From beb48a15b0fc15d26747dd7199244a34039e6561 Mon Sep 17 00:00:00 2001 From: brave-builds Date: Tue, 18 Jan 2022 22:50:03 -0800 Subject: [PATCH] Update adblock-resources from sugarcoat-update-dev --- dist/resources.json | 2 +- metadata.json | 196 +- ...t-0034123910e2a05f7a8ad0c58ef06f3bd4542217 | 1727 ++ ...t-01f64c522910b028219e9cec1cc1847395faeead | 3061 +++ ...t-076c7980e90e3f4c811295e17dcec5de21c8fd79 | 15136 ++++++++++++ ...t-0df9436bcc867b94a71bac256f2dba3713a377a0 | 7146 ++++++ ...t-20d16a205863d5a0eb56d0490a10be62d27324b9 | 8191 +++++++ ...t-501fa30f9f8155b71c084d4272d83dbd84a50120 | 205 + ...t-646e5b5090e12bb4f057679af94c25920631ff46 | 15769 +++++++++++++ ...t-78a233d465e2385b4f1804ca5bfbacecc08cc23b | 470 + ...t-7cf18f09d6a063650697adab76d51d51cddc3f58 | 990 + ...t-7ef6938db3b17aa422131955b7760870bc69ac0c | 14915 ++++++++++++ ...t-821a7439b994eb58f64748b0553bf1d5b78a731d | 12130 ++++++++++ ...t-8a781a44c232f576b9148f440e69f1a64d74d543 | 3931 ++++ ...t-8c173320401d8fc5291c1ea5e26e89a50fb17a42 | 483 + ...t-8db49593133758f7fe84678381f329915b2ccbe3 | 135 + ...t-972e8be011822bca0cb25ecca1f34fd347ca4875 | 19624 ++++++++++++++++ ...t-a8259f1424fe238ddadb822d18e5b54e9da87475 | 852 + ...t-bc51028c5fccd8dec101b0f2fc0e2887b1e7ef5e | 127 + ...t-cce8c1365e310397573f250aac085a12a8319bb7 | 18925 +++++++++++++++ ...t-d46a0542506f49cf865d98cb5ffd6c7a7854adb7 | 10386 ++++++++ ...t-dfc7510b217a08b434f81d37728e218b563e02e5 | 1247 + ...t-e40cf8b1b251a846b2adda42a1521d0b92745c79 | 3585 +++ ...t-ef97e7e3be5379b2e3627791e936581f734402bd | 2728 +++ ...t-f542409ccbdc9bf05ab43353222723e26ac37628 | 618 + ...t-f7ada209562e58fd31703fb8f6187652f7e75ed2 | 7150 ++++++ 26 files changed, 149726 insertions(+), 3 deletions(-) create mode 100644 resources/sugarcoat-0034123910e2a05f7a8ad0c58ef06f3bd4542217 create mode 100644 resources/sugarcoat-01f64c522910b028219e9cec1cc1847395faeead create mode 100644 resources/sugarcoat-076c7980e90e3f4c811295e17dcec5de21c8fd79 create mode 100644 resources/sugarcoat-0df9436bcc867b94a71bac256f2dba3713a377a0 create mode 100644 resources/sugarcoat-20d16a205863d5a0eb56d0490a10be62d27324b9 create mode 100644 resources/sugarcoat-501fa30f9f8155b71c084d4272d83dbd84a50120 create mode 100644 resources/sugarcoat-646e5b5090e12bb4f057679af94c25920631ff46 create mode 100644 resources/sugarcoat-78a233d465e2385b4f1804ca5bfbacecc08cc23b create mode 100644 resources/sugarcoat-7cf18f09d6a063650697adab76d51d51cddc3f58 create mode 100644 resources/sugarcoat-7ef6938db3b17aa422131955b7760870bc69ac0c create mode 100644 resources/sugarcoat-821a7439b994eb58f64748b0553bf1d5b78a731d create mode 100644 resources/sugarcoat-8a781a44c232f576b9148f440e69f1a64d74d543 create mode 100644 resources/sugarcoat-8c173320401d8fc5291c1ea5e26e89a50fb17a42 create mode 100644 resources/sugarcoat-8db49593133758f7fe84678381f329915b2ccbe3 create mode 100644 resources/sugarcoat-972e8be011822bca0cb25ecca1f34fd347ca4875 create mode 100644 resources/sugarcoat-a8259f1424fe238ddadb822d18e5b54e9da87475 create mode 100644 resources/sugarcoat-bc51028c5fccd8dec101b0f2fc0e2887b1e7ef5e create mode 100644 resources/sugarcoat-cce8c1365e310397573f250aac085a12a8319bb7 create mode 100644 resources/sugarcoat-d46a0542506f49cf865d98cb5ffd6c7a7854adb7 create mode 100644 resources/sugarcoat-dfc7510b217a08b434f81d37728e218b563e02e5 create mode 100644 resources/sugarcoat-e40cf8b1b251a846b2adda42a1521d0b92745c79 create mode 100644 resources/sugarcoat-ef97e7e3be5379b2e3627791e936581f734402bd create mode 100644 resources/sugarcoat-f542409ccbdc9bf05ab43353222723e26ac37628 create mode 100644 resources/sugarcoat-f7ada209562e58fd31703fb8f6187652f7e75ed2 diff --git a/dist/resources.json b/dist/resources.json index 189480e7..e925f50c 100644 --- a/dist/resources.json +++ b/dist/resources.json @@ -1 +1 @@ -[{"name":"async-sugarcoat-04394153a7ce417b88e3fe1790a4e6a269bfebe5","aliases":[],"kind":{"mime":"application/javascript"},"content":"e2NvbnN0IGE9e307KGU9PnsidXNlIHN0cmljdCI7Y29uc3QgdD1TeW1ib2woImRlZmVycmVkSGFuZGxlIiksbj1TeW1ib2woIm9ubG9hZHN0YXJ0IiksaT1TeW1ib2woIm9ucHJvZ3Jlc3MiKSxyPVN5bWJvbCgib25hYm9ydCIpLGE9U3ltYm9sKCJvbmVycm9yIiksbz1TeW1ib2woIm9ubG9hZCIpLHM9U3ltYm9sKCJvbnRpbWVvdXQiKSxnPVN5bWJvbCgib25sb2FkZW5kIiksbD1TeW1ib2woIm9ucmVhZHlzdGF0ZWNoYW5nZSIpLGQ9U3ltYm9sKCJyZWFkeVN0YXRlIiksdT1TeW1ib2woInRpbWVvdXQiKSxjPVN5bWJvbCgid2l0aENyZWRlbnRpYWxzIikscD1TeW1ib2woInVwbG9hZCIpLGg9U3ltYm9sKCJyZXNwb25zZVR5cGUiKSx2PShlLG4pPT57dmFyIHQ9bi5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7T2JqZWN0LmRlZmluZVByb3BlcnR5KGUsbix7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6bnVsbCx3cml0YWJsZTohMH0pLGUuYWRkRXZlbnRMaXN0ZW5lcih0LGZ1bmN0aW9uKGUpe2NvbnN0IHQ9dGhpc1tuXTt0JiZ0LmNhbGwodGhpcyxlKX0pfSxrPShlLHQpPT57ZVtkXT10LGUuZGlzcGF0Y2hFdmVudChuZXcgRXZlbnQoInJlYWR5c3RhdGVjaGFuZ2UiKSl9O2xldCBNPSEwO2NsYXNzIG0gZXh0ZW5kcyBFdmVudFRhcmdldHtjb25zdHJ1Y3Rvcigpe2lmKHN1cGVyKCksISh0aGlzIGluc3RhbmNlb2YgZnx8dGhpcyBpbnN0YW5jZW9mIHkpKXRocm93IG5ldyBUeXBlRXJyb3IoIklsbGVnYWwgY29uc3RydWN0b3IiKTt2KHRoaXMsbiksdih0aGlzLGkpLHYodGhpcyxyKSx2KHRoaXMsYSksdih0aGlzLG8pLHYodGhpcyxzKSx2KHRoaXMsZyl9Z2V0IG9ubG9hZHN0YXJ0KCl7cmV0dXJuIHRoaXNbbl19c2V0IG9ubG9hZHN0YXJ0KGUpe3RoaXNbbl09ZX1nZXQgb25wcm9ncmVzcygpe3JldHVybiB0aGlzW2ldfXNldCBvbnByb2dyZXNzKGUpe3RoaXNbaV09ZX1nZXQgb25hYm9ydCgpe3JldHVybiB0aGlzW3JdfXNldCBvbmFib3J0KGUpe3RoaXNbcl09ZX1nZXQgb25lcnJvcigpe3JldHVybiB0aGlzW2FdfXNldCBvbmVycm9yKGUpe3RoaXNbYV09ZX1nZXQgb250aW1lb3V0KCl7cmV0dXJuIHRoaXNbc119c2V0IG9udGltZW91dChlKXt0aGlzW3NdPWV9Z2V0IG9ubG9hZGVuZCgpe3JldHVybiB0aGlzW2ddfXNldCBvbmxvYWRlbmQoZSl7dGhpc1tnXT1lfX1lLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQ9e2NvbmZpZ3VyYWJsZTohMCxlbnVtZXJhYmxlOiEwLHZhbHVlOm0sd3JpdGFibGU6ITB9O2NsYXNzIHkgZXh0ZW5kcyBte2NvbnN0cnVjdG9yKCl7aWYoTSl0aHJvdyBuZXcgVHlwZUVycm9yKCJJbGxlZ2FsIGNvbnN0cnVjdG9yIik7c3VwZXIoKX19ZS5YTUxIdHRwUmVxdWVzdFVwbG9hZD17Y29uZmlndXJhYmxlOiEwLGVudW1lcmFibGU6ITAsdmFsdWU6eSx3cml0YWJsZTohMH07Y2xhc3MgZiBleHRlbmRzIG17Y29uc3RydWN0b3IoKXtzdXBlcigpLE09ITE7dmFyIGU9bmV3IHk7TT0hMCxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyx0LHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTpudWxsLHdyaXRhYmxlOiEwfSksdih0aGlzLGwpLE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLGQse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiExLHZhbHVlOjAsd3JpdGFibGU6ITB9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyx1LHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTowLHdyaXRhYmxlOiEwfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsYyx7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6ITEsd3JpdGFibGU6ITB9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyxwLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTplLHdyaXRhYmxlOiExfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsaCx7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6IiIsd3JpdGFibGU6ITB9KX1nZXQgb25yZWFkeXN0YXRlY2hhbmdlKCl7cmV0dXJuIHRoaXNbbF19c2V0IG9ucmVhZHlzdGF0ZWNoYW5nZShlKXt0aGlzW2xdPWV9Z2V0IHJlYWR5U3RhdGUoKXtyZXR1cm4gdGhpc1tkXX1vcGVuKGUsdCl7c3dpdGNoKHRoaXNbZF0pe2Nhc2UgMDpjYXNlIDQ6ayh0aGlzLDEpfX1zZXRSZXF1ZXN0SGVhZGVyKGUsdCl7fXNldFRydXN0VG9rZW4oZSl7fWdldCB0aW1lb3V0KCl7cmV0dXJuIHRoaXNbdV19c2V0IHRpbWVvdXQoZSl7dGhpc1t1XT1lfWdldCB3aXRoQ3JlZGVudGlhbHMoKXtyZXR1cm4gdGhpc1tjXX1zZXQgd2l0aENyZWRlbnRpYWxzKGUpe3N3aXRjaCh0aGlzW2RdKXtjYXNlIDA6Y2FzZSAxOmJyZWFrO2RlZmF1bHQ6dGhyb3cgbmV3IERPTUV4Y2VwdGlvbigiRmFpbGVkIHRvIHNldCB0aGUgJ3dpdGhDcmVkZW50aWFscycgcHJvcGVydHkgb24gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIHZhbHVlIG1heSBvbmx5IGJlIHNldCBpZiB0aGUgb2JqZWN0J3Mgc3RhdGUgaXMgVU5TRU5UIG9yIE9QRU5FRC4iKX10aGlzW2NdPSEhZX1nZXQgdXBsb2FkKCl7cmV0dXJuIHRoaXNbcF19c2VuZCgpe2lmKDEhPT10aGlzW2RdfHxudWxsIT09dGhpc1t0XSl0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCJGYWlsZWQgdG8gZXhlY3V0ZSAnc2VuZCcgb24gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIG9iamVjdCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELiIpO3RoaXNbdF09c2V0VGltZW91dCgoKT0+e3RoaXNbdF09bnVsbCxrKHRoaXMsNCksdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCJlcnJvciIpKSx0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoImxvYWRlbmQiKSl9LDApfWFib3J0KCl7MT09PXRoaXNbZF0mJm51bGwhPT10aGlzW3RdJiYoY2xlYXJUaW1lb3V0KHRoaXNbdF0pLHRoaXNbdF09bnVsbCxrKHRoaXMsMCksdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCJhYm9ydCIpKSx0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoImxvYWRlbmQiKSkpfWdldCByZXNwb25zZVVSTCgpe3JldHVybiIifWdldCBzdGF0dXMoKXtyZXR1cm4gMH1nZXQgc3RhdHVzVGV4dCgpe3JldHVybiIifWdldFJlc3BvbnNlSGVhZGVyKGUpe3JldHVybiBudWxsfW92ZXJyaWRlTWltZVR5cGUoZSl7fWdldCByZXNwb25zZVR5cGUoKXtyZXR1cm4gdGhpc1toXX1zZXQgcmVzcG9uc2VUeXBlKGUpe2lmKDQ9PT10aGlzW2RdKXRocm93IG5ldyBET01FeGNlcHRpb24oIkZhaWxlZCB0byBzZXQgdGhlICdyZXNwb25zZVR5cGUnIHByb3BlcnR5IG9uICdYTUxIdHRwUmVxdWVzdCc6IFRoZSByZXNwb25zZSB0eXBlIGNhbm5vdCBiZSBzZXQgaWYgdGhlIG9iamVjdCdzIHN0YXRlIGlzIExPQURJTkcgb3IgRE9ORS4iKTtzd2l0Y2goZSl7Y2FzZSIiOmNhc2UiYXJyYXlidWZmZXIiOmNhc2UiYmxvYiI6Y2FzZSJkb2N1bWVudCI6Y2FzZSJqc29uIjpjYXNlInRleHQiOnRoaXNbaF09ZX19Z2V0IHJlc3BvbnNlKCl7dmFyIGU9dGhpc1toXTtyZXR1cm4iIj09PWV8fCJ0ZXh0Ij09PWU/IiI6bnVsbH1nZXQgcmVzcG9uc2VUZXh0KCl7dmFyIGU9dGhpc1toXTtpZigiIj09PWV8fCJ0ZXh0Ij09PWUpcmV0dXJuIiI7dGhyb3cgbmV3IERPTUV4Y2VwdGlvbigiRmFpbGVkIHRvIHJlYWQgdGhlICdyZXNwb25zZVRleHQnIHByb3BlcnR5IGZyb20gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIHZhbHVlIGlzIG9ubHkgYWNjZXNzaWJsZSBpZiB0aGUgb2JqZWN0J3MgJ3Jlc3BvbnNlVHlwZScgaXMgJycgb3IgJ3RleHQnICh3YXMgJ2FycmF5YnVmZmVyJykuIil9Z2V0IHJlc3BvbnNlWE1MKCl7cmV0dXJuIG51bGx9fU9iamVjdC5kZWZpbmVQcm9wZXJ0eShmLCJVTlNFTlQiLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMCx2YWx1ZTowfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KGYsIk9QRU5FRCIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjF9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoZiwiSEVBREVSU19SRUNFSVZFRCIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjJ9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoZiwiTE9BRElORyIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjN9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoZiwiRE9ORSIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjR9KSxlLlhNTEh0dHBSZXF1ZXN0PXtjb25maWd1cmFibGU6ITAsZW51bWVyYWJsZTohMCx2YWx1ZTpmLHdyaXRhYmxlOiEwfX0pKGEpO2NvbnN0IGI9e307KGU9PnsidXNlIHN0cmljdCI7bGV0IHQ9ITE7Y2xhc3Mgbntjb25zdHJ1Y3Rvcigpe2lmKHQpdGhyb3cgbmV3IFR5cGVFcnJvcigiSWxsZWdhbCBjb25zdHJ1Y3RvciIpfWdldCBsZW5ndGgoKXtyZXR1cm4gT2JqZWN0LmtleXModGhpcykubGVuZ3RofWtleShlKXt2YXIgdD1PYmplY3Qua2V5cyh0aGlzKTtyZXR1cm4gZTwwfHxlPj10Lmxlbmd0aD9udWxsOnRbZV19Z2V0SXRlbShlKXtyZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHRoaXMsZSk/dGhpc1tlXTpudWxsfXNldEl0ZW0oZSx0KXt0aGlzW2VdPVN0cmluZyh0KX1yZW1vdmVJdGVtKGUpe2RlbGV0ZSB0aGlzW2VdfWNsZWFyKCl7Zm9yKGNvbnN0IGUgb2YgT2JqZWN0LmtleXModGhpcykpZGVsZXRlIHRoaXNbZV19fWUuU3RvcmFnZT17Y29uZmlndXJhYmxlOiEwLGVudW1lcmFibGU6ITAsdmFsdWU6bix3cml0YWJsZTohMH07Y29uc3QgaT1uZXcgbjtlLmxvY2FsU3RvcmFnZT17Y29uZmlndXJhYmxlOiEwLGVudW1lcmFibGU6ITAsZ2V0KCl7cmV0dXJuIGl9fTtjb25zdCByPW5ldyBuO2Uuc2Vzc2lvblN0b3JhZ2U9e2NvbmZpZ3VyYWJsZTohMCxlbnVtZXJhYmxlOiEwLGdldCgpe3JldHVybiByfX0sdD0hMH0pKGIpLE1hcmtldGluZy5iaW5kRGVwZW5kZW5jeUltbWVkaWF0ZShmdW5jdGlvbigpe3dpbmRvdy5NYXJrZXRpbmcsTWFya2V0aW5nLmVuc2lnaHRlbk9wdGlvbnM7dHJ5e01hcmtldGluZy5VRE8ucGVyZlRpbWluZ1N0YXJ0KCJydWxlSWQtIit0aGlzLmlkKyItZGVwbG95bWVudElkLSIrdGhpcy5kZXBsb3ltZW50SWQpLCJ0cnVlIj09ZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRQYXJhbWV0ZXJCeU5hbWUoIm1kZWJ1ZyIsbG9jYXRpb24uc2VhcmNoKSYmKGRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0RHBpZD1mdW5jdGlvbigpe3JldHVybihuZXcgRGF0ZSkuZ2V0VGltZSgpfSxNYXJrZXRpbmcuZ0V2ZW50KCJEQy05NjMyNjQ1L3NhbGVzMC9jc2JfdGVzdCt0cmFuc2FjdGlvbnMiLCJwdXJjaGFzZSIpLGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoImlmcmFtZSIpLmZvckVhY2goZnVuY3Rpb24oZSl7ZS5zcmMuaW5jbHVkZXMoInR5cGU9c2FsZXMiKSYmZS5jb250ZW50V2luZG93LnBvc3RNZXNzYWdlKEpTT04uc3RyaW5naWZ5KE1hcmtldGluZyksIioiKX0pKSxNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoInJ1bGVJZC0iK3RoaXMuaWQrIi1kZXBsb3ltZW50SWQtIit0aGlzLmRlcGxveW1lbnRJZCl9Y2F0Y2goZSl7ZGVsbF9tYXJrZXRpbmdfdXRpbC5kZWJ1ZyhlKX19LDM2MDAzMTEsWzM2MTc2ODJdLDYzNjE0MixbNjE5NDA0XSksTWFya2V0aW5nLmJpbmREZXBlbmRlbmN5RE9NUGFyc2VkKGZ1bmN0aW9uKCl7dmFyIG4sZSxpLHQscjt3aW5kb3cuTWFya2V0aW5nLE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zO3RyeXtNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdTdGFydCgicnVsZUlkLSIrdGhpcy5pZCsiLWRlcGxveW1lbnRJZC0iK3RoaXMuZGVwbG95bWVudElkKSxuPXdpbmRvdyxlPWRvY3VtZW50LG5baT0idWV0cSJdPW5baV18fFtdLHQ9ZnVuY3Rpb24oKXt2YXIgZT17fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCJYTUxIdHRwUmVxdWVzdCIpLHQ9e30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywibG9jYWxTdG9yYWdlIik7dHJ5e3JldHVybiBlJiZ7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csIlhNTEh0dHBSZXF1ZXN0IixhLlhNTEh0dHBSZXF1ZXN0KSx0JiZ7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csImxvY2FsU3RvcmFnZSIsYi5sb2NhbFN0b3JhZ2UpLGZ1bmN0aW9uKCl7dmFyIGU9e3RpOiI1MTAyMjYxIn07ZS5xPW5baV0sbltpXT1uZXcgVUVUKGUpLG5baV0ucHVzaCgicGFnZUxvYWQiKX0uYXBwbHkodGhpcyxhcmd1bWVudHMpfWZpbmFsbHl7ZSYme30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCJYTUxIdHRwUmVxdWVzdCIsZSksdCYme30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCJsb2NhbFN0b3JhZ2UiLHQpfX0sKHI9ZS5jcmVhdGVFbGVtZW50KCJzY3JpcHQiKSkuc3JjPSIvL2JhdC5iaW5nLmNvbS9iYXQuanMiLHIuYXN5bmM9MSxyLm9ubG9hZD1yLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpe3ZhciBlPXRoaXMucmVhZHlTdGF0ZTtlJiYibG9hZGVkIiE9PWUmJiJjb21wbGV0ZSIhPT1lfHwodCgpLHIub25sb2FkPXIub25yZWFkeXN0YXRlY2hhbmdlPW51bGwpfSwoZT1lLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJzY3JpcHQiKVswXSkucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUocixlKSxNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoInJ1bGVJZC0iK3RoaXMuaWQrIi1kZXBsb3ltZW50SWQtIit0aGlzLmRlcGxveW1lbnRJZCl9Y2F0Y2goZSl7ZGVsbF9tYXJrZXRpbmdfdXRpbC5kZWJ1ZyhlKX19LDM2MDUyNDIsWzM2MDYzMjldLDY5NTg3NCxbNjEwMzIzXSksTWFya2V0aW5nLmJpbmREZXBlbmRlbmN5RE9NUGFyc2VkKGZ1bmN0aW9uKCl7dmFyIGU7d2luZG93Lk1hcmtldGluZyxNYXJrZXRpbmcuZW5zaWdodGVuT3B0aW9uczt0cnl7TWFya2V0aW5nLlVETy5wZXJmVGltaW5nU3RhcnQoInJ1bGVJZC0iK3RoaXMuaWQrIi1kZXBsb3ltZW50SWQtIit0aGlzLmRlcGxveW1lbnRJZCksTWFya2V0aW5nLlVETy5wcmlvcmNvbnNlbnQmJigidXMiPT09KGU9TWFya2V0aW5nLnNjRGF0YU9iai5jb3VudHJ5KSYmTWFya2V0aW5nLmluc2VydFNjcmlwdCgiLy92dC5teXZpc3VhbGlxLm5ldC8yL1R4VVFOSFNLdkdXSWlNajFPaDN0ZnclM0QlM0QvdnQtMjg4LmpzIiksImNhIj09PWUmJk1hcmtldGluZy5pbnNlcnRTY3JpcHQoIi8vdnQubXl2aXN1YWxpcS5uZXQvMi9UeFVRTkhTS3ZHV0lpTWoxT2gzdGZ3JTNEJTNEL3Z0LTI4OS5qcyIpLCJiciI9PT1lJiZNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCIvL3Z0Lm15dmlzdWFsaXEubmV0LzIvd1FRdFRpaXpsNFNpeHJoSVR5VHFiZyUzRCUzRC92dC0yODYuanMiKSwidWsiPT09ZSYmTWFya2V0aW5nLmluc2VydFNjcmlwdCgiLy92dC5teXZpc3VhbGlxLm5ldC8yL2FtaTdlV0Q3TWE5cWt1OUhERzIzMnclM0QlM0QvdnQtMjEzLmpzIiksImpwIj09PWUmJk1hcmtldGluZy5pbnNlcnRTY3JpcHQoIi8vdnQubXl2aXN1YWxpcS5uZXQvMi82JTJCeFQlMkJPM3oxemgxNHl1bEpCRE42ZyUzRCUzRC92dC0yODcuanMiKSwiYXUiPT09ZSYmTWFya2V0aW5nLmluc2VydFNjcmlwdCgiLy92dC5teXZpc3VhbGlxLm5ldC8yL2lwZWV5SGh0NG5wUUVpemlDV2FZenclM0QlM0QvdnQtMjk5LmpzIiksIm56Ij09PWUmJk1hcmtldGluZy5pbnNlcnRTY3JpcHQoIi8vdnQubXl2aXN1YWxpcS5uZXQvMi9pcGVleUhodDRucFFFaXppQ1dhWXp3JTNEJTNEL3Z0LTMwMS5qcyIpLCJpbiI9PT1lJiZNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCIvL3Z0Lm15dmlzdWFsaXEubmV0LzIvdUJGJTJCbmRKVDduMHI5V3lzTkkxVnd3JTNEJTNEL3Z0LTI5OC5qcyIpLCJmciI9PT1lJiZNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCIvL3Z0Lm15dmlzdWFsaXEubmV0LzIvR1hPZE4lMkJXdWdZM04zbjRhNUxBa05RJTNEJTNEL3Z0LTMwMC5qcyIpLCJkZSI9PT1lJiZNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCIvL3Z0Lm15dmlzdWFsaXEubmV0LzIvdjlCSk9HY2dsNHdmam43cFhCaHVuQSUzRCUzRC92dC0zMDIuanMiKSksTWFya2V0aW5nLlVETy5wZXJmVGltaW5nRW5kKCJydWxlSWQtIit0aGlzLmlkKyItZGVwbG95bWVudElkLSIrdGhpcy5kZXBsb3ltZW50SWQpfWNhdGNoKGUpe2RlbGxfbWFya2V0aW5nX3V0aWwuZGVidWcoZSl9fSwzNTkzMzY1LFszNTA2OTI0LDM2MDYzMjldLDYyMTkxOSxbNjEwMzEwLDYxMDMyM10pLE1hcmtldGluZy5iaW5kRE9NUGFyc2VkKGZ1bmN0aW9uKCl7d2luZG93Lk1hcmtldGluZyxNYXJrZXRpbmcuZW5zaWdodGVuT3B0aW9uczt0cnl7TWFya2V0aW5nLlVETy5wZXJmVGltaW5nU3RhcnQoInJ1bGVJZC0iK3RoaXMuaWQrIi1kZXBsb3ltZW50SWQtIit0aGlzLmRlcGxveW1lbnRJZCksTWFya2V0aW5nLlVETy5wcmlvcmNvbnNlbnQmJk1hcmtldGluZy5pbWFnZVJlcXVlc3QoImh0dHBzOi8vcHguYWRzLmxpbmtlZGluLmNvbS9jb2xsZWN0Lz9waWQ9NzUxMyZmbXQ9Z2lmIiksTWFya2V0aW5nLlVETy5wZXJmVGltaW5nRW5kKCJydWxlSWQtIit0aGlzLmlkKyItZGVwbG95bWVudElkLSIrdGhpcy5kZXBsb3ltZW50SWQpfWNhdGNoKGUpe2RlbGxfbWFya2V0aW5nX3V0aWwuZGVidWcoZSl9fSwzNTkzMjg3LDYxOTA4OSksTWFya2V0aW5nLmJpbmREZXBlbmRlbmN5SW1tZWRpYXRlKGZ1bmN0aW9uKCl7dmFyIGkscixlO3dpbmRvdy5NYXJrZXRpbmcsTWFya2V0aW5nLmVuc2lnaHRlbk9wdGlvbnM7TWFya2V0aW5nLlVETy5mbF9sb2FkZWQ9ITEsTWFya2V0aW5nLlVETy5wcmlvcmNvbnNlbnQmJihNYXJrZXRpbmcubG9hZFNjcmlwdENhbGxiYWNrKCJodHRwczovL3d3dy5nb29nbGV0YWdtYW5hZ2VyLmNvbS9ndGFnL2pzP2lkPURDLTk2MzI2NDUiLGZ1bmN0aW9uKCl7ZGVsbF9tYXJrZXRpbmdfdXRpbC5jdXN0b21fbWFya2V0aW5nX2V2ZW50KCJmbF9sb2FkZWQiKSxNYXJrZXRpbmcuVURPLmZsX2xvYWRlZD0hMH0pLHdpbmRvdy5kYXRhTGF5ZXI9d2luZG93LmRhdGFMYXllcnx8W10sd2luZG93Lmd0YWc9ZnVuY3Rpb24oKXtkYXRhTGF5ZXIucHVzaChhcmd1bWVudHMpfSxndGFnKCJqcyIsbmV3IERhdGUpLGd0YWcoImNvbmZpZyIsIkRDLTk2MzI2NDUiKSxndGFnKCJjb25maWciLCJEQy05NjMyOTIxIiksZ3RhZygiY29uZmlnIiwiREMtOTYzMjY0OCIpLGk9ZnVuY3Rpb24oKXtyZXR1cm57YWxsb3dfY3VzdG9tX3NjcmlwdHM6ITAsdTE6TWFya2V0aW5nLlVETy5sYW5ndWFnZSx1MTA6TWFya2V0aW5nLlVETy5jc2VnLHUxMTpNYXJrZXRpbmcuVURPLmRlYWxzLHUxMjpNYXJrZXRpbmcuVURPLmRldmljZSx1MTM6TWFya2V0aW5nLlVETy5kaXNjb3VudCx1MTQ6TWFya2V0aW5nLlVETy5mYW1pbHksdTE1Ok1hcmtldGluZy5VRE8ub2dpZCx1MTY6TWFya2V0aW5nLlVETy5vcmRlcmNvZGUsdTE3Ok1hcmtldGluZy5VRE8ucGxhdGZvcm0sdTE4Ok1hcmtldGluZy5VRE8ucHJvZGNhdCx1MTk6TWFya2V0aW5nLlVETy5wcm9kdWN0LHUyOk1hcmtldGluZy5VRE8uc2VnbWVudCx1MjA6TWFya2V0aW5nLlVETy5wcm9tb2lkLHUyMTpNYXJrZXRpbmcuVURPLnR5cGUsdTIyOmRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0UGFyYW1ldGVyQnlOYW1lKCJkZ2MiLGxvY2F0aW9uLnRvU3RyaW5nKCkudG9Mb3dlckNhc2UoKSksdTIzOk1hcmtldGluZy5VRE8uZ2FjZCx1MjQ6ZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRQYXJhbWV0ZXJCeU5hbWUoImxpZCIsbG9jYXRpb24udG9TdHJpbmcoKS50b0xvd2VyQ2FzZSgpKSx1MjU6TWFya2V0aW5nLlVETy52ZW4xLHUyNjpNYXJrZXRpbmcuVURPLnZlbjIsdTI4OmRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0UGFyYW1ldGVyQnlOYW1lKCJ0ZmNpZCIsbG9jYXRpb24udG9TdHJpbmcoKS50b0xvd2VyQ2FzZSgpKSx1Mjk6TWFya2V0aW5nLlVETy5yZXZlbnVlLHUzOk1hcmtldGluZy5VRE8uY3VycmVuY3ksdTMwOk1hcmtldGluZy5VRE8udXNkcmV2LHUzNTpNYXJrZXRpbmcuVURPLmRwaWQsdTM2Ok1hcmtldGluZy5VRE8ubGFuZCx1Mzc6TWFya2V0aW5nLlVETy5zZXJpYWxwcm9kbGlzdCx1Mzg6TWFya2V0aW5nLlVETy5jamV2ZW50LHU0Ok1hcmtldGluZy5VRE8uY291bnRyeSx1NTpNYXJrZXRpbmcuVURPLmFjY291bnRpZCx1NjpNYXJrZXRpbmcuVURPLmNhdGVnb3J5LHU3Ok1hcmtldGluZy5VRE8uY2F0ZWdvcnlwYXRoLHU4Ok1hcmtldGluZy5VRE8uY2lkLHU5Ok1hcmtldGluZy5VRE8uY291cG9ufX0sTWFya2V0aW5nLlVETy5yZWFkRGF0YSgpLChyPWkoKSkudTMxPSIiLChlPWRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0Q29va2llKCJBTUNWXzRERDgwODYxNTE1Q0FCOTkwQTQ5MEQ0NSU0MEFkb2JlT3JnIikpJiYoci51MzE9ZS5zcGxpdCgiTUNNSUR8IilbMV0uc3BsaXQoInwiKVswXSksTWFya2V0aW5nLmdFdmVudD1NYXJrZXRpbmcuZ0V2ZW50fHxmdW5jdGlvbih0LG4pe3ZhciBlO3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJmbF9sb2FkZWQiLGZ1bmN0aW9uKCl7dmFyIGU9cjsicHVyY2hhc2UiPT09biYmKGUudmFsdWU9TWFya2V0aW5nLlVETy51c2RyZXZ8fE1hcmtldGluZy5VRE8ucmV2ZW51ZSxlLnRyYW5zYWN0aW9uX2lkPWRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0RHBpZCgpKSxlLnNlbmRfdG89dCxndGFnKCJldmVudCIsbixlKX0pLE1hcmtldGluZy5VRE8uZmxfbG9hZGVkJiYoZT1yPWkoKSwicHVyY2hhc2UiPT09biYmKGUudmFsdWU9TWFya2V0aW5nLlVETy51c2RyZXZ8fE1hcmtldGluZy5VRE8ucmV2ZW51ZSxlLnRyYW5zYWN0aW9uX2lkPWRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0RHBpZCgpKSxlLnNlbmRfdG89dCxndGFnKCJldmVudCIsbixlKSl9KX0sMzYxNzY4MixbMzYwNjMyOV0sNjE5NDA0LFs2MTAzMjNdKSxNYXJrZXRpbmcuYmluZERlcGVuZGVuY3lJbW1lZGlhdGUoZnVuY3Rpb24oKXt3aW5kb3cuTWFya2V0aW5nLE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zO01hcmtldGluZy5VRE8uZ19kb3dubG9hZD1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpe01hcmtldGluZy5VRE8uaHZlb3ZlcmxheT0hMSwiZG93bmxvYWQiPT09ZS5kZXRhaWwudHlwZSYmTWFya2V0aW5nLmdFdmVudCh0LG4pfSksTWFya2V0aW5nLlVETy5odmVvdmVybGF5JiZNYXJrZXRpbmcuZ0V2ZW50KHQsbil9LE1hcmtldGluZy5VRE8uZ19zaGFyZT1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpeyJzaGFyZSI9PT1lLmRldGFpbC50eXBlJiZNYXJrZXRpbmcuZ0V2ZW50KHQsbil9KX0sTWFya2V0aW5nLlVETy5nX21wdj1mdW5jdGlvbihlLHQpezM9PXNlc3Npb25TdG9yYWdlLmVuc3BhZ2Vjb3VudEZMVCYmTWFya2V0aW5nLmdFdmVudChlLHQpfSxNYXJrZXRpbmcuVURPLmdfYmNfc3RhcnQ9ZnVuY3Rpb24obixpKXtpZigidW5kZWZpbmVkIiE9dHlwZW9mIHZpZGVvanMmJnZpZGVvanMucGxheWVycylmb3IodmFyIGUgaW4gdmlkZW9qcy5wbGF5ZXJzKXZpZGVvanMucGxheWVyc1tlXS5yZWFkeShmdW5jdGlvbigpe3ZhciBlPXRoaXM7ZS5lbF8uaGFzQXR0cmlidXRlKCJtdXRlZCIpfHxlLm9uKCJzdGFydCIsZnVuY3Rpb24oKXtlLnZpZGVvX3N0YXJ0fHwoZS52aWRlb181MF9wZXJjZW50PSExLGUudmlkZW9fODBfcGVyY2VudD0hMSxNYXJrZXRpbmcuZ0V2ZW50KG4saSkpfSl9KTtlbHNlIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uIGUodCl7ImJyaWdodGNvdmUiPT09dC5kZXRhaWwudHlwZSYmKE1hcmtldGluZy5VRE8uZ19iY19zdGFydChuLGkpLHdpbmRvdy5yZW1vdmVFdmVudExpc3RlbmVyKCJodmUiLGUpKX0pfSxNYXJrZXRpbmcuVURPLmdfYmNfNTA9ZnVuY3Rpb24odCxuKXt3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigiYnJpZ2h0Y292ZTUwIixmdW5jdGlvbihlKXtNYXJrZXRpbmcuZ0V2ZW50KHQsbil9KX0sTWFya2V0aW5nLlVETy5nX2JjXzgwPWZ1bmN0aW9uKHQsbil7d2luZG93LmFkZEV2ZW50TGlzdGVuZXIoImJyaWdodGNvdmU4MCIsZnVuY3Rpb24oZSl7TWFya2V0aW5nLmdFdmVudCh0LG4pfSl9LE1hcmtldGluZy5VRE8uZ19iY19lbmQ9ZnVuY3Rpb24obixpKXtpZigidW5kZWZpbmVkIiE9dHlwZW9mIHZpZGVvanMmJnZpZGVvanMucGxheWVycylmb3IodmFyIGUgaW4gdmlkZW9qcy5wbGF5ZXJzKXZpZGVvanMucGxheWVyc1tlXS5yZWFkeShmdW5jdGlvbigpe3ZhciBlPXRoaXM7ZS5lbF8uaGFzQXR0cmlidXRlKCJtdXRlZCIpfHxlLm9uKCJlbmRlZCIsZnVuY3Rpb24oKXtNYXJrZXRpbmcuZ0V2ZW50KG4saSksZS52aWRlb19zdGFydD0hMX0pfSk7ZWxzZSB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigiaHZlIixmdW5jdGlvbiBlKHQpeyJicmlnaHRjb3ZlIj09PXQuZGV0YWlsLnR5cGUmJihNYXJrZXRpbmcuVURPLmdfYmNfZW5kKG4saSksd2luZG93LnJlbW92ZUV2ZW50TGlzdGVuZXIoImh2ZSIsZSkpfSl9LE1hcmtldGluZy5VRE8uZ19jb250YWN0dXM9ZnVuY3Rpb24odCxuKXt3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigiaHZlIixmdW5jdGlvbihlKXsiY29udGFjdHVzIj09PWUuZGV0YWlsLnR5cGUmJk1hcmtldGluZy5nRXZlbnQodCxuKX0pfSxNYXJrZXRpbmcuVURPLmdfY2hhdD1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpeyJjaGF0Ij09PWUuZGV0YWlsLnR5cGUmJk1hcmtldGluZy5nRXZlbnQodCxuKX0pfSxNYXJrZXRpbmcuVURPLmdfYWRkdG9jYXJ0PWZ1bmN0aW9uKGUsdCl7ImNvbnRlbnRzIiE9PWRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0c2NNYXAoIndhY29udHJvbGxlciIpJiYiY2FydCIhPT1kZWxsX21hcmtldGluZ191dGlsLmdldHNjTWFwKCJ3b3JrZmxvd3N0ZXAiKXx8TWFya2V0aW5nLmdFdmVudChlLHQpfSxNYXJrZXRpbmcuVURPLmdfY2hlY2tvdXQ9ZnVuY3Rpb24oZSx0KXsiY29uZmlybWF0aW9uIj09PWRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0c2NNYXAoIndhY29udHJvbGxlciIpJiZNYXJrZXRpbmcuZ0V2ZW50KGUsdCl9LE1hcmtldGluZy5VRE8uZ19wb2RjYXN0X2xpc3Rlbj1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpeyJwb2RjYXN0X2xpc3RlbiI9PT1lLmRldGFpbC50eXBlJiZNYXJrZXRpbmcuZ0V2ZW50KHQsbil9KX0sTWFya2V0aW5nLlVETy5nX3BvZGNhc3Rfc3Vic2NyaWJlPWZ1bmN0aW9uKHQsbil7d2luZG93LmFkZEV2ZW50TGlzdGVuZXIoImh2ZSIsZnVuY3Rpb24oZSl7InBvZGNhc3Rfc3Vic2NyaWJlIj09PWUuZGV0YWlsLnR5cGUmJk1hcmtldGluZy5nRXZlbnQodCxuKX0pfSxNYXJrZXRpbmcuVURPLmdfcmZxX3N1Ym1pdD1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpeyJyZnFfc3VibWl0Ij09PWUuZGV0YWlsLnR5cGUmJk1hcmtldGluZy5nRXZlbnQodCxuKX0pfSxNYXJrZXRpbmcuVURPLmdfaW9uX3N1Ym1pdD1mdW5jdGlvbihlLHQpey9saXZlYmFsbC4qY29tcGxldGVkL2dpLnRlc3QoZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRzY01hcCgicGFnZW5hbWUiKSkmJk1hcmtldGluZy5nRXZlbnQoZSx0KX0sTWFya2V0aW5nLlVETy5nX2dhdGVkX3N1Ym1pdD1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpeyJnYXRlZF9zdWJtaXQiPT09ZS5kZXRhaWwudHlwZSYmTWFya2V0aW5nLmdFdmVudCh0LG4pfSl9fSwzNDc1MTkzLFszNjE3NjgyXSw2MjA4MTgsWzYxOTQwNF0pfQo="},{"name":"async-sugarcoat-8a459c41783885dc83d30f5b7da2359091f4e607","aliases":[],"kind":{"mime":"application/javascript"},"content":"e2NvbnN0IGE9e307KHQ9PnsidXNlIHN0cmljdCI7Y29uc3QgZT1TeW1ib2woImRlZmVycmVkSGFuZGxlIiksbj1TeW1ib2woIm9ubG9hZHN0YXJ0Iikscj1TeW1ib2woIm9ucHJvZ3Jlc3MiKSxhPVN5bWJvbCgib25hYm9ydCIpLG89U3ltYm9sKCJvbmVycm9yIiksaT1TeW1ib2woIm9ubG9hZCIpLHM9U3ltYm9sKCJvbnRpbWVvdXQiKSxjPVN5bWJvbCgib25sb2FkZW5kIiksdT1TeW1ib2woIm9ucmVhZHlzdGF0ZWNoYW5nZSIpLGw9U3ltYm9sKCJyZWFkeVN0YXRlIiksZz1TeW1ib2woInRpbWVvdXQiKSxoPVN5bWJvbCgid2l0aENyZWRlbnRpYWxzIiksZj1TeW1ib2woInVwbG9hZCIpLGQ9U3ltYm9sKCJyZXNwb25zZVR5cGUiKSxwPSh0LG4pPT57dmFyIGU9bi5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7T2JqZWN0LmRlZmluZVByb3BlcnR5KHQsbix7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6bnVsbCx3cml0YWJsZTohMH0pLHQuYWRkRXZlbnRMaXN0ZW5lcihlLGZ1bmN0aW9uKHQpe2NvbnN0IGU9dGhpc1tuXTtlJiZlLmNhbGwodGhpcyx0KX0pfSx2PSh0LGUpPT57dFtsXT1lLHQuZGlzcGF0Y2hFdmVudChuZXcgRXZlbnQoInJlYWR5c3RhdGVjaGFuZ2UiKSl9O2xldCBtPSEwO2NsYXNzIGIgZXh0ZW5kcyBFdmVudFRhcmdldHtjb25zdHJ1Y3Rvcigpe2lmKHN1cGVyKCksISh0aGlzIGluc3RhbmNlb2YgeXx8dGhpcyBpbnN0YW5jZW9mIHcpKXRocm93IG5ldyBUeXBlRXJyb3IoIklsbGVnYWwgY29uc3RydWN0b3IiKTtwKHRoaXMsbikscCh0aGlzLHIpLHAodGhpcyxhKSxwKHRoaXMsbykscCh0aGlzLGkpLHAodGhpcyxzKSxwKHRoaXMsYyl9Z2V0IG9ubG9hZHN0YXJ0KCl7cmV0dXJuIHRoaXNbbl19c2V0IG9ubG9hZHN0YXJ0KHQpe3RoaXNbbl09dH1nZXQgb25wcm9ncmVzcygpe3JldHVybiB0aGlzW3JdfXNldCBvbnByb2dyZXNzKHQpe3RoaXNbcl09dH1nZXQgb25hYm9ydCgpe3JldHVybiB0aGlzW2FdfXNldCBvbmFib3J0KHQpe3RoaXNbYV09dH1nZXQgb25lcnJvcigpe3JldHVybiB0aGlzW29dfXNldCBvbmVycm9yKHQpe3RoaXNbb109dH1nZXQgb250aW1lb3V0KCl7cmV0dXJuIHRoaXNbc119c2V0IG9udGltZW91dCh0KXt0aGlzW3NdPXR9Z2V0IG9ubG9hZGVuZCgpe3JldHVybiB0aGlzW2NdfXNldCBvbmxvYWRlbmQodCl7dGhpc1tjXT10fX10LlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQ9e2NvbmZpZ3VyYWJsZTohMCxlbnVtZXJhYmxlOiEwLHZhbHVlOmIsd3JpdGFibGU6ITB9O2NsYXNzIHcgZXh0ZW5kcyBie2NvbnN0cnVjdG9yKCl7aWYobSl0aHJvdyBuZXcgVHlwZUVycm9yKCJJbGxlZ2FsIGNvbnN0cnVjdG9yIik7c3VwZXIoKX19dC5YTUxIdHRwUmVxdWVzdFVwbG9hZD17Y29uZmlndXJhYmxlOiEwLGVudW1lcmFibGU6ITAsdmFsdWU6dyx3cml0YWJsZTohMH07Y2xhc3MgeSBleHRlbmRzIGJ7Y29uc3RydWN0b3IoKXtzdXBlcigpLG09ITE7dmFyIHQ9bmV3IHc7bT0hMCxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyxlLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTpudWxsLHdyaXRhYmxlOiEwfSkscCh0aGlzLHUpLE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLGwse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiExLHZhbHVlOjAsd3JpdGFibGU6ITB9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyxnLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTowLHdyaXRhYmxlOiEwfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsaCx7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6ITEsd3JpdGFibGU6ITB9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyxmLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTp0LHdyaXRhYmxlOiExfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsZCx7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6IiIsd3JpdGFibGU6ITB9KX1nZXQgb25yZWFkeXN0YXRlY2hhbmdlKCl7cmV0dXJuIHRoaXNbdV19c2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh0KXt0aGlzW3VdPXR9Z2V0IHJlYWR5U3RhdGUoKXtyZXR1cm4gdGhpc1tsXX1vcGVuKHQsZSl7c3dpdGNoKHRoaXNbbF0pe2Nhc2UgMDpjYXNlIDQ6dih0aGlzLDEpfX1zZXRSZXF1ZXN0SGVhZGVyKHQsZSl7fXNldFRydXN0VG9rZW4odCl7fWdldCB0aW1lb3V0KCl7cmV0dXJuIHRoaXNbZ119c2V0IHRpbWVvdXQodCl7dGhpc1tnXT10fWdldCB3aXRoQ3JlZGVudGlhbHMoKXtyZXR1cm4gdGhpc1toXX1zZXQgd2l0aENyZWRlbnRpYWxzKHQpe3N3aXRjaCh0aGlzW2xdKXtjYXNlIDA6Y2FzZSAxOmJyZWFrO2RlZmF1bHQ6dGhyb3cgbmV3IERPTUV4Y2VwdGlvbigiRmFpbGVkIHRvIHNldCB0aGUgJ3dpdGhDcmVkZW50aWFscycgcHJvcGVydHkgb24gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIHZhbHVlIG1heSBvbmx5IGJlIHNldCBpZiB0aGUgb2JqZWN0J3Mgc3RhdGUgaXMgVU5TRU5UIG9yIE9QRU5FRC4iKX10aGlzW2hdPSEhdH1nZXQgdXBsb2FkKCl7cmV0dXJuIHRoaXNbZl19c2VuZCgpe2lmKDEhPT10aGlzW2xdfHxudWxsIT09dGhpc1tlXSl0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCJGYWlsZWQgdG8gZXhlY3V0ZSAnc2VuZCcgb24gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIG9iamVjdCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELiIpO3RoaXNbZV09c2V0VGltZW91dCgoKT0+e3RoaXNbZV09bnVsbCx2KHRoaXMsNCksdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCJlcnJvciIpKSx0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoImxvYWRlbmQiKSl9LDApfWFib3J0KCl7MT09PXRoaXNbbF0mJm51bGwhPT10aGlzW2VdJiYoY2xlYXJUaW1lb3V0KHRoaXNbZV0pLHRoaXNbZV09bnVsbCx2KHRoaXMsMCksdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCJhYm9ydCIpKSx0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoImxvYWRlbmQiKSkpfWdldCByZXNwb25zZVVSTCgpe3JldHVybiIifWdldCBzdGF0dXMoKXtyZXR1cm4gMH1nZXQgc3RhdHVzVGV4dCgpe3JldHVybiIifWdldFJlc3BvbnNlSGVhZGVyKHQpe3JldHVybiBudWxsfW92ZXJyaWRlTWltZVR5cGUodCl7fWdldCByZXNwb25zZVR5cGUoKXtyZXR1cm4gdGhpc1tkXX1zZXQgcmVzcG9uc2VUeXBlKHQpe2lmKDQ9PT10aGlzW2xdKXRocm93IG5ldyBET01FeGNlcHRpb24oIkZhaWxlZCB0byBzZXQgdGhlICdyZXNwb25zZVR5cGUnIHByb3BlcnR5IG9uICdYTUxIdHRwUmVxdWVzdCc6IFRoZSByZXNwb25zZSB0eXBlIGNhbm5vdCBiZSBzZXQgaWYgdGhlIG9iamVjdCdzIHN0YXRlIGlzIExPQURJTkcgb3IgRE9ORS4iKTtzd2l0Y2godCl7Y2FzZSIiOmNhc2UiYXJyYXlidWZmZXIiOmNhc2UiYmxvYiI6Y2FzZSJkb2N1bWVudCI6Y2FzZSJqc29uIjpjYXNlInRleHQiOnRoaXNbZF09dH19Z2V0IHJlc3BvbnNlKCl7dmFyIHQ9dGhpc1tkXTtyZXR1cm4iIj09PXR8fCJ0ZXh0Ij09PXQ/IiI6bnVsbH1nZXQgcmVzcG9uc2VUZXh0KCl7dmFyIHQ9dGhpc1tkXTtpZigiIj09PXR8fCJ0ZXh0Ij09PXQpcmV0dXJuIiI7dGhyb3cgbmV3IERPTUV4Y2VwdGlvbigiRmFpbGVkIHRvIHJlYWQgdGhlICdyZXNwb25zZVRleHQnIHByb3BlcnR5IGZyb20gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIHZhbHVlIGlzIG9ubHkgYWNjZXNzaWJsZSBpZiB0aGUgb2JqZWN0J3MgJ3Jlc3BvbnNlVHlwZScgaXMgJycgb3IgJ3RleHQnICh3YXMgJ2FycmF5YnVmZmVyJykuIil9Z2V0IHJlc3BvbnNlWE1MKCl7cmV0dXJuIG51bGx9fU9iamVjdC5kZWZpbmVQcm9wZXJ0eSh5LCJVTlNFTlQiLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMCx2YWx1ZTowfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KHksIk9QRU5FRCIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjF9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoeSwiSEVBREVSU19SRUNFSVZFRCIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjJ9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoeSwiTE9BRElORyIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjN9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoeSwiRE9ORSIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjR9KSx0LlhNTEh0dHBSZXF1ZXN0PXtjb25maWd1cmFibGU6ITAsZW51bWVyYWJsZTohMCx2YWx1ZTp5LHdyaXRhYmxlOiEwfX0pKGEpLGZ1bmN0aW9uKCl7ZnVuY3Rpb24gdCh0LGUpe3Q9dC5zcGxpdCgiLiIpO3ZhciBuLHI9YTt0WzBdaW4gcnx8dm9pZCAwPT09ci5leGVjU2NyaXB0fHxyLmV4ZWNTY3JpcHQoInZhciAiK3RbMF0pO2Zvcig7dC5sZW5ndGgmJihuPXQuc2hpZnQoKSk7KXQubGVuZ3RofHx2b2lkIDA9PT1lP3I9cltuXSYmcltuXSE9PU9iamVjdC5wcm90b3R5cGVbbl0/cltuXTpyW25dPXt9OnJbbl09ZX1mdW5jdGlvbiBzKHQpe2Zvcih2YXIgZSBpbiB0KWlmKHQuaGFzT3duUHJvcGVydHkoZSkpcmV0dXJuIDF9ZnVuY3Rpb24gbyh0LGUpe3AuYWRkRXZlbnRMaXN0ZW5lcj9wLmFkZEV2ZW50TGlzdGVuZXIodCxlLCExKTpwLmF0dGFjaEV2ZW50JiZwLmF0dGFjaEV2ZW50KCJvbiIrdCxlKX1mdW5jdGlvbiBpKHQsZSxuKXt0PXQuc3BsaXQoIiYiKTtmb3IodmFyIHI9MDtyPHQubGVuZ3RoO3IrKyl7dmFyIGE9dFtyXS5zcGxpdCgiPSIpO2lmKGRlY29kZVVSSUNvbXBvbmVudChhWzBdKS5yZXBsYWNlKC9cKy9nLCIgIik9PT1lKXJldHVybiBlPWEuc2xpY2UoMSkuam9pbigiPSIpLG4/ZTpkZWNvZGVVUklDb21wb25lbnQoZSkucmVwbGFjZSgvXCsvZywiICIpfX12YXIgdSxsLGMsYT10aGlzfHxzZWxmLGc9ZnVuY3Rpb24odCxlKXtmb3IodmFyIG4gaW4gZSllLmhhc093blByb3BlcnR5KG4pJiYodFtuXT1lW25dKX0saD0vXig/Oig/Omh0dHBzP3xtYWlsdG98ZnRwKTp8W146Lz8jXSooPzpbLz8jXXwkKSkvaSxmPXdpbmRvdyxkPXdpbmRvdy5oaXN0b3J5LHA9ZG9jdW1lbnQsdj1uYXZpZ2F0b3IsZT17fSxtPWZ1bmN0aW9uKCl7ZS5UQUdHSU5HPWUuVEFHR0lOR3x8W10sZS5UQUdHSU5HWzFdPSEwfSxiPS86WzAtOV0rJC8sdz1mdW5jdGlvbih0LGUpe3JldHVybiJwcm90b2NvbCIhPT0oZT1lJiZTdHJpbmcoZSkudG9Mb3dlckNhc2UoKSkmJiJwb3J0IiE9PWV8fCh0LnByb3RvY29sPV8odC5wcm90b2NvbCl8fF8oZi5sb2NhdGlvbi5wcm90b2NvbCkpLCJwb3J0Ij09PWU/dC5wb3J0PVN0cmluZyhOdW1iZXIoKHQuaG9zdG5hbWU/dDpmLmxvY2F0aW9uKS5wb3J0KXx8KCJodHRwIj09dC5wcm90b2NvbD84MDoiaHR0cHMiPT10LnByb3RvY29sPzQ0MzoiIikpOiJob3N0Ij09PWUmJih0Lmhvc3RuYW1lPSh0Lmhvc3RuYW1lfHxmLmxvY2F0aW9uLmhvc3RuYW1lKS5yZXBsYWNlKGIsIiIpLnRvTG93ZXJDYXNlKCkpLHkodCxlLHZvaWQgMCx2b2lkIDAsdm9pZCAwKX0seT1mdW5jdGlvbih0LGUsbixyLGEpe3ZhciBvPV8odC5wcm90b2NvbCk7c3dpdGNoKGU9ZSYmU3RyaW5nKGUpLnRvTG93ZXJDYXNlKCkpe2Nhc2UidXJsX25vX2ZyYWdtZW50IjpyPSIiLHQ9cj10JiZ0LmhyZWY/KHI9dC5ocmVmLmluZGV4T2YoIiMiKSk8MD90LmhyZWY6dC5ocmVmLnN1YnN0cigwLHIpOnI7YnJlYWs7Y2FzZSJwcm90b2NvbCI6dD1vO2JyZWFrO2Nhc2UiaG9zdCI6dD10Lmhvc3RuYW1lLnJlcGxhY2UoYiwiIikudG9Mb3dlckNhc2UoKSxuJiYocj0vXnd3d1xkKlwuLy5leGVjKHQpKSYmclswXSYmKHQ9dC5zdWJzdHIoclswXS5sZW5ndGgpKTticmVhaztjYXNlInBvcnQiOnQ9U3RyaW5nKE51bWJlcih0LnBvcnQpfHwoImh0dHAiPT1vPzgwOiJodHRwcyI9PW8/NDQzOiIiKSk7YnJlYWs7Y2FzZSJwYXRoIjp0LnBhdGhuYW1lfHx0Lmhvc3RuYW1lfHxtKCksdD0odD0iLyI9PXQucGF0aG5hbWUuc3Vic3RyKDAsMSk/dC5wYXRobmFtZToiLyIrdC5wYXRobmFtZSkuc3BsaXQoIi8iKSwwPD0ocnx8W10pLmluZGV4T2YodFt0Lmxlbmd0aC0xXSkmJih0W3QubGVuZ3RoLTFdPSIiKSx0PXQuam9pbigiLyIpO2JyZWFrO2Nhc2UicXVlcnkiOnQ9dC5zZWFyY2gucmVwbGFjZSgiPyIsIiIpLGEmJih0PWkodCxhLHZvaWQgMCkpO2JyZWFrO2Nhc2UiZXh0ZW5zaW9uIjp0PSh0PTE8KHQ9dC5wYXRobmFtZS5zcGxpdCgiLiIpKS5sZW5ndGg/dFt0Lmxlbmd0aC0xXToiIikuc3BsaXQoIi8iKVswXTticmVhaztjYXNlImZyYWdtZW50Ijp0PXQuaGFzaC5yZXBsYWNlKCIjIiwiIik7YnJlYWs7ZGVmYXVsdDp0PXQmJnQuaHJlZn1yZXR1cm4gdH0sXz1mdW5jdGlvbih0KXtyZXR1cm4gdD90LnJlcGxhY2UoIjoiLCIiKS50b0xvd2VyQ2FzZSgpOiIifSxPPWZ1bmN0aW9uKHQpe3ZhciBlPXAuY3JlYXRlRWxlbWVudCgiYSIpO3QmJihlLmhyZWY9dCk7dmFyIG49ZS5wYXRobmFtZTtyZXR1cm4iLyIhPT1uWzBdJiYodHx8bSgpLG49Ii8iK24pLHQ9ZS5ob3N0bmFtZS5yZXBsYWNlKGIsIiIpLHtocmVmOmUuaHJlZixwcm90b2NvbDplLnByb3RvY29sLGhvc3Q6ZS5ob3N0LGhvc3RuYW1lOnQscGF0aG5hbWU6bixzZWFyY2g6ZS5zZWFyY2gsaGFzaDplLmhhc2gscG9ydDplLnBvcnR9fTtmdW5jdGlvbiBFKCl7Zm9yKHZhciB0PXUsZT17fSxuPTA7bjx0Lmxlbmd0aDsrK24pZVt0W25dXT1uO3JldHVybiBlfWZ1bmN0aW9uIFQoKXt2YXIgdD0iQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoiO3JldHVybih0Kz0iQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoiLnRvTG93ZXJDYXNlKCkrIjAxMjM0NTY3ODktXyIpKyIuIn1mdW5jdGlvbiB4KHQpe3U9dXx8VCgpLGw9bHx8RSgpO2Zvcih2YXIgZT1bXSxuPTA7bjx0Lmxlbmd0aDtuKz0zKXt2YXIgcj1uKzE8dC5sZW5ndGgsYT1uKzI8dC5sZW5ndGgsbz10LmNoYXJDb2RlQXQobiksaT1yP3QuY2hhckNvZGVBdChuKzEpOjAscz1hP3QuY2hhckNvZGVBdChuKzIpOjAsYz1vPj4yLG89KDMmbyk8PDR8aT4+NCxpPSgxNSZpKTw8MnxzPj42O3MmPTYzLGF8fChzPTY0LHJ8fChpPTY0KSksZS5wdXNoKHVbY10sdVtvXSx1W2ldLHVbc10pfXJldHVybiBlLmpvaW4oIiIpfWZ1bmN0aW9uIGsoKXtmdW5jdGlvbiB0KHQpe24odC50YXJnZXR8fHQuc3JjRWxlbWVudHx8e30pfXZhciBlLG49RixyPVgsYT1OKCk7YS5pbml0fHwobygibW91c2Vkb3duIix0KSxvKCJrZXl1cCIsdCksbygic3VibWl0IixmdW5jdGlvbih0KXtyKHQudGFyZ2V0fHx0LnNyY0VsZW1lbnR8fHt9KX0pLGU9SFRNTEZvcm1FbGVtZW50LnByb3RvdHlwZS5zdWJtaXQsSFRNTEZvcm1FbGVtZW50LnByb3RvdHlwZS5zdWJtaXQ9ZnVuY3Rpb24oKXtyKHRoaXMpLGUuY2FsbCh0aGlzKX0sYS5pbml0PSEwKX1mdW5jdGlvbiBTKHQsZSxuLHIsYSl7dD17Y2FsbGJhY2s6dCxkb21haW5zOmUsZnJhZ21lbnQ6Mj09PW4scGxhY2VtZW50Om4sZm9ybXM6cixzYW1lSG9zdDphfSxOKCkuZGVjb3JhdG9ycy5wdXNoKHQpfWZ1bmN0aW9uIEModCxlLG4pe2Zvcih2YXIgcj1OKCkuZGVjb3JhdG9ycyxhPXt9LG89MDtvPHIubGVuZ3RoOysrbyl7dmFyIGk9cltvXTtpZihzPSFufHxpLmZvcm1zKXQ6e3ZhciBzPWkuZG9tYWlucyxjPXQsdT0hIWkuc2FtZUhvc3Q7aWYocyYmKHV8fGMhPT1wLmxvY2F0aW9uLmhvc3RuYW1lKSlmb3IodmFyIGw9MDtsPHMubGVuZ3RoO2wrKylpZihzW2xdaW5zdGFuY2VvZiBSZWdFeHApe2lmKHNbbF0udGVzdChjKSl7cz0hMDticmVhayB0fX1lbHNlIGlmKDA8PWMuaW5kZXhPZihzW2xdKXx8dSYmMDw9c1tsXS5pbmRleE9mKGMpKXtzPSEwO2JyZWFrIHR9cz0hMX1zJiYoKHM9bnVsbD09KHM9aS5wbGFjZW1lbnQpP2kuZnJhZ21lbnQ/MjoxOnMpPT09ZSYmZyhhLGkuY2FsbGJhY2soKSkpfXJldHVybiBhfXZhciBqPXZvaWQgMDtmdW5jdGlvbiBOKCl7dmFyIHQ9e30sZT1mLmdvb2dsZV90YWdfZGF0YTtyZXR1cm4gZi5nb29nbGVfdGFnX2RhdGE9dm9pZCAwPT09ZT90OmUsKGU9KHQ9Zi5nb29nbGVfdGFnX2RhdGEpLmdsKSYmZS5kZWNvcmF0b3JzfHwodC5nbD1lPXtkZWNvcmF0b3JzOltdfSksZX12YXIgUj0vKC4qPylcKiguKj8pXCooLiopLyxBPS8oW14/I10rKShcP1teI10qKT8oIy4qKT8vO2Z1bmN0aW9uIEwodCl7cmV0dXJuIG5ldyBSZWdFeHAoIiguKj8pKF58JikiK3QrIj0oW14mXSopJj8oLiopIil9ZnVuY3Rpb24gSSh0LGUpe3ZhciBuLHIsYT1bXTtmb3IobiBpbiB0KSF0Lmhhc093blByb3BlcnR5KG4pfHx2b2lkIDAhPT0ocj10W25dKSYmcj09ciYmbnVsbCE9PXImJiJbb2JqZWN0IE9iamVjdF0iIT09ci50b1N0cmluZygpJiYoYS5wdXNoKG4pLGEucHVzaCh4KFN0cmluZyhyKSkpKTtyZXR1cm4gdD1hLmpvaW4oIioiKSx2b2lkIDAhPT1lJiYoYT0ieHBfIitlLGU9TVtlXSh0KSx0PXQrIioiK1thLHgoU3RyaW5nKGUpKV0uam9pbigiKiIpKSxbIjEiLFAodCksdF0uam9pbigiKiIpfWZ1bmN0aW9uIFAodCxlKXtpZih0PVtmLm5hdmlnYXRvci51c2VyQWdlbnQsKG5ldyBEYXRlKS5nZXRUaW1lem9uZU9mZnNldCgpLHYudXNlckxhbmd1YWdlfHx2Lmxhbmd1YWdlLE1hdGguZmxvb3IobmV3IERhdGUoRGF0ZS5ub3coKSkuZ2V0VGltZSgpLzYwLzFlMyktKHZvaWQgMD09PWU/MDplKSx0XS5qb2luKCIqIiksIShlPWMpKXtlPUFycmF5KDI1Nik7Zm9yKHZhciBuPTA7bjwyNTY7bisrKXtmb3IodmFyIHI9bixhPTA7YTw4O2ErKylyPTEmcj9yPj4+MV4zOTg4MjkyMzg0OnI+Pj4xO2Vbbl09cn19Zm9yKGM9ZSxlPTQyOTQ5NjcyOTUsbj0wO248dC5sZW5ndGg7bisrKWU9ZT4+PjheY1syNTUmKGVedC5jaGFyQ29kZUF0KG4pKV07cmV0dXJuKCgtMV5lKT4+PjApLnRvU3RyaW5nKDM2KX12YXIgbj17fSxNPShuWzFdPWZ1bmN0aW9uKCl7cmV0dXJuIkNIRUNLU1VNX0VYUF9ESVNBQkxFRCJ9LG5bMl09ZnVuY3Rpb24oKXtyZXR1cm4iQ0hFQ0tTVU1fRVhQX0RJU0FCTEVEIn0sblszXT1mdW5jdGlvbigpe3JldHVybiJDSEVDS1NVTV9FWFBfRElTQUJMRUQifSxuKTtmdW5jdGlvbiByKG8pe3JldHVybiBmdW5jdGlvbih0KXt2YXIgZT1PKGYubG9jYXRpb24uaHJlZiksbj1lLnNlYXJjaC5yZXBsYWNlKCI/IiwiIikscj1pKG4sIl9nbCIsITApO3QucXVlcnk9cShyfHwiIil8fHt9O3ZhciBhPShyPXcoZSwiZnJhZ21lbnQiKSkubWF0Y2goTCgiX2dsIikpO3QuZnJhZ21lbnQ9cShhJiZhWzNdfHwiIil8fHt9LG8mJmZ1bmN0aW9uKHQsZSxuKXtmdW5jdGlvbiByKHQsZSl7cmV0dXJuIHQ9KHQ9RCgiX2dsIix0KSkubGVuZ3RoP2UrdDp0fXt2YXIgYTtkJiZkLnJlcGxhY2VTdGF0ZSYmKCgoYT1MKCJfZ2wiKSkudGVzdChlKXx8YS50ZXN0KG4pKSYmKHQ9dyh0LCJwYXRoIiksZT1yKGUsIj8iKSxuPXIobiwiIyIpLGQucmVwbGFjZVN0YXRlKHt9LHZvaWQgMCwiIit0K2UrbikpKX19KGUsbixyKX19ZnVuY3Rpb24gRCh0LGUpe3ZhciBuLHI7cmV0dXJuKHQ9TCh0KS5leGVjKGUpKSYmKG49dFsyXSxyPXRbNF0sZT10WzFdLHImJihlPWUrbityKSksZX1mdW5jdGlvbiBxKHQpe3ZhciBlPXZvaWQgMD09PWU/MzplO3RyeXtpZih0KXt0Ontmb3IodmFyIG49MDtuPDM7KytuKXt2YXIgcj1SLmV4ZWModCk7aWYocil7dmFyIGE9cjticmVhayB0fXQ9ZGVjb2RlVVJJQ29tcG9uZW50KHQpfWE9dm9pZCAwfWlmKGEmJiIxIj09PWFbMV0pe3ZhciBvPWFbMl0saT1hWzNdO3Q6e2ZvcihhPTA7YTxlOysrYSlpZihvPT09UChpLGEpKXt2YXIgcz0hMDticmVhayB0fXM9ITF9aWYocyl7Zm9yKHZhciBlPXt9LGM9aT9pLnNwbGl0KCIqIik6W10saT0wO2k8Yy5sZW5ndGg7aSs9MillW2NbaV1dPWZ1bmN0aW9uKHIpe2Z1bmN0aW9uIHQodCl7Zm9yKDthPHIubGVuZ3RoOyl7dmFyIGU9ci5jaGFyQXQoYSsrKSxuPWxbZV07aWYobnVsbCE9bilyZXR1cm4gbjtpZighL15bXHNceGEwXSokLy50ZXN0KGUpKXRocm93IEVycm9yKCJVbmtub3duIGJhc2U2NCBlbmNvZGluZyBhdCBjaGFyOiAiK2UpfXJldHVybiB0fXU9dXx8VCgpLGw9bHx8RSgpO2Zvcih2YXIgZT0iIixhPTA7Oyl7dmFyIG49dCgtMSksbz10KDApLGk9dCg2NCkscz10KDY0KTtpZig2ND09PXMmJi0xPT09bilyZXR1cm4gZTtlKz1TdHJpbmcuZnJvbUNoYXJDb2RlKG48PDJ8bz4+NCksNjQhPWkmJihlKz1TdHJpbmcuZnJvbUNoYXJDb2RlKG88PDQmMjQwfGk+PjIpLDY0IT1zJiYoZSs9U3RyaW5nLmZyb21DaGFyQ29kZShpPDw2JjE5MnxzKSkpfX0oY1tpKzFdKTtyZXR1cm4gZX19fX1jYXRjaCh0KXt9fWZ1bmN0aW9uIFUobix0LGUscil7ZnVuY3Rpb24gYSh0KXt2YXIgZT0odD1EKG4sdCkpLmNoYXJBdCh0Lmxlbmd0aC0xKTtyZXR1cm4gdCYmIiYiIT09ZSYmKHQrPSImIiksdCtzfWlmKHI9dm9pZCAwIT09ciYmciwhKGk9QS5leGVjKGUpKSlyZXR1cm4iIjtlPWlbMV07dmFyIG89aVsyXXx8IiIsaT1pWzNdfHwiIixzPW4rIj0iK3Q7cmV0dXJuIHI/aT0iIyIrYShpLnN1YnN0cmluZygxKSk6bz0iPyIrYShvLnN1YnN0cmluZygxKSksIiIrZStvK2l9ZnVuY3Rpb24gSCh0LGUpe3ZhciBuPSJGT1JNIj09PSh0LnRhZ05hbWV8fCIiKS50b1VwcGVyQ2FzZSgpLHI9QyhlLDEsbiksYT1DKGUsMixuKTtlPUMoZSwzLG4pO3ZhciBvLGk9ajtmb3IobyBpbiBzKHIpJiYocj1JKHIsaSksbj9WKCJfZ2wiLHIsdCk6RygiX2dsIixyLHQsITEpKSwhbiYmcyhhKSYmRygiX2dsIixuPUkoYSksdCwhMCksZSllLmhhc093blByb3BlcnR5KG8pJiYkKG8sZVtvXSx0KX1mdW5jdGlvbiAkKHQsZSxuLHIpe2lmKG4udGFnTmFtZSl7aWYoImEiPT09bi50YWdOYW1lLnRvTG93ZXJDYXNlKCkpcmV0dXJuIEcodCxlLG4scik7aWYoImZvcm0iPT09bi50YWdOYW1lLnRvTG93ZXJDYXNlKCkpcmV0dXJuIFYodCxlLG4pfWlmKCJzdHJpbmciPT10eXBlb2YgbilyZXR1cm4gVSh0LGUsbixyKX1mdW5jdGlvbiBHKHQsZSxuLHIpe24uaHJlZiYmKHQ9VSh0LGUsbi5ocmVmLHZvaWQgMCE9PXImJnIpLGgudGVzdCh0KSYmKG4uaHJlZj10KSl9ZnVuY3Rpb24gVih0LGUsbil7aWYobiYmbi5hY3Rpb24paWYoImdldCI9PT0ocj0obi5tZXRob2R8fCIiKS50b0xvd2VyQ2FzZSgpKSl7Zm9yKHZhciByPW4uY2hpbGROb2Rlc3x8W10sYT0hMSxvPTA7bzxyLmxlbmd0aDtvKyspe3ZhciBpPXJbb107aWYoaS5uYW1lPT09dCl7aS5zZXRBdHRyaWJ1dGUoInZhbHVlIixlKSxhPSEwO2JyZWFrfX1hfHwoKHI9cC5jcmVhdGVFbGVtZW50KCJpbnB1dCIpKS5zZXRBdHRyaWJ1dGUoInR5cGUiLCJoaWRkZW4iKSxyLnNldEF0dHJpYnV0ZSgibmFtZSIsdCksci5zZXRBdHRyaWJ1dGUoInZhbHVlIixlKSxuLmFwcGVuZENoaWxkKHIpKX1lbHNlInBvc3QiPT09ciYmKHQ9VSh0LGUsbi5hY3Rpb24pLGgudGVzdCh0KSYmKG4uYWN0aW9uPXQpKX1mdW5jdGlvbiBGKHQpe3RyeXt0Ontmb3IodmFyIGU9MTAwO3QmJjA8ZTspe2lmKHQuaHJlZiYmdC5ub2RlTmFtZS5tYXRjaCgvXmEoPzpyZWEpPyQvaSkpe3ZhciBuPXQ7YnJlYWsgdH10PXQucGFyZW50Tm9kZSxlLS19bj1udWxsfXZhciByO24mJigiaHR0cDoiIT09KHI9bi5wcm90b2NvbCkmJiJodHRwczoiIT09cnx8SChuLG4uaG9zdG5hbWUpKX1jYXRjaCh0KXt9fWZ1bmN0aW9uIFgodCl7dHJ5e3QuYWN0aW9uJiZIKHQsdyhPKHQuYWN0aW9uKSwiaG9zdCIpKX1jYXRjaCh0KXt9fXQoImdvb2dsZV90YWdfZGF0YS5nbEJyaWRnZS5hdXRvIixmdW5jdGlvbih0LGUsbixyLGEpe2soKSx2b2lkIDAhPT1hJiYoaj1hKSwzIT09YXx8di51c2VyQWdlbnREYXRhJiZ2LnVzZXJBZ2VudERhdGEuZ2V0SGlnaEVudHJvcHlWYWx1ZXMoWyJhcmNoaXRlY3R1cmUiLCJtb2RlbCIsImJpdG5lc3MiLCJwbGF0Zm9ybVZlcnNpb24iLCJ1YUZ1bGxWZXJzaW9uIl0pLnRoZW4oZnVuY3Rpb24oKXt9KSxTKHQsZSwiZnJhZ21lbnQiPT09bj8yOjEsISFyLCExKX0pLHQoImdvb2dsZV90YWdfZGF0YS5nbEJyaWRnZS5wYXNzdGhyb3VnaCIsZnVuY3Rpb24odCxlLG4scil7aygpLHZvaWQgMCE9PXImJihqPXIpLFModCxbeShmLmxvY2F0aW9uLCJob3N0IiwhMCldLGUsISFuLCEwKX0pLHQoImdvb2dsZV90YWdfZGF0YS5nbEJyaWRnZS5kZWNvcmF0ZSIsZnVuY3Rpb24odCxlLG4pe3JldHVybiAkKCJfZ2wiLHQ9SSh0KSxlLCEhbil9KSx0KCJnb29nbGVfdGFnX2RhdGEuZ2xCcmlkZ2UuZ2VuZXJhdGUiLEkpLHQoImdvb2dsZV90YWdfZGF0YS5nbEJyaWRnZS5nZXQiLGZ1bmN0aW9uKHQsZSl7dmFyIG49cighIWUpO3JldHVybihlPU4oKSkuZGF0YXx8KGUuZGF0YT17cXVlcnk6e30sZnJhZ21lbnQ6e319LG4oZS5kYXRhKSksbj17fSwoZT1lLmRhdGEpJiYoZyhuLGUucXVlcnkpLHQmJmcobixlLmZyYWdtZW50KSksbn0pfSh3aW5kb3cpLGZ1bmN0aW9uKCl7ZnVuY3Rpb24gbyh0KXt2YXIgZSxuPTE7aWYodClmb3Iobj0wLGU9dC5sZW5ndGgtMTswPD1lO2UtLSl7dmFyIHI9dC5jaGFyQ29kZUF0KGUpO249MCE9KHI9MjY2MzM4MzA0JihuPShuPDw2JjI2ODQzNTQ1NSkrcisocjw8MTQpKSk/bl5yPj4yMTpufXJldHVybiBufWZ1bmN0aW9uIGkodCl7dGhpcy5DPXR8fFtdfWkucHJvdG90eXBlLnNldD1mdW5jdGlvbih0KXt0aGlzLkNbdF09ITB9LGkucHJvdG90eXBlLmVuY29kZT1mdW5jdGlvbigpe2Zvcih2YXIgdD1bXSxlPTA7ZTx0aGlzLkMubGVuZ3RoO2UrKyl0aGlzLkNbZV0mJih0W01hdGguZmxvb3IoZS82KV1ePTE8PGUlNik7Zm9yKGU9MDtlPHQubGVuZ3RoO2UrKyl0W2VdPSJBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OS1fIi5jaGFyQXQodFtlXXx8MCk7cmV0dXJuIHQuam9pbigiIikrIn4ifTt2YXIgdD13aW5kb3cuR29vZ2xlQW5hbHl0aWNzT2JqZWN0LHM9KEFlPShBZT1OZT0oTmU9bnVsbCE9dCk/LTE8KHQuY29uc3RydWN0b3IrIiIpLmluZGV4T2YoIlN0cmluZyIpOk5lKT8oUmU9d2luZG93Lkdvb2dsZUFuYWx5dGljc09iamVjdCk/UmUucmVwbGFjZSgvXltcc1x4YTBdK3xbXHNceGEwXSskL2csIiIpOiIiOkFlKXx8ImdhIixjPS9eKD86dXRtYVwuKT9cZCtcLlxkKyQvLHU9L15hbXAtW1x3Li1dezIyLDY0fSQvLGw9ITEscj1uZXcgaTtmdW5jdGlvbiBnKHQpe3Iuc2V0KHQpfWZ1bmN0aW9uIGgodCl7cmV0dXJuIHQ9dC5nZXQoRmUpLHQ9IXkodCk/W106dH1mdW5jdGlvbiBmKHQpe3JldHVybiJmdW5jdGlvbiI9PXR5cGVvZiB0fWZ1bmN0aW9uIGQoKXtmb3IodmFyIHQ9SS5uYXZpZ2F0b3IudXNlckFnZW50KyhQLmNvb2tpZXx8IiIpKyhQLnJlZmVycmVyfHwiIiksZT10Lmxlbmd0aCxuPUkuaGlzdG9yeS5sZW5ndGg7MDxuOyl0Kz1uLS1eZSsrO3JldHVybltBdCgpXjIxNDc0ODM2NDcmbyh0KSxNYXRoLnJvdW5kKChuZXcgRGF0ZSkuZ2V0VGltZSgpLzFlMyldLmpvaW4oIi4iKX1mdW5jdGlvbiBwKHQsZSxuLHIpe3RyeXt0LmFkZEV2ZW50TGlzdGVuZXI/dC5hZGRFdmVudExpc3RlbmVyKGUsbiwhIXIpOnQuYXR0YWNoRXZlbnQmJnQuYXR0YWNoRXZlbnQoIm9uIitlLG4pfWNhdGNoKHQpe2coMjcpfX1mdW5jdGlvbiB2KHQsZSl7dmFyIG49dC5pbmRleE9mKGUpO3JldHVybiEoNSE9biYmNiE9bnx8Ii8iIT0odD10LmNoYXJBdChuK2UubGVuZ3RoKSkmJiI/IiE9dCYmIiIhPXQmJiI6IiE9dCl9ZnVuY3Rpb24gbSh0LGUpe2lmKDE9PWUubGVuZ3RoJiZudWxsIT1lWzBdJiYib2JqZWN0Ij09dHlwZW9mIGVbMF0pcmV0dXJuIGVbMF07Zm9yKHZhciBuPXt9LHI9TWF0aC5taW4odC5sZW5ndGgrMSxlLmxlbmd0aCksYT0wO2E8cjthKyspe2lmKCJvYmplY3QiPT10eXBlb2YgZVthXSl7Zm9yKHZhciBvIGluIGVbYV0pZVthXS5oYXNPd25Qcm9wZXJ0eShvKSYmKG5bb109ZVthXVtvXSk7YnJlYWt9YTx0Lmxlbmd0aCYmKG5bdFthXV09ZVthXSl9cmV0dXJuIG59ZnVuY3Rpb24gYigpe3RoaXMub2E9W10sdGhpcy5lYT17fSx0aGlzLm09e319dmFyIHc9ZnVuY3Rpb24odCl7dD1oKHQpLHQ9bmV3IGkodCk7Zm9yKHZhciBlPXIuQy5zbGljZSgpLG49MDtuPHQuQy5sZW5ndGg7bisrKWVbbl09ZVtuXXx8dC5DW25dO3JldHVybiBuZXcgaShlKS5lbmNvZGUoKX0seT1mdW5jdGlvbih0KXtyZXR1cm4iW29iamVjdCBBcnJheV0iPT1PYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoT2JqZWN0KHQpKX0sXz1mdW5jdGlvbih0KXtyZXR1cm4gbnVsbCE9dCYmLTE8KHQuY29uc3RydWN0b3IrIiIpLmluZGV4T2YoIlN0cmluZyIpfSxPPWZ1bmN0aW9uKHQsZSl7cmV0dXJuIDA9PXQuaW5kZXhPZihlKX0sRT1mdW5jdGlvbih0KXt2YXIgZT1QLmNyZWF0ZUVsZW1lbnQoImltZyIpO3JldHVybiBlLndpZHRoPTEsZS5oZWlnaHQ9MSxlLnNyYz10LGV9LFQ9ZnVuY3Rpb24oKXt9LHg9ZnVuY3Rpb24odCl7cmV0dXJuIGVuY29kZVVSSUNvbXBvbmVudCBpbnN0YW5jZW9mIEZ1bmN0aW9uP2VuY29kZVVSSUNvbXBvbmVudCh0KTooZygyOCksdCl9LGs9L15bXHdcLTovLj89JiUhXFtcXV0rJC8sUz0vXltcdysvXy1dK1s9XXswLDJ9JC8sQz1udWxsLGo9ZnVuY3Rpb24odCxlLG4scixhKXtpZighQyl7Qz17Y3JlYXRlU2NyaXB0VVJMOmZ1bmN0aW9uKHQpe3JldHVybiB0fSxjcmVhdGVIVE1MOmZ1bmN0aW9uKHQpe3JldHVybiB0fX07dHJ5e0M9d2luZG93LnRydXN0ZWRUeXBlcy5jcmVhdGVQb2xpY3koImdvb2dsZS1hbmFseXRpY3MiLEMpfWNhdGNoKHQpe319dmFyIG87dCYmKG89KG89UC5xdWVyeVNlbGVjdG9yJiZQLnF1ZXJ5U2VsZWN0b3IoInNjcmlwdFtub25jZV0iKXx8bnVsbCkmJihvLm5vbmNlfHxvLmdldEF0dHJpYnV0ZSYmby5nZXRBdHRyaWJ1dGUoIm5vbmNlIikpfHwiIixuPyhhPXI9IiIsZSYmay50ZXN0KGUpJiYocj0nIGlkPSInK2UrJyInKSxvJiZTLnRlc3QobykmJihhPScgbm9uY2U9IicrbysnIicpLGsudGVzdCh0KSYmUC53cml0ZShDLmNyZWF0ZUhUTUwoIjxzY3JpcHQiK3IrYSsnIHNyYz0iJyt0KyciPjxcL3NjcmlwdD4nKSkpOigobj1QLmNyZWF0ZUVsZW1lbnQoInNjcmlwdCIpKS50eXBlPSJ0ZXh0L2phdmFzY3JpcHQiLG4uYXN5bmM9ITAsbi5zcmM9Qy5jcmVhdGVTY3JpcHRVUkwodCksciYmKG4ub25sb2FkPXIpLGEmJihuLm9uZXJyb3I9YSksZSYmKG4uaWQ9ZSksbyYmbi5zZXRBdHRyaWJ1dGUoIm5vbmNlIixvKSwodD1QLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJzY3JpcHQiKVswXSkucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUobix0KSkpfSxOPWZ1bmN0aW9uKHQsZSl7cmV0dXJuIFIoUC5sb2NhdGlvbltlPyJocmVmIjoic2VhcmNoIl0sdCl9LFI9ZnVuY3Rpb24odCxlKXtyZXR1cm4odD10Lm1hdGNoKCIoPzomfCN8XFw/KSIreChlKS5yZXBsYWNlKC8oWy4qKz9ePSE6JHt9KCl8XFtcXVwvXFxdKS9nLCJcXCQxIikrIj0oW14mI10qKSIpKSYmMj09dC5sZW5ndGg/dFsxXToiIn0sQT1mdW5jdGlvbigpe3ZhciB0PSIiK1AubG9jYXRpb24uaG9zdG5hbWU7cmV0dXJuIDA9PXQuaW5kZXhPZigid3d3LiIpP3Quc3Vic3RyaW5nKDQpOnR9LEw9ZnVuY3Rpb24odCxlKXtmb3IodmFyIG49MDtuPHQubGVuZ3RoO24rKylpZihlPT10W25dKXJldHVybiEwO3JldHVybiExfTtiLnByb3RvdHlwZS5zZXQ9ZnVuY3Rpb24odCxlLG4pe3RoaXMub2EucHVzaCh0KSxuP3RoaXMubVsiOiIrdF09ZTp0aGlzLmVhWyI6Iit0XT1lfSxiLnByb3RvdHlwZS5nZXQ9ZnVuY3Rpb24odCl7cmV0dXJuKHRoaXMubS5oYXNPd25Qcm9wZXJ0eSgiOiIrdCk/dGhpcy5tOnRoaXMuZWEpWyI6Iit0XX0sYi5wcm90b3R5cGUubWFwPWZ1bmN0aW9uKHQpe2Zvcih2YXIgZT0wO2U8dGhpcy5vYS5sZW5ndGg7ZSsrKXt2YXIgbj10aGlzLm9hW2VdLHI9dGhpcy5nZXQobik7ciYmdChuLHIpfX07dmFyIEk9d2luZG93LFA9ZG9jdW1lbnQsbj1kb2N1bWVudC5jdXJyZW50U2NyaXB0P2RvY3VtZW50LmN1cnJlbnRTY3JpcHQuc3JjOiIiLE09ZnVuY3Rpb24odCxlKXtyZXR1cm4gc2V0VGltZW91dCh0LGUpfSxEPXdpbmRvdyxxPWRvY3VtZW50LFU9ZnVuY3Rpb24odCl7dmFyIGU9RC5fZ2FVc2VyUHJlZnM7aWYoZSYmZS5pb28mJmUuaW9vKCl8fHQmJiEwPT09RFsiZ2EtZGlzYWJsZS0iK3RdKXJldHVybiEwO3RyeXt2YXIgbj1ELmV4dGVybmFsO2lmKG4mJm4uX2dhVXNlclByZWZzJiYib28iPT1uLl9nYVVzZXJQcmVmcylyZXR1cm4hMH1jYXRjaCh0KXt9Zm9yKHQ9W10sZT1TdHJpbmcocS5jb29raWUpLnNwbGl0KCI7Iiksbj0wO248ZS5sZW5ndGg7bisrKXt2YXIgcj1lW25dLnNwbGl0KCI9IiksYT1yWzBdLnJlcGxhY2UoL15ccyp8XHMqJC9nLCIiKTthJiYiQU1QX1RPS0VOIj09YSYmKChyPXIuc2xpY2UoMSkuam9pbigiPSIpLnJlcGxhY2UoL15ccyp8XHMqJC9nLCIiKSkmJihyPWRlY29kZVVSSUNvbXBvbmVudChyKSksdC5wdXNoKHIpKX1mb3IoZT0wO2U8dC5sZW5ndGg7ZSsrKWlmKCIkT1BUX09VVCI9PXRbZV0pcmV0dXJuITA7cmV0dXJuISFxLmdldEVsZW1lbnRCeUlkKCJfX2dhT3B0T3V0RXh0ZW5zaW9uIil9LEg9ZnVuY3Rpb24odCl7dmFyIGU9W10sbj1QLmNvb2tpZS5zcGxpdCgiOyIpO3Q9bmV3IFJlZ0V4cCgiXlxccyoiK3QrIj1cXHMqKC4qPylcXHMqJCIpO2Zvcih2YXIgcj0wO3I8bi5sZW5ndGg7cisrKXt2YXIgYT1uW3JdLm1hdGNoKHQpO2EmJmUucHVzaChhWzFdKX1yZXR1cm4gZX0sJD1mdW5jdGlvbih0LGUsbixyLGEsbyxpKXtpZighKGE9IVUoYSkmJiEoRi50ZXN0KFAubG9jYXRpb24uaG9zdG5hbWUpfHwiLyI9PW4mJlYudGVzdChyKSkpKXJldHVybiExO2lmKG49dCsiPSIrKGU9ZSYmMTIwMDxlLmxlbmd0aD9lLnN1YnN0cmluZygwLDEyMDApOmUpKyI7IHBhdGg9IituKyI7ICIsbyYmKG4rPSJleHBpcmVzPSIrbmV3IERhdGUoKG5ldyBEYXRlKS5nZXRUaW1lKCkrbykudG9HTVRTdHJpbmcoKSsiOyAiKSxyJiYibm9uZSIhPT1yJiYobis9ImRvbWFpbj0iK3IrIjsiKSxpJiYobis9aSsiOyIpLHI9UC5jb29raWUsUC5jb29raWU9biwhKHI9ciE9UC5jb29raWUpKXQ6e2Zvcih0PUgodCkscj0wO3I8dC5sZW5ndGg7cisrKWlmKGU9PXRbcl0pe3I9ITA7YnJlYWsgdH1yPSExfXJldHVybiByfSxHPWZ1bmN0aW9uKHQpe3JldHVybiBlbmNvZGVVUklDb21wb25lbnQ/ZW5jb2RlVVJJQ29tcG9uZW50KHQpLnJlcGxhY2UoL1woL2csIiUyOCIpLnJlcGxhY2UoL1wpL2csIiUyOSIpOnR9LFY9L14od3d3XC4pP2dvb2dsZShcLmNvbT8pPyhcLlthLXpdezJ9KT8kLyxGPS8oXnxcLilkb3VibGVjbGlja1wubmV0JC9pLFg9ZnVuY3Rpb24odCl7dmFyIGU9W10sbj1QLmNvb2tpZS5zcGxpdCgiOyIpO3Q9bmV3IFJlZ0V4cCgiXlxccyoiKyh0fHwiX2dhYyIpKyJfKFVBLVxcZCstXFxkKyk9XFxzKiguKz8pXFxzKiQiKTtmb3IodmFyIHI9MDtyPG4ubGVuZ3RoO3IrKyl7dmFyIGE9bltyXS5tYXRjaCh0KTthJiZlLnB1c2goe2phOmFbMV0sdmFsdWU6YVsyXSx0aW1lc3RhbXA6TnVtYmVyKGFbMl0uc3BsaXQoIi4iKVsxXSl8fDB9KX1yZXR1cm4gZS5zb3J0KGZ1bmN0aW9uKHQsZSl7cmV0dXJuIGUudGltZXN0YW1wLXQudGltZXN0YW1wfSksZX07ZnVuY3Rpb24gQih0LGUsbil7dmFyIHI9e307aWYoIShlPVgoZSkpfHwhZS5sZW5ndGgpcmV0dXJuIHI7Zm9yKHZhciBhPTA7YTxlLmxlbmd0aDthKyspe3ZhciBvLGk9ZVthXS52YWx1ZS5zcGxpdCgiLiIpOyIxIiE9PWlbMF18fG4mJmkubGVuZ3RoPDN8fCFuJiYzIT09aS5sZW5ndGg/dCYmKHQubmE9ITApOk51bWJlcihpWzFdKSYmKHJbZVthXS5qYV0/dCYmKHQucGE9ITApOnJbZVthXS5qYV09W10sbz17dmVyc2lvbjppWzBdLHRpbWVzdGFtcDoxZTMqTnVtYmVyKGlbMV0pLHFhOmlbMl19LG4mJjM8aS5sZW5ndGgmJihvLmxhYmVscz1pLnNsaWNlKDMpKSxyW2VbYV0uamFdLnB1c2gobykpfXJldHVybiByfWZ1bmN0aW9uIHooKXt4YS5EKFtUXSl9ZnVuY3Rpb24gSyh0LGUsbil7Zm9yKGV0JiZjbGVhclRpbWVvdXQoZXQpLGUmJmx0KGUsbikscnQ9dCxlPWl0LGl0PVtdLG49MDtuPGUubGVuZ3RoO24rKyllW25dKHQpfWZ1bmN0aW9uIFcodCl7dDp7aWYoYXQudGVzdChQLnJlZmVycmVyKSl7dmFyIGU9UC5sb2NhdGlvbi5ob3N0bmFtZS5yZXBsYWNlKG90LCIiKTtlOnt2YXIgbj1QLnJlZmVycmVyLHI9KG49bi5yZXBsYWNlKC9eaHR0cHM/OlwvXC8vLCIiKSkucmVwbGFjZSgvXlteL10rLywiIikuc3BsaXQoIi8iKSxhPXJbMl07aWYoIShyPShyPSJzIj09YT9yWzNdOmEpP2RlY29kZVVSSUNvbXBvbmVudChyKTpyKSl7aWYoMD09bi5pbmRleE9mKCJ4bi0tIikpe249IiI7YnJlYWsgZX0obj1uLm1hdGNoKC8oLiopXC5jZG5cLmFtcHByb2plY3RcLm9yZ1wvPyQvKSkmJjI9PW4ubGVuZ3RoJiYocj1uWzFdLnJlcGxhY2UoLy0vZywiLiIpLnJlcGxhY2UoL1wuXC4vZywiLSIpKX1uPXI/ci5yZXBsYWNlKG90LCIiKToiIn1pZihyPSEocj1lPT09bik/ZS5zdWJzdHJpbmcoZS5sZW5ndGgtKG49Ii4iK24pLmxlbmd0aCxlLmxlbmd0aCk9PT1uOnIpe2U9ITA7YnJlYWsgdH1nKDc4KX1lPSExfXJldHVybiBlJiYhMSE9PXR9ZnVuY3Rpb24gWih0KXtzd2l0Y2godCl7ZGVmYXVsdDpjYXNlIDE6cmV0dXJuImh0dHBzOi8vd3d3Lmdvb2dsZS1hbmFseXRpY3MuY29tL2d0bS9qcz9pZD0iO2Nhc2UgMjpyZXR1cm4iaHR0cHM6Ly93d3cuZ29vZ2xldGFnbWFuYWdlci5jb20vZ3RhZy9qcz9pZD0ifX1mdW5jdGlvbiBZKHQpe3RoaXMubmFtZT0ibGVuIix0aGlzLm1lc3NhZ2U9dCsiLTgxOTIifWZ1bmN0aW9uIEoodCxlLG4pe2lmKDA9PT1lLmxlbmd0aCluKCk7ZWxzZXt2YXIgcj1lLmNoYXJBdCgwKTtzd2l0Y2gocil7Y2FzZSJkIjpmdCgiaHR0cHM6Ly9zdGF0cy5nLmRvdWJsZWNsaWNrLm5ldC9qL2NvbGxlY3QiLHQuVSx0LG4pO2JyZWFrO2Nhc2UiZyI6ZHQoImh0dHBzOi8vd3d3Lmdvb2dsZS5jb20vYWRzL2dhLWF1ZGllbmNlcyIsdC5nb29nbGUsbiksKGU9ZS5zdWJzdHJpbmcoMSkpJiYoL15bYS16Ll17MSw2fSQvLnRlc3QoZSk/ZHQoImh0dHBzOi8vd3d3Lmdvb2dsZS4lL2Fkcy9nYS1hdWRpZW5jZXMiLnJlcGxhY2UoIiUiLGUpLHQuZ29vZ2xlLFQpOmJ0KCJ0bGQiLCJiY2MiLGUpKTticmVhaztjYXNlIkciOmlmKHQuVil7dC5WKCJHLSIrZS5zdWJzdHJpbmcoMSkpLG4oKTticmVha31jYXNlIngiOmlmKHQuVil7dC5WKCksbigpO2JyZWFrfWRlZmF1bHQ6YnQoInhociIsImJyYyIsciksbigpfX19ZnVuY3Rpb24gUSgpe3RoaXMuTT1bXX12YXIgdHQsZXQsbnQscnQsYXQ9L15odHRwcz86XC9cL1teL10qY2RuXC5hbXBwcm9qZWN0XC5vcmdcLy8sb3Q9L14oPzp3d3dcLnxtXC58YW1wXC4pKy8saXQ9W10sc3Q9ZnVuY3Rpb24odCxlKXt2YXIgbj1IKCJBTVBfVE9LRU4iKTtyZXR1cm4gMTxuLmxlbmd0aD8oZyg1NSksITEpOiIkT1BUX09VVCI9PShuPWRlY29kZVVSSUNvbXBvbmVudChuWzBdfHwiIikpfHwiJEVSUk9SIj09bnx8VShlKT8oZyg2MiksITEpOmF0LnRlc3QoUC5yZWZlcnJlcil8fCIkTk9UX0ZPVU5EIiE9bj92b2lkIDAhPT1ydD8oZyg1NiksTShmdW5jdGlvbigpe3QocnQpfSwwKSwhMCk6dHQ/KGl0LnB1c2godCksITApOiIkUkVUUklFVklORyI9PW4/KGcoNTcpLE0oZnVuY3Rpb24oKXtzdCh0LGUpfSwxZTQpLCEwKToodHQ9ITAsbiYmIiQiIT1uWzBdfHwobHQoIiRSRVRSSUVWSU5HIiwzZTQpLHNldFRpbWVvdXQodXQsM2U0KSxuPSIiKSwhIWN0KG4sZSkmJihpdC5wdXNoKHQpLCEwKSk6KGcoNjgpLCExKX0sY3Q9ZnVuY3Rpb24oZSxuLHIpe2lmKCF3aW5kb3cuSlNPTilyZXR1cm4gZyg1OCksITE7dmFyIHQ9SS5YTUxIdHRwUmVxdWVzdDtpZighdClyZXR1cm4gZyg1OSksITE7dmFyIGE9bmV3IHQ7cmV0dXJuIndpdGhDcmVkZW50aWFscyJpbiBhPyhhLm9wZW4oIlBPU1QiLChyfHwiaHR0cHM6Ly9hbXBjaWQuZ29vZ2xlLmNvbS92MS9wdWJsaXNoZXI6Z2V0Q2xpZW50SWQiKSsiP2tleT1BSXphU3lBNjVsRUhVRWl6SXNOdGxiTm8tbDJLMThkVDY4MG5zYU0iLCEwKSxhLndpdGhDcmVkZW50aWFscz0hMCxhLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsInRleHQvcGxhaW4iKSxhLm9ubG9hZD1mdW5jdGlvbigpe2lmKHR0PSExLDQ9PWEucmVhZHlTdGF0ZSl7dHJ5ezIwMCE9YS5zdGF0dXMmJihnKDYxKSxLKCIiLCIkRVJST1IiLDNlNCkpO3ZhciB0PUpTT04ucGFyc2UoYS5yZXNwb25zZVRleHQpO3Qub3B0T3V0PyhnKDYzKSxLKCIiLCIkT1BUX09VVCIsMzE1MzZlNikpOnQuY2xpZW50SWQ/Syh0LmNsaWVudElkLHQuc2VjdXJpdHlUb2tlbiwzMTUzNmU2KTohciYmdC5hbHRlcm5hdGVVcmw/KGV0JiZjbGVhclRpbWVvdXQoZXQpLHR0PSEwLGN0KGUsbix0LmFsdGVybmF0ZVVybCkpOihnKDY0KSxLKCIiLCIkTk9UX0ZPVU5EIiwzNmU1KSl9Y2F0Y2godCl7Zyg2NSksSygiIiwiJEVSUk9SIiwzZTQpfWE9bnVsbH19LHQ9e29yaWdpblNjb3BlOiJBTVBfRUNJRF9HT09HTEUifSxlJiYodC5zZWN1cml0eVRva2VuPWUpLGEuc2VuZChKU09OLnN0cmluZ2lmeSh0KSksZXQ9TShmdW5jdGlvbigpe2coNjYpLEsoIiIsIiRFUlJPUiIsM2U0KX0sMWU0KSwhMCk6KGcoNjApLCExKX0sdXQ9ZnVuY3Rpb24oKXt0dD0hMX0sbHQ9ZnVuY3Rpb24odCxlKXtpZih2b2lkIDA9PT1udCl7bnQ9IiI7Zm9yKHZhciBuPXNyKCkscj0wO3I8bi5sZW5ndGg7cisrKXt2YXIgYT1uW3JdO2lmKCQoIkFNUF9UT0tFTiIsZW5jb2RlVVJJQ29tcG9uZW50KHQpLCIvIixhLCIiLGUpKXJldHVybiB2b2lkKG50PWEpfX0kKCJBTVBfVE9LRU4iLGVuY29kZVVSSUNvbXBvbmVudCh0KSwiLyIsbnQsIiIsZSl9LGd0PWZ1bmN0aW9uKHQpe3JldHVybih0fHxsfHwiaHR0cHM6Ij09UC5sb2NhdGlvbi5wcm90b2NvbD8iaHR0cHM6IjoiaHR0cDoiKSsiLy93d3cuZ29vZ2xlLWFuYWx5dGljcy5jb20ifSxodD1mdW5jdGlvbih0LGUsbil7aWYobj1ufHxULGUubGVuZ3RoPD0yMDM2KWR0KHQsZSxuKTtlbHNle2lmKCEoZS5sZW5ndGg8PTgxOTIpKXRocm93IGJ0KCJsZW4iLGUubGVuZ3RoKSxuZXcgWShlLmxlbmd0aCk7bXQodCxlLG4pfHxwdCh0LGUsbil8fGR0KHQsZSxuKX19LGZ0PWZ1bmN0aW9uKHQsZSxuLHIpe3B0KHQrIj8iK2UsIiIscj1yfHxULG4pfSxkdD1mdW5jdGlvbih0LGUsbil7dmFyIHI9RSh0KyI/IitlKTtyLm9ubG9hZD1yLm9uZXJyb3I9ZnVuY3Rpb24oKXtyLm9ubG9hZD1udWxsLHIub25lcnJvcj1udWxsLG4oKX19LHB0PWZ1bmN0aW9uKG4scixvLGkpe3ZhciB0PXt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csIlhNTEh0dHBSZXF1ZXN0Iik7dHJ5e3JldHVybiB0JiZ7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csIlhNTEh0dHBSZXF1ZXN0IixhLlhNTEh0dHBSZXF1ZXN0KSxmdW5jdGlvbigpe3ZhciB0PUkuWE1MSHR0cFJlcXVlc3Q7aWYoIXQpcmV0dXJuITE7dmFyIGU9bmV3IHQ7cmV0dXJuIndpdGhDcmVkZW50aWFscyJpbiBlJiYobj1uLnJlcGxhY2UoL15odHRwOi8sImh0dHBzOiIpLGUub3BlbigiUE9TVCIsbiwhMCksZS53aXRoQ3JlZGVudGlhbHM9ITAsZS5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LVR5cGUiLCJ0ZXh0L3BsYWluIiksZS5vbnJlYWR5c3RhdGVjaGFuZ2U9ZnVuY3Rpb24oKXtpZig0PT1lLnJlYWR5U3RhdGUpe2lmKGkmJiJ0ZXh0L3BsYWluIj09PWUuZ2V0UmVzcG9uc2VIZWFkZXIoIkNvbnRlbnQtVHlwZSIpKXRyeXt2dChpLGUucmVzcG9uc2VUZXh0LG8pfWNhdGNoKHQpe2J0KCJ4aHIiLCJyc3AiKSxvKCl9ZWxzZSBvKCk7ZT1udWxsfX0sZS5zZW5kKHIpLCEwKX0uYXBwbHkodGhpcyxhcmd1bWVudHMpfWZpbmFsbHl7dCYme30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCJYTUxIdHRwUmVxdWVzdCIsdCl9fSx2dD1mdW5jdGlvbih0LGUsbil7aWYoZS5sZW5ndGg8MSlidCgieGhyIiwidmVyIiwiMCIpLG4oKTtlbHNlIGlmKDM8dC5jb3VudCsrKWJ0KCJ4aHIiLCJ0bXIiLCIiK3QuY291bnQpLG4oKTtlbHNle3ZhciByPWUuY2hhckF0KDApO2lmKCIxIj09PXIpSih0LGUuc3Vic3RyaW5nKDEpLG4pO2Vsc2UgaWYodC5WJiYiMiI9PT1yKXt2YXIgYT1lLnN1YnN0cmluZygxKS5zcGxpdCgiLCIpLG89MDtmb3IoZT1mdW5jdGlvbigpeysrbz09PWEubGVuZ3RoJiZuKCl9LHI9MDtyPGEubGVuZ3RoO3IrKylKKHQsYVtyXSxlKX1lbHNlIGJ0KCJ4aHIiLCJ2ZXIiLFN0cmluZyhlLmxlbmd0aCkpLG4oKX19LG10PWZ1bmN0aW9uKHQsZSxuKXtyZXR1cm4hIUkubmF2aWdhdG9yLnNlbmRCZWFjb24mJighIUkubmF2aWdhdG9yLnNlbmRCZWFjb24odCxlKSYmKG4oKSwhMCkpfSxidD1mdW5jdGlvbih0LGUsbil7MTw9MTAwKk1hdGgucmFuZG9tKCl8fFUoIj8iKXx8KHQ9WyJ0PWVycm9yIiwiX2U9Iit0LCJfdj1qOTYiLCJzcj0xIl0sZSYmdC5wdXNoKCJfZj0iK2UpLG4mJnQucHVzaCgiX209Iit4KG4uc3Vic3RyaW5nKDAsMTAwKSkpLHQucHVzaCgiYWlwPTEiKSx0LnB1c2goIno9IitBdCgpKSxkdChndCghMCkrIi91L2QiLHQuam9pbigiJiIpLFQpKX0sd3Q9ZnVuY3Rpb24oKXtyZXR1cm4gSS5nYURhdGE9SS5nYURhdGF8fHt9fSx5dD1mdW5jdGlvbih0KXt2YXIgZT13dCgpO3JldHVybiBlW3RdPWVbdF18fHt9fTtmdW5jdGlvbiBfdCh0KXtpZigxMDAhPXQuZ2V0KENuKSYmbyhQdCh0LGhuKSklMWU0Pj0xMDAqTXQodCxDbikpdGhyb3ciYWJvcnQifWZ1bmN0aW9uIE90KHQpe2lmKFUoUHQodCx2bikpKXRocm93ImFib3J0In1mdW5jdGlvbiBFdCgpe3ZhciB0PVAubG9jYXRpb24ucHJvdG9jb2w7aWYoImh0dHA6IiE9dCYmImh0dHBzOiIhPXQpdGhyb3ciYWJvcnQifWZ1bmN0aW9uIFR0KG4pe3RyeXtJLm5hdmlnYXRvci5zZW5kQmVhY29uP2coNDIpOkkuWE1MSHR0cFJlcXVlc3QmJiJ3aXRoQ3JlZGVudGlhbHMiaW4gbmV3IEkuWE1MSHR0cFJlcXVlc3QmJmcoNDApfWNhdGNoKHQpe31uLnNldChWZSx3KG4pLCEwKSxuLnNldCh0ZSxNdChuLHRlKSsxKTt2YXIgcj1bXTtHdC5tYXAoZnVuY3Rpb24odCxlKXtlLkYmJihudWxsIT0odD1uLmdldCh0KSkmJnQhPWUuZGVmYXVsdFZhbHVlJiYoImJvb2xlYW4iPT10eXBlb2YgdCYmKHQqPTEpLHIucHVzaChlLkYrIj0iK3goIiIrdCkpKSl9KSwhMT09PW4uZ2V0KHRyKSYmci5wdXNoKCJucGE9MSIpLHIucHVzaCgiej0iK2UoKSksbi5zZXQoWXQsci5qb2luKCImIiksITApfWZ1bmN0aW9uIHh0KHQpe3ZhciBlPVB0KHQsUXQpOyFlJiZ0LmdldChKdCkmJihlPSJiZWFjb24iKTt2YXIgbj1QdCh0LEtuKSxyPVB0KHQsVW4pLGE9bnx8KHJ8fGd0KCExKSsiIikrIi9jb2xsZWN0IjsiZCI9PT1QdCh0LEpuKT8oYT1ufHwocnx8Z3QoITEpKyIiKSsiL2ovY29sbGVjdCIsZT10LmdldChZbil8fHZvaWQgMCxmdChhLFB0KHQsWXQpLGUsdC5aKFp0KSkpOmU/KG49UHQodCxZdCkscj0ocj10LlooWnQpKXx8VCwiaW1hZ2UiPT1lP2R0KGEsbixyKToieGhyIj09ZSYmcHQoYSxuLHIpfHwiYmVhY29uIj09ZSYmbXQoYSxuLHIpfHxodChhLG4scikpOmh0KGEsUHQodCxZdCksdC5aKFp0KSksYT1QdCh0LHZuKSxlPShhPXl0KGEpKS5oaXRjb3VudCxhLmhpdGNvdW50PWU/ZSsxOjEsYS5maXJzdF9oaXR8fChhLmZpcnN0X2hpdD0obmV3IERhdGUpLmdldFRpbWUoKSksYT1QdCh0LHZuKSxkZWxldGUgeXQoYSkucGVuZGluZ19leHBlcmltZW50cyx0LnNldChadCxULCEwKX1mdW5jdGlvbiBrdCh0KXt3dCgpLmV4cElkJiZ0LnNldChMZSx3dCgpLmV4cElkKSx3dCgpLmV4cFZhciYmdC5zZXQoSWUsd3QoKS5leHBWYXIpO3ZhciBlPVB0KHQsdm4pO2lmKGU9eXQoZSkucGVuZGluZ19leHBlcmltZW50cyl7dmFyIG49W107Zm9yKHIgaW4gZSllLmhhc093blByb3BlcnR5KHIpJiZlW3JdJiZuLnB1c2goZW5jb2RlVVJJQ29tcG9uZW50KHIpKyIuIitlbmNvZGVVUklDb21wb25lbnQoZVtyXSkpO3ZhciByPW4uam9pbigiISIpfWVsc2Ugcj12b2lkIDA7ciYmKChlPXQuZ2V0KFBlKSkmJihyPWUrIiEiK3IpLHQuc2V0KFBlLHIsITApKX1mdW5jdGlvbiBTdCgpe2lmKEkubmF2aWdhdG9yJiYicHJldmlldyI9PUkubmF2aWdhdG9yLmxvYWRQdXJwb3NlKXRocm93ImFib3J0In1mdW5jdGlvbiBDdCh0KXt2YXIgZT1JLmdhRGV2SWRzfHxbXTtpZih5KGUpKXt2YXIgbj10LmdldCgiJmRpZCIpO18obikmJjA8bi5sZW5ndGgmJihlPWUuY29uY2F0KG4uc3BsaXQoIiwiKSkpO2Zvcih2YXIgbj1bXSxyPTA7cjxlLmxlbmd0aDtyKyspTChuLGVbcl0pfHxuLnB1c2goZVtyXSk7MCE9bi5sZW5ndGgmJnQuc2V0KCImZGlkIixuLmpvaW4oIiwiKSwhMCl9fWZ1bmN0aW9uIGp0KHQpe2lmKCF0LmdldCh2bikpdGhyb3ciYWJvcnQifWZ1bmN0aW9uIE50KHQpe3RyeXt2YXIgZSxuO3QuZ2V0KEZuKXx8KHQuc2V0KEZuLCEwKSx0LmdldCgiJmd0bSIpKXx8KGU9dm9pZCAwLChlPSEoZT0hKGU9UnQoTigiZ3RtX2RlYnVnIikpPzI6ZSkmJk8oUC5yZWZlcnJlciwiaHR0cHM6Ly90YWdhc3Npc3RhbnQuZ29vZ2xlLmNvbS8iKT8zOmUpJiZMKFAuY29va2llLnNwbGl0KCI7ICIpLCJfX1RBR19BU1NJU1RBTlQ9eCIpPzQ6ZSl8fFJ0KFAuZG9jdW1lbnRFbGVtZW50LmdldEF0dHJpYnV0ZSgiZGF0YS10YWctYXNzaXN0YW50LXByZXNlbnQiKSkmJihlPTUpLGUmJihJWyJnb29nbGUudGFnbWFuYWdlci5kZWJ1Z3VpMi5xdWV1ZSJdfHwoSVsiZ29vZ2xlLnRhZ21hbmFnZXIuZGVidWd1aTIucXVldWUiXT1bXSxqKCJodHRwczovL3d3dy5nb29nbGUtYW5hbHl0aWNzLmNvbS9kZWJ1Zy9ib290c3RyYXA/aWQ9Iit0LmdldCh2bikrIiZzcmM9TEVHQUNZJmNvbmQ9IitlKSksbj1QLmN1cnJlbnRTY3JpcHQsSVsiZ29vZ2xlLnRhZ21hbmFnZXIuZGVidWd1aTIucXVldWUiXS5wdXNoKHttZXNzYWdlVHlwZToiTEVHQUNZX0NPTlRBSU5FUl9TVEFSVElORyIsZGF0YTp7aWQ6dC5nZXQodm4pLHNjcmlwdFNvdXJjZTpuJiZuLnNyY3x8IiJ9fSkpKX1jYXRjaCh0KXt9fWZ1bmN0aW9uIFJ0KHQpe2lmKG51bGwhPXQmJjAhPT10Lmxlbmd0aCl7dD1OdW1iZXIodCk7dmFyIGU9RGF0ZS5ub3coKTtyZXR1cm4gdDxlKzNlNSYmZS05ZTU8dH19US5wcm90b3R5cGUuYWRkPWZ1bmN0aW9uKHQpe3RoaXMuTS5wdXNoKHQpfSxRLnByb3RvdHlwZS5EPWZ1bmN0aW9uKHQpe3RyeXtmb3IodmFyIGU9MDtlPHRoaXMuTS5sZW5ndGg7ZSsrKXt2YXIgbj10LmdldCh0aGlzLk1bZV0pO24mJmYobikmJm4uY2FsbChJLHQpfX1jYXRjaCh0KXt9KGU9dC5nZXQoWnQpKSE9VCYmZihlKSYmKHQuc2V0KFp0LFQsITApLHNldFRpbWVvdXQoZSwxMCkpfTt2YXIgQXQ9ZnVuY3Rpb24oKXtyZXR1cm4gTWF0aC5yb3VuZCgyMTQ3NDgzNjQ3Kk1hdGgucmFuZG9tKCkpfSxlPWZ1bmN0aW9uKCl7dHJ5e3ZhciB0PW5ldyBVaW50MzJBcnJheSgxKTtyZXR1cm4gSS5jcnlwdG8uZ2V0UmFuZG9tVmFsdWVzKHQpLDIxNDc0ODM2NDcmdFswXX1jYXRjaCh0KXtyZXR1cm4gQXQoKX19O2Z1bmN0aW9uIEx0KHQpe3ZhciBlPU10KHQsVWUpO2lmKDUwMDw9ZSYmZygxNSksInRyYW5zYWN0aW9uIiE9KG49UHQodCxXdCkpJiYiaXRlbSIhPW4pe3ZhciBuPU10KHQsJGUpLHI9KG5ldyBEYXRlKS5nZXRUaW1lKCksYT1NdCh0LEhlKTtpZigwPT1hJiZ0LnNldChIZSxyKSwwPChhPU1hdGgucm91bmQoMiooci1hKS8xZTMpKSYmKG49TWF0aC5taW4obithLDIwKSx0LnNldChIZSxyKSksbjw9MCl0aHJvdyJhYm9ydCI7dC5zZXQoJGUsLS1uKX10LnNldChVZSwrK2UpfWZ1bmN0aW9uIEl0KCl7dGhpcy5kYXRhPW5ldyBifUl0LnByb3RvdHlwZS5nZXQ9ZnVuY3Rpb24odCl7dmFyIGU9WHQodCksbj10aGlzLmRhdGEuZ2V0KHQpO3JldHVybiBlJiZudWxsPT1uJiYobj1mKGUuZGVmYXVsdFZhbHVlKT9lLmRlZmF1bHRWYWx1ZSgpOmUuZGVmYXVsdFZhbHVlKSxlJiZlLlo/ZS5aKHRoaXMsdCxuKTpufTt2YXIgUHQ9ZnVuY3Rpb24odCxlKXtyZXR1cm4gbnVsbD09KHQ9dC5nZXQoZSkpPyIiOiIiK3R9LE10PWZ1bmN0aW9uKHQsZSl7cmV0dXJuIG51bGw9PSh0PXQuZ2V0KGUpKXx8IiI9PT10PzA6TnVtYmVyKHQpfTtJdC5wcm90b3R5cGUuWj1mdW5jdGlvbih0KXtyZXR1cm4odD10aGlzLmdldCh0KSkmJmYodCk/dDpUfSxJdC5wcm90b3R5cGUuc2V0PWZ1bmN0aW9uKHQsZSxuKXtpZih0KWlmKCJvYmplY3QiPT10eXBlb2YgdClmb3IodmFyIHIgaW4gdCl0Lmhhc093blByb3BlcnR5KHIpJiYkdCh0aGlzLHIsdFtyXSxuKTtlbHNlICR0KHRoaXMsdCxlLG4pfTtmdW5jdGlvbiBEdCh0LGUsbixyLGEpe3JldHVybiB0PW5ldyBGdCh0LGUsbixyLGEpLEd0LnNldCh0Lm5hbWUsdCksdC5uYW1lfWZ1bmN0aW9uIHF0KHQsZSl7VnQucHVzaChbbmV3IFJlZ0V4cCgiXiIrdCsiJCIpLGVdKX1mdW5jdGlvbiBVdCh0LGUsbil7cmV0dXJuIER0KHQsZSxuLHZvaWQgMCxIdCl9ZnVuY3Rpb24gSHQoKXt9dmFyICR0PWZ1bmN0aW9uKHQsZSxuLHIpe251bGwhPW4mJmU9PT12biYmYWEudGVzdChuKTt2YXIgYT1YdChlKTthJiZhLm8/YS5vKHQsZSxuLHIpOnQuZGF0YS5zZXQoZSxuLHIpfSxHdD1uZXcgYixWdD1bXSxGdD1mdW5jdGlvbih0LGUsbixyLGEpe3RoaXMubmFtZT10LHRoaXMuRj1lLHRoaXMuWj1yLHRoaXMubz1hLHRoaXMuZGVmYXVsdFZhbHVlPW59LFh0PWZ1bmN0aW9uKHQpe3ZhciBlPUd0LmdldCh0KTtpZighZSlmb3IodmFyIG49MDtuPFZ0Lmxlbmd0aDtuKyspe3ZhciByPVZ0W25dLGE9clswXS5leGVjKHQpO2lmKGEpe2U9clsxXShhKSxHdC5zZXQoZS5uYW1lLGUpO2JyZWFrfX1yZXR1cm4gZX0sQnQ9VXQoImFwaVZlcnNpb24iLCJ2IiksenQ9VXQoImNsaWVudFZlcnNpb24iLCJfdiIpO0R0KCJhbm9ueW1pemVJcCIsImFpcCIpO3ZhciBLdD1EdCgiYWRTZW5zZUlkIiwiYSIpLFd0PUR0KCJoaXRUeXBlIiwidCIpLFp0PUR0KCJoaXRDYWxsYmFjayIpLFl0PUR0KCJoaXRQYXlsb2FkIik7RHQoIm5vbkludGVyYWN0aW9uIiwibmkiKSxEdCgiY3VycmVuY3lDb2RlIiwiY3UiKSxEdCgiZGF0YVNvdXJjZSIsImRzIik7dmFyIEp0PUR0KCJ1c2VCZWFjb24iLHZvaWQgMCwhMSksUXQ9RHQoInRyYW5zcG9ydCIpO0R0KCJzZXNzaW9uQ29udHJvbCIsInNjIiwiIiksRHQoInNlc3Npb25Hcm91cCIsInNnIiksRHQoInF1ZXVlVGltZSIsInF0Iik7dmFyIHRlPUR0KCJfcyIsIl9zIik7RHQoInNjcmVlbk5hbWUiLCJjZCIpO3ZhciBlZT1EdCgibG9jYXRpb24iLCJkbCIsIiIpLG5lPUR0KCJyZWZlcnJlciIsImRyIikscmU9RHQoInBhZ2UiLCJkcCIsIiIpO0R0KCJob3N0bmFtZSIsImRoIik7dmFyIGFlPUR0KCJsYW5ndWFnZSIsInVsIiksb2U9RHQoImVuY29kaW5nIiwiZGUiKTtEdCgidGl0bGUiLCJkdCIsZnVuY3Rpb24oKXtyZXR1cm4gUC50aXRsZXx8dm9pZCAwfSkscXQoImNvbnRlbnRHcm91cChbMC05XSspIixmdW5jdGlvbih0KXtyZXR1cm4gbmV3IEZ0KHRbMF0sImNnIit0WzFdKX0pO3ZhciBpZT1EdCgic2NyZWVuQ29sb3JzIiwic2QiKSxzZT1EdCgic2NyZWVuUmVzb2x1dGlvbiIsInNyIiksY2U9RHQoInZpZXdwb3J0U2l6ZSIsInZwIiksdWU9RHQoImphdmFFbmFibGVkIiwiamUiKSxsZT1EdCgiZmxhc2hWZXJzaW9uIiwiZmwiKTtEdCgiY2FtcGFpZ25JZCIsImNpIiksRHQoImNhbXBhaWduTmFtZSIsImNuIiksRHQoImNhbXBhaWduU291cmNlIiwiY3MiKSxEdCgiY2FtcGFpZ25NZWRpdW0iLCJjbSIpLER0KCJjYW1wYWlnbktleXdvcmQiLCJjayIpLER0KCJjYW1wYWlnbkNvbnRlbnQiLCJjYyIpO3ZhciBnZT1EdCgiZXZlbnRDYXRlZ29yeSIsImVjIiksaGU9RHQoImV2ZW50QWN0aW9uIiwiZWEiKSxmZT1EdCgiZXZlbnRMYWJlbCIsImVsIiksZGU9RHQoImV2ZW50VmFsdWUiLCJldiIpLHBlPUR0KCJzb2NpYWxOZXR3b3JrIiwic24iKSx2ZT1EdCgic29jaWFsQWN0aW9uIiwic2EiKSxtZT1EdCgic29jaWFsVGFyZ2V0Iiwic3QiKSxiZT1EdCgibDEiLCJwbHQiKSx3ZT1EdCgibDIiLCJwZHQiKSx5ZT1EdCgibDMiLCJkbnMiKSxfZT1EdCgibDQiLCJycnQiKSxPZT1EdCgibDUiLCJzcnQiKSxFZT1EdCgibDYiLCJ0Y3AiKSxUZT1EdCgibDciLCJkaXQiKSx4ZT1EdCgibDgiLCJjbHQiKSxrZT1EdCgibDkiLCJfZ3N0IiksU2U9RHQoImwxMCIsIl9nYnQiKSxDZT1EdCgibDExIiwiX2NzdCIpLGplPUR0KCJsMTIiLCJfY2J0IiksdD1EdCgidGltaW5nQ2F0ZWdvcnkiLCJ1dGMiKSxOZT1EdCgidGltaW5nVmFyIiwidXR2IiksUmU9RHQoInRpbWluZ0xhYmVsIiwidXRsIiksQWU9RHQoInRpbWluZ1ZhbHVlIiwidXR0Iik7RHQoImFwcE5hbWUiLCJhbiIpLER0KCJhcHBWZXJzaW9uIiwiYXYiLCIiKSxEdCgiYXBwSWQiLCJhaWQiLCIiKSxEdCgiYXBwSW5zdGFsbGVySWQiLCJhaWlkIiwiIiksRHQoImV4RGVzY3JpcHRpb24iLCJleGQiKSxEdCgiZXhGYXRhbCIsImV4ZiIpO3ZhciBMZT1EdCgiZXhwSWQiLCJ4aWQiKSxJZT1EdCgiZXhwVmFyIiwieHZhciIpLFBlPUR0KCJleHAiLCJleHAiKSxNZT1EdCgiX3V0bWEiLCJfdXRtYSIpLERlPUR0KCJfdXRteiIsIl91dG16IikscWU9RHQoIl91dG1odCIsIl91dG1odCIpLFVlPUR0KCJfaGMiLHZvaWQgMCwwKSxIZT1EdCgiX3RpIix2b2lkIDAsMCksJGU9RHQoIl90byIsdm9pZCAwLDIwKTtxdCgiZGltZW5zaW9uKFswLTldKykiLGZ1bmN0aW9uKHQpe3JldHVybiBuZXcgRnQodFswXSwiY2QiK3RbMV0pfSkscXQoIm1ldHJpYyhbMC05XSspIixmdW5jdGlvbih0KXtyZXR1cm4gbmV3IEZ0KHRbMF0sImNtIit0WzFdKX0pLER0KCJsaW5rZXJQYXJhbSIsdm9pZCAwLHZvaWQgMCxmdW5jdGlvbih0KXtpZih0LmdldChHZSkpcmV0dXJuIGcoMzUpLGtyLmdlbmVyYXRlKE1yKHQpKTt2YXIgZT1QdCh0LGhuKSxuPVB0KHQsUm4pfHwiIjtyZXR1cm4gZT0iX2dhPTIuIit4KE5yKG4rZSwwKSsiLiIrbisiLSIrZSksdD0odD1Ecih0KSk/KGcoNDQpLCImX2dhYz0xLiIreChbTnIodC5xYSwwKSx0LnRpbWVzdGFtcCx0LnFhXS5qb2luKCIuIikpKToiIixlK3R9LEh0KTt2YXIgR2U9VXQoIl9jZDJsIix2b2lkIDAsITEpLFZlPUR0KCJ1c2FnZSIsIl91IiksRmU9RHQoIl91bSIpO0R0KCJmb3JjZVNTTCIsdm9pZCAwLHZvaWQgMCxmdW5jdGlvbigpe3JldHVybiBsfSxmdW5jdGlvbih0LGUsbil7ZygzNCksbD0hIW59KTt2YXIgWGU9RHQoIl9qMSIsImppZCIpLEJlPUR0KCJfajIiLCJnamlkIik7cXQoIlxcJiguKikiLGZ1bmN0aW9uKHQpe3ZhciBuLHIsZT1uZXcgRnQodFswXSx0WzFdKSxhPShuPXRbMF0uc3Vic3RyaW5nKDEpLEd0Lm1hcChmdW5jdGlvbih0LGUpe2UuRj09biYmKHI9ZSl9KSxyJiZyLm5hbWUpO3JldHVybiBhJiYoZS5aPWZ1bmN0aW9uKHQpe3JldHVybiB0LmdldChhKX0sZS5vPWZ1bmN0aW9uKHQsZSxuLHIpe3Quc2V0KGEsbixyKX0sZS5GPXZvaWQgMCksZX0pO3ZhciB6ZT1VdCgiX29vdCIpLEtlPUR0KCJwcmV2aWV3VGFzayIpLFdlPUR0KCJjaGVja1Byb3RvY29sVGFzayIpLFplPUR0KCJ2YWxpZGF0aW9uVGFzayIpLFllPUR0KCJjaGVja1N0b3JhZ2VUYXNrIiksSmU9RHQoImhpc3RvcnlJbXBvcnRUYXNrIiksUWU9RHQoInNhbXBsZXJUYXNrIiksdG49RHQoIl9ybHQiKSxlbj1EdCgiYnVpbGRIaXRUYXNrIiksbm49RHQoInNlbmRIaXRUYXNrIikscm49RHQoImNlVGFzayIpLGFuPUR0KCJkZXZJZFRhc2siKSxvbj1EdCgidGltaW5nVGFzayIpLHNuPUR0KCJkaXNwbGF5RmVhdHVyZXNUYXNrIiksY249RHQoImN1c3RvbVRhc2siKSx1bj1EdCgiZnBzQ3Jvc3NEb21haW5UYXNrIiksbG49VXQoIl9jdGEiKSxnbj1VdCgibmFtZSIpLGhuPVV0KCJjbGllbnRJZCIsImNpZCIpLGZuPVV0KCJjbGllbnRJZFRpbWUiKSxkbj1VdCgic3RvcmVkQ2xpZW50SWQiKSxwbj1EdCgidXNlcklkIiwidWlkIiksdm49VXQoInRyYWNraW5nSWQiLCJ0aWQiKSxtbj1VdCgiY29va2llTmFtZSIsdm9pZCAwLCJfZ2EiKSxibj1VdCgiY29va2llRG9tYWluIiksd249VXQoImNvb2tpZVBhdGgiLHZvaWQgMCwiLyIpLHluPVV0KCJjb29raWVFeHBpcmVzIix2b2lkIDAsNjMwNzJlMyksX249VXQoImNvb2tpZVVwZGF0ZSIsdm9pZCAwLCEwKSxPbj1VdCgiY29va2llRmxhZ3MiLHZvaWQgMCwiIiksRW49VXQoImxlZ2FjeUNvb2tpZURvbWFpbiIpLFRuPVV0KCJsZWdhY3lIaXN0b3J5SW1wb3J0Iix2b2lkIDAsITApLHhuPVV0KCJzdG9yYWdlIix2b2lkIDAsImNvb2tpZSIpLGtuPVV0KCJhbGxvd0xpbmtlciIsdm9pZCAwLCExKSxTbj1VdCgiYWxsb3dBbmNob3IiLHZvaWQgMCwhMCksQ249VXQoInNhbXBsZVJhdGUiLCJzZiIsMTAwKSxqbj1VdCgic2l0ZVNwZWVkU2FtcGxlUmF0ZSIsdm9pZCAwLDEpLE5uPVV0KCJhbHdheXNTZW5kUmVmZXJyZXIiLHZvaWQgMCwhMSksUm49VXQoIl9naWQiLCJfZ2lkIiksQW49VXQoIl9nY24iKSxMbj1VdCgidXNlQW1wQ2xpZW50SWQiKSxJbj1VdCgiX2djbGlkIiksUG49VXQoIl9ndCIpLE1uPVV0KCJfZ2UiLHZvaWQgMCw3Nzc2ZTYpLERuPVV0KCJfZ2Nsc3JjIikscW49VXQoInN0b3JlR2FjIix2b2lkIDAsITApLFVuPUR0KCJfeF8xOSIpLEhuPUR0KCJfZnBsYyIsIl9mcGxjIiksJG49VXQoIl9jcyIpLEduPVV0KCJfdXNlVXAiLHZvaWQgMCwhMSksVm49RHQoInVwIiwidXAiKSxGbj1EdCgiX3RhYyIsdm9pZCAwLCExKSxYbj1VdCgiX2dicmFpZCIpLEJuPVV0KCJfZ2J0Iiksem49VXQoIl9nYmUiLHZvaWQgMCw3Nzc2ZTYpLEtuPUR0KCJ0cmFuc3BvcnRVcmwiKSxXbj1EdCgiX3IiLCJfciIpLFpuPUR0KCJfc2xjIiwiX3NsYyIpLFluPUR0KCJfZHAiKSxKbj1EdCgiX2p0Iix2b2lkIDAsIm4iKSxRbj1EdCgiYWxsb3dBZEZlYXR1cmVzIix2b2lkIDAsITApLHRyPUR0KCJhbGxvd0FkUGVyc29uYWxpemF0aW9uU2lnbmFscyIsdm9pZCAwLCEwKTtmdW5jdGlvbiBlcihlLHQsbixyKXt0W2VdPWZ1bmN0aW9uKCl7dHJ5e3JldHVybiByJiZnKHIpLG4uYXBwbHkodGhpcyxhcmd1bWVudHMpfWNhdGNoKHQpe3Rocm93IGJ0KCJleGMiLGUsdCYmdC5uYW1lKSx0fX19ZnVuY3Rpb24gbnIodCl7dmFyIGU7KGU9KGU9UHQodCxVbikmJnQuZ2V0KEdlKSk/ISgoZT1rci5nZXQodC5nZXQoU24pKSkmJmUuX2ZwbGMpOmUpJiYhY3IodCkmJnQuc2V0KEhuLCIwIil9ZnVuY3Rpb24gcnIodCxlKXt2YXIgbj10W2VdOyhpc05hTihuKXx8MS8wPT1ufHxuPDApJiYodFtlXT12b2lkIDApfWZ1bmN0aW9uIGFyKHQpe2lmKCJjb29raWUiPT1QdCh0LHhuKSYmIWdyJiYoaHIodCksIWdyKSl0aHJvdyJhYm9ydCJ9ZnVuY3Rpb24gb3IodCl7dmFyIGUsbixyO3QuZ2V0KFRuKSYmKGU9UHQodCxibiksKHI9RXIoIl9fdXRtYSIsbj1QdCh0LEVuKXx8QSgpLGUpKSYmKGcoMTkpLHQuc2V0KHFlLChuZXcgRGF0ZSkuZ2V0VGltZSgpLCEwKSx0LnNldChNZSxyLlIpLChlPUVyKCJfX3V0bXoiLG4sZSkpJiZyLmhhc2g9PWUuaGFzaCYmdC5zZXQoRGUsZS5SKSkpfWZ1bmN0aW9uIGlyKHQsZSl7ZT1HKFB0KHQsZSkpO3ZhciBuPWJyKFB0KHQsYm4pKS5zcGxpdCgiLiIpLmxlbmd0aDtyZXR1cm4gMTwodD15cihQdCh0LHduKSkpJiYobis9Ii0iK3QpLGU/WyJHQTEiLG4sZV0uam9pbigiLiIpOiIifWZ1bmN0aW9uIHNyKCl7dmFyIHQ9W10sZT1BKCkuc3BsaXQoIi4iKTtpZig0PT1lLmxlbmd0aCl7dmFyIG49ZVtlLmxlbmd0aC0xXTtpZihwYXJzZUludChuLDEwKT09bilyZXR1cm5bIm5vbmUiXX1mb3Iobj1lLmxlbmd0aC0yOzA8PW47bi0tKXQucHVzaChlLnNsaWNlKG4pLmpvaW4oIi4iKSk7cmV0dXJuIGU9UC5sb2NhdGlvbi5ob3N0bmFtZSxGLnRlc3QoZSl8fFYudGVzdChlKXx8dC5wdXNoKCJub25lIiksdH12YXIgY3I9ZnVuY3Rpb24odCl7aWYoImNvb2tpZSI9PXQuZ2V0KHhuKSlyZXR1cm4gMDwodD1IKCJGUExDIikpLmxlbmd0aD90WzBdOnZvaWQgMH0sdXI9ZnVuY3Rpb24odCl7dmFyIGU9TWF0aC5taW4oTXQodCxqbiksMTAwKTtyZXR1cm4hKG8oUHQodCxobikpJTEwMD49ZSl9LGxyPWZ1bmN0aW9uKHQpe3ZhciBlLG49e307KGZ1bmN0aW9uKHQpe3ZhciBlPUkucGVyZm9ybWFuY2V8fEkud2Via2l0UGVyZm9ybWFuY2UsZTtpZighKGU9ZSYmZS50aW1pbmcpKXJldHVybiExO3ZhciBuPWUubmF2aWdhdGlvblN0YXJ0O3JldHVybiAwPT1uPyExOih0W2JlXT1lLmxvYWRFdmVudFN0YXJ0LW4sdFt5ZV09ZS5kb21haW5Mb29rdXBFbmQtZS5kb21haW5Mb29rdXBTdGFydCx0W0VlXT1lLmNvbm5lY3RFbmQtZS5jb25uZWN0U3RhcnQsdFtPZV09ZS5yZXNwb25zZVN0YXJ0LWUucmVxdWVzdFN0YXJ0LHRbd2VdPWUucmVzcG9uc2VFbmQtZS5yZXNwb25zZVN0YXJ0LHRbX2VdPWUuZmV0Y2hTdGFydC1uLHRbVGVdPWUuZG9tSW50ZXJhY3RpdmUtbix0W3hlXT1lLmRvbUNvbnRlbnRMb2FkZWRFdmVudFN0YXJ0LW4sdFtrZV09a2EuTC1uLHRbU2VdPWthLnlhLW4sSS5nb29nbGVfdGFnX21hbmFnZXImJkkuZ29vZ2xlX3RhZ19tYW5hZ2VyLl9saSYmKGU9SS5nb29nbGVfdGFnX21hbmFnZXIuX2xpLHRbQ2VdPWUuY3N0LHRbamVdPWUuY2J0KSwhMCl9KG4pfHxmdW5jdGlvbih0KXtpZihJLnRvcCE9SSlyZXR1cm4hMTt2YXIgZT1JLmV4dGVybmFsLG49ZSYmZS5vbmxvYWRUO3JldHVybigwPChuPTIxNDc0ODM2NDg8KG49ZSYmIWUuaXNWYWxpZExvYWRUaW1lP3ZvaWQgMDpuKT92b2lkIDA6bikmJmUuc2V0UGFnZVJlYWR5VGltZSgpLG51bGw9PW4pPyExOih0W2JlXT1uLCEwKX0obikpJiYobnVsbD09KGU9bltiZV0pfHwxLzA9PWV8fGlzTmFOKGUpfHwoMDxlPyhycihuLHllKSxycihuLEVlKSxycihuLE9lKSxycihuLHdlKSxycihuLF9lKSxycihuLFRlKSxycihuLHhlKSxycihuLGtlKSxycihuLFNlKSxycihuLENlKSxycihuLGplKSxNKGZ1bmN0aW9uKCl7dChuKX0sMTApKTpwKEksImxvYWQiLGZ1bmN0aW9uKCl7bHIodCl9LCExKSkpfSxncj0hMSxocj1mdW5jdGlvbih0KXt2YXIgZSxuLHIsYSxvLGkscyxjLHU7ImNvb2tpZSI9PVB0KHQseG4pJiYoIXQuZ2V0KF9uKSYmUHQodCxkbik9PVB0KHQsaG4pfHwoZT0xZTMqTXQodCx5biksZnIodCxobixtbixlKSx0LmRhdGEuc2V0KGRuLFB0KHQsaG4pKSksIXQuZ2V0KF9uKSYmZHIodCk9PVB0KHQsUm4pfHxmcih0LFJuLEFuLDg2NGU1KSx0LmdldChxbik/KGU9UHQodCxJbikpJiYobj0wPT09KG49TWF0aC5taW4oTXQodCxNbiksMWUzKk10KHQseW4pKSk/MDpNYXRoLm1pbihuLDFlMypNdCh0LFBuKStuLShuZXcgRGF0ZSkuZ2V0VGltZSgpKSx0LmRhdGEuc2V0KE1uLG4pLHI9e30sYT1QdCh0LFBuKSxvPVB0KHQsRG4pLGk9d3IoUHQodCx3bikpLHM9YnIoUHQodCxibikpLGM9UHQodCx2biksdT1QdCh0LE9uKSxvJiYiYXcuZHMiIT1vP3ImJihyLnVhPSEwKTooZT1bIjEiLGEsRyhlKV0uam9pbigiLiIpLDA8PW4mJihyJiYoci50YT0hMCksJCgiX2dhY18iK0coYyksZSxpLHMsYyxuLHUpKSksX3IocikpOmcoNzUpLHQuZ2V0KHFuKSYmKGU9UHQodCxYbikpJiYobj0wPT09KG49TWF0aC5taW4oTXQodCx6biksMWUzKk10KHQseW4pKSk/MDpNYXRoLm1pbihuLDFlMypNdCh0LEJuKStuLShuZXcgRGF0ZSkuZ2V0VGltZSgpKSx0LmRhdGEuc2V0KHpuLG4pLHI9e30sdT1QdCh0LEJuKSxpPXdyKFB0KHQsd24pKSxzPWJyKFB0KHQsYm4pKSxjPVB0KHQsdm4pLHQ9UHQodCxPbiksZT1bIjEiLHUsRyhlKV0uam9pbigiLiIpLDA8PW4mJihyJiYoci50YT0hMCksJCgiX2dhY19nYl8iK0coYyksZSxpLHMsYyxuLHQpKSxPcihyKSkpfSxmcj1mdW5jdGlvbih0LGUsbixyKXt2YXIgYT1pcih0LGUpO2lmKGEpe249UHQodCxuKTt2YXIgbz13cihQdCh0LHduKSksaT1icihQdCh0LGJuKSkscz1QdCh0LE9uKSxjPVB0KHQsdm4pO2lmKCJhdXRvIiE9aSkkKG4sYSxvLGksYyxyLHMpJiYoZ3I9ITApO2Vsc2V7ZygzMik7Zm9yKHZhciB1PXNyKCksbD0wO2w8dS5sZW5ndGg7bCsrKWlmKGk9dVtsXSx0LmRhdGEuc2V0KGJuLGkpLGE9aXIodCxlKSwkKG4sYSxvLGksYyxyLHMpKXJldHVybiB2b2lkKGdyPSEwKTt0LmRhdGEuc2V0KGJuLCJhdXRvIil9fX0sZHI9ZnVuY3Rpb24odCl7dmFyIGU9SChQdCh0LEFuKSk7cmV0dXJuIHByKHQsZSl9LHByPWZ1bmN0aW9uKHQsZSl7cmV0dXJuIHZyKGUsUHQodCxibiksUHQodCx3bikpfSx2cj1mdW5jdGlvbih0LGUsbil7aWYodCYmISh0Lmxlbmd0aDwxKSl7Zm9yKHZhciByPVtdLGE9MDthPHQubGVuZ3RoO2ErKyl7dmFyIG89dFthXSxpPW8uc3BsaXQoIi4iKSxzPWkuc2hpZnQoKTsoaT0oIkdBMSI9PXN8fCIxIj09cykmJjE8aS5sZW5ndGg/KDE9PShvPWkuc2hpZnQoKS5zcGxpdCgiLSIpKS5sZW5ndGgmJihvWzFdPSIxIiksb1swXSo9MSxvWzFdKj0xLHtIOm8sczppLmpvaW4oIi4iKX0pOnUudGVzdChvKT97SDpbMCwwXSxzOm99OnZvaWQgMCkmJnIucHVzaChpKX1yZXR1cm4gMT09ci5sZW5ndGg/KGcoMTMpLHJbMF0ucyk6MCE9ci5sZW5ndGg/KGcoMTQpLDE9PShyPW1yKHIsYnIoZSkuc3BsaXQoIi4iKS5sZW5ndGgsMCkpLmxlbmd0aD9yWzBdLnM6KDE8KHI9bXIocix5cihuKSwxKSkubGVuZ3RoJiZnKDQxKSxyWzBdJiZyWzBdLnMpKTp2b2lkIGcoMTIpfWcoMTIpfSxtcj1mdW5jdGlvbih0LGUsbil7Zm9yKHZhciByLGE9W10sbz1bXSxpPTA7aTx0Lmxlbmd0aDtpKyspe3ZhciBzPXRbaV07cy5IW25dPT1lP2EucHVzaChzKTpudWxsPT1yfHxzLkhbbl08cj8obz1bc10scj1zLkhbbl0pOnMuSFtuXT09ciYmby5wdXNoKHMpfXJldHVybiAwPGEubGVuZ3RoP2E6b30sYnI9ZnVuY3Rpb24odCl7cmV0dXJuIDA9PXQuaW5kZXhPZigiLiIpP3Quc3Vic3RyKDEpOnR9LHdyPWZ1bmN0aW9uKHQpe3JldHVybiB0PzAhPSh0PTE8dC5sZW5ndGgmJnQubGFzdEluZGV4T2YoIi8iKT09dC5sZW5ndGgtMT90LnN1YnN0cigwLHQubGVuZ3RoLTEpOnQpLmluZGV4T2YoIi8iKT8iLyIrdDp0OiIvIn0seXI9ZnVuY3Rpb24odCl7cmV0dXJuIi8iPT0odD13cih0KSk/MTp0LnNwbGl0KCIvIikubGVuZ3RofSxfcj1mdW5jdGlvbih0KXt0LnRhJiZnKDc3KSx0Lm5hJiZnKDc0KSx0LnBhJiZnKDczKSx0LnVhJiZnKDY5KX0sT3I9ZnVuY3Rpb24odCl7dC50YSYmZyg4NSksdC5uYSYmZyg4NiksdC5wYSYmZyg4Nyl9O2Z1bmN0aW9uIEVyKHQsZSxuKXsibm9uZSI9PWUmJihlPSIiKTt2YXIgcj1bXSxhPUgodCk7dD0iX191dG1hIj09dD82OjI7Zm9yKHZhciBvPTA7bzxhLmxlbmd0aDtvKyspe3ZhciBpPSgiIithW29dKS5zcGxpdCgiLiIpO2kubGVuZ3RoPj10JiZyLnB1c2goe2hhc2g6aVswXSxSOmFbb10sTzppfSl9aWYoMCE9ci5sZW5ndGgpcmV0dXJuIDEhPXIubGVuZ3RoJiYoVHIoZSxyKXx8VHIobixyKXx8VHIobnVsbCxyKSl8fHJbMF19ZnVuY3Rpb24gVHIodCxlKXt2YXIgbjtudWxsPT10P249dD0xOihuPW8odCksdD1vKE8odCwiLiIpP3Quc3Vic3RyaW5nKDEpOiIuIit0KSk7Zm9yKHZhciByPTA7cjxlLmxlbmd0aDtyKyspaWYoZVtyXS5oYXNoPT1ufHxlW3JdLmhhc2g9PXQpcmV0dXJuIGVbcl19dmFyIHhyPW5ldyBSZWdFeHAoL15odHRwcz86XC9cLyhbXlwvOl0rKS8pLGtyPUkuZ29vZ2xlX3RhZ19kYXRhLmdsQnJpZGdlLFNyPVJlZ0V4cCgiKC4qKShbPyYjXSkoPzpfZ2E9W14mI10qKSg/OiY/KSguKikiKSxDcj1SZWdFeHAoIiguKikoWz8mI10pKD86X2dhYz1bXiYjXSopKD86Jj8pKC4qKSIpO2Z1bmN0aW9uIGpyKHQsZSl7dmFyIG49bmV3IERhdGUscj1JLm5hdmlnYXRvcixhPXIucGx1Z2luc3x8W107Zm9yKHQ9W3Qsci51c2VyQWdlbnQsbi5nZXRUaW1lem9uZU9mZnNldCgpLG4uZ2V0WWVhcigpLG4uZ2V0RGF0ZSgpLG4uZ2V0SG91cnMoKSxuLmdldE1pbnV0ZXMoKStlXSxlPTA7ZTxhLmxlbmd0aDsrK2UpdC5wdXNoKGFbZV0uZGVzY3JpcHRpb24pO3JldHVybiBvKHQuam9pbigiLiIpKX1mdW5jdGlvbiBOcih0LGUpe3ZhciBuPW5ldyBEYXRlLHI9SS5uYXZpZ2F0b3IsYT1uLmdldEhvdXJzKCkrTWF0aC5mbG9vcigobi5nZXRNaW51dGVzKCkrZSkvNjApO3JldHVybiBvKFt0LHIudXNlckFnZW50LHIubGFuZ3VhZ2V8fCIiLG4uZ2V0VGltZXpvbmVPZmZzZXQoKSxuLmdldFllYXIoKSxuLmdldERhdGUoKStNYXRoLmZsb29yKGEvMjQpLCgyNCthKSUyNCwoNjArbi5nZXRNaW51dGVzKCkrZSklNjBdLmpvaW4oIi4iKSl9ZnVuY3Rpb24gUnIodCl7Zyg0OCksdGhpcy50YXJnZXQ9dCx0aGlzLlQ9ITF9UnIucHJvdG90eXBlLmNhPWZ1bmN0aW9uKHQsZSl7aWYodCl7aWYodGhpcy50YXJnZXQuZ2V0KEdlKSlyZXR1cm4ga3IuZGVjb3JhdGUoTXIodGhpcy50YXJnZXQpLHQsZSk7aWYodC50YWdOYW1lKXtpZigiYSI9PXQudGFnTmFtZS50b0xvd2VyQ2FzZSgpKXJldHVybiB2b2lkKHQuaHJlZiYmKHQuaHJlZj1Bcih0aGlzLHQuaHJlZixlKSkpO2lmKCJmb3JtIj09dC50YWdOYW1lLnRvTG93ZXJDYXNlKCkpcmV0dXJuIExyKHRoaXMsdCl9cmV0dXJuInN0cmluZyI9PXR5cGVvZiB0P0FyKHRoaXMsdCxlKTp2b2lkIDB9fTt2YXIgQXI9ZnVuY3Rpb24odCxlLG4peyhyPVNyLmV4ZWMoZSkpJiYzPD1yLmxlbmd0aCYmKGU9clsxXSsoclszXT9yWzJdK3JbM106IiIpKSwocj1Dci5leGVjKGUpKSYmMzw9ci5sZW5ndGgmJihlPXJbMV0rKHJbM10/clsyXStyWzNdOiIiKSksdD10LnRhcmdldC5nZXQoImxpbmtlclBhcmFtIik7dmFyIHI9ZS5pbmRleE9mKCI/IiksYT1lLmluZGV4T2YoIiMiKTtyZXR1cm4oZT0oZT1uP2UrKC0xPT1hPyIjIjoiJiIpK3Q6LTE9PWE/ZSsoLTE9PT1yPyI/IjoiJiIpK3Q6ZS5zdWJzdHJpbmcoMCxhKSsoLTE9PT1yfHxhPHI/Ij8iOiImIikrdCtlLnN1YnN0cmluZyhhKSkucmVwbGFjZSgvJitfZ2E9LywiJl9nYT0iKSkucmVwbGFjZShSZWdFeHAoIiYrX2dhYz0iKSwiJl9nYWM9Iil9LExyPWZ1bmN0aW9uKHQsZSl7aWYoZSYmZS5hY3Rpb24paWYoImdldCI9PWUubWV0aG9kLnRvTG93ZXJDYXNlKCkpe3Q9dC50YXJnZXQuZ2V0KCJsaW5rZXJQYXJhbSIpLnNwbGl0KCImIik7Zm9yKHZhciBuPTA7bjx0Lmxlbmd0aDtuKyspe2Zvcih2YXIgcj0oYT10W25dLnNwbGl0KCI9IikpWzFdLGE9YVswXSxvPWUuY2hpbGROb2Rlc3x8W10saT0hMSxzPTA7czxvLmxlbmd0aDtzKyspaWYob1tzXS5uYW1lPT1hKXtvW3NdLnNldEF0dHJpYnV0ZSgidmFsdWUiLHIpLGk9ITA7YnJlYWt9aXx8KChvPVAuY3JlYXRlRWxlbWVudCgiaW5wdXQiKSkuc2V0QXR0cmlidXRlKCJ0eXBlIiwiaGlkZGVuIiksby5zZXRBdHRyaWJ1dGUoIm5hbWUiLGEpLG8uc2V0QXR0cmlidXRlKCJ2YWx1ZSIsciksZS5hcHBlbmRDaGlsZChvKSl9fWVsc2UicG9zdCI9PWUubWV0aG9kLnRvTG93ZXJDYXNlKCkmJihlLmFjdGlvbj1Bcih0LGUuYWN0aW9uKSl9O2Z1bmN0aW9uIElyKHQsZSl7aWYoZSE9UC5sb2NhdGlvbi5ob3N0bmFtZSlmb3IodmFyIG49MDtuPHQubGVuZ3RoO24rKylpZih0W25daW5zdGFuY2VvZiBSZWdFeHApe2lmKHRbbl0udGVzdChlKSlyZXR1cm4gMX1lbHNlIGlmKDA8PWUuaW5kZXhPZih0W25dKSlyZXR1cm4gMX1mdW5jdGlvbiBQcih0LGUpe3JldHVybiBlIT1qcih0LDApJiZlIT1qcih0LC0xKSYmZSE9anIodCwtMikmJmUhPU5yKHQsMCkmJmUhPU5yKHQsLTEpJiZlIT1Ocih0LC0yKX1mdW5jdGlvbiBNcih0KXt2YXIgZT1Ecih0KSxuPXt9O3JldHVybiBuLl9nYT10LmdldChobiksbi5fZ2lkPXQuZ2V0KFJuKXx8dm9pZCAwLG4uX2dhYz1lP1tlLnFhLGUudGltZXN0YW1wXS5qb2luKCIuIik6dm9pZCAwLGU9dC5nZXQoSG4pLHQ9Y3IodCksbi5fZnBsYz1lJiYiMCIhPT1lP2U6dCxufWZ1bmN0aW9uIERyKHQpe2Z1bmN0aW9uIGUodCl7cmV0dXJuIG51bGw9PXR8fCIiPT09dD8wOk51bWJlcih0KX12YXIgbj10LmdldChJbik7aWYobiYmdC5nZXQocW4pKXt2YXIgcj1lKHQuZ2V0KFBuKSk7aWYoISgxZTMqcitlKHQuZ2V0KE1uKSk8PShuZXcgRGF0ZSkuZ2V0VGltZSgpKSlyZXR1cm57dGltZXN0YW1wOnIscWE6bn07Zyg3Nil9fVJyLnByb3RvdHlwZS5TPWZ1bmN0aW9uKHIsYSx0KXtmdW5jdGlvbiBlKHQpe3RyeXt0PXR8fEkuZXZlbnQ7dDp7dmFyIGU9dC50YXJnZXR8fHQuc3JjRWxlbWVudDtmb3IodD0xMDA7ZSYmMDx0Oyl7aWYoZS5ocmVmJiZlLm5vZGVOYW1lLm1hdGNoKC9eYSg/OnJlYSk/JC9pKSl7dmFyIG49ZTticmVhayB0fWU9ZS5wYXJlbnROb2RlLHQtLX1uPXt9fSgiaHR0cDoiPT1uLnByb3RvY29sfHwiaHR0cHM6Ij09bi5wcm90b2NvbCkmJklyKHIsbi5ob3N0bmFtZXx8IiIpJiZuLmhyZWYmJihuLmhyZWY9QXIobyxuLmhyZWYsYSkpfWNhdGNoKHQpe2coMjYpfX12YXIgbz10aGlzO3RoaXMudGFyZ2V0LmdldChHZSk/a3IuYXV0byhmdW5jdGlvbigpe3JldHVybiBNcihvLnRhcmdldCl9LHIsYT8iZnJhZ21lbnQiOiIiLHQpOih0aGlzLlR8fCh0aGlzLlQ9ITAscChQLCJtb3VzZWRvd24iLGUsITEpLHAoUCwia2V5dXAiLGUsITEpKSx0JiZwKFAsInN1Ym1pdCIsZnVuY3Rpb24odCl7dmFyIGU7KHQ9KHQ9dHx8SS5ldmVudCkudGFyZ2V0fHx0LnNyY0VsZW1lbnQpJiZ0LmFjdGlvbiYmKChlPXQuYWN0aW9uLm1hdGNoKHhyKSkmJklyKHIsZVsxXSkmJkxyKG8sdCkpfSkpfSxSci5wcm90b3R5cGUuJD1mdW5jdGlvbih0KXt2YXIgZSxuOyF0fHx2b2lkIDAhPT0obj0oZT10aGlzKS50YXJnZXQuZ2V0KCRuKSkmJmtyLnBhc3N0aHJvdWdoKGZ1bmN0aW9uKCl7aWYobigiYW5hbHl0aWNzX3N0b3JhZ2UiKSlyZXR1cm57fTt2YXIgdD17fTtyZXR1cm4gdC5fZ2E9ZS50YXJnZXQuZ2V0KGhuKSx0Ll91cD0iMSIsdH0sMSwhMCl9O2Z1bmN0aW9uIHFyKHQsZSxuLHIpe249bnx8e307dmFyIGE9MSxvPXtpZDplLHR5cGU6YT1Wci50ZXN0KGUpPzI6YSxCOm4uZGF0YUxheWVyfHwiZGF0YUxheWVyIixHOiExfSxpPXZvaWQgMDtyZXR1cm4gdC5nZXQoIiZndG0iKT09ZSYmKG8uRz0hMCksMT09PWE/KG8uaWE9ISF0LmdldCgiYW5vbnltaXplSXAiKSxvLnN5bmM9ciwidDAiIT0oZT1TdHJpbmcodC5nZXQoIm5hbWUiKSkpJiYoby50YXJnZXQ9ZSksVShTdHJpbmcodC5nZXQoInRyYWNraW5nSWQiKSkpfHwoby5jbGllbnRJZD1TdHJpbmcodC5nZXQoaG4pKSxvLmthPU51bWJlcih0LmdldChmbikpLG49bi5wYWxpbmRyb21lP1hyOkZyLG49KG49UC5jb29raWUucmVwbGFjZSgvXnwoOyArKS9nLCI7IikubWF0Y2gobikpP24uc29ydCgpLmpvaW4oIiIpLnN1YnN0cmluZygxKTp2b2lkIDAsby5sYT1uLG8ucWE9UihQdCh0LGVlKSwiZ2NsaWQiKSkpOjI9PT1hJiYoby5jb250ZXh0PSJjIixpPXthbGxvd19nb29nbGVfc2lnbmFsczp0LmdldChRbiksYWxsb3dfYWRfcGVyc29uYWxpemF0aW9uX3NpZ25hbHM6dC5nZXQodHIpfSksS3IobyxpKSx6cihvKX1mdW5jdGlvbiBVcih0LGUpe3ZhciBuLHI7KHQ9dC5tb2RlbCkuZ2V0KCJkY0xvYWRlZCIpfHwoKG49bmV3IGkoaCh0KSkpLnNldCgyOSksdC5zZXQoRmUsbi5DKSwoZT1lfHx7fSlbbW5dJiYocj1HKGVbbW5dKSksZnVuY3Rpb24obix0KXt2YXIgcj10LmdldChlbik7dC5zZXQoZW4sZnVuY3Rpb24odCl7WXIobix0LFhlKSxZcihuLHQsQmUpO3ZhciBlPXIodCk7cmV0dXJuIEpyKG4sdCksZX0pO3ZhciBhPXQuZ2V0KG5uKTt0LnNldChubixmdW5jdGlvbih0KXt2YXIgZSxuPWEodCk7cmV0dXJuIFFyKHQpJiYoZyg4MCksZT17VTplYSh0LDEpLGdvb2dsZTplYSh0LDIpLGNvdW50OjB9LGZ0KCJodHRwczovL3N0YXRzLmcuZG91YmxlY2xpY2submV0L2ovY29sbGVjdCIsZS5VLGUpLHQuc2V0KFhlLCIiLCEwKSksbn0pfShlPW5ldyBacih0LHIpLHQpLHQuc2V0KCJkY0xvYWRlZCIsITApKX1mdW5jdGlvbiBIcih0KXt2YXIgZSxuO3QuZ2V0KCJkY0xvYWRlZCIpfHwiY29va2llIiE9dC5nZXQoeG4pfHwoZT1uZXcgWnIodCksWXIoZSx0LFhlKSxZcihlLHQsQmUpLEpyKGUsdCksZT1Rcih0KSxuPXRhKHQpLGUmJnQuc2V0KFduLDEsITApLG4mJnQuc2V0KFpuLDEsITApLChlfHxuKSYmKHQuc2V0KEpuLCJkIiwhMCksZyg3OSksdC5zZXQoWW4se1U6ZWEodCwxKSxnb29nbGU6ZWEodCwyKSxWOm5hKHQpLGNvdW50OjB9LCEwKSkpfWZ1bmN0aW9uICRyKHQpe2Z1bmN0aW9uIG4odCxlKXtvLm1vZGVsLmRhdGEuc2V0KHQsZSl9ZnVuY3Rpb24gZSh0LGUpe24odCxlKSxvLmZpbHRlcnMuYWRkKHQpfXZhciByLGEsbz10aGlzO3RoaXMubW9kZWw9bmV3IEl0LHRoaXMuZmlsdGVycz1uZXcgUSxuKGduLHRbZ25dKSxuKHZuLChyPXRbdm5dKT9yLnJlcGxhY2UoL15bXHNceGEwXSt8W1xzXHhhMF0rJC9nLCIiKToiIiksbihtbix0W21uXSksbihibix0W2JuXXx8QSgpKSxuKHduLHRbd25dKSxuKHluLHRbeW5dKSxuKF9uLHRbX25dKSxuKE9uLHRbT25dKSxuKEVuLHRbRW5dKSxuKFRuLHRbVG5dKSxuKGtuLHRba25dKSxuKFNuLHRbU25dKSxuKENuLHRbQ25dKSxuKGpuLHRbam5dKSxuKE5uLHRbTm5dKSxuKHhuLHRbeG5dKSxuKHBuLHRbcG5dKSxuKGZuLHRbZm5dKSxuKExuLHRbTG5dKSxuKHFuLHRbcW5dKSxuKEdlLHRbR2VdKSxuKFVuLHRbVW5dKSxuKEduLHRbR25dKSxuKCRuLHRbJG5dKSxuKEJ0LDEpLG4oenQsImo5NiIpLGUobG4sTnQpLGUoemUsT3QpLGUoY24sVCksZShLZSxTdCksZShXZSxFdCksZShaZSxqdCksZShZZSxhciksZShKZSxvciksZShRZSxfdCksZSh0bixMdCksZShybixrdCksZShhbixDdCksZShzbixIciksZSh1bixuciksZShlbixUdCksZShubix4dCksZShvbiwoYT10aGlzLGZ1bmN0aW9uKHQpe3ZhciBlLG4scjsicGFnZXZpZXciIT10LmdldChXdCl8fGEuSXx8KGEuST0hMCxlPXVyKHQpLG49MDxSKFB0KHQsZWUpLCJnY2xpZCIpLmxlbmd0aCxyPTA8UihQdCh0LGVlKSwid2JyYWlkIikubGVuZ3RoLChlfHxufHxyKSYmbHIoZnVuY3Rpb24odCl7ZSYmYS5zZW5kKCJ0aW1pbmciLHQpLChufHxyKSYmYS5zZW5kKCJhZHRpbWluZyIsdCl9KSl9KSksY2EodGhpcy5tb2RlbCksc2EodGhpcy5tb2RlbCx0W2huXSksdGhpcy5tb2RlbC5zZXQoS3QsKHQ9SS5nYUdsb2JhbD1JLmdhR2xvYmFsfHx7fSkuaGlkPXQuaGlkfHxBdCgpKX12YXIgR3I9L14oR1RNfE9QVCktW0EtWjAtOV0rJC8sVnI9L15HLVtBLVowLTldKyQvLEZyPS87X2dhZXhwPVteO10qL2csWHI9LzsoKF9fdXRtYT0pfChbXjs9XSs9R0FYP1xkK1wuKSlbXjtdKi9nLEJyPS9eaHR0cHM/OlwvXC9bXHdcLS5dK1wuZ29vZ2xlLmNvbSg6XGQrKT9cL29wdGltaXplXC9vcHQtbGF1bmNoXC5odG1sXD8uKiQvLHpyPWZ1bmN0aW9uKHQpe2Z1bmN0aW9uIGUodCxlKXtlJiYobis9IiYiK3QrIj0iK3goZSkpfXZhciBuPVoodC50eXBlKSt4KHQuaWQpO3JldHVybiJkYXRhTGF5ZXIiIT10LkImJmUoImwiLHQuQiksZSgiY3giLHQuY29udGV4dCksZSgidCIsdC50YXJnZXQpLGUoImNpZCIsdC5jbGllbnRJZCksZSgiY2lkdCIsdC5rYSksZSgiZ2FjIix0LmxhKSxlKCJhaXAiLHQuaWEpLHQuc3luYyYmZSgibSIsInN5bmMiKSxlKCJjeWNsZSIsdC5HKSx0LnFhJiZlKCJnY2xpZCIsdC5xYSksQnIudGVzdChQLnJlZmVycmVyKSYmZSgiY2IiLFN0cmluZyhBdCgpKSksbn0sS3I9ZnVuY3Rpb24ocix0KXt2YXIgZT0obmV3IERhdGUpLmdldFRpbWUoKTtJW3IuQl09SVtyLkJdfHxbXSxlPXsiZ3RtLnN0YXJ0IjplfSxyLnN5bmN8fChlLmV2ZW50PSJndG0uanMiKSxJW3IuQl0ucHVzaChlKSwyPT09ci50eXBlJiZmdW5jdGlvbih0LGUsbil7SVtyLkJdLnB1c2goYXJndW1lbnRzKX0oImNvbmZpZyIsci5pZCx0KX0sV3I9e30sWnI9ZnVuY3Rpb24odCxlKXtlPWV8fCgoZT1QdCh0LGduKSkmJiJ0MCIhPWU/cmEudGVzdChlKT8iX2dhdF8iK0coUHQodCx2bikpOiJfZ2F0XyIrRyhlKToiX2dhdCIpLHRoaXMuWT1lfSxZcj1mdW5jdGlvbih0LGUsbil7ITE9PT1lLmdldChRbil8fGUuZ2V0KG4pfHwoIjEiPT1IKHQuWSlbMF0/ZS5zZXQobiwiIiwhMCk6ZS5zZXQobiwiIitBdCgpLCEwKSl9LEpyPWZ1bmN0aW9uKHQsZSl7UXIoZSkmJiQodC5ZLCIxIixQdChlLHduKSxQdChlLGJuKSxQdChlLHZuKSw2ZTQsUHQoZSxPbikpfSxRcj1mdW5jdGlvbih0KXtyZXR1cm4hIXQuZ2V0KFhlKSYmITEhPT10LmdldChRbil9LHRhPWZ1bmN0aW9uKHQpe3JldHVybiFXcltQdCh0LHZuKV0mJnZvaWQgMD09PXQuZ2V0KCImZ3RtIikmJnZvaWQgMD09PXQuZ2V0KFF0KSYmdm9pZCAwPT09dC5nZXQoS24pJiZ2b2lkIDA9PT10LmdldChVbil9LGVhPWZ1bmN0aW9uKGUsdCl7ZnVuY3Rpb24gbih0KXtYdCh0KS5GJiZyLnNldChYdCh0KS5GLGUuZ2V0KHQpKX12YXIgcj1uZXcgYjtuKEJ0KSxuKHp0KSxuKHZuKSxuKGhuKSxuKFhlKSwxPT10JiYobihwbiksbihCZSksbihSbikpLCExPT09ZS5nZXQodHIpJiZyLnNldCgibnBhIiwiMSIpLHIuc2V0KFh0KFZlKS5GLHcoZSkpO3ZhciBhPSIiO3JldHVybiByLm1hcChmdW5jdGlvbih0LGUpe2ErPXgodCkrIj0iLGErPXgoIiIrZSkrIiYifSksYSs9Ino9IitBdCgpLDE9PXQ/YT0idD1kYyZhaXA9MSZfcj0zJiIrYToyPT10JiYoYT0idD1zciZhaXA9MSZfcj00JnNsZl9yZD0xJiIrYSksYX0sbmE9ZnVuY3Rpb24obil7aWYodGEobikpcmV0dXJuIFdyW1B0KG4sdm4pXT0hMCxmdW5jdGlvbih0KXt2YXIgZTt0JiYhV3JbdF0mJihlPXFyKG4sdCksaihlKSxXclt0XT0hMCl9fSxyYT0vXmd0bVxkKyQvLGFhPS9eKFVBfFlUfE1PfEdQKS0oXGQrKS0oXGQrKSQvOyRyLnByb3RvdHlwZS5nZXQ9ZnVuY3Rpb24odCl7cmV0dXJuIHRoaXMubW9kZWwuZ2V0KHQpfSwkci5wcm90b3R5cGUuc2V0PWZ1bmN0aW9uKHQsZSl7dGhpcy5tb2RlbC5zZXQodCxlKX0sJHIucHJvdG90eXBlLnNlbmQ9ZnVuY3Rpb24odCl7dmFyIGUsbjthcmd1bWVudHMubGVuZ3RoPDF8fChuPSJzdHJpbmciPT10eXBlb2YgdD8oZT10LFtdLnNsaWNlLmNhbGwoYXJndW1lbnRzLDEpKTooZT10JiZ0W1d0XSxhcmd1bWVudHMpLGUmJigobj1tKHVhW2VdfHxbXSxuKSlbV3RdPWUsdGhpcy5tb2RlbC5zZXQobix2b2lkIDAsITApLHRoaXMuZmlsdGVycy5EKHRoaXMubW9kZWwpLHRoaXMubW9kZWwuZGF0YS5tPXt9KSl9LCRyLnByb3RvdHlwZS5tYT1mdW5jdGlvbih0LGUpe3ZhciBuPXRoaXM7bWEodCxuLGUpfHwod2EodCxmdW5jdGlvbigpe21hKHQsbixlKX0pLGJhKFN0cmluZyhuLmdldChnbikpLHQsdm9pZCAwLGUsITApKX07ZnVuY3Rpb24gb2EodCl7cmV0dXJuInByZXJlbmRlciIhPVAudmlzaWJpbGl0eVN0YXRlJiYodCgpLCEwKX1mdW5jdGlvbiBpYSh0KXtpZihmKHRbMF0pKXRoaXMudT10WzBdO2Vsc2V7dmFyIGU9bGEuZXhlYyh0WzBdKTtpZihudWxsIT1lJiY0PT1lLmxlbmd0aCYmKHRoaXMuZGE9ZVsxXXx8InQwIix0aGlzLks9ZVsyXXx8IiIsdGhpcy5tZXRob2ROYW1lPWVbM10sdGhpcy5hYT1bXS5zbGljZS5jYWxsKHQsMSksdGhpcy5LfHwodGhpcy5BPSJjcmVhdGUiPT10aGlzLm1ldGhvZE5hbWUsdGhpcy5pPSJyZXF1aXJlIj09dGhpcy5tZXRob2ROYW1lLHRoaXMuZz0icHJvdmlkZSI9PXRoaXMubWV0aG9kTmFtZSx0aGlzLmJhPSJyZW1vdmUiPT10aGlzLm1ldGhvZE5hbWUpLHRoaXMuaSYmKDM8PXRoaXMuYWEubGVuZ3RoPyh0aGlzLlg9dGhpcy5hYVsxXSx0aGlzLlc9dGhpcy5hYVsyXSk6dGhpcy5hYVsxXSYmKF8odGhpcy5hYVsxXSk/dGhpcy5YPXRoaXMuYWFbMV06dGhpcy5XPXRoaXMuYWFbMV0pKSksZT10WzFdLHQ9dFsyXSwhdGhpcy5tZXRob2ROYW1lKXRocm93ImFib3J0IjtpZih0aGlzLmkmJighXyhlKXx8IiI9PWUpKXRocm93ImFib3J0IjtpZih0aGlzLmcmJighXyhlKXx8IiI9PWV8fCFmKHQpKSl0aHJvdyJhYm9ydCI7aWYoZ2EodGhpcy5kYSl8fGdhKHRoaXMuSykpdGhyb3ciYWJvcnQiO2lmKHRoaXMuZyYmInQwIiE9dGhpcy5kYSl0aHJvdyJhYm9ydCJ9fXZhciBzYT1mdW5jdGlvbih0LGUpe3ZhciBuLHI9UHQodCxtbik7aWYodC5kYXRhLnNldChBbiwiX2dhIj09cj8iX2dpZCI6cisiX2dpZCIpLCJjb29raWUiPT1QdCh0LHhuKSYmKGdyPSExLHI9SChQdCh0LG1uKSksKHI9cHIodCxyKSl8fChyPVB0KHQsYm4pLHI9bnVsbCE9KHI9RXIoIl9fdXRtYSIsbj1QdCh0LEVuKXx8QSgpLHIpKT8oZygxMCksci5PWzFdKyIuIityLk9bMl0pOnZvaWQgMCksciYmKGdyPSEwKSwocj0obj0obj1yJiYhdC5nZXQoX24pKT8yPT0obj1yLnNwbGl0KCIuIikpLmxlbmd0aCYmKCEhKG49TnVtYmVyKG5bMV0pKSYmbisobz1NdCh0LHluKSk8KG5ldyBEYXRlKS5nZXRUaW1lKCkvMWUzKTpuKT92b2lkIDA6cikmJih0LmRhdGEuc2V0KGRuLHIpLHQuZGF0YS5zZXQoaG4sciksKHI9ZHIodCkpJiZ0LmRhdGEuc2V0KFJuLHIpKSx0LmdldChxbikmJihyPXQuZ2V0KEluKSxuPXQuZ2V0KERuKSwhcnx8biYmImF3LmRzIiE9bikmJihyPXt9LG49KFA/QihyKTp7fSlbUHQodCx2bildLF9yKHIpLG4mJjAhPW4ubGVuZ3RoJiYocj1uWzBdLHQuZGF0YS5zZXQoUG4sci50aW1lc3RhbXAvMWUzKSx0LmRhdGEuc2V0KEluLHIucWEpKSksdC5nZXQocW4pJiYocj10LmdldChYbiksbj17fSxvPShQP0IobiwiX2dhY19nYiIsITApOnt9KVtQdCh0LHZuKV0sT3IobiksbyYmMCE9by5sZW5ndGgmJihvPShuPW9bMF0pLnFhLHImJnIhPT1vfHwobi5sYWJlbHMmJm4ubGFiZWxzLmxlbmd0aCYmKG8rPSIuIituLmxhYmVscy5qb2luKCIuIikpLHQuZGF0YS5zZXQoQm4sbi50aW1lc3RhbXAvMWUzKSx0LmRhdGEuc2V0KFhuLG8pKSkpKSx0LmdldChfbikpe3I9TigiX2dhIiwhIXQuZ2V0KFNuKSk7dmFyIGE9TigiX2dsIiwhIXQuZ2V0KFNuKSksbz0obj1rci5nZXQodC5nZXQoU24pKSkuX2dhO2EmJjA8YS5pbmRleE9mKCJfZ2EqIikmJiFvJiZnKDMwKSxhPSEoZXx8IXQuZ2V0KEduKSkmJih2b2lkIDAhPT0oYT10LmdldCgkbikpJiYhYSgiYW5hbHl0aWNzX3N0b3JhZ2UiKSYmKGcoODQpLHQuZGF0YS5zZXQoVm4sMSksISEoYT0oYT1uLl91cCk/ISEoYT14ci5leGVjKFAucmVmZXJyZXIpKSYmKGE9YVsxXSwoaT1QLmxvY2F0aW9uLmhvc3RuYW1lKT09PWF8fDA8PWkuaW5kZXhPZigiLiIrYSl8fDA8PWEuaW5kZXhPZigiLiIraSkpOmEpKSk7dmFyIGk9bi5nY2xpZCxzPW4uX2dhYztpZihyfHxvfHxpfHxzKWlmKHImJm8mJmcoMzYpLHQuZ2V0KGtuKXx8Vyh0LmdldChMbikpfHxhKXtpZihvJiYoZygzOCksdC5kYXRhLnNldChobixvKSxuLl9naWQmJihnKDUxKSx0LmRhdGEuc2V0KFJuLG4uX2dpZCkpKSxpPyhnKDgyKSx0LmRhdGEuc2V0KEluLGkpLG4uZ2Nsc3JjJiZ0LmRhdGEuc2V0KERuLG4uZ2Nsc3JjKSk6cyYmKG89cy5zcGxpdCgiLiIpKSYmMj09PW8ubGVuZ3RoJiYoZygzNyksdC5kYXRhLnNldChJbixvWzBdKSx0LmRhdGEuc2V0KFBuLG9bMV0pKSwobj1uLl9mcGxjKSYmUHQodCxVbikmJihnKDgzKSx0LmRhdGEuc2V0KEhuLG4pKSxyKXQ6aWYobj1yLmluZGV4T2YoIi4iKSwtMT09bilnKDIyKTtlbHNle2lmKG89ci5zdWJzdHJpbmcoMCxuKSxuPShhPXIuc3Vic3RyaW5nKG4rMSkpLmluZGV4T2YoIi4iKSxyPWEuc3Vic3RyaW5nKDAsbiksYT1hLnN1YnN0cmluZyhuKzEpLCIxIj09byl7aWYoUHIobj1hLHIpKXtnKDIzKTticmVhayB0fX1lbHNle2lmKCIyIiE9byl7ZygyMik7YnJlYWsgdH1pZihvPSIiLG49MDwobj1hLmluZGV4T2YoIi0iKSk/KG89YS5zdWJzdHJpbmcoMCxuKSxhLnN1YnN0cmluZyhuKzEpKTphLnN1YnN0cmluZygxKSxQcihvK24scikpe2coNTMpO2JyZWFrIHR9byYmKGcoMiksdC5kYXRhLnNldChSbixvKSl9ZygxMSksdC5kYXRhLnNldChobixuKSwocj1OKCJfZ2FjIiwhIXQuZ2V0KFNuKSkpJiYoIjEiIT0ocj1yLnNwbGl0KCIuIikpWzBdfHw0IT1yLmxlbmd0aD9nKDcyKTpQcihyWzNdLHJbMV0pP2coNzEpOih0LmRhdGEuc2V0KEluLHJbM10pLHQuZGF0YS5zZXQoUG4sclsyXSksZyg3MCkpKX19ZWxzZSBnKDIxKX1lJiYoZyg5KSx0LmRhdGEuc2V0KGhuLHgoZSkpKSx0LmdldChobil8fCgoZT0oIShlPUkuZ2FHbG9iYWwpfHwhZS5mcm9tX2Nvb2tpZXx8ImNvb2tpZSI9PT1QdCh0LHhuKSkmJihlPWUmJmUudmlkKSYmLTEhPT1lLnNlYXJjaChjKT9lOnZvaWQgMCk/KGcoMTcpLHQuZGF0YS5zZXQoaG4sZSkpOihnKDgpLHQuZGF0YS5zZXQoaG4sZCgpKSkpLHQuZ2V0KFJuKXx8KGcoMyksdC5kYXRhLnNldChSbixkKCkpKSxocih0KSxlPUkuZ2FHbG9iYWw9SS5nYUdsb2JhbHx8e30sdD0ocj1QdCh0LGhuKSk9PT1QdCh0LGRuKSwobnVsbD09ZS52aWR8fHQmJiFlLmZyb21fY29va2llKSYmKGUudmlkPXIsZS5mcm9tX2Nvb2tpZT10KX0sY2E9ZnVuY3Rpb24odCl7dmFyIGU9SS5uYXZpZ2F0b3Isbj1JLnNjcmVlbixyPVAubG9jYXRpb24sYT10LnNldDt0Ont2YXIgbz0hIXQuZ2V0KE5uKSxpPSEhdC5nZXQoTG4pLHM9UC5yZWZlcnJlcjtpZigvXihodHRwcz98YW5kcm9pZC1hcHApOlwvXC8vaS50ZXN0KHMpKXtpZihvKWJyZWFrIHQ7aWYobz0iLy8iK1AubG9jYXRpb24uaG9zdG5hbWUsIXYocyxvKSl7aWYoaSYmKGk9by5yZXBsYWNlKC9cLi9nLCItIikrIi5jZG4uYW1wcHJvamVjdC5vcmciLHYocyxpKSkpe3M9dm9pZCAwO2JyZWFrIHR9YnJlYWsgdH19cz12b2lkIDB9aWYoYS5jYWxsKHQsbmUscyksciYmKCIvIiE9KGE9ci5wYXRobmFtZXx8IiIpLmNoYXJBdCgwKSYmKGcoMzEpLGE9Ii8iK2EpLHQuc2V0KGVlLHIucHJvdG9jb2wrIi8vIityLmhvc3RuYW1lK2Erci5zZWFyY2gpKSxuJiZ0LnNldChzZSxuLndpZHRoKyJ4IituLmhlaWdodCksbiYmdC5zZXQoaWUsbi5jb2xvckRlcHRoKyItYml0Iiksbj1QLmRvY3VtZW50RWxlbWVudCxzPShhPVAuYm9keSkmJmEuY2xpZW50V2lkdGgmJmEuY2xpZW50SGVpZ2h0LGk9W10sbiYmbi5jbGllbnRXaWR0aCYmbi5jbGllbnRIZWlnaHQmJigiQ1NTMUNvbXBhdCI9PT1QLmNvbXBhdE1vZGV8fCFzKT9pPVtuLmNsaWVudFdpZHRoLG4uY2xpZW50SGVpZ2h0XTpzJiYoaT1bYS5jbGllbnRXaWR0aCxhLmNsaWVudEhlaWdodF0pLG49aVswXTw9MHx8aVsxXTw9MD8iIjppLmpvaW4oIngiKSx0LnNldChjZSxuKSxuPXQuc2V0LChhPShhPUkubmF2aWdhdG9yKT9hLnBsdWdpbnM6bnVsbCkmJmEubGVuZ3RoKWZvcihzPTA7czxhLmxlbmd0aCYmIXU7cysrKS0xPChpPWFbc10pLm5hbWUuaW5kZXhPZigiU2hvY2t3YXZlIEZsYXNoIikmJih1PWkuZGVzY3JpcHRpb24pO2lmKCF1KXRyeXt2YXIgYz1uZXcgQWN0aXZlWE9iamVjdCgiU2hvY2t3YXZlRmxhc2guU2hvY2t3YXZlRmxhc2guNyIpLHU9Yy5HZXRWYXJpYWJsZSgiJHZlcnNpb24iKX1jYXRjaCh0KXt9aWYoIXUpdHJ5e2M9bmV3IEFjdGl2ZVhPYmplY3QoIlNob2Nrd2F2ZUZsYXNoLlNob2Nrd2F2ZUZsYXNoLjYiKSx1PSJXSU4gNiwwLDIxLDAiLGMuQWxsb3dTY3JpcHRBY2Nlc3M9ImFsd2F5cyIsdT1jLkdldFZhcmlhYmxlKCIkdmVyc2lvbiIpfWNhdGNoKHQpe31pZighdSl0cnl7dT0oYz1uZXcgQWN0aXZlWE9iamVjdCgiU2hvY2t3YXZlRmxhc2guU2hvY2t3YXZlRmxhc2giKSkuR2V0VmFyaWFibGUoIiR2ZXJzaW9uIil9Y2F0Y2godCl7fWlmKHUmJihjPXUubWF0Y2goL1tcZF0rL2cpKSYmMzw9Yy5sZW5ndGgmJih1PWNbMF0rIi4iK2NbMV0rIiByIitjWzJdKSxuLmNhbGwodCxsZSx1fHx2b2lkIDApLHQuc2V0KG9lLFAuY2hhcmFjdGVyU2V0fHxQLmNoYXJzZXQpLHQuc2V0KHVlLGUmJiJmdW5jdGlvbiI9PXR5cGVvZiBlLmphdmFFbmFibGVkJiZlLmphdmFFbmFibGVkKCl8fCExKSx0LnNldChhZSwoZSYmKGUubGFuZ3VhZ2V8fGUuYnJvd3Nlckxhbmd1YWdlKXx8IiIpLnRvTG93ZXJDYXNlKCkpLHQuZGF0YS5zZXQoSW4sTigiZ2NsaWQiLCEwKSksdC5kYXRhLnNldChEbixOKCJnY2xzcmMiLCEwKSksdC5kYXRhLnNldChQbixNYXRoLnJvdW5kKChuZXcgRGF0ZSkuZ2V0VGltZSgpLzFlMykpLHQuZ2V0KEluKXx8KHQuZGF0YS5zZXQoWG4sTigid2JyYWlkIiwhMCkpLHQuZGF0YS5zZXQoQm4sTWF0aC5yb3VuZCgobmV3IERhdGUpLmdldFRpbWUoKS8xZTMpKSksciYmdC5nZXQoU24pJiYoZT1QLmxvY2F0aW9uLmhhc2gpKXtmb3IoZT1lLnNwbGl0KC9bPyYjXSsvKSxyPVtdLHU9MDt1PGUubGVuZ3RoOysrdSkoTyhlW3VdLCJ1dG1faWQiKXx8TyhlW3VdLCJ1dG1fY2FtcGFpZ24iKXx8TyhlW3VdLCJ1dG1fc291cmNlIil8fE8oZVt1XSwidXRtX21lZGl1bSIpfHxPKGVbdV0sInV0bV90ZXJtIil8fE8oZVt1XSwidXRtX2NvbnRlbnQiKXx8TyhlW3VdLCJnY2xpZCIpfHxPKGVbdV0sImRjbGlkIil8fE8oZVt1XSwiZ2Nsc3JjIil8fE8oZVt1XSwid2JyYWlkIikpJiZyLnB1c2goZVt1XSk7MDxyLmxlbmd0aCYmKGU9IiMiK3Iuam9pbigiJiIpLHQuc2V0KGVlLHQuZ2V0KGVlKStlKSl9fSx1YT17cGFnZXZpZXc6W3JlXSxldmVudDpbZ2UsaGUsZmUsZGVdLHNvY2lhbDpbcGUsdmUsbWVdLHRpbWluZzpbdCxOZSxBZSxSZV19LE5lPWZ1bmN0aW9uKG4pe3ZhciByLGE7b2Eobil8fChnKDE2KSxyPSExLHAoUCwidmlzaWJpbGl0eWNoYW5nZSIsYT1mdW5jdGlvbigpe3ZhciB0LGU7IXImJm9hKG4pJiYocj0hMCx0PWEsKGU9UCkucmVtb3ZlRXZlbnRMaXN0ZW5lcj9lLnJlbW92ZUV2ZW50TGlzdGVuZXIoInZpc2liaWxpdHljaGFuZ2UiLHQsITEpOmUuZGV0YWNoRXZlbnQmJmUuZGV0YWNoRXZlbnQoIm9udmlzaWJpbGl0eWNoYW5nZSIsdCkpfSkpfSxsYT0vXig/OihcdyspXC4pPyg/OihcdyspOik/KFx3KykkLztmdW5jdGlvbiBnYSh0KXtyZXR1cm4gMDw9dC5pbmRleE9mKCIuIil8fDA8PXQuaW5kZXhPZigiOiIpfWZ1bmN0aW9uIGhhKHQsZSl7ZmEuc2V0KHQsZSksZT1wYS5nZXQodCl8fFtdO2Zvcih2YXIgbj0wO248ZS5sZW5ndGg7bisrKWVbbl0oKTtwYS5zZXQodCxbXSl9dmFyIGZhPW5ldyBiLGRhPW5ldyBiLHBhPW5ldyBiLHZhPXtlYzo0NSxlY29tbWVyY2U6NDYsbGlua2lkOjQ3fSxtYT1mdW5jdGlvbih0LGUsbil7ZT09a2F8fGUuZ2V0KGduKTt2YXIgcj1mYS5nZXQodCk7cmV0dXJuISFmKHIpJiYoZS5wbHVnaW5zXz1lLnBsdWdpbnNffHxuZXcgYixlLnBsdWdpbnNfLmdldCh0KXx8ZS5wbHVnaW5zXy5zZXQodCxuZXcgcihlLG58fHt9KSksITApfSxiYT1mdW5jdGlvbih0LGUsbixyLGEpe2lmKCFmKGZhLmdldChlKSkmJiFkYS5nZXQoZSkpe3ZhLmhhc093blByb3BlcnR5KGUpJiZnKHZhW2VdKTt2YXIgbyxpPXZvaWQgMDtpZihHci50ZXN0KGUpKXtpZihnKDUyKSwhKHQ9a2Euaih0KSkpcmV0dXJuITA7bj1xcih0Lm1vZGVsLGUscixhKSxpPWZ1bmN0aW9uKCl7eGEuRChbInByb3ZpZGUiLGUsZnVuY3Rpb24oKXt9XSk7dmFyIHQ9SVtyJiZyLmRhdGFMYXllcnx8ImRhdGFMYXllciJdO3QmJnQuaGlkZSYmZih0LmhpZGUuZW5kKSYmdC5oaWRlW2VdJiYodC5oaWRlLmVuZCgpLHQuaGlkZS5lbmQ9dm9pZCAwKX19IW4mJnZhLmhhc093blByb3BlcnR5KGUpPyhnKDM5KSxuPWUrIi5qcyIpOmcoNDMpLG4mJihyJiYobz1yW1VuXSksXyhvKXx8KG89dm9pZCAwKSx0PUVhKFRhKG4sbykpLCFvfHxfYSh0LnByb3RvY29sKSYmeWEodCl8fCh0PUVhKFRhKG4pKSksX2EodC5wcm90b2NvbCkmJnlhKHQpJiYoaih0LnVybCx2b2lkIDAsYSx2b2lkIDAsaSksZGEuc2V0KGUsITApKSl9fSx3YT1mdW5jdGlvbih0LGUpe3ZhciBuPXBhLmdldCh0KXx8W107bi5wdXNoKGUpLHBhLnNldCh0LG4pfSx5YT1mdW5jdGlvbih0KXt2YXIgZT1FYShQLmxvY2F0aW9uLmhyZWYpO3JldHVybiEoIU8odC51cmwsWigxKSkmJiFPKHQudXJsLFooMikpKXx8ISh0LnF1ZXJ5fHwwPD10LnVybC5pbmRleE9mKCI/Iil8fDA8PXQucGF0aC5pbmRleE9mKCI6Ly8iKSkmJighISh0Lmhvc3Q9PWUuaG9zdCYmdC5wb3J0PT1lLnBvcnR8fG4mJigoZT1QLmNyZWF0ZUVsZW1lbnQoImEiKSkuaHJlZj1uLGU9T2EoZSksdC5ob3N0PT09ZVswXSYmdC5wb3J0PT09ZVsxXSkpfHwoZT0iaHR0cDoiPT10LnByb3RvY29sPzgwOjQ0MywhKCJ3d3cuZ29vZ2xlLWFuYWx5dGljcy5jb20iIT10Lmhvc3R8fCh0LnBvcnR8fGUpIT1lfHwhTyh0LnBhdGgsIi9wbHVnaW5zLyIpKSkpfSxfYT1mdW5jdGlvbih0KXt2YXIgZT1QLmxvY2F0aW9uLnByb3RvY29sO3JldHVybiJodHRwczoiPT10fHx0PT1lfHwiaHR0cDoiPT10JiYiaHR0cDoiPT1lfSxPYT1mdW5jdGlvbih0KXt2YXIgZT0wPD0obj10Lmhvc3RuYW1lfHwiIikuaW5kZXhPZigiXSIpLG49bi5zcGxpdChlPyJdIjoiOiIpWzBdLnRvTG93ZXJDYXNlKCk7cmV0dXJuIGUmJihuKz0iXSIpLGU9KHQucHJvdG9jb2x8fCIiKS50b0xvd2VyQ2FzZSgpLGU9K3QucG9ydHx8KCJodHRwOiI9PWU/ODA6Imh0dHBzOiI9PWU/NDQzOiIiKSx0PXQucGF0aG5hbWV8fCIiLFtuLCIiK2UsdD0hTyh0LCIvIik/Ii8iK3Q6dF19LEVhPWZ1bmN0aW9uKHQpe3ZhciBlPVAuY3JlYXRlRWxlbWVudCgiYSIpO2UuaHJlZj1QLmxvY2F0aW9uLmhyZWY7dmFyIG49KGUucHJvdG9jb2x8fCIiKS50b0xvd2VyQ2FzZSgpLHI9T2EoZSksYT1lLnNlYXJjaHx8IiIsbz1uKyIvLyIrclswXSsoclsxXT8iOiIrclsxXToiIik7cmV0dXJuIE8odCwiLy8iKT90PW4rdDpPKHQsIi8iKT90PW8rdDohdHx8Tyh0LCI/Iik/dD1vK3JbMl0rKHR8fGEpOnQuc3BsaXQoIi8iKVswXS5pbmRleE9mKCI6Iik8MCYmKHQ9bytyWzJdLnN1YnN0cmluZygwLHJbMl0ubGFzdEluZGV4T2YoIi8iKSkrIi8iK3QpLGUuaHJlZj10LG49T2EoZSkse3Byb3RvY29sOihlLnByb3RvY29sfHwiIikudG9Mb3dlckNhc2UoKSxob3N0Om5bMF0scG9ydDpuWzFdLHBhdGg6blsyXSxxdWVyeTplLnNlYXJjaHx8IiIsdXJsOnR8fCIifX0sVGE9ZnVuY3Rpb24odCxlKXtyZXR1cm4gdCYmMDw9dC5pbmRleE9mKCIvIik/dDooZXx8Z3QoITEpKSsiL3BsdWdpbnMvdWEvIit0fSx4YT17Z2E6ZnVuY3Rpb24oKXt4YS5mYT1bXX19O3hhLmdhKCkseGEuRD1mdW5jdGlvbih0KXt2YXIgZT14YS5KLmFwcGx5KHhhLGFyZ3VtZW50cyksZT14YS5mYS5jb25jYXQoZSk7Zm9yKHhhLmZhPVtdOzA8ZS5sZW5ndGgmJiF4YS52KGVbMF0pJiYoZS5zaGlmdCgpLCEoMDx4YS5mYS5sZW5ndGgpKTspO3hhLmZhPXhhLmZhLmNvbmNhdChlKX0seGEucmE9ZnVuY3Rpb24odCl7a2EucSYmKDMwMD09PWthLnEubGVuZ3RoJiYoa2EucS5zaGlmdCgpLGthLnFkKyspLGthLnEucHVzaCh0KSl9LHhhLko9ZnVuY3Rpb24odCl7Zm9yKHZhciBlPVtdLG49MDtuPGFyZ3VtZW50cy5sZW5ndGg7bisrKXRyeXt2YXIgcj1uZXcgaWEoYXJndW1lbnRzW25dKTtyLmc/aGEoci5hYVswXSxyLmFhWzFdKTooci5pJiYoci5oYT1iYShyLmRhLHIuYWFbMF0sci5YLHIuVykpLGUucHVzaChyKSkseGEucmEoYXJndW1lbnRzW25dKX1jYXRjaCh0KXt9cmV0dXJuIGV9LHhhLnY9ZnVuY3Rpb24odCl7dHJ5e2lmKHQudSl0LnUuY2FsbChJLGthLmooInQwIikpO2Vsc2V7dmFyIGUsbixyLGE9dC5kYT09cz9rYTprYS5qKHQuZGEpO2lmKHQuQSl7aWYoInQwIj09dC5kYSYmbnVsbD09PShhPWthLmNyZWF0ZS5hcHBseShrYSx0LmFhKSkpcmV0dXJuITB9ZWxzZSBpZih0LmJhKWthLnJlbW92ZSh0LmRhKTtlbHNlIGlmKGEpaWYodC5pKXtpZih0LmhhJiYodC5oYT1iYSh0LmRhLHQuYWFbMF0sdC5YLHQuVykpLCFtYSh0LmFhWzBdLGEsdC5XKSlyZXR1cm4hMH1lbHNlIHQuSz8oZT10Lm1ldGhvZE5hbWUsbj10LmFhLChyPWEucGx1Z2luc18uZ2V0KHQuSykpW2VdLmFwcGx5KHIsbikpOmFbdC5tZXRob2ROYW1lXS5hcHBseShhLHQuYWEpfX1jYXRjaCh0KXt9fTt2YXIga2E9ZnVuY3Rpb24odCl7ZygxKSx4YS5ELmFwcGx5KHhhLFthcmd1bWVudHNdKX07a2EuaD17fSxrYS5QPVtdLGthLkw9MCxrYS55YT0wLGthLmFuc3dlcj00Mjt2YXIgU2E9W3ZuLGJuLGduXTtrYS5jcmVhdGU9ZnVuY3Rpb24odCl7dmFyIGU9bShTYSxbXS5zbGljZS5jYWxsKGFyZ3VtZW50cykpO2VbZ25dfHwoZVtnbl09InQwIik7dmFyIG49IiIrZVtnbl07aWYoa2EuaFtuXSlyZXR1cm4ga2EuaFtuXTtpZihmdW5jdGlvbih0KXtpZihXKHRbTG5dKSYmKHZvaWQgMD09PXJ0JiYoZT0oZT1rci5nZXQoKSkmJmUuX2dhfHx2b2lkIDApJiYocnQ9ZSxnKDgxKSksdm9pZCAwIT09cnQpKXJldHVybiB0W2huXXx8KHRbaG5dPXJ0KSwhMTtpZih0W0xuXSl7aWYoZyg2NyksdFt4bl0mJiJjb29raWUiIT10W3huXSlyZXR1cm4hMTtpZih2b2lkIDAhPT1ydCl0W2huXXx8KHRbaG5dPXJ0KTtlbHNle3ZhciBlPVN0cmluZyh0W2JuXXx8QSgpKSxuPVN0cmluZyh0W3duXXx8Ii8iKSxyPUgoU3RyaW5nKHRbbW5dfHwiX2dhIikpO2lmKChlPSEoKGU9dnIocixlLG4pKSYmIWMudGVzdChlKSl8fCgwPT0oZT1IKCJBTVBfVE9LRU4iKSkubGVuZ3RofHwxPT1lLmxlbmd0aCYmKCIkUkVUUklFVklORyI9PShlPWRlY29kZVVSSUNvbXBvbmVudChlWzBdKSl8fCIkT1BUX09VVCI9PWV8fCIkRVJST1IiPT1lfHwiJE5PVF9GT1VORCI9PWUpKSkmJnN0KHosU3RyaW5nKHRbdm5dKSkpcmV0dXJuITB9fXJldHVybiExfShlKSlyZXR1cm4gbnVsbDtpZihlPW5ldyAkcihlKSxrYS5oW25dPWUsa2EuUC5wdXNoKGUpLG49d3QoKS50cmFja2VyX2NyZWF0ZWQsZihuKSl0cnl7bihlKX1jYXRjaCh0KXt9cmV0dXJuIGV9LGthLnJlbW92ZT1mdW5jdGlvbih0KXtmb3IodmFyIGU9MDtlPGthLlAubGVuZ3RoO2UrKylpZihrYS5QW2VdLmdldChnbik9PXQpe2thLlAuc3BsaWNlKGUsMSksa2EuaFt0XT1udWxsO2JyZWFrfX0sa2Euaj1mdW5jdGlvbih0KXtyZXR1cm4ga2EuaFt0XX0sa2EuZ2V0QWxsPWZ1bmN0aW9uKCl7cmV0dXJuIGthLlAuc2xpY2UoMCl9LGthLk49ZnVuY3Rpb24oKXtpZigiZ2EiIT1zJiZnKDQ5KSwhKG49SVtzXSl8fDQyIT1uLmFuc3dlcil7a2EuTD1uJiZuLmwsa2EueWE9K25ldyBEYXRlLGthLmxvYWRlZD0hMDt2YXIgdD1uJiZuLnEsZT15KHQpLG49W107aWYoZT9uPXQuc2xpY2UoMCk6Zyg1MCksa2EucT1lP3Q6W10sa2EucS5zcGxpY2UoMCksa2EucWQ9MCxlcigiY3JlYXRlIix0PUlbc109a2EsdC5jcmVhdGUpLGVyKCJyZW1vdmUiLHQsdC5yZW1vdmUpLGVyKCJnZXRCeU5hbWUiLHQsdC5qLDUpLGVyKCJnZXRBbGwiLHQsdC5nZXRBbGwsNiksZXIoImdldCIsdD0kci5wcm90b3R5cGUsdC5nZXQsNyksZXIoInNldCIsdCx0LnNldCw0KSxlcigic2VuZCIsdCx0LnNlbmQpLGVyKCJyZXF1aXJlU3luYyIsdCx0Lm1hKSxlcigiZ2V0Iix0PUl0LnByb3RvdHlwZSx0LmdldCksZXIoInNldCIsdCx0LnNldCksImh0dHBzOiIhPVAubG9jYXRpb24ucHJvdG9jb2wmJiFsKXt0Ontmb3IodD1QLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJzY3JpcHQiKSxlPTA7ZTx0Lmxlbmd0aCYmZTwxMDA7ZSsrKXt2YXIgcj10W2VdLnNyYztpZihyJiYwPT1yLmluZGV4T2YoZ3QoITApKyIvYW5hbHl0aWNzIikpe3Q9ITA7YnJlYWsgdH19dD0hMX10JiYobD0hMCl9dD0oKEkuZ2FwbHVnaW5zPUkuZ2FwbHVnaW5zfHx7fSkuTGlua2VyPVJyKS5wcm90b3R5cGUsaGEoImxpbmtlciIsUnIpLGVyKCJkZWNvcmF0ZSIsdCx0LmNhLDIwKSxlcigiYXV0b0xpbmsiLHQsdC5TLDI1KSxlcigicGFzc3Rocm91Z2giLHQsdC4kLDI1KSxoYSgiZGlzcGxheWZlYXR1cmVzIixVciksaGEoImFkZmVhdHVyZXMiLFVyKSx4YS5ELmFwcGx5KGthLG4pfX07QWU9a2EuTixSZT1JW3NdO1JlJiZSZS5yP0FlKCk6TmUoQWUpLE5lKGZ1bmN0aW9uKCl7eGEuRChbInByb3ZpZGUiLCJyZW5kZXIiLFRdKX0pfSh3aW5kb3cpfQo="},{"name":"brave-fix","aliases":["bf"],"kind":{"mime":"application/javascript"},"content":"Ly8vIGJyYXZlLWZpeC5qcwovLy8gYWxpYXMgYmYuanMKZGVsZXRlIE5hdmlnYXRvci5wcm90b3R5cGUuYnJhdmUKZGVsZXRlIHdpbmRvdy5uYXZpZ2F0b3IuYnJhdmUK"}] \ No newline at end of file +[{"name":"async-sugarcoat-04394153a7ce417b88e3fe1790a4e6a269bfebe5","aliases":[],"kind":{"mime":"application/javascript"},"content":"e2NvbnN0IGE9e307KGU9PnsidXNlIHN0cmljdCI7Y29uc3QgdD1TeW1ib2woImRlZmVycmVkSGFuZGxlIiksbj1TeW1ib2woIm9ubG9hZHN0YXJ0IiksaT1TeW1ib2woIm9ucHJvZ3Jlc3MiKSxyPVN5bWJvbCgib25hYm9ydCIpLGE9U3ltYm9sKCJvbmVycm9yIiksbz1TeW1ib2woIm9ubG9hZCIpLHM9U3ltYm9sKCJvbnRpbWVvdXQiKSxnPVN5bWJvbCgib25sb2FkZW5kIiksbD1TeW1ib2woIm9ucmVhZHlzdGF0ZWNoYW5nZSIpLGQ9U3ltYm9sKCJyZWFkeVN0YXRlIiksdT1TeW1ib2woInRpbWVvdXQiKSxjPVN5bWJvbCgid2l0aENyZWRlbnRpYWxzIikscD1TeW1ib2woInVwbG9hZCIpLGg9U3ltYm9sKCJyZXNwb25zZVR5cGUiKSx2PShlLG4pPT57dmFyIHQ9bi5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7T2JqZWN0LmRlZmluZVByb3BlcnR5KGUsbix7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6bnVsbCx3cml0YWJsZTohMH0pLGUuYWRkRXZlbnRMaXN0ZW5lcih0LGZ1bmN0aW9uKGUpe2NvbnN0IHQ9dGhpc1tuXTt0JiZ0LmNhbGwodGhpcyxlKX0pfSxrPShlLHQpPT57ZVtkXT10LGUuZGlzcGF0Y2hFdmVudChuZXcgRXZlbnQoInJlYWR5c3RhdGVjaGFuZ2UiKSl9O2xldCBNPSEwO2NsYXNzIG0gZXh0ZW5kcyBFdmVudFRhcmdldHtjb25zdHJ1Y3Rvcigpe2lmKHN1cGVyKCksISh0aGlzIGluc3RhbmNlb2YgZnx8dGhpcyBpbnN0YW5jZW9mIHkpKXRocm93IG5ldyBUeXBlRXJyb3IoIklsbGVnYWwgY29uc3RydWN0b3IiKTt2KHRoaXMsbiksdih0aGlzLGkpLHYodGhpcyxyKSx2KHRoaXMsYSksdih0aGlzLG8pLHYodGhpcyxzKSx2KHRoaXMsZyl9Z2V0IG9ubG9hZHN0YXJ0KCl7cmV0dXJuIHRoaXNbbl19c2V0IG9ubG9hZHN0YXJ0KGUpe3RoaXNbbl09ZX1nZXQgb25wcm9ncmVzcygpe3JldHVybiB0aGlzW2ldfXNldCBvbnByb2dyZXNzKGUpe3RoaXNbaV09ZX1nZXQgb25hYm9ydCgpe3JldHVybiB0aGlzW3JdfXNldCBvbmFib3J0KGUpe3RoaXNbcl09ZX1nZXQgb25lcnJvcigpe3JldHVybiB0aGlzW2FdfXNldCBvbmVycm9yKGUpe3RoaXNbYV09ZX1nZXQgb250aW1lb3V0KCl7cmV0dXJuIHRoaXNbc119c2V0IG9udGltZW91dChlKXt0aGlzW3NdPWV9Z2V0IG9ubG9hZGVuZCgpe3JldHVybiB0aGlzW2ddfXNldCBvbmxvYWRlbmQoZSl7dGhpc1tnXT1lfX1lLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQ9e2NvbmZpZ3VyYWJsZTohMCxlbnVtZXJhYmxlOiEwLHZhbHVlOm0sd3JpdGFibGU6ITB9O2NsYXNzIHkgZXh0ZW5kcyBte2NvbnN0cnVjdG9yKCl7aWYoTSl0aHJvdyBuZXcgVHlwZUVycm9yKCJJbGxlZ2FsIGNvbnN0cnVjdG9yIik7c3VwZXIoKX19ZS5YTUxIdHRwUmVxdWVzdFVwbG9hZD17Y29uZmlndXJhYmxlOiEwLGVudW1lcmFibGU6ITAsdmFsdWU6eSx3cml0YWJsZTohMH07Y2xhc3MgZiBleHRlbmRzIG17Y29uc3RydWN0b3IoKXtzdXBlcigpLE09ITE7dmFyIGU9bmV3IHk7TT0hMCxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyx0LHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTpudWxsLHdyaXRhYmxlOiEwfSksdih0aGlzLGwpLE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLGQse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiExLHZhbHVlOjAsd3JpdGFibGU6ITB9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyx1LHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTowLHdyaXRhYmxlOiEwfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsYyx7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6ITEsd3JpdGFibGU6ITB9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyxwLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTplLHdyaXRhYmxlOiExfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsaCx7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6IiIsd3JpdGFibGU6ITB9KX1nZXQgb25yZWFkeXN0YXRlY2hhbmdlKCl7cmV0dXJuIHRoaXNbbF19c2V0IG9ucmVhZHlzdGF0ZWNoYW5nZShlKXt0aGlzW2xdPWV9Z2V0IHJlYWR5U3RhdGUoKXtyZXR1cm4gdGhpc1tkXX1vcGVuKGUsdCl7c3dpdGNoKHRoaXNbZF0pe2Nhc2UgMDpjYXNlIDQ6ayh0aGlzLDEpfX1zZXRSZXF1ZXN0SGVhZGVyKGUsdCl7fXNldFRydXN0VG9rZW4oZSl7fWdldCB0aW1lb3V0KCl7cmV0dXJuIHRoaXNbdV19c2V0IHRpbWVvdXQoZSl7dGhpc1t1XT1lfWdldCB3aXRoQ3JlZGVudGlhbHMoKXtyZXR1cm4gdGhpc1tjXX1zZXQgd2l0aENyZWRlbnRpYWxzKGUpe3N3aXRjaCh0aGlzW2RdKXtjYXNlIDA6Y2FzZSAxOmJyZWFrO2RlZmF1bHQ6dGhyb3cgbmV3IERPTUV4Y2VwdGlvbigiRmFpbGVkIHRvIHNldCB0aGUgJ3dpdGhDcmVkZW50aWFscycgcHJvcGVydHkgb24gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIHZhbHVlIG1heSBvbmx5IGJlIHNldCBpZiB0aGUgb2JqZWN0J3Mgc3RhdGUgaXMgVU5TRU5UIG9yIE9QRU5FRC4iKX10aGlzW2NdPSEhZX1nZXQgdXBsb2FkKCl7cmV0dXJuIHRoaXNbcF19c2VuZCgpe2lmKDEhPT10aGlzW2RdfHxudWxsIT09dGhpc1t0XSl0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCJGYWlsZWQgdG8gZXhlY3V0ZSAnc2VuZCcgb24gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIG9iamVjdCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELiIpO3RoaXNbdF09c2V0VGltZW91dCgoKT0+e3RoaXNbdF09bnVsbCxrKHRoaXMsNCksdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCJlcnJvciIpKSx0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoImxvYWRlbmQiKSl9LDApfWFib3J0KCl7MT09PXRoaXNbZF0mJm51bGwhPT10aGlzW3RdJiYoY2xlYXJUaW1lb3V0KHRoaXNbdF0pLHRoaXNbdF09bnVsbCxrKHRoaXMsMCksdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCJhYm9ydCIpKSx0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoImxvYWRlbmQiKSkpfWdldCByZXNwb25zZVVSTCgpe3JldHVybiIifWdldCBzdGF0dXMoKXtyZXR1cm4gMH1nZXQgc3RhdHVzVGV4dCgpe3JldHVybiIifWdldFJlc3BvbnNlSGVhZGVyKGUpe3JldHVybiBudWxsfW92ZXJyaWRlTWltZVR5cGUoZSl7fWdldCByZXNwb25zZVR5cGUoKXtyZXR1cm4gdGhpc1toXX1zZXQgcmVzcG9uc2VUeXBlKGUpe2lmKDQ9PT10aGlzW2RdKXRocm93IG5ldyBET01FeGNlcHRpb24oIkZhaWxlZCB0byBzZXQgdGhlICdyZXNwb25zZVR5cGUnIHByb3BlcnR5IG9uICdYTUxIdHRwUmVxdWVzdCc6IFRoZSByZXNwb25zZSB0eXBlIGNhbm5vdCBiZSBzZXQgaWYgdGhlIG9iamVjdCdzIHN0YXRlIGlzIExPQURJTkcgb3IgRE9ORS4iKTtzd2l0Y2goZSl7Y2FzZSIiOmNhc2UiYXJyYXlidWZmZXIiOmNhc2UiYmxvYiI6Y2FzZSJkb2N1bWVudCI6Y2FzZSJqc29uIjpjYXNlInRleHQiOnRoaXNbaF09ZX19Z2V0IHJlc3BvbnNlKCl7dmFyIGU9dGhpc1toXTtyZXR1cm4iIj09PWV8fCJ0ZXh0Ij09PWU/IiI6bnVsbH1nZXQgcmVzcG9uc2VUZXh0KCl7dmFyIGU9dGhpc1toXTtpZigiIj09PWV8fCJ0ZXh0Ij09PWUpcmV0dXJuIiI7dGhyb3cgbmV3IERPTUV4Y2VwdGlvbigiRmFpbGVkIHRvIHJlYWQgdGhlICdyZXNwb25zZVRleHQnIHByb3BlcnR5IGZyb20gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIHZhbHVlIGlzIG9ubHkgYWNjZXNzaWJsZSBpZiB0aGUgb2JqZWN0J3MgJ3Jlc3BvbnNlVHlwZScgaXMgJycgb3IgJ3RleHQnICh3YXMgJ2FycmF5YnVmZmVyJykuIil9Z2V0IHJlc3BvbnNlWE1MKCl7cmV0dXJuIG51bGx9fU9iamVjdC5kZWZpbmVQcm9wZXJ0eShmLCJVTlNFTlQiLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMCx2YWx1ZTowfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KGYsIk9QRU5FRCIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjF9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoZiwiSEVBREVSU19SRUNFSVZFRCIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjJ9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoZiwiTE9BRElORyIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjN9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoZiwiRE9ORSIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjR9KSxlLlhNTEh0dHBSZXF1ZXN0PXtjb25maWd1cmFibGU6ITAsZW51bWVyYWJsZTohMCx2YWx1ZTpmLHdyaXRhYmxlOiEwfX0pKGEpO2NvbnN0IGI9e307KGU9PnsidXNlIHN0cmljdCI7bGV0IHQ9ITE7Y2xhc3Mgbntjb25zdHJ1Y3Rvcigpe2lmKHQpdGhyb3cgbmV3IFR5cGVFcnJvcigiSWxsZWdhbCBjb25zdHJ1Y3RvciIpfWdldCBsZW5ndGgoKXtyZXR1cm4gT2JqZWN0LmtleXModGhpcykubGVuZ3RofWtleShlKXt2YXIgdD1PYmplY3Qua2V5cyh0aGlzKTtyZXR1cm4gZTwwfHxlPj10Lmxlbmd0aD9udWxsOnRbZV19Z2V0SXRlbShlKXtyZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHRoaXMsZSk/dGhpc1tlXTpudWxsfXNldEl0ZW0oZSx0KXt0aGlzW2VdPVN0cmluZyh0KX1yZW1vdmVJdGVtKGUpe2RlbGV0ZSB0aGlzW2VdfWNsZWFyKCl7Zm9yKGNvbnN0IGUgb2YgT2JqZWN0LmtleXModGhpcykpZGVsZXRlIHRoaXNbZV19fWUuU3RvcmFnZT17Y29uZmlndXJhYmxlOiEwLGVudW1lcmFibGU6ITAsdmFsdWU6bix3cml0YWJsZTohMH07Y29uc3QgaT1uZXcgbjtlLmxvY2FsU3RvcmFnZT17Y29uZmlndXJhYmxlOiEwLGVudW1lcmFibGU6ITAsZ2V0KCl7cmV0dXJuIGl9fTtjb25zdCByPW5ldyBuO2Uuc2Vzc2lvblN0b3JhZ2U9e2NvbmZpZ3VyYWJsZTohMCxlbnVtZXJhYmxlOiEwLGdldCgpe3JldHVybiByfX0sdD0hMH0pKGIpLE1hcmtldGluZy5iaW5kRGVwZW5kZW5jeUltbWVkaWF0ZShmdW5jdGlvbigpe3dpbmRvdy5NYXJrZXRpbmcsTWFya2V0aW5nLmVuc2lnaHRlbk9wdGlvbnM7dHJ5e01hcmtldGluZy5VRE8ucGVyZlRpbWluZ1N0YXJ0KCJydWxlSWQtIit0aGlzLmlkKyItZGVwbG95bWVudElkLSIrdGhpcy5kZXBsb3ltZW50SWQpLCJ0cnVlIj09ZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRQYXJhbWV0ZXJCeU5hbWUoIm1kZWJ1ZyIsbG9jYXRpb24uc2VhcmNoKSYmKGRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0RHBpZD1mdW5jdGlvbigpe3JldHVybihuZXcgRGF0ZSkuZ2V0VGltZSgpfSxNYXJrZXRpbmcuZ0V2ZW50KCJEQy05NjMyNjQ1L3NhbGVzMC9jc2JfdGVzdCt0cmFuc2FjdGlvbnMiLCJwdXJjaGFzZSIpLGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoImlmcmFtZSIpLmZvckVhY2goZnVuY3Rpb24oZSl7ZS5zcmMuaW5jbHVkZXMoInR5cGU9c2FsZXMiKSYmZS5jb250ZW50V2luZG93LnBvc3RNZXNzYWdlKEpTT04uc3RyaW5naWZ5KE1hcmtldGluZyksIioiKX0pKSxNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoInJ1bGVJZC0iK3RoaXMuaWQrIi1kZXBsb3ltZW50SWQtIit0aGlzLmRlcGxveW1lbnRJZCl9Y2F0Y2goZSl7ZGVsbF9tYXJrZXRpbmdfdXRpbC5kZWJ1ZyhlKX19LDM2MDAzMTEsWzM2MTc2ODJdLDYzNjE0MixbNjE5NDA0XSksTWFya2V0aW5nLmJpbmREZXBlbmRlbmN5RE9NUGFyc2VkKGZ1bmN0aW9uKCl7dmFyIG4sZSxpLHQscjt3aW5kb3cuTWFya2V0aW5nLE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zO3RyeXtNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdTdGFydCgicnVsZUlkLSIrdGhpcy5pZCsiLWRlcGxveW1lbnRJZC0iK3RoaXMuZGVwbG95bWVudElkKSxuPXdpbmRvdyxlPWRvY3VtZW50LG5baT0idWV0cSJdPW5baV18fFtdLHQ9ZnVuY3Rpb24oKXt2YXIgZT17fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCJYTUxIdHRwUmVxdWVzdCIpLHQ9e30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywibG9jYWxTdG9yYWdlIik7dHJ5e3JldHVybiBlJiZ7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csIlhNTEh0dHBSZXF1ZXN0IixhLlhNTEh0dHBSZXF1ZXN0KSx0JiZ7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csImxvY2FsU3RvcmFnZSIsYi5sb2NhbFN0b3JhZ2UpLGZ1bmN0aW9uKCl7dmFyIGU9e3RpOiI1MTAyMjYxIn07ZS5xPW5baV0sbltpXT1uZXcgVUVUKGUpLG5baV0ucHVzaCgicGFnZUxvYWQiKX0uYXBwbHkodGhpcyxhcmd1bWVudHMpfWZpbmFsbHl7ZSYme30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCJYTUxIdHRwUmVxdWVzdCIsZSksdCYme30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCJsb2NhbFN0b3JhZ2UiLHQpfX0sKHI9ZS5jcmVhdGVFbGVtZW50KCJzY3JpcHQiKSkuc3JjPSIvL2JhdC5iaW5nLmNvbS9iYXQuanMiLHIuYXN5bmM9MSxyLm9ubG9hZD1yLm9ucmVhZHlzdGF0ZWNoYW5nZT1mdW5jdGlvbigpe3ZhciBlPXRoaXMucmVhZHlTdGF0ZTtlJiYibG9hZGVkIiE9PWUmJiJjb21wbGV0ZSIhPT1lfHwodCgpLHIub25sb2FkPXIub25yZWFkeXN0YXRlY2hhbmdlPW51bGwpfSwoZT1lLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJzY3JpcHQiKVswXSkucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUocixlKSxNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoInJ1bGVJZC0iK3RoaXMuaWQrIi1kZXBsb3ltZW50SWQtIit0aGlzLmRlcGxveW1lbnRJZCl9Y2F0Y2goZSl7ZGVsbF9tYXJrZXRpbmdfdXRpbC5kZWJ1ZyhlKX19LDM2MDUyNDIsWzM2MDYzMjldLDY5NTg3NCxbNjEwMzIzXSksTWFya2V0aW5nLmJpbmREZXBlbmRlbmN5RE9NUGFyc2VkKGZ1bmN0aW9uKCl7dmFyIGU7d2luZG93Lk1hcmtldGluZyxNYXJrZXRpbmcuZW5zaWdodGVuT3B0aW9uczt0cnl7TWFya2V0aW5nLlVETy5wZXJmVGltaW5nU3RhcnQoInJ1bGVJZC0iK3RoaXMuaWQrIi1kZXBsb3ltZW50SWQtIit0aGlzLmRlcGxveW1lbnRJZCksTWFya2V0aW5nLlVETy5wcmlvcmNvbnNlbnQmJigidXMiPT09KGU9TWFya2V0aW5nLnNjRGF0YU9iai5jb3VudHJ5KSYmTWFya2V0aW5nLmluc2VydFNjcmlwdCgiLy92dC5teXZpc3VhbGlxLm5ldC8yL1R4VVFOSFNLdkdXSWlNajFPaDN0ZnclM0QlM0QvdnQtMjg4LmpzIiksImNhIj09PWUmJk1hcmtldGluZy5pbnNlcnRTY3JpcHQoIi8vdnQubXl2aXN1YWxpcS5uZXQvMi9UeFVRTkhTS3ZHV0lpTWoxT2gzdGZ3JTNEJTNEL3Z0LTI4OS5qcyIpLCJiciI9PT1lJiZNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCIvL3Z0Lm15dmlzdWFsaXEubmV0LzIvd1FRdFRpaXpsNFNpeHJoSVR5VHFiZyUzRCUzRC92dC0yODYuanMiKSwidWsiPT09ZSYmTWFya2V0aW5nLmluc2VydFNjcmlwdCgiLy92dC5teXZpc3VhbGlxLm5ldC8yL2FtaTdlV0Q3TWE5cWt1OUhERzIzMnclM0QlM0QvdnQtMjEzLmpzIiksImpwIj09PWUmJk1hcmtldGluZy5pbnNlcnRTY3JpcHQoIi8vdnQubXl2aXN1YWxpcS5uZXQvMi82JTJCeFQlMkJPM3oxemgxNHl1bEpCRE42ZyUzRCUzRC92dC0yODcuanMiKSwiYXUiPT09ZSYmTWFya2V0aW5nLmluc2VydFNjcmlwdCgiLy92dC5teXZpc3VhbGlxLm5ldC8yL2lwZWV5SGh0NG5wUUVpemlDV2FZenclM0QlM0QvdnQtMjk5LmpzIiksIm56Ij09PWUmJk1hcmtldGluZy5pbnNlcnRTY3JpcHQoIi8vdnQubXl2aXN1YWxpcS5uZXQvMi9pcGVleUhodDRucFFFaXppQ1dhWXp3JTNEJTNEL3Z0LTMwMS5qcyIpLCJpbiI9PT1lJiZNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCIvL3Z0Lm15dmlzdWFsaXEubmV0LzIvdUJGJTJCbmRKVDduMHI5V3lzTkkxVnd3JTNEJTNEL3Z0LTI5OC5qcyIpLCJmciI9PT1lJiZNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCIvL3Z0Lm15dmlzdWFsaXEubmV0LzIvR1hPZE4lMkJXdWdZM04zbjRhNUxBa05RJTNEJTNEL3Z0LTMwMC5qcyIpLCJkZSI9PT1lJiZNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCIvL3Z0Lm15dmlzdWFsaXEubmV0LzIvdjlCSk9HY2dsNHdmam43cFhCaHVuQSUzRCUzRC92dC0zMDIuanMiKSksTWFya2V0aW5nLlVETy5wZXJmVGltaW5nRW5kKCJydWxlSWQtIit0aGlzLmlkKyItZGVwbG95bWVudElkLSIrdGhpcy5kZXBsb3ltZW50SWQpfWNhdGNoKGUpe2RlbGxfbWFya2V0aW5nX3V0aWwuZGVidWcoZSl9fSwzNTkzMzY1LFszNTA2OTI0LDM2MDYzMjldLDYyMTkxOSxbNjEwMzEwLDYxMDMyM10pLE1hcmtldGluZy5iaW5kRE9NUGFyc2VkKGZ1bmN0aW9uKCl7d2luZG93Lk1hcmtldGluZyxNYXJrZXRpbmcuZW5zaWdodGVuT3B0aW9uczt0cnl7TWFya2V0aW5nLlVETy5wZXJmVGltaW5nU3RhcnQoInJ1bGVJZC0iK3RoaXMuaWQrIi1kZXBsb3ltZW50SWQtIit0aGlzLmRlcGxveW1lbnRJZCksTWFya2V0aW5nLlVETy5wcmlvcmNvbnNlbnQmJk1hcmtldGluZy5pbWFnZVJlcXVlc3QoImh0dHBzOi8vcHguYWRzLmxpbmtlZGluLmNvbS9jb2xsZWN0Lz9waWQ9NzUxMyZmbXQ9Z2lmIiksTWFya2V0aW5nLlVETy5wZXJmVGltaW5nRW5kKCJydWxlSWQtIit0aGlzLmlkKyItZGVwbG95bWVudElkLSIrdGhpcy5kZXBsb3ltZW50SWQpfWNhdGNoKGUpe2RlbGxfbWFya2V0aW5nX3V0aWwuZGVidWcoZSl9fSwzNTkzMjg3LDYxOTA4OSksTWFya2V0aW5nLmJpbmREZXBlbmRlbmN5SW1tZWRpYXRlKGZ1bmN0aW9uKCl7dmFyIGkscixlO3dpbmRvdy5NYXJrZXRpbmcsTWFya2V0aW5nLmVuc2lnaHRlbk9wdGlvbnM7TWFya2V0aW5nLlVETy5mbF9sb2FkZWQ9ITEsTWFya2V0aW5nLlVETy5wcmlvcmNvbnNlbnQmJihNYXJrZXRpbmcubG9hZFNjcmlwdENhbGxiYWNrKCJodHRwczovL3d3dy5nb29nbGV0YWdtYW5hZ2VyLmNvbS9ndGFnL2pzP2lkPURDLTk2MzI2NDUiLGZ1bmN0aW9uKCl7ZGVsbF9tYXJrZXRpbmdfdXRpbC5jdXN0b21fbWFya2V0aW5nX2V2ZW50KCJmbF9sb2FkZWQiKSxNYXJrZXRpbmcuVURPLmZsX2xvYWRlZD0hMH0pLHdpbmRvdy5kYXRhTGF5ZXI9d2luZG93LmRhdGFMYXllcnx8W10sd2luZG93Lmd0YWc9ZnVuY3Rpb24oKXtkYXRhTGF5ZXIucHVzaChhcmd1bWVudHMpfSxndGFnKCJqcyIsbmV3IERhdGUpLGd0YWcoImNvbmZpZyIsIkRDLTk2MzI2NDUiKSxndGFnKCJjb25maWciLCJEQy05NjMyOTIxIiksZ3RhZygiY29uZmlnIiwiREMtOTYzMjY0OCIpLGk9ZnVuY3Rpb24oKXtyZXR1cm57YWxsb3dfY3VzdG9tX3NjcmlwdHM6ITAsdTE6TWFya2V0aW5nLlVETy5sYW5ndWFnZSx1MTA6TWFya2V0aW5nLlVETy5jc2VnLHUxMTpNYXJrZXRpbmcuVURPLmRlYWxzLHUxMjpNYXJrZXRpbmcuVURPLmRldmljZSx1MTM6TWFya2V0aW5nLlVETy5kaXNjb3VudCx1MTQ6TWFya2V0aW5nLlVETy5mYW1pbHksdTE1Ok1hcmtldGluZy5VRE8ub2dpZCx1MTY6TWFya2V0aW5nLlVETy5vcmRlcmNvZGUsdTE3Ok1hcmtldGluZy5VRE8ucGxhdGZvcm0sdTE4Ok1hcmtldGluZy5VRE8ucHJvZGNhdCx1MTk6TWFya2V0aW5nLlVETy5wcm9kdWN0LHUyOk1hcmtldGluZy5VRE8uc2VnbWVudCx1MjA6TWFya2V0aW5nLlVETy5wcm9tb2lkLHUyMTpNYXJrZXRpbmcuVURPLnR5cGUsdTIyOmRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0UGFyYW1ldGVyQnlOYW1lKCJkZ2MiLGxvY2F0aW9uLnRvU3RyaW5nKCkudG9Mb3dlckNhc2UoKSksdTIzOk1hcmtldGluZy5VRE8uZ2FjZCx1MjQ6ZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRQYXJhbWV0ZXJCeU5hbWUoImxpZCIsbG9jYXRpb24udG9TdHJpbmcoKS50b0xvd2VyQ2FzZSgpKSx1MjU6TWFya2V0aW5nLlVETy52ZW4xLHUyNjpNYXJrZXRpbmcuVURPLnZlbjIsdTI4OmRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0UGFyYW1ldGVyQnlOYW1lKCJ0ZmNpZCIsbG9jYXRpb24udG9TdHJpbmcoKS50b0xvd2VyQ2FzZSgpKSx1Mjk6TWFya2V0aW5nLlVETy5yZXZlbnVlLHUzOk1hcmtldGluZy5VRE8uY3VycmVuY3ksdTMwOk1hcmtldGluZy5VRE8udXNkcmV2LHUzNTpNYXJrZXRpbmcuVURPLmRwaWQsdTM2Ok1hcmtldGluZy5VRE8ubGFuZCx1Mzc6TWFya2V0aW5nLlVETy5zZXJpYWxwcm9kbGlzdCx1Mzg6TWFya2V0aW5nLlVETy5jamV2ZW50LHU0Ok1hcmtldGluZy5VRE8uY291bnRyeSx1NTpNYXJrZXRpbmcuVURPLmFjY291bnRpZCx1NjpNYXJrZXRpbmcuVURPLmNhdGVnb3J5LHU3Ok1hcmtldGluZy5VRE8uY2F0ZWdvcnlwYXRoLHU4Ok1hcmtldGluZy5VRE8uY2lkLHU5Ok1hcmtldGluZy5VRE8uY291cG9ufX0sTWFya2V0aW5nLlVETy5yZWFkRGF0YSgpLChyPWkoKSkudTMxPSIiLChlPWRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0Q29va2llKCJBTUNWXzRERDgwODYxNTE1Q0FCOTkwQTQ5MEQ0NSU0MEFkb2JlT3JnIikpJiYoci51MzE9ZS5zcGxpdCgiTUNNSUR8IilbMV0uc3BsaXQoInwiKVswXSksTWFya2V0aW5nLmdFdmVudD1NYXJrZXRpbmcuZ0V2ZW50fHxmdW5jdGlvbih0LG4pe3ZhciBlO3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJmbF9sb2FkZWQiLGZ1bmN0aW9uKCl7dmFyIGU9cjsicHVyY2hhc2UiPT09biYmKGUudmFsdWU9TWFya2V0aW5nLlVETy51c2RyZXZ8fE1hcmtldGluZy5VRE8ucmV2ZW51ZSxlLnRyYW5zYWN0aW9uX2lkPWRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0RHBpZCgpKSxlLnNlbmRfdG89dCxndGFnKCJldmVudCIsbixlKX0pLE1hcmtldGluZy5VRE8uZmxfbG9hZGVkJiYoZT1yPWkoKSwicHVyY2hhc2UiPT09biYmKGUudmFsdWU9TWFya2V0aW5nLlVETy51c2RyZXZ8fE1hcmtldGluZy5VRE8ucmV2ZW51ZSxlLnRyYW5zYWN0aW9uX2lkPWRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0RHBpZCgpKSxlLnNlbmRfdG89dCxndGFnKCJldmVudCIsbixlKSl9KX0sMzYxNzY4MixbMzYwNjMyOV0sNjE5NDA0LFs2MTAzMjNdKSxNYXJrZXRpbmcuYmluZERlcGVuZGVuY3lJbW1lZGlhdGUoZnVuY3Rpb24oKXt3aW5kb3cuTWFya2V0aW5nLE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zO01hcmtldGluZy5VRE8uZ19kb3dubG9hZD1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpe01hcmtldGluZy5VRE8uaHZlb3ZlcmxheT0hMSwiZG93bmxvYWQiPT09ZS5kZXRhaWwudHlwZSYmTWFya2V0aW5nLmdFdmVudCh0LG4pfSksTWFya2V0aW5nLlVETy5odmVvdmVybGF5JiZNYXJrZXRpbmcuZ0V2ZW50KHQsbil9LE1hcmtldGluZy5VRE8uZ19zaGFyZT1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpeyJzaGFyZSI9PT1lLmRldGFpbC50eXBlJiZNYXJrZXRpbmcuZ0V2ZW50KHQsbil9KX0sTWFya2V0aW5nLlVETy5nX21wdj1mdW5jdGlvbihlLHQpezM9PXNlc3Npb25TdG9yYWdlLmVuc3BhZ2Vjb3VudEZMVCYmTWFya2V0aW5nLmdFdmVudChlLHQpfSxNYXJrZXRpbmcuVURPLmdfYmNfc3RhcnQ9ZnVuY3Rpb24obixpKXtpZigidW5kZWZpbmVkIiE9dHlwZW9mIHZpZGVvanMmJnZpZGVvanMucGxheWVycylmb3IodmFyIGUgaW4gdmlkZW9qcy5wbGF5ZXJzKXZpZGVvanMucGxheWVyc1tlXS5yZWFkeShmdW5jdGlvbigpe3ZhciBlPXRoaXM7ZS5lbF8uaGFzQXR0cmlidXRlKCJtdXRlZCIpfHxlLm9uKCJzdGFydCIsZnVuY3Rpb24oKXtlLnZpZGVvX3N0YXJ0fHwoZS52aWRlb181MF9wZXJjZW50PSExLGUudmlkZW9fODBfcGVyY2VudD0hMSxNYXJrZXRpbmcuZ0V2ZW50KG4saSkpfSl9KTtlbHNlIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uIGUodCl7ImJyaWdodGNvdmUiPT09dC5kZXRhaWwudHlwZSYmKE1hcmtldGluZy5VRE8uZ19iY19zdGFydChuLGkpLHdpbmRvdy5yZW1vdmVFdmVudExpc3RlbmVyKCJodmUiLGUpKX0pfSxNYXJrZXRpbmcuVURPLmdfYmNfNTA9ZnVuY3Rpb24odCxuKXt3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigiYnJpZ2h0Y292ZTUwIixmdW5jdGlvbihlKXtNYXJrZXRpbmcuZ0V2ZW50KHQsbil9KX0sTWFya2V0aW5nLlVETy5nX2JjXzgwPWZ1bmN0aW9uKHQsbil7d2luZG93LmFkZEV2ZW50TGlzdGVuZXIoImJyaWdodGNvdmU4MCIsZnVuY3Rpb24oZSl7TWFya2V0aW5nLmdFdmVudCh0LG4pfSl9LE1hcmtldGluZy5VRE8uZ19iY19lbmQ9ZnVuY3Rpb24obixpKXtpZigidW5kZWZpbmVkIiE9dHlwZW9mIHZpZGVvanMmJnZpZGVvanMucGxheWVycylmb3IodmFyIGUgaW4gdmlkZW9qcy5wbGF5ZXJzKXZpZGVvanMucGxheWVyc1tlXS5yZWFkeShmdW5jdGlvbigpe3ZhciBlPXRoaXM7ZS5lbF8uaGFzQXR0cmlidXRlKCJtdXRlZCIpfHxlLm9uKCJlbmRlZCIsZnVuY3Rpb24oKXtNYXJrZXRpbmcuZ0V2ZW50KG4saSksZS52aWRlb19zdGFydD0hMX0pfSk7ZWxzZSB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigiaHZlIixmdW5jdGlvbiBlKHQpeyJicmlnaHRjb3ZlIj09PXQuZGV0YWlsLnR5cGUmJihNYXJrZXRpbmcuVURPLmdfYmNfZW5kKG4saSksd2luZG93LnJlbW92ZUV2ZW50TGlzdGVuZXIoImh2ZSIsZSkpfSl9LE1hcmtldGluZy5VRE8uZ19jb250YWN0dXM9ZnVuY3Rpb24odCxuKXt3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigiaHZlIixmdW5jdGlvbihlKXsiY29udGFjdHVzIj09PWUuZGV0YWlsLnR5cGUmJk1hcmtldGluZy5nRXZlbnQodCxuKX0pfSxNYXJrZXRpbmcuVURPLmdfY2hhdD1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpeyJjaGF0Ij09PWUuZGV0YWlsLnR5cGUmJk1hcmtldGluZy5nRXZlbnQodCxuKX0pfSxNYXJrZXRpbmcuVURPLmdfYWRkdG9jYXJ0PWZ1bmN0aW9uKGUsdCl7ImNvbnRlbnRzIiE9PWRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0c2NNYXAoIndhY29udHJvbGxlciIpJiYiY2FydCIhPT1kZWxsX21hcmtldGluZ191dGlsLmdldHNjTWFwKCJ3b3JrZmxvd3N0ZXAiKXx8TWFya2V0aW5nLmdFdmVudChlLHQpfSxNYXJrZXRpbmcuVURPLmdfY2hlY2tvdXQ9ZnVuY3Rpb24oZSx0KXsiY29uZmlybWF0aW9uIj09PWRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0c2NNYXAoIndhY29udHJvbGxlciIpJiZNYXJrZXRpbmcuZ0V2ZW50KGUsdCl9LE1hcmtldGluZy5VRE8uZ19wb2RjYXN0X2xpc3Rlbj1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpeyJwb2RjYXN0X2xpc3RlbiI9PT1lLmRldGFpbC50eXBlJiZNYXJrZXRpbmcuZ0V2ZW50KHQsbil9KX0sTWFya2V0aW5nLlVETy5nX3BvZGNhc3Rfc3Vic2NyaWJlPWZ1bmN0aW9uKHQsbil7d2luZG93LmFkZEV2ZW50TGlzdGVuZXIoImh2ZSIsZnVuY3Rpb24oZSl7InBvZGNhc3Rfc3Vic2NyaWJlIj09PWUuZGV0YWlsLnR5cGUmJk1hcmtldGluZy5nRXZlbnQodCxuKX0pfSxNYXJrZXRpbmcuVURPLmdfcmZxX3N1Ym1pdD1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpeyJyZnFfc3VibWl0Ij09PWUuZGV0YWlsLnR5cGUmJk1hcmtldGluZy5nRXZlbnQodCxuKX0pfSxNYXJrZXRpbmcuVURPLmdfaW9uX3N1Ym1pdD1mdW5jdGlvbihlLHQpey9saXZlYmFsbC4qY29tcGxldGVkL2dpLnRlc3QoZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRzY01hcCgicGFnZW5hbWUiKSkmJk1hcmtldGluZy5nRXZlbnQoZSx0KX0sTWFya2V0aW5nLlVETy5nX2dhdGVkX3N1Ym1pdD1mdW5jdGlvbih0LG4pe3dpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJodmUiLGZ1bmN0aW9uKGUpeyJnYXRlZF9zdWJtaXQiPT09ZS5kZXRhaWwudHlwZSYmTWFya2V0aW5nLmdFdmVudCh0LG4pfSl9fSwzNDc1MTkzLFszNjE3NjgyXSw2MjA4MTgsWzYxOTQwNF0pfQo="},{"name":"async-sugarcoat-8a459c41783885dc83d30f5b7da2359091f4e607","aliases":[],"kind":{"mime":"application/javascript"},"content":"e2NvbnN0IGE9e307KHQ9PnsidXNlIHN0cmljdCI7Y29uc3QgZT1TeW1ib2woImRlZmVycmVkSGFuZGxlIiksbj1TeW1ib2woIm9ubG9hZHN0YXJ0Iikscj1TeW1ib2woIm9ucHJvZ3Jlc3MiKSxhPVN5bWJvbCgib25hYm9ydCIpLG89U3ltYm9sKCJvbmVycm9yIiksaT1TeW1ib2woIm9ubG9hZCIpLHM9U3ltYm9sKCJvbnRpbWVvdXQiKSxjPVN5bWJvbCgib25sb2FkZW5kIiksdT1TeW1ib2woIm9ucmVhZHlzdGF0ZWNoYW5nZSIpLGw9U3ltYm9sKCJyZWFkeVN0YXRlIiksZz1TeW1ib2woInRpbWVvdXQiKSxoPVN5bWJvbCgid2l0aENyZWRlbnRpYWxzIiksZj1TeW1ib2woInVwbG9hZCIpLGQ9U3ltYm9sKCJyZXNwb25zZVR5cGUiKSxwPSh0LG4pPT57dmFyIGU9bi5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7T2JqZWN0LmRlZmluZVByb3BlcnR5KHQsbix7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6bnVsbCx3cml0YWJsZTohMH0pLHQuYWRkRXZlbnRMaXN0ZW5lcihlLGZ1bmN0aW9uKHQpe2NvbnN0IGU9dGhpc1tuXTtlJiZlLmNhbGwodGhpcyx0KX0pfSx2PSh0LGUpPT57dFtsXT1lLHQuZGlzcGF0Y2hFdmVudChuZXcgRXZlbnQoInJlYWR5c3RhdGVjaGFuZ2UiKSl9O2xldCBtPSEwO2NsYXNzIGIgZXh0ZW5kcyBFdmVudFRhcmdldHtjb25zdHJ1Y3Rvcigpe2lmKHN1cGVyKCksISh0aGlzIGluc3RhbmNlb2YgeXx8dGhpcyBpbnN0YW5jZW9mIHcpKXRocm93IG5ldyBUeXBlRXJyb3IoIklsbGVnYWwgY29uc3RydWN0b3IiKTtwKHRoaXMsbikscCh0aGlzLHIpLHAodGhpcyxhKSxwKHRoaXMsbykscCh0aGlzLGkpLHAodGhpcyxzKSxwKHRoaXMsYyl9Z2V0IG9ubG9hZHN0YXJ0KCl7cmV0dXJuIHRoaXNbbl19c2V0IG9ubG9hZHN0YXJ0KHQpe3RoaXNbbl09dH1nZXQgb25wcm9ncmVzcygpe3JldHVybiB0aGlzW3JdfXNldCBvbnByb2dyZXNzKHQpe3RoaXNbcl09dH1nZXQgb25hYm9ydCgpe3JldHVybiB0aGlzW2FdfXNldCBvbmFib3J0KHQpe3RoaXNbYV09dH1nZXQgb25lcnJvcigpe3JldHVybiB0aGlzW29dfXNldCBvbmVycm9yKHQpe3RoaXNbb109dH1nZXQgb250aW1lb3V0KCl7cmV0dXJuIHRoaXNbc119c2V0IG9udGltZW91dCh0KXt0aGlzW3NdPXR9Z2V0IG9ubG9hZGVuZCgpe3JldHVybiB0aGlzW2NdfXNldCBvbmxvYWRlbmQodCl7dGhpc1tjXT10fX10LlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQ9e2NvbmZpZ3VyYWJsZTohMCxlbnVtZXJhYmxlOiEwLHZhbHVlOmIsd3JpdGFibGU6ITB9O2NsYXNzIHcgZXh0ZW5kcyBie2NvbnN0cnVjdG9yKCl7aWYobSl0aHJvdyBuZXcgVHlwZUVycm9yKCJJbGxlZ2FsIGNvbnN0cnVjdG9yIik7c3VwZXIoKX19dC5YTUxIdHRwUmVxdWVzdFVwbG9hZD17Y29uZmlndXJhYmxlOiEwLGVudW1lcmFibGU6ITAsdmFsdWU6dyx3cml0YWJsZTohMH07Y2xhc3MgeSBleHRlbmRzIGJ7Y29uc3RydWN0b3IoKXtzdXBlcigpLG09ITE7dmFyIHQ9bmV3IHc7bT0hMCxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyxlLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTpudWxsLHdyaXRhYmxlOiEwfSkscCh0aGlzLHUpLE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLGwse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiExLHZhbHVlOjAsd3JpdGFibGU6ITB9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyxnLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTowLHdyaXRhYmxlOiEwfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsaCx7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6ITEsd3JpdGFibGU6ITB9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcyxmLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMSx2YWx1ZTp0LHdyaXRhYmxlOiExfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsZCx7Y29uZmlndXJhYmxlOiExLGVudW1lcmFibGU6ITEsdmFsdWU6IiIsd3JpdGFibGU6ITB9KX1nZXQgb25yZWFkeXN0YXRlY2hhbmdlKCl7cmV0dXJuIHRoaXNbdV19c2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh0KXt0aGlzW3VdPXR9Z2V0IHJlYWR5U3RhdGUoKXtyZXR1cm4gdGhpc1tsXX1vcGVuKHQsZSl7c3dpdGNoKHRoaXNbbF0pe2Nhc2UgMDpjYXNlIDQ6dih0aGlzLDEpfX1zZXRSZXF1ZXN0SGVhZGVyKHQsZSl7fXNldFRydXN0VG9rZW4odCl7fWdldCB0aW1lb3V0KCl7cmV0dXJuIHRoaXNbZ119c2V0IHRpbWVvdXQodCl7dGhpc1tnXT10fWdldCB3aXRoQ3JlZGVudGlhbHMoKXtyZXR1cm4gdGhpc1toXX1zZXQgd2l0aENyZWRlbnRpYWxzKHQpe3N3aXRjaCh0aGlzW2xdKXtjYXNlIDA6Y2FzZSAxOmJyZWFrO2RlZmF1bHQ6dGhyb3cgbmV3IERPTUV4Y2VwdGlvbigiRmFpbGVkIHRvIHNldCB0aGUgJ3dpdGhDcmVkZW50aWFscycgcHJvcGVydHkgb24gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIHZhbHVlIG1heSBvbmx5IGJlIHNldCBpZiB0aGUgb2JqZWN0J3Mgc3RhdGUgaXMgVU5TRU5UIG9yIE9QRU5FRC4iKX10aGlzW2hdPSEhdH1nZXQgdXBsb2FkKCl7cmV0dXJuIHRoaXNbZl19c2VuZCgpe2lmKDEhPT10aGlzW2xdfHxudWxsIT09dGhpc1tlXSl0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCJGYWlsZWQgdG8gZXhlY3V0ZSAnc2VuZCcgb24gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIG9iamVjdCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELiIpO3RoaXNbZV09c2V0VGltZW91dCgoKT0+e3RoaXNbZV09bnVsbCx2KHRoaXMsNCksdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCJlcnJvciIpKSx0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoImxvYWRlbmQiKSl9LDApfWFib3J0KCl7MT09PXRoaXNbbF0mJm51bGwhPT10aGlzW2VdJiYoY2xlYXJUaW1lb3V0KHRoaXNbZV0pLHRoaXNbZV09bnVsbCx2KHRoaXMsMCksdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCJhYm9ydCIpKSx0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoImxvYWRlbmQiKSkpfWdldCByZXNwb25zZVVSTCgpe3JldHVybiIifWdldCBzdGF0dXMoKXtyZXR1cm4gMH1nZXQgc3RhdHVzVGV4dCgpe3JldHVybiIifWdldFJlc3BvbnNlSGVhZGVyKHQpe3JldHVybiBudWxsfW92ZXJyaWRlTWltZVR5cGUodCl7fWdldCByZXNwb25zZVR5cGUoKXtyZXR1cm4gdGhpc1tkXX1zZXQgcmVzcG9uc2VUeXBlKHQpe2lmKDQ9PT10aGlzW2xdKXRocm93IG5ldyBET01FeGNlcHRpb24oIkZhaWxlZCB0byBzZXQgdGhlICdyZXNwb25zZVR5cGUnIHByb3BlcnR5IG9uICdYTUxIdHRwUmVxdWVzdCc6IFRoZSByZXNwb25zZSB0eXBlIGNhbm5vdCBiZSBzZXQgaWYgdGhlIG9iamVjdCdzIHN0YXRlIGlzIExPQURJTkcgb3IgRE9ORS4iKTtzd2l0Y2godCl7Y2FzZSIiOmNhc2UiYXJyYXlidWZmZXIiOmNhc2UiYmxvYiI6Y2FzZSJkb2N1bWVudCI6Y2FzZSJqc29uIjpjYXNlInRleHQiOnRoaXNbZF09dH19Z2V0IHJlc3BvbnNlKCl7dmFyIHQ9dGhpc1tkXTtyZXR1cm4iIj09PXR8fCJ0ZXh0Ij09PXQ/IiI6bnVsbH1nZXQgcmVzcG9uc2VUZXh0KCl7dmFyIHQ9dGhpc1tkXTtpZigiIj09PXR8fCJ0ZXh0Ij09PXQpcmV0dXJuIiI7dGhyb3cgbmV3IERPTUV4Y2VwdGlvbigiRmFpbGVkIHRvIHJlYWQgdGhlICdyZXNwb25zZVRleHQnIHByb3BlcnR5IGZyb20gJ1hNTEh0dHBSZXF1ZXN0JzogVGhlIHZhbHVlIGlzIG9ubHkgYWNjZXNzaWJsZSBpZiB0aGUgb2JqZWN0J3MgJ3Jlc3BvbnNlVHlwZScgaXMgJycgb3IgJ3RleHQnICh3YXMgJ2FycmF5YnVmZmVyJykuIil9Z2V0IHJlc3BvbnNlWE1MKCl7cmV0dXJuIG51bGx9fU9iamVjdC5kZWZpbmVQcm9wZXJ0eSh5LCJVTlNFTlQiLHtjb25maWd1cmFibGU6ITEsZW51bWVyYWJsZTohMCx2YWx1ZTowfSksT2JqZWN0LmRlZmluZVByb3BlcnR5KHksIk9QRU5FRCIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjF9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoeSwiSEVBREVSU19SRUNFSVZFRCIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjJ9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoeSwiTE9BRElORyIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjN9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoeSwiRE9ORSIse2NvbmZpZ3VyYWJsZTohMSxlbnVtZXJhYmxlOiEwLHZhbHVlOjR9KSx0LlhNTEh0dHBSZXF1ZXN0PXtjb25maWd1cmFibGU6ITAsZW51bWVyYWJsZTohMCx2YWx1ZTp5LHdyaXRhYmxlOiEwfX0pKGEpLGZ1bmN0aW9uKCl7ZnVuY3Rpb24gdCh0LGUpe3Q9dC5zcGxpdCgiLiIpO3ZhciBuLHI9YTt0WzBdaW4gcnx8dm9pZCAwPT09ci5leGVjU2NyaXB0fHxyLmV4ZWNTY3JpcHQoInZhciAiK3RbMF0pO2Zvcig7dC5sZW5ndGgmJihuPXQuc2hpZnQoKSk7KXQubGVuZ3RofHx2b2lkIDA9PT1lP3I9cltuXSYmcltuXSE9PU9iamVjdC5wcm90b3R5cGVbbl0/cltuXTpyW25dPXt9OnJbbl09ZX1mdW5jdGlvbiBzKHQpe2Zvcih2YXIgZSBpbiB0KWlmKHQuaGFzT3duUHJvcGVydHkoZSkpcmV0dXJuIDF9ZnVuY3Rpb24gbyh0LGUpe3AuYWRkRXZlbnRMaXN0ZW5lcj9wLmFkZEV2ZW50TGlzdGVuZXIodCxlLCExKTpwLmF0dGFjaEV2ZW50JiZwLmF0dGFjaEV2ZW50KCJvbiIrdCxlKX1mdW5jdGlvbiBpKHQsZSxuKXt0PXQuc3BsaXQoIiYiKTtmb3IodmFyIHI9MDtyPHQubGVuZ3RoO3IrKyl7dmFyIGE9dFtyXS5zcGxpdCgiPSIpO2lmKGRlY29kZVVSSUNvbXBvbmVudChhWzBdKS5yZXBsYWNlKC9cKy9nLCIgIik9PT1lKXJldHVybiBlPWEuc2xpY2UoMSkuam9pbigiPSIpLG4/ZTpkZWNvZGVVUklDb21wb25lbnQoZSkucmVwbGFjZSgvXCsvZywiICIpfX12YXIgdSxsLGMsYT10aGlzfHxzZWxmLGc9ZnVuY3Rpb24odCxlKXtmb3IodmFyIG4gaW4gZSllLmhhc093blByb3BlcnR5KG4pJiYodFtuXT1lW25dKX0saD0vXig/Oig/Omh0dHBzP3xtYWlsdG98ZnRwKTp8W146Lz8jXSooPzpbLz8jXXwkKSkvaSxmPXdpbmRvdyxkPXdpbmRvdy5oaXN0b3J5LHA9ZG9jdW1lbnQsdj1uYXZpZ2F0b3IsZT17fSxtPWZ1bmN0aW9uKCl7ZS5UQUdHSU5HPWUuVEFHR0lOR3x8W10sZS5UQUdHSU5HWzFdPSEwfSxiPS86WzAtOV0rJC8sdz1mdW5jdGlvbih0LGUpe3JldHVybiJwcm90b2NvbCIhPT0oZT1lJiZTdHJpbmcoZSkudG9Mb3dlckNhc2UoKSkmJiJwb3J0IiE9PWV8fCh0LnByb3RvY29sPV8odC5wcm90b2NvbCl8fF8oZi5sb2NhdGlvbi5wcm90b2NvbCkpLCJwb3J0Ij09PWU/dC5wb3J0PVN0cmluZyhOdW1iZXIoKHQuaG9zdG5hbWU/dDpmLmxvY2F0aW9uKS5wb3J0KXx8KCJodHRwIj09dC5wcm90b2NvbD84MDoiaHR0cHMiPT10LnByb3RvY29sPzQ0MzoiIikpOiJob3N0Ij09PWUmJih0Lmhvc3RuYW1lPSh0Lmhvc3RuYW1lfHxmLmxvY2F0aW9uLmhvc3RuYW1lKS5yZXBsYWNlKGIsIiIpLnRvTG93ZXJDYXNlKCkpLHkodCxlLHZvaWQgMCx2b2lkIDAsdm9pZCAwKX0seT1mdW5jdGlvbih0LGUsbixyLGEpe3ZhciBvPV8odC5wcm90b2NvbCk7c3dpdGNoKGU9ZSYmU3RyaW5nKGUpLnRvTG93ZXJDYXNlKCkpe2Nhc2UidXJsX25vX2ZyYWdtZW50IjpyPSIiLHQ9cj10JiZ0LmhyZWY/KHI9dC5ocmVmLmluZGV4T2YoIiMiKSk8MD90LmhyZWY6dC5ocmVmLnN1YnN0cigwLHIpOnI7YnJlYWs7Y2FzZSJwcm90b2NvbCI6dD1vO2JyZWFrO2Nhc2UiaG9zdCI6dD10Lmhvc3RuYW1lLnJlcGxhY2UoYiwiIikudG9Mb3dlckNhc2UoKSxuJiYocj0vXnd3d1xkKlwuLy5leGVjKHQpKSYmclswXSYmKHQ9dC5zdWJzdHIoclswXS5sZW5ndGgpKTticmVhaztjYXNlInBvcnQiOnQ9U3RyaW5nKE51bWJlcih0LnBvcnQpfHwoImh0dHAiPT1vPzgwOiJodHRwcyI9PW8/NDQzOiIiKSk7YnJlYWs7Y2FzZSJwYXRoIjp0LnBhdGhuYW1lfHx0Lmhvc3RuYW1lfHxtKCksdD0odD0iLyI9PXQucGF0aG5hbWUuc3Vic3RyKDAsMSk/dC5wYXRobmFtZToiLyIrdC5wYXRobmFtZSkuc3BsaXQoIi8iKSwwPD0ocnx8W10pLmluZGV4T2YodFt0Lmxlbmd0aC0xXSkmJih0W3QubGVuZ3RoLTFdPSIiKSx0PXQuam9pbigiLyIpO2JyZWFrO2Nhc2UicXVlcnkiOnQ9dC5zZWFyY2gucmVwbGFjZSgiPyIsIiIpLGEmJih0PWkodCxhLHZvaWQgMCkpO2JyZWFrO2Nhc2UiZXh0ZW5zaW9uIjp0PSh0PTE8KHQ9dC5wYXRobmFtZS5zcGxpdCgiLiIpKS5sZW5ndGg/dFt0Lmxlbmd0aC0xXToiIikuc3BsaXQoIi8iKVswXTticmVhaztjYXNlImZyYWdtZW50Ijp0PXQuaGFzaC5yZXBsYWNlKCIjIiwiIik7YnJlYWs7ZGVmYXVsdDp0PXQmJnQuaHJlZn1yZXR1cm4gdH0sXz1mdW5jdGlvbih0KXtyZXR1cm4gdD90LnJlcGxhY2UoIjoiLCIiKS50b0xvd2VyQ2FzZSgpOiIifSxPPWZ1bmN0aW9uKHQpe3ZhciBlPXAuY3JlYXRlRWxlbWVudCgiYSIpO3QmJihlLmhyZWY9dCk7dmFyIG49ZS5wYXRobmFtZTtyZXR1cm4iLyIhPT1uWzBdJiYodHx8bSgpLG49Ii8iK24pLHQ9ZS5ob3N0bmFtZS5yZXBsYWNlKGIsIiIpLHtocmVmOmUuaHJlZixwcm90b2NvbDplLnByb3RvY29sLGhvc3Q6ZS5ob3N0LGhvc3RuYW1lOnQscGF0aG5hbWU6bixzZWFyY2g6ZS5zZWFyY2gsaGFzaDplLmhhc2gscG9ydDplLnBvcnR9fTtmdW5jdGlvbiBFKCl7Zm9yKHZhciB0PXUsZT17fSxuPTA7bjx0Lmxlbmd0aDsrK24pZVt0W25dXT1uO3JldHVybiBlfWZ1bmN0aW9uIFQoKXt2YXIgdD0iQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoiO3JldHVybih0Kz0iQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoiLnRvTG93ZXJDYXNlKCkrIjAxMjM0NTY3ODktXyIpKyIuIn1mdW5jdGlvbiB4KHQpe3U9dXx8VCgpLGw9bHx8RSgpO2Zvcih2YXIgZT1bXSxuPTA7bjx0Lmxlbmd0aDtuKz0zKXt2YXIgcj1uKzE8dC5sZW5ndGgsYT1uKzI8dC5sZW5ndGgsbz10LmNoYXJDb2RlQXQobiksaT1yP3QuY2hhckNvZGVBdChuKzEpOjAscz1hP3QuY2hhckNvZGVBdChuKzIpOjAsYz1vPj4yLG89KDMmbyk8PDR8aT4+NCxpPSgxNSZpKTw8MnxzPj42O3MmPTYzLGF8fChzPTY0LHJ8fChpPTY0KSksZS5wdXNoKHVbY10sdVtvXSx1W2ldLHVbc10pfXJldHVybiBlLmpvaW4oIiIpfWZ1bmN0aW9uIGsoKXtmdW5jdGlvbiB0KHQpe24odC50YXJnZXR8fHQuc3JjRWxlbWVudHx8e30pfXZhciBlLG49RixyPVgsYT1OKCk7YS5pbml0fHwobygibW91c2Vkb3duIix0KSxvKCJrZXl1cCIsdCksbygic3VibWl0IixmdW5jdGlvbih0KXtyKHQudGFyZ2V0fHx0LnNyY0VsZW1lbnR8fHt9KX0pLGU9SFRNTEZvcm1FbGVtZW50LnByb3RvdHlwZS5zdWJtaXQsSFRNTEZvcm1FbGVtZW50LnByb3RvdHlwZS5zdWJtaXQ9ZnVuY3Rpb24oKXtyKHRoaXMpLGUuY2FsbCh0aGlzKX0sYS5pbml0PSEwKX1mdW5jdGlvbiBTKHQsZSxuLHIsYSl7dD17Y2FsbGJhY2s6dCxkb21haW5zOmUsZnJhZ21lbnQ6Mj09PW4scGxhY2VtZW50Om4sZm9ybXM6cixzYW1lSG9zdDphfSxOKCkuZGVjb3JhdG9ycy5wdXNoKHQpfWZ1bmN0aW9uIEModCxlLG4pe2Zvcih2YXIgcj1OKCkuZGVjb3JhdG9ycyxhPXt9LG89MDtvPHIubGVuZ3RoOysrbyl7dmFyIGk9cltvXTtpZihzPSFufHxpLmZvcm1zKXQ6e3ZhciBzPWkuZG9tYWlucyxjPXQsdT0hIWkuc2FtZUhvc3Q7aWYocyYmKHV8fGMhPT1wLmxvY2F0aW9uLmhvc3RuYW1lKSlmb3IodmFyIGw9MDtsPHMubGVuZ3RoO2wrKylpZihzW2xdaW5zdGFuY2VvZiBSZWdFeHApe2lmKHNbbF0udGVzdChjKSl7cz0hMDticmVhayB0fX1lbHNlIGlmKDA8PWMuaW5kZXhPZihzW2xdKXx8dSYmMDw9c1tsXS5pbmRleE9mKGMpKXtzPSEwO2JyZWFrIHR9cz0hMX1zJiYoKHM9bnVsbD09KHM9aS5wbGFjZW1lbnQpP2kuZnJhZ21lbnQ/MjoxOnMpPT09ZSYmZyhhLGkuY2FsbGJhY2soKSkpfXJldHVybiBhfXZhciBqPXZvaWQgMDtmdW5jdGlvbiBOKCl7dmFyIHQ9e30sZT1mLmdvb2dsZV90YWdfZGF0YTtyZXR1cm4gZi5nb29nbGVfdGFnX2RhdGE9dm9pZCAwPT09ZT90OmUsKGU9KHQ9Zi5nb29nbGVfdGFnX2RhdGEpLmdsKSYmZS5kZWNvcmF0b3JzfHwodC5nbD1lPXtkZWNvcmF0b3JzOltdfSksZX12YXIgUj0vKC4qPylcKiguKj8pXCooLiopLyxBPS8oW14/I10rKShcP1teI10qKT8oIy4qKT8vO2Z1bmN0aW9uIEwodCl7cmV0dXJuIG5ldyBSZWdFeHAoIiguKj8pKF58JikiK3QrIj0oW14mXSopJj8oLiopIil9ZnVuY3Rpb24gSSh0LGUpe3ZhciBuLHIsYT1bXTtmb3IobiBpbiB0KSF0Lmhhc093blByb3BlcnR5KG4pfHx2b2lkIDAhPT0ocj10W25dKSYmcj09ciYmbnVsbCE9PXImJiJbb2JqZWN0IE9iamVjdF0iIT09ci50b1N0cmluZygpJiYoYS5wdXNoKG4pLGEucHVzaCh4KFN0cmluZyhyKSkpKTtyZXR1cm4gdD1hLmpvaW4oIioiKSx2b2lkIDAhPT1lJiYoYT0ieHBfIitlLGU9TVtlXSh0KSx0PXQrIioiK1thLHgoU3RyaW5nKGUpKV0uam9pbigiKiIpKSxbIjEiLFAodCksdF0uam9pbigiKiIpfWZ1bmN0aW9uIFAodCxlKXtpZih0PVtmLm5hdmlnYXRvci51c2VyQWdlbnQsKG5ldyBEYXRlKS5nZXRUaW1lem9uZU9mZnNldCgpLHYudXNlckxhbmd1YWdlfHx2Lmxhbmd1YWdlLE1hdGguZmxvb3IobmV3IERhdGUoRGF0ZS5ub3coKSkuZ2V0VGltZSgpLzYwLzFlMyktKHZvaWQgMD09PWU/MDplKSx0XS5qb2luKCIqIiksIShlPWMpKXtlPUFycmF5KDI1Nik7Zm9yKHZhciBuPTA7bjwyNTY7bisrKXtmb3IodmFyIHI9bixhPTA7YTw4O2ErKylyPTEmcj9yPj4+MV4zOTg4MjkyMzg0OnI+Pj4xO2Vbbl09cn19Zm9yKGM9ZSxlPTQyOTQ5NjcyOTUsbj0wO248dC5sZW5ndGg7bisrKWU9ZT4+PjheY1syNTUmKGVedC5jaGFyQ29kZUF0KG4pKV07cmV0dXJuKCgtMV5lKT4+PjApLnRvU3RyaW5nKDM2KX12YXIgbj17fSxNPShuWzFdPWZ1bmN0aW9uKCl7cmV0dXJuIkNIRUNLU1VNX0VYUF9ESVNBQkxFRCJ9LG5bMl09ZnVuY3Rpb24oKXtyZXR1cm4iQ0hFQ0tTVU1fRVhQX0RJU0FCTEVEIn0sblszXT1mdW5jdGlvbigpe3JldHVybiJDSEVDS1NVTV9FWFBfRElTQUJMRUQifSxuKTtmdW5jdGlvbiByKG8pe3JldHVybiBmdW5jdGlvbih0KXt2YXIgZT1PKGYubG9jYXRpb24uaHJlZiksbj1lLnNlYXJjaC5yZXBsYWNlKCI/IiwiIikscj1pKG4sIl9nbCIsITApO3QucXVlcnk9cShyfHwiIil8fHt9O3ZhciBhPShyPXcoZSwiZnJhZ21lbnQiKSkubWF0Y2goTCgiX2dsIikpO3QuZnJhZ21lbnQ9cShhJiZhWzNdfHwiIil8fHt9LG8mJmZ1bmN0aW9uKHQsZSxuKXtmdW5jdGlvbiByKHQsZSl7cmV0dXJuIHQ9KHQ9RCgiX2dsIix0KSkubGVuZ3RoP2UrdDp0fXt2YXIgYTtkJiZkLnJlcGxhY2VTdGF0ZSYmKCgoYT1MKCJfZ2wiKSkudGVzdChlKXx8YS50ZXN0KG4pKSYmKHQ9dyh0LCJwYXRoIiksZT1yKGUsIj8iKSxuPXIobiwiIyIpLGQucmVwbGFjZVN0YXRlKHt9LHZvaWQgMCwiIit0K2UrbikpKX19KGUsbixyKX19ZnVuY3Rpb24gRCh0LGUpe3ZhciBuLHI7cmV0dXJuKHQ9TCh0KS5leGVjKGUpKSYmKG49dFsyXSxyPXRbNF0sZT10WzFdLHImJihlPWUrbityKSksZX1mdW5jdGlvbiBxKHQpe3ZhciBlPXZvaWQgMD09PWU/MzplO3RyeXtpZih0KXt0Ontmb3IodmFyIG49MDtuPDM7KytuKXt2YXIgcj1SLmV4ZWModCk7aWYocil7dmFyIGE9cjticmVhayB0fXQ9ZGVjb2RlVVJJQ29tcG9uZW50KHQpfWE9dm9pZCAwfWlmKGEmJiIxIj09PWFbMV0pe3ZhciBvPWFbMl0saT1hWzNdO3Q6e2ZvcihhPTA7YTxlOysrYSlpZihvPT09UChpLGEpKXt2YXIgcz0hMDticmVhayB0fXM9ITF9aWYocyl7Zm9yKHZhciBlPXt9LGM9aT9pLnNwbGl0KCIqIik6W10saT0wO2k8Yy5sZW5ndGg7aSs9MillW2NbaV1dPWZ1bmN0aW9uKHIpe2Z1bmN0aW9uIHQodCl7Zm9yKDthPHIubGVuZ3RoOyl7dmFyIGU9ci5jaGFyQXQoYSsrKSxuPWxbZV07aWYobnVsbCE9bilyZXR1cm4gbjtpZighL15bXHNceGEwXSokLy50ZXN0KGUpKXRocm93IEVycm9yKCJVbmtub3duIGJhc2U2NCBlbmNvZGluZyBhdCBjaGFyOiAiK2UpfXJldHVybiB0fXU9dXx8VCgpLGw9bHx8RSgpO2Zvcih2YXIgZT0iIixhPTA7Oyl7dmFyIG49dCgtMSksbz10KDApLGk9dCg2NCkscz10KDY0KTtpZig2ND09PXMmJi0xPT09bilyZXR1cm4gZTtlKz1TdHJpbmcuZnJvbUNoYXJDb2RlKG48PDJ8bz4+NCksNjQhPWkmJihlKz1TdHJpbmcuZnJvbUNoYXJDb2RlKG88PDQmMjQwfGk+PjIpLDY0IT1zJiYoZSs9U3RyaW5nLmZyb21DaGFyQ29kZShpPDw2JjE5MnxzKSkpfX0oY1tpKzFdKTtyZXR1cm4gZX19fX1jYXRjaCh0KXt9fWZ1bmN0aW9uIFUobix0LGUscil7ZnVuY3Rpb24gYSh0KXt2YXIgZT0odD1EKG4sdCkpLmNoYXJBdCh0Lmxlbmd0aC0xKTtyZXR1cm4gdCYmIiYiIT09ZSYmKHQrPSImIiksdCtzfWlmKHI9dm9pZCAwIT09ciYmciwhKGk9QS5leGVjKGUpKSlyZXR1cm4iIjtlPWlbMV07dmFyIG89aVsyXXx8IiIsaT1pWzNdfHwiIixzPW4rIj0iK3Q7cmV0dXJuIHI/aT0iIyIrYShpLnN1YnN0cmluZygxKSk6bz0iPyIrYShvLnN1YnN0cmluZygxKSksIiIrZStvK2l9ZnVuY3Rpb24gSCh0LGUpe3ZhciBuPSJGT1JNIj09PSh0LnRhZ05hbWV8fCIiKS50b1VwcGVyQ2FzZSgpLHI9QyhlLDEsbiksYT1DKGUsMixuKTtlPUMoZSwzLG4pO3ZhciBvLGk9ajtmb3IobyBpbiBzKHIpJiYocj1JKHIsaSksbj9WKCJfZ2wiLHIsdCk6RygiX2dsIixyLHQsITEpKSwhbiYmcyhhKSYmRygiX2dsIixuPUkoYSksdCwhMCksZSllLmhhc093blByb3BlcnR5KG8pJiYkKG8sZVtvXSx0KX1mdW5jdGlvbiAkKHQsZSxuLHIpe2lmKG4udGFnTmFtZSl7aWYoImEiPT09bi50YWdOYW1lLnRvTG93ZXJDYXNlKCkpcmV0dXJuIEcodCxlLG4scik7aWYoImZvcm0iPT09bi50YWdOYW1lLnRvTG93ZXJDYXNlKCkpcmV0dXJuIFYodCxlLG4pfWlmKCJzdHJpbmciPT10eXBlb2YgbilyZXR1cm4gVSh0LGUsbixyKX1mdW5jdGlvbiBHKHQsZSxuLHIpe24uaHJlZiYmKHQ9VSh0LGUsbi5ocmVmLHZvaWQgMCE9PXImJnIpLGgudGVzdCh0KSYmKG4uaHJlZj10KSl9ZnVuY3Rpb24gVih0LGUsbil7aWYobiYmbi5hY3Rpb24paWYoImdldCI9PT0ocj0obi5tZXRob2R8fCIiKS50b0xvd2VyQ2FzZSgpKSl7Zm9yKHZhciByPW4uY2hpbGROb2Rlc3x8W10sYT0hMSxvPTA7bzxyLmxlbmd0aDtvKyspe3ZhciBpPXJbb107aWYoaS5uYW1lPT09dCl7aS5zZXRBdHRyaWJ1dGUoInZhbHVlIixlKSxhPSEwO2JyZWFrfX1hfHwoKHI9cC5jcmVhdGVFbGVtZW50KCJpbnB1dCIpKS5zZXRBdHRyaWJ1dGUoInR5cGUiLCJoaWRkZW4iKSxyLnNldEF0dHJpYnV0ZSgibmFtZSIsdCksci5zZXRBdHRyaWJ1dGUoInZhbHVlIixlKSxuLmFwcGVuZENoaWxkKHIpKX1lbHNlInBvc3QiPT09ciYmKHQ9VSh0LGUsbi5hY3Rpb24pLGgudGVzdCh0KSYmKG4uYWN0aW9uPXQpKX1mdW5jdGlvbiBGKHQpe3RyeXt0Ontmb3IodmFyIGU9MTAwO3QmJjA8ZTspe2lmKHQuaHJlZiYmdC5ub2RlTmFtZS5tYXRjaCgvXmEoPzpyZWEpPyQvaSkpe3ZhciBuPXQ7YnJlYWsgdH10PXQucGFyZW50Tm9kZSxlLS19bj1udWxsfXZhciByO24mJigiaHR0cDoiIT09KHI9bi5wcm90b2NvbCkmJiJodHRwczoiIT09cnx8SChuLG4uaG9zdG5hbWUpKX1jYXRjaCh0KXt9fWZ1bmN0aW9uIFgodCl7dHJ5e3QuYWN0aW9uJiZIKHQsdyhPKHQuYWN0aW9uKSwiaG9zdCIpKX1jYXRjaCh0KXt9fXQoImdvb2dsZV90YWdfZGF0YS5nbEJyaWRnZS5hdXRvIixmdW5jdGlvbih0LGUsbixyLGEpe2soKSx2b2lkIDAhPT1hJiYoaj1hKSwzIT09YXx8di51c2VyQWdlbnREYXRhJiZ2LnVzZXJBZ2VudERhdGEuZ2V0SGlnaEVudHJvcHlWYWx1ZXMoWyJhcmNoaXRlY3R1cmUiLCJtb2RlbCIsImJpdG5lc3MiLCJwbGF0Zm9ybVZlcnNpb24iLCJ1YUZ1bGxWZXJzaW9uIl0pLnRoZW4oZnVuY3Rpb24oKXt9KSxTKHQsZSwiZnJhZ21lbnQiPT09bj8yOjEsISFyLCExKX0pLHQoImdvb2dsZV90YWdfZGF0YS5nbEJyaWRnZS5wYXNzdGhyb3VnaCIsZnVuY3Rpb24odCxlLG4scil7aygpLHZvaWQgMCE9PXImJihqPXIpLFModCxbeShmLmxvY2F0aW9uLCJob3N0IiwhMCldLGUsISFuLCEwKX0pLHQoImdvb2dsZV90YWdfZGF0YS5nbEJyaWRnZS5kZWNvcmF0ZSIsZnVuY3Rpb24odCxlLG4pe3JldHVybiAkKCJfZ2wiLHQ9SSh0KSxlLCEhbil9KSx0KCJnb29nbGVfdGFnX2RhdGEuZ2xCcmlkZ2UuZ2VuZXJhdGUiLEkpLHQoImdvb2dsZV90YWdfZGF0YS5nbEJyaWRnZS5nZXQiLGZ1bmN0aW9uKHQsZSl7dmFyIG49cighIWUpO3JldHVybihlPU4oKSkuZGF0YXx8KGUuZGF0YT17cXVlcnk6e30sZnJhZ21lbnQ6e319LG4oZS5kYXRhKSksbj17fSwoZT1lLmRhdGEpJiYoZyhuLGUucXVlcnkpLHQmJmcobixlLmZyYWdtZW50KSksbn0pfSh3aW5kb3cpLGZ1bmN0aW9uKCl7ZnVuY3Rpb24gbyh0KXt2YXIgZSxuPTE7aWYodClmb3Iobj0wLGU9dC5sZW5ndGgtMTswPD1lO2UtLSl7dmFyIHI9dC5jaGFyQ29kZUF0KGUpO249MCE9KHI9MjY2MzM4MzA0JihuPShuPDw2JjI2ODQzNTQ1NSkrcisocjw8MTQpKSk/bl5yPj4yMTpufXJldHVybiBufWZ1bmN0aW9uIGkodCl7dGhpcy5DPXR8fFtdfWkucHJvdG90eXBlLnNldD1mdW5jdGlvbih0KXt0aGlzLkNbdF09ITB9LGkucHJvdG90eXBlLmVuY29kZT1mdW5jdGlvbigpe2Zvcih2YXIgdD1bXSxlPTA7ZTx0aGlzLkMubGVuZ3RoO2UrKyl0aGlzLkNbZV0mJih0W01hdGguZmxvb3IoZS82KV1ePTE8PGUlNik7Zm9yKGU9MDtlPHQubGVuZ3RoO2UrKyl0W2VdPSJBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OS1fIi5jaGFyQXQodFtlXXx8MCk7cmV0dXJuIHQuam9pbigiIikrIn4ifTt2YXIgdD13aW5kb3cuR29vZ2xlQW5hbHl0aWNzT2JqZWN0LHM9KEFlPShBZT1OZT0oTmU9bnVsbCE9dCk/LTE8KHQuY29uc3RydWN0b3IrIiIpLmluZGV4T2YoIlN0cmluZyIpOk5lKT8oUmU9d2luZG93Lkdvb2dsZUFuYWx5dGljc09iamVjdCk/UmUucmVwbGFjZSgvXltcc1x4YTBdK3xbXHNceGEwXSskL2csIiIpOiIiOkFlKXx8ImdhIixjPS9eKD86dXRtYVwuKT9cZCtcLlxkKyQvLHU9L15hbXAtW1x3Li1dezIyLDY0fSQvLGw9ITEscj1uZXcgaTtmdW5jdGlvbiBnKHQpe3Iuc2V0KHQpfWZ1bmN0aW9uIGgodCl7cmV0dXJuIHQ9dC5nZXQoRmUpLHQ9IXkodCk/W106dH1mdW5jdGlvbiBmKHQpe3JldHVybiJmdW5jdGlvbiI9PXR5cGVvZiB0fWZ1bmN0aW9uIGQoKXtmb3IodmFyIHQ9SS5uYXZpZ2F0b3IudXNlckFnZW50KyhQLmNvb2tpZXx8IiIpKyhQLnJlZmVycmVyfHwiIiksZT10Lmxlbmd0aCxuPUkuaGlzdG9yeS5sZW5ndGg7MDxuOyl0Kz1uLS1eZSsrO3JldHVybltBdCgpXjIxNDc0ODM2NDcmbyh0KSxNYXRoLnJvdW5kKChuZXcgRGF0ZSkuZ2V0VGltZSgpLzFlMyldLmpvaW4oIi4iKX1mdW5jdGlvbiBwKHQsZSxuLHIpe3RyeXt0LmFkZEV2ZW50TGlzdGVuZXI/dC5hZGRFdmVudExpc3RlbmVyKGUsbiwhIXIpOnQuYXR0YWNoRXZlbnQmJnQuYXR0YWNoRXZlbnQoIm9uIitlLG4pfWNhdGNoKHQpe2coMjcpfX1mdW5jdGlvbiB2KHQsZSl7dmFyIG49dC5pbmRleE9mKGUpO3JldHVybiEoNSE9biYmNiE9bnx8Ii8iIT0odD10LmNoYXJBdChuK2UubGVuZ3RoKSkmJiI/IiE9dCYmIiIhPXQmJiI6IiE9dCl9ZnVuY3Rpb24gbSh0LGUpe2lmKDE9PWUubGVuZ3RoJiZudWxsIT1lWzBdJiYib2JqZWN0Ij09dHlwZW9mIGVbMF0pcmV0dXJuIGVbMF07Zm9yKHZhciBuPXt9LHI9TWF0aC5taW4odC5sZW5ndGgrMSxlLmxlbmd0aCksYT0wO2E8cjthKyspe2lmKCJvYmplY3QiPT10eXBlb2YgZVthXSl7Zm9yKHZhciBvIGluIGVbYV0pZVthXS5oYXNPd25Qcm9wZXJ0eShvKSYmKG5bb109ZVthXVtvXSk7YnJlYWt9YTx0Lmxlbmd0aCYmKG5bdFthXV09ZVthXSl9cmV0dXJuIG59ZnVuY3Rpb24gYigpe3RoaXMub2E9W10sdGhpcy5lYT17fSx0aGlzLm09e319dmFyIHc9ZnVuY3Rpb24odCl7dD1oKHQpLHQ9bmV3IGkodCk7Zm9yKHZhciBlPXIuQy5zbGljZSgpLG49MDtuPHQuQy5sZW5ndGg7bisrKWVbbl09ZVtuXXx8dC5DW25dO3JldHVybiBuZXcgaShlKS5lbmNvZGUoKX0seT1mdW5jdGlvbih0KXtyZXR1cm4iW29iamVjdCBBcnJheV0iPT1PYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoT2JqZWN0KHQpKX0sXz1mdW5jdGlvbih0KXtyZXR1cm4gbnVsbCE9dCYmLTE8KHQuY29uc3RydWN0b3IrIiIpLmluZGV4T2YoIlN0cmluZyIpfSxPPWZ1bmN0aW9uKHQsZSl7cmV0dXJuIDA9PXQuaW5kZXhPZihlKX0sRT1mdW5jdGlvbih0KXt2YXIgZT1QLmNyZWF0ZUVsZW1lbnQoImltZyIpO3JldHVybiBlLndpZHRoPTEsZS5oZWlnaHQ9MSxlLnNyYz10LGV9LFQ9ZnVuY3Rpb24oKXt9LHg9ZnVuY3Rpb24odCl7cmV0dXJuIGVuY29kZVVSSUNvbXBvbmVudCBpbnN0YW5jZW9mIEZ1bmN0aW9uP2VuY29kZVVSSUNvbXBvbmVudCh0KTooZygyOCksdCl9LGs9L15bXHdcLTovLj89JiUhXFtcXV0rJC8sUz0vXltcdysvXy1dK1s9XXswLDJ9JC8sQz1udWxsLGo9ZnVuY3Rpb24odCxlLG4scixhKXtpZighQyl7Qz17Y3JlYXRlU2NyaXB0VVJMOmZ1bmN0aW9uKHQpe3JldHVybiB0fSxjcmVhdGVIVE1MOmZ1bmN0aW9uKHQpe3JldHVybiB0fX07dHJ5e0M9d2luZG93LnRydXN0ZWRUeXBlcy5jcmVhdGVQb2xpY3koImdvb2dsZS1hbmFseXRpY3MiLEMpfWNhdGNoKHQpe319dmFyIG87dCYmKG89KG89UC5xdWVyeVNlbGVjdG9yJiZQLnF1ZXJ5U2VsZWN0b3IoInNjcmlwdFtub25jZV0iKXx8bnVsbCkmJihvLm5vbmNlfHxvLmdldEF0dHJpYnV0ZSYmby5nZXRBdHRyaWJ1dGUoIm5vbmNlIikpfHwiIixuPyhhPXI9IiIsZSYmay50ZXN0KGUpJiYocj0nIGlkPSInK2UrJyInKSxvJiZTLnRlc3QobykmJihhPScgbm9uY2U9IicrbysnIicpLGsudGVzdCh0KSYmUC53cml0ZShDLmNyZWF0ZUhUTUwoIjxzY3JpcHQiK3IrYSsnIHNyYz0iJyt0KyciPjxcL3NjcmlwdD4nKSkpOigobj1QLmNyZWF0ZUVsZW1lbnQoInNjcmlwdCIpKS50eXBlPSJ0ZXh0L2phdmFzY3JpcHQiLG4uYXN5bmM9ITAsbi5zcmM9Qy5jcmVhdGVTY3JpcHRVUkwodCksciYmKG4ub25sb2FkPXIpLGEmJihuLm9uZXJyb3I9YSksZSYmKG4uaWQ9ZSksbyYmbi5zZXRBdHRyaWJ1dGUoIm5vbmNlIixvKSwodD1QLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJzY3JpcHQiKVswXSkucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUobix0KSkpfSxOPWZ1bmN0aW9uKHQsZSl7cmV0dXJuIFIoUC5sb2NhdGlvbltlPyJocmVmIjoic2VhcmNoIl0sdCl9LFI9ZnVuY3Rpb24odCxlKXtyZXR1cm4odD10Lm1hdGNoKCIoPzomfCN8XFw/KSIreChlKS5yZXBsYWNlKC8oWy4qKz9ePSE6JHt9KCl8XFtcXVwvXFxdKS9nLCJcXCQxIikrIj0oW14mI10qKSIpKSYmMj09dC5sZW5ndGg/dFsxXToiIn0sQT1mdW5jdGlvbigpe3ZhciB0PSIiK1AubG9jYXRpb24uaG9zdG5hbWU7cmV0dXJuIDA9PXQuaW5kZXhPZigid3d3LiIpP3Quc3Vic3RyaW5nKDQpOnR9LEw9ZnVuY3Rpb24odCxlKXtmb3IodmFyIG49MDtuPHQubGVuZ3RoO24rKylpZihlPT10W25dKXJldHVybiEwO3JldHVybiExfTtiLnByb3RvdHlwZS5zZXQ9ZnVuY3Rpb24odCxlLG4pe3RoaXMub2EucHVzaCh0KSxuP3RoaXMubVsiOiIrdF09ZTp0aGlzLmVhWyI6Iit0XT1lfSxiLnByb3RvdHlwZS5nZXQ9ZnVuY3Rpb24odCl7cmV0dXJuKHRoaXMubS5oYXNPd25Qcm9wZXJ0eSgiOiIrdCk/dGhpcy5tOnRoaXMuZWEpWyI6Iit0XX0sYi5wcm90b3R5cGUubWFwPWZ1bmN0aW9uKHQpe2Zvcih2YXIgZT0wO2U8dGhpcy5vYS5sZW5ndGg7ZSsrKXt2YXIgbj10aGlzLm9hW2VdLHI9dGhpcy5nZXQobik7ciYmdChuLHIpfX07dmFyIEk9d2luZG93LFA9ZG9jdW1lbnQsbj1kb2N1bWVudC5jdXJyZW50U2NyaXB0P2RvY3VtZW50LmN1cnJlbnRTY3JpcHQuc3JjOiIiLE09ZnVuY3Rpb24odCxlKXtyZXR1cm4gc2V0VGltZW91dCh0LGUpfSxEPXdpbmRvdyxxPWRvY3VtZW50LFU9ZnVuY3Rpb24odCl7dmFyIGU9RC5fZ2FVc2VyUHJlZnM7aWYoZSYmZS5pb28mJmUuaW9vKCl8fHQmJiEwPT09RFsiZ2EtZGlzYWJsZS0iK3RdKXJldHVybiEwO3RyeXt2YXIgbj1ELmV4dGVybmFsO2lmKG4mJm4uX2dhVXNlclByZWZzJiYib28iPT1uLl9nYVVzZXJQcmVmcylyZXR1cm4hMH1jYXRjaCh0KXt9Zm9yKHQ9W10sZT1TdHJpbmcocS5jb29raWUpLnNwbGl0KCI7Iiksbj0wO248ZS5sZW5ndGg7bisrKXt2YXIgcj1lW25dLnNwbGl0KCI9IiksYT1yWzBdLnJlcGxhY2UoL15ccyp8XHMqJC9nLCIiKTthJiYiQU1QX1RPS0VOIj09YSYmKChyPXIuc2xpY2UoMSkuam9pbigiPSIpLnJlcGxhY2UoL15ccyp8XHMqJC9nLCIiKSkmJihyPWRlY29kZVVSSUNvbXBvbmVudChyKSksdC5wdXNoKHIpKX1mb3IoZT0wO2U8dC5sZW5ndGg7ZSsrKWlmKCIkT1BUX09VVCI9PXRbZV0pcmV0dXJuITA7cmV0dXJuISFxLmdldEVsZW1lbnRCeUlkKCJfX2dhT3B0T3V0RXh0ZW5zaW9uIil9LEg9ZnVuY3Rpb24odCl7dmFyIGU9W10sbj1QLmNvb2tpZS5zcGxpdCgiOyIpO3Q9bmV3IFJlZ0V4cCgiXlxccyoiK3QrIj1cXHMqKC4qPylcXHMqJCIpO2Zvcih2YXIgcj0wO3I8bi5sZW5ndGg7cisrKXt2YXIgYT1uW3JdLm1hdGNoKHQpO2EmJmUucHVzaChhWzFdKX1yZXR1cm4gZX0sJD1mdW5jdGlvbih0LGUsbixyLGEsbyxpKXtpZighKGE9IVUoYSkmJiEoRi50ZXN0KFAubG9jYXRpb24uaG9zdG5hbWUpfHwiLyI9PW4mJlYudGVzdChyKSkpKXJldHVybiExO2lmKG49dCsiPSIrKGU9ZSYmMTIwMDxlLmxlbmd0aD9lLnN1YnN0cmluZygwLDEyMDApOmUpKyI7IHBhdGg9IituKyI7ICIsbyYmKG4rPSJleHBpcmVzPSIrbmV3IERhdGUoKG5ldyBEYXRlKS5nZXRUaW1lKCkrbykudG9HTVRTdHJpbmcoKSsiOyAiKSxyJiYibm9uZSIhPT1yJiYobis9ImRvbWFpbj0iK3IrIjsiKSxpJiYobis9aSsiOyIpLHI9UC5jb29raWUsUC5jb29raWU9biwhKHI9ciE9UC5jb29raWUpKXQ6e2Zvcih0PUgodCkscj0wO3I8dC5sZW5ndGg7cisrKWlmKGU9PXRbcl0pe3I9ITA7YnJlYWsgdH1yPSExfXJldHVybiByfSxHPWZ1bmN0aW9uKHQpe3JldHVybiBlbmNvZGVVUklDb21wb25lbnQ/ZW5jb2RlVVJJQ29tcG9uZW50KHQpLnJlcGxhY2UoL1woL2csIiUyOCIpLnJlcGxhY2UoL1wpL2csIiUyOSIpOnR9LFY9L14od3d3XC4pP2dvb2dsZShcLmNvbT8pPyhcLlthLXpdezJ9KT8kLyxGPS8oXnxcLilkb3VibGVjbGlja1wubmV0JC9pLFg9ZnVuY3Rpb24odCl7dmFyIGU9W10sbj1QLmNvb2tpZS5zcGxpdCgiOyIpO3Q9bmV3IFJlZ0V4cCgiXlxccyoiKyh0fHwiX2dhYyIpKyJfKFVBLVxcZCstXFxkKyk9XFxzKiguKz8pXFxzKiQiKTtmb3IodmFyIHI9MDtyPG4ubGVuZ3RoO3IrKyl7dmFyIGE9bltyXS5tYXRjaCh0KTthJiZlLnB1c2goe2phOmFbMV0sdmFsdWU6YVsyXSx0aW1lc3RhbXA6TnVtYmVyKGFbMl0uc3BsaXQoIi4iKVsxXSl8fDB9KX1yZXR1cm4gZS5zb3J0KGZ1bmN0aW9uKHQsZSl7cmV0dXJuIGUudGltZXN0YW1wLXQudGltZXN0YW1wfSksZX07ZnVuY3Rpb24gQih0LGUsbil7dmFyIHI9e307aWYoIShlPVgoZSkpfHwhZS5sZW5ndGgpcmV0dXJuIHI7Zm9yKHZhciBhPTA7YTxlLmxlbmd0aDthKyspe3ZhciBvLGk9ZVthXS52YWx1ZS5zcGxpdCgiLiIpOyIxIiE9PWlbMF18fG4mJmkubGVuZ3RoPDN8fCFuJiYzIT09aS5sZW5ndGg/dCYmKHQubmE9ITApOk51bWJlcihpWzFdKSYmKHJbZVthXS5qYV0/dCYmKHQucGE9ITApOnJbZVthXS5qYV09W10sbz17dmVyc2lvbjppWzBdLHRpbWVzdGFtcDoxZTMqTnVtYmVyKGlbMV0pLHFhOmlbMl19LG4mJjM8aS5sZW5ndGgmJihvLmxhYmVscz1pLnNsaWNlKDMpKSxyW2VbYV0uamFdLnB1c2gobykpfXJldHVybiByfWZ1bmN0aW9uIHooKXt4YS5EKFtUXSl9ZnVuY3Rpb24gSyh0LGUsbil7Zm9yKGV0JiZjbGVhclRpbWVvdXQoZXQpLGUmJmx0KGUsbikscnQ9dCxlPWl0LGl0PVtdLG49MDtuPGUubGVuZ3RoO24rKyllW25dKHQpfWZ1bmN0aW9uIFcodCl7dDp7aWYoYXQudGVzdChQLnJlZmVycmVyKSl7dmFyIGU9UC5sb2NhdGlvbi5ob3N0bmFtZS5yZXBsYWNlKG90LCIiKTtlOnt2YXIgbj1QLnJlZmVycmVyLHI9KG49bi5yZXBsYWNlKC9eaHR0cHM/OlwvXC8vLCIiKSkucmVwbGFjZSgvXlteL10rLywiIikuc3BsaXQoIi8iKSxhPXJbMl07aWYoIShyPShyPSJzIj09YT9yWzNdOmEpP2RlY29kZVVSSUNvbXBvbmVudChyKTpyKSl7aWYoMD09bi5pbmRleE9mKCJ4bi0tIikpe249IiI7YnJlYWsgZX0obj1uLm1hdGNoKC8oLiopXC5jZG5cLmFtcHByb2plY3RcLm9yZ1wvPyQvKSkmJjI9PW4ubGVuZ3RoJiYocj1uWzFdLnJlcGxhY2UoLy0vZywiLiIpLnJlcGxhY2UoL1wuXC4vZywiLSIpKX1uPXI/ci5yZXBsYWNlKG90LCIiKToiIn1pZihyPSEocj1lPT09bik/ZS5zdWJzdHJpbmcoZS5sZW5ndGgtKG49Ii4iK24pLmxlbmd0aCxlLmxlbmd0aCk9PT1uOnIpe2U9ITA7YnJlYWsgdH1nKDc4KX1lPSExfXJldHVybiBlJiYhMSE9PXR9ZnVuY3Rpb24gWih0KXtzd2l0Y2godCl7ZGVmYXVsdDpjYXNlIDE6cmV0dXJuImh0dHBzOi8vd3d3Lmdvb2dsZS1hbmFseXRpY3MuY29tL2d0bS9qcz9pZD0iO2Nhc2UgMjpyZXR1cm4iaHR0cHM6Ly93d3cuZ29vZ2xldGFnbWFuYWdlci5jb20vZ3RhZy9qcz9pZD0ifX1mdW5jdGlvbiBZKHQpe3RoaXMubmFtZT0ibGVuIix0aGlzLm1lc3NhZ2U9dCsiLTgxOTIifWZ1bmN0aW9uIEoodCxlLG4pe2lmKDA9PT1lLmxlbmd0aCluKCk7ZWxzZXt2YXIgcj1lLmNoYXJBdCgwKTtzd2l0Y2gocil7Y2FzZSJkIjpmdCgiaHR0cHM6Ly9zdGF0cy5nLmRvdWJsZWNsaWNrLm5ldC9qL2NvbGxlY3QiLHQuVSx0LG4pO2JyZWFrO2Nhc2UiZyI6ZHQoImh0dHBzOi8vd3d3Lmdvb2dsZS5jb20vYWRzL2dhLWF1ZGllbmNlcyIsdC5nb29nbGUsbiksKGU9ZS5zdWJzdHJpbmcoMSkpJiYoL15bYS16Ll17MSw2fSQvLnRlc3QoZSk/ZHQoImh0dHBzOi8vd3d3Lmdvb2dsZS4lL2Fkcy9nYS1hdWRpZW5jZXMiLnJlcGxhY2UoIiUiLGUpLHQuZ29vZ2xlLFQpOmJ0KCJ0bGQiLCJiY2MiLGUpKTticmVhaztjYXNlIkciOmlmKHQuVil7dC5WKCJHLSIrZS5zdWJzdHJpbmcoMSkpLG4oKTticmVha31jYXNlIngiOmlmKHQuVil7dC5WKCksbigpO2JyZWFrfWRlZmF1bHQ6YnQoInhociIsImJyYyIsciksbigpfX19ZnVuY3Rpb24gUSgpe3RoaXMuTT1bXX12YXIgdHQsZXQsbnQscnQsYXQ9L15odHRwcz86XC9cL1teL10qY2RuXC5hbXBwcm9qZWN0XC5vcmdcLy8sb3Q9L14oPzp3d3dcLnxtXC58YW1wXC4pKy8saXQ9W10sc3Q9ZnVuY3Rpb24odCxlKXt2YXIgbj1IKCJBTVBfVE9LRU4iKTtyZXR1cm4gMTxuLmxlbmd0aD8oZyg1NSksITEpOiIkT1BUX09VVCI9PShuPWRlY29kZVVSSUNvbXBvbmVudChuWzBdfHwiIikpfHwiJEVSUk9SIj09bnx8VShlKT8oZyg2MiksITEpOmF0LnRlc3QoUC5yZWZlcnJlcil8fCIkTk9UX0ZPVU5EIiE9bj92b2lkIDAhPT1ydD8oZyg1NiksTShmdW5jdGlvbigpe3QocnQpfSwwKSwhMCk6dHQ/KGl0LnB1c2godCksITApOiIkUkVUUklFVklORyI9PW4/KGcoNTcpLE0oZnVuY3Rpb24oKXtzdCh0LGUpfSwxZTQpLCEwKToodHQ9ITAsbiYmIiQiIT1uWzBdfHwobHQoIiRSRVRSSUVWSU5HIiwzZTQpLHNldFRpbWVvdXQodXQsM2U0KSxuPSIiKSwhIWN0KG4sZSkmJihpdC5wdXNoKHQpLCEwKSk6KGcoNjgpLCExKX0sY3Q9ZnVuY3Rpb24oZSxuLHIpe2lmKCF3aW5kb3cuSlNPTilyZXR1cm4gZyg1OCksITE7dmFyIHQ9SS5YTUxIdHRwUmVxdWVzdDtpZighdClyZXR1cm4gZyg1OSksITE7dmFyIGE9bmV3IHQ7cmV0dXJuIndpdGhDcmVkZW50aWFscyJpbiBhPyhhLm9wZW4oIlBPU1QiLChyfHwiaHR0cHM6Ly9hbXBjaWQuZ29vZ2xlLmNvbS92MS9wdWJsaXNoZXI6Z2V0Q2xpZW50SWQiKSsiP2tleT1BSXphU3lBNjVsRUhVRWl6SXNOdGxiTm8tbDJLMThkVDY4MG5zYU0iLCEwKSxhLndpdGhDcmVkZW50aWFscz0hMCxhLnNldFJlcXVlc3RIZWFkZXIoIkNvbnRlbnQtVHlwZSIsInRleHQvcGxhaW4iKSxhLm9ubG9hZD1mdW5jdGlvbigpe2lmKHR0PSExLDQ9PWEucmVhZHlTdGF0ZSl7dHJ5ezIwMCE9YS5zdGF0dXMmJihnKDYxKSxLKCIiLCIkRVJST1IiLDNlNCkpO3ZhciB0PUpTT04ucGFyc2UoYS5yZXNwb25zZVRleHQpO3Qub3B0T3V0PyhnKDYzKSxLKCIiLCIkT1BUX09VVCIsMzE1MzZlNikpOnQuY2xpZW50SWQ/Syh0LmNsaWVudElkLHQuc2VjdXJpdHlUb2tlbiwzMTUzNmU2KTohciYmdC5hbHRlcm5hdGVVcmw/KGV0JiZjbGVhclRpbWVvdXQoZXQpLHR0PSEwLGN0KGUsbix0LmFsdGVybmF0ZVVybCkpOihnKDY0KSxLKCIiLCIkTk9UX0ZPVU5EIiwzNmU1KSl9Y2F0Y2godCl7Zyg2NSksSygiIiwiJEVSUk9SIiwzZTQpfWE9bnVsbH19LHQ9e29yaWdpblNjb3BlOiJBTVBfRUNJRF9HT09HTEUifSxlJiYodC5zZWN1cml0eVRva2VuPWUpLGEuc2VuZChKU09OLnN0cmluZ2lmeSh0KSksZXQ9TShmdW5jdGlvbigpe2coNjYpLEsoIiIsIiRFUlJPUiIsM2U0KX0sMWU0KSwhMCk6KGcoNjApLCExKX0sdXQ9ZnVuY3Rpb24oKXt0dD0hMX0sbHQ9ZnVuY3Rpb24odCxlKXtpZih2b2lkIDA9PT1udCl7bnQ9IiI7Zm9yKHZhciBuPXNyKCkscj0wO3I8bi5sZW5ndGg7cisrKXt2YXIgYT1uW3JdO2lmKCQoIkFNUF9UT0tFTiIsZW5jb2RlVVJJQ29tcG9uZW50KHQpLCIvIixhLCIiLGUpKXJldHVybiB2b2lkKG50PWEpfX0kKCJBTVBfVE9LRU4iLGVuY29kZVVSSUNvbXBvbmVudCh0KSwiLyIsbnQsIiIsZSl9LGd0PWZ1bmN0aW9uKHQpe3JldHVybih0fHxsfHwiaHR0cHM6Ij09UC5sb2NhdGlvbi5wcm90b2NvbD8iaHR0cHM6IjoiaHR0cDoiKSsiLy93d3cuZ29vZ2xlLWFuYWx5dGljcy5jb20ifSxodD1mdW5jdGlvbih0LGUsbil7aWYobj1ufHxULGUubGVuZ3RoPD0yMDM2KWR0KHQsZSxuKTtlbHNle2lmKCEoZS5sZW5ndGg8PTgxOTIpKXRocm93IGJ0KCJsZW4iLGUubGVuZ3RoKSxuZXcgWShlLmxlbmd0aCk7bXQodCxlLG4pfHxwdCh0LGUsbil8fGR0KHQsZSxuKX19LGZ0PWZ1bmN0aW9uKHQsZSxuLHIpe3B0KHQrIj8iK2UsIiIscj1yfHxULG4pfSxkdD1mdW5jdGlvbih0LGUsbil7dmFyIHI9RSh0KyI/IitlKTtyLm9ubG9hZD1yLm9uZXJyb3I9ZnVuY3Rpb24oKXtyLm9ubG9hZD1udWxsLHIub25lcnJvcj1udWxsLG4oKX19LHB0PWZ1bmN0aW9uKG4scixvLGkpe3ZhciB0PXt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csIlhNTEh0dHBSZXF1ZXN0Iik7dHJ5e3JldHVybiB0JiZ7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csIlhNTEh0dHBSZXF1ZXN0IixhLlhNTEh0dHBSZXF1ZXN0KSxmdW5jdGlvbigpe3ZhciB0PUkuWE1MSHR0cFJlcXVlc3Q7aWYoIXQpcmV0dXJuITE7dmFyIGU9bmV3IHQ7cmV0dXJuIndpdGhDcmVkZW50aWFscyJpbiBlJiYobj1uLnJlcGxhY2UoL15odHRwOi8sImh0dHBzOiIpLGUub3BlbigiUE9TVCIsbiwhMCksZS53aXRoQ3JlZGVudGlhbHM9ITAsZS5zZXRSZXF1ZXN0SGVhZGVyKCJDb250ZW50LVR5cGUiLCJ0ZXh0L3BsYWluIiksZS5vbnJlYWR5c3RhdGVjaGFuZ2U9ZnVuY3Rpb24oKXtpZig0PT1lLnJlYWR5U3RhdGUpe2lmKGkmJiJ0ZXh0L3BsYWluIj09PWUuZ2V0UmVzcG9uc2VIZWFkZXIoIkNvbnRlbnQtVHlwZSIpKXRyeXt2dChpLGUucmVzcG9uc2VUZXh0LG8pfWNhdGNoKHQpe2J0KCJ4aHIiLCJyc3AiKSxvKCl9ZWxzZSBvKCk7ZT1udWxsfX0sZS5zZW5kKHIpLCEwKX0uYXBwbHkodGhpcyxhcmd1bWVudHMpfWZpbmFsbHl7dCYme30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCJYTUxIdHRwUmVxdWVzdCIsdCl9fSx2dD1mdW5jdGlvbih0LGUsbil7aWYoZS5sZW5ndGg8MSlidCgieGhyIiwidmVyIiwiMCIpLG4oKTtlbHNlIGlmKDM8dC5jb3VudCsrKWJ0KCJ4aHIiLCJ0bXIiLCIiK3QuY291bnQpLG4oKTtlbHNle3ZhciByPWUuY2hhckF0KDApO2lmKCIxIj09PXIpSih0LGUuc3Vic3RyaW5nKDEpLG4pO2Vsc2UgaWYodC5WJiYiMiI9PT1yKXt2YXIgYT1lLnN1YnN0cmluZygxKS5zcGxpdCgiLCIpLG89MDtmb3IoZT1mdW5jdGlvbigpeysrbz09PWEubGVuZ3RoJiZuKCl9LHI9MDtyPGEubGVuZ3RoO3IrKylKKHQsYVtyXSxlKX1lbHNlIGJ0KCJ4aHIiLCJ2ZXIiLFN0cmluZyhlLmxlbmd0aCkpLG4oKX19LG10PWZ1bmN0aW9uKHQsZSxuKXtyZXR1cm4hIUkubmF2aWdhdG9yLnNlbmRCZWFjb24mJighIUkubmF2aWdhdG9yLnNlbmRCZWFjb24odCxlKSYmKG4oKSwhMCkpfSxidD1mdW5jdGlvbih0LGUsbil7MTw9MTAwKk1hdGgucmFuZG9tKCl8fFUoIj8iKXx8KHQ9WyJ0PWVycm9yIiwiX2U9Iit0LCJfdj1qOTYiLCJzcj0xIl0sZSYmdC5wdXNoKCJfZj0iK2UpLG4mJnQucHVzaCgiX209Iit4KG4uc3Vic3RyaW5nKDAsMTAwKSkpLHQucHVzaCgiYWlwPTEiKSx0LnB1c2goIno9IitBdCgpKSxkdChndCghMCkrIi91L2QiLHQuam9pbigiJiIpLFQpKX0sd3Q9ZnVuY3Rpb24oKXtyZXR1cm4gSS5nYURhdGE9SS5nYURhdGF8fHt9fSx5dD1mdW5jdGlvbih0KXt2YXIgZT13dCgpO3JldHVybiBlW3RdPWVbdF18fHt9fTtmdW5jdGlvbiBfdCh0KXtpZigxMDAhPXQuZ2V0KENuKSYmbyhQdCh0LGhuKSklMWU0Pj0xMDAqTXQodCxDbikpdGhyb3ciYWJvcnQifWZ1bmN0aW9uIE90KHQpe2lmKFUoUHQodCx2bikpKXRocm93ImFib3J0In1mdW5jdGlvbiBFdCgpe3ZhciB0PVAubG9jYXRpb24ucHJvdG9jb2w7aWYoImh0dHA6IiE9dCYmImh0dHBzOiIhPXQpdGhyb3ciYWJvcnQifWZ1bmN0aW9uIFR0KG4pe3RyeXtJLm5hdmlnYXRvci5zZW5kQmVhY29uP2coNDIpOkkuWE1MSHR0cFJlcXVlc3QmJiJ3aXRoQ3JlZGVudGlhbHMiaW4gbmV3IEkuWE1MSHR0cFJlcXVlc3QmJmcoNDApfWNhdGNoKHQpe31uLnNldChWZSx3KG4pLCEwKSxuLnNldCh0ZSxNdChuLHRlKSsxKTt2YXIgcj1bXTtHdC5tYXAoZnVuY3Rpb24odCxlKXtlLkYmJihudWxsIT0odD1uLmdldCh0KSkmJnQhPWUuZGVmYXVsdFZhbHVlJiYoImJvb2xlYW4iPT10eXBlb2YgdCYmKHQqPTEpLHIucHVzaChlLkYrIj0iK3goIiIrdCkpKSl9KSwhMT09PW4uZ2V0KHRyKSYmci5wdXNoKCJucGE9MSIpLHIucHVzaCgiej0iK2UoKSksbi5zZXQoWXQsci5qb2luKCImIiksITApfWZ1bmN0aW9uIHh0KHQpe3ZhciBlPVB0KHQsUXQpOyFlJiZ0LmdldChKdCkmJihlPSJiZWFjb24iKTt2YXIgbj1QdCh0LEtuKSxyPVB0KHQsVW4pLGE9bnx8KHJ8fGd0KCExKSsiIikrIi9jb2xsZWN0IjsiZCI9PT1QdCh0LEpuKT8oYT1ufHwocnx8Z3QoITEpKyIiKSsiL2ovY29sbGVjdCIsZT10LmdldChZbil8fHZvaWQgMCxmdChhLFB0KHQsWXQpLGUsdC5aKFp0KSkpOmU/KG49UHQodCxZdCkscj0ocj10LlooWnQpKXx8VCwiaW1hZ2UiPT1lP2R0KGEsbixyKToieGhyIj09ZSYmcHQoYSxuLHIpfHwiYmVhY29uIj09ZSYmbXQoYSxuLHIpfHxodChhLG4scikpOmh0KGEsUHQodCxZdCksdC5aKFp0KSksYT1QdCh0LHZuKSxlPShhPXl0KGEpKS5oaXRjb3VudCxhLmhpdGNvdW50PWU/ZSsxOjEsYS5maXJzdF9oaXR8fChhLmZpcnN0X2hpdD0obmV3IERhdGUpLmdldFRpbWUoKSksYT1QdCh0LHZuKSxkZWxldGUgeXQoYSkucGVuZGluZ19leHBlcmltZW50cyx0LnNldChadCxULCEwKX1mdW5jdGlvbiBrdCh0KXt3dCgpLmV4cElkJiZ0LnNldChMZSx3dCgpLmV4cElkKSx3dCgpLmV4cFZhciYmdC5zZXQoSWUsd3QoKS5leHBWYXIpO3ZhciBlPVB0KHQsdm4pO2lmKGU9eXQoZSkucGVuZGluZ19leHBlcmltZW50cyl7dmFyIG49W107Zm9yKHIgaW4gZSllLmhhc093blByb3BlcnR5KHIpJiZlW3JdJiZuLnB1c2goZW5jb2RlVVJJQ29tcG9uZW50KHIpKyIuIitlbmNvZGVVUklDb21wb25lbnQoZVtyXSkpO3ZhciByPW4uam9pbigiISIpfWVsc2Ugcj12b2lkIDA7ciYmKChlPXQuZ2V0KFBlKSkmJihyPWUrIiEiK3IpLHQuc2V0KFBlLHIsITApKX1mdW5jdGlvbiBTdCgpe2lmKEkubmF2aWdhdG9yJiYicHJldmlldyI9PUkubmF2aWdhdG9yLmxvYWRQdXJwb3NlKXRocm93ImFib3J0In1mdW5jdGlvbiBDdCh0KXt2YXIgZT1JLmdhRGV2SWRzfHxbXTtpZih5KGUpKXt2YXIgbj10LmdldCgiJmRpZCIpO18obikmJjA8bi5sZW5ndGgmJihlPWUuY29uY2F0KG4uc3BsaXQoIiwiKSkpO2Zvcih2YXIgbj1bXSxyPTA7cjxlLmxlbmd0aDtyKyspTChuLGVbcl0pfHxuLnB1c2goZVtyXSk7MCE9bi5sZW5ndGgmJnQuc2V0KCImZGlkIixuLmpvaW4oIiwiKSwhMCl9fWZ1bmN0aW9uIGp0KHQpe2lmKCF0LmdldCh2bikpdGhyb3ciYWJvcnQifWZ1bmN0aW9uIE50KHQpe3RyeXt2YXIgZSxuO3QuZ2V0KEZuKXx8KHQuc2V0KEZuLCEwKSx0LmdldCgiJmd0bSIpKXx8KGU9dm9pZCAwLChlPSEoZT0hKGU9UnQoTigiZ3RtX2RlYnVnIikpPzI6ZSkmJk8oUC5yZWZlcnJlciwiaHR0cHM6Ly90YWdhc3Npc3RhbnQuZ29vZ2xlLmNvbS8iKT8zOmUpJiZMKFAuY29va2llLnNwbGl0KCI7ICIpLCJfX1RBR19BU1NJU1RBTlQ9eCIpPzQ6ZSl8fFJ0KFAuZG9jdW1lbnRFbGVtZW50LmdldEF0dHJpYnV0ZSgiZGF0YS10YWctYXNzaXN0YW50LXByZXNlbnQiKSkmJihlPTUpLGUmJihJWyJnb29nbGUudGFnbWFuYWdlci5kZWJ1Z3VpMi5xdWV1ZSJdfHwoSVsiZ29vZ2xlLnRhZ21hbmFnZXIuZGVidWd1aTIucXVldWUiXT1bXSxqKCJodHRwczovL3d3dy5nb29nbGUtYW5hbHl0aWNzLmNvbS9kZWJ1Zy9ib290c3RyYXA/aWQ9Iit0LmdldCh2bikrIiZzcmM9TEVHQUNZJmNvbmQ9IitlKSksbj1QLmN1cnJlbnRTY3JpcHQsSVsiZ29vZ2xlLnRhZ21hbmFnZXIuZGVidWd1aTIucXVldWUiXS5wdXNoKHttZXNzYWdlVHlwZToiTEVHQUNZX0NPTlRBSU5FUl9TVEFSVElORyIsZGF0YTp7aWQ6dC5nZXQodm4pLHNjcmlwdFNvdXJjZTpuJiZuLnNyY3x8IiJ9fSkpKX1jYXRjaCh0KXt9fWZ1bmN0aW9uIFJ0KHQpe2lmKG51bGwhPXQmJjAhPT10Lmxlbmd0aCl7dD1OdW1iZXIodCk7dmFyIGU9RGF0ZS5ub3coKTtyZXR1cm4gdDxlKzNlNSYmZS05ZTU8dH19US5wcm90b3R5cGUuYWRkPWZ1bmN0aW9uKHQpe3RoaXMuTS5wdXNoKHQpfSxRLnByb3RvdHlwZS5EPWZ1bmN0aW9uKHQpe3RyeXtmb3IodmFyIGU9MDtlPHRoaXMuTS5sZW5ndGg7ZSsrKXt2YXIgbj10LmdldCh0aGlzLk1bZV0pO24mJmYobikmJm4uY2FsbChJLHQpfX1jYXRjaCh0KXt9KGU9dC5nZXQoWnQpKSE9VCYmZihlKSYmKHQuc2V0KFp0LFQsITApLHNldFRpbWVvdXQoZSwxMCkpfTt2YXIgQXQ9ZnVuY3Rpb24oKXtyZXR1cm4gTWF0aC5yb3VuZCgyMTQ3NDgzNjQ3Kk1hdGgucmFuZG9tKCkpfSxlPWZ1bmN0aW9uKCl7dHJ5e3ZhciB0PW5ldyBVaW50MzJBcnJheSgxKTtyZXR1cm4gSS5jcnlwdG8uZ2V0UmFuZG9tVmFsdWVzKHQpLDIxNDc0ODM2NDcmdFswXX1jYXRjaCh0KXtyZXR1cm4gQXQoKX19O2Z1bmN0aW9uIEx0KHQpe3ZhciBlPU10KHQsVWUpO2lmKDUwMDw9ZSYmZygxNSksInRyYW5zYWN0aW9uIiE9KG49UHQodCxXdCkpJiYiaXRlbSIhPW4pe3ZhciBuPU10KHQsJGUpLHI9KG5ldyBEYXRlKS5nZXRUaW1lKCksYT1NdCh0LEhlKTtpZigwPT1hJiZ0LnNldChIZSxyKSwwPChhPU1hdGgucm91bmQoMiooci1hKS8xZTMpKSYmKG49TWF0aC5taW4obithLDIwKSx0LnNldChIZSxyKSksbjw9MCl0aHJvdyJhYm9ydCI7dC5zZXQoJGUsLS1uKX10LnNldChVZSwrK2UpfWZ1bmN0aW9uIEl0KCl7dGhpcy5kYXRhPW5ldyBifUl0LnByb3RvdHlwZS5nZXQ9ZnVuY3Rpb24odCl7dmFyIGU9WHQodCksbj10aGlzLmRhdGEuZ2V0KHQpO3JldHVybiBlJiZudWxsPT1uJiYobj1mKGUuZGVmYXVsdFZhbHVlKT9lLmRlZmF1bHRWYWx1ZSgpOmUuZGVmYXVsdFZhbHVlKSxlJiZlLlo/ZS5aKHRoaXMsdCxuKTpufTt2YXIgUHQ9ZnVuY3Rpb24odCxlKXtyZXR1cm4gbnVsbD09KHQ9dC5nZXQoZSkpPyIiOiIiK3R9LE10PWZ1bmN0aW9uKHQsZSl7cmV0dXJuIG51bGw9PSh0PXQuZ2V0KGUpKXx8IiI9PT10PzA6TnVtYmVyKHQpfTtJdC5wcm90b3R5cGUuWj1mdW5jdGlvbih0KXtyZXR1cm4odD10aGlzLmdldCh0KSkmJmYodCk/dDpUfSxJdC5wcm90b3R5cGUuc2V0PWZ1bmN0aW9uKHQsZSxuKXtpZih0KWlmKCJvYmplY3QiPT10eXBlb2YgdClmb3IodmFyIHIgaW4gdCl0Lmhhc093blByb3BlcnR5KHIpJiYkdCh0aGlzLHIsdFtyXSxuKTtlbHNlICR0KHRoaXMsdCxlLG4pfTtmdW5jdGlvbiBEdCh0LGUsbixyLGEpe3JldHVybiB0PW5ldyBGdCh0LGUsbixyLGEpLEd0LnNldCh0Lm5hbWUsdCksdC5uYW1lfWZ1bmN0aW9uIHF0KHQsZSl7VnQucHVzaChbbmV3IFJlZ0V4cCgiXiIrdCsiJCIpLGVdKX1mdW5jdGlvbiBVdCh0LGUsbil7cmV0dXJuIER0KHQsZSxuLHZvaWQgMCxIdCl9ZnVuY3Rpb24gSHQoKXt9dmFyICR0PWZ1bmN0aW9uKHQsZSxuLHIpe251bGwhPW4mJmU9PT12biYmYWEudGVzdChuKTt2YXIgYT1YdChlKTthJiZhLm8/YS5vKHQsZSxuLHIpOnQuZGF0YS5zZXQoZSxuLHIpfSxHdD1uZXcgYixWdD1bXSxGdD1mdW5jdGlvbih0LGUsbixyLGEpe3RoaXMubmFtZT10LHRoaXMuRj1lLHRoaXMuWj1yLHRoaXMubz1hLHRoaXMuZGVmYXVsdFZhbHVlPW59LFh0PWZ1bmN0aW9uKHQpe3ZhciBlPUd0LmdldCh0KTtpZighZSlmb3IodmFyIG49MDtuPFZ0Lmxlbmd0aDtuKyspe3ZhciByPVZ0W25dLGE9clswXS5leGVjKHQpO2lmKGEpe2U9clsxXShhKSxHdC5zZXQoZS5uYW1lLGUpO2JyZWFrfX1yZXR1cm4gZX0sQnQ9VXQoImFwaVZlcnNpb24iLCJ2IiksenQ9VXQoImNsaWVudFZlcnNpb24iLCJfdiIpO0R0KCJhbm9ueW1pemVJcCIsImFpcCIpO3ZhciBLdD1EdCgiYWRTZW5zZUlkIiwiYSIpLFd0PUR0KCJoaXRUeXBlIiwidCIpLFp0PUR0KCJoaXRDYWxsYmFjayIpLFl0PUR0KCJoaXRQYXlsb2FkIik7RHQoIm5vbkludGVyYWN0aW9uIiwibmkiKSxEdCgiY3VycmVuY3lDb2RlIiwiY3UiKSxEdCgiZGF0YVNvdXJjZSIsImRzIik7dmFyIEp0PUR0KCJ1c2VCZWFjb24iLHZvaWQgMCwhMSksUXQ9RHQoInRyYW5zcG9ydCIpO0R0KCJzZXNzaW9uQ29udHJvbCIsInNjIiwiIiksRHQoInNlc3Npb25Hcm91cCIsInNnIiksRHQoInF1ZXVlVGltZSIsInF0Iik7dmFyIHRlPUR0KCJfcyIsIl9zIik7RHQoInNjcmVlbk5hbWUiLCJjZCIpO3ZhciBlZT1EdCgibG9jYXRpb24iLCJkbCIsIiIpLG5lPUR0KCJyZWZlcnJlciIsImRyIikscmU9RHQoInBhZ2UiLCJkcCIsIiIpO0R0KCJob3N0bmFtZSIsImRoIik7dmFyIGFlPUR0KCJsYW5ndWFnZSIsInVsIiksb2U9RHQoImVuY29kaW5nIiwiZGUiKTtEdCgidGl0bGUiLCJkdCIsZnVuY3Rpb24oKXtyZXR1cm4gUC50aXRsZXx8dm9pZCAwfSkscXQoImNvbnRlbnRHcm91cChbMC05XSspIixmdW5jdGlvbih0KXtyZXR1cm4gbmV3IEZ0KHRbMF0sImNnIit0WzFdKX0pO3ZhciBpZT1EdCgic2NyZWVuQ29sb3JzIiwic2QiKSxzZT1EdCgic2NyZWVuUmVzb2x1dGlvbiIsInNyIiksY2U9RHQoInZpZXdwb3J0U2l6ZSIsInZwIiksdWU9RHQoImphdmFFbmFibGVkIiwiamUiKSxsZT1EdCgiZmxhc2hWZXJzaW9uIiwiZmwiKTtEdCgiY2FtcGFpZ25JZCIsImNpIiksRHQoImNhbXBhaWduTmFtZSIsImNuIiksRHQoImNhbXBhaWduU291cmNlIiwiY3MiKSxEdCgiY2FtcGFpZ25NZWRpdW0iLCJjbSIpLER0KCJjYW1wYWlnbktleXdvcmQiLCJjayIpLER0KCJjYW1wYWlnbkNvbnRlbnQiLCJjYyIpO3ZhciBnZT1EdCgiZXZlbnRDYXRlZ29yeSIsImVjIiksaGU9RHQoImV2ZW50QWN0aW9uIiwiZWEiKSxmZT1EdCgiZXZlbnRMYWJlbCIsImVsIiksZGU9RHQoImV2ZW50VmFsdWUiLCJldiIpLHBlPUR0KCJzb2NpYWxOZXR3b3JrIiwic24iKSx2ZT1EdCgic29jaWFsQWN0aW9uIiwic2EiKSxtZT1EdCgic29jaWFsVGFyZ2V0Iiwic3QiKSxiZT1EdCgibDEiLCJwbHQiKSx3ZT1EdCgibDIiLCJwZHQiKSx5ZT1EdCgibDMiLCJkbnMiKSxfZT1EdCgibDQiLCJycnQiKSxPZT1EdCgibDUiLCJzcnQiKSxFZT1EdCgibDYiLCJ0Y3AiKSxUZT1EdCgibDciLCJkaXQiKSx4ZT1EdCgibDgiLCJjbHQiKSxrZT1EdCgibDkiLCJfZ3N0IiksU2U9RHQoImwxMCIsIl9nYnQiKSxDZT1EdCgibDExIiwiX2NzdCIpLGplPUR0KCJsMTIiLCJfY2J0IiksdD1EdCgidGltaW5nQ2F0ZWdvcnkiLCJ1dGMiKSxOZT1EdCgidGltaW5nVmFyIiwidXR2IiksUmU9RHQoInRpbWluZ0xhYmVsIiwidXRsIiksQWU9RHQoInRpbWluZ1ZhbHVlIiwidXR0Iik7RHQoImFwcE5hbWUiLCJhbiIpLER0KCJhcHBWZXJzaW9uIiwiYXYiLCIiKSxEdCgiYXBwSWQiLCJhaWQiLCIiKSxEdCgiYXBwSW5zdGFsbGVySWQiLCJhaWlkIiwiIiksRHQoImV4RGVzY3JpcHRpb24iLCJleGQiKSxEdCgiZXhGYXRhbCIsImV4ZiIpO3ZhciBMZT1EdCgiZXhwSWQiLCJ4aWQiKSxJZT1EdCgiZXhwVmFyIiwieHZhciIpLFBlPUR0KCJleHAiLCJleHAiKSxNZT1EdCgiX3V0bWEiLCJfdXRtYSIpLERlPUR0KCJfdXRteiIsIl91dG16IikscWU9RHQoIl91dG1odCIsIl91dG1odCIpLFVlPUR0KCJfaGMiLHZvaWQgMCwwKSxIZT1EdCgiX3RpIix2b2lkIDAsMCksJGU9RHQoIl90byIsdm9pZCAwLDIwKTtxdCgiZGltZW5zaW9uKFswLTldKykiLGZ1bmN0aW9uKHQpe3JldHVybiBuZXcgRnQodFswXSwiY2QiK3RbMV0pfSkscXQoIm1ldHJpYyhbMC05XSspIixmdW5jdGlvbih0KXtyZXR1cm4gbmV3IEZ0KHRbMF0sImNtIit0WzFdKX0pLER0KCJsaW5rZXJQYXJhbSIsdm9pZCAwLHZvaWQgMCxmdW5jdGlvbih0KXtpZih0LmdldChHZSkpcmV0dXJuIGcoMzUpLGtyLmdlbmVyYXRlKE1yKHQpKTt2YXIgZT1QdCh0LGhuKSxuPVB0KHQsUm4pfHwiIjtyZXR1cm4gZT0iX2dhPTIuIit4KE5yKG4rZSwwKSsiLiIrbisiLSIrZSksdD0odD1Ecih0KSk/KGcoNDQpLCImX2dhYz0xLiIreChbTnIodC5xYSwwKSx0LnRpbWVzdGFtcCx0LnFhXS5qb2luKCIuIikpKToiIixlK3R9LEh0KTt2YXIgR2U9VXQoIl9jZDJsIix2b2lkIDAsITEpLFZlPUR0KCJ1c2FnZSIsIl91IiksRmU9RHQoIl91bSIpO0R0KCJmb3JjZVNTTCIsdm9pZCAwLHZvaWQgMCxmdW5jdGlvbigpe3JldHVybiBsfSxmdW5jdGlvbih0LGUsbil7ZygzNCksbD0hIW59KTt2YXIgWGU9RHQoIl9qMSIsImppZCIpLEJlPUR0KCJfajIiLCJnamlkIik7cXQoIlxcJiguKikiLGZ1bmN0aW9uKHQpe3ZhciBuLHIsZT1uZXcgRnQodFswXSx0WzFdKSxhPShuPXRbMF0uc3Vic3RyaW5nKDEpLEd0Lm1hcChmdW5jdGlvbih0LGUpe2UuRj09biYmKHI9ZSl9KSxyJiZyLm5hbWUpO3JldHVybiBhJiYoZS5aPWZ1bmN0aW9uKHQpe3JldHVybiB0LmdldChhKX0sZS5vPWZ1bmN0aW9uKHQsZSxuLHIpe3Quc2V0KGEsbixyKX0sZS5GPXZvaWQgMCksZX0pO3ZhciB6ZT1VdCgiX29vdCIpLEtlPUR0KCJwcmV2aWV3VGFzayIpLFdlPUR0KCJjaGVja1Byb3RvY29sVGFzayIpLFplPUR0KCJ2YWxpZGF0aW9uVGFzayIpLFllPUR0KCJjaGVja1N0b3JhZ2VUYXNrIiksSmU9RHQoImhpc3RvcnlJbXBvcnRUYXNrIiksUWU9RHQoInNhbXBsZXJUYXNrIiksdG49RHQoIl9ybHQiKSxlbj1EdCgiYnVpbGRIaXRUYXNrIiksbm49RHQoInNlbmRIaXRUYXNrIikscm49RHQoImNlVGFzayIpLGFuPUR0KCJkZXZJZFRhc2siKSxvbj1EdCgidGltaW5nVGFzayIpLHNuPUR0KCJkaXNwbGF5RmVhdHVyZXNUYXNrIiksY249RHQoImN1c3RvbVRhc2siKSx1bj1EdCgiZnBzQ3Jvc3NEb21haW5UYXNrIiksbG49VXQoIl9jdGEiKSxnbj1VdCgibmFtZSIpLGhuPVV0KCJjbGllbnRJZCIsImNpZCIpLGZuPVV0KCJjbGllbnRJZFRpbWUiKSxkbj1VdCgic3RvcmVkQ2xpZW50SWQiKSxwbj1EdCgidXNlcklkIiwidWlkIiksdm49VXQoInRyYWNraW5nSWQiLCJ0aWQiKSxtbj1VdCgiY29va2llTmFtZSIsdm9pZCAwLCJfZ2EiKSxibj1VdCgiY29va2llRG9tYWluIiksd249VXQoImNvb2tpZVBhdGgiLHZvaWQgMCwiLyIpLHluPVV0KCJjb29raWVFeHBpcmVzIix2b2lkIDAsNjMwNzJlMyksX249VXQoImNvb2tpZVVwZGF0ZSIsdm9pZCAwLCEwKSxPbj1VdCgiY29va2llRmxhZ3MiLHZvaWQgMCwiIiksRW49VXQoImxlZ2FjeUNvb2tpZURvbWFpbiIpLFRuPVV0KCJsZWdhY3lIaXN0b3J5SW1wb3J0Iix2b2lkIDAsITApLHhuPVV0KCJzdG9yYWdlIix2b2lkIDAsImNvb2tpZSIpLGtuPVV0KCJhbGxvd0xpbmtlciIsdm9pZCAwLCExKSxTbj1VdCgiYWxsb3dBbmNob3IiLHZvaWQgMCwhMCksQ249VXQoInNhbXBsZVJhdGUiLCJzZiIsMTAwKSxqbj1VdCgic2l0ZVNwZWVkU2FtcGxlUmF0ZSIsdm9pZCAwLDEpLE5uPVV0KCJhbHdheXNTZW5kUmVmZXJyZXIiLHZvaWQgMCwhMSksUm49VXQoIl9naWQiLCJfZ2lkIiksQW49VXQoIl9nY24iKSxMbj1VdCgidXNlQW1wQ2xpZW50SWQiKSxJbj1VdCgiX2djbGlkIiksUG49VXQoIl9ndCIpLE1uPVV0KCJfZ2UiLHZvaWQgMCw3Nzc2ZTYpLERuPVV0KCJfZ2Nsc3JjIikscW49VXQoInN0b3JlR2FjIix2b2lkIDAsITApLFVuPUR0KCJfeF8xOSIpLEhuPUR0KCJfZnBsYyIsIl9mcGxjIiksJG49VXQoIl9jcyIpLEduPVV0KCJfdXNlVXAiLHZvaWQgMCwhMSksVm49RHQoInVwIiwidXAiKSxGbj1EdCgiX3RhYyIsdm9pZCAwLCExKSxYbj1VdCgiX2dicmFpZCIpLEJuPVV0KCJfZ2J0Iiksem49VXQoIl9nYmUiLHZvaWQgMCw3Nzc2ZTYpLEtuPUR0KCJ0cmFuc3BvcnRVcmwiKSxXbj1EdCgiX3IiLCJfciIpLFpuPUR0KCJfc2xjIiwiX3NsYyIpLFluPUR0KCJfZHAiKSxKbj1EdCgiX2p0Iix2b2lkIDAsIm4iKSxRbj1EdCgiYWxsb3dBZEZlYXR1cmVzIix2b2lkIDAsITApLHRyPUR0KCJhbGxvd0FkUGVyc29uYWxpemF0aW9uU2lnbmFscyIsdm9pZCAwLCEwKTtmdW5jdGlvbiBlcihlLHQsbixyKXt0W2VdPWZ1bmN0aW9uKCl7dHJ5e3JldHVybiByJiZnKHIpLG4uYXBwbHkodGhpcyxhcmd1bWVudHMpfWNhdGNoKHQpe3Rocm93IGJ0KCJleGMiLGUsdCYmdC5uYW1lKSx0fX19ZnVuY3Rpb24gbnIodCl7dmFyIGU7KGU9KGU9UHQodCxVbikmJnQuZ2V0KEdlKSk/ISgoZT1rci5nZXQodC5nZXQoU24pKSkmJmUuX2ZwbGMpOmUpJiYhY3IodCkmJnQuc2V0KEhuLCIwIil9ZnVuY3Rpb24gcnIodCxlKXt2YXIgbj10W2VdOyhpc05hTihuKXx8MS8wPT1ufHxuPDApJiYodFtlXT12b2lkIDApfWZ1bmN0aW9uIGFyKHQpe2lmKCJjb29raWUiPT1QdCh0LHhuKSYmIWdyJiYoaHIodCksIWdyKSl0aHJvdyJhYm9ydCJ9ZnVuY3Rpb24gb3IodCl7dmFyIGUsbixyO3QuZ2V0KFRuKSYmKGU9UHQodCxibiksKHI9RXIoIl9fdXRtYSIsbj1QdCh0LEVuKXx8QSgpLGUpKSYmKGcoMTkpLHQuc2V0KHFlLChuZXcgRGF0ZSkuZ2V0VGltZSgpLCEwKSx0LnNldChNZSxyLlIpLChlPUVyKCJfX3V0bXoiLG4sZSkpJiZyLmhhc2g9PWUuaGFzaCYmdC5zZXQoRGUsZS5SKSkpfWZ1bmN0aW9uIGlyKHQsZSl7ZT1HKFB0KHQsZSkpO3ZhciBuPWJyKFB0KHQsYm4pKS5zcGxpdCgiLiIpLmxlbmd0aDtyZXR1cm4gMTwodD15cihQdCh0LHduKSkpJiYobis9Ii0iK3QpLGU/WyJHQTEiLG4sZV0uam9pbigiLiIpOiIifWZ1bmN0aW9uIHNyKCl7dmFyIHQ9W10sZT1BKCkuc3BsaXQoIi4iKTtpZig0PT1lLmxlbmd0aCl7dmFyIG49ZVtlLmxlbmd0aC0xXTtpZihwYXJzZUludChuLDEwKT09bilyZXR1cm5bIm5vbmUiXX1mb3Iobj1lLmxlbmd0aC0yOzA8PW47bi0tKXQucHVzaChlLnNsaWNlKG4pLmpvaW4oIi4iKSk7cmV0dXJuIGU9UC5sb2NhdGlvbi5ob3N0bmFtZSxGLnRlc3QoZSl8fFYudGVzdChlKXx8dC5wdXNoKCJub25lIiksdH12YXIgY3I9ZnVuY3Rpb24odCl7aWYoImNvb2tpZSI9PXQuZ2V0KHhuKSlyZXR1cm4gMDwodD1IKCJGUExDIikpLmxlbmd0aD90WzBdOnZvaWQgMH0sdXI9ZnVuY3Rpb24odCl7dmFyIGU9TWF0aC5taW4oTXQodCxqbiksMTAwKTtyZXR1cm4hKG8oUHQodCxobikpJTEwMD49ZSl9LGxyPWZ1bmN0aW9uKHQpe3ZhciBlLG49e307KGZ1bmN0aW9uKHQpe3ZhciBlPUkucGVyZm9ybWFuY2V8fEkud2Via2l0UGVyZm9ybWFuY2UsZTtpZighKGU9ZSYmZS50aW1pbmcpKXJldHVybiExO3ZhciBuPWUubmF2aWdhdGlvblN0YXJ0O3JldHVybiAwPT1uPyExOih0W2JlXT1lLmxvYWRFdmVudFN0YXJ0LW4sdFt5ZV09ZS5kb21haW5Mb29rdXBFbmQtZS5kb21haW5Mb29rdXBTdGFydCx0W0VlXT1lLmNvbm5lY3RFbmQtZS5jb25uZWN0U3RhcnQsdFtPZV09ZS5yZXNwb25zZVN0YXJ0LWUucmVxdWVzdFN0YXJ0LHRbd2VdPWUucmVzcG9uc2VFbmQtZS5yZXNwb25zZVN0YXJ0LHRbX2VdPWUuZmV0Y2hTdGFydC1uLHRbVGVdPWUuZG9tSW50ZXJhY3RpdmUtbix0W3hlXT1lLmRvbUNvbnRlbnRMb2FkZWRFdmVudFN0YXJ0LW4sdFtrZV09a2EuTC1uLHRbU2VdPWthLnlhLW4sSS5nb29nbGVfdGFnX21hbmFnZXImJkkuZ29vZ2xlX3RhZ19tYW5hZ2VyLl9saSYmKGU9SS5nb29nbGVfdGFnX21hbmFnZXIuX2xpLHRbQ2VdPWUuY3N0LHRbamVdPWUuY2J0KSwhMCl9KG4pfHxmdW5jdGlvbih0KXtpZihJLnRvcCE9SSlyZXR1cm4hMTt2YXIgZT1JLmV4dGVybmFsLG49ZSYmZS5vbmxvYWRUO3JldHVybigwPChuPTIxNDc0ODM2NDg8KG49ZSYmIWUuaXNWYWxpZExvYWRUaW1lP3ZvaWQgMDpuKT92b2lkIDA6bikmJmUuc2V0UGFnZVJlYWR5VGltZSgpLG51bGw9PW4pPyExOih0W2JlXT1uLCEwKX0obikpJiYobnVsbD09KGU9bltiZV0pfHwxLzA9PWV8fGlzTmFOKGUpfHwoMDxlPyhycihuLHllKSxycihuLEVlKSxycihuLE9lKSxycihuLHdlKSxycihuLF9lKSxycihuLFRlKSxycihuLHhlKSxycihuLGtlKSxycihuLFNlKSxycihuLENlKSxycihuLGplKSxNKGZ1bmN0aW9uKCl7dChuKX0sMTApKTpwKEksImxvYWQiLGZ1bmN0aW9uKCl7bHIodCl9LCExKSkpfSxncj0hMSxocj1mdW5jdGlvbih0KXt2YXIgZSxuLHIsYSxvLGkscyxjLHU7ImNvb2tpZSI9PVB0KHQseG4pJiYoIXQuZ2V0KF9uKSYmUHQodCxkbik9PVB0KHQsaG4pfHwoZT0xZTMqTXQodCx5biksZnIodCxobixtbixlKSx0LmRhdGEuc2V0KGRuLFB0KHQsaG4pKSksIXQuZ2V0KF9uKSYmZHIodCk9PVB0KHQsUm4pfHxmcih0LFJuLEFuLDg2NGU1KSx0LmdldChxbik/KGU9UHQodCxJbikpJiYobj0wPT09KG49TWF0aC5taW4oTXQodCxNbiksMWUzKk10KHQseW4pKSk/MDpNYXRoLm1pbihuLDFlMypNdCh0LFBuKStuLShuZXcgRGF0ZSkuZ2V0VGltZSgpKSx0LmRhdGEuc2V0KE1uLG4pLHI9e30sYT1QdCh0LFBuKSxvPVB0KHQsRG4pLGk9d3IoUHQodCx3bikpLHM9YnIoUHQodCxibikpLGM9UHQodCx2biksdT1QdCh0LE9uKSxvJiYiYXcuZHMiIT1vP3ImJihyLnVhPSEwKTooZT1bIjEiLGEsRyhlKV0uam9pbigiLiIpLDA8PW4mJihyJiYoci50YT0hMCksJCgiX2dhY18iK0coYyksZSxpLHMsYyxuLHUpKSksX3IocikpOmcoNzUpLHQuZ2V0KHFuKSYmKGU9UHQodCxYbikpJiYobj0wPT09KG49TWF0aC5taW4oTXQodCx6biksMWUzKk10KHQseW4pKSk/MDpNYXRoLm1pbihuLDFlMypNdCh0LEJuKStuLShuZXcgRGF0ZSkuZ2V0VGltZSgpKSx0LmRhdGEuc2V0KHpuLG4pLHI9e30sdT1QdCh0LEJuKSxpPXdyKFB0KHQsd24pKSxzPWJyKFB0KHQsYm4pKSxjPVB0KHQsdm4pLHQ9UHQodCxPbiksZT1bIjEiLHUsRyhlKV0uam9pbigiLiIpLDA8PW4mJihyJiYoci50YT0hMCksJCgiX2dhY19nYl8iK0coYyksZSxpLHMsYyxuLHQpKSxPcihyKSkpfSxmcj1mdW5jdGlvbih0LGUsbixyKXt2YXIgYT1pcih0LGUpO2lmKGEpe249UHQodCxuKTt2YXIgbz13cihQdCh0LHduKSksaT1icihQdCh0LGJuKSkscz1QdCh0LE9uKSxjPVB0KHQsdm4pO2lmKCJhdXRvIiE9aSkkKG4sYSxvLGksYyxyLHMpJiYoZ3I9ITApO2Vsc2V7ZygzMik7Zm9yKHZhciB1PXNyKCksbD0wO2w8dS5sZW5ndGg7bCsrKWlmKGk9dVtsXSx0LmRhdGEuc2V0KGJuLGkpLGE9aXIodCxlKSwkKG4sYSxvLGksYyxyLHMpKXJldHVybiB2b2lkKGdyPSEwKTt0LmRhdGEuc2V0KGJuLCJhdXRvIil9fX0sZHI9ZnVuY3Rpb24odCl7dmFyIGU9SChQdCh0LEFuKSk7cmV0dXJuIHByKHQsZSl9LHByPWZ1bmN0aW9uKHQsZSl7cmV0dXJuIHZyKGUsUHQodCxibiksUHQodCx3bikpfSx2cj1mdW5jdGlvbih0LGUsbil7aWYodCYmISh0Lmxlbmd0aDwxKSl7Zm9yKHZhciByPVtdLGE9MDthPHQubGVuZ3RoO2ErKyl7dmFyIG89dFthXSxpPW8uc3BsaXQoIi4iKSxzPWkuc2hpZnQoKTsoaT0oIkdBMSI9PXN8fCIxIj09cykmJjE8aS5sZW5ndGg/KDE9PShvPWkuc2hpZnQoKS5zcGxpdCgiLSIpKS5sZW5ndGgmJihvWzFdPSIxIiksb1swXSo9MSxvWzFdKj0xLHtIOm8sczppLmpvaW4oIi4iKX0pOnUudGVzdChvKT97SDpbMCwwXSxzOm99OnZvaWQgMCkmJnIucHVzaChpKX1yZXR1cm4gMT09ci5sZW5ndGg/KGcoMTMpLHJbMF0ucyk6MCE9ci5sZW5ndGg/KGcoMTQpLDE9PShyPW1yKHIsYnIoZSkuc3BsaXQoIi4iKS5sZW5ndGgsMCkpLmxlbmd0aD9yWzBdLnM6KDE8KHI9bXIocix5cihuKSwxKSkubGVuZ3RoJiZnKDQxKSxyWzBdJiZyWzBdLnMpKTp2b2lkIGcoMTIpfWcoMTIpfSxtcj1mdW5jdGlvbih0LGUsbil7Zm9yKHZhciByLGE9W10sbz1bXSxpPTA7aTx0Lmxlbmd0aDtpKyspe3ZhciBzPXRbaV07cy5IW25dPT1lP2EucHVzaChzKTpudWxsPT1yfHxzLkhbbl08cj8obz1bc10scj1zLkhbbl0pOnMuSFtuXT09ciYmby5wdXNoKHMpfXJldHVybiAwPGEubGVuZ3RoP2E6b30sYnI9ZnVuY3Rpb24odCl7cmV0dXJuIDA9PXQuaW5kZXhPZigiLiIpP3Quc3Vic3RyKDEpOnR9LHdyPWZ1bmN0aW9uKHQpe3JldHVybiB0PzAhPSh0PTE8dC5sZW5ndGgmJnQubGFzdEluZGV4T2YoIi8iKT09dC5sZW5ndGgtMT90LnN1YnN0cigwLHQubGVuZ3RoLTEpOnQpLmluZGV4T2YoIi8iKT8iLyIrdDp0OiIvIn0seXI9ZnVuY3Rpb24odCl7cmV0dXJuIi8iPT0odD13cih0KSk/MTp0LnNwbGl0KCIvIikubGVuZ3RofSxfcj1mdW5jdGlvbih0KXt0LnRhJiZnKDc3KSx0Lm5hJiZnKDc0KSx0LnBhJiZnKDczKSx0LnVhJiZnKDY5KX0sT3I9ZnVuY3Rpb24odCl7dC50YSYmZyg4NSksdC5uYSYmZyg4NiksdC5wYSYmZyg4Nyl9O2Z1bmN0aW9uIEVyKHQsZSxuKXsibm9uZSI9PWUmJihlPSIiKTt2YXIgcj1bXSxhPUgodCk7dD0iX191dG1hIj09dD82OjI7Zm9yKHZhciBvPTA7bzxhLmxlbmd0aDtvKyspe3ZhciBpPSgiIithW29dKS5zcGxpdCgiLiIpO2kubGVuZ3RoPj10JiZyLnB1c2goe2hhc2g6aVswXSxSOmFbb10sTzppfSl9aWYoMCE9ci5sZW5ndGgpcmV0dXJuIDEhPXIubGVuZ3RoJiYoVHIoZSxyKXx8VHIobixyKXx8VHIobnVsbCxyKSl8fHJbMF19ZnVuY3Rpb24gVHIodCxlKXt2YXIgbjtudWxsPT10P249dD0xOihuPW8odCksdD1vKE8odCwiLiIpP3Quc3Vic3RyaW5nKDEpOiIuIit0KSk7Zm9yKHZhciByPTA7cjxlLmxlbmd0aDtyKyspaWYoZVtyXS5oYXNoPT1ufHxlW3JdLmhhc2g9PXQpcmV0dXJuIGVbcl19dmFyIHhyPW5ldyBSZWdFeHAoL15odHRwcz86XC9cLyhbXlwvOl0rKS8pLGtyPUkuZ29vZ2xlX3RhZ19kYXRhLmdsQnJpZGdlLFNyPVJlZ0V4cCgiKC4qKShbPyYjXSkoPzpfZ2E9W14mI10qKSg/OiY/KSguKikiKSxDcj1SZWdFeHAoIiguKikoWz8mI10pKD86X2dhYz1bXiYjXSopKD86Jj8pKC4qKSIpO2Z1bmN0aW9uIGpyKHQsZSl7dmFyIG49bmV3IERhdGUscj1JLm5hdmlnYXRvcixhPXIucGx1Z2luc3x8W107Zm9yKHQ9W3Qsci51c2VyQWdlbnQsbi5nZXRUaW1lem9uZU9mZnNldCgpLG4uZ2V0WWVhcigpLG4uZ2V0RGF0ZSgpLG4uZ2V0SG91cnMoKSxuLmdldE1pbnV0ZXMoKStlXSxlPTA7ZTxhLmxlbmd0aDsrK2UpdC5wdXNoKGFbZV0uZGVzY3JpcHRpb24pO3JldHVybiBvKHQuam9pbigiLiIpKX1mdW5jdGlvbiBOcih0LGUpe3ZhciBuPW5ldyBEYXRlLHI9SS5uYXZpZ2F0b3IsYT1uLmdldEhvdXJzKCkrTWF0aC5mbG9vcigobi5nZXRNaW51dGVzKCkrZSkvNjApO3JldHVybiBvKFt0LHIudXNlckFnZW50LHIubGFuZ3VhZ2V8fCIiLG4uZ2V0VGltZXpvbmVPZmZzZXQoKSxuLmdldFllYXIoKSxuLmdldERhdGUoKStNYXRoLmZsb29yKGEvMjQpLCgyNCthKSUyNCwoNjArbi5nZXRNaW51dGVzKCkrZSklNjBdLmpvaW4oIi4iKSl9ZnVuY3Rpb24gUnIodCl7Zyg0OCksdGhpcy50YXJnZXQ9dCx0aGlzLlQ9ITF9UnIucHJvdG90eXBlLmNhPWZ1bmN0aW9uKHQsZSl7aWYodCl7aWYodGhpcy50YXJnZXQuZ2V0KEdlKSlyZXR1cm4ga3IuZGVjb3JhdGUoTXIodGhpcy50YXJnZXQpLHQsZSk7aWYodC50YWdOYW1lKXtpZigiYSI9PXQudGFnTmFtZS50b0xvd2VyQ2FzZSgpKXJldHVybiB2b2lkKHQuaHJlZiYmKHQuaHJlZj1Bcih0aGlzLHQuaHJlZixlKSkpO2lmKCJmb3JtIj09dC50YWdOYW1lLnRvTG93ZXJDYXNlKCkpcmV0dXJuIExyKHRoaXMsdCl9cmV0dXJuInN0cmluZyI9PXR5cGVvZiB0P0FyKHRoaXMsdCxlKTp2b2lkIDB9fTt2YXIgQXI9ZnVuY3Rpb24odCxlLG4peyhyPVNyLmV4ZWMoZSkpJiYzPD1yLmxlbmd0aCYmKGU9clsxXSsoclszXT9yWzJdK3JbM106IiIpKSwocj1Dci5leGVjKGUpKSYmMzw9ci5sZW5ndGgmJihlPXJbMV0rKHJbM10/clsyXStyWzNdOiIiKSksdD10LnRhcmdldC5nZXQoImxpbmtlclBhcmFtIik7dmFyIHI9ZS5pbmRleE9mKCI/IiksYT1lLmluZGV4T2YoIiMiKTtyZXR1cm4oZT0oZT1uP2UrKC0xPT1hPyIjIjoiJiIpK3Q6LTE9PWE/ZSsoLTE9PT1yPyI/IjoiJiIpK3Q6ZS5zdWJzdHJpbmcoMCxhKSsoLTE9PT1yfHxhPHI/Ij8iOiImIikrdCtlLnN1YnN0cmluZyhhKSkucmVwbGFjZSgvJitfZ2E9LywiJl9nYT0iKSkucmVwbGFjZShSZWdFeHAoIiYrX2dhYz0iKSwiJl9nYWM9Iil9LExyPWZ1bmN0aW9uKHQsZSl7aWYoZSYmZS5hY3Rpb24paWYoImdldCI9PWUubWV0aG9kLnRvTG93ZXJDYXNlKCkpe3Q9dC50YXJnZXQuZ2V0KCJsaW5rZXJQYXJhbSIpLnNwbGl0KCImIik7Zm9yKHZhciBuPTA7bjx0Lmxlbmd0aDtuKyspe2Zvcih2YXIgcj0oYT10W25dLnNwbGl0KCI9IikpWzFdLGE9YVswXSxvPWUuY2hpbGROb2Rlc3x8W10saT0hMSxzPTA7czxvLmxlbmd0aDtzKyspaWYob1tzXS5uYW1lPT1hKXtvW3NdLnNldEF0dHJpYnV0ZSgidmFsdWUiLHIpLGk9ITA7YnJlYWt9aXx8KChvPVAuY3JlYXRlRWxlbWVudCgiaW5wdXQiKSkuc2V0QXR0cmlidXRlKCJ0eXBlIiwiaGlkZGVuIiksby5zZXRBdHRyaWJ1dGUoIm5hbWUiLGEpLG8uc2V0QXR0cmlidXRlKCJ2YWx1ZSIsciksZS5hcHBlbmRDaGlsZChvKSl9fWVsc2UicG9zdCI9PWUubWV0aG9kLnRvTG93ZXJDYXNlKCkmJihlLmFjdGlvbj1Bcih0LGUuYWN0aW9uKSl9O2Z1bmN0aW9uIElyKHQsZSl7aWYoZSE9UC5sb2NhdGlvbi5ob3N0bmFtZSlmb3IodmFyIG49MDtuPHQubGVuZ3RoO24rKylpZih0W25daW5zdGFuY2VvZiBSZWdFeHApe2lmKHRbbl0udGVzdChlKSlyZXR1cm4gMX1lbHNlIGlmKDA8PWUuaW5kZXhPZih0W25dKSlyZXR1cm4gMX1mdW5jdGlvbiBQcih0LGUpe3JldHVybiBlIT1qcih0LDApJiZlIT1qcih0LC0xKSYmZSE9anIodCwtMikmJmUhPU5yKHQsMCkmJmUhPU5yKHQsLTEpJiZlIT1Ocih0LC0yKX1mdW5jdGlvbiBNcih0KXt2YXIgZT1Ecih0KSxuPXt9O3JldHVybiBuLl9nYT10LmdldChobiksbi5fZ2lkPXQuZ2V0KFJuKXx8dm9pZCAwLG4uX2dhYz1lP1tlLnFhLGUudGltZXN0YW1wXS5qb2luKCIuIik6dm9pZCAwLGU9dC5nZXQoSG4pLHQ9Y3IodCksbi5fZnBsYz1lJiYiMCIhPT1lP2U6dCxufWZ1bmN0aW9uIERyKHQpe2Z1bmN0aW9uIGUodCl7cmV0dXJuIG51bGw9PXR8fCIiPT09dD8wOk51bWJlcih0KX12YXIgbj10LmdldChJbik7aWYobiYmdC5nZXQocW4pKXt2YXIgcj1lKHQuZ2V0KFBuKSk7aWYoISgxZTMqcitlKHQuZ2V0KE1uKSk8PShuZXcgRGF0ZSkuZ2V0VGltZSgpKSlyZXR1cm57dGltZXN0YW1wOnIscWE6bn07Zyg3Nil9fVJyLnByb3RvdHlwZS5TPWZ1bmN0aW9uKHIsYSx0KXtmdW5jdGlvbiBlKHQpe3RyeXt0PXR8fEkuZXZlbnQ7dDp7dmFyIGU9dC50YXJnZXR8fHQuc3JjRWxlbWVudDtmb3IodD0xMDA7ZSYmMDx0Oyl7aWYoZS5ocmVmJiZlLm5vZGVOYW1lLm1hdGNoKC9eYSg/OnJlYSk/JC9pKSl7dmFyIG49ZTticmVhayB0fWU9ZS5wYXJlbnROb2RlLHQtLX1uPXt9fSgiaHR0cDoiPT1uLnByb3RvY29sfHwiaHR0cHM6Ij09bi5wcm90b2NvbCkmJklyKHIsbi5ob3N0bmFtZXx8IiIpJiZuLmhyZWYmJihuLmhyZWY9QXIobyxuLmhyZWYsYSkpfWNhdGNoKHQpe2coMjYpfX12YXIgbz10aGlzO3RoaXMudGFyZ2V0LmdldChHZSk/a3IuYXV0byhmdW5jdGlvbigpe3JldHVybiBNcihvLnRhcmdldCl9LHIsYT8iZnJhZ21lbnQiOiIiLHQpOih0aGlzLlR8fCh0aGlzLlQ9ITAscChQLCJtb3VzZWRvd24iLGUsITEpLHAoUCwia2V5dXAiLGUsITEpKSx0JiZwKFAsInN1Ym1pdCIsZnVuY3Rpb24odCl7dmFyIGU7KHQ9KHQ9dHx8SS5ldmVudCkudGFyZ2V0fHx0LnNyY0VsZW1lbnQpJiZ0LmFjdGlvbiYmKChlPXQuYWN0aW9uLm1hdGNoKHhyKSkmJklyKHIsZVsxXSkmJkxyKG8sdCkpfSkpfSxSci5wcm90b3R5cGUuJD1mdW5jdGlvbih0KXt2YXIgZSxuOyF0fHx2b2lkIDAhPT0obj0oZT10aGlzKS50YXJnZXQuZ2V0KCRuKSkmJmtyLnBhc3N0aHJvdWdoKGZ1bmN0aW9uKCl7aWYobigiYW5hbHl0aWNzX3N0b3JhZ2UiKSlyZXR1cm57fTt2YXIgdD17fTtyZXR1cm4gdC5fZ2E9ZS50YXJnZXQuZ2V0KGhuKSx0Ll91cD0iMSIsdH0sMSwhMCl9O2Z1bmN0aW9uIHFyKHQsZSxuLHIpe249bnx8e307dmFyIGE9MSxvPXtpZDplLHR5cGU6YT1Wci50ZXN0KGUpPzI6YSxCOm4uZGF0YUxheWVyfHwiZGF0YUxheWVyIixHOiExfSxpPXZvaWQgMDtyZXR1cm4gdC5nZXQoIiZndG0iKT09ZSYmKG8uRz0hMCksMT09PWE/KG8uaWE9ISF0LmdldCgiYW5vbnltaXplSXAiKSxvLnN5bmM9ciwidDAiIT0oZT1TdHJpbmcodC5nZXQoIm5hbWUiKSkpJiYoby50YXJnZXQ9ZSksVShTdHJpbmcodC5nZXQoInRyYWNraW5nSWQiKSkpfHwoby5jbGllbnRJZD1TdHJpbmcodC5nZXQoaG4pKSxvLmthPU51bWJlcih0LmdldChmbikpLG49bi5wYWxpbmRyb21lP1hyOkZyLG49KG49UC5jb29raWUucmVwbGFjZSgvXnwoOyArKS9nLCI7IikubWF0Y2gobikpP24uc29ydCgpLmpvaW4oIiIpLnN1YnN0cmluZygxKTp2b2lkIDAsby5sYT1uLG8ucWE9UihQdCh0LGVlKSwiZ2NsaWQiKSkpOjI9PT1hJiYoby5jb250ZXh0PSJjIixpPXthbGxvd19nb29nbGVfc2lnbmFsczp0LmdldChRbiksYWxsb3dfYWRfcGVyc29uYWxpemF0aW9uX3NpZ25hbHM6dC5nZXQodHIpfSksS3IobyxpKSx6cihvKX1mdW5jdGlvbiBVcih0LGUpe3ZhciBuLHI7KHQ9dC5tb2RlbCkuZ2V0KCJkY0xvYWRlZCIpfHwoKG49bmV3IGkoaCh0KSkpLnNldCgyOSksdC5zZXQoRmUsbi5DKSwoZT1lfHx7fSlbbW5dJiYocj1HKGVbbW5dKSksZnVuY3Rpb24obix0KXt2YXIgcj10LmdldChlbik7dC5zZXQoZW4sZnVuY3Rpb24odCl7WXIobix0LFhlKSxZcihuLHQsQmUpO3ZhciBlPXIodCk7cmV0dXJuIEpyKG4sdCksZX0pO3ZhciBhPXQuZ2V0KG5uKTt0LnNldChubixmdW5jdGlvbih0KXt2YXIgZSxuPWEodCk7cmV0dXJuIFFyKHQpJiYoZyg4MCksZT17VTplYSh0LDEpLGdvb2dsZTplYSh0LDIpLGNvdW50OjB9LGZ0KCJodHRwczovL3N0YXRzLmcuZG91YmxlY2xpY2submV0L2ovY29sbGVjdCIsZS5VLGUpLHQuc2V0KFhlLCIiLCEwKSksbn0pfShlPW5ldyBacih0LHIpLHQpLHQuc2V0KCJkY0xvYWRlZCIsITApKX1mdW5jdGlvbiBIcih0KXt2YXIgZSxuO3QuZ2V0KCJkY0xvYWRlZCIpfHwiY29va2llIiE9dC5nZXQoeG4pfHwoZT1uZXcgWnIodCksWXIoZSx0LFhlKSxZcihlLHQsQmUpLEpyKGUsdCksZT1Rcih0KSxuPXRhKHQpLGUmJnQuc2V0KFduLDEsITApLG4mJnQuc2V0KFpuLDEsITApLChlfHxuKSYmKHQuc2V0KEpuLCJkIiwhMCksZyg3OSksdC5zZXQoWW4se1U6ZWEodCwxKSxnb29nbGU6ZWEodCwyKSxWOm5hKHQpLGNvdW50OjB9LCEwKSkpfWZ1bmN0aW9uICRyKHQpe2Z1bmN0aW9uIG4odCxlKXtvLm1vZGVsLmRhdGEuc2V0KHQsZSl9ZnVuY3Rpb24gZSh0LGUpe24odCxlKSxvLmZpbHRlcnMuYWRkKHQpfXZhciByLGEsbz10aGlzO3RoaXMubW9kZWw9bmV3IEl0LHRoaXMuZmlsdGVycz1uZXcgUSxuKGduLHRbZ25dKSxuKHZuLChyPXRbdm5dKT9yLnJlcGxhY2UoL15bXHNceGEwXSt8W1xzXHhhMF0rJC9nLCIiKToiIiksbihtbix0W21uXSksbihibix0W2JuXXx8QSgpKSxuKHduLHRbd25dKSxuKHluLHRbeW5dKSxuKF9uLHRbX25dKSxuKE9uLHRbT25dKSxuKEVuLHRbRW5dKSxuKFRuLHRbVG5dKSxuKGtuLHRba25dKSxuKFNuLHRbU25dKSxuKENuLHRbQ25dKSxuKGpuLHRbam5dKSxuKE5uLHRbTm5dKSxuKHhuLHRbeG5dKSxuKHBuLHRbcG5dKSxuKGZuLHRbZm5dKSxuKExuLHRbTG5dKSxuKHFuLHRbcW5dKSxuKEdlLHRbR2VdKSxuKFVuLHRbVW5dKSxuKEduLHRbR25dKSxuKCRuLHRbJG5dKSxuKEJ0LDEpLG4oenQsImo5NiIpLGUobG4sTnQpLGUoemUsT3QpLGUoY24sVCksZShLZSxTdCksZShXZSxFdCksZShaZSxqdCksZShZZSxhciksZShKZSxvciksZShRZSxfdCksZSh0bixMdCksZShybixrdCksZShhbixDdCksZShzbixIciksZSh1bixuciksZShlbixUdCksZShubix4dCksZShvbiwoYT10aGlzLGZ1bmN0aW9uKHQpe3ZhciBlLG4scjsicGFnZXZpZXciIT10LmdldChXdCl8fGEuSXx8KGEuST0hMCxlPXVyKHQpLG49MDxSKFB0KHQsZWUpLCJnY2xpZCIpLmxlbmd0aCxyPTA8UihQdCh0LGVlKSwid2JyYWlkIikubGVuZ3RoLChlfHxufHxyKSYmbHIoZnVuY3Rpb24odCl7ZSYmYS5zZW5kKCJ0aW1pbmciLHQpLChufHxyKSYmYS5zZW5kKCJhZHRpbWluZyIsdCl9KSl9KSksY2EodGhpcy5tb2RlbCksc2EodGhpcy5tb2RlbCx0W2huXSksdGhpcy5tb2RlbC5zZXQoS3QsKHQ9SS5nYUdsb2JhbD1JLmdhR2xvYmFsfHx7fSkuaGlkPXQuaGlkfHxBdCgpKX12YXIgR3I9L14oR1RNfE9QVCktW0EtWjAtOV0rJC8sVnI9L15HLVtBLVowLTldKyQvLEZyPS87X2dhZXhwPVteO10qL2csWHI9LzsoKF9fdXRtYT0pfChbXjs9XSs9R0FYP1xkK1wuKSlbXjtdKi9nLEJyPS9eaHR0cHM/OlwvXC9bXHdcLS5dK1wuZ29vZ2xlLmNvbSg6XGQrKT9cL29wdGltaXplXC9vcHQtbGF1bmNoXC5odG1sXD8uKiQvLHpyPWZ1bmN0aW9uKHQpe2Z1bmN0aW9uIGUodCxlKXtlJiYobis9IiYiK3QrIj0iK3goZSkpfXZhciBuPVoodC50eXBlKSt4KHQuaWQpO3JldHVybiJkYXRhTGF5ZXIiIT10LkImJmUoImwiLHQuQiksZSgiY3giLHQuY29udGV4dCksZSgidCIsdC50YXJnZXQpLGUoImNpZCIsdC5jbGllbnRJZCksZSgiY2lkdCIsdC5rYSksZSgiZ2FjIix0LmxhKSxlKCJhaXAiLHQuaWEpLHQuc3luYyYmZSgibSIsInN5bmMiKSxlKCJjeWNsZSIsdC5HKSx0LnFhJiZlKCJnY2xpZCIsdC5xYSksQnIudGVzdChQLnJlZmVycmVyKSYmZSgiY2IiLFN0cmluZyhBdCgpKSksbn0sS3I9ZnVuY3Rpb24ocix0KXt2YXIgZT0obmV3IERhdGUpLmdldFRpbWUoKTtJW3IuQl09SVtyLkJdfHxbXSxlPXsiZ3RtLnN0YXJ0IjplfSxyLnN5bmN8fChlLmV2ZW50PSJndG0uanMiKSxJW3IuQl0ucHVzaChlKSwyPT09ci50eXBlJiZmdW5jdGlvbih0LGUsbil7SVtyLkJdLnB1c2goYXJndW1lbnRzKX0oImNvbmZpZyIsci5pZCx0KX0sV3I9e30sWnI9ZnVuY3Rpb24odCxlKXtlPWV8fCgoZT1QdCh0LGduKSkmJiJ0MCIhPWU/cmEudGVzdChlKT8iX2dhdF8iK0coUHQodCx2bikpOiJfZ2F0XyIrRyhlKToiX2dhdCIpLHRoaXMuWT1lfSxZcj1mdW5jdGlvbih0LGUsbil7ITE9PT1lLmdldChRbil8fGUuZ2V0KG4pfHwoIjEiPT1IKHQuWSlbMF0/ZS5zZXQobiwiIiwhMCk6ZS5zZXQobiwiIitBdCgpLCEwKSl9LEpyPWZ1bmN0aW9uKHQsZSl7UXIoZSkmJiQodC5ZLCIxIixQdChlLHduKSxQdChlLGJuKSxQdChlLHZuKSw2ZTQsUHQoZSxPbikpfSxRcj1mdW5jdGlvbih0KXtyZXR1cm4hIXQuZ2V0KFhlKSYmITEhPT10LmdldChRbil9LHRhPWZ1bmN0aW9uKHQpe3JldHVybiFXcltQdCh0LHZuKV0mJnZvaWQgMD09PXQuZ2V0KCImZ3RtIikmJnZvaWQgMD09PXQuZ2V0KFF0KSYmdm9pZCAwPT09dC5nZXQoS24pJiZ2b2lkIDA9PT10LmdldChVbil9LGVhPWZ1bmN0aW9uKGUsdCl7ZnVuY3Rpb24gbih0KXtYdCh0KS5GJiZyLnNldChYdCh0KS5GLGUuZ2V0KHQpKX12YXIgcj1uZXcgYjtuKEJ0KSxuKHp0KSxuKHZuKSxuKGhuKSxuKFhlKSwxPT10JiYobihwbiksbihCZSksbihSbikpLCExPT09ZS5nZXQodHIpJiZyLnNldCgibnBhIiwiMSIpLHIuc2V0KFh0KFZlKS5GLHcoZSkpO3ZhciBhPSIiO3JldHVybiByLm1hcChmdW5jdGlvbih0LGUpe2ErPXgodCkrIj0iLGErPXgoIiIrZSkrIiYifSksYSs9Ino9IitBdCgpLDE9PXQ/YT0idD1kYyZhaXA9MSZfcj0zJiIrYToyPT10JiYoYT0idD1zciZhaXA9MSZfcj00JnNsZl9yZD0xJiIrYSksYX0sbmE9ZnVuY3Rpb24obil7aWYodGEobikpcmV0dXJuIFdyW1B0KG4sdm4pXT0hMCxmdW5jdGlvbih0KXt2YXIgZTt0JiYhV3JbdF0mJihlPXFyKG4sdCksaihlKSxXclt0XT0hMCl9fSxyYT0vXmd0bVxkKyQvLGFhPS9eKFVBfFlUfE1PfEdQKS0oXGQrKS0oXGQrKSQvOyRyLnByb3RvdHlwZS5nZXQ9ZnVuY3Rpb24odCl7cmV0dXJuIHRoaXMubW9kZWwuZ2V0KHQpfSwkci5wcm90b3R5cGUuc2V0PWZ1bmN0aW9uKHQsZSl7dGhpcy5tb2RlbC5zZXQodCxlKX0sJHIucHJvdG90eXBlLnNlbmQ9ZnVuY3Rpb24odCl7dmFyIGUsbjthcmd1bWVudHMubGVuZ3RoPDF8fChuPSJzdHJpbmciPT10eXBlb2YgdD8oZT10LFtdLnNsaWNlLmNhbGwoYXJndW1lbnRzLDEpKTooZT10JiZ0W1d0XSxhcmd1bWVudHMpLGUmJigobj1tKHVhW2VdfHxbXSxuKSlbV3RdPWUsdGhpcy5tb2RlbC5zZXQobix2b2lkIDAsITApLHRoaXMuZmlsdGVycy5EKHRoaXMubW9kZWwpLHRoaXMubW9kZWwuZGF0YS5tPXt9KSl9LCRyLnByb3RvdHlwZS5tYT1mdW5jdGlvbih0LGUpe3ZhciBuPXRoaXM7bWEodCxuLGUpfHwod2EodCxmdW5jdGlvbigpe21hKHQsbixlKX0pLGJhKFN0cmluZyhuLmdldChnbikpLHQsdm9pZCAwLGUsITApKX07ZnVuY3Rpb24gb2EodCl7cmV0dXJuInByZXJlbmRlciIhPVAudmlzaWJpbGl0eVN0YXRlJiYodCgpLCEwKX1mdW5jdGlvbiBpYSh0KXtpZihmKHRbMF0pKXRoaXMudT10WzBdO2Vsc2V7dmFyIGU9bGEuZXhlYyh0WzBdKTtpZihudWxsIT1lJiY0PT1lLmxlbmd0aCYmKHRoaXMuZGE9ZVsxXXx8InQwIix0aGlzLks9ZVsyXXx8IiIsdGhpcy5tZXRob2ROYW1lPWVbM10sdGhpcy5hYT1bXS5zbGljZS5jYWxsKHQsMSksdGhpcy5LfHwodGhpcy5BPSJjcmVhdGUiPT10aGlzLm1ldGhvZE5hbWUsdGhpcy5pPSJyZXF1aXJlIj09dGhpcy5tZXRob2ROYW1lLHRoaXMuZz0icHJvdmlkZSI9PXRoaXMubWV0aG9kTmFtZSx0aGlzLmJhPSJyZW1vdmUiPT10aGlzLm1ldGhvZE5hbWUpLHRoaXMuaSYmKDM8PXRoaXMuYWEubGVuZ3RoPyh0aGlzLlg9dGhpcy5hYVsxXSx0aGlzLlc9dGhpcy5hYVsyXSk6dGhpcy5hYVsxXSYmKF8odGhpcy5hYVsxXSk/dGhpcy5YPXRoaXMuYWFbMV06dGhpcy5XPXRoaXMuYWFbMV0pKSksZT10WzFdLHQ9dFsyXSwhdGhpcy5tZXRob2ROYW1lKXRocm93ImFib3J0IjtpZih0aGlzLmkmJighXyhlKXx8IiI9PWUpKXRocm93ImFib3J0IjtpZih0aGlzLmcmJighXyhlKXx8IiI9PWV8fCFmKHQpKSl0aHJvdyJhYm9ydCI7aWYoZ2EodGhpcy5kYSl8fGdhKHRoaXMuSykpdGhyb3ciYWJvcnQiO2lmKHRoaXMuZyYmInQwIiE9dGhpcy5kYSl0aHJvdyJhYm9ydCJ9fXZhciBzYT1mdW5jdGlvbih0LGUpe3ZhciBuLHI9UHQodCxtbik7aWYodC5kYXRhLnNldChBbiwiX2dhIj09cj8iX2dpZCI6cisiX2dpZCIpLCJjb29raWUiPT1QdCh0LHhuKSYmKGdyPSExLHI9SChQdCh0LG1uKSksKHI9cHIodCxyKSl8fChyPVB0KHQsYm4pLHI9bnVsbCE9KHI9RXIoIl9fdXRtYSIsbj1QdCh0LEVuKXx8QSgpLHIpKT8oZygxMCksci5PWzFdKyIuIityLk9bMl0pOnZvaWQgMCksciYmKGdyPSEwKSwocj0obj0obj1yJiYhdC5nZXQoX24pKT8yPT0obj1yLnNwbGl0KCIuIikpLmxlbmd0aCYmKCEhKG49TnVtYmVyKG5bMV0pKSYmbisobz1NdCh0LHluKSk8KG5ldyBEYXRlKS5nZXRUaW1lKCkvMWUzKTpuKT92b2lkIDA6cikmJih0LmRhdGEuc2V0KGRuLHIpLHQuZGF0YS5zZXQoaG4sciksKHI9ZHIodCkpJiZ0LmRhdGEuc2V0KFJuLHIpKSx0LmdldChxbikmJihyPXQuZ2V0KEluKSxuPXQuZ2V0KERuKSwhcnx8biYmImF3LmRzIiE9bikmJihyPXt9LG49KFA/QihyKTp7fSlbUHQodCx2bildLF9yKHIpLG4mJjAhPW4ubGVuZ3RoJiYocj1uWzBdLHQuZGF0YS5zZXQoUG4sci50aW1lc3RhbXAvMWUzKSx0LmRhdGEuc2V0KEluLHIucWEpKSksdC5nZXQocW4pJiYocj10LmdldChYbiksbj17fSxvPShQP0IobiwiX2dhY19nYiIsITApOnt9KVtQdCh0LHZuKV0sT3IobiksbyYmMCE9by5sZW5ndGgmJihvPShuPW9bMF0pLnFhLHImJnIhPT1vfHwobi5sYWJlbHMmJm4ubGFiZWxzLmxlbmd0aCYmKG8rPSIuIituLmxhYmVscy5qb2luKCIuIikpLHQuZGF0YS5zZXQoQm4sbi50aW1lc3RhbXAvMWUzKSx0LmRhdGEuc2V0KFhuLG8pKSkpKSx0LmdldChfbikpe3I9TigiX2dhIiwhIXQuZ2V0KFNuKSk7dmFyIGE9TigiX2dsIiwhIXQuZ2V0KFNuKSksbz0obj1rci5nZXQodC5nZXQoU24pKSkuX2dhO2EmJjA8YS5pbmRleE9mKCJfZ2EqIikmJiFvJiZnKDMwKSxhPSEoZXx8IXQuZ2V0KEduKSkmJih2b2lkIDAhPT0oYT10LmdldCgkbikpJiYhYSgiYW5hbHl0aWNzX3N0b3JhZ2UiKSYmKGcoODQpLHQuZGF0YS5zZXQoVm4sMSksISEoYT0oYT1uLl91cCk/ISEoYT14ci5leGVjKFAucmVmZXJyZXIpKSYmKGE9YVsxXSwoaT1QLmxvY2F0aW9uLmhvc3RuYW1lKT09PWF8fDA8PWkuaW5kZXhPZigiLiIrYSl8fDA8PWEuaW5kZXhPZigiLiIraSkpOmEpKSk7dmFyIGk9bi5nY2xpZCxzPW4uX2dhYztpZihyfHxvfHxpfHxzKWlmKHImJm8mJmcoMzYpLHQuZ2V0KGtuKXx8Vyh0LmdldChMbikpfHxhKXtpZihvJiYoZygzOCksdC5kYXRhLnNldChobixvKSxuLl9naWQmJihnKDUxKSx0LmRhdGEuc2V0KFJuLG4uX2dpZCkpKSxpPyhnKDgyKSx0LmRhdGEuc2V0KEluLGkpLG4uZ2Nsc3JjJiZ0LmRhdGEuc2V0KERuLG4uZ2Nsc3JjKSk6cyYmKG89cy5zcGxpdCgiLiIpKSYmMj09PW8ubGVuZ3RoJiYoZygzNyksdC5kYXRhLnNldChJbixvWzBdKSx0LmRhdGEuc2V0KFBuLG9bMV0pKSwobj1uLl9mcGxjKSYmUHQodCxVbikmJihnKDgzKSx0LmRhdGEuc2V0KEhuLG4pKSxyKXQ6aWYobj1yLmluZGV4T2YoIi4iKSwtMT09bilnKDIyKTtlbHNle2lmKG89ci5zdWJzdHJpbmcoMCxuKSxuPShhPXIuc3Vic3RyaW5nKG4rMSkpLmluZGV4T2YoIi4iKSxyPWEuc3Vic3RyaW5nKDAsbiksYT1hLnN1YnN0cmluZyhuKzEpLCIxIj09byl7aWYoUHIobj1hLHIpKXtnKDIzKTticmVhayB0fX1lbHNle2lmKCIyIiE9byl7ZygyMik7YnJlYWsgdH1pZihvPSIiLG49MDwobj1hLmluZGV4T2YoIi0iKSk/KG89YS5zdWJzdHJpbmcoMCxuKSxhLnN1YnN0cmluZyhuKzEpKTphLnN1YnN0cmluZygxKSxQcihvK24scikpe2coNTMpO2JyZWFrIHR9byYmKGcoMiksdC5kYXRhLnNldChSbixvKSl9ZygxMSksdC5kYXRhLnNldChobixuKSwocj1OKCJfZ2FjIiwhIXQuZ2V0KFNuKSkpJiYoIjEiIT0ocj1yLnNwbGl0KCIuIikpWzBdfHw0IT1yLmxlbmd0aD9nKDcyKTpQcihyWzNdLHJbMV0pP2coNzEpOih0LmRhdGEuc2V0KEluLHJbM10pLHQuZGF0YS5zZXQoUG4sclsyXSksZyg3MCkpKX19ZWxzZSBnKDIxKX1lJiYoZyg5KSx0LmRhdGEuc2V0KGhuLHgoZSkpKSx0LmdldChobil8fCgoZT0oIShlPUkuZ2FHbG9iYWwpfHwhZS5mcm9tX2Nvb2tpZXx8ImNvb2tpZSI9PT1QdCh0LHhuKSkmJihlPWUmJmUudmlkKSYmLTEhPT1lLnNlYXJjaChjKT9lOnZvaWQgMCk/KGcoMTcpLHQuZGF0YS5zZXQoaG4sZSkpOihnKDgpLHQuZGF0YS5zZXQoaG4sZCgpKSkpLHQuZ2V0KFJuKXx8KGcoMyksdC5kYXRhLnNldChSbixkKCkpKSxocih0KSxlPUkuZ2FHbG9iYWw9SS5nYUdsb2JhbHx8e30sdD0ocj1QdCh0LGhuKSk9PT1QdCh0LGRuKSwobnVsbD09ZS52aWR8fHQmJiFlLmZyb21fY29va2llKSYmKGUudmlkPXIsZS5mcm9tX2Nvb2tpZT10KX0sY2E9ZnVuY3Rpb24odCl7dmFyIGU9SS5uYXZpZ2F0b3Isbj1JLnNjcmVlbixyPVAubG9jYXRpb24sYT10LnNldDt0Ont2YXIgbz0hIXQuZ2V0KE5uKSxpPSEhdC5nZXQoTG4pLHM9UC5yZWZlcnJlcjtpZigvXihodHRwcz98YW5kcm9pZC1hcHApOlwvXC8vaS50ZXN0KHMpKXtpZihvKWJyZWFrIHQ7aWYobz0iLy8iK1AubG9jYXRpb24uaG9zdG5hbWUsIXYocyxvKSl7aWYoaSYmKGk9by5yZXBsYWNlKC9cLi9nLCItIikrIi5jZG4uYW1wcHJvamVjdC5vcmciLHYocyxpKSkpe3M9dm9pZCAwO2JyZWFrIHR9YnJlYWsgdH19cz12b2lkIDB9aWYoYS5jYWxsKHQsbmUscyksciYmKCIvIiE9KGE9ci5wYXRobmFtZXx8IiIpLmNoYXJBdCgwKSYmKGcoMzEpLGE9Ii8iK2EpLHQuc2V0KGVlLHIucHJvdG9jb2wrIi8vIityLmhvc3RuYW1lK2Erci5zZWFyY2gpKSxuJiZ0LnNldChzZSxuLndpZHRoKyJ4IituLmhlaWdodCksbiYmdC5zZXQoaWUsbi5jb2xvckRlcHRoKyItYml0Iiksbj1QLmRvY3VtZW50RWxlbWVudCxzPShhPVAuYm9keSkmJmEuY2xpZW50V2lkdGgmJmEuY2xpZW50SGVpZ2h0LGk9W10sbiYmbi5jbGllbnRXaWR0aCYmbi5jbGllbnRIZWlnaHQmJigiQ1NTMUNvbXBhdCI9PT1QLmNvbXBhdE1vZGV8fCFzKT9pPVtuLmNsaWVudFdpZHRoLG4uY2xpZW50SGVpZ2h0XTpzJiYoaT1bYS5jbGllbnRXaWR0aCxhLmNsaWVudEhlaWdodF0pLG49aVswXTw9MHx8aVsxXTw9MD8iIjppLmpvaW4oIngiKSx0LnNldChjZSxuKSxuPXQuc2V0LChhPShhPUkubmF2aWdhdG9yKT9hLnBsdWdpbnM6bnVsbCkmJmEubGVuZ3RoKWZvcihzPTA7czxhLmxlbmd0aCYmIXU7cysrKS0xPChpPWFbc10pLm5hbWUuaW5kZXhPZigiU2hvY2t3YXZlIEZsYXNoIikmJih1PWkuZGVzY3JpcHRpb24pO2lmKCF1KXRyeXt2YXIgYz1uZXcgQWN0aXZlWE9iamVjdCgiU2hvY2t3YXZlRmxhc2guU2hvY2t3YXZlRmxhc2guNyIpLHU9Yy5HZXRWYXJpYWJsZSgiJHZlcnNpb24iKX1jYXRjaCh0KXt9aWYoIXUpdHJ5e2M9bmV3IEFjdGl2ZVhPYmplY3QoIlNob2Nrd2F2ZUZsYXNoLlNob2Nrd2F2ZUZsYXNoLjYiKSx1PSJXSU4gNiwwLDIxLDAiLGMuQWxsb3dTY3JpcHRBY2Nlc3M9ImFsd2F5cyIsdT1jLkdldFZhcmlhYmxlKCIkdmVyc2lvbiIpfWNhdGNoKHQpe31pZighdSl0cnl7dT0oYz1uZXcgQWN0aXZlWE9iamVjdCgiU2hvY2t3YXZlRmxhc2guU2hvY2t3YXZlRmxhc2giKSkuR2V0VmFyaWFibGUoIiR2ZXJzaW9uIil9Y2F0Y2godCl7fWlmKHUmJihjPXUubWF0Y2goL1tcZF0rL2cpKSYmMzw9Yy5sZW5ndGgmJih1PWNbMF0rIi4iK2NbMV0rIiByIitjWzJdKSxuLmNhbGwodCxsZSx1fHx2b2lkIDApLHQuc2V0KG9lLFAuY2hhcmFjdGVyU2V0fHxQLmNoYXJzZXQpLHQuc2V0KHVlLGUmJiJmdW5jdGlvbiI9PXR5cGVvZiBlLmphdmFFbmFibGVkJiZlLmphdmFFbmFibGVkKCl8fCExKSx0LnNldChhZSwoZSYmKGUubGFuZ3VhZ2V8fGUuYnJvd3Nlckxhbmd1YWdlKXx8IiIpLnRvTG93ZXJDYXNlKCkpLHQuZGF0YS5zZXQoSW4sTigiZ2NsaWQiLCEwKSksdC5kYXRhLnNldChEbixOKCJnY2xzcmMiLCEwKSksdC5kYXRhLnNldChQbixNYXRoLnJvdW5kKChuZXcgRGF0ZSkuZ2V0VGltZSgpLzFlMykpLHQuZ2V0KEluKXx8KHQuZGF0YS5zZXQoWG4sTigid2JyYWlkIiwhMCkpLHQuZGF0YS5zZXQoQm4sTWF0aC5yb3VuZCgobmV3IERhdGUpLmdldFRpbWUoKS8xZTMpKSksciYmdC5nZXQoU24pJiYoZT1QLmxvY2F0aW9uLmhhc2gpKXtmb3IoZT1lLnNwbGl0KC9bPyYjXSsvKSxyPVtdLHU9MDt1PGUubGVuZ3RoOysrdSkoTyhlW3VdLCJ1dG1faWQiKXx8TyhlW3VdLCJ1dG1fY2FtcGFpZ24iKXx8TyhlW3VdLCJ1dG1fc291cmNlIil8fE8oZVt1XSwidXRtX21lZGl1bSIpfHxPKGVbdV0sInV0bV90ZXJtIil8fE8oZVt1XSwidXRtX2NvbnRlbnQiKXx8TyhlW3VdLCJnY2xpZCIpfHxPKGVbdV0sImRjbGlkIil8fE8oZVt1XSwiZ2Nsc3JjIil8fE8oZVt1XSwid2JyYWlkIikpJiZyLnB1c2goZVt1XSk7MDxyLmxlbmd0aCYmKGU9IiMiK3Iuam9pbigiJiIpLHQuc2V0KGVlLHQuZ2V0KGVlKStlKSl9fSx1YT17cGFnZXZpZXc6W3JlXSxldmVudDpbZ2UsaGUsZmUsZGVdLHNvY2lhbDpbcGUsdmUsbWVdLHRpbWluZzpbdCxOZSxBZSxSZV19LE5lPWZ1bmN0aW9uKG4pe3ZhciByLGE7b2Eobil8fChnKDE2KSxyPSExLHAoUCwidmlzaWJpbGl0eWNoYW5nZSIsYT1mdW5jdGlvbigpe3ZhciB0LGU7IXImJm9hKG4pJiYocj0hMCx0PWEsKGU9UCkucmVtb3ZlRXZlbnRMaXN0ZW5lcj9lLnJlbW92ZUV2ZW50TGlzdGVuZXIoInZpc2liaWxpdHljaGFuZ2UiLHQsITEpOmUuZGV0YWNoRXZlbnQmJmUuZGV0YWNoRXZlbnQoIm9udmlzaWJpbGl0eWNoYW5nZSIsdCkpfSkpfSxsYT0vXig/OihcdyspXC4pPyg/OihcdyspOik/KFx3KykkLztmdW5jdGlvbiBnYSh0KXtyZXR1cm4gMDw9dC5pbmRleE9mKCIuIil8fDA8PXQuaW5kZXhPZigiOiIpfWZ1bmN0aW9uIGhhKHQsZSl7ZmEuc2V0KHQsZSksZT1wYS5nZXQodCl8fFtdO2Zvcih2YXIgbj0wO248ZS5sZW5ndGg7bisrKWVbbl0oKTtwYS5zZXQodCxbXSl9dmFyIGZhPW5ldyBiLGRhPW5ldyBiLHBhPW5ldyBiLHZhPXtlYzo0NSxlY29tbWVyY2U6NDYsbGlua2lkOjQ3fSxtYT1mdW5jdGlvbih0LGUsbil7ZT09a2F8fGUuZ2V0KGduKTt2YXIgcj1mYS5nZXQodCk7cmV0dXJuISFmKHIpJiYoZS5wbHVnaW5zXz1lLnBsdWdpbnNffHxuZXcgYixlLnBsdWdpbnNfLmdldCh0KXx8ZS5wbHVnaW5zXy5zZXQodCxuZXcgcihlLG58fHt9KSksITApfSxiYT1mdW5jdGlvbih0LGUsbixyLGEpe2lmKCFmKGZhLmdldChlKSkmJiFkYS5nZXQoZSkpe3ZhLmhhc093blByb3BlcnR5KGUpJiZnKHZhW2VdKTt2YXIgbyxpPXZvaWQgMDtpZihHci50ZXN0KGUpKXtpZihnKDUyKSwhKHQ9a2Euaih0KSkpcmV0dXJuITA7bj1xcih0Lm1vZGVsLGUscixhKSxpPWZ1bmN0aW9uKCl7eGEuRChbInByb3ZpZGUiLGUsZnVuY3Rpb24oKXt9XSk7dmFyIHQ9SVtyJiZyLmRhdGFMYXllcnx8ImRhdGFMYXllciJdO3QmJnQuaGlkZSYmZih0LmhpZGUuZW5kKSYmdC5oaWRlW2VdJiYodC5oaWRlLmVuZCgpLHQuaGlkZS5lbmQ9dm9pZCAwKX19IW4mJnZhLmhhc093blByb3BlcnR5KGUpPyhnKDM5KSxuPWUrIi5qcyIpOmcoNDMpLG4mJihyJiYobz1yW1VuXSksXyhvKXx8KG89dm9pZCAwKSx0PUVhKFRhKG4sbykpLCFvfHxfYSh0LnByb3RvY29sKSYmeWEodCl8fCh0PUVhKFRhKG4pKSksX2EodC5wcm90b2NvbCkmJnlhKHQpJiYoaih0LnVybCx2b2lkIDAsYSx2b2lkIDAsaSksZGEuc2V0KGUsITApKSl9fSx3YT1mdW5jdGlvbih0LGUpe3ZhciBuPXBhLmdldCh0KXx8W107bi5wdXNoKGUpLHBhLnNldCh0LG4pfSx5YT1mdW5jdGlvbih0KXt2YXIgZT1FYShQLmxvY2F0aW9uLmhyZWYpO3JldHVybiEoIU8odC51cmwsWigxKSkmJiFPKHQudXJsLFooMikpKXx8ISh0LnF1ZXJ5fHwwPD10LnVybC5pbmRleE9mKCI/Iil8fDA8PXQucGF0aC5pbmRleE9mKCI6Ly8iKSkmJighISh0Lmhvc3Q9PWUuaG9zdCYmdC5wb3J0PT1lLnBvcnR8fG4mJigoZT1QLmNyZWF0ZUVsZW1lbnQoImEiKSkuaHJlZj1uLGU9T2EoZSksdC5ob3N0PT09ZVswXSYmdC5wb3J0PT09ZVsxXSkpfHwoZT0iaHR0cDoiPT10LnByb3RvY29sPzgwOjQ0MywhKCJ3d3cuZ29vZ2xlLWFuYWx5dGljcy5jb20iIT10Lmhvc3R8fCh0LnBvcnR8fGUpIT1lfHwhTyh0LnBhdGgsIi9wbHVnaW5zLyIpKSkpfSxfYT1mdW5jdGlvbih0KXt2YXIgZT1QLmxvY2F0aW9uLnByb3RvY29sO3JldHVybiJodHRwczoiPT10fHx0PT1lfHwiaHR0cDoiPT10JiYiaHR0cDoiPT1lfSxPYT1mdW5jdGlvbih0KXt2YXIgZT0wPD0obj10Lmhvc3RuYW1lfHwiIikuaW5kZXhPZigiXSIpLG49bi5zcGxpdChlPyJdIjoiOiIpWzBdLnRvTG93ZXJDYXNlKCk7cmV0dXJuIGUmJihuKz0iXSIpLGU9KHQucHJvdG9jb2x8fCIiKS50b0xvd2VyQ2FzZSgpLGU9K3QucG9ydHx8KCJodHRwOiI9PWU/ODA6Imh0dHBzOiI9PWU/NDQzOiIiKSx0PXQucGF0aG5hbWV8fCIiLFtuLCIiK2UsdD0hTyh0LCIvIik/Ii8iK3Q6dF19LEVhPWZ1bmN0aW9uKHQpe3ZhciBlPVAuY3JlYXRlRWxlbWVudCgiYSIpO2UuaHJlZj1QLmxvY2F0aW9uLmhyZWY7dmFyIG49KGUucHJvdG9jb2x8fCIiKS50b0xvd2VyQ2FzZSgpLHI9T2EoZSksYT1lLnNlYXJjaHx8IiIsbz1uKyIvLyIrclswXSsoclsxXT8iOiIrclsxXToiIik7cmV0dXJuIE8odCwiLy8iKT90PW4rdDpPKHQsIi8iKT90PW8rdDohdHx8Tyh0LCI/Iik/dD1vK3JbMl0rKHR8fGEpOnQuc3BsaXQoIi8iKVswXS5pbmRleE9mKCI6Iik8MCYmKHQ9bytyWzJdLnN1YnN0cmluZygwLHJbMl0ubGFzdEluZGV4T2YoIi8iKSkrIi8iK3QpLGUuaHJlZj10LG49T2EoZSkse3Byb3RvY29sOihlLnByb3RvY29sfHwiIikudG9Mb3dlckNhc2UoKSxob3N0Om5bMF0scG9ydDpuWzFdLHBhdGg6blsyXSxxdWVyeTplLnNlYXJjaHx8IiIsdXJsOnR8fCIifX0sVGE9ZnVuY3Rpb24odCxlKXtyZXR1cm4gdCYmMDw9dC5pbmRleE9mKCIvIik/dDooZXx8Z3QoITEpKSsiL3BsdWdpbnMvdWEvIit0fSx4YT17Z2E6ZnVuY3Rpb24oKXt4YS5mYT1bXX19O3hhLmdhKCkseGEuRD1mdW5jdGlvbih0KXt2YXIgZT14YS5KLmFwcGx5KHhhLGFyZ3VtZW50cyksZT14YS5mYS5jb25jYXQoZSk7Zm9yKHhhLmZhPVtdOzA8ZS5sZW5ndGgmJiF4YS52KGVbMF0pJiYoZS5zaGlmdCgpLCEoMDx4YS5mYS5sZW5ndGgpKTspO3hhLmZhPXhhLmZhLmNvbmNhdChlKX0seGEucmE9ZnVuY3Rpb24odCl7a2EucSYmKDMwMD09PWthLnEubGVuZ3RoJiYoa2EucS5zaGlmdCgpLGthLnFkKyspLGthLnEucHVzaCh0KSl9LHhhLko9ZnVuY3Rpb24odCl7Zm9yKHZhciBlPVtdLG49MDtuPGFyZ3VtZW50cy5sZW5ndGg7bisrKXRyeXt2YXIgcj1uZXcgaWEoYXJndW1lbnRzW25dKTtyLmc/aGEoci5hYVswXSxyLmFhWzFdKTooci5pJiYoci5oYT1iYShyLmRhLHIuYWFbMF0sci5YLHIuVykpLGUucHVzaChyKSkseGEucmEoYXJndW1lbnRzW25dKX1jYXRjaCh0KXt9cmV0dXJuIGV9LHhhLnY9ZnVuY3Rpb24odCl7dHJ5e2lmKHQudSl0LnUuY2FsbChJLGthLmooInQwIikpO2Vsc2V7dmFyIGUsbixyLGE9dC5kYT09cz9rYTprYS5qKHQuZGEpO2lmKHQuQSl7aWYoInQwIj09dC5kYSYmbnVsbD09PShhPWthLmNyZWF0ZS5hcHBseShrYSx0LmFhKSkpcmV0dXJuITB9ZWxzZSBpZih0LmJhKWthLnJlbW92ZSh0LmRhKTtlbHNlIGlmKGEpaWYodC5pKXtpZih0LmhhJiYodC5oYT1iYSh0LmRhLHQuYWFbMF0sdC5YLHQuVykpLCFtYSh0LmFhWzBdLGEsdC5XKSlyZXR1cm4hMH1lbHNlIHQuSz8oZT10Lm1ldGhvZE5hbWUsbj10LmFhLChyPWEucGx1Z2luc18uZ2V0KHQuSykpW2VdLmFwcGx5KHIsbikpOmFbdC5tZXRob2ROYW1lXS5hcHBseShhLHQuYWEpfX1jYXRjaCh0KXt9fTt2YXIga2E9ZnVuY3Rpb24odCl7ZygxKSx4YS5ELmFwcGx5KHhhLFthcmd1bWVudHNdKX07a2EuaD17fSxrYS5QPVtdLGthLkw9MCxrYS55YT0wLGthLmFuc3dlcj00Mjt2YXIgU2E9W3ZuLGJuLGduXTtrYS5jcmVhdGU9ZnVuY3Rpb24odCl7dmFyIGU9bShTYSxbXS5zbGljZS5jYWxsKGFyZ3VtZW50cykpO2VbZ25dfHwoZVtnbl09InQwIik7dmFyIG49IiIrZVtnbl07aWYoa2EuaFtuXSlyZXR1cm4ga2EuaFtuXTtpZihmdW5jdGlvbih0KXtpZihXKHRbTG5dKSYmKHZvaWQgMD09PXJ0JiYoZT0oZT1rci5nZXQoKSkmJmUuX2dhfHx2b2lkIDApJiYocnQ9ZSxnKDgxKSksdm9pZCAwIT09cnQpKXJldHVybiB0W2huXXx8KHRbaG5dPXJ0KSwhMTtpZih0W0xuXSl7aWYoZyg2NyksdFt4bl0mJiJjb29raWUiIT10W3huXSlyZXR1cm4hMTtpZih2b2lkIDAhPT1ydCl0W2huXXx8KHRbaG5dPXJ0KTtlbHNle3ZhciBlPVN0cmluZyh0W2JuXXx8QSgpKSxuPVN0cmluZyh0W3duXXx8Ii8iKSxyPUgoU3RyaW5nKHRbbW5dfHwiX2dhIikpO2lmKChlPSEoKGU9dnIocixlLG4pKSYmIWMudGVzdChlKSl8fCgwPT0oZT1IKCJBTVBfVE9LRU4iKSkubGVuZ3RofHwxPT1lLmxlbmd0aCYmKCIkUkVUUklFVklORyI9PShlPWRlY29kZVVSSUNvbXBvbmVudChlWzBdKSl8fCIkT1BUX09VVCI9PWV8fCIkRVJST1IiPT1lfHwiJE5PVF9GT1VORCI9PWUpKSkmJnN0KHosU3RyaW5nKHRbdm5dKSkpcmV0dXJuITB9fXJldHVybiExfShlKSlyZXR1cm4gbnVsbDtpZihlPW5ldyAkcihlKSxrYS5oW25dPWUsa2EuUC5wdXNoKGUpLG49d3QoKS50cmFja2VyX2NyZWF0ZWQsZihuKSl0cnl7bihlKX1jYXRjaCh0KXt9cmV0dXJuIGV9LGthLnJlbW92ZT1mdW5jdGlvbih0KXtmb3IodmFyIGU9MDtlPGthLlAubGVuZ3RoO2UrKylpZihrYS5QW2VdLmdldChnbik9PXQpe2thLlAuc3BsaWNlKGUsMSksa2EuaFt0XT1udWxsO2JyZWFrfX0sa2Euaj1mdW5jdGlvbih0KXtyZXR1cm4ga2EuaFt0XX0sa2EuZ2V0QWxsPWZ1bmN0aW9uKCl7cmV0dXJuIGthLlAuc2xpY2UoMCl9LGthLk49ZnVuY3Rpb24oKXtpZigiZ2EiIT1zJiZnKDQ5KSwhKG49SVtzXSl8fDQyIT1uLmFuc3dlcil7a2EuTD1uJiZuLmwsa2EueWE9K25ldyBEYXRlLGthLmxvYWRlZD0hMDt2YXIgdD1uJiZuLnEsZT15KHQpLG49W107aWYoZT9uPXQuc2xpY2UoMCk6Zyg1MCksa2EucT1lP3Q6W10sa2EucS5zcGxpY2UoMCksa2EucWQ9MCxlcigiY3JlYXRlIix0PUlbc109a2EsdC5jcmVhdGUpLGVyKCJyZW1vdmUiLHQsdC5yZW1vdmUpLGVyKCJnZXRCeU5hbWUiLHQsdC5qLDUpLGVyKCJnZXRBbGwiLHQsdC5nZXRBbGwsNiksZXIoImdldCIsdD0kci5wcm90b3R5cGUsdC5nZXQsNyksZXIoInNldCIsdCx0LnNldCw0KSxlcigic2VuZCIsdCx0LnNlbmQpLGVyKCJyZXF1aXJlU3luYyIsdCx0Lm1hKSxlcigiZ2V0Iix0PUl0LnByb3RvdHlwZSx0LmdldCksZXIoInNldCIsdCx0LnNldCksImh0dHBzOiIhPVAubG9jYXRpb24ucHJvdG9jb2wmJiFsKXt0Ontmb3IodD1QLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJzY3JpcHQiKSxlPTA7ZTx0Lmxlbmd0aCYmZTwxMDA7ZSsrKXt2YXIgcj10W2VdLnNyYztpZihyJiYwPT1yLmluZGV4T2YoZ3QoITApKyIvYW5hbHl0aWNzIikpe3Q9ITA7YnJlYWsgdH19dD0hMX10JiYobD0hMCl9dD0oKEkuZ2FwbHVnaW5zPUkuZ2FwbHVnaW5zfHx7fSkuTGlua2VyPVJyKS5wcm90b3R5cGUsaGEoImxpbmtlciIsUnIpLGVyKCJkZWNvcmF0ZSIsdCx0LmNhLDIwKSxlcigiYXV0b0xpbmsiLHQsdC5TLDI1KSxlcigicGFzc3Rocm91Z2giLHQsdC4kLDI1KSxoYSgiZGlzcGxheWZlYXR1cmVzIixVciksaGEoImFkZmVhdHVyZXMiLFVyKSx4YS5ELmFwcGx5KGthLG4pfX07QWU9a2EuTixSZT1JW3NdO1JlJiZSZS5yP0FlKCk6TmUoQWUpLE5lKGZ1bmN0aW9uKCl7eGEuRChbInByb3ZpZGUiLCJyZW5kZXIiLFRdKX0pfSh3aW5kb3cpfQo="},{"name":"brave-fix","aliases":[],"kind":{"mime":"application/javascript"},"content":"Ly8vIGJyYXZlLWZpeC5qcwovLy8gYWxpYXMgYmYuanMKZGVsZXRlIE5hdmlnYXRvci5wcm90b3R5cGUuYnJhdmUKZGVsZXRlIHdpbmRvdy5uYXZpZ2F0b3IuYnJhdmUK"},{"name":"sugarcoat-0034123910e2a05f7a8ad0c58ef06f3bd4542217","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfYjQ2YjNiYjQ2NDQyZmM5MCA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja19iNDZiM2JiNDY0NDJmYzkwKTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PSB0eXBlb2YgZXhwb3J0cyAmJiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgbW9kdWxlKQogICAgICAgICAgICAgICAgbW9kdWxlLmV4cG9ydHMgPSBlKCk7CiAgICAgICAgICAgIGVsc2UgaWYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIGRlZmluZSAmJiBkZWZpbmUuYW1kKQogICAgICAgICAgICAgICAgZGVmaW5lKFtdLCBlKTsKICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAoJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHdpbmRvdyA/IHdpbmRvdyA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBnbG9iYWwgPyBnbG9iYWwgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygc2VsZiA/IHNlbGYgOiB0aGlzKS5idWdzbmFnID0gZSgpOwogICAgICAgICAgICB9CiAgICAgICAgfShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIGZ1bmN0aW9uIGUoZSwgdCkgewogICAgICAgICAgICAgICAgaWYgKCEoZSBpbnN0YW5jZW9mIHQpKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0Nhbm5vdCBjYWxsIGEgY2xhc3MgYXMgYSBmdW5jdGlvbicpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHQoZSwgdCkgewogICAgICAgICAgICAgICAgaWYgKCEoZSBpbnN0YW5jZW9mIHQpKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0Nhbm5vdCBjYWxsIGEgY2xhc3MgYXMgYSBmdW5jdGlvbicpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIG4oKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gSigoTWF0aC5yYW5kb20oKSAqIHJlIDw8IDApLnRvU3RyaW5nKG5lKSwgdGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZWUgPSBlZSA8IHJlID8gZWUgOiAwLCArK2VlIC0gMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBpKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICdjJyArIG5ldyBEYXRlKCkuZ2V0VGltZSgpLnRvU3RyaW5nKG5lKSArIEoocigpLnRvU3RyaW5nKG5lKSwgdGUpICsgUSgpICsgKG4oKSArIG4oKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gbyhlLCB0KSB7CiAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQ2Fubm90IGNhbGwgYSBjbGFzcyBhcyBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gYShlLCB0KSB7CiAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQ2Fubm90IGNhbGwgYSBjbGFzcyBhcyBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICB2YXIgdCA9IFtlLnRhZ05hbWVdOwogICAgICAgICAgICAgICAgaWYgKGUuaWQgJiYgdC5wdXNoKCcjJyArIGUuaWQpLCBlLmNsYXNzTmFtZSAmJiBlLmNsYXNzTmFtZS5sZW5ndGggJiYgdC5wdXNoKCcuJyArIGUuY2xhc3NOYW1lLnNwbGl0KCcgJykuam9pbignLicpKSwgIWRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwgfHwgIUFycmF5LnByb3RvdHlwZS5pbmRleE9mKQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmpvaW4oJycpOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PT0gZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCh0LmpvaW4oJycpKS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmpvaW4oJycpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAocikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmpvaW4oJycpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGUucGFyZW50Tm9kZS5jaGlsZE5vZGVzLmxlbmd0aCA+IDEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IEFycmF5LnByb3RvdHlwZS5pbmRleE9mLmNhbGwoZS5wYXJlbnROb2RlLmNoaWxkTm9kZXMsIGUpICsgMTsKICAgICAgICAgICAgICAgICAgICB0LnB1c2goJzpudGgtY2hpbGQoJyArIG4gKyAnKScpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIDEgPT09IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwodC5qb2luKCcnKSkubGVuZ3RoID8gdC5qb2luKCcnKSA6IGUucGFyZW50Tm9kZSA/IHMoZS5wYXJlbnROb2RlKSArICcgPiAnICsgdC5qb2luKCcnKSA6IHQuam9pbignJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gdShlLCB0KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLmxlbmd0aCA8PSB0ID8gZSA6IGUuc2xpY2UoMCwgdCAtICcoLi4uKScubGVuZ3RoKSArICcoLi4uKSc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gYygpIHsKICAgICAgICAgICAgICAgIGlmICghdHQocnQoKSwgdGhpc1tRZV0pKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogdGhpcy5zdGF0dXMsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IHRoaXNbZXRdICsgJyAnICsgdGhpc1tRZV0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdHVzID49IDQwMCA/IG50LmxlYXZlQnJlYWRjcnVtYignWE1MSHR0cFJlcXVlc3QgZmFpbGVkJywgZSwgWmUpIDogbnQubGVhdmVCcmVhZGNydW1iKCdYTUxIdHRwUmVxdWVzdCBzdWNjZWVkZWQnLCBlLCBaZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gZigpIHsKICAgICAgICAgICAgICAgIHR0KHJ0KCksIHRoaXNbUWVdKSB8fCBudC5sZWF2ZUJyZWFkY3J1bWIoJ1hNTEh0dHBSZXF1ZXN0IGVycm9yJywgeyByZXF1ZXN0OiB0aGlzW2V0XSArICcgJyArIHRoaXNbUWVdIH0sIFplKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBkKGUpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnW1Rocm93czogJyArIChlID8gZS5tZXNzYWdlIDogJz8nKSArICddJzsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBsKGUsIHQpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0gZS5sZW5ndGg7IG4gPCByOyBuKyspCiAgICAgICAgICAgICAgICAgICAgaWYgKGVbbl0gPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBnKGUpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnW29iamVjdCBBcnJheV0nID09PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcChlLCB0KSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3RdOwogICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBkKG4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGgoZSkgewogICAgICAgICAgICAgICAgZnVuY3Rpb24gdChlLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgPiB4dCAmJiByID4gRHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChyKyssIGkgPT09IHVuZGVmaW5lZCAmJiAoaSA9IDApLCBpID4gQnQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBMdDsKICAgICAgICAgICAgICAgICAgICBpZiAobygpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTHQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGUgfHwgJ29iamVjdCcgIT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIGlmIChsKG4sIGUpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tDaXJjdWxhcl0nOwogICAgICAgICAgICAgICAgICAgIGlmIChuLnB1c2goZSksICdmdW5jdGlvbicgPT0gdHlwZW9mIGUudG9KU09OKQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgci0tOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0KGUudG9KU09OKCksIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ucG9wKCksIGE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKG0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKGcoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgcyA9IFtdLCB1ID0gMCwgYyA9IGUubGVuZ3RoOyB1IDwgYzsgdSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobygpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5wdXNoKEx0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMucHVzaCh0KGVbdV0sIGkgKyAxKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ucG9wKCksIHM7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciBmID0ge307CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaCBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLCBoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZltoXSA9IEx0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZltoXSA9IHQocChlLCBoKSwgaSArIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHYpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ucG9wKCksIGY7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgbiA9IFtdLCByID0gMDsKICAgICAgICAgICAgICAgIHJldHVybiB0KGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBtID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gbiwgaSA9IDAsIG8gPSBlLmxlbmd0aDsgaSA8IG87IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgciA9IHQociwgZVtpXSwgaSwgZSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICB9LCB2ID0gIXsgdG9TdHJpbmc6IG51bGwgfS5wcm9wZXJ0eUlzRW51bWVyYWJsZSgndG9TdHJpbmcnKSwgeSA9IFsKICAgICAgICAgICAgICAgICAgICAndG9TdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICd0b0xvY2FsZVN0cmluZycsCiAgICAgICAgICAgICAgICAgICAgJ3ZhbHVlT2YnLAogICAgICAgICAgICAgICAgICAgICdoYXNPd25Qcm9wZXJ0eScsCiAgICAgICAgICAgICAgICAgICAgJ2lzUHJvdG90eXBlT2YnLAogICAgICAgICAgICAgICAgICAgICdwcm9wZXJ0eUlzRW51bWVyYWJsZScsCiAgICAgICAgICAgICAgICAgICAgJ2NvbnN0cnVjdG9yJwogICAgICAgICAgICAgICAgXSwgYiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPCAxMCA/ICcwJyArIGUgOiBlOwogICAgICAgICAgICAgICAgfSwgdyA9IHsKICAgICAgICAgICAgICAgICAgICBtYXA6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKGUsIGZ1bmN0aW9uIChlLCBuLCByLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jb25jYXQodChuLCByLCBpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtdKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHJlZHVjZTogbSwKICAgICAgICAgICAgICAgICAgICBmaWx0ZXI6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKGUsIGZ1bmN0aW9uIChlLCBuLCByLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdChuLCByLCBpKSA/IGUuY29uY2F0KG4pIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgW10pOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaW5jbHVkZXM6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKGUsIGZ1bmN0aW9uIChlLCBuLCByLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGUgfHwgbiA9PT0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgITEpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAga2V5czogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXSwgbiA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSwgbikgJiYgdC5wdXNoKG4pOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IDAsIGkgPSB5Lmxlbmd0aDsgciA8IGk7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLCB5W3JdKSAmJiB0LnB1c2goeVtyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNBcnJheTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0IEFycmF5XScgPT09IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzb0RhdGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZXcgRGF0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5nZXRVVENGdWxsWWVhcigpICsgJy0nICsgYihlLmdldFVUQ01vbnRoKCkgKyAxKSArICctJyArIGIoZS5nZXRVVENEYXRlKCkpICsgJ1QnICsgYihlLmdldFVUQ0hvdXJzKCkpICsgJzonICsgYihlLmdldFVUQ01pbnV0ZXMoKSkgKyAnOicgKyBiKGUuZ2V0VVRDU2Vjb25kcygpKSArICcuJyArIChlLmdldFVUQ01pbGxpc2Vjb25kcygpIC8gMTAwMCkudG9GaXhlZCgzKS5zbGljZSgyLCA1KSArICdaJzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBTID0gdy5pc29EYXRlLCBPID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgYXJndW1lbnRzWzBdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbMF0gOiAnW2Fub255bW91c10nLCByID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgYXJndW1lbnRzWzFdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbMV0gOiB7fSwgaSA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIGFyZ3VtZW50c1syXSAhPT0gdW5kZWZpbmVkID8gYXJndW1lbnRzWzJdIDogJ21hbnVhbCcsIG8gPSBhcmd1bWVudHMubGVuZ3RoID4gMyAmJiBhcmd1bWVudHNbM10gIT09IHVuZGVmaW5lZCA/IGFyZ3VtZW50c1szXSA6IFMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgZSh0aGlzLCB0KSwgdGhpcy50eXBlID0gaSwgdGhpcy5uYW1lID0gbiwgdGhpcy5tZXRhRGF0YSA9IHIsIHRoaXMudGltZXN0YW1wID0gbzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucHJvdG90eXBlLnRvSlNPTiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHRoaXMudHlwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IHRoaXMubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVzdGFtcDogdGhpcy50aW1lc3RhbXAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRhRGF0YTogdGhpcy5tZXRhRGF0YQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIHQ7CiAgICAgICAgICAgICAgICB9KCksIGogPSB7fSwgRSA9IHcuaW5jbHVkZXM7CiAgICAgICAgICAgIGoucG9zaXRpdmVJbnRJZkRlZmluZWQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIEUoWwogICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnLAogICAgICAgICAgICAgICAgICAgICdudW1iZXInCiAgICAgICAgICAgICAgICBdLCB0eXBlb2YgZSkgJiYgcGFyc2VJbnQoJycgKyBlLCAxMCkgPT09IGUgJiYgZSA+IDA7CiAgICAgICAgICAgIH0sIGouc3RyaW5nV2l0aExlbmd0aCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgISFlLmxlbmd0aDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE4gPSB7fSwgUiA9IHcuZmlsdGVyLCBrID0gdy5yZWR1Y2UsIEIgPSB3LmtleXMsIEQgPSB3LmlzQXJyYXksIHggPSB3LmluY2x1ZGVzLCBMID0gai5wb3NpdGl2ZUludElmRGVmaW5lZCwgXyA9IGouc3RyaW5nV2l0aExlbmd0aDsKICAgICAgICAgICAgTi5zY2hlbWEgPSB7CiAgICAgICAgICAgICAgICBhcGlLZXk6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnaXMgcmVxdWlyZWQnLAogICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlOiBfCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgYXBwVmVyc2lvbjogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdzaG91bGQgYmUgYSBzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gZSB8fCBfKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBhdXRvTm90aWZ5OiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdzaG91bGQgYmUgdHJ1ZXxmYWxzZScsCiAgICAgICAgICAgICAgICAgICAgdmFsaWRhdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gZSB8fCAhMSA9PT0gZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgYmVmb3JlU2VuZDogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnc2hvdWxkIGJlIGEgZnVuY3Rpb24gb3IgYXJyYXkgb2YgZnVuY3Rpb25zJywKICAgICAgICAgICAgICAgICAgICB2YWxpZGF0ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgPT0gdHlwZW9mIGUgfHwgRChlKSAmJiBSKGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkubGVuZ3RoID09PSBlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgZW5kcG9pbnRzOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RpZnk6ICdodHRwczovL25vdGlmeS5idWdzbmFnLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uczogJ2h0dHBzOi8vc2Vzc2lvbnMuYnVnc25hZy5jb20nCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnc2hvdWxkIGJlIGFuIG9iamVjdCBjb250YWluaW5nIGVuZHBvaW50IFVSTHMgeyBub3RpZnksIHNlc3Npb25zIH0uIHNlc3Npb25zIGlzIG9wdGlvbmFsIGlmIGF1dG9DYXB0dXJlU2Vzc2lvbnM9ZmFsc2UnLAogICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgZSAmJiBfKGUubm90aWZ5KSAmJiAoITEgPT09IHQuYXV0b0NhcHR1cmVTZXNzaW9ucyB8fCBfKGUuc2Vzc2lvbnMpKSAmJiAwID09PSBSKEIoZSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXgoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdub3RpZnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZXNzaW9ucycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGF1dG9DYXB0dXJlU2Vzc2lvbnM6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmVuZHBvaW50cyA9PT0gdW5kZWZpbmVkIHx8ICEhdC5lbmRwb2ludHMgJiYgISF0LmVuZHBvaW50cy5zZXNzaW9uczsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdzaG91bGQgYmUgdHJ1ZXxmYWxzZScsCiAgICAgICAgICAgICAgICAgICAgdmFsaWRhdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gZSB8fCAhMSA9PT0gZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgbm90aWZ5UmVsZWFzZVN0YWdlczogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdzaG91bGQgYmUgYW4gYXJyYXkgb2Ygc3RyaW5ncycsCiAgICAgICAgICAgICAgICAgICAgdmFsaWRhdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09PSBlIHx8IEQoZSkgJiYgUihlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5sZW5ndGggPT09IGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICByZWxlYXNlU3RhZ2U6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdwcm9kdWN0aW9uJzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdzaG91bGQgYmUgYSBzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIG1heEJyZWFkY3J1bWJzOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAyMDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdzaG91bGQgYmUgYSBudW1iZXIgXHUyMjY0NDAnLAogICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA9PT0gZSB8fCBMKGUpICYmIChlID09PSB1bmRlZmluZWQgfHwgZSA8PSA0MCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGF1dG9CcmVhZGNydW1iczogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnc2hvdWxkIGJlIHRydWV8ZmFsc2UnLAogICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Jvb2xlYW4nID09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB1c2VyOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogJyhvYmplY3QpIHVzZXIgc2hvdWxkIGJlIGFuIG9iamVjdCcsCiAgICAgICAgICAgICAgICAgICAgdmFsaWRhdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnb2JqZWN0JyA9PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgbWV0YURhdGE6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnc2hvdWxkIGJlIGFuIG9iamVjdCcsCiAgICAgICAgICAgICAgICAgICAgdmFsaWRhdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnb2JqZWN0JyA9PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgbG9nZ2VyOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWQ7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnc2hvdWxkIGJlIG51bGwgb3IgYW4gb2JqZWN0IHdpdGggbWV0aG9kcyB7IGRlYnVnLCBpbmZvLCB3YXJuLCBlcnJvciB9JywKICAgICAgICAgICAgICAgICAgICB2YWxpZGF0ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFlIHx8IGUgJiYgayhbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGVidWcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2luZm8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3dhcm4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Vycm9yJwogICAgICAgICAgICAgICAgICAgICAgICBdLCBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwgTi5tZXJnZURlZmF1bHRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGlmICghZSB8fCAhdCkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ29wdHMgYW5kIHNjaGVtYSBvYmplY3RzIGFyZSByZXF1aXJlZCcpOwogICAgICAgICAgICAgICAgcmV0dXJuIGsoQih0KSwgZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbltyXSA9IGVbcl0gIT09IHVuZGVmaW5lZCA/IGVbcl0gOiB0W3JdLmRlZmF1bHRWYWx1ZShlW3JdLCBlKSwgbjsKICAgICAgICAgICAgICAgIH0sIHt9KTsKICAgICAgICAgICAgfSwgTi52YWxpZGF0ZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBpZiAoIWUgfHwgIXQpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdvcHRzIGFuZCBzY2hlbWEgb2JqZWN0cyBhcmUgcmVxdWlyZWQnKTsKICAgICAgICAgICAgICAgIHZhciBuID0gayhCKHQpLCBmdW5jdGlvbiAobiwgcikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0W3JdLnZhbGlkYXRlKGVbcl0sIGUpID8gbiA6IG4uY29uY2F0KHsKICAgICAgICAgICAgICAgICAgICAgICAga2V5OiByLAogICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiB0W3JdLm1lc3NhZ2UsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlW3JdCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBbXSk7CiAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgIHZhbGlkOiAhbi5sZW5ndGgsCiAgICAgICAgICAgICAgICAgICAgZXJyb3JzOiBuCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwICYmICdzdHJpbmcnID09IHR5cGVvZiBlLmFwcC5yZWxlYXNlU3RhZ2UgPyBlLmFwcC5yZWxlYXNlU3RhZ2UgOiBlLmNvbmZpZy5yZWxlYXNlU3RhZ2U7CiAgICAgICAgICAgICAgICB9LCBxID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISghZSB8fCAhZS5zdGFjayAmJiAhZS5zdGFja3RyYWNlICYmICFlWydvcGVyYSNzb3VyY2Vsb2MnXSB8fCAnc3RyaW5nJyAhPSB0eXBlb2YgKGUuc3RhY2sgfHwgZS5zdGFja3RyYWNlIHx8IGVbJ29wZXJhI3NvdXJjZWxvYyddKSB8fCBlLnN0YWNrID09PSBlLm5hbWUgKyAnOiAnICsgZS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgIH0sIFQgPSB7fTsKICAgICAgICAgICAgIWZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAnb2JqZWN0JyA9PSB0eXBlb2YgVCA/IFQgPSB0KCkgOiBlLlN0YWNrRnJhbWUgPSB0KCk7CiAgICAgICAgICAgIH0odGhpcywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFpc05hTihwYXJzZUZsb2F0KGUpKSAmJiBpc0Zpbml0ZShlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNoYXJBdCgwKS50b1VwcGVyQ2FzZSgpICsgZS5zdWJzdHJpbmcoMSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1tlXTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUgaW5zdGFuY2VvZiBPYmplY3QpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgdS5sZW5ndGg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaGFzT3duUHJvcGVydHkodVtuXSkgJiYgZVt1W25dXSAhPT0gdW5kZWZpbmVkICYmIHRoaXNbJ3NldCcgKyB0KHVbbl0pXShlW3Vbbl1dKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBpID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnaXNDb25zdHJ1Y3RvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICdpc0V2YWwnLAogICAgICAgICAgICAgICAgICAgICAgICAnaXNOYXRpdmUnLAogICAgICAgICAgICAgICAgICAgICAgICAnaXNUb3BsZXZlbCcKICAgICAgICAgICAgICAgICAgICBdLCBvID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnY29sdW1uTnVtYmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xpbmVOdW1iZXInCiAgICAgICAgICAgICAgICAgICAgXSwgYSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2ZpbGVOYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uTmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdzb3VyY2UnCiAgICAgICAgICAgICAgICAgICAgXSwgcyA9IFsnYXJncyddLCB1ID0gaS5jb25jYXQobywgYSwgcyk7CiAgICAgICAgICAgICAgICByLnByb3RvdHlwZSA9IHsKICAgICAgICAgICAgICAgICAgICBnZXRBcmdzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmFyZ3M7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBzZXRBcmdzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ1tvYmplY3QgQXJyYXldJyAhPT0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQXJncyBtdXN0IGJlIGFuIEFycmF5Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYXJncyA9IGU7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBnZXRFdmFsT3JpZ2luOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmV2YWxPcmlnaW47CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBzZXRFdmFsT3JpZ2luOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSBpbnN0YW5jZW9mIHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmV2YWxPcmlnaW4gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiBPYmplY3QpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0V2YWwgT3JpZ2luIG11c3QgYmUgYW4gT2JqZWN0IG9yIFN0YWNrRnJhbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZXZhbE9yaWdpbiA9IG5ldyByKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB0b1N0cmluZzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHRoaXMuZ2V0RnVuY3Rpb25OYW1lKCkgfHwgJ3thbm9ueW1vdXN9JykgKyAoJygnICsgKHRoaXMuZ2V0QXJncygpIHx8IFtdKS5qb2luKCcsJykgKyAnKScpICsgKHRoaXMuZ2V0RmlsZU5hbWUoKSA/ICdAJyArIHRoaXMuZ2V0RmlsZU5hbWUoKSA6ICcnKSArIChlKHRoaXMuZ2V0TGluZU51bWJlcigpKSA/ICc6JyArIHRoaXMuZ2V0TGluZU51bWJlcigpIDogJycpICsgKGUodGhpcy5nZXRDb2x1bW5OdW1iZXIoKSkgPyAnOicgKyB0aGlzLmdldENvbHVtbk51bWJlcigpIDogJycpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IGkubGVuZ3RoOyBjKyspCiAgICAgICAgICAgICAgICAgICAgci5wcm90b3R5cGVbJ2dldCcgKyB0KGlbY10pXSA9IG4oaVtjXSksIHIucHJvdG90eXBlWydzZXQnICsgdChpW2NdKV0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbZV0gPSBCb29sZWFuKHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0oaVtjXSk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBmID0gMDsgZiA8IG8ubGVuZ3RoOyBmKyspCiAgICAgICAgICAgICAgICAgICAgci5wcm90b3R5cGVbJ2dldCcgKyB0KG9bZl0pXSA9IG4ob1tmXSksIHIucHJvdG90eXBlWydzZXQnICsgdChvW2ZdKV0gPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZShuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKHQgKyAnIG11c3QgYmUgYSBOdW1iZXInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbdF0gPSBOdW1iZXIobik7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfShvW2ZdKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSAwOyBkIDwgYS5sZW5ndGg7IGQrKykKICAgICAgICAgICAgICAgICAgICByLnByb3RvdHlwZVsnZ2V0JyArIHQoYVtkXSldID0gbihhW2RdKSwgci5wcm90b3R5cGVbJ3NldCcgKyB0KGFbZF0pXSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1tlXSA9IFN0cmluZyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KGFbZF0pOwogICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgQSA9IHt9OwogICAgICAgICAgICAhZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICdvYmplY3QnID09IHR5cGVvZiBBID8gQSA9IHQoVCkgOiBlLkVycm9yU3RhY2tQYXJzZXIgPSB0KGUuU3RhY2tGcmFtZSk7CiAgICAgICAgICAgIH0odGhpcywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciB0ID0gLyhefEApXFMrXDpcZCsvLCBuID0gL15ccyphdCAuKihcUytcOlxkK3xcKG5hdGl2ZVwpKS9tLCByID0gL14oZXZhbEApPyhcW25hdGl2ZSBjb2RlXF0pPyQvOwogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBwYXJzZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBlLnN0YWNrdHJhY2UgfHwgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGVbJ29wZXJhI3NvdXJjZWxvYyddKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucGFyc2VPcGVyYShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuc3RhY2sgJiYgZS5zdGFjay5tYXRjaChuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnBhcnNlVjhPcklFKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5zdGFjaykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnBhcnNlRkZPclNhZmFyaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdDYW5ub3QgcGFyc2UgZ2l2ZW4gRXJyb3Igb2JqZWN0Jyk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBleHRyYWN0TG9jYXRpb246IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtMSA9PT0gZS5pbmRleE9mKCc6JykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW2VdOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IC8oLis/KSg/Olw6KFxkKykpPyg/Olw6KFxkKykpPyQvLmV4ZWMoZS5yZXBsYWNlKC9bXChcKV0vZywgJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbMV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0WzJdIHx8IHVuZGVmaW5lZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbM10gfHwgdW5kZWZpbmVkCiAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBwYXJzZVY4T3JJRTogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuc3RhY2suc3BsaXQoJ1xuJykuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlLm1hdGNoKG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzKS5tYXAoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaW5kZXhPZignKGV2YWwgJykgPiAtMSAmJiAodCA9IHQucmVwbGFjZSgvZXZhbCBjb2RlL2csICdldmFsJykucmVwbGFjZSgvKFwoZXZhbCBhdCBbXlwoKV0qKXwoXClcLC4qJCkvZywgJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5yZXBsYWNlKC9eXHMrLywgJycpLnJlcGxhY2UoL1woZXZhbCBjb2RlL2csICcoJykuc3BsaXQoL1xzKy8pLnNsaWNlKDEpLCByID0gdGhpcy5leHRyYWN0TG9jYXRpb24obi5wb3AoKSksIGkgPSBuLmpvaW4oJyAnKSB8fCB1bmRlZmluZWQsIG8gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdldmFsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzxhbm9ueW1vdXM+JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uaW5kZXhPZihyWzBdKSA+IC0xID8gdW5kZWZpbmVkIDogclswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb25OYW1lOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVOYW1lOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVOdW1iZXI6IHJbMV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sdW1uTnVtYmVyOiByWzJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcGFyc2VGRk9yU2FmYXJpOiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5zdGFjay5zcGxpdCgnXG4nKS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZS5tYXRjaChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcykubWFwKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5pbmRleE9mKCcgPiBldmFsJykgPiAtMSAmJiAodCA9IHQucmVwbGFjZSgvIGxpbmUgKFxkKykoPzogPiBldmFsIGxpbmUgXGQrKSogPiBldmFsXDpcZCtcOlxkKy9nLCAnOiQxJykpLCAtMSA9PT0gdC5pbmRleE9mKCdAJykgJiYgLTEgPT09IHQuaW5kZXhPZignOicpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgZSh7IGZ1bmN0aW9uTmFtZTogdCB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gLygoLioiLisiW15AXSopP1teQF0qKSg/OkApLywgciA9IHQubWF0Y2gobiksIGkgPSByICYmIHJbMV0gPyByWzFdIDogdW5kZWZpbmVkLCBvID0gdGhpcy5leHRyYWN0TG9jYXRpb24odC5yZXBsYWNlKG4sICcnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uTmFtZTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxlTmFtZTogb1swXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5lTnVtYmVyOiBvWzFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbk51bWJlcjogb1syXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHBhcnNlT3BlcmE6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZS5zdGFja3RyYWNlIHx8IGUubWVzc2FnZS5pbmRleE9mKCdcbicpID4gLTEgJiYgZS5tZXNzYWdlLnNwbGl0KCdcbicpLmxlbmd0aCA+IGUuc3RhY2t0cmFjZS5zcGxpdCgnXG4nKS5sZW5ndGggPyB0aGlzLnBhcnNlT3BlcmE5KGUpIDogZS5zdGFjayA/IHRoaXMucGFyc2VPcGVyYTExKGUpIDogdGhpcy5wYXJzZU9wZXJhMTAoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBwYXJzZU9wZXJhOTogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IC9MaW5lIChcZCspLipzY3JpcHQgKD86aW4gKT8oXFMrKS9pLCByID0gdC5tZXNzYWdlLnNwbGl0KCdcbicpLCBpID0gW10sIG8gPSAyLCBhID0gci5sZW5ndGg7IG8gPCBhOyBvICs9IDIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gbi5leGVjKHJbb10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcyAmJiBpLnB1c2gobmV3IGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVOYW1lOiBzWzJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVOdW1iZXI6IHNbMV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiByW29dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBwYXJzZU9wZXJhMTA6IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAvTGluZSAoXGQrKS4qc2NyaXB0ICg/OmluICk/KFxTKykoPzo6IEluIGZ1bmN0aW9uIChcUyspKT8kL2ksIHIgPSB0LnN0YWNrdHJhY2Uuc3BsaXQoJ1xuJyksIGkgPSBbXSwgbyA9IDAsIGEgPSByLmxlbmd0aDsgbyA8IGE7IG8gKz0gMikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBuLmV4ZWMocltvXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzICYmIGkucHVzaChuZXcgZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb25OYW1lOiBzWzNdIHx8IHVuZGVmaW5lZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxlTmFtZTogc1syXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5lTnVtYmVyOiBzWzFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogcltvXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcGFyc2VPcGVyYTExOiBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5zdGFjay5zcGxpdCgnXG4nKS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWUubWF0Y2godCkgJiYgIWUubWF0Y2goL15FcnJvciBjcmVhdGVkIGF0Lyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMpLm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIgPSB0LnNwbGl0KCdAJyksIGkgPSB0aGlzLmV4dHJhY3RMb2NhdGlvbihyLnBvcCgpKSwgbyA9IHIuc2hpZnQoKSB8fCAnJywgYSA9IG8ucmVwbGFjZSgvPGFub255bW91cyBmdW5jdGlvbig6IChcdyspKT8+LywgJyQyJykucmVwbGFjZSgvXChbXlwpXSpcKS9nLCAnJykgfHwgdW5kZWZpbmVkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgby5tYXRjaCgvXCgoW15cKV0qKVwpLykgJiYgKG4gPSBvLnJlcGxhY2UoL15bXlwoXStcKChbXlwpXSopXCkkLywgJyQxJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBuID09PSB1bmRlZmluZWQgfHwgJ1thcmd1bWVudHMgbm90IGF2YWlsYWJsZV0nID09PSBuID8gdW5kZWZpbmVkIDogbi5zcGxpdCgnLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbk5hbWU6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJnczogcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxlTmFtZTogaVswXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5lTnVtYmVyOiBpWzFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbk51bWJlcjogaVsyXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIE0gPSB7fTsKICAgICAgICAgICAgIWZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAnb2JqZWN0JyA9PSB0eXBlb2YgTSA/IE0gPSB0KFQpIDogZS5TdGFja0dlbmVyYXRvciA9IHQoZS5TdGFja0ZyYW1lKTsKICAgICAgICAgICAgfSh0aGlzLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBiYWNrdHJhY2U6IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gW10sIHIgPSAxMDsKICAgICAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT0gdHlwZW9mIHQgJiYgJ251bWJlcicgPT0gdHlwZW9mIHQubWF4U3RhY2tTaXplICYmIChyID0gdC5tYXhTdGFja1NpemUpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gYXJndW1lbnRzLmNhbGxlZTsgaSAmJiBuLmxlbmd0aCA8IHIgJiYgaS5hcmd1bWVudHM7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gbmV3IEFycmF5KGkuYXJndW1lbnRzLmxlbmd0aCksIGEgPSAwOyBhIDwgby5sZW5ndGg7ICsrYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvW2FdID0gaS5hcmd1bWVudHNbYV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvZnVuY3Rpb24oPzpccysoW1x3JF0rKSkrXHMqXCgvLnRlc3QoaS50b1N0cmluZygpKSA/IG4ucHVzaChuZXcgZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb25OYW1lOiBSZWdFeHAuJDEgfHwgdW5kZWZpbmVkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3M6IG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSA6IG4ucHVzaChuZXcgZSh7IGFyZ3M6IG8gfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gaS5jYWxsZXI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBQID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgcikgJiYgKGVbcl0gPSBuW3JdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9LCBWID0gdy5yZWR1Y2UsIEggPSB3LmZpbHRlciwgVSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBhcmd1bWVudHMubGVuZ3RoID4gMiAmJiBhcmd1bWVudHNbMl0gIT09IHVuZGVmaW5lZCA/IGFyZ3VtZW50c1syXSA6IFtdLCBvID0gYXJndW1lbnRzLmxlbmd0aCA+IDMgJiYgYXJndW1lbnRzWzNdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbM10gOiBGKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHQodGhpcywgZSksIHRoaXMuX19pc0J1Z3NuYWdSZXBvcnQgPSAhMCwgdGhpcy5faWdub3JlZCA9ICExLCB0aGlzLl9oYW5kbGVkU3RhdGUgPSBvLCB0aGlzLmFwcCA9IHVuZGVmaW5lZCwgdGhpcy5hcGlLZXkgPSB1bmRlZmluZWQsIHRoaXMuYnJlYWRjcnVtYnMgPSBbXSwgdGhpcy5jb250ZXh0ID0gdW5kZWZpbmVkLCB0aGlzLmRldmljZSA9IHVuZGVmaW5lZCwgdGhpcy5lcnJvckNsYXNzID0gSyhuLCAnW25vIGVycm9yIGNsYXNzXScpLCB0aGlzLmVycm9yTWVzc2FnZSA9IEsociwgJ1tubyBlcnJvciBtZXNzYWdlXScpLCB0aGlzLmdyb3VwaW5nSGFzaCA9IHVuZGVmaW5lZCwgdGhpcy5tZXRhRGF0YSA9IHt9LCB0aGlzLnJlcXVlc3QgPSB1bmRlZmluZWQsIHRoaXMuc2V2ZXJpdHkgPSB0aGlzLl9oYW5kbGVkU3RhdGUuc2V2ZXJpdHksIHRoaXMuc3RhY2t0cmFjZSA9IFYoaSwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gSSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd7fScgPT09IEpTT04uc3RyaW5naWZ5KG4pID8gZSA6IGUuY29uY2F0KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LCBbXSksIHRoaXMudXNlciA9IHVuZGVmaW5lZCwgdGhpcy5zZXNzaW9uID0gdW5kZWZpbmVkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuaWdub3JlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9pZ25vcmVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuaXNJZ25vcmVkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5faWdub3JlZDsKICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS51cGRhdGVNZXRhRGF0YSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09PSAoYXJndW1lbnRzLmxlbmd0aCA8PSAxID8gdW5kZWZpbmVkIDogYXJndW1lbnRzWzFdKSA/IHRoaXMucmVtb3ZlTWV0YURhdGEoZSkgOiBudWxsID09PSAoYXJndW1lbnRzLmxlbmd0aCA8PSAyID8gdW5kZWZpbmVkIDogYXJndW1lbnRzWzJdKSA/IHRoaXMucmVtb3ZlTWV0YURhdGEoZSwgYXJndW1lbnRzLmxlbmd0aCA8PSAxID8gdW5kZWZpbmVkIDogYXJndW1lbnRzWzFdLCBhcmd1bWVudHMubGVuZ3RoIDw9IDIgPyB1bmRlZmluZWQgOiBhcmd1bWVudHNbMl0pIDogKCdvYmplY3QnID09IHR5cGVvZiAoYXJndW1lbnRzLmxlbmd0aCA8PSAxID8gdW5kZWZpbmVkIDogYXJndW1lbnRzWzFdKSAmJiAobiA9IGFyZ3VtZW50cy5sZW5ndGggPD0gMSA/IHVuZGVmaW5lZCA6IGFyZ3VtZW50c1sxXSksICdzdHJpbmcnID09IHR5cGVvZiAoYXJndW1lbnRzLmxlbmd0aCA8PSAxID8gdW5kZWZpbmVkIDogYXJndW1lbnRzWzFdKSAmJiAodCA9IHt9LCB0W2FyZ3VtZW50cy5sZW5ndGggPD0gMSA/IHVuZGVmaW5lZCA6IGFyZ3VtZW50c1sxXV0gPSBhcmd1bWVudHMubGVuZ3RoIDw9IDIgPyB1bmRlZmluZWQgOiBhcmd1bWVudHNbMl0sIG4gPSB0KSwgbiA/ICh0aGlzLm1ldGFEYXRhW2VdIHx8ICh0aGlzLm1ldGFEYXRhW2VdID0ge30pLCB0aGlzLm1ldGFEYXRhW2VdID0gUCh7fSwgdGhpcy5tZXRhRGF0YVtlXSwgbiksIHRoaXMpIDogdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUucmVtb3ZlTWV0YURhdGEgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgIT0gdHlwZW9mIGUgPyB0aGlzIDogdCA/IHRoaXMubWV0YURhdGFbZV0gPyAoZGVsZXRlIHRoaXMubWV0YURhdGFbZV1bdF0sIHRoaXMpIDogdGhpcyA6IChkZWxldGUgdGhpcy5tZXRhRGF0YVtlXSwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUudG9KU09OID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF5bG9hZFZlcnNpb246ICc0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4Y2VwdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yQ2xhc3M6IHRoaXMuZXJyb3JDbGFzcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogdGhpcy5lcnJvck1lc3NhZ2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrdHJhY2U6IHRoaXMuc3RhY2t0cmFjZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2Jyb3dzZXJqcycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldmVyaXR5OiB0aGlzLnNldmVyaXR5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5oYW5kbGVkOiB0aGlzLl9oYW5kbGVkU3RhdGUudW5oYW5kbGVkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V2ZXJpdHlSZWFzb246IHRoaXMuX2hhbmRsZWRTdGF0ZS5zZXZlcml0eVJlYXNvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwcDogdGhpcy5hcHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2U6IHRoaXMuZGV2aWNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWRjcnVtYnM6IHRoaXMuYnJlYWRjcnVtYnMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiB0aGlzLmNvbnRleHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VyOiB0aGlzLnVzZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRhRGF0YTogdGhpcy5tZXRhRGF0YSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdyb3VwaW5nSGFzaDogdGhpcy5ncm91cGluZ0hhc2gsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiB0aGlzLnJlcXVlc3QsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uOiB0aGlzLnNlc3Npb24KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfSgpLCBJID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgZmlsZTogZS5maWxlTmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAkKGUuZnVuY3Rpb25OYW1lKSwKICAgICAgICAgICAgICAgICAgICAgICAgbGluZU51bWJlcjogZS5saW5lTnVtYmVyLAogICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW5OdW1iZXI6IGUuY29sdW1uTnVtYmVyLAogICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiB1bmRlZmluZWQsCiAgICAgICAgICAgICAgICAgICAgICAgIGluUHJvamVjdDogdW5kZWZpbmVkCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5saW5lTnVtYmVyID4gLTEgJiYgIXQuZmlsZSAmJiAhdC5tZXRob2QgJiYgKHQuZmlsZSA9ICdnbG9iYWwgY29kZScpLCB0OwogICAgICAgICAgICAgICAgfSwgJCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC9eZ2xvYmFsIGNvZGUkL2kudGVzdChlKSA/ICdnbG9iYWwgY29kZScgOiBlOwogICAgICAgICAgICAgICAgfSwgRiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICB1bmhhbmRsZWQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICBzZXZlcml0eTogJ3dhcm5pbmcnLAogICAgICAgICAgICAgICAgICAgICAgICBzZXZlcml0eVJlYXNvbjogeyB0eXBlOiAnaGFuZGxlZEV4Y2VwdGlvbicgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBLID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgZSA/IGUgOiB0OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgVS5nZXRTdGFja3RyYWNlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgYXJndW1lbnRzWzFdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbMV0gOiAwLCBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgYXJndW1lbnRzWzJdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbMl0gOiAwOwogICAgICAgICAgICAgICAgcmV0dXJuIHEoZSkgPyBBLnBhcnNlKGUpLnNsaWNlKHQpIDogSChNLmJhY2t0cmFjZSgpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSA9PT0gKGUuZnVuY3Rpb25OYW1lIHx8ICcnKS5pbmRleE9mKCdTdGFja0dlbmVyYXRvciQkJyk7CiAgICAgICAgICAgICAgICB9KS5zbGljZSgxICsgbik7CiAgICAgICAgICAgIH0sIFUuZW5zdXJlUmVwb3J0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgYXJndW1lbnRzWzFdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbMV0gOiAwLCBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgYXJndW1lbnRzWzJdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbMl0gOiAwOwogICAgICAgICAgICAgICAgaWYgKGUuX19pc0J1Z3NuYWdSZXBvcnQpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gVS5nZXRTdGFja3RyYWNlKGUsIHQsIDEgKyBuKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFUoZS5uYW1lLCBlLm1lc3NhZ2UsIHIpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoaSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVShlLm5hbWUsIGUubWVzc2FnZSwgW10pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWCA9IFUsIEogPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gJzAwMDAwMDAwMCcgKyBlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnN1YnN0cihuLmxlbmd0aCAtIHQpOwogICAgICAgICAgICAgICAgfSwgeiA9ICdvYmplY3QnID09IHR5cGVvZiB3aW5kb3cgPyB3aW5kb3cgOiBzZWxmLCBHID0gMDsKICAgICAgICAgICAgZm9yICh2YXIgVyBpbiB6KQogICAgICAgICAgICAgICAgT2JqZWN0Lmhhc093blByb3BlcnR5LmNhbGwoeiwgVykgJiYgRysrOwogICAgICAgICAgICB2YXIgWSA9IG5hdmlnYXRvci5taW1lVHlwZXMgPyBuYXZpZ2F0b3IubWltZVR5cGVzLmxlbmd0aCA6IDAsIFogPSBKKChZICsgbmF2aWdhdG9yLnVzZXJBZ2VudC5sZW5ndGgpLnRvU3RyaW5nKDM2KSArIEcudG9TdHJpbmcoMzYpLCA0KSwgUSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gWjsKICAgICAgICAgICAgICAgIH0sIGVlID0gMCwgdGUgPSA0LCBuZSA9IDM2LCByZSA9IE1hdGgucG93KG5lLCB0ZSk7CiAgICAgICAgICAgIGkuZmluZ2VycHJpbnQgPSBROwogICAgICAgICAgICB2YXIgaWUgPSBpLCBvZSA9IHcuaXNvRGF0ZSwgYWUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbyh0aGlzLCBlKSwgdGhpcy5pZCA9IGllKCksIHRoaXMuc3RhcnRlZEF0ID0gb2UoKSwgdGhpcy5faGFuZGxlZCA9IDAsIHRoaXMuX3VuaGFuZGxlZCA9IDA7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS50b0pTT04gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogdGhpcy5pZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ZWRBdDogdGhpcy5zdGFydGVkQXQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVkOiB0aGlzLl9oYW5kbGVkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuaGFuZGxlZDogdGhpcy5fdW5oYW5kbGVkCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUudHJhY2tFcnJvciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbZS5faGFuZGxlZFN0YXRlLnVuaGFuZGxlZCA/ICdfdW5oYW5kbGVkJyA6ICdfaGFuZGxlZCddICs9IDE7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0oKSwgc2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnW29iamVjdCBFcnJvcl0nOgogICAgICAgICAgICAgICAgICAgIGNhc2UgJ1tvYmplY3QgRXhjZXB0aW9uXSc6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnW29iamVjdCBET01FeGNlcHRpb25dJzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIGluc3RhbmNlb2YgRXJyb3I7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdWUgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChuLCByKSAmJiAoZVtyXSA9IG5bcl0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0sIGNlID0gdy5tYXAsIGZlID0gdy5yZWR1Y2UsIGRlID0gdy5pbmNsdWRlcywgbGUgPSB3LmlzQXJyYXksIGdlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgfSwgcGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgYXJndW1lbnRzWzFdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbMV0gOiBOLnNjaGVtYSwgciA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIGFyZ3VtZW50c1syXSAhPT0gdW5kZWZpbmVkID8gYXJndW1lbnRzWzJdIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEodGhpcywgZSksICEodCAmJiB0Lm5hbWUgJiYgdC52ZXJzaW9uICYmIHQudXJsKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignYG5vdGlmaWVyYCBhcmd1bWVudCBpcyByZXF1aXJlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm5vdGlmaWVyID0gdCwgdGhpcy5jb25maWdTY2hlbWEgPSBuLCB0aGlzLl9jb25maWd1cmVkID0gITEsIHRoaXMuX3RyYW5zcG9ydCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRTZXNzaW9uOiBnZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRSZXBvcnQ6IGdlCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuX2xvZ2dlciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlYnVnOiBnZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZm86IGdlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2FybjogZ2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZ2UKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5wbHVnaW5zID0gW10sIHRoaXMuc2Vzc2lvbiA9IHIsIHRoaXMuYmVmb3JlU2Vzc2lvbiA9IFtdLCB0aGlzLmJyZWFkY3J1bWJzID0gW10sIHRoaXMuYXBwID0ge30sIHRoaXMuY29udGV4dCA9IHVuZGVmaW5lZCwgdGhpcy5kZXZpY2UgPSB1bmRlZmluZWQsIHRoaXMubWV0YURhdGEgPSB1bmRlZmluZWQsIHRoaXMucmVxdWVzdCA9IHVuZGVmaW5lZCwgdGhpcy51c2VyID0ge30sIHRoaXMuQnVnc25hZ1JlcG9ydCA9IFgsIHRoaXMuQnVnc25hZ0JyZWFkY3J1bWIgPSBPLCB0aGlzLkJ1Z3NuYWdTZXNzaW9uID0gYWU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS5jb25maWd1cmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgYXJndW1lbnRzWzBdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbMF0gOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25maWcgPSBOLm1lcmdlRGVmYXVsdHModWUoe30sIHRoaXMuY29uZmlnLCBlKSwgdGhpcy5jb25maWdTY2hlbWEpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE4udmFsaWRhdGUodGhpcy5jb25maWcsIHRoaXMuY29uZmlnU2NoZW1hKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEwID09ICF0LnZhbGlkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKHZlKHQuZXJyb3JzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09IHR5cGVvZiB0aGlzLmNvbmZpZy5iZWZvcmVTZW5kICYmICh0aGlzLmNvbmZpZy5iZWZvcmVTZW5kID0gW3RoaXMuY29uZmlnLmJlZm9yZVNlbmRdKSwgbnVsbCAhPT0gdGhpcy5jb25maWcuYXBwVmVyc2lvbiAmJiAodGhpcy5hcHAudmVyc2lvbiA9IHRoaXMuY29uZmlnLmFwcFZlcnNpb24pLCB0aGlzLmNvbmZpZy5tZXRhRGF0YSAmJiAodGhpcy5tZXRhRGF0YSA9IHRoaXMuY29uZmlnLm1ldGFEYXRhKSwgdGhpcy5jb25maWcudXNlciAmJiAodGhpcy51c2VyID0gdGhpcy5jb25maWcudXNlciksIHRoaXMuY29uZmlnLmxvZ2dlciAmJiB0aGlzLmxvZ2dlcih0aGlzLmNvbmZpZy5sb2dnZXIpLCB0aGlzLl9jb25maWd1cmVkID0gITAsIHRoaXMuX2xvZ2dlci5kZWJ1ZygnTG9hZGVkIScpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnVzZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnBsdWdpbnMucHVzaChlKSwgZS5pbml0KHRoaXMpOwogICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnRyYW5zcG9ydCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl90cmFuc3BvcnQgPSBlLCB0aGlzOwogICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLmxvZ2dlciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9sb2dnZXIgPSBlLCB0aGlzOwogICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnNlc3Npb25EZWxlZ2F0ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9zZXNzaW9uRGVsZWdhdGUgPSBlLCB0aGlzOwogICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnN0YXJ0U2Vzc2lvbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3Nlc3Npb25EZWxlZ2F0ZSA/IHRoaXMuX3Nlc3Npb25EZWxlZ2F0ZS5zdGFydFNlc3Npb24odGhpcykgOiAodGhpcy5fbG9nZ2VyLndhcm4oJ05vIHNlc3Npb24gaW1wbGVtZW50YXRpb24gaXMgaW5zdGFsbGVkJyksIHRoaXMpOwogICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLmxlYXZlQnJlYWRjcnVtYiA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdGhpcy5fY29uZmlndXJlZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignY2xpZW50IG5vdCBjb25maWd1cmVkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID0gZSB8fCB1bmRlZmluZWQsIG4gPSAnc3RyaW5nJyA9PSB0eXBlb2YgbiA/IG4gOiB1bmRlZmluZWQsIHIgPSAnc3RyaW5nJyA9PSB0eXBlb2YgciA/IHIgOiB1bmRlZmluZWQsIHQgPSAnb2JqZWN0JyA9PSB0eXBlb2YgdCAmJiBudWxsICE9PSB0ID8gdCA6IHVuZGVmaW5lZCwgJ3N0cmluZycgPT0gdHlwZW9mIGUgfHwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuZXcgTyhlLCB0LCBuLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmJyZWFkY3J1bWJzLnB1c2goaSksIHRoaXMuYnJlYWRjcnVtYnMubGVuZ3RoID4gdGhpcy5jb25maWcubWF4QnJlYWRjcnVtYnMgJiYgKHRoaXMuYnJlYWRjcnVtYnMgPSB0aGlzLmJyZWFkY3J1bWJzLnNsaWNlKHRoaXMuYnJlYWRjcnVtYnMubGVuZ3RoIC0gdGhpcy5jb25maWcubWF4QnJlYWRjcnVtYnMpKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLm5vdGlmeSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgYXJndW1lbnRzWzFdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbMV0gOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLl9jb25maWd1cmVkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdjbGllbnQgbm90IGNvbmZpZ3VyZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBDKHRoaXMpLCByID0gaGUoZSwgdCwgdGhpcy5fbG9nZ2VyKSwgaSA9IHIuZXJyLCBvID0gci5lcnJvckZyYW1lc1RvU2tpcCwgYSA9IHIuX29wdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhICYmICh0ID0gYSksICFpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHllKCdub3RoaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9sb2dnZXIud2FybignVXNhZ2UgZXJyb3IuICcgKyBzKSwgaSA9IG5ldyBFcnJvcignQnVnc25hZyB1c2FnZSBlcnJvci4gJyArIHMpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09IHR5cGVvZiB0ICYmIG51bGwgIT09IHQgfHwgKHQgPSB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gWC5lbnN1cmVSZXBvcnQoaSwgbywgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1LmFwcCA9IHVlKHsgcmVsZWFzZVN0YWdlOiBuIH0sIHUuYXBwLCB0aGlzLmFwcCksIHUuY29udGV4dCA9IHUuY29udGV4dCB8fCB0LmNvbnRleHQgfHwgdGhpcy5jb250ZXh0IHx8IHVuZGVmaW5lZCwgdS5kZXZpY2UgPSB1ZSh7fSwgdS5kZXZpY2UsIHRoaXMuZGV2aWNlLCB0LmRldmljZSksIHUucmVxdWVzdCA9IHVlKHt9LCB1LnJlcXVlc3QsIHRoaXMucmVxdWVzdCwgdC5yZXF1ZXN0KSwgdS51c2VyID0gdWUoe30sIHUudXNlciwgdGhpcy51c2VyLCB0LnVzZXIpLCB1Lm1ldGFEYXRhID0gdWUoe30sIHUubWV0YURhdGEsIHRoaXMubWV0YURhdGEsIHQubWV0YURhdGEpLCB1LmJyZWFkY3J1bWJzID0gdGhpcy5icmVhZGNydW1icy5zbGljZSgwKSwgdGhpcy5zZXNzaW9uICYmICh0aGlzLnNlc3Npb24udHJhY2tFcnJvcih1KSwgdS5zZXNzaW9uID0gdGhpcy5zZXNzaW9uKSwgdC5zZXZlcml0eSAhPT0gdW5kZWZpbmVkICYmICh1LnNldmVyaXR5ID0gdC5zZXZlcml0eSwgdS5faGFuZGxlZFN0YXRlLnNldmVyaXR5UmVhc29uID0geyB0eXBlOiAndXNlclNwZWNpZmllZFNldmVyaXR5JyB9KSwgbGUodGhpcy5jb25maWcubm90aWZ5UmVsZWFzZVN0YWdlcykgJiYgIWRlKHRoaXMuY29uZmlnLm5vdGlmeVJlbGVhc2VTdGFnZXMsIG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2xvZ2dlci53YXJuKCdSZXBvcnQgbm90IHNlbnQgZHVlIHRvIHJlbGVhc2VTdGFnZS9ub3RpZnlSZWxlYXNlU3RhZ2VzIGNvbmZpZ3VyYXRpb24nKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gdS5zZXZlcml0eSwgZiA9IFtdLmNvbmNhdCh0LmJlZm9yZVNlbmQpLmNvbmNhdCh0aGlzLmNvbmZpZy5iZWZvcmVTZW5kKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZlKGYsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGUgfHwgKCdmdW5jdGlvbicgPT0gdHlwZW9mIHQgJiYgITEgPT09IHQodSkgfHwgISF1LmlzSWdub3JlZCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgITEpID8gKHRoaXMuX2xvZ2dlci5kZWJ1ZygnUmVwb3J0IG5vdCBzZW50IGR1ZSB0byBiZWZvcmVTZW5kIGNhbGxiYWNrJyksICExKSA6ICh0aGlzLmNvbmZpZy5hdXRvQnJlYWRjcnVtYnMgJiYgdGhpcy5sZWF2ZUJyZWFkY3J1bWIodS5lcnJvckNsYXNzLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvckNsYXNzOiB1LmVycm9yQ2xhc3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvck1lc3NhZ2U6IHUuZXJyb3JNZXNzYWdlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V2ZXJpdHk6IHUuc2V2ZXJpdHkKICAgICAgICAgICAgICAgICAgICAgICAgfSwgJ2Vycm9yJyksIGMgIT09IHUuc2V2ZXJpdHkgJiYgKHUuX2hhbmRsZWRTdGF0ZS5zZXZlcml0eVJlYXNvbiA9IHsgdHlwZTogJ3VzZXJDYWxsYmFja1NldFNldmVyaXR5JyB9KSwgdGhpcy5fdHJhbnNwb3J0LnNlbmRSZXBvcnQodGhpcy5fbG9nZ2VyLCB0aGlzLmNvbmZpZywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBpS2V5OiB1LmFwaUtleSB8fCB0aGlzLmNvbmZpZy5hcGlLZXksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RpZmllcjogdGhpcy5ub3RpZmllciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3VdCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0oKSwgaGUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gdm9pZCAwLCBpID0gMCwgbyA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHR5cGVvZiBlKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnc3RyaW5nJzoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHllKCdzdHJpbmcvc3RyaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLndhcm4oJ1VzYWdlIGVycm9yLiAnICsgYSksIHIgPSBuZXcgRXJyb3IoJ0J1Z3NuYWcgdXNhZ2UgZXJyb3IuICcgKyBhKSwgbyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRhRGF0YTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RpZmllcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZ5QXJnczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gbmV3IEVycm9yKFN0cmluZyhlKSksIGkgKz0gMjsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbnVtYmVyJzoKICAgICAgICAgICAgICAgICAgICBjYXNlICdib29sZWFuJzoKICAgICAgICAgICAgICAgICAgICAgICAgciA9IG5ldyBFcnJvcihTdHJpbmcoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlICdmdW5jdGlvbic6CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0geWUoJ2Z1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIG4ud2FybignVXNhZ2UgZXJyb3IuICcgKyBzKSwgciA9IG5ldyBFcnJvcignQnVnc25hZyB1c2FnZSBlcnJvci4gJyArIHMpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlICdvYmplY3QnOgogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gZSAmJiAoc2UoZSkgfHwgZS5fX2lzQnVnc25hZ1JlcG9ydCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAobnVsbCAhPT0gZSAmJiBtZShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChyID0gbmV3IEVycm9yKGUubWVzc2FnZSB8fCBlLmVycm9yTWVzc2FnZSkpLm5hbWUgPSBlLm5hbWUgfHwgZS5lcnJvckNsYXNzLCBpICs9IDI7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSB5ZSgndW5zdXBwb3J0ZWQgb2JqZWN0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLndhcm4oJ1VzYWdlIGVycm9yLiAnICsgdSksIHIgPSBuZXcgRXJyb3IoJ0J1Z3NuYWcgdXNhZ2UgZXJyb3IuICcgKyB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICBlcnI6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yRnJhbWVzVG9Ta2lwOiBpLAogICAgICAgICAgICAgICAgICAgICAgICBfb3B0czogbwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBtZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoJ3N0cmluZycgIT0gdHlwZW9mIGUubmFtZSAmJiAnc3RyaW5nJyAhPSB0eXBlb2YgZS5lcnJvckNsYXNzIHx8ICdzdHJpbmcnICE9IHR5cGVvZiBlLm1lc3NhZ2UgJiYgJ3N0cmluZycgIT0gdHlwZW9mIGUuZXJyb3JNZXNzYWdlKTsKICAgICAgICAgICAgICAgIH0sIHZlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0J1Z3NuYWcgY29uZmlndXJhdGlvbiBlcnJvclxuJyArIGNlKGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnIicgKyBlLmtleSArICciICcgKyBlLm1lc3NhZ2UgKyAnIFxuICAgIGdvdCAnICsgYmUoZS52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgfSkuam9pbignXG5cbicpOwogICAgICAgICAgICAgICAgfSwgeWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnbm90aWZ5KCkgZXhwZWN0ZWQgZXJyb3Ivb3B0cyBwYXJhbWV0ZXJzLCBnb3QgJyArIGU7CiAgICAgICAgICAgICAgICB9LCBiZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnID09IHR5cGVvZiBlID8gSlNPTi5zdHJpbmdpZnkoZSkgOiBTdHJpbmcoZSk7CiAgICAgICAgICAgICAgICB9LCB3ZSA9IHBlLCBTZSA9IGoucG9zaXRpdmVJbnRJZkRlZmluZWQsIE9lID0gewogICAgICAgICAgICAgICAgICAgIGluaXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgZS5jb25maWcuYmVmb3JlU2VuZC5wdXNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA+PSBlLmNvbmZpZy5tYXhFdmVudHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uaWdub3JlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Kys7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlLnJlZnJlc2ggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGNvbmZpZ1NjaGVtYTogewogICAgICAgICAgICAgICAgICAgICAgICBtYXhFdmVudHM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnc2hvdWxkIGJlIGEgcG9zaXRpdmUgaW50ZWdlciBcdTIyNjQxMDAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRhdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNlKGUpICYmIGUgPCAxMDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBqZSA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG4sIHIpICYmIChlW3JdID0gbltyXSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfSwgRWUgPSBOLnNjaGVtYSwgTmUgPSB3Lm1hcCwgUmUgPSB7CiAgICAgICAgICAgICAgICAgICAgcmVsZWFzZVN0YWdlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC9ebG9jYWxob3N0KDpcZCspPyQvLnRlc3Qod2luZG93LmxvY2F0aW9uLmhvc3QpID8gJ2RldmVsb3BtZW50JyA6ICdwcm9kdWN0aW9uJzsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogJ3Nob3VsZCBiZSBzZXQnLAogICAgICAgICAgICAgICAgICAgICAgICB2YWxpZGF0ZTogai5zdHJpbmdXaXRoTGVuZ3RoCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBjb2xsZWN0VXNlcklwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnc2hvdWxkIGJlIHRydWV8ZmFsc2UnLAogICAgICAgICAgICAgICAgICAgICAgICB2YWxpZGF0ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gZSB8fCAhMSA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgbG9nZ2VyOiBqZSh7fSwgRWUubG9nZ2VyLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnICE9IHR5cGVvZiBjb25zb2xlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGNvbnNvbGUuZGVidWcgPyBrZSgpIDogdW5kZWZpbmVkOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgIH0sIGtlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0ge30sIHQgPSBjb25zb2xlLmxvZzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gTmUoWwogICAgICAgICAgICAgICAgICAgICAgICAnZGVidWcnLAogICAgICAgICAgICAgICAgICAgICAgICAnaW5mbycsCiAgICAgICAgICAgICAgICAgICAgICAgICd3YXJuJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2Vycm9yJwogICAgICAgICAgICAgICAgICAgIF0sIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gY29uc29sZVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgZVtuXSA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIHIgPyByLmJpbmQoY29uc29sZSwgJ1tidWdzbmFnXScpIDogdC5iaW5kKGNvbnNvbGUsICdbYnVnc25hZ10nKTsKICAgICAgICAgICAgICAgICAgICB9KSwgZTsKICAgICAgICAgICAgICAgIH0sIEJlID0ge30sIERlID0gdy5tYXAsIHhlID0gdy5yZWR1Y2UsIExlID0gdy5maWx0ZXI7CiAgICAgICAgICAgIEJlLmluaXQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgRGUoX2UsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBjb25zb2xlW3RdOwogICAgICAgICAgICAgICAgICAgIGNvbnNvbGVbdF0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSBhcmd1bWVudHMubGVuZ3RoLCBpID0gQXJyYXkociksIG8gPSAwOyBvIDwgcjsgbysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaVtvXSA9IGFyZ3VtZW50c1tvXTsKICAgICAgICAgICAgICAgICAgICAgICAgZS5sZWF2ZUJyZWFkY3J1bWIoJ0NvbnNvbGUgb3V0cHV0JywgeGUoaSwgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gU3RyaW5nKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdbb2JqZWN0IE9iamVjdF0nID09PSByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBKU09OLnN0cmluZ2lmeSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbJ1snICsgbiArICddJ10gPSByLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7IHNldmVyaXR5OiAwID09PSB0LmluZGV4T2YoJ2dyb3VwJykgPyAnbG9nJyA6IHQgfSksICdsb2cnKSwgbi5hcHBseShjb25zb2xlLCBpKTsKICAgICAgICAgICAgICAgICAgICB9LCBjb25zb2xlW3RdLl9yZXN0b3JlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlW3RdID0gbjsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sIEJlLmNvbmZpZ1NjaGVtYSA9IHsKICAgICAgICAgICAgICAgIGNvbnNvbGVCcmVhZGNydW1ic0VuYWJsZWQ6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGUgfHwgITEgPT09IGUgfHwgZSA9PT0gdW5kZWZpbmVkOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogJ3Nob3VsZCBiZSB0cnVlfGZhbHNlJwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgX2UgPSBMZShbCiAgICAgICAgICAgICAgICAgICAgJ2xvZycsCiAgICAgICAgICAgICAgICAgICAgJ2RlYnVnJywKICAgICAgICAgICAgICAgICAgICAnaW5mbycsCiAgICAgICAgICAgICAgICAgICAgJ3dhcm4nLAogICAgICAgICAgICAgICAgICAgICdlcnJvcicKICAgICAgICAgICAgICAgIF0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnICE9IHR5cGVvZiBjb25zb2xlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGNvbnNvbGVbZV07CiAgICAgICAgICAgICAgICB9KSwgQ2UgPSB7CiAgICAgICAgICAgICAgICAgICAgaW5pdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZS5jb25maWcuYmVmb3JlU2VuZC51bnNoaWZ0KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmNvbnRleHQgfHwgKGUuY29udGV4dCA9IHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHFlID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgcikgJiYgKGVbcl0gPSBuW3JdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9LCBUZSA9IHcuaXNvRGF0ZSwgQWUgPSB7CiAgICAgICAgICAgICAgICAgICAgaW5pdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZS5jb25maWcuYmVmb3JlU2VuZC51bnNoaWZ0KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmRldmljZSA9IHFlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lOiBUZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsZTogbmF2aWdhdG9yLmJyb3dzZXJMYW5ndWFnZSB8fCBuYXZpZ2F0b3Iuc3lzdGVtTGFuZ3VhZ2UgfHwgbmF2aWdhdG9yLnVzZXJMYW5ndWFnZSB8fCBuYXZpZ2F0b3IubGFuZ3VhZ2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlckFnZW50OiBuYXZpZ2F0b3IudXNlckFnZW50CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRldmljZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlLmJlZm9yZVNlc3Npb24ucHVzaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5kZXZpY2UgPSB7IHVzZXJBZ2VudDogbmF2aWdhdG9yLnVzZXJBZ2VudCB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBNZSA9IHt9LCBQZSA9IHcucmVkdWNlLCBWZSA9IC9eLio8c2NyaXB0Lio/Pi8sIEhlID0gLzxcL3NjcmlwdD4uKiQvLCBVZSA9IChNZSA9IHsKICAgICAgICAgICAgICAgICAgICBpbml0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICcnLCBuID0gITEsIHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5vdXRlckhUTUw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpID0gd2luZG93LmxvY2F0aW9uLmhyZWY7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgPSByKCksIGRvY3VtZW50Lm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbnRlcmFjdGl2ZScgPT09IGRvY3VtZW50LnJlYWR5U3RhdGUgJiYgKHQgPSByKCksIG4gPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuY29uZmlnLmJlZm9yZVNlbmQudW5zaGlmdChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlLnN0YWNrdHJhY2VbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8gfHwgIW8uZmlsZSB8fCAhby5saW5lTnVtYmVyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8uZmlsZS5yZXBsYWNlKC8jLiokLywgJycpICE9PSBpLnJlcGxhY2UoLyMuKiQvLCAnJykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIHQgfHwgKHQgPSByKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBbJzwhLS0gRE9DIFNUQVJUIC0tPiddLmNvbmNhdCh0LnNwbGl0KCdcbicpKSwgcyA9IFVlKGEsIG8ubGluZU51bWJlciAtIDEpLCB1ID0gcy5zY3JpcHQsIGMgPSBzLnN0YXJ0LCBmID0gUGUodSwgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGguYWJzKGMgKyBuICsgMSAtIG8ubGluZU51bWJlcikgPiAxMCA/IGUgOiAoZVsnJyArIChjICsgbiArIDEpXSA9IHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uY29kZSA9IGYsIGUudXBkYXRlTWV0YURhdGEoJ3NjcmlwdCcsIHsgY29udGVudDogdS5qb2luKCdcbicpIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KS5leHRyYWN0U2NyaXB0Q29udGVudCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IHQ7IG4gPCBlLmxlbmd0aCAmJiAhSGUudGVzdChlW25dKTspCiAgICAgICAgICAgICAgICAgICAgICAgIG4rKzsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gbjsgbiA+IDAgJiYgIVZlLnRlc3QoZVtuXSk7KQogICAgICAgICAgICAgICAgICAgICAgICBuLS07CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuLCBvID0gZS5zbGljZShpLCByICsgMSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9bMF0gPSBvWzBdLnJlcGxhY2UoVmUsICcnKSwgb1tvLmxlbmd0aCAtIDFdID0gb1tvLmxlbmd0aCAtIDFdLnJlcGxhY2UoSGUsICcnKSwgewogICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0OiBpCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIEllID0gewogICAgICAgICAgICAgICAgICAgIGluaXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICdhZGRFdmVudExpc3RlbmVyJyBpbiB3aW5kb3cgJiYgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdm9pZCAwLCByID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gJGUodC50YXJnZXQpLCByID0gcyh0LnRhcmdldCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICdbaGlkZGVuXScsIHIgPSAnW2hpZGRlbl0nLCBlLl9sb2dnZXIuZXJyb3IoJ0Nyb3NzIGRvbWFpbiBlcnJvciB3aGVuIHRyYWNraW5nIGNsaWNrIGV2ZW50LiBTZWUgZG9jczogaHR0cHM6Ly90aW55dXJsLmNvbS95OTRmcTV6bScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5sZWF2ZUJyZWFkY3J1bWIoJ1VJIGNsaWNrJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldFRleHQ6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0U2VsZWN0b3I6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICd1c2VyJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGNvbmZpZ1NjaGVtYTogewogICAgICAgICAgICAgICAgICAgICAgICBpbnRlcmFjdGlvbkJyZWFkY3J1bWJzRW5hYmxlZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWxpZGF0ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGUgfHwgITEgPT09IGUgfHwgZSA9PT0gdW5kZWZpbmVkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdzaG91bGQgYmUgdHJ1ZXxmYWxzZScKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sICRlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudGV4dENvbnRlbnQgfHwgZS5pbm5lclRleHQgfHwgJyc7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgfHwgJ3N1Ym1pdCcgIT09IGUudHlwZSAmJiAnYnV0dG9uJyAhPT0gZS50eXBlIHx8ICh0ID0gZS52YWx1ZSksIHQgPSB0LnJlcGxhY2UoL15ccyt8XHMrJC9nLCAnJyksIHUodCwgMTQwKTsKICAgICAgICAgICAgICAgIH0sIEZlID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgcikgJiYgKGVbcl0gPSBuW3JdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9LCBLZSA9IHsKICAgICAgICAgICAgICAgICAgICBpbml0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBlLmNvbmZpZy5jb2xsZWN0VXNlcklwIHx8IGUuY29uZmlnLmJlZm9yZVNlbmQucHVzaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS51c2VyID0gRmUoeyBpZDogJ1tOT1QgQ09MTEVDVEVEXScgfSwgZS51c2VyKSwgZS5yZXF1ZXN0ID0gRmUoeyBjbGllbnRJcDogJ1tOT1QgQ09MTEVDVEVEXScgfSwgZS5yZXF1ZXN0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgWGUgPSB7fTsKICAgICAgICAgICAgWGUuaW5pdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICBpZiAoJ2FkZEV2ZW50TGlzdGVuZXInIGluIHdpbmRvdykgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmxlYXZlQnJlYWRjcnVtYih0LCB7fSwgJ25hdmlnYXRpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdwYWdlaGlkZScsIHQoJ1BhZ2UgaGlkZGVuJyksICEwKSwgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoJ3BhZ2VzaG93JywgdCgnUGFnZSBzaG93bicpLCAhMCksIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgdCgnUGFnZSBsb2FkZWQnKSwgITApLCB3aW5kb3cuZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcignRE9NQ29udGVudExvYWRlZCcsIHQoJ0RPTUNvbnRlbnRMb2FkZWQnKSwgITApLCB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdwb3BzdGF0ZScsIHQoJ05hdmlnYXRlZCBiYWNrJyksICEwKTsKICAgICAgICAgICAgICAgICAgICB9KSwgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoJ2hhc2hjaGFuZ2UnLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQub2xkVVJMID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbTogSmUodC5vbGRVUkwpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdG86IEplKHQubmV3VVJMKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiBXZSgpCiAgICAgICAgICAgICAgICAgICAgICAgIH0gOiB7IHRvOiBKZSh3aW5kb3cubG9jYXRpb24uaHJlZikgfTsKICAgICAgICAgICAgICAgICAgICAgICAgZS5sZWF2ZUJyZWFkY3J1bWIoJ0hhc2ggY2hhbmdlZCcsIG4sICduYXZpZ2F0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgfSwgITApLCB3aW5kb3cuaGlzdG9yeS5yZXBsYWNlU3RhdGUgJiYgR2UoZSwgd2luZG93Lmhpc3RvcnksICdyZXBsYWNlU3RhdGUnKSwgd2luZG93Lmhpc3RvcnkucHVzaFN0YXRlICYmIEdlKGUsIHdpbmRvdy5oaXN0b3J5LCAncHVzaFN0YXRlJyksIGUubGVhdmVCcmVhZGNydW1iKCdCdWdzbmFnIGxvYWRlZCcsIHt9LCAnbmF2aWdhdGlvbicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LCBYZS5jb25maWdTY2hlbWEgPSB7CiAgICAgICAgICAgICAgICBuYXZpZ2F0aW9uQnJlYWRjcnVtYnNFbmFibGVkOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWQ7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB2YWxpZGF0ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBlIHx8ICExID09PSBlIHx8IGUgPT09IHVuZGVmaW5lZDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdzaG91bGQgYmUgdHJ1ZXxmYWxzZScKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEplID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ0EnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5ocmVmID0gZSwgJycgKyB0LnBhdGhuYW1lICsgdC5zZWFyY2ggKyB0Lmhhc2g7CiAgICAgICAgICAgICAgICB9LCB6ZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBKZSh3aW5kb3cubG9jYXRpb24uaHJlZik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBwcmV2U3RhdGU6IFdlKCksCiAgICAgICAgICAgICAgICAgICAgICAgIHRvOiBuIHx8IHIsCiAgICAgICAgICAgICAgICAgICAgICAgIGZyb206IHIKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgR2UgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gdFtuXTsKICAgICAgICAgICAgICAgICAgICB0W25dID0gZnVuY3Rpb24gKGksIG8sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZS5sZWF2ZUJyZWFkY3J1bWIoJ0hpc3RvcnkgJyArIG4sIHplKGksIG8sIGEpLCAnbmF2aWdhdGlvbicpLCAnZnVuY3Rpb24nID09IHR5cGVvZiBlLnJlZnJlc2ggJiYgZS5yZWZyZXNoKCksIGUuc2Vzc2lvbiAmJiBlLnN0YXJ0U2Vzc2lvbigpLCByLmFwcGx5KHQsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvCiAgICAgICAgICAgICAgICAgICAgICAgIF0uY29uY2F0KGEgIT09IHVuZGVmaW5lZCA/IGEgOiBbXSkpOwogICAgICAgICAgICAgICAgICAgIH0sIHRbbl0uX3Jlc3RvcmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRbbl0gPSByOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBXZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93Lmhpc3Rvcnkuc3RhdGU7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIFllID0ge30sIFplID0gJ3JlcXVlc3QnLCBRZSA9ICdCU35+VScsIGV0ID0gJ0JTfn5NJywgdHQgPSB3LmluY2x1ZGVzLCBudCA9IHZvaWQgMCwgcnQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnQuY29uZmlnLmVuZHBvaW50cy5ub3RpZnksCiAgICAgICAgICAgICAgICAgICAgICAgIG50LmNvbmZpZy5lbmRwb2ludHMuc2Vzc2lvbnMKICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgWWUuaW5pdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICBudCA9IGUsIGl0KCksIG90KCk7CiAgICAgICAgICAgIH0sIFllLmNvbmZpZ1NjaGVtYSA9IHsKICAgICAgICAgICAgICAgIG5ldHdvcmtCcmVhZGNydW1ic0VuYWJsZWQ6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGUgfHwgITEgPT09IGUgfHwgZSA9PT0gdW5kZWZpbmVkOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogJ3Nob3VsZCBiZSB0cnVlfGZhbHNlJwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF9jNDgwOTZmMWNkODdkOWFhID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0Jyk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYzQ4MDk2ZjFjZDg3ZDlhYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrX2I0NmIzYmI0NjQ0MmZjOTAuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnYWRkRXZlbnRMaXN0ZW5lcicgaW4gd2luZG93LlhNTEh0dHBSZXF1ZXN0LnByb3RvdHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gd2luZG93LlhNTEh0dHBSZXF1ZXN0LnByb3RvdHlwZS5vcGVuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5YTUxIdHRwUmVxdWVzdC5wcm90b3R5cGUub3BlbiA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbUWVdID0gbiwgdGhpc1tldF0gPSB0LCB0aGlzWydCU35+UyddICYmICh0aGlzLnJlbW92ZUV2ZW50TGlzdGVuZXIoJ2xvYWQnLCBjKSwgdGhpcy5yZW1vdmVFdmVudExpc3RlbmVyKCdlcnJvcicsIGYpKSwgdGhpcy5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgYyksIHRoaXMuYWRkRXZlbnRMaXN0ZW5lcignZXJyb3InLCBmKSwgdGhpc1snQlN+flMnXSA9ICEwLCBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2M0ODA5NmYxY2Q4N2Q5YWEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkX2M0ODA5NmYxY2Q4N2Q5YWEpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBvdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2ZldGNoJyBpbiB3aW5kb3cpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB3aW5kb3cuZmV0Y2g7CiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5mZXRjaCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoLCBuID0gQXJyYXkodCksIHIgPSAwOyByIDwgdDsgcisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bcl0gPSBhcmd1bWVudHNbcl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG5bMF0sIG8gPSBuWzFdLCBhID0gJ0dFVCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyAmJiBvLm1ldGhvZCAmJiAoYSA9IG8ubWV0aG9kKSwgbmV3IFByb21pc2UoZnVuY3Rpb24gKHQsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmFwcGx5KHVuZGVmaW5lZCwgbikudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdChlLCBhLCBpKSwgdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVsnY2F0Y2gnXShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdChhLCBpKSwgcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGF0ID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiBlLnN0YXR1cywKICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogdCArICcgJyArIG4KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGUuc3RhdHVzID49IDQwMCA/IG50LmxlYXZlQnJlYWRjcnVtYignZmV0Y2goKSBmYWlsZWQnLCByLCBaZSkgOiBudC5sZWF2ZUJyZWFkY3J1bWIoJ2ZldGNoKCkgc3VjY2VlZGVkJywgciwgWmUpOwogICAgICAgICAgICAgICAgfSwgc3QgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIG50LmxlYXZlQnJlYWRjcnVtYignZmV0Y2goKSBlcnJvcicsIHsgcmVxdWVzdDogZSArICcgJyArIHQgfSwgWmUpOwogICAgICAgICAgICAgICAgfSwgdXQgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChuLCByKSAmJiAoZVtyXSA9IG5bcl0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0sIGN0ID0gewogICAgICAgICAgICAgICAgICAgIGluaXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUuY29uZmlnLmJlZm9yZVNlbmQudW5zaGlmdChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5yZXF1ZXN0ICYmIGUucmVxdWVzdC51cmwgfHwgKGUucmVxdWVzdCA9IHV0KHt9LCBlLnJlcXVlc3QsIHsgdXJsOiB3aW5kb3cubG9jYXRpb24uaHJlZiB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGZ0ID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgcikgJiYgKGVbcl0gPSBuW3JdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9LCBkdCA9IHcubWFwLCBsdCA9IHcuaXNBcnJheSwgZ3QgPSB3LmluY2x1ZGVzLCBwdCA9IHsKICAgICAgICAgICAgICAgICAgICBpbml0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zZXNzaW9uRGVsZWdhdGUoaHQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGh0ID0gewogICAgICAgICAgICAgICAgICAgIHN0YXJ0U2Vzc2lvbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICB0LnNlc3Npb24gPSBuZXcgZS5CdWdzbmFnU2Vzc2lvbigpLCBkdCh0LmJlZm9yZVNlc3Npb24sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gQyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGx0KHQuY29uZmlnLm5vdGlmeVJlbGVhc2VTdGFnZXMpICYmICFndCh0LmNvbmZpZy5ub3RpZnlSZWxlYXNlU3RhZ2VzLCBuKSA/ICh0Ll9sb2dnZXIud2FybignU2Vzc2lvbiBub3Qgc2VudCBkdWUgdG8gcmVsZWFzZVN0YWdlL25vdGlmeVJlbGVhc2VTdGFnZXMgY29uZmlndXJhdGlvbicpLCB0KSA6IHQuY29uZmlnLmVuZHBvaW50cy5zZXNzaW9ucyA/ICh0Ll90cmFuc3BvcnQuc2VuZFNlc3Npb24odC5fbG9nZ2VyLCB0LmNvbmZpZywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZpZXI6IHQubm90aWZpZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2U6IHQuZGV2aWNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBwOiBmdCh7IHJlbGVhc2VTdGFnZTogbiB9LCB0LmFwcCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHQuc2Vzc2lvbi5pZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRlZEF0OiB0LnNlc3Npb24uc3RhcnRlZEF0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VyOiB0LnVzZXIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdCkgOiAodC5fbG9nZ2VyLndhcm4oJ1Nlc3Npb24gbm90IHNlbnQgZHVlIHRvIG1pc3NpbmcgZW5kcG9pbnRzLnNlc3Npb25zIGNvbmZpZ3VyYXRpb24nKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgbXQgPSB7fSwgdnQgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChuLCByKSAmJiAoZVtyXSA9IG5bcl0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0sIHl0ID0gdy5tYXAsIGJ0ID0gKG10ID0gewogICAgICAgICAgICAgICAgICAgIGluaXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUuY29uZmlnLmJlZm9yZVNlbmQucHVzaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zdGFja3RyYWNlID0geXQoZS5zdGFja3RyYWNlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2dCh7fSwgZSwgeyBmaWxlOiBidChlLmZpbGUpIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pLl9zdHJpcCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09IHR5cGVvZiBlID8gZS5yZXBsYWNlKC9cPy4qJC8sICcnKS5yZXBsYWNlKC8jLiokLywgJycpIDogZTsKICAgICAgICAgICAgICAgIH0sIHd0ID0ge30sIFN0ID0gdy5yZWR1Y2UsIE90ID0gdm9pZCAwOwogICAgICAgICAgICB3dC5pbml0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHZhciB0ID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQucmVhc29uLCByID0gITE7CiAgICAgICAgICAgICAgICAgICAgdC5kZXRhaWwgJiYgdC5kZXRhaWwucmVhc29uICYmIChuID0gdC5kZXRhaWwucmVhc29uLCByID0gITApOwogICAgICAgICAgICAgICAgICAgIHZhciBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V2ZXJpdHk6ICdlcnJvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bmhhbmRsZWQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V2ZXJpdHlSZWFzb246IHsgdHlwZTogJ3VuaGFuZGxlZFByb21pc2VSZWplY3Rpb24nIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgbyA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICBpZiAobiAmJiBxKG4pKQogICAgICAgICAgICAgICAgICAgICAgICBvID0gbmV3IGUuQnVnc25hZ1JlcG9ydChuLm5hbWUsIG4ubWVzc2FnZSwgQS5wYXJzZShuKSwgaSksIHIgJiYgKG8uc3RhY2t0cmFjZSA9IFN0KG8uc3RhY2t0cmFjZSwgRXQobiksIFtdKSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIChvID0gbmV3IGUuQnVnc25hZ1JlcG9ydChuICYmIG4ubmFtZSA/IG4ubmFtZSA6ICdVbmhhbmRsZWRSZWplY3Rpb24nLCBuICYmIG4ubWVzc2FnZSA/IG4ubWVzc2FnZSA6ICdSZWplY3Rpb24gcmVhc29uIHdhcyBub3QgYW4gRXJyb3IuIFNlZSAiUHJvbWlzZSIgdGFiIGZvciBtb3JlIGRldGFpbC4nLCBbXSwgaSkpLnVwZGF0ZU1ldGFEYXRhKCdwcm9taXNlJywgJ3JlamVjdGlvbiByZWFzb24nLCBqdChuKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGUubm90aWZ5KG8pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICdhZGRFdmVudExpc3RlbmVyJyBpbiB3aW5kb3cgPyB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigndW5oYW5kbGVkcmVqZWN0aW9uJywgdCkgOiB3aW5kb3cub251bmhhbmRsZWRyZWplY3Rpb24gPSBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgIHQoewogICAgICAgICAgICAgICAgICAgICAgICBkZXRhaWw6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYXNvbjogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb21pc2U6IG4KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgT3QgPSB0OwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIganQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBlIHx8IGUgPT09IHVuZGVmaW5lZCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQgKG9yIG51bGwpJzsKICAgICAgICAgICAgICAgICAgICBpZiAoc2UoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0ge30sIHRbT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGUubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6IGUubWVzc2FnZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6IGUuY29kZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrOiBlLnN0YWNrCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfSwgRXQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5maWxlID09PSBlLnRvU3RyaW5nKCkgPyB0IDogKG4ubWV0aG9kICYmIChuLm1ldGhvZCA9IG4ubWV0aG9kLnJlcGxhY2UoL15ccysvLCAnJykpLCB0LmNvbmNhdChuKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIE50ID0gewogICAgICAgICAgICAgICAgICAgIGluaXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gd2luZG93Lm9uZXJyb3I7CiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5vbmVycm9yID0gZnVuY3Rpb24gKG4sIHIsIGksIG8sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBpICYmIC9TY3JpcHQgZXJyb3JcLj8vLnRlc3QobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fbG9nZ2VyLndhcm4oJ0lnbm9yaW5nIGNyb3NzLWRvbWFpbiBvciBldmFsIHNjcmlwdCBlcnJvci4gU2VlIGRvY3M6IGh0dHBzOi8vdGlueXVybC5jb20veTk0ZnE1em0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V2ZXJpdHk6ICdlcnJvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bmhhbmRsZWQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V2ZXJpdHlSZWFzb246IHsgdHlwZTogJ3VuaGFuZGxlZEV4Y2VwdGlvbicgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB1ID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLm5hbWUgJiYgYS5tZXNzYWdlID8gdSA9IG5ldyBlLkJ1Z3NuYWdSZXBvcnQoYS5uYW1lLCBhLm1lc3NhZ2UsIFJ0KGUuQnVnc25hZ1JlcG9ydC5nZXRTdGFja3RyYWNlKGEpLCByLCBpLCBvKSwgcykgOiAodSA9IG5ldyBlLkJ1Z3NuYWdSZXBvcnQoJ3dpbmRvdy5vbmVycm9yJywgU3RyaW5nKGEpLCBSdChlLkJ1Z3NuYWdSZXBvcnQuZ2V0U3RhY2t0cmFjZShhLCAxKSwgciwgaSwgbyksIHMpKS51cGRhdGVNZXRhRGF0YSgnd2luZG93IG9uZXJyb3InLCB7IGVycm9yOiBhIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCdvYmplY3QnICE9IHR5cGVvZiBuIHx8IG51bGwgPT09IG4gfHwgciB8fCBpIHx8IG8gfHwgYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHUgPSBuZXcgZS5CdWdzbmFnUmVwb3J0KCd3aW5kb3cub25lcnJvcicsIFN0cmluZyhuKSwgUnQoZS5CdWdzbmFnUmVwb3J0LmdldFN0YWNrdHJhY2UoYSwgMSksIHIsIGksIG8pLCBzKSkudXBkYXRlTWV0YURhdGEoJ3dpbmRvdyBvbmVycm9yJywgeyBldmVudDogbiB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuLnR5cGUgPyAnRXZlbnQ6ICcgKyBuLnR5cGUgOiAnd2luZG93Lm9uZXJyb3InLCBmID0gbi5tZXNzYWdlIHx8IG4uZGV0YWlsIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodSA9IG5ldyBlLkJ1Z3NuYWdSZXBvcnQoYywgZiwgZS5CdWdzbmFnUmVwb3J0LmdldFN0YWNrdHJhY2UobmV3IEVycm9yKCksIDEpLnNsaWNlKDEpLCBzKSkudXBkYXRlTWV0YURhdGEoJ3dpbmRvdyBvbmVycm9yJywgeyBldmVudDogbiB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5ub3RpZnkodSksICdmdW5jdGlvbicgPT0gdHlwZW9mIHQgJiYgdChuLCByLCBpLCBvLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBSdCA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlWzBdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBpID8gKGkuZmlsZU5hbWUgfHwgaS5zZXRGaWxlTmFtZSh0KSwgaS5saW5lTnVtYmVyIHx8IGkuc2V0TGluZU51bWJlcihuKSwgaS5jb2x1bW5OdW1iZXIgfHwgKHIgIT09IHVuZGVmaW5lZCA/IGkuc2V0Q29sdW1uTnVtYmVyKHIpIDogd2luZG93LmV2ZW50ICYmIHdpbmRvdy5ldmVudC5lcnJvckNoYXJhY3RlciAmJiBpLnNldENvbHVtbk51bWJlcih3aW5kb3cuZXZlbnQgJiYgd2luZG93LmV2ZW50LmVycm9yQ2hhcmFjdGVyKSksIGUpIDogZTsKICAgICAgICAgICAgICAgIH0sIGt0ID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkoaChlKSwgdCwgbik7CiAgICAgICAgICAgICAgICB9LCBCdCA9IDIwLCBEdCA9IDI1MDAwLCB4dCA9IDgsIEx0ID0gJy4uLicsIF90ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGt0KGUpOwogICAgICAgICAgICAgICAgICAgIGlmICh0Lmxlbmd0aCA+IDEwMDAwMDAgJiYgKGRlbGV0ZSBlLmV2ZW50c1swXS5tZXRhRGF0YSwgZS5ldmVudHNbMF0ubWV0YURhdGEgPSB7IG5vdGlmaWVyOiAnV0FSTklORyFcblNlcmlhbGl6ZWQgcGF5bG9hZCB3YXMgJyArIHQubGVuZ3RoIC8gMTAwMDAwMCArICdNQiAobGltaXQgPSAxTUIpXG5tZXRhRGF0YSB3YXMgcmVtb3ZlZCcgfSwgKHQgPSBrdChlKSkubGVuZ3RoID4gMTAwMDAwMCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigncGF5bG9hZCBleGNlZWRlZCAxTUIgbGltaXQnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgIH0sIEN0ID0ge30sIHF0ID0gdy5pc29EYXRlOwogICAgICAgICAgICBDdCA9IHsKICAgICAgICAgICAgICAgIHNlbmRSZXBvcnQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBhcmd1bWVudHMubGVuZ3RoID4gMyAmJiBhcmd1bWVudHNbM10gIT09IHVuZGVmaW5lZCA/IGFyZ3VtZW50c1szXSA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSA9IFR0KHQsICdub3RpZnknLCAnNC4wJyksIG8gPSBuZXcgd2luZG93LlhEb21haW5SZXF1ZXN0KCk7CiAgICAgICAgICAgICAgICAgICAgby5vbmxvYWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHIobnVsbCwgby5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgIH0sIG8ub3BlbignUE9TVCcsIGkpLCBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uc2VuZChfdChuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXJyb3IodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBzZW5kU2Vzc2lvbjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGFyZ3VtZW50cy5sZW5ndGggPiAzICYmIGFyZ3VtZW50c1szXSAhPT0gdW5kZWZpbmVkID8gYXJndW1lbnRzWzNdIDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9LCBpID0gVHQodCwgJ3Nlc3Npb25zJywgJzEuMCcpLCBvID0gbmV3IHdpbmRvdy5YRG9tYWluUmVxdWVzdCgpOwogICAgICAgICAgICAgICAgICAgIG8ub25sb2FkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByKG51bGwsIG8ucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICB9LCBvLm9wZW4oJ1BPU1QnLCBpKSwgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLnNlbmQoa3QobikpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmVycm9yKHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBUdCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEF0KGUuZW5kcG9pbnRzW3RdLCB3aW5kb3cubG9jYXRpb24ucHJvdG9jb2wpICsgJz9hcGlLZXk9JyArIGVuY29kZVVSSUNvbXBvbmVudChlLmFwaUtleSkgKyAnJnBheWxvYWRWZXJzaW9uPScgKyBuICsgJyZzZW50QXQ9JyArIGVuY29kZVVSSUNvbXBvbmVudChxdCgpKTsKICAgICAgICAgICAgICAgIH0sIEF0ID0gQ3QuX21hdGNoUGFnZVByb3RvY29sID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2h0dHA6JyA9PT0gdCA/IGUucmVwbGFjZSgvXmh0dHBzOi8sICdodHRwOicpIDogZTsKICAgICAgICAgICAgICAgIH0sIE10ID0gdy5pc29EYXRlLCBQdCA9IHsKICAgICAgICAgICAgICAgICAgICBzZW5kUmVwb3J0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGFyZ3VtZW50cy5sZW5ndGggPiAzICYmIGFyZ3VtZW50c1szXSAhPT0gdW5kZWZpbmVkID8gYXJndW1lbnRzWzNdIDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0LmVuZHBvaW50cy5ub3RpZnksIG8gPSBuZXcgd2luZG93LlhNTEh0dHBSZXF1ZXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLnJlYWR5U3RhdGUgPT09IHdpbmRvdy5YTUxIdHRwUmVxdWVzdC5ET05FICYmIHIobnVsbCwgby5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgby5vcGVuKCdQT1NUJywgaSksIG8uc2V0UmVxdWVzdEhlYWRlcignQ29udGVudC1UeXBlJywgJ2FwcGxpY2F0aW9uL2pzb24nKSwgby5zZXRSZXF1ZXN0SGVhZGVyKCdCdWdzbmFnLUFwaS1LZXknLCBuLmFwaUtleSB8fCB0LmFwaUtleSksIG8uc2V0UmVxdWVzdEhlYWRlcignQnVnc25hZy1QYXlsb2FkLVZlcnNpb24nLCAnNC4wJyksIG8uc2V0UmVxdWVzdEhlYWRlcignQnVnc25hZy1TZW50LUF0JywgTXQoKSksIG8uc2VuZChfdChuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXJyb3IoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHNlbmRTZXNzaW9uOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkX2Y3NGM2OTRkYjgyYTIzODEgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKSwgJF9fX29sZF83MmJiMWZlMDEyODRjNWRjID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9mNzRjNjk0ZGI4MmEyMzgxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrX2I0NmIzYmI0NjQ0MmZjOTAuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzcyYmIxZmUwMTI4NGM1ZGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfYjQ2YjNiYjQ2NDQyZmM5MC5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGFyZ3VtZW50cy5sZW5ndGggPiAzICYmIGFyZ3VtZW50c1szXSAhPT0gdW5kZWZpbmVkID8gYXJndW1lbnRzWzNdIDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0LmVuZHBvaW50cy5zZXNzaW9ucywgbyA9IG5ldyB3aW5kb3cuWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkXzFhMzk3YWY5ZTE2ZGQ5MzUgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMWEzOTdhZjllMTZkZDkzNSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfYjQ2YjNiYjQ2NDQyZmM5MC5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8ucmVhZHlTdGF0ZSA9PT0gd2luZG93LlhNTEh0dHBSZXF1ZXN0LkRPTkUgJiYgcihudWxsLCBvLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8xYTM5N2FmOWUxNmRkOTM1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzFhMzk3YWY5ZTE2ZGQ5MzUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgby5vcGVuKCdQT1NUJywgaSksIG8uc2V0UmVxdWVzdEhlYWRlcignQ29udGVudC1UeXBlJywgJ2FwcGxpY2F0aW9uL2pzb24nKSwgby5zZXRSZXF1ZXN0SGVhZGVyKCdCdWdzbmFnLUFwaS1LZXknLCB0LmFwaUtleSksIG8uc2V0UmVxdWVzdEhlYWRlcignQnVnc25hZy1QYXlsb2FkLVZlcnNpb24nLCAnMS4wJyksIG8uc2V0UmVxdWVzdEhlYWRlcignQnVnc25hZy1TZW50LUF0JywgTXQoKSksIG8uc2VuZChrdChuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmVycm9yKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2Y3NGM2OTRkYjgyYTIzODEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX29sZF9mNzRjNjk0ZGI4MmEyMzgxKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF83MmJiMWZlMDEyODRjNWRjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfNzJiYjFmZTAxMjg0YzVkYykpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgVnQgPSB7fSwgSHQgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChuLCByKSAmJiAoZVtyXSA9IG5bcl0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0sIFV0ID0gdy5tYXAsIEl0ID0gdy5yZWR1Y2UsICR0ID0gSHQoe30sIE4uc2NoZW1hLCBSZSksIEZ0ID0gWwogICAgICAgICAgICAgICAgICAgIE50LAogICAgICAgICAgICAgICAgICAgIHd0LAogICAgICAgICAgICAgICAgICAgIEFlLAogICAgICAgICAgICAgICAgICAgIENlLAogICAgICAgICAgICAgICAgICAgIGN0LAogICAgICAgICAgICAgICAgICAgIE9lLAogICAgICAgICAgICAgICAgICAgIEJlLAogICAgICAgICAgICAgICAgICAgIFllLAogICAgICAgICAgICAgICAgICAgIFhlLAogICAgICAgICAgICAgICAgICAgIEllLAogICAgICAgICAgICAgICAgICAgIE1lLAogICAgICAgICAgICAgICAgICAgIHB0LAogICAgICAgICAgICAgICAgICAgIEtlLAogICAgICAgICAgICAgICAgICAgIG10CiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICBWdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIGFyZ3VtZW50c1sxXSAhPT0gdW5kZWZpbmVkID8gYXJndW1lbnRzWzFdIDogW107CiAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PSB0eXBlb2YgZSAmJiAoZSA9IHsgYXBpS2V5OiBlIH0pOwogICAgICAgICAgICAgICAgdmFyIG4gPSBbXTsKICAgICAgICAgICAgICAgIGUuc2Vzc2lvblRyYWNraW5nRW5hYmxlZCAmJiAobi5wdXNoKCdkZXByZWNhdGVkIG9wdGlvbiBzZXNzaW9uVHJhY2tpbmdFbmFibGVkIGlzIG5vdyBjYWxsZWQgYXV0b0NhcHR1cmVTZXNzaW9ucycpLCBlLmF1dG9DYXB0dXJlU2Vzc2lvbnMgPSBlLnNlc3Npb25UcmFja2luZ0VuYWJsZWQpLCAhZS5lbmRwb2ludCAmJiAhZS5zZXNzaW9uRW5kcG9pbnQgfHwgZS5lbmRwb2ludHMgfHwgKG4ucHVzaCgnZGVwcmVjYXRlZCBvcHRpb25zIGVuZHBvaW50L3Nlc3Npb25FbmRwb2ludCBhcmUgbm93IGNvbmZpZ3VyZWQgaW4gdGhlIGVuZHBvaW50cyBvYmplY3QnKSwgZS5lbmRwb2ludHMgPSB7CiAgICAgICAgICAgICAgICAgICAgbm90aWZ5OiBlLmVuZHBvaW50LAogICAgICAgICAgICAgICAgICAgIHNlc3Npb25zOiBlLnNlc3Npb25FbmRwb2ludAogICAgICAgICAgICAgICAgfSksIGUuZW5kcG9pbnRzICYmIGUuZW5kcG9pbnRzLm5vdGlmeSAmJiAhZS5lbmRwb2ludHMuc2Vzc2lvbnMgJiYgbi5wdXNoKCdub3RpZnkgZW5kcG9pbnQgaXMgc2V0IGJ1dCBzZXNzaW9ucyBlbmRwb2ludCBpcyBub3QuIE5vIHNlc3Npb25zIHdpbGwgYmUgc2VudC4nKTsKICAgICAgICAgICAgICAgIHZhciByID0gSXQoW10uY29uY2F0KEZ0KS5jb25jYXQodCksIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmNvbmZpZ1NjaGVtYSA/IEh0KHt9LCBlLCB0LmNvbmZpZ1NjaGVtYSkgOiBlOwogICAgICAgICAgICAgICAgICAgIH0sICR0KSwgaSA9IG5ldyB3ZSh7CiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdCdWdzbmFnIEphdmFTY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiAnNC43LjMnLAogICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL2dpdGh1Yi5jb20vYnVnc25hZy9idWdzbmFnLWpzJwogICAgICAgICAgICAgICAgICAgIH0sIHIpOwogICAgICAgICAgICAgICAgcmV0dXJuIGkudHJhbnNwb3J0KHdpbmRvdy5YRG9tYWluUmVxdWVzdCA/IEN0IDogUHQpLCBpLmNvbmZpZ3VyZShlKSwgVXQobiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5fbG9nZ2VyLndhcm4oZSk7CiAgICAgICAgICAgICAgICB9KSwgaS51c2UoQWUpLCBpLnVzZShDZSksIGkudXNlKGN0KSwgaS51c2UoTWUpLCBpLnVzZShPZSksIGkudXNlKHB0KSwgaS51c2UoS2UpLCBpLnVzZShtdCksICExICE9PSBpLmNvbmZpZy5hdXRvTm90aWZ5ICYmIChpLnVzZShOdCksIGkudXNlKHd0KSksIEt0KGkuY29uZmlnLCAnbmF2aWdhdGlvbkJyZWFkY3J1bWJzRW5hYmxlZCcpICYmIGkudXNlKFhlKSwgS3QoaS5jb25maWcsICdpbnRlcmFjdGlvbkJyZWFkY3J1bWJzRW5hYmxlZCcpICYmIGkudXNlKEllKSwgS3QoaS5jb25maWcsICduZXR3b3JrQnJlYWRjcnVtYnNFbmFibGVkJykgJiYgaS51c2UoWWUpLCBLdChpLmNvbmZpZywgJ2NvbnNvbGVCcmVhZGNydW1ic0VuYWJsZWQnLCAhMSkgJiYgaS51c2UoQmUpLCBVdCh0LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBpLnVzZShlKTsKICAgICAgICAgICAgICAgIH0pLCBpLmNvbmZpZy5hdXRvQ2FwdHVyZVNlc3Npb25zID8gaS5zdGFydFNlc3Npb24oKSA6IGk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBLdCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICB2YXIgbiA9ICEoYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgYXJndW1lbnRzWzJdICE9PSB1bmRlZmluZWQpIHx8IGFyZ3VtZW50c1syXTsKICAgICAgICAgICAgICAgIHJldHVybiAnYm9vbGVhbicgPT0gdHlwZW9mIGVbdF0gPyBlW3RdIDogZS5hdXRvQnJlYWRjcnVtYnMgJiYgKG4gfHwgIS9eZGV2KGVsb3BtZW50KT8kLy50ZXN0KGUucmVsZWFzZVN0YWdlKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHJldHVybiBWdC5CdWdzbmFnID0gewogICAgICAgICAgICAgICAgQ2xpZW50OiB3ZSwKICAgICAgICAgICAgICAgIFJlcG9ydDogWCwKICAgICAgICAgICAgICAgIFNlc3Npb246IGFlLAogICAgICAgICAgICAgICAgQnJlYWRjcnVtYjogTwogICAgICAgICAgICB9LCBWdFsnZGVmYXVsdCddID0gVnQsIFZ0OwogICAgICAgIH0pOwogICAgfSgpKQp9"},{"name":"sugarcoat-01f64c522910b028219e9cec1cc1847395faeead","aliases":[],"kind":{"mime":"application/javascript"},"content":"dmFyIGZkeF9pbml0U0NWYXJzLCBmZHhfZGVidWcsIGZkeF9zZXRDb29raWUsIGZkeF9nZXRDb29raWUsIGZkeF9jYW1wYWlnbiwgZmR4X2d1cCwgZmR4X2ZpcmVTRG90VCwgZmR4X2ZpcmVTRG90VEwsIGZkeF9zcFNyY2gsIGxvZ0xpbmtWaWV3LCBmZHhfbG9nTGlua1ZpZXcsIHNldExpbmtWaWV3LCBmZHhfc2V0TGlua1ZpZXcsIGZkeF9nZXRMaW5rVmlldywgZmR4X2xpbmtGb3JtYXQsIGZkeF90cmFja01hcHBpbmcsIGZkeF9sb2dEb3dubG9hZCwgbG9nUGFnZVZpZXcsIGZkeF9sb2dQYWdlVmlldywgbG9nUHVyY2hhc2UsIGZkeF9sb2dQdXJjaGFzZSwgZmR4X2xvZ1B1cmNoYXNlTUFHUywgaXNPYmplY3QsIGZkeF9sb2dQdXJjaGFzZV9QYWdlTGV2ZWwsIGZkeF9sb2dQdXJjaGFzZU1BR1IsIGZkeF9sb2dQdXJjaGFzZVdSRUcsIHByb2Nlc3NEYXRhLCBmZHhfY29udmVydFRvU3RyLCBmZHhfbG9nQ2hhdCwgc19kb1BsdWdpbnMsIGZkeF9pbml0UGx1Z2lucywgQXBwTWVhc3VyZW1lbnRfTW9kdWxlX0ludGVncmF0ZSwgQXBwTWVhc3VyZW1lbnRfTW9kdWxlX0F1ZGllbmNlTWFuYWdlbWVudCwgQXBwTWVhc3VyZW1lbnRfTW9kdWxlX0FjdGl2aXR5TWFwLCBBcHBNZWFzdXJlbWVudCwgc19naSwgc19wZ2ljcSwgZmR4X3J1blNDb2RlLCBmZHhfaW5pdFNDb2RlLCBmZHhfY3JlYXRlQ3VzdG9tRXZlbnQsIGZkeF9kaXNwYXRjaEN1c3RvbUV2ZW50LCBmZHhfZmlyZUN1c3RvbUV2ZW50LCBNQUdTRXZhck1hcHBpbmc7CnsKICAgIGNvbnN0ICRfX19tb2NrXzIxM2MyYzY5OGU1NzAyNzAgPSB7fTsKICAgIChleHBvcnRzID0+IHsKICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgbGV0IGlzU2VhbGVkID0gZmFsc2U7CiAgICAgICAgY2xhc3MgU3RvcmFnZSB7CiAgICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICAgICAgaWYgKGlzU2VhbGVkKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSWxsZWdhbCBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBsZW5ndGgoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXModGhpcykubGVuZ3RoOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGtleShpbmRleCkgewogICAgICAgICAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKHRoaXMpOwogICAgICAgICAgICAgICAgaWYgKGluZGV4IDwgMCB8fCBpbmRleCA+PSBrZXlzLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGtleXNbaW5kZXhdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldEl0ZW0oa2V5KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHRoaXMsIGtleSkgPyB0aGlzW2tleV0gOiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldEl0ZW0oa2V5LCB2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1trZXldID0gU3RyaW5nKHZhbHVlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZW1vdmVJdGVtKGtleSkgewogICAgICAgICAgICAgICAgZGVsZXRlIHRoaXNba2V5XTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjbGVhcigpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGtleXMgPSBPYmplY3Qua2V5cyh0aGlzKTsKICAgICAgICAgICAgICAgIGZvciAoY29uc3Qga2V5IG9mIGtleXMpIHsKICAgICAgICAgICAgICAgICAgICBkZWxldGUgdGhpc1trZXldOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGV4cG9ydHMuU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogU3RvcmFnZSwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgICAgIGNvbnN0IGxvY2FsU3RvcmFnZSA9IG5ldyBTdG9yYWdlKCk7CiAgICAgICAgZXhwb3J0cy5sb2NhbFN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZ2V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIGxvY2FsU3RvcmFnZTsKICAgICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgY29uc3Qgc2Vzc2lvblN0b3JhZ2UgPSBuZXcgU3RvcmFnZSgpOwogICAgICAgIGV4cG9ydHMuc2Vzc2lvblN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZ2V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHNlc3Npb25TdG9yYWdlOwogICAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICB9KSgkX19fbW9ja18yMTNjMmM2OThlNTcwMjcwKTsKICAgIGNvbnN0ICRfX19tb2NrXzNkMDQ5YmNmZWNmOTVlODkgPSB7fTsKICAgIChleHBvcnRzID0+IHsKICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgY29uc3QgeGhyVW5zZW50ID0gMDsKICAgICAgICBjb25zdCB4aHJPcGVuZWQgPSAxOwogICAgICAgIGNvbnN0IHhockhlYWRlcnNSZWNlaXZlZCA9IDI7CiAgICAgICAgY29uc3QgeGhyTG9hZGluZyA9IDM7CiAgICAgICAgY29uc3QgeGhyRG9uZSA9IDQ7CiAgICAgICAgY29uc3QgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wgPSBTeW1ib2woJ2RlZmVycmVkSGFuZGxlJyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkU3RhcnRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZHN0YXJ0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Qcm9ncmVzc1N5bWJvbCA9IFN5bWJvbCgnb25wcm9ncmVzcycpOwogICAgICAgIGNvbnN0IHhock9uQWJvcnRTeW1ib2wgPSBTeW1ib2woJ29uYWJvcnQnKTsKICAgICAgICBjb25zdCB4aHJPbkVycm9yU3ltYm9sID0gU3ltYm9sKCdvbmVycm9yJyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkU3ltYm9sID0gU3ltYm9sKCdvbmxvYWQnKTsKICAgICAgICBjb25zdCB4aHJPblRpbWVvdXRTeW1ib2wgPSBTeW1ib2woJ29udGltZW91dCcpOwogICAgICAgIGNvbnN0IHhock9uTG9hZEVuZFN5bWJvbCA9IFN5bWJvbCgnb25sb2FkZW5kJyk7CiAgICAgICAgY29uc3QgeGhyT25SZWFkeVN0YXRlQ2hhbmdlU3ltYm9sID0gU3ltYm9sKCdvbnJlYWR5c3RhdGVjaGFuZ2UnKTsKICAgICAgICBjb25zdCB4aHJSZWFkeVN0YXRlU3ltYm9sID0gU3ltYm9sKCdyZWFkeVN0YXRlJyk7CiAgICAgICAgY29uc3QgeGhyVGltZW91dFN5bWJvbCA9IFN5bWJvbCgndGltZW91dCcpOwogICAgICAgIGNvbnN0IHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCA9IFN5bWJvbCgnd2l0aENyZWRlbnRpYWxzJyk7CiAgICAgICAgY29uc3QgeGhyVXBsb2FkU3ltYm9sID0gU3ltYm9sKCd1cGxvYWQnKTsKICAgICAgICBjb25zdCB4aHJSZXNwb25zZVR5cGVTeW1ib2wgPSBTeW1ib2woJ3Jlc3BvbnNlVHlwZScpOwogICAgICAgIGNvbnN0IGRlZmluZUV2ZW50ID0gKG9iaiwgc3ltYm9sKSA9PiB7CiAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBzeW1ib2wuZGVzY3JpcHRpb24uc3Vic3RyaW5nKDIpOwogICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkob2JqLCBzeW1ib2wsIHsKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIG9iai5hZGRFdmVudExpc3RlbmVyKHR5cGUsIGZ1bmN0aW9uIChldmVudCkgewogICAgICAgICAgICAgICAgY29uc3QgaGFuZGxlciA9IHRoaXNbc3ltYm9sXTsKICAgICAgICAgICAgICAgIGlmIChoYW5kbGVyKSB7CiAgICAgICAgICAgICAgICAgICAgaGFuZGxlci5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICBjb25zdCBjaGFuZ2VSZWFkeVN0YXRlID0gKHhociwgcmVhZHlTdGF0ZSkgPT4gewogICAgICAgICAgICB4aHJbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPSByZWFkeVN0YXRlOwogICAgICAgICAgICB4aHIuZGlzcGF0Y2hFdmVudChuZXcgRXZlbnQoJ3JlYWR5c3RhdGVjaGFuZ2UnKSk7CiAgICAgICAgfTsKICAgICAgICBsZXQgaXNTZWFsZWQgPSB0cnVlOwogICAgICAgIGNsYXNzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgZXh0ZW5kcyBFdmVudFRhcmdldCB7CiAgICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICAgICAgc3VwZXIoKTsKICAgICAgICAgICAgICAgIGlmICghKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdCkgJiYgISh0aGlzIGluc3RhbmNlb2YgWE1MSHR0cFJlcXVlc3RVcGxvYWQpKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSWxsZWdhbCBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Mb2FkU3RhcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Qcm9ncmVzc1N5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkFib3J0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uRXJyb3JTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Mb2FkU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uVGltZW91dFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRFbmRTeW1ib2wpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmxvYWRzdGFydCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uTG9hZFN0YXJ0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2Fkc3RhcnQodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucHJvZ3Jlc3MoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPblByb2dyZXNzU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25wcm9ncmVzcyh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblByb2dyZXNzU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmFib3J0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25BYm9ydFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uYWJvcnQodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25BYm9ydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25lcnJvcigpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uRXJyb3JTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmVycm9yKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uRXJyb3JTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9udGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uVGltZW91dFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9udGltZW91dCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZGVuZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ubG9hZGVuZCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRFbmRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0ID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RVcGxvYWQgZXh0ZW5kcyBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBpZiAoaXNTZWFsZWQpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3RVcGxvYWQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0VXBsb2FkLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3QgZXh0ZW5kcyBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaXNTZWFsZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgIGNvbnN0IHhoclVwbG9hZCA9IG5ldyBYTUxIdHRwUmVxdWVzdFVwbG9hZCgpOwogICAgICAgICAgICAgICAgaXNTZWFsZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhockRlZmVycmVkSGFuZGxlU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbnVsbCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhoclJlYWR5U3RhdGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhoclRpbWVvdXRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAwLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJXaXRoQ3JlZGVudGlhbHNTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVXBsb2FkU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogeGhyVXBsb2FkLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVzcG9uc2VUeXBlU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbnJlYWR5c3RhdGVjaGFuZ2UoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnJlYWR5c3RhdGVjaGFuZ2UodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25SZWFkeVN0YXRlQ2hhbmdlU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZWFkeVN0YXRlKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgb3BlbihtZXRob2QsIHVybCkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyRG9uZTogewogICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhock9wZW5lZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRSZXF1ZXN0SGVhZGVyKG5hbWUsIHZhbHVlKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0VHJ1c3RUb2tlbih0cnVzdFRva2VuKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHRpbWVvdXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJUaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgdGltZW91dCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJUaW1lb3V0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCB3aXRoQ3JlZGVudGlhbHMoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJXaXRoQ3JlZGVudGlhbHNTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB3aXRoQ3JlZGVudGlhbHModmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJVbnNlbnQ6CiAgICAgICAgICAgICAgICBjYXNlIHhock9wZW5lZDogewogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZhdWx0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwnd2l0aENyZWRlbnRpYWxzXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgbWF5IG9ubHkgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgVU5TRU5UIG9yIE9QRU5FRC4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF0gPSAhIXZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCB1cGxvYWQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJVcGxvYWRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNlbmQoKSB7CiAgICAgICAgICAgICAgICBpZiAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSA9PT0geGhyT3BlbmVkICYmIHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdID09PSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBzZXRUaW1lb3V0KCgpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhockRvbmUpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Vycm9yJykpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2xvYWRlbmQnKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgMCk7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBleGVjdXRlIFwnc2VuZFwnIG9uIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIG9iamVjdFwncyBzdGF0ZSBtdXN0IGJlIE9QRU5FRC4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBhYm9ydCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gIT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQodGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0pOwogICAgICAgICAgICAgICAgICAgIHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhoclVuc2VudCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCdhYm9ydCcpKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2xvYWRlbmQnKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlVVJMKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXMoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgc3RhdHVzVGV4dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXRSZXNwb25zZUhlYWRlcihuYW1lKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBvdmVycmlkZU1pbWVUeXBlKG1pbWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUeXBlKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgcmVzcG9uc2VUeXBlKHZhbHVlKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyRG9uZTogewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCdGYWlsZWQgdG8gc2V0IHRoZSBcJ3Jlc3BvbnNlVHlwZVwnIHByb3BlcnR5IG9uIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIHJlc3BvbnNlIHR5cGUgY2Fubm90IGJlIHNldCBpZiB0aGUgb2JqZWN0XCdzIHN0YXRlIGlzIExPQURJTkcgb3IgRE9ORS4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHZhbHVlKSB7CiAgICAgICAgICAgICAgICBjYXNlICcnOgogICAgICAgICAgICAgICAgY2FzZSAnYXJyYXlidWZmZXInOgogICAgICAgICAgICAgICAgY2FzZSAnYmxvYic6CiAgICAgICAgICAgICAgICBjYXNlICdkb2N1bWVudCc6CiAgICAgICAgICAgICAgICBjYXNlICdqc29uJzoKICAgICAgICAgICAgICAgIGNhc2UgJ3RleHQnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlKCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgcmV0dXJuIHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcgPyAnJyA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlVGV4dCgpIHsKICAgICAgICAgICAgICAgIGNvbnN0IHJlc3BvbnNlVHlwZSA9IHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXTsKICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZVR5cGUgPT09ICcnIHx8IHJlc3BvbnNlVHlwZSA9PT0gJ3RleHQnKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCdGYWlsZWQgdG8gcmVhZCB0aGUgXCdyZXNwb25zZVRleHRcJyBwcm9wZXJ0eSBmcm9tIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIHZhbHVlIGlzIG9ubHkgYWNjZXNzaWJsZSBpZiB0aGUgb2JqZWN0XCdzIFwncmVzcG9uc2VUeXBlXCcgaXMgXCdcJyBvciBcJ3RleHRcJyAod2FzIFwnYXJyYXlidWZmZXJcJykuJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlWE1MKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnVU5TRU5UJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyVW5zZW50CiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnT1BFTkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyT3BlbmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnSEVBREVSU19SRUNFSVZFRCcsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockhlYWRlcnNSZWNlaXZlZAogICAgICAgIH0pOwogICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShYTUxIdHRwUmVxdWVzdCwgJ0xPQURJTkcnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJMb2FkaW5nCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnRE9ORScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockRvbmUKICAgICAgICB9KTsKICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0ID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBYTUxIdHRwUmVxdWVzdCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgfSkoJF9fX21vY2tfM2QwNDliY2ZlY2Y5NWU4OSk7CiAgICAoZnVuY3Rpb24gKCkgewogICAgICAgIGZkeF9pbml0U0NWYXJzID0gJF9fX3Zhcl85ZTY5NDg5NDJhNzAxYzVlOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfaW5pdFNDVmFycywgJ25hbWUnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIHZhbHVlOiAnZmR4X2luaXRTQ1ZhcnMnLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgZmR4X2RlYnVnID0gJF9fX3Zhcl84NTZlZTNjZjJjN2QxZmMzOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfZGVidWcsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9kZWJ1ZycsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBmZHhfc2V0Q29va2llID0gJF9fX3Zhcl83OWMwNTJjODY5MzUyYWRhOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfc2V0Q29va2llLCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdmZHhfc2V0Q29va2llJywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIGZkeF9nZXRDb29raWUgPSAkX19fdmFyXzllMTU1ZjQ5OTgyZDZjODE7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KGZkeF9nZXRDb29raWUsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9nZXRDb29raWUnLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgZmR4X2NhbXBhaWduID0gJF9fX3Zhcl83MjRjZGViMDI1ZDgxNTQzOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfY2FtcGFpZ24sICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9jYW1wYWlnbicsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBmZHhfZ3VwID0gJF9fX3Zhcl9iN2VjZjUwMmZjZjFiNjMyOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfZ3VwLCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdmZHhfZ3VwJywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIGZkeF9maXJlU0RvdFQgPSAkX19fdmFyX2EwNzQ3NjY4OGQ0MDIwYWI7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KGZkeF9maXJlU0RvdFQsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9maXJlU0RvdFQnLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgZmR4X2ZpcmVTRG90VEwgPSAkX19fdmFyXzQ5MTBhMzVmZjcyNDcwY2E7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KGZkeF9maXJlU0RvdFRMLCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdmZHhfZmlyZVNEb3RUTCcsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBmZHhfc3BTcmNoID0gJF9fX3Zhcl82MzI5Yzk4Zjk3Mjk4Y2MyOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfc3BTcmNoLCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdmZHhfc3BTcmNoJywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIGxvZ0xpbmtWaWV3ID0gJF9fX3Zhcl8wMGQxZDA3NmUwOGNmOWE4OwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShsb2dMaW5rVmlldywgJ25hbWUnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIHZhbHVlOiAnbG9nTGlua1ZpZXcnLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgZmR4X2xvZ0xpbmtWaWV3ID0gJF9fX3Zhcl84NjA4YzQwMzY3MWM2YTJjOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfbG9nTGlua1ZpZXcsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9sb2dMaW5rVmlldycsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBzZXRMaW5rVmlldyA9ICRfX192YXJfYjg3MTM0N2Q5YjYxYzIxZTsKICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkoc2V0TGlua1ZpZXcsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ3NldExpbmtWaWV3JywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIGZkeF9zZXRMaW5rVmlldyA9ICRfX192YXJfZTkxYzliZmVlZGNjNmQ3YzsKICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkoZmR4X3NldExpbmtWaWV3LCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdmZHhfc2V0TGlua1ZpZXcnLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgZmR4X2dldExpbmtWaWV3ID0gJF9fX3Zhcl82NmNhYjhjNWQ3MThjMDNhOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfZ2V0TGlua1ZpZXcsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9nZXRMaW5rVmlldycsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBmZHhfbGlua0Zvcm1hdCA9ICRfX192YXJfODMwYTcyNjBlMzQ1NGE3YjsKICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkoZmR4X2xpbmtGb3JtYXQsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9saW5rRm9ybWF0JywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIGZkeF90cmFja01hcHBpbmcgPSAkX19fdmFyXzRjNDJkMjllMDY5NTdiMGE7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KGZkeF90cmFja01hcHBpbmcsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF90cmFja01hcHBpbmcnLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgZmR4X2xvZ0Rvd25sb2FkID0gJF9fX3Zhcl9iNTRjOWIyYWQ1MzczYTQxOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfbG9nRG93bmxvYWQsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9sb2dEb3dubG9hZCcsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBsb2dQYWdlVmlldyA9ICRfX192YXJfZmE0ZDRjZTczYzc1ZTQ5MDsKICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkobG9nUGFnZVZpZXcsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2xvZ1BhZ2VWaWV3JywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIGZkeF9sb2dQYWdlVmlldyA9ICRfX192YXJfZTgzOGZlNzE4ZTc3MWJmOTsKICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkoZmR4X2xvZ1BhZ2VWaWV3LCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdmZHhfbG9nUGFnZVZpZXcnLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgbG9nUHVyY2hhc2UgPSAkX19fdmFyXzM5MzE4NjJjNDhiZmIxMzk7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KGxvZ1B1cmNoYXNlLCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdsb2dQdXJjaGFzZScsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBmZHhfbG9nUHVyY2hhc2UgPSAkX19fdmFyX2MxYjA5YTAxOGE4MWRhYjk7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KGZkeF9sb2dQdXJjaGFzZSwgJ25hbWUnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIHZhbHVlOiAnZmR4X2xvZ1B1cmNoYXNlJywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIGZkeF9sb2dQdXJjaGFzZU1BR1MgPSAkX19fdmFyXzhiNDRiMDBhODMwZDlkMTE7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KGZkeF9sb2dQdXJjaGFzZU1BR1MsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9sb2dQdXJjaGFzZU1BR1MnLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgaXNPYmplY3QgPSAkX19fdmFyXzk0YTc1MzZmYTQ2OWY1ZjA7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KGlzT2JqZWN0LCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdpc09iamVjdCcsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBmZHhfbG9nUHVyY2hhc2VfUGFnZUxldmVsID0gJF9fX3Zhcl8zYTE1ZjllNzA0NjY1NmJhOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfbG9nUHVyY2hhc2VfUGFnZUxldmVsLCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdmZHhfbG9nUHVyY2hhc2VfUGFnZUxldmVsJywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIGZkeF9sb2dQdXJjaGFzZU1BR1IgPSAkX19fdmFyX2RjYTNhMDZmMDQ5OGNjZjk7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KGZkeF9sb2dQdXJjaGFzZU1BR1IsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9sb2dQdXJjaGFzZU1BR1InLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgZmR4X2xvZ1B1cmNoYXNlV1JFRyA9ICRfX192YXJfYTMyM2RmODJiMDE0OWJiMDsKICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkoZmR4X2xvZ1B1cmNoYXNlV1JFRywgJ25hbWUnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIHZhbHVlOiAnZmR4X2xvZ1B1cmNoYXNlV1JFRycsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBwcm9jZXNzRGF0YSA9ICRfX192YXJfN2UyZWNjYzY0MGIwYjNlMjsKICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkocHJvY2Vzc0RhdGEsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ3Byb2Nlc3NEYXRhJywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIGZkeF9jb252ZXJ0VG9TdHIgPSAkX19fdmFyX2E0M2Q4NDY4ODc3ZGU1NGQ7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KGZkeF9jb252ZXJ0VG9TdHIsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9jb252ZXJ0VG9TdHInLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgZmR4X2xvZ0NoYXQgPSAkX19fdmFyX2QwNTdlYzBlYjJiYWI0MDc7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KGZkeF9sb2dDaGF0LCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdmZHhfbG9nQ2hhdCcsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBzX2RvUGx1Z2lucyA9ICRfX192YXJfNTg0ZmUzYjdhNWJjZThkMTsKICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkoc19kb1BsdWdpbnMsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ3NfZG9QbHVnaW5zJywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIGZkeF9pbml0UGx1Z2lucyA9ICRfX192YXJfODA4MzdkM2NlODI2NjAyZDsKICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkoZmR4X2luaXRQbHVnaW5zLCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdmZHhfaW5pdFBsdWdpbnMnLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgQXBwTWVhc3VyZW1lbnRfTW9kdWxlX0ludGVncmF0ZSA9ICRfX192YXJfYjlkMDQ2ZWYzN2FmZjE4OTsKICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkoQXBwTWVhc3VyZW1lbnRfTW9kdWxlX0ludGVncmF0ZSwgJ25hbWUnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIHZhbHVlOiAnQXBwTWVhc3VyZW1lbnRfTW9kdWxlX0ludGVncmF0ZScsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBBcHBNZWFzdXJlbWVudF9Nb2R1bGVfQXVkaWVuY2VNYW5hZ2VtZW50ID0gJF9fX3Zhcl82NGU4NzQ2ZjUzMTA4OTRhOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShBcHBNZWFzdXJlbWVudF9Nb2R1bGVfQXVkaWVuY2VNYW5hZ2VtZW50LCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdBcHBNZWFzdXJlbWVudF9Nb2R1bGVfQXVkaWVuY2VNYW5hZ2VtZW50JywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIEFwcE1lYXN1cmVtZW50X01vZHVsZV9BY3Rpdml0eU1hcCA9ICRfX192YXJfOWM1OWExODVkNGJkMWZlYzsKICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkoQXBwTWVhc3VyZW1lbnRfTW9kdWxlX0FjdGl2aXR5TWFwLCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdBcHBNZWFzdXJlbWVudF9Nb2R1bGVfQWN0aXZpdHlNYXAnLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgQXBwTWVhc3VyZW1lbnQgPSAkX19fdmFyX2FkN2I1OTE0YmMzMDA0Y2I7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KEFwcE1lYXN1cmVtZW50LCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdBcHBNZWFzdXJlbWVudCcsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBzX2dpID0gJF9fX3Zhcl9lNzlmMzJjOTgzOTRlODJhOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShzX2dpLCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdzX2dpJywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIHNfcGdpY3EgPSAkX19fdmFyXzA4YzQ1ZjE3MmJkZTM4ZmQ7CiAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHNfcGdpY3EsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ3NfcGdpY3EnLAogICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KSk7CiAgICAgICAgZmR4X3J1blNDb2RlID0gJF9fX3Zhcl85MjA2MjkyY2JmZmY3OTI5OwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfcnVuU0NvZGUsICduYW1lJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB2YWx1ZTogJ2ZkeF9ydW5TQ29kZScsCiAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pKTsKICAgICAgICBmZHhfaW5pdFNDb2RlID0gJF9fX3Zhcl84YWM1YzdiMzE0YjhjMDUyOwogICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eShmZHhfaW5pdFNDb2RlLCAnbmFtZScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgdmFsdWU6ICdmZHhfaW5pdFNDb2RlJywKICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSkpOwogICAgICAgIGZ1bmN0aW9uICRfX192YXJfOWU2OTQ4OTQyYTcwMWM1ZSgpIHsKICAgICAgICAgICAgd2luZG93LnNjX2NvZGVfdmVyID0gJzMuMC40MCcsIHdpbmRvdy5zY19jb2RlX3Zlcl9kYXRlID0gJzA2MTUyMDIxLjAxJywgd2luZG93LnNfdmVyc2lvbiA9ICdBTS4yLjIyLjAnLCB3aW5kb3cuc19hY2NvdW50ID0gJ2ZlZGV4Z2xibGRldicsICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpLCB3aW5kb3cud3d3SG9zdCA9IF9mZHgucGNmVXRpbCgpLCAnd3d3LmZlZGV4LmNvbScgPT0gd3d3SG9zdCAmJiAoc19hY2NvdW50ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ3NBY2NvdW50JykpLCB3aW5kb3cucyA9IHNfZ2koc19hY2NvdW50KSwgcy5wYWdlTG9hZENvbXBsZXRlID0gITEsIHMudHJhY2tEb3dubG9hZExpbmtzID0gITAsIHMudHJhY2tFeHRlcm5hbExpbmtzID0gITAsIHMudHJhY2tJbmxpbmVTdGF0cyA9ICEwLCBzLmxpbmtEb3dubG9hZEZpbGVUeXBlcyA9ICdleGUsemlwLHdhdixtcDMsbXA0LG1vdixtcGcsYXZpLHdtdixwZGYsZG9jLGRvY3gseGxzLHhsc3gscHB0LHBwdHgscG5nJywgcy5saW5rTGVhdmVRdWVyeVN0cmluZyA9ICExLCBzLmxpbmtUcmFja1ZhcnMgPSAnTm9uZScsIHMubGlua1RyYWNrRXZlbnRzID0gJ05vbmUnLCBzLnVzZVBsdWdpbnMgPSAhMCwgcy5saW5rSW50ZXJuYWxGaWx0ZXJzID0gJ2phdmFzY3JpcHQ6LGZlZGV4LmNvbSxpYW1mZWRleC5jb20sZmVkZXhhZHMuZGVzaWduY2R0LmNvbSxraW5rb3NkZXYuY29tLGtpbmtvc3Rlc3QuY29tLHNlbnNlYXdhcmUuY29tLGZlZGV4c2FtZWRheS5jb20sZmVkZXgucC5kZWxpdmVyeS5uZXQsZmVkZXguY28uanAscHNnLmtpbmtvcy5jb20sZmVkZXhjYXJlcy5jb20sYm9uZ291cy5jb20nLCB3aW5kb3cubmx0cmsgPSAnJzsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl84NTZlZTNjZjJjN2QxZmMzKGUsIHQsIG4pIHsKICAgICAgICAgICAgdCA9IHZvaWQgMCAhPT0gdCA/ICdbJyArIHQgKyAnXSAnIDogJycsIG4gPSB2b2lkIDAgIT09IG4gPyAnWycgKyBuICsgJ10gJyA6ICcnLCB3aW5kb3cuY29uc29sZSAmJiBjb25zb2xlLmxvZyA/IGNvbnNvbGUubG9nKHQgKyBuICsgZSkgOiB3aW5kb3cub3BlcmEgJiYgb3BlcmEucG9zdEVycm9yICYmIG9wZXJhLnBvc3RFcnJvcih0ICsgbiArIGUpOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdmFyIGkgPSB2b2lkIDAgIT09IGZkeF9nZXRDb29raWUoJ2ZkeF9kZWJ1ZycpID8gZmR4X2dldENvb2tpZSgnZmR4X2RlYnVnJykuc3BsaXQoJywnKSA6IFtdLCByID0gX2ZkeC5nZXRUZXN0TGV2ZWwoKSwgYSA9IG5ldyBEYXRlKCkuZ2V0VGltZSgpICsgJ3wnICsgdCArIG4gKyBlICsgJ3wnICsgciArICd8JyArICgndW5kZWZpbmVkJyAhPSB0eXBlb2YgcyAmJiBzLnBhZ2VOYW1lID8gcy5wYWdlTmFtZSA6IGRvY3VtZW50LmxvY2F0aW9uLmhyZWYpOwogICAgICAgICAgICAgICAgaS5wdXNoKGEucmVwbGFjZSgvLC9nLCAnIyMnKSk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyXzc5YzA1MmM4NjkzNTJhZGEoZSwgdCwgbiwgaSwgcikgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGVzY2FwZSh0KTsKICAgICAgICAgICAgICAgICAgICBpZiAoJycgIT09IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBuZXcgRGF0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICBzLnNldERhdGUocy5nZXREYXRlKCkgKyBuKSwgYSArPSBudWxsID09PSBuID8gJycgOiAnOyBleHBpcmVzPScgKyBzLnRvVVRDU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGEgKz0gbnVsbCAhPSBpID8gJzsgcGF0aD0nICsgaSA6ICcnLCBhICs9IG51bGwgIT0gciA/ICc7IGRvbWFpbj0nICsgciA6ICcnLCBkb2N1bWVudC5jb29raWUgPSBlICsgJz0nICsgYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgZmR4X2RlYnVnKGUsICdDSU0nLCAnZmR4X3NldENvb2tpZScpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uICRfX192YXJfOWUxNTVmNDk5ODJkNmM4MShlKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciB0LCBuID0ge30sIGkgPSBkb2N1bWVudC5jb29raWUuc3BsaXQoJzsgJyksIHIgPSAwOyByIDwgaS5sZW5ndGg7IHIrKykKICAgICAgICAgICAgICAgICAgICBuWyh0ID0gaVtyXS5zcGxpdCgnPScpKVswXV0gPSB1bmVzY2FwZSh0WzFdKTsKICAgICAgICAgICAgICAgIHJldHVybiBuW2VdOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBmZHhfZGVidWcoZSwgJ0NJTScsICdmZHhfZ2V0Q29va2llJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl83MjRjZGViMDI1ZDgxNTQzKCkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZkeF9ndXAod2luZG93LmxvY2F0aW9uICE9IHdpbmRvdy5wYXJlbnQubG9jYXRpb24gPyBkb2N1bWVudC5yZWZlcnJlciA6IGRvY3VtZW50LmxvY2F0aW9uLCAnY21wJyk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBmZHhfZGVidWcoZSwgJ1NDJywgJ2ZkeF9jYW1wYWlnbicpLCAnJzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyX2I3ZWNmNTAyZmNmMWI2MzIoZSwgdCkgewogICAgICAgICAgICB0ID0gdC5yZXBsYWNlKC9bXFtdLywgJ1xcWycpLnJlcGxhY2UoL1tcXV0vLCAnXFxdJyk7CiAgICAgICAgICAgIHZhciBuID0gbmV3IFJlZ0V4cCgnW1xcPyZdJyArIHQgKyAnPShbXiYjXSopJywgJ2knKS5leGVjKGUpOwogICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBuID8gJycgOiBuWzFdOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyX2EwNzQ3NjY4OGQ0MDIwYWIoKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBzLmRlbGF5ViA9ICExOwogICAgICAgICAgICAgICAgcy50KCk7CiAgICAgICAgICAgICAgICBzLmV2ZW50cyA9ICcnLCBzLmxpc3QxID0gJycsIHMubGlzdDIgPSAnJywgcy5saXN0MyA9ICcnLCBzRXZudHNPbmNlID0gJycsIHMuY193KCdTQ19MSU5LUycsICcnKSwgcy5jX3coJ3NldExpbmsnLCAnJyk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGZkeF9kZWJ1ZyhlLCAnU0MnLCAnZmR4X2ZpcmVTRG90VCcpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uICRfX192YXJfNDkxMGEzNWZmNzI0NzBjYShlLCB0LCBuKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBzLmxpbmtUcmFja1ZhcnMgPSBzLmFwbChzLmxpbmtUcmFja1ZhcnMsICdwcm9wNTAnLCAnLCcsIDIpLCBzLnRsKGUsIHQsIG4pLCBzLmxpbmtUcmFja1ZhcnMgPSAnTm9uZScsIHMubGlua1RyYWNrRXZlbnRzID0gJ05vbmUnLCBzLmV2ZW50cyA9ICcnLCBzLmxpc3QxID0gJycsIHMubGlzdDIgPSAnJywgcy5saXN0MyA9ICcnLCBzLmNfdygnU0NfTElOS1MnLCAnJyksIHMuY193KCdzZXRMaW5rJywgJycpOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBmZHhfZGVidWcoZSwgJ1NDJywgJ2ZkeF9maXJlU0RvdFRMJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl82MzI5Yzk4Zjk3Mjk4Y2MyKGUpIHsKICAgICAgICAgICAgdmFyIHQgPSBzLlV0aWwuZ2V0UXVlcnlQYXJhbSgncScpLCBuID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6bG9jYWxlJyksIHIgPSAoZS50b3RhbFJlc3VsdENvdW50ID4gMCA/ICdTdWNjZXNzJyA6ICdGYWlsdXJlJykgKyAnOicgKyBlLnRvdGFsUmVzdWx0Q291bnQgKyAnOicgKyBuOwogICAgICAgICAgICBpZiAodCkgewogICAgICAgICAgICAgICAgcy5wcm9wNDkgPSB0LCBzLnByb3A0OSA9IHMucHJvcDQ5LnRvTG93ZXJDYXNlKCksIDAgPT0gcy5wcm9wNDkuaW5kZXhPZignKycpICYmIChzLnByb3A0OSA9IHMucHJvcDQ5LnJlcGxhY2UoJysnLCAnICAnKSksIHMucHJvcDQ5ID0gcy5yZXBsKHMucHJvcDQ5LCAnKycsICcgJyksIHMucHJvcDQ5ID0gcy5yZXBsKHMucHJvcDQ5LCAnICAnLCAnICsnKS5yZXBsYWNlKC9eXHMrLywgJycpLCBlLnRvdGFsUmVzdWx0Q291bnQgPiAwID8gKHMucHJvcDEgPSBzLmVWYXIxID0gcy5wcm9wNDksIHMuZXZlbnRzID0gcy5hcGwocy5ldmVudHMsICdldmVudDExOCcsICcsJywgMikpIDogKHMucHJvcDEgPSBzLmVWYXIxID0gJzA6JyArIHMucHJvcDQ5LCBzLmV2ZW50cyA9IHMuYXBsKHMuZXZlbnRzLCAnZXZlbnQxMTknLCAnLCcsIDIpKSwgdm9pZCAwICE9PSByICYmICcnICE9PSByICYmIChzLnByb3A0OSA9IHIgKyAnOicgKyBzLnByb3A0OSk7CiAgICAgICAgICAgICAgICB2YXIgYSA9ICcnOwogICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gRkRYLkRBVEFMQVlFUi5zZWFyY2gucmVzdWx0LmJhbm5lciAmJiAnJyAhPSBGRFguREFUQUxBWUVSLnNlYXJjaC5yZXN1bHQuYmFubmVyICYmIEZEWC5EQVRBTEFZRVIuc2VhcmNoLnJlc3VsdC5iYW5uZXIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoJ2NxLXNlYXJjaHByb21vdGUtYmFubmVycycpWzBdLmdldEVsZW1lbnRzQnlUYWdOYW1lKCdkaXYnKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgby5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG9baV07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnhnLWltYWdlLWNvbXBvbmVudF9faW1hZ2UnID09IGMuY2xhc3NOYW1lICYmICh2b2lkIDAgIT09IGMuY2hpbGRyZW5bMF0uYXR0cmlidXRlc1snZGF0YS1hbmFseXRpY3MnXSAmJiAoYSArPSAnJCcgKyBjLmNoaWxkcmVuWzBdLmF0dHJpYnV0ZXNbJ2RhdGEtYW5hbHl0aWNzJ10udmFsdWUpLCBhLmluZGV4T2YoJ1NQQnxSZXN1bHRzIE5vdCBGb3VuZCBJbWFnZScpID49IDApKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ1NQQnxSZXN1bHRzIE5vdCBGb3VuZCBJbWFnZSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAnJyAhPT0gYSAmJiBhICYmIChhID0gYS5yZXBsYWNlKCckJywgJycpLCBzLnByb3A0OSA9IHMucHJvcDQ5ICsgJzonICsgYSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzLmVWYXI0OSA9ICdEPWM0OSc7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl8wMGQxZDA3NmUwOGNmOWE4KGUsIHQsIG4sIGkpIHsKICAgICAgICAgICAgZmR4X2xvZ0xpbmtWaWV3KGUsIHQsIG4sIGkpOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyXzg2MDhjNDAzNjcxYzZhMmMoZSwgdCkgewogICAgICAgICAgICB2b2lkIDAgPT09IHQgJiYgKHQgPSAnJyksIHMuZXZlbnRzLmluZGV4T2YoJ2V2ZW50OTA0JykgPiAtMSAmJiAocy5saW5rVHJhY2tFdmVudHMgPSBzLmV2ZW50cyA9IHMuZXZlbnRzID0gcy5yZmwocy5ldmVudHMsICdldmVudDkwNCcpKTsKICAgICAgICAgICAgdmFyIG4gPSBbCiAgICAgICAgICAgICAgICAndHJrLWxhbmRpbmdQYWdlMVRyYWNraW5nTnVtYmVyc1ByZXNlbnQnLAogICAgICAgICAgICAgICAgJ3Ryay1sYW5kaW5nUGFnZS1UcmFja0J0bicsCiAgICAgICAgICAgICAgICAndHJrLXRyYWNrQnlSZWZlcmVuY2UtVHJhY2tCdG4nLAogICAgICAgICAgICAgICAgJ3Ryay10cmFja0J5VENOLVRyYWNrQnRuJywKICAgICAgICAgICAgICAgICd0cmstbGFuZGluZ1BhZ2UtdHJhY2staGVscExpbmsnLAogICAgICAgICAgICAgICAgJ3Ryay1sYW5kaW5nUGFnZS1tdWxpdGlwbGVUcmFja2luZ051bWJlckxpbmsnLAogICAgICAgICAgICAgICAgJ3Ryay1sYW5kaW5nUGFnZS1zaW5nbGVUcmFja2luZ051bWJlckxpbmsnLAogICAgICAgICAgICAgICAgJ3Ryay10cmFja0J5UmVmZXJlbmNlLURlc3RpbmF0aW9uQ291bnRyeScsCiAgICAgICAgICAgICAgICAndHJrLWxhbmRpbmdQYWdlLXByb21wdFRvTG9naW5mb3JCT0wnLAogICAgICAgICAgICAgICAgJ3Ryay1PUE9ELWNhbmNlbCcsCiAgICAgICAgICAgICAgICAndHJrLU9QT0QtUHJpbnRMZXR0ZXItU3VibWl0JywKICAgICAgICAgICAgICAgICd0cmstT1BPRC1FbWFpbExldHRlci1TdWJtaXQnLAogICAgICAgICAgICAgICAgJ3Ryay1PUE9ELUZheC1TdWJtaXQnLAogICAgICAgICAgICAgICAgJ3Ryay1sYW5kaW5ncGFnZS1ib2xEb3dubG9hZEJ1dHRvbicsCiAgICAgICAgICAgICAgICAndHJrLWxhbmRpbmdQYWdlLXRyYWNrLWhlbHBMaW5rJwogICAgICAgICAgICBdOwogICAgICAgICAgICBpZiAoMSA9PSAhIShfc2F0ZWxsaXRlLmdldFZhcignY2xpY2s6YmxvY2tGbGFnJykoZSwgJ2NsaWNrOmJsb2NrTGlzdCcpIHx8IGUuaW5kZXhPZigndmFQb3BpbkFzaycpID4gLTEpKQogICAgICAgICAgICAgICAgcmV0dXJuIG4uaW5kZXhPZihlLnRyaW0oKSkgPiAtMSAmJiBmZHhfc2V0TGlua1ZpZXcoZSksICEwOwogICAgICAgICAgICBpZiAobnVsbCAhPSBlKSB7CiAgICAgICAgICAgICAgICAoZSA9IGZkeF9saW5rRm9ybWF0KGUpKS5pbmRleE9mKCd0cmstJykgPiAtMSAmJiAoZSA9IGZkeF90cmFja01hcHBpbmcoZSkpOwogICAgICAgICAgICAgICAgdmFyIGkgPSBuZXcgRGF0ZSgpLCByID0gKGkuZ2V0TW9udGgoKSwgaS5nZXREYXRlKCksIGkuZ2V0RnVsbFllYXIoKSwgaS5nZXRIb3VycygpLCBpLmdldE1pbnV0ZXMoKSk7CiAgICAgICAgICAgICAgICByIDwgMTAgJiYgKHIgPSAnMCcgKyByKTsKICAgICAgICAgICAgICAgIHZhciBhID0gaS5nZXRTZWNvbmRzKCk7CiAgICAgICAgICAgICAgICBhIDwgMTAgJiYgKGEgPSAnMCcgKyBhKTsKICAgICAgICAgICAgICAgIHMubGlua1RyYWNrVmFycyA9ICdwcm9wMixwcm9wMyxwcm9wNCxwcm9wNSxwcm9wNixwcm9wMTgscHJvcDE5LHByb3AyMCxwcm9wMzEscHJvcDMzLHByb3AzNSxwcm9wNDEscHJvcDQ4LHByb3A1Mixwcm9wNTQscHJvcDU1LHByb3A1Nixwcm9wNzAscHJvcDcxLGVWYXI0LGVWYXI2LGVWYXIxMSxlVmFyMTMsZVZhcjQzLGVWYXI1MCxlVmFyNTIsZVZhcjU2LGVWYXI1MyxldmVudHMnLCAnaGRyfExvZ2luJyA9PSBlICYmICh0ICs9ICdldmVudDMnKSwgJ2hkcnxTSUdOIE9VVCcgPT0gZSAmJiAodCArPSAnZXZlbnQxMCcsIHMuZVZhcjQgPSAnTG9nZ2VkIE91dCcpLCB0ICYmIChzLmxpbmtUcmFja0V2ZW50cyA9IHQsIHMuZXZlbnRzID0gdCksIHMucHJvcDQgPSAnRD12NCcsIHMucHJvcDUgPSBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpyZWdpb24nKSwgcy5wcm9wNiA9ICdEPXY2Jywgcy5wcm9wMTggPSBzLnBhZ2VOYW1lLCBzLnByb3AxOSA9IGUsIHMucHJvcDIwID0gcy5wYWdlTmFtZSArICc6JyArIGUsIHMucHJvcDMxID0gJycgIT09IHMudmlzaXRvci5nZXRBbmFseXRpY3NWaXNpdG9ySUQoKSA/ICdbQ1NddjF8JyArIHMudmlzaXRvci5nZXRBbmFseXRpY3NWaXNpdG9ySUQoKSArICdbQ0VdJyA6IHMudmlzaXRvci5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCgpLCBzLnByb3AzMyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OnBhZ2UgdHlwZScpLCBzLnByb3A0MSA9ICdEPXY0MScsIHMucHJvcDQzID0gJ0Q9djQzJzsKICAgICAgICAgICAgICAgIHZhciBvID0gbmV3IERhdGUoKSwgYyA9IG8uZ2V0TW9udGgoKSArIDEsIGwgPSBvLmdldERhdGUoKSwgdSA9IG8uZ2V0RnVsbFllYXIoKTsKICAgICAgICAgICAgICAgIHJldHVybiBzLnByb3A1MiA9IHMuZVZhcjUyID0gdSArICctJyArIGMgKyAnLScgKyBsLCBzLnByb3A1NCA9ICdEPXY1NCcsIHMucHJvcDU1ID0gJ0Q9djU1Jywgcy5lVmFyNiA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdsb2dpbjp1c2VyLWlkJyksIHMuZVZhcjQzID0gJ0w6JyArIGUsIHMuZVZhcjU2ID0gcy5wcm9wNTYgPSBlLCBzLmVWYXI1MyA9ICcrMScsIG5sdHJrID0gJ3knLCBmZHhfZmlyZVNEb3RUTCh0aGlzLCAnbycsIGUpLCAhMDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyX2I4NzEzNDdkOWI2MWMyMWUoZSkgewogICAgICAgICAgICBmZHhfc2V0TGlua1ZpZXcoZSk7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uICRfX192YXJfZTkxYzliZmVlZGNjNmQ3YyhlKSB7CiAgICAgICAgICAgIChlID0gZmR4X2xpbmtGb3JtYXQoZSkpLmluZGV4T2YoJ3Ryay0nKSA+IC0xICYmIChlID0gZmR4X3RyYWNrTWFwcGluZyhlKSk7CiAgICAgICAgICAgIHZhciB0ID0gcy5wYWdlTmFtZSArICdeXicgKyBlICsgJ15eJyArIHMucGFnZU5hbWUgKyAnIHwgJyArIGUgKyAnXl4nOwogICAgICAgICAgICByZXR1cm4gcy5jX3coJ3NldExpbmsnLCB0LCAwKSwgITA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uICRfX192YXJfNjZjYWI4YzVkNzE4YzAzYSgpIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIHZhciBlID0gcy5jX3IoJ3NldExpbmsnKTsKICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IGUgJiYgJycgIT0gZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5zcGxpdCgnXl4nKTsKICAgICAgICAgICAgICAgICAgICBzLnByb3AxOCA9IHRbMF0sIHMucHJvcDE5ID0gdFsxXSwgcy5wcm9wMjAgPSB0WzJdLCBzLmNfdygnU0NfTElOS1MnLCAnJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGZkeF9kZWJ1ZyhlLCAnU0MnLCAnZmR4X2dldExpbmtWaWV3Jyk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl84MzBhNzI2MGUzNDU0YTdiKGUpIHsKICAgICAgICAgICAgZm9yICh2YXIgdCA9IGUuc3BsaXQoJ3wnKSwgbiA9ICcnLCBpID0gMDsgaSA8IHQubGVuZ3RoOyBpKyspCiAgICAgICAgICAgICAgICAnJyAhPSBuICYmIChuICs9ICd8JyksIG4gKz0gdFtpXS50cmltKCk7CiAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyXzRjNDJkMjllMDY5NTdiMGEoZSkgewogICAgICAgICAgICB2YXIgdCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCd0cmFjazpidG5NYXBwaW5nJyk7CiAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IHRbZV0gPyBlIDogdFtlXTsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl9iNTRjOWIyYWQ1MzczYTQxKGUsIHQpIHsKICAgICAgICAgICAgcy5saW5rVHJhY2tWYXJzID0gJ2VWYXI2LGVWYXIxMTAsZVZhcjQzLHByb3AzNyxwcm9wNzAscHJvcDcxLGV2ZW50cyc7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHMucHJvcDM3ID0gZS50b1N0cmluZygpLCAnc2luZ2xlJyA9PSB0LnRvTG93ZXJDYXNlKCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHMuZXZlbnRzID0gcy5hcGwocy5ldmVudHMsICdldmVudDEyJywgJywnLCAyKSwgcy5saW5rVHJhY2tFdmVudHMgPSAnZXZlbnQxMic7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoJ211bHRpcGxlJyA9PSB0LnRvTG93ZXJDYXNlKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAnZmFpbGVkJyAhPSBlLnRvU3RyaW5nKCkudG9Mb3dlckNhc2UoKSAmJiAobiA9IGUubGVuZ3RoKSwgcy5ldmVudHMgPSBzLmFwbChzLmV2ZW50cywgJ2V2ZW50MTgxPScgKyBuLCAnLCcsIDIpLCBzLmxpbmtUcmFja0V2ZW50cyA9ICdldmVudDE4MSc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBmZHhfZmlyZVNEb3RUTCh0aGlzLCAnZCcpLCAhMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgZmR4X2RlYnVnKGUsICdTQycsICdmZHhfbG9nRG93bmxvYWQnKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyX2ZhNGQ0Y2U3M2M3NWU0OTAoZSwgdCwgbiwgaSwgciwgYSkgewogICAgICAgICAgICBmZHhfbG9nUGFnZVZpZXcoZSwgdCwgbiwgaSwgciwgYSk7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uICRfX192YXJfZTgzOGZlNzE4ZTc3MWJmOShlLCB0LCBuLCBpLCByKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9ICcnOwogICAgICAgICAgICAgICAgd3d3SG9zdC5tYXRjaCgvd3d3KHNib3guaWRldnxiYXNlLmlkZXZ8ZGV2LmlkZXZ8ZHJ0LmlkZXZ8c3RyZXNzLmRtei5pZGV2fGJpdC5pZGV2fHRlc3R8KS5mZWRleC5jb20vZ2kpICYmIChhID0gJ2ZlZGV4LycpLCBhICE9IGUuc2xpY2UoMCwgYS5sZW5ndGgpICYmIChlID0gYSArIGUpLCBzLnBhZ2VOYW1lID0gZSwgZmR4X2dldExpbmtWaWV3KCksIHQgPyAocy5saW5rVHJhY2tFdmVudHMgPSB0LCBzLmV2ZW50cyA9IHQpIDogKHMubGlua1RyYWNrRXZlbnRzID0gJycsIHMuZXZlbnRzID0gJycpOwogICAgICAgICAgICAgICAgdmFyIG8gPSBfc2F0ZWxsaXRlLmdldFZhcignc2VhcmNoOnNwRGF0YScpOwogICAgICAgICAgICAgICAgdm9pZCAwICE9PSBvICYmICcnICE9IG8gJiYgZmR4X3NwU3JjaChvKSwgbiAmJiAocy5wcm9wNCA9IG4pLCBpICYmIChzLnByb3A3NCA9IGkpOwogICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgRGF0ZSgpLCBsID0gKGMuZ2V0TW9udGgoKSwgYy5nZXREYXRlKCksIGMuZ2V0RnVsbFllYXIoKSwgYy5nZXRIb3VycygpLCBjLmdldE1pbnV0ZXMoKSk7CiAgICAgICAgICAgICAgICBsIDwgMTAgJiYgKGwgPSAnMCcgKyBsKTsKICAgICAgICAgICAgICAgIHZhciB1ID0gYy5nZXRTZWNvbmRzKCk7CiAgICAgICAgICAgICAgICB1IDwgMTAgJiYgKHUgPSAnMCcgKyB1KTsKICAgICAgICAgICAgICAgIHMuZVZhcjQzID0gJ1Y6JyArIHMucGFnZU5hbWUsIHMucHJvcDQzID0gJ0Q9djQzJzsKICAgICAgICAgICAgICAgIHZhciBkID0gbmV3IERhdGUoKSwgcCA9IGQuZ2V0TW9udGgoKSArIDEsIGYgPSBkLmdldERhdGUoKSwgZyA9IGQuZ2V0RnVsbFllYXIoKTsKICAgICAgICAgICAgICAgIHMucHJvcDUyID0gcy5lVmFyNTIgPSBnICsgJy0nICsgcCArICctJyArIGYsIHIgPyAocy5kZWxheVYgPSAhMCwgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgZmR4X2ZpcmVTRG90VCgpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coJ2Vycm9yOicgKyBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCAyMDAwKSkgOiBmZHhfZmlyZVNEb3RUKCk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCdlcnJvcjonICsgZSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl8zOTMxODYyYzQ4YmZiMTM5KGUsIHQpIHsKICAgICAgICAgICAgdm9pZCAwICE9PSBlICYmIGZkeF9sb2dQdXJjaGFzZShlLCB0KTsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl9jMWIwOWEwMThhODFkYWI5KGUsIHQpIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIHMuZXZlbnRzID0gJyc7CiAgICAgICAgICAgICAgICB2YXIgbiA9ICcnOwogICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gZS5Mb2dQdXJjaGFzZVJlcXVlc3QgJiYgbnVsbCAhPT0gZS5Mb2dQdXJjaGFzZVJlcXVlc3QgJiYgKGUuTG9nUHVyY2hhc2VSZXF1ZXN0LmNsaWVudElkICYmIChlLkxvZ1B1cmNoYXNlUmVxdWVzdC5jbGllbnRJZCA9IGUuTG9nUHVyY2hhc2VSZXF1ZXN0LmNsaWVudElkLnRvVXBwZXJDYXNlKCkpLCAnTUFHUycgPT0gZS5Mb2dQdXJjaGFzZVJlcXVlc3QuY2xpZW50SWQgJiYgKGZkeF9sb2dQdXJjaGFzZU1BR1MoZS5Mb2dQdXJjaGFzZVJlcXVlc3QsIHQpLCBuID0gJ01BR1NTaGlwQnRuJyksICdNQUdSJyA9PSBlLkxvZ1B1cmNoYXNlUmVxdWVzdC5jbGllbnRJZCAmJiAoZmR4X2xvZ1B1cmNoYXNlTUFHUihlLkxvZ1B1cmNoYXNlUmVxdWVzdCwgdCksIG4gPSAnTUFHUlJhdGVCdG4nKSksIG51bGwgIT0gZSAmJiAnTUFHUycgPT0gZS5jbGllbnRJZCAmJiAndW5kZWZpbmVkJyAhPT0gZS5wYWdlTmFtZSAmJiBudWxsICE9PSBlLnBhZ2VOYW1lICYmICcnICE9PSBlLnBhZ2VOYW1lICYmIChmZHhfbG9nUHVyY2hhc2VfUGFnZUxldmVsKGUsIHQpLCBuID0gZS5wYWdlTmFtZSksIHZvaWQgMCAhPT0gZS5hcHBJZCAmJiBudWxsICE9PSBlLmFwcElkICYmICdXUkVHJyA9PSBlLmFwcElkICYmIChmZHhfbG9nUHVyY2hhc2VXUkVHKGUsIHQpLCBuID0gJ1dSRUdSZWdpc3RlckJ0bicpLCAnJyAhPT0gcy5ldmVudHMgJiYgKG5sdHJrID0gJ3knLCBzLmVWYXI0MCA9ICdEPWV2ZW50cycsIHMucHJvcDQwID0gJ0Q9ZXZlbnRzJywgcy5wcm9wNDMgPSAnRD12NDMnLCBzLnByb3AxOCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OnBhZ2UgbmFtZScpLCBzLnByb3AxOSA9IG4sIHMucHJvcDIwID0gcy5wYWdlTmFtZSArICc6JyArIG4sIHMubGlua1RyYWNrVmFycyA9IHMuYXBsKHMubGlua1RyYWNrVmFycywgJ3Byb3A2LGVWYXI2LHByb3AxOCxwcm9wMTkscHJvcDIwLHByb3AzMSxlVmFyMzgscHJvcDQwLGVWYXI0MCxwcm9wNDMsZVZhcjQzLHByb3A0NixlVmFyNDYsZVZhcjczLGVWYXI3NSxwcm9wNzQsZVZhcjExMixlVmFyMTEzLGVWYXIxMTQsZVZhcjExNSxlVmFyMTE2LGVWYXIxMTcsZVZhcjExOCxlVmFyMTE5LGVWYXIxMjAsZVZhcjEyMSxlVmFyMTM2LGVWYXIxMzgsZVZhcjEzOSxlVmFyMTQyLGVWYXIxNDMsZVZhcjE0NSxwcm9kdWN0cyxwdXJjaGFzZUlELGV2ZW50cycsICcsJywgMiksIHMubGlua1RyYWNrRXZlbnRzID0gcy5ldmVudHMsIGZkeF9maXJlU0RvdFRMKHRoaXMsICdvJywgbiksIHMucHJvZHVjdHMgPSAnJywgcy5wdXJjaGFzZUlEID0gJycsIHMuZXZlbnRzID0gJycsIHMuZVZhcjczID0gJycsIHMuZVZhcjc1ID0gJycsIHMucHJvcDc0ID0gJycsIHMuZVZhcjQzID0gJycsICEwKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZkeF9kZWJ1ZyhlLCAnU0MnLCAnZmR4X2xvZ1B1cmNoYXNlJyksICExOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uICRfX192YXJfOGI0NGIwMGE4MzBkOWQxMShlLCB0KSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICB2YXIgbiA9ICcnLCBpID0gZS5jbGllbnRJZCArICc6SU5UXycgKyBlLklOVDsKICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IGUuY2xpZW50SWQgJiYgJycgIT09IGUuY2xpZW50SWQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBlLnNoaXBEYXRhICYmIG51bGwgIT09IGUuc2hpcERhdGEpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gZS5zaGlwRGF0YSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaSArPSAnOicgKyByICsgJ18nICsgZS5zaGlwRGF0YVtyXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG4gPSAnWScgPT0gZS5JTlQgPyAnZXZlbnQ2OCcgOiAnZXZlbnQ2NycsIHMuZXZlbnRzID0gJ3B1cmNoYXNlLCcgKyBuLCBzLmxpbmtUcmFja0V2ZW50cyA9IHMuZXZlbnRzLCBzLmVWYXIxNDMgPSBpLCBzLnByb2R1Y3RzID0gJztNQUdTOzs7JyArIG4gKyAnO2VWYXIxNDM9JyArIHMuZVZhcjE0Mywgcy5lVmFyNDMgPSAnUzpNQUdTJzsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IHQgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCAmJiB0KGUpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZmR4X2RlYnVnKGUsICdTQycsICdmZHhfbG9nUHVyY2hhc2VNQUdTOmNhbGxiYWNrJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBmZHhfZGVidWcoZSwgJ1NDJywgJ2ZkeF9sb2dQdXJjaGFzZU1BR1MnKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyXzk0YTc1MzZmYTQ2OWY1ZjAoZSkgewogICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBlICYmIGUuY29uc3RydWN0b3IgPT0gT2JqZWN0OwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyXzNhMTVmOWU3MDQ2NjU2YmEoZSwgdCkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdmFyIG4gPSAnJzsKICAgICAgICAgICAgICAgIGlmIChzLmxpbmtUcmFja1ZhcnMgPSBzLmFwbChzLmxpbmtUcmFja1ZhcnMsIE1BR1NFdmFyTWFwcGluZ1tlLnBhZ2VOYW1lXVswXSwgJywnLCAyKSwgaXNPYmplY3QoZSkpCiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSBpbiAodm9pZCAwICE9PSBlLlNSQyAmJiAnJyAhPSBlLlNSQyAmJiAocy5saW5rVHJhY2tWYXJzID0gcy5hcGwocy5saW5rVHJhY2tWYXJzLCAnZVZhcjE2NicsICcsJywgMiksIHMuZVZhcjE2NiA9IGUuU1JDKSwgZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlW2ldOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNPYmplY3QocikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgaW4gcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICs9IGkgKyAnXycgKyByW2ldICsgJzonOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG4uc3Vic3RyaW5nKDAsIG4ubGVuZ3RoIC0gMSkgKyAnOic7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgYSA9IG4uc3Vic3RyaW5nKDAsIG4ubGVuZ3RoIC0gMSk7CiAgICAgICAgICAgICAgICBzLmV2ZW50cyA9ICdTY0FkZCwnICsgW01BR1NFdmFyTWFwcGluZ1tlLnBhZ2VOYW1lXVsxXV0sIHMubGlua1RyYWNrRXZlbnRzID0gcy5ldmVudHMsIHNbW01BR1NFdmFyTWFwcGluZ1tlLnBhZ2VOYW1lXVswXV1dID0gYSwgcy5wcm9kdWN0cyA9ICc7TUFHUzs7OzsnICsgTUFHU0V2YXJNYXBwaW5nW2UucGFnZU5hbWVdWzBdICsgJz0nICsgc1tNQUdTRXZhck1hcHBpbmdbZS5wYWdlTmFtZV1bMF1dLCBzLmVWYXI0MyA9ICdTOicgKyBlLnBhZ2VOYW1lOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBudWxsICE9IHQgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCAmJiB0KG9iaik7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZmR4X2RlYnVnKGUsICdTQycsICdmZHhfbG9nUHVyY2hhc2VfUGFnZUxldmVsOmNhbGxiYWNrJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGZkeF9kZWJ1ZyhlLCAnU0MnLCAnZmR4X2xvZ1B1cmNoYXNlX1BhZ2VMZXZlbCcpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uICRfX192YXJfZGNhM2EwNmYwNDk4Y2NmOShlLCB0KSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICB2YXIgbiA9IGUuY2xpZW50SWQgKyAnOklOVF8nICsgZS5JTlQsIGkgPSBlLmNsaWVudElkOwogICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gZSAmJiAnJyAhPT0gZSkgewogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IGUuc2hpcERhdGEgJiYgbnVsbCAhPT0gZS5zaGlwRGF0YSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBlLnNoaXBEYXRhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICs9ICc6JyArIHIgKyAnXycgKyBlLnNoaXBEYXRhW3JdOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gZS5jb21EYXRhICYmIG51bGwgIT09IGUuY29tRGF0YSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBlLmNvbURhdGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgKz0gJzonICsgciArICdfJyArIGUuY29tRGF0YVtyXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHMuZXZlbnRzID0gJ3NjQWRkLGV2ZW50MTEwJywgcy5saW5rVHJhY2tFdmVudHMgPSBzLmV2ZW50cywgcy5lVmFyMTM2ID0gbiwgcy5lVmFyMTQyID0gaSwgcy5wcm9kdWN0cyA9ICc7TUFHUjs7OztlVmFyMTM2PScgKyBzLmVWYXIxMzYgKyAnfGVWYXIxNDI9JyArIHMuZVZhcjE0Miwgcy5lVmFyNDMgPSAnUzpSYXRlTUFHUic7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSB0ICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIHQgJiYgdChlKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZkeF9kZWJ1ZyhlLCAnU0MnLCAnZmR4X2xvZ1B1cmNoYXNlTUFHUjpjYWxsYmFjaycpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgZmR4X2RlYnVnKGUsICdTQycsICdmZHhfbG9nUHVyY2hhc2VNQUdSJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl9hMzIzZGY4MmIwMTQ5YmIwKGUsIHQpIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIHZhciBuID0gJycsIGkgPSAnJzsKICAgICAgICAgICAgICAgIG51bGwgIT0gZSAmJiAodm9pZCAwICE9PSBlLnByb2ZpbGUgJiYgKG4gPSBwcm9jZXNzRGF0YShlLnByb2ZpbGUpKSwgdm9pZCAwICE9PSBlLmFkZHREYXRhICYmIChpID0gcHJvY2Vzc0RhdGEoZS5hZGR0RGF0YSkpLCBzLmVWYXIxNDUgPSBuICsgJ3wnICsgaSksIHMuZXZlbnRzID0gJ3NjQWRkJywgcy5saW5rVHJhY2tFdmVudHMgPSBzLmV2ZW50cywgcy5wcm9kdWN0cyA9ICc7JyArIGUuYXBwSWQgKyAnOzs7O2VWYXIxNDU9JyArIHMuZVZhcjE0NSwgcy5lVmFyNDMgPSAnUzonICsgZS5hcHBJZDsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSB0ICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIHQgJiYgdChlKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICBmZHhfZGVidWcoZSwgJ1NDJywgJ2ZkeF9sb2dQdXJjaGFzZVdSRUc6Y2FsbGJhY2snKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgZmR4X2RlYnVnKGUsICdTQycsICdmZHhfbG9nUHVyY2hhc2VXUkVHJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl83ZTJlY2NjNjQwYjBiM2UyKGUpIHsKICAgICAgICAgICAgdmFyIHQgPSAnJzsKICAgICAgICAgICAgaWYgKG51bGwgIT0gZSkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgIHQgKz0gJzonICsgbiArICdfJyArIGVbbl07CiAgICAgICAgICAgICAgICB0ID0gdC5yZXBsYWNlKCc6JywgJycpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyX2E0M2Q4NDY4ODc3ZGU1NGQoZSkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PSB0eXBlb2YgZSAmJiBudWxsID09IGUuam9pbikKICAgICAgICAgICAgICAgICAgICBmb3IgKHByb3AgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgcHJvcCAmJiAnJyAhPSBwcm9wICYmIGVbcHJvcF0gJiYgJycgIT0gZVtwcm9wXSAmJiB0LnB1c2gocHJvcCwgJzonLCBmZHhfY29udmVydFRvU3RyKGVbcHJvcF0pLCAnLCcpOwogICAgICAgICAgICAgICAgZWxzZSBpZiAoJ29iamVjdCcgPT0gdHlwZW9mIGUgJiYgbnVsbCAhPSBlLmpvaW4pCiAgICAgICAgICAgICAgICAgICAgZm9yIChwcm9wIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHByb3AgJiYgJycgIT0gcHJvcCAmJiBlW3Byb3BdICYmICcnICE9IGVbcHJvcF0gJiYgdC5wdXNoKGZkeF9jb252ZXJ0VG9TdHIoZVtwcm9wXSksICcsJyk7CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgZSAmJiAnJyAhPSBlLnRvU3RyaW5nKCkgJiYgdC5wdXNoKGUudG9TdHJpbmcoKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gdC5qb2luKCcnKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgZmR4X2RlYnVnKGUsICdTQycsICdmZHhfY29udmVydFRvU3RyJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl9kMDU3ZWMwZWIyYmFiNDA3KGUsIHQpIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgIGlmIChzLmxpbmtUcmFja1ZhcnMgPSAncHJvcDYsZVZhcjYscHJvcDMxLGVWYXI0Myxwcm9wNTIsZVZhcjUyLHByb3A1NixlVmFyNTYsZVZhcjUzLHByb3AxOCxwcm9wMTkscHJvcDIwLHByb3A0MSxldmVudHMnLCBsID0gdm9pZCAwICE9PSBlLnN0YXR1cyAmJiBlLnN0YXR1cyA/IGUuc3RhdHVzIDogJycpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFQb3BpbkFzazogJ2V2ZW50MTEyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc3RvTEE6ICdldmVudDExNCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiAoYSA9IG5bbF0sIHMucHJvcDE4ID0gcy5wYWdlTmFtZSwgcy5wcm9wMTkgPSBsLCBzLnByb3AyMCA9IHMucGFnZU5hbWUgKyAnOicgKyBsLCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbcl0gJiYgKGkgKz0gJzonICsgZVtyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHMuZVZhcjE0ID0gdCArICc6JyArIHMucGFnZU5hbWUgKyBpLCBzLmxpbmtUcmFja1ZhcnMgPSBzLmFwbChzLmxpbmtUcmFja1ZhcnMsICdlVmFyMTQnLCAnLCcsIDIpLCBzLmxpbmtUcmFja0V2ZW50cyA9IHMuZXZlbnRzID0gYSwgbmx0cmsgPSAneScsIGZkeF9maXJlU0RvdFRMKHRoaXMsICdvJywgdCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gZS5jaGF0UmVxdWVzdCAmJiBudWxsICE9PSBlLmNoYXRSZXF1ZXN0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAnJywgbyA9ICh0ID0gJycsICcnKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIChzLmxpbmtUcmFja1ZhcnMgPSAncHJvcDYsZVZhcjYscHJvcDMxLGVWYXI0Myxwcm9wNTIsZVZhcjUyLHByb3A1NixlVmFyNTYsZVZhcjUzLHByb3AxOCxwcm9wMTkscHJvcDIwLHByb3A0MSxldmVudHMnLCBlLmNoYXRSZXF1ZXN0WzBdLmNoYXREYXRhKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9ICcnICsgZS5jaGF0UmVxdWVzdFswXS5jaGF0RGF0YVtyXTsKICAgICAgICAgICAgICAgICAgICAgICAgbyArPSAnfCcgKyAociA9IHIucmVwbGFjZSgnfCcsICctJykpICsgJ18nICsgKGMgPSBjLnJlcGxhY2UoJ3wnLCAnLScpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKCdDSEFUJyA9PSBlLmNoYXRSZXF1ZXN0WzBdLmNsaWVudElkKQogICAgICAgICAgICAgICAgICAgICAgICB0ID0gJ2xpdmVhZ2VudF9DSEFUJywgYSA9ICdldmVudDQ1Jywgcy5wcm9wNTkgPSBzLmVWYXI1OSA9IG8ucmVwbGFjZSgnfCcsICcnKSwgcy5saW5rVHJhY2tWYXJzID0gcy5hcGwocy5saW5rVHJhY2tWYXJzLCAnZVZhcjU5LHByb3A1OScsICcsJywgMik7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoJ05JTkEnID09IGUuY2hhdFJlcXVlc3RbMF0uY2xpZW50SWQpCiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gJ3ZhX05JTkEnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBlLmNoYXRSZXF1ZXN0WzBdLmNoYXREYXRhLnN0YXR1czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAobiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YVBvcGluT3BlbjogJ2V2ZW50MTEyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YVBvcGluQ2xvc2U6ICdldmVudDExMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnN0b0xBOiAnZXZlbnQxMTQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVtsXSwgcy5lVmFyMTQgPSBvLnJlcGxhY2UoJ3wnLCAnJykucmVwbGFjZSgndmFQb3Bpbk9wZW4nLCAndmFQb3BpbicpLnJlcGxhY2UoJ3ZhUG9waW5DbG9zZScsICd2YVBvcGluJyksIHMubGlua1RyYWNrVmFycyA9IHMuYXBsKHMubGlua1RyYWNrVmFycywgJ2VWYXIxNCcsICcsJywgMik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZkeF9kZWJ1ZyhlLCAnU0MnLCAnZmR4X2xvZ0NoYXQ6TklOQScpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcy5saW5rVHJhY2tFdmVudHMgPSBzLmV2ZW50cyA9IGEsIG5sdHJrID0gJ3knLCBmZHhfZmlyZVNEb3RUTCh0aGlzLCAnbycsIHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBmZHhfZGVidWcoZSwgJ1NDJywgJ2ZkeF9sb2dDaGF0Jyk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl81ODRmZTNiN2E1YmNlOGQxKGUpIHsKICAgICAgICAgICAgY29uc3QgJF9fX29sZF85YmRmYTMwYzY4MmRhZGU5ID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ2xvY2FsU3RvcmFnZScpLCAkX19fb2xkX2VhMGIyYzIwMzcyMmRmNGMgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnc2Vzc2lvblN0b3JhZ2UnKTsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzliZGZhMzBjNjgyZGFkZTkpCiAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2xvY2FsU3RvcmFnZScsICRfX19tb2NrXzIxM2MyYzY5OGU1NzAyNzAubG9jYWxTdG9yYWdlKSk7CiAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9lYTBiMmMyMDM3MjJkZjRjKQogICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdzZXNzaW9uU3RvcmFnZScsICRfX19tb2NrXzIxM2MyYzY5OGU1NzAyNzAuc2Vzc2lvblN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZS5lVmFyNCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdsb2dpbjpzdGF0dXMnKSwgd2luZG93LmZkeF9jb250cm9sbGVyVmVyc2lvbiwgdm9pZCAwID09PSBlLnBhZ2VOYW1lICYmICcnID09IGUucGFnZU5hbWUgJiYgKF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OnBhZ2UgbmFtZScpLCAxKSAmJiBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpwYWdlIG5hbWUnKSAmJiAoZS5wYWdlTmFtZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OnBhZ2UgbmFtZScpKSwgZS5wYWdlTmFtZSA9IGUucGFnZU5hbWUudG9Mb3dlckNhc2UoKSwgZS5lVmFyMzggPSAnRD1wYWdlTmFtZScsIGUuZVZhcjUwID0gWwogICAgICAgICAgICAgICAgICAgICAgICBsb2NhdGlvbi5ob3N0LAogICAgICAgICAgICAgICAgICAgICAgICBsb2NhdGlvbi5wYXRobmFtZQogICAgICAgICAgICAgICAgICAgIF0uam9pbignJyksIGUucHJvcDQ2ID0gZS5lVmFyNDYgPSAnRD1wYWdlTmFtZSc7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuZXcgRGF0ZSgpLmdldEZ1bGxZZWFyKCksIG4gPSBlLmdldFRpbWVQYXJ0aW5nKCdoJywgJy02JywgdCksIGkgPSBlLmdldFRpbWVQYXJ0aW5nKCdkJywgJy02JywgdCk7CiAgICAgICAgICAgICAgICAgICAgZS5lVmFyNyA9IGUucHJvcDcgPSBuICsgJ3wnICsgaTsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG5ldyBEYXRlKCksIGEgPSByLmdldE1vbnRoKCkgKyAxLCBzID0gci5nZXREYXRlKCksIG8gPSByLmdldEZ1bGxZZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgZS5wcm9wNTIgPSBlLmVWYXI1MiA9IG8gKyAnLScgKyBhICsgJy0nICsgczsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGUuZ2V0UHJldmlvdXNWYWx1ZShlLnBhZ2VOYW1lLCAnZ3B2X3BhZ2VOYW1lJyk7CiAgICAgICAgICAgICAgICAgICAgYyAmJiAoZS5wcm9wMTIgPSBjLCBlLmVWYXIyID0gJ0Q9YzEyJyksIGUucHJvcDM1ID0gJ0Q9QWNjZXB0LUxhbmd1YWdlJywgZS5lVmFyNTMgPSAnKzEnLCBlLmVWYXI0MCA9ICdEPWV2ZW50cyc7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBlLmdldFBlcmNlbnRQYWdlVmlld2VkKGUucGFnZU5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IGwgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGwgJiYgNCA9PT0gbC5sZW5ndGggJiYgdm9pZCAwICE9PSBsWzJdICYmIChlLnByb3A2MCA9IGxbMl0gKyAnOicgKyBsWzFdKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZkeF9kZWJ1ZyhlLCAnU0MnLCAnc19kb1BsdWdpbnM6cHB2QXJyYXknKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKCdkJyA9PSBlLmxpbmtUeXBlICYmIHZvaWQgMCAhPT0gZS5saW5rT2JqZWN0LmRhdGFzZXQuYWx0ICYmIChlLmxpbmtUeXBlID0gJycpLCAnZCcgPT0gZS5saW5rVHlwZSAmJiB2b2lkIDAgIT09IGUubGlua09iamVjdCAmJiAwICE9PSBlLmxpbmtPYmplY3QgJiYgdm9pZCAwICE9PSBlLmxpbmtPYmplY3QuZ2V0QXR0cmlidXRlKCdocmVmJykgJiYgKGUudXJsID0gZS5saW5rT2JqZWN0LmdldEF0dHJpYnV0ZSgnaHJlZicpLCBlLnByb3AzNyA9IGUuZVZhcjM3ID0gZS51cmwuc3Vic3RyaW5nKGUudXJsLmxhc3RJbmRleE9mKCcvJykgKyAxLCBlLnVybC5sZW5ndGgpLCBlLmVWYXI0MyA9ICdEOicgKyBlLnByb3AzNywgZS5ldmVudHMgPSBlLmFwbChlLmV2ZW50cywgJ2V2ZW50MTInLCAnLCcsIDIpLCBlLmxpbmtUcmFja0V2ZW50cyA9ICdldmVudDEyJywgZS5saW5rVHJhY2tWYXJzID0gJ3Byb3AxOCxwcm9wMTkscHJvcDIwLGVWYXIzNyxlVmFyNDMsZXZlbnRzJyksICd5JyAhPSBubHRyayAmJiAoZS5lVmFyNiA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdsb2dpbjp1c2VyLWlkJyksIGUucHJvcDYgPSAnRD12NicsIGUubGlua1RyYWNrVmFycyA9IGUuYXBsKGUubGlua1RyYWNrVmFycywgJ3Byb3AyLHByb3AzLHByb3A0LHByb3A1LHByb3A2LHByb3AxOCxwcm9wMTkscHJvcDIwLHByb3AzMSxwcm9wMzMscHJvcDM1LHByb3A0OCxwcm9wNTAsZVZhcjQsZVZhcjYsZVZhcjEzLGVWYXI1MCcsICcsJywgMiksIGUuc2V0dXBMaW5rVHJhY2soJ3Byb3AxOCxwcm9wMTkscHJvcDIwJywgJ1NDX0xJTktTJyksIHZvaWQgMCAhPT0gZS5wcm9wMTkgJiYgJycgIT09IGUucHJvcDE5ICYmIChlLnByb3AxOS5pbmRleE9mKCdzcHJpdGUtcGxhY2Vob2xkZXIucG5nJykgPiAtMSAmJiAoZS5wcm9wMTkgPSAnaGRyfFNlYXJjaCcpLCBlLnByb3AyMCA9IGUucHJvcDE4ICsgJyB8ICcgKyBlLnByb3AxOSkpLCBlLmVWYXI0NSB8fCAoZS5lVmFyNDUgPSBlLlV0aWwuZ2V0UXVlcnlQYXJhbSgnSU5UQ01QJyksIGUuZVZhcjQ1ID0gZS5nZXRWYWxPbmNlKGUuZVZhcjQ1LCAnc19pbnRjYW1wYWlnbicsIDApLCBlLmNsaWNrUGFzdChlLmVWYXI0NSwgJ2V2ZW50ODInLCAnZXZlbnQ4MycsICdzX2NwLWJhZycpKSwgZS5lVmFyNDUgJiYgKGUubGlzdDEgPSBlLmVWYXI0NSwgZS5ldmVudHMgPSBlLmFwbChlLmV2ZW50cywgJ2V2ZW50NDQnLCAnLCcsIDIpKSwgIWUuY2FtcGFpZ24pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZS5jYW1wYWlnbiA9IGUuVXRpbC5nZXRRdWVyeVBhcmFtKCdDTVAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBlLlV0aWwuZ2V0UXVlcnlQYXJhbSgnTElOSycpOwogICAgICAgICAgICAgICAgICAgICAgICBlLmNhbXBhaWduICYmIHUgJiYgKGUuZVZhcjU4ID0gdSksICcnID09IGUuY2FtcGFpZ24gJiYgKGUuY2FtcGFpZ24gPSBmZHhfY2FtcGFpZ24oKSksIGUuY2FtcGFpZ24gPSBlLmdldFZhbE9uY2UoZS5jYW1wYWlnbiwgJ3NfY2FtcGFpZ24nLCAwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZS5jbGlja1Bhc3QoZS5jYW1wYWlnbiwgJ2V2ZW50MjMnLCAnZXZlbnQyNCcpOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gZS5nZXRBYW1TZWdtZW50cygnYWFtX3NjJywgJ2FhbXNjJykucmVwbGFjZSgvXHwvZywgJywnKTsKICAgICAgICAgICAgICAgICAgICBlLmxpc3QyID0gZS5hcGwoZS5saXN0MiwgZCwgJywnLCAyKSwgZS5wcm9wNDggPSBzX3ZlcnNpb24gKyAnXycgKyBzY19jb2RlX3ZlciArICdfJyArIHNjX2NvZGVfdmVyX2RhdGUsIGUucHJvcDUwID0gc19hY2NvdW50OwogICAgICAgICAgICAgICAgICAgIHZhciBwID0gX2ZkeC5nZXRUZXN0TGV2ZWwoKTsKICAgICAgICAgICAgICAgICAgICBwICYmIChlLnByb3A1MCArPSAnX0xhdW5jaF8nICsgcCksIGUuZVZhcjQxID0gZS5nZXRWaXNpdE51bSgnZCcpLCBlLnByb3AzMSA9ICcnICE9PSBlLnZpc2l0b3IuZ2V0QW5hbHl0aWNzVmlzaXRvcklEKCkgPyAnW0NTXXYxfCcgKyBlLnZpc2l0b3IuZ2V0QW5hbHl0aWNzVmlzaXRvcklEKCkgKyAnW0NFXScgOiBlLnZpc2l0b3IuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoKSwgbmx0cmsgPSAnJywgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHBycDcyICYmICcnICE9IHBycDcyICYmIChlLnByb3A3MiA9IHBycDcyKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9ICcnOwogICAgICAgICAgICAgICAgICAgIG51bGwgIT0gKGYgPSBfc2F0ZWxsaXRlLmNvb2tpZS5nZXQoJ1JidCcpKSAmJiAnJyAhPSBmICYmICdmMScgPT09IGYgJiYgKGUuYWJvcnQgPSAhMCk7CiAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF85YmRmYTMwYzY4MmRhZGU5KQogICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkXzliZGZhMzBjNjgyZGFkZTkpKTsKICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2VhMGIyYzIwMzcyMmRmNGMpCiAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ3Nlc3Npb25TdG9yYWdlJywgJF9fX29sZF9lYTBiMmMyMDM3MjJkZjRjKSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl84MDgzN2QzY2U4MjY2MDJkKCkgewogICAgICAgICAgICBpZiAocy5kb1BsdWdpbnMgPSBzX2RvUGx1Z2lucywgcy5wX2NoZWNrSW50ZXJ2YWwgPSBuZXcgQXJyYXkoKSwgcy5wX2NiY3QgPSAwLCBzLnRfY2IgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpczsKICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSA0MDAwOwogICAgICAgICAgICAgICAgICAgIHQgfHwgKHQgPSAnc19wX2NhbGxCYWNrQ29kZScpLCBpbnRlcnZhbCA9IDEwMCwgbi5wX2Nid2FpdCA9IDA7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAxOwogICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gbi5yYyAmJiAoaSA9IG4ucmNbbi52aXNpdG9yTmFtZXNwYWNlXSksIGkgPiBuLnBfY2JjdCAmJiAobi5wX2NiY3QrKywgbi5wX2NoZWNrSW50ZXJ2YWxbaV0gPSBzZXRJbnRlcnZhbCgncy5wX2NhbGxCYWNrKCcgKyBlICsgJywgJyArIGkgKyAnLCBcJycgKyB0ICsgJ1wnKScsIGludGVydmFsKSk7CiAgICAgICAgICAgICAgICB9LCBzLnBfY2FsbEJhY2sgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpczsKICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IG4udmlzaXRvck5hbWVzcGFjZSAmJiAobi52aXNpdG9yTmFtZXNwYWNlID0gc19hY2NvdW50KTsKICAgICAgICAgICAgICAgICAgICB2YXIgaSA9ICcnOwogICAgICAgICAgICAgICAgICAgIHQgPiAxICYmIChpID0gJ18nICsgKHQgLSAxKSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAnc19pXycgKyBuLnZpc2l0b3JOYW1lc3BhY2UgKyBpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IHdpbmRvd1tyXSAmJiB3aW5kb3dbcl0uaGVpZ2h0ID4gMCA/IChjbGVhckludGVydmFsKG4ucF9jaGVja0ludGVydmFsW3RdKSwgITApIDogKG4ucF9jYndhaXQgKz0gaW50ZXJ2YWwsIG4ucF9jYndhaXQgPiBlICYmIChjbGVhckludGVydmFsKG4ucF9jaGVja0ludGVydmFsW3RdKSwgdm9pZCAwICE9PSB3aW5kb3dbcl0gJiYgKHdpbmRvd1tyXS5zcmMgPSAnaHR0cHM6Ly93d3cuZmVkZXguY29tL2ltYWdlcy9hc2NlbmQvc2hhcmVkL2hlYWRlcnMvY29ycF9sb2dvLmdpZj9zY19yZXNwb25zZV9mYWlsdXJlJykpLCAhMSk7CiAgICAgICAgICAgICAgICB9LCBzLmxvb2t1cGxvb2t1cCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIsIGEsIHMsIG8sIGMsIGwsIHUgPSB0aGlzLCBkID0gMCwgcCA9IGUgPyBlLmxlbmd0aCA6IDAsIGYgPSBuZXcgQXJyYXkoKSwgZyA9IG5ldyBBcnJheSgpOwogICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBwOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICh0ID0gZS5pbmRleE9mKCd8JywgaSkpID4gLTEgJiYgKGZbZF0gPSBlLnN1YnN0cmluZyhpLCB0KSwgZCsrLCBpID0gdCk7CiAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGQ7IGkrKykgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSAwLCBhID0gZltpXSA/IGZbaV0ubGVuZ3RoIDogMCwgaiA9IDA7IGogPCBhOyBqKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHIgPSBmW2ldLmluZGV4T2YoJ34nLCBqKSkgPiAtMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnW25dID0gZltpXS5zdWJzdHJpbmcoaiwgciksIG4rKywgaiA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoLTEgPT0gciAmJiBuIDwgMyB8fCBuID4gMykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC0xID09IHIgJiYgMyA9PSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdbbl0gPSBmW2ldLnN1YnN0cmluZyhqKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoLTEgPT0gciAmJiAzID09IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvID0gZ1swXSwgcyA9IGdbMV0sIGMgPSBnWzJdLCBsID0gZ1szXSwgbyAmJiAnYycgPT0gYyAmJiB1LnBhZ2VOYW1lLmluZGV4T2YobykgPiAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUuZXZlbnRzID0gdS5hcGwodS5ldmVudHMsIGwsICcsJywgMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobyAmJiAnZScgPT0gYyAmJiB1LnBhZ2VOYW1lID09IG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LmV2ZW50cyA9IHUuYXBsKHUuZXZlbnRzLCBsLCAnLCcsIDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMgJiYgJ2MnID09IGMgJiYgZG9jdW1lbnQuVVJMLmluZGV4T2YocykgPiAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUuZXZlbnRzID0gdS5hcGwodS5ldmVudHMsIGwsICcsJywgMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocyAmJiAnZScgPT0gYyAmJiBkb2N1bWVudC5VUkwgPT0gcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUuZXZlbnRzID0gdS5hcGwodS5ldmVudHMsIGwsICcsJywgMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBzLmZhZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG47CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5hY3RpdmVFbGVtZW50IHx8ICFlLmFjdGl2ZUVsZW1lbnQudHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gKHQgPSBlLmFjdGl2ZUVsZW1lbnQpLnR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWRvY3VtZW50LmFjdGl2ZUVsZW1lbnQgfHwgIWRvY3VtZW50LmFjdGl2ZUVsZW1lbnQudHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gKHQgPSBkb2N1bWVudC5hY3RpdmVFbGVtZW50KS50eXBlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndGV4dCcgPT0gbiB8fCAndGV4dGFyZWEnID09IG4gfHwgJ2NoZWNrYm94JyA9PSBuIHx8ICdyYWRpbycgPT0gbiB8fCAnc2VsZWN0LW9uZScgPT0gbiB8fCAnYnV0dG9uJyA9PSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHQuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJycgPT0gKGkgPSAnJyA9PT0gaSA/IHQubmFtZSA6IGkpICYmIHQub3V0ZXJIVE1MICYmICcnICE9PSB0Lm91dGVySFRNTCAmJiAoaSA9IHQub3V0ZXJIVE1MLnN1YnN0cmluZygwLCA4NSkpLCAnJyA9PT0gaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZmR4X2dldENvb2tpZSgnc19sZmYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gKGkgPSB2b2lkIDAgIT09IHIgPyByIDogJ1tQTjonICsgcy5wYWdlTmFtZSArICddJykucmVwbGFjZShzLmZvcm1OYW1lICsgJ3wnLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZHhfc2V0Q29va2llKCdzX2xmZicsIHMuZm9ybU5hbWUgKyAnfCcgKyBpLCAzMCwgJy8nLCAnLmZlZGV4LmNvbScpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmZHhfZGVidWcoZSwgJ1NDJywgJ3MuZmFlJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgcy5wYXJ0bmVyREZBQ2hlY2sgPSBuZXcgRnVuY3Rpb24oJ2NmZycsICd2YXIgcz10aGlzLGM9Y2ZnLnZpc2l0Q29va2llLHNyYz1jZmcuY2xpY2tUaHJvdWdoUGFyYW0sc2NwPWNmZy5zZWFyY2hDZW50ZXJQYXJhbSxwPWNmZy5uZXdSc2lkc1Byb3AsdHY9Y2ZnLnRFdmFyLGRsPVwnLFwnLGNyLG5jLHEsZyxncyxpLGosayxmbmQsdj0xLHQ9bmV3IERhdGUsY249MCxjYT1uZXcgQXJyYXksYWE9bmV3IEFycmF5LGNzPW5ldyBBcnJheTt0LnNldFRpbWUodC5nZXRUaW1lKCkrMTgwMDAwMCk7Y3I9cy5jX3IoYyk7aWYoY3Ipe3Y9MDt9Y2E9cy5zcGxpdChjcixkbCk7aWYocy51bilhYT1zLnNwbGl0KHMudW4sZGwpO2Vsc2UgYWE9cy5zcGxpdChzLmFjY291bnQsZGwpO2ZvcihpPTA7aTxhYS5sZW5ndGg7aSsrKXtmbmQgPSAwO2ZvcihqPTA7ajxjYS5sZW5ndGg7aisrKXtpZihhYVtpXSA9PSBjYVtqXSl7Zm5kPTE7fX1pZighZm5kKXtjc1tjbl09YWFbaV07Y24rKzt9fWlmKGNzLmxlbmd0aCl7Zm9yKGs9MDtrPGNzLmxlbmd0aDtrKyspe25jPShuYz9uYytkbDpcJ1wnKStjc1trXTt9Y3I9KGNyP2NyK2RsOlwnXCcpK25jO3MudnByKHAsbmMpO3Y9MTt9aWYocy53ZClxPXMud2QubG9jYXRpb24uc2VhcmNoLnRvTG93ZXJDYXNlKCk7ZWxzZSBxPXMudy5sb2NhdGlvbi5zZWFyY2gudG9Mb3dlckNhc2UoKTtxPXMucmVwbChxLFwnP1wnLFwnJlwnKTtnPXEuaW5kZXhPZihcJyZcJytzcmMudG9Mb3dlckNhc2UoKStcJz1cJyk7Z3M9KHNjcCk/cS5pbmRleE9mKFwnJlwnK3NjcC50b0xvd2VyQ2FzZSgpK1wnPVwnKTotMTtpZihnPi0xKXtzLnZwcihwLGNyKTt2PTE7fWVsc2UgaWYoZ3M+LTEpe3Y9MDtzLnZwcih0dixcJ1NlYXJjaENlbnRlciBWaXNpdG9yc1wnKTt9aWYoIXMuY193KGMsY3IsdCkpe3MuY193KGMsY3IsMCk7fWlmKCFzLmNfcihjKSl7dj0wO31yZXR1cm4gdj49MTsnKSwgcy52cHIgPSBuZXcgRnVuY3Rpb24oJ3ZzJywgJ3YnLCAnaWYodHlwZW9mKHYpIT1cJ3VuZGVmaW5lZFwnICYmIHZzKXt2YXIgcz10aGlzOyBldmFsKFwncy5cJyt2cytcJz0iXCcrditcJyJcJyl9JyksIHMuZ2V0QWN0aW9uRGVwdGggPSBuZXcgRnVuY3Rpb24oJ2MnLCAndmFyIHM9dGhpcyx2PTEsdD1uZXcgRGF0ZTt0LnNldFRpbWUodC5nZXRUaW1lKCkrMTgwMDAwMCk7aWYoIXMuY19yKGMpKXt2PTF9aWYocy5jX3IoYykpe3Y9cy5jX3IoYyk7disrfWlmKCFzLmNfdyhjLHYsdCkpe3MuY193KGMsdiwwKX1yZXR1cm4gdjsnKSwgcy5nZXRWaXNpdE51bSA9IG5ldyBGdW5jdGlvbigndHAnLCAnYycsICdjMicsICd2YXIgcz10aGlzLGU9bmV3IERhdGUsY3ZhbCxjdmlzaXQsY3Q9ZS5nZXRUaW1lKCksZDtpZighdHApe3RwPVwnbVwnO31pZih0cD09XCdtXCd8fHRwPT1cJ3dcJ3x8dHA9PVwnZFwnKXtlbz1zLmVuZG9mKHRwKSx5PWVvLmdldFRpbWUoKTtlLnNldFRpbWUoeSk7fWVsc2Uge2Q9dHAqODY0MDAwMDA7ZS5zZXRUaW1lKGN0K2QpO31pZighYyl7Yz1cJ3Nfdm51bVwnO31pZighYzIpe2MyPVwnc19pbnZpc2l0XCc7fWN2YWw9cy5jX3IoYyk7aWYoY3ZhbCl7dmFyIGk9Y3ZhbC5pbmRleE9mKFwnJnZuPVwnKSxzdHI9Y3ZhbC5zdWJzdHJpbmcoaSs0LGN2YWwubGVuZ3RoKSxrO31jdmlzaXQ9cy5jX3IoYzIpO2lmKGN2aXNpdCl7aWYoc3RyKXtlLnNldFRpbWUoY3QrMTgwMDAwMCk7cy5jX3coYzIsXCd0cnVlXCcsZSk7cmV0dXJuIHN0cjt9ZWxzZSB7cmV0dXJuIFwndW5rbm93biB2aXNpdCBudW1iZXJcJzt9fWVsc2Uge2lmKHN0cil7c3RyKys7az1jdmFsLnN1YnN0cmluZygwLGkpO2Uuc2V0VGltZShrKTtzLmNfdyhjLGsrXCcmdm49XCcrc3RyLGUpO2Uuc2V0VGltZShjdCsxODAwMDAwKTtzLmNfdyhjMixcJ3RydWVcJyxlKTtyZXR1cm4gc3RyO31lbHNlIHtzLmNfdyhjLGUuZ2V0VGltZSgpK1wnJnZuPTFcJyxlKTtlLnNldFRpbWUoY3QrMTgwMDAwMCk7cy5jX3coYzIsXCd0cnVlXCcsZSk7cmV0dXJuIDE7fX0nKSwgcy5kaW1vID0gbmV3IEZ1bmN0aW9uKCdtJywgJ3knLCAndmFyIGQ9bmV3IERhdGUoeSxtKzEsMCk7cmV0dXJuIGQuZ2V0RGF0ZSgpOycpLCBzLmVuZG9mID0gbmV3IEZ1bmN0aW9uKCd4JywgJ3ZhciB0PW5ldyBEYXRlO3Quc2V0SG91cnMoMCk7dC5zZXRNaW51dGVzKDApO3Quc2V0U2Vjb25kcygwKTtpZih4PT1cJ21cJyl7ZD1zLmRpbW8odC5nZXRNb250aCgpLHQuZ2V0RnVsbFllYXIoKSktdC5nZXREYXRlKCkrMTt9ZWxzZSBpZih4PT1cJ3dcJyl7ZD03LXQuZ2V0RGF5KCk7fWVsc2Uge2Q9MTt9dC5zZXREYXRlKHQuZ2V0RGF0ZSgpK2QpO3JldHVybiB0OycpLCBzLmdldFZpc2l0U3RhcnQgPSBuZXcgRnVuY3Rpb24oJ2MnLCAndmFyIHM9dGhpcyx2PTEsdD1uZXcgRGF0ZTt0LnNldFRpbWUodC5nZXRUaW1lKCkrMTgwMDAwMCk7aWYocy5jX3IoYykpe3Y9MH1pZighcy5jX3coYywxLHQpKXtzLmNfdyhjLDEsMCl9aWYoIXMuY19yKGMpKXt2PTB9cmV0dXJuIHY7JyksIHMuY3Jvc3NWaXNpdFBhcnRpY2lwYXRpb24gPSBuZXcgRnVuY3Rpb24oJ3YnLCAnY24nLCAnZXgnLCAnY3QnLCAnZGwnLCAnZXYnLCAnZHYnLCAndmFyIHM9dGhpcyxjZTtpZih0eXBlb2YoZHYpPT09XCd1bmRlZmluZWRcJylkdj0wO2lmKHMuZXZlbnRzJiZldil7dmFyIGF5PXMuc3BsaXQoZXYsXCcsXCcpO3ZhciBlYT1zLnNwbGl0KHMuZXZlbnRzLFwnLFwnKTtmb3IodmFyIHU9MDt1PGF5Lmxlbmd0aDt1Kyspe2Zvcih2YXIgeD0wO3g8ZWEubGVuZ3RoO3grKyl7aWYoYXlbdV09PWVhW3hdKXtjZT0xO319fX1pZighdnx8dj09XCdcJyl7aWYoY2Upe3MuY193KGNuLFwnXCcpO3JldHVyblwnXCc7fWVsc2UgcmV0dXJuXCdcJzt9dj1lc2NhcGUodik7dmFyIGFycnk9bmV3IEFycmF5KCksYT1uZXcgQXJyYXkoKSxjPXMuY19yKGNuKSxnPTAsaD1uZXcgQXJyYXkoKTtpZihjJiZjIT1cJ1wnKXthcnJ5PXMuc3BsaXQoYyxcJ10sW1wnKTtmb3IocT0wO3E8YXJyeS5sZW5ndGg7cSsrKXt6PWFycnlbcV07ej1zLnJlcGwoeixcJ1tcJyxcJ1wnKTt6PXMucmVwbCh6LFwnXVwnLFwnXCcpO3o9cy5yZXBsKHosIlwnIixcJ1wnKTthcnJ5W3FdPXMuc3BsaXQoeixcJyxcJyl9fXZhciBlPW5ldyBEYXRlKCk7ZS5zZXRGdWxsWWVhcihlLmdldEZ1bGxZZWFyKCkrNSk7aWYoZHY9PTAmJmFycnkubGVuZ3RoPjAmJmFycnlbYXJyeS5sZW5ndGgtMV1bMF09PXYpYXJyeVthcnJ5Lmxlbmd0aC0xXT1bdixuZXcgRGF0ZSgpLmdldFRpbWUoKV07ZWxzZSBhcnJ5W2FycnkubGVuZ3RoXT1bdixuZXcgRGF0ZSgpLmdldFRpbWUoKV07dmFyIHN0YXJ0PWFycnkubGVuZ3RoLWN0PDA/MDphcnJ5Lmxlbmd0aC1jdDt2YXIgdGQ9bmV3IERhdGUoKTtmb3IodmFyIHg9c3RhcnQ7eDxhcnJ5Lmxlbmd0aDt4Kyspe3ZhciBkaWZmPU1hdGgucm91bmQoKHRkLmdldFRpbWUoKS1hcnJ5W3hdWzFdKS84NjQwMDAwMCk7aWYoZGlmZjxleCl7aFtnXT11bmVzY2FwZShhcnJ5W3hdWzBdKTthW2ddPVthcnJ5W3hdWzBdLGFycnlbeF1bMV1dO2crKzt9fXZhciBkYXRhPXMuam9pbihhLHtkZWxpbTpcJyxcJyxmcm9udDpcJ1tcJyxiYWNrOlwnXVwnLHdyYXA6IlwnIn0pO3MuY193KGNuLGRhdGEsZSk7dmFyIHI9cy5qb2luKGgse2RlbGltOmRsfSk7aWYoY2Upcy5jX3coY24sXCdcJyk7cmV0dXJuIHI7JyksIHMucF9ncHZuZSA9IG5ldyBGdW5jdGlvbignaycsICd1JywgJ3ZhciBzPXRoaXMsdj1cJ1wnLGk9dS5pbmRleE9mKFwnP1wnKSxxO2lmKGsmJmk+LTEpe3E9dS5zdWJzdHJpbmcoaSsxKTt2PXMucHQocSxcJyZcJyxcJ3BfZ3ZmbmVcJyxrKX1yZXR1cm4gdicpLCBzLnBfZ3ZmbmUgPSBuZXcgRnVuY3Rpb24oJ3QnLCAnaycsICdpZih0KXt2YXIgcz10aGlzLGk9dC5pbmRleE9mKFwnPVwnKSxwPWk8MD90OnQuc3Vic3RyaW5nKDAsaSksdj1pPDA/XCdUcnVlXCc6dC5zdWJzdHJpbmcoaSsxKTtpZihwLnRvTG93ZXJDYXNlKCk9PWsudG9Mb3dlckNhc2UoKSlyZXR1cm4gdjt9cmV0dXJuIFwnXCcnKSwgcy5wdCA9IG5ldyBGdW5jdGlvbigneCcsICdkJywgJ2YnLCAnYScsICd2YXIgcz10aGlzLHQ9eCx6PTAseSxyO3doaWxlKHQpe3k9dC5pbmRleE9mKGQpO3k9eTwwP3QubGVuZ3RoOnk7dD10LnN1YnN0cmluZygwLHkpO3I9c1tmXSh0LGEpO2lmKHIpcmV0dXJuIHI7eis9eStkLmxlbmd0aDt0PXguc3Vic3RyaW5nKHoseC5sZW5ndGgpO3Q9ejx4Lmxlbmd0aD90OlwnXCd9cmV0dXJuXCdcJzsnKSwgcy5nZXRRdWVyeVBhcmFtTm9FbmNvZGUgPSBuZXcgRnVuY3Rpb24oJ3AnLCAnZCcsICd1JywgJ3ZhciBzPXRoaXMsdj1cJ1wnLGksdDtkPWQ/ZDpcJ1wnO3U9dT91OihzLnBhZ2VVUkw/cy5wYWdlVVJMOndpbmRvdy5sb2NhdGlvbik7aWYodT09XCdmXCcpdT1zLmd0ZnMoKS5sb2NhdGlvbjt3aGlsZShwKXtpPXAuaW5kZXhPZihcJyxcJyk7aT1pPDA/cC5sZW5ndGg6aTt0PXMucF9ncHZuZShwLnN1YnN0cmluZygwLGkpLHUrXCdcJyk7aWYodCl2Kz12P2QrdDp0O3A9cC5zdWJzdHJpbmcoaT09cC5sZW5ndGg/aTppKzEpfXJldHVybiB2JyksIHMuZ2V0TmV3UmVwZWF0ID0gbmV3IEZ1bmN0aW9uKCdkJywgJ2NuJywgJ3ZhciBzPXRoaXMsZT1uZXcgRGF0ZSgpLGN2YWwsc3ZhbCxjdD1lLmdldFRpbWUoKTtkPWQ/ZDozMDtjbj1jbj9jbjpcJ3NfbnJcJztlLnNldFRpbWUoY3QrZCoyNCo2MCo2MCoxMDAwKTtjdmFsPXMuY19yKGNuKTtpZihjdmFsLmxlbmd0aD09MCl7cy5jX3coY24sY3QrXCctTmV3XCcsZSk7cmV0dXJuXCdOZXdcJzt9c3ZhbD1zLnNwbGl0KGN2YWwsXCctXCcpO2lmKGN0LXN2YWxbMF08MzAqNjAqMTAwMCYmc3ZhbFsxXT09XCdOZXdcJyl7cy5jX3coY24sY3QrXCctTmV3XCcsZSk7cmV0dXJuXCdOZXdcJzt9ZWxzZXtzLmNfdyhjbixjdCtcJy1SZXBlYXRcJyxlKTtyZXR1cm5cJ1JlcGVhdFwnO30nKSwgcy5nZXRWYWxPbmNlID0gbmV3IEZ1bmN0aW9uKCd2JywgJ2MnLCAnZScsICd2YXIgcz10aGlzLGs9cy5jX3IoYyksYT1uZXcgRGF0ZTtlPWU/ZTowO2lmKHYpe2Euc2V0VGltZShhLmdldFRpbWUoKStlKjg2NDAwMDAwKTtzLmNfdyhjLHYsZT9hOjApO31yZXR1cm4gdj09az9cJ1wnOnYnKSwgcy5nZXRQcmV2aW91c1ZhbHVlID0gbmV3IEZ1bmN0aW9uKCd2JywgJ2MnLCAnZWwnLCAndmFyIHM9dGhpcyx0PW5ldyBEYXRlLGksaixyPVwnXCc7dC5zZXRUaW1lKHQuZ2V0VGltZSgpKzE4MDAwMDApO2lmKGVsKXtpZihzLmV2ZW50cyl7aT1zLnNwbGl0KGVsLFwnLFwnKTtqPXMuc3BsaXQocy5ldmVudHMsXCcsXCcpO2Zvcih4IGluIGkpe2Zvcih5IGluIGope2lmKGlbeF09PWpbeV0pe2lmKHMuY19yKGMpKSByPXMuY19yKGMpO3Y/cy5jX3coYyx2LHQpOnMuY193KGMsXCdubyB2YWx1ZVwnLHQpO3JldHVybiByfX19fX1lbHNle2lmKHMuY19yKGMpKSByPXMuY19yKGMpO3Y/cy5jX3coYyx2LHQpOnMuY193KGMsXCdubyB2YWx1ZVwnLHQpO3JldHVybiByfScpLCBzLmdldFRpbWVQYXJ0aW5nID0gbmV3IEZ1bmN0aW9uKCd0JywgJ3onLCAneScsICdkYz1uZXcgRGF0ZShcJzEvMS8yMDAwXCcpO2Y9MTU7bmU9ODtpZihkYy5nZXREYXkoKSE9Nnx8ZGMuZ2V0TW9udGgoKSE9MCl7cmV0dXJuXCdEYXRhIE5vdCBBdmFpbGFibGVcJ31lbHNlezt6PXBhcnNlSW50KHopO2lmKHk9PVwnMjAwOVwnKXtmPTg7bmU9MX07Z21hcj1uZXcgRGF0ZShcJzMvMS9cJyt5KTtkc3RzPWYtZ21hci5nZXREYXkoKTtnbm92PW5ldyBEYXRlKFwnMTEvMS9cJyt5KTtkc3RlPW5lLWdub3YuZ2V0RGF5KCk7c3ByPW5ldyBEYXRlKFwnMy9cJytkc3RzK1wnL1wnK3kpO2ZsPW5ldyBEYXRlKFwnMTEvXCcrZHN0ZStcJy9cJyt5KTtjZD1uZXcgRGF0ZSgpO2lmKGNkPnNwciYmY2Q8Zmwpe3o9eisxfWVsc2V7ej16fTt1dGM9Y2QuZ2V0VGltZSgpKyhjZC5nZXRUaW1lem9uZU9mZnNldCgpKjYwMDAwKTt0ej1uZXcgRGF0ZSh1dGMgKyAoMzYwMDAwMCp6KSk7dGhpc3k9dHouZ2V0RnVsbFllYXIoKTt2YXIgZGF5cz1bXCdTdW5kYXlcJyxcJ01vbmRheVwnLFwnVHVlc2RheVwnLFwnV2VkbmVzZGF5XCcsXCdUaHVyc2RheVwnLFwnRnJpZGF5XCcsXCdTYXR1cmRheVwnXTtpZih0aGlzeSE9eSl7cmV0dXJuXCdEYXRhIE5vdCBBdmFpbGFibGVcJ31lbHNlezt0aGlzaD10ei5nZXRIb3VycygpO3RoaXNtaW49dHouZ2V0TWludXRlcygpO3RoaXNkPXR6LmdldERheSgpO3ZhciBkb3c9ZGF5c1t0aGlzZF07dmFyIGFwPVwnQU1cJzt2YXIgZHQ9XCdXZWVrZGF5XCc7dmFyIG1pbnQ9XCcwMFwnO2lmKHRoaXNtaW4+MzApe21pbnQ9XCczMFwnfWlmKHRoaXNoPj0xMil7YXA9XCdQTVwnO3RoaXNoPXRoaXNoLTEyfTtpZiAodGhpc2g9PTApe3RoaXNoPTEyfTtpZih0aGlzZD09Nnx8dGhpc2Q9PTApe2R0PVwnV2Vla2VuZFwnfTt2YXIgdGltZXN0cmluZz10aGlzaCtcJzpcJyttaW50K2FwO3ZhciBkYXlzdHJpbmc9ZG93O3ZhciBlbmRzdHJpbmc9ZHQ7aWYodD09XCdoXCcpe3JldHVybiB0aW1lc3RyaW5nfWlmKHQ9PVwnZFwnKXtyZXR1cm4gZGF5c3RyaW5nfTtpZih0PT1cJ3dcJyl7cmV0dXJuIGVuZHN0cmluZ319fTsnKSwgcy5zZXR1cExpbmtUcmFjayA9IG5ldyBGdW5jdGlvbigndmwnLCAnYycsICdlJywgJ3ZhciBzPXRoaXM7dmFyIGN2PXMuY19yKGMpO2lmKHZsKXt2YXIgdmxhPXZsLnNwbGl0KFwnLFwnKTt9aWYoY3YhPVwnXCcpe3ZhciBjdmE9cy5zcGxpdChjdixcJ15eXCcpO2lmKGN2YVsxXSE9XCdcJyl7Zm9yKHggaW4gdmxhKXtzW3ZsYVt4XV09Y3ZhW3hdO2lmKGUpe3MuZXZlbnRzPXMuYXBsKHMuZXZlbnRzLGUsXCcsXCcsMik7fX19fXMuY193KGMsXCdcJywwKTtpZih0eXBlb2Ygcy5saW5rT2JqZWN0IT1cJ3VuZGVmaW5lZFwnJiZzLmhieF9sdCE9XCdtYW51YWxcJyl7cy5sdGE9W107aWYodHlwZW9mIHMubGlua09iamVjdCE9bnVsbCl7c2xvPXMubGlua09iamVjdDtpZihzLmxpbmtPYmplY3QhPTApe2lmKHMubGlua09iamVjdC5nZXRBdHRyaWJ1dGUoXCduYW1lXCcpIT1udWxsKXt2YXIgYj1zLmxpbmtPYmplY3QuZ2V0QXR0cmlidXRlKFwnbmFtZVwnKTtpZihiLmluZGV4T2YoXCcmbHBvcz1cJyk+LTEpe3MubHRhWzNdPWIubWF0Y2goXCcmbHBvcz0oW14mXSopXCcpWzFdO31pZihiLmluZGV4T2YoXCcmbGlkPVwnKT4tMSl7cy5sdGFbMV09Yi5tYXRjaChcJyZsaWQ9KFteJl0qKVwnKVsxXTt9fX1pZih0eXBlb2Ygcy5sdGFbMV09PVwndW5kZWZpbmVkXCcpe2lmKHMubGlua05hbWUhPTApe3MubHRhWzFdPXMubGlua05hbWU7fWVsc2UgaWYocy5saW5rT2JqZWN0IT0wKXtpZihzLmxpbmtPYmplY3QuaW5uZXJIVE1MLmluZGV4T2YoXCc8aW1nXCcpPi0xKXtzLmx0YVsxXT1zLmxpbmtPYmplY3QuaW5uZXJIVE1MLm1hdGNoKFwnc3JjPSIoW14iXSopXCcpWzFdO31lbHNle3MubHRhWzFdPXMubGlua09iamVjdC5pbm5lckhUTUw7fX1lbHNlIGlmKHMubGlua1VSTCl7cy5sdGFbMV09cy5saW5rVVJMO31lbHNle3MubHRhWzFdPW51bGw7fX1pZihzLmx0YVsxXSE9bnVsbCl7aWYodHlwZW9mIHMucGFnZU5hbWUhPVwndW5kZWZpbmVkXCcpcy5sdGFbMF09cy5wYWdlTmFtZTtzLmx0YVsyXT1zLnBhZ2VOYW1lK1wnIHwgXCcrcy5sdGFbMV07fX1pZihzLmxpbmtUeXBlIT0wKXtmb3IodmFyIHg9MDt4PHZsYS5sZW5ndGg7eCsrKXtzW3ZsYVt4XV09cy5jbGVhblN0cihzLmx0YVt4XSk7aWYoZSl7cy5ldmVudHM9cy5hcGwocy5ldmVudHMsZSxcJyxcJywyKTtzLmxpbmtUcmFja1ZhcnM9cy5hcGwocy5saW5rVHJhY2tWYXJzLFwnZXZlbnRzXCcsXCcsXCcsMik7fX1zLmxpbmtUcmFja1ZhcnM9cy5hcGwocy5saW5rVHJhY2tWYXJzLHZsLFwnLFwnLDIpO31lbHNle2lmKHMubHRhWzFdKXt2YXIgdGN2PVwnXCc7Zm9yKHZhciB4PTA7eDxzLmx0YS5sZW5ndGg7eCsrKXt0Y3YrPXMuY2xlYW5TdHIocy5sdGFbeF0pK1wnXl5cJzt9cy5jX3coYyx0Y3YpO319cy5sdGE9bnVsbDt9JyksIHMuY2xlYW5TdHIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gKGUgPSBlLnJlcGxhY2UoLzxcLz9bXj5dKyg+fCQpL2csICcnKSkucmVwbGFjZSgvXlxzK3xccyskL2csICcnKTsKICAgICAgICAgICAgICAgIH0sIHMuc3BsaXQgPSBuZXcgRnVuY3Rpb24oJ2wnLCAnZCcsICd2YXIgaSx4PTAsYT1uZXcgQXJyYXk7d2hpbGUobCl7aT1sLmluZGV4T2YoZCk7aT1pPi0xP2k6bC5sZW5ndGg7YVt4KytdPWwuc3Vic3RyaW5nKDAsaSk7bD1sLnN1YnN0cmluZyhpK2QubGVuZ3RoKTt9cmV0dXJuIGEnKSwgcy5hcGwgPSBuZXcgRnVuY3Rpb24oJ0wnLCAndicsICdkJywgJ3UnLCAndmFyIHM9dGhpcyxtPTA7aWYoIUwpTD1cJ1wnO2lmKHUpe3ZhciBpLG4sYT1zLnNwbGl0KEwsZCk7Zm9yKGk9MDtpPGEubGVuZ3RoO2krKyl7bj1hW2ldO209bXx8KHU9PTE/KG49PXYpOihuLnRvTG93ZXJDYXNlKCk9PXYudG9Mb3dlckNhc2UoKSkpO319aWYoIW0pTD1MP0wrZCt2OnY7cmV0dXJuIEwnKSwgcy5yZmwgPSBmdW5jdGlvbiAoZSwgdCwgbiwgaSwgcikgewogICAgICAgICAgICAgICAgICAgIGlmICghZSB8fCAhdCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgIHZhciBhID0gW10sIHMgPSAnJzsKICAgICAgICAgICAgICAgICAgICBpID0gaSB8fCBuLCByID0gISFyLCBuID0gKGUgPSBlLnNwbGl0KG4gfHwgJywnKSkubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gPSAwOyBvIDwgbjsgbysrKQogICAgICAgICAgICAgICAgICAgICAgICAtMSA8IGVbb10uaW5kZXhPZignOicpICYmICgocyA9IGVbb10uc3BsaXQoJzonKSlbMV0gPSBzWzBdICsgJzonICsgc1sxXSwgZVtvXSA9IHNbMF0pLCAtMSA8IGVbb10uaW5kZXhPZignPScpICYmICgocyA9IGVbb10uc3BsaXQoJz0nKSlbMV0gPSBzWzBdICsgJz0nICsgc1sxXSwgZVtvXSA9IHNbMF0pLCBlW29dICE9PSB0ICYmIHMgPyBhLnB1c2goc1sxXSkgOiBlW29dICE9PSB0ID8gYS5wdXNoKGVbb10pIDogZVtvXSA9PT0gdCAmJiByICYmIChzID8gYS5wdXNoKHNbMV0pIDogYS5wdXNoKGVbb10pLCByID0gITEpLCBzID0gJyc7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuam9pbihpKTsKICAgICAgICAgICAgICAgIH0sIHMuZ2V0QW5kUGVyc2lzdFZhbHVlID0gbmV3IEZ1bmN0aW9uKCd2JywgJ2MnLCAnZScsICd2YXIgcz10aGlzLGE9bmV3IERhdGU7ZT1lP2U6MDthLnNldFRpbWUoYS5nZXRUaW1lKCkrZSo4NjQwMDAwMCk7aWYodilzLmNfdyhjLHYsZT9hOjApO3JldHVybiBzLmNfcihjKTsnKSwgcy5qb2luID0gbmV3IEZ1bmN0aW9uKCd2JywgJ3AnLCAndmFyIHMgPSB0aGlzO3ZhciBmLGIsZCx3O2lmKHApe2Y9cC5mcm9udD9wLmZyb250OlwnXCc7Yj1wLmJhY2s/cC5iYWNrOlwnXCc7ZD1wLmRlbGltP3AuZGVsaW06XCdcJzt3PXAud3JhcD9wLndyYXA6XCdcJzt9dmFyIHN0cj1cJ1wnO2Zvcih2YXIgeD0wO3g8di5sZW5ndGg7eCsrKXtpZih0eXBlb2Yodlt4XSk9PVwnb2JqZWN0XCcgKXN0cis9cy5qb2luKCB2W3hdLHApO2Vsc2Ugc3RyKz13K3ZbeF0rdztpZih4PHYubGVuZ3RoLTEpc3RyKz1kO31yZXR1cm4gZitzdHIrYjsnKSwgcy5zb2NpYWxQbGF0Zm9ybXMgPSBuZXcgRnVuY3Rpb24oJ2EnLCAndmFyIHM9dGhpcyxnLEssRCxFLEYsaTtnPXMucmVmZXJyZXI/cy5yZWZlcnJlcjpkb2N1bWVudC5yZWZlcnJlcjtnPWcudG9Mb3dlckNhc2UoKTtLPXMuc3BsaXQocy5zb2NQbGF0TGlzdCxcJ3xcJyk7Zm9yKGk9MDtpPEsubGVuZ3RoO2krKyl7RD1zLnNwbGl0KEtbaV0sXCc+XCcpO2lmKGcuaW5kZXhPZihEWzBdKSE9LTEpe3MuY29udGV4dERhdGFbXCdhLnNvY2lhbGNvbnRlbnRwcm92aWRlclwnXT1EWzFdO319JyksIHMuc29jUGxhdExpc3QgPSAnZmFjZWJvb2suY29tPkZhY2Vib29rfHR3aXR0ZXIuY29tPlR3aXR0ZXJ8dC5jby8+VHdpdHRlcnx5b3V0dWJlLmNvbT5Zb3V0dWJlfGNsaXBtYXJrcy5jb20+Q2xpcG1hcmtzfGRhaWx5bW90aW9uLmNvbT5EYWlseW1vdGlvbnxkZWxpY2lvdXMuY29tPkRlbGljaW91c3xkaWdnLmNvbT5EaWdnfGRpaWdvLmNvbT5EaWlnb3xmbGlja3IuY29tPkZsaWNrcnxmbGl4c3Rlci5jb20+RmxpeHN0ZXJ8Zm90b2xvZy5jb20+Rm90b2xvZ3xmcmllbmRmZWVkLmNvbT5GcmllbmRGZWVkfGdvb2dsZS5jb20vYnV6ej5Hb29nbGUgQnV6enxidXp6Lmdvb2dsZWFwaXMuY29tPkdvb2dsZSBCdXp6fHBsdXMuZ29vZ2xlLmNvbT5Hb29nbGUrfGh1bHUuY29tPkh1bHV8aWRlbnRpLmNhPmlkZW50aS5jYXxpbGlrZS5jb20+aUxpa2V8aW50ZW5zZWRlYmF0ZS5jb20+SW50ZW5zZURlYmF0ZXxteXNwYWNlLmNvbT5NeVNwYWNlfG5ld3NnYXRvci5jb20+TmV3c2dhdG9yfHBob3RvYnVja2V0LmNvbT5QaG90b2J1Y2tldHxwbHVyay5jb20+UGx1cmt8c2xpZGVzaGFyZS5uZXQ+U2xpZGVTaGFyZXxzbXVnbXVnLmNvbT5TbXVnTXVnfHN0dW1ibGV1cG9uLmNvbT5TdHVtYmxlVXBvbnx0dW1ibHIuY29tPlR1bWJscnx2aW1lby5jb20+VmltZW98d29yZHByZXNzLmNvbT5Xb3JkUHJlc3N8eGFuZ2EuY29tPlhhbmdhfG1ldGFjYWZlLmNvbT5NZXRhY2FmZXxwaW50ZXJlc3QuY29tPlBpbnRlcmVzdCcsIHMuc29jaWFsQXV0aG9ycyA9IG5ldyBGdW5jdGlvbignJywgJ3ZhciBzPXRoaXMsZztnPXMucmVmZXJyZXI/cy5yZWZlcnJlcjpkb2N1bWVudC5yZWZlcnJlcjtpZihnLmluZGV4T2YoXCdodHRwOi8vdC5jby9cJyk9PT0wfHxnLmluZGV4T2YoXCdodHRwczovL3QuY28vXCcpPT09MHx8Zy5pbmRleE9mKFwncGludGVyZXN0LmNvbS9waW5cJykhPT0tMXx8Zy5pbmRleE9mKFwndHVtYmxyLmNvbVwnKSE9PS0xfHxnLmluZGV4T2YoXCd5b3V0dWJlLmNvbVwnKSE9PS0xKXtzLkludGVncmF0ZS5hZGQoXCdTb2NpYWxBdXRob3JcJyk7cy5JbnRlZ3JhdGUuU29jaWFsQXV0aG9yLmdldChcJ2h0dHA6Ly9zYS1zZXJ2aWNlcy5zb2NpYWwub21uaXR1cmUuY29tL2F1dGhvci9uYW1lP3Zhcj1bVkFSXSZjYWxsYmFjaz1zLnNvY2lhbEF1dGhvclNlYXJjaCZycz1cJytlbmNvZGVVUklDb21wb25lbnQocy5hY2NvdW50KStcJyZxPVwnK2VuY29kZVVSSUNvbXBvbmVudChnKSk7cy5JbnRlZ3JhdGUuU29jaWFsQXV0aG9yLmRlbGF5KCk7cy5JbnRlZ3JhdGUuU29jaWFsQXV0aG9yLnNldFZhcnM9ZnVuY3Rpb24ocyxwKXtzLmNvbnRleHREYXRhW1wnYS5zb2NpYWxhdXRob3JcJ109cy51c2VyO319JyksIHMuc29jaWFsQXV0aG9yU2VhcmNoID0gbmV3IEZ1bmN0aW9uKCdvYmonLCAndmFyIHM9dGhpcztpZih0eXBlb2Ygb2JqPT09XCd1bmRlZmluZWRcJ3x8dHlwZW9mIG9iai5hdXRob3I9PT1cJ3VuZGVmaW5lZFwnKXtzLnVzZXI9XCdOb3QgRm91bmRcJzt9ZWxzZXtzLnVzZXI9b2JqLmF1dGhvcjt9cy5JbnRlZ3JhdGUuU29jaWFsQXV0aG9yLnJlYWR5KCk7JyksICFzLl9fY2N1Y3IpIHsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBpLCByID0gdGhpcywgYSA9IChuZXcgRGF0ZSgpLCByLmNfcnIoZSkpLCBzID0gci5jX3JzcGVycygpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhIHx8IChlID0gci5VdGlsLnVybERlY29kZShlKSwgdCA9IHMuaW5kZXhPZignICcgKyBlICsgJz0nKSwgbiA9ICh0ID0gKHMgPSB0IDwgMCA/IHIuY19ycignc19zZXNzJykgOiBzKS5pbmRleE9mKCcgJyArIGUgKyAnPScpKSA8IDAgPyB0IDogcy5pbmRleE9mKCd8JywgdCksIGkgPSB0IDwgMCA/IHQgOiBzLmluZGV4T2YoJzsnLCB0KSwgbiA9IG4gPiAwID8gbiA6IGksIGEgPSB0IDwgMCA/ICcnIDogci5VdGlsLnVybERlY29kZShzLnN1YnN0cmluZyh0ICsgMiArIGUubGVuZ3RoLCBuIDwgMCA/IHMubGVuZ3RoIDogbikpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBzLmNfcnIoJ3NfcGVycycpLCB0ID0gbmV3IERhdGUoKS5nZXRUaW1lKCksIG4gPSBudWxsLCBpID0gW10sIHIgPSAnJzsKICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSAwLCBvID0gKGkgPSBlLnNwbGl0KCc7JykpLmxlbmd0aDsgYSA8IG87IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgKG4gPSBpW2FdLm1hdGNoKC9cfChbMC05XSspJC8pKSAmJiBwYXJzZUludChuWzFdKSA+PSB0ICYmIChyICs9IGlbYV0gKyAnOycpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcy5jX3JyID0gcy5jX3IsIHMuX19jY3VjciA9ICEwLCBzLmNfcnNwZXJzID0gdCwgcy5jX3IgPSBlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICghcy5fX2NjdWN3KSB7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgaSwgciwgYSwgcywgbyA9IHRoaXMsIGMgPSBuZXcgRGF0ZSgpLCBsID0gMCwgdSA9ICdzX3BlcnMnLCBkID0gJ3Nfc2VzcycsIHAgPSAwLCBmID0gMDsKICAgICAgICAgICAgICAgICAgICBpZiAoYy5zZXRUaW1lKGMuZ2V0VGltZSgpIC0gNjAwMDApLCBvLmNfcnIoZSkgJiYgby5jX3dyKGUsICcnLCBjKSwgZSA9IG8uVXRpbC51cmxFbmNvZGUoZSksIChhID0gKGkgPSBvLmNfcnNwZXJzKCkpLmluZGV4T2YoJyAnICsgZSArICc9JykpID4gLTEgJiYgKGkgPSBpLnN1YnN0cmluZygwLCBhKSArIGkuc3Vic3RyaW5nKGkuaW5kZXhPZignOycsIGEpICsgMSksIHAgPSAxKSwgKGEgPSAociA9IG8uY19ycihkKSkuaW5kZXhPZignICcgKyBlICsgJz0nKSkgPiAtMSAmJiAociA9IHIuc3Vic3RyaW5nKDAsIGEpICsgci5zdWJzdHJpbmcoci5pbmRleE9mKCc7JywgYSkgKyAxKSwgZiA9IDEpLCBjID0gbmV3IERhdGUoKSwgbiA/IG4uZ2V0VGltZSgpID4gYy5nZXRUaW1lKCkgJiYgKGkgKz0gJyAnICsgZSArICc9JyArIG8uVXRpbC51cmxFbmNvZGUodCkgKyAnfCcgKyBuLmdldFRpbWUoKSArICc7JywgcCA9IDEpIDogKHIgKz0gJyAnICsgZSArICc9JyArIG8uVXRpbC51cmxFbmNvZGUodCkgKyAnOycsIGYgPSAxKSwgciA9IHIucmVwbGFjZSgvJTAwL2csICcnKSwgaSA9IGkucmVwbGFjZSgvJTAwL2csICcnKSwgZiAmJiBvLmNfd3IoZCwgciwgMCksIHApIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChzID0gaTsgcyAmJiAtMSAhPSBzLmluZGV4T2YoJzsnKTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gcGFyc2VJbnQocy5zdWJzdHJpbmcocy5pbmRleE9mKCd8JykgKyAxLCBzLmluZGV4T2YoJzsnKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IHMuc3Vic3RyaW5nKHMuaW5kZXhPZignOycpICsgMSksIGwgPSBsIDwgZyA/IGcgOiBsOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGMuc2V0VGltZShsKSwgby5jX3dyKHUsIGksIGMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9PSBvLmNfcihvLlV0aWwudXJsRW5jb2RlKGUpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHMuY193ciA9IHMuY193LCBzLl9fY2N1Y3cgPSAhMCwgcy5jX3cgPSBuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHMucF9mbyA9IG5ldyBGdW5jdGlvbignbicsICd2YXIgcz10aGlzO2lmKCFzLl9fZm8pe3MuX19mbz1uZXcgT2JqZWN0O31pZighcy5fX2ZvW25dKXtzLl9fZm9bbl09bmV3IE9iamVjdDtyZXR1cm4gMTt9ZWxzZSB7cmV0dXJuIDA7fScpLCBzLnJlcGwgPSBuZXcgRnVuY3Rpb24oJ3gnLCAnbycsICduJywgJ3ZhciBpPXguaW5kZXhPZihvKSxsPW4ubGVuZ3RoO3doaWxlKHgmJmk+PTApe3g9eC5zdWJzdHJpbmcoMCxpKStuK3guc3Vic3RyaW5nKGkrby5sZW5ndGgpO2k9eC5pbmRleE9mKG8saStsKX1yZXR1cm4geCcpLCBzLmNsaWNrUGFzdCA9IG5ldyBGdW5jdGlvbignc2NwJywgJ2N0X2V2JywgJ2NwX2V2JywgJ2NwYycsICd2YXIgcz10aGlzLHNjcCxjdF9ldixjcF9ldixjcGMsZXYsdGN0O2lmKHMucF9mbyhjdF9ldik9PTEpe2lmKCFjcGMpe2NwYz1cJ3NfY3BjXCc7fWV2PXMuZXZlbnRzP3MuZXZlbnRzK1wnLFwnOlwnXCc7aWYoc2NwKXtzLmV2ZW50cz1lditjdF9ldjtzLmNfdyhjcGMsMSwwKTt9ZWxzZXtpZihzLmNfcihjcGMpPj0xKXtzLmV2ZW50cz1lditjcF9ldjtzLmNfdyhjcGMsMCwwKTt9fX0nKSwgcy5tYW5hZ2VRdWVyeVBhcmFtID0gbmV3IEZ1bmN0aW9uKCdwJywgJ3cnLCAnZScsICd1JywgJ3ZhciBzPXRoaXMseCx5LGkscXMscXAscXYsZixiO3U9dT91OihzLnBhZ2VVUkw/cy5wYWdlVVJMOlwnXCcrd2luZG93LmxvY2F0aW9uKTt4PXUuaW5kZXhPZihcJz9cJyk7cXM9eD4tMT91LnN1YnN0cmluZyh4LHUubGVuZ3RoKTpcJ1wnO3U9eD4tMT91LnN1YnN0cmluZygwLHgpOnU7eD1xcy5pbmRleE9mKFwnP1wnK3ArXCc9XCcpO2lmKHg+LTEpe3k9cXMuaW5kZXhPZihcJyZcJyk7Zj1cJ1wnO2lmKHk+LTEpe3FwPXFzLnN1YnN0cmluZyh4KzEseSk7Yj1xcy5zdWJzdHJpbmcoeSsxLHFzLmxlbmd0aCk7fWVsc2V7cXA9cXMuc3Vic3RyaW5nKDEscXMubGVuZ3RoKTtiPVwnXCc7fX1lbHNle3g9cXMuaW5kZXhPZihcJyZcJytwK1wnPVwnKTtpZih4Pi0xKXtmPXFzLnN1YnN0cmluZygxLHgpO2I9cXMuc3Vic3RyaW5nKHgrMSxxcy5sZW5ndGgpO3k9Yi5pbmRleE9mKFwnJlwnKTtpZih5Pi0xKXtxcD1iLnN1YnN0cmluZygwLHkpO2I9Yi5zdWJzdHJpbmcoeSxiLmxlbmd0aCk7fWVsc2V7cXA9YjtiPVwnXCc7fX19aWYoZSYmcXApe3k9cXAuaW5kZXhPZihcJz1cJyk7cXY9eT4tMT9xcC5zdWJzdHJpbmcoeSsxLHFwLmxlbmd0aCk6XCdcJzt2YXIgZXVpPTA7d2hpbGUocXYuaW5kZXhPZihcJyUyNVwnKT4tMSl7cXY9dW5lc2NhcGUocXYpO2V1aSsrO2lmKGV1aT09MTApYnJlYWs7fXF2PXMucmVwbGFjZShxdixcJytcJyxcJyBcJyk7cXY9ZXNjYXBlKHF2KTtxdj1zLnJlcGxhY2UocXYsXCclMjVcJyxcJyVcJyk7cXY9cy5yZXBsYWNlKHF2LFwnJTdDXCcsXCd8XCcpO3F2PXMucmVwbGFjZShxdixcJyU3Y1wnLFwnfFwnKTtxcD1xcC5zdWJzdHJpbmcoMCx5KzEpK3F2O31pZih3JiZxcCl7aWYoZilxcz1cJz9cJytxcCtcJyZcJytmK2I7ZWxzZSBpZihiKXFzPVwnP1wnK3FwK1wnJlwnK2I7ZWxzZSBxcz1cJz9cJytxcH1lbHNlIGlmKGYpcXM9XCc/XCcrZitcJyZcJytxcCtiO2Vsc2UgaWYoYilxcz1cJz9cJytxcCtcJyZcJytiO2Vsc2UgaWYocXApcXM9XCc/XCcrcXA7cmV0dXJuIHUrcXM7JyksIHMuaGFuZGxlUFBWZXZlbnRzID0gbmV3IEZ1bmN0aW9uKCcnLCAndmFyIFc9d2luZG93LHM9Vy5zX25hbWUmJnR5cGVvZiBXW3NfbmFtZV09PVwnb2JqZWN0XCc/V1tzX25hbWVdOjA7aWYoIXN8fCFzLmdldFBQVmlkKXJldHVybjt2YXIgQj1kb2N1bWVudC5ib2R5LEU9ZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LEQ9d2luZG93LmRvY3VtZW50O2Q9TWF0aC5tYXgoQi5zY3JvbGxIZWlnaHQsRS5zY3JvbGxIZWlnaHQsQi5vZmZzZXRIZWlnaHQsRS5vZmZzZXRIZWlnaHQsQi5jbGllbnRIZWlnaHQsRS5jbGllbnRIZWlnaHQpLHY9d2luZG93LmlubmVySGVpZ2h0fHxFLmNsaWVudEhlaWdodHx8Qi5jbGllbnRIZWlnaHQsdD13aW5kb3cucGFnZVlPZmZzZXR8fEQuZG9jdW1lbnRFbGVtZW50LnNjcm9sbFRvcHx8RC5ib2R5LnNjcm9sbFRvcCxoPXQrdixwPU1hdGgubWluKE1hdGgucm91bmQoaC9kKjEwMCksMTAwKSxjPXMuY19yKFwnc19wcHZcJyksYT1jLmluZGV4T2YoXCcsXCcpPi0xP2Muc3BsaXQoXCcsXCcsNCk6W10sbD1hLmxlbmd0aCxuPWw+MD9hWzBdOmVzY2FwZShzLmdldFBQVmlkKSxQPWw+MT9wYXJzZUludChhWzFdKTowLGY9bD4yP3BhcnNlSW50KGFbMl0pOnAsSD1sPjM/cGFyc2VJbnQoYVszXSk6MCxjbj1wPjA/bitcJyxcJysocD5QP3A6UCkrXCcsXCcrZitcJyxcJysoaD5IP2g6SCk6XCdcJztzLmNfdyhcJ3NfcHB2XCcsY24pJyksIHMuZ2V0UGVyY2VudFBhZ2VWaWV3ZWQgPSBuZXcgRnVuY3Rpb24oJ24nLCAnaWYodHlwZW9mIHRoaXMubGlua1R5cGUhPVwndW5kZWZpbmVkXCcpcmV0dXJuXCdcJzt2YXIgcz10aGlzLHc9d2luZG93LEY9ZmFsc2UsZT13aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcnx8d2luZG93LmF0dGFjaEV2ZW50fHxcJ1wnO2k9Myx2PXMuY19yKFwnc19wcHZcJyksYT12LmluZGV4T2YoXCcsXCcpPi0xP3Yuc3BsaXQoXCcsXCcsNCk6W107aWYoYS5sZW5ndGg8NCl7d2hpbGUoaT4wKWFbaS0tXT1pPGEubGVuZ3RoP2FbaS0xXTpcJ1wnO2FbMF09XCdcJ31hWzBdPXVuZXNjYXBlKGFbMF0pO3MuZ2V0UFBWaWQ9bj1ufHxzLnBhZ2VOYW1lfHxkb2N1bWVudC5sb2NhdGlvbi5ocmVmO3MuY193KFwnc19wcHZcJyxlc2NhcGUobikpO2lmKCFzLmdldFBQVmV2ZW50cyl7cy5nZXRQUFZldmVudHM9MTtpZighdy5zX25hbWUpe2ZvcihpIGluIHcpaWYod1tpXT09PXMpe3NfbmFtZT1pO2JyZWFrfX1mb3IoaSBpbntcJ2xvYWRcJzpcJ1wnLFwnc2Nyb2xsXCc6XCdcJyxcJ3Jlc2l6ZVwnOlwnXCd9KWUoKHdpbmRvdy5hdHRhY2hFdmVudD9cJ29uXCc6XCdcJykraSxzLmhhbmRsZVBQVmV2ZW50cyxGKX1yZXR1cm4gYScpLCBzLnRyYWNrVE5UID0gbmV3IEZ1bmN0aW9uKCd2JywgJ3AnLCAnYicsICd2YXIgcz10aGlzLG49XCdzX3RudFwnLHE9XCdzX3RudHJlZlwnLHA9KHApP3A6bix2PSh2KT92Om4scj1cJ1wnLHBtPWZhbHNlLGI9KGIpP2I6dHJ1ZTtpZihzLlV0aWwuZ2V0UXVlcnlQYXJhbShxKSE9XCdcJyl7cy5yZWZlcnJlcj1zLlV0aWwuZ2V0UXVlcnlQYXJhbShxKTt9ZWxzZSBpZihzLmNfcihxKSE9XCdcJyl7cy5yZWZlcnJlcj1zLmNfcihxKTtkb2N1bWVudC5jb29raWU9cStcJz07cGF0aD0vO2V4cGlyZXM9VGh1LCAwMS1KYW4tMTk3MCAwMDowMDowMSBHTVQ7XCc7fWVsc2UgaWYoKGRvY3VtZW50LmNvb2tpZS5pbmRleE9mKHEpIT0tMSYmcy5jX3IocSk9PVwnXCcpfHwobG9jYXRpb24uc2VhcmNoLmluZGV4T2YocStcJz1cJykhPS0xJiZzLlV0aWwuZ2V0UXVlcnlQYXJhbShxKT09XCdcJykpe3MucmVmZXJyZXI9XCdUeXBlZC9Cb29rbWFya2VkXCc7ZG9jdW1lbnQuY29va2llPXErXCc9O3BhdGg9LztleHBpcmVzPVRodSwgMDEtSmFuLTE5NzAgMDA6MDA6MDEgR01UO1wnO31pZihzLlV0aWwuZ2V0UXVlcnlQYXJhbShwKSE9XCdcJyl7cG09cy5VdGlsLmdldFF1ZXJ5UGFyYW0ocCk7fWVsc2UgaWYocy5jX3IocCkpe3BtPXMuY19yKHApO2RvY3VtZW50LmNvb2tpZT1wK1wnPTtwYXRoPS87ZXhwaXJlcz1UaHUsIDAxLUphbi0xOTcwIDAwOjAwOjAxIEdNVDtcJzt9ZWxzZSBpZihzLmNfcihwKT09XCdcJyYmcy5VdGlsLmdldFF1ZXJ5UGFyYW0ocCk9PVwnXCcpe3BtPVwnXCc7fWlmKHBtKXIrPShwbStcJyxcJyk7aWYod2luZG93W3ZdIT11bmRlZmluZWQpcis9d2luZG93W3ZdO2lmKGIpd2luZG93W3ZdPVwnXCc7cmV0dXJuIHI7JyksIHMuZ2V0QWFtU2VnbWVudHMgPSBuZXcgRnVuY3Rpb24oJ2EnLCAnYicsICd2YXIgcz10aGlzO3ZhciBjPXMuY19yKGEpO2lmKGMpe2M9cy5yZXBsKGMsYitcJz1cJyxcJ1wnKTt9cmV0dXJuIGMnKSwgcy5hcGwgPSBuZXcgRnVuY3Rpb24oJ0wnLCAndicsICdkJywgJ3UnLCAndmFyIHM9dGhpcyxtPTA7aWYoIUwpTD1cJ1wnO2lmKHUpe3ZhciBpLG4sYT1zLnNwbGl0KEwsZCk7Zm9yKGk9MDtpPGEubGVuZ3RoO2krKyl7bj1hW2ldO209bXx8KHU9PTE/KG49PXYpOihuLnRvTG93ZXJDYXNlKCk9PXYudG9Mb3dlckNhc2UoKSkpO319aWYoIW0pTD1MP0wrZCt2OnY7cmV0dXJuIEwnKSwgd2luZG93LnMgJiYgJ29iamVjdCcgPT0gdHlwZW9mIHdpbmRvdy5zICYmIChzLlV0aWwsIDEpICYmICdvYmplY3QnID09IHR5cGVvZiBzLlV0aWwgJiYgKHdpbmRvdy5zLlV0aWwuZ2V0UXVlcnlQYXJhbSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgaSwgciA9IHdpbmRvdzsKICAgICAgICAgICAgICAgIHJldHVybiB0IHx8ICh0ID0gcy5wYWdlVVJMID8gcy5wYWdlVVJMIDogci5sb2NhdGlvbiksIG4gfHwgKG4gPSAnJicpLCBlICYmIHQgJiYgKChpID0gKHQgPSAnJyArIHQpLmluZGV4T2YoJz8nKSkgPj0gMCAmJiAoKGkgPSAodCA9IG4gKyB0LnN1YnN0cmluZyhpICsgMSkgKyBuKS50b1N0cmluZygpLnRvTG93ZXJDYXNlKCkuaW5kZXhPZihuICsgZS50b1N0cmluZygpLnRvTG93ZXJDYXNlKCkgKyAnPScpKSA+PSAwICYmICgoaSA9ICh0ID0gdC5zdWJzdHJpbmcoaSArIG4ubGVuZ3RoICsgZS5sZW5ndGggKyAxKSkudG9TdHJpbmcoKS50b0xvd2VyQ2FzZSgpLmluZGV4T2Yobi50b1N0cmluZygpLnRvTG93ZXJDYXNlKCkpKSA+PSAwICYmICh0ID0gdC5zdWJzdHJpbmcoMCwgaSkpLCB0Lmxlbmd0aCA+IDApKSkgPyBzLnVuZXNjYXBlKHQpIDogJyc7CiAgICAgICAgICAgIH0pLCBzLm9uY2VQZXJQYWdlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHMub3BwLnNwbGl0KCcsJyksIG4gPSAwOyBuIDwgdC5sZW5ndGg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgcy5ldmVudHMgJiYgKHYgPSBuZXcgUmVnRXhwKCcsKj8nICsgdFtuXSArICdcXGInKSwgbnVsbCAhPSBzLmV2ZW50cy5tYXRjaCh2KSAmJiAocy5ldmVudHMgPSBzLmV2ZW50cy5yZXBsYWNlKHYsICcnKSwgJywnID09IHMuZXZlbnRzLnN1YnN0cmluZygwLCAxKSAmJiAocy5ldmVudHMgPSBzLmV2ZW50cy5zdWJzdHJpbmcoMSwgcy5ldmVudHMubGVuZ3RoKSkpKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gZS5zcGxpdCgnLCcpLCByID0gMDsgciA8IGkubGVuZ3RoOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHMub3BwID0gcy5hcGwocy5vcHAsIGlbcl0sICcsJywgMik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sIHMubG9hZE1vZHVsZSgnTWVkaWEnKSwgcy5NZWRpYS5hdXRvVHJhY2sgPSAhMCwgcy5NZWRpYS50cmFja1doaWxlUGxheWluZyA9ICEwLCBzLk1lZGlhLnRyYWNrVmFycyA9ICdOb25lJywgcy5NZWRpYS50cmFja0V2ZW50cyA9ICdOb25lJywgJ3VzJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpyZWdpb24nKS50b0xvd2VyQ2FzZSgpICYmIHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoJy9mZWRleHRyYWNrJykgPiAtMSAmJiAocy5jb250ZXh0RGF0YVsnY20uc3NmJ10gPSAxKTsKICAgICAgICAgICAgdmFyIHIgPSAnJyAhPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FhbTpyZWdpb25GbGFnJykgJiYgMCAhPSBfc2F0ZWxsaXRlLmdldFZhcignYWFtOnJlZ2lvbkZsYWcnKSwgYSA9ICcnICE9PSBfc2F0ZWxsaXRlLmdldFZhcignYWFtOmNvdW50cnlGbGFnJykgJiYgMCAhPSBfc2F0ZWxsaXRlLmdldFZhcignYWFtOmNvdW50cnlGbGFnJyksIG8gPSAnZmFsc2UnICE9PSBfc2F0ZWxsaXRlLmdldFZhcignYWFtOklkU3luY0Rpc2FibGUnKSwgYyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdhYW06UmVnaW9uQ29udGFpbmVyTlNJRCcpOwogICAgICAgICAgICAociB8fCBhKSAmJiAocy5sb2FkTW9kdWxlKCdBdWRpZW5jZU1hbmFnZW1lbnQnKSwgcy5BdWRpZW5jZU1hbmFnZW1lbnQuc2V0dXAoewogICAgICAgICAgICAgICAgcGFydG5lcjogJ2ZlZGV4JywKICAgICAgICAgICAgICAgIGNvbnRhaW5lck5TSUQ6IGMsCiAgICAgICAgICAgICAgICB2aXNpdG9yU2VydmljZTogeyBuYW1lc3BhY2U6ICcxRTIyMTcxQjUyMEU5M0JGMEE0OTBENDRAQWRvYmVPcmcnIH0sCiAgICAgICAgICAgICAgICBkaXNhYmxlRGVmYXVsdFJlcXVlc3Q6ICEwLAogICAgICAgICAgICAgICAgZGlzYWJsZVNjcmlwdEF0dGFjaG1lbnQ6ICEwLAogICAgICAgICAgICAgICAgZGlzYWJsZURlc3RpbmF0aW9uUHVibGlzaGluZ0lmcmFtZTogbwogICAgICAgICAgICB9KSk7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uICRfX192YXJfYjlkMDQ2ZWYzN2FmZjE4OShlKSB7CiAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgdC5zID0gZTsKICAgICAgICAgICAgdmFyIG4gPSB3aW5kb3c7CiAgICAgICAgICAgIG4uc19jX2luIHx8IChuLnNfY19pbCA9IFtdLCBuLnNfY19pbiA9IDApLCB0Ll9pbCA9IG4uc19jX2lsLCB0Ll9pbiA9IG4uc19jX2luLCB0Ll9pbFt0Ll9pbl0gPSB0LCBuLnNfY19pbisrLCB0Ll9jID0gJ3NfbScsIHQubGlzdCA9IFtdLCB0LmFkZCA9IGZ1bmN0aW9uIChpLCByKSB7CiAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgIHIgfHwgKHIgPSAnc19JbnRlZ3JhdGVfJyArIGkpLCBuW3JdIHx8IChuW3JdID0ge30pLCAoYSA9IHRbaV0gPSBuW3JdKS5hID0gaSwgYS5lID0gdCwgYS5fYyA9IDAsIGEuX2QgPSAwLCBudWxsID09IGEuZGlzYWJsZSAmJiAoYS5kaXNhYmxlID0gMCksIGEuZ2V0ID0gZnVuY3Rpb24gKGUsIGkpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciwgcyA9IGRvY3VtZW50LCBvID0gcy5nZXRFbGVtZW50c0J5VGFnTmFtZSgnSEVBRCcpOwogICAgICAgICAgICAgICAgICAgIGlmICghYS5kaXNhYmxlICYmIChpIHx8ICh2ID0gJ3NfJyArIHQuX2luICsgJ19JbnRlZ3JhdGVfJyArIGEuYSArICdfZ2V0XycgKyBhLl9jKSwgYS5fYysrLCBhLlZBUiA9IHYsIGEuQ0FMTEJBQ0sgPSAnc19jX2lsWycgKyB0Ll9pbiArICddLicgKyBhLmEgKyAnLmNhbGxiYWNrJywgYS5kZWxheSgpLCBvID0gbyAmJiAwIDwgby5sZW5ndGggPyBvWzBdIDogcy5ib2R5KSkKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChyID0gcy5jcmVhdGVFbGVtZW50KCdTQ1JJUFQnKSkudHlwZSA9ICd0ZXh0L2phdmFzY3JpcHQnLCByLnNldEF0dHJpYnV0ZSgnYXN5bmMnLCAnYXN5bmMnKSwgci5zcmMgPSB0LmMoYSwgZSksIDAgPiBlLmluZGV4T2YoJ1tDQUxMQkFDS10nKSAmJiAoci5vbmxvYWQgPSByLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmNhbGxiYWNrKG5bdl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG8uZmlyc3RDaGlsZCA/IG8uaW5zZXJ0QmVmb3JlKHIsIG8uZmlyc3RDaGlsZCkgOiBvLmFwcGVuZENoaWxkKHIpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGEuY2FsbGJhY2sgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgIGlmIChlKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGVbdF0gfHwgKGFbdF0gPSBlW3RdKTsKICAgICAgICAgICAgICAgICAgICBhLnJlYWR5KCk7CiAgICAgICAgICAgICAgICB9LCBhLmJlYWNvbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAnc19pXycgKyB0Ll9pbiArICdfSW50ZWdyYXRlXycgKyBhLmEgKyAnXycgKyBhLl9jOwogICAgICAgICAgICAgICAgICAgIGEuZGlzYWJsZSB8fCAoYS5fYysrLCAoaSA9IG5baV0gPSBuZXcgSW1hZ2UoKSkuc3JjID0gdC5jKGEsIGUpKTsKICAgICAgICAgICAgICAgIH0sIGEuc2NyaXB0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBhLmdldChlLCAxKTsKICAgICAgICAgICAgICAgIH0sIGEuZGVsYXkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYS5fZCsrOwogICAgICAgICAgICAgICAgfSwgYS5yZWFkeSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBhLl9kLS0sIGEuZGlzYWJsZSB8fCBlLmRlbGF5UmVhZHkoKTsKICAgICAgICAgICAgICAgIH0sIHQubGlzdC5wdXNoKGkpOwogICAgICAgICAgICB9LCB0Ll9nID0gZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgIHZhciBpLCByID0gKG4gPyAndXNlJyA6ICdzZXQnKSArICdWYXJzJzsKICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPCB0Lmxpc3QubGVuZ3RoOyBuKyspCiAgICAgICAgICAgICAgICAgICAgaWYgKChpID0gdFt0Lmxpc3Rbbl1dKSAmJiAhaS5kaXNhYmxlICYmIGlbcl0pCiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpW3JdKGUsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwgdC5fdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHQuX2coMSk7CiAgICAgICAgICAgIH0sIHQuX2QgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgZSwgbjsKICAgICAgICAgICAgICAgIGZvciAoZSA9IDA7IGUgPCB0Lmxpc3QubGVuZ3RoOyBlKyspCiAgICAgICAgICAgICAgICAgICAgaWYgKChuID0gdFt0Lmxpc3RbZV1dKSAmJiAhbi5kaXNhYmxlICYmIDAgPCBuLl9kKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9LCB0LmMgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgdmFyIGksIHIsIGEsIHM7CiAgICAgICAgICAgICAgICBmb3IgKCdodHRwJyAhPSBuLnRvTG93ZXJDYXNlKCkuc3Vic3RyaW5nKDAsIDQpICYmIChuID0gJ2h0dHA6Ly8nICsgbiksIGUuc3NsICYmIChuID0gZS5yZXBsYWNlKG4sICdodHRwOicsICdodHRwczonKSksIHQuUkFORCA9IE1hdGguZmxvb3IoMTAwMDAwMDAwMDAwMDAgKiBNYXRoLnJhbmRvbSgpKSwgaSA9IDA7IDAgPD0gaTspCiAgICAgICAgICAgICAgICAgICAgMCA8PSAoaSA9IG4uaW5kZXhPZignWycsIGkpKSAmJiAoKHIgPSBuLmluZGV4T2YoJ10nLCBpKSkgPiBpICYmICgyIDwgKGEgPSBuLnN1YnN0cmluZyhpICsgMSwgcikpLmxlbmd0aCAmJiAncy4nID09IGEuc3Vic3RyaW5nKDAsIDIpID8gKHMgPSBlW2Euc3Vic3RyaW5nKDIpXSkgfHwgKHMgPSAnJykgOiAocyA9ICcnICsgdFthXSkgIT0gdFthXSAmJiBwYXJzZUZsb2F0KHMpICE9IHRbYV0gJiYgKGEgPSAwKSwgYSAmJiAobiA9IG4uc3Vic3RyaW5nKDAsIGkpICsgZW5jb2RlVVJJQ29tcG9uZW50KHMpICsgbi5zdWJzdHJpbmcociArIDEpKSwgaSA9IHIpKTsKICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyXzY0ZTg3NDZmNTMxMDg5NGEoZSkgewogICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgIHQucyA9IGU7CiAgICAgICAgICAgIHZhciBuID0gd2luZG93OwogICAgICAgICAgICBuLnNfY19pbiB8fCAobi5zX2NfaWwgPSBbXSwgbi5zX2NfaW4gPSAwKSwgdC5faWwgPSBuLnNfY19pbCwgdC5faW4gPSBuLnNfY19pbiwgdC5faWxbdC5faW5dID0gdCwgbi5zX2NfaW4rKywgdC5fYyA9ICdzX20nLCB0LnNldHVwID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIG4uRElMICYmIGUgJiYgKGUuZGlzYWJsZURlZmF1bHRSZXF1ZXN0ID0gITAsIGUuZGlzYWJsZUNPUlMgPSAhMCwgZS5zZWN1cmVEYXRhQ29sbGVjdGlvbiA9ICExLCB0Lmluc3RhbmNlID0gbi5ESUwuY3JlYXRlKGUpLCB0LnRvb2xzID0gbi5ESUwudG9vbHMpOwogICAgICAgICAgICB9LCB0LmlzUmVhZHkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gISF0Lmluc3RhbmNlOwogICAgICAgICAgICB9LCB0LmdldEV2ZW50Q2FsbENvbmZpZ1BhcmFtcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0Lmluc3RhbmNlICYmIHQuaW5zdGFuY2UuYXBpICYmIHQuaW5zdGFuY2UuYXBpLmdldEV2ZW50Q2FsbENvbmZpZ1BhcmFtcyA/IHQuaW5zdGFuY2UuYXBpLmdldEV2ZW50Q2FsbENvbmZpZ1BhcmFtcygpIDoge307CiAgICAgICAgICAgIH0sIHQucGFzc0RhdGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgdC5pbnN0YW5jZSAmJiB0Lmluc3RhbmNlLmFwaSAmJiB0Lmluc3RhbmNlLmFwaS5wYXNzRGF0YSAmJiB0Lmluc3RhbmNlLmFwaS5wYXNzRGF0YShlKTsKICAgICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl85YzU5YTE4NWQ0YmQxZmVjKGUpIHsKICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgIHZhciBlID0gbC5wYWdlWU9mZnNldCArIChsLmlubmVySGVpZ2h0IHx8IDApOwogICAgICAgICAgICAgICAgZSAmJiBlID4gK2QgJiYgKGQgPSBlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBuKCkgewogICAgICAgICAgICAgICAgaWYgKGMuc2Nyb2xsUmVhY2hTZWxlY3RvcikgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5kLnF1ZXJ5U2VsZWN0b3IgJiYgZS5kLnF1ZXJ5U2VsZWN0b3IoYy5zY3JvbGxSZWFjaFNlbGVjdG9yKTsKICAgICAgICAgICAgICAgICAgICB0ID8gKGQgPSB0LnNjcm9sbFRvcCB8fCAwLCB0LmFkZEV2ZW50TGlzdGVuZXIoJ3Njcm9sbCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIChlID0gdCAmJiB0LnNjcm9sbFRvcCArIHQuY2xpZW50SGVpZ2h0IHx8IDApID4gZCAmJiAoZCA9IGUpOwogICAgICAgICAgICAgICAgICAgIH0pKSA6IDAgPCBwLS0gJiYgc2V0VGltZW91dChuLCAxMDAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBpKGUsIHQpIHsKICAgICAgICAgICAgICAgIHZhciBuLCBpLCByOwogICAgICAgICAgICAgICAgaWYgKGUgJiYgdCAmJiAobiA9IGMuY1t0XSB8fCAoYy5jW3RdID0gdC5zcGxpdCgnLCcpKSkpCiAgICAgICAgICAgICAgICAgICAgZm9yIChyID0gMDsgciA8IG4ubGVuZ3RoICYmIChpID0gbltyKytdKTspCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtMSA8IGUuaW5kZXhPZihpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcih0LCBuLCBpLCByLCBhKSB7CiAgICAgICAgICAgICAgICB2YXIgcywgbzsKICAgICAgICAgICAgICAgIGlmICgodC5kYXRhc2V0ICYmIChvID0gdC5kYXRhc2V0W25dKSB8fCB0LmdldEF0dHJpYnV0ZSAmJiAoKG8gPSB0LmdldEF0dHJpYnV0ZSgnZGF0YS0nICsgaSkpIHx8IChvID0gdC5nZXRBdHRyaWJ1dGUoaSkpKSkgJiYgKHMgPSBvKSwgIXMgJiYgZS51c2VGb3JjZWRMaW5rVHJhY2tpbmcgJiYgYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBjOwogICAgICAgICAgICAgICAgICAgIGlmICh0ID0gdC5vbmNsaWNrID8gJycgKyB0Lm9uY2xpY2sgOiAnJywgdmFyVmFsdWUgPSAnJywgciAmJiB0ICYmIDAgPD0gKG4gPSB0LmluZGV4T2YocikpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiArPSByLmxlbmd0aDsgbiA8IHQubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpID0gdC5jaGFyQXQobisrKSwgMCA8PSAnXCciJy5pbmRleE9mKGkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobyA9ICExOyBuIDwgdC5sZW5ndGggJiYgYyAmJiAoaSA9IHQuY2hhckF0KG4pLCBvIHx8IGkgIT09IGMpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdcXCcgPT09IGkgPyBvID0gITAgOiAodmFyVmFsdWUgKz0gaSwgbyA9ICExKSwgbisrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAoYyA9IHZhclZhbHVlKSAmJiAoZS53W3JdID0gYyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gcyB8fCBhICYmIGUud1tyXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBhKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgcmV0dXJuIChyID0gY1t0XShlLCBuKSkgJiYgaShvKHIpLCBjW3QgKyAnRXhjbHVzaW9ucyddKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBzKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciBpOwogICAgICAgICAgICAgICAgaWYgKGUgJiYgISgxID09PSAoaSA9IGUubm9kZVR5cGUpICYmIChpID0gZS5ub2RlTmFtZSkgJiYgKGkgPSBpLnRvVXBwZXJDYXNlKCkpICYmIGZbaV0pICYmICgxID09PSBlLm5vZGVUeXBlICYmIChpID0gZS5ub2RlVmFsdWUpICYmICh0W3QubGVuZ3RoXSA9IGkpLCBuLmEgfHwgbi50IHx8IG4ucyB8fCAhZS5nZXRBdHRyaWJ1dGUgfHwgKChpID0gZS5nZXRBdHRyaWJ1dGUoJ2FsdCcpKSA/IG4uYSA9IGkgOiAoaSA9IGUuZ2V0QXR0cmlidXRlKCd0aXRsZScpKSA/IG4udCA9IGkgOiAnSU1HJyA9PSAoJycgKyBlLm5vZGVOYW1lKS50b1VwcGVyQ2FzZSgpICYmIChpID0gZS5nZXRBdHRyaWJ1dGUoJ3NyYycpIHx8IGUuc3JjKSAmJiAobi5zID0gaSkpLCAoaSA9IGUuY2hpbGROb2RlcykgJiYgaS5sZW5ndGgpKQogICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IDA7IGUgPCBpLmxlbmd0aDsgZSsrKQogICAgICAgICAgICAgICAgICAgICAgICBzKGlbZV0sIHQsIG4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSkgewogICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gZSB8fCBudWxsID09IGUpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlcGxhY2UoUmVnRXhwKCdeW1xcc1xcblxcZlxcclxcdFx0LVxyIFx4QTBcdTE2ODBcdTE4MEVcdTIwMDAtXHUyMDBBXHUyMDI4XHUyMDI5XHUyMDVGXHUzMDAwXHVGRUZGXSsnLCAnbWcnKSwgJycpLnJlcGxhY2UoUmVnRXhwKCdbXFxzXFxuXFxmXFxyXFx0XHQtXHIgXHhBMFx1MTY4MFx1MTgwRVx1MjAwMC1cdTIwMEFcdTIwMjhcdTIwMjlcdTIwNUZcdTMwMDBcdUZFRkZdKyQnLCAnbWcnKSwgJycpLnJlcGxhY2UoUmVnRXhwKCdbXFxzXFxuXFxmXFxyXFx0XHQtXHIgXHhBMFx1MTY4MFx1MTgwRVx1MjAwMC1cdTIwMEFcdTIwMjhcdTIwMjlcdTIwNUZcdTMwMDBcdUZFRkZdezEsfScsICdtZycpLCAnICcpLnN1YnN0cmluZygwLCAyNTQpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBjID0gdGhpczsKICAgICAgICAgICAgYy5zID0gZTsKICAgICAgICAgICAgdmFyIGwgPSB3aW5kb3c7CiAgICAgICAgICAgIGwuc19jX2luIHx8IChsLnNfY19pbCA9IFtdLCBsLnNfY19pbiA9IDApLCBjLl9pbCA9IGwuc19jX2lsLCBjLl9pbiA9IGwuc19jX2luLCBjLl9pbFtjLl9pbl0gPSBjLCBsLnNfY19pbisrLCBjLl9jID0gJ3NfbSc7CiAgICAgICAgICAgIHZhciB1LCBkID0gMCwgcCA9IDYwOwogICAgICAgICAgICBjLmMgPSB7fTsKICAgICAgICAgICAgdmFyIGYgPSB7CiAgICAgICAgICAgICAgICBTQ1JJUFQ6IDEsCiAgICAgICAgICAgICAgICBTVFlMRTogMSwKICAgICAgICAgICAgICAgIExJTks6IDEsCiAgICAgICAgICAgICAgICBDQU5WQVM6IDEKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYy5fZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciB0LCBuLCBpLCByID0gZS5jb250ZXh0RGF0YSwgcyA9IGUubGlua09iamVjdDsKICAgICAgICAgICAgICAgICh0ID0gZS5wYWdlTmFtZSB8fCBlLnBhZ2VVUkwpICYmIChuID0gYShzLCAnbGluaycsIGUubGlua05hbWUpKSAmJiAoaSA9IGEocywgJ3JlZ2lvbicpKSAmJiAoclsnYS5hY3Rpdml0eW1hcC5wYWdlJ10gPSB0LnN1YnN0cmluZygwLCAyNTUpLCByWydhLmFjdGl2aXR5bWFwLmxpbmsnXSA9IDEyOCA8IG4ubGVuZ3RoID8gbi5zdWJzdHJpbmcoMCwgMTI4KSA6IG4sIHJbJ2EuYWN0aXZpdHltYXAucmVnaW9uJ10gPSAxMjcgPCBpLmxlbmd0aCA/IGkuc3Vic3RyaW5nKDAsIDEyNykgOiBpLCAwIDwgZCAmJiAoclsnYS5hY3Rpdml0eW1hcC54eSddID0gMTAgKiBNYXRoLmZsb29yKGQgLyAxMCkpLCByWydhLmFjdGl2aXR5bWFwLnBhZ2VJRFR5cGUnXSA9IGUucGFnZU5hbWUgPyAxIDogMCk7CiAgICAgICAgICAgIH0sIGMuX2QgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBjLnRyYWNrU2Nyb2xsUmVhY2ggJiYgIXUgJiYgKGMuc2Nyb2xsUmVhY2hTZWxlY3RvciA/IG4oKSA6ICh0KCksIGwuYWRkRXZlbnRMaXN0ZW5lciAmJiBsLmFkZEV2ZW50TGlzdGVuZXIoJ3Njcm9sbCcsIHQsICExKSksIHUgPSAhMCk7CiAgICAgICAgICAgIH0sIGMubGluayA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgIG4gPSBpKG8odCksIGMubGlua0V4Y2x1c2lvbnMpOwogICAgICAgICAgICAgICAgZWxzZSBpZiAoKG4gPSBlKSAmJiAhKG4gPSByKGUsICdzT2JqZWN0SWQnLCAncy1vYmplY3QtaWQnLCAnc19vYmplY3RJRCcsIDEpKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBhLCBsOwogICAgICAgICAgICAgICAgICAgIChsID0gaShvKGUuaW5uZXJUZXh0IHx8IGUudGV4dENvbnRlbnQpLCBjLmxpbmtFeGNsdXNpb25zKSkgfHwgKHMoZSwgYSA9IFtdLCBuID0gewogICAgICAgICAgICAgICAgICAgICAgICBhOiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgIHQ6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgczogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgfSksIChsID0gaShvKGEuam9pbignJykpKSkgfHwgKGwgPSBpKG8obi5hID8gbi5hIDogbi50ID8gbi50IDogbi5zID8gbi5zIDogdm9pZCAwKSkpIHx8ICEoYSA9IChhID0gZS50YWdOYW1lKSAmJiBhLnRvVXBwZXJDYXNlID8gYS50b1VwcGVyQ2FzZSgpIDogJycpIHx8ICgnSU5QVVQnID09IGEgfHwgJ1NVQk1JVCcgPT0gYSAmJiBlLnZhbHVlID8gbCA9IGkobyhlLnZhbHVlKSkgOiAnSU1BR0UnID09IGEgJiYgZS5zcmMgJiYgKGwgPSBpKG8oZS5zcmMpKSkpKSwgbiA9IGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgfSwgYy5yZWdpb24gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgdCwgbiA9IGMucmVnaW9uSURBdHRyaWJ1dGUgfHwgJ2lkJzsgZSAmJiAoZSA9IGUucGFyZW50Tm9kZSk7KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQgPSByKGUsIG4sIG4sIG4pKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICBpZiAoJ0JPRFknID09IGUubm9kZU5hbWUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnQk9EWSc7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uICRfX192YXJfYWQ3YjU5MTRiYzMwMDRjYihlKSB7CiAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgdC52ZXJzaW9uID0gJzIuMjIuMCc7CiAgICAgICAgICAgIHZhciBuID0gd2luZG93OwogICAgICAgICAgICBuLnNfY19pbiB8fCAobi5zX2NfaWwgPSBbXSwgbi5zX2NfaW4gPSAwKSwgdC5faWwgPSBuLnNfY19pbCwgdC5faW4gPSBuLnNfY19pbiwgdC5faWxbdC5faW5dID0gdCwgbi5zX2NfaW4rKywgdC5fYyA9ICdzX2MnOwogICAgICAgICAgICB2YXIgaSA9IG4uQXBwTWVhc3VyZW1lbnQuaWM7CiAgICAgICAgICAgIGkgfHwgKGkgPSBudWxsKTsKICAgICAgICAgICAgdmFyIHIsIGEsIHMsIG8gPSBuOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgZm9yIChyID0gby5wYXJlbnQsIGEgPSBvLmxvY2F0aW9uOyByICYmIHIubG9jYXRpb24gJiYgYSAmJiAnJyArIHIubG9jYXRpb24gIT0gJycgKyBhICYmIG8ubG9jYXRpb24gJiYgJycgKyByLmxvY2F0aW9uICE9ICcnICsgby5sb2NhdGlvbiAmJiByLmxvY2F0aW9uLmhvc3QgPT09IGEuaG9zdDspCiAgICAgICAgICAgICAgICAgICAgciA9IChvID0gcikucGFyZW50OwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdC5DID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coZSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sIHQuUmEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnICsgcGFyc2VJbnQoZSkgPT0gJycgKyBlOwogICAgICAgICAgICB9LCB0LnJlcGxhY2UgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgcmV0dXJuICFlIHx8IDAgPiBlLmluZGV4T2YodCkgPyBlIDogZS5zcGxpdCh0KS5qb2luKG4pOwogICAgICAgICAgICB9LCB0LmVzY2FwZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICB2YXIgbiwgaTsKICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIGZvciAoZSA9IGVuY29kZVVSSUNvbXBvbmVudChlKSwgbiA9IDA7IDcgPiBuOyBuKyspCiAgICAgICAgICAgICAgICAgICAgaSA9ICcrfiEqKClcJycuc3Vic3RyaW5nKG4sIG4gKyAxKSwgMCA8PSBlLmluZGV4T2YoaSkgJiYgKGUgPSB0LnJlcGxhY2UoZSwgaSwgJyUnICsgaS5jaGFyQ29kZUF0KDApLnRvU3RyaW5nKDE2KS50b1VwcGVyQ2FzZSgpKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfSwgdC51bmVzY2FwZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICBlID0gMCA8PSBlLmluZGV4T2YoJysnKSA/IHQucmVwbGFjZShlLCAnKycsICcgJykgOiBlOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGVjb2RlVVJJQ29tcG9uZW50KGUpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHVuZXNjYXBlKGUpOwogICAgICAgICAgICB9LCB0Lk5iID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGUsIGkgPSBuLmxvY2F0aW9uLmhvc3RuYW1lLCByID0gdC5mcENvb2tpZURvbWFpblBlcmlvZHM7CiAgICAgICAgICAgICAgICBpZiAociB8fCAociA9IHQuY29va2llRG9tYWluUGVyaW9kcyksIGkgJiYgIXQuS2EgJiYgIS9eWzAtOS5dKyQvLnRlc3QoaSkgJiYgKHIgPSAyIDwgKHIgPSByID8gcGFyc2VJbnQocikgOiAyKSA/IHIgOiAyLCAwIDw9IChlID0gaS5sYXN0SW5kZXhPZignLicpKSkpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgMCA8PSBlICYmIDEgPCByOykKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGkubGFzdEluZGV4T2YoJy4nLCBlIC0gMSksIHItLTsKICAgICAgICAgICAgICAgICAgICB0LkthID0gMCA8IGUgPyBpLnN1YnN0cmluZyhlKSA6IGk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gdC5LYTsKICAgICAgICAgICAgfSwgdC5jX3IgPSB0LmNvb2tpZVJlYWQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgZSA9IHQuZXNjYXBlKGUpOwogICAgICAgICAgICAgICAgdmFyIG4gPSAnICcgKyB0LmQuY29va2llLCBpID0gbi5pbmRleE9mKCcgJyArIGUgKyAnPScpLCByID0gMCA+IGkgPyBpIDogbi5pbmRleE9mKCc7JywgaSk7CiAgICAgICAgICAgICAgICByZXR1cm4gJ1tbQl1dJyAhPSAoZSA9IDAgPiBpID8gJycgOiB0LnVuZXNjYXBlKG4uc3Vic3RyaW5nKGkgKyAyICsgZS5sZW5ndGgsIDAgPiByID8gbi5sZW5ndGggOiByKSkpID8gZSA6ICcnOwogICAgICAgICAgICB9LCB0LmNfdyA9IHQuY29va2llV3JpdGUgPSBmdW5jdGlvbiAoZSwgbiwgaSkgewogICAgICAgICAgICAgICAgdmFyIHIsIGEgPSB0Lk5iKCksIHMgPSB0LmNvb2tpZUxpZmV0aW1lOwogICAgICAgICAgICAgICAgcmV0dXJuIG4gPSAnJyArIG4sIHMgPSBzID8gKCcnICsgcykudG9VcHBlckNhc2UoKSA6ICcnLCBpICYmICdTRVNTSU9OJyAhPSBzICYmICdOT05FJyAhPSBzICYmICgociA9ICcnICE9IG4gPyBwYXJzZUludChzIHx8IDApIDogLTYwKSA/IChpID0gbmV3IERhdGUoKSkuc2V0VGltZShpLmdldFRpbWUoKSArIDEwMDAgKiByKSA6IDEgPT09IGkgJiYgKHIgPSAoaSA9IG5ldyBEYXRlKCkpLmdldFllYXIoKSwgaS5zZXRZZWFyKHIgKyAyICsgKDE5MDAgPiByID8gMTkwMCA6IDApKSkpLCBlICYmICdOT05FJyAhPSBzID8gKHQuZC5jb29raWUgPSB0LmVzY2FwZShlKSArICc9JyArIHQuZXNjYXBlKCcnICE9IG4gPyBuIDogJ1tbQl1dJykgKyAnOyBwYXRoPS87JyArIChpICYmICdTRVNTSU9OJyAhPSBzID8gJyBleHBpcmVzPScgKyBpLnRvVVRDU3RyaW5nKCkgKyAnOycgOiAnJykgKyAoYSA/ICcgZG9tYWluPScgKyBhICsgJzsnIDogJycpICsgKHQud3JpdGVTZWN1cmVDb29raWVzID8gJyBzZWN1cmU7JyA6ICcnKSwgdC5jb29raWVSZWFkKGUpID09IG4pIDogMDsKICAgICAgICAgICAgfSwgdC5LYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBlID0gdC5VdGlsLmdldEllVmVyc2lvbigpOwogICAgICAgICAgICAgICAgJ251bWJlcicgPT0gdHlwZW9mIGUgJiYgMTAgPiBlICYmICh0LnVuc3VwcG9ydGVkQnJvd3NlciA9ICEwLCB0LnhiKHQsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfSwgdC55YSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBlID0gbmF2aWdhdG9yLnVzZXJBZ2VudDsKICAgICAgICAgICAgICAgIHJldHVybiAnTWljcm9zb2Z0IEludGVybmV0IEV4cGxvcmVyJyA9PT0gbmF2aWdhdG9yLmFwcE5hbWUgfHwgMCA8PSBlLmluZGV4T2YoJ01TSUUgJykgfHwgMCA8PSBlLmluZGV4T2YoJ1RyaWRlbnQvJykgJiYgMCA8PSBlLmluZGV4T2YoJ1dpbmRvd3MgTlQgNicpOwogICAgICAgICAgICB9LCB0LnhiID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSwgbikgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZVtuXSAmJiAoZVtuXSA9IHQpOwogICAgICAgICAgICB9LCB0LksgPSBbXSwgdC5mYSA9IGZ1bmN0aW9uIChlLCBuLCBpKSB7CiAgICAgICAgICAgICAgICBpZiAodC5MYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgIHQubWF4RGVsYXkgfHwgKHQubWF4RGVsYXkgPSAyNTApOwogICAgICAgICAgICAgICAgdmFyIHIgPSAwLCBhID0gbmV3IERhdGUoKS5nZXRUaW1lKCkgKyB0Lm1heERlbGF5LCBzID0gdC5kLnZpc2liaWxpdHlTdGF0ZSwgbyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3dlYmtpdHZpc2liaWxpdHljaGFuZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAndmlzaWJpbGl0eWNoYW5nZScKICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgaWYgKHMgfHwgKHMgPSB0LmQud2Via2l0VmlzaWJpbGl0eVN0YXRlKSwgcyAmJiAncHJlcmVuZGVyJyA9PSBzKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCF0LmdhKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQuZ2EgPSAxLCBpID0gMDsgaSA8IG8ubGVuZ3RoOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmQuYWRkRXZlbnRMaXN0ZW5lcihvW2ldLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0LmQudmlzaWJpbGl0eVN0YXRlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgfHwgKGUgPSB0LmQud2Via2l0VmlzaWJpbGl0eVN0YXRlKSwgJ3Zpc2libGUnID09IGUgJiYgKHQuZ2EgPSAwLCB0LmRlbGF5UmVhZHkoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByID0gMSwgYSA9IDA7CiAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICBpIHx8IHQudSgnX2QnKSAmJiAociA9IDEpOwogICAgICAgICAgICAgICAgcmV0dXJuIHIgJiYgKHQuSy5wdXNoKHsKICAgICAgICAgICAgICAgICAgICBtOiBlLAogICAgICAgICAgICAgICAgICAgIGE6IG4sCiAgICAgICAgICAgICAgICAgICAgdDogYQogICAgICAgICAgICAgICAgfSksIHQuZ2EgfHwgc2V0VGltZW91dCh0LmRlbGF5UmVhZHksIHQubWF4RGVsYXkpKSwgcjsKICAgICAgICAgICAgfSwgdC5kZWxheVJlYWR5ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGUsIG4gPSBuZXcgRGF0ZSgpLmdldFRpbWUoKSwgaSA9IDA7CiAgICAgICAgICAgICAgICBmb3IgKHQudSgnX2QnKSA/IGkgPSAxIDogdC5BYSgpOyAwIDwgdC5LLmxlbmd0aDspIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSA9IHQuSy5zaGlmdCgpLCBpICYmICFlLnQgJiYgZS50ID4gbikgewogICAgICAgICAgICAgICAgICAgICAgICB0LksudW5zaGlmdChlKSwgc2V0VGltZW91dCh0LmRlbGF5UmVhZHksIHBhcnNlSW50KHQubWF4RGVsYXkgLyAyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0LkxhID0gMSwgdFtlLm1dLmFwcGx5KHQsIGUuYSksIHQuTGEgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LCB0LnNldEFjY291bnQgPSB0LnNhID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHZhciBuLCBpOwogICAgICAgICAgICAgICAgaWYgKCF0LmZhKCdzZXRBY2NvdW50JywgYXJndW1lbnRzKSkKICAgICAgICAgICAgICAgICAgICBpZiAodC5hY2NvdW50ID0gZSwgdC5hbGxBY2NvdW50cykKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gdC5hbGxBY2NvdW50cy5jb25jYXQoZS5zcGxpdCgnLCcpKSwgdC5hbGxBY2NvdW50cyA9IFtdLCBuLnNvcnQoKSwgaSA9IDA7IGkgPCBuLmxlbmd0aDsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgMCAhPSBpICYmIG5baSAtIDFdID09IG5baV0gfHwgdC5hbGxBY2NvdW50cy5wdXNoKG5baV0pOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgdC5hbGxBY2NvdW50cyA9IGUuc3BsaXQoJywnKTsKICAgICAgICAgICAgfSwgdC5mb3JlYWNoVmFyID0gZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgIHZhciBpLCByLCBhLCBzLCBvID0gJyc7CiAgICAgICAgICAgICAgICBmb3IgKGEgPSByID0gJycsIHQubGlnaHRQcm9maWxlSUQgPyAoaSA9IHQuTywgKG8gPSB0LmxpZ2h0VHJhY2tWYXJzKSAmJiAobyA9ICcsJyArIG8gKyAnLCcgKyB0LmxhLmpvaW4oJywnKSArICcsJykpIDogKGkgPSB0LmcsICh0LnBlIHx8IHQubGlua1R5cGUpICYmIChvID0gdC5saW5rVHJhY2tWYXJzLCByID0gdC5saW5rVHJhY2tFdmVudHMsIHQucGUgJiYgKGEgPSB0LnBlLnN1YnN0cmluZygwLCAxKS50b1VwcGVyQ2FzZSgpICsgdC5wZS5zdWJzdHJpbmcoMSksIHRbYV0gJiYgKG8gPSB0W2FdLmVjLCByID0gdFthXS5jYykpKSwgbyAmJiAobyA9ICcsJyArIG8gKyAnLCcgKyB0LkYuam9pbignLCcpICsgJywnKSwgciAmJiBvICYmIChvICs9ICcsZXZlbnRzLCcpKSwgbiAmJiAobiA9ICcsJyArIG4gKyAnLCcpLCByID0gMDsgciA8IGkubGVuZ3RoOyByKyspCiAgICAgICAgICAgICAgICAgICAgYSA9IGlbcl0sIChzID0gdFthXSkgJiYgKCFvIHx8IDAgPD0gby5pbmRleE9mKCcsJyArIGEgKyAnLCcpKSAmJiAoIW4gfHwgMCA8PSBuLmluZGV4T2YoJywnICsgYSArICcsJykpICYmIGUoYSwgcyk7CiAgICAgICAgICAgIH0sIHQubyA9IGZ1bmN0aW9uIChlLCBuLCBpLCByLCBhKSB7CiAgICAgICAgICAgICAgICB2YXIgcywgbywgYywgbCwgdSA9ICcnLCBkID0gMDsKICAgICAgICAgICAgICAgIGlmICgnY29udGV4dERhdGEnID09IGUgJiYgKGUgPSAnYycpLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yIChzIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKE9iamVjdC5wcm90b3R5cGVbc10gfHwgYSAmJiBzLnN1YnN0cmluZygwLCBhLmxlbmd0aCkgIT0gYSkgJiYgbltzXSAmJiAoIWkgfHwgMCA8PSBpLmluZGV4T2YoJywnICsgKHIgPyByICsgJy4nIDogJycpICsgcyArICcsJykpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9ICExLCBkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobyA9IDA7IG8gPCBkLmxlbmd0aDsgbysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocy5zdWJzdHJpbmcoMCwgZFtvXS5sZW5ndGgpID09IGRbb10pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWMgJiYgKCcnID09IHUgJiYgKHUgKz0gJyYnICsgZSArICcuJyksIG8gPSBuW3NdLCBhICYmIChzID0gcy5zdWJzdHJpbmcoYS5sZW5ndGgpKSwgMCA8IHMubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA8IChjID0gcy5pbmRleE9mKCcuJykpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gKGEgfHwgJycpICsgKG8gPSBzLnN1YnN0cmluZygwLCBjKSkgKyAnLicsIGQgfHwgKGQgPSBbXSksIGQucHVzaChjKSwgdSArPSB0Lm8obywgbiwgaSwgciwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoJ2Jvb2xlYW4nID09IHR5cGVvZiBvICYmIChvID0gbyA/ICd0cnVlJyA6ICdmYWxzZScpLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgncmV0cmlldmVMaWdodERhdGEnID09IHIgJiYgMCA+IGEuaW5kZXhPZignLmNvbnRleHREYXRhLicpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChjID0gcy5zdWJzdHJpbmcoMCwgNCksIGwgPSBzLnN1YnN0cmluZyg0KSwgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndHJhbnNhY3Rpb25JRCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9ICd4YWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2NoYW5uZWwnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSAnY2gnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnY2FtcGFpZ24nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSAndjAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LlJhKGwpICYmICgncHJvcCcgPT0gYyA/IHMgPSAnYycgKyBsIDogJ2VWYXInID09IGMgPyBzID0gJ3YnICsgbCA6ICdsaXN0JyA9PSBjID8gcyA9ICdsJyArIGwgOiAnaGllcicgPT0gYyAmJiAocyA9ICdoJyArIGwsIG8gPSBvLnN1YnN0cmluZygwLCAyNTUpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgKz0gJyYnICsgdC5lc2NhcGUocykgKyAnPScgKyB0LmVzY2FwZShvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAnJyAhPSB1ICYmICh1ICs9ICcmLicgKyBlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB1OwogICAgICAgICAgICB9LCB0LnVzZVBvc3RiYWNrcyA9IDAsIHQuUWIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgZSwgbiwgciwgYSwgcywgbywgYywgbCwgdSA9ICcnLCBkID0gJycsIHAgPSAnJywgZiA9IGEgPSAnJywgZyA9IHQuVCgpOwogICAgICAgICAgICAgICAgaWYgKHQubGlnaHRQcm9maWxlSUQgPyAoZSA9IHQuTywgKGQgPSB0LmxpZ2h0VHJhY2tWYXJzKSAmJiAoZCA9ICcsJyArIGQgKyAnLCcgKyB0LmxhLmpvaW4oJywnKSArICcsJykpIDogKGUgPSB0LmcsICh0LnBlIHx8IHQubGlua1R5cGUpICYmIChkID0gdC5saW5rVHJhY2tWYXJzLCBwID0gdC5saW5rVHJhY2tFdmVudHMsIHQucGUgJiYgKGEgPSB0LnBlLnN1YnN0cmluZygwLCAxKS50b1VwcGVyQ2FzZSgpICsgdC5wZS5zdWJzdHJpbmcoMSksIHRbYV0gJiYgKGQgPSB0W2FdLmVjLCBwID0gdFthXS5jYykpKSwgZCAmJiAoZCA9ICcsJyArIGQgKyAnLCcgKyB0LkYuam9pbignLCcpICsgJywnKSwgcCAmJiAocCA9ICcsJyArIHAgKyAnLCcsIGQgJiYgKGQgKz0gJyxldmVudHMsJykpLCB0LmV2ZW50czIgJiYgKGYgKz0gKCcnICE9IGYgPyAnLCcgOiAnJykgKyB0LmV2ZW50czIpKSwgZyAmJiBnLmdldEN1c3RvbWVySURzKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEgPSBpLCBzID0gZy5nZXRDdXN0b21lcklEcygpKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gaW4gcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGVbbl0gfHwgJ29iamVjdCcgPT0gdHlwZW9mIChyID0gc1tuXSkgJiYgKGEgfHwgKGEgPSB7fSksIHIuaWQgJiYgKGFbbiArICcuaWQnXSA9IHIuaWQpLCByLmF1dGhTdGF0ZSAmJiAoYVtuICsgJy5hcyddID0gci5hdXRoU3RhdGUpKTsKICAgICAgICAgICAgICAgICAgICBhICYmICh1ICs9IHQubygnY2lkJywgYSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZm9yICh0LkF1ZGllbmNlTWFuYWdlbWVudCAmJiB0LkF1ZGllbmNlTWFuYWdlbWVudC5pc1JlYWR5KCkgJiYgKHUgKz0gdC5vKCdkJywgdC5BdWRpZW5jZU1hbmFnZW1lbnQuZ2V0RXZlbnRDYWxsQ29uZmlnUGFyYW1zKCkpKSwgbiA9IDA7IG4gPCBlLmxlbmd0aDsgbisrKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEgPSBlW25dLCBzID0gdFthXSwgciA9IGEuc3Vic3RyaW5nKDAsIDQpLCBvID0gYS5zdWJzdHJpbmcoNCksIHMgfHwgKCdldmVudHMnID09IGEgJiYgZiA/IChzID0gZiwgZiA9ICcnKSA6ICdtYXJrZXRpbmdDbG91ZE9yZ0lEJyA9PSBhICYmIGcgJiYgdC5WKCdFQ0lEJykgJiYgKHMgPSBnLm1hcmtldGluZ0Nsb3VkT3JnSUQpKSwgcyAmJiAoIWQgfHwgMCA8PSBkLmluZGV4T2YoJywnICsgYSArICcsJykpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdjdXN0b21lclBlcnNwZWN0aXZlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnY3AnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ21hcmtldGluZ0Nsb3VkT3JnSUQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdtY29yZ2lkJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdzdXBwbGVtZW50YWxEYXRhSUQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdzZGlkJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd0aW1lc3RhbXAnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICd0cyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZHluYW1pY1ZhcmlhYmxlUHJlZml4JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnRCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndmlzaXRvcklEJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAndmlkJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdtYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ21pZCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYW5hbHl0aWNzVmlzaXRvcklEJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnYWlkJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdhdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdhYW1saCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYXVkaWVuY2VNYW5hZ2VyQmxvYic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ2FhbWInOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2F1dGhTdGF0ZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ2FzJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdwYWdlVVJMJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnZycsIDI1NSA8IHMubGVuZ3RoICYmICh0LnBhZ2VVUkxSZXN0ID0gcy5zdWJzdHJpbmcoMjU1KSwgcyA9IHMuc3Vic3RyaW5nKDAsIDI1NSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3BhZ2VVUkxSZXN0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnLWcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3JlZmVycmVyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAncic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndm1rJzoKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndmlzaXRvck1pZ3JhdGlvbktleSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ3ZtdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndmlzaXRvck1pZ3JhdGlvblNlcnZlcic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ3ZtZicsIHQuc3NsICYmIHQudmlzaXRvck1pZ3JhdGlvblNlcnZlclNlY3VyZSAmJiAocyA9ICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd2aXNpdG9yTWlncmF0aW9uU2VydmVyU2VjdXJlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAndm1mJywgIXQuc3NsICYmIHQudmlzaXRvck1pZ3JhdGlvblNlcnZlciAmJiAocyA9ICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdjaGFyU2V0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnY2UnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3Zpc2l0b3JOYW1lc3BhY2UnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICducyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnY29va2llRG9tYWluUGVyaW9kcyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ2NkcCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnY29va2llTGlmZXRpbWUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdjbCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndmFyaWFibGVQcm92aWRlcic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ3Z2cCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnY3VycmVuY3lDb2RlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnY2MnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2NoYW5uZWwnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdjaCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndHJhbnNhY3Rpb25JRCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ3hhY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2NhbXBhaWduJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAndjAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2xhdGl0dWRlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnbGF0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdsb25naXR1ZGUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdsb24nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3Jlc29sdXRpb24nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdzJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdjb2xvckRlcHRoJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnYyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnamF2YXNjcmlwdFZlcnNpb24nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdqJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdqYXZhRW5hYmxlZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ3YnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Nvb2tpZXNFbmFibGVkJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnayc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYnJvd3NlcldpZHRoJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnYncnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Jyb3dzZXJIZWlnaHQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdiaCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnY29ubmVjdGlvblR5cGUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdjdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaG9tZXBhZ2UnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdocCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZXZlbnRzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmICYmIChzICs9ICgnJyAhPSBzID8gJywnIDogJycpICsgZiksIHApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChvID0gcy5zcGxpdCgnLCcpLCBzID0gJycsIHIgPSAwOyByIDwgby5sZW5ndGg7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCA8PSAobCA9IChjID0gb1tyXSkuaW5kZXhPZignPScpKSAmJiAoYyA9IGMuc3Vic3RyaW5nKDAsIGwpKSwgMCA8PSAobCA9IGMuaW5kZXhPZignOicpKSAmJiAoYyA9IGMuc3Vic3RyaW5nKDAsIGwpKSwgMCA8PSBwLmluZGV4T2YoJywnICsgYyArICcsJykgJiYgKHMgKz0gKHMgPyAnLCcgOiAnJykgKyBvW3JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdldmVudHMyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdjb250ZXh0RGF0YSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ICs9IHQubygnYycsIHRbYV0sIGQsIGEpLCBzID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbGlnaHRQcm9maWxlSUQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICdtdHAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2xpZ2h0U3RvcmVGb3JTZWNvbmRzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnbXRzcycsIHQubGlnaHRQcm9maWxlSUQgfHwgKHMgPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbGlnaHRJbmNyZW1lbnRCeSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ210aScsIHQubGlnaHRQcm9maWxlSUQgfHwgKHMgPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncmV0cmlldmVMaWdodFByb2ZpbGVzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnbXRzcic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZGVsZXRlTGlnaHRQcm9maWxlcyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ210c2QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3JldHJpZXZlTGlnaHREYXRhJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucmV0cmlldmVMaWdodFByb2ZpbGVzICYmICh1ICs9IHQubygnbXRzJywgdFthXSwgZCwgYSkpLCBzID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuUmEobykgJiYgKCdwcm9wJyA9PSByID8gYSA9ICdjJyArIG8gOiAnZVZhcicgPT0gciA/IGEgPSAndicgKyBvIDogJ2xpc3QnID09IHIgPyBhID0gJ2wnICsgbyA6ICdoaWVyJyA9PSByICYmIChhID0gJ2gnICsgbywgcyA9IHMuc3Vic3RyaW5nKDAsIDI1NSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBzICYmICh1ICs9ICcmJyArIGEgKyAnPScgKyAoJ3BldicgIT0gYS5zdWJzdHJpbmcoMCwgMykgPyB0LmVzY2FwZShzKSA6IHMpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgJ3BldjMnID09IGEgJiYgdC5lICYmICh1ICs9IHQuZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gdC5rYSAmJiAodSArPSAnJmxydD0nICsgdC5rYSwgdC5rYSA9IG51bGwpLCB1OwogICAgICAgICAgICB9LCB0LkIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgdmFyIHQgPSBlLnRhZ05hbWU7CiAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgIT0gJycgKyBlLmxjIHx8ICd1bmRlZmluZWQnICE9ICcnICsgZS5aYiAmJiAnSFRNTCcgIT0gKCcnICsgZS5aYikudG9VcHBlckNhc2UoKSA/ICcnIDogKCdTSEFQRScgPT0gKHQgPSB0ICYmIHQudG9VcHBlckNhc2UgPyB0LnRvVXBwZXJDYXNlKCkgOiAnJykgJiYgKHQgPSAnJyksIHQgJiYgKCgnSU5QVVQnID09IHQgfHwgJ0JVVFRPTicgPT0gdCkgJiYgZS50eXBlICYmIGUudHlwZS50b1VwcGVyQ2FzZSA/IHQgPSBlLnR5cGUudG9VcHBlckNhc2UoKSA6ICF0ICYmIGUuaHJlZiAmJiAodCA9ICdBJykpLCB0KTsKICAgICAgICAgICAgfSwgdC5OYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICB2YXIgdCwgaSwgciwgYSA9IG4ubG9jYXRpb24sIHMgPSBlLmhyZWYgPyBlLmhyZWYgOiAnJzsKICAgICAgICAgICAgICAgIHJldHVybiB0ID0gcy5pbmRleE9mKCc6JyksIGkgPSBzLmluZGV4T2YoJz8nKSwgciA9IHMuaW5kZXhPZignLycpLCBzICYmICgwID4gdCB8fCAwIDw9IGkgJiYgdCA+IGkgfHwgMCA8PSByICYmIHQgPiByKSAmJiAoaSA9IGUucHJvdG9jb2wgJiYgMSA8IGUucHJvdG9jb2wubGVuZ3RoID8gZS5wcm90b2NvbCA6IGEucHJvdG9jb2wgPyBhLnByb3RvY29sIDogJycsIHQgPSBhLnBhdGhuYW1lLmxhc3RJbmRleE9mKCcvJyksIHMgPSAoaSA/IGkgKyAnLy8nIDogJycpICsgKGUuaG9zdCA/IGUuaG9zdCA6IGEuaG9zdCA/IGEuaG9zdCA6ICcnKSArICgnLycgIT0gcy5zdWJzdHJpbmcoMCwgMSkgPyBhLnBhdGhuYW1lLnN1YnN0cmluZygwLCAwID4gdCA/IDAgOiB0KSArICcvJyA6ICcnKSArIHMpLCBzOwogICAgICAgICAgICB9LCB0LkwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgdmFyIG4sIGksIHIgPSB0LkIoZSksIGEgPSAnJywgcyA9IDA7CiAgICAgICAgICAgICAgICByZXR1cm4gciAmJiAobiA9IGUucHJvdG9jb2wsIGkgPSBlLm9uY2xpY2ssICFlLmhyZWYgfHwgJ0EnICE9IHIgJiYgJ0FSRUEnICE9IHIgfHwgaSAmJiBuICYmICEoMCA+IG4udG9Mb3dlckNhc2UoKS5pbmRleE9mKCdqYXZhc2NyaXB0JykpID8gaSA/IChhID0gdC5yZXBsYWNlKHQucmVwbGFjZSh0LnJlcGxhY2UodC5yZXBsYWNlKCcnICsgaSwgJ1xyJywgJycpLCAnXG4nLCAnJyksICdcdCcsICcnKSwgJyAnLCAnJyksIHMgPSAyKSA6ICdJTlBVVCcgPT0gciB8fCAnU1VCTUlUJyA9PSByID8gKGUudmFsdWUgPyBhID0gZS52YWx1ZSA6IGUuaW5uZXJUZXh0ID8gYSA9IGUuaW5uZXJUZXh0IDogZS50ZXh0Q29udGVudCAmJiAoYSA9IGUudGV4dENvbnRlbnQpLCBzID0gMykgOiAnSU1BR0UnID09IHIgJiYgZS5zcmMgJiYgKGEgPSBlLnNyYykgOiBhID0gdC5OYShlKSwgYSkgPyB7CiAgICAgICAgICAgICAgICAgICAgaWQ6IGEuc3Vic3RyaW5nKDAsIDEwMCksCiAgICAgICAgICAgICAgICAgICAgdHlwZTogcwogICAgICAgICAgICAgICAgfSA6IDA7CiAgICAgICAgICAgIH0sIHQuamMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IHQuQihlKSwgaSA9IHQuTChlKTsgZSAmJiAhaSAmJiAnQk9EWScgIT0gbjspCiAgICAgICAgICAgICAgICAgICAgKGUgPSBlLnBhcmVudEVsZW1lbnQgPyBlLnBhcmVudEVsZW1lbnQgOiBlLnBhcmVudE5vZGUpICYmIChuID0gdC5CKGUpLCBpID0gdC5MKGUpKTsKICAgICAgICAgICAgICAgIHJldHVybiBpICYmICdCT0RZJyAhPSBuIHx8IChlID0gMCksIGUgJiYgKDAgPD0gKG4gPSBlLm9uY2xpY2sgPyAnJyArIGUub25jbGljayA6ICcnKS5pbmRleE9mKCcudGwoJykgfHwgMCA8PSBuLmluZGV4T2YoJy50cmFja0xpbmsoJykpICYmIChlID0gMCksIGU7CiAgICAgICAgICAgIH0sIHQuWWIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgZSwgaSwgciwgYSwgcyA9IHQubGlua09iamVjdCwgbyA9IHQubGlua1R5cGUsIGMgPSB0LmxpbmtVUkw7CiAgICAgICAgICAgICAgICBpZiAodC5tYSA9IDEsIHMgfHwgKHQubWEgPSAwLCBzID0gdC5jbGlja09iamVjdCksIHMpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSB0LkIocyksIGkgPSB0Lkwocyk7IHMgJiYgIWkgJiYgJ0JPRFknICE9IGU7KQogICAgICAgICAgICAgICAgICAgICAgICAocyA9IHMucGFyZW50RWxlbWVudCA/IHMucGFyZW50RWxlbWVudCA6IHMucGFyZW50Tm9kZSkgJiYgKGUgPSB0LkIocyksIGkgPSB0LkwocykpOwogICAgICAgICAgICAgICAgICAgIGlmIChpICYmICdCT0RZJyAhPSBlIHx8IChzID0gMCksIHMgJiYgIXQubGlua09iamVjdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IHMub25jbGljayA/ICcnICsgcy5vbmNsaWNrIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICgwIDw9IGwuaW5kZXhPZignLnRsKCcpIHx8IDAgPD0gbC5pbmRleE9mKCcudHJhY2tMaW5rKCcpKSAmJiAocyA9IDApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgIHQubWEgPSAxOwogICAgICAgICAgICAgICAgaWYgKCFjICYmIHMgJiYgKGMgPSB0Lk5hKHMpKSwgYyAmJiAhdC5saW5rTGVhdmVRdWVyeVN0cmluZyAmJiAoMCA8PSAociA9IGMuaW5kZXhPZignPycpKSAmJiAoYyA9IGMuc3Vic3RyaW5nKDAsIHIpKSksICFvICYmIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdSwgZCA9IDAsIHAgPSAwOwogICAgICAgICAgICAgICAgICAgIGlmICh0LnRyYWNrRG93bmxvYWRMaW5rcyAmJiB0LmxpbmtEb3dubG9hZEZpbGVUeXBlcykKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyID0gKGwgPSBjLnRvTG93ZXJDYXNlKCkpLmluZGV4T2YoJz8nKSwgYSA9IGwuaW5kZXhPZignIycpLCAwIDw9IHIgPyAwIDw9IGEgJiYgYSA8IHIgJiYgKHIgPSBhKSA6IHIgPSBhLCAwIDw9IHIgJiYgKGwgPSBsLnN1YnN0cmluZygwLCByKSksIHIgPSB0LmxpbmtEb3dubG9hZEZpbGVUeXBlcy50b0xvd2VyQ2FzZSgpLnNwbGl0KCcsJyksIGEgPSAwOyBhIDwgci5sZW5ndGg7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICh1ID0gclthXSkgJiYgbC5zdWJzdHJpbmcobC5sZW5ndGggLSAodS5sZW5ndGggKyAxKSkgPT0gJy4nICsgdSAmJiAobyA9ICdkJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQudHJhY2tFeHRlcm5hbExpbmtzICYmICFvICYmIChsID0gYy50b0xvd2VyQ2FzZSgpLCB0LlFhKGwpICYmICh0LmxpbmtJbnRlcm5hbEZpbHRlcnMgfHwgKHQubGlua0ludGVybmFsRmlsdGVycyA9IG4ubG9jYXRpb24uaG9zdG5hbWUpLCByID0gMCwgdC5saW5rRXh0ZXJuYWxGaWx0ZXJzID8gKHIgPSB0LmxpbmtFeHRlcm5hbEZpbHRlcnMudG9Mb3dlckNhc2UoKS5zcGxpdCgnLCcpLCBkID0gMSkgOiB0LmxpbmtJbnRlcm5hbEZpbHRlcnMgJiYgKHIgPSB0LmxpbmtJbnRlcm5hbEZpbHRlcnMudG9Mb3dlckNhc2UoKS5zcGxpdCgnLCcpKSwgcikpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IDA7IGEgPCByLmxlbmd0aDsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdSA9IHJbYV0sIDAgPD0gbC5pbmRleE9mKHUpICYmIChwID0gMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHAgPyBkICYmIChvID0gJ2UnKSA6IGQgfHwgKG8gPSAnZScpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHQubGlua09iamVjdCA9IHMsIHQubGlua1VSTCA9IGMsIHQubGlua1R5cGUgPSBvLCAodC50cmFja0NsaWNrTWFwIHx8IHQudHJhY2tJbmxpbmVTdGF0cykgJiYgKHQuZSA9ICcnLCBzICYmIChvID0gdC5wYWdlTmFtZSwgYyA9IDEsIHMgPSBzLnNvdXJjZUluZGV4LCBvIHx8IChvID0gdC5wYWdlVVJMLCBjID0gMCksIG4uc19vYmplY3RJRCAmJiAoaS5pZCA9IG4uc19vYmplY3RJRCwgcyA9IGkudHlwZSA9IDEpLCBvICYmIGkgJiYgaS5pZCAmJiBlICYmICh0LmUgPSAnJnBpZD0nICsgdC5lc2NhcGUoby5zdWJzdHJpbmcoMCwgMjU1KSkgKyAoYyA/ICcmcGlkdD0nICsgYyA6ICcnKSArICcmb2lkPScgKyB0LmVzY2FwZShpLmlkLnN1YnN0cmluZygwLCAxMDApKSArIChpLnR5cGUgPyAnJm9pZHQ9JyArIGkudHlwZSA6ICcnKSArICcmb3Q9JyArIGUgKyAocyA/ICcmb2k9JyArIHMgOiAnJykpKSk7CiAgICAgICAgICAgIH0sIHQuUmIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgZSA9IHQubWEsIG4gPSB0LmxpbmtUeXBlLCBpID0gdC5saW5rVVJMLCByID0gdC5saW5rTmFtZTsKICAgICAgICAgICAgICAgIGlmIChuICYmIChpIHx8IHIpICYmICgnZCcgIT0gKG4gPSBuLnRvTG93ZXJDYXNlKCkpICYmICdlJyAhPSBuICYmIChuID0gJ28nKSwgdC5wZSA9ICdsbmtfJyArIG4sIHQucGV2MSA9IGkgPyB0LmVzY2FwZShpKSA6ICcnLCB0LnBldjIgPSByID8gdC5lc2NhcGUocikgOiAnJywgZSA9IDEpLCB0LmFib3J0ICYmIChlID0gMCksIHQudHJhY2tDbGlja01hcCB8fCB0LnRyYWNrSW5saW5lU3RhdHMgfHwgdC5VYigpKSB7CiAgICAgICAgICAgICAgICAgICAgbiA9IHt9LCBpID0gMDsKICAgICAgICAgICAgICAgICAgICB2YXIgYSwgcywgbywgYyA9IChsID0gdC5yYigpKSA/IGwuc3BsaXQoJyYnKSA6IDAsIGwgPSAwOwogICAgICAgICAgICAgICAgICAgIGlmIChjKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgPSAwOyBhIDwgYy5sZW5ndGg7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSBjW2FdLnNwbGl0KCc9JyksIHIgPSB0LnVuZXNjYXBlKHNbMF0pLnNwbGl0KCcsJyksIG5bcyA9IHQudW5lc2NhcGUoc1sxXSldID0gcjsKICAgICAgICAgICAgICAgICAgICBmb3IgKG8gaW4gKHIgPSB0LmFjY291bnQuc3BsaXQoJywnKSwgYSA9IHt9LCB0LmNvbnRleHREYXRhKSkKICAgICAgICAgICAgICAgICAgICAgICAgbyAmJiAhT2JqZWN0LnByb3RvdHlwZVtvXSAmJiAnYS5hY3Rpdml0eW1hcC4nID09IG8uc3Vic3RyaW5nKDAsIDE0KSAmJiAoYVtvXSA9IHQuY29udGV4dERhdGFbb10sIHQuY29udGV4dERhdGFbb10gPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQuZSA9IHQubygnYycsIGEpICsgKHQuZSA/IHQuZSA6ICcnKSwgZSB8fCB0LmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChzIGluIChlICYmICF0LmUgJiYgKGwgPSAxKSwgbikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIU9iamVjdC5wcm90b3R5cGVbc10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChvID0gMDsgbyA8IHIubGVuZ3RoOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobCAmJiAoKGMgPSBuW3NdLmpvaW4oJywnKSkgPT0gdC5hY2NvdW50ICYmICh0LmUgKz0gKCcmJyAhPSBzLmNoYXJBdCgwKSA/ICcmJyA6ICcnKSArIHMsIG5bc10gPSBbXSwgaSA9IDEpKSwgYSA9IDA7IGEgPCBuW3NdLmxlbmd0aDsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGMgPSBuW3NdW2FdKSA9PSByW29dICYmIChsICYmICh0LmUgKz0gJyZ1PScgKyB0LmVzY2FwZShjKSArICgnJicgIT0gcy5jaGFyQXQoMCkgPyAnJicgOiAnJykgKyBzICsgJyZ1PTAnKSwgbltzXS5zcGxpY2UoYSwgMSksIGkgPSAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgfHwgKGkgPSAxKSwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChzIGluIChsID0gJycsIGEgPSAyLCAhZSAmJiB0LmUgJiYgKGwgPSB0LmVzY2FwZShyLmpvaW4oJywnKSkgKyAnPScgKyB0LmVzY2FwZSh0LmUpLCBhID0gMSksIG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFPYmplY3QucHJvdG90eXBlW3NdICYmIDAgPCBhICYmIDAgPCBuW3NdLmxlbmd0aCAmJiAobCArPSAobCA/ICcmJyA6ICcnKSArIHQuZXNjYXBlKG5bc10uam9pbignLCcpKSArICc9JyArIHQuZXNjYXBlKHMpLCBhLS0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC56YihsKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICB9LCB0LnJiID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHQudXNlTGlua1RyYWNrU2Vzc2lvblN0b3JhZ2UgPyB0LkVhKCkgPyBuLnNlc3Npb25TdG9yYWdlLmdldEl0ZW0odC5QKSA6IHZvaWQgMCA6IHQuY29va2llUmVhZCh0LlApOwogICAgICAgICAgICB9LCB0LkVhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICEhbi5zZXNzaW9uU3RvcmFnZTsKICAgICAgICAgICAgfSwgdC56YiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICB0LnVzZUxpbmtUcmFja1Nlc3Npb25TdG9yYWdlID8gdC5FYSgpICYmIG4uc2Vzc2lvblN0b3JhZ2Uuc2V0SXRlbSh0LlAsIGUpIDogdC5jb29raWVXcml0ZSh0LlAsIGUpOwogICAgICAgICAgICB9LCB0LlNiID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKCF0LmJjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIG4sIGkgPSBuZXcgRGF0ZSgpLCByID0gby5sb2NhdGlvbiwgYSA9IG4gPSBlID0gJycsIHMgPSAnJywgYyA9ICcnLCBsID0gJzEuMicsIHUgPSB0LmNvb2tpZVdyaXRlKCdzX2NjJywgJ3RydWUnLCAwKSA/ICdZJyA6ICdOJywgZCA9ICcnLCBwID0gJyc7CiAgICAgICAgICAgICAgICAgICAgaWYgKGkuc2V0VVRDRGF0ZSAmJiAobCA9ICcxLjMnLCAwIC50b1ByZWNpc2lvbiAmJiAobCA9ICcxLjUnLCAoaSA9IFtdKS5mb3JFYWNoKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbCA9ICcxLjYnLCBuID0gMCwgZSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgKG4gPSBuZXcgSXRlcmF0b3IoZSkpLm5leHQgJiYgKGwgPSAnMS43JywgaS5yZWR1Y2UgJiYgKChsID0gJzEuOCcpLnRyaW0gJiYgKGwgPSAnMS44LjEnLCBEYXRlLnBhcnNlICYmIChsID0gJzEuOC4yJywgT2JqZWN0LmNyZWF0ZSAmJiAobCA9ICcxLjguNScpKSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGUgPSBzY3JlZW4ud2lkdGggKyAneCcgKyBzY3JlZW4uaGVpZ2h0LCBhID0gbmF2aWdhdG9yLmphdmFFbmFibGVkKCkgPyAnWScgOiAnTicsIG4gPSBzY3JlZW4ucGl4ZWxEZXB0aCA/IHNjcmVlbi5waXhlbERlcHRoIDogc2NyZWVuLmNvbG9yRGVwdGgsIHMgPSB0LncuaW5uZXJXaWR0aCA/IHQudy5pbm5lcldpZHRoIDogdC5kLmRvY3VtZW50RWxlbWVudC5vZmZzZXRXaWR0aCwgYyA9IHQudy5pbm5lckhlaWdodCA/IHQudy5pbm5lckhlaWdodCA6IHQuZC5kb2N1bWVudEVsZW1lbnQub2Zmc2V0SGVpZ2h0OwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQuYi5hZGRCZWhhdmlvcignI2RlZmF1bHQjaG9tZVBhZ2UnKSwgZCA9IHQuYi5rYyhyKSA/ICdZJyA6ICdOJzsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQuYi5hZGRCZWhhdmlvcignI2RlZmF1bHQjY2xpZW50Q2FwcycpLCBwID0gdC5iLmNvbm5lY3Rpb25UeXBlOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdC5yZXNvbHV0aW9uID0gZSwgdC5jb2xvckRlcHRoID0gbiwgdC5qYXZhc2NyaXB0VmVyc2lvbiA9IGwsIHQuamF2YUVuYWJsZWQgPSBhLCB0LmNvb2tpZXNFbmFibGVkID0gdSwgdC5icm93c2VyV2lkdGggPSBzLCB0LmJyb3dzZXJIZWlnaHQgPSBjLCB0LmNvbm5lY3Rpb25UeXBlID0gcCwgdC5ob21lcGFnZSA9IGQsIHQuYmMgPSAxOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LCB0LlEgPSB7fSwgdC5sb2FkTW9kdWxlID0gZnVuY3Rpb24gKGUsIGkpIHsKICAgICAgICAgICAgICAgIHZhciByID0gdC5RW2VdOwogICAgICAgICAgICAgICAgaWYgKCFyKSB7CiAgICAgICAgICAgICAgICAgICAgciA9IG5bJ0FwcE1lYXN1cmVtZW50X01vZHVsZV8nICsgZV0gPyBuZXcgblsnQXBwTWVhc3VyZW1lbnRfTW9kdWxlXycgKyBlXSh0KSA6IHt9LCB0LlFbZV0gPSB0W2VdID0gciwgci5rYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIudWI7CiAgICAgICAgICAgICAgICAgICAgfSwgci5BYiA9IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIChyLnViID0gbikgJiYgKHRbZSArICdfb25Mb2FkJ10gPSBuLCB0LmZhKGUgKyAnX29uTG9hZCcsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByCiAgICAgICAgICAgICAgICAgICAgICAgIF0sIDEpIHx8IG4odCwgcikpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5ID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KHIsICdvbkxvYWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IHIua2IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IHIuQWIKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiByLl9vbGMgPSAxOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgci5fb2xjID0gMTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpICYmICh0W2UgKyAnX29uTG9hZCddID0gaSwgdC5mYShlICsgJ19vbkxvYWQnLCBbCiAgICAgICAgICAgICAgICAgICAgdCwKICAgICAgICAgICAgICAgICAgICByCiAgICAgICAgICAgICAgICBdLCAxKSB8fCBpKHQsIHIpKTsKICAgICAgICAgICAgfSwgdC51ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHZhciBuLCBpOwogICAgICAgICAgICAgICAgZm9yIChuIGluIHQuUSkKICAgICAgICAgICAgICAgICAgICBpZiAoIU9iamVjdC5wcm90b3R5cGVbbl0gJiYgKGkgPSB0LlFbbl0pICYmIChpLl9vbGMgJiYgaS5vbkxvYWQgJiYgKGkuX29sYyA9IDAsIGkub25Mb2FkKHQsIGkpKSwgaVtlXSAmJiBpW2VdKCkpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9LCB0LlViID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICEoIXQuQWN0aXZpdHlNYXAgfHwgIXQuQWN0aXZpdHlNYXAuX2MpOwogICAgICAgICAgICB9LCB0LlZiID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGUgPSBNYXRoLmZsb29yKDEwMDAwMDAwMDAwMDAwICogTWF0aC5yYW5kb20oKSksIG4gPSB0LnZpc2l0b3JTYW1wbGluZywgaSA9IHQudmlzaXRvclNhbXBsaW5nR3JvdXAsIHIgPSAoaSA9ICdzX3Zzbl8nICsgKHQudmlzaXRvck5hbWVzcGFjZSA/IHQudmlzaXRvck5hbWVzcGFjZSA6IHQuYWNjb3VudCkgKyAoaSA/ICdfJyArIGkgOiAnJyksIHQuY29va2llUmVhZChpKSk7CiAgICAgICAgICAgICAgICBpZiAobikgewogICAgICAgICAgICAgICAgICAgIGlmIChuICo9IDEwMCwgciAmJiAociA9IHBhcnNlSW50KHIpKSwgIXIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0LmNvb2tpZVdyaXRlKGksIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAociAlIDEwMDAwID4gbikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgICAgfSwgdC5TID0gZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgIHZhciBpLCByLCBhLCBzLCBvLCBjLCBsOwogICAgICAgICAgICAgICAgZm9yIChsID0ge30sIGkgPSAwOyAyID4gaTsgaSsrKQogICAgICAgICAgICAgICAgICAgIGZvciAociA9IDAgPCBpID8gdC5HYSA6IHQuZywgYSA9IDA7IGEgPCByLmxlbmd0aDsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoKG8gPSBlW3MgPSByW2FdXSkgfHwgZVsnIScgKyBzXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8gJiYgIW4gJiYgKCdjb250ZXh0RGF0YScgPT0gcyB8fCAncmV0cmlldmVMaWdodERhdGEnID09IHMpICYmIHRbc10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjIGluIHRbc10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9bY10gfHwgKG9bY10gPSB0W3NdW2NdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbc10gfHwgKGxbJyEnICsgc10gPSAxKSwgbFtzXSA9IHRbc10sIHRbc10gPSBvOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gbDsKICAgICAgICAgICAgfSwgdC5oYyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICB2YXIgbiwgaSwgciwgYTsKICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IDIgPiBuOyBuKyspCiAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMCA8IG4gPyB0LkdhIDogdC5nLCByID0gMDsgciA8IGkubGVuZ3RoOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGVbYSA9IGlbcl1dID0gdFthXSwgZVthXSB8fCAncHJvcCcgIT09IGEuc3Vic3RyaW5nKDAsIDQpICYmICdlVmFyJyAhPT0gYS5zdWJzdHJpbmcoMCwgNCkgJiYgJ2hpZXInICE9PSBhLnN1YnN0cmluZygwLCA0KSAmJiAnbGlzdCcgIT09IGEuc3Vic3RyaW5nKDAsIDQpICYmICdjaGFubmVsJyAhPT0gYSAmJiAnZXZlbnRzJyAhPT0gYSAmJiAnZXZlbnRMaXN0JyAhPT0gYSAmJiAncHJvZHVjdHMnICE9PSBhICYmICdwcm9kdWN0TGlzdCcgIT09IGEgJiYgJ3B1cmNoYXNlSUQnICE9PSBhICYmICd0cmFuc2FjdGlvbklEJyAhPT0gYSAmJiAnc3RhdGUnICE9PSBhICYmICd6aXAnICE9PSBhICYmICdjYW1wYWlnbicgIT09IGEgJiYgJ2V2ZW50czInICE9PSBhICYmICdsYXRpdHVkZScgIT09IGEgJiYgJ2xvbmdpdHVkZScgIT09IGEgJiYgJ21zX2EnICE9PSBhICYmICdjb250ZXh0RGF0YScgIT09IGEgJiYgJ3N1cHBsZW1lbnRhbERhdGFJRCcgIT09IGEgJiYgJ3RudCcgIT09IGEgJiYgJ3RpbWVzdGFtcCcgIT09IGEgJiYgJ2Fib3J0JyAhPT0gYSAmJiAndXNlQmVhY29uJyAhPT0gYSAmJiAnbGlua09iamVjdCcgIT09IGEgJiYgJ2NsaWNrT2JqZWN0JyAhPT0gYSAmJiAnbGlua1R5cGUnICE9PSBhICYmICdsaW5rTmFtZScgIT09IGEgJiYgJ2xpbmtVUkwnICE9PSBhICYmICdib2R5Q2xpY2tUYXJnZXQnICE9PSBhICYmICdib2R5Q2xpY2tGdW5jdGlvbicgIT09IGEgfHwgKGVbJyEnICsgYV0gPSAxKTsKICAgICAgICAgICAgfSwgdC5NYiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICB2YXIgdCwgbiwgaSwgciwgYSwgcywgbyA9IDAsIGMgPSAnJywgbCA9ICcnOwogICAgICAgICAgICAgICAgaWYgKGUgJiYgMjU1IDwgZS5sZW5ndGggJiYgKDAgPCAobiA9ICh0ID0gJycgKyBlKS5pbmRleE9mKCc/JykpICYmIChzID0gdC5zdWJzdHJpbmcobiArIDEpLCBpID0gMCwgJ2h0dHA6Ly8nID09IChyID0gKHQgPSB0LnN1YnN0cmluZygwLCBuKSkudG9Mb3dlckNhc2UoKSkuc3Vic3RyaW5nKDAsIDcpID8gaSArPSA3IDogJ2h0dHBzOi8vJyA9PSByLnN1YnN0cmluZygwLCA4KSAmJiAoaSArPSA4KSwgMCA8IChuID0gci5pbmRleE9mKCcvJywgaSkpICYmIChyID0gci5zdWJzdHJpbmcoaSwgbiksIGEgPSB0LnN1YnN0cmluZyhuKSwgdCA9IHQuc3Vic3RyaW5nKDAsIG4pLCAwIDw9IHIuaW5kZXhPZignZ29vZ2xlJykgPyBvID0gJyxxLGllLHN0YXJ0LHNlYXJjaF9rZXksd29yZCxrdyxjZCwnIDogMCA8PSByLmluZGV4T2YoJ3lhaG9vLmNvJykgPyBvID0gJyxwLGVpLCcgOiAwIDw9IHIuaW5kZXhPZignYmFpZHUuJykgJiYgKG8gPSAnLHdkLHdvcmQsJyksIG8gJiYgcykpKSkgewogICAgICAgICAgICAgICAgICAgIGlmICgoZSA9IHMuc3BsaXQoJyYnKSkgJiYgMSA8IGUubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBlLmxlbmd0aDsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgMCA8IChuID0gKHIgPSBlW2ldKS5pbmRleE9mKCc9JykpICYmIDAgPD0gby5pbmRleE9mKCcsJyArIHIuc3Vic3RyaW5nKDAsIG4pICsgJywnKSA/IGMgKz0gKGMgPyAnJicgOiAnJykgKyByIDogbCArPSAobCA/ICcmJyA6ICcnKSArIHI7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgJiYgbCA/IHMgPSBjICsgJyYnICsgbCA6IGwgPSAnJzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZSA9IHQgKyAoMCA8IChuID0gMjUzIC0gKHMubGVuZ3RoIC0gbC5sZW5ndGgpIC0gdC5sZW5ndGgpID8gYS5zdWJzdHJpbmcoMCwgbikgOiAnJykgKyAnPycgKyBzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgIH0sIHQuZWIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgdmFyIG4gPSB0LmQudmlzaWJpbGl0eVN0YXRlLCBpID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnd2Via2l0dmlzaWJpbGl0eWNoYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICd2aXNpYmlsaXR5Y2hhbmdlJwogICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICBpZiAobiB8fCAobiA9IHQuZC53ZWJraXRWaXNpYmlsaXR5U3RhdGUpLCBuICYmICdwcmVyZW5kZXInID09IG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gMDsgbiA8IGkubGVuZ3RoOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmQuYWRkRXZlbnRMaXN0ZW5lcihpW25dLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LmQudmlzaWJpbGl0eVN0YXRlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gfHwgKG4gPSB0LmQud2Via2l0VmlzaWJpbGl0eVN0YXRlKSwgJ3Zpc2libGUnID09IG4gJiYgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICB9LCB0LmNhID0gITEsIHQuSCA9ICExLCB0LkNiID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdC5IID0gITAsIHQucCgpOwogICAgICAgICAgICB9LCB0LkkgPSAhMSwgdC5EYiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICB0Lm1hcmtldGluZ0Nsb3VkVmlzaXRvcklEID0gZS5NQ01JRCwgdC52aXNpdG9yT3B0ZWRPdXQgPSBlLk1DT1BUT1VULCB0LmFuYWx5dGljc1Zpc2l0b3JJRCA9IGUuTUNBSUQsIHQuYXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50ID0gZS5NQ0FBTUxILCB0LmF1ZGllbmNlTWFuYWdlckJsb2IgPSBlLk1DQUFNQiwgdC5JID0gITEsIHQucCgpOwogICAgICAgICAgICB9LCB0LmNiID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0Lm1heERlbGF5IHx8ICh0Lm1heERlbGF5ID0gMjUwKSwgIXQudSgnX2QnKSB8fCAoZSAmJiBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBlKCk7CiAgICAgICAgICAgICAgICB9LCB0Lm1heERlbGF5KSwgITEpOwogICAgICAgICAgICB9LCB0LmFhID0gITEsIHQuRyA9ICExLCB0LkFhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdC5HID0gITAsIHQucCgpOwogICAgICAgICAgICB9LCB0LmlzUmVhZHlUb1RyYWNrID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGUgPSAhMDsKICAgICAgICAgICAgICAgIHJldHVybiAhKCF0Lm9iKCkgfHwgIXQubWIoKSkgJiYgKHQucWIoKSB8fCAoZSA9ICExKSwgdC50YigpIHx8IChlID0gITEpLCBlKTsKICAgICAgICAgICAgfSwgdC5vYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0LmNhIHx8IHQuSCB8fCAodC5lYih0LkNiKSA/IHQuSCA9ICEwIDogdC5jYSA9ICEwKSwgISh0LmNhICYmICF0LkgpOwogICAgICAgICAgICB9LCB0Lm1iID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGUgPSB0LndhKCk7CiAgICAgICAgICAgICAgICBpZiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghdC50YSAmJiAhdC5iYSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZmV0Y2hQZXJtaXNzaW9ucyh0LnZiLCAhMCksIHQuYmEgPSAhMCwgITE7CiAgICAgICAgICAgICAgICAgICAgaWYgKCF0LnRhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFlLmlzQXBwcm92ZWQoZS5DYXRlZ29yaWVzLkFOQUxZVElDUykpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgfSwgdC5WID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHZhciBuID0gdC53YSgpOwogICAgICAgICAgICAgICAgcmV0dXJuICEobiAmJiAhbi5pc0FwcHJvdmVkKG4uQ2F0ZWdvcmllc1tlXSkpOwogICAgICAgICAgICB9LCB0LndhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIG4uYWRvYmUgJiYgbi5hZG9iZS5vcHRJbiA/IG4uYWRvYmUub3B0SW4gOiBudWxsOwogICAgICAgICAgICB9LCB0LlkgPSAhMCwgdC5xYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBlID0gdC5UKCk7CiAgICAgICAgICAgICAgICByZXR1cm4gIWUgfHwgIWUuZ2V0VmlzaXRvclZhbHVlcyB8fCAodC5ZICYmICh0LlkgPSAhMSwgdC5JIHx8ICh0LkkgPSAhMCwgZS5nZXRWaXNpdG9yVmFsdWVzKHQuRGIpKSksICF0LkkpOwogICAgICAgICAgICB9LCB0LlQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgZSA9IHQudmlzaXRvcjsKICAgICAgICAgICAgICAgIHJldHVybiBlICYmICFlLmlzQWxsb3dlZCgpICYmIChlID0gbnVsbCksIGU7CiAgICAgICAgICAgIH0sIHQudGIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdC5hYSB8fCB0LkcgfHwgKHQuY2IodC5BYSkgPyB0LkcgPSAhMCA6IHQuYWEgPSAhMCksICEodC5hYSAmJiAhdC5HKTsKICAgICAgICAgICAgfSwgdC5iYSA9ICExLCB0LnZiID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdC5iYSA9ICExLCB0LnRhID0gITA7CiAgICAgICAgICAgIH0sIHQuaiA9IGksIHQucSA9IDAsIHQuY2FsbGJhY2tXaGVuUmVhZHlUb1RyYWNrID0gZnVuY3Rpb24gKGUsIG4sIHIpIHsKICAgICAgICAgICAgICAgIHZhciBhOwogICAgICAgICAgICAgICAgKGEgPSB7fSkuSGIgPSBlLCBhLkdiID0gbiwgYS5FYiA9IHIsIHQuaiA9PSBpICYmICh0LmogPSBbXSksIHQuai5wdXNoKGEpLCAwID09IHQucSAmJiAodC5xID0gc2V0SW50ZXJ2YWwodC5wLCAxMDApKTsKICAgICAgICAgICAgfSwgdC5wID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICBpZiAodC5pc1JlYWR5VG9UcmFjaygpICYmICh0LkJiKCksIHQuaiAhPSBpKSkKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgMCA8IHQuai5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgICAgICAoZSA9IHQuai5zaGlmdCgpKS5HYi5hcHBseShlLkhiLCBlLkViKTsKICAgICAgICAgICAgfSwgdC5CYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHQucSAmJiAoY2xlYXJJbnRlcnZhbCh0LnEpLCB0LnEgPSAwKTsKICAgICAgICAgICAgfSwgdC51YSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICB2YXIgbiwgciA9IHt9OwogICAgICAgICAgICAgICAgaWYgKHQuaGMociksIGUgIT0gaSkKICAgICAgICAgICAgICAgICAgICBmb3IgKG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgcltuXSA9IGVbbl07CiAgICAgICAgICAgICAgICB0LmNhbGxiYWNrV2hlblJlYWR5VG9UcmFjayh0LCB0LkZhLCBbcl0pLCB0LkRhKCk7CiAgICAgICAgICAgIH0sIHQuT2IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgZSwgbiA9IHQuY29va2llUmVhZCgnc19maWQnKSwgaSA9ICcnLCByID0gJyc7CiAgICAgICAgICAgICAgICBlID0gODsKICAgICAgICAgICAgICAgIHZhciBhID0gNDsKICAgICAgICAgICAgICAgIGlmICghbiB8fCAwID4gbi5pbmRleE9mKCctJykpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSAwOyAxNiA+IG47IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIGUpLCBpICs9ICcwMTIzNDU2Nzg5QUJDREVGJy5zdWJzdHJpbmcoZSwgZSArIDEpLCBlID0gTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogYSksIHIgKz0gJzAxMjM0NTY3ODlBQkNERUYnLnN1YnN0cmluZyhlLCBlICsgMSksIGUgPSBhID0gMTY7CiAgICAgICAgICAgICAgICAgICAgbiA9IGkgKyAnLScgKyByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHQuY29va2llV3JpdGUoJ3NfZmlkJywgbiwgMSkgfHwgKG4gPSAwKSwgbjsKICAgICAgICAgICAgfSwgdC5GYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICB2YXIgaSwgciA9IG5ldyBEYXRlKCksIGEgPSAncycgKyBNYXRoLmZsb29yKHIuZ2V0VGltZSgpIC8gMTA4MDAwMDApICUgMTAgKyBNYXRoLmZsb29yKDEwMDAwMDAwMDAwMDAwICogTWF0aC5yYW5kb20oKSksIHMgPSByLmdldFllYXIoKSwgYyA9IChzID0gJ3Q9JyArIHQuZXNjYXBlKHIuZ2V0RGF0ZSgpICsgJy8nICsgci5nZXRNb250aCgpICsgJy8nICsgKDE5MDAgPiBzID8gcyArIDE5MDAgOiBzKSArICcgJyArIHIuZ2V0SG91cnMoKSArICc6JyArIHIuZ2V0TWludXRlcygpICsgJzonICsgci5nZXRTZWNvbmRzKCkgKyAnICcgKyByLmdldERheSgpICsgJyAnICsgci5nZXRUaW1lem9uZU9mZnNldCgpKSwgdC5UKCkpOwogICAgICAgICAgICAgICAgZSAmJiAoaSA9IHQuUyhlLCAxKSksIHQuVmIoKSAmJiAhdC52aXNpdG9yT3B0ZWRPdXQgJiYgKHQueGEoKSB8fCAodC5maWQgPSB0Lk9iKCkpLCB0LlliKCksIHQudXNlUGx1Z2lucyAmJiB0LmRvUGx1Z2lucyAmJiB0LmRvUGx1Z2lucyh0KSwgdC5hY2NvdW50ICYmICh0LmFib3J0IHx8ICh0LnRyYWNrT2ZmbGluZSAmJiAhdC50aW1lc3RhbXAgJiYgKHQudGltZXN0YW1wID0gTWF0aC5mbG9vcihyLmdldFRpbWUoKSAvIDEwMDApKSwgZSA9IG4ubG9jYXRpb24sIHQucGFnZVVSTCB8fCAodC5wYWdlVVJMID0gZS5ocmVmID8gZS5ocmVmIDogZSksIHQucmVmZXJyZXIgfHwgdC4kYSB8fCAoZSA9IHQuVXRpbC5nZXRRdWVyeVBhcmFtKCdhZG9iZV9tY19yZWYnLCBudWxsLCBudWxsLCAhMCksIHQucmVmZXJyZXIgPSBlIHx8IHZvaWQgMCA9PT0gZSA/IHZvaWQgMCA9PT0gZSA/ICcnIDogZSA6IG8uZG9jdW1lbnQucmVmZXJyZXIpLCB0LiRhID0gMSwgIXQucmVmZXJyZXIgJiYgdC5aICYmICh0LnJlZmVycmVyID0gdC5aKSwgdC5aID0gMCwgdC5yZWZlcnJlciA9IHQuTWIodC5yZWZlcnJlciksIHQudSgnX2cnKSksIHQuUmIoKSAmJiAhdC5hYm9ydCAmJiAoYyAmJiB0LlYoJ1RBUkdFVCcpICYmICF0LnN1cHBsZW1lbnRhbERhdGFJRCAmJiBjLmdldFN1cHBsZW1lbnRhbERhdGFJRCAmJiAodC5zdXBwbGVtZW50YWxEYXRhSUQgPSBjLmdldFN1cHBsZW1lbnRhbERhdGFJRCgnQXBwTWVhc3VyZW1lbnQ6JyArIHQuX2luLCAhdC5leHBlY3RTdXBwbGVtZW50YWxEYXRhKSksIHQuVignQUFNJykgfHwgKHQuY29udGV4dERhdGFbJ2NtLnNzZiddID0gMSksIHQuU2IoKSwgdC53YigpLCBzICs9IHQuUWIoKSwgdC5zYihhLCBzKSwgdC51KCdfdCcpLCB0LnJlZmVycmVyID0gJycpKSksIHQucmVmZXJyZXIgJiYgKHQuWiA9IHQucmVmZXJyZXIpLCB0LkRhKCksIGkgJiYgdC5TKGksIDEpOwogICAgICAgICAgICB9LCB0LnQgPSB0LnRyYWNrID0gZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgIG4gJiYgdC5TKG4pLCB0LlkgPSAhMCwgdC5pc1JlYWR5VG9UcmFjaygpID8gbnVsbCAhPSB0LmogJiYgMCA8IHQuai5sZW5ndGggPyAodC51YShlKSwgdC5wKCkpIDogdC5GYShlKSA6IHQudWEoZSk7CiAgICAgICAgICAgIH0sIHQud2IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0LndyaXRlU2VjdXJlQ29va2llcyAmJiAhdC5zc2wgJiYgdC5hYigpOwogICAgICAgICAgICB9LCB0LmFiID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdC5jb250ZXh0RGF0YS5leGNDb2RlcyA9IHQuY29udGV4dERhdGEuZXhjQ29kZXMgPyB0LmNvbnRleHREYXRhLmV4Y0NvZGVzIDogW10sIHQuY29udGV4dERhdGEuZXhjQ29kZXMucHVzaCgxKTsKICAgICAgICAgICAgfSwgdC5EYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHQuYWJvcnQgPSB0LnN1cHBsZW1lbnRhbERhdGFJRCA9IHQudGltZXN0YW1wID0gdC5wYWdlVVJMUmVzdCA9IHQubGlua09iamVjdCA9IHQuY2xpY2tPYmplY3QgPSB0LmxpbmtVUkwgPSB0LmxpbmtOYW1lID0gdC5saW5rVHlwZSA9IG4uc19vYmplY3RJRCA9IHQucGUgPSB0LnBldjEgPSB0LnBldjIgPSB0LnBldjMgPSB0LmUgPSB0LmxpZ2h0UHJvZmlsZUlEID0gdC51c2VCZWFjb24gPSB0LnJlZmVycmVyID0gMCwgdC5jb250ZXh0RGF0YSAmJiB0LmNvbnRleHREYXRhLmV4Y0NvZGVzICYmICh0LmNvbnRleHREYXRhLmV4Y0NvZGVzID0gMCk7CiAgICAgICAgICAgIH0sIHQuQ2EgPSBbXSwgdC5yZWdpc3RlclByZVRyYWNrQ2FsbGJhY2sgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IFtdLCBpID0gMTsgaSA8IGFyZ3VtZW50cy5sZW5ndGg7IGkrKykKICAgICAgICAgICAgICAgICAgICBuLnB1c2goYXJndW1lbnRzW2ldKTsKICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT0gdHlwZW9mIGUgPyB0LkNhLnB1c2goWwogICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgXSkgOiB0LmRlYnVnVHJhY2tpbmcgJiYgdC5DKCdERUJVRzogTm9uIGZ1bmN0aW9uIHR5cGUgcGFzc2VkIHRvIHJlZ2lzdGVyUHJlVHJhY2tDYWxsYmFjaycpOwogICAgICAgICAgICB9LCB0LmhiID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHQudmEodC5DYSwgZSk7CiAgICAgICAgICAgIH0sIHQuQmEgPSBbXSwgdC5yZWdpc3RlclBvc3RUcmFja0NhbGxiYWNrID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBbXSwgaSA9IDE7IGkgPCBhcmd1bWVudHMubGVuZ3RoOyBpKyspCiAgICAgICAgICAgICAgICAgICAgbi5wdXNoKGFyZ3VtZW50c1tpXSk7CiAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiBlID8gdC5CYS5wdXNoKFsKICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgIG4KICAgICAgICAgICAgICAgIF0pIDogdC5kZWJ1Z1RyYWNraW5nICYmIHQuQygnREVCVUc6IE5vbiBmdW5jdGlvbiB0eXBlIHBhc3NlZCB0byByZWdpc3RlclBvc3RUcmFja0NhbGxiYWNrJyk7CiAgICAgICAgICAgIH0sIHQuZ2IgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgdC52YSh0LkJhLCBlKTsKICAgICAgICAgICAgfSwgdC52YSA9IGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBlLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZVtpXVswXSwgYSA9IGVbaV1bMV0uc2xpY2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEudW5zaGlmdChuKSwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5hcHBseShudWxsLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmRlYnVnVHJhY2tpbmcgJiYgdC5DKGUubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LCB0LnRsID0gdC50cmFja0xpbmsgPSBmdW5jdGlvbiAoZSwgbiwgaSwgciwgYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIHQubGlua09iamVjdCA9IGUsIHQubGlua1R5cGUgPSBuLCB0LmxpbmtOYW1lID0gaSwgYSAmJiAodC5ib2R5Q2xpY2tUYXJnZXQgPSBlLCB0LmJvZHlDbGlja0Z1bmN0aW9uID0gYSksIHQudHJhY2socik7CiAgICAgICAgICAgIH0sIHQudHJhY2tMaWdodCA9IGZ1bmN0aW9uIChlLCBuLCBpLCByKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdC5saWdodFByb2ZpbGVJRCA9IGUsIHQubGlnaHRTdG9yZUZvclNlY29uZHMgPSBuLCB0LmxpZ2h0SW5jcmVtZW50QnkgPSBpLCB0LnRyYWNrKHIpOwogICAgICAgICAgICB9LCB0LmNsZWFyVmFycyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBlLCBuOwogICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IHQuZy5sZW5ndGg7IGUrKykKICAgICAgICAgICAgICAgICAgICAoJ3Byb3AnID09IChuID0gdC5nW2VdKS5zdWJzdHJpbmcoMCwgNCkgfHwgJ2VWYXInID09IG4uc3Vic3RyaW5nKDAsIDQpIHx8ICdoaWVyJyA9PSBuLnN1YnN0cmluZygwLCA0KSB8fCAnbGlzdCcgPT0gbi5zdWJzdHJpbmcoMCwgNCkgfHwgJ2NoYW5uZWwnID09IG4gfHwgJ2V2ZW50cycgPT0gbiB8fCAnZXZlbnRMaXN0JyA9PSBuIHx8ICdwcm9kdWN0cycgPT0gbiB8fCAncHJvZHVjdExpc3QnID09IG4gfHwgJ3B1cmNoYXNlSUQnID09IG4gfHwgJ3RyYW5zYWN0aW9uSUQnID09IG4gfHwgJ3N0YXRlJyA9PSBuIHx8ICd6aXAnID09IG4gfHwgJ2NhbXBhaWduJyA9PSBuKSAmJiAodFtuXSA9IHZvaWQgMCk7CiAgICAgICAgICAgIH0sIHQudGFnQ29udGFpbmVyTWFya2VyID0gJycsIHQuc2IgPSBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgdmFyIGkgPSB0LmliKCkgKyAnLycgKyBlICsgJz9BUUI9MSZuZGg9MSZwZj0xJicgKyAodC56YSgpID8gJ2NhbGxiYWNrPXNfY19pbFsnICsgdC5faW4gKyAnXS5kb1Bvc3RiYWNrcyZldD0xJicgOiAnJykgKyBuICsgJyZBUUU9MSc7CiAgICAgICAgICAgICAgICB0LmhiKGkpLCB0LmZiKGkpLCB0LlUoKTsKICAgICAgICAgICAgfSwgdC5pYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBlID0gdC5qYigpOwogICAgICAgICAgICAgICAgcmV0dXJuICdodHRwJyArICh0LnNzbCA/ICdzJyA6ICcnKSArICc6Ly8nICsgZSArICcvYi9zcy8nICsgdC5hY2NvdW50ICsgJy8nICsgKHQubW9iaWxlID8gJzUuJyA6ICcnKSArICh0LnphKCkgPyAnMTAnIDogJzEnKSArICcvSlMtJyArIHQudmVyc2lvbiArICh0LmFjID8gJ1QnIDogJycpICsgKHQudGFnQ29udGFpbmVyTWFya2VyID8gJy0nICsgdC50YWdDb250YWluZXJNYXJrZXIgOiAnJyk7CiAgICAgICAgICAgIH0sIHQuemEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdC5BdWRpZW5jZU1hbmFnZW1lbnQgJiYgdC5BdWRpZW5jZU1hbmFnZW1lbnQuaXNSZWFkeSgpIHx8IDAgIT0gdC51c2VQb3N0YmFja3M7CiAgICAgICAgICAgIH0sIHQuamIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgZSA9IHQuZGMsIG4gPSB0LnRyYWNraW5nU2VydmVyOwogICAgICAgICAgICAgICAgcmV0dXJuIG4gPyB0LnRyYWNraW5nU2VydmVyU2VjdXJlICYmIHQuc3NsICYmIChuID0gdC50cmFja2luZ1NlcnZlclNlY3VyZSkgOiAoJ2QxJyA9PSAoZSA9IGUgPyAoJycgKyBlKS50b0xvd2VyQ2FzZSgpIDogJ2QxJykgPyBlID0gJzExMicgOiAnZDInID09IGUgJiYgKGUgPSAnMTIyJyksIG4gPSB0LmxiKCkgKyAnLicgKyBlICsgJy4ybzcubmV0JyksIG47CiAgICAgICAgICAgIH0sIHQubGIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgZSA9IHQudmlzaXRvck5hbWVzcGFjZTsKICAgICAgICAgICAgICAgIHJldHVybiBlIHx8IChlID0gKGUgPSB0LmFjY291bnQuc3BsaXQoJywnKVswXSkucmVwbGFjZSgvW14wLTlhLXpdL2dpLCAnJykpLCBlOwogICAgICAgICAgICB9LCB0LlphID0gL3soJT8pKC4qPykoJT8pfS8sIHQuZ2MgPSBSZWdFeHAodC5aYS5zb3VyY2UsICdnJyksIHQuTGIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09IHR5cGVvZiBlLmRlc3RzKQogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgZS5kZXN0cy5sZW5ndGg7ICsrbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUuZGVzdHNbbl07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgaS5jICYmICdhYS4nID09IGkuaWQuc3Vic3RyKDAsIDMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IGkuYy5tYXRjaCh0LmdjKSwgYSA9IDA7IGEgPCByLmxlbmd0aDsgKythKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSByW2FdLCBvID0gcy5tYXRjaCh0LlphKSwgYyA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICclJyA9PSBvWzFdICYmICd0aW1lem9uZV9vZmZzZXQnID09IG9bMl0gPyBjID0gbmV3IERhdGUoKS5nZXRUaW1lem9uZU9mZnNldCgpIDogJyUnID09IG9bMV0gJiYgJ3RpbWVzdGFtcHonID09IG9bMl0gJiYgKGMgPSB0LlBiKCkpLCBpLmMgPSBpLmMucmVwbGFjZShzLCB0LmVzY2FwZShjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LCB0LlBiID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGUgPSBuZXcgRGF0ZSgpLCBuID0gbmV3IERhdGUoNjAwMDAgKiBNYXRoLmFicyhlLmdldFRpbWV6b25lT2Zmc2V0KCkpKTsKICAgICAgICAgICAgICAgIHJldHVybiB0LmsoNCwgZS5nZXRGdWxsWWVhcigpKSArICctJyArIHQuaygyLCBlLmdldE1vbnRoKCkgKyAxKSArICctJyArIHQuaygyLCBlLmdldERhdGUoKSkgKyAnVCcgKyB0LmsoMiwgZS5nZXRIb3VycygpKSArICc6JyArIHQuaygyLCBlLmdldE1pbnV0ZXMoKSkgKyAnOicgKyB0LmsoMiwgZS5nZXRTZWNvbmRzKCkpICsgKDAgPCBlLmdldFRpbWV6b25lT2Zmc2V0KCkgPyAnLScgOiAnKycpICsgdC5rKDIsIG4uZ2V0VVRDSG91cnMoKSkgKyAnOicgKyB0LmsoMiwgbi5nZXRVVENNaW51dGVzKCkpOwogICAgICAgICAgICB9LCB0LmsgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgcmV0dXJuIChBcnJheShlICsgMSkuam9pbigwKSArIHQpLnNsaWNlKC1lKTsKICAgICAgICAgICAgfSwgdC5xYSA9IHt9LCB0LmRvUG9zdGJhY2tzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICBpZiAodC5MYihlKSwgJ29iamVjdCcgPT0gdHlwZW9mIHQuQXVkaWVuY2VNYW5hZ2VtZW50ICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIHQuQXVkaWVuY2VNYW5hZ2VtZW50LmlzUmVhZHkgJiYgdC5BdWRpZW5jZU1hbmFnZW1lbnQuaXNSZWFkeSgpICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIHQuQXVkaWVuY2VNYW5hZ2VtZW50LnBhc3NEYXRhKQogICAgICAgICAgICAgICAgICAgICAgICB0LkF1ZGllbmNlTWFuYWdlbWVudC5wYXNzRGF0YShlKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgnb2JqZWN0JyA9PSB0eXBlb2YgZSAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgZS5kZXN0cykKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCBlLmRlc3RzLmxlbmd0aDsgKytuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUuZGVzdHNbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb2JqZWN0JyA9PSB0eXBlb2YgaSAmJiAnc3RyaW5nJyA9PSB0eXBlb2YgaS5jICYmICdzdHJpbmcnID09IHR5cGVvZiBpLmlkICYmICdhYS4nID09IGkuaWQuc3Vic3RyKDAsIDMpICYmICh0LnFhW2kuaWRdID0gbmV3IEltYWdlKCksIHQucWFbaS5pZF0uYWx0ID0gJycsIHQucWFbaS5pZF0uc3JjID0gaS5jKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LCB0LmZiID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHQuaSB8fCB0LlRiKCksIHQuaS5wdXNoKGUpLCB0LmphID0gdC5BKCksIHQuWWEoKTsKICAgICAgICAgICAgfSwgdC5UYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHQuaSA9IHQuV2IoKSwgdC5pIHx8ICh0LmkgPSBbXSk7CiAgICAgICAgICAgIH0sIHQuV2IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgZSwgaTsKICAgICAgICAgICAgICAgIGlmICh0LnBhKCkpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAoaSA9IG4ubG9jYWxTdG9yYWdlLmdldEl0ZW0odC5uYSgpKSkgJiYgKGUgPSBuLkpTT04ucGFyc2UoaSkpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sIHQucGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgZSA9ICEwOwogICAgICAgICAgICAgICAgcmV0dXJuIHQudHJhY2tPZmZsaW5lICYmIHQub2ZmbGluZUZpbGVuYW1lICYmIG4ubG9jYWxTdG9yYWdlICYmIG4uSlNPTiB8fCAoZSA9ICExKSwgZTsKICAgICAgICAgICAgfSwgdC5PYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBlID0gMDsKICAgICAgICAgICAgICAgIHJldHVybiB0LmkgJiYgKGUgPSB0LmkubGVuZ3RoKSwgdC5sICYmIGUrKywgZTsKICAgICAgICAgICAgfSwgdC5VID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKCF0LmwgfHwgKHQudiAmJiB0LnYuY29tcGxldGUgJiYgdC52LkQgJiYgdC52LlIoKSwgIXQubCkpCiAgICAgICAgICAgICAgICAgICAgaWYgKHQuUGEgPSBpLCB0Lm9hKQogICAgICAgICAgICAgICAgICAgICAgICB0LmphID4gdC5OICYmIHQuV2EodC5pKSwgdC5yYSg1MDApOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHQuRmIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgMCA8IGUgPyB0LnJhKGUpIDogKGUgPSB0Lk1hKCkpICYmICh0LmwgPSAxLCB0LlhiKGUpLCB0LiRiKGUpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sIHQucmEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgdC5QYSB8fCAoZSB8fCAoZSA9IDApLCB0LlBhID0gc2V0VGltZW91dCh0LlUsIGUpKTsKICAgICAgICAgICAgfSwgdC5GYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBlOwogICAgICAgICAgICAgICAgcmV0dXJuICF0LnRyYWNrT2ZmbGluZSB8fCAwID49IHQub2ZmbGluZVRocm90dGxlRGVsYXkgPyAwIDogKGUgPSB0LkEoKSAtIHQuVWEsIHQub2ZmbGluZVRocm90dGxlRGVsYXkgPCBlID8gMCA6IHQub2ZmbGluZVRocm90dGxlRGVsYXkgLSBlKTsKICAgICAgICAgICAgfSwgdC5NYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGlmICgwIDwgdC5pLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5pLnNoaWZ0KCk7CiAgICAgICAgICAgIH0sIHQuWGIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgaWYgKHQuZGVidWdUcmFja2luZykgewogICAgICAgICAgICAgICAgICAgIHZhciBuLCBpID0gJ0FwcE1lYXN1cmVtZW50IERlYnVnOiAnICsgZTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSBlLnNwbGl0KCcmJyksIG4gPSAwOyBuIDwgZS5sZW5ndGg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgaSArPSAnXG5cdCcgKyB0LnVuZXNjYXBlKGVbbl0pOwogICAgICAgICAgICAgICAgICAgIHQuQyhpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwgdC54YSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0Lm1hcmtldGluZ0Nsb3VkVmlzaXRvcklEIHx8IHQuYW5hbHl0aWNzVmlzaXRvcklEOwogICAgICAgICAgICB9LCB0LlggPSAhMTsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIHMgPSBKU09OLnBhcnNlKCd7IngiOiJ5In0nKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgcyA9IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZm9yIChzICYmICd5JyA9PSBzLnggPyAodC5YID0gITAsIHQuVyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04ucGFyc2UoZSk7CiAgICAgICAgICAgICAgICB9KSA6IG4uJCAmJiBuLiQucGFyc2VKU09OID8gKHQuVyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uJC5wYXJzZUpTT04oZSk7CiAgICAgICAgICAgICAgICB9LCB0LlggPSAhMCkgOiB0LlcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9LCB0LiRiID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciwgYSwgczsKICAgICAgICAgICAgICAgICAgICBpZiAodC5uYihlKSAmJiAoYSA9IDEsIHIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudXNlQmVhY29uID0gITEsIG5hdmlnYXRvci5zZW5kQmVhY29uKGUpID8gci5SKCkgOiByLmhhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAhciAmJiB0LnhhKCkgJiYgMjA0NyA8IGUubGVuZ3RoICYmICh0LmJiKCkgJiYgKGEgPSAyLCByID0gbmV3IFhNTEh0dHBSZXF1ZXN0KCkpLCByICYmICh0LkF1ZGllbmNlTWFuYWdlbWVudCAmJiB0LkF1ZGllbmNlTWFuYWdlbWVudC5pc1JlYWR5KCkgfHwgMCAhPSB0LnVzZVBvc3RiYWNrcykgJiYgKHQuWCA/IHIuSGEgPSAhMCA6IHIgPSAwKSksICFyICYmIHQuZmMgJiYgKGUgPSBlLnN1YnN0cmluZygwLCAyMDQ3KSksICFyICYmIHQuZC5jcmVhdGVFbGVtZW50ICYmICgwICE9IHQudXNlUG9zdGJhY2tzIHx8IHQuQXVkaWVuY2VNYW5hZ2VtZW50ICYmIHQuQXVkaWVuY2VNYW5hZ2VtZW50LmlzUmVhZHkoKSkgJiYgKHIgPSB0LmQuY3JlYXRlRWxlbWVudCgnU0NSSVBUJykpICYmICdhc3luYycgaW4gciAmJiAoKHMgPSAocyA9IHQuZC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnSEVBRCcpKSAmJiBzWzBdID8gc1swXSA6IHQuZC5ib2R5KSA/IChyLnR5cGUgPSAndGV4dC9qYXZhc2NyaXB0Jywgci5zZXRBdHRyaWJ1dGUoJ2FzeW5jJywgJ2FzeW5jJyksIGEgPSAzKSA6IHIgPSAwKSwgciB8fCAoKHIgPSBuZXcgSW1hZ2UoKSkuYWx0ID0gJycsIHIuYWJvcnQgfHwgdm9pZCAwID09PSBuLkluc3RhbGxUcmlnZ2VyIHx8IChyLmFib3J0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgci5zcmMgPSBpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSksIHIuVmEgPSBEYXRlLm5vdygpLCByLkphID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLkQgJiYgKGNsZWFyVGltZW91dChyLkQpLCByLkQgPSAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgci5vbmxvYWQgPSByLlIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5WYSAmJiAodC5rYSA9IERhdGUubm93KCkgLSByLlZhKSwgdC5nYihlKSwgci5KYSgpLCB0LkpiKCksIHQuZGEoKSwgdC5sID0gMCwgdC5VKCksIHIuSGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLkhhID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5kb1Bvc3RiYWNrcyh0Llcoci5yZXNwb25zZVRleHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LCByLm9uYWJvcnQgPSByLm9uZXJyb3IgPSByLmhhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgci5KYSgpLCAodC50cmFja09mZmxpbmUgfHwgdC5vYSkgJiYgdC5sICYmIHQuaS51bnNoaWZ0KHQuSWIpLCB0LmwgPSAwLCB0LmphID4gdC5OICYmIHQuV2EodC5pKSwgdC5kYSgpLCB0LnJhKDUwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIub25yZWFkeXN0YXRlY2hhbmdlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgNCA9PSByLnJlYWR5U3RhdGUgJiYgKDIwMCA9PSByLnN0YXR1cyA/IHIuUigpIDogci5oYSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5VYSA9IHQuQSgpLCAxID09PSBhKQogICAgICAgICAgICAgICAgICAgICAgICByLnNlbmQoZSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoMiA9PT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgcyA9IGUuaW5kZXhPZignPycpLCBhID0gZS5zdWJzdHJpbmcoMCwgcyksIHMgPSAocyA9IGUuc3Vic3RyaW5nKHMgKyAxKSkucmVwbGFjZSgvJmNhbGxiYWNrPVthLXpBLVowLTlfLlxbXF1dKy8sICcnKSwgci5vcGVuKCdQT1NUJywgYSwgITApLCByLndpdGhDcmVkZW50aWFscyA9ICEwLCByLnNlbmQocyk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoci5zcmMgPSBlLCAzID09PSBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LlNhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnJlbW92ZUNoaWxkKHQuU2EpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBzLmZpcnN0Q2hpbGQgPyBzLmluc2VydEJlZm9yZShyLCBzLmZpcnN0Q2hpbGQpIDogcy5hcHBlbmRDaGlsZChyKSwgdC5TYSA9IHQudjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgci5EID0gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHIuRCAmJiAoci5jb21wbGV0ZSA/IHIuUigpIDogKHQudHJhY2tPZmZsaW5lICYmIHIuYWJvcnQgJiYgci5hYm9ydCgpLCByLmhhKCkpKTsKICAgICAgICAgICAgICAgICAgICB9LCA1MDAwKSwgdC5JYiA9IGUsIHQudiA9IG5bJ3NfaV8nICsgdC5yZXBsYWNlKHQuYWNjb3VudCwgJywnLCAnXycpXSA9IHIsICh0LnVzZUZvcmNlZExpbmtUcmFja2luZyAmJiB0LkogfHwgdC5ib2R5Q2xpY2tGdW5jdGlvbikgJiYgKHQuZm9yY2VkTGlua1RyYWNraW5nVGltZW91dCB8fCAodC5mb3JjZWRMaW5rVHJhY2tpbmdUaW1lb3V0ID0gMjUwKSwgdC5lYSA9IHNldFRpbWVvdXQodC5kYSwgdC5mb3JjZWRMaW5rVHJhY2tpbmdUaW1lb3V0KSk7CiAgICAgICAgICAgICAgICB9LCB0Lm5iID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICExOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuYXZpZ2F0b3Iuc2VuZEJlYWNvbiAmJiAodC5wYihlKSB8fCB0LnVzZUJlYWNvbikgJiYgKG4gPSAhMCksIHQueWIoZSkgJiYgKG4gPSAhMSksIG47CiAgICAgICAgICAgICAgICB9LCB0LnBiID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISEoZSAmJiAwIDwgZS5pbmRleE9mKCdwZT1sbmtfZScpKTsKICAgICAgICAgICAgICAgIH0sIHQueWIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiA2NDAwMCA8PSBlLmxlbmd0aDsKICAgICAgICAgICAgICAgIH0sIHQuYmIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnICE9IHR5cGVvZiBYTUxIdHRwUmVxdWVzdCAmJiAnd2l0aENyZWRlbnRpYWxzJyBpbiBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgIH0sIHQuSmIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQucGEoKSAmJiAhKHQuVGEgPiB0Lk4pKQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5sb2NhbFN0b3JhZ2UucmVtb3ZlSXRlbSh0Lm5hKCkpLCB0LlRhID0gdC5BKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdC5XYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQucGEoKSkgewogICAgICAgICAgICAgICAgICAgICAgICB0LllhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmxvY2FsU3RvcmFnZS5zZXRJdGVtKHQubmEoKSwgbi5KU09OLnN0cmluZ2lmeShlKSksIHQuTiA9IHQuQSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCB0LllhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGlmICh0LnRyYWNrT2ZmbGluZSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICgoIXQub2ZmbGluZUxpbWl0IHx8IDAgPj0gdC5vZmZsaW5lTGltaXQpICYmICh0Lm9mZmxpbmVMaW1pdCA9IDEwKTsgdC5pLmxlbmd0aCA+IHQub2ZmbGluZUxpbWl0OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuTWEoKTsKICAgICAgICAgICAgICAgIH0sIHQuZm9yY2VPZmZsaW5lID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHQub2EgPSAhMDsKICAgICAgICAgICAgICAgIH0sIHQuZm9yY2VPbmxpbmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdC5vYSA9ICExOwogICAgICAgICAgICAgICAgfSwgdC5uYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5vZmZsaW5lRmlsZW5hbWUgKyAnLScgKyB0LnZpc2l0b3JOYW1lc3BhY2UgKyB0LmFjY291bnQ7CiAgICAgICAgICAgICAgICB9LCB0LkEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBEYXRlKCkuZ2V0VGltZSgpOwogICAgICAgICAgICAgICAgfSwgdC5RYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgIT0gKGUgPSBlLnRvTG93ZXJDYXNlKCkpLmluZGV4T2YoJyMnKSAmJiAwICE9IGUuaW5kZXhPZignYWJvdXQ6JykgJiYgMCAhPSBlLmluZGV4T2YoJ29wZXJhOicpICYmIDAgIT0gZS5pbmRleE9mKCdqYXZhc2NyaXB0OicpOwogICAgICAgICAgICAgICAgfSwgdC5zZXRUYWdDb250YWluZXIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBuLCBpLCByOwogICAgICAgICAgICAgICAgICAgIGZvciAodC5hYyA9IGUsIG4gPSAwOyBuIDwgdC5faWwubGVuZ3RoOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoaSA9IHQuX2lsW25dKSAmJiAnc19sJyA9PSBpLl9jICYmIGkudGFnQ29udGFpbmVyTmFtZSA9PSBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5TKGkpLCBpLmxtcSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgaS5sbXEubGVuZ3RoOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBpLmxtcVtuXSwgdC5sb2FkTW9kdWxlKHIubik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaS5tbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgaW4gaS5tbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRbcl0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gaW4gKGUgPSB0W3JdLCByID0gaS5tbFtyXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIU9iamVjdC5wcm90b3R5cGVbbl0gJiYgKCdmdW5jdGlvbicgIT0gdHlwZW9mIHJbbl0gfHwgMCA+ICgnJyArIHJbbl0pLmluZGV4T2YoJ3NfY19pbCcpKSAmJiAoZVtuXSA9IHJbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkubW1xKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPCBpLm1tcS5sZW5ndGg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IGkubW1xW25dLCB0W3IubV0gJiYgKChlID0gdFtyLm1dKVtyLmZdICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGVbci5mXSAmJiAoci5hID8gZVtyLmZdLmFwcGx5KGUsIHIuYSkgOiBlW3IuZl0uYXBwbHkoZSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpLnRxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPCBpLnRxLmxlbmd0aDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnRyYWNrKGkudHFbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5zID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCB0LlV0aWwgPSB7CiAgICAgICAgICAgICAgICAgICAgdXJsRW5jb2RlOiB0LmVzY2FwZSwKICAgICAgICAgICAgICAgICAgICB1cmxEZWNvZGU6IHQudW5lc2NhcGUsCiAgICAgICAgICAgICAgICAgICAgY29va2llUmVhZDogdC5jb29raWVSZWFkLAogICAgICAgICAgICAgICAgICAgIGNvb2tpZVdyaXRlOiB0LmNvb2tpZVdyaXRlLAogICAgICAgICAgICAgICAgICAgIGdldFF1ZXJ5UGFyYW06IGZ1bmN0aW9uIChlLCBpLCByLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzLCBvID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpIHx8IChpID0gdC5wYWdlVVJMID8gdC5wYWdlVVJMIDogbi5sb2NhdGlvbiksIHIgPSByIHx8ICcmJywgZSAmJiBpID8gMCA+IChzID0gKGkgPSAnJyArIGkpLmluZGV4T2YoJz8nKSkgPyBvIDogKGkgPSByICsgaS5zdWJzdHJpbmcocyArIDEpICsgciwgYSAmJiAoMCA8PSBpLmluZGV4T2YociArIGUgKyByKSB8fCAwIDw9IGkuaW5kZXhPZihyICsgZSArICc9JyArIHIpKSA/IHZvaWQgMCA6ICgwIDw9IChzID0gaS5pbmRleE9mKCcjJykpICYmIChpID0gaS5zdWJzdHIoMCwgcykgKyByKSwgMCA+IChzID0gaS5pbmRleE9mKHIgKyBlICsgJz0nKSkgfHwgKDAgPD0gKHMgPSAoaSA9IGkuc3Vic3RyaW5nKHMgKyByLmxlbmd0aCArIGUubGVuZ3RoICsgMSkpLmluZGV4T2YocikpICYmIChpID0gaS5zdWJzdHJpbmcoMCwgcykpLCAwIDwgaS5sZW5ndGggJiYgKG8gPSB0LnVuZXNjYXBlKGkpKSksIG8pKSA6IG87CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBnZXRJZVZlcnNpb246IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50LmRvY3VtZW50TW9kZSA/IGRvY3VtZW50LmRvY3VtZW50TW9kZSA6IHQueWEoKSA/IDcgOiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHQuRiA9ICdzdXBwbGVtZW50YWxEYXRhSUQgdGltZXN0YW1wIGR5bmFtaWNWYXJpYWJsZVByZWZpeCB2aXNpdG9ySUQgbWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQgYW5hbHl0aWNzVmlzaXRvcklEIGF1ZGllbmNlTWFuYWdlckxvY2F0aW9uSGludCBhdXRoU3RhdGUgZmlkIHZtayB2aXNpdG9yTWlncmF0aW9uS2V5IHZpc2l0b3JNaWdyYXRpb25TZXJ2ZXIgdmlzaXRvck1pZ3JhdGlvblNlcnZlclNlY3VyZSBjaGFyU2V0IHZpc2l0b3JOYW1lc3BhY2UgY29va2llRG9tYWluUGVyaW9kcyBmcENvb2tpZURvbWFpblBlcmlvZHMgY29va2llTGlmZXRpbWUgcGFnZU5hbWUgcGFnZVVSTCBjdXN0b21lclBlcnNwZWN0aXZlIHJlZmVycmVyIGNvbnRleHREYXRhIGN1cnJlbmN5Q29kZSBsaWdodFByb2ZpbGVJRCBsaWdodFN0b3JlRm9yU2Vjb25kcyBsaWdodEluY3JlbWVudEJ5IHJldHJpZXZlTGlnaHRQcm9maWxlcyBkZWxldGVMaWdodFByb2ZpbGVzIHJldHJpZXZlTGlnaHREYXRhJy5zcGxpdCgnICcpLCB0LmcgPSB0LkYuY29uY2F0KCdwdXJjaGFzZUlEIHZhcmlhYmxlUHJvdmlkZXIgY2hhbm5lbCBzZXJ2ZXIgcGFnZVR5cGUgdHJhbnNhY3Rpb25JRCBjYW1wYWlnbiBzdGF0ZSB6aXAgZXZlbnRzIGV2ZW50czIgcHJvZHVjdHMgYXVkaWVuY2VNYW5hZ2VyQmxvYiB0bnQnLnNwbGl0KCcgJykpLCB0LmxhID0gJ3RpbWVzdGFtcCBjaGFyU2V0IHZpc2l0b3JOYW1lc3BhY2UgY29va2llRG9tYWluUGVyaW9kcyBjb29raWVMaWZldGltZSBjb250ZXh0RGF0YSBsaWdodFByb2ZpbGVJRCBsaWdodFN0b3JlRm9yU2Vjb25kcyBsaWdodEluY3JlbWVudEJ5Jy5zcGxpdCgnICcpLCB0Lk8gPSB0LmxhLnNsaWNlKDApLCB0LkdhID0gJ2FjY291bnQgYWxsQWNjb3VudHMgZGVidWdUcmFja2luZyB2aXNpdG9yIHZpc2l0b3JPcHRlZE91dCB0cmFja09mZmxpbmUgb2ZmbGluZUxpbWl0IG9mZmxpbmVUaHJvdHRsZURlbGF5IG9mZmxpbmVGaWxlbmFtZSB1c2VQbHVnaW5zIGRvUGx1Z2lucyBjb25maWdVUkwgdmlzaXRvclNhbXBsaW5nIHZpc2l0b3JTYW1wbGluZ0dyb3VwIGxpbmtPYmplY3QgY2xpY2tPYmplY3QgbGlua1VSTCBsaW5rTmFtZSBsaW5rVHlwZSB0cmFja0Rvd25sb2FkTGlua3MgdHJhY2tFeHRlcm5hbExpbmtzIHRyYWNrQ2xpY2tNYXAgdHJhY2tJbmxpbmVTdGF0cyBsaW5rTGVhdmVRdWVyeVN0cmluZyBsaW5rVHJhY2tWYXJzIGxpbmtUcmFja0V2ZW50cyBsaW5rRG93bmxvYWRGaWxlVHlwZXMgbGlua0V4dGVybmFsRmlsdGVycyBsaW5rSW50ZXJuYWxGaWx0ZXJzIHVzZUZvcmNlZExpbmtUcmFja2luZyBmb3JjZWRMaW5rVHJhY2tpbmdUaW1lb3V0IHdyaXRlU2VjdXJlQ29va2llcyB1c2VMaW5rVHJhY2tTZXNzaW9uU3RvcmFnZSB0cmFja2luZ1NlcnZlciB0cmFja2luZ1NlcnZlclNlY3VyZSBzc2wgYWJvcnQgbW9iaWxlIGRjIGxpZ2h0VHJhY2tWYXJzIG1heERlbGF5IGV4cGVjdFN1cHBsZW1lbnRhbERhdGEgdXNlQmVhY29uIHVzZVBvc3RiYWNrcyByZWdpc3RlclByZVRyYWNrQ2FsbGJhY2sgcmVnaXN0ZXJQb3N0VHJhY2tDYWxsYmFjayBib2R5Q2xpY2tUYXJnZXQgYm9keUNsaWNrRnVuY3Rpb24gQXVkaWVuY2VNYW5hZ2VtZW50Jy5zcGxpdCgnICcpLCByID0gMDsgMjUwID49IHI7IHIrKykKICAgICAgICAgICAgICAgIDc2ID4gciAmJiAodC5nLnB1c2goJ3Byb3AnICsgciksIHQuTy5wdXNoKCdwcm9wJyArIHIpKSwgdC5nLnB1c2goJ2VWYXInICsgciksIHQuTy5wdXNoKCdlVmFyJyArIHIpLCA2ID4gciAmJiB0LmcucHVzaCgnaGllcicgKyByKSwgNCA+IHIgJiYgdC5nLnB1c2goJ2xpc3QnICsgcik7CiAgICAgICAgICAgIHIgPSAncGUgcGV2MSBwZXYyIHBldjMgbGF0aXR1ZGUgbG9uZ2l0dWRlIHJlc29sdXRpb24gY29sb3JEZXB0aCBqYXZhc2NyaXB0VmVyc2lvbiBqYXZhRW5hYmxlZCBjb29raWVzRW5hYmxlZCBicm93c2VyV2lkdGggYnJvd3NlckhlaWdodCBjb25uZWN0aW9uVHlwZSBob21lcGFnZSBwYWdlVVJMUmVzdCBtYXJrZXRpbmdDbG91ZE9yZ0lEIG1zX2EnLnNwbGl0KCcgJyksIHQuZyA9IHQuZy5jb25jYXQociksIHQuRiA9IHQuRi5jb25jYXQociksIHQuc3NsID0gMCA8PSBuLmxvY2F0aW9uLnByb3RvY29sLnRvTG93ZXJDYXNlKCkuaW5kZXhPZignaHR0cHMnKSwgdC5jaGFyU2V0ID0gJ1VURi04JywgdC5jb250ZXh0RGF0YSA9IHt9LCB0LndyaXRlU2VjdXJlQ29va2llcyA9ICExLCB0Lm9mZmxpbmVUaHJvdHRsZURlbGF5ID0gMCwgdC5vZmZsaW5lRmlsZW5hbWUgPSAnQXBwTWVhc3VyZW1lbnQub2ZmbGluZScsIHQuUCA9ICdzX3NxJywgdC5VYSA9IDAsIHQuamEgPSAwLCB0Lk4gPSAwLCB0LlRhID0gMCwgdC5saW5rRG93bmxvYWRGaWxlVHlwZXMgPSAnZXhlLHppcCx3YXYsbXAzLG1vdixtcGcsYXZpLHdtdixwZGYsZG9jLGRvY3gseGxzLHhsc3gscHB0LHBwdHgnLCB0LncgPSBuLCB0LmQgPSBuLmRvY3VtZW50LCB0LmRhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdC5lYSAmJiAobi5jbGVhclRpbWVvdXQodC5lYSksIHQuZWEgPSBpKSwgdC5ib2R5Q2xpY2tUYXJnZXQgJiYgdC5KICYmIHQuYm9keUNsaWNrVGFyZ2V0LmRpc3BhdGNoRXZlbnQodC5KKSwgdC5ib2R5Q2xpY2tGdW5jdGlvbiAmJiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdC5ib2R5Q2xpY2tGdW5jdGlvbiA/IHQuYm9keUNsaWNrRnVuY3Rpb24oKSA6IHQuYm9keUNsaWNrVGFyZ2V0ICYmIHQuYm9keUNsaWNrVGFyZ2V0LmhyZWYgJiYgKHQuZC5sb2NhdGlvbiA9IHQuYm9keUNsaWNrVGFyZ2V0LmhyZWYpKSwgdC5ib2R5Q2xpY2tUYXJnZXQgPSB0LkogPSB0LmJvZHlDbGlja0Z1bmN0aW9uID0gMDsKICAgICAgICAgICAgfSwgdC5YYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHQuYiA9IHQuZC5ib2R5LCB0LmIgPyAodC5yID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgaSwgciwgYSwgcywgbzsKICAgICAgICAgICAgICAgICAgICBpZiAoISh0LmQgJiYgdC5kLmdldEVsZW1lbnRCeUlkKCdjcHBYWWN0bnInKSB8fCBlICYmIGVbJ3NfZmVfJyArIHQuX2luXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuSWEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdC51c2VGb3JjZWRMaW5rVHJhY2tpbmcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYi5yZW1vdmVFdmVudExpc3RlbmVyKCdjbGljaycsIHQuciwgITApLCB2b2lkICh0LklhID0gdC51c2VGb3JjZWRMaW5rVHJhY2tpbmcgPSAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuYi5yZW1vdmVFdmVudExpc3RlbmVyKCdjbGljaycsIHQuciwgITEpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudXNlRm9yY2VkTGlua1RyYWNraW5nID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgdC5jbGlja09iamVjdCA9IGUuc3JjRWxlbWVudCA/IGUuc3JjRWxlbWVudCA6IGUudGFyZ2V0OwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0LmNsaWNrT2JqZWN0IHx8IHQuTSAmJiB0Lk0gPT0gdC5jbGlja09iamVjdCB8fCAhKHQuY2xpY2tPYmplY3QudGFnTmFtZSB8fCB0LmNsaWNrT2JqZWN0LnBhcmVudEVsZW1lbnQgfHwgdC5jbGlja09iamVjdC5wYXJlbnROb2RlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmNsaWNrT2JqZWN0ID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gdC5NID0gdC5jbGlja09iamVjdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5pYSAmJiAoY2xlYXJUaW1lb3V0KHQuaWEpLCB0LmlhID0gMCksIHQuaWEgPSBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuTSA9PSBjICYmICh0Lk0gPSAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTAwMDApLCBhID0gdC5PYSgpLCB0LnRyYWNrKCksIGEgPCB0Lk9hKCkgJiYgdC51c2VGb3JjZWRMaW5rVHJhY2tpbmcgJiYgZS50YXJnZXQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChzID0gZS50YXJnZXQ7IHMgJiYgcyAhPSB0LmIgJiYgJ0EnICE9IHMudGFnTmFtZS50b1VwcGVyQ2FzZSgpICYmICdBUkVBJyAhPSBzLnRhZ05hbWUudG9VcHBlckNhc2UoKTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gcy5wYXJlbnROb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocyAmJiAobyA9IHMuaHJlZiwgdC5RYShvKSB8fCAobyA9IDApLCByID0gcy50YXJnZXQsIGUudGFyZ2V0LmRpc3BhdGNoRXZlbnQgJiYgbyAmJiAoIXIgfHwgJ19zZWxmJyA9PSByIHx8ICdfdG9wJyA9PSByIHx8ICdfcGFyZW50JyA9PSByIHx8IG4ubmFtZSAmJiByID09IG4ubmFtZSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSB0LmQuY3JlYXRlRXZlbnQoJ01vdXNlRXZlbnRzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IG5ldyBuLk1vdXNlRXZlbnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5pbml0TW91c2VFdmVudCgnY2xpY2snLCBlLmJ1YmJsZXMsIGUuY2FuY2VsYWJsZSwgZS52aWV3LCBlLmRldGFpbCwgZS5zY3JlZW5YLCBlLnNjcmVlblksIGUuY2xpZW50WCwgZS5jbGllbnRZLCBlLmN0cmxLZXksIGUuYWx0S2V5LCBlLnNoaWZ0S2V5LCBlLm1ldGFLZXksIGUuYnV0dG9uLCBlLnJlbGF0ZWRUYXJnZXQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJiYgKGlbJ3NfZmVfJyArIHQuX2luXSA9IGkuc19mZSA9IDEsIGUuc3RvcFByb3BhZ2F0aW9uKCksIGUuc3RvcEltbWVkaWF0ZVByb3BhZ2F0aW9uICYmIGUuc3RvcEltbWVkaWF0ZVByb3BhZ2F0aW9uKCksIGUucHJldmVudERlZmF1bHQoKSwgdC5ib2R5Q2xpY2tUYXJnZXQgPSBlLnRhcmdldCwgdC5KID0gaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuY2xpY2tPYmplY3QgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdC5iICYmIHQuYi5hdHRhY2hFdmVudCA/IHQuYi5hdHRhY2hFdmVudCgnb25jbGljaycsIHQucikgOiB0LmIgJiYgdC5iLmFkZEV2ZW50TGlzdGVuZXIgJiYgKG5hdmlnYXRvciAmJiAoMCA8PSBuYXZpZ2F0b3IudXNlckFnZW50LmluZGV4T2YoJ1dlYktpdCcpICYmIHQuZC5jcmVhdGVFdmVudCB8fCAwIDw9IG5hdmlnYXRvci51c2VyQWdlbnQuaW5kZXhPZignRmlyZWZveC8yJykgJiYgbi5Nb3VzZUV2ZW50KSAmJiAodC5JYSA9IDEsIHQudXNlRm9yY2VkTGlua1RyYWNraW5nID0gMSwgdC5iLmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgdC5yLCAhMCkpLCB0LmIuYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCB0LnIsICExKSkpIDogc2V0VGltZW91dCh0LlhhLCAzMCk7CiAgICAgICAgICAgIH0sIHQuZmMgPSB0LnlhKCksIHQuS2IoKSwgdC5tYyB8fCAoZSA/IHQuc2V0QWNjb3VudChlKSA6IHQuQygnRXJyb3IsIG1pc3NpbmcgUmVwb3J0IFN1aXRlIElEIGluIEFwcE1lYXN1cmVtZW50IGluaXRpYWxpemF0aW9uJyksIHQuWGEoKSwgdC5sb2FkTW9kdWxlKCdBY3Rpdml0eU1hcCcpKTsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gJF9fX3Zhcl9lNzlmMzJjOTgzOTRlODJhKGUpIHsKICAgICAgICAgICAgdmFyIHQsIG4sIGksIHIsIGEsIHMgPSB3aW5kb3cuc19jX2lsLCBvID0gZS5zcGxpdCgnLCcpLCBjID0gMDsKICAgICAgICAgICAgaWYgKHMpCiAgICAgICAgICAgICAgICBmb3IgKG4gPSAwOyAhYyAmJiBuIDwgcy5sZW5ndGg7KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdzX2MnID09ICh0ID0gc1tuXSkuX2MgJiYgKHQuYWNjb3VudCB8fCB0Lm91bikpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmFjY291bnQgJiYgdC5hY2NvdW50ID09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gdC5hY2NvdW50ID8gdC5hY2NvdW50IDogdC5vdW4sIGkgPSB0LmFsbEFjY291bnRzID8gdC5hbGxBY2NvdW50cyA6IGkuc3BsaXQoJywnKSwgciA9IDA7IHIgPCBvLmxlbmd0aDsgcisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IDA7IGEgPCBpLmxlbmd0aDsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvW3JdID09IGlbYV0gJiYgKGMgPSAxKTsKICAgICAgICAgICAgICAgICAgICBuKys7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBjID8gdC5zZXRBY2NvdW50ICYmIHQuc2V0QWNjb3VudChlKSA6IHQgPSBuZXcgQXBwTWVhc3VyZW1lbnQoZSksIHQ7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uICRfX192YXJfMDhjNDVmMTcyYmRlMzhmZCgpIHsKICAgICAgICAgICAgdmFyIGUsIHQsIG4sIGkgPSB3aW5kb3csIHIgPSBpLnNfZ2lxOwogICAgICAgICAgICBpZiAocikKICAgICAgICAgICAgICAgIGZvciAoZSA9IDA7IGUgPCByLmxlbmd0aDsgZSsrKQogICAgICAgICAgICAgICAgICAgIChuID0gc19naSgodCA9IHJbZV0pLm91bikpLnNldEFjY291bnQodC51biksIG4uc2V0VGFnQ29udGFpbmVyKHQudGFnQ29udGFpbmVyTmFtZSk7CiAgICAgICAgICAgIGkuc19naXEgPSAwOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyXzkyMDYyOTJjYmZmZjc5MjkoKSB7CiAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyA9PSB0eXBlb2YgcGdMdmwpIHsKICAgICAgICAgICAgICAgIGZkeF9nZXRMaW5rVmlldygpLCAodm9pZCAwID09PSBzLnBhZ2VOYW1lIHx8ICcnID09IHMucGFnZU5hbWUpICYmIChfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpwYWdlIG5hbWUnKSwgMSkgJiYgX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6cGFnZSBuYW1lJykgJiYgKHMucGFnZU5hbWUgPSBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpwYWdlIG5hbWUnKSksIHMucGFnZU5hbWUgPSBzLnBhZ2VOYW1lLnRvTG93ZXJDYXNlKCksIHZvaWQgMCAhPT0gcy5lVmFyNDMgJiYgJycgIT0gcy5lVmFyNDMgfHwgKHMuZVZhcjQzID0gJ1A6JyArIHMucGFnZU5hbWUpLCBzLnByb3A0MyA9ICdEPXY0Myc7CiAgICAgICAgICAgICAgICB2YXIgZSA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoJ2JyaWdodGNvdmUtY29udGFpbmVyJyk7CiAgICAgICAgICAgICAgICBzLmVWYXIzMSA9IGUubGVuZ3RoOwogICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9ICcnLCBuID0gMDsgbiA8IGUubGVuZ3RoOyBuKyspCiAgICAgICAgICAgICAgICAgICAgcy5lVmFyMzEgKz0gJ3wnICsgZVtuXS5nZXRBdHRyaWJ1dGUoJ2RhdGEtdmlkZW8taWQnKSwgdCA9ICdldmVudDIwMic7CiAgICAgICAgICAgICAgICBzLmxpbmtUcmFja0V2ZW50cyA9IHMuZXZlbnRzID0gcy5hcGwocy5ldmVudHMsIHQsICcsJywgMik7CiAgICAgICAgICAgICAgICB2YXIgaSA9IGZkeF9nZXRDb29raWUoJ3hhY2MnKS50b0xvd2VyQ2FzZSgpLCByID0gZmR4X2dldENvb2tpZSgnZmR4X2xvY2FsZScpLnRvTG93ZXJDYXNlKCkuc3BsaXQoJ18nKSwgYSA9IGZkeF9nZXRDb29raWUoJ2ZkeF9nZW9fc2VsZWN0Jyk7CiAgICAgICAgICAgICAgICBmZHhfZ2V0Q29va2llKCdmZHhfZ2VvX2hpZGUnKSAhPT0gclsxXSAmJiBpICE9PSByWzFdICYmIGEgIT09IHJbMV0gJiYgKHMubGlua1RyYWNrRXZlbnRzID0gcy5ldmVudHMgPSAnZXZlbnQ5MDQnKTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBmZHhfZ2V0Q29va2llKCdmZHhfZGVidWcnKTsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPCBvLnNwbGl0KCcsJykubGVuZ3RoOyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gJ0RCR18nICsgby5zcGxpdCgnLCcpW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IChjID0gYy5zcGxpdCgnfCcpLnNsaWNlKDEpLmpvaW4oJ3wnKSkuc3Vic3RyaW5nKDAsIE1hdGgubWluKDI1NSwgYy5sZW5ndGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBzLmV2ZW50cyA9IHMuYXBsKHMuZXZlbnRzLCAnZXZlbnQxMDAnLCAnLCcsIDIpLCBmZHhfc2V0Q29va2llKCdmZHhfZGVidWcnLCAnJywgLTEsICcvJywgJy5mZWRleC5jb20nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZmR4X2RlYnVnKGUsICdTQycsICdmZHhfcnVuU0NvZGU6bG9nIGRlYnVnIGVycm9ycycpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcy5lVmFyNjAgPSBzLlV0aWwuZ2V0UXVlcnlQYXJhbSgnZXRfcmlkJyksIHMuZVZhcjYwID0gcy5nZXRWYWxPbmNlKHMuZVZhcjYwLCAnc19ldHJpZCcsIDApOwogICAgICAgICAgICAgICAgdmFyIGwgPSBzLmNfcignc19ldHJpZCcpOwogICAgICAgICAgICAgICAgd2luZG93LnNjX3NfZXRyaWQgPSAnJywgbnVsbCAhPSBsICYmICcnICE9PSBsID8gKHMuZ2V0QW5kUGVyc2lzdFZhbHVlKGwsICdzY19zX2V0cmlkJywgOTApLCB3aW5kb3cuc2Nfc19ldHJpZCA9IGwpIDogd2luZG93LnNjX3NfZXRyaWQgPSBzLmNfcignc2Nfc19ldHJpZCcpLCBzLmVWYXI4MCA9IHMuVXRpbC5nZXRRdWVyeVBhcmFtKCdldF9jaWQnKSwgcy5lVmFyODAgPSBzLmdldFZhbE9uY2Uocy5lVmFyODAsICdzX2V0Y2lkJywgMCk7CiAgICAgICAgICAgICAgICB2YXIgdSA9IHMuY19yKCdzX2FjeHJpZCcpOwogICAgICAgICAgICAgICAgd2luZG93LnNjX3NfYWN4cmlkID0gJycsIG51bGwgIT0gdSAmJiAnJyAhPT0gdSA/IChzLmdldEFuZFBlcnNpc3RWYWx1ZSh1LCAnc2Nfc19hY3hyaWQnLCA5MCksIHdpbmRvdy5zY19zX2FjeHJpZCA9IHUpIDogd2luZG93LnNjX3NfYWN4cmlkID0gcy5jX3IoJ3NjX3NfYWN4cmlkJyk7CiAgICAgICAgICAgICAgICB2YXIgZCA9IGZkeF9nZXRDb29raWUoJ2ZjbF91dWlkJyk7CiAgICAgICAgICAgICAgICB3aW5kb3cuc2NfZmNsX3V1aWQgPSAnJzsKICAgICAgICAgICAgICAgIHZhciBwID0gbmV3IE9iamVjdCgpOwogICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gZCB8fCBudWxsID09IGQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LnNjX2ZjbF91dWlkID0gcy5jX3IoJ3NjX2ZjbF91dWlkJyksICcnICE9PSB3aW5kb3cuc2NfZmNsX3V1aWQpCiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5zY19mY2xfdXVpZC5pbmRleE9mKCdAJykgPCAwICYmIChzLmVWYXI2ID0gd2luZG93LnNjX2ZjbF91dWlkLCBzLnByb3A2ID0gJ0Q9djYnLCBwLmZlZGV4Y3VzdGlkID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHMuZVZhcjYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdXRoU3RhdGU6IFZpc2l0b3IuQXV0aFN0YXRlLkxPR0dFRF9PVVQKICAgICAgICAgICAgICAgICAgICAgICAgfSwgcC5GM2VEeCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBzLmVWYXI2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXV0aFN0YXRlOiBWaXNpdG9yLkF1dGhTdGF0ZS5MT0dHRURfT1VUCiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHdpbmRvdy5zY19zX2V0cmlkICYmIChwLmV0X3JpZCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHdpbmRvdy5zY19zX2V0cmlkLAogICAgICAgICAgICAgICAgICAgICAgICBhdXRoU3RhdGU6IFZpc2l0b3IuQXV0aFN0YXRlLkxPR0dFRF9PVVQKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgIGQuaW5kZXhPZignQCcpIDwgMCAmJiAocy5lVmFyNiA9IGQsIHMucHJvcDYgPSAnRD12NicsIHMuZ2V0QW5kUGVyc2lzdFZhbHVlKGQsICdzY19mY2xfdXVpZCcsIDkwKSwgd2luZG93LnNjX2ZjbF91dWlkID0gZCwgcC5mZWRleGN1c3RpZCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHMuZVZhcjYsCiAgICAgICAgICAgICAgICAgICAgICAgIGF1dGhTdGF0ZTogVmlzaXRvci5BdXRoU3RhdGUuQVVUSEVOVElDQVRFRAogICAgICAgICAgICAgICAgICAgIH0sIHAuRjNlRHggPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBzLmVWYXI2LAogICAgICAgICAgICAgICAgICAgICAgICBhdXRoU3RhdGU6IFZpc2l0b3IuQXV0aFN0YXRlLkFVVEhFTlRJQ0FURUQKICAgICAgICAgICAgICAgICAgICB9KSwgd2luZG93LnNjX3NfZXRyaWQgJiYgKHAuZXRfcmlkID0gewogICAgICAgICAgICAgICAgICAgICAgICBpZDogd2luZG93LnNjX3NfZXRyaWQsCiAgICAgICAgICAgICAgICAgICAgICAgIGF1dGhTdGF0ZTogVmlzaXRvci5BdXRoU3RhdGUuQVVUSEVOVElDQVRFRAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IHMudmlzaXRvciA/IChzLnZpc2l0b3Iuc2V0Q3VzdG9tZXJJRHMocCksIHMudmlzaXRvci5fc2V0RmllbGRFeHBpcmUoJ01DQUFNQicsIC0xKSwgcy52aXNpdG9yLmdldEF1ZGllbmNlTWFuYWdlckJsb2IoKSkgOiAocy52aXNpdG9yID0gVmlzaXRvci5nZXRJbnN0YW5jZShfc2F0ZWxsaXRlLmdldFZhcignbWNvcmdJRCcpKSwgcy52aXNpdG9yLnNldEN1c3RvbWVySURzKHApLCBzLnZpc2l0b3IuX3NldEZpZWxkRXhwaXJlKCdNQ0FBTUInLCAtMSksIHMudmlzaXRvci5nZXRBdWRpZW5jZU1hbmFnZXJCbG9iKCkpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIGZkeF9kZWJ1ZyhlLCAnU0MnLCAnZmR4X3J1blNDb2RlOklEIHN5bmMgZm9yIEFBTSAnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiAkX19fdmFyXzhhYzVjN2IzMTRiOGMwNTIoKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBmZHhfaW5pdFNDVmFycygpLCBmZHhfaW5pdFBsdWdpbnMoKSwgZmR4X3J1blNDb2RlKCk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGZkeF9kZWJ1ZyhlLCAnU0MnLCAnZmR4X2luaXRTQ29kZScpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHZhciAkX19fdmFyXzI5NTgzYzA4MTkyZTQ3MWQgPSBmZHhfY3JlYXRlQ3VzdG9tRXZlbnQgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50LmNyZWF0ZUV2ZW50ID8gKHQgPSBkb2N1bWVudC5jcmVhdGVFdmVudCgnRXZlbnQnKSkuaW5pdEV2ZW50KGUsICExLCAhMSkgOiB0ID0gZSwgdDsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICBmZHhfZGVidWcoZSwgJ0NJTScsICdmZHhfY3JlYXRlQ3VzdG9tRXZlbnQnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwgJF9fX3Zhcl83YWY2NWZjOGM1YjZkOTRhID0gZmR4X2Rpc3BhdGNoQ3VzdG9tRXZlbnQgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuY3JlYXRlRXZlbnQgPyBkb2N1bWVudC5kaXNwYXRjaEV2ZW50KGUpIDogdm9pZCAwICE9PSBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnRbZV0gPyBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnRbZV0rKyA6IGRvY3VtZW50LmRvY3VtZW50RWxlbWVudFtlXSA9IDA7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZmR4X2RlYnVnKGUsICdDSU0nLCAnZmR4X2Rpc3BhdGNoQ3VzdG9tRXZlbnQnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwgJF9fX3Zhcl8wYjYwODUwNDhiNTQ5NGY4ID0gZmR4X2ZpcmVDdXN0b21FdmVudCB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGZkeF9jcmVhdGVDdXN0b21FdmVudChlKTsKICAgICAgICAgICAgICAgICAgICBmZHhfZGlzcGF0Y2hDdXN0b21FdmVudCh0KTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICBmZHhfZGVidWcoZSwgJ0NJTScsICdmZHhfZmlyZUN1c3RvbUV2ZW50Jyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sICRfX192YXJfNjY2NTlmMzM5OWRhZWQwYiA9IHsKICAgICAgICAgICAgICAgICdtYWdzLWFkZHJlc3MnOiBbCiAgICAgICAgICAgICAgICAgICAgJ2VWYXIxNTEnLAogICAgICAgICAgICAgICAgICAgICdldmVudDIxMScKICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAnbWFncy1wYWNrYWdlJzogWwogICAgICAgICAgICAgICAgICAgICdlVmFyMTUyJywKICAgICAgICAgICAgICAgICAgICAnZXZlbnQyMTInCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgJ21hZ3MtY3VzdG9tJzogWwogICAgICAgICAgICAgICAgICAgICdlVmFyMTU1JywKICAgICAgICAgICAgICAgICAgICAnZXZlbnQyMTQnCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgJ21hZ3MtcmF0ZXNkaXNwbGF5JzogWwogICAgICAgICAgICAgICAgICAgICdlVmFyMTUzJywKICAgICAgICAgICAgICAgICAgICAnZXZlbnQyMTYnCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgJ21hZ3MtcGF5bWVudCc6IFsKICAgICAgICAgICAgICAgICAgICAnZVZhcjE1NCcsCiAgICAgICAgICAgICAgICAgICAgJ2V2ZW50MjE4JwogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9OwogICAgICAgIGZkeF9jcmVhdGVDdXN0b21FdmVudCA9ICRfX192YXJfMjk1ODNjMDgxOTJlNDcxZDsKICAgICAgICBmZHhfZGlzcGF0Y2hDdXN0b21FdmVudCA9ICRfX192YXJfN2FmNjVmYzhjNWI2ZDk0YTsKICAgICAgICBmZHhfZmlyZUN1c3RvbUV2ZW50ID0gJF9fX3Zhcl8wYjYwODUwNDhiNTQ5NGY4OwogICAgICAgIE1BR1NFdmFyTWFwcGluZyA9ICRfX192YXJfNjY2NTlmMzM5OWRhZWQwYjsKICAgICAgICAhZnVuY3Rpb24gKCkgewogICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgIHZhciBlLCB0LCBuOwogICAgICAgICAgICAnZnVuY3Rpb24nICE9IHR5cGVvZiB3aW5kb3cuRElMICYmICh3aW5kb3cuRElMID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfYzVjYzBiZjI1NmZkYzhhMSA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpLCAkX19fb2xkXzQ2NWNlNzk0YzJhYjEwYWYgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYzVjYzBiZjI1NmZkYzhhMSkKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfM2QwNDliY2ZlY2Y5NWU4OS5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzQ2NWNlNzk0YzJhYjEwYWYpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzNkMDQ5YmNmZWNmOTVlODkuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGUgfHwgITAgPT09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHogfHwgKHogPSAhMCwgQS5yZWdpc3RlclJlcXVlc3QoKSwgVygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSwgciwgYSwgcywgbywgYywgbCwgdSwgZCwgcCwgZiwgZywgdiwgaCwgbSwgYiwgXywgaywgeSwgdywgeCwgRCA9IFtdLCBDID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIGUgIT09IE9iamVjdChlKSAmJiAoZSA9IHt9KSwgYSA9IGUucGFydG5lciwgcyA9IGUuY29udGFpbmVyTlNJRCwgbyA9IGUubWFwcGluZ3MsIGMgPSBlLnV1aWRDb29raWUsIGwgPSAhMCA9PT0gZS5lbmFibGVFcnJvclJlcG9ydGluZywgdSA9IGUudmlzaXRvclNlcnZpY2UsIGQgPSBlLmRlY2xhcmVkSWQsIHAgPSAhMCA9PT0gZS5kZWxheUFsbFVudGlsV2luZG93TG9hZCwgZiA9IHQoZS5zZWN1cmVEYXRhQ29sbGVjdGlvbiksIGcgPSAnYm9vbGVhbicgPT0gdHlwZW9mIGUuaXNDb29wU2FmZSA/IGUuaXNDb29wU2FmZSA6IG51bGwsIHYgPSB0KGUuZW5hYmxlSHJlZmVyZXJQYXJhbSksIGggPSB0KGUuZW5hYmxlTG9nZ2luZyksIG0gPSB0KGUuZW5hYmxlVXJsRGVzdGluYXRpb25zKSwgYiA9IHQoZS5lbmFibGVDb29raWVEZXN0aW5hdGlvbnMpLCBfID0gITAgPT09IGUuZGlzYWJsZURlZmF1bHRSZXF1ZXN0LCBrID0gZS5hZnRlclJlc3VsdEZvckRlZmF1bHRSZXF1ZXN0LCB5ID0gZS52aXNpdG9yQ29uc3RydWN0b3IsIHcgPSAhMCA9PT0gZS5kaXNhYmxlQ09SUywgeCA9ICEwID09PSBlLmlnbm9yZUhhcmREZXBlbmRlbmN5T25WaXNpdG9yQVBJLCBsICYmIERJTC5lcnJvck1vZHVsZS5hY3RpdmF0ZSgpLCB4ICYmIEQucHVzaCgnV2FybmluZzogdGhpcyBpbnN0YW5jZSBpcyBjb25maWd1cmVkIHRvIGlnbm9yZSB0aGUgaGFyZCBkZXBlbmRlbmN5IG9uIHRoZSBWaXNpdG9yQVBJIHNlcnZpY2UuIFRoaXMgbWVhbnMgdGhhdCBubyBVUkwgZGVzdGluYXRpb25zIHdpbGwgYmUgZmlyZWQgaWYgdGhlIGluc3RhbmNlIGhhcyBubyBjb25uZWN0aW9uIHRvIFZpc2l0b3JBUEkuIElmIHRoZSBWaXNpdG9yQVBJIHNlcnZpY2UgaXMgbm90IGluc3RhbnRpYXRlZCwgSUQgc3luY3Mgd2lsbCBub3QgYmUgZmlyZWQgZWl0aGVyLicpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgSSA9ICEwID09PSB3aW5kb3cuX2RpbF91bml0X3Rlc3RzOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGkgPSBhcmd1bWVudHNbMV0pICYmIEQucHVzaChpICsgJycpLCAhYSB8fCAnc3RyaW5nJyAhPSB0eXBlb2YgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIE8gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2Vycm9yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiBpID0gJ0RJTCBwYXJ0bmVyIGlzIGludmFsaWQgb3Igbm90IHNwZWNpZmllZCBpbiBpbml0Q29uZmlnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxlbmFtZTogJ2RpbC5qcycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRElMLmVycm9yTW9kdWxlLmhhbmRsZUVycm9yKE8pLCBuZXcgRXJyb3IoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPSAnRElMIGNvbnRhaW5lck5TSUQgaXMgaW52YWxpZCBvciBub3Qgc3BlY2lmaWVkIGluIGluaXRDb25maWcsIHNldHRpbmcgdG8gZGVmYXVsdCBvZiAwJywgIXMgJiYgJ251bWJlcicgIT0gdHlwZW9mIHMgfHwgKHMgPSBwYXJzZUludChzLCAxMCksICFpc05hTihzKSAmJiAwIDw9IHMgJiYgKGkgPSAnJykpLCBpICYmIChzID0gMCwgRC5wdXNoKGkpLCBpID0gJycpLCAociA9IERJTC5nZXREaWwoYSwgcykpIGluc3RhbmNlb2YgRElMICYmIHIuYXBpLmdldFBhcnRuZXIoKSA9PT0gYSAmJiByLmFwaS5nZXRDb250YWluZXJOU0lEKCkgPT09IHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIERJTCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IERJTChlLCAnRElMIHdhcyBub3QgaW5zdGFudGlhdGVkIHdpdGggdGhlIFwnbmV3XCcgb3BlcmF0b3IsIHJldHVybmluZyBhIHZhbGlkIGluc3RhbmNlIHdpdGggcGFydG5lciA9ICcgKyBhICsgJyBhbmQgY29udGFpbmVyTlNJRCA9ICcgKyBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgRElMLnJlZ2lzdGVyRGlsKHRoaXMsIGEsIHMpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgVCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2VzQ29uc29sZUxvZ0V4aXN0OiB3aW5kb3cuY29uc29sZSA9PT0gT2JqZWN0KHdpbmRvdy5jb25zb2xlKSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiB3aW5kb3cuY29uc29sZS5sb2csCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nTWVtbzoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBELnB1c2goZSksIGggJiYgdGhpcy5kb2VzQ29uc29sZUxvZ0V4aXN0ICYmIEZ1bmN0aW9uLnByb3RvdHlwZS5iaW5kLmNhbGwod2luZG93LmNvbnNvbGUubG9nLCB3aW5kb3cuY29uc29sZSkuYXBwbHkod2luZG93LmNvbnNvbGUsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dPbmNlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZ01lbW9bZV0gfHwgKHRoaXMubG9nTWVtb1tlXSA9ICEwLCBULmxvZyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgUyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19IVFRQUzogZiB8fCAnaHR0cHM6JyA9PT0gZG9jdW1lbnQubG9jYXRpb24ucHJvdG9jb2wsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU0lYX01PTlRIU19JTl9NSU5VVEVTOiAyNTkyMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSUVfVkVSU0lPTjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQuZG9jdW1lbnRNb2RlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50LmRvY3VtZW50TW9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IDc7IDQgPCBlOyBlLS0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5pbm5lckhUTUwgPSAnPCEtLVtpZiBJRSAnICsgZSArICddPjxzcGFuPjwvc3Bhbj48IVtlbmRpZl0tLT4nLCB0LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdzcGFuJykubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gbnVsbCwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIFMuSVNfSUVfTEVTU19USEFOXzEwID0gJ251bWJlcicgPT0gdHlwZW9mIFMuSUVfVkVSU0lPTiAmJiBTLklFX1ZFUlNJT04gPCAxMDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFYgPSB7IHN0dWZmZWQ6IHt9IH0sIEwgPSB7fSwgQSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJpbmdRdWV1ZTogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyZWQ6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpcmluZzogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VudDogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JlZDogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXJ2ZWRLZXlzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpZHM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZGF0YTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2RhdGE6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvc3RDYWxsYmFja0ZuOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlSW1hZ2VSZXF1ZXN0OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3RSZXF1ZXN0SGFzRmlyZWQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFib3J0UmVxdWVzdHM6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bV9vZl9jb3JzX3Jlc3BvbnNlczogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudW1fb2ZfY29yc19lcnJvcnM6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yc0Vycm9yU291cmNlczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtX29mX2ltZ19yZXNwb25zZXM6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtX29mX2ltZ19lcnJvcnM6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGxhdGZvcm1QYXJhbXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZF9uc2lkOiBzICsgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRfcnRiZDogJ2pzb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkX2pzb252OiBESUwuanNvblZlcnNpb24gKyAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZF9kc3Q6ICcxJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uTW9kU3RhdHNQYXJhbXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZF9ydGJkOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZF9kc3Q6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkX2N0czogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRfcnM6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RTdGF0c1BhcmFtczogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZG1zOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRJTUVfVE9fQ0FUQ0hfQUxMX1JFUVVFU1RTX1JFTEVBU0U6IDMwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsZWRCYWNrOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlkOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub1Zpc2l0b3JBUEk6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpc2l0b3JBUEk6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluc3RhbmNlOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWxlYXNlVHlwZTogJ25vIFZpc2l0b3JBUEknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc09wdGVkT3V0OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNPcHRlZE91dENhbGxiYWNrQ2FsbGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRtc1Byb2Nlc3NpbmdTdGFydGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2VzczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuYWRtc1Byb2Nlc3NpbmdTdGFydGVkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5hZG1zUHJvY2Vzc2luZ1N0YXJ0ZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgaSwgciA9IHU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT0gdHlwZW9mIGUgfHwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgZS5nZXRJbnN0YW5jZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgdGhpcy5ub1Zpc2l0b3JBUEkgPSAhMCwgbmV3IEVycm9yKCdWaXNpdG9yIGRvZXMgbm90IGV4aXN0LicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyICE9PSBPYmplY3QocikgfHwgISh0ID0gci5uYW1lc3BhY2UpIHx8ICdzdHJpbmcnICE9IHR5cGVvZiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyB0aGlzLnJlbGVhc2VUeXBlID0gJ25vIG5hbWVzcGFjZScsIG5ldyBFcnJvcignRElMLmNyZWF0ZSgpIG5lZWRzIHRoZSBpbml0Q29uZmlnIHByb3BlcnR5IGB2aXNpdG9yU2VydmljZWA6e25hbWVzcGFjZTpcJzxFeHBlcmllbmNlIENsb3VkIE9yZyBJRD5cJ30nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKG4gPSBlLmdldEluc3RhbmNlKHQsIHsgaWRTeW5jQ29udGFpbmVySUQ6IHMgfSkpICE9PSBPYmplY3QobikgfHwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2Ygbi5pc0FsbG93ZWQgfHwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2Ygbi5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBuLmdldEN1c3RvbWVySURzIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIG4uaXNPcHRlZE91dCB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBuLnB1Ymxpc2hEZXN0aW5hdGlvbnMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IHRoaXMucmVsZWFzZVR5cGUgPSAnaW52YWxpZCBpbnN0YW5jZScsIGkgPSAnSW52YWxpZCBWaXNpdG9yIGluc3RhbmNlLicsIG4gPT09IE9iamVjdChuKSAmJiAnZnVuY3Rpb24nICE9IHR5cGVvZiBuLnB1Ymxpc2hEZXN0aW5hdGlvbnMgJiYgKGkgKz0gJyBJbiBwYXJ0aWN1bGFyLCB2aXNpdG9ySW5zdGFuY2UucHVibGlzaERlc3RpbmF0aW9ucyBpcyBub3QgYSBmdW5jdGlvbi4gVGhpcyBpcyBuZWVkZWQgdG8gZmlyZSBVUkwgZGVzdGluYXRpb25zIGluIERJTCB2OC4wKyBhbmQgc2hvdWxkIGJlIHByZXNlbnQgaW4gVmlzaXRvciB2My4zLjArIC4nKSwgbmV3IEVycm9yKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLlZpc2l0b3JBUEkgPSBlLCAhbi5pc0FsbG93ZWQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucmVsZWFzZVR5cGUgPSAnVmlzaXRvckFQSSBpcyBub3QgYWxsb3dlZCB0byB3cml0ZSBjb29raWVzJywgdm9pZCB0aGlzLnJlbGVhc2VSZXF1ZXN0cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW5zdGFuY2UgPSBuLCB0aGlzLndhaXRGb3JNaWRUb1JlbGVhc2VSZXF1ZXN0cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgheCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdFcnJvciBpbiBwcm9jZXNzaW5nIFZpc2l0b3IgQVBJLCB3aGljaCBpcyBhIGhhcmQgZGVwZW5kZW5jeSBmb3IgRElMIHY4LjArOiAnICsgZS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJlbGVhc2VSZXF1ZXN0cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3YWl0Rm9yTWlkVG9SZWxlYXNlUmVxdWVzdHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW5zdGFuY2UgJiYgKHRoaXMuaW5zdGFuY2UuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm1pZCA9IHQsIGUucmVsZWFzZVR5cGUgPSAnVmlzaXRvckFQSScsIGUucmVsZWFzZVJlcXVlc3RzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMCksICghRi5leGlzdHMgfHwgIUYuaXNJYWJDb250ZXh0ICYmIEYuaXNBcHByb3ZlZCgpIHx8IEYuaXNJYWJDb250ZXh0ICYmIFEuaGFzR29TaWduYWwoKSkgJiYgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1Zpc2l0b3JBUEknICE9PSBlLnJlbGVhc2VUeXBlICYmIChlLnJlbGVhc2VUeXBlID0gJ3RpbWVvdXQnLCBlLnJlbGVhc2VSZXF1ZXN0cygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuZ2V0TG9hZFRpbWVvdXQoKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWxlYXNlUmVxdWVzdHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbGVkQmFjayA9ICEwLCBBLnJlZ2lzdGVyUmVxdWVzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaW5zdGFuY2UgPyB0aGlzLmluc3RhbmNlLmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEKCkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRNSURRdWVyeVN0cmluZzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBxLmlzUG9wdWxhdGVkU3RyaW5nLCB0ID0gdGhpcy5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodGhpcy5taWQpICYmIHRoaXMubWlkID09PSB0IHx8ICh0aGlzLm1pZCA9IHQpLCBlKHRoaXMubWlkKSA/ICdkX21pZD0nICsgdGhpcy5taWQgKyAnJicgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q3VzdG9tZXJJRHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmluc3RhbmNlID8gdGhpcy5pbnN0YW5jZS5nZXRDdXN0b21lcklEcygpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q3VzdG9tZXJJRHNRdWVyeVN0cmluZzogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICE9PSBPYmplY3QoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIGksIHIsIGEgPSAnJywgcyA9IFtdLCBvID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmhhc093blByb3BlcnR5KHQpICYmIChuID0gZVtvWzBdID0gdF0pID09PSBPYmplY3QobikgJiYgKG9bMV0gPSBuLmlkIHx8ICcnLCBvWzJdID0gbi5hdXRoU3RhdGUgfHwgMCwgcy5wdXNoKG8pLCBvID0gW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPSBzLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgcjsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhICs9ICcmZF9jaWRfaWM9JyArIE4uZW5jb2RlQW5kQnVpbGRSZXF1ZXN0KHNbaV0sICclMDEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRJc09wdGVkT3V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmluc3RhbmNlID8gdGhpcy5pbnN0YW5jZS5pc09wdGVkT3V0KFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaXNPcHRlZE91dENhbGxiYWNrCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCB0aGlzLlZpc2l0b3JBUEkuT3B0T3V0LkdMT0JBTCwgITApIDogKHRoaXMuaXNPcHRlZE91dCA9ICExLCB0aGlzLmlzT3B0ZWRPdXRDYWxsYmFja0NhbGxlZCA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNPcHRlZE91dENhbGxiYWNrOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pc09wdGVkT3V0ID0gZSwgdGhpcy5pc09wdGVkT3V0Q2FsbGJhY2tDYWxsZWQgPSAhMCwgQS5yZWdpc3RlclJlcXVlc3QoKSwgRi5pc0lhYkNvbnRleHQoKSAmJiBRLmNoZWNrUXVlcnlTdHJpbmdPYmplY3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TG9hZFRpbWVvdXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5pbnN0YW5jZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIGUuZ2V0TG9hZFRpbWVvdXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmdldExvYWRUaW1lb3V0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gZS5sb2FkVGltZW91dCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubG9hZFRpbWVvdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5USU1FX1RPX0NBVENIX0FMTF9SRVFVRVNUU19SRUxFQVNFOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWNsYXJlZElkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlY2xhcmVkSWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBudWxsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlY2xhcmVkSWRDb21ib3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXREZWNsYXJlZElkOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBxLmlzUG9wdWxhdGVkU3RyaW5nLCBpID0gZW5jb2RlVVJJQ29tcG9uZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IE9iamVjdChlKSAmJiBuKHQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLmRwaWQsIGEgPSBlLmRwdXVpZCwgcyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4ocikgJiYgbihhKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMgPSBpKHIpICsgJyQnICsgaShhKSwgITAgPT09IHRoaXMuZGVjbGFyZWRJZENvbWJvc1tzXSA/ICdzZXREZWNsYXJlZElkOiBjb21ibyBleGlzdHMgZm9yIHR5cGUgXCcnICsgdCArICdcJycgOiAodGhpcy5kZWNsYXJlZElkQ29tYm9zW3NdID0gITAsIHRoaXMuZGVjbGFyZWRJZFt0XSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRwaWQ6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcHV1aWQ6IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgJ3NldERlY2xhcmVkSWQ6IHN1Y2NlZWRlZCBmb3IgdHlwZSBcJycgKyB0ICsgJ1wnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3NldERlY2xhcmVkSWQ6IGZhaWxlZCBmb3IgdHlwZSBcJycgKyB0ICsgJ1wnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RGVjbGFyZWRJZFF1ZXJ5U3RyaW5nOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMuZGVjbGFyZWRJZC5yZXF1ZXN0LCB0ID0gdGhpcy5kZWNsYXJlZElkLmluaXQsIG4gPSBlbmNvZGVVUklDb21wb25lbnQsIGkgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlID8gaSA9ICcmZF9kcGlkPScgKyBuKGUuZHBpZCkgKyAnJmRfZHB1dWlkPScgKyBuKGUuZHB1dWlkKSA6IG51bGwgIT09IHQgJiYgKGkgPSAnJmRfZHBpZD0nICsgbih0LmRwaWQpICsgJyZkX2RwdXVpZD0nICsgbih0LmRwdXVpZCkpLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpc3RlclJlcXVlc3Q6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gdGhpcy5maXJpbmdRdWV1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9PT0gT2JqZWN0KGUpICYmIChuLnB1c2goZSksIGUuaXNEZWZhdWx0UmVxdWVzdCB8fCAoXyA9ICEwKSksIHRoaXMuZmlyaW5nIHx8ICFuLmxlbmd0aCB8fCBwICYmICFESUwud2luZG93TG9hZGVkIHx8ICh0aGlzLmFkbXMuaXNPcHRlZE91dENhbGxiYWNrQ2FsbGVkIHx8IHRoaXMuYWRtcy5nZXRJc09wdGVkT3V0KCksIHRoaXMuYWRtcy5jYWxsZWRCYWNrICYmICF0aGlzLmFkbXMuaXNPcHRlZE91dCAmJiB0aGlzLmFkbXMuaXNPcHRlZE91dENhbGxiYWNrQ2FsbGVkICYmIChGLmlzQXBwcm92ZWQoKSB8fCBRLmhhc0dvU2lnbmFsKCkpICYmICh0aGlzLmFkbXMuaXNPcHRlZE91dENhbGxiYWNrQ2FsbGVkID0gITEsICh0ID0gbi5zaGlmdCgpKS5zcmMgPSB0LnNyYy5yZXBsYWNlKC8mZF9uc2lkPS8sICcmJyArIHRoaXMuYWRtcy5nZXRNSURRdWVyeVN0cmluZygpICsgUS5nZXRRdWVyeVN0cmluZygpICsgJ2RfbnNpZD0nKSwgcS5pc1BvcHVsYXRlZFN0cmluZyh0LmNvcnNQb3N0RGF0YSkgJiYgKHQuY29yc1Bvc3REYXRhID0gdC5jb3JzUG9zdERhdGEucmVwbGFjZSgvXmRfbnNpZD0vLCB0aGlzLmFkbXMuZ2V0TUlEUXVlcnlTdHJpbmcoKSArIFEuZ2V0UXVlcnlTdHJpbmcoKSArICdkX25zaWQ9JykpLCBqLmZpcmVSZXF1ZXN0KHQpLCB0aGlzLmZpcnN0UmVxdWVzdEhhc0ZpcmVkIHx8ICdzY3JpcHQnICE9PSB0LnRhZyAmJiAnY29ycycgIT09IHQudGFnIHx8ICh0aGlzLmZpcnN0UmVxdWVzdEhhc0ZpcmVkID0gITApKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzVmlzaXRvckFQSTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkbXMucHJvY2Vzcyh5IHx8IHdpbmRvdy5WaXNpdG9yKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldENvb3BRdWVyeVN0cmluZzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGcgPyBlID0gJyZkX2Nvb3Bfc2FmZT0xJyA6ICExID09PSBnICYmIChlID0gJyZkX2Nvb3BfdW5zYWZlPTEnKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBDLnJlcXVlc3RDb250cm9sbGVyID0gQTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFAsIEUsIE0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VuZGluZ01lc3NhZ2VzOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZXNQb3N0ZWQ6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc3RpbmF0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzdGluYXRpb25zUG9zdGVkOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uRm9yQ29tcGFyaXNvbjogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbkR1cGxpY2F0ZXM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb25XYWl0aW5nOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uUHJvY2Vzc2VkOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoRGVzdGluYXRpb25zVmVyc2lvbjogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0VG9Qcm9jZXNzOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5qc29uRm9yQ29tcGFyaXNvbi5wdXNoKGUpLCByLmpzb25XYWl0aW5nLnB1c2goWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGksIHIgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiAhcS5pc0VtcHR5T2JqZWN0KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPSBKU09OLnN0cmluZ2lmeShlLmRlc3RzIHx8IFtdKSwgdGhpcy5qc29uRm9yQ29tcGFyaXNvbi5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgcywgbywgYyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IDAsIHMgPSB0aGlzLmpzb25Gb3JDb21wYXJpc29uLmxlbmd0aDsgYSA8IHM7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8gPSB0aGlzLmpzb25Gb3JDb21wYXJpc29uW2FdLCBpID09PSBKU09OLnN0cmluZ2lmeShvLmRlc3RzIHx8IFtdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID8gdGhpcy5qc29uRHVwbGljYXRlcy5wdXNoKGUpIDogbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5qc29uV2FpdGluZy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gdGhpcy5qc29uV2FpdGluZy5zaGlmdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzKGxbMF0sIGxbMV0pLCB0aGlzLnJlcXVlc3RUb1Byb2Nlc3MoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm1lc3NhZ2VzLmxlbmd0aCAmJiAhdGhpcy5zZW5kaW5nTWVzc2FnZXMgJiYgdGhpcy5zZW5kTWVzc2FnZXMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2Nlc3M6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgaSwgciwgYSwgcywgbyA9IGVuY29kZVVSSUNvbXBvbmVudCwgYyA9IHRoaXMuZ2V0UHVibGlzaERlc3RpbmF0aW9uc1ZlcnNpb24oKSwgbCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC0xICE9PSBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0ID0gZS5kZXN0cykgJiYgdCBpbnN0YW5jZW9mIEFycmF5ICYmIChuID0gdC5sZW5ndGgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBuOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gdFtpXSwgcyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKCdkZXN0cycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8oci5pZCB8fCAnJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyhyLnkgfHwgJycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8oci5jIHx8ICcnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5qb2luKCd8JyksIHRoaXMuYWRkTWVzc2FnZShzKSwgYSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHIuYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaWRlUmVmZXJyZXI6IHZvaWQgMCA9PT0gci5ociB8fCAhIXIuaHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5hZGREZXN0aW5hdGlvbihhKSwgdm9pZCAwICE9PSByLmhyICYmIChsID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxID09PSBjICYmIGwgJiYgVC5sb2dPbmNlKCdXYXJuaW5nOiB2aXNpdG9ySW5zdGFuY2UucHVibGlzaERlc3RpbmF0aW9ucyB2ZXJzaW9uIGlzIG9sZCAoVmlzaXRvciB2My4zLjAgdG8gdjQuMC4wKS4gVVJMIGRlc3RpbmF0aW9ucyB3aWxsIG5vdCBoYXZlIHRoZSBvcHRpb24gb2YgYmVpbmcgZmlyZWQgb24gcGFnZSwgb25seSBpbiB0aGUgaWZyYW1lLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmpzb25Qcm9jZXNzZWQucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkTWVzc2FnZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5tZXNzYWdlcy5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkRGVzdGluYXRpb246IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGVzdGluYXRpb25zLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZXM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZW5kaW5nTWVzc2FnZXMgfHwgKHRoaXMuc2VuZGluZ01lc3NhZ2VzID0gITAsIG0gJiYgdGhpcy5tZXNzYWdlcy5sZW5ndGggJiYgdGhpcy5wdWJsaXNoRGVzdGluYXRpb25zKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaERlc3RpbmF0aW9uczogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQubG9nKCd2aXNpdG9yLnB1Ymxpc2hEZXN0aW5hdGlvbnMoKSByZXN1bHQ6ICcgKyAoZS5lcnJvciB8fCBlLm1lc3NhZ2UpKSwgbi5zZW5kaW5nTWVzc2FnZXMgPSAhMSwgbi5yZXF1ZXN0VG9Qcm9jZXNzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ubWVzc2FnZXMgPSBbXSwgbi5kZXN0aW5hdGlvbnMgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMsIGkgPSBBLmFkbXMuaW5zdGFuY2UsIHIgPSBbXSwgcyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMSA9PT0gdGhpcy5wdWJsaXNoRGVzdGluYXRpb25zVmVyc2lvbiA/IChOLmV4dGVuZEFycmF5KHIsIHRoaXMubWVzc2FnZXMpLCBOLmV4dGVuZEFycmF5KHRoaXMubWVzc2FnZXNQb3N0ZWQsIHRoaXMubWVzc2FnZXMpLCB0KCksIGkucHVibGlzaERlc3RpbmF0aW9ucyhhLCByLCBlKSwgJ0NhbGxlZCB2aXNpdG9yLnB1Ymxpc2hEZXN0aW5hdGlvbnMoKSB2ZXJzaW9uIDEnKSA6IDEgPCB0aGlzLnB1Ymxpc2hEZXN0aW5hdGlvbnNWZXJzaW9uID8gKE4uZXh0ZW5kQXJyYXkocywgdGhpcy5kZXN0aW5hdGlvbnMpLCBOLmV4dGVuZEFycmF5KHRoaXMuZGVzdGluYXRpb25zUG9zdGVkLCB0aGlzLmRlc3RpbmF0aW9ucyksIHQoKSwgaS5wdWJsaXNoRGVzdGluYXRpb25zKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YmRvbWFpbjogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsRGVzdGluYXRpb25zOiBzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAnQ2FsbGVkIHZpc2l0b3IucHVibGlzaERlc3RpbmF0aW9ucygpIHZlcnNpb24gPiAxJykgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRQdWJsaXNoRGVzdGluYXRpb25zVmVyc2lvbjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gdGhpcy5wdWJsaXNoRGVzdGluYXRpb25zVmVyc2lvbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnB1Ymxpc2hEZXN0aW5hdGlvbnNWZXJzaW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IEEuYWRtcy5pbnN0YW5jZSwgdCA9IC0xOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wdWJsaXNoRGVzdGluYXRpb25zKG51bGwsIG51bGwsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9PT0gT2JqZWN0KGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmVycm9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdWJkb21haW4gaXMgbm90IGEgcG9wdWxhdGVkIHN0cmluZy4nID09PSBuID8gdCA9IDEgOiAnSW52YWxpZCBwYXJhbWV0ZXJzIHBhc3NlZC4nID09PSBuICYmICh0ID0gMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzLnB1Ymxpc2hEZXN0aW5hdGlvbnNWZXJzaW9uID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBSID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWl0czogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHEuaXNWYWxpZFBkYXRhKGUpICYmIChMLnNpZHMgaW5zdGFuY2VvZiBBcnJheSB8fCAoTC5zaWRzID0gW10pLCBOLmV4dGVuZEFycmF5KEwuc2lkcywgZSkpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcS5pc1ZhbGlkUGRhdGEoZSkgJiYgKEwucGRhdGEgaW5zdGFuY2VvZiBBcnJheSB8fCAoTC5wZGF0YSA9IFtdKSwgTi5leHRlbmRBcnJheShMLnBkYXRhLCBlKSksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcS5pc1ZhbGlkTG9nZGF0YShlKSAmJiAoTC5sb2dkYXRhICE9PSBPYmplY3QoTC5sb2dkYXRhKSAmJiAoTC5sb2dkYXRhID0ge30pLCBOLmV4dGVuZE9iamVjdChMLmxvZ2RhdGEsIGUpKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVF1ZXJ5UGFyYW1zOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcS5pc0VtcHR5T2JqZWN0KGUpIHx8IE4uZXh0ZW5kT2JqZWN0KEwsIGUsIEEucmVzZXJ2ZWRLZXlzKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpZ25hbHM6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCBpID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFxLmlzRW1wdHlPYmplY3QoaSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICYmICdzdHJpbmcnID09IHR5cGVvZiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiBpbiAoaSA9IHt9LCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoaVt0ICsgbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE4uZXh0ZW5kT2JqZWN0KEwsIGksIEEucmVzZXJ2ZWRLZXlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlY2xhcmVkSWQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBLmRlY2xhcmVkSWQuc2V0RGVjbGFyZWRJZChlLCAncmVxdWVzdCcpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZSAmJiAoTC5jYWxsYmFjayA9IGUpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWZ0ZXJSZXN1bHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09IHR5cGVvZiBlICYmIChMLnBvc3RDYWxsYmFja0ZuID0gZSksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VJbWFnZVJlcXVlc3Q6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEwudXNlSW1hZ2VSZXF1ZXN0ID0gITAsIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhckRhdGE6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEwgPSB7fSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1Ym1pdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEwuaXNEZWZhdWx0UmVxdWVzdCA9ICEhZSwgai5zdWJtaXRSZXF1ZXN0KEwpLCBMID0ge30sIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRQYXJ0bmVyOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29udGFpbmVyTlNJRDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEV2ZW50TG9nOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0U3RhdGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fSwgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTi5leHRlbmRPYmplY3QodCwgQSwgeyByZWdpc3RlclJlcXVlc3Q6ICEwIH0pLCBOLmV4dGVuZE9iamVjdChuLCBNLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0VG9Qcm9jZXNzOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2Nlc3M6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2VzOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdENvbmZpZzogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlbmRpbmdSZXF1ZXN0OiBMLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3RoZXJSZXF1ZXN0SW5mbzogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc3RpbmF0aW9uUHVibGlzaGluZ0luZm86IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2c6IEQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkU3luYzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1BsZWFzZSB1c2UgdGhlIGBpZFN5bmNCeVVSTGAgbWV0aG9kIG9mIHRoZSBFeHBlcmllbmNlIENsb3VkIElEIFNlcnZpY2UgKFZpc2l0b3IpIGluc3RhbmNlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhYW1JZFN5bmM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdQbGVhc2UgdXNlIHRoZSBgaWRTeW5jQnlEYXRhU291cmNlYCBtZXRob2Qgb2YgdGhlIEV4cGVyaWVuY2UgQ2xvdWQgSUQgU2VydmljZSAoVmlzaXRvcikgaW5zdGFuY2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhc3NEYXRhOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcS5pc0VtcHR5T2JqZWN0KGUpID8gJ0Vycm9yOiBqc29uIGlzIGVtcHR5IG9yIG5vdCBhbiBvYmplY3QnIDogKGouZGVmYXVsdENhbGxiYWNrKGUpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFBsYXRmb3JtUGFyYW1zOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBLnBsYXRmb3JtUGFyYW1zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RXZlbnRDYWxsQ29uZmlnUGFyYW1zOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0ID0gQSwgbiA9IHQubW9kU3RhdHNQYXJhbXMsIGkgPSB0LnBsYXRmb3JtUGFyYW1zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSBpbiAobiA9IHt9LCBpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmhhc093blByb3BlcnR5KGUpICYmICF0Lm5vbk1vZFN0YXRzUGFyYW1zW2VdICYmIChuW2UucmVwbGFjZSgvXmRfLywgJycpXSA9IGlbZV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgITAgPT09IGcgPyBuLmNvb3Bfc2FmZSA9IDEgOiAhMSA9PT0gZyAmJiAobi5jb29wX3Vuc2FmZSA9IDEpLCB0Lm1vZFN0YXRzUGFyYW1zID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEFzQ29vcFNhZmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcgPSAhMCwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEFzQ29vcFVuc2FmZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyA9ICExLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RXZlbnRDYWxsSWFiU2lnbmFsczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICE9PSBPYmplY3QoZSkgPyAnRXJyb3I6IGNvbmZpZyBpcyBub3QgYW4gb2JqZWN0JyA6ICdmdW5jdGlvbicgIT0gdHlwZW9mIGUuY2FsbGJhY2sgPyAnRXJyb3I6IGNvbmZpZy5jYWxsYmFjayBpcyBub3QgYSBmdW5jdGlvbicgOiAodCA9IHBhcnNlSW50KGUudGltZW91dCwgMTApLCBpc05hTih0KSAmJiAodCA9IG51bGwpLCB2b2lkIFEuZ2V0UXVlcnlTdHJpbmdPYmplY3QoZS5jYWxsYmFjaywgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGogPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yc01ldGFkYXRhOiAoUCA9ICdub25lJywgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIFhNTEh0dHBSZXF1ZXN0ICYmIFhNTEh0dHBSZXF1ZXN0ID09PSBPYmplY3QoWE1MSHR0cFJlcXVlc3QpICYmICd3aXRoQ3JlZGVudGlhbHMnIGluIG5ldyBYTUxIdHRwUmVxdWVzdCgpICYmIChQID0gJ1hNTEh0dHBSZXF1ZXN0JyksIHsgY29yc1R5cGU6IFAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q09SU0luc3RhbmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnbm9uZScgPT09IHRoaXMuY29yc01ldGFkYXRhLmNvcnNUeXBlID8gbnVsbCA6IG5ldyB3aW5kb3dbdGhpcy5jb3JzTWV0YWRhdGEuY29yc1R5cGVdKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJtaXRSZXF1ZXN0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQS5yZWdpc3RlclJlcXVlc3Qoai5jcmVhdGVRdWV1ZWRSZXF1ZXN0KGUpKSwgITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVRdWV1ZWRSZXF1ZXN0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgaSwgciwgYSwgcyA9IGUuY2FsbGJhY2ssIGMgPSAnaW1nJywgbCA9IGUuaXNEZWZhdWx0UmVxdWVzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRlbGV0ZSBlLmlzRGVmYXVsdFJlcXVlc3QsICFxLmlzRW1wdHlPYmplY3QobykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgaW4gbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoby5oYXNPd25Qcm9wZXJ0eShpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSAociA9IG9baV0pIHx8ICcnID09PSByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpIGluIGUgJiYgIShyIGluIGUpICYmICEociBpbiBBLnJlc2VydmVkS2V5cykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IChhID0gZVtpXSkgfHwgJycgPT09IGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3JdID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHEuaXNWYWxpZFBkYXRhKGUuc2lkcykgfHwgKGUuc2lkcyA9IFtdKSwgcS5pc1ZhbGlkUGRhdGEoZS5wZGF0YSkgfHwgKGUucGRhdGEgPSBbXSksIHEuaXNWYWxpZExvZ2RhdGEoZS5sb2dkYXRhKSB8fCAoZS5sb2dkYXRhID0ge30pLCBlLmxvZ2RhdGFBcnJheSA9IE4uY29udmVydE9iamVjdFRvS2V5VmFsdWVQYWlycyhlLmxvZ2RhdGEsICc9JywgITApLCBlLmxvZ2RhdGFBcnJheS5wdXNoKCdfdHM9JyArIG5ldyBEYXRlKCkuZ2V0VGltZSgpKSwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgcyAmJiAocyA9IHRoaXMuZGVmYXVsdENhbGxiYWNrKSwgdCA9IHRoaXMubWFrZVJlcXVlc3RTcmNEYXRhKGUpLCAobiA9IHRoaXMuZ2V0Q09SU0luc3RhbmNlKCkpICYmICEwICE9PSBlLnVzZUltYWdlUmVxdWVzdCAmJiAoYyA9ICdjb3JzJyksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhZzogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYzogdC5zcmMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JzU3JjOiB0LmNvcnNTcmMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFja0ZuOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zdENhbGxiYWNrRm46IGUucG9zdENhbGxiYWNrRm4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VJbWFnZVJlcXVlc3Q6ICEhZS51c2VJbWFnZVJlcXVlc3QsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0RGF0YTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnNJbnN0YW5jZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnNQb3N0RGF0YTogdC5jb3JzUG9zdERhdGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0RlZmF1bHRSZXF1ZXN0OiBsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0Q2FsbGJhY2s6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCBpLCByLCBhLCBzLCBvLCBsLCB1LCBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiAmJiAobiA9IGUuc3R1ZmYpICYmIG4gaW5zdGFuY2VvZiBBcnJheSAmJiAoaSA9IG4ubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociA9IDA7IHIgPCBpOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGEgPSBuW3JdKSAmJiBhID09PSBPYmplY3QoYSkgJiYgKHMgPSBhLmNuLCBvID0gYS5jdiwgdm9pZCAwICE9PSAobCA9IGEudHRsKSAmJiAnJyAhPT0gbCB8fCAobCA9IE1hdGguZmxvb3IoTi5nZXRNYXhDb29raWVFeHBpcmVzSW5NaW51dGVzKCkgLyA2MCAvIDI0KSksIHUgPSBhLmRtbiB8fCAnLicgKyBkb2N1bWVudC5kb21haW4ucmVwbGFjZSgvXnd3d1wuLywgJycpLCBkID0gYS50eXBlLCBzICYmIChvIHx8ICdudW1iZXInID09IHR5cGVvZiBvKSAmJiAoJ3ZhcicgIT09IGQgJiYgKGwgPSBwYXJzZUludChsLCAxMCkpICYmICFpc05hTihsKSAmJiBOLnNldENvb2tpZShzLCBvLCAyNCAqIGwgKiA2MCwgJy8nLCB1LCAhMSksIFYuc3R1ZmZlZFtzXSA9IG8pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAsIGYsIGcgPSBlLnV1aWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHEuaXNQb3B1bGF0ZWRTdHJpbmcoZykgJiYgKHEuaXNFbXB0eU9iamVjdChjKSB8fCAoJ3N0cmluZycgPT0gdHlwZW9mIChwID0gYy5wYXRoKSAmJiBwLmxlbmd0aCB8fCAocCA9ICcvJyksIGYgPSBwYXJzZUludChjLmRheXMsIDEwKSwgaXNOYU4oZikgJiYgKGYgPSAxMDApLCBOLnNldENvb2tpZShjLm5hbWUgfHwgJ2FhbV9kaWQnLCBnLCAyNCAqIGYgKiA2MCwgcCwgYy5kb21haW4gfHwgJy4nICsgZG9jdW1lbnQuZG9tYWluLnJlcGxhY2UoL153d3dcLi8sICcnKSwgITAgPT09IGMuc2VjdXJlKSkpLCBBLmFib3J0UmVxdWVzdHMgfHwgTS5yZXF1ZXN0VG9Qcm9jZXNzKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFrZVJlcXVlc3RTcmNEYXRhOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNpZHMgPSBxLnJlbW92ZUVtcHR5QXJyYXlWYWx1ZXMoZS5zaWRzIHx8IFtdKSwgZS5wZGF0YSA9IHEucmVtb3ZlRW1wdHlBcnJheVZhbHVlcyhlLnBkYXRhIHx8IFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBBLCBuID0gdC5wbGF0Zm9ybVBhcmFtcywgaSA9IE4uZW5jb2RlQW5kQnVpbGRSZXF1ZXN0KGUuc2lkcywgJywnKSwgciA9IE4uZW5jb2RlQW5kQnVpbGRSZXF1ZXN0KGUucGRhdGEsICcsJyksIHMgPSAoZS5sb2dkYXRhQXJyYXkgfHwgW10pLmpvaW4oJyYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGUubG9nZGF0YUFycmF5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbywgYywgbCA9IGVuY29kZVVSSUNvbXBvbmVudCwgdSA9IFMuSVNfSFRUUFMgPyAnaHR0cHM6Ly8nIDogJ2h0dHA6Ly8nLCBkID0gdC5kZWNsYXJlZElkLmdldERlY2xhcmVkSWRRdWVyeVN0cmluZygpLCBwID0gdC5hZG1zLmluc3RhbmNlID8gdC5hZG1zLmdldEN1c3RvbWVySURzUXVlcnlTdHJpbmcodC5hZG1zLmdldEN1c3RvbWVySURzKCkpIDogJycsIGYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGksIHIsIGEsIHMgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEobiBpbiB0LnJlc2VydmVkS2V5cykgJiYgZS5oYXNPd25Qcm9wZXJ0eShuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpID0gZVtuXSwgbiA9IGwobiksIGkgaW5zdGFuY2VvZiBBcnJheSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgPSAwLCBhID0gaS5sZW5ndGg7IHIgPCBhOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMucHVzaChuICsgJz0nICsgbChpW3JdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5wdXNoKG4gKyAnPScgKyBsKGkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5sZW5ndGggPyAnJicgKyBzLmpvaW4oJyYnKSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCBnID0gJ2RfZGlsX3Zlcj0nICsgbChESUwudmVyc2lvbiksIGggPSAnZF9uc2lkPScgKyBuLmRfbnNpZCArIHQuZ2V0Q29vcFF1ZXJ5U3RyaW5nKCkgKyBkICsgcCArIChpLmxlbmd0aCA/ICcmZF9zaWQ9JyArIGkgOiAnJykgKyAoci5sZW5ndGggPyAnJmRfcHg9JyArIHIgOiAnJykgKyAocy5sZW5ndGggPyAnJmRfbGQ9JyArIGwocykgOiAnJyksIG0gPSAnJmRfcnRiZD0nICsgbi5kX3J0YmQgKyAnJmRfanNvbnY9JyArIG4uZF9qc29udiArICcmZF9kc3Q9JyArIG4uZF9kc3QsIGIgPSB2ID8gJyZoX3JlZmVyZXI9JyArIGwobG9jYXRpb24uaHJlZikgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgPSAobyA9IHUgKyBhICsgJy5kZW1kZXgubmV0L2V2ZW50JykgKyAnPycgKyBnICsgJyYnICsgaCArIG0gKyBmICsgYiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yc1NyYzogbyArICc/JyArIGcgKyAnJl90cz0nICsgbmV3IERhdGUoKS5nZXRUaW1lKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcmM6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JzUG9zdERhdGE6IGggKyBtICsgZiArIGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0RlY2xhcmVkSWRDYWxsOiAnJyAhPT0gZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyZVJlcXVlc3Q6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnaW1nJyA9PT0gZS50YWcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZpcmVJbWFnZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEEuZGVjbGFyZWRJZCwgbiA9IHQuZGVjbGFyZWRJZC5yZXF1ZXN0IHx8IHQuZGVjbGFyZWRJZC5pbml0IHx8IHt9LCBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcGlkOiBuLmRwaWQgfHwgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRwdXVpZDogbi5kcHV1aWQgfHwgJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5maXJlQ09SUyhlLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyZUltYWdlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgciA9IEE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuYWJvcnRSZXF1ZXN0cyB8fCAoci5maXJpbmcgPSAhMCwgdCA9IG5ldyBJbWFnZSgwLCAwKSwgci5zZW50LnB1c2goZSksIHQub25sb2FkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5maXJpbmcgPSAhMSwgci5maXJlZC5wdXNoKGUpLCByLm51bV9vZl9pbWdfcmVzcG9uc2VzKyssIHIucmVnaXN0ZXJSZXF1ZXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4gPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9ICdpbWdBYm9ydE9yRXJyb3JIYW5kbGVyIHJlY2VpdmVkIHRoZSBldmVudCBvZiB0eXBlICcgKyB0LnR5cGUsIFQubG9nKGkpLCByLmFib3J0UmVxdWVzdHMgPSAhMCwgci5maXJpbmcgPSAhMSwgci5lcnJvcmVkLnB1c2goZSksIHIubnVtX29mX2ltZ19lcnJvcnMrKywgci5yZWdpc3RlclJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5hZGRFdmVudExpc3RlbmVyKCdlcnJvcicsIG4pLCB0LmFkZEV2ZW50TGlzdGVuZXIoJ2Fib3J0JywgbiksIHQuc3JjID0gZS5zcmMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyZUNPUlM6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcywgciA9IEEsIHMgPSB0aGlzLmNvcnNNZXRhZGF0YS5jb3JzVHlwZSwgbyA9IGUuY29yc1NyYywgYyA9IGUuY29yc0luc3RhbmNlLCBsID0gZS5jb3JzUG9zdERhdGEsIHUgPSBlLnBvc3RDYWxsYmFja0ZuLCBkID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyLmFib3J0UmVxdWVzdHMgJiYgIXcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuZmlyaW5nID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMub3BlbigncG9zdCcsIG8sICEwKSwgJ1hNTEh0dHBSZXF1ZXN0JyA9PT0gcyAmJiAoYy53aXRoQ3JlZGVudGlhbHMgPSAhMCwgYy5zZXRSZXF1ZXN0SGVhZGVyKCdDb250ZW50LVR5cGUnLCAnYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkJyksIGMub25yZWFkeXN0YXRlY2hhbmdlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0ID09PSB0aGlzLnJlYWR5U3RhdGUgJiYgMjAwID09PSB0aGlzLnN0YXR1cyAmJiBmdW5jdGlvbiAocykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgobyA9IEpTT04ucGFyc2UocykpICE9PSBPYmplY3QobykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmhhbmRsZUNPUlNFcnJvcihlLCB0LCAnUmVzcG9uc2UgaXMgbm90IEpTT04nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5oYW5kbGVDT1JTRXJyb3IoZSwgdCwgJ0Vycm9yIHBhcnNpbmcgcmVzcG9uc2UgYXMgSlNPTicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGUuY2FsbGJhY2tGbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmZpcmluZyA9ICExLCByLmZpcmVkLnB1c2goZSksIHIubnVtX29mX2NvcnNfcmVzcG9uc2VzKyssIGMobywgdCksIGQgJiYgdShvLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLm1lc3NhZ2UgPSAnRElMIGhhbmRsZUNPUlNSZXNwb25zZSBjYXVnaHQgZXJyb3Igd2l0aCBtZXNzYWdlICcgKyBzLm1lc3NhZ2UsIGkgPSBzLm1lc3NhZ2UsIFQubG9nKGkpLCBzLmZpbGVuYW1lID0gcy5maWxlbmFtZSB8fCAnZGlsLmpzJywgcy5wYXJ0bmVyID0gYSwgRElMLmVycm9yTW9kdWxlLmhhbmRsZUVycm9yKHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMoeyBlcnJvcjogcy5uYW1lICsgJ3wnICsgcy5tZXNzYWdlIH0sIHQpLCBkICYmIHUoeyBlcnJvcjogcy5uYW1lICsgJ3wnICsgcy5tZXNzYWdlIH0sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucmVnaXN0ZXJSZXF1ZXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0odGhpcy5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBjLm9uZXJyb3IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uaGFuZGxlQ09SU0Vycm9yKGUsIHQsICdvbmVycm9yJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYy5vbnRpbWVvdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uaGFuZGxlQ09SU0Vycm9yKGUsIHQsICdvbnRpbWVvdXQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBjLnNlbmQobCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5oYW5kbGVDT1JTRXJyb3IoZSwgdCwgJ3RyeS1jYXRjaCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5zZW50LnB1c2goZSksIHIuZGVjbGFyZWRJZC5kZWNsYXJlZElkLnJlcXVlc3QgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVDT1JTRXJyb3I6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEubnVtX29mX2NvcnNfZXJyb3JzKyssIEEuY29yc0Vycm9yU291cmNlcy5wdXNoKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNWYWxpZFBkYXRhOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISEoZSBpbnN0YW5jZW9mIEFycmF5ICYmIHRoaXMucmVtb3ZlRW1wdHlBcnJheVZhbHVlcyhlKS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNWYWxpZExvZ2RhdGE6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhdGhpcy5pc0VtcHR5T2JqZWN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFbXB0eU9iamVjdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgIT09IE9iamVjdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuaGFzT3duUHJvcGVydHkodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVFbXB0eUFycmF5VmFsdWVzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IDAsIGkgPSBlLmxlbmd0aCwgciA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgaTsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSAodCA9IGVbbl0pICYmICcnICE9PSB0ICYmIHIucHVzaCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc1BvcHVsYXRlZFN0cmluZzogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09IHR5cGVvZiBlICYmIGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udmVydE9iamVjdFRvS2V5VmFsdWVQYWlyczogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGksIHIsIGEgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpIGluICh0ID0gdCB8fCAnPScsIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5oYXNPd25Qcm9wZXJ0eShpKSAmJiBudWxsICE9IChyID0gZVtpXSkgJiYgJycgIT09IHIgJiYgYS5wdXNoKGkgKyB0ICsgKG4gPyBlbmNvZGVVUklDb21wb25lbnQocikgOiByKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2RlQW5kQnVpbGRSZXF1ZXN0OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDb29raWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBpLCByID0gZSArICc9JywgYSA9IGRvY3VtZW50LmNvb2tpZS5zcGxpdCgnOycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSAwLCBuID0gYS5sZW5ndGg7IHQgPCBuOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IGFbdF07ICcgJyA9PT0gaS5jaGFyQXQoMCk7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBpLnN1YnN0cmluZygxLCBpLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gaS5pbmRleE9mKHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkZWNvZGVVUklDb21wb25lbnQoaS5zdWJzdHJpbmcoci5sZW5ndGgsIGkubGVuZ3RoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRDb29raWU6IGZ1bmN0aW9uIChlLCB0LCBuLCBpLCByLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gbmV3IERhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG4gJiYgMTAwMCAqIG4gKiA2MCwgZG9jdW1lbnQuY29va2llID0gZSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh0KSArIChuID8gJztleHBpcmVzPScgKyBuZXcgRGF0ZShzLmdldFRpbWUoKSArIG4pLnRvVVRDU3RyaW5nKCkgOiAnJykgKyAoaSA/ICc7cGF0aD0nICsgaSA6ICcnKSArIChyID8gJztkb21haW49JyArIHIgOiAnJykgKyAoYSA/ICc7c2VjdXJlJyA6ICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dGVuZEFycmF5OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSBpbnN0YW5jZW9mIEFycmF5ICYmIHQgaW5zdGFuY2VvZiBBcnJheSAmJiAoQXJyYXkucHJvdG90eXBlLnB1c2guYXBwbHkoZSwgdCksICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dGVuZE9iamVjdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICE9PSBPYmplY3QoZSkgfHwgdCAhPT0gT2JqZWN0KHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0Lmhhc093blByb3BlcnR5KGkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFxLmlzRW1wdHlPYmplY3QobikgJiYgaSBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW2ldID0gdFtpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TWF4Q29va2llRXhwaXJlc0luTWludXRlczogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUy5TSVhfTU9OVEhTX0lOX01JTlVURVM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXBsYWNlTWV0aG9kc1dpdGhGdW5jdGlvbjogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSBPYmplY3QoZSkgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaGFzT3duUHJvcGVydHkobikgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZVtuXSAmJiAoZVtuXSA9IHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEYgPSAoRSA9IEMucmVxdWVzdENvbnRyb2xsZXIsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleGlzdHM6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5zdGFuY2U6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWFtSXNBcHByb3ZlZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbml0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jaGVja0lmRXhpc3RzKCkgPyAodGhpcy5leGlzdHMgPSAhMCwgdGhpcy5pbnN0YW5jZSA9IHdpbmRvdy5hZG9iZS5vcHRJbiwgdGhpcy5pbnN0YW5jZS5mZXRjaFBlcm1pc3Npb25zKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbGJhY2soKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApKSA6IHRoaXMuZXhpc3RzID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGVja0lmRXhpc3RzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuYWRvYmUgPT09IE9iamVjdCh3aW5kb3cuYWRvYmUpICYmIHdpbmRvdy5hZG9iZS5vcHRJbiA9PT0gT2JqZWN0KHdpbmRvdy5hZG9iZS5vcHRJbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFhbUlzQXBwcm92ZWQgPSB0aGlzLmluc3RhbmNlLmlzQXBwcm92ZWQoW3RoaXMuaW5zdGFuY2UuQ2F0ZWdvcmllcy5BQU1dKSwgRS5hZG1zLndhaXRGb3JNaWRUb1JlbGVhc2VSZXF1ZXN0cygpLCBFLmFkbXMuZ2V0SXNPcHRlZE91dCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNBcHByb3ZlZDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXRoaXMuaXNJYWJDb250ZXh0KCkgJiYgIUUuYWRtcy5pc09wdGVkT3V0ICYmICghdGhpcy5leGlzdHMgfHwgdGhpcy5hYW1Jc0FwcHJvdmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzSWFiQ29udGV4dDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5pbnN0YW5jZSAmJiB0aGlzLmluc3RhbmNlLmlzSWFiQ29udGV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgQy5vcHRJbiA9IEY7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBVLCBCLCBILCBHLCBRID0gKEIgPSAoVSA9IEMpLnJlcXVlc3RDb250cm9sbGVyLCBIID0gVS5vcHRJbiwgRyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc1ZlbmRvckNvbnNlbnRlZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2VzR2RwckFwcGx5OiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRTdHJpbmc6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVlcnlTdHJpbmdPYmplY3RDYWxsYmFja3M6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5mZXRjaENvbnNlbnREYXRhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNHb1NpZ25hbDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISghKEguaXNJYWJDb250ZXh0KCkgJiYgdGhpcy5pc1ZlbmRvckNvbnNlbnRlZCAmJiB0aGlzLmRvZXNHZHByQXBwbHkgJiYgJ3N0cmluZycgPT0gdHlwZW9mIHRoaXMuY29uc2VudFN0cmluZyAmJiB0aGlzLmNvbnNlbnRTdHJpbmcubGVuZ3RoKSB8fCBCLmFkbXMuaXNPcHRlZE91dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZXRjaENvbnNlbnREYXRhOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMsIGkgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgZSAmJiAoZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIEguaW5zdGFuY2UgJiYgSC5pc0lhYkNvbnRleHQoKSA/ICh0ICYmIChpLnRpbWVvdXQgPSB0KSwgSC5pbnN0YW5jZS5leGVjdXRlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1hbmQ6ICdpYWJQbHVnaW4uZmV0Y2hDb25zZW50RGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXM6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogZnVuY3Rpb24gKHQsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID09PSBPYmplY3QoaSkgPyAobi5kb2VzR2RwckFwcGx5ID0gISFpLmdkcHJBcHBsaWVzLCBuLmNvbnNlbnRTdHJpbmcgPSBpLmNvbnNlbnRTdHJpbmcgfHwgJycpIDogKG4uZG9lc0dkcHJBcHBseSA9ICExLCBuLmNvbnNlbnRTdHJpbmcgPSAnJyksIG4uaXNWZW5kb3JDb25zZW50ZWQgPSBILmluc3RhbmNlLmlzQXBwcm92ZWQoSC5pbnN0YW5jZS5DYXRlZ29yaWVzLkFBTSksIHQgPyBlKHt9KSA6IG4uY2hlY2tRdWVyeVN0cmluZ09iamVjdChlKSwgQi5hZG1zLndhaXRGb3JNaWRUb1JlbGVhc2VSZXF1ZXN0cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgOiBlKHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFF1ZXJ5U3RyaW5nOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBILmlzSWFiQ29udGV4dCgpID8gJ2dkcHI9JyArICh0aGlzLmRvZXNHZHByQXBwbHkgPyAxIDogMCkgKyAnJmdkcHJfY29uc2VudD0nICsgdGhpcy5jb25zZW50U3RyaW5nICsgJyYnIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRRdWVyeVN0cmluZ09iamVjdDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5mZXRjaENvbnNlbnREYXRhKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hlY2tRdWVyeVN0cmluZ09iamVjdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRy5oYXNHb1NpZ25hbCgpICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGUgJiYgZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByOiB0aGlzLmRvZXNHZHByQXBwbHkgPyAxIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdkcHJfY29uc2VudDogdGhpcy5jb25zZW50U3RyaW5nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBDLmlhYiA9IFEsICdlcnJvcicgPT09IGEgJiYgMCA9PT0gcyAmJiB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIERJTC53aW5kb3dMb2FkZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB6ID0gITEsIFcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8gfHwgQS5maXJzdFJlcXVlc3RIYXNGaXJlZCB8fCAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgayA/IFIuYWZ0ZXJSZXN1bHQoaykuc3VibWl0KCEwKSA6IFIuc3VibWl0KCEwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRElMLmNvbnN0YW50cy5USU1FX1RPX0RFRkFVTFRfUkVRVUVTVCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBZID0gZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICdlcnJvcicgIT09IGEgJiYgKERJTC53aW5kb3dMb2FkZWQgPyBuKCkgOiAnY29tcGxldGUnICE9PSBZLnJlYWR5U3RhdGUgJiYgJ2xvYWRlZCcgIT09IFkucmVhZHlTdGF0ZSA/IHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgRElMLndpbmRvd0xvYWRlZCA9ICEwLCBuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogKERJTC53aW5kb3dMb2FkZWQgPSAhMCwgbigpKSksIEEuZGVjbGFyZWRJZC5zZXREZWNsYXJlZElkKGQsICdpbml0JyksIEYuaW5pdCgpLCBRLmluaXQoKSwgQS5wcm9jZXNzVmlzaXRvckFQSSgpLCBTLklTX0lFX0xFU1NfVEhBTl8xMCAmJiBOLnJlcGxhY2VNZXRob2RzV2l0aEZ1bmN0aW9uKFIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5hcGkgPSBSLCB0aGlzLmdldFN0dWZmZWRWYXJpYWJsZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFYuc3R1ZmZlZFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0IHx8ICdudW1iZXInID09IHR5cGVvZiB0IHx8ICh0ID0gTi5nZXRDb29raWUoZSkpIHx8ICdudW1iZXInID09IHR5cGVvZiB0IHx8ICh0ID0gJycpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLnZhbGlkYXRvcnMgPSBxLCB0aGlzLmhlbHBlcnMgPSBOLCB0aGlzLmNvbnN0YW50cyA9IFMsIHRoaXMubG9nID0gRCwgdGhpcy5wZW5kaW5nUmVxdWVzdCA9IEwsIHRoaXMucmVxdWVzdENvbnRyb2xsZXIgPSBBLCB0aGlzLmRlc3RpbmF0aW9uUHVibGlzaGluZyA9IE0sIHRoaXMucmVxdWVzdFByb2NzID0gaiwgdGhpcy51bml0cyA9IEMsIHRoaXMuaW5pdENvbmZpZyA9IGUsIHRoaXMubG9nZ2VyID0gVCwgSSAmJiAodGhpcy52YXJpYWJsZXMgPSBWLCB0aGlzLmNhbGxXaW5kb3dMb2FkRnVuY3Rpb25zID0gbik7CiAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9jNWNjMGJmMjU2ZmRjOGExKQogICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkX2M1Y2MwYmYyNTZmZGM4YTEpKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF80NjVjZTc5NGMyYWIxMGFmKQogICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzQ2NWNlNzk0YzJhYjEwYWYpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwgRElMLmV4dGVuZFN0YXRpY1Byb3BlcnRpZXNBbmRNZXRob2RzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgaWYgKGUgPT09IE9iamVjdChlKSkKICAgICAgICAgICAgICAgICAgICBmb3IgKHQgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgZS5oYXNPd25Qcm9wZXJ0eSh0KSAmJiAodGhpc1t0XSA9IGVbdF0pOwogICAgICAgICAgICB9LCBESUwuZXh0ZW5kU3RhdGljUHJvcGVydGllc0FuZE1ldGhvZHMoewogICAgICAgICAgICAgICAgdmVyc2lvbjogJzkuNCcsCiAgICAgICAgICAgICAgICBqc29uVmVyc2lvbjogMSwKICAgICAgICAgICAgICAgIGNvbnN0YW50czogeyBUSU1FX1RPX0RFRkFVTFRfUkVRVUVTVDogNTAwIH0sCiAgICAgICAgICAgICAgICB2YXJpYWJsZXM6IHsgc2NyaXB0Tm9kZUxpc3Q6IGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdzY3JpcHQnKSB9LAogICAgICAgICAgICAgICAgd2luZG93TG9hZGVkOiAhMSwKICAgICAgICAgICAgICAgIGRpbHM6IHt9LAogICAgICAgICAgICAgICAgaXNBZGRlZFBvc3RXaW5kb3dMb2FkOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHNbMF07CiAgICAgICAgICAgICAgICAgICAgdGhpcy53aW5kb3dMb2FkZWQgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBlID8gISFlKCkgOiAnYm9vbGVhbicgIT0gdHlwZW9mIGUgfHwgZTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBjcmVhdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBESUwoZSk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0Vycm9yIGluIGF0dGVtcHQgdG8gY3JlYXRlIERJTCBpbnN0YW5jZSB3aXRoIERJTC5jcmVhdGUoKTogJyArIGUubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHJlZ2lzdGVyRGlsOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciBpID0gdCArICckJyArIG47CiAgICAgICAgICAgICAgICAgICAgaSBpbiB0aGlzLmRpbHMgfHwgKHRoaXMuZGlsc1tpXSA9IGUpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGdldERpbDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgIT0gdHlwZW9mIGUgJiYgKGUgPSAnJyksIChuID0gZSArICckJyArICh0ID0gdCB8fCAwKSkgaW4gdGhpcy5kaWxzID8gdGhpcy5kaWxzW25dIDogbmV3IEVycm9yKCdUaGUgRElMIGluc3RhbmNlIHdpdGggcGFydG5lciA9ICcgKyBlICsgJyBhbmQgY29udGFpbmVyTlNJRCA9ICcgKyB0ICsgJyB3YXMgbm90IGZvdW5kJyk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgZGV4R2V0UVNWYXJzOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciBpID0gdGhpcy5nZXREaWwodCwgbik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgaW5zdGFuY2VvZiB0aGlzID8gaS5nZXRTdHVmZmVkVmFyaWFibGUoZSkgOiAnJzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSksIERJTC5lcnJvck1vZHVsZSA9IChlID0gRElMLmNyZWF0ZSh7CiAgICAgICAgICAgICAgICBwYXJ0bmVyOiAnZXJyb3InLAogICAgICAgICAgICAgICAgY29udGFpbmVyTlNJRDogMCwKICAgICAgICAgICAgICAgIGlnbm9yZUhhcmREZXBlbmRlbmN5T25WaXNpdG9yQVBJOiAhMAogICAgICAgICAgICB9KSwgbiA9ICEodCA9IHsKICAgICAgICAgICAgICAgIGhhcnZlc3RlcmVycm9yOiAxNDEzOCwKICAgICAgICAgICAgICAgIGRlc3RwdWJlcnJvcjogMTQxMzksCiAgICAgICAgICAgICAgICBkcG1lcnJvcjogMTQxNDAsCiAgICAgICAgICAgICAgICBnZW5lcmFsZXJyb3I6IDE0MTM3LAogICAgICAgICAgICAgICAgZXJyb3I6IDE0MTM3LAogICAgICAgICAgICAgICAgbm9lcnJvcnR5cGVkZWZpbmVkOiAxNTAyMSwKICAgICAgICAgICAgICAgIGV2YWxlcnJvcjogMTUwMTYsCiAgICAgICAgICAgICAgICByYW5nZWVycm9yOiAxNTAxNywKICAgICAgICAgICAgICAgIHJlZmVyZW5jZWVycm9yOiAxNTAxOCwKICAgICAgICAgICAgICAgIHR5cGVlcnJvcjogMTUwMTksCiAgICAgICAgICAgICAgICB1cmllcnJvcjogMTUwMjAKICAgICAgICAgICAgfSksIHsKICAgICAgICAgICAgICAgIGFjdGl2YXRlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgbiA9ICEwOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGhhbmRsZUVycm9yOiBmdW5jdGlvbiAoaSkgewogICAgICAgICAgICAgICAgICAgIGlmICghbikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdESUwgZXJyb3IgbW9kdWxlIGhhcyBub3QgYmVlbiBhY3RpdmF0ZWQnOwogICAgICAgICAgICAgICAgICAgIGkgIT09IE9iamVjdChpKSAmJiAoaSA9IHt9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGkubmFtZSA/IChpLm5hbWUgKyAnJykudG9Mb3dlckNhc2UoKSA6ICcnLCBhID0gciBpbiB0ID8gdFtyXSA6IHQubm9lcnJvcnR5cGVkZWZpbmVkLCBzID0gW10sIG8gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsZW5hbWU6IGkuZmlsZW5hbWUgPyBpLmZpbGVuYW1lICsgJycgOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnRuZXI6IGkucGFydG5lciA/IGkucGFydG5lciArICcnIDogJ25vX3BhcnRuZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l0ZTogaS5zaXRlID8gaS5zaXRlICsgJycgOiBkb2N1bWVudC5sb2NhdGlvbi5ocmVmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogaS5tZXNzYWdlID8gaS5tZXNzYWdlICsgJycgOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBzLnB1c2goYSksIGUuYXBpLnBpeGVscyhzKS5sb2dzKG8pLnVzZUltYWdlUmVxdWVzdCgpLnN1Ym1pdCgpLCAnRElMIGVycm9yIHJlcG9ydCBzZW50JzsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBwaXhlbE1hcDogdAogICAgICAgICAgICB9KSwgRElMLnRvb2xzID0ge30sIERJTC5tb2R1bGVzID0geyBoZWxwZXJzOiB7fSB9KTsKICAgICAgICB9KCksIEFwcE1lYXN1cmVtZW50LmdldEluc3RhbmNlID0gc19naSwgd2luZG93LnNfb2JqZWN0SUQgfHwgKHdpbmRvdy5zX29iamVjdElEID0gMCksIHNfcGdpY3EoKSwgZmR4X2luaXRTQ29kZSgpOwogICAgfSgpKQp9"},{"name":"sugarcoat-076c7980e90e3f4c811295e17dcec5de21c8fd79","aliases":[],"kind":{"mime":"application/javascript"},"content":"dmFyIF9zYXRlbGxpdGU7CnsKICAgIGNvbnN0ICRfX19tb2NrXzQ0OGI5NWE0N2RkNDlmMGEgPSB7fTsKICAgIChleHBvcnRzID0+IHsKICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgY29uc3QgeGhyVW5zZW50ID0gMDsKICAgICAgICBjb25zdCB4aHJPcGVuZWQgPSAxOwogICAgICAgIGNvbnN0IHhockhlYWRlcnNSZWNlaXZlZCA9IDI7CiAgICAgICAgY29uc3QgeGhyTG9hZGluZyA9IDM7CiAgICAgICAgY29uc3QgeGhyRG9uZSA9IDQ7CiAgICAgICAgY29uc3QgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wgPSBTeW1ib2woJ2RlZmVycmVkSGFuZGxlJyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkU3RhcnRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZHN0YXJ0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Qcm9ncmVzc1N5bWJvbCA9IFN5bWJvbCgnb25wcm9ncmVzcycpOwogICAgICAgIGNvbnN0IHhock9uQWJvcnRTeW1ib2wgPSBTeW1ib2woJ29uYWJvcnQnKTsKICAgICAgICBjb25zdCB4aHJPbkVycm9yU3ltYm9sID0gU3ltYm9sKCdvbmVycm9yJyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkU3ltYm9sID0gU3ltYm9sKCdvbmxvYWQnKTsKICAgICAgICBjb25zdCB4aHJPblRpbWVvdXRTeW1ib2wgPSBTeW1ib2woJ29udGltZW91dCcpOwogICAgICAgIGNvbnN0IHhock9uTG9hZEVuZFN5bWJvbCA9IFN5bWJvbCgnb25sb2FkZW5kJyk7CiAgICAgICAgY29uc3QgeGhyT25SZWFkeVN0YXRlQ2hhbmdlU3ltYm9sID0gU3ltYm9sKCdvbnJlYWR5c3RhdGVjaGFuZ2UnKTsKICAgICAgICBjb25zdCB4aHJSZWFkeVN0YXRlU3ltYm9sID0gU3ltYm9sKCdyZWFkeVN0YXRlJyk7CiAgICAgICAgY29uc3QgeGhyVGltZW91dFN5bWJvbCA9IFN5bWJvbCgndGltZW91dCcpOwogICAgICAgIGNvbnN0IHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCA9IFN5bWJvbCgnd2l0aENyZWRlbnRpYWxzJyk7CiAgICAgICAgY29uc3QgeGhyVXBsb2FkU3ltYm9sID0gU3ltYm9sKCd1cGxvYWQnKTsKICAgICAgICBjb25zdCB4aHJSZXNwb25zZVR5cGVTeW1ib2wgPSBTeW1ib2woJ3Jlc3BvbnNlVHlwZScpOwogICAgICAgIGNvbnN0IGRlZmluZUV2ZW50ID0gKG9iaiwgc3ltYm9sKSA9PiB7CiAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBzeW1ib2wuZGVzY3JpcHRpb24uc3Vic3RyaW5nKDIpOwogICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkob2JqLCBzeW1ib2wsIHsKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIG9iai5hZGRFdmVudExpc3RlbmVyKHR5cGUsIGZ1bmN0aW9uIChldmVudCkgewogICAgICAgICAgICAgICAgY29uc3QgaGFuZGxlciA9IHRoaXNbc3ltYm9sXTsKICAgICAgICAgICAgICAgIGlmIChoYW5kbGVyKSB7CiAgICAgICAgICAgICAgICAgICAgaGFuZGxlci5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICBjb25zdCBjaGFuZ2VSZWFkeVN0YXRlID0gKHhociwgcmVhZHlTdGF0ZSkgPT4gewogICAgICAgICAgICB4aHJbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPSByZWFkeVN0YXRlOwogICAgICAgICAgICB4aHIuZGlzcGF0Y2hFdmVudChuZXcgRXZlbnQoJ3JlYWR5c3RhdGVjaGFuZ2UnKSk7CiAgICAgICAgfTsKICAgICAgICBsZXQgaXNTZWFsZWQgPSB0cnVlOwogICAgICAgIGNsYXNzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgZXh0ZW5kcyBFdmVudFRhcmdldCB7CiAgICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICAgICAgc3VwZXIoKTsKICAgICAgICAgICAgICAgIGlmICghKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdCkgJiYgISh0aGlzIGluc3RhbmNlb2YgWE1MSHR0cFJlcXVlc3RVcGxvYWQpKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSWxsZWdhbCBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Mb2FkU3RhcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Qcm9ncmVzc1N5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkFib3J0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uRXJyb3JTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Mb2FkU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uVGltZW91dFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRFbmRTeW1ib2wpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmxvYWRzdGFydCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uTG9hZFN0YXJ0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2Fkc3RhcnQodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucHJvZ3Jlc3MoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPblByb2dyZXNzU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25wcm9ncmVzcyh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblByb2dyZXNzU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmFib3J0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25BYm9ydFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uYWJvcnQodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25BYm9ydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25lcnJvcigpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uRXJyb3JTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmVycm9yKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uRXJyb3JTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9udGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uVGltZW91dFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9udGltZW91dCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZGVuZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ubG9hZGVuZCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRFbmRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0ID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RVcGxvYWQgZXh0ZW5kcyBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBpZiAoaXNTZWFsZWQpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3RVcGxvYWQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0VXBsb2FkLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3QgZXh0ZW5kcyBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaXNTZWFsZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgIGNvbnN0IHhoclVwbG9hZCA9IG5ldyBYTUxIdHRwUmVxdWVzdFVwbG9hZCgpOwogICAgICAgICAgICAgICAgaXNTZWFsZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhockRlZmVycmVkSGFuZGxlU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbnVsbCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhoclJlYWR5U3RhdGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhoclRpbWVvdXRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAwLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJXaXRoQ3JlZGVudGlhbHNTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVXBsb2FkU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogeGhyVXBsb2FkLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVzcG9uc2VUeXBlU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbnJlYWR5c3RhdGVjaGFuZ2UoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnJlYWR5c3RhdGVjaGFuZ2UodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25SZWFkeVN0YXRlQ2hhbmdlU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZWFkeVN0YXRlKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgb3BlbihtZXRob2QsIHVybCkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyRG9uZTogewogICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhock9wZW5lZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRSZXF1ZXN0SGVhZGVyKG5hbWUsIHZhbHVlKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0VHJ1c3RUb2tlbih0cnVzdFRva2VuKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHRpbWVvdXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJUaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgdGltZW91dCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJUaW1lb3V0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCB3aXRoQ3JlZGVudGlhbHMoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJXaXRoQ3JlZGVudGlhbHNTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB3aXRoQ3JlZGVudGlhbHModmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJVbnNlbnQ6CiAgICAgICAgICAgICAgICBjYXNlIHhock9wZW5lZDogewogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZhdWx0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwnd2l0aENyZWRlbnRpYWxzXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgbWF5IG9ubHkgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgVU5TRU5UIG9yIE9QRU5FRC4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF0gPSAhIXZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCB1cGxvYWQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJVcGxvYWRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNlbmQoKSB7CiAgICAgICAgICAgICAgICBpZiAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSA9PT0geGhyT3BlbmVkICYmIHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdID09PSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBzZXRUaW1lb3V0KCgpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhockRvbmUpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Vycm9yJykpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2xvYWRlbmQnKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgMCk7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBleGVjdXRlIFwnc2VuZFwnIG9uIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIG9iamVjdFwncyBzdGF0ZSBtdXN0IGJlIE9QRU5FRC4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBhYm9ydCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gIT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQodGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0pOwogICAgICAgICAgICAgICAgICAgIHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhoclVuc2VudCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCdhYm9ydCcpKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2xvYWRlbmQnKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlVVJMKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXMoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgc3RhdHVzVGV4dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXRSZXNwb25zZUhlYWRlcihuYW1lKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBvdmVycmlkZU1pbWVUeXBlKG1pbWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUeXBlKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgcmVzcG9uc2VUeXBlKHZhbHVlKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyRG9uZTogewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCdGYWlsZWQgdG8gc2V0IHRoZSBcJ3Jlc3BvbnNlVHlwZVwnIHByb3BlcnR5IG9uIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIHJlc3BvbnNlIHR5cGUgY2Fubm90IGJlIHNldCBpZiB0aGUgb2JqZWN0XCdzIHN0YXRlIGlzIExPQURJTkcgb3IgRE9ORS4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHZhbHVlKSB7CiAgICAgICAgICAgICAgICBjYXNlICcnOgogICAgICAgICAgICAgICAgY2FzZSAnYXJyYXlidWZmZXInOgogICAgICAgICAgICAgICAgY2FzZSAnYmxvYic6CiAgICAgICAgICAgICAgICBjYXNlICdkb2N1bWVudCc6CiAgICAgICAgICAgICAgICBjYXNlICdqc29uJzoKICAgICAgICAgICAgICAgIGNhc2UgJ3RleHQnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlKCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgcmV0dXJuIHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcgPyAnJyA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlVGV4dCgpIHsKICAgICAgICAgICAgICAgIGNvbnN0IHJlc3BvbnNlVHlwZSA9IHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXTsKICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZVR5cGUgPT09ICcnIHx8IHJlc3BvbnNlVHlwZSA9PT0gJ3RleHQnKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCdGYWlsZWQgdG8gcmVhZCB0aGUgXCdyZXNwb25zZVRleHRcJyBwcm9wZXJ0eSBmcm9tIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIHZhbHVlIGlzIG9ubHkgYWNjZXNzaWJsZSBpZiB0aGUgb2JqZWN0XCdzIFwncmVzcG9uc2VUeXBlXCcgaXMgXCdcJyBvciBcJ3RleHRcJyAod2FzIFwnYXJyYXlidWZmZXJcJykuJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlWE1MKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnVU5TRU5UJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyVW5zZW50CiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnT1BFTkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyT3BlbmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnSEVBREVSU19SRUNFSVZFRCcsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockhlYWRlcnNSZWNlaXZlZAogICAgICAgIH0pOwogICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShYTUxIdHRwUmVxdWVzdCwgJ0xPQURJTkcnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJMb2FkaW5nCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnRE9ORScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockRvbmUKICAgICAgICB9KTsKICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0ID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBYTUxIdHRwUmVxdWVzdCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgfSkoJF9fX21vY2tfNDQ4Yjk1YTQ3ZGQ0OWYwYSk7CiAgICBjb25zdCAkX19fbW9ja19jYTkxODA0M2M3NDUxMTdlID0ge307CiAgICAoZXhwb3J0cyA9PiB7CiAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgIGxldCBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgIGNsYXNzIFN0b3JhZ2UgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgbGVuZ3RoKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKHRoaXMpLmxlbmd0aDsKICAgICAgICAgICAgfQogICAgICAgICAgICBrZXkoaW5kZXgpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGtleXMgPSBPYmplY3Qua2V5cyh0aGlzKTsKICAgICAgICAgICAgICAgIGlmIChpbmRleCA8IDAgfHwgaW5kZXggPj0ga2V5cy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBrZXlzW2luZGV4XTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXRJdGVtKGtleSkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbCh0aGlzLCBrZXkpID8gdGhpc1trZXldIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRJdGVtKGtleSwgdmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNba2V5XSA9IFN0cmluZyh2YWx1ZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmVtb3ZlSXRlbShrZXkpIHsKICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2tleV07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2xlYXIoKSB7CiAgICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXModGhpcyk7CiAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGtleSBvZiBrZXlzKSB7CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHRoaXNba2V5XTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFN0b3JhZ2UsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjb25zdCBsb2NhbFN0b3JhZ2UgPSBuZXcgU3RvcmFnZSgpOwogICAgICAgIGV4cG9ydHMubG9jYWxTdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIGdldCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBsb2NhbFN0b3JhZ2U7CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGNvbnN0IHNlc3Npb25TdG9yYWdlID0gbmV3IFN0b3JhZ2UoKTsKICAgICAgICBleHBvcnRzLnNlc3Npb25TdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIGdldCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBzZXNzaW9uU3RvcmFnZTsKICAgICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgaXNTZWFsZWQgPSB0cnVlOwogICAgfSkoJF9fX21vY2tfY2E5MTgwNDNjNzQ1MTE3ZSk7CiAgICAoZnVuY3Rpb24gKCkgewogICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHdpbmRvdy5fc2F0ZWxsaXRlID0gd2luZG93Ll9zYXRlbGxpdGUgfHwge30sIHdpbmRvdy5fc2F0ZWxsaXRlLmNvbnRhaW5lciA9IHsKICAgICAgICAgICAgICAgIGJ1aWxkSW5mbzogewogICAgICAgICAgICAgICAgICAgIG1pbmlmaWVkOiAhMCwKICAgICAgICAgICAgICAgICAgICBidWlsZERhdGU6ICcyMDIxLTEyLTMwVDE1OjUwOjIyWicsCiAgICAgICAgICAgICAgICAgICAgdHVyYmluZUJ1aWxkRGF0ZTogJzIwMjEtMDgtMTFUMjA6MjU6NDlaJywKICAgICAgICAgICAgICAgICAgICB0dXJiaW5lVmVyc2lvbjogJzI3LjIuMCcKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudDogewogICAgICAgICAgICAgICAgICAgIGlkOiAnRU5lNjQ1YzY0NjVmZDI0ZDAzYjM4MDM5OTFiZDA5MDNjMycsCiAgICAgICAgICAgICAgICAgICAgc3RhZ2U6ICdwcm9kdWN0aW9uJwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGRhdGFFbGVtZW50czogewogICAgICAgICAgICAgICAgICAgICdbRGlnaXRhbERhdGFdIFF1YXJ0byBMaXZlbGxvJzogewogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBmb3JjZUxvd2VyQ2FzZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFuVGV4dDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5wYWdlLmNhdGVnb3J5LnN1YkNhdGVnb3J5MycgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgJ1tEaWdpdGFsRGF0YV0gVGVyem8gTGl2ZWxsbyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VMb3dlckNhc2U6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEucGFnZS5jYXRlZ29yeS5zdWJDYXRlZ29yeTInIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VMb3dlckNhc2U6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEucGFnZS5jYXRlZ29yeS5zdWJDYXRlZ29yeTEnIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdbQUxMXSBJbnRlcm5hbCBmaWx0ZXInOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuZG9tYWluOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAnW0FMTF0gVHJhbnNhY3Rpb25JZCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VMb3dlckNhc2U6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9xdWVyeVN0cmluZ1BhcmFtZXRlci5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnbGVhZElkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgJ1tEaWdpdGFsRGF0YV0gSW50Y21wJzogewogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBmb3JjZUxvd2VyQ2FzZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFuVGV4dDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5wYWdlLmNhdGVnb3J5LmludGNtcCcgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgQ21wJzogewogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBmb3JjZUxvd2VyQ2FzZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFuVGV4dDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL3F1ZXJ5U3RyaW5nUGFyYW1ldGVyLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjbXAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZUluc2Vuc2l0aXZlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAnW0RpZ2l0YWxEYXRhXSBDaGFubmVsJzogewogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEucGFnZS5jYXRlZ29yeS5wcmltYXJ5Q2F0ZWdvcnknIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdbQUxMXSBFeHRlcm5hbCBJZCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VMb3dlckNhc2U6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICd2aXNpdG9yJywKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY29va2llLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgbmFtZTogJ2V4dCcgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgJ1tBTExdIFNlcnZlcic6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQubG9jYXRpb24uaG9zdG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdbQUxMXSBDb29raWUgTG9naW4gU3RhdHVzJzogewogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoX3NhdGVsbGl0ZS5jb29raWUuZ2V0KCdSRVNLWUMnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ0MnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2NsaWVudGUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1AnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1InOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ25vbiBjbGllbnRlJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ25vbiBsb2dnYXRvJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdbVklERU9dIEhiQ29uZmlndXJhdGlvbic6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSGJDb25maWd1cmF0aW9uID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQTEFZRVI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5BTUU6ICdKVyBQbGF5ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS0VZOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZJREVPX0lEOiAnc2t5UGxheWVyX2p3cGxheWVyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWSVNJVE9SOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQVJLRVRJTkdfQ0xPVURfT1JHX0lEOiAnMUExMjQ2NzM1Mjc4NTMyOTBBNDkwRDQ1QEFkb2JlT3JnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRSQUNLSU5HX1NFUlZFUjogJ3NreS5pdC5zYy5vbXRyZGMubmV0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERQSUQ6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRFBVVUlEOiAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBUFBfTUVBU1VSRU1FTlQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJTSUQ6ICdza3lpdGNvbGwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVFJBQ0tJTkdfU0VSVkVSOiAnc2t5Lml0LnNjLm9tdHJkYy5uZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUEFHRV9OQU1FOiAndmlkZW8taG9tZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSEVBUlRCRUFUOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUUkFDS0lOR19TRVJWRVI6ICdza3lpdGFsaWEuaGIub210cmRjLm5ldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDSEFOTkVMOiAndmlkZW8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT1ZQOiAnVmlkZW8gUGxhdGZvcm0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU0RLOiAnMi4wLjAnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBIYkNvbmZpZ3VyYXRpb247CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIEludGNtcCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VMb3dlckNhc2U6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9xdWVyeVN0cmluZ1BhcmFtZXRlci5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnaW50Y21wJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgJ1tBT0xdIEVudHJ5UHJvZHVjdCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VMb3dlckNhc2U6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICd3aW5kb3cuZW50cnlwcm9kdWN0JyB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAnW0RpZ2l0YWxEYXRhXSBQYWdlTmFtZSc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VMb3dlckNhc2U6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEucGFnZS5wYWdlSW5mby5wYWdlTmFtZScgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgJ1tBT0xdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgQ29kcHJvbW8nOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZvcmNlTG93ZXJDYXNlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY2xlYW5UZXh0OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvcXVlcnlTdHJpbmdQYXJhbWV0ZXIuanMnLAogICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2NvZFByb21vJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJzogewogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBmb3JjZUxvd2VyQ2FzZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFuVGV4dDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL3F1ZXJ5U3RyaW5nUGFyYW1ldGVyLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdzb2NpYWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZUluc2Vuc2l0aXZlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAnW0FPTF0gUHJvZG90dGkgSW50ZXJtZWRpYXRlJzogewogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICdub19wcm9kO25vX3Byb2QnLAogICAgICAgICAgICAgICAgICAgICAgICBmb3JjZUxvd2VyQ2FzZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ3dpbmRvdy5EYXRhTGF5ZXJJbnRlcm1lZGlhdGUnIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdbQU9MXSBBZGZvcm0gdHJhY2tpbmcnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuZXcgUmVnRXhwKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5tYXRjaChhKSA/ICcxJyA6ICcwJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfcHJvbW9jb2RlJyksIGEgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FPTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBDb2Rwcm9tbycpLCBuID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X29mZmVydHlwZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN2NjA6IHQgfHwgYSA/IHQgfHwgYSA6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Y2MTogbiB8fCAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN2MzE6IGUoJ25ldGZsaXgnLCAnc2VsZXppb25hJyA9PSByID8gRGF0YUxheWVyIDogJ2FuYWdyYWZpY2EnID09IHIgfHwgJ3BhZ2FtZW50bycgPT0gciA/IERhdGFMYXllckludGVybWVkaWF0ZSA6IERhdGFMYXllckZpbmFsKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN2NDY6IGUoJ3NreXEnLCAnc2VsZXppb25hJyA9PSByID8gRGF0YUxheWVyIDogJ2FuYWdyYWZpY2EnID09IHIgfHwgJ3BhZ2FtZW50bycgPT0gciA/IERhdGFMYXllckludGVybWVkaWF0ZSA6IERhdGFMYXllckZpbmFsKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN2NjI6IGUoJ3NreSBmYW1pZ2xpYScsICdzZWxlemlvbmEnID09IHIgPyBEYXRhTGF5ZXIgOiAnYW5hZ3JhZmljYScgPT0gciB8fCAncGFnYW1lbnRvJyA9PSByID8gRGF0YUxheWVySW50ZXJtZWRpYXRlIDogRGF0YUxheWVyRmluYWwpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Y2NDogZSgnc2t5IGNpbmVtYScsICdzZWxlemlvbmEnID09IHIgPyBEYXRhTGF5ZXIgOiAnYW5hZ3JhZmljYScgPT0gciB8fCAncGFnYW1lbnRvJyA9PSByID8gRGF0YUxheWVySW50ZXJtZWRpYXRlIDogRGF0YUxheWVyRmluYWwpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Y2NTogZSgnc2t5IHNwb3J0JywgJ3NlbGV6aW9uYScgPT0gciA/IERhdGFMYXllciA6ICdhbmFncmFmaWNhJyA9PSByIHx8ICdwYWdhbWVudG8nID09IHIgPyBEYXRhTGF5ZXJJbnRlcm1lZGlhdGUgOiBEYXRhTGF5ZXJGaW5hbCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdjY2OiBlKCdza3kgY2FsY2lvJywgJ3NlbGV6aW9uYScgPT0gciA/IERhdGFMYXllciA6ICdhbmFncmFmaWNhJyA9PSByIHx8ICdwYWdhbWVudG8nID09IHIgPyBEYXRhTGF5ZXJJbnRlcm1lZGlhdGUgOiBEYXRhTGF5ZXJGaW5hbCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdjY5OiBlKCdwYXJhYm9sYScsICdzZWxlemlvbmEnID09IHIgPyBEYXRhTGF5ZXIgOiAnYW5hZ3JhZmljYScgPT0gciB8fCAncGFnYW1lbnRvJyA9PSByID8gRGF0YUxheWVySW50ZXJtZWRpYXRlIDogRGF0YUxheWVyRmluYWwpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Y3MjogZSgnc2t5IG9uIGRlbWFuZCcsICdzZWxlemlvbmEnID09IHIgPyBEYXRhTGF5ZXIgOiAnYW5hZ3JhZmljYScgPT0gciB8fCAncGFnYW1lbnRvJyA9PSByID8gRGF0YUxheWVySW50ZXJtZWRpYXRlIDogRGF0YUxheWVyRmluYWwpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Y3MzogZSgnc2t5IGhkJywgJ3NlbGV6aW9uYScgPT0gciA/IERhdGFMYXllciA6ICdhbmFncmFmaWNhJyA9PSByIHx8ICdwYWdhbWVudG8nID09IHIgPyBEYXRhTGF5ZXJJbnRlcm1lZGlhdGUgOiBEYXRhTGF5ZXJGaW5hbCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdjc1OiBlKCdza3kgbXVsdGl2aXNpb24nLCAnc2VsZXppb25hJyA9PSByID8gRGF0YUxheWVyIDogJ2FuYWdyYWZpY2EnID09IHIgfHwgJ3BhZ2FtZW50bycgPT0gciA/IERhdGFMYXllckludGVybWVkaWF0ZSA6IERhdGFMYXllckZpbmFsKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN2ODM6ICdzZWxlemlvbmEnID09IHIgPyAnUGFjY2hldHRpJyA6ICdhbmFncmFmaWNhJyA9PSByID8gJ0FuYWdyYWZpY2EnIDogJ3BhZ2FtZW50bycgPT0gciA/ICdQYWdhbWVudG8nIDogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERhdGFMYXllci5tYXRjaCgvZmFzdHdlYi8pICYmIChpLnN2NjcgPSBlKCdpbnRlcm5ldCBpbGxpbWl0YXRvIGZhc3R3ZWInLCAnc2VsZXppb25hJyA9PSByID8gRGF0YUxheWVyIDogJ2FuYWdyYWZpY2EnID09IHIgfHwgJ3BhZ2FtZW50bycgPT0gciA/IERhdGFMYXllckludGVybWVkaWF0ZSA6IERhdGFMYXllckZpbmFsKSwgaS5zdjY4ID0gZSgnY2hpYW1hdGUgaWxsaW1pdGF0ZSBmYXN0d2ViJywgJ3NlbGV6aW9uYScgPT0gciA/IERhdGFMYXllciA6ICdhbmFncmFmaWNhJyA9PSByIHx8ICdwYWdhbWVudG8nID09IHIgPyBEYXRhTGF5ZXJJbnRlcm1lZGlhdGUgOiBEYXRhTGF5ZXJGaW5hbCkpLCAndHlwJyA9PSByICYmIChpLnN2NTQgPSBzLnB1cmNoYXNlSUQpLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdbQUxMXSBSZW1vdmUgcmVwbGljYXRkIHNjcmlwdHMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ3NjcmlwdCcpLCB0ID0gW10sIGEgPSAwOyBhIDwgZS5sZW5ndGg7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbYV0uZ2V0QXR0cmlidXRlKCdzcmMnKSAmJiBlW2FdLmdldEF0dHJpYnV0ZSgnc3JjJykubWF0Y2goL2Fzc2V0c1wuYWRvYmUvKSAmJiB0LnB1c2goZVthXS5nZXRBdHRyaWJ1dGUoJ3NyYycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHQubGVuZ3RoOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID09IHQuaW5kZXhPZih0W2ldKSAmJiB0LmluZGV4T2YodFtpXSkgPT0gdC5sYXN0SW5kZXhPZih0W2ldKSB8fCBuLnB1c2godFtpXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uc3BsaWNlKC0xLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IDA7IHIgPCBuLmxlbmd0aDsgcisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChhID0gMDsgYSA8IGUubGVuZ3RoOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVthXS5nZXRBdHRyaWJ1dGUoJ3NyYycpICYmIGVbYV0uZ2V0QXR0cmlidXRlKCdzcmMnKSA9PSBuW3JdICYmIGVbYV0ucGFyZW50Tm9kZS5yZW1vdmVDaGlsZChlW2FdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgJ0NhbmFsZSBkXCdhY3F1aXN0byc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VMb3dlckNhc2U6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5tb2JpbGVEVE1jaGVjayA/ICdtb2JpbGUgc2l0ZScgOiAnZGVza3RvcCBzaXRlJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgJ1tBT0xdIFByb2RvdHRpJzogewogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICdub19wcm9kO25vX3Byb2QnLAogICAgICAgICAgICAgICAgICAgICAgICBmb3JjZUxvd2VyQ2FzZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ3dpbmRvdy5EYXRhTGF5ZXInIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdbQU9MXSBQcm9kb3R0aSBGaW5hbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnbm9fcHJvZDtub19wcm9kJywKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VMb3dlckNhc2U6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICd3aW5kb3cuRGF0YUxheWVyRmluYWwnIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdbQU9MXSBFeGl0UHJvZHVjdCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VMb3dlckNhc2U6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICd3aW5kb3cuZXhpdHByb2R1Y3QnIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdbQU9MXSBBZGZvcm0gdHJhY2tpbmcgQkInOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19wcm9tb2NvZGUnKSwgdCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQU9MXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIENvZHByb21vJyksIGEgPSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfb2ZmZXJ0eXBlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3YxOiBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN2MzogZSB8fCB0ID8gZSB8fCB0IDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdjQ6IGEgfHwgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdjU6IHMucGFnZU5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdjY6IGxvY2F0aW9uLmhyZWYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdjg6IHMuY2hhbm5lbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN2OTogcy5wcm9wNTksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdjEwOiBzLnByb3A2MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN2MTE6IGRvY3VtZW50LnJlZmVycmVyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3YxMjogJ3NlbGV6aW9uYScgPT0gbiA/ICdQYWNjaGV0dGknIDogJ2FuYWdyYWZpY2EnID09IG4gPyAnQW5hZ3JhZmljYScgOiAncGFnYW1lbnRvJyA9PSBuID8gJ1BhZ2FtZW50bycgOiAnZG9jdW1lbnRpJyA9PSBuID8gJ0RvY3VtZW50aScgOiAncmllcGlsb2dvJyA9PSBuID8gJ1JpZXBpbG9nbycgOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN2MTM6IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3YxNDogYSB8fCAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3R5cCcgPT0gbiAmJiAoci5vcmRlcmlkID0gcy5wdXJjaGFzZUlEKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGV4dGVuc2lvbnM6IHsKICAgICAgICAgICAgICAgICAgICBjb3JlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQ29yZScsCiAgICAgICAgICAgICAgICAgICAgICAgIGhvc3RlZExpYkZpbGVzQmFzZVVybDogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS9leHRlbnNpb25zL0VQYzE4ODE5YTNhZThlNDQ3Y2FlOTc5MzdkZDA4ZTYwZTMvJywKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdqYXZhc2NyaXB0LXZhcmlhYmxlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0phdmFTY3JpcHQgVmFyaWFibGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEoJy4uL2hlbHBlcnMvZ2V0T2JqZWN0UHJvcGVydHkuanMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKHdpbmRvdywgZS5wYXRoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY3VzdG9tLWNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQ3VzdG9tIENvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc291cmNlKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9xdWVyeVN0cmluZ1BhcmFtZXRlci5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncXVlcnktc3RyaW5nLXBhcmFtZXRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdRdWVyeSBTdHJpbmcgUGFyYW1ldGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgciA9IGEoJ0BhZG9iZS9yZWFjdG9yLXF1ZXJ5LXN0cmluZycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSByLnBhcnNlKG4ubG9jYXRpb24uc2VhcmNoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5jYXNlSW5zZW5zaXRpdmUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbZS5uYW1lXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSBlLm5hbWUudG9Mb3dlckNhc2UoKSwgaSA9IE9iamVjdC5rZXlzKHQpLCBvID0gMDsgbyA8IGkubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGlbb107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMudG9Mb3dlckNhc2UoKSA9PT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbc107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2Nvb2tpZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY29va2llJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0Nvb2tpZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYSgnQGFkb2JlL3JlYWN0b3ItY29va2llJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5nZXQoZS5uYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZGlyZWN0LWNhbGwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnRGlyZWN0IENhbGwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuX3NhdGVsbGl0ZSA9IHdpbmRvdy5fc2F0ZWxsaXRlIHx8IHt9LCB3aW5kb3cuX3NhdGVsbGl0ZS50cmFjayA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZS50cmltKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHJbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZGVudGlmaWVyOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXRhaWw6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gWydSdWxlcyB1c2luZyB0aGUgZGlyZWN0IGNhbGwgZXZlbnQgdHlwZSB3aXRoIGlkZW50aWZpZXIgIicgKyBlICsgJyIgaGF2ZSBiZWVuIHRyaWdnZXJlZCcgKyAodCA/ICcgd2l0aCBhZGRpdGlvbmFsIGRldGFpbDonIDogJy4nKV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiBvLnB1c2godCksIG4ubG9nZ2VyLmxvZy5hcHBseShuLmxvZ2dlciwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmxvZ2dlci5sb2coJyInICsgZSArICciIGRvZXMgbm90IG1hdGNoIGFueSBkaXJlY3QgY2FsbCBpZGVudGlmaWVycy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gcltlLmlkZW50aWZpZXJdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSB8fCAoYSA9IHJbZS5pZGVudGlmaWVyXSA9IFtdKSwgYS5wdXNoKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY3VzdG9tLWNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQ3VzdG9tIENvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgaSwgbywgcywgYyA9IGEoJ0BhZG9iZS9yZWFjdG9yLWRvY3VtZW50JyksIGwgPSBhKCdAYWRvYmUvcmVhY3Rvci1wcm9taXNlJyksIHUgPSBhKCcuL2hlbHBlcnMvZGVjb3JhdGVDb2RlJyksIGQgPSBhKCcuL2hlbHBlcnMvbG9hZENvZGVTZXF1ZW50aWFsbHknKSwgcCA9IGEoJy4uLy4uLy4uL25vZGVfbW9kdWxlcy9wb3N0c2NyaWJlL2Rpc3QvcG9zdHNjcmliZScpLCBoID0gYSgnLi9oZWxwZXJzL3VuZXNjYXBlSHRtbENvZGUnKSwgZiA9IGEoJy4uL2hlbHBlcnMvZmluZFBhZ2VTY3JpcHQnKS5nZXRUdXJiaW5lLCBnID0gKGkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAoYy5ib2R5LCBlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlZm9yZVdyaXRlVG9rZW46IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudGFnTmFtZSAmJiBlLnRhZ05hbWUudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByICYmICdzY3JpcHQnID09PSB0ICYmIChlLmF0dHJzLm5vbmNlID0gciksICdzY3JpcHQnICE9PSB0ICYmICdzdHlsZScgIT09IHQgfHwgKE9iamVjdC5rZXlzKGUuYXR0cnMgfHwge30pLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmF0dHJzW3RdID0gaChlLmF0dHJzW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlLnNyYyAmJiAoZS5zcmMgPSBoKGUuc3JjKSkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ubG9nZ2VyLmVycm9yKGUubXNnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbyA9IFtdLCBzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjLmJvZHkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBvLmxlbmd0aDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKG8uc2hpZnQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KHMsIDIwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby5wdXNoKGUpLCBzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYy5jdXJyZW50U2NyaXB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5jdXJyZW50U2NyaXB0LmFzeW5jOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZSB8fCBlLmFzeW5jOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gbi5nZXRFeHRlbnNpb25TZXR0aW5ncygpLmNzcE5vbmNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8gPSBpLnNldHRpbmdzLnNvdXJjZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLnNldHRpbmdzLmlzRXh0ZXJuYWwgPyBkKG8pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPyAoYSA9IHUoaSwgZSksIGcoYS5jb2RlKSwgYS5wcm9taXNlKSA6IGwucmVzb2x2ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogKGEgPSB1KGksIG8pLCBtIHx8ICdsb2FkaW5nJyAhPT0gYy5yZWFkeVN0YXRlID8gZyhhLmNvZGUpIDogYy53cml0ZSAmJiAhMSA9PT0gbi5wcm9wZXJ0eVNldHRpbmdzLnJ1bGVDb21wb25lbnRTZXF1ZW5jaW5nRW5hYmxlZCA/IGMud3JpdGUoYS5jb2RlKSA6IGcoYS5jb2RlKSwgYS5wcm9taXNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZG9tYWluJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0RvbWFpbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYSgnQGFkb2JlL3JlYWN0b3ItZG9jdW1lbnQnKSwgciA9IC9bfFxce30oKVtcXV4kKyo/Li1dL2csIGkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignRXhwZWN0ZWQgYSBzdHJpbmcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZXBsYWNlKHIsICdcXCQmJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuLmxvY2F0aW9uLmhvc3RuYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZG9tYWlucy5zb21lKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQubWF0Y2gobmV3IFJlZ0V4cCgnKF58XFwuKScgKyBpKGUpICsgJyQnLCAnaScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY3VzdG9tLWNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQ3VzdG9tIENvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc291cmNlLmNhbGwodC5lbGVtZW50LCB0LCB0LnRhcmdldCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjbGljaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdDbGljaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYSgnQGFkb2JlL3JlYWN0b3Itd2luZG93JyksIHIgPSBhKCcuL2hlbHBlcnMvY3JlYXRlQnViYmx5JykoKSwgaSA9IG5ldyAoYSgnLi9oZWxwZXJzL3dlYWtNYXAnKSkoKSwgbyA9IDIsIHMgPSBhKCcuLi9oZWxwZXJzL3N0cmluZ0FuZE51bWJlclV0aWxzJykuY2FzdFRvTnVtYmVySWZTdHJpbmcsIGMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5jdHJsS2V5ICYmICFlLm1ldGFLZXkgJiYgZS5idXR0b24gIT09IG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBlLnRhcmdldDsgdDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdC50YWdOYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEgJiYgJ2EnID09PSBhLnRvTG93ZXJDYXNlKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQuZ2V0QXR0cmlidXRlKCdocmVmJyksIGkgPSB0LmdldEF0dHJpYnV0ZSgndGFyZ2V0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgJiYgKCFpIHx8ICdfc2VsZicgPT09IGkgfHwgJ190b3AnID09PSBpICYmIG4udG9wID09PSBuIHx8IGkgPT09IG4ubmFtZSkgPyB0IDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQucGFyZW50Tm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCByLmV2YWx1YXRlRXZlbnQsICEwKSwgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuYWRkTGlzdGVuZXIoZSwgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGEubmF0aXZlRXZlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyLnNfZmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBzKGUuYW5jaG9yRGVsYXkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobyAmJiAhaS5oYXMocikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gYyhyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgJiYgKHIucHJldmVudERlZmF1bHQoKSwgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5sb2NhdGlvbiA9IGwuaHJlZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8pKSwgaS5zZXQociwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZXhwb3J0cy5fX3Jlc2V0ID0gci5fX3Jlc2V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9kb21SZWFkeS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZG9tLXJlYWR5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0RPTSBSZWFkeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYSgnLi9oZWxwZXJzL3BhZ2VMaWZlY3ljbGVFdmVudHMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucmVnaXN0ZXJEb21SZWFkeVRyaWdnZXIodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL2xpYnJhcnlMb2FkZWQuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2xpYnJhcnktbG9hZGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0xpYnJhcnkgTG9hZGVkIChQYWdlIFRvcCknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEoJy4vaGVscGVycy9wYWdlTGlmZWN5Y2xlRXZlbnRzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnJlZ2lzdGVyTGlicmFyeUxvYWRlZFRyaWdnZXIodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3BhZ2UtYm90dG9tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ1BhZ2UgQm90dG9tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhKCcuL2hlbHBlcnMvcGFnZUxpZmVjeWNsZUV2ZW50cycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5yZWdpc3RlclBhZ2VCb3R0b21UcmlnZ2VyKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvcGF0aC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncGF0aCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdQYXRoIFdpdGhvdXQgUXVlcnkgU3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhKCdAYWRvYmUvcmVhY3Rvci1kb2N1bWVudCcpLCByID0gYSgnLi4vaGVscGVycy90ZXh0TWF0Y2gnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbi5sb2NhdGlvbi5wYXRobmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnBhdGhzLnNvbWUoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUudmFsdWVJc1JlZ2V4ID8gbmV3IFJlZ0V4cChlLnZhbHVlLCAnaScpIDogZS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2hlbHBlcnMvZ2V0T2JqZWN0UHJvcGVydHkuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gdC5zcGxpdCgnLicpLCBuID0gZSwgciA9IDAsIGkgPSBhLmxlbmd0aDsgciA8IGk7IHIrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gblthW3JdXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2FjdGlvbnMvaGVscGVycy9kZWNvcmF0ZUNvZGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYSgnLi9kZWNvcmF0b3JzL2RlY29yYXRlR2xvYmFsSmF2YVNjcmlwdENvZGUnKSwgciA9IGEoJy4vZGVjb3JhdG9ycy9kZWNvcmF0ZU5vbkdsb2JhbEphdmFTY3JpcHRDb2RlJyksIGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamF2YXNjcmlwdDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc2V0dGluZ3MuZ2xvYmFsID8gbihlLCB0KSA6IHIoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBodG1sOiBhKCcuL2RlY29yYXRvcnMvZGVjb3JhdGVIdG1sQ29kZScpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlbZS5zZXR0aW5ncy5sYW5ndWFnZV0oZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvYWN0aW9ucy9oZWxwZXJzL2xvYWRDb2RlU2VxdWVudGlhbGx5LmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEoJ0BhZG9iZS9yZWFjdG9yLXByb21pc2UnKSwgciA9IGEoJy4vZ2V0U291cmNlQnlVcmwnKSwgaSA9IG4ucmVzb2x2ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuZXcgbihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmFsbChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgPSB0LCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9ub2RlX21vZHVsZXMvcG9zdHNjcmliZS9kaXN0L3Bvc3RzY3JpYmUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IHRoaXMsIG4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFbbl0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYVtuXS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGFbbl0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBvcnRzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9hZGVkOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtuXS5jYWxsKHIuZXhwb3J0cywgciwgci5leHBvcnRzLCB0KSwgci5sb2FkZWQgPSAhMCwgci5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lm0gPSBlLCB0LmMgPSBhLCB0LnAgPSAnJywgdCgwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLl9fZXNNb2R1bGUgPyBlIDogeyBkZWZhdWx0OiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuKGEoMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByLmRlZmF1bHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZS5fX2VzTW9kdWxlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSwgYSkgJiYgKHRbYV0gPSBlW2FdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmRlZmF1bHQgPSBlLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5fX2VzTW9kdWxlID8gZSA6IHsgZGVmYXVsdDogZSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZi5zaGlmdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGQubGFzdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmFmdGVyRGVxdWV1ZSgpLCBlLnN0cmVhbSA9IHMuYXBwbHkodm9pZCAwLCBlKSwgdC5hZnRlclN0cmVhbVN0YXJ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gYS5iZWZvcmVXcml0ZShlKSwgZy53cml0ZShlKSwgYS5hZnRlcldyaXRlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGcgPSBuZXcgdS5kZWZhdWx0KGUsIGEpKS5pZCA9IGgrKywgZy5uYW1lID0gYS5uYW1lIHx8IGcuaWQsIGMuc3RyZWFtc1tnLm5hbWVdID0gZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5vd25lckRvY3VtZW50LCBzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbG9zZTogci5jbG9zZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3Blbjogci5vcGVuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0ZTogci53cml0ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGVsbjogci53cml0ZWxuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwociwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsb3NlOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wZW46IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGgsIHQgPSBBcnJheShlKSwgYSA9IDA7IGEgPCBlOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W2FdID0gYXJndW1lbnRzW2FdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbih0LmpvaW4oJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlbG46IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGgsIHQgPSBBcnJheShlKSwgYSA9IDA7IGEgPCBlOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W2FdID0gYXJndW1lbnRzW2FdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbih0LmpvaW4oJycpICsgJ1xuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGcud2luLm9uZXJyb3IgfHwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnLndpbi5vbmVycm9yID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmVycm9yKHsgbXNnOiBlICsgJyAtICcgKyB0ICsgJzogJyArIG4gfSksIGQuYXBwbHkoZy53aW4sIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZy53cml0ZSh0LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbChyLCBzKSwgZy53aW4ub25lcnJvciA9IGQsIGEuZG9uZSgpLCBnID0gbnVsbCwgbygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZC5pc0Z1bmN0aW9uKGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB7IGRvbmU6IGEgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCdjbGVhcicgPT09IGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYgPSBbXSwgZyA9IG51bGwsIHZvaWQgKGggPSAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBkLmRlZmF1bHRzKGEsIHApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IC9eIy8udGVzdChlKSA/IHdpbmRvdy5kb2N1bWVudC5nZXRFbGVtZW50QnlJZChlLnN1YnN0cigxKSkgOiBlLmpxdWVyeSA/IGVbMF0gOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnBvc3RzY3JpYmUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuY2VsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uc3RyZWFtID8gbi5zdHJlYW0uYWJvcnQoKSA6IG5bMV0gPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEuYmVmb3JlRW5xdWV1ZShuKSwgZi5wdXNoKG4pLCBnIHx8IG8oKSwgZS5wb3N0c2NyaWJlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuX19lc01vZHVsZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBhcmd1bWVudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgbikgJiYgKGVbbl0gPSBhW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmRlZmF1bHQgPSBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHIoYSgyKSksIGQgPSBuKGEoNCkpLCBwID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFmdGVyQXN5bmM6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWZ0ZXJEZXF1ZXVlOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFmdGVyU3RyZWFtU3RhcnQ6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWZ0ZXJXcml0ZTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdXRvRml4OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiZWZvcmVFbnF1ZXVlOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlZm9yZVdyaXRlVG9rZW46IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmVmb3JlV3JpdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGUubXNnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbGVhc2VBc3luYzogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGggPSAwLCBmID0gW10sIGcgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsKGMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmVhbXM6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVldWU6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXcml0ZVN0cmVhbTogdS5kZWZhdWx0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICYmIGUuX19lc01vZHVsZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsIGEpICYmICh0W2FdID0gZVthXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5kZWZhdWx0ID0gZSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGUuX19lc01vZHVsZSA/IGUgOiB7IGRlZmF1bHQ6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdDYW5ub3QgY2FsbCBhIGNsYXNzIGFzIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gcCArIHQsIG4gPSBlLmdldEF0dHJpYnV0ZShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1LmV4aXN0eShuKSA/IFN0cmluZyhuKSA6IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzJdID8gYXJndW1lbnRzWzJdIDogbnVsbCwgbiA9IHAgKyB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5leGlzdHkoYSkgJiYgJycgIT09IGEgPyBlLnNldEF0dHJpYnV0ZShuLCBhKSA6IGUucmVtb3ZlQXR0cmlidXRlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuX19lc01vZHVsZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGFyZ3VtZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGEsIG4pICYmIChlW25dID0gYVtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbCA9IHIoYSgzKSksIHUgPSBuKGEoNCkpLCBkID0gITEsIHAgPSAnZGF0YS1wcy0nLCBoID0gJ3BzLXN0eWxlJywgZiA9ICdwcy1zY3JpcHQnLCBnID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkodGhpcywgZSksIHRoaXMucm9vdCA9IHQsIHRoaXMub3B0aW9ucyA9IGEsIHRoaXMuZG9jID0gdC5vd25lckRvY3VtZW50LCB0aGlzLndpbiA9IHRoaXMuZG9jLmRlZmF1bHRWaWV3IHx8IHRoaXMuZG9jLnBhcmVudFdpbmRvdywgdGhpcy5wYXJzZXIgPSBuZXcgbC5kZWZhdWx0KCcnLCB7IGF1dG9GaXg6IGEuYXV0b0ZpeCB9KSwgdGhpcy5hY3R1YWxzID0gW3RdLCB0aGlzLnByb3h5SGlzdG9yeSA9ICcnLCB0aGlzLnByb3h5Um9vdCA9IHRoaXMuZG9jLmNyZWF0ZUVsZW1lbnQodC5ub2RlTmFtZSksIHRoaXMuc2NyaXB0U3RhY2sgPSBbXSwgdGhpcy53cml0ZVF1ZXVlID0gW10sIHModGhpcy5wcm94eVJvb3QsICdwcm94eW9mJywgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS53cml0ZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoKGUgPSB0aGlzLndyaXRlUXVldWUpLnB1c2guYXBwbHkoZSwgYXJndW1lbnRzKTsgIXRoaXMuZGVmZXJyZWRSZW1vdGUgJiYgdGhpcy53cml0ZVF1ZXVlLmxlbmd0aDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcy53cml0ZVF1ZXVlLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LmlzRnVuY3Rpb24odCkgPyB0aGlzLl9jYWxsRnVuY3Rpb24odCkgOiB0aGlzLl93cml0ZUltcGwodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fY2FsbEZ1bmN0aW9uID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnZnVuY3Rpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGUubmFtZSB8fCBlLnRvU3RyaW5nKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fb25TY3JpcHRTdGFydCh0KSwgZS5jYWxsKHRoaXMud2luLCB0aGlzLmRvYyksIHRoaXMuX29uU2NyaXB0RG9uZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fd3JpdGVJbXBsID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wYXJzZXIuYXBwZW5kKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gdm9pZCAwLCBhID0gdm9pZCAwLCBuID0gdm9pZCAwLCByID0gW107ICh0ID0gdGhpcy5wYXJzZXIucmVhZFRva2VuKCkpICYmICEoYSA9IHUuaXNTY3JpcHQodCkpICYmICEobiA9IHUuaXNTdHlsZSh0KSk7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHQgPSB0aGlzLm9wdGlvbnMuYmVmb3JlV3JpdGVUb2tlbih0KSkgJiYgci5wdXNoKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmxlbmd0aCA+IDAgJiYgdGhpcy5fd3JpdGVTdGF0aWNUb2tlbnMociksIGEgJiYgdGhpcy5faGFuZGxlU2NyaXB0VG9rZW4odCksIG4gJiYgdGhpcy5faGFuZGxlU3R5bGVUb2tlbih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fd3JpdGVTdGF0aWNUb2tlbnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMuX2J1aWxkQ2h1bmsoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFjdHVhbCA/ICh0Lmh0bWwgPSB0aGlzLnByb3h5SGlzdG9yeSArIHQuYWN0dWFsLCB0aGlzLnByb3h5SGlzdG9yeSArPSB0LnByb3h5LCB0aGlzLnByb3h5Um9vdC5pbm5lckhUTUwgPSB0Lmh0bWwsIGQgJiYgKHQucHJveHlJbm5lckhUTUwgPSB0aGlzLnByb3h5Um9vdC5pbm5lckhUTUwpLCB0aGlzLl93YWxrQ2h1bmsoKSwgZCAmJiAodC5hY3R1YWxJbm5lckhUTUwgPSB0aGlzLnJvb3QuaW5uZXJIVE1MKSwgdCkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9idWlsZENodW5rID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHRoaXMuYWN0dWFscy5sZW5ndGgsIGEgPSBbXSwgbiA9IFtdLCByID0gW10sIGkgPSBlLmxlbmd0aCwgbyA9IDA7IG8gPCBpOyBvKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gZVtvXSwgYyA9IHMudG9TdHJpbmcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLnB1c2goYyksIHMuYXR0cnMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIS9ebm9zY3JpcHQkL2kudGVzdChzLnRhZ05hbWUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gdCsrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnB1c2goYy5yZXBsYWNlKC8oXC8/PikvLCAnICcgKyBwICsgJ2lkPScgKyBsICsgJyAkMScpKSwgcy5hdHRycy5pZCAhPT0gZiAmJiBzLmF0dHJzLmlkICE9PSBoICYmIHIucHVzaCgnYXRvbWljVGFnJyA9PT0gcy50eXBlID8gJycgOiAnPCcgKyBzLnRhZ05hbWUgKyAnICcgKyBwICsgJ3Byb3h5b2Y9JyArIGwgKyAocy51bmFyeSA/ICcgLz4nIDogJz4nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoKGMpLCByLnB1c2goJ2VuZFRhZycgPT09IHMudHlwZSA/IGMgOiAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRva2VuczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJhdzogYS5qb2luKCcnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdHVhbDogbi5qb2luKCcnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3h5OiByLmpvaW4oJycpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX3dhbGtDaHVuayA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHZvaWQgMCwgdCA9IFt0aGlzLnByb3h5Um9vdF07IHUuZXhpc3R5KGUgPSB0LnNoaWZ0KCkpOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAxID09PSBlLm5vZGVUeXBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8ICFvKGUsICdwcm94eW9mJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhICYmICh0aGlzLmFjdHVhbHNbbyhlLCAnaWQnKV0gPSBlLCBzKGUsICdpZCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUucGFyZW50Tm9kZSAmJiBvKGUucGFyZW50Tm9kZSwgJ3Byb3h5b2YnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIHRoaXMuYWN0dWFsc1tuXS5hcHBlbmRDaGlsZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudW5zaGlmdC5hcHBseSh0LCB1LnRvQXJyYXkoZS5jaGlsZE5vZGVzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5faGFuZGxlU2NyaXB0VG9rZW4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMsIGEgPSB0aGlzLnBhcnNlci5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhICYmIHRoaXMud3JpdGVRdWV1ZS51bnNoaWZ0KGEpLCBlLnNyYyA9IGUuYXR0cnMuc3JjIHx8IGUuYXR0cnMuU1JDLCAoZSA9IHRoaXMub3B0aW9ucy5iZWZvcmVXcml0ZVRva2VuKGUpKSAmJiAoZS5zcmMgJiYgdGhpcy5zY3JpcHRTdGFjay5sZW5ndGggPyB0aGlzLmRlZmVycmVkUmVtb3RlID0gZSA6IHRoaXMuX29uU2NyaXB0U3RhcnQoZSksIHRoaXMuX3dyaXRlU2NyaXB0VG9rZW4oZSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5fb25TY3JpcHREb25lKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX2hhbmRsZVN0eWxlVG9rZW4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMucGFyc2VyLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgdGhpcy53cml0ZVF1ZXVlLnVuc2hpZnQodCksIGUudHlwZSA9IGUuYXR0cnMudHlwZSB8fCBlLmF0dHJzLlRZUEUgfHwgJ3RleHQvY3NzJywgKGUgPSB0aGlzLm9wdGlvbnMuYmVmb3JlV3JpdGVUb2tlbihlKSkgJiYgdGhpcy5fd3JpdGVTdHlsZVRva2VuKGUpLCB0ICYmIHRoaXMud3JpdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fd3JpdGVTdHlsZVRva2VuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLl9idWlsZFN0eWxlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9pbnNlcnRDdXJzb3IodCwgaCksIGUuY29udGVudCAmJiAodC5zdHlsZVNoZWV0ICYmICF0LnNoZWV0ID8gdC5zdHlsZVNoZWV0LmNzc1RleHQgPSBlLmNvbnRlbnQgOiB0LmFwcGVuZENoaWxkKHRoaXMuZG9jLmNyZWF0ZVRleHROb2RlKGUuY29udGVudCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fYnVpbGRTdHlsZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcy5kb2MuY3JlYXRlRWxlbWVudChlLnRhZ05hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5zZXRBdHRyaWJ1dGUoJ3R5cGUnLCBlLnR5cGUpLCB1LmVhY2hLZXkoZS5hdHRycywgZnVuY3Rpb24gKGUsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2V0QXR0cmlidXRlKGUsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5faW5zZXJ0Q3Vyc29yID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fd3JpdGVJbXBsKCc8c3BhbiBpZD0iJyArIHQgKyAnIi8+Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5kb2MuZ2V0RWxlbWVudEJ5SWQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgJiYgYS5wYXJlbnROb2RlLnJlcGxhY2VDaGlsZChlLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fb25TY3JpcHRTdGFydCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUub3V0ZXJXcml0ZXMgPSB0aGlzLndyaXRlUXVldWUsIHRoaXMud3JpdGVRdWV1ZSA9IFtdLCB0aGlzLnNjcmlwdFN0YWNrLnVuc2hpZnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX29uU2NyaXB0RG9uZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPT09IHRoaXMuc2NyaXB0U3RhY2tbMF0gPyAodGhpcy5zY3JpcHRTdGFjay5zaGlmdCgpLCB0aGlzLndyaXRlLmFwcGx5KHRoaXMsIGUub3V0ZXJXcml0ZXMpLCAhdGhpcy5zY3JpcHRTdGFjay5sZW5ndGggJiYgdGhpcy5kZWZlcnJlZFJlbW90ZSAmJiAodGhpcy5fb25TY3JpcHRTdGFydCh0aGlzLmRlZmVycmVkUmVtb3RlKSwgdGhpcy5kZWZlcnJlZFJlbW90ZSA9IG51bGwpKSA6IHRoaXMub3B0aW9ucy5lcnJvcih7IG1zZzogJ0JhZCBzY3JpcHQgbmVzdGluZyBvciBzY3JpcHQgZmluaXNoZWQgdHdpY2UnIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl93cml0ZVNjcmlwdFRva2VuID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLl9idWlsZFNjcmlwdChlKSwgbiA9IHRoaXMuX3Nob3VsZFJlbGVhc2UoYSksIHIgPSB0aGlzLm9wdGlvbnMuYWZ0ZXJBc3luYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zcmMgJiYgKGEuc3JjID0gZS5zcmMsIHRoaXMuX3NjcmlwdExvYWRIYW5kbGVyKGEsIG4gPyByIDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCgpLCByKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2luc2VydEN1cnNvcihhLCBmKSwgYS5zcmMgJiYgIW4gfHwgdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm9wdGlvbnMuZXJyb3IoZSksIHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9idWlsZFNjcmlwdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcy5kb2MuY3JlYXRlRWxlbWVudChlLnRhZ05hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdS5lYWNoS2V5KGUuYXR0cnMsIGZ1bmN0aW9uIChlLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNldEF0dHJpYnV0ZShlLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGUuY29udGVudCAmJiAodC50ZXh0ID0gZS5jb250ZW50KSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fc2NyaXB0TG9hZEhhbmRsZXIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUub25sb2FkID0gZS5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBlLm9uZXJyb3IgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKCksIG51bGwgIT0gdCAmJiB0KCksIHQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSgpLCBvKGUpLCBudWxsICE9IHQgJiYgdCgpLCB0ID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZVsnb24nICsgdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IGEgJiYgKGVbJ19vbicgKyB0XSA9IGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdGhpcy5vcHRpb25zLmVycm9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKGUsICdsb2FkJyksIGkoZSwgJ2Vycm9yJyksIGMoZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25sb2FkOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuX29ubG9hZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX29ubG9hZC5hcHBseSh0aGlzLCBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcih7IG1zZzogJ29ubG9hZCBoYW5kbGVyIGZhaWxlZCAnICsgdCArICcgQCAnICsgZS5zcmMgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25lcnJvcjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLl9vbmVycm9yKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fb25lcnJvci5hcHBseSh0aGlzLCBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgcih7IG1zZzogJ29uZXJyb3IgaGFuZGxlciBmYWlsZWQgJyArIHQgKyAnIEAgJyArIGUuc3JjIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcih7IG1zZzogJ3JlbW90ZSBzY3JpcHQgZmFpbGVkICcgKyBlLnNyYyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbnJlYWR5c3RhdGVjaGFuZ2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvXihsb2FkZWR8Y29tcGxldGUpJC8udGVzdChlLnJlYWR5U3RhdGUpICYmIG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX3Nob3VsZFJlbGVhc2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIS9ec2NyaXB0JC9pLnRlc3QoZS5ub2RlTmFtZSkgfHwgISEodGhpcy5vcHRpb25zLnJlbGVhc2VBc3luYyAmJiBlLnNyYyAmJiBlLmhhc0F0dHJpYnV0ZSgnYXN5bmMnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5kZWZhdWx0ID0gZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhW25dKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbbl0uZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBhW25dID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwb3J0czoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvYWRlZDogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbbl0uY2FsbChyLmV4cG9ydHMsIHIsIHIuZXhwb3J0cywgdCksIHIubG9hZGVkID0gITAsIHIuZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5tID0gZSwgdC5jID0gYSwgdC5wID0gJycsIHQoMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5fX2VzTW9kdWxlID8gZSA6IHsgZGVmYXVsdDogZSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbihhKDEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gci5kZWZhdWx0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGUuX19lc01vZHVsZSA/IGUgOiB7IGRlZmF1bHQ6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICYmIGUuX19lc01vZHVsZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsIGEpICYmICh0W2FdID0gZVthXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5kZWZhdWx0ID0gZSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdDYW5ub3QgY2FsbCBhIGNsYXNzIGFzIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ll9fZXNNb2R1bGUgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByKGEoMikpLCBzID0gcihhKDMpKSwgYyA9IG4oYSg2KSksIGwgPSBhKDUpLCB1ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1lbnQ6IC9ePCEtLS8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGFnOiAvXjxcLy8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXRvbWljVGFnOiAvXjxccyooc2NyaXB0fHN0eWxlfG5vc2NyaXB0fGlmcmFtZXx0ZXh0YXJlYSlbXHNcLz5dL2ksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUYWc6IC9ePC8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhcnM6IC9eW148XS8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLCBhID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiAnJywgbiA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkodGhpcywgZSksIHRoaXMuc3RyZWFtID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAhMSwgcyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBsIGluIG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLmhhc093blByb3BlcnR5KGwpICYmIChuLmF1dG9GaXggJiYgKHNbbCArICdGaXgnXSA9ICEwKSwgciA9IHIgfHwgc1tsICsgJ0ZpeCddKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA/ICh0aGlzLl9yZWFkVG9rZW4gPSAoMCwgYy5kZWZhdWx0KSh0aGlzLCBzLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5fcmVhZFRva2VuSW1wbCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5fcGVla1Rva2VuID0gKDAsIGMuZGVmYXVsdCkodGhpcywgcywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuX3BlZWtUb2tlbkltcGwoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIDogKHRoaXMuX3JlYWRUb2tlbiA9IHRoaXMuX3JlYWRUb2tlbkltcGwsIHRoaXMuX3BlZWtUb2tlbiA9IHRoaXMuX3BlZWtUb2tlbkltcGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuYXBwZW5kID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdHJlYW0gKz0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5wcmVwZW5kID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdHJlYW0gPSBlICsgdGhpcy5zdHJlYW07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX3JlYWRUb2tlbkltcGwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5fcGVla1Rva2VuSW1wbCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0cmVhbSA9IHRoaXMuc3RyZWFtLnNsaWNlKGUubGVuZ3RoKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fcGVla1Rva2VuSW1wbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSBpbiB1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUuaGFzT3duUHJvcGVydHkoZSkgJiYgdVtlXS50ZXN0KHRoaXMuc3RyZWFtKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gc1tlXSh0aGlzLnN0cmVhbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RhcnRUYWcnID09PSB0LnR5cGUgJiYgL3NjcmlwdHxzdHlsZS9pLnRlc3QodC50YWdOYW1lKSA/IG51bGwgOiAodC50ZXh0ID0gdGhpcy5zdHJlYW0uc3Vic3RyKDAsIHQubGVuZ3RoKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUucGVla1Rva2VuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fcGVla1Rva2VuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUucmVhZFRva2VuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fcmVhZFRva2VuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUucmVhZFRva2VucyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSB2b2lkIDA7IHQgPSB0aGlzLnJlYWRUb2tlbigpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlW3QudHlwZV0gJiYgITEgPT09IGVbdC50eXBlXSh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuY2xlYXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5zdHJlYW07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0cmVhbSA9ICcnLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnJlc3QgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0cmVhbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBwIGluICh0LmRlZmF1bHQgPSBkLCBkLnRva2VuVG9TdHJpbmcgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkLmVzY2FwZUF0dHJpYnV0ZXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmhhc093blByb3BlcnR5KGEpICYmICh0W2FdID0gKDAsIGwuZXNjYXBlUXVvdGVzKShlW2FdLCBudWxsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkLnN1cHBvcnRzID0gbywgbykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLmhhc093blByb3BlcnR5KHApICYmIChkLmJyb3dzZXJIYXNGbGF3ID0gZC5icm93c2VySGFzRmxhdyB8fCAhb1twXSAmJiBwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5fX2VzTW9kdWxlID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gITEsIG4gPSAhMSwgciA9IHdpbmRvdy5kb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gJzxQPjxJPjwvUD48L0k+JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaW5uZXJIVE1MID0gaSwgdC50YWdTb3VwID0gYSA9IHIuaW5uZXJIVE1MICE9PSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnRhZ1NvdXAgPSBhID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaW5uZXJIVE1MID0gJzxQPjxpPjxQPjwvUD48L2k+PC9QPicsIHQuc2VsZkNsb3NlID0gbiA9IDIgPT09IHIuY2hpbGROb2Rlcy5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2VsZkNsb3NlID0gbiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBudWxsLCB0LnRhZ1NvdXAgPSBhLCB0LnNlbGZDbG9zZSA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmluZGV4T2YoJy0tPicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPj0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGwuQ29tbWVudFRva2VuKGUuc3Vic3RyKDQsIHQgLSAxKSwgdCArIDMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmluZGV4T2YoJzwnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgbC5DaGFyc1Rva2VuKHQgPj0gMCA/IHQgOiBlLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgYSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtMSAhPT0gZS5pbmRleE9mKCc+JykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUubWF0Y2godS5zdGFydFRhZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAodCA9IHt9LCBhID0ge30sIG4gPSByWzJdLCByWzJdLnJlcGxhY2UodS5hdHRyLCBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJndW1lbnRzWzJdIHx8IGFyZ3VtZW50c1szXSB8fCBhcmd1bWVudHNbNF0gfHwgYXJndW1lbnRzWzVdID8gYXJndW1lbnRzWzVdID8gKHRbYXJndW1lbnRzWzVdXSA9ICcnLCBhW2FyZ3VtZW50c1s1XV0gPSAhMCkgOiB0W3JdID0gYXJndW1lbnRzWzJdIHx8IGFyZ3VtZW50c1szXSB8fCBhcmd1bWVudHNbNF0gfHwgdS5maWxsQXR0ci50ZXN0KHIpICYmIHIgfHwgJycgOiB0W3JdID0gJycsIG4gPSBuLnJlcGxhY2UoZSwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgeyB2OiBuZXcgbC5TdGFydFRhZ1Rva2VuKHJbMV0sIHJbMF0ubGVuZ3RoLCB0LCBhLCAhIXJbM10sIG4ucmVwbGFjZSgvXltcc1x1RkVGRlx4QTBdK3xbXHNcdUZFRkZceEEwXSskL2csICcnKSkgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gKHZvaWQgMCA9PT0gaSA/ICd1bmRlZmluZWQnIDogYyhpKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS52OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlLnNsaWNlKHQubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5tYXRjaChuZXcgUmVnRXhwKCc8L1xccyonICsgdC50YWdOYW1lICsgJ1xccyo+JywgJ2knKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhLm1hdGNoKG5ldyBSZWdFeHAoJyhbXFxzXFxTXSo/KTwvXFxzKicgKyB0LnRhZ05hbWUgKyAnXFxzKj4nLCAnaScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGwuQXRvbWljVGFnVG9rZW4odC50YWdOYW1lLCBuWzBdLmxlbmd0aCArIHQubGVuZ3RoLCB0LmF0dHJzLCB0LmJvb2xlYW5BdHRycywgblsxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLm1hdGNoKHUuZW5kVGFnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgbC5FbmRUYWdUb2tlbih0WzFdLCB0WzBdLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5fX2VzTW9kdWxlID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3IgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiBlLmNvbnN0cnVjdG9yID09PSBTeW1ib2wgJiYgZSAhPT0gU3ltYm9sLnByb3RvdHlwZSA/ICdzeW1ib2wnIDogdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuY29tbWVudCA9IG4sIHQuY2hhcnMgPSByLCB0LnN0YXJ0VGFnID0gaSwgdC5hdG9taWNUYWcgPSBvLCB0LmVuZFRhZyA9IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gYSg0KSwgdSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydFRhZzogL148KFtcLUEtWmEtejAtOV9dKykoKD86XHMrW1x3XC1dKyg/OlxzKj0/XHMqKD86KD86IlteIl0qIil8KD86J1teJ10qJyl8W14+XHNdKykpPykqKVxzKihcLz8pPi8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGFnOiAvXjxcLyhbXC1BLVphLXowLTlfXSspW14+XSo+LywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHRyOiAvKD86KFtcLUEtWmEtejAtOV9dKylccyo9XHMqKD86KD86IigoPzpcXC58W14iXSkqKSIpfCg/OicoKD86XFwufFteJ10pKiknKXwoW14+XHNdKykpKXwoPzooW1wtQS1aYS16MC05X10rKShcc3wkKSspL2csCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsbEF0dHI6IC9eKGNoZWNrZWR8Y29tcGFjdHxkZWNsYXJlfGRlZmVyfGRpc2FibGVkfGlzbWFwfG11bHRpcGxlfG5vaHJlZnxub3Jlc2l6ZXxub3NoYWRlfG5vd3JhcHxyZWFkb25seXxzZWxlY3RlZCkkL2kKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoZSBpbnN0YW5jZW9mIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0Nhbm5vdCBjYWxsIGEgY2xhc3MgYXMgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuX19lc01vZHVsZSA9ICEwLCB0LkVuZFRhZ1Rva2VuID0gdC5BdG9taWNUYWdUb2tlbiA9IHQuU3RhcnRUYWdUb2tlbiA9IHQuVGFnVG9rZW4gPSB0LkNoYXJzVG9rZW4gPSB0LkNvbW1lbnRUb2tlbiA9IHQuVG9rZW4gPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gYSg1KSwgaSA9ICh0LlRva2VuID0gZnVuY3Rpb24gZSh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbih0aGlzLCBlKSwgdGhpcy50eXBlID0gdCwgdGhpcy5sZW5ndGggPSBhLCB0aGlzLnRleHQgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuQ29tbWVudFRva2VuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKHRoaXMsIGUpLCB0aGlzLnR5cGUgPSAnY29tbWVudCcsIHRoaXMubGVuZ3RoID0gYSB8fCAodCA/IHQubGVuZ3RoIDogMCksIHRoaXMudGV4dCA9ICcnLCB0aGlzLmNvbnRlbnQgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnPCEtLScgKyB0aGlzLmNvbnRlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgdC5DaGFyc1Rva2VuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKHRoaXMsIGUpLCB0aGlzLnR5cGUgPSAnY2hhcnMnLCB0aGlzLmxlbmd0aCA9IHQsIHRoaXMudGV4dCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRleHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgdC5UYWdUb2tlbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQsIGEsIHIsIGksIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbih0aGlzLCBlKSwgdGhpcy50eXBlID0gdCwgdGhpcy5sZW5ndGggPSByLCB0aGlzLnRleHQgPSAnJywgdGhpcy50YWdOYW1lID0gYSwgdGhpcy5hdHRycyA9IGksIHRoaXMuYm9vbGVhbkF0dHJzID0gbywgdGhpcy51bmFyeSA9ICExLCB0aGlzLmh0bWw1VW5hcnkgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZm9ybWF0VGFnID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IG51bGwsIGEgPSAnPCcgKyBlLnRhZ05hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZS5hdHRycykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmF0dHJzLmhhc093blByb3BlcnR5KG4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSArPSAnICcgKyBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZS5hdHRyc1tuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IGUuYm9vbGVhbkF0dHJzICYmIHZvaWQgMCAhPT0gZS5ib29sZWFuQXR0cnNbbl0gfHwgKGEgKz0gJz0iJyArICgwLCByLmVzY2FwZVF1b3RlcykoaSkgKyAnIicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZXN0ICYmIChhICs9ICcgJyArIGUucmVzdCksIGUudW5hcnkgJiYgIWUuaHRtbDVVbmFyeSA/IGEgKz0gJy8+JyA6IGEgKz0gJz4nLCBudWxsICE9IHQgJiYgKGEgKz0gdCArICc8LycgKyBlLnRhZ05hbWUgKyAnPicpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LlN0YXJ0VGFnVG9rZW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQsIGEsIHIsIGksIG8sIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKHRoaXMsIGUpLCB0aGlzLnR5cGUgPSAnc3RhcnRUYWcnLCB0aGlzLmxlbmd0aCA9IGEsIHRoaXMudGV4dCA9ICcnLCB0aGlzLnRhZ05hbWUgPSB0LCB0aGlzLmF0dHJzID0gciwgdGhpcy5ib29sZWFuQXR0cnMgPSBpLCB0aGlzLmh0bWw1VW5hcnkgPSAhMSwgdGhpcy51bmFyeSA9IG8sIHRoaXMucmVzdCA9IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuZm9ybWF0VGFnKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCB0LkF0b21pY1RhZ1Rva2VuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSh0LCBhLCByLCBpLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbih0aGlzLCBlKSwgdGhpcy50eXBlID0gJ2F0b21pY1RhZycsIHRoaXMubGVuZ3RoID0gYSwgdGhpcy50ZXh0ID0gJycsIHRoaXMudGFnTmFtZSA9IHQsIHRoaXMuYXR0cnMgPSByLCB0aGlzLmJvb2xlYW5BdHRycyA9IGksIHRoaXMudW5hcnkgPSAhMSwgdGhpcy5odG1sNVVuYXJ5ID0gITEsIHRoaXMuY29udGVudCA9IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuZm9ybWF0VGFnKHRoaXMsIHRoaXMuY29udGVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIHQuRW5kVGFnVG9rZW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKHRoaXMsIGUpLCB0aGlzLnR5cGUgPSAnZW5kVGFnJywgdGhpcy5sZW5ndGggPSBhLCB0aGlzLnRleHQgPSAnJywgdGhpcy50YWdOYW1lID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJzwvJyArIHRoaXMudGFnTmFtZSArICc+JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IGUucmVwbGFjZSgvKFteIl0qKSIvZywgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gL1xcLy50ZXN0KHQpID8gdCArICciJyA6IHQgKyAnXFwiJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ll9fZXNNb2R1bGUgPSAhMCwgdC5lc2NhcGVRdW90ZXMgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdzdGFydFRhZycgPT09IGUudHlwZSAmJiAoZS51bmFyeSA9IHMudGVzdChlLnRhZ05hbWUpIHx8IGUudW5hcnksIGUuaHRtbDVVbmFyeSA9ICEvXC8+JC8udGVzdChlLnRleHQpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5zdHJlYW0sIHIgPSBhKHQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdHJlYW0gPSBuLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0LnBvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmVwZW5kKCc8LycgKyBhLnRhZ05hbWUgKyAnPicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubGFzdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t0aGlzLmxlbmd0aCAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5sYXN0VGFnTmFtZUVxID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMubGFzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIHQudGFnTmFtZSAmJiB0LnRhZ05hbWUudG9VcHBlckNhc2UoKSA9PT0gZS50b1VwcGVyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5jb250YWluc1RhZ05hbWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQsIGEgPSAwOyB0ID0gdGhpc1thXTsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC50YWdOYW1lID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlLCB0LCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbihlLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIHVbdC50eXBlXSAmJiB1W3QudHlwZV0odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGkoKSwgdSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUYWc6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEudGFnTmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUUicgPT09IG4udG9VcHBlckNhc2UoKSAmJiBsLmxhc3RUYWdOYW1lRXEoJ1RBQkxFJykgPyAoZS5wcmVwZW5kKCc8VEJPRFk+JyksIHMoKSkgOiB0LnNlbGZDbG9zZUZpeCAmJiBjLnRlc3QobikgJiYgbC5jb250YWluc1RhZ05hbWUobikgPyBsLmxhc3RUYWdOYW1lRXEobikgPyByKGUsIGwpIDogKGUucHJlcGVuZCgnPC8nICsgYS50YWdOYW1lICsgJz4nKSwgcygpKSA6IGEudW5hcnkgfHwgbC5wdXNoKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmRUYWc6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLmxhc3QoKSA/IHQudGFnU291cEZpeCAmJiAhbC5sYXN0VGFnTmFtZUVxKGEudGFnTmFtZSkgPyByKGUsIGwpIDogbC5wb3AoKSA6IHQudGFnU291cEZpeCAmJiAobygpLCBzKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMoKSwgYShvKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ll9fZXNNb2R1bGUgPSAhMCwgdC5kZWZhdWx0ID0gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSAvXihBUkVBfEJBU0V8QkFTRUZPTlR8QlJ8Q09MfEZSQU1FfEhSfElNR3xJTlBVVHxJU0lOREVYfExJTkt8TUVUQXxQQVJBTXxFTUJFRCkkL2ksIGMgPSAvXihDT0xHUk9VUHxERHxEVHxMSXxPUFRJT05TfFB8VER8VEZPT1R8VEh8VEhFQUR8VFIpJC9pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmV4cG9ydHMgPSB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB2b2lkIDAsIHIgPSBlICYmIGUubGVuZ3RoIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgcjsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuY2FsbChhLCBlW25dLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmhhc093blByb3BlcnR5KG4pICYmIHQuY2FsbChhLCBuLCBlW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gZSB8fCB7fSwgaSh0LCBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoZVt0XSkgfHwgKGVbdF0gPSBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAoYSA9IFtdLCByKGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgeyB2OiBhIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gKHZvaWQgMCA9PT0gdCA/ICd1bmRlZmluZWQnIDogcCh0KSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW2UubGVuZ3RoIC0gMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISghZSB8fCAnc3RhcnRUYWcnICE9PSBlLnR5cGUgJiYgJ2F0b21pY1RhZycgIT09IGUudHlwZSB8fCAhKCd0YWdOYW1lJyBpbiBlKSB8fCAhfmUudGFnTmFtZS50b0xvd2VyQ2FzZSgpLmluZGV4T2YodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwoZSwgJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwoZSwgJ3N0eWxlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5fX2VzTW9kdWxlID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3IgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiBlLmNvbnN0cnVjdG9yID09PSBTeW1ib2wgJiYgZSAhPT0gU3ltYm9sLnByb3RvdHlwZSA/ICdzeW1ib2wnIDogdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZXhpc3R5ID0gYSwgdC5pc0Z1bmN0aW9uID0gbiwgdC5lYWNoID0gciwgdC5lYWNoS2V5ID0gaSwgdC5kZWZhdWx0cyA9IG8sIHQudG9BcnJheSA9IHMsIHQubGFzdCA9IGMsIHQuaXNUYWcgPSBsLCB0LmlzU2NyaXB0ID0gdSwgdC5pc1N0eWxlID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgJ29iamVjdCcgPT0gdHlwZW9mIHQgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGUgPyBlLmV4cG9ydHMgPSBuKCkgOiAnZnVuY3Rpb24nID09IHR5cGVvZiBkZWZpbmUgJiYgZGVmaW5lLmFtZCA/IGRlZmluZShbXSwgbikgOiAnb2JqZWN0JyA9PSB0eXBlb2YgdCA/IHQucG9zdHNjcmliZSA9IG4oKSA6IGEucG9zdHNjcmliZSA9IG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2hlbHBlcnMvdW5lc2NhcGVIdG1sQ29kZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhKCdAYWRvYmUvcmVhY3Rvci1kb2N1bWVudCcpLmNyZWF0ZUVsZW1lbnQoJ2RpdicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uaW5uZXJIVE1MID0gZSwgbi50ZXh0Q29udGVudCB8fCBuLmlubmVyVGV4dCB8fCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2hlbHBlcnMvZmluZFBhZ2VTY3JpcHQuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYSgnQGFkb2JlL3JlYWN0b3ItZG9jdW1lbnQnKSwgciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IG4ucXVlcnlTZWxlY3RvckFsbCgnc2NyaXB0JyksIGEgPSAwOyBhIDwgdC5sZW5ndGg7IGErKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRbYV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLnRlc3Qoci5zcmMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihuZXcgUmVnRXhwKC8obGF1bmNofHNhdGVsbGl0ZUxpYiktW15cL10rLmpzKFw/LiopPyQvKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRUdXJiaW5lOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnlSZWdleFBhdHRlcm46IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2hlbHBlcnMvZGVjb3JhdG9ycy9kZWNvcmF0ZUdsb2JhbEphdmFTY3JpcHRDb2RlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEoJ0BhZG9iZS9yZWFjdG9yLXByb21pc2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTogJzxzY3JpcHQ+XG4nICsgdCArICdcbjwvc2NyaXB0PicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvbWlzZTogbi5yZXNvbHZlKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvYWN0aW9ucy9oZWxwZXJzL2RlY29yYXRvcnMvZGVjb3JhdGVOb25HbG9iYWxKYXZhU2NyaXB0Q29kZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhKCdAYWRvYmUvcmVhY3Rvci1wcm9taXNlJyksIHIgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAnX3J1blNjcmlwdCcgKyArK3IsIGkgPSBuZXcgbihmdW5jdGlvbiAodCwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc2F0ZWxsaXRlW2FdID0gZnVuY3Rpb24gKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBfc2F0ZWxsaXRlW2FdLCBuZXcgbihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoaS5jYWxsKGUuZXZlbnQuZWxlbWVudCwgZS5ldmVudCwgZS5ldmVudC50YXJnZXQsIG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4odCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6ICc8c2NyaXB0Pl9zYXRlbGxpdGVbIicgKyBhICsgJyJdKGZ1bmN0aW9uKGV2ZW50LCB0YXJnZXQsIFByb21pc2UpIHtcbicgKyB0ICsgJ1xufSk7PC9zY3JpcHQ+JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlOiBpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2FjdGlvbnMvaGVscGVycy9kZWNvcmF0b3JzL2RlY29yYXRlSHRtbENvZGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gYSgnQGFkb2JlL3JlYWN0b3ItcHJvbWlzZScpLCBpID0gMCwgbyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuX3NhdGVsbGl0ZSA9IHdpbmRvdy5fc2F0ZWxsaXRlIHx8IHt9LCB3aW5kb3cuX3NhdGVsbGl0ZS5fb25DdXN0b21Db2RlU3VjY2VzcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG9bZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIChkZWxldGUgb1tlXSwgdC5yZXNvbHZlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3aW5kb3cuX3NhdGVsbGl0ZS5fb25DdXN0b21Db2RlRmFpbHVyZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG9bZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIChkZWxldGUgb1tlXSwgdC5yZWplY3QoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgIT09IGUuaW5kZXhPZignJHtyZWFjdG9yQ2FsbGJhY2tJZH0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlcGxhY2UoL1wke3JlYWN0b3JDYWxsYmFja0lkfS9nLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnNldHRpbmdzLmlzRXh0ZXJuYWw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbChlKSAmJiAodCA9IG4ucmVwbGFjZVRva2Vucyh0LCBlLmV2ZW50KSksIHModCkgPyAoYSA9IG5ldyByKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb1tTdHJpbmcoaSldID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWplY3Q6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQgPSBjKHQsIGkpLCBpICs9IDEpIDogYSA9IHIucmVzb2x2ZSgpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlOiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2FjdGlvbnMvaGVscGVycy9nZXRTb3VyY2VCeVVybC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhKCdAYWRvYmUvcmVhY3Rvci1sb2FkLXNjcmlwdCcpLCByID0gYSgnQGFkb2JlL3JlYWN0b3ItcHJvbWlzZScpLCBpID0gYSgnLi4vLi4vaGVscGVycy9maW5kUGFnZVNjcmlwdCcpLmJ5UmVnZXhQYXR0ZXJuLCBvID0ge30sIHMgPSB7fSwgYyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNbZV0gfHwgKHNbZV0gPSBuKGUpKSwgc1tlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9zYXRlbGxpdGUuX19yZWdpc3RlclNjcmlwdCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkb2N1bWVudC5jdXJyZW50U2NyaXB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBkb2N1bWVudC5jdXJyZW50U2NyaXB0LmdldEF0dHJpYnV0ZSgnc3JjJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG5ldyBSZWdFeHAoJy4qJyArIGUgKyAnLionKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gaShuKS5nZXRBdHRyaWJ1dGUoJ3NyYycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb1thXSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb1tlXSA/IHIucmVzb2x2ZShvW2VdKSA6IG5ldyByKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhlKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChvW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9oZWxwZXJzL2NyZWF0ZUJ1YmJseS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhKCcuL3dlYWtNYXAnKSwgciA9IGEoJy4vbWF0Y2hlc1Byb3BlcnRpZXMnKSwgaSA9IGEoJy4vbWF0Y2hlc1NlbGVjdG9yJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gW10sIHQgPSBuZXcgbigpLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGRMaXN0ZW5lcjogZnVuY3Rpb24gKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsdWF0ZUV2ZW50OiBmdW5jdGlvbiAoYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUubGVuZ3RoICYmICF0LmhhcyhhKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gPSBhLnRhcmdldCwgcyA9ICExOyBvOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gITEsIGwgPSAhMSwgdSA9IDA7IHUgPCBlLmxlbmd0aDsgdSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGVbdV0sIHAgPSBkLnNldHRpbmdzLmVsZW1lbnRTZWxlY3RvciwgaCA9IGQuc2V0dGluZ3MuZWxlbWVudFByb3BlcnRpZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKCExICE9PSBkLnNldHRpbmdzLmJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQgfHwgIXMpICYmICgobyA9PT0gYS50YXJnZXQgfHwgITEgIT09IGQuc2V0dGluZ3MuYnViYmxlRmlyZUlmUGFyZW50KSAmJiAobyA9PT0gYS50YXJnZXQgfHwgcCB8fCBoICYmIE9iamVjdC5rZXlzKGgpLmxlbmd0aCkgJiYgKCFwIHx8IGkobywgcCkpICYmICghaCB8fCByKG8sIGgpKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPyBPYmplY3Qua2V5cyhhKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZbZV0gPSBhW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogZi5uYXRpdmVFdmVudCA9IGEsIGYuZWxlbWVudCA9IG8sIGYudGFyZ2V0ID0gYS50YXJnZXQsICExICE9PSBkLmNhbGxiYWNrKGYpICYmIChsID0gITAsIGQuc2V0dGluZ3MuYnViYmxlU3RvcCAmJiAoYyA9ICEwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCAmJiAocyA9ICEwKSwgbyA9IG8ucGFyZW50Tm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zZXQoYSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX3Jlc2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL2hlbHBlcnMvd2Vha01hcC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKS5XZWFrTWFwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0eSwgaSA9IERhdGUubm93KCkgJSAxMDAwMDAwMDAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5uYW1lID0gJ19fc3QnICsgKDEwMDAwMDAwMDAgKiBNYXRoLnJhbmRvbSgpID4+PiAwKSArIGkrKyArICdfXyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5wcm90b3R5cGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGVbdGhpcy5uYW1lXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgJiYgYVswXSA9PT0gZSA/IGFbMV0gPSB0IDogcihlLCB0aGlzLm5hbWUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICh0ID0gZVt0aGlzLm5hbWVdKSAmJiB0WzBdID09PSBlID8gdFsxXSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW3RoaXMubmFtZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCF0IHx8IHRbMF0gIT09IGUpICYmICh0WzBdID0gdFsxXSA9IHZvaWQgMCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbdGhpcy5uYW1lXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhdCAmJiB0WzBdID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9oZWxwZXJzL3N0cmluZ0FuZE51bWJlclV0aWxzLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09IHR5cGVvZiBlICYmIGlzRmluaXRlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09IHR5cGVvZiBlIHx8IGUgaW5zdGFuY2VvZiBTdHJpbmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdChlKSA/IFN0cmluZyhlKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShlKSA/IE51bWJlcihlKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc051bWJlcjogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzU3RyaW5nOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzdFRvU3RyaW5nSWZOdW1iZXI6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXN0VG9OdW1iZXJJZlN0cmluZzogcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9oZWxwZXJzL21hdGNoZXNQcm9wZXJ0aWVzLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEoJy4vLi4vLi4vaGVscGVycy90ZXh0TWF0Y2gnKSwgciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdAdGV4dCcgPT09IHQgfHwgJ2lubmVyVGV4dCcgPT09IHQgPyBlLnRleHRDb250ZW50IHx8IGUuaW5uZXJUZXh0IDogdCBpbiBlID8gZVt0XSA6IGUuZ2V0QXR0cmlidXRlID8gZS5nZXRBdHRyaWJ1dGUodCkgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF0IHx8IHQuZXZlcnkoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHIoZSwgdC5uYW1lKSwgaSA9IHQudmFsdWVJc1JlZ2V4ID8gbmV3IFJlZ0V4cCh0LnZhbHVlLCAnaScpIDogdC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbihhLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9oZWxwZXJzL21hdGNoZXNTZWxlY3Rvci5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5tYXRjaGVzIHx8IGUubXNNYXRjaGVzU2VsZWN0b3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5jYWxsKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ubG9nZ2VyLndhcm4oJ01hdGNoaW5nIGVsZW1lbnQgZmFpbGVkLiAnICsgdCArICcgaXMgbm90IGEgdmFsaWQgc2VsZWN0b3IuJyksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9oZWxwZXJzL3RleHRNYXRjaC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdJbGxlZ2FsIEFyZ3VtZW50OiBQYXR0ZXJuIGlzIG5vdCBwcmVzZW50Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBlICYmICgnc3RyaW5nJyA9PSB0eXBlb2YgdCA/IGUgPT09IHQgOiB0IGluc3RhbmNlb2YgUmVnRXhwICYmIHQudGVzdChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL2hlbHBlcnMvcGFnZUxpZmVjeWNsZUV2ZW50cy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgciA9IGEoJ0BhZG9iZS9yZWFjdG9yLWRvY3VtZW50JyksIGkgPSAtMSAhPT0gbi5uYXZpZ2F0b3IuYXBwVmVyc2lvbi5pbmRleE9mKCdNU0lFIDEwJyksIG8gPSAnV0lORE9XX0xPQURFRCcsIHMgPSAnRE9NX1JFQURZJywgYyA9ICdQQUdFX0JPVFRPTScsIGwgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQ6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlRXZlbnQ6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRbZV0gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLnNsaWNlKDAsIGYoZSkgKyAxKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcodCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBoID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnY29tcGxldGUnID09PSByLnJlYWR5U3RhdGUgPyBvIDogJ2ludGVyYWN0aXZlJyA9PT0gci5yZWFkeVN0YXRlID8gaSA/IG51bGwgOiBzIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwuaW5kZXhPZihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGcgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRbdF0uZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBkW3RdID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBtID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQudHJpZ2dlciwgbiA9IHQuc3ludGhldGljRXZlbnRGbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKG4gPyBuKGUpIDogbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLl9zYXRlbGxpdGUgPSBuLl9zYXRlbGxpdGUgfHwge30sIG4uX3NhdGVsbGl0ZS5wYWdlQm90dG9tID0gcC5iaW5kKG51bGwsIGMpLCByLmFkZEV2ZW50TGlzdGVuZXIoJ0RPTUNvbnRlbnRMb2FkZWQnLCBwLmJpbmQobnVsbCwgcyksICEwKSwgbi5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgcC5iaW5kKG51bGwsIG8pLCAhMCksIG4uc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGgoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgJiYgcChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMCksIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lzdGVyTGlicmFyeUxvYWRlZFRyaWdnZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lzdGVyUGFnZUJvdHRvbVRyaWdnZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFtjXS5wdXNoKHsgdHJpZ2dlcjogZSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpc3RlckRvbVJlYWR5VHJpZ2dlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW3NdLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmlnZ2VyOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzeW50aGV0aWNFdmVudEZuOiB1LmJpbmQobnVsbCwgcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpc3RlcldpbmRvd0xvYWRlZFRyaWdnZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFtvXS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJpZ2dlcjogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3ludGhldGljRXZlbnRGbjogdS5iaW5kKG51bGwsIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAnYWRvYmUtdGFyZ2V0LXYyJzogewogICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0Fkb2JlIFRhcmdldCB2MicsCiAgICAgICAgICAgICAgICAgICAgICAgIGhvc3RlZExpYkZpbGVzQmFzZVVybDogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS9leHRlbnNpb25zL0VQZjZkNjk0NDYyYmY2NGQyZmJhODAzNGU4Y2VlMjM5MjQvJywKICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldFNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5hYmxlZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dDogMzAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiAnMi4yLjAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZHBvaW50OiAnL3Jlc3QvdjEvZGVsaXZlcnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltc09yZ0lkOiAnMUExMjQ2NzM1Mjc4NTMyOTBBNDkwRDQ1QEFkb2JlT3JnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGllbnRDb2RlOiAnc2t5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWN1cmVPbmx5OiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJTdGF0ZToge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW5FbmFibGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJEb21haW46ICdza3kudHQub210cmRjLm5ldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsU2l6ZUxpbWl0OiAyMDQ4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZXdzRW5hYmxlZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0b3V0RW5hYmxlZDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keUhpZGRlblN0eWxlOiAnYm9keSB7b3BhY2l0eTogMH0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VMb2FkRW5hYmxlZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5hbHl0aWNzTG9nZ2luZzogJ3NlcnZlcl9zaWRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2VJZExpZmV0aW1lOiA2MzI0NDgwMDAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5SGlkaW5nRW5hYmxlZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbklkTGlmZXRpbWU6IDE4NjAwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlzaXRvckFwaVRpbWVvdXQ6IDIwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXV0aG9yaW5nU2NyaXB0VXJsOiAnLy9jZG4udHQub210cmRjLm5ldC9jZG4vdGFyZ2V0LXZlYy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGVNYm94RWRnZVNlcnZlcjogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0b3JzUG9sbGluZ1RpbWVvdXQ6IDUwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdENvbnRlbnRIaWRkZW5TdHlsZTogJ3Zpc2liaWxpdHk6IGhpZGRlbjsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRDb250ZW50VmlzaWJsZVN0eWxlOiAndmlzaWJpbGl0eTogdmlzaWJsZTsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJyaWRlTWJveEVkZ2VTZXJ2ZXJUaW1lb3V0OiAxODYwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1cHBsZW1lbnRhbERhdGFJZFBhcmFtVGltZW91dDogMzAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLXRhcmdldC12Mi9saWIvZmlyZVBhZ2VMb2FkLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdmaXJlLXBhZ2UtbG9hZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdGaXJlIFBhZ2UgTG9hZCBSZXF1ZXN0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLmFkb2JlICYmIGkuYWRvYmUudGFyZ2V0ICYmIGkuYWRvYmUudGFyZ2V0LlZFUlNJT047CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBhKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgbyA9IGEoJy4vbW9kdWxlcy9saWJzL2F0LWxhdW5jaCcpLCBzID0gby5pbml0Q29uZmlnLCBjID0gby5pbml0RGVsaXZlcnksIGwgPSBhKCcuL21vZHVsZXMvcGFnZS1sb2FkJyksIHUgPSBhKCcuL21lc3NhZ2VzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGwoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKCkgPyAocyh0KSwgYygpKSA6IGkuY29uc29sZSAmJiBuLmxvZ2dlci53YXJuKHUuTk9fUkVRVUVTVCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS10YXJnZXQtdjIvbGliL2xvYWRUYXJnZXQuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2xvYWQtdGFyZ2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0xvYWQgVGFyZ2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgciA9IGEoJ0BhZG9iZS9yZWFjdG9yLWRvY3VtZW50JyksIGkgPSBhKCcuL21vZHVsZXMvbG9hZC10YXJnZXQnKSwgbyA9IGkuaW5pdExpYnJhcnlTZXR0aW5ncywgcyA9IGkub3ZlcnJpZGVQdWJsaWNBcGksIGMgPSBhKCcuL21vZHVsZXMvb3B0aW4nKSwgbCA9IGMuc2hvdWxkVXNlT3B0SW4sIHUgPSBjLmlzVGFyZ2V0QXBwcm92ZWQsIGQgPSBhKCcuL2FuYWx5dGljc0ludGVncmF0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiBlLmVuYWJsZWQgPyAoKDAsIGEoJy4vbW9kdWxlcy9saWJzL2F0LWxhdW5jaCcpLmluaXQpKG4sIHIsIGUpLCBsKCkgJiYgIXUoKSB8fCBkKCkpIDogcyhuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLXRhcmdldC12Mi9saWIvYWRkUGFnZUxvYWRQYXJhbXMuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2FkZC1wYWdlLWxvYWQtcGFyYW1zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0FkZCBQYXJhbXMgdG8gUGFnZSBMb2FkIFJlcXVlc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEoJy4vbW9kdWxlcy9wYXJhbXMtc3RvcmUnKS5tZXJnZVBhZ2VMb2FkUGFyYW1zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihlLnBhcmFtcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS10YXJnZXQtdjIvbGliL21vZHVsZXMvbGlicy9hdC1sYXVuY2guanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGUgJiYgJ2RlZmF1bHQnIGluIGUgPyBlLmRlZmF1bHQgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBdS5jYWxsKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0IGluIGUgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGVbdF0gPSBhLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiAoJ29iamVjdCcgPT09IHQgfHwgJ2Z1bmN0aW9uJyA9PT0gdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFsKGUpICYmIG8oZSkgPT09IFN1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShlKSA/IGUgOiBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoZSkgPyBbXSA6IE9iamVjdC5rZXlzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCkgPyBbXSA6ICh5dSh0KSA/IER1IDogSXUpKHAoZSksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGcoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5sZW5ndGggPyBlWzBdIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoZSkgPyBbXSA6IFtdLmNvbmNhdC5hcHBseShbXSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gdGhpcywgYSA9IGUgPyBlLmxlbmd0aCA6IDAsIG4gPSBhOyBuIC09IDE7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdShlW25dKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignRXhwZWN0ZWQgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMCwgciA9IGFyZ3VtZW50cy5sZW5ndGgsIGkgPSBuZXcgQXJyYXkociksIG8gPSAwOyBvIDwgcjsgbysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpW29dID0gYXJndW1lbnRzW29dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSBhID8gZVtuXS5hcHBseSh0LCBpKSA6IGlbMF07IChuICs9IDEpIDwgYTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSBlW25dLmNhbGwodCwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcih0KSB8fCAoeXUodCkgPyB3dSA6IEV1KShwKGUpLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGUgJiYgJ29iamVjdCcgPT09IHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGUgfHwgIXl1KGUpICYmIHYoZSkgJiYgbyhlKSA9PT0gVHU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gayhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDAsIGEgPSBlLmxlbmd0aCwgbiA9IDA7IG4gPCBhOyBuICs9IDEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9ICh0IDw8IDUpIC0gdCArIGUuY2hhckNvZGVBdChuKSAmIDQyOTQ5NjcyOTU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnbnVtYmVyJyA9PSB0eXBlb2YgZSAmJiBlID4gLTEgJiYgZSAlIDEgPT0gMCAmJiBlIDw9IFB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiBBKGUubGVuZ3RoKSAmJiAhdShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB3KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBDdShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMCwgYSA9IGUubGVuZ3RoLCBuID0gQXJyYXkoYSk7IHQgPCBhOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3RdID0gZVt0XSwgdCArPSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zcGxpdCgnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihlKSA/IFtdIDogUyhlKSA/IHkoZSkgPyBEKGUpIDogRShlKSA6IHcoaChlKSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChTKGUpICYmICh5dShlKSB8fCB5KGUpIHx8IHUoZS5zcGxpY2UpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChMdS5jYWxsKGUsIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihlKSA/ICcnIDogT3UuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5KGUpID8gIVAoZSkgOiBUKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFYoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09IHR5cGVvZiBlIHx8IHYoZSkgJiYgbyhlKSA9PT0gUnU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldFByb3RvdHlwZU9mKE9iamVjdChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXYoZSkgfHwgbyhlKSAhPT0ganUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBMKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBIdS5jYWxsKHQsICdjb25zdHJ1Y3RvcicpICYmIHQuY29uc3RydWN0b3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgYSAmJiBhIGluc3RhbmNlb2YgYSAmJiBGdS5jYWxsKGEpID09PSBxdTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBPKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5dSh0KSA/IHQuam9pbihlIHx8ICcnKSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE0oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCkgPyBbXSA6ICh5dSh0KSA/IEN1IDogVXUpKHAoZSksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IERhdGUoKS5nZXRUaW1lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaihlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihhKSA/IHQgOiAoeXUoYSkgPyB6dSA6IFl1KShwKGUpLCB0LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB4KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGUgPyBlIDogUXUuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBCKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBDKHQpID8gW10gOiB0LnNwbGl0KGUgfHwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEYoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgKyBNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiAodCAtIGUgKyAxKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gUigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd4eHh4eHh4eHh4eHg0eHh4eXh4eHh4eHh4eHh4eHh4eCcucmVwbGFjZSgvW3h5XS9nLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gKGUgKyBGKDAsIDE2KSkgJSAxNiB8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBNYXRoLmZsb29yKGUgLyAxNiksICgneCcgPT09IHQgPyBhIDogMyAmIGEgfCA4KS50b1N0cmluZygxNik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBxKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNldFRpbWVvdXQoZSwgTnVtYmVyKHQpIHx8IDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHooZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodCA9IHsgZXhwb3J0czoge30gfSwgdC5leHBvcnRzKSwgdC5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gdCB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc291cmNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Byb3RvY29sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2F1dGhvcml0eScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2VySW5mbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2VyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Bhc3N3b3JkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2hvc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncG9ydCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdyZWxhdGl2ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwYXRoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RpcmVjdG9yeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmaWxlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3F1ZXJ5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FuY2hvcicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3F1ZXJ5S2V5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyOiAvKD86XnwmKShbXiY9XSopPT8oW14mXSopL2cKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpY3Q6IC9eKD86KFteOlwvPyNdKyk6KT8oPzpcL1wvKCg/OigoW146QF0qKSg/OjooW146QF0qKSk/KT9AKT8oW146XC8/I10qKSg/OjooXGQqKSk/KSk/KCgoKD86W14/I1wvXSpcLykqKShbXj8jXSopKSg/Olw/KFteI10qKSk/KD86IyguKikpPykvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb29zZTogL14oPzooPyFbXjpAXSs6W146QFwvXSpAKShbXjpcLz8jLl0rKTopPyg/OlwvXC8pPygoPzooKFteOkBdKikoPzo6KFteOkBdKikpPyk/QCk/KFteOlwvPyNdKikoPzo6KFxkKikpPykoKChcLyg/OltePyNdKD8hW14/I1wvXSpcLltePyNcLy5dKyg/Ols/I118JCkpKSpcLz8pPyhbXj8jXC9dKikpKD86XD8oW14jXSopKT8oPzojKC4qKSk/KS8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuID0gYS5wYXJzZXJbdC5zdHJpY3RNb2RlID8gJ3N0cmljdCcgOiAnbG9vc2UnXS5leGVjKGUpLCByID0ge30sIGkgPSAxNDsgaS0tOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgclthLmtleVtpXV0gPSBuW2ldIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByW2EucS5uYW1lXSA9IHt9LCByW2Eua2V5WzEyXV0ucmVwbGFjZShhLnEucGFyc2VyLCBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIChyW2EucS5uYW1lXVt0XSA9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEsoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVthaF0gJiYgKHIodFtjaF0pIHx8IChlW0hoXSA9IHRbY2hdKSwgXyhmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIodFthXSkgfHwgKGVbYV0gPSB0W2FdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFZmKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuZG9jdW1lbnRNb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF0IHx8IHQgPj0gMTA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuY29tcGF0TW9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmICdDU1MxQ29tcGF0JyA9PT0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBXKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZi50ZXN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFcoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHgoQignLicsIGUpKSwgYSA9IHQubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPj0gMyAmJiBQZi50ZXN0KHRbMV0pID8gdFsyXSArICcuJyArIHRbMV0gKyAnLicgKyB0WzBdIDogMSA9PT0gYSA/IHRbMF0gOiB0WzFdICsgJy4nICsgdFswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmxvY2F0aW9uLnByb3RvY29sID09PSBJZiB8fCAobiA9ICQoZS5sb2NhdGlvbi5ob3N0bmFtZSkpLCBhW3doXSA9IG4sIGFbYWhdID0gRyh0KSAmJiBRKHQpLCBLKGEsIGVbUmhdIHx8IHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBaKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEood2luZG93LCBkb2N1bWVudCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHdpbmRvdy5sb2NhdGlvbi5wcm90b2NvbCA9PT0gSWY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoQ2YgPSBndSh7fSwgZSkpW2hoXSA9IGVbaGhdIC8gMTAwMCwgQ2ZbZmhdID0gZVtmaF0gLyAxMDAwLCBDZltTaF0gPSBDZlt5aF0gfHwgdCA/ICdodHRwczonIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBDZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBMZihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdGUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTmYoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGFlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRlY29kZVVSSUNvbXBvbmVudChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcmUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE1mW2VdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNZltlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9mLmhyZWYgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBadShPZi5ocmVmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnF1ZXJ5S2V5ID0gZWUodC5xdWVyeSksIE1mW2VdID0gdCwgTWZbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaWUoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyZXM6IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gb2UoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBCKCcjJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVCh0KSB8fCB0Lmxlbmd0aCA8IDMgfHwgaXNOYU4ocGFyc2VJbnQodFsyXSwgMTApKSA/IG51bGwgOiBpZShhZSh0WzBdKSwgYWUodFsxXSksIE51bWJlcih0WzJdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gc2UoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMoZSkgPyBbXSA6IEIoJ3wnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gTShvZSwgc2UoUmYoQmYpKSksIHQgPSBNYXRoLmNlaWwoUigpIC8gMTAwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3QubmFtZV0gPSB0LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30sIGYoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbChlKSAmJiB0IDw9IGUuZXhwaXJlczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGNlKClbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbCh0KSA/IHQudmFsdWUgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1ZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTygnIycsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZShlLm5hbWUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5lKGUudmFsdWUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwaXJlcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZGUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZXhwaXJlczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE0oZGUsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWF4LmFwcGx5KG51bGwsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGhlKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gSShlKSwgciA9IE1hdGguYWJzKDEwMDAgKiBwZShuKSAtIFIoKSksIGkgPSBPKCd8JywgTSh1ZSwgbikpLCBvID0gbmV3IERhdGUoUigpICsgciksIHMgPSBndSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbjogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJlczogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdXJlOiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA/IHsgc2FtZVNpdGU6IEVmIH0gOiB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqZihCZiwgaSwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZmUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLm5hbWUsIGEgPSBlLnZhbHVlLCBuID0gZS5leHBpcmVzLCByID0gZS5kb21haW4sIGkgPSBlLnNlY3VyZSwgbyA9IGNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvW3RdID0gaWUodCwgYSwgTWF0aC5jZWlsKG4gKyBSKCkgLyAxMDAwKSksIGhlKG8sIHIsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGdlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdShSZihlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbWUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlZShlLmxvY2F0aW9uLnNlYXJjaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTXUoYVt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYmUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSByZShlLnJlZmVycmVyKS5xdWVyeUtleTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhcihhKSAmJiBNdShhW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBfZShlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2UoYSkgfHwgbWUoZSwgYSkgfHwgYmUodCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdmUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFgoKSwgdCA9IGVbd2hdLCBhID0gZVt5aF0sIG4gPSBndSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbjogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdXJlOiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA/IHsgc2FtZVNpdGU6IEVmIH0gOiB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqZihSZCwgamQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBSZihSZCkgPT09IGpkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHhmKFJkKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5ZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfZSh3aW5kb3csIGRvY3VtZW50LCBPZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24ga2UoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWCgpW2FoXSAmJiB2ZSgpICYmICF5ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEFlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9lKHdpbmRvdywgZG9jdW1lbnQsIE5kKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBTZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfZSh3aW5kb3csIGRvY3VtZW50LCBNZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gd2UoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlLmNvbnNvbGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXIoYSkgJiYgdShhW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBFZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUuY29uc29sZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlKGUsICd3YXJuJykgJiYgYS53YXJuLmFwcGx5KGEsIFtGZl0uY29uY2F0KHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBEZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUuY29uc29sZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlKGUsICdkZWJ1ZycpICYmIEFlKCkgJiYgYS5kZWJ1Zy5hcHBseShhLCBbRmZdLmNvbmNhdCh0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSWUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCwgdCA9IG5ldyBBcnJheShlKSwgYSA9IDA7IGEgPCBlOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFthXSA9IGFyZ3VtZW50c1thXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVlKHdpbmRvdywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCwgdCA9IG5ldyBBcnJheShlKSwgYSA9IDA7IGEgPCBlOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFthXSA9IGFyZ3VtZW50c1thXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERlKHdpbmRvdywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUGUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGooZnVuY3Rpb24gKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFthXSA9IGVbYV0sIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSwgVmYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIENlKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZVtNaF0gfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVtNaF0gPSBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLnB1c2g7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbltsaF0gPSBIZiwgbltMaF0gPSBQZSh0KSwgbltOaF0gPSBbXSwgbltPaF0gPSBbXSwgbi5wdXNoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbltPaF0ucHVzaChndSh7IHRpbWVzdGFtcDogUigpIH0sIGUpKSwgci5jYWxsKHRoaXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVmUoZSwgdCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9PT0gT2ggJiYgZVtNaF0ucHVzaChhKSwgbiAmJiB0ICE9PSBPaCAmJiBlW01oXVt0XS5wdXNoKGd1KHsgdGltZXN0YW1wOiBSKCkgfSwgYSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2Uod2luZG93LCBYKCksIEFlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE5lKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZlKHdpbmRvdywgT2gsIGUsIEFlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE9lKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZlKHdpbmRvdywgTmgsIGUsIEFlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE1lKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoVWYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFJlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVWYoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gamUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGRvY3VtZW50LmNyZWF0ZVRleHROb2RlKCcnKSwgdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS50ZXh0Q29udGVudCA9IGUudGV4dENvbnRlbnQubGVuZ3RoID4gMCA/ICcnIDogJ2EnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBSZShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IGEubGVuZ3RoLCB0ID0gMDsgdCA8IGU7IHQgKz0gMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVt0XSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuc3BsaWNlKDAsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkub2JzZXJ2ZShlLCB7IGNoYXJhY3RlckRhdGE6ICEwIH0pLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucHVzaChlKSwgdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB4ZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcWYoJzxzY3JpcHQ+Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5vbigncmVhZHlzdGF0ZWNoYW5nZScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5vbigncmVhZHlzdGF0ZWNoYW5nZScsIG51bGwpLCB0LnJlbW92ZSgpLCB0ID0gbnVsbCwgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBxZihkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQpLmFwcGVuZCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQmUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNZSgpID8gX3UuX3NldEltbWVkaWF0ZUZuKGplKCkpIDogLTEgIT09IHdpbmRvdy5uYXZpZ2F0b3IudXNlckFnZW50LmluZGV4T2YoJ01TSUUgMTAnKSAmJiBfdS5fc2V0SW1tZWRpYXRlRm4oeGUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRmUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBfdShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBIZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3UucmVzb2x2ZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBxZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3UucmVqZWN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFVlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5dShlKSA/IF91LnJhY2UoZSkgOiBxZShuZXcgVHlwZUVycm9yKHpmKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gemUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHl1KGUpID8gX3UuYWxsKGUpIDogcWUobmV3IFR5cGVFcnJvcih6ZikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFllKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVWUoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRmUoZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHEoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIobmV3IEVycm9yKGEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVShuKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVShuKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEtlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKGVbbGZdKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbbGZdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIodFt1Zl0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdFt1Zl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShhW3BmXSkgJiYgdShhW2RmXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUWUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhdCAmJiBLZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBHZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUtlKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZVtsZl1bdWZdLCBuID0gKGVbbGZdW3VmXVtoZl0gfHwge30pW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbZGZdKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFdlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghS2UoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhlKCEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZVtsZl1bdWZdLCBuID0gKGVbbGZdW3VmXVtoZl0gfHwge30pW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEZlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtwZl0oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhW2RmXShuKSA/IGUoITApIDogdChiZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gJGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFgoKVttZl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUod2luZG93LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBHZSh3aW5kb3csIGZmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBaZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBHZSh3aW5kb3csIGdmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBYZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXZSh3aW5kb3csIGZmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBldCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlZSh3aW5kb3cubG9jYXRpb24uc2VhcmNoKVtJaF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdHQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IENoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyZXM6IHRbZmhdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbjogdFt3aF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdXJlOiB0W3loXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYXQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHQoZSwgWCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBudCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkZSgpICYmICFKZSgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBZZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNdShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXQoZSksIGxlKENoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbGUoQ2gpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEModCkgPyBhdChZZikgOiBhdCh0KSwgbGUoQ2gpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJ0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gWCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IFRoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyZXM6IHRbaGhdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbjogdFt3aF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdXJlOiB0W3loXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaXQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGUoVGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG90KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gS2YuZXhlYyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKHQpIHx8IDIgIT09IHQubGVuZ3RoID8gJycgOiB0WzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHN0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFYKClbYmhdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gUmYoUGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMoZSkgPyAnJyA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gY3QoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBYKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodFtiaF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRbd2hdLCBuID0gbmV3IERhdGUoUigpICsgdFtfaF0pLCByID0gdFt5aF0sIGkgPSBSZihQaCksIG8gPSBndSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW46IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBpcmVzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdXJlOiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIgPyB7IHNhbWVTaXRlOiBFZiB9IDoge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNdShpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamYoUGgsIGksIG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG90KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDKHMpIHx8IGpmKFBoLCBzLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbHQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LmNyZWF0ZUV2ZW50KCdDdXN0b21FdmVudCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhID0gYSB8fCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZXM6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV0YWlsOiB2b2lkIDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuLmluaXRDdXN0b21FdmVudChlLCBhLmJ1YmJsZXMsIGEuY2FuY2VsYWJsZSwgYS5kZXRhaWwpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdShlLkN1c3RvbUV2ZW50KSB8fCAoYS5wcm90b3R5cGUgPSBlLkV2ZW50LnByb3RvdHlwZSwgZS5DdXN0b21FdmVudCA9IGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHV0KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZSgpLCBuID0gdCgpLCByID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5zZXNzaW9uSWQgPSBhLCBNdShuKSA/IChyLmRldmljZUlkID0gbiwgcikgOiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGR0KGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbmV3IGUuQ3VzdG9tRXZlbnQoYSwgeyBkZXRhaWw6IG4gfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmRpc3BhdGNoRXZlbnQocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcHQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0Lm1ib3gsIG4gPSB0LmVycm9yLCBpID0gdC51cmwsIG8gPSB0LmFuYWx5dGljc0RldGFpbHMsIHMgPSB0LnJlc3BvbnNlVG9rZW5zLCBjID0gdC5leGVjdXRpb24sIGwgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNraW5nOiB1dChudCwgaXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGEpIHx8IChsLm1ib3ggPSBhKSwgcihuKSB8fCAobC5lcnJvciA9IG4pLCByKGkpIHx8IChsLnVybCA9IGkpLCBUKG8pIHx8IChsLmFuYWx5dGljc0RldGFpbHMgPSBvKSwgVChzKSB8fCAobC5yZXNwb25zZVRva2VucyA9IHMpLCBUKGMpIHx8IChsLmV4ZWN1dGlvbiA9IGMpLCBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGh0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBwdChRZiwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHQod2luZG93LCBkb2N1bWVudCwgUWYsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZ0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcHQoR2YsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHQod2luZG93LCBkb2N1bWVudCwgR2YsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGd0KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gcHQoV2YsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5yZWRpcmVjdCA9IHQsIGR0KHdpbmRvdywgZG9jdW1lbnQsIFdmLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBtdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHB0KCRmLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR0KHdpbmRvdywgZG9jdW1lbnQsICRmLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBidChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHB0KEpmLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR0KHdpbmRvdywgZG9jdW1lbnQsIEpmLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBfdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHB0KFpmLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR0KHdpbmRvdywgZG9jdW1lbnQsIFpmLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2dChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHB0KFhmLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR0KHdpbmRvdywgZG9jdW1lbnQsIFhmLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5dChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHB0KGVnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR0KHdpbmRvdywgZG9jdW1lbnQsIGVnLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBrdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHB0KHRnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR0KHdpbmRvdywgZG9jdW1lbnQsIHRnLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdihlKSAmJiAxID09PSBlLm5vZGVUeXBlICYmICFOKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFN0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jaGFyQXQoMCksIGEgPSBlLmNoYXJBdCgxKSwgbiA9IGUuY2hhckF0KDIpLCByID0geyBrZXk6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLnZhbCA9ICctJyA9PT0gYSA/ICcnICsgdCArIGEgKyAnXFwzJyArIG4gKyAnICcgOiB0ICsgJ1xcMycgKyBhICsgJyAnLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHd0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5tYXRjaChpZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVCh0KSA/IGUgOiBqKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVwbGFjZSh0LmtleSwgdC52YWwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgTShTdCwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEV0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQsIGEsIG4sIHIsIGkgPSBbXSwgbyA9IFAoZSksIHMgPSBvLmluZGV4T2YoYWcpOyAtMSAhPT0gczspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IFAoby5zdWJzdHJpbmcoMCwgcykpLCByID0gKGEgPSBQKG8uc3Vic3RyaW5nKHMpKSkuaW5kZXhPZihuZyksIG4gPSBQKGEuc3Vic3RyaW5nKHJnLCByKSksIHMgPSAobyA9IFAoYS5zdWJzdHJpbmcociArIDEpKSkuaW5kZXhPZihhZyksIHQgJiYgbiAmJiBpLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWw6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVxOiBOdW1iZXIobikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvICYmIGkucHVzaCh7IHNlbDogbyB9KSwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBEdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXQoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHFmKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxZihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gd3QoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoLTEgPT09IHQuaW5kZXhPZihhZykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHFmKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBFdCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0LnNlbCwgbiA9IHQuZXE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBlLmZpbmQoYSksIFYobikgJiYgKGUgPSBlLmVxKG4pKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHFmKGRvY3VtZW50KSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSXQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIER0KGUpLmxlbmd0aCA+IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVHQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHFmKCc8JyArIFhkICsgJy8+JykuYXBwZW5kKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFB0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxZihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRHQoZSkucHJldigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFZ0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEdChlKS5uZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTHQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIER0KGUpLnBhcmVudCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE50KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEdCh0KS5pcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBPdChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRHQodCkuZmluZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRHQoZSkuY2hpbGRyZW4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBSdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvd1tjZ10gPSB3aW5kb3dbY2ddIHx8IHt9LCB3aW5kb3dbY2ddLnF1ZXJ5U2VsZWN0b3JBbGwgPSBEdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBqdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbWmhdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93W2NnXVt1Z10gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHh0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcihRZCwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1KHdpbmRvd1tjZ11bbGddKSAmJiB3aW5kb3dbY2ddW2xnXShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBCdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChTZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFgoKVtBaF0sIHQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJZShvZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGUoc2cpLCB2dShlKS50aGVuKHQpLmNhdGNoKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZ0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUludChlLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSHQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBGdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpc05hTih0KSA/IG51bGwgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHF0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCKGJnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBVdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEIoYmcsIGUpLCBhID0gSHQodFswXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocihhKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmFjdGl2aXR5SW5kZXggPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBIdCh0WzFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGkpIHx8IChuLmV4cGVyaWVuY2VJbmRleCA9IGkpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHp0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmKF9nLCBNKFV0LCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWXQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHl1KGUpID8genQoZSkgOiB6dChbZV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEt0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZWUoZSksIGEgPSB0W3BnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDKGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4udG9rZW4gPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0W2ZnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE11KHIpICYmIHIgPT09IGpkICYmIChuLmxpc3RlZEFjdGl2aXRpZXNPbmx5ID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0W2dnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE11KGkpICYmIChuLmV2YWx1YXRlQXNUcnVlQXVkaWVuY2VJZHMgPSBxdChpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRbbWddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXUobykgJiYgKG4uZXZhbHVhdGVBc0ZhbHNlQXVkaWVuY2VJZHMgPSBxdChvKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHRbaGddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQocykgfHwgKG4ucHJldmlld0luZGV4ZXMgPSBZdChzKSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUXQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBLdChlLmxvY2F0aW9uLnNlYXJjaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIodCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG5ldyBEYXRlKFIoKSArIDE4NjAwMDApLCBuID0gWCgpW3loXSwgaSA9IGd1KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyZXM6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWN1cmU6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA/IHsgc2FtZVNpdGU6IEVmIH0gOiB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamYoZGcsIEpTT04uc3RyaW5naWZ5KHQpLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBHdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gUmYoZGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEMoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5wYXJzZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gV3QoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlZShlKVt5Z107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQyh0KSA/IG51bGwgOiB7IHRva2VuOiB0IH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gJHQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBXdChlLmxvY2F0aW9uLnNlYXJjaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIodCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG5ldyBEYXRlKFIoKSArIDE4NjAwMDApLCBuID0gWCgpW3loXSwgaSA9IGd1KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyZXM6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWN1cmU6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA/IHsgc2FtZVNpdGU6IEVmIH0gOiB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamYodmcsIEpTT04uc3RyaW5naWZ5KHQpLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gUmYodmcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEMoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5wYXJzZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWnQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIER0KGUpLmVtcHR5KCkucmVtb3ZlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWHQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIER0KHQpLmFmdGVyKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGVhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEdCh0KS5iZWZvcmUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdGEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIER0KHQpLmFwcGVuZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRHQodCkucHJlcGVuZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRHQodCkuaHRtbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRHQoZSkuaHRtbCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGlhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEdCh0KS50ZXh0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG9hKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnPCcgKyAkZCArICcgJyArIFlkICsgJz0iJyArIGUgKyAnIiAnICsgS2QgKyAnPSInICsgWHAgKyAnIj4nICsgdCArICc8LycgKyAkZCArICc+JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2Eoa2cgKyBrKHQpLCB0ICsgJyB7JyArIGUgKyAnfScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGNhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvYSh3ZywgdCArICcgeycgKyBlICsgJ30nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoITAgPT09IGVbcGhdICYmICFJdChTZykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbZGhdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhKG9hKEFnLCB0KSwgR2QpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHVhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICEwID09PSBlW3BoXSAmJiBJdChTZykgJiYgWnQoU2cpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVCh0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIUl0KCcjJyArIChrZyArIGsoZSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVQoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlW3VoXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGEoTygnXG4nLCBNKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2EobiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEpKSwgR2QpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUKHQpIHx8IEl0KCcjJyArIHdnKSB8fCB0YShjYShlW3VoXSwgTygnLCAnLCB0KSksIEdkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoYSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhKFgoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZmEoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1YShYKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGdhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhKFgoKSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbWEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGEoWCgpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBiYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBadCgnIycgKyAoa2cgKyBrKGUpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gX2EoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9ICcjJyArIHdnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSXQoZSkgJiYgWnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdmEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFyKGVbWWRdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5YShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXIoZVtxaF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGthKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3Vua25vd24nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXV0aGVudGljYXRlZCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdsb2dnZWRfb3V0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtZaF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gU2EoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZhKGUpIHx8IHlhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHdhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqKGZ1bmN0aW9uIChlLCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gclt6aF0gPSBuLCB2YShhKSAmJiAocltZZF0gPSBhW1lkXSksIHlhKGEpICYmIChyW1VoXSA9IGthKGFbcWhdKSksIHJbWHVdID0gdCwgQWEoYSkgJiYgKHJbWWhdID0gITApLCBlLnB1c2gociksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBbXSwgZihTYSwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5uYW1lU3BhY2VzICYmICFlLmRhdGFTb3VyY2VzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3YShlLCBPZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmFtZVNwYWNlcyAmJiB0LnB1c2guYXBwbHkodCwgd2EoZS5uYW1lU3BhY2VzLCBOZykpLCBlLmRhdGFTb3VyY2VzICYmIHQucHVzaC5hcHBseSh0LCB3YShlLmRhdGFTb3VyY2VzLCBPZykpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdShlW1ZnXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW1ZnXShMZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbCh0KSA/IEVhKHQpIDogW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSWEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoZSkgPyBudWxsIDogdShlW0NnXSkgPyBlW0NnXSh0KSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVGEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihhKSA/IG51bGwgOiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFBhKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIoZVtqZ10pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF1KGVbamddW3hnXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGVbamddW3hnXSh0LCB7IHNkaWRQYXJhbUV4cGlyeTogYSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKG4pICYmIHUobltCZ10pICYmIG5bQmddKCkgPyBuIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXUoZS5nZXRWaXNpdG9yVmFsdWVzKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSGUoe30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSWcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiBhLnB1c2goUGcpLCBGZShmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2V0VmlzaXRvclZhbHVlcyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFZhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZShIZywgZSksIHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExhKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGUpID8gSGUoe30pIDogWWUoQ2EoZSwgYSksIHQsIEZnKS5jYXRjaChWYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTmEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF1KGUuZ2V0VmlzaXRvclZhbHVlcykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSWcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIGEucHVzaChQZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZ2V0VmlzaXRvclZhbHVlcyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBndShuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE9hKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGUpID8ge30gOiBOYShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNYSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gWCgpLCB0ID0gZVtyaF0sIGEgPSBlW2toXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQYSh3aW5kb3csIHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFJhKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBNYSgpLCB0ID0gWCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIExhKGUsIHRbbWhdLCB0W3ZoXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gamEoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2EoTWEoKSwgWCgpW3ZoXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geGEoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGEoTWEoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQmEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElhKE1hKCksIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUYShNYSgpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBIYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxZ1tlXSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcWEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHFnW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFVhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtSaF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocih0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRbeGhdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIXl1KGEpIHx8IFQoYSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHphKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtVcF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXkodCkgfHwgVCh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGVbbGhdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5KGEpIHx8IFQoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlW29oXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFyKG4pICYmICFWKG4pKSAmJiAhIXUoZVtKcF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFlhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGZShmdW5jdGlvbiAodCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUoZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihlKSA/IHQobikgOiBhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gS2EoZSwgdCwgYSwgbiwgciwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9bZV0gPSB0LCBvW2FdID0gbiwgb1tyXSA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNbamhdID0gbywgczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBRYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbVXBdLCBhID0gZVtsaF0sIG4gPSBlW29oXSB8fCBZZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBZZShZYShlW0pwXSksIG4sIHpnKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBLYShVcCwgdCwgbGgsIGEsIFlwLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUoVWcsIHhwLCBuKSwgT2UobiksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gS2EoVXAsIHQsIGxoLCBhLCBPcCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRlKFVnLCBPcCwgbiksIE9lKG4pLCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEdhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBndShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBIYSh4aCwgdCksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gV2EoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVhKGUpID8gemUoTShRYSwgZih6YSwgZVtSaF1beGhdKSkpLnRoZW4oR2EpIDogSGUoe30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICRhKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBxYSh4aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihlKSA/IHt9IDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKYSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXYSh3aW5kb3cpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFphKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlZShlLmxvY2F0aW9uLnNlYXJjaClbS2ddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEModCkgPyBudWxsIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gUmYoUWcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMoZSkgPyBudWxsIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0bigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gWGEod2luZG93KSwgdCA9IGVuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSB8fCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGFuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhVChlKSAmJiAyID09PSBlLmxlbmd0aCAmJiBNdShlWzBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBubihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuaW5kZXhPZignPScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xID09PSB0ID8gW10gOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zdWJzdHIoMCwgdCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zdWJzdHIodCArIDEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJuKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8oZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsKGUpID8gKHQucHVzaChyKSwgcm4oZSwgdCwgYSwgbiksIHQucG9wKCkpIDogVCh0KSA/IGFbbihyKV0gPSBlIDogYVtuKE8oJy4nLCB0LmNvbmNhdChyKSkpXSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVlKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGooZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wdXNoKG5uKHQpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtdLCBmKE11LCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW2FlKFAodFswXSkpXSA9IGFlKFAodFsxXSkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30sIGYoYW4sIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjbihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCkgPyBybihlLCBbXSwgYSwgZCkgOiBybihlLCBbXSwgYSwgdCksIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF1KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0KSA/IHt9IDogeXUodCkgPyBzbih0KSA6IHkodCkgJiYgTXUodCkgPyBvbih0KSA6IGwodCkgPyBjbih0KSA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHVuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBndSh7fSwgZSwgbG4od2luZG93LnRhcmdldFBhZ2VQYXJhbXNBbGwpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ3Uoe30sIGUsIGxuKHdpbmRvdy50YXJnZXRQYWdlUGFyYW1zKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBYKCksIGEgPSB0W3NoXSwgbiA9IHRbRWhdLCByID0gdFtEaF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSAhPT0gZSA/IHVuKG4gfHwge30pIDogZ3UodW4obiB8fCB7fSksIGRuKHIgfHwge30pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBobigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnY2FudmFzJyksIHQgPSBlLmdldENvbnRleHQoJ3dlYmdsJykgfHwgZS5nZXRDb250ZXh0KCdleHBlcmltZW50YWwtd2ViZ2wnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0LmdldEV4dGVuc2lvbignV0VCR0xfZGVidWdfcmVuZGVyZXJfaW5mbycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuZ2V0UGFyYW1ldGVyKGEuVU5NQVNLRURfUkVOREVSRVJfV0VCR0wpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIobikgPyBudWxsIDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gd2luZG93LmRldmljZVBpeGVsUmF0aW87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gd2luZG93LnNjcmVlbiwgYSA9IHQuc3lzdGVtWERQSSwgbiA9IHQubG9naWNhbFhEUEk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXIoYSkgJiYgIXIobikgJiYgYSA+IG4gJiYgKGUgPSBhIC8gbiksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZ24oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHdpbmRvdy5zY3JlZW4sIHQgPSBlLm9yaWVudGF0aW9uLCBhID0gZS53aWR0aCwgbiA9IGUuaGVpZ2h0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPiBuID8gJ2xhbmRzY2FwZScgOiAncG9ydHJhaXQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIodC50eXBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gQignLScsIHQudHlwZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoVChpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gaVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKG8pID8gbnVsbCA6IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbW4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gR2c7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYm4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09ICRnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9uKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSAhPT0gZS5pbmRleE9mKFdnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2bihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gSmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geW4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IFpnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGtuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBYZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gZW07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gU24oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IHRtOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHduKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBhbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBFbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX24oZSkgfHwgYm4oZSkgfHwgdm4oZSkgfHwgeW4oZSkgfHwga24oZSkgfHwgQW4oZSkgfHwgU24oZSkgfHwgd24oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3Vic3RyaW5nKFdnLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSW4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbJGddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFRuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW0pnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBQbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtaZ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQ24oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbWGddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFZuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gTShQLCBCKCcsJywgZVtlbV0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmKE11LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBMbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0bV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTm4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbYW1dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE9uKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqKGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVuKGEpIHx8IChlW2FdID0gcih0KSA/ICcnIDogdCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTW4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGooZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIV9uKGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IERuKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBDKG4pIHx8IChlW25dID0gcih0KSA/ICcnIDogdCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUm4oZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUub25sb2FkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gMTIyMyA9PT0gZS5zdGF0dXMgPyAyMDQgOiBlLnN0YXR1czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA8IDEwMCB8fCBuID4gNTk5KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKG5ldyBFcnJvcihybSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBKU09OLnBhcnNlKGUucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgYShuZXcgRXJyb3Iob20pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUuZ2V0QWxsUmVzcG9uc2VIZWFkZXJzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlOiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gam4oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUub25lcnJvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KG5ldyBFcnJvcihybSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB4bihlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS50aW1lb3V0ID0gdCwgZS5vbnRpbWVvdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYShuZXcgRXJyb3IoaW0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQm4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8oZnVuY3Rpb24gKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5dSh0KSAmJiBfKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc2V0UmVxdWVzdEhlYWRlcihhLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDoge30pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS51cmwsIGEgPSBlLmhlYWRlcnMsIG4gPSBlLmJvZHksIGkgPSBlLnRpbWVvdXQsIG8gPSBlLmFzeW5jOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEZlKGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF81NDYyY2Y1NWUxNTdhM2RhID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JyksICRfX19vbGRfNTRmMWVjMWY3MDg2NGMzMSA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzU0NjJjZjU1ZTE1N2EzZGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja180NDhiOTVhNDdkZDQ5ZjBhLlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzU0ZjFlYzFmNzA4NjRjMzEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja180NDhiOTVhNDdkZDQ5ZjBhLlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG5ldyB3aW5kb3cuWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChzID0gam4ocyA9IFJuKHMsIGUsIHIpLCByKSkub3BlbihubSwgdCwgbyksIHMud2l0aENyZWRlbnRpYWxzID0gITAsIHMgPSBCbihzLCBhKSwgbyAmJiAocyA9IHhuKHMsIGksIHIpKSwgcy5zZW5kKEpTT04uc3RyaW5naWZ5KG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzU0NjJjZjU1ZTE1N2EzZGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzU0NjJjZjU1ZTE1N2EzZGEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfNTRmMWVjMWY3MDg2NGMzMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfNTRmMWVjMWY3MDg2NGMzMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVzcG9uc2UsIGEgPSB0LnN0YXR1cywgbiA9IHQubWVzc2FnZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIoYSkgJiYgIXIobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEhuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlW1BnXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoRWcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcW4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFJhKCksIHQgPSBKYSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHplKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnRoZW4oSG4pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFVuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqYSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFphKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gem4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBYKClbc2hdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGd1KHt9LCBlLCBwbih0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWW4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLW5ldyBEYXRlKCkuZ2V0VGltZXpvbmVPZmZzZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBLbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gd2luZG93LnNjcmVlbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IGUud2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBlLmhlaWdodCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcmllbnRhdGlvbjogZ24oKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xvckRlcHRoOiBlLmNvbG9yRGVwdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxSYXRpbzogZm4oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBRbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogZS5jbGllbnRXaWR0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IGUuY2xpZW50SGVpZ2h0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEduKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBob3N0OiB3aW5kb3cubG9jYXRpb24uaG9zdG5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2ViR0xSZW5kZXJlcjogbW4oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBXbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB3aW5kb3cubG9jYXRpb24uaHJlZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZlcnJpbmdVcmw6IGRvY3VtZW50LnJlZmVycmVyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICRuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcihlKSAmJiBlLmNoYW5uZWwgPT09IERmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAoZSB8fCB7fSkuYmVhY29uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VyQWdlbnQ6IHdpbmRvdy5uYXZpZ2F0b3IudXNlckFnZW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVPZmZzZXRJbk1pbnV0ZXM6IFluKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbDogRGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyZWVuOiBLbigpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdzogUW4oKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicm93c2VyOiBHbigpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZHJlc3M6IFduKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2VvOiBlICYmIGUuZ2VvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlYWNvbjogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKbihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFQodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRbSWddLCBpID0gcGFyc2VJbnQobiwgMTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNOYU4oaSkgfHwgKGEubG9jYXRpb25IaW50ID0gaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRbRGddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE11KG8pICYmIChhLmJsb2IgPSBvKSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBabihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuaWQsIGEgPSBlLmludGVncmF0aW9uQ29kZSwgbiA9IGUuYXV0aGVudGljYXRlZFN0YXRlLCByID0gZS50eXBlLCBpID0gZS5wcmltYXJ5LCBvID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTXUodCkgJiYgKG8uaWQgPSB0KSwgTXUoYSkgJiYgKG8uaW50ZWdyYXRpb25Db2RlID0gYSksIE11KG4pICYmIChvLmF1dGhlbnRpY2F0ZWRTdGF0ZSA9IG4pLCBNdShyKSAmJiAoby50eXBlID0gciksIGkgJiYgKG8ucHJpbWFyeSA9IGkpLCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFhuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNKFpuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlcihlLCB0LCBhLCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXUodCkgJiYgKGkudG50SWQgPSB0KSwgTXUoYSkgJiYgKGkudGhpcmRQYXJ0eUlkID0gYSksIE11KGUudGhpcmRQYXJ0eUlkKSAmJiAoaS50aGlyZFBhcnR5SWQgPSBlLnRoaXJkUGFydHlJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG5bVGddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE11KG8pICYmIChpLm1hcmtldGluZ0Nsb3VkVmlzaXRvcklkID0gbyksIE11KGUubWFya2V0aW5nQ2xvdWRWaXNpdG9ySWQpICYmIChpLm1hcmtldGluZ0Nsb3VkVmlzaXRvcklkID0gZS5tYXJrZXRpbmdDbG91ZFZpc2l0b3JJZCksIFQoZS5jdXN0b21lcklkcykgPyAoVChyKSB8fCAoaS5jdXN0b21lcklkcyA9IFhuKHIpKSwgaSkgOiAoaS5jdXN0b21lcklkcyA9IGUuY3VzdG9tZXJJZHMsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHRyKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0ge30sIG4gPSBKbihlLmF1ZGllbmNlTWFuYWdlciwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChuKSB8fCAoYS5hdWRpZW5jZU1hbmFnZXIgPSBuKSwgVChlLmFuYWx5dGljcykgfHwgKGEuYW5hbHl0aWNzID0gZS5hbmFseXRpY3MpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGFyKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcihlKSAmJiBNdShlLnRva2VuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0ge30sIG4gPSBUbih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdShuKSAmJiAoYS50b2tlbiA9IG4pLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG5yKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcihlKSAmJiBNdShlLmF1dGhvcml6YXRpb25Ub2tlbikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9LCBhID0gdG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdShhKSAmJiAodC5hdXRob3JpemF0aW9uVG9rZW4gPSBhKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBycihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihlKSA/IEp0KCkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGlyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGUpID8gR3QoKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gb3IoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fSwgYSA9IFBuKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihhKSB8fCAodC5pZCA9IGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBDbihlKSwgaSA9IHBhcnNlRmxvYXQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc05hTihpKSB8fCAodC50b3RhbCA9IGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBWbihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKG8pIHx8ICh0LnB1cmNoYXNlZFByb2R1Y3RJZHMgPSBvKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9LCBhID0gTG4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKGEpIHx8ICh0LmlkID0gYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE5uKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIobikgfHwgKHQuY2F0ZWdvcnlJZCA9IG4pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGNyKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0ge30sIG4gPSBndSh7fSwgT24odCksIGUucGFyYW1ldGVycyB8fCB7fSksIHIgPSBndSh7fSwgTW4odCksIGUucHJvZmlsZVBhcmFtZXRlcnMgfHwge30pLCBpID0gZ3Uoe30sIG9yKHQpLCBlLm9yZGVyIHx8IHt9KSwgbyA9IGd1KHt9LCBzcih0KSwgZS5wcm9kdWN0IHx8IHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKG4pIHx8IChhLnBhcmFtZXRlcnMgPSBuKSwgVChyKSB8fCAoYS5wcm9maWxlUGFyYW1ldGVycyA9IHIpLCBUKGkpIHx8IChhLm9yZGVyID0gaSksIFQobykgfHwgKGEucHJvZHVjdCA9IG8pLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGxyKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMl0gPyBhcmd1bWVudHNbMl0gOiB7fSwgbiA9IFgoKVtzaF0sIGkgPSBlLmluZGV4LCBvID0gZS5uYW1lLCBzID0gZS5hZGRyZXNzLCBjID0gY3IoZSwgZ3Uoe30sIG8gPT09IG4gPyB0IDogYSwgcG4obykpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGkpIHx8IChjLmluZGV4ID0gaSksIE11KG8pICYmIChjLm5hbWUgPSBvKSwgVChzKSB8fCAoYy5hZGRyZXNzID0gcyksIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdXIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlLm5hbWUsIG4gPSBlLmFkZHJlc3MsIHIgPSBjcihlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdShhKSAmJiAoci5uYW1lID0gYSksIFQobikgfHwgKHIuYWRkcmVzcyA9IG4pLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRyKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5leGVjdXRlLCBpID0gdm9pZCAwID09PSBuID8ge30gOiBuLCBvID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoVChpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gaS5wYWdlTG9hZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIocykgfHwgKG8ucGFnZUxvYWQgPSBjcihzLCB0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGkubWJveGVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyKGMpICYmIHl1KGMpICYmICFUKGMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBmKGxtLCBNKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBscihlLCB0LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVChsKSB8fCAoby5tYm94ZXMgPSBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHByKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5wcmVmZXRjaCwgaSA9IHZvaWQgMCA9PT0gbiA/IHt9IDogbiwgbyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFQoaSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGkubWJveGVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihzKSB8fCAheXUocykgfHwgVChzKSB8fCAoby5tYm94ZXMgPSBNKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxyKGUsIHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBpLnZpZXdzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoYykgfHwgIXl1KGMpIHx8IFQoYykgfHwgKG8udmlld3MgPSBNKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVyKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYykpLCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGhyKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkZSgpICYmICFaZSgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBYKCksIG4gPSBCYShlKSwgaSA9IEZhKE1nKSwgbyA9IEZhKFJnKSwgcyA9IHQuZXhwZXJpZW5jZUNsb3VkLCBjID0gKHZvaWQgMCA9PT0gcyA/IHt9IDogcykuYW5hbHl0aWNzLCBsID0gdm9pZCAwID09PSBjID8ge30gOiBjLCB1ID0gbC5sb2dnaW5nLCBkID0gbC5zdXBwbGVtZW50YWxEYXRhSWQsIHAgPSBsLnRyYWNraW5nU2VydmVyLCBoID0gbC50cmFja2luZ1NlcnZlclNlY3VyZSwgZiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodSkgPyBmLmxvZ2dpbmcgPSBhW19mXSA6IGYubG9nZ2luZyA9IHUsIHIoZCkgfHwgKGYuc3VwcGxlbWVudGFsRGF0YUlkID0gZCksIE11KG4pICYmIChmLnN1cHBsZW1lbnRhbERhdGFJZCA9IG4pLCByKHApIHx8IChmLnRyYWNraW5nU2VydmVyID0gcCksIE11KGkpICYmIChmLnRyYWNraW5nU2VydmVyID0gaSksIHIoaCkgfHwgKGYudHJhY2tpbmdTZXJ2ZXJTZWN1cmUgPSBoKSwgTXUobykgJiYgKGYudHJhY2tpbmdTZXJ2ZXJTZWN1cmUgPSBvKSwgVChmKSA/IG51bGwgOiBmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZyKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gem4oYSksIHIgPSBpdCgpLCBpID0gSW4obiksIG8gPSB4YSgpLCBzID0gZXIoZS5pZCB8fCB7fSwgciwgaSwgdCwgbyksIGMgPSBhcihlLnByb3BlcnR5LCBuKSwgbCA9IHRyKGUuZXhwZXJpZW5jZUNsb3VkIHx8IHt9LCB0KSwgdSA9IG5yKGUudHJhY2UpLCBkID0gcnIoZS5wcmV2aWV3KSwgcCA9IGlyKGUucWFNb2RlKSwgaCA9IGRyKGUsIG4sIGEpLCBmID0gcHIoZSwgbiwgYSksIGcgPSBlLm5vdGlmaWNhdGlvbnMsIG0gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtLnJlcXVlc3RJZCA9IEgoKSwgbS5jb250ZXh0ID0gJG4oZS5jb250ZXh0KSwgVChzKSB8fCAobS5pZCA9IHMpLCBUKGMpIHx8IChtLnByb3BlcnR5ID0gYyksIFQodSkgfHwgKG0udHJhY2UgPSB1KSwgVChsKSB8fCAobS5leHBlcmllbmNlQ2xvdWQgPSBsKSwgVChkKSB8fCAobS5wcmV2aWV3ID0gZCksIFQocCkgfHwgKG0ucWFNb2RlID0gcCksIFQoaCkgfHwgKG0uZXhlY3V0ZSA9IGgpLCBUKGYpIHx8IChtLnByZWZldGNoID0gZiksIFQoZykgfHwgKG0ubm90aWZpY2F0aW9ucyA9IGcpLCBtOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGdyKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYVswXSwgciA9IGFbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnIoZSwgbiwgZ3Uoe30sIHIsIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBtcihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcW4oKS50aGVuKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdyKGUsIHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYnIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdyKGUsIHQsIFVuKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9yKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBWKHQpID8gdCA8IDAgPyBlW29oXSA6IHQgOiBlW29oXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2cihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbaWhdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlW2JoXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBDKGEpID8gdCA6ICcnICsgc20gKyBhICsgY207CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geXIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbU2hdICsgJy8vJyArIHZyKGUpICsgZVtCaF0gKyAnPycgKyB0ZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50OiBlW25oXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uSWQ6IG50KCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogZVtsaF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGtyKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gWCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEZuKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHlyKGEpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGMoe30sIGVmLCBbdGZdKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVvdXQ6IF9yKGEsIHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFzeW5jOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBndShlLCB7IGRlY2lzaW9uaW5nTWV0aG9kOiBHdS5TRVJWRVJfU0lERSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEFyKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZSgkcCwgdCksIE9lKHsgcmVxdWVzdDogdCB9KSwga3IodCwgYSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZShXcCwgZSksIE9lKHsgcmVzcG9uc2U6IGUgfSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2U6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gU3IoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXM6IHhwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB3cihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogT3AsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIUVyKGUpICYmIE11KGUuZXZlbnRUb2tlbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSXIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFUKGUpICYmICFDKGUudHlwZSkgJiYgTXUoZS5ldmVudFRva2VuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBUcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFJcihlKSAmJiBNdShlLnNlbGVjdG9yKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBQcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbCh0KSAmJiBNdSh0LnRudElkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVzcG9uc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHIodCkgJiYgcnQodC5pZC50bnRJZCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVnIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJlc3BvbnNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUHIodCkgJiYgY3QodC5pZC50bnRJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY3QobnVsbCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IChhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6IHt9KS50cmFjZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQoZSkgfHwgTmUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTnIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJlc3BvbnNlLCBhID0gdC5leGVjdXRlLCBuID0gdm9pZCAwID09PSBhID8ge30gOiBhLCByID0gdC5wcmVmZXRjaCwgaSA9IHZvaWQgMCA9PT0gciA/IHt9IDogciwgbyA9IHQubm90aWZpY2F0aW9ucywgcyA9IHZvaWQgMCA9PT0gbyA/IHt9IDogbywgYyA9IG4ucGFnZUxvYWQsIGwgPSB2b2lkIDAgPT09IGMgPyB7fSA6IGMsIHUgPSBuLm1ib3hlcywgZCA9IHZvaWQgMCA9PT0gdSA/IFtdIDogdSwgcCA9IGkubWJveGVzLCBoID0gdm9pZCAwID09PSBwID8gW10gOiBwLCBmID0gaS52aWV3cywgZyA9IHZvaWQgMCA9PT0gZiA/IFtdIDogZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBMcihsKSwgXyhMciwgZCksIF8oTHIsIGgpLCBfKExyLCBnKSwgXyhMciwgcyksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gT3IoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnF1ZXJ5S2V5LCBhID0gdFtMbV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXkoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQyhhKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gTWF0aC5yb3VuZChSKCkgLyAxMDAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W0xtXSA9IGEucmVwbGFjZSgvXHxUUz1cZCsvLCAnfFRTPScgKyBuKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5xdWVyeUtleTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBScihlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHJlKGUpLCByID0gbi5wcm90b2NvbCwgaSA9IG4uaG9zdCwgbyA9IG4ucGF0aCwgcyA9ICcnID09PSBuLnBvcnQgPyAnJyA6ICc6JyArIG4ucG9ydCwgYyA9IEMobi5hbmNob3IpID8gJycgOiAnIycgKyBuLmFuY2hvciwgbCA9IGEobiksIHUgPSB0ZShndSh7fSwgbCwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgKyAnOi8vJyArIGkgKyBzICsgbyArIChDKHUpID8gJycgOiAnPycgKyB1KSArIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24ganIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFJyKGUsIHQsIE9yKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB4cihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUnIoZSwgdCwgTXIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEJyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jb250ZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEModCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRlKHdwLCBlKSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZ3Uoe30sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuY29udGVudCA9IGpyKHQsIHt9KSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBGcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW3htXSB8fCBSbSwgYSA9IGVbQm1dIHx8IEZyKE1tKSwgbiA9IGVbRm1dIHx8IHt9LCBpID0gZVtIbV0gfHwgbnVsbCwgbyA9IGVbcW1dIHx8ICExLCBzID0gZVtVbV0gfHwgMzAwMCwgYyA9ICEhcihlW3ptXSkgfHwgITAgPT09IGVbem1dLCBsID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbFt4bV0gPSB0LCBsW0JtXSA9IGEsIGxbRm1dID0gbiwgbFtIbV0gPSBpLCBsW3FtXSA9IG8sIGxbVW1dID0gcywgbFt6bV0gPSBjLCBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHFyKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm9ubG9hZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IDEyMjMgPT09IGUuc3RhdHVzID8gMjA0IDogZS5zdGF0dXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPCAxMDAgfHwgbiA+IDU5OSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYShuZXcgRXJyb3IoTm0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLnJlc3BvbnNlVGV4dCwgaSA9IGUuZ2V0QWxsUmVzcG9uc2VIZWFkZXJzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlOiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVXIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUub25lcnJvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KG5ldyBFcnJvcihObSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB6cihlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS50aW1lb3V0ID0gdCwgZS5vbnRpbWVvdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYShuZXcgRXJyb3IoT20pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWXIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSB0ICYmIChlLndpdGhDcmVkZW50aWFscyA9IHQpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEtyKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfKGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXyhmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zZXRSZXF1ZXN0SGVhZGVyKGEsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUXIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBIcih0KSwgbiA9IGFbeG1dLCByID0gYVtCbV0sIGkgPSBhW0ZtXSwgbyA9IGFbSG1dLCBzID0gYVtxbV0sIGMgPSBhW1VtXSwgbCA9IGFbem1dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEZlKGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBuZXcgZS5YTUxIdHRwUmVxdWVzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh1ID0gVXIodSA9IHFyKHUsIHQsIGEpLCBhKSkub3BlbihuLCByLCBsKSwgdSA9IEtyKHUgPSBZcih1LCBzKSwgaSksIGwgJiYgKHUgPSB6cih1LCBjLCBhKSksIHUuc2VuZChvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEdyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRcih3aW5kb3csIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFdyKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gblt4bV0gPSBSbSwgbltCbV0gPSB4cihlLCB0KSwgbltVbV0gPSBhLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICRyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID49IDIwMCAmJiBlIDwgMzAwIHx8IDMwNCA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISRyKGUuc3RhdHVzKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXNwb25zZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLnR5cGUgPSBIZCwgYS5jb250ZW50ID0gdCwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBacihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gR3IoV3IoZS5jb250ZW50LCB7fSwgWCgpW1VtXSkpLnRoZW4oSnIpLmNhdGNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFhyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtjZF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQyh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFltLmV4ZWModCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChhKSB8fCAyICE9PSBhLmxlbmd0aCA/ICcnIDogYVsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoWGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5pbm5lckhUTUwgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhLmZpcnN0RWxlbWVudENoaWxkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIobikgPyB0IDogKG4uaWQgPSBlLCBuLm91dGVySFRNTCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW2VkXSwgYSA9IFhyKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEMoYSkgfHwgQyh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZVtjZF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtjZF0gPSBuLnJlcGxhY2UoS20sICcnKSwgZVtlZF0gPSBlaShhLCB0KSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXIoZS5zZWxlY3Rvcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbmkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhaShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geSh0W2VkXSkgPyB0IDogKFRlKF9wLCB0KSwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcmkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhaShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geSh0W2VkXSkgPyB0IDogKFRlKF9wLCB0KSwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaWkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhaShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geSh0W2VkXSkgPyB0IDogKFRlKF9wLCB0KSwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gb2koZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhaShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geSh0W2VkXSkgPyB0IDogKFRlKF9wLCB0KSwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gc2koZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhaShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geSh0W2VkXSkgPyB0IDogKFRlKF9wLCB0KSwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gY2koZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhaShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geSh0W2VkXSkgPyB0IDogKFRlKF9wLCB0KSwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhaShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geSh0W2VkXSkgPyB0IDogKFRlKF9wLCB0KSwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdWkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFpKGUpID8geShlW2VkXSkgPyBlIDogKFRlKF9wLCBlKSwgbnVsbCkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhaShlKSA/IGwoZVtlZF0pID8gZSA6IChUZSh2cCwgZSksIG51bGwpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYWkoZSkgPyB5KGVbZWRdKSA/IGUgOiAoVGUoRXAsIGUpLCBudWxsKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFpKGUpID8gbChlW2VkXSkgPyBlIDogKFRlKHlwLCBlKSwgbnVsbCkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhaShlKSA/IGwoZVtlZF0pID8gZSA6IChUZShrcCwgZSksIG51bGwpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYWkoZSkgPyBsKGVbZWRdKSA/IGUgOiAoVGUoQXAsIGUpLCBudWxsKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbWkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFpKGUpID8gZSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYmkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFpKGUpID8gbChlW2VkXSkgPyBlIDogKFRlKFNwLCBlKSwgbnVsbCkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9pKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jb250ZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEModCkgPyAoVGUod3AsIGUpLCBudWxsKSA6IChlLmNvbnRlbnQgPSBqcih0LCB7fSksIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHZpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtYdV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQyh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB1ZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHBkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgSWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBQZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2koZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFZkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBEZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGtkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1aShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBnZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG1kOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgX2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB2ZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2koZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHlkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgYmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBBZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2koZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHlpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtlZF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXl1KHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFQodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGYoUW0sIE0odmksIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBndSh7fSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jb250ZW50ID0gYSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBraSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gKGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30pLm9wdGlvbnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geXUoZSkgPyBUKGUpID8gW10gOiBfbShNKFNtLCBlKSkgOiBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBaSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiB7fSwgdCA9IGUuZXhlY3V0ZSwgYSA9IHZvaWQgMCA9PT0gdCA/IHt9IDogdCwgbiA9IGUucHJlZmV0Y2gsIHIgPSB2b2lkIDAgPT09IG4gPyB7fSA6IG4sIGkgPSBhLnBhZ2VMb2FkLCBvID0gdm9pZCAwID09PSBpID8ge30gOiBpLCBzID0gYS5tYm94ZXMsIGMgPSB2b2lkIDAgPT09IHMgPyBbXSA6IHMsIGwgPSByLm1ib3hlcywgdSA9IHZvaWQgMCA9PT0gbCA/IFtdIDogbCwgZCA9IHIudmlld3MsIHAgPSB2b2lkIDAgPT09IGQgPyBbXSA6IGQsIGggPSBraShvKSwgZiA9IG0oTShraSwgYykpLCBnID0gbShNKGtpLCB1KSksIGIgPSBtKE0oa2ksIHApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBTaSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gKGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30pLmV4ZWN1dGUsIHQgPSB2b2lkIDAgPT09IGUgPyB7fSA6IGUsIGEgPSB0LnBhZ2VMb2FkLCBuID0gdm9pZCAwID09PSBhID8ge30gOiBhLCByID0gdC5tYm94ZXMsIGkgPSB2b2lkIDAgPT09IHIgPyBbXSA6IHIsIG8gPSB5bShuKSB8fCBbXSwgcyA9IG0oX20oTSh5bSwgaSkpKSwgYyA9IG0oWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIGwgPSBtKE0oa20sIGYobW0sIGMpKSksIHUgPSBmKGJtLCBjKSwgZCA9IGYoYm0sIGwpLCBwID0gdS5jb25jYXQoZCksIGggPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKHApKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBwWzBdLmNvbnRlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQyhnKSB8fCAoaC51cmwgPSBnKSwgaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB3aSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gKGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30pLmFuYWx5dGljczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKGUpID8gW10gOiBbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRWkoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30sIHQgPSBlLmV4ZWN1dGUsIGEgPSB2b2lkIDAgPT09IHQgPyB7fSA6IHQsIG4gPSBlLnByZWZldGNoLCByID0gdm9pZCAwID09PSBuID8ge30gOiBuLCBpID0gYS5wYWdlTG9hZCwgbyA9IHZvaWQgMCA9PT0gaSA/IHt9IDogaSwgcyA9IGEubWJveGVzLCBjID0gdm9pZCAwID09PSBzID8gW10gOiBzLCBsID0gci5tYm94ZXMsIHUgPSB2b2lkIDAgPT09IGwgPyBbXSA6IGwsIGQgPSByLnZpZXdzLCBwID0gdm9pZCAwID09PSBkID8gW10gOiBkLCBoID0gci5tZXRyaWNzLCBmID0gdm9pZCAwID09PSBoID8gW10gOiBoLCBnID0gd2kobyksIGIgPSBtKE0od2ksIGMpKSwgXyA9IG0oTSh3aSwgdSkpLCB2ID0gbShNKHdpLCBwKSksIHkgPSBtKE0od2ksIGYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucGFyYW1ldGVycyA9IHQucGFyYW1ldGVycywgZS5wcm9maWxlUGFyYW1ldGVycyA9IHQucHJvZmlsZVBhcmFtZXRlcnMsIGUub3JkZXIgPSB0Lm9yZGVyLCBlLnByb2R1Y3QgPSB0LnByb2R1Y3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSWkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0WzBdLCBuID0gdFsxXSwgciA9ICFUKGEpLCBpID0gIVQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciB8fCBpID8gKHIgJiYgKGUub3B0aW9ucyA9IGEpLCBpICYmIChlLm1ldHJpY3MgPSBuKSwgZSkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFRpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS50eXBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEFkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBIZShCcihlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHFkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBacihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgS3A6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhlKHlpKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFBpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgheXUoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhlKFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBIZShbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGYodCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChhKSA/IEhlKFtdKSA6IHplKE0oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhKSkudGhlbihfbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQ2koZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHl1KGUpID8gVChlKSA/IEhlKFtdKSA6IEhlKGYodCwgZSkpIDogSGUoW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFZpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXNwb25zZS5leGVjdXRlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBIZShudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdC5wYWdlTG9hZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbChhKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSGUobnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEuYW5hbHl0aWNzLCByID0gYS5vcHRpb25zLCBpID0gYS5tZXRyaWNzLCBvID0geyBhbmFseXRpY3M6IG4gfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6ZShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGkociwgRXIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENpKGksIFRyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJaShvLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5uYW1lLCBhID0gZS5hbmFseXRpY3MsIG4gPSBlLm9wdGlvbnMsIHIgPSBlLm1ldHJpY3MsIGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuYWx5dGljczogYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gemUoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBpKG4sIEVyKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDaShyLCBJcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSWkoaSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBOaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVzcG9uc2UuZXhlY3V0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbCh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSGUoW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0Lm1ib3hlczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAheXUoYSkgfHwgVChhKSA/IEhlKFtdKSA6IHplKE0oTGksIGYoRG0sIGEpKSkudGhlbihfbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gT2koZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuaW5kZXggPT09IHQgJiYgZS5uYW1lID09PSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE1pKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5wcmVmZXRjaCwgciA9ICh2b2lkIDAgPT09IG4gPyB7fSA6IG4pLm1ib3hlcywgaSA9IHZvaWQgMCA9PT0gciA/IFtdIDogcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKGkpID8gbnVsbCA6IGcoZihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPaShlLCB0LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBSaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQuaW5kZXgsIG4gPSB0Lm5hbWUsIGkgPSB0LnN0YXRlLCBvID0gdC5hbmFseXRpY3MsIHMgPSB0Lm9wdGlvbnMsIGMgPSB0Lm1ldHJpY3MsIGwgPSBNaShlLCBhLCBuKSwgdSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuYWx5dGljczogbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihsKSB8fCBEaSh1LCBsKSwgemUoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBpKHMsIERyKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDaShjLCBJcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSWkodSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBqaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVxdWVzdCwgYSA9IGUucmVzcG9uc2UucHJlZmV0Y2g7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWwoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhlKFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYS5tYm94ZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXl1KG4pIHx8IFQobikgPyBIZShbXSkgOiB6ZShNKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFJpKHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZihJbSwgbikpKS50aGVuKF9tKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB4aShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucHJlZmV0Y2gsIGEgPSAodm9pZCAwID09PSB0ID8ge30gOiB0KS52aWV3cywgbiA9IHZvaWQgMCA9PT0gYSA/IFtdIDogYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKG4pID8gbnVsbCA6IG5bMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQmkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0Lm5hbWUsIG4gPSB0LnN0YXRlLCBpID0gdC5hbmFseXRpY3MsIG8gPSB0Lm9wdGlvbnMsIHMgPSB0Lm1ldHJpY3MsIGMgPSB4aShlKSwgbCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogYS50b0xvd2VyQ2FzZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5hbHl0aWNzOiBpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGMpIHx8IERpKGwsIGMpLCB6ZShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGkobywgRHIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENpKHMsIFRyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJaShsLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXF1ZXN0LCBhID0gZS5yZXNwb25zZS5wcmVmZXRjaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbChhKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSGUoW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhLnZpZXdzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF5dShuKSB8fCBUKG4pID8gSGUoW10pIDogemUoTShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCaSh0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGYoVG0sIG4pKSkudGhlbihfbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJlc3BvbnNlLnByZWZldGNoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwodCkgPyBDaSh0Lm1ldHJpY3MsIFRyKSA6IEhlKFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBxaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVzcG9uc2UsIGEgPSB0LnJlbW90ZU1ib3hlcywgbiA9IHQucmVtb3RlVmlld3MsIHIgPSB0LmRlY2lzaW9uaW5nTWV0aG9kLCBpID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbChhKSAmJiAoaS5yZW1vdGVNYm94ZXMgPSBhKSwgbChuKSAmJiAoaS5yZW1vdGVWaWV3cyA9IG4pLCB5KHIpICYmIChpLmRlY2lzaW9uaW5nTWV0aG9kID0gciksIEhlKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFVpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGUpIHx8IEMoZS5pZCkgPyBIZShudWxsKSA6IEhlKHsgaWQ6IGUuaWQgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gemkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJlc3BvbnNlLm5vdGlmaWNhdGlvbnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geXUodCkgPyB6ZShNKFVpLCB0KSkudGhlbihfbSkgOiBIZShbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWWkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlWzBdLCBhID0gZVsxXSwgbiA9IGVbMl0sIHIgPSBlWzNdLCBpID0gZVs0XSwgbyA9IGVbNV0sIHMgPSBlWzZdLCBjID0ge30sIHUgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwodCkgJiYgKHUucGFnZUxvYWQgPSB0KSwgVChhKSB8fCAodS5tYm94ZXMgPSBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChuKSB8fCAoZC5tYm94ZXMgPSBuKSwgVChyKSB8fCAoZC52aWV3cyA9IHIpLCBUKGkpIHx8IChkLm1ldHJpY3MgPSBpKSwgVCh1KSB8fCAoYy5leGVjdXRlID0gdSksIFQoZCkgfHwgKGMucHJlZmV0Y2ggPSBkKSwgVChvKSB8fCAoYy5tZXRhID0gbyksIFQocykgfHwgKGMubm90aWZpY2F0aW9ucyA9IHMpLCBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEtpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYihbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTnIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVnIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHplKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaSh0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOaSh0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaSh0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGaSh0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIaSh0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxaSh0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6aSh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkudGhlbihZaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUWkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFUKFNpKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBHaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEFpKGUpLCBhID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVCh0KSB8fCAoYS5yZXNwb25zZVRva2VucyA9IHQpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFdpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gR2koZSksIGEgPSBFaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKGEpIHx8ICh0LmFuYWx5dGljc0RldGFpbHMgPSBhKSwgVGUoZ3AsIGUpLCBndCh0LCBRaShlKSksIEhlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICRpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gR2kodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5tYm94ID0gZSwgVGUoZ3AsIHQpLCBndChhLCBRaSh0KSksIEhlKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEppKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJZShmcCwgZSksIG10KHsgZXJyb3I6IGUgfSksIHFlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFppKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJZShmcCwgdCksIG10KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYm94OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgcWUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBYKClbc2hdLCBhID0gZS5tYm94LCBuID0gZS50aW1lb3V0LCByID0gbChlLnBhcmFtcykgPyBlLnBhcmFtcyA6IHt9LCBpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRpKGEsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWmkoYSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcyA9IHt9LCBjID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID09PSB0ID8gYy5wYWdlTG9hZCA9IHt9IDogYy5tYm94ZXMgPSBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLCBzLmV4ZWN1dGUgPSBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBocihhLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVCh1KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5hbmFseXRpY3MgPSB1LCBzLmV4cGVyaWVuY2VDbG91ZCA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnQoeyBtYm94OiBhIH0pLCBtcihzLCByKS50aGVuKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFyKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihLaSkudGhlbihpKS5jYXRjaChvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFgoKVtzaF0sIGEgPSBlLmNvbnN1bWVySWQsIG4gPSB2b2lkIDAgPT09IGEgPyB0IDogYSwgciA9IGUucmVxdWVzdCwgaSA9IGUudGltZW91dCwgbyA9IGhyKG4sIHIpLCBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFdpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSmkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVChvKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gci5leHBlcmllbmNlQ2xvdWQgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5hbmFseXRpY3MgPSBvLCByLmV4cGVyaWVuY2VDbG91ZCA9IGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnQoe30pLCBtcihyLCB7fSkudGhlbihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcihlLCB0LCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oS2kpLnRoZW4ocykuY2F0Y2goYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIER0KHQpLmFkZENsYXNzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGFvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEdCh0KS5jc3MoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbm8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIER0KHQpLmF0dHIoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcm8oZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIER0KGEpLmF0dHIoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaW8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIER0KHQpLnJlbW92ZUF0dHIoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gb28oZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBubyhlLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE11KG4pICYmIChpbyhlLCBhKSwgcm8odCwgbiwgYSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdShubyhlLCB0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gY28oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBFcnJvcignQ291bGQgbm90IGZpbmQ6ICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsbyhlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRmUoZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IFJlKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUKHQpIHx8IChpLmRpc2Nvbm5lY3QoKSwgbih0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuZGlzY29ubmVjdCgpLCByKGNvKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KSwgaS5vYnNlcnZlKGRvY3VtZW50LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkTGlzdDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YnRyZWU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1bygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkb2N1bWVudFtHbV0gPT09IFdtOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHBvKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGZShmdW5jdGlvbiAobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVCh0KSA/IHdpbmRvdy5yZXF1ZXN0QW5pbWF0aW9uRnJhbWUoaSkgOiBuKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKCksIHEoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKGNvKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGhvKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGZShmdW5jdGlvbiAobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVCh0KSA/IHEoaSwgJG0pIDogbih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSgpLCBxKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihjbyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDogWCgpW2doXSwgYSA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzJdID8gYXJndW1lbnRzWzJdIDogRHQsIG4gPSBhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQobikgPyBNZSgpID8gbG8oZSwgdCwgYSkgOiB1bygpID8gcG8oZSwgdCwgYSkgOiBobyhlLCB0LCBhKSA6IEhlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGdvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBubyhCZCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbW8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNvKEJkLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBibyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvbyh6ZCwgQmQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSShPdChaZCwgZSkpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBfbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvbyhCZCwgemQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSShPdChaZCwgZSkpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2byhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUoVHAsIGUpLCBubyh6ZCwgcm8oemQsIGUsIFB0KCc8JyArIFpkICsgJy8+JykpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5byhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGYobW8sIEkoT3QoWmQsIGUpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVCh0KSB8fCBfKHZvLCBNKGdvLCB0KSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24ga28oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHlvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9vCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG5vKHpkLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdSh0KSA/IHQgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmKE11LCBNKEFvLCBJKE90KFVkLCBlKSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB3byhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUoTnAsIHQpLCBPZSh7IHJlbW90ZVNjcmlwdDogdCB9KSwgdnUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBIZSgpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBFbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBEbyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSWUoaHAsIHQpLCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBJbyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgbiA9IER0KHRbY2RdKSwgciA9IGtvKFR0KHRbZWRdKSksIGkgPSBTbyhyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IEhlKGUobiwgcikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxZShEbyh0LCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChpKSA/IGEudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVvKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRG8odCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGEudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVvKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRG8odCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBUbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFR0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE8oJycsIGooZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wdXNoKHJhKFR0KHQpKSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBbXSwgSShPdChKbSwgdCkpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUG8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBndSh7fSwgZSksIGEgPSB0W2VkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDKGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBEdCh0W2NkXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTnQoR2QsIG4pID8gKHRbWHVdID0gSWQsIHRbZWRdID0gVG8oYSksIHQpIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5pbmRleE9mKCdweCcpID09PSBlLmxlbmd0aCAtIDIgPyBlIDogZSArICdweCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVm8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5hKHJhKHQpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBMbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUoYnAsIGUpLCBJbyhWbywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTm8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBEdChlW2NkXSksIGEgPSBlW2VkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZShicCwgZSksIE9lKHsgYWN0aW9uOiBlIH0pLCBpYShhLCB0KSwgSGUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gT28oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRhKHJhKHQpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUoYnAsIGUpLCBJbyhPbywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUm8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFhKHJhKHQpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBqbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUoYnAsIGUpLCBJbyhSbywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBMdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBadChlYShyYSh0KSwgZSkpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEJvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZShicCwgZSksIElvKHhvLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBGbyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQ3QoZWEocmEodCksIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBIbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUoYnAsIGUpLCBJbyhGbywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcW8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFZ0KFh0KHJhKHQpLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVW8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRlKGJwLCBlKSwgSW8ocW8sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHpvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBMdChlYShyYSh0KSwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFlvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZShicCwgZSksIElvKHpvLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBLbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbZWRdLCBhID0gRHQoZVtjZF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRlKGJwLCBlKSwgT2UoeyBhY3Rpb246IGUgfSksIGlvKHpkLCBhKSwgcm8oemQsIHZvKHQpLCBhKSwgSGUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUW8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW2VkXSwgYSA9IER0KGVbY2RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZShicCwgZSksIE9lKHsgYWN0aW9uOiBlIH0pLCBfKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJvKHQsIGUsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCksIEhlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEdvKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0eWxlLnNldFByb3BlcnR5KG4sIHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSShlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gV28oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBEdChlW2NkXSksIGEgPSBlW2VkXSwgbiA9IGFbc2RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRlKGJwLCBlKSwgT2UoeyBhY3Rpb246IGUgfSksIEMobikgPyBhbyhhLCB0KSA6IEdvKHQsIGEsIG4pLCBIZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAkbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IER0KGVbY2RdKSwgYSA9IGVbZWRdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbYWRdID0gQ28oYVthZF0pLCBhW3RkXSA9IENvKGFbdGRdKSwgVGUoYnAsIGUpLCBPZSh7IGFjdGlvbjogZSB9KSwgYW8oYSwgdCksIEhlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEpvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gRHQoZVtjZF0pLCBhID0gZVtlZF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYVtuZF0gPSBDbyhhW25kXSksIGFbcmRdID0gQ28oYVtyZF0pLCBUZShicCwgZSksIE9lKHsgYWN0aW9uOiBlIH0pLCBhbyhhLCB0KSwgSGUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWm8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBEdChlW2NkXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUoYnAsIGUpLCBPZSh7IGFjdGlvbjogZSB9KSwgWnQodCksIEhlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFhvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gRHQoZVtjZF0pLCBhID0gZVtlZF0sIG4gPSBOdW1iZXIoYVtpZF0pLCByID0gTnVtYmVyKGFbb2RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc05hTihuKSAmJiBpc05hTihyKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUoSXAsIGUpLCBxZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gSShNdCh0KSksIG8gPSBpW25dLCBzID0gaVtyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJdChvKSAmJiBJdChzKSA/IChUZShicCwgZSksIE9lKHsgYWN0aW9uOiBlIH0pLCBuIDwgciA/IFh0KG8sIHMpIDogZWEobywgcyksIEhlKGUpKSA6IChUZShEcCwgZSksIHFlKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFBvKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0W1h1XSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB1ZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTG8odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHBkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBObyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgSWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1vKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBQZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gam8odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFZkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhvKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBEZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVW8odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGtkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBZbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFvKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBnZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gS28odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG1kOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgX2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRvKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB2ZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSm8odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHlkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBabyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgYmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFhvKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSGUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbWHVdID09PSBTZCB8fCBlW1h1XSA9PT0gd2Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYXMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW2NkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdSh0KSB8fCBBdCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBucyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUua2V5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFDKHQpICYmIGFzKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlW2NkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBybyhabSwgdCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcnMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW2xkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEModCkgfHwgYmEodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaXMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFzKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW2NkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cyhlKSA/IHRvKHRoLCB0KSA6ICh0byhlaCwgdCksIHJzKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG9zKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8oaXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5rZXk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQyh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVtYdV0gPT09IGtkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW0toXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZVtjZF0sIG4gPSBubyhabSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAhPT0gdCB8fCBuID09PSB0ICYmICFlW0toXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3MoZSkgPyBlcyhlKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUobXAsIGUpLCBPZSh7IGFjdGlvbjogZSB9KSwgbnMoZSksIGlzKGUpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJZShocCwgdCksIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGd1KHt9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYVtPcF0gPSAhMCwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogKGlzKGUpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBscyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGYoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGVbT3BdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVCh0KSA/IEhlKCkgOiAob3ModCksIHFlKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1cyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZm8oZVtjZF0pLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZ3Uoe30sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W09wXSA9ICEwLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVzKGUpLnRoZW4oY3MpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHBzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6ZShNKGRzLCBlKSkudGhlbihscyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaHMoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIER0KGEpLm9uKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZzKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEdChhKS5vZmYoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZ3MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZvKGVbY2RdKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2UoeyBtZXRyaWM6IGUgfSksIGd1KHsgZm91bmQ6ICEwIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJZShYbSwgZSksIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0cmljOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiBYbQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbXMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLm5hbWUsIGEgPSBxYShHaCkgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhW3RdID0gZSwgSGEoR2gsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGJzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiB7fSwgYSA9IHQucGFnZSwgbiA9IHZvaWQgMCA9PT0gYSB8fCBhLCBpID0gKHFhKEdoKSB8fCB7fSlbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocihpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdC5pbXByZXNzaW9uSWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihvKSA/IGkgOiBndSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbXByZXNzaW9uSWQ6IG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9zKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8obXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHZzKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW2ViXVt0Yl0odCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geXMoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bZWZdID0gW3RmXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByW3htXSA9IGptLCByW0JtXSA9IHQsIHJbSG1dID0gYSwgcltxbV0gPSAhMCwgclt6bV0gPSAhMSwgcltGbV0gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBrcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWIgaW4gZSAmJiB0YiBpbiBlW2ViXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBcyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ga3Mod2luZG93KSA/IHZzKHdpbmRvdywgZSwgdCkgOiB5cyhHciwgZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gU3MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBocihlLCB7fSksIGEgPSB7IGNvbnRleHQ6IHsgYmVhY29uOiAhMCB9IH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVQodCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uYW5hbHl0aWNzID0gdCwgYS5leHBlcmllbmNlQ2xvdWQgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gd3MoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBicihTcyhlKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5ub3RpZmljYXRpb25zID0gYSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBFcyhlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbXIoU3MoZSksIHQpLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5ub3RpZmljYXRpb25zID0gYSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERzKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBIKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXA6IFIoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbWV0ZXJzOiBlLnBhcmFtZXRlcnMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZmlsZVBhcmFtZXRlcnM6IGUucHJvZmlsZVBhcmFtZXRlcnMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3JkZXI6IGUub3JkZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZHVjdDogZS5wcm9kdWN0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQoYSkgfHwgKG4udG9rZW5zID0gYSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSXMoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLm5hbWUsIHIgPSBlLnN0YXRlLCBpID0gRHMoZSwgdCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5tYm94ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVHMoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLm5hbWUsIHIgPSBlLnN0YXRlLCBpID0gRHMoZSwgdCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS52aWV3ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB5cihYKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFzKHQsIEpTT04uc3RyaW5naWZ5KGUpKSA/IChUZShhYiwgdCwgZSksICEwKSA6IChJZShuYiwgdCwgZSksICExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDcyhlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHBuKFgoKVtzaF0pLCByID0gRHMoY3Ioe30sIG4pLCB0LCBbYV0pLCBpID0gd3MoSCgpLCBuLCBbcl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGUoc2IsIGUsIHIpLCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IGkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBQcyhpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBWcyhlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHBuKGUpLCByID0gRHMoY3Ioe30sIG4pLCB0LCBbYV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5tYm94ID0geyBuYW1lOiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHdzKEgoKSwgbiwgW3JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRlKGNiLCBlLCByKSwgT2UoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ib3g6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIFBzKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gWCgpW3NoXSwgYSA9IFtdLCBuID0gWGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoXyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubWJveCwgaSA9IGUuZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyKGkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGkuZXZlbnRUb2tlbnMsIHMgPSB2b2lkIDAgPT09IG8gPyBbXSA6IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUKHMpIHx8IGEucHVzaChJcyh0LCBuLCBzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKSwgIVQoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHdzKHQsIHt9LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZShvYiwgYSksIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiB1YiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQ6IGRiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIFBzKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE5zKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gcG4oWCgpW3NoXSksIHIgPSBEcyhjcih7fSwgbiksIHQsIFthXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnZpZXcgPSB7IG5hbWU6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gd3MoSCgpLCBuLCBbcl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGUobGIsIGUsIHIpLCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlldzogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudDogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgUHMoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gT3MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnZpZXdOYW1lLCBhID0gZS5pbXByZXNzaW9uSWQsIG4gPSBwbihYKClbc2hdKSwgciA9IERzKGNyKHt9LCBuKSwgWGgsIFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIudmlldyA9IHsgbmFtZTogdCB9LCBUZShyYiwgdCksIEVzKHQsIG4sIFtyXSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaW1wcmVzc2lvbklkID0gYSwgT2UoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWV3OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudDogcGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgUHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudmlldywgYSA9IGUuZGF0YSwgbiA9ICh2b2lkIDAgPT09IGEgPyB7fSA6IGEpLmV2ZW50VG9rZW5zLCBpID0gdm9pZCAwID09PSBuID8gW10gOiBuLCBvID0gdC5uYW1lLCBzID0gdC5pbXByZXNzaW9uSWQsIGMgPSBicyhvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIoYykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSB3cyhvLCB7fSwgW1RzKGMsIFhoLCBpKV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLmltcHJlc3Npb25JZCA9IHMsIFRlKGliLCBvLCBpKSwgT2UoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlldzogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50OiBkYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IGwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIFBzKGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBScyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID09PSBRZCAmJiB0byh0aCwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24ganMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFyKGhiW2VdKSAmJiAhcihoYltlXVt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geHMoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIoaGJbZV0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBoKGhiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUKG4pIHx8IF8oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXyhmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBoYltlXVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZzKHQsIHIsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBoKGhiW2VdKSksIGRlbGV0ZSBoYltlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBCcyhlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYltlXSA9IGhiW2VdIHx8IHt9LCBoYltlXVt0XSA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRnMoZSwgdCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBhLnR5cGUsIGkgPSBhLnNlbGVjdG9yLCBvID0gYS5ldmVudFRva2VuLCBzID0gayhyICsgJzonICsgaSArICc6JyArIG8pLCBjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbihlLCByLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUnMociwgaSksIHQgPyBqcyhlLCBzKSB8fCAoeHMoZSwgciwgaSksIEJzKGUsIHMsIGMpLCBocyhyLCBjLCBpKSkgOiBocyhyLCBjLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBIcyhlLCB0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gemUoTShncywgYSkpLnRoZW4oZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXyhmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRnMoZSwgdCwgYSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5mb3VuZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhKSksIGJiKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChfYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcXMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhzKGUubmFtZSwgITEsIG1iKGUpLCBWcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVXMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhzKGUubmFtZSwgITAsIG1iKGUpLCBOcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24genMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhzKGZiLCAhMSwgbWIoZSksIENzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBZcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSHMoZ2IsICExLCBtYihlKSwgQ3MpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEtzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gTSh5YiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnYSh2bSh0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUXMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBNKHliLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hKF9tKHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBHcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGYobW0sIHltKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKE0odmIsIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBXcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbChlKSAmJiBlLnR5cGUgIT09IGhkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICRzKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGd1KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmKFdzLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSnMoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmV2ZW50VG9rZW4sIHIgPSBlLnJlc3BvbnNlVG9rZW5zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBzKCRzKGUuY29udGVudCwgdCwgYSkpLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBrYih7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50VG9rZW46IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlVG9rZW5zOiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChBYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWnMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwoZSkgJiYgZS50eXBlICE9PSBGZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBYcyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShlLCBmKFpzLCB5bSh0KSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGVjKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYyh7IHN0YXR1czogeHAgfSwgZSwgdCksIHIgPSBNKENtLCBmKGdtLCBhKSksIGkgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKHIpIHx8IChuLnN0YXR1cyA9IE9wLCBpLmVycm9ycyA9IHIpLCBUKGkpIHx8IChuLmRhdGEgPSBpKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0YyhlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGMoeyBzdGF0dXM6IHhwIH0sIGUsIHQpLCByID0gTShDbSwgZihnbSwgYSkpLCBpID0gTShDbSwgZihTYiwgYSkpLCBvID0gX20oTShBbSwgaSkpLCBzID0gX20oTShTbSwgaSkpLCBsID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChyKSB8fCAobi5zdGF0dXMgPSBPcCwgbC5lcnJvcnMgPSByKSwgVChvKSB8fCAobC5ldmVudFRva2VucyA9IG8pLCBUKHMpIHx8IChsLnJlc3BvbnNlVG9rZW5zID0gcyksIFQobCkgfHwgKG4uZGF0YSA9IGwpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGFjKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6ZShYcyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKcyhlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKSkudGhlbih0KS50aGVuKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoZSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuYyhlLCB0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQubmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6ZShYcyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKcyhlLCByLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQpKS50aGVuKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRjKGUsIHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKHQpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcmMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFjKGUsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVjKEhwLCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHFzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmMoSHAsIGUsICEwLCBxcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gb2MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS3MoR3MoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdICYmIGFyZ3VtZW50c1sxXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuZXhlY3V0ZSwgYSA9ICh2b2lkIDAgPT09IHQgPyB7fSA6IHQpLnBhZ2VMb2FkLCBuID0gdm9pZCAwID09PSBhID8ge30gOiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQobikgfHwgb2Mobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gY2MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnByZWZldGNoLCBhID0gKHZvaWQgMCA9PT0gdCA/IHt9IDogdCkudmlld3MsIG4gPSB2b2lkIDAgPT09IGEgPyBbXSA6IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUKG4pIHx8IFFzKG0oTShHcywgbikpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBLcyhHcyhlKSksIF9hKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdWMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFjKGUsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVjKFpwLCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHpzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gemUoTShyYywgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHBjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6ZShNKGljLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaGMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHplKFtZcyhlKV0pLnRoZW4oZWMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5wYWdlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5jKFFoLCBlLCB0LCBVcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZ2MoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbWMoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHdiKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYmMoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5lbWl0KHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9jKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUub24odCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdmMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmMoRGIsIGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHljKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9jKERiLCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBrYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IEFkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGUudXJsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEFjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0gdWQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0gcGQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHdjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0gSWQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0gUGQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0gVmQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEljKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0gRWQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFRjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0gRGQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFBjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0ga2QsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIENjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCBlLmF0dHJpYnV0ZSA9PT0gemQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudHlwZSA9IGdkLCB0LmNvbnRlbnQgPSBlLnZhbHVlLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC50eXBlID0gZmQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbZS5hdHRyaWJ1dGVdID0gZS52YWx1ZSwgdC5jb250ZW50ID0gYSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBWYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuc3R5bGUsIGEgPSB2b2lkIDAgPT09IHQgPyB7fSA6IHQsIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnNlbGVjdG9yID0gZS5zZWxlY3Rvciwgbi5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHIoYS5sZWZ0KSB8fCByKGEudG9wKSA/IHIoYS53aWR0aCkgfHwgcihhLmhlaWdodCkgPyAobi50eXBlID0gbWQsIG4uY29udGVudCA9IGEsIG4pIDogKG4udHlwZSA9IF9kLCBuLmNvbnRlbnQgPSBhLCBuKSA6IChuLnR5cGUgPSB2ZCwgbi5jb250ZW50ID0gYSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTGMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnR5cGUgPSB5ZCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE5jKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmZyb20gPSBlLmZyb20sIHQudG8gPSBlLnRvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLnR5cGUgPSBiZCwgYS5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIGEuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCBhLmNvbnRlbnQgPSB0LCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE9jKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdShlLnNlbGVjdG9yKSAmJiBNdShlLmNzc1NlbGVjdG9yKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFQoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFtdLCBuID0gW10sIHIgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUuYWN0aW9uKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBkZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2MoZSkgPyByLnB1c2goQWMoZSkpIDogYS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IEhkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogZS5jb250ZW50CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGhkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUKGUuY29udGVudCkgfHwgXyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogRmQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuY29udGVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgcGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChTYyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaCh3YyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChFYyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChEYyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChJYyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChUYyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Uga2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChQYyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChDYyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChWYyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgeWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChMYyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgYmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChOYyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucHVzaChrYyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgU2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBRZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdG9yOiBlLnNlbGVjdG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRUb2tlbjogZS5jbGlja1RyYWNrSWQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFUKHIpICYmIGEucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IEtwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksICFUKGEpICYmIChpLm9wdGlvbnMgPSBhKSwgIVQobikgJiYgKGkubWV0cmljcyA9IG4pLCBUKGkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLnBhZ2VMb2FkID0gaSwgdC5leGVjdXRlID0gbywgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBSYyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFQodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFtdLCByID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLmFjdGlvbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBIZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGUuY29udGVudAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBoZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVChlLmNvbnRlbnQpIHx8IF8oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IEZkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmNvbnRlbnQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEFkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnB1c2goa2MoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHdkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogUWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudFRva2VuOiBlLmNsaWNrVHJhY2tJZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0geyBuYW1lOiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVQobikgJiYgKGkub3B0aW9ucyA9IG4pLCAhVChyKSAmJiAoaS5tZXRyaWNzID0gciksIFQoaSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHt9LCBzID0gW2ldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8ubWJveGVzID0gcywgYS5leGVjdXRlID0gbywgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBqYyhlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA/IE1jKHQpIDogUmMoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geGMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnN0YXR1cywgYSA9IGUuZGF0YSwgbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlTG9hZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoYSkgfHwgKG4uZGF0YSA9IGEpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEJjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5zdGF0dXMsIGEgPSBlLm1ib3gsIG4gPSBlLmRhdGEsIGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWJveDogYS5uYW1lCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKG4pIHx8IChpLmRhdGEgPSBuKSwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBGYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuc3RhdHVzLCBhID0gZS52aWV3LCBuID0gZS5kYXRhLCBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXM6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZXc6IGEubmFtZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihuKSB8fCAoaS5kYXRhID0gbiksIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSGMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnN0YXR1cywgYSA9IGUuZGF0YSwgbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVmZXRjaE1ldHJpY3M6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGEpIHx8IChuLmRhdGEgPSBhKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBxYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocihlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW251bGxdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBNKHhjLCBbZV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFZiKHQpICYmIEllKEliLCBlKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBVYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocihlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW251bGxdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBNKEJjLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBWYih0KSAmJiBJZShUYiwgZSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gemMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IExzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtudWxsXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gTShCYywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVmIoYSkgJiYgSWUoVGIsIGUpLCB0KGUpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFljKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiBNczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbbnVsbF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IE0oRmMsIFtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVmIoYSkgJiYgSWUoUGIsIGUpLCBlLnZpZXcucGFnZSA/ICh0KGUpLCBhKSA6IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gS2MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtudWxsXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gTShIYywgW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBWYih0KSAmJiBJZShDYiwgZSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUWMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBtKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcWMoZVswXSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVjKGVbMV0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6YyhlWzJdKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS2MoZVszXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgYSA9IGYocG0sIHQpLCBuID0gZihnbSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChuKSA/IEhlKGEpIDogcWUobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gR2MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHFlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFdjKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVCh0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdC5vcHRpb25zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQoYSkgfHwgXyhmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC50eXBlID09PSBIZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB1ZCwgbiA9IHQuY29udGVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudHlwZSA9IEtwLCB0LmNvbnRlbnQgPSBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxlY3RvcjogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gJGMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0Lm1ldHJpY3M7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVQoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQubmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubmFtZSA9IG4sIHQuc2VsZWN0b3IgPSB0LnNlbGVjdG9yIHx8IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSmMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBndSh7fSwgdCksIG4gPSBhLmV4ZWN1dGUsIHIgPSB2b2lkIDAgPT09IG4gPyB7fSA6IG4sIGkgPSBhLnByZWZldGNoLCBvID0gdm9pZCAwID09PSBpID8ge30gOiBpLCBzID0gci5wYWdlTG9hZCwgYyA9IHZvaWQgMCA9PT0gcyA/IHt9IDogcywgbCA9IHIubWJveGVzLCB1ID0gdm9pZCAwID09PSBsID8gW10gOiBsLCBkID0gby5tYm94ZXMsIHAgPSB2b2lkIDAgPT09IGQgPyBbXSA6IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gV2MoZSwgYyksIF8oZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gV2MoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB1KSwgXyhmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkYyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHUpLCBfKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFdjKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcCksIF8oZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGMoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBwKSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBaYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucHJlZmV0Y2gsIGEgPSAodm9pZCAwID09PSB0ID8ge30gOiB0KS52aWV3cywgbiA9IHZvaWQgMCA9PT0gYSA/IFtdIDogYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQobikgfHwgX3Mobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWGMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXSwgYSA9IGUuZXhlY3V0ZSwgbiA9IHZvaWQgMCA9PT0gYSA/IHt9IDogYSwgciA9IG4ucGFnZUxvYWQsIGkgPSB2b2lkIDAgPT09IHIgPyB7fSA6IHIsIG8gPSBuLm1ib3hlcywgcyA9IHZvaWQgMCA9PT0gbyA/IFtdIDogbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQoaSkgPyB0LnB1c2goSGUobnVsbCkpIDogdC5wdXNoKHVjKGkpKSwgVChzKSA/IHQucHVzaChIZShudWxsKSkgOiB0LnB1c2goZGMocykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBlLnByZWZldGNoLCBsID0gdm9pZCAwID09PSBjID8ge30gOiBjLCB1ID0gbC5tYm94ZXMsIGQgPSB2b2lkIDAgPT09IHUgPyBbXSA6IHUsIHAgPSBsLm1ldHJpY3MsIGggPSB2b2lkIDAgPT09IHAgPyBbXSA6IHA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChkKSA/IHQucHVzaChIZShudWxsKSkgOiB0LnB1c2gocGMoZCkpLCB5dShoKSAmJiAhVChoKSA/IHQucHVzaChoYyhsKSkgOiB0LnB1c2goSGUobnVsbCkpLCBmYSgpLCB6ZSh0KS50aGVuKFFjKS5jYXRjaChHYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZWwoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubG9jYXRpb24ucmVwbGFjZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHRsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdShlKSB8fCBBdChlKSA/IGUgOiBHZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0byhlaCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbmwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLm1ib3gsIGEgPSBlLnNlbGVjdG9yLCBuID0gZS5vZmZlciwgciA9IFgoKSwgaSA9IHQgPT09IHJbc2hdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFQobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRlKFZwKSwgYWwoYSksIGZhKCksIHZvaWQgeXQoeyBtYm94OiB0IH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBKYyhhLCBqYyh0LCBuLCBpKSksIHMgPSBTaShvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVChzKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gcy51cmw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRlKExwLCBzKSwga3QoeyB1cmw6IGMgfSksIHZvaWQgZWwod2luZG93LCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ0KHsgbWJveDogdCB9KSwgc2MobyksIFhjKG8pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUKGUpIHx8IF90KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWJveDogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0aW9uOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2dCh7IGVycm9yOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcmwoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30sIHQgPSBlLnByZWZldGNoLCBhID0gdm9pZCAwID09PSB0ID8ge30gOiB0LCBuID0gZS5leGVjdXRlLCByID0gdm9pZCAwID09PSBuID8ge30gOiBuLCBpID0gci5wYWdlTG9hZCwgbyA9IHZvaWQgMCA9PT0gaSA/IHt9IDogaSwgcyA9IHIubWJveGVzLCBjID0gdm9pZCAwID09PSBzID8gW10gOiBzLCBsID0gYS5wYWdlTG9hZCwgdSA9IHZvaWQgMCA9PT0gbCA/IHt9IDogbCwgZCA9IGEudmlld3MsIHAgPSB2b2lkIDAgPT09IGQgPyBbXSA6IGQsIGggPSBhLm1ib3hlcywgZiA9IHZvaWQgMCA9PT0gaCA/IFtdIDogaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKG8pICYmIFQoYykgJiYgVCh1KSAmJiBUKHApICYmIFQoZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaWwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSAmJiBhcmd1bWVudHNbMV0sIGEgPSBlLnNlbGVjdG9yLCBuID0gZS5yZXNwb25zZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChybChuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUoVnApLCBhbChhKSwgZmEoKSwgeXQoe30pLCB2YyhTZiksIEhlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IEpjKGEsIG4pLCBpID0gU2kocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVQoaSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGkudXJsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZShMcCwgaSksIGt0KHsgdXJsOiBvIH0pLCB2Yyh3ZiksIGVsKHdpbmRvdywgbyksIEhlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYnQoe30pLCBaYyhyKSwgdmMoQWYpLCBzYyhyLCB0KSwgWGMocikudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQoZSkgfHwgX3QoeyBleGVjdXRpb246IGUgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2dCh7IGVycm9yOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gb2woZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW3ZmXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdC5yZXF1ZXN0LCBuID0gdC5yZXNwb25zZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhVChhKSAmJiAhVChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt2Zl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gY2woZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSWUoTGIsIG5mLCBlKSwgdmMoU2YpLCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBMYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGZhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbGwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSAmJiBhcmd1bWVudHNbMV0sIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdG9yOiBHZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2U6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGUoTGIsIFdwLCBlKSwgT2UoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogTGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2U6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpbChhLCB0KS5jYXRjaChjbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdWwoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBndSh7fSwgdCksIG4gPSBhLmV4ZWN1dGUsIHIgPSBhLnByZWZldGNoLCBpID0gZVtIaF0sIG8gPSBlW0ZoXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICYmIChhLmV4ZWN1dGUubWJveGVzID0gbnVsbCksIG4gJiYgIWkgJiYgKGEuZXhlY3V0ZS5wYWdlTG9hZCA9IG51bGwpLCByICYmIChhLnByZWZldGNoLm1ib3hlcyA9IG51bGwpLCByICYmICFvICYmIChhLnByZWZldGNoLnZpZXdzID0gbnVsbCksIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZGwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBzbChlKSwgYSA9IHQucmVxdWVzdCwgbiA9IHQucmVzcG9uc2UsIHIgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRlKExiLCBjZiksIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IExiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZlclN0YXRlOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdWwoZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYyhpKSwgY2MoaSksIEtpKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlOiBpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxsKGUsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goY2wpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHBsKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFrZSgpICYmICFTZSgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJZShMYiwgZXApLCB2b2lkIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBMYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFgoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvbChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtIaF0sIGEgPSBlW0ZoXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXQgJiYgIWEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZShMYiwgc2YpLCB2b2lkIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogTGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogc2YKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0geyBwYWdlTG9hZDoge30gfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5leGVjdXRlID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB7IHZpZXdzOiBbe31dIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucHJlZmV0Y2ggPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGVbb2hdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRlKExiLCAkcCwgbiksIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBMYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lb3V0OiBvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkZSgpICYmICFKZSgpID8gWGUoKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW8ocykudGhlbihsbCkuY2F0Y2goY2wpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGNsKSA6IGVvKHMpLnRoZW4obGwpLmNhdGNoKGNsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBobCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtqcF0gPSAhMCwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbanBdID0gITEsIHRbT3BdID0gZSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQyhlKSA/IGZsKGNwKSA6IGUubGVuZ3RoID4geGQgPyBmbChscCkgOiBobCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG1sKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmwoYXApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBnbChlW0hwXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtqcF0gPyB1KGVbeHBdKSA/IHUoZVtPcF0pID8gaGwoKSA6IGZsKGRwKSA6IGZsKHVwKSA6IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYmwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmbChhcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVxdWVzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbCh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmwobnApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0LmV4ZWN1dGUsIG4gPSB0LnByZWZldGNoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwoYSkgfHwgbChuKSA/IGhsKCkgOiBmbChpcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gX2woZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmbChhcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVxdWVzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbCh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmwobnApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0LmV4ZWN1dGUsIG4gPSB0LnByZWZldGNoLCByID0gdC5ub3RpZmljYXRpb25zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwoYSkgfHwgbChuKSA/IGZsKG9wKSA6IHl1KHIpID8gaGwoKSA6IGZsKHNwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2bChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWwoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZsKGFwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZ2woZVtIcF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0W2pwXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZVtxcF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geXUoYSkgPyBobCgpIDogZmwocHApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHlsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKGUpID8gbChlLnJlc3BvbnNlKSA/IGhsKCkgOiBmbChycCkgOiBmbChhcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24ga2woZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmbChhcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGdsKGVbSHBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W2pwXSA/IGhsKCkgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEFsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiBBZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGUuY29udGVudAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBTbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gZGQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHdsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hY3Rpb24gPSBwZCwgdC5jb250ZW50ID0gZS5jb250ZW50LCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRWwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFjdGlvbiA9IFRkLCB0LmNvbnRlbnQgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBEbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gQ2QsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIElsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hY3Rpb24gPSBMZCwgdC5jb250ZW50ID0gZS5jb250ZW50LCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVGwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFjdGlvbiA9IEVkLCB0LmNvbnRlbnQgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBQbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gRGQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIENsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hY3Rpb24gPSBrZCwgdC5jb250ZW50ID0gZS5jb250ZW50LCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVmwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBoKGUuY29udGVudClbMF0sIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmFjdGlvbiA9IGZkLCBhLmF0dHJpYnV0ZSA9IHQsIGEudmFsdWUgPSBlLmNvbnRlbnRbdF0sIGEuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCBhLmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBMbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gZmQsIHQuYXR0cmlidXRlID0gemQsIHQudmFsdWUgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBObChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gbWQsIHQuc3R5bGUgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBPbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gbWQsIHQuc3R5bGUgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gbWQsIHQuc3R5bGUgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBSbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0geWQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBqbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gYmQsIHQuZnJvbSA9IGUuY29udGVudC5mcm9tLCB0LnRvID0gZS5jb250ZW50LnRvLCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geGwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHVkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goU2woZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHBkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2god2woZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIElkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goRWwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFBkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goRGwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFZkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goSWwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEVkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goVGwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIERkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goUGwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGtkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goQ2woZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGZkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goVmwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGdkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goTGwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG1kOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goTmwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIF9kOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goT2woZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHZkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goTWwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHlkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goUmwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGJkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goamwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEFkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goQWwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEJsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUudHlwZSA9PT0gUWQgJiYgKFBtKGUpID8gdC5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiBTZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0b3I6IGUuc2VsZWN0b3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWNrVHJhY2tJZDogZS5ldmVudFRva2VuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiB0LnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb246IHdkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGlja1RyYWNrSWQ6IGUuZXZlbnRUb2tlbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW10sIGEgPSBbXSwgbiA9IFtdLCByID0gZS5vcHRpb25zLCBpID0gdm9pZCAwID09PSByID8gW10gOiByLCBvID0gZS5tZXRyaWNzLCBzID0gdm9pZCAwID09PSBvID8gW10gOiBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS50eXBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBIZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKGUuY29udGVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucHVzaChlLmNvbnRlbnQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEFkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnB1c2goQWwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEtwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnB1c2guYXBwbHkobiwgeGwoZS5jb250ZW50KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSksIFQodCkgfHwgbi5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb246IGRkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IHQuam9pbignJykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBUKGEpIHx8IG4ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiBoZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gQmwocyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChjKSB8fCBuLnB1c2guYXBwbHkobiwgYyksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSGwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmV4ZWN1dGUsIGEgPSB2b2lkIDAgPT09IHQgPyB7fSA6IHQsIG4gPSBhLnBhZ2VMb2FkLCByID0gdm9pZCAwID09PSBuID8ge30gOiBuLCBpID0gYS5tYm94ZXMsIG8gPSB2b2lkIDAgPT09IGkgPyBbXSA6IGksIHMgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzLnB1c2guYXBwbHkocywgRmwocikpLCBzLnB1c2guYXBwbHkocywgbShNKEZsLCBvKSkpLCBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHFsKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gSGwodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3hwXShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBVbChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRbenBdIHx8IFJwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtPcF0oYSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gemwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBtbChlKSwgYSA9IHRbT3BdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0W2pwXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSWUoTmIsIGEpLCB2b2lkIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBOYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgha2UoKSAmJiAhU2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcShlW09wXShNcCwgZXApKSwgSWUoTmIsIGVwKSwgdm9pZCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogTmIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBlcAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcWwoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVbChlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGUoTmIsIGUpLCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBOYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgJGUoKSAmJiAhSmUoKSA/IFhlKCkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWGkoZSkudGhlbihuKS5jYXRjaChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogWGkoZSkudGhlbihuKS5jYXRjaChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBZbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGJsKGUpLCBhID0gdFtPcF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtqcF0gPyBrZSgpIHx8IFNlKCkgPyAoVGUoT2IsIGUpLCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBPYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgISRlKCkgfHwgSmUoKSA/IGVvKGUpIDogWGUoKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW8oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgOiAoSWUoT2IsIGVwKSwgT2UoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogT2IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBxZShuZXcgRXJyb3IoZXApKSkgOiAoSWUoT2IsIGEpLCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBPYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgcWUodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEtsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGwoZS5zZWxlY3RvciksIGEgPSB2bChlKSwgbiA9IGFbT3BdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbanBdID8ga2UoKSB8fCBTZSgpID8gKGUuc2VsZWN0b3IgPSB0LCBUZShNYiwgZSksIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IE1iLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB2b2lkIG5sKGUpKSA6IChJZShNYiwgZXApLCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBNYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBlcAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHZvaWQgYWwodCkpIDogKEllKE1iLCBlLCBuKSwgT2UoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogTWIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHZvaWQgYWwodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFFsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGwoZS5zZWxlY3RvciksIGEgPSB5bChlKSwgbiA9IGFbT3BdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbanBdID8ga2UoKSB8fCBTZSgpID8gKGUuc2VsZWN0b3IgPSB0LCBUZShSYiwgZSksIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IFJiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpbChlKSkgOiAoSWUoUmIsIGVwKSwgT2UoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogUmIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhbCh0KSwgcWUobmV3IEVycm9yKGVwKSkpIDogKEllKFJiLCBlLCBuKSwgT2UoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogUmIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGFsKHQpLCBxZShhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gR2woZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBYKClbc2hdLCBhID0gZS5jb25zdW1lcklkLCBuID0gdm9pZCAwID09PSBhID8gdCA6IGEsIHIgPSBlLnJlcXVlc3QsIGkgPSBfbChlKSwgbyA9IGlbT3BdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpW2pwXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSWUoamIsIG8pLCB2b2lkIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBqYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgha2UoKSAmJiAhU2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSWUoamIsIGVwKSwgdm9pZCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogamIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBlcAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGUoamIsIGUpLCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBqYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gd3Mobiwge30sIHIubm90aWZpY2F0aW9ucyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhJGUoKSB8fCBKZSgpID8gUHMocykgOiBJZShqYiwgYmYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFdsKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdFtIcF0sIG4gPSBndSh7fSwgdCksIHIgPSBsKHQucGFyYW1zKSA/IHQucGFyYW1zIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbltZcF0gPSBndSh7fSwgcG4oYSksIHIpLCBuW29oXSA9IF9yKGUsIHRbb2hdKSwgblt4cF0gPSB1KHRbeHBdKSA/IHRbeHBdIDogV3UsIG5bT3BdID0gdSh0W09wXSkgPyB0W09wXSA6IFd1LCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICRsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtYdV0sIGEgPSBlW2NkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdSh0KSAmJiAoTXUoYSkgfHwgQXQoYSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEpsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5tYm94LCBhID0gZS50eXBlLCBuID0gdm9pZCAwID09PSBhID8gWGggOiBhLCByID0gbChlLnBhcmFtcykgPyBlLnBhcmFtcyA6IHt9LCBpID0gZ3Uoe30sIHBuKHQpLCByKSwgbyA9IERzKGNyKHt9LCBpKSwgbiwgW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8ubWJveCA9IHsgbmFtZTogdCB9LCBQcyh3cyh0LCBpLCBbb10pKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVGUoUHAsIGUpLCB2b2lkIGVbeHBdKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJZShDcCwgZSksIGVbT3BdKFJwLCBDcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWmwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRlKCkgJiYgIUplKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEllKENwLCBiZiksIHZvaWQgZVtPcF0oT3AsIGJmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEpsKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFhsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBabChlKSwgIWUucHJldmVudERlZmF1bHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZXUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW2NkXSwgYSA9IGVbWHVdLCBuID0gSShEdCh0KSksIHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBYbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBocyhhLCByLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHR1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ga2woZSksIGEgPSB0W09wXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdFtqcF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEllKHhiLCBhKSwgdm9pZCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogeGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFdsKFgoKSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWtlKCkgJiYgIVNlKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEllKHhiLCBlcCksIHEobltPcF0oTXAsIGVwKSksIHZvaWQgT2UoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IHhiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRlKHhiLCBuKSwgT2UoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogeGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksICRsKG4pID8gZXUobikgOiBabChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGMoZSksIGZjKGUpLnRoZW4oWWMpLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUKGUpIHx8IF90KHsgZXhlY3V0aW9uOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJZShhZiwgZSksIHZ0KHsgZXJyb3I6IGUgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBudSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBGYi5sZW5ndGggPiAwOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gRmIucG9wKCksIHQgPSBlLnZpZXdOYW1lLCBhID0gZS5wYWdlLCBuID0gYnModCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihuKSA/IGEgJiYgT3MoZSkgOiBhdShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBydSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFViID0gcWIsIG51KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaXUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5YyhBZiwgcnUpLCB5YyhTZiwgcnUpLCB5Yyh3ZiwgcnUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG91KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS52aWV3TmFtZSA9IGUsIGEuaW1wcmVzc2lvbklkID0gSCgpLCBhLnBhZ2UgPSAhMCwgVCh0KSB8fCAoYS5wYWdlID0gISF0LnBhZ2UpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHN1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZiLnB1c2goZSksIFViICE9PSBIYiAmJiBudSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGN1KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChYKClbRmhdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5KGUpIHx8IEMoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJZShCYiwgcmYsIGUpLCB2b2lkIE9lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogQmIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWV3OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IHJmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS50b0xvd2VyQ2FzZSgpLCBuID0gb3UoYSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFNlKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZShCYiwgYSwgbiksIHZvaWQganQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGUoQmIsIGEsIG4pLCBPZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogQmIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZXc6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgc3Uobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJZShCYiwgb2YpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGx1KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSWUoWWIsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdXUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJZShLYiwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkdSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEllKFFiLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHB1KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSWUoR2IsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaHUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5hZG9iZSA9IGUuYWRvYmUgfHwge30sIGUuYWRvYmUudGFyZ2V0ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZFUlNJT046ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50OiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRPZmZlcjogV3UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0T2ZmZXJzOiAkdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcHBseU9mZmVyOiBXdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcHBseU9mZmVyczogJHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VuZE5vdGlmaWNhdGlvbnM6IFd1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrRXZlbnQ6IFd1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyaWdnZXJWaWV3OiBXdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpc3RlckV4dGVuc2lvbjogV3UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdDogV3UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUubWJveENyZWF0ZSA9IFd1LCBlLm1ib3hEZWZpbmUgPSBXdSwgZS5tYm94VXBkYXRlID0gV3U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZnUoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuYWRvYmUgJiYgZS5hZG9iZS50YXJnZXQgJiYgdm9pZCAwICE9PSBlLmFkb2JlLnRhcmdldC5nZXRPZmZlcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJZSh0cCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBaKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gWCgpLCByID0gbltsaF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuYWRvYmUgPSBlLmFkb2JlIHx8IHt9LCBlLmFkb2JlLnRhcmdldCA9IGUuYWRvYmUudGFyZ2V0IHx8IHt9LCBlLmFkb2JlLnRhcmdldC5WRVJTSU9OID0gciwgZS5hZG9iZS50YXJnZXQuZXZlbnQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMSUJSQVJZX0xPQURFRDogUWYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRVFVRVNUX1NUQVJUOiBHZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFUVVFU1RfU1VDQ0VFREVEOiBXZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFUVVFU1RfRkFJTEVEOiAkZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENPTlRFTlRfUkVOREVSSU5HX1NUQVJUOiBKZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENPTlRFTlRfUkVOREVSSU5HX1NVQ0NFRURFRDogWmYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDT05URU5UX1JFTkRFUklOR19GQUlMRUQ6IFhmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ09OVEVOVF9SRU5ERVJJTkdfTk9fT0ZGRVJTOiBlZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENPTlRFTlRfUkVOREVSSU5HX1JFRElSRUNUOiB0ZwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhblthaF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBodShlKSwgdm9pZCBJZShlcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTGUoKSwgQnQoKSwgUXQoZSksICR0KGUpLCBlLmFkb2JlLnRhcmdldC5nZXRPZmZlciA9IHpsLCBlLmFkb2JlLnRhcmdldC5nZXRPZmZlcnMgPSBZbCwgZS5hZG9iZS50YXJnZXQuYXBwbHlPZmZlciA9IEtsLCBlLmFkb2JlLnRhcmdldC5hcHBseU9mZmVycyA9IFFsLCBlLmFkb2JlLnRhcmdldC5zZW5kTm90aWZpY2F0aW9ucyA9IEdsLCBlLmFkb2JlLnRhcmdldC50cmFja0V2ZW50ID0gdHUsIGUuYWRvYmUudGFyZ2V0LnRyaWdnZXJWaWV3ID0gY3UsIGUuYWRvYmUudGFyZ2V0LnJlZ2lzdGVyRXh0ZW5zaW9uID0gbHUsIGUubWJveENyZWF0ZSA9IHV1LCBlLm1ib3hEZWZpbmUgPSBkdSwgZS5tYm94VXBkYXRlID0gcHUsIGh0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGd1ID0gbihhKCdAYWRvYmUvcmVhY3Rvci1vYmplY3QtYXNzaWduJykpLCBtdSA9IG4oYSgnQGFkb2JlL3JlYWN0b3ItY29va2llJykpLCBidSA9IG4oYSgnQGFkb2JlL3JlYWN0b3ItcXVlcnktc3RyaW5nJykpLCBfdSA9IG4oYSgnQGFkb2JlL3JlYWN0b3ItcHJvbWlzZScpKSwgdnUgPSBuKGEoJ0BhZG9iZS9yZWFjdG9yLWxvYWQtc2NyaXB0JykpLCB5dSA9IEFycmF5LmlzQXJyYXksIGt1ID0gT2JqZWN0LnByb3RvdHlwZSwgQXUgPSBrdS50b1N0cmluZywgU3UgPSAnW29iamVjdCBGdW5jdGlvbl0nLCB3dSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZm9yRWFjaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEV1ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3dShmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0W2FdLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBoKHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIER1ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5maWx0ZXIoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBJdSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRXUoZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSAmJiAoYVtuXSA9IHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgVHUgPSAnW29iamVjdCBTdHJpbmddJywgUHUgPSA5MDA3MTk5MjU0NzQwOTkxLCBDdSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQubWFwKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgVnUgPSBPYmplY3QucHJvdG90eXBlLCBMdSA9IFZ1Lmhhc093blByb3BlcnR5LCBOdSA9IFN0cmluZy5wcm90b3R5cGUsIE91ID0gTnUudHJpbSwgTXUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhQyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFJ1ID0gJ1tvYmplY3QgTnVtYmVyXScsIGp1ID0gJ1tvYmplY3QgT2JqZWN0XScsIHh1ID0gRnVuY3Rpb24ucHJvdG90eXBlLCBCdSA9IE9iamVjdC5wcm90b3R5cGUsIEZ1ID0geHUudG9TdHJpbmcsIEh1ID0gQnUuaGFzT3duUHJvcGVydHksIHF1ID0gRnUuY2FsbChPYmplY3QpLCBVdSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRXUoZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtuXSA9IGUodCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCksIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB6dSA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEucmVkdWNlKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgWXUgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRXUoZnVuY3Rpb24gKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGUobiwgdCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBLdSA9IEFycmF5LnByb3RvdHlwZSwgUXUgPSBLdS5yZXZlcnNlLCBHdSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPTl9ERVZJQ0U6ICdvbi1kZXZpY2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNFUlZFUl9TSURFOiAnc2VydmVyLXNpZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEhZQlJJRDogJ2h5YnJpZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFd1ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgJHUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBKdSA9ICd1bmRlZmluZWQnICE9IHR5cGVvZiBnbG9iYWxUaGlzID8gZ2xvYmFsVGhpcyA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiB3aW5kb3cgPyB3aW5kb3cgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgZ2xvYmFsID8gZ2xvYmFsIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHNlbGYgPyBzZWxmIDoge30sIFp1ID0gKHooZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgYSwgbiwgciwgaSwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHBlcmZvcm1hbmNlICYmIG51bGwgIT09IHBlcmZvcm1hbmNlICYmIHBlcmZvcm1hbmNlLm5vdyA/IGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwZXJmb3JtYW5jZS5ub3coKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBwcm9jZXNzICYmIG51bGwgIT09IHByb2Nlc3MgJiYgcHJvY2Vzcy5ocnRpbWUgPyAoZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICh0KCkgLSBpKSAvIDEwMDAwMDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEgPSBwcm9jZXNzLmhydGltZSwgciA9ICh0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTAwMDAwMDAwMCAqIChlID0gYSgpKVswXSArIGVbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKCksIG8gPSAxMDAwMDAwMDAwICogcHJvY2Vzcy51cHRpbWUoKSwgaSA9IHIgLSBvKSA6IERhdGUubm93ID8gKGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEYXRlLm5vdygpIC0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA9IERhdGUubm93KCkpIDogKGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgRGF0ZSgpLmdldFRpbWUoKSAtIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4gPSBuZXcgRGF0ZSgpLmdldFRpbWUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5jYWxsKEp1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgWSksIFh1ID0gJ3R5cGUnLCBlZCA9ICdjb250ZW50JywgdGQgPSAnaGVpZ2h0JywgYWQgPSAnd2lkdGgnLCBuZCA9ICdsZWZ0JywgcmQgPSAndG9wJywgaWQgPSAnZnJvbScsIG9kID0gJ3RvJywgc2QgPSAncHJpb3JpdHknLCBjZCA9ICdzZWxlY3RvcicsIGxkID0gJ2Nzc1NlbGVjdG9yJywgdWQgPSAnc2V0SHRtbCcsIGRkID0gJ3NldENvbnRlbnQnLCBwZCA9ICdzZXRUZXh0JywgaGQgPSAnc2V0SnNvbicsIGZkID0gJ3NldEF0dHJpYnV0ZScsIGdkID0gJ3NldEltYWdlU291cmNlJywgbWQgPSAnc2V0U3R5bGUnLCBiZCA9ICdyZWFycmFuZ2UnLCBfZCA9ICdyZXNpemUnLCB2ZCA9ICdtb3ZlJywgeWQgPSAncmVtb3ZlJywga2QgPSAnY3VzdG9tQ29kZScsIEFkID0gJ3JlZGlyZWN0JywgU2QgPSAndHJhY2tDbGljaycsIHdkID0gJ3NpZ25hbENsaWNrJywgRWQgPSAnaW5zZXJ0QmVmb3JlJywgRGQgPSAnaW5zZXJ0QWZ0ZXInLCBJZCA9ICdhcHBlbmRIdG1sJywgVGQgPSAnYXBwZW5kQ29udGVudCcsIFBkID0gJ3ByZXBlbmRIdG1sJywgQ2QgPSAncHJlcGVuZENvbnRlbnQnLCBWZCA9ICdyZXBsYWNlSHRtbCcsIExkID0gJ3JlcGxhY2VDb250ZW50JywgTmQgPSAnbWJveERlYnVnJywgT2QgPSAnbWJveERpc2FibGUnLCBNZCA9ICdtYm94RWRpdCcsIFJkID0gJ2F0X2NoZWNrJywgamQgPSAndHJ1ZScsIHhkID0gMjUwLCBCZCA9ICdkYXRhLWF0LXNyYycsIEZkID0gJ2pzb24nLCBIZCA9ICdodG1sJywgcWQgPSAnZHluYW1pYycsIFVkID0gJ3NjcmlwdCcsIHpkID0gJ3NyYycsIFlkID0gJ2lkJywgS2QgPSAnY2xhc3MnLCBRZCA9ICdjbGljaycsIEdkID0gJ2hlYWQnLCBXZCA9ICdzY3JpcHQnLCAkZCA9ICdzdHlsZScsIEpkID0gJ2xpbmsnLCBaZCA9ICdpbWcnLCBYZCA9ICdkaXYnLCBlcCA9ICdBZG9iZSBUYXJnZXQgY29udGVudCBkZWxpdmVyeSBpcyBkaXNhYmxlZC4gRW5zdXJlIHRoYXQgeW91IGNhbiBzYXZlIGNvb2tpZXMgdG8geW91ciBjdXJyZW50IGRvbWFpbiwgdGhlcmUgaXMgbm8gIm1ib3hEaXNhYmxlIiBjb29raWUgYW5kIHRoZXJlIGlzIG5vICJtYm94RGlzYWJsZSIgcGFyYW1ldGVyIGluIHF1ZXJ5IHN0cmluZy4nLCB0cCA9ICdBZG9iZSBUYXJnZXQgaGFzIGFscmVhZHkgYmVlbiBpbml0aWFsaXplZC4nLCBhcCA9ICdvcHRpb25zIGFyZ3VtZW50IGlzIHJlcXVpcmVkJywgbnAgPSAncmVxdWVzdCBvcHRpb24gaXMgcmVxdWlyZWQnLCBycCA9ICdyZXNwb25zZSBvcHRpb24gaXMgcmVxdWlyZWQnLCBpcCA9ICdleGVjdXRlIG9yIHByZWZldGNoIGlzIHJlcXVpcmVkJywgb3AgPSAnZXhlY3V0ZSBvciBwcmVmZXRjaCBpcyBub3QgYWxsb3dlZCcsIHNwID0gJ25vdGlmaWNhdGlvbnMgYXJlIHJlcXVpcmVkJywgY3AgPSAnbWJveCBvcHRpb24gaXMgcmVxdWlyZWQnLCBscCA9ICdtYm94IG9wdGlvbiBpcyB0b28gbG9uZycsIHVwID0gJ3N1Y2Nlc3Mgb3B0aW9uIGlzIHJlcXVpcmVkJywgZHAgPSAnZXJyb3Igb3B0aW9uIGlzIHJlcXVpcmVkJywgcHAgPSAnb2ZmZXIgb3B0aW9uIGlzIHJlcXVpcmVkJywgaHAgPSAnVW5leHBlY3RlZCBlcnJvcicsIGZwID0gJ3JlcXVlc3QgZmFpbGVkJywgZ3AgPSAncmVxdWVzdCBzdWNjZWVkZWQnLCBtcCA9ICdBY3Rpb24gcmVuZGVyZWQgc3VjY2Vzc2Z1bGx5JywgYnAgPSAnUmVuZGVyaW5nIGFjdGlvbicsIF9wID0gJ0FjdGlvbiBoYXMgbm8gY29udGVudCcsIHZwID0gJ0FjdGlvbiBoYXMgbm8gYXR0cmlidXRlcycsIHlwID0gJ0FjdGlvbiBoYXMgbm8gQ1NTIHByb3BlcnRpZXMnLCBrcCA9ICdBY3Rpb24gaGFzIG5vIGhlaWdodCBvciB3aWR0aCcsIEFwID0gJ0FjdGlvbiBoYXMgbm8gbGVmdCwgdG9wIG9yIHBvc2l0aW9uJywgU3AgPSAnQWN0aW9uIGhhcyBubyBmcm9tIG9yIHRvJywgd3AgPSAnQWN0aW9uIGhhcyBubyB1cmwnLCBFcCA9ICdBY3Rpb24gaGFzIG5vIGltYWdlIHVybCcsIERwID0gJ1JlYXJyYW5nZSBlbGVtZW50cyBhcmUgbWlzc2luZycsIElwID0gJ1JlYXJyYW5nZSBoYXMgaW5jb3JyZWN0ICJmcm9tIiBhbmQgInRvIiBpbmRleGVzJywgVHAgPSAnTG9hZGluZyBpbWFnZScsIFBwID0gJ1RyYWNrIGV2ZW50IHJlcXVlc3Qgc3VjY2VlZGVkJywgQ3AgPSAnVHJhY2sgZXZlbnQgcmVxdWVzdCBmYWlsZWQnLCBWcCA9ICdObyBhY3Rpb25zIHRvIGJlIHJlbmRlcmVkJywgTHAgPSAnUmVkaXJlY3QgYWN0aW9uJywgTnAgPSAnU2NyaXB0IGxvYWQnLCBPcCA9ICdlcnJvcicsIE1wID0gJ3dhcm5pbmcnLCBScCA9ICd1bmtub3duJywganAgPSAndmFsaWQnLCB4cCA9ICdzdWNjZXNzJywgQnAgPSAncmVuZGVyJywgRnAgPSAnbWV0cmljJywgSHAgPSAnbWJveCcsIHFwID0gJ29mZmVyJywgVXAgPSAnbmFtZScsIHpwID0gJ3N0YXR1cycsIFlwID0gJ3BhcmFtcycsIEtwID0gJ2FjdGlvbnMnLCBRcCA9ICdyZXNwb25zZVRva2VucycsIEdwID0gJ2RhdGEnLCBXcCA9ICdyZXNwb25zZScsICRwID0gJ3JlcXVlc3QnLCBKcCA9ICdwcm92aWRlcicsIFpwID0gJ3BhZ2VMb2FkJywgWHAgPSAnYXQtZmxpY2tlci1jb250cm9sJywgZWggPSAnYXQtZWxlbWVudC1tYXJrZXInLCB0aCA9ICdhdC1lbGVtZW50LWNsaWNrLXRyYWNraW5nJywgYWggPSAnZW5hYmxlZCcsIG5oID0gJ2NsaWVudENvZGUnLCByaCA9ICdpbXNPcmdJZCcsIGloID0gJ3NlcnZlckRvbWFpbicsIG9oID0gJ3RpbWVvdXQnLCBzaCA9ICdnbG9iYWxNYm94TmFtZScsIGNoID0gJ2dsb2JhbE1ib3hBdXRvQ3JlYXRlJywgbGggPSAndmVyc2lvbicsIHVoID0gJ2RlZmF1bHRDb250ZW50SGlkZGVuU3R5bGUnLCBkaCA9ICdib2R5SGlkZGVuU3R5bGUnLCBwaCA9ICdib2R5SGlkaW5nRW5hYmxlZCcsIGhoID0gJ2RldmljZUlkTGlmZXRpbWUnLCBmaCA9ICdzZXNzaW9uSWRMaWZldGltZScsIGdoID0gJ3NlbGVjdG9yc1BvbGxpbmdUaW1lb3V0JywgbWggPSAndmlzaXRvckFwaVRpbWVvdXQnLCBiaCA9ICdvdmVycmlkZU1ib3hFZGdlU2VydmVyJywgX2ggPSAnb3ZlcnJpZGVNYm94RWRnZVNlcnZlclRpbWVvdXQnLCB2aCA9ICdvcHRvdXRFbmFibGVkJywgeWggPSAnc2VjdXJlT25seScsIGtoID0gJ3N1cHBsZW1lbnRhbERhdGFJZFBhcmFtVGltZW91dCcsIEFoID0gJ2F1dGhvcmluZ1NjcmlwdFVybCcsIFNoID0gJ3NjaGVtZScsIHdoID0gJ2Nvb2tpZURvbWFpbicsIEVoID0gJ21ib3hQYXJhbXMnLCBEaCA9ICdnbG9iYWxNYm94UGFyYW1zJywgSWggPSAnbWJveFNlc3Npb24nLCBUaCA9ICdQQycsIFBoID0gJ21ib3hFZGdlQ2x1c3RlcicsIENoID0gJ3Nlc3Npb24nLCBWaCA9ICdUcmFjZXMnLCBMaCA9ICdzZXR0aW5ncycsIE5oID0gJ2NsaWVudCcgKyBWaCwgT2ggPSAnc2VydmVyJyArIFZoLCBNaCA9ICdfX190YXJnZXRfdHJhY2VzJywgUmggPSAndGFyZ2V0R2xvYmFsU2V0dGluZ3MnLCBqaCA9ICdkYXRhUHJvdmlkZXInLCB4aCA9IGpoICsgJ3MnLCBCaCA9ICdlbmRwb2ludCcsIEZoID0gJ3ZpZXdzRW5hYmxlZCcsIEhoID0gJ3BhZ2VMb2FkRW5hYmxlZCcsIHFoID0gJ2F1dGhTdGF0ZScsIFVoID0gJ2F1dGhlbnRpY2F0ZWRTdGF0ZScsIHpoID0gJ2ludGVncmF0aW9uQ29kZScsIFloID0gJ3ByaW1hcnknLCBLaCA9ICdwYWdlJywgUWggPSAndmlldycsIEdoID0gJ3ZpZXdzJywgV2ggPSAnb3B0aW9ucycsICRoID0gJ21ldHJpY3MnLCBKaCA9ICdldmVudFRva2VuJywgWmggPSAndmlld05hbWUnLCBYaCA9ICdkaXNwbGF5JywgZWYgPSAnQ29udGVudC1UeXBlJywgdGYgPSAndGV4dC9wbGFpbicsIGFmID0gJ1ZpZXcgcmVuZGVyaW5nIGZhaWxlZCcsIG5mID0gJ1ZpZXcgZGVsaXZlcnkgZXJyb3InLCByZiA9ICdWaWV3IG5hbWUgc2hvdWxkIGJlIGEgbm9uLWVtcHR5IHN0cmluZycsIG9mID0gJ1ZpZXdzIGFyZSBub3QgZW5hYmxlZCcsIHNmID0gJ1BhZ2UgbG9hZCBkaXNhYmxlZCcsIGNmID0gJ1VzaW5nIHNlcnZlciBzdGF0ZScsIGxmID0gJ2Fkb2JlJywgdWYgPSAnb3B0SW4nLCBkZiA9ICdpc0FwcHJvdmVkJywgcGYgPSAnZmV0Y2hQZXJtaXNzaW9ucycsIGhmID0gJ0NhdGVnb3JpZXMnLCBmZiA9ICdUQVJHRVQnLCBnZiA9ICdBTkFMWVRJQ1MnLCBtZiA9ICdvcHRpbkVuYWJsZWQnLCBiZiA9ICdBZG9iZSBUYXJnZXQgaXMgbm90IG9wdGVkIGluJywgX2YgPSAnYW5hbHl0aWNzTG9nZ2luZycsIHZmID0gJ3NlcnZlclN0YXRlJywgeWYgPSAnY3NwU2NyaXB0Tm9uY2UnLCBrZiA9ICdjc3BTdHlsZU5vbmNlJywgQWYgPSAnY2FjaGUtdXBkYXRlZC1ldmVudCcsIFNmID0gJ25vLW9mZmVycy1ldmVudCcsIHdmID0gJ3JlZGlyZWN0LW9mZmVyLWV2ZW50JywgRWYgPSAnTm9uZScsIERmID0gJ3dlYicsIElmID0gJ2ZpbGU6JywgVGYgPSAvXig/ITApKD8hLipcLiQpKCgxP1xkP1xkfDI1WzAtNV18MlswLTRdXGQpKFwufCQpKXs0fSQvLCBQZiA9IC9eKGNvbXxlZHV8Z292fG5ldHxtaWx8b3JnfG5vbXxjb3xuYW1lfGluZm98Yml6KSQvaSwgQ2YgPSB7fSwgVmYgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2gsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2gsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RlZmF1bHRDb250ZW50VmlzaWJsZVN0eWxlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBraCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXJsU2l6ZUxpbWl0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGVjaXNpb25pbmdNZXRob2QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwb2xsaW5nSW50ZXJ2YWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcnRpZmFjdExvY2F0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYXJ0aWZhY3RGb3JtYXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcnRpZmFjdFBheWxvYWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbnZpcm9ubWVudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NkbkVudmlyb25tZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGVsZW1ldHJ5RW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NkbkJhc2VQYXRoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5ZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgTGYgPSBidS5wYXJzZSwgTmYgPSBidS5zdHJpbmdpZnksIE9mID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnYScpLCBNZiA9IHt9LCBSZiA9IG11LmdldCwgamYgPSBtdS5zZXQsIHhmID0gbXUucmVtb3ZlLCBCZiA9ICdtYm94JywgRmYgPSAnQVQ6JywgSGYgPSAnMScsIHFmID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBlID8gU3RyaW5nKGUpIDogSltaLmNhbGwoZSldIHx8ICdvYmplY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgPT0gdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGUgJiYgZSA9PSBlLndpbmRvdzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGUgJiYgZS5ub2RlVHlwZSA9PSBlLkRPQ1VNRU5UX05PREU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT0gdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGUpICYmICFuKGUpICYmIE9iamVjdC5nZXRQcm90b3R5cGVPZihlKSA9PSBPYmplY3QucHJvdG90eXBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAhIWUgJiYgJ2xlbmd0aCcgaW4gZSAmJiBlLmxlbmd0aCwgYSA9IEkudHlwZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nICE9IGEgJiYgIW4oZSkgJiYgKCdhcnJheScgPT0gYSB8fCAwID09PSB0IHx8ICdudW1iZXInID09IHR5cGVvZiB0ICYmIHQgPiAwICYmIHQgLSAxIGluIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE4uY2FsbChlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmxlbmd0aCA+IDAgPyBJLmZuLmNvbmNhdC5hcHBseShbXSwgZSkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVwbGFjZSgvOjovZywgJy8nKS5yZXBsYWNlKC8oW0EtWl0rKShbQS1aXVthLXpdKS9nLCAnJDFfJDInKS5yZXBsYWNlKC8oW2EtelxkXSkoW0EtWl0pL2csICckMV8kMicpLnJlcGxhY2UoL18vZywgJy0nKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgaW4gaiA/IGpbZV0gOiBqW2VdID0gbmV3IFJlZ0V4cCgnKF58XFxzKScgKyBlICsgJyhcXHN8JCknKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnbnVtYmVyJyAhPSB0eXBlb2YgdCB8fCB4W2QoZSldID8gdCA6IHQgKyAncHgnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUltlXSB8fCAodCA9IE0uY3JlYXRlRWxlbWVudChlKSwgTS5ib2R5LmFwcGVuZENoaWxkKHQpLCBhID0gZ2V0Q29tcHV0ZWRTdHlsZSh0LCAnJykuZ2V0UHJvcGVydHlWYWx1ZSgnZGlzcGxheScpLCB0LnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQodCksICdub25lJyA9PSBhICYmIChhID0gJ2Jsb2NrJyksIFJbZV0gPSBhKSwgUltlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnY2hpbGRyZW4nIGluIGUgPyBPLmNhbGwoZS5jaGlsZHJlbikgOiBJLm1hcChlLmNoaWxkTm9kZXMsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gZS5ub2RlVHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBtKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCBuID0gZSA/IGUubGVuZ3RoIDogMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IDA7IGEgPCBuOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1thXSA9IGVbYV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxlbmd0aCA9IG4sIHRoaXMuc2VsZWN0b3IgPSB0IHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChEIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiAobyh0W0RdKSB8fCBuZSh0W0RdKSkgPyAobyh0W0RdKSAmJiAhbyhlW0RdKSAmJiAoZVtEXSA9IHt9KSwgbmUodFtEXSkgJiYgIW5lKGVbRF0pICYmIChlW0RdID0gW10pLCBiKGVbRF0sIHRbRF0sIGEpKSA6IHRbRF0gIT09IEUgJiYgKGVbRF0gPSB0W0RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBfKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IHQgPyBJKGUpIDogSShlKS5maWx0ZXIodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdihlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSh0KSA/IHQuY2FsbChlLCBuLCByKSA6IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geShlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsID09IGEgPyBlLnJlbW92ZUF0dHJpYnV0ZSh0KSA6IGUuc2V0QXR0cmlidXRlKHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGsoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlLmNsYXNzTmFtZSB8fCAnJywgbiA9IGEgJiYgYS5iYXNlVmFsICE9PSBFOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPT09IEUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPyBhLmJhc2VWYWwgOiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA/IGEuYmFzZVZhbCA9IHQgOiBlLmNsYXNzTmFtZSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gJ3RydWUnID09IGUgfHwgJ2ZhbHNlJyAhPSBlICYmICgnbnVsbCcgPT0gZSA/IG51bGwgOiArZSArICcnID09IGUgPyArZSA6IC9eW1xbXHtdLy50ZXN0KGUpID8gSS5wYXJzZUpTT04oZSkgOiBlKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IDAsIG4gPSBlLmNoaWxkTm9kZXMubGVuZ3RoOyBhIDwgbjsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFMoZS5jaGlsZE5vZGVzW2FdLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB3KGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5nZXRFbGVtZW50c0J5VGFnTmFtZSgnc2NyaXB0JylbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbi5wYXJlbnROb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZS5jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5pbm5lckhUTUwgPSB0LCBNdShhKSAmJiBpLnNldEF0dHJpYnV0ZSgnbm9uY2UnLCBhKSwgci5hcHBlbmRDaGlsZChpKSwgci5yZW1vdmVDaGlsZChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEUsIEQsIEksIFQsIFAsIEMsIFYgPSBbXSwgTCA9IFYuY29uY2F0LCBOID0gVi5maWx0ZXIsIE8gPSBWLnNsaWNlLCBNID0gZS5kb2N1bWVudCwgUiA9IHt9LCBqID0ge30sIHggPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbHVtbi1jb3VudCc6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sdW1uczogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZm9udC13ZWlnaHQnOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsaW5lLWhlaWdodCc6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3BhY2l0eTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnei1pbmRleCc6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgem9vbTogMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgQiA9IC9eXHMqPChcdyt8ISlbXj5dKj4vLCBGID0gL148KFx3KylccypcLz8+KD86PFwvXDE+fCkkLywgSCA9IC88KD8hYXJlYXxicnxjb2x8ZW1iZWR8aHJ8aW1nfGlucHV0fGxpbmt8bWV0YXxwYXJhbSkoKFtcdzpdKylbXj5dKilcLz4vZ2ksIHEgPSAvXig/OmJvZHl8aHRtbCkkL2ksIFUgPSAvKFtBLVpdKS9nLCB6ID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2YWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjc3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdodG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGV4dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3aWR0aCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2hlaWdodCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29mZnNldCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIFkgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FmdGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJlcGVuZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JlZm9yZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FwcGVuZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIEsgPSBNLmNyZWF0ZUVsZW1lbnQoJ3RhYmxlJyksIFEgPSBNLmNyZWF0ZUVsZW1lbnQoJ3RyJyksIEcgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHI6IE0uY3JlYXRlRWxlbWVudCgndGJvZHknKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ym9keTogSywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGVhZDogSywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Zm9vdDogSywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZDogUSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aDogUSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnKic6IE0uY3JlYXRlRWxlbWVudCgnZGl2JykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFcgPSAvY29tcGxldGV8bG9hZGVkfGludGVyYWN0aXZlLywgJCA9IC9eW1x3LV0qJC8sIEogPSB7fSwgWiA9IEoudG9TdHJpbmcsIGVlID0ge30sIHRlID0gTS5jcmVhdGVFbGVtZW50KCdkaXYnKSwgYWUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFiaW5kZXg6ICd0YWJJbmRleCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZG9ubHk6ICdyZWFkT25seScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yOiAnaHRtbEZvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3M6ICdjbGFzc05hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heGxlbmd0aDogJ21heExlbmd0aCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2VsbHNwYWNpbmc6ICdjZWxsU3BhY2luZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2VsbHBhZGRpbmc6ICdjZWxsUGFkZGluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcm93c3BhbjogJ3Jvd1NwYW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHNwYW46ICdjb2xTcGFuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VtYXA6ICd1c2VNYXAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyYW1lYm9yZGVyOiAnZnJhbWVCb3JkZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnRlZGl0YWJsZTogJ2NvbnRlbnRFZGl0YWJsZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG5lID0gQXJyYXkuaXNBcnJheSB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIGluc3RhbmNlb2YgQXJyYXk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWUubWF0Y2hlcyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXQgfHwgIWUgfHwgMSAhPT0gZS5ub2RlVHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUubWF0Y2hlcyB8fCBlLndlYmtpdE1hdGNoZXNTZWxlY3RvciB8fCBlLm1vek1hdGNoZXNTZWxlY3RvciB8fCBlLm9NYXRjaGVzU2VsZWN0b3IgfHwgZS5tYXRjaGVzU2VsZWN0b3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5jYWxsKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIgPSBlLnBhcmVudE5vZGUsIGkgPSAhcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpICYmIChyID0gdGUpLmFwcGVuZENoaWxkKGUpLCBuID0gfmVlLnFzYShyLCB0KS5pbmRleE9mKGUpLCBpICYmIHRlLnJlbW92ZUNoaWxkKGUpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBQID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlcGxhY2UoLy0rKC4pPy9nLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID8gdC50b1VwcGVyQ2FzZSgpIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgQyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTi5jYWxsKGUsIGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuaW5kZXhPZih0KSA9PSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVlLmZyYWdtZW50ID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEYudGVzdChlKSAmJiAobiA9IEkoTS5jcmVhdGVFbGVtZW50KFJlZ0V4cC4kMSkpKSwgbiB8fCAoZS5yZXBsYWNlICYmIChlID0gZS5yZXBsYWNlKEgsICc8JDE+PC8kMj4nKSksIHQgPT09IEUgJiYgKHQgPSBCLnRlc3QoZSkgJiYgUmVnRXhwLiQxKSwgdCBpbiBHIHx8ICh0ID0gJyonKSwgKGkgPSBHW3RdKS5pbm5lckhUTUwgPSAnJyArIGUsIG4gPSBJLmVhY2goTy5jYWxsKGkuY2hpbGROb2RlcyksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnJlbW92ZUNoaWxkKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBvKGEpICYmIChyID0gSShuKSwgSS5lYWNoKGEsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgei5pbmRleE9mKGUpID4gLTEgPyByW2VdKHQpIDogci5hdHRyKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlZS5aID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgbShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZWUuaXNaID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIGluc3RhbmNlb2YgZWUuWjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZWUuaW5pdCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWUuWigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnPCcgPT0gKGUgPSBlLnRyaW0oKSlbMF0gJiYgQi50ZXN0KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gZWUuZnJhZ21lbnQoZSwgUmVnRXhwLiQxLCB0KSwgZSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICE9PSBFKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEkodCkuZmluZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGVlLnFzYShNLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEkoTSkucmVhZHkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVlLmlzWihlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5lKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChpKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gW2VdLCBlID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChCLnRlc3QoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBlZS5mcmFnbWVudChlLnRyaW0oKSwgUmVnRXhwLiQxLCB0KSwgZSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICE9PSBFKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEkodCkuZmluZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGVlLnFzYShNLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWUuWihuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgKEkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVlLmluaXQoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmV4dGVuZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgYSA9IE8uY2FsbChhcmd1bWVudHMsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdib29sZWFuJyA9PSB0eXBlb2YgZSAmJiAodCA9IGUsIGUgPSBhLnNoaWZ0KCkpLCBhLmZvckVhY2goZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKGUsIGEsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVlLnFzYSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgbiA9ICcjJyA9PSB0WzBdLCByID0gIW4gJiYgJy4nID09IHRbMF0sIGkgPSBuIHx8IHIgPyB0LnNsaWNlKDEpIDogdCwgbyA9ICQudGVzdChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmdldEVsZW1lbnRCeUlkICYmIG8gJiYgbiA/IChhID0gZS5nZXRFbGVtZW50QnlJZChpKSkgPyBbYV0gOiBbXSA6IDEgIT09IGUubm9kZVR5cGUgJiYgOSAhPT0gZS5ub2RlVHlwZSAmJiAxMSAhPT0gZS5ub2RlVHlwZSA/IFtdIDogTy5jYWxsKG8gJiYgIW4gJiYgZS5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lID8gciA/IGUuZ2V0RWxlbWVudHNCeUNsYXNzTmFtZShpKSA6IGUuZ2V0RWxlbWVudHNCeVRhZ05hbWUodCkgOiBlLnF1ZXJ5U2VsZWN0b3JBbGwodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBJLmNvbnRhaW5zID0gTS5kb2N1bWVudEVsZW1lbnQuY29udGFpbnMgPyBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgIT09IHQgJiYgZS5jb250YWlucyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgdCAmJiAodCA9IHQucGFyZW50Tm9kZSk7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEkudHlwZSA9IHQsIEkuaXNGdW5jdGlvbiA9IGEsIEkuaXNXaW5kb3cgPSBuLCBJLmlzQXJyYXkgPSBuZSwgSS5pc1BsYWluT2JqZWN0ID0gbywgSS5pc0VtcHR5T2JqZWN0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0IGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBJLmlzTnVtZXJpYyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE51bWJlcihlKSwgYSA9IHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBlICYmICdib29sZWFuJyAhPSBhICYmICgnc3RyaW5nJyAhPSBhIHx8IGUubGVuZ3RoKSAmJiAhaXNOYU4odCkgJiYgaXNGaW5pdGUodCkgfHwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEkuaW5BcnJheSA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVi5pbmRleE9mLmNhbGwodCwgZSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEkuY2FtZWxDYXNlID0gUCwgSS50cmltID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGUgPyAnJyA6IFN0cmluZy5wcm90b3R5cGUudHJpbS5jYWxsKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBJLnV1aWQgPSAwLCBJLnN1cHBvcnQgPSB7fSwgSS5leHByID0ge30sIEkubm9vcCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSS5tYXAgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEsIG4sIHIsIGkgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPCBlLmxlbmd0aDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IChhID0gdChlW25dLCBuKSkgJiYgaS5wdXNoKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IChhID0gdChlW3JdLCByKSkgJiYgaS5wdXNoKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEkuZWFjaCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChhID0gMDsgYSA8IGUubGVuZ3RoOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghMSA9PT0gdC5jYWxsKGVbYV0sIGEsIGVbYV0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCExID09PSB0LmNhbGwoZVtuXSwgbiwgZVtuXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBJLmdyZXAgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE4uY2FsbChlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5KU09OICYmIChJLnBhcnNlSlNPTiA9IEpTT04ucGFyc2UpLCBJLmVhY2goJ0Jvb2xlYW4gTnVtYmVyIFN0cmluZyBGdW5jdGlvbiBBcnJheSBEYXRlIFJlZ0V4cCBPYmplY3QgRXJyb3InLnNwbGl0KCcgJyksIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKWydbb2JqZWN0ICcgKyB0ICsgJ10nXSA9IHQudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIEkuZm4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdHJ1Y3RvcjogZWUuWiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbmd0aDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvckVhY2g6IFYuZm9yRWFjaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZHVjZTogVi5yZWR1Y2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXNoOiBWLnB1c2gsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3J0OiBWLnNvcnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGxpY2U6IFYuc3BsaWNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXhPZjogVi5pbmRleE9mLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uY2F0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQsIGEgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSAwOyBlIDwgYXJndW1lbnRzLmxlbmd0aDsgZSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gYXJndW1lbnRzW2VdLCBhW2VdID0gZWUuaXNaKHQpID8gdC50b0FycmF5KCkgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBMLmFwcGx5KGVlLmlzWih0aGlzKSA/IHRoaXMudG9BcnJheSgpIDogdGhpcywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJKEkubWFwKHRoaXMsIGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNhbGwodCwgYSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNsaWNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEkoTy5hcHBseSh0aGlzLCBhcmd1bWVudHMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkeTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVy50ZXN0KE0ucmVhZHlTdGF0ZSkgJiYgTS5ib2R5ID8gZShJKSA6IE0uYWRkRXZlbnRMaXN0ZW5lcignRE9NQ29udGVudExvYWRlZCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZShJKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMSksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBFID8gTy5jYWxsKHRoaXMpIDogdGhpc1tlID49IDAgPyBlIDogZSArIHRoaXMubGVuZ3RoXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b0FycmF5OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSB0aGlzLnBhcmVudE5vZGUgJiYgdGhpcy5wYXJlbnROb2RlLnJlbW92ZUNoaWxkKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVhY2g6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCwgYSA9IHRoaXMubGVuZ3RoLCBuID0gMDsgbiA8IGEgJiYgKHQgPSB0aGlzW25dLCAhMSAhPT0gZS5jYWxsKHQsIG4sIHQpKTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4rKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWx0ZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoZSkgPyB0aGlzLm5vdCh0aGlzLm5vdChlKSkgOiBJKE4uY2FsbCh0aGlzLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWUubWF0Y2hlcyh0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJKEModGhpcy5jb25jYXQoSShlLCB0KSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5sZW5ndGggPiAwICYmIGVlLm1hdGNoZXModGhpc1swXSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm90OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEoZSkgJiYgZS5jYWxsICE9PSBFKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmVhY2goZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbCh0aGlzLCBhKSB8fCB0LnB1c2godGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICdzdHJpbmcnID09IHR5cGVvZiBlID8gdGhpcy5maWx0ZXIoZSkgOiBjKGUpICYmIGEoZS5pdGVtKSA/IE8uY2FsbChlKSA6IEkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5pbmRleE9mKGUpIDwgMCAmJiB0LnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoZSkgPyBJLmNvbnRhaW5zKHRoaXMsIGUpIDogSSh0aGlzKS5maW5kKGUpLnNpemUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgPT09IGUgPyB0aGlzLnNsaWNlKGUpIDogdGhpcy5zbGljZShlLCArZSArIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpcnN0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICFpKGUpID8gZSA6IEkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpc1t0aGlzLmxlbmd0aCAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICFpKGUpID8gZSA6IEkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSBlID8gJ29iamVjdCcgPT0gcyhlKSA/IEkoZSkuZmlsdGVyKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVi5zb21lLmNhbGwoYSwgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJLmNvbnRhaW5zKHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IDEgPT0gdGhpcy5sZW5ndGggPyBJKGVlLnFzYSh0aGlzWzBdLCBlKSkgOiB0aGlzLm1hcChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlZS5xc2EodGhpcywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBJKCksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xvc2VzdDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFtdLCBuID0gJ29iamVjdCcgPT0gcyhlKSAmJiBJKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKGksIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IG8gJiYgIShuID8gbi5pbmRleE9mKG8pID49IDAgOiBlZS5tYXRjaGVzKG8sIGUpKTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gbyAhPT0gdCAmJiAhcihvKSAmJiBvLnBhcmVudE5vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gJiYgYS5pbmRleE9mKG8pIDwgMCAmJiBhLnB1c2gobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIEkoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyZW50czogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gW10sIGEgPSB0aGlzOyBhLmxlbmd0aCA+IDA7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gSS5tYXAoYSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoZSA9IGUucGFyZW50Tm9kZSkgJiYgIXIoZSkgJiYgdC5pbmRleE9mKGUpIDwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5wdXNoKGUpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXyh0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJlbnQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8oQyh0aGlzLnBsdWNrKCdwYXJlbnROb2RlJykpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXyh0aGlzLm1hcChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50czogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm1hcChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbnRlbnREb2N1bWVudCB8fCBPLmNhbGwodGhpcy5jaGlsZE5vZGVzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaWJsaW5nczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXyh0aGlzLm1hcChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTi5jYWxsKGcodC5wYXJlbnROb2RlKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICE9PSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW1wdHk6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pbm5lckhUTUwgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbHVjazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSS5tYXAodGhpcywgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvdzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbm9uZScgPT0gdGhpcy5zdHlsZS5kaXNwbGF5ICYmICh0aGlzLnN0eWxlLmRpc3BsYXkgPSAnJyksICdub25lJyA9PSBnZXRDb21wdXRlZFN0eWxlKHRoaXMsICcnKS5nZXRQcm9wZXJ0eVZhbHVlKCdkaXNwbGF5JykgJiYgKHRoaXMuc3R5bGUuZGlzcGxheSA9IGYodGhpcy5ub2RlTmFtZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcGxhY2VXaXRoOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmJlZm9yZShlKS5yZW1vdmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cmFwOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpc1swXSAmJiAhdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBJKGUpLmdldCgwKSwgciA9IG4ucGFyZW50Tm9kZSB8fCB0aGlzLmxlbmd0aCA+IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZWFjaChmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKHRoaXMpLndyYXBBbGwodCA/IGUuY2FsbCh0aGlzLCBhKSA6IHIgPyBuLmNsb25lTm9kZSghMCkgOiBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cmFwQWxsOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzWzBdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKEkodGhpc1swXSkuYmVmb3JlKGUgPSBJKGUpKTsgKHQgPSBlLmNoaWxkcmVuKCkpLmxlbmd0aDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gdC5maXJzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKGUpLmFwcGVuZCh0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JhcElubmVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gSSh0aGlzKSwgciA9IG4uY29udGVudHMoKSwgaSA9IHQgPyBlLmNhbGwodGhpcywgYSkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmxlbmd0aCA/IHIud3JhcEFsbChpKSA6IG4uYXBwZW5kKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVud3JhcDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnBhcmVudCgpLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKHRoaXMpLnJlcGxhY2VXaXRoKEkodGhpcykuY2hpbGRyZW4oKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xvbmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5tYXAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jbG9uZU5vZGUoITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhpZGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jc3MoJ2Rpc3BsYXknLCAnbm9uZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvZ2dsZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBJKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZSA9PT0gRSA/ICdub25lJyA9PSB0LmNzcygnZGlzcGxheScpIDogZSkgPyB0LnNob3coKSA6IHQuaGlkZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZXY6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEkodGhpcy5wbHVjaygncHJldmlvdXNFbGVtZW50U2libGluZycpKS5maWx0ZXIoZSB8fCAnKicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEkodGhpcy5wbHVjaygnbmV4dEVsZW1lbnRTaWJsaW5nJykpLmZpbHRlcihlIHx8ICcqJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCBpbiBhcmd1bWVudHMgPyB0aGlzLmVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLmlubmVySFRNTDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSSh0aGlzKS5lbXB0eSgpLmFwcGVuZCh2KHRoaXMsIGUsIHQsIGEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IDAgaW4gdGhpcyA/IHRoaXNbMF0uaW5uZXJIVE1MIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXh0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwIGluIGFyZ3VtZW50cyA/IHRoaXMuZWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHYodGhpcywgZSwgdCwgdGhpcy50ZXh0Q29udGVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudGV4dENvbnRlbnQgPSBudWxsID09IGEgPyAnJyA6ICcnICsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IDAgaW4gdGhpcyA/IHRoaXMucGx1Y2soJ3RleHRDb250ZW50Jykuam9pbignJykgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0dHI6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnICE9IHR5cGVvZiBlIHx8IDEgaW4gYXJndW1lbnRzID8gdGhpcy5lYWNoKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxID09PSB0aGlzLm5vZGVUeXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChEIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkodGhpcywgRCwgZVtEXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeSh0aGlzLCBlLCB2KHRoaXMsIHQsIGEsIHRoaXMuZ2V0QXR0cmlidXRlKGUpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiAwIGluIHRoaXMgJiYgMSA9PSB0aGlzWzBdLm5vZGVUeXBlICYmIG51bGwgIT0gKGEgPSB0aGlzWzBdLmdldEF0dHJpYnV0ZShlKSkgPyBhIDogRTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVBdHRyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxID09PSB0aGlzLm5vZGVUeXBlICYmIGUuc3BsaXQoJyAnKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5KHRoaXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gYWVbZV0gfHwgZSwgMSBpbiBhcmd1bWVudHMgPyB0aGlzLmVhY2goZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1tlXSA9IHYodGhpcywgdCwgYSwgdGhpc1tlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiB0aGlzWzBdICYmIHRoaXNbMF1bZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlUHJvcDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IGFlW2VdIHx8IGUsIHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAnZGF0YS0nICsgZS5yZXBsYWNlKFUsICctJDEnKS50b0xvd2VyQ2FzZSgpLCBuID0gMSBpbiBhcmd1bWVudHMgPyB0aGlzLmF0dHIoYSwgdCkgOiB0aGlzLmF0dHIoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IG4gPyBBKG4pIDogRTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWw6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgaW4gYXJndW1lbnRzID8gKG51bGwgPT0gZSAmJiAoZSA9ICcnKSwgdGhpcy5lYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmFsdWUgPSB2KHRoaXMsIGUsIHQsIHRoaXMudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSA6IHRoaXNbMF0gJiYgKHRoaXNbMF0ubXVsdGlwbGUgPyBJKHRoaXNbMF0pLmZpbmQoJ29wdGlvbicpLmZpbHRlcihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNlbGVjdGVkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnBsdWNrKCd2YWx1ZScpIDogdGhpc1swXS52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2Zmc2V0OiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IEkodGhpcyksIG4gPSB2KHRoaXMsIHQsIGUsIGEub2Zmc2V0KCkpLCByID0gYS5vZmZzZXRQYXJlbnQoKS5vZmZzZXQoKSwgaSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9wOiBuLnRvcCAtIHIudG9wLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWZ0OiBuLmxlZnQgLSByLmxlZnQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0YXRpYycgPT0gYS5jc3MoJ3Bvc2l0aW9uJykgJiYgKGkucG9zaXRpb24gPSAncmVsYXRpdmUnKSwgYS5jc3MoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdGhpcy5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNLmRvY3VtZW50RWxlbWVudCAhPT0gdGhpc1swXSAmJiAhSS5jb250YWlucyhNLmRvY3VtZW50RWxlbWVudCwgdGhpc1swXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3A6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWZ0OiAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzWzBdLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IGEubGVmdCArIGUucGFnZVhPZmZzZXQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvcDogYS50b3AgKyBlLnBhZ2VZT2Zmc2V0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogTWF0aC5yb3VuZChhLndpZHRoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBNYXRoLnJvdW5kKGEuaGVpZ2h0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3NzOiBmdW5jdGlvbiAoZSwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoIDwgMikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXNbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnN0eWxlW1AoZSldIHx8IGdldENvbXB1dGVkU3R5bGUobiwgJycpLmdldFByb3BlcnR5VmFsdWUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5lKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7fSwgaSA9IGdldENvbXB1dGVkU3R5bGUobiwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEkuZWFjaChlLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbdF0gPSBuLnN0eWxlW1AodCldIHx8IGkuZ2V0UHJvcGVydHlWYWx1ZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHQoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgfHwgMCA9PT0gYSA/IG8gPSBkKGUpICsgJzonICsgaChlLCBhKSA6IHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0eWxlLnJlbW92ZVByb3BlcnR5KGQoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoRCBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtEXSB8fCAwID09PSBlW0RdID8gbyArPSBkKEQpICsgJzonICsgaChELCBlW0RdKSArICc7JyA6IHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdHlsZS5yZW1vdmVQcm9wZXJ0eShkKEQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0eWxlLmNzc1RleHQgKz0gJzsnICsgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IHRoaXMuaW5kZXhPZihJKGUpWzBdKSA6IHRoaXMucGFyZW50KCkuY2hpbGRyZW4oKS5pbmRleE9mKHRoaXNbMF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc0NsYXNzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWUgJiYgVi5zb21lLmNhbGwodGhpcywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudGVzdChrKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBwKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGRDbGFzczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IHRoaXMuZWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2NsYXNzTmFtZScgaW4gdGhpcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBrKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdih0aGlzLCBlLCB0LCBhKS5zcGxpdCgvXHMrL2cpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKHRoaXMpLmhhc0NsYXNzKGUpIHx8IFQucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMpLCBULmxlbmd0aCAmJiBrKHRoaXMsIGEgKyAoYSA/ICcgJyA6ICcnKSArIFQuam9pbignICcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVDbGFzczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnY2xhc3NOYW1lJyBpbiB0aGlzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9PT0gRSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gayh0aGlzLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUID0gayh0aGlzKSwgdih0aGlzLCBlLCB0LCBUKS5zcGxpdCgvXHMrL2cpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUID0gVC5yZXBsYWNlKHAoZSksICcgJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgayh0aGlzLCBULnRyaW0oKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2dnbGVDbGFzczogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IHRoaXMuZWFjaChmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IEkodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYodGhpcywgZSwgYSwgayh0aGlzKSkuc3BsaXQoL1xzKy9nKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodCA9PT0gRSA/ICFuLmhhc0NsYXNzKGUpIDogdCkgPyBuLmFkZENsYXNzKGUpIDogbi5yZW1vdmVDbGFzcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcm9sbFRvcDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAnc2Nyb2xsVG9wJyBpbiB0aGlzWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gRSA/IHQgPyB0aGlzWzBdLnNjcm9sbFRvcCA6IHRoaXNbMF0ucGFnZVlPZmZzZXQgOiB0aGlzLmVhY2godCA/IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsVG9wID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsVG8odGhpcy5zY3JvbGxYLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcm9sbExlZnQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJ3Njcm9sbExlZnQnIGluIHRoaXNbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBFID8gdCA/IHRoaXNbMF0uc2Nyb2xsTGVmdCA6IHRoaXNbMF0ucGFnZVhPZmZzZXQgOiB0aGlzLmVhY2godCA/IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsTGVmdCA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbFRvKGUsIHRoaXMuc2Nyb2xsWSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXNbMF0sIHQgPSB0aGlzLm9mZnNldFBhcmVudCgpLCBhID0gdGhpcy5vZmZzZXQoKSwgbiA9IHEudGVzdCh0WzBdLm5vZGVOYW1lKSA/IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3A6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVmdDogMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IHQub2Zmc2V0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLnRvcCAtPSBwYXJzZUZsb2F0KEkoZSkuY3NzKCdtYXJnaW4tdG9wJykpIHx8IDAsIGEubGVmdCAtPSBwYXJzZUZsb2F0KEkoZSkuY3NzKCdtYXJnaW4tbGVmdCcpKSB8fCAwLCBuLnRvcCArPSBwYXJzZUZsb2F0KEkodFswXSkuY3NzKCdib3JkZXItdG9wLXdpZHRoJykpIHx8IDAsIG4ubGVmdCArPSBwYXJzZUZsb2F0KEkodFswXSkuY3NzKCdib3JkZXItbGVmdC13aWR0aCcpKSB8fCAwLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3A6IGEudG9wIC0gbi50b3AsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWZ0OiBhLmxlZnQgLSBuLmxlZnQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2Zmc2V0UGFyZW50OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWFwKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHRoaXMub2Zmc2V0UGFyZW50IHx8IE0uYm9keTsgZSAmJiAhcS50ZXN0KGUubm9kZU5hbWUpICYmICdzdGF0aWMnID09IEkoZSkuY3NzKCdwb3NpdGlvbicpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLm9mZnNldFBhcmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEkuZm4uZGV0YWNoID0gSS5mbi5yZW1vdmUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3aWR0aCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGVpZ2h0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXBsYWNlKC8uLywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVswXS50b1VwcGVyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJLmZuW2VdID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSwgbyA9IHRoaXNbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPT09IEUgPyBuKG8pID8gb1snaW5uZXInICsgdF0gOiByKG8pID8gby5kb2N1bWVudEVsZW1lbnRbJ3Njcm9sbCcgKyB0XSA6IChpID0gdGhpcy5vZmZzZXQoKSkgJiYgaVtlXSA6IHRoaXMuZWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobyA9IEkodGhpcykpLmNzcyhlLCB2KHRoaXMsIGEsIHQsIG9bZV0oKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIFkuZm9yRWFjaChmdW5jdGlvbiAoZSwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhICUgMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkuZm5bZV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHIsIGkgPSBJLm1hcChhcmd1bWVudHMsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhcnJheScgPT0gKGUgPSB0KGEpKSA/IChhLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5ub2RlVHlwZSAhPT0gRSA/IG4ucHVzaChlKSA6IEkuemVwdG8uaXNaKGUpID8gbiA9IG4uY29uY2F0KGUuZ2V0KCkpIDogdm9pZCAobiA9IG4uY29uY2F0KGVlLmZyYWdtZW50KGUpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbikgOiAnb2JqZWN0JyA9PSBlIHx8IG51bGwgPT0gYSA/IGEgOiBlZS5mcmFnbWVudChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG8gPSB0aGlzLmxlbmd0aCA+IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkubGVuZ3RoIDwgMSA/IHRoaXMgOiB0aGlzLmVhY2goZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IG4gPyB0IDogdC5wYXJlbnROb2RlLCB0ID0gMCA9PSBhID8gdC5uZXh0U2libGluZyA6IDEgPT0gYSA/IHQuZmlyc3RDaGlsZCA6IDIgPT0gYSA/IHQgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IEkuY29udGFpbnMoTS5kb2N1bWVudEVsZW1lbnQsIHIpLCBjID0gL14odGV4dHxhcHBsaWNhdGlvbilcLyhqYXZhc2NyaXB0fGVjbWFzY3JpcHQpJC8sIGwgPSBYKCksIHUgPSBsW3lmXSwgZCA9IGxba2ZdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLmNsb25lTm9kZSghMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICghcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSShlKS5yZW1vdmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE11KHUpICYmICdTQ1JJUFQnID09PSBlLnRhZ05hbWUgJiYgZS5zZXRBdHRyaWJ1dGUoJ25vbmNlJywgdSksIE11KGQpICYmICdTVFlMRScgPT09IGUudGFnTmFtZSAmJiBlLnNldEF0dHJpYnV0ZSgnbm9uY2UnLCBkKSwgci5pbnNlcnRCZWZvcmUoZSwgdCksIHMgJiYgUyhlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT0gZS5ub2RlTmFtZSB8fCAnU0NSSVBUJyAhPT0gZS5ub2RlTmFtZS50b1VwcGVyQ2FzZSgpIHx8IGUudHlwZSAmJiAhYy50ZXN0KGUudHlwZS50b0xvd2VyQ2FzZSgpKSB8fCBlLnNyYyB8fCB3KE0sIGUuaW5uZXJIVE1MLCBlLm5vbmNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEkuZm5bbiA/IGUgKyAnVG8nIDogJ2luc2VydCcgKyAoYSA/ICdCZWZvcmUnIDogJ0FmdGVyJyldID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSSh0KVtlXSh0aGlzKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlZS5aLnByb3RvdHlwZSA9IG0ucHJvdG90eXBlID0gSS5mbiwgZWUudW5pcSA9IEMsIGVlLmRlc2VyaWFsaXplVmFsdWUgPSBBLCBJLnplcHRvID0gZWUsIEk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLl96aWQgfHwgKGUuX3ppZCA9IGgrKyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihlLCB0LCBuLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHQgPSByKHQpKS5ucykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGkodC5ucyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGJbYShlKV0gfHwgW10pLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICghdC5lIHx8IGUuZSA9PSB0LmUpICYmICghdC5ucyB8fCBzLnRlc3QoZS5ucykpICYmICghbiB8fCBhKGUuZm4pID09PSBhKG4pKSAmJiAoIW8gfHwgZS5zZWwgPT0gbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gKCcnICsgZSkuc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZTogdFswXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuczogdC5zbGljZSgxKS5zb3J0KCkuam9pbignICcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBSZWdFeHAoJyg/Ol58ICknICsgZS5yZXBsYWNlKCcgJywgJyAuKiA/JykgKyAnKD86IHwkKScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZGVsICYmICF2ICYmIGUuZSBpbiB5IHx8ICEhdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBrW2VdIHx8IHYgJiYgeVtlXSB8fCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSwgbiwgaSwgYywgbCwgZCwgaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBhKGUpLCBnID0gYltmXSB8fCAoYltmXSA9IFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uc3BsaXQoL1xzLykuZm9yRWFjaChmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgncmVhZHknID09IGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KGRvY3VtZW50KS5yZWFkeShpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHIoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5mbiA9IGksIG4uc2VsID0gbCwgbi5lIGluIGsgJiYgKGkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUucmVsYXRlZFRhcmdldDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8IGEgIT09IHRoaXMgJiYgIXQuY29udGFpbnModGhpcywgYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5mbi5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuLmRlbCA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBkIHx8IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wcm94eSA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKHQgPSB1KHQpKS5pc0ltbWVkaWF0ZVByb3BhZ2F0aW9uU3RvcHBlZCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmRhdGEgPSBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBmLmFwcGx5KGUsIHQuX2FyZ3MgPT0gcCA/IFt0XSA6IFt0XS5jb25jYXQodC5fYXJncykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExID09PSBhICYmICh0LnByZXZlbnREZWZhdWx0KCksIHQuc3RvcFByb3BhZ2F0aW9uKCkpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbi5pID0gZy5sZW5ndGgsIGcucHVzaChuKSwgJ2FkZEV2ZW50TGlzdGVuZXInIGluIGUgJiYgZS5hZGRFdmVudExpc3RlbmVyKHMobi5lKSwgbi5wcm94eSwgbyhuLCBoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUsIHQsIHIsIGksIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gYShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh0IHx8ICcnKS5zcGxpdCgvXHMvKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihlLCB0LCByLCBpKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBiW2xdW3QuaV0sICdyZW1vdmVFdmVudExpc3RlbmVyJyBpbiBlICYmIGUucmVtb3ZlRXZlbnRMaXN0ZW5lcihzKHQuZSksIHQucHJveHksIG8odCwgYykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSB8fCAhZS5pc0RlZmF1bHRQcmV2ZW50ZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhIHx8IChhID0gZSksIHQuZWFjaChFLCBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGFbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1tuXSA9IEEsIHIgJiYgci5hcHBseShhLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlW25dID0gUzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnRpbWVTdGFtcCB8fCAoZS50aW1lU3RhbXAgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoYS5kZWZhdWx0UHJldmVudGVkICE9PSBwID8gYS5kZWZhdWx0UHJldmVudGVkIDogJ3JldHVyblZhbHVlJyBpbiBhID8gITEgPT09IGEucmV0dXJuVmFsdWUgOiBhLmdldFByZXZlbnREZWZhdWx0ICYmIGEuZ2V0UHJldmVudERlZmF1bHQoKSkgJiYgKGUuaXNEZWZhdWx0UHJldmVudGVkID0gQSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBhID0geyBvcmlnaW5hbEV2ZW50OiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3LnRlc3QodCkgfHwgZVt0XSA9PT0gcCB8fCAoYVt0XSA9IGVbdF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoYSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAsIGggPSAxLCBmID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLCBnID0gdC5pc0Z1bmN0aW9uLCBtID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBiID0ge30sIF8gPSB7fSwgdiA9ICdvbmZvY3VzaW4nIGluIGUsIHkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9jdXM6ICdmb2N1c2luJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibHVyOiAnZm9jdXNvdXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBrID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vdXNlZW50ZXI6ICdtb3VzZW92ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vdXNlbGVhdmU6ICdtb3VzZW91dCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8uY2xpY2sgPSBfLm1vdXNlZG93biA9IF8ubW91c2V1cCA9IF8ubW91c2Vtb3ZlID0gJ01vdXNlRXZlbnRzJywgdC5ldmVudCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZDogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZTogbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3h5ID0gZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gMiBpbiBhcmd1bWVudHMgJiYgZi5jYWxsKGFyZ3VtZW50cywgMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZyhlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseShuLCByID8gci5jb25jYXQoZi5jYWxsKGFyZ3VtZW50cykpIDogYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLl96aWQgPSBhKGUpLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG0obikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPyAoci51bnNoaWZ0KGVbbl0sIGUpLCB0LnByb3h5LmFwcGx5KG51bGwsIHIpKSA6IHQucHJveHkoZVtuXSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdleHBlY3RlZCBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmZuLmJpbmQgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMub24oZSwgdCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuZm4udW5iaW5kID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm9mZihlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5mbi5vbmUgPSBmdW5jdGlvbiAoZSwgdCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMub24oZSwgdCwgYSwgbiwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBBID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdyA9IC9eKFtBLVpdfHJldHVyblZhbHVlJHxsYXllcltYWV0kfHdlYmtpdE1vdmVtZW50W1hZXSQpLywgRSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmV2ZW50RGVmYXVsdDogJ2lzRGVmYXVsdFByZXZlbnRlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcEltbWVkaWF0ZVByb3BhZ2F0aW9uOiAnaXNJbW1lZGlhdGVQcm9wYWdhdGlvblN0b3BwZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3BQcm9wYWdhdGlvbjogJ2lzUHJvcGFnYXRpb25TdG9wcGVkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5mbi5kZWxlZ2F0ZSA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5vbih0LCBlLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5mbi51bmRlbGVnYXRlID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm9mZih0LCBlLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5mbi5saXZlID0gZnVuY3Rpb24gKGUsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KGRvY3VtZW50LmJvZHkpLmRlbGVnYXRlKHRoaXMuc2VsZWN0b3IsIGUsIGEpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmZuLmRpZSA9IGZ1bmN0aW9uIChlLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdChkb2N1bWVudC5ib2R5KS51bmRlbGVnYXRlKHRoaXMuc2VsZWN0b3IsIGUsIGEpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmZuLm9uID0gZnVuY3Rpb24gKGUsIGEsIG4sIHIsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvLCBzLCB1ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICFtKGUpID8gKHQuZWFjaChlLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUub24oZSwgYSwgbiwgdCwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdSkgOiAobShhKSB8fCBnKHIpIHx8ICExID09PSByIHx8IChyID0gbiwgbiA9IGEsIGEgPSBwKSwgciAhPT0gcCAmJiAhMSAhPT0gbiB8fCAociA9IG4sIG4gPSBwKSwgITEgPT09IHIgJiYgKHIgPSBTKSwgdS5lYWNoKGZ1bmN0aW9uICh1LCBwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSAmJiAobyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKHAsIGUudHlwZSwgciksIHIuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYSAmJiAocyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCBpID0gdChlLnRhcmdldCkuY2xvc2VzdChhLCBwKS5nZXQoMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpICYmIGkgIT09IHApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9IHQuZXh0ZW5kKGQoZSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50VGFyZ2V0OiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpdmVGaXJlZDogcAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIChvIHx8IHIpLmFwcGx5KGksIFtuXS5jb25jYXQoZi5jYWxsKGFyZ3VtZW50cywgMSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYyhwLCBlLCByLCBuLCBhLCBzIHx8IG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmZuLm9mZiA9IGZ1bmN0aW9uIChlLCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAhbShlKSA/ICh0LmVhY2goZSwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLm9mZihlLCBhLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByKSA6IChtKGEpIHx8IGcobikgfHwgITEgPT09IG4gfHwgKG4gPSBhLCBhID0gcCksICExID09PSBuICYmIChuID0gUyksIHIuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCh0aGlzLCBlLCBuLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5mbi50cmlnZ2VyID0gZnVuY3Rpb24gKGUsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IG0oZSkgfHwgdC5pc1BsYWluT2JqZWN0KGUpID8gdC5FdmVudChlKSA6IHUoZSkpLl9hcmdzID0gYSwgdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnR5cGUgaW4geSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiB0aGlzW2UudHlwZV0gPyB0aGlzW2UudHlwZV0oKSA6ICdkaXNwYXRjaEV2ZW50JyBpbiB0aGlzID8gdGhpcy5kaXNwYXRjaEV2ZW50KGUpIDogdCh0aGlzKS50cmlnZ2VySGFuZGxlcihlLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmZuLnRyaWdnZXJIYW5kbGVyID0gZnVuY3Rpb24gKGUsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZWFjaChmdW5jdGlvbiAobywgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChyID0gZChtKGUpID8gdC5FdmVudChlKSA6IGUpKS5fYXJncyA9IGEsIHIudGFyZ2V0ID0gcywgdC5lYWNoKG4ocywgZS50eXBlIHx8IGUpLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA9IHQucHJveHkociksIHIuaXNJbW1lZGlhdGVQcm9wYWdhdGlvblN0b3BwZWQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAnZm9jdXNpbiBmb2N1c291dCBmb2N1cyBibHVyIGxvYWQgcmVzaXplIHNjcm9sbCB1bmxvYWQgY2xpY2sgZGJsY2xpY2sgbW91c2Vkb3duIG1vdXNldXAgbW91c2Vtb3ZlIG1vdXNlb3ZlciBtb3VzZW91dCBtb3VzZWVudGVyIG1vdXNlbGVhdmUgY2hhbmdlIHNlbGVjdCBrZXlkb3duIGtleXByZXNzIGtleXVwIGVycm9yJy5zcGxpdCgnICcpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZm5bZV0gPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwIGluIGFyZ3VtZW50cyA/IHRoaXMuYmluZChlLCB0KSA6IHRoaXMudHJpZ2dlcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0LkV2ZW50ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0oZSkgfHwgKGUgPSAodCA9IGUpLnR5cGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBkb2N1bWVudC5jcmVhdGVFdmVudChfW2VdIHx8ICdFdmVudHMnKSwgbiA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYnViYmxlcycgPT0gciA/IG4gPSAhIXRbcl0gOiBhW3JdID0gdFtyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmluaXRFdmVudChlLCBuLCAhMCksIHUoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0KSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29tcHV0ZWRTdHlsZSh2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGdldENvbXB1dGVkU3R5bGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmdldENvbXB1dGVkU3R5bGUgPSBmdW5jdGlvbiAoZSwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KGUsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnplcHRvLCBhID0gdC5xc2EsIG4gPSAvXlxzKj4vLCByID0gJ1plcHRvJyArICtuZXcgRGF0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnFzYSA9IGZ1bmN0aW9uICh0LCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbywgcywgYyA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPyBuLnRlc3QoYykgJiYgKHMgPSBlKHQpLmFkZENsYXNzKHIpLCBjID0gJy4nICsgciArICcgJyArIGMpIDogYyA9ICcqJywgbyA9IGEodCwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyAmJiBzLnJlbW92ZUNsYXNzKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0KSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0od2luZG93KSwgVWYgPSB3aW5kb3cuTXV0YXRpb25PYnNlcnZlciB8fCB3aW5kb3cuV2Via2l0TXV0YXRpb25PYnNlcnZlciwgemYgPSAnRXhwZWN0ZWQgYW4gYXJyYXkgb2YgcHJvbWlzZXMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdS5fc2V0SW1tZWRpYXRlRm4gJiYgQmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFlmID0gSCgpLCBLZiA9IC8uKlwuKFxkKylfXGQrLzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbHQod2luZG93LCBkb2N1bWVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBRZiA9ICdhdC1saWJyYXJ5LWxvYWRlZCcsIEdmID0gJ2F0LXJlcXVlc3Qtc3RhcnQnLCBXZiA9ICdhdC1yZXF1ZXN0LXN1Y2NlZWRlZCcsICRmID0gJ2F0LXJlcXVlc3QtZmFpbGVkJywgSmYgPSAnYXQtY29udGVudC1yZW5kZXJpbmctc3RhcnQnLCBaZiA9ICdhdC1jb250ZW50LXJlbmRlcmluZy1zdWNjZWVkZWQnLCBYZiA9ICdhdC1jb250ZW50LXJlbmRlcmluZy1mYWlsZWQnLCBlZyA9ICdhdC1jb250ZW50LXJlbmRlcmluZy1uby1vZmZlcnMnLCB0ZyA9ICdhdC1jb250ZW50LXJlbmRlcmluZy1yZWRpcmVjdCcsIGFnID0gJzplcSgnLCBuZyA9ICcpJywgcmcgPSBhZy5sZW5ndGgsIGlnID0gLygoXC58IykoLSk/XGR7MX0pL2csIG9nID0gJ1VuYWJsZSB0byBsb2FkIHRhcmdldC12ZWMuanMnLCBzZyA9ICdMb2FkaW5nIHRhcmdldC12ZWMuanMnLCBjZyA9ICdfQVQnLCBsZyA9ICdjbGlja0hhbmRsZXJGb3JFeHBlcmllbmNlRWRpdG9yJywgdWcgPSAnY3VycmVudFZpZXcnLCBkZyA9ICdhdF9xYV9tb2RlJywgcGcgPSAnYXRfcHJldmlld190b2tlbicsIGhnID0gJ2F0X3ByZXZpZXdfaW5kZXgnLCBmZyA9ICdhdF9wcmV2aWV3X2xpc3RlZF9hY3Rpdml0aWVzX29ubHknLCBnZyA9ICdhdF9wcmV2aWV3X2V2YWx1YXRlX2FzX3RydWVfYXVkaWVuY2VfaWRzJywgbWcgPSAnYXRfcHJldmlld19ldmFsdWF0ZV9hc19mYWxzZV9hdWRpZW5jZV9pZHMnLCBiZyA9ICdfJywgX2cgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHZnID0gJ2F0X3ByZXZpZXdfbW9kZScsIHlnID0gJ2F0X3ByZXZpZXcnLCBrZyA9ICdhdC0nLCBBZyA9ICdhdC1ib2R5LXN0eWxlJywgU2cgPSAnIycgKyBBZywgd2cgPSBrZyArICd2aWV3cycsIEVnID0gJ0Rpc2FibGVkIGR1ZSB0byBvcHRvdXQnLCBEZyA9ICdNQ0FBTUInLCBJZyA9ICdNQ0FBTUxIJywgVGcgPSAnTUNNSUQnLCBQZyA9ICdNQ09QVE9VVCcsIENnID0gJ2dldFN1cHBsZW1lbnRhbERhdGFJRCcsIFZnID0gJ2dldEN1c3RvbWVySURzJywgTGcgPSAhMCwgTmcgPSAnTlMnLCBPZyA9ICdEUycsIE1nID0gJ3RyYWNraW5nU2VydmVyJywgUmcgPSBNZyArICdTZWN1cmUnLCBqZyA9ICdWaXNpdG9yJywgeGcgPSAnZ2V0SW5zdGFuY2UnLCBCZyA9ICdpc0FsbG93ZWQnLCBGZyA9ICdWaXNpdG9yIEFQSSByZXF1ZXN0cyB0aW1lZCBvdXQnLCBIZyA9ICdWaXNpdG9yIEFQSSByZXF1ZXN0cyBlcnJvcicsIHFnID0ge30sIFVnID0gJ0RhdGEgcHJvdmlkZXInLCB6ZyA9ICd0aW1lZCBvdXQnLCBZZyA9IDIwMDAsIEtnID0gJ2F1dGhvcml6YXRpb24nLCBRZyA9ICdtYm94RGVidWdUb29scycsIEdnID0gaG4oKSwgV2cgPSAncHJvZmlsZS4nLCAkZyA9ICdtYm94M3JkUGFydHlJZCcsIEpnID0gJ2F0X3Byb3BlcnR5JywgWmcgPSAnb3JkZXJJZCcsIFhnID0gJ29yZGVyVG90YWwnLCBlbSA9ICdwcm9kdWN0UHVyY2hhc2VkSWQnLCB0bSA9ICdwcm9kdWN0SWQnLCBhbSA9ICdjYXRlZ29yeUlkJywgbm0gPSAnUE9TVCcsIHJtID0gJ05ldHdvcmsgcmVxdWVzdCBmYWlsZWQnLCBpbSA9ICdSZXF1ZXN0IHRpbWVkIG91dCcsIG9tID0gJ01hbGZvcm1lZCByZXNwb25zZSBKU09OJywgc20gPSAnbWJveGVkZ2UnLCBjbSA9ICcudHQub210cmRjLm5ldCcsIGxtID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIVQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB1bSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkbSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcG0gPSBkbShyKSwgaG0gPSBkbShDKSwgZm0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZihlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZ20gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0YXR1cyA9PT0gT3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBtbSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudHlwZSA9PT0gS3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBibSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudHlwZSA9PT0gQWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBfbSA9IGZtKHBtKSwgdm0gPSBmbShobSksIHltID0gdW0oV2gpLCBrbSA9IHVtKGVkKSwgQW0gPSB1bShKaCksIFNtID0gdW0oUXApLCB3bSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE11KGUubmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBFbSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFyKGUuaW5kZXgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRG0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKGUpICYmIHdtKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSW0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKGUpICYmIHdtKGUpICYmIEVtKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgVG0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKGUpICYmIHdtKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgUG0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdShlLnNlbGVjdG9yKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIENtID0gdW0oR3ApLCBWbSA9IGIoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENtLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBtCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgTG0gPSAnYWRvYmVfbWNfc2RpZCcsIE5tID0gJ05ldHdvcmsgcmVxdWVzdCBmYWlsZWQnLCBPbSA9ICdSZXF1ZXN0IHRpbWVkIG91dCcsIE1tID0gJ1VSTCBpcyByZXF1aXJlZCcsIFJtID0gJ0dFVCcsIGptID0gJ1BPU1QnLCB4bSA9ICdtZXRob2QnLCBCbSA9ICd1cmwnLCBGbSA9ICdoZWFkZXJzJywgSG0gPSAnZGF0YScsIHFtID0gJ2NyZWRlbnRpYWxzJywgVW0gPSAndGltZW91dCcsIHptID0gJ2FzeW5jJywgWW0gPSAvQ0xLVFJLIyhcUyspLywgS20gPSAvQ0xLVFJLIyhcUyspXHMvLCBRbSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFyKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgR20gPSAndmlzaWJpbGl0eVN0YXRlJywgV20gPSAndmlzaWJsZScsICRtID0gMTAwLCBKbSA9IFdkICsgJywnICsgSmQgKyAnLCcgKyAkZCwgWm0gPSAnYXQtYWN0aW9uLWtleScsIFhtID0gJ21ldHJpYyBlbGVtZW50IG5vdCBmb3VuZCcsIGViID0gJ25hdmlnYXRvcicsIHRiID0gJ3NlbmRCZWFjb24nLCBhYiA9ICdCZWFjb24gZGF0YSBzZW50JywgbmIgPSAnQmVhY29uIGRhdGEgc2VudCBmYWlsZWQnLCByYiA9ICdWaWV3IHRyaWdnZXJlZCBub3RpZmljYXRpb24nLCBpYiA9ICdWaWV3IHJlbmRlcmVkIG5vdGlmaWNhdGlvbicsIG9iID0gJ01ib3hlcyByZW5kZXJlZCBub3RpZmljYXRpb24nLCBzYiA9ICdFdmVudCBoYW5kbGVyIG5vdGlmaWNhdGlvbicsIGNiID0gJ01ib3ggZXZlbnQgaGFuZGxlciBub3RpZmljYXRpb24nLCBsYiA9ICdWaWV3IGV2ZW50IGhhbmRsZXIgbm90aWZpY2F0aW9uJywgdWIgPSAncHJlZmV0Y2hNYm94ZXMnLCBkYiA9ICdyZW5kZXJlZCcsIHBiID0gJ3RyaWdnZXJlZCcsIGhiID0ge30sIGZiID0gJ3BhZ2VMb2FkTWV0cmljcycsIGdiID0gJ3ByZWZldGNoTWV0cmljcycsIG1iID0gdW0oJGgpLCBiYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gU3IoRnApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgX2IgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3cihGcCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2YiA9IHVtKGVkKSwgeWIgPSB1bShsZCksIGtiID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gU3IoQnAsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgQWIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3cihCcCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBTYiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRtKGdtKShlKSAmJiBWbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdjLnByb3RvdHlwZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uOiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcy5lIHx8ICh0aGlzLmUgPSB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChuW2VdIHx8IChuW2VdID0gW10pKS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm46IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN0eDogYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uY2U6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5vZmYoZSwgbiksIHQuYXBwbHkoYSwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLl8gPSB0LCB0aGlzLm9uKGUsIG4sIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVtaXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IFtdLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKSwgYSA9ICgodGhpcy5lIHx8ICh0aGlzLmUgPSB7fSkpW2VdIHx8IFtdKS5zbGljZSgpLCBuID0gMCwgciA9IGEubGVuZ3RoOyBuIDwgcjsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhW25dLmZuLmFwcGx5KGFbbl0uY3R4LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZmY6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLmUgfHwgKHRoaXMuZSA9IHt9KSwgbiA9IGFbZV0sIHIgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiAmJiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbyA9IG4ubGVuZ3RoOyBpIDwgbzsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbltpXS5mbiAhPT0gdCAmJiBuW2ldLmZuLl8gIT09IHQgJiYgci5wdXNoKG5baV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmxlbmd0aCA/IGFbZV0gPSByIDogZGVsZXRlIGFbZV0sIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB3YiA9IGdjLCBFYiA9IGdjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3Yi5UaW55RW1pdHRlciA9IEViOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgRGIgPSBtYygpLCBJYiA9ICdQYWdlIGxvYWQgcmVuZGVyaW5nIGZhaWxlZCcsIFRiID0gJ01ib3hlcyByZW5kZXJpbmcgZmFpbGVkJywgUGIgPSAnVmlldyByZW5kZXJpbmcgZmFpbGVkJywgQ2IgPSAnUHJlZmV0Y2ggcmVuZGVyaW5nIGZhaWxlZCcsIFZiID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIVQoZihnbSwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgTGIgPSAnW3BhZ2UtaW5pdF0nLCBOYiA9ICdbZ2V0T2ZmZXIoKV0nLCBPYiA9ICdbZ2V0T2ZmZXJzKCldJywgTWIgPSAnW2FwcGx5T2ZmZXIoKV0nLCBSYiA9ICdbYXBwbHlPZmZlcnMoKV0nLCBqYiA9ICdbc2VuZE5vdGlmaWNhdGlvbnMoKV0nLCB4YiA9ICdbdHJhY2tFdmVudCgpXScsIEJiID0gJ1t0cmlnZ2VyVmlldygpXScsIEZiID0gW10sIEhiID0gMCwgcWIgPSAxLCBVYiA9IEhiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgemIgPSAnZnVuY3Rpb24gaGFzIGJlZW4gZGVwcmVjYXRlZC4gUGxlYXNlIHVzZSBnZXRPZmZlcigpIGFuZCBhcHBseU9mZmVyKCkgZnVuY3Rpb25zIGluc3RlYWQuJywgWWIgPSAnYWRvYmUudGFyZ2V0LnJlZ2lzdGVyRXh0ZW5zaW9uKCkgZnVuY3Rpb24gaGFzIGJlZW4gZGVwcmVjYXRlZC4gUGxlYXNlIHJldmlldyB0aGUgZG9jdW1lbnRhdGlvbiBmb3IgYWx0ZXJuYXRpdmVzLicsIEtiID0gJ21ib3hDcmVhdGUoKSAnICsgemIsIFFiID0gJ21ib3hEZWZpbmUoKSAnICsgemIsIEdiID0gJ21ib3hVcGRhdGUoKSAnICsgemIsIFdiID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXQ6IGZ1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXRDb25maWc6IFosCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdERlbGl2ZXJ5OiBwbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gV2I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS10YXJnZXQtdjIvbGliL21vZHVsZXMvcGFnZS1sb2FkLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEoJy4uL2xpYnJhcnlTZXR0aW5ncycpLCByID0gYSgnQGFkb2JlL3JlYWN0b3Itd2luZG93JyksIGkgPSBhKCcuL29iamVjdC1vdmVycmlkZScpLCBvID0gYSgnLi9wYXJhbXMtc3RvcmUnKSwgcyA9IG8uZ2V0UGFyYW1zLCBjID0gby5nZXRQYWdlTG9hZFBhcmFtcywgbCA9IGEoJy4uL3RhcmdldFNldHRpbmdzJykudGFyZ2V0U2V0dGluZ3M7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbC5tYm94UGFyYW1zID0gcygpLCBsLmdsb2JhbE1ib3hQYXJhbXMgPSBjKCksIGkobCwgZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdib2R5SGlkaW5nRW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JvZHlIaWRkZW5TdHlsZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBpKGwsIHIudGFyZ2V0R2xvYmFsU2V0dGluZ3MgfHwge30sIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JvZHlIaWRpbmdFbmFibGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYm9keUhpZGRlblN0eWxlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIGkobCwgbi5UQVJHRVRfREVGQVVMVF9TRVRUSU5HUyB8fCB7fSwgWyd2ZXJzaW9uJ10pLCBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtdGFyZ2V0LXYyL2xpYi9tZXNzYWdlcy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxSRUFEWV9JTklUSUFMSVpFRDogJ0FUOiBBZG9iZSBUYXJnZXQgaGFzIGFscmVhZHkgYmVlbiBpbml0aWFsaXplZC4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREVMSVZFUllfRElTQUJMRUQ6ICdBVDogQWRvYmUgVGFyZ2V0IGNvbnRlbnQgZGVsaXZlcnkgaXMgZGlzYWJsZWQuIFVwZGF0ZSB5b3VyIERPQ1RZUEUgdG8gc3VwcG9ydCBTdGFuZGFyZHMgbW9kZS4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTk9fUkVRVUVTVDogJ0FUOiBUYXJnZXQgbGlicmFyeSBpcyBlaXRoZXIgbm90IGxvYWRlZCBvciBkaXNhYmxlZCwgbm8gcmVxdWVzdCB3aWxsIGJlIGV4ZWN1dGVkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtdGFyZ2V0LXYyL2xpYi9saWJyYXJ5U2V0dGluZ3MuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0geyB2ZXJzaW9uOiAnMi42LjEnIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsgVEFSR0VUX0RFRkFVTFRfU0VUVElOR1M6IHQgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLXRhcmdldC12Mi9saWIvbW9kdWxlcy9vYmplY3Qtb3ZlcnJpZGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoZSwgdCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFthXSAhPT0gbiAmJiAoZVthXSA9IHRbYV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFBcnJheS5pc0FycmF5KHRoaXMuc3Vic2V0KSB8fCAtMSAhPT0gdGhpcy5zdWJzZXQuaW5kZXhPZihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMobikuZmlsdGVyKGEsIHsgc3Vic2V0OiByIH0pLmZvckVhY2goZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGUsIG4sIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS10YXJnZXQtdjIvbGliL21vZHVsZXMvcGFyYW1zLXN0b3JlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IGUgJiYgbnVsbCAhPSBlICYmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSwgJ3ZhbHVlJykgJiYgbnVsbCAhPSBlLmNoZWNrZWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlW2FdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKHIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gci5jaGVja2VkLCBvID0gci52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSAmJiAnJyA9PT0gbyB8fCAodFthXSA9IG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W2FdID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSByKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCh1LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwoZCwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGEoJy4vb2JqZWN0LW92ZXJyaWRlJyksIHUgPSB7fSwgZCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXJnZVBhcmFtczogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lcmdlUGFnZUxvYWRQYXJhbXM6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRQYXJhbXM6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRQYWdlTG9hZFBhcmFtczogYwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtdGFyZ2V0LXYyL2xpYi90YXJnZXRTZXR0aW5ncy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLmdldEV4dGVuc2lvblNldHRpbmdzKCksIGkgPSByLnRhcmdldFNldHRpbmdzIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRlbnNpb25TZXR0aW5nczogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldFNldHRpbmdzOiBpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS10YXJnZXQtdjIvbGliL21vZHVsZXMvbG9hZC10YXJnZXQuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmNvbXBhdE1vZGUsIGEgPSBlLmRvY3VtZW50TW9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmICdDU1MxQ29tcGF0JyA9PT0gdCAmJiAoIWEgfHwgYSA+PSA5KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1LnJlc29sdmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5hZG9iZSA9IGUuYWRvYmUgfHwge30sIGUuYWRvYmUudGFyZ2V0ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZFUlNJT046ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50OiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRPZmZlcjogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRPZmZlcnM6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBwbHlPZmZlcjogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcHBseU9mZmVyczogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTm90aWZpY2F0aW9uczogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja0V2ZW50OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyaWdnZXJWaWV3OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lzdGVyRXh0ZW5zaW9uOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXQ6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUubWJveENyZWF0ZSA9IHQsIGUubWJveERlZmluZSA9IHQsIGUubWJveFVwZGF0ZSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmFkb2JlICYmIGMuYWRvYmUudGFyZ2V0ICYmIHZvaWQgMCAhPT0gYy5hZG9iZS50YXJnZXQuZ2V0T2ZmZXI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKCkgPyAobi5sb2dnZXIud2FybihkLkFMUkVBRFlfSU5JVElBTElaRUQpLCBudWxsKSA6IChnLm1ib3hQYXJhbXMgPSBoKCksIGcuZ2xvYmFsTWJveFBhcmFtcyA9IGYoKSwgbShnLCBjLnRhcmdldEdsb2JhbFNldHRpbmdzIHx8IHt9LCBfKSwgbShnLCBiIHx8IHt9LCBbJ3ZlcnNpb24nXSksIHIobCkgfHwgKGcuZW5hYmxlZCA9ICExLCBuLmxvZ2dlci53YXJuKGQuREVMSVZFUllfRElTQUJMRUQpKSwgZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgbCA9IGEoJ0BhZG9iZS9yZWFjdG9yLWRvY3VtZW50JyksIHUgPSBhKCdAYWRvYmUvcmVhY3Rvci1wcm9taXNlJyksIGQgPSBhKCcuLi9tZXNzYWdlcycpLCBwID0gYSgnLi9wYXJhbXMtc3RvcmUnKSwgaCA9IHAuZ2V0UGFyYW1zLCBmID0gcC5nZXRQYWdlTG9hZFBhcmFtcywgZyA9IGEoJy4uL3RhcmdldFNldHRpbmdzJykudGFyZ2V0U2V0dGluZ3MsIG0gPSBhKCcuL29iamVjdC1vdmVycmlkZScpLCBiID0gYSgnLi4vbGlicmFyeVNldHRpbmdzJykuVEFSR0VUX0RFRkFVTFRfU0VUVElOR1MsIF8gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuYWJsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjbGllbnRDb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaW1zT3JnSWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZXJ2ZXJEb21haW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb29raWVEb21haW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0aW1lb3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGVmYXVsdENvbnRlbnRIaWRkZW5TdHlsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RlZmF1bHRDb250ZW50VmlzaWJsZVN0eWxlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYm9keUhpZGRlblN0eWxlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYm9keUhpZGluZ0VuYWJsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZWxlY3RvcnNQb2xsaW5nVGltZW91dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Zpc2l0b3JBcGlUaW1lb3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb3ZlcnJpZGVNYm94RWRnZVNlcnZlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ292ZXJyaWRlTWJveEVkZ2VTZXJ2ZXJUaW1lb3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb3B0b3V0RW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29wdGluRW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NlY3VyZU9ubHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdXBwbGVtZW50YWxEYXRhSWRQYXJhbVRpbWVvdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhdXRob3JpbmdTY3JpcHRVcmwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1cmxTaXplTGltaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbmRwb2ludCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BhZ2VMb2FkRW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZpZXdzRW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FuYWx5dGljc0xvZ2dpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZXJ2ZXJTdGF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dsb2JhbE1ib3hOYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGVjaXNpb25pbmdNZXRob2QnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbml0TGlicmFyeVNldHRpbmdzOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGVQdWJsaWNBcGk6IGkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLXRhcmdldC12Mi9saWIvbW9kdWxlcy9vcHRpbi5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgPT09ICh2b2lkIDAgPT09IGUgPyAndW5kZWZpbmVkJyA6IHUoZSkpIHx8IG51bGwgPT09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHZvaWQgMCA9PT0gZSA/ICd1bmRlZmluZWQnIDogdShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmICgnb2JqZWN0JyA9PT0gdCB8fCAnZnVuY3Rpb24nID09PSB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGVbZ10pICYmIHIoZVtwXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF0ICYmICghbihlKSAmJiAoIW4oZVtmXSkgJiYgaShlW2ZdKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbcF0odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZFtmXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzKGUsIGVbbV1bYl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9baF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhkLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IGEoJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLmFkb2JlLCBwID0gJ2lzQXBwcm92ZWQnLCBoID0gJ29wdGluRW5hYmxlZCcsIGYgPSAnb3B0SW4nLCBnID0gJ2ZldGNoUGVybWlzc2lvbnMnLCBtID0gJ0NhdGVnb3JpZXMnLCBiID0gJ1RBUkdFVCcsIF8gPSBhKCcuLi90YXJnZXRTZXR0aW5ncycpLnRhcmdldFNldHRpbmdzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG91bGRVc2VPcHRJbjogbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzVGFyZ2V0QXBwcm92ZWQ6IGMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLXRhcmdldC12Mi9saWIvYW5hbHl0aWNzSW50ZWdyYXRpb24uanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBzKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA/IHQudGhlbihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIChlLmFib3J0ID0gITApLCBhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuZXcgcyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUoITEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZC50YXJnZXRTZXR0aW5ncy50aW1lb3V0KSwgYSA9IGZ1bmN0aW9uIGEobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUoITEpLCBjbGVhclRpbWVvdXQodCksIHUobywgbiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsKG8sIGgsIGZ1bmN0aW9uIGEobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5kZXRhaWwgJiYgITAgPT09IG4uZGV0YWlsLnJlZGlyZWN0ID8gZSghMCkgOiBlKCExKSwgY2xlYXJUaW1lb3V0KHQpLCB1KG8sIG4sIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbChvLCBmLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gYSgnQGFkb2JlL3JlYWN0b3ItZG9jdW1lbnQnKSwgcyA9IGEoJ0BhZG9iZS9yZWFjdG9yLXByb21pc2UnKSwgYyA9IGEoJy4vbW9kdWxlcy9ldmVudC11dGlsJyksIGwgPSBjLmFkZEV2ZW50TGlzdGVuZXIsIHUgPSBjLnJlbW92ZUV2ZW50TGlzdGVuZXIsIGQgPSBhKCcuL3RhcmdldFNldHRpbmdzJykuZXh0ZW5zaW9uU2V0dGluZ3MsIHAgPSBuLmdldFNoYXJlZE1vZHVsZSgnYWRvYmUtYW5hbHl0aWNzJywgJ2F1Z21lbnQtdHJhY2tlcicpLCBoID0gJ2F0LXJlcXVlc3Qtc3VjY2VlZGVkJywgZiA9ICdhdC1yZXF1ZXN0LWZhaWxlZCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkocCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS10YXJnZXQtdjIvbGliL21vZHVsZXMvZXZlbnQtdXRpbC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmFkZEV2ZW50TGlzdGVuZXIodCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnJlbW92ZUV2ZW50TGlzdGVuZXIodCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkRXZlbnRMaXN0ZW5lcjogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZUV2ZW50TGlzdGVuZXI6IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdhZG9iZS1tY2lkJzogewogICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0V4cGVyaWVuY2UgQ2xvdWQgSUQgU2VydmljZScsCiAgICAgICAgICAgICAgICAgICAgICAgIGhvc3RlZExpYkZpbGVzQmFzZVVybDogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS9leHRlbnNpb25zL0VQZjA0MTJhNWM2NWU1NDI5YWIwZTVlZDhiYTIyNTY1MTAvJywKICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yZ0lkOiAnMUExMjQ2NzM1Mjc4NTMyOTBBNDkwRDQ1QEFkb2JlT3JnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3RyYWNraW5nU2VydmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdtZXRyaWNzLnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3RyYWNraW5nU2VydmVyU2VjdXJlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdzbWV0cmljcy5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdtYXJrZXRpbmdDbG91ZFNlcnZlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnbWV0cmljcy5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdtYXJrZXRpbmdDbG91ZFNlcnZlclNlY3VyZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnc21ldHJpY3Muc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0lhYkNvbnRleHQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9lc09wdEluQXBwbHk6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJldmlvdXNQZXJtaXNzaW9uczogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc09wdEluU3RvcmFnZUVuYWJsZWQ6ICExCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1tY2lkL3NyYy9saWIvc2hhcmVkTW9kdWxlcy9tY2lkSW5zdGFuY2UuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gYSgnQGFkb2JlL3JlYWN0b3ItZG9jdW1lbnQnKSwgaSA9IGEoJy4uL2NvZGVMaWJyYXJ5L1Zpc2l0b3JBUEknKSwgbyA9IGEoJy4uLy4uL3ZpZXcvdXRpbHMvdGltZVVuaXRzJyksIHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlZHVjZShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IC9eKHRydWV8ZmFsc2UpJC9pLnRlc3QodC52YWx1ZSkgPyBKU09OLnBhcnNlKHQudmFsdWUpIDogdC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbdC5uYW1lXSA9IGEsIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuLmdldEV4dGVuc2lvblNldHRpbmdzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9IHR5cGVvZiB0Lm9yZ0lkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdPcmcgSUQgaXMgbm90IGEgc3RyaW5nLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gcyh0LnZhcmlhYmxlcyB8fCBbXSksIHIgPSB0LmRvZXNPcHRJbkFwcGx5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgKCdib29sZWFuJyA9PSB0eXBlb2YgciA/IGEuZG9lc09wdEluQXBwbHkgPSByIDogdC5vcHRJbkNhbGxiYWNrICYmIChhLmRvZXNPcHRJbkFwcGx5ID0gdC5vcHRJbkNhbGxiYWNrKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0LmlzT3B0SW5TdG9yYWdlRW5hYmxlZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpICYmIChhLmlzT3B0SW5TdG9yYWdlRW5hYmxlZCA9IGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gdC5vcHRJbkNvb2tpZURvbWFpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjICYmIChhLm9wdEluQ29va2llRG9tYWluID0gYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSB0Lm9wdEluU3RvcmFnZUV4cGlyeTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHQudGltZVVuaXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1ICYmIG9bdV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gbCAqIG9bdV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLm9wdEluU3RvcmFnZUV4cGlyeSA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgITAgPT09IGkgJiYgKGEub3B0SW5TdG9yYWdlRXhwaXJ5ID0gMzM2OTYwMDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gdC5wcmV2aW91c1Blcm1pc3Npb25zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAgJiYgKGEucHJldmlvdXNQZXJtaXNzaW9ucyA9IHApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gdC5wcmVPcHRJbkFwcHJvdmFsczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5wcmVPcHRJbkFwcHJvdmFscyA9IGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gdC5wcmVPcHRJbkFwcHJvdmFsSW5wdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgJiYgKGEucHJlT3B0SW5BcHByb3ZhbHMgPSBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSB0LmlzSWFiQ29udGV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnICYmIChhLmlzSWFiQ29udGV4dCA9IGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gZS5nZXRJbnN0YW5jZSh0Lm9yZ0lkLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5sb2dnZXIuaW5mbygnQ3JlYXRlZCBpbnN0YW5jZSB1c2luZyBvcmdJZDogIicgKyB0Lm9yZ0lkICsgJyInKSwgbi5sb2dnZXIuaW5mbygnU2V0IHZhcmlhYmxlczogJyArIEpTT04uc3RyaW5naWZ5KGEpKSwgbS5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmxvZ2dlci5pbmZvKCdPYnRhaW5lZCBNYXJrZXRpbmcgQ2xvdWQgVmlzaXRvciBJZDogJyArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKSwgbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAobi5nZXRFeHRlbnNpb25TZXR0aW5ncygpLnBhdGhFeGNsdXNpb25zIHx8IFtdKS5zb21lKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnZhbHVlSXNSZWdleCA/IG5ldyBSZWdFeHAodC52YWx1ZSwgJ2knKS50ZXN0KGUpIDogdC52YWx1ZSA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHUgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc2F0ZWxsaXRlLmdldFZpc2l0b3JJZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBsKHIubG9jYXRpb24ucGF0aG5hbWUpID8gbi5sb2dnZXIud2FybignTUNJRCBsaWJyYXJ5IG5vdCBsb2FkZWQuIE9uZSBvZiB0aGUgcGF0aCBleGNsdXNpb25zIG1hdGNoZXMgdGhlIGN1cnJlbnQgcGF0aC4nKSA6IHUgPSBjKGkpLCBlLmV4cG9ydHMgPSB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ21jaWQtaW5zdGFuY2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNoYXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtbWNpZC9zcmMvbGliL2NvZGVMaWJyYXJ5L1Zpc2l0b3JBUEkuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3IgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiBlLmNvbnN0cnVjdG9yID09PSBTeW1ib2wgJiYgZSAhPT0gU3ltYm9sLnByb3RvdHlwZSA/ICdzeW1ib2wnIDogdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgaW4gZSA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGVbdF0gPSBhLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2tzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNhbGxiYWNrc1tlXSA9IHRoaXMuY2FsbGJhY2tzW2VdIHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5jYWxsYmFja3NbZV0ucHVzaCh0KSAtIDEsIG4gPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uY2FsbGJhY2tzW2VdLnNwbGljZShhLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4ZWN1dGU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuY2FsbGJhY2tzW2VdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAodCA9IHZvaWQgMCA9PT0gdCA/IFtdIDogdCkgaW5zdGFuY2VvZiBBcnJheSA/IHQgOiBbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgdGhpcy5jYWxsYmFja3NbZV0ubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5jYWxsYmFja3NbZV0uc2hpZnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiBhID8gYS5hcHBseShudWxsLCB0KSA6IGEgaW5zdGFuY2VvZiBBcnJheSAmJiBhWzFdLmFwcGx5KGFbMF0sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHRoaXMuY2FsbGJhY2tzW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0ZUFsbDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodCB8fCBlICYmICFDLmlzT2JqZWN0RW1wdHkoZSkpICYmIE9iamVjdC5rZXlzKHRoaXMuY2FsbGJhY2tzKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdm9pZCAwICE9PSBlW3RdID8gZVt0XSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmV4ZWN1dGUodCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzQ2FsbGJhY2tzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJvb2xlYW4oT2JqZWN0LmtleXModGhpcy5jYWxsYmFja3MpLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG51bGwgPT0gZSA/IHZvaWQgMCA6IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IG4gPyBhIDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAvXlxkKyQvLCBhID0gMCwgbiA9IGUubGVuZ3RoOyBhIDwgbjsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0LnRlc3QoZVthXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZS5sZW5ndGggPCB0Lmxlbmd0aDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnB1c2goJzAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHQubGVuZ3RoIDwgZS5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKCcwJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gMDsgYSA8IGUubGVuZ3RoOyBhKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gcGFyc2VJbnQoZVthXSwgMTApLCByID0gcGFyc2VJbnQodFthXSwgMTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPiByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS50b1N0cmluZygpLnNwbGl0KCcuJyksIG4gPSB0LnRvU3RyaW5nKCkuc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoYS5jb25jYXQobikpID8gKGkoYSwgbiksIG8oYSwgbikpIDogTmFOOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IE9iamVjdChlKSAmJiAwID09PSBPYmplY3Qua2V5cyhlKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZSB8fCBlIGluc3RhbmNlb2YgQXJyYXkgJiYgZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiAnJywgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nID0gdWUoJ2xvZycsIGUsIHQpLCB0aGlzLndhcm4gPSB1ZSgnd2FybicsIGUsIHQpLCB0aGlzLmVycm9yID0gdWUoJ2Vycm9yJywgZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gKGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30pLmNvb2tpZU5hbWUsIHQgPSAoYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiB7fSkuY29va2llczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlIHx8ICF0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IEVlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogRWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlOiBFZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnJlbW92ZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQuZ2V0KGUpLCBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IEpTT04ucGFyc2UoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gciB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGEuZ2V0KCksIG8gPSBPYmplY3QuYXNzaWduKGksIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2V0KGUsIEpTT04uc3RyaW5naWZ5KG8pLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbjogci5vcHRJbkNvb2tpZURvbWFpbiB8fCAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llTGlmZXRpbWU6IHIub3B0SW5TdG9yYWdlRXhwaXJ5IHx8IDM0MTkwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBpcmVzOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubmFtZSA9IHRoaXMuY29uc3RydWN0b3IubmFtZSwgdGhpcy5tZXNzYWdlID0gZSwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgRXJyb3IuY2FwdHVyZVN0YWNrVHJhY2UgPyBFcnJvci5jYXB0dXJlU3RhY2tUcmFjZSh0aGlzLCB0aGlzLmNvbnN0cnVjdG9yKSA6IHRoaXMuc3RhY2sgPSBuZXcgRXJyb3IoZSkuc3RhY2s7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBnZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmxlbmd0aCA/IGEuZXZlcnkoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBtZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRCh3KSwgRSh0ZS5DT01QTEVURSksIG0oZy5zdGF0dXMsIGcucGVybWlzc2lvbnMpLCBzICYmIGYuc2V0KGcucGVybWlzc2lvbnMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRJbkNvb2tpZURvbWFpbjogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRJblN0b3JhZ2VFeHBpcnk6IGwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBiLmV4ZWN1dGUoVmUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFiZShhKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdbT3B0SW5dIEludmFsaWQgY2F0ZWdvcnkoLWllcykuIFBsZWFzZSB1c2UgdGhlIGBPcHRJbi5DYXRlZ29yaWVzYCBlbnVtLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFKHRlLkNIQU5HRUQpLCBPYmplY3QuYXNzaWduKHcsIF9lKGdlKGEpLCBlKSksIG4gfHwgdCgpLCBnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30sIHIgPSBuLmRvZXNPcHRJbkFwcGx5LCBpID0gbi5wcmV2aW91c1Blcm1pc3Npb25zLCBvID0gbi5wcmVPcHRJbkFwcHJvdmFscywgcyA9IG4uaXNPcHRJblN0b3JhZ2VFbmFibGVkLCBjID0gbi5vcHRJbkNvb2tpZURvbWFpbiwgbCA9IG4ub3B0SW5TdG9yYWdlRXhwaXJ5LCB1ID0gbi5pc0lhYkNvbnRleHQsIHAgPSAoYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiB7fSkuY29va2llcywgaCA9IERlKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJZShoLCAnSW52YWxpZCBgcHJldmlvdXNQZXJtaXNzaW9uc2AhJyksIEllKG8sICdJbnZhbGlkIGBwcmVPcHRJbkFwcHJvdmFsc2AhJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gZCh7IGNvb2tpZU5hbWU6ICdhZG9iZXVqcy1vcHRpbicgfSwgeyBjb29raWVzOiBwIH0pLCBnID0gdGhpcywgbSA9IGVlKGcpLCBiID0gc2UoKSwgXyA9IGtlKGgpLCB2ID0ga2UobyksIHkgPSBzID8gZi5nZXQoKSA6IHt9LCBrID0ge30sIEEgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShlKSB8fCB0ICYmIEFlKHQpID8gdGUuQ09NUExFVEUgOiB0ZS5QRU5ESU5HOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShfLCB5KSwgUyA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBfZShvZSwgIXIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByID8gT2JqZWN0LmFzc2lnbih7fSwgbiwgZSwgdCwgYSkgOiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh2LCBfLCB5KSwgdyA9IHZlKFMpLCBFID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBEID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLmRlbnkgPSBhKCExKSwgZy5hcHByb3ZlID0gYSghMCksIGcuZGVueUFsbCA9IGcuZGVueS5iaW5kKGcsIG9lKSwgZy5hcHByb3ZlQWxsID0gZy5hcHByb3ZlLmJpbmQoZywgb2UpLCBnLmlzQXBwcm92ZWQgPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodCwgZy5wZXJtaXNzaW9ucyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGcuaXNQcmVBcHByb3ZlZCA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0LCB2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZy5mZXRjaFBlcm1pc3Npb25zID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gJiYgYXJndW1lbnRzWzFdLCBhID0gdCA/IGcub24odGUuQ09NUExFVEUsIGUpIDogRWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXIgfHwgciAmJiBnLmlzQ29tcGxldGUgfHwgbyA/IGUoZy5wZXJtaXNzaW9ucykgOiB0IHx8IGIuYWRkKFZlLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUoZy5wZXJtaXNzaW9ucyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZy5jb21wbGV0ZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcuc3RhdHVzID09PSB0ZS5DSEFOR0VEICYmIHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZy5yZWdpc3RlclBsdWdpbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUgfHwgIWUubmFtZSB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBlLm9uUmVnaXN0ZXIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKExlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtbZS5uYW1lXSB8fCAoa1tlLm5hbWVdID0gZSwgZS5vblJlZ2lzdGVyLmNhbGwoZSwgZykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBnLmV4ZWN1dGUgPSBDZShrKSwgZy5tZW1vaXplQ29udGVudCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ZShlKSAmJiBmLnNldChlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0SW5Db29raWVEb21haW46IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0SW5TdG9yYWdlRXhwaXJ5OiBsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZy5nZXRNZW1vaXplZENvbnRlbnQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBmLmdldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlcm1pc3Npb25zOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENhdGVnb3JpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2VzT3B0SW5BcHBseTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc1BlbmRpbmc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcuc3RhdHVzID09PSB0ZS5QRU5ESU5HOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0NvbXBsZXRlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnLnN0YXR1cyA9PT0gdGUuQ09NUExFVEU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fcGx1Z2luczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoayk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzSWFiQ29udGV4dDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBudWxsLCBlLmNhbGwoZSwgbmV3IHAoJ1RoZSBjYWxsIHRvb2sgbG9uZ2VyIHRoYW4geW91IHdhbnRlZCEnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgKGNsZWFyVGltZW91dChyKSwgZS5hcHBseShlLCBhcmd1bWVudHMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gc2V0VGltZW91dChhLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGcoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuX190Y2ZhcGkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93Ll9fdGNmYXBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHdpbmRvdzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgIT09IHdpbmRvdy50b3ApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQ7ICF0OykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLnBhcmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZyYW1lcy5fX3RjZmFwaUxvY2F0b3IgJiYgKHQgPSBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSB3aW5kb3cudG9wKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93Ll9fdGNmYXBpID0gZnVuY3Rpb24gKGUsIG4sIHIsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBNYXRoLnJhbmRvbSgpICsgJycsIHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX190Y2ZhcGlDYWxsOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1hbmQ6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtZXRlcjogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbElkOiBvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtvXSA9IHIsIHQucG9zdE1lc3NhZ2UocywgJyonKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignbWVzc2FnZScsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5kYXRhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBKU09OLnBhcnNlKGUuZGF0YSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0Ll9fdGNmYXBpUmV0dXJuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuX190Y2ZhcGlSZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiBhW24uY2FsbElkXSAmJiAoYVtuLmNhbGxJZF0obi5yZXR1cm5WYWx1ZSwgbi5zdWNjZXNzKSwgZGVsZXRlIGFbbi5jYWxsSWRdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICExKSwgd2luZG93Ll9fdGNmYXBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGUuZXJyb3IoJ19fdGNmYXBpIG5vdCBmb3VuZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlLmVycm9yKCdfX3RjZmFwaSBub3QgZm91bmQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMl0gPyBhcmd1bWVudHNbMl0gOiBbXSwgbiA9ICEwID09PSBlLnZlbmRvci5jb25zZW50c1t0XSwgciA9IGEuZXZlcnkoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGUucHVycG9zZS5jb25zZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmFtZSA9ICdpYWJQbHVnaW4nLCBlLnZlcnNpb24gPSAnMC4wLjInOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgYSA9IHNlKCksIG4gPSB7IHRyYW5zcGFyZW5jeUFuZENvbnNlbnREYXRhOiBudWxsIH0sIHIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbltlXSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZldGNoQ29uc2VudERhdGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBmKGUuY2FsbGJhY2ssIGUudGltZW91dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKHsgY2FsbGJhY2s6IHQgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuaXNBcHByb3ZlZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuY2FsbGJhY2ssIGEgPSBlLmNhdGVnb3J5LCByID0gZS50aW1lb3V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4udHJhbnNwYXJlbmN5QW5kQ29uc2VudERhdGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQobnVsbCwgbShuLnRyYW5zcGFyZW5jeUFuZENvbnNlbnREYXRhLCBuZVthXSwgcmVbYV0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZihmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoZSwgbShuLCBuZVthXSwgcmVbYV0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZWdvcnk6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLm9uUmVnaXN0ZXIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5rZXlzKG5lKSwgciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFlICYmIHQgJiYgKG4uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBtKHQsIG5lW2VdLCByZVtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhW24gPyAnYXBwcm92ZScgOiAnZGVueSddKGUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGEuY29tcGxldGUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZmV0Y2hDb25zZW50RGF0YSh7IGNhbGxiYWNrOiByIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLmNhbGxiYWNrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLnRyYW5zcGFyZW5jeUFuZENvbnNlbnREYXRhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShudWxsLCBuLnRyYW5zcGFyZW5jeUFuZENvbnNlbnREYXRhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmFkZCgnRkVUQ0hfQ09OU0VOVF9EQVRBJywgaSksIG8oZnVuY3Rpb24gKGUsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdmUoZSksIHMgPSB0LmdldE1lbW9pemVkQ29udGVudCgnaWFiQ29uc2VudEhhc2gnKSwgYyA9IHBlKG8udGNTdHJpbmcpLnRvU3RyaW5nKDMyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uY29uc2VudFN0cmluZyA9IGUudGNTdHJpbmcsIG8uaGFzQ29uc2VudENoYW5nZWRTaW5jZUxhc3RDbXBQdWxsID0gcyAhPT0gYywgcigndHJhbnNwYXJlbmN5QW5kQ29uc2VudERhdGEnLCBvKSwgdC5tZW1vaXplQ29udGVudCh7IGlhYkNvbnNlbnRIYXNoOiBjIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuZXhlY3V0ZSgnRkVUQ0hfQ09OU0VOVF9EQVRBJywgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4udHJhbnNwYXJlbmN5QW5kQ29uc2VudERhdGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFBlKG5lKSwgYSA9IGcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiBhICYmIGEoJ2dldFRDRGF0YScsIDIsIGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIF8gPSAndW5kZWZpbmVkJyAhPSB0eXBlb2YgZ2xvYmFsVGhpcyA/IGdsb2JhbFRoaXMgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygd2luZG93ID8gd2luZG93IDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGdsb2JhbCA/IGdsb2JhbCA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBzZWxmID8gc2VsZiA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5hc3NpZ24gPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQsIGEsIG4gPSAxOyBuIDwgYXJndW1lbnRzLmxlbmd0aDsgKytuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0IGluIGEgPSBhcmd1bWVudHNbbl0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGEsIHQpICYmIChlW3RdID0gYVt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHYsIHksIGsgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNRVNTQUdFUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEhBTkRTSEFLRTogJ0hBTkRTSEFLRScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0VUU1RBVEU6ICdHRVRTVEFURScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUEFSRU5UU1RBVEU6ICdQQVJFTlRTVEFURScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTVEFURV9LRVlTX01BUDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DTUlEOiAnTUNNSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUlEOiAnTUNBSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNQjogJ01DQUFNQicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBQU1MSDogJ01DQUFNTEgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DT1BUT1VUOiAnTUNPUFRPVVQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENVU1RPTUVSSURTOiAnQ1VTVE9NRVJJRFMnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVNZTkNfQVBJX01BUDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DTUlEOiAnZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUlEOiAnZ2V0QW5hbHl0aWNzVmlzaXRvcklEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUI6ICdnZXRBdWRpZW5jZU1hbmFnZXJCbG9iJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUxIOiAnZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ09QVE9VVDogJ2lzT3B0ZWRPdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFMTEZJRUxEUzogJ2dldFZpc2l0b3JWYWx1ZXMnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU1lOQ19BUElfTUFQOiB7IENVU1RPTUVSSURTOiAnZ2V0Q3VzdG9tZXJJRHMnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTExfQVBJUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DTUlEOiAnZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNQjogJ2dldEF1ZGllbmNlTWFuYWdlckJsb2InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNTEg6ICdnZXRBdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DT1BUT1VUOiAnaXNPcHRlZE91dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBSUQ6ICdnZXRBbmFseXRpY3NWaXNpdG9ySUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENVU1RPTUVSSURTOiAnZ2V0Q3VzdG9tZXJJRHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFMTEZJRUxEUzogJ2dldFZpc2l0b3JWYWx1ZXMnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRklFTERHUk9VUF9UT19GSUVMRDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DOiAnTUNNSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEE6ICdNQ0FJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUFNOiAnTUNBQU1CJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZJRUxEUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DTUlEOiAnTUNNSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DT1BUT1VUOiAnTUNPUFRPVVQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUlEOiAnTUNBSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNTEg6ICdNQ0FBTUxIJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUI6ICdNQ0FBTUInCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVUSF9TVEFURTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVOS05PV046IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVUSEVOVElDQVRFRDogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMT0dHRURfT1VUOiAyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT1BUX09VVDogeyBHTE9CQUw6ICdnbG9iYWwnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTQU1FX1NJVEVfVkFMVUVTOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTEFYOiAnTGF4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTVFJJQ1Q6ICdTdHJpY3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5PTkU6ICdOb25lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBBID0gay5TVEFURV9LRVlTX01BUCwgUyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYSh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZSgwLCB0KSwgaSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaVt0XSA9IHIsIG4uc2V0U3RhdGVBbmRQdWJsaXNoKGkpLCBhKHIpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZSB8fCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcy5maW5kRmllbGQoQS5NQ01JRCwgZSksIHIgPSBhLmNhbGwodGhpcywgQS5NQ01JRCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gbiA/IG4gOiByKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLmdldFZpc2l0b3JWYWx1ZXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh7IE1DTUlEOiB0IH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdyA9IGsuTUVTU0FHRVMsIEUgPSBrLkFTWU5DX0FQSV9NQVAsIEQgPSBrLlNZTkNfQVBJX01BUCwgSSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuY2FsbGJhY2tSZWdpc3RyeS5hZGQoZSwgdCksIGEubWVzc2FnZVBhcmVudCh3LkdFVFNUQVRFKSwgJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbRVthXV0gPSBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbiB8fCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMuZmluZEZpZWxkKGEsIG4pLCBpID0gdC5jYWxsKHRoaXMsIGEsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSByID8gciA6IGkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbih0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1tEW3RdXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmluZEZpZWxkKHQsIGUpIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhFKS5mb3JFYWNoKGEsIHRoaXMpLCBPYmplY3Qua2V5cyhEKS5mb3JFYWNoKG4sIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBUID0gay5BU1lOQ19BUElfTUFQLCBQID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoVCkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbVFtlXV0gPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNhbGxiYWNrUmVnaXN0cnkuYWRkKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgQyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0ID0geyBleHBvcnRzOiB7fSB9LCB0LmV4cG9ydHMpLCB0LmV4cG9ydHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZnVuY3Rpb24gKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuaXNPYmplY3RFbXB0eSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IE9iamVjdChlKSAmJiAwID09PSBPYmplY3Qua2V5cyhlKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhLmlzVmFsdWVFbXB0eSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnID09PSBlIHx8IGEuaXNPYmplY3RFbXB0eShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5hdmlnYXRvci5hcHBOYW1lLCB0ID0gbmF2aWdhdG9yLnVzZXJBZ2VudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ01pY3Jvc29mdCBJbnRlcm5ldCBFeHBsb3JlcicgPT09IGUgfHwgdC5pbmRleE9mKCdNU0lFICcpID49IDAgfHwgdC5pbmRleE9mKCdUcmlkZW50LycpID49IDAgJiYgdC5pbmRleE9mKCdXaW5kb3dzIE5UIDYnKSA+PSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuZ2V0SWVWZXJzaW9uID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkb2N1bWVudC5kb2N1bWVudE1vZGUgPyBkb2N1bWVudC5kb2N1bWVudE1vZGUgOiBuKCkgPyA3IDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEuZW5jb2RlQW5kQnVpbGRSZXF1ZXN0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5tYXAoZW5jb2RlVVJJQ29tcG9uZW50KS5qb2luKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYS5pc09iamVjdCA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IHQgJiYgJ29iamVjdCcgPT09IGUodCkgJiYgITEgPT09IEFycmF5LmlzQXJyYXkodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhLmRlZmluZUdsb2JhbE5hbWVzcGFjZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LmFkb2JlID0gYS5pc09iamVjdCh3aW5kb3cuYWRvYmUpID8gd2luZG93LmFkb2JlIDoge30sIHdpbmRvdy5hZG9iZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEucGx1Y2sgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnJlZHVjZShmdW5jdGlvbiAodCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVthXSAmJiAodFthXSA9IGVbYV0pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5jcmVhdGUobnVsbCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYS5wYXJzZU9wdE91dCA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCB8fCAodCA9IGEsIGUuZF9vcHRvdXQgJiYgZS5kX29wdG91dCBpbnN0YW5jZW9mIEFycmF5ICYmICh0ID0gZS5kX29wdG91dC5qb2luKCcsJykpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHBhcnNlSW50KGUuZF9vdHRsLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlzTmFOKG4pICYmIChuID0gNzIwMCksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0T3V0OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkX290dGw6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYS5ub3JtYWxpemVCb29sZWFuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0cnVlJyA9PT0gZSA/IHQgPSAhMCA6ICdmYWxzZScgPT09IGUgJiYgKHQgPSAhMSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgViA9IChDLmlzT2JqZWN0RW1wdHksIEMuaXNWYWx1ZUVtcHR5LCBDLmdldEllVmVyc2lvbiwgQy5lbmNvZGVBbmRCdWlsZFJlcXVlc3QsIEMuaXNPYmplY3QsIEMuZGVmaW5lR2xvYmFsTmFtZXNwYWNlLCBDLnBsdWNrLCBDLnBhcnNlT3B0T3V0LCBDLm5vcm1hbGl6ZUJvb2xlYW4sIGEpLCBMID0gay5NRVNTQUdFUywgTiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDA6ICdwcmVmaXgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTogJ29yZ0lEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI6ICdzdGF0ZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgTyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnBhcnNlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5kYXRhLnNwbGl0KCd8JykuZm9yRWFjaChmdW5jdGlvbiAoZSwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBlICYmICh0W05bYV1dID0gMiAhPT0gYSA/IGUgOiBKU09OLnBhcnNlKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuaXNJbnZhbGlkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMucGFyc2UoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFuIHx8IE9iamVjdC5rZXlzKG4pLmxlbmd0aCA8IDIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUgIT09IG4ub3JnSUQsIGkgPSAhdCB8fCBhLm9yaWdpbiAhPT0gdCwgbyA9IC0xID09PSBPYmplY3Qua2V5cyhMKS5pbmRleE9mKG4ucHJlZml4KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciB8fCBpIHx8IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLnNlbmQgPSBmdW5jdGlvbiAoYSwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbiArICd8JyArIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciAmJiByID09PSBPYmplY3QocikgJiYgKGkgKz0gJ3wnICsgSlNPTi5zdHJpbmdpZnkocikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucG9zdE1lc3NhZ2UoaSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE0gPSBrLk1FU1NBR0VTLCBSID0gZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5hc3NpZ24oaCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuYXNzaWduKGguc3RhdGUsIGUpLCBPYmplY3QuYXNzaWduKGguc3RhdGUuQUxMRklFTERTLCBlKSwgaC5jYWxsYmFja1JlZ2lzdHJ5LmV4ZWN1dGVBbGwoaC5zdGF0ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW0uaXNJbnZhbGlkKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBtLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLnNldFN0YXRlQW5kUHVibGlzaCh0LnN0YXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZyAmJiBmICYmIChnID0gITAsIG0uc2VuZChuLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIobmV3IFMoYS5fZ2VuZXJhdGVJRCkpLCBoLmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEKCksIGguY2FsbGJhY2tSZWdpc3RyeS5leGVjdXRlQWxsKGguc3RhdGUsICEwKSwgXy5yZW1vdmVFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW0uaXNJbnZhbGlkKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbS5wYXJzZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9ICExLCBfLmNsZWFyVGltZW91dChoLl9oYW5kc2hha2VUaW1lb3V0KSwgXy5yZW1vdmVFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgbCksIHIobmV3IEkoaCkpLCBfLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBvKSwgaC5zZXRTdGF0ZUFuZFB1Ymxpc2godC5zdGF0ZSksIGguY2FsbGJhY2tSZWdpc3RyeS5oYXNDYWxsYmFja3MoKSAmJiBzKE0uR0VUU1RBVEUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiAmJiBwb3N0TWVzc2FnZSA/IChfLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBsKSwgcyhNLkhBTkRTSEFLRSksIGguX2hhbmRzaGFrZVRpbWVvdXQgPSBzZXRUaW1lb3V0KGMsIDI1MCkpIDogYygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfLnNfY19pbiB8fCAoXy5zX2NfaWwgPSBbXSwgXy5zX2NfaW4gPSAwKSwgaC5fYyA9ICdWaXNpdG9yJywgaC5faWwgPSBfLnNfY19pbCwgaC5faW4gPSBfLnNfY19pbiwgaC5faWxbaC5faW5dID0gaCwgXy5zX2NfaW4rKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgIT09IGUuaW5kZXhPZignXycpICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGFbZV0gJiYgKGhbZV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhhKS5mb3JFYWNoKGUpLCBoLmdldFN1cHBsZW1lbnRhbERhdGFJRCA9IGEuZ2V0U3VwcGxlbWVudGFsRGF0YUlELCBoLmlzQWxsb3dlZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IHRoaXMsIGYgPSB0LndoaXRlbGlzdFBhcmVudERvbWFpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGguc3RhdGUgPSB7IEFMTEZJRUxEUzoge30gfSwgaC52ZXJzaW9uID0gYS52ZXJzaW9uLCBoLm1hcmtldGluZ0Nsb3VkT3JnSUQgPSBlLCBoLmNvb2tpZURvbWFpbiA9IGEuY29va2llRG9tYWluIHx8ICcnLCBoLl9pbnN0YW5jZVR5cGUgPSAnY2hpbGQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSAhMSwgbSA9IG5ldyBPKGUsIGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5jYWxsYmFja1JlZ2lzdHJ5ID0gVigpLCBoLmluaXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCgpLCBwKCksIHIobmV3IFAoaCkpLCB1KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBoLmZpbmRGaWVsZCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gaC5zdGF0ZVtlXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQoaC5zdGF0ZVtlXSksIGguc3RhdGVbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBoLm1lc3NhZ2VQYXJlbnQgPSBzLCBoLnNldFN0YXRlQW5kUHVibGlzaCA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGogPSBrLk1FU1NBR0VTLCB4ID0gay5BTExfQVBJUywgQiA9IGsuQVNZTkNfQVBJX01BUCwgRiA9IGsuRklFTERHUk9VUF9UT19GSUVMRCwgSCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKHgpLmZvckVhY2goZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB4W2FdLCByID0gZVtuXSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDLmlzVmFsdWVFbXB0eShyKSB8fCAodFthXSA9IHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLl9sb2FkaW5nICYmIE9iamVjdC5rZXlzKGUuX2xvYWRpbmcpLmZvckVhY2goZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuX2xvYWRpbmdbYV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gRlthXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0Lmxlbmd0aCA/IHQgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcih0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIGEoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBCW3JbMF1dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtpXShhLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNlbmQoZSwgbiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjKGUpLCBpKGUsIGouSEFORFNIQUtFKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKGUsIGouUEFSRU5UU1RBVEUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5jYWxsKGUsIG4pLCB0LnNlbmQoYSwgai5QQVJFTlRTVEFURSwgeyBDVVNUT01FUklEUzogZS5nZXRDdXN0b21lcklEcygpIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuc2V0Q3VzdG9tZXJJRHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zZXRDdXN0b21lcklEcyA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmlzSW52YWxpZChlKSB8fCAodC5wYXJzZShlKS5wcmVmaXggPT09IGouSEFORFNIQUtFID8gbyA6IHMpKGUuc291cmNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHEgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bZV0gPSBhLCArK3IgPT09IGkgJiYgdChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fSwgciA9IDAsIGkgPSBPYmplY3Qua2V5cyhlKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmZuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbi5hcmdzIHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnVuc2hpZnQoYSh0KSksIG4uZm4uYXBwbHkobi5jb250ZXh0IHx8IG51bGwsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBVID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlbmNvZGVVUklDb21wb25lbnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAoJzsnICsgZG9jdW1lbnQuY29va2llKS5zcGxpdCgnICcpLmpvaW4oJzsnKSwgYSA9IHQuaW5kZXhPZignOycgKyBlICsgJz0nKSwgbiA9IGEgPCAwID8gYSA6IHQuaW5kZXhPZignOycsIGEgKyAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA8IDAgPyAnJyA6IGRlY29kZVVSSUNvbXBvbmVudCh0LnN1YnN0cmluZyhhICsgMiArIGUubGVuZ3RoLCBuIDwgMCA/IHQubGVuZ3RoIDogbikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oYSwgJ2Nvb2tpZUxpZmV0aW1lJyksIGkgPSBuKGEsICdleHBpcmVzJyksIG8gPSBuKGEsICdkb21haW4nKSwgcyA9IG4oYSwgJ3NlY3VyZScpLCBjID0gbihhLCAnc2FtZVNpdGUnKSwgbCA9IHMgPyAnU2VjdXJlJyA6ICcnLCB1ID0gYyA/ICdTYW1lU2l0ZT0nICsgYyArICc7JyA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpICYmICdTRVNTSU9OJyAhPT0gciAmJiAnTk9ORScgIT09IHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSAnJyAhPT0gdCA/IHBhcnNlSW50KHIgfHwgMCwgMTApIDogLTYwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpID0gbmV3IERhdGUoKSkuc2V0VGltZShpLmdldFRpbWUoKSArIDEwMDAgKiBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoMSA9PT0gaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSAoaSA9IG5ldyBEYXRlKCkpLmdldFllYXIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuc2V0WWVhcihwICsgMiArIChwIDwgMTkwMCA/IDE5MDAgOiAwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ05PTkUnICE9PSByID8gKGRvY3VtZW50LmNvb2tpZSA9IGVuY29kZVVSSUNvbXBvbmVudChlKSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh0KSArICc7IHBhdGg9LzsnICsgKGkgPyAnIGV4cGlyZXM9JyArIGkudG9HTVRTdHJpbmcoKSArICc7JyA6ICcnKSArIChvID8gJyBkb21haW49JyArIG8gKyAnOycgOiAnJykgKyB1ICsgbCwgdGhpcy5nZXQoZSkgPT09IHQpIDogMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuKHQsICdkb21haW4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gYSA/ICcgZG9tYWluPScgKyBhICsgJzsnIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuKHQsICdzZWN1cmUnKSwgaSA9IG4odCwgJ3NhbWVTaXRlJyksIG8gPSByID8gJ1NlY3VyZScgOiAnJywgcyA9IGkgPyAnU2FtZVNpdGU9JyArIGkgKyAnOycgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5jb29raWUgPSBlbmNvZGVVUklDb21wb25lbnQoZSkgKyAnPTsgUGF0aD0vOyBFeHBpcmVzPVRodSwgMDEgSmFuIDE5NzAgMDA6MDA6MDEgR01UOycgKyBhICsgcyArIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHogPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWUgJiYgXy5sb2NhdGlvbiAmJiAoZSA9IF8ubG9jYXRpb24uaG9zdG5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEsIG4gPSBlLnNwbGl0KCcuJyksIHIgPSB0IHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChhID0gbi5sZW5ndGggLSAyOyBhID49IDA7IGEtLSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5kb21haW4gPSBuLnNsaWNlKGEpLmpvaW4oJy4nKSwgVS5zZXQoJ3Rlc3QnLCAnY29va2llJywgcikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVLnJlbW92ZSgndGVzdCcsIHIpLCByLmRvbWFpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgWSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBhcmU6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0xlc3NUaGFuOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzKGUsIHQpIDwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmVWZXJzaW9uc0RpZmZlcmVudDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCAhPT0gcyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0dyZWF0ZXJUaGFuOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzKGUsIHQpID4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0VxdWFsOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwID09PSBzKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBLID0gISFfLnBvc3RNZXNzYWdlLCBRID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zdE1lc3NhZ2U6IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgKEsgPyBhLnBvc3RNZXNzYWdlKGUsIHQucmVwbGFjZSgvKFteOl0rOlwvXC9bXlwvXSspLiovLCAnJDEnKSkgOiB0ICYmIChhLmxvY2F0aW9uID0gdC5yZXBsYWNlKC8jLiokLywgJycpICsgJyMnICsgK25ldyBEYXRlKCkgKyBuKysgKyAnJicgKyBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZU1lc3NhZ2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSyAmJiAoZSAmJiAoYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIHQgJiYgYS5vcmlnaW4gIT09IHQgfHwgJ1tvYmplY3QgRnVuY3Rpb25dJyA9PT0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKHQpICYmICExID09PSB0KGEub3JpZ2luKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgXy5hZGRFdmVudExpc3RlbmVyID8gX1tlID8gJ2FkZEV2ZW50TGlzdGVuZXInIDogJ3JlbW92ZUV2ZW50TGlzdGVuZXInXSgnbWVzc2FnZScsIGEpIDogX1tlID8gJ2F0dGFjaEV2ZW50JyA6ICdkZXRhY2hFdmVudCddKCdvbm1lc3NhZ2UnLCBhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgYSwgbiA9ICcwMTIzNDU2Nzg5JywgciA9ICcnLCBpID0gJycsIG8gPSA4LCBzID0gMTAsIGMgPSAxMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxID09IGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gKz0gJ0FCQ0RFRicsIHQgPSAwOyAxNiA+IHQ7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIG8pLCByICs9IG4uc3Vic3RyaW5nKGEsIGEgKyAxKSwgYSA9IE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIG8pLCBpICs9IG4uc3Vic3RyaW5nKGEsIGEgKyAxKSwgbyA9IDE2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByICsgJy0nICsgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCA9IDA7IDE5ID4gdDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBzKSwgciArPSBuLnN1YnN0cmluZyhhLCBhICsgMSksIDAgPT09IHQgJiYgOSA9PSBhID8gcyA9IDMgOiAoKDEgPT0gdCB8fCAyID09IHQpICYmIDEwICE9IHMgJiYgMiA+IGEgfHwgMiA8IHQpICYmIChzID0gMTApLCBhID0gTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogYyksIGkgKz0gbi5zdWJzdHJpbmcoYSwgYSArIDEpLCAwID09PSB0ICYmIDkgPT0gYSA/IGMgPSAzIDogKCgxID09IHQgfHwgMiA9PSB0KSAmJiAxMCAhPSBjICYmIDIgPiBhIHx8IDIgPCB0KSAmJiAoYyA9IDEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByICsgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgVyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnNNZXRhZGF0YTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkXzYxOGJjMGIwMGRkZjZjYzIgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKSwgJF9fX29sZF8zODlhOGJlNTljOTY2NWY3ID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF82MThiYzBiMDBkZGY2Y2MyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzQ0OGI5NWE0N2RkNDlmMGEuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzM4OWE4YmU1OWM5NjY1ZjcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfNDQ4Yjk1YTQ3ZGQ0OWYwYS5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9ICdub25lJywgdCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgWE1MSHR0cFJlcXVlc3QgJiYgWE1MSHR0cFJlcXVlc3QgPT09IE9iamVjdChYTUxIdHRwUmVxdWVzdCkgJiYgKCd3aXRoQ3JlZGVudGlhbHMnIGluIG5ldyBYTUxIdHRwUmVxdWVzdCgpID8gZSA9ICdYTUxIdHRwUmVxdWVzdCcgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgWERvbWFpblJlcXVlc3QgJiYgWERvbWFpblJlcXVlc3QgPT09IE9iamVjdChYRG9tYWluUmVxdWVzdCkgJiYgKHQgPSAhMSksIE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChfLkhUTUxFbGVtZW50KS5pbmRleE9mKCdDb25zdHJ1Y3RvcicpID4gMCAmJiAodCA9ICExKSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yc1R5cGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnNDb29raWVzRW5hYmxlZDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF82MThiYzBiMDBkZGY2Y2MyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfNjE4YmMwYjAwZGRmNmNjMikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMzg5YThiZTU5Yzk2NjVmNykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzM4OWE4YmU1OWM5NjY1ZjcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDT1JTSW5zdGFuY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF9kMTk0ZTRkYjUwNDlkMjY2ID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JyksICRfX19vbGRfNGI4YjgwYTg5MDAzOTc4NCA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfZDE5NGU0ZGI1MDQ5ZDI2NikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja180NDhiOTVhNDdkZDQ5ZjBhLlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF80YjhiODBhODkwMDM5Nzg0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzQ0OGI5NWE0N2RkNDlmMGEuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdub25lJyA9PT0gdGhpcy5jb3JzTWV0YWRhdGEuY29yc1R5cGUgPyBudWxsIDogbmV3IF9bdGhpcy5jb3JzTWV0YWRhdGEuY29yc1R5cGVdKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9kMTk0ZTRkYjUwNDlkMjY2KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfZDE5NGU0ZGI1MDQ5ZDI2NikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfNGI4YjgwYTg5MDAzOTc4NCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzRiOGI4MGE4OTAwMzk3ODQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyZUNPUlM6IGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoYSA9IEpTT04ucGFyc2UoZSkpICE9PSBPYmplY3QoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIHIuaGFuZGxlQ09SU0Vycm9yKHQsIG51bGwsICdSZXNwb25zZSBpcyBub3QgSlNPTicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIHIuaGFuZGxlQ09SU0Vycm9yKHQsIGUsICdFcnJvciBwYXJzaW5nIHJlc3BvbnNlIGFzIEpTT04nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IHQuY2FsbGJhY2ssIGkgPSBfLCBvID0gMDsgbyA8IG4ubGVuZ3RoOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBpW25bb11dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5oYW5kbGVDT1JTRXJyb3IodCwgZSwgJ0Vycm9yIGZvcm1pbmcgY2FsbGJhY2sgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgJiYgKHQubG9hZEVycm9ySGFuZGxlciA9IGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0aGlzLmdldENPUlNJbnN0YW5jZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5vcGVuKCdnZXQnLCB0LmNvcnNVcmwgKyAnJnRzPScgKyBuZXcgRGF0ZSgpLmdldFRpbWUoKSwgITApLCAnWE1MSHR0cFJlcXVlc3QnID09PSB0aGlzLmNvcnNNZXRhZGF0YS5jb3JzVHlwZSAmJiAoaS53aXRoQ3JlZGVudGlhbHMgPSAhMCwgaS50aW1lb3V0ID0gZS5sb2FkVGltZW91dCwgaS5zZXRSZXF1ZXN0SGVhZGVyKCdDb250ZW50LVR5cGUnLCAnYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkJyksIGkub25yZWFkeXN0YXRlY2hhbmdlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQgPT09IHRoaXMucmVhZHlTdGF0ZSAmJiAyMDAgPT09IHRoaXMuc3RhdHVzICYmIG4odGhpcy5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkub25lcnJvciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5oYW5kbGVDT1JTRXJyb3IodCwgZSwgJ29uZXJyb3InKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkub250aW1lb3V0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmhhbmRsZUNPUlNFcnJvcih0LCBlLCAnb250aW1lb3V0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpLnNlbmQoKSwgZS5fbG9nLnJlcXVlc3RzLnB1c2godC5jb3JzVXJsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5oYW5kbGVDT1JTRXJyb3IodCwgZSwgJ3RyeS1jYXRjaCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVDT1JTRXJyb3I6IGZ1bmN0aW9uICh0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuQ09SU0Vycm9ycy5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnNEYXRhOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5sb2FkRXJyb3JIYW5kbGVyICYmICgnb250aW1lb3V0JyA9PT0gbiA/IHQubG9hZEVycm9ySGFuZGxlcighMCkgOiB0LmxvYWRFcnJvckhhbmRsZXIoITEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAkID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUE9TVF9NRVNTQUdFX0VOQUJMRUQ6ICEhXy5wb3N0TWVzc2FnZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERBWVNfQkVUV0VFTl9TWU5DX0lEX0NBTExTOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUlMTElTX1BFUl9EQVk6IDg2NDAwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQURPQkVfTUM6ICdhZG9iZV9tYycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBRE9CRV9NQ19TRElEOiAnYWRvYmVfbWNfc2RpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWQUxJRF9WSVNJVE9SX0lEX1JFR0VYOiAvXlswLTlhLWZBLUZcLV0rJC8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBRE9CRV9NQ19UVExfSU5fTUlOOiA1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVkVSU0lPTl9SRUdFWDogL3ZWZXJzaW9uXHwoKFxkK1wuKT8oXGQrXC4pPyhcKnxcZCspKSg/PSR8XHwpLywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZJUlNUX1BBUlRZX1NFUlZFUl9DT09LSUU6ICdzX2VjaWQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEogPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBfLmRvY3VtZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUSFJPVFRMRV9TVEFSVDogMzAwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUFYX1NZTkNTX0xFTkdUSDogNjQ5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm90dGxlVGltZXJTZXQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uUGFnZVBpeGVsczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyYW1lSG9zdDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRJZnJhbWVIb3N0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5zcGxpdCgnLycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbMF0gKyAnLy8nICsgdFsyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3ViZG9tYWluOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRVcmw6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSAnaHR0cDovL2Zhc3QuJywgciA9ICc/ZF9uc2lkPScgKyBlLmlkU3luY0NvbnRhaW5lcklEICsgJyMnICsgZW5jb2RlVVJJQ29tcG9uZW50KGEubG9jYXRpb24ub3JpZ2luKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3ViZG9tYWluIHx8ICh0aGlzLnN1YmRvbWFpbiA9ICdub3N1YmRvbWFpbnJldHVybmVkJyksIGUubG9hZFNTTCAmJiAobiA9IGUuaWRTeW5jU1NMVXNlQWthbWFpID8gJ2h0dHBzOi8vZmFzdC4nIDogJ2h0dHBzOi8vJyksIHQgPSBuICsgdGhpcy5zdWJkb21haW4gKyAnLmRlbWRleC5uZXQvZGVzdDUuaHRtbCcgKyByLCB0aGlzLmlmcmFtZUhvc3QgPSB0aGlzLmdldElmcmFtZUhvc3QodCksIHRoaXMuaWQgPSAnZGVzdGluYXRpb25fcHVibGlzaGluZ19pZnJhbWVfJyArIHRoaXMuc3ViZG9tYWluICsgJ18nICsgZS5pZFN5bmNDb250YWluZXJJRCwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoZWNrRFBJZnJhbWVTcmM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAnP2RfbnNpZD0nICsgZS5pZFN5bmNDb250YWluZXJJRCArICcjJyArIGVuY29kZVVSSUNvbXBvbmVudChhLmxvY2F0aW9uLmhyZWYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PSB0eXBlb2YgZS5kcElmcmFtZVNyYyAmJiBlLmRwSWZyYW1lU3JjLmxlbmd0aCAmJiAodGhpcy5pZCA9ICdkZXN0aW5hdGlvbl9wdWJsaXNoaW5nX2lmcmFtZV8nICsgKGUuX3N1YmRvbWFpbiB8fCB0aGlzLnN1YmRvbWFpbiB8fCBuZXcgRGF0ZSgpLmdldFRpbWUoKSkgKyAnXycgKyBlLmlkU3luY0NvbnRhaW5lcklELCB0aGlzLmlmcmFtZUhvc3QgPSB0aGlzLmdldElmcmFtZUhvc3QoZS5kcElmcmFtZVNyYyksIHRoaXMudXJsID0gZS5kcElmcmFtZVNyYyArIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWRDYWxsTm90UHJvY2Vzc3NlZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb0F0dGFjaElmcmFtZTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRlZEF0dGFjaGluZ0lmcmFtZTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyYW1lSGFzTG9hZGVkOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmcmFtZUlkQ2hhbmdlZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdJZnJhbWVDcmVhdGVkOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yaWdpbmFsSWZyYW1lSGFzTG9hZGVkQWxyZWFkeTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZnJhbWVMb2FkZWRDYWxsYmFja3M6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lvbkNoYW5nZWQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVzUmVnaW9uQ2hhbmdlZDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kaW5nTWVzc2FnZXM6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2VzOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlc1Bvc3RlZDogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZXNSZWNlaXZlZDogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZVNlbmRpbmdJbnRlcnZhbDogJC5QT1NUX01FU1NBR0VfRU5BQkxFRCA/IG51bGwgOiAxMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25QYWdlRGVzdGluYXRpb25zRmlyZWQ6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb25Gb3JDb21wYXJpc29uOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uRHVwbGljYXRlczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbldhaXRpbmc6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb25Qcm9jZXNzZWQ6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhblNldFRoaXJkUGFydHlDb29raWVzOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWNlaXZlZFRoaXJkUGFydHlDb29raWVzTm90aWZpY2F0aW9uOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkeVRvQXR0YWNoSWZyYW1lUHJlbGltaW5hcnk6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoZS5pZFN5bmNEaXNhYmxlU3luY3MgfHwgZS5kaXNhYmxlSWRTeW5jcyB8fCBlLmlkU3luY0Rpc2FibGUzcmRQYXJ0eVN5bmNpbmcgfHwgZS5kaXNhYmxlVGhpcmRQYXJ0eUNvb2tpZXMgfHwgZS5kaXNhYmxlVGhpcmRQYXJ0eUNhbGxzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYWR5VG9BdHRhY2hJZnJhbWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucmVhZHlUb0F0dGFjaElmcmFtZVByZWxpbWluYXJ5KCkgJiYgKHRoaXMuZG9BdHRhY2hJZnJhbWUgfHwgZS5fZG9BdHRhY2hJZnJhbWUpICYmICh0aGlzLnN1YmRvbWFpbiAmJiAnbm9zdWJkb21haW5yZXR1cm5lZCcgIT09IHRoaXMuc3ViZG9tYWluIHx8IGUuX3N1YmRvbWFpbikgJiYgdGhpcy51cmwgJiYgIXRoaXMuc3RhcnRlZEF0dGFjaGluZ0lmcmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0dGFjaElmcmFtZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHIgPSBhLmNyZWF0ZUVsZW1lbnQoJ2lmcmFtZScpKS5zYW5kYm94ID0gJ2FsbG93LXNjcmlwdHMgYWxsb3ctc2FtZS1vcmlnaW4nLCByLnRpdGxlID0gJ0Fkb2JlIElEIFN5bmNpbmcgaUZyYW1lJywgci5pZCA9IG4uaWQsIHIubmFtZSA9IG4uaWQgKyAnX25hbWUnLCByLnN0eWxlLmNzc1RleHQgPSAnZGlzcGxheTogbm9uZTsgd2lkdGg6IDA7IGhlaWdodDogMDsnLCByLnNyYyA9IG4udXJsLCBuLm5ld0lmcmFtZUNyZWF0ZWQgPSAhMCwgdCgpLCBhLmJvZHkuYXBwZW5kQ2hpbGQocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmFkZEV2ZW50TGlzdGVuZXIoJ2xvYWQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5jbGFzc05hbWUgPSAnYWFtSWZyYW1lTG9hZGVkJywgbi5pZnJhbWVIYXNMb2FkZWQgPSAhMCwgbi5maXJlSWZyYW1lTG9hZGVkQ2FsbGJhY2tzKGUpLCBuLnJlcXVlc3RUb1Byb2Nlc3MoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhcnRlZEF0dGFjaGluZ0lmcmFtZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMsIHIgPSBhLmdldEVsZW1lbnRCeUlkKHRoaXMuaWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID8gJ0lGUkFNRScgIT09IHIubm9kZU5hbWUgPyAodGhpcy5pZCArPSAnXzInLCB0aGlzLmlmcmFtZUlkQ2hhbmdlZCA9ICEwLCBlKCkpIDogKHRoaXMubmV3SWZyYW1lQ3JlYXRlZCA9ICExLCAnYWFtSWZyYW1lTG9hZGVkJyAhPT0gci5jbGFzc05hbWUgPyAodGhpcy5vcmlnaW5hbElmcmFtZUhhc0xvYWRlZEFscmVhZHkgPSAhMSwgdCgnVGhlIGRlc3RpbmF0aW9uIHB1Ymxpc2hpbmcgaWZyYW1lIGFscmVhZHkgZXhpc3RzIGZyb20gYSBkaWZmZXJlbnQgbGlicmFyeSwgYnV0IGhhZG5cJ3QgbG9hZGVkIHlldC4nKSkgOiAodGhpcy5vcmlnaW5hbElmcmFtZUhhc0xvYWRlZEFscmVhZHkgPSAhMCwgdGhpcy5pZnJhbWVIYXNMb2FkZWQgPSAhMCwgdGhpcy5pZnJhbWUgPSByLCB0aGlzLmZpcmVJZnJhbWVMb2FkZWRDYWxsYmFja3MoJ1RoZSBkZXN0aW5hdGlvbiBwdWJsaXNoaW5nIGlmcmFtZSBhbHJlYWR5IGV4aXN0cyBmcm9tIGEgZGlmZmVyZW50IGxpYnJhcnksIGFuZCBoYWQgbG9hZGVkIGFscmVzYWR5LicpLCB0aGlzLnJlcXVlc3RUb1Byb2Nlc3MoKSkpIDogZSgpLCB0aGlzLmlmcmFtZSA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJlSWZyYW1lTG9hZGVkQ2FsbGJhY2tzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmlmcmFtZUxvYWRlZENhbGxiYWNrcy5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiB0ICYmIHQoeyBtZXNzYWdlOiBlIHx8ICdUaGUgZGVzdGluYXRpb24gcHVibGlzaGluZyBpZnJhbWUgd2FzIGF0dGFjaGVkIGFuZCBsb2FkZWQgc3VjY2Vzc2Z1bGx5LicgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzLmlmcmFtZUxvYWRlZENhbGxiYWNrcyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdFRvUHJvY2VzczogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuanNvbkZvckNvbXBhcmlzb24ucHVzaCh0KSwgci5qc29uV2FpdGluZy5wdXNoKHQpLCByLnByb2Nlc3NTeW5jT25QYWdlKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPT09IE9iamVjdCh0KSAmJiB0LmlicykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID0gSlNPTi5zdHJpbmdpZnkodC5pYnMgfHwgW10pLCB0aGlzLmpzb25Gb3JDb21wYXJpc29uLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpLCBvLCBzLCBjID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMCwgbyA9IHRoaXMuanNvbkZvckNvbXBhcmlzb24ubGVuZ3RoOyBpIDwgbzsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocyA9IHRoaXMuanNvbkZvckNvbXBhcmlzb25baV0sIG4gPT09IEpTT04uc3RyaW5naWZ5KHMuaWJzIHx8IFtdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID8gdGhpcy5qc29uRHVwbGljYXRlcy5wdXNoKHQpIDogYSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHRoaXMucmVjZWl2ZWRUaGlyZFBhcnR5Q29va2llc05vdGlmaWNhdGlvbiB8fCAhJC5QT1NUX01FU1NBR0VfRU5BQkxFRCB8fCB0aGlzLmlmcmFtZUhhc0xvYWRlZCkgJiYgdGhpcy5qc29uV2FpdGluZy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gdGhpcy5qc29uV2FpdGluZy5zaGlmdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzKGwpLCB0aGlzLnJlcXVlc3RUb1Byb2Nlc3MoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmlkU3luY0Rpc2FibGVTeW5jcyB8fCBlLmRpc2FibGVJZFN5bmNzIHx8ICF0aGlzLmlmcmFtZUhhc0xvYWRlZCB8fCAhdGhpcy5tZXNzYWdlcy5sZW5ndGggfHwgdGhpcy5zZW5kaW5nTWVzc2FnZXMgfHwgKHRoaXMudGhyb3R0bGVUaW1lclNldCB8fCAodGhpcy50aHJvdHRsZVRpbWVyU2V0ID0gITAsIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5tZXNzYWdlU2VuZGluZ0ludGVydmFsID0gJC5QT1NUX01FU1NBR0VfRU5BQkxFRCA/IG51bGwgOiAxNTA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuVEhST1RUTEVfU1RBUlQpKSwgdGhpcy5zZW5kaW5nTWVzc2FnZXMgPSAhMCwgdGhpcy5zZW5kTWVzc2FnZXMoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRSZWdpb25BbmRDaGVja0lmQ2hhbmdlZDogZnVuY3Rpb24gKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLl9nZXRGaWVsZCgnTUNBQU1MSCcpLCByID0gdC5kX3JlZ2lvbiB8fCB0LmRjc19yZWdpb247CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID8gciAmJiAoZS5fc2V0RmllbGRFeHBpcmUoJ01DQUFNTEgnLCBhKSwgZS5fc2V0RmllbGQoJ01DQUFNTEgnLCByKSwgcGFyc2VJbnQobiwgMTApICE9PSByICYmICh0aGlzLnJlZ2lvbkNoYW5nZWQgPSAhMCwgdGhpcy50aW1lc1JlZ2lvbkNoYW5nZWQrKywgZS5fc2V0RmllbGQoJ01DU1lOQ1NPUCcsICcnKSwgZS5fc2V0RmllbGQoJ01DU1lOQ1MnLCAnJyksIG4gPSByKSkgOiAobiA9IHIpICYmIChlLl9zZXRGaWVsZEV4cGlyZSgnTUNBQU1MSCcsIGEpLCBlLl9zZXRGaWVsZCgnTUNBQU1MSCcsIG4pKSwgbiB8fCAobiA9ICcnKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2Nlc3NTeW5jT25QYWdlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgYSwgbiwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0ID0gZS5pYnMpICYmIHQgaW5zdGFuY2VvZiBBcnJheSAmJiAoYSA9IHQubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPCBhOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHIgPSB0W25dKS5zeW5jT25QYWdlICYmIHRoaXMuY2hlY2tGaXJzdFBhcnR5Q29va2llKHIsICcnLCAnc3luY09uUGFnZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2VzczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIGEsIG4sIHIsIGksIG8gPSBlbmNvZGVVUklDb21wb25lbnQsIHMgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0ID0gZS5pYnMpICYmIHQgaW5zdGFuY2VvZiBBcnJheSAmJiAoYSA9IHQubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocyA9ICEwLCBuID0gMDsgbiA8IGE7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gdFtuXSwgaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbygnaWJzJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8oci5pZCB8fCAnJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8oci50YWcgfHwgJycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDLmVuY29kZUFuZEJ1aWxkUmVxdWVzdChyLnVybCB8fCBbXSwgJywnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyhyLnR0bCB8fCAnJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5maXJlVVJMU3luYyA/ICd0cnVlJyA6ICdmYWxzZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCByLnN5bmNPblBhZ2UgfHwgKHRoaXMuY2FuU2V0VGhpcmRQYXJ0eUNvb2tpZXMgPyB0aGlzLmFkZE1lc3NhZ2UoaS5qb2luKCd8JykpIDogci5maXJlVVJMU3luYyAmJiB0aGlzLmNoZWNrRmlyc3RQYXJ0eUNvb2tpZShyLCBpLmpvaW4oJ3wnKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzICYmIHRoaXMuanNvblByb2Nlc3NlZC5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hlY2tGaXJzdFBhcnR5Q29va2llOiBmdW5jdGlvbiAodCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICdzeW5jT25QYWdlJyA9PT0gbiwgaSA9IHIgPyAnTUNTWU5DU09QJyA6ICdNQ1NZTkNTJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fcmVhZFZpc2l0b3IoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8sIHMsIGMgPSBlLl9nZXRGaWVsZChpKSwgbCA9ICExLCB1ID0gITEsIGQgPSBNYXRoLmNlaWwobmV3IERhdGUoKS5nZXRUaW1lKCkgLyAkLk1JTExJU19QRVJfREFZKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA/IChvID0gYy5zcGxpdCgnKicpLCBsID0gKHMgPSB0aGlzLnBydW5lU3luY0RhdGEobywgdC5pZCwgZCkpLmRhdGFQcmVzZW50LCB1ID0gcy5kYXRhVmFsaWQsIGwgJiYgdSB8fCB0aGlzLmZpcmVTeW5jKHIsIHQsIGEsIG8sIGksIGQpKSA6IChvID0gW10sIHRoaXMuZmlyZVN5bmMociwgdCwgYSwgbywgaSwgZCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJ1bmVTeW5jRGF0YTogZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIGksIG8gPSAhMSwgcyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgZS5sZW5ndGg7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBlW3JdLCBpID0gcGFyc2VJbnQobi5zcGxpdCgnLScpWzFdLCAxMCksIG4ubWF0Y2goJ14nICsgdCArICctJykgPyAobyA9ICEwLCBhIDwgaSA/IHMgPSAhMCA6IChlLnNwbGljZShyLCAxKSwgci0tKSkgOiBhID49IGkgJiYgKGUuc3BsaWNlKHIsIDEpLCByLS0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YVByZXNlbnQ6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhVmFsaWQ6IHMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hbmFnZVN5bmNzU2l6ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuam9pbignKicpLmxlbmd0aCA+IHRoaXMuTUFYX1NZTkNTX0xFTkdUSCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZS5zb3J0KGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUludChlLnNwbGl0KCctJylbMV0sIDEwKSAtIHBhcnNlSW50KHQuc3BsaXQoJy0nKVsxXSwgMTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOyBlLmpvaW4oJyonKS5sZW5ndGggPiB0aGlzLk1BWF9TWU5DU19MRU5HVEg7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc2hpZnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpcmVTeW5jOiBmdW5jdGlvbiAodCwgYSwgbiwgciwgaSwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2ltZycgPT09IGEudGFnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMsIGwsIHUsIGQsIHAgPSBhLnVybCwgaCA9IGUubG9hZFNTTCA/ICdodHRwczonIDogJ2h0dHA6JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSAwLCBsID0gcC5sZW5ndGg7IGMgPCBsOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSA9IHBbY10sIGQgPSAvXlwvXC8vLnRlc3QodSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gbmV3IEltYWdlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsIGZ1bmN0aW9uICh0LCBhLCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMub25QYWdlUGl4ZWxzW3RdID0gbnVsbCwgZS5fcmVhZFZpc2l0b3IoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbywgYywgbCwgdSwgZCA9IGUuX2dldEZpZWxkKGkpLCBwID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYyA9IDAsIGwgPSAobyA9IGQuc3BsaXQoJyonKSkubGVuZ3RoOyBjIDwgbDsgYysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHUgPSBvW2NdKS5tYXRjaCgnXicgKyBhLmlkICsgJy0nKSB8fCBwLnB1c2godSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5zZXRTeW5jVHJhY2tpbmdEYXRhKHAsIGEsIG4sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0aGlzLm9uUGFnZVBpeGVscy5sZW5ndGgsIGEsIGksIG8pKSwgZi5zcmMgPSAoZCA/IGggOiAnJykgKyB1LCB0aGlzLm9uUGFnZVBpeGVscy5wdXNoKGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZE1lc3NhZ2UobiksIHRoaXMuc2V0U3luY1RyYWNraW5nRGF0YShyLCBhLCBpLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZE1lc3NhZ2U6IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZW5jb2RlVVJJQ29tcG9uZW50KGUuX2VuYWJsZUVycm9yUmVwb3J0aW5nID8gJy0tLWRlc3RwdWItZGVidWctLS0nIDogJy0tLWRlc3RwdWItLS0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5tZXNzYWdlcy5wdXNoKCgkLlBPU1RfTUVTU0FHRV9FTkFCTEVEID8gJycgOiBhKSArIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U3luY1RyYWNraW5nRGF0YTogZnVuY3Rpb24gKHQsIGEsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKGEuaWQgKyAnLScgKyAociArIE1hdGguY2VpbChhLnR0bCAvIDYwIC8gMjQpKSksIHRoaXMubWFuYWdlU3luY3NTaXplKHQpLCBlLl9zZXRGaWVsZChuLCB0LmpvaW4oJyonKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZXM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQgPSB0aGlzLCBhID0gJycsIG4gPSBlbmNvZGVVUklDb21wb25lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucmVnaW9uQ2hhbmdlZCAmJiAoYSA9IG4oJy0tLWRlc3RwdWItY2xlYXItZGV4dHAtLS0nKSwgdGhpcy5yZWdpb25DaGFuZ2VkID0gITEpLCB0aGlzLm1lc3NhZ2VzLmxlbmd0aCA/ICQuUE9TVF9NRVNTQUdFX0VOQUJMRUQgPyAoZSA9IGEgKyBuKCctLS1kZXN0cHViLWNvbWJpbmVkLS0tJykgKyB0aGlzLm1lc3NhZ2VzLmpvaW4oJyUwMScpLCB0aGlzLnBvc3RNZXNzYWdlKGUpLCB0aGlzLm1lc3NhZ2VzID0gW10sIHRoaXMuc2VuZGluZ01lc3NhZ2VzID0gITEpIDogKGUgPSB0aGlzLm1lc3NhZ2VzLnNoaWZ0KCksIHRoaXMucG9zdE1lc3NhZ2UoYSArIGUpLCBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2VuZE1lc3NhZ2VzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMubWVzc2FnZVNlbmRpbmdJbnRlcnZhbCkpIDogdGhpcy5zZW5kaW5nTWVzc2FnZXMgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvc3RNZXNzYWdlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBRLnBvc3RNZXNzYWdlKGUsIHRoaXMudXJsLCB0aGlzLmlmcmFtZS5jb250ZW50V2luZG93KSwgdGhpcy5tZXNzYWdlc1Bvc3RlZC5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZU1lc3NhZ2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBhID0gL14tLS1kZXN0cHViLXRvLXBhcmVudC0tLS87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09IHR5cGVvZiBlICYmIGEudGVzdChlKSAmJiAoJ2NhblNldFRoaXJkUGFydHlDb29raWVzJyA9PT0gKHQgPSBlLnJlcGxhY2UoYSwgJycpLnNwbGl0KCd8JykpWzBdICYmICh0aGlzLmNhblNldFRoaXJkUGFydHlDb29raWVzID0gJ3RydWUnID09PSB0WzFdLCB0aGlzLnJlY2VpdmVkVGhpcmRQYXJ0eUNvb2tpZXNOb3RpZmljYXRpb24gPSAhMCwgdGhpcy5yZXF1ZXN0VG9Qcm9jZXNzKCkpLCB0aGlzLm1lc3NhZ2VzUmVjZWl2ZWQucHVzaChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzSURDYWxsRGF0YTogZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG51bGwgPT0gdGhpcy51cmwgfHwgbi5zdWJkb21haW4gJiYgJ25vc3ViZG9tYWlucmV0dXJuZWQnID09PSB0aGlzLnN1YmRvbWFpbikgJiYgKCdzdHJpbmcnID09IHR5cGVvZiBlLl9zdWJkb21haW4gJiYgZS5fc3ViZG9tYWluLmxlbmd0aCA/IHRoaXMuc3ViZG9tYWluID0gZS5fc3ViZG9tYWluIDogdGhpcy5zdWJkb21haW4gPSBuLnN1YmRvbWFpbiB8fCAnJywgdGhpcy51cmwgPSB0aGlzLmdldFVybCgpKSwgbi5pYnMgaW5zdGFuY2VvZiBBcnJheSAmJiBuLmlicy5sZW5ndGggJiYgKHRoaXMuZG9BdHRhY2hJZnJhbWUgPSAhMCksIHRoaXMucmVhZHlUb0F0dGFjaElmcmFtZSgpICYmIChlLmlkU3luY0F0dGFjaElmcmFtZU9uV2luZG93TG9hZCA/ICh0LndpbmRvd0xvYWRlZCB8fCAnY29tcGxldGUnID09PSBhLnJlYWR5U3RhdGUgfHwgJ2xvYWRlZCcgPT09IGEucmVhZHlTdGF0ZSkgJiYgdGhpcy5hdHRhY2hJZnJhbWUoKSA6IHRoaXMuYXR0YWNoSWZyYW1lQVNBUCgpKSwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZS5pZFN5bmNJRENhbGxSZXN1bHQgPyBlLmlkU3luY0lEQ2FsbFJlc3VsdChuKSA6IHRoaXMucmVxdWVzdFRvUHJvY2VzcyhuKSwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZS5pZFN5bmNBZnRlcklEQ2FsbFJlc3VsdCAmJiBlLmlkU3luY0FmdGVySURDYWxsUmVzdWx0KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuTWFrZVN5bmNJRENhbGw6IGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLl9mb3JjZVN5bmNJRENhbGwgfHwgIXQgfHwgYSAtIHQgPiAkLkRBWVNfQkVUV0VFTl9TWU5DX0lEX0NBTExTOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR0YWNoSWZyYW1lQVNBUDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zdGFydGVkQXR0YWNoaW5nSWZyYW1lIHx8IChhLmJvZHkgPyB0LmF0dGFjaElmcmFtZSgpIDogc2V0VGltZW91dChlLCAzMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFogPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpZW5jZU1hbmFnZXJTZXJ2ZXI6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaWVuY2VNYW5hZ2VyU2VydmVyU2VjdXJlOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZURvbWFpbjoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29raWVMaWZldGltZToge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29raWVOYW1lOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvZXNPcHRJbkFwcGx5OiB7IHR5cGU6ICdib29sZWFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzYWJsZVRoaXJkUGFydHlDYWxsczogeyB0eXBlOiAnYm9vbGVhbicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc2NhcmRUcmFja2luZ1NlcnZlckVDSUQ6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNBZnRlcklEQ2FsbFJlc3VsdDoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNBdHRhY2hJZnJhbWVPbldpbmRvd0xvYWQ6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNDb250YWluZXJJRDoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNEaXNhYmxlM3JkUGFydHlTeW5jaW5nOiB7IHR5cGU6ICdib29sZWFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzYWJsZVRoaXJkUGFydHlDb29raWVzOiB7IHR5cGU6ICdib29sZWFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWRTeW5jRGlzYWJsZVN5bmNzOiB7IHR5cGU6ICdib29sZWFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzYWJsZUlkU3luY3M6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNJRENhbGxSZXN1bHQ6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWRTeW5jU1NMVXNlQWthbWFpOiB7IHR5cGU6ICdib29sZWFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNDb29wU2FmZTogeyB0eXBlOiAnYm9vbGVhbicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzSWFiQ29udGV4dDogeyB0eXBlOiAnYm9vbGVhbicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzT3B0SW5TdG9yYWdlRW5hYmxlZDogeyB0eXBlOiAnYm9vbGVhbicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvYWRTU0w6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2FkVGltZW91dDoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJrZXRpbmdDbG91ZFNlcnZlcjoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJrZXRpbmdDbG91ZFNlcnZlclNlY3VyZToge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRJbkNvb2tpZURvbWFpbjoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRJblN0b3JhZ2VFeHBpcnk6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcndyaXRlQ3Jvc3NEb21haW5NQ0lEQW5kQUlEOiB7IHR5cGU6ICdib29sZWFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlT3B0SW5BcHByb3ZhbHM6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJldmlvdXNQZXJtaXNzaW9uczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNldEJlZm9yZVZlcnNpb246IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2RpZFBhcmFtRXhwaXJ5OiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZlclN0YXRlOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb25Db29raWVOYW1lOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY3VyZUNvb2tpZTogeyB0eXBlOiAnYm9vbGVhbicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbWVTaXRlQ29va2llOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRha2VUaW1lb3V0TWV0cmljczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2luZ1NlcnZlcjoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2luZ1NlcnZlclNlY3VyZToge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VMb2NhbFN0b3JhZ2U6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGl0ZWxpc3RJZnJhbWVEb21haW5zOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaXRlbGlzdFBhcmVudERvbWFpbjoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgWCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldENvbmZpZ05hbWVzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKFopOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldENvbmZpZ3M6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3JtYWxpemVDb25maWc6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFpbZV0gJiYgJ2Jvb2xlYW4nID09PSBaW2VdLnR5cGUgPyAnZnVuY3Rpb24nICE9IHR5cGVvZiB0ID8gdCA6IHQoKSA6IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5vbiA9IGZ1bmN0aW9uIChlLCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignW09OXSBDYWxsYmFjayBzaG91bGQgYmUgYSBmdW5jdGlvbi4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KGUpIHx8ICh0W2VdID0gW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdFtlXS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSAtIDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtlXS5zcGxpY2UociwgMSksIHRbZV0ubGVuZ3RoIHx8IGRlbGV0ZSB0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLm9mZiA9IGZ1bmN0aW9uIChlLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShlKSAmJiAodFtlXSA9IHRbZV0uZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmNhbGxiYWNrICE9PSBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wdWJsaXNoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5oYXNPd25Qcm9wZXJ0eShlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFtdLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtlXS5zbGljZSgwKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmNhbGxiYWNrLmFwcGx5KGUuY29udGV4dCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHVibGlzaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQRU5ESU5HOiAncGVuZGluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDSEFOR0VEOiAnY2hhbmdlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDT01QTEVURTogJ2NvbXBsZXRlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFBTTogJ2FhbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBRENMT1VEOiAnYWRjbG91ZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTkFMWVRJQ1M6ICdhYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQU1QQUlHTjogJ2NhbXBhaWduJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVDSUQ6ICdlY2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExJVkVGWVJFOiAnbGl2ZWZ5cmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEFSR0VUOiAndGFyZ2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1FRElBX0FOQUxZVElDUzogJ21lZGlhYWEnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG5lID0gKHQodiA9IHt9LCBhZS5BQU0sIDU2NSksIHQodiwgYWUuRUNJRCwgNTY1KSwgdiksIHJlID0gKHQoeSA9IHt9LCBhZS5BQU0sIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgdCh5LCBhZS5FQ0lELCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIHkpLCBpZSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2aWRlb2FhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpYWJDb25zZW50SGFzaCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgb2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGUpLm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oYWUpLCBzZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jYWxsYmFja3MgPSBPYmplY3QuY3JlYXRlKG51bGwpLCBlLmFkZCA9IGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsKGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1tjYWxsYmFja1JlZ2lzdHJ5RmFjdG9yeV0gTWFrZSBzdXJlIGNhbGxiYWNrIGlzIGEgZnVuY3Rpb24gb3IgYW4gYXJyYXkgb2YgZnVuY3Rpb25zLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbGJhY2tzW3RdID0gZS5jYWxsYmFja3NbdF0gfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmNhbGxiYWNrc1t0XS5wdXNoKGEpIC0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmNhbGxiYWNrc1t0XS5zcGxpY2UobiwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZXhlY3V0ZSA9IGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuY2FsbGJhY2tzW3RdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAoYSA9IHZvaWQgMCA9PT0gYSA/IFtdIDogYSkgaW5zdGFuY2VvZiBBcnJheSA/IGEgOiBbYV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZS5jYWxsYmFja3NbdF0ubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5jYWxsYmFja3NbdF0uc2hpZnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiBuID8gbi5hcHBseShudWxsLCBhKSA6IG4gaW5zdGFuY2VvZiBBcnJheSAmJiBuWzFdLmFwcGx5KG5bMF0sIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGUuY2FsbGJhY2tzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmV4ZWN1dGVBbGwgPSBmdW5jdGlvbiAodCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChhIHx8IHQgJiYgIWModCkpICYmIE9iamVjdC5rZXlzKGUuY2FsbGJhY2tzKS5mb3JFYWNoKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdm9pZCAwICE9PSB0W2FdID8gdFthXSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4ZWN1dGUoYSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmhhc0NhbGxiYWNrcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQm9vbGVhbihPYmplY3Qua2V5cyhlLmNhbGxiYWNrcykubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGNlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBsZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHdpbmRvdy5jb25zb2xlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhdCAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiB0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB1ZSA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSgpID8gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZShlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gYXJndW1lbnRzLmxlbmd0aCwgbiA9IG5ldyBBcnJheShhKSwgciA9IDA7IHIgPCBhOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3JdID0gYXJndW1lbnRzW3JdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlW2VdLmFwcGx5KGNvbnNvbGUsIFt0XS5jb25jYXQobikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBjZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZGUgPSB1LCBwZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBbXSwgdCA9IDA7IHQgPCAyNTY7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSB0LCBuID0gMDsgbiA8IDg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IDEgJiBhID8gMzk4ODI5MjM4NCBeIGEgPj4+IDEgOiBhID4+PiAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHVzaChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB1bmVzY2FwZShlbmNvZGVVUklDb21wb25lbnQodCkpLCBhIHx8IChhID0gMCksIGEgXj0gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCB0Lmxlbmd0aDsgbisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gMjU1ICYgKGEgXiB0LmNoYXJDb2RlQXQobikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gYSA+Pj4gOCBeIGVbcl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoYSBePSAtMSkgPj4+IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIGhlID0gbmV3IGRlKCdbQURPQkUgT1BULUlOXScpLCBmZSA9IGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0KSA9PT0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZ2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgaW5zdGFuY2VvZiBBcnJheSA/IGUgOiBmZShlLCAnc3RyaW5nJykgPyBbZV0gOiB0IHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBtZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdC5rZXlzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhdC5sZW5ndGggJiYgdC5ldmVyeShmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gZVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBiZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdICYmIGFyZ3VtZW50c1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFlIHx8IHllKGUpKSAmJiBnZShlKS5ldmVyeShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvZS5pbmRleE9mKGUpID4gLTEgfHwgdCAmJiBpZS5pbmRleE9mKGUpID4gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgX2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVkdWNlKGZ1bmN0aW9uIChlLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbYV0gPSB0LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5wYXJzZShKU09OLnN0cmluZ2lmeShlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHllID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnW29iamVjdCBBcnJheV0nID09PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoZSkgJiYgIWUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBrZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod2UoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgQWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PT0gZSB8fCAod2UoZSkgPyBiZShPYmplY3Qua2V5cyhlKSwgITApIDogU2UoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBTZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gSlNPTi5wYXJzZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlICYmIGZlKGUsICdzdHJpbmcnKSAmJiBiZShPYmplY3Qua2V5cyh0KSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgd2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGUgJiYgZmUoZSwgJ29iamVjdCcpICYmICExID09PSBBcnJheS5pc0FycmF5KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBFZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZlKGUsICdmdW5jdGlvbicpID8gZSgpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSWUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQWUoZSkgfHwgaGUuZXJyb3IoJycuY29uY2F0KHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgVGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGUpLm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFBlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUZShlKS5maWx0ZXIoZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5pbmRleE9mKGUpID09PSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIENlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6IHt9LCBhID0gdC5jb21tYW5kLCBuID0gdC5wYXJhbXMsIHIgPSB2b2lkIDAgPT09IG4gPyB7fSA6IG4sIGkgPSB0LmNhbGxiYWNrLCBvID0gdm9pZCAwID09PSBpID8gRWUgOiBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYSB8fCAtMSA9PT0gYS5pbmRleE9mKCcuJykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignW09wdEluLmV4ZWN1dGVdIFBsZWFzZSBwcm92aWRlIGEgdmFsaWQgY29tbWFuZC4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGEuc3BsaXQoJy4nKSwgYyA9IGVbc1swXV0sIGwgPSBzWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWMgfHwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgY1tsXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignTWFrZSBzdXJlIHRoZSBwbHVnaW4gYW5kIEFQSSBuYW1lIGV4aXN0LicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IE9iamVjdC5hc3NpZ24ociwgeyBjYWxsYmFjazogbyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY1tsXS5jYWxsKGMsIHUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGUuZXJyb3IoJ1tleGVjdXRlXSBTb21ldGhpbmcgd2VudCB3cm9uZzogJyArIGUubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLnByb3RvdHlwZSA9IE9iamVjdC5jcmVhdGUoRXJyb3IucHJvdG90eXBlKSwgcC5wcm90b3R5cGUuY29uc3RydWN0b3IgPSBwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBWZSA9ICdmZXRjaFBlcm1pc3Npb25zJywgTGUgPSAnW09wdEluI3JlZ2lzdGVyUGx1Z2luXSBQbHVnaW4gaXMgaW52YWxpZC4nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGguQ2F0ZWdvcmllcyA9IGFlLCBoLlRpbWVvdXRFcnJvciA9IHA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIE5lID0gT2JqZWN0LmZyZWV6ZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPcHRJbjogaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElhYlBsdWdpbjogYgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wdWJsaXNoRGVzdGluYXRpb25zID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50c1sxXSwgciA9IGFyZ3VtZW50c1syXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgciA/IHIgOiBhLmNhbGxiYWNrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpLnJlYWR5VG9BdHRhY2hJZnJhbWVQcmVsaW1pbmFyeSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCByKHsgZXJyb3I6ICdzdWJkb21haW4gaXMgbm90IGEgcG9wdWxhdGVkIHN0cmluZy4nIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEobiBpbnN0YW5jZW9mIEFycmF5ICYmIG4ubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCByKHsgZXJyb3I6ICdtZXNzYWdlcyBpcyBub3QgYSBwb3B1bGF0ZWQgYXJyYXkuJyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09IHR5cGVvZiBlICYmIGUubGVuZ3RoICYmIChpLmFkZE1lc3NhZ2UoZSksIG8gPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksICFvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIHIoeyBlcnJvcjogJ05vbmUgb2YgdGhlIG1lc3NhZ2VzIGFyZSBwb3B1bGF0ZWQgc3RyaW5ncy4nIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFDLmlzT2JqZWN0KGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIHIoeyBlcnJvcjogJ0ludmFsaWQgcGFyYW1ldGVycyBwYXNzZWQuJyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPSB0eXBlb2YgKGEgPSBzLnN1YmRvbWFpbikgfHwgIWEubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIHIoeyBlcnJvcjogJ2NvbmZpZy5zdWJkb21haW4gaXMgbm90IGEgcG9wdWxhdGVkIHN0cmluZy4nIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBzLnVybERlc3RpbmF0aW9uczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGMgaW5zdGFuY2VvZiBBcnJheSAmJiBjLmxlbmd0aCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgcih7IGVycm9yOiAnY29uZmlnLnVybERlc3RpbmF0aW9ucyBpcyBub3QgYSBwb3B1bGF0ZWQgYXJyYXkuJyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDLmlzT2JqZWN0KGUpICYmIChlLmhpZGVSZWZlcnJlciA/IGUubWVzc2FnZSAmJiBpLmFkZE1lc3NhZ2UoZS5tZXNzYWdlKSA6IGwucHVzaChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLmxlbmd0aCAmJiBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuZXcgSW1hZ2UoKSwgYSA9IGwuc2hpZnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zcmMgPSBhLnVybCwgaS5vblBhZ2VEZXN0aW5hdGlvbnNGaXJlZC5wdXNoKGEpLCBlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmlmcmFtZSA/IChyKHsgbWVzc2FnZTogJ1RoZSBkZXN0aW5hdGlvbiBwdWJsaXNoaW5nIGlmcmFtZSBpcyBhbHJlYWR5IGF0dGFjaGVkIGFuZCBsb2FkZWQuJyB9KSwgaS5yZXF1ZXN0VG9Qcm9jZXNzKCkpIDogIWUuc3ViZG9tYWluICYmIGUuX2dldEZpZWxkKCdNQ01JRCcpID8gKGkuc3ViZG9tYWluID0gYSwgaS5kb0F0dGFjaElmcmFtZSA9ICEwLCBpLnVybCA9IGkuZ2V0VXJsKCksIGkucmVhZHlUb0F0dGFjaElmcmFtZSgpID8gKGkuaWZyYW1lTG9hZGVkQ2FsbGJhY2tzLnB1c2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoeyBtZXNzYWdlOiAnQXR0ZW1wdGVkIHRvIGF0dGFjaCBhbmQgbG9hZCB0aGUgZGVzdGluYXRpb24gcHVibGlzaGluZyBpZnJhbWUgdGhyb3VnaCB0aGlzIEFQSSBjYWxsLiBSZXN1bHQ6ICcgKyAoZS5tZXNzYWdlIHx8ICdubyByZXN1bHQnKSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkuYXR0YWNoSWZyYW1lKCkpIDogcih7IGVycm9yOiAnRW5jb3VudGVyZWQgYSBwcm9ibGVtIGluIGF0dGVtcHRpbmcgdG8gYXR0YWNoIGFuZCBsb2FkIHRoZSBkZXN0aW5hdGlvbiBwdWJsaXNoaW5nIGlmcmFtZSB0aHJvdWdoIHRoaXMgQVBJIGNhbGwuJyB9KSkgOiBpLmlmcmFtZUxvYWRlZENhbGxiYWNrcy5wdXNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKHsgbWVzc2FnZTogJ0F0dGVtcHRlZCB0byBhdHRhY2ggYW5kIGxvYWQgdGhlIGRlc3RpbmF0aW9uIHB1Ymxpc2hpbmcgaWZyYW1lIHRocm91Z2ggbm9ybWFsIFZpc2l0b3IgQVBJIHByb2Nlc3NpbmcuIFJlc3VsdDogJyArIChlLm1lc3NhZ2UgfHwgJ25vIHJlc3VsdCcpIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcih7IGVycm9yOiAnVGhlIGRlc3RpbmF0aW9uIHB1Ymxpc2hpbmcgaWZyYW1lIGlzIGRpc2FibGVkIGluIHRoZSBWaXNpdG9yIGxpYnJhcnkuJyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE1lID0gZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA+Pj4gdCB8IGUgPDwgMzIgLSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiwgciwgaSA9IE1hdGgucG93LCBvID0gaSgyLCAzMiksIHMgPSAnJywgYyA9IFtdLCBsID0gOCAqIHQubGVuZ3RoLCB1ID0gZS5oID0gZS5oIHx8IFtdLCBkID0gZS5rID0gZS5rIHx8IFtdLCBwID0gZC5sZW5ndGgsIGggPSB7fSwgZiA9IDI7IHAgPCA2NDsgZisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaFtmXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgMzEzOyBuICs9IGYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoW25dID0gZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdVtwXSA9IGkoZiwgMC41KSAqIG8gfCAwLCBkW3ArK10gPSBpKGYsIDEgLyAzKSAqIG8gfCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCArPSAnXHg4MCc7IHQubGVuZ3RoICUgNjQgLSA1NjspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSAnXDAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gMDsgbiA8IHQubGVuZ3RoOyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHIgPSB0LmNoYXJDb2RlQXQobikpID4+IDgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjW24gPj4gMl0gfD0gciA8PCAoMyAtIG4pICUgNCAqIDg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGNbYy5sZW5ndGhdID0gbCAvIG8gfCAwLCBjW2MubGVuZ3RoXSA9IGwsIHIgPSAwOyByIDwgYy5sZW5ndGg7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBjLnNsaWNlKHIsIHIgKz0gMTYpLCBtID0gdTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHUgPSB1LnNsaWNlKDAsIDgpLCBuID0gMDsgbiA8IDY0OyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBnW24gLSAxNV0sIF8gPSBnW24gLSAyXSwgdiA9IHVbMF0sIHkgPSB1WzRdLCBrID0gdVs3XSArIChhKHksIDYpIF4gYSh5LCAxMSkgXiBhKHksIDI1KSkgKyAoeSAmIHVbNV0gXiB+eSAmIHVbNl0pICsgZFtuXSArIChnW25dID0gbiA8IDE2ID8gZ1tuXSA6IGdbbiAtIDE2XSArIChhKGIsIDcpIF4gYShiLCAxOCkgXiBiID4+PiAzKSArIGdbbiAtIDddICsgKGEoXywgMTcpIF4gYShfLCAxOSkgXiBfID4+PiAxMCkgfCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHUgPSBbayArICgoYSh2LCAyKSBeIGEodiwgMTMpIF4gYSh2LCAyMikpICsgKHYgJiB1WzFdIF4gdiAmIHVbMl0gXiB1WzFdICYgdVsyXSkpIHwgMF0uY29uY2F0KHUpKVs0XSA9IHVbNF0gKyBrIHwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gMDsgbiA8IDg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdVtuXSA9IHVbbl0gKyBtW25dIHwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPCA4OyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyID0gMzsgciArIDE7IHItLSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgQSA9IHVbbl0gPj4gOCAqIHIgJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgKz0gKEEgPCAxNiA/IDAgOiAnJykgKyBBLnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgUmUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdTSEEtMjU2JyAhPT0gdCAmJiAnU0hBMjU2JyAhPT0gdCAmJiAnc2hhMjU2JyAhPT0gdCAmJiAnc2hhLTI1NicgIT09IHQgfHwgKGUgPSBNZShlKSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGplID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTdHJpbmcoZSkudHJpbSgpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHhlID0gTmUuT3B0SW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQy5kZWZpbmVHbG9iYWxOYW1lc3BhY2UoKSwgd2luZG93LmFkb2JlLk9wdEluQ2F0ZWdvcmllcyA9IHhlLkNhdGVnb3JpZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEJlID0gZnVuY3Rpb24gKHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuX2N1c3RvbWVySURzSGFzaENoYW5nZWQgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZSB8fCBELmxvY2F0aW9uLmhyZWY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB2Ll9leHRyYWN0UGFyYW1Gcm9tVXJpKGEsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ZS5wYXJzZVBpcGVEZWxpbWV0ZWRLZXlWYWx1ZXMobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmIGUubWF0Y2goJC5WQUxJRF9WSVNJVE9SX0lEX1JFR0VYKSAmJiAoYSA9PT0gTCAmJiAoRSA9ICEwKSwgdChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGVbTF0sIHYuc2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQsIEwpLCB2Ll9zZXRGaWVsZEV4cGlyZSh4LCAtMSksIHQoZVtSXSwgdi5zZXRBbmFseXRpY3NWaXNpdG9ySUQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUgfHwge30sIHYuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQgPSBlLnN1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQgfHwgJycsIHYuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnRDb25zdW1lZCA9IGUuc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkIHx8IHt9LCB2Ll9zdXBwbGVtZW50YWxEYXRhSURMYXN0ID0gZS5zdXBwbGVtZW50YWxEYXRhSURMYXN0IHx8ICcnLCB2Ll9zdXBwbGVtZW50YWxEYXRhSURMYXN0Q29uc3VtZWQgPSBlLnN1cHBsZW1lbnRhbERhdGFJRExhc3RDb25zdW1lZCB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoYSA9IGEgPyBhICs9ICd8JyA6IGEpICsgKGUgKyAnPScpICsgZW5jb2RlVVJJQ29tcG9uZW50KHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhWzBdLCByID0gYVsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSByICYmIHIgIT09IEIgJiYgKGUgPSB0KG4sIHIsIGUpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IGUgPyBlICs9ICd8JyA6IGUpICsgJ1RTPScgKyB0ZS5nZXRUaW1lc3RhbXBJblNlY29uZHMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZS5yZWR1Y2UoYSwgJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5taW51dGVzVG9MaXZlLCBhID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHYuaWRTeW5jRGlzYWJsZVN5bmNzIHx8IHYuZGlzYWJsZUlkU3luY3MpICYmIChhID0gYSB8fCAnRXJyb3I6IGlkIHN5bmNzIGhhdmUgYmVlbiBkaXNhYmxlZCcpLCAnc3RyaW5nJyA9PSB0eXBlb2YgZS5kcGlkICYmIGUuZHBpZC5sZW5ndGggfHwgKGEgPSBhIHx8ICdFcnJvcjogY29uZmlnLmRwaWQgaXMgZW1wdHknKSwgJ3N0cmluZycgPT0gdHlwZW9mIGUudXJsICYmIGUudXJsLmxlbmd0aCB8fCAoYSA9IGEgfHwgJ0Vycm9yOiBjb25maWcudXJsIGlzIGVtcHR5JyksIHZvaWQgMCA9PT0gdCA/IHQgPSAyMDE2MCA6ICh0ID0gcGFyc2VJbnQodCwgMTApLCAoaXNOYU4odCkgfHwgdCA8PSAwKSAmJiAoYSA9IGEgfHwgJ0Vycm9yOiBjb25maWcubWludXRlc1RvTGl2ZSBuZWVkcyB0byBiZSBhIHBvc2l0aXZlIG51bWJlcicpKSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR0bDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIXYuY29uZmlncy5kb2VzT3B0SW5BcHBseSB8fCB5Lm9wdEluLmlzQ29tcGxldGUgJiYgZCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuY29uZmlncy5kb2VzT3B0SW5BcHBseSAmJiB2LmNvbmZpZ3MuaXNJYWJDb250ZXh0ID8geS5vcHRJbi5pc0FwcHJvdmVkKHkub3B0SW4uQ2F0ZWdvcmllcy5FQ0lEKSAmJiB3IDogeS5vcHRJbi5pc0FwcHJvdmVkKHkub3B0SW4uQ2F0ZWdvcmllcy5FQ0lEKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQnXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZXRDdXN0b21lcklEcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3luY0lkZW50aXR5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ2dldEFuYWx5dGljc1Zpc2l0b3JJRCddLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50J10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydnZXRMb2NhdGlvbkhpbnQnXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ2dldEF1ZGllbmNlTWFuYWdlckJsb2InXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlWzBdLCBhID0gMiA9PT0gZS5sZW5ndGggPyBlWzFdIDogJycsIG4gPSB2W3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZbdF0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCgpICYmIHYuaXNBbGxvd2VkKCkgPyBuLmFwcGx5KHYsIGFyZ3VtZW50cykgOiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZSAmJiB2Ll9jYWxsQ2FsbGJhY2soZSwgW2FdKSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHYuX2dldEF1ZGllbmNlTWFuYWdlclVSTERhdGEoKSwgdCA9IGUudXJsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuX2xvYWREYXRhKFYsIHQsIG51bGwsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHcgPSAhMCwgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1tJQUIgcGx1Z2luXSA6ICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgdC5nZHByQXBwbGllcyAmJiAoQSA9IHQuY29uc2VudFN0cmluZywgUyA9IHQuaGFzQ29uc2VudENoYW5nZWRTaW5jZUxhc3RDbXBQdWxsID8gMSA6IDApLCBoKCksIGIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3ID0gITAsIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdbSUFCIHBsdWdpbl0gOiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmdkcHJBcHBsaWVzICYmIChBID0gdC5jb25zZW50U3RyaW5nLCBTID0gdC5oYXNDb25zZW50Q2hhbmdlZFNpbmNlTGFzdENtcFB1bGwgPyAxIDogMCksIHYuaW5pdCgpLCBiKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkub3B0SW4uaXNDb21wbGV0ZSAmJiAoeS5vcHRJbi5pc0FwcHJvdmVkKHkub3B0SW4uQ2F0ZWdvcmllcy5FQ0lEKSA/IHYuY29uZmlncy5pc0lhYkNvbnRleHQgPyB5Lm9wdEluLmV4ZWN1dGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1hbmQ6ICdpYWJQbHVnaW4uZmV0Y2hDb25zZW50RGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IGcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogKHYuaW5pdCgpLCBiKCkpIDogdi5jb25maWdzLmlzSWFiQ29udGV4dCA/IHkub3B0SW4uZXhlY3V0ZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tbWFuZDogJ2lhYlBsdWdpbi5mZXRjaENvbnNlbnREYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiAocCgpLCBiKCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5vcHRJbi5vZmYoJ2NvbXBsZXRlJywgbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFuIHx8IG4uc3BsaXQoJycpLnJldmVyc2UoKS5qb2luKCcnKSAhPT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignUGxlYXNlIHVzZSBgVmlzaXRvci5nZXRJbnN0YW5jZWAgdG8gaW5zdGFudGlhdGUgVmlzaXRvci4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSB0aGlzLCB5ID0gd2luZG93LmFkb2JlLCBBID0gJycsIFMgPSAwLCB3ID0gITEsIEUgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi52ZXJzaW9uID0gJzUuMi4wJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEQgPSBfLCBJID0gRC5WaXNpdG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJLnZlcnNpb24gPSB2LnZlcnNpb24sIEkuQXV0aFN0YXRlID0gay5BVVRIX1NUQVRFLCBJLk9wdE91dCA9IGsuT1BUX09VVCwgRC5zX2NfaW4gfHwgKEQuc19jX2lsID0gW10sIEQuc19jX2luID0gMCksIHYuX2MgPSAnVmlzaXRvcicsIHYuX2lsID0gRC5zX2NfaWwsIHYuX2luID0gRC5zX2NfaW4sIHYuX2lsW3YuX2luXSA9IHYsIEQuc19jX2luKyssIHYuX2luc3RhbmNlVHlwZSA9ICdyZWd1bGFyJywgdi5fbG9nID0geyByZXF1ZXN0czogW10gfSwgdi5tYXJrZXRpbmdDbG91ZE9yZ0lEID0gdCwgdi5jb29raWVOYW1lID0gJ0FNQ1ZfJyArIHQsIHYuc2Vzc2lvbkNvb2tpZU5hbWUgPSAnQU1DVlNfJyArIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBUID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgJiYgYS5zZWN1cmVDb29raWUgJiYgYS5zYW1lU2l0ZUNvb2tpZSAmJiAoVCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhbWVTaXRlOiBhLnNhbWVTaXRlQ29va2llLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdXJlOiBhLnNlY3VyZUNvb2tpZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdi5jb29raWVEb21haW4gPSB2LnVzZUxvY2FsU3RvcmFnZSA/ICcnIDogeihudWxsLCBUKSwgdi5sb2FkU1NMID0gITAsIHYubG9hZFRpbWVvdXQgPSAzMDAwMCwgdi5DT1JTRXJyb3JzID0gW10sIHYubWFya2V0aW5nQ2xvdWRTZXJ2ZXIgPSB2LmF1ZGllbmNlTWFuYWdlclNlcnZlciA9ICdkcG0uZGVtZGV4Lm5ldCcsIHYuc2RpZFBhcmFtRXhwaXJ5ID0gMzA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBQID0gbnVsbCwgViA9ICdNQycsIEwgPSAnTUNNSUQnLCBOID0gJ01DSURUUycsIE0gPSAnQScsIFIgPSAnTUNBSUQnLCBqID0gJ0FBTScsIHggPSAnTUNBQU1CJywgQiA9ICdOT05FJywgRiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFPYmplY3QucHJvdG90eXBlW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSyA9IFcodik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuRklFTERTID0gay5GSUVMRFMsIHYuY29va2llUmVhZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdi51c2VMb2NhbFN0b3JhZ2UgPyBlID09PSB2LnNlc3Npb25Db29raWVOYW1lID8gc2Vzc2lvblN0b3JhZ2UuZ2V0SXRlbShlKSA6IGxvY2FsU3RvcmFnZS5nZXRJdGVtKGUpIDogVS5nZXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuY29va2llV3JpdGUgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAnJyArIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodi51c2VMb2NhbFN0b3JhZ2UpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IHYuc2Vzc2lvbkNvb2tpZU5hbWUgPyBzZXNzaW9uU3RvcmFnZS5zZXRJdGVtKGUsIG4pIDogbG9jYWxTdG9yYWdlLnNldEl0ZW0oZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHYuY29va2llTGlmZXRpbWUgPyAoJycgKyB2LmNvb2tpZUxpZmV0aW1lKS50b1VwcGVyQ2FzZSgpIDogJycsIGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyZXM6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbjogdi5jb29raWVEb21haW4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZUxpZmV0aW1lOiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2LmNvbmZpZ3MgJiYgdi5jb25maWdzLnNlY3VyZUNvb2tpZSAmJiAnaHR0cHM6JyA9PT0gbG9jYXRpb24ucHJvdG9jb2wgJiYgKGkuc2VjdXJlID0gITApLCB2LmNvbmZpZ3MgJiYgdi5jb25maWdzLnNhbWVTaXRlQ29va2llICYmICdodHRwczonID09PSBsb2NhdGlvbi5wcm90b2NvbCAmJiAoaS5zYW1lU2l0ZSA9IGsuU0FNRV9TSVRFX1ZBTFVFU1t2LmNvbmZpZ3Muc2FtZVNpdGVDb29raWUudG9VcHBlckNhc2UoKV0gfHwgJ0xheCcpLCBVLnNldChlLCBuLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5yZW1vdmVDb29raWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHYudXNlTG9jYWxTdG9yYWdlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSB2LnNlc3Npb25Db29raWVOYW1lID8gc2Vzc2lvblN0b3JhZ2UucmVtb3ZlSXRlbShlKSA6IGxvY2FsU3RvcmFnZS5yZW1vdmVJdGVtKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7IGRvbWFpbjogdi5jb29raWVEb21haW4gfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2LmNvbmZpZ3MgJiYgdi5jb25maWdzLnNlY3VyZUNvb2tpZSAmJiAnaHR0cHM6JyA9PT0gbG9jYXRpb24ucHJvdG9jb2wgJiYgKHQuc2VjdXJlID0gITApLCB2LmNvbmZpZ3MgJiYgdi5jb25maWdzLnNhbWVTaXRlQ29va2llICYmICdodHRwczonID09PSBsb2NhdGlvbi5wcm90b2NvbCAmJiAodC5zYW1lU2l0ZSA9IGsuU0FNRV9TSVRFX1ZBTFVFU1t2LmNvbmZpZ3Muc2FtZVNpdGVDb29raWUudG9VcHBlckNhc2UoKV0gfHwgJ0xheCcpLCBVLnJlbW92ZShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5yZXNldFN0YXRlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPyB2Ll9tZXJnZVNlcnZlclN0YXRlKGUpIDogcygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll9pc0FsbG93ZWREb25lID0gITEsIHYuX2lzQWxsb3dlZEZsYWcgPSAhMSwgdi5pc0FsbG93ZWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdi5faXNBbGxvd2VkRG9uZSB8fCAodi5faXNBbGxvd2VkRG9uZSA9ICEwLCAodi5jb29raWVSZWFkKHYuY29va2llTmFtZSkgfHwgdi5jb29raWVXcml0ZSh2LmNvb2tpZU5hbWUsICdUJywgMSkpICYmICh2Ll9pc0FsbG93ZWRGbGFnID0gITApKSwgJ1QnID09PSB2LmNvb2tpZVJlYWQodi5jb29raWVOYW1lKSAmJiB2LnJlbW92ZUNvb2tpZSh2LmNvb2tpZU5hbWUpLCB2Ll9pc0FsbG93ZWRGbGFnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2LnNldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuX3NldE1hcmtldGluZ0Nsb3VkRmllbGRzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll91c2Uxc3RQYXJ0eU1hcmtldGluZ0Nsb3VkU2VydmVyID0gITEsIHYuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5tYXJrZXRpbmdDbG91ZFNlcnZlciAmJiB2Lm1hcmtldGluZ0Nsb3VkU2VydmVyLmluZGV4T2YoJy5kZW1kZXgubmV0JykgPCAwICYmICh2Ll91c2Uxc3RQYXJ0eU1hcmtldGluZ0Nsb3VkU2VydmVyID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB2Ll9nZXRBdWRpZW5jZU1hbmFnZXJVUkxEYXRhKCdfc2V0TWFya2V0aW5nQ2xvdWRGaWVsZHMnKSwgbiA9IGEudXJsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuX2dldFJlbW90ZUZpZWxkKEwsIG4sIGUsIHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgWiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbZV0gPSB2Ll9nZXRGaWVsZChlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIC0xICE9PSB0LmluZGV4T2YoJ01DT1BUT1VUJykgPyB2LmlzT3B0ZWRPdXQoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5NQ09QVE9VVCA9IHQsIGUoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbnVsbCwgITApIDogZShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5nZXRWaXNpdG9yVmFsdWVzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ01JRDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm46IHYuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzOiBbITBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogdgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ09QVE9VVDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm46IHYuaXNPcHRlZE91dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3M6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiB2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUlEOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbjogdi5nZXRBbmFseXRpY3NWaXNpdG9ySUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzOiBbITBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogdgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUxIOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbjogdi5nZXRBdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzOiBbITBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogdgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuOiB2LmdldEF1ZGllbmNlTWFuYWdlckJsb2IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzOiBbITBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogdgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA9IHQgJiYgdC5sZW5ndGggPyBDLnBsdWNrKGEsIHQpIDogYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgLTEgPT09IHQuaW5kZXhPZignTUNBSUQnKSA/IFooZSwgdCkgOiBxKG4sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll9jdXJyZW50Q3VzdG9tZXJJRHMgPSB7fSwgdi5fY3VzdG9tZXJJRHNIYXNoQ2hhbmdlZCA9ICExLCB2Ll9uZXdDdXN0b21lcklEc0hhc2ggPSAnJywgdi5zZXRDdXN0b21lcklEcyA9IGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXYuaXNPcHRlZE91dCgpICYmIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUMuaXNPYmplY3QodCkgfHwgQy5pc09iamVjdEVtcHR5KHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGksIG8sIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuIGluICh2Ll9yZWFkVmlzaXRvcigpLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEYobikgJiYgKHYuX2N1cnJlbnRDdXN0b21lcklEcy5kYXRhU291cmNlcyA9IHYuX2N1cnJlbnRDdXN0b21lcklEcy5kYXRhU291cmNlcyB8fCB7fSwgYSA9IChpID0gdFtuXSkuaGFzT3duUHJvcGVydHkoJ2hhc2hUeXBlJykgPyBpLmhhc2hUeXBlIDogYSwgaSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT09IGUoaSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpLmlkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShzID0gUmUoamUoaS5pZCksIGEpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmlkID0gcywgYy5oYXNoVHlwZSA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5pZCA9IGkuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT0gaS5hdXRoU3RhdGUgJiYgKGMuYXV0aFN0YXRlID0gaS5hdXRoU3RhdGUpLCB2Ll9jdXJyZW50Q3VzdG9tZXJJRHMuZGF0YVNvdXJjZXNbbl0gPSBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEocyA9IFJlKGplKGkpLCBhKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2Ll9jdXJyZW50Q3VzdG9tZXJJRHMuZGF0YVNvdXJjZXNbbl0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNoVHlwZTogYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2Ll9jdXJyZW50Q3VzdG9tZXJJRHMuZGF0YVNvdXJjZXNbbl0gPSB7IGlkOiBpIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSB2LmdldEN1c3RvbWVySURzKCEwKSwgdSA9IHYuX2dldEZpZWxkKCdNQ0NJREgnKSwgZCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobyBpbiAodSB8fCAodSA9IDApLCBsKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IGxbb107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghQy5pc09iamVjdEVtcHR5KHApKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuIGluIHApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRihuKSAmJiAoZCArPSAoZCA/ICd8JyA6ICcnKSArIG4gKyAnfCcgKyAoKGkgPSBwW25dKS5pZCA/IGkuaWQgOiAnJykgKyAoaS5hdXRoU3RhdGUgPyBpLmF1dGhTdGF0ZSA6ICcnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuX25ld0N1c3RvbWVySURzSGFzaCA9IFN0cmluZyh2Ll9oYXNoKGQpKSwgdi5fbmV3Q3VzdG9tZXJJRHNIYXNoICE9PSB1ICYmICh2Ll9jdXN0b21lcklEc0hhc2hDaGFuZ2VkID0gITAsIHYuX21hcEN1c3RvbWVySURzKHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5zeW5jSWRlbnRpdHkgPSBmdW5jdGlvbiAodCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF2LmlzT3B0ZWRPdXQoKSAmJiB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFDLmlzT2JqZWN0KHQpIHx8IEMuaXNPYmplY3RFbXB0eSh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCBpLCBvLCBzLCBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiBpbiAodi5fcmVhZFZpc2l0b3IoKSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChGKG4pICYmICh2Ll9jdXJyZW50Q3VzdG9tZXJJRHMubmFtZVNwYWNlcyA9IHYuX2N1cnJlbnRDdXN0b21lcklEcy5uYW1lU3BhY2VzIHx8IHt9LCBhID0gKGkgPSB0W25dKS5oYXNPd25Qcm9wZXJ0eSgnaGFzaFR5cGUnKSA/IGkuaGFzaFR5cGUgOiBhLCBpICYmICdvYmplY3QnID09PSBlKGkpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpLmlkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEobyA9IFJlKGplKGkuaWQpLCBhKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuaWQgPSBvLCBsLmhhc2hUeXBlID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5pZCA9IGkuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IGkuYXV0aFN0YXRlICYmIChsLmF1dGhTdGF0ZSA9IGkuYXV0aFN0YXRlKSwgaS5kYXRhU291cmNlICYmICh2Ll9jdXJyZW50Q3VzdG9tZXJJRHMuZGF0YVNvdXJjZXMgPSB2Ll9jdXJyZW50Q3VzdG9tZXJJRHMuZGF0YVNvdXJjZXMgfHwge30sIHMgPSBpLmRhdGFTb3VyY2UsIHYuX2N1cnJlbnRDdXN0b21lcklEcy5kYXRhU291cmNlc1tzXSA9IGwpLCB2Ll9jdXJyZW50Q3VzdG9tZXJJRHMubmFtZVNwYWNlc1tuXSA9IGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHYuZ2V0Q3VzdG9tZXJJRHMoITApLCBkID0gdi5fZ2V0RmllbGQoJ01DQ0lESCcpLCBwID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjIGluIChkIHx8IChkID0gJzAnKSwgdSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSB1W2NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUMuaXNPYmplY3RFbXB0eShoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiBpbiBoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEYobikgJiYgKHAgKz0gKHAgPyAnfCcgOiAnJykgKyBuICsgJ3wnICsgKChpID0gaFtuXSkuaWQgPyBpLmlkIDogJycpICsgKGkuYXV0aFN0YXRlID8gaS5hdXRoU3RhdGUgOiAnJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2Ll9uZXdDdXN0b21lcklEc0hhc2ggPSBTdHJpbmcodi5faGFzaChwKSksIHYuX25ld0N1c3RvbWVySURzSGFzaCAhPT0gZCAmJiAodi5fY3VzdG9tZXJJRHNIYXNoQ2hhbmdlZCA9ICEwLCB2Ll9tYXBDdXN0b21lcklEcyhyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuZ2V0Q3VzdG9tZXJJRHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5fcmVhZFZpc2l0b3IoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBhLCBuID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhU291cmNlczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWVTcGFjZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IHYuX2N1cnJlbnRDdXN0b21lcklEcy5kYXRhU291cmNlczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCBpbiByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEYodCkgJiYgKChhID0gclt0XSkuaWQgJiYgKG4uZGF0YVNvdXJjZXNbdF0gfHwgKG4uZGF0YVNvdXJjZXNbdF0gPSB7fSksIG4uZGF0YVNvdXJjZXNbdF0uaWQgPSBhLmlkLCBudWxsICE9IGEuYXV0aFN0YXRlID8gbi5kYXRhU291cmNlc1t0XS5hdXRoU3RhdGUgPSBhLmF1dGhTdGF0ZSA6IG4uZGF0YVNvdXJjZXNbdF0uYXV0aFN0YXRlID0gSS5BdXRoU3RhdGUuVU5LTk9XTiwgYS5oYXNoVHlwZSAmJiAobi5kYXRhU291cmNlc1t0XS5oYXNoVHlwZSA9IGEuaGFzaFR5cGUpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHYuX2N1cnJlbnRDdXN0b21lcklEcy5uYW1lU3BhY2VzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0IGluIGkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRih0KSAmJiAoKGEgPSBpW3RdKS5pZCAmJiAobi5uYW1lU3BhY2VzW3RdIHx8IChuLm5hbWVTcGFjZXNbdF0gPSB7fSksIG4ubmFtZVNwYWNlc1t0XS5pZCA9IGEuaWQsIG51bGwgIT0gYS5hdXRoU3RhdGUgPyBuLm5hbWVTcGFjZXNbdF0uYXV0aFN0YXRlID0gYS5hdXRoU3RhdGUgOiBuLm5hbWVTcGFjZXNbdF0uYXV0aFN0YXRlID0gSS5BdXRoU3RhdGUuVU5LTk9XTiwgYS5oYXNoVHlwZSAmJiAobi5uYW1lU3BhY2VzW3RdLmhhc2hUeXBlID0gYS5oYXNoVHlwZSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gbiA6IG4uZGF0YVNvdXJjZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuc2V0QW5hbHl0aWNzVmlzaXRvcklEID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuX3NldEFuYWx5dGljc0ZpZWxkcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5nZXRBbmFseXRpY3NWaXNpdG9ySUQgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0ZS5pc1RyYWNraW5nU2VydmVyUG9wdWxhdGVkKCkgJiYgIWEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuX2NhbGxDYWxsYmFjayhlLCBbJyddKSwgJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEgfHwgKG4gPSB2LmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5nZXRBbmFseXRpY3NWaXNpdG9ySUQoZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgbiB8fCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBhID8gdi5tYXJrZXRpbmdDbG91ZFNlcnZlciA6IHYudHJhY2tpbmdTZXJ2ZXIsIGkgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LmxvYWRTU0wgJiYgKGEgPyB2Lm1hcmtldGluZ0Nsb3VkU2VydmVyU2VjdXJlICYmIChyID0gdi5tYXJrZXRpbmdDbG91ZFNlcnZlclNlY3VyZSkgOiB2LnRyYWNraW5nU2VydmVyU2VjdXJlICYmIChyID0gdi50cmFja2luZ1NlcnZlclNlY3VyZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSAnaHR0cCcgKyAodi5sb2FkU1NMID8gJ3MnIDogJycpICsgJzovLycgKyByICsgJy9pZCcsIGMgPSAnZF92aXNpZF92ZXI9JyArIHYudmVyc2lvbiArICcmbWNvcmdpZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KHYubWFya2V0aW5nQ2xvdWRPcmdJRCkgKyAobiA/ICcmbWlkPScgKyBlbmNvZGVVUklDb21wb25lbnQobikgOiAnJykgKyAodi5pZFN5bmNEaXNhYmxlM3JkUGFydHlTeW5jaW5nIHx8IHYuZGlzYWJsZVRoaXJkUGFydHlDb29raWVzID8gJyZkX2NvcHBhPXRydWUnIDogJycpLCBsID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzX2NfaWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuX2luLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdfc2V0JyArIChhID8gJ01hcmtldGluZ0Nsb3VkJyA6ICdBbmFseXRpY3MnKSArICdGaWVsZHMnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gcyArICc/JyArIGMgKyAnJmNhbGxiYWNrPXNfY19pbCU1QicgKyB2Ll9pbiArICclNUQuX3NldCcgKyAoYSA/ICdNYXJrZXRpbmdDbG91ZCcgOiAnQW5hbHl0aWNzJykgKyAnRmllbGRzJywgby5jb3JzVXJsID0gcyArICc/JyArIGMsIG8uY2FsbGJhY2sgPSBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby51cmwgPSBpLCB2Ll9nZXRSZW1vdGVGaWVsZChhID8gTCA6IFIsIGksIGUsIHQsIG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2LmdldEF1ZGllbmNlTWFuYWdlckxvY2F0aW9uSGludCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodi5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50KGUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdi5fZ2V0RmllbGQoUik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhICYmIHRlLmlzVHJhY2tpbmdTZXJ2ZXJQb3B1bGF0ZWQoKSAmJiAoYSA9IHYuZ2V0QW5hbHl0aWNzVmlzaXRvcklEKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50KGUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBhIHx8ICF0ZS5pc1RyYWNraW5nU2VydmVyUG9wdWxhdGVkKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB2Ll9nZXRBdWRpZW5jZU1hbmFnZXJVUkxEYXRhKCksIHIgPSBuLnVybDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuX2dldFJlbW90ZUZpZWxkKCdNQ0FBTUxIJywgciwgZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2LmdldExvY2F0aW9uSGludCA9IHYuZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50LCB2LmdldEF1ZGllbmNlTWFuYWdlckJsb2IgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHYuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LmdldEF1ZGllbmNlTWFuYWdlckJsb2IoZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB2Ll9nZXRGaWVsZChSKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWEgJiYgdGUuaXNUcmFja2luZ1NlcnZlclBvcHVsYXRlZCgpICYmIChhID0gdi5nZXRBbmFseXRpY3NWaXNpdG9ySUQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5nZXRBdWRpZW5jZU1hbmFnZXJCbG9iKGUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBhIHx8ICF0ZS5pc1RyYWNraW5nU2VydmVyUG9wdWxhdGVkKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB2Ll9nZXRBdWRpZW5jZU1hbmFnZXJVUkxEYXRhKCksIHIgPSBuLnVybDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuX2N1c3RvbWVySURzSGFzaENoYW5nZWQgJiYgdi5fc2V0RmllbGRFeHBpcmUoeCwgLTEpLCB2Ll9nZXRSZW1vdGVGaWVsZCh4LCByLCBlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQgPSAnJywgdi5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkID0ge30sIHYuX3N1cHBsZW1lbnRhbERhdGFJRExhc3QgPSAnJywgdi5fc3VwcGxlbWVudGFsRGF0YUlETGFzdENvbnN1bWVkID0ge30sIHYuZ2V0U3VwcGxlbWVudGFsRGF0YUlEID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQgfHwgdCB8fCAodi5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudCA9IHYuX2dlbmVyYXRlSUQoMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB2Ll9zdXBwbGVtZW50YWxEYXRhSURDdXJyZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuX3N1cHBsZW1lbnRhbERhdGFJRExhc3QgJiYgIXYuX3N1cHBsZW1lbnRhbERhdGFJRExhc3RDb25zdW1lZFtlXSA/IChhID0gdi5fc3VwcGxlbWVudGFsRGF0YUlETGFzdCwgdi5fc3VwcGxlbWVudGFsRGF0YUlETGFzdENvbnN1bWVkW2VdID0gITApIDogYSAmJiAodi5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkW2VdICYmICh2Ll9zdXBwbGVtZW50YWxEYXRhSURMYXN0ID0gdi5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudCwgdi5fc3VwcGxlbWVudGFsRGF0YUlETGFzdENvbnN1bWVkID0gdi5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkLCB2Ll9zdXBwbGVtZW50YWxEYXRhSURDdXJyZW50ID0gYSA9IHQgPyAnJyA6IHYuX2dlbmVyYXRlSUQoMSksIHYuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnRDb25zdW1lZCA9IHt9KSwgYSAmJiAodi5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkW2VdID0gITApKSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFggPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5fbGliZXJhdGVkT3B0T3V0ID0gbnVsbCwgdi5nZXRPcHRPdXQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB2Ll9nZXRBdWRpZW5jZU1hbmFnZXJVUkxEYXRhKCdfc2V0TWFya2V0aW5nQ2xvdWRGaWVsZHMnKSwgbiA9IGEudXJsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdi5fZ2V0UmVtb3RlRmllbGQoJ01DT1BUT1VUJywgbiwgZSwgdCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodi5fcmVnaXN0ZXJDYWxsYmFjaygnbGliZXJhdGVkT3B0T3V0JywgZSksIG51bGwgIT09IHYuX2xpYmVyYXRlZE9wdE91dCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdi5fY2FsbEFsbENhbGxiYWNrcygnbGliZXJhdGVkT3B0T3V0JywgW3YuX2xpYmVyYXRlZE9wdE91dF0pLCBYID0gITEsIHYuX2xpYmVyYXRlZE9wdE91dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChYKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAnbGliZXJhdGVkR2V0T3B0T3V0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmNvcnNVcmwgPSBhLmNvcnNVcmwucmVwbGFjZSgvXC5kZW1kZXhcLm5ldFwvaWRcPy8sICcuZGVtZGV4Lm5ldC9vcHRPdXRTdGF0dXM/JyksIGEuY2FsbGJhY2sgPSBbcl0sIF9bcl0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSBPYmplY3QoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIGEsIG4gPSBDLnBhcnNlT3B0T3V0KGUsIHQsIEIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gbi5vcHRPdXQsIGEgPSAxMDAwICogbi5kX290dGwsIHYuX2xpYmVyYXRlZE9wdE91dCA9IHQsIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5fbGliZXJhdGVkT3B0T3V0ID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuX2NhbGxBbGxDYWxsYmFja3MoJ2xpYmVyYXRlZE9wdE91dCcsIFt0XSksIFggPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEsuZmlyZUNPUlMoYSksIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuaXNPcHRlZE91dCA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0IHx8ICh0ID0gSS5PcHRPdXQuR0xPQkFMKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdi5nZXRPcHRPdXQoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEgPT09IEkuT3B0T3V0LkdMT0JBTCB8fCBhLmluZGV4T2YodCkgPj0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2Ll9jYWxsQ2FsbGJhY2soZSwgW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPyBuID09PSBJLk9wdE91dC5HTE9CQUwgfHwgbi5pbmRleE9mKHQpID49IDAgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZWUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJzY3JpYmVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrczogW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5vblJlY2VpdmVFY2lkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWUuc3Vic2NyaWJlZCA9ICEwLCBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGUgJiYgZWUuY2FsbGJhY2tzLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX2ZpZWxkcyA9IG51bGwsIHYuX2ZpZWxkc0V4cGlyZWQgPSBudWxsLCB2Ll9oYXNoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBhID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCA9IDA7IHQgPCBlLmxlbmd0aDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gKGEgPDwgNSkgLSBhICsgZS5jaGFyQ29kZUF0KHQpLCBhICY9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5fZ2VuZXJhdGVJRCA9IEcsIHYuX2dlbmVyYXRlTG9jYWxNSUQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHYuX2dlbmVyYXRlSUQoMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmUuaXNDbGllbnRTaWRlTWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQgPSAhMCwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5fY2FsbGJhY2tMaXN0ID0gbnVsbCwgdi5fY2FsbENhbGxiYWNrID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZSA/IGUuYXBwbHkoRCwgdCkgOiBlWzFdLmFwcGx5KGVbMF0sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll9yZWdpc3RlckNhbGxiYWNrID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgKG51bGwgPT0gdi5fY2FsbGJhY2tMaXN0ICYmICh2Ll9jYWxsYmFja0xpc3QgPSB7fSksIG51bGwgPT0gdi5fY2FsbGJhY2tMaXN0W2VdICYmICh2Ll9jYWxsYmFja0xpc3RbZV0gPSBbXSksIHYuX2NhbGxiYWNrTGlzdFtlXS5wdXNoKHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5fY2FsbEFsbENhbGxiYWNrcyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSB2Ll9jYWxsYmFja0xpc3QpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHYuX2NhbGxiYWNrTGlzdFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGEubGVuZ3RoID4gMDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2Ll9jYWxsQ2FsbGJhY2soYS5zaGlmdCgpLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5fYWRkUXVlcnlzdHJpbmdQYXJhbSA9IGZ1bmN0aW9uIChlLCB0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGVuY29kZVVSSUNvbXBvbmVudCh0KSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudChhKSwgaSA9IHRlLnBhcnNlSGFzaChlKSwgbyA9IHRlLmhhc2hsZXNzVXJsKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC0xID09PSBvLmluZGV4T2YoJz8nKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyArICc/JyArIHIgKyBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBvLnNwbGl0KCc/JyksIGMgPSBzWzBdICsgJz8nLCBsID0gc1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjICsgdGUuYWRkUXVlcnlQYXJhbUF0TG9jYXRpb24obCwgciwgbikgKyBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll9leHRyYWN0UGFyYW1Gcm9tVXJpID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IFJlZ0V4cCgnW1xcPyYjXScgKyB0ICsgJz0oW14mI10qKScpLmV4ZWMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSAmJiBhLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGVjb2RlVVJJQ29tcG9uZW50KGFbMV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll9wYXJzZUFkb2JlTWNGcm9tVXJsID0gaSgkLkFET0JFX01DKSwgdi5fcGFyc2VBZG9iZU1jU2RpZEZyb21VcmwgPSBpKCQuQURPQkVfTUNfU0RJRCksIHYuX2F0dGVtcHRUb1BvcHVsYXRlU2RpZEZyb21VcmwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB2Ll9wYXJzZUFkb2JlTWNTZGlkRnJvbVVybChlKSwgbiA9IDEwMDAwMDAwMDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhICYmIGEuVFMgJiYgKG4gPSB0ZS5nZXRUaW1lc3RhbXBJblNlY29uZHMoKSAtIGEuVFMpLCBhICYmIGEuU0RJRCAmJiBhLk1DT1JHSUQgPT09IHQgJiYgbiA8IHYuc2RpZFBhcmFtRXhwaXJ5ICYmICh2Ll9zdXBwbGVtZW50YWxEYXRhSURDdXJyZW50ID0gYS5TRElELCB2Ll9zdXBwbGVtZW50YWxEYXRhSURDdXJyZW50Q29uc3VtZWQuU0RJRF9VUkxfUEFSQU0gPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX2F0dGVtcHRUb1BvcHVsYXRlSWRzRnJvbVVybCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdi5fcGFyc2VBZG9iZU1jRnJvbVVybCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZS5UUykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGUuZ2V0VGltZXN0YW1wSW5TZWNvbmRzKCkgLSBlLlRTOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNYXRoLmZsb29yKGEgLyA2MCkgPiAkLkFET0JFX01DX1RUTF9JTl9NSU4gfHwgZS5NQ09SR0lEICE9PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5fbWVyZ2VTZXJ2ZXJTdGF0ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ZS5pc09iamVjdChlKSA/IGUgOiBKU09OLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlKSlbdi5tYXJrZXRpbmdDbG91ZE9yZ0lEXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW3YubWFya2V0aW5nQ2xvdWRPcmdJRF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZS5pc09iamVjdChlKSAmJiB2LnNldEN1c3RvbWVySURzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0LmN1c3RvbWVySURzKSwgcyh0LnNkaWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ2BzZXJ2ZXJTdGF0ZWAgaGFzIGFuIGludmFsaWQgZm9ybWF0LicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5fdGltZW91dCA9IG51bGwsIHYuX2xvYWREYXRhID0gZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB2Ll9hZGRRdWVyeXN0cmluZ1BhcmFtKHQsICdkX2ZpZWxkZ3JvdXAnLCBlLCAxKSwgbi51cmwgPSB2Ll9hZGRRdWVyeXN0cmluZ1BhcmFtKG4udXJsLCAnZF9maWVsZGdyb3VwJywgZSwgMSksIG4uY29yc1VybCA9IHYuX2FkZFF1ZXJ5c3RyaW5nUGFyYW0obi5jb3JzVXJsLCAnZF9maWVsZGdyb3VwJywgZSwgMSksIHJlLmZpZWxkR3JvdXBPYmpbZV0gPSAhMCwgbiA9PT0gT2JqZWN0KG4pICYmIG4uY29yc1VybCAmJiAnWE1MSHR0cFJlcXVlc3QnID09PSBLLmNvcnNNZXRhZGF0YS5jb3JzVHlwZSAmJiBLLmZpcmVDT1JTKG4sIGEsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll9jbGVhclRpbWVvdXQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSB2Ll90aW1lb3V0ICYmIHYuX3RpbWVvdXRbZV0gJiYgKGNsZWFyVGltZW91dCh2Ll90aW1lb3V0W2VdKSwgdi5fdGltZW91dFtlXSA9IDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll9zZXR0aW5nc0RpZ2VzdCA9IDAsIHYuX2dldFNldHRpbmdzRGlnZXN0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF2Ll9zZXR0aW5nc0RpZ2VzdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdi52ZXJzaW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuYXVkaWVuY2VNYW5hZ2VyU2VydmVyICYmIChlICs9ICd8JyArIHYuYXVkaWVuY2VNYW5hZ2VyU2VydmVyKSwgdi5hdWRpZW5jZU1hbmFnZXJTZXJ2ZXJTZWN1cmUgJiYgKGUgKz0gJ3wnICsgdi5hdWRpZW5jZU1hbmFnZXJTZXJ2ZXJTZWN1cmUpLCB2Ll9zZXR0aW5nc0RpZ2VzdCA9IHYuX2hhc2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdi5fc2V0dGluZ3NEaWdlc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX3JlYWRWaXNpdG9yRG9uZSA9ICExLCB2Ll9yZWFkVmlzaXRvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdi5fcmVhZFZpc2l0b3JEb25lKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5fcmVhZFZpc2l0b3JEb25lID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQsIGEsIG4sIHIsIGksIG8gPSB2Ll9nZXRTZXR0aW5nc0RpZ2VzdCgpLCBzID0gITEsIGMgPSB2LmNvb2tpZVJlYWQodi5jb29raWVOYW1lKSwgbCA9IG5ldyBEYXRlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgfHwgRSB8fCB2LmRpc2NhcmRUcmFja2luZ1NlcnZlckVDSUQgfHwgKGMgPSB2LmNvb2tpZVJlYWQoJC5GSVJTVF9QQVJUWV9TRVJWRVJfQ09PS0lFKSksIG51bGwgPT0gdi5fZmllbGRzICYmICh2Ll9maWVsZHMgPSB7fSksIGMgJiYgJ1QnICE9PSBjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKChjID0gYy5zcGxpdCgnfCcpKVswXS5tYXRjaCgvXltcLTAtOV0rJC8pICYmIChwYXJzZUludChjWzBdLCAxMCkgIT09IG8gJiYgKHMgPSAhMCksIGMuc2hpZnQoKSksIGMubGVuZ3RoICUgMiA9PSAxICYmIGMucG9wKCksIGUgPSAwOyBlIDwgYy5sZW5ndGg7IGUgKz0gMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAodCA9IGNbZV0uc3BsaXQoJy0nKSlbMF0sIG4gPSBjW2UgKyAxXSwgdC5sZW5ndGggPiAxID8gKHIgPSBwYXJzZUludCh0WzFdLCAxMCksIGkgPSB0WzFdLmluZGV4T2YoJ3MnKSA+IDApIDogKHIgPSAwLCBpID0gITEpLCBzICYmICgnTUNDSURIJyA9PT0gYSAmJiAobiA9ICcnKSwgciA+IDAgJiYgKHIgPSBsLmdldFRpbWUoKSAvIDEwMDAgLSA2MCkpLCBhICYmIG4gJiYgKHYuX3NldEZpZWxkKGEsIG4sIDEpLCByID4gMCAmJiAodi5fZmllbGRzWydleHBpcmUnICsgYV0gPSByICsgKGkgPyAncycgOiAnJyksIChsLmdldFRpbWUoKSA+PSAxMDAwICogciB8fCBpICYmICF2LmNvb2tpZVJlYWQodi5zZXNzaW9uQ29va2llTmFtZSkpICYmICh2Ll9maWVsZHNFeHBpcmVkIHx8ICh2Ll9maWVsZHNFeHBpcmVkID0ge30pLCB2Ll9maWVsZHNFeHBpcmVkW2FdID0gITApKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIXYuX2dldEZpZWxkKFIpICYmIHRlLmlzVHJhY2tpbmdTZXJ2ZXJQb3B1bGF0ZWQoKSAmJiAoYyA9IHYuY29va2llUmVhZCgnc192aScpKSAmJiAoKGMgPSBjLnNwbGl0KCd8JykpLmxlbmd0aCA+IDEgJiYgY1swXS5pbmRleE9mKCd2MScpID49IDAgJiYgKChlID0gKG4gPSBjWzFdKS5pbmRleE9mKCdbJykpID49IDAgJiYgKG4gPSBuLnN1YnN0cmluZygwLCBlKSksIG4gJiYgbi5tYXRjaCgkLlZBTElEX1ZJU0lUT1JfSURfUkVHRVgpICYmIHYuX3NldEZpZWxkKFIsIG4pKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX2FwcGVuZFZlcnNpb25UbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICd2VmVyc2lvbnwnICsgdi52ZXJzaW9uLCBhID0gZSA/IHYuX2dldENvb2tpZVZlcnNpb24oZSkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBZLmFyZVZlcnNpb25zRGlmZmVyZW50KGEsIHYudmVyc2lvbikgJiYgKGUgPSBlLnJlcGxhY2UoJC5WRVJTSU9OX1JFR0VYLCB0KSkgOiBlICs9IChlID8gJ3wnIDogJycpICsgdCwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5fd3JpdGVWaXNpdG9yID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQsIGEgPSB2Ll9nZXRTZXR0aW5nc0RpZ2VzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlIGluIHYuX2ZpZWxkcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGKGUpICYmIHYuX2ZpZWxkc1tlXSAmJiAnZXhwaXJlJyAhPT0gZS5zdWJzdHJpbmcoMCwgNikgJiYgKHQgPSB2Ll9maWVsZHNbZV0sIGEgKz0gKGEgPyAnfCcgOiAnJykgKyBlICsgKHYuX2ZpZWxkc1snZXhwaXJlJyArIGVdID8gJy0nICsgdi5fZmllbGRzWydleHBpcmUnICsgZV0gOiAnJykgKyAnfCcgKyB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB2Ll9hcHBlbmRWZXJzaW9uVG8oYSksIHYuY29va2llV3JpdGUodi5jb29raWVOYW1lLCBhLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5fZ2V0RmllbGQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gdi5fZmllbGRzIHx8ICF0ICYmIHYuX2ZpZWxkc0V4cGlyZWQgJiYgdi5fZmllbGRzRXhwaXJlZFtlXSA/IG51bGwgOiB2Ll9maWVsZHNbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX3NldEZpZWxkID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT0gdi5fZmllbGRzICYmICh2Ll9maWVsZHMgPSB7fSksIHYuX2ZpZWxkc1tlXSA9IHQsIGEgfHwgdi5fd3JpdGVWaXNpdG9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX2dldEZpZWxkTGlzdCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHYuX2dldEZpZWxkKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhLnNwbGl0KCcqJykgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll9zZXRGaWVsZExpc3QgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5fc2V0RmllbGQoZSwgdCA/IHQuam9pbignKicpIDogJycsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll9nZXRGaWVsZE1hcCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHYuX2dldEZpZWxkTGlzdChlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgYS5sZW5ndGg7IG4gKz0gMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgclthW25dXSA9IGFbbiArIDFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX3NldEZpZWxkTWFwID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiBpbiAociA9IFtdLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRihuKSAmJiAoci5wdXNoKG4pLCByLnB1c2godFtuXSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5fc2V0RmllbGRMaXN0KGUsIHIsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll9zZXRGaWVsZEV4cGlyZSA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG5ldyBEYXRlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnNldFRpbWUobi5nZXRUaW1lKCkgKyAxMDAwICogdCksIG51bGwgPT0gdi5fZmllbGRzICYmICh2Ll9maWVsZHMgPSB7fSksIHYuX2ZpZWxkc1snZXhwaXJlJyArIGVdID0gTWF0aC5mbG9vcihuLmdldFRpbWUoKSAvIDEwMDApICsgKGEgPyAncycgOiAnJyksIHQgPCAwID8gKHYuX2ZpZWxkc0V4cGlyZWQgfHwgKHYuX2ZpZWxkc0V4cGlyZWQgPSB7fSksIHYuX2ZpZWxkc0V4cGlyZWRbZV0gPSAhMCkgOiB2Ll9maWVsZHNFeHBpcmVkICYmICh2Ll9maWVsZHNFeHBpcmVkW2VdID0gITEpLCBhICYmICh2LmNvb2tpZVJlYWQodi5zZXNzaW9uQ29va2llTmFtZSkgfHwgdi5jb29raWVXcml0ZSh2LnNlc3Npb25Db29raWVOYW1lLCAnMScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5fZmluZFZpc2l0b3JJRCA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiAoJ29iamVjdCcgPT09IGUodCkgJiYgKHQgPSB0LmRfbWlkID8gdC5kX21pZCA6IHQudmlzaXRvcklEID8gdC52aXNpdG9ySUQgOiB0LmlkID8gdC5pZCA6IHQudXVpZCA/IHQudXVpZCA6ICcnICsgdCksIHQgJiYgJ05PVEFSR0VUJyA9PT0gKHQgPSB0LnRvVXBwZXJDYXNlKCkpICYmICh0ID0gQiksIHQgJiYgKHQgPT09IEIgfHwgdC5tYXRjaCgkLlZBTElEX1ZJU0lUT1JfSURfUkVHRVgpKSB8fCAodCA9ICcnKSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX3NldEZpZWxkcyA9IGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodi5fY2xlYXJUaW1lb3V0KHQpLCBudWxsICE9IHYuX2xvYWRpbmcgJiYgKHYuX2xvYWRpbmdbdF0gPSAhMSksIHJlLmZpZWxkR3JvdXBPYmpbdF0gJiYgcmUuc2V0U3RhdGUodCwgITEpLCB0ID09PSBWKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgITAgIT09IHJlLmlzQ2xpZW50U2lkZU1hcmtldGluZ0Nsb3VkVmlzaXRvcklEICYmIChyZS5pc0NsaWVudFNpZGVNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCA9ICExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHYuX2dldEZpZWxkKEwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbiB8fCB2Lm92ZXJ3cml0ZUNyb3NzRG9tYWluTUNJREFuZEFJRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShuID0gJ29iamVjdCcgPT09IGUoYSkgJiYgYS5taWQgPyBhLm1pZCA6IHYuX2ZpbmRWaXNpdG9ySUQoYSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodi5fdXNlMXN0UGFydHlNYXJrZXRpbmdDbG91ZFNlcnZlciAmJiAhdi50cmllZDFzdFBhcnR5TWFya2V0aW5nQ2xvdWRTZXJ2ZXIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYudHJpZWQxc3RQYXJ0eU1hcmtldGluZ0Nsb3VkU2VydmVyID0gITAsIHZvaWQgdi5nZXRBbmFseXRpY3NWaXNpdG9ySUQobnVsbCwgITEsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB2Ll9nZW5lcmF0ZUxvY2FsTUlEKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5fc2V0RmllbGQoTCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgbiAhPT0gQiB8fCAobiA9ICcnKSwgJ29iamVjdCcgPT09IGUoYSkgJiYgKChhLmRfcmVnaW9uIHx8IGEuZGNzX3JlZ2lvbiB8fCBhLmRfYmxvYiB8fCBhLmJsb2IpICYmIHYuX3NldEZpZWxkcyhqLCBhKSwgdi5fdXNlMXN0UGFydHlNYXJrZXRpbmdDbG91ZFNlcnZlciAmJiBhLm1pZCAmJiB2Ll9zZXRGaWVsZHMoTSwgeyBpZDogYS5pZCB9KSksIHYuX2NhbGxBbGxDYWxsYmFja3MoTCwgW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID09PSBqICYmICdvYmplY3QnID09PSBlKGEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSA2MDQ4MDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSBhLmlkX3N5bmNfdHRsICYmIGEuaWRfc3luY190dGwgJiYgKHIgPSBwYXJzZUludChhLmlkX3N5bmNfdHRsLCAxMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gYWUuZ2V0UmVnaW9uQW5kQ2hlY2tJZkNoYW5nZWQoYSwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5fY2FsbEFsbENhbGxiYWNrcygnTUNBQU1MSCcsIFtpXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB2Ll9nZXRGaWVsZCh4KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoYS5kX2Jsb2IgfHwgYS5ibG9iKSAmJiAoKG8gPSBhLmRfYmxvYikgfHwgKG8gPSBhLmJsb2IpLCB2Ll9zZXRGaWVsZEV4cGlyZSh4LCByKSwgdi5fc2V0RmllbGQoeCwgbykpLCBvIHx8IChvID0gJycpLCB2Ll9jYWxsQWxsQ2FsbGJhY2tzKHgsIFtvXSksICFhLmVycm9yX21zZyAmJiB2Ll9uZXdDdXN0b21lcklEc0hhc2ggJiYgdi5fc2V0RmllbGQoJ01DQ0lESCcsIHYuX25ld0N1c3RvbWVySURzSGFzaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9PT0gTSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gdi5fZ2V0RmllbGQoUik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyAmJiAhdi5vdmVyd3JpdGVDcm9zc0RvbWFpbk1DSURBbmRBSUQgfHwgKChzID0gdi5fZmluZFZpc2l0b3JJRChhKSkgPyBzICE9PSBCICYmIHYuX3NldEZpZWxkRXhwaXJlKHgsIC0xKSA6IHMgPSBCLCB2Ll9zZXRGaWVsZChSLCBzKSksIHMgJiYgcyAhPT0gQiB8fCAocyA9ICcnKSwgdi5fY2FsbEFsbENhbGxiYWNrcyhSLCBbc10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHYuaWRTeW5jRGlzYWJsZVN5bmNzIHx8IHYuZGlzYWJsZUlkU3luY3MpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWUuaWRDYWxsTm90UHJvY2Vzc3NlZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWUuaWRDYWxsTm90UHJvY2Vzc3NlZCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5pYnMgPSBhLmlicywgYy5zdWJkb21haW4gPSBhLnN1YmRvbWFpbiwgYWUucHJvY2Vzc0lEQ2FsbERhdGEoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA9PT0gT2JqZWN0KGEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwsIHU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCgpICYmIHYuaXNBbGxvd2VkKCkgJiYgKGwgPSB2Ll9nZXRGaWVsZCgnTUNPUFRPVVQnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBDLnBhcnNlT3B0T3V0KGEsIGwsIEIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBwLm9wdE91dCwgdSA9IHAuZF9vdHRsLCB2Ll9zZXRGaWVsZEV4cGlyZSgnTUNPUFRPVVQnLCB1LCAhMCksIHYuX3NldEZpZWxkKCdNQ09QVE9VVCcsIGwpLCB2Ll9jYWxsQWxsQ2FsbGJhY2tzKCdNQ09QVE9VVCcsIFtsXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX2xvYWRpbmcgPSBudWxsLCB2Ll9nZXRSZW1vdGVGaWVsZCA9IGZ1bmN0aW9uIChlLCB0LCBhLCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSwgbyA9ICcnLCBzID0gdGUuaXNGaXJzdFBhcnR5QW5hbHl0aWNzVmlzaXRvcklEQ2FsbChlKSwgYyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBQU1MSDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNQjogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQoKSAmJiB2LmlzQWxsb3dlZCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2Ll9yZWFkVmlzaXRvcigpLCAhKCEobyA9IHYuX2dldEZpZWxkKGUsICEwID09PSBjW2VdKSkgfHwgdi5fZmllbGRzRXhwaXJlZCAmJiB2Ll9maWVsZHNFeHBpcmVkW2VdKSB8fCB2LmRpc2FibGVUaGlyZFBhcnR5Q2FsbHMgJiYgIXMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gfHwgKGUgPT09IEwgPyAodi5fcmVnaXN0ZXJDYWxsYmFjayhlLCBhKSwgbyA9IHYuX2dlbmVyYXRlTG9jYWxNSUQoKSwgdi5zZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRChvKSkgOiBlID09PSBSID8gKHYuX3JlZ2lzdGVyQ2FsbGJhY2soZSwgYSksIG8gPSAnJywgdi5zZXRBbmFseXRpY3NWaXNpdG9ySUQobykpIDogKG8gPSAnJywgbiA9ICEwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZSA9PT0gTCB8fCAnTUNPUFRPVVQnID09PSBlID8gaSA9IFYgOiAnTUNBQU1MSCcgPT09IGUgfHwgZSA9PT0geCA/IGkgPSBqIDogZSA9PT0gUiAmJiAoaSA9IE0pLCBpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXQgfHwgbnVsbCAhPSB2Ll9sb2FkaW5nICYmIHYuX2xvYWRpbmdbaV0gfHwgKG51bGwgPT0gdi5fbG9hZGluZyAmJiAodi5fbG9hZGluZyA9IHt9KSwgdi5fbG9hZGluZ1tpXSA9ICEwLCBpID09PSBqICYmIChTID0gMCksIHYuX2xvYWREYXRhKGksIHQsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXYuX2dldEZpZWxkKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiByZS5zZXRTdGF0ZShpLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID09PSBMID8gYSA9IHYuX2dlbmVyYXRlTG9jYWxNSUQoKSA6IGkgPT09IGogJiYgKGEgPSB7IGVycm9yX21zZzogJ3RpbWVvdXQnIH0pLCB2Ll9zZXRGaWVsZHMoaSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIpKSwgdi5fcmVnaXN0ZXJDYWxsYmFjayhlLCBhKSwgbyB8fCAodCB8fCB2Ll9zZXRGaWVsZHMoaSwgeyBpZDogQiB9KSwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgIT09IEwgJiYgZSAhPT0gUiB8fCBvICE9PSBCIHx8IChvID0gJycsIG4gPSAhMCksIGEgJiYgbiAmJiB2Ll9jYWxsQ2FsbGJhY2soYSwgW29dKSwgZSA9PT0gTCAmJiBlZS5zdWJzY3JpYmVkICYmIChlZS5jYWxsYmFja3MgJiYgZWUuY2FsbGJhY2tzLmxlbmd0aCAmJiBlZS5jYWxsYmFja3MuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuX2NhbGxDYWxsYmFjayhlLCBbb10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGVlLnN1YnNjcmliZWQgPSAhMSwgZWUuY2FsbGJhY2tzLmxlbmd0aCA9IDApLCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2Ll9zZXRNYXJrZXRpbmdDbG91ZEZpZWxkcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2Ll9yZWFkVmlzaXRvcigpLCB2Ll9zZXRGaWVsZHMoViwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX21hcEN1c3RvbWVySURzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuZ2V0QXVkaWVuY2VNYW5hZ2VyQmxvYihlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX3NldEFuYWx5dGljc0ZpZWxkcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2Ll9yZWFkVmlzaXRvcigpLCB2Ll9zZXRGaWVsZHMoTSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX3NldEF1ZGllbmNlTWFuYWdlckZpZWxkcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2Ll9yZWFkVmlzaXRvcigpLCB2Ll9zZXRGaWVsZHMoaiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuX2dldEF1ZGllbmNlTWFuYWdlclVSTERhdGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB2LmF1ZGllbmNlTWFuYWdlclNlcnZlciwgYSA9ICcnLCBuID0gdi5fZ2V0RmllbGQoTCksIHIgPSB2Ll9nZXRGaWVsZCh4LCAhMCksIGkgPSB2Ll9nZXRGaWVsZChSKSwgbyA9IGkgJiYgaSAhPT0gQiA/ICcmZF9jaWRfaWM9QVZJRCUwMScgKyBlbmNvZGVVUklDb21wb25lbnQoaSkgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2LmxvYWRTU0wgJiYgdi5hdWRpZW5jZU1hbmFnZXJTZXJ2ZXJTZWN1cmUgJiYgKHQgPSB2LmF1ZGllbmNlTWFuYWdlclNlcnZlclNlY3VyZSksIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcywgYywgbCwgdSA9IHYuZ2V0Q3VzdG9tZXJJRHMoITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGMgaW4gdSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB1W2NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFDLmlzT2JqZWN0RW1wdHkoZCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9ICduYW1lU3BhY2VzJyA9PT0gYyA/ICcmZF9jaWRfbnM9JyA6ICcmZF9jaWRfaWM9JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHMgaW4gZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRihzKSAmJiAobCA9IGRbc10sIG8gKz0gcCArIGVuY29kZVVSSUNvbXBvbmVudChzKSArICclMDEnICsgZW5jb2RlVVJJQ29tcG9uZW50KGwuaWQgPyBsLmlkIDogJycpICsgKGwuYXV0aFN0YXRlID8gJyUwMScgKyBsLmF1dGhTdGF0ZSA6ICcnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlIHx8IChlID0gJ19zZXRBdWRpZW5jZU1hbmFnZXJGaWVsZHMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9ICdodHRwJyArICh2LmxvYWRTU0wgPyAncycgOiAnJykgKyAnOi8vJyArIHQgKyAnL2lkJywgZiA9ICdkX3Zpc2lkX3Zlcj0nICsgdi52ZXJzaW9uICsgKEEgJiYgLTEgIT09IGguaW5kZXhPZignZGVtZGV4Lm5ldCcpID8gJyZnZHByPTEmZ2Rwcl9jb25zZW50PScgKyBBIDogJycpICsgKFMgJiYgLTEgIT09IGguaW5kZXhPZignZGVtZGV4Lm5ldCcpID8gJyZkX2NmPScgKyBTIDogJycpICsgJyZkX3J0YmQ9anNvbiZkX3Zlcj0yJyArICghbiAmJiB2Ll91c2Uxc3RQYXJ0eU1hcmtldGluZ0Nsb3VkU2VydmVyID8gJyZkX3ZlcmlmeT0xJyA6ICcnKSArICcmZF9vcmdpZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KHYubWFya2V0aW5nQ2xvdWRPcmdJRCkgKyAnJmRfbnNpZD0nICsgKHYuaWRTeW5jQ29udGFpbmVySUQgfHwgMCkgKyAobiA/ICcmZF9taWQ9JyArIGVuY29kZVVSSUNvbXBvbmVudChuKSA6ICcnKSArICh2LmlkU3luY0Rpc2FibGUzcmRQYXJ0eVN5bmNpbmcgfHwgdi5kaXNhYmxlVGhpcmRQYXJ0eUNvb2tpZXMgPyAnJmRfY29wcGE9dHJ1ZScgOiAnJykgKyAoITAgPT09IFAgPyAnJmRfY29vcF9zYWZlPTEnIDogITEgPT09IFAgPyAnJmRfY29vcF91bnNhZmU9MScgOiAnJykgKyAociA/ICcmZF9ibG9iPScgKyBlbmNvZGVVUklDb21wb25lbnQocikgOiAnJykgKyBvLCBnID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NfY19pbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2Ll9pbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGEgPSBoICsgJz8nICsgZiArICcmZF9jYj1zX2NfaWwlNUInICsgdi5faW4gKyAnJTVELicgKyBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JzVXJsOiBoICsgJz8nICsgZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IGcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsgdXJsOiBhIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuYXBwZW5kVmlzaXRvcklEc1RvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2Ll9nZXRGaWVsZChMKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5fZ2V0RmllbGQoUikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01DT1JHSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5tYXJrZXRpbmdDbG91ZE9yZ0lECiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2Ll9hZGRRdWVyeXN0cmluZ1BhcmFtKGUsICQuQURPQkVfTUMsIGModCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2LmFwcGVuZFN1cHBsZW1lbnRhbERhdGFJRFRvID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKHQgPSB0IHx8IHYuZ2V0U3VwcGxlbWVudGFsRGF0YUlEKHRlLmdlbmVyYXRlUmFuZG9tU3RyaW5nKCksICEwKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gYyhbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTRElEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01DT1JHSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5tYXJrZXRpbmdDbG91ZE9yZ0lECiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdi5fYWRkUXVlcnlzdHJpbmdQYXJhbShlLCAkLkFET0JFX01DX1NESUQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZUhhc2g6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmluZGV4T2YoJyMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA+IDAgPyBlLnN1YnN0cih0KSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc2hsZXNzVXJsOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5pbmRleE9mKCcjJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPiAwID8gZS5zdWJzdHIoMCwgdCkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZFF1ZXJ5UGFyYW1BdExvY2F0aW9uOiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5zcGxpdCgnJicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhID0gbnVsbCAhPSBhID8gYSA6IG4ubGVuZ3RoLCBuLnNwbGljZShhLCAwLCB0KSwgbi5qb2luKCcmJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNGaXJzdFBhcnR5QW5hbHl0aWNzVmlzaXRvcklEQ2FsbDogZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gUiAmJiAodCB8fCAodCA9IHYudHJhY2tpbmdTZXJ2ZXIpLCBhIHx8IChhID0gdi50cmFja2luZ1NlcnZlclNlY3VyZSksICEoJ3N0cmluZycgIT0gdHlwZW9mIChuID0gdi5sb2FkU1NMID8gYSA6IHQpIHx8ICFuLmxlbmd0aCkgJiYgbi5pbmRleE9mKCcybzcubmV0JykgPCAwICYmIG4uaW5kZXhPZignb210cmRjLm5ldCcpIDwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNPYmplY3Q6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJvb2xlYW4oZSAmJiBlID09PSBPYmplY3QoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZUNvb2tpZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVLnJlbW92ZShlLCB7IGRvbWFpbjogdi5jb29raWVEb21haW4gfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNUcmFja2luZ1NlcnZlclBvcHVsYXRlZDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXYudHJhY2tpbmdTZXJ2ZXIgfHwgISF2LnRyYWNraW5nU2VydmVyU2VjdXJlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFRpbWVzdGFtcEluU2Vjb25kczogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLnJvdW5kKG5ldyBEYXRlKCkuZ2V0VGltZSgpIC8gMTAwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VQaXBlRGVsaW1ldGVkS2V5VmFsdWVzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnNwbGl0KCd8JykucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdC5zcGxpdCgnPScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVthWzBdXSA9IGRlY29kZVVSSUNvbXBvbmVudChhWzFdKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2VuZXJhdGVSYW5kb21TdHJpbmc6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUgfHwgNTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gJycsIGEgPSAnYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5JzsgZS0tOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSBhW01hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIGEubGVuZ3RoKV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9ybWFsaXplQm9vbGVhbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RydWUnID09PSBlIHx8ICdmYWxzZScgIT09IGUgJiYgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZUJvb2xlYW46IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0cnVlJyA9PT0gZSB8fCAnZmFsc2UnICE9PSBlICYmIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVwbGFjZU1ldGhvZHNXaXRoRnVuY3Rpb246IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmhhc093blByb3BlcnR5KGEpICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGVbYV0gJiYgKGVbYV0gPSB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5faGVscGVycyA9IHRlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWUgPSBKKHYsIEkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2Ll9kZXN0aW5hdGlvblB1Ymxpc2hpbmcgPSBhZSwgdi50aW1lb3V0TWV0cmljc0xvZyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbmUsIHJlID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQ2xpZW50U2lkZU1hcmtldGluZ0Nsb3VkVmlzaXRvcklEOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DSURDYWxsVGltZWRPdXQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQW5hbHl0aWNzSURDYWxsVGltZWRPdXQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUFNSURDYWxsVGltZWRPdXQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRHcm91cE9iajoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U3RhdGU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhMSA9PT0gdCA/ICEwICE9PSB0aGlzLk1DSURDYWxsVGltZWRPdXQgJiYgKHRoaXMuTUNJRENhbGxUaW1lZE91dCA9ICExKSA6IHRoaXMuTUNJRENhbGxUaW1lZE91dCA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgITEgPT09IHQgPyAhMCAhPT0gdGhpcy5BbmFseXRpY3NJRENhbGxUaW1lZE91dCAmJiAodGhpcy5BbmFseXRpY3NJRENhbGxUaW1lZE91dCA9ICExKSA6IHRoaXMuQW5hbHl0aWNzSURDYWxsVGltZWRPdXQgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgajoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICExID09PSB0ID8gITAgIT09IHRoaXMuQUFNSURDYWxsVGltZWRPdXQgJiYgKHRoaXMuQUFNSURDYWxsVGltZWRPdXQgPSAhMSkgOiB0aGlzLkFBTUlEQ2FsbFRpbWVkT3V0ID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuaXNDbGllbnRTaWRlTWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmUuaXNDbGllbnRTaWRlTWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuTUNJRENhbGxUaW1lZE91dCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZS5NQ0lEQ2FsbFRpbWVkT3V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2LkFuYWx5dGljc0lEQ2FsbFRpbWVkT3V0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlLkFuYWx5dGljc0lEQ2FsbFRpbWVkT3V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2LkFBTUlEQ2FsbFRpbWVkT3V0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlLkFBTUlEQ2FsbFRpbWVkT3V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2LmlkU3luY0dldE9uUGFnZVN5bmNJbmZvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuX3JlYWRWaXNpdG9yKCksIHYuX2dldEZpZWxkKCdNQ1NZTkNTT1AnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5pZFN5bmNCeVVSTCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXYuaXNPcHRlZE91dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBsKGUgfHwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmVycm9yKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5lcnJvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgbiwgciA9IGUudXJsLCBpID0gZW5jb2RlVVJJQ29tcG9uZW50LCBvID0gYWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSByLnJlcGxhY2UoL15odHRwczovLCAnJykucmVwbGFjZSgvXmh0dHA6LywgJycpLCBhID0gQy5lbmNvZGVBbmRCdWlsZFJlcXVlc3QoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5kcGlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmRwdXVpZCB8fCAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sICcsJyksIG4gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpYnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKGUuZHBpZCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbWcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKHIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnR0bCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBvLmFkZE1lc3NhZ2Uobi5qb2luKCd8JykpLCBvLnJlcXVlc3RUb1Byb2Nlc3MoKSwgJ1N1Y2Nlc3NmdWxseSBxdWV1ZWQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2LmlkU3luY0J5RGF0YVNvdXJjZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXYuaXNPcHRlZE91dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBPYmplY3QoZSkgJiYgJ3N0cmluZycgPT0gdHlwZW9mIGUuZHB1dWlkICYmIGUuZHB1dWlkLmxlbmd0aCA/IChlLnVybCA9ICcvL2RwbS5kZW1kZXgubmV0L2liczpkcGlkPScgKyBlLmRwaWQgKyAnJmRwdXVpZD0nICsgZS5kcHV1aWQsIHYuaWRTeW5jQnlVUkwoZSkpIDogJ0Vycm9yOiBjb25maWcgb3IgY29uZmlnLmRwdXVpZCBpcyBlbXB0eSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9lKHYsIGFlKSwgdi5fZ2V0Q29va2llVmVyc2lvbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZSB8fCB2LmNvb2tpZVJlYWQodi5jb29raWVOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJC5WRVJTSU9OX1JFR0VYLmV4ZWMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiB0Lmxlbmd0aCA+IDEgPyB0WzFdIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5fcmVzZXRBbWN2Q29va2llID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdi5fZ2V0Q29va2llVmVyc2lvbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAhWS5pc0xlc3NUaGFuKHQsIGUpIHx8IHYucmVtb3ZlQ29va2llKHYuY29va2llTmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYuc2V0QXNDb29wU2FmZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFAgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdi5zZXRBc0Nvb3BVbnNhZmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2LmNvbmZpZ3MgPSBPYmplY3QuY3JlYXRlKG51bGwpLCB0ZS5pc09iamVjdChhKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlIGluIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEYoZSkgJiYgKHZbZV0gPSBhW2VdLCB2LmNvbmZpZ3NbZV0gPSBhW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCBwKCksIHYuaW5pdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUoKSAmJiAoeS5vcHRJbi5mZXRjaFBlcm1pc3Npb25zKG0sICEwKSwgIXkub3B0SW4uaXNBcHByb3ZlZCh5Lm9wdEluLkNhdGVnb3JpZXMuRUNJRCkpIHx8IG5lIHx8IChuZSA9ICEwLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRlLmlzT2JqZWN0KGEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuaWRTeW5jQ29udGFpbmVySUQgPSB2LmlkU3luY0NvbnRhaW5lcklEIHx8IDAsIFAgPSAnYm9vbGVhbicgPT0gdHlwZW9mIHYuaXNDb29wU2FmZSA/IHYuaXNDb29wU2FmZSA6IHRlLnBhcnNlQm9vbGVhbih2LmlzQ29vcFNhZmUpLCB2LnJlc2V0QmVmb3JlVmVyc2lvbiAmJiB2Ll9yZXNldEFtY3ZDb29raWUodi5yZXNldEJlZm9yZVZlcnNpb24pLCB2Ll9hdHRlbXB0VG9Qb3B1bGF0ZUlkc0Zyb21VcmwoKSwgdi5fYXR0ZW1wdFRvUG9wdWxhdGVTZGlkRnJvbVVybCgpLCB2Ll9yZWFkVmlzaXRvcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHYuX2dldEZpZWxkKE4pLCB0ID0gTWF0aC5jZWlsKG5ldyBEYXRlKCkuZ2V0VGltZSgpIC8gJC5NSUxMSVNfUEVSX0RBWSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuaWRTeW5jRGlzYWJsZVN5bmNzIHx8IHYuZGlzYWJsZUlkU3luY3MgfHwgIWFlLmNhbk1ha2VTeW5jSURDYWxsKGUsIHQpIHx8ICh2Ll9zZXRGaWVsZEV4cGlyZSh4LCAtMSksIHYuX3NldEZpZWxkKE4sIHQpKSwgdi5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCgpLCB2LmdldEF1ZGllbmNlTWFuYWdlckxvY2F0aW9uSGludCgpLCB2LmdldEF1ZGllbmNlTWFuYWdlckJsb2IoKSwgdi5fbWVyZ2VTZXJ2ZXJTdGF0ZSh2LnNlcnZlclN0YXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5fYXR0ZW1wdFRvUG9wdWxhdGVJZHNGcm9tVXJsKCksIHYuX2F0dGVtcHRUb1BvcHVsYXRlU2RpZEZyb21VcmwoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdi5pZFN5bmNEaXNhYmxlU3luY3MgJiYgIXYuZGlzYWJsZUlkU3luY3MpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWUuY2hlY2tEUElmcmFtZVNyYygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnJlYWR5VG9BdHRhY2hJZnJhbWUoKSAmJiBlLmF0dGFjaElmcmFtZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBELmFkZEV2ZW50TGlzdGVuZXIoJ2xvYWQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJLndpbmRvd0xvYWRlZCA9ICEwLCBlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUS5yZWNlaXZlTWVzc2FnZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFlLnJlY2VpdmVNZXNzYWdlKGUuZGF0YSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhZS5pZnJhbWVIb3N0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCB2LndoaXRlbGlzdElmcmFtZURvbWFpbnMgJiYgJC5QT1NUX01FU1NBR0VfRU5BQkxFRCAmJiAodi53aGl0ZWxpc3RJZnJhbWVEb21haW5zID0gdi53aGl0ZWxpc3RJZnJhbWVEb21haW5zIGluc3RhbmNlb2YgQXJyYXkgPyB2LndoaXRlbGlzdElmcmFtZURvbWFpbnMgOiBbdi53aGl0ZWxpc3RJZnJhbWVEb21haW5zXSwgdi53aGl0ZWxpc3RJZnJhbWVEb21haW5zLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG5ldyBPKHQsIGUpLCBuID0gSCh2LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBRLnJlY2VpdmVNZXNzYWdlKG4sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJlLmNvbmZpZyA9IFgsIF8uVmlzaXRvciA9IEJlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBGZSA9IEJlLCBIZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQy5pc09iamVjdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSkuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJyAhPT0gZVt0XSAmJiBYLmdldENvbmZpZ3MoKVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5yZWR1Y2UoZnVuY3Rpb24gKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBYLm5vcm1hbGl6ZUNvbmZpZyhhLCBlW2FdKSwgciA9IEMubm9ybWFsaXplQm9vbGVhbihuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbYV0gPSByLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5jcmVhdGUobnVsbCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBxZSA9IE5lLk9wdEluLCBVZSA9IE5lLklhYlBsdWdpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGZS5nZXRJbnN0YW5jZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignVmlzaXRvciByZXF1aXJlcyBBZG9iZSBNYXJrZXRpbmcgQ2xvdWQgT3JnIElELicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmluZGV4T2YoJ0AnKSA8IDAgJiYgKGUgKz0gJ0BBZG9iZU9yZycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gXy5zX2NfaWw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gMDsgYSA8IHQubGVuZ3RoOyBhKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0W2FdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiAmJiAnVmlzaXRvcicgPT09IG4uX2MgJiYgbi5tYXJrZXRpbmdDbG91ZE9yZ0lEID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gSGUodCkgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXy5hZG9iZS5vcHRJbiA9IF8uYWRvYmUub3B0SW4gfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gQy5wbHVjayhlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZG9lc09wdEluQXBwbHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXZpb3VzUGVybWlzc2lvbnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZU9wdEluQXBwcm92YWxzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpc09wdEluU3RvcmFnZUVuYWJsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29wdEluU3RvcmFnZUV4cGlyeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaXNJYWJDb250ZXh0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgYSA9IGUub3B0SW5Db29raWVEb21haW4gfHwgZS5jb29raWVEb21haW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IChhID0gYSB8fCB6KCkpID09PSB3aW5kb3cubG9jYXRpb24uaG9zdG5hbWUgPyAnJyA6IGEsIHQub3B0SW5Db29raWVEb21haW4gPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IHFlKHQsIHsgY29va2llczogVSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5pc0lhYkNvbnRleHQgJiYgdC5kb2VzT3B0SW5BcHBseSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG5ldyBVZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnJlZ2lzdGVyUGx1Z2luKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShuIHx8IHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLnNwbGl0KCcnKS5yZXZlcnNlKCkuam9pbignJyksIGkgPSBuZXcgRmUoZSwgbnVsbCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uY29va2llRG9tYWluICYmIChpLmNvb2tpZURvbWFpbiA9IG4uY29va2llRG9tYWluKSwgbi5zYW1lU2l0ZUNvb2tpZSAmJiBuLnNlY3VyZUNvb2tpZSAmJiAoaS5jb25maWdzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtZVNpdGVDb29raWU6IG4uc2FtZVNpdGVDb29raWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWN1cmVDb29raWU6IG4uc2VjdXJlQ29va2llCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBfLnNfY19pbC5zcGxpY2UoLS1fLnNfY19pbiwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gQy5nZXRJZVZlcnNpb24oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdudW1iZXInID09IHR5cGVvZiBvICYmIG8gPCAxMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLl9oZWxwZXJzLnJlcGxhY2VNZXRob2RzV2l0aEZ1bmN0aW9uKGksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8uc2VsZiAhPT0gXy5wYXJlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkgJiYgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jb29raWVXcml0ZSgnVEVTVF9BTUNWX0NPT0tJRScsICdUJywgMSksICdUJyA9PT0gZS5jb29raWVSZWFkKCdURVNUX0FNQ1ZfQ09PS0lFJykgJiYgKGUucmVtb3ZlQ29va2llKCdURVNUX0FNQ1ZfQ09PS0lFJyksICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShpKSAmJiBfLnBhcmVudCA/IG5ldyBSKGUsIG4sIGksIF8ucGFyZW50KSA6IG5ldyBGZShlLCBuLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgPSBudWxsLCBzLmluaXQoKSwgczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGZS53aW5kb3dMb2FkZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfLmFkZEV2ZW50TGlzdGVuZXIgPyBfLmFkZEV2ZW50TGlzdGVuZXIoJ2xvYWQnLCBlKSA6IF8uYXR0YWNoRXZlbnQgJiYgXy5hdHRhY2hFdmVudCgnb25sb2FkJywgZSksIEZlLmNvZGVMb2FkRW5kID0gbmV3IERhdGUoKS5nZXRUaW1lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFZpc2l0b3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLW1jaWQvc3JjL3ZpZXcvdXRpbHMvdGltZVVuaXRzLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIb3VyczogMzYwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERheXM6IDg2NDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2Vla3M6IDYwNDgwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1vbnRoczogMjU5MjAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFllYXJzOiAzMTUzNjAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgY2xpY2t0YWxlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQ2xpY2t0YWxlIFRhZyBJbmplY3RvcicsCiAgICAgICAgICAgICAgICAgICAgICAgIGhvc3RlZExpYkZpbGVzQmFzZVVybDogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS9leHRlbnNpb25zL0VQNGQ4M2JmZTEyNWRhNDZmMmI1YjJmY2FjZWMwNDNiOWYvJywKICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd1aWQ6ICcwOGJhOTNiZC05NTA1LTQyNTktYWFhNy1mZTMyMTJkYWFjNGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFydGl0aW9uOiAnd3d3MTYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlpc2VsZWN0b3I6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbXVsdGlwbGVjb25kaXRpb25zOiAnW10nCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjbGlja3RhbGUvc3JjL2xpYi9hY3Rpb25zL2RlcGxveWNsaWNrdGFsZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZGVwbG95Y2xpY2t0YWxlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0RlcGxveSBDbGlja3RhbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKG1vZHVsZSwgZXhwb3J0cywgcmVxdWlyZSwgdHVyYmluZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEJhc2U2NERlY29kZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGVjb2RlVVJJQ29tcG9uZW50KGF0b2IoZSkuc3BsaXQoJycpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJScgKyAoJzAwJyArIGUuY2hhckNvZGVBdCgwKS50b1N0cmluZygxNikpLnNsaWNlKC0yKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbG9hZFNjcmlwdCA9IHJlcXVpcmUoJ0BhZG9iZS9yZWFjdG9yLWxvYWQtc2NyaXB0JyksIGV4dGVuc2lvblNldHRpbmdzID0gdHVyYmluZS5nZXRFeHRlbnNpb25TZXR0aW5ncygpLCBwYXJ0aXRpb24gPSBleHRlbnNpb25TZXR0aW5ncy5wYXJ0aXRpb24sIGd1aWQgPSBleHRlbnNpb25TZXR0aW5ncy5ndWlkLCBwaWlzZWxlY3RvciA9IGV4dGVuc2lvblNldHRpbmdzLnBpaXNlbGVjdG9yLCBtdWx0aXBsZWNvbmRpdGlvbnMgPSBleHRlbnNpb25TZXR0aW5ncy5tdWx0aXBsZWNvbmRpdGlvbnMgfHwgJ1tdJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG11bHRpcGxlY29uZGl0aW9ucyA9IEpTT04ucGFyc2UobXVsdGlwbGVjb25kaXRpb25zKSwgbXVsdGlwbGVjb25kaXRpb25zICYmIG11bHRpcGxlY29uZGl0aW9ucy5mb3JFYWNoKGZ1bmN0aW9uIChpbmRleCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkZWZpbml0aW9uID0gaW5kZXguZGVmaW5pdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGVmaW5pdGlvbiA9IGRlZmluaXRpb24ucmVwbGFjZSgvJiMzOTsvZywgJ1wnJyksIGV2YWwoZGVmaW5pdGlvbikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBndWlkID0gaW5kZXguZ3VpZCwgdm9pZCAocGFydGl0aW9uID0gaW5kZXgucGFydGl0aW9uKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBwaWlzZWxlY3RvcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWlzZWxlY3RvciA9IEJhc2U2NERlY29kZShleHRlbnNpb25TZXR0aW5ncy5waWlzZWxlY3Rvcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlpc2VsZWN0b3IgPSBleHRlbnNpb25TZXR0aW5ncy5waWlzZWxlY3RvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5DbGlja1RhbGVQSUlTZWxlY3RvciA9IHBpaXNlbGVjdG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFydGl0aW9uICYmIGd1aWQgJiYgKHdpbmRvdy5jbGlja1RhbGVUYWdJbmplY3RlZCB8fCBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5jcmVhdGVFbGVtZW50TlMsIHIgPSBuID8gbi5jYWxsKGUsICdodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1sJywgdCkgOiBlLmNyZWF0ZUVsZW1lbnQodCksIGkgPSBlLmdldEVsZW1lbnRzQnlUYWdOYW1lKHQpWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmFzeW5jID0gITAsIHIuY3Jvc3NPcmlnaW4gPSAnYW5vbnltb3VzJywgci50eXBlID0gJ3RleHQvamF2YXNjcmlwdCcsIHIuc3JjID0gYSwgaS5wYXJlbnROb2RlLmluc2VydEJlZm9yZShyLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LmNsaWNrVGFsZVRhZ0luamVjdGVkID0gITAsICdsb2FkaW5nJyAhPSBlLnJlYWR5U3RhdGUgPyBuKCkgOiBlLmFkZEV2ZW50TGlzdGVuZXIoJ0RPTUNvbnRlbnRMb2FkZWQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQobiwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGRvY3VtZW50LCAnc2NyaXB0JywgJ2h0dHBzOi8vY2Ruc3NsLmNsaWNrdGFsZS5uZXQvJyArIHBhcnRpdGlvbiArICcvcHRjLycgKyBndWlkICsgJy5qcycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3MnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQWRvYmUgQW5hbHl0aWNzJywKICAgICAgICAgICAgICAgICAgICAgICAgaG9zdGVkTGliRmlsZXNCYXNlVXJsOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tL2V4dGVuc2lvbnMvRVA2MzI2ZTRkNmIzMmY0YTcxYWQ1MjA0NDU5Y2M1N2Q2Ni8nLAogICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3JnSWQ6ICcxQTEyNDY3MzUyNzg1MzI5MEE0OTBENDVAQWRvYmVPcmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnVzZVBsdWdpbnMgPSAhMCwgZS5nZXRQcmV2aW91c1ZhbHVlID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcywgciA9ICcnLCBpID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9IHQgfHwgJ3NfZ3B2JywgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSAhMSwgYSA9IGEuc3BsaXQoJywnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gbi5ldmVudHMgPyBuLmV2ZW50cy5zcGxpdCgnLCcpIDogJycsIHMgPSAwLCBjID0gYS5sZW5ndGg7IHMgPCBjOyBzKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbCA9IDAsIHUgPSBvLmxlbmd0aDsgbCA8IHU7IGwrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhW3NdID09PSBvW2xdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoITAgPT09IGkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGkgJiYgKChpID0gbmV3IERhdGUoKSkuc2V0VGltZShpLmdldFRpbWUoKSArIDE4MDAwMDApLCBuLmNfcih0KSAmJiAociA9IG4uY19yKHQpKSwgZSA/IG4uY193KHQsIGUsIGkpIDogbi5jX3codCwgJ25vIHByZXZpb3VzIHZhbHVlJywgaSkpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0ID0gbmF2aWdhdG9yLnVzZXJBZ2VudCB8fCBuYXZpZ2F0b3IudmVuZG9yIHx8IHdpbmRvdy5vcGVyYSwgKC8oYW5kcm9pZHxiYlxkK3xtZWVnbykuK21vYmlsZXxhdmFudGdvfGJhZGFcL3xibGFja2JlcnJ5fGJsYXplcnxjb21wYWx8ZWxhaW5lfGZlbm5lY3xoaXB0b3B8aWVtb2JpbGV8aXAoaG9uZXxvZCl8aXJpc3xraW5kbGV8bGdlIHxtYWVtb3xtaWRwfG1tcHxtb2JpbGUuK2ZpcmVmb3h8bmV0ZnJvbnR8b3BlcmEgbShvYnxpbilpfHBhbG0oIG9zKT98cGhvbmV8cChpeGl8cmUpXC98cGx1Y2tlcnxwb2NrZXR8cHNwfHNlcmllcyg0fDYpMHxzeW1iaWFufHRyZW98dXBcLihicm93c2VyfGxpbmspfHZvZGFmb25lfHdhcHx3aW5kb3dzIGNlfHhkYXx4aWluby9pLnRlc3QodCkgfHwgLzEyMDd8NjMxMHw2NTkwfDNnc298NHRocHw1MFsxLTZdaXw3NzBzfDgwMnN8YSB3YXxhYmFjfGFjKGVyfG9vfHNcLSl8YWkoa298cm4pfGFsKGF2fGNhfGNvKXxhbW9pfGFuKGV4fG55fHl3KXxhcHR1fGFyKGNofGdvKXxhcyh0ZXx1cyl8YXR0d3xhdShkaXxcLW18ciB8cyApfGF2YW58YmUoY2t8bGx8bnEpfGJpKGxifHJkKXxibChhY3xheil8YnIoZXx2KXd8YnVtYnxid1wtKG58dSl8YzU1XC98Y2FwaXxjY3dhfGNkbVwtfGNlbGx8Y2h0bXxjbGRjfGNtZFwtfGNvKG1wfG5kKXxjcmF3fGRhKGl0fGxsfG5nKXxkYnRlfGRjXC1zfGRldml8ZGljYXxkbW9ifGRvKGN8cClvfGRzKDEyfFwtZCl8ZWwoNDl8YWkpfGVtKGwyfHVsKXxlcihpY3xrMCl8ZXNsOHxleihbNC03XTB8b3N8d2F8emUpfGZldGN8Zmx5KFwtfF8pfGcxIHV8ZzU2MHxnZW5lfGdmXC01fGdcLW1vfGdvKFwud3xvZCl8Z3IoYWR8dW4pfGhhaWV8aGNpdHxoZFwtKG18cHx0KXxoZWlcLXxoaShwdHx0YSl8aHAoIGl8aXApfGhzXC1jfGh0KGMoXC18IHxffGF8Z3xwfHN8dCl8dHApfGh1KGF3fHRjKXxpXC0oMjB8Z298bWEpfGkyMzB8aWFjKCB8XC18XC8pfGlicm98aWRlYXxpZzAxfGlrb218aW0xa3xpbm5vfGlwYXF8aXJpc3xqYSh0fHYpYXxqYnJvfGplbXV8amlnc3xrZGRpfGtlaml8a2d0KCB8XC8pfGtsb258a3B0IHxrd2NcLXxreW8oY3xrKXxsZShub3x4aSl8bGcoIGd8XC8oa3xsfHUpfDUwfDU0fFwtW2Etd10pfGxpYnd8bHlueHxtMVwtd3xtM2dhfG01MFwvfG1hKHRlfHVpfHhvKXxtYygwMXwyMXxjYSl8bVwtY3J8bWUocmN8cmkpfG1pKG84fG9hfHRzKXxtbWVmfG1vKDAxfDAyfGJpfGRlfGRvfHQoXC18IHxvfHYpfHp6KXxtdCg1MHxwMXx2ICl8bXdicHxteXdhfG4xMFswLTJdfG4yMFsyLTNdfG4zMCgwfDIpfG41MCgwfDJ8NSl8bjcoMCgwfDEpfDEwKXxuZSgoY3xtKVwtfG9ufHRmfHdmfHdnfHd0KXxub2soNnxpKXxuenBofG8yaW18b3AodGl8d3YpfG9yYW58b3dnMXxwODAwfHBhbihhfGR8dCl8cGR4Z3xwZygxM3xcLShbMS04XXxjKSl8cGhpbHxwaXJlfHBsKGF5fHVjKXxwblwtMnxwbyhja3xydHxzZSl8cHJveHxwc2lvfHB0XC1nfHFhXC1hfHFjKDA3fDEyfDIxfDMyfDYwfFwtWzItN118aVwtKXxxdGVrfHIzODB8cjYwMHxyYWtzfHJpbTl8cm8odmV8em8pfHM1NVwvfHNhKGdlfG1hfG1tfG1zfG55fHZhKXxzYygwMXxoXC18b298cFwtKXxzZGtcL3xzZShjKFwtfDB8MSl8NDd8bWN8bmR8cmkpfHNnaFwtfHNoYXJ8c2llKFwtfG0pfHNrXC0wfHNsKDQ1fGlkKXxzbShhbHxhcnxiM3xpdHx0NSl8c28oZnR8bnkpfHNwKDAxfGhcLXx2XC18diApfHN5KDAxfG1iKXx0MigxOHw1MCl8dDYoMDB8MTB8MTgpfHRhKGd0fGxrKXx0Y2xcLXx0ZGdcLXx0ZWwoaXxtKXx0aW1cLXx0XC1tb3x0byhwbHxzaCl8dHMoNzB8bVwtfG0zfG01KXx0eFwtOXx1cChcLmJ8ZzF8c2kpfHV0c3R8djQwMHx2NzUwfHZlcml8dmkocmd8dGUpfHZrKDQwfDVbMC0zXXxcLXYpfHZtNDB8dm9kYXx2dWxjfHZ4KDUyfDUzfDYwfDYxfDcwfDgwfDgxfDgzfDg1fDk4KXx3M2MoXC18ICl8d2ViY3x3aGl0fHdpKGcgfG5jfG53KXx3bWxifHdvbnV8eDcwMHx5YXNcLXx5b3VyfHpldG98enRlXC0vaS50ZXN0KHQuc3Vic3RyKDAsIDQpKSkgJiYgKHdpbmRvdy5tb2JpbGVEVE1jaGVjayA9ICEwKSwgd2luZG93LnRyYWNraW5ncHZjb3Jwb3JhdGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3NhdGVsbGl0ZS5zZXRWYXIoJ3RyYWNrX3RyYWNraW5ncHZjb3Jwb3JhdGVfc3RlcCcsIGUpLCBfc2F0ZWxsaXRlLnRyYWNrKCd0cmFja190cmFja2luZ3B2Y29ycG9yYXRlX2FjdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3aW5kb3cudHJhY2tpbmdwdmNvbmZpZ3VyYXRvcmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3NhdGVsbGl0ZS5zZXRWYXIoJ3RyYWNrX3RyYWNraW5ncHZjb25maWd1cmF0b3JlX3N0ZXAnLCBlKSwgX3NhdGVsbGl0ZS50cmFjaygndHJhY2tfdHJhY2tpbmdwdmNvbmZpZ3VyYXRvcmVfYWN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHdpbmRvdy50cmFja2luZ2N0YWV4dHJhID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9zYXRlbGxpdGUuc2V0VmFyKCd0cmFja190cmFja2luZ2N0YWV4dHJhX3N0ZXAnLCBlKSwgX3NhdGVsbGl0ZS50cmFjaygndHJhY2tfdHJhY2tpbmdjdGFleHRyYV9hY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgd2luZG93LnRyYWNraW5nY3RhY29ycG9yYXRlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9zYXRlbGxpdGUuc2V0VmFyKCd0cmFja190cmFja2luZ2N0YWNvcnBvcmF0ZV9zdGVwJywgZSksIF9zYXRlbGxpdGUudHJhY2soJ3RyYWNrX3RyYWNraW5nY3RhY29ycG9yYXRlX2FjdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3aW5kb3cudHJhY2tpbmdzd2lwZWNvcnBvcmF0ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc2F0ZWxsaXRlLnNldFZhcigndHJhY2tfdHJhY2tpbmdzd2lwZWNvcnBvcmF0ZV9zdGVwJywgZSksIF9zYXRlbGxpdGUudHJhY2soJ3RyYWNrX3RyYWNraW5nc3dpcGVjb3Jwb3JhdGVfYWN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHdpbmRvdy50cmFja2luZ2N0YWFvbCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc2F0ZWxsaXRlLnNldFZhcigndHJhY2tfdHJhY2tpbmdjdGFhb2xfc3RlcCcsIGUpLCBfc2F0ZWxsaXRlLnRyYWNrKCd0cmFja190cmFja2luZ2N0YWFvbF9hY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgd2luZG93LmxvY2FuZGluZUNhdGVnb3JpZXNNb2JpbGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3NhdGVsbGl0ZS5zZXRWYXIoJ3RyYWNrX3RyYWNraW5nY2xpY2tjb3Jwb3JhdGVfY2F0ZWdvcnknLCBlKSwgX3NhdGVsbGl0ZS50cmFjaygndHJhY2tfdHJhY2tpbmdjbGlja2NvcnBvcmF0ZV9hcnJvdycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3aW5kb3cudHJhY2tpbmdmYXFjb3Jwb3JhdGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3NhdGVsbGl0ZS5zZXRWYXIoJ3RyYWNrX3RyYWNraW5nZmFxY29ycG9yYXRlX2xhYmVsJywgZSksIF9zYXRlbGxpdGUudHJhY2soJ3RyYWNrX3RyYWNraW5nZmFxY29ycG9yYXRlX2FjdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvXC8ocmVnaXN0cmF0aXxmaWx0cm9fY2xpZW50ZSkvKSAmJiAod2luZG93LlRyYWNrU3RlcFJlZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc2F0ZWxsaXRlLnNldFZhcigncmVnaXN0cmF6aW9uZV9zdGVwJywgZSksIF9zYXRlbGxpdGUudHJhY2soJ3JlZ2lzdHJhemlvbmUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLyhhbmRyb2lkfGJiXGQrfG1lZWdvKS4rbW9iaWxlfGF2YW50Z298YmFkYVwvfGJsYWNrYmVycnl8YmxhemVyfGNvbXBhbHxlbGFpbmV8ZmVubmVjfGhpcHRvcHxpZW1vYmlsZXxpcChob25lfG9kKXxpcmlzfGtpbmRsZXxsZ2UgfG1hZW1vfG1pZHB8bW1wfG1vYmlsZS4rZmlyZWZveHxuZXRmcm9udHxvcGVyYSBtKG9ifGluKWl8cGFsbSggb3MpP3xwaG9uZXxwKGl4aXxyZSlcL3xwbHVja2VyfHBvY2tldHxwc3B8c2VyaWVzKDR8NikwfHN5bWJpYW58dHJlb3x1cFwuKGJyb3dzZXJ8bGluayl8dm9kYWZvbmV8d2FwfHdpbmRvd3MgY2V8eGRhfHhpaW5vL2kudGVzdChlKSB8fCAvMTIwN3w2MzEwfDY1OTB8M2dzb3w0dGhwfDUwWzEtNl1pfDc3MHN8ODAyc3xhIHdhfGFiYWN8YWMoZXJ8b298c1wtKXxhaShrb3xybil8YWwoYXZ8Y2F8Y28pfGFtb2l8YW4oZXh8bnl8eXcpfGFwdHV8YXIoY2h8Z28pfGFzKHRlfHVzKXxhdHR3fGF1KGRpfFwtbXxyIHxzICl8YXZhbnxiZShja3xsbHxucSl8YmkobGJ8cmQpfGJsKGFjfGF6KXxicihlfHYpd3xidW1ifGJ3XC0obnx1KXxjNTVcL3xjYXBpfGNjd2F8Y2RtXC18Y2VsbHxjaHRtfGNsZGN8Y21kXC18Y28obXB8bmQpfGNyYXd8ZGEoaXR8bGx8bmcpfGRidGV8ZGNcLXN8ZGV2aXxkaWNhfGRtb2J8ZG8oY3xwKW98ZHMoMTJ8XC1kKXxlbCg0OXxhaSl8ZW0obDJ8dWwpfGVyKGljfGswKXxlc2w4fGV6KFs0LTddMHxvc3x3YXx6ZSl8ZmV0Y3xmbHkoXC18Xyl8ZzEgdXxnNTYwfGdlbmV8Z2ZcLTV8Z1wtbW98Z28oXC53fG9kKXxncihhZHx1bil8aGFpZXxoY2l0fGhkXC0obXxwfHQpfGhlaVwtfGhpKHB0fHRhKXxocCggaXxpcCl8aHNcLWN8aHQoYyhcLXwgfF98YXxnfHB8c3x0KXx0cCl8aHUoYXd8dGMpfGlcLSgyMHxnb3xtYSl8aTIzMHxpYWMoIHxcLXxcLyl8aWJyb3xpZGVhfGlnMDF8aWtvbXxpbTFrfGlubm98aXBhcXxpcmlzfGphKHR8dilhfGpicm98amVtdXxqaWdzfGtkZGl8a2VqaXxrZ3QoIHxcLyl8a2xvbnxrcHQgfGt3Y1wtfGt5byhjfGspfGxlKG5vfHhpKXxsZyggZ3xcLyhrfGx8dSl8NTB8NTR8XC1bYS13XSl8bGlid3xseW54fG0xXC13fG0zZ2F8bTUwXC98bWEodGV8dWl8eG8pfG1jKDAxfDIxfGNhKXxtXC1jcnxtZShyY3xyaSl8bWkobzh8b2F8dHMpfG1tZWZ8bW8oMDF8MDJ8Yml8ZGV8ZG98dChcLXwgfG98dil8enopfG10KDUwfHAxfHYgKXxtd2JwfG15d2F8bjEwWzAtMl18bjIwWzItM118bjMwKDB8Mil8bjUwKDB8Mnw1KXxuNygwKDB8MSl8MTApfG5lKChjfG0pXC18b258dGZ8d2Z8d2d8d3QpfG5vayg2fGkpfG56cGh8bzJpbXxvcCh0aXx3dil8b3Jhbnxvd2cxfHA4MDB8cGFuKGF8ZHx0KXxwZHhnfHBnKDEzfFwtKFsxLThdfGMpKXxwaGlsfHBpcmV8cGwoYXl8dWMpfHBuXC0yfHBvKGNrfHJ0fHNlKXxwcm94fHBzaW98cHRcLWd8cWFcLWF8cWMoMDd8MTJ8MjF8MzJ8NjB8XC1bMi03XXxpXC0pfHF0ZWt8cjM4MHxyNjAwfHJha3N8cmltOXxybyh2ZXx6byl8czU1XC98c2EoZ2V8bWF8bW18bXN8bnl8dmEpfHNjKDAxfGhcLXxvb3xwXC0pfHNka1wvfHNlKGMoXC18MHwxKXw0N3xtY3xuZHxyaSl8c2doXC18c2hhcnxzaWUoXC18bSl8c2tcLTB8c2woNDV8aWQpfHNtKGFsfGFyfGIzfGl0fHQ1KXxzbyhmdHxueSl8c3AoMDF8aFwtfHZcLXx2ICl8c3koMDF8bWIpfHQyKDE4fDUwKXx0NigwMHwxMHwxOCl8dGEoZ3R8bGspfHRjbFwtfHRkZ1wtfHRlbChpfG0pfHRpbVwtfHRcLW1vfHRvKHBsfHNoKXx0cyg3MHxtXC18bTN8bTUpfHR4XC05fHVwKFwuYnxnMXxzaSl8dXRzdHx2NDAwfHY3NTB8dmVyaXx2aShyZ3x0ZSl8dmsoNDB8NVswLTNdfFwtdil8dm00MHx2b2RhfHZ1bGN8dngoNTJ8NTN8NjB8NjF8NzB8ODB8ODF8ODN8ODV8OTgpfHczYyhcLXwgKXx3ZWJjfHdoaXR8d2koZyB8bmN8bncpfHdtbGJ8d29udXx4NzAwfHlhc1wtfHlvdXJ8emV0b3x6dGVcLS9pLnRlc3QoZS5zdWJzdHIoMCwgNCkpKSAmJiAod2luZG93Lm1vYmlsZURUTWNoZWNrID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG5hdmlnYXRvci51c2VyQWdlbnQgfHwgbmF2aWdhdG9yLnZlbmRvciB8fCB3aW5kb3cub3BlcmEpLCB3aW5kb3cuYW9scmVuZXdmdW5uZWwgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChfc2F0ZWxsaXRlLnNldFZhcignYW9scmVuZXdfb2ZmZXJ0eXBlJywgYSksIF9zYXRlbGxpdGUuc2V0VmFyKCdhb2xyZW5ld19wcm9tb2NvZGUnLCB0KSwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnb3Blbic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3NhdGVsbGl0ZS50cmFjaygnYW9scmVuZXdmdW5uZWxfb3BlbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc3RlcF9vbmUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc3RlcF90d28nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc3RlcF9kb2MnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc3RlcF90aHJlZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdzdGVwX3JpZXBpbG9nbyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdrbyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3NhdGVsbGl0ZS5zZXRWYXIoJ2FvbHJlbmV3ZnVubmVsX2FjdGlvbicsIGUpLCBfc2F0ZWxsaXRlLnRyYWNrKCdhb2xyZW5ld2Z1bm5lbF9zdGVwJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHdpbmRvdy5hb2xyZW5ld3BvcHVwID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9zYXRlbGxpdGUuc2V0VmFyKCdhb2xyZW5ld19wYWdlbmFtZScsIGUpLCBfc2F0ZWxsaXRlLnRyYWNrKCdhb2xyZW5ld3BvcHVwX3BhZ2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgd2luZG93LmFvbHJlbmV3bW9kYWwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3NhdGVsbGl0ZS5zZXRWYXIoJ2FvbHJlbmV3X2FjdGlvbicsIGUpLCBfc2F0ZWxsaXRlLnRyYWNrKCdhb2xyZW5ld21vZGFsX2FjdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3aW5kb3cuYW9scmVuZXdjYXJ0ID0gZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9zYXRlbGxpdGUuc2V0VmFyKCdhb2xyZW5ld19vZmZlcnR5cGUnLCBuKSwgX3NhdGVsbGl0ZS5zZXRWYXIoJ2FvbHJlbmV3X3Byb21vY29kZScsIGEpLCBfc2F0ZWxsaXRlLnNldFZhcignYW9scmVuZXdfY2FydCcsIGUpLCBfc2F0ZWxsaXRlLnNldFZhcignYW9scmVuZXdfcHJvZHVjdCcsIHQpLCBfc2F0ZWxsaXRlLnRyYWNrKCdhb2xyZW5ld2NhcnRfYnVpbGQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgd2luZG93LmFvbHJlbmV3b3JkZXIgPSBmdW5jdGlvbiAoZSwgdCwgYSwgbiwgciwgaSwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3NhdGVsbGl0ZS5zZXRWYXIoJ2FvbHJlbmV3X29mZmVydHlwZScsIHQpLCBfc2F0ZWxsaXRlLnNldFZhcignYW9scmVuZXdfcHJvbW9jb2RlJywgZSksIF9zYXRlbGxpdGUuc2V0VmFyKCdhb2xyZW5ld19wdXJjaGFzZWlkJywgYSksIF9zYXRlbGxpdGUuc2V0VmFyKCdhb2xyZW5ld196aXAnLCBuKSwgX3NhdGVsbGl0ZS5zZXRWYXIoJ2FvbHJlbmV3X2luaXppYWxpJywgciksIF9zYXRlbGxpdGUuc2V0VmFyKCdhb2xyZW5ld19tZW5zaWxpJywgaSksIF9zYXRlbGxpdGUuc2V0VmFyKCdhb2xyZW5ld19tZXRvZG8nLCBvKSwgX3NhdGVsbGl0ZS50cmFjaygnYW9scmVuZXdvcmRlcl9wdXJjaGFzZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3aW5kb3cuYW9scmVuZXdlcnJvciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc2F0ZWxsaXRlLnNldFZhcignYW9scmVuZXdfZXJyb3InLCBlKSwgX3NhdGVsbGl0ZS50cmFjaygnYW9scmVuZXdlcnJvcl9zdGVwJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL29mZmVydGUvKSAmJiBkb2N1bWVudC5hZGRFdmVudExpc3RlbmVyKCdtb3VzZWRvd24nLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT09IHQud2hpY2ggJiYgdC50YXJnZXQubWF0Y2hlcygnLmRyb3Bkb3duLnNlbnRlbmNlIGxpW29uY2xpY2sqPVwnZmlsdGVyQ2FyZHNcJ10nKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubGlua1RyYWNrVmFycyA9ICdlVmFyMjQscHJvcDU1LGVWYXI1NSxldmVudHMnLCBlLmxpbmtUcmFja0V2ZW50cyA9IGUuZXZlbnRzID0gJ2V2ZW50MTYnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdC50YXJnZXQudGV4dENvbnRlbnQudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gYS5yZXBsYWNlKC9cc1xzKy9nLCAnICcpLCBlLmVWYXIyNCA9ICdvZmZlcnRlaW5kZXhfZmlsdHJvXycgKyBhLnJlcGxhY2UoLyAvZywgJycpLCBlLnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIGUucHJvcDU1ICYmIChlLmVWYXI1NSA9ICdEPWM1NScpLCBlLnRsKHRoaXMsICdvJywgJ2NsaWNrX2NvcnBvcmF0ZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpYnJhcnlDb2RlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ21hbmFnZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjY291bnRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YWdpbmc6IFsnc2t5aXRjb2xsJ10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2R1Y3Rpb246IFsnc2t5aXRkZXYnXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2ZWxvcG1lbnQ6IFsnc2t5aXRjb2xsJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZUFjdGl2aXR5TWFwOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZVRyYWNrZXJHbG9iYWxseTogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3A0MCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdEPW1pZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhclNldDogJ1VURi04JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW5jeUNvZGU6ICdFVVInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNraW5nU2VydmVyOiAnbWV0cmljcy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrSW5saW5lU3RhdHM6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpc2l0b3JOYW1lc3BhY2U6ICdza3lpdGFsaWEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrRG93bmxvYWRMaW5rczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tFeHRlcm5hbExpbmtzOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rSW50ZXJuYWxGaWx0ZXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdqYXZhc2NyaXB0OicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtYWlsdG86JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJVtBTExdIEludGVybmFsIGZpbHRlciUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd3d3LnNreWdyb3VwLnNreScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcjJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tpbmdTZXJ2ZXJTZWN1cmU6ICdzbWV0cmljcy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtEb3dubG9hZEZpbGVUeXBlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZG9jJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RvY3gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXBzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BuZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAneGxzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcHR4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3hsc3gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGFiJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NzdicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd6aXAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHh0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZzZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2eGQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAneG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2pzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NzcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdyYXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXhlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3dtYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtb3YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYXZpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3dtdicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtcDMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd2F2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ200dicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjbGVhci12YXJpYWJsZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQ2xlYXIgVmFyaWFibGVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBhKCcuLi9zaGFyZWRNb2R1bGVzL2dldFRyYWNrZXInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jbGVhclZhcnMgJiYgKG4ubG9nZ2VyLmluZm8oJ0NsZWFyIHZhcmlhYmxlcy4nKSwgZS5jbGVhclZhcnMoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ubG9nZ2VyLmVycm9yKCdDYW5ub3QgY2xlYXIgdmFyaWFibGVzOiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdzZXQtdmFyaWFibGVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ1NldCBWYXJpYWJsZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGEoJy4uL3NoYXJlZE1vZHVsZXMvZ2V0VHJhY2tlcicpLCBpID0gYSgnLi4vaGVscGVycy9hcHBseVRyYWNrZXJWYXJpYWJsZXMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCkudGhlbihmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ubG9nZ2VyLmluZm8oJ1NldCB2YXJpYWJsZXMgb24gdGhlIHRyYWNrZXIuJyksIGkoYSwgZS50cmFja2VyUHJvcGVydGllcyksIGUuY3VzdG9tU2V0dXAgJiYgZS5jdXN0b21TZXR1cC5zb3VyY2UgJiYgZS5jdXN0b21TZXR1cC5zb3VyY2UuY2FsbCh0LmVsZW1lbnQsIHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmxvZ2dlci5lcnJvcignQ2Fubm90IHNldCB2YXJpYWJsZXM6ICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdzZW5kLWJlYWNvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdTZW5kIEJlYWNvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gYSgnLi4vc2hhcmVkTW9kdWxlcy9nZXRUcmFja2VyJyksIGkgPSBhKCcuLi9oZWxwZXJzL2dldE5vZGVMaW5rVGV4dCcpLCBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLm5vZGVOYW1lICYmICdhJyA9PT0gZS5ub2RlTmFtZS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSkgPyBpKGUpIDogJ2xpbmsgY2xpY2tlZCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBjID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3BhZ2UnID09PSB0LnR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ubG9nZ2VyLmluZm8oJ0ZpcmluZyBwYWdlIHZpZXcgYmVhY29uLicpLCBlLnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogdC5saW5rVHlwZSB8fCAnbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogdC5saW5rTmFtZSB8fCBzKGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ubG9nZ2VyLmluZm8oJ0ZpcmluZyBsaW5rIHRyYWNrIGJlYWNvbiB1c2luZyB0aGUgdmFsdWVzOiAnICsgSlNPTi5zdHJpbmdpZnkocikgKyAnLicpLCBlLnRsKG8oYSkgPyBhIDogJ3RydWUnLCByLmxpbmtUeXBlLCByLmxpbmtOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoKS50aGVuKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhhLCBlLCB0LmVsZW1lbnQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmxvZ2dlci5lcnJvcignQ2Fubm90IHNlbmQgYmVhY29uOiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL3NoYXJlZE1vZHVsZXMvZ2V0VHJhY2tlci5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBhKCdAYWRvYmUvcmVhY3Rvci1jb29raWUnKSwgaSA9IGEoJ0BhZG9iZS9yZWFjdG9yLXByb21pc2UnKSwgbyA9IGEoJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLCBzID0gYSgnLi4vaGVscGVycy9zZXR0aW5nc0hlbHBlcicpLCBjID0gYSgnLi4vaGVscGVycy9hdWdtZW50ZXJzJyksIGwgPSBhKCcuLi9oZWxwZXJzL2FwcGx5VHJhY2tlclZhcmlhYmxlcycpLCB1ID0gYSgnLi4vaGVscGVycy9sb2FkTGlicmFyeScpLCBkID0gYSgnLi4vaGVscGVycy9nZW5lcmF0ZVZlcnNpb24nKShuLmJ1aWxkSW5mby50dXJiaW5lQnVpbGREYXRlKSwgcCA9ICdiZWZvcmVTZXR0aW5ncycsIGggPSBuLmdldFNoYXJlZE1vZHVsZSgnYWRvYmUtbWNpZCcsICdtY2lkLWluc3RhbmNlJyksIGYgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZSB8fCAndHJ1ZScgPT09IHIuZ2V0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuYWxsKGMubWFwKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IHQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5yZXNvbHZlKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBtID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaCAmJiAobi5sb2dnZXIuaW5mbygnU2V0dGluZyBNQ0lEIGluc3RhbmNlIG9uIHRoZSB0cmFja2VyLicpLCBlLnZpc2l0b3IgPSBoKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmxvZ2dlci5pbmZvKCdTZXR0aW5nIHZlcnNpb24gb24gdHJhY2tlcjogIicgKyBkICsgJyIuJyksIHZvaWQgMCAhPT0gZS50YWdDb250YWluZXJNYXJrZXIgPyBlLnRhZ0NvbnRhaW5lck1hcmtlciA9IGQgOiAnc3RyaW5nJyA9PSB0eXBlb2YgZS52ZXJzaW9uICYmIGUudmVyc2lvbi5zdWJzdHJpbmcoZS52ZXJzaW9uLmxlbmd0aCAtIDUpICE9PSAnLScgKyBkICYmIChlLnZlcnNpb24gKz0gJy0nICsgZCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBfID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5sb2FkUGhhc2UgPT09IHAgJiYgdC5zb3VyY2UgJiYgKG4ubG9nZ2VyLmluZm8oJ0NhbGxpbmcgY3VzdG9tIHNjcmlwdCBiZWZvcmUgc2V0dGluZ3MuJyksIHQuc291cmNlLmNhbGwobywgYSkpLCBsKGEsIGUgfHwge30pLCB0LmxvYWRQaGFzZSAhPT0gcCAmJiB0LnNvdXJjZSAmJiAobi5sb2dnZXIuaW5mbygnQ2FsbGluZyBjdXN0b20gc2NyaXB0IGFmdGVyIHNldHRpbmdzLicpLCB0LnNvdXJjZS5jYWxsKG8sIGEpKSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzLmlzQXVkaWVuY2VNYW5hZ2VtZW50RW5hYmxlZChlKSAmJiAodC5sb2FkTW9kdWxlKCdBdWRpZW5jZU1hbmFnZW1lbnQnKSwgbi5sb2dnZXIuaW5mbygnSW5pdGlhbGl6aW5nIEF1ZGllbmNlTWFuYWdlbWVudCBtb2R1bGUnKSwgdC5BdWRpZW5jZU1hbmFnZW1lbnQuc2V0dXAoZS5tb2R1bGVQcm9wZXJ0aWVzLmF1ZGllbmNlTWFuYWdlci5jb25maWcpKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmKGUudHJhY2tpbmdDb29raWVOYW1lKSA/IHUoZSkudGhlbihnKS50aGVuKG0pLnRoZW4oYikudGhlbihfLmJpbmQobnVsbCwgZS50cmFja2VyUHJvcGVydGllcywgZS5jdXN0b21TZXR1cCB8fCB7fSkpLnRoZW4odi5iaW5kKG51bGwsIGUpKSA6IGkucmVqZWN0KCdFVSBjb21wbGlhbmNlIHdhcyBub3QgYWNrbm93bGVkZ2VkIGJ5IHRoZSB1c2VyLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShuLmdldEV4dGVuc2lvblNldHRpbmdzKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdnZXQtdHJhY2tlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9zaGFyZWRNb2R1bGVzL2F1Z21lbnRUcmFja2VyLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdhdWdtZW50LXRyYWNrZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNoYXJlZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYSgnLi4vaGVscGVycy9hdWdtZW50ZXJzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9oZWxwZXJzL3NldHRpbmdzSGVscGVyLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGEoJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLCBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExJQl9UWVBFUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQU5BR0VEOiAnbWFuYWdlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBSRUlOU1RBTExFRDogJ3ByZWluc3RhbGxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFTU9URTogJ3JlbW90ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENVU1RPTTogJ2N1c3RvbScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1BTkFHRURfTElCX1BBVEhTOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFQUF9NRUFTVVJFTUVOVDogJ0FwcE1lYXN1cmVtZW50LmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUNUSVZJVFlfTUFQOiAnQXBwTWVhc3VyZW1lbnRfTW9kdWxlX0FjdGl2aXR5TWFwLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVESUVOQ0VfTUFOQUdFTUVOVDogJ0FwcE1lYXN1cmVtZW50X01vZHVsZV9BdWRpZW5jZU1hbmFnZW1lbnQuanMnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRSZXBvcnRTdWl0ZXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5wcm9kdWN0aW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtuLmVudmlyb25tZW50LnN0YWdlXSAmJiAodCA9IGVbbi5lbnZpcm9ubWVudC5zdGFnZV0pLCB0LmpvaW4oJywnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQWN0aXZpdHlNYXBFbmFibGVkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIShlLmxpYnJhcnlDb2RlICYmICFlLmxpYnJhcnlDb2RlLnVzZUFjdGl2aXR5TWFwICYmICExID09PSBlLmxpYnJhcnlDb2RlLnVzZUFjdGl2aXR5TWFwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQXVkaWVuY2VNYW5hZ2VtZW50RW5hYmxlZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5tb2R1bGVQcm9wZXJ0aWVzICYmIGUubW9kdWxlUHJvcGVydGllcy5hdWRpZW5jZU1hbmFnZXIgJiYgZS5tb2R1bGVQcm9wZXJ0aWVzLmF1ZGllbmNlTWFuYWdlci5jb25maWcgJiYgciAmJiByLl9zYXRlbGxpdGUgJiYgci5fc2F0ZWxsaXRlLmNvbXBhbnkgJiYgci5fc2F0ZWxsaXRlLmNvbXBhbnkub3JnSWQgJiYgKHQgPSAhMCksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2hlbHBlcnMvYXVnbWVudGVycy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9oZWxwZXJzL2FwcGx5VHJhY2tlclZhcmlhYmxlcy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBhKCdAYWRvYmUvcmVhY3Rvci1xdWVyeS1zdHJpbmcnKSwgaSA9IGEoJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLCBvID0gL2VWYXIoWzAtOV0rKS8sIHMgPSAvcHJvcChbMC05XSspLywgYyA9IG5ldyBSZWdFeHAoJ14oZVZhclswLTldKyl8KHByb3BbMC05XSspfChoaWVyWzAtOV0rKXxjYW1wYWlnbnxwdXJjaGFzZUlEfGNoYW5uZWx8c2VydmVyfHN0YXRlfHppcHxwYWdlVHlwZSQnKSwgbCA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuaW5kZXhPZihlKSA9PT0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHUgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0LmtleXModCkuZmlsdGVyKGMudGVzdC5iaW5kKGMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSAmJiBuLnB1c2goJ2V2ZW50cycpLCAobiA9IG4uY29uY2F0KChlLmxpbmtUcmFja1ZhcnMgfHwgJycpLnNwbGl0KCcsJykpKS5maWx0ZXIoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdOb25lJyAhPT0gZSAmJiBlICYmIGwoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0Lm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoYSA9IGEuY29uY2F0KChlLmxpbmtUcmFja0V2ZW50cyB8fCAnJykuc3BsaXQoJywnKSkpLmZpbHRlcihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ05vbmUnICE9PSBlICYmIGwoZSwgdCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcCA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0XSA9IGFbdF0uam9pbignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaCA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhLmR5bmFtaWNWYXJpYWJsZVByZWZpeCB8fCAnRD0nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbdF0uZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd2YWx1ZScgPT09IHQudHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB0LnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gby5leGVjKHQudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IG4gKyAndicgKyByWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBzLmV4ZWModC52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSAmJiAoYSA9IG4gKyAnYycgKyBpWzFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3QubmFtZV0gPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rRG93bmxvYWRGaWxlVHlwZXM6IHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua0V4dGVybmFsRmlsdGVyczogcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rSW50ZXJuYWxGaWx0ZXJzOiBwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhpZXJhcmNoaWVzOiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhW3RdLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdC5uYW1lXSA9IHQuc2VjdGlvbnMuam9pbih0LmRlbGltaXRlcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcHM6IGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FtcGFpZ246IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgncXVlcnlQYXJhbScgPT09IGFbdF0udHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSByLnBhcnNlKGkubG9jYXRpb24uc2VhcmNoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0gPSBuW2FbdF0udmFsdWVdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0gPSBhW3RdLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFbdF0ubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmlkICYmICh0ID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5pZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5qb2luKCc6JykpLCBlLnZhbHVlICYmICh0ID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS52YWx1ZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5qb2luKCc9JykpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0XSA9IG4uam9pbignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQgfHwge30sIE9iamVjdC5rZXlzKHQpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGZbZV0sIHIgPSB0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPyBuKGEsIGUsIHQpIDogYVtlXSA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYS5ldmVudHMgJiYgZS5ldmVudHMgJiYgZS5ldmVudHMubGVuZ3RoID4gMCAmJiAoYS5ldmVudHMgPSBlLmV2ZW50cyArICcsJyArIGEuZXZlbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdCAmJiB0LmV2ZW50cyAmJiB0LmV2ZW50cy5sZW5ndGggPiAwLCBpID0gdShlLCBhLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJiYgKGEubGlua1RyYWNrVmFycyA9IGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBkKGUsIHQuZXZlbnRzIHx8IFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gJiYgKGEubGlua1RyYWNrRXZlbnRzID0gbyksIG4ubG9nZ2VyLmluZm8oJ0FwcGx5aW5nIHRoZSBmb2xsb3dpbmcgcHJvcGVydGllcyBvbiB0cmFja2VyOiAiJyArIEpTT04uc3RyaW5naWZ5KGEpICsgJyIuJyksIE9iamVjdC5rZXlzKGEpLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3RdID0gYVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvaGVscGVycy9sb2FkTGlicmFyeS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBhKCdAYWRvYmUvcmVhY3Rvci1sb2FkLXNjcmlwdCcpLCBpID0gYSgnQGFkb2JlL3JlYWN0b3Itd2luZG93JyksIG8gPSBhKCdAYWRvYmUvcmVhY3Rvci1wcm9taXNlJyksIHMgPSBhKCcuL3NldHRpbmdzSGVscGVyJyksIGMgPSBhKCcuL3BvbGxIZWxwZXInKSwgbCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpLnNfZ2kpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignVW5hYmxlIHRvIGNyZWF0ZSBBcHBNZWFzdXJlbWVudCB0cmFja2VyLCBgc19naWAgZnVuY3Rpb24gbm90IGZvdW5kLicgKyBpLkFwcE1lYXN1cmVtZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmxvZ2dlci5pbmZvKCdDcmVhdGluZyBBcHBNZWFzdXJlbWVudCB0cmFja2VyIHdpdGggdGhlc2UgcmVwb3J0IHN1aXRlczogIicgKyB0ICsgJyInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGkuc19naSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5saWJyYXJ5Q29kZS5zY29wZVRyYWNrZXJHbG9iYWxseSAmJiAobi5sb2dnZXIuaW5mbygnU2V0dGluZyB0aGUgdHJhY2tlciBhcyB3aW5kb3cucycpLCBpLnMgPSBhKSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLmxpYnJhcnlDb2RlLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHMuTElCX1RZUEVTLk1BTkFHRUQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChuLmdldEhvc3RlZExpYkZpbGVVcmwocy5NQU5BR0VEX0xJQl9QQVRIUy5BUFBfTUVBU1VSRU1FTlQpKSwgcy5pc0FjdGl2aXR5TWFwRW5hYmxlZChlKSAmJiB0LnB1c2gobi5nZXRIb3N0ZWRMaWJGaWxlVXJsKHMuTUFOQUdFRF9MSUJfUEFUSFMuQUNUSVZJVFlfTUFQKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugcy5MSUJfVFlQRVMuQ1VTVE9NOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goZS5saWJyYXJ5Q29kZS5zb3VyY2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHMuTElCX1RZUEVTLlJFTU9URToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKCdodHRwczonID09PSBpLmxvY2F0aW9uLnByb3RvY29sID8gZS5saWJyYXJ5Q29kZS5odHRwc1VybCA6IGUubGlicmFyeUNvZGUuaHR0cFVybCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzLmlzQXVkaWVuY2VNYW5hZ2VtZW50RW5hYmxlZChlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHsgbmFtZXNwYWNlOiBpLl9zYXRlbGxpdGUuY29tcGFueS5vcmdJZCB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm1vZHVsZVByb3BlcnRpZXMuYXVkaWVuY2VNYW5hZ2VyLmNvbmZpZy52aXNpdG9yU2VydmljZSA9IGEsIHQucHVzaChuLmdldEhvc3RlZExpYkZpbGVVcmwocy5NQU5BR0VEX0xJQl9QQVRIUy5BVURJRU5DRV9NQU5BR0VNRU5UKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8uYWxsKHUoZSkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmxvZ2dlci5pbmZvKCdMb2FkaW5nIHNjcmlwdDogJyArIGUpLCByKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHAgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmxpYnJhcnlDb2RlLmFjY291bnRzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5zYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBzLmdldFJlcG9ydFN1aXRlcyhlLmxpYnJhcnlDb2RlLmFjY291bnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ubG9nZ2VyLmluZm8oJ1NldHRpbmcgdGhlIGZvbGxvd2luZyByZXBvcnQgc3VpdGVzIG9uIHRoZSB0cmFja2VyOiAiJyArIGEgKyAnIicpLCB0LnNhKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ubG9nZ2VyLndhcm4oJ0Nhbm5vdCBzZXQgcmVwb3J0IHN1aXRlcyBvbiB0cmFja2VyLiBgc2FgIG1ldGhvZCBub3QgYXZhaWxhYmxlLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlbZV0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmxvZ2dlci5pbmZvKCdGb3VuZCB0cmFja2VyIGxvY2F0ZWQgYXQ6ICInICsgZSArICciLicpLCBpW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQ2Fubm90IGZpbmQgdGhlIGdsb2JhbCB2YXJpYWJsZSBuYW1lOiAiJyArIGUgKyAnIi4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUubGlicmFyeUNvZGUudHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBzLkxJQl9UWVBFUy5NQU5BR0VEOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gcy5nZXRSZXBvcnRTdWl0ZXMoZS5saWJyYXJ5Q29kZS5hY2NvdW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudGhlbihsLmJpbmQobnVsbCwgZSwgYSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBzLkxJQl9UWVBFUy5QUkVJTlNUQUxMRUQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudGhlbihjLnBvbGwuYmluZChudWxsLCBpLCBlLmxpYnJhcnlDb2RlLnRyYWNrZXJWYXJpYWJsZU5hbWUpKS50aGVuKHAuYmluZChudWxsLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHMuTElCX1RZUEVTLkNVU1RPTToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugcy5MSUJfVFlQRVMuUkVNT1RFOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnRoZW4oaC5iaW5kKG51bGwsIGUubGlicmFyeUNvZGUudHJhY2tlclZhcmlhYmxlTmFtZSkpLnRoZW4ocC5iaW5kKG51bGwsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdDYW5ub3QgbG9hZCBsaWJyYXJ5LiBUeXBlIG5vdCBzdXBwb3J0ZWQuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9oZWxwZXJzL2dlbmVyYXRlVmVyc2lvbi5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSA4LCBhID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5nZXRVVENEYXRlKCkudG9TdHJpbmcoMzYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3Vic3RyKGUubGVuZ3RoIC0gMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWF0aC5mbG9vcihlLmdldFVUQ0hvdXJzKCkgLyB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gKGUuZ2V0VVRDTW9udGgoKSArIDEgKyAxMiAqIHIoZSkpLnRvU3RyaW5nKDM2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZS5nZXRVVENGdWxsWWVhcigpIC0gMjAxMCkudG9TdHJpbmcoMzYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbmV3IERhdGUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNOYU4odCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdJbnZhbGlkIGRhdGUgcHJvdmlkZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoJ0wnICsgbyh0KSArIGkodCkgKyBhKHQpKS50b1VwcGVyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvaGVscGVycy9wb2xsSGVscGVyLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGEoJ0BhZG9iZS9yZWFjdG9yLXByb21pc2UnKSwgaSA9IDQwLCBvID0gMjUwLCBzID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmxvZ2dlci5pbmZvKCdGb3VuZCBwcm9wZXJ0eSBsb2NhdGVkIGF0OiAiJyArIHQgKyAnIl0uJyksIGUoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBjID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHIoZnVuY3Rpb24gKGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVbdF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyhhLCB0LCBlW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAxLCBjID0gc2V0SW50ZXJ2YWwoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0gJiYgKHMoYSwgdCwgZVt0XSksIGNsZWFySW50ZXJ2YWwoYykpLCByID49IGkgJiYgKGNsZWFySW50ZXJ2YWwoYyksIG4obmV3IEVycm9yKCdCYWlsaW5nIG91dC4gQ2Fubm90IGZpbmQgdGhlIHZhcmlhYmxlIG5hbWU6ICInICsgdCArICciXS4nKSkpLCByKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvbGw6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ubG9nZ2VyLmluZm8oJ1dhaXRpbmcgZm9yIHRoZSBwcm9wZXJ0eSB0byBiZWNvbWUgYWNjZXNzaWJsZSBhdDogIicgKyB0ICsgJyJdLicpLCBjKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvaGVscGVycy9nZXROb2RlTGlua1RleHQuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLnJlcGxhY2UoL1xzKy9nLCAnICcpLnRyaW0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEgPSAvXihTQ1JJUFR8U1RZTEV8TElOS3xDQU5WQVN8Tk9TQ1JJUFR8I0NPTU1FTlQpJC9pLCBuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIShlICYmIGUubm9kZU5hbWUgJiYgZS5ub2RlTmFtZS5tYXRjaChhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdLCBhID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihlKSA/ICh0LnB1c2goZSksIGUuY2hpbGROb2RlcyAmJiBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChlLmNoaWxkTm9kZXMpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSByKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gdC5jb25jYXQobi5zdXBwb3J0ZWROb2RlcyksIGEgPSBhIHx8IG4uaW5jbHVkZXNVbnN1cHBvcnRlZE5vZGVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSA6IGEgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdXBwb3J0ZWROb2RlczogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5jbHVkZXNVbnN1cHBvcnRlZE5vZGVzOiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhICYmIGEgIT09IGUubm9kZU5hbWUudG9VcHBlckNhc2UoKSB8fCAobiA9IGUuZ2V0QXR0cmlidXRlKHQpKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQoZS5pbm5lclRleHQgfHwgZS50ZXh0Q29udGVudCksIG4gPSByKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8IG4uaW5jbHVkZXNVbnN1cHBvcnRlZE5vZGVzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8sIHMsIGMsIGwsIHUgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnN1cHBvcnRlZE5vZGVzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5nZXRBdHRyaWJ1dGUgJiYgKG8gPSBvIHx8IHQoZS5nZXRBdHRyaWJ1dGUoJ2FsdCcpKSwgcyA9IHMgfHwgdChlLmdldEF0dHJpYnV0ZSgndGl0bGUnKSksIGMgPSBjIHx8IHQoaShlLCAndmFsdWUnLCAnSU5QVVQnKSksIGwgPSBsIHx8IHQoaShlLCAnc3JjJywgJ0lNRycpKSksIGUubm9kZVZhbHVlICYmIHUucHVzaChlLm5vZGVWYWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIChhID0gdCh1LmpvaW4oJycpKSkgfHwgKGEgPSB0KG8gfHwgcyB8fCBjIHx8IGwgfHwgJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBjb21wYW55OiB7IG9yZ0lkOiAnMUExMjQ2NzM1Mjc4NTMyOTBBNDkwRDQ1QEFkb2JlT3JnJyB9LAogICAgICAgICAgICAgICAgcHJvcGVydHk6IHsKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnU0tZIC0gQ09SUE9SQVRFJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3ZpbGNtcy53d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjYWVtLnd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NhZW0uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLnd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Rlc3QuZXh0cmEuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdleHRyYS5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2Qtd3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy5ob3RjbHViLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaG90Y2x1Yi5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2NlZ2xpLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXByb2N1cmVtZW50LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc21hcnRsZWFkLml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdza3kud2lubmVybGFuZC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2QuYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLnNreWFjYWRlbXkuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NreWFjYWRlbXkuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxjbXMuc2t5aXRhbGlhLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2t5aXRhbGlhLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGVzdC5zY2VnbGkuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cm92YWJhci5za3lidXNpbmVzcy5jbG8udWQuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryb3ZhaG90ZWwuc2t5YnVzaW5lc3MuY2xvLnVkLml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cm92YWJhci5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryb3ZhaG90ZWwuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdza3lnby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0b3JlLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2t5Z28tdGVzdC5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2J1c2luZXNzLnNreXR2Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cm92YS5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NreWxvY2F0b3Iubm9odXAuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLmVwcm9jdXJlbWVudC5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLXB0LnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgdW5kZWZpbmVkVmFyc1JldHVybkVtcHR5OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgcnVsZUNvbXBvbmVudFNlcXVlbmNpbmdFbmFibGVkOiAhMQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaWQ6ICdQUjNmNzU3YTZhYTk0MjQ4YjBiYTA4ZGEzMGVhMmJiOGU3JwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHJ1bGVzOiBbCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYWY3NjJjOTdmNTVhNDE5MDg0ZTczMWE4ODZmMGEwNTMnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gW1ZpZGVvXSBDb250ZWdnaW8gdmlld3MgQ29udGVudCAoZXZlbnQxMjIpJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdjb3VudF92aWRlb19jb250ZW50JyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdldmVudHMsc2VydmVyLGVWYXI1NSxwcm9wNTUnLCB0LmV2ZW50cyA9ICcnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTIyJywgdC5zZXJ2ZXIgPSB3aW5kb3cubG9jYXRpb24uaG9zdCwgdC5lVmFyNTUgPSB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2NvdW50X3ZpZGVvX2NvbnRlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxjYTUxNzg5NDNiMGM0Y2E3YTJiMTBlNGU0OWE0ZWJiZScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdbRFJdIFtBT0xdIGFvbHJlbmV3ZnVubmVsX3N0ZXAgKCsgQURGT1JNICsgVEFSR0VUKScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnYW9scmVuZXdmdW5uZWxfc3RlcCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xscHJqLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2QuYWJib25hbWVudG8tby5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmluZm8oJ0FET0JFIExBVU5DSDogYW9scmVuZXdmdW5uZWxfc3RlcCB1cGxvYWRlZCEgU1RFUCBOQU1FOiAnICsgX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3ZnVubmVsX2FjdGlvbicpKSwgdC5jaGFubmVsID0gJ0FjcXVpc3RhJywgdC5ldmVudHMgPSB0LnByb2R1Y3RzID0gdC5wYWdlTmFtZSA9ICcnLCB0LnRyYW5zYWN0aW9uSUQgPSAnJywgdC5ldmVudHMgPSAnc3RlcF9vbmUnID09IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld2Z1bm5lbF9hY3Rpb24nKSA/ICdldmVudDE5JyA6ICdzdGVwX3R3bycgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3ZnVubmVsX2FjdGlvbicpIHx8ICdzdGVwX2RvYycgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3ZnVubmVsX2FjdGlvbicpID8gJ2V2ZW50MjAnIDogJ3N0ZXBfdGhyZWUnID09IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld2Z1bm5lbF9hY3Rpb24nKSA/ICdldmVudDEzJyA6ICdzdGVwX3JpZXBpbG9nbycgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3ZnVubmVsX2FjdGlvbicpID8gJ2V2ZW50MTY1JyA6ICdrbycgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3ZnVubmVsX2FjdGlvbicpID8gJ2V2ZW50MTM2JyA6ICcnLCB0LnByb2R1Y3RzID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBT0xdIFByb2RvdHRpIEludGVybWVkaWF0ZScpLnJlcGxhY2UoJ251bGw7c2NvbnRvIHByZXNlbnRhIHVuIGFtaWNvLCcsICcnKSwgdC5wcm9wMjEgPSBfc2F0ZWxsaXRlLmdldFZhcignQ2FuYWxlIGRcJ2FjcXVpc3RvJyksIHQucHJvcDM0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X3Byb21vY29kZScpLCB0LnByb3AzNSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQU9MXSBFbnRyeVByb2R1Y3QnKSwgJ2Zhc3R3ZWInID09IHQucHJvcDM3ICYgJ3N0ZXBfdHdvJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdmdW5uZWxfYWN0aW9uJykgPyB0LnBhZ2VOYW1lID0gJ3NreTphY3F1aXN0YTpjaGVja291dDp2ZXJpZmljYSBkb2N1bWVudGknIDogdC5wYWdlTmFtZSA9ICdzdGVwX29uZScgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3ZnVubmVsX2FjdGlvbicpID8gJ3NreTphY3F1aXN0YTpjaGVja291dDphbmFncmFmaWNhJyA6ICdzdGVwX3R3bycgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3ZnVubmVsX2FjdGlvbicpID8gJ3NreTphY3F1aXN0YTpjaGVja291dDp2ZXJpZmljYSBpbmRpcml6em8nIDogJ3N0ZXBfZG9jJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdmdW5uZWxfYWN0aW9uJykgPyAnc2t5OmFjcXVpc3RhOmNoZWNrb3V0Omluc2VyaXNjaSBkb2N1bWVudGknIDogJ3N0ZXBfdGhyZWUnID09IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld2Z1bm5lbF9hY3Rpb24nKSA/ICdza3k6YWNxdWlzdGE6Y2hlY2tvdXQ6cGFnYW1lbnRvJyA6ICdzdGVwX3JpZXBpbG9nbycgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3ZnVubmVsX2FjdGlvbicpID8gJ3NreTphY3F1aXN0YTpjaGVja291dDpyaWVwaWxvZ28nIDogJ2tvJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdmdW5uZWxfYWN0aW9uJykgPyAnc2t5OmFjcXVpc3RhOmNoZWNrb3V0OmtvJyA6ICcnLCB0LnByb3AzNyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19vZmZlcnR5cGUnKSwgdC5wcm9wNTkgPSAnYW9sJywgdC5wcm9wNjIgPSAnJywgd2luZG93LnBhZ2VuYW1lQmFzZUFvbFJlbmV3ID0gdC5wYWdlTmFtZSwgdC5wYWdlTmFtZSAmJiAodC5lVmFyMSA9ICdEPXBhZ2VOYW1lJyksIHQucHJvcDM0ICYmICh0LmVWYXIzNCA9ICdEPWMzNCcpLCB0LnByb3AzNyAmJiAodC5lVmFyMzcgPSAnRD1jMzcnKSwgdC5wcm9wMzUgJiYgKHQuZVZhcjM1ID0gJ0Q9YzM1JyksIHQucHJvcDU5ICYmICh0LmVWYXI1OSA9ICdEPWM1OScpLCB0LmVWYXI5OCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vMjczMzFjMTY2OTJjLzMzYTg2MmE3MDU0YS8xNWExZTY0ZWVlYmUvUkNhMDNjMzBkOWNhOGI0NGUwOGE0OThiNzY2NmY5NThkYS1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vMjczMzFjMTY2OTJjLzMzYTg2MmE3MDU0YS8xNWExZTY0ZWVlYmUvUkM0ZDIyYTFjZTgxYjE0MGVjOTdlNzlhNDMwYzc3NzNhMC1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdodG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGRjNmJhMzVlNjkzNjQ5ZDI5NzM1Y2IxZmE5YjE5ZmE2JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIExhbmRpbmcgbXNhIC0gQ3RhIEFwcGxlIHN0b3JlJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcuYXBwbGUtc3RvcmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1NQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvYXBwLW15LXNreS8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wYWdlTmFtZSA9ICcnLCB0LmxpbmtUcmFja1ZhcnMgPSAnZVZhcjI0LHByb3A1NCxlVmFyNTQscHJvcDU1LGVWYXI1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LmVWYXIyNCA9ICdteXNreWFwcF9hcHBsZXN0b3JlJywgdC5wcm9wNTQgPSB3aW5kb3cubG9jYXRpb24uaHJlZiwgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NCAmJiAodC5lVmFyNTQgPSAnRD1jNTQnKSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2NsaWNrX2NvcnBvcmF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDM5YTZiNjZjODBkODRjODFiNjNhZGZjZjViZjRiOGFmJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIExhbmRpbmcgcmVjb250cmFjdGluZyAtIEN0YSBjbGljY2EgcXVpJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICdhW2RhdGEtdGFyZ2V0Xj1cJyNkZXR0YWdsaU9mZmVydGFcJ10nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1NQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL2xhbmRpbmdcL2FiYm9uYXJzaVwvcmVjb250cmFjdGluZy8pICYmICFkb2N1bWVudC5sb2NhdGlvbi5ocmVmLm1hdGNoKC9sYW5kaW5nLW5ld1wvYWJib25hcnNpXC9yZWNvbnRyYWN0aW5nLykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wYWdlTmFtZSA9ICdza3k6bGFuZGluZzphYmJvbmFyc2k6cmVjb250cmFjdGluZzpuZXc6b3ZlcmxheS1jb25kJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDAzNDFjZTc2MGYxYjQyNTI4ZGU4Y2I0Y2Y3YTM4MzdjJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIFNreVEgZXNwbG9yYSBmdW56aW9uYWxpdMOgIC0gVGFiJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICdhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFByb3BlcnRpZXM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2NsYXNzTmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICduYXZpZ2F0aW9uLWNhdGVnb3J5IGFjdGl2ZS1jYXRlZ29yeXxuYXZpZ2F0aW9uLWNhdGVnb3J5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL3R2XC9za3lxXC9lc3Bsb3JhLWZ1bnppb25hbGl0YXxsYW5kaW5nXC9lc3Bsb3JhLWZ1bnppb25hbGl0YS8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wYWdlTmFtZSA9ICcnLCB0LmxpbmtUcmFja1ZhcnMgPSAnZVZhcjI0LHByb3A1NSxlVmFyNTUsZXZlbnRzJywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JywgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMudGV4dENvbnRlbnQudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmVWYXIyNCA9IGEudHJpbSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdjbGlja19jb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw5MzMxM2M1M2JmMDI0Y2ZhYmQ1OTU0YzBkYTZhZmFiOCcsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0VSXSBbQUxMXSBEb3dubG9hZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRQcm9wZXJ0aWVzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdocmVmJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyhqcGd8anBlZ3xwZGYpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnBhZ2VOYW1lID0gJycsIHQubGlua1RyYWNrVmFycyA9ICdwcm9wOCxwcm9wOSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50OCcsIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdjYXRlZ29yaWVzJykgJiYgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2NhdGVnb3JpZXMnKS5vcHRpb25zW2RvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdjYXRlZ29yaWVzJykuc2VsZWN0ZWRJbmRleF0gPyAodC5wcm9wOCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdjYXRlZ29yaWVzJykub3B0aW9uc1tkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnY2F0ZWdvcmllcycpLnNlbGVjdGVkSW5kZXhdLnZhbHVlLnRvTG93ZXJDYXNlKCkgKyAnLScsIHQucHJvcDggKz0gdGhpcy5ocmVmLnN1YnN0cmluZyh0aGlzLmhyZWYubGFzdEluZGV4T2YoJy8nKSArIDEsIHRoaXMuaHJlZi5sZW5ndGgpLnRvTG93ZXJDYXNlKCkpIDogdC5wcm9wOCA9IHRoaXMuaHJlZi5zdWJzdHJpbmcodGhpcy5ocmVmLmxhc3RJbmRleE9mKCcvJykgKyAxLCB0aGlzLmhyZWYubGVuZ3RoKS50b0xvd2VyQ2FzZSgpLCAtMSAhPSB0LnByb3A4LmluZGV4T2YoJyUyMCcpICYmICh0LnByb3A4ID0gdC5wcm9wOC5yZXBsYWNlKC8lMjAvZywgJyAnKS50b0xvd2VyQ2FzZSgpKSwgdC5wcm9wOSA9IC0xICE9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoJz8nKSA/IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnJlcGxhY2UoL2h0dHAocyk/OlwvXC8vZ2ksICcnKS5zdWJzdHJpbmcoMCwgd2luZG93LmxvY2F0aW9uLmhyZWYucmVwbGFjZSgvaHR0cChzKT86XC9cLy9naSwgJycpLmluZGV4T2YoJz8nKSkgOiB3aW5kb3cubG9jYXRpb24uaHJlZi5yZXBsYWNlKC9odHRwKHMpPzpcL1wvL2dpLCAnJyksIHQucHJvcDkgPSB0LnByb3A5LnJlcGxhY2UoLyMkLywgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdkb3dubG9hZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDczNmZlZjE3ZDY4ZjRiOWZhMmM4NmZlYTVlZmQxMTQ2JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIFNreVEgLSBCb3ggc2t5IGdvJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcjZGEtc2t5LWdvLmRhQWNjb3JkaW9uSXRlbS5jbG9zZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1NQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvdHZcL3NreXEvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdlVmFyMjQsZVZhcjU1LHByb3A1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LmVWYXIyNCA9ICdza3kgZ28nLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdjbGlja19jb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxlZmQ0MTJlYjc1MjU0ODI2YTg3NTY5NmVmOTc2OTBjZScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBUcmFja2luZyBQdiBDb3Jwb3JhdGUgKCtBREZPUk0pJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICd0cmFja190cmFja2luZ3B2Y29ycG9yYXRlX2FjdGlvbicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmluZm8oJ0Fkb2JlIHRyYWNraW5ncHZjb3Jwb3JhdGUgJyArIF9zYXRlbGxpdGUuZ2V0VmFyKCd0cmFja190cmFja2luZ3B2Y29ycG9yYXRlX3N0ZXAnKSksIHQuZXZlbnRzID0gJycsIHQucGFnZU5hbWUgPSBfc2F0ZWxsaXRlLmdldFZhcigndHJhY2tfdHJhY2tpbmdwdmNvcnBvcmF0ZV9zdGVwJyksICdza3k6Y29tZS12ZWRlcmU6c2t5cScgPT0gdC5wYWdlTmFtZSAmJiAodC5wYWdlTmFtZSA9ICdza3k6dHY6c2t5cScpLCAnc2t5OmNvbWUtdmVkZXJlOnNreXEtZmlicmEnID09IHQucGFnZU5hbWUgJiYgKHQucGFnZU5hbWUgPSAnc2t5OnR2OnNreXE6c2VuemEtcGFyYWJvbGEnKSwgJ3NreTp0djpza3lxOmF0dGl2YXppb25lLXNreWlkOm9rJyA9PSB0LnBhZ2VOYW1lICYmICh0LmV2ZW50cyA9ICdldmVudDM2JyksIHQuc2VydmVyID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFNlcnZlcicpLCB0LmNoYW5uZWwgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBDaGFubmVsJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBDaGFubmVsJykgOiAnJywgZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvd3d3XC5za3lcLml0XC9sb2dpbi8pICYmIGRvY3VtZW50LnJlZmVycmVyLm1hdGNoKC9jbXA9LykgJiYgKHQuY2FtcGFpZ24gPSBfc2F0ZWxsaXRlLnJlYWRDb29raWUoJ0NDTVAnKSksIHQucHJvcDIgPSB0LmdldFByZXZpb3VzVmFsdWUodC5wYWdlTmFtZSwgJ2dwdl9wbicpLCB0LnByb3A1ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFF1YXJ0byBMaXZlbGxvJykgOiAnJywgdC5wcm9wMjkgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpIDogJycsIHQucHJvcDUwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA6ICcnLCB0LnByb3A1NCA9IGxvY2F0aW9uLmhyZWYsIHQucHJvcDU1ID0gbG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1OSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgOiAnJywgJ3NreTpwYWdpbmUgZGkgc2Vydml6aW86YWdnaW9ybmEgaWwgdHVvIGJyb3dzZXInID09IHQucGFnZU5hbWUgJiYgKHQucHJvcDU5ID0gJ3BhZ2luZSBkaSBzZXJ2aXppbycpLCB0LnByb3A2MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A2NyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBDb29raWUgTG9naW4gU3RhdHVzJyksIHQucGFnZU5hbWUgJiYgKHQuZVZhcjEgPSAnRD1wYWdlTmFtZScpLCB0LnByb3AyICYmICh0LmVWYXIyID0gJ0Q9YzInKSwgdC5wcm9wNSAmJiAodC5lVmFyNSA9ICdEPWM1JyksICcnICE9PSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBJbnRjbXAnKSA/IHQuZVZhcjEwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gSW50Y21wJykgOiAnJyAhPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgSW50Y21wJykgPyB0LmVWYXIxMCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIEludGNtcCcpIDogdC5lVmFyMTAgPSAnJywgbG9jYXRpb24ucGF0aG5hbWUubWF0Y2goL1wvYW9sXC8vKSB8fCAodC5lVmFyMjIgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2YgbW9iaWxlRFRNY2hlY2sgJiYgbW9iaWxlRFRNY2hlY2sgPyAnbW9iaWxlIHNpdGUnIDogJ2Rlc2t0b3Agc2l0ZScpLCB0LnByb3A1MCAmJiAodC5lVmFyNTAgPSAnRD1jNTAnKSwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpLCB0LnByb3A1OSAmJiAodC5lVmFyNTkgPSAnRD1jNTknKSwgdC5wcm9wNjAgJiYgKHQuZVZhcjYwID0gJ0Q9YzYwJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS8yNzMzMWMxNjY5MmMvMzNhODYyYTcwNTRhLzE1YTFlNjRlZWViZS9SQ2VmYTVkODljYzMyYjQ2MWI5ZWQ5MGQ1ZDIxMmY3MDdlLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw5NjFmMmFjYzc2NDg0ZmY1OWFiNDE2NmUwNTExNjVmMScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTUgW0VSXSBbQ0xJQ0sgQ09SUE9SQVRFXSBJbmRleCBUdiAtIEN0YSBTY29wcmkgT2ZmZXJ0ZSBQYXJjbycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnI29mZmVydGUgPiAuc2VjdGlvbi1zY3JlZW4uSXNQYXJjbyBhLmN0YS5zZWNvbmRhcnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1NQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcvdHYnID09PSBsb2NhdGlvbi5wYXRobmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdlVmFyMjQscHJvcDU1LGVWYXI1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LmVWYXIyNCA9ICdpbmRleC10dl9vZmZlcnRlX2ZhaS1kYS10ZV9zY29wcmknLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdjbGlja19jb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxlOGY1ZTU2ZTQwMzI0MzYwOWJmNDIyZTg0MTRjMDgyMycsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdbRFJdIFtBT0xdIGFvbHJlbmV3ZnVubmVsX29wZW4gKCsgQURGT1JNKScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnYW9scmVuZXdmdW5uZWxfb3BlbicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xscHJqLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJlcHJvZC5hYmJvbmFtZW50by1vLnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbygnQURPQkUgTEFVTkNIOiBhb2xyZW5ld2Z1bm5lbF9vcGVuIHVwbG9hZGVkJyksIHQuY2hhbm5lbCA9ICdBY3F1aXN0YScsIHQudHJhbnNhY3Rpb25JRCA9ICcnLCB3aW5kb3cucGFnZW5hbWVCYXNlQW9sUmVuZXcgPSAnc2t5OmFjcXVpc3RhOmNvbmZpZ3VyYSBvZmZlcnRhJywgdC5wYWdlTmFtZSA9IHdpbmRvdy5wYWdlbmFtZUJhc2VBb2xSZW5ldywgdC5ldmVudHMgPSB0LnByb2R1Y3RzID0gJycsIHQuZXZlbnRzID0gJ3NjQWRkLHNjT3BlbicsIHQucHJvZHVjdHMgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FPTF0gUHJvZG90dGknKS5yZXBsYWNlKCdudWxsO3Njb250byBwcmVzZW50YSB1biBhbWljbywnLCAnJyksIHQucHJvcDIxID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ0NhbmFsZSBkXCdhY3F1aXN0bycpLCB0LnByb3AzNCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19wcm9tb2NvZGUnKSwgdC5wcm9wMzUgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FPTF0gRW50cnlQcm9kdWN0JyksIHQucHJvcDM3ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X29mZmVydHlwZScpLCB0LnByb3A1OSA9ICdhb2wnLCB0LnByb3A2MiA9ICcnLCB0LnBhZ2VOYW1lICYmICh0LmVWYXIxID0gJ0Q9cGFnZU5hbWUnKSwgdC5wcm9wMjEgJiYgKHQuZVZhcjIyID0gJ0Q9YzIyJyksIHQucHJvcDM0ICYmICh0LmVWYXIzNCA9ICdEPWMzNCcpLCB0LnByb3AzNSAmJiAodC5lVmFyMzUgPSAnRD1jMzUnKSwgdC5wcm9wMzcgJiYgKHQuZVZhcjM3ID0gJ0Q9YzM3JyksIHQucHJvcDU5ICYmICh0LmVWYXI1OSA9ICdEPWM1OScpLCB0LmVWYXI5OCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogeyBjaGFubmVsOiAnQWNxdWlzdGEnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vMjczMzFjMTY2OTJjLzMzYTg2MmE3MDU0YS8xNWExZTY0ZWVlYmUvUkM5MDhiYTlmNDhjNzc0ZTk2OTcwMDY3YmFlMzY1MmViNS1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDUwM2IzYTRiZDUwMjQ3ODY4YjlkMzUxZTY4YTViY2FjJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbUExdIFtBTExdIERpZ2l0YWxEYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RvbVJlYWR5LmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3ZpbGNtcy53d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjYWVtLnd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NhZW0uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLnd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Rlc3QuZXh0cmEuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLXd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2V4dHJhLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXByb2N1cmVtZW50LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc21hcnRsZWFkLml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdza3kud2lubmVybGFuZC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxjbXMuc2t5YWNhZGVteS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2t5YWNhZGVteS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy5za3lpdGFsaWEuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdza3lpdGFsaWEuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0ZXN0LnNjZWdsaS5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryb3ZhYmFyLnNreWJ1c2luZXNzLmNsby51ZC5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJvdmFob3RlbC5za3lidXNpbmVzcy5jbG8udWQuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryb3ZhYmFyLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJvdmFob3RlbC5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NreWxvY2F0b3Iubm9odXAuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryb3ZhLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2NlZ2xpLnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvZXh0cmFcL215ZXh0cmEvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29uc29sZS5pbmZvKCdhZG9iZSBkaWdpdGFsIGRhdGEnKSwgdC5zZXJ2ZXIgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gU2VydmVyJyksIHQuY2hhbm5lbCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIENoYW5uZWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIENoYW5uZWwnKSA6ICcnLCB0LnBhZ2VOYW1lID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUGFnZU5hbWUnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFBhZ2VOYW1lJykgOiAnJywgZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvd3d3XC5za3lcLml0XC9sb2dpbi8pICYmIF9zYXRlbGxpdGUucmVhZENvb2tpZSgnQ0NNUCcpID8gdC5jYW1wYWlnbiA9IF9zYXRlbGxpdGUucmVhZENvb2tpZSgnQ0NNUCcpIDogJycgIT09IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIENtcCcpICYmICh0LmNhbXBhaWduID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgQ21wJykpLCBkb2N1bWVudC5sb2NhdGlvbi5ocmVmLm1hdGNoKC9za3lcLml0XC9hcHAtbXktc2t5LykgJiYgX3NhdGVsbGl0ZS5jb29raWUuZ2V0KCdDQ01QJykgJiYgKHQuY2FtcGFpZ24gPSBfc2F0ZWxsaXRlLmNvb2tpZS5nZXQoJ0NDTVAnKSksIGRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL3NreVwuaXRcL3R2XC9za3lxXC9hdHRpdmF6aW9uZS1za3lpZC8pICYmICdvbmVQdWNrU2VjdGlvblJlc3RvcmVTa3lJZCcgPT0gdC5VdGlsLmdldFF1ZXJ5UGFyYW0oJ2dvdG8nKSAmJiAodC5wYWdlTmFtZSA9IHQucGFnZU5hbWUgKyAnOnJpZ2VuZXJhLXNreWlkJyksIHQucHJvcDIgPSB0LmdldFByZXZpb3VzVmFsdWUodC5wYWdlTmFtZSwgJ2dwdl9wbicpLCB0LnByb3A1ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFF1YXJ0byBMaXZlbGxvJykgOiAnJywgdC5wcm9wMjkgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpIDogJycsIHQucHJvcDUwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA6ICcnLCB0LnByb3A1NCA9IGxvY2F0aW9uLmhyZWYsIHQucHJvcDU1ID0gbG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1OSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjcgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gQ29va2llIExvZ2luIFN0YXR1cycpLCB0LnBhZ2VOYW1lICYmICh0LmVWYXIxID0gJ0Q9cGFnZU5hbWUnKSwgdC5wcm9wMiAmJiAodC5lVmFyMiA9ICdEPWMyJyksIHQucHJvcDUgJiYgKHQuZVZhcjUgPSAnRD1jNScpLCBkb2N1bWVudC5sb2NhdGlvbi5ocmVmLm1hdGNoKC93d3dcLnNreVwuaXRcL2xvZ2luLykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZ2V0VXJsUGFyYW1ldGVyKCdmb3J3YXJkJyksIG4gPSBkZWNvZGVVUklDb21wb25lbnQoYSksIHIgPSBnZXRVcmxQYXJhbWV0ZXIoJ2ludGNtcCcsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnICE9PSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBJbnRjbXAnKSA/IHQuZVZhcjEwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gSW50Y21wJykgOiAnJyAhPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgSW50Y21wJykgPyB0LmVWYXIxMCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIEludGNtcCcpIDogdC5lVmFyMTAgPSAnJyAhPT0gciA/IHIgOiAnJywgbG9jYXRpb24ucGF0aG5hbWUubWF0Y2goL1wvYW9sXC8vKSB8fCAodC5lVmFyMjIgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2YgbW9iaWxlRFRNY2hlY2sgJiYgbW9iaWxlRFRNY2hlY2sgPyAnbW9iaWxlIHNpdGUnIDogJ2Rlc2t0b3Agc2l0ZScpLCB0LnByb3A1MCAmJiAodC5lVmFyNTAgPSAnRD1jNTAnKSwgZG9jdW1lbnQubG9jYXRpb24ucGF0aG5hbWUubWF0Y2goL0dTQS8pICYmICh0LmV2ZW50cyA9ICdldmVudDUnLCB0LmVWYXIxOSA9IHQuVXRpbC5nZXRRdWVyeVBhcmFtKCdxdWVyeScpLnRvTG93ZXJDYXNlKCksIHQuZVZhcjE5ICYmICh0LnByb3AxOSA9ICdEPXYxOScpKSwgKCd0cm92YWJhci5za3kuaXQnID09IGxvY2F0aW9uLmhvc3RuYW1lICYmICcvc2VhcmNoJyA9PSBsb2NhdGlvbi5wYXRobmFtZSB8fCAndHJvdmFiYXIuc2t5YnVzaW5lc3MuY2xvLnVkLml0JyA9PSBsb2NhdGlvbi5ob3N0bmFtZSAmJiAnL3NlYXJjaCcgPT0gbG9jYXRpb24ucGF0aG5hbWUgfHwgJ3Ryb3ZhaG90ZWwuc2t5Lml0JyA9PSBsb2NhdGlvbi5ob3N0bmFtZSAmJiAnL3NlYXJjaCcgPT0gbG9jYXRpb24ucGF0aG5hbWUgfHwgJ3Ryb3ZhaG90ZWwuc2t5YnVzaW5lc3MuY2xvLnVkLml0JyA9PSBsb2NhdGlvbi5ob3N0bmFtZSAmJiAnL3NlYXJjaCcgPT0gbG9jYXRpb24ucGF0aG5hbWUgfHwgJ3Ryb3ZhLnNreS5pdCcgPT0gbG9jYXRpb24uaG9zdG5hbWUgJiYgJy9yaXN1bHRhdGktcmljZXJjYScgPT0gbG9jYXRpb24ucGF0aG5hbWUgfHwgJ3NreWxvY2F0b3Iubm9odXAuaXQnID09IGxvY2F0aW9uLmhvc3RuYW1lICYmICcvcmlzdWx0YXRpLXJpY2VyY2EnID09IGxvY2F0aW9uLnBhdGhuYW1lKSAmJiAodC5ldmVudHMgPSAnZXZlbnQ1JyksIHQucHJvcDU0ICYmICh0LmVWYXI1NCA9ICdEPWM1NCcpLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKSwgdC5wcm9wNTkgJiYgKHQuZVZhcjU5ID0gJ0Q9YzU5JyksIHQucHJvcDYwICYmICh0LmVWYXI2MCA9ICdEPWM2MCcpLCB0LnByb3A2NyAmJiAodC5lVmFyNjcgPSAnRD1jNjcnKSwgJ3NreTppdDpyZWdpc3RyYXRpX2xvZ2luJyA9PSB0LnBhZ2VOYW1lICYmICh0LmV2ZW50cyA9ICdldmVudDM2JyksIChsb2NhdGlvbi5ob3N0bmFtZS5tYXRjaCgvZXByb2N1cmVtZW50XC5za3kuXGl0LykgfHwgbG9jYXRpb24uaG9zdG5hbWUubWF0Y2goL3NreVwud2lubmVybGFuZFwuY29tLykgfHwgbG9jYXRpb24uaG9zdG5hbWUubWF0Y2goL3NtYXJ0bGVhZFwuaXQvKSkgJiYgKHQucGFnZU5hbWUgPSBsb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0pLCAnd3d3LnNreWFjYWRlbXkuaXQnICE9IGxvY2F0aW9uLmhvc3RuYW1lICYmICdjb2xsY21zLnNreWFjYWRlbXkuaXQnICE9IGxvY2F0aW9uLmhvc3RuYW1lIHx8ICh0LmNoYW5uZWwgPSAnc2t5IGFjYWRlbXknLCB0LnBhZ2VOYW1lID0gbG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnBhZ2VOYW1lICYmICh0LmVWYXIxID0gJ0Q9cGFnZU5hbWUnKSwgdC5wcm9wMiA9IHQuZVZhcjIgPSAnJyksICdza3lpdGFsaWEuc2t5Lml0JyAhPSBsb2NhdGlvbi5ob3N0bmFtZSAmJiAnY29sbGNtcy5za3lpdGFsaWEuc2t5Lml0JyAhPSBsb2NhdGlvbi5ob3N0bmFtZSB8fCAodC5jaGFubmVsID0gJ2NvcnBvcmF0ZScsIHQucGFnZU5hbWUgPSBsb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucGFnZU5hbWUgJiYgKHQuZVZhcjEgPSAnRD1wYWdlTmFtZScpLCB0LnByb3AyID0gdC5lVmFyMiA9ICcnLCB0LmVWYXI1OSA9ICdMYXZvcmEgY29uIG5vaScpLCAobG9jYXRpb24uc2VhcmNoLm1hdGNoKC9sZWFkaWQ9L2kpICYmICFfc2F0ZWxsaXRlLmNvb2tpZS5nZXQoJ3hhY3RzPScpIHx8IGxvY2F0aW9uLnNlYXJjaC5tYXRjaCgvbGVhZGlkPS9pKSAmJiBfc2F0ZWxsaXRlLmNvb2tpZS5nZXQoJ3hhY3RzPScpICYmIF9zYXRlbGxpdGUuY29va2llLmdldCgneGFjdHMnKS5pbmRleE9mKHQuVXRpbC5nZXRRdWVyeVBhcmFtKCdsZWFkSWQnKSArICctJykgPCAwKSAmJiAodC50cmFuc2FjdGlvbklEID0gdC5VdGlsLmdldFF1ZXJ5UGFyYW0oJ2xlYWRJZCcpLCAnJyAhPSB0LmV2ZW50cyAmJiB2b2lkIDAgIT09IHQuZXZlbnRzID8gdC5ldmVudHMgKz0gJyxldmVudDg2JyA6ICh0LmV2ZW50cyA9ICdldmVudDg2JywgdC5lVmFyMjIgPSAnY2FsbCBtZSBub3cnKSwgX3NhdGVsbGl0ZS5jb29raWUuc2V0KCd4YWN0cycsIF9zYXRlbGxpdGUuY29va2llLmdldCgneGFjdHMnKSArIHQudHJhbnNhY3Rpb25JRCArICctJywgNzUwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNDI4YmMxMmNhMTlmNGYzMmI3YzI2Nzk4OTgwZWJkMDgnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtQTF0gW1RBRyBURVJaSV0gQ0xJQ0tUQUxFIChUYWcgaW5qZWN0b3IpJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2xpYnJhcnlMb2FkZWQuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkXzNkMGU3MGJkODAxZGUxZGUgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzNkMGU3MGJkODAxZGUxZGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja19jYTkxODA0M2M3NDUxMTdlLmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndHJ1ZScgPT09IGxvY2FsU3RvcmFnZS5nZXRJdGVtKCdjbXBDb25zZW50Q2xpY2t0YWxlJykgJiYgIWxvY2F0aW9uLmhyZWYubWF0Y2goL2ZpbGU6XC9cL1wvQ1w6XC8vKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzNkMGU3MGJkODAxZGUxZGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkXzNkMGU3MGJkODAxZGUxZGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjbGlja3RhbGUvc3JjL2xpYi9hY3Rpb25zL2RlcGxveWNsaWNrdGFsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMOTc3MjFlNzQwYjliNDlhNGE4OWE3NWZmMmU5MDUxZmInLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtQTF0gW1RBRyBURVJaSV0gQURGT1JNIChETVApIC0gU2l0aSBjb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZG9tUmVhZHkuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdob3RjbHViLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy5ob3RjbHViLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJvdmFiYXIuc2t5YnVzaW5lc3MuY2xvLnVkLml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cm92YWJhci5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKGRvY3VtZW50LmRvbWFpbi5tYXRjaCgvKGNhZW18c2FlbXxwcmVhZW18Y29sbGFtfGNvbGxwcmp8Y29sbG5ld3xjb2xsbmV3MikvKSB8fCBsb2NhdGlvbi5ocmVmLm1hdGNoKC9maWxlOlwvXC9cL0NcOlwvLykgfHwgZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvXC5hbXAvKSB8fCBkb2N1bWVudC5sb2NhdGlvbi5ocmVmLm1hdGNoKC9wbGF5ZXJcLnNreVwuaXQvKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS8yNzMzMWMxNjY5MmMvMzNhODYyYTcwNTRhLzE1YTFlNjRlZWViZS9SQzEzMmJlODk4YTA5YzRjZjZiNTdiNTE1YjQ0OTYzYzVmLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw4MDIyNmZlYzBiMGQ0NTJhYmEwNTc0NzY4NWZhMmVkMScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBbQUxMXSBSZWl0ZWsgQ01OLUNNQiAoKyBBREZPUk0pJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICd0cmFja19yZWl0ZWsnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlLmRldGFpbC50eXBlID8gZS5kZXRhaWwudHlwZSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2F0aW9uLnBhdGhuYW1lLm1hdGNoKCdhb2wvYWJib25hdGlvbmxpbmUnKSB8fCBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgnYW9sL2NtbicpID8gdC5wYWdlTmFtZSA9IHdpbmRvdy5wYWdlbmFtZUJhc2VBb2xSZW5ldyArIGUuZGV0YWlsLnN0ZXAgKyAnICcgKyBhIDogdC5wYWdlTmFtZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFBhZ2VOYW1lJykgKyBlLmRldGFpbC5zdGVwICsgJyAnICsgYSwgdC5lVmFyMTAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBJbnRjbXAnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIEludGNtcCcpIDogJycsIHQuc2VydmVyID0gZG9jdW1lbnQuZG9tYWluLCB0LnByb3A1NCA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU0ICYmICh0LmVWYXI1NCA9ICdEPWM1NCcpLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vMjczMzFjMTY2OTJjLzMzYTg2MmE3MDU0YS8xNWExZTY0ZWVlYmUvUkM1MWFjYTRjZjQxNzg0ZmI1OTM0NzVhZjYxMTY1NWYwYS1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDFkOTI3ZjJjNWRmNzRhOWE5Mjc5MjQ2NWYxMTBhY2M3JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIERhem4gLSBUb29sIEJ1dHRvbiByZXN0YXJ0JywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcjZGF6bi1mbG93LXJlc3RhcnQtY3RhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL3R2XC9kYXpuLyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxpbmtUcmFja1ZhcnMgPSAnZVZhcjI0LHByb3A1NSxlVmFyNTUsZXZlbnRzJywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JywgdC5lVmFyMjQgPSAnZGF6biB0b29sIHJlc3RhcnQnLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdjbGlja19jb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxlOGRhZjZjYzQxNDM0NGJkYTgwNmM4YTAxOTlhYWVjOScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBUcmFja2luZyBDVEEgQ29ycG9yYXRlICcsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAndHJhY2tfdHJhY2tpbmdjdGFjb3Jwb3JhdGVfYWN0aW9uJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucGFnZU5hbWUgPSAnJywgdC5ldmVudHMgPSAnJywgdC5saW5rVHJhY2tWYXJzID0gJ2V2ZW50cyxlVmFyMjQscHJvcDU0LGVWYXI1NCxwcm9wNTUsZVZhcjU1JywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JywgdC5lVmFyMjQgPSBfc2F0ZWxsaXRlLmdldFZhcigndHJhY2tfdHJhY2tpbmdjdGFjb3Jwb3JhdGVfc3RlcCcpLCB0LnByb3A1NCA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLCB0LnByb3A1NCAmJiAodC5lVmFyNTQgPSAnRD1jNTQnKSwgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAndHJhY2tpbmdjdGFjb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDk4OTAwNTQwNzE0YjQ1NzJiZmJhMWNkMDdjYWM5MzFmJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbRFJdIFNwZWVkIFRlc3QgLSBlc2l0byBpbiBwYXJ0ZSBwb3NpdGl2bycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnZmlicmF0ZXN0X2lucGFydGVwb3NpdGl2bycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2FlbS5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxjbXMud3d3LnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0cmFja2VyUHJvcGVydGllczogeyBwYWdlTmFtZTogJ3NreTphc3Npc3RlbnphOnNreXZpYWZpYnJhdGVzdDplc2l0by1pbnBhcnRlcG9zaXRpdm8nIH0gfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw3Nzk4YzM4MDllZGQ0MTM3OWU0NDRkMWRkYzZiN2JlOScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBab25lIElkIFB1c2ggQ29tcG9uZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdwdXNoX2NvbXBvbmVudF90cmFjaycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlLmRldGFpbC56b25laWQgPyBlLmRldGFpbC56b25laWQgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnBhZ2VOYW1lID0gJycsIHQubGlua1RyYWNrVmFycyA9ICdlVmFyNzknLCB0LmVWYXI3OSA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ3pvbmVJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDY2YzY0NGRmOTY2YzQ5OWJiMGY3Y2Y5N2Y2MzU3ZjFhJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbRFJdIFtBTExdIExvZ2luICgrIEFERk9STSknLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2xvZ2luJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucGFnZU5hbWUgPSAnJywgdC5saW5rVHJhY2tWYXJzID0gJ3NlcnZlcixlVmFyNjcscHJvcDY3LGVWYXI1MCxwcm9wNTAnLCB0LnNlcnZlciA9ICd3d3cuc2t5Lml0JywgdC5wcm9wNjcgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gQ29va2llIExvZ2luIFN0YXR1cycpLCB0LnByb3A1MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgOiAnJywgdC5wcm9wNTAgJiYgKHQuZVZhcjUwID0gJ0Q9YzUwJyksIHQucHJvcDY3ICYmICh0LmVWYXI2NyA9ICdEPWM2NycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogeyBldmVudHM6IFt7IG5hbWU6ICdldmVudDYnIH1dIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdsb2dpbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vMjczMzFjMTY2OTJjLzMzYTg2MmE3MDU0YS8xNWExZTY0ZWVlYmUvUkMyYzk0NTc3YzgzMzE0ZjU0YjM3OTg4YTY0ZjhlZjdhOC1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDc4NzcwZDM0OTkwYjRlMWU4NTZiNTg1YTA5MjI5NmQwJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIFNreVEgLSBCb3ggbXVsdGlzY3JlZW4nLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJyNkYS10dXR0aS1zY2hlcm1pLmRhQWNjb3JkaW9uSXRlbS5jbG9zZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1NQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvdHZcL3NreXEvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdlVmFyMjQsZVZhcjU1LHByb3A1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LmVWYXIyNCA9ICdtdWx0aXNjcmVlbiB3aXJlbGVzcycsIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2NsaWNrX2NvcnBvcmF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGVmZjc3NDNhZjIzYTQwZWRhNTUzNmMyYTk0ZThhMzIxJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbRFJdIFJlZ2lzdHJhemlvbmUnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3JlZ2lzdHJhemlvbmUnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoITApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIC9hbmFncmFmaWNhLy50ZXN0KF9zYXRlbGxpdGUuZ2V0VmFyKCdyZWdpc3RyYXppb25lX3N0ZXAnKSk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucGFnZU5hbWUgPSAnc2t5Oml0OnJlZ2lzdHJhdGk6YW5hZ3JhZmljYScsIHQuZXZlbnRzID0gJ2V2ZW50MzQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIC9yaWVwaWxvZ28vLnRlc3QoX3NhdGVsbGl0ZS5nZXRWYXIoJ3JlZ2lzdHJhemlvbmVfc3RlcCcpKToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wYWdlTmFtZSA9ICdza3k6aXQ6cmVnaXN0cmF0aTpyaWVwaWxvZ28nLCB0LmV2ZW50cyA9ICdldmVudDM1JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAvdXBncmFkZS8udGVzdChfc2F0ZWxsaXRlLmdldFZhcigncmVnaXN0cmF6aW9uZV9zdGVwJykpOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnBhZ2VOYW1lID0gJ3NreTppdDpyZWdpc3RyYXRpOnVwZ3JhZGUnLCB0LmV2ZW50cyA9ICdldmVudDM3JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgL2FuYWdyYWZpY2EvLnRlc3QoX3NhdGVsbGl0ZS5nZXRWYXIoJ3JlZ2lzdHJhemlvbmVfc3RlcCcpKSAmJiAodC5lVmFyNjcgPSAkKCcjY2hlY2tCb3hQJykuaXMoJzpjaGVja2VkJykgPyAnbm9uIGNsaWVudGUnIDogJ2NsaWVudGUnLCB0LnByb3A2NyA9ICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkwyMDgyMjM2NWY4Y2U0ZWRiOTFhNDM3OGVkODY1ZTBjZicsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTUgW0VSXSBbQ0xJQ0sgQ09SUE9SQVRFXSBEYXpuIC0gVG9vbCBDdGEgYWRlcmlzY2kgb2ZmZXJ0YSAoZHR0KScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnI2Rhem4tZmxvdy1maW5hbC1jdGEtZHR0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL3R2XC9kYXpuLyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxpbmtUcmFja1ZhcnMgPSAnZVZhcjI0LHByb3A1NSxlVmFyNTUsZXZlbnRzJywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JywgdC5lVmFyMjQgPSAnZGF6biB0b29sIGFkZXJpc2NpIG9mZmVydGEgZHR0JywgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnY2xpY2tfY29ycG9yYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMmE3ZGY3OGEyOTk3NGI4N2FjNjgxZTk2NGRiNDE0ZDYnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gW1ZpZGVvXSBDb250ZWdnaW8gdmlld3MgQWR2IChldmVudDEyMSknLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2NvdW50X3ZpZGVvX2FkdicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxpbmtUcmFja1ZhcnMgPSAnZXZlbnRzLHNlcnZlcixlVmFyNTUscHJvcDU1JywgdC5ldmVudHMgPSAnJywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDEyMScsIHQuc2VydmVyID0gd2luZG93LmxvY2F0aW9uLmhvc3QsIHQuZVZhcjU1ID0gdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdjb3VudF92aWRlb19hZHYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw3ZmJkZGM2MTA5YWY0MzZkOGMwOGZiNWM1YzEyN2ExZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTUgW0VSXSBbQ0xJQ0sgQ09SUE9SQVRFXSBPZmZlcnRlIC0gQ2xpY2sgZmlsdHJvIHByZXp6byBiYXNzbycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnLm9yZGVyLWJ5Lmxvd2VyLXByaWNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL29mZmVydGUvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucGFnZU5hbWUgPSAnJywgdC5saW5rVHJhY2tWYXJzID0gJ2VWYXIyNCxwcm9wNTUsZVZhcjU1LGV2ZW50cycsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxNicsIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1JyksIHQuZVZhcjI0ID0gJ29mZmVydGVpbmRleF9maWx0cm9fcHJlenpvcGl1YmFzc28nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdjbGlja19jb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxlZGIzNTY0ZDliNjk0OWY3OTg2MDFlNTE1MGE0NTMzMycsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdbRFJdIFtBT0xdIGFvbHJlbmV3b3JkZXJfcHVyY2hhc2UgKCsgQURGT1JNICsgR09PR0xFIEFEUyknLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2FvbHJlbmV3b3JkZXJfcHVyY2hhc2UnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2QuYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsYW0uYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLmFiYm9uYW1lbnRvLW8uc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5pbmZvKCdBRE9CRSBMQVVOQ0g6IGFvbHJlbmV3b3JkZXJfcHVyY2hhc2UgdXBsb2FkZWQnKSwgdC5ldmVudHMgPSB0LnByb2R1Y3RzID0gJycsIHQucHJvZHVjdHMgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FPTF0gUHJvZG90dGkgRmluYWwnKS5tYXRjaCgvbnVsbDtzY29udG8gcHJlc2VudGEgdW4gYW1pY28vKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQU9MXSBQcm9kb3R0aSBGaW5hbCcpLnN1YnN0cmluZygwLCBfc2F0ZWxsaXRlLmdldFZhcignW0FPTF0gUHJvZG90dGkgRmluYWwnKS5sYXN0SW5kZXhPZignbnVsbDtzY29udG8gcHJlc2VudGEgdW4gYW1pY28nKSAtIDEpICsgX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBT0xdIFByb2RvdHRpIEZpbmFsJykuc3Vic3RyaW5nKF9zYXRlbGxpdGUuZ2V0VmFyKCdbQU9MXSBQcm9kb3R0aSBGaW5hbCcpLmxhc3RJbmRleE9mKCdudWxsO3Njb250byBwcmVzZW50YSB1biBhbWljbycpLCBfc2F0ZWxsaXRlLmdldFZhcignW0FPTF0gUHJvZG90dGkgRmluYWwnKS5sZW5ndGgpLnN1YnN0cmluZyhfc2F0ZWxsaXRlLmdldFZhcignW0FPTF0gUHJvZG90dGkgRmluYWwnKS5zdWJzdHJpbmcoX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBT0xdIFByb2RvdHRpIEZpbmFsJykubGFzdEluZGV4T2YoJ251bGw7c2NvbnRvIHByZXNlbnRhIHVuIGFtaWNvJyksIF9zYXRlbGxpdGUuZ2V0VmFyKCdbQU9MXSBQcm9kb3R0aSBGaW5hbCcpLmxlbmd0aCkuaW5kZXhPZignLCcpLCBfc2F0ZWxsaXRlLmdldFZhcignW0FPTF0gUHJvZG90dGkgRmluYWwnKS5zdWJzdHJpbmcoX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBT0xdIFByb2RvdHRpIEZpbmFsJykubGFzdEluZGV4T2YoJ251bGw7c2NvbnRvIHByZXNlbnRhIHVuIGFtaWNvJyksIF9zYXRlbGxpdGUuZ2V0VmFyKCdbQU9MXSBQcm9kb3R0aSBGaW5hbCcpLmxlbmd0aCkubGVuZ3RoKSA6IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQU9MXSBQcm9kb3R0aSBGaW5hbCcpLCB0LmV2ZW50cyA9ICdwdXJjaGFzZScgKyAoX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBT0xdIFByb2RvdHRpIEZpbmFsJykubWF0Y2goL2V2ZW50MjQvKSA/ICcsZXZlbnQyNCcgOiAnJyksIHQucGFnZU5hbWUgPSAnc2t5OmFjcXVpc3RhOmNoZWNrb3V0Om9yZGVyIGNvbmZpcm1hdGlvbicsIHQuemlwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X3ppcCcpLCBfc2F0ZWxsaXRlLmdldFZhcignQ2hhdFZlbmRpdGVBc3MnKSAmJiAnbm9fY2hhdCcgIT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ0NoYXRWZW5kaXRlQXNzJykgJiYgKHQuZXZlbnRzICs9ICcsZXZlbnQnICsgKF9zYXRlbGxpdGUuZ2V0VmFyKCdDaGF0VmVuZGl0ZUFzcycpLm1hdGNoKC9pbnNlc3Npb24oX3wtKW9wZW4vKSA/ICc2MicgOiBfc2F0ZWxsaXRlLmdldFZhcignQ2hhdFZlbmRpdGVBc3MnKS5tYXRjaCgvaW5zZXNzaW9uKF98LSljbG9zZWQvKSA/ICc2MycgOiBfc2F0ZWxsaXRlLmdldFZhcignQ2hhdFZlbmRpdGVBc3MnKS5tYXRjaCgvY3Jvc3MoX3wtKXNlc3Npb24vKSA/ICc2NCcgOiAnJykpLCB0LmV2ZW50cyArPSAnLGV2ZW50MTM3PScgKyBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfaW5pemlhbGknKSArICcsZXZlbnQxMzg9JyArIF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19tZW5zaWxpJyksIHQucHVyY2hhc2VJRCA9IHQuZVZhcjMwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X3B1cmNoYXNlaWQnKSwgdC5wcm9wMjEgPSBfc2F0ZWxsaXRlLmdldFZhcignQ2FuYWxlIGRcJ2FjcXVpc3RvJyksIHQucHJvcDM0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X3Byb21vY29kZScpLCB0LnByb3AzNSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQU9MXSBFbnRyeVByb2R1Y3QnKSwgdC5wcm9wMzcgPSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfb2ZmZXJ0eXBlJyksIHQucHJvcDU5ID0gJ2FvbCcsIHQucHJvcDYyID0gJycsIHQucGFnZU5hbWUgJiYgKHQuZVZhcjEgPSAnRD1wYWdlTmFtZScpLCB3aW5kb3cucGFnZW5hbWVCYXNlQW9sUmVuZXcgPSB0LmVWYXIxID0gJ3NreTphY3F1aXN0YTpjaGVja291dDpvcmRlciBjb25maXJtYXRpb24nLCB0LmVWYXIxNSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19tZXRvZG8nKSwgdC5lVmFyMjYgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FPTF0gRW50cnlQcm9kdWN0JyksIHQucHJvcDIxICYmICh0LmVWYXIyMiA9ICdEPWMyMicpLCB0LnByb3AzNCAmJiAodC5lVmFyMzQgPSAnRD1jMzQnKSwgdC5wcm9wMzUgJiYgKHQuZVZhcjM1ID0gJ0Q9YzM1JyksIHQucHJvcDM3ICYmICh0LmVWYXIzNyA9ICdEPWMzNycpLCB0LnByb3A1OSAmJiAodC5lVmFyNTkgPSAnRD1jNTknKSwgdC5lVmFyOTggPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsgY2hhbm5lbDogJ0FjcXVpc3RhJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzI3MzMxYzE2NjkyYy8zM2E4NjJhNzA1NGEvMTVhMWU2NGVlZWJlL1JDYmM0YWJlMzk5YjFiNGY0ZjllYjg0ZDFhYTg0NjBhMzgtc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXh0ZXJuYWw6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzI3MzMxYzE2NjkyYy8zM2E4NjJhNzA1NGEvMTVhMWU2NGVlZWJlL1JDNTZmMjIwZGM4NmUwNDA2MGJkZTlhZWYzZjFhMDhmYTYtc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXh0ZXJuYWw6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkwzNmE2MTYyNjdjN2I0MDE1YjY3MmM1MzY2MDgyNzIxNycsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdbRVJdIFtBT0xdIENsaWNrIEJ1dHR1biBDYW1iaWEgT2ZmZXJ0YScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnI2NhbWJpYV9vZmZlcnRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xscHJqLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsYW0uYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsYW0uYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLmFiYm9uYW1lbnRvLW8uc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wYWdlTmFtZSA9ICcnLCB0LmV2ZW50cyA9ICcnLCB0LmxpbmtUcmFja1ZhcnMgPSAnZXZlbnRzLGVWYXIyNCxwcm9wNTUsZVZhcjU1JywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JywgdC5lVmFyMjQgPSAnY2FtYmlhIG9mZmVydGEnLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogeyBjaGFubmVsOiAnQWNxdWlzdGEnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdhb2xfYnV0dG9uX2NhbWJpYV9vZmZlcnRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZWRkNTE1ZDA0OWIzNDYzZjhiNjlmNTA1YTRkYzQyNGQnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzU1IFtFUl0gW0NMSUNLIENPUlBPUkFURV0gU2t5USBlc3Bsb3JhIGZ1bnppb25hbGl0w6AgLSBUYWIgKE1vYmlsZSknLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJ2RpdicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRQcm9wZXJ0aWVzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjbGFzc05hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnbW9iaWxlLWZpeGVkLW1lbnVfY3RhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL3R2XC9za3lxXC9lc3Bsb3JhLWZ1bnppb25hbGl0YXxsYW5kaW5nXC9lc3Bsb3JhLWZ1bnppb25hbGl0YS8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5saW5rVHJhY2tWYXJzID0gJ2VWYXIyNCxwcm9wNTUsZVZhcjU1LGV2ZW50cycsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxNicsIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLnRleHRDb250ZW50LnRvTG93ZXJDYXNlKCkudHJpbSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubWF0Y2goL2luZXZpZGVuemEvKSA/IHQuZVZhcjI0ID0gJ2luIGV2aWRlbnphJyA6IGEubWF0Y2goL2NvbnRyb2xsb3ZvY2FsZS8pID8gdC5lVmFyMjQgPSAnY29udHJvbGxvIHZvY2FsZScgOiBhLm1hdGNoKC9kdXJhbnRlbGEgdmlzaW9uZS8pID8gdC5lVmFyMjQgPSAnZHVyYW50ZSBsYSB2aXNpb25lJyA6IGEubWF0Y2goL2hvbWUgZXJlZ2lzdHJhemlvbmkvKSA/IHQuZVZhcjI0ID0gJ2hvbWUgZSByZWdpc3RyYXppb25pJyA6IHQuZVZhcjI0ID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnY2xpY2tfY29ycG9yYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNDYzODVjYjlmYzhhNGY1Yzg2M2Y0YTFjYWU0NjYwZTEnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnW0RSXSBbQU9MXSBhb2xyZW5ld2Vycm9yX3N0ZXAnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2FvbHJlbmV3ZXJyb3Jfc3RlcCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xscHJqLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJlcHJvZC5hYmJvbmFtZW50by1vLnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbygnQURPQkUgTEFVTkNIOiBhb2xyZW5ld2Vycm9yX3N0ZXAgdXBsb2FkZWQnKSwgdC5wYWdlTmFtZSA9IHQucHJvZHVjdHMgPSAnJywgdC5saW5rVHJhY2tWYXJzID0gJ2V2ZW50cyxjaGFubmVsLHByb3A2MixlVmFyMzQsZVZhcjM3LHByb3AzNCxwcm9wMzcsZVZhcjk4JywgdC5ldmVudHMgPSAnJywgdC50cmFuc2FjdGlvbklEID0gJycsIHQuY2hhbm5lbCA9ICdBY3F1aXN0YScsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxMzUnLCB0LnByb3AzNCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19wcm9tb2NvZGUnKSwgdC5wcm9wMzcgPSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfb2ZmZXJ0eXBlJyksIHQucHJvcDYyID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X2Vycm9yJyksIHQucHJvcDM3ICYmICh0LmVWYXIzNyA9ICdEPWMzNycpLCB0LnByb3AzNCAmJiAodC5lVmFyMzQgPSAnRD1jMzQnKSwgdC5lVmFyOTggPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnYW9sX2Vycm9yX3N0ZXAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw1YjMzNmVmM2Y3Nzc0ZWU1OTc2YjM5MDUwZTc0NzI1MicsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBbQUxMXSBSZWl0ZWsgQ01OICgrIEFERk9STSknLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3RyYWNrX3JlaXRla19jbW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlLmRldGFpbC50eXBlID8gZS5kZXRhaWwudHlwZSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2F0aW9uLnBhdGhuYW1lLm1hdGNoKCdhb2wvYWJib25hdGlvbmxpbmUnKSB8fCBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgnYW9sL2NtbicpID8gdC5wYWdlTmFtZSA9IHdpbmRvdy5wYWdlbmFtZUJhc2VBb2xSZW5ldyArIGUuZGV0YWlsLnN0ZXAgKyAnICcgKyBhIDogdC5wYWdlTmFtZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFBhZ2VOYW1lJykgKyBlLmRldGFpbC5zdGVwICsgJyAnICsgYSwgJzpjbW4gZm9ybTp0eXAnID09IGUuZGV0YWlsLnN0ZXAgJiYgKHQuZXZlbnRzID0gJ2V2ZW50MTYyJywgdC50cmFuc2FjdGlvbklEID0gZS5kZXRhaWwudHJhbnNpZCksIHQuc2VydmVyID0gZG9jdW1lbnQuZG9tYWluLCB0LnByb3A1NCA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU0ICYmICh0LmVWYXI1NCA9ICdEPWM1NCcpLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vMjczMzFjMTY2OTJjLzMzYTg2MmE3MDU0YS8xNWExZTY0ZWVlYmUvUkM5ZTg0NmU1OWU5YmM0YjUxYmQ1YTNhMWZiNjJmMjNhNC1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGE2YjRiYmJiYjQxMjQxZWFhZmVjZTA1YjE0NzcyODcwJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbUExdIEhPVENMVUIgVHJhZmZpY28nLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvbGlicmFyeUxvYWRlZC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLmhvdGNsdWIuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdob3RjbHViLnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHJvcDI5ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA6ICcnLCB0LnByb3A1MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgOiAnJywgdC5wcm9wNTQgPSBsb2NhdGlvbi5ocmVmLCB0LnByb3A1NSA9IGxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTkgPSBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvXC9hdHRyaWNpfFwvYXR0b3JpLykgPyAnaG90Y2x1YiBhdHRvcmknIDogbG9jYXRpb24ucGF0aG5hbWUubWF0Y2goL1wvdmlkZW8vKSA/ICdob3RjbHViIHZpZGVvJyA6IGxvY2F0aW9uLnBhdGhuYW1lLm1hdGNoKC9cL3NwZWNpYWxpLykgPyAnaG90Y2x1YiBzcGVjaWFsaScgOiBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvXC9jYXRlZ29yaWUvKSA/ICdob3RjbHViIGNhdGVnb3JpZScgOiBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvXC9vbi1kZW1hbmQvKSA/ICdob3RjbHViIG9uIGRlbWFuZCcgOiBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvXC9nZW5lcmkvKSA/ICdob3RjbHViIGdlbmVyaScgOiBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvXC9vZmZlcnRhfFwvb2ZmZXJ0ZS8pID8gJ2hvdGNsdWIgb2ZmZXJ0ZScgOiBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvXC9jb21lLWFjcXVpc3RhcmUvKSA/ICdob3RjbHViIGNvbWUgYWNxdWlzdGFyZScgOiBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvXC9jYXNlLWRpLXByb2R1emlvbmUvKSA/ICdob3RjbHViIGNhc2UgZGkgcHJvZHV6aW9uZScgOiBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvXC9yaXNlcnZhdGV6emEvKSA/ICdob3RjbHViIHJpc2VydmF0ZXp6YScgOiBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvXC9mYXEvKSA/ICdob3RjbHViIGZhcScgOiAnLycgPT0gbG9jYXRpb24ucGF0aG5hbWUgPyAnaG90Y2x1YiBob21lJyA6IGxvY2F0aW9uLnBhdGhuYW1lLm1hdGNoKC9cL3BhcmVudGFsLWNvbnRyb2wvKSA/ICdob3RjbHViIHBhcmVudGFsIGNvbnRyb2wnIDogJ2hvdGNsdWIgb3RoZXInLCB0LnByb3A2NyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBDb29raWUgTG9naW4gU3RhdHVzJyksIHQucGFnZU5hbWUgPSBsb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sICcnICE9PSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBDbXAnKSAmJiAodC5jYW1wYWlnbiA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIENtcCcpKSwgdC5wYWdlTmFtZSAmJiAodC5lVmFyMSA9ICdEPXBhZ2VOYW1lJyksICcnICE9PSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBJbnRjbXAnKSA/IHQuZVZhcjEwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gSW50Y21wJykgOiAnJyAhPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgSW50Y21wJykgPyB0LmVWYXIxMCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIEludGNtcCcpIDogdC5lVmFyMTAgPSAnJywgdC5wcm9wNTAgJiYgKHQuZVZhcjUwID0gJ0Q9YzUwJyksIHQucHJvcDU0ICYmICh0LmVWYXI1NCA9ICdEPWM1NCcpLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKSwgdC5wcm9wNTkgJiYgKHQuZVZhcjU5ID0gJ0Q9YzU5JyksIHQucHJvcDY3ICYmICh0LmVWYXI2NyA9ICdEPWM2NycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmVyOiAnJVtBTExdIFNlcnZlciUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbDogJ0hvdGNsdWInCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGVmOWMzODlhNWYyNjQ3NzA4NWMyY2ZlMDFlYjc5MTQ3JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbRFJdIFNwZWVkIFRlc3QgLSBlc2l0byBuZWdhdGl2bycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnZmlicmF0ZXN0X25lZ2F0aXZvJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjYWVtLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy53d3cuc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHRyYWNrZXJQcm9wZXJ0aWVzOiB7IHBhZ2VOYW1lOiAnc2t5OmFzc2lzdGVuemE6c2t5dmlhZmlicmF0ZXN0OmVzaXRvLW5lZ2F0aXZvJyB9IH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMzJjMzQwZTRmZWJmNDA2YmJhNDE5ZDY4ODc5OTg4YjMnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gQXNzaXN0ZW56YSBGbHVzc28gRGlzZGV0dGEgQXNJcycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAndHJhY2tkZGxjb25jb3JyZW56YScgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5pbmZvKCdhZG9iZSBkaXNkZXR0YSA+IHBhZ2VuYW1lOiAnICsgX3NhdGVsbGl0ZS5nZXRWYXIoJ2RkbF9wYWdlbmFtZScpICsgJyBtb3RpdmF6aW9uZTogJyArIF9zYXRlbGxpdGUuZ2V0VmFyKCdkZGxfbW90aXZhemlvbmUnKSArICcgc2NhZGVuemE6ICcgKyBfc2F0ZWxsaXRlLmdldFZhcignZGRsX3NjYWRlbnphJykpLCB0LmNoYW5uZWwgPSAnY29ycG9yYXRlJywgdC5wcm9wNTkgPSAnYXNzaXN0ZW56YScsIHQucHJvcDYwID0gJ2Rpc2RldHRhLWFiYm9uYW1lbnRvJywgdC5wcm9wNTkgJiYgKHQuZVZhcjU5ID0gJ0Q9YzU5JyksIHQucHJvcDYwICYmICh0LmVWYXI2MCA9ICdEPWM2MCcpLCB0LmVWYXIyOCA9ICcnLCB0LmVWYXIyOSA9ICcnLCBfc2F0ZWxsaXRlLmdldFZhcignZGRsX21vdGl2YXppb25lJykgJiYgKHQuZVZhcjI4ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2RkbF9tb3RpdmF6aW9uZScpKSwgX3NhdGVsbGl0ZS5nZXRWYXIoJ2RkbF9zY2FkZW56YScpICYmICh0LmVWYXIyOSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdkZGxfc2NhZGVuemEnKSksIGEgPSAnZW50cm8gMTQgZ2lvcm5pJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignZGRsX3NjYWRlbnphJykgfHwgJ2FsdHJvJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignZGRsX3NjYWRlbnphJykgPyAncmVjZXNzbycgOiAnZGlzZGV0dGEnLCB0LnBhZ2VOYW1lID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2RkbF9wYWdlbmFtZScpLCAnc2t5OmFzc2lzdGVuemE6ZGlzZGV0dGEtYWJib25hbWVudG86c3RlcHMtZGlzZGV0dGEnID09IHQucGFnZU5hbWUgJiYgKHQucGFnZW5hbWUgPSAnc2t5OmFzc2lzdGVuemE6ZGlzZGV0dGEtYWJib25hbWVudG86c2NlbHRhLWNvbnRyYXR0bycpLCAnc2t5OmFzc2lzdGVuemE6ZGlzZGV0dGEtYWJib25hbWVudG86dHlwJyA9PSB0LnBhZ2VOYW1lICYmICdkaXNkZXR0YScgPT0gYSA/IHQucGFnZU5hbWUgPSAnc2t5OmFzc2lzdGVuemE6ZGlzZGV0dGEtYWJib25hbWVudG86b2stZGlzZGV0dGEnIDogJ3NreTphc3Npc3RlbnphOmRpc2RldHRhLWFiYm9uYW1lbnRvOnR5cCcgPT0gdC5wYWdlTmFtZSAmJiAncmVjZXNzbycgPT0gYSAmJiAodC5wYWdlTmFtZSA9ICdza3k6YXNzaXN0ZW56YTpkaXNkZXR0YS1hYmJvbmFtZW50bzpvay1yZWNlc3NvJyksICdza3k6YXNzaXN0ZW56YTpkaXNkZXR0YS1hYmJvbmFtZW50bzpyaWVwaWxvZ28nID09IHQucGFnZU5hbWUgJiYgJ2Rpc2RldHRhJyA9PSBhID8gdC5wYWdlTmFtZSA9ICdza3k6YXNzaXN0ZW56YTpkaXNkZXR0YS1hYmJvbmFtZW50bzpyaWVwaWxvZ28tZGlzZGV0dGEnIDogJ3NreTphc3Npc3RlbnphOmRpc2RldHRhLWFiYm9uYW1lbnRvOnJpZXBpbG9nbycgPT0gdC5wYWdlTmFtZSAmJiAncmVjZXNzbycgPT0gYSAmJiAodC5wYWdlTmFtZSA9ICdza3k6YXNzaXN0ZW56YTpkaXNkZXR0YS1hYmJvbmFtZW50bzpyaWVwaWxvZ28tcmVjZXNzbycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2RkbF9tb3RpdmF6aW9uZScpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ2RkbF9tb3RpdmF6aW9uZScpIDogJycsIHIgPSBfc2F0ZWxsaXRlLmdldFZhcignZGRsX3NjYWRlbnphJykgPyBfc2F0ZWxsaXRlLmdldFZhcignZGRsX3NjYWRlbnphJykgOiAnJywgaSA9IG4gJiYgciA/IG4gKyAnIC0gJyArIHIgOiBuICYmICFyID8gbiA6ICFuICYmIHIgPyByIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NreTphc3Npc3RlbnphOmRpc2RldHRhLWFiYm9uYW1lbnRvOnNjZWx0YS1jb250cmF0dG8nID09IHQucGFnZU5hbWUgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGFkZiAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBhZGYuQ2xpY2tUcmFjayA/IGFkZi5DbGlja1RyYWNrKCQoJ2JvZHknKSwgMTI0MDc2LCAnRGlzZGV0dGEgLSBTY2VsdGEgQWJib25hbWVudG8nLCB7IHN2MTM6IF9zYXRlbGxpdGUuZ2V0VmFyKCdFeHRlcm5hbCBJRCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ0V4dGVybmFsIElEJykgOiAnJyB9KSA6ICh0LnBhZ2VOYW1lLCAnc2t5OmFzc2lzdGVuemE6ZGlzZGV0dGEtYWJib25hbWVudG86b2stZGlzZGV0dGEnICE9IHQucGFnZU5hbWUgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGFkZiAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBhZGYuQ2xpY2tUcmFjayA/IGFkZi5DbGlja1RyYWNrKCQoJ2JvZHknKSwgMTI0MDc2LCAnRGlzZGV0dGEgLSBGdW5uZWwnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN2MTM6IF9zYXRlbGxpdGUuZ2V0VmFyKCdFeHRlcm5hbCBJRCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ0V4dGVybmFsIElEJykgOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Y4MzogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Y5MjogdC5wYWdlTmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Y5MzogaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogJ3NreTphc3Npc3RlbnphOmRpc2RldHRhLWFiYm9uYW1lbnRvOm9rLWRpc2RldHRhJyA9PSB0LnBhZ2VOYW1lICYmICdvYmplY3QnID09IHR5cGVvZiBhZGYgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgYWRmLkNsaWNrVHJhY2sgJiYgYWRmLkNsaWNrVHJhY2soJCgnYm9keScpLCAxMjQwNzYsICdEaXNkZXR0YSAtIFRZUCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3YxMzogX3NhdGVsbGl0ZS5nZXRWYXIoJ0V4dGVybmFsIElEJykgPyBfc2F0ZWxsaXRlLmdldFZhcignRXh0ZXJuYWwgSUQnKSA6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdjgzOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdjkyOiB0LnBhZ2VOYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdjkzOiBpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGY4OGI5NWYyNWZkMDRhOGE4N2QwMjgwMGEzYmE2ZGNhJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbRFJdIFtBTExdIFJlaXRlayBDTUIgKCsgQURGT1JNKScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAndHJhY2tfcmVpdGVrX2NtYicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUuZGV0YWlsLnR5cGUgPyBlLmRldGFpbC50eXBlIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9jYXRpb24ucGF0aG5hbWUubWF0Y2goJ2FvbC9hYmJvbmF0aW9ubGluZScpIHx8IGxvY2F0aW9uLnBhdGhuYW1lLm1hdGNoKCdhb2wvY21uJykgPyB0LnBhZ2VOYW1lID0gd2luZG93LnBhZ2VuYW1lQmFzZUFvbFJlbmV3ICsgZS5kZXRhaWwuc3RlcCArICcgJyArIGEgOiB0LnBhZ2VOYW1lID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUGFnZU5hbWUnKSArIGUuZGV0YWlsLnN0ZXAgKyAnICcgKyBhLCAnOmNtYiBmb3JtOnR5cCcgPT0gZS5kZXRhaWwuc3RlcCAmJiAodC5ldmVudHMgPSAnZXZlbnQxNjMnLCB0LnRyYW5zYWN0aW9uSUQgPSBlLmRldGFpbC50cmFuc2lkKSwgdC5zZXJ2ZXIgPSBkb2N1bWVudC5kb21haW4sIHQucHJvcDU0ID0gd2luZG93LmxvY2F0aW9uLmhyZWYsIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS8yNzMzMWMxNjY5MmMvMzNhODYyYTcwNTRhLzE1YTFlNjRlZWViZS9SQzZkYzcxMjZkMWFiNDQyYzFhZjMyNDdmN2NhYmNmNjZhLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMjk5YWQzZmQwYzMyNDczNWEwM2ZmM2QzNmEzZjUzMjUnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gVHJhY2tpbmcgRkFRIENvcnBvcmF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAndHJhY2tfdHJhY2tpbmdmYXFjb3Jwb3JhdGVfYWN0aW9uJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZXZlbnRzID0gJycsIHQucGFnZU5hbWUgPSAnJywgdC5saW5rVHJhY2tWYXJzID0gJ2V2ZW50cyxlVmFyMjQscHJvcDU0LGVWYXI1NCxwcm9wNTUsZVZhcjU1JywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JywgdC5lVmFyMjQgPSAnZmFxOicgKyBfc2F0ZWxsaXRlLmdldFZhcigndHJhY2tfdHJhY2tpbmdmYXFjb3Jwb3JhdGVfbGFiZWwnKSwgdC5wcm9wNTQgPSB3aW5kb3cubG9jYXRpb24uaHJlZiwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ3RyYWNraW5nZmFxY29ycG9yYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmNTU0NTNkYzIzMDE0YjZjOTYyZGYzZDBhMDcwY2ExZScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0VSXSBBcGVydHVyYSBDaGF0IC0gRGlzZGV0dGEgQXNzaXN0ZW56YScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYnV0dG9uLmNoYXRTaG93JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFByb3BlcnRpZXM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ2xpdmVhZ2VudF9idXR0b25fb25saW5lXzU3MzFvMDAwMDAwQ2NDdycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZG9jdW1lbnQubG9jYXRpb24ucGF0aG5hbWUubWF0Y2goL2Fzc2lzdGVuemFcL2Rpc2RldHRhLWFiYm9uYW1lbnRvLyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnBhZ2VOYW1lID0gJycsIHQubGlua1RyYWNrVmFycyA9ICdldmVudHMsZVZhcjU0LHByb3A1NCxlVmFyODAsZVZhcjgxJywgdC5ldmVudHMgPSAnJywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDExJywgdC5lVmFyODAgPSAnQ2hhdCBBc3Npc3RlbnphIERpc2RldHRhJywgdC5lVmFyODEgPSB0LmVWYXI1NCA9IHQucHJvcDU0ID0gZG9jdW1lbnQubG9jYXRpb24uaHJlZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnY2hhdF9hc3Npc3RlbnphX2Rpc2RldHRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmMjRmNDU3NDgyNTc0ZmNkYWU2Y2NkNmY4NzQyZDU3MScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW1BMXSBbVEFHIFRFUlpJXSBERlAgKExpYnJlcmlhKScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gX3NhdGVsbGl0ZS5jb29raWUuZ2V0KCdleHQnKSAmJiAhbG9jYXRpb24uaHJlZi5tYXRjaCgvZmlsZTpcL1wvXC9DXDpcLy8pICYmICFkb2N1bWVudC5kb21haW4ubWF0Y2goLyhjYWVtfHNhZW18cHJlYWVtfGNvbGxhbXxjb2xscHJqfGNvbGxuZXd8Y29sbG5ldzJ8Y29sbGNtc3xwcmVwcm9kKS8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ3ZhciBleHRpZCA9IF9zYXRlbGxpdGUuY29va2llLmdldCgiZXh0IikgIT0gInVuZGVmaW5lZCIgPyBfc2F0ZWxsaXRlLmNvb2tpZS5nZXQoImV4dCIpIDogIiI7XG5cbi8vRG91YmxlQ2xpY2sgZm9yIFB1Ymxpc2hlcnMgKERGUClcbnZhciBheGVsID0gTWF0aC5yYW5kb20oKSArICIiO1xudmFyIGEgPSBheGVsICogMTAwMDAwMDAwMDAwMDA7XG52YXIgZG91YmxlY2xpY2tJbWcgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJpbWciKTtcbmRvdWJsZWNsaWNrSW1nLnNldEF0dHJpYnV0ZSgic3R5bGUiLCAiZGlzcGxheTogbm9uZTsiKTtcbmRvdWJsZWNsaWNrSW1nLnNldEF0dHJpYnV0ZSgic3JjIiwgImh0dHBzOi8vcHViYWRzLmcuZG91YmxlY2xpY2submV0L2FjdGl2aXR5O2RjX2l1PS8zMTY4MTY5OTUvREZQQXVkaWVuY2VQaXhlbDtvcmQ9IisgYSArICJfIiArIGV4dGlkICsgIjtkY19zZWc9NjU1NDU4NjY0PyIpO1xuZG9jdW1lbnQuYm9keS5pbnNlcnRCZWZvcmUoZG91YmxlY2xpY2tJbWcsIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJoZWFkZXIiKSk7JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw5YTJkNTAxNjc3MmI0OGYzOWFiZmY0OWE2MDNkNDk1NicsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBGbHVzc28gRGlzZGV0dGEgQ2FydG9uYXRvIEJCJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICd0cmFja2Rpc2RldHRhJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGRvbWFpbnM6IFsnc2NlZ2xpLnNreS5pdCddIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbygnQURPQkUgTEFVTkNIIC0gdHJhY2tkaXNkZXR0YSArIHBhZ2VuYW1lOicgKyBfc2F0ZWxsaXRlLmdldFZhcignZGlzX3BhZ2VuYW1lJykpLCB0LnBhZ2VOYW1lID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2Rpc19wYWdlbmFtZScpLCB0LmNoYW5uZWwgPSAnY29ycG9yYXRlJywgdC5wcm9wNTkgPSAnYXNzaXN0ZW56YScsIHQucHJvcDYwID0gJ2Rpc2RldHRhLWFiYm9uYW1lbnRvLXdpZmknLCB0LnByb3A1OSAmJiAodC5lVmFyNTkgPSAnRD1jNTknKSwgdC5wcm9wNjAgJiYgKHQuZVZhcjYwID0gJ0Q9YzYwJyksIHQuZVZhcjI4ID0gJycsIHQuZVZhcjI5ID0gJycsIF9zYXRlbGxpdGUuZ2V0VmFyKCdkaXNfbW90aXZhemlvbmUnKSAmJiAodC5lVmFyMjggPSBfc2F0ZWxsaXRlLmdldFZhcignZGlzX21vdGl2YXppb25lJykpLCBfc2F0ZWxsaXRlLmdldFZhcignZGlzX21vZGFsaXRhJykgJiYgKHQuZVZhcjI5ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2Rpc19tb2RhbGl0YScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGViZDY3NjFiNWFmMTQ5MTBiY2VhMzI4YWExNjBmNTJmJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIEluZGV4IFR2IC0gVm9jaSBTdWJtZW51ICcsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnLmRyb3Bkb3duLmV4cGxvZGUgbGknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1NQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcvdHYnID09PSBsb2NhdGlvbi5wYXRobmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdlVmFyMjQscHJvcDU1LGVWYXI1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy50ZXh0Q29udGVudC50b0xvd2VyQ2FzZSgpLnJlcGxhY2UoJyAnLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5lVmFyMjQgPSAnaW5kZXgtdHZfbWVudV8nICsgYSArICdfYW5jaG9yJywgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnY2xpY2tfY29ycG9yYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNjlkY2QzYzRjMjJmNDczZWJjNjFmNjFkZDliYzNiYWEnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtFUl0gQXBlcnR1cmEgQ2hhdCAnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJ1AsIEEsIERJVicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISghdGhpcy5pZC5tYXRjaCgvbGl2ZWFnZW50LipcZHxkaXYtbmF2LWNoYXR8Y2hhdF9hY3Rpb24vKSB8fCB0aGlzLmlkLm1hdGNoKC81NzMyNDAwMDAwMFBEN04vKSB8fCB0aGlzLmlkLm1hdGNoKC9DbG9zZS8pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vMjczMzFjMTY2OTJjLzMzYTg2MmE3MDU0YS8xNWExZTY0ZWVlYmUvUkMzYzM4NjFmZTA0ZWQ0ZTgxYTVlYjBlMDU1ZjE3YTdiZS1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNmQ1MDJkMWJkOTk5NDk4YjliODNlYjc2N2I1NWFlMmInLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnW1BMXSBbQU9MXSBDTU4gLSBGbHVzc28gZGEgY2hhdCAnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvbGlicmFyeUxvYWRlZC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFkb2N1bWVudC5sb2NhdGlvbi5ocmVmLm1hdGNoKC9jb250ZW50XC9uZXdhb2xcL2NvbW1vblwvY21uX2NoYXQvKSAmJiAhZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvY29udGVudFwvYW9sXC9jb21tb25cL2Ntbl9jaGF0LykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5pbmZvKCdBRE9CRSBMQVVOQ0g6IGZsdXNzbyBjbW4gZGEgY2hhdCB1cGxvYWRlZCcpLCB0LnBhZ2VOYW1lID0gZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvY2hrcD0wLykgPyAnc2t5OmFjcXVpc3RhOm5vIGNoYXQ6Y21uOnR5cCcgOiBkb2N1bWVudC5sb2NhdGlvbi5ocmVmLm1hdGNoKC9jaGtwPTEvKSA/ICdza3k6YWNxdWlzdGE6bm8gY2hhdDpjbW46a28nIDogJ3NreTphY3F1aXN0YTpubyBjaGF0OmNtbicsIHQucHJvcDU5ID0gJ2FvbCcsIHQucHJvcDU5ICYmICh0LmVWYXI1OSA9ICdEPWM1OScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDJjMzdjMWM5ZTY4ZTRmZDc5Y2E2MWEzN2EzZWJiZjg2JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbRFJdIFNwZWVkIFRlc3QgQW9sIENyb3NzcGFnZSAtIGVzaXRvIG5lZ2F0aXZvJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdmaWJyYXRlc3RfbmVnYXRpdm8nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2QuYWJib25hbWVudG8tby5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNlcnZlciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBTZXJ2ZXInKSwgdC5jaGFubmVsID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpIDogJycsIHQucGFnZU5hbWUgPSAnc2t5OmFjcXVpc3RhOmNyb3NzcGFnZTplc2l0by1uZWdhdGl2bycsIHQucHJvcDIgPSB0LmdldFByZXZpb3VzVmFsdWUodC5wYWdlTmFtZSwgJ2dwdl9wbicpLCB0LnByb3A1ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFF1YXJ0byBMaXZlbGxvJykgOiAnJywgdC5wcm9wMjkgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpIDogJycsIHQucHJvcDUwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA6ICcnLCB0LnByb3A1NCA9IGxvY2F0aW9uLmhyZWYsIHQucHJvcDU1ID0gbG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1OSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjcgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gQ29va2llIExvZ2luIFN0YXR1cycpLCB0LnBhZ2VOYW1lICYmICh0LmVWYXIxID0gJ0Q9cGFnZU5hbWUnKSwgdC5wcm9wMiAmJiAodC5lVmFyMiA9ICdEPWMyJyksIHQucHJvcDUgJiYgKHQuZVZhcjUgPSAnRD1jNScpLCB0LnByb3A1NCAmJiAodC5lVmFyNTQgPSAnRD1jNTQnKSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1JyksIHQucHJvcDU5ICYmICh0LmVWYXI1OSA9ICdEPWM1OScpLCB0LnByb3A2MCAmJiAodC5lVmFyNjAgPSAnRD1jNjAnKSwgdC5wcm9wNjcgJiYgKHQuZVZhcjY3ID0gJ0Q9YzY3Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZjZhZDk1OTZmODg3NGEzMzg1M2I4YmM1YWMwMDc5N2EnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnW1BMXSBbQU9MXSBhdHRlcnJhZ2dpbyBpbiBwcm9tbycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2QuYWJib25hbWVudG8tby5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmluZm8oJ0FET0JFIExBVU5DSDogYXR0ZXJyYWdnaW8gdXBsb2FkZWQnKSwgdC5zZXJ2ZXIgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gU2VydmVyJyksIHQuY2hhbm5lbCA9ICdBY3F1aXN0YScsIGxvY2F0aW9uLmhyZWYubWF0Y2goL2FvbFwvY21uY2hhdC8pID8gKHQucGFnZU5hbWUgPSAnc2t5OmFjcXVpc3RhOm5vIGNoYXQ6Y21uJywgd2luZG93LnBhZ2VuYW1lQmFzZUFvbFJlbmV3ID0gJ3NreTphY3F1aXN0YTpubyBjaGF0OmNtbicpIDogbG9jYXRpb24uaHJlZi5tYXRjaCgvYW9sXC9jbW4vKSA/ICh0LnBhZ2VOYW1lID0gJ3NreTphY3F1aXN0YTpubyBwcm9tbzpjbW4nLCB3aW5kb3cucGFnZW5hbWVCYXNlQW9sUmVuZXcgPSAnc2t5OmFjcXVpc3RhOm5vIHByb21vOmNtbicpIDogbG9jYXRpb24uaHJlZi5tYXRjaCgvYW9sXC9jcm9zc3BhZ2UvKSA/IHQucGFnZU5hbWUgPSAnc2t5OmFjcXVpc3RhOmNyb3NzcGFnZScgOiB0LnBhZ2VOYW1lID0gJ3NreTphY3F1aXN0YScsICcnICE9PSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBDbXAnKSAmJiAodC5jYW1wYWlnbiA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIENtcCcpKSwgdC5wcm9wMiA9IHQuZ2V0UHJldmlvdXNWYWx1ZSh0LnBhZ2VOYW1lLCAnZ3B2X3BuJyksIHQucHJvcDI5ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA6ICcnLCB0LnByb3AzNCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQU9MXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIENvZHByb21vJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FPTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBDb2Rwcm9tbycpIDogJycsIHQucHJvcDUwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA6ICcnLCB0LnByb3A1NCA9IGxvY2F0aW9uLmhyZWYsIHQucHJvcDU1ID0gbG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1OSA9ICdhb2wnLCB0LnByb3A2NyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBDb29raWUgTG9naW4gU3RhdHVzJyksIHQucGFnZU5hbWUgJiYgKHQuZVZhcjEgPSAnRD1wYWdlTmFtZScpLCB0LnByb3AyICYmICh0LmVWYXIyID0gJ0Q9YzInKSwgdC5lVmFyMTAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBJbnRjbXAnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIEludGNtcCcpIDogJycsIGxvY2F0aW9uLnBhdGhuYW1lLm1hdGNoKC9cL2FvbFwvLykgfHwgKHQuZVZhcjIyID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIG1vYmlsZURUTWNoZWNrICYmIG1vYmlsZURUTWNoZWNrID8gJ21vYmlsZSBzaXRlJyA6ICdkZXNrdG9wIHNpdGUnKSwgdC5wcm9wNTAgJiYgKHQuZVZhcjUwID0gJ0Q9YzUwJyksIHQucHJvcDM0ICYmICh0LmVWYXIzNCA9ICdEPWMzNCcpLCB0LnByb3A1MCAmJiAodC5lVmFyNTAgPSAnRD1jNTAnKSwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpLCB0LnByb3A1OSAmJiAodC5lVmFyNTkgPSAnRD1jNTknKSwgdC5wcm9wNjcgJiYgKHQuZVZhcjY3ID0gJ0Q9YzY3Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMTI4Y2Q0YzNjYTNmNDJmYjk3NmU5N2E3MWE4NjM0OGYnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnW0VSXSBbQU9MXSBDbGljayBCdXR0dW4gQXBwbGljYSBGaWx0cmknLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJy5za3ktYnRuLnNreS1idG4tYmx1ZS5idG4tc2F2ZS1maWx0ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2QuYWJib25hbWVudG8tby5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnBhZ2VOYW1lID0gJycsIHQuZXZlbnRzID0gJycsIHQubGlua1RyYWNrVmFycyA9ICdldmVudHMsZVZhcjI0LHByb3A1NSxlVmFyNTUnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LmVWYXIyNCA9ICdhcHBsaWNhIGZpbHRyaScsIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7IGNoYW5uZWw6ICdBY3F1aXN0YScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2FvbF9idXR0b25fYXBwbGljYV9maWx0cmknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkwyYmYwMTM2MDI2NjE0MTljYjEzOGJjZTA1YzQzNmJiOCcsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW1BMXSBbVEFHIFRFUlpJXSBbQU9MXSBBREZPUk0gKERNUCkgJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RvbVJlYWR5LmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2QuYWJib25hbWVudG8tby5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzI3MzMxYzE2NjkyYy8zM2E4NjJhNzA1NGEvMTVhMWU2NGVlZWJlL1JDY2E3NDJlNjQ4OWVjNDU5OWE3Mzg2MzhjZjkwMzA3YjAtc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXh0ZXJuYWw6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDk2OWExODNiMzlmYzRkZTRiMTFmN2Q1NDc1ZGZlYjcxJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIExhbmRpbmcgQXBlcnR1cmEgQ01OIFZpdm9jaGEgJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICd0YWJsZS52aXZvY2hhX3dpZGdldF9sYWJlbF9yaWdodCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDU1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wYWdlTmFtZSA9ICcnLCB0LmxpbmtUcmFja1ZhcnMgPSAnZVZhcjI0LHByb3A1NSxlVmFyNTUsZXZlbnRzJywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JywgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKSwgd2luZG93LmxvY2F0aW9uLmhyZWYubWF0Y2goL3NreXBvcnRhbFwvZmFjZXNcL2ZhaURhVGUoLiopLykgPyB0LmVWYXIyNCA9ICd3c2Mtdml2b2NoYS1zZXJ2ZSBhaXV0bycgOiB0LmVWYXIyNCA9ICdsYW5kaW5nIHVwcy1zZXJ2ZSBhaXV0byc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2N0YV9jbW5fdml2b2NoYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGZkY2M5Y2IyMTk5NDRjNTQ5NDQwZWE5NjRjYjdlYTk2JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbUExdIEF0dGVycmFnZ2lvIEZsdXNzbyBEaXNkZXR0YSBDYXJ0b25hdG8gQkInLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvbGlicmFyeUxvYWRlZC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFsb2NhdGlvbi5ocmVmLm1hdGNoKCdzY2VnbGkuc2t5Lml0L2Rpc2RldHRhLWFiYm9uYW1lbnRvLXdpZmkvaW5kZXgucGhwL3BhZ2VzL3N1cnZleScpICYmICFsb2NhdGlvbi5ocmVmLm1hdGNoKCdodHRwczovL3NjZWdsaS5za3kuaXQvZGlzZGV0dGEtYWJib25hbWVudG8td2lmaS8nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmNoYW5uZWwgPSAnY29ycG9yYXRlJywgdC5wcm9wNTkgPSAnYXNzaXN0ZW56YScsIHQucHJvcDYwID0gJ2Rpc2RldHRhLWFiYm9uYW1lbnRvLXdpZmknLCB0LnByb3A1OSAmJiAodC5lVmFyNTkgPSAnRD1jNTknKSwgdC5wcm9wNjAgJiYgKHQuZVZhcjYwID0gJ0Q9YzYwJyksIGxvY2F0aW9uLmhyZWYubWF0Y2goJ3NjZWdsaS5za3kuaXQvZGlzZGV0dGEtYWJib25hbWVudG8td2lmaS9pbmRleC5waHAvcGFnZXMvc3VydmV5JykgPyB0LnBhZ2VOYW1lID0gJ3NreTphc3Npc3RlbnphOmRpc2RldHRhLWFiYm9uYW1lbnRvLXdpZmk6c2NlbHRhIGNvbnRyYXR0bycgOiBsb2NhdGlvbi5ocmVmLm1hdGNoKCdodHRwczovL3NjZWdsaS5za3kuaXQvZGlzZGV0dGEtYWJib25hbWVudG8td2lmaS8nKSAmJiAodC5wYWdlTmFtZSA9ICdza3k6YXNzaXN0ZW56YTpkaXNkZXR0YS1hYmJvbmFtZW50by13aWZpJyksIGNvbnNvbGUuaW5mbygnQURPQkUgTEFVTkNIIC0gcGwgKyBwYWdlbmFtZTonICsgdC5wYWdlTmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMODljMTY5ZGYwNTJiNDQ0NDhlMTRkYzI1ZDVhYzY0ZGMnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtFUl0gW0ZBUSBDT1JQT1JBVEVdIE9sZCBwYWdlcycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnZGl2LmZhcSAucGFuZWwtZ3JvdXAgLnBhbmVsLnBhbmVsLWRlZmF1bHQgLnBhbmVsLWhlYWRpbmcgYS5jb2xsYXBzZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL3d3d1wuc2t5XC5pdFwvdHYvKSAmJiAhZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvd3d3XC5za3lcLml0XC9vZmZlcnRlLykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLnRleHRDb250ZW50LnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IChhID0gYS5yZXBsYWNlKC9cbi9nLCAnICcpKS5yZXBsYWNlKC9cc1xzKy9nLCAnICcpLCB0LmxpbmtUcmFja1ZhcnMgPSAnZVZhcjI0LHByb3A1NSxlVmFyNTUsZXZlbnRzJywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JywgdC5lVmFyMjQgPSAnZmFxOiAnICsgYS50cmltKCksIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2ZhcV9jb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDgzOTMwNzRkMTZiNDRjYTVhYmQ0MWI4ZjExNDk3ZDg0JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIERhem4gLSBUb29sIEN0YSBhZGVyaXNjaSBvZmZlcnRhIChzYXRlbGxpdGUpJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcjZGF6bi1mbG93LWZpbmFsLWN0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDU1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFkb2N1bWVudC5sb2NhdGlvbi5ocmVmLm1hdGNoKC90dlwvZGF6bi8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5saW5rVHJhY2tWYXJzID0gJ2VWYXIyNCxwcm9wNTUsZVZhcjU1LGV2ZW50cycsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxNicsIHQuZVZhcjI0ID0gJ2Rhem4gdG9vbCBhZGVyaXNjaSBvZmZlcnRhIHN0YW5kYXJkJywgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnY2xpY2tfY29ycG9yYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZjU4ZDU3N2ZhODc4NDJjOWIyNDY0N2UwZWM2MjA5MmEnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtQTF0gW1RBRyBURVJaSV0gQURGT1JNIChNYXJrZXRlciBlIERNUCkgLSBBTEwnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZG9tUmVhZHkuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3ZpbGNtcy53d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjYWVtLnd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NhZW0uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLnd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Rlc3QuZXh0cmEuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdleHRyYS5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2Qtd3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy5ob3RjbHViLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2NlZ2xpLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdob3RjbHViLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGVzdC5zY2VnbGkuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdza3lpdGFsaWEuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLnNreWl0YWxpYS5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2t5YWNhZGVteS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy5za3lhY2FkZW15Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2t5Lndpbm5lcmxhbmQuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzbWFydGxlYWQuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryb3ZhLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2t5bG9jYXRvci5ub2h1cC5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vMjczMzFjMTY2OTJjLzMzYTg2MmE3MDU0YS8xNWExZTY0ZWVlYmUvUkM5NWMzMDIzYzU5M2U0M2U1YmNlZmMyZmMzYjlhOTVkZi1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNDUwNjM3M2Y0MjZlNDVkMmFkN2VmZTM5YTE4YjExYjInLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzU1IFtFUl0gW0NMSUNLIENPUlBPUkFURV0gU2t5IEtpZHMgLSBDdGEgYXR0aXZhIGtpZHMgLSBmYXEnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJyNjb2xsYXBzZTMgPiBkaXYgPiBwID4gYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDU1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFkb2N1bWVudC5sb2NhdGlvbi5ocmVmLm1hdGNoKC90dlwvc2t5LWtpZHMvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdlVmFyMjQsZVZhcjU1LHByb3A1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LmVWYXIyNCA9ICdjdGFfc2t5LWtpZHNfZmFxX3Blci1hdHRpdmFyZScsIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2NsaWNrX2NvcnBvcmF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDk0YTZlNzRlMDdmZjQyMmY5MDk2MjEwODZiYmI3NDQwJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIExhbmRpbmcgcmVjb250cmFjdGluZyAtIEN0YSB0aSByaWNoaWFtaWFtbyBub2knLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJy5jdGEtY2FsbC52dmNfYnV0dG9uLCAuY3RhLWNhbGwuY3RsaXZlQ2xhc3NPbkNsaWNrJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFkb2N1bWVudC5sb2NhdGlvbi5ocmVmLm1hdGNoKC9sYW5kaW5nXC9hYmJvbmFyc2lcL3JlY29udHJhY3RpbmcvKSAmJiAhZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvbGFuZGluZy1uZXdcL2FiYm9uYXJzaVwvcmVjb250cmFjdGluZy8pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucGFnZU5hbWUgPSAnJywgdC5saW5rVHJhY2tWYXJzID0gJ2VWYXIyNCxwcm9wNTUsZVZhcjU1LGV2ZW50cycsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxNicsIHQuZVZhcjI0ID0gJ2xhbmRpbmctcmVjb250cmFjdGluZ19jdGFfdGlyaWNoaWFtaWFtb19vdmVybGF5JywgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnY2xpY2tfY29ycG9yYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw2Y2JmYzViNjQxMDE0NWNhOGZmMmJiNjkwOTNmZmY1MScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTUgW0VSXSBbQ0xJQ0sgQ09SUE9SQVRFXSBMYW5kaW5nIEFwZXJ0dXJhIENNTiBSZWl0ZWsnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJ2EucmVpdGVrQnV0dG9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnBhZ2VOYW1lID0gJycsIHQubGlua1RyYWNrVmFycyA9ICdlVmFyMjQscHJvcDU1LGVWYXI1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpLCB3aW5kb3cubG9jYXRpb24uaHJlZi5tYXRjaCgvc2t5cG9ydGFsXC9mYWNlc1wvZmFpRGFUZSguKikvKSA/IHQuZVZhcjI0ID0gJ3dzYy12aXZvY2hhLXNlcnZlIGFpdXRvJyA6IHQuZVZhcjI0ID0gJ2xhbmRpbmcgdXBzLXNlcnZlIGFpdXRvJywgd2luZG93LmxvY2F0aW9uLmhyZWYubWF0Y2goL3NreXBvcnRhbFwvZmFjZXNcL2ZhaURhVGUoLiopLykgPyB0LmVWYXIyNCA9ICd3c2Mtdml2b2NoYS1zZXJ2ZSBhaXV0bycgOiB3aW5kb3cubG9jYXRpb24uaHJlZi5tYXRjaCgvbGFuZGluZy1uZXdcL3NreS13aWZpLWZpYnJhXC9hYmJvbmFyc2lcLzNQXC9udW92b2FiYm9uYW1lbnRvLTNQLTMvKSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5tYXRjaCgvbGFuZGluZy1uZXdcL3NreS13aWZpLWZpYnJhXC9hYmJvbmFyc2lcLzNQXC9udW92b2FiYm9uYW1lbnRvLTNQLTkvKSA/IHQuZVZhcjI0ID0gJ2N0YV90aWNoaWFtaWFtb25vaV9sYW5kaW5nM1AtcHJvc3BlY3QnIDogd2luZG93LmxvY2F0aW9uLmhyZWYubWF0Y2goL2xhbmRpbmctbmV3XC9wYXJ0bmVyc2hpcFwvM1BcL251b3ZvYWJib25hbWVudG8vKSA/IHQuZVZhcjI0ID0gJ3BhcnRuZXJzaGlwX0dydXBwb0Rpc3RyaWJ1emlvbmVfdGljaGlhbWlhbW9ub2lfbGFuZGluZzNQJyA6IHdpbmRvdy5sb2NhdGlvbi5ocmVmLm1hdGNoKC9sYW5kaW5nLW5ld1wvc2t5LXdpZmktZmlicmFcL2FiYm9uYXJzaVwvM1BcL251b3ZvYWJib25hbWVudG8tM1AtMTQvKSA/IHQuZVZhcjI0ID0gJ2N0YV90aWNoaWFtaWFtb25vaV9sYW5kaW5nM1AtcHJvc3BlY3QnIDogbG9jYXRpb24ucGF0aG5hbWUubWF0Y2goL2xhbmRpbmctbmV3XC9vZmZlcnRlLXBhcnRuZXJcLzNQXC9udW92b2FiYm9uYW1lbnRvLykgJiYgIWxvY2F0aW9uLnBhdGhuYW1lLm1hdGNoKC9udW92b2FiYm9uYW1lbnRvLWNsaWVudGkvKSA/IHQuZVZhcjI0ID0gJ29mZmVydGVwYXJ0bmVyX251b3ZvYWJib25hbWVudG9fdGljaGlhbWlhbW9ub2lfbGFuZGluZzNQJyA6IGxvY2F0aW9uLnBhdGhuYW1lLm1hdGNoKC9sYW5kaW5nLW5ld1wvb2ZmZXJ0ZS1wYXJ0bmVyXC8zUFwvbnVvdm9hYmJvbmFtZW50by1jbGllbnRpLykgPyB0LmVWYXIyNCA9ICdvZmZlcnRlcGFydG5lcl9udW92b2FiYm9uYW1lbnRvY2xpZW50aV90aWNoaWFtaWFtb25vaV9sYW5kaW5nM1AnIDogbG9jYXRpb24ucGF0aG5hbWUubWF0Y2goL2xhbmRpbmctbmV3XC9za3ktd2lmaS1maWJyYVwvY2xpZW50aVwvd2F5b3V0M3BfY21iXC9jbW4vKSB8fCBsb2NhdGlvbi5wYXRobmFtZS5tYXRjaCgvbGFuZGluZy1uZXdcL3NreS13aWZpLWZpYnJhXC9jbGllbnRpXC9jb21wYXJhdG9yaS8pID8gdC5lVmFyMjQgPSAnY3RhX3RpY2hpYW1pYW1vbm9pX2xhbmRpbmctcGFyY28nIDogdC5lVmFyMjQgPSAnbGFuZGluZyB1cHMtc2VydmUgYWl1dG8nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdjdGFfY21uX3JlaXRlaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDRhMGNmY2E1MmExZjQ3MzJhMzYwZGMwOGQ2MTBjNGM5JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIE5ldGZsaXggYWNjb3VudCAtIEN0YSByZWN1cGVyYSBjcmVkZW56aWFsaScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYnV0dG9uLmJhc2ljVHJhbnNpdGlvbiNyZWNvdmVyQnV0dG9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL2l0XC9uZXRmbGl4LWFjY291bnQvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdlVmFyMjQscHJvcDU1LGVWYXI1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LmVWYXIyNCA9ICdhdHRpdmFuZXRmbGl4X2N0YV9yZWN1cGVyYS1jcmVkZW56aWFsaV92YWktYWwtZmFpZGF0ZScsIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2NsaWNrX2NvcnBvcmF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDlmMDJiMDBkMDNmNjRlMWU5NjI3ZDEwYjJlNmQzYmE1JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1tEUl0gW0FPTF0gY3JlYSBza3lpZCAnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3NreWlkcmVnJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xscHJqLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsYW0uYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsYW0uYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLmFiYm9uYW1lbnRvLW8uc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmNoYW5uZWwgPSAnQWNxdWlzdGEnLCB0LmV2ZW50cyA9ICdldmVudDM2JywgdC5wYWdlTmFtZSA9IGUuZGV0YWlsLnBhZ2VuYW1lLCB0LnByb3AzNCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19wcm9tb2NvZGUnKSwgdC5wcm9wMzcgPSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfb2ZmZXJ0eXBlJyksIHQucHJvcDU0ID0gbG9jYXRpb24uaHJlZiwgdC5wcm9wNTUgPSBsb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU5ID0gJ2FvbCcsIHQucHJvcDM0ICYmICh0LmVWYXIzNCA9ICdEPWMzNCcpLCB0LnByb3AzNyAmJiAodC5lVmFyMzcgPSAnRD1jMzcnKSwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpLCB0LnByb3A1OSAmJiAodC5lVmFyNTkgPSAnRD1jNTknKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGY5MWJlMTBkOWFjYTQ3YmE4NGEyZTY4YTRhOTVhOWQ0JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1tEUl0gW0FPTF0gYW9scmVuZXdtb2RhbF9hY3Rpb24gKCsgQURGT1JNICsgR09PR0xFIEFEUyknLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2FvbHJlbmV3bW9kYWxfYWN0aW9uJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xscHJqLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsYW0uYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsYW0uYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLmFiYm9uYW1lbnRvLW8uc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5pbmZvKCdBRE9CRSBMQVVOQ0g6IGFvbHJlbmV3bW9kYWxfYWN0aW9uIHVwbG9hZGVkJyksIHQuY2hhbm5lbCA9ICdBY3F1aXN0YScsIHQuZXZlbnRzID0gdC5wcm9kdWN0cyA9ICcnLCAnOnNhbHZhIHByZXZlbnRpdm86dHlwJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfYWN0aW9uJykgJiYgKHQuZXZlbnRzID0gJ2V2ZW50MTUnKSwgJzpzYWx2YSBhYmJvbmFtZW50bzp0eXAnID09IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19hY3Rpb24nKSAmJiAodC5ldmVudHMgPSAnZXZlbnQxNScpLCAnOnJlY3VwZXJhIHByZXZlbnRpdm86dHlwJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfYWN0aW9uJykgJiYgKHQuZXZlbnRzID0gJ2V2ZW50MTE0JyksIHQucHJvcDM0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X3Byb21vY29kZScpLCB0LnByb3AzNyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19vZmZlcnR5cGUnKSwgdC5wYWdlTmFtZSA9IHdpbmRvdy5wYWdlbmFtZUJhc2VBb2xSZW5ldyArIF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19hY3Rpb24nKSwgdC5wcm9wNTkgPSAnYW9sJywgdC5wcm9wNjIgPSAnJywgdC5wYWdlTmFtZSAmJiAodC5lVmFyMSA9ICdEPXBhZ2VOYW1lJyksIHQucHJvcDM0ICYmICh0LmVWYXIzNCA9ICdEPWMzNCcpLCB0LnByb3AzNyAmJiAodC5lVmFyMzcgPSAnRD1jMzcnKSwgdC5wcm9wNTkgJiYgKHQuZVZhcjU5ID0gJ0Q9YzU5JyksIHQuZXZhcjE1ID0gJycsIHQuZVZhcjk4ID0gJycsICc6bm8gY2hhdDpjbW4gZm9ybTp0eXAnID09IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19hY3Rpb24nKSA/IHQucGFnZU5hbWUgPSAnc2t5OmFjcXVpc3RhOm5vIGNoYXQ6Y21uIGZvcm06dHlwJyA6ICc6bm8gY2hhdDpjbW4gZm9ybTprbycgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X2FjdGlvbicpICYmICh0LnBhZ2VOYW1lID0gJ3NreTphY3F1aXN0YTpubyBjaGF0OmNtbiBmb3JtOmtvJyksIChfc2F0ZWxsaXRlLmdldFZhcignbGVhZElkJykgJiYgKCFfc2F0ZWxsaXRlLnJlYWRDb29raWUoJ3hhY3RzPScpIHx8IF9zYXRlbGxpdGUucmVhZENvb2tpZSgneGFjdHM9JykgJiYgX3NhdGVsbGl0ZS5yZWFkQ29va2llKCd4YWN0cycpLmluZGV4T2YoX3NhdGVsbGl0ZS5nZXRWYXIoJ2xlYWRJZCcpICsgJy0nKSA8IDApICYmICc6Y21uIGZvcm06dHlwJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfYWN0aW9uJykgfHwgJzpoZWxwOmNtbiBmb3JtOnR5cCcgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X2FjdGlvbicpIHx8ICc6Y21uIGZvcm0gcHVzaDp0eXAnID09IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19hY3Rpb24nKSB8fCAnOm5vIGNoYXQ6Y21uIGZvcm06dHlwJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfYWN0aW9uJykpICYmICh0LnRyYW5zYWN0aW9uSUQgPSBfc2F0ZWxsaXRlLmdldFZhcignbGVhZElkJyksIHQuZXZlbnRzID0gJ2V2ZW50ODYnLCB0LmVWYXIyMiA9ICdjYWxsIG1lIG5vdycsIHQucHVyY2hhc2VJRCA9ICcnLCB0LnppcCA9ICcnLCB0LmVWYXIxNSA9IHQuZVZhcjI2ID0gdC5lVmFyMzUgPSB0LnByb3AzNSA9IHQuZVZhcjMwID0gJycsIF9zYXRlbGxpdGUuc2V0Q29va2llKCd4YWN0cycsIF9zYXRlbGxpdGUucmVhZENvb2tpZSgneGFjdHMnKSArIHQudHJhbnNhY3Rpb25JRCArICctJywgNzUwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS8yNzMzMWMxNjY5MmMvMzNhODYyYTcwNTRhLzE1YTFlNjRlZWViZS9SQzRkZWMxNGU5MmE0NjQ3Y2RhMzJhMDM1NTcyNDQ1NTI0LXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS8yNzMzMWMxNjY5MmMvMzNhODYyYTcwNTRhLzE1YTFlNjRlZWViZS9SQ2YxYWE1ODU4OGVmNzQ4ZTY4NGE4Y2JlNjUwNjAzN2YxLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS8yNzMzMWMxNjY5MmMvMzNhODYyYTcwNTRhLzE1YTFlNjRlZWViZS9SQzQwYzk1Y2Q1NjVkZjQ0Nzg4NDJjOTBhNzZmZDQ3YzYyLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYzBhYTM1YWQ4ZjgxNDIyMDg2NDQyYmFhYTk4YTVjZmInLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzU1IFtFUl0gW0NMSUNLIENPUlBPUkFURV0gTGFuZGluZyBtc2EgLSBDdGEgR29vZ2xlIHN0b3JlJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcuZ29vZ2xlLXBsYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1NQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvYXBwLW15LXNreS8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wYWdlTmFtZSA9ICcnLCB0LmxpbmtUcmFja1ZhcnMgPSAnZVZhcjI0LHByb3A1NCxlVmFyNTQscHJvcDU1LGVWYXI1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LmVWYXIyNCA9ICdteXNreWFwcF9nb29nbGVzdG9yZScsIHQucHJvcDU0ID0gd2luZG93LmxvY2F0aW9uLmhyZWYsIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdjbGlja19jb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw0ZWNhMmMyN2Q2Y2U0NTVkOWE4OGRhYWQ1ZmQ2NGJkMycsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW1BMXSBbVEFHIFRFUlpJXSBDT01TQ09SRSAoTGlicmVyaWEgZSBwYXJhbWV0cmkpJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RvbVJlYWR5LmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vMjczMzFjMTY2OTJjLzMzYTg2MmE3MDU0YS8xNWExZTY0ZWVlYmUvUkM2MTE5MTFmM2QyZjY0OWI1ODMyNDczZWM2OGM5MmM0ZC1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdodG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZWYxODM2YWU5Y2U0NGMzZmE3YjQwOGM4ZjIyNGJhYjEnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtQTF0gQ01OIE5PIEFPTCAoQURGT1JNKScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9saWJyYXJ5TG9hZGVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoJ2NhbGxtZW5vdy1uZXcnICE9IGxvY2F0aW9uLnBhdGhuYW1lLnNwbGl0KC9bL10vKVsxXSB8fCAncmVzJyAhPSBsb2NhdGlvbi5wYXRobmFtZS5zcGxpdCgvWy9dLylbMl0gfHwgIWxvY2F0aW9uLmhyZWYubWF0Y2goL3R5cC8pIHx8IGRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL3BhcnRuZXJzaGlwLykgfHwgZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvbm90eXB8bm8tdHlwLykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2lmICh3aW5kb3cucyAhPT0gd2luZG93LnNfY19pbFsxXSkgd2luZG93LnMgPSB3aW5kb3cuc19jX2lsWzFdO1xuXG4gIHdpbmRvdy5fYWRmdHJhY2sgPSB7XG4gICAgSHR0cEhvc3Q6IFwndHJhY2suYWRmb3JtLm5ldFwnLFxuICAgIHBtOiAxMjQwNzYsXG4gICAgZGl2aWRlcjogZW5jb2RlVVJJQ29tcG9uZW50KFwnfFwnKSxcbiAgICBwYWdlbmFtZTogZW5jb2RlVVJJQ29tcG9uZW50KFwnQ01OX0xQX25ld1wnKSxcbiAgICBvcmRlciA6IHsgXG4gICAgICAgICAgICAgc3YxMzogX3NhdGVsbGl0ZS5jb29raWUuZ2V0KCJleHQiKSA/IF9zYXRlbGxpdGUuY29va2llLmdldCgiZXh0IikgOiAiIixcbiAgICAgICAgICAgICBzdjU0OiBfc2F0ZWxsaXRlLmdldFZhcigiW0FMTF0gVHJhbnNhY3Rpb25JZCIpID8gX3NhdGVsbGl0ZS5nZXRWYXIoIltBTExdIFRyYW5zYWN0aW9uSWQiKSA6ICIiXG4gICAgICAgIH1cbiAgfTtcblxuICB2YXIgYWRmb3JtbGliID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudChcJ3NjcmlwdFwnKTsgXG4gIGFkZm9ybWxpYi50eXBlID0gXCd0ZXh0L2phdmFzY3JpcHRcJzsgXG4gIGFkZm9ybWxpYi5hc3luYyA9IHRydWU7IFxuICBhZGZvcm1saWIuc3JjID0gXCdodHRwczovL3MyLmFkZm9ybS5uZXQvYmFubmVycy9zY3JpcHRzL3N0L3RyYWNrcG9pbnQtYXN5bmMuanNcJzsgXG4gIGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKFwnc2NyaXB0XCcpWzBdLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKGFkZm9ybWxpYiwgZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoXCdzY3JpcHRcJylbMF0pOyBcbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMWU1ZmExM2UyN2Y2NDE0Zjg2NDRjMjc2NWM4NDhiYWYnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnW0RSXSBbQU9MXSBhb2xyZW5ld2NhcnRfYnVpbGQnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2FvbHJlbmV3Y2FydF9idWlsZCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xscHJqLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJlcHJvZC5hYmJvbmFtZW50by1vLnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbygnQURPQkVMYXVuY2g6IGFvbHJlbmV3Y2FydF9idWlsZCB1cGxvYWRlZCcpLCB0LnBhZ2VOYW1lID0gdC5wcm9kdWN0cyA9ICcnLCB0LmxpbmtUcmFja1ZhcnMgPSAnZXZlbnRzLHByb2R1Y3RzLGVWYXIzNCxwcm9wMzQsZVZhcjM3LHByb3AzNyxlVmFyMzUscHJvcDM1LHByb3A2MixlVmFyOTgnLCB0LmV2ZW50cyA9ICcnLCB0LnRyYW5zYWN0aW9uSUQgPSAnJywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdhZGQnID09IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19jYXJ0JykgPyAnc2NBZGQnIDogJ3JlbW92ZScgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X2NhcnQnKSA/ICdzY1JlbW92ZScgOiAnJywgdC5wcm9kdWN0cyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19wcm9kdWN0JyksIHQucHJvcDM0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X3Byb21vY29kZScpLCB0LnByb3AzNSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQU9MXSBFbnRyeVByb2R1Y3QnKSwgdC5wcm9wMzcgPSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfb2ZmZXJ0eXBlJyksIHQucHJvcDYyID0gJycsIHQucHJvcDM0ICYmICh0LmVWYXIzNCA9ICdEPWMzNCcpLCB0LnByb3AzNSAmJiAodC5lVmFyMzUgPSAnRD1jMzUnKSwgdC5wcm9wMzcgJiYgKHQuZVZhcjM3ID0gJ0Q9YzM3JyksIHQuZVZhcjk4ID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2FvbF9hZGRfcmVtb3ZlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZTE0ZDk2MDYzNTJiNDBhOThlNjNjN2NiYzU0MzhkMWUnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzU1IFtFUl0gW0NMSUNLIENPUlBPUkFURV0gTmV0ZmxpeCBpbnRyYXR0ZW5pbWVudG8gLSBUYWInLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJ2Rpdi5uZXRmbGl4LWFjcXVpc3RhX3RhYnMtY29udGFpbmVyLS10YWInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1NQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvdHZcL2ludHJhdHRlbmltZW50by1wbHVzLyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxpbmtUcmFja1ZhcnMgPSAnZVZhcjI0LHByb3A1NSxlVmFyNTUsZXZlbnRzJywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9ICQodGhpcykudGV4dCgpLnRyaW0oKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZVZhcjI0ID0gJ3RhYjonICsgYSwgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnY2xpY2tfY29ycG9yYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNjBkN2FiODQwOGM4NDFmZmEyMDM3YzNkYjU5NGNkMDUnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzA1IFtQTF0gW1RBUkdFVF0gTGlicmFyeSBWMicsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9saWJyYXJ5TG9hZGVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLnd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2QuYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLmFiYm9uYW1lbnRvLW8uc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWxvY2F0aW9uLmhyZWYubWF0Y2goL3NreVwuaXRcL29mZmVydGVcP3Zlcj1iLyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtdGFyZ2V0LXYyL2xpYi9sb2FkVGFyZ2V0LmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLXRhcmdldC12Mi9saWIvZmlyZVBhZ2VMb2FkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5SGlkZGVuU3R5bGU6ICdib2R5IHtvcGFjaXR5OiAwfScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHlIaWRpbmdFbmFibGVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYjdjOGUyZDE1ZTM5NDU3YzlmNzhkMTkxYWM1ZjIwOGInLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnW0RSXSBbQU9MXSBhb2xyZW5ld2NoYXQnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2FvbHJlbmV3Y2hhdCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xscHJqLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJlcHJvZC5hYmJvbmFtZW50by1vLnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbygnQURPQkUgTEFVTkNIOiBhcGVydHVyYSBjaGF0IHVwbG9hZGVkJyksIHQucGFnZU5hbWUgPSB0LnByb2R1Y3RzID0gJycsIHQubGlua1RyYWNrVmFycyA9ICdldmVudHMsZVZhcjM0LGVWYXIzNyxlVmFyODAsZVZhcjgxLGVWYXI5OCxwcm9wMzQscHJvcDM3LHByb3A2MicsIHQuZXZlbnRzID0gJycsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxMScsIHQucHJvcDM0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X3Byb21vY29kZScpLCB0LnByb3AzNyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19vZmZlcnR5cGUnKSwgdC5wcm9wNjIgPSAnJywgdC5wcm9wMzQgJiYgKHQuZVZhcjM0ID0gJ0Q9YzM0JyksIHQucHJvcDM3ICYmICh0LmVWYXIzNyA9ICdEPWMzNycpLCB0LmVWYXI4MCA9ICdjaGF0IHJlbmV3IGFvbCcsIHQuZVZhcjgxID0gZG9jdW1lbnQubG9jYXRpb24uaHJlZiwgdC5lVmFyOTggPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnYW9scmVuZXdfY2hhdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGFkYjAzNWE3NmE4MTQwY2Q5ODhjMTI1ZDM5NjcxZGZiJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbRFJdIFNwZWVkIFRlc3QgQ29uZmlndXJhdG9yZSAtIGVzaXRvIGluIHBhcnRlIHBvc2l0aXZvJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdjb25maWd1cmF0b3JlLXNwZWVkLXRlc3RfaW5wYXJ0ZXBvc2l0aXZvJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjYWVtLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy53d3cuc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zZXJ2ZXIgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gU2VydmVyJyksIHQuY2hhbm5lbCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIENoYW5uZWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIENoYW5uZWwnKSA6ICcnLCB0LnBhZ2VOYW1lID0gJ3NreTpvZmZlcnRlOmNvbmZpZ3VyYXRvcmUtYWJib25hbWVudG8tc2t5OmVzaXRvLXNwZWVkLXRlc3QtaW5wYXJ0ZXBvc2l0aXZvJywgdC5wcm9wMiA9IHQuZ2V0UHJldmlvdXNWYWx1ZSh0LnBhZ2VOYW1lLCAnZ3B2X3BuJyksIHQucHJvcDUgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBRdWFydG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA6ICcnLCB0LnByb3AyOSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJykgOiAnJywgdC5wcm9wNTAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpIDogJycsIHQucHJvcDU0ID0gbG9jYXRpb24uaHJlZiwgdC5wcm9wNTUgPSBsb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU5ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBTZWNvbmRvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A2MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A2NyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBDb29raWUgTG9naW4gU3RhdHVzJyksIHQucGFnZU5hbWUgJiYgKHQuZVZhcjEgPSAnRD1wYWdlTmFtZScpLCB0LnByb3AyICYmICh0LmVWYXIyID0gJ0Q9YzInKSwgdC5wcm9wNSAmJiAodC5lVmFyNSA9ICdEPWM1JyksIHQucHJvcDU0ICYmICh0LmVWYXI1NCA9ICdEPWM1NCcpLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKSwgdC5wcm9wNTkgJiYgKHQuZVZhcjU5ID0gJ0Q9YzU5JyksIHQucHJvcDYwICYmICh0LmVWYXI2MCA9ICdEPWM2MCcpLCB0LnByb3A2NyAmJiAodC5lVmFyNjcgPSAnRD1jNjcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw4YTZiN2QwY2I4OGI0OWJlOGNjZjlmNDQ2NjEwYzY0NicsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTUgW0VSXSBbQ0xJQ0sgQ09SUE9SQVRFXSBPZmZlcnRlIC0gQ2xpY2sgZmlsdHJvIHByZXp6byBhbHRvJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcub3JkZXItYnkuaGlnaGVyLXByaWNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL29mZmVydGUvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucGFnZU5hbWUgPSAnJywgdC5saW5rVHJhY2tWYXJzID0gJ2VWYXIyNCxwcm9wNTUsZVZhcjU1LGV2ZW50cycsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxNicsIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1JyksIHQuZVZhcjI0ID0gJ29mZmVydGVpbmRleF9maWx0cm9fcHJlenpvcGl1YWx0byc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2NsaWNrX2NvcnBvcmF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGQ1YzIyNTU0MTZiZDQ0ZDZhOWZhNzQzYjc1MmY1ZTFjJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbQUxMXSBDTU4gKEdPT0dMRSBBRFMpJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2xpYnJhcnlMb2FkZWQuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISghbG9jYXRpb24uc2VhcmNoLm1hdGNoKC9sZWFkaWQ9L2kpIHx8IGRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL25vdHlwfG5vLXR5cC8pIHx8ICFsb2NhdGlvbi5ocmVmLm1hdGNoKC93d3cuc2t5Lml0LykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJzwhLS0gR2xvYmFsIHNpdGUgdGFnIChndGFnLmpzKSAtIEdvb2dsZSBBZHM6IDEwNDgyNjUyMjYgLS0+XG48c2NyaXB0IGFzeW5jIHNyYz0iaHR0cHM6Ly93d3cuZ29vZ2xldGFnbWFuYWdlci5jb20vZ3RhZy9qcz9pZD1BVy0xMDQ4MjY1MjI2Ij48L3NjcmlwdD5cbjxzY3JpcHQ+XG4gIHdpbmRvdy5kYXRhTGF5ZXIgPSB3aW5kb3cuZGF0YUxheWVyIHx8IFtdO1xuICBmdW5jdGlvbiBndGFnKCl7ZGF0YUxheWVyLnB1c2goYXJndW1lbnRzKTt9XG4gIGd0YWcoXCdqc1wnLCBuZXcgRGF0ZSgpKTtcblxuICBndGFnKFwnY29uZmlnXCcsIFwnQVctMTA0ODI2NTIyNlwnKTtcbiAgZ3RhZyhcJ2V2ZW50XCcsIFwnY29udmVyc2lvblwnLCB7XCdzZW5kX3RvXCc6IFwnQVctMTA0ODI2NTIyNi8yM21BQ0lhdTFNSUJFSXFFN2ZNRFwnfSk7IFxuPC9zY3JpcHQ+JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdodG1sJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmNGMxZmVkNmQ5MjE0ZmQ5YTlmMjZkZmQ4OWU1NDI2ZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBTcGVlZCBUZXN0IENvbmZpZ3VyYXRvcmUgLSBlc2l0byBwb3NpdGl2bycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnY29uZmlndXJhdG9yZS1zcGVlZC10ZXN0X3Bvc2l0aXZvJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjYWVtLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy53d3cuc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zZXJ2ZXIgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gU2VydmVyJyksIHQuY2hhbm5lbCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIENoYW5uZWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIENoYW5uZWwnKSA6ICcnLCB0LnBhZ2VOYW1lID0gJ3NreTpvZmZlcnRlOmNvbmZpZ3VyYXRvcmUtYWJib25hbWVudG8tc2t5OmVzaXRvLXNwZWVkLXRlc3QtcG9zaXRpdm8nLCB0LnByb3AyID0gdC5nZXRQcmV2aW91c1ZhbHVlKHQucGFnZU5hbWUsICdncHZfcG4nKSwgdC5wcm9wNSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFF1YXJ0byBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBRdWFydG8gTGl2ZWxsbycpIDogJycsIHQucHJvcDI5ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA6ICcnLCB0LnByb3A1MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgOiAnJywgdC5wcm9wNTQgPSBsb2NhdGlvbi5ocmVmLCB0LnByb3A1NSA9IGxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTkgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBTZWNvbmRvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbycpIDogJycsIHQucHJvcDYwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gVGVyem8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gVGVyem8gTGl2ZWxsbycpIDogJycsIHQucHJvcDY3ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIENvb2tpZSBMb2dpbiBTdGF0dXMnKSwgdC5wYWdlTmFtZSAmJiAodC5lVmFyMSA9ICdEPXBhZ2VOYW1lJyksIHQucHJvcDIgJiYgKHQuZVZhcjIgPSAnRD1jMicpLCB0LnByb3A1ICYmICh0LmVWYXI1ID0gJ0Q9YzUnKSwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpLCB0LnByb3A1OSAmJiAodC5lVmFyNTkgPSAnRD1jNTknKSwgdC5wcm9wNjAgJiYgKHQuZVZhcjYwID0gJ0Q9YzYwJyksIHQucHJvcDY3ICYmICh0LmVWYXI2NyA9ICdEPWM2NycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDMxMzk0OGQ2MmE1MDQwMDZiN2RmMjlkMmU1MTc1N2UwJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIFNreSBLaWRzIC0gQ3RhIGF0dGl2YSBraWRzICcsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnI3dyYXBwZXIgPiBzZWN0aW9uLmhlbHAuc3BvdGlmeS1oZWxwLnNjcm9sbEFuaW1hdGlvbiA+IGRpdi5ib3R0b20gPiBkaXYgPiBkaXYucm93LnJvdy1lcS1oZWlnaHQgPiBkaXYgPiBkaXYuc3dpcGVyLXdyYXBwZXIgPiBkaXYuc3BvdGlmeS1zbGlkZS5zd2lwZXItc2xpZGUtbmV4dCA+IGRpdiA+IHAgPiBhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL3R2XC9za3kta2lkcy8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5saW5rVHJhY2tWYXJzID0gJ2VWYXIyNCxlVmFyNTUscHJvcDU1LGV2ZW50cycsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxNicsIHQuZVZhcjI0ID0gJ2N0YV9za3kta2lkc19hdHRpdmEnLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdjbGlja19jb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw1NDg1NzZlODg3ZGU0NjM5OTRlZGYyNzg3NTMyODY3ZicsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTUgW0VSXSBbQ0xJQ0sgQ09SUE9SQVRFXSBTa3lRIGF0dGl2YXppb25lIC0gQm94IEN0YSBzY29wcmknLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJy50d28tYm94ZXMtaG92ZXIgLmJveCAubWFzayAuaG92ZXIgLmN0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDU1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFkb2N1bWVudC5sb2NhdGlvbi5ocmVmLm1hdGNoKC90dlwvc2t5cVwvYXR0aXZhemlvbmUvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdlVmFyMjQscHJvcDU1LGVWYXI1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gJCh0aGlzKS5maXJzdCgpLnRleHQoKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZVZhcjI0ID0gYS50cmltKCksIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2NsaWNrX2NvcnBvcmF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDYxNGZhNGUxYjAyMTRlMmFiOGE1ZGRhOTUzYTc0Zjk2JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbUExdIFtUQUcgVEVSWkldIEdvb2dsZSBBRFMgKExpYnJlcmlhKScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWxvY2F0aW9uLmhyZWYubWF0Y2goL2ZpbGU6XC9cL1wvQ1w6XC8vKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgZG9tYWluczogWyd3d3cuc2t5Lml0J10gfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICc8IS0tIEdsb2JhbCBzaXRlIHRhZyAoZ3RhZy5qcykgLSBHb29nbGUgQWRzOiAxMDQ4MjY1MjI2IC0tPlxuPHNjcmlwdCBhc3luYyBzcmM9Imh0dHBzOi8vd3d3Lmdvb2dsZXRhZ21hbmFnZXIuY29tL2d0YWcvanM/aWQ9QVctMTA0ODI2NTIyNiI+PC9zY3JpcHQ+XG48c2NyaXB0PlxuICB3aW5kb3cuZGF0YUxheWVyID0gd2luZG93LmRhdGFMYXllciB8fCBbXTtcbiAgZnVuY3Rpb24gZ3RhZygpe2RhdGFMYXllci5wdXNoKGFyZ3VtZW50cyk7fVxuICBndGFnKFwnanNcJywgbmV3IERhdGUoKSk7XG5cbiAgZ3RhZyhcJ2NvbmZpZ1wnLCBcJ0FXLTEwNDgyNjUyMjZcJyk7XG48L3NjcmlwdD4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2h0bWwnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDkyNTNkZDNkZWUzOTQwMTJhNzNhYjcwOGQ1N2NhMzUxJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIFNreVEgYXR0aXZhemlvbmUgLSBCdXR0b24gc3dpdGNoJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcuc3dpdGNoLWNvbnRyb2xsZXIgLnN3aXRjaC1idXR0b24gYnV0dG9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL3R2XC9za3lxXC9hdHRpdmF6aW9uZS8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5saW5rVHJhY2tWYXJzID0gJ2VWYXIyNCxwcm9wNTUsZVZhcjU1LGV2ZW50cycsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxNic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAkKHRoaXMpLmZpcnN0KCkudGV4dCgpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5lVmFyMjQgPSBhLnRyaW0oKSwgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnY2xpY2tfY29ycG9yYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMODIwMjc4MWMwNDhhNDYwMjg4YjhiZWFlMTJmNmI1MGInLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gVHJhY2tpbmcgQ1RBIEV4dHJhJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICd0cmFja190cmFja2luZ2N0YWV4dHJhX2FjdGlvbicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5sb2NhdGlvbi5ocmVmLm1hdGNoKC9leHRyYVwvY3NyXC91bm1hcmVkYXNhbHZhcmUvKSA/ICh0LmV2ZW50cyA9ICcnLCB0LmxpbmtUcmFja1ZhcnMgPSAnZXZlbnRzLGVWYXIyNCxwcm9wNTUsZVZhcjU1JywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JywgdC5lVmFyMjQgPSAncXVpeiBvY2VhbiB0eXAnLCB0LnByb3A1NSA9IHQuZVZhcjU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSkgOiAodC5ldmVudHMgPSAnJywgdC5wYWdlTmFtZSA9ICcnLCB0LmxpbmtUcmFja1ZhcnMgPSAnZXZlbnRzLGVWYXIzOSxwcm9wNTQsZVZhcjU0LHByb3A1NSxlVmFyNTUnLCB0LmVWYXIzOSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCd0cmFja190cmFja2luZ2N0YWV4dHJhX3N0ZXAnKSwgdC5lVmFyMzkgJiYgKHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQ4NycpLCB0LnByb3A1NCA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLCB0LnByb3A1NCAmJiAodC5lVmFyNTQgPSAnRD1jNTQnKSwgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKSksIGNvbnNvbGUuaW5mbygnQURPQkUgTEFVTkNIIFRyYWNraW5nY3RhZXh0cmEgOiAnICsgX3NhdGVsbGl0ZS5nZXRWYXIoJ3RyYWNrX3RyYWNraW5nY3RhZXh0cmFfc3RlcCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAndHJhY2tpbmdjdGFleHRyYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDU1ODkwZDg3MWVhYzQ0MDdiNjEyYmI5N2NkZWFiNGI0JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbRVJdIFtBTExdIExvZ291dCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnLmxvZ291dC1iYWxsb29uLWxvZ291dC1hcmVhLCAubG9nb3V0LW92ZXJsYXktbG9nb3V0LWFyZWEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucGFnZU5hbWUgPSAnJywgdC5saW5rVHJhY2tWYXJzID0gJ3NlcnZlcixwcm9wNTQscHJvcDU1LGVWYXI1NCxlVmFyNTUnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTIwJywgdC5wcm9wNTQgPSB3aW5kb3cubG9jYXRpb24uaHJlZiwgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NCAmJiAodC5lVmFyNTQgPSAnRD1jNTQnKSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2xvZ291dF9za3knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDc4ZjJkMzQ2ZDMxNjQxOTViOTcyMmMzMjZkYTIwZTdkJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbRVJdIFtBTExdIFpvbmUgSWQnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJ2EsIGltZy5za3ktbG9nbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRQcm9wZXJ0aWVzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICd6b25laWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnLionLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhdGhpcy5nZXRBdHRyaWJ1dGUoJ3pvbmVpZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnBhZ2VOYW1lID0gJycsIHQubGlua1RyYWNrVmFycyA9ICdlVmFyNzknLCB0LmVWYXI3OSA9IHRoaXMuZ2V0QXR0cmlidXRlKCd6b25laWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnem9uZWlkX21lbnUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxhOGFjM2M4MTU5NmM0Y2Y3OTUxNDRiMDQ5MDA1YTMzZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBUcmFja2luZyBDbGljayBDb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3RyYWNrX3RyYWNraW5nY2xpY2tjb3Jwb3JhdGVfYXJyb3cnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucGFnZU5hbWUgPSAnJywgdC5ldmVudHMgPSAnJywgdC5saW5rVHJhY2tWYXJzID0gJ2V2ZW50cyxlVmFyMjQscHJvcDU1LGVWYXI1NScsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxNicsIHQuZVZhcjI0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ3RyYWNrX3RyYWNraW5nY2xpY2tjb3Jwb3JhdGVfY2F0ZWdvcnknKS50b0xvd2VyQ2FzZSgpLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICd0cmFja2luZ2NsaWNrY29ycG9yYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNmE4OWMyNTE2MzlhNDRmODk4Y2VlZTIyYWRmOTQ0ODknLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzAyIFtQTF0gW0FMTF0gTGlicmFyeSBMb2FkZWQgSGVhcnRiZWF0cycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9saWJyYXJ5TG9hZGVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiAyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdsb2JhbDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXG4gKiBBRE9CRSBDT05GSURFTlRJQUxcbiAqIF9fX19fX19fX19fX19fX19fX19cbiAqXG4gKiBDb3B5cmlnaHQgMjAxOSBBZG9iZVxuICogQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbiAqXG4gKiBOT1RJQ0U6IEFsbCBpbmZvcm1hdGlvbiBjb250YWluZWQgaGVyZWluIGlzLCBhbmQgcmVtYWluc1xuICogdGhlIHByb3BlcnR5IG9mIEFkb2JlIGFuZCBpdHMgc3VwcGxpZXJzLCBpZiBhbnkuIFRoZSBpbnRlbGxlY3R1YWxcbiAqIGFuZCB0ZWNobmljYWwgY29uY2VwdHMgY29udGFpbmVkIGhlcmVpbiBhcmUgcHJvcHJpZXRhcnkgdG8gQWRvYmVcbiAqIGFuZCBpdHMgc3VwcGxpZXJzIGFuZCBhcmUgcHJvdGVjdGVkIGJ5IGFsbCBhcHBsaWNhYmxlIGludGVsbGVjdHVhbFxuICogcHJvcGVydHkgbGF3cywgaW5jbHVkaW5nIHRyYWRlIHNlY3JldCBhbmQgY29weXJpZ2h0IGxhd3MuXG4gKiBEaXNzZW1pbmF0aW9uIG9mIHRoaXMgaW5mb3JtYXRpb24gb3IgcmVwcm9kdWN0aW9uIG9mIHRoaXMgbWF0ZXJpYWxcbiAqIGlzIHN0cmljdGx5IGZvcmJpZGRlbiB1bmxlc3MgcHJpb3Igd3JpdHRlbiBwZXJtaXNzaW9uIGlzIG9idGFpbmVkXG4gKiBmcm9tIEFkb2JlLlxuICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqL1xuLypcbiAqIE1lZGlhU0RLIC0gMi4yLjAgLSAyMDE5LTAyLTEyXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTkgQWRvYmUuIEFsbCBSaWdodHMgUmVzZXJ2ZWQuXG4gKlxuICogQ29weXJpZ2h0IGZvciBleHRlcm5hbCBsaWJyYXJpZXMgdXNlZCBpbiBNZWRpYSBTREtcbiAqIEphdmFTY3JpcHQgTUQ1IDEuMC4xXG4gKiBodHRwczovL2dpdGh1Yi5jb20vYmx1ZWltcC9KYXZhU2NyaXB0LU1ENVxuICpcbiAqIENvcHlyaWdodCAyMDExLCBTZWJhc3RpYW4gVHNjaGFuXG4gKiBodHRwczovL2JsdWVpbXAubmV0XG4gKlxuICogTGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlOlxuICogaHR0cDovL3d3dy5vcGVuc291cmNlLm9yZy9saWNlbnNlcy9NSVRcbiAqXG4gKiBCYXNlZCBvblxuICogQSBKYXZhU2NyaXB0IGltcGxlbWVudGF0aW9uIG9mIHRoZSBSU0EgRGF0YSBTZWN1cml0eSwgSW5jLiBNRDUgTWVzc2FnZVxuICogRGlnZXN0IEFsZ29yaXRobSwgYXMgZGVmaW5lZCBpbiBSRkMgMTMyMS5cbiAqIFZlcnNpb24gMi4yIENvcHlyaWdodCAoQykgUGF1bCBKb2huc3RvbiAxOTk5IC0gMjAwOVxuICogT3RoZXIgY29udHJpYnV0b3JzOiBHcmVnIEhvbHQsIEFuZHJldyBLZXBlcnQsIFlkbmFyLCBMb3N0aW5ldFxuICogRGlzdHJpYnV0ZWQgdW5kZXIgdGhlIEJTRCBMaWNlbnNlXG4gKiBTZWUgaHR0cDovL3BhamhvbWUub3JnLnVrL2NyeXB0L21kNSBmb3IgbW9yZSBpbmZvLlxuICpcbiAqXG4gKiB1bWRqcyAoY29tbW9uanNTdHJpY3QuanMpXG4gKiBDb3B5cmlnaHQgKGMpIHRoZSBVTUQgY29udHJpYnV0b3JzXG4gKiBMaWNlbnNlZCB1bmRlciB0aGUgTUlUIGxpY2Vuc2U6XG4gKiBodHRwczovL2dpdGh1Yi5jb20vdW1kanMvdW1kL2Jsb2IvbWFzdGVyL0xJQ0VOU0UubWRcbiAqL1xuKGZ1bmN0aW9uIChyb290LCBmYWN0b3J5KSB7XG4gIGlmICh0eXBlb2YgZGVmaW5lID09PSBcJ2Z1bmN0aW9uXCcgJiYgZGVmaW5lLmFtZCkge1xuICAgIGRlZmluZShbXCdleHBvcnRzXCddLCBmYWN0b3J5KTtcbiAgfSBlbHNlIGlmICh0eXBlb2YgZXhwb3J0cyA9PT0gXCdvYmplY3RcJyAmJiB0eXBlb2YgZXhwb3J0cy5ub2RlTmFtZSAhPT0gXCdzdHJpbmdcJykge1xuICAgIGZhY3RvcnkoZXhwb3J0cyk7XG4gIH0gZWxzZSB7XG4gICAgZmFjdG9yeShyb290LkFEQiA9IHt9KTtcbiAgfVxufSh0eXBlb2Ygc2VsZiAhPT0gXCd1bmRlZmluZWRcJyA/IHNlbGYgOiB0aGlzLCBmdW5jdGlvbiAoZXhwb3J0cykge1xuICB2YXIgbGliID0ge307XG4gIChmdW5jdGlvbiAoKSB7XG4gICAgXG5cbi8vIEhlYXJ0YmVhdCBjb3JlXG4hZnVuY3Rpb24oYSl7aWYodm9pZCAwPT09Yil2YXIgYj17fTtpZih2b2lkIDA9PT1jKXZhciBjPXt9O2lmKHZvaWQgMD09PWQpdmFyIGQ9e307aWYoZC5yYWRpb3x8KGQucmFkaW89e30pLGQucGx1Z2lufHwoZC5wbHVnaW49e30pLHZvaWQgMD09PWUpdmFyIGU9e307ZS5jbG9ja3x8KGUuY2xvY2s9e30pLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKGEsYil7dmFyIGM9KDY1NTM1JmEpKyg2NTUzNSZiKTtyZXR1cm4oYT4+MTYpKyhiPj4xNikrKGM+PjE2KTw8MTZ8NjU1MzUmY31mdW5jdGlvbiBjKGEsYil7cmV0dXJuIGE8PGJ8YT4+PjMyLWJ9ZnVuY3Rpb24gZChhLGQsZSxmLGcsaCl7cmV0dXJuIGIoYyhiKGIoZCxhKSxiKGYsaCkpLGcpLGUpfWZ1bmN0aW9uIGUoYSxiLGMsZSxmLGcsaCl7cmV0dXJuIGQoYiZjfH5iJmUsYSxiLGYsZyxoKX1mdW5jdGlvbiBmKGEsYixjLGUsZixnLGgpe3JldHVybiBkKGImZXxjJn5lLGEsYixmLGcsaCl9ZnVuY3Rpb24gZyhhLGIsYyxlLGYsZyxoKXtyZXR1cm4gZChiXmNeZSxhLGIsZixnLGgpfWZ1bmN0aW9uIGgoYSxiLGMsZSxmLGcsaCl7cmV0dXJuIGQoY14oYnx+ZSksYSxiLGYsZyxoKX1mdW5jdGlvbiBpKGEsYyl7YVtjPj41XXw9MTI4PDxjJTMyLGFbMTQrKGMrNjQ+Pj45PDw0KV09Yzt2YXIgZCxpLGosayxsLG09MTczMjU4NDE5MyxuPS0yNzE3MzM4Nzksbz0tMTczMjU4NDE5NCxwPTI3MTczMzg3ODtmb3IoZD0wO2Q8YS5sZW5ndGg7ZCs9MTYpaT1tLGo9bixrPW8sbD1wLG09ZShtLG4sbyxwLGFbZF0sNywtNjgwODc2OTM2KSxwPWUocCxtLG4sbyxhW2QrMV0sMTIsLTM4OTU2NDU4Niksbz1lKG8scCxtLG4sYVtkKzJdLDE3LDYwNjEwNTgxOSksbj1lKG4sbyxwLG0sYVtkKzNdLDIyLC0xMDQ0NTI1MzMwKSxtPWUobSxuLG8scCxhW2QrNF0sNywtMTc2NDE4ODk3KSxwPWUocCxtLG4sbyxhW2QrNV0sMTIsMTIwMDA4MDQyNiksbz1lKG8scCxtLG4sYVtkKzZdLDE3LC0xNDczMjMxMzQxKSxuPWUobixvLHAsbSxhW2QrN10sMjIsLTQ1NzA1OTgzKSxtPWUobSxuLG8scCxhW2QrOF0sNywxNzcwMDM1NDE2KSxwPWUocCxtLG4sbyxhW2QrOV0sMTIsLTE5NTg0MTQ0MTcpLG89ZShvLHAsbSxuLGFbZCsxMF0sMTcsLTQyMDYzKSxuPWUobixvLHAsbSxhW2QrMTFdLDIyLC0xOTkwNDA0MTYyKSxtPWUobSxuLG8scCxhW2QrMTJdLDcsMTgwNDYwMzY4MikscD1lKHAsbSxuLG8sYVtkKzEzXSwxMiwtNDAzNDExMDEpLG89ZShvLHAsbSxuLGFbZCsxNF0sMTcsLTE1MDIwMDIyOTApLG49ZShuLG8scCxtLGFbZCsxNV0sMjIsMTIzNjUzNTMyOSksbT1mKG0sbixvLHAsYVtkKzFdLDUsLTE2NTc5NjUxMCkscD1mKHAsbSxuLG8sYVtkKzZdLDksLTEwNjk1MDE2MzIpLG89ZihvLHAsbSxuLGFbZCsxMV0sMTQsNjQzNzE3NzEzKSxuPWYobixvLHAsbSxhW2RdLDIwLC0zNzM4OTczMDIpLG09ZihtLG4sbyxwLGFbZCs1XSw1LC03MDE1NTg2OTEpLHA9ZihwLG0sbixvLGFbZCsxMF0sOSwzODAxNjA4Myksbz1mKG8scCxtLG4sYVtkKzE1XSwxNCwtNjYwNDc4MzM1KSxuPWYobixvLHAsbSxhW2QrNF0sMjAsLTQwNTUzNzg0OCksbT1mKG0sbixvLHAsYVtkKzldLDUsNTY4NDQ2NDM4KSxwPWYocCxtLG4sbyxhW2QrMTRdLDksLTEwMTk4MDM2OTApLG89ZihvLHAsbSxuLGFbZCszXSwxNCwtMTg3MzYzOTYxKSxuPWYobixvLHAsbSxhW2QrOF0sMjAsMTE2MzUzMTUwMSksbT1mKG0sbixvLHAsYVtkKzEzXSw1LC0xNDQ0NjgxNDY3KSxwPWYocCxtLG4sbyxhW2QrMl0sOSwtNTE0MDM3ODQpLG89ZihvLHAsbSxuLGFbZCs3XSwxNCwxNzM1MzI4NDczKSxuPWYobixvLHAsbSxhW2QrMTJdLDIwLC0xOTI2NjA3NzM0KSxtPWcobSxuLG8scCxhW2QrNV0sNCwtMzc4NTU4KSxwPWcocCxtLG4sbyxhW2QrOF0sMTEsLTIwMjI1NzQ0NjMpLG89ZyhvLHAsbSxuLGFbZCsxMV0sMTYsMTgzOTAzMDU2Miksbj1nKG4sbyxwLG0sYVtkKzE0XSwyMywtMzUzMDk1NTYpLG09ZyhtLG4sbyxwLGFbZCsxXSw0LC0xNTMwOTkyMDYwKSxwPWcocCxtLG4sbyxhW2QrNF0sMTEsMTI3Mjg5MzM1Myksbz1nKG8scCxtLG4sYVtkKzddLDE2LC0xNTU0OTc2MzIpLG49ZyhuLG8scCxtLGFbZCsxMF0sMjMsLTEwOTQ3MzA2NDApLG09ZyhtLG4sbyxwLGFbZCsxM10sNCw2ODEyNzkxNzQpLHA9ZyhwLG0sbixvLGFbZF0sMTEsLTM1ODUzNzIyMiksbz1nKG8scCxtLG4sYVtkKzNdLDE2LC03MjI1MjE5NzkpLG49ZyhuLG8scCxtLGFbZCs2XSwyMyw3NjAyOTE4OSksbT1nKG0sbixvLHAsYVtkKzldLDQsLTY0MDM2NDQ4NykscD1nKHAsbSxuLG8sYVtkKzEyXSwxMSwtNDIxODE1ODM1KSxvPWcobyxwLG0sbixhW2QrMTVdLDE2LDUzMDc0MjUyMCksbj1nKG4sbyxwLG0sYVtkKzJdLDIzLC05OTUzMzg2NTEpLG09aChtLG4sbyxwLGFbZF0sNiwtMTk4NjMwODQ0KSxwPWgocCxtLG4sbyxhW2QrN10sMTAsMTEyNjg5MTQxNSksbz1oKG8scCxtLG4sYVtkKzE0XSwxNSwtMTQxNjM1NDkwNSksbj1oKG4sbyxwLG0sYVtkKzVdLDIxLC01NzQzNDA1NSksbT1oKG0sbixvLHAsYVtkKzEyXSw2LDE3MDA0ODU1NzEpLHA9aChwLG0sbixvLGFbZCszXSwxMCwtMTg5NDk4NjYwNiksbz1oKG8scCxtLG4sYVtkKzEwXSwxNSwtMTA1MTUyMyksbj1oKG4sbyxwLG0sYVtkKzFdLDIxLC0yMDU0OTIyNzk5KSxtPWgobSxuLG8scCxhW2QrOF0sNiwxODczMzEzMzU5KSxwPWgocCxtLG4sbyxhW2QrMTVdLDEwLC0zMDYxMTc0NCksbz1oKG8scCxtLG4sYVtkKzZdLDE1LC0xNTYwMTk4MzgwKSxuPWgobixvLHAsbSxhW2QrMTNdLDIxLDEzMDkxNTE2NDkpLG09aChtLG4sbyxwLGFbZCs0XSw2LC0xNDU1MjMwNzApLHA9aChwLG0sbixvLGFbZCsxMV0sMTAsLTExMjAyMTAzNzkpLG89aChvLHAsbSxuLGFbZCsyXSwxNSw3MTg3ODcyNTkpLG49aChuLG8scCxtLGFbZCs5XSwyMSwtMzQzNDg1NTUxKSxtPWIobSxpKSxuPWIobixqKSxvPWIobyxrKSxwPWIocCxsKTtyZXR1cm5bbSxuLG8scF19ZnVuY3Rpb24gaihhKXt2YXIgYixjPSIiO2ZvcihiPTA7YjwzMiphLmxlbmd0aDtiKz04KWMrPVN0cmluZy5mcm9tQ2hhckNvZGUoYVtiPj41XT4+PmIlMzImMjU1KTtyZXR1cm4gY31mdW5jdGlvbiBrKGEpe3ZhciBiLGM9W107Zm9yKGNbKGEubGVuZ3RoPj4yKS0xXT12b2lkIDAsYj0wO2I8Yy5sZW5ndGg7Yis9MSljW2JdPTA7Zm9yKGI9MDtiPDgqYS5sZW5ndGg7Yis9OCljW2I+PjVdfD0oMjU1JmEuY2hhckNvZGVBdChiLzgpKTw8YiUzMjtyZXR1cm4gY31mdW5jdGlvbiBsKGEpe3JldHVybiBqKGkoayhhKSw4KmEubGVuZ3RoKSl9ZnVuY3Rpb24gbShhLGIpe3ZhciBjLGQsZT1rKGEpLGY9W10sZz1bXTtmb3IoZlsxNV09Z1sxNV09dm9pZCAwLGUubGVuZ3RoPjE2JiYoZT1pKGUsOCphLmxlbmd0aCkpLGM9MDtjPDE2O2MrPTEpZltjXT05MDk1MjI0ODZeZVtjXSxnW2NdPTE1NDk1NTY4MjheZVtjXTtyZXR1cm4gZD1pKGYuY29uY2F0KGsoYikpLDUxMis4KmIubGVuZ3RoKSxqKGkoZy5jb25jYXQoZCksNjQwKSl9ZnVuY3Rpb24gbihhKXt2YXIgYixjLGQ9IjAxMjM0NTY3ODlhYmNkZWYiLGU9IiI7Zm9yKGM9MDtjPGEubGVuZ3RoO2MrPTEpYj1hLmNoYXJDb2RlQXQoYyksZSs9ZC5jaGFyQXQoYj4+PjQmMTUpK2QuY2hhckF0KDE1JmIpO3JldHVybiBlfWZ1bmN0aW9uIG8oYSl7cmV0dXJuIHVuZXNjYXBlKGVuY29kZVVSSUNvbXBvbmVudChhKSl9ZnVuY3Rpb24gcChhKXtyZXR1cm4gbChvKGEpKX1mdW5jdGlvbiBxKGEpe3JldHVybiBuKHAoYSkpfWZ1bmN0aW9uIHIoYSxiKXtyZXR1cm4gbShvKGEpLG8oYikpfWZ1bmN0aW9uIHMoYSxiKXtyZXR1cm4gbihyKGEsYikpfWZ1bmN0aW9uIHQoYSxiLGMpe3JldHVybiBiP2M/cihiLGEpOnMoYixhKTpjP3AoYSk6cShhKX1hLm1kNT10fShiKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7dmFyIGI9e307Yi5zdGFydHNXaXRoPWZ1bmN0aW9uKGEsYil7cmV0dXJuIDA9PWEuaW5kZXhPZihiKX0sYS5TdHJpbmdVdGlscz1ifShiKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7dmFyIGI9e307Yi5jbG9uZT1mdW5jdGlvbihhKXt2YXIgYj17fTtmb3IodmFyIGMgaW4gYSlhLmhhc093blByb3BlcnR5KGMpJiYoYltjXT1hW2NdKTtyZXR1cm4gYn0sYi5tZXJnZT1mdW5jdGlvbihhLGMpe3ZhciBkPWIuY2xvbmUoYSk7Zm9yKHZhciBlIGluIGMpYy5oYXNPd25Qcm9wZXJ0eShlKSYmKGRbZV09Y1tlXSk7cmV0dXJuIGR9LGIuYXBwZW5kPWZ1bmN0aW9uKGEsYil7Zm9yKHZhciBjIGluIGIpYi5oYXNPd25Qcm9wZXJ0eShjKSYmKGFbY109YltjXSl9LGEuT2JqZWN0VXRpbHM9Yn0oYiksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoYSl7aWYobnVsbD09YSlyZXR1cm4hMDtmb3IodmFyIGI9MDtiPGEubGVuZ3RoOysrYilpZihpc05hTihhW2JdKSlyZXR1cm4hMTtyZXR1cm4hMH1mdW5jdGlvbiBjKGEsYyl7aWYoInN0cmluZyIhPXR5cGVvZiBhfHwic3RyaW5nIiE9dHlwZW9mIGMpcmV0dXJuIE5hTjt2YXIgZD1hLnNwbGl0KCIuIiksZT1jLnNwbGl0KCIuIik7aWYoIWIoZCl8fCFiKGUpKXJldHVybiBOYU47Zm9yKHZhciBmPU1hdGgubWF4KGQubGVuZ3RoLGUubGVuZ3RoKSxnPTA7ZzxmOysrZyl7dmFyIGg9dm9pZCAwIT1kW2ddP2RbZ106IjAiLGk9dm9pZCAwIT1lW2ddP2VbZ106IjAiO2lmKGg9TnVtYmVyKGgpLGk9TnVtYmVyKGkpLGg+aSlyZXR1cm4gMTtpZihoPGkpcmV0dXJuLTF9cmV0dXJuIDB9dmFyIGQ9e307ZC5pc0dyZWF0ZXJUaGFuPWZ1bmN0aW9uKGEsYil7cmV0dXJuIGMoYSxiKT4wfSxkLmlzR3JlYXRlclRoYW5FcXVhbD1mdW5jdGlvbihhLGIpe3JldHVybiBjKGEsYik+PTB9LGQuaXNMZXNzVGhhbj1mdW5jdGlvbihhLGIpe3JldHVybiBjKGEsYik8MH0sZC5pc0xlc3NUaGFuRXF1YWw9ZnVuY3Rpb24oYSxiKXtyZXR1cm4gYyhhLGIpPD0wfSxkLmlzU2FtZT1mdW5jdGlvbihhLGIpe3JldHVybiAwPT09YyhhLGIpfSxkLmlzRGlmZmVyZW50PWZ1bmN0aW9uKGEsYil7cmV0dXJuIDAhPT1jKGEsYil9LGEuVmVyc2lvblV0aWxzPWR9KGIpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKGEsYixjKXt0aGlzLmZuPWEsdGhpcy5jdHg9Yix0aGlzLnBhcmFtcz1jfWIucHJvdG90eXBlLnJ1bj1mdW5jdGlvbigpe3RoaXMucGFyYW1zP3RoaXMuZm4uYXBwbHkodGhpcy5jdHgsdGhpcy5wYXJhbXMpOnRoaXMuZm4uYXBwbHkodGhpcy5jdHgpfSxhLnJhZGlvLkNvbW1hbmQ9Yn0oZCksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoYSxiKXt0aGlzLl9xdWV1ZT1bXSx0aGlzLl9sYXN0VHM9MCx0aGlzLl9pc1N1c3BlbmRlZD12b2lkIDAhPT1hJiZhLHRoaXMuX2RlbGF5PXZvaWQgMCE9PWI/YjowfWIucHJvdG90eXBlLmFkZENvbW1hbmQ9ZnVuY3Rpb24oYSl7dGhpcy5fcXVldWUucHVzaChhKSx0aGlzLl9kcmFpbigpfSxiLnByb3RvdHlwZS5jYW5jZWxBbGxDb21tYW5kcz1mdW5jdGlvbigpe3RoaXMuX3F1ZXVlPVtdfSxiLnByb3RvdHlwZS5pc0VtcHR5PWZ1bmN0aW9uKCl7cmV0dXJuIDA9PT10aGlzLl9xdWV1ZS5sZW5ndGh9LGIucHJvdG90eXBlLnN1c3BlbmQ9ZnVuY3Rpb24oKXt0aGlzLl9pc1N1c3BlbmRlZD0hMH0sYi5wcm90b3R5cGUucmVzdW1lPWZ1bmN0aW9uKCl7dGhpcy5faXNTdXNwZW5kZWQ9ITEsdGhpcy5fZHJhaW4oKX0sYi5wcm90b3R5cGUuZmx1c2g9ZnVuY3Rpb24oKXt0aGlzLl9pc1N1c3BlbmRlZD0hMTtmb3IodmFyIGE9MDthPHRoaXMuX3F1ZXVlLmxlbmd0aDthKyspe3RoaXMuX3F1ZXVlW2FdLnJ1bigpfXRoaXMuX3F1ZXVlPVtdfSxiLnByb3RvdHlwZS5fZHJhaW49ZnVuY3Rpb24oKXtpZighdGhpcy5faXNTdXNwZW5kZWQmJiF0aGlzLl9kcmFpbkluUHJvZ3Jlc3Mpe3RoaXMuX2RyYWluSW5Qcm9ncmVzcz0hMDt2YXIgYT10aGlzOyFmdW5jdGlvbiBiKCl7dmFyIGM9YS5fcXVldWUuc2hpZnQoKTtjP2EuX3J1bkNvbW1hbmQoYyxmdW5jdGlvbigpe2EuX2lzU3VzcGVuZGVkfHxiKCl9KTphLl9kcmFpbkluUHJvZ3Jlc3M9ITF9KCl9fSxiLnByb3RvdHlwZS5fcnVuQ29tbWFuZD1mdW5jdGlvbihhLGIpe2Z1bmN0aW9uIGMoKXthLnJ1bigpLG51bGwhPWImJmIuY2FsbChkKX12YXIgZD10aGlzO2lmKDA9PXRoaXMuX2xhc3RUcyljKCk7ZWxzZXt2YXIgZT0obmV3IERhdGUpLmdldFRpbWUoKSxmPWUtdGhpcy5fbGFzdFRzO3RoaXMuX2xhc3RUcz1lLGY8dGhpcy5fZGVsYXk/c2V0VGltZW91dChjLHRoaXMuX2RlbGF5LWYpOmMoKX19LGEucmFkaW8uQ29tbWFuZFF1ZXVlPWJ9KGQpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKGEsYil7aWYodGhpcy5fbmFtZT1hLCFiKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBsb2dnZXIgb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7dGhpcy5fbG9nZ2VyPWIsdGhpcy5fbGlzdGVuZXJzPXt9LHRoaXMuX3JlcXVlc3RzPXt9LHRoaXMuX2NvbW1hbmRzPXt9LHRoaXMuX2lzU2h1dERvd249ITF9ZnVuY3Rpb24gYyhhLGMpe2lmKGE9PT1jKXJldHVybiEwO2Zvcih2YXIgZD0oYXx8IiIpLnNwbGl0KGIuU0VQQVJBVE9SKSxlPShjfHwiIikuc3BsaXQoYi5TRVBBUkFUT1IpLGY9ITAsZz0wO2c8ZC5sZW5ndGg7ZysrKWY9ZiYmKGRbZ109PT1iLldJTERDQVJEfHxkW2ddPT09ZVtnXSk7cmV0dXJuIGZ9Yi5XSUxEQ0FSRD0iKiIsYi5TRVBBUkFUT1I9IjoiLGIucHJvdG90eXBlLnRvU3RyaW5nPWZ1bmN0aW9uKCl7cmV0dXJuIjxjaGFubmVsOiAiK3RoaXMuX25hbWUrIj4ifSxiLnByb3RvdHlwZS5zaHV0ZG93bj1mdW5jdGlvbigpe3RoaXMuX2lzU2h1dERvd258fCh0aGlzLl9sb2dnZXIuZGVidWcoZCwiI3NodXRkb3duID4gU2h1dHRpbmcgZG93biIpLHRoaXMub2ZmKCksdGhpcy5fcmVxdWVzdHM9e30sdGhpcy5fY29tbWFuZHM9e30sdGhpcy5faXNTaHV0RG93bj0hMCl9LGIucHJvdG90eXBlLm9uPWZ1bmN0aW9uKGEsYixjKXt0aGlzLl9pc1NodXREb3dufHwodGhpcy5fbGlzdGVuZXJzW2FdfHwodGhpcy5fbGlzdGVuZXJzW2FdPVtdKSx0aGlzLl9saXN0ZW5lcnNbYV0ucHVzaCh7Zm46YixjdHg6Y30pKX0sYi5wcm90b3R5cGUub2ZmPWZ1bmN0aW9uKGEsYixjKXtpZighdGhpcy5faXNTaHV0RG93bil7aWYoYj0iZnVuY3Rpb24iPT10eXBlb2YgYj9iOm51bGwsIWEmJm51bGw9PWImJiFjKXJldHVybiB2b2lkKHRoaXMuX2xpc3RlbmVycz17fSk7aWYoYSl0aGlzLl9yZW1vdmVMaXN0ZW5lcihhLGIsYyk7ZWxzZSBmb3IoYSBpbiB0aGlzLl9saXN0ZW5lcnMpdGhpcy5fbGlzdGVuZXJzLmhhc093blByb3BlcnR5KGEpJiZ0aGlzLl9yZW1vdmVMaXN0ZW5lcihhLGIsYyl9fSxiLnByb3RvdHlwZS50cmlnZ2VyPWZ1bmN0aW9uKGEpe2lmKCF0aGlzLl9pc1NodXREb3duKWZvcih2YXIgYiBpbiB0aGlzLl9saXN0ZW5lcnMpaWYodGhpcy5fbGlzdGVuZXJzLmhhc093blByb3BlcnR5KGIpJiZjKGIsYS5uYW1lKSlmb3IodmFyIGQ9dGhpcy5fbGlzdGVuZXJzW2JdLnNsaWNlKDApLGU9MDtlPGQubGVuZ3RoO2UrKyl7dmFyIGY9ZFtlXTtmLmZuLmNhbGwoZi5jdHgsYSl9fSxiLnByb3RvdHlwZS5jb21wbHk9ZnVuY3Rpb24oYSxiLGMpe3RoaXMuX2lzU2h1dERvd258fCh0aGlzLl9jb21tYW5kc1thXT17Y21kOmIsY3R4OmN9KX0sYi5wcm90b3R5cGUuY29tbWFuZD1mdW5jdGlvbihhLGIpe2lmKCF0aGlzLl9pc1NodXREb3duKXt2YXIgYz10aGlzLl9jb21tYW5kc1thXTtpZighYylyZXR1cm4gdm9pZCB0aGlzLl9sb2dnZXIud2FybihkLCIjY29tbWFuZCA+IE5vIGNvbW1hbmQgaGFuZGxlciBmb3I6ICIrYSk7Yy5jbWQuY2FsbChjLmN0eCxiKX19LGIucHJvdG90eXBlLnJlcGx5PWZ1bmN0aW9uKGEsYixjKXt0aGlzLl9pc1NodXREb3dufHwodGhpcy5fcmVxdWVzdHNbYV09e2ZuOmIsY3R4OmN9KX0sYi5wcm90b3R5cGUucmVxdWVzdD1mdW5jdGlvbihhKXtpZighdGhpcy5faXNTaHV0RG93bil7dmFyIGI9dGhpcy5fcmVxdWVzdHNbYV07cmV0dXJuIGI/Yi5mbi5jYWxsKGIuY3R4KToodGhpcy5fbG9nZ2VyLndhcm4oZCwiI3JlcXVlc3QgPiBObyByZXF1ZXN0IGhhbmRsZXIgZm9yOiAiK2EpLG51bGwpfX0sYi5wcm90b3R5cGUuX3JlbW92ZUxpc3RlbmVyPWZ1bmN0aW9uKGEsYixjKXtiPSJmdW5jdGlvbiI9PXR5cGVvZiBiP2I6bnVsbDt2YXIgZD10aGlzLl9saXN0ZW5lcnNbYV07aWYoZCl7aWYoIWQubGVuZ3RofHxudWxsPT1iJiYhYylyZXR1cm4gdm9pZCBkZWxldGUgdGhpcy5fbGlzdGVuZXJzW2FdO2Zvcih2YXIgZT0wO2U8ZC5sZW5ndGg7ZSsrKXt2YXIgZj1kW2VdO251bGwhPT1iJiZiIT09Zi5mbnx8YyYmYyE9PWYuY3R4fHx0aGlzLl9saXN0ZW5lcnNbYV0uc3BsaWNlKGUsMSl9fX07dmFyIGQ9InJhZGlvOjpDaGFubmVsIjthLnJhZGlvLkNoYW5uZWw9Yn0oZCksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoYSl7aWYoIWEpdGhyb3cgbmV3IEVycm9yKCJSZWZlcmVuY2UgdG8gdGhlIGxvZ2dlciBvYmplY3QgY2Fubm90IGJlIE5VTEwiKTt0aGlzLl9sb2dnZXI9YSx0aGlzLl9jaGFubmVscz17fX12YXIgYz1hLnJhZGlvLkNoYW5uZWw7Yi5wcm90b3R5cGUuY2hhbm5lbD1mdW5jdGlvbihhKXtyZXR1cm4gdGhpcy5fY2hhbm5lbHNbYV18fCh0aGlzLl9jaGFubmVsc1thXT1uZXcgYyhhLHRoaXMuX2xvZ2dlcikpLHRoaXMuX2NoYW5uZWxzW2FdfSxiLnByb3RvdHlwZS5zaHV0ZG93bj1mdW5jdGlvbigpe2Zvcih2YXIgYSBpbiB0aGlzLl9jaGFubmVscyl0aGlzLl9jaGFubmVscy5oYXNPd25Qcm9wZXJ0eShhKSYmdGhpcy5fY2hhbm5lbHNbYV0uc2h1dGRvd24oKX0sYS5yYWRpby5SYWRpbz1ifShkKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYihhLGIpe2Z1bmN0aW9uIGMoKXt0aGlzLmNvbnN0cnVjdG9yPWF9Zm9yKHZhciBkIGluIGIpYi5oYXNPd25Qcm9wZXJ0eShkKSYmKGFbZF09YltkXSk7cmV0dXJuIGMucHJvdG90eXBlPWIucHJvdG90eXBlLGEucHJvdG90eXBlPW5ldyBjLGEuX19zdXBlcl9fPWIucHJvdG90eXBlLGF9YS5leHRlbmQ9Yn0oZCksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoKXt9Yi5wcm90b3R5cGUud3JpdGU9ZnVuY3Rpb24oYSl7dGhyb3cgbmV3IEVycm9yKCJJbXBsZW1lbnRhdGlvbiBlcnJvcjogTWV0aG9kIG11c3QgYmUgb3ZlcnJpZGRlbi4iKX0sYS5JTG9nV3JpdGVyPWJ9KGQpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKCl7fWIucHJvdG90eXBlLndyaXRlPWZ1bmN0aW9uKGEpe3dpbmRvdy5jb25zb2xlJiZ3aW5kb3cuY29uc29sZS5sb2cmJndpbmRvdy5jb25zb2xlLmxvZyhhKX0sYS5Mb2dXcml0ZXI9Yn0oZCksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoKXt9Yi5wcm90b3R5cGUuc2V0TG9nV3JpdGVyPWZ1bmN0aW9uKGEpe3Rocm93IG5ldyBFcnJvcigiSW1wbGVtZW50YXRpb24gZXJyb3I6IE1ldGhvZCBtdXN0IGJlIG92ZXJyaWRkZW4uIil9LGIucHJvdG90eXBlLmdldExvZ1dyaXRlcj1mdW5jdGlvbigpe3Rocm93IG5ldyBFcnJvcigiSW1wbGVtZW50YXRpb24gZXJyb3I6IE1ldGhvZCBtdXN0IGJlIG92ZXJyaWRkZW4uIil9LGIucHJvdG90eXBlLmdldEVuYWJsZWQ9ZnVuY3Rpb24oKXt0aHJvdyBuZXcgRXJyb3IoIkltcGxlbWVudGF0aW9uIGVycm9yOiBNZXRob2QgbXVzdCBiZSBvdmVycmlkZGVuLiIpfSxiLnByb3RvdHlwZS5lbmFibGU9ZnVuY3Rpb24oKXt0aHJvdyBuZXcgRXJyb3IoIkltcGxlbWVudGF0aW9uIGVycm9yOiBNZXRob2QgbXVzdCBiZSBvdmVycmlkZGVuLiIpfSxiLnByb3RvdHlwZS5kaXNhYmxlPWZ1bmN0aW9uKCl7dGhyb3cgbmV3IEVycm9yKCJJbXBsZW1lbnRhdGlvbiBlcnJvcjogTWV0aG9kIG11c3QgYmUgb3ZlcnJpZGRlbi4iKX0sYi5wcm90b3R5cGUuZGVidWc9ZnVuY3Rpb24oYSxiKXt0aHJvdyBuZXcgRXJyb3IoIkltcGxlbWVudGF0aW9uIGVycm9yOiBNZXRob2QgbXVzdCBiZSBvdmVycmlkZGVuLiIpfSxiLnByb3RvdHlwZS5pbmZvPWZ1bmN0aW9uKGEsYil7dGhyb3cgbmV3IEVycm9yKCJJbXBsZW1lbnRhdGlvbiBlcnJvcjogTWV0aG9kIG11c3QgYmUgb3ZlcnJpZGRlbi4iKX0sYi5wcm90b3R5cGUud2Fybj1mdW5jdGlvbihhLGIpe3Rocm93IG5ldyBFcnJvcigiSW1wbGVtZW50YXRpb24gZXJyb3I6IE1ldGhvZCBtdXN0IGJlIG92ZXJyaWRkZW4uIil9LGIucHJvdG90eXBlLmVycm9yPWZ1bmN0aW9uKGEsYil7dGhyb3cgbmV3IEVycm9yKCJJbXBsZW1lbnRhdGlvbiBlcnJvcjogTWV0aG9kIG11c3QgYmUgb3ZlcnJpZGRlbi4iKX0sYS5JTG9nZ2VyPWJ9KGQpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKCl7dGhpcy5fbG9nV3JpdGVyPW5ldyBkfWZ1bmN0aW9uIGMoYSl7cmV0dXJuIGE8MTA/IjAwIithOmE8MTAwPyIwIithOiIiK2F9dmFyIGQ9YS5Mb2dXcml0ZXI7Yi5wcm90b3R5cGUuc2V0TG9nV3JpdGVyPWZ1bmN0aW9uKGEpe2lmKCFhKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBJTG9nV3JpdGVyIG9iamVjdCBjYW5ub3QgYmUgTlVMTCIpO3RoaXMuX2xvZ1dyaXRlcj1hLHRoaXMuX2VuYWJsZWQ9ITF9LGIucHJvdG90eXBlLmdldExvZ1dyaXRlcj1mdW5jdGlvbigpe3JldHVybiB0aGlzLl9sb2dXcml0ZXJ9LGIucHJvdG90eXBlLmdldEVuYWJsZWQ9ZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5fZW5hYmxlZH0sYi5wcm90b3R5cGUuZW5hYmxlPWZ1bmN0aW9uKCl7dGhpcy5fZW5hYmxlZD0hMH0sYi5wcm90b3R5cGUuZGlzYWJsZT1mdW5jdGlvbigpe3RoaXMuX2VuYWJsZWQ9ITF9LGIucHJvdG90eXBlLmRlYnVnPWZ1bmN0aW9uKGEsYil7dGhpcy5fbG9nKGEsZixiKX0sYi5wcm90b3R5cGUuaW5mbz1mdW5jdGlvbihhLGIpe3RoaXMuX2xvZyhhLGUsYil9LGIucHJvdG90eXBlLndhcm49ZnVuY3Rpb24oYSxiKXt0aGlzLl9sb2coYSxnLGIpfSxiLnByb3RvdHlwZS5lcnJvcj1mdW5jdGlvbihhLGIpe3RoaXMuX2xvZyhhLGgsYil9LGIucHJvdG90eXBlLl9sb2c9ZnVuY3Rpb24oYSxiLGQpe2lmKGI9PWh8fHRoaXMuX2VuYWJsZWQpe3ZhciBlPSIiLGY9bmV3IERhdGU7ZSs9IlsiK2YudG9UaW1lU3RyaW5nKCkrIi4iK2MoZi5nZXRNaWxsaXNlY29uZHMoKSkrIl0gWyIrYisiXSAiLGUrPSJbIithKyJdICIrZCx0aGlzLl9sb2dXcml0ZXIud3JpdGUoZSl9fTt2YXIgZT0iSU5GTyIsZj0iREVCVUciLGc9IldBUk4iLGg9IkVSUk9SIjthLkxvZ2dlcj1ifShkKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYihhLGIpe3RoaXMuX3BsdWdpbk5hbWU9YSx0aGlzLl9ldmVudE5hbWU9Yn12YXIgYz1hLnJhZGlvLkNoYW5uZWw7Yi5wcm90b3R5cGUuZ2V0UGx1Z2luTmFtZT1mdW5jdGlvbigpe3JldHVybiB0aGlzLl9wbHVnaW5OYW1lfSxiLnByb3RvdHlwZS5nZXRFdmVudE5hbWU9ZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5fZXZlbnROYW1lfSxiLnByb3RvdHlwZS5nZXROYW1lPWZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMuX3BsdWdpbk5hbWUrYy5TRVBBUkFUT1IrdGhpcy5fZXZlbnROYW1lfSxhLlRyaWdnZXI9Yn0oZCksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoYSxiKXt0aGlzLm5hbWU9YSx0aGlzLmRhdGE9Yn1iLlNVQ0NFU1M9InN1Y2Nlc3MiLGIuRVJST1I9ImVycm9yIixiLmNyZWF0ZUZyb21UcmlnZ2VyPWZ1bmN0aW9uKGEpe3JldHVybiBuZXcgYihhLmdldE5hbWUoKSl9LGEuRXZlbnQ9Yn0oZCksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoKXt0aGlzLl9ldmVudHM9e319Yi5wcm90b3R5cGUuYWRkRXZlbnRMaXN0ZW5lcj1mdW5jdGlvbihhLGIsYyl7YSYmYiYmKGM9Y3x8d2luZG93LHRoaXMuX2V2ZW50c1thXT10aGlzLl9ldmVudHNbYV18fFtdLHRoaXMuX2V2ZW50c1thXS5wdXNoKHtjYjpiLGN0eDpjfSkpfSxiLnByb3RvdHlwZS5yZW1vdmVFdmVudExpc3RlbmVyPWZ1bmN0aW9uKGEsYixjKXtpZihhJiZiKXtjPWN8fHdpbmRvdzt2YXIgZCxlLGY9ITE7Zm9yKGUgaW4gdGhpcy5fZXZlbnRzKWlmKGE9PT1lKXtmPSEwO2JyZWFrfWlmKGYpe2ZvcihkPXRoaXMuX2V2ZW50c1tlXS5sZW5ndGgtMTtkPj0wO2QtLSl7dmFyIGc9dGhpcy5fZXZlbnRzW2VdW2RdO2I9PT1nLmNiJiZjPT09Zy5jdHgmJnRoaXMuX2V2ZW50c1tlXS5zcGxpY2UoZCwxKX10aGlzLl9ldmVudHNbZV0ubGVuZ3RofHxkZWxldGUgdGhpcy5fZXZlbnRzW2VdfX19LGIucHJvdG90eXBlLmRpc3BhdGNoRXZlbnQ9ZnVuY3Rpb24oYSl7aWYoYS5uYW1lKXt2YXIgYixjO2ZvcihiIGluIHRoaXMuX2V2ZW50cylpZih0aGlzLl9ldmVudHMuaGFzT3duUHJvcGVydHkoYikmJmEubmFtZT09PWIpe3ZhciBkPXRoaXMuX2V2ZW50c1tiXSxlPWQuc2xpY2UoMCksZj1lLmxlbmd0aDtmb3IoYz0wO2M8ZjtjKyspZVtjXS5jYi5jYWxsKGVbY10uY3R4LGEpO2JyZWFrfX19LGIucHJvdG90eXBlLnJlbW92ZUFsbExpc3RlbmVycz1mdW5jdGlvbihhKXtpZihhKXt2YXIgYixjO2ZvcihjIGluIHRoaXMuX2V2ZW50cylpZih0aGlzLl9ldmVudHMuaGFzT3duUHJvcGVydHkoYykpe2ZvcihiPXRoaXMuX2V2ZW50c1tjXS5sZW5ndGgtMTtiPj0wO2ItLSl7dmFyIGQ9dGhpcy5fZXZlbnRzW2NdW2JdO2QuY3R4PT09YSYmdGhpcy5fZXZlbnRzW2NdLnNwbGljZShiLDEpfXRoaXMuX2V2ZW50c1tjXS5sZW5ndGh8fGRlbGV0ZSB0aGlzLl9ldmVudHNbY119fWVsc2UgdGhpcy5fZXZlbnRzPXt9fSxhLkV2ZW50RGlzcGF0Y2hlcj1ifShkKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYigpe31mdW5jdGlvbiBjKGEsYil7dGhpcy51cmw9YXx8bnVsbCx0aGlzLm1ldGhvZD1iLHRoaXMuX3htbGh0dHA9bnVsbH1mdW5jdGlvbiBkKCl7ZC5fX3N1cGVyX18uY29uc3RydWN0b3IuY2FsbCh0aGlzKSx0aGlzLl9jb25uZWN0aW9uPW51bGx9dmFyIGU9YS5FdmVudCxmPWEuRXZlbnREaXNwYXRjaGVyO2IuR0VUPSJHRVQiLGQuUkVTUE9OU0U9InJlc3BvbnNlIixkLklOU1RBTkNFPSJpbnN0YW5jZSIsYS5leHRlbmQoZCxmKSxkLnByb3RvdHlwZS5jbG9zZT1mdW5jdGlvbigpe3RoaXMucmVtb3ZlQWxsTGlzdGVuZXJzKG51bGwpfSxkLnByb3RvdHlwZS5sb2FkPWZ1bmN0aW9uKGEpe2EmJmEubWV0aG9kJiZhLnVybCYmKGEuX3htbGh0dHA9dGhpcy5fY3JlYXRlQ09SU1JlcXVlc3QoYSksYS5feG1saHR0cD9hLl94bWxodHRwLnNlbmQoKTp0aGlzLl9sb2FkSW1hZ2UoYSkpfSxkLnByb3RvdHlwZS5fY3JlYXRlQ09SU1JlcXVlc3Q9ZnVuY3Rpb24oYSl7dmFyIGI9bnVsbDtpZih2b2lkIDAhPT13aW5kb3cuWE1MSHR0cFJlcXVlc3Qpe3ZhciBjPW5ldyB3aW5kb3cuWE1MSHR0cFJlcXVlc3Q7IndpdGhDcmVkZW50aWFscyJpbiBjJiYoYj1jLGIub3BlbihhLm1ldGhvZCxhLnVybCwhMCkpfWlmKG51bGw9PWImJnZvaWQgMCE9PXdpbmRvdy5YRG9tYWluUmVxdWVzdCYmKGI9bmV3IHdpbmRvdy5YRG9tYWluUmVxdWVzdCxiLm9wZW4oYS5tZXRob2QsYS51cmwpKSxiKXt2YXIgZj17fTtmW2QuSU5TVEFOQ0VdPXRoaXM7dmFyIGc9dGhpcztiLm9ubG9hZD1mdW5jdGlvbigpe2lmKGIuc3RhdHVzJiZwYXJzZUludChiLnN0YXR1cywxMCk+PTQwMClyZXR1cm4gdGhpcy5vbmVycm9yKCk7ZltkLlJFU1BPTlNFXT1iLnJlc3BvbnNlVGV4dCxnLmRpc3BhdGNoRXZlbnQobmV3IGUoZS5TVUNDRVNTLGYpKX0sYi5vbmVycm9yPWZ1bmN0aW9uKCl7Zy5kaXNwYXRjaEV2ZW50KG5ldyBlKGUuRVJST1IsZikpfX1yZXR1cm4gYn0sZC5wcm90b3R5cGUuX2xvYWRJbWFnZT1mdW5jdGlvbihhKXt0aGlzLl9jb25uZWN0aW9ufHwodGhpcy5fY29ubmVjdGlvbj1uZXcgSW1hZ2UsdGhpcy5fY29ubmVjdGlvbi5hbHQ9IiIpLHRoaXMuX2Nvbm5lY3Rpb24uc3JjPWEudXJsO3ZhciBiPXt9O2JbZC5SRVNQT05TRV09IiIsYltkLklOU1RBTkNFXT10aGlzLHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgZShlLlNVQ0NFU1MsYikpfSxhLlVSTFJlcXVlc3RNZXRob2Q9YixhLlVSTFJlcXVlc3Q9YyxhLlVSTExvYWRlcj1kfShkKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7dmFyIGI9IjIuMi4wLjIyMyIsYz0iMDVjM2M0IixkPXt9O2QuZ2V0VmVyc2lvbj1mdW5jdGlvbigpe3JldHVybiJqcy0iK2IrIi0iK2N9LGQuZ2V0TWFqb3I9ZnVuY3Rpb24oKXtyZXR1cm4gZC5nZXROdW1iZXJBdFBvc2l0aW9uKDApfSxkLmdldE1pbm9yPWZ1bmN0aW9uKCl7cmV0dXJuIGQuZ2V0TnVtYmVyQXRQb3NpdGlvbigxKX0sZC5nZXRNaWNybz1mdW5jdGlvbigpe3JldHVybiBkLmdldE51bWJlckF0UG9zaXRpb24oMil9LGQuZ2V0UGF0Y2g9ZnVuY3Rpb24oKXtyZXR1cm4gZC5nZXROdW1iZXJBdFBvc2l0aW9uKDMpfSxkLmdldEJ1aWxkPWZ1bmN0aW9uKCl7cmV0dXJuIGN9LGQuZ2V0QXBpTGV2ZWw9ZnVuY3Rpb24oKXtyZXR1cm4gNH0sZC5nZXROdW1iZXJBdFBvc2l0aW9uPWZ1bmN0aW9uKGEpe3JldHVybiBiLnNwbGl0KCIuIilbYV19LGEuVmVyc2lvbj1kfShjKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYihhLGIpe3RoaXMuX21lc3NhZ2U9YSx0aGlzLl9kZXRhaWxzPWJ9Yi5wcm90b3R5cGUuZ2V0TWVzc2FnZT1mdW5jdGlvbigpe3JldHVybiB0aGlzLl9tZXNzYWdlfSxiLnByb3RvdHlwZS5nZXREZXRhaWxzPWZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMuX2RldGFpbHN9LGEuRXJyb3JJbmZvPWJ9KGMpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKCl7dGhpcy5kZWJ1Z0xvZ2dpbmc9ITF9YS5IZWFydGJlYXRDb25maWc9Yn0oYyksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoKXt9Yi5wcm90b3R5cGUub25FcnJvcj1mdW5jdGlvbihhKXt9LGEuSGVhcnRiZWF0RGVsZWdhdGU9Yn0oYyksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoKXt9Yi5wcm90b3R5cGUuY29uZmlndXJlPWZ1bmN0aW9uKGEpe3Rocm93IG5ldyBFcnJvcigiSW1wbGVtZW50YXRpb24gZXJyb3I6IE1ldGhvZCBtdXN0IGJlIG92ZXJyaWRkZW4uIil9LGIucHJvdG90eXBlLmJvb3RzdHJhcD1mdW5jdGlvbihhKXt0aHJvdyBuZXcgRXJyb3IoIkltcGxlbWVudGF0aW9uIGVycm9yOiBNZXRob2QgbXVzdCBiZSBvdmVycmlkZGVuLiIpfSxiLnByb3RvdHlwZS5zZXR1cD1mdW5jdGlvbigpe3Rocm93IG5ldyBFcnJvcigiSW1wbGVtZW50YXRpb24gZXJyb3I6IE1ldGhvZCBtdXN0IGJlIG92ZXJyaWRkZW4uIil9LGIucHJvdG90eXBlLmRlc3Ryb3k9ZnVuY3Rpb24oKXt0aHJvdyBuZXcgRXJyb3IoIkltcGxlbWVudGF0aW9uIGVycm9yOiBNZXRob2QgbXVzdCBiZSBvdmVycmlkZGVuLiIpfSxiLnByb3RvdHlwZS5lbmFibGU9ZnVuY3Rpb24oKXt0aHJvdyBuZXcgRXJyb3IoIkltcGxlbWVudGF0aW9uIGVycm9yOiBNZXRob2QgbXVzdCBiZSBvdmVycmlkZGVuLiIpfSxiLnByb3RvdHlwZS5kaXNhYmxlPWZ1bmN0aW9uKCl7dGhyb3cgbmV3IEVycm9yKCJJbXBsZW1lbnRhdGlvbiBlcnJvcjogTWV0aG9kIG11c3QgYmUgb3ZlcnJpZGRlbi4iKX0sYi5wcm90b3R5cGUuZ2V0TmFtZT1mdW5jdGlvbigpe3Rocm93IG5ldyBFcnJvcigiSW1wbGVtZW50YXRpb24gZXJyb3I6IE1ldGhvZCBtdXN0IGJlIG92ZXJyaWRkZW4uIil9LGIucHJvdG90eXBlLmlzSW5pdGlhbGl6ZWQ9ZnVuY3Rpb24oKXt0aHJvdyBuZXcgRXJyb3IoIkltcGxlbWVudGF0aW9uIGVycm9yOiBNZXRob2QgbXVzdCBiZSBvdmVycmlkZGVuLiIpfSxiLnByb3RvdHlwZS5yZXNvbHZlRGF0YT1mdW5jdGlvbihhKXt0aHJvdyBuZXcgRXJyb3IoIkltcGxlbWVudGF0aW9uIGVycm9yOiBNZXRob2QgbXVzdCBiZSBvdmVycmlkZGVuLiIpfSxhLnBsdWdpbi5JUGx1Z2luPWJ9KGQpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKGEsYixjLGQpe3RoaXMudHJpZ2dlcj1hLHRoaXMuYWN0aW9uPWMsdGhpcy5wbHVnaW49Yix0aGlzLl9wYXJhbU1hcHBpbmdzPXt9LHRoaXMubWVyZ2VQYXJhbXMoZCl9dmFyIGM9YS5wbHVnaW4uUGFyYW1NYXBwaW5nO2IucHJvdG90eXBlLm1lcmdlUGFyYW1zPWZ1bmN0aW9uKGEpe2lmKGEpZm9yKHZhciBiPTA7YjxhLmxlbmd0aDtiKyspe3ZhciBjPWFbYl07dGhpcy5fcGFyYW1NYXBwaW5nc1tjLmdldEtleU5hbWUoKV09Y319LGIucHJvdG90eXBlLmdldFBhcmFtcz1mdW5jdGlvbigpe3ZhciBhPVtdO2Zvcih2YXIgYiBpbiB0aGlzLl9wYXJhbU1hcHBpbmdzKXRoaXMuX3BhcmFtTWFwcGluZ3MuaGFzT3duUHJvcGVydHkoYikmJmEucHVzaCh0aGlzLl9wYXJhbU1hcHBpbmdzW2JdKTtyZXR1cm4gYX0sYi5wcm90b3R5cGUuYWRkUGFyYW09ZnVuY3Rpb24oYSl7dGhpcy5fcGFyYW1NYXBwaW5nc1thLmdldEtleU5hbWUoKV09YX0sYi5wcm90b3R5cGUucmVtb3ZlUGFyYW09ZnVuY3Rpb24oYSxiKXt2YXIgZD1uZXcgYyhhLGIpO3RoaXMuX3BhcmFtTWFwcGluZ3MuaGFzT3duUHJvcGVydHkoZC5nZXRLZXlOYW1lKCkpJiZkZWxldGUgdGhpcy5fcGFyYW1NYXBwaW5nc1tkLmdldEtleU5hbWUoKV19LGEucGx1Z2luLkJlaGF2aW91cj1ifShkKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYihhLGIsZCl7dGhpcy5fcGx1Z2luTmFtZT1hLHRoaXMuX2tleT1iLHRoaXMuX3BhcmFtTmFtZT1kfHxhK2MuU0VQQVJBVE9SK2J9dmFyIGM9YS5yYWRpby5DaGFubmVsO2IucHJvdG90eXBlLmdldFBsdWdpbk5hbWU9ZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5fcGx1Z2luTmFtZX0sYi5wcm90b3R5cGUuZ2V0S2V5PWZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMuX2tleX0sYi5wcm90b3R5cGUuZ2V0S2V5TmFtZT1mdW5jdGlvbigpe3JldHVybiB0aGlzLl9wbHVnaW5OYW1lK2MuU0VQQVJBVE9SK3RoaXMuX2tleX0sYi5wcm90b3R5cGUuZ2V0UGFyYW1OYW1lPWZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMuX3BhcmFtTmFtZX0sYS5wbHVnaW4uUGFyYW1NYXBwaW5nPWJ9KGQpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKGEpe2lmKCFhKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBsb2dnZXIgb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7dGhpcy5fbG9nZ2VyPWEsdGhpcy5fcGx1Z2lucz17fSx0aGlzLl9iZWhhdmlvdXJzPXt9LHRoaXMuX3JhZGlvPW5ldyBkKHRoaXMuX2xvZ2dlciksdGhpcy5fZGF0YUNoYW5uZWw9dGhpcy5fcmFkaW8uY2hhbm5lbChnKSx0aGlzLl9jdHJsQ2hhbm5lbD10aGlzLl9yYWRpby5jaGFubmVsKGgpfXZhciBjPWEuRXZlbnQsZD1hLnJhZGlvLlJhZGlvLGU9YS5yYWRpby5DaGFubmVsLGY9YS5wbHVnaW4uQmVoYXZpb3VyO2IuRVJST1I9ImVycm9yIixiLnByb3RvdHlwZS5hZGRQbHVnaW49ZnVuY3Rpb24oYSl7dmFyIGI9YS5nZXROYW1lKCk7dGhpcy5fcGx1Z2luc1tiXSYmdGhpcy5fbG9nZ2VyLndhcm4oaSwiI2FkZFBsdWdpbiA+IFJlcGxhY2luZyBwbHVnaW46ICIrYiksdGhpcy5fcGx1Z2luc1tiXT1hLGEuYm9vdHN0cmFwKHRoaXMpfSxiLnByb3RvdHlwZS5zZXR1cFBsdWdpbnM9ZnVuY3Rpb24oKXtmb3IodmFyIGEgaW4gdGhpcy5fcGx1Z2lucyl0aGlzLl9wbHVnaW5zLmhhc093blByb3BlcnR5KGEpJiZ0aGlzLl9wbHVnaW5zW2FdLnNldHVwKCl9LGIucHJvdG90eXBlLnBsdWdpbkV4aXN0cz1mdW5jdGlvbihhKXtyZXR1cm4hIXRoaXMuX3BsdWdpbnNbYV19LGIucHJvdG90eXBlLmlzUGx1Z2luSW5pdGlhbGl6ZWQ9ZnVuY3Rpb24oYSl7cmV0dXJuIHRoaXMuX3BsdWdpbnNbYV0mJnRoaXMuX3BsdWdpbnNbYV0uaXNJbml0aWFsaXplZCgpfSxiLnByb3RvdHlwZS5vbj1mdW5jdGlvbihhLGIsYyxkKXt0aGlzLl9kYXRhQ2hhbm5lbC5vbihhK2UuU0VQQVJBVE9SK2IsYyxkKX0sYi5wcm90b3R5cGUub2ZmPWZ1bmN0aW9uKGEsYixjLGQpe3ZhciBmPWEmJmI/YStlLlNFUEFSQVRPUitiOm51bGw7dGhpcy5fZGF0YUNoYW5uZWwub2ZmKGYsYyxkKX0sYi5wcm90b3R5cGUudHJpZ2dlcj1mdW5jdGlvbihhKXt2YXIgYj1hLm5hbWUsYz10aGlzLl9iZWhhdmlvdXJzW2JdO2lmKGMpe3ZhciBkLGUsZixnLGgsaT17fSxqPXt9O2ZvcihkPTA7ZDxjLmxlbmd0aDtkKyspaWYoZj1jW2RdLGc9Zi5nZXRQYXJhbXMoKSlmb3IoZT0wO2U8Zy5sZW5ndGg7ZSsrKWg9Z1tlXSxpW2guZ2V0UGx1Z2luTmFtZSgpXT1pW2guZ2V0UGx1Z2luTmFtZSgpXXx8W10saC5rZXkgaW4gaVtoLmdldFBsdWdpbk5hbWUoKV18fGlbaC5nZXRQbHVnaW5OYW1lKCldLnB1c2goaC5nZXRLZXkoKSk7Zm9yKHZhciBrIGluIGkpaS5oYXNPd25Qcm9wZXJ0eShrKSYmKGpba109dGhpcy5yZXF1ZXN0KGssaVtrXSkpO2ZvcihkPTA7ZDxjLmxlbmd0aDtkKyspe2Y9Y1tkXTt2YXIgbD17X2JlaGF2aW91cjpmLF9ldmVudERhdGE6YS5kYXRhfHx7fX07aWYoZz1mLmdldFBhcmFtcygpKXtmb3IoZT0wO2U8Zy5sZW5ndGg7ZSsrKWg9Z1tlXSxsW2guZ2V0UGFyYW1OYW1lKCldPWpbaC5nZXRQbHVnaW5OYW1lKCldP2pbaC5nZXRQbHVnaW5OYW1lKCldW2guZ2V0S2V5KCldOm51bGw7dGhpcy5jb21tYW5kKGYucGx1Z2luLmdldE5hbWUoKSxmLmFjdGlvbixsKX19fXRoaXMuX2RhdGFDaGFubmVsLnRyaWdnZXIoYSl9LGIucHJvdG90eXBlLnJlcXVlc3Q9ZnVuY3Rpb24oYSxiKXt2YXIgYz10aGlzLl9wbHVnaW5zW2FdO3JldHVybiBjJiZiJiYwIT1iLmxlbmd0aD9jLnJlc29sdmVEYXRhKGIpOm51bGx9LGIucHJvdG90eXBlLnJhaXNlPWZ1bmN0aW9uKGEpe3RoaXMuX2Vycm9ySW5mbz1hO3ZhciBkPW5ldyBjKGIuRVJST1IsYSk7dGhpcy5fY3RybENoYW5uZWwudHJpZ2dlcihkKX0sYi5wcm90b3R5cGUuZ2V0RXJyb3JJbmZvPWZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMuX2Vycm9ySW5mb30sYi5wcm90b3R5cGUuZGVzdHJveT1mdW5jdGlvbigpe3RoaXMuX3JhZGlvLnNodXRkb3duKCk7Zm9yKHZhciBhIGluIHRoaXMuX3BsdWdpbnMpdGhpcy5fcGx1Z2lucy5oYXNPd25Qcm9wZXJ0eShhKSYmdGhpcy5fcGx1Z2luc1thXS5kZXN0cm95KCl9LGIucHJvdG90eXBlLmNvbXBseT1mdW5jdGlvbihhLGIsYyl7dGhpcy5fZGF0YUNoYW5uZWwuY29tcGx5KGEuZ2V0TmFtZSgpK2UuU0VQQVJBVE9SK2IsYyxhKX0sYi5wcm90b3R5cGUuY29tbWFuZD1mdW5jdGlvbihhLGIsYyl7dGhpcy5fZGF0YUNoYW5uZWwuY29tbWFuZChhK2UuU0VQQVJBVE9SK2IsYyl9LGIucHJvdG90eXBlLnJlZ2lzdGVyQmVoYXZpb3VyPWZ1bmN0aW9uKGEsYixjLGQpe3ZhciBlPWEuZ2V0TmFtZSgpLGc9bmV3IGYoYSxiLGMsZCk7dGhpcy5fYmVoYXZpb3Vyc1tlXT10aGlzLl9iZWhhdmlvdXJzW2VdfHxbXSx0aGlzLl9iZWhhdmlvdXJzW2VdLnB1c2goZyl9O3ZhciBnPSJkYXRhX2NoYW5uZWwiLGg9ImN0cmxfY2hhbm5lbCIsaT0icGx1Z2luOjpQbHVnaW5NYW5hZ2VyIjthLnBsdWdpbi5QbHVnaW5NYW5hZ2VyPWJ9KGQpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoYSl7dGhpcy5fbmFtZT1hLHRoaXMuX2lzSW5pdGlhbGl6ZWQ9ITEsdGhpcy5faXNEZXN0cm95ZWQ9ITEsdGhpcy5faXNFbmFibGVkPSEwLHRoaXMuX2RhdGFSZXNvbHZlcj17fSx0aGlzLl9sb2dUYWc9InBsdWdpbjo6Iit0aGlzLmdldE5hbWUoKSx0aGlzLl9sb2dnZXI9bmV3IGR9dmFyIGQ9YS5Mb2dnZXIsZT1hLlRyaWdnZXIsZj1hLkV2ZW50LGc9Yi5FcnJvckluZm87Yy5JTklUSUFMSVpFRD0iaW5pdGlhbGl6ZWQiLGMucHJvdG90eXBlLmNvbmZpZ3VyZT1mdW5jdGlvbihhKXt9LGMucHJvdG90eXBlLmJvb3RzdHJhcD1mdW5jdGlvbihhKXt0aGlzLl9wbHVnaW5NYW5hZ2VyPWEsdGhpcy5faXNEZXN0cm95ZWQmJnRoaXMuX3BsdWdpbk1hbmFnZXIucmFpc2UobmV3IGcoIkludmFsaWQgc3RhdGUuIiwiUGx1Z2luIGFscmVhZHkgZGVzdHJveWVkLiIpKX0sYy5wcm90b3R5cGUuc2V0dXA9ZnVuY3Rpb24oKXt0aGlzLl90cmlnZ2VyKGMuSU5JVElBTElaRUQpLHRoaXMuX2lzSW5pdGlhbGl6ZWQ9ITB9LGMucHJvdG90eXBlLmRlc3Ryb3k9ZnVuY3Rpb24oKXt0aGlzLl9pc0Rlc3Ryb3llZHx8KHRoaXMuX2lzRGVzdHJveWVkPSEwLHRoaXMuX3RlYXJkb3duKCkpfSxjLnByb3RvdHlwZS5lbmFibGU9ZnVuY3Rpb24oKXt0aGlzLl9pc0VuYWJsZWQ9ITAsdGhpcy5fZW5hYmxlZCgpfSxjLnByb3RvdHlwZS5kaXNhYmxlPWZ1bmN0aW9uKCl7dGhpcy5faXNFbmFibGVkPSExLHRoaXMuX2Rpc2FibGVkKCl9LGMucHJvdG90eXBlLmdldE5hbWU9ZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5fbmFtZX0sYy5wcm90b3R5cGUuZ2V0TG9nZ2VyPWZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMuX2xvZ2dlcn0sYy5wcm90b3R5cGUuaXNJbml0aWFsaXplZD1mdW5jdGlvbigpe3JldHVybiB0aGlzLl9pc0luaXRpYWxpemVkfSxjLnByb3RvdHlwZS5yZXNvbHZlRGF0YT1mdW5jdGlvbihhKXtpZighdGhpcy5faXNFbmFibGVkfHwhdGhpcy5faXNJbml0aWFsaXplZClyZXR1cm4gdGhpcy5fbG9nZ2VyLndhcm4odGhpcy5fbG9nVGFnLCJVbmFibGUgdG8gcmV0cmlldmUgcGx1Z2luIGRhdGEuIFBsdWdpbjogIit0aGlzLl9uYW1lKyIuIEVuYWJsZWQ6ICIrdGhpcy5faXNFbmFibGVkKyIuIEluaXRpYWxpemVkOiAiK3RoaXMuX2lzSW5pdGlhbGl6ZWQrIi4iKSxudWxsO2lmKCJmdW5jdGlvbiI9PXR5cGVvZiB0aGlzLl9kYXRhUmVzb2x2ZXIpcmV0dXJuIHRoaXMuX2RhdGFSZXNvbHZlci5jYWxsKHRoaXMsYSk7dmFyIGI9bnVsbDtpZihhKWZvcih2YXIgYz0wO2M8YS5sZW5ndGg7YysrKXt2YXIgZD1hW2NdO3RoaXMuX2RhdGFSZXNvbHZlci5oYXNPd25Qcm9wZXJ0eShkKSYmKGI9Ynx8e30sImZ1bmN0aW9uIj09dHlwZW9mIHRoaXMuX2RhdGFSZXNvbHZlcltkXT9iW2RdPXRoaXMuX2RhdGFSZXNvbHZlcltkXS5jYWxsKHRoaXMpOmJbZF09dGhpcy5fZGF0YVJlc29sdmVyW2RdKX1yZXR1cm4gYn0sYy5wcm90b3R5cGUudG9TdHJpbmc9ZnVuY3Rpb24oKXtyZXR1cm4iPHBsdWdpbjogIit0aGlzLl9uYW1lKyI+In0sYy5wcm90b3R5cGUuX2VuYWJsZWQ9ZnVuY3Rpb24oKXt9LGMucHJvdG90eXBlLl9kaXNhYmxlZD1mdW5jdGlvbigpe30sYy5wcm90b3R5cGUuX3RlYXJkb3duPWZ1bmN0aW9uKCl7fSxjLnByb3RvdHlwZS5fY2FuUHJvY2Vzcz1mdW5jdGlvbigpe3JldHVybiB0aGlzLl9pc0VuYWJsZWQ/IXRoaXMuX2lzRGVzdHJveWVkfHwodGhpcy5fbG9nZ2VyLmVycm9yKHRoaXMuX2xvZ1RhZywiUGx1Z2luIGRlc3Ryb3llZC4iKSwhMSk6KHRoaXMuX2xvZ2dlci5lcnJvcih0aGlzLl9sb2dUYWcsIlBsdWdpbiBkaXNhYmxlZC4iKSwhMSl9LGMucHJvdG90eXBlLl90cmlnZ2VyPWZ1bmN0aW9uKGEsYil7dmFyIGM9Zi5jcmVhdGVGcm9tVHJpZ2dlcihuZXcgZSh0aGlzLmdldE5hbWUoKSxhKSk7Yy5kYXRhPWIsdGhpcy5fcGx1Z2luTWFuYWdlci50cmlnZ2VyKGMpfSxhLnBsdWdpbi5CYXNlUGx1Z2luPWN9KGQsYyksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoYSxiLGMpe3RoaXMubmFtZT1hLHRoaXMuaW50ZXJ2YWw9Yix0aGlzLmlzQWN0aXZlPSExLHRoaXMucmVwZWF0Q291bnQ9dm9pZCAwIT09Yz9jOmUsdGhpcy5fbmV4dFRpY2tUaW1lc3RhbXA9MCx0aGlzLnJlc2V0KCl9ZnVuY3Rpb24gYyhhLGIpe2lmKCFhKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBDbG9ja1NlcnZpY2Ugb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7aWYodGhpcy5fc2VydmljZT1hLCFiKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBsb2dnZXIgb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7dGhpcy5fbG9nZ2VyPWIsdGhpcy5faXNEZXN0cm95ZWQ9ITEsdGhpcy5fdGltZXJzPXt9O3ZhciBjPXRoaXM7dGhpcy5fY2xvY2s9d2luZG93LnNldEludGVydmFsKGZ1bmN0aW9uKCl7Yy5fb25UaWNrKCl9LDFlMypmKX1iLnByb3RvdHlwZS5yZXNldD1mdW5jdGlvbigpe3RoaXMudGljaz0wLHRoaXMuX2NyZWF0ZWRUaW1lc3RhbXA9KG5ldyBEYXRlKS5nZXRUaW1lKCksdGhpcy5fdXBkYXRlTmV4dFRpY2tUaW1lc3RhbXAoKX0sYi5wcm90b3R5cGUuc2hvdWxkVGljaz1mdW5jdGlvbigpe3JldHVybihuZXcgRGF0ZSkuZ2V0VGltZSgpPnRoaXMuX25leHRUaWNrVGltZXN0YW1wLWcvMiYmKHRoaXMudGljaysrLHRoaXMuX3VwZGF0ZU5leHRUaWNrVGltZXN0YW1wKCksITApfSxiLnByb3RvdHlwZS5fdXBkYXRlTmV4dFRpY2tUaW1lc3RhbXA9ZnVuY3Rpb24oKXt2YXIgYT0obmV3IERhdGUpLmdldFRpbWUoKTt0aGlzLl9uZXh0VGlja1RpbWVzdGFtcD1hKzFlMyp0aGlzLmludGVydmFsLTF9LGMucHJvdG90eXBlLmNyZWF0ZVRpbWVyPWZ1bmN0aW9uKGEsYyxkKXt0aGlzLl90aW1lcnNbYV09bmV3IGIoYSxjLGQpfSxjLnByb3RvdHlwZS5kZXN0cm95VGltZXI9ZnVuY3Rpb24oYSl7ZGVsZXRlIHRoaXMuX3RpbWVyc1thXX0sYy5wcm90b3R5cGUucmVzdW1lVGltZXI9ZnVuY3Rpb24oYSxiKXtiPXZvaWQgMCE9PWImJmIsdGhpcy5fbG9nZ2VyLmRlYnVnKGQsIiNyZXN1bWVUaW1lcihuYW1lPSIrYSsiLCByZXNldD0iK2IrIikiKTt2YXIgYz10aGlzLl90aW1lcnNbYV07YyYmKGMuaXNBY3RpdmU9ITAsYiYmYy5yZXNldCgpKX0sYy5wcm90b3R5cGUucGF1c2VUaW1lcj1mdW5jdGlvbihhLGIpe2I9dm9pZCAwIT09YiYmYix0aGlzLl9sb2dnZXIuZGVidWcoZCwiI3BhdXNlVGltZXIobmFtZT0iK2ErIiwgcmVzZXQ9IitiKyIpIik7dmFyIGM9dGhpcy5fdGltZXJzW2FdO2MmJihjLmlzQWN0aXZlPSExLGImJmMucmVzZXQoKSl9LGMucHJvdG90eXBlLmlzVGltZXJQYXVzZWQ9ZnVuY3Rpb24oYSl7dmFyIGI9dGhpcy5fdGltZXJzW2FdO3JldHVybiEhYiYmIWIuaXNBY3RpdmV9LGMucHJvdG90eXBlLmRlc3Ryb3k9ZnVuY3Rpb24oKXt0aGlzLl9pc0Rlc3Ryb3llZHx8KHRoaXMuX2lzRGVzdHJveWVkPSEwLHRoaXMuX3RpbWVycz17fSx3aW5kb3cuY2xlYXJJbnRlcnZhbCh0aGlzLl9jbG9jaykpfSxjLnByb3RvdHlwZS5fb25UaWNrPWZ1bmN0aW9uKCl7Zm9yKHZhciBhIGluIHRoaXMuX3RpbWVycylpZih0aGlzLl90aW1lcnMuaGFzT3duUHJvcGVydHkoYSkpe3ZhciBiPXRoaXMuX3RpbWVyc1thXTtiLmlzQWN0aXZlJiZiLnNob3VsZFRpY2soKSYmKGIuaW50ZXJ2YWw+MSYmdGhpcy5fbG9nZ2VyLmRlYnVnKGQsIiNfb25UaWNrKCkgPiAiK2IubmFtZSsiKCIrYi50aWNrKyIgfCAiK2IucmVwZWF0Q291bnQrIikiKSwwIT1iLnJlcGVhdENvdW50Pyh0aGlzLl9zZXJ2aWNlLm9uVGljayhiLm5hbWUsYi5pbnRlcnZhbCxiLnRpY2spLGIucmVwZWF0Q291bnQhPWUmJmIucmVwZWF0Q291bnQtLSk6dGhpcy5kZXN0cm95VGltZXIoYi5uYW1lKSl9fTt2YXIgZD0ic2VydmljZS5jbG9jazo6VGltZXJNYW5hZ2VyIixlPS0xLGY9LjI1LGc9MWUzKmY7YS5jbG9jay5UaW1lckRlc2NyaXB0b3I9YixhLmNsb2NrLlRpbWVyTWFuYWdlcj1jfShlKSxmdW5jdGlvbihhLGIsYyl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGQoYSl7aWYoZC5fX3N1cGVyX18uY29uc3RydWN0b3IuY2FsbCh0aGlzLGgpLCFhKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBsb2dnZXIgb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7dGhpcy5fbG9nZ2VyPWEsdGhpcy5fdGltZXJNYW5hZ2VyPW5ldyBlKHRoaXMsdGhpcy5fbG9nZ2VyKSx0aGlzLl9zZXR1cERhdGFSZXNvbHZlcigpfXZhciBlPWMuY2xvY2suVGltZXJNYW5hZ2VyLGY9Yi5TdHJpbmdVdGlscyxnPWEucGx1Z2luLkJhc2VQbHVnaW47YS5leHRlbmQoZCxnKSxkLnByb3RvdHlwZS5ib290c3RyYXA9ZnVuY3Rpb24oYSl7ZC5fX3N1cGVyX18uYm9vdHN0cmFwLmNhbGwodGhpcyxhKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLmNvbXBseSh0aGlzLGksdGhpcy5fY21kQ3JlYXRlKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLmNvbXBseSh0aGlzLGssdGhpcy5fY21kUmVzdW1lKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLmNvbXBseSh0aGlzLGosdGhpcy5fY21kUGF1c2UpLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tcGx5KHRoaXMsbCx0aGlzLl9jbWREZXN0cm95KX0sZC5wcm90b3R5cGUuX3RlYXJkb3duPWZ1bmN0aW9uKCl7dGhpcy5fdGltZXJNYW5hZ2VyLmRlc3Ryb3koKX0sZC5wcm90b3R5cGUuX2NtZENyZWF0ZT1mdW5jdGlvbihhKXt2YXIgYj1hW29dfHxzO3RoaXMuX3RpbWVyTWFuYWdlci5jcmVhdGVUaW1lcihhW21dLGFbbl0sYil9LGQucHJvdG90eXBlLl9jbWRQYXVzZT1mdW5jdGlvbihhKXt0aGlzLl90aW1lck1hbmFnZXIucGF1c2VUaW1lcihhW21dLCEhYVtxXSl9LGQucHJvdG90eXBlLl9jbWRSZXN1bWU9ZnVuY3Rpb24oYSl7dGhpcy5fdGltZXJNYW5hZ2VyLnJlc3VtZVRpbWVyKGFbbV0sISFhW3FdKX0sZC5wcm90b3R5cGUuX2NtZERlc3Ryb3k9ZnVuY3Rpb24oYSl7dGhpcy5fdGltZXJNYW5hZ2VyLmRlc3Ryb3lUaW1lcihhW21dKX0sZC5wcm90b3R5cGUub25UaWNrPWZ1bmN0aW9uKGEsYixjKXthKz0iLnRpY2siO3ZhciBkPXt9O2RbbV09YSxkW25dPWIsZFtwXT1jLHRoaXMuX3RyaWdnZXIoYSxkKX0sZC5wcm90b3R5cGUuX3NldHVwRGF0YVJlc29sdmVyPWZ1bmN0aW9uKCl7dmFyIGE9e30sYj10aGlzLl90aW1lck1hbmFnZXI7YVtyXT1mdW5jdGlvbihhKXtyZXR1cm4gYi5pc1RpbWVyUGF1c2VkKGEpfSx0aGlzLl9kYXRhUmVzb2x2ZXI9ZnVuY3Rpb24oYil7aWYoIWJ8fDA9PWIubGVuZ3RoKXJldHVybiBudWxsO2Zvcih2YXIgYz1udWxsLGQ9MDtkPGIubGVuZ3RoO2QrKyl7dmFyIGU9YltkXTtpZihjPWN8fHt9LGYuc3RhcnRzV2l0aChlLHIpKXt2YXIgZz1lLnNwbGl0KHIrIi4iKTtnLmxlbmd0aD4wJiYoY1tlXT1hW3JdLmNhbGwodGhpcyxnWzFdKSl9fXJldHVybiBjfX07dmFyIGg9InNlcnZpY2UuY2xvY2siLGk9ImNyZWF0ZSIsaj0icGF1c2UiLGs9InJlc3VtZSIsbD0iZGVzdHJveSIsbT0ibmFtZSIsbj0iaW50ZXJ2YWwiLG89InJlcGVhdF9jb3VudCIscD0idGljayIscT0icmVzZXQiLHI9ImlzX3BhdXNlZCIscz0tMTtjLmNsb2NrLkNsb2NrU2VydmljZT1kfShkLGIsZSksZnVuY3Rpb24oYSxiLGMpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBkKGEsYil7aWYodGhpcy5fbG9nZ2VyPW5ldyBlLHRoaXMuX3BsdWdpbk1hbmFnZXI9bmV3IGYodGhpcy5fbG9nZ2VyKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLmFkZFBsdWdpbihuZXcgZyh0aGlzLl9sb2dnZXIpKSxiKWZvcih2YXIgYz0wO2M8Yi5sZW5ndGg7YysrKXRoaXMuX3BsdWdpbk1hbmFnZXIuYWRkUGx1Z2luKGJbY10pO3RoaXMuX3BsdWdpbk1hbmFnZXIuc2V0dXBQbHVnaW5zKCksdGhpcy5faXNEZXN0cm95ZWQ9ITF9dmFyIGU9YS5Mb2dnZXIsZj1hLnBsdWdpbi5QbHVnaW5NYW5hZ2VyLGc9Yi5jbG9jay5DbG9ja1NlcnZpY2U7ZC5wcm90b3R5cGUuY29uZmlndXJlPWZ1bmN0aW9uKGEpe2lmKCFhKXRocm93IG5ldyBFcnJvcigiQ29uZmlndXJhdGlvbiBvYmplY3QgY2Fubm90IGJlIE5VTEwuIik7YS5kZWJ1Z0xvZ2dpbmc/dGhpcy5fbG9nZ2VyLmVuYWJsZSgpOnRoaXMuX2xvZ2dlci5kaXNhYmxlKCksdGhpcy5faXNEZXN0cm95ZWQmJnRoaXMuX2xvZ2dlci5lcnJvcihoLCJJbnN0YW5jZSBpcyBkZXN0cm95ZWQuIil9LGQucHJvdG90eXBlLmRlc3Ryb3k9ZnVuY3Rpb24oKXt0aGlzLl9pc0Rlc3Ryb3llZHx8KHRoaXMuX3BsdWdpbk1hbmFnZXIuZGVzdHJveSgpLHRoaXMuX2lzRGVzdHJveWVkPSEwKX07dmFyIGg9IkhlYXJ0YmVhdCI7Yy5IZWFydGJlYXQ9ZH0oZCxlLGMpLGEuQURCfHwoYS5BREI9e30pLGEuQURCLmNvcmV8fChhLkFEQi5jb3JlPWQpLGEuQURCLnZhfHwoYS5BREIudmE9YyksYS5BREIudmEudXRpbHN8fChhLkFEQi52YS51dGlscz1iKSxhLkFEQi52YS5wbHVnaW5zfHwoYS5BREIudmEucGx1Z2lucz17fSl9KHRoaXMpO1xuXG4vLyBWaWRlb1BsYXllclBsdWdpblxuIWZ1bmN0aW9uKGEpe2lmKHZvaWQgMD09PWIpdmFyIGI9e307IWZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0Ijt2YXIgYj17fTtiLkFTU0VUX1RZUEVfVk9EPSJ2b2QiLGIuQVNTRVRfVFlQRV9MSVZFPSJsaXZlIixiLkFTU0VUX1RZUEVfTElORUFSPSJsaW5lYXIiLGEuQXNzZXRUeXBlPWJ9KGIpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKCl7dGhpcy5wbGF5ZXJOYW1lPW51bGwsdGhpcy5uYW1lPW51bGwsdGhpcy5wb3NpdGlvbj1udWxsLHRoaXMuc3RhcnRUaW1lPW51bGx9Yi5wcm90b3R5cGUudG9TdHJpbmc9ZnVuY3Rpb24oKXtyZXR1cm4icGxheWVyTmFtZT0iK3RoaXMucGxheWVyTmFtZSsiLCBuYW1lPSIrdGhpcy5uYW1lKyIsIHBvc2l0aW9uPSIrdGhpcy5wb3NpdGlvbisiLCBzdGFydFRpbWU9Iit0aGlzLnN0YXJ0VGltZX0sYS5BZEJyZWFrSW5mbz1ifShiKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYigpe3RoaXMuaWQ9bnVsbCx0aGlzLm5hbWU9bnVsbCx0aGlzLmxlbmd0aD1udWxsLHRoaXMucG9zaXRpb249bnVsbCx0aGlzLmdyYW51bGFyVHJhY2tpbmc9ITB9Yi5wcm90b3R5cGUudG9TdHJpbmc9ZnVuY3Rpb24oKXtyZXR1cm4iaWQ9Iit0aGlzLmlkKyIsIG5hbWU9Iit0aGlzLm5hbWUrIiwgbGVuZ3RoPSIrdGhpcy5sZW5ndGgrIiwgcG9zaXRpb249Iit0aGlzLnBvc2l0aW9uKyIsIGdyYW51bGFyVHJhY2tpbmc9Iit0aGlzLmdyYW51bGFyVHJhY2tpbmd9LGEuQWRJbmZvPWJ9KGIpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKCl7dGhpcy5uYW1lPW51bGwsdGhpcy5sZW5ndGg9bnVsbCx0aGlzLnBvc2l0aW9uPW51bGwsdGhpcy5zdGFydFRpbWU9bnVsbH1iLnByb3RvdHlwZS50b1N0cmluZz1mdW5jdGlvbigpe3JldHVybiJuYW1lPSIrdGhpcy5uYW1lKyIsIGxlbmd0aD0iK3RoaXMubGVuZ3RoKyIsIHBvc2l0aW9uPSIrdGhpcy5wb3NpdGlvbisiLCBzdGFydFRpbWU9Iit0aGlzLnN0YXJ0VGltZX0sYS5DaGFwdGVySW5mbz1ifShiKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYigpe3RoaXMuYml0cmF0ZT1udWxsLHRoaXMuZnBzPW51bGwsdGhpcy5kcm9wcGVkRnJhbWVzPW51bGwsdGhpcy5zdGFydHVwVGltZT1udWxsfWIucHJvdG90eXBlLnRvU3RyaW5nPWZ1bmN0aW9uKCl7cmV0dXJuImJpdHJhdGU9Iit0aGlzLmJpdHJhdGUrIiwgZnBzPSIrdGhpcy5mcHMrIiwgZHJvcHBlZEZyYW1lcz0iK3RoaXMuZHJvcHBlZEZyYW1lcysiLCBzdGFydHVwVGltZT0iK3RoaXMuc3RhcnR1cFRpbWV9LGEuUW9TSW5mbz1ifShiKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYigpe3RoaXMucGxheWVyTmFtZT1udWxsLHRoaXMuaWQ9bnVsbCx0aGlzLm5hbWU9bnVsbCx0aGlzLmxlbmd0aD1udWxsLHRoaXMucGxheWhlYWQ9bnVsbCx0aGlzLm1lZGlhVHlwZT1udWxsLHRoaXMuc3RyZWFtVHlwZT1udWxsLHRoaXMucmVzdW1lZD0hMX1iLnByb3RvdHlwZS50b1N0cmluZz1mdW5jdGlvbigpe3JldHVybiJwbGF5ZXJOYW1lPSIrdGhpcy5wbGF5ZXJOYW1lKyIsIGlkPSIrdGhpcy5pZCsiLCBuYW1lPSIrdGhpcy5uYW1lKyIsIGxlbmd0aD0iK3RoaXMubGVuZ3RoKyIsIHBsYXloZWFkPSIrdGhpcy5wbGF5aGVhZCsiLCBtZWRpYVR5cGU9Iit0aGlzLm1lZGlhVHlwZSsiLCBzdHJlYW1UeXBlPSIrdGhpcy5zdHJlYW1UeXBlKyIsIHJlc3VtZWQ9Iit0aGlzLnJlc3VtZWR9LGEuVmlkZW9JbmZvPWJ9KGIpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKCl7dGhpcy5kZWJ1Z0xvZ2dpbmc9ITF9YS5WaWRlb1BsYXllclBsdWdpbkNvbmZpZz1ifShiKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYigpe31iLnByb3RvdHlwZS5nZXRWaWRlb0luZm89ZnVuY3Rpb24oKXt0aHJvdyBuZXcgRXJyb3IoIkltcGxlbWVudGF0aW9uIGVycm9yOiBNZXRob2QgbXVzdCBiZSBvdmVycmlkZGVuLiIpfSxiLnByb3RvdHlwZS5nZXRBZEJyZWFrSW5mbz1mdW5jdGlvbigpe3JldHVybiBudWxsfSxiLnByb3RvdHlwZS5nZXRBZEluZm89ZnVuY3Rpb24oKXtyZXR1cm4gbnVsbH0sYi5wcm90b3R5cGUuZ2V0Q2hhcHRlckluZm89ZnVuY3Rpb24oKXtyZXR1cm4gbnVsbH0sYi5wcm90b3R5cGUuZ2V0UW9TSW5mbz1mdW5jdGlvbigpe3JldHVybiBudWxsfSxhLlZpZGVvUGxheWVyUGx1Z2luRGVsZWdhdGU9Yn0oYiksZnVuY3Rpb24oYSxiKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYyhhKXtpZihjLl9fc3VwZXJfXy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMsaCksIWEpdGhyb3cgbmV3IEVycm9yKCJQbGF5ZXJQbHVnaW4gZGVsZWdhdGUgY2Fubm90IGJlIE5VTEwuIik7dGhpcy5fZGVsZWdhdGU9YSx0aGlzLl9pc1RyYWNraW5nU2Vzc2lvbkFjdGl2ZT0hMSx0aGlzLl9pc1RyYWNraW5nU2Vzc2lvblN0YXJ0ZWQ9ITEsdGhpcy5fc2V0dXBEYXRhUmVzb2x2ZXIoKX12YXIgZD1hLnBsdWdpbi5QYXJhbU1hcHBpbmcsZT1hLlRyaWdnZXIsZj1hLnBsdWdpbi5CYXNlUGx1Z2luLGc9Yi5WaWRlb1BsYXllclBsdWdpbkNvbmZpZzthLmV4dGVuZChjLGYpLGMucHJvdG90eXBlLmNvbmZpZ3VyZT1mdW5jdGlvbihhKXtpZighYSl0aHJvdyBuZXcgRXJyb3IoIlJlZmVyZW5jZSB0byB0aGUgY29uZmlndXJhdGlvbiBkYXRhIGNhbm5vdCBiZSBOVUxMLiIpO2lmKCEoYSBpbnN0YW5jZW9mIGcpKXRocm93IG5ldyBFcnJvcigiRXhwZWN0ZWQgY29uZmlnIGRhdGEgdG8gYmUgaW5zdGFuY2Ugb2YgVmlkZW9QbGF5ZXJQbHVnaW5Db25maWcuIik7YS5kZWJ1Z0xvZ2dpbmc/dGhpcy5fbG9nZ2VyLmVuYWJsZSgpOnRoaXMuX2xvZ2dlci5kaXNhYmxlKCksdGhpcy5fbG9nZ2VyLmRlYnVnKHRoaXMuX2xvZ1RhZywiI2NvbmZpZ3VyZShkZWJ1Z0xvZ2dpbmc9IithLmRlYnVnTG9nZ2luZysiKSIpfSxjLnByb3RvdHlwZS5ib290c3RyYXA9ZnVuY3Rpb24oYSl7Yy5fX3N1cGVyX18uYm9vdHN0cmFwLmNhbGwodGhpcyxhKSx0aGlzLl9yZWdpc3RlckNvbW1hbmRzKCksdGhpcy5fcmVnaXN0ZXJCZWhhdmlvdXJzKCl9LGMucHJvdG90eXBlLl9jbWRWaWRlb0lkbGVTdGFydD1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiNfY21kVmlkZW9JZGxlU3RhcnQoKSIpLHRoaXMuX3ZpZGVvSWRsZT0hMH0sYy5wcm90b3R5cGUuX2NtZFZpZGVvSWRsZVJlc3VtZT1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiNfY21kVmlkZW9JZGxlUmVzdW1lKCkiKSx0aGlzLl92aWRlb0lkbGUmJih0aGlzLl90cmlnZ2VyKHApLHRoaXMuX3RyaWdnZXIocSksYS5pc0luQWQmJih0aGlzLl90cmlnZ2VyKHgpLHRoaXMuX2lzVHJhY2tpbmdBZEJyZWFrPSEwKSxhLmlzSW5BZCYmKHRoaXMuX3RyaWdnZXIoeiksdGhpcy5faXNUcmFja2luZ0FkPSEwKSxhLmlzSW5DaGFwdGVyJiZ0aGlzLl90cmlnZ2VyKEcpLHRoaXMuX3RyaWdnZXIodSkpLHRoaXMuX3ZpZGVvSWRsZT0hMX0sYy5wcm90b3R5cGUudHJhY2tTZXNzaW9uU3RhcnQ9ZnVuY3Rpb24oKXtpZih0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja1Nlc3Npb25TdGFydCgpIiksdGhpcy5fY2FuUHJvY2VzcygpKXtpZighdGhpcy5faXNUcmFja2luZ1Nlc3Npb25BY3RpdmUpcmV0dXJuIHZvaWQgdGhpcy5fbG9nZ2VyLndhcm4odGhpcy5fbG9nVGFnLCIjdHJhY2tTZXNzaW9uU3RhcnQoKSA+IE5vIGFjdGl2ZSB0cmFja2luZyBzZXNzaW9uLiIpO2lmKHRoaXMuX2lzVHJhY2tpbmdTZXNzaW9uU3RhcnRlZClyZXR1cm4gdm9pZCB0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja1Nlc3Npb25TdGFydCgpID4gVHJhY2tpbmcgc2Vzc2lvbiBhbHJlYWR5IHN0YXJ0ZWQuIik7dGhpcy5fdHJpZ2dlcihwKSx0aGlzLl9pc1RyYWNraW5nU2Vzc2lvblN0YXJ0ZWQ9ITA7dmFyIGE9dGhpcy5fZGF0YVJlc29sdmVyKFsidmlkZW8ucmVzdW1lZCJdKTthLmhhc093blByb3BlcnR5KCJ2aWRlby5yZXN1bWVkIikmJmFbInZpZGVvLnJlc3VtZWQiXSYmdGhpcy5fdHJpZ2dlcihxKX19LGMucHJvdG90eXBlLnRyYWNrVmlkZW9Mb2FkPWZ1bmN0aW9uKCl7dGhpcy5fbG9nZ2VyLmluZm8odGhpcy5fbG9nVGFnLCIjdHJhY2tWaWRlb0xvYWQoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmKHRoaXMuX2lzVHJhY2tpbmdBZEJyZWFrPSExLHRoaXMuX2lzVHJhY2tpbmdBZD0hMSx0aGlzLl9jb250ZW50U3RhcnRlZD0hMSx0aGlzLl9pc1BhdXNlZD0hMCx0aGlzLl9pc0J1ZmZlcmluZz0hMSx0aGlzLl9pc1NlZWtpbmc9ITEsdGhpcy5fcGxheWhlYWRUaW1lcj1udWxsLHRoaXMuX3ByZXZpb3VzUGxheWhlYWQ9LTEsdGhpcy5fc3RhbGxlZFBsYXloZWFkQ291bnQ9MCx0aGlzLl9wbGF5aGVhZFN0YWxsZWQ9ITEsdGhpcy5fdmlkZW9JZGxlPSExLHRoaXMuX3RyaWdnZXIobSksdGhpcy5faXNUcmFja2luZ1Nlc3Npb25BY3RpdmU9ITAsdGhpcy5faXNUcmFja2luZ1Nlc3Npb25TdGFydGVkPSExKX0sYy5wcm90b3R5cGUudHJhY2tWaWRlb1VubG9hZD1mdW5jdGlvbigpe2lmKHRoaXMuX2xvZ2dlci5pbmZvKHRoaXMuX2xvZ1RhZywiI3RyYWNrVmlkZW9VbmxvYWQoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSl7aWYoIXRoaXMuX2lzVHJhY2tpbmdTZXNzaW9uQWN0aXZlKXJldHVybiB2b2lkIHRoaXMuX2xvZ2dlci53YXJuKHRoaXMuX2xvZ1RhZywiI3RyYWNrVmlkZW9VbmxvYWQoKSA+IE5vIGFjdGl2ZSB0cmFja2luZyBzZXNzaW9uLiIpO3RoaXMuX3N0b3BQbGF5aGVhZFRpbWVyKCksdGhpcy5fdHJpZ2dlcihuKSx0aGlzLl9pc1RyYWNraW5nU2Vzc2lvbkFjdGl2ZT0hMSx0aGlzLl9pc1RyYWNraW5nU2Vzc2lvblN0YXJ0ZWQ9ITEsdGhpcy5fY29udGVudFN0YXJ0ZWQ9ITF9fSxjLnByb3RvdHlwZS50cmFja1BsYXk9ZnVuY3Rpb24oKXt0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja1BsYXkoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fc3RhcnRTZXNzaW9uSWZOZWVkZWQoInRyYWNrUGxheSIpJiZ0aGlzLl9hbGxvd1BsYXllclN0YXRlQ2hhbmdlKCkmJih0aGlzLl9pc1BhdXNlZD0hMSx0aGlzLl90cmlnZ2VyKHUpLHRoaXMuX3N0YXJ0UGxheWhlYWRUaW1lcigpKX0sYy5wcm90b3R5cGUudHJhY2tQYXVzZT1mdW5jdGlvbigpe2lmKHRoaXMuX2xvZ2dlci5pbmZvKHRoaXMuX2xvZ1RhZywiI3RyYWNrUGF1c2UoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fc3RhcnRTZXNzaW9uSWZOZWVkZWQoInRyYWNrUGF1c2UiKSYmdGhpcy5fYWxsb3dQbGF5ZXJTdGF0ZUNoYW5nZSgpKXt0aGlzLl9zdG9wUGxheWhlYWRUaW1lcigpO3ZhciBhPXt9O2FbT109ITEsdGhpcy5faXNQYXVzZWQ9ITAsdGhpcy5fdHJpZ2dlcih2LGEpfX0sYy5wcm90b3R5cGUudHJhY2tCdWZmZXJTdGFydD1mdW5jdGlvbigpe3RoaXMuX2xvZ2dlci5pbmZvKHRoaXMuX2xvZ1RhZywiI3RyYWNrQnVmZmVyU3RhcnQoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fc3RhcnRTZXNzaW9uSWZOZWVkZWQoInRyYWNrQnVmZmVyU3RhcnQiKSYmdGhpcy5fYWxsb3dQbGF5ZXJTdGF0ZUNoYW5nZSgpJiYodGhpcy5fc3RvcFBsYXloZWFkVGltZXIoKSx0aGlzLl9pc0J1ZmZlcmluZz0hMCx0aGlzLl90cmlnZ2VyKEMpKX0sYy5wcm90b3R5cGUudHJhY2tCdWZmZXJDb21wbGV0ZT1mdW5jdGlvbigpe3RoaXMuX2xvZ2dlci5pbmZvKHRoaXMuX2xvZ1RhZywiI3RyYWNrQnVmZmVyQ29tcGxldGUoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fc3RhcnRTZXNzaW9uSWZOZWVkZWQoInRyYWNrQnVmZmVyQ29tcGxldGUiKSYmdGhpcy5fYWxsb3dQbGF5ZXJTdGF0ZUNoYW5nZSgpJiYodGhpcy5faXNCdWZmZXJpbmc9ITEsdGhpcy5fdHJpZ2dlcihEKSx0aGlzLl9zdGFydFBsYXloZWFkVGltZXIoKSl9LGMucHJvdG90eXBlLnRyYWNrU2Vla1N0YXJ0PWZ1bmN0aW9uKCl7dGhpcy5fbG9nZ2VyLmluZm8odGhpcy5fbG9nVGFnLCIjdHJhY2tTZWVrU3RhcnQoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fc3RhcnRTZXNzaW9uSWZOZWVkZWQoInRyYWNrU2Vla1N0YXJ0IikmJnRoaXMuX2FsbG93UGxheWVyU3RhdGVDaGFuZ2UoKSYmKHRoaXMuX3N0b3BQbGF5aGVhZFRpbWVyKCksdGhpcy5faXNTZWVraW5nPSEwLHRoaXMuX3RyaWdnZXIoRSkpfSxjLnByb3RvdHlwZS50cmFja1NlZWtDb21wbGV0ZT1mdW5jdGlvbigpe3RoaXMuX2xvZ2dlci5pbmZvKHRoaXMuX2xvZ1RhZywiI3RyYWNrU2Vla0NvbXBsZXRlKCkiKSx0aGlzLl9jYW5Qcm9jZXNzKCkmJnRoaXMuX3N0YXJ0U2Vzc2lvbklmTmVlZGVkKCJ0cmFja1NlZWtDb21wbGV0ZSIpJiZ0aGlzLl9hbGxvd1BsYXllclN0YXRlQ2hhbmdlKCkmJih0aGlzLl9pc1NlZWtpbmc9ITEsdGhpcy5fdHJpZ2dlcihGKSx0aGlzLl9zdGFydFBsYXloZWFkVGltZXIoKSl9LGMucHJvdG90eXBlLnRyYWNrQ29tcGxldGU9ZnVuY3Rpb24oYSxiKXtpZih0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja0NvbXBsZXRlKCkiKSx0aGlzLl9jYW5Qcm9jZXNzKCkmJnRoaXMuX3N0YXJ0U2Vzc2lvbklmTmVlZGVkKCJ0cmFja0NvbXBsZXRlIikpe2lmKHRoaXMuX3N0b3BQbGF5aGVhZFRpbWVyKCksdGhpcy5fdmlkZW9JZGxlKXJldHVybiB0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja0NvbXBsZXRlKCkgPiBWaWRlbyBzZXNzaW9uIGlzIGFscmVhZHkgaW4gSWRsZSBTdGF0ZS4iKSx2b2lkKGEmJmEoKSk7dmFyIGM9e307Y1tOXT1hLGI9dm9pZCAwPT09Ynx8ISFiLGI/dGhpcy5fdHJpZ2dlcihyLGMpOih0aGlzLl90cmlnZ2VyKHMpLHRoaXMuX3RyaWdnZXIobyxjKSl9fSxjLnByb3RvdHlwZS50cmFja1RpbWVkTWV0YWRhdGE9ZnVuY3Rpb24oYSl7dGhpcy5fbG9nZ2VyLmluZm8odGhpcy5fbG9nVGFnLCIjdHJhY2tDb21wbGV0ZSgpIiksdGhpcy5fY2FuUHJvY2VzcygpJiZ0aGlzLl9zdGFydFNlc3Npb25JZk5lZWRlZCgidHJhY2tUaW1lZE1ldGFkYXRhIikmJnRoaXMuX3RyaWdnZXIodCxhKX0sYy5wcm90b3R5cGUudHJhY2tDaGFwdGVyU3RhcnQ9ZnVuY3Rpb24oKXt0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja0NoYXB0ZXJTdGFydCgpIiksdGhpcy5fY2FuUHJvY2VzcygpJiZ0aGlzLl9zdGFydFNlc3Npb25JZk5lZWRlZCgiI3RyYWNrQ2hhcHRlclN0YXJ0IikmJnRoaXMuX3RyaWdnZXIoRyl9LGMucHJvdG90eXBlLnRyYWNrQ2hhcHRlckNvbXBsZXRlPWZ1bmN0aW9uKCl7dGhpcy5fbG9nZ2VyLmluZm8odGhpcy5fbG9nVGFnLCIjdHJhY2tDaGFwdGVyQ29tcGxldGUoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fc3RhcnRTZXNzaW9uSWZOZWVkZWQoInRyYWNrQ2hhcHRlckNvbXBsZXRlIikmJnRoaXMuX3RyaWdnZXIoSCl9LGMucHJvdG90eXBlLnRyYWNrQ2hhcHRlclNraXA9ZnVuY3Rpb24oKXt0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja0NoYXB0ZXJTa2lwKCkiKSx0aGlzLl9jYW5Qcm9jZXNzKCkmJnRoaXMuX3N0YXJ0U2Vzc2lvbklmTmVlZGVkKCJ0cmFja0NoYXB0ZXJTa2lwIikmJnRoaXMuX3RyaWdnZXIoSSl9LGMucHJvdG90eXBlLnRyYWNrQWRCcmVha1N0YXJ0PWZ1bmN0aW9uKCl7dGhpcy5fbG9nZ2VyLmluZm8odGhpcy5fbG9nVGFnLCIjdHJhY2tBZEJyZWFrU3RhcnQoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fc3RhcnRTZXNzaW9uSWZOZWVkZWQoInRyYWNrQWRCcmVha1N0YXJ0IikmJih0aGlzLl90cmlnZ2VyKHgpLHRoaXMuX2lzVHJhY2tpbmdBZEJyZWFrPSEwKX0sYy5wcm90b3R5cGUudHJhY2tBZEJyZWFrQ29tcGxldGU9ZnVuY3Rpb24oKXt0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja0FkQnJlYWtDb21wbGV0ZSgpIiksdGhpcy5fY2FuUHJvY2VzcygpJiZ0aGlzLl9zdGFydFNlc3Npb25JZk5lZWRlZCgidHJhY2tBZEJyZWFrQ29tcGxldGUiKSYmKHRoaXMuX3RyaWdnZXIoeSksdGhpcy5faXNUcmFja2luZ0FkQnJlYWs9ITEpfSxjLnByb3RvdHlwZS50cmFja0FkU3RhcnQ9ZnVuY3Rpb24oKXt0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja0FkU3RhcnQoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fc3RhcnRTZXNzaW9uSWZOZWVkZWQoInRyYWNrQWRTdGFydCIpJiYodGhpcy5fdHJpZ2dlcih6KSx0aGlzLl9pc1RyYWNraW5nQWQ9ITApfSxjLnByb3RvdHlwZS50cmFja0FkQ29tcGxldGU9ZnVuY3Rpb24oKXt0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja0FkQ29tcGxldGUoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fc3RhcnRTZXNzaW9uSWZOZWVkZWQoInRyYWNrQWRDb21wbGV0ZSIpJiYodGhpcy5fdHJpZ2dlcihBKSx0aGlzLl9pc1RyYWNraW5nQWQ9ITEpfSxjLnByb3RvdHlwZS50cmFja0FkU2tpcD1mdW5jdGlvbigpe3RoaXMuX2xvZ2dlci5pbmZvKHRoaXMuX2xvZ1RhZywiI3RyYWNrQWRTa2lwKCkiKSx0aGlzLl9jYW5Qcm9jZXNzKCkmJnRoaXMuX3N0YXJ0U2Vzc2lvbklmTmVlZGVkKCJ0cmFja0FkU2tpcCIpJiYodGhpcy5fdHJpZ2dlcihCKSx0aGlzLl9pc1RyYWNraW5nQWQ9ITEpfSxjLnByb3RvdHlwZS50cmFja0JpdHJhdGVDaGFuZ2U9ZnVuY3Rpb24oKXt0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja0JpdHJhdGVDaGFuZ2UoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fc3RhcnRTZXNzaW9uSWZOZWVkZWQoInRyYWNrQml0cmF0ZUNoYW5nZSIpJiZ0aGlzLl90cmlnZ2VyKEopfSxjLnByb3RvdHlwZS50cmFja1ZpZGVvUGxheWVyRXJyb3I9ZnVuY3Rpb24oYSl7aWYodGhpcy5fbG9nZ2VyLmluZm8odGhpcy5fbG9nVGFnLCIjdHJhY2tWaWRlb1BsYXllckVycm9yKGVycm9ySWQ9IithKyIpIiksdGhpcy5fc3RhcnRTZXNzaW9uSWZOZWVkZWQoInRyYWNrVmlkZW9QbGF5ZXJFcnJvciIpKXt2YXIgYj17fTtiW1BdPWwsYltRXT1hLHRoaXMuX3RyaWdnZXIoSyxiKX19LGMucHJvdG90eXBlLnRyYWNrQXBwbGljYXRpb25FcnJvcj1mdW5jdGlvbihhKXtpZih0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiN0cmFja0FwcGxpY2F0aW9uRXJyb3IoZXJyb3JJZD0iK2ErIikiKSx0aGlzLl9zdGFydFNlc3Npb25JZk5lZWRlZCgidHJhY2tBcHBsaWNhdGlvbkVycm9yIikpe3ZhciBiPXt9O2JbUF09ayxiW1FdPWEsdGhpcy5fdHJpZ2dlcihLLGIpfX0sYy5wcm90b3R5cGUuX3JlZ2lzdGVyQ29tbWFuZHM9ZnVuY3Rpb24oKXt0aGlzLl9wbHVnaW5NYW5hZ2VyLmNvbXBseSh0aGlzLCJoYW5kbGVWaWRlb0lkbGVTdGFydCIsdGhpcy5fY21kVmlkZW9JZGxlU3RhcnQpLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tcGx5KHRoaXMsImhhbmRsZVZpZGVvSWRsZVJlc3VtZSIsdGhpcy5fY21kVmlkZW9JZGxlUmVzdW1lKX0sYy5wcm90b3R5cGUuX3JlZ2lzdGVyQmVoYXZpb3Vycz1mdW5jdGlvbigpe3RoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGUoaixMKSx0aGlzLCJoYW5kbGVWaWRlb0lkbGVTdGFydCIpLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGUoaixNKSx0aGlzLCJoYW5kbGVWaWRlb0lkbGVSZXN1bWUiLFtuZXcgZChpLCJhZC5pc0luQWRCcmVhayIsImlzSW5BZEJyZWFrIiksbmV3IGQoaSwiYWQuaXNJbkFkIiwiaXNJbkFkIiksbmV3IGQoaSwiY2hhcHRlci5pc0luQ2hhcHRlciIsImlzSW5DaGFwdGVyIildKX0sYy5wcm90b3R5cGUuX3NldHVwRGF0YVJlc29sdmVyPWZ1bmN0aW9uKCl7ZnVuY3Rpb24gYSgpe3JldHVybiBnLnZpZGVvP2cudmlkZW86KGcudmlkZW89aC5fZGVsZWdhdGUuZ2V0VmlkZW9JbmZvKCksaC5fbG9nZ2VyLmluZm8oaC5fbG9nVGFnLCJEYXRhIGZyb20gZGVsZWdhdGUgPiBWaWRlb0luZm86ICIrZy52aWRlbyksZy52aWRlbyl9ZnVuY3Rpb24gYigpe3JldHVybiBnLmFkP2cuYWQ6KGcuYWQ9aC5fZGVsZWdhdGUuZ2V0QWRJbmZvKCksaC5fbG9nZ2VyLmluZm8oaC5fbG9nVGFnLCJEYXRhIGZyb20gZGVsZWdhdGUgPiBBZEluZm86ICIrZy5hZCksZy5hZCl9ZnVuY3Rpb24gYygpe3JldHVybiBnLnBvZD9nLnBvZDooZy5wb2Q9aC5fZGVsZWdhdGUuZ2V0QWRCcmVha0luZm8oKSxoLl9sb2dnZXIuaW5mbyhoLl9sb2dUYWcsIkRhdGEgZnJvbSBkZWxlZ2F0ZSA+IEFkQnJlYWtJbmZvOiAiK2cucG9kKSxnLnBvZCl9ZnVuY3Rpb24gZCgpe3JldHVybiBnLmNoYXB0ZXI/Zy5jaGFwdGVyOihnLmNoYXB0ZXI9aC5fZGVsZWdhdGUuZ2V0Q2hhcHRlckluZm8oKSxoLl9sb2dnZXIuaW5mbyhoLl9sb2dUYWcsIkRhdGEgZnJvbSBkZWxlZ2F0ZSA+IENoYXB0ZXJJbmZvOiAiK2cuY2hhcHRlciksZy5jaGFwdGVyKX1mdW5jdGlvbiBlKCl7cmV0dXJuIGcucW9zP2cucW9zOihnLnFvcz1oLl9kZWxlZ2F0ZS5nZXRRb1NJbmZvKCksaC5fbG9nZ2VyLmluZm8oaC5fbG9nVGFnLCJEYXRhIGZyb20gZGVsZWdhdGUgPiBRb1NJbmZvOiAiK2cucW9zKSxnLnFvcyl9dmFyIGY9e30sZz17fSxoPXRoaXM7ZlsidmlkZW8uaWQiXT1mdW5jdGlvbigpe3ZhciBiPWEoKSxjPWI/Yi5pZDpudWxsO3JldHVybiBoLl9sb2dnZXIuZGVidWcoaC5fbG9nVGFnLCJSZXNvbHZpbmcgdmlkZW8uaWQ6ICIrYyksY30sZlsidmlkZW8ubmFtZSJdPWZ1bmN0aW9uKCl7dmFyIGI9YSgpLGM9Yj9iLm5hbWU6bnVsbDtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIHZpZGVvLm5hbWU6ICIrYyksY30sZlsidmlkZW8ubGVuZ3RoIl09ZnVuY3Rpb24oKXt2YXIgYj1hKCksYz1iP2IubGVuZ3RoOk5hTjtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIHZpZGVvLmxlbmd0aDogIitjKSxjfSxmWyJ2aWRlby5wbGF5ZXJOYW1lIl09ZnVuY3Rpb24oKXt2YXIgYj1hKCksYz1iP2IucGxheWVyTmFtZTpudWxsO3JldHVybiBoLl9sb2dnZXIuZGVidWcoaC5fbG9nVGFnLCJSZXNvbHZpbmcgdmlkZW8ucGxheWVyTmFtZTogIitjKSxjfSxmWyJ2aWRlby5tZWRpYVR5cGUiXT1mdW5jdGlvbigpe3ZhciBiPWEoKSxjPWI/Yi5tZWRpYVR5cGU6bnVsbDtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIHZpZGVvLm1lZGlhVHlwZTogIitjKSxjfSxmWyJ2aWRlby5zdHJlYW1UeXBlIl09ZnVuY3Rpb24oKXt2YXIgYj1hKCksYz1iP2Iuc3RyZWFtVHlwZTpudWxsO3JldHVybiBoLl9sb2dnZXIuZGVidWcoaC5fbG9nVGFnLCJSZXNvbHZpbmcgdmlkZW8uc3RyZWFtVHlwZTogIitjKSxjfSxmWyJ2aWRlby5wbGF5aGVhZCJdPWZ1bmN0aW9uKCl7dmFyIGI9YSgpLGM9Yj9iLnBsYXloZWFkOk5hTjtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIHZpZGVvLnBsYXloZWFkOiAiK2MpLGN9LGZbInZpZGVvLnJlc3VtZWQiXT1mdW5jdGlvbigpe3ZhciBiPWEoKSxjPSEhYiYmYi5yZXN1bWVkO3JldHVybiBoLl9sb2dnZXIuZGVidWcoaC5fbG9nVGFnLCJSZXNvbHZpbmcgdmlkZW8ucmVzdW1lZDogIitjKSxjfSxmWyJ2aWRlby5wbGF5aGVhZFN0YWxsZWQiXT1mdW5jdGlvbigpe3JldHVybiB0aGlzLl9wbGF5aGVhZFN0YWxsZWR9LGZbInBvZC5uYW1lIl09ZnVuY3Rpb24oKXt2YXIgYT1jKCksYj1hP2EubmFtZTpudWxsO3JldHVybiBoLl9sb2dnZXIuZGVidWcoaC5fbG9nVGFnLCJSZXNvbHZpbmcgcG9kLm5hbWU6ICIrYiksYn0sZlsicG9kLnBsYXllck5hbWUiXT1mdW5jdGlvbigpe3ZhciBhPWMoKSxiPWE/YS5wbGF5ZXJOYW1lOm51bGw7cmV0dXJuIGguX2xvZ2dlci5kZWJ1ZyhoLl9sb2dUYWcsIlJlc29sdmluZyBwb2QucGxheWVyTmFtZTogIitiKSxifSxmWyJwb2QucG9zaXRpb24iXT1mdW5jdGlvbigpe3ZhciBhPWMoKSxiPWE/YS5wb3NpdGlvbjpOYU47cmV0dXJuIGguX2xvZ2dlci5kZWJ1ZyhoLl9sb2dUYWcsIlJlc29sdmluZyBwb2QucG9zaXRpb246ICIrYiksYn0sZlsicG9kLnN0YXJ0VGltZSJdPWZ1bmN0aW9uKCl7dmFyIGE9YygpLGI9YT9hLnN0YXJ0VGltZTpOYU47cmV0dXJuIGguX2xvZ2dlci5kZWJ1ZyhoLl9sb2dUYWcsIlJlc29sdmluZyBwb2Quc3RhcnRUaW1lOiAiK2IpLGJ9LGZbImFkLmlzSW5BZCJdPWZ1bmN0aW9uKCl7dmFyIGE9YigpLGM9bnVsbCE9YTtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIGFkLmlzSW5BZDogIitjKSxjfSxmWyJhZC5pc0luQWRCcmVhayJdPWZ1bmN0aW9uKCl7dmFyIGE9YygpLGI9bnVsbCE9YTtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIGFkLmlzSW5BZEJyZWFrOiAiK2IpLGJ9LGZbImFkLmlkIl09ZnVuY3Rpb24oKXt2YXIgYT1iKCksYz1hP2EuaWQ6bnVsbDtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIGFkLmlkOiAiK2MpLGN9LGZbImFkLm5hbWUiXT1mdW5jdGlvbigpe3ZhciBhPWIoKSxjPWE/YS5uYW1lOm51bGw7cmV0dXJuIGguX2xvZ2dlci5kZWJ1ZyhoLl9sb2dUYWcsIlJlc29sdmluZyBhZC5uYW1lOiAiK2MpLGN9LGZbImFkLmxlbmd0aCJdPWZ1bmN0aW9uKCl7dmFyIGE9YigpLGM9YT9hLmxlbmd0aDpOYU47cmV0dXJuIGguX2xvZ2dlci5kZWJ1ZyhoLl9sb2dUYWcsIlJlc29sdmluZyBhZC5sZW5ndGg6ICIrYyksY30sZlsiYWQucG9zaXRpb24iXT1mdW5jdGlvbigpe3ZhciBhPWIoKSxjPWE/YS5wb3NpdGlvbjpOYU47cmV0dXJuIGguX2xvZ2dlci5kZWJ1ZyhoLl9sb2dUYWcsIlJlc29sdmluZyBhZC5wb3NpdGlvbjogIitjKSxjfSxmWyJhZC5ncmFudWxhclRyYWNraW5nIl09ZnVuY3Rpb24oKXt2YXIgYT1iKCksYz0hIWEmJmEuZ3JhbnVsYXJUcmFja2luZztyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIGFkLmdyYW51bGFyVHJhY2tpbmc6ICIrYyksY30sZlsiYWQudHJhY2tpbmdJbnRlcnZhbCJdPWZ1bmN0aW9uKCl7dmFyIGE9UztyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIGFkLnRyYWNraW5nSW50ZXJ2YWw6ICIrYSksYX0sZlsiY2hhcHRlci5pc0luQ2hhcHRlciJdPWZ1bmN0aW9uKCl7dmFyIGE9ZCgpLGI9bnVsbCE9YTtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIGNoYXB0ZXIuaXNJbkNoYXB0ZXI6ICIrYiksYn0sZlsiY2hhcHRlci5uYW1lIl09ZnVuY3Rpb24oKXt2YXIgYT1kKCksYj1hP2EubmFtZTpudWxsO3JldHVybiBoLl9sb2dnZXIuZGVidWcoaC5fbG9nVGFnLCJSZXNvbHZpbmcgY2hhcHRlci5uYW1lOiAiK2IpLGJ9LGZbImNoYXB0ZXIubGVuZ3RoIl09ZnVuY3Rpb24oKXt2YXIgYT1kKCksYj1hP2EubGVuZ3RoOk5hTjtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIGNoYXB0ZXIubGVuZ3RoOiAiK2IpLGJ9LGZbImNoYXB0ZXIucG9zaXRpb24iXT1mdW5jdGlvbigpe3ZhciBhPWQoKSxiPWE/YS5wb3NpdGlvbjpOYU47cmV0dXJuIGguX2xvZ2dlci5kZWJ1ZyhoLl9sb2dUYWcsIlJlc29sdmluZyBjaGFwdGVyLnBvc2l0aW9uOiAiK2IpLGJ9LGZbImNoYXB0ZXIuc3RhcnRUaW1lIl09ZnVuY3Rpb24oKXt2YXIgYT1kKCksYj1hP2Euc3RhcnRUaW1lOk5hTjtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIGNoYXB0ZXIuc3RhcnRUaW1lOiAiK2IpLGJ9LGZbInFvcy5iaXRyYXRlIl09ZnVuY3Rpb24oKXt2YXIgYT1lKCksYj1hP2EuYml0cmF0ZTpOYU47cmV0dXJuIGguX2xvZ2dlci5kZWJ1ZyhoLl9sb2dUYWcsIlJlc29sdmluZyBxb3MuYml0cmF0ZTogIitiKSxifSxmWyJxb3MuZnBzIl09ZnVuY3Rpb24oKXt2YXIgYT1lKCksYj1hP2EuZnBzOk5hTjtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIHFvcy5mcHM6ICIrYiksYn0sZlsicW9zLmRyb3BwZWRGcmFtZXMiXT1mdW5jdGlvbigpe3ZhciBhPWUoKSxiPWE/YS5kcm9wcGVkRnJhbWVzOk5hTjtyZXR1cm4gaC5fbG9nZ2VyLmRlYnVnKGguX2xvZ1RhZywiUmVzb2x2aW5nIHFvcy5kcm9wcGVkRnJhbWVzOiAiK2IpLGJ9LGZbInFvcy5zdGFydHVwVGltZSJdPWZ1bmN0aW9uKCl7dmFyIGE9ZSgpLGI9YT8xZTMqYS5zdGFydHVwVGltZTpOYU47cmV0dXJuIGguX2xvZ2dlci5kZWJ1ZyhoLl9sb2dUYWcsIlJlc29sdmluZyBxb3Muc3RhcnR1cFRpbWU6ICIrYiksYn0sdGhpcy5fZGF0YVJlc29sdmVyPWZ1bmN0aW9uKGEpe2lmKCFhfHwwPT1hLmxlbmd0aClyZXR1cm4gbnVsbDtnPXt9O2Zvcih2YXIgYj1udWxsLGM9MDtjPGEubGVuZ3RoO2MrKyl7dmFyIGQ9YVtjXTtiPWJ8fHt9LGJbZF09Zi5oYXNPd25Qcm9wZXJ0eShkKT9mW2RdLmNhbGwodGhpcyk6bnVsbH1yZXR1cm4gYn19LGMucHJvdG90eXBlLl90cmFja1BsYXloZWFkU3RhbGw9ZnVuY3Rpb24oKXt0aGlzLl9jYW5Qcm9jZXNzKCkmJih0aGlzLl9wbGF5aGVhZFN0YWxsZWR8fCh0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiNfdHJhY2tQbGF5aGVhZFN0YWxsKCkiKSx0aGlzLl9zdGFsbGVkUGxheWhlYWRDb3VudD0wLHRoaXMuX3BsYXloZWFkU3RhbGxlZD0hMCx0aGlzLl90cmlnZ2VyKHYpKSl9LGMucHJvdG90eXBlLl90cmFja0V4aXRTdGFsbD1mdW5jdGlvbigpe3RoaXMuX2NhblByb2Nlc3MoKSYmKHRoaXMuX3N0YWxsZWRQbGF5aGVhZENvdW50PTAsIXRoaXMuX3BsYXloZWFkU3RhbGxlZHx8dGhpcy5faXNQYXVzZWR8fHRoaXMuX2lzU2Vla2luZ3x8dGhpcy5faXNCdWZmZXJpbmd8fCh0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIiNfdHJhY2tFeGl0U3RhbGwoKSIpLHRoaXMuX3BsYXloZWFkU3RhbGxlZD0hMSx0aGlzLl90cmlnZ2VyKHUpKSl9LGMucHJvdG90eXBlLl9zdGFydFBsYXloZWFkVGltZXI9ZnVuY3Rpb24oKXt2YXIgYT10aGlzO3RoaXMuX3BsYXloZWFkVGltZXJ8fHRoaXMuX2lzUGF1c2VkfHx0aGlzLl9pc1NlZWtpbmd8fHRoaXMuX2lzQnVmZmVyaW5nfHwodGhpcy5fcGxheWhlYWRUaW1lcj1zZXRJbnRlcnZhbChmdW5jdGlvbigpe2lmKGEuX2NhblByb2Nlc3MoKSl7dmFyIGI9YS5fZGF0YVJlc29sdmVyKFsiYWQuaXNJbkFkIiwidmlkZW8ucGxheWhlYWQiXSk7aWYoYS5faXNUcmFja2luZ0FkQnJlYWspYS5fcGxheWhlYWRTdGFsbGVkJiZhLl90cmFja0V4aXRTdGFsbCgpO2Vsc2V7dmFyIGM9YlsidmlkZW8ucGxheWhlYWQiXTtjIT1hLl9wcmV2aW91c1BsYXloZWFkP2EuX3RyYWNrRXhpdFN0YWxsKCk6YS5fcHJldmlvdXNQbGF5aGVhZD49MCYmYz09YS5fcHJldmlvdXNQbGF5aGVhZCYmKythLl9zdGFsbGVkUGxheWhlYWRDb3VudD09VCYmYS5fdHJhY2tQbGF5aGVhZFN0YWxsKCksYyE9YS5fcHJldmlvdXNQbGF5aGVhZCYmYz4wJiYhYS5fY29udGVudFN0YXJ0ZWQmJihhLl9pc1BhdXNlZHx8YS5faXNCdWZmZXJpbmd8fGEuX2lzU2Vla2luZ3x8KGEuX2xvZ2dlci5pbmZvKGEuX2xvZ1RhZywiI19wbGF5aGVhZFRpbWVyIHBsYXloZWFkIHByb2dyZXNzIHRvOiAiK2MpLGEuX3RyaWdnZXIodyksYS5fY29udGVudFN0YXJ0ZWQ9ITApKSxhLl9wcmV2aW91c1BsYXloZWFkPWN9fX0sUikpfSxjLnByb3RvdHlwZS5fc3RvcFBsYXloZWFkVGltZXI9ZnVuY3Rpb24oKXt0aGlzLl9wbGF5aGVhZFRpbWVyJiYoY2xlYXJJbnRlcnZhbCh0aGlzLl9wbGF5aGVhZFRpbWVyKSx0aGlzLl9wbGF5aGVhZFRpbWVyPW51bGwpLHRoaXMuX3RyYWNrRXhpdFN0YWxsKCl9LGMucHJvdG90eXBlLl9zdGFydFNlc3Npb25JZk5lZWRlZD1mdW5jdGlvbihhKXtyZXR1cm4gdGhpcy5faXNUcmFja2luZ1Nlc3Npb25BY3RpdmU/KHRoaXMuX2lzVHJhY2tpbmdTZXNzaW9uU3RhcnRlZHx8KHRoaXMuX2xvZ2dlci5pbmZvKHRoaXMuX2xvZ1RhZywiIyIrYSsiKCkgPiBUcmFja2luZyBzZXNzaW9uIGF1dG8tc3RhcnQuIiksdGhpcy50cmFja1Nlc3Npb25TdGFydCgpKSwhMCk6KHRoaXMuX2xvZ2dlci53YXJuKHRoaXMuX2xvZ1RhZywiIyIrYSsiKCkgPiBObyBhY3RpdmUgdHJhY2tpbmcgc2Vzc2lvbi4iKSwhMSl9LGMucHJvdG90eXBlLl9hbGxvd1BsYXllclN0YXRlQ2hhbmdlPWZ1bmN0aW9uKCl7cmV0dXJuISh0aGlzLl9pc1RyYWNraW5nQWRCcmVhayYmIXRoaXMuX2lzVHJhY2tpbmdBZCl8fCh0aGlzLl9sb2dnZXIuaW5mbyh0aGlzLl9sb2dUYWcsIl9hbGxvd1BsYXllclN0YXRlQ2hhbmdlIFBsYXllciBwbHVnaW4gZG9lcyBub3QgYWxsb3cgcGxheWVyIHN0YXRlIGNoYW5nZXMgd2hlbiBpbiBBZGJyZWFrIGFuZCBub3QgaW4gQWQuIiksITEpfTt2YXIgaD0icGxheWVyIixpPWgsaj0iYWRvYmUtaGVhcnRiZWF0IixrPSJzb3VyY2VFcnJvckV4dGVybmFsIixsPSJzb3VyY2VFcnJvclNESyIsbT0idmlkZW9fbG9hZCIsbj0idmlkZW9fdW5sb2FkIixvPSJ2aWRlb19zZXNzaW9uX2VuZCIscD0idmlkZW9fc3RhcnQiLHE9InZpZGVvX3Jlc3VtZSIscj0idmlkZW9fY29tcGxldGUiLHM9InZpZGVvX3NraXAiLHQ9InRpbWVkX21ldGFkYXRhIix1PSJwbGF5Iix2PSJwYXVzZSIsdz0iY29udGVudF9zdGFydCIseD0iYWRicmVha19zdGFydCIseT0iYWRicmVha19jb21wbGV0ZSIsej0iYWRfc3RhcnQiLEE9ImFkX2NvbXBsZXRlIixCPSJhZF9za2lwIixDPSJidWZmZXJfc3RhcnQiLEQ9ImJ1ZmZlcl9jb21wbGV0ZSIsRT0ic2Vla19zdGFydCIsRj0ic2Vla19jb21wbGV0ZSIsRz0iY2hhcHRlcl9zdGFydCIsSD0iY2hhcHRlcl9jb21wbGV0ZSIsST0iY2hhcHRlcl9za2lwIixKPSJiaXRyYXRlX2NoYW5nZSIsSz0idHJhY2tfZXJyb3IiLEw9InZpZGVvX2lkbGVfc3RhcnQiLE09InZpZGVvX2lkbGVfcmVzdW1lIixOPSJjYWxsYmFjayIsTz0iZmlsdGVyX3JlcG9ydCIsUD0ic291cmNlIixRPSJlcnJvcl9pZCIsUj0xMDAxLFM9MSxUPTI7Yi5WaWRlb1BsYXllclBsdWdpbj1jfShhLkFEQi5jb3JlLGIpLGEuQURCLnZhLnBsdWdpbnMudmlkZW9wbGF5ZXJ8fChhLkFEQi52YS5wbHVnaW5zLnZpZGVvcGxheWVyPWIpfSh0aGlzKTtcblxuLy8gQWRvYmVIZWFydGJlYXRQbHVnaW5cbiFmdW5jdGlvbihhKXtpZih2b2lkIDA9PT1iKXZhciBiPXt9O2IuY2xvY2t8fChiLmNsb2NrPXt9KSxiLmNvbnRleHR8fChiLmNvbnRleHQ9e30pLGIuZmlsdGVyfHwoYi5maWx0ZXI9e30pLGIubW9kZWx8fChiLm1vZGVsPXt9KSxiLm5ldHdvcmt8fChiLm5ldHdvcms9e30pLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoYSxiLGMsZCxlKXtpZighYil0aHJvdyBuZXcgRXJyb3IoIlJlZmVyZW5jZSB0byB0aGUgY2hhbm5lbCBvYmplY3QgY2Fubm90IGJlIE5VTEwiKTtpZih0aGlzLl9jaGFubmVsPWIsIWEpdGhyb3cgbmV3IEVycm9yKCJSZWZlcmVuY2UgdG8gdGhlIHBsdWdpbk1hbmFnZXIgb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7aWYodGhpcy5fcGx1Z2luTWFuYWdlcj1hLCFlKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBsb2dnZXIgb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7dGhpcy5fbG9nVGFnPSJhaDo6VGltZXIuIitjLHRoaXMuX2xvZ2dlcj1lLHRoaXMuX2lzRGVzdHJveWVkPSExLHRoaXMuX2NyZWF0ZVRpbWVyKGMsZCksdGhpcy5faW5zdGFsbEhhbmRsZXJzKCl9dmFyIGQ9YS5FdmVudDtjLktFWV9OQU1FPSJuYW1lIixjLktFWV9JTlRFUlZBTD0iaW50ZXJ2YWwiLGMuS0VZX1JFU0VUPSJyZXNldCIsYy5wcm90b3R5cGUucmVzdW1lPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh0aGlzLl9sb2dUYWcsIlN0YXJ0aW5nIHRpbWVyOiAiK3RoaXMuX25hbWUpO3ZhciBiPXt9O2JbYy5LRVlfTkFNRV09ZSsiLiIrdGhpcy5fbmFtZSxiW2MuS0VZX1JFU0VUXT1hLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tbWFuZChmLGksYil9LGMucHJvdG90eXBlLnBhdXNlPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh0aGlzLl9sb2dUYWcsIlN0b3BwaW5nIHRpbWVyOiAiK3RoaXMuX25hbWUpO3ZhciBiPXt9O2JbYy5LRVlfTkFNRV09ZSsiLiIrdGhpcy5fbmFtZSxiW2MuS0VZX1JFU0VUXT1hLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tbWFuZChmLGgsYil9LGMucHJvdG90eXBlLmRlc3Ryb3k9ZnVuY3Rpb24oKXtpZighdGhpcy5faXNEZXN0cm95ZWQpe3RoaXMuX2lzRGVzdHJveWVkPSEwLHRoaXMuX3VuaW5zdGFsbEhhbmRsZXJzKCk7dmFyIGE9e307YVtjLktFWV9OQU1FXT1lKyIuIit0aGlzLl9uYW1lLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tbWFuZChmLGosYSl9fSxjLnByb3RvdHlwZS5zZXRJbnRlcnZhbD1mdW5jdGlvbihhKXt2YXIgYj1rKyIuIitlKyIuIit0aGlzLl9uYW1lLGM9dGhpcy5fcGx1Z2luTWFuYWdlci5yZXF1ZXN0KGYsW2JdKVtiXTt0aGlzLnBhdXNlKCEwKSx0aGlzLl9jcmVhdGVUaW1lcih0aGlzLl9uYW1lLGEpLGN8fHRoaXMucmVzdW1lKCEwKX0sYy5wcm90b3R5cGUuX2NtZFJlc3VtZT1mdW5jdGlvbihhKXt2YXIgYj0hMTtudWxsIT1hJiZhLmhhc093blByb3BlcnR5KGMuS0VZX1JFU0VUKSYmKGI9YVtjLktFWV9SRVNFVF0pLHRoaXMucmVzdW1lKGIpfSxjLnByb3RvdHlwZS5fY21kUGF1c2U9ZnVuY3Rpb24oYSl7dmFyIGI9ITE7bnVsbCE9YSYmYS5oYXNPd25Qcm9wZXJ0eShjLktFWV9SRVNFVCkmJihiPWFbYy5LRVlfUkVTRVRdKSx0aGlzLnBhdXNlKGIpfSxjLnByb3RvdHlwZS5fb25UaWNrPWZ1bmN0aW9uKGEsYil7dGhpcy5fY2hhbm5lbC50cmlnZ2VyKG5ldyBkKCJjbG9jazoiK3RoaXMuX25hbWUrIi50aWNrIixiKSl9LGMucHJvdG90eXBlLl9pbnN0YWxsSGFuZGxlcnM9ZnVuY3Rpb24oKXt0aGlzLl9jaGFubmVsLmNvbXBseSgiY2xvY2s6Iit0aGlzLl9uYW1lKyIucmVzdW1lIix0aGlzLl9jbWRSZXN1bWUsdGhpcyksdGhpcy5fY2hhbm5lbC5jb21wbHkoImNsb2NrOiIrdGhpcy5fbmFtZSsiLnBhdXNlIix0aGlzLl9jbWRQYXVzZSx0aGlzKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLm9uKGYsZSsiLiIrdGhpcy5fbmFtZSsiLnRpY2siLHRoaXMuX29uVGljayx0aGlzKX0sYy5wcm90b3R5cGUuX3VuaW5zdGFsbEhhbmRsZXJzPWZ1bmN0aW9uKCl7dGhpcy5fY2hhbm5lbC5vZmYobnVsbCxudWxsLHRoaXMpLHRoaXMuX3BsdWdpbk1hbmFnZXIub2ZmKG51bGwsbnVsbCxudWxsLHRoaXMpfSxjLnByb3RvdHlwZS5fY3JlYXRlVGltZXI9ZnVuY3Rpb24oYSxiKXt0aGlzLl9uYW1lPWEsdGhpcy5faW50ZXJ2YWw9Yjt2YXIgZD17fTtkW2MuS0VZX05BTUVdPWUrIi4iK3RoaXMuX25hbWUsZFtjLktFWV9JTlRFUlZBTF09dGhpcy5faW50ZXJ2YWwsdGhpcy5fcGx1Z2luTWFuYWdlci5jb21tYW5kKGYsZyxkKX07dmFyIGU9ImhlYXJ0YmVhdCIsZj0ic2VydmljZS5jbG9jayIsZz0iY3JlYXRlIixoPSJwYXVzZSIsaT0icmVzdW1lIixqPSJkZXN0cm95IixrPSJpc19wYXVzZWQiO2IuY2xvY2suVGltZXI9Y30oYS5BREIuY29yZSxiKSxmdW5jdGlvbihhLGIpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBjKGEsYixkKXtjLl9fc3VwZXJfXy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMsYSxiLGYsaCxkKX12YXIgZD1hLkV2ZW50LGU9Yi5jbG9jay5UaW1lcjthLmV4dGVuZChjLGUpLGMucHJvdG90eXBlLl9vbkNoZWNrU3RhdHVzQ29tcGxldGU9ZnVuY3Rpb24oYSl7dmFyIGI9YS5kYXRhW2xdO2lmKHRoaXMuX2xvZ2dlci5kZWJ1Zyh0aGlzLl9sb2dUYWcsIiNfb25DaGVja1N0YXR1c0NvbXBsZXRlKGludGVydmFsPSIrYisiKSIpLGIpe2lmKGI9PXRoaXMuX2ludGVydmFsKXJldHVybiB2b2lkIHRoaXMuX2xvZ2dlci5kZWJ1Zyh0aGlzLl9sb2dUYWcsIiNfb25DaGVja1N0YXR1c0NvbXBsZXRlKCkgPiBJbnRlcnZhbCB2YWx1ZSBub3QgY2hhbmdlZC4iKTtiPmc/KHRoaXMuX2xvZ2dlci53YXJuKHRoaXMuX2xvZ1RhZywiI19vbkNoZWNrU3RhdHVzQ29tcGxldGUoKSA+IEludGVydmFsIHZhbHVlIHRvbyBsYXJnZTogIitiKSx0aGlzLnNldEludGVydmFsKGcpKToodGhpcy5fbG9nZ2VyLmRlYnVnKHRoaXMuX2xvZ1RhZywiI19vbkNoZWNrU3RhdHVzQ29tcGxldGUoKSA+IEludGVydmFsIGNoYW5nZWQgdG86ICIrYiksdGhpcy5zZXRJbnRlcnZhbChiKSl9ZWxzZSB0aGlzLl9sb2dnZXIud2Fybih0aGlzLl9sb2dUYWcsIiNfb25DaGVja1N0YXR1c0NvbXBsZXRlKCkgPiBJbnZhbGlkIGludGVydmFsIHZhbHVlLiIpLHRoaXMuc2V0SW50ZXJ2YWwoaCl9LGMucHJvdG90eXBlLl9nZXRTZXR0aW5ncz1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuZGVidWcodGhpcy5fbG9nVGFnLCIjX2dldFNldHRpbmdzKCkiKSx0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGQoaSkpfSxjLnByb3RvdHlwZS5faW5zdGFsbEhhbmRsZXJzPWZ1bmN0aW9uKCl7Yy5fX3N1cGVyX18uX2luc3RhbGxIYW5kbGVycy5jYWxsKHRoaXMpLHRoaXMuX2NoYW5uZWwub24oaix0aGlzLl9nZXRTZXR0aW5ncyx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKGssdGhpcy5fb25DaGVja1N0YXR1c0NvbXBsZXRlLHRoaXMpLHRoaXMuX2NoYW5uZWwucmVwbHkobCxmdW5jdGlvbigpe3JldHVybiB0aGlzLl9pbnRlcnZhbH0sdGhpcyl9O3ZhciBmPSJjaGVja19zdGF0dXMiLGc9NjAwLGg9MTgwLGk9ImNsb2NrOmNoZWNrX3N0YXR1cy50aWNrIixqPSJjbG9jazpjaGVja19zdGF0dXMuZ2V0X3NldHRpbmdzIixrPSJuZXQ6Y2hlY2tfc3RhdHVzX2NvbXBsZXRlIixsPSJjaGVja19zdGF0dXNfaW50ZXJ2YWwiO2IuY2xvY2suQ2hlY2tTdGF0dXNUaW1lcj1jfShhLkFEQi5jb3JlLGIpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoYSxiLGQpe2MuX19zdXBlcl9fLmNvbnN0cnVjdG9yLmNhbGwodGhpcyxhLGIsZSxmLGQpLHRoaXMuX2RvTm90T3ZlcnJpZGVJbnRlcnZhbD0hMX12YXIgZD1iLmNsb2NrLlRpbWVyO2EuZXh0ZW5kKGMsZCksYy5wcm90b3R5cGUuX29uQ2hlY2tTdGF0dXNDb21wbGV0ZT1mdW5jdGlvbihhKXt2YXIgYj1hLmRhdGFbZ107aWYodGhpcy5fbG9nZ2VyLmRlYnVnKHRoaXMuX2xvZ1RhZywiI19vbkNoZWNrU3RhdHVzQ29tcGxldGUoaW50ZXJ2YWw9IitiKyIpIiksdGhpcy5fZG9Ob3RPdmVycmlkZUludGVydmFsKXRoaXMuX2xvZ2dlci5kZWJ1Zyh0aGlzLl9sb2dUYWcsIiNfb25DaGVja1N0YXR1c0NvbXBsZXRlKCkgPiBJbnRlcnZhbCB2YWx1ZSBub3QgY2hhbmdlZC4gKGRvTm90T3ZlcnJpZGVJbnRlcnZhbCA9IHRydWUpIik7ZWxzZSBpZihiKXtpZihiPT10aGlzLl9pbnRlcnZhbClyZXR1cm4gdm9pZCB0aGlzLl9sb2dnZXIuZGVidWcodGhpcy5fbG9nVGFnLCIjX29uQ2hlY2tTdGF0dXNDb21wbGV0ZSgpID4gSW50ZXJ2YWwgdmFsdWUgbm90IGNoYW5nZWQuIik7dGhpcy5fbG9nZ2VyLmRlYnVnKHRoaXMuX2xvZ1RhZywiI19vbkNoZWNrU3RhdHVzQ29tcGxldGUoKSA+IEludGVydmFsIGNoYW5nZWQgdG86ICIrYiksdGhpcy5zZXRJbnRlcnZhbChiKX1lbHNlIHRoaXMuX2xvZ2dlci53YXJuKHRoaXMuX2xvZ1RhZywiI19vbkNoZWNrU3RhdHVzQ29tcGxldGUoKSA+IEludmFsaWQgaW50ZXJ2YWwgdmFsdWUuIiksdGhpcy5zZXRJbnRlcnZhbChmKX0sYy5wcm90b3R5cGUuX29uVXBkYXRlUmVwb3J0aW5nSW50ZXJ2YWw9ZnVuY3Rpb24oYSl7dmFyIGI9YS5kYXRhW2ddO2lmKHRoaXMuX2RvTm90T3ZlcnJpZGVJbnRlcnZhbD0hIWEuZGF0YVtoXSx0aGlzLl9sb2dnZXIuZGVidWcodGhpcy5fbG9nVGFnLCIjX29uVXBkYXRlUmVwb3J0aW5nSW50ZXJ2YWwoaW50ZXJ2YWw9IitiKyIsIGRvTm90T3ZlcnJpZGVJbnRlcnZhbD0iK3RoaXMuX2RvTm90T3ZlcnJpZGVJbnRlcnZhbCsiKSIpLGIpe2lmKGI9PXRoaXMuX2ludGVydmFsKXJldHVybiB2b2lkIHRoaXMuX2xvZ2dlci5kZWJ1Zyh0aGlzLl9sb2dUYWcsIiNfb25VcGRhdGVSZXBvcnRpbmdJbnRlcnZhbCgpID4gSW50ZXJ2YWwgdmFsdWUgbm90IGNoYW5nZWQuIik7dGhpcy5fbG9nZ2VyLmRlYnVnKHRoaXMuX2xvZ1RhZywiI19vblVwZGF0ZVJlcG9ydGluZ0ludGVydmFsKCkgPiBJbnRlcnZhbCBjaGFuZ2VkIHRvOiAiK2IpLHRoaXMuc2V0SW50ZXJ2YWwoYil9ZWxzZSB0aGlzLl9sb2dnZXIud2Fybih0aGlzLl9sb2dUYWcsIiNfb25VcGRhdGVSZXBvcnRpbmdJbnRlcnZhbCgpID4gSW52YWxpZCBpbnRlcnZhbCB2YWx1ZS4iKSx0aGlzLnNldEludGVydmFsKGYpfSxjLnByb3RvdHlwZS5faW5zdGFsbEhhbmRsZXJzPWZ1bmN0aW9uKCl7Yy5fX3N1cGVyX18uX2luc3RhbGxIYW5kbGVycy5jYWxsKHRoaXMpLHRoaXMuX2NoYW5uZWwub24oaix0aGlzLl9vbkNoZWNrU3RhdHVzQ29tcGxldGUsdGhpcyksdGhpcy5fY2hhbm5lbC5vbihpLHRoaXMuX29uVXBkYXRlUmVwb3J0aW5nSW50ZXJ2YWwsdGhpcyksdGhpcy5fY2hhbm5lbC5yZXBseShnLGZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMuX2ludGVydmFsfSx0aGlzKX07dmFyIGU9InJlcG9ydGluZyIsZj0xMCxnPSJyZXBvcnRpbmdfaW50ZXJ2YWwiLGg9ImRvX25vdF9vdmVycmlkZV9pbnRlcnZhbCIsaT0icmVwb3J0aW5nOnVwZGF0ZV9pbnRlcnZhbCIsaj0ibmV0OmNoZWNrX3N0YXR1c19jb21wbGV0ZSI7Yi5jbG9jay5SZXBvcnRpbmdUaW1lcj1jfShhLkFEQi5jb3JlLGIpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoYSxiLGQpe2MuX19zdXBlcl9fLmNvbnN0cnVjdG9yLmNhbGwodGhpcyxhLGIsZSxmLGQpfXZhciBkPWIuY2xvY2suVGltZXI7YS5leHRlbmQoYyxkKTt2YXIgZT0iaWRsZSIsZj0xODAwO2IuY2xvY2suSWRsZVRpbWVyPWN9KGEuQURCLmNvcmUsYiksZnVuY3Rpb24oYSxiKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYyhhLGIsZCl7Yy5fX3N1cGVyX18uY29uc3RydWN0b3IuY2FsbCh0aGlzLGEsYixlLGYsZCl9dmFyIGQ9Yi5jbG9jay5UaW1lcjthLmV4dGVuZChjLGQpO3ZhciBlPSJmbHVzaF9maWx0ZXIiLGY9LjI1O2IuY2xvY2suRmx1c2hGaWx0ZXJUaW1lcj1jfShhLkFEQi5jb3JlLGIpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoYSxiLGMpe2lmKCFhKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBwbHVnaW5NYW5hZ2VyIG9iamVjdCBjYW5ub3QgYmUgTlVMTCIpO2lmKCFiKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBjaGFubmVsIG9iamVjdCBjYW5ub3QgYmUgTlVMTCIpO2lmKCFjKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBsb2dnZXIgb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7dGhpcy5faXNEZXN0cm95ZWQ9ITEsdGhpcy5fcmVwb3J0aW5nVGltZXI9bmV3IGYoYSxiLGMpLHRoaXMuX2NoZWNrU3RhdHVzVGltZXI9bmV3IGQoYSxiLGMpLHRoaXMuX2ZsdXNoRmlsdGVyVGltZXI9bmV3IGUoYSxiLGMpLHRoaXMuX2lkbGVUaW1lcj1uZXcgZyhhLGIsYyl9dmFyIGQ9Yi5jbG9jay5DaGVja1N0YXR1c1RpbWVyLGU9Yi5jbG9jay5GbHVzaEZpbHRlclRpbWVyLGY9Yi5jbG9jay5SZXBvcnRpbmdUaW1lcixnPWIuY2xvY2suSWRsZVRpbWVyO2MucHJvdG90eXBlLmRlc3Ryb3k9ZnVuY3Rpb24oKXt0aGlzLl9pc0Rlc3Ryb3llZHx8KHRoaXMuX2lzRGVzdHJveWVkPSEwLHRoaXMuX3JlcG9ydGluZ1RpbWVyLmRlc3Ryb3koKSx0aGlzLl9jaGVja1N0YXR1c1RpbWVyLmRlc3Ryb3koKSx0aGlzLl9mbHVzaEZpbHRlclRpbWVyLmRlc3Ryb3koKSx0aGlzLl9pZGxlVGltZXIuZGVzdHJveSgpKX0sYi5jbG9jay5DbG9jaz1jfShhLkFEQi5jb3JlLGIpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoYSxiKXt0aGlzLnZhbHVlPWEsdGhpcy5oaW50PWJ9ZnVuY3Rpb24gZChhKXt0aGlzLnJlYWxtPWEsdGhpcy5kYXRhPXt9fWMuSElOVF9TSE9SVD0ic2hvcnQiLGQucHJvdG90eXBlLnNldEZpZWxkPWZ1bmN0aW9uKGEsYixkKXt0aGlzLmRhdGFbYV09bmV3IGMoYixkKX0sZC5wcm90b3R5cGUuX2NyZWF0ZUFjY2Vzc29yPWZ1bmN0aW9uKGEsYixjKXt2YXIgZD10aGlzO3JldHVybiBmdW5jdGlvbigpe3JldHVybiBhcmd1bWVudHMubGVuZ3RoJiYoZFthXT1hcmd1bWVudHNbMF0sZC5zZXRGaWVsZChiLGFyZ3VtZW50c1swXSxjKSksZFthXX19LGIubW9kZWwuRGFvPWQsYi5tb2RlbC5EYW9GaWVsZD1jfShhLkFEQi5jb3JlLGIpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoKXtpZihjLl9fc3VwZXJfXy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMsImFzc2V0IiksdGhpcy5hZElkPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfYWRJZCIsImFkX2lkIixudWxsKSx0aGlzLnNpZD10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX3NpZCIsImFkX3NpZCIsbnVsbCksdGhpcy5yZXNvbHZlcj10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX3Jlc29sdmVyIiwicmVzb2x2ZXIiLG51bGwpLHRoaXMucG9kSWQ9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9wb2RJZCIsInBvZF9pZCIsbnVsbCksdGhpcy5wb2RQb3NpdGlvbj10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX3BvZFBvc2l0aW9uIiwicG9kX3Bvc2l0aW9uIixudWxsKSx0aGlzLnBvZE9mZnNldD10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX3BvZE9mZnNldCIsInBvZF9vZmZzZXQiLG51bGwpLHRoaXMucG9kTmFtZT10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX3BvZE5hbWUiLCJwb2RfbmFtZSIsbnVsbCksdGhpcy5hZExlbmd0aD10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX2FkTGVuZ3RoIiwiYWRfbGVuZ3RoIixudWxsKSx0aGlzLmFkTmFtZT10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX2FkTmFtZSIsImFkX25hbWUiLG51bGwpLGFyZ3VtZW50cy5sZW5ndGgmJmFyZ3VtZW50c1swXWluc3RhbmNlb2YgYyl7dmFyIGE9YXJndW1lbnRzWzBdO3RoaXMuYWRJZChhLmFkSWQoKSksdGhpcy5zaWQoYS5zaWQoKSksdGhpcy5yZXNvbHZlcihhLnJlc29sdmVyKCkpLHRoaXMucG9kSWQoYS5wb2RJZCgpKSx0aGlzLnBvZFBvc2l0aW9uKGEucG9kUG9zaXRpb24oKSksdGhpcy5wb2RPZmZzZXQoYS5wb2RPZmZzZXQoKSksdGhpcy5wb2ROYW1lKGEucG9kTmFtZSgpKSx0aGlzLmFkTGVuZ3RoKGEuYWRMZW5ndGgoKSksdGhpcy5hZE5hbWUoYS5hZE5hbWUoKSl9ZWxzZSB0aGlzLmFkSWQoIiIpLHRoaXMuc2lkKCIiKSx0aGlzLnJlc29sdmVyKCIiKSx0aGlzLnBvZElkKCIiKSx0aGlzLnBvZFBvc2l0aW9uKCIiKSx0aGlzLnBvZE9mZnNldCgwKSx0aGlzLnBvZE5hbWUoIiIpLHRoaXMuYWRMZW5ndGgoMCksdGhpcy5hZE5hbWUoIiIpfXZhciBkPWIubW9kZWwuRGFvO2EuZXh0ZW5kKGMsZCksYi5tb2RlbC5BZERhbz1jfShhLkFEQi5jb3JlLGIpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoKXtpZihjLl9fc3VwZXJfXy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMsInNjIiksdGhpcy5yZXBvcnRTdWl0ZUlkPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfcmVwb3J0U3VpdGVJZCIsInJzaWQiLG51bGwpLHRoaXMudHJhY2tpbmdTZXJ2ZXI9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl90cmFja2luZ1NlcnZlciIsInRyYWNraW5nX3NlcnZlciIsbnVsbCksdGhpcy5zc2w9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9zc2wiLCJzc2wiLGUuSElOVF9TSE9SVCksYXJndW1lbnRzLmxlbmd0aCYmYXJndW1lbnRzWzBdaW5zdGFuY2VvZiBjKXt2YXIgYT1hcmd1bWVudHNbMF07dGhpcy5yZXBvcnRTdWl0ZUlkKGEucmVwb3J0U3VpdGVJZCgpKSx0aGlzLnRyYWNraW5nU2VydmVyKGEudHJhY2tpbmdTZXJ2ZXIoKSksdGhpcy5zc2woYS5zc2woKSl9ZWxzZSB0aGlzLnJlcG9ydFN1aXRlSWQoIiIpLHRoaXMudHJhY2tpbmdTZXJ2ZXIoIiIpLHRoaXMuc3NsKDApfXZhciBkPWIubW9kZWwuRGFvLGU9Yi5tb2RlbC5EYW9GaWVsZDthLmV4dGVuZChjLGQpLGIubW9kZWwuQWRvYmVBbmFseXRpY3NEYW89Y30oYS5BREIuY29yZSxiKSxmdW5jdGlvbihhLGIpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBjKCl7aWYoYy5fX3N1cGVyX18uY29uc3RydWN0b3IuY2FsbCh0aGlzLCJzdHJlYW0iKSx0aGlzLmlkPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfaWQiLCJjaGFwdGVyX2lkIixudWxsKSx0aGlzLnNpZD10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX3NpZCIsImNoYXB0ZXJfc2lkIixudWxsKSx0aGlzLm5hbWU9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9uYW1lIiwiY2hhcHRlcl9uYW1lIixudWxsKSx0aGlzLnBvc2l0aW9uPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfcG9zaXRpb24iLCJjaGFwdGVyX3BvcyIsbnVsbCksdGhpcy5sZW5ndGg9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9sZW5ndGgiLCJjaGFwdGVyX2xlbmd0aCIsbnVsbCksdGhpcy5vZmZzZXQ9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9vZmZzZXQiLCJjaGFwdGVyX29mZnNldCIsbnVsbCksYXJndW1lbnRzLmxlbmd0aCYmYXJndW1lbnRzWzBdaW5zdGFuY2VvZiBjKXt2YXIgYT1hcmd1bWVudHNbMF07dGhpcy5pZChhLmlkKCkpLHRoaXMuc2lkKGEuc2lkKCkpLHRoaXMubmFtZShhLm5hbWUoKSksdGhpcy5wb3NpdGlvbihhLnBvc2l0aW9uKCkpLHRoaXMubGVuZ3RoKGEubGVuZ3RoKCkpLHRoaXMub2Zmc2V0KGEub2Zmc2V0KCkpfWVsc2UgdGhpcy5pZCgiIiksdGhpcy5zaWQoIiIpLHRoaXMubmFtZSgiIiksdGhpcy5wb3NpdGlvbigwKSx0aGlzLmxlbmd0aCgwKSx0aGlzLm9mZnNldCgwKX12YXIgZD1iLm1vZGVsLkRhbzthLmV4dGVuZChjLGQpLGIubW9kZWwuQ2hhcHRlckRhbz1jfShhLkFEQi5jb3JlLGIpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoKXtpZihjLl9fc3VwZXJfXy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMsImFzc2V0IiksdGhpcy50eXBlPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfdHlwZSIsInR5cGUiLG51bGwpLHRoaXMudmlkZW9JZD10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX3ZpZGVvSWQiLCJ2aWRlb19pZCIsbnVsbCksdGhpcy5wdWJsaXNoZXI9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9wdWJsaXNoZXIiLCJwdWJsaXNoZXIiLG51bGwpLHRoaXMuYWREYXRhPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfYWREYXRhIiwiYWRfZGF0YSIsbnVsbCksdGhpcy5jaGFwdGVyRGF0YT10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX2NoYXB0ZXJEYXRhIiwiY2hhcHRlcl9kYXRhIixudWxsKSx0aGlzLmxlbmd0aD10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX2xlbmd0aCIsImxlbmd0aCIsbnVsbCksdGhpcy5uYW1lPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfbmFtZSIsIm5hbWUiLG51bGwpLGFyZ3VtZW50cy5sZW5ndGgmJmFyZ3VtZW50c1swXWluc3RhbmNlb2YgYyl7dmFyIGE9YXJndW1lbnRzWzBdO3RoaXMudHlwZShhLnR5cGUoKSksdGhpcy5uYW1lKGEubmFtZSgpKSx0aGlzLnZpZGVvSWQoYS52aWRlb0lkKCkpLHRoaXMucHVibGlzaGVyKGEucHVibGlzaGVyKCkpLHRoaXMubGVuZ3RoKGEubGVuZ3RoKCkpO3ZhciBiPWEuYWREYXRhKCk/bmV3IGUoYS5hZERhdGEoKSk6bnVsbDt0aGlzLmFkRGF0YShiKTt2YXIgZD1hLmNoYXB0ZXJEYXRhKCk/bmV3IGYoYS5jaGFwdGVyRGF0YSgpKTpudWxsO3RoaXMuY2hhcHRlckRhdGEoZCl9ZWxzZSB0aGlzLnR5cGUoIiIpLHRoaXMubmFtZSgiIiksdGhpcy52aWRlb0lkKCIiKSx0aGlzLnB1Ymxpc2hlcigiIiksdGhpcy5sZW5ndGgoMCksdGhpcy5hZERhdGEobnVsbCksdGhpcy5jaGFwdGVyRGF0YShudWxsKX12YXIgZD1iLm1vZGVsLkRhbyxlPWIubW9kZWwuQWREYW8sZj1iLm1vZGVsLkNoYXB0ZXJEYW87YS5leHRlbmQoYyxkKSxjLlRZUEVfQUQ9ImFkIixjLlRZUEVfTUFJTl9DT05URU5UPSJtYWluIixiLm1vZGVsLkFzc2V0RGFvPWN9KGEuQURCLmNvcmUsYiksZnVuY3Rpb24oYSxiKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYygpe2lmKGMuX19zdXBlcl9fLmNvbnN0cnVjdG9yLmNhbGwodGhpcywiZXZlbnQiKSx0aGlzLnR5cGU9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl90eXBlIiwidHlwZSIsbnVsbCksdGhpcy5kdXJhdGlvbj10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX2R1cmF0aW9uIiwiZHVyYXRpb24iLG51bGwpLHRoaXMucGxheWhlYWQ9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9wbGF5aGVhZCIsInBsYXloZWFkIixudWxsKSx0aGlzLmlkPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfaWQiLCJpZCIsbnVsbCksdGhpcy5zb3VyY2U9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9zb3VyY2UiLCJzb3VyY2UiLG51bGwpLHRoaXMudHM9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl90cyIsInRzIixudWxsKSx0aGlzLnByZXZUcz10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX3ByZXZUcyIsInByZXZfdHMiLG51bGwpLGFyZ3VtZW50cy5sZW5ndGgmJmFyZ3VtZW50c1swXWluc3RhbmNlb2YgYyl7dmFyIGE9YXJndW1lbnRzWzBdO3RoaXMudHlwZShhLnR5cGUoKSksdGhpcy5kdXJhdGlvbihhLmR1cmF0aW9uKCkpLHRoaXMucGxheWhlYWQoYS5wbGF5aGVhZCgpKSx0aGlzLmlkKGEuaWQoKSksdGhpcy5zb3VyY2UoYS5zb3VyY2UoKSksdGhpcy50cyhhLnRzKCkpLHRoaXMucHJldlRzKGEucHJldlRzKCkpfWVsc2UgdGhpcy50eXBlKCIiKSx0aGlzLmR1cmF0aW9uKDApLHRoaXMucGxheWhlYWQoMCksdGhpcy5pZCgiIiksdGhpcy5zb3VyY2UoIiIpLHRoaXMudHMoMCksdGhpcy5wcmV2VHMoLTEpfXZhciBkPWIubW9kZWwuRGFvO2EuZXh0ZW5kKGMsZCksYy5FVkVOVF9UWVBFX0FBX1NUQVJUPSJhYV9zdGFydCIsYy5FVkVOVF9UWVBFX0FBX0FEX1NUQVJUPSJhYV9hZF9zdGFydCIsYy5FVkVOVF9UWVBFX1NUQVJUPSJzdGFydCIsYy5FVkVOVF9UWVBFX1JFU1VNRT0icmVzdW1lIixjLkVWRU5UX1RZUEVfQ0hBUFRFUl9TVEFSVD0iY2hhcHRlcl9zdGFydCIsYy5FVkVOVF9UWVBFX0NIQVBURVJfQ09NUExFVEU9ImNoYXB0ZXJfY29tcGxldGUiLGMuRVZFTlRfVFlQRV9DSEFQVEVSX1NLSVA9ImNoYXB0ZXJfc2tpcCIsYy5FVkVOVF9UWVBFX1BMQVk9InBsYXkiLGMuRVZFTlRfVFlQRV9QQVVTRT0icGF1c2UiLGMuRVZFTlRfVFlQRV9TVEFMTD0ic3RhbGwiLGMuRVZFTlRfVFlQRV9CVUZGRVI9ImJ1ZmZlciIsYy5FVkVOVF9UWVBFX0JJVFJBVEVfQ0hBTkdFPSJiaXRyYXRlX2NoYW5nZSIsYy5FVkVOVF9UWVBFX0VSUk9SPSJlcnJvciIsYy5FVkVOVF9UWVBFX0NPTVBMRVRFPSJjb21wbGV0ZSIsYy5FVkVOVF9UWVBFX1NLSVA9InNraXAiLGMuRVZFTlRfVFlQRV9FTkQ9ImVuZCIsYi5tb2RlbC5FdmVudERhbz1jfShhLkFEQi5jb3JlLGIpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoKXtpZihjLl9fc3VwZXJfXy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMsInN0cmVhbSIpLHRoaXMuYml0cmF0ZT10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX2JpdHJhdGUiLCJiaXRyYXRlIixudWxsKSx0aGlzLmZwcz10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX2ZwcyIsImZwcyIsbnVsbCksdGhpcy5kcm9wcGVkRnJhbWVzPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfZHJvcHBlZEZyYW1lcyIsImRyb3BwZWRfZnJhbWVzIixudWxsKSx0aGlzLnN0YXJ0dXBUaW1lPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfc3RhcnR1cF90aW1lIiwic3RhcnR1cF90aW1lIixudWxsKSxhcmd1bWVudHMubGVuZ3RoJiZhcmd1bWVudHNbMF1pbnN0YW5jZW9mIGMpe3ZhciBhPWFyZ3VtZW50c1swXTt0aGlzLmJpdHJhdGUoYS5iaXRyYXRlKCkpLHRoaXMuZnBzKGEuZnBzKCkpLHRoaXMuZHJvcHBlZEZyYW1lcyhhLmRyb3BwZWRGcmFtZXMoKSksdGhpcy5zdGFydHVwVGltZShhLnN0YXJ0dXBUaW1lKCkpLHRoaXMuaXNTdGFydHVwVGltZU92ZXJyaWRkZW49YS5pc1N0YXJ0dXBUaW1lT3ZlcnJpZGRlbn1lbHNlIHRoaXMuYml0cmF0ZSgwKSx0aGlzLmZwcygwKSx0aGlzLmRyb3BwZWRGcmFtZXMoMCksdGhpcy5zdGFydHVwVGltZSgwKSx0aGlzLmlzU3RhcnR1cFRpbWVPdmVycmlkZGVuPSExfXZhciBkPWIubW9kZWwuRGFvO2EuZXh0ZW5kKGMsZCksYi5tb2RlbC5Rb1NEYW89Y30oYS5BREIuY29yZSxiKSxmdW5jdGlvbihhLGIpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBjKCl7aWYoYy5fX3N1cGVyX18uY29uc3RydWN0b3IuY2FsbCh0aGlzLCJzcCIpLHRoaXMub3ZwPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfb3ZwIiwib3ZwIixudWxsKSx0aGlzLnNkaz10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX3NkayIsInNkayIsbnVsbCksdGhpcy5jaGFubmVsPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfY2hhbm5lbCIsImNoYW5uZWwiLG51bGwpLHRoaXMucGxheWVyTmFtZT10aGlzLl9jcmVhdGVBY2Nlc3NvcigiX3BsYXllck5hbWUiLCJwbGF5ZXJfbmFtZSIsbnVsbCksdGhpcy5saWJWZXJzaW9uPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfbGliVmVyc2lvbiIsImhiX3ZlcnNpb24iLG51bGwpLHRoaXMuYXBpTGV2ZWw9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9hcGlMZXZlbCIsImhiX2FwaV9sdmwiLG51bGwpLGFyZ3VtZW50cy5sZW5ndGgmJmFyZ3VtZW50c1swXWluc3RhbmNlb2YgYyl7dmFyIGE9YXJndW1lbnRzWzBdO3RoaXMub3ZwKGEub3ZwKCkpLHRoaXMuc2RrKGEuc2RrKCkpLHRoaXMuY2hhbm5lbChhLmNoYW5uZWwoKSksdGhpcy5wbGF5ZXJOYW1lKGEucGxheWVyTmFtZSgpKSx0aGlzLmxpYlZlcnNpb24oYS5saWJWZXJzaW9uKCkpLHRoaXMuYXBpTGV2ZWwoYS5hcGlMZXZlbCgpKX1lbHNlIHRoaXMub3ZwKGUpLHRoaXMuc2RrKGUpLHRoaXMuY2hhbm5lbChlKSx0aGlzLnBsYXllck5hbWUoIiIpLHRoaXMubGliVmVyc2lvbigiIiksdGhpcy5hcGlMZXZlbCgwKX12YXIgZD1iLm1vZGVsLkRhbzthLmV4dGVuZChjLGQpO3ZhciBlPSJ1bmtub3duIjtiLm1vZGVsLlNlcnZpY2VQcm92aWRlckRhbz1jfShhLkFEQi5jb3JlLGIpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoKXtpZihjLl9fc3VwZXJfXy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMsImV2ZW50IiksdGhpcy5zZXNzaW9uSWQ9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9zZXNzaW9uSWQiLCJzaWQiLG51bGwpLGFyZ3VtZW50cy5sZW5ndGgmJmFyZ3VtZW50c1swXWluc3RhbmNlb2YgYyl7dmFyIGE9YXJndW1lbnRzWzBdO3RoaXMuc2Vzc2lvbklkKGEuc2Vzc2lvbklkKCkpfWVsc2UgdGhpcy5zZXNzaW9uSWQobnVsbCl9dmFyIGQ9Yi5tb2RlbC5EYW87YS5leHRlbmQoYyxkKSxiLm1vZGVsLlNlc3Npb25EYW89Y30oYS5BREIuY29yZSxiKSxmdW5jdGlvbihhLGIpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBjKCl7aWYoYy5fX3N1cGVyX18uY29uc3RydWN0b3IuY2FsbCh0aGlzLCJzdHJlYW0iKSx0aGlzLnR5cGU9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl90eXBlIiwidHlwZSIsbnVsbCksYXJndW1lbnRzLmxlbmd0aCYmYXJndW1lbnRzWzBdaW5zdGFuY2VvZiBjKXt2YXIgYT1hcmd1bWVudHNbMF07dGhpcy50eXBlKGEudHlwZSgpKX1lbHNlIHRoaXMudHlwZShudWxsKX12YXIgZD1iLm1vZGVsLkRhbzthLmV4dGVuZChjLGQpLGIubW9kZWwuU3RyZWFtRGFvPWN9KGEuQURCLmNvcmUsYiksZnVuY3Rpb24oYSxiKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYygpe2lmKGMuX19zdXBlcl9fLmNvbnN0cnVjdG9yLmNhbGwodGhpcywidXNlciIpLHRoaXMuYW5hbHl0aWNzVmlzaXRvcklkPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfYW5hbHl0aWNzVmlzaXRvcklkIiwiYWlkIixudWxsKSx0aGlzLm1hcmtldGluZ0Nsb3VkVmlzaXRvcklkPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfbWFya2V0aW5nQ2xvdWRWaXNpdG9ySWQiLCJtaWQiLG51bGwpLHRoaXMudmlzaXRvcklkPXRoaXMuX2NyZWF0ZUFjY2Vzc29yKCJfdmlzaXRvcklkIiwiaWQiLG51bGwpLGFyZ3VtZW50cy5sZW5ndGgmJmFyZ3VtZW50c1swXWluc3RhbmNlb2YgYyl7dmFyIGE9YXJndW1lbnRzWzBdO3RoaXMuYW5hbHl0aWNzVmlzaXRvcklkKGEuYW5hbHl0aWNzVmlzaXRvcklkKCkpLHRoaXMubWFya2V0aW5nQ2xvdWRWaXNpdG9ySWQoYS5tYXJrZXRpbmdDbG91ZFZpc2l0b3JJZCgpKSx0aGlzLnZpc2l0b3JJZChhLnZpc2l0b3JJZCgpKX1lbHNlIHRoaXMuYW5hbHl0aWNzVmlzaXRvcklkKG51bGwpLHRoaXMubWFya2V0aW5nQ2xvdWRWaXNpdG9ySWQobnVsbCksdGhpcy52aXNpdG9ySWQobnVsbCl9dmFyIGQ9Yi5tb2RlbC5EYW87YS5leHRlbmQoYyxkKSxiLm1vZGVsLlVzZXJEYW89Y30oYS5BREIuY29yZSxiKSxmdW5jdGlvbihhLGIpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBjKCl7aWYoYy5fX3N1cGVyX18uY29uc3RydWN0b3IuY2FsbCh0aGlzLCJhYW0iKSx0aGlzLmF1ZGllbmNlTWFuYWdlckJsb2I9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9hdWRpZW5jZU1hbmFnZXJCbG9iIiwiYmxvYiIsbnVsbCksdGhpcy5hdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQ9dGhpcy5fY3JlYXRlQWNjZXNzb3IoIl9hdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQiLCJsb2NfaGludCIsbnVsbCksYXJndW1lbnRzLmxlbmd0aCYmYXJndW1lbnRzWzBdaW5zdGFuY2VvZiBjKXt2YXIgYT1hcmd1bWVudHNbMF07dGhpcy5hdWRpZW5jZU1hbmFnZXJCbG9iKGEuYXVkaWVuY2VNYW5hZ2VyQmxvYigpKSx0aGlzLmF1ZGllbmNlTWFuYWdlckxvY2F0aW9uSGludChhLmF1ZGllbmNlTWFuYWdlckxvY2F0aW9uSGludCgpKX1lbHNlIHRoaXMuYXVkaWVuY2VNYW5hZ2VyQmxvYihudWxsKSx0aGlzLmF1ZGllbmNlTWFuYWdlckxvY2F0aW9uSGludChudWxsKX12YXIgZD1iLm1vZGVsLkRhbzthLmV4dGVuZChjLGQpLGIubW9kZWwuQXVkaWVuY2VNYW5hZ2VyRGFvPWN9KGEuQURCLmNvcmUsYiksZnVuY3Rpb24oYSxiKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYyhhLGIsYyxpLGope3RoaXMuZXZlbnREYXRhPW5ldyBlLHRoaXMuZXZlbnREYXRhLnR5cGUoYiksdGhpcy5ldmVudERhdGEuZHVyYXRpb24oMCksdGhpcy5ldmVudERhdGEudHMoKG5ldyBEYXRlKS5nZXRUaW1lKCkpLHRoaXMuZXZlbnREYXRhLnBsYXloZWFkKGMpLHRoaXMuYXNzZXREYXRhPW5ldyBmKGEuX2Fzc2V0RGF0YSksdGhpcy5zdHJlYW1EYXRhPW5ldyBnKGEuX3N0cmVhbURhdGEpLHRoaXMucW9zRGF0YT1uZXcgaChhLl9xb3NEYXRhKSx0aGlzLmN1c2VyRGF0YT1kLmNsb25lKGEuX2N1c2VyRGF0YSksdGhpcy5tZXRhPWksdGhpcy5jYWxsYmFjaz1qLHRoaXMuZmlsdGVyUmVwb3J0PSEwfXZhciBkPWEuT2JqZWN0VXRpbHMsZT1iLm1vZGVsLkV2ZW50RGFvLGY9Yi5tb2RlbC5Bc3NldERhbyxnPWIubW9kZWwuU3RyZWFtRGFvLGg9Yi5tb2RlbC5Rb1NEYW87Yi5tb2RlbC5UcmFja0l0ZW09Y30oYS5BREIudmEudXRpbHMsYiksZnVuY3Rpb24oYSxiKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYyhhLGIsYyxpLGosayl7dGhpcy5hZG9iZUFuYWx5dGljc0RhdGE9YSx0aGlzLnVzZXJEYXRhPWIsdGhpcy5hYW1EYXRhPWMsdGhpcy5zZXJ2aWNlUHJvdmlkZXJEYXRhPWksdGhpcy5zZXNzaW9uRGF0YT1qLHRoaXMuZXZlbnREYXRhPW5ldyBlKGsuZXZlbnREYXRhKSx0aGlzLmFzc2V0RGF0YT1uZXcgZihrLmFzc2V0RGF0YSksdGhpcy5zdHJlYW1EYXRhPW5ldyBnKGsuc3RyZWFtRGF0YSksdGhpcy5xb3NEYXRhPW5ldyBoKGsucW9zRGF0YSksdGhpcy5jdXNlckRhdGE9ZC5jbG9uZShrLmN1c2VyRGF0YSksdGhpcy5tZXRhPWQuY2xvbmUoay5tZXRhKSx0aGlzLmNhbGxiYWNrPWsuY2FsbGJhY2ssdGhpcy5maWx0ZXJSZXBvcnQ9ay5maWx0ZXJSZXBvcnR9dmFyIGQ9YS5PYmplY3RVdGlscyxlPWIubW9kZWwuRXZlbnREYW8sZj1iLm1vZGVsLkFzc2V0RGFvLGc9Yi5tb2RlbC5TdHJlYW1EYW8saD1iLm1vZGVsLlFvU0RhbztiLm1vZGVsLkNVc2VyRGFvO2IubW9kZWwuUmVwb3J0PWN9KGEuQURCLnZhLnV0aWxzLGIpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKCl7fWIucHJvdG90eXBlLnNlcmlhbGl6ZVJlcG9ydD1mdW5jdGlvbihhKXt9LGIucHJvdG90eXBlLnNlcmlhbGl6ZURhbz1mdW5jdGlvbihhKXt9LGIucHJvdG90eXBlLnNlcmlhbGl6ZU1hcD1mdW5jdGlvbihhKXt9LGIucHJvdG90eXBlLnNlcmlhbGl6ZU51bWJlcj1mdW5jdGlvbihhLGIsYyxkKXt9LGIucHJvdG90eXBlLnNlcmlhbGl6ZVN0cmluZz1mdW5jdGlvbihhLGIsYyxkKXt9LGEubW9kZWwuSVNlcmlhbGl6ZXI9Yn0oYiksZnVuY3Rpb24oYSxiKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYyhhKXtpZighYSl0aHJvdyBuZXcgRXJyb3IoIlJlZmVyZW5jZSB0byB0aGUgbG9nZ2VyIG9iamVjdCBjYW5ub3QgYmUgTlVMTCIpO3RoaXMuX2xvZ2dlcj1hfXZhciBkPWIubW9kZWwuRGFvLGU9Yi5tb2RlbC5EYW9GaWVsZCxmPWIubW9kZWwuSVNlcmlhbGl6ZXI7YS5leHRlbmQoYyxmKSxjLnByb3RvdHlwZS5zZXJpYWxpemVSZXBvcnQ9ZnVuY3Rpb24oYSl7dmFyIGI9W107cmV0dXJuIGIucHVzaCh0aGlzLnNlcmlhbGl6ZURhbyhhLmFkb2JlQW5hbHl0aWNzRGF0YSkpLGIucHVzaCh0aGlzLnNlcmlhbGl6ZURhbyhhLnVzZXJEYXRhKSksYi5wdXNoKHRoaXMuc2VyaWFsaXplRGFvKGEuYWFtRGF0YSkpLGIucHVzaCh0aGlzLnNlcmlhbGl6ZU1hcChhLmN1c2VyRGF0YSwiY3VzZXIiKSksYi5wdXNoKHRoaXMuc2VyaWFsaXplRGFvKGEuc2VydmljZVByb3ZpZGVyRGF0YSkpLGIucHVzaCh0aGlzLnNlcmlhbGl6ZURhbyhhLnNlc3Npb25EYXRhKSksYi5wdXNoKHRoaXMuc2VyaWFsaXplRGFvKGEuZXZlbnREYXRhKSksYi5wdXNoKHRoaXMuc2VyaWFsaXplRGFvKGEuYXNzZXREYXRhKSksYi5wdXNoKHRoaXMuc2VyaWFsaXplRGFvKGEuc3RyZWFtRGF0YSkpLGIucHVzaCh0aGlzLnNlcmlhbGl6ZURhbyhhLnFvc0RhdGEpKSxiLnB1c2godGhpcy5zZXJpYWxpemVNYXAoYS5tZXRhLCJtZXRhIikpLHtzZXJpYWxpemVkT3V0cHV0OmIuZmlsdGVyKGZ1bmN0aW9uKGEpe3JldHVybiEhYX0pLmpvaW4oIiYiKSxjYWxsYmFjazphLmNhbGxiYWNrfX0sYy5wcm90b3R5cGUuc2VyaWFsaXplRGFvPWZ1bmN0aW9uKGEpe3JldHVybiB0aGlzLl9wcm9jZXNzRGFvKGEpLmZpbHRlcihmdW5jdGlvbihhKXtyZXR1cm4hIWF9KS5qb2luKCImIil9LGMucHJvdG90eXBlLnNlcmlhbGl6ZU1hcD1mdW5jdGlvbihhLGIpe3ZhciBjPVtdLGQ9Ynx8Im1ldGEiO2Zvcih2YXIgZSBpbiBhKWEuaGFzT3duUHJvcGVydHkoZSkmJmFbZV0mJmMucHVzaCgiczoiK2QrIjoiK2UrIj0iK3dpbmRvdy5lbmNvZGVVUklDb21wb25lbnQoYVtlXSkpO3JldHVybiBjLmpvaW4oIiYiKX0sYy5wcm90b3R5cGUuc2VyaWFsaXplTnVtYmVyPWZ1bmN0aW9uKGEsYixjLGQpe3ZhciBmPWg7cmV0dXJuIG51bGw9PWJ8fGlzTmFOKGIpP251bGw6KGQ9PT1lLkhJTlRfU0hPUlQmJihmPWkpLGYrIjoiK2MrIjoiK2ErIj0iK01hdGguZmxvb3IoYikpfSxjLnByb3RvdHlwZS5zZXJpYWxpemVTdHJpbmc9ZnVuY3Rpb24oYSxiLGMsZCl7cmV0dXJuIGI/aisiOiIrYysiOiIrYSsiPSIrd2luZG93LmVuY29kZVVSSUNvbXBvbmVudChiKTpudWxsfSxjLnByb3RvdHlwZS5fcHJvY2Vzc0Rhbz1mdW5jdGlvbihhKXt2YXIgYj1bXTtmb3IodmFyIGMgaW4gYS5kYXRhKWlmKGEuZGF0YS5oYXNPd25Qcm9wZXJ0eShjKSl7dmFyIGU9YS5kYXRhW2NdLGY9ZS52YWx1ZSxoPWUuaGludCxpPW51bGwsaj1hLnJlYWxtO2lmKG51bGw9PWYpY29udGludWU7Im51bWJlciI9PXR5cGVvZiBmP2k9dGhpcy5zZXJpYWxpemVOdW1iZXIoYyxmLGosaCk6InN0cmluZyI9PXR5cGVvZiBmP2k9dGhpcy5zZXJpYWxpemVTdHJpbmcoYyxmLGosaCk6ZiBpbnN0YW5jZW9mIGQ/aT10aGlzLnNlcmlhbGl6ZURhbyhmKTp0aGlzLl9sb2dnZXIud2FybihnLCIjX3Byb2Nlc3NEYW8oKSA+IFVuYWJsZSB0byBzZXJpYWxpemUgREFPLiBGaWVsZDogIitjKyIuIFZhbHVlOiAiK2YrIi4iKSxpJiZiLnB1c2goaSl9cmV0dXJuIGJ9O3ZhciBnPSJhaDo6UXVlcnlzdHJpbmdTZXJpYWxpemVyIixoPSJsIixpPSJoIixqPSJzIjtiLm1vZGVsLlF1ZXJ5c3RyaW5nU2VyaWFsaXplcj1jfShhLkFEQi5jb3JlLGIpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoYSxiKXtpZighYSl0aHJvdyBuZXcgRXJyb3IoIlJlZmVyZW5jZSB0byB0aGUgZGF0YSBvYmplY3QgY2Fubm90IGJlIE5VTEwiKTtpZih0aGlzLl9kYXRhPWEsIWIpdGhyb3cgbmV3IEVycm9yKCJSZWZlcmVuY2UgdG8gdGhlIGxvZ2dlciBvYmplY3QgY2Fubm90IGJlIE5VTEwiKTt0aGlzLl9sb2dnZXI9Yn1jLnByb3RvdHlwZS5wYXJzZT1mdW5jdGlvbigpe3ZhciBhLGIsYyxqLGssbDtpZih3aW5kb3cuRE9NUGFyc2VyKXtsPShuZXcgd2luZG93LkRPTVBhcnNlcikucGFyc2VGcm9tU3RyaW5nKHRoaXMuX2RhdGEsInRleHQveG1sIil9ZWxzZSBsPW5ldyB3aW5kb3cuQWN0aXZlWE9iamVjdCgiTWljcm9zb2Z0LlhNTERPTSIpLGwuYXN5bmM9ITEsbC5sb2FkWE1MKHRoaXMuX2RhdGEpO3ZhciBtO209cGFyc2VJbnQobC5nZXRFbGVtZW50c0J5VGFnTmFtZSgidHJhY2tpbmdJbnRlcnZhbCIpWzBdLmNoaWxkTm9kZXNbMF0ubm9kZVZhbHVlLDEwKSxtJiYoYT1tKSxtPXBhcnNlSW50KGwuZ2V0RWxlbWVudHNCeVRhZ05hbWUoInNldHVwQ2hlY2tJbnRlcnZhbCIpWzBdLmNoaWxkTm9kZXNbMF0ubm9kZVZhbHVlLDEwKSxtJiYoYj1tKSxtPXBhcnNlSW50KGwuZ2V0RWxlbWVudHNCeVRhZ05hbWUoInRyYWNrRXh0ZXJuYWxFcnJvcnMiKVswXS5jaGlsZE5vZGVzWzBdLm5vZGVWYWx1ZSwxMCksbSYmKGM9MT09bSksbC5nZXRFbGVtZW50c0J5VGFnTmFtZSgidHJhY2tpbmdEaXNhYmxlZCIpWzBdJiYobT1wYXJzZUludChsLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJ0cmFja2luZ0Rpc2FibGVkIilbMF0uY2hpbGROb2Rlc1swXS5ub2RlVmFsdWUsMTApLGo9MT09bSksbC5nZXRFbGVtZW50c0J5VGFnTmFtZSgibmllbHNlbkVuYWJsZWQiKVswXT8obT1wYXJzZUludChsLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJuaWVsc2VuRW5hYmxlZCIpWzBdLmNoaWxkTm9kZXNbMF0ubm9kZVZhbHVlLDEwKSxrPTE9PW0pOms9ITA7dmFyIG49e307cmV0dXJuIG5bZV09YSxuW2ZdPWIsbltnXT1jLG5baV09aixuW2hdPWssdGhpcy5fbG9nZ2VyLmRlYnVnKGQsIiNwYXJzZSgpID4gT2J0YWluZWQgY29uZmlndXJhdGlvbiBzZXR0aW5ncy4iKSxufTt2YXIgZD0iYWg6OlNldHRpbmdzUGFyc2VyIixlPSJyZXBvcnRpbmdfaW50ZXJ2YWwiLGY9ImNoZWNrX3N0YXR1c19pbnRlcnZhbCIsZz0idHJhY2tfZXh0ZXJuYWxfZXJyb3JzIixoPSJuaWVsc2VuX2VuYWJsZWQiLGk9InRyYWNraW5nX2Rpc2FibGVkIjtiLm5ldHdvcmsuU2V0dGluZ3NQYXJzZXI9Y30oYS5BREIuY29yZSxiKSxmdW5jdGlvbihhLGIpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBjKGEsYil7aWYodGhpcy5fdHJhY2tpbmdTZXJ2ZXI9bnVsbCx0aGlzLl9jaGVja1N0YXR1c1NlcnZlcj1udWxsLHRoaXMuX3B1Ymxpc2hlcj1udWxsLHRoaXMuX2lzQ29uZmlndXJlZD0hMSx0aGlzLl9pc0Rlc3Ryb3llZD0hMSx0aGlzLl9xdWlldE1vZGU9ITEsdGhpcy5fdmlzaXRvck9wdGVkT3V0PSExLHRoaXMuX3ByZXZSZXBvcnRTZW50PW51bGwsIWEpdGhyb3cgbmV3IEVycm9yKCJSZWZlcmVuY2UgdG8gdGhlIGNoYW5uZWwgb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7aWYodGhpcy5fY2hhbm5lbD1hLCFiKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBsb2dnZXIgb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7dGhpcy5fbG9nZ2VyPWIsdGhpcy5fc2VyaWFsaXplcj1uZXcgaShiKSx0aGlzLl9pbnN0YWxsRXZlbnRMaXN0ZW5lcnMoKX12YXIgZD1hLkV2ZW50LGU9YS5VUkxSZXF1ZXN0TWV0aG9kLGY9YS5VUkxSZXF1ZXN0LGc9YS5VUkxMb2FkZXIsaD1iLm5ldHdvcmsuU2V0dGluZ3NQYXJzZXIsaT1iLm1vZGVsLlF1ZXJ5c3RyaW5nU2VyaWFsaXplcjtjLnByb3RvdHlwZS5kZXN0cm95PWZ1bmN0aW9uKCl7dGhpcy5faXNEZXN0cm95ZWR8fCh0aGlzLl9pc0Rlc3Ryb3llZD0hMCx0aGlzLl9sb2dnZXIuZGVidWcoaiwiI2Rlc3Ryb3koKSIpLHRoaXMuX3VuaW5zdGFsbEV2ZW50TGlzdGVuZXJzKCkpfSxjLnByb3RvdHlwZS5fb25BcGlDb25maWc9ZnVuY3Rpb24oYSl7dmFyIGI9YS5kYXRhO3RoaXMuX2xvZ2dlci5kZWJ1ZyhqLCIjX29uQXBpQ29uZmlnKHNiX3NlcnZlcj0iK2Jba10rIiwgY2hlY2tfc3RhdHVzX3NlcnZlcj0iK2JbbF0rIiwgcHVibGlzaGVyPSIrYlttXSsiLCBxdWlldF9tb2RlPSIrYltuXSsiLCBzc2w9IitiW29dKyIpIiksdGhpcy5fdHJhY2tpbmdTZXJ2ZXI9dGhpcy5fdXBkYXRlUmVxdWVzdFByb3RvY29sKGJba10sYltvXSksdGhpcy5fY2hlY2tTdGF0dXNTZXJ2ZXI9dGhpcy5fdXBkYXRlUmVxdWVzdFByb3RvY29sKGJbbF0sYltvXSksdGhpcy5fcHVibGlzaGVyPWJbbV0sdGhpcy5fcXVpZXRNb2RlPWJbbl0sdGhpcy5faXNDb25maWd1cmVkPSEwfSxjLnByb3RvdHlwZS5fb25VcGRhdGVWaXNpdG9yT3B0T3V0PWZ1bmN0aW9uKGEpe3ZhciBiPWEuZGF0YTt0aGlzLl9sb2dnZXIuZGVidWcoaiwiI19vblVwZGF0ZVZpc2l0b3JPcHRPdXQodmlzaXRvcl9vcHRfb3V0PSIrYltxXSsiKSIpLHRoaXMuX3Zpc2l0b3JPcHRlZE91dD1iW3FdfSxjLnByb3RvdHlwZS5fb25GaWx0ZXJSZXBvcnRBdmFpbGFibGU9ZnVuY3Rpb24oYSl7dmFyIGI9YS5kYXRhO2lmKCF0aGlzLl9pc0NvbmZpZ3VyZWQpcmV0dXJuIHZvaWQgdGhpcy5fbG9nZ2VyLndhcm4oaiwiI19vbkZpbHRlclJlcG9ydEF2YWlsYWJsZSgpID4gVW5hYmxlIHRvIHNlbmQgcmVxdWVzdDogbm90IGNvbmZpZ3VyZWQuIik7dmFyIGM9YltwXSxoPXRoaXMuX3NlcmlhbGl6ZXIuc2VyaWFsaXplUmVwb3J0KGMpLGk9dGhpcy5fdHJhY2tpbmdTZXJ2ZXIrIi8/IitoLnNlcmlhbGl6ZWRPdXRwdXQ7aWYodGhpcy5fcHJldlJlcG9ydFNlbnQmJnRoaXMuX3ByZXZSZXBvcnRTZW50LmV2ZW50RGF0YSYmYy5ldmVudERhdGEmJnRoaXMuX3ByZXZSZXBvcnRTZW50LmV2ZW50RGF0YS5wbGF5aGVhZD09Yy5ldmVudERhdGEucGxheWhlYWQmJnRoaXMuX3ByZXZSZXBvcnRTZW50LmV2ZW50RGF0YS50cz09Yy5ldmVudERhdGEudHMmJnRoaXMuX3ByZXZSZXBvcnRTZW50LmV2ZW50RGF0YS5wcmV2VHM9PWMuZXZlbnREYXRhLnByZXZUcyYmdGhpcy5fcHJldlJlcG9ydFNlbnQuZXZlbnREYXRhLnR5cGU9PWMuZXZlbnREYXRhLnR5cGUpcmV0dXJuIHZvaWQgdGhpcy5fbG9nZ2VyLmRlYnVnKGosIiNfb25GaWx0ZXJSZXBvcnRBdmFpbGFibGUoKSA+IER1cGxpY2F0ZSBoZWFydGJlYXQgcmVwb3J0IG5vdCBzZW50IGZvciBVUkw6XFxuIitpKTt0aGlzLl9wcmV2UmVwb3J0U2VudD1jO3ZhciBrPW5ldyBmKGksZS5HRVQpO3RoaXMuX2xvZ2dlci5kZWJ1ZyhqLCIjX29uRmlsdGVyUmVwb3J0QXZhaWxhYmxlKCkgPiAiK2sudXJsKTt2YXIgbD10aGlzLG09ZnVuY3Rpb24oYSl7by5jbG9zZSgpLGguY2FsbGJhY2smJmguY2FsbGJhY2suY2FsbChudWxsKX0sbj1mdW5jdGlvbihhKXtvLmNsb3NlKCksbC5fbG9nZ2VyLndhcm4oaiwiI19vbkZpbHRlclJlcG9ydEF2YWlsYWJsZSgpID4gRmFpbGVkIHRvIHNlbmQgaGVhcnRiZWF0IHJlcG9ydC4iKSxoLmNhbGxiYWNrJiZoLmNhbGxiYWNrLmNhbGwobnVsbCl9O2lmKCF0aGlzLl9xdWlldE1vZGUmJiF0aGlzLl92aXNpdG9yT3B0ZWRPdXQpe3ZhciBvPW5ldyBnO28uYWRkRXZlbnRMaXN0ZW5lcihkLlNVQ0NFU1MsbSx0aGlzKSxvLmFkZEV2ZW50TGlzdGVuZXIoZC5FUlJPUixuLHRoaXMpLG8ubG9hZChrKX19LGMucHJvdG90eXBlLl9vbkNsb2NrQ2hlY2tTdGF0dXNUaWNrPWZ1bmN0aW9uKGEpe2Z1bmN0aW9uIGIoYSl7aWYoYS5kYXRhKXt2YXIgYj1uZXcgaChhLmRhdGEucmVzcG9uc2UsaS5fbG9nZ2VyKSxjPWIucGFyc2UoKTtjP2kuX2NoYW5uZWwudHJpZ2dlcihuZXcgZCh2LGMpKTppLl9sb2dnZXIud2FybihqLCIjX29uQ2xvY2tDaGVja1N0YXR1c1RpY2soKSA+IEZhaWxlZCB0byBwYXJzZSB0aGUgY29uZmlnLiBzZXR0aW5ncy4iKX1uLmNsb3NlKCl9ZnVuY3Rpb24gYyhhKXtpLl9sb2dnZXIud2FybihqLCIjX29uQ2xvY2tDaGVja1N0YXR1c1RpY2soKSA+IEZhaWxlZCB0byBvYnRhaW4gdGhlIGNvbmZpZy4gc2V0dGluZ3MuIiksbi5jbG9zZSgpfWlmKCF0aGlzLl9pc0NvbmZpZ3VyZWQpcmV0dXJuIHZvaWQgdGhpcy5fbG9nZ2VyLndhcm4oaiwiI19vbkNsb2NrQ2hlY2tTdGF0dXNUaWNrKCkgPiBVbmFibGUgdG8gc2VuZCByZXF1ZXN0OiBub3QgY29uZmlndXJlZC4iKTtpZighdGhpcy5fcHVibGlzaGVyKXJldHVybiB2b2lkIHRoaXMuX2xvZ2dlci53YXJuKGosIiNfb25DbG9ja0NoZWNrU3RhdHVzVGljaygpID4gUHVibGlzaGVyIGlzIE5VTEwuIik7dmFyIGk9dGhpcyxrPXRoaXMuX3B1Ymxpc2hlci5yZXBsYWNlKC9bXmEtekEtWjAtOV0rLywiLSIpLnRvTG9jYWxlTG93ZXJDYXNlKCksbD10aGlzLl9jaGVja1N0YXR1c1NlcnZlcitrKyIueG1sP3I9IisobmV3IERhdGUpLmdldFRpbWUoKSxtPW5ldyBmKGwsZS5HRVQpLG49bmV3IGc7bi5hZGRFdmVudExpc3RlbmVyKGQuU1VDQ0VTUyxiLHRoaXMpLG4uYWRkRXZlbnRMaXN0ZW5lcihkLkVSUk9SLGMsdGhpcyksdGhpcy5fbG9nZ2VyLmRlYnVnKGosIiNfb25DbG9ja0NoZWNrU3RhdHVzVGljaygpID4gR2V0IG5ldyBzZXR0aW5ncyBmcm9tOiAiK2wpLG4ubG9hZChtKX0sYy5wcm90b3R5cGUuX3VwZGF0ZVJlcXVlc3RQcm90b2NvbD1mdW5jdGlvbihhLGIpe3ZhciBjPWE7cmV0dXJuIDA9PT1jLmluZGV4T2YoImh0dHA6Ly8iKT9jPWMuc2xpY2UoNyk6MD09PWMuaW5kZXhPZigiaHR0cHM6Ly8iKSYmKGM9Yy5zbGljZSg4KSksYj8iaHR0cHM6Ly8iK2M6Imh0dHA6Ly8iK2N9LGMucHJvdG90eXBlLl9pbnN0YWxsRXZlbnRMaXN0ZW5lcnM9ZnVuY3Rpb24oKXt0aGlzLl9jaGFubmVsLm9uKHIsdGhpcy5fb25BcGlDb25maWcsdGhpcyksdGhpcy5fY2hhbm5lbC5vbihzLHRoaXMuX29uVXBkYXRlVmlzaXRvck9wdE91dCx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKHQsdGhpcy5fb25GaWx0ZXJSZXBvcnRBdmFpbGFibGUsdGhpcyksdGhpcy5fY2hhbm5lbC5vbih1LHRoaXMuX29uQ2xvY2tDaGVja1N0YXR1c1RpY2ssdGhpcyl9LGMucHJvdG90eXBlLl91bmluc3RhbGxFdmVudExpc3RlbmVycz1mdW5jdGlvbigpe3RoaXMuX2NoYW5uZWwub2ZmKG51bGwsbnVsbCx0aGlzKX07dmFyIGo9ImFoOjpOZXR3b3JrIixrPSJ0cmFja2luZ19zZXJ2ZXIiLGw9ImNoZWNrX3N0YXR1c19zZXJ2ZXIiLG09InB1Ymxpc2hlciIsbj0icXVpZXRfbW9kZSIsbz0ic3NsIixwPSJyZXBvcnQiLHE9InZpc2l0b3Jfb3B0X291dCIscj0iYXBpOmNvbmZpZyIscz0iYXBpOnVwZGF0ZV92aXNpdG9yX29wdG91dCIsdD0iZmlsdGVyOmRhdGFfYXZhaWxhYmxlIix1PSJjbG9jazpjaGVja19zdGF0dXMudGljayIsdj0ibmV0OmNoZWNrX3N0YXR1c19jb21wbGV0ZSI7Yi5uZXR3b3JrLk5ldHdvcms9Y30oYS5BREIuY29yZSxiKSxmdW5jdGlvbihhLGIpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBjKGEsYil7aWYoIWEpdGhyb3cgbmV3IEVycm9yKCJSZWZlcmVuY2UgdG8gdGhlIGNoYW5uZWwgb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7aWYodGhpcy5fY2hhbm5lbD1hLCFiKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBsb2dnZXIgb2JqZWN0IGNhbm5vdCBiZSBOVUxMIik7dGhpcy5fbG9nZ2VyPWIsdGhpcy5faXNEZXN0cm95ZWQ9ITEsdGhpcy5faXNCdWZmZXJpbmdJblByb2dyZXNzPSExLHRoaXMuX3JlcG9ydEJ1ZmZlcj17fSx0aGlzLl90c0hpc3Rvcnk9e30sdGhpcy5fd29ya1F1ZXVlPW5ldyBpLHRoaXMuX2luc3RhbGxFdmVudExpc3RlbmVycygpfWZ1bmN0aW9uIGQoYSl7dmFyIGI9W107cmV0dXJuIGEmJmEuZm9yRWFjaChmdW5jdGlvbihhKXthLmV2ZW50RGF0YS50eXBlKCk9PWsuRVZFTlRfVFlQRV9QQVVTRXx8YS5ldmVudERhdGEudHlwZSgpPT1rLkVWRU5UX1RZUEVfU1RBTEx8fGEuZXZlbnREYXRhLnR5cGUoKT09ay5FVkVOVF9UWVBFX0JVRkZFUj8oIWEuZmlsdGVyUmVwb3J0fHxhLmV2ZW50RGF0YS5kdXJhdGlvbigpPnUpJiZiLnB1c2goYSk6Yi5wdXNoKGEpfSksYn1mdW5jdGlvbiBlKGEpe3ZhciBiPS0xLGM9LTEsZD1bXTtyZXR1cm4gYS5mb3JFYWNoKGZ1bmN0aW9uKGEpe2EuZXZlbnREYXRhLnR5cGUoKT09ay5FVkVOVF9UWVBFX1NUQVJUP2EuYXNzZXREYXRhLnR5cGUoKT09bC5UWVBFX01BSU5fQ09OVEVOVD8tMT09Yj9iPWQucHVzaChhKS0xOihhLmV2ZW50RGF0YS5wcmV2VHMoLTEpLGRbYl09YSk6LTE9PWM/Yz1kLnB1c2goYSktMTooYS5ldmVudERhdGEucHJldlRzKC0xKSxkW2NdPWEpOmQucHVzaChhKX0pLGR9ZnVuY3Rpb24gZihhKXt2YXIgYj1bXTtyZXR1cm4gYS5mb3JFYWNoKGZ1bmN0aW9uKGMpe2lmKGMuZXZlbnREYXRhLnR5cGUoKT09ay5FVkVOVF9UWVBFX1BMQVkpe2lmKGMuZXZlbnREYXRhLmR1cmF0aW9uKCk+dCliLnB1c2goYyk7ZWxzZSBpZigwPT1jLmV2ZW50RGF0YS5kdXJhdGlvbigpJiZjLmFzc2V0RGF0YS50eXBlKCk9PWwuVFlQRV9NQUlOX0NPTlRFTlQpe3ZhciBkPWcoYSk7ZC5pbmRleE9mKGMpPT1kLmxlbmd0aC0xJiZiLnB1c2goYyl9fWVsc2UgYi5wdXNoKGMpfSksYn1mdW5jdGlvbiBnKGEpe3ZhciBiPVtdO3JldHVybiBhLmZvckVhY2goZnVuY3Rpb24oYSl7YS5ldmVudERhdGEudHlwZSgpIT1rLkVWRU5UX1RZUEVfUExBWSYmYS5ldmVudERhdGEudHlwZSgpIT1rLkVWRU5UX1RZUEVfQlVGRkVSJiZhLmV2ZW50RGF0YS50eXBlKCkhPWsuRVZFTlRfVFlQRV9TVEFSVHx8Yi5wdXNoKGEpfSksYn12YXIgaD1hLnJhZGlvLkNvbW1hbmQsaT1hLnJhZGlvLkNvbW1hbmRRdWV1ZSxqPWEuRXZlbnQsaz1iLm1vZGVsLkV2ZW50RGFvLGw9Yi5tb2RlbC5Bc3NldERhbztjLnByb3RvdHlwZS5kZXN0cm95PWZ1bmN0aW9uKCl7dGhpcy5faXNEZXN0cm95ZWR8fCh0aGlzLl9pc0Rlc3Ryb3llZD0hMCx0aGlzLl9sb2dnZXIuZGVidWcodywiI2Rlc3Ryb3koKSIpLHRoaXMuX3VuaW5zdGFsbEV2ZW50TGlzdGVuZXJzKCksdGhpcy5jbGVhcigpKX0sYy5wcm90b3R5cGUuY2xlYXI9ZnVuY3Rpb24oKXt0aGlzLl9sb2dnZXIuZGVidWcodywiI2NsZWFyKCkiKSx0aGlzLl93b3JrUXVldWUuY2FuY2VsQWxsQ29tbWFuZHMoKSx0aGlzLl9yZXBvcnRCdWZmZXI9e30sdGhpcy5fdHNIaXN0b3J5PXt9LHRoaXMuX2lzQnVmZmVyaW5nSW5Qcm9ncmVzcz0hMX0sYy5wcm90b3R5cGUuZmx1c2g9ZnVuY3Rpb24oKXt0aGlzLl93b3JrUXVldWUuYWRkQ29tbWFuZChuZXcgaCh0aGlzLl9mbHVzaEJ1ZmZlclJlcG9ydCx0aGlzKSl9LGMucHJvdG90eXBlLl9idWZmZXJSZXBvcnQ9ZnVuY3Rpb24oYSl7aWYoIXRoaXMuX2lzRGVzdHJveWVkKXt2YXIgYj1hW3FdO2lmKGIpe3ZhciBjPWIuc2Vzc2lvbkRhdGEuc2Vzc2lvbklkKCk7dGhpcy5fcmVwb3J0QnVmZmVyW2NdPXRoaXMuX3JlcG9ydEJ1ZmZlcltjXXx8W10sdGhpcy5fcmVwb3J0QnVmZmVyW2NdLnB1c2goYil9aWYoIXRoaXMuX2lzQnVmZmVyaW5nSW5Qcm9ncmVzcyl7dGhpcy5faXNCdWZmZXJpbmdJblByb2dyZXNzPSEwO3ZhciBkPXt9O2RbcF09ITAsZFtyXT0xLHRoaXMuX2NoYW5uZWwuY29tbWFuZChzLGQpfX19LGMucHJvdG90eXBlLl9mbHVzaEJ1ZmZlclJlcG9ydD1mdW5jdGlvbigpe2Z1bmN0aW9uIGEoYSl7aWYoYSlmb3IodmFyIGM9MDtjPGEubGVuZ3RoO2MrKyl7dmFyIGQ9YVtjXSxlPWQuc2Vzc2lvbkRhdGEuc2Vzc2lvbklkKCk7Yi5fdHNIaXN0b3J5W2VdPWIuX3RzSGlzdG9yeVtlXXx8e307dmFyIGY9ZC5ldmVudERhdGEudHlwZSgpKyIuIisoZC5hc3NldERhdGEudHlwZSgpPT1sLlRZUEVfQUQ/ZC5hc3NldERhdGEuYWREYXRhKCkuYWRJZCgpOmQuYXNzZXREYXRhLnZpZGVvSWQoKSk7Yi5fdHNIaXN0b3J5W2VdLmhhc093blByb3BlcnR5KGYpJiZkLmV2ZW50RGF0YS5wcmV2VHMoYi5fdHNIaXN0b3J5W2VdW2ZdKSxiLl90c0hpc3RvcnlbZV1bZl09ZC5ldmVudERhdGEudHMoKX19aWYoIXRoaXMuX2lzRGVzdHJveWVkKXt2YXIgYj10aGlzO2Zvcih2YXIgYyBpbiB0aGlzLl9yZXBvcnRCdWZmZXIpaWYodGhpcy5fcmVwb3J0QnVmZmVyLmhhc093blByb3BlcnR5KGMpKXt2YXIgZz1mKGUoZCh0aGlzLl9yZXBvcnRCdWZmZXJbY10pKSk7YShnKTtmb3IodmFyIGg9MDtoPGcubGVuZ3RoO2grKyl7dmFyIGk9Z1toXSxrPXt9O2tbcV09aSx0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGoobixrKSl9fXRoaXMuX3JlcG9ydEJ1ZmZlcj17fTt2YXIgbT10aGlzLl9jaGFubmVsLnJlcXVlc3Qodiksbz10aGlzLl90c0hpc3RvcnlbbV18fHt9O3RoaXMuX3RzSGlzdG9yeT17fSx0aGlzLl90c0hpc3RvcnlbbV09byx0aGlzLl9pc0J1ZmZlcmluZ0luUHJvZ3Jlc3M9ITF9fSxjLnByb3RvdHlwZS5fb25Db250ZXh0UmVwb3J0QXZhaWxhYmxlPWZ1bmN0aW9uKGEpe3ZhciBiPWEuZGF0YTt0aGlzLl93b3JrUXVldWUuYWRkQ29tbWFuZChuZXcgaCh0aGlzLl9idWZmZXJSZXBvcnQsdGhpcyxbYl0pKX0sYy5wcm90b3R5cGUuX29uQ2xvY2tGbHVzaEZpbHRlclRpY2s9ZnVuY3Rpb24oYSl7dGhpcy5mbHVzaCgpfSxjLnByb3RvdHlwZS5faW5zdGFsbEV2ZW50TGlzdGVuZXJzPWZ1bmN0aW9uKCl7dGhpcy5fY2hhbm5lbC5vbihtLHRoaXMuX29uQ29udGV4dFJlcG9ydEF2YWlsYWJsZSx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKG8sdGhpcy5fb25DbG9ja0ZsdXNoRmlsdGVyVGljayx0aGlzKX0sYy5wcm90b3R5cGUuX3VuaW5zdGFsbEV2ZW50TGlzdGVuZXJzPWZ1bmN0aW9uKCl7dGhpcy5fY2hhbm5lbC5vZmYobnVsbCxudWxsLHRoaXMpfTt2YXIgbT0iY29udGV4dDpyZXBvcnRfYXZhaWxhYmxlIixuPSJmaWx0ZXI6ZGF0YV9hdmFpbGFibGUiLG89ImNsb2NrOmZsdXNoX2ZpbHRlci50aWNrIixwPSJyZXNldCIscT0icmVwb3J0IixyPSJyZXBlYXRfY291bnQiLHM9ImNsb2NrOmZsdXNoX2ZpbHRlci5yZXN1bWUiLHQ9MjUwLHU9MjUwLHY9InNlc3Npb25faWQiLHc9ImFoOjpSZXBvcnRGaWx0ZXIiO2IuZmlsdGVyLlJlcG9ydEZpbHRlcj1jfShhLkFEQi5jb3JlLGIpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoYSxiKXt0aGlzLl9vbkZhaWw9e2ZuOmEsY3R4OmJ9fXZhciBkPWEuRXJyb3JJbmZvO2MucHJvdG90eXBlLnZhbGlkYXRlRmllbGRzPWZ1bmN0aW9uKGEsYil7aWYoIWEpcmV0dXJuIHRoaXMuX2ZhaWwoIkRhdGEgY2Fubm90IGJlIG51bGwiKTtpZihiKWZvcih2YXIgYz0wO2M8Yi5sZW5ndGg7YysrKXt2YXIgZD1iW2NdO3N3aXRjaChkKXtjYXNlInZpZGVvSWQiOmlmKCFhLmhhc093blByb3BlcnR5KCJ2aWRlb0lkIikpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBJRCBmb3IgdGhlIG1haW4gdmlkZW8gbXVzdCBiZSBzcGVjaWZpZWQuIik7aWYoInN0cmluZyIhPXR5cGVvZiBhLnZpZGVvSWQpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBJRCBmb3IgdGhlIG1haW4gdmlkZW8gbXVzdCBiZSBhIFN0cmluZy4iKTtpZigiIj09PWEudmlkZW9JZClyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIElEIGZvciB0aGUgbWFpbiB2aWRlbyBjYW5ub3QgYmUgYW4gZW1wdHkgc3RyaW5nLiIpO2JyZWFrO2Nhc2Uic3RyZWFtVHlwZSI6aWYoIWEuaGFzT3duUHJvcGVydHkoInN0cmVhbVR5cGUiKSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIHN0cmVhbSB0eXBlIGZvciB0aGUgbWFpbiB2aWRlbyBtdXN0IGJlIHNwZWNpZmllZC4iKTtpZigic3RyaW5nIiE9dHlwZW9mIGEuc3RyZWFtVHlwZSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIHN0cmVhbSB0eXBlIGZvciB0aGUgbWFpbiB2aWRlbyBtdXN0IGJlIGEgU3RyaW5nLiIpO2lmKCIiPT09YS5zdHJlYW1UeXBlKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgc3RyZWFtIHR5cGUgZm9yIHRoZSBtYWluIHZpZGVvIGNhbm5vdCBiZSBhbiBlbXB0eSBzdHJpbmcuIik7YnJlYWs7Y2FzZSJ2aWRlb0xlbmd0aCI6aWYoIWEuaGFzT3duUHJvcGVydHkoInZpZGVvTGVuZ3RoIikpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBsZW5ndGggb2YgdGhlIG1haW4gdmlkZW8gbXVzdCBiZSBzcGVjaWZpZWQuIik7aWYoIm51bWJlciIhPXR5cGVvZiBhLnZpZGVvTGVuZ3RoKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgbGVuZ3RoIG9mIHRoZSBtYWluIHZpZGVvIG11c3QgYmUgYSBOdW1iZXIuIik7aWYoaXNOYU4oYS52aWRlb0xlbmd0aCkpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBsZW5ndGggb2YgdGhlIG1haW4gdmlkZW8gY2Fubm90IGJlIE5hTi4iKTticmVhaztjYXNlInBsYXloZWFkIjppZighYS5oYXNPd25Qcm9wZXJ0eSgicGxheWhlYWQiKSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIHBsYXloZWFkIGZvciB0aGUgbWFpbiB2aWRlbyBtdXN0IGJlIHNwZWNpZmllZC4iKTtpZigibnVtYmVyIiE9dHlwZW9mIGEucGxheWhlYWQpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBwbGF5aGVhZCBmb3IgdGhlIG1haW4gdmlkZW8gbXVzdCBiZSBhIE51bWJlci4iKTtpZihpc05hTihhLnBsYXloZWFkKSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIHBsYXloZWFkIGZvciB0aGUgbWFpbiB2aWRlbyBjYW5ub3QgYmUgTmFOLiIpO2JyZWFrO2Nhc2UicGxheWVyTmFtZSI6aWYoIWEuaGFzT3duUHJvcGVydHkoInBsYXllck5hbWUiKSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIHBsYXllciBuYW1lIGZvciB0aGUgbWFpbiB2aWRlbyBtdXN0IGJlIHNwZWNpZmllZC4iKTtpZigic3RyaW5nIiE9dHlwZW9mIGEucGxheWVyTmFtZSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIHBsYXllciBuYW1lIGZvciB0aGUgbWFpbiB2aWRlbyBtdXN0IGJlIGEgU3RyaW5nLiIpO2lmKCIiPT09YS5wbGF5ZXJOYW1lKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgcGxheWVyIG5hbWUgZm9yIHRoZSBtYWluIHZpZGVvIGNhbm5vdCBiZSBhbiBlbXB0eSBzdHJpbmcuIik7YnJlYWs7Y2FzZSJyc2lkIjppZighYS5oYXNPd25Qcm9wZXJ0eSgicnNpZCIpKXJldHVybiB0aGlzLl9mYWlsKCJhY2NvdW50IChyc2lkKSBpcyByZXF1aXJlZCBhbmQgaGFzIHRvIGJlIHNldCBpbiB0aGUgQXBwTWVhc3VyZW1lbnQgaW5zdGFuY2UuIik7aWYoInN0cmluZyIhPXR5cGVvZiBhLnJzaWQpcmV0dXJuIHRoaXMuX2ZhaWwoImFjY291bnQgKHJzaWQpIG9mIHRoZSBBcHBNZWFzdXJlbWVudCBpbnN0YW5jZSBtdXN0IGJlIGEgU3RyaW5nLiIpO2lmKCIiPT09YS5yc2lkKXJldHVybiB0aGlzLl9mYWlsKCJhY2NvdW50IChyc2lkKSBvZiB0aGUgQXBwTWVhc3VyZW1lbnQgaW5zdGFuY2UgIGNhbm5vdCBiZSBhbiBlbXB0eSBzdHJpbmcuIik7YnJlYWs7Y2FzZSJ0cmFja2luZ1NlcnZlciI6aWYoIWEuaGFzT3duUHJvcGVydHkoInRyYWNraW5nU2VydmVyIikpcmV0dXJuIHRoaXMuX2ZhaWwoInRyYWNraW5nU2VydmVyIGlzIHJlcXVpcmVkIGFuZCBoYXMgdG8gYmUgc2V0IGluIHRoZSBBcHBNZWFzdXJlbWVudCBpbnN0YW5jZS4iKTtpZigic3RyaW5nIiE9dHlwZW9mIGEudHJhY2tpbmdTZXJ2ZXIpcmV0dXJuIHRoaXMuX2ZhaWwoInRyYWNraW5nU2VydmVyIG9mIHRoZSBBcHBNZWFzdXJlbWVudCBpbnN0YW5jZSBtdXN0IGJlIGEgU3RyaW5nLiIpO2lmKCIiPT09YS50cmFja2luZ1NlcnZlcilyZXR1cm4gdGhpcy5fZmFpbCgidHJhY2tpbmdTZXJ2ZXIgb2YgdGhlIEFwcE1lYXN1cmVtZW50IGluc3RhbmNlIGNhbm5vdCBiZSBhbiBlbXB0eSBzdHJpbmcuIik7YnJlYWs7Y2FzZSJwb2RQbGF5ZXJOYW1lIjppZighYS5oYXNPd25Qcm9wZXJ0eSgicG9kUGxheWVyTmFtZSIpKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgcGxheWVyIG5hbWUgZm9yIHRoZSBhZC1icmVhayBtdXN0IGJlIHNwZWNpZmllZC4iKTtpZigic3RyaW5nIiE9dHlwZW9mIGEucG9kUGxheWVyTmFtZSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIHBsYXllciBuYW1lIGZvciB0aGUgYWQtYnJlYWsgbXVzdCBiZSBhIFN0cmluZy4iKTtpZigiIj09PWEucG9kUGxheWVyTmFtZSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIHBsYXllciBuYW1lIGZvciB0aGUgYWQtYnJlYWsgY2Fubm90IGJlIGFuIGVtcHR5IHN0cmluZy4iKTticmVhaztjYXNlInBvZFBvc2l0aW9uIjppZighYS5oYXNPd25Qcm9wZXJ0eSgicG9kUG9zaXRpb24iKSlyZXR1cm4gdGhpcy5fZmFpbCgiUG9zaXRpb24gKGluZGV4KSBvZiB0aGUgYWQtYnJlYWsgbXVzdCBiZSBzcGVjaWZpZWQuIik7aWYoIm51bWJlciIhPXR5cGVvZiBhLnBvZFBvc2l0aW9uKXJldHVybiB0aGlzLl9mYWlsKCJQb3NpdGlvbiAoaW5kZXgpIG9mIHRoZSBhZC1icmVhayBtdXN0IGJlIGEgTnVtYmVyLiIpO2lmKGlzTmFOKGEucG9kUG9zaXRpb24pKXJldHVybiB0aGlzLl9mYWlsKCJQb3NpdGlvbiAoaW5kZXgpIG9mIHRoZSBhZC1icmVhayBjYW5ub3QgYmUgTmFOLiIpO2JyZWFrO2Nhc2UiYWRJZCI6aWYoIWEuaGFzT3duUHJvcGVydHkoImFkSWQiKSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIGFkIElEIG11c3QgYmUgc3BlY2lmaWVkLiIpO2lmKCJzdHJpbmciIT10eXBlb2YgYS5hZElkKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgYWQgSUQgbXVzdCBiZSBhIFN0cmluZy4iKTtpZigiIj09PWEuYWRJZClyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIGFkIElEIGNhbm5vdCBiZSBhbiBlbXB0eSBzdHJpbmcuIik7YnJlYWs7Y2FzZSJhZFBvc2l0aW9uIjppZighYS5oYXNPd25Qcm9wZXJ0eSgiYWRQb3NpdGlvbiIpKXJldHVybiB0aGlzLl9mYWlsKCJQb3NpdGlvbiAoaW5kZXgpIG9mIHRoZSBhZCBtdXN0IGJlIHNwZWNpZmllZC4iKTtpZigibnVtYmVyIiE9dHlwZW9mIGEuYWRQb3NpdGlvbilyZXR1cm4gdGhpcy5fZmFpbCgiUG9zaXRpb24gKGluZGV4KSBvZiB0aGUgYWQgbXVzdCBiZSBhIE51bWJlci4iKTtpZihpc05hTihhLmFkUG9zaXRpb24pKXJldHVybiB0aGlzLl9mYWlsKCJQb3NpdGlvbiAoaW5kZXgpIG9mIHRoZSBhZCBjYW5ub3QgYmUgTmFOLiIpO2JyZWFrO2Nhc2UiY2hhcHRlclBvc2l0aW9uIjppZighYS5oYXNPd25Qcm9wZXJ0eSgiY2hhcHRlclBvc2l0aW9uIikpcmV0dXJuIHRoaXMuX2ZhaWwoIlBvc2l0aW9uIChpbmRleCkgb2YgdGhlIGNoYXB0ZXIgbXVzdCBiZSBzcGVjaWZpZWQuIik7aWYoIm51bWJlciIhPXR5cGVvZiBhLmNoYXB0ZXJQb3NpdGlvbilyZXR1cm4gdGhpcy5fZmFpbCgiUG9zaXRpb24gKGluZGV4KSBvZiB0aGUgY2hhcHRlciBtdXN0IGJlIGEgTnVtYmVyLiIpO2lmKGlzTmFOKGEuY2hhcHRlclBvc2l0aW9uKSlyZXR1cm4gdGhpcy5fZmFpbCgiUG9zaXRpb24gKGluZGV4KSBvZiB0aGUgY2hhcHRlciBjYW5ub3QgYmUgTmFOLiIpO2JyZWFrO2Nhc2UiY2hhcHRlck9mZnNldCI6aWYoIWEuaGFzT3duUHJvcGVydHkoImNoYXB0ZXJPZmZzZXQiKSlyZXR1cm4gdGhpcy5fZmFpbCgiQ2hhcHRlciBzdGFydC10aW1lIChvZmZzZXQpIG11c3QgYmUgc3BlY2lmaWVkLiIpO2lmKCJudW1iZXIiIT10eXBlb2YgYS5jaGFwdGVyT2Zmc2V0KXJldHVybiB0aGlzLl9mYWlsKCJDaGFwdGVyIHN0YXJ0LXRpbWUgKG9mZnNldCkgbXVzdCBiZSBhIE51bWJlci4iKTtpZihpc05hTihhLmNoYXB0ZXJPZmZzZXQpKXJldHVybiB0aGlzLl9mYWlsKCJDaGFwdGVyIHN0YXJ0LXRpbWUgKG9mZnNldCkgY2Fubm90IGJlIE5hTi4iKTticmVhaztjYXNlImNoYXB0ZXJMZW5ndGgiOmlmKCFhLmhhc093blByb3BlcnR5KCJjaGFwdGVyTGVuZ3RoIikpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBsZW5ndGggb2YgdGhlIGNoYXB0ZXIgbXVzdCBiZSBzcGVjaWZpZWQuIik7aWYoIm51bWJlciIhPXR5cGVvZiBhLmNoYXB0ZXJMZW5ndGgpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBsZW5ndGggb2YgdGhlIGNoYXB0ZXIgbXVzdCBiZSBhIE51bWJlci4iKTtpZihpc05hTihhLmNoYXB0ZXJMZW5ndGgpKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgbGVuZ3RoIG9mIHRoZSBjaGFwdGVyIGNhbm5vdCBiZSBOYU4uIik7YnJlYWs7ZGVmYXVsdDpyZXR1cm4gdGhpcy5fZmFpbCgiVW5hYmxlIHRvIHZhbGlkYXRlIHVua25vd24gcGFyYW1ldGVyOiAiK2QpfX1yZXR1cm4hMH0sYy5wcm90b3R5cGUuX2ZhaWw9ZnVuY3Rpb24oYSl7dmFyIGI9bmV3IGQoIkludmFsaWQgaW5wdXQgZGF0YSIsYSk7cmV0dXJuIHRoaXMuX29uRmFpbC5mbiYmdGhpcy5fb25GYWlsLmZuLmNhbGwodGhpcy5fb25GYWlsLmN0eCxiKSwhMX0sYi5jb250ZXh0LklucHV0RGF0YVZhbGlkYXRvcj1jfShhLkFEQi52YSxiKSxmdW5jdGlvbihhLGIpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBjKGEsYil7aWYoIWIpdGhyb3cgbmV3IEVycm9yKCJSZWZlcmVuY2UgdG8gdGhlIGxvZ2dlciBvYmplY3QgY2Fubm90IGJlIE5VTEwiKTtpZih0aGlzLl9sb2dnZXI9YiwhYSl0aHJvdyBuZXcgRXJyb3IoIlJlZmVyZW5jZSB0byB0aGUgY29udGV4dCBvYmplY3QgY2Fubm90IGJlIE5VTEwiKTt0aGlzLl9jb250ZXh0PWF9dmFyIGQ9Yi5tb2RlbC5SZXBvcnQ7Yy5wcm90b3R5cGUuY3JlYXRlUmVwb3J0Rm9ySXRlbT1mdW5jdGlvbihhKXtyZXR1cm4gdGhpcy5fbG9nZ2VyLmRlYnVnKGUsIkNyZWF0aW5nIHJlcG9ydCBmb3IgaXRlbTogIithLmV2ZW50RGF0YS50eXBlKCkpLG5ldyBkKHRoaXMuX2NvbnRleHQuX2Fkb2JlQW5hbHl0aWNzRGF0YSx0aGlzLl9jb250ZXh0Ll91c2VyRGF0YSx0aGlzLl9jb250ZXh0Ll9hYW1EYXRhLHRoaXMuX2NvbnRleHQuX3NlcnZpY2VQcm92aWRlckRhdGEsdGhpcy5fY29udGV4dC5fc2Vzc2lvbkRhdGEsYSl9O3ZhciBlPSJhaDo6UmVwb3J0RmFjdG9yeSI7Yi5jb250ZXh0LlJlcG9ydEZhY3Rvcnk9Y30oYS5BREIuY29yZSxiKSxmdW5jdGlvbihhLGIsYyxkKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gZShhLGIpe2lmKCFhKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBjaGFubmVsIG9iamVjdCBjYW5ub3QgYmUgTlVMTCIpO2lmKHRoaXMuX2NoYW5uZWw9YSwhYil0aHJvdyBuZXcgRXJyb3IoIlJlZmVyZW5jZSB0byB0aGUgbG9nZ2VyIG9iamVjdCBjYW5ub3QgYmUgTlVMTCIpO3RoaXMuX2xvZ2dlcj1iLHRoaXMuX2xhc3RJbkJhbmRJdGVtPW51bGwsdGhpcy5fc3Rhc2hlZExhc3RJbkJhbmRJdGVtPW51bGwsdGhpcy5fc3Rhc2hlZE1haW5NZXRhZGF0YT1udWxsLHRoaXMuX2F1dG9Db21wdXRlZFN0YXJ0dXBUaW1lPTAsdGhpcy5fcmVwb3J0aW5nSW50ZXJ2YWw9bWEsdGhpcy5fYXNzZXREYXRhPW51bGwsdGhpcy5fc3RyZWFtRGF0YT1udWxsLHRoaXMuX3Fvc0RhdGE9bnVsbCx0aGlzLl9zZXNzaW9uRGF0YT1udWxsLHRoaXMuX2N1c2VyRGF0YT1udWxsLHRoaXMuX2Fkb2JlQW5hbHl0aWNzRGF0YT1uZXcgaix0aGlzLl9zZXJ2aWNlUHJvdmlkZXJEYXRhPW5ldyBrLHRoaXMuX3VzZXJEYXRhPW5ldyBsLHRoaXMuX2FhbURhdGE9bmV3IG0sdGhpcy5faXNUcmFja2luZ1Nlc3Npb25BY3RpdmU9ITEsdGhpcy5faXNWaWRlb0NvbXBsZXRlPSExLHRoaXMuX2lzRGVzdHJveWVkPSExLHRoaXMuX2RvTm90T3ZlcnJpZGVFdmVudER1cmF0aW9uPSExLHRoaXMuX3JlcG9ydEZhY3Rvcnk9bmV3IHUodGhpcyx0aGlzLl9sb2dnZXIpLHRoaXMuX2lucHV0RGF0YVZhbGlkYXRvcj1uZXcgdihmdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuZXJyb3IodyxhLmdldE1lc3NhZ2UoKSsiIHwgIithLmdldERldGFpbHMoKSksdGhpcy5fY2hhbm5lbC50cmlnZ2VyKG5ldyBoKHksYSkpfSx0aGlzKSx0aGlzLl90cmFja0V4dGVybmFsRXJyb3JzPSEwLHRoaXMuX2luc3RhbGxFdmVudExpc3RlbmVycygpfXZhciBmPWMubWQ1LGc9Yy5PYmplY3RVdGlscyxoPWEuRXZlbnQsaT1kLm1vZGVsLlNlc3Npb25EYW8saj1kLm1vZGVsLkFkb2JlQW5hbHl0aWNzRGFvLGs9ZC5tb2RlbC5TZXJ2aWNlUHJvdmlkZXJEYW8sbD1kLm1vZGVsLlVzZXJEYW8sbT1kLm1vZGVsLkF1ZGllbmNlTWFuYWdlckRhbyxuPWQubW9kZWwuRXZlbnREYW8sbz1kLm1vZGVsLkFzc2V0RGFvLHA9ZC5tb2RlbC5TdHJlYW1EYW8scT1kLm1vZGVsLlFvU0RhbyxyPWQubW9kZWwuQWREYW8scz1kLm1vZGVsLkNoYXB0ZXJEYW8sdD1kLm1vZGVsLlRyYWNrSXRlbSx1PWQuY29udGV4dC5SZXBvcnRGYWN0b3J5LHY9ZC5jb250ZXh0LklucHV0RGF0YVZhbGlkYXRvcjtlLnByb3RvdHlwZS5kZXN0cm95PWZ1bmN0aW9uKCl7dGhpcy5faXNEZXN0cm95ZWR8fCh0aGlzLl9pc0Rlc3Ryb3llZD0hMCx0aGlzLl9sb2dnZXIuZGVidWcodywiI2Rlc3Ryb3koKSIpLHRoaXMuX3VuaW5zdGFsbEV2ZW50TGlzdGVuZXJzKCkpfSxlLnByb3RvdHlwZS5fb25BcGlBbmFseXRpY3NTdGFydD1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaUFuYWx5dGljc1N0YXJ0KCkiKTt2YXIgYj1hLmRhdGE7aWYodGhpcy5fY2hlY2tDYWxsKCJfb25BcGlBbmFseXRpY3NTdGFydCIpJiZ0aGlzLl9pbnB1dERhdGFWYWxpZGF0b3IudmFsaWRhdGVGaWVsZHMoYixbInBsYXloZWFkIl0pKXt0aGlzLl91c2VyRGF0YS52aXNpdG9ySWQoYi52aWQpLHRoaXMuX3VzZXJEYXRhLmFuYWx5dGljc1Zpc2l0b3JJZChiLmFpZCksdGhpcy5fdXNlckRhdGEubWFya2V0aW5nQ2xvdWRWaXNpdG9ySWQoYi5taWQpLHRoaXMuX2FhbURhdGEuYXVkaWVuY2VNYW5hZ2VyQmxvYihiLmJsb2IpLHRoaXMuX2FhbURhdGEuYXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50KGIubG9jX2hpbnQpLGIuY3VzdG9tZXJJRHMmJih0aGlzLl9jdXNlckRhdGE9Yi5jdXN0b21lcklEcyksdGhpcy5fdXBkYXRlUW9TSW5mbyhiKTt2YXIgYz1uZXcgdCh0aGlzLG4uRVZFTlRfVFlQRV9BQV9TVEFSVCxiLnBsYXloZWFkLG51bGwsYi5fZXZlbnREYXRhW0VdKTtjLmFzc2V0RGF0YS5hZERhdGEobnVsbCksYy5hc3NldERhdGEudHlwZShvLlRZUEVfTUFJTl9DT05URU5UKSx0aGlzLl9jdXNlckRhdGE9bnVsbCx0aGlzLl9zZW5kSGl0KGMpfX0sZS5wcm90b3R5cGUuX29uQXBpQW5hbHl0aWNzQWRTdGFydD1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaUFuYWx5dGljc0FkU3RhcnQoKSIpO3ZhciBiPWEuZGF0YTtpZih0aGlzLl9jaGVja0NhbGwoIl9vbkFwaUFuYWx5dGljc0FkU3RhcnQiKSYmdGhpcy5faW5wdXREYXRhVmFsaWRhdG9yLnZhbGlkYXRlRmllbGRzKGIsWyJwbGF5aGVhZCJdKSl7dGhpcy5fdXBkYXRlUW9TSW5mbyhiKTt2YXIgYz1uZXcgdCh0aGlzLG4uRVZFTlRfVFlQRV9BQV9BRF9TVEFSVCxiLnBsYXloZWFkLG51bGwsYi5fZXZlbnREYXRhW0VdKTt0aGlzLl9zZW5kSGl0KGMpfX0sZS5wcm90b3R5cGUuX29uQXBpVmlkZW9Mb2FkPWZ1bmN0aW9uKGEpe3ZhciBiPWEuZGF0YTt0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaVZpZGVvTG9hZChyc2lkPSIrYi5yc2lkKyIsIGFhX3RyYWNraW5nU2VydmVyPSIrYi50cmFja2luZ1NlcnZlcisiKSIpLHRoaXMuX3Jlc2V0SW50ZXJuYWxTdGF0ZSgpLHRoaXMuX2lucHV0RGF0YVZhbGlkYXRvci52YWxpZGF0ZUZpZWxkcyhiLFsicnNpZCIsInRyYWNraW5nU2VydmVyIl0pJiYodGhpcy5fc2Vzc2lvbkRhdGEuc2Vzc2lvbklkKHRoaXMuX2dlbmVyYXRlU2Vzc2lvbklkKCkpLHRoaXMuX2lzVHJhY2tpbmdTZXNzaW9uQWN0aXZlPSEwKX0sZS5wcm90b3R5cGUuX29uQXBpVmlkZW9VbmxvYWQ9ZnVuY3Rpb24oYSl7aWYodGhpcy5fbG9nZ2VyLmRlYnVnKHcsIiNfb25BcGlWaWRlb1VubG9hZCgpIiksIXRoaXMuX2lzVHJhY2tpbmdTZXNzaW9uQWN0aXZlKXJldHVybiB2b2lkIHRoaXMuX2xvZ2dlci5kZWJ1Zyh3LCIjX29uQXBpVmlkZW9VbmxvYWQoKSA+IE5vIGFjdGl2ZSB0cmFja2luZyBzZXNzaW9uLiIpO3RoaXMuX2lzVHJhY2tpbmdTZXNzaW9uQWN0aXZlPSExfSxlLnByb3RvdHlwZS5fb25BcGlWaWRlb1N0YXJ0PWZ1bmN0aW9uKGEpe3ZhciBiPWEuZGF0YTtpZih0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaVZpZGVvU3RhcnQoaWQ9IitiLnZpZGVvSWQrIiwgbmFtZT0iK2IudmlkZW9OYW1lKyIsIGxlbmd0aD0iK2IudmlkZW9MZW5ndGgrIiwgdHlwZT0iK2Iuc3RyZWFtVHlwZSsiLCBwbGF5ZXJOYW1lPSIrYi5wbGF5ZXJOYW1lKyIpIiksdGhpcy5fY2hlY2tDYWxsKCJfb25BcGlWaWRlb1N0YXJ0IikmJnRoaXMuX2lucHV0RGF0YVZhbGlkYXRvci52YWxpZGF0ZUZpZWxkcyhiLFsidmlkZW9JZCIsInN0cmVhbVR5cGUiLCJ2aWRlb0xlbmd0aCIsInBsYXloZWFkIiwicGxheWVyTmFtZSJdKSl7dGhpcy5fbGFzdEluQmFuZEl0ZW09bnVsbCx0aGlzLl9zdGFzaGVkTGFzdEluQmFuZEl0ZW09bnVsbCx0aGlzLl9hZG9iZUFuYWx5dGljc0RhdGEucmVwb3J0U3VpdGVJZChiLnJzaWQpLHRoaXMuX2Fkb2JlQW5hbHl0aWNzRGF0YS50cmFja2luZ1NlcnZlcihiLnRyYWNraW5nU2VydmVyKSx0aGlzLl9hZG9iZUFuYWx5dGljc0RhdGEuc3NsKE51bWJlcihiLnVzZVNzbCkpLHRoaXMuX3NlcnZpY2VQcm92aWRlckRhdGEub3ZwKGIub3ZwKSx0aGlzLl9zZXJ2aWNlUHJvdmlkZXJEYXRhLnNkayhiLnNkayksdGhpcy5fc2VydmljZVByb3ZpZGVyRGF0YS5jaGFubmVsKGIuY2hhbm5lbCksdGhpcy5fc2VydmljZVByb3ZpZGVyRGF0YS5saWJWZXJzaW9uKGIudmVyc2lvbiksdGhpcy5fc2VydmljZVByb3ZpZGVyRGF0YS5hcGlMZXZlbChiLmFwaUx2bCksdGhpcy5fc2VydmljZVByb3ZpZGVyRGF0YS5wbGF5ZXJOYW1lKGIucGxheWVyTmFtZSksdGhpcy5fYXNzZXREYXRhLmFkRGF0YShudWxsKSx0aGlzLl9hc3NldERhdGEuY2hhcHRlckRhdGEobnVsbCksdGhpcy5fYXNzZXREYXRhLnZpZGVvSWQoYi52aWRlb0lkKSx0aGlzLl9hc3NldERhdGEubGVuZ3RoKGIudmlkZW9MZW5ndGgpLHRoaXMuX2Fzc2V0RGF0YS50eXBlKG8uVFlQRV9NQUlOX0NPTlRFTlQpLHRoaXMuX2Fzc2V0RGF0YS5wdWJsaXNoZXIoYi5wdWJsaXNoZXIpLHRoaXMuX2Fzc2V0RGF0YS5uYW1lKGIudmlkZW9OYW1lKSx0aGlzLl9zdHJlYW1EYXRhLnR5cGUoYi5zdHJlYW1UeXBlKSx0aGlzLl91cGRhdGVRb1NJbmZvKGIpO3ZhciBjPWIubWV0YU5pZWxzZW4/Zy5tZXJnZShiLm1ldGFWaWRlbyxiLm1ldGFOaWVsc2VuKTpiLm1ldGFWaWRlbyxkPW5ldyB0KHRoaXMsbi5FVkVOVF9UWVBFX1NUQVJULGIucGxheWhlYWQsYyxiLl9ldmVudERhdGFbRV0pO3RoaXMuX3NlbmRIaXQoZCl9fSxlLnByb3RvdHlwZS5fb25BcGlWaWRlb1Jlc3VtZT1mdW5jdGlvbihhKXt2YXIgYj1hLmRhdGE7aWYodGhpcy5fbG9nZ2VyLmRlYnVnKHcsIiNfb25BcGlWaWRlb1Jlc3VtZShpZD0iK2IudmlkZW9JZCsiLCBuYW1lPSIrYi52aWRlb05hbWUrIiwgbGVuZ3RoPSIrYi52aWRlb0xlbmd0aCsiLCB0eXBlPSIrYi5zdHJlYW1UeXBlKyIsIHBsYXllck5hbWU9IitiLnBsYXllck5hbWUrIikiKSx0aGlzLl9jaGVja0NhbGwoIl9vbkFwaVZpZGVvUmVzdW1lIikmJnRoaXMuX2lucHV0RGF0YVZhbGlkYXRvci52YWxpZGF0ZUZpZWxkcyhiLFsidmlkZW9JZCIsInN0cmVhbVR5cGUiLCJ2aWRlb0xlbmd0aCIsInBsYXloZWFkIiwicGxheWVyTmFtZSJdKSl7dGhpcy5fYXNzZXREYXRhLnZpZGVvSWQoYi52aWRlb0lkKSx0aGlzLl9hc3NldERhdGEubGVuZ3RoKGIudmlkZW9MZW5ndGgpLHRoaXMuX2Fzc2V0RGF0YS50eXBlKG8uVFlQRV9NQUlOX0NPTlRFTlQpLHRoaXMuX2Fzc2V0RGF0YS5uYW1lKGIudmlkZW9OYW1lKSx0aGlzLl9zdHJlYW1EYXRhLnR5cGUoYi5zdHJlYW1UeXBlKTt2YXIgYz1uZXcgdCh0aGlzLG4uRVZFTlRfVFlQRV9SRVNVTUUsYi5wbGF5aGVhZCxudWxsLGIuX2V2ZW50RGF0YVtFXSk7dGhpcy5fc2VuZEhpdChjKX19LGUucHJvdG90eXBlLl9vbkFwaVZpZGVvU2Vzc2lvbkVuZD1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaVZpZGVvU2Vzc2lvbkVuZCgpIik7dmFyIGI9YS5kYXRhO2lmKHRoaXMuX2NoZWNrQ2FsbCgiX29uQXBpVmlkZW9TZXNzaW9uRW5kIikmJnRoaXMuX2lucHV0RGF0YVZhbGlkYXRvci52YWxpZGF0ZUZpZWxkcyhiLFsicGxheWhlYWQiXSkpe3ZhciBjPW5ldyB0KHRoaXMsbi5FVkVOVF9UWVBFX0VORCxiLnBsYXloZWFkLG51bGwsYi5fZXZlbnREYXRhW0VdKTtjLmFzc2V0RGF0YS5hZERhdGEobnVsbCksYy5hc3NldERhdGEudHlwZShvLlRZUEVfTUFJTl9DT05URU5UKSx0aGlzLl9zZW5kSGl0KGMpfX0sZS5wcm90b3R5cGUuX29uQXBpVmlkZW9Db21wbGV0ZT1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaVZpZGVvQ29tcGxldGUoKSIpO3ZhciBiPWEuZGF0YTtpZih0aGlzLl9jaGVja0NhbGwoIl9vbkFwaVZpZGVvQ29tcGxldGUiKSl7dmFyIGM9bmV3IHQodGhpcyxuLkVWRU5UX1RZUEVfQ09NUExFVEUsdGhpcy5fYXNzZXREYXRhLmxlbmd0aCgpLG51bGwsYi5fZXZlbnREYXRhW0VdKTt0aGlzLl9zZW5kSGl0KGMpLHRoaXMuX2lzVmlkZW9Db21wbGV0ZT0hMH19LGUucHJvdG90eXBlLl9vbkFwaVZpZGVvU2tpcD1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaVZpZGVvU2tpcCgpIik7dmFyIGI9YS5kYXRhO2lmKHRoaXMuX2NoZWNrQ2FsbCgiX29uQXBpVmlkZW9Ta2lwIikpe3ZhciBjPW5ldyB0KHRoaXMsbi5FVkVOVF9UWVBFX1NLSVAsYi5wbGF5aGVhZCxudWxsLGIuX2V2ZW50RGF0YVtFXSk7dGhpcy5fc2VuZEhpdChjKSx0aGlzLl9pc1ZpZGVvQ29tcGxldGU9ITB9fSxlLnByb3RvdHlwZS5fb25BcGlQbGF5PWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh3LCIjX29uQXBpUGxheSgpIik7dmFyIGI9YS5kYXRhO2lmKHRoaXMuX2NoZWNrQ2FsbCgiX29uQXBpUGxheSIpJiZ0aGlzLl9pbnB1dERhdGFWYWxpZGF0b3IudmFsaWRhdGVGaWVsZHMoYixbInBsYXloZWFkIl0pKXt0aGlzLl91cGRhdGVRb1NJbmZvKGIpO3ZhciBjPW5ldyB0KHRoaXMsbi5FVkVOVF9UWVBFX1BMQVksYi5wbGF5aGVhZCxudWxsLGIuX2V2ZW50RGF0YVtFXSk7dGhpcy5fc2VuZEhpdChjKX19LGUucHJvdG90eXBlLl9vbkFwaVBhdXNlPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh3LCIjX29uQXBpUGF1c2UoKSIpO3ZhciBiPWEuZGF0YTtpZih0aGlzLl9jaGVja0NhbGwoIl9vbkFwaVBhdXNlIikmJnRoaXMuX2lucHV0RGF0YVZhbGlkYXRvci52YWxpZGF0ZUZpZWxkcyhiLFsicGxheWhlYWQiXSkpe3RoaXMuX3VwZGF0ZVFvU0luZm8oYik7dmFyIGM9Yi5wbGF5aGVhZFN0YWxsZWQ/bi5FVkVOVF9UWVBFX1NUQUxMOm4uRVZFTlRfVFlQRV9QQVVTRSxkPW5ldyB0KHRoaXMsYyxiLnBsYXloZWFkLG51bGwsYi5fZXZlbnREYXRhW0VdKTtiLl9ldmVudERhdGEuaGFzT3duUHJvcGVydHkoRikmJihkLmZpbHRlclJlcG9ydD1iLl9ldmVudERhdGFbRl0pLHRoaXMuX3NlbmRIaXQoZCl9fSxlLnByb3RvdHlwZS5fb25BcGlCdWZmZXJTdGFydD1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaUJ1ZmZlclN0YXJ0KCkiKTt2YXIgYj1hLmRhdGE7aWYodGhpcy5fY2hlY2tDYWxsKCJfb25BcGlCdWZmZXJTdGFydCIpJiZ0aGlzLl9pbnB1dERhdGFWYWxpZGF0b3IudmFsaWRhdGVGaWVsZHMoYixbInBsYXloZWFkIl0pKXt0aGlzLl91cGRhdGVRb1NJbmZvKGIpO3ZhciBjPW5ldyB0KHRoaXMsbi5FVkVOVF9UWVBFX0JVRkZFUixiLnBsYXloZWFkLG51bGwsYi5fZXZlbnREYXRhW0VdKTt0aGlzLl9zZW5kSGl0KGMpfX0sZS5wcm90b3R5cGUuX29uQXBpQWRCcmVha1N0YXJ0PWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh3LCIjX29uQXBpQWRCcmVha1N0YXJ0KCkiKTt2YXIgYj1hLmRhdGE7dGhpcy5fY2hlY2tDYWxsKCJfb25BcGlBZEJyZWFrU3RhcnQiKSYmdGhpcy5faW5wdXREYXRhVmFsaWRhdG9yLnZhbGlkYXRlRmllbGRzKGIsWyJwbGF5aGVhZCJdKSYmKHRoaXMuX2ZsdXNoTGFzdEluYmFuZEl0ZW0oYiksdGhpcy5fdXBkYXRlTGFzdEluYmFuZEl0ZW1Ub0J1ZmZlcmluZygpKX0sZS5wcm90b3R5cGUuX29uQXBpQWRCcmVha0NvbXBsZXRlPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh3LCIjX29uQXBpQWRCcmVha0NvbXBsZXRlKCkiKTt2YXIgYj1hLmRhdGE7dGhpcy5fY2hlY2tDYWxsKCJfb25BcGlBZEJyZWFrQ29tcGxldGUiKSYmdGhpcy5faW5wdXREYXRhVmFsaWRhdG9yLnZhbGlkYXRlRmllbGRzKGIsWyJwbGF5aGVhZCJdKSYmKHRoaXMuX2ZsdXNoTGFzdEluYmFuZEl0ZW0oYiksdGhpcy5fcmVzdG9yZUxhc3RJbmJhbmRJdGVtKCkpfSxlLnByb3RvdHlwZS5fb25BcGlBZFN0YXJ0PWZ1bmN0aW9uKGEpe3ZhciBiPWEuZGF0YTtpZih0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaUFkU3RhcnQoaWQ9IitiLmFkSWQrIiwgcGxheWVyX25hbWU9IitiLnBvZFBsYXllck5hbWUrIiwgcGFyZW50X25hbWU9Iit0aGlzLl9hc3NldERhdGEudmlkZW9JZCgpKyIsIHBvZF9wb3M9IitiLmFkUG9zaXRpb24rIikiKSx0aGlzLl9jaGVja0NhbGwoIl9vbkFwaUFkU3RhcnQiKSYmdGhpcy5faW5wdXREYXRhVmFsaWRhdG9yLnZhbGlkYXRlRmllbGRzKGIsWyJwbGF5aGVhZCIsInBvZFBvc2l0aW9uIiwicG9kUGxheWVyTmFtZSIsImFkSWQiLCJhZFBvc2l0aW9uIl0pKXt2YXIgYz1uZXcgcjtjLmFkSWQoYi5hZElkKSxjLmFkTmFtZShiLmFkTmFtZSksYy5hZExlbmd0aChiLmFkTGVuZ3RoKSxjLnJlc29sdmVyKGIucG9kUGxheWVyTmFtZSksYy5wb2RJZChmKHRoaXMuX2Fzc2V0RGF0YS52aWRlb0lkKCkpKyJfIitiLnBvZFBvc2l0aW9uKSxjLnBvZFBvc2l0aW9uKGIuYWRQb3NpdGlvbisiIiksYy5wb2ROYW1lKGIucG9kTmFtZSksYy5wb2RPZmZzZXQoYi5wb2RTZWNvbmQpLGMuc2lkKHRoaXMuX2dlbmVyYXRlU2Vzc2lvbklkKCkpLHRoaXMuX2Fzc2V0RGF0YS5hZERhdGEoYyksdGhpcy5fYXNzZXREYXRhLnR5cGUoby5UWVBFX0FEKSx0aGlzLl91cGRhdGVRb1NJbmZvKGIpO3ZhciBkPWcubWVyZ2UoYi5tZXRhVmlkZW8sYi5tZXRhQWQpO2Q9Yi5tZXRhTmllbHNlbj9nLm1lcmdlKGQsYi5tZXRhTmllbHNlbik6ZCxkPWIubWV0YUFkTmllbHNlbj9nLm1lcmdlKGQsYi5tZXRhQWROaWVsc2VuKTpkO3ZhciBlPW5ldyB0KHRoaXMsbi5FVkVOVF9UWVBFX1NUQVJULGIucGxheWhlYWQsZCxiLl9ldmVudERhdGFbRV0pO3RoaXMuX3NlbmRIaXQoZSksdGhpcy5fcmVzdG9yZUxhc3RJbmJhbmRJdGVtKCk7aWYoISFiLmFkR3JhbnVsYXJUcmFja2luZyl7dmFyIGg9Yi5hZFRyYWNraW5nSW50ZXJ2YWw/Yi5hZFRyYWNraW5nSW50ZXJ2YWw6dGhpcy5fcmVwb3J0aW5nSW50ZXJ2YWw7dGhpcy5fdXBkYXRlUmVwb3J0aW5nSW50ZXJ2YWwoaCwhMCl9fX0sZS5wcm90b3R5cGUuX29uQXBpQWRDb21wbGV0ZT1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaUFkQ29tcGxldGUoKSIpO3ZhciBiPWEuZGF0YTtpZih0aGlzLl9jaGVja0NhbGwoIl9vbkFwaUFkQ29tcGxldGUiKSYmdGhpcy5faW5wdXREYXRhVmFsaWRhdG9yLnZhbGlkYXRlRmllbGRzKGIsWyJwbGF5aGVhZCJdKSl7aWYodGhpcy5fYXNzZXREYXRhLnR5cGUoKSE9by5UWVBFX0FEKXJldHVybiB2b2lkIHRoaXMuX2xvZ2dlci53YXJuKHcsIiNfb25BcGlBZENvbXBsZXRlKCkgPiBJZ25vcmluZyB0aGUgYWQgY29tcGxldGUgZXZlbnQsIGJlY2F1c2Ugd2UgYXJlIG5vIGxvbmdlciBpbiBhbiBhZC4iKTt0aGlzLl91cGRhdGVRb1NJbmZvKGIpO3ZhciBjPW5ldyB0KHRoaXMsbi5FVkVOVF9UWVBFX0NPTVBMRVRFLGIucGxheWhlYWQsbnVsbCxiLl9ldmVudERhdGFbRV0pO3RoaXMuX3NlbmRIaXQoYyksdGhpcy5fdXBkYXRlTGFzdEluYmFuZEl0ZW1Ub0J1ZmZlcmluZygpLHRoaXMuX2Fzc2V0RGF0YS5hZERhdGEobnVsbCksdGhpcy5fYXNzZXREYXRhLnR5cGUoby5UWVBFX01BSU5fQ09OVEVOVCksdGhpcy5fdXBkYXRlUmVwb3J0aW5nSW50ZXJ2YWwodGhpcy5fcmVwb3J0aW5nSW50ZXJ2YWwsITEpfX0sZS5wcm90b3R5cGUuX29uQXBpQWRTa2lwPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh3LCIjX29uQXBpQWRTa2lwKCkiKTt2YXIgYj1hLmRhdGE7aWYodGhpcy5fY2hlY2tDYWxsKCJfb25BcGlBZFNraXAiKSYmdGhpcy5faW5wdXREYXRhVmFsaWRhdG9yLnZhbGlkYXRlRmllbGRzKGIsWyJwbGF5aGVhZCJdKSl7aWYodGhpcy5fYXNzZXREYXRhLnR5cGUoKSE9by5UWVBFX0FEKXJldHVybiB2b2lkIHRoaXMuX2xvZ2dlci53YXJuKHcsIiNfb25BcGlBZFNraXAoKSA+IElnbm9yaW5nIHRoZSBhZCBza2lwIGV2ZW50LCBiZWNhdXNlIHdlIGFyZSBubyBsb25nZXIgaW4gYW4gYWQuIik7dGhpcy5fdXBkYXRlUW9TSW5mbyhiKTt2YXIgYz1uZXcgdCh0aGlzLG4uRVZFTlRfVFlQRV9TS0lQLGIucGxheWhlYWQsbnVsbCxiLl9ldmVudERhdGFbRV0pO3RoaXMuX3NlbmRIaXQoYyksdGhpcy5fdXBkYXRlTGFzdEluYmFuZEl0ZW1Ub0J1ZmZlcmluZygpLHRoaXMuX2Fzc2V0RGF0YS5hZERhdGEobnVsbCksdGhpcy5fYXNzZXREYXRhLnR5cGUoby5UWVBFX01BSU5fQ09OVEVOVCksdGhpcy5fdXBkYXRlUmVwb3J0aW5nSW50ZXJ2YWwodGhpcy5fcmVwb3J0aW5nSW50ZXJ2YWwsITEpfX0sZS5wcm90b3R5cGUuX29uQXBpQ2hhcHRlclN0YXJ0PWZ1bmN0aW9uKGEpe3ZhciBiPWEuZGF0YTtpZih0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaUNoYXB0ZXJTdGFydChuYW1lPSIrYi5jaGFwdGVyTmFtZSsiLCBsZW5ndGg9IitiLmNoYXB0ZXJMZW5ndGgrIiwgcG9zaXRpb249IitiLmNoYXB0ZXJQb3NpdGlvbisiLCBjaGFwdGVyX29mZnNldD0iK2IuY2hhcHRlck9mZnNldCsiKSIpLHRoaXMuX2NoZWNrQ2FsbCgiX29uQXBpQ2hhcHRlclN0YXJ0IikmJnRoaXMuX2lucHV0RGF0YVZhbGlkYXRvci52YWxpZGF0ZUZpZWxkcyhiLFsicGxheWhlYWQiLCJjaGFwdGVyUG9zaXRpb24iLCJjaGFwdGVyT2Zmc2V0IiwiY2hhcHRlckxlbmd0aCJdKSl7dmFyIGM9bmV3IHM7Yy5pZChmKHRoaXMuX2Fzc2V0RGF0YS52aWRlb0lkKCkpKyJfIitiLmNoYXB0ZXJQb3NpdGlvbiksYy5uYW1lKGIuY2hhcHRlck5hbWUpLGMubGVuZ3RoKGIuY2hhcHRlckxlbmd0aCksYy5wb3NpdGlvbihiLmNoYXB0ZXJQb3NpdGlvbiksYy5vZmZzZXQoYi5jaGFwdGVyT2Zmc2V0KSxjLnNpZCh0aGlzLl9nZW5lcmF0ZVNlc3Npb25JZCgpKSx0aGlzLl9hc3NldERhdGEuY2hhcHRlckRhdGEoYyksdGhpcy5fdXBkYXRlUW9TSW5mbyhiKTt2YXIgZD1nLm1lcmdlKGIubWV0YVZpZGVvLGIubWV0YUNoYXB0ZXIpLGU9bmV3IHQodGhpcyxuLkVWRU5UX1RZUEVfQ0hBUFRFUl9TVEFSVCxiLnBsYXloZWFkLGQsYi5fZXZlbnREYXRhW0VdKTtlLmFzc2V0RGF0YS5hZERhdGEobnVsbCksZS5hc3NldERhdGEudHlwZShvLlRZUEVfTUFJTl9DT05URU5UKSx0aGlzLl9zZW5kSGl0KGUpfX0sZS5wcm90b3R5cGUuX29uQXBpQ2hhcHRlckNvbXBsZXRlPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh3LCIjX29uQXBpQ2hhcHRlckNvbXBsZXRlKCkiKTt2YXIgYj1hLmRhdGE7aWYodGhpcy5fY2hlY2tDYWxsKCJfb25BcGlDaGFwdGVyQ29tcGxldGUiKSYmdGhpcy5faW5wdXREYXRhVmFsaWRhdG9yLnZhbGlkYXRlRmllbGRzKGIsWyJwbGF5aGVhZCJdKSl7aWYoIXRoaXMuX2Fzc2V0RGF0YS5jaGFwdGVyRGF0YSgpKXJldHVybiB2b2lkIHRoaXMuX2xvZ2dlci53YXJuKHcsIiNfb25BcGlDaGFwdGVyQ29tcGxldGUoKSA+IElnbm9yaW5nIHRoZSBjaGFwdGVyIGNvbXBsZXRlIGV2ZW50LCBiZWNhdXNlIHdlIGFyZSBubyBsb25nZXIgaW4gYSBjaGFwdGVyLiIpO3RoaXMuX3VwZGF0ZVFvU0luZm8oYik7dmFyIGM9bmV3IHQodGhpcyxuLkVWRU5UX1RZUEVfQ0hBUFRFUl9DT01QTEVURSxiLnBsYXloZWFkLG51bGwsYi5fZXZlbnREYXRhW0VdKTtjLmFzc2V0RGF0YS5hZERhdGEobnVsbCksYy5hc3NldERhdGEudHlwZShvLlRZUEVfTUFJTl9DT05URU5UKSx0aGlzLl9zZW5kSGl0KGMpLHRoaXMuX2Fzc2V0RGF0YS5jaGFwdGVyRGF0YShudWxsKX19LGUucHJvdG90eXBlLl9vbkFwaUNoYXB0ZXJTa2lwPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh3LCIjX29uQXBpQ2hhcHRlclNraXAoKSIpO3ZhciBiPWEuZGF0YTtpZih0aGlzLl9jaGVja0NhbGwoIl9vbkFwaUNoYXB0ZXJTa2lwIikmJnRoaXMuX2lucHV0RGF0YVZhbGlkYXRvci52YWxpZGF0ZUZpZWxkcyhiLFsicGxheWhlYWQiXSkpe2lmKCF0aGlzLl9hc3NldERhdGEuY2hhcHRlckRhdGEoKSlyZXR1cm4gdm9pZCB0aGlzLl9sb2dnZXIud2Fybih3LCIjX29uQXBpQ2hhcHRlclNraXAoKSA+IElnbm9yaW5nIHRoZSBjaGFwdGVyIHNraXAgZXZlbnQsIGJlY2F1c2Ugd2UgYXJlIG5vIGxvbmdlciBpbiBhIGNoYXB0ZXIuIik7dGhpcy5fdXBkYXRlUW9TSW5mbyhiKTt2YXIgYz1uZXcgdCh0aGlzLG4uRVZFTlRfVFlQRV9DSEFQVEVSX1NLSVAsYi5wbGF5aGVhZCxudWxsLGIuX2V2ZW50RGF0YVtFXSk7Yy5hc3NldERhdGEuYWREYXRhKG51bGwpLGMuYXNzZXREYXRhLnR5cGUoby5UWVBFX01BSU5fQ09OVEVOVCksdGhpcy5fc2VuZEhpdChjKSx0aGlzLl9hc3NldERhdGEuY2hhcHRlckRhdGEobnVsbCl9fSxlLnByb3RvdHlwZS5fb25BcGlCaXRyYXRlQ2hhbmdlPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh3LCIjX29uQXBpQml0cmF0ZUNoYW5nZSgpIik7dmFyIGI9YS5kYXRhO2lmKHRoaXMuX2NoZWNrQ2FsbCgiX29uQXBpQml0cmF0ZUNoYW5nZSIpJiZ0aGlzLl9pbnB1dERhdGFWYWxpZGF0b3IudmFsaWRhdGVGaWVsZHMoYixbInBsYXloZWFkIl0pKXt0aGlzLl91cGRhdGVRb1NJbmZvKGIpO3ZhciBjPW5ldyB0KHRoaXMsbi5FVkVOVF9UWVBFX0JJVFJBVEVfQ0hBTkdFLGIucGxheWhlYWQsbnVsbCxiLl9ldmVudERhdGFbRV0pO3RoaXMuX3NlbmRIaXQoYyl9fSxlLnByb3RvdHlwZS5fb25BcGlUcmFja0Vycm9yPWZ1bmN0aW9uKGEpe3ZhciBiPWEuZGF0YTtpZih0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaVRyYWNrRXJyb3Ioc291cmNlPSIrYi5fZXZlbnREYXRhLnNvdXJjZSsiLCBlcnJfaWQ9IitiLl9ldmVudERhdGEuZXJyb3JfaWQrIikiKSwhdGhpcy5faXNUcmFja2luZ1Nlc3Npb25BY3RpdmUpcmV0dXJuIHZvaWQgdGhpcy5fbG9nZ2VyLndhcm4odywiI19vbkFwaVRyYWNrRXJyb3IoKSA+IE5vIGFjdGl2ZSB0cmFja2luZyBzZXNzaW9uLiIpO2lmKHRoaXMuX3RyYWNrRXh0ZXJuYWxFcnJvcnN8fGIuX2V2ZW50RGF0YS5zb3VyY2U9PT14KXt0aGlzLl91cGRhdGVRb1NJbmZvKGIpO3ZhciBjPW5ldyB0KHRoaXMsbi5FVkVOVF9UWVBFX0VSUk9SLDAsbnVsbCxiLl9ldmVudERhdGFbRV0pO2MuZXZlbnREYXRhLmlkKGIuX2V2ZW50RGF0YS5lcnJvcl9pZCksYy5ldmVudERhdGEuc291cmNlKGIuX2V2ZW50RGF0YS5zb3VyY2UpLHRoaXMuX3NlbmRIaXQoYyl9fSxlLnByb3RvdHlwZS5fb25BcGlUcmFja0ludGVybmFsRXJyb3I9ZnVuY3Rpb24oYSl7dmFyIGI9YS5kYXRhO3RoaXMuX2xvZ2dlci5kZWJ1Zyh3LCIjX29uQXBpVHJhY2tJbnRlcm5hbEVycm9yKHNvdXJjZT0iK2Iuc291cmNlKyIsIGVycl9pZD0iK2IuZXJyb3JfaWQrIikiKSx0aGlzLl91cGRhdGVRb1NJbmZvKGIpO3ZhciBjPW5ldyB0KHRoaXMsbi5FVkVOVF9UWVBFX0VSUk9SLDApO2MuZXZlbnREYXRhLmlkKGIuZXJyb3JfaWQpLGMuZXZlbnREYXRhLnNvdXJjZShiLnNvdXJjZSksdGhpcy5fc2VuZEhpdChjKX0sZS5wcm90b3R5cGUuX29uQXBpUXVhbnR1bUVuZD1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuZGVidWcodywiI19vbkFwaVF1YW50dW1FbmQoaW50ZXJ2YWw9Iit0aGlzLl9jaGFubmVsLnJlcXVlc3QoQikrIikiKTt2YXIgYj1hLmRhdGE7aWYodGhpcy5fY2hlY2tDYWxsKCJfb25BcGlRdWFudHVtRW5kIikmJnRoaXMuX2lucHV0RGF0YVZhbGlkYXRvci52YWxpZGF0ZUZpZWxkcyhiLFsicGxheWhlYWQiXSkpe3ZhciBjPXRoaXMuX2xhc3RJbkJhbmRJdGVtO2lmKGMpe3RoaXMuX3VwZGF0ZVFvU0luZm8oYik7dmFyIGQ9bmV3IHQodGhpcyxjLmV2ZW50RGF0YS50eXBlKCksYi5wbGF5aGVhZCxjLm1ldGEsYy5jYWxsYmFjayk7ZC5maWx0ZXJSZXBvcnQ9Yy5maWx0ZXJSZXBvcnQsdGhpcy5fc2VuZEhpdChkLCEwKX19fSxlLnByb3RvdHlwZS5fb25OZXR3b3JrQ2hlY2tTdGF0dXNDb21wbGV0ZT1mdW5jdGlvbihhKXt2YXIgYj1hLmRhdGE7dGhpcy5fdHJhY2tFeHRlcm5hbEVycm9ycz1iW0ldLHRoaXMuX3JlcG9ydGluZ0ludGVydmFsPWJbSl0sdGhpcy5fcmVwb3J0aW5nSW50ZXJ2YWx8fCh0aGlzLl9yZXBvcnRpbmdJbnRlcnZhbD1tYSksdGhpcy5fbG9nZ2VyLmRlYnVnKHcsIiNfb25OZXR3b3JrQ2hlY2tTdGF0dXNDb21wbGV0ZSh0cmFja19leHRfZXJyPSIrdGhpcy5fdHJhY2tFeHRlcm5hbEVycm9ycysiKSIpfSxlLnByb3RvdHlwZS5fb25SZXNldFNlc3Npb25JZD1mdW5jdGlvbihhKXt2YXIgYj10aGlzLl9nZW5lcmF0ZVNlc3Npb25JZCgpO3RoaXMuX3Nlc3Npb25EYXRhPW5ldyBpLHRoaXMuX3Nlc3Npb25EYXRhLnNlc3Npb25JZChiKSx0aGlzLl9sb2dnZXIuZGVidWcodywiI19yZXNldFNlc3Npb25JZChuZXcgc2Vzc2lvbklkPSIrYisiKSIpfSxlLnByb3RvdHlwZS5faW5zdGFsbEV2ZW50TGlzdGVuZXJzPWZ1bmN0aW9uKCl7dGhpcy5fY2hhbm5lbC5vbihMLHRoaXMuX29uQXBpQW5hbHl0aWNzU3RhcnQsdGhpcyksdGhpcy5fY2hhbm5lbC5vbihNLHRoaXMuX29uQXBpQW5hbHl0aWNzQWRTdGFydCx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKE4sdGhpcy5fb25BcGlWaWRlb0xvYWQsdGhpcyksdGhpcy5fY2hhbm5lbC5vbihPLHRoaXMuX29uQXBpVmlkZW9VbmxvYWQsdGhpcyksdGhpcy5fY2hhbm5lbC5vbihQLHRoaXMuX29uQXBpVmlkZW9TdGFydCx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKFEsdGhpcy5fb25BcGlWaWRlb0NvbXBsZXRlLHRoaXMpLHRoaXMuX2NoYW5uZWwub24oUix0aGlzLl9vbkFwaVZpZGVvU2tpcCx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKFMsdGhpcy5fb25BcGlWaWRlb1Jlc3VtZSx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKFQsdGhpcy5fb25BcGlWaWRlb1Nlc3Npb25FbmQsdGhpcyksdGhpcy5fY2hhbm5lbC5vbihVLHRoaXMuX29uQXBpQWRCcmVha1N0YXJ0LHRoaXMpLHRoaXMuX2NoYW5uZWwub24oVix0aGlzLl9vbkFwaUFkQnJlYWtDb21wbGV0ZSx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKFcsdGhpcy5fb25BcGlBZFN0YXJ0LHRoaXMpLHRoaXMuX2NoYW5uZWwub24oWCx0aGlzLl9vbkFwaUFkQ29tcGxldGUsdGhpcyksdGhpcy5fY2hhbm5lbC5vbihZLHRoaXMuX29uQXBpQWRTa2lwLHRoaXMpLHRoaXMuX2NoYW5uZWwub24oWix0aGlzLl9vbkFwaVBsYXksdGhpcyksdGhpcy5fY2hhbm5lbC5vbigkLHRoaXMuX29uQXBpUGF1c2UsdGhpcyksdGhpcy5fY2hhbm5lbC5vbihfLHRoaXMuX29uQXBpQnVmZmVyU3RhcnQsdGhpcyksdGhpcy5fY2hhbm5lbC5vbihhYSx0aGlzLl9vbkFwaUNoYXB0ZXJTdGFydCx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKGJhLHRoaXMuX29uQXBpQ2hhcHRlckNvbXBsZXRlLHRoaXMpLHRoaXMuX2NoYW5uZWwub24oY2EsdGhpcy5fb25BcGlDaGFwdGVyU2tpcCx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKGZhLHRoaXMuX29uQXBpQml0cmF0ZUNoYW5nZSx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKGRhLHRoaXMuX29uQXBpVHJhY2tFcnJvcix0aGlzKSx0aGlzLl9jaGFubmVsLm9uKGVhLHRoaXMuX29uQXBpVHJhY2tJbnRlcm5hbEVycm9yLHRoaXMpLHRoaXMuX2NoYW5uZWwub24oZ2EsdGhpcy5fb25BcGlRdWFudHVtRW5kLHRoaXMpLHRoaXMuX2NoYW5uZWwub24oaWEsdGhpcy5fb25OZXR3b3JrQ2hlY2tTdGF0dXNDb21wbGV0ZSx0aGlzKSx0aGlzLl9jaGFubmVsLm9uKEQsdGhpcy5fb25SZXNldFNlc3Npb25JZCx0aGlzKSx0aGlzLl9jaGFubmVsLnJlcGx5KEMsZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5fc2Vzc2lvbkRhdGEmJnRoaXMuX3Nlc3Npb25EYXRhLnNlc3Npb25JZCgpP3RoaXMuX3Nlc3Npb25EYXRhLnNlc3Npb25JZCgpOm51bGx9LHRoaXMpfSxlLnByb3RvdHlwZS5fdW5pbnN0YWxsRXZlbnRMaXN0ZW5lcnM9ZnVuY3Rpb24oKXt0aGlzLl9jaGFubmVsLm9mZihudWxsLG51bGwsdGhpcyl9LGUucHJvdG90eXBlLl9yZXNldEludGVybmFsU3RhdGU9ZnVuY3Rpb24oKXt0aGlzLl9sb2dnZXIuZGVidWcodywiI19yZXNldEludGVybmFsU3RhdGUoKSIpLHRoaXMuX2lzVHJhY2tpbmdTZXNzaW9uQWN0aXZlPSExLHRoaXMuX2lzVmlkZW9Db21wbGV0ZT0hMSx0aGlzLl9hdXRvQ29tcHV0ZWRTdGFydHVwVGltZT0wLHRoaXMuX2xhc3RJbkJhbmRJdGVtPW51bGwsdGhpcy5fc3Rhc2hlZExhc3RJbkJhbmRJdGVtPW51bGwsdGhpcy5fc3RyZWFtRGF0YT1uZXcgcCx0aGlzLl9xb3NEYXRhPW5ldyBxLHRoaXMuX3Nlc3Npb25EYXRhPW5ldyBpLHRoaXMuX2Fzc2V0RGF0YT1uZXcgbyx0aGlzLl9jdXNlckRhdGE9bnVsbH0sZS5wcm90b3R5cGUuX2dlbmVyYXRlU2Vzc2lvbklkPWZ1bmN0aW9uKCl7cmV0dXJuIiIrKG5ldyBEYXRlKS5nZXRUaW1lKCkrTWF0aC5mbG9vcigxZTkqTWF0aC5yYW5kb20oKSl9LGUucHJvdG90eXBlLl91cGRhdGVRb1NJbmZvPWZ1bmN0aW9uKGEpe3RoaXMuX3Fvc0RhdGEuYml0cmF0ZShhLmJpdHJhdGV8fDApLHRoaXMuX3Fvc0RhdGEuZnBzKGEuZnBzfHwwKSx0aGlzLl9xb3NEYXRhLmRyb3BwZWRGcmFtZXMoYS5kcm9wcGVkRnJhbWVzfHwwKSxudWxsPT1hLnN0YXJ0dXBUaW1lfHxpc05hTihhLnN0YXJ0dXBUaW1lKT8odGhpcy5fcW9zRGF0YS5zdGFydHVwVGltZSh0aGlzLl9hdXRvQ29tcHV0ZWRTdGFydHVwVGltZSksdGhpcy5fcW9zRGF0YS5pc1N0YXJ0dXBUaW1lT3ZlcnJpZGRlbj0hMSk6KHRoaXMuX3Fvc0RhdGEuc3RhcnR1cFRpbWUoYS5zdGFydHVwVGltZSksdGhpcy5fcW9zRGF0YS5pc1N0YXJ0dXBUaW1lT3ZlcnJpZGRlbj0hMCl9LGUucHJvdG90eXBlLl9jaGVja0NhbGw9ZnVuY3Rpb24oYSl7cmV0dXJuIHRoaXMuX2lzVHJhY2tpbmdTZXNzaW9uQWN0aXZlPyF0aGlzLl9pc1ZpZGVvQ29tcGxldGV8fCJfb25BcGlWaWRlb1Nlc3Npb25FbmQiPT09YXx8KHRoaXMuX2xvZ2dlci53YXJuKHcsIiMiK2ErIigpID4gVGhlIHZpZGVvIGNvbnRlbnQgYWxyZWFkeSBjb21wbGV0ZWQuIiksITEpOih0aGlzLl9sb2dnZXIud2Fybih3LCIjIithKyIoKSA+IE5vIGFjdGl2ZSB0cmFja2luZyBzZXNzaW9uLiIpLCExKX0sZS5wcm90b3R5cGUuX3VwZGF0ZVJlcG9ydGluZ0ludGVydmFsPWZ1bmN0aW9uKGEsYil7dmFyIGM9e307Y1tLXT0hIWIsY1tKXT1hLHRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgaChqYSxjKSl9LGUucHJvdG90eXBlLl91cGRhdGVMYXN0SW5CYW5kSXRlbT1mdW5jdGlvbihhKXt2YXIgYj10aGlzLl9sYXN0SW5CYW5kSXRlbSxjPShuZXcgRGF0ZSkuZ2V0VGltZSgpLGQ9Yi5hc3NldERhdGEudHlwZSgpPT09by5UWVBFX0FEfHxhLmFzc2V0RGF0YS50eXBlKCk9PT1vLlRZUEVfQUQsZT0xZTMqTWF0aC5hYnMoYS5ldmVudERhdGEucGxheWhlYWQoKS1iLmV2ZW50RGF0YS5wbGF5aGVhZCgpKSxmPU1hdGguYWJzKGMtYi5ldmVudERhdGEudHMoKSksZz1NYXRoLmFicyhlLWYpLGg9ZjtoPmthPyh0aGlzLl9sb2dnZXIud2Fybih3LCIgUmVzZXR0aW5nIGR1cmF0aW9uIGluIGxhc3RJbkJhbmRJdGVtWyIrYi5hc3NldERhdGEudHlwZSgpKyI6IitiLmV2ZW50RGF0YS50eXBlKCkrIl0gY2FsbCB0byAwIGFzIGNhbGN1bGF0ZWQgZHVyYXRpb24gKCIraCsiKWV4Y2VlZHMgMTBtaW5zIiksaD0wKTpiLmV2ZW50RGF0YS50eXBlKCk9PW4uRVZFTlRfVFlQRV9QTEFZJiYhZCYmIXRoaXMuX2RvTm90T3ZlcnJpZGVFdmVudER1cmF0aW9uJiZnPmxhJiYoaD1NYXRoLm1pbihlLGYpLHRoaXMuX2xvZ2dlci53YXJuKHcsIiBSZXNldHRpbmcgZHVyYXRpb24gaW4gbGFzdEluQmFuZEl0ZW1bIitiLmFzc2V0RGF0YS50eXBlKCkrIjoiK2IuZXZlbnREYXRhLnR5cGUoKSsiXSBjYWxsIHRvICIraCsiIGFzIGNhbGN1bGF0ZWQgZXJyb3IgZGVsdGEgKCIrZysiKWV4Y2VlZHMgMnNlYyIpKSx0aGlzLl9kb05vdE92ZXJyaWRlRXZlbnREdXJhdGlvbj0hMSxiLmV2ZW50RGF0YS5kdXJhdGlvbihoKSxiLmV2ZW50RGF0YS50cyhjKSxiLmV2ZW50RGF0YS5wbGF5aGVhZChhLmV2ZW50RGF0YS5wbGF5aGVhZCgpKSxiLnFvc0RhdGEuc3RhcnR1cFRpbWUoYS5xb3NEYXRhLnN0YXJ0dXBUaW1lKCkpLGIucW9zRGF0YS5pc1N0YXJ0dXBUaW1lT3ZlcnJpZGRlbj1hLnFvc0RhdGEuaXNTdGFydHVwVGltZU92ZXJyaWRkZW59LGUucHJvdG90eXBlLl91cGRhdGVMYXN0SW5iYW5kSXRlbVRvQnVmZmVyaW5nPWZ1bmN0aW9uKCl7dGhpcy5fc3Rhc2hlZExhc3RJbkJhbmRJdGVtPXRoaXMuX2xhc3RJbkJhbmRJdGVtO3ZhciBhPTA7bnVsbCE9dGhpcy5fbGFzdEluQmFuZEl0ZW0mJih0aGlzLl9sYXN0SW5CYW5kSXRlbS5hc3NldERhdGEudHlwZSgpPT1vLlRZUEVfTUFJTl9DT05URU5UJiZ0aGlzLl9sYXN0SW5CYW5kSXRlbS5ldmVudERhdGEudHlwZSgpPT1uLkVWRU5UX1RZUEVfU1RBUlQmJih0aGlzLl9zdGFzaGVkTWFpbk1ldGFkYXRhPXRoaXMuX2xhc3RJbkJhbmRJdGVtLm1ldGEpLGE9dGhpcy5fbGFzdEluQmFuZEl0ZW0uZXZlbnREYXRhLnBsYXloZWFkKCkpO3ZhciBiPW5ldyB0KHRoaXMsbi5FVkVOVF9UWVBFX0JVRkZFUixhLG51bGwsbnVsbCk7Yi5hc3NldERhdGEuYWREYXRhKG51bGwpLGIuYXNzZXREYXRhLnR5cGUoby5UWVBFX01BSU5fQ09OVEVOVCksdGhpcy5fbGFzdEluQmFuZEl0ZW09Yn0sZS5wcm90b3R5cGUuX3Jlc3RvcmVMYXN0SW5iYW5kSXRlbT1mdW5jdGlvbigpe2lmKG51bGwhPXRoaXMuX3N0YXNoZWRMYXN0SW5CYW5kSXRlbSl7dmFyIGE9bnVsbDt0aGlzLl9zdGFzaGVkTGFzdEluQmFuZEl0ZW0uZXZlbnREYXRhLnR5cGUoKT09bi5FVkVOVF9UWVBFX1NUQVJUJiYodGhpcy5fbGFzdEluQmFuZEl0ZW0uYXNzZXREYXRhLnR5cGUoKT09by5UWVBFX0FEP2E9dGhpcy5fbGFzdEluQmFuZEl0ZW0ubWV0YTooYT10aGlzLl9zdGFzaGVkTWFpbk1ldGFkYXRhLHRoaXMuX3N0YXNoZWRNYWluTWV0YWRhdGE9bnVsbCkpO3ZhciBiPW5ldyB0KHRoaXMsdGhpcy5fc3Rhc2hlZExhc3RJbkJhbmRJdGVtLmV2ZW50RGF0YS50eXBlKCksdGhpcy5fc3Rhc2hlZExhc3RJbkJhbmRJdGVtLmV2ZW50RGF0YS5wbGF5aGVhZCgpLGEsdGhpcy5fc3Rhc2hlZExhc3RJbkJhbmRJdGVtLmNhbGxiYWNrKTtiLmZpbHRlclJlcG9ydD10aGlzLl9zdGFzaGVkTGFzdEluQmFuZEl0ZW0uZmlsdGVyUmVwb3J0LHRoaXMuX2xhc3RJbkJhbmRJdGVtPWIsdGhpcy5fc3Rhc2hlZExhc3RJbkJhbmRJdGVtPW51bGx9fSxlLnByb3RvdHlwZS5fZmx1c2hMYXN0SW5iYW5kSXRlbT1mdW5jdGlvbihhKXtpZih0aGlzLl9sYXN0SW5CYW5kSXRlbSl7dGhpcy5fdXBkYXRlUW9TSW5mbyhhKTt2YXIgYj1uZXcgdCh0aGlzLHRoaXMuX2xhc3RJbkJhbmRJdGVtLmV2ZW50RGF0YS50eXBlKCksYS5wbGF5aGVhZCx0aGlzLl9sYXN0SW5CYW5kSXRlbS5tZXRhLHRoaXMuX2xhc3RJbkJhbmRJdGVtLmNhbGxiYWNrKTt0aGlzLl9zZW5kSGl0KGIsITApfX0sZS5wcm90b3R5cGUuX2NyZWF0ZUFuZFNlbmRSZXBvcnQ9ZnVuY3Rpb24oYSl7dmFyIGI9dGhpcy5fcmVwb3J0RmFjdG9yeS5jcmVhdGVSZXBvcnRGb3JJdGVtKGEpO2IucW9zRGF0YS5pc1N0YXJ0dXBUaW1lT3ZlcnJpZGRlbnx8Yi5xb3NEYXRhLnN0YXJ0dXBUaW1lKHRoaXMuX2F1dG9Db21wdXRlZFN0YXJ0dXBUaW1lKTt2YXIgYz17fTtpZihjW0ddPWIsdGhpcy5fY2hhbm5lbC50cmlnZ2VyKG5ldyBoKGhhLGMpKSxiLmV2ZW50RGF0YS50eXBlKCk9PW4uRVZFTlRfVFlQRV9TVEFSVHx8Yi5ldmVudERhdGEudHlwZSgpPT1uLkVWRU5UX1RZUEVfUExBWXx8Yi5ldmVudERhdGEudHlwZSgpPT1uLkVWRU5UX1RZUEVfUEFVU0V8fGIuZXZlbnREYXRhLnR5cGUoKT09bi5FVkVOVF9UWVBFX1NUQUxMfHxiLmV2ZW50RGF0YS50eXBlKCk9PW4uRVZFTlRfVFlQRV9CVUZGRVIpe3ZhciBkPXt9O2RbSF09ITAsdGhpcy5fY2hhbm5lbC5jb21tYW5kKHosZCl9fSxlLnByb3RvdHlwZS5fc2VuZEhpdD1mdW5jdGlvbihhLGIpe3N3aXRjaChhLmV2ZW50RGF0YS50eXBlKCkpe2Nhc2Ugbi5FVkVOVF9UWVBFX1NUQVJUOmNhc2Ugbi5FVkVOVF9UWVBFX1BMQVk6Y2FzZSBuLkVWRU5UX1RZUEVfUEFVU0U6Y2FzZSBuLkVWRU5UX1RZUEVfU1RBTEw6Y2FzZSBuLkVWRU5UX1RZUEVfQlVGRkVSOnRoaXMuX2xhc3RJbkJhbmRJdGVtPyh0aGlzLl91cGRhdGVMYXN0SW5CYW5kSXRlbShhKSx0aGlzLl9sYXN0SW5CYW5kSXRlbS5ldmVudERhdGEudHlwZSgpPT1uLkVWRU5UX1RZUEVfU1RBUlQmJnRoaXMuX2xhc3RJbkJhbmRJdGVtLmFzc2V0RGF0YS50eXBlKCk9PW8uVFlQRV9NQUlOX0NPTlRFTlQmJih0aGlzLl9hdXRvQ29tcHV0ZWRTdGFydHVwVGltZSs9dGhpcy5fbGFzdEluQmFuZEl0ZW0uZXZlbnREYXRhLmR1cmF0aW9uKCkpLHRoaXMuX2NyZWF0ZUFuZFNlbmRSZXBvcnQodGhpcy5fbGFzdEluQmFuZEl0ZW0pLGImJnRoaXMuX2xhc3RJbkJhbmRJdGVtLmV2ZW50RGF0YS50eXBlKCk9PWEuZXZlbnREYXRhLnR5cGUoKXx8dGhpcy5fY3JlYXRlQW5kU2VuZFJlcG9ydChhKSk6dGhpcy5fY3JlYXRlQW5kU2VuZFJlcG9ydChhKSx0aGlzLl9sYXN0SW5CYW5kSXRlbT1hO2JyZWFrO2Nhc2Ugbi5FVkVOVF9UWVBFX0NPTVBMRVRFOmNhc2Ugbi5FVkVOVF9UWVBFX1NLSVA6aWYodGhpcy5fbGFzdEluQmFuZEl0ZW0mJih0aGlzLl91cGRhdGVMYXN0SW5CYW5kSXRlbShhKSx0aGlzLl9jcmVhdGVBbmRTZW5kUmVwb3J0KHRoaXMuX2xhc3RJbkJhbmRJdGVtKSksYS5ldmVudERhdGEudHlwZSgpIT09bi5FVkVOVF9UWVBFX1NLSVAmJnRoaXMuX2NyZWF0ZUFuZFNlbmRSZXBvcnQoYSksYS5hc3NldERhdGEudHlwZSgpPT1vLlRZUEVfTUFJTl9DT05URU5UKXt0aGlzLl9sYXN0SW5CYW5kSXRlbT1udWxsLHRoaXMuX3N0YXNoZWRMYXN0SW5CYW5kSXRlbT1udWxsO3ZhciBjPXt9O2NbSF09ITAsdGhpcy5fY2hhbm5lbC5jb21tYW5kKEEsYyl9ZWxzZSBhLmFzc2V0RGF0YS50eXBlKCk9PW8uVFlQRV9BRCYmKHRoaXMuX2xhc3RJbkJhbmRJdGVtLmFzc2V0RGF0YS5hZERhdGEobnVsbCksdGhpcy5fbGFzdEluQmFuZEl0ZW0uYXNzZXREYXRhLnR5cGUoby5UWVBFX01BSU5fQ09OVEVOVCksdGhpcy5fZG9Ob3RPdmVycmlkZUV2ZW50RHVyYXRpb249ITApO2JyZWFrO2Nhc2Ugbi5FVkVOVF9UWVBFX0NIQVBURVJfU1RBUlQ6Y2FzZSBuLkVWRU5UX1RZUEVfQ0hBUFRFUl9DT01QTEVURTpjYXNlIG4uRVZFTlRfVFlQRV9DSEFQVEVSX1NLSVA6dGhpcy5fbGFzdEluQmFuZEl0ZW0mJih0aGlzLl91cGRhdGVMYXN0SW5CYW5kSXRlbShhKSx0aGlzLl9jcmVhdGVBbmRTZW5kUmVwb3J0KHRoaXMuX2xhc3RJbkJhbmRJdGVtKSksYS5ldmVudERhdGEudHlwZSgpIT09bi5FVkVOVF9UWVBFX0NIQVBURVJfU0tJUCYmdGhpcy5fY3JlYXRlQW5kU2VuZFJlcG9ydChhKSx0aGlzLl9sYXN0SW5CYW5kSXRlbSYmKHRoaXMuX2xhc3RJbkJhbmRJdGVtLmFzc2V0RGF0YS5jaGFwdGVyRGF0YShhLmV2ZW50RGF0YS50eXBlKCk9PW4uRVZFTlRfVFlQRV9DSEFQVEVSX1NUQVJUP25ldyBzKGEuYXNzZXREYXRhLmNoYXB0ZXJEYXRhKCkpOm51bGwpLHRoaXMuX2xhc3RJbkJhbmRJdGVtLmV2ZW50RGF0YS5kdXJhdGlvbigwKSx0aGlzLl9jcmVhdGVBbmRTZW5kUmVwb3J0KHRoaXMuX2xhc3RJbkJhbmRJdGVtKSk7YnJlYWs7ZGVmYXVsdDp0aGlzLl9jcmVhdGVBbmRTZW5kUmVwb3J0KGEpfX07dmFyIHc9ImFoOjpDb250ZXh0Iix4PSJzb3VyY2VFcnJvclNESyIseT0iZXJyb3IiLHo9ImNsb2NrOnJlcG9ydGluZy5yZXN1bWUiLEE9ImNsb2NrOnJlcG9ydGluZy5wYXVzZSIsQj0icmVwb3J0aW5nX2ludGVydmFsIixDPSJzZXNzaW9uX2lkIixEPSJyZXNldF9zZXNzaW9uX2lkIixFPSJjYWxsYmFjayIsRj0iZmlsdGVyX3JlcG9ydCIsRz0icmVwb3J0IixIPSJyZXNldCIsST0idHJhY2tfZXh0ZXJuYWxfZXJyb3JzIixKPSJyZXBvcnRpbmdfaW50ZXJ2YWwiLEs9ImRvX25vdF9vdmVycmlkZV9pbnRlcnZhbCIsTD0iYXBpOmFhX3N0YXJ0IixNPSJhcGk6YWFfYWRfc3RhcnQiLE49ImFwaTp2aWRlb19sb2FkIixPPSJhcGk6dmlkZW9fdW5sb2FkIixQPSJhcGk6dmlkZW9fc3RhcnQiLFE9ImFwaTp2aWRlb19jb21wbGV0ZSIsUj0iYXBpOnZpZGVvX3NraXAiLFM9ImFwaTp2aWRlb19yZXN1bWUiLFQ9ImFwaTp2aWRlb19zZXNzaW9uX2VuZCIsVT0iYXBpOmFkYnJlYWtfc3RhcnQiLFY9ImFwaTphZGJyZWFrX2NvbXBsZXRlIixXPSJhcGk6YWRfc3RhcnQiLFg9ImFwaTphZF9jb21wbGV0ZSIsWT0iYXBpOmFkX3NraXAiLFo9ImFwaTpwbGF5IiwkPSJhcGk6cGF1c2UiLF89ImFwaTpidWZmZXJfc3RhcnQiLGFhPSJhcGk6Y2hhcHRlcl9zdGFydCIsYmE9ImFwaTpjaGFwdGVyX2NvbXBsZXRlIixjYT0iYXBpOmNoYXB0ZXJfc2tpcCIsZGE9ImFwaTp0cmFja19lcnJvciIsZWE9ImFwaTp0cmFja19pbnRlcm5hbF9lcnJvciIsZmE9ImFwaTpiaXRyYXRlX2NoYW5nZSIsZ2E9ImFwaTpxdWFudHVtX2VuZCIsaGE9ImNvbnRleHQ6cmVwb3J0X2F2YWlsYWJsZSIsaWE9Im5ldDpjaGVja19zdGF0dXNfY29tcGxldGUiLGphPSJyZXBvcnRpbmc6dXBkYXRlX2ludGVydmFsIixrYT02ZTUsbGE9MmUzLG1hPTEwO2QuY29udGV4dC5Db250ZXh0PWV9KGEuQURCLmNvcmUsYS5BREIudmEsYS5BREIudmEudXRpbHMsYiksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoYSxiKXt0aGlzLnRyYWNraW5nU2VydmVyPWEsdGhpcy5wdWJsaXNoZXI9Yix0aGlzLnNzbD0hMSx0aGlzLm92cD1jLHRoaXMuc2RrPWMsdGhpcy5xdWlldE1vZGU9ITEsdGhpcy5kZWJ1Z0xvZ2dpbmc9ITEsdGhpcy5fX2lzUHJpbWV0aW1lPSExLHRoaXMuX19wc2RrVmVyc2lvbj1udWxsfXZhciBjPSJ1bmtub3duIjthLkFkb2JlSGVhcnRiZWF0UGx1Z2luQ29uZmlnPWJ9KGIpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBiKCl7fWIucHJvdG90eXBlLm9uRXJyb3I9ZnVuY3Rpb24oYSl7fSxiLnByb3RvdHlwZS5vblRyYWNraW5nRGlzYWJsZWQ9ZnVuY3Rpb24oKXt9LGEuQWRvYmVIZWFydGJlYXRQbHVnaW5EZWxlZ2F0ZT1ifShiKSxmdW5jdGlvbihhLGIsYyl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGQoYSl7ZC5fX3N1cGVyX18uY29uc3RydWN0b3IuY2FsbCh0aGlzLHEpLHRoaXMuX3JhZGlvPW5ldyBpKHRoaXMuX2xvZ2dlciksdGhpcy5fY2hhbm5lbD10aGlzLl9yYWRpby5jaGFubmVsKHkpLHRoaXMuX2RlbGVnYXRlPWEsdGhpcy5fY29udGV4dD1uZXcgbCh0aGlzLl9jaGFubmVsLHRoaXMuX2xvZ2dlciksdGhpcy5fZmlsdGVyPW5ldyBtKHRoaXMuX2NoYW5uZWwsdGhpcy5fbG9nZ2VyKSx0aGlzLl9uZXR3b3JrPW5ldyBuKHRoaXMuX2NoYW5uZWwsdGhpcy5fbG9nZ2VyKSx0aGlzLl9zZXR1cERhdGFSZXNvbHZlcigpfXZhciBlPWEuRXZlbnQsZj1hLlRyaWdnZXIsZz1hLnBsdWdpbi5CYXNlUGx1Z2luLGg9YS5wbHVnaW4uUGFyYW1NYXBwaW5nLGk9YS5yYWRpby5SYWRpbyxqPWIuRXJyb3JJbmZvLGs9Yi5WZXJzaW9uLGw9Yy5jb250ZXh0LkNvbnRleHQsbT1jLmZpbHRlci5SZXBvcnRGaWx0ZXIsbj1jLm5ldHdvcmsuTmV0d29yayxvPWMuY2xvY2suQ2xvY2sscD1jLkFkb2JlSGVhcnRiZWF0UGx1Z2luQ29uZmlnO2EuZXh0ZW5kKGQsZyksZC5wcm90b3R5cGUuY29uZmlndXJlPWZ1bmN0aW9uKGEpe2lmKCFhKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBjb25maWd1cmF0aW9uIGRhdGEgY2Fubm90IGJlIE5VTEwuIik7aWYoIShhIGluc3RhbmNlb2YgcCkpdGhyb3cgbmV3IEVycm9yKCJFeHBlY3RlZCBjb25maWcgZGF0YSB0byBiZSBpbnN0YW5jZSBvZiBBZG9iZUhlYXJ0YmVhdFBsdWdpbkNvbmZpZy4iKTt0aGlzLl9jb25maWc9YSx0aGlzLl9jb25maWcuZGVidWdMb2dnaW5nP3RoaXMuX2xvZ2dlci5lbmFibGUoKTp0aGlzLl9sb2dnZXIuZGlzYWJsZSgpLHRoaXMuX2xvZ2dlci5kZWJ1Zyh0aGlzLl9sb2dUYWcsIiNjb25maWd1cmUoe3RyYWNraW5nU2VydmVyPSIrdGhpcy5fY29uZmlnLnRyYWNraW5nU2VydmVyKyIsIHB1Ymxpc2hlcj0iK3RoaXMuX2NvbmZpZy5wdWJsaXNoZXIrIiwgcXVpZXRNb2RlPSIrdGhpcy5fY29uZmlnLnF1aWV0TW9kZSsiLCBzc2w9Iit0aGlzLl9jb25maWcuc3NsKyJ9KSIpO3ZhciBiPXRoaXMuX2NvbmZpZy50cmFja2luZ1NlcnZlcisiL3NldHRpbmdzLyIsYz17fTtjW2lhXT10aGlzLl9jb25maWcudHJhY2tpbmdTZXJ2ZXIsY1tqYV09YixjW2thXT10aGlzLl9jb25maWcucHVibGlzaGVyLGNbbGFdPXRoaXMuX2NvbmZpZy5xdWlldE1vZGUsY1ttYV09dGhpcy5fY29uZmlnLnNzbCx0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUoc2EsYykpLHRoaXMuX2lzQ29uZmlndXJlZD0hMH0sZC5wcm90b3R5cGUuYm9vdHN0cmFwPWZ1bmN0aW9uKGEpe2QuX19zdXBlcl9fLmJvb3RzdHJhcC5jYWxsKHRoaXMsYSksdGhpcy5fY2hhbm5lbC5vbih6LHRoaXMuX29uRXJyb3IsdGhpcyksdGhpcy5fY2xvY2s9bmV3IG8odGhpcy5fcGx1Z2luTWFuYWdlcix0aGlzLl9jaGFubmVsLHRoaXMuX2xvZ2dlciksdGhpcy5fY2hhbm5lbC5jb21tYW5kKFJhKSx0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUoWWEpKSx0aGlzLl9jaGFubmVsLm9uKHBhLHRoaXMuX29uQ2hlY2tTdGF0dXNDb21wbGV0ZSx0aGlzKSx0aGlzLl9yZWdpc3RlckNvbW1hbmRzKCksdGhpcy5fcmVnaXN0ZXJCZWhhdmlvdXJzKCl9LGQucHJvdG90eXBlLl90ZWFyZG93bj1mdW5jdGlvbigpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh0aGlzLl9sb2dUYWcsIiNfdGVhcmRvd24oKSIpLHRoaXMuX3JhZGlvLnNodXRkb3duKCksdGhpcy5fY29udGV4dC5kZXN0cm95KCksdGhpcy5fY2xvY2suZGVzdHJveSgpLHRoaXMuX2ZpbHRlci5kZXN0cm95KCksdGhpcy5fbmV0d29yay5kZXN0cm95KCl9LGQucHJvdG90eXBlLl9jYW5Qcm9jZXNzPWZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMuX2lzQ29uZmlndXJlZD90aGlzLl9lcnJvckluZm8/KHRoaXMuX2xvZ2dlci5lcnJvcih0aGlzLl9sb2dUYWcsIl9jYW5Qcm9jZXNzKCkgPiBQbHVnaW4gaW4gRVJST1Igc3RhdGUuIiksITEpOmQuX19zdXBlcl9fLl9jYW5Qcm9jZXNzLmNhbGwodGhpcyk6KHRoaXMuX2xvZ2dlci5lcnJvcih0aGlzLl9sb2dUYWcsIl9jYW5Qcm9jZXNzKCkgPiBQbHVnaW4gbm90IGNvbmZpZ3VyZWQuIiksITEpfSxkLnByb3RvdHlwZS5fY21kQW5hbHl0aWNzRXJyb3I9ZnVuY3Rpb24oYSl7dGhpcy5fZXJyb3JJbmZvfHwodGhpcy5fZXJyb3JJbmZvPW5ldyBqKCJJbnRlcm5hbCBlcnJvciIsIkFkb2JlQW5hbHl0aWNzUGx1Z2luIGlzIGluIEVSUk9SIHN0YXRlLiIpLHRoaXMuX3RyaWdnZXIoeix0aGlzLl9lcnJvckluZm8pLHRoaXMuX2RlbGVnYXRlJiZ0aGlzLl9kZWxlZ2F0ZS5vbkVycm9yKHRoaXMuX2Vycm9ySW5mbykpfSxkLnByb3RvdHlwZS5fY21kQW5hbHl0aWNzU3RhcnQ9ZnVuY3Rpb24oYSl7aWYodGhpcy5fY2FuUHJvY2VzcygpKXt2YXIgYj17fTtiW25hXT1hLnZpc2l0b3JPcHRlZE91dCx0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUodGEsYikpLHRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZShxYSxhKSl9fSxkLnByb3RvdHlwZS5fY21kQW5hbHl0aWNzQWRTdGFydD1mdW5jdGlvbihhKXt0aGlzLl9jYW5Qcm9jZXNzKCkmJnRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZShyYSxhKSl9LGQucHJvdG90eXBlLl9jbWRWaWRlb0xvYWQ9ZnVuY3Rpb24oYSl7dGhpcy5fZXJyb3JJbmZvPW51bGwsdGhpcy5fY2FuUHJvY2VzcygpJiYodGhpcy5faXNUcmFja2luZ1Nlc3Npb25BY3RpdmUmJnRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZSh2YSxhKSksdGhpcy5faXNUcmFja2luZ1Nlc3Npb25BY3RpdmU9ITEsdGhpcy5faXNQYXVzZWQ9ITAsdGhpcy5faXNTZWVraW5nPSExLHRoaXMuX2lzQnVmZmVyaW5nPSExLHRoaXMuX2lzVmlkZW9JZGxlPSExLHRoaXMuX2ZpbHRlci5jbGVhcigpLHRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZSh1YSxhKSksdGhpcy5faXNUcmFja2luZ1Nlc3Npb25BY3RpdmU9ITApfSxkLnByb3RvdHlwZS5fY21kVmlkZW9VbmxvYWQ9ZnVuY3Rpb24oYSl7dGhpcy5fZXJyb3JJbmZvPW51bGwsdGhpcy5fY2FuUHJvY2VzcygpJiYodGhpcy5fY2hhbm5lbC50cmlnZ2VyKG5ldyBlKHZhLGEpKSx0aGlzLl9maWx0ZXIuZmx1c2goKSx0aGlzLl9ydW5SZXBvcnRpbmdUaW1lcighMSksdGhpcy5fcnVuRmx1c2hGaWx0ZXJUaW1lcighMSksdGhpcy5fcnVuSWRsZVRpbWVyKCExKSx0aGlzLl9pc1RyYWNraW5nU2Vzc2lvbkFjdGl2ZT0hMSl9LGQucHJvdG90eXBlLl9jbWRWaWRlb1Nlc3Npb25FbmQ9ZnVuY3Rpb24oYSl7dGhpcy5fY2FuUHJvY2VzcygpJiZ0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUoQWEsYSkpfSxkLnByb3RvdHlwZS5fY21kVmlkZW9TdGFydD1mdW5jdGlvbihhKXt0aGlzLl9jYW5Qcm9jZXNzKCkmJih0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUod2EsYSkpLHRoaXMuX2ZpbHRlci5mbHVzaCgpKX0sZC5wcm90b3R5cGUuX2NtZFZpZGVvQ29tcGxldGU9ZnVuY3Rpb24oYSl7dGhpcy5fY2FuUHJvY2VzcygpJiZ0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUoeGEsYSkpfSxkLnByb3RvdHlwZS5fY21kVmlkZW9Ta2lwPWZ1bmN0aW9uKGEpe3RoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fY2hhbm5lbC50cmlnZ2VyKG5ldyBlKHlhLGEpKX0sZC5wcm90b3R5cGUuX2NtZFZpZGVvUmVzdW1lPWZ1bmN0aW9uKGEpe3RoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fY2hhbm5lbC50cmlnZ2VyKG5ldyBlKHphLGEpKX0sZC5wcm90b3R5cGUuX2NtZFBsYXk9ZnVuY3Rpb24oYSl7dGhpcy5fY2FuUHJvY2VzcygpJiYodGhpcy5faXNQYXVzZWQ9ITEsdGhpcy5fcmVzdW1lUGxheWJhY2tJZlBvc3NpYmxlKGEpKX0sZC5wcm90b3R5cGUuX2NtZFBhdXNlPWZ1bmN0aW9uKGEpe3RoaXMuX2NhblByb2Nlc3MoKSYmKHRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZShIYSxhKSksdGhpcy5faXNQYXVzZWQ9ITAsdGhpcy5fcnVuSWRsZVRpbWVyKCEwKSl9LGQucHJvdG90eXBlLl9jbWRBZEJyZWFrU3RhcnQ9ZnVuY3Rpb24oYSl7dGhpcy5fY2FuUHJvY2VzcygpJiZ0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUoQmEsYSkpfSxkLnByb3RvdHlwZS5fY21kQWRCcmVha0NvbXBsZXRlPWZ1bmN0aW9uKGEpe3RoaXMuX2NhblByb2Nlc3MoKSYmKHRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZShDYSxhKSksdGhpcy5fcmVzdW1lUGxheWJhY2tJZlBvc3NpYmxlKGEpKX0sZC5wcm90b3R5cGUuX2NtZEFkU3RhcnQ9ZnVuY3Rpb24oYSl7dGhpcy5fY2FuUHJvY2VzcygpJiYodGhpcy5fY2hhbm5lbC50cmlnZ2VyKG5ldyBlKERhLGEpKSx0aGlzLl9yZXN1bWVQbGF5YmFja0lmUG9zc2libGUoYSkpfSxkLnByb3RvdHlwZS5fY21kQWRDb21wbGV0ZT1mdW5jdGlvbihhKXt0aGlzLl9jYW5Qcm9jZXNzKCkmJnRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZShFYSxhKSl9LGQucHJvdG90eXBlLl9jbWRBZFNraXA9ZnVuY3Rpb24oYSl7dGhpcy5fY2FuUHJvY2VzcygpJiZ0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUoRmEsYSkpfSxkLnByb3RvdHlwZS5fY21kQnVmZmVyU3RhcnQ9ZnVuY3Rpb24oYSl7dGhpcy5fY2FuUHJvY2VzcygpJiYodGhpcy5fY2hhbm5lbC50cmlnZ2VyKG5ldyBlKElhLGEpKSx0aGlzLl9pc0J1ZmZlcmluZz0hMCx0aGlzLl9ydW5JZGxlVGltZXIoITApKX0sZC5wcm90b3R5cGUuX2NtZEJ1ZmZlckNvbXBsZXRlPWZ1bmN0aW9uKGEpe3RoaXMuX2NhblByb2Nlc3MoKSYmKHRoaXMuX2lzQnVmZmVyaW5nPSExLHRoaXMuX2lzUGF1c2VkP3RoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZShIYSxhKSk6dGhpcy5fcmVzdW1lUGxheWJhY2tJZlBvc3NpYmxlKGEpKX0sZC5wcm90b3R5cGUuX2NtZFNlZWtTdGFydD1mdW5jdGlvbihhKXt0aGlzLl9jYW5Qcm9jZXNzKCkmJih0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUoSGEsYSkpLHRoaXMuX2lzU2Vla2luZz0hMCx0aGlzLl9ydW5JZGxlVGltZXIoITApKX0sZC5wcm90b3R5cGUuX2NtZFNlZWtDb21wbGV0ZT1mdW5jdGlvbihhKXt0aGlzLl9jYW5Qcm9jZXNzKCkmJih0aGlzLl9pc1NlZWtpbmc9ITEsdGhpcy5fcmVzdW1lUGxheWJhY2tJZlBvc3NpYmxlKGEpKX0sZC5wcm90b3R5cGUuX2NtZENoYXB0ZXJTdGFydD1mdW5jdGlvbihhKXt0aGlzLl9jYW5Qcm9jZXNzKCkmJnRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZShKYSxhKSl9LGQucHJvdG90eXBlLl9jbWRDaGFwdGVyQ29tcGxldGU9ZnVuY3Rpb24oYSl7dGhpcy5fY2FuUHJvY2VzcygpJiZ0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUoS2EsYSkpfSxkLnByb3RvdHlwZS5fY21kQ2hhcHRlclNraXA9ZnVuY3Rpb24oYSl7dGhpcy5fY2FuUHJvY2VzcygpJiZ0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUoTGEsYSkpfSxkLnByb3RvdHlwZS5fY21kQml0cmF0ZUNoYW5nZT1mdW5jdGlvbihhKXt0aGlzLl9jYW5Qcm9jZXNzKCkmJnRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZShPYSxhKSl9LGQucHJvdG90eXBlLl9jbWRUcmFja0Vycm9yPWZ1bmN0aW9uKGEpe3RoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fY2hhbm5lbC50cmlnZ2VyKG5ldyBlKE1hLGEpKX0sZC5wcm90b3R5cGUuX2NtZENsb2NrUmVwb3J0aW5nVGljaz1mdW5jdGlvbihhKXt0aGlzLl9jYW5Qcm9jZXNzKCkmJnRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZShQYSxhKSl9LGQucHJvdG90eXBlLl9vbkNoZWNrU3RhdHVzQ29tcGxldGU9ZnVuY3Rpb24oYSl7aWYodGhpcy5fY2FuUHJvY2VzcygpKXt2YXIgYj0hMTthJiZhLmRhdGEmJmEuZGF0YVtvYV0mJihiPWEuZGF0YVtvYV0pLHRoaXMuX2xvZ2dlci5kZWJ1Zyh0aGlzLl9sb2dUYWcsIiNfb25DaGVja1N0YXR1c0NvbXBsZXRlKHRyYWNraW5nRGlzYWJsZWQ9IitiKyIpIiksYiYmdGhpcy5fZGVsZWdhdGUmJnRoaXMuX2RlbGVnYXRlLm9uVHJhY2tpbmdEaXNhYmxlZCgpfX0sZC5wcm90b3R5cGUuX2NtZElkbGVUaWNrPWZ1bmN0aW9uKGEpe3RoaXMuX2NhblByb2Nlc3MoKSYmKHRoaXMuX2lzVmlkZW9JZGxlPSEwLHRoaXMuX3RyaWdnZXIoYWEpLHRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZShBYSxhKSksdGhpcy5fZmlsdGVyLmZsdXNoKCksdGhpcy5fcnVuUmVwb3J0aW5nVGltZXIoITEpLHRoaXMuX3J1bkZsdXNoRmlsdGVyVGltZXIoITEpLHRoaXMuX3J1bklkbGVUaW1lcighMSksdGhpcy5fdHJpZ2dlcigkKSl9LGQucHJvdG90eXBlLl9vbkVycm9yPWZ1bmN0aW9uKGEpe3RoaXMuX2Vycm9ySW5mbz1hLmRhdGE7dmFyIGI9e307YltnYV09UWEsYltoYV09dGhpcy5fZXJyb3JJbmZvLmdldE1lc3NhZ2UoKSsifCIrdGhpcy5fZXJyb3JJbmZvLmdldERldGFpbHMoKSx0aGlzLl9jaGFubmVsLnRyaWdnZXIobmV3IGUoTmEsYikpLHRoaXMuX3J1blJlcG9ydGluZ1RpbWVyKCExKSx0aGlzLl90cmlnZ2VyKHosdGhpcy5fZXJyb3JJbmZvKSx0aGlzLl9kZWxlZ2F0ZSYmdGhpcy5fZGVsZWdhdGUub25FcnJvcih0aGlzLl9lcnJvckluZm8pfSxkLnByb3RvdHlwZS5fcnVuSWRsZVRpbWVyPWZ1bmN0aW9uKGEpe3ZhciBiPXt9O2JbZmFdPSEwLGE/dGhpcy5fY2hhbm5lbC5jb21tYW5kKFdhLGIpOnRoaXMuX2NoYW5uZWwuY29tbWFuZChYYSxiKX0sZC5wcm90b3R5cGUuX3J1bkZsdXNoRmlsdGVyVGltZXI9ZnVuY3Rpb24oYSl7dmFyIGI9e307YltmYV09ITAsYT90aGlzLl9jaGFubmVsLmNvbW1hbmQoVWEsYik6dGhpcy5fY2hhbm5lbC5jb21tYW5kKFZhLGIpfSxkLnByb3RvdHlwZS5fcnVuUmVwb3J0aW5nVGltZXI9ZnVuY3Rpb24oYSl7dmFyIGI9e307YltmYV09ITAsYT90aGlzLl9jaGFubmVsLmNvbW1hbmQoU2EsYik6dGhpcy5fY2hhbm5lbC5jb21tYW5kKFRhLGIpfSxkLnByb3RvdHlwZS5fcmVnaXN0ZXJDb21tYW5kcz1mdW5jdGlvbigpe3RoaXMuX3BsdWdpbk1hbmFnZXIuY29tcGx5KHRoaXMsImhhbmRsZUFuYWx5dGljc0Vycm9yIix0aGlzLl9jbWRBbmFseXRpY3NFcnJvciksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlQW5hbHl0aWNzU3RhcnQiLHRoaXMuX2NtZEFuYWx5dGljc1N0YXJ0KSx0aGlzLl9wbHVnaW5NYW5hZ2VyLmNvbXBseSh0aGlzLCJoYW5kbGVBbmFseXRpY3NBZFN0YXJ0Iix0aGlzLl9jbWRBbmFseXRpY3NBZFN0YXJ0KSx0aGlzLl9wbHVnaW5NYW5hZ2VyLmNvbXBseSh0aGlzLCJoYW5kbGVWaWRlb0xvYWQiLHRoaXMuX2NtZFZpZGVvTG9hZCksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlVmlkZW9VbmxvYWQiLHRoaXMuX2NtZFZpZGVvVW5sb2FkKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLmNvbXBseSh0aGlzLCJoYW5kbGVWaWRlb1Nlc3Npb25FbmQiLHRoaXMuX2NtZFZpZGVvU2Vzc2lvbkVuZCksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlVmlkZW9TdGFydCIsdGhpcy5fY21kVmlkZW9TdGFydCksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlVmlkZW9Db21wbGV0ZSIsdGhpcy5fY21kVmlkZW9Db21wbGV0ZSksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlVmlkZW9Ta2lwIix0aGlzLl9jbWRWaWRlb1NraXApLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tcGx5KHRoaXMsImhhbmRsZVZpZGVvUmVzdW1lIix0aGlzLl9jbWRWaWRlb1Jlc3VtZSksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlUGxheSIsdGhpcy5fY21kUGxheSksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlUGF1c2UiLHRoaXMuX2NtZFBhdXNlKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLmNvbXBseSh0aGlzLCJoYW5kbGVBZEJyZWFrU3RhcnQiLHRoaXMuX2NtZEFkQnJlYWtTdGFydCksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlQWRCcmVha0NvbXBsZXRlIix0aGlzLl9jbWRBZEJyZWFrQ29tcGxldGUpLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tcGx5KHRoaXMsImhhbmRsZUFkU3RhcnQiLHRoaXMuX2NtZEFkU3RhcnQpLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tcGx5KHRoaXMsImhhbmRsZUFkQ29tcGxldGUiLHRoaXMuX2NtZEFkQ29tcGxldGUpLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tcGx5KHRoaXMsImhhbmRsZUFkU2tpcCIsdGhpcy5fY21kQWRTa2lwKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLmNvbXBseSh0aGlzLCJoYW5kbGVCdWZmZXJTdGFydCIsdGhpcy5fY21kQnVmZmVyU3RhcnQpLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tcGx5KHRoaXMsImhhbmRsZUJ1ZmZlckNvbXBsZXRlIix0aGlzLl9jbWRCdWZmZXJDb21wbGV0ZSksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlU2Vla1N0YXJ0Iix0aGlzLl9jbWRTZWVrU3RhcnQpLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tcGx5KHRoaXMsImhhbmRsZVNlZWtDb21wbGV0ZSIsdGhpcy5fY21kU2Vla0NvbXBsZXRlKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLmNvbXBseSh0aGlzLCJoYW5kbGVDaGFwdGVyU3RhcnQiLHRoaXMuX2NtZENoYXB0ZXJTdGFydCksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlQ2hhcHRlckNvbXBsZXRlIix0aGlzLl9jbWRDaGFwdGVyQ29tcGxldGUpLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tcGx5KHRoaXMsImhhbmRsZUNoYXB0ZXJTa2lwIix0aGlzLl9jbWRDaGFwdGVyU2tpcCksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlQml0cmF0ZUNoYW5nZSIsdGhpcy5fY21kQml0cmF0ZUNoYW5nZSksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlVHJhY2tFcnJvciIsdGhpcy5fY21kVHJhY2tFcnJvciksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlQ2xvY2tSZXBvcnRpbmdUaWNrIix0aGlzLl9jbWRDbG9ja1JlcG9ydGluZ1RpY2spLHRoaXMuX3BsdWdpbk1hbmFnZXIuY29tcGx5KHRoaXMsImhhbmRsZUlkbGVUaWNrIix0aGlzLl9jbWRJZGxlVGljayl9LGQucHJvdG90eXBlLl9yZWdpc3RlckJlaGF2aW91cnM9ZnVuY3Rpb24oKXt0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHQsQyksdGhpcywiaGFuZGxlVmlkZW9Mb2FkIixbbmV3IGgocywicnNpZCIsInJzaWQiKSxuZXcgaChzLCJ0cmFja2luZ19zZXJ2ZXIiLCJ0cmFja2luZ1NlcnZlciIpXSksdGhpcy5fcGx1Z2luTWFuYWdlci5yZWdpc3RlckJlaGF2aW91cihuZXcgZih0LEQpLHRoaXMsImhhbmRsZVZpZGVvVW5sb2FkIiksdGhpcy5fcGx1Z2luTWFuYWdlci5yZWdpc3RlckJlaGF2aW91cihuZXcgZih0LEUpLHRoaXMsImhhbmRsZVZpZGVvU2Vzc2lvbkVuZCIsW25ldyBoKHQsInZpZGVvLnBsYXloZWFkIiwicGxheWhlYWQiKV0pLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYodCxGKSx0aGlzLCJoYW5kbGVWaWRlb1N0YXJ0IixbbmV3IGgodCwidmlkZW8uaWQiLCJ2aWRlb0lkIiksbmV3IGgodCwidmlkZW8ubmFtZSIsInZpZGVvTmFtZSIpLG5ldyBoKHQsInZpZGVvLmxlbmd0aCIsInZpZGVvTGVuZ3RoIiksbmV3IGgodCwidmlkZW8ucGxheWhlYWQiLCJwbGF5aGVhZCIpLG5ldyBoKHQsInZpZGVvLnBsYXllck5hbWUiLCJwbGF5ZXJOYW1lIiksbmV3IGgodCwidmlkZW8uc3RyZWFtVHlwZSIsInN0cmVhbVR5cGUiKSxuZXcgaCh0LCJxb3MuZnBzIiwiZnBzIiksbmV3IGgodCwicW9zLmRyb3BwZWRGcmFtZXMiLCJkcm9wcGVkRnJhbWVzIiksbmV3IGgodCwicW9zLmJpdHJhdGUiLCJiaXRyYXRlIiksbmV3IGgodCwicW9zLnN0YXJ0dXBUaW1lIiwic3RhcnR1cFRpbWUiKSxuZXcgaChzLCJyc2lkIiwicnNpZCIpLG5ldyBoKHMsInRyYWNraW5nX3NlcnZlciIsInRyYWNraW5nU2VydmVyIiksbmV3IGgocywiY2hhbm5lbCIsImNoYW5uZWwiKSxuZXcgaChzLCJtZXRhLnZpZGVvLioiLCJtZXRhVmlkZW8iKSxuZXcgaChzLCJzc2wiLCJ1c2VTc2wiKSxuZXcgaCh1LCJtZXRhIiwibWV0YU5pZWxzZW4iKSxuZXcgaChyLCJwdWJsaXNoZXIiLCJwdWJsaXNoZXIiKSxuZXcgaChyLCJzZGsiLCJzZGsiKSxuZXcgaChyLCJvdnAiLCJvdnAiKSxuZXcgaChyLCJ2ZXJzaW9uIiwidmVyc2lvbiIpLG5ldyBoKHIsImFwaV9sZXZlbCIsImFwaUx2bCIpXSksdGhpcy5fcGx1Z2luTWFuYWdlci5yZWdpc3RlckJlaGF2aW91cihuZXcgZih0LEgpLHRoaXMsImhhbmRsZVZpZGVvQ29tcGxldGUiLFtuZXcgaCh0LCJxb3MuZnBzIiwiZnBzIiksbmV3IGgodCwicW9zLmRyb3BwZWRGcmFtZXMiLCJkcm9wcGVkRnJhbWVzIiksbmV3IGgodCwicW9zLmJpdHJhdGUiLCJiaXRyYXRlIiksbmV3IGgodCwicW9zLnN0YXJ0dXBUaW1lIiwic3RhcnR1cFRpbWUiKV0pLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYodCxJKSx0aGlzLCJoYW5kbGVWaWRlb1NraXAiLFtuZXcgaCh0LCJ2aWRlby5wbGF5aGVhZCIsInBsYXloZWFkIiksbmV3IGgodCwicW9zLmZwcyIsImZwcyIpLG5ldyBoKHQsInFvcy5kcm9wcGVkRnJhbWVzIiwiZHJvcHBlZEZyYW1lcyIpLG5ldyBoKHQsInFvcy5iaXRyYXRlIiwiYml0cmF0ZSIpLG5ldyBoKHQsInFvcy5zdGFydHVwVGltZSIsInN0YXJ0dXBUaW1lIildKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHQsRyksdGhpcywiaGFuZGxlVmlkZW9SZXN1bWUiLFtuZXcgaCh0LCJ2aWRlby5pZCIsInZpZGVvSWQiKSxuZXcgaCh0LCJ2aWRlby5uYW1lIiwidmlkZW9OYW1lIiksbmV3IGgodCwidmlkZW8ubGVuZ3RoIiwidmlkZW9MZW5ndGgiKSxuZXcgaCh0LCJ2aWRlby5wbGF5aGVhZCIsInBsYXloZWFkIiksbmV3IGgodCwidmlkZW8ucGxheWVyTmFtZSIsInBsYXllck5hbWUiKSxuZXcgaCh0LCJ2aWRlby5zdHJlYW1UeXBlIiwic3RyZWFtVHlwZSIpXSksdGhpcy5fcGx1Z2luTWFuYWdlci5yZWdpc3RlckJlaGF2aW91cihuZXcgZih0LEopLHRoaXMsImhhbmRsZVBsYXkiLFtuZXcgaCh0LCJ2aWRlby5wbGF5aGVhZCIsInBsYXloZWFkIiksbmV3IGgodCwicW9zLmZwcyIsImZwcyIpLG5ldyBoKHQsInFvcy5kcm9wcGVkRnJhbWVzIiwiZHJvcHBlZEZyYW1lcyIpLG5ldyBoKHQsInFvcy5iaXRyYXRlIiwiYml0cmF0ZSIpLG5ldyBoKHQsInFvcy5zdGFydHVwVGltZSIsInN0YXJ0dXBUaW1lIildKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHQsSyksdGhpcywiaGFuZGxlUGF1c2UiLFtuZXcgaCh0LCJ2aWRlby5wbGF5aGVhZCIsInBsYXloZWFkIiksbmV3IGgodCwidmlkZW8ucGxheWhlYWRTdGFsbGVkIiwicGxheWhlYWRTdGFsbGVkIiksbmV3IGgodCwicW9zLmZwcyIsImZwcyIpLG5ldyBoKHQsInFvcy5kcm9wcGVkRnJhbWVzIiwiZHJvcHBlZEZyYW1lcyIpLG5ldyBoKHQsInFvcy5iaXRyYXRlIiwiYml0cmF0ZSIpLG5ldyBoKHQsInFvcy5zdGFydHVwVGltZSIsInN0YXJ0dXBUaW1lIildKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHQsTSksdGhpcywiaGFuZGxlQWRCcmVha1N0YXJ0IixbbmV3IGgodCwiYWQuaXNJbkFkQnJlYWsiLCJpc0luQWRCcmVhayIpLG5ldyBoKHQsInZpZGVvLnBsYXloZWFkIiwicGxheWhlYWQiKSxuZXcgaCh0LCJxb3MuZnBzIiwiZnBzIiksbmV3IGgodCwicW9zLmRyb3BwZWRGcmFtZXMiLCJkcm9wcGVkRnJhbWVzIiksbmV3IGgodCwicW9zLmJpdHJhdGUiLCJiaXRyYXRlIiksbmV3IGgodCwicW9zLnN0YXJ0dXBUaW1lIiwic3RhcnR1cFRpbWUiKV0pLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYodCxOKSx0aGlzLCJoYW5kbGVBZEJyZWFrQ29tcGxldGUiLFtuZXcgaCh0LCJhZC5pc0luQWRCcmVhayIsImlzSW5BZEJyZWFrIiksbmV3IGgodCwidmlkZW8ucGxheWhlYWQiLCJwbGF5aGVhZCIpLG5ldyBoKHQsInFvcy5mcHMiLCJmcHMiKSxuZXcgaCh0LCJxb3MuZHJvcHBlZEZyYW1lcyIsImRyb3BwZWRGcmFtZXMiKSxuZXcgaCh0LCJxb3MuYml0cmF0ZSIsImJpdHJhdGUiKSxuZXcgaCh0LCJxb3Muc3RhcnR1cFRpbWUiLCJzdGFydHVwVGltZSIpXSksdGhpcy5fcGx1Z2luTWFuYWdlci5yZWdpc3RlckJlaGF2aW91cihuZXcgZih0LE8pLHRoaXMsImhhbmRsZUFkU3RhcnQiLFtuZXcgaCh0LCJ2aWRlby5wbGF5aGVhZCIsInBsYXloZWFkIiksbmV3IGgodCwiYWQuaWQiLCJhZElkIiksbmV3IGgodCwiYWQubmFtZSIsImFkTmFtZSIpLG5ldyBoKHQsImFkLmxlbmd0aCIsImFkTGVuZ3RoIiksbmV3IGgodCwiYWQucG9zaXRpb24iLCJhZFBvc2l0aW9uIiksbmV3IGgodCwiYWQuZ3JhbnVsYXJUcmFja2luZyIsImFkR3JhbnVsYXJUcmFja2luZyIpLG5ldyBoKHQsImFkLnRyYWNraW5nSW50ZXJ2YWwiLCJhZFRyYWNraW5nSW50ZXJ2YWwiKSxuZXcgaCh0LCJwb2QubmFtZSIsInBvZE5hbWUiKSxuZXcgaCh0LCJwb2QucGxheWVyTmFtZSIsInBvZFBsYXllck5hbWUiKSxuZXcgaCh0LCJwb2QucG9zaXRpb24iLCJwb2RQb3NpdGlvbiIpLG5ldyBoKHQsInBvZC5zdGFydFRpbWUiLCJwb2RTZWNvbmQiKSxuZXcgaCh0LCJxb3MuZnBzIiwiZnBzIiksbmV3IGgodCwicW9zLmRyb3BwZWRGcmFtZXMiLCJkcm9wcGVkRnJhbWVzIiksbmV3IGgodCwicW9zLmJpdHJhdGUiLCJiaXRyYXRlIiksbmV3IGgodCwicW9zLnN0YXJ0dXBUaW1lIiwic3RhcnR1cFRpbWUiKSxuZXcgaChzLCJtZXRhLnZpZGVvLioiLCJtZXRhVmlkZW8iKSxuZXcgaChzLCJtZXRhLmFkLioiLCJtZXRhQWQiKSxuZXcgaCh1LCJtZXRhIiwibWV0YU5pZWxzZW4iKSxuZXcgaCh1LCJtZXRhQWQiLCJtZXRhQWROaWVsc2VuIildKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHQsUCksdGhpcywiaGFuZGxlQWRDb21wbGV0ZSIsW25ldyBoKHQsInZpZGVvLnBsYXloZWFkIiwicGxheWhlYWQiKSxuZXcgaCh0LCJhZC5pc0luQWRCcmVhayIsImlzSW5BZEJyZWFrIiksbmV3IGgodCwicW9zLmZwcyIsImZwcyIpLG5ldyBoKHQsInFvcy5kcm9wcGVkRnJhbWVzIiwiZHJvcHBlZEZyYW1lcyIpLG5ldyBoKHQsInFvcy5iaXRyYXRlIiwiYml0cmF0ZSIpLG5ldyBoKHQsInFvcy5zdGFydHVwVGltZSIsInN0YXJ0dXBUaW1lIildKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHQsUSksdGhpcywiaGFuZGxlQWRTa2lwIixbbmV3IGgodCwidmlkZW8ucGxheWhlYWQiLCJwbGF5aGVhZCIpLG5ldyBoKHQsImFkLmlzSW5BZEJyZWFrIiwiaXNJbkFkQnJlYWsiKSxuZXcgaCh0LCJxb3MuZnBzIiwiZnBzIiksbmV3IGgodCwicW9zLmRyb3BwZWRGcmFtZXMiLCJkcm9wcGVkRnJhbWVzIiksbmV3IGgodCwicW9zLmJpdHJhdGUiLCJiaXRyYXRlIiksbmV3IGgodCwicW9zLnN0YXJ0dXBUaW1lIiwic3RhcnR1cFRpbWUiKV0pLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYodCxSKSx0aGlzLCJoYW5kbGVCdWZmZXJTdGFydCIsW25ldyBoKHQsInZpZGVvLnBsYXloZWFkIiwicGxheWhlYWQiKSxuZXcgaCh0LCJxb3MuZnBzIiwiZnBzIiksbmV3IGgodCwicW9zLmRyb3BwZWRGcmFtZXMiLCJkcm9wcGVkRnJhbWVzIiksbmV3IGgodCwicW9zLmJpdHJhdGUiLCJiaXRyYXRlIiksbmV3IGgodCwicW9zLnN0YXJ0dXBUaW1lIiwic3RhcnR1cFRpbWUiKV0pLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYodCxTKSx0aGlzLCJoYW5kbGVCdWZmZXJDb21wbGV0ZSIsW25ldyBoKHQsInZpZGVvLnBsYXloZWFkIiwicGxheWhlYWQiKSxuZXcgaCh0LCJ2aWRlby5wbGF5aGVhZFN0YWxsZWQiLCJwbGF5aGVhZFN0YWxsZWQiKSxuZXcgaCh0LCJxb3MuZnBzIiwiZnBzIiksbmV3IGgodCwicW9zLmRyb3BwZWRGcmFtZXMiLCJkcm9wcGVkRnJhbWVzIiksbmV3IGgodCwicW9zLmJpdHJhdGUiLCJiaXRyYXRlIiksbmV3IGgodCwicW9zLnN0YXJ0dXBUaW1lIiwic3RhcnR1cFRpbWUiKV0pLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYodCxUKSx0aGlzLCJoYW5kbGVTZWVrU3RhcnQiLFtuZXcgaCh0LCJ2aWRlby5wbGF5aGVhZCIsInBsYXloZWFkIildKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHQsVSksdGhpcywiaGFuZGxlU2Vla0NvbXBsZXRlIixbbmV3IGgodCwidmlkZW8ucGxheWhlYWQiLCJwbGF5aGVhZCIpLG5ldyBoKHQsImFkLmlzSW5BZCIsImlzSW5BZCIpLG5ldyBoKHQsImFkLmlkIiwiYWRJZCIpLG5ldyBoKHQsImFkLnBvc2l0aW9uIiwiYWRQb3NpdGlvbiIpLG5ldyBoKHQsInBvZC5wbGF5ZXJOYW1lIiwicG9kUGxheWVyTmFtZSIpLG5ldyBoKHQsInBvZC5wb3NpdGlvbiIsInBvZFBvc2l0aW9uIiksbmV3IGgodCwiY2hhcHRlci5pc0luQ2hhcHRlciIsImlzSW5DaGFwdGVyIiksbmV3IGgodCwiY2hhcHRlci5wb3NpdGlvbiIsImNoYXB0ZXJQb3NpdGlvbiIpLG5ldyBoKHQsImNoYXB0ZXIubmFtZSIsImNoYXB0ZXJOYW1lIiksbmV3IGgodCwiY2hhcHRlci5sZW5ndGgiLCJjaGFwdGVyTGVuZ3RoIiksbmV3IGgodCwiY2hhcHRlci5zdGFydFRpbWUiLCJjaGFwdGVyT2Zmc2V0IiksbmV3IGgodCwicW9zLmZwcyIsImZwcyIpLG5ldyBoKHQsInFvcy5kcm9wcGVkRnJhbWVzIiwiZHJvcHBlZEZyYW1lcyIpLG5ldyBoKHQsInFvcy5iaXRyYXRlIiwiYml0cmF0ZSIpLG5ldyBoKHQsInFvcy5zdGFydHVwVGltZSIsInN0YXJ0dXBUaW1lIildKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHQsViksdGhpcywiaGFuZGxlQ2hhcHRlclN0YXJ0IixbbmV3IGgodCwidmlkZW8ucGxheWhlYWQiLCJwbGF5aGVhZCIpLG5ldyBoKHQsImNoYXB0ZXIucG9zaXRpb24iLCJjaGFwdGVyUG9zaXRpb24iKSxuZXcgaCh0LCJjaGFwdGVyLm5hbWUiLCJjaGFwdGVyTmFtZSIpLG5ldyBoKHQsImNoYXB0ZXIubGVuZ3RoIiwiY2hhcHRlckxlbmd0aCIpLG5ldyBoKHQsImNoYXB0ZXIuc3RhcnRUaW1lIiwiY2hhcHRlck9mZnNldCIpLG5ldyBoKHQsInFvcy5mcHMiLCJmcHMiKSxuZXcgaCh0LCJxb3MuZHJvcHBlZEZyYW1lcyIsImRyb3BwZWRGcmFtZXMiKSxuZXcgaCh0LCJxb3MuYml0cmF0ZSIsImJpdHJhdGUiKSxuZXcgaCh0LCJxb3Muc3RhcnR1cFRpbWUiLCJzdGFydHVwVGltZSIpLG5ldyBoKHMsIm1ldGEudmlkZW8uKiIsIm1ldGFWaWRlbyIpLG5ldyBoKHMsIm1ldGEuY2hhcHRlci4qIiwibWV0YUNoYXB0ZXIiKSxuZXcgaCh1LCJtZXRhIiwibWV0YU5pZWxzZW4iKV0pLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYodCxXKSx0aGlzLCJoYW5kbGVDaGFwdGVyQ29tcGxldGUiLFtuZXcgaCh0LCJ2aWRlby5wbGF5aGVhZCIsInBsYXloZWFkIiksbmV3IGgodCwicW9zLmZwcyIsImZwcyIpLG5ldyBoKHQsInFvcy5kcm9wcGVkRnJhbWVzIiwiZHJvcHBlZEZyYW1lcyIpLG5ldyBoKHQsInFvcy5iaXRyYXRlIiwiYml0cmF0ZSIpLG5ldyBoKHQsInFvcy5zdGFydHVwVGltZSIsInN0YXJ0dXBUaW1lIildKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHQsWCksdGhpcywiaGFuZGxlQ2hhcHRlclNraXAiLFtuZXcgaCh0LCJ2aWRlby5wbGF5aGVhZCIsInBsYXloZWFkIiksbmV3IGgodCwicW9zLmZwcyIsImZwcyIpLG5ldyBoKHQsInFvcy5kcm9wcGVkRnJhbWVzIiwiZHJvcHBlZEZyYW1lcyIpLG5ldyBoKHQsInFvcy5iaXRyYXRlIiwiYml0cmF0ZSIpLG5ldyBoKHQsInFvcy5zdGFydHVwVGltZSIsInN0YXJ0dXBUaW1lIildKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHQsWSksdGhpcywiaGFuZGxlQml0cmF0ZUNoYW5nZSIsW25ldyBoKHQsInZpZGVvLnBsYXloZWFkIiwicGxheWhlYWQiKSxuZXcgaCh0LCJxb3MuZnBzIiwiZnBzIiksbmV3IGgodCwicW9zLmRyb3BwZWRGcmFtZXMiLCJkcm9wcGVkRnJhbWVzIiksbmV3IGgodCwicW9zLmJpdHJhdGUiLCJiaXRyYXRlIiksbmV3IGgodCwicW9zLnN0YXJ0dXBUaW1lIiwic3RhcnR1cFRpbWUiKV0pLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYodCxaKSx0aGlzLCJoYW5kbGVUcmFja0Vycm9yIiksdGhpcy5fcGx1Z2luTWFuYWdlci5yZWdpc3RlckJlaGF2aW91cihuZXcgZih2LGNhKSx0aGlzLCJoYW5kbGVDbG9ja1JlcG9ydGluZ1RpY2siLFtuZXcgaCh0LCJ2aWRlby5wbGF5aGVhZCIsInBsYXloZWFkIiksbmV3IGgodCwicW9zLmZwcyIsImZwcyIpLG5ldyBoKHQsInFvcy5kcm9wcGVkRnJhbWVzIiwiZHJvcHBlZEZyYW1lcyIpLG5ldyBoKHQsInFvcy5iaXRyYXRlIiwiYml0cmF0ZSIpLG5ldyBoKHQsInFvcy5zdGFydHVwVGltZSIsInN0YXJ0dXBUaW1lIildKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHQsTCksdGhpcywiaGFuZGxlQ2xvY2tSZXBvcnRpbmdUaWNrIixbbmV3IGgodCwidmlkZW8ucGxheWhlYWQiLCJwbGF5aGVhZCIpLG5ldyBoKHQsInFvcy5mcHMiLCJmcHMiKSxuZXcgaCh0LCJxb3MuZHJvcHBlZEZyYW1lcyIsImRyb3BwZWRGcmFtZXMiKSxuZXcgaCh0LCJxb3MuYml0cmF0ZSIsImJpdHJhdGUiKSxuZXcgaCh0LCJxb3Muc3RhcnR1cFRpbWUiLCJzdGFydHVwVGltZSIpXSksdGhpcy5fcGx1Z2luTWFuYWdlci5yZWdpc3RlckJlaGF2aW91cihuZXcgZih2LGVhKSx0aGlzLCJoYW5kbGVJZGxlVGljayIsW25ldyBoKHQsInZpZGVvLnBsYXloZWFkIiwicGxheWhlYWQiKV0pLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYocixhYSksdGhpcywiaGFuZGxlQ2xvY2tSZXBvcnRpbmdUaWNrIixbbmV3IGgodCwidmlkZW8ucGxheWhlYWQiLCJwbGF5aGVhZCIpLG5ldyBoKHQsInFvcy5mcHMiLCJmcHMiKSxuZXcgaCh0LCJxb3MuZHJvcHBlZEZyYW1lcyIsImRyb3BwZWRGcmFtZXMiKSxuZXcgaCh0LCJxb3MuYml0cmF0ZSIsImJpdHJhdGUiKSxuZXcgaCh0LCJxb3Muc3RhcnR1cFRpbWUiLCJzdGFydHVwVGltZSIpXSksdGhpcy5fcGx1Z2luTWFuYWdlci5yZWdpc3RlckJlaGF2aW91cihuZXcgZihzLHopLHRoaXMsImhhbmRsZUFuYWx5dGljc0Vycm9yIiksdGhpcy5fcGx1Z2luTWFuYWdlci5yZWdpc3RlckJlaGF2aW91cihuZXcgZihzLEEpLHRoaXMsImhhbmRsZUFuYWx5dGljc1N0YXJ0IixbbmV3IGgocywidmlkIiwidmlkIiksbmV3IGgocywiYWlkIiwiYWlkIiksbmV3IGgocywibWlkIiwibWlkIiksbmV3IGgocywiY3VzdG9tZXJJRHMiLCJjdXN0b21lcklEcyIpLG5ldyBoKHMsInZpc2l0b3JPcHRlZE91dCIsInZpc2l0b3JPcHRlZE91dCIpLG5ldyBoKHMsImJsb2IiLCJibG9iIiksbmV3IGgocywibG9jX2hpbnQiLCJsb2NfaGludCIpLG5ldyBoKHQsInZpZGVvLnBsYXloZWFkIiwicGxheWhlYWQiKSxuZXcgaCh0LCJxb3MuZnBzIiwiZnBzIiksbmV3IGgodCwicW9zLmRyb3BwZWRGcmFtZXMiLCJkcm9wcGVkRnJhbWVzIiksbmV3IGgodCwicW9zLmJpdHJhdGUiLCJiaXRyYXRlIiksbmV3IGgodCwicW9zLnN0YXJ0dXBUaW1lIiwic3RhcnR1cFRpbWUiKV0pLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYocyxCKSx0aGlzLCJoYW5kbGVBbmFseXRpY3NBZFN0YXJ0IixbbmV3IGgodCwidmlkZW8ucGxheWhlYWQiLCJwbGF5aGVhZCIpLG5ldyBoKHQsInFvcy5mcHMiLCJmcHMiKSxuZXcgaCh0LCJxb3MuZHJvcHBlZEZyYW1lcyIsImRyb3BwZWRGcmFtZXMiKSxuZXcgaCh0LCJxb3MuYml0cmF0ZSIsImJpdHJhdGUiKSxuZXcgaCh0LCJxb3Muc3RhcnR1cFRpbWUiLCJzdGFydHVwVGltZSIpXSl9LGQucHJvdG90eXBlLl9zZXR1cERhdGFSZXNvbHZlcj1mdW5jdGlvbigpe3ZhciBhPXt9LGI9dGhpczthLnZlcnNpb249ZnVuY3Rpb24oKXtyZXR1cm4gay5nZXRWZXJzaW9uKCl9LGEuYXBpX2xldmVsPWZ1bmN0aW9uKCl7cmV0dXJuIGsuZ2V0QXBpTGV2ZWwoKX0sYS50cmFja2luZ19zZXJ2ZXI9ZnVuY3Rpb24oKXtyZXR1cm4gYi5fY29uZmlnP2IuX2NvbmZpZy50cmFja2luZ1NlcnZlcjpudWxsfSxhLnB1Ymxpc2hlcj1mdW5jdGlvbigpe3JldHVybiBiLl9jb25maWc/Yi5fY29uZmlnLnB1Ymxpc2hlcjpudWxsfSxhLnF1aWV0X21vZGU9ZnVuY3Rpb24oKXtyZXR1cm4hIWIuX2NvbmZpZyYmYi5fY29uZmlnLnF1aWV0TW9kZX0sYS5vdnA9ZnVuY3Rpb24oKXtyZXR1cm4gYi5fY29uZmlnP2IuX2NvbmZpZy5vdnA6bnVsbH0sYS5zZGs9ZnVuY3Rpb24oKXtyZXR1cm4gYi5fY29uZmlnP2IuX2NvbmZpZy5zZGs6bnVsbH0sYS5pc19wcmltZXRpbWU9ZnVuY3Rpb24oKXtyZXR1cm4hIWIuX2NvbmZpZyYmYi5fY29uZmlnLl9faXNQcmltZXRpbWV9LGEucHNka192ZXJzaW9uPWZ1bmN0aW9uKCl7cmV0dXJuIGIuX2NvbmZpZz9iLl9jb25maWcuX19wc2RrVmVyc2lvbjpudWxsfSxhLnNlc3Npb25faWQ9ZnVuY3Rpb24oKXtyZXR1cm4gYi5fY2hhbm5lbC5yZXF1ZXN0KHcpfSx0aGlzLl9kYXRhUmVzb2x2ZXI9ZnVuY3Rpb24oYil7aWYoIWJ8fDA9PWIubGVuZ3RoKXJldHVybiBudWxsO2Zvcih2YXIgYz1udWxsLGQ9MDtkPGIubGVuZ3RoO2QrKyl7dmFyIGU9YltkXTtjPWN8fHt9LGNbZV09YS5oYXNPd25Qcm9wZXJ0eShlKT9hW2VdLmNhbGwodGhpcyk6bnVsbH1yZXR1cm4gY319LGQucHJvdG90eXBlLl9yZXN1bWVQbGF5YmFja0lmUG9zc2libGU9ZnVuY3Rpb24oYSl7dGhpcy5fZXJyb3JJbmZvfHx0aGlzLl9pc1BhdXNlZHx8dGhpcy5faXNTZWVraW5nfHx0aGlzLl9pc0J1ZmZlcmluZ3x8KHRoaXMuX2lzVmlkZW9JZGxlPyh0aGlzLl9pc1ZpZGVvSWRsZT0hMSx0aGlzLl9yZXN1bWVQbGF5YmFja0Zyb21JZGxlKCkpOnRoaXMuX2NoYW5uZWwudHJpZ2dlcihuZXcgZShHYSxhKSksdGhpcy5fcnVuSWRsZVRpbWVyKCExKSl9LGQucHJvdG90eXBlLl9yZXN1bWVQbGF5YmFja0Zyb21JZGxlPWZ1bmN0aW9uKCl7dGhpcy5fdHJpZ2dlcihhYSksdGhpcy5fZmlsdGVyLmNsZWFyKCksdGhpcy5fY2hhbm5lbC50cmlnZ2VyKG5ldyBlKHgpKSx0aGlzLl90cmlnZ2VyKF8pLHRoaXMuX3J1blJlcG9ydGluZ1RpbWVyKCEwKSx0aGlzLl9ydW5GbHVzaEZpbHRlclRpbWVyKCEwKX07dmFyIHE9ImFkb2JlLWhlYXJ0YmVhdCIscj1xLHM9ImFkb2JlLWFuYWx5dGljcyIsdD0icGxheWVyIix1PSJuaWVsc2VuIix2PSJzZXJ2aWNlLmNsb2NrIix3PSJzZXNzaW9uX2lkIix4PSJyZXNldF9zZXNzaW9uX2lkIix5PSJoZWFydGJlYXQtY2hhbm5lbCIsej0iZXJyb3IiLEE9ImFhX3N0YXJ0IixCPSJzY19hZF9zdGFydCIsQz0idmlkZW9fbG9hZCIsRD0idmlkZW9fdW5sb2FkIixFPSJ2aWRlb19zZXNzaW9uX2VuZCIsRj0idmlkZW9fc3RhcnQiLEc9InZpZGVvX3Jlc3VtZSIsSD0idmlkZW9fY29tcGxldGUiLEk9InZpZGVvX3NraXAiLEo9InBsYXkiLEs9InBhdXNlIixMPSJjb250ZW50X3N0YXJ0IixNPSJhZGJyZWFrX3N0YXJ0IixOPSJhZGJyZWFrX2NvbXBsZXRlIixPPSJhZF9zdGFydCIsUD0iYWRfY29tcGxldGUiLFE9ImFkX3NraXAiLFI9ImJ1ZmZlcl9zdGFydCIsUz0iYnVmZmVyX2NvbXBsZXRlIixUPSJzZWVrX3N0YXJ0IixVPSJzZWVrX2NvbXBsZXRlIixWPSJjaGFwdGVyX3N0YXJ0IixXPSJjaGFwdGVyX2NvbXBsZXRlIixYPSJjaGFwdGVyX3NraXAiLFk9ImJpdHJhdGVfY2hhbmdlIixaPSJ0cmFja19lcnJvciIsJD0idmlkZW9faWRsZV9zdGFydCIsXz0idmlkZW9faWRsZV9yZXN1bWUiLGFhPSJxdWFudHVtX2Nsb3NlIixiYT0iaGVhcnRiZWF0LnJlcG9ydGluZyIsY2E9YmErIi50aWNrIixkYT0iaGVhcnRiZWF0LmlkbGUiLGVhPWRhKyIudGljayIsZmE9InJlc2V0IixnYT0ic291cmNlIixoYT0iZXJyb3JfaWQiLGlhPSJ0cmFja2luZ19zZXJ2ZXIiLGphPSJjaGVja19zdGF0dXNfc2VydmVyIixrYT0icHVibGlzaGVyIixsYT0icXVpZXRfbW9kZSIsbWE9InNzbCIsbmE9InZpc2l0b3Jfb3B0X291dCIsb2E9InRyYWNraW5nX2Rpc2FibGVkIixwYT0ibmV0OmNoZWNrX3N0YXR1c19jb21wbGV0ZSIscWE9ImFwaTphYV9zdGFydCIscmE9ImFwaTphYV9hZF9zdGFydCIsc2E9ImFwaTpjb25maWciLHRhPSJhcGk6dXBkYXRlX3Zpc2l0b3Jfb3B0b3V0Iix1YT0iYXBpOnZpZGVvX2xvYWQiLHZhPSJhcGk6dmlkZW9fdW5sb2FkIix3YT0iYXBpOnZpZGVvX3N0YXJ0Iix4YT0iYXBpOnZpZGVvX2NvbXBsZXRlIix5YT0iYXBpOnZpZGVvX3NraXAiLHphPSJhcGk6dmlkZW9fcmVzdW1lIixBYT0iYXBpOnZpZGVvX3Nlc3Npb25fZW5kIixCYT0iYXBpOmFkYnJlYWtfc3RhcnQiLENhPSJhcGk6YWRicmVha19jb21wbGV0ZSIsRGE9ImFwaTphZF9zdGFydCIsRWE9ImFwaTphZF9jb21wbGV0ZSIsRmE9ImFwaTphZF9za2lwIixHYT0iYXBpOnBsYXkiLEhhPSJhcGk6cGF1c2UiLElhPSJhcGk6YnVmZmVyX3N0YXJ0IixKYT0iYXBpOmNoYXB0ZXJfc3RhcnQiLEthPSJhcGk6Y2hhcHRlcl9jb21wbGV0ZSIsTGE9ImFwaTpjaGFwdGVyX3NraXAiLE1hPSJhcGk6dHJhY2tfZXJyb3IiLE5hPSJhcGk6dHJhY2tfaW50ZXJuYWxfZXJyb3IiLE9hPSJhcGk6Yml0cmF0ZV9jaGFuZ2UiLFBhPSJhcGk6cXVhbnR1bV9lbmQiLFFhPSJzb3VyY2VFcnJvckhlYXJ0YmVhdCIsUmE9ImNsb2NrOmNoZWNrX3N0YXR1cy5yZXN1bWUiLFNhPSJjbG9jazpyZXBvcnRpbmcucmVzdW1lIixUYT0iY2xvY2s6cmVwb3J0aW5nLnBhdXNlIixVYT0iY2xvY2s6Zmx1c2hfZmlsdGVyLnJlc3VtZSIsVmE9ImNsb2NrOmZsdXNoX2ZpbHRlci5wYXVzZSIsV2E9ImNsb2NrOmlkbGUucmVzdW1lIixYYT0iY2xvY2s6aWRsZS5wYXVzZSIsWWE9ImNsb2NrOmNoZWNrX3N0YXR1cy5nZXRfc2V0dGluZ3MiO2MuQWRvYmVIZWFydGJlYXRQbHVnaW49ZH0oYS5BREIuY29yZSxhLkFEQi52YSxiKSxhLkFEQi52YS5wbHVnaW5zLmFofHwoYS5BREIudmEucGx1Z2lucy5haD1iKX0odGhpcyk7XG5cbi8vIEFkb2JlQW5hbHl0aWNzUGx1Z2luXG4hZnVuY3Rpb24oYSl7aWYodm9pZCAwPT09Yil2YXIgYj17fTshZnVuY3Rpb24oYSxiKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYyhhLGIpe3RoaXMuX29uRmFpbD17Zm46YSxjdHg6Yn19dmFyIGQ9YS5FcnJvckluZm87Yy5wcm90b3R5cGUudmFsaWRhdGVGaWVsZHM9ZnVuY3Rpb24oYSxiKXtpZighYSlyZXR1cm4gdGhpcy5fZmFpbCgiRGF0YSBjYW5ub3QgYmUgbnVsbCIpO2lmKGIpZm9yKHZhciBjPTA7YzxiLmxlbmd0aDtjKyspe3ZhciBkPWJbY107c3dpdGNoKGQpe2Nhc2UidmlkZW9JZCI6aWYoIWEuaGFzT3duUHJvcGVydHkoInZpZGVvSWQiKSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIElEIGZvciB0aGUgbWFpbiB2aWRlbyBtdXN0IGJlIHNwZWNpZmllZC4iKTtpZigic3RyaW5nIiE9dHlwZW9mIGEudmlkZW9JZClyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIElEIGZvciB0aGUgbWFpbiB2aWRlbyBtdXN0IGJlIGEgU3RyaW5nLiIpO2lmKCIiPT09YS52aWRlb0lkKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgSUQgZm9yIHRoZSBtYWluIHZpZGVvIGNhbm5vdCBiZSBhbiBlbXB0eSBzdHJpbmcuIik7YnJlYWs7Y2FzZSJtZWRpYVR5cGUiOmlmKCFhLmhhc093blByb3BlcnR5KCJtZWRpYVR5cGUiKSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIG1lZGlhIHR5cGUgZm9yIHRoZSBtYWluIHZpZGVvIG11c3QgYmUgc3BlY2lmaWVkLiIpO2lmKCJzdHJpbmciIT10eXBlb2YgYS5tZWRpYVR5cGUpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBtZWRpYSB0eXBlIGZvciB0aGUgbWFpbiB2aWRlbyBtdXN0IGJlIGEgU3RyaW5nLiIpO2lmKCIiPT09YS5tZWRpYVR5cGUpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBzdHJlYW0gdHlwZSBmb3IgdGhlIG1haW4gdmlkZW8gY2Fubm90IGJlIGFuIGVtcHR5IHN0cmluZy4iKTticmVhaztjYXNlInN0cmVhbVR5cGUiOmlmKCFhLmhhc093blByb3BlcnR5KCJzdHJlYW1UeXBlIikpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBzdHJlYW0gdHlwZSBmb3IgdGhlIG1haW4gdmlkZW8gbXVzdCBiZSBzcGVjaWZpZWQuIik7aWYoInN0cmluZyIhPXR5cGVvZiBhLnN0cmVhbVR5cGUpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBzdHJlYW0gdHlwZSBmb3IgdGhlIG1haW4gdmlkZW8gbXVzdCBiZSBhIFN0cmluZy4iKTtpZigiIj09PWEuc3RyZWFtVHlwZSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIHN0cmVhbSB0eXBlIGZvciB0aGUgbWFpbiB2aWRlbyBjYW5ub3QgYmUgYW4gZW1wdHkgc3RyaW5nLiIpO2JyZWFrO2Nhc2UicGxheWVyTmFtZSI6aWYoIWEuaGFzT3duUHJvcGVydHkoInBsYXllck5hbWUiKSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIHBsYXllciBuYW1lIGZvciB0aGUgbWFpbiB2aWRlbyBtdXN0IGJlIHNwZWNpZmllZC4iKTtpZigic3RyaW5nIiE9dHlwZW9mIGEucGxheWVyTmFtZSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIHBsYXllciBuYW1lIGZvciB0aGUgbWFpbiB2aWRlbyBtdXN0IGJlIGEgU3RyaW5nLiIpO2lmKCIiPT09YS5wbGF5ZXJOYW1lKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgcGxheWVyIG5hbWUgZm9yIHRoZSBtYWluIHZpZGVvIGNhbm5vdCBiZSBhbiBlbXB0eSBzdHJpbmcuIik7YnJlYWs7Y2FzZSJ2aWRlb0xlbmd0aCI6aWYoIWEuaGFzT3duUHJvcGVydHkoInZpZGVvTGVuZ3RoIikpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBsZW5ndGggb2YgdGhlIG1haW4gdmlkZW8gbXVzdCBiZSBzcGVjaWZpZWQuIik7aWYoIm51bWJlciIhPXR5cGVvZiBhLnZpZGVvTGVuZ3RoKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgbGVuZ3RoIG9mIHRoZSBtYWluIHZpZGVvIG11c3QgYmUgYSBOdW1iZXIuIik7aWYoaXNOYU4oYS52aWRlb0xlbmd0aCkpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBsZW5ndGggb2YgdGhlIG1haW4gdmlkZW8gY2Fubm90IGJlIE5hTi4iKTticmVhaztjYXNlInBvZFBsYXllck5hbWUiOmlmKCFhLmhhc093blByb3BlcnR5KCJwb2RQbGF5ZXJOYW1lIikpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBwbGF5ZXIgbmFtZSBmb3IgdGhlIGFkLWJyZWFrIG11c3QgYmUgc3BlY2lmaWVkLiIpO2lmKCJzdHJpbmciIT10eXBlb2YgYS5wb2RQbGF5ZXJOYW1lKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgcGxheWVyIG5hbWUgZm9yIHRoZSBhZC1icmVhayBtdXN0IGJlIGEgU3RyaW5nLiIpO2lmKCIiPT09YS5wb2RQbGF5ZXJOYW1lKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgcGxheWVyIG5hbWUgZm9yIHRoZSBhZC1icmVhayBjYW5ub3QgYmUgYW4gZW1wdHkgc3RyaW5nLiIpO2JyZWFrO2Nhc2UicG9kUG9zaXRpb24iOmlmKCFhLmhhc093blByb3BlcnR5KCJwb2RQb3NpdGlvbiIpKXJldHVybiB0aGlzLl9mYWlsKCJQb3NpdGlvbiAoaW5kZXgpIG9mIHRoZSBhZC1icmVhayBtdXN0IGJlIHNwZWNpZmllZC4iKTtpZigibnVtYmVyIiE9dHlwZW9mIGEucG9kUG9zaXRpb24pcmV0dXJuIHRoaXMuX2ZhaWwoIlBvc2l0aW9uIChpbmRleCkgb2YgdGhlIGFkLWJyZWFrIG11c3QgYmUgYSBOdW1iZXIuIik7aWYoaXNOYU4oYS5wb2RQb3NpdGlvbikpcmV0dXJuIHRoaXMuX2ZhaWwoIlBvc2l0aW9uIChpbmRleCkgb2YgdGhlIGFkLWJyZWFrIGNhbm5vdCBiZSBOYU4uIik7YnJlYWs7Y2FzZSJhZElkIjppZighYS5oYXNPd25Qcm9wZXJ0eSgiYWRJZCIpKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgYWQgSUQgbXVzdCBiZSBzcGVjaWZpZWQuIik7aWYoInN0cmluZyIhPXR5cGVvZiBhLmFkSWQpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBhZCBJRCBtdXN0IGJlIGEgU3RyaW5nLiIpO2lmKCIiPT09YS5hZElkKXJldHVybiB0aGlzLl9mYWlsKCJUaGUgYWQgSUQgY2Fubm90IGJlIGFuIGVtcHR5IHN0cmluZy4iKTticmVhaztjYXNlImFkUG9zaXRpb24iOmlmKCFhLmhhc093blByb3BlcnR5KCJhZFBvc2l0aW9uIikpcmV0dXJuIHRoaXMuX2ZhaWwoIlBvc2l0aW9uIChpbmRleCkgb2YgdGhlIGFkIG11c3QgYmUgc3BlY2lmaWVkLiIpO2lmKCJudW1iZXIiIT10eXBlb2YgYS5hZFBvc2l0aW9uKXJldHVybiB0aGlzLl9mYWlsKCJQb3NpdGlvbiAoaW5kZXgpIG9mIHRoZSBhZCBtdXN0IGJlIGEgTnVtYmVyLiIpO2lmKGlzTmFOKGEuYWRQb3NpdGlvbikpcmV0dXJuIHRoaXMuX2ZhaWwoIlBvc2l0aW9uIChpbmRleCkgb2YgdGhlIGFkIGNhbm5vdCBiZSBOYU4uIik7YnJlYWs7Y2FzZSJhZExlbmd0aCI6aWYoIWEuaGFzT3duUHJvcGVydHkoImFkTGVuZ3RoIikpcmV0dXJuIHRoaXMuX2ZhaWwoIlRoZSBsZW5ndGggb2YgdGhlIGFkIG11c3QgYmUgc3BlY2lmaWVkLiIpO2lmKCJudW1iZXIiIT10eXBlb2YgYS5hZExlbmd0aClyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIGxlbmd0aCBvZiB0aGUgYWQgbXVzdCBiZSBhIE51bWJlci4iKTtpZihpc05hTihhLmFkTGVuZ3RoKSlyZXR1cm4gdGhpcy5fZmFpbCgiVGhlIGxlbmd0aCBvZiB0aGUgYWQgY2Fubm90IGJlIE5hTi4iKTticmVhaztkZWZhdWx0OnJldHVybiB0aGlzLl9mYWlsKCJVbmFibGUgdG8gdmFsaWRhdGUgdW5rbm93biBwYXJhbWV0ZXI6ICIrZCl9fXJldHVybiEwfSxjLnByb3RvdHlwZS5fZmFpbD1mdW5jdGlvbihhKXt2YXIgYj1uZXcgZCgiSW52YWxpZCBpbnB1dCBkYXRhIixhKTtyZXR1cm4gdGhpcy5fb25GYWlsLmZuJiZ0aGlzLl9vbkZhaWwuZm4uY2FsbCh0aGlzLl9vbkZhaWwuY3R4LGIpLCExfSxiLklucHV0RGF0YVZhbGlkYXRvcj1jfShhLkFEQi52YSxiKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYigpe3RoaXMuY2hhbm5lbD1jLHRoaXMuZGVidWdMb2dnaW5nPSExfXZhciBjPSIiO2EuQWRvYmVBbmFseXRpY3NQbHVnaW5Db25maWc9Yn0oYiksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoKXt9Yi5wcm90b3R5cGUub25FcnJvcj1mdW5jdGlvbihhKXt9LGEuQWRvYmVBbmFseXRpY3NQbHVnaW5EZWxlZ2F0ZT1ifShiKSxmdW5jdGlvbihhLGIsYyxkKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gZShhLGIpe2lmKGUuX19zdXBlcl9fLmNvbnN0cnVjdG9yLmNhbGwodGhpcyxyKSwhYSl0aHJvdyBuZXcgRXJyb3IoIlRoZSByZWZlcmVuY2UgdG8gdGhlIEFwcE1lYXN1cmVtZW50IG9iamVjdCBjYW5ub3QgYmUgTlVMTC4iKTtpZihhLnVuc3VwcG9ydGVkQnJvd3Nlcil0aHJvdyBuZXcgRXJyb3IoIkFwcE1lYXN1cmVtZW50IGlzIG5vdCBzdXBwb3J0ZWQgaW4gY3VycmVudCBicm93c2VyLiIpO3RoaXMuX2FwcE1lYXN1cmVtZW50PWEsdGhpcy5fZGVsZWdhdGU9Yix0aGlzLl92aWRlb01ldGFkYXRhPXt9LHRoaXMuX2FkTWV0YWRhdGE9e30sdGhpcy5fY2hhcHRlck1ldGFkYXRhPXt9LHRoaXMuX2Vycm9ySW5mbz1udWxsLHRoaXMuX3dvcmtRdWV1ZT1uZXcgayghMCx3KSx0aGlzLl9pbnB1dERhdGFWYWxpZGF0b3I9bmV3IHEoZnVuY3Rpb24oYSl7dGhpcy5fZXJyb3JJbmZvPWEsdGhpcy5fbG9nZ2VyLmVycm9yKHRoaXMuX2xvZ1RhZyxhLmdldE1lc3NhZ2UoKSsiIHwgIithLmdldERldGFpbHMoKSk7dmFyIGI9dGhpcztzZXRUaW1lb3V0KGZ1bmN0aW9uKCl7Yi5fdHJpZ2dlcih4LGEpLGIuX2RlbGVnYXRlJiZiLl9kZWxlZ2F0ZS5vbkVycm9yKGIuX2Vycm9ySW5mbyl9LDApfSx0aGlzKSx0aGlzLl9hcHBNZWFzdXJlbWVudC5pc1JlYWR5VG9UcmFjaygpLHRoaXMuX3NldHVwRGF0YVJlc29sdmVyKCl9dmFyIGY9YS5UcmlnZ2VyLGc9YS5wbHVnaW4uQmFzZVBsdWdpbixoPWEucGx1Z2luLlBhcmFtTWFwcGluZyxpPWEucmFkaW8uQ2hhbm5lbCxqPWEucmFkaW8uQ29tbWFuZCxrPWEucmFkaW8uQ29tbWFuZFF1ZXVlLGw9Yi5FcnJvckluZm8sbT1jLm1kNSxuPWMuU3RyaW5nVXRpbHMsbz1jLk9iamVjdFV0aWxzLHA9ZC5BZG9iZUFuYWx5dGljc1BsdWdpbkNvbmZpZyxxPWQuSW5wdXREYXRhVmFsaWRhdG9yO2EuZXh0ZW5kKGUsZyksZS5wcm90b3R5cGUuY29uZmlndXJlPWZ1bmN0aW9uKGEpe2lmKCFhKXRocm93IG5ldyBFcnJvcigiUmVmZXJlbmNlIHRvIHRoZSBjb25maWd1cmF0aW9uIGRhdGEgY2Fubm90IGJlIE5VTEwuIik7aWYoIShhIGluc3RhbmNlb2YgcCkpdGhyb3cgbmV3IEVycm9yKCJFeHBlY3RlZCBjb25maWcgZGF0YSB0byBiZSBpbnN0YW5jZSBvZiBBZG9iZUFuYWx5dGljc1BsdWdpbkNvbmZpZy4iKTt0aGlzLl9jb25maWc9YSx0aGlzLl9jb25maWcuZGVidWdMb2dnaW5nP3RoaXMuX2xvZ2dlci5lbmFibGUoKTp0aGlzLl9sb2dnZXIuZGlzYWJsZSgpLHRoaXMuX2xvZ2dlci5kZWJ1Zyh0aGlzLl9sb2dUYWcsIiNjb25maWd1cmUoe3RyYWNraW5nU2VydmVyPSIrdGhpcy5fY29uZmlnLmRlYnVnTG9nZ2luZysiLCBjaGFubmVsPSIrdGhpcy5fY29uZmlnLmNoYW5uZWwrIiwgc3NsPSIrdGhpcy5fYXBwTWVhc3VyZW1lbnQuc3NsKyJ9KSIpfSxlLnByb3RvdHlwZS5ib290c3RyYXA9ZnVuY3Rpb24oYSl7ZS5fX3N1cGVyX18uYm9vdHN0cmFwLmNhbGwodGhpcyxhKSx0aGlzLl9yZWdpc3RlckNvbW1hbmRzKCksdGhpcy5fcmVnaXN0ZXJCZWhhdmlvdXJzKCl9LGUucHJvdG90eXBlLnNldHVwPWZ1bmN0aW9uKCl7dGhpcy5fYXBwTWVhc3VyZW1lbnQuaXNSZWFkeVRvVHJhY2soKT90aGlzLl9vbkFwcE1lYXN1cmVtZW50UmVhZHkoKTp0aGlzLl9hcHBNZWFzdXJlbWVudC5jYWxsYmFja1doZW5SZWFkeVRvVHJhY2sodGhpcyx0aGlzLl9vbkFwcE1lYXN1cmVtZW50UmVhZHksW10pLGUuX19zdXBlcl9fLnNldHVwLmNhbGwodGhpcyl9LGUucHJvdG90eXBlLnNldFZpZGVvTWV0YWRhdGE9ZnVuY3Rpb24oYSl7dGhpcy5fdmlkZW9NZXRhZGF0YT1vLmNsb25lKGEpfSxlLnByb3RvdHlwZS5zZXRBZE1ldGFkYXRhPWZ1bmN0aW9uKGEpe3RoaXMuX2FkTWV0YWRhdGE9by5jbG9uZShhKX0sZS5wcm90b3R5cGUuc2V0Q2hhcHRlck1ldGFkYXRhPWZ1bmN0aW9uKGEpe3RoaXMuX2NoYXB0ZXJNZXRhZGF0YT1vLmNsb25lKGEpfSxlLnByb3RvdHlwZS5fY2FuUHJvY2Vzcz1mdW5jdGlvbigpe3JldHVybiB0aGlzLl9lcnJvckluZm8/KHRoaXMuX2xvZ2dlci5lcnJvcih0aGlzLl9sb2dUYWcsIiNfY2FuUHJvY2VzcygpID4gSW4gRVJST1Igc3RhdGUuIiksITEpOmUuX19zdXBlcl9fLl9jYW5Qcm9jZXNzLmNhbGwodGhpcyl9LGUucHJvdG90eXBlLl9jbWRWaWRlb0xvYWQ9ZnVuY3Rpb24oYSl7dGhpcy5fZXJyb3JJbmZvPW51bGx9LGUucHJvdG90eXBlLl9jbWRWaWRlb1N0YXJ0PWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5kZWJ1Zyh0aGlzLl9sb2dUYWcsIiNfY21kVmlkZW9TdGFydCgpIiksdGhpcy5fY2FuUHJvY2VzcygpJiZ0aGlzLl93b3JrUXVldWUuYWRkQ29tbWFuZChuZXcgaih0aGlzLl9leGVjdXRlT3Blbix0aGlzLFthXSkpfSxlLnByb3RvdHlwZS5fY21kQWRTdGFydD1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuZGVidWcodGhpcy5fbG9nVGFnLCIjX2NtZEFkU3RhcnQoKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5fd29ya1F1ZXVlLmFkZENvbW1hbmQobmV3IGoodGhpcy5fZXhlY3V0ZU9wZW5BZCx0aGlzLFthXSkpfSxlLnByb3RvdHlwZS5fY21kSGVhcnRiZWF0UGx1Z2luRXJyb3I9ZnVuY3Rpb24oYSl7dGhpcy5fZXJyb3JJbmZvfHwodGhpcy5fZXJyb3JJbmZvPW5ldyBsKCJJbnRlcm5hbCBlcnJvciIsIkhlYXJ0YmVhdFBsdWdpbiBpcyBpbiBFUlJPUiBzdGF0ZS4iKSx0aGlzLl90cmlnZ2VyKHgsdGhpcy5fZXJyb3JJbmZvKSx0aGlzLl9kZWxlZ2F0ZSYmdGhpcy5fZGVsZWdhdGUub25FcnJvcih0aGlzLl9lcnJvckluZm8pKX0sZS5wcm90b3R5cGUuX3RyYWNrPWZ1bmN0aW9uKGEpe3RyeXtpZighdGhpcy5fYXBwTWVhc3VyZW1lbnQudmlzaXRvck9wdGVkT3V0KXt2YXIgYj10aGlzLl9hcHBNZWFzdXJlbWVudC5saW5rVHJhY2tWYXJzO3RoaXMuX2FwcE1lYXN1cmVtZW50LmxpbmtUcmFja1ZhcnM9IiIsdGhpcy5fYXBwTWVhc3VyZW1lbnQudHJhY2soYSksdGhpcy5fYXBwTWVhc3VyZW1lbnQubGlua1RyYWNrVmFycz1ifX1jYXRjaChhKXt0aGlzLl9sb2dnZXIud2Fybih0aGlzLl9sb2dUYWcsImFwcE1lYXN1cmVtZW50LnRyYWNrKCkgY2FsbCB0aHJldyBhbiBleGNlcHRpb24uIil9fSxlLnByb3RvdHlwZS5fZXhlY3V0ZU9wZW49ZnVuY3Rpb24oYSl7aWYodGhpcy5fbG9nZ2VyLmRlYnVnKHRoaXMuX2xvZ1RhZywiI19leGVjdXRlT3BlbihpZD0iK2EudmlkZW9JZCsiLCB2aWRlb05hbWU9IithLnZpZGVvTmFtZSsiLCBtZWRpYVR5cGU9IithLm1lZGlhVHlwZSsiLCBzdHJlYW1UeXBlPSIrYS5zdHJlYW1UeXBlKyIsIGxlbmd0aD0iK2EudmlkZW9MZW5ndGgrIiwgcGxheWVyTmFtZT0iK2EucGxheWVyTmFtZSsiLCBjaGFubmVsPSIrYS5jaGFubmVsKyIsIGlzUHJpbWV0aW1lPSIrYS5pc1ByaW1ldGltZSsiLCBzZXNzaW9uSWQ9IithLnNlc3Npb25JZCsiKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5faW5wdXREYXRhVmFsaWRhdG9yLnZhbGlkYXRlRmllbGRzKGEsWyJ2aWRlb0lkIiwibWVkaWFUeXBlIiwic3RyZWFtVHlwZSIsInZpZGVvTGVuZ3RoIiwicGxheWVyTmFtZSJdKSl7dmFyIGI9e307Zm9yKHZhciBjIGluIGEubWV0YVZpZGVvKWEubWV0YVZpZGVvLmhhc093blByb3BlcnR5KGMpJiYoYltjXT1hLm1ldGFWaWRlb1tjXSk7aWYoYS5tZXRhTmllbHNlbilmb3IodmFyIGMgaW4gYS5tZXRhTmllbHNlbilhLm1ldGFOaWVsc2VuLmhhc093blByb3BlcnR5KGMpJiYoYltjXT1hLm1ldGFOaWVsc2VuW2NdKTtiWyJhLmNvbnRlbnRUeXBlIl09YS5zdHJlYW1UeXBlLGJbImEubWVkaWEubmFtZSJdPWEudmlkZW9JZCxiWyJhLm1lZGlhLmZyaWVuZGx5TmFtZSJdPWEudmlkZW9OYW1lfHwiIixiWyJhLm1lZGlhLmxlbmd0aCJdPU1hdGguZmxvb3IoYS52aWRlb0xlbmd0aCl8fCIwIixiWyJhLm1lZGlhLnBsYXllck5hbWUiXT1hLnBsYXllck5hbWUsYlsiYS5tZWRpYS5jaGFubmVsIl09YS5jaGFubmVsfHwiIixiWyJhLm1lZGlhLnZpZXciXT0hMCxiWyJhLm1lZGlhLnZzaWQiXT1hLnNlc3Npb25JZDt2YXIgZD17fTtkLmNvbnRleHREYXRhPWIsImF1ZGlvIj09PWEubWVkaWFUeXBlPyhkLnBldjM9QSxkLm1zX2E9IjEiKTpkLnBldjM9eSxkLnBlPWEuaXNQcmltZXRpbWU/RDpDLHRoaXMuX3RyYWNrKGQpO3ZhciBlPXRoaXM7c2V0VGltZW91dChmdW5jdGlvbigpe2UuX3RyaWdnZXIoRyxhKX0sMCl9fSxlLnByb3RvdHlwZS5fZXhlY3V0ZU9wZW5BZD1mdW5jdGlvbihhKXt2YXIgYj1tKGEudmlkZW9JZCkrIl8iK2EucG9kUG9zaXRpb247aWYodGhpcy5fbG9nZ2VyLmRlYnVnKHRoaXMuX2xvZ1RhZywiI19leGVjdXRlT3BlbkFkKGlkPSIrYS5hZElkKyIsIG1lZGlhVHlwZT0iK2EubWVkaWFUeXBlKyIsIHN0cmVhbVR5cGU9IithLnN0cmVhbVR5cGUrIiwgbGVuZ3RoPSIrYS5hZExlbmd0aCsiLCBwb2RQbGF5ZXJOYW1lPSIrYS5wb2RQbGF5ZXJOYW1lKyIsIHBhcmVudElkPSIrYS52aWRlb0lkKyIsIHBvZElkPSIrYisiLCBwYXJlbnRQb2RQb3NpdGlvbj0iK2EuYWRQb3NpdGlvbisiLCBwb2RTZWNvbmQ9IithLnBvZFNlY29uZCsiKSIpLHRoaXMuX2NhblByb2Nlc3MoKSYmdGhpcy5faW5wdXREYXRhVmFsaWRhdG9yLnZhbGlkYXRlRmllbGRzKGEsWyJ2aWRlb0lkIiwibWVkaWFUeXBlIiwic3RyZWFtVHlwZSIsInBsYXllck5hbWUiLCJhZElkIiwiYWRMZW5ndGgiLCJwb2RQbGF5ZXJOYW1lIiwiYWRQb3NpdGlvbiJdKSl7YS5wb2RTZWNvbmQ9bnVsbD09YS5wb2RTZWNvbmR8fGlzTmFOKGEucG9kU2Vjb25kKT9hLnBsYXloZWFkOmEucG9kU2Vjb25kO3ZhciBjLGQ9e307Zm9yKGMgaW4gYS5tZXRhVmlkZW8pYS5tZXRhVmlkZW8uaGFzT3duUHJvcGVydHkoYykmJihkW2NdPWEubWV0YVZpZGVvW2NdKTtmb3IoYyBpbiBhLm1ldGFBZClhLm1ldGFBZC5oYXNPd25Qcm9wZXJ0eShjKSYmKGRbY109YS5tZXRhQWRbY10pO2lmKGEubWV0YU5pZWxzZW4pZm9yKHZhciBjIGluIGEubWV0YU5pZWxzZW4pYS5tZXRhTmllbHNlbi5oYXNPd25Qcm9wZXJ0eShjKSYmKGRbY109YS5tZXRhTmllbHNlbltjXSk7ZFsiYS5jb250ZW50VHlwZSJdPWEuc3RyZWFtVHlwZSxkWyJhLm1lZGlhLm5hbWUiXT1hLnZpZGVvSWQsZFsiYS5tZWRpYS5wbGF5ZXJOYW1lIl09YS5wbGF5ZXJOYW1lLGRbImEubWVkaWEuY2hhbm5lbCJdPWEuY2hhbm5lbHx8IiIsZFsiYS5tZWRpYS52c2lkIl09YS5zZXNzaW9uSWQsZFsiYS5tZWRpYS5mcmllbmRseU5hbWUiXT1hLnZpZGVvTmFtZXx8IiIsZFsiYS5tZWRpYS5sZW5ndGgiXT1NYXRoLmZsb29yKGEudmlkZW9MZW5ndGgpfHwiMCIsZFsiYS5tZWRpYS5hZC5uYW1lIl09YS5hZElkLGRbImEubWVkaWEuYWQuZnJpZW5kbHlOYW1lIl09YS5hZE5hbWV8fCIiLGRbImEubWVkaWEuYWQucG9kRnJpZW5kbHlOYW1lIl09YS5wb2ROYW1lfHwiIixkWyJhLm1lZGlhLmFkLmxlbmd0aCJdPU1hdGguZmxvb3IoYS5hZExlbmd0aCl8fCIwIixkWyJhLm1lZGlhLmFkLnBsYXllck5hbWUiXT1hLnBvZFBsYXllck5hbWUsZFsiYS5tZWRpYS5hZC5wb2QiXT1iLGRbImEubWVkaWEuYWQucG9kUG9zaXRpb24iXT1NYXRoLmZsb29yKGEuYWRQb3NpdGlvbil8fCIwIixkWyJhLm1lZGlhLmFkLnBvZFNlY29uZCJdPU1hdGguZmxvb3IoYS5wb2RTZWNvbmQpfHwiMCIsZFsiYS5tZWRpYS5hZC52aWV3Il09ITA7dmFyIGU9e307ZS5jb250ZXh0RGF0YT1kLCJhdWRpbyI9PT1hLm1lZGlhVHlwZT8oZS5wZXYzPUIsZS5tc19hPSIxIik6ZS5wZXYzPXosZS5wZT1hLmlzUHJpbWV0aW1lP0Y6RSx0aGlzLl90cmFjayhlKTt2YXIgZj10aGlzO3NldFRpbWVvdXQoZnVuY3Rpb24oKXtmLl90cmlnZ2VyKEgsYSl9LDApfX0sZS5wcm90b3R5cGUuX3NldHVwRGF0YVJlc29sdmVyPWZ1bmN0aW9uKCl7dmFyIGE9e30sYj10aGlzO2EucnNpZD1mdW5jdGlvbigpe3JldHVybiBiLl9hcHBNZWFzdXJlbWVudC5hY2NvdW50fSxhLnRyYWNraW5nX3NlcnZlcj1mdW5jdGlvbigpe3JldHVybiBiLl9hcHBNZWFzdXJlbWVudC5zc2wmJmIuX2FwcE1lYXN1cmVtZW50LnRyYWNraW5nU2VydmVyU2VjdXJlP2IuX2FwcE1lYXN1cmVtZW50LnRyYWNraW5nU2VydmVyU2VjdXJlOmIuX2FwcE1lYXN1cmVtZW50LnRyYWNraW5nU2VydmVyfSxhLnNzbD1mdW5jdGlvbigpe3JldHVybiBiLl9hcHBNZWFzdXJlbWVudC5zc2x9LGEudmlkPWZ1bmN0aW9uKCl7cmV0dXJuIGIuX2FwcE1lYXN1cmVtZW50LnZpc2l0b3JJRH0sYS5haWQ9ZnVuY3Rpb24oKXtyZXR1cm4gYi5fYXBwTWVhc3VyZW1lbnQuYW5hbHl0aWNzVmlzaXRvcklEfSxhLm1pZD1mdW5jdGlvbigpe3JldHVybiBiLl9hcHBNZWFzdXJlbWVudC5tYXJrZXRpbmdDbG91ZFZpc2l0b3JJRH0sYS5ibG9iPWZ1bmN0aW9uKCl7cmV0dXJuIGIuX2FwcE1lYXN1cmVtZW50LmF1ZGllbmNlTWFuYWdlckJsb2J9LGEubG9jX2hpbnQ9ZnVuY3Rpb24oKXtyZXR1cm4gYi5fYXBwTWVhc3VyZW1lbnQuYXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50P3BhcnNlSW50KGIuX2FwcE1lYXN1cmVtZW50LmF1ZGllbmNlTWFuYWdlckxvY2F0aW9uSGludCk6IiJ9LGEuY3VzdG9tZXJJRHM9ZnVuY3Rpb24oKXt2YXIgYT17fSxjPWIuX2FwcE1lYXN1cmVtZW50LnZpc2l0b3IuZ2V0Q3VzdG9tZXJJRHMoKTtmb3IodmFyIGQgaW4gYylpZihjLmhhc093blByb3BlcnR5KGQpKXt2YXIgZT1jW2RdO2lmKCJvYmplY3QiPT10eXBlb2YgZSl7Zm9yKHZhciBmIGluIGUpZS5oYXNPd25Qcm9wZXJ0eShmKSYmKCJhdXRoU3RhdGUiPT1mP2FbZCsiLmFzIl09ZVtmXTphW2QrIi4iK2ZdPWVbZl0pO2FbZCsiLmFzIl18fChhW2QrIi5hcyJdPSIwIil9fXJldHVybiBhfSxhLnZpc2l0b3JPcHRlZE91dD1mdW5jdGlvbigpe3JldHVybiEhYi5fYXBwTWVhc3VyZW1lbnQudmlzaXRvck9wdGVkT3V0fSxhLmNoYW5uZWw9ZnVuY3Rpb24oKXtyZXR1cm4gYi5fY29uZmlnP2IuX2NvbmZpZy5jaGFubmVsOm51bGx9LGEubWV0YT1mdW5jdGlvbihhKXt2YXIgYz1hLnNwbGl0KCIuIik7aWYoYy5sZW5ndGg8MilyZXR1cm4gbnVsbDt2YXIgZD1jLnNoaWZ0KCk7c3dpdGNoKGE9Yy5qb2luKCIuIiksZCl7Y2FzZSJ2aWRlbyI6cmV0dXJuIGE9PWkuV0lMRENBUkQ/Yi5fdmlkZW9NZXRhZGF0YTpiLl92aWRlb01ldGFkYXRhW2FdO2Nhc2UiYWQiOnJldHVybiBhPT1pLldJTERDQVJEP2IuX2FkTWV0YWRhdGE6Yi5fYWRNZXRhZGF0YVthXTtjYXNlImNoYXB0ZXIiOnJldHVybiBhPT1pLldJTERDQVJEP2IuX2NoYXB0ZXJNZXRhZGF0YTpiLl9jaGFwdGVyTWV0YWRhdGFbYV07ZGVmYXVsdDpyZXR1cm4gbnVsbH19LHRoaXMuX2RhdGFSZXNvbHZlcj1mdW5jdGlvbihiKXtpZighYnx8MD09Yi5sZW5ndGgpcmV0dXJuIG51bGw7Zm9yKHZhciBjPW51bGwsZD0wO2Q8Yi5sZW5ndGg7ZCsrKXt2YXIgZT1iW2RdO2M9Y3x8e30sbi5zdGFydHNXaXRoKGUsIm1ldGEuIik/Y1tlXT1hLm1ldGEoZS5zcGxpdCgibWV0YS4iKVsxXSk6Y1tlXT1hLmhhc093blByb3BlcnR5KGUpP2FbZV0uY2FsbCh0aGlzKTpudWxsfXJldHVybiBjfX0sZS5wcm90b3R5cGUuX3JlZ2lzdGVyQ29tbWFuZHM9ZnVuY3Rpb24oKXt0aGlzLl9wbHVnaW5NYW5hZ2VyLmNvbXBseSh0aGlzLCJoYW5kbGVWaWRlb0xvYWQiLHRoaXMuX2NtZFZpZGVvTG9hZCksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlVmlkZW9TdGFydCIsdGhpcy5fY21kVmlkZW9TdGFydCksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlQWRTdGFydCIsdGhpcy5fY21kQWRTdGFydCksdGhpcy5fcGx1Z2luTWFuYWdlci5jb21wbHkodGhpcywiaGFuZGxlSGVhcnRiZWF0UGx1Z2luRXJyb3IiLHRoaXMuX2NtZEhlYXJ0YmVhdFBsdWdpbkVycm9yKX0sZS5wcm90b3R5cGUuX3JlZ2lzdGVyQmVoYXZpb3Vycz1mdW5jdGlvbigpe3RoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYodSxJKSx0aGlzLCJoYW5kbGVWaWRlb0xvYWQiKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHUsSiksdGhpcywiaGFuZGxlVmlkZW9TdGFydCIsW25ldyBoKHUsInZpZGVvLmlkIiwidmlkZW9JZCIpLG5ldyBoKHUsInZpZGVvLm1lZGlhVHlwZSIsIm1lZGlhVHlwZSIpLG5ldyBoKHUsInZpZGVvLnN0cmVhbVR5cGUiLCJzdHJlYW1UeXBlIiksbmV3IGgodSwidmlkZW8ubmFtZSIsInZpZGVvTmFtZSIpLG5ldyBoKHUsInZpZGVvLmxlbmd0aCIsInZpZGVvTGVuZ3RoIiksbmV3IGgodSwidmlkZW8ucGxheWVyTmFtZSIsInBsYXllck5hbWUiKSxuZXcgaCh1LCJ2aWRlby5zdHJlYW1UeXBlIiwic3RyZWFtVHlwZSIpLG5ldyBoKHYsImlzX3ByaW1ldGltZSIsImlzUHJpbWV0aW1lIiksbmV3IGgodiwic2Vzc2lvbl9pZCIsInNlc3Npb25JZCIpLG5ldyBoKHMsImNoYW5uZWwiLCJjaGFubmVsIiksbmV3IGgocywibWV0YS52aWRlby4qIiwibWV0YVZpZGVvIiksbmV3IGgodCwibWV0YSIsIm1ldGFOaWVsc2VuIildKSx0aGlzLl9wbHVnaW5NYW5hZ2VyLnJlZ2lzdGVyQmVoYXZpb3VyKG5ldyBmKHUsSyksdGhpcywiaGFuZGxlQWRTdGFydCIsW25ldyBoKHUsInZpZGVvLmlkIiwidmlkZW9JZCIpLG5ldyBoKHUsInZpZGVvLm1lZGlhVHlwZSIsIm1lZGlhVHlwZSIpLG5ldyBoKHUsInZpZGVvLnN0cmVhbVR5cGUiLCJzdHJlYW1UeXBlIiksbmV3IGgodSwidmlkZW8ucGxheWhlYWQiLCJwbGF5aGVhZCIpLG5ldyBoKHUsInZpZGVvLnBsYXllck5hbWUiLCJwbGF5ZXJOYW1lIiksbmV3IGgodSwidmlkZW8ubmFtZSIsInZpZGVvTmFtZSIpLG5ldyBoKHUsInZpZGVvLmxlbmd0aCIsInZpZGVvTGVuZ3RoIiksbmV3IGgodSwiYWQuaWQiLCJhZElkIiksbmV3IGgodSwiYWQubGVuZ3RoIiwiYWRMZW5ndGgiKSxuZXcgaCh1LCJhZC5wb3NpdGlvbiIsImFkUG9zaXRpb24iKSxuZXcgaCh1LCJhZC5uYW1lIiwiYWROYW1lIiksbmV3IGgodSwicG9kLm5hbWUiLCJwb2ROYW1lIiksbmV3IGgodSwicG9kLnBvc2l0aW9uIiwicG9kUG9zaXRpb24iKSxuZXcgaCh1LCJwb2QucGxheWVyTmFtZSIsInBvZFBsYXllck5hbWUiKSxuZXcgaCh1LCJwb2Quc3RhcnRUaW1lIiwicG9kU2Vjb25kIiksbmV3IGgodiwiaXNfcHJpbWV0aW1lIiwiaXNQcmltZXRpbWUiKSxuZXcgaCh2LCJzZXNzaW9uX2lkIiwic2Vzc2lvbklkIiksbmV3IGgocywiY2hhbm5lbCIsImNoYW5uZWwiKSxuZXcgaChzLCJtZXRhLnZpZGVvLioiLCJtZXRhVmlkZW8iKSxuZXcgaChzLCJtZXRhLmFkLioiLCJtZXRhQWQiKSxuZXcgaCh0LCJtZXRhIiwibWV0YU5pZWxzZW4iKV0pLHRoaXMuX3BsdWdpbk1hbmFnZXIucmVnaXN0ZXJCZWhhdmlvdXIobmV3IGYodix4KSx0aGlzLCJoYW5kbGVIZWFydGJlYXRQbHVnaW5FcnJvciIpfSxlLnByb3RvdHlwZS5fb25BcHBNZWFzdXJlbWVudFJlYWR5PWZ1bmN0aW9uKCl7dGhpcy5fbG9nZ2VyLmRlYnVnKHRoaXMuX2xvZ1RhZywiW0luaXRdICNfb25BcHBNZWFzdXJlbWVudFJlYWR5IiksdGhpcy5fd29ya1F1ZXVlLnJlc3VtZSgpfTt2YXIgcj0iYWRvYmUtYW5hbHl0aWNzIixzPXIsdD0ibmllbHNlbiIsdT0icGxheWVyIix2PSJhZG9iZS1oZWFydGJlYXQiLHc9MmUzLHg9ImVycm9yIix5PSJ2aWRlbyIsej0idmlkZW9BZCIsQT0iYXVkaW8iLEI9ImF1ZGlvQWQiLEM9Im1zX3MiLEQ9Im1zcF9zIixFPSJtc2FfcyIsRj0ibXNwYV9zIixHPSJhYV9zdGFydCIsSD0ic2NfYWRfc3RhcnQiLEk9InZpZGVvX2xvYWQiLEo9InZpZGVvX3N0YXJ0IixLPSJhZF9zdGFydCI7ZC5BZG9iZUFuYWx5dGljc1BsdWdpbj1lfShhLkFEQi5jb3JlLGEuQURCLnZhLGEuQURCLnZhLnV0aWxzLGIpLGZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0Ijt2YXIgYj17U0hPVzoiYS5tZWRpYS5zaG93IixTRUFTT046ImEubWVkaWEuc2Vhc29uIixFUElTT0RFOiJhLm1lZGlhLmVwaXNvZGUiLEFTU0VUX0lEOiJhLm1lZGlhLmFzc2V0IixHRU5SRToiYS5tZWRpYS5nZW5yZSIsRklSU1RfQUlSX0RBVEU6ImEubWVkaWEuYWlyRGF0ZSIsRklSU1RfRElHSVRBTF9EQVRFOiJhLm1lZGlhLmRpZ2l0YWxEYXRlIixSQVRJTkc6ImEubWVkaWEucmF0aW5nIixPUklHSU5BVE9SOiJhLm1lZGlhLm9yaWdpbmF0b3IiLE5FVFdPUks6ImEubWVkaWEubmV0d29yayIsU0hPV19UWVBFOiJhLm1lZGlhLnR5cGUiLEFEX0xPQUQ6ImEubWVkaWEuYWRMb2FkIixNVlBEOiJhLm1lZGlhLnBhc3MubXZwZCIsQVVUSE9SSVpFRDoiYS5tZWRpYS5wYXNzLmF1dGgiLERBWV9QQVJUOiJhLm1lZGlhLmRheVBhcnQiLEZFRUQ6ImEubWVkaWEuZmVlZCIsU1RSRUFNX0ZPUk1BVDoiYS5tZWRpYS5mb3JtYXQifSxjPXtBUlRJU1Q6ImEubWVkaWEuYXJ0aXN0IixBTEJVTToiYS5tZWRpYS5hbGJ1bSIsTEFCRUw6ImEubWVkaWEubGFiZWwiLEFVVEhPUjoiYS5tZWRpYS5hdXRob3IiLFNUQVRJT046ImEubWVkaWEuc3RhdGlvbiIsUFVCTElTSEVSOiJhLm1lZGlhLnB1Ymxpc2hlciJ9LGQ9e0FEVkVSVElTRVI6ImEubWVkaWEuYWQuYWR2ZXJ0aXNlciIsQ0FNUEFJR05fSUQ6ImEubWVkaWEuYWQuY2FtcGFpZ24iLENSRUFUSVZFX0lEOiJhLm1lZGlhLmFkLmNyZWF0aXZlIixQTEFDRU1FTlRfSUQ6ImEubWVkaWEuYWQucGxhY2VtZW50IixTSVRFX0lEOiJhLm1lZGlhLmFkLnNpdGUiLENSRUFUSVZFX1VSTDoiYS5tZWRpYS5hZC5jcmVhdGl2ZVVSTCJ9O2EuVmlkZW9NZXRhZGF0YUtleXM9YixhLkF1ZGlvTWV0YWRhdGFLZXlzPWMsYS5BZE1ldGFkYXRhS2V5cz1kfShiKSxhLkFEQi52YS5wbHVnaW5zLmFhfHwoYS5BREIudmEucGx1Z2lucy5hYT1iKX0odGhpcyk7XG5cbi8vIE1lZGlhSGVhcnRiZWF0XG4hZnVuY3Rpb24oYSl7IWZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoKXt0aGlzLl9wcm9jZXNzQWN0aW9uPSEwLHRoaXMuX3N0b3JlPXt9fWZ1bmN0aW9uIGQoYSl7aWYoIWEpdGhyb3cgbmV3IEVycm9yKCJSZWZlcmVuY2UgdG8gdGhlIGxvZ2dlciBvYmplY3QgY2Fubm90IGJlIE5VTEwiKTt0aGlzLl9sb2dnZXI9YSx0aGlzLl9ydWxlcz1bXX1jLnByb3RvdHlwZS5zZXRSdWxlTmFtZT1mdW5jdGlvbihhKXt0aGlzLl9ydWxlTmFtZT1hfSxjLnByb3RvdHlwZS5nZXRSdWxlTmFtZT1mdW5jdGlvbihhLGIpe3JldHVybiB0aGlzLl9ydWxlTmFtZX0sYy5wcm90b3R5cGUuc2V0RGF0YT1mdW5jdGlvbihhLGIpe3RoaXMuX3N0b3JlW2FdPWJ9LGMucHJvdG90eXBlLmdldERhdGE9ZnVuY3Rpb24oYSl7cmV0dXJuIHRoaXMuX3N0b3JlW2FdfSxjLnByb3RvdHlwZS5zaG91bGRQcm9jZXNzQWN0aW9uPWZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMuX3Byb2Nlc3NBY3Rpb259LGMucHJvdG90eXBlLnN0b3BQcm9jZXNzaW5nQWN0aW9uPWZ1bmN0aW9uKCl7dGhpcy5fcHJvY2Vzc0FjdGlvbj0hMX0sYy5wcm90b3R5cGUuc3RhcnRQcm9jZXNzaW5nQWN0aW9uPWZ1bmN0aW9uKCl7dGhpcy5fcHJvY2Vzc0FjdGlvbj0hMH0sZC5jcmVhdGVDb250ZXh0PWZ1bmN0aW9uKCl7cmV0dXJuIG5ldyBjfSxkLmNyZWF0ZVByZWRpY2F0ZT1mdW5jdGlvbihhLGIsYyl7cmV0dXJue2ZuOmEsZXhwZWN0ZWRWYWx1ZTpiLG1zZzpjfX0sZC5wcm90b3R5cGUucmVnaXN0ZXJSdWxlPWZ1bmN0aW9uKGEsYixjLGQsZSl7dGhpcy5fcnVsZXMucHVzaCh7bmFtZTphLGRlc2M6YixwcmVjb25kaXRpb25zOmMsYWN0aW9uczpkLHNjb3BlOmV9KX0sZC5wcm90b3R5cGUucmVnaXN0ZXJFbnRlckV4aXRBY3Rpb249ZnVuY3Rpb24oYSxiKXt0aGlzLl9lbnRlckFjdGlvbj1hLHRoaXMuX2V4aXRBY3Rpb249Yn0sZC5wcm90b3R5cGUuX2hhbmRsZUZhaWx1cmU9ZnVuY3Rpb24oYSxiKXt0aGlzLl9sb2dnZXIuZXJyb3IoZSxhLmRlc2MrIiAtICAiK2IubXNnKX0sZC5wcm90b3R5cGUuX2dldFJ1bGU9ZnVuY3Rpb24oYSl7Zm9yKHZhciBiPTA7Yjx0aGlzLl9ydWxlcy5sZW5ndGg7KytiKWlmKHRoaXMuX3J1bGVzW2JdLm5hbWU9PT1hKXJldHVybiB0aGlzLl9ydWxlc1tiXTtyZXR1cm4gbnVsbH0sZC5wcm90b3R5cGUucHJvY2Vzc1J1bGU9ZnVuY3Rpb24oYSxiKXt2YXIgYz0hMCxmPXRoaXMuX2dldFJ1bGUoYSk7aWYoZil7dmFyIGc9Zi5zY29wZTtifHwoYj1kLmNyZWF0ZUNvbnRleHQoKSksYi5zZXRSdWxlTmFtZShhKTtmb3IodmFyIGg9ITEsaT0wO2k8Zi5wcmVjb25kaXRpb25zLmxlbmd0aDsrK2kpe3ZhciBqPWYucHJlY29uZGl0aW9uc1tpXTtpZihoPSEhai5mbi5jYWxsKGcsYikhPT1qLmV4cGVjdGVkVmFsdWUpe3RoaXMuX2hhbmRsZUZhaWx1cmUoZixqKTticmVha319aWYoaCljPSExO2Vsc2V7Yi5zdGFydFByb2Nlc3NpbmdBY3Rpb24oKSx0aGlzLl9lbnRlckFjdGlvbiYmdGhpcy5fZW50ZXJBY3Rpb24uY2FsbChnLGIpO2Zvcih2YXIgaT0wO2k8Zi5hY3Rpb25zLmxlbmd0aDsrK2kpe3ZhciBrPWYuYWN0aW9uc1tpXTtpZighYi5zaG91bGRQcm9jZXNzQWN0aW9uKCkpe3RoaXMuX2xvZ2dlci5pbmZvKGUsIlN0b3BwaW5nIGFjdGlvbnMgZm9yICIrZi5kZXNjKTticmVha31rLmNhbGwoZyxiKX10aGlzLl9leGl0QWN0aW9uJiZiLnNob3VsZFByb2Nlc3NBY3Rpb24oKSYmdGhpcy5fZXhpdEFjdGlvbi5jYWxsKGcsYil9fWVsc2UgdGhpcy5fbG9nZ2VyLndhcm4oZSwiTm8gcmVnaXN0ZXJlZCBldmVudCBmb3VuZCBmb3IgcnVsZU5hbWUgIithKSxjPSExO3JldHVybiBjfTt2YXIgZT0iUnVsZUVuZ2luZSI7Yi5fUnVsZUVuZ2luZT1kfShhLkFEQi5jb3JlLGEuQURCLnZhKSxmdW5jdGlvbihhLGIpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiBjKGEsYixjKXt0aGlzLnRhc2tGbj1hLHRoaXMuc2NvcGU9Yix0aGlzLmludGVydmFsPWMsdGhpcy5yZW1haW5pbmdJbnRlcnZhbD1jfWZ1bmN0aW9uIGQoYSl7aWYoIWEpdGhyb3cgbmV3IEVycm9yKCJSZWZlcmVuY2UgdG8gdGhlIGxvZ2dlciBvYmplY3QgY2Fubm90IGJlIE5VTEwiKTt0aGlzLl9sb2dnZXI9YSx0aGlzLl90YXNrcz1bXSx0aGlzLl9wYXVzZWRUYXNrcz1bXX1jLnByb3RvdHlwZS5lbGFwc2VkVGltZT1mdW5jdGlvbihhKXt0aGlzLnJlbWFpbmluZ0ludGVydmFsLT1hfSxjLnByb3RvdHlwZS5zaG91bGRFeGVjdXRlPWZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMucmVtYWluaW5nSW50ZXJ2YWw8PTB9LGMucHJvdG90eXBlLmV4ZWN1dGU9ZnVuY3Rpb24oKXt0aGlzLnRhc2tGbi5jYWxsKHRoaXMuc2NvcGUpfSxkLnByb3RvdHlwZS5fZ2V0Q3VycmVudFRpbWVJbk1TPWZ1bmN0aW9uKCl7cmV0dXJuKG5ldyBEYXRlKS5nZXRUaW1lKCl9LGQucHJvdG90eXBlLl9ydW5UYXNrc0ZvclRpbWU9ZnVuY3Rpb24oYSl7dmFyIGI9W10sYz1hLXRoaXMuX2xhc3RUaWNrVGltZTt0aGlzLl9sYXN0VGlja1RpbWU9YTtmb3IodmFyIGQ9MDtkPHRoaXMuX3Rhc2tzLmxlbmd0aDspe3ZhciBlPXRoaXMuX3Rhc2tzW2RdO2UuZWxhcHNlZFRpbWUoYyksZS5zaG91bGRFeGVjdXRlKCk/KGIucHVzaChlKSx0aGlzLl90YXNrcy5zcGxpY2UoZCwxKSk6KytkfXRoaXMuX2NoZWNrU3RvcFRpbWVyKCk7Zm9yKHZhciBkPTA7ZDxiLmxlbmd0aDsrK2QpYltkXS5leGVjdXRlKCl9LGQucHJvdG90eXBlLl9vblRpY2s9ZnVuY3Rpb24oKXt2YXIgYT10aGlzLl9nZXRDdXJyZW50VGltZUluTVMoKTt0aGlzLl9ydW5UYXNrc0ZvclRpbWUoYSl9LGQucHJvdG90eXBlLl9zdGFydFRpbWVyPWZ1bmN0aW9uKCl7dmFyIGE9dGhpczt0aGlzLl90aW1lcnx8KHRoaXMuX2xvZ2dlci5pbmZvKGUsIiNzdGFydFRpbWVyKCkiKSxhLl9sYXN0VGlja1RpbWU9dGhpcy5fZ2V0Q3VycmVudFRpbWVJbk1TKCksdGhpcy5fdGltZXI9d2luZG93LnNldEludGVydmFsKGZ1bmN0aW9uKCl7YS5fb25UaWNrKCl9LGYpKX0sZC5wcm90b3R5cGUuX3N0b3BUaW1lcj1mdW5jdGlvbigpe3RoaXMuX3RpbWVyJiYodGhpcy5fbG9nZ2VyLmluZm8oZSwiI3N0b3BUaW1lcigpIiksd2luZG93LmNsZWFySW50ZXJ2YWwodGhpcy5fdGltZXIpLHRoaXMuX3RpbWVyPW51bGwpfSxkLnByb3RvdHlwZS5fY2hlY2tTdGFydFRpbWVyPWZ1bmN0aW9uKCl7dGhpcy5fdGFza3MubGVuZ3RoPjAmJnRoaXMuX3N0YXJ0VGltZXIoKX0sZC5wcm90b3R5cGUuX2NoZWNrU3RvcFRpbWVyPWZ1bmN0aW9uKCl7MD09PXRoaXMuX3Rhc2tzLmxlbmd0aCYmdGhpcy5fc3RvcFRpbWVyKCl9LGQucHJvdG90eXBlLl9yZW1vdmVUYXNrPWZ1bmN0aW9uKGEsYil7Zm9yKHZhciBjPTA7YzxhLmxlbmd0aDsrK2MpaWYoYVtjXT09PWIpcmV0dXJuIGEuc3BsaWNlKGMsMSksITA7cmV0dXJuITF9LGQucHJvdG90eXBlLnNjaGVkdWxlVGFzaz1mdW5jdGlvbihhLGIsZCl7aWYodGhpcy5fbG9nZ2VyLmluZm8oZSwiI3NjaGVkdWxlVGFzaygpIiksIWEpdGhyb3cgbmV3IEVycm9yKCJSZWZlcmVuY2UgdG8gdGhlIHRhc2tGbiBjYW5ub3QgYmUgTlVMTCIpO3ZhciBmPW5ldyBjKGEsYixkKTtyZXR1cm4gdGhpcy5fdGFza3MucHVzaChmKSx0aGlzLl9jaGVja1N0YXJ0VGltZXIoKSxmfSxkLnByb3RvdHlwZS5jYW5jZWxUYXNrPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5pbmZvKGUsIiNjYW5jZWxUYXNrKCkiKSx0aGlzLl9yZW1vdmVUYXNrKHRoaXMuX3Rhc2tzLGEpLHRoaXMuX2NoZWNrU3RvcFRpbWVyKCl9LGQucHJvdG90eXBlLnBhdXNlVGFzaz1mdW5jdGlvbihhKXt0aGlzLl9sb2dnZXIuaW5mbyhlLCIjcGF1c2VUYXNrKCkiKSx0aGlzLl9yZW1vdmVUYXNrKHRoaXMuX3Rhc2tzLGEpJiZ0aGlzLl9wYXVzZWRUYXNrcy5wdXNoKGEpLHRoaXMuX2NoZWNrU3RvcFRpbWVyKCl9LGQucHJvdG90eXBlLnJlc3VtZVRhc2s9ZnVuY3Rpb24oYSl7dGhpcy5fbG9nZ2VyLmluZm8oZSwiI3Jlc3VtZVRhc2soKSIpLHRoaXMuX3JlbW92ZVRhc2sodGhpcy5fcGF1c2VkVGFza3MsYSkmJnRoaXMuX3Rhc2tzLnB1c2goYSksdGhpcy5fY2hlY2tTdGFydFRpbWVyKCl9LGQucHJvdG90eXBlLmNsZWFyVGFza3M9ZnVuY3Rpb24oKXt0aGlzLl9zdG9wVGltZXIoKSx0aGlzLl90YXNrcz1bXSx0aGlzLl9wYXVzZWRUYXNrcz1bXX07dmFyIGU9IlRhc2tTY2hlZHVsZXIiLGY9MjUwO2IuX1Rhc2tTY2hlZHVsZXI9ZH0oYS5BREIuY29yZSxhLkFEQi52YSksZnVuY3Rpb24oYSl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGIoKXt0aGlzLnRyYWNraW5nU2VydmVyPXZvaWQgMCx0aGlzLmNoYW5uZWw9dm9pZCAwLHRoaXMub3ZwPXZvaWQgMCx0aGlzLmFwcFZlcnNpb249dm9pZCAwLHRoaXMucGxheWVyTmFtZT12b2lkIDAsdGhpcy5zc2w9ITEsdGhpcy5kZWJ1Z0xvZ2dpbmc9ITF9YS5NZWRpYUhlYXJ0YmVhdENvbmZpZz1iLGEuTWVkaWFIZWFydGJlYXRDb25maWcuc2hhcmVkSW5zdGFuY2U9bmV3IGJ9KGEuQURCLnZhKSxmdW5jdGlvbihhKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYigpe3RoaXMuZGF0YT17fX12YXIgYz1hLnBsdWdpbnMudmlkZW9wbGF5ZXIuVmlkZW9JbmZvLGQ9YS5wbHVnaW5zLnZpZGVvcGxheWVyLkFkQnJlYWtJbmZvLGU9YS5wbHVnaW5zLnZpZGVvcGxheWVyLkFkSW5mbyxmPWEucGx1Z2lucy52aWRlb3BsYXllci5DaGFwdGVySW5mbyxnPWEucGx1Z2lucy52aWRlb3BsYXllci5Rb1NJbmZvO2IuTUVESUFJTkZPX0tFWV9OQU1FPSJhLm5hbWUiLGIuTUVESUFJTkZPX0tFWV9WSURFT0lEPSJhLnZpZGVvSWQiLGIuTUVESUFJTkZPX0tFWV9BRElEPSJhLmFkSWQiLGIuTUVESUFJTkZPX0tFWV9MRU5HVEg9ImEubGVuZ3RoIixiLk1FRElBSU5GT19LRVlfUExBWUhFQUQ9ImEucGxheWhlYWQiLGIuTUVESUFJTkZPX0tFWV9NRURJQVRZUEU9ImEubWVkaWFUeXBlIixiLk1FRElBSU5GT19LRVlfU1RSRUFNVFlQRT0iYS5zdHJlYW1UeXBlIixiLk1FRElBSU5GT19LRVlfUE9TSVRJT049ImEucG9zaXRpb24iLGIuTUVESUFJTkZPX0tFWV9TVEFSVFRJTUU9ImEuc3RhcnRUaW1lIixiLk1FRElBSU5GT19LRVlfQklUUkFURT0iYS5iaXRyYXRlIixiLk1FRElBSU5GT19LRVlfRlBTPSJhLmZwcyIsYi5NRURJQUlORk9fS0VZX0RST1BQRURGUkFNRVM9ImEuZHJvcHBlZEZyYW1lcyIsYi5NRURJQUlORk9fS0VZX1NUQVJUVVBUSU1FPSJhLnN0YXJ0dXBUaW1lIixiLk1FRElBSU5GT19LRVlfVElNRURNRVRBREFUQT0iYS50aW1lZE1ldGFkYXRhIixiLnByb3RvdHlwZS5zZXRWYWx1ZT1mdW5jdGlvbihhLGIpe3RoaXMuZGF0YVthXT1ifSxiLnByb3RvdHlwZS5nZXRWYWx1ZT1mdW5jdGlvbihhKXtyZXR1cm4gdGhpcy5kYXRhLmhhc093blByb3BlcnR5KGEpP3RoaXMuZGF0YVthXTpudWxsfSxiLnByb3RvdHlwZS5jcmVhdGVWaWRlb0luZm89ZnVuY3Rpb24oKXt2YXIgYT1uZXcgYztyZXR1cm4gYS5pZD1udWxsIT10aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9WSURFT0lEKT90aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9WSURFT0lEKToiIixhLm5hbWU9bnVsbCE9dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfTkFNRSk/dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfTkFNRSk6IiIsYS5sZW5ndGg9bnVsbCE9dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfTEVOR1RIKT90aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9MRU5HVEgpOjAsYS5wbGF5aGVhZD1udWxsIT10aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9QTEFZSEVBRCk/dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfUExBWUhFQUQpOjAsYS5tZWRpYVR5cGU9bnVsbCE9dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfTUVESUFUWVBFKT90aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9NRURJQVRZUEUpOiIiLGEuc3RyZWFtVHlwZT1udWxsIT10aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9TVFJFQU1UWVBFKT90aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9TVFJFQU1UWVBFKToiIixhfSxiLnByb3RvdHlwZS5jcmVhdGVBZEJyZWFrSW5mbz1mdW5jdGlvbigpe3ZhciBhPW5ldyBkO3JldHVybiBhLm5hbWU9bnVsbCE9dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfTkFNRSk/dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfTkFNRSk6IiIsYS5wb3NpdGlvbj1udWxsIT10aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9QT1NJVElPTik/dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfUE9TSVRJT04pOjAsYS5zdGFydFRpbWU9bnVsbCE9dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfU1RBUlRUSU1FKT90aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9TVEFSVFRJTUUpOjAsYX0sYi5wcm90b3R5cGUuY3JlYXRlQWRJbmZvPWZ1bmN0aW9uKCl7dmFyIGE9bmV3IGU7cmV0dXJuIGEuaWQ9bnVsbCE9dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfQURJRCk/dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfQURJRCk6IiIsYS5uYW1lPW51bGwhPXRoaXMuZ2V0VmFsdWUoYi5NRURJQUlORk9fS0VZX05BTUUpP3RoaXMuZ2V0VmFsdWUoYi5NRURJQUlORk9fS0VZX05BTUUpOiIiLGEubGVuZ3RoPW51bGwhPXRoaXMuZ2V0VmFsdWUoYi5NRURJQUlORk9fS0VZX0xFTkdUSCk/dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfTEVOR1RIKTowLGEucG9zaXRpb249bnVsbCE9dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfUE9TSVRJT04pP3RoaXMuZ2V0VmFsdWUoYi5NRURJQUlORk9fS0VZX1BPU0lUSU9OKTowLGF9LGIucHJvdG90eXBlLmNyZWF0ZUNoYXB0ZXJJbmZvPWZ1bmN0aW9uKCl7dmFyIGE9bmV3IGY7cmV0dXJuIGEubmFtZT1udWxsIT10aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9OQU1FKT90aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9OQU1FKToiIixhLmxlbmd0aD1udWxsIT10aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9MRU5HVEgpP3RoaXMuZ2V0VmFsdWUoYi5NRURJQUlORk9fS0VZX0xFTkdUSCk6MCxhLnN0YXJ0VGltZT1udWxsIT10aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9TVEFSVFRJTUUpP3RoaXMuZ2V0VmFsdWUoYi5NRURJQUlORk9fS0VZX1NUQVJUVElNRSk6MCxhLnBvc2l0aW9uPW51bGwhPXRoaXMuZ2V0VmFsdWUoYi5NRURJQUlORk9fS0VZX1BPU0lUSU9OKT90aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9QT1NJVElPTik6MCxhfSxiLnByb3RvdHlwZS5jcmVhdGVRb1NJbmZvPWZ1bmN0aW9uKCl7dmFyIGE9bmV3IGc7cmV0dXJuIGEuYml0cmF0ZT1udWxsIT10aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9CSVRSQVRFKT90aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9CSVRSQVRFKTowLGEuZnBzPW51bGwhPXRoaXMuZ2V0VmFsdWUoYi5NRURJQUlORk9fS0VZX0ZQUyk/dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfRlBTKTowLGEuZHJvcHBlZEZyYW1lcz1udWxsIT10aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9EUk9QUEVERlJBTUVTKT90aGlzLmdldFZhbHVlKGIuTUVESUFJTkZPX0tFWV9EUk9QUEVERlJBTUVTKTowLGEuc3RhcnR1cFRpbWU9bnVsbCE9dGhpcy5nZXRWYWx1ZShiLk1FRElBSU5GT19LRVlfU1RBUlRVUFRJTUUpP3RoaXMuZ2V0VmFsdWUoYi5NRURJQUlORk9fS0VZX1NUQVJUVVBUSU1FKTowLGF9LGIucHJvdG90eXBlLmlzRXF1YWw9ZnVuY3Rpb24oYSl7aWYodGhpcz09PWEpcmV0dXJuITA7aWYoIWF8fCJvYmplY3QiIT10eXBlb2YgYXx8ImZ1bmN0aW9uIiE9dHlwZW9mIGEuZ2V0VmFsdWUpcmV0dXJuITE7Zm9yKHZhciBjPVtiLk1FRElBSU5GT19LRVlfTkFNRSxiLk1FRElBSU5GT19LRVlfVklERU9JRCxiLk1FRElBSU5GT19LRVlfQURJRCxiLk1FRElBSU5GT19LRVlfTEVOR1RILGIuTUVESUFJTkZPX0tFWV9QTEFZSEVBRCxiLk1FRElBSU5GT19LRVlfU1RSRUFNVFlQRSxiLk1FRElBSU5GT19LRVlfTUVESUFUWVBFLGIuTUVESUFJTkZPX0tFWV9QT1NJVElPTixiLk1FRElBSU5GT19LRVlfU1RBUlRUSU1FLGIuTUVESUFJTkZPX0tFWV9CSVRSQVRFLGIuTUVESUFJTkZPX0tFWV9GUFMsYi5NRURJQUlORk9fS0VZX0RST1BQRURGUkFNRVMsYi5NRURJQUlORk9fS0VZX1NUQVJUVVBUSU1FLGIuTUVESUFJTkZPX0tFWV9USU1FRE1FVEFEQVRBXSxkPTA7ZDxjLmxlbmd0aDsrK2Qpe3ZhciBlPWNbZF07aWYodGhpcy5nZXRWYWx1ZShlKSE9PWEuZ2V0VmFsdWUoZSkpcmV0dXJuITF9cmV0dXJuITB9LGEuTWVkaWFPYmplY3Q9Yn0oYS5BREIudmEpLGZ1bmN0aW9uKGEsYil7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIGMoYSl7Yy5fX3N1cGVyX18uY29uc3RydWN0b3IuY2FsbCh0aGlzKSx0aGlzLl9oZWFydGJlYXQ9YX1mdW5jdGlvbiBkKGEpe2QuX19zdXBlcl9fLmNvbnN0cnVjdG9yLmNhbGwodGhpcyksdGhpcy5faGVhcnRiZWF0PWF9ZnVuY3Rpb24gZShhKXtlLl9fc3VwZXJfXy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMpLHRoaXMuX2hlYXJ0YmVhdD1hfWZ1bmN0aW9uIGYoYSl7Zi5fX3N1cGVyX18uY29uc3RydWN0b3IuY2FsbCh0aGlzKSx0aGlzLl9oZWFydGJlYXQ9YX1hLmV4dGVuZChjLGIucGx1Z2lucy5hYS5BZG9iZUFuYWx5dGljc1BsdWdpbkRlbGVnYXRlKSxjLnByb3RvdHlwZS5vbkVycm9yPWZ1bmN0aW9uKGEpe3RoaXMuX2hlYXJ0YmVhdCYmdGhpcy5faGVhcnRiZWF0Ll9vbkRlbGVnYXRlRXJyb3IoYSl9LGEuZXh0ZW5kKGQsYi5wbHVnaW5zLmFoLkFkb2JlSGVhcnRiZWF0UGx1Z2luRGVsZWdhdGUpLGQucHJvdG90eXBlLm9uRXJyb3I9ZnVuY3Rpb24oYSl7dGhpcy5faGVhcnRiZWF0JiZ0aGlzLl9oZWFydGJlYXQuX29uRGVsZWdhdGVFcnJvcihhKX0sZC5wcm90b3R5cGUub25UcmFja2luZ0Rpc2FibGVkPWZ1bmN0aW9uKCl7dGhpcy5faGVhcnRiZWF0JiZ0aGlzLl9oZWFydGJlYXQuX2Rpc2FibGVIQlRyYWNraW5nKCl9LGEuZXh0ZW5kKGUsYi5IZWFydGJlYXREZWxlZ2F0ZSksZS5wcm90b3R5cGUub25FcnJvcj1mdW5jdGlvbihhKXt0aGlzLl9oZWFydGJlYXQmJnRoaXMuX2hlYXJ0YmVhdC5fb25EZWxlZ2F0ZUVycm9yKGEpfSxhLmV4dGVuZChmLGIucGx1Z2lucy52aWRlb3BsYXllci5WaWRlb1BsYXllclBsdWdpbkRlbGVnYXRlKSxmLnByb3RvdHlwZS5nZXRWaWRlb0luZm89ZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5faGVhcnRiZWF0JiZ0aGlzLl9oZWFydGJlYXQuX3ZpZGVvSW5mbz8odGhpcy5faGVhcnRiZWF0Ll9kZWxlZ2F0ZSYmKHRoaXMuX2hlYXJ0YmVhdC5fdmlkZW9JbmZvLnBsYXloZWFkPXRoaXMuX2hlYXJ0YmVhdC5fZGVsZWdhdGUuZ2V0Q3VycmVudFBsYXliYWNrVGltZSgpKSx0aGlzLl9oZWFydGJlYXQuX3ZpZGVvSW5mbyk6bnVsbH0sZi5wcm90b3R5cGUuZ2V0QWRCcmVha0luZm89ZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5faGVhcnRiZWF0JiZ0aGlzLl9oZWFydGJlYXQuX2FkQnJlYWtJbmZvP3RoaXMuX2hlYXJ0YmVhdC5fYWRCcmVha0luZm86bnVsbH0sZi5wcm90b3R5cGUuZ2V0QWRJbmZvPWZ1bmN0aW9uKCl7cmV0dXJuIHRoaXMuX2hlYXJ0YmVhdCYmdGhpcy5faGVhcnRiZWF0Ll9hZEluZm8/dGhpcy5faGVhcnRiZWF0Ll9hZEluZm86bnVsbH0sZi5wcm90b3R5cGUuZ2V0Q2hhcHRlckluZm89ZnVuY3Rpb24oKXtyZXR1cm4gdGhpcy5faGVhcnRiZWF0JiZ0aGlzLl9oZWFydGJlYXQuX2NoYXB0ZXJJbmZvP3RoaXMuX2hlYXJ0YmVhdC5fY2hhcHRlckluZm86bnVsbH0sZi5wcm90b3R5cGUuZ2V0UW9TSW5mbz1mdW5jdGlvbigpe2lmKHRoaXMuX2hlYXJ0YmVhdCYmdGhpcy5faGVhcnRiZWF0Ll9kZWxlZ2F0ZSYmdGhpcy5faGVhcnRiZWF0Ll9kZWxlZ2F0ZS5nZXRRb1NPYmplY3QoKSl7dmFyIGE9dGhpcy5faGVhcnRiZWF0Ll9kZWxlZ2F0ZS5nZXRRb1NPYmplY3QoKTtpZihhJiYib2JqZWN0Ij09dHlwZW9mIGEmJmEuc2V0VmFsdWUpcmV0dXJuIGEuY3JlYXRlUW9TSW5mbygpfXJldHVybiBudWxsfSxiLl9NZWRpYUFuYWx5dGljc1BsdWdpbkRlbGVnYXRlPWMsYi5fTWVkaWFIZWFydGJlYXRQbHVnaW5EZWxlZ2F0ZT1kLGIuX0FEQk1lZGlhSGVhcnRiZWF0RGVsZWdhdGU9ZSxiLl9NZWRpYUhlYXJ0YmVhdFZpZGVvUGxheWVyUGx1Z2luRGVsZWdhdGU9Zn0oYS5BREIuY29yZSxhLkFEQi52YSksZnVuY3Rpb24oYSxiKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gYyhhLGQpe2MuX19zdXBlcl9fLmNvbnN0cnVjdG9yLmNhbGwodGhpcyksdGhpcy5faGVhcnRiZWF0PWEsdGhpcy5fbG9nZ2VyPWQsdGhpcy5fdmFsaWRhdG9yPW5ldyBiLnBsdWdpbnMubmllbHNlbi5NZXRhZGF0YVZhbGlkYXRvcihkKX12YXIgZD0iTWVkaWFIZWFydGJlYXROaWVsc2VuUGx1Z2luRGVsZWdhdGUiLGU9e05pZWxzZW5Db250ZW50TWV0YWRhdGE6Im1lZGlhX25pZWxzZW5fY29udGVudF9tZXRhZGF0YSIsTmllbHNlbkNoYW5uZWxNZXRhZGF0YToibWVkaWFfbmllbHNlbl9jaGFubmVsX21ldGFkYXRhIixOaWVsc2VuQWRNZXRhZGF0YToibWVkaWFfbmllbHNlbl9hZF9tZXRhZGF0YSJ9O2IucGx1Z2lucy5uaWVsc2VuJiZhLmV4dGVuZChjLGIucGx1Z2lucy5uaWVsc2VuLk5pZWxzZW5QbHVnaW5EZWxlZ2F0ZSksYy5wcm90b3R5cGUuZ2V0TWV0YWRhdGFJbmZvPWZ1bmN0aW9uKCl7aWYodGhpcy5faGVhcnRiZWF0JiZ0aGlzLl9oZWFydGJlYXQuX2N1cnJlbnRNZWRpYU9iamVjdCl7dmFyIGE9dGhpcy5faGVhcnRiZWF0Ll9jdXJyZW50TWVkaWFPYmplY3QuZ2V0VmFsdWUoZS5OaWVsc2VuQ29udGVudE1ldGFkYXRhKTtpZihhJiYib2JqZWN0Ij09dHlwZW9mIGEpcmV0dXJuIHRoaXMuX3ZhbGlkYXRvci52YWxpZGF0ZUNvbnRlbnRNZXRhZGF0YShhLCJNZWRpYUhlYXJ0YmVhdC5OaWVsc2VuQ29udGVudE1ldGFkYXRhS2V5cyIpLGE7dGhpcy5fbG9nZ2VyLndhcm4oZCwiV2UgZXhwZWN0IGEgdmFsaWQgb2JqZWN0IGZvciBNZWRpYUhlYXJ0YmVhdC5NZWRpYU9iamVjdEtleS5OaWVsc2VuQ29udGVudE1ldGFkYXRhIGluIE1lZGlhT2JqZWN0Iil9cmV0dXJuIG51bGx9LGMucHJvdG90eXBlLmdldEFkTWV0YWRhdGFJbmZvPWZ1bmN0aW9uKCl7aWYodGhpcy5faGVhcnRiZWF0JiZ0aGlzLl9oZWFydGJlYXQuX2N1cnJlbnRBZE9iamVjdCl7dmFyIGE9dGhpcy5faGVhcnRiZWF0Ll9jdXJyZW50QWRPYmplY3QuZ2V0VmFsdWUoZS5OaWVsc2VuQWRNZXRhZGF0YSk7aWYoYSYmIm9iamVjdCI9PXR5cGVvZiBhKXJldHVybiB0aGlzLl92YWxpZGF0b3IudmFsaWRhdGVBZE1ldGFkYXRhKGEsIk1lZGlhSGVhcnRiZWF0Lk5pZWxzZW5BZE1ldGFkYXRhS2V5cyIpLGE7dGhpcy5fbG9nZ2VyLndhcm4oZCwiV2UgZXhwZWN0IGEgdmFsaWQgb2JqZWN0IGZvciBNZWRpYUhlYXJ0YmVhdC5NZWRpYU9iamVjdEtleS5OaWVsc2VuQWRNZXRhZGF0YSBpbiBNZWRpYU9iamVjdCIpfXJldHVybiBudWxsfSxjLnByb3RvdHlwZS5nZXRDaGFubmVsSW5mbz1mdW5jdGlvbigpe2lmKHRoaXMuX2hlYXJ0YmVhdCYmdGhpcy5faGVhcnRiZWF0Ll9jdXJyZW50TWVkaWFPYmplY3Qpe3ZhciBhPXRoaXMuX2hlYXJ0YmVhdC5fY3VycmVudE1lZGlhT2JqZWN0LmdldFZhbHVlKGUuTmllbHNlbkNoYW5uZWxNZXRhZGF0YSk7aWYoYSYmIm9iamVjdCI9PXR5cGVvZiBhKXJldHVybiB0aGlzLl92YWxpZGF0b3IudmFsaWRhdGVDaGFubmVsTWV0YWRhdGEoYSwiTWVkaWFIZWFydGJlYXQuTmllbHNlbkNoYW5uZWxNZXRhZGF0YUtleXMiKSxhO3RoaXMuX2xvZ2dlci53YXJuKGQsIldlIGV4cGVjdCBhIHZhbGlkIG9iamVjdCBmb3IgTWVkaWFIZWFydGJlYXQuTWVkaWFPYmplY3RLZXkuTmllbHNlbkNoYW5uZWxNZXRhZGF0YSBpbiBNZWRpYU9iamVjdCIpfXJldHVybiBudWxsfSxjLnByb3RvdHlwZS5vbkVycm9yPWZ1bmN0aW9uKGEpe3RoaXMuX2hlYXJ0YmVhdCYmdGhpcy5faGVhcnRiZWF0Ll9vbkRlbGVnYXRlRXJyb3IoYSl9LGIucGx1Z2lucy5uaWVsc2VuJiYoYi5fTmllbHNlbk9iamVjdEtleT1lLGIuX05pZWxzZW5QbHVnaW5EZWxlZ2F0ZT1jKX0oYS5BREIuY29yZSxhLkFEQi52YSksZnVuY3Rpb24oYixjKXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gZCgpe31mdW5jdGlvbiBlKGIsZCxlKXtpZih0aGlzLl9hcHBNZWFzdXJlbWVudD1lfHxhLnMsIXRoaXMuX2FwcE1lYXN1cmVtZW50KXRocm93IG5ldyBFcnJvcigiTWVkaWFIZWFydGJlYXQgbmVlZHMgYSB2YWxpZCBBcHBNZWFzdXJlbWVudCBpbnN0YW5jZS4iKTtpZighdGhpcy5fYXBwTWVhc3VyZW1lbnQudmlzaXRvcnx8IXRoaXMuX2FwcE1lYXN1cmVtZW50LnZpc2l0b3IubWFya2V0aW5nQ2xvdWRPcmdJRCl0aHJvdyBuZXcgRXJyb3IoIk1lZGlhSGVhcnRiZWF0IG5lZWRzIGEgdmFsaWQgdmlzaXRvciBpbnN0YW5jZSB3aXRoIG1hcmtldGluZ0Nsb3VkT3JnSWQgc2V0LiIpO2lmKCFiKXRocm93IG5ldyBFcnJvcigiTWVkaWFIZWFydGJlYXQgbmVlZHMgYSB2YWxpZCBkZWxlZ2F0ZSBvYmplY3QuIik7aWYoIWR8fCJvYmplY3QiIT10eXBlb2YgZHx8IWQudHJhY2tpbmdTZXJ2ZXIpdGhyb3cgbmV3IEVycm9yKCJNZWRpYUhlYXJ0YmVhdCBuZWVkcyBhIHZhbGlkIGNvbmZpZyBvYmplY3Qgd2l0aCB0cmFja2luZ1NlcnZlciBzZXQuIik7dGhpcy5fY29uZmlnPWQsdGhpcy5fZGVsZWdhdGU9Yix0aGlzLl9kZWJ1Z0xvZ2dpbmc9Yy5NZWRpYUhlYXJ0YmVhdC5fZGVidWdMb2dnaW5nfHx0aGlzLl9jb25maWcuZGVidWdMb2dnaW5nLHRoaXMuX2xvZ2dlcj1uZXcgZix0aGlzLl9kZWJ1Z0xvZ2dpbmc/dGhpcy5fbG9nZ2VyLmVuYWJsZSgpOnRoaXMuX2xvZ2dlci5kaXNhYmxlKCksdGhpcy5fcnVsZUVuZ2luZT1uZXcgdCh0aGlzLl9sb2dnZXIpLHRoaXMuX3Rhc2tTY2hlZHVsZXI9bmV3IHUodGhpcy5fbG9nZ2VyKSx0aGlzLl9yZXNldFN0YXRlKCksdGhpcy5fc2V0dXBSdWxlcygpfXZhciBmPWIuTG9nZ2VyLGc9Yy5NZWRpYU9iamVjdCxoPWMuSGVhcnRiZWF0LGk9Yy5IZWFydGJlYXRDb25maWcsaj1jLl9BREJNZWRpYUhlYXJ0YmVhdERlbGVnYXRlLGs9Yy5wbHVnaW5zLnZpZGVvcGxheWVyLlZpZGVvUGxheWVyUGx1Z2luLGw9Yy5wbHVnaW5zLnZpZGVvcGxheWVyLlZpZGVvUGxheWVyUGx1Z2luQ29uZmlnLG09Yy5fTWVkaWFIZWFydGJlYXRWaWRlb1BsYXllclBsdWdpbkRlbGVnYXRlLG49Yy5wbHVnaW5zLmFhLkFkb2JlQW5hbHl0aWNzUGx1Z2luLG89Yy5wbHVnaW5zLmFhLkFkb2JlQW5hbHl0aWNzUGx1Z2luQ29uZmlnLHA9Yy5fTWVkaWFBbmFseXRpY3NQbHVnaW5EZWxlZ2F0ZSxxPWMucGx1Z2lucy5haC5BZG9iZUhlYXJ0YmVhdFBsdWdpbixyPWMucGx1Z2lucy5haC5BZG9iZUhlYXJ0YmVhdFBsdWdpbkNvbmZpZyxzPWMuX01lZGlhSGVhcnRiZWF0UGx1Z2luRGVsZWdhdGUsdD1jLl9SdWxlRW5naW5lLHU9Yy5fVGFza1NjaGVkdWxlcix2PWMudXRpbHMuT2JqZWN0VXRpbHMsdz1jLnV0aWxzLlZlcnNpb25VdGlscztpZihkLnByb3RvdHlwZS5nZXRDdXJyZW50UGxheWJhY2tUaW1lPWZ1bmN0aW9uKCl7cmV0dXJuIG51bGx9LGQucHJvdG90eXBlLmdldFFvU09iamVjdD1mdW5jdGlvbigpe3JldHVybiBudWxsfSxlLk1lZGlhVHlwZT17VmlkZW86InZpZGVvIixBdWRpbzoiYXVkaW8ifSxlLkV2ZW50PXtBZEJyZWFrU3RhcnQ6ImFkQnJlYWtTdGFydCIsQWRCcmVha0NvbXBsZXRlOiJhZEJyZWFrQ29tcGxldGUiLEFkU3RhcnQ6ImFkU3RhcnQiLEFkQ29tcGxldGU6ImFkQ29tcGxldGUiLEFkU2tpcDoiYWRTa2lwIixDaGFwdGVyU3RhcnQ6ImNoYXB0ZXJTdGFydCIsQ2hhcHRlckNvbXBsZXRlOiJjaGFwdGVyQ29tcGxldGUiLENoYXB0ZXJTa2lwOiJjaGFwdGVyU2tpcCIsU2Vla1N0YXJ0OiJzZWVrU3RhcnQiLFNlZWtDb21wbGV0ZToic2Vla0NvbXBsZXRlIixCdWZmZXJTdGFydDoiYnVmZmVyU3RhcnQiLEJ1ZmZlckNvbXBsZXRlOiJidWZmZXJDb21wbGV0ZSIsQml0cmF0ZUNoYW5nZToiYml0cmF0ZUNoYW5nZSIsVGltZWRNZXRhZGF0YVVwZGF0ZToidGltZWRNZXRhZGF0YVVwZGF0ZSJ9LGUuU3RyZWFtVHlwZT17Vk9EOiJ2b2QiLExJVkU6ImxpdmUiLExJTkVBUjoibGluZWFyIixQT0RDQVNUOiJwb2RjYXN0IixBVURJT0JPT0s6ImF1ZGlvYm9vayIsQU9EOiJhb2QifSxlLk1lZGlhT2JqZWN0S2V5PXtTdGFuZGFyZFZpZGVvTWV0YWRhdGE6Im1lZGlhX3N0YW5kYXJkX2NvbnRlbnRfbWV0YWRhdGEiLFN0YW5kYXJkTWVkaWFNZXRhZGF0YToibWVkaWFfc3RhbmRhcmRfY29udGVudF9tZXRhZGF0YSIsU3RhbmRhcmRBZE1ldGFkYXRhOiJtZWRpYV9zdGFuZGFyZF9hZF9tZXRhZGF0YSIsVmlkZW9SZXN1bWVkOiJyZXN1bWVkIixNZWRpYVJlc3VtZWQ6InJlc3VtZWQiLFByZXJvbGxUcmFja2luZ1dhaXRpbmdUaW1lOiJwcmVyb2xsX3RyYWNraW5nX3dhaXRpbmdfdGltZSJ9LGUuVmlkZW9NZXRhZGF0YUtleXM9Yy5wbHVnaW5zLmFhLlZpZGVvTWV0YWRhdGFLZXlzLGUuQXVkaW9NZXRhZGF0YUtleXM9Yy5wbHVnaW5zLmFhLkF1ZGlvTWV0YWRhdGFLZXlzLGUuQWRNZXRhZGF0YUtleXM9Yy5wbHVnaW5zLmFhLkFkTWV0YWRhdGFLZXlzLGUuY3JlYXRlTWVkaWFPYmplY3Q9ZnVuY3Rpb24oYSxiLGMsZCxmKXt2YXIgaD1uZXcgZztoLnNldFZhbHVlKGcuTUVESUFJTkZPX0tFWV9WSURFT0lELGIpLGguc2V0VmFsdWUoZy5NRURJQUlORk9fS0VZX05BTUUsYSksaC5zZXRWYWx1ZShnLk1FRElBSU5GT19LRVlfTEVOR1RILGMpLGguc2V0VmFsdWUoZy5NRURJQUlORk9fS0VZX1BMQVlIRUFELDApO3ZhciBpPWR8fGUuU3RyZWFtVHlwZS5WT0Q7cmV0dXJuIGguc2V0VmFsdWUoZy5NRURJQUlORk9fS0VZX1NUUkVBTVRZUEUsaSksKCJzdHJpbmciIT10eXBlb2YgZnx8ZiE9ZS5NZWRpYVR5cGUuVmlkZW8mJmYhPWUuTWVkaWFUeXBlLkF1ZGlvKSYmKGY9ZS5NZWRpYVR5cGUuVmlkZW8pLGguc2V0VmFsdWUoZy5NRURJQUlORk9fS0VZX01FRElBVFlQRSxmKSxofSxlLmNyZWF0ZUFkQnJlYWtPYmplY3Q9ZnVuY3Rpb24oYSxiLGMpe3ZhciBkPW5ldyBnO3JldHVybiBkLnNldFZhbHVlKGcuTUVESUFJTkZPX0tFWV9OQU1FLGEpLGQuc2V0VmFsdWUoZy5NRURJQUlORk9fS0VZX1BPU0lUSU9OLGIpLGQuc2V0VmFsdWUoZy5NRURJQUlORk9fS0VZX1NUQVJUVElNRSxjKSxkfSxlLmNyZWF0ZUFkT2JqZWN0PWZ1bmN0aW9uKGEsYixjLGQpe3ZhciBlPW5ldyBnO3JldHVybiBlLnNldFZhbHVlKGcuTUVESUFJTkZPX0tFWV9OQU1FLGEpLGUuc2V0VmFsdWUoZy5NRURJQUlORk9fS0VZX0FESUQsYiksZS5zZXRWYWx1ZShnLk1FRElBSU5GT19LRVlfUE9TSVRJT04sYyksZS5zZXRWYWx1ZShnLk1FRElBSU5GT19LRVlfTEVOR1RILGQpLGV9LGUuY3JlYXRlQ2hhcHRlck9iamVjdD1mdW5jdGlvbihhLGIsYyxkKXt2YXIgZT1uZXcgZztyZXR1cm4gZS5zZXRWYWx1ZShnLk1FRElBSU5GT19LRVlfTkFNRSxhKSxlLnNldFZhbHVlKGcuTUVESUFJTkZPX0tFWV9QT1NJVElPTixiKSxlLnNldFZhbHVlKGcuTUVESUFJTkZPX0tFWV9MRU5HVEgsYyksZS5zZXRWYWx1ZShnLk1FRElBSU5GT19LRVlfU1RBUlRUSU1FLGQpLGV9LGUuY3JlYXRlUW9TT2JqZWN0PWZ1bmN0aW9uKGEsYixjLGQpe3ZhciBlPW5ldyBnO3JldHVybiBlLnNldFZhbHVlKGcuTUVESUFJTkZPX0tFWV9CSVRSQVRFLGEpLGUuc2V0VmFsdWUoZy5NRURJQUlORk9fS0VZX0ZQUyxjKSxlLnNldFZhbHVlKGcuTUVESUFJTkZPX0tFWV9EUk9QUEVERlJBTUVTLGQpLGUuc2V0VmFsdWUoZy5NRURJQUlORk9fS0VZX1NUQVJUVVBUSU1FLGIpLGV9LGUuY3JlYXRlVGltZWRNZXRhZGF0YU9iamVjdD1mdW5jdGlvbihhKXt2YXIgYj1uZXcgZztyZXR1cm4gYi5zZXRWYWx1ZShnLk1FRElBSU5GT19LRVlfVElNRURNRVRBREFUQSxhKSxifSxlLnZlcnNpb249ZnVuY3Rpb24oKXtyZXR1cm4gYy5WZXJzaW9uLmdldFZlcnNpb24oKX0sZS5wcm90b3R5cGUudHJhY2tTZXNzaW9uU3RhcnQ9ZnVuY3Rpb24oYSxiKXt0aGlzLl9sb2dnZXIuaW5mbyhDLCIjOjp0cmFja1Nlc3Npb25TdGFydCgpIik7dmFyIGM9dC5jcmVhdGVDb250ZXh0KCk7Yy5zZXREYXRhKEQsYSksYy5zZXREYXRhKEksdGhpcy5fY2xlYW5Db250ZXh0RGF0YShiKSksdGhpcy5fcHJvY2Vzc1J1bGUoQS5TZXNzaW9uU3RhcnQsYyl9LGUucHJvdG90eXBlLnRyYWNrUGxheT1mdW5jdGlvbigpe3RoaXMuX2xvZ2dlci5pbmZvKEMsIiM6OnRyYWNrUGxheSgpIiksdGhpcy5fcHJvY2Vzc1J1bGUoQS5QbGF5KX0sZS5wcm90b3R5cGUudHJhY2tQYXVzZT1mdW5jdGlvbigpe3RoaXMuX2xvZ2dlci5pbmZvKEMsIiM6OnRyYWNrUGF1c2UoKSIpLHRoaXMuX3Byb2Nlc3NSdWxlKEEuUGF1c2UpfSxlLnByb3RvdHlwZS50cmFja0NvbXBsZXRlPWZ1bmN0aW9uKCl7dGhpcy5fbG9nZ2VyLmluZm8oQywiIzo6dHJhY2tDb21wbGV0ZSgpIiksdGhpcy5fcHJvY2Vzc1J1bGUoQS5WaWRlb0NvbXBsZXRlKX0sZS5wcm90b3R5cGUudHJhY2tTZXNzaW9uRW5kPWZ1bmN0aW9uKCl7dGhpcy5fbG9nZ2VyLmluZm8oQywiIzo6dHJhY2tTZXNzaW9uRW5kKCkiKSx0aGlzLl9wcm9jZXNzUnVsZShBLlNlc3Npb25FbmQpfSxlLnByb3RvdHlwZS50cmFja0Vycm9yPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5pbmZvKEMsIiM6OnRyYWNrRXJyb3IoKSIpO3ZhciBiPXQuY3JlYXRlQ29udGV4dCgpO2Iuc2V0RGF0YShKLGEpLHRoaXMuX3Byb2Nlc3NSdWxlKEEuRXJyb3IsYil9LGUucHJvdG90eXBlLnRyYWNrRXZlbnQ9ZnVuY3Rpb24oYSxiLGMpe3RoaXMuX2xvZ2dlci5pbmZvKEMsIiM6OnRyYWNrRXZlbnQoKSAtICIrYSk7dmFyIGQsZj10LmNyZWF0ZUNvbnRleHQoKTtzd2l0Y2goYSl7Y2FzZSBlLkV2ZW50LkFkQnJlYWtTdGFydDpmLnNldERhdGEoRSxiKSxmLnNldERhdGEoSSx0aGlzLl9jbGVhbkNvbnRleHREYXRhKGMpKSxkPUEuQWRCcmVha1N0YXJ0O2JyZWFrO2Nhc2UgZS5FdmVudC5BZEJyZWFrQ29tcGxldGU6ZD1BLkFkQnJlYWtDb21wbGV0ZTticmVhaztjYXNlIGUuRXZlbnQuQWRTdGFydDpmLnNldERhdGEoRixiKSxmLnNldERhdGEoSSx0aGlzLl9jbGVhbkNvbnRleHREYXRhKGMpKSxkPUEuQWRTdGFydDticmVhaztjYXNlIGUuRXZlbnQuQWRDb21wbGV0ZTpkPUEuQWRDb21wbGV0ZTticmVhaztjYXNlIGUuRXZlbnQuQWRTa2lwOmQ9QS5BZFNraXA7YnJlYWs7Y2FzZSBlLkV2ZW50LlNlZWtTdGFydDpkPUEuU2Vla1N0YXJ0O2JyZWFrO2Nhc2UgZS5FdmVudC5TZWVrQ29tcGxldGU6ZD1BLlNlZWtDb21wbGV0ZTticmVhaztjYXNlIGUuRXZlbnQuQ2hhcHRlclN0YXJ0OmYuc2V0RGF0YShHLGIpLGYuc2V0RGF0YShJLHRoaXMuX2NsZWFuQ29udGV4dERhdGEoYykpLGQ9QS5DaGFwdGVyU3RhcnQ7YnJlYWs7Y2FzZSBlLkV2ZW50LkNoYXB0ZXJDb21wbGV0ZTpkPUEuQ2hhcHRlckNvbXBsZXRlO2JyZWFrO2Nhc2UgZS5FdmVudC5DaGFwdGVyU2tpcDpkPUEuQ2hhcHRlclNraXA7YnJlYWs7Y2FzZSBlLkV2ZW50LkJ1ZmZlclN0YXJ0OmQ9QS5CdWZmZXJTdGFydDticmVhaztjYXNlIGUuRXZlbnQuQnVmZmVyQ29tcGxldGU6ZD1BLkJ1ZmZlckNvbXBsZXRlO2JyZWFrO2Nhc2UgZS5FdmVudC5CaXRyYXRlQ2hhbmdlOmQ9QS5CaXRyYXRlQ2hhbmdlO2JyZWFrO2Nhc2UgZS5FdmVudC5UaW1lZE1ldGFkYXRhVXBkYXRlOmQ9QS5UaW1lZE1ldGFkYXRhVXBkYXRlLGYuc2V0RGF0YShILGIpO2JyZWFrO2RlZmF1bHQ6cmV0dXJuIHZvaWQgdGhpcy5fbG9nZ2VyLmVycm9yKEMsIkluY29ycmVjdCBldmVudCBuYW1lLiIpfXRoaXMuX3Byb2Nlc3NSdWxlKGQsZil9LGMucGx1Z2lucy5uaWVsc2VuKXt2YXIgeD1jLk1lZGlhSGVhcnRiZWF0Q29uZmlnO3gucHJvdG90eXBlLm5pZWxzZW5Db25maWdLZXk9dm9pZCAwLHgucHJvdG90eXBlLm5pZWxzZW5BcHBJbmZvPXZvaWQgMDt2YXIgeT1jLl9OaWVsc2VuT2JqZWN0S2V5O2UuTWVkaWFPYmplY3RLZXkuTmllbHNlbkNvbnRlbnRNZXRhZGF0YT15Lk5pZWxzZW5Db250ZW50TWV0YWRhdGEsZS5NZWRpYU9iamVjdEtleS5OaWVsc2VuQWRNZXRhZGF0YT15Lk5pZWxzZW5BZE1ldGFkYXRhLGUuTWVkaWFPYmplY3RLZXkuTmllbHNlbkNoYW5uZWxNZXRhZGF0YT15Lk5pZWxzZW5DaGFubmVsTWV0YWRhdGEsZS5OaWVsc2VuQ29udGVudE1ldGFkYXRhS2V5cz1jLnBsdWdpbnMubmllbHNlbi5Db250ZW50TWV0YWRhdGFLZXlzLGUuTmllbHNlbkNoYW5uZWxNZXRhZGF0YUtleXM9Yy5wbHVnaW5zLm5pZWxzZW4uQ2hhbm5lbE1ldGFkYXRhS2V5cyxlLk5pZWxzZW5BZE1ldGFkYXRhS2V5cz1jLnBsdWdpbnMubmllbHNlbi5BZE1ldGFkYXRhS2V5cyxlLnByb3RvdHlwZS5uaWVsc2VuTG9hZE1ldGFkYXRhPWZ1bmN0aW9uKGEpe3RoaXMuX25pZWxzZW5QbHVnaW4mJnRoaXMuX25pZWxzZW5QbHVnaW4ubG9hZE1ldGFkYXRhKGEpfX1lLnByb3RvdHlwZS5fc2V0U3RhdGU9ZnVuY3Rpb24oYSxiKXt0aGlzLl9tZWRpYVN0YXRlW2FdPWJ9LGUucHJvdG90eXBlLl9pc0luU3RhdGU9ZnVuY3Rpb24oYSl7cmV0dXJuIHRoaXMuX21lZGlhU3RhdGVbYV19LGUucHJvdG90eXBlLl9pc1RyYWNraW5nRGlzYWJsZWQ9ZnVuY3Rpb24oYSl7cmV0dXJuIHRoaXMuX21lZGlhSGVhcnRiZWF0RGlzYWJsZWR9LGUucHJvdG90eXBlLl9pc0luU2Vzc2lvbj1mdW5jdGlvbihhKXtyZXR1cm4gdGhpcy5faXNJblN0YXRlKHouU2Vzc2lvbil9LGUucHJvdG90eXBlLl9pc0luTWVkaWE9ZnVuY3Rpb24oYSl7cmV0dXJuIHRoaXMuX2lzSW5TdGF0ZSh6Lk1lZGlhKX0sZS5wcm90b3R5cGUuX2lzSW5BZD1mdW5jdGlvbihhKXtyZXR1cm4gdGhpcy5faXNJblN0YXRlKHouQWQpfSxlLnByb3RvdHlwZS5faXNJbkFkQnJlYWs9ZnVuY3Rpb24oYSl7cmV0dXJuIHRoaXMuX2lzSW5TdGF0ZSh6LkFkQnJlYWspfSxlLnByb3RvdHlwZS5faXNJbkNoYXB0ZXI9ZnVuY3Rpb24oYSl7cmV0dXJuIHRoaXMuX2lzSW5TdGF0ZSh6LkNoYXB0ZXIpfSxlLnByb3RvdHlwZS5faXNJblBsYXk9ZnVuY3Rpb24oYSl7cmV0dXJuIHRoaXMuX2lzSW5TdGF0ZSh6LlBsYXlQYXVzZSl9LGUucHJvdG90eXBlLl9pc0luUGF1c2U9ZnVuY3Rpb24oYSl7cmV0dXJuIXRoaXMuX2lzSW5TdGF0ZSh6LlBsYXlQYXVzZSl9LGUucHJvdG90eXBlLl9pc0luQnVmZmVyPWZ1bmN0aW9uKGEpe3JldHVybiB0aGlzLl9pc0luU3RhdGUoei5CdWZmZXIpfSxlLnByb3RvdHlwZS5faXNJblNlZWs9ZnVuY3Rpb24oYSl7cmV0dXJuIHRoaXMuX2lzSW5TdGF0ZSh6LlNlZWspfSxlLnByb3RvdHlwZS5faXNQbGF0Zm9ybVRyYWNraW5nU3VwcG9ydGVkPWZ1bmN0aW9uKGEpe3JldHVybiF0aGlzLl9hcHBNZWFzdXJlbWVudC51bnN1cHBvcnRlZEJyb3dzZXJ9LGUucHJvdG90eXBlLl9pc0F1ZGlvVHJhY2tpbmdTdXBwb3J0ZWQ9ZnVuY3Rpb24oYSl7cmV0dXJuIGEuZ2V0RGF0YShEKS5nZXRWYWx1ZShnLk1FRElBSU5GT19LRVlfTUVESUFUWVBFKSE9PWUuTWVkaWFUeXBlLkF1ZGlvfHx3LmlzR3JlYXRlclRoYW5FcXVhbCh0aGlzLl9hcHBNZWFzdXJlbWVudC52ZXJzaW9uLCIyLjExLjAiKX0sZS5wcm90b3R5cGUuX2lzVmFsaWRNZWRpYU9iamVjdD1mdW5jdGlvbihhKXt2YXIgYj1hLmdldERhdGEoRCk7aWYoYiYmYiBpbnN0YW5jZW9mIGcpe3ZhciBjPWIuZ2V0VmFsdWUoZS5NZWRpYU9iamVjdEtleS5NZWRpYVJlc3VtZWQpO251bGwhPWMmJiJib29sZWFuIiE9dHlwZW9mIGMmJnRoaXMuX2xvZ2dlci53YXJuKEMsIklnbm9yaW5nIHZhbHVlIHNldCBmb3IgTWVkaWFIZWFydGJlYXQuTWVkaWFPYmplY3RLZXkuTWVkaWFSZXN1bWVkIGluIE1lZGlhT2JqZWN0IGFzIHdlIGV4cGVjdCBhIGJvb2xlYW4gdmFsdWUiKTt2YXIgZD1iLmdldFZhbHVlKGUuTWVkaWFPYmplY3RLZXkuUHJlcm9sbFRyYWNraW5nV2FpdGluZ1RpbWUpO2lmKG51bGwhPWQpeygic3RyaW5nIj09dHlwZW9mIGR8fCJudW1iZXIiPT10eXBlb2YgZCkmJiFpc05hTihkKXx8dGhpcy5fbG9nZ2VyLndhcm4oQywiSWdub3JpbmcgdmFsdWUgc2V0IGZvciBNZWRpYUhlYXJ0YmVhdC5NZWRpYU9iamVjdEtleS5QcmVyb2xsVHJhY2tpbmdXYWl0aW5nVGltZSBpbiBNZWRpYU9iamVjdCBhcyB3ZSBleHBlY3QgYSB2YWxpZCBkdXJhdGlvbiBhcyBudW1iZXIgaW4gbWlsbGlzZWNvbmRzLiIpfXZhciBmPWIuZ2V0VmFsdWUoZS5NZWRpYU9iamVjdEtleS5TdGFuZGFyZE1lZGlhTWV0YWRhdGEpO3JldHVybiBudWxsIT1mJiYib2JqZWN0IiE9dHlwZW9mIGYmJnRoaXMuX2xvZ2dlci53YXJuKEMsIklnbm9yaW5nIHZhbHVlIHNldCBmb3IgTWVkaWFIZWFydGJlYXQuTWVkaWFPYmplY3RLZXkuU3RhbmRhcmRNZWRpYU1ldGFkYXRhIGluIE1lZGlhT2JqZWN0IGFzIHdlIGV4cGVjdCBhIHZhbGlkIG9iamVjdCB3aXRoIGt2IHBhaXJzLiIpLCEwfXJldHVybiExfSxlLnByb3RvdHlwZS5faXNWYWxpZEFkQnJlYWtPYmplY3Q9ZnVuY3Rpb24oYSl7dmFyIGI9YS5nZXREYXRhKEUpO3JldHVybiBiJiZiIGluc3RhbmNlb2YgZ30sZS5wcm90b3R5cGUuX2lzRGlmZmVyZW50QWRCcmVha09iamVjdD1mdW5jdGlvbihhKXt2YXIgYj1hLmdldERhdGEoRSk7cmV0dXJuISh0aGlzLl9jdXJyZW50QWRCcmVha09iamVjdCYmdGhpcy5fY3VycmVudEFkQnJlYWtPYmplY3QuaXNFcXVhbChiKSl9LGUucHJvdG90eXBlLl9pc1ZhbGlkQWRPYmplY3Q9ZnVuY3Rpb24oYSl7dmFyIGI9YS5nZXREYXRhKEYpO2lmKGImJmIgaW5zdGFuY2VvZiBnKXt2YXIgYz1iLmdldFZhbHVlKE0pO251bGwhPWMmJiJib29sZWFuIiE9dHlwZW9mIGMmJnRoaXMuX2xvZ2dlci53YXJuKEMsIklnbm9yaW5nIHZhbHVlIHNldCBmb3IgTWVkaWFIZWFydGJlYXQuTWVkaWFPYmplY3RLZXkuR3JhbnVsYXJBZFRyYWNraW5nIGluIEFkT2JqZWN0IGFzIHdlIGV4cGVjdCBhIGJvb2xlYW4gdmFsdWUuIik7dmFyIGQ9Yi5nZXRWYWx1ZShlLk1lZGlhT2JqZWN0S2V5LlN0YW5kYXJkQWRNZXRhZGF0YSk7cmV0dXJuIG51bGwhPWQmJiJvYmplY3QiIT10eXBlb2YgZCYmdGhpcy5fbG9nZ2VyLndhcm4oQywiSWdub3JpbmcgdmFsdWUgc2V0IGZvciBNZWRpYUhlYXJ0YmVhdC5NZWRpYU9iamVjdEtleS5TdGFuZGFyZEFkTWV0YWRhdGEgaW4gQWRPYmplY3QgYXMgd2UgZXhwZWN0IGEgdmFsaWQgb2JqZWN0IHdpdGgga3YgcGFpcnMuIiksITB9cmV0dXJuITF9LGUucHJvdG90eXBlLl9pc0RpZmZlcmVudEFkT2JqZWN0PWZ1bmN0aW9uKGEpe3ZhciBiPWEuZ2V0RGF0YShGKTtyZXR1cm4hKHRoaXMuX2N1cnJlbnRBZE9iamVjdCYmdGhpcy5fY3VycmVudEFkT2JqZWN0LmlzRXF1YWwoYikpfSxlLnByb3RvdHlwZS5faXNWYWxpZENoYXB0ZXJPYmplY3Q9ZnVuY3Rpb24oYSl7dmFyIGI9YS5nZXREYXRhKEcpO3JldHVybiBiJiZiIGluc3RhbmNlb2YgZ30sZS5wcm90b3R5cGUuX2lzRGlmZmVyZW50Q2hhcHRlck9iamVjdD1mdW5jdGlvbihhKXt2YXIgYj1hLmdldERhdGEoRyk7cmV0dXJuISh0aGlzLl9jdXJyZW50Q2hhcHRlck9iamVjdCYmdGhpcy5fY3VycmVudENoYXB0ZXJPYmplY3QuaXNFcXVhbChiKSl9LGUucHJvdG90eXBlLl9pc1ZhbGlkVGltZWRNZXRhZGF0YU9iamVjdD1mdW5jdGlvbihhKXt2YXIgYj1hLmdldERhdGEoSCk7aWYoYiYmYiBpbnN0YW5jZW9mIGcpe3ZhciBjPWIuZ2V0VmFsdWUoZy5NRURJQUlORk9fS0VZX1RJTUVETUVUQURBVEEpO3JldHVybiBjJiYic3RyaW5nIj09dHlwZW9mIGN9cmV0dXJuITF9LGUucHJvdG90eXBlLl9zaG91bGRBbGxvd1BsYXllclN0YXRlQ2hhbmdlPWZ1bmN0aW9uKGEpe3JldHVybiEodGhpcy5faXNJblN0YXRlKHouQWRCcmVhaykmJiF0aGlzLl9pc0luU3RhdGUoei5BZCkpfSxlLnByb3RvdHlwZS5fZGVmZXJyZWRUcmFja1BsYXk9ZnVuY3Rpb24oKXt0aGlzLl9wcmVyb2xsV2FpdEVuYWJsZWQmJih0aGlzLl9sb2dnZXIuaW5mbyhDLCJFeGVjdXRpbmcgZGVmZXJyZWQgQVBJOnRyYWNrUGxheS4iKSx0aGlzLl9wcmVyb2xsV2FpdEVuYWJsZWQ9ITEsdGhpcy5fcGxheVRhc2tIYW5kbGU9bnVsbCx0aGlzLl9wcm9jZXNzUnVsZShBLlBsYXkpKX0sZS5wcm90b3R5cGUuX2NtZEVudGVyQWN0aW9uPWZ1bmN0aW9uKGEpe3ZhciBiPWEuZ2V0UnVsZU5hbWUoKTtpZih0aGlzLl9wcmVyb2xsV2FpdEVuYWJsZWQpaWYodGhpcy5fcGxheVJlY2VpdmVkKXN3aXRjaChiKXtjYXNlIEEuU2Vla1N0YXJ0OmNhc2UgQS5CdWZmZXJTdGFydDp0aGlzLl9sb2dnZXIuaW5mbyhDLCJDYW5jZWxsaW5nIHNjaGVkdWxlZCBBUEk6dHJhY2tQbGF5IGJlY2F1c2Ugb2YgU2Vla1N0YXJ0L0J1ZmZlclN0YXJ0IGV2ZW50IiksdGhpcy5fdGFza1NjaGVkdWxlci5jYW5jZWxUYXNrKHRoaXMuX3BsYXlUYXNrSGFuZGxlKSx0aGlzLl9wbGF5VGFza0hhbmRsZT1udWxsO2JyZWFrO2Nhc2UgQS5TZWVrQ29tcGxldGU6Y2FzZSBBLkJ1ZmZlckNvbXBsZXRlOnRoaXMuX2xvZ2dlci5pbmZvKEMsIlJlc2NoZWR1bGVkIEFQSTp0cmFja1BsYXkgYWZ0ZXIgU2Vla0NvbXBsZXRlL0J1ZmZlckNvbXBsZXRlIGV2ZW50IiksdGhpcy5fcGxheVRhc2tIYW5kbGU9dGhpcy5fdGFza1NjaGVkdWxlci5zY2hlZHVsZVRhc2sodGhpcy5fZGVmZXJyZWRUcmFja1BsYXksdGhpcyx0aGlzLl9wcmVyb2xsV2FpdFRpbWUpO2JyZWFrO2Nhc2UgQS5QbGF5OnRoaXMuX2xvZ2dlci5pbmZvKEMsIkRyb3BwaW5nIEFQSTp0cmFja1BsYXkgYXMgd2UgYWxyZWFkeSBoYXZlIGEgQVBJOnRyYWNrUGxheSBzY2hlZHVsZWQuIiksYS5zdG9wUHJvY2Vzc2luZ0FjdGlvbigpO2JyZWFrO2Nhc2UgQS5QYXVzZTp0aGlzLl9sb2dnZXIuaW5mbyhDLCJDYW5jZWxsaW5nIHNjaGVkdWxlZCBBUEk6dHJhY2tQbGF5IGJlY2F1c2Ugb2YgQVBJOnRyYWNrUGF1c2UgY2FsbC4iKSx0aGlzLl90YXNrU2NoZWR1bGVyLmNhbmNlbFRhc2sodGhpcy5fcGxheVRhc2tIYW5kbGUpLHRoaXMuX3BsYXlUYXNrSGFuZGxlPW51bGwsdGhpcy5fcHJlcm9sbFdhaXRFbmFibGVkPSExO2JyZWFrO2Nhc2UgQS5BZEJyZWFrU3RhcnQ6dGhpcy5fbG9nZ2VyLmluZm8oQywiUmVjZWl2ZWQgQVBJOnRyYWNrRXZlbnQoQWRCcmVha1N0YXJ0KSB3aXRoaW4gIit0aGlzLl9wcmVyb2xsV2FpdFRpbWUrIiBtcyBhZnRlciBBUEk6dHJhY2tQbGF5LiBXZSB3aWxsIHRyYWNrIHRoaXMgYXMgcHJlcm9sbCBBZEJyZWFrLiIpLHRoaXMuX3Rhc2tTY2hlZHVsZXIuY2FuY2VsVGFzayh0aGlzLl9wbGF5VGFza0hhbmRsZSksdGhpcy5fcGxheVRhc2tIYW5kbGU9bnVsbCx0aGlzLl9wcmVyb2xsV2FpdEVuYWJsZWQ9ITEsdGhpcy5fcGxheUFmdGVyQWRTdGFydD0hMH1lbHNlIHN3aXRjaChiKXtjYXNlIEEuUGxheTp0aGlzLl9sb2dnZXIuaW5mbyhDLCJEZWZlcnJpbmcgQVBJOnRyYWNrUGxheSBmb3IgIit0aGlzLl9wcmVyb2xsV2FpdFRpbWUrIiBtcy4iKSx0aGlzLl9wbGF5UmVjZWl2ZWQ9ITAsdGhpcy5fcGxheVRhc2tIYW5kbGU9dGhpcy5fdGFza1NjaGVkdWxlci5zY2hlZHVsZVRhc2sodGhpcy5fZGVmZXJyZWRUcmFja1BsYXksdGhpcyx0aGlzLl9wcmVyb2xsV2FpdFRpbWUpLGEuc3RvcFByb2Nlc3NpbmdBY3Rpb24oKTticmVhaztjYXNlIEEuQWRCcmVha1N0YXJ0OnRoaXMuX2xvZ2dlci5pbmZvKEMsIlJlY2VpdmVkIHRyYWNrRXZlbnQoQWRCcmVha1N0YXJ0KSBiZWZvcmUgZmlyc3QgdHJhY2tQbGF5LiIpLHRoaXMuX3ByZXJvbGxXYWl0RW5hYmxlZD0hMX19LGUucHJvdG90eXBlLl9jbWRFeGl0QWN0aW9uPWZ1bmN0aW9uKGEpe3ZhciBiPWEuZ2V0UnVsZU5hbWUoKTt0aGlzLl9wbGF5QWZ0ZXJBZFN0YXJ0JiYoYj09PUEuQWRTdGFydD8odGhpcy5fY21kUGxheShhKSx0aGlzLl9wbGF5QWZ0ZXJBZFN0YXJ0PSExKTpiPT09QS5BZEJyZWFrQ29tcGxldGUmJih0aGlzLl9wbGF5QWZ0ZXJBZFN0YXJ0PSExKSksYiE9PUEuQWRTdGFydHx8dGhpcy5faXNJblN0YXRlKHouRlBsYXlQYXVzZSl8fHRoaXMuX2NtZFBsYXkoYSl9LGUucHJvdG90eXBlLl9jbWRDb25maWd1cmU9ZnVuY3Rpb24oYSl7dGhpcy5fcmVzZXRTdGF0ZSgpLHRoaXMuX2NvbmZpZ3VyZUFkb2JlQW5hbHl0aWNzUGx1Z2luKCksdGhpcy5fY29uZmlndXJlQWRvYmVIZWFyYmVhdFBsdWdpbigpLHRoaXMuX2NvbmZpZ3VyZVZpZGVvUGxheWVyUGx1Z2luKCksdGhpcy5fY29uZmlndXJlT3RoZXJQbHVnaW5zKCksdGhpcy5fY29uZmlndXJlSGVhcnRiZWF0KCl9LGUucHJvdG90eXBlLl9jbWRTZXNzaW9uU3RhcnQ9ZnVuY3Rpb24oYSl7dmFyIGI9YS5nZXREYXRhKEQpLGM9YS5nZXREYXRhKEkpO3RoaXMuX2N1cnJlbnRNZWRpYU9iamVjdD1iLHRoaXMuX3ZpZGVvSW5mbz1iLmNyZWF0ZVZpZGVvSW5mbygpLHRoaXMuX3ZpZGVvSW5mby5wbGF5ZXJOYW1lPXRoaXMuX2NvbmZpZy5wbGF5ZXJOYW1lP3RoaXMuX2NvbmZpZy5wbGF5ZXJOYW1lOiIiO3ZhciBkPWIuZ2V0VmFsdWUoZS5NZWRpYU9iamVjdEtleS5TdGFuZGFyZE1lZGlhTWV0YWRhdGEpO2QmJiJvYmplY3QiPT10eXBlb2YgZHx8KGQ9bnVsbCk7dmFyIGY9Yi5nZXRWYWx1ZShlLk1lZGlhT2JqZWN0S2V5Lk1lZGlhUmVzdW1lZCk7ImJvb2xlYW4iPT10eXBlb2YgZiYmKHRoaXMuX3ZpZGVvSW5mby5yZXN1bWVkPWYpO3ZhciBnPWIuZ2V0VmFsdWUoZS5NZWRpYU9iamVjdEtleS5QcmVyb2xsVHJhY2tpbmdXYWl0aW5nVGltZSk7InN0cmluZyIhPXR5cGVvZiBnJiYibnVtYmVyIiE9dHlwZW9mIGd8fGlzTmFOKGcpfHwodGhpcy5fcHJlcm9sbFdhaXRUaW1lPU51bWJlcihnKSx0aGlzLl9wcmVyb2xsV2FpdFRpbWU8PTAmJih0aGlzLl9wcmVyb2xsV2FpdEVuYWJsZWQ9ITEpKTt2YXIgaD10aGlzLl9wcmVwYXJlTWV0YWRhdGEoZCxjKTtoW0tdPXRoaXMuX3ZpZGVvSW5mby5tZWRpYVR5cGUsdGhpcy5fYWFQbHVnaW4uc2V0VmlkZW9NZXRhZGF0YShoKSx0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tWaWRlb0xvYWQoKSx0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tTZXNzaW9uU3RhcnQoKSx0aGlzLl9zZXRTdGF0ZSh6LlNlc3Npb24sITApLHRoaXMuX3NldFN0YXRlKHouTWVkaWEsITApfSxlLnByb3RvdHlwZS5fY21kVmlkZW9FbmQ9ZnVuY3Rpb24oYSl7dmFyIGI9YS5nZXRSdWxlTmFtZSgpPT09QS5WaWRlb0NvbXBsZXRlO2lmKHRoaXMuX2lzSW5TdGF0ZSh6Lk1lZGlhKSl7dmFyIGM9dGhpcy5faGVhcnRiZWF0LGQ9dGhpcy5fcGxheWVyUGx1Z2luO3RoaXMuX3BsYXllclBsdWdpbi50cmFja0NvbXBsZXRlKGZ1bmN0aW9uKCl7ZCYmZC50cmFja1ZpZGVvVW5sb2FkKCksYyYmYy5kZXN0cm95KCl9LGIpfXRoaXMuX3NldFN0YXRlKHouTWVkaWEsITEpfSxlLnByb3RvdHlwZS5fY21kSGFuZGxlTWVkaWFDb21wbGV0ZT1mdW5jdGlvbihhKXt0aGlzLl9pc0luTWVkaWEoYSl8fCh0aGlzLl9sb2dnZXIuaW5mbyhDLCJBUEk6dHJhY2tDb21wbGV0ZSBoYXMgYWxyZWFkeSBjbGVhbmVkIHVwIEhlYXJ0YmVhdCBpbnN0YW5jZS4iKSx0aGlzLl9jbWRTZXNzaW9uRW5kKGEpLGEuc3RvcFByb2Nlc3NpbmdBY3Rpb24oKSl9LGUucHJvdG90eXBlLl9jbWRTZXNzaW9uRW5kPWZ1bmN0aW9uKGEpe3RoaXMuX3NldFN0YXRlKHouU2Vzc2lvbiwhMSksdGhpcy5fcmVzZXRTdGF0ZSgpfSxlLnByb3RvdHlwZS5fY21kRGlzYWJsZVRyYWNraW5nPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5pbmZvKEMsIiNfY21kRGlzYWJsZVRyYWNraW5nOiBBREJNZWRpYUhlYXJ0YmVhdCBUcmFja2luZyBEaXNhYmxlZCBSZW1vdGVseS4iKSx0aGlzLl9tZWRpYUhlYXJ0YmVhdERpc2FibGVkPSEwfSxlLnByb3RvdHlwZS5fY21kQnVmZmVyU3RhcnQ9ZnVuY3Rpb24oYSl7dGhpcy5fcGxheWVyUGx1Z2luLnRyYWNrQnVmZmVyU3RhcnQoKSx0aGlzLl9zZXRTdGF0ZSh6LkJ1ZmZlciwhMCl9LGUucHJvdG90eXBlLl9jbWRCdWZmZXJDb21wbGV0ZT1mdW5jdGlvbihhKXt0aGlzLl9pc0luU3RhdGUoei5CdWZmZXIpJiZ0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tCdWZmZXJDb21wbGV0ZSgpLHRoaXMuX3NldFN0YXRlKHouQnVmZmVyLCExKX0sZS5wcm90b3R5cGUuX2NtZFNlZWtTdGFydD1mdW5jdGlvbihhKXt0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tTZWVrU3RhcnQoKSx0aGlzLl9zZXRTdGF0ZSh6LlNlZWssITApfSxlLnByb3RvdHlwZS5fY21kU2Vla0NvbXBsZXRlPWZ1bmN0aW9uKGEpe3RoaXMuX2lzSW5TdGF0ZSh6LlNlZWspJiZ0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tTZWVrQ29tcGxldGUoKSx0aGlzLl9zZXRTdGF0ZSh6LlNlZWssITEpfSxlLnByb3RvdHlwZS5fY21kUGxheT1mdW5jdGlvbihhKXt0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tQbGF5KCksdGhpcy5fc2V0U3RhdGUoei5QbGF5UGF1c2UsITApLHRoaXMuX3NldFN0YXRlKHouRlBsYXlQYXVzZSwhMCl9LGUucHJvdG90eXBlLl9jbWRQYXVzZT1mdW5jdGlvbihhKXt0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tQYXVzZSgpLHRoaXMuX3NldFN0YXRlKHouUGxheVBhdXNlLCExKSx0aGlzLl9zZXRTdGF0ZSh6LkZQbGF5UGF1c2UsITApfSxlLnByb3RvdHlwZS5fY21kQWRCcmVha1N0YXJ0PWZ1bmN0aW9uKGEpe3ZhciBiPWEuZ2V0RGF0YShFKTt0aGlzLl9jdXJyZW50QWRCcmVha09iamVjdD1iLHRoaXMuX2FkQnJlYWtJbmZvPWIuY3JlYXRlQWRCcmVha0luZm8oKSx0aGlzLl9hZEJyZWFrSW5mby5wbGF5ZXJOYW1lPXRoaXMuX2NvbmZpZy5wbGF5ZXJOYW1lP3RoaXMuX2NvbmZpZy5wbGF5ZXJOYW1lOiIiLHRoaXMuX3BsYXllclBsdWdpbi50cmFja0FkQnJlYWtTdGFydCgpLHRoaXMuX3NldFN0YXRlKHouQWRCcmVhaywhMCl9LGUucHJvdG90eXBlLl9jbWRBZEJyZWFrQ29tcGxldGU9ZnVuY3Rpb24oYSl7dGhpcy5fY3VycmVudEFkQnJlYWtPYmplY3Q9bnVsbCx0aGlzLl9hZEJyZWFrSW5mbz1udWxsLHRoaXMuX2lzSW5TdGF0ZSh6LkFkQnJlYWspJiZ0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tBZEJyZWFrQ29tcGxldGUoKSx0aGlzLl9zZXRTdGF0ZSh6LkFkQnJlYWssITEpfSxlLnByb3RvdHlwZS5fY21kQWRTdGFydD1mdW5jdGlvbihhKXt2YXIgYj1hLmdldERhdGEoRiksYz1hLmdldERhdGEoSSk7dGhpcy5fY3VycmVudEFkT2JqZWN0PWIsdGhpcy5fYWRJbmZvPWIuY3JlYXRlQWRJbmZvKCk7dmFyIGQ9Yi5nZXRWYWx1ZShNKTsiYm9vbGVhbiI9PXR5cGVvZiBkJiYodGhpcy5fYWRJbmZvLmdyYW51bGFyVHJhY2tpbmc9ZCk7dmFyIGY9Yi5nZXRWYWx1ZShlLk1lZGlhT2JqZWN0S2V5LlN0YW5kYXJkQWRNZXRhZGF0YSk7ZiYmIm9iamVjdCI9PXR5cGVvZiBmfHwoZj1udWxsKTt2YXIgZz10aGlzLl9wcmVwYXJlTWV0YWRhdGEoZixjKTt0aGlzLl9hYVBsdWdpbi5zZXRBZE1ldGFkYXRhKGcpLHRoaXMuX3BsYXllclBsdWdpbi50cmFja0FkU3RhcnQoKSx0aGlzLl9zZXRTdGF0ZSh6LkFkLCEwKX0sZS5wcm90b3R5cGUuX2NtZEFkQ29tcGxldGU9ZnVuY3Rpb24oYSl7dGhpcy5fY3VycmVudEFkT2JqZWN0PW51bGwsdGhpcy5fYWRJbmZvPW51bGwsdGhpcy5faXNJblN0YXRlKHouQWQpJiZ0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tBZENvbXBsZXRlKCksdGhpcy5fc2V0U3RhdGUoei5BZCwhMSl9LGUucHJvdG90eXBlLl9jbWRBZFNraXA9ZnVuY3Rpb24oYSl7dGhpcy5fY3VycmVudEFkT2JqZWN0PW51bGwsdGhpcy5fYWRJbmZvPW51bGwsdGhpcy5faXNJblN0YXRlKHouQWQpJiZ0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tBZFNraXAoKSx0aGlzLl9zZXRTdGF0ZSh6LkFkLCExKX0sZS5wcm90b3R5cGUuX2NtZENoYXB0ZXJTdGFydD1mdW5jdGlvbihhKXt2YXIgYj1hLmdldERhdGEoRyksYz1hLmdldERhdGEoSSk7dGhpcy5fY3VycmVudENoYXB0ZXJPYmplY3Q9Yix0aGlzLl9jaGFwdGVySW5mbz1iLmNyZWF0ZUNoYXB0ZXJJbmZvKCk7dmFyIGQ9dGhpcy5fcHJlcGFyZU1ldGFkYXRhKG51bGwsYyk7dGhpcy5fYWFQbHVnaW4uc2V0Q2hhcHRlck1ldGFkYXRhKGQpLHRoaXMuX3BsYXllclBsdWdpbi50cmFja0NoYXB0ZXJTdGFydCgpLHRoaXMuX3NldFN0YXRlKHouQ2hhcHRlciwhMCl9LGUucHJvdG90eXBlLl9jbWRDaGFwdGVyQ29tcGxldGU9ZnVuY3Rpb24oYSl7dGhpcy5fY3VycmVudENoYXB0ZXJPYmplY3Q9bnVsbCx0aGlzLl9jaGFwdGVySW5mbz1udWxsLHRoaXMuX2lzSW5TdGF0ZSh6LkNoYXB0ZXIpJiZ0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tDaGFwdGVyQ29tcGxldGUoKSx0aGlzLl9zZXRTdGF0ZSh6LkNoYXB0ZXIsITEpfSxlLnByb3RvdHlwZS5fY21kQ2hhcHRlclNraXA9ZnVuY3Rpb24oYSl7dGhpcy5fY3VycmVudENoYXB0ZXJPYmplY3Q9bnVsbCx0aGlzLl9jaGFwdGVySW5mbz1udWxsLHRoaXMuX2lzSW5TdGF0ZSh6LkNoYXB0ZXIpJiZ0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tDaGFwdGVyU2tpcCgpLHRoaXMuX3NldFN0YXRlKHouQ2hhcHRlciwhMSl9LGUucHJvdG90eXBlLl9jbWRFcnJvcj1mdW5jdGlvbihhKXt2YXIgYj1hLmdldERhdGEoSik7Ynx8KGI9InVua25vd25fZXJyb3JfaWQiKSx0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tWaWRlb1BsYXllckVycm9yKGIpfSxlLnByb3RvdHlwZS5fY21kQml0cmF0ZT1mdW5jdGlvbihhKXt0aGlzLl9wbGF5ZXJQbHVnaW4udHJhY2tCaXRyYXRlQ2hhbmdlKCl9LGUucHJvdG90eXBlLl9jbWRUaW1lZE1ldGFkYXRhVXBkYXRlPWZ1bmN0aW9uKGEpe3ZhciBiPWEuZ2V0RGF0YShIKSxjPWIuZ2V0VmFsdWUoZy5NRURJQUlORk9fS0VZX1RJTUVETUVUQURBVEEpO3RoaXMuX3BsYXllclBsdWdpbi50cmFja1RpbWVkTWV0YWRhdGEoYyl9LGUucHJvdG90eXBlLl9wcm9jZXNzUnVsZT1mdW5jdGlvbihhLGIpe3JldHVybiB0aGlzLl9ydWxlRW5naW5lLnByb2Nlc3NSdWxlKGEsYil9LGUucHJvdG90eXBlLl9zZXR1cFJ1bGVzPWZ1bmN0aW9uKCl7dGhpcy5fcnVsZUVuZ2luZS5yZWdpc3RlckVudGVyRXhpdEFjdGlvbih0aGlzLl9jbWRFbnRlckFjdGlvbix0aGlzLl9jbWRFeGl0QWN0aW9uKSx0aGlzLl9ydWxlRW5naW5lLnJlZ2lzdGVyUnVsZShBLlNlc3Npb25TdGFydCwiQVBJOnRyYWNrU2Vzc2lvblN0YXJ0IixbdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNQbGF0Zm9ybVRyYWNraW5nU3VwcG9ydGVkLCEwLEIuRXJyVW5TdXBwb3J0ZWRQbGF0Zm9ybSksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNUcmFja2luZ0Rpc2FibGVkLCExLEIuRXJyVHJhY2tpbmdEaXNhYmxlZCksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJblNlc3Npb24sITEsQi5FcnJJblNlc3Npb24pLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzVmFsaWRNZWRpYU9iamVjdCwhMCxCLkVyckludmFsaWRNZWRpYU9iamVjdCksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNBdWRpb1RyYWNraW5nU3VwcG9ydGVkLCEwLEIuRXJyQXVkaW9UcmFja2luZ05vdFN1cHBvcnRlZCldLFt0aGlzLl9jbWRDb25maWd1cmUsdGhpcy5fY21kU2Vzc2lvblN0YXJ0XSx0aGlzKSx0aGlzLl9ydWxlRW5naW5lLnJlZ2lzdGVyUnVsZShBLlNlc3Npb25FbmQsIkFQSTp0cmFja1Nlc3Npb25FbmQiLFt0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luU2Vzc2lvbiwhMCxCLkVyck5vdEluU2Vzc2lvbildLFt0aGlzLl9jbWRIYW5kbGVNZWRpYUNvbXBsZXRlLHRoaXMuX2NtZEFkU2tpcCx0aGlzLl9jbWRBZEJyZWFrQ29tcGxldGUsdGhpcy5fY21kQ2hhcHRlclNraXAsdGhpcy5fY21kVmlkZW9FbmQsdGhpcy5fY21kU2Vzc2lvbkVuZF0sdGhpcyksdGhpcy5fcnVsZUVuZ2luZS5yZWdpc3RlclJ1bGUoQS5WaWRlb0NvbXBsZXRlLCJBUEk6dHJhY2tDb21wbGV0ZSIsW3QuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5TZXNzaW9uLCEwLEIuRXJyTm90SW5TZXNzaW9uKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luTWVkaWEsITAsQi5FcnJOb3RJbk1lZGlhKV0sW3RoaXMuX2NtZEFkU2tpcCx0aGlzLl9jbWRBZEJyZWFrQ29tcGxldGUsdGhpcy5fY21kQ2hhcHRlclNraXAsdGhpcy5fY21kVmlkZW9FbmRdLHRoaXMpLHRoaXMuX3J1bGVFbmdpbmUucmVnaXN0ZXJSdWxlKEEuRGlzYWJsZVRyYWNraW5nLCJEaXNhYmxlVHJhY2tpbmciLFt0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc1RyYWNraW5nRGlzYWJsZWQsITEsQi5FcnJUcmFja2luZ0Rpc2FibGVkKV0sW3RoaXMuX2NtZERpc2FibGVUcmFja2luZ10sdGhpcyksdGhpcy5fcnVsZUVuZ2luZS5yZWdpc3RlclJ1bGUoQS5FcnJvciwiQVBJOnRyYWNrRXJyb3IiLFt0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luU2Vzc2lvbiwhMCxCLkVyck5vdEluU2Vzc2lvbiksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJbk1lZGlhLCEwLEIuRXJyTm90SW5NZWRpYSldLFt0aGlzLl9jbWRFcnJvcl0sdGhpcyksdGhpcy5fcnVsZUVuZ2luZS5yZWdpc3RlclJ1bGUoQS5QbGF5LCJBUEk6dHJhY2tQbGF5IixbdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJblNlc3Npb24sITAsQi5FcnJOb3RJblNlc3Npb24pLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5NZWRpYSwhMCxCLkVyck5vdEluTWVkaWEpLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX3Nob3VsZEFsbG93UGxheWVyU3RhdGVDaGFuZ2UsITAsQi5FcnJJbnZhbGlkUGxheWVyU3RhdGUpXSxbdGhpcy5fY21kU2Vla0NvbXBsZXRlLHRoaXMuX2NtZEJ1ZmZlckNvbXBsZXRlLHRoaXMuX2NtZFBsYXldLHRoaXMpLHRoaXMuX3J1bGVFbmdpbmUucmVnaXN0ZXJSdWxlKEEuUGF1c2UsIkFQSTp0cmFja1BhdXNlIixbdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJblNlc3Npb24sITAsQi5FcnJOb3RJblNlc3Npb24pLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5NZWRpYSwhMCxCLkVyck5vdEluTWVkaWEpLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX3Nob3VsZEFsbG93UGxheWVyU3RhdGVDaGFuZ2UsITAsQi5FcnJJbnZhbGlkUGxheWVyU3RhdGUpLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5CdWZmZXIsITEsQi5FcnJJbkJ1ZmZlciksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJblNlZWssITEsQi5FcnJJblNlZWspXSxbdGhpcy5fY21kUGF1c2VdLHRoaXMpLHRoaXMuX3J1bGVFbmdpbmUucmVnaXN0ZXJSdWxlKEEuQnVmZmVyU3RhcnQsIkFQSTp0cmFja0V2ZW50KEJ1ZmZlclN0YXJ0KSIsW3QuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5TZXNzaW9uLCEwLEIuRXJyTm90SW5TZXNzaW9uKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luTWVkaWEsITAsQi5FcnJOb3RJbk1lZGlhKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9zaG91bGRBbGxvd1BsYXllclN0YXRlQ2hhbmdlLCEwLEIuRXJySW52YWxpZFBsYXllclN0YXRlKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luQnVmZmVyLCExLEIuRXJySW5CdWZmZXIpLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5TZWVrLCExLEIuRXJySW5TZWVrKV0sW3RoaXMuX2NtZEJ1ZmZlclN0YXJ0XSx0aGlzKSx0aGlzLl9ydWxlRW5naW5lLnJlZ2lzdGVyUnVsZShBLkJ1ZmZlckNvbXBsZXRlLCJBUEk6dHJhY2tFdmVudChCdWZmZXJDb21wbGV0ZSkiLFt0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luU2Vzc2lvbiwhMCxCLkVyck5vdEluU2Vzc2lvbiksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJbk1lZGlhLCEwLEIuRXJyTm90SW5NZWRpYSksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5fc2hvdWxkQWxsb3dQbGF5ZXJTdGF0ZUNoYW5nZSwhMCxCLkVyckludmFsaWRQbGF5ZXJTdGF0ZSksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJbkJ1ZmZlciwhMCxCLkVyck5vdEluQnVmZmVyKV0sW3RoaXMuX2NtZEJ1ZmZlckNvbXBsZXRlXSx0aGlzKSx0aGlzLl9ydWxlRW5naW5lLnJlZ2lzdGVyUnVsZShBLlNlZWtTdGFydCwiQVBJOnRyYWNrRXZlbnQoU2Vla1N0YXJ0KSIsW3QuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5TZXNzaW9uLCEwLEIuRXJyTm90SW5TZXNzaW9uKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luTWVkaWEsITAsQi5FcnJOb3RJbk1lZGlhKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9zaG91bGRBbGxvd1BsYXllclN0YXRlQ2hhbmdlLCEwLEIuRXJySW52YWxpZFBsYXllclN0YXRlKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luU2VlaywhMSxCLkVyckluU2VlayksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJbkJ1ZmZlciwhMSxCLkVyckluQnVmZmVyKV0sW3RoaXMuX2NtZFNlZWtTdGFydF0sdGhpcyksdGhpcy5fcnVsZUVuZ2luZS5yZWdpc3RlclJ1bGUoQS5TZWVrQ29tcGxldGUsIkFQSTp0cmFja0V2ZW50KFNlZWtDb21wbGV0ZSkiLFt0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luU2Vzc2lvbiwhMCxCLkVyck5vdEluU2Vzc2lvbiksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJbk1lZGlhLCEwLEIuRXJyTm90SW5NZWRpYSksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5fc2hvdWxkQWxsb3dQbGF5ZXJTdGF0ZUNoYW5nZSwhMCxCLkVyckludmFsaWRQbGF5ZXJTdGF0ZSksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJblNlZWssITAsQi5FcnJOb3RJblNlZWspXSxbdGhpcy5fY21kU2Vla0NvbXBsZXRlXSx0aGlzKSx0aGlzLl9ydWxlRW5naW5lLnJlZ2lzdGVyUnVsZShBLkFkQnJlYWtTdGFydCwiQVBJOnRyYWNrRXZlbnQoQWRCcmVha1N0YXJ0KSIsW3QuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5TZXNzaW9uLCEwLEIuRXJyTm90SW5TZXNzaW9uKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luTWVkaWEsITAsQi5FcnJOb3RJbk1lZGlhKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc1ZhbGlkQWRCcmVha09iamVjdCwhMCxCLkVyckludmFsaWRBZEJyZWFrT2JqZWN0KSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0RpZmZlcmVudEFkQnJlYWtPYmplY3QsITAsQi5FcnJEdXBsaWNhdGVBZEJyZWFrT2JqZWN0KV0sW3RoaXMuX2NtZEFkU2tpcCx0aGlzLl9jbWRBZEJyZWFrQ29tcGxldGUsdGhpcy5fY21kQWRCcmVha1N0YXJ0XSx0aGlzKSx0aGlzLl9ydWxlRW5naW5lLnJlZ2lzdGVyUnVsZShBLkFkQnJlYWtDb21wbGV0ZSwiQVBJOnRyYWNrRXZlbnQoQWRCcmVha0NvbXBsZXRlKSIsW3QuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5TZXNzaW9uLCEwLEIuRXJyTm90SW5TZXNzaW9uKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luTWVkaWEsITAsQi5FcnJOb3RJbk1lZGlhKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luQWRCcmVhaywhMCxCLkVyck5vdEluQWRCcmVhayldLFt0aGlzLl9jbWRBZFNraXAsdGhpcy5fY21kQWRCcmVha0NvbXBsZXRlXSx0aGlzKSx0aGlzLl9ydWxlRW5naW5lLnJlZ2lzdGVyUnVsZShBLkFkU3RhcnQsIkFQSTp0cmFja0V2ZW50KEFkU3RhcnQpIixbdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJblNlc3Npb24sITAsQi5FcnJOb3RJblNlc3Npb24pLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5NZWRpYSwhMCxCLkVyck5vdEluTWVkaWEpLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5BZEJyZWFrLCEwLEIuRXJyTm90SW5BZEJyZWFrKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc1ZhbGlkQWRPYmplY3QsITAsQi5FcnJJbnZhbGlkQWRPYmplY3QpLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzRGlmZmVyZW50QWRPYmplY3QsITAsQi5FcnJEdXBsaWNhdGVBZE9iamVjdCldLFt0aGlzLl9jbWRBZFNraXAsdGhpcy5fY21kQWRTdGFydF0sdGhpcyksdGhpcy5fcnVsZUVuZ2luZS5yZWdpc3RlclJ1bGUoQS5BZENvbXBsZXRlLCJBUEk6dHJhY2tFdmVudChBZENvbXBsZXRlKSIsW3QuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5TZXNzaW9uLCEwLEIuRXJyTm90SW5TZXNzaW9uKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luTWVkaWEsITAsQi5FcnJOb3RJbk1lZGlhKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luQWRCcmVhaywhMCxCLkVyck5vdEluQWRCcmVhayksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJbkFkLCEwLEIuRXJyTm90SW5BZCldLFt0aGlzLl9jbWRBZENvbXBsZXRlXSx0aGlzKSx0aGlzLl9ydWxlRW5naW5lLnJlZ2lzdGVyUnVsZShBLkFkU2tpcCwiQVBJOnRyYWNrRXZlbnQoQWRTa2lwKSIsW3QuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5TZXNzaW9uLCEwLEIuRXJyTm90SW5TZXNzaW9uKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luTWVkaWEsITAsQi5FcnJOb3RJbk1lZGlhKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luQWRCcmVhaywhMCxCLkVyck5vdEluQWRCcmVhayksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJbkFkLCEwLEIuRXJyTm90SW5BZCldLFt0aGlzLl9jbWRBZFNraXBdLHRoaXMpLHRoaXMuX3J1bGVFbmdpbmUucmVnaXN0ZXJSdWxlKEEuQ2hhcHRlclN0YXJ0LCJBUEk6dHJhY2tFdmVudChDaGFwdGVyU3RhcnQpIixbdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJblNlc3Npb24sITAsQi5FcnJOb3RJblNlc3Npb24pLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5NZWRpYSwhMCxCLkVyck5vdEluTWVkaWEpLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzVmFsaWRDaGFwdGVyT2JqZWN0LCEwLEIuRXJySW52YWxpZENoYXB0ZXJPYmplY3QpLHQuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzRGlmZmVyZW50Q2hhcHRlck9iamVjdCwhMCxCLkVyckR1cGxpY2F0ZUNoYXB0ZXJPYmplY3QpXSxbdGhpcy5fY21kQ2hhcHRlclNraXAsdGhpcy5fY21kQ2hhcHRlclN0YXJ0XSx0aGlzKSx0aGlzLl9ydWxlRW5naW5lLnJlZ2lzdGVyUnVsZShBLkNoYXB0ZXJDb21wbGV0ZSwiQVBJOnRyYWNrRXZlbnQoQ2hhcHRlckNvbXBsZXRlKSIsW3QuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5TZXNzaW9uLCEwLEIuRXJyTm90SW5TZXNzaW9uKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luTWVkaWEsITAsQi5FcnJOb3RJbk1lZGlhKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luQ2hhcHRlciwhMCxCLkVyck5vdEluQ2hhcHRlcildLFt0aGlzLl9jbWRDaGFwdGVyQ29tcGxldGVdLHRoaXMpLHRoaXMuX3J1bGVFbmdpbmUucmVnaXN0ZXJSdWxlKEEuQ2hhcHRlclNraXAsIkFQSTp0cmFja0V2ZW50KENoYXB0ZXJTa2lwKSIsW3QuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5TZXNzaW9uLCEwLEIuRXJyTm90SW5TZXNzaW9uKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luTWVkaWEsITAsQi5FcnJOb3RJbk1lZGlhKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luQ2hhcHRlciwhMCxCLkVyck5vdEluQ2hhcHRlcildLFt0aGlzLl9jbWRDaGFwdGVyU2tpcF0sdGhpcyksdGhpcy5fcnVsZUVuZ2luZS5yZWdpc3RlclJ1bGUoQS5CaXRyYXRlQ2hhbmdlLCJBUEk6dHJhY2tFdmVudChCaXRyYXRlQ2hhbmdlKSIsW3QuY3JlYXRlUHJlZGljYXRlKHRoaXMuX2lzSW5TZXNzaW9uLCEwLEIuRXJyTm90SW5TZXNzaW9uKSx0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luTWVkaWEsITAsQi5FcnJOb3RJbk1lZGlhKV0sW3RoaXMuX2NtZEJpdHJhdGVdLHRoaXMpLHRoaXMuX3J1bGVFbmdpbmUucmVnaXN0ZXJSdWxlKEEuVGltZWRNZXRhZGF0YVVwZGF0ZSwiQVBJOnRyYWNrRXZlbnQoVGltZWRNZXRhZGF0YVVwZGF0ZSkiLFt0LmNyZWF0ZVByZWRpY2F0ZSh0aGlzLl9pc0luU2Vzc2lvbiwhMCxCLkVyck5vdEluU2Vzc2lvbiksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNJbk1lZGlhLCEwLEIuRXJyTm90SW5NZWRpYSksdC5jcmVhdGVQcmVkaWNhdGUodGhpcy5faXNWYWxpZFRpbWVkTWV0YWRhdGFPYmplY3QsITAsQi5FcnJJbnZhbGlkVGltZWRNZXRhZGF0YU9iamVjdCldLFt0aGlzLl9jbWRUaW1lZE1ldGFkYXRhVXBkYXRlXSx0aGlzKX0sZS5wcm90b3R5cGUuX2NvbmZpZ3VyZUFkb2JlQW5hbHl0aWNzUGx1Z2luPWZ1bmN0aW9uKCl7dGhpcy5fYWFQbHVnaW49bmV3IG4odGhpcy5fYXBwTWVhc3VyZW1lbnQsbmV3IHAodGhpcykpO3ZhciBhPW5ldyBvO2EuY2hhbm5lbD10aGlzLl9jb25maWcuY2hhbm5lbD90aGlzLl9jb25maWcuY2hhbm5lbDoiIixhLmRlYnVnTG9nZ2luZz1jLk1lZGlhSGVhcnRiZWF0Ll9kZWJ1Z0xvZ2dpbmd8fHRoaXMuX2NvbmZpZy5kZWJ1Z0xvZ2dpbmcsdGhpcy5fYWFQbHVnaW4uY29uZmlndXJlKGEpLHRoaXMuX3BsdWdpbnMucHVzaCh0aGlzLl9hYVBsdWdpbil9LGUucHJvdG90eXBlLl9jb25maWd1cmVBZG9iZUhlYXJiZWF0UGx1Z2luPWZ1bmN0aW9uKCl7dmFyIGE9dGhpcy5fYXBwTWVhc3VyZW1lbnQudmlzaXRvcj90aGlzLl9hcHBNZWFzdXJlbWVudC52aXNpdG9yLm1hcmtldGluZ0Nsb3VkT3JnSUQ6IiI7dGhpcy5fYWhQbHVnaW49bmV3IHEobmV3IHModGhpcykpO3ZhciBiPW5ldyByKHRoaXMuX2NvbmZpZy50cmFja2luZ1NlcnZlcixhKTtiLmRlYnVnTG9nZ2luZz1jLk1lZGlhSGVhcnRiZWF0Ll9kZWJ1Z0xvZ2dpbmd8fHRoaXMuX2NvbmZpZy5kZWJ1Z0xvZ2dpbmcsYi5vdnA9dGhpcy5fY29uZmlnLm92cD90aGlzLl9jb25maWcub3ZwOiIiLGIuc3NsPXRoaXMuX2NvbmZpZy5zc2wsYi5zZGs9dGhpcy5fY29uZmlnLmFwcFZlcnNpb24/dGhpcy5fY29uZmlnLmFwcFZlcnNpb246IiI7dmFyIGQ9dGhpcy5fcHJpbWV0aW1lVFZTREtWZXJzaW9uKCk7ZCYmZC5sZW5ndGg+MCYmKGIuX19wcmltZXRpbWU9ITAsYi5fX3BzZGtWZXJzaW9uPWQpLHRoaXMuX2FoUGx1Z2luLmNvbmZpZ3VyZShiKSx0aGlzLl9wbHVnaW5zLnB1c2godGhpcy5fYWhQbHVnaW4pfSxlLnByb3RvdHlwZS5fY29uZmlndXJlVmlkZW9QbGF5ZXJQbHVnaW49ZnVuY3Rpb24oKXt0aGlzLl9wbGF5ZXJQbHVnaW49bmV3IGsobmV3IG0odGhpcykpO3ZhciBhPW5ldyBsO2EuZGVidWdMb2dnaW5nPWMuTWVkaWFIZWFydGJlYXQuX2RlYnVnTG9nZ2luZ3x8dGhpcy5fY29uZmlnLmRlYnVnTG9nZ2luZyx0aGlzLl9wbGF5ZXJQbHVnaW4uY29uZmlndXJlKGEpLHRoaXMuX3BsdWdpbnMucHVzaCh0aGlzLl9wbGF5ZXJQbHVnaW4pfSxlLnByb3RvdHlwZS5fY29uZmlndXJlT3RoZXJQbHVnaW5zPWZ1bmN0aW9uKCl7aWYoYy5wbHVnaW5zLm5pZWxzZW4mJnRoaXMuX2NvbmZpZy5uaWVsc2VuQ29uZmlnS2V5JiZ0aGlzLl9jb25maWcubmllbHNlbkFwcEluZm8pe3RoaXMuX25pZWxzZW5QbHVnaW49bmV3IGMucGx1Z2lucy5uaWVsc2VuLk5pZWxzZW5QbHVnaW4obmV3IGMuX05pZWxzZW5QbHVnaW5EZWxlZ2F0ZSh0aGlzLHRoaXMuX2xvZ2dlcikpO3ZhciBhPW5ldyBjLnBsdWdpbnMubmllbHNlbi5OaWVsc2VuUGx1Z2luQ29uZmlnO2EuZGVidWdMb2dnaW5nPWMuTWVkaWFIZWFydGJlYXQuX2RlYnVnTG9nZ2luZ3x8dGhpcy5fY29uZmlnLmRlYnVnTG9nZ2luZyxhLmFwcEluZm89dGhpcy5fY29uZmlnLm5pZWxzZW5BcHBJbmZvLGEuY29uZmlnS2V5PXRoaXMuX2NvbmZpZy5uaWVsc2VuQ29uZmlnS2V5LHRoaXMuX25pZWxzZW5QbHVnaW4uY29uZmlndXJlKGEpLHRoaXMuX3BsdWdpbnMucHVzaCh0aGlzLl9uaWVsc2VuUGx1Z2luKX19LGUucHJvdG90eXBlLl9jb25maWd1cmVIZWFydGJlYXQ9ZnVuY3Rpb24oKXt2YXIgYT1uZXcgaTthLmRlYnVnTG9nZ2luZz1jLk1lZGlhSGVhcnRiZWF0Ll9kZWJ1Z0xvZ2dpbmd8fHRoaXMuX2NvbmZpZy5kZWJ1Z0xvZ2dpbmcsdGhpcy5faGVhcnRiZWF0PW5ldyBoKG5ldyBqKHRoaXMpLHRoaXMuX3BsdWdpbnMpLHRoaXMuX2hlYXJ0YmVhdC5jb25maWd1cmUoYSl9LGUucHJvdG90eXBlLl9yZXNldFN0YXRlPWZ1bmN0aW9uKCl7dGhpcy5fdGFza1NjaGVkdWxlci5jbGVhclRhc2tzKCksdGhpcy5fbWVkaWFTdGF0ZT17fSx0aGlzLl9wbHVnaW5zPVtdLHRoaXMuX3BsYXllclBsdWdpbj1udWxsLHRoaXMuX2FhUGx1Z2luPW51bGwsdGhpcy5fYWhQbHVnaW49bnVsbCx0aGlzLl9uaWVsc2VuUGx1Z2luPW51bGwsdGhpcy5faGVhcnRiZWF0PW51bGwsdGhpcy5fY3VycmVudE1lZGlhT2JqZWN0PW51bGwsdGhpcy5fY3VycmVudEFkQnJlYWtPYmplY3Q9bnVsbCx0aGlzLl9jdXJyZW50QWRPYmplY3Q9bnVsbCx0aGlzLl9jdXJyZW50Q2hhcHRlck9iamVjdD1udWxsLHRoaXMuX3ZpZGVvSW5mbz1udWxsLHRoaXMuX2FkQnJlYWtJbmZvPW51bGwsdGhpcy5fYWRJbmZvPW51bGwsdGhpcy5fY2hhcHRlckluZm89bnVsbCx0aGlzLl9wcmVyb2xsV2FpdEVuYWJsZWQ9ITAsdGhpcy5fcHJlcm9sbFdhaXRUaW1lPU4sdGhpcy5fcGxheVJlY2VpdmVkPSExLHRoaXMuX3BsYXlUYXNrSGFuZGxlPW51bGwsdGhpcy5fcGxheUFmdGVyQWRTdGFydD0hMX0sZS5wcm90b3R5cGUuX3ByaW1ldGltZVRWU0RLVmVyc2lvbj1mdW5jdGlvbigpe3JldHVybiB0aGlzLl9jdXJyZW50TWVkaWFPYmplY3Q/dGhpcy5fY3VycmVudE1lZGlhT2JqZWN0LmdldFZhbHVlKEwpOm51bGx9LGUucHJvdG90eXBlLl9jbGVhbkNvbnRleHREYXRhPWZ1bmN0aW9uKGEpe2lmKG51bGw9PWF8fCJvYmplY3QiIT10eXBlb2YgYSlyZXR1cm4gbnVsbDt2YXIgYj17fTtmb3IodmFyIGMgaW4gYSlpZihhLmhhc093blByb3BlcnR5KGMpKXt2YXIgZD1hW2NdOyJudW1iZXIiIT10eXBlb2YgZCYmInN0cmluZyIhPXR5cGVvZiBkJiYiYm9vbGVhbiIhPXR5cGVvZiBkfHwoYltjXT1kKX1yZXR1cm4gYn0sZS5wcm90b3R5cGUuX3ByZXBhcmVNZXRhZGF0YT1mdW5jdGlvbihhLGIpe3ZhciBjPXt9O2lmKGImJnYuYXBwZW5kKGMsYiksYSl7dmFyIGQ9dGhpcy5fY2xlYW5Db250ZXh0RGF0YShhKTt2LmFwcGVuZChjLGQpfXJldHVybiBkZWxldGUgY1tLXSxjfSxlLnByb3RvdHlwZS5fb25EZWxlZ2F0ZUVycm9yPWZ1bmN0aW9uKGEpe3RoaXMuX2xvZ2dlci5lcnJvcihDLGEuZ2V0TWVzc2FnZSgpKyIgfCAiK2EuZ2V0RGV0YWlscygpKX0sZS5wcm90b3R5cGUuX2Rpc2FibGVIQlRyYWNraW5nPWZ1bmN0aW9uKCl7dmFyIGE9dC5jcmVhdGVDb250ZXh0KCk7dGhpcy5fcHJvY2Vzc1J1bGUoQS5EaXNhYmxlVHJhY2tpbmcsYSksdGhpcy5fcHJvY2Vzc1J1bGUoQS5TZXNzaW9uRW5kLGEpfTt2YXIgej17U2Vzc2lvbjowLE1lZGlhOjEsQWRCcmVhazoyLEFkOjMsQ2hhcHRlcjo0LFBsYXlQYXVzZTo1LEJ1ZmZlcjo2LFNlZWs6NyxGUGxheVBhdXNlOjh9LEE9e1Nlc3Npb25TdGFydDowLFNlc3Npb25FbmQ6MSxWaWRlb0NvbXBsZXRlOjIsUGxheTozLFBhdXNlOjQsRXJyb3I6NSxBZEJyZWFrU3RhcnQ6NixBZEJyZWFrQ29tcGxldGU6NyxBZFN0YXJ0OjgsQWRDb21wbGV0ZTo5LEFkU2tpcDoxMCxDaGFwdGVyU3RhcnQ6MTEsQ2hhcHRlckNvbXBsZXRlOjEyLENoYXB0ZXJTa2lwOjEzLFNlZWtTdGFydDoxNCxTZWVrQ29tcGxldGU6MTUsQnVmZmVyU3RhcnQ6MTYsQnVmZmVyQ29tcGxldGU6MTcsQml0cmF0ZUNoYW5nZToxOCxUaW1lZE1ldGFkYXRhVXBkYXRlOjE5LERpc2FibGVUcmFja2luZzoyMH0sQj17RXJyVW5TdXBwb3J0ZWRQbGF0Zm9ybToiTWVkaWFIZWFydGJlYXQgZG9lcyBub3Qgc3VwcG9ydCB0cmFja2luZyBkdWUgdG8gQXBwTWVhc3VyZW1lbnQgb3IgVmlzaXRvckFQSSBub3Qgc3VwcG9ydGluZyB0aGUgYnJvd3Nlci4iLEVyck5vdEluU2Vzc2lvbjpcJ01lZGlhSGVhcnRiZWF0IGlzIG5vdCBpbiBhY3RpdmUgdHJhY2tpbmcgc2Vzc2lvbiwgY2FsbCAiQVBJOnRyYWNrU2Vzc2lvblN0YXJ0IiB0byBiZWdpbiBhIG5ldyB0cmFja2luZyBzZXNzaW9uLlwnLEVyckluU2Vzc2lvbjpcJ01lZGlhSGVhcnRiZWF0IGlzIGluIGFjdGl2ZSB0cmFja2luZyBzZXNzaW9uLCBjYWxsICJBUEk6dHJhY2tTZXNzaW9uRW5kIiB0byBlbmQgY3VycmVudCB0cmFja2luZyBzZXNzaW9uLlwnLEVyclRyYWNraW5nRGlzYWJsZWQ6Ik1lZGlhSGVhcnRiZWF0IHRyYWNraW5nIGlzIGRpc2FibGVkIGZvciB0aGlzIHB1Ymxpc2hlci4gUGxlYXNlIGNvbnRhY3QgQWRvYmUgUmVwcmVzZW50YXRpdmUgdG8gZW5hYmxlIHRyYWNraW5nLiIsRXJyTm90SW5NZWRpYTpcJ01lZGlhSGVhcnRiZWF0IGhhcyBjb21wbGV0ZWQgdHJhY2tpbmcgc2Vzc2lvbiwgY2FsbCAiQVBJOnRyYWNrU2Vzc2lvbkVuZCIgZmlyc3QgdG8gZW5kIGN1cnJlbnQgc2Vzc2lvbiBhbmQgdGhlbiBiZWdpbiBhIG5ldyB0cmFja2luZyBzZXNzaW9uLlwnLEVyckluQnVmZmVyOlwnTWVkaWFIZWFydGJlYXQgaXMgdHJhY2tpbmcgYnVmZmVyIGV2ZW50cywgY2FsbCAiQVBJOnRyYWNrRXZlbnQoQnVmZmVyQ29tcGxldGUpIiBmaXJzdCB0byBzdG9wIHRyYWNraW5nIGJ1ZmZlciBldmVudHMuXCcsRXJyTm90SW5CdWZmZXI6XCdNZWRpYUhlYXJ0YmVhdCBpcyBub3QgdHJhY2tpbmcgYnVmZmVyIGV2ZW50cywgY2FsbCAiQVBJOnRyYWNrRXZlbnQoQnVmZmVyU3RhcnQpIiBiZWZvcmUgIkFQSTp0cmFja0V2ZW50KEJ1ZmZlckNvbXBsZXRlKSIuXCcsRXJySW5TZWVrOlwnTWVkaWFIZWFydGJlYXQgaXMgdHJhY2tpbmcgc2VlayBldmVudHMsIGNhbGwgIkFQSTp0cmFja0V2ZW50KFNlZWtDb21wbGV0ZSkiIGZpcnN0IHRvIHN0b3AgdHJhY2tpbmcgc2VlayBldmVudHMuXCcsRXJyTm90SW5TZWVrOlwnTWVkaWFIZWFydGJlYXQgaXMgbm90IHRyYWNraW5nIHNlZWsgZXZlbnRzLCBjYWxsICJBUEk6dHJhY2tFdmVudChTZWVrU3RhcnQpIiBiZWZvcmUgIkFQSTp0cmFja0V2ZW50KFNlZWtDb21wbGV0ZSkiLlwnLEVyck5vdEluQWRCcmVhazpcJ01lZGlhSGVhcnRiZWF0IGlzIG5vdCB0cmFja2luZyBhbnkgQWRCcmVhaywgY2FsbCAiQVBJOnRyYWNrRXZlbnQoQWRCcmVha1N0YXJ0KSIgdG8gYmVnaW4gdHJhY2tpbmcgQWRCcmVha1wnLEVyck5vdEluQWQ6XCdNZWRpYUhlYXJ0YmVhdCBpcyBub3QgdHJhY2tpbmcgYW55IEFkLCBjYWxsICJBUEk6dHJhY2tFdmVudChBZFN0YXJ0KSIgdG8gYmVnaW4gdHJhY2tpbmcgQWRcJyxFcnJOb3RJbkNoYXB0ZXI6XCdNZWRpYUhlYXJ0YmVhdCBpcyBub3QgdHJhY2tpbmcgYW55IENoYXB0ZXIsIGNhbGwgIkFQSTp0cmFja0V2ZW50KENoYXB0ZXJTdGFydCkiIHRvIGJlZ2luIHRyYWNraW5nIENoYXB0ZXJcJyxFcnJJbnZhbGlkTWVkaWFPYmplY3Q6XCdNZWRpYUluZm8gcGFzc2VkIGludG8gIkFQSTp0cmFja1Nlc3Npb25TdGFydCIgaXMgaW52YWxpZC5cJyxFcnJJbnZhbGlkQWRCcmVha09iamVjdDpcJ0FkQnJlYWtJbmZvIHBhc3NlZCBpbnRvICJBUEk6dHJhY2tFdmVudChBZEJyZWFrU3RhcnQpIiBpcyBpbnZhbGlkLlwnLEVyckR1cGxpY2F0ZUFkQnJlYWtPYmplY3Q6XCdNZWRpYUhlYXJ0YmVhdCBpcyBjdXJyZW50bHkgdHJhY2tpbmcgdGhlIEFkQnJlYWsgcGFzc2VkIGludG8gIkFQSTp0cmFja0V2ZW50KEFkQnJlYWtTdGFydCkiLlwnLEVyckludmFsaWRBZE9iamVjdDpcJ0FkSW5mbyBwYXNzZWQgaW50byAiQVBJOnRyYWNrRXZlbnQoQWRTdGFydCkiIGlzIGludmFsaWQuXCcsRXJyRHVwbGljYXRlQWRPYmplY3Q6XCdNZWRpYUhlYXJ0YmVhdCBpcyBjdXJyZW50bHkgdHJhY2tpbmcgdGhlIEFkIHBhc3NlZCBpbnRvICJBUEk6dHJhY2tFdmVudChBZFN0YXJ0KSIuXCcsRXJySW52YWxpZENoYXB0ZXJPYmplY3Q6XCdDaGFwdGVySW5mbyBwYXNzZWQgaW50byAiQVBJOnRyYWNrRXZlbnQoQ2hhcHRlclN0YXJ0KSIgaXMgaW52YWxpZC5cJyxFcnJEdXBsaWNhdGVDaGFwdGVyT2JqZWN0OlwnTWVkaWFIZWFydGJlYXQgaXMgY3VycmVudGx5IHRyYWNraW5nIHRoZSBDaGFwdGVyIHBhc3NlZCBpbnRvICJBUEk6dHJhY2tFdmVudChDaGFwdGVyU3RhcnQpIi5cJyxFcnJJbnZhbGlkVGltZWRNZXRhZGF0YU9iamVjdDpcJ1RpbWVkTWV0YWRhdGEgcGFzc2VkIGludG8gIkFQSTp0cmFja0V2ZW50KFRpbWVkTWV0YWRhdGFVcGRhdGUpIiBpcyBpbnZhbGlkLlwnLEVyckludmFsaWRQbGF5ZXJTdGF0ZToiTWVkaWFIZWFydGJlYXQgaXMgdHJhY2tpbmcgYW4gQWRCcmVhayBidXQgbm90IHRyYWNraW5nIGFueSBBZCBhbmQgd2lsbCBkcm9wIGFueSBjYWxscyB0byB0cmFjayBwbGF5ZXIgc3RhdGUgKFBsYXksIFBhdXNlLCBCdWZmZXIgb3IgU2VlaykgaW4gdGhpcyBzdGF0ZS4iLEVyckF1ZGlvVHJhY2tpbmdOb3RTdXBwb3J0ZWQ6IlVwZ3JhZGUgeW91ciBBcHBNZWFzdXJlbWVudCBsaWJyYXJ5IHRvIHZlcnNpb24gPj0gXCcyLjExLjBcJyB0byBzdXBwb3J0IHRyYWNraW5nIGF1ZGlvIGNvbnRlbnQuIn0sQz0iTWVkaWFIZWFydGJlYXQiLEQ9ImtleV9tZWRpYV9vYmplY3QiLEU9ImtleV9hZGJyZWFrX29iamVjdCIsRj0ia2V5X2FkX29iamVjdCIsRz0ia2V5X2NoYXB0ZXJfb2JqZWN0IixIPSJrZXlfdGltZWRfbWV0YWRhdGFfb2JqZWN0IixJPSJrZXlfY3VzdG9tX21ldGFkYXRhIixKPSJrZXlfZXJyb3JfaWQiLEs9ImEubWVkaWEuc3RyZWFtVHlwZSIsTD0iYS5fX3B0dHZzZGtWZXJzaW9uIixNPSJncmFudWxhcl9hZF90cmFja2luZyIsTj0yNTA7Yy5fTWVkaWFIZWFydGJlYXRFcnJvck1lc3NhZ2U9QixjLk1lZGlhSGVhcnRiZWF0RGVsZWdhdGU9ZCxjLk1lZGlhSGVhcnRiZWF0PWUsYy5NZWRpYUhlYXJ0YmVhdC5fZGVidWdMb2dnaW5nPSExfShhLkFEQi5jb3JlLGEuQURCLnZhKSxhLkFEQnx8KGEuQURCPXt9KSxhLkFEQi5jb3JlfHwoYS5BREIuY29yZT1jb3JlKSxhLkFEQi52YXx8KGEuQURCLnZhPXZhKSxhLkFEQi52YS5wbHVnaW5zfHwoYS5BREIudmEucGx1Z2lucz17fSl9KHRoaXMpO1xuXG4gIH0pLmNhbGwobGliKTtcbiAgZXhwb3J0cy52YSA9IGxpYi5BREIudmE7XG4gIGV4cG9ydHMuY29yZSA9IGxpYi5BREIuY29yZTtcbn0pKTtcbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMjZiMTE3MzU2OWJkNDMwMThiYmU0ZmRlMDhkMzMwZjknLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzA0IFtQTF0gWlogSGVhcnRCZWF0IFRyYWNrZXInLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvbGlicmFyeUxvYWRlZC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnbG9iYWw6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICcvKiEgSGVhcnRCZWF0VHJhY2tlciAtIHYxLjIgLSAyMDE5LTExLTI3ICovXG5cbndpbmRvdy5IZWFydEJlYXRUcmFja2VyID0gZnVuY3Rpb24oKSB7XG4gICAgdmFyIE1lZGlhSGVhcnRiZWF0ID0gQURCLnZhLk1lZGlhSGVhcnRiZWF0O1xuICAgIHZhciBNZWRpYUhlYXJ0YmVhdENvbmZpZyA9IEFEQi52YS5NZWRpYUhlYXJ0YmVhdENvbmZpZztcbiAgICB2YXIgTWVkaWFIZWFydGJlYXREZWxlZ2F0ZSA9IEFEQi52YS5NZWRpYUhlYXJ0YmVhdERlbGVnYXRlO1xuXG4gICAgLy8gICJ0aGlzIG9iamVjdCBvdmVycmlkZVxuICAgIHZhciBfdGhpcyA9IHRoaXM7XG5cbiAgICAvLyAgUGxheWVycyBsaXN0XG4gICAgLy8gIFBsYXllcnMgYXJlIGtleWVkIG9uIHBsYXllcklkXG4gICAgdGhpcy5wbGF5ZXJzID0ge307XG5cblxuICAgIC8vICBTdGF0aWMgY29uZmlndXJhdGlvbiBwYXJhbWV0ZXJzIHNldCBhdCBEVE0gbGV2ZWxcbiAgICB0aGlzLmNvbmZpZ3VyYXRpb24gPSBfc2F0ZWxsaXRlLmdldFZhcigiW1ZJREVPXSBIYkNvbmZpZ3VyYXRpb24iKTtcblxuICAgIC8vICBBcHBNZWFzdXJlbWVudCBvYmplY3QgLSBzZXQgYXQgZ2xvYmFsIGxldmVsXG4gICAgdGhpcy5hcHBNZWFzdXJlbWVudCA9IHdpbmRvdy5zO1xuXG4gICAgLy8gIENyZWF0ZSBIZWFydEJlYXQgTWVkaWEgT2JqZWN0XG4gICAgLy8gIFBhcmFtczpcbiAgICAvLyAgICAgIC0gY29udGV4dERhdGFcbiAgICAvLyAgICAgIC0gdmlkZW9fZGF0YVxuICAgIC8vICAgICAgICAgIC0gdmlkZW9faWRcbiAgICAvLyAgICAgICAgICAtIHZpZGVvX25hbWVcbiAgICAvLyAgICAgICAgICAtIHZpZGVvX2xlbmd0aFxuICAgIC8vICAgICAgICAgIC0gdmlkZW9fb3ZwXG4gICAgLy8gICAgICAtIGp3UGxheWVyT2JqZWN0XG5cbiAgICB0aGlzLmNyZWF0ZUhCUGxheWVyID0gZnVuY3Rpb24ocGFyYW1zKSB7XG5cbiAgICAgICAgLy8gIEdldCBKV1BsYXllciBJRC5cbiAgICAgICAgdmFyIHBsYXllcl9pZCA9IHBhcmFtcy5qd1BsYXllck9iamVjdC5nZXRDb25maWcoKS5pZDtcbiAgICAgICAgdmFyIHBsYXllciA9IGZhbHNlO1xuICAgICAgICAvL19zYXRlbGxpdGUubm90aWZ5KCItLS0tIEhFQVJUQkVBVFRSQUNLRVI6ICIsXG4gICAgICAgIC8vICAgICJQbGF5ZXJJRCAiLCBwbGF5ZXJfaWQpOyAgICAgICBcblxuICAgICAgICAvL19zYXRlbGxpdGUubm90aWZ5KCItLS0tIEhFQVJUQkVBVFRSQUNLRVI6IGxpbmtUcmFja1ZhcnM6ICIsIHMubGlua1RyYWNrVmFycyk7XG4gICAgICAgIHMubGlua1RyYWNrVmFycyA9ICIiO1xuICAgICAgICBzLmNsZWFyVmFycygpO1xuXG4gICAgICAgIC8vICAgIFdvcmthcm91bmQgdG8gY29udmVydCB2aWRlb0lEIHRvIFN0cmluZ1xuICAgICAgICBpZiAodHlwZW9mIHBhcmFtcy52aWRlb19kYXRhLnZpZGVvX2lkICE9ICJzdHJpbmciKVxuICAgICAgICAgICAgcGFyYW1zLnZpZGVvX2RhdGEudmlkZW9faWQgPSBwYXJhbXMudmlkZW9fZGF0YS52aWRlb19pZC50b1N0cmluZygpO1xuXG4gICAgICAgIC8vIFZlcmlmaWNvIGNoZSBub24gZXNpc3RhIHVuIHBsYXllciBkZWwgdmlkZW9cbiAgICAgICAgaWYgKHR5cGVvZiBfdGhpcy5wbGF5ZXJzW3BsYXllcl9pZF0gIT0gInVuZGVmaW5lZCIpIHtcbiAgICAgICAgICAgIC8vIF9zYXRlbGxpdGUubm90aWZ5KCItLS0tIEhFQVJUQkVBVFRSQUNLRVI6ICIsXG4gICAgICAgICAgICAvLyAgICAgIkhCUGxheWVyIGZvciAtLT4gIixcbiAgICAgICAgICAgIC8vICAgICBwbGF5ZXJfaWQsXG4gICAgICAgICAgICAvLyAgICAgIiIsXG4gICAgICAgICAgICAvLyAgICAgIiBhbHJlYWR5IGV4aXN0cy4iKTtcbiAgICAgICAgICAgIHBsYXllciA9IF90aGlzLnBsYXllcnNbcGxheWVyX2lkXVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgLy8gIENyZWF0ZSBsXCdpc3RhbnphIGRlbGxhIGNsYXNzZSBWaWRlb0hlYXJ0QmVhdCBQbGF5ZXIgZm9yIHRoZSB2aWRlb19pZFxuICAgICAgICAgICAgcGxheWVyID0gbmV3IEhlYXJ0QmVhdFBsYXllcihcbiAgICAgICAgICAgICAgICBwYXJhbXMsXG4gICAgICAgICAgICAgICAgdGhpcy5jb25maWd1cmF0aW9uLFxuICAgICAgICAgICAgICAgIHRoaXMuYXBwTWVhc3VyZW1lbnRcbiAgICAgICAgICAgICk7XG5cbiAgICAgICAgICAgIF90aGlzLnBsYXllcnNbcGxheWVyX2lkXSA9IHBsYXllcjtcbiAgICAgICAgICAgIC8vX3NhdGVsbGl0ZS5ub3RpZnkoIi0tLS0gSEVBUlRCRUFUVFJBQ0tFUjoiLFxuICAgICAgICAgICAgLy8gICAgIkhCUGxheWVyIGZvciAtLT4gIixcbiAgICAgICAgICAgIC8vICBwbGF5ZXJfaWQsXG4gICAgICAgICAgICAvLyAgIiIsXG4gICAgICAgICAgICAvLyAgIiBDUkVBVEVEISIpO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gIENvbnRyb2xsYXJlIGNoZSBsYSBzZXNzaW9uZSBub24gc2lhIGdpw6AgaW5pemlhdGFcbiAgICAgICAgLy8gIEluaXppbyBsYSBzZXNzaW9uIHRyYWNraW5nIChxdWFuZG8gY2FtYmlhbm8gaSB2aWRlbyBzZW56YSBBRFYpXG4gICAgICAgIGlmICghcGxheWVyLmlzVHJhY2tpbmdTZXNzaW9uQWN0aXZlKSB7XG4gICAgICAgICAgICBfdHJhY2tTZXNzaW9uU3RhcnQocGFyYW1zLCBwbGF5ZXIpO1xuICAgICAgICAgICAgcGxheWVyLmlzVHJhY2tpbmdTZXNzaW9uQWN0aXZlID0gdHJ1ZTtcbiAgICAgICAgfVxuICAgICAgICAvL19zYXRlbGxpdGUubm90aWZ5KCItLS0tIEhFQVJUQkVBVFRSQUNLRVI6IGxpbmtUcmFja1ZhcnM6ICIsIHMubGlua1RyYWNrVmFycyk7XG4gICAgfVxuXG4gICAgLy8gIFZJREVPIENPUkUgUExBWUJBQ0tcbiAgICAvLyAgTWV0aG9kIHRvIHRyYWNrIHZpZGVvIHBsYXlcbiAgICB0aGlzLkhCVHJhY2tQbGF5ID0gZnVuY3Rpb24ocGFyYW1zKSB7XG4gICAgICAgIHZhciBwbGF5ZXIgPSBfdGhpcy5wbGF5ZXJzW3BhcmFtcy5wbGF5ZXJfaWRdO1xuXG4gICAgICAgIC8vX3NhdGVsbGl0ZS5ub3RpZnkoIi0tLS0gSEVBUlRCRUFUVFJBQ0tFUjogcGxheWVyIHN0YXRlIG9uIHRyYWNrIHBsYXk6ICIgLCBwbGF5ZXIucGxheWVyLmdldFN0YXRlKCkpXG5cbiAgICAgICAgLy8gIFdvcmthcm91bmQgdG8gY29udmVydCB2aWRlb0lEIHRvIFN0cmluZ1xuICAgICAgICBpZiAodHlwZW9mIHBhcmFtcy52aWRlb19kYXRhLnZpZGVvX2lkICE9ICJzdHJpbmciKVxuICAgICAgICAgICAgcGFyYW1zLnZpZGVvX2RhdGEudmlkZW9faWQgPSBwYXJhbXMudmlkZW9fZGF0YS52aWRlb19pZC50b1N0cmluZygpO1xuXG5cbiAgICAgICAgLy8gIENoZWNrIHRvIGF2b2lkIGRvdWJsZSBwbGF5VHJhY2tpbmdcbiAgICAgICAgaWYgKHBsYXllci5pc1RyYWNraW5nKVxuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuXG4gICAgICAgIC8vICBDb250cm9sbGFyZSBjaGUgbGEgc2Vzc2lvbmUgbm9uIHNpYSBnacOgIGluaXppYXRhXG4gICAgICAgIC8vICBJbml6aW8gbGEgc2Vzc2lvbiB0cmFja2luZyAocXVhbmRvIGNhbWJpYW5vIGkgdmlkZW8gc2VuemEgQURWKVxuICAgICAgICAvKmlmICghcGxheWVyLmlzVHJhY2tpbmdTZXNzaW9uQWN0aXZlKSB7XG4gICAgICAgICAgICBfdHJhY2tTZXNzaW9uU3RhcnQocGFyYW1zLCBwbGF5ZXIpO1xuICAgICAgICAgICAgcGxheWVyLmlzVHJhY2tpbmdTZXNzaW9uQWN0aXZlID0gdHJ1ZTtcbiAgICAgICAgfSovXG5cbiAgICAgICAgcGxheWVyLm15X21lZGlhSGVhcnRiZWF0LnRyYWNrUGxheSgpO1xuXG4gICAgICAgIC8vICBDaGVjayB0byBhdm9pZCBkb3VibGUgcGxheVRyYWNraW5nXG4gICAgICAgIHBsYXllci5pc1RyYWNraW5nID0gdHJ1ZTtcbiAgICAgICAgLy9fc2F0ZWxsaXRlLm5vdGlmeSgiLS0tLSBIRUFSVEJFQVRUUkFDS0VSOiAiLFxuICAgICAgICAvLyAgIkhCUGxheWVyIC0tPiIsIHBhcmFtcy5wbGF5ZXJfaWQsICItLT4gUExBWVNUQVJUICIpXG4gICAgICAgIC8vIF9zYXRlbGxpdGUubm90aWZ5KCItLS0tIEhFQVJUQkVBVFRSQUNLRVI6IFZpZGVvICIsXG4gICAgICAgIC8vICAgICBwYXJhbXMudmlkZW9fZGF0YS52aWRlb19uYW1lKTtcbiAgICB9XG5cbiAgICAvLyAgTWV0aG9kIHRvIHRyYWNrIHZpZGVvIGNvbXBsZXRlXG4gICAgdGhpcy5IQlRyYWNrUGF1c2UgPSBmdW5jdGlvbihwYXJhbXMpIHtcbiAgICAgICAgdmFyIHBsYXllciA9IF90aGlzLnBsYXllcnNbcGFyYW1zLnBsYXllcl9pZF07XG5cbiAgICAgICAgcGxheWVyLm15X21lZGlhSGVhcnRiZWF0LnRyYWNrUGF1c2UoKTtcblxuICAgICAgICAvL19zYXRlbGxpdGUubm90aWZ5KCItLS0tIEhFQVJUQkVBVFRSQUNLRVI6IiArXG4gICAgICAgIC8vICAgIiBIQlBsYXllciAtLT4gIiArXG4gICAgICAgIC8vICBwYXJhbXMucGxheWVyX2lkICsgIiBUUkFDSyBQQVVTRSBjYWxsZWQuIik7XG4gICAgfVxuXG4gICAgLy8gIE1ldGhvZCB0byB0cmFjayB2aWRlbyBjb21wbGV0ZVxuICAgIHRoaXMuSEJUcmFja0NvbXBsZXRlID0gZnVuY3Rpb24ocGFyYW1zKSB7XG4gICAgICAgIHZhciBwbGF5ZXIgPSBfdGhpcy5wbGF5ZXJzW3BhcmFtcy5wbGF5ZXJfaWRdO1xuXG4gICAgICAgIHBsYXllci5teV9tZWRpYUhlYXJ0YmVhdC50cmFja0NvbXBsZXRlKCk7XG5cbiAgICAgICAgcGxheWVyLmlzVHJhY2tpbmcgPSBmYWxzZTtcbiAgICAgICAgXG4gICAgICAgIC8vX3NhdGVsbGl0ZS5ub3RpZnkoIi0tLS0gSEVBUlRCRUFUVFJBQ0tFUjoiLFxuICAgICAgICAvLyAgIiBIQlBsYXllciAtLT4gIixcbiAgICAgICAgLy8gIHBhcmFtcy5wbGF5ZXJfaWQsICIgVFJBQ0sgQ09NUExFVEUgYW5kIFNFU1NJT04gRU5EIGNhbGxlZC4iKTtcbiAgICB9XG5cbiAgICAvLyAgTWV0aG9kIHRvIHN0b3AgdGhlIHNlc3Npb24gd2hlbiB0aGUgdmlkZW8gaXMgdW5sb2FkZWQsIHdpdGhvdXQgY29tcGxldGluZ1xuICAgIHRoaXMuZGVzdHJveUhCUGxheWVyID0gZnVuY3Rpb24ocGFyYW1zKSB7XG4gICAgICAgIHZhciBwbGF5ZXIgPSBfdGhpcy5wbGF5ZXJzW3BhcmFtcy5wbGF5ZXJfaWRdO1xuXG4gICAgICAgIHBsYXllci5teV9tZWRpYUhlYXJ0YmVhdC50cmFja1Nlc3Npb25FbmQoKTtcblxuICAgICAgICBwbGF5ZXIuaXNUcmFja2luZyA9IGZhbHNlO1xuICAgICAgICBwbGF5ZXIuaXNUcmFja2luZ1Nlc3Npb25BY3RpdmUgPSBmYWxzZTtcblxuICAgICAgICBkZWxldGUgX3RoaXMucGxheWVyc1twYXJhbXMucGxheWVyX2lkXTtcblxuICAgICAgICAvL19zYXRlbGxpdGUubm90aWZ5KCItLS0tIEhFQVJUQkVBVFRSQUNLRVI6IixcbiAgICAgICAgLy8gICIgSEJQbGF5ZXIgLS0+ICIsXG4gICAgICAgIC8vICBwYXJhbXMucGxheWVyX2lkLCAiU0VTU0lPTiBFTkQgd2l0aG91dCBUUkFDSyBDT01QTEVURSBjYWxsZWQuIik7XG4gICAgfVxuXG4gICAgLy8gIEVORCBWSURFTyBDT1JFIFBMQVlCQUNLXG5cbiAgICAvLyAgQUQgVFJBQ0tJTkdcblxuICAgIC8vICBNZXRob2QgdG8gdHJhY2sgQWRCcmVha1N0YXJ0XG4gICAgLy8gIHBhcmFtczpcbiAgICAvLyAgLSBwbGF5ZXJfaWRcbiAgICAvLyAgLSBhZF9icmVha19wYXJhbXNcbiAgICAvLyAgICAgIC0gYWRfYnJlYWtfbmFtZTogInByZXJvbGwiLFxuICAgIC8vICAgICAgLSBwb3NpdGlvbjogMCxcbiAgICAvLyAgICAgIC0gc3RhcnRfdGltZTogMFxuXG4gICAgdGhpcy5IQlRyYWNrQWRCcmVha1N0YXJ0ID0gZnVuY3Rpb24ocGFyYW1zKSB7XG4gICAgICAgIC8vIGNvbnNvbGUubG9nKCItLS0tIFRyYWNrIEFkIEJyZWFrIFN0YXJ0IDEiKVxuXG4gICAgICAgIHZhciBwbGF5ZXIgPSBfdGhpcy5wbGF5ZXJzW3BhcmFtcy5wbGF5ZXJfaWRdO1xuXG4gICAgICAgIHZhciBfYWRCcmVha0luZm8gPSBBREIudmEuTWVkaWFIZWFydGJlYXQuY3JlYXRlQWRCcmVha09iamVjdChcbiAgICAgICAgICAgIHBhcmFtcy5hZF9icmVha19wYXJhbXMuYWRfYnJlYWtfbmFtZSxcbiAgICAgICAgICAgIHBhcmFtcy5hZF9icmVha19wYXJhbXMucG9zaXRpb24sXG4gICAgICAgICAgICBwYXJhbXMuYWRfYnJlYWtfcGFyYW1zLnN0YXJ0X3RpbWUpO1xuXG4gICAgICAgIC8vIGNvbnNvbGUubG9nKCItLS0tIFRyYWNrIEFkIEJyZWFrIFN0YXJ0IDIiKVxuXG5cblxuICAgICAgICBwbGF5ZXIubXlfbWVkaWFIZWFydGJlYXQudHJhY2tFdmVudChBREIudmEuTWVkaWFIZWFydGJlYXQuRXZlbnQuQWRCcmVha1N0YXJ0LCBfYWRCcmVha0luZm8sIG51bGwpO1xuXG4gICAgICAgIC8vIGNvbnNvbGUubG9nKCItLS0tIFRyYWNrIEFkIEJyZWFrIFN0YXJ0IDMiKVxuXG4gICAgICAgIC8vX3NhdGVsbGl0ZS5ub3RpZnkoIi0tLS0gSEVBUlRCRUFUVFJBQ0tFUjoiICtcbiAgICAgICAgLy8gICAiIEhCUGxheWVyIC0tPiAiICtcbiAgICAgICAgLy8gICIgLS0+IFRSQUNLIEFEIEJSRUFLIFNUQVJUIGNhbGxlZC4iKTtcbiAgICB9XG5cbiAgICAvLyAgTWV0aG9kIHRvIHRyYWNrIEFkU3RhcnRcbiAgICAvLyAgcGFyYW1zOlxuICAgIC8vICAtIHBsYXllcl9pZFxuICAgIC8vICAtIGFkX3BhcmFtc1xuICAgIC8vICAgICAgLSBhZF9uYW1lXG4gICAgLy8gICAgICAtIGFkX2lkXG4gICAgLy8gICAgICAtIHBvc2l0aW9uXG4gICAgLy8gICAgICAtIGxlbmd0aFxuXG4gICAgdGhpcy5IQlRyYWNrQWRTdGFydCA9IGZ1bmN0aW9uKHBhcmFtcykge1xuXG4gICAgICAgIHZhciBwbGF5ZXIgPSBfdGhpcy5wbGF5ZXJzW3BhcmFtcy5wbGF5ZXJfaWRdO1xuXG5cbiAgICAgICAgdmFyIF9hZE9iamVjdCA9IEFEQi52YS5NZWRpYUhlYXJ0YmVhdC5jcmVhdGVBZE9iamVjdChcbiAgICAgICAgICAgIHBhcmFtcy5hZF9wYXJhbXMuYWRfbmFtZSxcbiAgICAgICAgICAgIHBhcmFtcy5hZF9wYXJhbXMuYWRfaWQsXG4gICAgICAgICAgICBwYXJhbXMuYWRfcGFyYW1zLnBvc2l0aW9uLFxuICAgICAgICAgICAgcGFyYW1zLmFkX3BhcmFtcy5sZW5ndGgpO1xuXG4gICAgICAgIC8vQUQgbmFtZSAtPiBUaGUgbmFtZSBvZiB0aGUgYWQgXG4gICAgICAgIC8vQUQgaWQgLT4gVGhlIHVuaXF1ZSBpZCBmb3IgdGhlIGFkXG4gICAgICAgIC8vQUQgcG9zaXRpb24gLT4gVGhlIHN0YXJ0IHBvc2l0aW9uIG9mIHRoZSBhZCAobnVtYmVyKVxuICAgICAgICAvL0FEIGxlbmd0aCAtPiBUaGUgbGVuZ3RoIG9mIHRoZSBhZCBpbiBzZWNvbmQgKG51bWJlcilcblxuICAgICAgICBwbGF5ZXIubXlfbWVkaWFIZWFydGJlYXQudHJhY2tFdmVudChBREIudmEuTWVkaWFIZWFydGJlYXQuRXZlbnQuQWRTdGFydCwgX2FkT2JqZWN0LCBudWxsKTtcblxuICAgICAgICAvL19zYXRlbGxpdGUubm90aWZ5KCItLS0tIEhFQVJUQkVBVFRSQUNLRVI6IiArXG4gICAgICAgIC8vICAiIEhCUGxheWVyIC0tPiAiICtcbiAgICAgICAgLy8gIHBhcmFtcy5wbGF5ZXJfaWQgK1xuICAgICAgICAvLyAgIiAtLT4gQWRUaXRsZTogIiArXG4gICAgICAgIC8vICBwYXJhbXMuYWRfcGFyYW1zLmFkX25hbWUgK1xuICAgICAgICAvLyAgIiAtLT4gVFJBQ0sgQUQgU1RBUlQgY2FsbGVkLiIpO1xuICAgIH1cblxuICAgIHRoaXMuSEJUcmFja0FkU2tpcCA9IGZ1bmN0aW9uKHBhcmFtcykge1xuICAgICAgICB2YXIgcGxheWVyID0gX3RoaXMucGxheWVyc1twYXJhbXMucGxheWVyX2lkXTtcblxuICAgICAgICAvL19zYXRlbGxpdGUubm90aWZ5KCItLS0tIEhFQVJUQkVBVFRSQUNLRVI6IHBsYXllciBzdGF0ZSBiZWZvcmUgc2tpcDogIiArIHBsYXllci5wbGF5ZXIuZ2V0U3RhdGUoKSlcbiAgICAgICAgLy8gIFszMS4wMS4yMDE5XSBSaW1vc3NvIG1vbWVudGFuZWFtZW50ZSBwZXIgaWwgbGl2ZS4gICBcbiAgICAgICAgcGxheWVyLm15X21lZGlhSGVhcnRiZWF0LnRyYWNrRXZlbnQoQURCLnZhLk1lZGlhSGVhcnRiZWF0LkV2ZW50LkFkU2tpcCk7XG5cbiAgICAgICAgLy8gX3NhdGVsbGl0ZS5ub3RpZnkoIi0tLS0gSEVBUlRCRUFUVFJBQ0tFUjogcGxheWVyIHN0YXRlIGFmdGVyIHNraXA6ICIgKyBwbGF5ZXIucGxheWVyLmdldFN0YXRlKCkpXG4gICAgICAgIC8vX3NhdGVsbGl0ZS5ub3RpZnkoIi0tLS0gSEVBUlRCRUFUVFJBQ0tFUjoiICtcbiAgICAgICAgLy8gICIgSEJQbGF5ZXIgLS0+ICIgK1xuICAgICAgICAvLyAgcGFyYW1zLnBsYXllcl9pZCArICIgVFJBQ0sgQUQgU0tJUCBjYWxsZWQuIik7XG4gICAgfVxuXG4gICAgdGhpcy5IQlRyYWNrQWRDb21wbGV0ZSA9IGZ1bmN0aW9uKHBhcmFtcykge1xuICAgICAgICB2YXIgcGxheWVyID0gX3RoaXMucGxheWVyc1twYXJhbXMucGxheWVyX2lkXTtcblxuICAgICAgICAvLyAgWzMxLjAxLjIwMTldIFJpbW9zc28gbW9tZW50YW5lYW1lbnRlIHBlciBpbCBsaXZlLlxuICAgICAgICBwbGF5ZXIubXlfbWVkaWFIZWFydGJlYXQudHJhY2tFdmVudChBREIudmEuTWVkaWFIZWFydGJlYXQuRXZlbnQuQWRDb21wbGV0ZSk7XG4gICAgICAgIC8vcGxheWVyLm15X21lZGlhSGVhcnRiZWF0LnRyYWNrRXZlbnQoQURCLnZhLk1lZGlhSGVhcnRiZWF0LkV2ZW50LkFkQnJlYWtDb21wbGV0ZSk7XG5cbiAgICAgICAgLy9fc2F0ZWxsaXRlLm5vdGlmeSgiLS0tLSBIRUFSVEJFQVRUUkFDS0VSOiIgK1xuICAgICAgICAvLyAgICIgSEJQbGF5ZXIgLS0+ICIgK1xuICAgICAgICAvLyAgcGFyYW1zLnBsYXllcl9pZCArICIgVFJBQ0sgQUQgQ09NUExFVEUgY2FsbGVkLiIpO1xuICAgIH1cblxuICAgIHRoaXMuSEJUcmFja0FkQnJlYWtFbmQgPSBmdW5jdGlvbihwYXJhbXMpIHtcbiAgICAgICAgdmFyIHBsYXllciA9IF90aGlzLnBsYXllcnNbcGFyYW1zLnBsYXllcl9pZF07XG5cbiAgICAgICAgcGxheWVyLm15X21lZGlhSGVhcnRiZWF0LnRyYWNrRXZlbnQoQURCLnZhLk1lZGlhSGVhcnRiZWF0LkV2ZW50LkFkQnJlYWtDb21wbGV0ZSk7XG5cbiAgICAgICAgLy9fc2F0ZWxsaXRlLm5vdGlmeSgiLS0tLSBIRUFSVEJFQVRUUkFDS0VSOiIgK1xuICAgICAgICAvLyAgIiBIQlBsYXllciAtLT4gIiArICIgVFJBQ0sgQUQgQlJFQUsgRU5EIGNhbGxlZC4iKTtcbiAgICB9XG5cbiAgICAvLyAgRU5EIEFEIFRSQUNLSU5HXG5cblxuICAgIC8vICBJTlRFUk5BTCBNRVRIT0RcbiAgICB2YXIgX3RyYWNrU2Vzc2lvblN0YXJ0ID0gZnVuY3Rpb24ocGFyYW1zLCBwbGF5ZXIpIHtcbiAgICAgICAgLy9fc2F0ZWxsaXRlLm5vdGlmeSgiLS0tLSBIRUFSVEJFQVRUUkFDS0VSIC0tPiBfdHJhY2tTZXNzaW9uU3RhcnQiKTtcblxuICAgICAgICB2YXIgbWVkaWFPYmplY3QgPSB1bmRlZmluZWQ7XG4gICAgICAgIHZhciBjdXN0b21WaWRlb01ldGFkYXRhID0gcGFyYW1zLmNvbnRleHREYXRhO1xuXG4gICAgICAgIG1lZGlhT2JqZWN0ID0gTWVkaWFIZWFydGJlYXQuY3JlYXRlTWVkaWFPYmplY3QocGFyYW1zLnZpZGVvX2RhdGEudmlkZW9fbmFtZSxcbiAgICAgICAgICAgIHBhcmFtcy52aWRlb19kYXRhLnZpZGVvX2lkLFxuICAgICAgICAgICAgcGFyYW1zLnZpZGVvX2RhdGEudmlkZW9fbGVuZ3RoLFxuICAgICAgICAgICAgcGFyYW1zLnZpZGVvX2RhdGEudmlkZW9fb3ZwKTtcblxuICAgICAgICBwbGF5ZXIubXlfbWVkaWFIZWFydGJlYXQudHJhY2tTZXNzaW9uU3RhcnQobWVkaWFPYmplY3QsIGN1c3RvbVZpZGVvTWV0YWRhdGEpO1xuICAgIH1cbn1cblxuXG4vLyAgQ2xhc3MgdG8gbWFuYWdlIE1lZGlhT2JqZWN0SW5zdGFuY2VzXG52YXIgSGVhcnRCZWF0UGxheWVyID0gZnVuY3Rpb24ocGFyYW1zLCBDb25maWd1cmF0aW9uLCBfYXBwTWVhc3VyZW1lbnQpIHtcblxuICAgIHZhciBNZWRpYUhlYXJ0YmVhdCA9IEFEQi52YS5NZWRpYUhlYXJ0YmVhdDtcbiAgICB2YXIgTWVkaWFIZWFydGJlYXRDb25maWcgPSBBREIudmEuTWVkaWFIZWFydGJlYXRDb25maWc7XG4gICAgdmFyIE1lZGlhSGVhcnRiZWF0RGVsZWdhdGUgPSBBREIudmEuTWVkaWFIZWFydGJlYXREZWxlZ2F0ZTtcblxuICAgIHZhciBfdGhpcyA9IHRoaXM7XG4gICAgdGhpcy52aWRlb19wYXJhbXMgPSBwYXJhbXM7XG4gICAgdGhpcy5wbGF5ZXIgPSBwYXJhbXMuandQbGF5ZXJPYmplY3Q7XG5cbiAgICAvLyBDb25maWdcbiAgICB0aGlzLm1lZGlhQ29uZmlnID0gbmV3IE1lZGlhSGVhcnRiZWF0Q29uZmlnKCk7XG4gICAgdGhpcy5tZWRpYUNvbmZpZy50cmFja2luZ1NlcnZlciA9IENvbmZpZ3VyYXRpb24uSEVBUlRCRUFULlRSQUNLSU5HX1NFUlZFUjtcbiAgICB0aGlzLm1lZGlhQ29uZmlnLnBsYXllck5hbWUgPSBDb25maWd1cmF0aW9uLlBMQVlFUi5OQU1FO1xuICAgIHRoaXMubWVkaWFDb25maWcuY2hhbm5lbCA9IENvbmZpZ3VyYXRpb24uSEVBUlRCRUFULkNIQU5ORUw7XG4gICAgdGhpcy5tZWRpYUNvbmZpZy5kZWJ1Z0xvZ2dpbmcgPSBmYWxzZTtcbiAgICB0aGlzLm1lZGlhQ29uZmlnLmFwcFZlcnNpb24gPSBDb25maWd1cmF0aW9uLkhFQVJUQkVBVC5TREs7XG4gICAgdGhpcy5tZWRpYUNvbmZpZy5zc2wgPSB0cnVlO1xuICAgIHRoaXMubWVkaWFDb25maWcub3ZwID0gQ29uZmlndXJhdGlvbi5IRUFSVEJFQVQuT1ZQO1xuXG4gICAgLy8gRGVsZWdhdGVcbiAgICB0aGlzLm1lZGlhRGVsZWdhdGUgPSBuZXcgTWVkaWFIZWFydGJlYXREZWxlZ2F0ZSgpO1xuXG4gICAgLy8gUmVwbGFjZSA8Y3VycmVudFBsYXliYWNrVGltZT4gd2l0aCB0aGUgdmlkZW8gcGxheWVyIGN1cnJlbnQgcGxheWJhY2sgdGltZVxuICAgIHRoaXMubWVkaWFEZWxlZ2F0ZS5nZXRDdXJyZW50UGxheWJhY2tUaW1lID0gZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiBfdGhpcy5wbGF5ZXIuZ2V0Q3VycmVudFRpbWUoKTtcbiAgICB9O1xuXG4gICAgdGhpcy5tZWRpYURlbGVnYXRlLmdldFFvU09iamVjdCA9IGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gTWVkaWFIZWFydGJlYXQuY3JlYXRlUW9TT2JqZWN0KDUwMDAsIDAsIDI0LCAxMCk7XG4gICAgfTtcblxuICAgIHRoaXMubXlfbWVkaWFIZWFydGJlYXQgPVxuICAgICAgICBuZXcgTWVkaWFIZWFydGJlYXQodGhpcy5tZWRpYURlbGVnYXRlLCB0aGlzLm1lZGlhQ29uZmlnLCBfYXBwTWVhc3VyZW1lbnQpO1xufScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNjBmYzY5YzcyMmRkNDY5M2E3ZGY5ZDlmYjBiMjQwNWYnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gVHJhY2tpbmcgQ1RBIEFPTCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAndHJhY2tfdHJhY2tpbmdjdGFhb2xfYWN0aW9uJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsYW0uYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsYW0uYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xscHJqLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLmFiYm9uYW1lbnRvLW8uc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmluZm8oJ0FET0JFIExBVU5DSCAtIHRyYWNraW5nY3RhYW9sJyksIHQucGFnZU5hbWUgPSAnJywgdC5ldmVudHMgPSAnJywgdC5saW5rVHJhY2tWYXJzID0gJ2V2ZW50cyxlVmFyMjQscHJvcDU0LGVWYXI1NCxwcm9wNTUsZVZhcjU1LGVWYXIxMCcsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxNicsIHQuZVZhcjI0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ3RyYWNrX3RyYWNraW5nY3RhYW9sX3N0ZXAnKSwgdC5wcm9wNTQgPSB3aW5kb3cubG9jYXRpb24uaHJlZiwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ3RyYWNraW5nY3RhYW9sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw1MTUzZmEzN2FhMDA0ZGM2YWJjZjVkNjEwNzQwNjRmMicsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBUcmFja2luZyBDVEEgUmVjb250cmFjdGluZycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAndHJhY2tfY3RhcmVjb250cmFjdGluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnBhZ2VOYW1lID0gJycsIHQuZXZlbnRzID0gJycsIHQubGlua1RyYWNrVmFycyA9ICdldmVudHMsZVZhcjI0LHByb3A1NCxlVmFyNTQscHJvcDU1LGVWYXI1NScsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxNicsIHQuZVZhcjI0ID0gZS5kZXRhaWwubGFiZWxjdGEsIHQucHJvcDU0ID0gd2luZG93LmxvY2F0aW9uLmhyZWYsIHQucHJvcDU0ICYmICh0LmVWYXI1NCA9ICdEPWM1NCcpLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICd0cmFja2luZ2N0YXJlY29udHJhY3RpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw0MTUxOWNkYjhlY2I0MGVlYjMxNzc3ZGY3Y2Y3ZWNmMycsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTUgW0VSXSBbQ0xJQ0sgQ09SUE9SQVRFXSBTa3lRIC0gQm94IGNvbnRyb2xsbyB2b2NhbGUnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJyNkYS1jb250cm9sbG8tdm9jYWxlLmRhQWNjb3JkaW9uSXRlbS5jbG9zZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1NQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvdHZcL3NreXEvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdlVmFyMjQsZVZhcjU1LHByb3A1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LmVWYXIyNCA9ICdjb250cm9sbG8gdm9jYWxlJywgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnY2xpY2tfY29ycG9yYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMOTg5NjkwOTE1YjU4NDdhOGEwYWFhNjU1YzllOGQ4YjYnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gW0FMTF0gT3ZlcmxheSByZWNvbnRyYWN0aW5nLXRyYWZmaWNvJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICd0cmFja19yZWNvbnRyYWN0aW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5kZXRhaWwucGFnZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnBhZ2VOYW1lID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUGFnZU5hbWUnKSArIGEsIGNvbnNvbGUuaW5mbygnQWRvYmUgdHJhY2tfcmVjb250cmFjdGluZyAnICsgdC5wYWdlTmFtZSksIHQuc2VydmVyID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFNlcnZlcicpLCB0LmNoYW5uZWwgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBDaGFubmVsJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBDaGFubmVsJykgOiAnJywgdC5wcm9wMiA9IHQuZ2V0UHJldmlvdXNWYWx1ZSh0LnBhZ2VOYW1lLCAnZ3B2X3BuJyksIHQucHJvcDUgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBRdWFydG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A1MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgOiAnJywgdC5wcm9wNTQgPSBsb2NhdGlvbi5ocmVmLCB0LnByb3A1NSA9IGxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTkgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBTZWNvbmRvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbycpIDogJycsIHQucHJvcDYwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gVGVyem8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gVGVyem8gTGl2ZWxsbycpIDogJycsIHQucHJvcDY3ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIENvb2tpZSBMb2dpbiBTdGF0dXMnKSwgdC5wYWdlTmFtZSAmJiAodC5lVmFyMSA9ICdEPXBhZ2VOYW1lJyksIHQucHJvcDIgJiYgKHQuZVZhcjIgPSAnRD1jMicpLCB0LnByb3A1ICYmICh0LmVWYXI1ID0gJ0Q9YzUnKSwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpLCB0LnByb3A1OSAmJiAodC5lVmFyNTkgPSAnRD1jNTknKSwgdC5wcm9wNjAgJiYgKHQuZVZhcjYwID0gJ0Q9YzYwJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZDcwZjE0NzY0NjJkNDc2YWE3MmFmOTRmZjliNGQ1YTUnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gU3BlZWQgVGVzdCBDb25maWd1cmF0b3JlIC0gZXNpdG8gbmVnYXRpdm8nLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2NvbmZpZ3VyYXRvcmUtc3BlZWQtdGVzdF9uZWdhdGl2bycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy53d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjYWVtLnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2VydmVyID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFNlcnZlcicpLCB0LmNoYW5uZWwgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBDaGFubmVsJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBDaGFubmVsJykgOiAnJywgdC5wYWdlTmFtZSA9ICdza3k6b2ZmZXJ0ZTpjb25maWd1cmF0b3JlLWFiYm9uYW1lbnRvLXNreTplc2l0by1zcGVlZC10ZXN0LW5lZ2F0aXZvJywgdC5wcm9wMiA9IHQuZ2V0UHJldmlvdXNWYWx1ZSh0LnBhZ2VOYW1lLCAnZ3B2X3BuJyksIHQucHJvcDUgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBRdWFydG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA6ICcnLCB0LnByb3AyOSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJykgOiAnJywgdC5wcm9wNTAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpIDogJycsIHQucHJvcDU0ID0gbG9jYXRpb24uaHJlZiwgdC5wcm9wNTUgPSBsb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU5ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBTZWNvbmRvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A2MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A2NyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBDb29raWUgTG9naW4gU3RhdHVzJyksIHQucGFnZU5hbWUgJiYgKHQuZVZhcjEgPSAnRD1wYWdlTmFtZScpLCB0LnByb3AyICYmICh0LmVWYXIyID0gJ0Q9YzInKSwgdC5wcm9wNSAmJiAodC5lVmFyNSA9ICdEPWM1JyksIHQucHJvcDU0ICYmICh0LmVWYXI1NCA9ICdEPWM1NCcpLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKSwgdC5wcm9wNTkgJiYgKHQuZVZhcjU5ID0gJ0Q9YzU5JyksIHQucHJvcDYwICYmICh0LmVWYXI2MCA9ICdEPWM2MCcpLCB0LnByb3A2NyAmJiAodC5lVmFyNjcgPSAnRD1jNjcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw1MWE5NjQyOGFmOGM0NGI5OTIyZTk0NGRjY2NiNGRkMScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjMDUgW1BMXSBbVEFSR0VUXSBQYWdpbmEgb2ZmZXJ0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9saWJyYXJ5TG9hZGVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIShfc2F0ZWxsaXRlLmNvb2tpZS5nZXQoJ2V4dCcpIHx8IG51bGwgIT0gX3NhdGVsbGl0ZS5jb29raWUuZ2V0KCdleHQnKSB8fCAhbG9jYXRpb24uaHJlZi5tYXRjaCgvc2t5XC5pdFwvb2ZmZXJ0ZS8pIHx8IGxvY2F0aW9uLmhyZWYubWF0Y2goL3NreVwuaXRcL29mZmVydGVcP3Zlcj1iLykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtdGFyZ2V0LXYyL2xpYi9sb2FkVGFyZ2V0LmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLXRhcmdldC12Mi9saWIvYWRkUGFnZUxvYWRQYXJhbXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Byb3NwZWN0LW9mZmVydGUnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICd0cnVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGVja2VkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtdGFyZ2V0LXYyL2xpYi9maXJlUGFnZUxvYWQuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHlIaWRkZW5TdHlsZTogJ2JvZHkge29wYWNpdHk6IDB9JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keUhpZGluZ0VuYWJsZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxhYzJmMmJkMzY0NmI0N2U3ODU3Mzg4ODliMmY1ODRlMScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTUgW0VSXSBbQ0xJQ0sgQ09SUE9SQVRFXSBTa3lRIC0gQm94IDRrIGhkcicsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnI2RhLXF1YWxpdGEtaGRyLmRhQWNjb3JkaW9uSXRlbS5jbG9zZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1NQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZG9jdW1lbnQubG9jYXRpb24uaHJlZi5tYXRjaCgvdHZcL3NreXEvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdlVmFyMjQsZVZhcjU1LHByb3A1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LmVWYXIyNCA9ICdxdWFsaXTDoCA0ayBoZHInLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdjbGlja19jb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmNDVjNWMxNjJmN2U0MTdmYTgxMWViM2U1YWVkMTZiZScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW1BMXSBTaXRpIG1pbm9yaSBUcmFmZmljbycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9saWJyYXJ5TG9hZGVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0b3JlLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2t5Z28uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdza3lnby10ZXN0LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYnVzaW5lc3Muc2t5dHYuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnByb3AyOSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJykgOiAnJywgdC5wcm9wNTAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpIDogJycsIHQucHJvcDU0ID0gbG9jYXRpb24uaHJlZiwgdC5wcm9wNTUgPSBsb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDY3ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIENvb2tpZSBMb2dpbiBTdGF0dXMnKSwgdC5wYWdlTmFtZSA9IGxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgJycgIT09IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIENtcCcpICYmICh0LmNhbXBhaWduID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgQ21wJykpLCB0LnBhZ2VOYW1lICYmICh0LmVWYXIxID0gJ0Q9cGFnZU5hbWUnKSwgJycgIT09IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIEludGNtcCcpID8gdC5lVmFyMTAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBJbnRjbXAnKSA6IHQuZVZhcjEwID0gJycsIHQucHJvcDUwICYmICh0LmVWYXI1MCA9ICdEPWM1MCcpLCB0LnByb3A1NCAmJiAodC5lVmFyNTQgPSAnRD1jNTQnKSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1JyksIHQucHJvcDY3ICYmICh0LmVWYXI2NyA9ICdEPWM2NycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGIzZWIwY2EwMmIwMDQ4ZTI5OTA1ZTZkNmZiYzQ5ZjI5JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbRFJdIFNwZWVkIFRlc3QgQW9sIENyb3NzcGFnZSAtIGVzaXRvIHBvc2l0aXZvJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdmaWJyYXRlc3RfcG9zaXRpdm8nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2QuYWJib25hbWVudG8tby5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNlcnZlciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBTZXJ2ZXInKSwgdC5jaGFubmVsID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpIDogJycsIHQucGFnZU5hbWUgPSAnc2t5OmFjcXVpc3RhOmNyb3NzcGFnZTplc2l0by1wb3NpdGl2bycsIHQucHJvcDIgPSB0LmdldFByZXZpb3VzVmFsdWUodC5wYWdlTmFtZSwgJ2dwdl9wbicpLCB0LnByb3A1ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFF1YXJ0byBMaXZlbGxvJykgOiAnJywgdC5wcm9wMjkgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpIDogJycsIHQucHJvcDUwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA6ICcnLCB0LnByb3A1NCA9IGxvY2F0aW9uLmhyZWYsIHQucHJvcDU1ID0gbG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1OSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjcgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gQ29va2llIExvZ2luIFN0YXR1cycpLCB0LnBhZ2VOYW1lICYmICh0LmVWYXIxID0gJ0Q9cGFnZU5hbWUnKSwgdC5wcm9wMiAmJiAodC5lVmFyMiA9ICdEPWMyJyksIHQucHJvcDUgJiYgKHQuZVZhcjUgPSAnRD1jNScpLCB0LnByb3A1NCAmJiAodC5lVmFyNTQgPSAnRD1jNTQnKSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1JyksIHQucHJvcDU5ICYmICh0LmVWYXI1OSA9ICdEPWM1OScpLCB0LnByb3A2MCAmJiAodC5lVmFyNjAgPSAnRD1jNjAnKSwgdC5wcm9wNjcgJiYgKHQuZVZhcjY3ID0gJ0Q9YzY3Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZTBjMGJkOTkwMjAwNDQ4ZWI4ZTEwMmFhYjE0NmI5YjcnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtQTF0gW1RBRyBURVJaSV0gRkFDRUJPT0sgQVVESUVOQ0UgKExpYnJlcmlhIGUgcGFyYW1ldHJpKScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9saWJyYXJ5TG9hZGVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF9iMWM1MjM2MGVmODE4YjYxID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ2xvY2FsU3RvcmFnZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9iMWM1MjM2MGVmODE4YjYxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX21vY2tfY2E5MTgwNDNjNzQ1MTE3ZS5sb2NhbFN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RydWUnID09PSBsb2NhbFN0b3JhZ2UuZ2V0SXRlbSgnY21wQ29uc2VudEZhY2Vib29rJykgJiYgIWxvY2F0aW9uLmhyZWYubWF0Y2goL2ZpbGU6XC9cL1wvQ1w6XC8vKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2IxYzUyMzYwZWY4MThiNjEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkX2IxYzUyMzYwZWY4MThiNjEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICchZnVuY3Rpb24oZixiLGUsdixuLHQscylcbntpZihmLmZicSlyZXR1cm47bj1mLmZicT1mdW5jdGlvbigpe24uY2FsbE1ldGhvZD9cbm4uY2FsbE1ldGhvZC5hcHBseShuLGFyZ3VtZW50cyk6bi5xdWV1ZS5wdXNoKGFyZ3VtZW50cyl9O1xuaWYoIWYuX2ZicSlmLl9mYnE9bjtuLnB1c2g9bjtuLmxvYWRlZD0hMDtuLnZlcnNpb249XCcyLjBcJztcbm4ucXVldWU9W107dD1iLmNyZWF0ZUVsZW1lbnQoZSk7dC5hc3luYz0hMDtcbnQuc3JjPXY7cz1iLmdldEVsZW1lbnRzQnlUYWdOYW1lKGUpWzBdO1xucy5wYXJlbnROb2RlLmluc2VydEJlZm9yZSh0LHMpfSh3aW5kb3csIGRvY3VtZW50LFwnc2NyaXB0XCcsXG5cJ2h0dHBzOi8vY29ubmVjdC5mYWNlYm9vay5uZXQvZW5fVVMvZmJldmVudHMuanNcJyk7XG5mYnEoXCdpbml0XCcsIFwnNjUxODE4NDY0OTg5ODI2XCcpO1xuZmJxKFwndHJhY2tcJywgXCdQYWdlVmlld1wnKTtcbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMzU4ZmQ1MDA5ZjIwNGQ1MTk2ZGQ3OGM0NDc0OWM1MGYnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gU3BlZWQgVGVzdCBBb2wgQ3Jvc3NwYWdlIC0gZXNpdG8gaW4gcGFydGUgcG9zaXRpdm8nLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2ZpYnJhdGVzdF9pbnBhcnRlcG9zaXRpdm8nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxhbS5hYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2QuYWJib25hbWVudG8tby5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNlcnZlciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBTZXJ2ZXInKSwgdC5jaGFubmVsID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpIDogJycsIHQucGFnZU5hbWUgPSAnc2t5OmFjcXVpc3RhOmNyb3NzcGFnZTplc2l0by1pbnBhcnRlcG9zaXRpdm8nLCB0LnByb3AyID0gdC5nZXRQcmV2aW91c1ZhbHVlKHQucGFnZU5hbWUsICdncHZfcG4nKSwgdC5wcm9wNSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFF1YXJ0byBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBRdWFydG8gTGl2ZWxsbycpIDogJycsIHQucHJvcDI5ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA6ICcnLCB0LnByb3A1MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgOiAnJywgdC5wcm9wNTQgPSBsb2NhdGlvbi5ocmVmLCB0LnByb3A1NSA9IGxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTkgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBTZWNvbmRvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbycpIDogJycsIHQucHJvcDYwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gVGVyem8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gVGVyem8gTGl2ZWxsbycpIDogJycsIHQucHJvcDY3ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIENvb2tpZSBMb2dpbiBTdGF0dXMnKSwgdC5wYWdlTmFtZSAmJiAodC5lVmFyMSA9ICdEPXBhZ2VOYW1lJyksIHQucHJvcDIgJiYgKHQuZVZhcjIgPSAnRD1jMicpLCB0LnByb3A1ICYmICh0LmVWYXI1ID0gJ0Q9YzUnKSwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpLCB0LnByb3A1OSAmJiAodC5lVmFyNTkgPSAnRD1jNTknKSwgdC5wcm9wNjAgJiYgKHQuZVZhcjYwID0gJ0Q9YzYwJyksIHQucHJvcDY3ICYmICh0LmVWYXI2NyA9ICdEPWM2NycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGIwZDdkMTU2NzU0NzRkOGViMjg0NTNkNGY4MjZlNjIxJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1tEUl0gW0FPTF0gYW9scmVuZXdwb3B1cF9wYWdlICgrIFRBUkdFVCknLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2FvbHJlbmV3cG9wdXBfcGFnZScgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbHByai5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGFtLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xscHJqLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJlcHJvZC5hYmJvbmFtZW50by1vLnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbygnQURPQkUgYW9scmVud2Vwb3B1cCcpLCB0LmV2ZW50cyA9IHQucHJvZHVjdHMgPSAnJywgdC5wcm9wMzQgPSBfc2F0ZWxsaXRlLmdldFZhcignYW9scmVuZXdfcHJvbW9jb2RlJyksIHQucHJvcDM3ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X29mZmVydHlwZScpLCB0LnByb3A1OSA9ICdhb2wnLCB0LnByb3A2MiA9ICcnLCB0LnBhZ2VOYW1lID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2FvbHJlbmV3X3BhZ2VuYW1lJyksICdza3k6YWNxdWlzdGE6Y29uZmlndXJhIG9mZmVydGEnID09IF9zYXRlbGxpdGUuZ2V0VmFyKCdhb2xyZW5ld19wYWdlbmFtZScpICYmICh3aW5kb3cucGFnZW5hbWVCYXNlQW9sUmVuZXcgPSAnc2t5OmFjcXVpc3RhOmNvbmZpZ3VyYSBvZmZlcnRhJyksIHQucGFnZU5hbWUgJiYgKHQuZVZhcjEgPSAnRD1wYWdlTmFtZScpLCB0LnByb3AzNCAmJiAodC5lVmFyMzQgPSAnRD1jMzQnKSwgdC5wcm9wMzcgJiYgKHQuZVZhcjM3ID0gJ0Q9YzM3JyksIHQucHJvcDU5ICYmICh0LmVWYXI1OSA9ICdEPWM1OScpLCB0LmVWYXI5OCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogeyBjaGFubmVsOiAnQWNxdWlzdGEnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vMjczMzFjMTY2OTJjLzMzYTg2MmE3MDU0YS8xNWExZTY0ZWVlYmUvUkMwOWI5MjUzNzQzMTQ0NmQzYjkyNTllYmVlZTMzNWFhNy1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdodG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDJlNmIzNGVlZTQ3YzQ1MjI5ZTdmYjZlZTVhNzA2OWY2JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbRFJdIFNwZWVkIFRlc3QgLSBlc2l0byBwb3NpdGl2bycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnZmlicmF0ZXN0X3Bvc2l0aXZvJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjYWVtLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy53d3cuc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHRyYWNrZXJQcm9wZXJ0aWVzOiB7IHBhZ2VOYW1lOiAnc2t5OmFzc2lzdGVuemE6c2t5dmlhZmlicmF0ZXN0OmVzaXRvLXBvc2l0aXZvJyB9IH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMmYxMTNhYzYzZDJhNDYyNDljYmEwNTIwMThiNGFjNmEnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzU1IFtFUl0gW0NMSUNLIENPUlBPUkFURV0gSW5kZXggVHYgLSBCb3ggTGluayBVdGlsaSBQYXJjbyAnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJy5ib3hsaW5rLklzUGFyY28gYS5ib3gtbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDU1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc2t5OmhvbWUnID09IHMucGFnZU5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLnd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXByb2Qtd3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd3d3LnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxpbmtUcmFja1ZhcnMgPSAnZVZhcjI0LHByb3A1NSxlVmFyNTUsZXZlbnRzJywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JywgdC5lVmFyMjQgPSAnaG9tZV9saW5rdXRpbGlfcGFyY29fZmFpZGF0ZScsIHQucHJvcDU1ID0gd2luZG93LmxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2NsaWNrX2NvcnBvcmF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDY2NGZmMDI4OWVlYzRmYTQ5NGY5ODZhODA2MjFjNmNmJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1NSBbRVJdIFtDTElDSyBDT1JQT1JBVEVdIE5ldGZsaXggYWNjb3VudCAtIEN0YSBhdHRpdmEgc3ViaXRvJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICdidXR0b24uYmFzaWNUcmFuc2l0aW9uI2FjdGl2YXRlQnV0dG9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL2l0XC9uZXRmbGl4LWFjY291bnQvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdlVmFyMjQscHJvcDU1LGVWYXI1NSxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTYnLCB0LmVWYXIyNCA9ICdhdHRpdmFuZXRmbGl4X2N0YV9hdHRpdmFzdWJpdG9fdmFpLWFsLWZhaWRhdGUnLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdjbGlja19jb3Jwb3JhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw1MWZlZTY4ZGNhYTE0OTdiOTlmNWFlNTUyMGUwYTZiYScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBMYW5kaW5nIERpc2RldHRhIFRZUCAoKyBBREZPUk0pJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdkaXNkZXR0YV90eXAnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhbG9jYXRpb24ucGF0aG5hbWUubWF0Y2goL1xhc3Npc3RlbnphXC9pbmZvLWRpc2RldHRhXC9za3kvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrVmFycyA9ICdwcm9wNTQsZVZhcjU0LHByb3A1NSxlVmFyNTUnLCB0LnByb3A1NCA9IGxvY2F0aW9uLmhyZWYsIHQucHJvcDU1ID0gbG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NCAmJiAodC5lVmFyNTQgPSAnRD1jNTQnKSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7IGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MzInIH1dIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdkaXNkZXR0YV90eXAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzI3MzMxYzE2NjkyYy8zM2E4NjJhNzA1NGEvMTVhMWU2NGVlZWJlL1JDYWMxNmFlZTNkY2NjNDQ2ZGE2ZGE0Y2YzMjYzYTU1OTYtc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXh0ZXJuYWw6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxiNjE5MTBhMjc5YTE0MWY5ODY1N2IzM2ZhZTJlZjlkNicsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTUgW0VSXSBbQ0xJQ0sgQ09SUE9SQVRFXSBOZXRmbGl4IGVycm9yZSAtIEN0YSByaXByb3ZhJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcjc3RlcEZhaWxSZWNvdmVyUHdkID4gZGl2ID4gYnV0dG9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRvY3VtZW50LmxvY2F0aW9uLmhyZWYubWF0Y2goL2l0XC8ocGFnaW5hLWVycm9yZS1uZXRmbGl4fHBhZ2luYV9lcnJvcmVfZ2VuZXJpY29uZXRmbGl4KS4qLyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxpbmtUcmFja1ZhcnMgPSAnZVZhcjI0LHByb3A1NSxlVmFyNTUsZXZlbnRzJywgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDE2JywgdC5lVmFyMjQgPSAncmlwcm92YS1hdHRpdmF6aW9uZS1uZXRmbGl4JywgdC5wcm9wNTUgPSB3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnY2xpY2tfY29ycG9yYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYTE2MmZjOTQ3YTllNDY3YWI4MWYyZjg1MjY3OGIxYTEnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gVHJhY2tpbmcgRXNpdG8gQ29wZXJ0dXJhJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICd0cmFja19lc2l0b2NvcGVydHVyYScgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnBhZ2VOYW1lID0gJycsIHQuZXZlbnRzID0gJycsIHQubGlua1RyYWNrVmFycyA9ICdldmVudHMsZVZhcjI0LHByb3A1NCxlVmFyNTQscHJvcDU1LGVWYXI1NScsIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQxNycsIHQuZVZhcjI0ID0gZS5kZXRhaWwubGFiZWwsIHQucHJvcDU0ID0gd2luZG93LmxvY2F0aW9uLmhyZWYsIHQucHJvcDU0ICYmICh0LmVWYXI1NCA9ICdEPWM1NCcpLCB0LnByb3A1NSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICd0cmFja2luZ2VzaXRvY29wZXJ0dXJhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMOTYxY2ZiOTQ2ODk3NDNhMjllZGRhNzE2ZDZiYmFmYTcnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gV29ya2Fyb3VuZCBRTUkgY2FydCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAndHJhY2tfbnBwcW1pJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbygnYWRvYmUgd29ya2Fyb3VuZCBxbWkgY2FydCcpLCB0LnNlcnZlciA9IGxvY2F0aW9uLmhvc3RuYW1lLCB0LmNoYW5uZWwgPSAnY29ycG9yYXRlJywgdC5wYWdlTmFtZSA9IGUuZGV0YWlsLnBhZ2VOYW1lID8gZS5kZXRhaWwucGFnZU5hbWUgOiAnJywgdC5lVmFyMSA9IGUuZGV0YWlsLnBhZ2VOYW1lID8gZS5kZXRhaWwucGFnZU5hbWUgOiAnJywgdC5wcm9wMiA9IHQuZ2V0UHJldmlvdXNWYWx1ZSh0LnBhZ2VOYW1lLCAnZ3B2X3BuJyksIHQucHJvcDIgJiYgKHQuZVZhcjIgPSAnRD1jMicpLCAnJyAhPT0gZS5kZXRhaWwuaW50Y21wICYmICh0LmVWYXIxMCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBJbnRjbXAnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBJbnRjbXAnKSA6ICcnKSwgdC5wcm9wNTAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpIDogJycsIHQucHJvcDU0ID0gbG9jYXRpb24uaHJlZiwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ID0gbG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKSwgdC5wcm9wNTkgPSAnZmFpIGRhIHRlJywgdC5wcm9wNTkgJiYgKHQuZVZhcjU5ID0gJ0Q9YzU5JyksIHQucHJvcDYwID0gJ29mZmVydGUgcGVyIHRlJywgdC5wcm9wNjAgJiYgKHQuZVZhcjYwID0gJ0Q9YzYwJyksIHQucHJvcDY3ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIENvb2tpZSBMb2dpbiBTdGF0dXMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDEyNzJlZjJiYTRhMDRlMmI5MjQ3MmE0MjEwOGNiNWE1JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbQUxMXSBbVEFHIFRFUlpJXSBNZWRhbGxpYSBsaWJyYXJ5JywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2xpYnJhcnlMb2FkZWQuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy53d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3d3cuc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJyhmdW5jdGlvbigpIHtcbiAgICB2YXIgc19tZGwgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KFwnc2NyaXB0XCcpO1xuICAgIHNfbWRsLnR5cGUgPSBcJ3RleHQvamF2YXNjcmlwdFwnO1xuICAgIHNfbWRsLmFzeW5jID0gdHJ1ZTtcbiAgICBzX21kbC5zcmMgPSBcJ2h0dHBzOi8vcmVzb3VyY2VzLmRpZ2l0YWwtY2xvdWQubWVkYWxsaWEuZXUvd2RjZXUvMjk4MzEvb25zaXRlL2VtYmVkLmpzXCc7XG4gICAgdmFyIHhfbWRsID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoXCdzY3JpcHRcJylbMF07XG4gICAgeF9tZGwucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUoc19tZGwsIHhfbWRsKTtcbn0pKCk7JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxjMGE3NThmYjAxZmY0NGM2OWNkNmYwMTk4NWI0NDRlMicsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0FMTF0gU1AgQ01QIG9wdCBpbicsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kb21SZWFkeS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2xvYmFsOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzI3MzMxYzE2NjkyYy8zM2E4NjJhNzA1NGEvMTVhMWU2NGVlZWJlL1JDNmI0ODNiNjk0M2JmNDI0Y2I5ODc2MDZjMGQ1YzAyOWQtc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXh0ZXJuYWw6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDAwNDljNDUyMGU2ZTRkMjc4MWFiNTMwMDRmMzRmMTc0JywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJyM1MCBbQURPQkVdIFNQIENNUCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9saWJyYXJ5TG9hZGVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxjbXMud3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGVzdC5leHRyYS5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxjbXMuaG90Y2x1Yi5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NreWdvLXRlc3Quc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cm92YWhvdGVsLnNreWJ1c2luZXNzLmNsby51ZC5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJvdmFiYXIuc2t5YnVzaW5lc3MuY2xvLnVkLml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLXd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3d3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N2aWxjbXMud3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2FlbS53d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjYWVtLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXh0cmEuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdob3RjbHViLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXByb2N1cmVtZW50LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJlcHJvZC5hYmJvbmFtZW50by5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxjbXMuc2t5YWNhZGVteS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2t5YWNhZGVteS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJvdmFiYXIuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cm92YWhvdGVsLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2t5Z28uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLmVwcm9jdXJlbWVudC5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxjbXMuc2t5aXRhbGlhLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2t5aXRhbGlhLnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICcvLyBJbCBjb2RpY2UgSmF2YVNjcmlwdCBhIHNlZ3VpcmUgdmVyaWZpY2EgcHVudHVhbG1lbnRlIGxcJ2FjY2V0dGF6aW9uZSBkZWxcbi8vIGNvbnNlbnNvIFNreSBEYXRhIFNlcnZpY2UsIHNjYXRlbmFuZG8gb3Bwb3J0dW5pIGV2ZW50aSBpbiBnZXN0aW9uZSBhbFxuLy8gRGF0YWxha2UuXG5pZiAodHlwZW9mIF9fdGNmYXBpID09PSBcJ2Z1bmN0aW9uXCcpIHtcbiAgdmFyIGlkU2t5RGF0YVNlcnZpY2UgPSBcJzYxMDk4NjNiNWMxZTc4MDViZDllNjUyZlwnO1xuXG4gIC8vIEdlc3Rpb25lIHJlZ2lzdHJhemlvbmUgZnVuemlvbmUgZGkgY2FsbGJhY2sgZGVsbGEgQ01QIHBlciAiY2F0dHVyYXJlIiBsaXZlXG4gIC8vIG8gaW4gcGFnZXZpZXcgZXZlbnR1YWxpIGludGVyYXppb25pIGNvbiBsYSBnZXN0aW9uZSBkZWkgY29uc2Vuc2kuXG4gIF9fdGNmYXBpKFwnYWRkRXZlbnRMaXN0ZW5lclwnLCAyLCBmdW5jdGlvbih0Y0RhdGEpIHtcbiAgICBpZih0Y0RhdGEuZXZlbnRTdGF0dXMgPT0gXCd1c2VyYWN0aW9uY29tcGxldGVcJykge1xuICAgICAgLy8gVmVyaWZpY2EgcHVudHVhbGUgY29uc2Vuc2kgU2t5IERhdGEgU2VydmljZVxuICAgICAgX190Y2ZhcGkoXCdnZXRDdXN0b21WZW5kb3JDb25zZW50c1wnLCAyLCBmdW5jdGlvbih2ZW5kb3JDb25zZW50cykge1xuICAgICAgICB2YXIgc2t5RGF0YVNlcnZpY2VDb25zZW50ID0gZmFsc2U7XG5cbiAgICAgICAgaWYgKHZlbmRvckNvbnNlbnRzICYmIHZlbmRvckNvbnNlbnRzLmNvbnNlbnRlZFZlbmRvcnMpIHtcbiAgICAgICAgICBmb3IodmFyIGkgPSAwLCBzaXplID0gdmVuZG9yQ29uc2VudHMuY29uc2VudGVkVmVuZG9ycy5sZW5ndGg7IGkgPCBzaXplOyArK2kpIHtcbiAgICAgICAgICAgIGlmKHZlbmRvckNvbnNlbnRzLmNvbnNlbnRlZFZlbmRvcnNbaV0uX2lkID09IGlkU2t5RGF0YVNlcnZpY2UpIHtcbiAgICAgICAgICAgICAgc2t5RGF0YVNlcnZpY2VDb25zZW50ID0gXCd0cnVlXCc7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmKHNreURhdGFTZXJ2aWNlQ29uc2VudCkge1xuICAgICAgICAgIGNvbnNvbGUuaW5mbyhcJ0NNUCAtIFNreSBEYXRhIFNlcnZpY2UgYWNjZXR0YXRvXCcpO1xuXG4gICAgICAgICAgcy5saW5rVHJhY2tWYXJzID0gXCdldmVudHNcJztcbiAgICAgICAgICBzLmxpbmtUcmFja0V2ZW50cyA9IHMuZXZlbnRzID0gXCdldmVudDIwMFwnO1xuICAgICAgICAgIHMudGwodGhpcywgXCdvXCcsIFwnY2xpY2tfY21wX2FjY2V0dGFcJyk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgY29uc29sZS5pbmZvKFwnQ01QIC0gU2t5IERhdGEgU2VydmljZSBOT04gYWNjZXR0YXRvXCcpO1xuXG4gICAgICAgICAgcy5saW5rVHJhY2tWYXJzID0gXCdldmVudHNcJztcbiAgICAgICAgICBzLmxpbmtUcmFja0V2ZW50cyA9IHMuZXZlbnRzID0gXCdldmVudDE5OVwnO1xuICAgICAgICAgIHMudGwodGhpcywgXCdvXCcsIFwnY2xpY2tfY21wX3JpZml1dGFcJyk7XG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgIH1cbiAgfSk7XG59XG5lbHNlIHtcbiAgY29uc29sZS5lcnJvcigiQ01QIEFQSSBub3QgYXZhaWxhYmxlIik7XG59JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmMmNiMDc5YjJjNWU0YTgyYWVjMjhmM2IzZjM2ZDYyNicsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0FET0JFXSBTUCBDTVAgcGVyIFNQQScsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kb21SZWFkeS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLmFiYm9uYW1lbnRvLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsYW0uYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsYW0uYWJib25hbWVudG8tby5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxwcmouYWJib25hbWVudG8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xscHJqLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwcm9kLmFiYm9uYW1lbnRvLW8uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhYmJvbmFtZW50by1vLnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2t5bG9jYXRvci5ub2h1cC5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJvdmEuc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS8yNzMzMWMxNjY5MmMvMzNhODYyYTcwNTRhLzE1YTFlNjRlZWViZS9SQzk4ZDkxN2EyMzljNDQxODk5OWYzNDFkYTY2OWNlNGZkLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw0YzA5NGRkM2QzNDg0MDc3OTUwYTdmNmJlMDE3ZTViNScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBQYWdlIFNwZWVkIFRlc3QgU2t5Lml0LSBlc2l0byBwb3NpdGl2bycsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAncGFnZS1zcGVlZC10ZXN0X3Bvc2l0aXZvJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdmlsY21zLnd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NhZW0ud3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sbGNtcy53d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3d3cuc2t5Lml0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5pbmZvKCdwYWdlLXNwZWVkLXRlc3RfcG9zaXRpdm8nKSwgdC5zZXJ2ZXIgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gU2VydmVyJyksIHQuY2hhbm5lbCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIENoYW5uZWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIENoYW5uZWwnKSA6ICcnLCB0LnBhZ2VOYW1lID0gJ3NreTpzcGVlZC10ZXN0OmVzaXRvLXBvc2l0aXZvJywgdC5wcm9wMiA9IHQuZ2V0UHJldmlvdXNWYWx1ZSh0LnBhZ2VOYW1lLCAnZ3B2X3BuJyksIHQucHJvcDUgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBRdWFydG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA6ICcnLCB0LnByb3AyOSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJykgOiAnJywgdC5wcm9wNTAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpIDogJycsIHQucHJvcDU0ID0gbG9jYXRpb24uaHJlZiwgdC5wcm9wNTUgPSBsb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU5ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBTZWNvbmRvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A2MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A2NyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBDb29raWUgTG9naW4gU3RhdHVzJyksIHQucGFnZU5hbWUgJiYgKHQuZVZhcjEgPSAnRD1wYWdlTmFtZScpLCB0LnByb3AyICYmICh0LmVWYXIyID0gJ0Q9YzInKSwgdC5wcm9wNSAmJiAodC5lVmFyNSA9ICdEPWM1JyksIHQucHJvcDU0ICYmICh0LmVWYXI1NCA9ICdEPWM1NCcpLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKSwgdC5wcm9wNTkgJiYgKHQuZVZhcjU5ID0gJ0Q9YzU5JyksIHQucHJvcDYwICYmICh0LmVWYXI2MCA9ICdEPWM2MCcpLCB0LnByb3A2NyAmJiAodC5lVmFyNjcgPSAnRD1jNjcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw5YzhmOTllNGM0MzE0NzEwOTI2ZmRhNWU2Y2ExYTQzZScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBQYWdlIFNwZWVkIFRlc3QgU2t5Lml0LSBlc2l0byBpbiBwYXJ0ZSBwb3NpdGl2byAnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3BhZ2Utc3BlZWQtdGVzdF9pbnBhcnRlcG9zaXRpdm8nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N2aWxjbXMud3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2FlbS53d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLnd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3d3dy5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmluZm8oJ3BhZ2Utc3BlZWQtdGVzdF9pbnBhcnRlcG9zaXRpdm8nKSwgdC5zZXJ2ZXIgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gU2VydmVyJyksIHQuY2hhbm5lbCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIENoYW5uZWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIENoYW5uZWwnKSA6ICcnLCB0LnBhZ2VOYW1lID0gJ3NreTpzcGVlZC10ZXN0OmVzaXRvLWlucGFydGVwb3NpdGl2bycsIHQucHJvcDIgPSB0LmdldFByZXZpb3VzVmFsdWUodC5wYWdlTmFtZSwgJ2dwdl9wbicpLCB0LnByb3A1ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFF1YXJ0byBMaXZlbGxvJykgOiAnJywgdC5wcm9wMjkgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpIDogJycsIHQucHJvcDUwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA6ICcnLCB0LnByb3A1NCA9IGxvY2F0aW9uLmhyZWYsIHQucHJvcDU1ID0gbG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1OSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjcgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gQ29va2llIExvZ2luIFN0YXR1cycpLCB0LnBhZ2VOYW1lICYmICh0LmVWYXIxID0gJ0Q9cGFnZU5hbWUnKSwgdC5wcm9wMiAmJiAodC5lVmFyMiA9ICdEPWMyJyksIHQucHJvcDUgJiYgKHQuZVZhcjUgPSAnRD1jNScpLCB0LnByb3A1NCAmJiAodC5lVmFyNTQgPSAnRD1jNTQnKSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1JyksIHQucHJvcDU5ICYmICh0LmVWYXI1OSA9ICdEPWM1OScpLCB0LnByb3A2MCAmJiAodC5lVmFyNjAgPSAnRD1jNjAnKSwgdC5wcm9wNjcgJiYgKHQuZVZhcjY3ID0gJ0Q9YzY3Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZjJjZTk3NDkzNWYyNGJkOGE5ZDgwNGRkYzM1ZjU1M2UnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gUGFnZSBTcGVlZCBUZXN0IFNreS5pdC0gZXNpdG8gbmVnYXRpdm8nLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3BhZ2Utc3BlZWQtdGVzdF9uZWdhdGl2bycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3ZpbGNtcy53d3cuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjYWVtLnd3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxjbXMud3d3LnNreS5pdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbygncGFnZS1zcGVlZC10ZXN0X25lZ2F0aXZvJyksIHQuc2VydmVyID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFNlcnZlcicpLCB0LmNoYW5uZWwgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBDaGFubmVsJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBDaGFubmVsJykgOiAnJywgdC5wYWdlTmFtZSA9ICdza3k6c3BlZWQtdGVzdDplc2l0by1uZWdhdGl2bycsIHQucHJvcDIgPSB0LmdldFByZXZpb3VzVmFsdWUodC5wYWdlTmFtZSwgJ2dwdl9wbicpLCB0LnByb3A1ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFF1YXJ0byBMaXZlbGxvJykgOiAnJywgdC5wcm9wMjkgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpIDogJycsIHQucHJvcDUwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA6ICcnLCB0LnByb3A1NCA9IGxvY2F0aW9uLmhyZWYsIHQucHJvcDU1ID0gbG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1OSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjcgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gQ29va2llIExvZ2luIFN0YXR1cycpLCB0LnBhZ2VOYW1lICYmICh0LmVWYXIxID0gJ0Q9cGFnZU5hbWUnKSwgdC5wcm9wMiAmJiAodC5lVmFyMiA9ICdEPWMyJyksIHQucHJvcDUgJiYgKHQuZVZhcjUgPSAnRD1jNScpLCB0LnByb3A1NCAmJiAodC5lVmFyNTQgPSAnRD1jNTQnKSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1JyksIHQucHJvcDU5ICYmICh0LmVWYXI1OSA9ICdEPWM1OScpLCB0LnByb3A2MCAmJiAodC5lVmFyNjAgPSAnRD1jNjAnKSwgdC5wcm9wNjcgJiYgKHQuZVZhcjY3ID0gJ0Q9YzY3Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNmFjMmQxZDAzODI3NDg0NDk0NjUwOWE3NTVkYTFmZWQnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnW0RSXSBTY2VnbGkgU2t5IC0gR2xhc3MgVFlQJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdzY2VnbGlfc2t5Z2xhc3NfdHlwJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzY2VnbGkuc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0ZXN0LnNjZWdsaS5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNlcnZlciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBTZXJ2ZXInKSwgdC5jaGFubmVsID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpIDogJycsIHQucGFnZU5hbWUgPSAnc2t5OnNjZWdsaTpza3lnbGFzczp0eXAnLCB0LnByb3AyID0gdC5nZXRQcmV2aW91c1ZhbHVlKHQucGFnZU5hbWUsICdncHZfcG4nKSwgdC5wcm9wNSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFF1YXJ0byBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBRdWFydG8gTGl2ZWxsbycpIDogJycsIHQucHJvcDI5ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA6ICcnLCB0LnByb3A1MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgOiAnJywgdC5wcm9wNTQgPSBsb2NhdGlvbi5ocmVmLCB0LnByb3A1NSA9IGxvY2F0aW9uLmhyZWYuc3BsaXQoL1s/I10vKVswXSwgdC5wcm9wNTkgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBTZWNvbmRvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbycpIDogJycsIHQucHJvcDYwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gVGVyem8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gVGVyem8gTGl2ZWxsbycpIDogJycsIHQucHJvcDY3ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIENvb2tpZSBMb2dpbiBTdGF0dXMnKSwgdC5wYWdlTmFtZSAmJiAodC5lVmFyMSA9ICdEPXBhZ2VOYW1lJyksIHQucHJvcDIgJiYgKHQuZVZhcjIgPSAnRD1jMicpLCB0LnByb3A1ICYmICh0LmVWYXI1ID0gJ0Q9YzUnKSwgdC5wcm9wNTQgJiYgKHQuZVZhcjU0ID0gJ0Q9YzU0JyksIHQucHJvcDU1ICYmICh0LmVWYXI1NSA9ICdEPWM1NScpLCB0LnByb3A1OSAmJiAodC5lVmFyNTkgPSAnRD1jNTknKSwgdC5wcm9wNjAgJiYgKHQuZVZhcjYwID0gJ0Q9YzYwJyksIHQucHJvcDY3ICYmICh0LmVWYXI2NyA9ICdEPWM2NycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDE3Y2Q1Mzg5MzYyMjQxZmQ4Y2FkNWM1ZDNmMGVjOTVhJywKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1tBT0xdIFRBUkdFVCBPUkRJTkUgQ0FNUEknLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvbGlicmFyeUxvYWRlZC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9wYXRoLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJy9uZXdhb2wvYWJib25hdGlvbmxpbmV8L2FvbC9hYmJvbmF0aW9ubGluZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnPGRpdiBjbGFzcz0iYWJfb3JkaW5lLWNhbXBpIj48L2Rpdj5cblxuPHNjcmlwdD4gXG4gIGFkb2JlLnRhcmdldC5nZXRPZmZlcih7XG4gICAgbWJveDogIm1ib3gtb3JkaW5lLWNhbXBpIixcbiAgICBzdWNjZXNzOiBmdW5jdGlvbihvZmZlcikge1xuICAgICAgYWRvYmUudGFyZ2V0LmFwcGx5T2ZmZXIoe1xuICAgICAgICBtYm94OiAibWJveC1vcmRpbmUtY2FtcGkiLFxuICAgICAgICBzZWxlY3RvcjogIi5hYl9vcmRpbmUtY2FtcGkiLFxuICAgICAgICBvZmZlcjogb2ZmZXJcbiAgICAgIH0pO1xuICAgIH0sXG4gICAgZXJyb3I6IGZ1bmN0aW9uKGVycm9yKSB7XG4gICAgICBjb25zb2xlLmVycm9yKGVycm9yKTtcbiAgICAgIHZhciBlbCA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoImFiX29yZGluZS1jYW1waSIpO1xuICAgICAgZWwuc3R5bGUudmlzaWJpbGl0eSA9ICJ2aXNpYmxlIjtcbiAgICB9XG4gIH0pO1xuPC9zY3JpcHQ+JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdodG1sJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkw2MjJlYWQwNGUzYzE0YTJkYjBjYTZiOWZlOTBmNDExZScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdbUExdIFNLWUlUIExvZ2luIC0gRHluYXRyYWNlJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2xpYnJhcnlMb2FkZWQuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkX2Q3ODRjYWU5YmRhNTI1MzUgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2Q3ODRjYWU5YmRhNTI1MzUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja19jYTkxODA0M2M3NDUxMTdlLmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCd0cnVlJyAhPT0gbG9jYWxTdG9yYWdlLmdldEl0ZW0oJ2NtcENvbnNlbnREeW5hdHJhY2UnKSB8fCAhbG9jYXRpb24uaHJlZi5tYXRjaCgvc2t5Lml0XC9sb2dpbih8LiopJC8pIHx8IGxvY2F0aW9uLmhyZWYubWF0Y2goL2NvbGxjbXMud3d3LnNreS5pdFwvbG9naW4ofC4qKSQvKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9kNzg0Y2FlOWJkYTUyNTM1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX29sZF9kNzg0Y2FlOWJkYTUyNTM1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiIHNyYz0iaHR0cHM6Ly9qcy1jZG4uZHluYXRyYWNlLmNvbS9qc3RhZy8xNDg3MDlmZGM0Yi9iZjk2MjM0aWdtLzk3NDdiZjhhZGYzYTM4NWFfY29tcGxldGUuanMiIGNyb3Nzb3JpZ2luPSJhbm9ueW1vdXMiPjwvc2NyaXB0PicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMmUyMGU3MTk4M2U2NDhlZjk4N2RkYWEzOTcyYTRkZDMnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gU3BlZWQgVGVzdCBDb25maWd1cmF0b3JlIDNQIC0gZXNpdG8gcG9zaXRpdm8gJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdjb25maWd1cmF0b3JlLXNwZWVkLTNwLXRlc3RfcG9zaXRpdm8nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3d3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NhZW0uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLnd3dy5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNlcnZlciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBTZXJ2ZXInKSwgdC5jaGFubmVsID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpIDogJycsIHQucGFnZU5hbWUgPSBfc2F0ZWxsaXRlLmdldFZhcigndHJhY2tfdHJhY2tpbmdwdmNvbmZpZ3VyYXRvcmVfc3RlcCcpICsgJzplc2l0by1zcGVlZC0zcC10ZXN0LXBvc2l0aXZvJywgY29uc29sZS5pbmZvKCczcCcgKyBfc2F0ZWxsaXRlLmdldFZhcigndHJhY2tfdHJhY2tpbmdwdmNvbmZpZ3VyYXRvcmVfc3RlcCcpKSwgdC5wcm9wMiA9IHQuZ2V0UHJldmlvdXNWYWx1ZSh0LnBhZ2VOYW1lLCAnZ3B2X3BuJyksIHQucHJvcDUgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBRdWFydG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA6ICcnLCB0LnByb3AyOSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJykgOiAnJywgdC5wcm9wNTAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpIDogJycsIHQucHJvcDU0ID0gbG9jYXRpb24uaHJlZiwgdC5wcm9wNTUgPSBsb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU5ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBTZWNvbmRvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A2MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A2NyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBDb29raWUgTG9naW4gU3RhdHVzJyksIHQucGFnZU5hbWUgJiYgKHQuZVZhcjEgPSAnRD1wYWdlTmFtZScpLCB0LnByb3AyICYmICh0LmVWYXIyID0gJ0Q9YzInKSwgdC5wcm9wNSAmJiAodC5lVmFyNSA9ICdEPWM1JyksIHQucHJvcDU0ICYmICh0LmVWYXI1NCA9ICdEPWM1NCcpLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKSwgdC5wcm9wNTkgJiYgKHQuZVZhcjU5ID0gJ0Q9YzU5JyksIHQucHJvcDYwICYmICh0LmVWYXI2MCA9ICdEPWM2MCcpLCB0LnByb3A2NyAmJiAodC5lVmFyNjcgPSAnRD1jNjcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnUkwyYjRhMmMwOWQ4MmY0NTBiYmRhMjYyYTY3ZTdhY2YzZScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICcjNTAgW0RSXSBTcGVlZCBUZXN0IENvbmZpZ3VyYXRvcmUgM1AgLSBlc2l0byBpbiBwYXJ0ZSBwb3NpdGl2byAnLAogICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2NvbmZpZ3VyYXRvcmUtc3BlZWQtM3AtdGVzdF9pbnBhcnRlcG9zaXRpdm8nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3d3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NhZW0uc2t5Lml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb2xsY21zLnd3dy5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNlcnZlciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBTZXJ2ZXInKSwgdC5jaGFubmVsID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpIDogJycsIHQucGFnZU5hbWUgPSBfc2F0ZWxsaXRlLmdldFZhcigndHJhY2tfdHJhY2tpbmdwdmNvbmZpZ3VyYXRvcmVfc3RlcCcpICsgJzplc2l0by1zcGVlZC0zcC10ZXN0LWlucGFydGVwb3NpdGl2bycsIHQucHJvcDIgPSB0LmdldFByZXZpb3VzVmFsdWUodC5wYWdlTmFtZSwgJ2dwdl9wbicpLCB0LnByb3A1ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFF1YXJ0byBMaXZlbGxvJykgOiAnJywgdC5wcm9wMjkgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gUXVlcnkgU3RyaW5nIFBhcmFtZXRlciBTb2NpYWwnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpIDogJycsIHQucHJvcDUwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIEV4dGVybmFsIElkJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA6ICcnLCB0LnByb3A1NCA9IGxvY2F0aW9uLmhyZWYsIHQucHJvcDU1ID0gbG9jYXRpb24uaHJlZi5zcGxpdCgvWz8jXS8pWzBdLCB0LnByb3A1OSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFNlY29uZG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBUZXJ6byBMaXZlbGxvJykgOiAnJywgdC5wcm9wNjcgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gQ29va2llIExvZ2luIFN0YXR1cycpLCB0LnBhZ2VOYW1lICYmICh0LmVWYXIxID0gJ0Q9cGFnZU5hbWUnKSwgdC5wcm9wMiAmJiAodC5lVmFyMiA9ICdEPWMyJyksIHQucHJvcDUgJiYgKHQuZVZhcjUgPSAnRD1jNScpLCB0LnByb3A1NCAmJiAodC5lVmFyNTQgPSAnRD1jNTQnKSwgdC5wcm9wNTUgJiYgKHQuZVZhcjU1ID0gJ0Q9YzU1JyksIHQucHJvcDU5ICYmICh0LmVWYXI1OSA9ICdEPWM1OScpLCB0LnByb3A2MCAmJiAodC5lVmFyNjAgPSAnRD1jNjAnKSwgdC5wcm9wNjcgJiYgKHQuZVZhcjY3ID0gJ0Q9YzY3Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNjY1MGNlMDI1M2RiNGFjY2JhZjUwODk2MmVlMTkwNjQnLAogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnIzUwIFtEUl0gU3BlZWQgVGVzdCBDb25maWd1cmF0b3JlIDNQIC0gZXNpdG8gbmVnYXRpdm8gJywKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdjb25maWd1cmF0b3JlLXNwZWVkLTNwLXRlc3RfbmVnYXRpdm8nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3d3dy5za3kuaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGxjbXMud3d3LnNreS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2FlbS5za3kuaXQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNlcnZlciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBTZXJ2ZXInKSwgdC5jaGFubmVsID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gQ2hhbm5lbCcpIDogJycsIHQucGFnZU5hbWUgPSBfc2F0ZWxsaXRlLmdldFZhcigndHJhY2tfdHJhY2tpbmdwdmNvbmZpZ3VyYXRvcmVfc3RlcCcpICsgJzplc2l0by1zcGVlZC0zcC10ZXN0LW5lZ2F0aXZvJywgdC5wcm9wMiA9IHQuZ2V0UHJldmlvdXNWYWx1ZSh0LnBhZ2VOYW1lLCAnZ3B2X3BuJyksIHQucHJvcDUgPSBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBRdWFydG8gTGl2ZWxsbycpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gUXVhcnRvIExpdmVsbG8nKSA6ICcnLCB0LnByb3AyOSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBRdWVyeSBTdHJpbmcgUGFyYW1ldGVyIFNvY2lhbCcpID8gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tBTExdIFF1ZXJ5IFN0cmluZyBQYXJhbWV0ZXIgU29jaWFsJykgOiAnJywgdC5wcm9wNTAgPSBfc2F0ZWxsaXRlLmdldFZhcignW0FMTF0gRXh0ZXJuYWwgSWQnKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBFeHRlcm5hbCBJZCcpIDogJycsIHQucHJvcDU0ID0gbG9jYXRpb24uaHJlZiwgdC5wcm9wNTUgPSBsb2NhdGlvbi5ocmVmLnNwbGl0KC9bPyNdLylbMF0sIHQucHJvcDU5ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ1tEaWdpdGFsRGF0YV0gU2Vjb25kbyBMaXZlbGxvJykgPyBfc2F0ZWxsaXRlLmdldFZhcignW0RpZ2l0YWxEYXRhXSBTZWNvbmRvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A2MCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA/IF9zYXRlbGxpdGUuZ2V0VmFyKCdbRGlnaXRhbERhdGFdIFRlcnpvIExpdmVsbG8nKSA6ICcnLCB0LnByb3A2NyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdbQUxMXSBDb29raWUgTG9naW4gU3RhdHVzJyksIHQucGFnZU5hbWUgJiYgKHQuZVZhcjEgPSAnRD1wYWdlTmFtZScpLCB0LnByb3AyICYmICh0LmVWYXIyID0gJ0Q9YzInKSwgdC5wcm9wNSAmJiAodC5lVmFyNSA9ICdEPWM1JyksIHQucHJvcDU0ICYmICh0LmVWYXI1NCA9ICdEPWM1NCcpLCB0LnByb3A1NSAmJiAodC5lVmFyNTUgPSAnRD1jNTUnKSwgdC5wcm9wNTkgJiYgKHQuZVZhcjU5ID0gJ0Q9YzU5JyksIHQucHJvcDYwICYmICh0LmVWYXI2MCA9ICdEPWM2MCcpLCB0LnByb3A2NyAmJiAodC5lVmFyNjcgPSAnRD1jNjcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9OwogICAgICAgIH0oKSk7CiAgICAgICAgdmFyICRfX192YXJfMjE4OTFlNjY1M2NjNmQzNiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICBmdW5jdGlvbiBlKGUpIHsKICAgICAgICAgICAgICAgIGlmIChudWxsID09IGUpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignT2JqZWN0LmFzc2lnbiBjYW5ub3QgYmUgY2FsbGVkIHdpdGggbnVsbCBvciB1bmRlZmluZWQnKTsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFPYmplY3QuYXNzaWduKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZXcgU3RyaW5nKCdhYmMnKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZVs1XSA9ICdkZScsICc1JyA9PT0gT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXMoZSlbMF0pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0ge30sIGEgPSAwOyBhIDwgMTA7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgdFsnXycgKyBTdHJpbmcuZnJvbUNoYXJDb2RlKGEpXSA9IGE7CiAgICAgICAgICAgICAgICAgICAgaWYgKCcwMTIzNDU2Nzg5JyAhPT0gT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXModCkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignJykpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiAnYWJjZGVmZ2hpamtsbW5vcHFyc3QnLnNwbGl0KCcnKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5bZV0gPSBlOwogICAgICAgICAgICAgICAgICAgIH0pLCAnYWJjZGVmZ2hpamtsbW5vcHFyc3QnID09PSBPYmplY3Qua2V5cyhPYmplY3QuYXNzaWduKHt9LCBuKSkuam9pbignJyk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgaWYgKGUuX19lc01vZHVsZSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0LmRlZmluZVByb3BlcnR5KHt9LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGUpLmZvckVhY2goZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoZSwgYSk7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsIGEsIG4uZ2V0ID8gbiA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbYV07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgdmFyIHQgPSB7IGV4cG9ydHM6IHt9IH07CiAgICAgICAgICAgICAgICByZXR1cm4gZSh0LCB0LmV4cG9ydHMpLCB0LmV4cG9ydHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMuY29uc3RydWN0b3I7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50aGVuKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucmVzb2x2ZShlKCkpLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucmVzb2x2ZShlKCkpLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5yZWplY3QoYSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBCb29sZWFuKGUgJiYgdm9pZCAwICE9PSBlLmxlbmd0aCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gbygpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBzKGUsIHQpIHsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZS5hcHBseSh0LCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgIGlmICghKHRoaXMgaW5zdGFuY2VvZiBjKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdQcm9taXNlcyBtdXN0IGJlIGNvbnN0cnVjdGVkIHZpYSBuZXcnKTsKICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nICE9IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ25vdCBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICB0aGlzLl9zdGF0ZSA9IDAsIHRoaXMuX2hhbmRsZWQgPSAhMSwgdGhpcy5fdmFsdWUgPSB2b2lkIDAsIHRoaXMuX2RlZmVycmVkcyA9IFtdLCBmKGUsIHRoaXMpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSwgdCkgewogICAgICAgICAgICAgICAgZm9yICg7IDMgPT09IGUuX3N0YXRlOykKICAgICAgICAgICAgICAgICAgICBlID0gZS5fdmFsdWU7CiAgICAgICAgICAgICAgICAwICE9PSBlLl9zdGF0ZSA/IChlLl9oYW5kbGVkID0gITAsIGMuX2ltbWVkaWF0ZUZuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IDEgPT09IGUuX3N0YXRlID8gdC5vbkZ1bGZpbGxlZCA6IHQub25SZWplY3RlZDsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gYSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBhKGUuX3ZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgZCh0LnByb21pc2UsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHUodC5wcm9taXNlLCBuKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgKDEgPT09IGUuX3N0YXRlID8gdSA6IGQpKHQucHJvbWlzZSwgZS5fdmFsdWUpOwogICAgICAgICAgICAgICAgfSkpIDogZS5fZGVmZXJyZWRzLnB1c2godCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gdShlLCB0KSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGlmICh0ID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdBIHByb21pc2UgY2Fubm90IGJlIHJlc29sdmVkIHdpdGggaXRzZWxmLicpOwogICAgICAgICAgICAgICAgICAgIGlmICh0ICYmICgnb2JqZWN0JyA9PSB0eXBlb2YgdCB8fCAnZnVuY3Rpb24nID09IHR5cGVvZiB0KSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQudGhlbjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgaW5zdGFuY2VvZiBjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuX3N0YXRlID0gMywgZS5fdmFsdWUgPSB0LCB2b2lkIHAoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09IHR5cGVvZiBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgZihzKGEsIHQpLCBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZS5fc3RhdGUgPSAxLCBlLl92YWx1ZSA9IHQsIHAoZSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgZChlLCB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBkKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuX3N0YXRlID0gMiwgZS5fdmFsdWUgPSB0LCBwKGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHAoZSkgewogICAgICAgICAgICAgICAgMiA9PT0gZS5fc3RhdGUgJiYgMCA9PT0gZS5fZGVmZXJyZWRzLmxlbmd0aCAmJiBjLl9pbW1lZGlhdGVGbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZS5faGFuZGxlZCB8fCBjLl91bmhhbmRsZWRSZWplY3Rpb25GbihlLl92YWx1ZSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAwLCBhID0gZS5fZGVmZXJyZWRzLmxlbmd0aDsgdCA8IGE7IHQrKykKICAgICAgICAgICAgICAgICAgICBsKGUsIGUuX2RlZmVycmVkc1t0XSk7CiAgICAgICAgICAgICAgICBlLl9kZWZlcnJlZHMgPSBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGgoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgdGhpcy5vbkZ1bGZpbGxlZCA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIGUgPyBlIDogbnVsbCwgdGhpcy5vblJlamVjdGVkID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCA/IHQgOiBudWxsLCB0aGlzLnByb21pc2UgPSBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSwgdCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSAhMTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBhIHx8IChhID0gITAsIHUodCwgZSkpOwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgfHwgKGEgPSAhMCwgZCh0LCBlKSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICBhID0gITAsIGQodCwgZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gZyhlKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IEdlKGUpICYmICdbb2JqZWN0IE9iamVjdF0nID09PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gbShlLCB0KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsIHQpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGIoZSkgewogICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09IHR5cGVvZiBlICYmIC0xICE9PSBlLmluZGV4T2YoJ1snKSAmJiAtMSAhPT0gZS5pbmRleE9mKCddJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gXyhlKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZS5zdWJzdHIoMCwgZS5pbmRleE9mKCdbJykpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHYoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgaWYgKGUubGVuZ3RoICYmIFdlKHQpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlWzBdOwogICAgICAgICAgICAgICAgICAgIGlmICgxICE9PSBlLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuc2xpY2UoMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYihuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2KHIsIHRbbl0sIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHRbbiA9IF8obildOwogICAgICAgICAgICAgICAgICAgICAgICBBcnJheS5pc0FycmF5KGkpICYmIGkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYociwgZSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pICYmICdzdHJpbmcnID09IHR5cGVvZiB0W25dICYmICh0W25dID0gYSh0W25dKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHdpbmRvdy5hdG9iKSB7CiAgICAgICAgICAgICAgICB2YXIgeSA9IGRvY3VtZW50LCBrID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scywgQSA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHksIFMgPSBPYmplY3QucHJvdG90eXBlLnByb3BlcnR5SXNFbnVtZXJhYmxlLCB3ID0gdCgpID8gT2JqZWN0LmFzc2lnbiA6IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEsIG4sIHIgPSBlKHQpLCBpID0gMTsgaSA8IGFyZ3VtZW50cy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbyBpbiBhID0gT2JqZWN0KGFyZ3VtZW50c1tpXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQS5jYWxsKGEsIG8pICYmIChyW29dID0gYVtvXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBrKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSAwOyBzIDwgbi5sZW5ndGg7IHMrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUy5jYWxsKGEsIG5bc10pICYmIChyW25bc11dID0gYVtuW3NdXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgfSwgRSA9IHcsIEQgPSB3aW5kb3csIEkgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciA9IEFycmF5LmlzQXJyYXkodCksIGkgPSBCb29sZWFuKHIgJiYgZSksIG8gPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdhJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvLmhyZWYgPSBlLCAoIS9eaHR0cHM/OlwvXC8uKi8udGVzdChlKSB8fCAhby5ob3N0KSAmJiByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG5ldyBFcnJvcignVW5hYmxlIHRvIGZpbmQgdGhlIExpYnJhcnkgRW1iZWQgQ29kZSBmb3IgRHluYW1pYyBIb3N0IFJlc29sdXRpb24uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBzLmNvZGUgPSAnZHluYW1pY19ob3N0X3Jlc29sdmVyX2NvbnN0cnVjdG9yX2Vycm9yJywgczsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAociAmJiAtMSA9PT0gdC5pbmRleE9mKG8uaG9zdG5hbWUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG5ldyBFcnJvcignVGhpcyBsaWJyYXJ5IGlzIG5vdCBhdXRob3JpemVkIGZvciB0aGlzIGRvbWFpbi4gUGxlYXNlIGNvbnRhY3QgeW91ciBDU00gZm9yIG1vcmUgaW5mb3JtYXRpb24uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBjLmNvZGUgPSAnZHluYW1pY19ob3N0X25vdF9hbGxvd2VkJywgYzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG8uaG9zdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLzo4MCQvLnRlc3QoZSkgPyBlID0gZS5yZXBsYWNlKCc6ODAnLCAnJykgOiAvOjgwXC8kLy50ZXN0KGUpID8gZSA9IGUucmVwbGFjZSgnOjgwLycsICcnKSA6IC86NDQzJC8udGVzdChlKSA/IGUgPSBlLnJlcGxhY2UoJzo0NDMnLCAnJykgOiAvOjQ0M1wvJC8udGVzdChlKSAmJiAoZSA9IGUucmVwbGFjZSgnOjQ0My8nLCAnJykpLCBuID0gJ2h0dHBzOi8vJyArIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpICYmICdzdHJpbmcnID09IHR5cGVvZiBlID8gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvJyA9PT0gZS5jaGFyQXQoMCkgPyBlLnNsaWNlKDEpIDogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uam9pbignLycpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VHVyYmluZUhvc3Q6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVjb3JhdGVXaXRoRHluYW1pY0hvc3Q6IHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0IGlzRHluYW1pY0VuZm9yY2VkKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRCAmJiBhLm9uRGVidWdDaGFuZ2VkKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID8gRC5keW5hbWljSG9zdFJlc29sdmVyID0gZCA6IGRlbGV0ZSBELmR5bmFtaWNIb3N0UmVzb2x2ZXI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBkOwogICAgICAgICAgICAgICAgICAgIH0sIFQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV2ZW50cyAmJiBlLmV2ZW50cy5mb3JFYWNoKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQ6IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5zb3J0KGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5ldmVudC5ydWxlT3JkZXIgLSB0LmV2ZW50LnJ1bGVPcmRlcjsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgUCA9ICdkZWJ1ZycsIEMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RydWUnID09PSBlLmdldEl0ZW0oUCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNldEl0ZW0oUCwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByID0gW10sIGkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lm91dHB1dEVuYWJsZWQgPSBhKCksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uRGVidWdDaGFuZ2VkOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RGVidWdFbmFibGVkOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0RGVidWdFbmFibGVkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoKSAhPT0gZSAmJiAobihlKSwgdC5vdXRwdXRFbmFibGVkID0gZSwgci5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIFYgPSAnTW9kdWxlIGRpZCBub3QgZXhwb3J0IGEgZnVuY3Rpb24uJywgTCA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobiwgciwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGkgfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGUuZ2V0TW9kdWxlRXhwb3J0cyhuLm1vZHVsZVBhdGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT0gdHlwZW9mIG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBlLmdldE1vZHVsZURlZmluaXRpb24obi5tb2R1bGVQYXRoKSwgYyA9IG4uc2V0dGluZ3MgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAhbi5oYXNUcmFuc2Zvcm1lZEZpbGVQYXRocyAmJiBzLmZpbGVQYXRocyAmJiAoYShjLCBzLmZpbGVQYXRocywgbi5tb2R1bGVQYXRoKSwgbi5oYXNUcmFuc2Zvcm1lZEZpbGVQYXRocyA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gdChjLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLmJpbmQobnVsbCwgbCkuYXBwbHkobnVsbCwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgTiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PSB0eXBlb2YgZSA/IGUucmVwbGFjZSgvXHMrL2csICcgJykudHJpbSgpIDogZTsKICAgICAgICAgICAgICAgICAgICB9LCBPID0gewogICAgICAgICAgICAgICAgICAgICAgICBMT0c6ICdsb2cnLAogICAgICAgICAgICAgICAgICAgICAgICBJTkZPOiAnaW5mbycsCiAgICAgICAgICAgICAgICAgICAgICAgIERFQlVHOiAnZGVidWcnLAogICAgICAgICAgICAgICAgICAgICAgICBXQVJOOiAnd2FybicsCiAgICAgICAgICAgICAgICAgICAgICAgIEVSUk9SOiAnZXJyb3InCiAgICAgICAgICAgICAgICAgICAgfSwgTSA9ICdcdUQ4M0RcdURFODAnLCBSID0gMTAgPT09IHBhcnNlSW50KCgvbXNpZSAoXGQrKS8uZXhlYyhuYXZpZ2F0b3IudXNlckFnZW50LnRvTG93ZXJDYXNlKCkpIHx8IFtdKVsxXSkgPyAnW0xhdW5jaF0nIDogTSwgaiA9ICExLCB4ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGogJiYgd2luZG93LmNvbnNvbGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudW5zaGlmdChSKSwgZSAhPT0gTy5ERUJVRyB8fCB3aW5kb3cuY29uc29sZVtlXSB8fCAoZSA9IE8uSU5GTyksIHdpbmRvdy5jb25zb2xlW2VdLmFwcGx5KHdpbmRvdy5jb25zb2xlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIEIgPSB4LmJpbmQobnVsbCwgTy5MT0cpLCBGID0geC5iaW5kKG51bGwsIE8uSU5GTyksIEggPSB4LmJpbmQobnVsbCwgTy5ERUJVRyksIHEgPSB4LmJpbmQobnVsbCwgTy5XQVJOKSwgVSA9IHguYmluZChudWxsLCBPLkVSUk9SKSwgeiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBqOwogICAgICAgICAgICAgICAgICAgICAgICBqID0gITAsIHguYXBwbHkobnVsbCwgQXJyYXkucHJvdG90eXBlLmNvbmNhdChPLldBUk4sIEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cykpKSwgZSB8fCAoaiA9ICExKTsKICAgICAgICAgICAgICAgICAgICB9LCBZID0gewogICAgICAgICAgICAgICAgICAgICAgICBsb2c6IEIsCiAgICAgICAgICAgICAgICAgICAgICAgIGluZm86IEYsCiAgICAgICAgICAgICAgICAgICAgICAgIGRlYnVnOiBILAogICAgICAgICAgICAgICAgICAgICAgICB3YXJuOiBxLAogICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogVSwKICAgICAgICAgICAgICAgICAgICAgICAgZGVwcmVjYXRpb246IHosCiAgICAgICAgICAgICAgICAgICAgICAgIGdldCBvdXRwdXRFbmFibGVkKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGo7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHNldCBvdXRwdXRFbmFibGVkKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogPSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVQcmVmaXhlZExvZ2dlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJ1snICsgZSArICddJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nOiBCLmJpbmQobnVsbCwgdCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5mbzogRi5iaW5kKG51bGwsIHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlYnVnOiBILmJpbmQobnVsbCwgdCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2FybjogcS5iaW5kKG51bGwsIHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBVLmJpbmQobnVsbCwgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBLID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGdsb2JhbFRoaXMgPyBnbG9iYWxUaGlzIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHdpbmRvdyA/IHdpbmRvdyA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBnbG9iYWwgPyBnbG9iYWwgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygc2VsZiA/IHNlbGYgOiB7fSwgUSA9IG4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5leHBvcnRzID0gdCgpLCAhITApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHdpbmRvdy5Db29raWVzLCBuID0gd2luZG93LkNvb2tpZXMgPSB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5ub0NvbmZsaWN0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LkNvb2tpZXMgPSBhLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gMCwgdCA9IHt9OyBlIDwgYXJndW1lbnRzLmxlbmd0aDsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gYXJndW1lbnRzW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W25dID0gYVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZXBsYWNlKC8oJVswLTlBLVpdezJ9KSsvZywgZGVjb2RlVVJJQ29tcG9uZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkodCwgYSwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGRvY3VtZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbnVtYmVyJyA9PSB0eXBlb2YgKGkgPSBlKHsgcGF0aDogJy8nIH0sIHIuZGVmYXVsdHMsIGkpKS5leHBpcmVzICYmIChpLmV4cGlyZXMgPSBuZXcgRGF0ZSgxICogbmV3IERhdGUoKSArIDg2NDAwMDAwICogaS5leHBpcmVzKSksIGkuZXhwaXJlcyA9IGkuZXhwaXJlcyA/IGkuZXhwaXJlcy50b1VUQ1N0cmluZygpIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gSlNPTi5zdHJpbmdpZnkoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgL15bXHtcW10vLnRlc3QobykgJiYgKGEgPSBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBuLndyaXRlID8gbi53cml0ZShhLCB0KSA6IGVuY29kZVVSSUNvbXBvbmVudChTdHJpbmcoYSkpLnJlcGxhY2UoLyUoMjN8MjR8MjZ8MkJ8M0F8M0N8M0V8M0R8MkZ8M0Z8NDB8NUJ8NUR8NUV8NjB8N0J8N0R8N0MpL2csIGRlY29kZVVSSUNvbXBvbmVudCksIHQgPSBlbmNvZGVVUklDb21wb25lbnQoU3RyaW5nKHQpKS5yZXBsYWNlKC8lKDIzfDI0fDI2fDJCfDVFfDYwfDdDKS9nLCBkZWNvZGVVUklDb21wb25lbnQpLnJlcGxhY2UoL1tcKFwpXS9nLCBlc2NhcGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgaW4gaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpW2NdICYmIChzICs9ICc7ICcgKyBjLCAhMCAhPT0gaVtjXSAmJiAocyArPSAnPScgKyBpW2NdLnNwbGl0KCc7JylbMF0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkb2N1bWVudC5jb29raWUgPSB0ICsgJz0nICsgYSArIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyAhPSB0eXBlb2YgZG9jdW1lbnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSB7fSwgaSA9IGRvY3VtZW50LmNvb2tpZSA/IGRvY3VtZW50LmNvb2tpZS5zcGxpdCgnOyAnKSA6IFtdLCBvID0gMDsgbyA8IGkubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGlbb10uc3BsaXQoJz0nKSwgYyA9IHMuc2xpY2UoMSkuam9pbignPScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgfHwgJyInICE9PSBjLmNoYXJBdCgwKSB8fCAoYyA9IGMuc2xpY2UoMSwgLTEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IHQoc1swXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID0gKG4ucmVhZCB8fCBuKShjLCBsKSB8fCB0KGMpLCBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gSlNPTi5wYXJzZShjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJbbF0gPSBjLCBlID09PSBsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gcltlXSA6IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuc2V0ID0gaSwgci5nZXQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhlLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgci5nZXRKU09OID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIucmVtb3ZlID0gZnVuY3Rpb24gKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSh0LCAnJywgZShhLCB7IGV4cGlyZXM6IC0xIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByLmRlZmF1bHRzID0ge30sIHIud2l0aENvbnZlcnRlciA9IGEsIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSksIEcgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogUS5nZXQsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldDogUS5zZXQsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZTogUS5yZW1vdmUKICAgICAgICAgICAgICAgICAgICB9LCBXID0gJ2NvbS5hZG9iZS5yZWFjdG9yLicsICQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFcgKyAodCB8fCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRJdGVtOiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfMDNjOGM1NDJiZDVjMjQ0NiA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdsb2NhbFN0b3JhZ2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8wM2M4YzU0MmJkNWMyNDQ2KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2xvY2FsU3RvcmFnZScsICRfX19tb2NrX2NhOTE4MDQzYzc0NTExN2UubG9jYWxTdG9yYWdlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEW2VdLmdldEl0ZW0oYSArIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMDNjOGM1NDJiZDVjMjQ0NikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkXzAzYzhjNTQyYmQ1YzI0NDYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbTogZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkXzFmMzU3OTgzOTMxMmM2YmMgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMWYzNTc5ODM5MzEyYzZiYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja19jYTkxODA0M2M3NDUxMTdlLmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRFtlXS5zZXRJdGVtKGEgKyB0LCBuKSwgITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMWYzNTc5ODM5MzEyYzZiYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkXzFmMzU3OTgzOTMxMmM2YmMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgSiA9ICdfc2RzYXRfJywgWiA9ICdkYXRhRWxlbWVudHMuJywgWCA9ICdkYXRhRWxlbWVudENvb2tpZXNNaWdyYXRlZCcsIGVlID0gJCgnbG9jYWxTdG9yYWdlJyksIHRlID0gJCgnc2Vzc2lvblN0b3JhZ2UnLCBaKSwgYWUgPSAkKCdsb2NhbFN0b3JhZ2UnLCBaKSwgbmUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFBBR0VWSUVXOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgICAgICBTRVNTSU9OOiAnc2Vzc2lvbicsCiAgICAgICAgICAgICAgICAgICAgICAgIFZJU0lUT1I6ICd2aXNpdG9yJwogICAgICAgICAgICAgICAgICAgIH0sIHJlID0ge30sIGllID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gSlNPTi5zdHJpbmdpZnkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICB9LCBvZSA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBuZS5QQUdFVklFVzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIChyZVtlXSA9IGEpOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG5lLlNFU1NJT046CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAoKG4gPSBpZShhKSkgJiYgdGUuc2V0SXRlbShlLCBuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbmUuVklTSVRPUjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkICgobiA9IGllKGEpKSAmJiBhZS5zZXRJdGVtKGUsIG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIHNlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBHLmdldChKICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gYSAmJiBvZShlLCB0LCBhKTsKICAgICAgICAgICAgICAgICAgICB9LCBjZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGVlLmdldEl0ZW0oWCkgfHwgKE9iamVjdC5rZXlzKGUpLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlKHQsIGVbdF0uc3RvcmFnZUR1cmF0aW9uKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGVlLnNldEl0ZW0oWCwgITApKTsKICAgICAgICAgICAgICAgICAgICB9LCBsZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgc2V0VmFsdWU6IG9lLAogICAgICAgICAgICAgICAgICAgICAgICBnZXRWYWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG5lLlBBR0VWSUVXOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZS5oYXNPd25Qcm9wZXJ0eShlKSA/IHJlW2VdIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbmUuU0VTU0lPTjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gKGEgPSB0ZS5nZXRJdGVtKGUpKSA/IGEgOiBKU09OLnBhcnNlKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBuZS5WSVNJVE9SOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09PSAoYSA9IGFlLmdldEl0ZW0oZSkpID8gYSA6IEpTT04ucGFyc2UoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG1pZ3JhdGVDb29raWVEYXRhOiBjZQogICAgICAgICAgICAgICAgICAgIH0sIHVlID0gZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdGYWlsZWQgdG8gZXhlY3V0ZSBkYXRhIGVsZW1lbnQgbW9kdWxlICcgKyBlLm1vZHVsZVBhdGggKyAnIGZvciBkYXRhIGVsZW1lbnQgJyArIHQgKyAnLiAnICsgYSArIChuID8gJ1xuJyArIG4gOiAnJyk7CiAgICAgICAgICAgICAgICAgICAgfSwgZGUgPSBmdW5jdGlvbiAoZSwgdCwgYSwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGksIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gdChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA/ICcnIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMsIGwsIHUgPSBzLnN0b3JhZ2VEdXJhdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGUuZ2V0TW9kdWxlRXhwb3J0cyhzLm1vZHVsZVBhdGgpLCBsID0gZS5nZXRNb2R1bGVEZWZpbml0aW9uKHMubW9kdWxlUGF0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgWS5lcnJvcih1ZShzLCBpLCBlLm1lc3NhZ2UsIGUuc3RhY2spKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09IHR5cGVvZiBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQsIHAgPSBzLnNldHRpbmdzIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFzLmhhc1RyYW5zZm9ybWVkRmlsZVBhdGhzICYmIGwuZmlsZVBhdGhzICYmIChyKHAsIGwuZmlsZVBhdGhzLCBzLm1vZHVsZVBhdGgpLCBzLmhhc1RyYW5zZm9ybWVkRmlsZVBhdGhzID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBjKGEocCwgbyksIG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgWS5lcnJvcih1ZShzLCBpLCBlLm1lc3NhZ2UsIGUuc3RhY2spKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUgJiYgKG51bGwgIT0gZCA/IGxlLnNldFZhbHVlKGksIHUsIGQpIDogZCA9IGxlLmdldFZhbHVlKGksIHUpKSwgbnVsbCA9PSBkICYmIG51bGwgIT0gcy5kZWZhdWx0VmFsdWUgJiYgKGQgPSBzLmRlZmF1bHRWYWx1ZSksICdzdHJpbmcnID09IHR5cGVvZiBkICYmIChzLmNsZWFuVGV4dCAmJiAoZCA9IE4oZCkpLCBzLmZvcmNlTG93ZXJDYXNlICYmIChkID0gZC50b0xvd2VyQ2FzZSgpKSksIGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBZLmVycm9yKHVlKHMsIGksICdNb2R1bGUgZGlkIG5vdCBleHBvcnQgYSBmdW5jdGlvbi4nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgcGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRleHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS50ZXh0Q29udGVudDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY2xlYW5UZXh0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE4oZS50ZXh0Q29udGVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBoZSA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4sIHIgPSBlLCBpID0gMCwgbyA9IHQubGVuZ3RoOyBpIDwgbzsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gdFtpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhICYmICdAJyA9PT0gcy5jaGFyQXQoMCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHMuc2xpY2UoMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHBlW2NdKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChyLmdldEF0dHJpYnV0ZSAmJiAobiA9IHMubWF0Y2goL15nZXRBdHRyaWJ1dGVcKCguKylcKSQvKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IG5bMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHIuZ2V0QXR0cmlidXRlKGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHJbc107CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgfSwgZmUgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGEobiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG4uc3BsaXQoJy4nKSwgcyA9IG8uc2hpZnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGhpcycgPT09IHMgPyByICYmIChpID0gaGUoci5lbGVtZW50LCBvLCAhMCkpIDogJ2V2ZW50JyA9PT0gcyA/IHIgJiYgKGkgPSBoZShyLCBvKSkgOiAndGFyZ2V0JyA9PT0gcyA/IHIgJiYgKGkgPSBoZShyLnRhcmdldCwgbykpIDogaSA9IGhlKGVbc10sIG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgZ2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYS5zcGxpdCgnLicpWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJvb2xlYW4odChhKSB8fCAndGhpcycgPT09IG4gfHwgJ2V2ZW50JyA9PT0gbiB8fCAndGFyZ2V0JyA9PT0gbiB8fCBlLmhhc093blByb3BlcnR5KG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBtZSA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0geyBleHBvcnRzOiB7fSB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jYWxsKG4uZXhwb3J0cywgbiwgbi5leHBvcnRzLCB0LCBhKSwgbi5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgIH0sIGJlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHt9LCB0ID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ01vZHVsZSAnICsgdCArICcgbm90IGZvdW5kLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICdFcnJvciBpbml0aWFsaXppbmcgbW9kdWxlICcgKyBlICsgJy4gJyArIGEubWVzc2FnZSArIChhLnN0YWNrID8gJ1xuJyArIGEuc3RhY2sgOiAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBZLmVycm9yKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuaGFzT3duUHJvcGVydHkoJ2V4cG9ydHMnKSB8fCAoYS5leHBvcnRzID0gbWUoYS5kZWZpbml0aW9uLnNjcmlwdCwgYS5yZXF1aXJlLCBhLnR1cmJpbmUpKSwgYS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lzdGVyTW9kdWxlOiBmdW5jdGlvbiAodCwgYSwgbiwgciwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZpbml0aW9uOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRlbnNpb25OYW1lOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dXJiaW5lOiBpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLnJlcXVpcmUgPSByLCBlW3RdID0gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoeWRyYXRlQ2FjaGU6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRNb2R1bGVFeHBvcnRzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TW9kdWxlRGVmaW5pdGlvbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdChlKS5kZWZpbml0aW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldE1vZHVsZUV4dGVuc2lvbk5hbWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQoZSkuZXh0ZW5zaW9uTmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBfZSA9ICExLCB2ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLl9tb25pdG9yczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgKF9lIHx8IChZLndhcm4oJ1RoZSBfc2F0ZWxsaXRlLl9tb25pdG9ycyBBUEkgbWF5IGNoYW5nZSBhdCBhbnkgdGltZSBhbmQgc2hvdWxkIG9ubHkgYmUgdXNlZCBmb3IgZGVidWdnaW5nLicpLCBfZSA9ICEwKSwgbi5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0XSAmJiBlW3RdKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIHllID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIGksIG8sIHMgPSBbXSwgYyA9IGZ1bmN0aW9uIChuLCByLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlKHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnB1c2gocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0KHIsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzLnBvcCgpLCBudWxsID09IG8gJiYgYSA/ICcnIDogbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gL14lKFteJV0rKSUkLy5leGVjKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBjKGUsIGFbMV0sIHQpIDogZS5yZXBsYWNlKC8lKC4rPyklL2csIGZ1bmN0aW9uIChlLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoZSwgYSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0ge30sIG4gPSBPYmplY3Qua2V5cyhlKSwgciA9IDA7IHIgPCBuLmxlbmd0aDsgcisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuW3JdLCBzID0gZVtpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhW2ldID0gbyhzLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBpID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSBbXSwgbiA9IDAsIHIgPSBlLmxlbmd0aDsgbiA8IHI7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnB1c2gobyhlW25dLCB0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgbyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGUgPyBuKGUsIHQpIDogQXJyYXkuaXNBcnJheShlKSA/IGkoZSwgdCkgOiAnb2JqZWN0JyA9PSB0eXBlb2YgZSAmJiBudWxsICE9PSBlID8gcihlLCB0KSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5sZW5ndGggPiAxMCA/IChZLmVycm9yKCdEYXRhIGVsZW1lbnQgY2lyY3VsYXIgcmVmZXJlbmNlIGRldGVjdGVkOiAnICsgcy5qb2luKCcgLT4gJykpLCBlKSA6IG8oZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwga2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBhcmd1bWVudHNbMF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVthcmd1bWVudHNbMF1dID0gYXJndW1lbnRzWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoYXJndW1lbnRzWzBdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHNbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW2FdID0gdFthXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBBZSA9IHNldFRpbWVvdXQ7CiAgICAgICAgICAgICAgICBjLnByb3RvdHlwZS5jYXRjaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudGhlbihudWxsLCBlKTsKICAgICAgICAgICAgICAgIH0sIGMucHJvdG90eXBlLnRoZW4gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IHRoaXMuY29uc3RydWN0b3Iobyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwodGhpcywgbmV3IGgoZSwgdCwgYSkpLCBhOwogICAgICAgICAgICAgICAgfSwgYy5wcm90b3R5cGUuZmluYWxseSA9IHIsIGMuYWxsID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGMoZnVuY3Rpb24gKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihlLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpICYmICgnb2JqZWN0JyA9PSB0eXBlb2YgaSB8fCAnZnVuY3Rpb24nID09IHR5cGVvZiBpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGkudGhlbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBzLmNhbGwoaSwgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbZV0gPSBpLCAwID09IC0tbyAmJiB0KHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEobmV3IFR5cGVFcnJvcignUHJvbWlzZS5hbGwgYWNjZXB0cyBhbiBhcnJheScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IHIubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQoW10pOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gci5sZW5ndGgsIHMgPSAwOyBzIDwgci5sZW5ndGg7IHMrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ocywgcltzXSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBjLnJlc29sdmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdvYmplY3QnID09IHR5cGVvZiBlICYmIGUuY29uc3RydWN0b3IgPT09IGMgPyBlIDogbmV3IGMoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdChlKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIGMucmVqZWN0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGMoZnVuY3Rpb24gKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYShlKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIGMucmFjZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBjKGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhKG5ldyBUeXBlRXJyb3IoJ1Byb21pc2UucmFjZSBhY2NlcHRzIGFuIGFycmF5JykpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMCwgciA9IGUubGVuZ3RoOyBuIDwgcjsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5yZXNvbHZlKGVbbl0pLnRoZW4odCwgYSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBjLl9pbW1lZGlhdGVGbiA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIHNldEltbWVkaWF0ZSAmJiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHNldEltbWVkaWF0ZShlKTsKICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBBZShlLCAwKTsKICAgICAgICAgICAgICAgIH0sIGMuX3VuaGFuZGxlZFJlamVjdGlvbkZuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPSB0eXBlb2YgY29uc29sZSAmJiBjb25zb2xlICYmIGNvbnNvbGUud2FybignUG9zc2libGUgVW5oYW5kbGVkIFByb21pc2UgUmVqZWN0aW9uOicsIGUpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHZhciBTZSA9IGEoT2JqZWN0LmZyZWV6ZSh7CiAgICAgICAgICAgICAgICAgICAgICAgIF9fcHJvdG9fXzogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDogYwogICAgICAgICAgICAgICAgICAgIH0pKSwgd2UgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygd2luZG93ICYmIHdpbmRvdy5Qcm9taXNlIHx8IHZvaWQgMCAhPT0gSyAmJiBLLlByb21pc2UgfHwgU2UuZGVmYXVsdCB8fCBTZSwgRWUgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIHIsIGksIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvLCBzID0gbi5kZWxheU5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB3ZShmdW5jdGlvbiAodCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUobiwgaSwgW2ldKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuLnRpbWVvdXQsIGwgPSBuZXcgd2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQobmV3IEVycm9yKCdBIHRpbWVvdXQgb2NjdXJyZWQgYmVjYXVzZSB0aGUgYWN0aW9uIHRvb2sgbG9uZ2VyIHRoYW4gJyArIGMgLyAxMDAwICsgJyBzZWNvbmRzIHRvIGNvbXBsZXRlLiAnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2UucmFjZShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKS50aGVuKHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjbGVhclRpbWVvdXQobyksIGUgPSB0KGUpLCBhKG4sIHIsIGUpLCB3ZS5yZWplY3QoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dChvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIERlID0gZnVuY3Rpb24gKGUsIHQsIGEsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChpLCBvLCBzLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHdlKGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZShpLCBzLCBbc10pLCByID0gaS50aW1lb3V0LCBvID0gbmV3IHdlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KG5ldyBFcnJvcignQSB0aW1lb3V0IG9jY3VycmVkIGJlY2F1c2UgdGhlIGNvbmRpdGlvbiB0b29rIGxvbmdlciB0aGFuICcgKyByIC8gMTAwMCArICcgc2Vjb25kcyB0byBjb21wbGV0ZS4gJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlLnJhY2UoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkudGhlbih0LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2xlYXJUaW1lb3V0KGMpLCBlID0gdChlKSwgbihpLCBvLCBlKSwgd2UucmVqZWN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNsZWFyVGltZW91dChjKSwgIWEoaSwgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihpLCBvKSwgd2UucmVqZWN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBJZSA9IHdlLnJlc29sdmUoKSwgVGUgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmNvbmRpdGlvbnMgJiYgbi5jb25kaXRpb25zLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJZSA9IGUodCwgbiwgciwgSWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG4uYWN0aW9ucyAmJiBuLmFjdGlvbnMuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEllID0gdChlLCBuLCByLCBJZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgSWUgPSAoSWUgPSBJZS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLmNhdGNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIFBlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJvb2xlYW4oZSAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBlLnRoZW4pOwogICAgICAgICAgICAgICAgICAgIH0sIENlID0gZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChyLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLmNvbmRpdGlvbnMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgcyA9IDA7IHMgPCByLmNvbmRpdGlvbnMubGVuZ3RoOyBzKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IHIuY29uZGl0aW9uc1tzXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gZShvLCBpLCBbaV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFBlKGMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignUnVsZSBjb21wb25lbnQgc2VxdWVuY2luZyBtdXN0IGJlIGVuYWJsZWQgb24gdGhlIHByb3BlcnR5IGZvciB0aGlzIGNvbmRpdGlvbiB0byBmdW5jdGlvbiBwcm9wZXJseS4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdChvLCBjKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShvLCByKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKG8sIHIsIGUpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBWZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZShhLCBuKSAmJiB0KGEsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIExlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUuZ2V0TW9kdWxlRGVmaW5pdGlvbih0Lm1vZHVsZVBhdGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgJiYgYS5kaXNwbGF5TmFtZSB8fCB0Lm1vZHVsZVBhdGg7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgTmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdC5ydWxlLCBuID0gdC5ldmVudCwgciA9IGUuZ2V0TW9kdWxlRGVmaW5pdGlvbihuLm1vZHVsZVBhdGgpLm5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0eXBlOiBlLmdldE1vZHVsZUV4dGVuc2lvbk5hbWUobi5tb2R1bGVQYXRoKSArICcuJyArIHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHJ1bGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGEuaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGEubmFtZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgT2UgPSBmdW5jdGlvbiAoZSwgdCwgYSwgbiwgciwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG8sIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gcy5ydWxlLCBsID0gcy5ldmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwuc2V0dGluZ3MgPSBsLnNldHRpbmdzIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHIocyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChsLCBudWxsLCBbZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYSh1LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUobiwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuZXJyb3IobihsLCBjLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgTWUgPSBmdW5jdGlvbiAoZSwgdCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHIsIGksIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gdChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuZXJyb3IoZShzLCBpLm5hbWUsIG8pKSwgbigncnVsZUFjdGlvbkZhaWxlZCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbjogcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgUmUgPSBmdW5jdGlvbiAoZSwgdCwgYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHIsIGksIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gdChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuZXJyb3IoZShzLCBpLm5hbWUsIG8pKSwgbigncnVsZUNvbmRpdGlvbkZhaWxlZCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbjogcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgamUgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubG9nKCdDb25kaXRpb24gIicgKyBpICsgJyIgZm9yIHJ1bGUgIicgKyByLm5hbWUgKyAnIiB3YXMgbm90IG1ldC4nKSwgYSgncnVsZUNvbmRpdGlvbkZhaWxlZCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbjogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgeGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubG9nKCdSdWxlICInICsgYS5uYW1lICsgJyIgZmlyZWQuJyksIHQoJ3J1bGVDb21wbGV0ZWQnLCB7IHJ1bGU6IGEgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgQmUgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4uYWN0aW9ucykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gMDsgbyA8IG4uYWN0aW9ucy5sZW5ndGg7IG8rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gbi5hY3Rpb25zW29dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZShpLCByLCBbcl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCB0KGksIG4sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBGZSA9IGZ1bmN0aW9uIChlLCB0LCBhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAociwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbigncnVsZVRyaWdnZXJlZCcsIHsgcnVsZTogaSB9KSwgZSA/IGEoaSwgcikgOiB0KGksIHIpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIEhlID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdGYWlsZWQgdG8gZXhlY3V0ZSAiJyArIGUgKyAnIiBmb3IgIicgKyB0ICsgJyIgcnVsZS4gJyArIGEubWVzc2FnZSArIChhLnN0YWNrID8gJ1xuJyArIGEuc3RhY2sgOiAnJyk7CiAgICAgICAgICAgICAgICAgICAgfSwgcWUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiAhZS5uZWdhdGUgfHwgIXQgJiYgZS5uZWdhdGU7CiAgICAgICAgICAgICAgICAgICAgfSwgVWUgPSBbXSwgemUgPSAhMSwgWWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB6ZSA/IGUoKSA6IFVlLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgfSwgS2UgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICBlKHQpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoWWUsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgemUgPSAhMCwgVWUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgVWUgPSBbXTsKICAgICAgICAgICAgICAgICAgICB9LCBRZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIHx8IChlID0gbmV3IEVycm9yKCdUaGUgZXh0ZW5zaW9uIHRyaWdnZXJlZCBhbiBlcnJvciwgYnV0IG5vIGVycm9yIGluZm9ybWF0aW9uIHdhcyBwcm92aWRlZC4nKSksICEoZSBpbnN0YW5jZW9mIEVycm9yKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAnb2JqZWN0JyA9PSB0eXBlb2YgZSA/IEpTT04uc3RyaW5naWZ5KGUpIDogU3RyaW5nKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IG5ldyBFcnJvcih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBHZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGUgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGUgJiYgITEgPT09IEFycmF5LmlzQXJyYXkoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwgV2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExICE9PSBnKGUpICYmICgnZnVuY3Rpb24nID09IHR5cGVvZiAodCA9IGUuY29uc3RydWN0b3IpICYmICghMSAhPT0gZyhhID0gdC5wcm90b3R5cGUpICYmICExICE9PSBhLmhhc093blByb3BlcnR5KCdpc1Byb3RvdHlwZU9mJykpKTsKICAgICAgICAgICAgICAgICAgICB9LCAkZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXZSh0ID0gdCB8fCB7fSkgPyB0ID0gRSh7fSwgdCwgZSkgOiBFKHQsIGUpLCB0Lmhhc093blByb3BlcnR5KCd0eXBlJykgfHwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICd0eXBlJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFkuZGVwcmVjYXRpb24oJ0FjY2Vzc2luZyBldmVudC50eXBlIGluIEFkb2JlIExhdW5jaCBoYXMgYmVlbiBkZXByZWNhdGVkIGFuZCB3aWxsIGJlIHJlbW92ZWQgc29vbi4gUGxlYXNlIHVzZSBldmVudC4kdHlwZSBpbnN0ZWFkLicpLCB0LiR0eXBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgICAgICB9LCBKZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlW2FdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHIubW9kdWxlczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbyA9IE9iamVjdC5rZXlzKGkpLCBzID0gMDsgcyA8IG8ubGVuZ3RoOyBzKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gb1tzXSwgbCA9IGlbY107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobC5zaGFyZWQgJiYgbC5uYW1lID09PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmdldE1vZHVsZUV4cG9ydHMoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBaZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA/IGUodCkgOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBYZSA9IGZ1bmN0aW9uIChlLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4uc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnNwbGljZShyLmxlbmd0aCAtIDEgfHwgMSwgMCwgJ21pbicpLCBuID0gci5qb2luKCcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0KSArIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgZXQgPSAnLmpzJywgdHQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdWJzdHIoMCwgZS5sYXN0SW5kZXhPZignLycpKTsKICAgICAgICAgICAgICAgICAgICB9LCBhdCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSAhPT0gZS5pbmRleE9mKHQsIGUubGVuZ3RoIC0gdC5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIH0sIG50ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYXQodCwgZXQpIHx8ICh0ICs9IGV0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0LnNwbGl0KCcvJyksIG4gPSB0dChlKS5zcGxpdCgnLycpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmICcuJyAhPT0gZSAmJiAoJy4uJyA9PT0gZSA/IG4ubGVuZ3RoICYmIG4ucG9wKCkgOiBuLnB1c2goZSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgbi5qb2luKCcvJyk7CiAgICAgICAgICAgICAgICAgICAgfSwgcnQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHdlKGZ1bmN0aW9uIChhLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm9ubG9hZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5vbmVycm9yID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4obmV3IEVycm9yKCdGYWlsZWQgdG8gbG9hZCBzY3JpcHQgJyArIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIGl0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdC5zcmMgPSBlLCB0LmFzeW5jID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gcnQoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnaGVhZCcpWzBdLmFwcGVuZENoaWxkKHQpLCBhOwogICAgICAgICAgICAgICAgICAgIH0sIG90ID0gZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQgfHwgJyYnLCBhID0gYSB8fCAnPSc7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPSB0eXBlb2YgZSB8fCAwID09PSBlLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IC9cKy9nOwogICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5zcGxpdCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSAxMDAwOwogICAgICAgICAgICAgICAgICAgICAgICBuICYmICdudW1iZXInID09IHR5cGVvZiBuLm1heEtleXMgJiYgKG8gPSBuLm1heEtleXMpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICBvID4gMCAmJiBzID4gbyAmJiAocyA9IG8pOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IHM7ICsrYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwsIHUsIGQsIHAsIGggPSBlW2NdLnJlcGxhY2UoaSwgJyUyMCcpLCBmID0gaC5pbmRleE9mKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA+PSAwID8gKGwgPSBoLnN1YnN0cigwLCBmKSwgdSA9IGguc3Vic3RyKGYgKyAxKSkgOiAobCA9IGgsIHUgPSAnJyksIGQgPSBkZWNvZGVVUklDb21wb25lbnQobCksIHAgPSBkZWNvZGVVUklDb21wb25lbnQodSksIG0ociwgZCkgPyBBcnJheS5pc0FycmF5KHJbZF0pID8gcltkXS5wdXNoKHApIDogcltkXSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByW2RdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0gOiByW2RdID0gcDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICB9LCBzdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodHlwZW9mIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc3RyaW5nJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdib29sZWFuJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gJ3RydWUnIDogJ2ZhbHNlJzsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbnVtYmVyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpc0Zpbml0ZShlKSA/IGUgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGN0ID0gZnVuY3Rpb24gKGUsIHQsIGEsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSB0IHx8ICcmJywgYSA9IGEgfHwgJz0nLCBudWxsID09PSBlICYmIChlID0gdm9pZCAwKSwgJ29iamVjdCcgPT0gdHlwZW9mIGUgPyBPYmplY3Qua2V5cyhlKS5tYXAoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZW5jb2RlVVJJQ29tcG9uZW50KHN0KG4pKSArIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShlW25dKSA/IGVbbl0ubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgKyBlbmNvZGVVUklDb21wb25lbnQoc3QoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbih0KSA6IHIgKyBlbmNvZGVVUklDb21wb25lbnQoc3QoZVtuXSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5qb2luKHQpIDogbiA/IGVuY29kZVVSSUNvbXBvbmVudChzdChuKSkgKyBhICsgZW5jb2RlVVJJQ29tcG9uZW50KHN0KGUpKSA6ICcnOwogICAgICAgICAgICAgICAgICAgIH0sIGx0ID0gbihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB0LmRlY29kZSA9IHQucGFyc2UgPSBvdCwgdC5lbmNvZGUgPSB0LnN0cmluZ2lmeSA9IGN0OwogICAgICAgICAgICAgICAgICAgIH0pLCB1dCA9ICdAYWRvYmUvcmVhY3Rvci0nLCBkdCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgY29va2llOiBHLAogICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudDogeSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2xvYWQtc2NyaXB0JzogaXQsCiAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QtYXNzaWduJzogRSwKICAgICAgICAgICAgICAgICAgICAgICAgcHJvbWlzZTogd2UsCiAgICAgICAgICAgICAgICAgICAgICAgICdxdWVyeS1zdHJpbmcnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgKGUgPSBlLnRyaW0oKS5yZXBsYWNlKC9eWz8jJl0vLCAnJykpLCBsdC5wYXJzZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmdpZnk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGx0LnN0cmluZ2lmeShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93OiBECiAgICAgICAgICAgICAgICAgICAgfSwgcHQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSB0LmluZGV4T2YodXQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0LnN1YnN0cih1dC5sZW5ndGgpLCBuID0gZHRbYV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IHQuaW5kZXhPZignLi8nKSB8fCAwID09PSB0LmluZGV4T2YoJy4uLycpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdDYW5ub3QgcmVzb2x2ZSBtb2R1bGUgIicgKyB0ICsgJyIuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgaHQgPSBmdW5jdGlvbiAoZSwgdCwgYSwgbiwgciwgaSwgbykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGUuZXh0ZW5zaW9ucywgYyA9IGUuYnVpbGRJbmZvLCBsID0gZS5lbnZpcm9ubWVudCwgdSA9IGUucHJvcGVydHkuc2V0dGluZ3M7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IEplKHMsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMocykuZm9yRWFjaChmdW5jdGlvbiAocCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gc1twXSwgZiA9IGguc2V0dGluZ3M7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShoLmZpbGVQYXRocykgJiYgKGYgPSBpKGYsIGguZmlsZVBhdGhzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBaZShuLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaC5tb2R1bGVzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gWS5jcmVhdGVQcmVmaXhlZExvZ2dlcihoLmRpc3BsYXlOYW1lKSwgYiA9IFhlKG8sIGguaG9zdGVkTGliRmlsZXNCYXNlVXJsLCBjLm1pbmlmaWVkKSwgXyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWlsZEluZm86IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnQ6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcGVydHk6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogZS5wcm9wZXJ0eS5uYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogZS5wcm9wZXJ0eS5pZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RGF0YUVsZW1lbnRWYWx1ZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRFeHRlbnNpb25TZXR0aW5nczogZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRIb3N0ZWRMaWJGaWxlVXJsOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFNoYXJlZE1vZHVsZTogZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2dnZXI6IG0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcGVydHlTZXR0aW5nczogdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXBsYWNlVG9rZW5zOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uRGVidWdDaGFuZ2VkOiBhLm9uRGVidWdDaGFuZ2VkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldCBkZWJ1Z0VuYWJsZWQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmdldERlYnVnRW5hYmxlZCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKGgubW9kdWxlcykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBoLm1vZHVsZXNbZV0sIG4gPSBwdChmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG50KGUsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5nZXRNb2R1bGVFeHBvcnRzKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5yZWdpc3Rlck1vZHVsZShlLCBhLCBwLCBuLCBfKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQuaHlkcmF0ZUNhY2hlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgZnQgPSBmdW5jdGlvbiAoZSwgdCwgYSwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IFkuY3JlYXRlUHJlZml4ZWRMb2dnZXIoJ0N1c3RvbSBTY3JpcHQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgZS50cmFjayA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBZLmxvZygnIicgKyBlICsgJyIgZG9lcyBub3QgbWF0Y2ggYW55IGRpcmVjdCBjYWxsIGlkZW50aWZpZXJzLicpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmdldFZpc2l0b3JJZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3BlcnR5ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogdC5wcm9wZXJ0eS5uYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHQucHJvcGVydHkuaWQKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5jb21wYW55ID0gdC5jb21wYW55LCBlLmJ1aWxkSW5mbyA9IHQuYnVpbGRJbmZvLCBlLmVudmlyb25tZW50ID0gdC5lbnZpcm9ubWVudCwgZS5sb2dnZXIgPSBpLCBlLm5vdGlmeSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKFkuZGVwcmVjYXRpb24oJ19zYXRlbGxpdGUubm90aWZ5IGlzIGRlcHJlY2F0ZWQuIFBsZWFzZSB1c2UgdGhlIGBfc2F0ZWxsaXRlLmxvZ2dlcmAgQVBJLicpLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5pbmZvKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkud2FybihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmVycm9yKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmxvZyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5nZXRWYXIgPSBuLCBlLnNldFZhciA9IHIsIGUuc2V0Q29va2llID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJycsIHIgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgJiYgKG4gPSAnLCB7IGV4cGlyZXM6ICcgKyBhICsgJyB9Jywgci5leHBpcmVzID0gYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9ICdfc2F0ZWxsaXRlLnNldENvb2tpZSBpcyBkZXByZWNhdGVkLiBQbGVhc2UgdXNlIF9zYXRlbGxpdGUuY29va2llLnNldCgiJyArIGUgKyAnIiwgIicgKyB0ICsgJyInICsgbiArICcpLic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBZLmRlcHJlY2F0aW9uKGkpLCBHLnNldChlLCB0LCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5yZWFkQ29va2llID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBZLmRlcHJlY2F0aW9uKCdfc2F0ZWxsaXRlLnJlYWRDb29raWUgaXMgZGVwcmVjYXRlZC4gUGxlYXNlIHVzZSBfc2F0ZWxsaXRlLmNvb2tpZS5nZXQoIicgKyBlICsgJyIpLicpLCBHLmdldChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5yZW1vdmVDb29raWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgWS5kZXByZWNhdGlvbignX3NhdGVsbGl0ZS5yZW1vdmVDb29raWUgaXMgZGVwcmVjYXRlZC4gUGxlYXNlIHVzZSBfc2F0ZWxsaXRlLmNvb2tpZS5yZW1vdmUoIicgKyBlICsgJyIpLicpLCBHLnJlbW92ZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5jb29raWUgPSBHLCBlLnBhZ2VCb3R0b20gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuc2V0RGVidWcgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgJ19jb250YWluZXInLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyB8fCAoWS53YXJuKCdfc2F0ZWxsaXRlLl9jb250YWluZXIgbWF5IGNoYW5nZSBhdCBhbnkgdGltZSBhbmQgc2hvdWxkIG9ubHkgYmUgdXNlZCBmb3IgZGVidWdnaW5nLicpLCBvID0gITApLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBndCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSB5LnF1ZXJ5U2VsZWN0b3JBbGwoJ3NjcmlwdCcpLCBhID0gMDsgYSA8IHQubGVuZ3RoOyBhKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdFthXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLnRlc3Qobi5zcmMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgbXQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGEsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIFdlKGEpICYmIE9iamVjdC5rZXlzKGEpLmxlbmd0aCAmJiBBcnJheS5pc0FycmF5KG4pICYmIG4ubGVuZ3RoID8gKG4uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJvb2xlYW4obnVsbCAhPSByICYmIC9eY29yZVwvLiphY3Rpb25zLipcL2N1c3RvbUNvZGVcLmpzJC8udGVzdChyKSkgJiYgJ3NvdXJjZScgPT09IGUgJiYgIWEuaXNFeHRlcm5hbCB8fCB2KGUuc3BsaXQoJy4nKSwgYSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYSkgOiBhOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGJ0ID0gewogICAgICAgICAgICAgICAgICAgICAgICBnZXRUdXJiaW5lOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ3QobmV3IFJlZ0V4cCgvKGxhdW5jaHxzYXRlbGxpdGVMaWIpLVteXC9dKy5qcyhcPy4qKT8kLykpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBieVJlZ2V4UGF0dGVybjogZ3QKICAgICAgICAgICAgICAgICAgICB9LmdldFR1cmJpbmUsIF90ID0gd2luZG93Ll9zYXRlbGxpdGU7CiAgICAgICAgICAgICAgICBpZiAoX3QgJiYgIXdpbmRvdy5fX3NhdGVsbGl0ZUxvYWRlZCkgewogICAgICAgICAgICAgICAgICAgIHdpbmRvdy5fX3NhdGVsbGl0ZUxvYWRlZCA9ICEwOwogICAgICAgICAgICAgICAgICAgIHZhciB2dCA9IF90LmNvbnRhaW5lcjsKICAgICAgICAgICAgICAgICAgICBkZWxldGUgX3QuY29udGFpbmVyOwogICAgICAgICAgICAgICAgICAgIHZhciB5dCA9IEUoe30sIHZ0LmJ1aWxkSW5mbyk7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHl0LCAnZW52aXJvbm1lbnQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFkuZGVwcmVjYXRpb24oJ2NvbnRhaW5lci5idWlsZEluZm8uZW52aXJvbm1lbnQgaXMgZGVwcmVjYXRlZC5QbGVhc2UgdXNlIGBjb250YWluZXIuZW52aXJvbm1lbnQuc3RhZ2VgIGluc3RlYWQnKSwgdnQuZW52aXJvbm1lbnQuc3RhZ2U7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KSwgdnQuYnVpbGRJbmZvID0geXQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIGt0LCBBdCA9IEMoJCgnbG9jYWxTdG9yYWdlJyksIFkpLCBTdCA9ICcnOwogICAgICAgICAgICAgICAgICAgIHkuY3VycmVudFNjcmlwdCAmJiB5LmN1cnJlbnRTY3JpcHQuZ2V0QXR0cmlidXRlKCdzcmMnKSA/IFN0ID0geS5jdXJyZW50U2NyaXB0LmdldEF0dHJpYnV0ZSgnc3JjJykgOiBidCgpICYmIChTdCA9IGJ0KCkuZ2V0QXR0cmlidXRlKCdzcmMnKSk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAga3QgPSBJKFN0LCB2dC5jb21wYW55LmNkbkFsbG93TGlzdCwgQXQpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgWS53YXJuKCdQbGVhc2UgcmV2aWV3IHRoZSBmb2xsb3dpbmcgZXJyb3I6JyksIGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciB3dCwgRXQgPSBtdChrdC5pc0R5bmFtaWNFbmZvcmNlZCwga3QuZGVjb3JhdGVXaXRoRHluYW1pY0hvc3QpLCBEdCA9IGJlKCksIEl0ID0gdnQucHJvcGVydHkuc2V0dGluZ3MudW5kZWZpbmVkVmFyc1JldHVybkVtcHR5LCBUdCA9IHZ0LnByb3BlcnR5LnNldHRpbmdzLnJ1bGVDb21wb25lbnRTZXF1ZW5jaW5nRW5hYmxlZCwgUHQgPSB2dC5kYXRhRWxlbWVudHMgfHwge307CiAgICAgICAgICAgICAgICAgICAgbGUubWlncmF0ZUNvb2tpZURhdGEoUHQpOwogICAgICAgICAgICAgICAgICAgIHZhciBDdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFZ0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHd0LmFwcGx5KG51bGwsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIEx0ID0gZGUoRHQsIEN0LCBWdCwgSXQsIEV0KSwgTnQgPSB7fSwgT3QgPSBrZShOdCksIE10ID0gZ2UoTnQsIEN0KSwgUnQgPSBmZShOdCwgQ3QsIEx0KTsKICAgICAgICAgICAgICAgICAgICB3dCA9IHllKE10LCBSdCwgSXQpLCBmdChfdCwgdnQsIEF0LnNldERlYnVnRW5hYmxlZCwgUnQsIE90KSwgaHQodnQsIER0LCBBdCwgd3QsIEx0LCBFdCwga3QuZGVjb3JhdGVXaXRoRHluYW1pY0hvc3QpOwogICAgICAgICAgICAgICAgICAgIHZhciBqdCA9IHZlKF90KSwgeHQgPSBMKER0LCB3dCwgRXQpLCBCdCA9IExlKER0KSwgRnQgPSBqZShCdCwgWSwganQpLCBIdCA9IFJlKEhlLCBCdCwgWSwganQpLCBxdCA9IE1lKEhlLCBCdCwgWSwganQpLCBVdCA9IHhlKFksIGp0KSwgenQgPSBPZShGZShUdCwgVmUoQ2UoeHQsIHFlLCBGdCwgSHQpLCBCZSh4dCwgcXQsIFV0KSksIFRlKERlKHh0LCBRZSwgcWUsIEh0LCBGdCksIEVlKHh0LCBRZSwgcXQpLCBVdCksIGp0KSwgeHQsICRlLCBIZSwgTmUoRHQpLCBZKTsKICAgICAgICAgICAgICAgICAgICBLZShULCB2dC5ydWxlcyB8fCBbXSwgenQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIF90OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGNvbnNvbGUud2FybignQWRvYmUgTGF1bmNoIGlzIHVuc3VwcG9ydGVkIGluIElFIDkgYW5kIGJlbG93LicpOwogICAgICAgIH0oKTsKICAgICAgICBfc2F0ZWxsaXRlID0gJF9fX3Zhcl8yMTg5MWU2NjUzY2M2ZDM2OwogICAgfSgpKQp9"},{"name":"sugarcoat-0df9436bcc867b94a71bac256f2dba3713a377a0","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfY2I1YzhmNTVhOWJiZWE4YiA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja19jYjVjOGY1NWE5YmJlYThiKTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgKGZ1bmN0aW9uIChFKSB7CiAgICAgICAgICAgIHZhciB3aW5kb3cgPSB0aGlzOwogICAgICAgICAgICBpZiAod2luZG93Lmdvb2dsZXRhZyAmJiBnb29nbGV0YWcuZXZhbFNjcmlwdHMpIHsKICAgICAgICAgICAgICAgIGdvb2dsZXRhZy5ldmFsU2NyaXB0cygpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh3aW5kb3cuZ29vZ2xldGFnICYmIGdvb2dsZXRhZy5fbG9hZGVkXykKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgdmFyIGFhLCBiYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSAwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiIDwgYS5sZW5ndGggPyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBhW2IrK10KICAgICAgICAgICAgICAgICAgICAgICAgfSA6IHsgZG9uZTogITAgfTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgY2EgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBPYmplY3QuZGVmaW5lUHJvcGVydGllcyA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eSA6IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEgPT0gQXJyYXkucHJvdG90eXBlIHx8IGEgPT0gT2JqZWN0LnByb3RvdHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgYVtiXSA9IGMudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9LCBkYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT0gdHlwZW9mIGdsb2JhbFRoaXMgJiYgZ2xvYmFsVGhpcywKICAgICAgICAgICAgICAgICAgICAgICAgYSwKICAgICAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT0gdHlwZW9mIHdpbmRvdyAmJiB3aW5kb3csCiAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09IHR5cGVvZiBzZWxmICYmIHNlbGYsCiAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09IHR5cGVvZiBnbG9iYWwgJiYgZ2xvYmFsCiAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gMDsgYiA8IGEubGVuZ3RoOyArK2IpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhW2JdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyAmJiBjLk1hdGggPT0gTWF0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignQ2Fubm90IGZpbmQgZ2xvYmFsIG9iamVjdCcpOwogICAgICAgICAgICAgICAgfSwgZWEgPSBkYSh0aGlzKSwgaGEgPSAnZnVuY3Rpb24nID09PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09PSB0eXBlb2YgU3ltYm9sKCd4JyksIG0gPSB7fSwgaWEgPSB7fSwgcCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBpYVtiXTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBjKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYVtiXTsKICAgICAgICAgICAgICAgICAgICBjID0gYVtjXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBjID8gYyA6IGFbYl07CiAgICAgICAgICAgICAgICB9LCByID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYikKICAgICAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gMSA9PT0gZC5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGRbMF0sIGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAhYSAmJiBlIGluIG0gPyBmID0gbSA6IGYgPSBlYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IDA7IGUgPCBkLmxlbmd0aCAtIDE7IGUrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShoIGluIGYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBmW2hdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGRbZC5sZW5ndGggLSAxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBoYSAmJiAnZXM2JyA9PT0gYyA/IGZbZF0gOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGIoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IGIgJiYgKGEgPyBjYShtLCBkLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogYiAhPT0gYyAmJiAodm9pZCAwID09PSBpYVtkXSAmJiAoYSA9IDEwMDAwMDAwMDAgKiBNYXRoLnJhbmRvbSgpID4+PiAwLCBpYVtkXSA9IGhhID8gZWEuU3ltYm9sKGQpIDogJyRqc2NwJCcgKyBhICsgJyQnICsgZCksIGNhKGYsIGlhW2RdLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHIoJ1N5bWJvbCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBpZiAoYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIHZhciBiID0gZnVuY3Rpb24gKGYsIGgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBmOwogICAgICAgICAgICAgICAgICAgIGNhKHRoaXMsICdkZXNjcmlwdGlvbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogaAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmc7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIGMgPSAnanNjb21wX3N5bWJvbF8nICsgKDEwMDAwMDAwMDAgKiBNYXRoLnJhbmRvbSgpID4+PiAwKSArICdfJywgZCA9IDAsIGUgPSBmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcyBpbnN0YW5jZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdTeW1ib2wgaXMgbm90IGEgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBiKGMgKyAoZiB8fCAnJykgKyAnXycgKyBkKyssIGYpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICByKCdTeW1ib2wuaXRlcmF0b3InLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICBhID0gKDAsIG0uU3ltYm9sKSgnU3ltYm9sLml0ZXJhdG9yJyk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gJ0FycmF5IEludDhBcnJheSBVaW50OEFycmF5IFVpbnQ4Q2xhbXBlZEFycmF5IEludDE2QXJyYXkgVWludDE2QXJyYXkgSW50MzJBcnJheSBVaW50MzJBcnJheSBGbG9hdDMyQXJyYXkgRmxvYXQ2NEFycmF5Jy5zcGxpdCgnICcpLCBjID0gMDsgYyA8IGIubGVuZ3RoOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGVhW2JbY11dOwogICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT09IHR5cGVvZiBkICYmICdmdW5jdGlvbicgIT0gdHlwZW9mIGQucHJvdG90eXBlW2FdICYmIGNhKGQucHJvdG90eXBlLCBhLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqYShiYSh0aGlzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHZhciBqYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IHsgbmV4dDogYSB9OwogICAgICAgICAgICAgICAgICAgIGFbcChtLlN5bWJvbCwgJ2l0ZXJhdG9yJyldID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSwga2EgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLnJhdyA9IGE7CiAgICAgICAgICAgICAgICB9LCB0ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9ICd1bmRlZmluZWQnICE9IHR5cGVvZiBtLlN5bWJvbCAmJiBwKG0uU3ltYm9sLCAnaXRlcmF0b3InKSAmJiBhW3AobS5TeW1ib2wsICdpdGVyYXRvcicpXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiA/IGIuY2FsbChhKSA6IHsgbmV4dDogYmEoYSkgfTsKICAgICAgICAgICAgICAgIH0sIGxhID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiLCBjID0gW107ICEoYiA9IGEubmV4dCgpKS5kb25lOykKICAgICAgICAgICAgICAgICAgICAgICAgYy5wdXNoKGIudmFsdWUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSwgdSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgaW5zdGFuY2VvZiBBcnJheSA/IGEgOiBsYSh0KGEpKTsKICAgICAgICAgICAgICAgIH0sIG1hID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgT2JqZWN0LmNyZWF0ZSA/IE9iamVjdC5jcmVhdGUgOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYi5wcm90b3R5cGUgPSBhOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgYigpOwogICAgICAgICAgICAgICAgfSwgbmE7CiAgICAgICAgICAgIGlmIChoYSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBPYmplY3Quc2V0UHJvdG90eXBlT2YpCiAgICAgICAgICAgICAgICBuYSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZjsKICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICB2YXIgb2E7CiAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHBhID0geyBhOiAhMCB9LCBxYSA9IHt9OwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHFhLl9fcHJvdG9fXyA9IHBhOwogICAgICAgICAgICAgICAgICAgICAgICBvYSA9IHFhLmE7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYSkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBvYSA9ICExOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgbmEgPSBvYSA/IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYS5fX3Byb3RvX18gPSBiOwogICAgICAgICAgICAgICAgICAgIGlmIChhLl9fcHJvdG9fXyAhPT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihhICsgJyBpcyBub3QgZXh0ZW5zaWJsZScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHJhID0gbmEsIHYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEucHJvdG90eXBlID0gbWEoYi5wcm90b3R5cGUpOwogICAgICAgICAgICAgICAgICAgIGEucHJvdG90eXBlLmNvbnN0cnVjdG9yID0gYTsKICAgICAgICAgICAgICAgICAgICBpZiAocmEpCiAgICAgICAgICAgICAgICAgICAgICAgIHJhKGEsIGIpOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyBpbiBiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdwcm90b3R5cGUnICE9IGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihiLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCAmJiBPYmplY3QuZGVmaW5lUHJvcGVydHkoYSwgYywgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbY10gPSBiW2NdOwogICAgICAgICAgICAgICAgICAgIGEuQWEgPSBiLnByb3RvdHlwZTsKICAgICAgICAgICAgICAgIH0sIHcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IE51bWJlcih0aGlzKSwgYiA9IFtdLCBjID0gYTsgYyA8IGFyZ3VtZW50cy5sZW5ndGg7IGMrKykKICAgICAgICAgICAgICAgICAgICAgICAgYltjIC0gYV0gPSBhcmd1bWVudHNbY107CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9LCB4ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGEsIGIpOwogICAgICAgICAgICAgICAgfSwgc2EgPSBoYSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBwKE9iamVjdCwgJ2Fzc2lnbicpID8gcChPYmplY3QsICdhc3NpZ24nKSA6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IDE7IGMgPCBhcmd1bWVudHMubGVuZ3RoOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhcmd1bWVudHNbY107CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSBpbiBkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHgoZCwgZSkgJiYgKGFbZV0gPSBkW2VdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICByKCdPYmplY3QuYXNzaWduJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhIHx8IHNhOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHIoJ0FycmF5LnByb3RvdHlwZS5maW5kJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgaW5zdGFuY2VvZiBTdHJpbmcgJiYgKGQgPSBTdHJpbmcoZCkpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gZC5sZW5ndGgsIGYgPSAwOyBmIDwgZTsgZisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGRbZl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYi5jYWxsKGMsIGgsIGYsIGQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgcignV2Vha01hcCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKCkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSB0eXBlb2YgaDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT09IGcgJiYgbnVsbCAhPT0gaCB8fCAnZnVuY3Rpb24nID09PSBnOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8ICFPYmplY3Quc2VhbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gT2JqZWN0LnNlYWwoe30pLCBnID0gT2JqZWN0LnNlYWwoe30pLCBrID0gbmV3IGEoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMiAhPSBrLmdldChoKSB8fCAzICE9IGsuZ2V0KGcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsuZGVsZXRlKGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgay5zZXQoZywgNCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWsuaGFzKGgpICYmIDQgPT0gay5nZXQoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIHZhciBkID0gJyRqc2NvbXBfaGlkZGVuXycgKyBNYXRoLnJhbmRvbSgpLCBlID0gMCwgZiA9IGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IChlICs9IE1hdGgucmFuZG9tKCkgKyAxKS50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IHQoaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBnOyAhKGcgPSBoLm5leHQoKSkuZG9uZTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGcudmFsdWUsIHRoaXMuc2V0KGdbMF0sIGdbMV0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGYucHJvdG90eXBlLnNldCA9IGZ1bmN0aW9uIChoLCBnKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFjKGgpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignSW52YWxpZCBXZWFrTWFwIGtleScpOwogICAgICAgICAgICAgICAgICAgIGlmICgheChoLCBkKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IG5ldyBiKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhKGgsIGQsIHsgdmFsdWU6IGsgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICgheChoLCBkKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1dlYWtNYXAga2V5IGZhaWw6ICcgKyBoKTsKICAgICAgICAgICAgICAgICAgICBoW2RdW3RoaXMuZ10gPSBnOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGYucHJvdG90eXBlLmdldCA9IGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoaCkgJiYgeChoLCBkKSA/IGhbZF1bdGhpcy5nXSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmLnByb3RvdHlwZS5oYXMgPSBmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjKGgpICYmIHgoaCwgZCkgJiYgeChoW2RdLCB0aGlzLmcpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGYucHJvdG90eXBlLmRlbGV0ZSA9IGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoaCkgJiYgeChoLCBkKSAmJiB4KGhbZF0sIHRoaXMuZykgPyBkZWxldGUgaFtkXVt0aGlzLmddIDogITE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgcignTWFwJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYSB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBhIHx8ICFhLnByb3RvdHlwZS5lbnRyaWVzIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIE9iamVjdC5zZWFsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBPYmplY3Quc2VhbCh7IHg6IDQgfSksIGsgPSBuZXcgYSh0KFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3MnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3MnICE9IGsuZ2V0KGcpIHx8IDEgIT0gay5zaXplIHx8IGsuZ2V0KHsgeDogNCB9KSB8fCBrLnNldCh7IHg6IDQgfSwgJ3QnKSAhPSBrIHx8IDIgIT0gay5zaXplKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gay5lbnRyaWVzKCksIG4gPSBsLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmRvbmUgfHwgbi52YWx1ZVswXSAhPSBnIHx8ICdzJyAhPSBuLnZhbHVlWzFdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBsLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmRvbmUgfHwgNCAhPSBuLnZhbHVlWzBdLnggfHwgJ3QnICE9IG4udmFsdWVbMV0gfHwgIWwubmV4dCgpLmRvbmUgPyAhMSA6ICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KCkpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB2YXIgYiA9IG5ldyBtLldlYWtNYXAoKSwgYyA9IGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBmKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2l6ZSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gdChnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGs7ICEoayA9IGcubmV4dCgpKS5kb25lOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrID0gay52YWx1ZSwgdGhpcy5zZXQoa1swXSwga1sxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuc2V0ID0gZnVuY3Rpb24gKGcsIGspIHsKICAgICAgICAgICAgICAgICAgICBnID0gMCA9PT0gZyA/IDAgOiBnOwogICAgICAgICAgICAgICAgICAgIHZhciBsID0gZCh0aGlzLCBnKTsKICAgICAgICAgICAgICAgICAgICBsLmxpc3QgfHwgKGwubGlzdCA9IHRoaXMuaFtsLmlkXSA9IFtdKTsKICAgICAgICAgICAgICAgICAgICBsLm0gPyBsLm0udmFsdWUgPSBrIDogKGwubSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogdGhpcy5nLAogICAgICAgICAgICAgICAgICAgICAgICB1OiB0aGlzLmcudSwKICAgICAgICAgICAgICAgICAgICAgICAgaGVhZDogdGhpcy5nLAogICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGcsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBrCiAgICAgICAgICAgICAgICAgICAgfSwgbC5saXN0LnB1c2gobC5tKSwgdGhpcy5nLnUubmV4dCA9IGwubSwgdGhpcy5nLnUgPSBsLm0sIHRoaXMuc2l6ZSsrKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBjLnByb3RvdHlwZS5kZWxldGUgPSBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIGcgPSBkKHRoaXMsIGcpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBnLm0gJiYgZy5saXN0ID8gKGcubGlzdC5zcGxpY2UoZy5pbmRleCwgMSksIGcubGlzdC5sZW5ndGggfHwgZGVsZXRlIHRoaXMuaFtnLmlkXSwgZy5tLnUubmV4dCA9IGcubS5uZXh0LCBnLm0ubmV4dC51ID0gZy5tLnUsIGcubS5oZWFkID0gbnVsbCwgdGhpcy5zaXplLS0sICEwKSA6ICExOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLmNsZWFyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IHt9OwogICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IHRoaXMuZy51ID0gZigpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuc2l6ZSA9IDA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuaGFzID0gZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFkKHRoaXMsIGcpLm07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuZ2V0ID0gZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGcgPSBkKHRoaXMsIGcpLm0pICYmIGcudmFsdWU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuZW50cmllcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0aGlzLCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5rZXksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLnZhbHVlCiAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUua2V5cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0aGlzLCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5rZXk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUudmFsdWVzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHRoaXMsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLmZvckVhY2ggPSBmdW5jdGlvbiAoZywgaykgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGwgPSB0aGlzLmVudHJpZXMoKSwgbjsgIShuID0gbC5uZXh0KCkpLmRvbmU7KQogICAgICAgICAgICAgICAgICAgICAgICBuID0gbi52YWx1ZSwgZy5jYWxsKGssIG5bMV0sIG5bMF0sIHRoaXMpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlW3AobS5TeW1ib2wsICdpdGVyYXRvcicpXSA9IGMucHJvdG90eXBlLmVudHJpZXM7CiAgICAgICAgICAgICAgICB2YXIgZCA9IGZ1bmN0aW9uIChnLCBrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gayAmJiB0eXBlb2YgazsKICAgICAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT0gbCB8fCAnZnVuY3Rpb24nID09IGwgPyBiLmhhcyhrKSA/IGwgPSBiLmdldChrKSA6IChsID0gJycgKyArK2gsIGIuc2V0KGssIGwpKSA6IGwgPSAncF8nICsgazsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBnLmhbbF07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuICYmIHgoZy5oLCBsKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZyA9IDA7IGcgPCBuLmxlbmd0aDsgZysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHEgPSBuW2ddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChrICE9PSBrICYmIHEua2V5ICE9PSBxLmtleSB8fCBrID09PSBxLmtleSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlzdDogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbTogcQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0OiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IC0xLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbTogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgZSA9IGZ1bmN0aW9uIChnLCBrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gZy5nOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamEoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbC5oZWFkICE9IGcuZzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBsLnU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGwubmV4dCAhPSBsLmhlYWQ7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbCA9IGwubmV4dCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogayhsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy51ID0gZy5uZXh0ID0gZy5oZWFkID0gZzsKICAgICAgICAgICAgICAgICAgICB9LCBoID0gMDsKICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHZhciB0YSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYSBpbnN0YW5jZW9mIFN0cmluZyAmJiAoYSArPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAwLCBkID0gITEsIGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFkICYmIGMgPCBhLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGMrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBiKGYsIGFbZl0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBlW3AobS5TeW1ib2wsICdpdGVyYXRvcicpXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0sIHVhID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBhKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdUaGUgXCd0aGlzXCcgdmFsdWUgZm9yIFN0cmluZy5wcm90b3R5cGUuJyArIGMgKyAnIG11c3Qgbm90IGJlIG51bGwgb3IgdW5kZWZpbmVkJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGIgaW5zdGFuY2VvZiBSZWdFeHApCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ZpcnN0IGFyZ3VtZW50IHRvIFN0cmluZy5wcm90b3R5cGUuJyArIGMgKyAnIG11c3Qgbm90IGJlIGEgcmVndWxhciBleHByZXNzaW9uJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgKyAnJzsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHIoJ1N0cmluZy5wcm90b3R5cGUuc3RhcnRzV2l0aCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gdWEodGhpcywgYiwgJ3N0YXJ0c1dpdGgnKSwgZSA9IGQubGVuZ3RoLCBmID0gYi5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgYyA9IE1hdGgubWF4KDAsIE1hdGgubWluKGMgfCAwLCBkLmxlbmd0aCkpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGggPSAwOyBoIDwgZiAmJiBjIDwgZTspCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkW2MrK10gIT0gYltoKytdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBoID49IGY7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHIoJ1N0cmluZy5wcm90b3R5cGUucmVwZWF0JywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB1YSh0aGlzLCBudWxsLCAncmVwZWF0Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPiBiIHx8IDEzNDIxNzcyNzkgPCBiKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcignSW52YWxpZCBjb3VudCB2YWx1ZScpOwogICAgICAgICAgICAgICAgICAgIGIgfD0gMDsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gJyc7IGI7KQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiAmIDEgJiYgKGQgKz0gYyksIGIgPj4+PSAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyArPSBjOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICByKCdnbG9iYWxUaGlzJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhIHx8IGVhOwogICAgICAgICAgICB9LCAnZXNfMjAyMCcpOwogICAgICAgICAgICByKCdTZXQnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIGEgfHwgIWEucHJvdG90eXBlLmVudHJpZXMgfHwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgT2JqZWN0LnNlYWwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IE9iamVjdC5zZWFsKHsgeDogNCB9KSwgZCA9IG5ldyBhKHQoW2NdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWQuaGFzKGMpIHx8IDEgIT0gZC5zaXplIHx8IGQuYWRkKGMpICE9IGQgfHwgMSAhPSBkLnNpemUgfHwgZC5hZGQoeyB4OiA0IH0pICE9IGQgfHwgMiAhPSBkLnNpemUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkLmVudHJpZXMoKSwgZiA9IGUubmV4dCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYuZG9uZSB8fCBmLnZhbHVlWzBdICE9IGMgfHwgZi52YWx1ZVsxXSAhPSBjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBlLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmLmRvbmUgfHwgZi52YWx1ZVswXSA9PSBjIHx8IDQgIT0gZi52YWx1ZVswXS54IHx8IGYudmFsdWVbMV0gIT0gZi52YWx1ZVswXSA/ICExIDogZS5uZXh0KCkuZG9uZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSgpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgdmFyIGIgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IG5ldyBtLk1hcCgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSB0KGMpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkOyAhKGQgPSBjLm5leHQoKSkuZG9uZTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZChkLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zaXplID0gdGhpcy5nLnNpemU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gMCA9PT0gYyA/IDAgOiBjOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZy5zZXQoYywgYyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zaXplID0gdGhpcy5nLnNpemU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuZGVsZXRlID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gdGhpcy5nLmRlbGV0ZShjKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNpemUgPSB0aGlzLmcuc2l6ZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS5jbGVhciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcuY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNpemUgPSAwOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLmhhcyA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZy5oYXMoYyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuZW50cmllcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5nLmVudHJpZXMoKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS52YWx1ZXMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAodGhpcy5nLCAndmFsdWVzJykuY2FsbCh0aGlzLmcpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLmtleXMgPSBwKGIucHJvdG90eXBlLCAndmFsdWVzJyk7CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZVtwKG0uU3ltYm9sLCAnaXRlcmF0b3InKV0gPSBwKGIucHJvdG90eXBlLCAndmFsdWVzJyk7CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS5mb3JFYWNoID0gZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nLmZvckVhY2goZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuY2FsbChkLCBmLCBmLCBlKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICByKCdTdHJpbmcucHJvdG90eXBlLnBhZFN0YXJ0JywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB1YSh0aGlzLCBudWxsLCAncGFkU3RhcnQnKTsKICAgICAgICAgICAgICAgICAgICBiIC09IGQubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIGMgPSB2b2lkIDAgIT09IGMgPyBTdHJpbmcoYykgOiAnICc7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICgwIDwgYiAmJiBjID8gcChjLCAncmVwZWF0JykuY2FsbChjLCBNYXRoLmNlaWwoYiAvIGMubGVuZ3RoKSkuc3Vic3RyaW5nKDAsIGIpIDogJycpICsgZDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczgnKTsKICAgICAgICAgICAgcignQXJyYXkucHJvdG90eXBlLmtleXMnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhIDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0YSh0aGlzLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgcignQXJyYXkucHJvdG90eXBlLnZhbHVlcycsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRhKHRoaXMsIGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzOCcpOwogICAgICAgICAgICByKCdPYmplY3QuaXMnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhIDogZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiA9PT0gYyA/IDAgIT09IGIgfHwgMSAvIGIgPT09IDEgLyBjIDogYiAhPT0gYiAmJiBjICE9PSBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICByKCdBcnJheS5wcm90b3R5cGUuaW5jbHVkZXMnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhIDogZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgZCBpbnN0YW5jZW9mIFN0cmluZyAmJiAoZCA9IFN0cmluZyhkKSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICBjID0gYyB8fCAwOwogICAgICAgICAgICAgICAgICAgIGZvciAoMCA+IGMgJiYgKGMgPSBNYXRoLm1heChjICsgZSwgMCkpOyBjIDwgZTsgYysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gZFtjXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYgPT09IGIgfHwgcChPYmplY3QsICdpcycpLmNhbGwoT2JqZWN0LCBmLCBiKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzNycpOwogICAgICAgICAgICByKCdTdHJpbmcucHJvdG90eXBlLmluY2x1ZGVzJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xICE9PSB1YSh0aGlzLCBiLCAnaW5jbHVkZXMnKS5pbmRleE9mKGIsIGMgfHwgMCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHZhciB6ID0gdGhpcyB8fCBzZWxmLCB2YSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IGEuc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0geiwgYyA9IDA7IGMgPCBhLmxlbmd0aDsgYysrKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IGJbYVtjXV0sIG51bGwgPT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSwgeWEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgd2EpICYmIGFbd2FdIHx8IChhW3dhXSA9ICsreGEpOwogICAgICAgICAgICAgICAgfSwgd2EgPSAnY2xvc3VyZV91aWRfJyArICgxMDAwMDAwMDAwICogTWF0aC5yYW5kb20oKSA+Pj4gMCksIHhhID0gMCwgemEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSBhLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB6OwogICAgICAgICAgICAgICAgICAgIGFbMF0gaW4gYyB8fCAndW5kZWZpbmVkJyA9PSB0eXBlb2YgYy5leGVjU2NyaXB0IHx8IGMuZXhlY1NjcmlwdCgndmFyICcgKyBhWzBdKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkOyBhLmxlbmd0aCAmJiAoZCA9IGEuc2hpZnQoKSk7KQogICAgICAgICAgICAgICAgICAgICAgICBhLmxlbmd0aCB8fCB2b2lkIDAgPT09IGIgPyBjW2RdICYmIGNbZF0gIT09IE9iamVjdC5wcm90b3R5cGVbZF0gPyBjID0gY1tkXSA6IGMgPSBjW2RdID0ge30gOiBjW2RdID0gYjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBBYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC9eW1xzXHhhMF0qKFtcc1xTXSo/KVtcc1x4YTBdKiQvLmV4ZWMoYSlbMV07CiAgICAgICAgICAgICAgICB9LCBJYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFCYS50ZXN0KGEpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAtMSAhPSBhLmluZGV4T2YoJyYnKSAmJiAoYSA9IGEucmVwbGFjZShDYSwgJyZhbXA7JykpOwogICAgICAgICAgICAgICAgICAgIC0xICE9IGEuaW5kZXhPZignPCcpICYmIChhID0gYS5yZXBsYWNlKERhLCAnJmx0OycpKTsKICAgICAgICAgICAgICAgICAgICAtMSAhPSBhLmluZGV4T2YoJz4nKSAmJiAoYSA9IGEucmVwbGFjZShFYSwgJyZndDsnKSk7CiAgICAgICAgICAgICAgICAgICAgLTEgIT0gYS5pbmRleE9mKCciJykgJiYgKGEgPSBhLnJlcGxhY2UoRmEsICcmcXVvdDsnKSk7CiAgICAgICAgICAgICAgICAgICAgLTEgIT0gYS5pbmRleE9mKCdcJycpICYmIChhID0gYS5yZXBsYWNlKEdhLCAnJiMzOTsnKSk7CiAgICAgICAgICAgICAgICAgICAgLTEgIT0gYS5pbmRleE9mKCdcMCcpICYmIChhID0gYS5yZXBsYWNlKEhhLCAnJiMwOycpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0sIENhID0gLyYvZywgRGEgPSAvPC9nLCBFYSA9IC8+L2csIEZhID0gLyIvZywgR2EgPSAvJy9nLCBIYSA9IC9ceDAwL2csIEJhID0gL1tceDAwJjw+IiddLywgTGEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gMDsKICAgICAgICAgICAgICAgICAgICBhID0gQWEoU3RyaW5nKGEpKS5zcGxpdCgnLicpOwogICAgICAgICAgICAgICAgICAgIGIgPSBBYShTdHJpbmcoYikpLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IE1hdGgubWF4KGEubGVuZ3RoLCBiLmxlbmd0aCksIGUgPSAwOyAwID09IGMgJiYgZSA8IGQ7IGUrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGFbZV0gfHwgJycsIGggPSBiW2VdIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gLyhcZCopKFxEKikoLiopLy5leGVjKGYpIHx8IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSAvKFxkKikoXEQqKSguKikvLmV4ZWMoaCkgfHwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT0gZlswXS5sZW5ndGggJiYgMCA9PSBoWzBdLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBLYSgwID09IGZbMV0ubGVuZ3RoID8gMCA6IHBhcnNlSW50KGZbMV0sIDEwKSwgMCA9PSBoWzFdLmxlbmd0aCA/IDAgOiBwYXJzZUludChoWzFdLCAxMCkpIHx8IEthKDAgPT0gZlsyXS5sZW5ndGgsIDAgPT0gaFsyXS5sZW5ndGgpIHx8IEthKGZbMl0sIGhbMl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGZbM107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gaFszXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoMCA9PSBjKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9LCBLYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPCBiID8gLTEgOiBhID4gYiA/IDEgOiAwOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gTWEoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHoubmF2aWdhdG9yOwogICAgICAgICAgICAgICAgcmV0dXJuIGEgJiYgKGEgPSBhLnVzZXJBZ2VudCkgPyBhIDogJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gTmEoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIC0xICE9IE1hKCkuaW5kZXhPZihhKTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBPYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgQXJyYXkucHJvdG90eXBlLmZvckVhY2guY2FsbChhLCBiLCB2b2lkIDApOwogICAgICAgICAgICAgICAgfSwgUGEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5wcm90b3R5cGUuZmlsdGVyLmNhbGwoYSwgYiwgdm9pZCAwKTsKICAgICAgICAgICAgICAgIH0sIFFhID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkucHJvdG90eXBlLm1hcC5jYWxsKGEsIGIsIHZvaWQgMCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBSYShhLCBiKSB7CiAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IGEubGVuZ3RoLCBkID0gJ3N0cmluZycgPT09IHR5cGVvZiBhID8gYS5zcGxpdCgnJykgOiBhLCBlID0gMDsgZSA8IGM7IGUrKykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgaW4gZCAmJiBiLmNhbGwodm9pZCAwLCBkW2VdLCBlLCBhKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYiA9IC0xOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIDAgPiBiID8gbnVsbCA6ICdzdHJpbmcnID09PSB0eXBlb2YgYSA/IGEuY2hhckF0KGIpIDogYVtiXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBTYShhLCBiKSB7CiAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9ICdzdHJpbmcnID09PSB0eXBlb2YgYSA/IGEuc3BsaXQoJycpIDogYSwgZCA9IGEubGVuZ3RoIC0gMTsgMCA8PSBkOyBkLS0pCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkIGluIGMgJiYgYi5jYWxsKHZvaWQgMCwgY1tkXSwgZCwgYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGIgPSAtMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiAwID4gYiA/IG51bGwgOiAnc3RyaW5nJyA9PT0gdHlwZW9mIGEgPyBhLmNoYXJBdChiKSA6IGFbYl07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gVGEoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIDAgPD0gQXJyYXkucHJvdG90eXBlLmluZGV4T2YuY2FsbChhLCBiLCB2b2lkIDApOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgdmFyIFVhID0ge30sIFZhID0gbnVsbCwgWGEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gW107CiAgICAgICAgICAgICAgICAgICAgV2EoYSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYi5wdXNoKGMpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSwgV2EgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoaykgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZCA8IGEubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBhLmNoYXJBdChkKyspLCBuID0gVmFbbF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEvXltcc1x4YTBdKiQvLnRlc3QobCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1Vua25vd24gYmFzZTY0IGVuY29kaW5nIGF0IGNoYXI6ICcgKyBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgWWEoKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gMDs7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYygtMSksIGYgPSBjKDApLCBoID0gYyg2NCksIGcgPSBjKDY0KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDY0ID09PSBnICYmIC0xID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGIoZSA8PCAyIHwgZiA+PiA0KTsKICAgICAgICAgICAgICAgICAgICAgICAgNjQgIT0gaCAmJiAoYihmIDw8IDQgJiAyNDAgfCBoID4+IDIpLCA2NCAhPSBnICYmIGIoaCA8PCA2ICYgMTkyIHwgZykpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIFlhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGlmICghVmEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgVmEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9ICdBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OScuc3BsaXQoJycpLCBiID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnKy89JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJysvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy1fPScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICctXy4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLV8nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgYyA9IDA7IDUgPiBjOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gYS5jb25jYXQoYltjXS5zcGxpdCgnJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgVWFbY10gPSBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IDA7IGUgPCBkLmxlbmd0aDsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBkW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gVmFbZl0gJiYgKFZhW2ZdID0gZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWmEgPSAnZnVuY3Rpb24nID09PSB0eXBlb2YgVWludDhBcnJheTsKICAgICAgICAgICAgdmFyICRhID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIG0uU3ltYm9sICYmICdzeW1ib2wnID09PSB0eXBlb2YgKDAsIG0uU3ltYm9sKSgpID8gKDAsIG0uU3ltYm9sKSh2b2lkIDApIDogdm9pZCAwOwogICAgICAgICAgICBmdW5jdGlvbiBhYihhKSB7CiAgICAgICAgICAgICAgICBPYmplY3QuaXNGcm96ZW4oYSkgfHwgKCRhID8gYVskYV0gfD0gMSA6IHZvaWQgMCAhPT0gYS5nID8gYS5nIHw9IDEgOiBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhhLCB7CiAgICAgICAgICAgICAgICAgICAgZzogewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgZnVuY3Rpb24gYmIoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGEgJiYgJ29iamVjdCcgPT09IHR5cGVvZiBhICYmICFBcnJheS5pc0FycmF5KGEpICYmIGEuY29uc3RydWN0b3IgPT09IE9iamVjdDsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgY2I7CiAgICAgICAgICAgIGZ1bmN0aW9uIGRiKGEpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodHlwZW9mIGEpIHsKICAgICAgICAgICAgICAgIGNhc2UgJ251bWJlcic6CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlzRmluaXRlKGEpID8gYSA6IFN0cmluZyhhKTsKICAgICAgICAgICAgICAgIGNhc2UgJ29iamVjdCc6CiAgICAgICAgICAgICAgICAgICAgaWYgKGEgJiYgIUFycmF5LmlzQXJyYXkoYSkgJiYgWmEgJiYgbnVsbCAhPSBhICYmIGEgaW5zdGFuY2VvZiBVaW50OEFycmF5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGIgJiYgKGIgPSAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgWWEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IFVhW2JdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gQXJyYXkoTWF0aC5mbG9vcihhLmxlbmd0aCAvIDMpKSwgZCA9IGJbNjRdIHx8ICcnLCBlID0gMCwgZiA9IDA7IGUgPCBhLmxlbmd0aCAtIDI7IGUgKz0gMykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBhW2VdLCBnID0gYVtlICsgMV0sIGsgPSBhW2UgKyAyXSwgbCA9IGJbaCA+PiAyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBiWyhoICYgMykgPDwgNCB8IGcgPj4gNF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gYlsoZyAmIDE1KSA8PCAyIHwgayA+PiA2XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsgPSBiW2sgJiA2M107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjW2YrK10gPSBsICsgaCArIGcgKyBrOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGwgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICBrID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChhLmxlbmd0aCAtIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGFbZSArIDFdLCBrID0gYlsobCAmIDE1KSA8PCAyXSB8fCBkOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gYVtlXSwgY1tmXSA9IGJbYSA+PiAyXSArIGJbKGEgJiAzKSA8PCA0IHwgbCA+PiA0XSArIGsgKyBkOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmpvaW4oJycpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgZnVuY3Rpb24gZWIoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShhKSB8fCBiYihhKSA/IGZiKGEsIGIpIDogYihhKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBmYihhLCBiKSB7CiAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShhKSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBBcnJheShhLmxlbmd0aCksIGQgPSAwOyBkIDwgYS5sZW5ndGg7IGQrKykKICAgICAgICAgICAgICAgICAgICAgICAgY1tkXSA9IGViKGFbZF0sIGIpOwogICAgICAgICAgICAgICAgICAgIGlmIChiID0gQXJyYXkuaXNBcnJheShhKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZTsKICAgICAgICAgICAgICAgICAgICAgICAgJGEgPyBlID0gYVskYV0gOiBlID0gYS5nOwogICAgICAgICAgICAgICAgICAgICAgICBiID0gKG51bGwgPT0gZSA/IDAgOiBlKSAmIDE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGIgJiYgYWIoYyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlID0ge307CiAgICAgICAgICAgICAgICBmb3IgKGMgaW4gYSkKICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgYykgJiYgKGVbY10gPSBlYihhW2NdLCBiKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBnYihhKSB7CiAgICAgICAgICAgICAgICBpZiAoYSAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgYSAmJiBhLnRvSlNPTikKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS50b0pTT04oKTsKICAgICAgICAgICAgICAgIGEgPSBkYihhKTsKICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5pc0FycmF5KGEpID8gZmIoYSwgZ2IpIDogYTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBoYjsKICAgICAgICAgICAgdmFyIEEgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gaGI7CiAgICAgICAgICAgICAgICAgICAgaGIgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGEgfHwgKGEgPSBkKTsKICAgICAgICAgICAgICAgICAgICBkID0gdGhpcy5jb25zdHJ1Y3Rvci5tZXNzYWdlSWQ7CiAgICAgICAgICAgICAgICAgICAgYSB8fCAoYSA9IGQgPyBbZF0gOiBbXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pID0gKGQgPyAwIDogLTEpIC0gKHRoaXMuY29uc3RydWN0b3Iud2EgfHwgMCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IGE7CiAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICBkID0gdGhpcy5oLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGQgLSAxOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiAoZCA9IHRoaXMuaFthXSwgYmIoZCkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmwgPSBhIC0gdGhpcy5pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBiICYmIC0xIDwgYiA/ICh0aGlzLmwgPSBNYXRoLm1heChiLCBhICsgMSAtIHRoaXMuaSksIHRoaXMuaiA9IHZvaWQgMCkgOiB0aGlzLmwgPSBOdW1iZXIuTUFYX1ZBTFVFOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChiID0gMDsgYiA8IGMubGVuZ3RoOyBiKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IGNbYl0sIGEgPCB0aGlzLmwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSArPSB0aGlzLmksIChkID0gdGhpcy5oW2FdKSA/IEFycmF5LmlzQXJyYXkoZCkgJiYgYWIoZCkgOiB0aGlzLmhbYV0gPSBrYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSB0aGlzLmogfHwgKHRoaXMuaiA9IHRoaXMuaFt0aGlzLmwgKyB0aGlzLmldID0ge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZFthXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID8gQXJyYXkuaXNBcnJheShlKSAmJiBhYihlKSA6IGRbYV0gPSBrYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGtiID0gT2JqZWN0LmZyZWV6ZShhYihbXSkpLCBCID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgPT09IGIgPyBudWxsIDogYiA+PSBhLmwgPyBhLmogPyBhLmpbYl0gOiB2b2lkIDAgOiAodm9pZCAwID09PSBjID8gMCA6IGMpICYmIGEuaiAmJiAoYyA9IGEualtiXSwgbnVsbCAhPSBjKSA/IGMgOiBhLmhbYiArIGEuaV07CiAgICAgICAgICAgICAgICB9LCBsYiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/ICExIDogYzsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IEIoYSwgYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSBkICYmIChkID0ga2IpOwogICAgICAgICAgICAgICAgICAgIGQgPT09IGtiICYmIChkID0gYWIoZC5zbGljZSgpKSwgQyhhLCBiLCBkLCBjKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICB9LCBEID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBhID0gQihhLCBiKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBhID8gYyA6IGE7CiAgICAgICAgICAgICAgICB9LCBtYiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IEIoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgYSA9IG51bGwgPT0gYSA/IGEgOiAhIWE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gYSA/ICExIDogYTsKICAgICAgICAgICAgICAgIH0sIG5iID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBhID0gQihhLCBiKTsKICAgICAgICAgICAgICAgICAgICBhID0gbnVsbCA9PSBhID8gYSA6ICthOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGEgPyB2b2lkIDAgPT09IGMgPyAwIDogYyA6IGE7CiAgICAgICAgICAgICAgICB9LCBDID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICAodm9pZCAwID09PSBkID8gMCA6IGQpIHx8IGIgPj0gYS5sID8gKGEuaiB8fCAoYS5qID0gYS5oW2EubCArIGEuaV0gPSB7fSkpW2JdID0gYyA6IGEuaFtiICsgYS5pXSA9IGM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9LCBvYiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB2b2lkIDAgPT09IGQgPyAhMSA6IGQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMoYSwgYiwgbnVsbCA9PSBjID8gYWIoW10pIDogQXJyYXkuaXNBcnJheShjKSA/IGFiKGMpIDogYywgZCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBGKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIDAgIT09IGMgPyBDKGEsIGIsIGMpIDogQyhhLCBiLCB2b2lkIDAsICExKTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBwYiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgKGMgPSBHKGEsIGMpKSAmJiBjICE9PSBiICYmIG51bGwgIT0gZCAmJiAoYS5nICYmIGMgaW4gYS5nICYmIChhLmdbY10gPSB2b2lkIDApLCBDKGEsIGMsIHZvaWQgMCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBDKGEsIGIsIGQpOwogICAgICAgICAgICAgICAgfSwgRyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IDAsIGQgPSAwOyBkIDwgYi5sZW5ndGg7IGQrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGJbZF07CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT0gQihhLCBlKSAmJiAoMCAhPT0gYyAmJiBDKGEsIGMsIHZvaWQgMCwgITEpLCBjID0gZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSwgSCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKC0xID09PSBjKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICBhLmcgfHwgKGEuZyA9IHt9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGEuZ1tjXTsKICAgICAgICAgICAgICAgICAgICBpZiAoZCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBCKGEsIGMsICExKTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgICAgICBiID0gbmV3IGIoZSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuZ1tjXSA9IGI7CiAgICAgICAgICAgICAgICB9LCBJID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBhLmcgfHwgKGEuZyA9IHt9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGEuZ1tjXTsKICAgICAgICAgICAgICAgICAgICBpZiAoIWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBsYihhLCBjLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiA9IDA7IGYgPCBlLmxlbmd0aDsgZisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZFtmXSA9IG5ldyBiKGVbZl0pOwogICAgICAgICAgICAgICAgICAgICAgICBhLmdbY10gPSBkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgIH0sIHFiID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZDsKICAgICAgICAgICAgICAgICAgICBhLmcgfHwgKGEuZyA9IHt9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMgPyBjLmggOiBjOwogICAgICAgICAgICAgICAgICAgIGEuZ1tiXSA9IGM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMoYSwgYiwgZSwgdm9pZCAwID09PSBkID8gITEgOiBkKTsKICAgICAgICAgICAgICAgIH0sIHNiID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHJiOwogICAgICAgICAgICAgICAgICAgIGEuZyB8fCAoYS5nID0ge30pOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gYyA/IGMuaCA6IGM7CiAgICAgICAgICAgICAgICAgICAgYS5nW2JdID0gYzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGIoYSwgYiwgZCwgZSk7CiAgICAgICAgICAgICAgICB9LCB0YiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB2b2lkIDAgPT09IGQgPyAhMSA6IGQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhYihbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSAwOyBmIDwgYy5sZW5ndGg7IGYrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbZl0gPSBjW2ZdLmg7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuZyB8fCAoYS5nID0ge30pOwogICAgICAgICAgICAgICAgICAgICAgICBhLmdbYl0gPSBjOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBhLmcgJiYgKGEuZ1tiXSA9IHZvaWQgMCksIGUgPSBrYjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQyhhLCBiLCBlLCBkKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIEEucHJvdG90eXBlLnRvSlNPTiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5oOwogICAgICAgICAgICAgICAgcmV0dXJuIGNiID8gYSA6IGZiKGEsIGdiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gdWIoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIGRiKGIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciB2YiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgY2IgPSAhMDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkoYS50b0pTT04oKSwgdWIpOwogICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNiID0gITE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgd2IgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBEKGEsIGIsIHZvaWQgMCA9PT0gYyA/ICcnIDogYyk7CiAgICAgICAgICAgICAgICB9LCB4YiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IEcoYSwgYykgPT09IGIgPyBiIDogLTE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEQoYSwgYiwgMCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQWIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdGhpcy5oID0gYSA9PT0geWIgJiYgYiB8fCAnJzsKICAgICAgICAgICAgICAgIHRoaXMuaSA9IHpiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBBYi5wcm90b3R5cGUuQiA9ICEwOwogICAgICAgICAgICBBYi5wcm90b3R5cGUuZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmg7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBCYiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgaW5zdGFuY2VvZiBBYiAmJiBhLmNvbnN0cnVjdG9yID09PSBBYiAmJiBhLmkgPT09IHpiID8gYS5oIDogJ3R5cGVfZXJyb3I6Q29uc3QnOwogICAgICAgICAgICAgICAgfSwgQ2IgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQWIoeWIsIGEpOwogICAgICAgICAgICAgICAgfSwgemIgPSB7fSwgeWIgPSB7fTsKICAgICAgICAgICAgZnVuY3Rpb24gRGIoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBbXSwgYyA9IDAsIGQ7CiAgICAgICAgICAgICAgICBmb3IgKGQgaW4gYSkKICAgICAgICAgICAgICAgICAgICBiW2MrK10gPSBhW2RdOwogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgRWIgPSB7CiAgICAgICAgICAgICAgICBhcmVhOiAhMCwKICAgICAgICAgICAgICAgIGJhc2U6ICEwLAogICAgICAgICAgICAgICAgYnI6ICEwLAogICAgICAgICAgICAgICAgY29sOiAhMCwKICAgICAgICAgICAgICAgIGNvbW1hbmQ6ICEwLAogICAgICAgICAgICAgICAgZW1iZWQ6ICEwLAogICAgICAgICAgICAgICAgaHI6ICEwLAogICAgICAgICAgICAgICAgaW1nOiAhMCwKICAgICAgICAgICAgICAgIGlucHV0OiAhMCwKICAgICAgICAgICAgICAgIGtleWdlbjogITAsCiAgICAgICAgICAgICAgICBsaW5rOiAhMCwKICAgICAgICAgICAgICAgIG1ldGE6ICEwLAogICAgICAgICAgICAgICAgcGFyYW06ICEwLAogICAgICAgICAgICAgICAgc291cmNlOiAhMCwKICAgICAgICAgICAgICAgIHRyYWNrOiAhMCwKICAgICAgICAgICAgICAgIHdicjogITAKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEogPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdGhpcy5pID0gYiA9PT0gRmIgPyBhIDogJyc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEoucHJvdG90eXBlLkIgPSAhMDsKICAgICAgICAgICAgSi5wcm90b3R5cGUuZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmkudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSi5wcm90b3R5cGUuaiA9ICEwOwogICAgICAgICAgICBKLnByb3RvdHlwZS5oID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBKYiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBhID0gR2IuZXhlYyhIYihhKS50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgIHZhciBjID0gYVszXSB8fCAnJzsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgSihhWzFdICsgSWIoJz8nLCBhWzJdIHx8ICcnLCBiKSArIEliKCcjJywgYywgdm9pZCAwKSwgRmIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBKLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmkgKyAnJzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEhiID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSBpbnN0YW5jZW9mIEogJiYgYS5jb25zdHJ1Y3RvciA9PT0gSiA/IGEuaSA6ICd0eXBlX2Vycm9yOlRydXN0ZWRSZXNvdXJjZVVybCc7CiAgICAgICAgICAgICAgICB9LCBHYiA9IC9eKFtePyNdKikoXD9bXiNdKik/KCNbXHNcU10qKT8vLCBLYiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9ICcnLCBjID0gMDsgYyA8IGEubGVuZ3RoOyBjKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGIgKz0gQmIoYVtjXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBKKGIsIEZiKTsKICAgICAgICAgICAgICAgIH0sIEZiID0ge30sIEliID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBjKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT09IHR5cGVvZiBjKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyA/IGEgKyBlbmNvZGVVUklDb21wb25lbnQoYykgOiAnJzsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkIGluIGMpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYywgZCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gY1tkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBBcnJheS5pc0FycmF5KGUpID8gZSA6IFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSAwOyBmIDwgZS5sZW5ndGg7IGYrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZVtmXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IGggJiYgKGIgfHwgKGIgPSBhKSwgYiArPSAoYi5sZW5ndGggPiBhLmxlbmd0aCA/ICcmJyA6ICcnKSArIGVuY29kZVVSSUNvbXBvbmVudChkKSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudChTdHJpbmcoaCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEsgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdGhpcy5pID0gYiA9PT0gTGIgPyBhIDogJyc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEsucHJvdG90eXBlLkIgPSAhMDsKICAgICAgICAgICAgSy5wcm90b3R5cGUuZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmkudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSy5wcm90b3R5cGUuaiA9ICEwOwogICAgICAgICAgICBLLnByb3RvdHlwZS5oID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEsucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaS50b1N0cmluZygpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgTWIgPSBSZWdFeHAoJ14oPzphdWRpby8oPzozZ3BwMnwzZ3BwfGFhY3xMMTZ8bWlkaXxtcDN8bXA0fG1wZWd8b2dhfG9nZ3xvcHVzfHgtbTRhfHgtbWF0cm9za2F8eC13YXZ8d2F2fHdlYm0pfGZvbnQvXFx3K3xpbWFnZS8oPzpibXB8Z2lmfGpwZWd8anBnfHBuZ3x0aWZmfHdlYnB8eC1pY29uKXx2aWRlby8oPzptcGVnfG1wNHxvZ2d8d2VibXxxdWlja3RpbWV8eC1tYXRyb3NrYSkpKD86O1xcdys9KD86XFx3K3wiW1xcdzssPSBdKyIpKSokJywgJ2knKSwgTmIgPSAvXmRhdGE6KC4qKTtiYXNlNjQsW2EtejAtOStcL10rPSokL2ksIE9iID0gL14oPzooPzpodHRwcz98bWFpbHRvfGZ0cCk6fFteOi8/I10qKD86Wy8/I118JCkpL2ksIExiID0ge30sIFBiID0gbmV3IEsoJ2Fib3V0OmludmFsaWQjekNsb3N1cmV6JywgTGIpOwogICAgICAgICAgICB2YXIgUWIgPSB7fSwgTCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pID0gYyA9PT0gUWIgPyBhIDogJyc7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gYjsKICAgICAgICAgICAgICAgICAgICB0aGlzLkIgPSB0aGlzLmogPSAhMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIEwucHJvdG90eXBlLmggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5sOwogICAgICAgICAgICB9OwogICAgICAgICAgICBMLnByb3RvdHlwZS5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaS50b1N0cmluZygpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBMLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmkudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFJiID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSBpbnN0YW5jZW9mIEwgJiYgYS5jb25zdHJ1Y3RvciA9PT0gTCA/IGEuaSA6ICd0eXBlX2Vycm9yOlNhZmVIdG1sJzsKICAgICAgICAgICAgICAgIH0sIFNiID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYSBpbnN0YW5jZW9mIEwpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgIHZhciBiID0gJ29iamVjdCcgPT0gdHlwZW9mIGEsIGMgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGIgJiYgYS5qICYmIChjID0gYS5oKCkpOwogICAgICAgICAgICAgICAgICAgIGEgPSBJYShiICYmIGEuQiA/IGEuZygpIDogU3RyaW5nKGEpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwoYSwgYywgUWIpOwogICAgICAgICAgICAgICAgfSwgV2IgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0geyBzcmM6IGEgfSwgZCA9IHt9OwogICAgICAgICAgICAgICAgICAgIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlIGluIGMpCiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChjLCBlKSAmJiAoYVtlXSA9IGNbZV0pOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgaW4gZCkKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGQsIGYpICYmIChhW2ZdID0gZFtmXSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGIpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGggaW4gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYiwgaCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gaC50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIGluIGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlIGluIGQgJiYgZGVsZXRlIGFbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtoXSA9IGJbaF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGc7CiAgICAgICAgICAgICAgICAgICAgYiA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgaCA9ICcnOwogICAgICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGsgaW4gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgaykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVRiLnRlc3QoaykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gYVtrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCBpbnN0YW5jZW9mIEFiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IEJiKGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3R5bGUnID09IGMudG9Mb3dlckNhc2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoL15vbi9pLnRlc3QoYykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMudG9Mb3dlckNhc2UoKSBpbiBVYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCBpbnN0YW5jZW9mIEopCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBIYihkKS50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGQgaW5zdGFuY2VvZiBLKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gZCBpbnN0YW5jZW9mIEsgJiYgZC5jb25zdHJ1Y3RvciA9PT0gSyA/IGQuaSA6ICd0eXBlX2Vycm9yOlNhZmVVcmwnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCdzdHJpbmcnID09PSB0eXBlb2YgZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCBpbnN0YW5jZW9mIEsgfHwgKGQgPSAnb2JqZWN0JyA9PSB0eXBlb2YgZCAmJiBkLkIgPyBkLmcoKSA6IFN0cmluZyhkKSwgT2IudGVzdChkKSA/IGQgPSBuZXcgSyhkLCBMYikgOiAoZCA9IFN0cmluZyhkKSwgZCA9IGQucmVwbGFjZSgvKCUwQXwlMEQpL2csICcnKSwgZCA9IChlID0gZC5tYXRjaChOYikpICYmIE1iLnRlc3QoZVsxXSkgPyBuZXcgSyhkLCBMYikgOiBudWxsKSksIGQgPSAoZCB8fCBQYikuZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQuQiAmJiAoZCA9IGQuZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMgKyAnPSInICsgSWEoU3RyaW5nKGQpKSArICciJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCArPSAnICcgKyBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgayA9ICc8c2NyaXB0JyArIGg7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSBnID8gZyA9IFtdIDogQXJyYXkuaXNBcnJheShnKSB8fCAoZyA9IFtnXSk7CiAgICAgICAgICAgICAgICAgICAgITAgPT09IEViLnNjcmlwdCA/IGsgKz0gJz4nIDogKGcgPSBWYihnKSwgayArPSAnPicgKyBSYihnKS50b1N0cmluZygpICsgJzwvc2NyaXB0PicsIGIgPSBnLmgoKSk7CiAgICAgICAgICAgICAgICAgICAgKGEgPSBhICYmIGEuZGlyKSAmJiAoL14obHRyfHJ0bHxhdXRvKSQvaS50ZXN0KGEpID8gYiA9IDAgOiBiID0gbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBMKGssIGIsIFFiKTsKICAgICAgICAgICAgICAgIH0sIFliID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IFNiKFhiKSwgYyA9IGIuaCgpLCBkID0gW10sIGUgPSBmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShmKSA/IGYuZm9yRWFjaChlKSA6IChmID0gU2IoZiksIGQucHVzaChSYihmKS50b1N0cmluZygpKSwgZiA9IGYuaCgpLCAwID09IGMgPyBjID0gZiA6IDAgIT0gZiAmJiBjICE9IGYgJiYgKGMgPSBudWxsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYS5mb3JFYWNoKGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTChkLmpvaW4oUmIoYikudG9TdHJpbmcoKSksIGMsIFFiKTsKICAgICAgICAgICAgICAgIH0sIFZiID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gWWIoQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKSk7CiAgICAgICAgICAgICAgICB9LCBUYiA9IC9eW2EtekEtWjAtOS1dKyQvLCBVYiA9IHsKICAgICAgICAgICAgICAgICAgICBhY3Rpb246ICEwLAogICAgICAgICAgICAgICAgICAgIGNpdGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGRhdGE6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcm1hY3Rpb246ICEwLAogICAgICAgICAgICAgICAgICAgIGhyZWY6ICEwLAogICAgICAgICAgICAgICAgICAgIG1hbmlmZXN0OiAhMCwKICAgICAgICAgICAgICAgICAgICBwb3N0ZXI6ICEwLAogICAgICAgICAgICAgICAgICAgIHNyYzogITAKICAgICAgICAgICAgICAgIH0sIFhiID0gbmV3IEwoei50cnVzdGVkVHlwZXMgJiYgei50cnVzdGVkVHlwZXMuZW1wdHlIVE1MIHx8ICcnLCAwLCBRYik7CiAgICAgICAgICAgIHZhciBaYiA9IHt9OwogICAgICAgICAgICBmdW5jdGlvbiAkYigpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiB3aW5kb3cgPyB3aW5kb3cudHJ1c3RlZFR5cGVzIDogdm9pZCAwOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGEgJiYgdm9pZCAwICE9PSBhID8gYSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIGFjOwogICAgICAgICAgICBmdW5jdGlvbiBiYygpIHsKICAgICAgICAgICAgICAgIHZhciBhLCBiOwogICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gYWMpCiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgYWMgPSBudWxsICE9PSAoYiA9IG51bGwgPT09IChhID0gJGIoKSkgfHwgdm9pZCAwID09PSBhID8gdm9pZCAwIDogYS5jcmVhdGVQb2xpY3koJ2dvb2dsZSNzYWZlJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlSFRNTDogZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVTY3JpcHQ6IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlU2NyaXB0VVJMOiBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KSkgJiYgdm9pZCAwICE9PSBiID8gYiA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBhYyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGFjOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgdmFyIGNjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgfSwgZGMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IGE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2KGRjLCBjYyk7CiAgICAgICAgICAgIGRjLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmcudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gZWMoYSkgewogICAgICAgICAgICAgICAgdmFyIGIsIGMgPSBudWxsID09PSAoYiA9IGJjKCkpIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuY3JlYXRlU2NyaXB0VVJMKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBkYyhudWxsICE9PSBjICYmIHZvaWQgMCAhPT0gYyA/IGMgOiBhLCBaYik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICBmdW5jdGlvbiBmYyhhKSB7CiAgICAgICAgICAgICAgICBpZiAoYSBpbnN0YW5jZW9mIGNjKQogICAgICAgICAgICAgICAgICAgIGlmIChhIGluc3RhbmNlb2YgZGMpCiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLmc7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignJyk7CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgYSA9IEhiKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICBmdW5jdGlvbiBnYyhhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiwgYyA9IChhLm93bmVyRG9jdW1lbnQgJiYgYS5vd25lckRvY3VtZW50LmRlZmF1bHRWaWV3IHx8IHdpbmRvdykuZG9jdW1lbnQsIGQgPSBudWxsID09PSAoYiA9IGMucXVlcnlTZWxlY3RvcikgfHwgdm9pZCAwID09PSBiID8gdm9pZCAwIDogYi5jYWxsKGMsICdzY3JpcHRbbm9uY2VdJyk7CiAgICAgICAgICAgICAgICAoYiA9IGQgPyBkLm5vbmNlIHx8IGQuZ2V0QXR0cmlidXRlKCdub25jZScpIHx8ICcnIDogJycpICYmIGEuc2V0QXR0cmlidXRlKCdub25jZScsIGIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgZnVuY3Rpb24gaGMoYSwgYikgewogICAgICAgICAgICAgICAgYS53cml0ZShSYihiKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgaWMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSAhMSwgYzsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYiB8fCAoYyA9IGEoKSwgYiA9ICEwKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBqYyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBhLmFkZEV2ZW50TGlzdGVuZXIgJiYgYS5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgYiwgITEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbGMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHouZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLnF1ZXJ5U2VsZWN0b3IgJiYgKGEgPSBhLnF1ZXJ5U2VsZWN0b3IoJ3NjcmlwdFtub25jZV0nKSkgJiYgKGEgPSBhLm5vbmNlIHx8IGEuZ2V0QXR0cmlidXRlKCdub25jZScpKSAmJiBrYy50ZXN0KGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICcnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0sIGtjID0gL15bXHcrL18tXStbPV17MCwyfSQvOwogICAgICAgICAgICB2YXIgbWMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gTmEoJ2lQYWQnKSB8fCBOYSgnQW5kcm9pZCcpICYmICFOYSgnTW9iaWxlJykgfHwgTmEoJ1NpbGsnKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIG5jID0gUmVnRXhwKCdeKD86KFteOi8/Iy5dKyk6KT8oPzovLyg/OihbXlxcXFwvPyNdKilAKT8oW15cXFxcLz8jXSo/KSg/OjooWzAtOV0rKSk/KD89W1xcXFwvPyNdfCQpKT8oW14/I10rKT8oPzpcXD8oW14jXSopKT8oPzojKFtcXHNcXFNdKikpPyQnKSwgb2MgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhID8gZGVjb2RlVVJJKGEpIDogYTsKICAgICAgICAgICAgICAgIH0sIHBjID0gLyN8JC8sIHFjID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEuc2VhcmNoKHBjKTsKICAgICAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IGIubGVuZ3RoOyAwIDw9IChkID0gYS5pbmRleE9mKGIsIGQpKSAmJiBkIDwgYzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gYS5jaGFyQ29kZUF0KGQgLSAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgzOCA9PSBmIHx8IDYzID09IGYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYgPSBhLmNoYXJDb2RlQXQoZCArIGUpLCAhZiB8fCA2MSA9PSBmIHx8IDM4ID09IGYgfHwgMzUgPT0gZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgKz0gZSArIDE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZCA9IC0xOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoMCA+IGQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIGUgPSBhLmluZGV4T2YoJyYnLCBkKTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA+IGUgfHwgZSA+IGMpCiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBjOwogICAgICAgICAgICAgICAgICAgIGQgKz0gYi5sZW5ndGggKyAxOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkZWNvZGVVUklDb21wb25lbnQoYS5zdWJzdHIoZCwgZSAtIGQpLnJlcGxhY2UoL1wrL2csICcgJykpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHVjID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIXJjKCkgJiYgIXNjKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBNYXRoLnJhbmRvbSgpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA8IGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyA9IHRjKCksIGFbTWF0aC5mbG9vcihjICogYS5sZW5ndGgpXTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9LCB0YyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIW0uZ2xvYmFsVGhpcy5jcnlwdG8pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLnJhbmRvbSgpOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IFVpbnQzMkFycmF5KDEpOwogICAgICAgICAgICAgICAgICAgICAgICBtLmdsb2JhbFRoaXMuY3J5cHRvLmdldFJhbmRvbVZhbHVlcyhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbMF0gLyA2NTUzNiAvIDY1NTM2OwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgucmFuZG9tKCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdmMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjIGluIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgYykgJiYgYi5jYWxsKHZvaWQgMCwgYVtjXSwgYywgYSk7CiAgICAgICAgICAgICAgICB9LCB3YyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSBiKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMzA1NDE5ODk2LCBkID0gMDsgZCA8IGI7IGQrKykKICAgICAgICAgICAgICAgICAgICAgICAgYyBePSAoYyA8PCA1KSArIChjID4+IDIpICsgYS5jaGFyQ29kZUF0KGQpICYgNDI5NDk2NzI5NTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA8IGMgPyBjIDogNDI5NDk2NzI5NiArIGM7CiAgICAgICAgICAgICAgICB9LCBzYyA9IGljKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkucHJvdG90eXBlLnNvbWUuY2FsbChbCiAgICAgICAgICAgICAgICAgICAgICAgICdHb29nbGUgV2ViIFByZXZpZXcnLAogICAgICAgICAgICAgICAgICAgICAgICAnTWVkaWFwYXJ0bmVycy1Hb29nbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnR29vZ2xlLVJlYWQtQWxvdWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnR29vZ2xlLUFkd29yZHMnCiAgICAgICAgICAgICAgICAgICAgXSwgeGMsIHZvaWQgMCkgfHwgMC4wMDAxID4gTWF0aC5yYW5kb20oKTsKICAgICAgICAgICAgICAgIH0pLCByYyA9IGljKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geGMoJ01TSUUnKTsKICAgICAgICAgICAgICAgIH0pLCB4YyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xICE9IE1hKCkuaW5kZXhPZihhKTsKICAgICAgICAgICAgICAgIH0sIHljID0gL14oLT9bMC05Ll17MSwzMH0pJC8sIHpjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geWMudGVzdChhKSAmJiAoYSA9IE51bWJlcihhKSwgIWlzTmFOKGEpKSA/IGEgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgQWMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAvXnRydWUkLy50ZXN0KGEpOwogICAgICAgICAgICAgICAgfSwgQmMgPSBpYyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFtYygpICYmIChOYSgnaVBvZCcpIHx8IE5hKCdpUGhvbmUnKSB8fCBOYSgnQW5kcm9pZCcpIHx8IE5hKCdJRU1vYmlsZScpKSA/IDIgOiBtYygpID8gMSA6IDA7CiAgICAgICAgICAgICAgICB9KSwgQ2MgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSB2b2lkIDAgPT09IGEgPyAnJyA6IGE7CiAgICAgICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IHdpbmRvdyA6IGI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChiID0gb2MoYi5sb2NhdGlvbi5ocmVmLm1hdGNoKG5jKVszXSB8fCBudWxsKSkgPyB3YyhiICsgYSkgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgRWMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyB3aW5kb3cuZG9jdW1lbnQgOiBiOwogICAgICAgICAgICAgICAgICAgIDAgIT0gYS5sZW5ndGggJiYgYi5oZWFkICYmIGEuZm9yRWFjaChmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/IHdpbmRvdy5kb2N1bWVudCA6IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyAmJiBkLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IERjKCdNRVRBJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5oZWFkLmFwcGVuZENoaWxkKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaHR0cEVxdWl2ID0gJ29yaWdpbi10cmlhbCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jb250ZW50ID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgRmMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGlmICgnbnVtYmVyJyAhPT0gdHlwZW9mIGEuZ29vZ19wdnNpZCkKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShhLCAnZ29vZ19wdnNpZCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogTWF0aC5wb3coMiwgNTIpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE51bWJlcihhLmdvb2dfcHZzaWQpIHx8IC0xOwogICAgICAgICAgICAgICAgfSwgRGMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBkb2N1bWVudCA6IGI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIuY3JlYXRlRWxlbWVudChTdHJpbmcoYSkudG9Mb3dlckNhc2UoKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgSGMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gJ2h0dHBzOi8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20vcGFnZWFkL2dlbl8yMDQ/aWQ9JyArIGI7CiAgICAgICAgICAgICAgICAgICAgdmMoYSwgZnVuY3Rpb24gKGQsIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZCAmJiAoYyArPSAnJicgKyBlICsgJz0nICsgZW5jb2RlVVJJQ29tcG9uZW50KGQpKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBHYyhjKTsKICAgICAgICAgICAgICAgIH0sIEdjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHdpbmRvdzsKICAgICAgICAgICAgICAgICAgICBpZiAoYi5mZXRjaCkKICAgICAgICAgICAgICAgICAgICAgICAgYi5mZXRjaChhLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwYWxpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlZGVudGlhbHM6ICdpbmNsdWRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZGlyZWN0OiAnZm9sbG93JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ2dldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiAnbm8tY29ycycKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIuZ29vZ2xlX2ltYWdlX3JlcXVlc3RzIHx8IChiLmdvb2dsZV9pbWFnZV9yZXF1ZXN0cyA9IFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBEYygnSU1HJywgYi5kb2N1bWVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuc3JjID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5nb29nbGVfaW1hZ2VfcmVxdWVzdHMucHVzaChjKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBJYyhhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHcuYXBwbHkoMSwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIGlmICgwID09PSBiLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWMoYVswXSk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gW2FbMF1dLCBkID0gMDsgZCA8IGIubGVuZ3RoOyBkKyspCiAgICAgICAgICAgICAgICAgICAgYy5wdXNoKGVuY29kZVVSSUNvbXBvbmVudChiW2RdKSksIGMucHVzaChhW2QgKyAxXSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZWMoYy5qb2luKCcnKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgSmMgPSAnYScuY2hhckNvZGVBdCgpLCBLYyA9IERiKHsKICAgICAgICAgICAgICAgICAgICByYTogMCwKICAgICAgICAgICAgICAgICAgICBxYTogMSwKICAgICAgICAgICAgICAgICAgICBuYTogMiwKICAgICAgICAgICAgICAgICAgICBpYTogMywKICAgICAgICAgICAgICAgICAgICBvYTogNCwKICAgICAgICAgICAgICAgICAgICBqYTogNSwKICAgICAgICAgICAgICAgICAgICBwYTogNiwKICAgICAgICAgICAgICAgICAgICBsYTogNywKICAgICAgICAgICAgICAgICAgICBtYTogOCwKICAgICAgICAgICAgICAgICAgICBoYTogOSwKICAgICAgICAgICAgICAgICAgICBrYTogMTAKICAgICAgICAgICAgICAgIH0pLCBMYyA9IERiKHsKICAgICAgICAgICAgICAgICAgICB0YTogMCwKICAgICAgICAgICAgICAgICAgICB1YTogMSwKICAgICAgICAgICAgICAgICAgICBzYTogMgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBNYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKC9bXjAxXS8udGVzdChhKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0lucHV0IGJpdHN0cmluZyAnICsgYSArICcgaXMgbWFsZm9ybWVkIScpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gMDsKICAgICAgICAgICAgICAgIH0sIFBjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IE0oYSwgMTYpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gISFNKGEsIDEpID8gKGEgPSBOYyhhKSwgYS5mb3JFYWNoKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID4gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdJRCAnICsgYyArICcgaXMgcGFzdCBNYXhWZW5kb3JJZCAnICsgYiArICchJyk7CiAgICAgICAgICAgICAgICAgICAgfSksIGEpIDogT2MoYSwgYik7CiAgICAgICAgICAgICAgICB9LCBOYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IE0oYSwgMTIpLCBjID0gW107IGItLTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSAhMCA9PT0gISFNKGEsIDEpLCBlID0gTShhLCAxNik7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChkID0gTShhLCAxNik7IGUgPD0gZDsgZSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBjLnNvcnQoZnVuY3Rpb24gKGYsIGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYgLSBoOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSwgT2MgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSBbXSwgZSA9IDA7IGUgPCBiOyBlKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNKGEsIDEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGUgKyAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgJiYgLTEgPT09IGMuaW5kZXhPZihmKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignSUQ6ICcgKyBmICsgJyBpcyBvdXRzaWRlIG9mIGFsbG93ZWQgdmFsdWVzIScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKGYpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICB9LCBNID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5nICsgYiA+IGEuaC5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdSZXF1ZXN0ZWQgbGVuZ3RoICcgKyBiICsgJyBpcyBwYXN0IGVuZCBvZiBzdHJpbmcuJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmguc3Vic3RyaW5nKGEuZywgYS5nICsgYik7CiAgICAgICAgICAgICAgICAgICAgYS5nICs9IGI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlSW50KGMsIDIpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFJjID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IFhhKGEuc3BsaXQoJy4nKVswXSkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChhYSA9IGUudG9TdHJpbmcoMiksIHAoYWEsICdwYWRTdGFydCcpKS5jYWxsKGFhLCA4LCAnMCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignJyksIGQgPSBuZXcgTWMoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgYy50Y1N0cmluZyA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuZ2RwckFwcGxpZXMgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgZC5nICs9IDc4OwogICAgICAgICAgICAgICAgICAgICAgICBjLmNtcElkID0gTShkLCAxMik7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuY21wVmVyc2lvbiA9IE0oZCwgMTIpOwogICAgICAgICAgICAgICAgICAgICAgICBkLmcgKz0gMzA7CiAgICAgICAgICAgICAgICAgICAgICAgIGMudGNmUG9saWN5VmVyc2lvbiA9IE0oZCwgNik7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuaXNTZXJ2aWNlU3BlY2lmaWMgPSAhIU0oZCwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMudXNlTm9uU3RhbmRhcmRTdGFja3MgPSAhIU0oZCwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuc3BlY2lhbEZlYXR1cmVPcHRpbnMgPSBRYyhPYyhkLCAxMiwgTGMpLCBMYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMucHVycG9zZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRzOiBRYyhPYyhkLCAyNCwgS2MpLCBLYyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlSW50ZXJlc3RzOiBRYyhPYyhkLCAyNCwgS2MpLCBLYykKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgYy5wdXJwb3NlT25lVHJlYXRtZW50ID0gISFNKGQsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICBjLnB1Ymxpc2hlckNDID0gU3RyaW5nLmZyb21DaGFyQ29kZShKYyArIE0oZCwgNikpICsgU3RyaW5nLmZyb21DaGFyQ29kZShKYyArIE0oZCwgNikpOwogICAgICAgICAgICAgICAgICAgICAgICBjLnZlbmRvciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRzOiBRYyhQYyhkKSwgYiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlSW50ZXJlc3RzOiBRYyhQYyhkKSwgYikKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBRYyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB7fTsKICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShiKSAmJiAwICE9PSBiLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICBiID0gdChiKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IGIubmV4dCgpOyAhZC5kb25lOyBkID0gYi5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gZC52YWx1ZSwgY1tkXSA9IC0xICE9PSBhLmluZGV4T2YoZCk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IHQoYSksIGQgPSBhLm5leHQoKTsgIWQuZG9uZTsgZCA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgY1tkLnZhbHVlXSA9ICEwOwogICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBjWzBdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gU2MoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHcuYXBwbHkoMCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hcHBseSh0aGlzLCBiKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgVGMgPSBTYyhmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBbXSwgYyA9IHt9OwogICAgICAgICAgICAgICAgYSA9IHQoYSk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gYS5uZXh0KCk7ICFkLmRvbmU7IGMgPSB7IEM6IGMuQyB9LCBkID0gYS5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgYy5DID0gZC52YWx1ZSwgU2MoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIucHVzaCgnW3siJyArIGUuQy5nYSArICciOicgKyB2YihlLkMubWVzc2FnZSkgKyAnfV0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KGMpKSgpOwogICAgICAgICAgICAgICAgcmV0dXJuICdbWycgKyBiLmpvaW4oJywnKSArICddXSc7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgVWMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKG0uZ2xvYmFsVGhpcy5mZXRjaCkKICAgICAgICAgICAgICAgICAgICBtLmdsb2JhbFRoaXMuZmV0Y2goYSwgewogICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJywKICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogYiwKICAgICAgICAgICAgICAgICAgICAgICAga2VlcGFsaXZlOiA2NTUzNiA+IGIubGVuZ3RoLAogICAgICAgICAgICAgICAgICAgICAgICBjcmVkZW50aWFsczogJ29taXQnLAogICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiAnbm8tY29ycycsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlZGlyZWN0OiAnZm9sbG93JwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICBjLm9wZW4oJ1BPU1QnLCBhLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgYy5zZW5kKGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBWYyhhKSB7CiAgICAgICAgICAgICAgICBhLmZhLmFwcGx5KGEsIHUody5hcHBseSgxLCBhcmd1bWVudHMpLm1hcChmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdhOiA0LAogICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiBiCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgV2MgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSB2b2lkIDAgPT09IGIgPyBVYyA6IGI7CiAgICAgICAgICAgICAgICB0aGlzLmkgPSB2b2lkIDAgPT09IGEgPyAxMDAwIDogYTsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLmggPSBbXTsKICAgICAgICAgICAgICAgIHRoaXMuZyA9IG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFdjLnByb3RvdHlwZS5mYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdy5hcHBseSgwLCBhcmd1bWVudHMpLCBiID0gdGhpczsKICAgICAgICAgICAgICAgIFNjKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBiLmgucHVzaC5hcHBseShiLmgsIHUoYSkpOwogICAgICAgICAgICAgICAgICAgIHZhciBjID0gU2MoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IFRjKGIuaCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGIuaignaHR0cHM6Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9wYWdlYWQvcGluZz9lPTEnLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5oID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGIuZyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgMTAwIDw9IGIuaC5sZW5ndGggPyAobnVsbCAhPT0gYi5nICYmIGNsZWFyVGltZW91dChiLmcpLCBiLmcgPSBzZXRUaW1lb3V0KGMsIDApKSA6IG51bGwgPT09IGIuZyAmJiAoYi5nID0gc2V0VGltZW91dChjLCBiLmkpKTsKICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBYYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRlZmF1bHRWYWx1ZSA9ICExOwogICAgICAgICAgICAgICAgfSwgWWMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWZhdWx0VmFsdWUgPSAwOwogICAgICAgICAgICAgICAgfSwgWmMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBbXSA6IGI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRlZmF1bHRWYWx1ZSA9IGI7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgJGMgPSBuZXcgWGMoMzk5NTQ0NTQ4KSwgYWQgPSBuZXcgWWMoMjQpLCBiZCA9IG5ldyBaYygxOTM5KSwgY2QgPSBuZXcgWmMoMTkzNCwgWwogICAgICAgICAgICAgICAgICAgICdBOEZIUzFObWRDd0dxRDlEd09pY25ISFkreTI3a2RXZnhLYTBZSFNHRGZ2MENTcERLUkhUUWRRbVpWUERVZGFGV1VzeGRnVnhsd0FkNm8rZGhKeWtQQTBBQUFDV2V5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwyUnZkV0pzWldOc2FXTnJMbTVsZERvME5ETWlMQ0ptWldGMGRYSmxJam9pUTI5dWRtVnljMmx2YmsxbFlYTjFjbVZ0Wlc1MElpd2laWGh3YVhKNUlqb3hOalF6TVRVMU1UazVMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsTENKMWMyRm5aU0k2SW5OMVluTmxkQ0o5JywKICAgICAgICAgICAgICAgICAgICAnQTh6ZFhpNmRyMWh3WEVValFyWWl5WVFHbFUzNTU3eTVRV0RuTjBMd2dqOWVQdDY2WE1Fdk5rVldPRU9XUGQ3VFA5c0JRMjVYMFExNUxyMU5uNG9HRlFrQUFBQ2NleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMmR2YjJkc1pYTjVibVJwWTJGMGFXOXVMbU52YlRvME5ETWlMQ0ptWldGMGRYSmxJam9pUTI5dWRtVnljMmx2YmsxbFlYTjFjbVZ0Wlc1MElpd2laWGh3YVhKNUlqb3hOalF6TVRVMU1UazVMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsTENKMWMyRm5aU0k2SW5OMVluTmxkQ0o5JywKICAgICAgICAgICAgICAgICAgICAnQTQvSHRlcm4ydWROOXczeUpLOVFnV1F4UUZydXhPWHNYTDdjVzYwRHlDbDBFWkZHQ1NtZS9KMzNRL1d6RjdiQmtWdmhFV0RsY0JpVXlaYWltNUNwRlF3QUFBQ2NleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMmR2YjJkc1pYUmhaM05sY25acFkyVnpMbU52YlRvME5ETWlMQ0ptWldGMGRYSmxJam9pUTI5dWRtVnljMmx2YmsxbFlYTjFjbVZ0Wlc1MElpd2laWGh3YVhKNUlqb3hOalF6TVRVMU1UazVMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsTENKMWMyRm5aU0k2SW5OMVluTmxkQ0o5JwogICAgICAgICAgICAgICAgXSksIGRkID0gbmV3IFhjKDE5NTkpLCBlZCA9IG5ldyBYYygyMDMpLCBmZCA9IG5ldyBYYygxOTI4KSwgZ2QgPSBuZXcgWGMoMTk0MSksIGhkID0gbmV3IFhjKDM3MDk0NjM0OSksIGlkID0gbmV3IFhjKDM5MjczNjQ3NiksIGpkID0gbmV3IFljKDQwNjE0OTgzNSksIGtkID0gbmV3IFpjKDE5MzIsIFsKICAgICAgICAgICAgICAgICAgICAnQXh1aktHOUlOanNaOC9nVXE4K2RUcnVOdms3UmpaUTFvRmhoZ1FiY1RKS0RuWmZielNURTgxd3ZDMkh6YWYzVFc0YXZBNzZMVFpFTWRpZWRGMXZJYkE0QUFBQnVleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMmx0WVhOa2F5NW5iMjluYkdWaGNHbHpMbU52YlRvME5ETWlMQ0ptWldGMGRYSmxJam9pVkhKMWMzUlViMnRsYm5NaUxDSmxlSEJwY25raU9qRTJOVEkzTnpRME1EQXNJbWx6VkdocGNtUlFZWEowZVNJNmRISjFaWDA9JywKICAgICAgICAgICAgICAgICAgICAnQXp1Y2U4NU9SdFNuV2UxTVpEVHY2OHFwYVczaUh5Zkw5WWJMUnkwY3djQ1p3Vm5lUG5PbWtVSmxHOEhHaWttT3doWlUyMmRFbENjZnJmWDJIaHJCUEFrQUFBQjdleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMlJ2ZFdKc1pXTnNhV05yTG01bGREbzBORE1pTENKbVpXRjBkWEpsSWpvaVZISjFjM1JVYjJ0bGJuTWlMQ0psZUhCcGNua2lPakUyTlRJM056UTBNREFzSW1selUzVmlaRzl0WVdsdUlqcDBjblZsTENKcGMxUm9hWEprVUdGeWRIa2lPblJ5ZFdWOScsCiAgICAgICAgICAgICAgICAgICAgJ0ExNm52Y2Rlb09BcXJKY21qTFJwbDFJNmYzTWNERDhFZm9mQVlUdC9QL0g0L0FXd0I5OW54aVBwNmtBMGZYb2laYXY5MDhaOGV0dUwxNmxhRlBVZGZRc0FBQUNCZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJkdmIyZHNaWFJoWjNObGNuWnBZMlZ6TG1OdmJUbzBORE1pTENKbVpXRjBkWEpsSWpvaVZISjFjM1JVYjJ0bGJuTWlMQ0psZUhCcGNua2lPakUyTlRJM056UTBNREFzSW1selUzVmlaRzl0WVdsdUlqcDBjblZsTENKcGMxUm9hWEprVUdGeWRIa2lPblJ5ZFdWOScsCiAgICAgICAgICAgICAgICAgICAgJ0F4QkhkcjBKNDR2RkJRdFpVcVg5c2ppcWY1eVdaL09jSFJjUk1OM0g5VEgrdDkwVi9qM0VOVzZDOCtpZ0JaRlhNSjdHM1ByOERkMTM2MzJhTG5nNDJ3Z0FBQUNCZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJkdmIyZHNaWE41Ym1ScFkyRjBhVzl1TG1OdmJUbzBORE1pTENKbVpXRjBkWEpsSWpvaVZISjFjM1JVYjJ0bGJuTWlMQ0psZUhCcGNua2lPakUyTlRJM056UTBNREFzSW1selUzVmlaRzl0WVdsdUlqcDBjblZsTENKcGMxUm9hWEprVUdGeWRIa2lPblJ5ZFdWOScsCiAgICAgICAgICAgICAgICAgICAgJ0E4OEJXSEZqY2F3VWZLVTNsSWVqTG9yeVhveWpvb0JYTGdXbUdoK2hOY3FNSzQ0Y3VndnNJNVlaYk5hcll2aTNyb2MxZlliSEExQVZiaEF0dUhaZmxnRUFBQUIyZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJkdmIyZHNaUzVqYjIwNk5EUXpJaXdpWm1WaGRIVnlaU0k2SWxSeWRYTjBWRzlyWlc1eklpd2laWGh3YVhKNUlqb3hOalV5TnpjME5EQXdMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsZlE9PScKICAgICAgICAgICAgICAgIF0pLCBsZCA9IG5ldyBZYygxOTM1KTsKICAgICAgICAgICAgdmFyIG5kID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhLCAtMSwgbWQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KG5kLCBBKTsKICAgICAgICAgICAgdmFyIG1kID0gWzZdOwogICAgICAgICAgICB2YXIgcGQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBvZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYocGQsIEEpOwogICAgICAgICAgICB2YXIgcWQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KHFkLCBBKTsKICAgICAgICAgICAgdmFyIHJkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihyZCwgQSk7CiAgICAgICAgICAgIHZhciBvZCA9IFs3XTsKICAgICAgICAgICAgdmFyIHNkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuZyA9IGEgfHwgeyBjb29raWU6ICcnIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHNkLnByb3RvdHlwZS5zZXQgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgdmFyIGQgPSAhMTsKICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gdHlwZW9mIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMueWE7CiAgICAgICAgICAgICAgICAgICAgZCA9IGMuemEgfHwgITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBjLmRvbWFpbiB8fCB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBjLnBhdGggfHwgdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIHZhciBnID0gYy5kYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgvWzs9XHNdLy50ZXN0KGEpKQogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdJbnZhbGlkIGNvb2tpZSBuYW1lICInICsgYSArICciJyk7CiAgICAgICAgICAgICAgICBpZiAoL1s7XHJcbl0vLnRlc3QoYikpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0ludmFsaWQgY29va2llIHZhbHVlICInICsgYiArICciJyk7CiAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGcgJiYgKGcgPSAtMSk7CiAgICAgICAgICAgICAgICB0aGlzLmcuY29va2llID0gYSArICc9JyArIGIgKyAoZiA/ICc7ZG9tYWluPScgKyBmIDogJycpICsgKGggPyAnO3BhdGg9JyArIGggOiAnJykgKyAoMCA+IGcgPyAnJyA6IDAgPT0gZyA/ICc7ZXhwaXJlcz0nICsgbmV3IERhdGUoMTk3MCwgMSwgMSkudG9VVENTdHJpbmcoKSA6ICc7ZXhwaXJlcz0nICsgbmV3IERhdGUoRGF0ZS5ub3coKSArIDEwMDAgKiBnKS50b1VUQ1N0cmluZygpKSArIChkID8gJztzZWN1cmUnIDogJycpICsgKG51bGwgIT0gZSA/ICc7c2FtZXNpdGU9JyArIGUgOiAnJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHNkLnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IGEgKyAnPScsIGQgPSAodGhpcy5nLmNvb2tpZSB8fCAnJykuc3BsaXQoJzsnKSwgZSA9IDAsIGY7IGUgPCBkLmxlbmd0aDsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgZiA9IEFhKGRbZV0pOwogICAgICAgICAgICAgICAgICAgIGlmICgwID09IGYubGFzdEluZGV4T2YoYywgMCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmLnN1YnN0cihjLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGYgPT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHNkLnByb3RvdHlwZS5pc0VtcHR5ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICF0aGlzLmcuY29va2llOwogICAgICAgICAgICB9OwogICAgICAgICAgICBzZC5wcm90b3R5cGUuY2xlYXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gKHRoaXMuZy5jb29raWUgfHwgJycpLnNwbGl0KCc7JyksIGIgPSBbXSwgYyA9IFtdLCBkLCBlLCBmID0gMDsgZiA8IGEubGVuZ3RoOyBmKyspCiAgICAgICAgICAgICAgICAgICAgZSA9IEFhKGFbZl0pLCBkID0gZS5pbmRleE9mKCc9JyksIC0xID09IGQgPyAoYi5wdXNoKCcnKSwgYy5wdXNoKGUpKSA6IChiLnB1c2goZS5zdWJzdHJpbmcoMCwgZCkpLCBjLnB1c2goZS5zdWJzdHJpbmcoZCArIDEpKSk7CiAgICAgICAgICAgICAgICBmb3IgKGEgPSBiLmxlbmd0aCAtIDE7IDAgPD0gYTsgYS0tKQogICAgICAgICAgICAgICAgICAgIGMgPSBiW2FdLCB0aGlzLmdldChjKSwgdGhpcy5zZXQoYywgJycsIHsKICAgICAgICAgICAgICAgICAgICAgICAgZGE6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIHBhdGg6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluOiB2b2lkIDAKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gdGQoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIChhID0gdmQoYSkpID8gSChhLCBxZCwgNCkgOiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHZkKGEpIHsKICAgICAgICAgICAgICAgIGEgPSAoYSA9IG5ldyBzZChhKS5nZXQoJ0ZDQ0RDRicsICcnKSkgPyBhIDogbnVsbDsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhID8gSlNPTi5wYXJzZShhKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGhiID0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgcGQoYik7CiAgICAgICAgICAgICAgICAgICAgICAgIGhiID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBjOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBkID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciB3ZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmggPSBudWxsOwogICAgICAgICAgICAgICAgfSwgeWQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEuX190Y2ZhcGlQb3N0TWVzc2FnZVJlYWR5IHx8IHhkKG5ldyB3ZChhKSk7CiAgICAgICAgICAgICAgICB9LCB4ZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYS5oID0gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAnc3RyaW5nJyA9PSB0eXBlb2YgYi5kYXRhOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBjID8gSlNPTi5wYXJzZShiLmRhdGEpIDogYi5kYXRhOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkLl9fdGNmYXBpQ2FsbDsKICAgICAgICAgICAgICAgICAgICAgICAgIWUgfHwgJ3BpbmcnICE9PSBlLmNvbW1hbmQgJiYgJ2dldFRDRGF0YScgIT09IGUuY29tbWFuZCAmJiAnYWRkRXZlbnRMaXN0ZW5lcicgIT09IGUuY29tbWFuZCAmJiAncmVtb3ZlRXZlbnRMaXN0ZW5lcicgIT09IGUuY29tbWFuZCB8fCBhLmcuX190Y2ZhcGkoZS5jb21tYW5kLCBlLnZlcnNpb24sIGZ1bmN0aW9uIChmLCBoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5fX3RjZmFwaVJldHVybiA9ICdyZW1vdmVFdmVudExpc3RlbmVyJyA9PT0gZS5jb21tYW5kID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbElkOiBlLmNhbGxJZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm5WYWx1ZTogZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWNjZXNzOiBoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxJZDogZS5jYWxsSWQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gYyA/IEpTT04uc3RyaW5naWZ5KGcpIDogZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuc291cmNlICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiBiLnNvdXJjZS5wb3N0TWVzc2FnZSAmJiBiLnNvdXJjZS5wb3N0TWVzc2FnZShmLCBiLm9yaWdpbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wYXJhbWV0ZXIpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYS5nLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBhLmgpOwogICAgICAgICAgICAgICAgICAgIGEuZy5fX3RjZmFwaVBvc3RNZXNzYWdlUmVhZHkgPSAhMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB6ZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IGEuZG9jdW1lbnQsIGQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYS5mcmFtZXNbYl0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYy5ib2R5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBEYygnSUZSQU1FJywgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc3R5bGUud2lkdGggPSAnMHB4JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnN0eWxlLmhlaWdodCA9ICcwcHgnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc3R5bGUuYm9yZGVyID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc3R5bGUuekluZGV4ID0gJy0xMDAwJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnN0eWxlLmxlZnQgPSAnLTEwMDBweCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zdHlsZS50b3AgPSAnLTEwMDBweCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uYW1lID0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmJvZHkuYXBwZW5kQ2hpbGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnNldFRpbWVvdXQoZCwgNSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGQoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEFkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IGEuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gKGEgPSAoYSA9IHZkKHRoaXMuaCkpID8gSChhLCByZCwgNSkgfHwgbnVsbCA6IG51bGwpID8gQihhLCAyKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gKGEgPSB0ZCh0aGlzLmgpKSAmJiBudWxsICE9IEIoYSwgMSkgPyBCKGEsIDEpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmkgPSAoYSA9IHRkKHRoaXMuaCkpICYmIG51bGwgIT0gQihhLCAyKSA/IEIoYSwgMikgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgRGQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEuX191c3BhcGkgfHwgYS5mcmFtZXMuX191c3BhcGlMb2NhdG9yIHx8IChhID0gbmV3IEFkKGEpLCBCZChhKSwgQ2QoYSkpOwogICAgICAgICAgICAgICAgfSwgQmQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICFhLmwgfHwgYS5nLl9fdXNwYXBpIHx8IGEuZy5mcmFtZXMuX191c3BhcGlMb2NhdG9yIHx8IChhLmcuX191c3BhcGlNYW5hZ2VyID0gJ2ZjJywgemQoYS5nLCAnX191c3BhcGlMb2NhdG9yJyksIHphKCdfX3VzcGFwaScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEucy5hcHBseShhLCB1KHcuYXBwbHkoMCwgYXJndW1lbnRzKSkpOwogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIEFkLnByb3RvdHlwZS5zID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT09IHR5cGVvZiBjICYmICdnZXRVU1BEYXRhJyA9PT0gYSAmJiBjKHsKICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiAxLAogICAgICAgICAgICAgICAgICAgIHVzcFN0cmluZzogdGhpcy5sCiAgICAgICAgICAgICAgICB9LCAhMCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBDZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAhYS5qIHx8IGEuZy5fX3RjZmFwaSB8fCBhLmcuZnJhbWVzLl9fdGNmYXBpTG9jYXRvciB8fCAoYS5nLl9fdGNmYXBpTWFuYWdlciA9ICdmYycsIHpkKGEuZywgJ19fdGNmYXBpTG9jYXRvcicpLCBhLmcuX190Y2ZhcGlFdmVudExpc3RlbmVycyA9IGEuZy5fX3RjZmFwaUV2ZW50TGlzdGVuZXJzIHx8IFtdLCB6YSgnX190Y2ZhcGknLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuby5hcHBseShhLCB1KHcuYXBwbHkoMCwgYXJndW1lbnRzKSkpOwogICAgICAgICAgICAgICAgfSksIHlkKGEuZykpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBBZC5wcm90b3R5cGUubyA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBkID0gdm9pZCAwID09PSBkID8gbnVsbCA6IGQ7CiAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGMpCiAgICAgICAgICAgICAgICAgICAgaWYgKGIgJiYgMiAhPT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgYyhudWxsLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGIgPSB0aGlzLmcuX190Y2ZhcGlFdmVudExpc3RlbmVycywgYSkgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdnZXRUQ0RhdGEnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIWQgfHwgQXJyYXkuaXNBcnJheShkKSAmJiBkLmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pID8gYyhFZCh0aGlzLCBkLCBudWxsKSwgITApIDogYyhudWxsLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncGluZyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByQXBwbGllczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wTG9hZGVkOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXBTdGF0dXM6ICdsb2FkZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlTdGF0dXM6ICdkaXNhYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBpVmVyc2lvbjogJzIuMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wVmVyc2lvbjogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXBJZDogMzAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdhZGRFdmVudExpc3RlbmVyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBiLnB1c2goYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjKEVkKHRoaXMsIG51bGwsIGEgLSAxKSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3JlbW92ZUV2ZW50TGlzdGVuZXInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYltkXSA/IChiW2RdID0gbnVsbCwgYyghMCkpIDogYyghMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZ2V0SW5BcHBUQ0RhdGEnOgogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdnZXRWZW5kb3JMaXN0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMobnVsbCwgITEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBFZCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBpZiAoIWEuaikKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIGIgPSBSYyhhLmosIGIpOwogICAgICAgICAgICAgICAgYi5hZGR0bENvbnNlbnQgPSBudWxsICE9IGEuaSA/IGEuaSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgIGIuY21wU3RhdHVzID0gJ2xvYWRlZCc7CiAgICAgICAgICAgICAgICBiLmV2ZW50U3RhdHVzID0gJ3RjbG9hZGVkJzsKICAgICAgICAgICAgICAgIG51bGwgIT0gYyAmJiAoYi5saXN0ZW5lcklkID0gYyk7CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEdkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhLCAtMSwgRmQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KEdkLCBBKTsKICAgICAgICAgICAgdmFyIEhkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcWIoYSwgMSwgYik7CiAgICAgICAgICAgICAgICB9LCBJZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRiKGEsIDIsIGIpOwogICAgICAgICAgICAgICAgfSwgSmQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBvYihhLCA0LCBiKTsKICAgICAgICAgICAgICAgIH0sIEtkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGIoYSwgNSwgYik7CiAgICAgICAgICAgICAgICB9LCBMZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEYoYSwgNiwgYik7CiAgICAgICAgICAgICAgICB9LCBNZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihNZCwgQSk7CiAgICAgICAgICAgIE1kLnByb3RvdHlwZS5BID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEQodGhpcywgMSwgMCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBOZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEYoYSwgMSwgYik7CiAgICAgICAgICAgICAgICB9LCBPZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEYoYSwgMiwgYik7CiAgICAgICAgICAgICAgICB9LCBQZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihQZCwgQSk7CiAgICAgICAgICAgIHZhciBGZCA9IFsKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgNQogICAgICAgICAgICAgICAgXSwgUWQgPSBbCiAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICB2YXIgU2QgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBSZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYoU2QsIEEpOwogICAgICAgICAgICB2YXIgVWQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBUZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYoVWQsIEEpOwogICAgICAgICAgICB2YXIgUmQgPSBbCiAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICBdLCBUZCA9IFs1XSwgVmQgPSBbCiAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgNAogICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgdmFyIFdkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihXZCwgQSk7CiAgICAgICAgICAgIFdkLnByb3RvdHlwZS5nZXRUYWdTZXNzaW9uQ29ycmVsYXRvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBEKHRoaXMsIDIsIDApOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWGQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IFdkKCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNiKGIsIDQsIGEpOwogICAgICAgICAgICAgICAgfSwgcmIgPSBbCiAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICA1LAogICAgICAgICAgICAgICAgICAgIDcKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgIHZhciBZZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IHZvaWQgMCA9PT0gYyA/IHt9IDogYzsKICAgICAgICAgICAgICAgIHRoaXMuZXJyb3IgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5jb250ZXh0ID0gYi5jb250ZXh0OwogICAgICAgICAgICAgICAgdGhpcy5tc2cgPSBiLm1lc3NhZ2UgfHwgJyc7CiAgICAgICAgICAgICAgICB0aGlzLmlkID0gYi5pZCB8fCAnanNlcnJvcic7CiAgICAgICAgICAgICAgICB0aGlzLm1ldGEgPSBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWmQgPSBudWxsLCAkZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gWmQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgWmQgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB6LnRvcC5sb2NhdGlvbi5oYXNoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB6LmxvY2F0aW9uLmhhc2g7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gYS5tYXRjaCgvXGJkZWlkPShbXGQsXSspLyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWmQgPSBiID8gYlsxXSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFpkOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGJlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhLCAtMSwgYWUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KGJlLCBBKTsKICAgICAgICAgICAgdmFyIGFlID0gWwogICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgOAogICAgICAgICAgICAgICAgXSwgY2UgPSBbCiAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgIF0sIGRlID0gWwogICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgNwogICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgdmFyIGVlOwogICAgICAgICAgICBlZSA9IHsKICAgICAgICAgICAgICAgIHZhOiAwLAogICAgICAgICAgICAgICAgYWE6IDMsCiAgICAgICAgICAgICAgICBiYTogNCwKICAgICAgICAgICAgICAgIGNhOiA1CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBmZSA9IGVlLmFhLCBOID0gZWUuYmEsIGdlID0gZWUuY2EsIGhlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBhID8gIWEgOiBhOwogICAgICAgICAgICAgICAgfSwgaWUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAhMSwgZCA9IDA7IGQgPCBhLmxlbmd0aDsgZCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYVtkXSgpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9PT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09IGUgJiYgKGMgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICghYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFiOwogICAgICAgICAgICAgICAgfSwga2UgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gSShhLCBiZSwgMik7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFjLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGplKGEsIGIpOwogICAgICAgICAgICAgICAgICAgIGEgPSBEKGEsIDEsIDApOwogICAgICAgICAgICAgICAgICAgIGlmICgxID09PSBhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaGUoa2UoY1swXSwgYikpOwogICAgICAgICAgICAgICAgICAgIGMgPSBRYShjLCBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGtlKGQsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYSkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGllKGMsICExKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpZShjLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgamUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gRyhhLCBjZSk7CiAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBmZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0geGIoYSwgMywgY2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBOOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IHhiKGEsIDQsIGNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZ2U6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0geGIoYSwgNSwgY2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBkID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiAoYiA9IChiID0gYltjXSkgJiYgYltkXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYi5hcHBseShudWxsLCB1KGxiKGEsIDgpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBiID0gRChhLCAxLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDQgPT09IGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gbnVsbCAhPSBlOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoNSA9PT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMTIgPT09IGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gd2IoYSwgNyA9PT0gRyhhLCBkZSkgPyA3IDogLTEsIHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE46CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBuYihhLCA2ID09PSBHKGEsIGRlKSA/IDYgOiAtMSwgdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGdlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gd2IoYSwgNyA9PT0gRyhhLCBkZSkgPyA3IDogLTEsIHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg2ID09PSBiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDkgPT09IGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiAwID09PSBMYShTdHJpbmcoZSksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA8IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA+IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09PSB0eXBlb2YgYSAmJiAnc3RyaW5nJyA9PT0gdHlwZW9mIGUgJiYgbmV3IFJlZ0V4cChhKS50ZXN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGUgJiYgLTEgPT09IExhKFN0cmluZyhlKSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiAxID09PSBMYShTdHJpbmcoZSksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGxlID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWEgfHwgISghYiB8fCAha2UoYSwgYikpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIG5lID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhLCAtMSwgbWUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KG5lLCBBKTsKICAgICAgICAgICAgdmFyIG1lID0gWzRdOwogICAgICAgICAgICB2YXIgb2UgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KG9lLCBBKTsKICAgICAgICAgICAgdmFyIE8gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBwZSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYoTywgQSk7CiAgICAgICAgICAgIHZhciBwZSA9IFs1XSwgcWUgPSBbCiAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICA3CiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICB2YXIgcmUgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gdm9pZCAwID09PSBkID8gbmV3IFdjKGIpIDogZDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmggPSBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMubCA9IGM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gZDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBbXTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmkgPSAwIDwgdGhpcy5oICYmIHRjKCkgPCAxIC8gdGhpcy5oOwogICAgICAgICAgICAgICAgfSwgdGUgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZikgewogICAgICAgICAgICAgICAgICAgIHZhciBoID0gT2QoTmQobmV3IE1kKCksIGIpLCBjKTsKICAgICAgICAgICAgICAgICAgICBiID0gTGQoSWQoSGQoS2QoSmQobmV3IEdkKCksIGQpLCBlKSwgaCksIGEuZyksIGYpOwogICAgICAgICAgICAgICAgICAgIGIgPSBYZChiKTsKICAgICAgICAgICAgICAgICAgICBhLmkgJiYgVmMoYS5qLCBzZShhLCBiKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT09IGYgfHwgMyA9PT0gZiB8fCA0ID09PSBmICYmICFhLmcuc29tZShmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcuQSgpID09PSBoLkEoKSAmJiBEKGcsIDIsIDApID09PSBjOwogICAgICAgICAgICAgICAgICAgICAgICB9KSkKICAgICAgICAgICAgICAgICAgICAgICAgYS5nLnB1c2goaCksIDEwMCA8IGEuZy5sZW5ndGggJiYgYS5nLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICB9LCB1ZSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEubCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyBTZCgpOwogICAgICAgICAgICAgICAgICAgICAgICBiID0gdGIoZSwgMiwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSB0YihiLCAzLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgZCAmJiBGKGMsIDEsIGQpOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gbmV3IFdkKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBzYihkLCA3LCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgYS5pICYmIFZjKGEuaiwgc2UoYSwgZCkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHNlID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBiID0gRihiLCAxLCBEYXRlLm5vdygpKTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IEZjKHdpbmRvdyk7CiAgICAgICAgICAgICAgICAgICAgYiA9IEYoYiwgMiwgYyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEYoYiwgNiwgYS5oKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBQID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gJ0onOwogICAgICAgICAgICAgICAgaWYgKGEuSiAmJiBhLmhhc093blByb3BlcnR5KGIpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLko7CiAgICAgICAgICAgICAgICBiID0gbmV3IGEoKTsKICAgICAgICAgICAgICAgIHJldHVybiBhLkogPSBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgdmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgdGhpcy5nID0gKGFbZmVdID0ge30sIGFbTl0gPSB7fSwgYVtnZV0gPSB7fSwgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB3ZSA9IEFjKCdmYWxzZScpOwogICAgICAgICAgICB2YXIgeGUgPSB3ZSwgeWUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHhiKGEsIDEsIHFlKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4YihhLCAyLCBxZSk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geGIoYSwgMywgcWUpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgNjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHhiKGEsIDYsIHFlKTsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCB6ZSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtYihhLCAxKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDc6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3YihhLCAzKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuYihhLCAyKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3YihhLCAzKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsYihhLCA0KTsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBBZSA9IGljKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIXhlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB3aW5kb3cuc2Vzc2lvblN0b3JhZ2UgJiYgd2luZG93LnNlc3Npb25TdG9yYWdlLmdldEl0ZW0oJ0dHREZTU0snKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5wYXJzZShhKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgIH0pLCBEZSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkID0gdm9pZCAwID09PSBkID8gMCA6IGQsIGYsIGg7CiAgICAgICAgICAgICAgICAgICAgUChRKS5qW2VdID0gbnVsbCAhPSAoaCA9IG51bGwgPT0gKGYgPSBQKFEpLmpbZV0pID8gdm9pZCAwIDogZi5hZGQoYikpID8gaCA6IG5ldyBtLlNldCgpLmFkZChiKTsKICAgICAgICAgICAgICAgICAgICBlID0gQWUoKTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBlW2JdKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtiXTsKICAgICAgICAgICAgICAgICAgICBiID0gQmUoZClbYl07CiAgICAgICAgICAgICAgICAgICAgaWYgKCFiKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgICAgICBiID0gbmV3IE8oYik7CiAgICAgICAgICAgICAgICAgICAgYiA9IENlKGIpOwogICAgICAgICAgICAgICAgICAgIGEgPSB6ZShiLCBhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBhID8gYSA6IGM7CiAgICAgICAgICAgICAgICB9LCBDZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBQKHZlKS5nOwogICAgICAgICAgICAgICAgICAgIGlmIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gU2EoSShhLCBvZSwgNSksIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGUoSChkLCBiZSwgMSksIGIpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSChjLCBuZSwgMik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBIKGEsIG5lLCA0KTsKICAgICAgICAgICAgICAgIH0sIFEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oID0ge307CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pID0gW107CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0ge307CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gbmV3IG0uTWFwKCk7CiAgICAgICAgICAgICAgICB9LCBFZSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhRGUoMSwgYSwgdm9pZCAwID09PSBiID8gITEgOiBiLCBjKTsKICAgICAgICAgICAgICAgIH0sIEZlID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gMCA6IGI7CiAgICAgICAgICAgICAgICAgICAgYSA9IE51bWJlcihEZSgyLCBhLCBiLCBjKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlzTmFOKGEpID8gYiA6IGE7CiAgICAgICAgICAgICAgICB9LCBHZSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKDMsIGEsIHZvaWQgMCA9PT0gYiA/ICcnIDogYiwgYyk7CiAgICAgICAgICAgICAgICB9LCBIZSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IFtdIDogYjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGUoNiwgYSwgYiwgYyk7CiAgICAgICAgICAgICAgICB9LCBCZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFAoUSkuaFthXSB8fCAoUChRKS5oW2FdID0ge30pOwogICAgICAgICAgICAgICAgfSwgSWUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gQmUoYik7CiAgICAgICAgICAgICAgICAgICAgdmMoYSwgZnVuY3Rpb24gKGQsIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNbZV0gPSBkOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgSmUgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIGUgPSB2b2lkIDAgPT09IGUgPyAhMSA6IGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBbXSwgaCA9IFtdOwogICAgICAgICAgICAgICAgICAgIE9hKGIsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBrID0gQmUoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIE9hKGEsIGZ1bmN0aW9uIChsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IEcobCwgcWUpLCBxID0geWUobCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB5LCBpYiwgdWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGpiID0gbnVsbCAhPSAodWQgPSBudWxsID09ICh5ID0gUChRKS5nLmdldChnKSkgPyB2b2lkIDAgOiBudWxsID09IChpYiA9IHkuZ2V0KHEpKSA/IHZvaWQgMCA6IGliLnNsaWNlKDApKSA/IHVkIDogW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5ID0gbmV3IFVkKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYih5LCAxLCBWZCwgcSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGIoeSwgMiwgVmQsIHEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBiKHksIDMsIFZkLCBxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYih5LCA0LCBWZCwgcSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iKHksIDUsIGpiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChqYiA9IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEphOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqYiA9ICEobnVsbCA9PSAoSmEgPSBQKFEpLmpbZ10pIHx8ICFKYS5oYXMocSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqYiAmJiBmLnB1c2gobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEphID0gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEphID0gIShudWxsID09IChmYSA9IFAoUSkuZy5nZXQoZykpIHx8ICFmYS5oYXMocSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKYSAmJiBoLnB1c2gobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSB8fCAoZmEgPSBQKFEpLCBmYS5nLmhhcyhnKSB8fCBmYS5nLnNldChnLCBuZXcgbS5NYXAoKSksIGZhLmcuZ2V0KGcpLmhhcyhxKSB8fCBmYS5nLmdldChnKS5zZXQocSwgW10pLCBkICYmIGZhLmcuZ2V0KGcpLmdldChxKS5wdXNoKGQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrW3FdID0gbC50b0pTT04oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgKGYubGVuZ3RoIHx8IGgubGVuZ3RoKSAmJiB1ZShjLCBmLCBoLCBudWxsICE9IGQgPyBkIDogdm9pZCAwKTsKICAgICAgICAgICAgICAgIH0sIEtlID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IEJlKGIpOwogICAgICAgICAgICAgICAgICAgIE9hKGEsIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IE8oZCksIGYgPSBHKGUsIHFlKTsKICAgICAgICAgICAgICAgICAgICAgICAgKGUgPSB5ZShlLCBmKSkgJiYgKGNbZV0gfHwgKGNbZV0gPSBkKSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBMZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWEocChPYmplY3QsICdrZXlzJykuY2FsbChPYmplY3QsIFAoUSkuaCksIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIoYSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBNZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgVGEoUChRKS5pLCBhKSB8fCBJZShCZSg0KSwgYSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tZXRob2ROYW1lID0gYTsKICAgICAgICAgICAgICAgIH0sIE5lID0gbmV3IFIoMSksIE9lID0gbmV3IFIoMTYpLCBQZSA9IG5ldyBSKDE1KSwgUWUgPSBuZXcgUigyKSwgUmUgPSBuZXcgUigzKSwgU2UgPSBuZXcgUig0KSwgVGUgPSBuZXcgUig1KSwgVWUgPSBuZXcgUig2KSwgVmUgPSBuZXcgUig3KSwgV2UgPSBuZXcgUig4KSwgWGUgPSBuZXcgUig5KSwgWWUgPSBuZXcgUigxMCksIFplID0gbmV3IFIoMTEpLCAkZSA9IG5ldyBSKDEyKSwgYWYgPSBuZXcgUigxMyksIGJmID0gbmV3IFIoMTQpLCBTID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBjLmhhc093blByb3BlcnR5KGEubWV0aG9kTmFtZSkgfHwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGMsIFN0cmluZyhhLm1ldGhvZE5hbWUpLCB7IHZhbHVlOiBiIH0pOwogICAgICAgICAgICAgICAgfSwgVCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJbYS5tZXRob2ROYW1lXSB8fCBjIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgY2YgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIFMoVGUsIEVlLCBhKTsKICAgICAgICAgICAgICAgICAgICBTKFVlLCBGZSwgYSk7CiAgICAgICAgICAgICAgICAgICAgUyhWZSwgR2UsIGEpOwogICAgICAgICAgICAgICAgICAgIFMoV2UsIEhlLCBhKTsKICAgICAgICAgICAgICAgICAgICBTKGFmLCBLZSwgYSk7CiAgICAgICAgICAgICAgICAgICAgUyhQZSwgTWUsIGEpOwogICAgICAgICAgICAgICAgfSwgZGYgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIFMoU2UsIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFAodmUpLmcgPSBiOwogICAgICAgICAgICAgICAgICAgIH0sIGEpOwogICAgICAgICAgICAgICAgICAgIFMoWGUsIGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gUCh2ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQuZ1tmZV1bYl0gfHwgKGQuZ1tmZV1bYl0gPSBjKTsKICAgICAgICAgICAgICAgICAgICB9LCBhKTsKICAgICAgICAgICAgICAgICAgICBTKFllLCBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IFAodmUpOwogICAgICAgICAgICAgICAgICAgICAgICBkLmdbTl1bYl0gfHwgKGQuZ1tOXVtiXSA9IGMpOwogICAgICAgICAgICAgICAgICAgIH0sIGEpOwogICAgICAgICAgICAgICAgICAgIFMoWmUsIGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gUCh2ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQuZ1tnZV1bYl0gfHwgKGQuZ1tnZV1bYl0gPSBjKTsKICAgICAgICAgICAgICAgICAgICB9LCBhKTsKICAgICAgICAgICAgICAgICAgICBTKGJmLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gUCh2ZSksIGQgPSB0KFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIGUgPSBkLm5leHQoKTsgIWUuZG9uZTsgZSA9IGQubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUudmFsdWUsIHAoT2JqZWN0LCAnYXNzaWduJykuY2FsbChPYmplY3QsIGMuZ1tlXSwgYltlXSk7CiAgICAgICAgICAgICAgICAgICAgfSwgYSk7CiAgICAgICAgICAgICAgICB9LCBlZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYS5oYXNPd25Qcm9wZXJ0eSgnaW5pdC1kb25lJykgfHwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGEsICdpbml0LWRvbmUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBmZiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgZ2YgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIGEuZyA9IGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFQoUWUsIGIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkoZCwgYyk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBhLmggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKFJlLCBiLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKGMpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaGYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYS5zcGxpdCgnLicpOwogICAgICAgICAgICAgICAgICAgICAgICBhID0gejsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IDAsIGU7IG51bGwgIT0gYSAmJiBkIDwgYy5sZW5ndGg7IGQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBhLCBhID0gYVtjW2RdXSwgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGEgJiYgKGEgPSBlW2NbZF1dKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZiA9PT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBqZiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgIHRoaXNbZmVdID0gKGFbOF0gPSBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gdmEoYik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGFbOV0gPSBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB2YShiKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gYyAmJiBjLnRvU3RyaW5nICYmIGMudG9TdHJpbmcoKSwgYiA9ICdzdHJpbmcnID09PSB0eXBlb2YgYyAmJiAtMSAhPSBjLmluZGV4T2YoJ1tuYXRpdmUgY29kZV0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgfSwgYVsxMF0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cgPT0gd2luZG93LnRvcDsKICAgICAgICAgICAgICAgICAgICB9LCBhWzZdID0gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRhKFAoZmYpLmgoKSwgcGFyc2VJbnQoYiwgMTApKTsKICAgICAgICAgICAgICAgICAgICB9LCBhWzI3XSA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBoZihiLCAnYm9vbGVhbicpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBiID8gYiA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9LCBhWzYwXSA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF6LmRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoYik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGEpOwogICAgICAgICAgICAgICAgICAgIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICB0aGlzW05dID0gKGFbM10gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCYygpOwogICAgICAgICAgICAgICAgICAgIH0sIGFbNl0gPSBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICBiID0gaGYoYiwgJ251bWJlcicpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBiID8gYiA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9LCBhWzExXSA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBDYyh2b2lkIDAgPT09IGIgPyAnJyA6IGIsIHopOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBiID8gdm9pZCAwIDogYiAlIDEwMDA7CiAgICAgICAgICAgICAgICAgICAgfSwgYSk7CiAgICAgICAgICAgICAgICAgICAgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgIHRoaXNbZ2VdID0gKGFbMl0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubG9jYXRpb24uaHJlZjsKICAgICAgICAgICAgICAgICAgICB9LCBhWzNdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy50b3AubG9jYXRpb24uaGFzaDsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgYVs0XSA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBoZihiLCAnc3RyaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IGIgPyBiIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIH0sIGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGtmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB2b2lkIDAgPT09IGEgPyB6IDogYTsKICAgICAgICAgICAgICAgIHJldHVybiBhLmdnZWFjIHx8IChhLmdnZWFjID0ge30pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbWYgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBsZik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYobWYsIEEpOwogICAgICAgICAgICBtZi5wcm90b3R5cGUuZ2V0SWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gRCh0aGlzLCAxLCAwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbWYucHJvdG90eXBlLkEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gRCh0aGlzLCA3LCAwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGxmID0gWzJdOwogICAgICAgICAgICB2YXIgb2YgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBuZik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYob2YsIEEpOwogICAgICAgICAgICBvZi5wcm90b3R5cGUuQSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBEKHRoaXMsIDUsIDApOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbmYgPSBbMl07CiAgICAgICAgICAgIHZhciBxZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBBLmNhbGwodGhpcywgYSwgLTEsIHBmKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihxZiwgQSk7CiAgICAgICAgICAgIHZhciBzZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBBLmNhbGwodGhpcywgYSwgLTEsIHJmKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihzZiwgQSk7CiAgICAgICAgICAgIHNmLnByb3RvdHlwZS5BID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEQodGhpcywgMSwgMCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB0ZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBBLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYodGYsIEEpOwogICAgICAgICAgICB2YXIgcGYgPSBbCiAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgXSwgcmYgPSBbMl07CiAgICAgICAgICAgIHZhciB1ZiA9IFsKICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAxMywKICAgICAgICAgICAgICAgICAgICAyMAogICAgICAgICAgICAgICAgXSwgdmYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB9LCB3ZiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgZSA9IHZvaWQgMCA9PT0gZSA/IHt9IDogZTsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHZvaWQgMCA9PT0gZS5aID8gITEgOiBlLlosIGggPSB2b2lkIDAgPT09IGUuZWEgPyB7fSA6IGUuZWE7CiAgICAgICAgICAgICAgICAgICAgZSA9IHZvaWQgMCA9PT0gZS4kID8gW10gOiBlLiQ7CiAgICAgICAgICAgICAgICAgICAgYS5pID0gYjsKICAgICAgICAgICAgICAgICAgICBhLm8gPSB7fTsKICAgICAgICAgICAgICAgICAgICBhLnMgPSBmOwogICAgICAgICAgICAgICAgICAgIGEubCA9IGg7CiAgICAgICAgICAgICAgICAgICAgYiA9IHt9OwogICAgICAgICAgICAgICAgICAgIGEuaCA9IChiW2NdID0gW10sIGJbNF0gPSBbXSwgYik7CiAgICAgICAgICAgICAgICAgICAgYS5qID0ge307CiAgICAgICAgICAgICAgICAgICAgKGMgPSAkZCgpKSAmJiBPYShjLnNwbGl0KCcsJykgfHwgW10sIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIChnID0gcGFyc2VJbnQoZywgMTApKSAmJiAoYS5qW2ddID0gITApOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIE9hKGUsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEualtnXSA9ICEwOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGEuZyA9IGQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9LCBBZiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBbXSwgZSA9IHhmKGEuaSwgYiksIGY7CiAgICAgICAgICAgICAgICAgICAgaWYgKGYgPSA5ICE9PSBiKQogICAgICAgICAgICAgICAgICAgICAgICBhLm9bYl0gPyBmID0gITAgOiAoYS5vW2JdID0gITAsIGYgPSAhMSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGg7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT0gKGggPSBhLmcpIHx8IHRlKGgsIGIsIGMsIGQsIFtdLCA0KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICghZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGc7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT0gKGcgPSBhLmcpIHx8IHRlKGcsIGIsIGMsIGQsIFtdLCAzKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciBrID0gVGEodWYsIGIpLCBsID0gW107CiAgICAgICAgICAgICAgICAgICAgT2EoZSwgZnVuY3Rpb24gKHEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHkgPSBuZXcgUGQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHEgPSB5ZihhLCBxLCBjLCB5KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgIT09IEcoeSwgUWQpICYmIGwucHVzaCh5KSwgeSA9IHEuZ2V0SWQoKSwgZC5wdXNoKHkpLCB6ZihhLCB5LCBrID8gNCA6IGMpLCAocSA9IEkocSwgTywgMikpICYmIChrID8gSmUocSwgTGUoKSwgYS5nLCB5KSA6IEplKHEsIFtjXSwgYS5nLCB5KSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSAobiA9IGEuZykgfHwgdGUobiwgYiwgYywgZCwgbCwgMSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICB9LCB6ZiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYS5oW2NdIHx8IChhLmhbY10gPSBbXSk7CiAgICAgICAgICAgICAgICAgICAgYSA9IGEuaFtjXTsKICAgICAgICAgICAgICAgICAgICBUYShhLCBiKSB8fCBhLnB1c2goYik7CiAgICAgICAgICAgICAgICB9LCBCZiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYS5pLnB1c2guYXBwbHkoYS5pLCB1KFBhKFFhKGIsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgc2YoYyk7CiAgICAgICAgICAgICAgICAgICAgfSksIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhVGEodWYsIGMuQSgpKTsKICAgICAgICAgICAgICAgICAgICB9KSkpOwogICAgICAgICAgICAgICAgfSwgeWYgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gUCh2ZSkuZzsKICAgICAgICAgICAgICAgICAgICBpZiAoIWxlKEgoYiwgYmUsIDMpLCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBJKGIsIG1mLCAyKSwgaCA9IEQoYiwgNiwgMCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGIoZCwgMSwgUWQsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICBmID0gZVtOXTsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gZls4XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gZls3XTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBjID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGcoaCksIEYoZCwgMywgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoYiA9IENmKGIsIGMpKSA/IERmKGEsIFtiXSwgMSkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoaCA9IEQoYiwgMTAsIDApKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBiKGQsIDIsIFFkLCBoKTsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gZVtOXVs5XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gZVtOXVsxMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBnID8gZyhTdHJpbmcoaCkpIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBjICYmIDEgPT09IEQoYiwgMTEsIDApKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gYyAmJiBGKGQsIDMsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGIgPSBDZihiLCBjKSkgPyBEZihhLCBbYl0sIDEpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZCA9IGUgPyBQYShmLCBmdW5jdGlvbiAoaykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGUoSChrLCBiZSwgMyksIGUpOwogICAgICAgICAgICAgICAgICAgIH0pIDogZjsKICAgICAgICAgICAgICAgICAgICBpZiAoIWQubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICBjID0gZC5sZW5ndGggKiBEKGIsIDEsIDApOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAoYiA9IEQoYiwgNCwgMCkpID8gRWYoYSwgYiwgYywgZCkgOiBEZihhLCBkLCBjIC8gMTAwMCk7CiAgICAgICAgICAgICAgICB9LCBFZiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBudWxsICE9IGEubFtiXSA/IGEubFtiXSA6IDEwMDA7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPj0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgZCA9IERmKGEsIGQsIGMgLyBlKTsKICAgICAgICAgICAgICAgICAgICBhLmxbYl0gPSBkID8gMCA6IGUgLSBjOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgfSwgRGYgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gYS5qLCBlID0gUmEoYiwgZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRbZi5nZXRJZCgpXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPyBlIDogYS5zID8gbnVsbCA6IHVjKGIsIGMpOwogICAgICAgICAgICAgICAgfSwgRmYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIFMoTmUsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEualtjXSA9ICEwOwogICAgICAgICAgICAgICAgICAgIH0sIGIpOwogICAgICAgICAgICAgICAgICAgIFMoUWUsIGZ1bmN0aW9uIChjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZihhLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICB9LCBiKTsKICAgICAgICAgICAgICAgICAgICBTKFJlLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGEuaFtjXSB8fCBbXSkuY29uY2F0KGEuaFs0XSk7CiAgICAgICAgICAgICAgICAgICAgfSwgYik7CiAgICAgICAgICAgICAgICAgICAgUygkZSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJmKGEsIGMpOwogICAgICAgICAgICAgICAgICAgIH0sIGIpOwogICAgICAgICAgICAgICAgICAgIFMoT2UsIGZ1bmN0aW9uIChjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6ZihhLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICB9LCBiKTsKICAgICAgICAgICAgICAgIH0sIHhmID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGEgPSBSYShhLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5BKCkgPT0gYjsKICAgICAgICAgICAgICAgICAgICB9KSkgJiYgSShhLCBvZiwgMikgfHwgW107CiAgICAgICAgICAgICAgICB9LCBDZiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBJKGEsIG1mLCAyKSwgZCA9IGMubGVuZ3RoLCBlID0gRChhLCA4LCAwKTsKICAgICAgICAgICAgICAgICAgICBhID0gZCAqIEQoYSwgMSwgMCkgLSAxOwogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgIT09IGIgPyBiIDogTWF0aC5mbG9vcigxMDAwICogdGMoKSk7CiAgICAgICAgICAgICAgICAgICAgZCA9IChiIC0gZSkgJSBkOwogICAgICAgICAgICAgICAgICAgIGlmIChiIDwgZSB8fCBiIC0gZSAtIGQgPj0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgYyA9IGNbZF07CiAgICAgICAgICAgICAgICAgICAgZSA9IFAodmUpLmc7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFjIHx8IGUgJiYgIWxlKEgoYywgYmUsIDMpLCBlKSA/IG51bGwgOiBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEdmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0ge307CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gYVtiXSA/IGFbYl0gOiBjOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gYVtiXSA/IGFbYl0gOiBjOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gYVtiXSA/IGFbYl0gOiBjOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gYVtiXSA/IGFbYl0gOiBjOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBIZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFAoR2YpLmooYS5nLCBhLmRlZmF1bHRWYWx1ZSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgSWYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBKZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgUChJZikuZyhhKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBLZiwgTGYsIE1mLCBOZiwgT2YsIFBmLCBTZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBQKFFmKS5nLCBjID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgWjogVVsyMTFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJDogVVsyMjZdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGQgPSB2b2lkIDAsIGUgPSAyOwogICAgICAgICAgICAgICAgICAgIGQgPSB2b2lkIDAgPT09IGQgPyBrZigpIDogZDsKICAgICAgICAgICAgICAgICAgICBlID0gdm9pZCAwID09PSBlID8gMCA6IGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSB2b2lkIDAgPT09IGYgPyBuZXcgcmUobnVsbCAhPSAoTmYgPSBudWxsID09IChLZiA9IEgoYSwgdGYsIDUpKSA/IHZvaWQgMCA6IEQoS2YsIDIsIDApKSA/IE5mIDogMCwgbnVsbCAhPSAoT2YgPSBudWxsID09IChMZiA9IEgoYSwgdGYsIDUpKSA/IHZvaWQgMCA6IEQoTGYsIDQsIDApKSA/IE9mIDogMCwgbnVsbCAhPSAoUGYgPSBudWxsID09IChNZiA9IEgoYSwgdGYsIDUpKSA/IHZvaWQgMCA6IG1iKE1mLCAzKSkgPyBQZiA6ICExKSA6IGY7CiAgICAgICAgICAgICAgICAgICAgZC5oYXNPd25Qcm9wZXJ0eSgnaW5pdC1kb25lJykgPyAoVCgkZSwgZCkoUWEoSShhLCBzZiwgMiksIGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoLnRvSlNPTigpOwogICAgICAgICAgICAgICAgICAgIH0pKSwgVChhZiwgZCkoUWEoSShhLCBPLCAxKSwgZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGgudG9KU09OKCk7CiAgICAgICAgICAgICAgICAgICAgfSksIGUpLCBiICYmIFQoYmYsIGQpKGIpLCBSZihkLCBlKSkgOiAoRmYod2YoUCh2ZiksIEkoYSwgc2YsIDIpLCBlLCBmLCBjKSwgZCksIGNmKGQpLCBkZihkKSwgZWYoZCksIFJmKGQsIGUpLCBKZShJKGEsIE8sIDEpLCBbZV0sIGYsIHZvaWQgMCwgITApLCB4ZSA9IHhlIHx8ICEoIWMgfHwgIWMueGEpLCBKZihQKGpmKSksIGIgJiYgSmYoYikpOwogICAgICAgICAgICAgICAgfSwgUmYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSB2b2lkIDAgPT09IGEgPyBrZigpIDogYTsKICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gMCA6IGI7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLCBkID0gYjsKICAgICAgICAgICAgICAgICAgICBkID0gdm9pZCAwID09PSBkID8gMCA6IGQ7CiAgICAgICAgICAgICAgICAgICAgZ2YoUChmZiksIGMsIGQpOwogICAgICAgICAgICAgICAgICAgIFRmKGEsIGIpOwogICAgICAgICAgICAgICAgICAgIFAoSWYpLmcgPSBUKGJmLCBhKTsKICAgICAgICAgICAgICAgICAgICBQKEdmKS5pKCk7CiAgICAgICAgICAgICAgICB9LCBUZiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBQKEdmKTsKICAgICAgICAgICAgICAgICAgICBjLmogPSBmdW5jdGlvbiAoZCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChUZSwgYSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB9KShkLCBlLCBiKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGMuZyA9IGZ1bmN0aW9uIChkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKFVlLCBhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSkoZCwgZSwgYik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBjLmwgPSBmdW5jdGlvbiAoZCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChWZSwgYSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICB9KShkLCBlLCBiKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGMuaCA9IGZ1bmN0aW9uIChkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKFdlLCBhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKGQsIGUsIGIpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYy5pID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBUKFBlLCBhKShiKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFVmID0gUChHZikuaChiZC5nLCBiZC5kZWZhdWx0VmFsdWUpOwogICAgICAgICAgICBmdW5jdGlvbiBWZihhKSB7CiAgICAgICAgICAgICAgICBhID0gdm9pZCAwID09PSBhID8gd2luZG93LmRvY3VtZW50IDogYTsKICAgICAgICAgICAgICAgIEVjKFVmLCBhKTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBXZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gdm9pZCAwID09PSBhID8geiA6IGE7CiAgICAgICAgICAgICAgICByZXR1cm4gKGEgPSBhLnBlcmZvcm1hbmNlKSAmJiBhLm5vdyA/IGEubm93KCkgOiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWGYgPSB6LnBlcmZvcm1hbmNlLCBZZiA9ICEhKFhmICYmIFhmLm1hcmsgJiYgWGYubWVhc3VyZSAmJiBYZi5jbGVhck1hcmtzKSwgWmYgPSBpYyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGE7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEgPSBZZikKICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICRkKCksIGEgPSAhIWEuaW5kZXhPZiAmJiAwIDw9IGEuaW5kZXhPZignMTMzNycpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciAkZiA9IGthKFsnaHR0cHM6Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9wYWdlYWQvanMvZXJyX3JlcC5qcyddKSwgYWcgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IHZvaWQgMCA9PT0gYSA/IG51bGwgOiBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaSA9IHZvaWQgMCA9PT0gYiA/ICdqc2Vycm9yJyA6IGI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSB2b2lkIDAgPT09IGMgPyAwLjAxIDogYzsKICAgICAgICAgICAgICAgICAgICB0aGlzLm8gPSB0aGlzLmw7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zID0gbnVsbDsKICAgICAgICAgICAgICAgIH0sIGJnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBhLmggPSBiOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgYWcucHJvdG90eXBlLmwgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/IHRoaXMuaiA6IGM7CiAgICAgICAgICAgICAgICBlID0gdm9pZCAwID09PSBlID8gdGhpcy5pIDogZTsKICAgICAgICAgICAgICAgIGlmIChNYXRoLnJhbmRvbSgpID4gYykKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICBiLmVycm9yICYmIGIubWV0YSAmJiBiLmlkIHx8IChiID0gbmV3IFlkKGIsIHsKICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiBhLAogICAgICAgICAgICAgICAgICAgIGlkOiBlCiAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICBpZiAoZCB8fCB0aGlzLmgpCiAgICAgICAgICAgICAgICAgICAgYi5tZXRhID0ge30sIHRoaXMuaCAmJiB0aGlzLmgoYi5tZXRhKSwgZCAmJiBkKGIubWV0YSk7CiAgICAgICAgICAgICAgICB6Lmdvb2dsZV9qc19lcnJvcnMgPSB6Lmdvb2dsZV9qc19lcnJvcnMgfHwgW107CiAgICAgICAgICAgICAgICB6Lmdvb2dsZV9qc19lcnJvcnMucHVzaChiKTsKICAgICAgICAgICAgICAgIGlmICghei5lcnJvcl9yZXBfbG9hZGVkKSB7CiAgICAgICAgICAgICAgICAgICAgYyA9IEljKCRmKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZjsKICAgICAgICAgICAgICAgICAgICBhID0gei5kb2N1bWVudDsKICAgICAgICAgICAgICAgICAgICBiID0gbnVsbCAhPSAoZiA9IHRoaXMucykgPyBmIDogbmV3IEooZmMoYykudG9TdHJpbmcoKSwgRmIpOwogICAgICAgICAgICAgICAgICAgIGYgPSBEYygnU0NSSVBUJywgYSk7CiAgICAgICAgICAgICAgICAgICAgZi5zcmMgPSBmYyhiKTsKICAgICAgICAgICAgICAgICAgICBnYyhmKTsKICAgICAgICAgICAgICAgICAgICAoYSA9IGEuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ3NjcmlwdCcpWzBdKSAmJiBhLnBhcmVudE5vZGUgJiYgYS5wYXJlbnROb2RlLmluc2VydEJlZm9yZShmLCBhKTsKICAgICAgICAgICAgICAgICAgICB6LmVycm9yX3JlcF9sb2FkZWQgPSAhMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGNnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmcgJiYgYS5nLnN0YXJ0KCc0MjAnLCAzKTsKICAgICAgICAgICAgICAgICAgICBiKCk7CiAgICAgICAgICAgICAgICAgICAgYS5nICYmIGMgJiYgYS5nLmVuZChjKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5nICYmIGMgJiYgKGIgPSBjKSAmJiBYZiAmJiBaZigpICYmIChYZi5jbGVhck1hcmtzKCdnb29nXycgKyBiLmxhYmVsICsgJ18nICsgYi51bmlxdWVJZCArICdfc3RhcnQnKSwgWGYuY2xlYXJNYXJrcygnZ29vZ18nICsgYi5sYWJlbCArICdfJyArIGIudW5pcXVlSWQgKyAnX2VuZCcpKSwgIWEubyg0MjAsIGQsIGEuaiwgdm9pZCAwLCBhLmkpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZGcgPSBQKEdmKS5oKGNkLmcsIGNkLmRlZmF1bHRWYWx1ZSk7CiAgICAgICAgICAgIGZ1bmN0aW9uIGVnKGEpIHsKICAgICAgICAgICAgICAgIGEgPSB2b2lkIDAgPT09IGEgPyB3aW5kb3cuZG9jdW1lbnQgOiBhOwogICAgICAgICAgICAgICAgRWMoZGcsIGEpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgdmFyIGZnID0gQ2IoJ2dwdC9wdWJhZHNfaW1wbF8nKTsKICAgICAgICAgICAgdmFyIGdnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IFdmKGIpOwogICAgICAgICAgICAgICAgICAgIGMgJiYgKGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsOiBhLAogICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiA5LAogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogYwogICAgICAgICAgICAgICAgICAgIH0sIGIgPSBiLmdvb2dsZV9qc19yZXBvcnRpbmdfcXVldWUgPSBiLmdvb2dsZV9qc19yZXBvcnRpbmdfcXVldWUgfHwgW10sIDIwNDggPiBiLmxlbmd0aCAmJiBiLnB1c2goYSkpOwogICAgICAgICAgICAgICAgfSwgaGcgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gd2luZG93OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gV2YoKSwgZiA9IDM7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGIuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IDEzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoYSwgZyksIGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBnOwogICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5nb29nbGVfbWVhc3VyZV9qc190aW1pbmcgJiYgZSAmJiAoZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbDogYS50b1N0cmluZygpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR1cmF0aW9uOiAoV2YoKSB8fCAwKSAtIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZiA9IGQuZ29vZ2xlX2pzX3JlcG9ydGluZ19xdWV1ZSA9IGQuZ29vZ2xlX2pzX3JlcG9ydGluZ19xdWV1ZSB8fCBbXSwgMjA0OCA+IGYubGVuZ3RoICYmIGYucHVzaChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGg7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIGlnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaGcoYSwgYiwgZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbmV3IGFnKCkubChjLCBkKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBqZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IHRoaXMuajsKICAgICAgICAgICAgICAgIHRoaXMuaSA9IHRoaXMuaTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgamcucHJvdG90eXBlLmogPSAhMTsKICAgICAgICAgICAgamcucHJvdG90eXBlLkwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBpZiAodGhpcy5pKQogICAgICAgICAgICAgICAgICAgIGZvciAoOyB0aGlzLmkubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pLnNoaWZ0KCkoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gVihhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBiID8gJyYnICsgYSArICc9bnVsbCcgOiAnJicgKyBhICsgJz0nICsgTWF0aC5mbG9vcihiKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBrZyhhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyYnICsgYSArICc9JyArIGIudG9GaXhlZCgzKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBsZygpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IG0uU2V0KCk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHZvaWQgMCA9PT0gYiA/IHdpbmRvdyA6IGI7CiAgICAgICAgICAgICAgICBiID0gYi5nb29nbGV0YWc7CiAgICAgICAgICAgICAgICBiID0gKG51bGwgPT09IGIgfHwgdm9pZCAwID09PSBiID8gMCA6IGIuYXBpUmVhZHkpID8gYiA6IHZvaWQgMDsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFiKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gYi5wdWJhZHMoKSwgZCA9IHQoYy5nZXRTbG90cygpKSwgZSA9IGQubmV4dCgpOyAhZS5kb25lOyBlID0gZC5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGEuYWRkKGUudmFsdWUuZ2V0U2xvdElkKCkuZ2V0RG9tSWQoKSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChmKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBtZyhhKSB7CiAgICAgICAgICAgICAgICBhID0gYS5pZDsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGEgJiYgKGxnKCkuaGFzKGEpIHx8IHAoYSwgJ3N0YXJ0c1dpdGgnKS5jYWxsKGEsICdnb29nbGVfYWRzX2lmcmFtZV8nKSB8fCBwKGEsICdzdGFydHNXaXRoJykuY2FsbChhLCAnYXN3aWZ0JykpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIG5nKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGlmICghYS5zb3VyY2VzKQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIHN3aXRjaCAob2coYSkpIHsKICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHBnKGEpOwogICAgICAgICAgICAgICAgICAgIGlmIChkKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5zb21lKGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcWcoZCwgZik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgIHZhciBlID0gcmcoYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiLnNvbWUoZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxZyhlLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gb2coYSkgewogICAgICAgICAgICAgICAgaWYgKCFhLnNvdXJjZXMpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICBhID0gYS5zb3VyY2VzLmZpbHRlcihmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiLnByZXZpb3VzUmVjdCAmJiBiLmN1cnJlbnRSZWN0OwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBpZiAoMSA8PSBhLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIGEgPSBhWzBdOwogICAgICAgICAgICAgICAgICAgIGlmIChhLnByZXZpb3VzUmVjdC50b3AgPCBhLmN1cnJlbnRSZWN0LnRvcCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEucHJldmlvdXNSZWN0LnRvcCA+IGEuY3VycmVudFJlY3QudG9wKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHJnKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBzZyhhLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiLmN1cnJlbnRSZWN0OwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcGcoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIHNnKGEsIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIucHJldmlvdXNSZWN0OwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gc2coYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIGEuc291cmNlcy5yZWR1Y2UoZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICBkID0gYihkKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyA/IGQgJiYgMCAhPT0gZC53aWR0aCAqIGQuaGVpZ2h0ID8gZC50b3AgPCBjLnRvcCA/IGQgOiBjIDogYyA6IGQ7CiAgICAgICAgICAgICAgICB9LCBudWxsKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgdGcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBqZy5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5oID0gdGhpcy5nID0gdGhpcy5HID0gdGhpcy5GID0gdGhpcy5LID0gMDsKICAgICAgICAgICAgICAgIHRoaXMuViA9IHRoaXMuUyA9IE51bWJlci5ORUdBVElWRV9JTkZJTklUWTsKICAgICAgICAgICAgICAgIHRoaXMuTiA9IHRoaXMuUCA9IHRoaXMuUiA9IHRoaXMuVCA9IHRoaXMuWSA9IHRoaXMubyA9IHRoaXMuWCA9IHRoaXMuSSA9IDA7CiAgICAgICAgICAgICAgICB0aGlzLk8gPSAhMTsKICAgICAgICAgICAgICAgIHRoaXMuSCA9IHRoaXMuRCA9IHRoaXMucyA9IDA7CiAgICAgICAgICAgICAgICB2YXIgYSA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJ1tkYXRhLWdvb2dsZS1xdWVyeS1pZF0nKTsKICAgICAgICAgICAgICAgIHRoaXMuVyA9IGEgPyBhLmdldEF0dHJpYnV0ZSgnZGF0YS1nb29nbGUtcXVlcnktaWQnKSA6IG51bGw7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBudWxsOwogICAgICAgICAgICAgICAgdGhpcy5VID0gITE7CiAgICAgICAgICAgICAgICB0aGlzLk0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KHRnLCBqZyk7CiAgICAgICAgICAgIHZhciB3ZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG5ldyB0ZygpOwogICAgICAgICAgICAgICAgICAgIGlmIChIZihlZCkgJiYgIXdpbmRvdy5nb29nbGVfcGxtZXRyaWNzICYmIHdpbmRvdy5QZXJmb3JtYW5jZU9ic2VydmVyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5nb29nbGVfcGxtZXRyaWNzID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSB0KFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2xheW91dC1zaGlmdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsYXJnZXN0LWNvbnRlbnRmdWwtcGFpbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZmlyc3QtaW5wdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbG9uZ3Rhc2snCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIGMgPSBiLm5leHQoKTsgIWMuZG9uZTsgYyA9IGIubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMudmFsdWUsIHVnKGEpLm9ic2VydmUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmcoYSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdWcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEubCB8fCAoYS5sID0gbmV3IFBlcmZvcm1hbmNlT2JzZXJ2ZXIoaWcoNjQwLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHhnICE9PSB3aW5kb3cuc2Nyb2xsWCB8fCB5ZyAhPT0gd2luZG93LnNjcm9sbFkgPyBbXSA6IHpnLCBkID0gQWcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IHQoYi5nZXRFbnRyaWVzKCkpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYi5uZXh0KCk7ICFlLmRvbmU7IGUgPSBiLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSA9IGUudmFsdWUsIGUuZW50cnlUeXBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdsYXlvdXQtc2hpZnQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUuaGFkUmVjZW50SW5wdXQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5LICs9IE51bWJlcihlLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTnVtYmVyKGUudmFsdWUpID4gZi5GICYmIChmLkYgPSBOdW1iZXIoZS52YWx1ZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLkcgKz0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBuZyhlLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCAmJiAoZi5vICs9IGUudmFsdWUsIGYuVCsrKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDUwMDAgPCBlLnN0YXJ0VGltZSAtIGYuUyB8fCAxMDAwIDwgZS5zdGFydFRpbWUgLSBmLlYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLlMgPSBlLnN0YXJ0VGltZSwgZi5nID0gMCwgZi5oID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5WID0gZS5zdGFydFRpbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuZyArPSBlLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoICYmIChmLmggKz0gZS52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuZyA+IGYuSSAmJiAoZi5JID0gZi5nLCBmLlkgPSBmLmgsIGYuWCA9IGUuc3RhcnRUaW1lICsgZS5kdXJhdGlvbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbGFyZ2VzdC1jb250ZW50ZnVsLXBhaW50JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLlIgPSBNYXRoLmZsb29yKGUucmVuZGVyVGltZSB8fCBlLmxvYWRUaW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLlAgPSBlLnNpemU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdmaXJzdC1pbnB1dCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5OID0gTnVtYmVyKChlLnByb2Nlc3NpbmdTdGFydCAtIGUuc3RhcnRUaW1lKS50b0ZpeGVkKDMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLk8gPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2xvbmd0YXNrJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gTWF0aC5tYXgoMCwgZS5kdXJhdGlvbiAtIDUwKSwgYS5zICs9IGUsIGEuRCA9IE1hdGgubWF4KGEuRCwgZSksIGEuSCArPSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubDsKICAgICAgICAgICAgICAgIH0sIHZnID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGlnKDY0MSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBkb2N1bWVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIgPT0gKEhmKGRkKSAmJiBkLnByZXJlbmRlcmluZyA/IDMgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlzaWJsZTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaWRkZW46IDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlcmVuZGVyOiAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZXZpZXc6IDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5sb2FkZWQ6IDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1bZC52aXNpYmlsaXR5U3RhdGUgfHwgZC53ZWJraXRWaXNpYmlsaXR5U3RhdGUgfHwgZC5tb3pWaXNpYmlsaXR5U3RhdGUgfHwgJyddIHx8IDApICYmIEJnKGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgYyA9IGlnKDY0MSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgQmcoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ3Zpc2liaWxpdHljaGFuZ2UnLCBiKTsKICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5hZGRFdmVudExpc3RlbmVyKCd1bmxvYWQnLCBjKTsKICAgICAgICAgICAgICAgICAgICBhLk0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LnJlbW92ZUV2ZW50TGlzdGVuZXIoJ3Zpc2liaWxpdHljaGFuZ2UnLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQucmVtb3ZlRXZlbnRMaXN0ZW5lcigndW5sb2FkJywgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHVnKGEpLmRpc2Nvbm5lY3QoKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdGcucHJvdG90eXBlLkwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBqZy5wcm90b3R5cGUuTC5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5NKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBCZyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFhLlUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYS5VID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIHVnKGEpLnRha2VSZWNvcmRzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gJ2h0dHBzOi8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20vcGFnZWFkL2dlbl8yMDQ/aWQ9cGxtZXRyaWNzJzsKICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LkxheW91dFNoaWZ0ICYmIChiICs9IGtnKCdjbHMnLCBhLkspLCBiICs9IGtnKCdtbHMnLCBhLkYpLCBiICs9IFYoJ25scycsIGEuRyksIHdpbmRvdy5MYXlvdXRTaGlmdEF0dHJpYnV0aW9uICYmIChiICs9IGtnKCdjYXMnLCBhLm8pLCBiICs9IFYoJ25hcycsIGEuVCkpLCBiICs9IGtnKCd3bHMnLCBhLkkpLCBiICs9IGtnKCd0bHMnLCBhLlgpLCB3aW5kb3cuTGF5b3V0U2hpZnRBdHRyaWJ1dGlvbiAmJiAoYiArPSBrZygnd2FzJywgYS5ZKSkpOwogICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuTGFyZ2VzdENvbnRlbnRmdWxQYWludCAmJiAoYiArPSBWKCdsY3AnLCBhLlIpLCBiICs9IFYoJ2xjcHMnLCBhLlApKTsKICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LlBlcmZvcm1hbmNlRXZlbnRUaW1pbmcgJiYgYS5PICYmIChiICs9IFYoJ2ZpZCcsIGEuTikpOwogICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuUGVyZm9ybWFuY2VMb25nVGFza1RpbWluZyAmJiAoYiArPSBWKCdjYnQnLCBhLnMpLCBiICs9IFYoJ21idCcsIGEuRCksIGIgKz0gVignbmx0JywgYS5IKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwLCBkID0gdChkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnaWZyYW1lJykpLCBlID0gZC5uZXh0KCk7ICFlLmRvbmU7IGUgPSBkLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1nKGUudmFsdWUpICYmIGMrKzsKICAgICAgICAgICAgICAgICAgICAgICAgYiArPSBWKCduaWYnLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IHdpbmRvdy5nb29nbGVfdW5pcXVlX2lkOwogICAgICAgICAgICAgICAgICAgICAgICBiICs9IFYoJ2lmaScsICdudW1iZXInID09PSB0eXBlb2YgYyA/IGMgOiAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IFAoZmYpLmgoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiArPSAnJmVpZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KGMuam9pbigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiArPSAnJnRvcD0nICsgKHogPT09IHoudG9wID8gMSA6IDApOwogICAgICAgICAgICAgICAgICAgICAgICBiICs9IGEuVyA/ICcmcXFpZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KGEuVykgOiBWKCdwdnNpZCcsIEZjKHopKTsKICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93Lmdvb2dsZXRhZyAmJiAoYiArPSAnJmdwdD0xJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5mZXRjaChiLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwYWxpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlZGVudGlhbHM6ICdpbmNsdWRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZGlyZWN0OiAnZm9sbG93JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ2dldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiAnbm8tY29ycycKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuaiB8fCAoYS5qID0gITAsIGEuTCgpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBxZyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBNYXRoLm1pbihhLnJpZ2h0LCBiLnJpZ2h0KSAtIE1hdGgubWF4KGEubGVmdCwgYi5sZWZ0KTsKICAgICAgICAgICAgICAgICAgICBhID0gTWF0aC5taW4oYS5ib3R0b20sIGIuYm90dG9tKSAtIE1hdGgubWF4KGEudG9wLCBiLnRvcCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPj0gYyB8fCAwID49IGEgPyAhMSA6IDUwIDw9IDEwMCAqIGMgKiBhIC8gKChiLnJpZ2h0IC0gYi5sZWZ0KSAqIChiLmJvdHRvbSAtIGIudG9wKSk7CiAgICAgICAgICAgICAgICB9LCBBZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFtdLmNvbmNhdCh1KGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdpZnJhbWUnKSkpLmZpbHRlcihtZyksIGIgPSBbXS5jb25jYXQodShsZygpKSkubWFwKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZpbHRlcihmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHhnID0gd2luZG93LnNjcm9sbFg7CiAgICAgICAgICAgICAgICAgICAgeWcgPSB3aW5kb3cuc2Nyb2xsWTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gemcgPSBbXS5jb25jYXQodShhKSwgdShiKSkubWFwKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgeGcgPSB2b2lkIDAsIHlnID0gdm9pZCAwLCB6ZyA9IFtdOwogICAgICAgICAgICB2YXIgVyA9IHsKICAgICAgICAgICAgICAgICAgICBpc3N1ZXJPcmlnaW46ICdodHRwczovL2F0dGVzdGF0aW9uLmFuZHJvaWQuY29tJywKICAgICAgICAgICAgICAgICAgICBpc3N1YW5jZVBhdGg6ICcvYXR0L2knLAogICAgICAgICAgICAgICAgICAgIHJlZGVtcHRpb25QYXRoOiAnL2F0dC9yJwogICAgICAgICAgICAgICAgfSwgWCA9IHsKICAgICAgICAgICAgICAgICAgICBpc3N1ZXJPcmlnaW46ICdodHRwczovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tJywKICAgICAgICAgICAgICAgICAgICBpc3N1YW5jZVBhdGg6ICcvZHR0L2knLAogICAgICAgICAgICAgICAgICAgIHJlZGVtcHRpb25QYXRoOiAnL2R0dC9yJywKICAgICAgICAgICAgICAgICAgICBnZXRTdGF0ZVBhdGg6ICcvZHR0L3MnCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQ2cgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB2b2lkIDAgPT09IGEgPyB3aW5kb3cgOiBhOwogICAgICAgICAgICAgICAgICAgIGEgPSBhLm5hdmlnYXRvci51c2VyQWdlbnQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSAvQ2hyb21lLy50ZXN0KGEpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAvQW5kcm9pZC8udGVzdChhKSAmJiBiOwogICAgICAgICAgICAgICAgfSwgRGcgPSBQKEdmKS5oKGtkLmcsIGtkLmRlZmF1bHRWYWx1ZSksIEVnID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBhID0gdm9pZCAwID09PSBhID8gITEgOiBhOwogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyAhMSA6IGI7CiAgICAgICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/ICExIDogYzsKICAgICAgICAgICAgICAgICAgICBqZy5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gdGhpczsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBhOwogICAgICAgICAgICAgICAgICAgIGEgPSBbXTsKICAgICAgICAgICAgICAgICAgICBiICYmIENnKCkgJiYgYS5wdXNoKFcpOwogICAgICAgICAgICAgICAgICAgIGMgJiYgYS5wdXNoKFgpOwogICAgICAgICAgICAgICAgICAgIGlmIChkb2N1bWVudC5oYXNUcnVzdFRva2VuICYmICFIZihoZCkgJiYgIUFycmF5LmlzQXJyYXkod2luZG93Lmdvb2dfdHRfc3RhdGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYS5tYXAoZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNzdWVyT3JpZ2luOiBmLmlzc3Vlck9yaWdpbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogZC5nID8gMSA6IDEyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2dvb2dfdHRfc3RhdGUnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc2xpY2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihFZywgamcpOwogICAgICAgICAgICB2YXIgRmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB3aW5kb3c7CiAgICAgICAgICAgICAgICAgICAgYSA9IHZvaWQgMCA9PT0gYSA/IHdpbmRvdyA6IGE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFhLlBlcmlvZGljU3luY01hbmFnZXI7CiAgICAgICAgICAgICAgICB9LCBHZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHZvaWQgMCA9PT0gYSA/IHdpbmRvdy5kb2N1bWVudCA6IGE7CiAgICAgICAgICAgICAgICAgICAgRWMoRGcsIGEpOwogICAgICAgICAgICAgICAgfSwgSGcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gVVsxNTBdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBVWzIyMV0gfHwgJy5nb29nbGUuY2gnID09PSBiIHx8ICdmdW5jdGlvbicgPT09IHR5cGVvZiBhLl9fdGNmYXBpOwogICAgICAgICAgICAgICAgfSwgWSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQsIGUgPSBudWxsID09IChkID0gd2luZG93Lmdvb2dfdHRfc3RhdGUpID8gdm9pZCAwIDogcChkLCAnZmluZCcpLmNhbGwoZCwgZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmLmlzc3Vlck9yaWdpbiA9PT0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgZSAmJiAoZS5zdGF0ZSA9IGIsIHZvaWQgMCAhPSBjICYmIChlLmhhc1JlZGVtcHRpb25SZWNvcmQgPSBjKSk7CiAgICAgICAgICAgICAgICB9LCBJZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFcuaXNzdWVyT3JpZ2luICsgVy5yZWRlbXB0aW9uUGF0aCwgYiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtlZXBhbGl2ZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVzdFRva2VuOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3Rva2VuLXJlZGVtcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzc3VlcjogVy5pc3N1ZXJPcmlnaW4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBvbGljeTogJ25vbmUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgWShXLmlzc3Vlck9yaWdpbiwgMik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5mZXRjaChhLCBiKS50aGVuKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYy5vaykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGMuc3RhdHVzICsgJzogTmV0d29yayByZXNwb25zZSB3YXMgbm90IG9rIScpOwogICAgICAgICAgICAgICAgICAgICAgICBZKFcuaXNzdWVyT3JpZ2luLCA2LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYyAmJiAnTm9Nb2RpZmljYXRpb25BbGxvd2VkRXJyb3InID09PSBjLm5hbWUgPyBZKFcuaXNzdWVyT3JpZ2luLCA2LCAhMCkgOiBZKFcuaXNzdWVyT3JpZ2luLCA1KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIEpnID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gVy5pc3N1ZXJPcmlnaW4gKyBXLmlzc3VhbmNlUGF0aDsKICAgICAgICAgICAgICAgICAgICBZKFcuaXNzdWVyT3JpZ2luLCA4KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LmZldGNoKGEsIHsKICAgICAgICAgICAgICAgICAgICAgICAga2VlcGFsaXZlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgdHJ1c3RUb2tlbjogeyB0eXBlOiAndG9rZW4tcmVxdWVzdCcgfQogICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFiLm9rKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYi5zdGF0dXMgKyAnOiBOZXR3b3JrIHJlc3BvbnNlIHdhcyBub3Qgb2shJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIFkoVy5pc3N1ZXJPcmlnaW4sIDEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElnKCk7CiAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIgJiYgJ05vTW9kaWZpY2F0aW9uQWxsb3dlZEVycm9yJyA9PT0gYi5uYW1lKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFkoVy5pc3N1ZXJPcmlnaW4sIDEwKSwgSWcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgWShXLmlzc3Vlck9yaWdpbiwgOSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBLZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBZKFcuaXNzdWVyT3JpZ2luLCAxMyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50Lmhhc1RydXN0VG9rZW4oVy5pc3N1ZXJPcmlnaW4pLnRoZW4oZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBJZygpIDogSmcoKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIExnID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIFkoWC5pc3N1ZXJPcmlnaW4sIDEzKTsKICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LlByb21pc2UpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBkb2N1bWVudC5oYXNUcnVzdFRva2VuKFguaXNzdWVyT3JpZ2luKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuUHJvbWlzZS5yZWplY3QoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogMTksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYiA9IFguaXNzdWVyT3JpZ2luICsgWC5yZWRlbXB0aW9uUGF0aCwgYyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwYWxpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRydXN0VG9rZW46IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3Rva2VuLXJlZGVtcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUG9saWN5OiAnbm9uZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBZKFguaXNzdWVyT3JpZ2luLCAxNik7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuZmV0Y2goYiwgYykudGhlbihmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZi5vaykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoZi5zdGF0dXMgKyAnOiBOZXR3b3JrIHJlc3BvbnNlIHdhcyBub3Qgb2shJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWShYLmlzc3Vlck9yaWdpbiwgMTgsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYgJiYgJ05vTW9kaWZpY2F0aW9uQWxsb3dlZEVycm9yJyA9PT0gZi5uYW1lKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBZKFguaXNzdWVyT3JpZ2luLCAxOCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuUHJvbWlzZS5yZWplY3QoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiAxNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFkoWC5pc3N1ZXJPcmlnaW4sIDE3KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuaGFzVHJ1c3RUb2tlbihYLmlzc3Vlck9yaWdpbikudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LlByb21pc2UucmVqZWN0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IDE5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gWC5pc3N1ZXJPcmlnaW4gKyBYLmdldFN0YXRlUGF0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFkoWC5pc3N1ZXJPcmlnaW4sIDIwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuZmV0Y2goZiArICc/aHQ9JyArIGUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVzdFRva2VuOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzZW5kLXJlZGVtcHRpb24tcmVjb3JkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNzdWVyczogW1guaXNzdWVyT3JpZ2luXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWgub2spCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGguc3RhdHVzICsgJzogTmV0d29yayByZXNwb25zZSB3YXMgbm90IG9rIScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFkoWC5pc3N1ZXJPcmlnaW4sIDIyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaC50ZXh0KCkudGhlbihmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5wYXJzZShnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5Qcm9taXNlLnJlamVjdCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiAyMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBGYyh3aW5kb3cpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IFguaXNzdWVyT3JpZ2luICsgWC5pc3N1YW5jZVBhdGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLnNycXQgJiYgZS5jcyA/IChZKFguaXNzdWVyT3JpZ2luLCAyMyksIHdpbmRvdy5mZXRjaChmICsgJz9jcz0nICsgZS5jcyArICcmY29ycmVsYXRvcj0nICsgZCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtlZXBhbGl2ZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ1c3RUb2tlbjogeyB0eXBlOiAndG9rZW4tcmVxdWVzdCcgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaC5vaykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoaC5zdGF0dXMgKyAnOiBOZXR3b3JrIHJlc3BvbnNlIHdhcyBub3Qgb2shJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWShYLmlzc3Vlck9yaWdpbiwgMjUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LlByb21pc2UucmVqZWN0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IDI0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZS5zcmR0ICYmIGUuY3MpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFkoWC5pc3N1ZXJPcmlnaW4sIDI2KSwgd2luZG93LmZldGNoKGIgKyAnP2NzPScgKyBlLmNzICsgJyZjb3JyZWxhdG9yPScgKyBkLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtlZXBhbGl2ZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRydXN0VG9rZW46IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd0b2tlbi1yZWRlbXB0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQb2xpY3k6ICdyZWZyZXNoJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYub2spCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihmLnN0YXR1cyArICc6IE5ldHdvcmsgcmVzcG9uc2Ugd2FzIG5vdCBvayEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWShYLmlzc3Vlck9yaWdpbiwgMjgsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LlByb21pc2UucmVqZWN0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiAyNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFkoWC5pc3N1ZXJPcmlnaW4sIDI5KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIGluc3RhbmNlb2YgT2JqZWN0ICYmIGUuaGFzT3duUHJvcGVydHkoJ3N0YXRlJykgJiYgZS5oYXNPd25Qcm9wZXJ0eSgnZXJyb3InKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ251bWJlcicgPT09IHR5cGVvZiBlLnN0YXRlICYmIGUuZXJyb3IgaW5zdGFuY2VvZiBFcnJvcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBZKFguaXNzdWVyT3JpZ2luLCBlLnN0YXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBQKEdmKS5nKGpkLmcsIGpkLmRlZmF1bHRWYWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hdGgucmFuZG9tKCkgPD0gZiAmJiBIYyh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogZS5zdGF0ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycjogZS5lcnJvci50b1N0cmluZygpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICdkdHRfZXJyJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIE1nID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQuaGFzVHJ1c3RUb2tlbiAmJiAhSGYoaGQpICYmIGEuZykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93Lmdvb2dfdHRfcHJvbWlzZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuZ29vZ190dF9wcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICBhID0gd2luZG93Lmdvb2dfdHRfc3RhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcChhLCAnZmluZCcpLmNhbGwoYSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5pc3N1ZXJPcmlnaW4gPT09IFcuaXNzdWVyT3JpZ2luOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgJiYgYi5wdXNoKEtnKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcChhLCAnZmluZCcpLmNhbGwoYSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5pc3N1ZXJPcmlnaW4gPT09IFguaXNzdWVyT3JpZ2luOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgJiYgYi5wdXNoKExnKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5Qcm9taXNlICYmIHdpbmRvdy5Qcm9taXNlLmFsbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA9IHdpbmRvdy5Qcm9taXNlLmFsbChiKSwgJ29iamVjdCcgIT0gdHlwZW9mIHdpbmRvdy5nb29nX3R0X3Byb21pc2UgJiYgT2JqZWN0LmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2dvb2dfdHRfcHJvbWlzZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE5nID0gJ3BsYXRmb3JtIHBsYXRmb3JtVmVyc2lvbiBhcmNoaXRlY3R1cmUgbW9kZWwgdWFGdWxsVmVyc2lvbiBiaXRuZXNzJy5zcGxpdCgnICcpOwogICAgICAgICAgICBmdW5jdGlvbiBPZyhhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiwgYzsKICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nICE9PSB0eXBlb2YgKG51bGwgPT09IChjID0gbnVsbCA9PT0gKGIgPSBudWxsID09PSBhIHx8IHZvaWQgMCA9PT0gYSA/IHZvaWQgMCA6IGEubmF2aWdhdG9yKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLnVzZXJBZ2VudERhdGEpIHx8IHZvaWQgMCA9PT0gYyA/IHZvaWQgMCA6IGMuZ2V0SGlnaEVudHJvcHlWYWx1ZXMpID8gbnVsbCA6IGEubmF2aWdhdG9yLnVzZXJBZ2VudERhdGEuZ2V0SGlnaEVudHJvcHlWYWx1ZXMoTmcpLnRoZW4oZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyBuZCgpOwogICAgICAgICAgICAgICAgICAgIGUgPSBDKGUsIDEsIGQucGxhdGZvcm0pOwogICAgICAgICAgICAgICAgICAgIGUgPSBDKGUsIDIsIGQucGxhdGZvcm1WZXJzaW9uKTsKICAgICAgICAgICAgICAgICAgICBlID0gQyhlLCAzLCBkLmFyY2hpdGVjdHVyZSk7CiAgICAgICAgICAgICAgICAgICAgZSA9IEMoZSwgNCwgZC5tb2RlbCk7CiAgICAgICAgICAgICAgICAgICAgZSA9IEMoZSwgNSwgZC51YUZ1bGxWZXJzaW9uKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQyhlLCA5LCBkLmJpdG5lc3MpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICBmdW5jdGlvbiBQZygpIHsKICAgICAgICAgICAgICAgIHZhciBhOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChhID0gei5nb29nbGV0YWcpICYmIHZvaWQgMCAhPT0gYSA/IGEgOiB6Lmdvb2dsZXRhZyA9IHt9OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFFnKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gUGcoKTsKICAgICAgICAgICAgICAgIGMuaGFzT3duUHJvcGVydHkoYSkgfHwgKGNbYV0gPSBiKTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBaID0ge30sIFUgPSAoWlsyM10gPSAwLjAwMSwgWlszOF0gPSAwLjAwMSwgWls1OF0gPSAxLCBaWzE1MF0gPSAnJywgWlsyMTFdID0gITEsIFpbMjUzXSA9ICExLCBaWzE3Ml0gPSBudWxsLCBaWzI0Nl0gPSBbXSwgWlsyMjZdID0gW10sIFpbMjUyXSA9IG51bGwsIFpbMjU4XSA9IG51bGwsIFpbMjUxXSA9IG51bGwsIFpbMjU5XSA9IG51bGwsIFpbNl0gPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyAhMCA6IGI7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IG51bGw7IGMgIT0gYTsgYyA9IGEsIGEgPSBhLnBhcmVudCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYS5sb2NhdGlvbi5wcm90b2NvbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaHR0cHM6JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdmaWxlOic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdodHRwOic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgfSh3aW5kb3cpLCBaWzM2XSA9IEFjKCdmYWxzZScpLCBaWzE0OF0gPSB3ZSwgWlsyMjFdID0gQWMoJycpLCBaWzI1N10gPSBBYygnZmFsc2UnKSwgWlsyNjBdID0gdm9pZCAwLCBaWzI2Ml0gPSBBYygnZmFsc2UnKSwgWik7CiAgICAgICAgICAgIGZ1bmN0aW9uIFJnKGEsIGIpIHsKICAgICAgICAgICAgICAgIFVbYV0gPSBiOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBTZyA9IFBnKCk7CiAgICAgICAgICAgIHAoT2JqZWN0LCAnYXNzaWduJykuY2FsbChPYmplY3QsIFUsIFNnLl92YXJzXyk7CiAgICAgICAgICAgIFNnLl92YXJzXyA9IFU7CiAgICAgICAgICAgIHZhciBUZyA9IG5ldyBtLldlYWtNYXAoKSwgVWcgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSBbYV07CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IGIubGVuZ3RoIC0gMTsgMCA8PSBjOyAtLWMpCiAgICAgICAgICAgICAgICAgICAgICAgIGEucHVzaCh0eXBlb2YgYltjXSwgYltjXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuam9pbignXHgwQicpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFZnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBVZyA6IGI7CiAgICAgICAgICAgICAgICB2YXIgYyA9IHlhKGEpLCBkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCgpOwogICAgICAgICAgICAgICAgICAgICAgICBlID0gbGEoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKGMsIGUpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gdy5hcHBseSgwLCBhcmd1bWVudHMpLCBmID0gdGhpcyB8fCB6LCBoID0gVGcuZ2V0KGYpOwogICAgICAgICAgICAgICAgICAgIGggfHwgKGggPSB7fSwgVGcuc2V0KGYsIGgpKTsKICAgICAgICAgICAgICAgICAgICBmID0gaDsKICAgICAgICAgICAgICAgICAgICBoID0gW3RoaXNdLmNvbmNhdCh1KGUpKTsKICAgICAgICAgICAgICAgICAgICBlID0gZCA/IGQoaCkgOiBoOwogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZiwgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBmW2VdOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IHQoaCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSBnLm5leHQoKS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGxhKGcpOwogICAgICAgICAgICAgICAgICAgICAgICBoID0gYS5hcHBseShoLCBnKTsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGZbZV0gPSBoOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0oZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAobnVsbCA9PT0gYSB8fCB2b2lkIDAgPT09IGEgPyAwIDogYS5zcmMpID8gL14oPzpodHRwcz86KT9cL1wvKD86d3d3XC5nb29nbGV0YWdzZXJ2aWNlc1wuY29tfHNlY3VyZXB1YmFkc1wuZ1wuZG91YmxlY2xpY2tcLm5ldHxwYWdlYWQyXC5nb29nbGVzeW5kaWNhdGlvblwuY29tKVwvdGFnXC9qc1wvZ3B0KD86X1thLXpdKykqXC5qcy8udGVzdChhLnNyYykgPyAwIDogMSA6IDI7CiAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgIHJldHVybiBhICsgJ1x4MEInICsgKG51bGwgPT09IChjID0gYlswXSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5zcmMpOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgZnVuY3Rpb24gV2coKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMCA9PT0gVmcoVVsxNzJdKTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIGZ1bmN0aW9uIFhnKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHpjKCcxJykgfHwgMDsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBZZygpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gWmc7CiAgICAgICAgICAgICAgICB2YXIgYiA9IE51bWJlcihhKTsKICAgICAgICAgICAgICAgIGlmICgxID4gYiB8fCBNYXRoLmZsb29yKGIpICE9PSBiKQogICAgICAgICAgICAgICAgICAgIEhjKHsgdjogYSB9LCAnZ3B0X2ludl92ZXInKSwgYSA9ICcxJzsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBaZyA9ICcyMDIyMDExMDAyJzsKICAgICAgICAgICAgdmFyIFFmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB7fSwgYiA9IHt9LCBjID0ge307CiAgICAgICAgICAgICAgICB0aGlzLmcgPSAoY1tmZV0gPSAoYVszXSA9IFdnLCBhWzE3XSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcCh3LmFwcGx5KDAsIGFyZ3VtZW50cyksICdpbmNsdWRlcycpLmNhbGwody5hcHBseSgwLCBhcmd1bWVudHMpLCBTdHJpbmcoQ2MoKSkpOwogICAgICAgICAgICAgICAgfSwgYVs1OV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB3LmFwcGx5KDAsIGFyZ3VtZW50cyksIGUgPSBwKGQsICdpbmNsdWRlcycpLCBmID0gU3RyaW5nLCBoOwogICAgICAgICAgICAgICAgICAgIHZhciBnID0gdm9pZCAwID09PSBnID8gd2luZG93IDogZzsKICAgICAgICAgICAgICAgICAgICB2YXIgazsKICAgICAgICAgICAgICAgICAgICBnID0gbnVsbCAhPSAoayA9IG51bGwgPT0gKGggPSBvYyhnLmxvY2F0aW9uLmhyZWYubWF0Y2gobmMpWzNdIHx8IG51bGwpKSA/IHZvaWQgMCA6IGguc3BsaXQoJy4nKSkgPyBrIDogW107CiAgICAgICAgICAgICAgICAgICAgaCA9IDIgPiBnLmxlbmd0aCA/IG51bGwgOiAndWsnID09PSBnW2cubGVuZ3RoIC0gMV0gPyAzID4gZy5sZW5ndGggPyBudWxsIDogd2MoZy5zcGxpY2UoZy5sZW5ndGggLSAzKS5qb2luKCcuJykpIDogd2MoZy5zcGxpY2UoZy5sZW5ndGggLSAyKS5qb2luKCcuJykpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNhbGwoZCwgZihoKSk7CiAgICAgICAgICAgICAgICB9LCBhWzIxXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gVVsxNDhdOwogICAgICAgICAgICAgICAgfSwgYVs2MV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVbMjIxXTsKICAgICAgICAgICAgICAgIH0sIGFbNjNdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBVWzIyMV0gfHwgJy5nb29nbGUuY2gnID09PSBVWzE1MF07CiAgICAgICAgICAgICAgICB9LCBhWzUwXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMSA9PT0gTWF0aC5mbG9vcihuZXcgRGF0ZSgpLmdldFRpbWUoKSAvIDI0IC8gNjAgLyA2MCAvIDEwMDApICUgMjsKICAgICAgICAgICAgICAgIH0sIGFbNTRdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIVVbMjU5XTsKICAgICAgICAgICAgICAgIH0sIGEpLCBjW05dID0gKGJbMV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChkID0gemMoJ3t7TU9EfX0nKSkgJiYgdm9pZCAwICE9PSBkID8gZCA6IC0xOwogICAgICAgICAgICAgICAgfSwgYls0XSA9IFhnLCBiKSwgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGZ1bmN0aW9uICRnKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IHFmKFVbMjQ2XSk7CiAgICAgICAgICAgICAgICBhID0gbmV3IHFmKGEpOwogICAgICAgICAgICAgICAgaWYgKCFJKGIsIE8sIDEpLmxlbmd0aCAmJiBJKGEsIE8sIDEpLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gSShhLCBPLCAxKTsKICAgICAgICAgICAgICAgICAgICB0YihiLCAxLCBjKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICFJKGIsIHNmLCAyKS5sZW5ndGggJiYgSShhLCBzZiwgMikubGVuZ3RoICYmIChjID0gSShhLCBzZiwgMiksIHRiKGIsIDIsIGMpKTsKICAgICAgICAgICAgICAgIG51bGwgPT0gQihiLCA1KSAmJiBudWxsICE9IEIoYSwgNSkgJiYgKGEgPSBIKGEsIHRmLCA1KSwgcWIoYiwgNSwgYSkpOwogICAgICAgICAgICAgICAgU2YoYik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICBmdW5jdGlvbiBhaChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gKGEgPSBhLmN1cnJlbnRTY3JpcHQpID8gYSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gYmgoYSkgewogICAgICAgICAgICAgICAgdmFyIGI7CiAgICAgICAgICAgICAgICBhID0gdChudWxsICE9PSAoYiA9IGEuc2NyaXB0cykgJiYgdm9pZCAwICE9PSBiID8gYiA6IFtdKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBhLm5leHQoKTsgIWMuZG9uZTsgYyA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgIGlmIChjID0gYy52YWx1ZSwgcChjLnNyYywgJ2luY2x1ZGVzJykuY2FsbChjLnNyYywgJy90YWcvanMvZ3B0JykpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gY2goYSkgewogICAgICAgICAgICAgICAgcmV0dXJuICEobnVsbCA9PT0gYSB8fCB2b2lkIDAgPT09IGEgfHwgIWEuc3JjKSAmJiAncGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20nID09PSBvYyhhLnNyYy5tYXRjaChuYylbM10gfHwgbnVsbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gZGgoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBhaChhKTsKICAgICAgICAgICAgICAgIHJldHVybiAnY29tcGxldGUnID09PSBhLnJlYWR5U3RhdGUgfHwgJ2xvYWRlZCcgPT09IGEucmVhZHlTdGF0ZSB8fCAhKG51bGwgPT09IGIgfHwgdm9pZCAwID09PSBiIHx8ICFiLmFzeW5jKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBlaChhKSB7CiAgICAgICAgICAgICAgICBhID0gY2goYSkgPyBDYignaHR0cHM6Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS8nKSA6IENiKCdodHRwczovL3NlY3VyZXB1YmFkcy5nLmRvdWJsZWNsaWNrLm5ldC8nKTsKICAgICAgICAgICAgICAgIGEgPSBLYihbCiAgICAgICAgICAgICAgICAgICAgYSwKICAgICAgICAgICAgICAgICAgICBmZywKICAgICAgICAgICAgICAgICAgICBDYignMjAyMjAxMTAwMicpLAogICAgICAgICAgICAgICAgICAgIENiKCcuanMnKQogICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IFAoR2YpLmcoYWQuZywgYWQuZGVmYXVsdFZhbHVlKTsKICAgICAgICAgICAgICAgIHJldHVybiBiID8gSmIoYSwgU3RyaW5nKGIpKSA6IGE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIGZoID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IFtdOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZXJyb3IgPSB0aGlzLmcgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICB9LCBnaCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYS5nID0gYjsKICAgICAgICAgICAgICAgICAgICBhLmVycm9yID0gYzsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gdChhLmgpLCBlID0gZC5uZXh0KCk7ICFlLmRvbmU7IGUgPSBkLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUudmFsdWUsIGUoYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgYS5oLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBoaChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBhID0gYS5sb2NhdGlvbi5ob3N0OwogICAgICAgICAgICAgICAgdmFyIGQgPSBiICYmIHFjKGIuc3JjLCAnZG9tYWluJyksIGUgPSBiICYmIHFjKGIuc3JjLCAnbmV0d29yay1jb2RlJyk7CiAgICAgICAgICAgICAgICBpZiAoIWEgJiYgIWQgJiYgIWUpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdoKGMsIHZvaWQgMCwgbmV3IG0uZ2xvYmFsVGhpcy5FcnJvcignbm8gcHJvdmlkZWQgb3IgaW5mZXJyZWQgZGF0YScpKSwgbnVsbDsKICAgICAgICAgICAgICAgIGIgPSBjaChiKSA/IENiKCdodHRwczovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tJykgOiBDYignaHR0cHM6Ly9zZWN1cmVwdWJhZHMuZy5kb3VibGVjbGljay5uZXQnKTsKICAgICAgICAgICAgICAgIHJldHVybiBKYihLYihbCiAgICAgICAgICAgICAgICAgICAgYiwKICAgICAgICAgICAgICAgICAgICBDYignL3BhZ2VhZC9wcHViX2NvbmZpZycpCiAgICAgICAgICAgICAgICBdKSwgewogICAgICAgICAgICAgICAgICAgIGlwcGQ6IGEsCiAgICAgICAgICAgICAgICAgICAgcHBwZDogZCwKICAgICAgICAgICAgICAgICAgICBwcHBuYzogZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gaWgoYSwgYikgewogICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF81NDMyODBmMmFiY2EzNmRlID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0Jyk7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzU0MzI4MGYyYWJjYTM2ZGUpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrX2NiNWM4ZjU1YTliYmVhOGIuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG5ldyBmaCgpOwogICAgICAgICAgICAgICAgICAgICAgICBSZygyNjAsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IGMuZyB8fCBjLmVycm9yID8gZShjLmcsIGMuZXJyb3IpIDogYy5oLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IGhoKGEsIGIsIGMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IG5ldyBtLmdsb2JhbFRoaXMuWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQub3BlbignR0VUJywgYi50b1N0cmluZygpLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLndpdGhDcmVkZW50aWFscyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5vbmxvYWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzAwID4gZC5zdGF0dXMgPyAoZ2coJzEzJywgYSksIGdoKGMsIDIwNCA9PT0gZC5zdGF0dXMgPyAnJyA6IGQucmVzcG9uc2VUZXh0KSkgOiBnaChjLCB2b2lkIDAsIG5ldyBtLmdsb2JhbFRoaXMuRXJyb3IoJ3Jlc3A6JyArIGQuc3RhdHVzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5vbmVycm9yID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGdoKGMsIHZvaWQgMCwgbmV3IG0uZ2xvYmFsVGhpcy5FcnJvcignczonICsgZC5zdGF0dXMgKyAnIHJzOicgKyBkLnJlYWR5U3RhdGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnNlbmQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfNTQzMjgwZjJhYmNhMzZkZSkKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX29sZF81NDMyODBmMmFiY2EzNmRlKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gamgoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgVVsxNzJdID0gZDsKICAgICAgICAgICAgICAgIFVbMjU5XSA9IGRoKGEpOwogICAgICAgICAgICAgICAgJGcoYik7CiAgICAgICAgICAgICAgICBQKGZmKS5nKDEyKTsKICAgICAgICAgICAgICAgIFAoZmYpLmcoNSk7CiAgICAgICAgICAgICAgICBHZygpOwogICAgICAgICAgICAgICAgSGcoYykgfHwgKGEgPSAhRmcoKSAmJiBIZihmZCkgfHwgRmcoKSAmJiBIZihnZCksIGIgPSBIZihpZCksIGEgPSBuZXcgRWcoITAsIGEsIGIpLCAwIDwgUChHZikuZyhsZC5nLCBsZC5kZWZhdWx0VmFsdWUpID8gUmcoMjU4LCBNZyhhKSkgOiBNZyhhKSk7CiAgICAgICAgICAgICAgICAoYSA9IE9nKGMpKSAmJiBhLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlID0gdmIoZSk7CiAgICAgICAgICAgICAgICAgICAgVVsyNTFdID0gZTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZWcoYy5kb2N1bWVudCk7CiAgICAgICAgICAgICAgICBWZihjLmRvY3VtZW50KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBraChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYywgZCwgZSwgZiwgaCwgZyA9IFBnKCksIGsgPSBudWxsICE9PSAoYyA9IG51bGwgIT09IGEgJiYgdm9pZCAwICE9PSBhID8gYSA6IGcuZmlmV2luKSAmJiB2b2lkIDAgIT09IGMgPyBjIDogd2luZG93OwogICAgICAgICAgICAgICAgYSA9IGsuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICB2YXIgbCA9IGcuZmlmV2luID8gd2luZG93IDogazsKICAgICAgICAgICAgICAgIFFnKCdfbG9hZGVkXycsICEwKTsKICAgICAgICAgICAgICAgIFFnKCdnZXRWZXJzaW9uJywgWWcpOwogICAgICAgICAgICAgICAgUWcoJ2NtZCcsIFtdKTsKICAgICAgICAgICAgICAgIHZhciBuID0gbnVsbCAhPT0gKGQgPSBhaChhKSkgJiYgdm9pZCAwICE9PSBkID8gZCA6IGJoKGEpOwogICAgICAgICAgICAgICAgamgoYSwgYiwgaywgbik7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHdnKCk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChpYikgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZ2coJzEnLCBrKTsKICAgICAgICAgICAgICAgIGIgPSBlaChuKTsKICAgICAgICAgICAgICAgIGlmICghVVsyNTldKSB7CiAgICAgICAgICAgICAgICAgICAgayA9ICdncHQtaW1wbC0nICsgTWF0aC5yYW5kb20oKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBoYyhhLCBXYihiLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbmNlOiBsYygpCiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChpYikgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBhLmdldEVsZW1lbnRCeUlkKGspICYmIChnLl9sb2FkU3RhcnRlZF8gPSAhMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoIWcuX2xvYWRTdGFydGVkXykgewogICAgICAgICAgICAgICAgICAgIGsgPSBnLmZpZldpbiA/IGwuZG9jdW1lbnQgOiBhOwogICAgICAgICAgICAgICAgICAgIHZhciBxID0gRGMoJ1NDUklQVCcpOwogICAgICAgICAgICAgICAgICAgIHEuc3JjID0gZmMoYik7CiAgICAgICAgICAgICAgICAgICAgZ2MocSk7CiAgICAgICAgICAgICAgICAgICAgcS5hc3luYyA9ICEwOwogICAgICAgICAgICAgICAgICAgIHZhciB5ID0gbnVsbCAhPT0gKGYgPSBudWxsICE9PSAoZSA9IGsuaGVhZCkgJiYgdm9pZCAwICE9PSBlID8gZSA6IGsuYm9keSkgJiYgdm9pZCAwICE9PSBmID8gZiA6IGsuZG9jdW1lbnRFbGVtZW50OwogICAgICAgICAgICAgICAgICAgICdjb21wbGV0ZScgIT09IGwuZG9jdW1lbnQucmVhZHlTdGF0ZSAmJiBnLmZpZldpbiA/IGpjKGwsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgeS5hcHBlbmRDaGlsZChxKTsKICAgICAgICAgICAgICAgICAgICB9KSA6IHkuYXBwZW5kQ2hpbGQocSk7CiAgICAgICAgICAgICAgICAgICAgZy5fbG9hZFN0YXJ0ZWRfID0gITA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBsID09PSBsLnRvcCAmJiAoSGYoJGMpIHx8IFVbMjU5XSB8fCAhYWgoYSkgJiYgKG51bGwgPT09IChoID0gYmgoYSkpIHx8IHZvaWQgMCA9PT0gaCA/IDAgOiBoLmFzeW5jKSkgJiYgKERkKGwpLCBpaChsLCBuKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgbGg7CiAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoRSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbGggPSBFOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGEpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGxoID0gW107CiAgICAgICAgICAgIH0KICAgICAgICAgICAgKGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IG5ldyBhZyhudWxsLCAnZ3B0X2V4Y2VwdGlvbicsIDAuMDEpOwogICAgICAgICAgICAgICAgYmcoYywgZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICBkLm1ldGhvZElkID0gNDIwOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBjZyhjLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQga2goYSwgYik7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSh2b2lkIDAsIGxoKSk7CiAgICAgICAgfS5jYWxsKHRoaXMuZ29vZ2xldGFnICYmIGdvb2dsZXRhZy5maWZXaW4gPyBnb29nbGV0YWcuZmlmV2luLnBhcmVudCA6IHRoaXMsIFsKICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgMC4xCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICA0MTA4MDM2OTAsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAzOTg3NzY4NzgsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICA0MTExNzAxNDcsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDQwODM4MDk5MiwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgMC4wMQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgNDAwOTYzODA1LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgNDAwOTkyNDY4LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAzOTczMTY5MzgsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDEwMDAKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMzg1NDQwMTM1LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAxMDAwCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDM3NzI4OTAxOSwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgMTAwMDAKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMzg1NjEwMTQ5LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAzMDAKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgNTI5LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAyMAogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICA0OTQsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDUwMDAKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDQxMDU2ODA0NiwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDQxMTg0MDk0OSwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDQxMzY4MTY4NiwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDQxMzQ3NzcyOSwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDQxMzY2NzUxNiwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDIwLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMzg4NTI5MTkxLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1OSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNDI3Njc2NzIzOCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgODY0MDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICA0OTIsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDAuMDEKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMzg5MzU3MjMwLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAxMDAwCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDM5ODc3Njg3NywKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgNjAwMDAKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDQwMzQyNjk2NiwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMzc0MjAxMjY5LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICA2MDAwMAogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAzNzEzNjQyMTMsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDYwMDAwCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDM3MzQ0MDkyMywKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDAxCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDM3NjE0OTc1NywKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDI1CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDM5NjY2ODkxNSwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgNQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgMzk5OTgyNzU5LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICA0NywKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAnMS0wLTM4JwogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgMzkyMDY1OTA1LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWycxODE5MDE3NiwxNTU5NTMwNDgnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNDk5NDQ1MjknXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNTQ0MSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc2MTc3J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzY3ODInXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNjU4MSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMzYwMjQ1NTk1LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICA1MDAKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDM5NjQ0MjU5OCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgNjEsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAxCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAxOTM2LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAxOTIxLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICA3MgogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAxOTIwLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAyNAogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAxOTIyLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICA1CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDE5MTcsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDMwMAogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAxOTE2LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAwLjAwMQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQThGSFMxTm1kQ3dHcUQ5RHdPaWNuSEhZK3kyN2tkV2Z4S2EwWUhTR0RmdjBDU3BES1JIVFFkUW1aVlBEVWRhRldVc3hkZ1Z4bHdBZDZvK2RoSnlrUEEwQUFBQ1dleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMlJ2ZFdKc1pXTnNhV05yTG01bGREbzBORE1pTENKbVpXRjBkWEpsSWpvaVEyOXVkbVZ5YzJsdmJrMWxZWE4xY21WdFpXNTBJaXdpWlhod2FYSjVJam94TmpRek1UVTFNVGs1TENKcGMxTjFZbVJ2YldGcGJpSTZkSEoxWlN3aWFYTlVhR2x5WkZCaGNuUjVJanAwY25WbExDSjFjMkZuWlNJNkluTjFZbk5sZENKOScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQTh6ZFhpNmRyMWh3WEVValFyWWl5WVFHbFUzNTU3eTVRV0RuTjBMd2dqOWVQdDY2WE1Fdk5rVldPRU9XUGQ3VFA5c0JRMjVYMFExNUxyMU5uNG9HRlFrQUFBQ2NleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMmR2YjJkc1pYTjVibVJwWTJGMGFXOXVMbU52YlRvME5ETWlMQ0ptWldGMGRYSmxJam9pUTI5dWRtVnljMmx2YmsxbFlYTjFjbVZ0Wlc1MElpd2laWGh3YVhKNUlqb3hOalF6TVRVMU1UazVMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsTENKMWMyRm5aU0k2SW5OMVluTmxkQ0o5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBNC9IdGVybjJ1ZE45dzN5Sks5UWdXUXhRRnJ1eE9Yc1hMN2NXNjBEeUNsMEVaRkdDU21lL0ozM1EvV3pGN2JCa1Z2aEVXRGxjQmlVeVphaW01Q3BGUXdBQUFDY2V5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwyZHZiMmRzWlhSaFozTmxjblpwWTJWekxtTnZiVG8wTkRNaUxDSm1aV0YwZFhKbElqb2lRMjl1ZG1WeWMybHZiazFsWVhOMWNtVnRaVzUwSWl3aVpYaHdhWEo1SWpveE5qUXpNVFUxTVRrNUxDSnBjMU4xWW1SdmJXRnBiaUk2ZEhKMVpTd2lhWE5VYUdseVpGQmhjblI1SWpwMGNuVmxMQ0oxYzJGblpTSTZJbk4xWW5ObGRDSjknCiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMTkzNAogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAxOTAzLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgMTk1MywKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDE5MzgsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAxOTQ4LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQXh1aktHOUlOanNaOC9nVXE4K2RUcnVOdms3UmpaUTFvRmhoZ1FiY1RKS0RuWmZielNURTgxd3ZDMkh6YWYzVFc0YXZBNzZMVFpFTWRpZWRGMXZJYkE0QUFBQnVleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMmx0WVhOa2F5NW5iMjluYkdWaGNHbHpMbU52YlRvME5ETWlMQ0ptWldGMGRYSmxJam9pVkhKMWMzUlViMnRsYm5NaUxDSmxlSEJwY25raU9qRTJOVEkzTnpRME1EQXNJbWx6VkdocGNtUlFZWEowZVNJNmRISjFaWDA9JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBenVjZTg1T1J0U25XZTFNWkRUdjY4cXBhVzNpSHlmTDlZYkxSeTBjd2NDWndWbmVQbk9ta1VKbEc4SEdpa21Pd2haVTIyZEVsQ2NmcmZYMkhockJQQWtBQUFCN2V5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwyUnZkV0pzWldOc2FXTnJMbTVsZERvME5ETWlMQ0ptWldGMGRYSmxJam9pVkhKMWMzUlViMnRsYm5NaUxDSmxlSEJwY25raU9qRTJOVEkzTnpRME1EQXNJbWx6VTNWaVpHOXRZV2x1SWpwMGNuVmxMQ0pwYzFSb2FYSmtVR0Z5ZEhraU9uUnlkV1Y5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBMTZudmNkZW9PQXFySmNtakxScGwxSTZmM01jREQ4RWZvZkFZVHQvUC9INC9BV3dCOTlueGlQcDZrQTBmWG9pWmF2OTA4WjhldHVMMTZsYUZQVWRmUXNBQUFDQmV5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwyZHZiMmRzWlhSaFozTmxjblpwWTJWekxtTnZiVG8wTkRNaUxDSm1aV0YwZFhKbElqb2lWSEoxYzNSVWIydGxibk1pTENKbGVIQnBjbmtpT2pFMk5USTNOelEwTURBc0ltbHpVM1ZpWkc5dFlXbHVJanAwY25WbExDSnBjMVJvYVhKa1VHRnlkSGtpT25SeWRXVjknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0F4QkhkcjBKNDR2RkJRdFpVcVg5c2ppcWY1eVdaL09jSFJjUk1OM0g5VEgrdDkwVi9qM0VOVzZDOCtpZ0JaRlhNSjdHM1ByOERkMTM2MzJhTG5nNDJ3Z0FBQUNCZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJkdmIyZHNaWE41Ym1ScFkyRjBhVzl1TG1OdmJUbzBORE1pTENKbVpXRjBkWEpsSWpvaVZISjFjM1JVYjJ0bGJuTWlMQ0psZUhCcGNua2lPakUyTlRJM056UTBNREFzSW1selUzVmlaRzl0WVdsdUlqcDBjblZsTENKcGMxUm9hWEprVUdGeWRIa2lPblJ5ZFdWOScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQTg4QldIRmpjYXdVZktVM2xJZWpMb3J5WG95am9vQlhMZ1dtR2graE5jcU1LNDRjdWd2c0k1WVpiTmFyWXZpM3JvYzFmWWJIQTFBVmJoQXR1SFpmbGdFQUFBQjJleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMmR2YjJkc1pTNWpiMjA2TkRReklpd2labVZoZEhWeVpTSTZJbFJ5ZFhOMFZHOXJaVzV6SWl3aVpYaHdhWEo1SWpveE5qVXlOemMwTkRBd0xDSnBjMU4xWW1SdmJXRnBiaUk2ZEhKMVpTd2lhWE5VYUdseVpGQmhjblI1SWpwMGNuVmxmUT09JwogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDE5MzIKICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAzOTc5MDc1NTIsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDUwMAogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgNDAxMjQzNzI0LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgXSwKICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDIwLAogICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjI5MzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjI5MzEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzgwMDI1OTQxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMgogICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAxMywKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs0NDc1Njg5NF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDc1Njg5NSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOTQ3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNDQ3NTY4OTZdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs0NDc1Njg5N10KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzQ0NzU2NDMxXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0NzU2NDMyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5NjAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MjU1NCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDaHJvbWUvKDlbMjM0NTY3ODldfFxcZHszLH0pJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3IudXNlckFnZW50J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjI1NTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzk1ODQyMTM5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0Nocm9tZS8oOVsyMzQ1Njc4OV18XFxkezMsfSknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbMjEwNjc0OTZdXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZG9jdW1lbnQuaGFzVHJ1c3RUb2tlbiddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MDQ3NSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ3dpbmRvdy5QZXJpb2RpY1N5bmNNYW5hZ2VyJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQW5kcm9pZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MTY5Ml0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MTY5MywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDc3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNzgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4NSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNzYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnMzEwNjE2OTEnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2Mjg5MF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2Mjg5MSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOTc4NDE4MjgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWzMxMDYyOTQ2XV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydkb2N1bWVudC5wcmVyZW5kZXJpbmcnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgW1szMTA2Mjk0N11dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydkb2N1bWVudC5wcmVyZW5kZXJpbmcnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0NzE0NDQ5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDY3Njk4Mjk2MSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC40CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDY3Njk4Mjk5NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYzMTYyXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzMTYzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM1OTM1MTE0NSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWycxODE5MDE3NiwxNTU5NTMwNDgnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNDk5NDQ1MjknXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNTQ0MSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc2MTc3J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzY3ODInXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNjU4MSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNDAKICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzQ0NzMyNzMwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNDQ3MzI3MzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzY3Njk4Mjk2MF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzY3Njk4Mjk5NF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzY3Njk4Mjk5OF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNjc2OTgyOTc1XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNjc2OTgyOTgwXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTMzNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDc3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNzgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4NSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNzYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4NCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE4OCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMjEwNjQzNjVdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjEwNjQzNzIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ2ZsYXNoJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDg5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzIxMDY4NzY2XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxMDY4NzY3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDg4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNDIKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYwNTQ1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNjM5MzEwMjIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQTBCZzJuZGRVajROdzZGenNYdWRCWEhaczFhQXpJZ08rVUd6ZkpHa0MxZjRKNTZnaHZKNlRDaXJqZHQ4QlV3c0sxNHNCQmpXR21PWStRQ1RyMkhyQlFvQUFBQ0JleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMM05sWTNWeVpYQjFZbUZrY3k1bkxtUnZkV0pzWldOc2FXTnJMbTVsZERvME5ETWlMQ0ptWldGMGRYSmxJam9pVTNWaWNtVnpiM1Z5WTJWWFpXSkNkVzVrYkdWeklpd2laWGh3YVhKNUlqb3hOalV5T0RNeE9UazVMQ0pwYzFSb2FYSmtVR0Z5ZEhraU9uUnlkV1Y5JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ2hyb21lLyg5XFxkfFxcZHszLH0pJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyOQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYyOTIzXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYyOTI0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE0NCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYzMjU2XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjMyNTddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MzcwNl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzcwNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM1OTM0Njk1NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzNzA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzU5MzQ2OTU2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzNzA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyd0b3AuZnJhbWVzLmdvb2dsZV9hZHNfdG9wX2ZyYW1lJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzcxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNjAyNDU1OTYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ3RvcC5mcmFtZXMuZ29vZ2xlX2Fkc190b3BfZnJhbWUnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM4MzEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0xCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzgzMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2Mzg3NF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2Mzg3NSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM1NzA0NTEyOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzODc2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzU3MDQ1MTI4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2Mzg5MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ4OCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4xCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM4OTEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MDI5MDUwMzUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ4OCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4xCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MgogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MzkxNl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzkxNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQxMzcyNTA0NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MAogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjQwMjBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQwMjEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM4NTQ0MDEzNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM3ODI5MDk3MywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQwMjIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM4NTQ0MDEzNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzc4MjkwOTczLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDAyMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzg1NDQwMTM1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNzgyOTA5NzMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNDQ3NTU4NDVdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDQ3NTU4NDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzODcxNjU1MzIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2MwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICczMzcyMDQ0MTE1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMjkwMjYyMzQ5MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzE5MDA5NDg2MzgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICczOTIyMDY1Njk0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTE2MzAzODkwNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzIyOTkxMTg1OTknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICc1Mjg4NzYxNDYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxNDE3MTY1OTc2JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICA1LAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMTA2Mjc4NSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnX2dtcHRubCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjEwNjI3ODYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ19nbXB0bmwnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RvZGF5XFwubGluZVxcLm1lLy4rLyhtYWlufGFydGljbGUpJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQzCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDkwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxMDYyODEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydfZ21wdG5sJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndG9kYXlcXC5saW5lXFwubWUvLisvKG1haW58YXJ0aWNsZSknCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNDMKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMTA2MzkxNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnd2Via2l0Lm1lc3NhZ2VIYW5kbGVycy5fZ21wdG5sJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMTA2MzkxNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnd2Via2l0Lm1lc3NhZ2VIYW5kbGVycy5fZ21wdG5sJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0b2RheVxcLmxpbmVcXC5tZS8uKy8obWFpbnxhcnRpY2xlKScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NAogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA5MDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMTA2NDExMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnd2Via2l0Lm1lc3NhZ2VIYW5kbGVycy5fZ21wdG5sJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndG9kYXlcXC5saW5lXFwubWUvLisvKG1haW58YXJ0aWNsZSknCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNDQKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYwNDM3XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYwNDM4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MDQzOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMjAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI0CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MDgzN10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MDgzOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM2ODI3OTU1NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM2NjgwOTQxMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjE0ODJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjE0ODMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNjAyNDU1OTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NTM2MDI1NCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDk0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MDAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQW5kcm9pZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3IudXNlckFnZW50J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1NTAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTE3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzMDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzYwMjQ1NTk3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0OTQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwMDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBbmRyb2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU1MDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxMjMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnc2NhciddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ4OQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQwNTg4MTEwNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzYwMjQ1NTk3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0OTQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwMDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBbmRyb2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU1MDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDQ3NTM3NTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNjAyNDU1OTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ5NCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FuZHJvaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTUwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUxNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ2dtYVNkay5nZXRRdWVyeUluZm8nXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyd3ZWJraXQubWVzc2FnZUhhbmRsZXJzLmdldEdtYVF1ZXJ5SW5mby5wb3N0TWVzc2FnZSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ3dlYmtpdC5tZXNzYWdlSGFuZGxlcnMuZ2V0R21hU2lnLnBvc3RNZXNzYWdlJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYxODE0XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYxODE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzg0NzM0NjQyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MjksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzMDExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ3NjYXInXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0ODkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzYwMjQ1NTk3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0OTQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwMDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBbmRyb2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU1MDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM4NDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNjAyNDU1OTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ5NCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FuZHJvaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTUwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUxNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzQ0NzUzODEzXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ21hU2RrLmdldFF1ZXJ5SW5mbyddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ3dlYmtpdC5tZXNzYWdlSGFuZGxlcnMuZ2V0R21hUXVlcnlJbmZvLnBvc3RNZXNzYWdlJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnd2Via2l0Lm1lc3NhZ2VIYW5kbGVycy5nZXRHbWFTaWcucG9zdE1lc3NhZ2UnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MzM3N10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzM3OCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOTU4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjM4MjBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM4MjEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDEwNTczOTUyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjM4MjJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM4MjMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MDI4NDcwMTYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOTU5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYzODcwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzODcxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM4NDcwMDM2MSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2NDAyNl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDAyNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MTM5MjUzMDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDEzNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTM2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDEzNgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxMzcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDEzNwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxMzcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTM4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxMzgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTM4CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDEzOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTM5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDEzOQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxNDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDE0MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxNDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTQxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxNDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTQxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs0NDc1MjU0MF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDc1MjU0MSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOTk1NDQ1NDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs0NDc1NzEwMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDc1NzEwMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOTg3NzY4NzgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNDAKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzMjIzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0xCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyOQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzIyNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOTU0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWzMxMDYwODg4XV0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYwODg5XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjA4OTBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwNAogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjExNjVdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjExNjYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNjM2NTAyNTEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MTE2NywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM2MzY1MDI1MSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDIKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzQ0NzQyNzY3XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNDQ3NDI3NjhdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs0NDc1MjU4NV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDc1MjU4NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOTIwNjU5MDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQxCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs0NDc1MzUwNl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDc1MzUwNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOTIwNjU5MDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWycxODE5MDE3NiwxNTU5NTMwNDgnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNDk5NDQ1MjknXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNTQ0MSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc2MTc3J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzY3ODInXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNjU4MSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNDEKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNDQ3NTcwNDVdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDQ3NTcwNDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzk4Nzc2ODc4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnMTgxOTAxNzYsMTU1OTUzMDQ4J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzQ5OTQ0NTI5J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzU0NDEnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNjE3NyddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc2NzgyJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzY1ODEnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQwCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzQ0NzU3MzAwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0NzU3MzAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzk4Nzc2ODc4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOTEzODU1MDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnMTgxOTAxNzYsMTU1OTUzMDQ4J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNDk5NDQ1MjknXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc1NDQxJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNjE3NyddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzY3ODInXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc2NTgxJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNDAKICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MTgyOF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MTgyOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAzMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQW5kcm9pZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3IudXNlckFnZW50J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzYwMjQ1NTk3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0OTQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwMDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBbmRyb2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU1MDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsyMTA2NTcyNF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMTA2NTcyNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydMYXlvdXRTaGlmdCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjAwMDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FuZHJvaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0Nocm9tZS8oODl8OVxcZHxcXGR7Myx9KScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnd2luZG93LlBlcmlvZGljU3luY01hbmFnZXInXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MDAwNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOTI4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBbmRyb2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3IudXNlckFnZW50J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDaHJvbWUvKDg5fDlcXGR8XFxkezMsfSknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ3dpbmRvdy5QZXJpb2RpY1N5bmNNYW5hZ2VyJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MDAzMl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MDAzMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOTI4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjE2OTBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjE2OTEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4MywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDg0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjMyNDRdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjMyNDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzkyNzM2NDc2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjMyNDZdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjMyNDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOTI3MzY0NzYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQwNjE0OTgzNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ2hyb21lLyg5WzM0NTY3ODldfFxcZHszLH0pJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ3dpbmRvdy5QZXJpb2RpY1N5bmNNYW5hZ2VyJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjM5MTBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM5MTEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTk0OCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgW1szMTA2MzA0OV1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnY3hiYmhieG0nXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM4NzcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0xCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM4NzgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyOQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0Nocm9tZS8oOVsyMzQ1Njc4OV18XFxkezMsfSknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3IudXNlckFnZW50J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnNlcnZpY2VXb3JrZXIuY29udHJvbGxlciddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgIDAuMDAxLAogICAgICAgICAgICAgICAgMTAwMCwKICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAxMDAwCiAgICAgICAgICAgIF0KICAgICAgICBdKSk7CiAgICB9KCkpCn0="},{"name":"sugarcoat-20d16a205863d5a0eb56d0490a10be62d27324b9","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfYjQ2YjNiYjQ2NDQyZmM5MCA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja19iNDZiM2JiNDY0NDJmYzkwKTsKICAgIGNvbnN0ICRfX19tb2NrXzFjZjFlOTA3Mzg1NDZkNDAgPSB7fTsKICAgIChleHBvcnRzID0+IHsKICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgbGV0IGlzU2VhbGVkID0gZmFsc2U7CiAgICAgICAgY2xhc3MgU3RvcmFnZSB7CiAgICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICAgICAgaWYgKGlzU2VhbGVkKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSWxsZWdhbCBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBsZW5ndGgoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXModGhpcykubGVuZ3RoOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGtleShpbmRleCkgewogICAgICAgICAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKHRoaXMpOwogICAgICAgICAgICAgICAgaWYgKGluZGV4IDwgMCB8fCBpbmRleCA+PSBrZXlzLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGtleXNbaW5kZXhdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldEl0ZW0oa2V5KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHRoaXMsIGtleSkgPyB0aGlzW2tleV0gOiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldEl0ZW0oa2V5LCB2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1trZXldID0gU3RyaW5nKHZhbHVlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZW1vdmVJdGVtKGtleSkgewogICAgICAgICAgICAgICAgZGVsZXRlIHRoaXNba2V5XTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjbGVhcigpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGtleXMgPSBPYmplY3Qua2V5cyh0aGlzKTsKICAgICAgICAgICAgICAgIGZvciAoY29uc3Qga2V5IG9mIGtleXMpIHsKICAgICAgICAgICAgICAgICAgICBkZWxldGUgdGhpc1trZXldOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGV4cG9ydHMuU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogU3RvcmFnZSwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgICAgIGNvbnN0IGxvY2FsU3RvcmFnZSA9IG5ldyBTdG9yYWdlKCk7CiAgICAgICAgZXhwb3J0cy5sb2NhbFN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZ2V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIGxvY2FsU3RvcmFnZTsKICAgICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgY29uc3Qgc2Vzc2lvblN0b3JhZ2UgPSBuZXcgU3RvcmFnZSgpOwogICAgICAgIGV4cG9ydHMuc2Vzc2lvblN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZ2V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHNlc3Npb25TdG9yYWdlOwogICAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICB9KSgkX19fbW9ja18xY2YxZTkwNzM4NTQ2ZDQwKTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgIGZ1bmN0aW9uIG4ocikgewogICAgICAgICAgICAgICAgaWYgKHRbcl0pCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbcl0uZXhwb3J0czsKICAgICAgICAgICAgICAgIHZhciBvID0gdFtyXSA9IHsKICAgICAgICAgICAgICAgICAgICBpOiByLAogICAgICAgICAgICAgICAgICAgIGw6ICExLAogICAgICAgICAgICAgICAgICAgIGV4cG9ydHM6IHt9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIGVbcl0uY2FsbChvLmV4cG9ydHMsIG8sIG8uZXhwb3J0cywgbiksIG8ubCA9ICEwLCBvLmV4cG9ydHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbi5tID0gZSwgbi5jID0gdCwgbi5kID0gZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgIG4ubyhlLCB0KSB8fCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGdldDogcgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sIG4uciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIFN5bWJvbCAmJiBTeW1ib2wudG9TdHJpbmdUYWcgJiYgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIFN5bWJvbC50b1N0cmluZ1RhZywgeyB2YWx1ZTogJ01vZHVsZScgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICB9LCBuLnQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgaWYgKDEgJiB0ICYmIChlID0gbihlKSksIDggJiB0KQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgaWYgKDQgJiB0ICYmICdvYmplY3QnID09PSB0eXBlb2YgZSAmJiBlICYmIGUuX19lc01vZHVsZSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0LmNyZWF0ZShudWxsKTsKICAgICAgICAgICAgICAgIGlmIChuLnIociksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShyLCAnZGVmYXVsdCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlCiAgICAgICAgICAgICAgICAgICAgfSksIDIgJiB0ICYmICdzdHJpbmcnICE9IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgbi5kKHIsIG8sIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgfS5iaW5kKG51bGwsIG8pKTsKICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICB9LCBuLm4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgdmFyIHQgPSBlICYmIGUuX19lc01vZHVsZSA/IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5kZWZhdWx0OwogICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gbi5kKHQsICdhJywgdCksIHQ7CiAgICAgICAgICAgIH0sIG4ubyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsIHQpOwogICAgICAgICAgICB9LCBuLnAgPSAnLycsIG4obi5zID0gMTk2KTsKICAgICAgICB9KFsKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IG4oOTkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgfHwgKHRbbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCByKG4oMTExKSksIHIobigxMTIpKSwgcihuKDExMykpLCByKG4oMTE0KSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgfHwgKHRbbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCByKG4oNTQpKSwgcihuKDExNSkpLCByKG4oNTUpKSwgcihuKDU2KSksIHIobigxMTYpKSwgcihuKDExNykpLCByKG4oMzgpKSwgcihuKDU3KSksIHIobigxMTgpKSwgcihuKDExOSkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDcxKSwgbyA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tvYmplY3QgQXJyYXldJyA9PT0gby5jYWxsKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnID09PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmICdvYmplY3QnID09PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnW29iamVjdCBGdW5jdGlvbl0nID09PSBvLmNhbGwoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gZSAmJiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyAhPT0gdHlwZW9mIGUgJiYgKGUgPSBbZV0pLCBpKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDAsIHIgPSBlLmxlbmd0aDsgbiA8IHI7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmNhbGwobnVsbCwgZVtuXSwgbiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSwgbykgJiYgdC5jYWxsKG51bGwsIGVbb10sIG8sIGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgIGlzQXJyYXk6IGksCiAgICAgICAgICAgICAgICAgICAgaXNBcnJheUJ1ZmZlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0IEFycmF5QnVmZmVyXScgPT09IG8uY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzQnVmZmVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gZSAmJiAhcyhlKSAmJiBudWxsICE9PSBlLmNvbnN0cnVjdG9yICYmICFzKGUuY29uc3RydWN0b3IpICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiBlLmNvbnN0cnVjdG9yLmlzQnVmZmVyICYmIGUuY29uc3RydWN0b3IuaXNCdWZmZXIoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc0Zvcm1EYXRhOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBGb3JtRGF0YSAmJiBlIGluc3RhbmNlb2YgRm9ybURhdGE7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc0FycmF5QnVmZmVyVmlldzogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnICE9PSB0eXBlb2YgQXJyYXlCdWZmZXIgJiYgQXJyYXlCdWZmZXIuaXNWaWV3ID8gQXJyYXlCdWZmZXIuaXNWaWV3KGUpIDogZSAmJiBlLmJ1ZmZlciAmJiBlLmJ1ZmZlciBpbnN0YW5jZW9mIEFycmF5QnVmZmVyOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNTdHJpbmc6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PT0gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc051bWJlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzT2JqZWN0OiBhLAogICAgICAgICAgICAgICAgICAgIGlzVW5kZWZpbmVkOiBzLAogICAgICAgICAgICAgICAgICAgIGlzRGF0ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0IERhdGVdJyA9PT0gby5jYWxsKGUpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNGaWxlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tvYmplY3QgRmlsZV0nID09PSBvLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc0Jsb2I6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnW29iamVjdCBCbG9iXScgPT09IG8uY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzRnVuY3Rpb246IGMsCiAgICAgICAgICAgICAgICAgICAgaXNTdHJlYW06IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhKGUpICYmIGMoZS5waXBlKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzVVJMU2VhcmNoUGFyYW1zOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBVUkxTZWFyY2hQYXJhbXMgJiYgZSBpbnN0YW5jZW9mIFVSTFNlYXJjaFBhcmFtczsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzU3RhbmRhcmRCcm93c2VyRW52OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoJ3VuZGVmaW5lZCcgPT09IHR5cGVvZiBuYXZpZ2F0b3IgfHwgJ1JlYWN0TmF0aXZlJyAhPT0gbmF2aWdhdG9yLnByb2R1Y3QgJiYgJ05hdGl2ZVNjcmlwdCcgIT09IG5hdmlnYXRvci5wcm9kdWN0ICYmICdOUycgIT09IG5hdmlnYXRvci5wcm9kdWN0KSAmJiAoJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiB3aW5kb3cgJiYgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBkb2N1bWVudCk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBmb3JFYWNoOiB1LAogICAgICAgICAgICAgICAgICAgIG1lcmdlOiBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09PSB0eXBlb2YgdFtyXSAmJiAnb2JqZWN0JyA9PT0gdHlwZW9mIG4gPyB0W3JdID0gZSh0W3JdLCBuKSA6IHRbcl0gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSAwLCBvID0gYXJndW1lbnRzLmxlbmd0aDsgciA8IG87IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUoYXJndW1lbnRzW3JdLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBkZWVwTWVyZ2U6IGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4obiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT09IHR5cGVvZiB0W3JdICYmICdvYmplY3QnID09PSB0eXBlb2YgbiA/IHRbcl0gPSBlKHRbcl0sIG4pIDogdFtyXSA9ICdvYmplY3QnID09PSB0eXBlb2YgbiA/IGUoe30sIG4pIDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMCwgbyA9IGFyZ3VtZW50cy5sZW5ndGg7IHIgPCBvOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1KGFyZ3VtZW50c1tyXSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZXh0ZW5kOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdSh0LCBmdW5jdGlvbiAodCwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtvXSA9IG4gJiYgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHQgPyByKHQsIG4pIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB0cmltOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZXBsYWNlKC9eXHMqLywgJycpLnJlcGxhY2UoL1xzKiQvLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigyOSksIG8gPSBuKDEwMyksIGkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVzZXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgdGhpcy5jbXBJZCwgZGVsZXRlIHRoaXMuY21wVmVyc2lvbiwgZGVsZXRlIHRoaXMuZXZlbnRTdGF0dXMsIGRlbGV0ZSB0aGlzLmdkcHJBcHBsaWVzLCBkZWxldGUgdGhpcy50Y01vZGVsLCBkZWxldGUgdGhpcy50Y1N0cmluZywgZGVsZXRlIHRoaXMudGNmUG9saWN5VmVyc2lvbiwgdGhpcy5jbXBTdGF0dXMgPSByLkNtcFN0YXR1cy5MT0FESU5HLCB0aGlzLmRpc2FibGVkID0gITEsIHRoaXMuZGlzcGxheVN0YXR1cyA9IHIuRGlzcGxheVN0YXR1cy5ISURERU4sIHRoaXMuZXZlbnRRdWV1ZS5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmFwaVZlcnNpb24gPSAnMicsIGUuZXZlbnRRdWV1ZSA9IG5ldyBvLkV2ZW50TGlzdGVuZXJRdWV1ZSgpLCBlLmNtcFN0YXR1cyA9IHIuQ21wU3RhdHVzLkxPQURJTkcsIGUuZGlzYWJsZWQgPSAhMSwgZS5kaXNwbGF5U3RhdHVzID0gci5EaXNwbGF5U3RhdHVzLkhJRERFTiwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkNtcEFwaU1vZGVsID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgLAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzICYmIHRoaXMuX192YWx1ZXMgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiBTeW1ib2wuaXRlcmF0b3IsIG4gPSB0ICYmIGVbdF0sIHIgPSAwOwogICAgICAgICAgICAgICAgICAgIGlmIChuKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jYWxsKGUpOwogICAgICAgICAgICAgICAgICAgIGlmIChlICYmICdudW1iZXInID09IHR5cGVvZiBlLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiByID49IGUubGVuZ3RoICYmIChlID0gdm9pZCAwKSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZSAmJiBlW3IrK10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICFlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKHQgPyAnT2JqZWN0IGlzIG5vdCBpdGVyYWJsZS4nIDogJ1N5bWJvbC5pdGVyYXRvciBpcyBub3QgZGVmaW5lZC4nKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS5jbG9uZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLCB0ID0gbmV3IHRoaXMuY29uc3RydWN0b3IoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKHRoaXMpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5kZWVwQ2xvbmUoZVtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IHIgJiYgKHRbbl0gPSByKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuZGVlcENsb25lID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIG8gPSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdudW1iZXInID09PSBvIHx8ICdzdHJpbmcnID09PSBvIHx8ICdib29sZWFuJyA9PT0gbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gZSAmJiAnb2JqZWN0JyA9PT0gbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIGUuY2xvbmUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY2xvbmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIGluc3RhbmNlb2YgRGF0ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IERhdGUoZS5nZXRUaW1lKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gZVtTeW1ib2wuaXRlcmF0b3JdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBzID0gcihlKSwgYSA9IHMubmV4dCgpOyAhYS5kb25lOyBhID0gcy5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkucHVzaCh0aGlzLmRlZXBDbG9uZShjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB7IGVycm9yOiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgJiYgIWEuZG9uZSAmJiAobiA9IHMucmV0dXJuKSAmJiBuLmNhbGwocyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyB0LmVycm9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIGluc3RhbmNlb2YgQXJyYXkgPyBpIDogbmV3IGUuY29uc3RydWN0b3IoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgcCBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaGFzT3duUHJvcGVydHkocCkgJiYgKHVbcF0gPSB0aGlzLmRlZXBDbG9uZShlW3BdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkNsb25lYWJsZSA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbig1KSwgbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5lbmNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgKGUgPSBwYXJzZUludChlLCAxMCkpLCAobiA9IGUudG9TdHJpbmcoMikpLmxlbmd0aCA+IHQgfHwgZSA8IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHIuRW5jb2RpbmdFcnJvcihlICsgJyB0b28gbGFyZ2UgdG8gZW5jb2RlIGludG8gJyArIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ubGVuZ3RoIDwgdCAmJiAobiA9ICcwJy5yZXBlYXQodCAtIG4ubGVuZ3RoKSArIG4pLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRlY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAhPT0gZS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHIuRGVjb2RpbmdFcnJvcignaW52YWxpZCBiaXQgbGVuZ3RoJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VJbnQoZSwgMik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5JbnRFbmNvZGVyID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0oKSwgbyA9IHRoaXMgJiYgdGhpcy5fX2F3YWl0ZXIgfHwgZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyAobiB8fCAobiA9IFByb21pc2UpKShmdW5jdGlvbiAobywgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhyLm5leHQoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjKHIudGhyb3coZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmRvbmUgPyBvKGUudmFsdWUpIDogKHQgPSBlLnZhbHVlLCB0IGluc3RhbmNlb2YgbiA/IHQgOiBuZXcgbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS50aGVuKHMsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYygociA9IHIuYXBwbHkoZSwgdCB8fCBbXSkpLm5leHQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIGkgPSB0aGlzICYmIHRoaXMuX19nZW5lcmF0b3IgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8sIGksIHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWw6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VudDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSAmIG9bMF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBvWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeXM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wczogW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogYSgwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93OiBhKDEpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOiBhKDIpCiAgICAgICAgICAgICAgICAgICAgICAgIH0sICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAoaVtTeW1ib2wuaXRlcmF0b3JdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpOwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0dlbmVyYXRvciBpcyBhbHJlYWR5IGV4ZWN1dGluZy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHM7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9IDEsIHIgJiYgKG8gPSAyICYgaVswXSA/IHIucmV0dXJuIDogaVswXSA/IHIudGhyb3cgfHwgKChvID0gci5yZXR1cm4pICYmIG8uY2FsbChyKSwgMCkgOiByLm5leHQpICYmICEobyA9IG8uY2FsbChyLCBpWzFdKSkuZG9uZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChyID0gMCwgbyAmJiAoaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIgJiBpWzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby52YWx1ZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgaVswXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzLmxhYmVsKyssIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBpWzFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubGFiZWwrKywgciA9IGlbMV0sIGkgPSBbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IHMub3BzLnBvcCgpLCBzLnRyeXMucG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG8gPSAobyA9IHMudHJ5cykubGVuZ3RoID4gMCAmJiBvW28ubGVuZ3RoIC0gMV0pICYmICg2ID09PSBpWzBdIHx8IDIgPT09IGlbMF0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgzID09PSBpWzBdICYmICghbyB8fCBpWzFdID4gb1swXSAmJiBpWzFdIDwgb1szXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubGFiZWwgPSBpWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDYgPT09IGlbMF0gJiYgcy5sYWJlbCA8IG9bMV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubGFiZWwgPSBvWzFdLCBvID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvICYmIHMubGFiZWwgPCBvWzJdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLmxhYmVsID0gb1syXSwgcy5vcHMucHVzaChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9bMl0gJiYgcy5vcHMucG9wKCksIHMudHJ5cy5wb3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSB0LmNhbGwoZSwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHIgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbyA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg1ICYgaVswXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGlbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogaVswXSA/IGlbMV0gOiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHMgPSBuKDE1KSwgYSA9IG4oNSksIGMgPSBuKDY1KSwgdSA9IG4oNiksIHAgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5jYWxsKHRoaXMpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmlzUmVhZHlfID0gITEsIHIuaXNMYXRlc3QgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdC5iYXNlVXJsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIubGFuZ18gPSB0LkRFRkFVTFRfTEFOR1VBR0UsIHIuaXNWZW5kb3JMaXN0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucG9wdWxhdGUobiksIHIucmVhZHlQcm9taXNlID0gUHJvbWlzZS5yZXNvbHZlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBhLkdWTEVycm9yKCdtdXN0IHNwZWNpZnkgR1ZMLmJhc2VVcmwgYmVmb3JlIGxvYWRpbmcgR1ZMIGpzb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LkNBQ0hFLmhhcyhpKSA/IChyLnBvcHVsYXRlKHQuQ0FDSEUuZ2V0KGkpKSwgci5yZWFkeVByb21pc2UgPSBQcm9taXNlLnJlc29sdmUoKSkgOiAobyArPSB0LnZlcnNpb25lZEZpbGVuYW1lLnJlcGxhY2UoJ1tWRVJTSU9OXScsIGkgKyAnJyksIHIucmVhZHlQcm9taXNlID0gci5mZXRjaEpzb24obykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LkNBQ0hFLmhhcyh0LkxBVEVTVF9DQUNIRV9LRVkpID8gKHIucG9wdWxhdGUodC5DQUNIRS5nZXQodC5MQVRFU1RfQ0FDSEVfS0VZKSksIHIucmVhZHlQcm9taXNlID0gUHJvbWlzZS5yZXNvbHZlKCkpIDogKHIuaXNMYXRlc3QgPSAhMCwgci5yZWFkeVByb21pc2UgPSByLmZldGNoSnNvbihvICsgdC5sYXRlc3RGaWxlbmFtZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnYmFzZVVybCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmJhc2VVcmxfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoL15odHRwcz86XC9cL3ZlbmRvcmxpc3RcLmNvbnNlbnN1XC5vcmdcLy8udGVzdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGEuR1ZMRXJyb3IoJ0ludmFsaWQgYmFzZVVybCEgIFlvdSBtYXkgbm90IHB1bGwgZGlyZWN0bHkgZnJvbSB2ZW5kb3JsaXN0LmNvbnNlbnN1Lm9yZyBhbmQgbXVzdCBwcm92aWRlIHlvdXIgb3duIGNhY2hlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5sZW5ndGggPiAwICYmICcvJyAhPT0gZVtlLmxlbmd0aCAtIDFdICYmIChlICs9ICcvJyksIHRoaXMuYmFzZVVybF8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5lbXB0eUxhbmd1YWdlQ2FjaGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGUgJiYgdC5MQU5HVUFHRV9DQUNIRS5zaXplID4gMCA/ICh0LkxBTkdVQUdFX0NBQ0hFID0gbmV3IE1hcCgpLCBuID0gITApIDogJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgdGhpcy5jb25zZW50TGFuZ3VhZ2VzLmhhcyhlLnRvVXBwZXJDYXNlKCkpICYmICh0LkxBTkdVQUdFX0NBQ0hFLmRlbGV0ZShlLnRvVXBwZXJDYXNlKCkpLCBuID0gITApLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmVtcHR5Q2FjaGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIuaXNJbnRlZ2VyKGUpICYmIGUgPj0gMCA/ICh0LkNBQ0hFLmRlbGV0ZShlKSwgbiA9ICEwKSA6IHZvaWQgMCA9PT0gZSAmJiAodC5DQUNIRSA9IG5ldyBNYXAoKSwgbiA9ICEwKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuY2FjaGVMYW5ndWFnZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuTEFOR1VBR0VfQ0FDSEUuaGFzKHRoaXMubGFuZ18pIHx8IHQuTEFOR1VBR0VfQ0FDSEUuc2V0KHRoaXMubGFuZ18sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXJwb3NlczogdGhpcy5wdXJwb3NlcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsUHVycG9zZXM6IHRoaXMuc3BlY2lhbFB1cnBvc2VzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlYXR1cmVzOiB0aGlzLmZlYXR1cmVzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxGZWF0dXJlczogdGhpcy5zcGVjaWFsRmVhdHVyZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2tzOiB0aGlzLnN0YWNrcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmZldGNoSnNvbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyh0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKHRoaXMsIGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoci5sYWJlbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci50cnlzLnB1c2goWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIHQgPSB0aGlzLnBvcHVsYXRlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLkpzb24uZmV0Y2goZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFwcGx5KHRoaXMsIFtyLnNlbnQoKV0pLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuID0gci5zZW50KCksIG5ldyBhLkdWTEVycm9yKG4ubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbMl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRKc29uID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04ucGFyc2UoSlNPTi5zdHJpbmdpZnkoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd2bFNwZWNpZmljYXRpb25WZXJzaW9uOiB0aGlzLmd2bFNwZWNpZmljYXRpb25WZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckxpc3RWZXJzaW9uOiB0aGlzLnZlbmRvckxpc3RWZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRjZlBvbGljeVZlcnNpb246IHRoaXMudGNmUG9saWN5VmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0VXBkYXRlZDogdGhpcy5sYXN0VXBkYXRlZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXJwb3NlczogdGhpcy5wdXJwb3NlcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsUHVycG9zZXM6IHRoaXMuc3BlY2lhbFB1cnBvc2VzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlYXR1cmVzOiB0aGlzLmZlYXR1cmVzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxGZWF0dXJlczogdGhpcy5zcGVjaWFsRmVhdHVyZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2tzOiB0aGlzLnN0YWNrcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JzOiB0aGlzLmZ1bGxWZW5kb3JMaXN0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmNoYW5nZUxhbmd1YWdlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8sIHMsIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkodGhpcywgZnVuY3Rpb24gKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChpLmxhYmVsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID0gZS50b1VwcGVyQ2FzZSgpLCAhdC5jb25zZW50TGFuZ3VhZ2VzLmhhcyhuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID09PSB0aGlzLmxhbmdfKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMubGFuZ18gPSBuLCAhdC5MQU5HVUFHRV9DQUNIRS5oYXMobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG8gaW4gciA9IHQuTEFOR1VBR0VfQ0FDSEUuZ2V0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaGFzT3duUHJvcGVydHkobykgJiYgKHRoaXNbb10gPSByW29dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gdC5iYXNlVXJsICsgdC5sYW5ndWFnZUZpbGVuYW1lLnJlcGxhY2UoJ1tMQU5HXScsIGUpLCBpLmxhYmVsID0gMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkudHJ5cy5wdXNoKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZldGNoSnNvbihzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuc2VudCgpLCB0aGlzLmNhY2hlTGFuZ3VhZ2UoKSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgYyA9IGkuc2VudCgpLCBuZXcgYS5HVkxFcnJvcigndW5hYmxlIHRvIGxvYWQgbGFuZ3VhZ2U6ICcgKyBjLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGEuR1ZMRXJyb3IoJ3Vuc3VwcG9ydGVkIGxhbmd1YWdlICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2xhbmd1YWdlJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubGFuZ187CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0LnByb3RvdHlwZS5pc1ZlbmRvckxpc3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gZSAmJiB2b2lkIDAgIT09IGUudmVuZG9yczsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUucG9wdWxhdGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdXJwb3NlcyA9IGUucHVycG9zZXMsIHRoaXMuc3BlY2lhbFB1cnBvc2VzID0gZS5zcGVjaWFsUHVycG9zZXMsIHRoaXMuZmVhdHVyZXMgPSBlLmZlYXR1cmVzLCB0aGlzLnNwZWNpYWxGZWF0dXJlcyA9IGUuc3BlY2lhbEZlYXR1cmVzLCB0aGlzLnN0YWNrcyA9IGUuc3RhY2tzLCB0aGlzLmlzVmVuZG9yTGlzdChlKSAmJiAodGhpcy5ndmxTcGVjaWZpY2F0aW9uVmVyc2lvbiA9IGUuZ3ZsU3BlY2lmaWNhdGlvblZlcnNpb24sIHRoaXMudGNmUG9saWN5VmVyc2lvbiA9IGUudGNmUG9saWN5VmVyc2lvbiwgdGhpcy52ZW5kb3JMaXN0VmVyc2lvbiA9IGUudmVuZG9yTGlzdFZlcnNpb24sIHRoaXMubGFzdFVwZGF0ZWQgPSBlLmxhc3RVcGRhdGVkLCAnc3RyaW5nJyA9PSB0eXBlb2YgdGhpcy5sYXN0VXBkYXRlZCAmJiAodGhpcy5sYXN0VXBkYXRlZCA9IG5ldyBEYXRlKHRoaXMubGFzdFVwZGF0ZWQpKSwgdGhpcy52ZW5kb3JzXyA9IGUudmVuZG9ycywgdGhpcy5mdWxsVmVuZG9yTGlzdCA9IGUudmVuZG9ycywgdGhpcy5tYXBWZW5kb3JzKCksIHRoaXMuaXNSZWFkeV8gPSAhMCwgdGhpcy5pc0xhdGVzdCAmJiB0LkNBQ0hFLnNldCh0LkxBVEVTVF9DQUNIRV9LRVksIHRoaXMuZ2V0SnNvbigpKSwgdC5DQUNIRS5oYXModGhpcy52ZW5kb3JMaXN0VmVyc2lvbikgfHwgdC5DQUNIRS5zZXQodGhpcy52ZW5kb3JMaXN0VmVyc2lvbiwgdGhpcy5nZXRKc29uKCkpKSwgdGhpcy5jYWNoZUxhbmd1YWdlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLm1hcFZlbmRvcnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ieVB1cnBvc2VWZW5kb3JNYXAgPSB7fSwgdGhpcy5ieVNwZWNpYWxQdXJwb3NlVmVuZG9yTWFwID0ge30sIHRoaXMuYnlGZWF0dXJlVmVuZG9yTWFwID0ge30sIHRoaXMuYnlTcGVjaWFsRmVhdHVyZVZlbmRvck1hcCA9IHt9LCBPYmplY3Qua2V5cyh0aGlzLnB1cnBvc2VzKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVB1cnBvc2VWZW5kb3JNYXBbZV0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZ0ludDogbmV3IFNldCgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50OiBuZXcgU2V0KCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsZXhpYmxlOiBuZXcgU2V0KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5rZXlzKHRoaXMuc3BlY2lhbFB1cnBvc2VzKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVNwZWNpYWxQdXJwb3NlVmVuZG9yTWFwW2VdID0gbmV3IFNldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5rZXlzKHRoaXMuZmVhdHVyZXMpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmJ5RmVhdHVyZVZlbmRvck1hcFtlXSA9IG5ldyBTZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3Qua2V5cyh0aGlzLnNwZWNpYWxGZWF0dXJlcykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuYnlTcGVjaWFsRmVhdHVyZVZlbmRvck1hcFtlXSA9IG5ldyBTZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBBcnJheS5pc0FycmF5KGUpIHx8IChlID0gT2JqZWN0LmtleXModGhpcy5mdWxsVmVuZG9yTGlzdCkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICtlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCB0aGlzLnZlbmRvcklkcyA9IG5ldyBTZXQoZSksIHRoaXMudmVuZG9yc18gPSBlLnJlZHVjZShmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC52ZW5kb3JzX1snJyArIG5dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByICYmIHZvaWQgMCA9PT0gci5kZWxldGVkRGF0ZSAmJiAoci5wdXJwb3Nlcy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuYnlQdXJwb3NlVmVuZG9yTWFwW2UgKyAnJ10uY29uc2VudC5hZGQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIuc3BlY2lhbFB1cnBvc2VzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVNwZWNpYWxQdXJwb3NlVmVuZG9yTWFwW2UgKyAnJ10uYWRkKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLmxlZ0ludFB1cnBvc2VzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVB1cnBvc2VWZW5kb3JNYXBbZSArICcnXS5sZWdJbnQuYWRkKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLmZsZXhpYmxlUHVycG9zZXMgJiYgci5mbGV4aWJsZVB1cnBvc2VzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVB1cnBvc2VWZW5kb3JNYXBbZSArICcnXS5mbGV4aWJsZS5hZGQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIuZmVhdHVyZXMuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmJ5RmVhdHVyZVZlbmRvck1hcFtlICsgJyddLmFkZChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgci5zcGVjaWFsRmVhdHVyZXMuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmJ5U3BlY2lhbEZlYXR1cmVWZW5kb3JNYXBbZSArICcnXS5hZGQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGVbbl0gPSByKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZ2V0RmlsdGVyZWRWZW5kb3JzID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdGhpcywgaSA9IGUuY2hhckF0KDApLnRvVXBwZXJDYXNlKCkgKyBlLnNsaWNlKDEpLCBzID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKCdwdXJwb3NlJyA9PT0gZSAmJiBuID8gdGhpc1snYnknICsgaSArICdWZW5kb3JNYXAnXVt0ICsgJyddW25dIDogdGhpc1snYnknICsgKHIgPyAnU3BlY2lhbCcgOiAnJykgKyBpICsgJ1ZlbmRvck1hcCddW3QgKyAnJ10pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzW2UgKyAnJ10gPSBvLnZlbmRvcnNbZSArICcnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBzOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRWZW5kb3JzV2l0aENvbnNlbnRQdXJwb3NlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldEZpbHRlcmVkVmVuZG9ycygncHVycG9zZScsIGUsICdjb25zZW50Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFZlbmRvcnNXaXRoTGVnSW50UHVycG9zZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5nZXRGaWx0ZXJlZFZlbmRvcnMoJ3B1cnBvc2UnLCBlLCAnbGVnSW50Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFZlbmRvcnNXaXRoRmxleGlibGVQdXJwb3NlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldEZpbHRlcmVkVmVuZG9ycygncHVycG9zZScsIGUsICdmbGV4aWJsZScpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRWZW5kb3JzV2l0aFNwZWNpYWxQdXJwb3NlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldEZpbHRlcmVkVmVuZG9ycygncHVycG9zZScsIGUsIHZvaWQgMCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRWZW5kb3JzV2l0aEZlYXR1cmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RmlsdGVyZWRWZW5kb3JzKCdmZWF0dXJlJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFZlbmRvcnNXaXRoU3BlY2lhbEZlYXR1cmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RmlsdGVyZWRWZW5kb3JzKCdmZWF0dXJlJywgZSwgdm9pZCAwLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ3ZlbmRvcnMnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy52ZW5kb3JzXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQucHJvdG90eXBlLm5hcnJvd1ZlbmRvcnNUbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm1hcFZlbmRvcnMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2lzUmVhZHknLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5pc1JlYWR5XzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQucHJvdG90eXBlLmNsb25lID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZXcgdCh0aGlzLmdldEpzb24oKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5sYW5nXyAhPT0gdC5ERUZBVUxUX0xBTkdVQUdFICYmIGUuY2hhbmdlTGFuZ3VhZ2UodGhpcy5sYW5nXyksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuaXNJbnN0YW5jZU9mID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnb2JqZWN0JyA9PSB0eXBlb2YgZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBlLm5hcnJvd1ZlbmRvcnNUbzsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5MQU5HVUFHRV9DQUNIRSA9IG5ldyBNYXAoKSwgdC5DQUNIRSA9IG5ldyBNYXAoKSwgdC5MQVRFU1RfQ0FDSEVfS0VZID0gMCwgdC5ERUZBVUxUX0xBTkdVQUdFID0gJ0VOJywgdC5jb25zZW50TGFuZ3VhZ2VzID0gbmV3IHUuQ29uc2VudExhbmd1YWdlcygpLCB0LmxhdGVzdEZpbGVuYW1lID0gJ3ZlbmRvci1saXN0Lmpzb24nLCB0LnZlcnNpb25lZEZpbGVuYW1lID0gJ2FyY2hpdmVzL3ZlbmRvci1saXN0LXZbVkVSU0lPTl0uanNvbicsIHQubGFuZ3VhZ2VGaWxlbmFtZSA9ICdwdXJwb3Nlcy1bTEFOR10uanNvbicsIHQ7CiAgICAgICAgICAgICAgICAgICAgfShzLkNsb25lYWJsZSk7CiAgICAgICAgICAgICAgICB0LkdWTCA9IHA7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDM2KSwgbyA9IG4oNiksIGkgPSBuKDE2KSwgcyA9IG4oMzMpLCBhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgbywgaSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSByLlNlbWFudGljUHJlRW5jb2Rlci5wcm9jZXNzKGUsIHQpLCAobyA9IEFycmF5LmlzQXJyYXkobnVsbCA9PT0gKG4gPSB0KSB8fCB2b2lkIDAgPT09IG4gPyB2b2lkIDAgOiBuLnNlZ21lbnRzKSA/IHQuc2VnbWVudHMgOiBuZXcgci5TZWdtZW50U2VxdWVuY2UoZSwgdClbJycgKyBlLnZlcnNpb25dKS5mb3JFYWNoKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuIDwgby5sZW5ndGggLSAxICYmIChzID0gJy4nKSwgaSArPSByLlNlZ21lbnRFbmNvZGVyLmVuY29kZShlLCB0KSArIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5kZWNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLnNwbGl0KCcuJyksIGEgPSBuLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgfHwgKHQgPSBuZXcgcy5UQ01vZGVsKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IDA7IGMgPCBhOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IG5bY10sIHAgPSByLkJhc2U2NFVybC5kZWNvZGUodS5jaGFyQXQoMCkpLnN1YnN0cigwLCByLkJpdExlbmd0aC5zZWdtZW50VHlwZSksIGwgPSBvLlNlZ21lbnRJRHMuSURfVE9fS0VZW2kuSW50RW5jb2Rlci5kZWNvZGUocCwgci5CaXRMZW5ndGguc2VnbWVudFR5cGUpLnRvU3RyaW5nKCldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuU2VnbWVudEVuY29kZXIuZGVjb2RlKHUsIHQsIGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5UQ1N0cmluZyA9IGE7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZW5jb2RlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICtlICsgJyc7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5kZWNvZGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJzEnID09PSBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkJvb2xlYW5FbmNvZGVyID0gcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSB8fCAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHIobig0OSkpLCByKG4oMTA0KSksIHIobigxMDUpKSwgcihuKDI4KSksIHIobig1MCkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTMpOwogICAgICAgICAgICAgICAgdC5SZXNwb25zZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmNtcElkID0gci5DbXBBcGlNb2RlbC5jbXBJZCwgdGhpcy5jbXBWZXJzaW9uID0gci5DbXBBcGlNb2RlbC5jbXBWZXJzaW9uLCB0aGlzLmdkcHJBcHBsaWVzID0gci5DbXBBcGlNb2RlbC5nZHByQXBwbGllcywgdGhpcy50Y2ZQb2xpY3lWZXJzaW9uID0gci5DbXBBcGlNb2RlbC50Y2ZQb2xpY3lWZXJzaW9uOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSB8fCAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHIobigxMDApKSwgcihuKDEwMSkpLCByKG4oMTAyKSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBuKDMxKSwgaSA9IG4oMjcpLCBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5yZXNwb25kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy50aHJvd0lmUGFyYW1JbnZhbGlkKCksIHRoaXMuaW52b2tlQ2FsbGJhY2sobmV3IGkuVENEYXRhKHRoaXMucGFyYW0sIHRoaXMubGlzdGVuZXJJZCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS50aHJvd0lmUGFyYW1JbnZhbGlkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodm9pZCAwID09PSB0aGlzLnBhcmFtIHx8IEFycmF5LmlzQXJyYXkodGhpcy5wYXJhbSkgJiYgdGhpcy5wYXJhbS5ldmVyeShOdW1iZXIuaXNJbnRlZ2VyKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdJbnZhbGlkIFBhcmFtZXRlcicpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgIH0oby5Db21tYW5kKTsKICAgICAgICAgICAgICAgIHQuR2V0VENEYXRhQ29tbWFuZCA9IHM7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN1Y2Nlc3MgPSAhMCwgT2JqZWN0LmFzc2lnbih0aGlzLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpc3RlbmVySWQ6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IHIKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJlc3BvbmQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pbnZva2VDYWxsYmFjayhudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuaW52b2tlQ2FsbGJhY2sgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG51bGwgIT09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT0gdHlwZW9mIHRoaXMubmV4dCA/IHRoaXMuY2FsbGJhY2sodGhpcy5uZXh0LCBlLCB0KSA6IHRoaXMuY2FsbGJhY2soZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuQ29tbWFuZCA9IHI7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMTUpLCBpID0gbig1KSwgcyA9IG4oMTkpLCBhID0gbig2KSwgYyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmNhbGwodGhpcykgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmlzU2VydmljZVNwZWNpZmljXyA9ICExLCBuLnN1cHBvcnRPT0JfID0gITAsIG4udXNlTm9uU3RhbmRhcmRTdGFja3NfID0gITEsIG4ucHVycG9zZU9uZVRyZWF0bWVudF8gPSAhMSwgbi5wdWJsaXNoZXJDb3VudHJ5Q29kZV8gPSAnQUEnLCBuLnZlcnNpb25fID0gMiwgbi5jb25zZW50U2NyZWVuXyA9IDAsIG4ucG9saWN5VmVyc2lvbl8gPSAyLCBuLmNvbnNlbnRMYW5ndWFnZV8gPSAnRU4nLCBuLmNtcElkXyA9IDAsIG4uY21wVmVyc2lvbl8gPSAwLCBuLnZlbmRvckxpc3RWZXJzaW9uXyA9IDAsIG4ubnVtQ3VzdG9tUHVycG9zZXNfID0gMCwgbi5zcGVjaWFsRmVhdHVyZU9wdGlucyA9IG5ldyBhLlZlY3RvcigpLCBuLnB1cnBvc2VDb25zZW50cyA9IG5ldyBhLlZlY3RvcigpLCBuLnB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzID0gbmV3IGEuVmVjdG9yKCksIG4ucHVibGlzaGVyQ29uc2VudHMgPSBuZXcgYS5WZWN0b3IoKSwgbi5wdWJsaXNoZXJMZWdpdGltYXRlSW50ZXJlc3RzID0gbmV3IGEuVmVjdG9yKCksIG4ucHVibGlzaGVyQ3VzdG9tQ29uc2VudHMgPSBuZXcgYS5WZWN0b3IoKSwgbi5wdWJsaXNoZXJDdXN0b21MZWdpdGltYXRlSW50ZXJlc3RzID0gbmV3IGEuVmVjdG9yKCksIG4udmVuZG9yQ29uc2VudHMgPSBuZXcgYS5WZWN0b3IoKSwgbi52ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzID0gbmV3IGEuVmVjdG9yKCksIG4udmVuZG9yc0Rpc2Nsb3NlZCA9IG5ldyBhLlZlY3RvcigpLCBuLnZlbmRvcnNBbGxvd2VkID0gbmV3IGEuVmVjdG9yKCksIG4ucHVibGlzaGVyUmVzdHJpY3Rpb25zID0gbmV3IGEuUHVycG9zZVJlc3RyaWN0aW9uVmVjdG9yKCksIHQgJiYgKG4uZ3ZsID0gdCksIG4uY3JlYXRlZCA9IG5ldyBEYXRlKCksIG4udXBkYXRlZCgpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdndmwnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5ndmxfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLkdWTC5pc0luc3RhbmNlT2YoZSkgfHwgKGUgPSBuZXcgcy5HVkwoZSkpLCB0aGlzLmd2bF8gPSBlLCB0aGlzLnB1Ymxpc2hlclJlc3RyaWN0aW9ucy5ndmwgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAnY21wSWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jbXBJZF87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKE51bWJlci5pc0ludGVnZXIoK2UpICYmIGUgPiAxKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuVENNb2RlbEVycm9yKCdjbXBJZCcsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY21wSWRfID0gK2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdjbXBWZXJzaW9uJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY21wVmVyc2lvbl87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKE51bWJlci5pc0ludGVnZXIoK2UpICYmIGUgPiAtMSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBpLlRDTW9kZWxFcnJvcignY21wVmVyc2lvbicsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY21wVmVyc2lvbl8gPSArZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2NvbnNlbnRTY3JlZW4nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb25zZW50U2NyZWVuXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoTnVtYmVyLmlzSW50ZWdlcigrZSkgJiYgZSA+IC0xKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuVENNb2RlbEVycm9yKCdjb25zZW50U2NyZWVuJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zZW50U2NyZWVuXyA9ICtlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAnY29uc2VudExhbmd1YWdlJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29uc2VudExhbmd1YWdlXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zZW50TGFuZ3VhZ2VfID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ3B1Ymxpc2hlckNvdW50cnlDb2RlJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucHVibGlzaGVyQ291bnRyeUNvZGVfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIS9eKFtBLXpdKXsyfSQvLnRlc3QoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBpLlRDTW9kZWxFcnJvcigncHVibGlzaGVyQ291bnRyeUNvZGUnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnB1Ymxpc2hlckNvdW50cnlDb2RlXyA9IGUudG9VcHBlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ3ZlbmRvckxpc3RWZXJzaW9uJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ3ZsID8gdGhpcy5ndmwudmVuZG9yTGlzdFZlcnNpb24gOiB0aGlzLnZlbmRvckxpc3RWZXJzaW9uXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChlID0gK2UgPj4gMCkgPCAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgaS5UQ01vZGVsRXJyb3IoJ3ZlbmRvckxpc3RWZXJzaW9uJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52ZW5kb3JMaXN0VmVyc2lvbl8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAncG9saWN5VmVyc2lvbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmd2bCA/IHRoaXMuZ3ZsLnRjZlBvbGljeVZlcnNpb24gOiB0aGlzLnBvbGljeVZlcnNpb25fOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5wb2xpY3lWZXJzaW9uXyA9IHBhcnNlSW50KGUsIDEwKSwgdGhpcy5wb2xpY3lWZXJzaW9uXyA8IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBpLlRDTW9kZWxFcnJvcigncG9saWN5VmVyc2lvbicsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAndmVyc2lvbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnZlcnNpb25fOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZlcnNpb25fID0gcGFyc2VJbnQoZSwgMTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAnaXNTZXJ2aWNlU3BlY2lmaWMnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5pc1NlcnZpY2VTcGVjaWZpY187CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaXNTZXJ2aWNlU3BlY2lmaWNfID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ3VzZU5vblN0YW5kYXJkU3RhY2tzJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudXNlTm9uU3RhbmRhcmRTdGFja3NfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnVzZU5vblN0YW5kYXJkU3RhY2tzXyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdzdXBwb3J0T09CJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3VwcG9ydE9PQl87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3VwcG9ydE9PQl8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAncHVycG9zZU9uZVRyZWF0bWVudCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnB1cnBvc2VPbmVUcmVhdG1lbnRfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnB1cnBvc2VPbmVUcmVhdG1lbnRfID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQucHJvdG90eXBlLnNldEFsbFZlbmRvckNvbnNlbnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52ZW5kb3JDb25zZW50cy5zZXQodGhpcy5ndmwudmVuZG9ycyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnVuc2V0QWxsVmVuZG9yQ29uc2VudHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZlbmRvckNvbnNlbnRzLmVtcHR5KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnNldEFsbFZlbmRvcnNEaXNjbG9zZWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZlbmRvcnNEaXNjbG9zZWQuc2V0KHRoaXMuZ3ZsLnZlbmRvcnMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS51bnNldEFsbFZlbmRvcnNEaXNjbG9zZWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZlbmRvcnNEaXNjbG9zZWQuZW1wdHkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuc2V0QWxsVmVuZG9yc0FsbG93ZWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZlbmRvcnNBbGxvd2VkLnNldCh0aGlzLmd2bC52ZW5kb3JzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUudW5zZXRBbGxWZW5kb3JzQWxsb3dlZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmVuZG9yc0FsbG93ZWQuZW1wdHkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuc2V0QWxsVmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cy5zZXQodGhpcy5ndmwudmVuZG9ycyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnVuc2V0QWxsVmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cy5lbXB0eSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5zZXRBbGxQdXJwb3NlQ29uc2VudHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnB1cnBvc2VDb25zZW50cy5zZXQodGhpcy5ndmwucHVycG9zZXMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS51bnNldEFsbFB1cnBvc2VDb25zZW50cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucHVycG9zZUNvbnNlbnRzLmVtcHR5KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnNldEFsbFB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cy5zZXQodGhpcy5ndmwucHVycG9zZXMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS51bnNldEFsbFB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cy5lbXB0eSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5zZXRBbGxTcGVjaWFsRmVhdHVyZU9wdGlucyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3BlY2lhbEZlYXR1cmVPcHRpbnMuc2V0KHRoaXMuZ3ZsLnNwZWNpYWxGZWF0dXJlcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnVuc2V0QWxsU3BlY2lhbEZlYXR1cmVPcHRpbnMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNwZWNpYWxGZWF0dXJlT3B0aW5zLmVtcHR5KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnNldEFsbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0QWxsVmVuZG9yQ29uc2VudHMoKSwgdGhpcy5zZXRBbGxQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cygpLCB0aGlzLnNldEFsbFNwZWNpYWxGZWF0dXJlT3B0aW5zKCksIHRoaXMuc2V0QWxsUHVycG9zZUNvbnNlbnRzKCksIHRoaXMuc2V0QWxsVmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cygpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS51bnNldEFsbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudW5zZXRBbGxWZW5kb3JDb25zZW50cygpLCB0aGlzLnVuc2V0QWxsUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMoKSwgdGhpcy51bnNldEFsbFNwZWNpYWxGZWF0dXJlT3B0aW5zKCksIHRoaXMudW5zZXRBbGxQdXJwb3NlQ29uc2VudHMoKSwgdGhpcy51bnNldEFsbFZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAnbnVtQ3VzdG9tUHVycG9zZXMnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMubnVtQ3VzdG9tUHVycG9zZXNfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PSB0eXBlb2YgdGhpcy5jdXN0b21QdXJwb3NlcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdC5rZXlzKHRoaXMuY3VzdG9tUHVycG9zZXMpLnNvcnQoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiArZSAtICt0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHBhcnNlSW50KHQucG9wKCksIDEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLm51bUN1c3RvbVB1cnBvc2VzXyA9IHBhcnNlSW50KGUsIDEwKSwgdGhpcy5udW1DdXN0b21QdXJwb3Nlc18gPCAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgaS5UQ01vZGVsRXJyb3IoJ251bUN1c3RvbVB1cnBvc2VzJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0LnByb3RvdHlwZS51cGRhdGVkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sYXN0VXBkYXRlZCA9IG5ldyBEYXRlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuY29uc2VudExhbmd1YWdlcyA9IHMuR1ZMLmNvbnNlbnRMYW5ndWFnZXMsIHQ7CiAgICAgICAgICAgICAgICAgICAgfShvLkNsb25lYWJsZSk7CiAgICAgICAgICAgICAgICB0LlRDTW9kZWwgPSBjOwogICAgICAgICAgICB9LAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSB8fCAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHIobig1MykpLCByKG4oMzcpKSwgcihuKDEyMCkpLCByKG4oMTI0KSksIHIobig1OCkpLCByKG4oNjQpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDYpLCBvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBvLCBpLCBzLCBhLCBjLCB1LCBwLCBsLCBkLCBmLCBoLCB2LCB5LCBnLCBtLCBiOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9IHIuRmllbGRzLmNtcElkLCBuID0gci5GaWVsZHMuY21wVmVyc2lvbiwgbyA9IHIuRmllbGRzLmNvbnNlbnRMYW5ndWFnZSwgaSA9IHIuRmllbGRzLmNvbnNlbnRTY3JlZW4sIHMgPSByLkZpZWxkcy5jcmVhdGVkLCBhID0gci5GaWVsZHMuaXNTZXJ2aWNlU3BlY2lmaWMsIGMgPSByLkZpZWxkcy5sYXN0VXBkYXRlZCwgdSA9IHIuRmllbGRzLnBvbGljeVZlcnNpb24sIHAgPSByLkZpZWxkcy5wdWJsaXNoZXJDb3VudHJ5Q29kZSwgbCA9IHIuRmllbGRzLnB1Ymxpc2hlckxlZ2l0aW1hdGVJbnRlcmVzdHMsIGQgPSByLkZpZWxkcy5wdWJsaXNoZXJDb25zZW50cywgZiA9IHIuRmllbGRzLnB1cnBvc2VDb25zZW50cywgaCA9IHIuRmllbGRzLnB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzLCB2ID0gci5GaWVsZHMucHVycG9zZU9uZVRyZWF0bWVudCwgeSA9IHIuRmllbGRzLnNwZWNpYWxGZWF0dXJlT3B0aW5zLCBnID0gci5GaWVsZHMudXNlTm9uU3RhbmRhcmRTdGFja3MsIG0gPSByLkZpZWxkcy52ZW5kb3JMaXN0VmVyc2lvbiwgYiA9IHIuRmllbGRzLnZlcnNpb24sIGVbdF0gPSAxMiwgZVtuXSA9IDEyLCBlW29dID0gMTIsIGVbaV0gPSA2LCBlW3NdID0gMzYsIGVbYV0gPSAxLCBlW2NdID0gMzYsIGVbdV0gPSA2LCBlW3BdID0gMTIsIGVbbF0gPSAyNCwgZVtkXSA9IDI0LCBlW2ZdID0gMjQsIGVbaF0gPSAyNCwgZVt2XSA9IDEsIGVbeV0gPSAxMiwgZVtnXSA9IDEsIGVbbV0gPSAxMiwgZVtiXSA9IDYsIGUuYW55Qm9vbGVhbiA9IDEsIGUuZW5jb2RpbmdUeXBlID0gMSwgZS5tYXhJZCA9IDE2LCBlLm51bUN1c3RvbVB1cnBvc2VzID0gNiwgZS5udW1FbnRyaWVzID0gMTIsIGUubnVtUmVzdHJpY3Rpb25zID0gMTIsIGUucHVycG9zZUlkID0gNiwgZS5yZXN0cmljdGlvblR5cGUgPSAyLCBlLnNlZ21lbnRUeXBlID0gMywgZS5zaW5nbGVPclJhbmdlID0gMSwgZS52ZW5kb3JJZCA9IDE2LCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuQml0TGVuZ3RoID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIChyID0gdC5SZXN0cmljdGlvblR5cGUgfHwgKHQuUmVzdHJpY3Rpb25UeXBlID0ge30pKVtyLk5PVF9BTExPV0VEID0gMF0gPSAnTk9UX0FMTE9XRUQnLCByW3IuUkVRVUlSRV9DT05TRU5UID0gMV0gPSAnUkVRVUlSRV9DT05TRU5UJywgcltyLlJFUVVJUkVfTEkgPSAyXSA9ICdSRVFVSVJFX0xJJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDIzKSwgbyA9IG4oNSksIGkgPSBuKDYpLCBzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gJycsIG8gPSAxOyBvIDw9IHQ7IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICs9IHIuQm9vbGVhbkVuY29kZXIuZW5jb2RlKGUuaGFzKG8pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRlY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5sZW5ndGggIT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IG8uRGVjb2RpbmdFcnJvcignYml0ZmllbGQgZW5jb2RpbmcgbGVuZ3RoIG1pc21hdGNoJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gbmV3IGkuVmVjdG9yKCksIHMgPSAxOyBzIDw9IHQ7IHMrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLkJvb2xlYW5FbmNvZGVyLmRlY29kZShlW3MgLSAxXSkgJiYgbi5zZXQocyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5iaXRMZW5ndGggPSBlLmxlbmd0aCwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkZpeGVkVmVjdG9yRW5jb2RlciA9IHM7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSB8fCAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgfShuKDQ4KSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCAociA9IHQuVENGQ29tbWFuZCB8fCAodC5UQ0ZDb21tYW5kID0ge30pKS5QSU5HID0gJ3BpbmcnLCByLkdFVF9UQ19EQVRBID0gJ2dldFRDRGF0YScsIHIuR0VUX0lOX0FQUF9UQ19EQVRBID0gJ2dldEluQXBwVENEYXRhJywgci5HRVRfVkVORE9SX0xJU1QgPSAnZ2V0VmVuZG9yTGlzdCcsIHIuQUREX0VWRU5UX0xJU1RFTkVSID0gJ2FkZEV2ZW50TGlzdGVuZXInLCByLlJFTU9WRV9FVkVOVF9MSVNURU5FUiA9ICdyZW1vdmVFdmVudExpc3RlbmVyJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMjgpLCBpID0gbigyOSksIHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuY21wU3RhdHVzID0gaS5DbXBTdGF0dXMuRVJST1IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIHQ7CiAgICAgICAgICAgICAgICAgICAgfShvLlJlc3BvbnNlKTsKICAgICAgICAgICAgICAgIHQuRGlzYWJsZWQgPSBzOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzICYmIHRoaXMuX19leHRlbmRzIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9fcHJvdG9fXyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pICYmIChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KCksIG8gPSB0aGlzICYmIHRoaXMuX19yZWFkIHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGVbU3ltYm9sLml0ZXJhdG9yXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBvLCBpID0gbi5jYWxsKGUpLCBzID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgKHZvaWQgMCA9PT0gdCB8fCB0LS0gPiAwKSAmJiAhKHIgPSBpLm5leHQoKSkuZG9uZTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5wdXNoKHIudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0geyBlcnJvcjogZSB9OwogICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYmICFyLmRvbmUgJiYgKG4gPSBpLnJldHVybikgJiYgbi5jYWxsKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgby5lcnJvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gczsKICAgICAgICAgICAgICAgICAgICB9LCBpID0gdGhpcyAmJiB0aGlzLl9fc3ByZWFkIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IFtdLCB0ID0gMDsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLmNvbmNhdChvKGFyZ3VtZW50c1t0XSkpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgcyA9IG4oMTMpLCBhID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuY2FsbCh0aGlzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIuZXZlbnRTdGF0dXMgPSBzLkNtcEFwaU1vZGVsLmV2ZW50U3RhdHVzLCByLmNtcFN0YXR1cyA9IHMuQ21wQXBpTW9kZWwuY21wU3RhdHVzLCByLmxpc3RlbmVySWQgPSBuLCBzLkNtcEFwaU1vZGVsLmdkcHJBcHBsaWVzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBzLkNtcEFwaU1vZGVsLnRjTW9kZWw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci50Y1N0cmluZyA9IHMuQ21wQXBpTW9kZWwudGNTdHJpbmcsIHIuaXNTZXJ2aWNlU3BlY2lmaWMgPSBvLmlzU2VydmljZVNwZWNpZmljLCByLnVzZU5vblN0YW5kYXJkU3RhY2tzID0gby51c2VOb25TdGFuZGFyZFN0YWNrcywgci5wdXJwb3NlT25lVHJlYXRtZW50ID0gby5wdXJwb3NlT25lVHJlYXRtZW50LCByLnB1Ymxpc2hlckNDID0gby5wdWJsaXNoZXJDb3VudHJ5Q29kZSwgci5vdXRPZkJhbmQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRWZW5kb3JzOiByLmNyZWF0ZVZlY3RvckZpZWxkKG8udmVuZG9yc0FsbG93ZWQsIHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNjbG9zZWRWZW5kb3JzOiByLmNyZWF0ZVZlY3RvckZpZWxkKG8udmVuZG9yc0Rpc2Nsb3NlZCwgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByLnB1cnBvc2UgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRzOiByLmNyZWF0ZVZlY3RvckZpZWxkKG8ucHVycG9zZUNvbnNlbnRzKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVnaXRpbWF0ZUludGVyZXN0czogci5jcmVhdGVWZWN0b3JGaWVsZChvLnB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIudmVuZG9yID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50czogci5jcmVhdGVWZWN0b3JGaWVsZChvLnZlbmRvckNvbnNlbnRzLCB0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVnaXRpbWF0ZUludGVyZXN0czogci5jcmVhdGVWZWN0b3JGaWVsZChvLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMsIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgci5zcGVjaWFsRmVhdHVyZU9wdGlucyA9IHIuY3JlYXRlVmVjdG9yRmllbGQoby5zcGVjaWFsRmVhdHVyZU9wdGlucyksIHIucHVibGlzaGVyID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50czogci5jcmVhdGVWZWN0b3JGaWVsZChvLnB1Ymxpc2hlckNvbnNlbnRzKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVnaXRpbWF0ZUludGVyZXN0czogci5jcmVhdGVWZWN0b3JGaWVsZChvLnB1Ymxpc2hlckxlZ2l0aW1hdGVJbnRlcmVzdHMpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21QdXJwb3NlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50czogci5jcmVhdGVWZWN0b3JGaWVsZChvLnB1Ymxpc2hlckN1c3RvbUNvbnNlbnRzKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2l0aW1hdGVJbnRlcmVzdHM6IHIuY3JlYXRlVmVjdG9yRmllbGQoby5wdWJsaXNoZXJDdXN0b21MZWdpdGltYXRlSW50ZXJlc3RzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN0cmljdGlvbnM6IHIuY3JlYXRlUmVzdHJpY3Rpb25zKG8ucHVibGlzaGVyUmVzdHJpY3Rpb25zKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdC5wcm90b3R5cGUuY3JlYXRlUmVzdHJpY3Rpb25zID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5udW1SZXN0cmljdGlvbnMgPiAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBlLmdldE1heFZlbmRvcklkKCksIHIgPSBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbi50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2V0UmVzdHJpY3Rpb25zKG4pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLnB1cnBvc2VJZC50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W25dIHx8ICh0W25dID0ge30pLCB0W25dW3JdID0gZS5yZXN0cmljdGlvblR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvID0gMTsgbyA8PSBuOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuY3JlYXRlVmVjdG9yRmllbGQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPyB0LnJlZHVjZShmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W24gKyAnJ10gPSBlLmhhcygrbiksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSkgOiBpKGUpLnJlZHVjZShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3RbMF0udG9TdHJpbmcoMTApXSA9IHRbMV0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQ7CiAgICAgICAgICAgICAgICAgICAgfShuKDI4KS5SZXNwb25zZSk7CiAgICAgICAgICAgICAgICB0LlRDRGF0YSA9IGE7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX3JlYWQgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZVtTeW1ib2wuaXRlcmF0b3JdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8sIGkgPSBuLmNhbGwoZSksIHMgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyAodm9pZCAwID09PSB0IHx8IHQtLSA+IDApICYmICEociA9IGkubmV4dCgpKS5kb25lOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnB1c2goci52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSB7IGVycm9yOiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgIXIuZG9uZSAmJiAobiA9IGkucmV0dXJuKSAmJiBuLmNhbGwoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBvLmVycm9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzOwogICAgICAgICAgICAgICAgICAgIH0sIG8gPSB0aGlzICYmIHRoaXMuX19zcHJlYWQgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gW10sIHQgPSAwOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUuY29uY2F0KHIoYXJndW1lbnRzW3RdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBpID0gbig0NyksIHMgPSBuKDEwNyksIGEgPSBuKDEzKSwgYyA9IG4oNDkpLCB1ID0gbigxMjcpOwogICAgICAgICAgICAgICAgdC5BUElfS0VZID0gJ19fdGNmYXBpJzsKICAgICAgICAgICAgICAgIHZhciBwID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gaS5UQ0ZDb21tYW5kLkFERF9FVkVOVF9MSVNURU5FUjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSAobiA9IGUpIHx8IHZvaWQgMCA9PT0gbiA/IHZvaWQgMCA6IG5bc10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdCdWlsdC1JbiBDdXN0b20gQ29tbW1hbmQgZm9yICcgKyBzICsgJyBub3QgYWxsb3dlZDogVXNlICcgKyBpLlRDRkNvbW1hbmQuR0VUX1RDX0RBVEEgKyAnIGluc3RlYWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzID0gaS5UQ0ZDb21tYW5kLlJFTU9WRV9FVkVOVF9MSVNURU5FUiwgbnVsbCA9PT0gKHIgPSBlKSB8fCB2b2lkIDAgPT09IHIgPyB2b2lkIDAgOiByW3NdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQnVpbHQtSW4gQ3VzdG9tIENvbW1tYW5kIGZvciAnICsgcyArICcgbm90IGFsbG93ZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChudWxsID09PSAobyA9IGUpIHx8IHZvaWQgMCA9PT0gbyA/IHZvaWQgMCA6IG9baS5UQ0ZDb21tYW5kLkdFVF9UQ19EQVRBXSkgJiYgKGVbaS5UQ0ZDb21tYW5kLkFERF9FVkVOVF9MSVNURU5FUl0gPSBlW2kuVENGQ29tbWFuZC5HRVRfVENfREFUQV0sIGVbaS5UQ0ZDb21tYW5kLlJFTU9WRV9FVkVOVF9MSVNURU5FUl0gPSBlW2kuVENGQ29tbWFuZC5HRVRfVENfREFUQV0pLCB0aGlzLmN1c3RvbUNvbW1hbmRzID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jYWxsUXVldWUgPSB3aW5kb3dbdC5BUElfS0VZXSgpIHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNhbGxRdWV1ZSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93W3QuQVBJX0tFWV0gPSB0aGlzLmFwaUNhbGwuYmluZCh0aGlzKSwgdGhpcy5wdXJnZVF1ZXVlZENhbGxzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJvdG90eXBlLmFwaUNhbGwgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByLCBwID0gW10sIGwgPSAzOyBsIDwgYXJndW1lbnRzLmxlbmd0aDsgbCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcFtsIC0gM10gPSBhcmd1bWVudHNbbF07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4obnVsbCwgITEpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICh1LlN1cHBvcnRlZFZlcnNpb25zLmhhcyh0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT0gdHlwZW9mIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdpbnZhbGlkIGNhbGxiYWNrIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLkNtcEFwaU1vZGVsLmRpc2FibGVkID8gbihuZXcgYy5EaXNhYmxlZCgpLCAhMSkgOiB0aGlzLmlzQ3VzdG9tQ29tbWFuZChlKSB8fCB0aGlzLmlzQnVpbHRJbkNvbW1hbmQoZSkgPyB0aGlzLmlzQ3VzdG9tQ29tbWFuZChlKSAmJiAhdGhpcy5pc0J1aWx0SW5Db21tYW5kKGUpID8gKHIgPSB0aGlzLmN1c3RvbUNvbW1hbmRzKVtlXS5hcHBseShyLCBvKFtuXSwgcCkpIDogZSA9PT0gaS5UQ0ZDb21tYW5kLlBJTkcgPyB0aGlzLmlzQ3VzdG9tQ29tbWFuZChlKSA/IG5ldyBzLkNvbW1hbmRNYXBbZV0odGhpcy5jdXN0b21Db21tYW5kc1tlXSwgcFswXSwgbnVsbCwgbikgOiBuZXcgcy5Db21tYW5kTWFwW2VdKG4sIHBbMF0pIDogdm9pZCAwID09PSBhLkNtcEFwaU1vZGVsLnRjTW9kZWwgPyB0aGlzLmNhbGxRdWV1ZS5wdXNoKG8oWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBwKSkgOiB0aGlzLmlzQ3VzdG9tQ29tbWFuZChlKSAmJiB0aGlzLmlzQnVpbHRJbkNvbW1hbmQoZSkgPyBuZXcgcy5Db21tYW5kTWFwW2VdKHRoaXMuY3VzdG9tQ29tbWFuZHNbZV0sIHBbMF0sIG51bGwsIG4pIDogbmV3IHMuQ29tbWFuZE1hcFtlXShuLCBwWzBdKSA6IG4obnVsbCwgITEpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4obnVsbCwgITEpOwogICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnB1cmdlUXVldWVkQ2FsbHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5jYWxsUXVldWU7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbFF1ZXVlID0gW10sIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93W3QuQVBJX0tFWV0uYXBwbHkod2luZG93LCBvKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuaXNDdXN0b21Db21tYW5kID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY3VzdG9tQ29tbWFuZHMgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdGhpcy5jdXN0b21Db21tYW5kc1tlXTsKICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5pc0J1aWx0SW5Db21tYW5kID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gcy5Db21tYW5kTWFwW2VdOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkNhbGxSZXNwb25kZXIgPSBwOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pIHx8ICh0W25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgcihuKDM2KSksIHIobig1KSksIHIobig2KSksIHIobigxNSkpLCByKG4oMTkpKSwgcihuKDY1KSksIHIobigzMykpLCByKG4oMjEpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDUpLCBvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIS9eWzAtMV0rJC8udGVzdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgci5FbmNvZGluZ0Vycm9yKCdJbnZhbGlkIGJpdEZpZWxkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubGVuZ3RoICUgdGhpcy5MQ007CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICs9IHQgPyAnMCcucmVwZWF0KHRoaXMuTENNIC0gdCkgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAnJywgbyA9IDA7IG8gPCBlLmxlbmd0aDsgbyArPSB0aGlzLkJBU0lTKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gKz0gdGhpcy5ESUNUW3BhcnNlSW50KGUuc3Vic3RyKG8sIHRoaXMuQkFTSVMpLCAyKV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5kZWNvZGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEvXltBLVphLXowLTlcLV9dKyQvLnRlc3QoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHIuRGVjb2RpbmdFcnJvcignSW52YWxpZGx5IGVuY29kZWQgQmFzZTY0VVJMIHN0cmluZycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9ICcnLCBuID0gMDsgbiA8IGUubGVuZ3RoOyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRoaXMuUkVWRVJTRV9ESUNULmdldChlW25dKS50b1N0cmluZygyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9ICcwJy5yZXBlYXQodGhpcy5CQVNJUyAtIG8ubGVuZ3RoKSArIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5ESUNUID0gJ0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5LV8nLCBlLlJFVkVSU0VfRElDVCA9IG5ldyBNYXAoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdIJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdJJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdKJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdLJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ00nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdOJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1AnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdRJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE4CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdXJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnWCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdaJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjYKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI3CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyOAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2snLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3EnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ4CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0OQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAneScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3onLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICczJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1NQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTYKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU3CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICc2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1OAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnNycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICc5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2MQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ18nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlLkJBU0lTID0gNiwgZS5MQ00gPSAyNCwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkJhc2U2NFVybCA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbnVsbCAhPT0gZSAmJiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucm9vdCA9IG51bGwsIHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5pc0VtcHR5ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXRoaXMucm9vdDsKICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5hZGQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWZ0OiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpZ2h0OiBudWxsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5pc0VtcHR5KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJvb3QgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSB0aGlzLnJvb3Q7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA8IHQudmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IHQubGVmdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5sZWZ0ID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0LmxlZnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoZSA+IHQudmFsdWUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSB0LnJpZ2h0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnJpZ2h0ID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0LnJpZ2h0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBbXSwgdCA9IHRoaXMucm9vdDsgdDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5sZWZ0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IHQubGVmdDsgbi5yaWdodCAmJiBuLnJpZ2h0ICE9IHQ7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbi5yaWdodDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnJpZ2h0ID09IHQgPyAobi5yaWdodCA9IG51bGwsIGUucHVzaCh0LnZhbHVlKSwgdCA9IHQucmlnaHQpIDogKG4ucmlnaHQgPSB0LCB0ID0gdC5sZWZ0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHVzaCh0LnZhbHVlKSwgdCA9IHQucmlnaHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmNvbnRhaW5zID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9ICExLCBuID0gdGhpcy5yb290OyBuOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4udmFsdWUgPT09IGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID4gbi52YWx1ZSA/IG4gPSBuLnJpZ2h0IDogZSA8IG4udmFsdWUgJiYgKG4gPSBuLmxlZnQpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLm1pbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZvaWQgMCA9PT0gZSAmJiAoZSA9IHRoaXMucm9vdCk7IGU7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5sZWZ0ID8gZSA9IGUubGVmdCA6ICh0ID0gZS52YWx1ZSwgZSA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5tYXggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2b2lkIDAgPT09IGUgJiYgKGUgPSB0aGlzLnJvb3QpOyBlOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucmlnaHQgPyBlID0gZS5yaWdodCA6ICh0ID0gZS52YWx1ZSwgZSA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5yZW1vdmUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IHQgJiYgKHQgPSB0aGlzLnJvb3QpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gbnVsbCwgciA9ICdsZWZ0JzsgdDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA8IHQudmFsdWUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHQsIHQgPSB0LmxlZnQsIHIgPSAnbGVmdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChlID4gdC52YWx1ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gdCwgdCA9IHQucmlnaHQsIHIgPSAncmlnaHQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQubGVmdCB8fCB0LnJpZ2h0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5sZWZ0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQucmlnaHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRoaXMubWluKHQucmlnaHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucmVtb3ZlKG8sIHQucmlnaHQpLCB0LnZhbHVlID0gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPyBuW3JdID0gdC5sZWZ0IDogdGhpcy5yb290ID0gdC5sZWZ0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID8gbltyXSA9IHQucmlnaHQgOiB0aGlzLnJvb3QgPSB0LnJpZ2h0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA/IG5bcl0gPSBudWxsIDogdGhpcy5yb290ID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgfShuKDE1KS5DbG9uZWFibGUpOwogICAgICAgICAgICAgICAgdC5CaW5hcnlTZWFyY2hUcmVlID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY21wSWQgPSAnY21wSWQnLCBlLmNtcFZlcnNpb24gPSAnY21wVmVyc2lvbicsIGUuY29uc2VudExhbmd1YWdlID0gJ2NvbnNlbnRMYW5ndWFnZScsIGUuY29uc2VudFNjcmVlbiA9ICdjb25zZW50U2NyZWVuJywgZS5jcmVhdGVkID0gJ2NyZWF0ZWQnLCBlLnN1cHBvcnRPT0IgPSAnc3VwcG9ydE9PQicsIGUuaXNTZXJ2aWNlU3BlY2lmaWMgPSAnaXNTZXJ2aWNlU3BlY2lmaWMnLCBlLmxhc3RVcGRhdGVkID0gJ2xhc3RVcGRhdGVkJywgZS5udW1DdXN0b21QdXJwb3NlcyA9ICdudW1DdXN0b21QdXJwb3NlcycsIGUucG9saWN5VmVyc2lvbiA9ICdwb2xpY3lWZXJzaW9uJywgZS5wdWJsaXNoZXJDb3VudHJ5Q29kZSA9ICdwdWJsaXNoZXJDb3VudHJ5Q29kZScsIGUucHVibGlzaGVyQ3VzdG9tQ29uc2VudHMgPSAncHVibGlzaGVyQ3VzdG9tQ29uc2VudHMnLCBlLnB1Ymxpc2hlckN1c3RvbUxlZ2l0aW1hdGVJbnRlcmVzdHMgPSAncHVibGlzaGVyQ3VzdG9tTGVnaXRpbWF0ZUludGVyZXN0cycsIGUucHVibGlzaGVyTGVnaXRpbWF0ZUludGVyZXN0cyA9ICdwdWJsaXNoZXJMZWdpdGltYXRlSW50ZXJlc3RzJywgZS5wdWJsaXNoZXJDb25zZW50cyA9ICdwdWJsaXNoZXJDb25zZW50cycsIGUucHVibGlzaGVyUmVzdHJpY3Rpb25zID0gJ3B1Ymxpc2hlclJlc3RyaWN0aW9ucycsIGUucHVycG9zZUNvbnNlbnRzID0gJ3B1cnBvc2VDb25zZW50cycsIGUucHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMgPSAncHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMnLCBlLnB1cnBvc2VPbmVUcmVhdG1lbnQgPSAncHVycG9zZU9uZVRyZWF0bWVudCcsIGUuc3BlY2lhbEZlYXR1cmVPcHRpbnMgPSAnc3BlY2lhbEZlYXR1cmVPcHRpbnMnLCBlLnVzZU5vblN0YW5kYXJkU3RhY2tzID0gJ3VzZU5vblN0YW5kYXJkU3RhY2tzJywgZS52ZW5kb3JDb25zZW50cyA9ICd2ZW5kb3JDb25zZW50cycsIGUudmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cyA9ICd2ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzJywgZS52ZW5kb3JMaXN0VmVyc2lvbiA9ICd2ZW5kb3JMaXN0VmVyc2lvbicsIGUudmVuZG9yc0FsbG93ZWQgPSAndmVuZG9yc0FsbG93ZWQnLCBlLnZlbmRvcnNEaXNjbG9zZWQgPSAndmVuZG9yc0Rpc2Nsb3NlZCcsIGUudmVyc2lvbiA9ICd2ZXJzaW9uJywgZTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuRmllbGRzID0gcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMTUpLCBpID0gbig1KSwgcyA9IG4oMzgpLCBhID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuY2FsbCh0aGlzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gdCAmJiAoci5wdXJwb3NlSWQgPSB0KSwgdm9pZCAwICE9PSBuICYmIChyLnJlc3RyaWN0aW9uVHlwZSA9IG4pLCByOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnVuSGFzaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuc3BsaXQodGhpcy5oYXNoU2VwYXJhdG9yKSwgciA9IG5ldyB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMiAhPT0gbi5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuVENNb2RlbEVycm9yKCdoYXNoJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5wdXJwb3NlSWQgPSBwYXJzZUludChuWzBdLCAxMCksIHIucmVzdHJpY3Rpb25UeXBlID0gcGFyc2VJbnQoblsxXSwgMTApLCByOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdoYXNoJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLmlzVmFsaWQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdjYW5ub3QgaGFzaCBpbnZhbGlkIFB1cnBvc2VSZXN0cmljdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJyArIHRoaXMucHVycG9zZUlkICsgdC5oYXNoU2VwYXJhdG9yICsgdGhpcy5yZXN0cmljdGlvblR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdwdXJwb3NlSWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wdXJwb3NlSWRfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnB1cnBvc2VJZF8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5wcm90b3R5cGUuaXNWYWxpZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIuaXNJbnRlZ2VyKHRoaXMucHVycG9zZUlkKSAmJiB0aGlzLnB1cnBvc2VJZCA+IDAgJiYgKHRoaXMucmVzdHJpY3Rpb25UeXBlID09PSBzLlJlc3RyaWN0aW9uVHlwZS5OT1RfQUxMT1dFRCB8fCB0aGlzLnJlc3RyaWN0aW9uVHlwZSA9PT0gcy5SZXN0cmljdGlvblR5cGUuUkVRVUlSRV9DT05TRU5UIHx8IHRoaXMucmVzdHJpY3Rpb25UeXBlID09PSBzLlJlc3RyaWN0aW9uVHlwZS5SRVFVSVJFX0xJKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuaXNTYW1lQXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucHVycG9zZUlkID09PSBlLnB1cnBvc2VJZCAmJiB0aGlzLnJlc3RyaWN0aW9uVHlwZSA9PT0gZS5yZXN0cmljdGlvblR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuaGFzaFNlcGFyYXRvciA9ICctJywgdDsKICAgICAgICAgICAgICAgICAgICB9KG8uQ2xvbmVhYmxlKTsKICAgICAgICAgICAgICAgIHQuUHVycG9zZVJlc3RyaWN0aW9uID0gYTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIChyID0gdC5TZWdtZW50IHx8ICh0LlNlZ21lbnQgPSB7fSkpLkNPUkUgPSAnY29yZScsIHIuVkVORE9SU19ESVNDTE9TRUQgPSAndmVuZG9yc0Rpc2Nsb3NlZCcsIHIuVkVORE9SU19BTExPV0VEID0gJ3ZlbmRvcnNBbGxvd2VkJywgci5QVUJMSVNIRVJfVEMgPSAncHVibGlzaGVyVEMnOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pIHx8ICh0W25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgcihuKDIzKSksIHIobig1OSkpLCByKG4oMTIxKSksIHIobigzOSkpLCByKG4oMTYpKSwgcihuKDYwKSksIHIobig2MSkpLCByKG4oNjMpKSwgcihuKDYyKSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIG8gPSBuKDUpLCBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5JbnRFbmNvZGVyLmVuY29kZShNYXRoLnJvdW5kKGUuZ2V0VGltZSgpIC8gMTAwKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZGVjb2RlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICE9PSBlLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgby5EZWNvZGluZ0Vycm9yKCdpbnZhbGlkIGJpdCBsZW5ndGgnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IERhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnNldFRpbWUoMTAwICogci5JbnRFbmNvZGVyLmRlY29kZShlLCB0KSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5EYXRlRW5jb2RlciA9IGk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIG8gPSBuKDUpLCBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IChlID0gZS50b1VwcGVyQ2FzZSgpKS5jaGFyQ29kZUF0KDApIC0gNjUsIGkgPSBlLmNoYXJDb2RlQXQoMSkgLSA2NTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuIDwgMCB8fCBuID4gMjUgfHwgaSA8IDAgfHwgaSA+IDI1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBvLkVuY29kaW5nRXJyb3IoJ2ludmFsaWQgbGFuZ3VhZ2UgY29kZTogJyArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgJSAyID09IDEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IG8uRW5jb2RpbmdFcnJvcignbnVtQml0cyBtdXN0IGJlIGV2ZW4sICcgKyB0ICsgJyBpcyBub3QgdmFsaWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0IC89IDIsIHIuSW50RW5jb2Rlci5lbmNvZGUobiwgdCkgKyByLkludEVuY29kZXIuZW5jb2RlKGksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRlY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAhPT0gZS5sZW5ndGggfHwgZS5sZW5ndGggJSAyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBvLkRlY29kaW5nRXJyb3IoJ2ludmFsaWQgYml0IGxlbmd0aCBmb3IgbGFuZ3VhZ2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5sZW5ndGggLyAyLCBpID0gci5JbnRFbmNvZGVyLmRlY29kZShlLnNsaWNlKDAsIG4pLCBuKSArIDY1LCBzID0gci5JbnRFbmNvZGVyLmRlY29kZShlLnNsaWNlKG4pLCBuKSArIDY1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFN0cmluZy5mcm9tQ2hhckNvZGUoaSkgKyBTdHJpbmcuZnJvbUNoYXJDb2RlKHMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuTGFuZ0VuY29kZXIgPSBpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzcpLCBvID0gbigyMyksIGkgPSBuKDUpLCBzID0gbigxNiksIGEgPSBuKDYpLCBjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHMuSW50RW5jb2Rlci5lbmNvZGUoZS5udW1SZXN0cmljdGlvbnMsIHIuQml0TGVuZ3RoLm51bVJlc3RyaWN0aW9ucyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5pc0VtcHR5KCkgfHwgZS5nZXRSZXN0cmljdGlvbnMoKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSBzLkludEVuY29kZXIuZW5jb2RlKG4ucHVycG9zZUlkLCByLkJpdExlbmd0aC5wdXJwb3NlSWQpLCB0ICs9IHMuSW50RW5jb2Rlci5lbmNvZGUobi5yZXN0cmljdGlvblR5cGUsIHIuQml0TGVuZ3RoLnJlc3RyaWN0aW9uVHlwZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IGUuZ2V0VmVuZG9ycyhuKSwgYSA9IGkubGVuZ3RoLCBjID0gMCwgdSA9IDAsIHAgPSAnJywgbCA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPT09IHUgJiYgKGMrKywgdSA9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gaVthIC0gMV0sIGQgPSBlLmd2bC52ZW5kb3JJZHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPT09IGEgLSAxIHx8IGlbdCArIDFdID4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyArK2UgPD0gbCAmJiAhZC5oYXMoZSk7KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gIShuID09PSB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcCArPSBvLkJvb2xlYW5FbmNvZGVyLmVuY29kZShmKSwgcCArPSBzLkludEVuY29kZXIuZW5jb2RlKHUsIHIuQml0TGVuZ3RoLnZlbmRvcklkKSwgZiAmJiAocCArPSBzLkludEVuY29kZXIuZW5jb2RlKG4sIHIuQml0TGVuZ3RoLnZlbmRvcklkKSksIHUgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGQgPSAwOyBkIDwgYTsgZCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsKGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gcy5JbnRFbmNvZGVyLmVuY29kZShjLCByLkJpdExlbmd0aC5udW1FbnRyaWVzKSwgdCArPSBwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZGVjb2RlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gMCwgbiA9IG5ldyBhLlB1cnBvc2VSZXN0cmljdGlvblZlY3RvcigpLCBjID0gcy5JbnRFbmNvZGVyLmRlY29kZShlLnN1YnN0cih0LCByLkJpdExlbmd0aC5udW1SZXN0cmljdGlvbnMpLCByLkJpdExlbmd0aC5udW1SZXN0cmljdGlvbnMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSByLkJpdExlbmd0aC5udW1SZXN0cmljdGlvbnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB1ID0gMDsgdSA8IGM7IHUrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gcy5JbnRFbmNvZGVyLmRlY29kZShlLnN1YnN0cih0LCByLkJpdExlbmd0aC5wdXJwb3NlSWQpLCByLkJpdExlbmd0aC5wdXJwb3NlSWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gci5CaXRMZW5ndGgucHVycG9zZUlkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gcy5JbnRFbmNvZGVyLmRlY29kZShlLnN1YnN0cih0LCByLkJpdExlbmd0aC5yZXN0cmljdGlvblR5cGUpLCByLkJpdExlbmd0aC5yZXN0cmljdGlvblR5cGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gci5CaXRMZW5ndGgucmVzdHJpY3Rpb25UeXBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gbmV3IGEuUHVycG9zZVJlc3RyaWN0aW9uKHAsIGwpLCBmID0gcy5JbnRFbmNvZGVyLmRlY29kZShlLnN1YnN0cih0LCByLkJpdExlbmd0aC5udW1FbnRyaWVzKSwgci5CaXRMZW5ndGgubnVtRW50cmllcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSByLkJpdExlbmd0aC5udW1FbnRyaWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGggPSAwOyBoIDwgZjsgaCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB2ID0gby5Cb29sZWFuRW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGguYW55Qm9vbGVhbikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9IHIuQml0TGVuZ3RoLmFueUJvb2xlYW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB5ID0gcy5JbnRFbmNvZGVyLmRlY29kZShlLnN1YnN0cih0LCByLkJpdExlbmd0aC52ZW5kb3JJZCksIHIuQml0TGVuZ3RoLnZlbmRvcklkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgKz0gci5CaXRMZW5ndGgudmVuZG9ySWQsIHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gcy5JbnRFbmNvZGVyLmRlY29kZShlLnN1YnN0cih0LCByLkJpdExlbmd0aC52ZW5kb3JJZCksIHIuQml0TGVuZ3RoLnZlbmRvcklkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICs9IHIuQml0TGVuZ3RoLnZlbmRvcklkLCBnIDwgeSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgaS5EZWNvZGluZ0Vycm9yKCdJbnZhbGlkIFJhbmdlRW50cnk6IGVuZFZlbmRvcklkICcgKyBnICsgJyBpcyBsZXNzIHRoYW4gJyArIHkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbSA9IHk7IG0gPD0gZzsgbSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uYWRkKG0sIGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uYWRkKHksIGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmJpdExlbmd0aCA9IHQsIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5QdXJwb3NlUmVzdHJpY3Rpb25WZWN0b3JFbmNvZGVyID0gYzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDYpLCBvID0gbigzNiksIGkgPSBuKDE2KSwgcyA9IG4oMjMpLCBhID0gbigzOSksIGMgPSBuKDYzKSwgdSA9IG4oNSksIHAgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZW5jb2RlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gW10sIHIgPSBbXSwgYSA9IGkuSW50RW5jb2Rlci5lbmNvZGUoZS5tYXhJZCwgby5CaXRMZW5ndGgubWF4SWQpLCB1ID0gJycsIHAgPSBvLkJpdExlbmd0aC5tYXhJZCArIG8uQml0TGVuZ3RoLmVuY29kaW5nVHlwZSwgbCA9IHAgKyBlLm1heElkLCBkID0gMiAqIG8uQml0TGVuZ3RoLnZlbmRvcklkICsgby5CaXRMZW5ndGguc2luZ2xlT3JSYW5nZSArIG8uQml0TGVuZ3RoLm51bUVudHJpZXMsIGYgPSBwICsgby5CaXRMZW5ndGgubnVtRW50cmllczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZvckVhY2goZnVuY3Rpb24gKGksIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ICs9IHMuQm9vbGVhbkVuY29kZXIuZW5jb2RlKGkpLCAodCA9IGUubWF4SWQgPiBkICYmIGYgPCBsKSAmJiBpICYmIChlLmhhcyhhICsgMSkgPyAwID09PSByLmxlbmd0aCAmJiAoci5wdXNoKGEpLCBmICs9IG8uQml0TGVuZ3RoLnNpbmdsZU9yUmFuZ2UsIGYgKz0gby5CaXRMZW5ndGgudmVuZG9ySWQpIDogKHIucHVzaChhKSwgZiArPSBvLkJpdExlbmd0aC52ZW5kb3JJZCwgbi5wdXNoKHIpLCByID0gW10pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0ID8gKGEgKz0gYy5WZWN0b3JFbmNvZGluZ1R5cGUuUkFOR0UgKyAnJywgYSArPSB0aGlzLmJ1aWxkUmFuZ2VFbmNvZGluZyhuKSkgOiAoYSArPSBjLlZlY3RvckVuY29kaW5nVHlwZS5GSUVMRCArICcnLCBhICs9IHUpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRlY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgcCA9IDAsIGwgPSBpLkludEVuY29kZXIuZGVjb2RlKGUuc3Vic3RyKHAsIG8uQml0TGVuZ3RoLm1heElkKSwgby5CaXRMZW5ndGgubWF4SWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcCArPSBvLkJpdExlbmd0aC5tYXhJZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gaS5JbnRFbmNvZGVyLmRlY29kZShlLmNoYXJBdChwKSwgby5CaXRMZW5ndGguZW5jb2RpbmdUeXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwICs9IG8uQml0TGVuZ3RoLmVuY29kaW5nVHlwZSwgZCA9PT0gYy5WZWN0b3JFbmNvZGluZ1R5cGUuUkFOR0UpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9IG5ldyByLlZlY3RvcigpLCAxID09PSB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnMScgPT09IGUuc3Vic3RyKHAsIDEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHUuRGVjb2RpbmdFcnJvcignVW5hYmxlIHRvIGRlY29kZSBkZWZhdWx0IGNvbnNlbnQ9MScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gaS5JbnRFbmNvZGVyLmRlY29kZShlLnN1YnN0cihwLCBvLkJpdExlbmd0aC5udW1FbnRyaWVzKSwgby5CaXRMZW5ndGgubnVtRW50cmllcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcCArPSBvLkJpdExlbmd0aC5udW1FbnRyaWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGggPSAwOyBoIDwgZjsgaCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB2ID0gcy5Cb29sZWFuRW5jb2Rlci5kZWNvZGUoZS5jaGFyQXQocCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwICs9IG8uQml0TGVuZ3RoLnNpbmdsZU9yUmFuZ2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB5ID0gaS5JbnRFbmNvZGVyLmRlY29kZShlLnN1YnN0cihwLCBvLkJpdExlbmd0aC52ZW5kb3JJZCksIG8uQml0TGVuZ3RoLnZlbmRvcklkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHAgKz0gby5CaXRMZW5ndGgudmVuZG9ySWQsIHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gaS5JbnRFbmNvZGVyLmRlY29kZShlLnN1YnN0cihwLCBvLkJpdExlbmd0aC52ZW5kb3JJZCksIG8uQml0TGVuZ3RoLnZlbmRvcklkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAgKz0gby5CaXRMZW5ndGgudmVuZG9ySWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBtID0geTsgbSA8PSBnOyBtKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5zZXQobSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5zZXQoeSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGUuc3Vic3RyKHAsIGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAgKz0gbCwgbiA9IGEuRml4ZWRWZWN0b3JFbmNvZGVyLmRlY29kZShiLCBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmJpdExlbmd0aCA9IHAsIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuYnVpbGRSYW5nZUVuY29kaW5nID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5sZW5ndGgsIG4gPSBpLkludEVuY29kZXIuZW5jb2RlKHQsIG8uQml0TGVuZ3RoLm51bUVudHJpZXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gMSA9PT0gZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiArPSBzLkJvb2xlYW5FbmNvZGVyLmVuY29kZSghdCksIG4gKz0gaS5JbnRFbmNvZGVyLmVuY29kZShlWzBdLCBvLkJpdExlbmd0aC52ZW5kb3JJZCksIHQgfHwgKG4gKz0gaS5JbnRFbmNvZGVyLmVuY29kZShlWzFdLCBvLkJpdExlbmd0aC52ZW5kb3JJZCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5WZW5kb3JWZWN0b3JFbmNvZGVyID0gcDsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIChyID0gdC5WZWN0b3JFbmNvZGluZ1R5cGUgfHwgKHQuVmVjdG9yRW5jb2RpbmdUeXBlID0ge30pKVtyLkZJRUxEID0gMF0gPSAnRklFTEQnLCByW3IuUkFOR0UgPSAxXSA9ICdSQU5HRSc7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgfHwgKHRbbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCByKG4oMTIyKSksIHIobigxMjMpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJzQ2FsbCA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiAobywgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMud2l0aENyZWRlbnRpYWxzID0gbiwgcy5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzLnJlYWR5U3RhdGUgPT0gWE1MSHR0cFJlcXVlc3QuRE9ORSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMuc3RhdHVzID49IDIwMCAmJiBzLnN0YXR1cyA8IDMwMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBzLnJlc3BvbnNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBKU09OLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkobmV3IEVycm9yKCdIVFRQIFN0YXR1czogJyArIHMuc3RhdHVzICsgJyByZXNwb25zZSB0eXBlOiAnICsgcy5yZXNwb25zZVR5cGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBzLmFkZEV2ZW50TGlzdGVuZXIoJ2Vycm9yJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkobmV3IEVycm9yKCdlcnJvcicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBzLmFkZEV2ZW50TGlzdGVuZXIoJ2Fib3J0JywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkobmV3IEVycm9yKCdhYm9ydGVkJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG51bGwgPT09IHQgPyBzLm9wZW4oJ0dFVCcsIGUsICEwKSA6IHMub3BlbignUE9TVCcsIGUsICEwKSwgcy5yZXNwb25zZVR5cGUgPSAnanNvbicsIHMudGltZW91dCA9IHIsIHMub250aW1lb3V0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkobmV3IEVycm9yKCdUaW1lb3V0ICcgKyByICsgJ21zICcgKyBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBzLnNlbmQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIGUucG9zdCA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IG4gJiYgKG4gPSAhMSksIHZvaWQgMCA9PT0gciAmJiAociA9IDApLCB0aGlzLmFic0NhbGwoZSwgSlNPTi5zdHJpbmdpZnkodCksIG4sIHIpOwogICAgICAgICAgICAgICAgICAgIH0sIGUuZmV0Y2ggPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSB0ICYmICh0ID0gITEpLCB2b2lkIDAgPT09IG4gJiYgKG4gPSAwKSwgdGhpcy5hYnNDYWxsKGUsIG51bGwsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0Lkpzb24gPSByOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gWwogICAgICAgICAgICAgICAgICAgICdlbicsCiAgICAgICAgICAgICAgICAgICAgJ2ZyJywKICAgICAgICAgICAgICAgICAgICAnZGUnLAogICAgICAgICAgICAgICAgICAgICdpdCcsCiAgICAgICAgICAgICAgICAgICAgJ2VzJywKICAgICAgICAgICAgICAgICAgICAnZGEnLAogICAgICAgICAgICAgICAgICAgICdubCcsCiAgICAgICAgICAgICAgICAgICAgJ2VsJywKICAgICAgICAgICAgICAgICAgICAnaHUnLAogICAgICAgICAgICAgICAgICAgICdwdCcsCiAgICAgICAgICAgICAgICAgICAgJ3JvJywKICAgICAgICAgICAgICAgICAgICAnZmknLAogICAgICAgICAgICAgICAgICAgICdwbCcsCiAgICAgICAgICAgICAgICAgICAgJ3NrJywKICAgICAgICAgICAgICAgICAgICAnc3YnLAogICAgICAgICAgICAgICAgICAgICdubycsCiAgICAgICAgICAgICAgICAgICAgJ3J1JywKICAgICAgICAgICAgICAgICAgICAnYmcnLAogICAgICAgICAgICAgICAgICAgICdjYScsCiAgICAgICAgICAgICAgICAgICAgJ2NzJywKICAgICAgICAgICAgICAgICAgICAnZXQnLAogICAgICAgICAgICAgICAgICAgICdocicsCiAgICAgICAgICAgICAgICAgICAgJ2x0JywKICAgICAgICAgICAgICAgICAgICAnbHYnLAogICAgICAgICAgICAgICAgICAgICdtdCcsCiAgICAgICAgICAgICAgICAgICAgJ3NsJywKICAgICAgICAgICAgICAgICAgICAndHInLAogICAgICAgICAgICAgICAgICAgICd6aCcKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBuZXcgQXJyYXkoYXJndW1lbnRzLmxlbmd0aCksIHIgPSAwOyByIDwgbi5sZW5ndGg7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bcl0gPSBhcmd1bWVudHNbcl07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDcpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVuY29kZVVSSUNvbXBvbmVudChlKS5yZXBsYWNlKC8lNDAvZ2ksICdAJykucmVwbGFjZSgvJTNBL2dpLCAnOicpLnJlcGxhY2UoLyUyNC9nLCAnJCcpLnJlcGxhY2UoLyUyQy9naSwgJywnKS5yZXBsYWNlKC8lMjAvZywgJysnKS5yZXBsYWNlKC8lNUIvZ2ksICdbJykucmVwbGFjZSgvJTVEL2dpLCAnXScpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIXQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIHZhciBpOwogICAgICAgICAgICAgICAgICAgIGlmIChuKQogICAgICAgICAgICAgICAgICAgICAgICBpID0gbih0KTsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChyLmlzVVJMU2VhcmNoUGFyYW1zKHQpKQogICAgICAgICAgICAgICAgICAgICAgICBpID0gdC50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICByLmZvckVhY2godCwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IGUgJiYgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBlICYmIChyLmlzQXJyYXkoZSkgPyB0ICs9ICdbXScgOiBlID0gW2VdLCByLmZvckVhY2goZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmlzRGF0ZShlKSA/IGUgPSBlLnRvSVNPU3RyaW5nKCkgOiByLmlzT2JqZWN0KGUpICYmIChlID0gSlNPTi5zdHJpbmdpZnkoZSkpLCBzLnB1c2gobyh0KSArICc9JyArIG8oZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgaSA9IHMuam9pbignJicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUuaW5kZXhPZignIycpOwogICAgICAgICAgICAgICAgICAgICAgICAtMSAhPT0gYSAmJiAoZSA9IGUuc2xpY2UoMCwgYSkpLCBlICs9ICgtMSA9PT0gZS5pbmRleE9mKCc/JykgPyAnPycgOiAnJicpICsgaTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISghZSB8fCAhZS5fX0NBTkNFTF9fKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oNyksIG8gPSBuKDEzNCksIGkgPSB7ICdDb250ZW50LVR5cGUnOiAnYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkJyB9OwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAhci5pc1VuZGVmaW5lZChlKSAmJiByLmlzVW5kZWZpbmVkKGVbJ0NvbnRlbnQtVHlwZSddKSAmJiAoZVsnQ29udGVudC1UeXBlJ10gPSB0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGFkYXB0ZXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfMjM1ZmFmOTY5NjE5MzE4MCA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8yMzVmYWY5Njk2MTkzMTgwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja19iNDZiM2JiNDY0NDJmYzkwLlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBYTUxIdHRwUmVxdWVzdCB8fCAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIHQgJiYgJ1tvYmplY3QgcHJvY2Vzc10nID09PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwodCkpICYmIChlID0gbig3NSkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMjM1ZmFmOTY5NjE5MzE4MCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX29sZF8yMzVmYWY5Njk2MTkzMTgwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwKICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtUmVxdWVzdDogW2Z1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8odCwgJ0FjY2VwdCcpLCBvKHQsICdDb250ZW50LVR5cGUnKSwgci5pc0Zvcm1EYXRhKGUpIHx8IHIuaXNBcnJheUJ1ZmZlcihlKSB8fCByLmlzQnVmZmVyKGUpIHx8IHIuaXNTdHJlYW0oZSkgfHwgci5pc0ZpbGUoZSkgfHwgci5pc0Jsb2IoZSkgPyBlIDogci5pc0FycmF5QnVmZmVyVmlldyhlKSA/IGUuYnVmZmVyIDogci5pc1VSTFNlYXJjaFBhcmFtcyhlKSA/IChzKHQsICdhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQ7Y2hhcnNldD11dGYtOCcpLCBlLnRvU3RyaW5nKCkpIDogci5pc09iamVjdChlKSA/IChzKHQsICdhcHBsaWNhdGlvbi9qc29uO2NoYXJzZXQ9dXRmLTgnKSwgSlNPTi5zdHJpbmdpZnkoZSkpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2Zvcm1SZXNwb25zZTogW2Z1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBKU09OLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICB0aW1lb3V0OiAwLAogICAgICAgICAgICAgICAgICAgICAgICB4c3JmQ29va2llTmFtZTogJ1hTUkYtVE9LRU4nLAogICAgICAgICAgICAgICAgICAgICAgICB4c3JmSGVhZGVyTmFtZTogJ1gtWFNSRi1UT0tFTicsCiAgICAgICAgICAgICAgICAgICAgICAgIG1heENvbnRlbnRMZW5ndGg6IC0xLAogICAgICAgICAgICAgICAgICAgICAgICB2YWxpZGF0ZVN0YXR1czogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID49IDIwMCAmJiBlIDwgMzAwOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7IGNvbW1vbjogeyBBY2NlcHQ6ICdhcHBsaWNhdGlvbi9qc29uLCB0ZXh0L3BsYWluLCAqLyonIH0gfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgci5mb3JFYWNoKFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2RlbGV0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdnZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAnaGVhZCcKICAgICAgICAgICAgICAgICAgICBdLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBhLmhlYWRlcnNbZV0gPSB7fTsKICAgICAgICAgICAgICAgICAgICB9KSwgci5mb3JFYWNoKFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3Bvc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAncHV0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ3BhdGNoJwogICAgICAgICAgICAgICAgICAgIF0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuaGVhZGVyc1tlXSA9IHIubWVyZ2UoaSk7CiAgICAgICAgICAgICAgICAgICAgfSksIGUuZXhwb3J0cyA9IGE7CiAgICAgICAgICAgICAgICB9LmNhbGwodGhpcywgbigxMzMpKSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNyksIG8gPSBuKDEzNSksIGkgPSBuKDcyKSwgcyA9IG4oMTM3KSwgYSA9IG4oMTQwKSwgYyA9IG4oMTQxKSwgdSA9IG4oNzYpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoZnVuY3Rpb24gKHQsIHApIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBlLmRhdGEsIGQgPSBlLmhlYWRlcnM7CiAgICAgICAgICAgICAgICAgICAgICAgIHIuaXNGb3JtRGF0YShsKSAmJiBkZWxldGUgZFsnQ29udGVudC1UeXBlJ107CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gbmV3IFhNTEh0dHBSZXF1ZXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmF1dGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZS5hdXRoLnVzZXJuYW1lIHx8ICcnLCB2ID0gZS5hdXRoLnBhc3N3b3JkIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5BdXRob3JpemF0aW9uID0gJ0Jhc2ljICcgKyBidG9hKGggKyAnOicgKyB2KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IHMoZS5iYXNlVVJMLCBlLnVybCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmLm9wZW4oZS5tZXRob2QudG9VcHBlckNhc2UoKSwgaSh5LCBlLnBhcmFtcywgZS5wYXJhbXNTZXJpYWxpemVyKSwgITApLCBmLnRpbWVvdXQgPSBlLnRpbWVvdXQsIGYub25yZWFkeXN0YXRlY2hhbmdlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmICYmIDQgPT09IGYucmVhZHlTdGF0ZSAmJiAoMCAhPT0gZi5zdGF0dXMgfHwgZi5yZXNwb25zZVVSTCAmJiAwID09PSBmLnJlc3BvbnNlVVJMLmluZGV4T2YoJ2ZpbGU6JykpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJ2dldEFsbFJlc3BvbnNlSGVhZGVycycgaW4gZiA/IGEoZi5nZXRBbGxSZXNwb25zZUhlYWRlcnMoKSkgOiBudWxsLCByID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IGUucmVzcG9uc2VUeXBlICYmICd0ZXh0JyAhPT0gZS5yZXNwb25zZVR5cGUgPyBmLnJlc3BvbnNlIDogZi5yZXNwb25zZVRleHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiBmLnN0YXR1cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXNUZXh0OiBmLnN0YXR1c1RleHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWc6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyh0LCBwLCByKSwgZiA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZi5vbmFib3J0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgJiYgKHAodSgnUmVxdWVzdCBhYm9ydGVkJywgZSwgJ0VDT05OQUJPUlRFRCcsIGYpKSwgZiA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZi5vbmVycm9yID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAodSgnTmV0d29yayBFcnJvcicsIGUsIG51bGwsIGYpKSwgZiA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmLm9udGltZW91dCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICd0aW1lb3V0IG9mICcgKyBlLnRpbWVvdXQgKyAnbXMgZXhjZWVkZWQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUudGltZW91dEVycm9yTWVzc2FnZSAmJiAodCA9IGUudGltZW91dEVycm9yTWVzc2FnZSksIHAodSh0LCBlLCAnRUNPTk5BQk9SVEVEJywgZikpLCBmID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIuaXNTdGFuZGFyZEJyb3dzZXJFbnYoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBuKDE0MiksIG0gPSAoZS53aXRoQ3JlZGVudGlhbHMgfHwgYyh5KSkgJiYgZS54c3JmQ29va2llTmFtZSA/IGcucmVhZChlLnhzcmZDb29raWVOYW1lKSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gJiYgKGRbZS54c3JmSGVhZGVyTmFtZV0gPSBtKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3NldFJlcXVlc3RIZWFkZXInIGluIGYgJiYgci5mb3JFYWNoKGQsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgPT09IHR5cGVvZiBsICYmICdjb250ZW50LXR5cGUnID09PSB0LnRvTG93ZXJDYXNlKCkgPyBkZWxldGUgZFt0XSA6IGYuc2V0UmVxdWVzdEhlYWRlcih0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLmlzVW5kZWZpbmVkKGUud2l0aENyZWRlbnRpYWxzKSB8fCAoZi53aXRoQ3JlZGVudGlhbHMgPSAhIWUud2l0aENyZWRlbnRpYWxzKSwgZS5yZXNwb25zZVR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYucmVzcG9uc2VUeXBlID0gZS5yZXNwb25zZVR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdqc29uJyAhPT0gZS5yZXNwb25zZVR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT09IHR5cGVvZiBlLm9uRG93bmxvYWRQcm9ncmVzcyAmJiBmLmFkZEV2ZW50TGlzdGVuZXIoJ3Byb2dyZXNzJywgZS5vbkRvd25sb2FkUHJvZ3Jlc3MpLCAnZnVuY3Rpb24nID09PSB0eXBlb2YgZS5vblVwbG9hZFByb2dyZXNzICYmIGYudXBsb2FkICYmIGYudXBsb2FkLmFkZEV2ZW50TGlzdGVuZXIoJ3Byb2dyZXNzJywgZS5vblVwbG9hZFByb2dyZXNzKSwgZS5jYW5jZWxUb2tlbiAmJiBlLmNhbmNlbFRva2VuLnByb21pc2UudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiAmJiAoZi5hYm9ydCgpLCBwKGUpLCBmID0gbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB2b2lkIDAgPT09IGwgJiYgKGwgPSBudWxsKSwgZi5zZW5kKGwpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMzYpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4sIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG5ldyBFcnJvcihlKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihzLCB0LCBuLCBvLCBpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHQgPSB0IHx8IHt9OwogICAgICAgICAgICAgICAgICAgIHZhciBuID0ge30sIG8gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXJsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtZXRob2QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BhcmFtcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGF0YScKICAgICAgICAgICAgICAgICAgICAgICAgXSwgaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdoZWFkZXJzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhdXRoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcm94eScKICAgICAgICAgICAgICAgICAgICAgICAgXSwgcyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdiYXNlVVJMJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1cmwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RyYW5zZm9ybVJlcXVlc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RyYW5zZm9ybVJlc3BvbnNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwYXJhbXNTZXJpYWxpemVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0aW1lb3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3aXRoQ3JlZGVudGlhbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FkYXB0ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Jlc3BvbnNlVHlwZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAneHNyZkNvb2tpZU5hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3hzcmZIZWFkZXJOYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvblVwbG9hZFByb2dyZXNzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvbkRvd25sb2FkUHJvZ3Jlc3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ21heENvbnRlbnRMZW5ndGgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZhbGlkYXRlU3RhdHVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtYXhSZWRpcmVjdHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2h0dHBBZ2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaHR0cHNBZ2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2FuY2VsVG9rZW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NvY2tldFBhdGgnCiAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgci5mb3JFYWNoKG8sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnICE9PSB0eXBlb2YgdFtlXSAmJiAobltlXSA9IHRbZV0pOwogICAgICAgICAgICAgICAgICAgIH0pLCByLmZvckVhY2goaSwgZnVuY3Rpb24gKG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgci5pc09iamVjdCh0W29dKSA/IG5bb10gPSByLmRlZXBNZXJnZShlW29dLCB0W29dKSA6ICd1bmRlZmluZWQnICE9PSB0eXBlb2YgdFtvXSA/IG5bb10gPSB0W29dIDogci5pc09iamVjdChlW29dKSA/IG5bb10gPSByLmRlZXBNZXJnZShlW29dKSA6ICd1bmRlZmluZWQnICE9PSB0eXBlb2YgZVtvXSAmJiAobltvXSA9IGVbb10pOwogICAgICAgICAgICAgICAgICAgIH0pLCByLmZvckVhY2gocywgZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiB0W3JdID8gbltyXSA9IHRbcl0gOiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGVbcl0gJiYgKG5bcl0gPSBlW3JdKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG8uY29uY2F0KGkpLmNvbmNhdChzKSwgYyA9IE9iamVjdC5rZXlzKHQpLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xID09PSBhLmluZGV4T2YoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByLmZvckVhY2goYywgZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiB0W3JdID8gbltyXSA9IHRbcl0gOiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGVbcl0gJiYgKG5bcl0gPSBlW3JdKTsKICAgICAgICAgICAgICAgICAgICB9KSwgbjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLm1lc3NhZ2UgPSBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgci5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdDYW5jZWwnICsgKHRoaXMubWVzc2FnZSA/ICc6ICcgKyB0aGlzLm1lc3NhZ2UgOiAnJyk7CiAgICAgICAgICAgICAgICB9LCByLnByb3RvdHlwZS5fX0NBTkNFTF9fID0gITAsIGUuZXhwb3J0cyA9IHI7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSB8fCAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHIobig0NykpLCByKG4oMjcpKSwgcihuKDI5KSksIHIobigxMDYpKTsKICAgICAgICAgICAgICAgIHZhciBvID0gbig1MSk7CiAgICAgICAgICAgICAgICB0LkFQSV9LRVkgPSBvLkFQSV9LRVk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBuKDEyOCk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAnZGF0YTppbWFnZS9zdmcreG1sLCUzQ3N2ZyB2aWV3Qm94PVwnMCAwIDE2IDE3XCcgdmVyc2lvbj1cJzEuMVwnIHhtbG5zPVwnaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmdcJyB4bWxuczp4bGluaz1cJ2h0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmtcJyBzdHlsZT1cJ21hcmdpbi1yaWdodDogNXB4OyBoZWlnaHQ6IDE3cHg7XCclM0UlM0NnIGlkPVwnUGFnZS0xXCcgc3Ryb2tlPVwnbm9uZVwnIHN0cm9rZS13aWR0aD1cJzFcJyBmaWxsPVwnbm9uZVwnIGZpbGwtcnVsZT1cJ2V2ZW5vZGRcJyUzRSUzQ2cgaWQ9XCdjb2dcJyBmaWxsPVwnJTIzRkZGRkZGXCcgZmlsbC1ydWxlPVwnbm9uemVyb1wnJTNFJTNDcGF0aCBkPVwnTTE1LjU5NjkxNyw5Ljk4MzI2OTM4IEwxNC41MDQxMDc5LDkuMzM3OTg4MTYgQzE0LjU3MjgwNjQsOC43ODE1Mzg2IDE0LjU3MjgwNjQsOC4yMTg0NjE0IDE0LjUwNDEwNzksNy42NjIwMTE4NCBMMTUuNTk2OTE3LDcuMDE2NzMwNjIgQzE1LjkxNzgyMjksNi44MjcyNjI1OSAxNi4wNzI2MTI0LDYuNDM3NDI3MzIgMTUuOTY3MDg0OCw2LjA3NDE1NDYgQzE1LjU5MTI4NzEsNC43ODAzMzYxMSAxNC45MjIzNjQ2LDMuNjE1NzMxNTMgMTQuMDM5MDAyMSwyLjY2MDYxMTEzIEMxMy43ODMxNzU1LDIuMzg0MDE3OTcgMTMuMzc0OTA1MywyLjMyMzQ4OTY1IDEzLjA1MjUyNDksMi41MTM4NDg4MSBMMTEuOTYxMzI0MywzLjE1ODEzNjA4IEMxMS41MjQ4NTE5LDIuODE4NDAxMTcgMTEuMDQ4MTIyMSwyLjUzNjQ4NjYzIDEwLjU0MjQ4MiwyLjMxOTEwMjU1IEwxMC41NDI0ODIsMS4wMjk5MTEwOCBDMTAuNTQyNDgyLDAuNjQ4NDM4NzMzIDEwLjI4NjA1MjIsMC4zMTY4Njk2ODMgOS45MjMwNTU5MiwwLjIyOTAyNDc5MiBDOC42NjE1NSwtMC4wNzYzMjQ0NiA3LjMzODcxODA5LC0wLjA3NjM1ODczNDIgNi4wNzY5NDQwOCwwLjIyOTAyNDc5MiBDNS43MTM5ODEzMSwwLjMxNjg2OTY4MyA1LjQ1NzUxOCwwLjY0ODQwNDQ1OCA1LjQ1NzUxOCwxLjAyOTkxMTA4IEw1LjQ1NzUxOCwyLjMxOTEwMjU1IEM0Ljk1MTg3NDA2LDIuNTM2NDc4NzIgNC40NzUxNDMzNCwyLjgxODM5MzgyIDQuMDM4Njc1NzIsMy4xNTgxMzYwOCBMMi45NDc0NzUxMSwyLjUxMzg0ODgxIEMyLjYyNTA2MTIyLDIuMzIzNDg5NjUgMi4yMTY3OTA5NCwyLjM4NDAxNzk3IDEuOTYwOTk3ODYsMi42NjA2MTExMyBDMS4wNzc2MzU0MiwzLjYxNTczMTUzIDAuNDA4NzEyODksNC43ODAzNzAzOCAwLjAzMjkxNTIyMzYsNi4wNzQxNTQ2IEMtMC4wNzI2MTI0MDcsNi40Mzc0MjczMiAwLjA4MjE3NzA4OTksNi44MjcyMjgzMiAwLjQwMzA4Mjk2Miw3LjAxNjczMDYyIEwxLjQ5NTg5MjEyLDcuNjYyMDExODQgQzEuNDI3MTkzNTYsOC4yMTg0NjE0IDEuNDI3MTkzNTYsOC43ODE1Mzg2IDEuNDk1ODkyMTIsOS4zMzc5ODgxNiBMMC40MDMwODI5NjIsOS45ODMyNjkzOCBDMC4wODIxNzcwODk5LDEwLjE3MjczNzQgLTAuMDcyNjEyNDA3LDEwLjU2MjU3MjcgMC4wMzI5MTUyMjM2LDEwLjkyNTg0NTQgQzAuNDA4NzEyODksMTIuMjE5NjI5NiAxLjA3NzYzNTQyLDEzLjM4NDI2ODUgMS45NjA5OTc4NiwxNC4zMzkzODg5IEMyLjIxNjgyNDQ1LDE0LjYxNTk4MiAyLjYyNTA5NDc0LDE0LjY3NjUxMDMgMi45NDc0NzUxMSwxNC40ODYxODU1IEw0LjAzODY3NTcyLDEzLjg0MTg5ODIgQzQuNDc1MTQwOTYsMTQuMTgxNjM0OSA0Ljk1MTg3MjQzLDE0LjQ2MzUzODkgNS40NTc1MTgsMTQuNjgwODk3NSBMNS40NTc1MTgsMTUuOTcwMDg4OSBDNS40NTc1MTgsMTYuMzUxNTYxMyA1LjcxMzk0NzgsMTYuNjgzMTMwMyA2LjA3Njk0NDA4LDE2Ljc3MDk3NTIgQzcuMzM4NDgzNTEsMTcuMDc2MzI0NSA4LjY2MTI4MTkxLDE3LjA3NjM1ODcgOS45MjMwNTU5MiwxNi43NzA5NzUyIEMxMC4yODYwMTg3LDE2LjY4MzEzMDMgMTAuNTQyNDgyLDE2LjM1MTU5NTUgMTAuNTQyNDgyLDE1Ljk3MDA4ODkgTDEwLjU0MjQ4MiwxNC42ODA4OTc1IEMxMS4wNDgxMTgzLDE0LjQ2MzUxOTggMTEuNTI0ODQ3NSwxNC4xODE2MTcxIDExLjk2MTMyNDMsMTMuODQxODk4MiBMMTMuMDUyNTI0OSwxNC40ODYxODU1IEMxMy4zNzQ5MDUzLDE0LjY3NjU0NDYgMTMuNzgzMTc1NSwxNC42MTYwMTYzIDE0LjAzOTAwMjEsMTQuMzM5Mzg4OSBDMTQuOTIyMzY0NiwxMy4zODQyNjg1IDE1LjU5MTI4NzEsMTIuMjE5NjI5NiAxNS45NjcwODQ4LDEwLjkyNTg0NTQgQzE2LjA3MjYxMjQsMTAuNTYyNTcyNyAxNS45MTc4MjI5LDEwLjE3Mjc3MTcgMTUuNTk2OTE3LDkuOTgzMjY5MzggWiBNMTMuNDAyNjE5MywxMy40MjY0OTQzIEwxMS44NTA3MzY0LDEyLjUxMDAwMSBDMTAuOTQ2MzI4OCwxMy4zMDA3NDIxIDEwLjYyNTU5MDUsMTMuNDk5NzA0MSA5LjQ3MDExNDg0LDEzLjkxNzI2NzMgTDkuNDcwMTE0ODQsMTUuNzUwMjE5NiBDOC41MDAyNDgwOCwxNS45NTQ4MzczIDcuNDk5NzUxOTIsMTUuOTU0ODM3MyA2LjUyOTg4NTE2LDE1Ljc1MDIxOTYgTDYuNTI5ODg1MTYsMTMuOTE3MjY3MyBDNS40MDMxOTU5LDEzLjUxMDEyMzUgNS4wNzY5OTUyMiwxMy4zMjEwNjY4IDQuMTQ5MjYzNTgsMTIuNTEwMDAxIEwyLjU5NzM4MDc1LDEzLjQyNjQ5NDMgQzEuOTM2ODY5NiwxMi42NjkzNzYzIDEuNDM0OTAxMjQsMTEuNzgxNzA3NiAxLjEyNTI1NTIyLDEwLjgyMzA5MTIgTDIuNjc3ODA4MjgsOS45MDY1OTc4OSBDMi40NTg4MTA4LDguNjkyNzA2OTQgMi40NTg3MTAyNyw4LjMwNzkwOTk5IDIuNjc3ODA4MjgsNy4wOTM0MDIxMSBMMS4xMjUyNTUyMiw2LjE3NjkwODc5IEMxLjQzNDkwMTI0LDUuMjE4MjkyNDIgMS45MzY5MDMxMSw0LjMzMDU4OTQ2IDIuNTk3MzgwNzUsMy41NzMxMjg2NCBMNC4xNDkyNjM1OCw0LjQ5MDMwNzQ1IEM1LjA2NjcwNzIsMy42ODcxMjQ3OCA1LjM5MTI5OTMzLDMuNDk0MTI2NSA2LjUyOTg4NTE2LDMuMDgyNjk4NDYgTDYuNTI5ODg1MTYsMS4yNDk3ODAzNyBDNy40OTk3MTc3NCwxLjA0NDgyMDU5IDguNTAwMjgyMjYsMS4wNDQ4MjA1OSA5LjQ3MDExNDg0LDEuMjQ5NzgwMzcgTDkuNDcwMTE0ODQsMy4wODI3MzI3NCBDMTAuNjA4NzY3NywzLjQ5NDE5NTA1IDEwLjkzMzM5MzMsMy42ODcyMjc2IDExLjg1MDczNjQsNC40OTAzNDE3MiBMMTMuNDAyNjE5MywzLjU3MzE2MjkxIEMxNC4wNjMwOTY5LDQuMzMwNTg5NDYgMTQuNTY1MDk4OCw1LjIxODI5MjQyIDE0Ljg3NDc0NDgsNi4xNzY5NDMwNiBMMTMuMzIyMTkxNyw3LjA5MzQzNjM4IEMxMy41NDEyMjI3LDguMzA3NjM1OCAxMy41NDEyODk3LDguNjkyMTI0MjggMTMuMzIyMTkxNyw5LjkwNjYzMjE3IEwxNC44NzQ3NDQ4LDEwLjgyMzEyNTUgQzE0LjU2NTA5ODgsMTEuNzgxNzA3NiAxNC4wNjMxMzA0LDEyLjY2OTQxMDUgMTMuNDAyNjE5MywxMy40MjY0OTQzIFogTTgsNS4yMDk2ODk1OCBDNi4yMjYwNzAxNCw1LjIwOTY4OTU4IDQuNzgyODk4NTMsNi42ODU3MDk5NiA0Ljc4Mjg5ODUzLDguNTAwMDE3MTQgQzQuNzgyODk4NTMsMTAuMzE0MzI0MyA2LjIyNjA3MDE0LDExLjc5MDM0NDcgOCwxMS43OTAzNDQ3IEM5Ljc3MzkyOTg2LDExLjc5MDM0NDcgMTEuMjE3MTAxNSwxMC4zMTQzMjQzIDExLjIxNzEwMTUsOC41MDAwMTcxNCBDMTEuMjE3MTAxNSw2LjY4NTcwOTk2IDkuNzczOTI5ODYsNS4yMDk2ODk1OCA4LDUuMjA5Njg5NTggWiBNOCwxMC42OTM1Njg4IEM2LjgxNzM4MDA5LDEwLjY5MzU2ODggNS44NTUyNjU2OCw5LjcwOTU1NTI2IDUuODU1MjY1NjgsOC41MDAwMTcxNCBDNS44NTUyNjU2OCw3LjI5MDQ3OTAyIDYuODE3MzgwMDksNi4zMDY0NjU0MyA4LDYuMzA2NDY1NDMgQzkuMTgyNjE5OTEsNi4zMDY0NjU0MyAxMC4xNDQ3MzQzLDcuMjkwNDc5MDIgMTAuMTQ0NzM0Myw4LjUwMDAxNzE0IEMxMC4xNDQ3MzQzLDkuNzA5NTU1MjYgOS4xODI2MTk5MSwxMC42OTM1Njg4IDgsMTAuNjkzNTY4OCBaXCcgaWQ9XCdTaGFwZVwnJTNFJTNDL3BhdGglM0UlM0MvZyUzRSUzQy9nJTNFJTNDL3N2ZyUzRSc7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3QucHJvdG90eXBlLCBuID0gdC5oYXNPd25Qcm9wZXJ0eSwgciA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBTeW1ib2wgPyBTeW1ib2wgOiB7fSwgbyA9IHIuaXRlcmF0b3IgfHwgJ0BAaXRlcmF0b3InLCBpID0gci5hc3luY0l0ZXJhdG9yIHx8ICdAQGFzeW5jSXRlcmF0b3InLCBzID0gci50b1N0cmluZ1RhZyB8fCAnQEB0b1N0cmluZ1RhZyc7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGVbdF07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEoe30sICcnKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChMKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbdF0gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0ICYmIHQucHJvdG90eXBlIGluc3RhbmNlb2YgbCA/IHQgOiBsLCBpID0gT2JqZWN0LmNyZWF0ZShvLnByb3RvdHlwZSksIHMgPSBuZXcgUyhyIHx8IFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuX2ludm9rZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICdzdXNwZW5kZWRTdGFydCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2V4ZWN1dGluZycgPT09IHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignR2VuZXJhdG9yIGlzIGFscmVhZHkgcnVubmluZycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnY29tcGxldGVkJyA9PT0gcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3Rocm93JyA9PT0gbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobi5tZXRob2QgPSBvLCBuLmFyZyA9IGk7OykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG4uZGVsZWdhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IEMocywgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhID09PSBwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ25leHQnID09PSBuLm1ldGhvZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uc2VudCA9IG4uX3NlbnQgPSBuLmFyZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoJ3Rocm93JyA9PT0gbi5tZXRob2QpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3VzcGVuZGVkU3RhcnQnID09PSByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IHIgPSAnY29tcGxldGVkJywgbi5hcmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmRpc3BhdGNoRXhjZXB0aW9uKG4uYXJnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmV0dXJuJyA9PT0gbi5tZXRob2QgJiYgbi5hYnJ1cHQoJ3JldHVybicsIG4uYXJnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9ICdleGVjdXRpbmcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHUoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnbm9ybWFsJyA9PT0gYy50eXBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociA9IG4uZG9uZSA/ICdjb21wbGV0ZWQnIDogJ3N1c3BlbmRlZFlpZWxkJywgYy5hcmcgPT09IHApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBjLmFyZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiBuLmRvbmUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Rocm93JyA9PT0gYy50eXBlICYmIChyID0gJ2NvbXBsZXRlZCcsIG4ubWV0aG9kID0gJ3Rocm93Jywgbi5hcmcgPSBjLmFyZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfShlLCBuLCBzKSwgaTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdub3JtYWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZzogZS5jYWxsKHQsIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChMKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd0aHJvdycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJnOiBMCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGUud3JhcCA9IGM7CiAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSB7fTsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IHt9OwogICAgICAgICAgICAgICAgICAgIGhbb10gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSBPYmplY3QuZ2V0UHJvdG90eXBlT2YsIHkgPSB2ICYmIHYodihJKFtdKSkpOwogICAgICAgICAgICAgICAgICAgIHkgJiYgeSAhPT0gdCAmJiBuLmNhbGwoeSwgbykgJiYgKGggPSB5KTsKICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGYucHJvdG90eXBlID0gbC5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKGgpOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oZSkgewogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbmV4dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGhyb3cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3JldHVybicKICAgICAgICAgICAgICAgICAgICAgICAgXS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKGUsIHQsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2ludm9rZSh0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9pbnZva2UgPSBmdW5jdGlvbiAobywgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHQoZnVuY3Rpb24gKHIsIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIHIobywgaSwgcywgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB1KGVbb10sIGUsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd0aHJvdycgIT09IGMudHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gYy5hcmcsIGwgPSBwLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsICYmICdvYmplY3QnID09PSB0eXBlb2YgbCAmJiBuLmNhbGwobCwgJ19fYXdhaXQnKSA/IHQucmVzb2x2ZShsLl9fYXdhaXQpLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcignbmV4dCcsIGUsIHMsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoJ3Rocm93JywgZSwgcywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiB0LnJlc29sdmUobCkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLnZhbHVlID0gZSwgcyhwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigndGhyb3cnLCBlLCBzLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoYy5hcmcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG8sIGksIHIsIHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSByID8gci50aGVuKHMsIHMpIDogcygpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLml0ZXJhdG9yW3QubWV0aG9kXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuZGVsZWdhdGUgPSBudWxsLCAndGhyb3cnID09PSB0Lm1ldGhvZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLml0ZXJhdG9yLnJldHVybiAmJiAodC5tZXRob2QgPSAncmV0dXJuJywgdC5hcmcgPSB2b2lkIDAsIEMoZSwgdCksICd0aHJvdycgPT09IHQubWV0aG9kKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tZXRob2QgPSAndGhyb3cnLCB0LmFyZyA9IG5ldyBUeXBlRXJyb3IoJ1RoZSBpdGVyYXRvciBkb2VzIG5vdCBwcm92aWRlIGEgXCd0aHJvd1wnIG1ldGhvZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB1KG4sIGUuaXRlcmF0b3IsIHQuYXJnKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd0aHJvdycgPT09IHIudHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lm1ldGhvZCA9ICd0aHJvdycsIHQuYXJnID0gci5hcmcsIHQuZGVsZWdhdGUgPSBudWxsLCBwOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHIuYXJnOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyA/IG8uZG9uZSA/ICh0W2UucmVzdWx0TmFtZV0gPSBvLnZhbHVlLCB0Lm5leHQgPSBlLm5leHRMb2MsICdyZXR1cm4nICE9PSB0Lm1ldGhvZCAmJiAodC5tZXRob2QgPSAnbmV4dCcsIHQuYXJnID0gdm9pZCAwKSwgdC5kZWxlZ2F0ZSA9IG51bGwsIHApIDogbyA6ICh0Lm1ldGhvZCA9ICd0aHJvdycsIHQuYXJnID0gbmV3IFR5cGVFcnJvcignaXRlcmF0b3IgcmVzdWx0IGlzIG5vdCBhbiBvYmplY3QnKSwgdC5kZWxlZ2F0ZSA9IG51bGwsIHApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBfKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7IHRyeUxvYzogZVswXSB9OwogICAgICAgICAgICAgICAgICAgICAgICAxIGluIGUgJiYgKHQuY2F0Y2hMb2MgPSBlWzFdKSwgMiBpbiBlICYmICh0LmZpbmFsbHlMb2MgPSBlWzJdLCB0LmFmdGVyTG9jID0gZVszXSksIHRoaXMudHJ5RW50cmllcy5wdXNoKHQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBFKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmNvbXBsZXRpb24gfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgIHQudHlwZSA9ICdub3JtYWwnLCBkZWxldGUgdC5hcmcsIGUuY29tcGxldGlvbiA9IHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnRyeUVudHJpZXMgPSBbeyB0cnlMb2M6ICdyb290JyB9XSwgZS5mb3JFYWNoKF8sIHRoaXMpLCB0aGlzLnJlc2V0KCEwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbb107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5jYWxsKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT09IHR5cGVvZiBlLm5leHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzTmFOKGUubGVuZ3RoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gLTEsIGkgPSBmdW5jdGlvbiB0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7ICsrciA8IGUubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5jYWxsKGUsIHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC52YWx1ZSA9IGVbcl0sIHQuZG9uZSA9ICExLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudmFsdWUgPSB2b2lkIDAsIHQuZG9uZSA9ICEwLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLm5leHQgPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7IG5leHQ6IFAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZC5wcm90b3R5cGUgPSBnLmNvbnN0cnVjdG9yID0gZiwgZi5jb25zdHJ1Y3RvciA9IGQsIGQuZGlzcGxheU5hbWUgPSBhKGYsIHMsICdHZW5lcmF0b3JGdW5jdGlvbicpLCBlLmlzR2VuZXJhdG9yRnVuY3Rpb24gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBlICYmIGUuY29uc3RydWN0b3I7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXQgJiYgKHQgPT09IGQgfHwgJ0dlbmVyYXRvckZ1bmN0aW9uJyA9PT0gKHQuZGlzcGxheU5hbWUgfHwgdC5uYW1lKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5tYXJrID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5zZXRQcm90b3R5cGVPZiA/IE9iamVjdC5zZXRQcm90b3R5cGVPZihlLCBmKSA6IChlLl9fcHJvdG9fXyA9IGYsIGEoZSwgcywgJ0dlbmVyYXRvckZ1bmN0aW9uJykpLCBlLnByb3RvdHlwZSA9IE9iamVjdC5jcmVhdGUoZyksIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5hd3JhcCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7IF9fYXdhaXQ6IGUgfTsKICAgICAgICAgICAgICAgICAgICB9LCBtKGIucHJvdG90eXBlKSwgYi5wcm90b3R5cGVbaV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgIH0sIGUuQXN5bmNJdGVyYXRvciA9IGIsIGUuYXN5bmMgPSBmdW5jdGlvbiAodCwgbiwgciwgbywgaSkgewogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGkgJiYgKGkgPSBQcm9taXNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBuZXcgYihjKHQsIG4sIHIsIG8pLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuaXNHZW5lcmF0b3JGdW5jdGlvbihuKSA/IHMgOiBzLm5leHQoKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5kb25lID8gZS52YWx1ZSA6IHMubmV4dCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBtKGcpLCBhKGcsIHMsICdHZW5lcmF0b3InKSwgZ1tvXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgfSwgZy50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0IEdlbmVyYXRvcl0nOwogICAgICAgICAgICAgICAgICAgIH0sIGUua2V5cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucmV2ZXJzZSgpLCBmdW5jdGlvbiBuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHQubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC5wb3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi52YWx1ZSA9IHIsIG4uZG9uZSA9ICExLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uZG9uZSA9ICEwLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGUudmFsdWVzID0gSSwgUy5wcm90b3R5cGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0cnVjdG9yOiBTLAogICAgICAgICAgICAgICAgICAgICAgICByZXNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPSAwLCB0aGlzLm5leHQgPSAwLCB0aGlzLnNlbnQgPSB0aGlzLl9zZW50ID0gdm9pZCAwLCB0aGlzLmRvbmUgPSAhMSwgdGhpcy5kZWxlZ2F0ZSA9IG51bGwsIHRoaXMubWV0aG9kID0gJ25leHQnLCB0aGlzLmFyZyA9IHZvaWQgMCwgdGhpcy50cnlFbnRyaWVzLmZvckVhY2goRSksICFlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgaW4gdGhpcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3QnID09PSB0LmNoYXJBdCgwKSAmJiBuLmNhbGwodGhpcywgdCkgJiYgIWlzTmFOKCt0LnNsaWNlKDEpKSAmJiAodGhpc1t0XSA9IHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3A6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZG9uZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnRyeUVudHJpZXNbMF0uY29tcGxldGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndGhyb3cnID09PSBlLnR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZS5hcmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5ydmFsOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBkaXNwYXRjaEV4Y2VwdGlvbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmRvbmUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzLnR5cGUgPSAndGhyb3cnLCBzLmFyZyA9IGUsIHQubmV4dCA9IG4sIHIgJiYgKHQubWV0aG9kID0gJ25leHQnLCB0LmFyZyA9IHZvaWQgMCksICEhcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gPSB0aGlzLnRyeUVudHJpZXMubGVuZ3RoIC0gMTsgbyA+PSAwOyAtLW8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHRoaXMudHJ5RW50cmllc1tvXSwgcyA9IGkuY29tcGxldGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3Jvb3QnID09PSBpLnRyeUxvYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ2VuZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpLnRyeUxvYyA8PSB0aGlzLnByZXYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuLmNhbGwoaSwgJ2NhdGNoTG9jJyksIGMgPSBuLmNhbGwoaSwgJ2ZpbmFsbHlMb2MnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEgJiYgYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGkuY2F0Y2hMb2MpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoaS5jYXRjaExvYywgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGkuZmluYWxseUxvYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihpLmZpbmFsbHlMb2MpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBpLmNhdGNoTG9jKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGkuY2F0Y2hMb2MsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ3RyeSBzdGF0ZW1lbnQgd2l0aG91dCBjYXRjaCBvciBmaW5hbGx5Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgaS5maW5hbGx5TG9jKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGkuZmluYWxseUxvYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFicnVwdDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSB0aGlzLnRyeUVudHJpZXMubGVuZ3RoIC0gMTsgciA+PSAwOyAtLXIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRoaXMudHJ5RW50cmllc1tyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoby50cnlMb2MgPD0gdGhpcy5wcmV2ICYmIG4uY2FsbChvLCAnZmluYWxseUxvYycpICYmIHRoaXMucHJldiA8IG8uZmluYWxseUxvYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJiYgKCdicmVhaycgPT09IGUgfHwgJ2NvbnRpbnVlJyA9PT0gZSkgJiYgaS50cnlMb2MgPD0gdCAmJiB0IDw9IGkuZmluYWxseUxvYyAmJiAoaSA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBpID8gaS5jb21wbGV0aW9uIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy50eXBlID0gZSwgcy5hcmcgPSB0LCBpID8gKHRoaXMubWV0aG9kID0gJ25leHQnLCB0aGlzLm5leHQgPSBpLmZpbmFsbHlMb2MsIHApIDogdGhpcy5jb21wbGV0ZShzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY29tcGxldGU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3Rocm93JyA9PT0gZS50eXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGUuYXJnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdicmVhaycgPT09IGUudHlwZSB8fCAnY29udGludWUnID09PSBlLnR5cGUgPyB0aGlzLm5leHQgPSBlLmFyZyA6ICdyZXR1cm4nID09PSBlLnR5cGUgPyAodGhpcy5ydmFsID0gdGhpcy5hcmcgPSBlLmFyZywgdGhpcy5tZXRob2QgPSAncmV0dXJuJywgdGhpcy5uZXh0ID0gJ2VuZCcpIDogJ25vcm1hbCcgPT09IGUudHlwZSAmJiB0ICYmICh0aGlzLm5leHQgPSB0KSwgcDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZmluaXNoOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyB0ID49IDA7IC0tdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcy50cnlFbnRyaWVzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmZpbmFsbHlMb2MgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbXBsZXRlKG4uY29tcGxldGlvbiwgbi5hZnRlckxvYyksIEUobiksIHA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGNoOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyB0ID49IDA7IC0tdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcy50cnlFbnRyaWVzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLnRyeUxvYyA9PT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4uY29tcGxldGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd0aHJvdycgPT09IHIudHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByLmFyZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEUobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdpbGxlZ2FsIGNhdGNoIGF0dGVtcHQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZGVsZWdhdGVZaWVsZDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmRlbGVnYXRlID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZXJhdG9yOiBJKGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdE5hbWU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dExvYzogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgJ25leHQnID09PSB0aGlzLm1ldGhvZCAmJiAodGhpcy5hcmcgPSB2b2lkIDApLCBwOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0oZS5leHBvcnRzKTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgcmVnZW5lcmF0b3JSdW50aW1lID0gcjsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG8pIHsKICAgICAgICAgICAgICAgICAgICBGdW5jdGlvbigncicsICdyZWdlbmVyYXRvclJ1bnRpbWUgPSByJykocik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCAociA9IHQuQ21wU3RhdHVzIHx8ICh0LkNtcFN0YXR1cyA9IHt9KSkuU1RVQiA9ICdzdHViJywgci5MT0FESU5HID0gJ2xvYWRpbmcnLCByLkxPQURFRCA9ICdsb2FkZWQnLCByLkVSUk9SID0gJ2Vycm9yJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIChyID0gdC5EaXNwbGF5U3RhdHVzIHx8ICh0LkRpc3BsYXlTdGF0dXMgPSB7fSkpLlZJU0lCTEUgPSAndmlzaWJsZScsIHIuSElEREVOID0gJ2hpZGRlbicsIHIuRElTQUJMRUQgPSAnZGlzYWJsZWQnOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHI7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgKHIgPSB0LkV2ZW50U3RhdHVzIHx8ICh0LkV2ZW50U3RhdHVzID0ge30pKS5UQ19MT0FERUQgPSAndGNsb2FkZWQnLCByLkNNUF9VSV9TSE9XTiA9ICdjbXB1aXNob3duJywgci5VU0VSX0FDVElPTl9DT01QTEVURSA9ICd1c2VyYWN0aW9uY29tcGxldGUnOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzApLCBvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ldmVudFF1ZXVlID0gbmV3IE1hcCgpLCB0aGlzLnF1ZXVlTnVtYmVyID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmV2ZW50UXVldWUuc2V0KHRoaXMucXVldWVOdW1iZXIsIGUpLCB0aGlzLnF1ZXVlTnVtYmVyKys7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnJlbW92ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5ldmVudFF1ZXVlLmRlbGV0ZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuZXhlYyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZXZlbnRRdWV1ZS5mb3JFYWNoKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IHIuR2V0VENEYXRhQ29tbWFuZChlLmNhbGxiYWNrLCBlLnBhcmFtLCB0LCBlLm5leHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLmNsZWFyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5xdWV1ZU51bWJlciA9IDAsIHRoaXMuZXZlbnRRdWV1ZS5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZS5wcm90b3R5cGUsICdzaXplJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZXZlbnRRdWV1ZS5zaXplOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkV2ZW50TGlzdGVuZXJRdWV1ZSA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0oKSwgbyA9IHRoaXMgJiYgdGhpcy5fX3JlYWQgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZVtTeW1ib2wuaXRlcmF0b3JdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8sIGkgPSBuLmNhbGwoZSksIHMgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyAodm9pZCAwID09PSB0IHx8IHQtLSA+IDApICYmICEociA9IGkubmV4dCgpKS5kb25lOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnB1c2goci52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSB7IGVycm9yOiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgIXIuZG9uZSAmJiAobiA9IGkucmV0dXJuKSAmJiBuLmNhbGwoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBvLmVycm9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzOwogICAgICAgICAgICAgICAgICAgIH0sIGkgPSB0aGlzICYmIHRoaXMuX19zcHJlYWQgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gW10sIHQgPSAwOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUuY29uY2F0KG8oYXJndW1lbnRzW3RdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmNhbGwodGhpcywgdCkgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRlbGV0ZSBuLm91dE9mQmFuZCwgbjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIHQucHJvdG90eXBlLmNyZWF0ZVZlY3RvckZpZWxkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoZSkucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSArICh0WzFdID8gJzEnIDogJzAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgJycpOwogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmNyZWF0ZVJlc3RyaWN0aW9ucyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLm51bVJlc3RyaWN0aW9ucyA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5nZXRNYXhWZW5kb3JJZCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5nZXRSZXN0cmljdGlvbnMoKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtlLnB1cnBvc2VJZC50b1N0cmluZygpXSA9ICdfJy5yZXBlYXQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuICsgMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2V0UmVzdHJpY3Rpb25zKHIpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUucmVzdHJpY3Rpb25UeXBlLnRvU3RyaW5nKCksIG8gPSBlLnB1cnBvc2VJZC50b1N0cmluZygpLCBpID0gdFtvXS5zdWJzdHIoMCwgbiksIHMgPSB0W29dLnN1YnN0cihuICsgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtvXSA9IGkgKyByICsgczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvID0gMDsgbyA8IG47IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKG8pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sIHQ7CiAgICAgICAgICAgICAgICB9KG4oNTApLlRDRGF0YSk7CiAgICAgICAgICAgICAgICB0LkluQXBwVENEYXRhID0gczsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMTMpLCBpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jYWxsKHRoaXMpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5jbXBMb2FkZWQgPSAhMCwgdC5jbXBTdGF0dXMgPSBvLkNtcEFwaU1vZGVsLmNtcFN0YXR1cywgdC5kaXNwbGF5U3RhdHVzID0gby5DbXBBcGlNb2RlbC5kaXNwbGF5U3RhdHVzLCB0LmFwaVZlcnNpb24gPSAnJyArIG8uQ21wQXBpTW9kZWwuYXBpVmVyc2lvbiwgby5DbXBBcGlNb2RlbC50Y01vZGVsICYmIG8uQ21wQXBpTW9kZWwudGNNb2RlbC52ZW5kb3JMaXN0VmVyc2lvbiAmJiAodC5ndmxWZXJzaW9uID0gK28uQ21wQXBpTW9kZWwudGNNb2RlbC52ZW5kb3JMaXN0VmVyc2lvbiksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIHQ7CiAgICAgICAgICAgICAgICAgICAgfShuKDI4KS5SZXNwb25zZSk7CiAgICAgICAgICAgICAgICB0LlBpbmcgPSBpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTMpLCBvID0gbigyOSksIGkgPSBuKDUxKSwgcyA9IG4oNTIpLCBhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKGUsIHQsIG4sIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gbiAmJiAobiA9ICExKSwgdGhpcy5udW1VcGRhdGVzID0gMCwgdGhpcy50aHJvd0lmSW52YWxpZEludChlLCAnY21wSWQnLCAyKSwgdGhpcy50aHJvd0lmSW52YWxpZEludCh0LCAnY21wVmVyc2lvbicsIDApLCByLkNtcEFwaU1vZGVsLmNtcElkID0gZSwgci5DbXBBcGlNb2RlbC5jbXBWZXJzaW9uID0gdCwgci5DbXBBcGlNb2RlbC50Y2ZQb2xpY3lWZXJzaW9uID0gMiwgdGhpcy5pc1NlcnZpY2VTcGVjaWZpYyA9ICEhbiwgdGhpcy5jYWxsUmVzcG9uZGVyID0gbmV3IGkuQ2FsbFJlc3BvbmRlcihvKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUudGhyb3dJZkludmFsaWRJbnQgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoJ251bWJlcicgPT0gdHlwZW9mIGUgJiYgTnVtYmVyLmlzSW50ZWdlcihlKSAmJiBlID49IG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignSW52YWxpZCAnICsgdCArICc6ICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUudXBkYXRlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IHQgJiYgKHQgPSAhMSksIHIuQ21wQXBpTW9kZWwuZGlzYWJsZWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdDbXBBcGkgRGlzYWJsZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuQ21wQXBpTW9kZWwuY21wU3RhdHVzID0gby5DbXBTdGF0dXMuTE9BREVELCB0ID8gKHIuQ21wQXBpTW9kZWwuZGlzcGxheVN0YXR1cyA9IG8uRGlzcGxheVN0YXR1cy5WSVNJQkxFLCByLkNtcEFwaU1vZGVsLmV2ZW50U3RhdHVzID0gby5FdmVudFN0YXR1cy5DTVBfVUlfU0hPV04pIDogdm9pZCAwID09PSByLkNtcEFwaU1vZGVsLnRjTW9kZWwgPyAoci5DbXBBcGlNb2RlbC5kaXNwbGF5U3RhdHVzID0gby5EaXNwbGF5U3RhdHVzLkRJU0FCTEVELCByLkNtcEFwaU1vZGVsLmV2ZW50U3RhdHVzID0gby5FdmVudFN0YXR1cy5UQ19MT0FERUQpIDogKHIuQ21wQXBpTW9kZWwuZGlzcGxheVN0YXR1cyA9IG8uRGlzcGxheVN0YXR1cy5ISURERU4sIHIuQ21wQXBpTW9kZWwuZXZlbnRTdGF0dXMgPSBvLkV2ZW50U3RhdHVzLlVTRVJfQUNUSU9OX0NPTVBMRVRFKSwgci5DbXBBcGlNb2RlbC5nZHByQXBwbGllcyA9IG51bGwgIT09IGUsIHIuQ21wQXBpTW9kZWwuZ2RwckFwcGxpZXMgPyAoJycgPT09IGUgPyAoci5DbXBBcGlNb2RlbC50Y01vZGVsID0gbmV3IHMuVENNb2RlbCgpLCByLkNtcEFwaU1vZGVsLnRjTW9kZWwuY21wSWQgPSByLkNtcEFwaU1vZGVsLmNtcElkLCByLkNtcEFwaU1vZGVsLnRjTW9kZWwuY21wVmVyc2lvbiA9IHIuQ21wQXBpTW9kZWwuY21wVmVyc2lvbikgOiByLkNtcEFwaU1vZGVsLnRjTW9kZWwgPSBzLlRDU3RyaW5nLmRlY29kZShlKSwgci5DbXBBcGlNb2RlbC50Y01vZGVsLmlzU2VydmljZVNwZWNpZmljID0gdGhpcy5pc1NlcnZpY2VTcGVjaWZpYywgci5DbXBBcGlNb2RlbC50Y2ZQb2xpY3lWZXJzaW9uID0gK3IuQ21wQXBpTW9kZWwudGNNb2RlbC5wb2xpY3lWZXJzaW9uLCByLkNtcEFwaU1vZGVsLnRjU3RyaW5nID0gZSkgOiByLkNtcEFwaU1vZGVsLnRjTW9kZWwgPSBudWxsLCAwID09PSB0aGlzLm51bVVwZGF0ZXMgPyB0aGlzLmNhbGxSZXNwb25kZXIucHVyZ2VRdWV1ZWRDYWxscygpIDogci5DbXBBcGlNb2RlbC5ldmVudFF1ZXVlLmV4ZWMoKSwgdGhpcy5udW1VcGRhdGVzKys7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLmRpc2FibGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLkNtcEFwaU1vZGVsLmRpc2FibGVkID0gITAsIHIuQ21wQXBpTW9kZWwuY21wU3RhdHVzID0gby5DbXBTdGF0dXMuRVJST1I7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5DbXBBcGkgPSBhOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTA4KSwgbyA9IG4oMzApLCBpID0gbigxMDkpLCBzID0gbigxMTApLCBhID0gbigxMjUpLCBjID0gbigxMjYpLCB1ID0gbig0OCksIHAgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHAsIGwsIGQsIGY7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gdS5UQ0ZDb21tYW5kLlBJTkcsIG4gPSB1LlRDRkNvbW1hbmQuR0VUX1RDX0RBVEEsIHAgPSB1LlRDRkNvbW1hbmQuR0VUX0lOX0FQUF9UQ19EQVRBLCBsID0gdS5UQ0ZDb21tYW5kLkdFVF9WRU5ET1JfTElTVCwgZCA9IHUuVENGQ29tbWFuZC5BRERfRVZFTlRfTElTVEVORVIsIGYgPSB1LlRDRkNvbW1hbmQuUkVNT1ZFX0VWRU5UX0xJU1RFTkVSLCBlW3RdID0gci5QaW5nQ29tbWFuZCwgZVtuXSA9IG8uR2V0VENEYXRhQ29tbWFuZCwgZVtwXSA9IGkuR2V0SW5BcHBUQ0RhdGFDb21tYW5kLCBlW2xdID0gcy5HZXRWZW5kb3JMaXN0Q29tbWFuZCwgZVtkXSA9IGEuQWRkRXZlbnRMaXN0ZW5lckNvbW1hbmQsIGVbZl0gPSBjLlJlbW92ZUV2ZW50TGlzdGVuZXJDb21tYW5kLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuQ29tbWFuZE1hcCA9IHA7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBuKDI3KSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gZSAmJiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdC5wcm90b3R5cGUucmVzcG9uZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW52b2tlQ2FsbGJhY2sobmV3IG8uUGluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdDsKICAgICAgICAgICAgICAgICAgICB9KG4oMzEpLkNvbW1hbmQpOwogICAgICAgICAgICAgICAgdC5QaW5nQ29tbWFuZCA9IGk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBuKDMwKSwgaSA9IG4oMjcpLCBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5yZXNwb25kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy50aHJvd0lmUGFyYW1JbnZhbGlkKCksIHRoaXMuaW52b2tlQ2FsbGJhY2sobmV3IGkuSW5BcHBUQ0RhdGEodGhpcy5wYXJhbSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgIH0oby5HZXRUQ0RhdGFDb21tYW5kKTsKICAgICAgICAgICAgICAgIHQuR2V0SW5BcHBUQ0RhdGFDb21tYW5kID0gczsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMTMpLCBpID0gbigzMSksIHMgPSBuKDUyKSwgYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gZSAmJiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdC5wcm90b3R5cGUucmVzcG9uZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0ID0gdGhpcywgbiA9IG8uQ21wQXBpTW9kZWwudGNNb2RlbCwgciA9IG4udmVuZG9yTGlzdFZlcnNpb247CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IHRoaXMucGFyYW0gJiYgKHRoaXMucGFyYW0gPSByKSwgKGUgPSB0aGlzLnBhcmFtID09PSByICYmIG4uZ3ZsID8gbi5ndmwgOiBuZXcgcy5HVkwodGhpcy5wYXJhbSkpLnJlYWR5UHJvbWlzZS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmludm9rZUNhbGxiYWNrKGUuZ2V0SnNvbigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgIH0oaS5Db21tYW5kKTsKICAgICAgICAgICAgICAgIHQuR2V0VmVuZG9yTGlzdENvbW1hbmQgPSBhOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzICYmIHRoaXMuX19leHRlbmRzIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCB7IF9fcHJvdG9fXzogW10gfSBpbnN0YW5jZW9mIEFycmF5ICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9fcHJvdG9fXyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pICYmIChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnN0cnVjdG9yID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmNhbGwodGhpcywgdCkgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ubmFtZSA9ICdEZWNvZGluZ0Vycm9yJywgbjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIHQ7CiAgICAgICAgICAgICAgICB9KEVycm9yKTsKICAgICAgICAgICAgICAgIHQuRGVjb2RpbmdFcnJvciA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQodCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuY2FsbCh0aGlzLCB0KSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5uYW1lID0gJ0VuY29kaW5nRXJyb3InLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdDsKICAgICAgICAgICAgICAgIH0oRXJyb3IpOwogICAgICAgICAgICAgICAgdC5FbmNvZGluZ0Vycm9yID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5jYWxsKHRoaXMsIHQpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLm5hbWUgPSAnR1ZMRXJyb3InLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdDsKICAgICAgICAgICAgICAgIH0oRXJyb3IpOwogICAgICAgICAgICAgICAgdC5HVkxFcnJvciA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQodCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IHIgJiYgKHIgPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZS5jYWxsKHRoaXMsICdpbnZhbGlkIHZhbHVlICcgKyBuICsgJyBwYXNzZWQgZm9yICcgKyB0ICsgJyAnICsgcikgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8ubmFtZSA9ICdUQ01vZGVsRXJyb3InLCBvOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdDsKICAgICAgICAgICAgICAgIH0oRXJyb3IpOwogICAgICAgICAgICAgICAgdC5UQ01vZGVsRXJyb3IgPSBvOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuaGFzID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubGFuZ1NldC5oYXModCk7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuZm9yRWFjaCA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUubGFuZ1NldC5mb3JFYWNoKHQpOwogICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLnByb3RvdHlwZSwgJ3NpemUnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubGFuZ1NldC5zaXplOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pLCBlLmxhbmdTZXQgPSBuZXcgU2V0KFsKICAgICAgICAgICAgICAgICAgICAgICAgJ0JHJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0NBJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0NTJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0RBJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0RFJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0VMJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0VOJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0VTJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0VUJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0ZJJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0ZSJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0hSJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0hVJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0lUJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0pBJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0xUJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0xWJywKICAgICAgICAgICAgICAgICAgICAgICAgJ01UJywKICAgICAgICAgICAgICAgICAgICAgICAgJ05MJywKICAgICAgICAgICAgICAgICAgICAgICAgJ05PJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1BMJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1BUJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1JPJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1JVJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1NLJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1NMJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1NWJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1RSJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1pIJwogICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5Db25zZW50TGFuZ3VhZ2VzID0gcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCB7IF9fcHJvdG9fXzogW10gfSBpbnN0YW5jZW9mIEFycmF5ICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnN0cnVjdG9yID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSgpLCBvID0gdGhpcyAmJiB0aGlzLl9fdmFsdWVzIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIFN5bWJvbC5pdGVyYXRvciwgbiA9IHQgJiYgZVt0XSwgciA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgJ251bWJlcicgPT0gdHlwZW9mIGUubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIHIgPj0gZS5sZW5ndGggJiYgKGUgPSB2b2lkIDApLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZSAmJiBlW3IrK10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IodCA/ICdPYmplY3QgaXMgbm90IGl0ZXJhYmxlLicgOiAnU3ltYm9sLml0ZXJhdG9yIGlzIG5vdCBkZWZpbmVkLicpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBpID0gbig1NiksIHMgPSBuKDU0KSwgYSA9IG4oMzgpLCBjID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbnVsbCAhPT0gZSAmJiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmJpdExlbmd0aCA9IDAsIHQubWFwID0gbmV3IE1hcCgpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5oYXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWFwLmhhcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuaXNPa1RvSGF2ZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgbyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IChyID0gdGhpcy5ndmwpIHx8IHZvaWQgMCA9PT0gciA/IHZvaWQgMCA6IHIudmVuZG9ycykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdGhpcy5ndmwudmVuZG9yc1tuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IGEuUmVzdHJpY3Rpb25UeXBlLk5PVF9BTExPV0VEKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGkubGVnSW50UHVycG9zZXMuaW5jbHVkZXModCkgfHwgaS5wdXJwb3Nlcy5pbmNsdWRlcyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoaS5mbGV4aWJsZVB1cnBvc2VzLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBhLlJlc3RyaWN0aW9uVHlwZS5SRVFVSVJFX0NPTlNFTlQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGkuZmxleGlibGVQdXJwb3Nlcy5pbmNsdWRlcyh0KSAmJiBpLmxlZ0ludFB1cnBvc2VzLmluY2x1ZGVzKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBhLlJlc3RyaWN0aW9uVHlwZS5SRVFVSVJFX0xJOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBpLmZsZXhpYmxlUHVycG9zZXMuaW5jbHVkZXModCkgJiYgaS5wdXJwb3Nlcy5pbmNsdWRlcyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5pc09rVG9IYXZlKHQucmVzdHJpY3Rpb25UeXBlLCB0LnB1cnBvc2VJZCwgZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuaGFzaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmhhcyhuKSB8fCAodGhpcy5tYXAuc2V0KG4sIG5ldyBzLkJpbmFyeVNlYXJjaFRyZWUoKSksIHRoaXMuYml0TGVuZ3RoID0gMCksIHRoaXMubWFwLmdldChuKS5hZGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnJlc3RyaWN0UHVycG9zZVRvTGVnYWxCYXNpcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gdGhpcy5ndmwudmVuZG9ySWRzLCBuID0gZS5oYXNoLCByID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIG4sIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSBvKHQpLCBzID0gaS5uZXh0KCk7ICFzLmRvbmU7IHMgPSBpLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHMudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHsgZXJyb3I6IHQgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyAmJiAhcy5kb25lICYmIChuID0gaS5yZXR1cm4pICYmIG4uY2FsbChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGUuZXJyb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgaSA9IDE7IGkgPD0gcjsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaGFzKG4pIHx8ICh0aGlzLm1hcC5zZXQobiwgbmV3IHMuQmluYXJ5U2VhcmNoVHJlZSgpKSwgdGhpcy5iaXRMZW5ndGggPSAwKSwgdGhpcy5tYXAuZ2V0KG4pLmFkZChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZ2V0VmVuZG9ycyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuaGFzaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmhhcyhuKSAmJiAodCA9IHRoaXMubWFwLmdldChuKS5nZXQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbmV3IFNldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubWFwLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5nZXQoKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmFkZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQgPSBBcnJheS5mcm9tKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFJlc3RyaWN0aW9uVHlwZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldFJlc3RyaWN0aW9ucyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wdXJwb3NlSWQgPT09IHQgJiYgKHZvaWQgMCA9PT0gbiB8fCBuID4gZS5yZXN0cmljdGlvblR5cGUpICYmIChuID0gZS5yZXN0cmljdGlvblR5cGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnZlbmRvckhhc1Jlc3RyaWN0aW9uID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAhMSwgciA9IHRoaXMuZ2V0UmVzdHJpY3Rpb25zKGUpLCBvID0gMDsgbyA8IHIubGVuZ3RoICYmICFuOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHQuaXNTYW1lQXMocltvXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZ2V0TWF4VmVuZG9ySWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5tYXAuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBNYXRoLm1heCh0Lm1heCgpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRSZXN0cmljdGlvbnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm1hcC5mb3JFYWNoKGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA/IG4uY29udGFpbnMoZSkgJiYgdC5wdXNoKGkuUHVycG9zZVJlc3RyaWN0aW9uLnVuSGFzaChyKSkgOiB0LnB1c2goaS5QdXJwb3NlUmVzdHJpY3Rpb24udW5IYXNoKHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRQdXJwb3NlcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IFNldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWFwLmZvckVhY2goZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmFkZChpLlB1cnBvc2VSZXN0cmljdGlvbi51bkhhc2gobikucHVycG9zZUlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBBcnJheS5mcm9tKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5yZW1vdmUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0Lmhhc2gsIHIgPSB0aGlzLm1hcC5nZXQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYmIChyLnJlbW92ZShlKSwgci5pc0VtcHR5KCkgJiYgKHRoaXMubWFwLmRlbGV0ZShuKSwgdGhpcy5iaXRMZW5ndGggPSAwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2d2bCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmd2bF87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmd2bF8gfHwgKHRoaXMuZ3ZsXyA9IGUsIHRoaXMubWFwLmZvckVhY2goZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBpLlB1cnBvc2VSZXN0cmljdGlvbi51bkhhc2gobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2V0KCkuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5pc09rVG9IYXZlKHIucmVzdHJpY3Rpb25UeXBlLCByLnB1cnBvc2VJZCwgbikgfHwgZS5yZW1vdmUobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQucHJvdG90eXBlLmlzRW1wdHkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA9PT0gdGhpcy5tYXAuc2l6ZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAnbnVtUmVzdHJpY3Rpb25zJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWFwLnNpemU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgIH0obigxNSkuQ2xvbmVhYmxlKTsKICAgICAgICAgICAgICAgIHQuUHVycG9zZVJlc3RyaWN0aW9uVmVjdG9yID0gYzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIChyID0gdC5EZXZpY2VEaXNjbG9zdXJlU3RvcmFnZUFjY2Vzc1R5cGUgfHwgKHQuRGV2aWNlRGlzY2xvc3VyZVN0b3JhZ2VBY2Nlc3NUeXBlID0ge30pKS5DT09LSUUgPSAnY29va2llJywgci5XRUIgPSAnd2ViJywgci5BUFAgPSAnYXBwJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oNTcpLCBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLklEX1RPX0tFWSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uU2VnbWVudC5DT1JFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgby5TZWdtZW50LlZFTkRPUlNfRElTQ0xPU0VELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgby5TZWdtZW50LlZFTkRPUlNfQUxMT1dFRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uU2VnbWVudC5QVUJMSVNIRVJfVEMKICAgICAgICAgICAgICAgICAgICAgICAgXSwgZS5LRVlfVE9fSUQgPSAoKHIgPSB7fSlbby5TZWdtZW50LkNPUkVdID0gMCwgcltvLlNlZ21lbnQuVkVORE9SU19ESVNDTE9TRURdID0gMSwgcltvLlNlZ21lbnQuVkVORE9SU19BTExPV0VEXSA9IDIsIHJbby5TZWdtZW50LlBVQkxJU0hFUl9UQ10gPSAzLCByKSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LlNlZ21lbnRJRHMgPSBpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzICYmIHRoaXMuX19leHRlbmRzIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9fcHJvdG9fXyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pICYmIChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KCksIG8gPSB0aGlzICYmIHRoaXMuX19nZW5lcmF0b3IgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8sIGksIHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWw6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VudDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSAmIG9bMF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBvWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeXM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wczogW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogYSgwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93OiBhKDEpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOiBhKDIpCiAgICAgICAgICAgICAgICAgICAgICAgIH0sICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAoaVtTeW1ib2wuaXRlcmF0b3JdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpOwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0dlbmVyYXRvciBpcyBhbHJlYWR5IGV4ZWN1dGluZy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHM7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9IDEsIHIgJiYgKG8gPSAyICYgaVswXSA/IHIucmV0dXJuIDogaVswXSA/IHIudGhyb3cgfHwgKChvID0gci5yZXR1cm4pICYmIG8uY2FsbChyKSwgMCkgOiByLm5leHQpICYmICEobyA9IG8uY2FsbChyLCBpWzFdKSkuZG9uZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChyID0gMCwgbyAmJiAoaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIgJiBpWzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby52YWx1ZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgaVswXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzLmxhYmVsKyssIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBpWzFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubGFiZWwrKywgciA9IGlbMV0sIGkgPSBbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IHMub3BzLnBvcCgpLCBzLnRyeXMucG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG8gPSAobyA9IHMudHJ5cykubGVuZ3RoID4gMCAmJiBvW28ubGVuZ3RoIC0gMV0pICYmICg2ID09PSBpWzBdIHx8IDIgPT09IGlbMF0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgzID09PSBpWzBdICYmICghbyB8fCBpWzFdID4gb1swXSAmJiBpWzFdIDwgb1szXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubGFiZWwgPSBpWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDYgPT09IGlbMF0gJiYgcy5sYWJlbCA8IG9bMV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubGFiZWwgPSBvWzFdLCBvID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvICYmIHMubGFiZWwgPCBvWzJdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLmxhYmVsID0gb1syXSwgcy5vcHMucHVzaChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9bMl0gJiYgcy5vcHMucG9wKCksIHMudHJ5cy5wb3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSB0LmNhbGwoZSwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHIgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbyA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg1ICYgaVswXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGlbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogaVswXSA/IGlbMV0gOiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIGkgPSBuKDE1KSwgcyA9IG4oNSksIGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYml0TGVuZ3RoID0gMCwgdC5tYXhJZF8gPSAwLCB0LnNldF8gPSBuZXcgU2V0KCksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIHQucHJvdG90eXBlW1N5bWJvbC5pdGVyYXRvcl0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKHRoaXMsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0LmxhYmVsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gMSwgdC5sYWJlbCA9IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA8PSB0aGlzLm1heElkID8gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaGFzKGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0gOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zZW50KCksIHQubGFiZWwgPSAzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUrKywgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbMl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnZhbHVlcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNldF8udmFsdWVzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ21heElkJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWF4SWRfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5wcm90b3R5cGUuaGFzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNldF8uaGFzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS51bnNldCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBBcnJheS5pc0FycmF5KGUpID8gZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudW5zZXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6ICdvYmplY3QnID09IHR5cGVvZiBlID8gdGhpcy51bnNldChPYmplY3Qua2V5cyhlKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gK2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgOiAodGhpcy5zZXRfLmRlbGV0ZShlKSwgdGhpcy5iaXRMZW5ndGggPSAwLCBlID09PSB0aGlzLm1heElkICYmICh0aGlzLm1heElkXyA9IDAsIHRoaXMuc2V0Xy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tYXhJZF8gPSBNYXRoLm1heCh0Lm1heElkLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmlzSW50TWFwID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcywgbiA9ICdvYmplY3QnID09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gJiYgT2JqZWN0LmtleXMoZSkuZXZlcnkoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE51bWJlci5pc0ludGVnZXIocGFyc2VJbnQobiwgMTApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHIgPSByICYmIHQuaXNWYWxpZE51bWJlcihlW25dLmlkKSkgJiYgdm9pZCAwICE9PSBlW25dLm5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuaXNWYWxpZE51bWJlciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VJbnQoZSwgMTApID4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuaXNTZXQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIGluc3RhbmNlb2YgU2V0ICYmICh0ID0gQXJyYXkuZnJvbShlKS5ldmVyeSh0aGlzLmlzVmFsaWROdW1iZXIpKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuc2V0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5zZXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICh0aGlzLmlzU2V0KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0KEFycmF5LmZyb20oZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAodGhpcy5pc0ludE1hcChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNldChPYmplY3Qua2V5cyhlKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICtlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdGhpcy5pc1ZhbGlkTnVtYmVyKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgcy5UQ01vZGVsRXJyb3IoJ3NldCgpJywgZSwgJ211c3QgYmUgcG9zaXRpdmUgaW50ZWdlciBhcnJheSwgcG9zaXRpdmUgaW50ZWdlciwgU2V0PG51bWJlcj4sIG9yIEludE1hcCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0Xy5hZGQoZSksIHRoaXMubWF4SWRfID0gTWF0aC5tYXgodGhpcy5tYXhJZCwgZSksIHRoaXMuYml0TGVuZ3RoID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZW1wdHkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNldF8gPSBuZXcgU2V0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmZvckVhY2ggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPD0gdGhpcy5tYXhJZDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUodGhpcy5oYXModCksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdzaXplJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2V0Xy5zaXplOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5wcm90b3R5cGUuc2V0QWxsID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgIH0oaS5DbG9uZWFibGUpOwogICAgICAgICAgICAgICAgdC5WZWN0b3IgPSBhOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNTMpLCBvID0gbigzNyksIGkgPSBuKDU4KSwgcyA9IG4oNjQpLCBhID0gbig1KSwgYyA9IG4oNTUpLCB1ID0gbig2KSwgcCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5lbmNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHMgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gdGhpcy5maWVsZFNlcXVlbmNlWycnICsgZS52ZXJzaW9uXVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgYS5FbmNvZGluZ0Vycm9yKCdVbmFibGUgdG8gZW5jb2RlIHZlcnNpb246ICcgKyBlLnZlcnNpb24gKyAnLCBzZWdtZW50OiAnICsgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgIT09IHUuU2VnbWVudC5DT1JFICYmIChwID0gaS5JbnRFbmNvZGVyLmVuY29kZSh1LlNlZ21lbnRJRHMuS0VZX1RPX0lEW3RdLCBvLkJpdExlbmd0aC5zZWdtZW50VHlwZSkpLCBuLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGVbbl0sIHUgPSBpLkZpZWxkRW5jb2Rlck1hcFtuXSwgbCA9IG8uQml0TGVuZ3RoW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gbCAmJiBzLmlzUHVibGlzaGVyQ3VzdG9tKG4pICYmIChsID0gK2VbYy5GaWVsZHMubnVtQ3VzdG9tUHVycG9zZXNdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwICs9IHUuZW5jb2RlKHIsIGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGEuRW5jb2RpbmdFcnJvcignRXJyb3IgZW5jb2RpbmcgJyArIHQgKyAnLT4nICsgbiArICc6ICcgKyBlLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLkJhc2U2NFVybC5lbmNvZGUocCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZGVjb2RlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gdGhpcywgcCA9IHIuQmFzZTY0VXJsLmRlY29kZShlKSwgbCA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9PT0gdS5TZWdtZW50LkNPUkUgJiYgKHQudmVyc2lvbiA9IGkuSW50RW5jb2Rlci5kZWNvZGUocC5zdWJzdHIobCwgby5CaXRMZW5ndGhbYy5GaWVsZHMudmVyc2lvbl0pLCBvLkJpdExlbmd0aFtjLkZpZWxkcy52ZXJzaW9uXSkpLCBuICE9PSB1LlNlZ21lbnQuQ09SRSAmJiAobCArPSBvLkJpdExlbmd0aC5zZWdtZW50VHlwZSksIHRoaXMuZmllbGRTZXF1ZW5jZVsnJyArIHQudmVyc2lvbl1bbl0uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gaS5GaWVsZEVuY29kZXJNYXBbZV0sIHIgPSBvLkJpdExlbmd0aFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSByICYmIHMuaXNQdWJsaXNoZXJDdXN0b20oZSkgJiYgKHIgPSArdFtjLkZpZWxkcy5udW1DdXN0b21QdXJwb3Nlc10pLCAwICE9PSByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gcC5zdWJzdHIobCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID09PSBpLlZlbmRvclZlY3RvckVuY29kZXIgPyB0W2VdID0gbi5kZWNvZGUodSwgdC52ZXJzaW9uKSA6IHRbZV0gPSBuLmRlY29kZSh1LCByKSwgTnVtYmVyLmlzSW50ZWdlcihyKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgKz0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIU51bWJlci5pc0ludGVnZXIodFtlXS5iaXRMZW5ndGgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBhLkRlY29kaW5nRXJyb3IoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsICs9IHRbZV0uYml0TGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuaXNQdWJsaXNoZXJDdXN0b20gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPT09IGUuaW5kZXhPZigncHVibGlzaGVyQ3VzdG9tJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZmllbGRTZXF1ZW5jZSA9IG5ldyBzLkZpZWxkU2VxdWVuY2UoKSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LlNlZ21lbnRFbmNvZGVyID0gcDsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDYpLCBvID0gbigyMyksIGkgPSBuKDU5KSwgcyA9IG4oMzkpLCBhID0gbigxNiksIGMgPSBuKDYwKSwgdSA9IG4oNjEpLCBwID0gbig2MiksIGwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIGwsIGQsIGYsIGgsIHYsIHksIGcsIG0sIGIsIEMsIF8sIEUsIFMsIEksIFAsIEwsIHcsIEEsIE8sIGssIFQsIFYsIHgsIFI7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gci5GaWVsZHMudmVyc2lvbiwgbiA9IHIuRmllbGRzLmNyZWF0ZWQsIGwgPSByLkZpZWxkcy5sYXN0VXBkYXRlZCwgZCA9IHIuRmllbGRzLmNtcElkLCBmID0gci5GaWVsZHMuY21wVmVyc2lvbiwgaCA9IHIuRmllbGRzLmNvbnNlbnRTY3JlZW4sIHYgPSByLkZpZWxkcy5jb25zZW50TGFuZ3VhZ2UsIHkgPSByLkZpZWxkcy52ZW5kb3JMaXN0VmVyc2lvbiwgZyA9IHIuRmllbGRzLnBvbGljeVZlcnNpb24sIG0gPSByLkZpZWxkcy5pc1NlcnZpY2VTcGVjaWZpYywgYiA9IHIuRmllbGRzLnVzZU5vblN0YW5kYXJkU3RhY2tzLCBDID0gci5GaWVsZHMuc3BlY2lhbEZlYXR1cmVPcHRpbnMsIF8gPSByLkZpZWxkcy5wdXJwb3NlQ29uc2VudHMsIEUgPSByLkZpZWxkcy5wdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cywgUyA9IHIuRmllbGRzLnB1cnBvc2VPbmVUcmVhdG1lbnQsIEkgPSByLkZpZWxkcy5wdWJsaXNoZXJDb3VudHJ5Q29kZSwgUCA9IHIuRmllbGRzLnZlbmRvckNvbnNlbnRzLCBMID0gci5GaWVsZHMudmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cywgdyA9IHIuRmllbGRzLnB1Ymxpc2hlclJlc3RyaWN0aW9ucywgQSA9IHIuRmllbGRzLnZlbmRvcnNEaXNjbG9zZWQsIE8gPSByLkZpZWxkcy52ZW5kb3JzQWxsb3dlZCwgayA9IHIuRmllbGRzLnB1Ymxpc2hlckNvbnNlbnRzLCBUID0gci5GaWVsZHMucHVibGlzaGVyTGVnaXRpbWF0ZUludGVyZXN0cywgViA9IHIuRmllbGRzLm51bUN1c3RvbVB1cnBvc2VzLCB4ID0gci5GaWVsZHMucHVibGlzaGVyQ3VzdG9tQ29uc2VudHMsIFIgPSByLkZpZWxkcy5wdWJsaXNoZXJDdXN0b21MZWdpdGltYXRlSW50ZXJlc3RzLCBlW3RdID0gYS5JbnRFbmNvZGVyLCBlW25dID0gaS5EYXRlRW5jb2RlciwgZVtsXSA9IGkuRGF0ZUVuY29kZXIsIGVbZF0gPSBhLkludEVuY29kZXIsIGVbZl0gPSBhLkludEVuY29kZXIsIGVbaF0gPSBhLkludEVuY29kZXIsIGVbdl0gPSBjLkxhbmdFbmNvZGVyLCBlW3ldID0gYS5JbnRFbmNvZGVyLCBlW2ddID0gYS5JbnRFbmNvZGVyLCBlW21dID0gby5Cb29sZWFuRW5jb2RlciwgZVtiXSA9IG8uQm9vbGVhbkVuY29kZXIsIGVbQ10gPSBzLkZpeGVkVmVjdG9yRW5jb2RlciwgZVtfXSA9IHMuRml4ZWRWZWN0b3JFbmNvZGVyLCBlW0VdID0gcy5GaXhlZFZlY3RvckVuY29kZXIsIGVbU10gPSBvLkJvb2xlYW5FbmNvZGVyLCBlW0ldID0gYy5MYW5nRW5jb2RlciwgZVtQXSA9IHAuVmVuZG9yVmVjdG9yRW5jb2RlciwgZVtMXSA9IHAuVmVuZG9yVmVjdG9yRW5jb2RlciwgZVt3XSA9IHUuUHVycG9zZVJlc3RyaWN0aW9uVmVjdG9yRW5jb2RlciwgZS5zZWdtZW50VHlwZSA9IGEuSW50RW5jb2RlciwgZVtBXSA9IHAuVmVuZG9yVmVjdG9yRW5jb2RlciwgZVtPXSA9IHAuVmVuZG9yVmVjdG9yRW5jb2RlciwgZVtrXSA9IHMuRml4ZWRWZWN0b3JFbmNvZGVyLCBlW1RdID0gcy5GaXhlZFZlY3RvckVuY29kZXIsIGVbVl0gPSBhLkludEVuY29kZXIsIGVbeF0gPSBzLkZpeGVkVmVjdG9yRW5jb2RlciwgZVtSXSA9IHMuRml4ZWRWZWN0b3JFbmNvZGVyLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuRmllbGRFbmNvZGVyTWFwID0gbDsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDYpOwogICAgICAgICAgICAgICAgdC5GaWVsZFNlcXVlbmNlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlLCB0OwogICAgICAgICAgICAgICAgICAgIHRoaXNbMV0gPSAoKGUgPSB7fSlbci5TZWdtZW50LkNPUkVdID0gWwogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy52ZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5jcmVhdGVkLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5sYXN0VXBkYXRlZCwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY21wSWQsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmNtcFZlcnNpb24sCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmNvbnNlbnRTY3JlZW4sCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmNvbnNlbnRMYW5ndWFnZSwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMudmVuZG9yTGlzdFZlcnNpb24sCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnB1cnBvc2VDb25zZW50cywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMudmVuZG9yQ29uc2VudHMKICAgICAgICAgICAgICAgICAgICBdLCBlKSwgdGhpc1syXSA9ICgodCA9IHt9KVtyLlNlZ21lbnQuQ09SRV0gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnZlcnNpb24sCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmNyZWF0ZWQsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmxhc3RVcGRhdGVkLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5jbXBJZCwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY21wVmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY29uc2VudFNjcmVlbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY29uc2VudExhbmd1YWdlLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy52ZW5kb3JMaXN0VmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucG9saWN5VmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuaXNTZXJ2aWNlU3BlY2lmaWMsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnVzZU5vblN0YW5kYXJkU3RhY2tzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5zcGVjaWFsRmVhdHVyZU9wdGlucywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucHVycG9zZUNvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucHVycG9zZU9uZVRyZWF0bWVudCwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucHVibGlzaGVyQ291bnRyeUNvZGUsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnZlbmRvckNvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy52ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdWJsaXNoZXJSZXN0cmljdGlvbnMKICAgICAgICAgICAgICAgICAgICBdLCB0W3IuU2VnbWVudC5QVUJMSVNIRVJfVENdID0gWwogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdWJsaXNoZXJDb25zZW50cywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucHVibGlzaGVyTGVnaXRpbWF0ZUludGVyZXN0cywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMubnVtQ3VzdG9tUHVycG9zZXMsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnB1Ymxpc2hlckN1c3RvbUNvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdWJsaXNoZXJDdXN0b21MZWdpdGltYXRlSW50ZXJlc3RzCiAgICAgICAgICAgICAgICAgICAgXSwgdFtyLlNlZ21lbnQuVkVORE9SU19BTExPV0VEXSA9IFtyLkZpZWxkcy52ZW5kb3JzQWxsb3dlZF0sIHRbci5TZWdtZW50LlZFTkRPUlNfRElTQ0xPU0VEXSA9IFtyLkZpZWxkcy52ZW5kb3JzRGlzY2xvc2VkXSwgdCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNik7CiAgICAgICAgICAgICAgICB0LlNlZ21lbnRTZXF1ZW5jZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXNbMV0gPSBbci5TZWdtZW50LkNPUkVdLCB0aGlzWzJdID0gW3IuU2VnbWVudC5DT1JFXSwgMiA9PT0gZS52ZXJzaW9uKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5pc1NlcnZpY2VTcGVjaWZpYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbMl0ucHVzaChyLlNlZ21lbnQuUFVCTElTSEVSX1RDKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICEoIXQgfHwgIXQuaXNGb3JWZW5kb3JzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgITAgIT09IGVbci5GaWVsZHMuc3VwcG9ydE9PQl0gfHwgdGhpc1syXS5wdXNoKHIuU2VnbWVudC5WRU5ET1JTX0RJU0NMT1NFRCksIG4gJiYgKGVbci5GaWVsZHMuc3VwcG9ydE9PQl0gJiYgZVtyLkZpZWxkcy52ZW5kb3JzQWxsb3dlZF0uc2l6ZSA+IDAgJiYgdGhpc1syXS5wdXNoKHIuU2VnbWVudC5WRU5ET1JTX0FMTE9XRUQpLCB0aGlzWzJdLnB1c2goci5TZWdtZW50LlBVQkxJU0hFUl9UQykpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNSksIG8gPSBuKDYpLCBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb2Nlc3MgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIG8sIGkgPSBlLmd2bDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgci5FbmNvZGluZ0Vycm9yKCdVbmFibGUgdG8gZW5jb2RlIFRDTW9kZWwgd2l0aG91dCBhIEdWTCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpLmlzUmVhZHkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHIuRW5jb2RpbmdFcnJvcignVW5hYmxlIHRvIGVuY29kZSBUQ01vZGVsIHRjTW9kZWwuZ3ZsLnJlYWR5UHJvbWlzZSBpcyBub3QgcmVzb2x2ZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChlID0gZS5jbG9uZSgpKS5jb25zZW50TGFuZ3VhZ2UgPSBpLmxhbmd1YWdlLnRvVXBwZXJDYXNlKCksIChudWxsID09PSAobiA9IHQpIHx8IHZvaWQgMCA9PT0gbiA/IHZvaWQgMCA6IG4udmVyc2lvbikgPiAwICYmIChudWxsID09PSAobyA9IHQpIHx8IHZvaWQgMCA9PT0gbyA/IHZvaWQgMCA6IG8udmVyc2lvbikgPD0gdGhpcy5wcm9jZXNzb3IubGVuZ3RoID8gZS52ZXJzaW9uID0gdC52ZXJzaW9uIDogZS52ZXJzaW9uID0gdGhpcy5wcm9jZXNzb3IubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBlLnZlcnNpb24gLSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLnByb2Nlc3NvcltzXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgci5FbmNvZGluZ0Vycm9yKCdJbnZhbGlkIHZlcnNpb246ICcgKyBlLnZlcnNpb24pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucHJvY2Vzc29yW3NdKGUsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb2Nlc3NvciA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnB1Ymxpc2hlclJlc3RyaWN0aW9ucy5ndmwgPSB0LCBlLnB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzLnVuc2V0KDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IE1hcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnNldCgnbGVnSW50UHVycG9zZXMnLCBlLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMpLCBuLnNldCgncHVycG9zZXMnLCBlLnZlbmRvckNvbnNlbnRzKSwgbi5mb3JFYWNoKGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uZm9yRWFjaChmdW5jdGlvbiAoaSwgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQudmVuZG9yc1tzXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWEgfHwgYS5kZWxldGVkRGF0ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi51bnNldChzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgwID09PSBhW3JdLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdsZWdJbnRQdXJwb3NlcycgPT09IHIgJiYgMCA9PT0gYS5wdXJwb3Nlcy5sZW5ndGggJiYgMCA9PT0gYS5sZWdJbnRQdXJwb3Nlcy5sZW5ndGggJiYgYS5zcGVjaWFsUHVycG9zZXMubGVuZ3RoID4gMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGUuaXNTZXJ2aWNlU3BlY2lmaWMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gYS5mbGV4aWJsZVB1cnBvc2VzLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnVuc2V0KHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IGUucHVibGlzaGVyUmVzdHJpY3Rpb25zLmdldFJlc3RyaWN0aW9ucyhzKSwgdSA9ICExLCBwID0gMCwgbCA9IGMubGVuZ3RoOyBwIDwgbCAmJiAhdTsgcCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gY1twXS5yZXN0cmljdGlvblR5cGUgPT09IG8uUmVzdHJpY3Rpb25UeXBlLlJFUVVJUkVfQ09OU0VOVCAmJiAncHVycG9zZXMnID09PSByIHx8IGNbcF0ucmVzdHJpY3Rpb25UeXBlID09PSBvLlJlc3RyaWN0aW9uVHlwZS5SRVFVSVJFX0xJICYmICdsZWdJbnRQdXJwb3NlcycgPT09IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSB8fCBuLnVuc2V0KHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnVuc2V0KHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZS52ZW5kb3JzRGlzY2xvc2VkLnNldCh0LnZlbmRvcnMpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuU2VtYW50aWNQcmVFbmNvZGVyID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMTMpLCBpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5yZXNwb25kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5saXN0ZW5lcklkID0gby5DbXBBcGlNb2RlbC5ldmVudFF1ZXVlLmFkZCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IHRoaXMuY2FsbGJhY2ssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW06IHRoaXMucGFyYW0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogdGhpcy5uZXh0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZS5wcm90b3R5cGUucmVzcG9uZC5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgIH0obigzMCkuR2V0VENEYXRhQ29tbWFuZCk7CiAgICAgICAgICAgICAgICB0LkFkZEV2ZW50TGlzdGVuZXJDb21tYW5kID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMTMpLCBpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5yZXNwb25kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pbnZva2VDYWxsYmFjayhvLkNtcEFwaU1vZGVsLmV2ZW50UXVldWUucmVtb3ZlKHRoaXMucGFyYW0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdDsKICAgICAgICAgICAgICAgICAgICB9KG4oMzEpLkNvbW1hbmQpOwogICAgICAgICAgICAgICAgdC5SZW1vdmVFdmVudExpc3RlbmVyQ29tbWFuZCA9IGk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmhhcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PSB0eXBlb2YgZSAmJiAoZSA9ICtlKSwgdGhpcy5zZXRfLmhhcyhlKTsKICAgICAgICAgICAgICAgICAgICB9LCBlLnNldF8gPSBuZXcgU2V0KFsKICAgICAgICAgICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICBudWxsCiAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LlN1cHBvcnRlZFZlcnNpb25zID0gcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbig3KSwgbyA9IG4oNzEpLCBpID0gbigxMjkpLCBzID0gbig3Nyk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG5ldyBpKGUpLCBuID0gbyhpLnByb3RvdHlwZS5yZXF1ZXN0LCB0KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5leHRlbmQobiwgaS5wcm90b3R5cGUsIHQpLCByLmV4dGVuZChuLCB0KSwgbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBjID0gYShuKDc0KSk7CiAgICAgICAgICAgICAgICBjLkF4aW9zID0gaSwgYy5jcmVhdGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhKHMoYy5kZWZhdWx0cywgZSkpOwogICAgICAgICAgICAgICAgfSwgYy5DYW5jZWwgPSBuKDc4KSwgYy5DYW5jZWxUb2tlbiA9IG4oMTQzKSwgYy5pc0NhbmNlbCA9IG4oNzMpLCBjLmFsbCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UuYWxsKGUpOwogICAgICAgICAgICAgICAgfSwgYy5zcHJlYWQgPSBuKDE0NCksIGUuZXhwb3J0cyA9IGMsIGUuZXhwb3J0cy5kZWZhdWx0ID0gYzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbig3KSwgbyA9IG4oNzIpLCBpID0gbigxMzApLCBzID0gbigxMzEpLCBhID0gbig3Nyk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRlZmF1bHRzID0gZSwgdGhpcy5pbnRlcmNlcHRvcnMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IG5ldyBpKCksCiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlOiBuZXcgaSgpCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLnJlcXVlc3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2YgZSA/IChlID0gYXJndW1lbnRzWzFdIHx8IHt9KS51cmwgPSBhcmd1bWVudHNbMF0gOiBlID0gZSB8fCB7fSwgKGUgPSBhKHRoaXMuZGVmYXVsdHMsIGUpKS5tZXRob2QgPyBlLm1ldGhvZCA9IGUubWV0aG9kLnRvTG93ZXJDYXNlKCkgOiB0aGlzLmRlZmF1bHRzLm1ldGhvZCA/IGUubWV0aG9kID0gdGhpcy5kZWZhdWx0cy5tZXRob2QudG9Mb3dlckNhc2UoKSA6IGUubWV0aG9kID0gJ2dldCc7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgIF0sIG4gPSBQcm9taXNlLnJlc29sdmUoZSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh0aGlzLmludGVyY2VwdG9ycy5yZXF1ZXN0LmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudW5zaGlmdChlLmZ1bGZpbGxlZCwgZS5yZWplY3RlZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzLmludGVyY2VwdG9ycy5yZXNwb25zZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goZS5mdWxmaWxsZWQsIGUucmVqZWN0ZWQpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsgdC5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgICAgICBuID0gbi50aGVuKHQuc2hpZnQoKSwgdC5zaGlmdCgpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgIH0sIGMucHJvdG90eXBlLmdldFVyaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBhKHRoaXMuZGVmYXVsdHMsIGUpLCBvKGUudXJsLCBlLnBhcmFtcywgZS5wYXJhbXNTZXJpYWxpemVyKS5yZXBsYWNlKC9eXD8vLCAnJyk7CiAgICAgICAgICAgICAgICB9LCByLmZvckVhY2goWwogICAgICAgICAgICAgICAgICAgICdkZWxldGUnLAogICAgICAgICAgICAgICAgICAgICdnZXQnLAogICAgICAgICAgICAgICAgICAgICdoZWFkJywKICAgICAgICAgICAgICAgICAgICAnb3B0aW9ucycKICAgICAgICAgICAgICAgIF0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgYy5wcm90b3R5cGVbZV0gPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZXF1ZXN0KHIubWVyZ2UobiB8fCB7fSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB0CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSksIHIuZm9yRWFjaChbCiAgICAgICAgICAgICAgICAgICAgJ3Bvc3QnLAogICAgICAgICAgICAgICAgICAgICdwdXQnLAogICAgICAgICAgICAgICAgICAgICdwYXRjaCcKICAgICAgICAgICAgICAgIF0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgYy5wcm90b3R5cGVbZV0gPSBmdW5jdGlvbiAodCwgbiwgbykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZXF1ZXN0KHIubWVyZ2UobyB8fCB7fSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogbgogICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0pLCBlLmV4cG9ydHMgPSBjOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDcpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gbygpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhhbmRsZXJzID0gW107CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBvLnByb3RvdHlwZS51c2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmhhbmRsZXJzLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICBmdWxmaWxsZWQ6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdGVkOiB0CiAgICAgICAgICAgICAgICAgICAgfSksIHRoaXMuaGFuZGxlcnMubGVuZ3RoIC0gMTsKICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLmVqZWN0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhhbmRsZXJzW2VdICYmICh0aGlzLmhhbmRsZXJzW2VdID0gbnVsbCk7CiAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5mb3JFYWNoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByLmZvckVhY2godGhpcy5oYW5kbGVycywgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gdCAmJiBlKHQpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgZS5leHBvcnRzID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbig3KSwgbyA9IG4oMTMyKSwgaSA9IG4oNzMpLCBzID0gbig3NCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLmNhbmNlbFRva2VuICYmIGUuY2FuY2VsVG9rZW4udGhyb3dJZlJlcXVlc3RlZCgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShlKSwgZS5oZWFkZXJzID0gZS5oZWFkZXJzIHx8IHt9LCBlLmRhdGEgPSBvKGUuZGF0YSwgZS5oZWFkZXJzLCBlLnRyYW5zZm9ybVJlcXVlc3QpLCBlLmhlYWRlcnMgPSByLm1lcmdlKGUuaGVhZGVycy5jb21tb24gfHwge30sIGUuaGVhZGVyc1tlLm1ldGhvZF0gfHwge30sIGUuaGVhZGVycyksIHIuZm9yRWFjaChbCiAgICAgICAgICAgICAgICAgICAgICAgICdkZWxldGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnZ2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ2hlYWQnLAogICAgICAgICAgICAgICAgICAgICAgICAncG9zdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdwdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAncGF0Y2gnLAogICAgICAgICAgICAgICAgICAgICAgICAnY29tbW9uJwogICAgICAgICAgICAgICAgICAgIF0sIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBlLmhlYWRlcnNbdF07CiAgICAgICAgICAgICAgICAgICAgfSksIChlLmFkYXB0ZXIgfHwgcy5hZGFwdGVyKShlKS50aGVuKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhKGUpLCB0LmRhdGEgPSBvKHQuZGF0YSwgdC5oZWFkZXJzLCBlLnRyYW5zZm9ybVJlc3BvbnNlKSwgdDsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSh0KSB8fCAoYShlKSwgdCAmJiB0LnJlc3BvbnNlICYmICh0LnJlc3BvbnNlLmRhdGEgPSBvKHQucmVzcG9uc2UuZGF0YSwgdC5yZXNwb25zZS5oZWFkZXJzLCBlLnRyYW5zZm9ybVJlc3BvbnNlKSkpLCBQcm9taXNlLnJlamVjdCh0KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiByLmZvckVhY2gobiwgZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IG4oZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8gPSBlLmV4cG9ydHMgPSB7fTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdzZXRUaW1lb3V0IGhhcyBub3QgYmVlbiBkZWZpbmVkJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignY2xlYXJUaW1lb3V0IGhhcyBub3QgYmVlbiBkZWZpbmVkJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobiA9PT0gc2V0VGltZW91dCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNldFRpbWVvdXQoZSwgMCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKChuID09PSBpIHx8ICFuKSAmJiBzZXRUaW1lb3V0KQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9IHNldFRpbWVvdXQsIHNldFRpbWVvdXQoZSwgMCk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oZSwgMCk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2FsbChudWxsLCBlLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2FsbCh0aGlzLCBlLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBzZXRUaW1lb3V0ID8gc2V0VGltZW91dCA6IGk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBuID0gaTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgciA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBjbGVhclRpbWVvdXQgPyBjbGVhclRpbWVvdXQgOiBzOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgciA9IHM7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdmFyIGMsIHUgPSBbXSwgcCA9ICExLCBsID0gLTE7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKCkgewogICAgICAgICAgICAgICAgICAgIHAgJiYgYyAmJiAocCA9ICExLCBjLmxlbmd0aCA/IHUgPSBjLmNvbmNhdCh1KSA6IGwgPSAtMSwgdS5sZW5ndGggJiYgZigpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYShkKTsKICAgICAgICAgICAgICAgICAgICAgICAgcCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gdS5sZW5ndGg7IHQ7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSB1LCB1ID0gW107ICsrbCA8IHQ7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgJiYgY1tsXS5ydW4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSAtMSwgdCA9IHUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBudWxsLCBwID0gITEsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociA9PT0gY2xlYXJUaW1lb3V0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjbGVhclRpbWVvdXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHIgPT09IHMgfHwgIXIpICYmIGNsZWFyVGltZW91dCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciA9IGNsZWFyVGltZW91dCwgY2xlYXJUaW1lb3V0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmNhbGwobnVsbCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5jYWxsKHRoaXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfShlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBoKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmZ1biA9IGUsIHRoaXMuYXJyYXkgPSB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdigpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG8ubmV4dFRpY2sgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbmV3IEFycmF5KGFyZ3VtZW50cy5sZW5ndGggLSAxKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA+IDEpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAxOyBuIDwgYXJndW1lbnRzLmxlbmd0aDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtuIC0gMV0gPSBhcmd1bWVudHNbbl07CiAgICAgICAgICAgICAgICAgICAgdS5wdXNoKG5ldyBoKGUsIHQpKSwgMSAhPT0gdS5sZW5ndGggfHwgcCB8fCBhKGYpOwogICAgICAgICAgICAgICAgfSwgaC5wcm90b3R5cGUucnVuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZnVuLmFwcGx5KG51bGwsIHRoaXMuYXJyYXkpOwogICAgICAgICAgICAgICAgfSwgby50aXRsZSA9ICdicm93c2VyJywgby5icm93c2VyID0gITAsIG8uZW52ID0ge30sIG8uYXJndiA9IFtdLCBvLnZlcnNpb24gPSAnJywgby52ZXJzaW9ucyA9IHt9LCBvLm9uID0gdiwgby5hZGRMaXN0ZW5lciA9IHYsIG8ub25jZSA9IHYsIG8ub2ZmID0gdiwgby5yZW1vdmVMaXN0ZW5lciA9IHYsIG8ucmVtb3ZlQWxsTGlzdGVuZXJzID0gdiwgby5lbWl0ID0gdiwgby5wcmVwZW5kTGlzdGVuZXIgPSB2LCBvLnByZXBlbmRPbmNlTGlzdGVuZXIgPSB2LCBvLmxpc3RlbmVycyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtdOwogICAgICAgICAgICAgICAgfSwgby5iaW5kaW5nID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ3Byb2Nlc3MuYmluZGluZyBpcyBub3Qgc3VwcG9ydGVkJyk7CiAgICAgICAgICAgICAgICB9LCBvLmN3ZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJy8nOwogICAgICAgICAgICAgICAgfSwgby5jaGRpciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdwcm9jZXNzLmNoZGlyIGlzIG5vdCBzdXBwb3J0ZWQnKTsKICAgICAgICAgICAgICAgIH0sIG8udW1hc2sgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDcpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByLmZvckVhY2goZSwgZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgciAhPT0gdCAmJiByLnRvVXBwZXJDYXNlKCkgPT09IHQudG9VcHBlckNhc2UoKSAmJiAoZVt0XSA9IG4sIGRlbGV0ZSBlW3JdKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNzYpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG4uY29uZmlnLnZhbGlkYXRlU3RhdHVzOwogICAgICAgICAgICAgICAgICAgICFvIHx8IG8obi5zdGF0dXMpID8gZShuKSA6IHQocignUmVxdWVzdCBmYWlsZWQgd2l0aCBzdGF0dXMgY29kZSAnICsgbi5zdGF0dXMsIG4uY29uZmlnLCBudWxsLCBuLnJlcXVlc3QsIG4pKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbiwgciwgbykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNvbmZpZyA9IHQsIG4gJiYgKGUuY29kZSA9IG4pLCBlLnJlcXVlc3QgPSByLCBlLnJlc3BvbnNlID0gbywgZS5pc0F4aW9zRXJyb3IgPSAhMCwgZS50b0pTT04gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiB0aGlzLm1lc3NhZ2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiB0aGlzLm5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogdGhpcy5kZXNjcmlwdGlvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bWJlcjogdGhpcy5udW1iZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxlTmFtZTogdGhpcy5maWxlTmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVOdW1iZXI6IHRoaXMubGluZU51bWJlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbk51bWJlcjogdGhpcy5jb2x1bW5OdW1iZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFjazogdGhpcy5zdGFjaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZzogdGhpcy5jb25maWcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiB0aGlzLmNvZGUKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMzgpLCBvID0gbigxMzkpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAhcih0KSA/IG8oZSwgdCkgOiB0OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC9eKFthLXpdW2EtelxkXCtcLVwuXSo6KT9cL1wvL2kudGVzdChlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID8gZS5yZXBsYWNlKC9cLyskLywgJycpICsgJy8nICsgdC5yZXBsYWNlKC9eXC8rLywgJycpIDogZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNyksIG8gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICdhZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAnYXV0aG9yaXphdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICdjb250ZW50LWxlbmd0aCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdjb250ZW50LXR5cGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnZXRhZycsCiAgICAgICAgICAgICAgICAgICAgICAgICdleHBpcmVzJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2Zyb20nLAogICAgICAgICAgICAgICAgICAgICAgICAnaG9zdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdpZi1tb2RpZmllZC1zaW5jZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdpZi11bm1vZGlmaWVkLXNpbmNlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xhc3QtbW9kaWZpZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnbG9jYXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAnbWF4LWZvcndhcmRzJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3Byb3h5LWF1dGhvcml6YXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAncmVmZXJlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICdyZXRyeS1hZnRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICd1c2VyLWFnZW50JwogICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBpLCBzID0ge307CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPyAoci5mb3JFYWNoKGUuc3BsaXQoJ1xuJyksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpID0gZS5pbmRleE9mKCc6JyksIHQgPSByLnRyaW0oZS5zdWJzdHIoMCwgaSkpLnRvTG93ZXJDYXNlKCksIG4gPSByLnRyaW0oZS5zdWJzdHIoaSArIDEpKSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNbdF0gJiYgby5pbmRleE9mKHQpID49IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc1t0XSA9ICdzZXQtY29va2llJyA9PT0gdCA/IChzW3RdID8gc1t0XSA6IFtdKS5jb25jYXQoW25dKSA6IHNbdF0gPyBzW3RdICsgJywgJyArIG4gOiBuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSksIHMpIDogczsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByLmlzU3RhbmRhcmRCcm93c2VyRW52KCkgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQgPSAvKG1zaWV8dHJpZGVudCkvaS50ZXN0KG5hdmlnYXRvci51c2VyQWdlbnQpLCBuID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnYScpOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIChuLnNldEF0dHJpYnV0ZSgnaHJlZicsIHIpLCByID0gbi5ocmVmKSwgbi5zZXRBdHRyaWJ1dGUoJ2hyZWYnLCByKSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaHJlZjogbi5ocmVmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvdG9jb2w6IG4ucHJvdG9jb2wgPyBuLnByb3RvY29sLnJlcGxhY2UoLzokLywgJycpIDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBob3N0OiBuLmhvc3QsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWFyY2g6IG4uc2VhcmNoID8gbi5zZWFyY2gucmVwbGFjZSgvXlw/LywgJycpIDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNoOiBuLmhhc2ggPyBuLmhhc2gucmVwbGFjZSgvXiMvLCAnJykgOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhvc3RuYW1lOiBuLmhvc3RuYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9ydDogbi5wb3J0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aG5hbWU6ICcvJyA9PT0gbi5wYXRobmFtZS5jaGFyQXQoMCkgPyBuLnBhdGhuYW1lIDogJy8nICsgbi5wYXRobmFtZQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IG8od2luZG93LmxvY2F0aW9uLmhyZWYpLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHIuaXNTdHJpbmcodCkgPyBvKHQpIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ucHJvdG9jb2wgPT09IGUucHJvdG9jb2wgJiYgbi5ob3N0ID09PSBlLmhvc3Q7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKSA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDcpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gci5pc1N0YW5kYXJkQnJvd3NlckVudigpID8gewogICAgICAgICAgICAgICAgICAgIHdyaXRlOiBmdW5jdGlvbiAoZSwgdCwgbiwgbywgaSwgcykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBhLnB1c2goZSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh0KSksIHIuaXNOdW1iZXIobikgJiYgYS5wdXNoKCdleHBpcmVzPScgKyBuZXcgRGF0ZShuKS50b0dNVFN0cmluZygpKSwgci5pc1N0cmluZyhvKSAmJiBhLnB1c2goJ3BhdGg9JyArIG8pLCByLmlzU3RyaW5nKGkpICYmIGEucHVzaCgnZG9tYWluPScgKyBpKSwgITAgPT09IHMgJiYgYS5wdXNoKCdzZWN1cmUnKSwgZG9jdW1lbnQuY29va2llID0gYS5qb2luKCc7ICcpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcmVhZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBkb2N1bWVudC5jb29raWUubWF0Y2gobmV3IFJlZ0V4cCgnKF58O1xccyopKCcgKyBlICsgJyk9KFteO10qKScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPyBkZWNvZGVVUklDb21wb25lbnQodFszXSkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcmVtb3ZlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLndyaXRlKGUsICcnLCBEYXRlLm5vdygpIC0gODY0MDAwMDApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gOiB7CiAgICAgICAgICAgICAgICAgICAgd3JpdGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHJlYWQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICByZW1vdmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDc4KTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSkgewogICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nICE9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignZXhlY3V0b3IgbXVzdCBiZSBhIGZ1bmN0aW9uLicpOwogICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgIHRoaXMucHJvbWlzZSA9IG5ldyBQcm9taXNlKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBlOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpczsKICAgICAgICAgICAgICAgICAgICBlKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG4ucmVhc29uIHx8IChuLnJlYXNvbiA9IG5ldyByKGUpLCB0KG4ucmVhc29uKSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBvLnByb3RvdHlwZS50aHJvd0lmUmVxdWVzdGVkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnJlYXNvbikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgdGhpcy5yZWFzb247CiAgICAgICAgICAgICAgICB9LCBvLnNvdXJjZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICB0b2tlbjogbmV3IG8oZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgY2FuY2VsOiBlCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIGUuZXhwb3J0cyA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseShudWxsLCB0KTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0IGluIGUgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pIDogZVt0XSA9IG4sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5rZXlzKGUpOwogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAociA9IHIuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLCB0KS5lbnVtZXJhYmxlOwogICAgICAgICAgICAgICAgICAgICAgICB9KSksIG4ucHVzaC5hcHBseShuLCByKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG51bGwgIT0gYXJndW1lbnRzW3RdID8gYXJndW1lbnRzW3RdIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgIHQgJSAyID8gbyhPYmplY3QobiksICEwKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByKGUsIHQsIG5bdF0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSA6IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzID8gT2JqZWN0LmRlZmluZVByb3BlcnRpZXMoZSwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMobikpIDogbyhPYmplY3QobikpLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKG4sIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgbi5yKHQpLCBuLmQodCwgJ3FjQ21wQXBpJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBFdDsKICAgICAgICAgICAgICAgIH0pLCBuLmQodCwgJ3VzcEFwaScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gU3Q7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciBzID0gbigwKSwgYSA9IG4ubihzKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSwgdCwgbiwgciwgbywgaSwgcykgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZVtpXShzKSwgYyA9IGEudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBuKHUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBhLmRvbmUgPyB0KGMpIDogUHJvbWlzZS5yZXNvbHZlKGMpLnRoZW4ociwgbyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMsIG4gPSBhcmd1bWVudHM7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiAociwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLmFwcGx5KHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhpLCByLCBvLCBzLCBhLCAnbmV4dCcsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhpLCByLCBvLCBzLCBhLCAndGhyb3cnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHModm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQ2Fubm90IGNhbGwgYSBjbGFzcyBhcyBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMDsgbiA8IHQubGVuZ3RoOyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0W25dOwogICAgICAgICAgICAgICAgICAgICAgICByLmVudW1lcmFibGUgPSByLmVudW1lcmFibGUgfHwgITEsIHIuY29uZmlndXJhYmxlID0gITAsICd2YWx1ZScgaW4gciAmJiAoci53cml0YWJsZSA9ICEwKSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHIua2V5LCByKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiBsKGUucHJvdG90eXBlLCB0KSwgbiAmJiBsKGUsIG4pLCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGYsIGgsIHYsIHksIGcgPSBuKDg2KTsKICAgICAgICAgICAgICAgIG4oNjYpLCBuKDY3KSwgbig2OCk7CiAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlW2UuVE9QX0xFRlQgPSAxXSA9ICdUT1BfTEVGVCcsIGVbZS5UT1BfUklHSFQgPSAyXSA9ICdUT1BfUklHSFQnLCBlW2UuQk9UVE9NX1JJR0hUID0gM10gPSAnQk9UVE9NX1JJR0hUJywgZVtlLkJPVFRPTV9MRUZUID0gNF0gPSAnQk9UVE9NX0xFRlQnOwogICAgICAgICAgICAgICAgfShmIHx8IChmID0ge30pKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLllFUyA9ICdZJywgZS5OT1QgPSAnTic7CiAgICAgICAgICAgICAgICB9KGggfHwgKGggPSB7fSkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuU0VSVklDRSA9ICdzZXJ2aWNlJywgZS5TRVJWSUNFX0dST1VQID0gJ3NlcnZpY2UgZ3JvdXAnOwogICAgICAgICAgICAgICAgfSh2IHx8ICh2ID0ge30pKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLkdEUFIgPSAnR0RQUicsIGUuVVNQID0gJ1VTUCc7CiAgICAgICAgICAgICAgICB9KHkgfHwgKHkgPSB7fSkpOwogICAgICAgICAgICAgICAgdmFyIG0sIGIsIEMsIF8sIEUsIFMsIEksIFAsIEwsIHcsIEEsIE8gPSB7IGhhc0Nvb2tpZTogITEgfSwgayA9IGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHAodGhpcywgZSksIHRoaXMudmVuZG9yQ29uc2VudHMgPSBpKHt9LCBPKSwgdGhpcy5wdXJwb3Nlc0NvbnNlbnRzID0gaSh7fSwgTyksIHRoaXMuc3BlY2lhbEZlYXR1cmVzID0gaSh7fSwgTyksIHRoaXMudmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0ID0gaSh7fSwgTyksIHRoaXMubGVnaXRpbWF0ZVB1cnBvc2VzQ29uc2VudHMgPSBpKHt9LCBPKSwgdGhpcy5ub25JYWJDb25zZW50cyA9IGkoe30sIE8pLCB0aGlzLmdvb2dsZUNvbnNlbnRzID0gaSh7fSwgTyksIHRoaXMuY29uc2VudFNjcmVlbiA9IDAsIHRoaXMuYWxsQ29uc2VudHMgPSAhMTsKICAgICAgICAgICAgICAgICAgICB9LCBUID0gKG4oNjkpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHVzcFZlcnNpb246IDEsCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcEp1cmlzZGljdGlvbjogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcExzcGFjdDogaC5OT1QsCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcFByaXZhY3lQb2xpY3lMaW5rOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgdXNwRGVsZXRlRGF0YUxpbms6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICB1c3BBY2Nlc3NEYXRhTGluazogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZURvbWFpbjogd2luZG93LmxvY2F0aW9uLmhvc3RuYW1lLAogICAgICAgICAgICAgICAgICAgICAgICBzdXBwcmVzc0NjcGFMaW5rczogITAKICAgICAgICAgICAgICAgICAgICB9KSwgViA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFRvZ2dsZVZhbHVlOiAnb2ZmJywKICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheVVpOiAnYWx3YXlzJywKICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheVBlcnNpc3RlbnRDb25zZW50TGluazogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGhhc2hDb2RlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZ3JvdXBTaXRlc1VybDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5SZWplY3RCdXR0b25TaG93aW5nOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNjcmVlbkNsb3NlQnV0dG9uU2hvd2luZzogITEsCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5Cb2R5VGV4dE9wdGlvbjogMSwKICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ186ICdlbicsCiAgICAgICAgICAgICAgICAgICAgICAgIG5vbmNvbnNlbnREaXNwbGF5RnJlcXVlbmN5OiAxLAogICAgICAgICAgICAgICAgICAgICAgICBwZXJzaXN0ZW50Q29uc2VudExpbmtMb2NhdGlvbjogZi5CT1RUT01fUklHSFQsCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlckxvZ286ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJOYW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2tzOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyRmVhdHVyZXNJZHM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJTcGVjaWFsRmVhdHVyZXNJZHM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJTcGVjaWFsUHVycG9zZXNJZHM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJQdXJwb3NlSWRzOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlclZlbmRvckxpc3RVcmw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJDb3VudHJ5Q29kZTogJ0dCJywKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yUHVycG9zZUlkczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JTcGVjaWFsRmVhdHVyZXNJZHM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvclNwZWNpYWxQdXJwb3Nlc0lkczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yRmVhdHVyZXNJZHM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICByZWplY3RDb25zZW50UmVkaXJlY3RVcmw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBzb2Z0T3B0SW5FbmFibGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgdWlMYXlvdXQ6ICdwb3B1cCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckxpc3RVcGRhdGVGcmVxOiAzMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudFNjb3BlR3JvdXBVUkw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBncm91cE9mV2Vic2l0ZXNVUkw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBjb29raWVEb21haW46IHdpbmRvdy5sb2NhdGlvbi5ob3N0bmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgY29va2llUGF0aDogJy8nLAogICAgICAgICAgICAgICAgICAgICAgICB0aGlyZFBhcnR5U3RvcmFnZVR5cGU6ICdpZnJhbWUnLAogICAgICAgICAgICAgICAgICAgICAgICBzaG93U3VtbWFyeVZpZXc6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBnb29nbGVFbmFibGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudE9uU2FmYXJpOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgaXNBTVA6ICExLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJDb25zZW50UmVzdHJpY3Rpb25JZHM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJMSVJlc3RyaWN0aW9uSWRzOiBbXQogICAgICAgICAgICAgICAgICAgIH0sIHggPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5DdXN0b21MaW5rczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtzVGl0bGU6ICdBZGRpdGlvbmFsIExpbmtzJywKICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yc0xhYmVsOiAnTm9uLUlBQiBWZW5kb3JzJwogICAgICAgICAgICAgICAgICAgIH0sIFIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHVzcERuc1RpdGxlOiAnRG8gTm90IFNlbGwgTXkgUGVyc29uYWwgSW5mb3JtYXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICB1c3BEbnNUZXh0OiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnPHA+V2hlbiB5b3UgdmlzaXQgdGhpcyB3ZWJzaXRlLCB3ZSBjb2xsZWN0IHBlcnNvbmFsIGluZm9ybWF0aW9uIHN1Y2ggYXMgSVAgYWRkcmVzc2VzLCBjb29raWUgaWRlbnRpZmllcnMgYW5kIG90aGVyIHBzZXVkb255bW91cyBpZGVudGlmaWVycy4gVGhpcyBpbmZvcm1hdGlvbiBtYXkgYmUgdXNlZCB0byBwZXJzb25hbGl6ZSBjb250ZW50IGJhc2VkIG9uIHlvdXIgaW50ZXJlc3RzLCBydW4gYW5kIG9wdGltaXplIGFkdmVydGlzaW5nIGNhbXBhaWducyB0YWlsb3JlZCB0byB5b3UsIG1lYXN1cmUgdGhlIHBlcmZvcm1hbmNlIG9mIGFkcyBhbmQgY29udGVudCwgYW5kIGRlcml2ZSBpbnNpZ2h0cyBhYm91dCB0aGUgYXVkaWVuY2VzIHdobyBlbmdhZ2Ugd2l0aCBhZHMgYW5kIGNvbnRlbnQuIFRoaXMgaW5mb3JtYXRpb24gbWF5IGFsc28gYmUgZGlzY2xvc2VkIGJ5IHVzIHRvIHRoaXJkIHBhcnRpZXMgb24gdGhlIDxhIGhyZWY9Imh0dHBzOi8vd3d3LmlhYnByaXZhY3kuY29tL29wdG91dC5odG1sIj5JQUJcdTIwMTlzIExpc3Qgb2YgRG93bnN0cmVhbSBQYXJ0aWNpcGFudHM8L2E+IHRoYXQgbWF5IGZ1cnRoZXIgZGlzY2xvc2UgaXQgdG8gb3RoZXIgdGhpcmQgcGFydGllcy4gVXNpbmcgcGVyc29uYWwgaW5mb3JtYXRpb24gYXMgZGVzY3JpYmVkIGFib3ZlIGlzIGFuIGludGVncmFsIHBhcnQgb2YgaG93IHdlIG9wZXJhdGUgb3VyIHdlYnNpdGUsIG1ha2UgcmV2ZW51ZSB0byBzdXBwb3J0IG91ciBzdGFmZiwgYW5kIGdlbmVyYXRlIHJlbGV2YW50IGNvbnRlbnQgZm9yIG91ciBhdWRpZW5jZS4gWW91IGNhbiBsZWFybiBtb3JlIGFib3V0IG91ciBkYXRhIGNvbGxlY3Rpb24gYW5kIHVzZSBwcmFjdGljZXMgaW4gb3VyIFByaXZhY3kgUG9saWN5LjwvcD4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJzxwPklmIHlvdSB3aXNoIHRvIG9wdCBvdXQgb2YgdGhlIGRpc2Nsb3N1cmUgb2YgeW91ciBwZXJzb25hbCBpbmZvcm1hdGlvbiB0byB0aGlyZCBwYXJ0aWVzIGJ5IHVzLCBwbGVhc2UgdXNlIHRoZSBiZWxvdyBvcHQgb3V0IGFuZCBjb25maXJtIHlvdXIgc2VsZWN0aW9uLiBQbGVhc2Ugbm90ZSB0aGF0IGFmdGVyIHlvdXIgb3B0IG91dCByZXF1ZXN0IGlzIHByb2Nlc3NlZCwgeW91IG1heSBjb250aW51ZSBzZWVpbmcgaW50ZXJlc3QtYmFzZWQgYWRzIGJhc2VkIG9uIHBlcnNvbmFsIEluZm9ybWF0aW9uIHV0aWxpemVkIGJ5IHVzIG9yIHBlcnNvbmFsIGluZm9ybWF0aW9uIGRpc2Nsb3NlZCB0byB0aGlyZCBwYXJ0aWVzIHByaW9yIHRvIHlvdXIgb3B0IG91dC4gWW91IG1heSBzZXBhcmF0ZWx5IG9wdCBvdXQgb2YgdGhlIGZ1cnRoZXIgZGlzY2xvc3VyZSBvZiB5b3VyIHBlcnNvbmFsIGluZm9ybWF0aW9uIGJ5IHRoaXJkIHBhcnRpZXMgb24gdGhlIDxhIGhyZWY9Imh0dHBzOi8vd3d3LmlhYnByaXZhY3kuY29tL29wdG91dC5odG1sIj5JQUJcdTIwMTlzIExpc3Qgb2YgRG93bnN0cmVhbSBQYXJ0aWNpcGFudHM8L2E+LjwvcD4nCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcERvTm90U2VsbFRvZ2dsZVRleHQ6ICdJIHdhbnQgdG8gbWFrZSBhICJEbyBOb3QgU2VsbCBNeSBQZXJzb25hbCBJbmZvcm1hdGlvbiIgcmVxdWVzdC4gTm90ZTogdGhpcyBhY3Rpb24gd2lsbCBtYWtlIGl0IGhhcmRlciB0byB1cyB0byB0YWlsb3IgY29udGVudCBmb3IgeW91LicsCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcFByaXZhY3lQb2xpY3lMaW5rVGV4dDogJ1ByaXZhY3kgUG9saWN5JywKICAgICAgICAgICAgICAgICAgICAgICAgdXNwRGVsZXRlRGF0YUxpbmtUZXh0OiAnRGF0YSBEZWxldGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcEFjY2Vzc0RhdGFMaW5rVGV4dDogJ0RhdGEgQWNjZXNzJywKICAgICAgICAgICAgICAgICAgICAgICAgdXNwQWNjZXB0QnV0dG9uOiAnQ09ORklSTScKICAgICAgICAgICAgICAgICAgICB9LCBVID0gewogICAgICAgICAgICAgICAgICAgICAgICBpbml0U2NyZWVuVGl0bGU6ICdXZSB2YWx1ZSB5b3VyIHByaXZhY3knLAogICAgICAgICAgICAgICAgICAgICAgICBhZ3JlZUJ1dHRvbjogJ0FHUkVFJywKICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNjcmVlblJlamVjdEJ1dHRvbjogJ0RJU0FHUkVFJywKICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNjcmVlblNldHRpbmdzQnV0dG9uOiAnTU9SRSBPUFRJT05TJywKICAgICAgICAgICAgICAgICAgICAgICAgc3VtbWFyeVNjcmVlbkJvZHlOb1JlamVjdFNlcnZpY2U6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdXZSBhbmQgb3VyIHBhcnRuZXJzIHN0b3JlIGFuZC9vciBhY2Nlc3MgaW5mb3JtYXRpb24gb24gYSBkZXZpY2UsIHN1Y2ggYXMgY29va2llcyBhbmQgcHJvY2VzcyBwZXJzb25hbCBkYXRhLCBzdWNoIGFzIHVuaXF1ZSBpZGVudGlmaWVycyBhbmQgc3RhbmRhcmQgaW5mb3JtYXRpb24gc2VudCBieSBhIGRldmljZSBmb3IgcGVyc29uYWxpc2VkIGFkcyBhbmQgY29udGVudCwgYWQgYW5kIGNvbnRlbnQgbWVhc3VyZW1lbnQsIGFuZCBhdWRpZW5jZSBpbnNpZ2h0cywgYXMgd2VsbCBhcyB0byBkZXZlbG9wIGFuZCBpbXByb3ZlIHByb2R1Y3RzLicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnIFdpdGggeW91ciBwZXJtaXNzaW9uIHdlIGFuZCBvdXIgcGFydG5lcnMgbWF5IHVzZSBwcmVjaXNlIGdlb2xvY2F0aW9uIGRhdGEgYW5kIGlkZW50aWZpY2F0aW9uIHRocm91Z2ggZGV2aWNlIHNjYW5uaW5nLiBZb3UgbWF5IGNsaWNrIHRvIGNvbnNlbnQgdG8gb3VyIGFuZCBvdXIgcGFydG5lcnNcdTIwMTkgcHJvY2Vzc2luZyBhcyBkZXNjcmliZWQgYWJvdmUuIEFsdGVybmF0aXZlbHkgeW91IG1heSBhY2Nlc3MgbW9yZSBkZXRhaWxlZCBpbmZvcm1hdGlvbiBhbmQgY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYmVmb3JlIGNvbnNlbnRpbmcgb3IgdG8gcmVmdXNlIGNvbnNlbnRpbmcuIFBsZWFzZSBub3RlIHRoYXQgc29tZSBwcm9jZXNzaW5nIG9mIHlvdXIgcGVyc29uYWwgZGF0YSBtYXkgbm90IHJlcXVpcmUgeW91ciBjb25zZW50LCBidXQgeW91IGhhdmUgYSByaWdodCB0byBvYmplY3QgdG8gc3VjaCBwcm9jZXNzaW5nLiBZb3VyIHByZWZlcmVuY2VzIHdpbGwgYXBwbHkgdG8gdGhpcyB3ZWJzaXRlIG9ubHkuIFlvdSBjYW4gY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYXQgYW55IHRpbWUgYnkgcmV0dXJuaW5nIHRvIHRoaXMgc2l0ZSBvciB2aXNpdCBvdXIgcHJpdmFjeSBwb2xpY3kuXG4nCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5Tm9SZWplY3RHcm91cDogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1dlIGFuZCBvdXIgcGFydG5lcnMgc3RvcmUgYW5kL29yIGFjY2VzcyBpbmZvcm1hdGlvbiBvbiBhIGRldmljZSwgc3VjaCBhcyBjb29raWVzIGFuZCBwcm9jZXNzIHBlcnNvbmFsIGRhdGEsIHN1Y2ggYXMgdW5pcXVlIGlkZW50aWZpZXJzIGFuZCBzdGFuZGFyZCBpbmZvcm1hdGlvbiBzZW50IGJ5IGEgZGV2aWNlIGZvciBwZXJzb25hbGlzZWQgYWRzIGFuZCBjb250ZW50LCBhZCBhbmQgY29udGVudCBtZWFzdXJlbWVudCwgYW5kIGF1ZGllbmNlIGluc2lnaHRzLCBhcyB3ZWxsIGFzIHRvIGRldmVsb3AgYW5kIGltcHJvdmUgcHJvZHVjdHMuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcgV2l0aCB5b3VyIHBlcm1pc3Npb24gd2UgYW5kIG91ciBwYXJ0bmVycyBtYXkgdXNlIHByZWNpc2UgZ2VvbG9jYXRpb24gZGF0YSBhbmQgaWRlbnRpZmljYXRpb24gdGhyb3VnaCBkZXZpY2Ugc2Nhbm5pbmcuIFlvdSBtYXkgY2xpY2sgdG8gY29uc2VudCB0byBvdXIgYW5kIG91ciBwYXJ0bmVyc1x1MjAxOSBwcm9jZXNzaW5nIGFzIGRlc2NyaWJlZCBhYm92ZS4gQWx0ZXJuYXRpdmVseSB5b3UgbWF5IGFjY2VzcyBtb3JlIGRldGFpbGVkIGluZm9ybWF0aW9uIGFuZCBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBiZWZvcmUgY29uc2VudGluZyBvciB0byByZWZ1c2UgY29uc2VudGluZy4gUGxlYXNlIG5vdGUgdGhhdCBzb21lIHByb2Nlc3Npbmcgb2YgeW91ciBwZXJzb25hbCBkYXRhIG1heSBub3QgcmVxdWlyZSB5b3VyIGNvbnNlbnQsIGJ1dCB5b3UgaGF2ZSBhIHJpZ2h0IHRvIG9iamVjdCB0byBzdWNoIHByb2Nlc3NpbmcuIFlvdXIgcHJlZmVyZW5jZXMgd2lsbCBhcHBseSB0byBhIGdyb3VwIG9mIHdlYnNpdGVzIFtoeXBlcmxpbmtlZCB0byBkb21haW4gd2hlcmUgYWxsIHRoZSBwcm9wZXJ0aWVzIGFyZSBsaXN0ZWQgZm9yIHRoaXMgZ3JvdXAgY29uZmlndXJhdGlvbl0uWW91IGNhbiBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBhdCBhbnkgdGltZSBieSByZXR1cm5pbmcgdG8gdGhpcyBzaXRlIG9yIHZpc2l0IG91ciBwcml2YWN5IHBvbGljeS4nCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5UmVqZWN0U2VydmljZTogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1dlIGFuZCBvdXIgcGFydG5lcnMgc3RvcmUgYW5kL29yIGFjY2VzcyBpbmZvcm1hdGlvbiBvbiBhIGRldmljZSwgc3VjaCBhcyBjb29raWVzIGFuZCBwcm9jZXNzIHBlcnNvbmFsIGRhdGEsIHN1Y2ggYXMgdW5pcXVlIGlkZW50aWZpZXJzIGFuZCBzdGFuZGFyZCBpbmZvcm1hdGlvbiBzZW50IGJ5IGEgZGV2aWNlIGZvciBwZXJzb25hbGlzZWQgYWRzIGFuZCBjb250ZW50LCBhZCBhbmQgY29udGVudCBtZWFzdXJlbWVudCwgYW5kIGF1ZGllbmNlIGluc2lnaHRzLCBhcyB3ZWxsIGFzIHRvIGRldmVsb3AgYW5kIGltcHJvdmUgcHJvZHVjdHMuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcgV2l0aCB5b3VyIHBlcm1pc3Npb24gd2UgYW5kIG91ciBwYXJ0bmVycyBtYXkgdXNlIHByZWNpc2UgZ2VvbG9jYXRpb24gZGF0YSBhbmQgaWRlbnRpZmljYXRpb24gdGhyb3VnaCBkZXZpY2Ugc2Nhbm5pbmcuIFlvdSBtYXkgY2xpY2sgdG8gY29uc2VudCB0byBvdXIgYW5kIG91ciBwYXJ0bmVyc1x1MjAxOSBwcm9jZXNzaW5nIGFzIGRlc2NyaWJlZCBhYm92ZS4gQWx0ZXJuYXRpdmVseSB5b3UgbWF5IGNsaWNrIHRvIHJlZnVzZSB0byBjb25zZW50IG9yIGFjY2VzcyBtb3JlIGRldGFpbGVkIGluZm9ybWF0aW9uIGFuZCBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBiZWZvcmUgY29uc2VudGluZy4gUGxlYXNlIG5vdGUgdGhhdCBzb21lIHByb2Nlc3Npbmcgb2YgeW91ciBwZXJzb25hbCBkYXRhIG1heSBub3QgcmVxdWlyZSB5b3VyIGNvbnNlbnQsIGJ1dCB5b3UgaGF2ZSBhIHJpZ2h0IHRvIG9iamVjdCB0byBzdWNoIHByb2Nlc3NpbmcuIFlvdXIgcHJlZmVyZW5jZXMgd2lsbCBhcHBseSB0byB0aGlzIHdlYnNpdGUgb25seS4gWW91IGNhbiBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBhdCBhbnkgdGltZSBieSByZXR1cm5pbmcgdG8gdGhpcyBzaXRlIG9yIHZpc2l0IG91ciBwcml2YWN5IHBvbGljeS4nCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5UmVqZWN0R3JvdXA6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdXZSBhbmQgb3VyIHBhcnRuZXJzIHN0b3JlIGFuZC9vciBhY2Nlc3MgaW5mb3JtYXRpb24gb24gYSBkZXZpY2UsIHN1Y2ggYXMgY29va2llcyBhbmQgcHJvY2VzcyBwZXJzb25hbCBkYXRhLCBzdWNoIGFzIHVuaXF1ZSBpZGVudGlmaWVycyBhbmQgc3RhbmRhcmQgaW5mb3JtYXRpb24gc2VudCBieSBhIGRldmljZSBmb3IgcGVyc29uYWxpc2VkIGFkcyBhbmQgY29udGVudCwgYWQgYW5kIGNvbnRlbnQgbWVhc3VyZW1lbnQsIGFuZCBhdWRpZW5jZSBpbnNpZ2h0cywgYXMgd2VsbCBhcyB0byBkZXZlbG9wIGFuZCBpbXByb3ZlIHByb2R1Y3RzLicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnIFdpdGggeW91ciBwZXJtaXNzaW9uIHdlIGFuZCBvdXIgcGFydG5lcnMgbWF5IHVzZSBwcmVjaXNlIGdlb2xvY2F0aW9uIGRhdGEgYW5kIGlkZW50aWZpY2F0aW9uIHRocm91Z2ggZGV2aWNlIHNjYW5uaW5nLiBZb3UgbWF5IGNsaWNrIHRvIGNvbnNlbnQgdG8gb3VyIGFuZCBvdXIgcGFydG5lcnNcdTIwMTkgcHJvY2Vzc2luZyBhcyBkZXNjcmliZWQgYWJvdmUuIEFsdGVybmF0aXZlbHkgeW91IG1heSBjbGljayB0byByZWZ1c2UgdG8gY29uc2VudCBvciBhY2Nlc3MgbW9yZSBkZXRhaWxlZCBpbmZvcm1hdGlvbiBhbmQgY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYmVmb3JlIGNvbnNlbnRpbmcuIFBsZWFzZSBub3RlIHRoYXQgc29tZSBwcm9jZXNzaW5nIG9mIHlvdXIgcGVyc29uYWwgZGF0YSBtYXkgbm90IHJlcXVpcmUgeW91ciBjb25zZW50LCBidXQgeW91IGhhdmUgYSByaWdodCB0byBvYmplY3QgdG8gc3VjaCBwcm9jZXNzaW5nLiBZb3VyIHByZWZlcmVuY2VzIHdpbGwgYXBwbHkgdG8gYSBncm91cCBvZiB3ZWJzaXRlcyBbbGlua3MgdG8gZG9tYWluIHdoZXJlIGFsbCB0aGUgcHJvcGVydGllcyBhcmUgbGlzdGVkIGZvciB0aGlzIGdyb3VwIGNvbmZpZ3VyYXRpb25dLiBZb3UgY2FuIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGF0IGFueSB0aW1lIGJ5IHJldHVybmluZyB0byB0aGlzIHNpdGUgb3IgdmlzaXQgb3VyIHByaXZhY3kgcG9saWN5LicKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNjcmVlbkJvZHlTZXJ2aWNlOiAnV2UgYW5kIG91ciBwYXJ0bmVycyBzdG9yZSBvciBhY2Nlc3MgaW5mb3JtYXRpb24gb24gZGV2aWNlcywgc3VjaCBhcyBjb29raWVzIGFuZCBwcm9jZXNzIHBlcnNvbmFsIGRhdGEsIHN1Y2ggYXMgdW5pcXVlIGlkZW50aWZpZXJzIGFuZCBzdGFuZGFyZCBpbmZvcm1hdGlvbiBzZW50IGJ5IGEgZGV2aWNlIGZvciB0aGUgcHVycG9zZXMgZGVzY3JpYmVkIGJlbG93LiBZb3UgbWF5IGNsaWNrIHRvIGNvbnNlbnQgdG8gb3VyIGFuZCBvdXIgcGFydG5lcnNcdTIwMTkgcHJvY2Vzc2luZyBmb3Igc3VjaCBwdXJwb3Nlcy4gQWx0ZXJuYXRpdmVseSwgeW91IG1heSBjbGljayB0byByZWZ1c2UgdG8gY29uc2VudCwgb3IgYWNjZXNzIG1vcmUgZGV0YWlsZWQgaW5mb3JtYXRpb24gYW5kIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGJlZm9yZSBjb25zZW50aW5nLiBZb3VyIHByZWZlcmVuY2VzIHdpbGwgYXBwbHkgdG8gdGhpcyB3ZWJzaXRlIG9ubHkuIFBsZWFzZSBub3RlIHRoYXQgc29tZSBwcm9jZXNzaW5nIG9mIHlvdXIgcGVyc29uYWwgZGF0YSBtYXkgbm90IHJlcXVpcmUgeW91ciBjb25zZW50LCBidXQgeW91IGhhdmUgYSByaWdodCB0byBvYmplY3QgdG8gc3VjaCBwcm9jZXNzaW5nLiBZb3UgY2FuIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGF0IGFueSB0aW1lIGJ5IHJldHVybmluZyB0byB0aGlzIHNpdGUgb3IgdmlzaXQgb3VyIHByaXZhY3kgcG9saWN5LicsCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5Cb2R5R3JvdXA6ICdXZSBhbmQgb3VyIHBhcnRuZXJzIHN0b3JlIG9yIGFjY2VzcyBpbmZvcm1hdGlvbiBvbiBkZXZpY2VzLCBzdWNoIGFzIGNvb2tpZXMgYW5kIHByb2Nlc3MgcGVyc29uYWwgZGF0YSwgc3VjaCBhcyB1bmlxdWUgaWRlbnRpZmllcnMgYW5kIHN0YW5kYXJkIGluZm9ybWF0aW9uIHNlbnQgYnkgYSBkZXZpY2UgZm9yIHRoZSBwdXJwb3NlcyBkZXNjcmliZWQgYmVsb3cuIFlvdSBtYXkgY2xpY2sgdG8gY29uc2VudCB0byBvdXIgYW5kIG91ciBwYXJ0bmVyc1x1MjAxOSBwcm9jZXNzaW5nIGZvciBzdWNoIHB1cnBvc2VzLiBBbHRlcm5hdGl2ZWx5LCB5b3UgbWF5IGNsaWNrIHRvIHJlZnVzZSB0byBjb25zZW50LCBvciBhY2Nlc3MgbW9yZSBkZXRhaWxlZCBpbmZvcm1hdGlvbiBhbmQgY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYmVmb3JlIGNvbnNlbnRpbmcuIFlvdXIgcHJlZmVyZW5jZXMgd2lsbCBhcHBseSB0byBhIGdyb3VwIG9mIHdlYnNpdGVzIFtsaW5rcyB0byBkb21haW4gd2hlcmUgYWxsIHRoZSBwcm9wZXJ0aWVzIGFyZSBsaXN0ZWQgZm9yIHRoaXMgZ3JvdXAgY29uZmlndXJhdGlvbl0uIFBsZWFzZSBub3RlIHRoYXQgc29tZSBwcm9jZXNzaW5nIG9mIHlvdXIgcGVyc29uYWwgZGF0YSBtYXkgbm90IHJlcXVpcmUgeW91ciBjb25zZW50LCBidXQgeW91IGhhdmUgYSByaWdodCB0byBvYmplY3QgdG8gc3VjaCBwcm9jZXNzaW5nLiBZb3UgY2FuIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGF0IGFueSB0aW1lIGJ5IHJldHVybmluZyB0byB0aGlzIHNpdGUgb3IgdmlzaXQgb3VyIHByaXZhY3kgcG9saWN5LicsCiAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxQdXJwb3Nlc0FuZEZlYXR1cmVzOiAnU3BlY2lhbCBQdXJwb3NlcyBhbmQgRmVhdHVyZXMnLAogICAgICAgICAgICAgICAgICAgICAgICBzYXZlQW5kRXhpdEJ1dHRvbjogJ1NBVkUgJiBFWElUJywKICAgICAgICAgICAgICAgICAgICAgICAgcHVycG9zZVNjcmVlblZlbmRvckxpbms6ICdQQVJUTkVSUycsCiAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2l0aW1hdGVJbnRlcmVzdExpbms6ICdMRUdJVElNQVRFIElOVEVSRVNUICcsCiAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxQdXJwb3Nlc0xhYmVsOiAnU3BlY2lhbCBQdXJwb3NlcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxGZWF0dXJlc0xhYmVsOiAnU3BlY2lhbCBGZWF0dXJlcycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZlYXR1cmVzTGFiZWw6ICdGZWF0dXJlcycsCiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2s6ICdCYWNrJywKICAgICAgICAgICAgICAgICAgICAgICAgb25MYWJlbDogJ09OJywKICAgICAgICAgICAgICAgICAgICAgICAgb2ZmTGFiZWw6ICdPRkYnLAogICAgICAgICAgICAgICAgICAgICAgICBtdWx0aUxhYmVsOiAnTVVMVEknLAogICAgICAgICAgICAgICAgICAgICAgICBsZWdhbERlc2NyaXB0aW9uOiAnTGVnYWwgRGVzY3JpcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICBzaG93UGFydG5lcnM6ICdTaG93IFBhcnRuZXJzJywKICAgICAgICAgICAgICAgICAgICAgICAgaGlkZVBhcnRuZXJzOiAnSGlkZSBQYXJ0bmVycycsCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvclNjcmVlbkJvZHk6ICdSZXZpZXcgYW5kIHNldCB5b3VyIGNvbnNlbnQgcHJlZmVyZW5jZXMgZm9yIGVhY2ggcGFydG5lciBiZWxvdy4gRXhwYW5kIGVhY2ggcGFydG5lciBsaXN0IGl0ZW0gZm9yIG1vcmUgaW5mb3JtYXRpb24gdG8gaGVscCBtYWtlIHlvdXIgY2hvaWNlLiBTb21lIHBlcnNvbmFsIGRhdGEgaXMgcHJvY2Vzc2VkIHdpdGhvdXQgeW91ciBjb25zZW50LCBidXQgeW91IGhhdmUgdGhlIHJpZ2h0IHRvIG9iamVjdC4nLAogICAgICAgICAgICAgICAgICAgICAgICBwcml2YWN5UG9saWN5TGFiZWw6ICdQcml2YWN5IFBvbGljeScsCiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uTGFiZWw6ICdWZW5kb3IgRGVzY3JpcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlU2NyZWVuQm9keTogJ1JldmlldyBhbmQgb2JqZWN0IHRvIHByb2Nlc3Npbmcgb2YgcGVyc29uYWwgZGF0YSB3aXRob3V0IHlvdXIgY29uc2VudCBvbiB0aGUgYmFzaXMgb2YgYSBsZWdpdGltYXRlIGludGVyZXN0IGZvciBlYWNoIHB1cnBvc2UgYW5kIGJ5IGVhY2ggcGFydG5lciBiZWxvdy4gRXhwYW5kIGVhY2ggcHVycG9zZSBvciBwYXJ0bmVyIGxpc3QgaXRlbSBmb3IgbW9yZSBpbmZvcm1hdGlvbiB0byBoZWxwIG1ha2UgeW91ciBjaG9pY2UuIFRvIG9iamVjdCB0byB0aGUgc3BlY2lhbCBwdXJwb3NlcyBvZiBlbnN1cmluZyBzZWN1cml0eSwgcHJldmVudGluZyBmcmF1ZCwgYW5kIGRlYnVnZ2luZywgYW5kIHRlY2huaWNhbGx5IGRlbGl2ZXJpbmcgYWRzIG9yIGNvbnRlbnQgY2xpY2sgb24gYSBwYXJ0bmVyXCdzIHByaXZhY3kgcG9saWN5IGxpbmsuJywKICAgICAgICAgICAgICAgICAgICAgICAgbGVnaXRpbWF0ZUludGVyZXN0UHVycG9zZXNMYWJlbDogJ0xlZ2l0aW1hdGUgSW50ZXJlc3QgUHVycG9zZShzKScsCiAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2l0aW1hdGVJbnRlcmVzdFZlbmRvckxhYmVsOiAnTGVnaXRpbWF0ZSBJbnRlcmVzdCBWZW5kb3JzJywKICAgICAgICAgICAgICAgICAgICAgICAgbGVnaXRpbWF0ZVNjcmVlbk9iamVjdDogJ09CSkVDVCAodHJhbnNsYXRpb24gaGludDogdmVyYiB0byBvYmplY3QpJywKICAgICAgICAgICAgICAgICAgICAgICAgbGVnaXRpbWF0ZVNjcmVlbk9iamVjdGVkOiAnT0JKRUNURUQnLAogICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlU2NyZWVuQWNjZXB0OiAnUkVNT1ZFIE9CSkVDVElPTicsCiAgICAgICAgICAgICAgICAgICAgICAgIG9iamVjdEFsbEJ1dHRvbjogJ09CSkVDVCBBTEwnLAogICAgICAgICAgICAgICAgICAgICAgICBwZXJzaXN0ZW50Q29uc2VudExpbmtMYWJlbDogJ1ByaXZhY3knLAogICAgICAgICAgICAgICAgICAgICAgICBub25JYWJWZW5kb3JzTm90aWNlOiAnVmVuZG9ycyB3aG8gZG8gbm90IHBhcnRpY2lwYXRlIGluIHRoZSBJQUIgRXVyb3BlIFRyYW5zcGFyZW5jeSBhbmQgQ29uc2VudCBGcmFtZXdvcmsgYW5kIGRvIG5vdCBhZGhlcmUgdG8gaXRzIHBvbGljaWVzIG9yIHRlY2huaWNhbCBzcGVjaWZpY2F0aW9ucycsCiAgICAgICAgICAgICAgICAgICAgICAgIGdvb2dsZVBhcnRuZXJzOiAnR29vZ2xlIFBhcnRuZXJzJywKICAgICAgICAgICAgICAgICAgICAgICAgY29va2llTWF4QWdlTGFiZWw6ICdNYXggY29va2llIGFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgIHNlY29uZHNMYWJlbDogJ3NlY29uZHMnLAogICAgICAgICAgICAgICAgICAgICAgICBkYXlzTGFiZWw6ICdkYXlzJywKICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZURpc2Nsb3N1cmVMYWJlbDogJ0Nvb2tpZSBkaXNjbG9zdXJlJwogICAgICAgICAgICAgICAgICAgIH0sIE0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvckxpc3RVcmw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JCbGFja2xpc3Q6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JXaGl0ZWxpc3Q6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBnb29nbGVXaGl0ZWxpc3Q6IFsxXQogICAgICAgICAgICAgICAgICAgIH0sIEQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHV4QmFja2dyb3VuZENvbG9yOiAnI2ZmZicsCiAgICAgICAgICAgICAgICAgICAgICAgIHV4UHJpbWFyeUJ1dHRvbkNvbG9yOiAnIzIwNkRDNScsCiAgICAgICAgICAgICAgICAgICAgICAgIHV4UHJpbWFyeUJ1dHRvblRleHRDb2xvcjogJyNmZmYnLAogICAgICAgICAgICAgICAgICAgICAgICB1eFNlY29uZGFyeUJ1dHRvbkNvbG9yOiAnI2ZmZicsCiAgICAgICAgICAgICAgICAgICAgICAgIHV4U2Vjb25kYXJ5QnV0dG9uVGV4dENvbG9yOiAnIzIwNkRDNScsCiAgICAgICAgICAgICAgICAgICAgICAgIHV4VG9vZ2xlQWN0aXZlQ29sb3I6ICcjMjA2REM1JywKICAgICAgICAgICAgICAgICAgICAgICAgdXhMaW5rQ29sb3I6ICcjMjA2REM1JywKICAgICAgICAgICAgICAgICAgICAgICAgdXhGb250Q29sb3I6ICcjMTQxZTIzJwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLkdPX1RPX1BBR0UgPSAnZ29Ub1BhZ2UnLCBlLlBVUlBPU0UgPSAncHVycG9zZScsIGUuTEVHSVRJTUFURV9QVVJQT1NFID0gJ2xlZ2l0aW1hdGVQdXJwb3NlJywgZS5MRUdJVElNQVRFX1ZFTkRPUiA9ICdsZWdpdGltYXRlVmVuZG9yJywgZS5TUEVDSUFMX0ZFQVRVUkUgPSAnc3BlY2lhbEZlYXR1cmUnLCBlLlNUQUNLID0gJ3N0YWNrJywgZS5QQVJUSUFMX0NPTlNFTlQgPSAncGFydGlhbCcsIGUuU0FWRV9BTkRfRVhJVCA9ICdzYXZlQW5kRXhpdCcsIGUuQUNDRVBUX0FMTCA9ICdhY2NlcHRBbGwnLCBlLlJFSkVDVF9BTEwgPSAncmVqZWN0QWxsJywgZS5BQ0NFUFRfQUxMX0xFR0lUSU1BVEUgPSAnYWNjZXB0QWxsTGVnaXRpbWF0ZScsIGUuT0JKRUNUX0FMTF9MRUdJVElNQVRFID0gJ29iamVjdEFsbExlZ2l0aW1hdGUnLCBlLkFDQ0VQVF9BTExfVkVORE9SUyA9ICdhY2NlcHRBbGxWZW5kb3JzJywgZS5SRUpFQ1RfQUxMX1ZFTkRPUlMgPSAncmVqZWN0QWxsVmVuZG9ycycsIGUuQUNDRVBUX0FMTF9QVVJQT1NFUyA9ICdhY2NlcHRBbGxQdXJwb3NlcycsIGUuUkVKRUNUX0FMTF9QVVJQT1NFUyA9ICdyZWplY3RBbGxQdXJwb3NlcycsIGUuVkVORE9SID0gJ3ZlbmRvcicsIGUuTk9OX0lBQl9WRU5ET1IgPSAnbm9uSWFiVmVuZG9yJywgZS5ESVNNSVNTX1VJID0gJ2Rpc21pc3NVaScsIGUuU1RBUlRfT05fUEFHRSA9ICdzdGFydE9uUGFnZScsIGUuT1BUX09VVF9UT0dHTEUgPSAnb3B0T3V0VG9nZ2xlJywgZS5PUFRfT1VUX0NPTkZJUk0gPSAnb3B0T3V0Q29uZmlybScsIGUuRVhQQU5EX0VMRU1FTlQgPSAnZXhwYW5kRWxlbWVudCcsIGUuQ09MTEFQU0VfRUxFTUVOVCA9ICdjb2xsYXBzZUVsZW1lbnQnLCBlLkdPT0dMRSA9ICdnb29nbGVQYXJ0bmVyJzsKICAgICAgICAgICAgICAgIH0obSB8fCAobSA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZVtlLklOSVRfUEFHRSA9IDBdID0gJ0lOSVRfUEFHRScsIGVbZS5QVVJQT1NFU19QQUdFID0gMV0gPSAnUFVSUE9TRVNfUEFHRScsIGVbZS5WRU5ET1JTX1BBR0UgPSAyXSA9ICdWRU5ET1JTX1BBR0UnLCBlW2UuTEVHSVRJTUFURV9QQUdFID0gM10gPSAnTEVHSVRJTUFURV9QQUdFJzsKICAgICAgICAgICAgICAgIH0oYiB8fCAoYiA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5NQU5EQVRPUlkgPSAndGNmdWk6bWFuZGF0b3J5JywgZS5DSEFOR0VfT0ZfQ09OU0VOVCA9ICd0Y2Z1aTpjaGFuZ2VvZmNvbnNlbnQnLCBlLkNDUEEgPSAndXNwdWk6ZG9ub3RzZWxsJzsKICAgICAgICAgICAgICAgIH0oQyB8fCAoQyA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5GRUFUVVJFUyA9ICdGZWF0dXJlcycsIGUuTk9OX0lBQiA9ICdOb24gSUFCJywgZS5QVVJQT1NFUyA9ICdQdXJwb3NlcycsIGUuTEVHSVRJTUFURV9QVVJQT1NFUyA9ICdMZWdpdGltYXRlIFB1cnBvc2VzJywgZS5MRUdJVElNQVRFX1ZFTkRPUlMgPSAnTGVnaXRpbWF0ZSBWZW5kb3JzJywgZS5TUEVDSUFMX1BVUlBPU0VTID0gJ1NwZWNpYWwgUHVycG9zZXMnLCBlLlNQRUNJQUxfRkVBVFVSRVMgPSAnU3BlY2lhbCBGZWF0dXJlcycsIGUuVkVORE9SUyA9ICdWZW5kb3JzJywgZS5TVEFDS1MgPSAnU3RhY2tzJywgZS5HT09HTEUgPSAnR29vZ2xlJzsKICAgICAgICAgICAgICAgIH0oXyB8fCAoXyA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5JTklUID0gJ2luaXQnLCBlLk5BVklHQVRJT04gPSAnbmF2aWdhdGlvbicsIGUuRE9ORSA9ICdkb25lJzsKICAgICAgICAgICAgICAgIH0oRSB8fCAoRSA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5BQ0NFUFRfQUxMID0gJ0FsbCcsIGUuQUNDRVBUX1BBUlRJQUwgPSAnUGFydGlhbCcsIGUuUkVKRUNUID0gJ1JlamVjdCc7CiAgICAgICAgICAgICAgICB9KFMgfHwgKFMgPSB7fSkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuTk9ORV9PQkpFQ1RFRCA9ICdOb25lJywgZS5BTExfT0JKRUNURUQgPSAnQWxsJzsKICAgICAgICAgICAgICAgIH0oSSB8fCAoSSA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5TVEFDS1MgPSAnc3RhY2tzJywgZS5WRU5ET1JTID0gJ3ZlbmRvcnMnLCBlLkZFQVRVUkVTID0gJ2ZlYXR1cmVzJywgZS5QVVJQT1NFUyA9ICdwdXJwb3NlcycsIGUuU1BFQ0lBTF9GRUFUVVJFUyA9ICdzcGVjaWFsRmVhdHVyZXMnLCBlLlNQRUNJQUxfUFVSUE9TRVMgPSAnc3BlY2lhbFB1cnBvc2VzJywgZS5GTEVYSUJMRV9QVVJQT1NFUyA9ICdmbGV4aWJsZVB1cnBvc2VzJywgZS5MRUdJVElNQVRFX1ZFTkRPUlMgPSAnbGVnaXRpbWF0ZVZlbmRvcnMnLCBlLkxFR0lUSU1BVEVfUFVSUE9TRVMgPSAnbGVnaXRpbWF0ZVB1cnBvc2VzJywgZS5VTkZJTFRFUkVEX0ZFQVRVUkVTID0gJ3VuZmlsdGVyZWRGZWF0dXJlcycsIGUuVU5GSUxURVJFRF9QVVJQT1NFUyA9ICd1bmZpbHRlcmVkUHVycG9zZXMnLCBlLlVORklMVEVSRURfU1BFQ0lBTF9GRUFUVVJFUyA9ICd1bmZpbHRlcmVkU3BlY2lhbEZlYXR1cmVzJywgZS5VTkZJTFRFUkVEX1NQRUNJQUxfUFVSUE9TRVMgPSAndW5maWx0ZXJlZFNwZWNpYWxQdXJwb3Nlcyc7CiAgICAgICAgICAgICAgICB9KFAgfHwgKFAgPSB7fSkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuQ09OU0VOVF9SRVNQT05TRSA9ICdjb25zZW50LXJlc3BvbnNlJywgZS5DT05TRU5UX1VJID0gJ2NvbnNlbnQtdWknOwogICAgICAgICAgICAgICAgfShMIHx8IChMID0ge30pKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlW2UuR0RQUiA9IDJdID0gJ0dEUFInLCBlW2UuVVNQID0gM10gPSAnVVNQJzsKICAgICAgICAgICAgICAgIH0odyB8fCAodyA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5BQ0NFUFQgPSAnYWNjZXB0JywgZS5SRUpFQ1QgPSAncmVqZWN0JywgZS5ESVNNSVNTID0gJ2Rpc21pc3MnLCBlLkVOVEVSX0ZVTExTQ1JFRU4gPSAnZW50ZXItZnVsbHNjcmVlbic7CiAgICAgICAgICAgICAgICB9KEEgfHwgKEEgPSB7fSkpOwogICAgICAgICAgICAgICAgdmFyIE4gPSBwYXJzZUludCgnJy5jb25jYXQoJzM4JykpLCBGID0gKGIuSU5JVF9QQUdFLCBiLlBVUlBPU0VTX1BBR0UsIGIuVkVORE9SU19QQUdFLCBiLkxFR0lUSU1BVEVfUEFHRSwgTnVtYmVyLmlzTmFOKE4pID8gMSA6IE4pLCBCID0gJ0NNUExpc3QnLCBqID0gJ2V1Y29uc2VudC12MicsIEcgPSAnbm9uaWFidmVuZG9yY29uc2VudCcsIEggPSAnZXVwdWJjb25zZW50JywgcSA9ICdfY21wUmVwcm9tcHRIYXNoJywgeiA9ICd1c3ByaXZhY3knLCBKID0gJ2FkZHRsX2NvbnNlbnQnLCBXID0gbig3MCksIFkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHF1YW50Y2FzdEFjY291bnRJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRTY29wZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LlNFUlZJQ0UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5TRVJWSUNFX0dST1VQCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRUb2dnbGVWYWx1ZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvZmYnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlVaTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbmV2ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbkVVJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWx3YXlzJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5UGVyc2lzdGVudENvbnNlbnRMaW5rOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdyb3VwU2l0ZXNVcmw6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBoYXNoQ29kZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5SZWplY3RCdXR0b25TaG93aW5nOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5DbG9zZUJ1dHRvblNob3dpbmc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaXNBTVA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNjcmVlbkJvZHlUZXh0T3B0aW9uOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbnVtYmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ186IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBXCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG5vbmNvbnNlbnREaXNwbGF5RnJlcXVlbmN5OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbnVtYmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcGVyc2lzdGVudENvbnNlbnRMaW5rTG9jYXRpb246IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdudW1iZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJMb2dvOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyTmFtZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlckZlYXR1cmVzSWRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyU3BlY2lhbEZlYXR1cmVzSWRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuQmVFbXB0eTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyU3BlY2lhbFB1cnBvc2VzSWRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlclB1cnBvc2VJZHM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW5CZUVtcHR5OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW5CZUVtcHR5OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlclZlbmRvckxpc3RVcmw6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJDb3VudHJ5Q29kZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQUYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBWCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FMJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRFonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBUycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQU8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBSScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FRJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQUcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FNJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQVcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBVScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQVonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCUycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JIJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQkQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCQicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JZJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQkUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCWicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JKJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQk0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JPJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQkEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCVycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JWJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQlInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdJTycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JOJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQkcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCRicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JJJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnS0gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDTScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NBJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ1YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdLWScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NGJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVEQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDTCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NOJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ1gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDQycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NPJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnS00nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDRycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ0snLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NJJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSFInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDVScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NZJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ1onLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdESycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0RKJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRE0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdETycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0VDJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRUcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTVicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dRJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRVInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdFRScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0VUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRksnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGTycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0ZKJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRkknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dGJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUEYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdURicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dBJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnR00nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHRScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0RFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnR0gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHSScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dSJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnR0wnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dQJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnR1UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dHJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnR04nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHVycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dZJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSFQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdITScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1ZBJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSE4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdISycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0hVJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSVMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdJTicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0lEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSVInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdJUScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0lFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSU0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdJTCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0lUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSk0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdKUCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0pFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSk8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdLWicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0tFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnS0knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdLUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0tXJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnS0cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdMQScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0xWJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTEInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdMUycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0xSJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTFknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdMSScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0xUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTFUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNTycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01LJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTUcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNVycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01ZJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTVYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNTCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01UJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTUgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNUScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01SJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTVUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdZVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01YJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRk0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01DJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTU4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNRScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01TJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTUEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNWicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01NJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTkEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdOUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ05QJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTkwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBTicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ05DJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTlonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdOSScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ05FJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTkcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdOVScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ05GJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTVAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdOTycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ09NJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUEsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdQVycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1BTJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUEEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdQRycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1BZJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUEUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdQSCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1BOJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUEwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdQVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1BSJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUUEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSRScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1JPJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUlUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSVycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JMJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU0gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdLTicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0xDJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTUYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdQTScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1ZDJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnV1MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTTScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU0EnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTTicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1JTJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU0MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTTCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NHJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU0snLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTSScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NCJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU08nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdaQScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dTJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRVMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdMSycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU1InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTSicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NaJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU0UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDSCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NZJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVFcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUSicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1RaJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVEgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUTCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1RHJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVEsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUTycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1RUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVE4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1RNJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVEMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUVicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1VHJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVUEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBRScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dCJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVVMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdVTScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1VZJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVVonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdWVScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1ZFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVk4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdWRycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1ZJJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnV0YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdFSCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1lFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnWk0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdaVycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yUHVycG9zZUlkczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbkJlRW1wdHk6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbkJlRW1wdHk6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yU3BlY2lhbEZlYXR1cmVzSWRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuQmVFbXB0eTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yU3BlY2lhbFB1cnBvc2VzSWRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuQmVFbXB0eTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yRmVhdHVyZXNJZHM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW5CZUVtcHR5OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdENvbnNlbnRSZWRpcmVjdFVybDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHNvZnRPcHRJbkVuYWJsZWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdWlMYXlvdXQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BvcHVwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYmFubmVyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JMaXN0VXBkYXRlRnJlcTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ251bWJlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRTY29wZUdyb3VwVVJMOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ3JvdXBPZldlYnNpdGVzVVJMOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY29va2llRG9tYWluOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY29va2llUGF0aDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXJkUGFydHlTdG9yYWdlVHlwZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaWZyYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYXBpJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzaG93U3VtbWFyeVZpZXc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcHJpdmFjeU1vZGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LkdEUFIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5VU1AKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNwVmVyc2lvbjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ251bWJlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsxXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c3BKdXJpc2RpY3Rpb246IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVVMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDQScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNwTHNwYWN0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGguWUVTLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGguTk9UCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcFByaXZhY3lQb2xpY3lMaW5rOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNwRGVsZXRlRGF0YUxpbms6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c3BBY2Nlc3NEYXRhTGluazogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1cHByZXNzQ2NwYUxpbmtzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdvb2dsZUVuYWJsZWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyQ29uc2VudFJlc3RyaWN0aW9uSWRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFycmF5VHlwZTogJ251bWJlcicKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyTElSZXN0cmljdGlvbklkczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcnJheVR5cGU6ICdudW1iZXInCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRPblNhZmFyaTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2Jvb2xlYW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgSyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYWNjZXB0QWxsOiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5SZWplY3RCdXR0b246IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNjcmVlblNldHRpbmdzQnV0dG9uOiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5UaXRsZTogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICBwZXJzaXN0ZW50Q29uc2VudExpbmtMYWJlbDogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21Jbml0U2NyZWVuQm9keVRleHQ6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2Vjb25kU2NyZWVuQm9keVRleHQ6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tVmVuZG9yU2NyZWVuQm9keVRleHQ6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tTGVnaXRpbWF0ZVNjcmVlbkJvZHlUZXh0OiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5Tm9SZWplY3RTZXJ2aWNlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzdW1tYXJ5U2NyZWVuQm9keVRleHROb1JlamVjdDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc3VtbWFyeVNjcmVlbkJvZHlUZXh0Tm9SZWplY3RHcm91cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc3VtbWFyeVNjcmVlbkJvZHlUZXh0UmVqZWN0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzdW1tYXJ5U2NyZWVuQm9keVRleHRSZWplY3RHcm91cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc3VtbWFyeVNjcmVlbkJvZHlOb1JlamVjdEdyb3VwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzdW1tYXJ5U2NyZWVuQm9keVJlamVjdFNlcnZpY2U6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5UmVqZWN0R3JvdXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdyb3VwT2ZTaXRlc0xhYmVsOiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVBbmRFeGl0QnV0dG9uOiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFncmVlVG9TZWxlY3RlZEJ1dHRvbjogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICBhZ3JlZUJ1dHRvbjogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICBhZ3JlZUFsbEJ1dHRvbjogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICByZWplY3RBbGw6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgb2JqZWN0QWxsQnV0dG9uOiB7IHR5cGU6ICdzdHJpbmcnIH0KICAgICAgICAgICAgICAgICAgICB9LCBRID0gewogICAgICAgICAgICAgICAgICAgICAgICBub25JYWJWZW5kb3JMaXN0VXJsOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yV2hpdGVsaXN0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFycmF5VHlwZTogJ251bWJlcicKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yQmxhY2tsaXN0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFycmF5VHlwZTogJ251bWJlcicKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ29vZ2xlV2hpdGVsaXN0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFycmF5VHlwZTogJ251bWJlcicKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIFogPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5DdXN0b21MaW5rczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcnJheVR5cGU6ICdvYmplY3QnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtzVGl0bGU6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yc0xhYmVsOiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcERuc1RpdGxlOiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcERuc1RleHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyYXlUeXBlOiAnc3RyaW5nJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c3BEb05vdFNlbGxUb2dnbGVUZXh0OiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcFByaXZhY3lQb2xpY3lMaW5rVGV4dDogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c3BEZWxldGVEYXRhTGlua1RleHQ6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNwQWNjZXNzRGF0YUxpbmtUZXh0OiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcEFjY2VwdEJ1dHRvbjogeyB0eXBlOiAnc3RyaW5nJyB9CiAgICAgICAgICAgICAgICAgICAgfSwgWCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgdXhCYWNrZ3JvdW5kQ29sb3I6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1eFByaW1hcnlCdXR0b25Db2xvcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHV4UHJpbWFyeUJ1dHRvblRleHRDb2xvcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHV4U2Vjb25kYXJ5QnV0dG9uQ29sb3I6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1eFNlY29uZGFyeUJ1dHRvblRleHRDb2xvcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHV4VG9vZ2xlQWN0aXZlQ29sb3I6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1eExpbmtDb2xvcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHV4Rm9udENvbG9yOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sICQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvckxpc3Q6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyYXlUeXBlOiAnb2JqZWN0JwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVBdDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvcnNIYXNoOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGVlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgaW4gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlW3RdLCBvID0gblt0XS50eXBlLCBpID0gblt0XS52YWx1ZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJycgIT09IHIgJiYgKHR5cGVvZiByID09PSBvID8gJ251bWJlcicgPT09IG8gJiYgciA8IDAgPyAoY29uc29sZS53YXJuKCcnLmNvbmNhdCh0LCAnIG11c3QgYmUgYSB2YWxpZCBudW1iZXInKSksICExKSA6ICcnID09PSBpIHx8ICghIWkuaW5jbHVkZXMocikgfHwgKGNvbnNvbGUud2FybignJy5jb25jYXQodCwgJyBtdXN0IGJlIGEgdmFsaWQgdmFsdWUnKSksICExKSkgOiAoY29uc29sZS53YXJuKCcnLmNvbmNhdCh0LCAnIG11c3QgYmUgJykuY29uY2F0KG8pKSwgITEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29uc29sZS53YXJuKCcnLmNvbmNhdCh0LCAnIGlzIG5vdCBhIHZhbGlkIGNvbmZpZyB2YWx1ZScpKSwgITE7CiAgICAgICAgICAgICAgICAgICAgfSwgdGUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KHIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gblt0XS5jYW5CZUVtcHR5ICYmIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2Ygblt0XS52YWx1ZXMgPyB0eXBlb2YgZSA9PT0gblt0XS5hcnJheVR5cGUgPyBvLnB1c2goZSkgOiBjb25zb2xlLndhcm4oJycuY29uY2F0KGUsICcgJykuY29uY2F0KCdpcyBub3QgYSB2YWxpZCB2YWx1ZSBmb3InLCAnICcpLmNvbmNhdCh0KSkgOiBuW3RdLnZhbHVlcy5pbmNsdWRlcyhlKSA/IG8ucHVzaChlKSA6IGNvbnNvbGUud2FybignJy5jb25jYXQoZSwgJyAnKS5jb25jYXQoJ2lzIG5vdCBhIHZhbGlkIHZhbHVlIGZvcicsICcgJykuY29uY2F0KHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAhIW8ubGVuZ3RoICYmIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbnNvbGUud2FybignJy5jb25jYXQodCwgJyBtdXN0IGJlIGFuIGFycmF5JykpLCAhMTsKICAgICAgICAgICAgICAgICAgICB9LCBuZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKHRoaXMsIGUpLCB0aGlzLl9jb3JlQ29uZmlnID0gdm9pZCAwLCB0aGlzLl9wcmVtaXVtUHJvcGVydGllcyA9IHZvaWQgMCwgdGhpcy5fY29yZVVpTGFiZWxzID0gdm9pZCAwLCB0aGlzLl9wcmVtaXVtVWlMYWJlbHMgPSB2b2lkIDAsIHRoaXMuX3RoZW1lID0gdm9pZCAwLCB0aGlzLl9ub25JYWJWZW5kb3JzSW5mbyA9IHZvaWQgMCwgdGhpcy5fYW1wRGF0YSA9IHZvaWQgMCwgdGhpcy5jbGVhbkNvbmZpZyA9IHZvaWQgMCwgdGhpcy5jaGVja1JlcXVpcmVkVmFsdWVzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbi5jbGVhbkNvbmZpZy5jb3JlQ29uZmlnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb25zZW50U2NvcGUnIGluIGUgfHwgKG4uY2xlYW5Db25maWcuY29yZUNvbmZpZy5jb25zZW50U2NvcGUgPSB2LlNFUlZJQ0UpLCAncHJpdmFjeU1vZGUnIGluIGUgfHwgKG4uY2xlYW5Db25maWcuY29yZUNvbmZpZy5wcml2YWN5TW9kZSA9IFt5LkdEUFJdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMudmFsaWRhdGVDb25maWcgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge30sIHIgPSB7fSwgbyA9IHt9LCBpID0ge30sIHMgPSB7fSwgYSA9IHZvaWQgMCwgYyA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jb3JlQ29uZmlnICYmICh0ID0gbi5maWx0ZXJDb25maWcoZS5jb3JlQ29uZmlnLCBZKSksIGUuY29yZVVpTGFiZWxzICYmIChyID0gbi5maWx0ZXJMYWJlbHMoZS5jb3JlVWlMYWJlbHMsIEspKSwgZS5wcmVtaXVtUHJvcGVydGllcyAmJiAobyA9IG4uZmlsdGVyQ29uZmlnKGUucHJlbWl1bVByb3BlcnRpZXMsIFEpKSwgZS5wcmVtaXVtVWlMYWJlbHMgJiYgKGkgPSBuLmZpbHRlckxhYmVscyhlLnByZW1pdW1VaUxhYmVscywgWikpLCBlLnRoZW1lICYmIChzID0gbi5maWx0ZXJDb25maWcoZS50aGVtZSwgWCkpLCBlLm5vbklhYlZlbmRvcnNJbmZvICYmIChhID0gbi5maWx0ZXJDb25maWcoZS5ub25JYWJWZW5kb3JzSW5mbywgJCkpLCBlLmFtcERhdGEgJiYgKGMgPSBlLmFtcERhdGEpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcmVDb25maWc6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcmVVaUxhYmVsczogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlbWl1bVByb3BlcnRpZXM6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZW1pdW1VaUxhYmVsczogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhlbWU6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvcnNJbmZvOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbXBEYXRhOiBjCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuZmlsdGVyQ29uZmlnID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnYXJyYXknID09PSB0W3JdLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRlKGUsIHIsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gJiYgKG5bcl0gPSBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVlKGUsIHIsIHQpICYmIChuW3JdID0gZVtyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLmZpbHRlckxhYmVscyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT09IHRbcl0udHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJyAhPT0gZVtyXSA/IG5bcl0gPSBlW3JdIDogY29uc29sZS53YXJuKCcnLmNvbmNhdChyLCAnIGNhbm5vdCBiZSBlbXB0eScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdGUoZSwgciwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyAmJiAobltyXSA9IG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5nZXRDdXN0b21Db3JlVWlMYWJlbHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2xlYW5Db25maWcuY29yZVVpTGFiZWxzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5pbml0aWFsaXplQ29uZmlnID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKG4uY2xlYW5Db25maWcpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbltlXSAmJiAobltlXSA9IGkoaSh7fSwgbltlXSksIG4uY2xlYW5Db25maWdbZV0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuY2xlYW5Db25maWcgPSB0aGlzLnZhbGlkYXRlQ29uZmlnKHQpLCB0aGlzLmNoZWNrUmVxdWlyZWRWYWx1ZXMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdGhpcy5jbGVhbkNvbmZpZywgbyA9IHIuY29yZUNvbmZpZywgcyA9IG8ucHJpdmFjeU1vZGUsIGEgPSBvLmNvbnNlbnRTY29wZSwgYyA9IG8ucXVhbnRjYXN0QWNjb3VudElkLCB1ID0gci5ub25JYWJWZW5kb3JzSW5mbywgbCA9IHIuYW1wRGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMuaW5jbHVkZXMoeS5HRFBSKSAmJiBzLmluY2x1ZGVzKHkuVVNQKSA/ICh0aGlzLl9jb3JlQ29uZmlnID0gaShpKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxdWFudGNhc3RBY2NvdW50SWQ6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudFNjb3BlOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaXZhY3lNb2RlOiBzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBWKSwgVCksIHRoaXMuX3ByZW1pdW1VaUxhYmVscyA9IGkoaSh7fSwgUiksIHgpLCB0aGlzLl9wcmVtaXVtUHJvcGVydGllcyA9IGkoe30sIE0pLCB0aGlzLl9jb3JlVWlMYWJlbHMgPSBpKHt9LCBVKSwgdGhpcy5fdGhlbWUgPSBpKHt9LCBEKSwgdSAmJiAodGhpcy5fbm9uSWFiVmVuZG9yc0luZm8gPSB1KSkgOiBzLmluY2x1ZGVzKCdHRFBSJykgPyAodGhpcy5fY29yZUNvbmZpZyA9IGkoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1YW50Y2FzdEFjY291bnRJZDogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50U2NvcGU6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpdmFjeU1vZGU6IHMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFYpLCB0aGlzLl9wcmVtaXVtVWlMYWJlbHMgPSBpKHt9LCB4KSwgdGhpcy5fcHJlbWl1bVByb3BlcnRpZXMgPSBpKHt9LCBNKSwgdGhpcy5fY29yZVVpTGFiZWxzID0gaSh7fSwgVSksIHRoaXMuX3RoZW1lID0gaSh7fSwgRCksIHUgJiYgKHRoaXMuX25vbklhYlZlbmRvcnNJbmZvID0gdSkpIDogKHRoaXMuX2NvcmVDb25maWcgPSBpKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxdWFudGNhc3RBY2NvdW50SWQ6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudFNjb3BlOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaXZhY3lNb2RlOiBzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBUKSwgdGhpcy5fcHJlbWl1bVVpTGFiZWxzID0gaSh7fSwgUiksIHRoaXMuX3ByZW1pdW1Qcm9wZXJ0aWVzID0ge30sIHRoaXMuX2NvcmVVaUxhYmVscyA9IHt9LCB0aGlzLl90aGVtZSA9IGkoe30sIEQpKSwgbCAmJiAodGhpcy5fYW1wRGF0YSA9IGwpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXRDdXN0b21QcmVtaXVtVWlMYWJlbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsZWFuQ29uZmlnLnByZW1pdW1VaUxhYmVsczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2NvcmVDb25maWcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fY29yZUNvbmZpZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLCBuID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdWJsaXNoZXJMb2dvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyTmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3B1Ymxpc2hlckZlYXR1cmVzSWRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyU3BlY2lhbEZlYXR1cmVzSWRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyU3BlY2lhbFB1cnBvc2VzSWRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyUHVycG9zZUlkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3B1Ymxpc2hlclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdWJsaXNoZXJWZW5kb3JMaXN0VXJsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyVmVuZG9yTGlzdFVybCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3B1Ymxpc2hlckNvdW50cnlDb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndmVuZG9yUHVycG9zZUlkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlbmRvclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZW5kb3JTcGVjaWFsRmVhdHVyZXNJZHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZW5kb3JTcGVjaWFsUHVycG9zZXNJZHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZW5kb3JGZWF0dXJlc0lkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3JlamVjdENvbnNlbnRSZWRpcmVjdFVybCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0YWNrcycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHIgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25vbmNvbnNlbnREaXNwbGF5RnJlcXVlbmN5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndmVuZG9yTGlzdFVwZGF0ZUZyZXEnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVtvXSAhPT0gdC5jb3JlQ29uZmlnW29dKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC0xICE9PSBuLmluZGV4T2YobykgJiYgKCcnID09PSBlW29dIHx8IGVbb10gPT09IFtdKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCcnLmNvbmNhdChvLCAnIGNhbm5vdCBiZSBlbXB0eScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5pbmRleE9mKG8pICYmIGVbb10gPCAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJycuY29uY2F0KG8sICcgY2Fubm90IGJlIGEgbmVnYXRpdmUgbnVtYmVyJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5fY29yZUNvbmZpZyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdwcmVtaXVtUHJvcGVydGllcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9wcmVtaXVtUHJvcGVydGllczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5wcmVtaXVtUHJvcGVydGllc1tuXSAhPT0gZVtuXSAmJiAoJycgPT09IGVbbl0gfHwgZVtuXSA9PT0gW10pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignJy5jb25jYXQobiwgJyBjYW5ub3QgYmUgZW1wdHknKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzLl9wcmVtaXVtUHJvcGVydGllcyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdjb3JlVWlMYWJlbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fY29yZVVpTGFiZWxzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKGUpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmNvcmVVaUxhYmVsc1tuXSAhPT0gZVtuXSAmJiAnJyA9PT0gZVtuXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJycuY29uY2F0KG4sICcgY2Fubm90IGJlIGVtcHR5JykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5fY29yZVVpTGFiZWxzID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3RoZW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3RoZW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKGUpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LnRoZW1lW25dICE9PSBlW25dICYmICcnID09PSBlW25dKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignJy5jb25jYXQobiwgJyBjYW5ub3QgYmUgZW1wdHknKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzLl90aGVtZSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdub25JYWJWZW5kb3JzSW5mbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9ub25JYWJWZW5kb3JzSW5mbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fbm9uSWFiVmVuZG9yc0luZm8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnYW1wRGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9hbXBEYXRhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9hbXBEYXRhID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3ByZW1pdW1VaUxhYmVscycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9wcmVtaXVtVWlMYWJlbHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoZSkuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQucHJlbWl1bVVpTGFiZWxzW25dICE9PSBlW25dICYmICFlW25dLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJycuY29uY2F0KG4sICcgY2Fubm90IGJlIGVtcHR5JykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5fcHJlbWl1bVVpTGFiZWxzID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKSwgcmUgPSBuKDE5KSwgb2UgPSBuKDMzKSwgaWUgPSBuKDcwKSwgc2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKHRoaXMsIGUpLCB0aGlzLl9fdGNmYXBpdWkgPSB2b2lkIDAsIHRoaXMuX190Y2ZhcGl1aSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IHQuX190Y2ZhcGl1aS5hID0gdC5fX3RjZmFwaXVpLmEgfHwgW10sIHIgPSBhcmd1bWVudHMubGVuZ3RoLCBvID0gbmV3IEFycmF5KHIgPiAxID8gciAtIDEgOiAwKSwgaSA9IDE7IGkgPCByOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9baSAtIDFdID0gYXJndW1lbnRzW2ldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucHVzaChbZV0uY29uY2F0KG8pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHdpbmRvdy5fX3RjZmFwaXVpIHx8ICh3aW5kb3cuX190Y2ZhcGl1aSA9IHRoaXMuX190Y2ZhcGl1aSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkaXNwbGF5VWknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdShhLmEubWFyayhmdW5jdGlvbiB0KG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBvLCBpLCBzLCBjLCB1LCBwID0gYXJndW1lbnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0LnByZXYgPSB0Lm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8gPSBwLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBwWzFdID8gcFsxXSA6IGIuUFVSUE9TRVNfUEFHRSwgaSA9IHAubGVuZ3RoID4gMiAmJiB2b2lkIDAgIT09IHBbMl0gJiYgcFsyXSwgZS5jcmVhdGVVaVNjcmlwdEJsb2NrKCksIHMgPSBudWxsID09PSAociA9IEZlLmNvcmVDb25maWcucHJpdmFjeU1vZGUpIHx8IHZvaWQgMCA9PT0gciA/IHZvaWQgMCA6IHIuaW5jbHVkZXMobiksIE5lLnVwZGF0ZUFwaVZpc2libGUobiwgcyksIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm5leHQgPSA4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbnNvbGUud2FybignYXR0ZW1wdCB0byBzaG93IGRpc2FibGVkIENNUCBVSSByZWd1bGF0aW9uPScuY29uY2F0KG4pKSwgdC5hYnJ1cHQoJ3JldHVybicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShjID0gJ0dEUFInID09PSBuKSB8fCBXZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubmV4dCA9IDEyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQubmV4dCA9IDEyLCBZZSghMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC50MCA9IG4sIHQudDEgPSBvLCB0LnQyID0gaSwgdC50MyA9IEZlLCB0LnQ0ID0gYyA/IE5lLmxvYWRHVkwoKSA6IHZvaWQgMCwgIWMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm5leHQgPSAyMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lm5leHQgPSAyMCwgTmUuZ2V0Q29uc2VudHMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudDUgPSB0LnNlbnQsIHQubmV4dCA9IDI0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnQ1ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnQ2ID0gdC50NSwgdC50NyA9IGMgPyBIZS5kYXRhLmRhdGEubm9uSWFiVmVuZG9yTGlzdCA6IHt9LCB0LnQ4ID0gYyA/IEtlLmZldGNoUGFydG5lcnMoKSA6IHZvaWQgMCwgdSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWd1bGF0aW9uOiB0LnQwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2U6IHQudDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNNYW5kYXRvcnk6IHQudDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnOiB0LnQzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd2bDogdC50NCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50SW5mbzogdC50NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25JYWJWZW5kb3JMaXN0OiB0LnQ3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvb2dsZURhdGE6IHQudDgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHdpbmRvdy5fX3RjZmFwaXVpKCdkaXNwbGF5VWknLCB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sIFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnY3JlYXRlVWlTY3JpcHRCbG9jaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB3aW5kb3cuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5nZXRFbGVtZW50QnlJZCgnX190Y2ZhcGl1aXNjcmlwdCcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpLCBuID0gKEZlLmNvcmVDb25maWcubGFuZ18gfHwgJ2VuJykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGllLmluY2x1ZGVzKG4pIHx8IChuID0gJ2VuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL3RjZnYyLzM4L2NtcDJ1aS5qcyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gci5yZXBsYWNlKCcuanMnLCAnLScuY29uY2F0KG4sICcuanMnKSksIHQudHlwZSA9ICd0ZXh0L2phdmFzY3JpcHQnLCB0LmlkID0gJ19fdGNmYXBpdWlzY3JpcHQnLCB0LnNyYyA9IHIsIGUuaGVhZC5hcHBlbmRDaGlsZCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dKSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCksIGFlID0gbig4NyksIGNlID0gbi5uKGFlKS5hLmNyZWF0ZSh7IHhzcmZDb29raWVOYW1lOiBudWxsIH0pLCB1ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBOT0RFX0VOVjogJ3Byb2R1Y3Rpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUFVCTElDX1VSTDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTVBfRlJBTUVfVVJMX0JBU0U6ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL3RjZnYyLzM4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFNUF9DSEVDS19DT05TRU5UX1VSTDogJ2h0dHBzOi8vYXBpcy5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9hbXAvY2hlY2stY29uc2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBMT0NBTF9TVEFUSUNfRElSOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9MT0dfQVBJOiAnaHR0cHM6Ly9hdWRpdC10Y2Z2Mi5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfR0VPSVBfQVBJX1VSTDogJ2h0dHBzOi8vYXBpcy5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9nZW9pcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfR09PR0xFX0FUUF9VUkw6ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL3RjZnYyL2dvb2dsZS1hdHAtbGlzdC5qc29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9WRVJTSU9OOiAnMzgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0NNUFVJX1NSQzogJ2h0dHBzOi8vcXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvMzgvY21wMnVpLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9HVkxfQkFTRV9VUkw6ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL0dWTC12Mi8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX1RSQU5TTEFUSU9OX0JBU0VfVVJMOiAnaHR0cHM6Ly93d3cucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvdHJhbnNsYXRpb25zLycKICAgICAgICAgICAgICAgICAgICAgICAgfSkuUkVBQ1RfQVBQX0RFQlVHICYmIGNvbnNvbGUubG9nKCdEZWJ1ZzogJyArIGUpOwogICAgICAgICAgICAgICAgICAgIH0sIHBlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAocCh0aGlzLCBlKSwgdGhpcy5faXNVc2VySW5FVSA9IHZvaWQgMCwgdGhpcy5faXNVc2VySW5VUyA9IHZvaWQgMCwgdGhpcy5fdXNlclNwZWNpZmljTG9jYXRpb24gPSB2b2lkIDAsIHRoaXMuX3VzZXJTcGVjaWZpY0xvY2F0aW9uID0gbnVsbCwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaW5VUyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5faXNVc2VySW5FVSA9IGZhbHNlLCB0aGlzLl9pc1VzZXJJblVTID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2luRVUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2lzVXNlckluRVUgPSBmYWxzZSwgdGhpcy5faXNVc2VySW5VUyA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2lzVXNlckluRVUgPSBmYWxzZSwgdGhpcy5faXNVc2VySW5VUyA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2NoZWNrU3BlY2lmaWNMb2NhdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB1KGEuYS5tYXJrKGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID0gRmUuY29yZUNvbmZpZy5wcml2YWN5TW9kZSwgdGhpcy5fdXNlclNwZWNpZmljTG9jYXRpb24pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAyMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1ZSgnaW5pdFVzcExvY2F0aW9uOiBleGFjdCBsb2NhdGlvbiByZXF1ZXN0JyksICF0LmluY2x1ZGVzKCdVU1AnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDIzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSBGZS5jb3JlQ29uZmlnLnVzcEp1cmlzZGljdGlvbiwgIXRoaXMuaXNVc2VySW5VUykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDIyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4uaW5jbHVkZXMoJ1VTJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxOTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByZXYgPSA3LCBlLm5leHQgPSAxMCwgY2UuZ2V0KCdodHRwczovL2FwaXMucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvZ2VvaXAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBlLnNlbnQsIHRoaXMuX3VzZXJTcGVjaWZpY0xvY2F0aW9uID0gci5kYXRhLCBlLm5leHQgPSAxNzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmV2ID0gMTQsIGUudDAgPSBlLmNhdGNoKDcpLCBjb25zb2xlLmxvZyhlLnQwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDIwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl91c2VyU3BlY2lmaWNMb2NhdGlvbiA9ICdVUyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAyMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDIyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fdXNlclNwZWNpZmljTG9jYXRpb24gPSAnbm9uLVVTJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJywgdGhpcy5fdXNlclNwZWNpZmljTG9jYXRpb24pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCB0aGlzLCBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnaXNVc2VySW5FVScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ZSgndGhpcyBzaG91bGQgb25seSBiZSB1c2VkIGZvciB0ZXN0aW5nJyksIHRoaXMuX2lzVXNlckluRVUgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9pc1VzZXJJbkVVOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnaXNVc2VySW5VUycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ZSgndGhpcyBzaG91bGQgb25seSBiZSB1c2VkIGZvciB0ZXN0aW5nJyksIHRoaXMuX2lzVXNlckluVVMgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9pc1VzZXJJblVTOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAndXNlclNwZWNpZmljTG9jYXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWUoJ3RoaXMgc2hvdWxkIG9ubHkgYmUgdXNlZCBmb3IgdGVzdGluZycpLCB0aGlzLl91c2VyU3BlY2lmaWNMb2NhdGlvbiA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3VzZXJTcGVjaWZpY0xvY2F0aW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gbGUoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGUgPSAnJywgZmUodCkuZGlzcGF0Y2goZSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYnRvYShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAnJywgbiA9IDA7IG4gPCBlLmxlbmd0aDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gZVtuXSwgbyA9IDA7IG8gPCA0OyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUociA+PiA4ICogbyAmIDI1NSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSBlLmxlbmd0aCwgciA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE3MzI1ODQxOTMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMjcxNzMzODc5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTE3MzI1ODQxOTQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNzE3MzM4NzgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSA2NDsgdCA8PSBlLmxlbmd0aDsgdCArPSA2NCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGUociwgQ2UoZS5zdWJzdHJpbmcodCAtIDY0LCB0KSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLnN1YnN0cmluZyh0IC0gNjQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSAwOyB0IDwgZS5sZW5ndGg7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb1t0ID4+IDJdIHw9IGUuY2hhckNvZGVBdCh0KSA8PCAodCAlIDQgPDwgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9bdCA+PiAyXSB8PSAxMjggPDwgKHQgJSA0IDw8IDMpLCB0ID4gNTUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaGUociwgbyksIHQgPSAwOyB0IDwgMTY7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9bdF0gPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvWzE0XSA9IDggKiBuLCBoZShyLCBvKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfShkZSk7CiAgICAgICAgICAgICAgICAgICAgfShlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBkZSA9ICcnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZmUoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIG4gPSBuIHx8IFtdOwogICAgICAgICAgICAgICAgICAgIHZhciByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZGUgKz0gZTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BhdGNoOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09PSBlICYmICh0ID0gJ251bGwnKSwgdGhpc1snXycgKyB0XShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX29iamVjdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpLCBvID0gL1xbb2JqZWN0ICguKilcXS9pLmV4ZWModCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gKG8gPSBvID8gb1sxXSA6ICd1bmtub3duOlsnICsgdCArICddJykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChpID0gbi5pbmRleE9mKGUpKSA+PSAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmRpc3BhdGNoKCdbQ0lSQ1VMQVI6JyArIGkgKyAnXScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4ucHVzaChlKSwgJ29iamVjdCcgPT09IG8gfHwgJ2Z1bmN0aW9uJyA9PT0gbyB8fCAnYXN5bmNmdW5jdGlvbicgPT09IG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IE9iamVjdC5rZXlzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoJ29iamVjdDonICsgcy5sZW5ndGggKyAnOicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuZGlzcGF0Y2godCksIHIoJzonKSwgYS5kaXNwYXRjaChlW3RdKSwgcignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzWydfJyArIG9dKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignVW5rbm93biBvYmplY3QgdHlwZSAiJyArIG8gKyAnIicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1snXycgKyBvXShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX2FycmF5OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ2FycmF5OicgKyBlLmxlbmd0aCArICc6JyksIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmRpc3BhdGNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIF9kYXRlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ2RhdGU6JyArIGUudG9KU09OKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBfc3ltYm9sOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3N5bWJvbDonICsgZS50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX2Vycm9yOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ2Vycm9yOicgKyBlLnRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBfYm9vbGVhbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCdib29sOicgKyBlLnRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBfc3RyaW5nOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcignc3RyaW5nOicgKyBlLmxlbmd0aCArICc6JyksIHIoZS50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX2Z1bmN0aW9uOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcignZm46JyksIHRoaXMuZGlzcGF0Y2goZS50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX251bWJlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCdudW1iZXI6JyArIGUudG9TdHJpbmcoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIF94bWw6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigneG1sOicgKyBlLnRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBfbnVsbDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ051bGwnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX3VuZGVmaW5lZDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ1VuZGVmaW5lZCcpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBfcmVnZXhwOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3JlZ2V4OicgKyBlLnRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBfdWludDhhcnJheTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCd1aW50OGFycmF5OicpLCB0aGlzLmRpc3BhdGNoKEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX3VpbnQ4Y2xhbXBlZGFycmF5OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3VpbnQ4Y2xhbXBlZGFycmF5OicpLCB0aGlzLmRpc3BhdGNoKEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX2ludDhhcnJheTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCd1aW50OGFycmF5OicpLCB0aGlzLmRpc3BhdGNoKEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX3VpbnQxNmFycmF5OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3VpbnQxNmFycmF5OicpLCB0aGlzLmRpc3BhdGNoKEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX2ludDE2YXJyYXk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigndWludDE2YXJyYXk6JyksIHRoaXMuZGlzcGF0Y2goQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBfdWludDMyYXJyYXk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigndWludDMyYXJyYXk6JyksIHRoaXMuZGlzcGF0Y2goQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBfaW50MzJhcnJheTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCd1aW50MzJhcnJheTonKSwgdGhpcy5kaXNwYXRjaChBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIF9mbG9hdDMyYXJyYXk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcignZmxvYXQzMmFycmF5OicpLCB0aGlzLmRpc3BhdGNoKEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX2Zsb2F0NjRhcnJheTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCdmbG9hdDY0YXJyYXk6JyksIHRoaXMuZGlzcGF0Y2goQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBfYXJyYXlidWZmZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcignYXJyYXlidWZmZXI6JyksIHRoaXMuZGlzcGF0Y2gobmV3IFVpbnQ4QXJyYXkoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBfdXJsOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3VybDonICsgZS50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX21hcDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoJ21hcDonKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9hcnJheSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgX3NldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoJ3NldDonKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9hcnJheSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBoZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlWzBdLCByID0gZVsxXSwgbyA9IGVbMl0sIGkgPSBlWzNdOwogICAgICAgICAgICAgICAgICAgIG4gPSB5ZShuLCByLCBvLCBpLCB0WzBdLCA3LCAtNjgwODc2OTM2KSwgaSA9IHllKGksIG4sIHIsIG8sIHRbMV0sIDEyLCAtMzg5NTY0NTg2KSwgbyA9IHllKG8sIGksIG4sIHIsIHRbMl0sIDE3LCA2MDYxMDU4MTkpLCByID0geWUociwgbywgaSwgbiwgdFszXSwgMjIsIC0xMDQ0NTI1MzMwKSwgbiA9IHllKG4sIHIsIG8sIGksIHRbNF0sIDcsIC0xNzY0MTg4OTcpLCBpID0geWUoaSwgbiwgciwgbywgdFs1XSwgMTIsIDEyMDAwODA0MjYpLCBvID0geWUobywgaSwgbiwgciwgdFs2XSwgMTcsIC0xNDczMjMxMzQxKSwgciA9IHllKHIsIG8sIGksIG4sIHRbN10sIDIyLCAtNDU3MDU5ODMpLCBuID0geWUobiwgciwgbywgaSwgdFs4XSwgNywgMTc3MDAzNTQxNiksIGkgPSB5ZShpLCBuLCByLCBvLCB0WzldLCAxMiwgLTE5NTg0MTQ0MTcpLCBvID0geWUobywgaSwgbiwgciwgdFsxMF0sIDE3LCAtNDIwNjMpLCByID0geWUociwgbywgaSwgbiwgdFsxMV0sIDIyLCAtMTk5MDQwNDE2MiksIG4gPSB5ZShuLCByLCBvLCBpLCB0WzEyXSwgNywgMTgwNDYwMzY4MiksIGkgPSB5ZShpLCBuLCByLCBvLCB0WzEzXSwgMTIsIC00MDM0MTEwMSksIG8gPSB5ZShvLCBpLCBuLCByLCB0WzE0XSwgMTcsIC0xNTAyMDAyMjkwKSwgbiA9IGdlKG4sIHIgPSB5ZShyLCBvLCBpLCBuLCB0WzE1XSwgMjIsIDEyMzY1MzUzMjkpLCBvLCBpLCB0WzFdLCA1LCAtMTY1Nzk2NTEwKSwgaSA9IGdlKGksIG4sIHIsIG8sIHRbNl0sIDksIC0xMDY5NTAxNjMyKSwgbyA9IGdlKG8sIGksIG4sIHIsIHRbMTFdLCAxNCwgNjQzNzE3NzEzKSwgciA9IGdlKHIsIG8sIGksIG4sIHRbMF0sIDIwLCAtMzczODk3MzAyKSwgbiA9IGdlKG4sIHIsIG8sIGksIHRbNV0sIDUsIC03MDE1NTg2OTEpLCBpID0gZ2UoaSwgbiwgciwgbywgdFsxMF0sIDksIDM4MDE2MDgzKSwgbyA9IGdlKG8sIGksIG4sIHIsIHRbMTVdLCAxNCwgLTY2MDQ3ODMzNSksIHIgPSBnZShyLCBvLCBpLCBuLCB0WzRdLCAyMCwgLTQwNTUzNzg0OCksIG4gPSBnZShuLCByLCBvLCBpLCB0WzldLCA1LCA1Njg0NDY0MzgpLCBpID0gZ2UoaSwgbiwgciwgbywgdFsxNF0sIDksIC0xMDE5ODAzNjkwKSwgbyA9IGdlKG8sIGksIG4sIHIsIHRbM10sIDE0LCAtMTg3MzYzOTYxKSwgciA9IGdlKHIsIG8sIGksIG4sIHRbOF0sIDIwLCAxMTYzNTMxNTAxKSwgbiA9IGdlKG4sIHIsIG8sIGksIHRbMTNdLCA1LCAtMTQ0NDY4MTQ2NyksIGkgPSBnZShpLCBuLCByLCBvLCB0WzJdLCA5LCAtNTE0MDM3ODQpLCBvID0gZ2UobywgaSwgbiwgciwgdFs3XSwgMTQsIDE3MzUzMjg0NzMpLCBuID0gbWUobiwgciA9IGdlKHIsIG8sIGksIG4sIHRbMTJdLCAyMCwgLTE5MjY2MDc3MzQpLCBvLCBpLCB0WzVdLCA0LCAtMzc4NTU4KSwgaSA9IG1lKGksIG4sIHIsIG8sIHRbOF0sIDExLCAtMjAyMjU3NDQ2MyksIG8gPSBtZShvLCBpLCBuLCByLCB0WzExXSwgMTYsIDE4MzkwMzA1NjIpLCByID0gbWUociwgbywgaSwgbiwgdFsxNF0sIDIzLCAtMzUzMDk1NTYpLCBuID0gbWUobiwgciwgbywgaSwgdFsxXSwgNCwgLTE1MzA5OTIwNjApLCBpID0gbWUoaSwgbiwgciwgbywgdFs0XSwgMTEsIDEyNzI4OTMzNTMpLCBvID0gbWUobywgaSwgbiwgciwgdFs3XSwgMTYsIC0xNTU0OTc2MzIpLCByID0gbWUociwgbywgaSwgbiwgdFsxMF0sIDIzLCAtMTA5NDczMDY0MCksIG4gPSBtZShuLCByLCBvLCBpLCB0WzEzXSwgNCwgNjgxMjc5MTc0KSwgaSA9IG1lKGksIG4sIHIsIG8sIHRbMF0sIDExLCAtMzU4NTM3MjIyKSwgbyA9IG1lKG8sIGksIG4sIHIsIHRbM10sIDE2LCAtNzIyNTIxOTc5KSwgciA9IG1lKHIsIG8sIGksIG4sIHRbNl0sIDIzLCA3NjAyOTE4OSksIG4gPSBtZShuLCByLCBvLCBpLCB0WzldLCA0LCAtNjQwMzY0NDg3KSwgaSA9IG1lKGksIG4sIHIsIG8sIHRbMTJdLCAxMSwgLTQyMTgxNTgzNSksIG8gPSBtZShvLCBpLCBuLCByLCB0WzE1XSwgMTYsIDUzMDc0MjUyMCksIG4gPSBiZShuLCByID0gbWUociwgbywgaSwgbiwgdFsyXSwgMjMsIC05OTUzMzg2NTEpLCBvLCBpLCB0WzBdLCA2LCAtMTk4NjMwODQ0KSwgaSA9IGJlKGksIG4sIHIsIG8sIHRbN10sIDEwLCAxMTI2ODkxNDE1KSwgbyA9IGJlKG8sIGksIG4sIHIsIHRbMTRdLCAxNSwgLTE0MTYzNTQ5MDUpLCByID0gYmUociwgbywgaSwgbiwgdFs1XSwgMjEsIC01NzQzNDA1NSksIG4gPSBiZShuLCByLCBvLCBpLCB0WzEyXSwgNiwgMTcwMDQ4NTU3MSksIGkgPSBiZShpLCBuLCByLCBvLCB0WzNdLCAxMCwgLTE4OTQ5ODY2MDYpLCBvID0gYmUobywgaSwgbiwgciwgdFsxMF0sIDE1LCAtMTA1MTUyMyksIHIgPSBiZShyLCBvLCBpLCBuLCB0WzFdLCAyMSwgLTIwNTQ5MjI3OTkpLCBuID0gYmUobiwgciwgbywgaSwgdFs4XSwgNiwgMTg3MzMxMzM1OSksIGkgPSBiZShpLCBuLCByLCBvLCB0WzE1XSwgMTAsIC0zMDYxMTc0NCksIG8gPSBiZShvLCBpLCBuLCByLCB0WzZdLCAxNSwgLTE1NjAxOTgzODApLCByID0gYmUociwgbywgaSwgbiwgdFsxM10sIDIxLCAxMzA5MTUxNjQ5KSwgbiA9IGJlKG4sIHIsIG8sIGksIHRbNF0sIDYsIC0xNDU1MjMwNzApLCBpID0gYmUoaSwgbiwgciwgbywgdFsxMV0sIDEwLCAtMTEyMDIxMDM3OSksIG8gPSBiZShvLCBpLCBuLCByLCB0WzJdLCAxNSwgNzE4Nzg3MjU5KSwgciA9IGJlKHIsIG8sIGksIG4sIHRbOV0sIDIxLCAtMzQzNDg1NTUxKSwgZVswXSA9IF9lKG4sIGVbMF0pLCBlWzFdID0gX2UociwgZVsxXSksIGVbMl0gPSBfZShvLCBlWzJdKSwgZVszXSA9IF9lKGksIGVbM10pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdmUoZSwgdCwgbiwgciwgbywgaSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gX2UoX2UodCwgZSksIF9lKHIsIGkpKSwgX2UodCA8PCBvIHwgdCA+Pj4gMzIgLSBvLCBuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHllKGUsIHQsIG4sIHIsIG8sIGksIHMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdmUodCAmIG4gfCB+dCAmIHIsIGUsIHQsIG8sIGksIHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZ2UoZSwgdCwgbiwgciwgbywgaSwgcykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB2ZSh0ICYgciB8IG4gJiB+ciwgZSwgdCwgbywgaSwgcyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBtZShlLCB0LCBuLCByLCBvLCBpLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZlKHQgXiBuIF4gciwgZSwgdCwgbywgaSwgcyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBiZShlLCB0LCBuLCByLCBvLCBpLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZlKG4gXiAodCB8IH5yKSwgZSwgdCwgbywgaSwgcyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBDZShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSBbXTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSAwOyB0IDwgNjQ7IHQgKz0gNCkKICAgICAgICAgICAgICAgICAgICAgICAgblt0ID4+IDJdID0gZS5jaGFyQ29kZUF0KHQpICsgKGUuY2hhckNvZGVBdCh0ICsgMSkgPDwgOCkgKyAoZS5jaGFyQ29kZUF0KHQgKyAyKSA8PCAxNikgKyAoZS5jaGFyQ29kZUF0KHQgKyAzKSA8PCAyNCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBfZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgKyB0ICYgNDI5NDk2NzI5NTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBFZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICBwKHRoaXMsIGUpLCB0aGlzLl92YWx1ZXMgPSB2b2lkIDAsIHRoaXMuX3ZhbHVlcyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV1Y29uc2VudDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25JYWJWZW5kb3JDb25zZW50OiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvcnNIYXNoOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZldGNoZWQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvbWlzZTogUHJvbWlzZS5yZXNvbHZlKCkKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3ZhbHVlcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fdmFsdWVzID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fdmFsdWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSksIGU7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBTZShlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBuICYmIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKG4pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBvIHx8IChvID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudChlKSwgdCAmJiAoby5jbGFzc05hbWUgPSB0KSwgbiAmJiAoby5pZCA9IG4pLCByICYmIHIuaW5zZXJ0QmVmb3JlKG8sIHIuZmlyc3RDaGlsZCkpLCBvLnNldEF0dHJpYnV0ZSgnZGF0YS1ub3NuaXBwZXQnLCAnJyksIG87CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgSWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuY29yZUNvbmZpZywgbiA9IHQucHVibGlzaGVyRmVhdHVyZXNJZHMsIHIgPSB0LnB1Ymxpc2hlclNwZWNpYWxGZWF0dXJlc0lkcywgbyA9IHQucHVibGlzaGVyU3BlY2lhbFB1cnBvc2VzSWRzLCBpID0gdC5wdWJsaXNoZXJQdXJwb3NlSWRzLCBzID0gdC5wdWJsaXNoZXJQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0SWRzLCBhID0gdC52ZW5kb3JQdXJwb3NlSWRzLCBjID0gdC52ZW5kb3JQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0SWRzLCB1ID0gdC52ZW5kb3JTcGVjaWFsRmVhdHVyZXNJZHMsIHAgPSB0LnZlbmRvclNwZWNpYWxQdXJwb3Nlc0lkcywgbCA9IHQudmVuZG9yRmVhdHVyZXNJZHMsIGQgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgZiA9IChhIHx8IFtdKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgKHQgPSBlKSAmJiB0LnNvcnQoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAtIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VJZHM6IChmID8gYSA6IGkpIHx8IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkczogKGYgPyBjIDogcykgfHwgW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsRmVhdHVyZXNJZHM6IChmID8gdSA6IHIpIHx8IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lhbFB1cnBvc2VzSWRzOiAoZiA/IHAgOiBvKSB8fCBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlYXR1cmVzSWRzOiAoZiA/IGwgOiBuKSB8fCBbXQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIFBlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSAmJiBhcmd1bWVudHNbMV0sIHIgPSAnJy5jb25jYXQoZVswXSwgJ34nKSwgbyA9IGUubWF0Y2goL1xkKy9nKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8uc2hpZnQoKSwgbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJy5jb25jYXQocikuY29uY2F0KG51bGwgPT09IG8gfHwgdm9pZCAwID09PSBvID8gdm9pZCAwIDogby5qb2luKCcuJykpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG51bGwgPT09IG8gfHwgdm9pZCAwID09PSBvID8gdm9pZCAwIDogby5yZWR1Y2UoZnVuY3Rpb24gKGUsIG4sIHIsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gcGFyc2VJbnQobiwgMTApLCBlLmNvbmNhdChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gb1tyXSA/IHBhcnNlSW50KG4sIDEwKSArIHQgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSBpLCBpID8gZS5jb25jYXQoJy4nLmNvbmNhdChpKSkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiAnc3RyaW5nJyA9PT0gdHlwZW9mIHQgPyBlKHQpIDogbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciB3ZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAodGhpcywgZSksIHRoaXMuZGF0YSA9IHZvaWQgMCwgdGhpcy5fcmVwcm9tcHRPcHRpb25zSGFzaCA9IHZvaWQgMCwgdGhpcy5fc3RvcmVkSGFzaCA9IHZvaWQgMCwgdGhpcy5kYXRhID0gbmV3IEVlKCksIHRoaXMuX3JlcHJvbXB0T3B0aW9uc0hhc2ggPSAnJywgdGhpcy5fc3RvcmVkSGFzaCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzaG91bGRSZXByb21wdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLmdlbmVyYXRlUmVwcm9tcHRPcHRpb25zSGFzaCgpLCB0ID0gdGhpcy5fc3RvcmVkSGFzaCwgbiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyonICE9PSB0ICYmIHQgIT09IGUgJiYgKG4gPSAhMCksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZW5lcmF0ZVJlcHJvbXB0T3B0aW9uc0hhc2gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5kYXRhLnZhbHVlcywgdCA9IGUuZXVjb25zZW50LCBuID0gZS5ub25JYWJWZW5kb3JDb25zZW50LCByID0gZS5ub25JYWJWZW5kb3JzSGFzaCwgbyA9IEZlLmNvcmVDb25maWcsIGkgPSBvLnN0YWNrcywgcyA9IG8uaW5pdFNjcmVlbkJvZHlUZXh0T3B0aW9uLCBhID0gRmUucHJlbWl1bVByb3BlcnRpZXMsIGMgPSBhLnZlbmRvcldoaXRlbGlzdCwgdSA9IGEudmVuZG9yQmxhY2tsaXN0LCBwID0gSWUoRmUpLCBsID0gcC5wdXJwb3NlSWRzLCBkID0gcC5wdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0SWRzLCBmID0gcC5zcGVjaWFsRmVhdHVyZXNJZHMsIGggPSBwLnNwZWNpYWxQdXJwb3Nlc0lkcywgdiA9IHAuZmVhdHVyZXNJZHMsIHkgPSB0aGlzLmNyZWF0ZU5ld0hhc2goWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIGcgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyA9ICcnLmNvbmNhdChnLCAnLicpLmNvbmNhdChzLCAnLicpLmNvbmNhdCh5KSwgZyA9IG4gPyAnJy5jb25jYXQoZywgJy4nKS5jb25jYXQobikgOiBnLCBnID0gciA/ICcnLmNvbmNhdChnLCAnLicpLmNvbmNhdChyKSA6IGcsIHRoaXMuX3JlcHJvbXB0T3B0aW9uc0hhc2ggPSBnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnY3JlYXRlTmV3SGFzaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldFZhbHVlcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGF0YS52YWx1ZXMgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0VmFsdWVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5kYXRhLnZhbHVlczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3N0b3JlZEhhc2gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fc3RvcmVkSGFzaCA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3N0b3JlZEhhc2g7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdKSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCksIEFlID0gbigyMSksIE9lID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcCh0aGlzLCBlKSwgdGhpcy5MT1dFUkNBU0VfU1RBUlQgPSA5NywgdGhpcy5QQURfWkVST1MgPSAnMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAnLCB0aGlzLkNPT0tJRV9NQVhfQUdFID0gMzM2OTYwMDAsIHRoaXMuYml0U2l6ZXMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wSWQ6IDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZWQ6IDM2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRTY3JlZW46IDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudExhbmd1YWdlOiAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXBWZXJzaW9uOiAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXBWZXJzaW9uT2xkOiA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRWYWx1ZTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0Q29uc2VudDogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmRWZW5kb3JJZDogMTYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2RpbmdUeXBlOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzUmFuZ2U6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFVwZGF0ZWQ6IDM2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heFZlbmRvcklkOiAxNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudW1iZXJDdXN0b21QdXJwb3NlczogNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudW1FbnRyaWVzOiAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJQdXJwb3Nlc1ZlcnNpb246IDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VzQWxvd2VkOiAyNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFuZGFyZFB1cnBvc2VzQWxsb3dlZDogMjQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRWZW5kb3JJZDogMTYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JMaXN0VmVyc2lvbjogMTIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuX2JpbmFyeVN0ciA9IHZvaWQgMCwgdGhpcy5fYml0UG9zaXRpb24gPSB2b2lkIDAsIHRoaXMuVENTdHJpbmcgPSB2b2lkIDAsIHRoaXMuX2JpbmFyeVN0ciA9ICcnLCB0aGlzLl9iaXRQb3NpdGlvbiA9IDAsIHRoaXMuVENTdHJpbmcgPSBuZXcgQWUuVENTdHJpbmcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZChlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZW5jb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5jb29raWVOYW1lKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBkdChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Nvb2tpZU5hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjcmVhdGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGFzdFVwZGF0ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjbXBJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NtcFZlcnNpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtYXhWZW5kb3JJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlbmRvckNvbnNlbnRzJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgZSksIHIgPSAnbm9uSWFiVmVuZG9yVG9CaW5hcnknOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgSDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBkdChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Nvb2tpZU5hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdWJsaXNoZXJQdXJwb3Nlc1ZlcnNpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdGFuZGFyZFB1cnBvc2VzQWxsb3dlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ251bWJlckN1c3RvbVB1cnBvc2VzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndmVyc2lvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NyZWF0ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsYXN0VXBkYXRlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NtcElkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY21wVmVyc2lvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbnNlbnRTY3JlZW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb25zZW50TGFuZ3VhZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZW5kb3JMaXN0VmVyc2lvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2N1c3RvbVB1cnBvc2VDb25zZW50cycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIGUpLCByID0gJ3B1Ymxpc2hlckNvbnNlbnRUb0JpbmFyeSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBqOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGR0KFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29va2llTmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlbmRvckNvbnNlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVycG9zZUNvbnNlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3BlY2lhbEZlYXR1cmVPcHRpbnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3B1Ymxpc2hlckNvbnNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdWJsaXNoZXJMZWdpdGltYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyUHVycG9zZUlkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3B1Ymxpc2hlclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBlKSwgciA9ICdlbmNvZGVFdUNvbnNlbnQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgSjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBkdChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Nvb2tpZU5hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZW5kb3JDb25zZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlcnNpb24nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBlKSwgciA9ICdlbmNvZGVHb29nbGVDb25zZW50JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociAmJiBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5ub3RGb3VuZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEVycm9yKCcnLmNvbmNhdChuLm5vdEZvdW5kLCAnIGtleXMgbm90IGZvdW5kJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIuaW5jbHVkZXMoJ1RvQmluYXJ5JykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRoaXNbcl0oewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyaWZpZWRPYmplY3Q6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRhZGF0YU9ubHk6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkgPSB0aGlzLmJpbmFyeVRvQnl0ZXMobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudG9XZWJTYWZlQmFzZTY0KGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbcl0obik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBFcnJvcignSW52YWxpZCBjb29raWUgbmFtZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZGVjb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAnZGVjb2RlTm9uSWFiVmVuZG9yQmluYXJ5JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gJ2RlY29kZVB1Ymxpc2hlckJpbmFyeSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBqOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICdkZWNvZGVFdUNvbnNlbnQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgSjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAnZGVjb2RlR29vZ2xlQ29uc2VudCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmluY2x1ZGVzKCdCaW5hcnknKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdGhpcy5mcm9tV2ViU2FmZUJhc2U2NCh0KSwgbyA9IHRoaXMuYnl0ZXNUb0JpbmFyeShyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1tuXShvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW25dKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgRXJyb3IoJ0ludmFsaWQgY29va2llIG5hbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2FkZEJpbmFyeUZpZWxkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAoZSB8fCAwKS50b1N0cmluZygyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoci5sZW5ndGggPD0gdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0VuY291bnRlcmVkIGFuIG92ZXJmbG93IHNldHRpbmcgY29va2llIGZpZWxkICcuY29uY2F0KG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHRoaXMuUEFEX1pFUk9TLnN1YnN0cigwLCB0IC0gci5sZW5ndGgpICsgciwgdGhpcy5iaW5hcnlTdHIgKz0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2VuY29kZUdvb2dsZUNvbnNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICcnLmNvbmNhdChlLnZlcnNpb24sICd+Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGZS5jb3JlQ29uZmlnLmlzQU1QID8gJycuY29uY2F0KHQpLmNvbmNhdChlLnZlbmRvckNvbnNlbnRzLmpvaW4oJy4nKSkgOiBlLnZlbmRvckNvbnNlbnRzLnJlZHVjZShmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY29uY2F0KHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByW25dID8gdCAtIHJbbiAtIDFdIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvID8gZS5jb25jYXQoJy4nLmNvbmNhdChvKSkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2RlY29kZUdvb2dsZUNvbnNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IG51bGwgPT09ICh0ID0gUGUoZSwgRmUuY29yZUNvbmZpZy5pc0FNUCkubWF0Y2goL1xkKy9nKSkgfHwgdm9pZCAwID09PSB0ID8gdm9pZCAwIDogdC5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VJbnQoZSwgMTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiBudWxsID09PSBuIHx8IHZvaWQgMCA9PT0gbiA/IHZvaWQgMCA6IG4uc2hpZnQoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRJZHM6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2VuY29kZUV1Q29uc2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaSh7fSwgZS52ZW5kb3JDb25zZW50cyksIG4gPSBpKHt9LCBlLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnZlbmRvckNvbnNlbnRzID0gdCwgZS52ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlW3RdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF1bbl0gPyBXZVt0XS5zZXQocGFyc2VJbnQobikpIDogV2VbdF0udW5zZXQocGFyc2VJbnQobikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLnB1Ymxpc2hlckNvbnNlbnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGNNb2RlbE5hbWU6ICdwdWJsaXNoZXJDb25zZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVkdWNlQXJyYXk6IGUucHVibGlzaGVyUHVycG9zZUlkcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZS5wdWJsaXNoZXJMZWdpdGltYXRlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRjTW9kZWxOYW1lOiAncHVibGlzaGVyTGVnaXRpbWF0ZUludGVyZXN0cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVkdWNlQXJyYXk6IGUucHVibGlzaGVyUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gdC52YWx1ZSAmJiAoZVt0LnRjTW9kZWxOYW1lXSA9IHQucmVkdWNlQXJyYXkucmVkdWNlKGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoaSh7fSwgZSksIHt9LCByKHt9LCBuLCB0LnZhbHVlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbygndmVuZG9yQ29uc2VudHMnKSwgbygncHVycG9zZUNvbnNlbnRzJyksIG8oJ3NwZWNpYWxGZWF0dXJlT3B0aW5zJyksIG8oJ3ZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMnKSwgbygncHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMnKSwgbygncHVibGlzaGVyQ29uc2VudHMnKSwgbygncHVibGlzaGVyTGVnaXRpbWF0ZUludGVyZXN0cycpLCB5dChXZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkZWNvZGVFdUNvbnNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ3QoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdub25JYWJWZW5kb3JUb0JpbmFyeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS52ZXJpZmllZE9iamVjdCwgbiA9IGUubWV0YWRhdGFPbmx5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5iaW5hcnlTdHIgPSAnJywgdGhpcy5hZGRCaW5hcnlGaWVsZChwdCh0LmNyZWF0ZWQpLCB0aGlzLmJpdFNpemVzLmNyZWF0ZWQsICdjcmVhdGVkJyksIHRoaXMuYWRkQmluYXJ5RmllbGQocHQodC5sYXN0VXBkYXRlZCksIHRoaXMuYml0U2l6ZXMubGFzdFVwZGF0ZWQsICdsYXN0VXBkYXRlZCcpLCB0aGlzLmFkZEJpbmFyeUZpZWxkKHQuY21wSWQsIHRoaXMuYml0U2l6ZXMuY21wSWQsICdjbXBJZCcpLCB0aGlzLmFkZEJpbmFyeUZpZWxkKHQuY21wVmVyc2lvbiwgdGhpcy5iaXRTaXplcy5jbXBWZXJzaW9uLCAnY21wVmVyc2lvbicpLCBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYmluYXJ5U3RyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEJpbmFyeUZpZWxkKHQubWF4VmVuZG9ySWQsIHRoaXMuYml0U2l6ZXMubWF4VmVuZG9ySWQsICdtYXhWZW5kb3JJZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMTsgciA8PSB0Lm1heFZlbmRvcklkOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmJpbmFyeVN0ciArPSB0LnZlbmRvckNvbnNlbnRzW3JdID8gJzEnIDogJzAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5iaW5hcnlTdHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkZWNvZGVOb25JYWJWZW5kb3JCaW5hcnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmJpdFBvc2l0aW9uID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlZDogbHQodGhpcy5nZXRCaXRzKHRoaXMuYml0U2l6ZXMuY3JlYXRlZCwgZSkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0VXBkYXRlZDogbHQodGhpcy5nZXRCaXRzKHRoaXMuYml0U2l6ZXMubGFzdFVwZGF0ZWQsIGUpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wSWQ6IHRoaXMuZ2V0Qml0cyh0aGlzLmJpdFNpemVzLmNtcElkLCBlKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wVmVyc2lvbjogdGhpcy5nZXRCaXRzKHRoaXMuYml0U2l6ZXMuY21wVmVyc2lvbiwgZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heFZlbmRvcklkOiB0aGlzLmdldEJpdHModGhpcy5iaXRTaXplcy5tYXhWZW5kb3JJZCwgZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckNvbnNlbnRzOiBbdm9pZCAwXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4gPSB0Lm1heFZlbmRvcklkIHx8IDEsIHIgPSBuZXcgQXJyYXkobiksIG8gPSAwOyBvIDwgdC5tYXhWZW5kb3JJZDsgbysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcltvICsgMV0gPSAnMScgPT09IGUuY2hhckF0KHRoaXMuX2JpdFBvc2l0aW9uICsgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnZlbmRvckNvbnNlbnRzID0gciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3B1Ymxpc2hlckNvbnNlbnRUb0JpbmFyeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS52ZXJpZmllZE9iamVjdCwgbiA9IGUubWV0YWRhdGFPbmx5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5iaW5hcnlTdHIgPSAnJywgMiAhPT0gdC52ZXJzaW9uKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd2ZXJzaW9uICcgKyB0LnZlcnNpb24gKyAnIG5vdCBzdXBwb3J0ZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuYWRkQmluYXJ5RmllbGQodC52ZXJzaW9uLCB0aGlzLmJpdFNpemVzLnZlcnNpb24sICd2ZXJzaW9uJyksIHRoaXMuYWRkQmluYXJ5RmllbGQocHQodC5jcmVhdGVkKSwgdGhpcy5iaXRTaXplcy5jcmVhdGVkLCAnY3JlYXRlZCcpLCB0aGlzLmFkZEJpbmFyeUZpZWxkKHB0KHQubGFzdFVwZGF0ZWQpLCB0aGlzLmJpdFNpemVzLmxhc3RVcGRhdGVkLCAnbGFzdFVwZGF0ZWQnKSwgdGhpcy5hZGRCaW5hcnlGaWVsZCh0LmNtcElkLCB0aGlzLmJpdFNpemVzLmNtcElkLCAnY21wSWQnKSwgdGhpcy5hZGRCaW5hcnlGaWVsZCh0LmNtcFZlcnNpb24sIHRoaXMuYml0U2l6ZXMuY21wVmVyc2lvbiwgJ2NtcFZlcnNpb24nKSwgdGhpcy5hZGRCaW5hcnlGaWVsZCh0LmNvbnNlbnRTY3JlZW4sIHRoaXMuYml0U2l6ZXMuY29uc2VudFNjcmVlbiwgJ2NvbnNlbnRTY3JlZW4nKSwgdGhpcy5hZGRCaW5hcnlGaWVsZCh0aGlzLmxhbmd1YWdlVG9Db29raWVWYWx1ZSh0LmNvbnNlbnRMYW5ndWFnZSksIHRoaXMuYml0U2l6ZXMuY29uc2VudExhbmd1YWdlLCAnY29uc2VudExhbmd1YWdlJyksIHRoaXMuYWRkQmluYXJ5RmllbGQodC52ZW5kb3JMaXN0VmVyc2lvbiwgdGhpcy5iaXRTaXplcy52ZW5kb3JMaXN0VmVyc2lvbiwgJ3ZlbmRvckxpc3RWZXJzaW9uJyksIHRoaXMuYWRkQmluYXJ5RmllbGQodC5wdWJsaXNoZXJQdXJwb3Nlc1ZlcnNpb24sIHRoaXMuYml0U2l6ZXMucHVibGlzaGVyUHVycG9zZXNWZXJzaW9uLCAncHVibGlzaGVyUHVycG9zZXNWZXJzaW9uJyksIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5iaW5hcnlTdHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYWRkQmluYXJ5RmllbGQodC5zdGFuZGFyZFB1cnBvc2VzQWxsb3dlZCwgdGhpcy5iaXRTaXplcy5zdGFuZGFyZFB1cnBvc2VzQWxsb3dlZCwgJ3N0YW5kYXJkUHVycG9zZXNBbGxvd2VkJyksIHRoaXMuYWRkQmluYXJ5RmllbGQodC5udW1iZXJDdXN0b21QdXJwb3NlcywgdGhpcy5iaXRTaXplcy5udW1iZXJDdXN0b21QdXJwb3NlcywgJ251bWJlckN1c3RvbVB1cnBvc2VzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSAxOyByIDw9IHQubnVtYmVyQ3VzdG9tUHVycG9zZXM7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYmluYXJ5U3RyICs9IHQuY3VzdG9tUHVycG9zZUNvbnNlbnRzW3JdID8gJzEnIDogJzAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5iaW5hcnlTdHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkZWNvZGVQdWJsaXNoZXJCaW5hcnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmJpdFBvc2l0aW9uID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogdGhpcy5nZXRCaXRzKHRoaXMuYml0U2l6ZXMudmVyc2lvbiwgZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZWQ6IGx0KHRoaXMuZ2V0Qml0cyh0aGlzLmJpdFNpemVzLmNyZWF0ZWQsIGUpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFVwZGF0ZWQ6IGx0KHRoaXMuZ2V0Qml0cyh0aGlzLmJpdFNpemVzLmxhc3RVcGRhdGVkLCBlKSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcElkOiB0aGlzLmdldEJpdHModGhpcy5iaXRTaXplcy5jbXBJZCwgZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcFZlcnNpb246IHRoaXMuZ2V0Qml0cyh0aGlzLmJpdFNpemVzLmNtcFZlcnNpb24sIGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50U2NyZWVuOiB0aGlzLmdldEJpdHModGhpcy5iaXRTaXplcy5jb25zZW50U2NyZWVuLCBlKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudExhbmd1YWdlOiB0aGlzLmxhbmd1YWdlRnJvbUNvb2tpZVZhbHVlKHRoaXMuZ2V0Qml0cyh0aGlzLmJpdFNpemVzLmNvbnNlbnRMYW5ndWFnZSwgZSkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JMaXN0VmVyc2lvbjogdGhpcy5nZXRCaXRzKHRoaXMuYml0U2l6ZXMudmVuZG9yTGlzdFZlcnNpb24sIGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJQdXJwb3Nlc1ZlcnNpb246IHRoaXMuZ2V0Qml0cyh0aGlzLmJpdFNpemVzLnB1Ymxpc2hlclB1cnBvc2VzVmVyc2lvbiwgZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YW5kYXJkUHVycG9zZXNBbGxvd2VkOiB0aGlzLmdldEJpdHModGhpcy5iaXRTaXplcy5zdGFuZGFyZFB1cnBvc2VzQWxsb3dlZCwgZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bWJlckN1c3RvbVB1cnBvc2VzOiB0aGlzLmdldEJpdHModGhpcy5iaXRTaXplcy5udW1iZXJDdXN0b21QdXJwb3NlcywgZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVB1cnBvc2VDb25zZW50czogW3ZvaWQgMF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuID0gbmV3IEFycmF5KHQubnVtYmVyQ3VzdG9tUHVycG9zZXMgKyAxKSwgciA9IDA7IHIgPCB0Lm51bWJlckN1c3RvbVB1cnBvc2VzOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3IgKyAxXSA9ICcxJyA9PT0gZS5jaGFyQXQodGhpcy5fYml0UG9zaXRpb24gKyByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuY3VzdG9tUHVycG9zZUNvbnNlbnRzID0gbiwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2JpbmFyeVRvQnl0ZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICs9IHRoaXMuUEFEX1pFUk9TLnN1YnN0cigwLCA3IC0gKGUubGVuZ3RoICsgNykgJSA4KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCBlLmxlbmd0aDsgbiArPSA4KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHBhcnNlSW50KGUuc3Vic3RyKG4sIDgpLCAyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnYnl0ZXNUb0JpbmFyeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAnJywgbiA9IDA7IG4gPCBlLmxlbmd0aDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSB0aGlzLmJpbmFyeThCaXRzKGUuY2hhckNvZGVBdChuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnYmluYXJ5OEJpdHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcwMDAwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcwMDAxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcwMDEwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcwMDExJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcwMTAwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcwMTAxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcwMTEwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcwMTExJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxMDAwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxMDAxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxMDEwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxMDExJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxMTAwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxMTAxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxMTEwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxMTExJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtlID4+PiA0ICYgMTVdICsgdFsxNSAmIGVdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Qml0cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gcGFyc2VJbnQodC5zdWJzdHIodGhpcy5iaXRQb3NpdGlvbiwgZSksIDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5iaXRQb3NpdGlvbiArPSBlLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAndG9XZWJTYWZlQmFzZTY0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJ0b2EoZSkucmVwbGFjZSgvXCsvZywgJy0nKS5yZXBsYWNlKC9cLy9nLCAnXycpLnJlcGxhY2UoLz0rJC8sICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2Zyb21XZWJTYWZlQmFzZTY0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGF0b2IoZS5yZXBsYWNlKC8tL2csICcrJykucmVwbGFjZSgvXy9nLCAnLycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2xhbmd1YWdlVG9Db29raWVWYWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiA2NCAqIChlLmNoYXJDb2RlQXQoMCkgLSB0aGlzLkxPV0VSQ0FTRV9TVEFSVCkgKyAoZS5jaGFyQ29kZUF0KDEpIC0gdGhpcy5MT1dFUkNBU0VfU1RBUlQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnbGFuZ3VhZ2VGcm9tQ29va2llVmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gU3RyaW5nLmZyb21DaGFyQ29kZSh0aGlzLkxPV0VSQ0FTRV9TVEFSVCArIGUgLyA2NCA+Pj4gMCkgKyBTdHJpbmcuZnJvbUNoYXJDb2RlKHRoaXMuTE9XRVJDQVNFX1NUQVJUICsgZSAlIDY0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2RlbGV0ZUNvb2tpZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmNvb2tpZSA9ICcnLmNvbmNhdChlLCAnPTsgZXhwaXJlcz1UaHUsIDAxIEphbiAxOTcwIDAwOjAwOjAwIFVUQzsgcGF0aD0vOyBtYXgtYWdlPS0xOyBkb21haW49JykuY29uY2F0KHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZmFsbGJhY2tUb0xvY2FsU3RvcmFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2F2ZU9uTG9jYWxTdG9yYWdlKGUsIHQpICYmIHRoaXMuZGVsZXRlQ29va2llKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2F2ZU9uTG9jYWxTdG9yYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubG9jYWxTdG9yYWdlLnNldEl0ZW0oZSwgdCksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29uc29sZS53YXJuKCdDb3VsZCBub3Qgc2F2ZSBkYXRhIG9uIGxvY2FsIHN0b3JhZ2U6IE5vdCBlbm91Z2ggc3BhY2UuJyksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICEoYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMl0pIHx8IGFyZ3VtZW50c1syXSwgciA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIChyID0gdGhpcy5zYXZlT25Mb2NhbFN0b3JhZ2UoZSwgdCkpLCByIHx8IHZ0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZU5hbWU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmNvZGVkVmFsdWU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhBZ2U6IHRoaXMuQ09PS0lFX01BWF9BR0UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkX2IxMTBkYWRmNmVkODllNjMgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9iMTEwZGFkZjZlZDg5ZTYzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja18xY2YxZTkwNzM4NTQ2ZDQwLmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LmxvY2FsU3RvcmFnZS5nZXRJdGVtKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LmxvY2FsU3RvcmFnZS5nZXRJdGVtKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS50cmltKCksIG4gPSBkb2N1bWVudC5jb29raWUuc3BsaXQoJzsnKS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRyaW0oKS5zdGFydHNXaXRoKHQgKyAnPScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRyaW0oKS5zdWJzdHJpbmcodC5sZW5ndGggKyAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4ubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByID0gZSA9PT0gaiA/IGJ0KG4pIDogblswXSwgZSAhPT0gaiAmJiBlICE9PSB6ICYmIGUgIT09IEogJiYgdGhpcy5mYWxsYmFja1RvTG9jYWxTdG9yYWdlKHQsIHIpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEVycm9yKCcnLmNvbmNhdChlLCAnIG5vdCBmb3VuZC4nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9iMTEwZGFkZjZlZDg5ZTYzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkX2IxMTBkYWRmNmVkODllNjMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnYml0UG9zaXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fYml0UG9zaXRpb247CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2JpdFBvc2l0aW9uID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2JpbmFyeVN0cicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9iaW5hcnlTdHIgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9iaW5hcnlTdHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdKSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBrZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgKG51bGwgPT0gdCB8fCB0ID4gZS5sZW5ndGgpICYmICh0ID0gZS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0gbmV3IEFycmF5KHQpOyBuIDwgdDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICByW25dID0gZVtuXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFRlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGtlKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChlKS5zbGljZSg4LCAtMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnT2JqZWN0JyA9PT0gbiAmJiBlLmNvbnN0cnVjdG9yICYmIChuID0gZS5jb25zdHJ1Y3Rvci5uYW1lKSwgJ01hcCcgPT09IG4gfHwgJ1NldCcgPT09IG4gPyBBcnJheS5mcm9tKG4pIDogJ0FyZ3VtZW50cycgPT09IG4gfHwgL14oPzpVaXxJKW50KD86OHwxNnwzMikoPzpDbGFtcGVkKT9BcnJheSQvLnRlc3QobikgPyBrZShlLCB0KSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBWZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfShlKSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBTeW1ib2wgJiYgU3ltYm9sLml0ZXJhdG9yIGluIE9iamVjdChlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBbXSwgciA9ICEwLCBvID0gITEsIGkgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMsIGEgPSBlW1N5bWJvbC5pdGVyYXRvcl0oKTsgIShyID0gKHMgPSBhLm5leHQoKSkuZG9uZSkgJiYgKG4ucHVzaChzLnZhbHVlKSwgIXQgfHwgbi5sZW5ndGggIT09IHQpOyByID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSAhMCwgaSA9IGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgfHwgbnVsbCA9PSBhLnJldHVybiB8fCBhLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oZSwgdCkgfHwgVGUoZSwgdCkgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbnZhbGlkIGF0dGVtcHQgdG8gZGVzdHJ1Y3R1cmUgbm9uLWl0ZXJhYmxlIGluc3RhbmNlLlxuSW4gb3JkZXIgdG8gYmUgaXRlcmFibGUsIG5vbi1hcnJheSBvYmplY3RzIG11c3QgaGF2ZSBhIFtTeW1ib2wuaXRlcmF0b3JdKCkgbWV0aG9kLicpOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHhlKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ga2UoZSk7CiAgICAgICAgICAgICAgICAgICAgfShlKSB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBTeW1ib2wgJiYgU3ltYm9sLml0ZXJhdG9yIGluIE9iamVjdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5mcm9tKGUpOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgVGUoZSkgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbnZhbGlkIGF0dGVtcHQgdG8gc3ByZWFkIG5vbi1pdGVyYWJsZSBpbnN0YW5jZS5cbkluIG9yZGVyIHRvIGJlIGl0ZXJhYmxlLCBub24tYXJyYXkgb2JqZWN0cyBtdXN0IGhhdmUgYSBbU3ltYm9sLml0ZXJhdG9yXSgpIG1ldGhvZC4nKTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgUmUgPSBuKDg4KSwgVWUgPSBuLm4oUmUpLCBNZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYmc6ICfQn9C+0LLQtdGA0LjRgtC10LvQvdC+0YHRgicsCiAgICAgICAgICAgICAgICAgICAgICAgIGhyOiAnUHJpdmF0bm9zdCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGNzOiAnT2NocmFuYSBvc29ibsOtY2ggw7pkYWrFrycsCiAgICAgICAgICAgICAgICAgICAgICAgIGRhOiAnUHJpdmF0bGl2ZXRzIGZyZWQnLAogICAgICAgICAgICAgICAgICAgICAgICBubDogJ1ByaXZhY3knLAogICAgICAgICAgICAgICAgICAgICAgICBldDogJ1ByaXZhYXRzdXMnLAogICAgICAgICAgICAgICAgICAgICAgICBmaTogJ1lrc2l0eWlzeXlzJywKICAgICAgICAgICAgICAgICAgICAgICAgZnI6ICdDb25maWRlbnRpYWxpdMOpJywKICAgICAgICAgICAgICAgICAgICAgICAgZGU6ICdEYXRlbnNjaHV0eicsCiAgICAgICAgICAgICAgICAgICAgICAgIGVuOiAnUHJpdmFjeScsCiAgICAgICAgICAgICAgICAgICAgICAgIGVsOiAnzpHPgM+Mz4HPgc63z4TOvycsCiAgICAgICAgICAgICAgICAgICAgICAgIGh1OiAnQWRhdHbDqWRlbGVtJywKICAgICAgICAgICAgICAgICAgICAgICAgaXQ6ICdSaXNlcnZhdGV6emEnLAogICAgICAgICAgICAgICAgICAgICAgICBsdjogJ1ByaXbEgXR1bXMnLAogICAgICAgICAgICAgICAgICAgICAgICBsdDogJ1ByaXZhdHVtYXMnLAogICAgICAgICAgICAgICAgICAgICAgICBtdDogJ1ByaXZhdGV6emEnLAogICAgICAgICAgICAgICAgICAgICAgICBubzogJ1BlcnNvbnZlcm4nLAogICAgICAgICAgICAgICAgICAgICAgICBwbDogJ1ByeXdhdG5vxZvEhycsCiAgICAgICAgICAgICAgICAgICAgICAgIHB0OiAnUHJpdmFjaWRhZGUnLAogICAgICAgICAgICAgICAgICAgICAgICBybzogJ0NvbmZpZGVuyJtpYWxpdGF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgIHJ1OiAn0JrQvtC90YTQuNC00LXQvdGG0LjQsNC70YzQvdC+0YHRgtGMJywKICAgICAgICAgICAgICAgICAgICAgICAgc2s6ICdTw7prcm9taWUnLAogICAgICAgICAgICAgICAgICAgICAgICBzbDogJ1phc2Vibm9zdCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGVzOiAnUHJpdmFjaWRhZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHN2OiAnSW50ZWdyaXRldCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGFyOiAn2KXYudiv2KfYr9in2Kog2KfZhNiu2LXZiNi12YrYqScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZhOiAn2KrZhti424zZhdin2Kog2K3YsduM2YUg2K7YtdmI2LXbjCcKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gRGUoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciBvLCBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAncWMtY21wMi1jb250YWluZXInOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNlKCdkaXYnLCBlLCBlLCBkb2N1bWVudC5ib2R5KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCBzID0gJ3FjLWNtcDItcGVyc2lzdGVudC1saW5rJywgYSA9IFNlKCdhJywgcywgcywgaSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEudGFiSW5kZXggPSAwLCBhLmhyZWYgPSAnIycsIGEuZmlyc3RDaGlsZCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgYS5vbmNsaWNrID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93Ll9fdGNmYXBpKCdkaXNwbGF5Q29uc2VudFVpJywgMiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9KSwgITE7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IFNlKCdpbWcnLCB2b2lkIDAsIHZvaWQgMCwgYSksIHUgPSBlIHx8IE1lWyh0IHx8ICdlbicpLnRvTG93ZXJDYXNlKCldIHx8IE1lLmVuOwogICAgICAgICAgICAgICAgICAgIGMuc3JjID0gVWUuYSwgYy5hbHQgPSB1OwogICAgICAgICAgICAgICAgICAgIHZhciBwID0gZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUodSk7CiAgICAgICAgICAgICAgICAgICAgYS5hcHBlbmRDaGlsZChwKTsKICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IFNlKCdzdHlsZScsIHZvaWQgMCwgJ3FjLWNtcDInLCBkb2N1bWVudC5oZWFkKSwgZCA9IFZlKChvID0ge30sIHIobywgZi5UT1BfTEVGVCwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RvcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGVmdCcKICAgICAgICAgICAgICAgICAgICAgICAgXSksIHIobywgZi5UT1BfUklHSFQsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0b3AnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3JpZ2h0JwogICAgICAgICAgICAgICAgICAgICAgICBdKSwgcihvLCBmLkJPVFRPTV9MRUZULCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYm90dG9tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsZWZ0JwogICAgICAgICAgICAgICAgICAgICAgICBdKSwgcihvLCBmLkJPVFRPTV9SSUdIVCwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JvdHRvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmlnaHQnCiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBvKVtuXSwgMiksIGggPSBkWzBdLCB2ID0gZFsxXSwgeSA9ICd0b3AnID09PSBoID8gJ2JvdHRvbScgOiAndG9wJzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbC5pbm5lckhUTUwgPSAnLnFjLWNtcDItcGVyc2lzdGVudC1saW5rIHtjdXJzb3I6cG9pbnRlcjsgcG9zaXRpb246Zml4ZWQ7IGJhY2tncm91bmQtY29sb3I6IzM2OEJENjtwYWRkaW5nOjVweCAxNXB4OyBjb2xvcjojRkZGOyBkaXNwbGF5OmZsZXg7IHRleHQtZGVjb3JhdGlvbjogbm9uZTthbGlnbi1pdGVtczpjZW50ZXI7IG1heC1oZWlnaHQ6MzBweDsgei1pbmRleDoyMTQ3NDgzNjQwOycgKyAnJy5jb25jYXQoaCwgJzowOyAnKS5jb25jYXQodiwgJzowOycpICsgJ2JvcmRlci0nLmNvbmNhdCh5LCAnLWxlZnQtcmFkaXVzOjNweDsnKSArICdib3JkZXItJy5jb25jYXQoeSwgJy1yaWdodC1yYWRpdXM6M3B4OycpICsgJ30ucWMtY21wMi1wZXJzaXN0ZW50LWxpbmsgaW1nIHt3aWR0aDoxNnB4OyBoZWlnaHQ6MTdweDsgbWFyZ2luLXJpZ2h0OjVweDt9JywgYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBOZSwgRmUsIEJlLCBqZSwgR2UsIEhlLCBxZSwgemUsIEplLCBXZSwgWWUsIEtlLCBRZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAodGhpcywgZSksIHRoaXMuX2Nvb2tpZVZhbHVlcyA9IHZvaWQgMCwgdGhpcy5pc1NhZmFyaSA9IHZvaWQgMCwgdGhpcy5yZXNvbHZlQ29va2llID0gdm9pZCAwLCB0aGlzLl9mZXRjaENvb2tpZXNDYWxsZWQgPSB2b2lkIDAsIHRoaXMucmVzb2x2ZUNvb2tpZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuX2Nvb2tpZVZhbHVlcyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldWNvbnNlbnQ6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvckNvbnNlbnQ6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvb2dsZUNvb2tpZVZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZXRjaGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlOiBuZXcgUHJvbWlzZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5yZXNvbHZlQ29va2llID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5pc1NhZmFyaSA9IG10KCdzYWZhcmknKSwgdGhpcy5fZmV0Y2hDb29raWVzQ2FsbGVkID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldENvcmVDb25maWcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGZS5jb3JlQ29uZmlnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Q29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdShhLmEubWFyayhmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIG8sIHMsIGMsIHUsIHAsIGwsIGQsIGYsIGgsIHYsIHksIGcsIG0sIGIsIEM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9IF8uVkVORE9SUywgbiA9IF8uTEVHSVRJTUFURV9WRU5ET1JTLCBvID0gXy5MRUdJVElNQVRFX1BVUlBPU0VTLCBzID0gXy5QVVJQT1NFUywgYyA9IF8uU1BFQ0lBTF9GRUFUVVJFUywgdSA9IF8uTk9OX0lBQiwgcCA9IF8uR09PR0xFLCB0aGlzLl9jb29raWVWYWx1ZXMuZmV0Y2hlZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gNCwgdGhpcy5fY29va2llVmFsdWVzLnByb21pc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsID0gTGUoemUuZGVjb2RlLCB0aGlzLl9jb29raWVWYWx1ZXMuZXVjb25zZW50KSwgZCA9IG5ldyBrKCksIGYgPSBXZS5ndmwsIGggPSBGZS5jb3JlQ29uZmlnLnB1Ymxpc2hlck5hbWUgfHwgRmUuY29yZUNvbmZpZy5jb29raWVEb21haW4gfHwgJycsIHYgPSBGZS5jb3JlQ29uZmlnLCB5ID0gdi5wdWJsaXNoZXJQdXJwb3NlSWRzLCBnID0gdi5wdWJsaXNoZXJQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0SWRzLCBtID0gZi52ZW5kb3JzLCAoeSB8fCBnKSAmJiAobSA9IGkoaSh7fSwgbSksIHt9LCByKHt9LCBoLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpKSwgdGhpcy5wb3B1bGF0ZUNvcmVDb25zZW50cyhkLCB0LCBtLCBsKSwgdGhpcy5wb3B1bGF0ZUNvcmVDb25zZW50cyhkLCBzLCBmLnB1cnBvc2VzLCBsKSwgdGhpcy5wb3B1bGF0ZUNvcmVDb25zZW50cyhkLCBjLCBmLnNwZWNpYWxGZWF0dXJlcywgbCksIHRoaXMucG9wdWxhdGVDb3JlQ29uc2VudHMoZCwgbiwgbSwgbCksIHRoaXMucG9wdWxhdGVDb3JlQ29uc2VudHMoZCwgbywgZi5wdXJwb3NlcywgbCksIGIgPSBMZShIZS5kZWNvZGUsIHRoaXMuX2Nvb2tpZVZhbHVlcy5ub25JYWJWZW5kb3JDb25zZW50KSwgdGhpcy5wb3B1bGF0ZUNvcmVDb25zZW50cyhkLCB1LCBIZS5kYXRhLmRhdGEubm9uSWFiVmVuZG9yTGlzdCwgYiksIEMgPSBMZShLZS5kZWNvZGUsIHRoaXMuX2Nvb2tpZVZhbHVlcy5nb29nbGVDb29raWVWYWx1ZSksIHRoaXMucG9wdWxhdGVDb3JlQ29uc2VudHMoZCwgcCwgW10sIEMpLCBlLmFicnVwdCgncmV0dXJuJywgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdleHRyYWN0TnVtZXJpY0tleXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gcGFyc2VJbnQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc05hTihyKSB8fCAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0Q29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEZlLmNvcmVDb25maWcsIG4gPSB0LnB1Ymxpc2hlclB1cnBvc2VJZHMsIHIgPSB0LnB1Ymxpc2hlclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMsIG8gPSB0LnB1Ymxpc2hlck5hbWUsIHMgPSB0LmlzQU1QOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmNvbnNlbnRTY3JlZW4gJiYgKFdlLmNvbnNlbnRTY3JlZW4gPSBlLmNvbnNlbnRTY3JlZW4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgYyA9IHplLmVuY29kZSh0aGlzLmV4dHJhY3ROdW1lcmljS2V5cyhlLnZlbmRvckNvbnNlbnRzKSwgdGhpcy5leHRyYWN0TnVtZXJpY0tleXMoZS5wdXJwb3Nlc0NvbnNlbnRzKSwgdGhpcy5leHRyYWN0TnVtZXJpY0tleXMoZS5zcGVjaWFsRmVhdHVyZXMpLCB0aGlzLmV4dHJhY3ROdW1lcmljS2V5cyhlLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdCksIHRoaXMuZXh0cmFjdE51bWVyaWNLZXlzKGUubGVnaXRpbWF0ZVB1cnBvc2VzQ29uc2VudHMpLCBlLnZlbmRvckNvbnNlbnRzW29dLCBlLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdFtvXSwgbiwgciksIHUgPSB0aGlzLmZvcm1hdENvbnNlbnRzKGUubm9uSWFiQ29uc2VudHMpLCBwID0gRmUucHJlbWl1bVByb3BlcnRpZXMubm9uSWFiVmVuZG9yTGlzdFVybCA/IEhlLmVuY29kZSh1LmNvbnNlbnRBcnJheSwgdS5tYXhWZW5kb3JJZCkgOiAnJywgbCA9IHRoaXMuZm9ybWF0R29vZ2xlQ29uc2VudHMoZSksIGQgPSBGZS5jb3JlQ29uZmlnLmdvb2dsZUVuYWJsZWQgPyBLZS5lbmNvZGUobCkgOiAnJywgZiA9IEhlLmRhdGEuZGF0YS5ub25JYWJWZW5kb3JzSGFzaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwubGVuZ3RoIHx8IHMgfHwgR2UuZGVsZXRlQ29va2llKEosIEZlLmNvcmVDb25maWcuY29va2llRG9tYWluKSwgSmUuc2V0VmFsdWVzKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV1Y29uc2VudDogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvckNvbnNlbnQ6IHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25JYWJWZW5kb3JzSGFzaDogZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYSA9IEplLmdlbmVyYXRlUmVwcm9tcHRPcHRpb25zSGFzaCgpLCB0aGlzLnNldERhdGEoYywgcCwgYSwgZCksIHRoaXMudXBkYXRlQXBpVmlzaWJsZSgnR0RQUicsICExKSwgaShpKHt9LCB0aGlzLl9jb29raWVWYWx1ZXMpLCB7fSwgeyBhbGxDb25zZW50czogZS5hbGxDb25zZW50cyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3VwZGF0ZUFwaVZpc2libGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ1VTUCcgIT09IGUgJiYgZnQoQmUuaXNVc2VySW5FVSwgRmUuY29yZUNvbmZpZy5kaXNwbGF5VWkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuX2Nvb2tpZVZhbHVlcy5ldWNvbnNlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmICFuLm1lc3NhZ2UgfHwgKG4gPSAnJyksIEV0LmNtcEFwaS51cGRhdGUobiwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRXQuY21wQXBpLnVwZGF0ZShudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRmUuY29yZUNvbmZpZy5wcml2YWN5TW9kZS5pbmNsdWRlcygnR0RQUicpICYmIEZlLmNvcmVDb25maWcuZGlzcGxheVBlcnNpc3RlbnRDb25zZW50TGluayAmJiAhRmUuY29yZUNvbmZpZy5pc0FNUCAmJiB0aGlzLmhhc0Nvb2tpZSgpICYmIERlKEZlLmdldEN1c3RvbUNvcmVVaUxhYmVscygpLnBlcnNpc3RlbnRDb25zZW50TGlua0xhYmVsLCBGZS5jb3JlQ29uZmlnLmxhbmdfLCBGZS5jb3JlQ29uZmlnLnBlcnNpc3RlbnRDb25zZW50TGlua0xvY2F0aW9uKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldERhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IEZlLmNvcmVDb25maWcsIGkgPSBvLmNvbnNlbnRTY29wZSwgcyA9IG8udGhpcmRQYXJ0eVN0b3JhZ2VUeXBlLCBhID0gby5jb25zZW50U2NvcGVHcm91cFVSTCwgYyA9IG8uY29uc2VudE9uU2FmYXJpLCB1ID0gby5pc0FNUCwgcCA9ICdhcGknID09PSBzLCBsID0gdGhpcy5pc1NhZmFyaSAmJiBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1IHx8IChsID8gdGhpcy5zZXREYXRhVXNpbmdBcGkoITAsIGEsIGUsIHQsIG4sIHIpIDogaSA9PT0gdi5TRVJWSUNFIHx8IHRoaXMuaXNTYWZhcmkgPyB0aGlzLnNldERhdGFVc2luZ0ZpcnN0UGFydHkoZSwgdCwgbiwgcikgOiBpID09PSB2LlNFUlZJQ0VfR1JPVVAgJiYgKHAgPyB0aGlzLnNldERhdGFVc2luZ0FwaSghMCwgYSwgZSwgdCwgbiwgcikgOiB0aGlzLnNldERhdGFVc2luZ0lmcmFtZShlLCB0LCBuLCByKSkpLCB0aGlzLl9jb29raWVWYWx1ZXMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldWNvbnNlbnQ6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25JYWJWZW5kb3JDb25zZW50OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ29vZ2xlQ29va2llVmFsdWU6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZXRjaGVkOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb21pc2U6IHRoaXMuX2Nvb2tpZVZhbHVlcy5wcm9taXNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXREYXRhVXNpbmdBcGknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgciwgbywgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIChzW2pdID0gbiksIHIgJiYgKHNbR10gPSByKSwgbyAmJiAoc1txXSA9IG8pLCBpICYmIChzW0pdID0gaSksIGNlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ3Bvc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpdGhDcmVkZW50aWFsczogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCd0aGUgY29va2llcyB3YXMgc2F2ZWQgc3VjY2Vzc2Z1bGx5Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0RGF0YVVzaW5nSWZyYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiBzdC50cnlHcm91cENvb2tpZUFjY2Vzc0NhbGwoJ3NldCcsIGosIGUpLCB0ICYmIHN0LnRyeUdyb3VwQ29va2llQWNjZXNzQ2FsbCgnc2V0JywgRywgdCksIG4gJiYgc3QudHJ5R3JvdXBDb29raWVBY2Nlc3NDYWxsKCdzZXQnLCBxLCBuKSwgciAmJiBzdC50cnlHcm91cENvb2tpZUFjY2Vzc0NhbGwoJ3NldCcsIEosIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0RGF0YVVzaW5nRmlyc3RQYXJ0eScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgJiYgemUuc2V0Q29va2llKGUpLCB0ICYmIEhlLnNldENvb2tpZSh0KSwgbiAmJiBHZS5zZXQocSwgbiksIHIgJiYgS2Uuc2V0Q29va2llKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZmV0Y2hDb29raWVWYWx1ZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdShhLmEubWFyayhmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIsIG8sIGksIHMsIGMsIHUsIHAsIGwsIGQsIGYsIGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9IEZlLmNvcmVDb25maWcsIG4gPSB0LmNvbnNlbnRTY29wZSwgciA9IHQuY29uc2VudFNjb3BlR3JvdXBVUkwsIG8gPSB0LnRoaXJkUGFydHlTdG9yYWdlVHlwZSwgaSA9IHQuY29uc2VudE9uU2FmYXJpLCBzID0gdC5pc0FNUCwgYyA9IEZlLmFtcERhdGEsIHUgPSAnJywgcCA9ICcnLCBsID0gJycsIGQgPSB7fSwgZiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBlLm5vbklhYkNvb2tpZVZhbHVlLCBwID0gZS52ZW5kb3JDb29raWVWYWx1ZSwgbCA9IGUuZ29vZ2xlQ29va2llVmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaCA9IHRoaXMuaXNTYWZhcmkgJiYgaSwgdGhpcy5fZmV0Y2hDb29raWVzQ2FsbGVkID0gITAsICFzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmNvbnNlbnRNZXRhZGF0YSAmJiBjLmNvbnNlbnRNZXRhZGF0YS5jb25zZW50U3RyaW5nVHlwZSA9PT0gdy5HRFBSICYmIChwID0gYy5jb25zZW50U3RyaW5nLCBjLmNvbnNlbnRNZXRhZGF0YS5hZGRpdGlvbmFsQ29uc2VudCAmJiAobCA9IGMuY29uc2VudE1ldGFkYXRhLmFkZGl0aW9uYWxDb25zZW50KSksIGUubmV4dCA9IDM2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxOTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSAxNSwgdGhpcy5nZXREYXRhVXNpbmdBcGkoITAsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGUuc2VudCwgZihkKSwgZS5uZXh0ID0gMzY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuICE9PSB2LlNFUlZJQ0UgJiYgIXRoaXMuaXNTYWZhcmkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAyNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSB0aGlzLmdldERhdGFVc2luZ0ZpcnN0UGFydHkoKSwgZihkKSwgZS5uZXh0ID0gMzY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuICE9PSB2LlNFUlZJQ0VfR1JPVVApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAzNjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnYXBpJyAhPT0gbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDMyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDI4LCB0aGlzLmdldERhdGFVc2luZ0FwaSghMCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gZS5zZW50LCBmKGQpLCBlLm5leHQgPSAzNjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDMyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDM0LCB0aGlzLmdldERhdGFVc2luZ0lmcmFtZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGUuc2VudCwgZihkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzNjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2Nvb2tpZVZhbHVlcyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldWNvbnNlbnQ6IHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yQ29uc2VudDogdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnb29nbGVDb29raWVWYWx1ZTogbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZXRjaGVkOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlOiB0aGlzLl9jb29raWVWYWx1ZXMucHJvbWlzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5yZXNvbHZlQ29va2llKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXREYXRhVXNpbmdBcGknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdShhLmEubWFyayhmdW5jdGlvbiBlKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBvLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDIsIGNlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdnZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aXRoQ3JlZGVudGlhbHM6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciA9IGUuc2VudCwgbyA9IHt9LCBpID0gci5kYXRhW3FdLCBKZS5zdG9yZWRIYXNoID0gaSwgby52ZW5kb3JDb29raWVWYWx1ZSA9IHIuZGF0YVtqXSwgby5ub25JYWJDb29raWVWYWx1ZSA9IHIuZGF0YVtHXSwgby5nb29nbGVDb29raWVWYWx1ZSA9IHIuZGF0YS5hZGR0bF9jb25zZW50LCBlLmFicnVwdCgncmV0dXJuJywgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0RGF0YVVzaW5nSWZyYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHUoYS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByLCBvLCBpLCBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSBGZS5jb3JlQ29uZmlnLmdvb2dsZUVuYWJsZWQsIG4gPSBGZS5wcmVtaXVtUHJvcGVydGllcy5ub25JYWJWZW5kb3JMaXN0VXJsLCByID0ge30sIGUubmV4dCA9IDQsIHN0LnRyeUdyb3VwQ29va2llQWNjZXNzQ2FsbCgnZ2V0JywgcSwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyA9IGUuc2VudCwgSmUuc3RvcmVkSGFzaCA9IG8sIGUubmV4dCA9IDgsIHN0LnRyeUdyb3VwQ29va2llQWNjZXNzQ2FsbCgnZ2V0JywgaiwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci52ZW5kb3JDb29raWVWYWx1ZSA9IGUuc2VudCwgIW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxNTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSAxMiwgc3QudHJ5R3JvdXBDb29raWVBY2Nlc3NDYWxsKCdnZXQnLCBHLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaSA9IGUuc2VudCkgJiYgQXJyYXkuaXNBcnJheShpKSA/IGkgPSBpWzBdIDogaSB8fCAoaSA9IG51bGwpLCByLm5vbklhYkNvb2tpZVZhbHVlID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDIxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDE4LCBzdC50cnlHcm91cENvb2tpZUFjY2Vzc0NhbGwoJ2dldCcsIEosICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChzID0gZS5zZW50KSAmJiBBcnJheS5pc0FycmF5KHMpID8gcyA9IHNbMF0gOiBzIHx8IChzID0gbnVsbCksIHIuZ29vZ2xlQ29va2llVmFsdWUgPSBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDIxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJydXB0KCdyZXR1cm4nLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldERhdGFVc2luZ0ZpcnN0UGFydHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0ge30sIHQgPSBGZS5jb3JlQ29uZmlnLmdvb2dsZUVuYWJsZWQsIG4gPSBGZS5wcmVtaXVtUHJvcGVydGllcy5ub25JYWJWZW5kb3JMaXN0VXJsLCByID0gR2UuZ2V0KGopLCBvID0gR2UuZ2V0KHEpLCBpID0gR2UuZ2V0KEcpLCBzID0gR2UuZ2V0KEopOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSmUuc3RvcmVkSGFzaCA9IG8sICdzdHJpbmcnID09PSB0eXBlb2YgciAmJiAoZS52ZW5kb3JDb29raWVWYWx1ZSA9IHIpLCB0ICYmICdzdHJpbmcnID09PSB0eXBlb2YgcyAmJiAoZS5nb29nbGVDb29raWVWYWx1ZSA9IHMpLCBuICYmICdzdHJpbmcnID09PSB0eXBlb2YgaSAmJiAoZS5ub25JYWJDb29raWVWYWx1ZSA9IGkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAncmVwcm9tcHREdWVUb0ludmFsaWRDTVBJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB1KGEuYS5tYXJrKGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgciwgbywgaSwgcywgYywgdSwgcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID0gRmUuY29yZUNvbmZpZy5pc0FNUCwgbiA9ICExLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMjU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociA9ICdodHRwczovL3Rlc3QucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvR1ZMLXYyL2NtcC1saXN0Lmpzb24nLCBvID0gW10sIGkgPSBuZXcgRGF0ZSgpLCBzID0gR2UuZ2V0KEIpLCAhKChjID0gcyAmJiAhcy5tZXNzYWdlID8gSlNPTi5wYXJzZShzKSA6IG51bGwpICYmIGMuQ01QICYmIGMuQ01QLmluY2x1ZGVzKFN0cmluZyhXZS5jbXBJZCkpICYmIGkuZ2V0VGltZSgpIDwgYy5leHBpcnkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gITEsIGUubmV4dCA9IDI1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcmV2ID0gMTIsIGUubmV4dCA9IDE1LCBjZS5nZXQocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gZS5zZW50LCBvLnB1c2guYXBwbHkobywgeGUoT2JqZWN0LmtleXModS5kYXRhLmNtcHMpKSksIHAgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFVwZGF0ZWQ6IHUuZGF0YS5sYXN0VXBkYXRlZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDTVA6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJ5OiBpLmdldFRpbWUoKSArIDI1OTIwMDAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgR2Uuc2V0KEIsIEpTT04uc3RyaW5naWZ5KHApKSwgZS5uZXh0ID0gMjQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHJldiA9IDIxLCBlLnQwID0gZS5jYXRjaCgxMiksIGNvbnNvbGUubG9nKGUudDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICFvLmluY2x1ZGVzKFN0cmluZyhXZS5jbXBJZCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJydXB0KCdyZXR1cm4nLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyNjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgbnVsbCwgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdyZXByb21wdER1ZVRvT3V0ZGF0ZWRHdmwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdShhLmEubWFyayhmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIsIG8sIGksIHMsIGMsIHUsIHAsIGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9IEZlLmNvcmVDb25maWcudmVuZG9yTGlzdFVwZGF0ZUZyZXEsIHRoaXMuX2Nvb2tpZVZhbHVlcy5mZXRjaGVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSA0LCB0aGlzLl9jb29raWVWYWx1ZXMucHJvbWlzZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSBMZSh6ZS5kZWNvZGUsIHRoaXMuX2Nvb2tpZVZhbHVlcy5ldWNvbnNlbnQpLCByID0gITEsICFuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobyA9IG4udmVuZG9yTGlzdFZlcnNpb24sIGkgPSBuLnBvbGljeVZlcnNpb24sIHMgPSBuLmxhc3RVcGRhdGVkLCBjID0gRGF0ZS5ub3coKSAtIHMuZ2V0VGltZSgpID4gODY0MDAwMDAgKiB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hYnJ1cHQoJ3JldHVybicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRkYXRlZEd2bFJlcHJvbXB0OiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlY29kZWRFdUNvbnNlbnQ6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDExOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDEzLCB0aGlzLmxvYWRHVkwoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBXZS5ndmwsIHAgPSB1LnZlbmRvckxpc3RWZXJzaW9uLCBsID0gdS50Y2ZQb2xpY3lWZXJzaW9uLCBjICYmIChwID4gbyB8fCBsID4gaSkgJiYgKHIgPSAhMCksIGUubmV4dCA9IDE4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hYnJ1cHQoJ3JldHVybicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRkYXRlZEd2bFJlcHJvbXB0OiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlY29kZWRFdUNvbnNlbnQ6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZmV0Y2hEYXRhVG9SZXByb21wdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB1KGEuYS5tYXJrKGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgciwgbywgczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSAyLCBQcm9taXNlLmFsbChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yZXByb21wdER1ZVRvT3V0ZGF0ZWRHdmwoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJlcHJvbXB0RHVlVG9JbnZhbGlkQ01QSUQoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gZS5zZW50LCBuID0gVmUodCwgMiksIHIgPSBuWzBdLm91dGRhdGVkR3ZsUmVwcm9tcHQsIG8gPSBuWzFdLCAocyA9IHIgfHwgbykgfHwgKEplLnNldFZhbHVlcyhpKGkoe30sIHRoaXMuX2Nvb2tpZVZhbHVlcyksIHt9LCB7IG5vbklhYlZlbmRvcnNIYXNoOiBIZS5kYXRhLmRhdGEubm9uSWFiVmVuZG9yc0hhc2ggfSkpLCBzID0gSmUuc2hvdWxkUmVwcm9tcHQoKSksIGUuYWJydXB0KCdyZXR1cm4nLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAncG9wdWxhdGVDb3JlQ29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbywgaSA9IF8uTk9OX0lBQiwgcyA9IF8uUFVSUE9TRVMsIGEgPSBfLkxFR0lUSU1BVEVfUFVSUE9TRVMsIGMgPSBfLkxFR0lUSU1BVEVfVkVORE9SUywgdSA9IF8uVkVORE9SUywgcCA9IF8uU1BFQ0lBTF9GRUFUVVJFUywgbCA9IF8uR09PR0xFLCBkID0gJycsIGYgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgaToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSAnbm9uSWFiQ29uc2VudHMnLCBkID0gJ3ZlbmRvckNvbnNlbnRzJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gJ3ZlbmRvckNvbnNlbnRzJywgZCA9ICd2ZW5kb3JDb25zZW50cycsIGYgPSAncHVibGlzaGVyQ29uc2VudHMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgczoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSAncHVycG9zZXNDb25zZW50cycsIGQgPSAncHVycG9zZUNvbnNlbnRzJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gJ2xlZ2l0aW1hdGVQdXJwb3Nlc0NvbnNlbnRzJywgZCA9ICdwdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBjOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICd2ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3QnLCBkID0gJ3ZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMnLCBmID0gJ3B1Ymxpc2hlckxlZ2l0aW1hdGVJbnRlcmVzdHMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgcDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSAnc3BlY2lhbEZlYXR1cmVzJywgZCA9ICdzcGVjaWFsRmVhdHVyZU9wdGlucyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBsOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICdnb29nbGVDb25zZW50cycsIGQgPSAnY29uc2VudElkcyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IG51bGwgIT09IHIgJiYgIXIubWVzc2FnZSwgdiA9IEZlLmNvcmVDb25maWcucHVibGlzaGVyTmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVbb10uaGFzQ29va2llID0gaCwgaCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBpOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB5LCBnID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgPT09IHR5cGVvZiBTeW1ib2wgfHwgbnVsbCA9PSBlW1N5bWJvbC5pdGVyYXRvcl0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkgfHwgKGUgPSBUZShlKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gMCwgbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG46IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPj0gZS5sZW5ndGggPyB7IGRvbmU6ICEwIH0gOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlW3QrK10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ludmFsaWQgYXR0ZW1wdCB0byBpdGVyYXRlIG5vbi1pdGVyYWJsZSBpbnN0YW5jZS5cbkluIG9yZGVyIHRvIGJlIGl0ZXJhYmxlLCBub24tYXJyYXkgb2JqZWN0cyBtdXN0IGhhdmUgYSBbU3ltYm9sLml0ZXJhdG9yXSgpIG1ldGhvZC4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8sIGkgPSAhMCwgcyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBlW1N5bWJvbC5pdGVyYXRvcl0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSByLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID0gZS5kb25lLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9ICEwLCBvID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpIHx8IG51bGwgPT0gci5yZXR1cm4gfHwgci5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZy5zKCk7ICEoeSA9IGcubigpKS5kb25lOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0geS52YWx1ZSwgYiA9IHJbZF1bbS5pZF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtvXVttLmlkXSA9IGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcuZShFKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcuZigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBsOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuY29uc2VudElkcyAmJiByLmNvbnNlbnRJZHMuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW29dW3RdID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyW2RdICYmIChyW2RdLmZvckVhY2goZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbb11bbl0gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIEMgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMgPT09IHYgJiYgKGVbb11bQ10gPSB4ZShyW2ZdLnNldF8pLmxlbmd0aCA+IDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZm9ybWF0Q29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IDAsIG4gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHBhcnNlSW50KHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNOYU4obykgfHwgKG8gPiB0ICYmICh0ID0gbyksIG4ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudDogZVtyXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50QXJyYXk6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhWZW5kb3JJZDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZm9ybWF0R29vZ2xlQ29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUuZ29vZ2xlQ29uc2VudHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhMCA9PT0gZS5nb29nbGVDb25zZW50c1tuXSAmJiB0LnB1c2gobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnNvcnQoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIC0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdyZWd1bGF0aW9uVG9Jbml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHUoYS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByLCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPSBGZS5jb3JlQ29uZmlnLnByaXZhY3lNb2RlLCBuID0gJycsICF0LmluY2x1ZGVzKCdVU1AnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDE0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPSBGZS5jb3JlQ29uZmlnLnVzcEp1cmlzZGljdGlvbiwgIUJlLmlzVXNlckluVVMgfHwgIXIubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodWUoJ2luaXRVc3BMb2NhdGlvbjogVVMnKSwgci5pbmNsdWRlcygnVVMnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDEzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDksIEJlLmNoZWNrU3BlY2lmaWNMb2NhdGlvbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ZSgnaW5pdFVzcExvY2F0aW9uOiBzcGVjaWZpYyBsb2NhdGlvbicgKyBKU09OLnN0cmluZ2lmeShCZS51c2VyU3BlY2lmaWNMb2NhdGlvbikpLCBCZS51c2VyU3BlY2lmaWNMb2NhdGlvbiAmJiBCZS51c2VyU3BlY2lmaWNMb2NhdGlvbi5yZWdpb24gJiYgci5pbmNsdWRlcyhCZS51c2VyU3BlY2lmaWNMb2NhdGlvbi5yZWdpb24udG9VcHBlckNhc2UoKSkgJiYgKG4gPSAnVVNQJyksIGUubmV4dCA9IDE0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gJ1VTUCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5pbmNsdWRlcygnR0RQUicpICYmICdVU1AnICE9PSBuICYmIChvID0gRmUuY29yZUNvbmZpZy5kaXNwbGF5VWksIChCZS5pc1VzZXJJbkVVICYmICdpbkVVJyA9PT0gbyB8fCAnYWx3YXlzJyA9PT0gbykgJiYgKG4gPSAnR0RQUicpKSwgZS5hYnJ1cHQoJ3JldHVybicsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnbG9hZEdWTCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB1KGEuYS5tYXJrKGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgciwgbywgaSwgcywgYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID0gRmUuY29yZUNvbmZpZywgbiA9IHQucHJpdmFjeU1vZGUsIHIgPSB0LmxhbmdfLCBvID0gRmUucHJlbWl1bVByb3BlcnRpZXMsIGkgPSBvLnZlbmRvcldoaXRlbGlzdCwgcyA9IG8udmVuZG9yQmxhY2tsaXN0LCBjID0gbnVsbCA9PT0gciB8fCB2b2lkIDAgPT09IHIgPyB2b2lkIDAgOiByLnRvVXBwZXJDYXNlKCksIFdlLmd2bCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDEyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFdlLmd2bCA9IG5ldyByZS5HVkwoJ0xBVEVTVCcpLCBlLm5leHQgPSA2LCBXZS5ndmwucmVhZHlQcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4uaW5jbHVkZXMoJ0dEUFInKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDksIFdlLmd2bC5jaGFuZ2VMYW5ndWFnZShjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5maWx0ZXJHdmwoV2UuZ3ZsLCBpLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDE0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gMTQsIFdlLmd2bC5yZWFkeVByb21pc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hYnJ1cHQoJ3JldHVybicsIFdlLmd2bCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdmaWx0ZXJHdmwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUudmVuZG9ycywgbyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhyKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLnB1c2gocltlXS5pZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0Lmxlbmd0aCAmJiAobyA9IHQuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5pbmNsdWRlcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBuLmxlbmd0aCA/IGUubmFycm93VmVuZG9yc1RvKG8uZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIW4uaW5jbHVkZXMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSA6IGUubmFycm93VmVuZG9yc1RvKG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnaGFzQ29va2llJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF0aGlzLl9jb29raWVWYWx1ZXMuZXVjb25zZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0UHVibGlzaGVyUmVzdHJpY3Rpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXZS5wdWJsaXNoZXJSZXN0cmljdGlvbnMuYWRkKGUuaWQsIGUucHVycG9zZVJlc3RyaWN0aW9uKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2Nvb2tpZVZhbHVlcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9jb29raWVWYWx1ZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdmZXRjaENvb2tpZXNDYWxsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZmV0Y2hDb29raWVzQ2FsbGVkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCBaZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAodGhpcywgZSksIHRoaXMuX2RhdGEgPSB2b2lkIDAsIHRoaXMuX2ZpZWxkcyA9IHZvaWQgMCwgdGhpcy5fZmllbGRzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZWQ6IG5ldyBEYXRlKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFVwZGF0ZWQ6IG5ldyBEYXRlKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wSWQ6IDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcFZlcnNpb246IDI2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heFZlbmRvcklkOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckNvbnNlbnRzOiBbXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5fZGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25JYWJWZW5kb3JMaXN0OiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVBdDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yc0hhc2g6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2RhdGEgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9kYXRhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZmllbGRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2ZpZWxkcyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2ZpZWxkczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKSwgWGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKHRoaXMsIGUpLCB0aGlzLl9kYXRhID0gdm9pZCAwLCB0aGlzLmNyZWF0ZWQgPSB2b2lkIDAsIHRoaXMuX2RhdGEgPSBuZXcgWmUoKSwgdGhpcy5jcmVhdGVkID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2VuY29kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bZS5pZF0gPSBlLmNvbnNlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAhMSA9PT0gdGhpcy5jcmVhdGVkID8gKHRoaXMuY3JlYXRlZCA9ICEwLCB0aGlzLl9kYXRhLmZpZWxkcyA9IGkoaSh7fSwgdGhpcy5fZGF0YS5maWVsZHMpLCB7fSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yQ29uc2VudHM6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVkOiBuZXcgRGF0ZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFVwZGF0ZWQ6IG5ldyBEYXRlKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhWZW5kb3JJZDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgOiB0aGlzLl9kYXRhLmZpZWxkcyA9IGkoaSh7fSwgdGhpcy5fZGF0YS5maWVsZHMpLCB7fSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yQ29uc2VudHM6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0VXBkYXRlZDogbmV3IERhdGUoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgR2UuZW5jb2RlKGkoeyBjb29raWVOYW1lOiBHIH0sIHRoaXMuX2RhdGEuZmllbGRzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkZWNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gR2UuZGVjb2RlKEcsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0Q29va2llJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgPT09IHR5cGVvZiBlID8gR2Uuc2V0KEcsIGUpIDogY29uc29sZS5lcnJvcihlLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Q29va2llJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IEdlLmdldChHKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ3N0cmluZycgPT09IHR5cGVvZiBlID8gdGhpcy5kZWNvZGUoZSkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZmV0Y2hMaXN0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHUoYS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEZlLnByZW1pdW1Qcm9wZXJ0aWVzLm5vbklhYlZlbmRvckxpc3RVcmwgfHwgRmUubm9uSWFiVmVuZG9yc0luZm8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJydXB0KCdyZXR1cm4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUucHJldiA9IDIsICd1bmRlZmluZWQnID09PSB0eXBlb2YgRmUubm9uSWFiVmVuZG9yc0luZm8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEZlLm5vbklhYlZlbmRvcnNJbmZvLm5vbklhYlZlbmRvckxpc3QgJiYgMCAhPT0gRmUubm9uSWFiVmVuZG9yc0luZm8ubm9uSWFiVmVuZG9yTGlzdC5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJydXB0KCdyZXR1cm4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IEZlLm5vbklhYlZlbmRvcnNJbmZvLCBlLm5leHQgPSAxMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gMTEsIGNlLmdldChGZS5wcmVtaXVtUHJvcGVydGllcy5ub25JYWJWZW5kb3JMaXN0VXJsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBlLnNlbnQsIHQgPSBuLmRhdGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gW10sIHQubm9uSWFiVmVuZG9yTGlzdC5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGUubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGUudmVuZG9ySWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvbGljeVVybDogISFlLnByaXZhY3lQb2xpY3lVcmwgJiYgZS5wcml2YWN5UG9saWN5VXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogISFlLmRlc2NyaXB0aW9uICYmIGUuZGVzY3JpcHRpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VzOiAnbm9uSWFiUHVycG9zZUNvbnNlbnRJZHMnIGluIGUgJiYgZS5ub25JYWJQdXJwb3NlQ29uc2VudElkcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVnSW50UHVycG9zZXM6ICdub25JYWJQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0SWRzJyBpbiBlICYmIGUubm9uSWFiUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5wdXNoKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHRoaXMuX2RhdGEuZGF0YSA9IGkoaSh7fSwgdCksIHt9LCB7IG5vbklhYlZlbmRvckxpc3Q6IHIgfSksIGUubmV4dCA9IDIxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXYgPSAxOCwgZS50MCA9IGUuY2F0Y2goMiksIGNvbnNvbGUubG9nKCdlcnJvciBwcm9jZXNzaW5nIG5vbklhYlZlbmRvcnMnLCBlLnQwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgdGhpcywgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2RhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKSwgJGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKHRoaXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdlbmNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgciwgbywgaSwgcywgYSwgYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gR2UuZW5jb2RlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZU5hbWU6IGosCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JDb25zZW50czogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VDb25zZW50czogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxGZWF0dXJlT3B0aW5zOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0czogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyQ29uc2VudDogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlckxlZ2l0aW1hdGU6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJQdXJwb3NlSWRzOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkczogYwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2RlY29kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBHZS5kZWNvZGUoaiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXRDb29raWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PT0gdHlwZW9mIGUgPyBHZS5zZXQoaiwgZSwgITEpIDogY29uc29sZS5lcnJvcihlLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Q29va2llJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IEdlLmdldChqKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ3N0cmluZycgPT09IHR5cGVvZiBlID8gdGhpcy5kZWNvZGUoZSkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCBldCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAodGhpcywgZSksIHRoaXMuX3VzcFZlcnNpb24gPSB2b2lkIDAsIHRoaXMuX2Jhc2VTdHJpbmcgPSB2b2lkIDAsIHRoaXMuX25vdGljZWdpdmVuID0gdm9pZCAwLCB0aGlzLl9vcHRlZG91dCA9IHZvaWQgMCwgdGhpcy5fbHNwYWN0ID0gdm9pZCAwLCB0aGlzLl91c3BWZXJzaW9uID0gMSwgdGhpcy5fbm90aWNlZ2l2ZW4gPSAnLScsIHRoaXMuX29wdGVkb3V0ID0gJy0nLCB0aGlzLl9sc3BhY3QgPSAnLScsIHRoaXMuX2Jhc2VTdHJpbmcgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdiYXNlU3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2Jhc2VTdHJpbmcgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9iYXNlU3RyaW5nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnbm90aWNlZ2l2ZW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fbm90aWNlZ2l2ZW4gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9ub3RpY2VnaXZlbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ29wdGVkb3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX29wdGVkb3V0ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fb3B0ZWRvdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdsc3BhY3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fbHNwYWN0ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fbHNwYWN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAndXNwVmVyc2lvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl91c3BWZXJzaW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCB0dCA9IC9eWzFdW25OeVktXVtuTnlZLV1bbk55WS1dJC8sIG50ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcCh0aGlzLCBlKSwgdGhpcy5fZGF0YSA9IHZvaWQgMCwgdGhpcy5fZGF0YSA9IG5ldyBldCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdlbmNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZGF0YS5iYXNlU3RyaW5nID0gJycuY29uY2F0KGUsICdZJykuY29uY2F0KHQgPyAnWScgOiAnTicpLmNvbmNhdChGZS5jb3JlQ29uZmlnLnVzcExzcGFjdCksIHRoaXMuX2RhdGEuYmFzZVN0cmluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldENvb2tpZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2YgZSA/IHR0LnRlc3QoZSkgJiYgR2Uuc2V0KHosIGUsICExKSA6IGUgJiYgJ21lc3NhZ2UnIGluIGUgJiYgY29uc29sZS5lcnJvcihlLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Q29va2llJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gR2UuZ2V0KHopOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCBydCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKHRoaXMsIGUpLCB0aGlzLl9jb29raWVBY2Nlc3NJZnJhbWUgPSB2b2lkIDAsIHRoaXMuX2lzQ29va2llQWNjZXNzSWZyYW1lUmVhZHkgPSB2b2lkIDAsIHRoaXMuZ3JvdXBDb29raWVBY2Nlc3NDYWxsYmFja3MgPSB2b2lkIDAsIHRoaXMuX2Nvb2tpZUFjY2Vzc0lmcmFtZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2lmcmFtZScpLCB0aGlzLl9pc0Nvb2tpZUFjY2Vzc0lmcmFtZVJlYWR5ID0gITEsIHRoaXMuZ3JvdXBDb29raWVBY2Nlc3NDYWxsYmFja3MgPSB7fSwgdGhpcy5ncm91cENvb2tpZUFjY2Vzc0hhbmRsZXIgPSB0aGlzLmdyb3VwQ29va2llQWNjZXNzSGFuZGxlci5iaW5kKHRoaXMpLCB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lciA/IHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgdGhpcy5ncm91cENvb2tpZUFjY2Vzc0hhbmRsZXIsICExKSA6IHdpbmRvdy5hdHRhY2hFdmVudCgnb25tZXNzYWdlJywgdGhpcy5ncm91cENvb2tpZUFjY2Vzc0hhbmRsZXIpLCB0aGlzLmNyZWF0ZUdyb3VwQ29va2llQWNjZXNzSWZyYW1lKHQuY29yZUNvbmZpZy5jb25zZW50U2NvcGVHcm91cFVSTCwgJ19xY19jb29raWVfYWNjZXNzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3RyeUdyb3VwQ29va2llQWNjZXNzQ2FsbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKGZ1bmN0aW9uIChvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHNldEludGVydmFsKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLl9pc0Nvb2tpZUFjY2Vzc0lmcmFtZVJlYWR5ICYmIHIuX2Nvb2tpZUFjY2Vzc0lmcmFtZS5jb250ZW50V2luZG93ICYmIChjbGVhckludGVydmFsKGkpLCByLmdyb3VwQ29va2llQWNjZXNzQ2FsbChlLCB0LCBuLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDUwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdncm91cENvb2tpZUFjY2Vzc0NhbGwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IE1hdGgucmFuZG9tKCkudG9TdHJpbmcoKSwgaSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsSWQ6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX19xY0NtcENvb2tpZUFjY2Vzc0NhbGw6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21kOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29raWVOYW1lOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzZXQnID09PSBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmdyb3VwQ29va2llQWNjZXNzQ2FsbGJhY2tzW29dID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZU5hbWU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llVmFsdWU6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG5ldyBEYXRlKERhdGUubm93KCkgKyAzMzY5NjAwMDAwMCkudG9VVENTdHJpbmcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuX19xY0NtcENvb2tpZUFjY2Vzc0NhbGwuY29va2llVmFsdWUgPSBuLCBpLl9fcWNDbXBDb29raWVBY2Nlc3NDYWxsLmNvb2tpZVBhdGggPSBGZS5jb3JlQ29uZmlnLmNvb2tpZVBhdGgsIGkuX19xY0NtcENvb2tpZUFjY2Vzc0NhbGwuZXhwaXJlcyA9IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ncm91cENvb2tpZUFjY2Vzc0NhbGxiYWNrc1tvXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29raWVOYW1lOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmU6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2Nvb2tpZUFjY2Vzc0lmcmFtZS5jb250ZW50V2luZG93LnBvc3RNZXNzYWdlKGksICcqJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdjcmVhdGVHcm91cENvb2tpZUFjY2Vzc0lmcmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcy5fY29va2llQWNjZXNzSWZyYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnNyYyA9IGUsIG4uc3R5bGUuZGlzcGxheSA9ICdub25lJywgbi5pZCA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keSA/IGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQobikgOiBzZXRUaW1lb3V0KGUsIDUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdncm91cENvb2tpZUFjY2Vzc0hhbmRsZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0ID0gJ3N0cmluZycgPT09IHR5cGVvZiBlLmRhdGEgPyAtMSAhPT0gZS5kYXRhLmluZGV4T2YoJ19fcWNDbXBDb29raWVBY2Nlc3NSZXR1cm4nKSA/IEpTT04ucGFyc2UoZS5kYXRhKSA6IHt9IDogZS5kYXRhKS5fX3FjQ21wQ29va2llQWNjZXNzUmV0dXJuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5fX3FjQ21wQ29va2llQWNjZXNzUmV0dXJuLmlzSGFuZGxlclJlZ2lzdGVyZWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgKHRoaXMuX2lzQ29va2llQWNjZXNzSWZyYW1lUmVhZHkgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuX19xY0NtcENvb2tpZUFjY2Vzc1JldHVybiwgciA9IHRoaXMuZ3JvdXBDb29raWVBY2Nlc3NDYWxsYmFja3NbdC5jYWxsSWRdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIucmVzb2x2ZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ2V0JyA9PT0gbi5jbWQgJiYgKG8gPSAtMSAhPT0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXVjb25zZW50LXYyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FkZHRsX2NvbnNlbnQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5pbmRleE9mKHIuY29va2llTmFtZSkgPyAnZXVjb25zZW50LXYyJyA9PT0gci5jb29raWVOYW1lID8gdGhpcy5yZXR1cm5MYXRlc3RWZW5kb3JDb29raWUobi5jb29raWVzKSA6IG4uaXNTdWNjZXNzID8gbi5jb29raWVzWzBdIDogbnVsbCA6IG4uY29va2llcywgci5yZXNvbHZlKG8pKSwgZGVsZXRlIHRoaXMuZ3JvdXBDb29raWVBY2Nlc3NDYWxsYmFja3NbdC5jYWxsSWRdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdyZXR1cm5MYXRlc3RWZW5kb3JDb29raWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLmxlbmd0aCA/IGJ0KGUpIDogbmV3IEVycm9yKCdldWNvbnNlbnQtdjIgbm90IGZvdW5kLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnaXNDb29raWVBY2Nlc3NJZnJhbWVSZWFkeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmlzQ29va2llQWNjZXNzSWZyYW1lUmVhZHk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdjb29raWVBY2Nlc3NJZnJhbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fY29va2llQWNjZXNzSWZyYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCBvdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAodGhpcywgZSksIHRoaXMudmVyc2lvbiA9IHZvaWQgMCwgdGhpcy5fZGF0YSA9IHZvaWQgMCwgdGhpcy53aGl0ZWxpc3QgPSB2b2lkIDAsIHRoaXMudmVyc2lvbiA9IDEsIHRoaXMuX2RhdGEgPSBbXSwgdGhpcy53aGl0ZWxpc3QgPSBGZS5wcmVtaXVtUHJvcGVydGllcy5nb29nbGVXaGl0ZWxpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2VuY29kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBHZS5lbmNvZGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llTmFtZTogSiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckNvbnNlbnRzOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogdGhpcy52ZXJzaW9uCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZGVjb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEdlLmRlY29kZShKLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldENvb2tpZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2YgZSA/IEdlLnNldChKLCBlLCAhMSkgOiBjb25zb2xlLmVycm9yKGUubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXRDb29raWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEdlLmdldChKKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgJ3N0cmluZycgPT09IHR5cGVvZiB0ID8gZSA/IHQgOiB0aGlzLmRlY29kZSh0KSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdmZXRjaFBhcnRuZXJzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChGZS5jb3JlQ29uZmlnLmdvb2dsZUVuYWJsZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShlLndoaXRlbGlzdCkgPT09IEpTT04uc3RyaW5naWZ5KFstMV0pID8gKGUuX2RhdGEgPSBbXSwgdChlLl9kYXRhKSkgOiBlLl9kYXRhLmxlbmd0aCA+IDAgPyB0KGUuX2RhdGEpIDogY2UuZ2V0KCdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL3RjZnYyL2dvb2dsZS1hdHAtbGlzdC5qc29uJykudGhlbihmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvIGluIG4uZGF0YSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuLmRhdGFbb107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBpLnByb3ZpZGVyX2lkICYmICcnICE9PSBpLnByb3ZpZGVyX2lkICYmIChKU09OLnN0cmluZ2lmeShlLndoaXRlbGlzdCkgPT09IEpTT04uc3RyaW5naWZ5KFsxXSkgfHwgZS53aGl0ZWxpc3QubGVuZ3RoID4gMCAmJiBlLndoaXRlbGlzdC5pbmNsdWRlcyhwYXJzZUludChpLnByb3ZpZGVyX2lkKSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGkucHJvdmlkZXJfbmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGkucHJvdmlkZXJfaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvbGljeVVybDogaS5wb2xpY3lfdXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogaS5kb21haW5zCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnB1c2gocyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9kYXRhID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGUuX2RhdGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb25zb2xlLmxvZyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2RhdGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdKSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICByZS5HVkwuYmFzZVVybCA9ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL0dWTC12Mi8nLCByZS5HVkwubGF0ZXN0RmlsZW5hbWUgPSAndmVuZG9yLWxpc3QtdHJpbW1lZC12MS5qc29uJzsKICAgICAgICAgICAgICAgIHZhciBpdCwgc3QsIGF0ID0gbmV3IHNlKCksIGN0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHUoYS5hLm1hcmsoZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciwgbywgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gKEZlID0gdCkuY29yZUNvbmZpZywgciA9IG4ucHJpdmFjeU1vZGUsIG8gPSBuLnB1Ymxpc2hlckNvdW50cnlDb2RlLCBpID0gbi5zaG93U3VtbWFyeVZpZXcsICcnLCBpdCA9ICcnLCBOZSA9IG5ldyBRZSgpLCBCZSA9IG5ldyBwZSgnaW5VUycpLCBqZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHUoYS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSAnJywgZS5wcmV2ID0gMSwgZS5uZXh0ID0gNCwgTmUucmVndWxhdGlvblRvSW5pdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1VTUCcgPT09ICh0ID0gZS5zZW50KSB8fCByLmluY2x1ZGVzKCdVU1AnKSA/IFN0LmluaXRVc3AoKSA6IChuID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnZXRVU1BEYXRhJyA9PT0gZSAmJiAxID09PSB0ICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiBuICYmIG4oewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNwU3RyaW5nOiAnMS0tLScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgT2JqZWN0LmFzc2lnbih3aW5kb3csIHsgX191c3BhcGk6IG4gfSkpLCBlLm5leHQgPSAxMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXYgPSA4LCBlLnQwID0gZS5jYXRjaCgxKSwgY29uc29sZS5sb2coZS50MCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJydXB0KCdyZXR1cm4nLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIG51bGwsIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgR2UgPSBuZXcgT2UoKSwgSGUgPSBuZXcgWGUoKSwgcWUgPSBuZXcgbnQoKSwgemUgPSBuZXcgJGUoKSwgS2UgPSBuZXcgb3QoKSwgSmUgPSBuZXcgd2UoKSwgV2UgPSBudWxsLCBZZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHUoYS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIsIGksIHMsIGMgPSBhcmd1bWVudHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPSBjLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBjWzBdICYmIGNbMF0sICgociA9ICdHRFBSJyA9PT0gaXQpIHx8IHQpICYmICgoV2UgPSBuZXcgb2UuVENNb2RlbCgpKS5jbXBJZCA9IDEwLCBXZS5jbXBWZXJzaW9uID0gRiwgV2UucHVibGlzaGVyQ291bnRyeUNvZGUgPSBvLCBXZS5pc1NlcnZpY2VTcGVjaWZpYyA9ICEwLCBpID0gSWUoRmUpLCAocyA9IGkucHVycG9zZUlkcykuaW5jbHVkZXMoMSkgfHwgKCdERScgPT09IG8gPyBXZS5wdXJwb3NlT25lVHJlYXRtZW50ID0gITAgOiBzLnB1c2goMSkpKSwgZS5wcmV2ID0gMywgIXIgJiYgIXQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDEyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDcsIE5lLmZldGNoQ29va2llVmFsdWVzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gOSwgSGUuZmV0Y2hMaXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gMTEsIE5lLmZldGNoRGF0YVRvUmVwcm9tcHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDExOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gZS5zZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDE3OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXYgPSAxNCwgZS50MCA9IGUuY2F0Y2goMyksIGNvbnNvbGUuZXJyb3IoZS50MCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJydXB0KCdyZXR1cm4nLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIG51bGwsIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIGUubmV4dCA9IDE3LCBqZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGl0ID0gZS5zZW50LCBlLm5leHQgPSAyMCwgWWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc2VudCAmJiAnR0RQUicgPT09IGl0ID8gYXQuZGlzcGxheVVpKCdHRFBSJywgaSA/IDAgOiAxLCAhMCkgOiBOZS51cGRhdGVBcGlWaXNpYmxlKGl0LCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KCksIHV0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoaShpKGkoe30sIGUuY29yZUNvbmZpZyksIGUucHJlbWl1bVByb3BlcnRpZXMpLCBlLmNvcmVVaUxhYmVscyksIGUucHJlbWl1bVVpTGFiZWxzKTsKICAgICAgICAgICAgICAgICAgICB9LCBwdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLmZsb29yKGUuZ2V0VGltZSgpIC8gMTAwKTsKICAgICAgICAgICAgICAgICAgICB9LCBsdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgRGF0ZSgxMDAgKiBlKTsKICAgICAgICAgICAgICAgICAgICB9LCBkdCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0LmtleXModCkuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgPT09IGUuaW5kZXhPZih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmxlbmd0aCAmJiAodC5ub3RGb3VuZCA9IG4pLCB0OwogICAgICAgICAgICAgICAgICAgIH0sIGZ0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIWUgJiYgJ2Fsd2F5cycgIT09IHQpOwogICAgICAgICAgICAgICAgICAgIH0sIGh0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgdC5sZW5ndGggPiAwID8gKHQuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBlW3RdID8gblt0XSA9IGVbdF0gOiBuW3RdID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgfSwgdnQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG5ldyBEYXRlKERhdGUubm93KCkgKyAxMDAwICogZS5tYXhBZ2UpLnRvVVRDU3RyaW5nKCksIG4gPSAnaHR0cHM6JyA9PT0gd2luZG93LmxvY2F0aW9uLnByb3RvY29sID8gJztTYW1lU2l0ZT1MYXg7c2VjdXJlJyA6ICcnLCByID0gRmUuY29yZUNvbmZpZy5jb29raWVQYXRoIHx8ICcvJzsKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuY29va2llID0gZS5jb29raWVOYW1lICsgJz0nICsgZS5lbmNvZGVkVmFsdWUgKyAnO3BhdGg9JyArIHIgKyAnO21heC1hZ2U9JyArIGUubWF4QWdlICsgJztleHBpcmVzPScgKyB0ICsgJztkb21haW49JyArIEZlLmNvcmVDb25maWcuY29va2llRG9tYWluICsgbjsKICAgICAgICAgICAgICAgICAgICB9LCB5dCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZS5UQ1N0cmluZy5lbmNvZGUoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZ3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQWUuVENTdHJpbmcuZGVjb2RlKGUpOwogICAgICAgICAgICAgICAgICAgIH0sIG10ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2ZpcmVmb3gnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IG5hdmlnYXRvci51c2VyQWdlbnQudG9Mb3dlckNhc2UoKS5pbmRleE9mKGUpID4gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc2FmYXJpJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBuYXZpZ2F0b3IudXNlckFnZW50LnRvTG93ZXJDYXNlKCkuaW5kZXhPZihlKSA+IC0xICYmIC0xID09PSBuYXZpZ2F0b3IudXNlckFnZW50LnRvTG93ZXJDYXNlKCkuaW5kZXhPZignY2hyb21lJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgYnQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG51bGwsIG4gPSBuZXcgRXJyb3IoJ2V1Y29uc2VudC12MiBub3QgdmFsaWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gZ3QoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcignRmFpbGVkIHRvIGRlY29kZSBldWNvbnNlbnQtdjIgY29va2llOiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYmIHIubGFzdFVwZGF0ZWQgJiYgci5sYXN0VXBkYXRlZCA+IHQgJiYgKHQgPSByLmxhc3RVcGRhdGVkLCBuID0gZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgIH0sIEN0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcCh0aGlzLCBlKSwgdGhpcy5jbXBBcGkgPSB2b2lkIDAsIHRoaXMuaXNJbml0aWFsaXplZCA9IHZvaWQgMCwgdGhpcy5jb25maWcgPSB2b2lkIDAsIHRoaXMuTXlDdXN0b21Db21tYW5kcyA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByID0gd2luZG93Ll9fdGNmYXBpKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmxlbmd0aCAmJiByLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmICdpbml0JyA9PT0gZVswXSAmJiAobiA9IGVbM10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHRoaXMuaXNJbml0aWFsaXplZCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSAndGhpcmRQYXJ0eVN0b3JhZ2VUeXBlJyBpbiBuLmNvcmVDb25maWcgPyBuLmNvcmVDb25maWcudGhpcmRQYXJ0eVN0b3JhZ2VUeXBlIDogJ2lmcmFtZScsIGkgPSAnY29uc2VudFNjb3BlJyBpbiBuLmNvcmVDb25maWcgPyBuLmNvcmVDb25maWcuY29uc2VudFNjb3BlIDogJ3NlcnZpY2UnLCBzID0gJ2NvbnNlbnRTY29wZUdyb3VwVVJMJyBpbiBuLmNvcmVDb25maWcgPyBuLmNvcmVDb25maWcuY29uc2VudFNjb3BlR3JvdXBVUkwgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuaW5jbHVkZXMoJ2dyb3VwJykgJiYgJ2lmcmFtZScgPT09IG8gJiYgcyAmJiAoc3QgPSBuZXcgcnQobikpLCB0aGlzLk15Q3VzdG9tQ29tbWFuZHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29uZmlnOiBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQuZ2V0Q29uZmlnKG4pLCBvID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09PSB0eXBlb2YgciAmJiAobyA9ICEwKSwgZShyLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldE5vbklBQlZlbmRvckNvbnNlbnRzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdShhLmEubWFyayhmdW5jdGlvbiBlKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDIsIHQuZ2V0Tm9uSUFCVmVuZG9yQ29uc2VudHMocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBlLnNlbnQsIGkgPSAhMSwgJ29iamVjdCcgPT09IHR5cGVvZiBvICYmIChpID0gITApLCBuKG8sIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheUNvbnNlbnRVaTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodC5kaXNwbGF5Q29uc2VudFVpKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0Q29uc2VudEluZm86IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKE5lLnNldENvbnNlbnRzKHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFB1Ymxpc2hlclJlc3RyaWN0aW9uOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZShOZS5zZXRQdWJsaXNoZXJSZXN0cmljdGlvbih0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RpZnlVaVN0YXRlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZShOZS51cGRhdGVBcGlWaXNpYmxlKHQucmVndWxhdGlvbiwgdC52aXNpYmxlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbml0OiBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0LmluaXQobikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuYWRkR2V0VENEYXRhVG9TdXBwb3J0R29vZ2xlKG4pLCB0aGlzLmNtcEFwaSA9IG5ldyBnLkNtcEFwaSgxMCwgRiwgITAsIHRoaXMuTXlDdXN0b21Db21tYW5kcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2FkZEdldFRDRGF0YVRvU3VwcG9ydEdvb2dsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZ29vZ2xlRW5hYmxlZCcgaW4gZS5jb3JlQ29uZmlnICYmIGUuY29yZUNvbmZpZy5nb29nbGVFbmFibGVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHUoYS5hLm1hcmsoZnVuY3Rpb24gZSh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBuIHx8ICdvYmplY3QnICE9PSB0eXBlb2YgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gODsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghTmUuZmV0Y2hDb29raWVzQ2FsbGVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE5lLmNvb2tpZVZhbHVlcy5mZXRjaGVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDUsIE5lLmNvb2tpZVZhbHVlcy5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IE5lLmNvb2tpZVZhbHVlcy5nb29nbGVDb29raWVWYWx1ZSwgbyA9IHIgPyBQZShyKSA6IHZvaWQgMCwgbi5hZGR0bENvbnNlbnQgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHQgJiYgKCdib29sZWFuJyA9PT0gdHlwZW9mIG4gPyB0KG4pIDogdChuLCAhMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuTXlDdXN0b21Db21tYW5kcy5nZXRUQ0RhdGEgPSB0LCB0aGlzLk15Q3VzdG9tQ29tbWFuZHMuZ2V0SW5BcHBUQ0RhdGEgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkaXNwbGF5Q29uc2VudFVpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdC5kaXNwbGF5VWkoJ0dEUFInLCAxLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdpbml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLmlzSW5pdGlhbGl6ZWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5pc0luaXRpYWxpemVkID0gITAsIHRoaXMuY29uZmlnIHx8ICh0aGlzLmNvbmZpZyA9IG5ldyBuZShlKSwgdGhpcy5jb25maWcuaW5pdGlhbGl6ZUNvbmZpZygpKSwgY3QodGhpcy5jb25maWcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oJ2luaXQgaGFzIGFscmVhZHkgYmVlbiBjYWxsZWQgYW5kIHNob3VsZCBvbmx5IGJlIHJ1biBvbmUgdGltZS4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldENvbmZpZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6ICdhbGwnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5jb25maWcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2FsbCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZUNvbmZpZzogdGhpcy5jb25maWcuY29yZUNvbmZpZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZVVpTGFiZWxzOiB0aGlzLmNvbmZpZy5jb3JlVWlMYWJlbHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZW1pdW1Qcm9wZXJ0aWVzOiB0aGlzLmNvbmZpZy5wcmVtaXVtUHJvcGVydGllcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlbWl1bVVpTGFiZWxzOiB0aGlzLmNvbmZpZy5wcmVtaXVtVWlMYWJlbHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZW1lOiB0aGlzLmNvbmZpZy50aGVtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yc0luZm86IHRoaXMuY29uZmlnLm5vbklhYlZlbmRvcnNJbmZvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ0NvcmUgQ29uZmlnJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb25maWcuY29yZUNvbmZpZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1ByZW1pdW0gUHJvcGVydGllcyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29uZmlnLnByZW1pdW1Qcm9wZXJ0aWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnQ29yZSBVSSBMYWJlbHMnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbmZpZy5jb3JlVWlMYWJlbHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdQcmVtaXVtIFVJIExhYmVscyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29uZmlnLnByZW1pdW1VaUxhYmVsczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1RoZW1lJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb25maWcudGhlbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdOb24gSWFiIFZlbmRvcnMgSW5mbyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29uZmlnLm5vbklhYlZlbmRvcnNJbmZvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHV0KHRoaXMuY29uZmlnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodFtlXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS53YXJuKCciJy5jb25jYXQoZSwgJyI6IHdhcyBub3QgZm91bmQgaW4gY29uZmlncycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcignU2hvdWxkIHJ1biBpbml0IGJlZm9yZSBydW5uaW5nIGdldENvbmZpZycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Q29uZmlnSW5zdGFuY2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbmZpZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldE5vbklBQlZlbmRvckNvbnNlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHUoYS5hLm1hcmsoZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyA9PT0gdHlwZW9mIHRoaXMuY29uZmlnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIU5lLmZldGNoQ29va2llc0NhbGxlZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoTmUuY29va2llVmFsdWVzLmZldGNoZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDUsIE5lLmNvb2tpZVZhbHVlcy5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9IExlKEhlLmRlY29kZSwgTmUuY29va2llVmFsdWVzLm5vbklhYlZlbmRvckNvbnNlbnQpLCByID0gbnVsbCwgbyA9ICdVU1AnICE9PSBpdCAmJiBmdChCZS5pc1VzZXJJbkVVLCB0aGlzLmNvbmZpZy5jb3JlQ29uZmlnLmRpc3BsYXlVaSksIG4gJiYgdCA/IHIgPSBodChuLnZlbmRvckNvbnNlbnRzLCB0KSA6IG4gJiYgKHIgPSBpKHt9LCBuLnZlbmRvckNvbnNlbnRzKSksIGUuYWJydXB0KCdyZXR1cm4nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2RwckFwcGxpZXM6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0YWRhdGE6IHIgPyBHZS5lbmNvZGUoaShpKHt9LCBuKSwge30sIHsgY29va2llTmFtZTogJ25vbmlhYnZlbmRvcmNvbnNlbnQnIH0pLCAhMCkgOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvckNvbnNlbnRzOiByIHx8IG51bGwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coJ0NvbmZpZyB3YXMgbm90IGZvdW5kJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCBfdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAodGhpcywgZSksIHRoaXMuX191c3BhcGkgPSB2b2lkIDAsIHRoaXMuX3VzcFZlcnNpb24gPSAxLCB0aGlzLmlzVXNwSnVyaXNkaWN0aW9uID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdShhLmEubWFyayhmdW5jdGlvbiBlKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8sIGksIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPSAhMCwgbyA9IEZlLmNvcmVDb25maWcsIGkgPSBvLnVzcEp1cmlzZGljdGlvbiwgby5pc0FNUCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gODsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSA1LCBCZS5jaGVja1NwZWNpZmljTG9jYXRpb24oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChzID0gZS5zZW50KSAmJiAnc3RyaW5nJyA9PT0gdHlwZW9mIHMucmVnaW9uICYmIChzID0gcy5yZWdpb24udG9VcHBlckNhc2UoKSksIGkuaW5jbHVkZXMocykgfHwgKCdmdW5jdGlvbicgPT09IHR5cGVvZiBuICYmIG4oewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogdC5fdXNwVmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzcFN0cmluZzogJzEtLS0nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKSwgciA9ICExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJywgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCB0aGlzLl9fdXNwYXBpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDogMSwgciA9IGFyZ3VtZW50cy5sZW5ndGggPiAyID8gYXJndW1lbnRzWzJdIDogdm9pZCAwLCBvID0gYXJndW1lbnRzLmxlbmd0aCA+IDMgPyBhcmd1bWVudHNbM10gOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPT09IHQuX3VzcFZlcnNpb24pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09PSB0eXBlb2YgcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBvID8gdFtlXShyLCBvKSA6IHRbZV0ocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcignVGhlIGZ1bmN0aW9uICcuY29uY2F0KGUsICcgaXMgbm90IGRlZmluZWQnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHZvaWQgMCA9PT0gcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtlXSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoJ1RoZSBmdW5jdGlvbiAnLmNvbmNhdChlLCAnIGlzIG1pc3NpbmcgcmVxdWlyZWQgcGFyYW1ldGVycycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS53YXJuKCdUaGUgdGhpcmQgcGFyYW1ldGVyIHNob3VsZCBiZSBhIGNhbGxiYWNrIGZvciB0aGUgJy5jb25jYXQoZSwgJyBmdW5jdGlvbicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybigndGhpcyBjb21tYW5kIGlzIG9ubHkgYXZhaWxhYmxlIGZvciB1c3BWZXJzaW9uIDEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2luaXRVc3AnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcywgdCA9IHRoaXMuX191c3BhcGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZlLmNvcmVDb25maWcuaXNBTVAgJiYgdGhpcy5nZXRVU1BEYXRhKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0IHx8IGUuc2V0VXNwRGZ0RGF0YShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAhMCwgbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogTC5DT05TRU5UX1JFU1BPTlNFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb246IEEuQUNDRVBULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmZvOiBlLnVzcFN0cmluZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudE1ldGFkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50U3RyaW5nVHlwZTogdy5VU1AsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByQXBwbGllczogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQgJiYgd2luZG93LnBhcmVudC5wb3N0TWVzc2FnZShuLCAnKicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuYXNzaWduKHdpbmRvdywgeyBfX3VzcGFwaTogdCB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3VzcFBpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdShhLmEubWFyayhmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT09IHR5cGVvZiB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gODsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSAzLCBCZS5jaGVja1NwZWNpZmljTG9jYXRpb24oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG4gPSBlLnNlbnQpICYmICdvYmplY3QnID09PSB0eXBlb2YgbiAmJiAobiA9IG4ucmVnaW9uKSwgdCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kZTogRmUuY29yZUNvbmZpZy5wcml2YWN5TW9kZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqdXJpc2RpY3Rpb246IEZlLmNvcmVDb25maWcudXNwSnVyaXNkaWN0aW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2F0aW9uOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcExvYWRlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKSwgZS5uZXh0ID0gOTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKCdUaGUgY2FsbGJhY2sgZnVuY3Rpb24gaXMgbWlzc2luZycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0VXNwRGZ0RGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB1KGEuYS5tYXJrKGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gRmUuY29yZUNvbmZpZy5pc0FNUCA/IG51bGwgOiBxZS5nZXRDb29raWUoKSwgZS5uZXh0ID0gNCwgdGhpcy5pc1VzcEp1cmlzZGljdGlvbih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuc2VudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hYnJ1cHQoJ3JldHVybicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyAhPT0gdHlwZW9mIG4gPyAociA9IHFlLmVuY29kZSh0aGlzLl91c3BWZXJzaW9uLCAhMSksIEZlLmNvcmVDb25maWcuaXNBTVAgfHwgcWUuc2V0Q29va2llKHIpLCB0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiB0aGlzLl91c3BWZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzcFN0cmluZzogcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApKSA6IChvID0gbi5zcGxpdCgnJylbMF0sIHQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNwU3RyaW5nOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMCkpLCBlLm5leHQgPSAxMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcignVGhlIGNhbGxiYWNrIGZ1bmN0aW9uIGlzIG1pc3NpbmcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXRVc3BEYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHUoYS5hLm1hcmsoZnVuY3Rpb24gZSh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nICE9PSB0eXBlb2YgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSBxZS5lbmNvZGUodGhpcy5fdXNwVmVyc2lvbiwgbiksIGUubmV4dCA9IDQsIHRoaXMuaXNVc3BKdXJpc2RpY3Rpb24odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLnNlbnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA3OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJydXB0KCdyZXR1cm4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgIT09IHR5cGVvZiByID8gdChudWxsLCAhMSkgOiAoRmUuY29yZUNvbmZpZy5pc0FNUCB8fCBxZS5zZXRDb29raWUociksIHQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IHRoaXMuX3VzcFZlcnNpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNwU3RyaW5nOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvTm90U2VsbDogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApKSwgZS5uZXh0ID0gMTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoJ1RoZSBjYWxsYmFjayBmdW5jdGlvbiBpcyBtaXNzaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0VVNQRGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB1KGEuYS5tYXJrKGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gRmUuY29yZUNvbmZpZy5pc0FNUCA/IEZlLmFtcERhdGEuY29uc2VudE1ldGFkYXRhICYmIEZlLmFtcERhdGEuY29uc2VudE1ldGFkYXRhLmNvbnNlbnRTdHJpbmdUeXBlID09PSB3LlVTUCAmJiBGZS5hbXBEYXRhLmNvbnNlbnRTdHJpbmcgOiBxZS5nZXRDb29raWUoKSwgZS5uZXh0ID0gNCwgdGhpcy5pc1VzcEp1cmlzZGljdGlvbih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuc2VudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hYnJ1cHQoJ3JldHVybicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PT0gdHlwZW9mIG4gPyAociA9IG4uc3BsaXQoJycpWzBdLCB0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzcFN0cmluZzogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApKSA6IHQobnVsbCwgITEpLCBlLm5leHQgPSAxMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcignVGhlIGNhbGxiYWNrIGZ1bmN0aW9uIGlzIG1pc3NpbmcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkaXNwbGF5VXNwVWknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdShhLmEubWFyayhmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByID0gYXJndW1lbnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPSByLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSByWzFdID8gclsxXSA6IDEsIGUubmV4dCA9IDMsIHRoaXMuaXNVc3BKdXJpc2RpY3Rpb24odm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuc2VudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29uc29sZS53YXJuKCdjYW5ub3QgZGlzcGxheSBVU1AgVUkgb3V0c2lkZSBvZiBjb25maWd1cmVkIGp1cmlzZGljdGlvbihzKScpLCBlLmFicnVwdCgncmV0dXJuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEgPT09IG4gJiYgYXQuZGlzcGxheVVpKCdVU1AnLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKSwgRXQgPSBuZXcgQ3QoKSwgU3QgPSBuZXcgX3QoKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgICwKICAgICAgICAgICAgLAogICAgICAgICAgICAsCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBuKDE2Nik7CiAgICAgICAgICAgIH0KICAgICAgICBdKTsKICAgIH0oKSkKfQ=="},{"name":"sugarcoat-501fa30f9f8155b71c084d4272d83dbd84a50120","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfZDBjMmUyNzAzY2I1MjJkNyA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBsZXQgaXNTZWFsZWQgPSBmYWxzZTsKICAgICAgICBjbGFzcyBTdG9yYWdlIHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBpZiAoaXNTZWFsZWQpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IGxlbmd0aCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyh0aGlzKS5sZW5ndGg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAga2V5KGluZGV4KSB7CiAgICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXModGhpcyk7CiAgICAgICAgICAgICAgICBpZiAoaW5kZXggPCAwIHx8IGluZGV4ID49IGtleXMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4ga2V5c1tpbmRleF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0SXRlbShrZXkpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwodGhpcywga2V5KSA/IHRoaXNba2V5XSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0SXRlbShrZXksIHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW2tleV0gPSBTdHJpbmcodmFsdWUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJlbW92ZUl0ZW0oa2V5KSB7CiAgICAgICAgICAgICAgICBkZWxldGUgdGhpc1trZXldOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGNsZWFyKCkgewogICAgICAgICAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKHRoaXMpOwogICAgICAgICAgICAgICAgZm9yIChjb25zdCBrZXkgb2Yga2V5cykgewogICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2tleV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5TdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBTdG9yYWdlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY29uc3QgbG9jYWxTdG9yYWdlID0gbmV3IFN0b3JhZ2UoKTsKICAgICAgICBleHBvcnRzLmxvY2FsU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbG9jYWxTdG9yYWdlOwogICAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBjb25zdCBzZXNzaW9uU3RvcmFnZSA9IG5ldyBTdG9yYWdlKCk7CiAgICAgICAgZXhwb3J0cy5zZXNzaW9uU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gc2Vzc2lvblN0b3JhZ2U7CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGlzU2VhbGVkID0gdHJ1ZTsKICAgIH0pKCRfX19tb2NrX2QwYzJlMjcwM2NiNTIyZDcpOwogICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICBNYXJrZXRpbmcuYmluZERlcGVuZGVuY3lET01QYXJzZWQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICB2YXIgQm9vdHN0cmFwcGVyID0gd2luZG93WydNYXJrZXRpbmcnXTsKICAgICAgICAgICAgdmFyIGVuc2lnaHRlbk9wdGlvbnMgPSBNYXJrZXRpbmcuZW5zaWdodGVuT3B0aW9uczsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ1N0YXJ0KCdydWxlSWQtJyArIHRoaXMuaWQgKyAnLWRlcGxveW1lbnRJZC0nICsgdGhpcy5kZXBsb3ltZW50SWQpOwogICAgICAgICAgICAgICAgdmFyIGdlbyA9IFsKICAgICAgICAgICAgICAgICAgICAnYXUnLAogICAgICAgICAgICAgICAgICAgICdueicsCiAgICAgICAgICAgICAgICAgICAgJ2luJywKICAgICAgICAgICAgICAgICAgICAnc2cnLAogICAgICAgICAgICAgICAgICAgICdteScsCiAgICAgICAgICAgICAgICAgICAgJ2pwJywKICAgICAgICAgICAgICAgICAgICAna3InCiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgdmFyIHVybCA9ICd2MT0mdjI9JyArIE1hcmtldGluZy5VRE8uZGVhbHMgKyAnJnYzPSZzMT0nICsgd2luZG93LmxvY2F0aW9uLmhyZWYgKyAnJnMyPScgKyBkb2N1bWVudC5yZWZlcnJlciArICcmczM9JyArIE1hcmtldGluZy5VRE8ucHJvbW9pZDsKICAgICAgICAgICAgICAgIHZhciBmdWxsVXJsID0gJ3MxPScgKyB3aW5kb3cubG9jYXRpb24uaHJlZiArICcmczI9JyArIGRvY3VtZW50LnJlZmVycmVyICsgJyZzMz0nICsgTWFya2V0aW5nLlVETy5wcm9tb2lkICsgJyZzND0nICsgTWFya2V0aW5nLlVETy5yZXZlbnVlICsgJyZzNT0nICsgTWFya2V0aW5nLlVETy5wcm9kY2F0ICsgJyZzNz0nICsgTWFya2V0aW5nLlVETy5vcmRlcmNvZGUgKyAnJnM4PScgKyBNYXJrZXRpbmcuVURPLmNhdGVnb3J5ICsgJyZzOT0nICsgTWFya2V0aW5nLlVETy5mYW1pbHkgKyAnJnMxMD0nICsgTWFya2V0aW5nLlVETy5wcm9kdWN0ICsgJyZ2Mj0nICsgTWFya2V0aW5nLlVETy5kZWFscyArICcmdjU9JyArIE1hcmtldGluZy5zY0RhdGFPYmouY291bnRyeSArICcmdjY9JyArIE1hcmtldGluZy5zY0RhdGFPYmoubGFuZ3VhZ2UgKyAnJnY3PScgKyBNYXJrZXRpbmcuVURPLmNzZWcgKyAnJnY4PScgKyBNYXJrZXRpbmcuc2NEYXRhT2JqLnNlZ21lbnQgKyAnJnY5PScgKyBNYXJrZXRpbmcuVURPLnBsYXRmb3JtICsgJyZ2MTA9JyArIE1hcmtldGluZy5VRE8uZHBpZDsKICAgICAgICAgICAgICAgIGlmIChnZW8uaW5kZXhPZihEZWxsLk1ldHJpY3Muc2MuY291bnRyeSkgPiAtMSkKICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCcvL3BpeGVsLm1hdGh0YWcuY29tL2V2ZW50L2pzP210X2lkPTEzNjc0NDcmbXRfYWRpZD0xODkxNjYmbXRfZXhlbT0mJyArIGZ1bGxVcmwpOwogICAgICAgICAgICAgICAgaWYgKE1hcmtldGluZy5zY0RhdGFPYmouY291bnRyeSA9PSAnYXUnIHx8IE1hcmtldGluZy5zY0RhdGFPYmouY291bnRyeSA9PSAnbnonIHx8IE1hcmtldGluZy5zY0RhdGFPYmouY291bnRyeSA9PSAnaW4nIHx8IE1hcmtldGluZy5zY0RhdGFPYmouY291bnRyeSA9PSAnanAnKQogICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbnNlcnRTY3JpcHQoJy8vcGl4ZWwubWF0aHRhZy5jb20vZXZlbnQvanM/bXRfaWQ9MTMyNTM2NSZtdF9hZGlkPTE4OTE2NiZtdF9leGVtPSYnICsgdXJsKTsKICAgICAgICAgICAgICAgIGlmIChNYXJrZXRpbmcuc2NEYXRhT2JqLmNvdW50cnkgPT0gJ2F1JyB8fCBNYXJrZXRpbmcuc2NEYXRhT2JqLmNvdW50cnkgPT0gJ256JykKICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCcvL3BpeGVsLm1hdGh0YWcuY29tL2V2ZW50L2ltZz9tdF9pZD0xMzM4NDc5Jm10X2FkaWQ9MTg5MTY2Jm10X2V4ZW09Jm10X2V4Y2w9JicgKyB1cmwgKyAnJm9yZD0lbicpOwogICAgICAgICAgICAgICAgaWYgKE1hcmtldGluZy5zY0RhdGFPYmouY291bnRyeSA9PSAnanAnKQogICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbnNlcnRTY3JpcHQoJy8vcGl4ZWwubWF0aHRhZy5jb20vZXZlbnQvanM/bXRfaWQ9MTMzODQ4MiZtdF9hZGlkPTE4OTE2NiZtdF9leGVtPSZtdF9leGNsPSYnICsgdXJsKTsKICAgICAgICAgICAgICAgIGlmIChNYXJrZXRpbmcuc2NEYXRhT2JqLmNvdW50cnkgPT0gJ2luJykKICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCcvL3BpeGVsLm1hdGh0YWcuY29tL2V2ZW50L2pzP210X2lkPTEzMzg0ODEmbXRfYWRpZD0xODkxNjYmbXRfZXhlbT0mbXRfZXhjbD0mJyArIHVybCk7CiAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGRlbGxfbWFya2V0aW5nX3V0aWwuZGVidWcoZSk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCAzNjAwMjc0LCBbCiAgICAgICAgICAgIDM1MDY5MjQsCiAgICAgICAgICAgIDM2MDYzMjkKICAgICAgICBdLCA2MDk4MjAsIFsKICAgICAgICAgICAgNjEwMzEwLAogICAgICAgICAgICA2MTAzMjMKICAgICAgICBdKTsKICAgICAgICBNYXJrZXRpbmcuYmluZERlcGVuZGVuY3lET01QYXJzZWQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICB2YXIgQm9vdHN0cmFwcGVyID0gd2luZG93WydNYXJrZXRpbmcnXTsKICAgICAgICAgICAgdmFyIGVuc2lnaHRlbk9wdGlvbnMgPSBNYXJrZXRpbmcuZW5zaWdodGVuT3B0aW9uczsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ1N0YXJ0KCdydWxlSWQtJyArIHRoaXMuaWQgKyAnLWRlcGxveW1lbnRJZC0nICsgdGhpcy5kZXBsb3ltZW50SWQpOwogICAgICAgICAgICAgICAgaWYgKE1hcmtldGluZy5VRE8ucHJpb3Jjb25zZW50KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG1hcmtldGluZ3NjRGF0YU9iaiA9IE1hcmtldGluZy5zY0RhdGFPYmo7CiAgICAgICAgICAgICAgICAgICAgdmFyIG1hcmtldGluZ1VETyA9IE1hcmtldGluZy5VRE87CiAgICAgICAgICAgICAgICAgICAgdmFyIHNlZ0lEID0gJyc7CiAgICAgICAgICAgICAgICAgICAgdmFyIHBpeGVsSUQgPSAnJzsKICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nc2NEYXRhT2JqLnNlZ21lbnQgPT0gJ2JzZCcpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdzY0RhdGFPYmoucGFnZSA9PSAnY29uZmlybWF0aW9uJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VnSUQgPSAnaWQ9MTExODM3MSZzZWc9MTgwMTc4NzMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxJRCA9ICcxMTE4MzcxJzsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlZ0lEID0gJ2lkPTEwOTY5NTEmc2VnPTE3NTUyODIyJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpeGVsSUQgPSAnMTA5Njk1MSc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nc2NEYXRhT2JqLnNlZ21lbnQgPT0gJ2RocycpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdzY0RhdGFPYmoucGFnZSA9PSAnY29uZmlybWF0aW9uJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VnSUQgPSAnaWQ9MTAyMDMxMCZzZWc9MTQxNTEyNjEnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxJRCA9ICcxMDIwMzEwJzsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlZ0lEID0gJ2lkPTEwMjAyNzgmc2VnPTE0MTQ5MTk1JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpeGVsSUQgPSAnMTAyMDI3OCc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nc2NEYXRhT2JqLnNlZ21lbnQgPT0gJ2VlcCcpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdzY0RhdGFPYmoucGFnZSA9PSAnY29uZmlybWF0aW9uJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VnSUQgPSAnaWQ9MTE4NDI4MSZzZWc9MTk3Mzk4MTQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxJRCA9ICcxMTg0MjgxJzsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlZ0lEID0gJ2lkPTExODQyNzUmc2VnPTE5NzM5NzMwJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpeGVsSUQgPSAnMTE4NDI3NSc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nc2NEYXRhT2JqLmNtcyA9PSAnZGVsbGVtYycgfHwgbWFya2V0aW5nc2NEYXRhT2JqLmNtcyA9PSAnZGVsbHRlY2gnIHx8IG1hcmtldGluZ3NjRGF0YU9iai5jbXMgPT0gJ29scicpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdzY0RhdGFPYmouY21zID09ICdvbHInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmlyZVByZW1pZXJQaXhlbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LmxvY2F0aW9uLmhyZWYuaW5jbHVkZXMoJy9jYXJ0L3RoYW5reW91JykgfHwgbWFya2V0aW5nVURPLnByb21vaWQgPT0gJzEwMCcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGVuY29kZVVSTCA9IGVuY29kZVVSSUNvbXBvbmVudCgnaHR0cHM6Ly9waXhlbC5tZWRpYWlxZGlnaXRhbC5jb20vcGl4ZWw/dTE9JyArIG1hcmtldGluZ1VETy5jaWQgKyAnJnUyPScgKyBtYXJrZXRpbmdVRE8udHlwZSArICcmdTM9JnU0PSZ1NT0nICsgbWFya2V0aW5nVURPLmRpc2NvdW50ICsgJyZ1Nj0nICsgbWFya2V0aW5nVURPLmRwaWQgKyAnJnU3PScgKyBtYXJrZXRpbmdVRE8uY3VycmVuY3kgKyAnJnU4PScgKyBtYXJrZXRpbmdVRE8uY291cG9uICsgJyZ1OT0nICsgbWFya2V0aW5nVURPLnByb2RjYXQgKyAnJnUxMD0nICsgbWFya2V0aW5nVURPLmNvdW50cnkgKyAnJnUxMT0nICsgbWFya2V0aW5nVURPLmxhbmd1YWdlICsgJyZ1MTI9JyArIG1hcmtldGluZ1VETy5kZXZpY2UgKyAnJnUxMz0nICsgbWFya2V0aW5nVURPLnBsYXRmb3JtICsgJyZ1MTQ9JyArIG1hcmtldGluZ1VETy5wcm9tb2lkICsgJyZ1MTU9JyArIGVuY29kZVVSSUNvbXBvbmVudChtYXJrZXRpbmdVRE8uY2F0ZWdvcnkpICsgJyZ1MTY9JyArIG1hcmtldGluZ1VETy5kZWFscyArICcmdTE3PScgKyBlbmNvZGVVUklDb21wb25lbnQobWFya2V0aW5nVURPLmZhbWlseSkgKyAnJnUxOD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KG1hcmtldGluZ1VETy5wcm9kdWN0KSArICcmdTE5PScgKyBtYXJrZXRpbmdVRE8ub3JkZXJjb2RlICsgJyZ1MjA9JyArIG1hcmtldGluZ1VETy5hY2NvdW50aWQgKyAnJnUyMT0nICsgSlNPTi5zdHJpbmdpZnkobWFya2V0aW5nVURPLnByb2R1Y3RsaXN0KSArICcmdTIyPScgKyBtYXJrZXRpbmdVRE8uY291bnRyeSArICcmcGl4ZWxfaWQ9MTE4NDI3NCZ1aWQ9JHtVSUR9Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbWFnZVJlcXVlc3QoJy8vc2VjdXJlLmFkbnhzLmNvbS9weD9pZD0xMTg0Mjc0JnNlZz0xOTczOTcwOCZvcmRlcl9pZD0nICsgbWFya2V0aW5nVURPLmRwaWQgKyAnJnZhbHVlPScgKyBtYXJrZXRpbmdVRE8ucmV2ZW51ZSArICcmcmVkaXI9JyArIGVuY29kZVVSTCArICcmdD0yJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpcmVQcmVtaWVyUGl4ZWwoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdoYXNoY2hhbmdlJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJlUHJlbWllclBpeGVsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlbmNvZGVVUkwgPSBlbmNvZGVVUklDb21wb25lbnQoJ2h0dHBzOi8vcGl4ZWwubWVkaWFpcWRpZ2l0YWwuY29tL3BpeGVsP3UxPScgKyBtYXJrZXRpbmdVRE8uYWNjb3VudGlkICsgJyZ1Mj0nICsgZW5jb2RlVVJJQ29tcG9uZW50KG1hcmtldGluZ1VETy5jYXRlZ29yeSkgKyAnJnUzPScgKyBtYXJrZXRpbmdVRE8uY2F0ZWdvcnlwYXRoICsgJyZ1ND0nICsgbWFya2V0aW5nVURPLmNvdW50cnkgKyAnJnU1PScgKyBtYXJrZXRpbmdVRE8uY2lkICsgJyZ1Nj0nICsgbWFya2V0aW5nVURPLmxhbmd1YWdlICsgJyZ1Nz0nICsgZW5jb2RlVVJJQ29tcG9uZW50KG1hcmtldGluZ1VETy5mYW1pbHkpICsgJyZ1OD0nICsgbWFya2V0aW5nVURPLnByb2RjYXQgKyAnJnU5PScgKyBlbmNvZGVVUklDb21wb25lbnQobWFya2V0aW5nVURPLnByb2R1Y3QpICsgJyZwaXhlbF9pZD0xMTg0MjcwJnVpZD0ke1VJRH0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbWFnZVJlcXVlc3QoJy8vc2VjdXJlLmFkbnhzLmNvbS9weD9pZD0xMTg0MjcwJnNlZz0xOTczOTcwMiZvcmRlcl9pZD0nICsgbWFya2V0aW5nVURPLmRwaWQgKyAnJnZhbHVlPScgKyBtYXJrZXRpbmdVRE8ucmV2ZW51ZSArICcmcmVkaXI9JyArIGVuY29kZVVSTCArICcmdD0yJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoc2VnSUQgIT0gJycgJiYgcGl4ZWxJRCAhPSAnJykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ3NjRGF0YU9iai5wYWdlID09ICdjb25maXJtYXRpb24nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmVkaXJlY3RVUkwgPSBlbmNvZGVVUklDb21wb25lbnQoJ2h0dHBzOi8vcGl4ZWwubWVkaWFpcWRpZ2l0YWwuY29tL3BpeGVsP3UxPScgKyBtYXJrZXRpbmdVRE8uY2lkICsgJyZ1Mj0nICsgbWFya2V0aW5nVURPLnR5cGUgKyAnJnUzPSZ1ND0mdTU9JyArIG1hcmtldGluZ1VETy5kaXNjb3VudCArICcmdTY9JyArIG1hcmtldGluZ1VETy5kcGlkICsgJyZ1Nz0nICsgbWFya2V0aW5nVURPLmN1cnJlbmN5ICsgJyZ1OD0nICsgbWFya2V0aW5nVURPLmNvdXBvbiArICcmdTk9JyArIG1hcmtldGluZ1VETy5wcm9kY2F0ICsgJyZ1MTA9JyArIG1hcmtldGluZ1VETy5jb3VudHJ5ICsgJyZ1MTE9JyArIG1hcmtldGluZ1VETy5sYW5ndWFnZSArICcmdTEyPScgKyBtYXJrZXRpbmdVRE8uZGV2aWNlICsgJyZ1MTM9JyArIG1hcmtldGluZ1VETy5wbGF0Zm9ybSArICcmdTE0PScgKyBtYXJrZXRpbmdVRE8ucHJvbW9pZCArICcmdTE1PScgKyBlbmNvZGVVUklDb21wb25lbnQobWFya2V0aW5nVURPLmNhdGVnb3J5KSArICcmdTE2PScgKyBtYXJrZXRpbmdVRE8uZGVhbHMgKyAnJnUxNz0nICsgZW5jb2RlVVJJQ29tcG9uZW50KG1hcmtldGluZ1VETy5mYW1pbHkpICsgJyZ1MTg9JyArIGVuY29kZVVSSUNvbXBvbmVudChtYXJrZXRpbmdVRE8ucHJvZHVjdCkgKyAnJnUxOT0nICsgbWFya2V0aW5nVURPLm9yZGVyY29kZSArICcmdTIwPScgKyBtYXJrZXRpbmdVRE8uYWNjb3VudGlkICsgJyZ1MjE9JyArIEpTT04uc3RyaW5naWZ5KG1hcmtldGluZ1VETy5wcm9kdWN0bGlzdCkgKyAnJnUyMj0nICsgbWFya2V0aW5nVURPLmNvdW50cnkgKyAnJnBpeGVsX2lkPScgKyBwaXhlbElEICsgJyZ1aWQ9JHtVSUR9Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW1hZ2VSZXF1ZXN0KCcvL3NlY3VyZS5hZG54cy5jb20vcHg/JyArIHNlZ0lEICsgJyZvcmRlcl9pZD0nICsgbWFya2V0aW5nVURPLmRwaWQgKyAnJnZhbHVlPScgKyBtYXJrZXRpbmdVRE8ucmV2ZW51ZSArICcmcmVkaXI9JyArIHJlZGlyZWN0VVJMICsgJyZ0PTInKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByZWRpcmVjdFVSTCA9IGVuY29kZVVSSUNvbXBvbmVudCgnaHR0cHM6Ly9waXhlbC5tZWRpYWlxZGlnaXRhbC5jb20vcGl4ZWw/dTE9JyArIG1hcmtldGluZ1VETy5hY2NvdW50aWQgKyAnJnUyPScgKyBlbmNvZGVVUklDb21wb25lbnQobWFya2V0aW5nVURPLmNhdGVnb3J5KSArICcmdTM9JyArIG1hcmtldGluZ1VETy5jYXRlZ29yeXBhdGggKyAnJnU0PScgKyBtYXJrZXRpbmdVRE8uY291bnRyeSArICcmdTU9JyArIG1hcmtldGluZ1VETy5jaWQgKyAnJnU2PScgKyBtYXJrZXRpbmdVRE8ubGFuZ3VhZ2UgKyAnJnU3PScgKyBlbmNvZGVVUklDb21wb25lbnQobWFya2V0aW5nVURPLmZhbWlseSkgKyAnJnU4PScgKyBtYXJrZXRpbmdVRE8ucHJvZGNhdCArICcmdTk9JyArIGVuY29kZVVSSUNvbXBvbmVudChtYXJrZXRpbmdVRE8ucHJvZHVjdCkgKyAnJnBpeGVsX2lkPScgKyBwaXhlbElEICsgJyZ1aWQ9JHtVSUR9Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW1hZ2VSZXF1ZXN0KCcvL3NlY3VyZS5hZG54cy5jb20vcHg/JyArIHNlZ0lEICsgJyZvcmRlcl9pZD0nICsgbWFya2V0aW5nVURPLmRwaWQgKyAnJnZhbHVlPScgKyBtYXJrZXRpbmdVRE8ucmV2ZW51ZSArICcmcmVkaXI9JyArIHJlZGlyZWN0VVJMICsgJyZ0PTInKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5wZXJmVGltaW5nRW5kKCdydWxlSWQtJyArIHRoaXMuaWQgKyAnLWRlcGxveW1lbnRJZC0nICsgdGhpcy5kZXBsb3ltZW50SWQpOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBkZWxsX21hcmtldGluZ191dGlsLmRlYnVnKGUpOwogICAgICAgICAgICB9CiAgICAgICAgfSwgMzU5MzM3OCwgWzM2MDYzMjldLCA2MzE3MDYsIFs2MTAzMjNdKTsKICAgICAgICBNYXJrZXRpbmcuYmluZERlcGVuZGVuY3lET01QYXJzZWQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICBjb25zdCAkX19fb2xkXzFjNTgyNjhhYWY2NGJiNzQgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnc2Vzc2lvblN0b3JhZ2UnKTsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzFjNTgyNjhhYWY2NGJiNzQpCiAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ3Nlc3Npb25TdG9yYWdlJywgJF9fX21vY2tfZDBjMmUyNzAzY2I1MjJkNy5zZXNzaW9uU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgQm9vdHN0cmFwcGVyID0gd2luZG93WydNYXJrZXRpbmcnXTsKICAgICAgICAgICAgICAgICAgICB2YXIgZW5zaWdodGVuT3B0aW9ucyA9IE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ1N0YXJ0KCdydWxlSWQtJyArIHRoaXMuaWQgKyAnLWRlcGxveW1lbnRJZC0nICsgdGhpcy5kZXBsb3ltZW50SWQpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoTWFya2V0aW5nLlVETy5wcmlvcmNvbnNlbnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBidWlsZFVybCA9IGZ1bmN0aW9uIChzcG90bmFtZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnLy9waXhlbC5tYXRodGFnLmNvbS9ldmVudC9pbWc/bXRfaWQ9MTI1MjUzNyZtdF9hZGlkPTEyOTgwNSZtdF9leGVtPSZtdF9leGNsPSZ2MT0mdjI9JnYzPSZzMT0nICsgd2luZG93LmxvY2F0aW9uLmhyZWYgKyAnJnMyPScgKyB3aW5kb3cuZG9jdW1lbnQucmVmZXJyZXIgKyAnJnMzPScgKyBzcG90bmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbXB2VXJsID0gYnVpbGRVcmwoJ0hWRV9NdWx0aV8zX3BhZ2Vfdmlld3MnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8uaHZlX21wdihtcHZVcmwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHNvY2lhbFVybCA9IGJ1aWxkVXJsKCdIVkVfU29jaWFsX3NoYXJlcycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5odmVfc29jaWFsKHNvY2lhbFVybCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZG93bmxvYWRVcmwgPSBidWlsZFVybCgnSFZFX0Fzc2V0X2Rvd25sb2FkcycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5odmVfZG93bmxvYWQoZG93bmxvYWRVcmwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHZpZGVvVXJsID0gYnVpbGRVcmwoJ0hWRV9WaWRlb19wbGF5Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLmh2ZV95dHViZSh2aWRlb1VybCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLmh2ZV9iY292ZSh2aWRlb1VybCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgY2hhdFVybCA9IGJ1aWxkVXJsKCdIVkVfQ2hhdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5odmVfY2hhdChjaGF0VXJsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjb250YWN0VXJsID0gYnVpbGRVcmwoJ0hWRV9Db250YWN0VXMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8uaHZlX2NvbnRhY3RVcyhjb250YWN0VXJsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByZnFTdWJtaXRVcmwgPSBidWlsZFVybCgnSFZFX3JmcV9zdWJtaXQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8uaHZlX3JmcV9zdWJtaXQocmZxU3VibWl0VXJsKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBkZWxsX21hcmtldGluZ191dGlsLmRlYnVnKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzFjNTgyNjhhYWY2NGJiNzQpCiAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ3Nlc3Npb25TdG9yYWdlJywgJF9fX29sZF8xYzU4MjY4YWFmNjRiYjc0KSk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCAzNTkzMzU4LCBbMzYwNjMyOV0sIDYzNDAyMywgWzYxMDMyM10pOwogICAgfSgpKQp9"},{"name":"sugarcoat-646e5b5090e12bb4f057679af94c25920631ff46","aliases":[],"kind":{"mime":"application/javascript"},"content":"dmFyIF9zYXRlbGxpdGU7CnsKICAgIGNvbnN0ICRfX19tb2NrXzNkMDQ5YmNmZWNmOTVlODkgPSB7fTsKICAgIChleHBvcnRzID0+IHsKICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgY29uc3QgeGhyVW5zZW50ID0gMDsKICAgICAgICBjb25zdCB4aHJPcGVuZWQgPSAxOwogICAgICAgIGNvbnN0IHhockhlYWRlcnNSZWNlaXZlZCA9IDI7CiAgICAgICAgY29uc3QgeGhyTG9hZGluZyA9IDM7CiAgICAgICAgY29uc3QgeGhyRG9uZSA9IDQ7CiAgICAgICAgY29uc3QgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wgPSBTeW1ib2woJ2RlZmVycmVkSGFuZGxlJyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkU3RhcnRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZHN0YXJ0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Qcm9ncmVzc1N5bWJvbCA9IFN5bWJvbCgnb25wcm9ncmVzcycpOwogICAgICAgIGNvbnN0IHhock9uQWJvcnRTeW1ib2wgPSBTeW1ib2woJ29uYWJvcnQnKTsKICAgICAgICBjb25zdCB4aHJPbkVycm9yU3ltYm9sID0gU3ltYm9sKCdvbmVycm9yJyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkU3ltYm9sID0gU3ltYm9sKCdvbmxvYWQnKTsKICAgICAgICBjb25zdCB4aHJPblRpbWVvdXRTeW1ib2wgPSBTeW1ib2woJ29udGltZW91dCcpOwogICAgICAgIGNvbnN0IHhock9uTG9hZEVuZFN5bWJvbCA9IFN5bWJvbCgnb25sb2FkZW5kJyk7CiAgICAgICAgY29uc3QgeGhyT25SZWFkeVN0YXRlQ2hhbmdlU3ltYm9sID0gU3ltYm9sKCdvbnJlYWR5c3RhdGVjaGFuZ2UnKTsKICAgICAgICBjb25zdCB4aHJSZWFkeVN0YXRlU3ltYm9sID0gU3ltYm9sKCdyZWFkeVN0YXRlJyk7CiAgICAgICAgY29uc3QgeGhyVGltZW91dFN5bWJvbCA9IFN5bWJvbCgndGltZW91dCcpOwogICAgICAgIGNvbnN0IHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCA9IFN5bWJvbCgnd2l0aENyZWRlbnRpYWxzJyk7CiAgICAgICAgY29uc3QgeGhyVXBsb2FkU3ltYm9sID0gU3ltYm9sKCd1cGxvYWQnKTsKICAgICAgICBjb25zdCB4aHJSZXNwb25zZVR5cGVTeW1ib2wgPSBTeW1ib2woJ3Jlc3BvbnNlVHlwZScpOwogICAgICAgIGNvbnN0IGRlZmluZUV2ZW50ID0gKG9iaiwgc3ltYm9sKSA9PiB7CiAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBzeW1ib2wuZGVzY3JpcHRpb24uc3Vic3RyaW5nKDIpOwogICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkob2JqLCBzeW1ib2wsIHsKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIG9iai5hZGRFdmVudExpc3RlbmVyKHR5cGUsIGZ1bmN0aW9uIChldmVudCkgewogICAgICAgICAgICAgICAgY29uc3QgaGFuZGxlciA9IHRoaXNbc3ltYm9sXTsKICAgICAgICAgICAgICAgIGlmIChoYW5kbGVyKSB7CiAgICAgICAgICAgICAgICAgICAgaGFuZGxlci5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICBjb25zdCBjaGFuZ2VSZWFkeVN0YXRlID0gKHhociwgcmVhZHlTdGF0ZSkgPT4gewogICAgICAgICAgICB4aHJbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPSByZWFkeVN0YXRlOwogICAgICAgICAgICB4aHIuZGlzcGF0Y2hFdmVudChuZXcgRXZlbnQoJ3JlYWR5c3RhdGVjaGFuZ2UnKSk7CiAgICAgICAgfTsKICAgICAgICBsZXQgaXNTZWFsZWQgPSB0cnVlOwogICAgICAgIGNsYXNzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgZXh0ZW5kcyBFdmVudFRhcmdldCB7CiAgICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICAgICAgc3VwZXIoKTsKICAgICAgICAgICAgICAgIGlmICghKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdCkgJiYgISh0aGlzIGluc3RhbmNlb2YgWE1MSHR0cFJlcXVlc3RVcGxvYWQpKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSWxsZWdhbCBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Mb2FkU3RhcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Qcm9ncmVzc1N5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkFib3J0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uRXJyb3JTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Mb2FkU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uVGltZW91dFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRFbmRTeW1ib2wpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmxvYWRzdGFydCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uTG9hZFN0YXJ0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2Fkc3RhcnQodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucHJvZ3Jlc3MoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPblByb2dyZXNzU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25wcm9ncmVzcyh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblByb2dyZXNzU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmFib3J0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25BYm9ydFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uYWJvcnQodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25BYm9ydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25lcnJvcigpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uRXJyb3JTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmVycm9yKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uRXJyb3JTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9udGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uVGltZW91dFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9udGltZW91dCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZGVuZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ubG9hZGVuZCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRFbmRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0ID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RVcGxvYWQgZXh0ZW5kcyBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBpZiAoaXNTZWFsZWQpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3RVcGxvYWQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0VXBsb2FkLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3QgZXh0ZW5kcyBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaXNTZWFsZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgIGNvbnN0IHhoclVwbG9hZCA9IG5ldyBYTUxIdHRwUmVxdWVzdFVwbG9hZCgpOwogICAgICAgICAgICAgICAgaXNTZWFsZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhockRlZmVycmVkSGFuZGxlU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbnVsbCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhoclJlYWR5U3RhdGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhoclRpbWVvdXRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAwLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJXaXRoQ3JlZGVudGlhbHNTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVXBsb2FkU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogeGhyVXBsb2FkLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVzcG9uc2VUeXBlU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbnJlYWR5c3RhdGVjaGFuZ2UoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnJlYWR5c3RhdGVjaGFuZ2UodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25SZWFkeVN0YXRlQ2hhbmdlU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZWFkeVN0YXRlKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgb3BlbihtZXRob2QsIHVybCkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyRG9uZTogewogICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhock9wZW5lZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRSZXF1ZXN0SGVhZGVyKG5hbWUsIHZhbHVlKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0VHJ1c3RUb2tlbih0cnVzdFRva2VuKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHRpbWVvdXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJUaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgdGltZW91dCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJUaW1lb3V0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCB3aXRoQ3JlZGVudGlhbHMoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJXaXRoQ3JlZGVudGlhbHNTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB3aXRoQ3JlZGVudGlhbHModmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJVbnNlbnQ6CiAgICAgICAgICAgICAgICBjYXNlIHhock9wZW5lZDogewogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZhdWx0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwnd2l0aENyZWRlbnRpYWxzXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgbWF5IG9ubHkgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgVU5TRU5UIG9yIE9QRU5FRC4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF0gPSAhIXZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCB1cGxvYWQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJVcGxvYWRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNlbmQoKSB7CiAgICAgICAgICAgICAgICBpZiAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSA9PT0geGhyT3BlbmVkICYmIHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdID09PSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBzZXRUaW1lb3V0KCgpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhockRvbmUpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Vycm9yJykpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2xvYWRlbmQnKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgMCk7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBleGVjdXRlIFwnc2VuZFwnIG9uIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIG9iamVjdFwncyBzdGF0ZSBtdXN0IGJlIE9QRU5FRC4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBhYm9ydCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gIT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQodGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0pOwogICAgICAgICAgICAgICAgICAgIHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhoclVuc2VudCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCdhYm9ydCcpKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2xvYWRlbmQnKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlVVJMKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXMoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgc3RhdHVzVGV4dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXRSZXNwb25zZUhlYWRlcihuYW1lKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBvdmVycmlkZU1pbWVUeXBlKG1pbWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUeXBlKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgcmVzcG9uc2VUeXBlKHZhbHVlKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyRG9uZTogewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCdGYWlsZWQgdG8gc2V0IHRoZSBcJ3Jlc3BvbnNlVHlwZVwnIHByb3BlcnR5IG9uIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIHJlc3BvbnNlIHR5cGUgY2Fubm90IGJlIHNldCBpZiB0aGUgb2JqZWN0XCdzIHN0YXRlIGlzIExPQURJTkcgb3IgRE9ORS4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHZhbHVlKSB7CiAgICAgICAgICAgICAgICBjYXNlICcnOgogICAgICAgICAgICAgICAgY2FzZSAnYXJyYXlidWZmZXInOgogICAgICAgICAgICAgICAgY2FzZSAnYmxvYic6CiAgICAgICAgICAgICAgICBjYXNlICdkb2N1bWVudCc6CiAgICAgICAgICAgICAgICBjYXNlICdqc29uJzoKICAgICAgICAgICAgICAgIGNhc2UgJ3RleHQnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlKCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgcmV0dXJuIHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcgPyAnJyA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlVGV4dCgpIHsKICAgICAgICAgICAgICAgIGNvbnN0IHJlc3BvbnNlVHlwZSA9IHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXTsKICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZVR5cGUgPT09ICcnIHx8IHJlc3BvbnNlVHlwZSA9PT0gJ3RleHQnKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCdGYWlsZWQgdG8gcmVhZCB0aGUgXCdyZXNwb25zZVRleHRcJyBwcm9wZXJ0eSBmcm9tIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIHZhbHVlIGlzIG9ubHkgYWNjZXNzaWJsZSBpZiB0aGUgb2JqZWN0XCdzIFwncmVzcG9uc2VUeXBlXCcgaXMgXCdcJyBvciBcJ3RleHRcJyAod2FzIFwnYXJyYXlidWZmZXJcJykuJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlWE1MKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnVU5TRU5UJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyVW5zZW50CiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnT1BFTkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyT3BlbmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnSEVBREVSU19SRUNFSVZFRCcsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockhlYWRlcnNSZWNlaXZlZAogICAgICAgIH0pOwogICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShYTUxIdHRwUmVxdWVzdCwgJ0xPQURJTkcnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJMb2FkaW5nCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnRE9ORScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockRvbmUKICAgICAgICB9KTsKICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0ID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBYTUxIdHRwUmVxdWVzdCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgfSkoJF9fX21vY2tfM2QwNDliY2ZlY2Y5NWU4OSk7CiAgICBjb25zdCAkX19fbW9ja18yMTNjMmM2OThlNTcwMjcwID0ge307CiAgICAoZXhwb3J0cyA9PiB7CiAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgIGxldCBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgIGNsYXNzIFN0b3JhZ2UgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgbGVuZ3RoKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKHRoaXMpLmxlbmd0aDsKICAgICAgICAgICAgfQogICAgICAgICAgICBrZXkoaW5kZXgpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGtleXMgPSBPYmplY3Qua2V5cyh0aGlzKTsKICAgICAgICAgICAgICAgIGlmIChpbmRleCA8IDAgfHwgaW5kZXggPj0ga2V5cy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBrZXlzW2luZGV4XTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXRJdGVtKGtleSkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbCh0aGlzLCBrZXkpID8gdGhpc1trZXldIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRJdGVtKGtleSwgdmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNba2V5XSA9IFN0cmluZyh2YWx1ZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmVtb3ZlSXRlbShrZXkpIHsKICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2tleV07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2xlYXIoKSB7CiAgICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXModGhpcyk7CiAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGtleSBvZiBrZXlzKSB7CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHRoaXNba2V5XTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFN0b3JhZ2UsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjb25zdCBsb2NhbFN0b3JhZ2UgPSBuZXcgU3RvcmFnZSgpOwogICAgICAgIGV4cG9ydHMubG9jYWxTdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIGdldCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBsb2NhbFN0b3JhZ2U7CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGNvbnN0IHNlc3Npb25TdG9yYWdlID0gbmV3IFN0b3JhZ2UoKTsKICAgICAgICBleHBvcnRzLnNlc3Npb25TdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIGdldCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBzZXNzaW9uU3RvcmFnZTsKICAgICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgaXNTZWFsZWQgPSB0cnVlOwogICAgfSkoJF9fX21vY2tfMjEzYzJjNjk4ZTU3MDI3MCk7CiAgICAoZnVuY3Rpb24gKCkgewogICAgICAgIHdpbmRvdy5fc2F0ZWxsaXRlID0gd2luZG93Ll9zYXRlbGxpdGUgfHwge30sIHdpbmRvdy5fc2F0ZWxsaXRlLmNvbnRhaW5lciA9IHsKICAgICAgICAgICAgYnVpbGRJbmZvOiB7CiAgICAgICAgICAgICAgICBtaW5pZmllZDogITAsCiAgICAgICAgICAgICAgICBidWlsZERhdGU6ICcyMDIyLTAxLTE1VDE0OjEwOjI2WicsCiAgICAgICAgICAgICAgICB0dXJiaW5lQnVpbGREYXRlOiAnMjAyMS0wOC0xMVQyMDoyNTo0OVonLAogICAgICAgICAgICAgICAgdHVyYmluZVZlcnNpb246ICcyNy4yLjAnCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGVudmlyb25tZW50OiB7CiAgICAgICAgICAgICAgICBpZDogJ0VOMzkzMjUxMTc3MWZiNGU1ZTlkZDg1MmFlODkzNzJiNTknLAogICAgICAgICAgICAgICAgc3RhZ2U6ICdwcm9kdWN0aW9uJwogICAgICAgICAgICB9LAogICAgICAgICAgICBkYXRhRWxlbWVudHM6IHsKICAgICAgICAgICAgICAgICdnVGFnOmJ0bkZCUGFnZUxpc3RNYXBwaW5nJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvcHJpbnRpbmcvZGVzaWduLXNlcnZpY2VzLmh0bWwnOiAnQWRkVG9DYXJ0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL3NtYWxsLW1lZGl1bS1idXNpbmVzcy1vZmZlcnMuaHRtbCc6ICdMZWFkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnZGZhOnBhZ2VMaXN0TWFwcGluZyc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2c6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1zZy9vcGVuLWFjY291bnQvcGVyc29uYWwuaHRtbCc6ICdodHRwczovLzkxODgyMDUuZmxzLmRvdWJsZWNsaWNrLm5ldC9hY3Rpdml0eWk7c3JjPTkxODgyMDU7dHlwZT1pbnZtZWRpYTtjYXQ9cGVyc28wO2RjX2xhdD07ZGNfcmRpZD07dGFnX2Zvcl9jaGlsZF9kaXJlY3RlZF90cmVhdG1lbnQ9O3RmdWE9O25wYT07b3JkPScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tc2cvb3Blbi1hY2NvdW50L2NvcnBvcmF0ZS5odG1sJzogJyBodHRwczovLzkxODgyMDUuZmxzLmRvdWJsZWNsaWNrLm5ldC9hY3Rpdml0eWk7c3JjPTkxODgyMDU7dHlwZT1pbnZtZWRpYTtjYXQ9Y29ycG8wMDtkY19sYXQ9O2RjX3JkaWQ9O3RhZ19mb3JfY2hpbGRfZGlyZWN0ZWRfdHJlYXRtZW50PTt0ZnVhPTtucGE9O29yZD0nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL3poLXR3L29wZW4tYWNjb3VudC9wZXJzb25hbC5odG1sP2ludGNtcD1CQUwtMTAwNTI0NS00LTEtOTYyLTEwMDAwMDAtQVBBQy1UVy1aSC1GWTE5UTRQQUNDTE5LWEEnOiAnaHR0cHM6Ly85MTg4MjA1LmZscy5kb3VibGVjbGljay5uZXQvYWN0aXZpdHlpO3NyYz05MTg4MjA1O3R5cGU9aW52bWVkaWE7Y2F0PXBlcnNvMDAxO2RjX2xhdD07ZGNfcmRpZD07dGFnX2Zvcl9jaGlsZF9kaXJlY3RlZF90cmVhdG1lbnQ9O3RmdWE9O25wYT07b3JkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi10dy9vcGVuLWFjY291bnQvcGVyc29uYWwuaHRtbD9pbnRjbXA9QkFMLTEwMDUyNDUtNC0xLTk2Mi0xMDAwMDAwLUFQQUMtVFctWkgtRlkxOVE0UEFDQ0xOS1hBJzogJ2h0dHBzOi8vOTE4ODIwNS5mbHMuZG91YmxlY2xpY2submV0L2FjdGl2aXR5aTtzcmM9OTE4ODIwNTt0eXBlPWludm1lZGlhO2NhdD1wZXJzbzAwMTtkY19sYXQ9O2RjX3JkaWQ9O3RhZ19mb3JfY2hpbGRfZGlyZWN0ZWRfdHJlYXRtZW50PTt0ZnVhPTtucGE9O29yZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdjb250ZW50OmxvY2FsZSc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdGRFguREFUQUxBWUVSLnBhZ2UucGFnZUluZm8ubG9jYWxlJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgZG90VGFnUGl4ZWxJZDogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxJZHMgPSBfc2F0ZWxsaXRlLmdldFZhcignZG90VGFnUGl4ZWxNYXBwaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gZSAmJiAnJyAhPSBlICYmICd1bmRlZmluZWQnICE9IHR5cGVvZiBwaXhlbElkcyAmJiAnJyAhPSBwaXhlbElkcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHBpeGVsSWRzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmluZGV4T2YobikgPiAwICYmICh0ID0gcGl4ZWxJZHNbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2dUYWc6REZBUGFnZUxpc3RNYXBwaW5nJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLW15L3NoaXBwaW5nL2ZlZGV4LXJld2FyZHMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1uei9zaGlwcGluZy9mZWRleC1yZXdhcmRzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tYXUvc21hbGwtYnVzaW5lc3MvZGVsaWdodGluZy1jdXN0b21lcnMvcmV3YXJkcy1wcm9ncmFtcy1iZW5lZml0cy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLW56L3NtYWxsLWJ1c2luZXNzL2RlbGlnaHRpbmctY3VzdG9tZXJzL3Jld2FyZHMtcHJvZ3JhbXMtYmVuZWZpdHMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1waC9zaGlwcGluZy9mZWRleC1yZXdhcmRzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvdGgtdGgvc2hpcHBpbmcvZmVkZXgtcmV3YXJkcy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLW15L3NtYWxsLWJ1c2luZXNzL2RlbGlnaHRpbmctY3VzdG9tZXJzL3Jld2FyZHMtcHJvZ3JhbXMtYmVuZWZpdHMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1waC9zbWFsbC1idXNpbmVzcy9kZWxpZ2h0aW5nLWN1c3RvbWVycy9yZXdhcmRzLXByb2dyYW1zLWJlbmVmaXRzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvdGgtdGgvc21hbGwtYnVzaW5lc3MvZGVsaWdodGluZy1jdXN0b21lcnMvcmV3YXJkcy1wcm9ncmFtcy1iZW5lZml0cy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL3poLWNuL3NoaXBwaW5nL2ZlZGV4LXJld2FyZHMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC1jbi9zbWFsbC1idXNpbmVzcy9kZWxpZ2h0aW5nLWN1c3RvbWVycy9yZXdhcmRzLXByb2dyYW1zLWJlbmVmaXRzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbXkvc21hbGwtYnVzaW5lc3MuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1waC9zbWFsbC1idXNpbmVzcy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWF1L3NtYWxsLWJ1c2luZXNzL3N1Y2Nlc3Mtam91cm5leS9mYWN0cy1iZW5lZml0cy1ncmFudHMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1teS9zbWFsbC1idXNpbmVzcy9zdWNjZXNzLWpvdXJuZXkvZmFjdHMtYmVuZWZpdHMtZ3JhbnRzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tcGgvc21hbGwtYnVzaW5lc3Mvc3VjY2Vzcy1qb3VybmV5L2ZhY3RzLWJlbmVmaXRzLWdyYW50cy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWF1L3NtYWxsLWJ1c2luZXNzL3N0cmVhbWxpbmUtb3BlcmF0aW9ucy90aXBzLWZvci1lZmZpY2llbnQtZWZmZWN0aXZlLXNoaXBwaW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbXkvc21hbGwtYnVzaW5lc3Mvc3RyZWFtbGluZS1vcGVyYXRpb25zL3RpcHMtZm9yLWVmZmljaWVudC1lZmZlY3RpdmUtc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1waC9zbWFsbC1idXNpbmVzcy9zdHJlYW1saW5lLW9wZXJhdGlvbnMvdGlwcy1mb3ItZWZmaWNpZW50LWVmZmVjdGl2ZS1zaGlwcGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWF1L3NtYWxsLWJ1c2luZXNzL2FjY2VsZXJhdGluZy1kaWdpdGFsL2RpZ2l0YWxpemUtY3VzdG9tcy1kb2N1bWVudHMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hdS9zbWFsbC1idXNpbmVzcy9hY2NlbGVyYXRpbmctZGlnaXRhbC9vcHBvcnR1bml0aWVzLWZvci1lY29tbWVyY2UtYnVzaW5lc3MuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hdS9zbWFsbC1idXNpbmVzcy9hZGFwdC1pbm5vdmF0ZS9zdXN0YWluYWJsZS1zdXBwbHktY2hhaW4uaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1teS9zbWFsbC1idXNpbmVzcy9hY2NlbGVyYXRpbmctZGlnaXRhbC9kaWdpdGFsaXplLWN1c3RvbXMtZG9jdW1lbnRzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbXkvc21hbGwtYnVzaW5lc3MvYWNjZWxlcmF0aW5nLWRpZ2l0YWwvb3Bwb3J0dW5pdGllcy1mb3ItZWNvbW1lcmNlLWJ1c2luZXNzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbXkvc21hbGwtYnVzaW5lc3MvYWRhcHQtaW5ub3ZhdGUvc3VzdGFpbmFibGUtc3VwcGx5LWNoYWluLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tcGgvc21hbGwtYnVzaW5lc3MvYWNjZWxlcmF0aW5nLWRpZ2l0YWwvZGlnaXRhbGl6ZS1jdXN0b21zLWRvY3VtZW50cy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXBoL3NtYWxsLWJ1c2luZXNzL2FjY2VsZXJhdGluZy1kaWdpdGFsL29wcG9ydHVuaXRpZXMtZm9yLWVjb21tZXJjZS1idXNpbmVzcy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXBoL3NtYWxsLWJ1c2luZXNzL2FkYXB0LWlubm92YXRlL3N1c3RhaW5hYmxlLXN1cHBseS1jaGFpbi5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXNnL3NtYWxsLWJ1c2luZXNzL3N1Y2Nlc3Mtam91cm5leS9mYWN0cy1iZW5lZml0cy1ncmFudHMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1zZy9zbWFsbC1idXNpbmVzcy9zdHJlYW1saW5lLW9wZXJhdGlvbnMvdGlwcy1mb3ItZWZmaWNpZW50LWVmZmVjdGl2ZS1zaGlwcGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXNnL3NtYWxsLWJ1c2luZXNzL2FjY2VsZXJhdGluZy1kaWdpdGFsL2RpZ2l0YWxpemUtY3VzdG9tcy1kb2N1bWVudHMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1zZy9zbWFsbC1idXNpbmVzcy9hY2NlbGVyYXRpbmctZGlnaXRhbC9vcHBvcnR1bml0aWVzLWZvci1lY29tbWVyY2UtYnVzaW5lc3MuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1zZy9zbWFsbC1idXNpbmVzcy9hZGFwdC1pbm5vdmF0ZS9zdXN0YWluYWJsZS1zdXBwbHktY2hhaW4uaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6bGFuZ3VhZ2UnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBmb3JjZUxvd2VyQ2FzZTogITAsCiAgICAgICAgICAgICAgICAgICAgY2xlYW5UZXh0OiAhMCwKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnRkRYLkRBVEFMQVlFUi5wYWdlLnBhZ2VJbmZvLmxhbmd1YWdlJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6aGlzdG9yaWNhbFBhZ2VOYW1lJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ0ZEWC5EQVRBTEFZRVIucGFnZS5wYWdlSW5mby5oaXN0b3JpY2FsUGFnZU5hbWUnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnZ1RhZzpDb25maWdJRE1hcHBpbmcnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERDQ29uZmlnSUQ6ICdEQy00MTkxMjYzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVdDb25maWdJRDogJ0FXLTg2MzIzODc5MycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERDQ29uZmlnSUQ6ICdEQy00MTkxMjYzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVdDb25maWdJRDogJ0FXLTEwMTU3Njc0OTAnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6YTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQ0NvbmZpZ0lEOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVdDb25maWdJRDogJzY5ODUyMDgxNycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERDQ29uZmlnSUQ6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBV0NvbmZpZ0lEOiAnQVctNjgzOTg3MDgyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbno6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRENDb25maWdJRDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFXQ29uZmlnSUQ6ICdBVy02ODM5ODcwODInCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQ0NvbmZpZ0lEOiAnREMtMjUyNjI4OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFXQ29uZmlnSUQ6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQ0NvbmZpZ0lEOiAnREMtMjUyNjI4OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFXQ29uZmlnSUQ6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQ0NvbmZpZ0lEOiAnREMtMjUyNjI4OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFXQ29uZmlnSUQ6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBteDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQ0NvbmZpZ0lEOiAnREMtMjUyNjI4OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFXQ29uZmlnSUQ6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQ0NvbmZpZ0lEOiAnREMtOTkyOTk2OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFXQ29uZmlnSUQ6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQ0NvbmZpZ0lEOiAnREMtOTkyOTk2OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFXQ29uZmlnSUQ6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQ0NvbmZpZ0lEOiAnREMtOTkyOTk2OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFXQ29uZmlnSUQ6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoazogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQ0NvbmZpZ0lEOiAnREMtOTkyOTk2OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFXQ29uZmlnSUQ6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqcDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQ0NvbmZpZ0lEOiAnREMtOTkyOTk2OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFXQ29uZmlnSUQ6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnY29udGVudDpwYWdlIG5hbWUnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnbm8gcGFnZU5hbWUgZm91bmQnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBfZmR4LnBjZlV0aWwoKSwgdCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5tYXRjaCgvd3d3KHNib3guaWRldnxiYXNlLmlkZXZ8ZGV2LmlkZXZ8ZHJ0LmlkZXZ8c3RyZXNzLmRtei5pZGV2fGJpdC5pZGV2fHRlc3R8KS5mZWRleC5jb20vZ2kpID8gdCA9ICdmZWRleC8nIDogZS5tYXRjaCgvKHdlYmFwcC5kZXYufHd3dy58KWZ0bi5mZWRleC5jb20vZ2kpICYmICh0ID0gJ2Z0bi8nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6cGFnZVBhdGgnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICE9IG4uc2xpY2UoMCwgdC5sZW5ndGgpICYmIChuID0gdCArIG4pLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdhYW06Y291bnRyeUZsYWcnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdhYW06Y291bnRyaWVzJyksIHQgPSBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpjb3VudHJ5Q29kZScpLCBuID0gdm9pZCAwICE9PSB0ICYmICcnICE9PSB0ID8gdCA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnICE9PSBuICYmIGUuaW5kZXhPZihuKSA+IC0xOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdjb250ZW50OmNvdW50cnlDb2RlJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ0ZEWC5EQVRBTEFZRVIucGFnZS5wYWdlSW5mby5jb3VudHJ5JyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ3Zlcml6b246cGFnZUxpc3QnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9ICdodHRwczovL3NwLmFuYWx5dGljcy55YWhvby5jb20vc3BwLnBsP2E9MTAwMDAmLnlwPTEwMDkyOTA3JmVjPSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2Evc2hpcHBpbmctc2VydmljZXMvaW50ZXJuYXRpb25hbC1zaGlwcGluZy9yZWd1bGF0b3J5LWZvcm0vdGhhbmsteW91Lmh0bWwnOiBlICsgJ0ZlZEV4X1JlZ3VsYXRvcnlfRm9ybV9UaGFua19Zb3VfRW5nbGlzaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jYS9zaGlwcGluZy1zZXJ2aWNlcy9pbnRlcm5hdGlvbmFsLXNoaXBwaW5nL3JlZ3VsYXRvcnktZm9ybS90aGFuay15b3UuaHRtbCc6IGUgKyAnRmVkRXhfUmVndWxhdG9yeV9Gb3JtX1RoYW5rX1lvdV9GcmVuY2gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2Evc2hpcHBpbmctc2VydmljZXMvaW50ZXJuYXRpb25hbC1zaGlwcGluZy5odG1sJzogZSArICdGZWRFeF9JbnRlcm5hdGlvbmFsX1NoaXBwaW5nX0VOJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2ludGVybmF0aW9uYWwtc2hpcHBpbmcuaHRtbCc6IGUgKyAnRmVkRXhfSW50ZXJuYXRpb25hbF9TaGlwcGluZ19GUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9zaGlwcGluZy1zZXJ2aWNlcy9pbnRlcm5hdGlvbmFsLXNoaXBwaW5nL29mZmVyL3RoYW5rLXlvdS5odG1sJzogZSArICdGZWRFeF9BZGRpdGlvbmFsX1RoYW5rX1lvdV9QYWdlX0VuZ2xpc2gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2Evc2hpcHBpbmctc2VydmljZXMvaW50ZXJuYXRpb25hbC1zaGlwcGluZy9vZmZlci90aGFuay15b3UuaHRtbCc6IGUgKyAnRmVkRXhfQWRkaXRpb25hbF9UaGFua19Zb3VfUGFnZV9GcmVuY2gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2Evc2hpcHBpbmctc2VydmljZXMvZXhwcmVzcy1mcmVpZ2h0Lmh0bWwnOiBlICsgJ0ZlZEV4X0FkZGl0aW9uYWxfVGhhbmtfWW91X1BhZ2VfRnJlbmNoMTIzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL2Vjb21tZXJjZS1zaGlwcGluZy9zdXBwb3J0LWZvci15b3VyLWN1c3RvbWVycy5odG1sJzogJ2h0dHBzOi8vc3AuYW5hbHl0aWNzLnlhaG9vLmNvbS9zcHAucGw/YT0xMDAwMCYueXA9MTAxNjc5OCZlYz1GZWRFeF9zdXBwb3J0X2Zvcl95b3VyX2N1c3RvbWVyc19FbmdsaXNoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL21hbmFnZS1teS1kZWxpdmVyaWVzLmh0bWwnOiAnaHR0cHM6Ly9zcC5hbmFseXRpY3MueWFob28uY29tL3NwcC5wbD9hPTEwMDAwJi55cD0xMDE2NzcwMCZlYz1GZWRFeF9tYW5hZ2VfbXlfZGVsaXZlcmllc19FbmdsaXNoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL2Vjb21tZXJjZS1zaGlwcGluZy9zdXBwb3J0LWZvci15b3VyLWN1c3RvbWVycy5odG1sJzogJ2h0dHBzOi8vc3AuYW5hbHl0aWNzLnlhaG9vLmNvbS9zcHAucGw/YT0xMDAwMCYueXA9MTAxNjc3MDImZWM9RmVkRXhfc3VwcG9ydF9mb3JfeW91cl9jdXN0b21lcnNfRnJlbmNoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL21hbmFnZS1teS1kZWxpdmVyaWVzLmh0bWwnOiAnaHR0cHM6Ly9zcC5hbmFseXRpY3MueWFob28uY29tL3NwcC5wbD9hPTEwMDAwJi55cD0xMDE2NzcwNCZlYz1GZWRFeF9tYW5hZ2VfbXlfZGVsaXZlcmllc19GcmVuY2gnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICd1c2VyOmVtYWlsSUQnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvcXVlcnlTdHJpbmdQYXJhbWV0ZXIuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdldF9yaWQnLAogICAgICAgICAgICAgICAgICAgICAgICBjYXNlSW5zZW5zaXRpdmU6ICEwCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdzZWFyY2g6c3BEYXRhJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ0ZEWC5EQVRBTEFZRVIuc2VhcmNoLnJlc3VsdCcgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICd1c2VyOnVzZXItYWdlbnQnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnbmF2aWdhdG9yLnVzZXJBZ2VudCcgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdjb250ZW50OmRldmljZVR5cGUnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5tYXRjaE1lZGlhKCcobWluLXdpZHRoOiA5OTNweCknKS5tYXRjaGVzICYmIChlID0gJ2Rlc2t0b3AnKSwgd2luZG93Lm1hdGNoTWVkaWEoJyhtYXgtd2lkdGg6IDk5MnB4KScpLm1hdGNoZXMgJiYgKGUgPSAndGFibGV0JyksIHdpbmRvdy5tYXRjaE1lZGlhKCcobWF4LXdpZHRoOiA3NjdweCknKS5tYXRjaGVzICYmIChlID0gJ21vYmlsZScpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdnVGFnOmJ0bk9yYW5nZUFXUGFnZUxpc3RNYXBwaW5nJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpZ25VcENvbnRpbnVlQnV0dG9uOiAnQVctODYzMjM4NzkzL1NwRzFDUHJxM053QkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJtaXRQaW5CdXR0b246ICdBVy04NjMyMzg3OTMvbnAyRENLNy0tTndCRUluMXo1c0QnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIEFsbG93ZWRQcm9kRG9tYWluczogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3BhaW4uZmVkZXguY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaW50ZXJuYXRpb25hbHNoaXBwaW5nYXNzaXN0LnZhbi5mZWRleC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3ZWJsZXRzLmRtei5hcGFjLmZlZGV4LmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dldHJld2FyZHMuZmVkZXguY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbG9jYWwuZmVkZXguY29tJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBhcHBOYW1lOiB7CiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ0ZEWC5EQVRBTEFZRVIucGFnZS5jYXRlZ29yeS5hcHBOYW1lJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NsaWNrOmJsb2NrRmxhZyc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuaXNCbG9ja2VkID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9zYXRlbGxpdGUuZ2V0VmFyKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmxlbmd0aCA+IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSAwOyByIDwgbi5sZW5ndGg7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuW3JdLnRvU3RyaW5nKCkudG9Mb3dlckNhc2UoKSA9PSBlLnRvTG93ZXJDYXNlKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGlzQmxvY2tlZDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBUYXJnZXRSZWdpb25zOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndXMsIGNhbiwgYXBhYywgbGFjLCBtZWlzYSwgZXUnOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdkb3RUYWc6ZW5hYmxlZFBhZ2VMaXN0JzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3Bvc3NpYmlsaXRpZXMuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJzE1OTA5Njk1OTkwMDAnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2hvbGlkYXkvY29uc3VtZXItc2hpcHBpbmctZGVsaXZlcnktZ3VpZGUuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2Evc2hpcHBpbmctc2VydmljZXMvaW50ZXJuYXRpb25hbC1zaGlwcGluZy5odG1sJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydFRpbWU6ICcxNTc4MjY4Nzk5MDAwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJzE1ODg1NTAzOTkwMDAnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2ludGVybmF0aW9uYWwtc2hpcHBpbmcuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnMTU3ODI2ODc5OTAwMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRpbWU6ICcxNTg4NTUwMzk5MDAwJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9ob2xpZGF5Lmh0bWwnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VGltZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRpbWU6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2NvdXBvbi1vZmZlcnMvZ3JvdW5kLmh0bWwnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VGltZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRpbWU6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL29uc2l0ZS93YWxncmVlbnMtcGFja2FnZS1waWNrdXAuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvaGVhbHRoY2FyZS92YWNjaW5lLXNoaXBwaW5nLmh0bWwnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VGltZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRpbWU6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2Vjb21tZXJjZS9vZmZlci1zdG9yZS1waWNrdXAtYXQtY2hlY2tvdXQuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbi1jYS9zaGlwcGluZy10b29scy9mcmVpZ2h0LXF1b3RlLW5vLWFjY291bnQuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbi1jYS9zaGlwcGluZy10b29scy9mcmVpZ2h0LXF1b3RlLmh0bWwnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VGltZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRpbWU6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW4tY2Evc2hpcHBpbmctc2VydmljZXMvZXhwcmVzcy1mcmVpZ2h0Lmh0bWwnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VGltZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRpbWU6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnItY2Evc2hpcHBpbmctdG9vbHMvZnJlaWdodC1xdW90ZS1uby1hY2NvdW50Lmh0bWwnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VGltZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRpbWU6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnItY2Evc2hpcHBpbmctdG9vbHMvZnJlaWdodC1xdW90ZS5odG1sJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydFRpbWU6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmRUaW1lOiAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ZyLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2V4cHJlc3MtZnJlaWdodC5odG1sJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydFRpbWU6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmRUaW1lOiAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9zbWFsbC1idXNpbmVzcy9lY29tbWVyY2Utc29sdXRpb25zLmh0bWwnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VGltZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRpbWU6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NtYWxsLWJ1c2luZXNzL2Vjb21tZXJjZS1zb2x1dGlvbnMuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2Evc21hbGwtYnVzaW5lc3MuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2Evc21hbGwtYnVzaW5lc3MuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2Evc2hpcHBpbmctc2VydmljZXMvZXhwcmVzcy1mcmVpZ2h0L2ludGVybmF0aW9uYWwtYWlyLWZyZWlnaHQtcXVvdGUuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2Evc2hpcHBpbmctc2VydmljZXMvZXhwcmVzcy1mcmVpZ2h0L2ludGVybmF0aW9uYWwtYWlyLWZyZWlnaHQtcXVvdGUuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2EvY2FyZWVycy5odG1sJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydFRpbWU6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmRUaW1lOiAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jYS9jYXJlZXJzLmh0bWwnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VGltZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRpbWU6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2hlYWx0aGNhcmUuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2Evc2hpcHBpbmctc2VydmljZXMvaGVhbHRoY2FyZS5odG1sJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydFRpbWU6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmRUaW1lOiAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9zaGlwcGluZy1zZXJ2aWNlcy9oZWFsdGhjYXJlL2NvbnRhY3QtdXMuaHRtbCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGltZTogJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2Evc2hpcHBpbmctc2VydmljZXMvaGVhbHRoY2FyZS9jb250YWN0LXVzLmh0bWwnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VGltZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRpbWU6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAndHJhZGVkZXNrOmJ0bkNsaWNrUGFnZUxpc3RNYXBwaW5nJzogewogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2xpbmt8c2lnbiB1cCBmb3IgZnJlZSc6ICcvL2luc2lnaHQuYWRzcnZyLm9yZy90cmFjay9weGwvP2Fkdj1zdWVudHZiYSZjdD0wOmxhbnRpNmQmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsaW5rfGZpbmQgYSBkb2xsYXIgZ2VuZXJhbCc6ICcvL2luc2lnaHQuYWRzcnZyLm9yZy90cmFjay9weGwvP2Fkdj1zdWVudHZiYSZjdD0wOnllOW4xOG4mZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdoZXJvfGZpbmQgYSB3YWxncmVlbnMgbmVhciB5b3UnOiAnLy9pbnNpZ2h0LmFkc3J2ci5vcmcvdHJhY2svcHhsLz9hZHY9c3VlbnR2YmEmY3Q9MDp6MGE2b242JmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGVyb3xzZWUgY3VycmVudCBvZmZlcnMnOiAnLy9pbnNpZ2h0LmFkc3J2ci5vcmcvdHJhY2svcHhsLz9hZHY9c3VlbnR2YmEmY3Q9MDo4ejRmYmg0JmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGlua3xzaWduIHVwIG5vdyc6ICcvL2luc2lnaHQuYWRzcnZyLm9yZy90cmFjay9weGwvP2Fkdj1zdWVudHZiYSZjdD0wOmtmMDZ2NjEmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsaW5rfG5leHQgdGltZSB1c2UgZmVkZXggZGVsaXZlcnkgbWFuYWdlcnxzaWduIHVwIGZvciBmcmVlJzogJy8vaW5zaWdodC5hZHNydnIub3JnL3RyYWNrL3B4bC8/YWR2PXN1ZW50dmJhJmN0PTA6OXB5bmk2ciZmbXQ9MycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ3ZhOmNhYXNEaXNhYmxlZENvdW50cnlMaXN0JzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2aV92bicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc191cycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCB0ID0gX2ZkeC5wYWdlRmxhZyhlLCBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpsb2NhbGUnKSksIG4gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZmVkZXh0cmFjay8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZlZGV4dHJhY2tpbmcvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHIgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWUsIGkgPSBfZmR4LnBhZ2VGbGFnKG4sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF0IHx8ICFpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdnVGFnOmJ0bk9yYW5nZURDUGFnZUxpc3RNYXBwaW5nJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpZ25VcENvbnRpbnVlQnV0dG9uOiAnREMtNDE5MTI2My9mZG1lbjAvZmRtLWkwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJtaXRQaW5CdXR0b246ICdEQy00MTkxMjYzL2ZkbWVuMC9mZG0tYzArc3RhbmRhcmQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICd2YTpjYWFzRW5hYmxlZENvdW50cnlMaXN0TmV3JzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnJfY2gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdkZV9jaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2l0X2NoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fYnInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdF9icicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX214JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fYXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9ibycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2NsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fY28nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9jcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2RvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fc3YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9ndCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2huJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fbmknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9wYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX3B5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fcGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9wcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX3V5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fdmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9ieicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2FpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fYWcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9nZicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2d5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fc3InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9hdycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2JzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fYmInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9ibScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2JxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fdmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9reScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2N3JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fZG0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9qbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX21zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fbWYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9zeCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2tuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fbGMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl92YycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX3R0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fdGMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl92aScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2dwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fbXEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9odCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2diJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnJfY2EnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9jYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2NoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfbXgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc19hcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX2JvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfY2wnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc19jbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX2NyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfZG8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc19lYycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX3N2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfZ3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc19obicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX25pJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfcGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc19weScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX3BlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfcHInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc191eScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX3ZlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5faW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9hZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX3phJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnYWFtOklkU3luY0Rpc2FibGUnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2ZhbHNlJzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAndHJhY2s6YnRuTWFwcGluZyc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1sYW5kaW5nUGFnZTFUcmFja2luZ051bWJlcnNQcmVzZW50JzogJ1RyYWNraW5nIE51bWJlcnxUUkFDSycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay10cmFja0J5VENOLVRyYWNrQnRuJzogJ1RyYWNrIGJ5IFRDTnxUUkFDSycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1sYW5kaW5ncGFnZS12aWV3UG9kU3VibWl0QnV0dG9uJzogJ09idGFpbiBQT0R8VmlldyBQT0R8U1VCTUlUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLXRyYWNrQnlSZWZlcmVuY2UtVHJhY2tCdG4nOiAnVHJhY2sgQnkgUmVmZXJlbmNlfFRSQUNLJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLWxhbmRpbmdQYWdlLXRyYWNrLWhlbHBMaW5rJzogJ1RyYWNrfE5FRUQgSEVMUCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2dUYWc6Y3RhT3JhbmdlRENQYWdlTGlzdE1hcHBpbmcnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9zaGlwcGluZy1zZXJ2aWNlcy9pbnRlcm5hdGlvbmFsLXNoaXBwaW5nLmh0bWwnOiAnREMtOTc0NzE0L2ZlZGV4MC9mZWRleDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2Evc2hpcHBpbmctc2VydmljZXMvaW50ZXJuYXRpb25hbC1zaGlwcGluZy5odG1sJzogJ0RDLTk3NDcxNC9mZWRleDAvZmVkZXgwMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kZWxpdmVyeS1tYW5hZ2VyLmh0bWwnOiAnREMtNDE5MTI2My9mZG1lbjAvZmRtbGEwMDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvcHJpbnRpbmcvY29uc3VtZXItb2ZmZXJzLmh0bWwnOiAnREMtNDE5MTI2My9jb25zdTAvZmVkZXgwMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9vbnNpdGUvd2FsZ3JlZW5zLXBhY2thZ2UtcGlja3VwLmh0bWwnOiAnREMtNDE5MTI2My93YWxncjAvZmVkZXgwMCtzdGFuZGFyZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6RGVsYXllZCBQYWdlIFR5cGUnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnbm9ybWFsJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnRkRYLkRBVEFMQVlFUi5wYWdlLnBhZ2VJbmZvLmRlbGF5VHlwZScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGRvdFRhZ1BpeGVsTWFwcGluZzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3Bvc3NpYmlsaXRpZXMuaHRtbCc6ICcxMDAwNjQ1OCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9ob2xpZGF5L2NvbnN1bWVyLXNoaXBwaW5nLWRlbGl2ZXJ5LWd1aWRlLmh0bWwnOiAnMTAwMDY0NTgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2Evc2hpcHBpbmctc2VydmljZXMvaW50ZXJuYXRpb25hbC1zaGlwcGluZy5odG1sJzogJzEwMDkyOTA3JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2ludGVybmF0aW9uYWwtc2hpcHBpbmcuaHRtbCc6ICcxMDA5MjkwNycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9ob2xpZGF5Lmh0bWwnOiAnMTAwMDY0NTgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvY291cG9uLW9mZmVycy9ncm91bmQuaHRtbCc6ICcxMDE0MjIyNycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9vbnNpdGUvd2FsZ3JlZW5zLXBhY2thZ2UtcGlja3VwLmh0bWwnOiAnMTAxNDIyMjcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvaGVhbHRoY2FyZS92YWNjaW5lLXNoaXBwaW5nLmh0bWwnOiAnMTAxNDIyMjcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvZWNvbW1lcmNlL29mZmVyLXN0b3JlLXBpY2t1cC1hdC1jaGVja291dC5odG1sJzogJzEwMTQyMjI3JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL3NoaXBwaW5nLXRvb2xzL2ZyZWlnaHQtcXVvdGUtbm8tYWNjb3VudC5odG1sJzogJzEwMTQ1NjcwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL3NoaXBwaW5nLXRvb2xzL2ZyZWlnaHQtcXVvdGUuaHRtbCc6ICcxMDE0OTYwOScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9zaGlwcGluZy1zZXJ2aWNlcy9leHByZXNzLWZyZWlnaHQuaHRtbCc6ICcxMDE0NTY3MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jYS9zaGlwcGluZy10b29scy9mcmVpZ2h0LXF1b3RlLW5vLWFjY291bnQuaHRtbCc6ICcxMDE0NTY4MicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jYS9zaGlwcGluZy10b29scy9mcmVpZ2h0LXF1b3RlLmh0bWwnOiAnMTAxNDk2MTAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2Evc2hpcHBpbmctc2VydmljZXMvZXhwcmVzcy1mcmVpZ2h0Lmh0bWwnOiAnMTAxNDU2ODQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2Evc21hbGwtYnVzaW5lc3MvZWNvbW1lcmNlLXNvbHV0aW9ucy5odG1sJzogJzEwMTQ3NjMxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NtYWxsLWJ1c2luZXNzL2Vjb21tZXJjZS1zb2x1dGlvbnMuaHRtbCc6ICcxMDE0NzYzMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9zbWFsbC1idXNpbmVzcy5odG1sJzogJzEwMTQ3NjMzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NtYWxsLWJ1c2luZXNzLmh0bWwnOiAnMTAxNDc2MzQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2Evc2hpcHBpbmctc2VydmljZXMvZXhwcmVzcy1mcmVpZ2h0L2ludGVybmF0aW9uYWwtYWlyLWZyZWlnaHQtcXVvdGUuaHRtbCc6ICcxMDE0OTUwNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jYS9zaGlwcGluZy1zZXJ2aWNlcy9leHByZXNzLWZyZWlnaHQvaW50ZXJuYXRpb25hbC1haXItZnJlaWdodC1xdW90ZS5odG1sJzogJzEwMTQ5NTA2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL2NhcmVlcnMuaHRtbCc6ICcxMDE1ODE5MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jYS9jYXJlZXJzLmh0bWwnOiAnMTAxNTgxOTQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdnVGFnOkVuYWJsZWRMb2NhbGVFcGljJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OmxvY2FsZScpLm1hdGNoKC9hcl9hZXxlbl9hZXxlbl9iaHxlbl9icnxlbl9jbHxlbl9jbnxlbl9jb3xlbl9rd3xlbl9teHxlbl96YXxlc19jbHxlc19jb3xlc19teHxwdF9icnx6aF9jbi9naSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2FwcDpzaGlwU2VnSWRzJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICc4MDkyNjg2JzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnZ1RhZzpBZFdvcmRzRXZlbnRNYXBwaW5nJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1czogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3Bvc3NpYmlsaXRpZXMuaHRtbCc6ICdBVy04NjMyMzg3OTMveXNaVENNT1I3NFlCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL29uc2l0ZS5odG1sJzogJ0FXLTg2MzIzODc5My8wWnVGQ056WDVZWUJFSW4xejVzRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvcGFja2luZy5odG1sJzogJ0FXLTg2MzIzODc5My9qcnA1Q09xQzc0WUJFSW4xejVzRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvc3RvcmUvZ3JvdW5kLmh0bWwnOiAnQVctODYzMjM4NzkzL0VBWFlDUFNENzRZQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kZWxpdmVyeS1tYW5hZ2VyL2J1c2luZXNzLXRvb2xraXQuaHRtbCc6ICdBVy04NjMyMzg3OTMvOW5EdkNJajc3TGNCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL3JldHVybnMvYnVzaW5lc3MuaHRtbCc6ICdBVy04NjMyMzg3OTMvYjZJZENMZm5oN2dCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL2ludGVybmF0aW9uYWwvaG93LXRvLXNoaXAuaHRtbCc6ICdBVy04NjMyMzg3OTMvYlpzM0NLSHBoN2dCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nLzctZGF5LWRlbGl2ZXJ5Lmh0bWwnOiAnQVctODYzMjM4NzkzL2JqblFDT3FKN2JjQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9lY29tbWVyY2UvZnVsZmlsbG1lbnQtc2hpcHBpbmcuaHRtbCc6ICdBVy04NjMyMzg3OTMvdEtTTENMWHJfTGNCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2Rpc2NvdW50LXByb2dyYW1zL2FnMTMzOTg2MDIuaHRtbCc6ICcvZW4tdXMvZGlzY291bnQtcHJvZ3JhbXMvYWcxMzM5ODYwMi5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9lY29tbWVyY2UuaHRtbCc6ICdBVy04NjMyMzg3OTMvcGc0NENQT0g2TUlCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2JpZy1jb21tZXJjZS5odG1sJzogJ0FXLTg2MzIzODc5My9PQWZSQ0xHVHlNMEJFSW4xejVzRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvcHJpbnRpbmcvc21hbGwtbWVkaXVtLWJ1c2luZXNzLW9mZmVycy5odG1sJzogJ0FXLTg2MzIzODc5My9fd2Z1Q0tQUXRjOEJFSW4xejVzRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvcHJpbnRpbmcvZGVzaWduLXNlcnZpY2VzLmh0bWwnOiAnQVctODYzMjM4NzkzL1ZpVWlDSzJubnRBQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kZWxpdmVyeS1tYW5hZ2VyLmh0bWwnOiAnQVctODYzMjM4NzkzL2VTN2JDTXJoM053QkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kZWxpdmVyeS1tYW5hZ2VyL21hbmFnZS15b3VyLWRlbGl2ZXJpZXMuaHRtbCc6ICdBVy04NjMyMzg3OTMvblVlRkNMRHY1ZHdCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2hvbGlkYXkvY29uc3VtZXItc2hpcHBpbmctZGVsaXZlcnktZ3VpZGUuaHRtbCc6ICdBVy04NjMyMzg3OTMvRjV2NUNKX0tydUVCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2hvbGlkYXkuaHRtbCc6ICdBVy04NjMyMzg3OTMvS19BeUNQNjFrLUVCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL2NvbnN1bWVyLW9mZmVycy5odG1sJzogJ0FXLTg2MzIzODc5My9pMzdmQ05YcGtPSUJFSW4xejVzRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvb25zaXRlL3dhbGdyZWVucy1wYWNrYWdlLXBpY2t1cC5odG1sJzogJ0FXLTg2MzIzODc5My9DT3NLQ01lRWhlSUJFSW4xejVzRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvcHJpbnRpbmcvZmxhc2gtc2FsZS1vZmZlcnMuaHRtbCc6ICdBVy04NjMyMzg3OTMvQzQwMkNPXzlrT0lCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL29uc2l0ZS9kb2xsYXItZ2VuZXJhbC1waWNrLXVwLWRyb3Atb2ZmLXBhY2thZ2UuaHRtbCc6ICdBVy04NjMyMzg3OTMvU1kwcUNONjc4LUVCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL2hvbGQtYXQtbG9jYXRpb24uaHRtbCc6ICdBVy04NjMyMzg3OTMvbTBGeENKcTFsdU1CRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2NvdXBvbi1vZmZlcnMvZ3JvdW5kLmh0bWwnOiAnQVctODYzMjM4NzkzL1ZtbHdDSU95LWVFQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9oZWFsdGhjYXJlL3ZhY2NpbmUtc2hpcHBpbmcuaHRtbCc6ICdBVy04NjMyMzg3OTMvdkZ6c0NPZnFuUEVCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2Vjb21tZXJjZS9vZmZlci1zdG9yZS1waWNrdXAtYXQtY2hlY2tvdXQuaHRtbCc6ICdBVy04NjMyMzg3OTMvUkNTTENJUF9sZk1CRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL3JldHVybnMvdGVjaG5vbG9neS5odG1sJzogJ0FXLTg2MzIzODc5My9UTHlZQ01QN3pPMEJFSW4xejVzRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvZWNvbW1lcmNlL3NoaXBwaW5nLW9wdGlvbnMuaHRtbCc6ICdBVy04NjMyMzg3OTMvUzBhNENNT2c4TzBCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL2ludGVybmF0aW9uYWwuaHRtbCc6ICdBVy04NjMyMzg3OTMvdkN3Q0NLbTUzLTBCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL2hvbWUtZGVsaXZlcnkuaHRtbCc6ICdBVy04NjMyMzg3OTMvT0UzOUNNcjN6ZTBCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2Vjb21tZXJjZS90b29scy1hbmQtc2VydmljZXMuaHRtbCc6ICdBVy04NjMyMzg3OTMvSTNZWUNJM0tsTzRCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3N3ZWVwc3Rha2VzL2NvbWUtaW4tYW5kLWNhc2gtaW4uaHRtbCc6ICdBVy04NjMyMzg3OTMvc3JVQkNPUFBwZk1DRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3N3ZWVwc3Rha2VzLmh0bWwnOiAnQVctODYzMjM4NzkzL1ZYcjRDT3VMcHZNQ0VJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zd2VlcHN0YWtlcy9ob2xpZGF5LWRyb3Atb2ZmLmh0bWwnOiAnQVctODYzMjM4NzkzL3JNVm5DS2lUcHZNQ0VJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9zYXR1cmRheS1hbmQtc3VuZGF5LWRlbGl2ZXJ5Lmh0bWwnOiAnQVctODYzMjM4NzkzL0FWdkhDUE9RcHZNQ0VJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zbWFsbC1idXNpbmVzcy9ncmFudC1jb250ZXN0Lmh0bWwnOiAnQVctODYzMjM4NzkzL1JfbFVDSURicGZNQ0VJbjF6NXNEJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgemE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi16YS9hYm91dC9wb3NzaWJpbGl0aWVzLmh0bWwnOiAnQVctNjk4NTIwODE3L1pzZnpDUC1pcXJNQkVQR3BpczBDJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi16YS9vcGVuLWFjY291bnQuaHRtbCc6ICdBVy02OTg1MjA4MTcvWFJxNkNKdm5uYk1CRVBHcGlzMEMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXphL2NhbXBhaWduL2RlbGl2ZXJpbmctd2hhdC1tYXR0ZXJzLmh0bWwnOiAnQVctNjM0MzczNjA3L2FwSktDTHFGNGRFQkVPZUx2NjRDJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hdS9jYW1wYWlnbi90dC5odG1sJzogJ0FXLTY4Mzk4NzA4Mi84clNvQ05EQmtMZ0JFSXFoazhZQycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tYXUvbmV3LWN1c3RvbWVyLmh0bWwnOiAnQVctNjgzOTg3MDgyL3ByLXJDSl9iaGJnQkVJcWhrOFlDJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbno6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1uei9jYW1wYWlnbi90dC5odG1sJzogJ0FXLTY4Mzk4NzA4Mi9jcWpXQ1BMZ2hiZ0JFSXFoazhZQycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbnovbmV3LWN1c3RvbWVyLmh0bWwnOiAnQVctNjgzOTg3MDgyL2VUN3RDUHlHOXJjQkVJcWhrOFlDJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW46IHsgJy9lbi1pbi9vcGVuLWFjY291bnQvdGhhbmsteW91Lmh0bWwnOiAnQVctMTA2NjUwMTEwNy96QWp1Q0lYYThnRVE4NGZHX0FNJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2EvZWNvbW1lcmNlLXNoaXBwaW5nL3N1cHBvcnQtZm9yLXlvdXItY3VzdG9tZXJzLmh0bWwnOiAnQVctMTAzMzU3Nzc5Ny90N2dwQ0xTWm1Qd0NFTVhLN093RCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2EvZWNvbW1lcmNlLXNoaXBwaW5nL3N1cHBvcnQtZm9yLXlvdXItY3VzdG9tZXJzLmh0bWwnOiAnQVctMTAzMzU3Nzc5Ny9iZTNYQ1BMbG1md0NFTVhLN093RCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2EvbWFuYWdlLW15LWRlbGl2ZXJpZXMuaHRtbCc6ICdBVy0xMDMzNTc3Nzk3L2FDd0JDTENqOGZzQ0VNWEs3T3dEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jYS9tYW5hZ2UtbXktZGVsaXZlcmllcy5odG1sJzogJ0FXLTEwMzM1Nzc3OTcvRGZJYkNJVEttZndDRU1YSzdPd0QnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnY29udGVudDpzaXRlIHNlY3Rpb24nOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnRkRYLkRBVEFMQVlFUi5wYWdlLmNhdGVnb3J5LnByaW1hcnlDYXRlZ29yeScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdldmVudDp2YUNsaWNrJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ0ZEWC5EQVRBTEFZRVIuVkEuc3RhdHVzJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6cGFnZVBhdGgnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnRkRYLkRBVEFMQVlFUi5wYWdlLnBhZ2VJbmZvLnBhZ2VQYXRoJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ3ZhOmRpc2FibGVkUGFnZUxpc3QnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvY3VzdG9tZXItc3VwcG9ydC5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2NvbnRhY3QtdXMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lcy11cy8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItbXEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2VydmljZWFsZXJ0Lmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvcXVpY2staGVscCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9kYS1kay8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvbm8tbm8vJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL3N2LXNlLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1ncC8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItaHQvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL3ZpLXZuLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9hci1hZS8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvb2ZmaWNlL3NhbXN1bmctcmVwYWlyLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvc3BhY2UuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9vZmZpY2UvcHNnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3RydXN0LWNlbnRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9jcmVhdGUtYWNjb3VudC5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2Rpc2NvdW50LXByb2dyYW1zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2Vjb21tZXJjZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zbWFsbC1idXNpbmVzcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zbWFsbC1idXNpbmVzcy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWdiLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1pZS8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tZGsvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLW5vLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1zZS8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbmwvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL25sLW5sLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1mci8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItZnIvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWl0LycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9pdC1pdC8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tYmUvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWJlLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9ubC1iZS8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tZXMvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VzLWVzLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hdC8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tZGUvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2RlLWRlLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1wbC8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvcGwtcGwvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnc2l0ZS1kaWFnbm9zdGljczp2aWV3cG9ydCc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBGRFguQlJFQUtQT0lOVFMgJiYgKGUgPSB2b2lkIDAgIT09IEZEWC5CUkVBS1BPSU5UUy5nZXRWaWV3UG9ydCgpID8gRkRYLkJSRUFLUE9JTlRTLmdldFZpZXdQb3J0KCkgOiAnJyksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2xvZ2luOmZkeF9jYmlkJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gX3NhdGVsbGl0ZS5jb29raWUuZ2V0KCdmZHhfY2JpZCcpID8gX3NhdGVsbGl0ZS5jb29raWUuZ2V0KCdmZHhfY2JpZCcpIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ1RhcmdldDphdF9wcm9wZXJ0eSc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gJycsIHQgPSBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpyZWdpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyAhPSB0ICYmICcnICE9PSB0ICYmICgndXMnID09IHQgPyBlID0gJzRiYTA2NWMwLTZiOTItMTNhNS1jY2M4LTJiOGNmYjIxYWJkYScgOiAnY2FuJyA9PSB0ID8gZSA9ICdjMjQyMTBmZi04YzY0LTkxNjAtM2E3Yi1mZGM0OTg0YTc0NjAnIDogJ2FwYWMnID09IHQgPyBlID0gJ2ViNjQxNmQ3LTBhNjQtOTJkOS0zN2QwLWM2MmQ1YjZlMTZlZCcgOiAnbGFjJyA9PSB0ID8gZSA9ICdiMTdlMzMyMi1hZjUwLWJmN2YtY2I4Yi05MGNhN2RhZWNmNDknIDogJ21laXNhJyA9PSB0ID8gZSA9ICcxZWFlY2FmNS1hMzI0LWM4MmUtN2UwZS0zM2Q2MjUxY2ZkYjgnIDogJ2V1JyA9PSB0ICYmIChlID0gJzE5MjQyM2VlLWMxYzktNjZkZi04MDRkLTVmYjczNDc1MzViYycpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnUENGOlV0aWwnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdBbGxvd2VkUHJvZERvbWFpbnMnKSwgdCA9IHdpbmRvdy5sb2NhdGlvbi5ob3N0bmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IHQubWF0Y2goL3d3dyhiYXNlLmlkZXZ8ZGV2LmlkZXZ8ZHJ0LmlkZXZ8c3RyZXNzLmRtei5pZGV2fGJpdC5pZGV2fHRlc3R8KS5mZWRleC5jb20vZ2kpID8gdCA6IGUubGVuZ3RoID4gMCAmJiBlLmluZGV4T2YodCkgPiAtMSA/ICd3d3cuZmVkZXguY29tJyA6ICd3d3d0ZXN0LmZlZGV4LmNvbSc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2FhbTpSZWdpb25Db250YWluZXJOU0lEJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9ICcnICE9PSBfc2F0ZWxsaXRlLmdldFZhcignYWFtOmNvbnRhaW5lck5TSURNYXBwaW5nJykgPyBfc2F0ZWxsaXRlLmdldFZhcignYWFtOmNvbnRhaW5lck5TSURNYXBwaW5nJykgOiAnJywgdCA9IDAsIG4gPSBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpyZWdpb24nKSwgciA9IEZEWC5EQVRBTEFZRVIucGFnZS5wYWdlSW5mby5sb2NhbGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSAvW2Etel17Mn1fW2Etel17Mn0vZy5leGVjKHIpICYmIDUgPT0gci5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBlICYmICcnICE9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi50b0xvd2VyQ2FzZSgpLmluZGV4T2YoaSkgPiAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBlW2ldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VJbnQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgZ1RhZ0Rpc2FibGVMb2NhbGU6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpsb2NhbGUnKS5tYXRjaCgvZW5fYXR8ZGVfYXR8bmxfYmV8ZnJfYmV8ZW5fYmV8YmdfYmd8ZW5fYmd8ZW5fY3l8Y3NfY3p8ZW5fY3p8ZGFfZGt8ZW5fZGt8ZXRfZWV8ZW5fZWV8ZmlfZml8ZW5fZml8ZnJfZnJ8ZW5fZnJ8ZW5fZGV8ZGVfZGV8ZW5fZ3J8ZWxfZ3J8ZW5faHV8aHVfaHV8ZW5faXN8ZW5faWV8ZW5faXR8aXRfaXR8ZW5fbHZ8bHZfbHZ8ZW5fbGl8ZW5fbHR8bHRfbHR8ZnJfbHV8ZW5fbHV8ZW5fbXR8ZW5fbm98bm9fbm98ZW5fcGx8cGxfcGx8ZW5fcHR8cHRfcHR8ZW5fcm98cm9fcm98ZW5fc2t8c2tfc2t8ZW5fc2l8c2xfc2l8ZW5fZXN8ZXNfZXN8ZW5fc2V8c3Zfc2V8bmxfbmx8ZW5fbmx8ZW5fZ2J8ZW5fdGh8dGhfdGh8ZW5fcGh8ZW5fbXl8ZW5fY258emhfY24vZ2kpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdxdWFsdHJpY3M6cGFnZUxpc3RNYXBwaW5nJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2dldC1zdGFydGVkLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvY291cG9uLW9mZmVycy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2NvdXBvbi1vZmZlcnMvZ3JvdW5kLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvb2ZmaWNlL3dhbG1hcnQuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL2Ryb3Bib3guaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9ob2xkLWF0LWxvY2F0aW9uLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvb25zaXRlLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvcGFja2luZy1ib3hlcy9zZXJ2aWNlcy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL3BhY2tpbmctc3VwcGxpZXMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9zdG9yZS9ncm91bmQuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy90cmFja2luZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2JpbGxpbmctb25saW5lLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvY3JlYXRlLWFjY291bnQuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9jcmVhdGUtYWNjb3VudC9hY2NvdW50LW1hbmFnZW1lbnQuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nLzItMy1kYXkuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9mZWRleC1zbWFydHBvc3QuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9ncm91bmQuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9ob21lLWRlbGl2ZXJ5Lmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvaW50ZXJuYXRpb25hbC1ncm91bmQtY2FuYWRhLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvb3Zlcm5pZ2h0Lmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvc2FtZS1kYXkuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9zY2hlZHVsZS1tYW5hZ2UtcGlja3Vwcy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL3NlcnZpY2VzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvY3VzdG9tZXItc3VwcG9ydC5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2N1c3RvbWVyLXN1cHBvcnQvY2xhaW1zLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2VydmljZS1ndWlkZS5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NlcnZpY2UtZ3VpZGUvcGlja3VwLWRlbGl2ZXJ5Lmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvbW9iaWxlLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvZmFxL2RlbGl2ZXJ5LW1hbmFnZXIuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9zdG9yZS9zaGlwcGluZy1zZXJ2aWNlcy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL29uc2l0ZS93YWxncmVlbnMtcGFja2FnZS1waWNrdXAuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9vbmxpbmUtcHJpbnRpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9zdG9yZS9hbGwtbG9jYXRpb24tdHlwZXMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi10dy9jYW1wYWlnbi9nZXRzdGFydGVkLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvemgtdHcvY2FtcGFpZ24vZ2V0c3RhcnRlZC5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWpwL29ubGluZS9zaGlwcGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWpwL29ubGluZS9zaGlwcGluZy5odG1sIy9zaGlwbWVudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9qYS1qcC9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9jdXN0b21lci1zdXBwb3J0L2hvdy10by9kb29yLXRhZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2N1c3RvbWVyLXN1cHBvcnQvaG93LXRvL3NjaGVkdWxlLWEtcGlja3VwLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2Evc2hpcHBpbmctc2VydmljZXMvaW50ZXJuYXRpb25hbC5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2ludGVybmF0aW9uYWwvZXhwb3J0Lmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tYXUvb25saW5lL3NoaXBwaW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbnovb25saW5lL3NoaXBwaW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tYXUvY2FtcGFpZ24vc21hbGwtYnVzaW5lc3MuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1uei9jYW1wYWlnbi9zbWFsbC1idXNpbmVzcy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL29ubGluZS9yYXRpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC1oay9vcGVuLWFjY291bnQuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1oay9vcGVuLWFjY291bnQuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC1jbi9jYW1wYWlnbi9mcm9udGRvb3IuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC10dy9jYW1wYWlnbi9mcm9udGRvb3IuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9qYS1qcC9jYW1wYWlnbi9mcm9udGRvb3IuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9rby1rci9jYW1wYWlnbi9mcm9udGRvb3IuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9zbWFsbC1idXNpbmVzcy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NtYWxsLWJ1c2luZXNzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tYXUvYmlsbGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWd1L2JpbGxpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1oay9iaWxsaW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvemgtaGsvYmlsbGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWpwL2JpbGxpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9qYS1qcC9iaWxsaW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4ta3IvYmlsbGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2tvLWtyL2JpbGxpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1tby9iaWxsaW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbXkvYmlsbGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLW56L2JpbGxpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1waC9iaWxsaW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tc2cvYmlsbGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXR3L2JpbGxpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC10dy9iaWxsaW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdGgvYmlsbGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL3RoLXRoL2JpbGxpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kZXZlbG9wZXIuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kZXZlbG9wZXIvd2ViLXNlcnZpY2VzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvZGV2ZWxvcGVyL3dlYi1zZXJ2aWNlcy9wcm9jZXNzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2EvY29udGFjdC11cy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL2NvbnRhY3QtdXMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1pbi9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jbi9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy90aC10aC9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi10aC9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC1oay9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1oay9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC1jbi9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hZi9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hbC9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1kei9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hby9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hbS9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1teS9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1zZy9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1waC9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hZS9vbmxpbmUvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLXRoLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L3poLWNuLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L3poLWhrLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2phLWpwLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLWdiLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLWhrLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLXBsLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLWluLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLW5sLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L25sLW5sLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLWNuLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLWpwLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L3BsLXBsLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L3RoLXRoLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLWF1LycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLWlkLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2lkLWlkLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2tvLWtyLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLWtyLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLW15LycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLW56LycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9zaGlwbWVudC1oaXN0b3J5L2VuLXNnLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9pbnRlcm5hdGlvbmFsLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvb2ZmaWNlLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvb25lLXJhdGUuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9mcmVpZ2h0Lmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvaG9tZS5odG1sJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAndmE6bW9iRW5hYmxlZFVybCc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAnL3RyYWNraW5nL2FkdmFuY2VkLmh0bWwnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzJyArIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYScgKyBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2EnICsgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2RlLWNoJyArIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jaCcgKyBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvaXQtY2gnICsgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNoJyArIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9kZWxpdmVyeS1tYW5hZ2VyL3BlcnNvbmFsLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2EvZGVsaXZlcnktbWFuYWdlci9wZXJzb25hbC5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL21hbmFnZS1teS1kZWxpdmVyaWVzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2EvbWFuYWdlLW15LWRlbGl2ZXJpZXMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9yZXNvdXJjZXMtdG9vbHMvYmlsbGluZy1jZW50cmUuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jYS9yZXNvdXJjZXMtdG9vbHMvYmlsbGluZy1jZW50cmUuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9zaGlwcGluZy1zZXJ2aWNlcy9pbnRlcm5hdGlvbmFsL2R1dGllcy10YXhlcy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2ludGVybmF0aW9uYWwvZHV0aWVzLXRheGVzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2Evc2hpcHBpbmctc2VydmljZXMvaW50ZXJuYXRpb25hbC9pbXBvcnQuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jYS9zaGlwcGluZy1zZXJ2aWNlcy9pbnRlcm5hdGlvbmFsL2ltcG9ydC5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2RlLWNoL3RyYWNraW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2gvdHJhY2tpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9pdC1jaC90cmFja2luZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNoL3RyYWNraW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZGUtY2gvbmV3LWN1c3RvbWVyLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2gvbmV3LWN1c3RvbWVyLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvaXQtY2gvbmV3LWN1c3RvbWVyLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2gvbmV3LWN1c3RvbWVyLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZGUtY2gvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jaC9zaGlwcGluZy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2l0LWNoL3NoaXBwaW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2gvc2hpcHBpbmcuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9kZS1jaC9ob21lLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2gvaG9tZS5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2l0LWNoL2hvbWUuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jaC9ob21lLmh0bWwnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICd0YWdJRDpjb250ZW50U3F1YXJlJzogewogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpLCAnd3d3LmZlZGV4LmNvbScgPT09IF9mZHgucGNmVXRpbCgpID8gJzljMDcyZWJkLTBkOWEtNGIzNy05ZTU0LWJhMGMzYmIwNTg4ZCcgOiAnMjNhOWMyZjgtYWViNC00NTRjLWJlMzctODg2MTI4NWU5ZDBjJzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnY2xpY2s6YmxvY2tMaXN0JzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaG9sZCBhdCBsb2NhdGlvbixmYWxzZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ludGVybmF0aW9uYWwgdHJhZmZpYyBpbiBhcm1zIHJlZ3VsYXRpb25zLGZhbHNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGVsaXZlcnkgb24gaW52b2ljZSBhY2NlcHRhbmNlLGZhbHNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2F2ZSBkaWEgcmV0dXJuIGFkZHJlc3MsZmFsc2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdyZXR1cm5zIGNsZWFyYW5jZSxmYWxzZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1sYW5kaW5ncGFnZTF0cmFja2luZ251bWJlcnNwcmVzZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLXN1bW1hcnlwYWdlLXRyYWNrYnRuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXRyay1kZXRhaWxwYWdlLWNkby1idXR0b24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstbGFuZGluZ3BhZ2UtdHJhY2tidG4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtdHJrLWRldGFpbHBhZ2Utc2VuZG5vdGlmeWNoZWNrYm94LWN1cnJlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstZGV0YWlscGFnZS1zZW5kbm90aWZ5Y2hlY2tib3gtY3VycmVudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay10cmFja2J5cmVmZXJlbmNlLWFjY291bnRudW1iZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstZGV0YWlscGFnZS1hc3Njc2hpcG1lbnRpY29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXRyay1ub3RpZmljYXRpb25wYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXRyay10cmstZGV0YWlscGFnZS1zZW5kbm90aWZ5Y2hlY2tib3gtZGVsaXZlcnlleGNlcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstZGV0YWlscGFnZS1zZW5kbm90aWZ5Y2hlY2tib3gtZGVsaXZlcnlleGNlcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstZGV0YWlscGFnZS1zZW5kbm90aWZ5Y2hlY2tib3gtZGVsaXZlcmVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXRyay1kZXRhaWxwYWdlLXNlbmRub3RpZnljaGVja2JveC1kZWxpdmVyZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtdHJrLWRldGFpbHBhZ2Utc2VuZG5vdGlmeWNoZWNrYm94LWV4Y2VwdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1kZXRhaWxwYWdlLXNlbmRub3RpZnljaGVja2JveC1leGNlcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstZGV0YWlscGFnZS1hY3Rpb25iYXItbW9yZWFjdGlvbnNfaGVhZGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLXRyYWNrbW9kdWxlLXBsYWNhcmQtcHJlc3NlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ210cmstZGV0YWlscGFnZS1zY2hlZHVsZWRkZWxpdmVyeWRhdGVpY29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLWRldGFpbHBhZ2Utc2VuZG5vdGlmeWNvbnRpbnVlYnRuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLWRldGFpbHBhZ2Utc2VuZG5vdGlmeWRlbGl2ZXJlZHN0YXR1c3NlbGVjdGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXRyay1kZXRhaWxwYWdlLXNlbmRub3RpZnljb250aW51ZWJ0bicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1kZXRhaWxwYWdlLXNlbmRub3RpZnllc3RkZWx1cGRhdGVzdGF0dXNzZWxlY3RlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ210cmstZGV0YWlscGFnZS1zZW5kbm90aWZ5ZGVsaXZlcmVkc3RhdHVzc2VsZWN0ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstZGV0YWlscGFnZS1zZW5kbm90aWZ5Y3VycmVucnN0YXR1c3NlbGVjdGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXRyay1kZXRhaWxwYWdlLXNlbmRub3RpZnljdXJyZW5yc3RhdHVzc2VsZWN0ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstdHJhY2ttb2R1bGUtd2F0Y2hsaXN0dGFiJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXRyay1kZXRhaWxwYWdlLXNlbmRub3RpZnllc3RkZWx1cGRhdGVzdGF0dXNzZWxlY3RlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1kZXRhaWxwYWdlLXNlbmRub3RpZnlleGNlcHRpb25zc3RhdHVzc2VsZWN0ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtdHJrLXRyYWNrbW9kdWxlLWFsbHNoaXBtZW50c3RhYicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1kZXRhaWxwYWdlLXNoaXBtZW50c25hcHNob3QtZGVzdGluYXRpb24taGVscCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1kZXRhaWxwYWdlLXRpbWV6b25lZHJvcGRvd24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtdHJrLWRldGFpbHBhZ2Utc2VuZG5vdGlmeWNoZWNrYm94LXRlbmRlcmVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLWRldGFpbHBhZ2Utc2VuZG5vdGlmeWNoZWNrYm94LXRlbmRlcmVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXRyay1kZXRhaWxwYWdlLXNlbmRub3RpZnlleGNlcHRpb25zc3RhdHVzc2VsZWN0ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstdHJhY2tieXJlZmVyZW5jZS1kZXN0aW5hdGlvbmNvdW50cnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtdHJrLWRldGFpbHBhZ2Utc2hpcGRhdGVpY29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXRyay10cmFja21vZHVsZS13YXRjaGxpc3R0YWInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtdHJrLWRldGFpbHBhZ2Utc3RhbmRhcmR0cmFuc2l0aGVscGljb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstdHJhY2tieXJlZmVyZW5jZS10cmFja2J0bicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1kZXRhaWxwYWdlLXNoaXBtZW50ZmFjdHMtaGVscC1pY29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLXRyYWNrbW9kdWxlLWFsbHNoaXBtZW50c3RhYicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay10cmFja2J5dGNuLXRjbi1pbnB1dGZpZWxkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXRyay1kZXRhaWxwYWdlLW9wb2RwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1kZXRhaWxwYWdlLXNhdmV0cmFja251bWJlcmNoa2JveC1jaGVja2VkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLXN1bW1hcnlwYWdlMXRyYWNraW5nbnVtYmVyc3ByZXNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtdHJrLWRldGFpbHBhZ2UtdHJhdmVsaGlzdG9yeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ210cmstdHJhY2ttb2R1bGUtZXhjZXB0aW9uc3RhYicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ210cmstdHJhY2ttb2R1bGUtcGxhY2FyZC1wcmVzc2VkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLWRldGFpbHBhZ2UtdHJhdmVsaGlzdG9yeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1kZXRhaWx2aWV3LXNjcm9sbGluZ2xpc3QtcGxhY2FyZC1wcmVzc2VkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLXRyYWNrbW9kdWxlLXdhdGNobGlzdHRhYicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay10cmFja21vZHVsZS1leGNlcHRpb25zdGFiJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGluayBjbGljazogYWRkcmVzc2NoZWNrLCB0cnVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ2V0Y3VzdG9taXplZHZpZXdzZnJvbWFkbWMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsaW5rIGNsaWNrOiBhZGRyZXNzcmVzdWx0LCB0cnVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2F2ZSBhcyBkZWZhdWx0IHJldHVybiBhZGRyZXNzLGZhbHNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmV0dXJuczpzYXR1cmRheSBkZWxpdmVyeSBhbGxvd2VkLGZhbHNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGRyfHRhYnwxfFNoaXBwaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGRyfHRhYnwyfFRyYWNraW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGRyfHRhYnwzfFByaW50aW5nIFNlcnZpY2VzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGRyfHRhYnw0fExvY2F0aW9ucycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2hkcnx0YWJ8NXxTdXBwb3J0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGVyb3xjdWJlfFJBVEUmU0hJUCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2hlcm98Y3ViZXxUUkFDSycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2hlcm98Y3ViZXxMT0NBVElPTlMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdob21lfE9wZW4gQSBGZWRFeCBBY2NvdW50JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGFifGVudmVsb3BlfHBhY2thZ2VzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGFifGZyZWlnaHR8c2hpcHBpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0YWJ8ZXhwZWRpdGVkfGV4dHJhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGFifGFpcnxmcmVpZ2h0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLXRyYWNrQnlUQ04tVENOLUlucHV0RmllbGQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstbGFuZGluZ1BhZ2UtcHJvbXB0VG9Mb2dpbmZvckJPTCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1sYW5kaW5nUGFnZS1yYWRpb0J0bi1CaWxsT2ZMYWRpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstbGFuZGluZ1BhZ2UtcmFkaW9CdG4tUHJvb2ZPZkRlbGl2ZXJ5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLWxhbmRpbmdQYWdlLXJhZGlvQnRuLUZheExldHRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1sYW5kaW5nUGFnZS1yYWRpb0J0bi1WaWV3UHJpbnRMZXR0ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstdHJhY2tCeVRDTi1UcmFja0J0bicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Ryay1sYW5kaW5nUGFnZS1tdWxpdGlwbGVUcmFja2luZ051bWJlckxpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0cmstbGFuZGluZ1BhZ2Utc2luZ2xlVHJhY2tpbmdOdW1iZXJMaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHJrLWxhbmRpbmdQYWdlLXRyYWNrLWhlbHBMaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGRyfExvZ2luJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB2ZXJpem9uQnRuQ2xpY2tNYXBwaW5nOiB7CiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGb3JtfEVOLUZyZWlnaHQgUXVvdGUtTm8tQWNjb3VudCc6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAxNDU2NzIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGZWRFeF9IZWF2eXdlaWdodF9GcmVpZ2h0X1F1b3RlX0J1dHRvbl9FTicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGb3JtfEZSLUZyZWlnaHQgUXVvdGUtTm8tQWNjb3VudCc6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAxNDU2ODMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGZWRFeF9IZWF2eXdlaWdodF9GcmVpZ2h0X1F1b3RlX0J1dHRvbl9GUicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGb3JtfEZSLUZyZWlnaHQgUXVvdGUnOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMTQ1NjgzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRmVkRXhfSGVhdnl3ZWlnaHRfRnJlaWdodF9RdW90ZV9CdXR0b25fRlInCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRm9ybXxGcmVpZ2h0IFF1b3RlIHdpdGggQWNjb3VudCc6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAxNDU2NzIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGZWRFeF9IZWF2eXdlaWdodF9GcmVpZ2h0X1F1b3RlX0J1dHRvbl9FTicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGb3JtfEJleW9uZCB0aGUgQnV5IEJ1dHRvbi1GUic6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAxNDc2MzAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGZWRFeF9lQ29tbWVyY2VfR0VUIE5PVyBCdXR0b25fRlInCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRm9ybXxCZXlvbmQgdGhlIEJ1eSBCdXR0b24nOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMTQ3NjI5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRmVkRXhfZUNvbW1lcmNlX0dFVCBOT1cgQnV0dG9uX0VOJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2xpbmt8U3RhcnQgeW91ciBxdW90ZSc6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAxNDk2MjksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGZWRFeF9IZWF2eXdlaWdodF9CdXR0b25fTm9BY2NfRU4nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGlua3xDb21tZW5jZXogdm90cmUgZXN0aW1hdGlvbic6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAxNDk2MzAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGZWRFeF9IZWF2eXdlaWdodF9CdXR0b25fTm9BY2NfRlInCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGVyb3xGSU5EIEEgSk9CJzogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDE1ODIwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1JlY3J1aXRtZW50X1NlYXJjaEJ1dHRvbl9FTicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdoZXJvfFRST1VWRVIgVU4gRU1QTE9JJzogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDE1ODIwMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1JlY3J1aXRtZW50X1NlYXJjaEJ1dHRvbl9GUicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsaW5rfFJFUVVFU1QgQSBDT05TVUxUQVRJT04tRlInOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMTYwNDAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSGVhbHRjYXJlX0NvbnN1bHRCdXR0b25fRlInCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGlua3xSRVFVRVNUIEEgQ09OU1VMVEFUSU9OJzogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDE2MDQwMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0hlYWx0aGNhcmVfQ29uc3VsdEJ1dHRvbl9FTicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGb3JtfEhlYWx0aGNhcmV8Q29udGFjdCBVcyAtIENBRlInOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMTYwNDkyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSGVhbHRoY2FyZV9TdWJtaXRCdXR0b25fRlInCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRm9ybXxIZWFsdGhjYXJlfENvbnRhY3QgVXMnOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMTYwNDkwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSGVhbHRoY2FyZV9TdWJtaXRCdXR0b25fRU4nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAndmVyaXpvbjp0aW1lRnJhbWUnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gJzE1NzgyNjg3OTkwMDAnLCB0ID0gJycsIG4gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyA9PSB0eXBlb2YgX2ZkeCAmJiBfc2F0ZWxsaXRlLmdldFZhcignX2ZkeFV0aWwnKSwgX2ZkeC5pc0xpdmUoZSwgdCkgJiYgKG4gPSAhMCksIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2FhbTpyZWdpb25GbGFnJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBfc2F0ZWxsaXRlLmdldFZhcignYWFtOnJlZ2lvbnMnKSwgdCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OnJlZ2lvbicpLCBuID0gdm9pZCAwICE9PSB0ICYmICcnICE9PSB0ID8gdCA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnICE9IG4gJiYgZS5pbmRleE9mKG4pID4gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2xvZ2luOnN0YXR1cyc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IF9zYXRlbGxpdGUuY29va2llLmdldCgnZmR4X2xvZ2luJykgJiYgX3NhdGVsbGl0ZS5jb29raWUuZ2V0KCdmZHhfbG9naW4nKSA/ICdMb2dnZWQgSW4nIDogJ0xvZ2dlZCBPdXQnOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdnVGFnOlRhcmdldEVuYWJsZWRNYXBwaW5nJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVFB8WFR8VVNJU3xZVFB8SEVST3xDVEF8Q2hlY2tJbnRsU2VydmljZXMnOiAnQVctODYzMjM4NzkzL05XdDNDTzJqOE8wQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVFB8WFR8VVNJU3xZVFB8SEVST3xDVEF8Q0FfQ2hlY2tJbnRsU2VydmljZXMnOiAnQVctODYzMjM4NzkzL05XdDNDTzJqOE8wQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVFB8WFR8VVNFVFN8WVRQfEhFUk98Q1RBfEhvd1RvU2F2ZSc6ICdBVy04NjMyMzg3OTMvQXBMWENQUzloTzRCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUUHxYVHxVU0hEfFlUUHxIRVJPfENUQXxDaGVja1RyYW5zaXRUaW1lcyc6ICdBVy04NjMyMzg3OTMvemZ5dENQNkQ0dTBCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUUHxBQnxVU1M3RHxMZW5zcmVudGFsQXxIRVJPfENUQXxDaGVja1RoZVNlcnZpY2VNYXAnOiAnQVctODYzMjM4NzkzL3ZOdTFDTkQyZy00QkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVFB8QUJ8VVNTN0R8TGVuc1JlbnRhbEJ8SEVST3xDVEF8R2V0QVJhdGVOb3cnOiAnQVctODYzMjM4NzkzL1BpQlNDTDM0Zy00QkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVFB8QUJ8VVNTN0R8UmVzaXxIRVJPfENUQXxTZXJ2aWNlTWFwJzogJ0FXLTg2MzIzODc5My96Q2lHQ1A3QjdQWUJFSW4xejVzRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1RQfEFCfFVTUzdEfFJlc2l8SEVST3xDVEF8R2V0QVJhdGVOb3cnOiAnQVctODYzMjM4NzkzL1ZBRERDT2lZOXZZQkVJbjF6NXNEJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAndmE6Y2Fhc0VuYWJsZWRDb3VudHJ5TGlzdCc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ZyX2NoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGVfY2gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpdF9jaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2JyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHRfYnInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9teCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2FyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fYm8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9jbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2NvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fY3InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9kbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX3N2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fZ3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9obicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX25pJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fcGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9weScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX3BlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fcHInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl91eScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX3ZlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fYnonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9haScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2FnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fZ2YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9neScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX3NyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fYXcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9icycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2JiJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fYm0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9icScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX3ZnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fa3knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9jdycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2RtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fam0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9tcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX21mJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fc3gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9rbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2xjJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fdmMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl90dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX3RjJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fdmknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9ncCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX21xJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5faHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl91cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ZyX2NhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fY2EnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl9jaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX214JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfYXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc19ibycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX2NsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfY28nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc19jcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX2RvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfZWMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc19zdicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX2d0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfaG4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc19uaScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX3BhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfcHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc19wZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VzX3ByJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXNfdXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlc192ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuX2luJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5fYWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbl96YScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2dUYWc6Y3RhT3JhbmdlQVdQYWdlTGlzdE1hcHBpbmcnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kZWxpdmVyeS1tYW5hZ2VyL2J1c2luZXNzLXRvb2xraXQuaHRtbCc6ICdBVy04NjMyMzg3OTMvYVJrNENJZnEwYmtCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvcmV0dXJucy9idXNpbmVzcy5odG1sJzogJ0FXLTg2MzIzODc5My95NmtzQ05lUXdia0JFSW4xejVzRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9pbnRlcm5hdGlvbmFsL2hvdy10by1zaGlwLmh0bWwnOiAnQVctODYzMjM4NzkzL05BUGNDT09XM2JrQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nLzctZGF5LWRlbGl2ZXJ5Lmh0bWwnOiAnQVctODYzMjM4NzkzLzkxN0dDT255MGJrQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2Rpc2NvdW50LXByb2dyYW1zL2FnMTMzOTg2MDIuaHRtbCc6ICdBVy04NjMyMzg3OTMvbW9hTUNJZndwN29CRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvYmlnLWNvbW1lcmNlLmh0bWwnOiAnQVctODYzMjM4NzkzL2dkRnZDTUtLNk0wQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL2Rlc2lnbi1zZXJ2aWNlcy5odG1sJzogJ0FXLTg2MzIzODc5My9TYnB2Q01pVXJ0QUJFSW4xejVzRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9zbWFsbC1tZWRpdW0tYnVzaW5lc3Mtb2ZmZXJzLmh0bWwnOiAnQVctODYzMjM4NzkzL0tzMS1DTktYaE5FQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2RlbGl2ZXJ5LW1hbmFnZXIuaHRtbCc6ICdBVy04NjMyMzg3OTMvb21mOUNPTDA1ZHdCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvcHJpbnRpbmcvY29uc3VtZXItb2ZmZXJzLmh0bWwnOiAnQVctODYzMjM4NzkzL0RGSG9DSmF6aGVJQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL29uc2l0ZS93YWxncmVlbnMtcGFja2FnZS1waWNrdXAuaHRtbCc6ICdBVy04NjMyMzg3OTMvaEdPdkNMZkxrT0lCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvb25zaXRlL2RvbGxhci1nZW5lcmFsLXBpY2stdXAtZHJvcC1vZmYtcGFja2FnZS5odG1sJzogJ0FXLTg2MzIzODc5My9hSy1NQ0x1dDQtRUJFSW4xejVzRCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ3RyYWRlZGVzazpwYWdlTGlzdE1hcHBpbmcnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9ICcvL2luc2lnaHQuYWRzcnZyLm9yZy90cmFjay9jb252Lz9hZHY9c3VlbnR2YmEmJywgdCA9ICcvL2luc2lnaHQuYWRzcnZyLm9yZy90cmFjay9weGwvP2Fkdj1zdWVudHZiYSYnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL2ZyZWlnaHQtc2VydmljZXMvaW5ub3ZhdGlvbi5odG1sJzogZSArICdjdD0wOmg5dmFoaGwmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvcHJpbnRpbmcvY3VzdG9tLXByb2Zlc3Npb25hbC1wcmludGluZy5odG1sJzogZSArICdjdD0wOmdmOGIyZ2EmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvcHJpbnRpbmcvc21hbGwtbWVkaXVtLWJ1c2luZXNzLW9mZmVycy5odG1sJzogZSArICdjdD0wOjNtejhvYXUmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvZnJlaWdodC1zZXJ2aWNlcy9sdGwvcXVvdGUuaHRtbCc6IGUgKyAnY3Q9MDozaWQzZmpnJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3Bvc3NpYmlsaXRpZXMuaHRtbCc6IGUgKyAnY3Q9MDpuenV5OGViJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL2ZsYXNoLXNhbGUtb2ZmZXJzLmh0bWwnOiBlICsgJ2N0PTA6cG5wMnA1YyZmbXQ9MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9vbmxpbmUtcHJpbnRpbmcuaHRtbCc6IGUgKyAnY3Q9MDpkb2gyZnRnJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL3N0b3JlL2dyb3VuZC5odG1sJzogZSArICdjdD0wOndibnE3b3ImZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvZGlzY291bnQtcHJvZ3JhbXMvZW0xNTY5MjIxMy5odG1sJzogZSArICdjdD0wOnpuMzRvYzcmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvY3JlYXRlLWFjY291bnQuaHRtbCc6IGUgKyAnY3Q9MDo4cXNsOGh3JmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2Rpc2NvdW50LXByb2dyYW1zL2VtMTU2OTIwMTMuaHRtbCc6IGUgKyAnY3Q9MDp2MTR3ZW8wJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2Rpc2NvdW50LXByb2dyYW1zL2VtMTU2OTIxMTMuaHRtbCc6IGUgKyAnY3Q9MDpqZzNwNW16JmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2hvbGlkYXkvY29uc3VtZXItc2hpcHBpbmctZGVsaXZlcnktZ3VpZGUuaHRtbCc6IHQgKyAnY3Q9MDo4aWljbzFoJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL2J1c2luZXNzLXNvbHV0aW9ucy9rbm93bGVkZ2UtY2VudGVyLmh0bWwnOiB0ICsgJ2N0PTA6Mm90bGwwOCZmbXQ9MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kaXNjb3VudC1wcm9ncmFtcy9hZzEzMzk4NjAyLmh0bWwnOiB0ICsgJ2N0PTA6emh0c2xzdyZmbXQ9MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9kZXNpZ24tc2VydmljZXMuaHRtbCc6IHQgKyAnY3Q9MDpkNWYxOG9zJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL29mZmljZS1kZXBvdC1vZmZpY2VtYXguaHRtbCc6IHQgKyAnY3Q9MDp6aXVhMzB6JmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL25hdGlvbmFsLWJpZC1jZW50ZXIuaHRtbCc6IHQgKyAnY3Q9MDpmbXpyazRmJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL29uc2l0ZS90YXJnZXQtcGljay11cC1kcm9wLW9mZi1wYWNrYWdlLmh0bWwnOiB0ICsgJ2N0PTA6enJnNjhlYiZmbXQ9MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9zbWFsbC1tZWRpdW0tYnVzaW5lc3Mtb2ZmZXJzLmh0bWwnOiB0ICsgJ2N0PTA6M216OG9hdSZmbXQ9MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9kZXNpZ24tc2VydmljZXMuaHRtbCc6IHQgKyAnY3Q9MDpkNWYxOG9zJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2hvbGlkYXkvY29uc3VtZXItc2hpcHBpbmctZGVsaXZlcnktZ3VpZGUuaHRtbCc6IHQgKyAnY3Q9MDpkazh3cXNvJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2hvbGlkYXkuaHRtbCc6IHQgKyAnY3Q9MDpxazJydGxiJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL2NvbnN1bWVyLW9mZmVycy5odG1sJzogdCArICdjdD0wOjZzODR1eHgmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvb25zaXRlL3dhbGdyZWVucy1wYWNrYWdlLXBpY2t1cC5odG1sJzogdCArICdjdD0wOmplcm9tcHAmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvb25zaXRlL2RvbGxhci1nZW5lcmFsLXBpY2stdXAtZHJvcC1vZmYtcGFja2FnZS5odG1sJzogdCArICdjdD0wOjd3OGJxemsmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvaG9sZC1hdC1sb2NhdGlvbi5odG1sJzogdCArICdjdD0wOm80Y2hwcm4mZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvZGVsaXZlcnktbWFuYWdlci5odG1sJzogdCArICdjdD0wOjNocHcxdXEmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvcmV0dXJucy9idXNpbmVzcy5odG1sJzogdCArICdjdD0wOnhsd2I4eGQmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvcmV0dXJucy90ZWNobm9sb2d5Lmh0bWwnOiB0ICsgJ2N0PTA6MmJlYW1wZCZmbXQ9MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9yZXR1cm5zLmh0bWwnOiB0ICsgJ2N0PTA6bXIwcnNmZiZmbXQ9MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9jb3Vwb24tb2ZmZXJzL2dyb3VuZC5odG1sJzogdCArICdjdD0wOjgwbGl6ZzMmZm10PTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvaGVhbHRoY2FyZS92YWNjaW5lLXNoaXBwaW5nLmh0bWwnOiB0ICsgJ2N0PTA6Nm50dGY2YiZmbXQ9MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9lY29tbWVyY2Uvb2ZmZXItc3RvcmUtcGlja3VwLWF0LWNoZWNrb3V0Lmh0bWwnOiB0ICsgJ2N0PTA6cXMya2ZxYiZmbXQ9MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kZWxpdmVyeS1tYW5hZ2VyL21hbmFnZS15b3VyLWRlbGl2ZXJpZXMuaHRtbCc6IHQgKyAnY3Q9MDplZXdjN2kzJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NtYWxsLWJ1c2luZXNzL2dyYW50LWNvbnRlc3QuaHRtbCc6IHQgKyAnY3Q9MDp4ODI1cnloJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3N3ZWVwc3Rha2VzL2NvbWUtaW4tYW5kLWNhc2gtaW4uaHRtbCc6IHQgKyAnY3Q9MDpzZzJiYjNsJmZtdD0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3N3ZWVwc3Rha2VzLmh0bWwnOiB0ICsgJ2N0PTA6bXgzbndrYiZmbXQ9MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zd2VlcHN0YWtlcy9ob2xpZGF5LWRyb3Atb2ZmLmh0bWwnOiB0ICsgJ2N0PTA6bW9oM2R2ciZmbXQ9MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9zYXR1cmRheS1hbmQtc3VuZGF5LWRlbGl2ZXJ5Lmh0bWwnOiB0ICsgJ2N0PTA6aHhkOXptMyZmbXQ9MycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2dUYWc6Q29uZmlnTG9naWMnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdnVGFnOkNvbmZpZ0lETWFwcGluZycpLCB0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6Y291bnRyeUNvZGUnKSwgbiA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gZSAmJiAnJyAhPT0gZSAmJiB2b2lkIDAgIT09IHQgJiYgJycgIT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmluZGV4T2YocikgPiAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGVbcl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJyA9PT0gbiAmJiAobiA9IGUudXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdleHRlcm5hbC1jYW1wYWlnbjpsaW5rJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL3F1ZXJ5U3RyaW5nUGFyYW1ldGVyLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnTElOSycsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZTogITAKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2FhbTpyZWdpb25zJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1cyxjYW4sYXBhYyc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6cGFnZSB0eXBlJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VMb3dlckNhc2U6ICEwLAogICAgICAgICAgICAgICAgICAgIGNsZWFuVGV4dDogITAsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ0ZEWC5EQVRBTEFZRVIucGFnZS5jYXRlZ29yeS5wYWdlVHlwZScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdsb2dpbjp1c2VyLWlkJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9zYXRlbGxpdGUuY29va2llLmdldCgnZmNsX3V1aWQnKSA/IF9zYXRlbGxpdGUuY29va2llLmdldCgnZmNsX3V1aWQnKSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHNBY2NvdW50OiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6cmVnaW9uJyksIHQgPSAnZmVkZXhnbGJsZGV2JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IGUgJiYgJycgIT0gZSAmJiAoJ3d3dy5mZWRleC5jb20nICE9IHdpbmRvdy5sb2NhdGlvbi5ob3N0ICYmICdkZXZlbG9wZXIuZmVkZXguY29tJyAhPSB3aW5kb3cubG9jYXRpb24uaG9zdCAmJiAnZ2V0cmV3YXJkcy5mZWRleC5jb20nICE9IHdpbmRvdy5sb2NhdGlvbi5ob3N0IHx8ICh0ID0gJ2ZlZGV4Z2xibCcpKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnYWFtOmNvdW50cmllcyc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnZ1RhZzpUYXJnZXRWaWRlb01hcHBpbmcnOiB7CiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYyMjc1NDQxODUwMDE6ICdBVy04NjMyMzg3OTMvZ2VtMENQSG5nLTRCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYyMjc1NDU2NTgwMDE6ICdBVy04NjMyMzg3OTMvcFZBLUNLT1E0dThCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYyMzQzOTk1NTkwMDE6ICdBVy04NjMyMzg3OTMvN1Z1QkNOck1sTzRCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYyMzM4MjcxNDEwMDE6ICdBVy04NjMyMzg3OTMvVXVQbkNQQzQxZmNCRUluMXo1c0QnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdzZWFyY2g6c3BEYXRhIC0gSlNPYmplY3RDaGFuZ2UnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnRkRYLkRBVEFMQVlFUi5zZWFyY2gucmVzdWx0LnRvdGFsUmVzdWx0Q291bnQnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnZ1RhZzpWaWRlb1BsYXlCdG5JZExpc3QnOiB7CiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxNjUwMTkwMDU5NDM0NzgwNjA0JzogJ0RDLTIyOTA3OTQvY2FtcGEwL2ZlZGV4MDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxNjUwNjU0Mjk2NDIzNjA0OTc1JzogJ0RDLTgzNTgwMDYvaW52bWVkaWEvZmVkZXgwMHUrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxNjUwNjU1MDk5NzkyMjY2NzY5JzogJ0RDLTU2NTMwMjAvZnkyMGEwL2Z5MjBfMDA0K3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnZ1RhZzpidG5EQ1BhZ2VMaXN0TWFwcGluZyc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2ludGVybmF0aW9uYWwtc2hpcHBpbmcuaHRtbCc6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0RDLTk3NDcxNC9mZWRleDAvZmVkZXgwMDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnREMtOTc0NzE0L2ZlZGV4MC9mZWRleDAwMitzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdEQy05NzQ3MTQvZmVkZXgwL2ZlZGV4MDA0K3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0RDLTk3NDcxNC9mZWRleDAvZmVkZXgwMDYrc3RhbmRhcmQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2ludGVybmF0aW9uYWwtc2hpcHBpbmcuaHRtbCc6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0RDLTk3NDcxNC9mZWRleDAvZmVkZXgwMDErc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnREMtOTc0NzE0L2ZlZGV4MC9mZWRleDAwMytzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdEQy05NzQ3MTQvZmVkZXgwL2ZlZGV4MDA1K3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0RDLTk3NDcxNC9mZWRleDAvZmVkZXgwMDcrc3RhbmRhcmQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWhrL2NhbXBhaWduL3JldGFpbGZyZWlnaHQuaHRtbCc6ICdEQy01NjY3MzAwL2Z5MjBfMC9mZWRleDAwMytzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC1oay9jYW1wYWlnbi9yZXRhaWxmcmVpZ2h0Lmh0bWwnOiAnREMtNTY2NzMwMC9meTIwXzAvZmVkZXgwMDErc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbXkvb3Blbi1hY2NvdW50L3BlcnNvbmFsLmh0bWwnOiAnREMtOTgxMTMxMy9pbnZtZWRpYS9teV9wZTArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbXkvb3Blbi1hY2NvdW50L2NvcnBvcmF0ZS5odG1sJzogJ0RDLTk4MTEzMTMvaW52bWVkaWEvbXlfY28wK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWF1L29wZW4tYWNjb3VudC9wZXJzb25hbC5odG1sJzogJ0RDLTk4MTEzMTMvaW52bWVkaWEvYXVfcGUwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWF1L29wZW4tYWNjb3VudC9jb3Jwb3JhdGUuaHRtbCc6ICdEQy05ODExMzEzL2ludm1lZGlhL2F1X2NvMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1uei9vcGVuLWFjY291bnQvcGVyc29uYWwuaHRtbCc6ICdEQy05ODExMzEzL2ludm1lZGlhL256X3BlMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1uei9vcGVuLWFjY291bnQvY29ycG9yYXRlLmh0bWwnOiAnREMtOTgxMTMxMy9pbnZtZWRpYS9uel9jbzArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdHcvb3Blbi1hY2NvdW50L3BlcnNvbmFsL2VndWktZm9ybS5odG1sJzogJ0RDLTk4MTEzMTMvaW52bWVkaWEvdHdfcGUwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL3poLXR3L29wZW4tYWNjb3VudC9wZXJzb25hbC9lZ3VpLWZvcm0uaHRtbCc6ICdEQy05ODExMzEzL2ludm1lZGlhL3R3X3BlMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi10dy9vcGVuLWFjY291bnQvY29ycG9yYXRlLmh0bWwnOiAnREMtOTgxMTMxMy9pbnZtZWRpYS90d19jbzArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvemgtdHcvb3Blbi1hY2NvdW50L2NvcnBvcmF0ZS5odG1sJzogJ0RDLTk4MTEzMTMvaW52bWVkaWEvdHdfY28wK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXBoL29wZW4tYWNjb3VudC5odG1sJzogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0RDLTk4MTEzMTMvaW52bWVkaWEvcGhfY28wK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0RDLTk4MTEzMTMvaW52bWVkaWEvcGhfcGUwK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgX2ZkeFV0aWw6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuX2ZkeCA9IHt9LCB3aW5kb3csIGUgPSBfZmR4IHx8IHt9LCBmID0gZSB8fCB7fSwgZi5pc09iamVjdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiBlLmNvbnN0cnVjdG9yID09IE9iamVjdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGYuaXNMaXZlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICEwLCByID0gbmV3IERhdGUoKS5nZXRUaW1lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGUgJiYgJycgIT09IGUgJiYgciA8IGUgJiYgKG4gPSAhMSksIG51bGwgIT09IHQgJiYgJycgIT09IHQgJiYgciA+IHQgJiYgKG4gPSAhMSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmLnBhZ2VGbGFnID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBlICYmICcnICE9PSBlICYmIHZvaWQgMCAhPT0gdCAmJiAnJyAhPT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzTmFOKHIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQudG9Mb3dlckNhc2UoKS5pbmRleE9mKHIudG9Mb3dlckNhc2UoKSkgPiAtMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9mZHguaXNPYmplY3QoZVtyXSkgPyAnY291bnRyeScgPT0gbiA/IGVbcl0gOiAoZW5hYmxlZFRpbWUgPSBfZmR4LmlzTGl2ZShlW3JdLnN0YXJ0VGltZSwgZVtyXS5lbmRUaW1lKSwgISFlbmFibGVkVGltZSAmJiAoc3JjVmFsdWUgPSBlW3JdLnBpeGVsLCAndW5kZWZpbmVkJyA9PSBzcmNWYWx1ZSB8fCBzcmNWYWx1ZSkpIDogZVtyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQudG9Mb3dlckNhc2UoKS5pbmRleE9mKGVbcl0udG9Mb3dlckNhc2UoKSkgPiAtMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID09IHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3JdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGYucGNmVXRpbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdBbGxvd2VkUHJvZERvbWFpbnMnKSwgdCA9IHdpbmRvdy5sb2NhdGlvbi5ob3N0bmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSB0Lm1hdGNoKC93d3coYmFzZS5pZGV2fGRldi5pZGV2fGRydC5pZGV2fHN0cmVzcy5kbXouaWRldnxiaXQuaWRldnx0ZXN0fCkuZmVkZXguY29tL2dpKSA/IHQgOiBlLmxlbmd0aCA+IDAgJiYgZS5pbmRleE9mKHQpID4gLTEgPyAnd3d3LmZlZGV4LmNvbScgOiAnd3d3dGVzdC5mZWRleC5jb20nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZi5nZXRUZXN0TGV2ZWwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAnJywgdCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHd3d3Nib3g6ICdMMVMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3d3YmFzZTogJ0wxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHd3d2RldjogJ0wyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHd3d2RydDogJ0wzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHd3d3N0cmVzczogJ0w0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHd3d2JpdDogJ0w1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHd3d3Rlc3Q6ICdMNicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA9IHd3d0hvc3Quc3BsaXQoJy4nKVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSB0W25dICYmICcnICE9PSB0W25dICYmIChlID0gdFtuXSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmLmdldEd0YWdMYWJlbCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodFtyXSA9PT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3JdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnZ1RhZzpidG5BV1BhZ2VMaXN0TWFwcGluZyc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL3JldHVybnMvYnVzaW5lc3MuaHRtbCc6ICdBVy04NjMyMzg3OTMvYWY1VUNOU1QzYmtCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvcHJpbnRpbmcvZGVzaWduLXNlcnZpY2VzLmh0bWwnOiAnQVctODYzMjM4NzkzL0U2OExDTHlGdk5BQkVJbjF6NXNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL3NtYWxsLW1lZGl1bS1idXNpbmVzcy1vZmZlcnMuaHRtbCc6ICdBVy04NjMyMzg3OTMvM3oxRENMM2w4OUFCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvY291cG9uLW9mZmVycy9ncm91bmQuaHRtbCc6ICdBVy04NjMyMzg3OTMvb05qaUNQMkxoZUlCRUluMXo1c0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvb25zaXRlL2RvbGxhci1nZW5lcmFsLXBpY2stdXAtZHJvcC1vZmYtcGFja2FnZS5odG1sJzogJ0FXLTg2MzIzODc5My82R2U3Q0otQTctRUJFSW4xejVzRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1pbi9zaGlwcGluZy9pbmR1c3RyeS1zb2x1dGlvbnMvaGVhbHRoY2FyZS9jb250YWN0LXVzLmh0bWwnOiAnQVctNjczNjgxODI5LzJZVDNDTV9CNXM0QkVLV2puc0VDJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL3NtYWxsLWJ1c2luZXNzL2Vjb21tZXJjZS1zb2x1dGlvbnMuaHRtbCc6ICdBVy0xMDMzNTc3Nzk3L1hQc0pDSVR5cF9NQ0VNWEs3T3dEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NtYWxsLWJ1c2luZXNzL2Vjb21tZXJjZS1zb2x1dGlvbnMuaHRtbCc6ICdBVy0xMDMzNTc3Nzk3LzJGbzFDS0xVcF9RQ0VNWEs3T3dEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL2Vjb21tZXJjZS1zaGlwcGluZy9zdXBwb3J0LWZvci15b3VyLWN1c3RvbWVycy5odG1sJzogJ0FXLTEwMzM1Nzc3OTcvOUpQWUNMZlVsX3dDRU1YSzdPd0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2EvZWNvbW1lcmNlLXNoaXBwaW5nL3N1cHBvcnQtZm9yLXlvdXItY3VzdG9tZXJzLmh0bWwnOiAnQVctMTAzMzU3Nzc5Ny9KQ3JqQ0llNW1md0NFTVhLN093RCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9tYW5hZ2UtbXktZGVsaXZlcmllcy5odG1sJzogJ0FXLTEwMzM1Nzc3OTcvTS0wYkNKWFA4UHNDRU1YSzdPd0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZnItY2EvbWFuYWdlLW15LWRlbGl2ZXJpZXMuaHRtbCc6ICdBVy0xMDMzNTc3Nzk3L0NzUXpDTm5wOFBzQ0VNWEs3T3dEJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnRmxhc2hUYWxraW5nOnBhZ2VMaXN0TWFwcGluZyc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7ICcvZW4tdXMvcG9zc2liaWxpdGllcy5odG1sJzogJ2h0dHBzOi8vc2VydmVkYnkuZmxhc2h0YWxraW5nLmNvbS9zcG90LzEvNTI4NDsxMTc5NjQ7MTI1MDkvP3Nwb3ROYW1lPUZlZEV4XzIwMjBfTGFuZGluZ19QYWdlJmNhY2hlYnVzdGVyPScgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAndmE6ZW5hYmxlZENvdW50cnlMaXN0TmV3JzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ2InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdqcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2EnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2F1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdueicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndm4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdteScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2J6JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dmJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ3knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2h0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnemEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2hrJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdrcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZG0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdibycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VjJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdobicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25pJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2F3JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdiYicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYnEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2t5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY3cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ptJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbWYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzeCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2tuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2YycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3R0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2aScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2wnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1eScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdicicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd6YScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ3F1YWx0cmljczpEaXNhYmxlTG9jYWxlJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OmxvY2FsZScpLm1hdGNoKC9lbl9hbHxlbl9hbXxkZV9hdHxlbl9hdHxlbl9henxlbl9ieXxlbl9iZXxmcl9iZXxubF9iZXxlbl9iYXxlbl9iZ3xlbl9ocnxlbl9jeXxjc19jenxlbl9jenxkYV9ka3xlbl9ka3xlbl9lZXxlbl9mb3xlbl9maXxmaV9maXxlbl9mcnxmcl9mcnxlbl9nZXxkZV9kZXxlbl9kZXxlbl9naXxlbl9ncnxlbl9nbHxlbl9odXxodV9odXxlbl9pc3xlbl9pZXxlbl9pbHxoZV9pbHxlbl9pdHxpdF9pdHxlbl9sdnxlbl9sdHxlbl9sdXxlbl9ta3xlbl9tdHxlbl9tZHxlbl9tZXxlbl9ubHxubF9ubHxlbl9ub3xub19ub3xlbl9wbHxwbF9wbHxlbl9wdHxwdF9wdHxlbl9yb3xlbl9ydXxydV9ydXxlbl9yc3xlbl9za3xza19za3xlbl9zaXxzbF9zaXxlbl9lc3xlc19lc3xlbl9zZXxzdl9zZXxkZV9jaHxlbl9jaHxmcl9jaHxpdF9jaHxlbl90cnx0cl90cnxlbl9nYnxlbl91YXxydV91YXx1a191YS9naSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ3ZhOmNhYXNNb2JFbmFibGVkVXJsJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsnL2ZlZGV4dHJhY2svJ107CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2dUYWc6Y3RhT3JhbmdlRkJQYWdlTGlzdE1hcHBpbmcnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kaXNjb3VudC1wcm9ncmFtcy9hZzEzMzk4NjAyLmh0bWwnOiAnSW5pdGlhdGVDaGVja291dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9kZXNpZ24tc2VydmljZXMuaHRtbCc6ICdDdXN0b21pemVQcm9kdWN0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL3NtYWxsLW1lZGl1bS1idXNpbmVzcy1vZmZlcnMuaHRtbCc6ICdBZGRUb0NhcnQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdnVGFnOkRGQUV2ZW50TWFwcGluZyc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wb3NzaWJpbGl0aWVzLmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwNS9mZWRleDAyaStzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvY291cG9uLW9mZmVycy5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMjErc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL2Ryb3Bib3guaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDIwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zaGlwcGluZy9mcmVpZ2h0LXNlcnZpY2VzL2x0bC92b2x1bWUtc2VydmljZXMuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDF1K3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9jdXN0b21lci1zdXBwb3J0Lmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwaC9mZWRleDAweStzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvaG9tZS5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMHgrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nLmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwaC9mZWRleDAwdytzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDB2K3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy90cmFja2luZy5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMHUrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL29mZmljZS5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMHMrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL2ludGVybmF0aW9uYWwtZ3JvdW5kLWNhbmFkYS5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMGwrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL29ubGluZS1wcmludGluZy5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMGgrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL3N0b3JlL2dyb3VuZC5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMGIrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL2dyb3VuZC5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMGErc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL3BhY2tpbmcuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDAtK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9wb3N0ZXJzL2NhbnZhcy1wcmludHMuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvcHJpbnRpbmcvcHJvbW90aW9uczEuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDBmK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9wcm9tb3Rpb25zMi5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMGUrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL3Byb21vdGlvbnMzLmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwaC9mZWRleDAwZytzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvcHJpbnRpbmcvcHJvbW90aW9uczQuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDBkK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9wcm9tb3Rpb25zNS5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMGMrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL2ZsYXNoLXNhbGUtb2ZmZXJzLmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwaC9mZWRleDAyZStzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvaG9sZC1hdC1sb2NhdGlvbi5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMmgrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL3NtYWxsLW1lZGl1bS1idXNpbmVzcy1vZmZlcnMuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDJnK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9vZmZpY2Uvd2FsbWFydC5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMmkrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL29uc2l0ZS93YWxncmVlbnMtcGFja2FnZS1waWNrdXAuaHRtbCc6ICdEQy00MTkxMjYzL3dhbGdyMC9mZWRleDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL29uc2l0ZS5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMm4rc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL3BhY2tpbmctc3VwcGxpZXMvY3VzdG9tLWJyYW5kZWQtYm94ZXMuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDJrK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kZWxpdmVyeS1tYW5hZ2VyL2hvdy10by1wcmV2ZW50LXN0b2xlbi1taXNzaW5nLXBhY2thZ2VzLmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwaC9mZWRleDAybCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvZnJlaWdodC1zZXJ2aWNlcy9sdGwvcXVvdGUuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDJyK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9jdXN0b20tcHJvZmVzc2lvbmFsLXByaW50aW5nLmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwaC9meTE5XzArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL2ZyZWlnaHQtc2VydmljZXMvaW5ub3ZhdGlvbi5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMnUrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2hvbGlkYXkvY29uc3VtZXItc2hpcHBpbmctZGVsaXZlcnktZ3VpZGUuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDJ5K3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9kaXNjb3VudC1wcm9ncmFtcy9lbTE1NjkyMDEzLmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwaC9meTIwXzAwMStzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvZGlzY291bnQtcHJvZ3JhbXMvZW0xNTY5MjIxMy5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZnkyMF8wMDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2NyZWF0ZS1hY2NvdW50Lmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwaC9meTIwXzArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL2Rpc2NvdW50LXByb2dyYW1zL2VtMTU2OTIxMTMuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2Z5MjBfMDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL2J1c2luZXNzLXNvbHV0aW9ucy9rbm93bGVkZ2UtY2VudGVyLmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwaC9mZWRleDAzMStzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvZGlzY291bnQtcHJvZ3JhbXMvYWcxMzM5ODYwMi5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwMzgrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3ByaW50aW5nL2Rlc2lnbi1zZXJ2aWNlcy5odG1sJzogJ0RDLTQxOTEyNjMvZmVkZXgwMGgvZmVkZXgwM2grc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL29mZmljZS1kZXBvdC1vZmZpY2VtYXguaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDNhK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9uYXRpb25hbC1iaWQtY2VudGVyLmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwaC9mZWRleDAzLStzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvc2hpcHBpbmcvb25zaXRlL3RhcmdldC1waWNrLXVwLWRyb3Atb2ZmLXBhY2thZ2UuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDNiK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9zbWFsbC1idXNpbmVzcy9tYWtpbmctaXQtd29yay1wb2RjYXN0Lmh0bWwnOiAnREMtNDE5MTI2My9mZWRleDAwaC9mZWRleDAzaitzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvZGVsaXZlcnktbWFuYWdlci5odG1sJzogJ0RDLTQxOTEyNjMvZmRtZW4wL2ZkbWxhMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvZGVsaXZlcnktbWFuYWdlci9tYW5hZ2UteW91ci1kZWxpdmVyaWVzLmh0bWwnOiAnREMtNDE5MTI2My9mZG1lbjAvZmRtbGEwMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tdXMvY291cG9uLW9mZmVycy9ncm91bmQuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDNtK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi11cy9wcmludGluZy9jb25zdW1lci1vZmZlcnMuaHRtbCc6ICdEQy00MTkxMjYzL2NvbnN1MC9mZWRleDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXVzL3NoaXBwaW5nL29uc2l0ZS9kb2xsYXItZ2VuZXJhbC1waWNrLXVwLWRyb3Atb2ZmLXBhY2thZ2UuaHRtbCc6ICdEQy00MTkxMjYzL2ZlZGV4MDBoL2ZlZGV4MDNsK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2E6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9zaGlwcGluZy1zZXJ2aWNlcy9pbnRlcm5hdGlvbmFsLXNoaXBwaW5nLmh0bWwnOiAnREMtOTc0NzE0L2ZlZGV4MTcvZmVkZXgwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jYS9zaGlwcGluZy1zZXJ2aWNlcy9pbnRlcm5hdGlvbmFsLXNoaXBwaW5nLmh0bWwnOiAnREMtOTc0NzE0L2ZlZGV4MTcvZmVkZXgwMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tY2Evc2hpcHBpbmctc2VydmljZXMvaW50ZXJuYXRpb25hbC1zaGlwcGluZy9yZWd1bGF0b3J5LWZvcm0vdGhhbmsteW91Lmh0bWwnOiAnREMtOTc0NzE0L2ZlZGV4MC9mZWRleDAwOCt1bmlxdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2ludGVybmF0aW9uYWwtc2hpcHBpbmcvcmVndWxhdG9yeS1mb3JtL3RoYW5rLXlvdS5odG1sJzogJ0RDLTk3NDcxNC9mZWRleDAvZmVkZXgwMDkrdW5pcXVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1jYS9zaGlwcGluZy1zZXJ2aWNlcy9oZWFsdGhjYXJlLmh0bWwnOiAnREMtOTc0NzE0L2ZlZGV4MDAvZnkyMmgwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mci1jYS9zaGlwcGluZy1zZXJ2aWNlcy9oZWFsdGhjYXJlLmh0bWwnOiAnREMtOTc0NzE0L2ZlZGV4MDAvZnkyMmgwMDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2hlYWx0aGNhcmUvY29udGFjdC11cy5odG1sJzogJ0RDLTk3NDcxNC9mZWRleDAwL2Z5MjJoMDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2ZyLWNhL3NoaXBwaW5nLXNlcnZpY2VzL2hlYWx0aGNhcmUvY29udGFjdC11cy5odG1sJzogJ0RDLTk3NDcxNC9mZWRleDAwL2Z5MjJoMDAxK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmg6IHsgJy9lbi1iaC9hYm91dC9wb3NzaWJpbGl0aWVzLmh0bWwnOiAnREMtMTk4MjU3NC9lbngyeDAvZmVkZXgwMCtzdGFuZGFyZCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrdzogeyAnL2VuLWt3L2Fib3V0L3Bvc3NpYmlsaXRpZXMuaHRtbCc6ICdEQy0xOTgyNTc0L2VueDJ4MC9mZWRleDAwMCtzdGFuZGFyZCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2FyLWFlL2Fib3V0L3Bvc3NpYmlsaXRpZXMuaHRtbCc6ICdEQy0xOTgyNTc0L2FyNDR4MC9mZWRleDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWFlL2Fib3V0L3Bvc3NpYmlsaXRpZXMuaHRtbCc6ICdEQy0xOTgyNTc0L2VueDJ4MC9mZWRleDArc3RhbmRhcmQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2tvLWtyL29wZW4tYWNjb3VudC9wZXJzb25hbC5odG1sJzogJ0RDLTk5Mjk5Njkva29yZWEwL2ZlZGV4MDAwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9rby1rci9zaGlwcGluZy9mZWRleC1yZXdhcmRzLmh0bWwnOiAnREMtOTkyOTk2OS9rb3JlYTAvZmVkZXgwMDErc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2tvLWtyL3NtYWxsLWJ1c2luZXNzLmh0bWwnOiAnREMtOTkyOTk2OS9rb3JlYTAvZmVkZXgwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9rby1rci9vcGVuLWFjY291bnQuaHRtbCc6ICdEQy05OTI5OTY5L2tvcmVhMC9mZWRleDAwK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC10dy9hYm91dC9wb3NzaWJpbGl0aWVzLmh0bWwnOiAnREMtNTY1MzAyMC9meTIwYTAvZnkyMF8wMDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXR3L2Fib3V0L3Bvc3NpYmlsaXRpZXMuaHRtbCc6ICdEQy01NjUzMDIwL2Z5MjBhMC9meTIwXzAwMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvemgtdHcvb3Blbi1hY2NvdW50L2NvcnBvcmF0ZS5odG1sJzogJ0RDLTk5Mjk5NjkvdGFpd2EwL2ZlZGV4MDAwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC10dy9vcGVuLWFjY291bnQvcGVyc29uYWwuaHRtbCc6ICdEQy05OTI5OTY5L3RhaXdhMC9mZWRleDAwMStzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvemgtdHcvc2hpcHBpbmcvZmVkZXgtcmV3YXJkcy5odG1sJzogJ0RDLTk5Mjk5NjkvdGFpd2EwL2ZlZGV4MDAyK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC10dy9zbWFsbC1idXNpbmVzcy5odG1sJzogJ0RDLTk5Mjk5NjkvdGFpd2EwL2ZlZGV4MCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvemgtdHcvb3Blbi1hY2NvdW50Lmh0bWwnOiAnREMtOTkyOTk2OS90YWl3YTAvZmVkZXgwMCtzdGFuZGFyZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tc2cvb3Blbi1hY2NvdW50L2NvcnBvcmF0ZS5odG1sJzogJ0RDLTk5Mjk5Njkvc2luZ2EwL2ZlZGV4MDAwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1zZy9vcGVuLWFjY291bnQvcGVyc29uYWwuaHRtbCc6ICdEQy05OTI5OTY5L3NpbmdhMC9mZWRleDAwMStzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tc2cvc2hpcHBpbmcvZmVkZXgtcmV3YXJkcy5odG1sJzogJ0RDLTk5Mjk5Njkvc2luZ2EwL2ZlZGV4MDAyK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1zZy9zbWFsbC1idXNpbmVzcy5odG1sJzogJ0RDLTk5Mjk5Njkvc2luZ2EwL2ZlZGV4MDBiK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1zZy9vcGVuLWFjY291bnQuaHRtbCc6ICdEQy05OTI5OTY5L3NpbmdhMC9mZWRleDAwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1zZy9zbWFsbC1idXNpbmVzcy9zdWNjZXNzLWpvdXJuZXkvZmFjdHMtYmVuZWZpdHMtZ3JhbnRzLmh0bWwnOiAnREMtOTkyOTk2OS9zaW5nYTAvZmVkZXgwMGMrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXNnL3NtYWxsLWJ1c2luZXNzL3N0cmVhbWxpbmUtb3BlcmF0aW9ucy90aXBzLWZvci1lZmZpY2llbnQtZWZmZWN0aXZlLXNoaXBwaW5nLmh0bWwnOiAnREMtOTkyOTk2OS9zaW5nYTAvZmVkZXgwMGQrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXNnL3NtYWxsLWJ1c2luZXNzL2FjY2VsZXJhdGluZy1kaWdpdGFsL2RpZ2l0YWxpemUtY3VzdG9tcy1kb2N1bWVudHMuaHRtbCc6ICdEQy05OTI5OTY5L3NpbmdhMC9mZWRleDAwZStzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tc2cvc21hbGwtYnVzaW5lc3MvYWNjZWxlcmF0aW5nLWRpZ2l0YWwvb3Bwb3J0dW5pdGllcy1mb3ItZWNvbW1lcmNlLWJ1c2luZXNzLmh0bWwnOiAnREMtOTkyOTk2OS9zaW5nYTAvZmVkZXgwMGYrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXNnL3NtYWxsLWJ1c2luZXNzL2FkYXB0LWlubm92YXRlL3N1c3RhaW5hYmxlLXN1cHBseS1jaGFpbi5odG1sJzogJ0RDLTk5Mjk5Njkvc2luZ2EwL2ZlZGV4MDBnK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9qYS1qcC9vcGVuLWFjY291bnQvY29ycG9yYXRlLmh0bWwnOiAnREMtOTkyOTk2OS9qYXBhbjAvZmVkZXgwMDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2phLWpwL29wZW4tYWNjb3VudC9wZXJzb25hbC5odG1sJzogJ0RDLTk5Mjk5NjkvamFwYW4wL2ZlZGV4MDAxK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9qYS1qcC9zaGlwcGluZy9mZWRleC1yZXdhcmRzLmh0bWwnOiAnREMtOTkyOTk2OS9qYXBhbjAvZmVkZXgwMDIrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2phLWpwL3NtYWxsLWJ1c2luZXNzLmh0bWwnOiAnREMtOTkyOTk2OS9qYXBhbjAvZmVkZXgwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9qYS1qcC9vcGVuLWFjY291bnQuaHRtbCc6ICdEQy05OTI5OTY5L2phcGFuMC9mZWRleDAwK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGs6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC1oay9vcGVuLWFjY291bnQvcGVyc29uYWwuaHRtbCc6ICdEQy05OTI5OTY5L2hvbmdrMC9mZWRleDAwNCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4taGsvb3Blbi1hY2NvdW50L3BlcnNvbmFsLmh0bWwnOiAnREMtOTkyOTk2OS9ob25nazAvZmVkZXgwMDUrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL3poLWhrL3NoaXBwaW5nL2ZlZGV4LXJld2FyZHMuaHRtbCc6ICdEQy05OTI5OTY5L2hvbmdrMC9mZWRleDAwNitzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4taGsvc2hpcHBpbmcvZmVkZXgtcmV3YXJkcy5odG1sJzogJ0RDLTk5Mjk5NjkvaG9uZ2swL2ZlZGV4MDA3K3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC1oay9zbWFsbC1idXNpbmVzcy5odG1sJzogJ0RDLTk5Mjk5NjkvaG9uZ2swL2ZlZGV4MCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4taGsvc21hbGwtYnVzaW5lc3MuaHRtbCc6ICdEQy05OTI5OTY5L2hvbmdrMC9mZWRleDAwK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy96aC1oay9vcGVuLWFjY291bnQuaHRtbCc6ICdEQy05OTI5OTY5L2hvbmdrMC9mZWRleDAwMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4taGsvb3Blbi1hY2NvdW50Lmh0bWwnOiAnREMtOTkyOTk2OS9ob25nazAvZmVkZXgwMDErc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL3poLWhrL29wZW4tYWNjb3VudC9jb3Jwb3JhdGUuaHRtbCc6ICdEQy05OTI5OTY5L2hvbmdrMC9mZWRleDAwMitzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4taGsvb3Blbi1hY2NvdW50L2NvcnBvcmF0ZS5odG1sJzogJ0RDLTk5Mjk5NjkvaG9uZ2swL2ZlZGV4MDAzK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hdS9zaGlwcGluZy9mZWRleC1yZXdhcmRzLmh0bWwnOiAnREMtOTkyOTk2OS9hdXN0cjAvZmVkZXgwMDIrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWF1L3NtYWxsLWJ1c2luZXNzLmh0bWwnOiAnREMtOTkyOTk2OS9hdXN0cjAvZmVkZXgwMC0rc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWF1L29wZW4tYWNjb3VudC5odG1sJzogJ0RDLTk5Mjk5NjkvYXVzdHIwL2ZlZGV4MDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWF1L29wZW4tYWNjb3VudC9jb3Jwb3JhdGUuaHRtbCc6ICdEQy05OTI5OTY5L2F1c3RyMC9mZWRleDAwMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tYXUvb3Blbi1hY2NvdW50L3BlcnNvbmFsLmh0bWwnOiAnREMtOTkyOTk2OS9hdXN0cjAvZmVkZXgwMDErc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWF1L3NtYWxsLWJ1c2luZXNzL2RlbGlnaHRpbmctY3VzdG9tZXJzL3Jld2FyZHMtcHJvZ3JhbXMtYmVuZWZpdHMuaHRtbCc6ICdEQy05OTI5OTY5L2F1c3RyMC9mZWRleDAwOStzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tYXUvc21hbGwtYnVzaW5lc3Mvc3VjY2Vzcy1qb3VybmV5L2ZhY3RzLWJlbmVmaXRzLWdyYW50cy5odG1sJzogJ0RDLTk5Mjk5NjkvYXVzdHIwL2ZlZGV4MDBhK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hdS9zbWFsbC1idXNpbmVzcy9zdHJlYW1saW5lLW9wZXJhdGlvbnMvdGlwcy1mb3ItZWZmaWNpZW50LWVmZmVjdGl2ZS1zaGlwcGluZy5odG1sJzogJ0RDLTk5Mjk5NjkvYXVzdHIwL2ZlZGV4MDBiK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hdS9zbWFsbC1idXNpbmVzcy9hY2NlbGVyYXRpbmctZGlnaXRhbC9kaWdpdGFsaXplLWN1c3RvbXMtZG9jdW1lbnRzLmh0bWwnOiAnREMtOTkyOTk2OS9hdXN0cjAvZmVkZXgwMGMrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLWF1L3NtYWxsLWJ1c2luZXNzL2FjY2VsZXJhdGluZy1kaWdpdGFsL29wcG9ydHVuaXRpZXMtZm9yLWVjb21tZXJjZS1idXNpbmVzcy5odG1sJzogJ0RDLTk5Mjk5NjkvYXVzdHIwL2ZlZGV4MDBkK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1hdS9zbWFsbC1idXNpbmVzcy9hZGFwdC1pbm5vdmF0ZS9zdXN0YWluYWJsZS1zdXBwbHktY2hhaW4uaHRtbCc6ICdEQy05OTI5OTY5L2F1c3RyMC9mZWRleDAwZStzdGFuZGFyZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZXMtY28vb3Blbi1hY2NvdW50Lmh0bWwnOiAnREMtMjUyNjI4OS9iYmNqbTAvYWxsX2YwMG8rc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VzLWNvL2N1c3RvbWVyLXN1cHBvcnQuaHRtbCc6ICdEQy0yNTI2Mjg5L2JiY2ptMC9hbGxfZjAwaitzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZXMtY28vYWJvdXQvcG9zc2liaWxpdGllcy5odG1sP0NNUD1QQUMtUG9zc2liaWxpdGllcy0wLTAtMTA1Mi0xMDAwMDAtTEFDLWNvLWVzLVZhbml0eVVSTCNmb29kLWJldmVyYWdlJzogJ0RDLTI1MjYyODkvYmJjam0wL2FsbF9mMDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VzLWNvL3NoaXBwaW5nLmh0bWwnOiAnREMtMjUyNjI4OS9iYmNqbTAvYWxsX2YwMDIrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VzLWNvL2Fib3V0L3Bvc3NpYmlsaXRpZXMuaHRtbD9DTVA9UEFDLVBvc3NpYmlsaXRpZXMtMC0wLTEwNTItMTAwMDAwLUxBQy1jby1lcy1WYW5pdHlVUkwjdGVjaG5vbG9neSc6ICdEQy0yNTI2Mjg5L2JiY2ptMC9hbGxfZjAwMCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZXMtY28vYWJvdXQvcG9zc2liaWxpdGllcy5odG1sP0NNUD1QQUMtUG9zc2liaWxpdGllcy0wLTAtMTA1Mi0xMDAwMDAtTEFDLWNvLWVzLVZhbml0eVVSTCc6ICdEQy0yNTI2Mjg5L2JiY2ptMC9hbGxfZjArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VzLWNvL3NoaXBwaW5nL3JhdGVzLmh0bWwnOiAnREMtMjUyNjI4OS9iYmNqbTAvYWxsX2YwMDcrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VzLWNvL2hvbWUuaHRtbCc6ICdEQy0yNTI2Mjg5L2JiY2ptMC9hbGxfZjAwcCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZXMtY28vb25saW5lL3JhdGluZy5odG1sJzogJ0RDLTI1MjYyODkvYmJjam0wL2FsbF9mMDA1K3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lcy1jby90cmFja2luZy5odG1sJzogJ0RDLTI1MjYyODkvYmJjam0wL2FsbF9mMDBiK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lcy1jby9jdXN0b21zLXRvb2xzLmh0bWwnOiAnREMtMjUyNjI4OS9iYmNqbTAvYWxsX2YwMGMrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VzLWNvL2Fib3V0L3Bvc3NpYmlsaXRpZXMuaHRtbCc6ICdEQy0yNTI2Mjg5L2JiY2ptMC9hbGxfZjAwK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2w6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lcy1jbC9iaWxsaW5nLmh0bWwnOiAnREMtMjUyNjI4OS9iYmNqbTAvYWxsX2YwMHMrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VzLWNsL2Fib3V0L3Bvc3NpYmlsaXRpZXMuaHRtbCc6ICdEQy0yNTI2Mjg5L2JiY2ptMC9hbGxfZjAwK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnI6IHsgJy9wdC1ici9hYm91dC9wb3NzaWJpbGl0aWVzLmh0bWwnOiAnREMtMjUyNjI4OS9iYmNqbTAvYWxsX2YwMCtzdGFuZGFyZCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBteDogeyAnL2VzLW14L2Fib3V0L3Bvc3NpYmlsaXRpZXMuaHRtbCc6ICdEQy0yNTI2Mjg5L2JiY2ptMC9hbGxfZjAwK3N0YW5kYXJkJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG15OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbXkvc2hpcHBpbmcvZmVkZXgtcmV3YXJkcy5odG1sJzogJ0RDLTk5Mjk5NjkvbWFsYXkwL2ZlZGV4MDAyK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1teS9zbWFsbC1idXNpbmVzcy9kZWxpZ2h0aW5nLWN1c3RvbWVycy9yZXdhcmRzLXByb2dyYW1zLWJlbmVmaXRzLmh0bWwnOiAnREMtOTkyOTk2OS9tYWxheTAvZmVkZXgwMDQrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLW15L3NtYWxsLWJ1c2luZXNzLmh0bWwnOiAnREMtOTkyOTk2OS9tYWxheTAvZmVkZXgwMDUrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLW15L3NtYWxsLWJ1c2luZXNzL3N1Y2Nlc3Mtam91cm5leS9mYWN0cy1iZW5lZml0cy1ncmFudHMuaHRtbCc6ICdEQy05OTI5OTY5L21hbGF5MC9mZWRleDAwNitzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbi1teS9zbWFsbC1idXNpbmVzcy9zdHJlYW1saW5lLW9wZXJhdGlvbnMvdGlwcy1mb3ItZWZmaWNpZW50LWVmZmVjdGl2ZS1zaGlwcGluZy5odG1sJzogJ0RDLTk5Mjk5NjkvbWFsYXkwL2ZlZGV4MDA3K3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1teS9zbWFsbC1idXNpbmVzcy9hY2NlbGVyYXRpbmctZGlnaXRhbC9kaWdpdGFsaXplLWN1c3RvbXMtZG9jdW1lbnRzLmh0bWwnOiAnREMtOTkyOTk2OS9tYWxheTAvZmVkZXgwMDgrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLW15L3NtYWxsLWJ1c2luZXNzL2FkYXB0LWlubm92YXRlL3N1c3RhaW5hYmxlLXN1cHBseS1jaGFpbi5odG1sJzogJ0RDLTk5Mjk5NjkvbWFsYXkwL2ZlZGV4MDAtK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1teS9zbWFsbC1idXNpbmVzcy9hY2NlbGVyYXRpbmctZGlnaXRhbC9vcHBvcnR1bml0aWVzLWZvci1lY29tbWVyY2UtYnVzaW5lc3MuaHRtbCc6ICdEQy05OTI5OTY5L21hbGF5MC9mZWRleDAwOStzdGFuZGFyZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG56OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tbnovc2hpcHBpbmcvZmVkZXgtcmV3YXJkcy5odG1sJzogJ0RDLTk5Mjk5NjkvbmV3emUwL2ZlZGV4MDAyK3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1uei9zbWFsbC1idXNpbmVzcy9kZWxpZ2h0aW5nLWN1c3RvbWVycy9yZXdhcmRzLXByb2dyYW1zLWJlbmVmaXRzLmh0bWwnOiAnREMtOTkyOTk2OS9uZXd6ZTAvZmVkZXgwMDQrc3RhbmRhcmQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXBoL3NoaXBwaW5nL2ZlZGV4LXJld2FyZHMuaHRtbCc6ICdEQy05OTI5OTY5L3BoaWxpMC9mZWRleDAwMitzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZW4tcGgvc21hbGwtYnVzaW5lc3MvZGVsaWdodGluZy1jdXN0b21lcnMvcmV3YXJkcy1wcm9ncmFtcy1iZW5lZml0cy5odG1sJzogJ0RDLTk5Mjk5NjkvcGhpbGkwL2ZlZGV4MDA0K3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1waC9zbWFsbC1idXNpbmVzcy5odG1sJzogJ0RDLTk5Mjk5NjkvcGhpbGkwL2ZlZGV4MDA1K3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1waC9zbWFsbC1idXNpbmVzcy9zdWNjZXNzLWpvdXJuZXkvZmFjdHMtYmVuZWZpdHMtZ3JhbnRzLmh0bWwnOiAnREMtOTkyOTk2OS9waGlsaTAvZmVkZXgwMDYrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXBoL3NtYWxsLWJ1c2luZXNzL3N0cmVhbWxpbmUtb3BlcmF0aW9ucy90aXBzLWZvci1lZmZpY2llbnQtZWZmZWN0aXZlLXNoaXBwaW5nLmh0bWwnOiAnREMtOTkyOTk2OS9waGlsaTAvZmVkZXgwMDcrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXBoL3NtYWxsLWJ1c2luZXNzL2FjY2VsZXJhdGluZy1kaWdpdGFsL29wcG9ydHVuaXRpZXMtZm9yLWVjb21tZXJjZS1idXNpbmVzcy5odG1sJzogJ0RDLTk5Mjk5NjkvcGhpbGkwL2ZlZGV4MDA5K3N0YW5kYXJkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9lbi1waC9zbWFsbC1idXNpbmVzcy9hY2NlbGVyYXRpbmctZGlnaXRhbC9kaWdpdGFsaXplLWN1c3RvbXMtZG9jdW1lbnRzLmh0bWwnOiAnREMtOTkyOTk2OS9waGlsaTAvZmVkZXgwMDgrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL2VuLXBoL3NtYWxsLWJ1c2luZXNzL2FkYXB0LWlubm92YXRlL3N1c3RhaW5hYmxlLXN1cHBseS1jaGFpbi5odG1sJzogJ0RDLTk5Mjk5NjkvcGhpbGkwL2ZlZGV4MDAtK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGg6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy90aC10aC9zaGlwcGluZy9mZWRleC1yZXdhcmRzLmh0bWwnOiAnREMtOTkyOTk2OS90aGFpbDAvZmVkZXgwMDIrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnL3RoLXRoL3NtYWxsLWJ1c2luZXNzL2RlbGlnaHRpbmctY3VzdG9tZXJzL3Jld2FyZHMtcHJvZ3JhbXMtYmVuZWZpdHMuaHRtbCc6ICdEQy05OTI5OTY5L3RoYWlsMC9mZWRleDAwNCtzdGFuZGFyZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNuOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvemgtY24vc2hpcHBpbmcvZmVkZXgtcmV3YXJkcy5odG1sJzogJ0RDLTk5Mjk5NjkvY2hpbmEwL2ZlZGV4MCtzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvemgtY24vc21hbGwtYnVzaW5lc3MvZGVsaWdodGluZy1jdXN0b21lcnMvcmV3YXJkcy1wcm9ncmFtcy1iZW5lZml0cy5odG1sJzogJ0RDLTk5Mjk5NjkvY2hpbmEwL2ZlZGV4MDAwK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ3NlYXJjaDp0ZXJtJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL3F1ZXJ5U3RyaW5nUGFyYW1ldGVyLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncScsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZTogITAKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2FhbTpjb250YWluZXJOU0lETWFwcGluZyc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuOiAnMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXM6ICcyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcGFjOiAnMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXU6ICc0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWM6ICc1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWlzYTogJzYnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdnVGFnOlZpZGVvUGxheUlkTGlzdCc6IHsKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2c6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzE2NDgwMDg1NDYxNjg0OTkzMzEnOiAnREMtMjI5MDc5NC9jYW1wYTAvZmVkZXgwMDArc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTY0ODAwODU0NzEyODAzODQzNic6ICdEQy0yMjkwNzk0L2NhbXBhMC9mZWRleDAwMStzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxNjQ4MjgyMjI5NTM4NjYyMTQ3JzogJ0RDLTIyOTA3OTQvY2FtcGEwL2ZlZGV4MDAyK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga3I6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzE2NDgwMDg1NDU2MDg1OTE3MTgnOiAnREMtODM1ODAwNi9pbnZtZWRpYS9mZWRleDAwcitzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxNjQ4MDA4NTA1MjkyOTkxMjY2JzogJ0RDLTgzNTgwMDYvaW52bWVkaWEvZmVkZXgwMHMrc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTY1MDE4NTcwODQwNjQ0NTU4NSc6ICdEQy04MzU4MDA2L2ludm1lZGlhL2ZlZGV4MDB0K3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzE2NDgwMDg0NzA5MDM3NjA2NDAnOiAnREMtNTY1MzAyMC9meTIwYTAvZnkyMF8wMDErc3RhbmRhcmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTY0ODAwODQ5NDQzMjg5MTI1MCc6ICdEQy01NjUzMDIwL2Z5MjBhMC9meTIwXzAwMitzdGFuZGFyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxNjUwMTg1NzA4NDA2NDQ1NTg1JzogJ0RDLTU2NTMwMjAvZnkyMGEwL2Z5MjBfMDAzK3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6cmVnaW9uJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBGRFguREFUQUxBWUVSLnBhZ2UucGFnZUluZm8ucmVnaW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdlbl9pbicgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6bG9jYWxlJykgJiYgJ21laXNhJyAhPT0gZSAmJiAoZSA9ICdtZWlzYScpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIG1jb3JnSUQ6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcxRTIyMTcxQjUyMEU5M0JGMEE0OTBENDRAQWRvYmVPcmcnOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHRhcmdldGVuYWJsZWRVcmxMaXN0OiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbJy9vbmxpbmUvcmF0aW5nLmh0bWwnXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAndmE6ZW5hYmxlZENvdW50cnlMaXN0JzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdqcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2EnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2F1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdueicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndm4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdteScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2J6JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dmJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ3knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2h0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnemEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2hrJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdrcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZG0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdibycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VjJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdobicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25pJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2F3JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdiYicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYnEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2t5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY3cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ptJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbWYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzeCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2tuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2YycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3R0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2aScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2wnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1eScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdicicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd6YScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ3F1YWx0cmljczpwYWdlTGlzdE1hcHBpbmdOZXcnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcvZmVkZXh0cmFjaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mZWRleHRyYWNraW5nJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAncXVhbHRyaWNzOnBhZ2VOYW1lJzogewogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZmNyL2NyZWF0ZS1uZXctcmVwb3J0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZmNyL3ZpZXctcmVwb3J0LXN0YXR1cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Zjci92aWV3LXJlY3VycmluZy1yZXBvcnQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICd2YTp2ZXJzaW9uIG51bWJlcic6IHsKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gTmluYS5kZWJ1Zy5nZXRVSVZlcnNpb24oKSwgdCA9IGUubGFzdEluZGV4T2YoJy0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN1YnN0cmluZyh0ICsgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGV4dGVuc2lvbnM6IHsKICAgICAgICAgICAgICAgICdhZG9iZS1tY2lkJzogewogICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnRXhwZXJpZW5jZSBDbG91ZCBJRCBTZXJ2aWNlJywKICAgICAgICAgICAgICAgICAgICBob3N0ZWRMaWJGaWxlc0Jhc2VVcmw6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vZXh0ZW5zaW9ucy9FUDY0MzdmYTc4YWIwMjQ5NDZhMjExMzk3Njg5MDUyMzgxLycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgb3JnSWQ6ICclbWNvcmdJRCUnLAogICAgICAgICAgICAgICAgICAgICAgICB2YXJpYWJsZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnbG9hZFRpbWVvdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnNzAwMCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3RyYWNraW5nU2VydmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ21ldHJpY3MuZmVkZXguY29tJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAndHJhY2tpbmdTZXJ2ZXJTZWN1cmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnc21ldHJpY3MuZmVkZXguY29tJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnbWFya2V0aW5nQ2xvdWRTZXJ2ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnbWV0cmljcy5mZWRleC5jb20nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdtYXJrZXRpbmdDbG91ZFNlcnZlclNlY3VyZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdzbWV0cmljcy5mZWRleC5jb20nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdkaXNhYmxlSWRTeW5jcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclYWFtOklkU3luY0Rpc2FibGUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnaWRTeW5jQ29udGFpbmVySUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWFhbTpSZWdpb25Db250YWluZXJOU0lEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlczogewogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtbWNpZC9zcmMvbGliL3NoYXJlZE1vZHVsZXMvbWNpZEluc3RhbmNlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4oJ0BhZG9iZS9yZWFjdG9yLWRvY3VtZW50JyksIGEgPSBuKCcuLi9jb2RlTGlicmFyeS9WaXNpdG9yQVBJJyksIG8gPSBuKCcuLi8uLi92aWV3L3V0aWxzL3RpbWVVbml0cycpLCBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlZHVjZShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gL14odHJ1ZXxmYWxzZSkkL2kudGVzdCh0LnZhbHVlKSA/IEpTT04ucGFyc2UodC52YWx1ZSkgOiB0LnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3QubmFtZV0gPSBuLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBjID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gci5nZXRFeHRlbnNpb25TZXR0aW5ncygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9IHR5cGVvZiB0Lm9yZ0lkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ09yZyBJRCBpcyBub3QgYSBzdHJpbmcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHModC52YXJpYWJsZXMgfHwgW10pLCBpID0gdC5kb2VzT3B0SW5BcHBseTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJiYgKCdib29sZWFuJyA9PSB0eXBlb2YgaSA/IG4uZG9lc09wdEluQXBwbHkgPSBpIDogdC5vcHRJbkNhbGxiYWNrICYmIChuLmRvZXNPcHRJbkFwcGx5ID0gdC5vcHRJbkNhbGxiYWNrKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQuaXNPcHRJblN0b3JhZ2VFbmFibGVkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiAobi5pc09wdEluU3RvcmFnZUVuYWJsZWQgPSBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gdC5vcHRJbkNvb2tpZURvbWFpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgJiYgKG4ub3B0SW5Db29raWVEb21haW4gPSBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gdC5vcHRJblN0b3JhZ2VFeHBpcnk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gdC50aW1lVW5pdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobCAmJiBvW2xdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gdSAqIG9bbF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ub3B0SW5TdG9yYWdlRXhwaXJ5ID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhMCA9PT0gYSAmJiAobi5vcHRJblN0b3JhZ2VFeHBpcnkgPSAzMzY5NjAwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHQucHJldmlvdXNQZXJtaXNzaW9uczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgJiYgKG4ucHJldmlvdXNQZXJtaXNzaW9ucyA9IGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSB0LnByZU9wdEluQXBwcm92YWxzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wcmVPcHRJbkFwcHJvdmFscyA9IHA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IHQucHJlT3B0SW5BcHByb3ZhbElucHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gJiYgKG4ucHJlT3B0SW5BcHByb3ZhbHMgPSBtKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gdC5pc0lhYkNvbnRleHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnICYmIChuLmlzSWFiQ29udGV4dCA9IGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBlLmdldEluc3RhbmNlKHQub3JnSWQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIubG9nZ2VyLmluZm8oJ0NyZWF0ZWQgaW5zdGFuY2UgdXNpbmcgb3JnSWQ6ICInICsgdC5vcmdJZCArICciJyksIHIubG9nZ2VyLmluZm8oJ1NldCB2YXJpYWJsZXM6ICcgKyBKU09OLnN0cmluZ2lmeShuKSksIGguZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmxvZ2dlci5pbmZvKCdPYnRhaW5lZCBNYXJrZXRpbmcgQ2xvdWQgVmlzaXRvciBJZDogJyArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApLCBoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB1ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoci5nZXRFeHRlbnNpb25TZXR0aW5ncygpLnBhdGhFeGNsdXNpb25zIHx8IFtdKS5zb21lKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudmFsdWVJc1JlZ2V4ID8gbmV3IFJlZ0V4cCh0LnZhbHVlLCAnaScpLnRlc3QoZSkgOiB0LnZhbHVlID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGwgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9zYXRlbGxpdGUuZ2V0VmlzaXRvcklkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB1KGkubG9jYXRpb24ucGF0aG5hbWUpID8gci5sb2dnZXIud2FybignTUNJRCBsaWJyYXJ5IG5vdCBsb2FkZWQuIE9uZSBvZiB0aGUgcGF0aCBleGNsdXNpb25zIG1hdGNoZXMgdGhlIGN1cnJlbnQgcGF0aC4nKSA6IGwgPSBjKGEpLCBlLmV4cG9ydHMgPSBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdtY2lkLWluc3RhbmNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNoYXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLW1jaWQvc3JjL2xpYi9jb2RlTGlicmFyeS9WaXNpdG9yQVBJLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGUuY29uc3RydWN0b3IgPT09IFN5bWJvbCAmJiBlICE9PSBTeW1ib2wucHJvdG90eXBlID8gJ3N5bWJvbCcgOiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgaW4gZSA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogZVt0XSA9IG4sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2tzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGQ6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbGJhY2tzW2VdID0gdGhpcy5jYWxsYmFja3NbZV0gfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcy5jYWxsYmFja3NbZV0ucHVzaCh0KSAtIDEsIHIgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5jYWxsYmFja3NbZV0uc3BsaWNlKG4sIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuY2FsbGJhY2tzW2VdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gKHQgPSB2b2lkIDAgPT09IHQgPyBbXSA6IHQpIGluc3RhbmNlb2YgQXJyYXkgPyB0IDogW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgdGhpcy5jYWxsYmFja3NbZV0ubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuY2FsbGJhY2tzW2VdLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT0gdHlwZW9mIG4gPyBuLmFwcGx5KG51bGwsIHQpIDogbiBpbnN0YW5jZW9mIEFycmF5ICYmIG5bMV0uYXBwbHkoblswXSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzLmNhbGxiYWNrc1tlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0ZUFsbDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHQgfHwgZSAmJiAhVC5pc09iamVjdEVtcHR5KGUpKSAmJiBPYmplY3Qua2V5cyh0aGlzLmNhbGxiYWNrcykuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB2b2lkIDAgIT09IGVbdF0gPyBlW3RdIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmV4ZWN1dGUodCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzQ2FsbGJhY2tzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCb29sZWFuKE9iamVjdC5rZXlzKHRoaXMuY2FsbGJhY2tzKS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG51bGwgPT0gZSA/IHZvaWQgMCA6IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSByID8gbiA6IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gL15cZCskLywgbiA9IDAsIHIgPSBlLmxlbmd0aDsgbiA8IHI7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXQudGVzdChlW25dKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGUubGVuZ3RoIDwgdC5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHVzaCgnMCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHQubGVuZ3RoIDwgZS5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaCgnMCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCBlLmxlbmd0aDsgbisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBwYXJzZUludChlW25dLCAxMCksIGkgPSBwYXJzZUludCh0W25dLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPiBpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA+IHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUudG9TdHJpbmcoKS5zcGxpdCgnLicpLCByID0gdC50b1N0cmluZygpLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShuLmNvbmNhdChyKSkgPyAoYShuLCByKSwgbyhuLCByKSkgOiBOYU47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gT2JqZWN0KGUpICYmIDAgPT09IE9iamVjdC5rZXlzKGUpLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09IHR5cGVvZiBlIHx8IGUgaW5zdGFuY2VvZiBBcnJheSAmJiBlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6ICcnLCB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2cgPSBsZSgnbG9nJywgZSwgdCksIHRoaXMud2FybiA9IGxlKCd3YXJuJywgZSwgdCksIHRoaXMuZXJyb3IgPSBsZSgnZXJyb3InLCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAoYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiB7fSkuY29va2llTmFtZSwgdCA9IChhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IHt9KS5jb29raWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlIHx8ICF0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogRWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogRWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZTogRWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucmVtb3ZlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5nZXQoZSksIHIgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBKU09OLnBhcnNlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChyLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBpIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4uZ2V0KCksIG8gPSBPYmplY3QuYXNzaWduKGEsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNldChlLCBKU09OLnN0cmluZ2lmeShvKSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluOiBpLm9wdEluQ29va2llRG9tYWluIHx8ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llTGlmZXRpbWU6IGkub3B0SW5TdG9yYWdlRXhwaXJ5IHx8IDM0MTkwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJlczogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5uYW1lID0gdGhpcy5jb25zdHJ1Y3Rvci5uYW1lLCB0aGlzLm1lc3NhZ2UgPSBlLCAnZnVuY3Rpb24nID09IHR5cGVvZiBFcnJvci5jYXB0dXJlU3RhY2tUcmFjZSA/IEVycm9yLmNhcHR1cmVTdGFja1RyYWNlKHRoaXMsIHRoaXMuY29uc3RydWN0b3IpIDogdGhpcy5zdGFjayA9IG5ldyBFcnJvcihlKS5zdGFjazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBnZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5sZW5ndGggPyBuLmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBoZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSSh3KSwgRSh0ZS5DT01QTEVURSksIGgoZy5zdGF0dXMsIGcucGVybWlzc2lvbnMpLCBzICYmIG0uc2V0KGcucGVybWlzc2lvbnMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0SW5Db29raWVEb21haW46IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdEluU3RvcmFnZUV4cGlyeTogdQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB2LmV4ZWN1dGUoUGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdmUobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1tPcHRJbl0gSW52YWxpZCBjYXRlZ29yeSgtaWVzKS4gUGxlYXNlIHVzZSB0aGUgYE9wdEluLkNhdGVnb3JpZXNgIGVudW0uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFKHRlLkNIQU5HRUQpLCBPYmplY3QuYXNzaWduKHcsIGJlKGdlKG4pLCBlKSksIHIgfHwgdCgpLCBnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30sIGkgPSByLmRvZXNPcHRJbkFwcGx5LCBhID0gci5wcmV2aW91c1Blcm1pc3Npb25zLCBvID0gci5wcmVPcHRJbkFwcHJvdmFscywgcyA9IHIuaXNPcHRJblN0b3JhZ2VFbmFibGVkLCBjID0gci5vcHRJbkNvb2tpZURvbWFpbiwgdSA9IHIub3B0SW5TdG9yYWdlRXhwaXJ5LCBsID0gci5pc0lhYkNvbnRleHQsIGYgPSAoYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiB7fSkuY29va2llcywgcCA9IEllKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGUocCwgJ0ludmFsaWQgYHByZXZpb3VzUGVybWlzc2lvbnNgIScpLCBEZShvLCAnSW52YWxpZCBgcHJlT3B0SW5BcHByb3ZhbHNgIScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSBkKHsgY29va2llTmFtZTogJ2Fkb2JldWpzLW9wdGluJyB9LCB7IGNvb2tpZXM6IGYgfSksIGcgPSB0aGlzLCBoID0gZWUoZyksIHYgPSBzZSgpLCBiID0gQ2UocCksIHkgPSBDZShvKSwgXyA9IHMgPyBtLmdldCgpIDoge30sIEMgPSB7fSwgeCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4ZShlKSB8fCB0ICYmIHhlKHQpID8gdGUuQ09NUExFVEUgOiB0ZS5QRU5ESU5HOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oYiwgXyksIGsgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGJlKG9lLCAhaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID8gT2JqZWN0LmFzc2lnbih7fSwgciwgZSwgdCwgbikgOiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oeSwgYiwgXyksIHcgPSB5ZShrKSwgRSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBJID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGsgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLmRlbnkgPSBuKCExKSwgZy5hcHByb3ZlID0gbighMCksIGcuZGVueUFsbCA9IGcuZGVueS5iaW5kKGcsIG9lKSwgZy5hcHByb3ZlQWxsID0gZy5hcHByb3ZlLmJpbmQoZywgb2UpLCBnLmlzQXBwcm92ZWQgPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHQsIGcucGVybWlzc2lvbnMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZy5pc1ByZUFwcHJvdmVkID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0LCB5KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGcuZmV0Y2hQZXJtaXNzaW9ucyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSAmJiBhcmd1bWVudHNbMV0sIG4gPSB0ID8gZy5vbih0ZS5DT01QTEVURSwgZSkgOiBFZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWkgfHwgaSAmJiBnLmlzQ29tcGxldGUgfHwgbyA/IGUoZy5wZXJtaXNzaW9ucykgOiB0IHx8IHYuYWRkKFBlLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKGcucGVybWlzc2lvbnMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZy5jb21wbGV0ZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLnN0YXR1cyA9PT0gdGUuQ0hBTkdFRCAmJiB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBnLnJlZ2lzdGVyUGx1Z2luID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUgfHwgIWUubmFtZSB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBlLm9uUmVnaXN0ZXIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihPZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ1tlLm5hbWVdIHx8IChDW2UubmFtZV0gPSBlLCBlLm9uUmVnaXN0ZXIuY2FsbChlLCBnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBnLmV4ZWN1dGUgPSBUZShDKSwgZy5tZW1vaXplQ29udGVudCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2UoZSkgJiYgbS5zZXQoZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRJbkNvb2tpZURvbWFpbjogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0SW5TdG9yYWdlRXhwaXJ5OiB1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBnLmdldE1lbW9pemVkQ29udGVudCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBtLmdldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZXJtaXNzaW9uczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2F0ZWdvcmllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9lc09wdEluQXBwbHk6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc1BlbmRpbmc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5zdGF0dXMgPT09IHRlLlBFTkRJTkc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQ29tcGxldGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5zdGF0dXMgPT09IHRlLkNPTVBMRVRFOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX3BsdWdpbnM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoQyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzSWFiQ29udGV4dDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBudWxsLCBlLmNhbGwoZSwgbmV3IGYoJ1RoZSBjYWxsIHRvb2sgbG9uZ2VyIHRoYW4geW91IHdhbnRlZCEnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJiYgKGNsZWFyVGltZW91dChpKSwgZS5hcHBseShlLCBhcmd1bWVudHMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHNldFRpbWVvdXQobiwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5fX3RjZmFwaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93Ll9fdGNmYXBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB3aW5kb3c7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSAhPT0gd2luZG93LnRvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQ7ICF0OykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5wYXJlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZyYW1lcy5fX3RjZmFwaUxvY2F0b3IgJiYgKHQgPSBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSB3aW5kb3cudG9wKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuX190Y2ZhcGkgPSBmdW5jdGlvbiAoZSwgciwgaSwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBNYXRoLnJhbmRvbSgpICsgJycsIHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fdGNmYXBpQ2FsbDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tbWFuZDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtZXRlcjogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsSWQ6IG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW29dID0gaSwgdC5wb3N0TWVzc2FnZShzLCAnKicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignbWVzc2FnZScsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gSlNPTi5wYXJzZShlLmRhdGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5fX3RjZmFwaVJldHVybikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC5fX3RjZmFwaVJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiBuW3IuY2FsbElkXSAmJiAobltyLmNhbGxJZF0oci5yZXR1cm5WYWx1ZSwgci5zdWNjZXNzKSwgZGVsZXRlIG5bci5jYWxsSWRdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITEpLCB3aW5kb3cuX190Y2ZhcGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlLmVycm9yKCdfX3RjZmFwaSBub3QgZm91bmQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlLmVycm9yKCdfX3RjZmFwaSBub3QgZm91bmQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMl0gPyBhcmd1bWVudHNbMl0gOiBbXSwgciA9ICEwID09PSBlLnZlbmRvci5jb25zZW50c1t0XSwgaSA9IG4uZXZlcnkoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBlLnB1cnBvc2UuY29uc2VudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciAmJiBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHYoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5hbWUgPSAnaWFiUGx1Z2luJywgZS52ZXJzaW9uID0gJzAuMC4yJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gc2UoKSwgciA9IHsgdHJhbnNwYXJlbmN5QW5kQ29uc2VudERhdGE6IG51bGwgfSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJbZV0gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZldGNoQ29uc2VudERhdGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbShlLmNhbGxiYWNrLCBlLnRpbWVvdXQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoeyBjYWxsYmFjazogdCB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuaXNBcHByb3ZlZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmNhbGxiYWNrLCBuID0gZS5jYXRlZ29yeSwgaSA9IGUudGltZW91dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci50cmFuc3BhcmVuY3lBbmRDb25zZW50RGF0YSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQobnVsbCwgaChyLnRyYW5zcGFyZW5jeUFuZENvbnNlbnREYXRhLCByZVtuXSwgaWVbbl0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG0oZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChlLCBoKHIsIHJlW25dLCBpZVtuXSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRlZ29yeTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUub25SZWdpc3RlciA9IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBPYmplY3Qua2V5cyhyZSksIGkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWUgJiYgdCAmJiAoci5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBoKHQsIHJlW2VdLCBpZVtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbltyID8gJ2FwcHJvdmUnIDogJ2RlbnknXShlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbi5jb21wbGV0ZSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZldGNoQ29uc2VudERhdGEoeyBjYWxsYmFjazogaSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5jYWxsYmFjazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIudHJhbnNwYXJlbmN5QW5kQ29uc2VudERhdGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShudWxsLCByLnRyYW5zcGFyZW5jeUFuZENvbnNlbnREYXRhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5hZGQoJ0ZFVENIX0NPTlNFTlRfREFUQScsIGEpLCBvKGZ1bmN0aW9uIChlLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0geWUoZSksIHMgPSB0LmdldE1lbW9pemVkQ29udGVudCgnaWFiQ29uc2VudEhhc2gnKSwgYyA9IGZlKG8udGNTdHJpbmcpLnRvU3RyaW5nKDMyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLmNvbnNlbnRTdHJpbmcgPSBlLnRjU3RyaW5nLCBvLmhhc0NvbnNlbnRDaGFuZ2VkU2luY2VMYXN0Q21wUHVsbCA9IHMgIT09IGMsIGkoJ3RyYW5zcGFyZW5jeUFuZENvbnNlbnREYXRhJywgbyksIHQubWVtb2l6ZUNvbnRlbnQoeyBpYWJDb25zZW50SGFzaDogYyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uZXhlY3V0ZSgnRkVUQ0hfQ09OU0VOVF9EQVRBJywgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci50cmFuc3BhcmVuY3lBbmRDb25zZW50RGF0YQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFNlKHJlKSwgbiA9IGcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgbiAmJiBuKCdnZXRUQ0RhdGEnLCAyLCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGdsb2JhbFRoaXMgPyBnbG9iYWxUaGlzIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHdpbmRvdyA/IHdpbmRvdyA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBnbG9iYWwgPyBnbG9iYWwgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygc2VsZiA/IHNlbGYgOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmFzc2lnbiA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQsIG4sIHIgPSAxOyByIDwgYXJndW1lbnRzLmxlbmd0aDsgKytyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCBpbiBuID0gYXJndW1lbnRzW3JdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgdCkgJiYgKGVbdF0gPSBuW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSwgXywgQyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNRVNTQUdFUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIQU5EU0hBS0U6ICdIQU5EU0hBS0UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRVRTVEFURTogJ0dFVFNUQVRFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUEFSRU5UU1RBVEU6ICdQQVJFTlRTVEFURScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNUQVRFX0tFWVNfTUFQOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DTUlEOiAnTUNNSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FJRDogJ01DQUlEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBQU1COiAnTUNBQU1CJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBQU1MSDogJ01DQUFNTEgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ09QVE9VVDogJ01DT1BUT1VUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ1VTVE9NRVJJRFM6ICdDVVNUT01FUklEUycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTWU5DX0FQSV9NQVA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNNSUQ6ICdnZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUlEOiAnZ2V0QW5hbHl0aWNzVmlzaXRvcklEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBQU1COiAnZ2V0QXVkaWVuY2VNYW5hZ2VyQmxvYicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNTEg6ICdnZXRBdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ09QVE9VVDogJ2lzT3B0ZWRPdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTExGSUVMRFM6ICdnZXRWaXNpdG9yVmFsdWVzJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU1lOQ19BUElfTUFQOiB7IENVU1RPTUVSSURTOiAnZ2V0Q3VzdG9tZXJJRHMnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxMX0FQSVM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNNSUQ6ICdnZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNQjogJ2dldEF1ZGllbmNlTWFuYWdlckJsb2InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUxIOiAnZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNPUFRPVVQ6ICdpc09wdGVkT3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBSUQ6ICdnZXRBbmFseXRpY3NWaXNpdG9ySUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDVVNUT01FUklEUzogJ2dldEN1c3RvbWVySURzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxMRklFTERTOiAnZ2V0VmlzaXRvclZhbHVlcycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZJRUxER1JPVVBfVE9fRklFTEQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUM6ICdNQ01JRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEE6ICdNQ0FJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFBTTogJ01DQUFNQicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZJRUxEUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ01JRDogJ01DTUlEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNPUFRPVVQ6ICdNQ09QVE9VVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUlEOiAnTUNBSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUxIOiAnTUNBQU1MSCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNQjogJ01DQUFNQicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVVEhfU1RBVEU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVU5LTk9XTjogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVUSEVOVElDQVRFRDogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTE9HR0VEX09VVDogMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT1BUX09VVDogeyBHTE9CQUw6ICdnbG9iYWwnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHggPSBDLlNUQVRFX0tFWVNfTUFQLCBrID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlKDAsIHQpLCBhID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYVt0XSA9IGksIHIuc2V0U3RhdGVBbmRQdWJsaXNoKGEpLCBuKGkpLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUgfHwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzLmZpbmRGaWVsZCh4Lk1DTUlELCBlKSwgaSA9IG4uY2FsbCh0aGlzLCB4Lk1DTUlELCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gciA/IHIgOiBpKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5nZXRWaXNpdG9yVmFsdWVzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh7IE1DTUlEOiB0IH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdyA9IEMuTUVTU0FHRVMsIEUgPSBDLkFTWU5DX0FQSV9NQVAsIEkgPSBDLlNZTkNfQVBJX01BUCwgRCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2FsbGJhY2tSZWdpc3RyeS5hZGQoZSwgdCksIG4ubWVzc2FnZVBhcmVudCh3LkdFVFNUQVRFKSwgJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4obikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzW0Vbbl1dID0gZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSByIHx8IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHRoaXMuZmluZEZpZWxkKG4sIHIpLCBhID0gdC5jYWxsKHRoaXMsIG4sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gaSA/IGkgOiBhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzW0lbdF1dID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmluZEZpZWxkKHQsIGUpIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhFKS5mb3JFYWNoKG4sIHRoaXMpLCBPYmplY3Qua2V5cyhJKS5mb3JFYWNoKHIsIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgQSA9IEMuQVNZTkNfQVBJX01BUCwgUyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhBKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbQVtlXV0gPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jYWxsYmFja1JlZ2lzdHJ5LmFkZChlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHQgPSB7IGV4cG9ydHM6IHt9IH0sIHQuZXhwb3J0cyksIHQuZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmlzT2JqZWN0RW1wdHkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gT2JqZWN0KGUpICYmIDAgPT09IE9iamVjdC5rZXlzKGUpLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuLmlzVmFsdWVFbXB0eSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJyA9PT0gZSB8fCBuLmlzT2JqZWN0RW1wdHkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuYXZpZ2F0b3IuYXBwTmFtZSwgdCA9IG5hdmlnYXRvci51c2VyQWdlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnTWljcm9zb2Z0IEludGVybmV0IEV4cGxvcmVyJyA9PT0gZSB8fCB0LmluZGV4T2YoJ01TSUUgJykgPj0gMCB8fCB0LmluZGV4T2YoJ1RyaWRlbnQvJykgPj0gMCAmJiB0LmluZGV4T2YoJ1dpbmRvd3MgTlQgNicpID49IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmdldEllVmVyc2lvbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50LmRvY3VtZW50TW9kZSA/IGRvY3VtZW50LmRvY3VtZW50TW9kZSA6IHIoKSA/IDcgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4uZW5jb2RlQW5kQnVpbGRSZXF1ZXN0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubWFwKGVuY29kZVVSSUNvbXBvbmVudCkuam9pbih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuLmlzT2JqZWN0ID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IHQgJiYgJ29iamVjdCcgPT09IGUodCkgJiYgITEgPT09IEFycmF5LmlzQXJyYXkodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbi5kZWZpbmVHbG9iYWxOYW1lc3BhY2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuYWRvYmUgPSBuLmlzT2JqZWN0KHdpbmRvdy5hZG9iZSkgPyB3aW5kb3cuYWRvYmUgOiB7fSwgd2luZG93LmFkb2JlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4ucGx1Y2sgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5yZWR1Y2UoZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW25dICYmICh0W25dID0gZVtuXSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5jcmVhdGUobnVsbCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4ucGFyc2VPcHRPdXQgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0IHx8ICh0ID0gbiwgZS5kX29wdG91dCAmJiBlLmRfb3B0b3V0IGluc3RhbmNlb2YgQXJyYXkgJiYgKHQgPSBlLmRfb3B0b3V0LmpvaW4oJywnKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHBhcnNlSW50KGUuZF9vdHRsLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpc05hTihyKSAmJiAociA9IDcyMDApLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRPdXQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkX290dGw6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuLm5vcm1hbGl6ZUJvb2xlYW4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndHJ1ZScgPT09IGUgPyB0ID0gITAgOiAnZmFsc2UnID09PSBlICYmICh0ID0gITEpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgUCA9IChULmlzT2JqZWN0RW1wdHksIFQuaXNWYWx1ZUVtcHR5LCBULmdldEllVmVyc2lvbiwgVC5lbmNvZGVBbmRCdWlsZFJlcXVlc3QsIFQuaXNPYmplY3QsIFQuZGVmaW5lR2xvYmFsTmFtZXNwYWNlLCBULnBsdWNrLCBULnBhcnNlT3B0T3V0LCBULm5vcm1hbGl6ZUJvb2xlYW4sIG4pLCBPID0gQy5NRVNTQUdFUywgaiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwOiAncHJlZml4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOiAnb3JnSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI6ICdzdGF0ZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEwgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucGFyc2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmRhdGEuc3BsaXQoJ3wnKS5mb3JFYWNoKGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBlICYmICh0W2pbbl1dID0gMiAhPT0gbiA/IGUgOiBKU09OLnBhcnNlKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLmlzSW52YWxpZCA9IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdGhpcy5wYXJzZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyIHx8IE9iamVjdC5rZXlzKHIpLmxlbmd0aCA8IDIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZSAhPT0gci5vcmdJRCwgYSA9ICF0IHx8IG4ub3JpZ2luICE9PSB0LCBvID0gLTEgPT09IE9iamVjdC5rZXlzKE8pLmluZGV4T2Yoci5wcmVmaXgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSB8fCBhIHx8IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5zZW5kID0gZnVuY3Rpb24gKG4sIHIsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSByICsgJ3wnICsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSAmJiBpID09PSBPYmplY3QoaSkgJiYgKGEgKz0gJ3wnICsgSlNPTi5zdHJpbmdpZnkoaSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wb3N0TWVzc2FnZShhLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE0gPSBDLk1FU1NBR0VTLCBWID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihwLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5hc3NpZ24ocC5zdGF0ZSwgZSksIE9iamVjdC5hc3NpZ24ocC5zdGF0ZS5BTExGSUVMRFMsIGUpLCBwLmNhbGxiYWNrUmVnaXN0cnkuZXhlY3V0ZUFsbChwLnN0YXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaC5pc0ludmFsaWQoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaC5wYXJzZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAuc2V0U3RhdGVBbmRQdWJsaXNoKHQuc3RhdGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZyAmJiBtICYmIChnID0gITAsIGguc2VuZChyLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkobmV3IGsobi5fZ2VuZXJhdGVJRCkpLCBwLmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEKCksIHAuY2FsbGJhY2tSZWdpc3RyeS5leGVjdXRlQWxsKHAuc3RhdGUsICEwKSwgYi5yZW1vdmVFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgdSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWguaXNJbnZhbGlkKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGgucGFyc2UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gITEsIGIuY2xlYXJUaW1lb3V0KHAuX2hhbmRzaGFrZVRpbWVvdXQpLCBiLnJlbW92ZUV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCB1KSwgaShuZXcgRChwKSksIGIuYWRkRXZlbnRMaXN0ZW5lcignbWVzc2FnZScsIG8pLCBwLnNldFN0YXRlQW5kUHVibGlzaCh0LnN0YXRlKSwgcC5jYWxsYmFja1JlZ2lzdHJ5Lmhhc0NhbGxiYWNrcygpICYmIHMoTS5HRVRTVEFURSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbSAmJiBwb3N0TWVzc2FnZSA/IChiLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCB1KSwgcyhNLkhBTkRTSEFLRSksIHAuX2hhbmRzaGFrZVRpbWVvdXQgPSBzZXRUaW1lb3V0KGMsIDI1MCkpIDogYygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLnNfY19pbiB8fCAoYi5zX2NfaWwgPSBbXSwgYi5zX2NfaW4gPSAwKSwgcC5fYyA9ICdWaXNpdG9yJywgcC5faWwgPSBiLnNfY19pbCwgcC5faW4gPSBiLnNfY19pbiwgcC5faWxbcC5faW5dID0gcCwgYi5zX2NfaW4rKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwICE9PSBlLmluZGV4T2YoJ18nKSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBuW2VdICYmIChwW2VdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMobikuZm9yRWFjaChlKSwgcC5nZXRTdXBwbGVtZW50YWxEYXRhSUQgPSBuLmdldFN1cHBsZW1lbnRhbERhdGFJRCwgcC5pc0FsbG93ZWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gdGhpcywgbSA9IHQud2hpdGVsaXN0UGFyZW50RG9tYWluOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAuc3RhdGUgPSB7IEFMTEZJRUxEUzoge30gfSwgcC52ZXJzaW9uID0gbi52ZXJzaW9uLCBwLm1hcmtldGluZ0Nsb3VkT3JnSUQgPSBlLCBwLmNvb2tpZURvbWFpbiA9IG4uY29va2llRG9tYWluIHx8ICcnLCBwLl9pbnN0YW5jZVR5cGUgPSAnY2hpbGQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gITEsIGggPSBuZXcgTChlLCBtKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLmNhbGxiYWNrUmVnaXN0cnkgPSBQKCksIHAuaW5pdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCgpLCBmKCksIGkobmV3IFMocCkpLCBsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcC5maW5kRmllbGQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBwLnN0YXRlW2VdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQocC5zdGF0ZVtlXSksIHAuc3RhdGVbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcC5tZXNzYWdlUGFyZW50ID0gcywgcC5zZXRTdGF0ZUFuZFB1Ymxpc2ggPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgUiA9IEMuTUVTU0FHRVMsIE4gPSBDLkFMTF9BUElTLCBGID0gQy5BU1lOQ19BUElfTUFQLCBCID0gQy5GSUVMREdST1VQX1RPX0ZJRUxELCBVID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoTikuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBOW25dLCBpID0gZVtyXSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVC5pc1ZhbHVlRW1wdHkoaSkgfHwgKHRbbl0gPSBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLl9sb2FkaW5nICYmIE9iamVjdC5rZXlzKGUuX2xvYWRpbmcpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLl9sb2FkaW5nW25dKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBCW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQubGVuZ3RoID8gdCA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IEZbaVswXV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVthXShuLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zZW5kKGUsIHIsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhlKSwgYShlLCBSLkhBTkRTSEFLRSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoZSwgUi5QQVJFTlRTVEFURSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuY2FsbChlLCByKSwgdC5zZW5kKG4sIFIuUEFSRU5UU1RBVEUsIHsgQ1VTVE9NRVJJRFM6IGUuZ2V0Q3VzdG9tZXJJRHMoKSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUuc2V0Q3VzdG9tZXJJRHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc2V0Q3VzdG9tZXJJRHMgPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5pc0ludmFsaWQoZSkgfHwgKHQucGFyc2UoZSkucHJlZml4ID09PSBSLkhBTkRTSEFLRSA/IG8gOiBzKShlLnNvdXJjZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHogPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbZV0gPSBuLCArK2kgPT09IGEgJiYgdChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7fSwgaSA9IDAsIGEgPSBPYmplY3Qua2V5cyhlKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoZSkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLmZuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHIuYXJncyB8fCBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkudW5zaGlmdChuKHQpKSwgci5mbi5hcHBseShyLmNvbnRleHQgfHwgbnVsbCwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZW5jb2RlVVJJQ29tcG9uZW50KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICgnOycgKyBkb2N1bWVudC5jb29raWUpLnNwbGl0KCcgJykuam9pbignOycpLCBuID0gdC5pbmRleE9mKCc7JyArIGUgKyAnPScpLCByID0gbiA8IDAgPyBuIDogdC5pbmRleE9mKCc7JywgbiArIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA8IDAgPyAnJyA6IGRlY29kZVVSSUNvbXBvbmVudCh0LnN1YnN0cmluZyhuICsgMiArIGUubGVuZ3RoLCByIDwgMCA/IHQubGVuZ3RoIDogcikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHIobiwgJ2Nvb2tpZUxpZmV0aW1lJyksIGEgPSByKG4sICdleHBpcmVzJyksIG8gPSByKG4sICdkb21haW4nKSwgcyA9IHIobiwgJ3NlY3VyZScpID8gJ1NlY3VyZScgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEgJiYgJ1NFU1NJT04nICE9PSBpICYmICdOT05FJyAhPT0gaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAnJyAhPT0gdCA/IHBhcnNlSW50KGkgfHwgMCwgMTApIDogLTYwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGEgPSBuZXcgRGF0ZSgpKS5zZXRUaW1lKGEuZ2V0VGltZSgpICsgMTAwMCAqIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoMSA9PT0gYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gKGEgPSBuZXcgRGF0ZSgpKS5nZXRZZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5zZXRZZWFyKHUgKyAyICsgKHUgPCAxOTAwID8gMTkwMCA6IDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ05PTkUnICE9PSBpID8gKGRvY3VtZW50LmNvb2tpZSA9IGVuY29kZVVSSUNvbXBvbmVudChlKSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh0KSArICc7IHBhdGg9LzsnICsgKGEgPyAnIGV4cGlyZXM9JyArIGEudG9HTVRTdHJpbmcoKSArICc7JyA6ICcnKSArIChvID8gJyBkb21haW49JyArIG8gKyAnOycgOiAnJykgKyBzLCB0aGlzLmdldChlKSA9PT0gdCkgOiAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHIodCwgJ2RvbWFpbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbiA/ICcgZG9tYWluPScgKyBuICsgJzsnIDogJycsIGRvY3VtZW50LmNvb2tpZSA9IGVuY29kZVVSSUNvbXBvbmVudChlKSArICc9OyBQYXRoPS87IEV4cGlyZXM9VGh1LCAwMSBKYW4gMTk3MCAwMDowMDowMSBHTVQ7JyArIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWUgJiYgYi5sb2NhdGlvbiAmJiAoZSA9IGIubG9jYXRpb24uaG9zdG5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByID0gKHQgPSBlKS5zcGxpdCgnLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IHIubGVuZ3RoIC0gMjsgbiA+PSAwOyBuLS0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID0gci5zbGljZShuKS5qb2luKCcuJyksIHEuc2V0KCd0ZXN0JywgJ2Nvb2tpZScsIHsgZG9tYWluOiB0IH0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHEucmVtb3ZlKCd0ZXN0JywgeyBkb21haW46IHQgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgVyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wYXJlOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzTGVzc1RoYW46IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzKGUsIHQpIDwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZVZlcnNpb25zRGlmZmVyZW50OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCAhPT0gcyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzR3JlYXRlclRoYW46IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzKGUsIHQpID4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXF1YWw6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwID09PSBzKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEcgPSAhIWIucG9zdE1lc3NhZ2UsIFkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zdE1lc3NhZ2U6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAoRyA/IG4ucG9zdE1lc3NhZ2UoZSwgdC5yZXBsYWNlKC8oW146XSs6XC9cL1teXC9dKykuKi8sICckMScpKSA6IHQgJiYgKG4ubG9jYXRpb24gPSB0LnJlcGxhY2UoLyMuKiQvLCAnJykgKyAnIycgKyArbmV3IERhdGUoKSArIHIrKyArICcmJyArIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlY2VpdmVNZXNzYWdlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEcgJiYgKGUgJiYgKG4gPSBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgdCAmJiBuLm9yaWdpbiAhPT0gdCB8fCAnW29iamVjdCBGdW5jdGlvbl0nID09PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwodCkgJiYgITEgPT09IHQobi5vcmlnaW4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBiLmFkZEV2ZW50TGlzdGVuZXIgPyBiW2UgPyAnYWRkRXZlbnRMaXN0ZW5lcicgOiAncmVtb3ZlRXZlbnRMaXN0ZW5lciddKCdtZXNzYWdlJywgbikgOiBiW2UgPyAnYXR0YWNoRXZlbnQnIDogJ2RldGFjaEV2ZW50J10oJ29ubWVzc2FnZScsIG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgWCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIgPSAnMDEyMzQ1Njc4OScsIGkgPSAnJywgYSA9ICcnLCBvID0gOCwgcyA9IDEwLCBjID0gMTA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgKz0gJ0FCQ0RFRicsIHQgPSAwOyAxNiA+IHQ7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBvKSwgaSArPSByLnN1YnN0cmluZyhuLCBuICsgMSksIG4gPSBNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBvKSwgYSArPSByLnN1YnN0cmluZyhuLCBuICsgMSksIG8gPSAxNjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgKyAnLScgKyBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSAwOyAxOSA+IHQ7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIHMpLCBpICs9IHIuc3Vic3RyaW5nKG4sIG4gKyAxKSwgMCA9PT0gdCAmJiA5ID09IG4gPyBzID0gMyA6ICgoMSA9PSB0IHx8IDIgPT0gdCkgJiYgMTAgIT0gcyAmJiAyID4gbiB8fCAyIDwgdCkgJiYgKHMgPSAxMCksIG4gPSBNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBjKSwgYSArPSByLnN1YnN0cmluZyhuLCBuICsgMSksIDAgPT09IHQgJiYgOSA9PSBuID8gYyA9IDMgOiAoKDEgPT0gdCB8fCAyID09IHQpICYmIDEwICE9IGMgJiYgMiA+IG4gfHwgMiA8IHQpICYmIChjID0gMTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpICsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEsgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnNNZXRhZGF0YTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF80ZmZjZDIyNDM1OGFlZGVlID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JyksICRfX19vbGRfMDAwNGFhMGYyNmQxY2ZhNiA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF80ZmZjZDIyNDM1OGFlZGVlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja18zZDA0OWJjZmVjZjk1ZTg5LlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMDAwNGFhMGYyNmQxY2ZhNikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfM2QwNDliY2ZlY2Y5NWU4OS5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gJ25vbmUnLCB0ID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgWE1MSHR0cFJlcXVlc3QgJiYgWE1MSHR0cFJlcXVlc3QgPT09IE9iamVjdChYTUxIdHRwUmVxdWVzdCkgJiYgKCd3aXRoQ3JlZGVudGlhbHMnIGluIG5ldyBYTUxIdHRwUmVxdWVzdCgpID8gZSA9ICdYTUxIdHRwUmVxdWVzdCcgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgWERvbWFpblJlcXVlc3QgJiYgWERvbWFpblJlcXVlc3QgPT09IE9iamVjdChYRG9tYWluUmVxdWVzdCkgJiYgKHQgPSAhMSksIE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChiLkhUTUxFbGVtZW50KS5pbmRleE9mKCdDb25zdHJ1Y3RvcicpID4gMCAmJiAodCA9ICExKSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnNUeXBlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yc0Nvb2tpZXNFbmFibGVkOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF80ZmZjZDIyNDM1OGFlZGVlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzRmZmNkMjI0MzU4YWVkZWUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8wMDA0YWEwZjI2ZDFjZmE2KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzAwMDRhYTBmMjZkMWNmYTYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDT1JTSW5zdGFuY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfMzdjZDkzY2RiNmE5NWM5ZiA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpLCAkX19fb2xkXzIyNzBmMjc5YzVjMjg5NmYgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMzdjZDkzY2RiNmE5NWM5ZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfM2QwNDliY2ZlY2Y5NWU4OS5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzIyNzBmMjc5YzVjMjg5NmYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzNkMDQ5YmNmZWNmOTVlODkuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ25vbmUnID09PSB0aGlzLmNvcnNNZXRhZGF0YS5jb3JzVHlwZSA/IG51bGwgOiBuZXcgYlt0aGlzLmNvcnNNZXRhZGF0YS5jb3JzVHlwZV0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzM3Y2Q5M2NkYjZhOTVjOWYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfMzdjZDkzY2RiNmE5NWM5ZikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzIyNzBmMjc5YzVjMjg5NmYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfMjI3MGYyNzljNWMyODk2ZikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJlQ09SUzogZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgobiA9IEpTT04ucGFyc2UoZSkpICE9PSBPYmplY3QobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBpLmhhbmRsZUNPUlNFcnJvcih0LCBudWxsLCAnUmVzcG9uc2UgaXMgbm90IEpTT04nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGkuaGFuZGxlQ09SU0Vycm9yKHQsIGUsICdFcnJvciBwYXJzaW5nIHJlc3BvbnNlIGFzIEpTT04nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IHQuY2FsbGJhY2ssIGEgPSBiLCBvID0gMDsgbyA8IHIubGVuZ3RoOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gYVtyW29dXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuaGFuZGxlQ09SU0Vycm9yKHQsIGUsICdFcnJvciBmb3JtaW5nIGNhbGxiYWNrIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiAodC5sb2FkRXJyb3JIYW5kbGVyID0gbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5nZXRDT1JTSW5zdGFuY2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLm9wZW4oJ2dldCcsIHQuY29yc1VybCArICcmdHM9JyArIG5ldyBEYXRlKCkuZ2V0VGltZSgpLCAhMCksICdYTUxIdHRwUmVxdWVzdCcgPT09IHRoaXMuY29yc01ldGFkYXRhLmNvcnNUeXBlICYmIChhLndpdGhDcmVkZW50aWFscyA9ICEwLCBhLnRpbWVvdXQgPSBlLmxvYWRUaW1lb3V0LCBhLnNldFJlcXVlc3RIZWFkZXIoJ0NvbnRlbnQtVHlwZScsICdhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQnKSwgYS5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQgPT09IHRoaXMucmVhZHlTdGF0ZSAmJiAyMDAgPT09IHRoaXMuc3RhdHVzICYmIHIodGhpcy5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhLm9uZXJyb3IgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmhhbmRsZUNPUlNFcnJvcih0LCBlLCAnb25lcnJvcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEub250aW1lb3V0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5oYW5kbGVDT1JTRXJyb3IodCwgZSwgJ29udGltZW91dCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEuc2VuZCgpLCBlLl9sb2cucmVxdWVzdHMucHVzaCh0LmNvcnNVcmwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaGFuZGxlQ09SU0Vycm9yKHQsIGUsICd0cnktY2F0Y2gnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlQ09SU0Vycm9yOiBmdW5jdGlvbiAodCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5DT1JTRXJyb3JzLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnNEYXRhOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uOiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5sb2FkRXJyb3JIYW5kbGVyICYmICgnb250aW1lb3V0JyA9PT0gciA/IHQubG9hZEVycm9ySGFuZGxlcighMCkgOiB0LmxvYWRFcnJvckhhbmRsZXIoITEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBRID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBPU1RfTUVTU0FHRV9FTkFCTEVEOiAhIWIucG9zdE1lc3NhZ2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREFZU19CRVRXRUVOX1NZTkNfSURfQ0FMTFM6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUlMTElTX1BFUl9EQVk6IDg2NDAwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFET0JFX01DOiAnYWRvYmVfbWMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFET0JFX01DX1NESUQ6ICdhZG9iZV9tY19zZGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWQUxJRF9WSVNJVE9SX0lEX1JFR0VYOiAvXlswLTlhLWZBLUZcLV0rJC8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQURPQkVfTUNfVFRMX0lOX01JTjogNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWRVJTSU9OX1JFR0VYOiAvdlZlcnNpb25cfCgoXGQrXC4pPyhcZCtcLik/KFwqfFxkKykpKD89JHxcfCkvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZJUlNUX1BBUlRZX1NFUlZFUl9DT09LSUU6ICdzX2VjaWQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAkID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGIuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEhST1RUTEVfU1RBUlQ6IDMwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQVhfU1lOQ1NfTEVOR1RIOiA2NDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm90dGxlVGltZXJTZXQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25QYWdlUGl4ZWxzOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyYW1lSG9zdDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SWZyYW1lSG9zdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5zcGxpdCgnLycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0WzBdICsgJy8vJyArIHRbMl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YmRvbWFpbjogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRVcmw6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCByID0gJ2h0dHA6Ly9mYXN0LicsIGkgPSAnP2RfbnNpZD0nICsgZS5pZFN5bmNDb250YWluZXJJRCArICcjJyArIGVuY29kZVVSSUNvbXBvbmVudChuLmxvY2F0aW9uLm9yaWdpbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdWJkb21haW4gfHwgKHRoaXMuc3ViZG9tYWluID0gJ25vc3ViZG9tYWlucmV0dXJuZWQnKSwgZS5sb2FkU1NMICYmIChyID0gZS5pZFN5bmNTU0xVc2VBa2FtYWkgPyAnaHR0cHM6Ly9mYXN0LicgOiAnaHR0cHM6Ly8nKSwgdCA9IHIgKyB0aGlzLnN1YmRvbWFpbiArICcuZGVtZGV4Lm5ldC9kZXN0NS5odG1sJyArIGksIHRoaXMuaWZyYW1lSG9zdCA9IHRoaXMuZ2V0SWZyYW1lSG9zdCh0KSwgdGhpcy5pZCA9ICdkZXN0aW5hdGlvbl9wdWJsaXNoaW5nX2lmcmFtZV8nICsgdGhpcy5zdWJkb21haW4gKyAnXycgKyBlLmlkU3luY0NvbnRhaW5lcklELCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGVja0RQSWZyYW1lU3JjOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICc/ZF9uc2lkPScgKyBlLmlkU3luY0NvbnRhaW5lcklEICsgJyMnICsgZW5jb2RlVVJJQ29tcG9uZW50KG4ubG9jYXRpb24uaHJlZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PSB0eXBlb2YgZS5kcElmcmFtZVNyYyAmJiBlLmRwSWZyYW1lU3JjLmxlbmd0aCAmJiAodGhpcy5pZCA9ICdkZXN0aW5hdGlvbl9wdWJsaXNoaW5nX2lmcmFtZV8nICsgKGUuX3N1YmRvbWFpbiB8fCB0aGlzLnN1YmRvbWFpbiB8fCBuZXcgRGF0ZSgpLmdldFRpbWUoKSkgKyAnXycgKyBlLmlkU3luY0NvbnRhaW5lcklELCB0aGlzLmlmcmFtZUhvc3QgPSB0aGlzLmdldElmcmFtZUhvc3QoZS5kcElmcmFtZVNyYyksIHRoaXMudXJsID0gZS5kcElmcmFtZVNyYyArIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZENhbGxOb3RQcm9jZXNzc2VkOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb0F0dGFjaElmcmFtZTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ZWRBdHRhY2hpbmdJZnJhbWU6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZnJhbWVIYXNMb2FkZWQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmcmFtZUlkQ2hhbmdlZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3SWZyYW1lQ3JlYXRlZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3JpZ2luYWxJZnJhbWVIYXNMb2FkZWRBbHJlYWR5OiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZnJhbWVMb2FkZWRDYWxsYmFja3M6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpb25DaGFuZ2VkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZXNSZWdpb25DaGFuZ2VkOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kaW5nTWVzc2FnZXM6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2VzUG9zdGVkOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZXNSZWNlaXZlZDogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2VTZW5kaW5nSW50ZXJ2YWw6IFEuUE9TVF9NRVNTQUdFX0VOQUJMRUQgPyBudWxsIDogMTAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvblBhZ2VEZXN0aW5hdGlvbnNGaXJlZDogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb25Gb3JDb21wYXJpc29uOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbkR1cGxpY2F0ZXM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uV2FpdGluZzogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb25Qcm9jZXNzZWQ6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW5TZXRUaGlyZFBhcnR5Q29va2llczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlY2VpdmVkVGhpcmRQYXJ0eUNvb2tpZXNOb3RpZmljYXRpb246ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkeVRvQXR0YWNoSWZyYW1lUHJlbGltaW5hcnk6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKGUuaWRTeW5jRGlzYWJsZVN5bmNzIHx8IGUuZGlzYWJsZUlkU3luY3MgfHwgZS5pZFN5bmNEaXNhYmxlM3JkUGFydHlTeW5jaW5nIHx8IGUuZGlzYWJsZVRoaXJkUGFydHlDb29raWVzIHx8IGUuZGlzYWJsZVRoaXJkUGFydHlDYWxscyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYWR5VG9BdHRhY2hJZnJhbWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJlYWR5VG9BdHRhY2hJZnJhbWVQcmVsaW1pbmFyeSgpICYmICh0aGlzLmRvQXR0YWNoSWZyYW1lIHx8IGUuX2RvQXR0YWNoSWZyYW1lKSAmJiAodGhpcy5zdWJkb21haW4gJiYgJ25vc3ViZG9tYWlucmV0dXJuZWQnICE9PSB0aGlzLnN1YmRvbWFpbiB8fCBlLl9zdWJkb21haW4pICYmIHRoaXMudXJsICYmICF0aGlzLnN0YXJ0ZWRBdHRhY2hpbmdJZnJhbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0dGFjaElmcmFtZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaSA9IG4uY3JlYXRlRWxlbWVudCgnaWZyYW1lJykpLnNhbmRib3ggPSAnYWxsb3ctc2NyaXB0cyBhbGxvdy1zYW1lLW9yaWdpbicsIGkudGl0bGUgPSAnQWRvYmUgSUQgU3luY2luZyBpRnJhbWUnLCBpLmlkID0gci5pZCwgaS5uYW1lID0gci5pZCArICdfbmFtZScsIGkuc3R5bGUuY3NzVGV4dCA9ICdkaXNwbGF5OiBub25lOyB3aWR0aDogMDsgaGVpZ2h0OiAwOycsIGkuc3JjID0gci51cmwsIHIubmV3SWZyYW1lQ3JlYXRlZCA9ICEwLCB0KCksIG4uYm9keS5hcHBlbmRDaGlsZChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5jbGFzc05hbWUgPSAnYWFtSWZyYW1lTG9hZGVkJywgci5pZnJhbWVIYXNMb2FkZWQgPSAhMCwgci5maXJlSWZyYW1lTG9hZGVkQ2FsbGJhY2tzKGUpLCByLnJlcXVlc3RUb1Byb2Nlc3MoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhcnRlZEF0dGFjaGluZ0lmcmFtZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzLCBpID0gbi5nZXRFbGVtZW50QnlJZCh0aGlzLmlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPyAnSUZSQU1FJyAhPT0gaS5ub2RlTmFtZSA/ICh0aGlzLmlkICs9ICdfMicsIHRoaXMuaWZyYW1lSWRDaGFuZ2VkID0gITAsIGUoKSkgOiAodGhpcy5uZXdJZnJhbWVDcmVhdGVkID0gITEsICdhYW1JZnJhbWVMb2FkZWQnICE9PSBpLmNsYXNzTmFtZSA/ICh0aGlzLm9yaWdpbmFsSWZyYW1lSGFzTG9hZGVkQWxyZWFkeSA9ICExLCB0KCdUaGUgZGVzdGluYXRpb24gcHVibGlzaGluZyBpZnJhbWUgYWxyZWFkeSBleGlzdHMgZnJvbSBhIGRpZmZlcmVudCBsaWJyYXJ5LCBidXQgaGFkblwndCBsb2FkZWQgeWV0LicpKSA6ICh0aGlzLm9yaWdpbmFsSWZyYW1lSGFzTG9hZGVkQWxyZWFkeSA9ICEwLCB0aGlzLmlmcmFtZUhhc0xvYWRlZCA9ICEwLCB0aGlzLmlmcmFtZSA9IGksIHRoaXMuZmlyZUlmcmFtZUxvYWRlZENhbGxiYWNrcygnVGhlIGRlc3RpbmF0aW9uIHB1Ymxpc2hpbmcgaWZyYW1lIGFscmVhZHkgZXhpc3RzIGZyb20gYSBkaWZmZXJlbnQgbGlicmFyeSwgYW5kIGhhZCBsb2FkZWQgYWxyZXNhZHkuJyksIHRoaXMucmVxdWVzdFRvUHJvY2VzcygpKSkgOiBlKCksIHRoaXMuaWZyYW1lID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyZUlmcmFtZUxvYWRlZENhbGxiYWNrczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaWZyYW1lTG9hZGVkQ2FsbGJhY2tzLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiB0ICYmIHQoeyBtZXNzYWdlOiBlIHx8ICdUaGUgZGVzdGluYXRpb24gcHVibGlzaGluZyBpZnJhbWUgd2FzIGF0dGFjaGVkIGFuZCBsb2FkZWQgc3VjY2Vzc2Z1bGx5LicgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5pZnJhbWVMb2FkZWRDYWxsYmFja3MgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdFRvUHJvY2VzczogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5qc29uRm9yQ29tcGFyaXNvbi5wdXNoKHQpLCBpLmpzb25XYWl0aW5nLnB1c2godCksIGkucHJvY2Vzc1N5bmNPblBhZ2UodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgaSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9PT0gT2JqZWN0KHQpICYmIHQuaWJzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyID0gSlNPTi5zdHJpbmdpZnkodC5pYnMgfHwgW10pLCB0aGlzLmpzb25Gb3JDb21wYXJpc29uLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgbywgcywgYyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgPSAwLCBvID0gdGhpcy5qc29uRm9yQ29tcGFyaXNvbi5sZW5ndGg7IGEgPCBvOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocyA9IHRoaXMuanNvbkZvckNvbXBhcmlzb25bYV0sIHIgPT09IEpTT04uc3RyaW5naWZ5KHMuaWJzIHx8IFtdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA/IHRoaXMuanNvbkR1cGxpY2F0ZXMucHVzaCh0KSA6IG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0aGlzLnJlY2VpdmVkVGhpcmRQYXJ0eUNvb2tpZXNOb3RpZmljYXRpb24gfHwgIVEuUE9TVF9NRVNTQUdFX0VOQUJMRUQgfHwgdGhpcy5pZnJhbWVIYXNMb2FkZWQpICYmIHRoaXMuanNvbldhaXRpbmcubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSB0aGlzLmpzb25XYWl0aW5nLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzKHUpLCB0aGlzLnJlcXVlc3RUb1Byb2Nlc3MoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaWRTeW5jRGlzYWJsZVN5bmNzIHx8IGUuZGlzYWJsZUlkU3luY3MgfHwgIXRoaXMuaWZyYW1lSGFzTG9hZGVkIHx8ICF0aGlzLm1lc3NhZ2VzLmxlbmd0aCB8fCB0aGlzLnNlbmRpbmdNZXNzYWdlcyB8fCAodGhpcy50aHJvdHRsZVRpbWVyU2V0IHx8ICh0aGlzLnRocm90dGxlVGltZXJTZXQgPSAhMCwgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5tZXNzYWdlU2VuZGluZ0ludGVydmFsID0gUS5QT1NUX01FU1NBR0VfRU5BQkxFRCA/IG51bGwgOiAxNTA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLlRIUk9UVExFX1NUQVJUKSksIHRoaXMuc2VuZGluZ01lc3NhZ2VzID0gITAsIHRoaXMuc2VuZE1lc3NhZ2VzKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRSZWdpb25BbmRDaGVja0lmQ2hhbmdlZDogZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5fZ2V0RmllbGQoJ01DQUFNTEgnKSwgaSA9IHQuZF9yZWdpb24gfHwgdC5kY3NfcmVnaW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPyBpICYmIChlLl9zZXRGaWVsZEV4cGlyZSgnTUNBQU1MSCcsIG4pLCBlLl9zZXRGaWVsZCgnTUNBQU1MSCcsIGkpLCBwYXJzZUludChyLCAxMCkgIT09IGkgJiYgKHRoaXMucmVnaW9uQ2hhbmdlZCA9ICEwLCB0aGlzLnRpbWVzUmVnaW9uQ2hhbmdlZCsrLCBlLl9zZXRGaWVsZCgnTUNTWU5DU09QJywgJycpLCBlLl9zZXRGaWVsZCgnTUNTWU5DUycsICcnKSwgciA9IGkpKSA6IChyID0gaSkgJiYgKGUuX3NldEZpZWxkRXhwaXJlKCdNQ0FBTUxIJywgbiksIGUuX3NldEZpZWxkKCdNQ0FBTUxIJywgcikpLCByIHx8IChyID0gJycpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzU3luY09uUGFnZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0ID0gZS5pYnMpICYmIHQgaW5zdGFuY2VvZiBBcnJheSAmJiAobiA9IHQubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgbjsgcisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaSA9IHRbcl0pLnN5bmNPblBhZ2UgJiYgdGhpcy5jaGVja0ZpcnN0UGFydHlDb29raWUoaSwgJycsICdzeW5jT25QYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2Nlc3M6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgciwgaSwgYSwgbyA9IGVuY29kZVVSSUNvbXBvbmVudCwgcyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0ID0gZS5pYnMpICYmIHQgaW5zdGFuY2VvZiBBcnJheSAmJiAobiA9IHQubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHMgPSAhMCwgciA9IDA7IHIgPCBuOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSB0W3JdLCBhID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbygnaWJzJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKGkuaWQgfHwgJycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyhpLnRhZyB8fCAnJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBULmVuY29kZUFuZEJ1aWxkUmVxdWVzdChpLnVybCB8fCBbXSwgJywnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8oaS50dGwgfHwgJycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuZmlyZVVSTFN5bmMgPyAndHJ1ZScgOiAnZmFsc2UnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIGkuc3luY09uUGFnZSB8fCAodGhpcy5jYW5TZXRUaGlyZFBhcnR5Q29va2llcyA/IHRoaXMuYWRkTWVzc2FnZShhLmpvaW4oJ3wnKSkgOiBpLmZpcmVVUkxTeW5jICYmIHRoaXMuY2hlY2tGaXJzdFBhcnR5Q29va2llKGksIGEuam9pbignfCcpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzICYmIHRoaXMuanNvblByb2Nlc3NlZC5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGVja0ZpcnN0UGFydHlDb29raWU6IGZ1bmN0aW9uICh0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9ICdzeW5jT25QYWdlJyA9PT0gciwgYSA9IGkgPyAnTUNTWU5DU09QJyA6ICdNQ1NZTkNTJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX3JlYWRWaXNpdG9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbywgcywgYyA9IGUuX2dldEZpZWxkKGEpLCB1ID0gITEsIGwgPSAhMSwgZCA9IE1hdGguY2VpbChuZXcgRGF0ZSgpLmdldFRpbWUoKSAvIFEuTUlMTElTX1BFUl9EQVkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA/IChvID0gYy5zcGxpdCgnKicpLCB1ID0gKHMgPSB0aGlzLnBydW5lU3luY0RhdGEobywgdC5pZCwgZCkpLmRhdGFQcmVzZW50LCBsID0gcy5kYXRhVmFsaWQsIHUgJiYgbCB8fCB0aGlzLmZpcmVTeW5jKGksIHQsIG4sIG8sIGEsIGQpKSA6IChvID0gW10sIHRoaXMuZmlyZVN5bmMoaSwgdCwgbiwgbywgYSwgZCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcnVuZVN5bmNEYXRhOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIGksIGEsIG8gPSAhMSwgcyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGUubGVuZ3RoOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IGVbaV0sIGEgPSBwYXJzZUludChyLnNwbGl0KCctJylbMV0sIDEwKSwgci5tYXRjaCgnXicgKyB0ICsgJy0nKSA/IChvID0gITAsIG4gPCBhID8gcyA9ICEwIDogKGUuc3BsaWNlKGksIDEpLCBpLS0pKSA6IG4gPj0gYSAmJiAoZS5zcGxpY2UoaSwgMSksIGktLSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFQcmVzZW50OiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFWYWxpZDogcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFuYWdlU3luY3NTaXplOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuam9pbignKicpLmxlbmd0aCA+IHRoaXMuTUFYX1NZTkNTX0xFTkdUSCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUuc29ydChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlSW50KGUuc3BsaXQoJy0nKVsxXSwgMTApIC0gcGFyc2VJbnQodC5zcGxpdCgnLScpWzFdLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOyBlLmpvaW4oJyonKS5sZW5ndGggPiB0aGlzLk1BWF9TWU5DU19MRU5HVEg7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpcmVTeW5jOiBmdW5jdGlvbiAodCwgbiwgciwgaSwgYSwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2ltZycgPT09IG4udGFnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjLCB1LCBsLCBkLCBmID0gbi51cmwsIHAgPSBlLmxvYWRTU0wgPyAnaHR0cHM6JyA6ICdodHRwOic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYyA9IDAsIHUgPSBmLmxlbmd0aDsgYyA8IHU7IGMrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGZbY10sIGQgPSAvXlwvXC8vLnRlc3QobCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IG5ldyBJbWFnZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbS5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgZnVuY3Rpb24gKHQsIG4sIHIsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLm9uUGFnZVBpeGVsc1t0XSA9IG51bGwsIGUuX3JlYWRWaXNpdG9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvLCBjLCB1LCBsLCBkID0gZS5fZ2V0RmllbGQoYSksIGYgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSAwLCB1ID0gKG8gPSBkLnNwbGl0KCcqJykpLmxlbmd0aDsgYyA8IHU7IGMrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobCA9IG9bY10pLm1hdGNoKCdeJyArIG4uaWQgKyAnLScpIHx8IGYucHVzaChsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5zZXRTeW5jVHJhY2tpbmdEYXRhKGYsIG4sIHIsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHRoaXMub25QYWdlUGl4ZWxzLmxlbmd0aCwgbiwgYSwgbykpLCBtLnNyYyA9IChkID8gcCA6ICcnKSArIGwsIHRoaXMub25QYWdlUGl4ZWxzLnB1c2gobSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZE1lc3NhZ2UociksIHRoaXMuc2V0U3luY1RyYWNraW5nRGF0YShpLCBuLCBhLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkTWVzc2FnZTogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZW5jb2RlVVJJQ29tcG9uZW50KGUuX2VuYWJsZUVycm9yUmVwb3J0aW5nID8gJy0tLWRlc3RwdWItZGVidWctLS0nIDogJy0tLWRlc3RwdWItLS0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubWVzc2FnZXMucHVzaCgoUS5QT1NUX01FU1NBR0VfRU5BQkxFRCA/ICcnIDogbikgKyB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U3luY1RyYWNraW5nRGF0YTogZnVuY3Rpb24gKHQsIG4sIHIsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChuLmlkICsgJy0nICsgKGkgKyBNYXRoLmNlaWwobi50dGwgLyA2MCAvIDI0KSkpLCB0aGlzLm1hbmFnZVN5bmNzU2l6ZSh0KSwgZS5fc2V0RmllbGQociwgdC5qb2luKCcqJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZXM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0ID0gdGhpcywgbiA9ICcnLCByID0gZW5jb2RlVVJJQ29tcG9uZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWdpb25DaGFuZ2VkICYmIChuID0gcignLS0tZGVzdHB1Yi1jbGVhci1kZXh0cC0tLScpLCB0aGlzLnJlZ2lvbkNoYW5nZWQgPSAhMSksIHRoaXMubWVzc2FnZXMubGVuZ3RoID8gUS5QT1NUX01FU1NBR0VfRU5BQkxFRCA/IChlID0gbiArIHIoJy0tLWRlc3RwdWItY29tYmluZWQtLS0nKSArIHRoaXMubWVzc2FnZXMuam9pbignJTAxJyksIHRoaXMucG9zdE1lc3NhZ2UoZSksIHRoaXMubWVzc2FnZXMgPSBbXSwgdGhpcy5zZW5kaW5nTWVzc2FnZXMgPSAhMSkgOiAoZSA9IHRoaXMubWVzc2FnZXMuc2hpZnQoKSwgdGhpcy5wb3N0TWVzc2FnZShuICsgZSksIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2VuZE1lc3NhZ2VzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLm1lc3NhZ2VTZW5kaW5nSW50ZXJ2YWwpKSA6IHRoaXMuc2VuZGluZ01lc3NhZ2VzID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvc3RNZXNzYWdlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWS5wb3N0TWVzc2FnZShlLCB0aGlzLnVybCwgdGhpcy5pZnJhbWUuY29udGVudFdpbmRvdyksIHRoaXMubWVzc2FnZXNQb3N0ZWQucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZU1lc3NhZ2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IC9eLS0tZGVzdHB1Yi10by1wYXJlbnQtLS0vOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgbi50ZXN0KGUpICYmICgnY2FuU2V0VGhpcmRQYXJ0eUNvb2tpZXMnID09PSAodCA9IGUucmVwbGFjZShuLCAnJykuc3BsaXQoJ3wnKSlbMF0gJiYgKHRoaXMuY2FuU2V0VGhpcmRQYXJ0eUNvb2tpZXMgPSAndHJ1ZScgPT09IHRbMV0sIHRoaXMucmVjZWl2ZWRUaGlyZFBhcnR5Q29va2llc05vdGlmaWNhdGlvbiA9ICEwLCB0aGlzLnJlcXVlc3RUb1Byb2Nlc3MoKSksIHRoaXMubWVzc2FnZXNSZWNlaXZlZC5wdXNoKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0lEQ2FsbERhdGE6IGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobnVsbCA9PSB0aGlzLnVybCB8fCByLnN1YmRvbWFpbiAmJiAnbm9zdWJkb21haW5yZXR1cm5lZCcgPT09IHRoaXMuc3ViZG9tYWluKSAmJiAoJ3N0cmluZycgPT0gdHlwZW9mIGUuX3N1YmRvbWFpbiAmJiBlLl9zdWJkb21haW4ubGVuZ3RoID8gdGhpcy5zdWJkb21haW4gPSBlLl9zdWJkb21haW4gOiB0aGlzLnN1YmRvbWFpbiA9IHIuc3ViZG9tYWluIHx8ICcnLCB0aGlzLnVybCA9IHRoaXMuZ2V0VXJsKCkpLCByLmlicyBpbnN0YW5jZW9mIEFycmF5ICYmIHIuaWJzLmxlbmd0aCAmJiAodGhpcy5kb0F0dGFjaElmcmFtZSA9ICEwKSwgdGhpcy5yZWFkeVRvQXR0YWNoSWZyYW1lKCkgJiYgKGUuaWRTeW5jQXR0YWNoSWZyYW1lT25XaW5kb3dMb2FkID8gKHQud2luZG93TG9hZGVkIHx8ICdjb21wbGV0ZScgPT09IG4ucmVhZHlTdGF0ZSB8fCAnbG9hZGVkJyA9PT0gbi5yZWFkeVN0YXRlKSAmJiB0aGlzLmF0dGFjaElmcmFtZSgpIDogdGhpcy5hdHRhY2hJZnJhbWVBU0FQKCkpLCAnZnVuY3Rpb24nID09IHR5cGVvZiBlLmlkU3luY0lEQ2FsbFJlc3VsdCA/IGUuaWRTeW5jSURDYWxsUmVzdWx0KHIpIDogdGhpcy5yZXF1ZXN0VG9Qcm9jZXNzKHIpLCAnZnVuY3Rpb24nID09IHR5cGVvZiBlLmlkU3luY0FmdGVySURDYWxsUmVzdWx0ICYmIGUuaWRTeW5jQWZ0ZXJJRENhbGxSZXN1bHQocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbk1ha2VTeW5jSURDYWxsOiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuX2ZvcmNlU3luY0lEQ2FsbCB8fCAhdCB8fCBuIC0gdCA+IFEuREFZU19CRVRXRUVOX1NZTkNfSURfQ0FMTFM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0dGFjaElmcmFtZUFTQVA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zdGFydGVkQXR0YWNoaW5nSWZyYW1lIHx8IChuLmJvZHkgPyB0LmF0dGFjaElmcmFtZSgpIDogc2V0VGltZW91dChlLCAzMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEogPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaWVuY2VNYW5hZ2VyU2VydmVyOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpZW5jZU1hbmFnZXJTZXJ2ZXJTZWN1cmU6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZURvbWFpbjoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llTGlmZXRpbWU6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZU5hbWU6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvZXNPcHRJbkFwcGx5OiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNhYmxlVGhpcmRQYXJ0eUNhbGxzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNjYXJkVHJhY2tpbmdTZXJ2ZXJFQ0lEOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNBZnRlcklEQ2FsbFJlc3VsdDoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWRTeW5jQXR0YWNoSWZyYW1lT25XaW5kb3dMb2FkOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNDb250YWluZXJJRDoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWRTeW5jRGlzYWJsZTNyZFBhcnR5U3luY2luZzoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzYWJsZVRoaXJkUGFydHlDb29raWVzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNEaXNhYmxlU3luY3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc2FibGVJZFN5bmNzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNJRENhbGxSZXN1bHQ6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkU3luY1NTTFVzZUFrYW1haToge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNDb29wU2FmZToge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNJYWJDb250ZXh0OiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc09wdEluU3RvcmFnZUVuYWJsZWQ6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvYWRTU0w6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvYWRUaW1lb3V0OiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJrZXRpbmdDbG91ZFNlcnZlcjoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFya2V0aW5nQ2xvdWRTZXJ2ZXJTZWN1cmU6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdEluQ29va2llRG9tYWluOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRJblN0b3JhZ2VFeHBpcnk6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJ3cml0ZUNyb3NzRG9tYWluTUNJREFuZEFJRDoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlT3B0SW5BcHByb3ZhbHM6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZXZpb3VzUGVybWlzc2lvbnM6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc2V0QmVmb3JlVmVyc2lvbjoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2RpZFBhcmFtRXhwaXJ5OiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJTdGF0ZToge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbkNvb2tpZU5hbWU6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY3VyZUNvb2tpZToge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFrZVRpbWVvdXRNZXRyaWNzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2luZ1NlcnZlcjoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tpbmdTZXJ2ZXJTZWN1cmU6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaXRlbGlzdElmcmFtZURvbWFpbnM6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaXRlbGlzdFBhcmVudERvbWFpbjoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFogPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29uZmlnTmFtZXM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKEopOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29uZmlnczogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vcm1hbGl6ZUNvbmZpZzogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgIT0gdHlwZW9mIGUgPyBlIDogZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm9uID0gZnVuY3Rpb24gKGUsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFuIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1tPTl0gQ2FsbGJhY2sgc2hvdWxkIGJlIGEgZnVuY3Rpb24uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkoZSkgfHwgKHRbZV0gPSBbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdFtlXS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSAtIDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W2VdLnNwbGljZShpLCAxKSwgdFtlXS5sZW5ndGggfHwgZGVsZXRlIHRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5vZmYgPSBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KGUpICYmICh0W2VdID0gdFtlXS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmNhbGxiYWNrICE9PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wdWJsaXNoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuaGFzT3duUHJvcGVydHkoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gW10uc2xpY2UuY2FsbChhcmd1bWVudHMsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtlXS5zbGljZSgwKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jYWxsYmFjay5hcHBseShlLmNvbnRleHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnB1Ymxpc2g7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0ZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQRU5ESU5HOiAncGVuZGluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBTkdFRDogJ2NoYW5nZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENPTVBMRVRFOiAnY29tcGxldGUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBQU06ICdhYW0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFEQ0xPVUQ6ICdhZGNsb3VkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTkFMWVRJQ1M6ICdhYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0FNUEFJR046ICdjYW1wYWlnbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRUNJRDogJ2VjaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExJVkVGWVJFOiAnbGl2ZWZ5cmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRBUkdFVDogJ3RhcmdldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUVESUFfQU5BTFlUSUNTOiAnbWVkaWFhYScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHJlID0gKHQoeSA9IHt9LCBuZS5BQU0sIDU2NSksIHQoeSwgbmUuRUNJRCwgNTY1KSwgeSksIGllID0gKHQoXyA9IHt9LCBuZS5BQU0sIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgdChfLCBuZS5FQ0lELCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIF8pLCBhZSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndmlkZW9hYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2lhYkNvbnNlbnRIYXNoJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgb2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhlKS5tYXAoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG5lKSwgc2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jYWxsYmFja3MgPSBPYmplY3QuY3JlYXRlKG51bGwpLCBlLmFkZCA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdShuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignW2NhbGxiYWNrUmVnaXN0cnlGYWN0b3J5XSBNYWtlIHN1cmUgY2FsbGJhY2sgaXMgYSBmdW5jdGlvbiBvciBhbiBhcnJheSBvZiBmdW5jdGlvbnMuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbGJhY2tzW3RdID0gZS5jYWxsYmFja3NbdF0gfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5jYWxsYmFja3NbdF0ucHVzaChuKSAtIDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmNhbGxiYWNrc1t0XS5zcGxpY2UociwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5leGVjdXRlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuY2FsbGJhY2tzW3RdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gKG4gPSB2b2lkIDAgPT09IG4gPyBbXSA6IG4pIGluc3RhbmNlb2YgQXJyYXkgPyBuIDogW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZS5jYWxsYmFja3NbdF0ubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuY2FsbGJhY2tzW3RdLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT0gdHlwZW9mIHIgPyByLmFwcGx5KG51bGwsIG4pIDogciBpbnN0YW5jZW9mIEFycmF5ICYmIHJbMV0uYXBwbHkoclswXSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBlLmNhbGxiYWNrc1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZXhlY3V0ZUFsbCA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChuIHx8IHQgJiYgIWModCkpICYmIE9iamVjdC5rZXlzKGUuY2FsbGJhY2tzKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHZvaWQgMCAhPT0gdFtuXSA/IHRbbl0gOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhlY3V0ZShuLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5oYXNDYWxsYmFja3MgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCb29sZWFuKE9iamVjdC5rZXlzKGUuY2FsbGJhY2tzKS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBjZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHVlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHdpbmRvdy5jb25zb2xlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXQgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGxlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbigpID8gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodWUoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBhcmd1bWVudHMubGVuZ3RoLCByID0gbmV3IEFycmF5KG4pLCBpID0gMDsgaSA8IG47IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByW2ldID0gYXJndW1lbnRzW2ldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZVtlXS5hcHBseShjb25zb2xlLCBbdF0uY29uY2F0KHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBjZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGRlID0gbCwgZmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IFtdLCB0ID0gMDsgdCA8IDI1NjsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSB0LCByID0gMDsgciA8IDg7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAxICYgbiA/IDM5ODgyOTIzODQgXiBuID4+PiAxIDogbiA+Pj4gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wdXNoKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHVuZXNjYXBlKGVuY29kZVVSSUNvbXBvbmVudCh0KSksIG4gfHwgKG4gPSAwKSwgbiBePSAtMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IDA7IHIgPCB0Lmxlbmd0aDsgcisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IDI1NSAmIChuIF4gdC5jaGFyQ29kZUF0KHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBuID4+PiA4IF4gZVtpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG4gXj0gLTEpID4+PiAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIHBlID0gbmV3IGRlKCdbQURPQkUgT1BULUlOXScpLCBtZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodCkgPT09IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBnZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgaW5zdGFuY2VvZiBBcnJheSA/IGUgOiBtZShlLCAnc3RyaW5nJykgPyBbZV0gOiB0IHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0LmtleXMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhdC5sZW5ndGggJiYgdC5ldmVyeShmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSAmJiBhcmd1bWVudHNbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIWUgfHwgX2UoZSkpICYmIGdlKGUpLmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvZS5pbmRleE9mKGUpID4gLTEgfHwgdCAmJiBhZS5pbmRleE9mKGUpID4gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBiZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVkdWNlKGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW25dID0gdCwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04ucGFyc2UoSlNPTi5zdHJpbmdpZnkoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgX2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnW29iamVjdCBBcnJheV0nID09PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoZSkgJiYgIWUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgQ2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3ZShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04ucGFyc2UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGUgfHwgKHdlKGUpID8gdmUoT2JqZWN0LmtleXMoZSksICEwKSA6IGtlKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGtlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEpTT04ucGFyc2UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWUgJiYgbWUoZSwgJ3N0cmluZycpICYmIHZlKE9iamVjdC5rZXlzKHQpLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgd2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmIG1lKGUsICdvYmplY3QnKSAmJiAhMSA9PT0gQXJyYXkuaXNBcnJheShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEVlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtZShlLCAnZnVuY3Rpb24nKSA/IGUoKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBEZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeGUoZSkgfHwgcGUuZXJyb3IoJycuY29uY2F0KHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEFlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSkubWFwKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgU2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShlKS5maWx0ZXIoZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uaW5kZXhPZihlKSA9PT0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFRlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30sIG4gPSB0LmNvbW1hbmQsIHIgPSB0LnBhcmFtcywgaSA9IHZvaWQgMCA9PT0gciA/IHt9IDogciwgYSA9IHQuY2FsbGJhY2ssIG8gPSB2b2lkIDAgPT09IGEgPyBFZSA6IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbiB8fCAtMSA9PT0gbi5pbmRleE9mKCcuJykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1tPcHRJbi5leGVjdXRlXSBQbGVhc2UgcHJvdmlkZSBhIHZhbGlkIGNvbW1hbmQuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG4uc3BsaXQoJy4nKSwgYyA9IGVbc1swXV0sIHUgPSBzWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIGNbdV0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdNYWtlIHN1cmUgdGhlIHBsdWdpbiBhbmQgQVBJIG5hbWUgZXhpc3QuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IE9iamVjdC5hc3NpZ24oaSwgeyBjYWxsYmFjazogbyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNbdV0uY2FsbChjLCBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGUuZXJyb3IoJ1tleGVjdXRlXSBTb21ldGhpbmcgd2VudCB3cm9uZzogJyArIGUubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKEVycm9yLnByb3RvdHlwZSksIGYucHJvdG90eXBlLmNvbnN0cnVjdG9yID0gZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFBlID0gJ2ZldGNoUGVybWlzc2lvbnMnLCBPZSA9ICdbT3B0SW4jcmVnaXN0ZXJQbHVnaW5dIFBsdWdpbiBpcyBpbnZhbGlkLic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAuQ2F0ZWdvcmllcyA9IG5lLCBwLlRpbWVvdXRFcnJvciA9IGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBqZSA9IE9iamVjdC5mcmVlemUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9wdEluOiBwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElhYlBsdWdpbjogdgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIExlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnB1Ymxpc2hEZXN0aW5hdGlvbnMgPSBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGFyZ3VtZW50c1sxXSwgaSA9IGFyZ3VtZW50c1syXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBpID8gaSA6IG4uY2FsbGJhY2s7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEucmVhZHlUb0F0dGFjaElmcmFtZVByZWxpbWluYXJ5KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbi5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGkoeyBlcnJvcjogJ3N1YmRvbWFpbiBpcyBub3QgYSBwb3B1bGF0ZWQgc3RyaW5nLicgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEociBpbnN0YW5jZW9mIEFycmF5ICYmIHIubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgaSh7IGVycm9yOiAnbWVzc2FnZXMgaXMgbm90IGEgcG9wdWxhdGVkIGFycmF5LicgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PSB0eXBlb2YgZSAmJiBlLmxlbmd0aCAmJiAoYS5hZGRNZXNzYWdlKGUpLCBvID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgIW8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGkoeyBlcnJvcjogJ05vbmUgb2YgdGhlIG1lc3NhZ2VzIGFyZSBwb3B1bGF0ZWQgc3RyaW5ncy4nIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVQuaXNPYmplY3QobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGkoeyBlcnJvcjogJ0ludmFsaWQgcGFyYW1ldGVycyBwYXNzZWQuJyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9IHR5cGVvZiAobiA9IHMuc3ViZG9tYWluKSB8fCAhbi5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGkoeyBlcnJvcjogJ2NvbmZpZy5zdWJkb21haW4gaXMgbm90IGEgcG9wdWxhdGVkIHN0cmluZy4nIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gcy51cmxEZXN0aW5hdGlvbnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoYyBpbnN0YW5jZW9mIEFycmF5ICYmIGMubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgaSh7IGVycm9yOiAnY29uZmlnLnVybERlc3RpbmF0aW9ucyBpcyBub3QgYSBwb3B1bGF0ZWQgYXJyYXkuJyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBULmlzT2JqZWN0KGUpICYmIChlLmhpZGVSZWZlcnJlciA/IGUubWVzc2FnZSAmJiBhLmFkZE1lc3NhZ2UoZS5tZXNzYWdlKSA6IHUucHVzaChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUubGVuZ3RoICYmIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuZXcgSW1hZ2UoKSwgbiA9IHUuc2hpZnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc3JjID0gbi51cmwsIGEub25QYWdlRGVzdGluYXRpb25zRmlyZWQucHVzaChuKSwgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuaWZyYW1lID8gKGkoeyBtZXNzYWdlOiAnVGhlIGRlc3RpbmF0aW9uIHB1Ymxpc2hpbmcgaWZyYW1lIGlzIGFscmVhZHkgYXR0YWNoZWQgYW5kIGxvYWRlZC4nIH0pLCBhLnJlcXVlc3RUb1Byb2Nlc3MoKSkgOiAhZS5zdWJkb21haW4gJiYgZS5fZ2V0RmllbGQoJ01DTUlEJykgPyAoYS5zdWJkb21haW4gPSBuLCBhLmRvQXR0YWNoSWZyYW1lID0gITAsIGEudXJsID0gYS5nZXRVcmwoKSwgYS5yZWFkeVRvQXR0YWNoSWZyYW1lKCkgPyAoYS5pZnJhbWVMb2FkZWRDYWxsYmFja3MucHVzaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkoeyBtZXNzYWdlOiAnQXR0ZW1wdGVkIHRvIGF0dGFjaCBhbmQgbG9hZCB0aGUgZGVzdGluYXRpb24gcHVibGlzaGluZyBpZnJhbWUgdGhyb3VnaCB0aGlzIEFQSSBjYWxsLiBSZXN1bHQ6ICcgKyAoZS5tZXNzYWdlIHx8ICdubyByZXN1bHQnKSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhLmF0dGFjaElmcmFtZSgpKSA6IGkoeyBlcnJvcjogJ0VuY291bnRlcmVkIGEgcHJvYmxlbSBpbiBhdHRlbXB0aW5nIHRvIGF0dGFjaCBhbmQgbG9hZCB0aGUgZGVzdGluYXRpb24gcHVibGlzaGluZyBpZnJhbWUgdGhyb3VnaCB0aGlzIEFQSSBjYWxsLicgfSkpIDogYS5pZnJhbWVMb2FkZWRDYWxsYmFja3MucHVzaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkoeyBtZXNzYWdlOiAnQXR0ZW1wdGVkIHRvIGF0dGFjaCBhbmQgbG9hZCB0aGUgZGVzdGluYXRpb24gcHVibGlzaGluZyBpZnJhbWUgdGhyb3VnaCBub3JtYWwgVmlzaXRvciBBUEkgcHJvY2Vzc2luZy4gUmVzdWx0OiAnICsgKGUubWVzc2FnZSB8fCAnbm8gcmVzdWx0JykgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKHsgZXJyb3I6ICdUaGUgZGVzdGluYXRpb24gcHVibGlzaGluZyBpZnJhbWUgaXMgZGlzYWJsZWQgaW4gdGhlIFZpc2l0b3IgbGlicmFyeS4nIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBNZSA9IGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA+Pj4gdCB8IGUgPDwgMzIgLSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByLCBpLCBhID0gTWF0aC5wb3csIG8gPSBhKDIsIDMyKSwgcyA9ICcnLCBjID0gW10sIHUgPSA4ICogdC5sZW5ndGgsIGwgPSBlLmggPSBlLmggfHwgW10sIGQgPSBlLmsgPSBlLmsgfHwgW10sIGYgPSBkLmxlbmd0aCwgcCA9IHt9LCBtID0gMjsgZiA8IDY0OyBtKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcFttXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyID0gMDsgciA8IDMxMzsgciArPSBtKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBbcl0gPSBtOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbFtmXSA9IGEobSwgMC41KSAqIG8gfCAwLCBkW2YrK10gPSBhKG0sIDEgLyAzKSAqIG8gfCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0ICs9ICdceDgwJzsgdC5sZW5ndGggJSA2NCAtIDU2OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSAnXDAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociA9IDA7IHIgPCB0Lmxlbmd0aDsgcisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoaSA9IHQuY2hhckNvZGVBdChyKSkgPj4gOCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY1tyID4+IDJdIHw9IGkgPDwgKDMgLSByKSAlIDQgKiA4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGNbYy5sZW5ndGhdID0gdSAvIG8gfCAwLCBjW2MubGVuZ3RoXSA9IHUsIGkgPSAwOyBpIDwgYy5sZW5ndGg7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gYy5zbGljZShpLCBpICs9IDE2KSwgaCA9IGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobCA9IGwuc2xpY2UoMCwgOCksIHIgPSAwOyByIDwgNjQ7IHIrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSBnW3IgLSAxNV0sIGIgPSBnW3IgLSAyXSwgeSA9IGxbMF0sIF8gPSBsWzRdLCBDID0gbFs3XSArIChuKF8sIDYpIF4gbihfLCAxMSkgXiBuKF8sIDI1KSkgKyAoXyAmIGxbNV0gXiB+XyAmIGxbNl0pICsgZFtyXSArIChnW3JdID0gciA8IDE2ID8gZ1tyXSA6IGdbciAtIDE2XSArIChuKHYsIDcpIF4gbih2LCAxOCkgXiB2ID4+PiAzKSArIGdbciAtIDddICsgKG4oYiwgMTcpIF4gbihiLCAxOSkgXiBiID4+PiAxMCkgfCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChsID0gW0MgKyAoKG4oeSwgMikgXiBuKHksIDEzKSBeIG4oeSwgMjIpKSArICh5ICYgbFsxXSBeIHkgJiBsWzJdIF4gbFsxXSAmIGxbMl0pKSB8IDBdLmNvbmNhdChsKSlbNF0gPSBsWzRdICsgQyB8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyID0gMDsgciA8IDg7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxbcl0gPSBsW3JdICsgaFtyXSB8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociA9IDA7IHIgPCA4OyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDM7IGkgKyAxOyBpLS0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB4ID0gbFtyXSA+PiA4ICogaSAmIDI1NTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgKz0gKHggPCAxNiA/IDAgOiAnJykgKyB4LnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgVmUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnU0hBLTI1NicgIT09IHQgJiYgJ1NIQTI1NicgIT09IHQgJiYgJ3NoYTI1NicgIT09IHQgJiYgJ3NoYS0yNTYnICE9PSB0IHx8IChlID0gTWUoZSkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgUmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTdHJpbmcoZSkudHJpbSgpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBOZSA9IGplLk9wdEluOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBULmRlZmluZUdsb2JhbE5hbWVzcGFjZSgpLCB3aW5kb3cuYWRvYmUuT3B0SW5DYXRlZ29yaWVzID0gTmUuQ2F0ZWdvcmllczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEZlID0gZnVuY3Rpb24gKHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fY3VzdG9tZXJJRHNIYXNoQ2hhbmdlZCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUgfHwgSS5sb2NhdGlvbi5ocmVmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB5Ll9leHRyYWN0UGFyYW1Gcm9tVXJpKG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFoucGFyc2VQaXBlRGVsaW1ldGVkS2V5VmFsdWVzKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgJiYgZS5tYXRjaChRLlZBTElEX1ZJU0lUT1JfSURfUkVHRVgpICYmIChuID09PSBQICYmIChFID0gITApLCB0KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChlW1BdLCB5LnNldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklELCBQKSwgeS5fc2V0RmllbGRFeHBpcmUoUiwgLTEpLCB0KGVbTV0sIHkuc2V0QW5hbHl0aWNzVmlzaXRvcklEKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlIHx8IHt9LCB5Ll9zdXBwbGVtZW50YWxEYXRhSURDdXJyZW50ID0gZS5zdXBwbGVtZW50YWxEYXRhSURDdXJyZW50IHx8ICcnLCB5Ll9zdXBwbGVtZW50YWxEYXRhSURDdXJyZW50Q29uc3VtZWQgPSBlLnN1cHBsZW1lbnRhbERhdGFJREN1cnJlbnRDb25zdW1lZCB8fCB7fSwgeS5fc3VwcGxlbWVudGFsRGF0YUlETGFzdCA9IGUuc3VwcGxlbWVudGFsRGF0YUlETGFzdCB8fCAnJywgeS5fc3VwcGxlbWVudGFsRGF0YUlETGFzdENvbnN1bWVkID0gZS5zdXBwbGVtZW50YWxEYXRhSURMYXN0Q29uc3VtZWQgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChuID0gbiA/IG4gKz0gJ3wnIDogbikgKyAoZSArICc9JykgKyBlbmNvZGVVUklDb21wb25lbnQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG5bMF0sIGkgPSBuWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBpICYmIGkgIT09IE4gJiYgKGUgPSB0KHIsIGksIGUpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IGUgPyBlICs9ICd8JyA6IGUpICsgJ1RTPScgKyBaLmdldFRpbWVzdGFtcEluU2Vjb25kcygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZS5yZWR1Y2UobiwgJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5taW51dGVzVG9MaXZlLCBuID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICh5LmlkU3luY0Rpc2FibGVTeW5jcyB8fCB5LmRpc2FibGVJZFN5bmNzKSAmJiAobiA9IG4gfHwgJ0Vycm9yOiBpZCBzeW5jcyBoYXZlIGJlZW4gZGlzYWJsZWQnKSwgJ3N0cmluZycgPT0gdHlwZW9mIGUuZHBpZCAmJiBlLmRwaWQubGVuZ3RoIHx8IChuID0gbiB8fCAnRXJyb3I6IGNvbmZpZy5kcGlkIGlzIGVtcHR5JyksICdzdHJpbmcnID09IHR5cGVvZiBlLnVybCAmJiBlLnVybC5sZW5ndGggfHwgKG4gPSBuIHx8ICdFcnJvcjogY29uZmlnLnVybCBpcyBlbXB0eScpLCB2b2lkIDAgPT09IHQgPyB0ID0gMjAxNjAgOiAodCA9IHBhcnNlSW50KHQsIDEwKSwgKGlzTmFOKHQpIHx8IHQgPD0gMCkgJiYgKG4gPSBuIHx8ICdFcnJvcjogY29uZmlnLm1pbnV0ZXNUb0xpdmUgbmVlZHMgdG8gYmUgYSBwb3NpdGl2ZSBudW1iZXInKSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR0bDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCF5LmNvbmZpZ3MuZG9lc09wdEluQXBwbHkgfHwgXy5vcHRJbi5pc0NvbXBsZXRlICYmIGQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5LmNvbmZpZ3MuZG9lc09wdEluQXBwbHkgJiYgeS5jb25maWdzLmlzSWFiQ29udGV4dCA/IF8ub3B0SW4uaXNBcHByb3ZlZChfLm9wdEluLkNhdGVnb3JpZXMuRUNJRCkgJiYgdyA6IF8ub3B0SW4uaXNBcHByb3ZlZChfLm9wdEluLkNhdGVnb3JpZXMuRUNJRCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydnZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCddLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2V0Q3VzdG9tZXJJRHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzeW5jSWRlbnRpdHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ2V0QW5hbHl0aWNzVmlzaXRvcklEJ10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50J10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ2V0TG9jYXRpb25IaW50J10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ2V0QXVkaWVuY2VNYW5hZ2VyQmxvYiddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVswXSwgbiA9IDIgPT09IGUubGVuZ3RoID8gZVsxXSA6ICcnLCByID0geVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeVt0XSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCgpICYmIHkuaXNBbGxvd2VkKCkgPyByLmFwcGx5KHksIGFyZ3VtZW50cykgOiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZSAmJiB5Ll9jYWxsQ2FsbGJhY2soZSwgW25dKSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0geS5fZ2V0QXVkaWVuY2VNYW5hZ2VyVVJMRGF0YSgpLCB0ID0gZS51cmw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkuX2xvYWREYXRhKFMsIHQsIG51bGwsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHcgPSAhMCwgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdbSUFCIHBsdWdpbl0gOiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiB0LmdkcHJBcHBsaWVzICYmICh4ID0gdC5jb25zZW50U3RyaW5nLCBrID0gdC5oYXNDb25zZW50Q2hhbmdlZFNpbmNlTGFzdENtcFB1bGwgPyAxIDogMCksIHAoKSwgdigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHcgPSAhMCwgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdbSUFCIHBsdWdpbl0gOiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5nZHByQXBwbGllcyAmJiAoeCA9IHQuY29uc2VudFN0cmluZywgayA9IHQuaGFzQ29uc2VudENoYW5nZWRTaW5jZUxhc3RDbXBQdWxsID8gMSA6IDApLCB5LmluaXQoKSwgdigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfLm9wdEluLmlzQ29tcGxldGUgJiYgKF8ub3B0SW4uaXNBcHByb3ZlZChfLm9wdEluLkNhdGVnb3JpZXMuRUNJRCkgPyB5LmNvbmZpZ3MuaXNJYWJDb250ZXh0ID8gXy5vcHRJbi5leGVjdXRlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tbWFuZDogJ2lhYlBsdWdpbi5mZXRjaENvbnNlbnREYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IGcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6ICh5LmluaXQoKSwgdigpKSA6IHkuY29uZmlncy5pc0lhYkNvbnRleHQgPyBfLm9wdEluLmV4ZWN1dGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21tYW5kOiAnaWFiUGx1Z2luLmZldGNoQ29uc2VudERhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogbQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogKGYoKSwgdigpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8ub3B0SW4ub2ZmKCdjb21wbGV0ZScsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyIHx8IHIuc3BsaXQoJycpLnJldmVyc2UoKS5qb2luKCcnKSAhPT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1BsZWFzZSB1c2UgYFZpc2l0b3IuZ2V0SW5zdGFuY2VgIHRvIGluc3RhbnRpYXRlIFZpc2l0b3IuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IHRoaXMsIF8gPSB3aW5kb3cuYWRvYmUsIHggPSAnJywgayA9IDAsIHcgPSAhMSwgRSA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS52ZXJzaW9uID0gJzUuMC4xJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBJID0gYiwgRCA9IEkuVmlzaXRvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEQudmVyc2lvbiA9IHkudmVyc2lvbiwgRC5BdXRoU3RhdGUgPSBDLkFVVEhfU1RBVEUsIEQuT3B0T3V0ID0gQy5PUFRfT1VULCBJLnNfY19pbiB8fCAoSS5zX2NfaWwgPSBbXSwgSS5zX2NfaW4gPSAwKSwgeS5fYyA9ICdWaXNpdG9yJywgeS5faWwgPSBJLnNfY19pbCwgeS5faW4gPSBJLnNfY19pbiwgeS5faWxbeS5faW5dID0geSwgSS5zX2NfaW4rKywgeS5faW5zdGFuY2VUeXBlID0gJ3JlZ3VsYXInLCB5Ll9sb2cgPSB7IHJlcXVlc3RzOiBbXSB9LCB5Lm1hcmtldGluZ0Nsb3VkT3JnSUQgPSB0LCB5LmNvb2tpZU5hbWUgPSAnQU1DVl8nICsgdCwgeS5zZXNzaW9uQ29va2llTmFtZSA9ICdBTUNWU18nICsgdCwgeS5jb29raWVEb21haW4gPSBIKCksIHkubG9hZFNTTCA9ICEwLCB5LmxvYWRUaW1lb3V0ID0gMzAwMDAsIHkuQ09SU0Vycm9ycyA9IFtdLCB5Lm1hcmtldGluZ0Nsb3VkU2VydmVyID0geS5hdWRpZW5jZU1hbmFnZXJTZXJ2ZXIgPSAnZHBtLmRlbWRleC5uZXQnLCB5LnNkaWRQYXJhbUV4cGlyeSA9IDMwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEEgPSBudWxsLCBTID0gJ01DJywgUCA9ICdNQ01JRCcsIE8gPSAnTUNJRFRTJywgaiA9ICdBJywgTSA9ICdNQ0FJRCcsIFYgPSAnQUFNJywgUiA9ICdNQ0FBTUInLCBOID0gJ05PTkUnLCBGID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFPYmplY3QucHJvdG90eXBlW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEIgPSBLKHkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5GSUVMRFMgPSBDLkZJRUxEUywgeS5jb29raWVSZWFkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcS5nZXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5LmNvb2tpZVdyaXRlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHkuY29va2llTGlmZXRpbWUgPyAoJycgKyB5LmNvb2tpZUxpZmV0aW1lKS50b1VwcGVyQ2FzZSgpIDogJycsIGkgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5jb25maWdzICYmIHkuY29uZmlncy5zZWN1cmVDb29raWUgJiYgJ2h0dHBzOicgPT09IGxvY2F0aW9uLnByb3RvY29sICYmIChpID0gITApLCBxLnNldChlLCAnJyArIHQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJlczogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluOiB5LmNvb2tpZURvbWFpbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llTGlmZXRpbWU6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY3VyZTogaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5yZXNldFN0YXRlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID8geS5fbWVyZ2VTZXJ2ZXJTdGF0ZShlKSA6IHMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2lzQWxsb3dlZERvbmUgPSAhMSwgeS5faXNBbGxvd2VkRmxhZyA9ICExLCB5LmlzQWxsb3dlZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5faXNBbGxvd2VkRG9uZSB8fCAoeS5faXNBbGxvd2VkRG9uZSA9ICEwLCAoeS5jb29raWVSZWFkKHkuY29va2llTmFtZSkgfHwgeS5jb29raWVXcml0ZSh5LmNvb2tpZU5hbWUsICdUJywgMSkpICYmICh5Ll9pc0FsbG93ZWRGbGFnID0gITApKSwgJ1QnID09PSB5LmNvb2tpZVJlYWQoeS5jb29raWVOYW1lKSAmJiB5Ll9oZWxwZXJzLnJlbW92ZUNvb2tpZSh5LmNvb2tpZU5hbWUpLCB5Ll9pc0FsbG93ZWRGbGFnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5zZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fc2V0TWFya2V0aW5nQ2xvdWRGaWVsZHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll91c2Uxc3RQYXJ0eU1hcmtldGluZ0Nsb3VkU2VydmVyID0gITEsIHkuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkubWFya2V0aW5nQ2xvdWRTZXJ2ZXIgJiYgeS5tYXJrZXRpbmdDbG91ZFNlcnZlci5pbmRleE9mKCcuZGVtZGV4Lm5ldCcpIDwgMCAmJiAoeS5fdXNlMXN0UGFydHlNYXJrZXRpbmdDbG91ZFNlcnZlciA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHkuX2dldEF1ZGllbmNlTWFuYWdlclVSTERhdGEoJ19zZXRNYXJrZXRpbmdDbG91ZEZpZWxkcycpLCByID0gbi51cmw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkuX2dldFJlbW90ZUZpZWxkKFAsIHIsIGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBHID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bZV0gPSB5Ll9nZXRGaWVsZChlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAtMSAhPT0gdC5pbmRleE9mKCdNQ09QVE9VVCcpID8geS5pc09wdGVkT3V0KGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLk1DT1BUT1VUID0gdCwgZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbnVsbCwgITApIDogZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5nZXRWaXNpdG9yVmFsdWVzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DTUlEOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm46IHkuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJnczogWyEwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiB5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNPUFRPVVQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbjogeS5pc09wdGVkT3V0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3M6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogeQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUlEOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm46IHkuZ2V0QW5hbHl0aWNzVmlzaXRvcklELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3M6IFshMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogeQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNTEg6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbjogeS5nZXRBdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJnczogWyEwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiB5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBQU1COiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm46IHkuZ2V0QXVkaWVuY2VNYW5hZ2VyQmxvYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzOiBbITBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IHkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IHQgJiYgdC5sZW5ndGggPyBULnBsdWNrKG4sIHQpIDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIC0xID09PSB0LmluZGV4T2YoJ01DQUlEJykgPyBHKGUsIHQpIDogeihyLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2N1cnJlbnRDdXN0b21lcklEcyA9IHt9LCB5Ll9jdXN0b21lcklEc0hhc2hDaGFuZ2VkID0gITEsIHkuX25ld0N1c3RvbWVySURzSGFzaCA9ICcnLCB5LnNldEN1c3RvbWVySURzID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXkuaXNPcHRlZE91dCgpICYmIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFULmlzT2JqZWN0KHQpIHx8IFQuaXNPYmplY3RFbXB0eSh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIGEsIG8sIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociBpbiAoeS5fcmVhZFZpc2l0b3IoKSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoRihyKSAmJiAoeS5fY3VycmVudEN1c3RvbWVySURzLmRhdGFTb3VyY2VzID0geS5fY3VycmVudEN1c3RvbWVySURzLmRhdGFTb3VyY2VzIHx8IHt9LCBuID0gKGEgPSB0W3JdKS5oYXNPd25Qcm9wZXJ0eSgnaGFzaFR5cGUnKSA/IGEuaGFzaFR5cGUgOiBuLCBhKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT09IGUoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEuaWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEocyA9IFZlKFJlKGEuaWQpLCBuKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmlkID0gcywgYy5oYXNoVHlwZSA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmlkID0gYS5pZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IGEuYXV0aFN0YXRlICYmIChjLmF1dGhTdGF0ZSA9IGEuYXV0aFN0YXRlKSwgeS5fY3VycmVudEN1c3RvbWVySURzLmRhdGFTb3VyY2VzW3JdID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEocyA9IFZlKFJlKGEpLCBuKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX2N1cnJlbnRDdXN0b21lcklEcy5kYXRhU291cmNlc1tyXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzaFR5cGU6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fY3VycmVudEN1c3RvbWVySURzLmRhdGFTb3VyY2VzW3JdID0geyBpZDogYSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHkuZ2V0Q3VzdG9tZXJJRHMoITApLCBsID0geS5fZ2V0RmllbGQoJ01DQ0lESCcpLCBkID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobyBpbiAobCB8fCAobCA9IDApLCB1KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSB1W29dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFULmlzT2JqZWN0RW1wdHkoZikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyIGluIGYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEYocikgJiYgKGQgKz0gKGQgPyAnfCcgOiAnJykgKyByICsgJ3wnICsgKChhID0gZltyXSkuaWQgPyBhLmlkIDogJycpICsgKGEuYXV0aFN0YXRlID8gYS5hdXRoU3RhdGUgOiAnJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX25ld0N1c3RvbWVySURzSGFzaCA9IFN0cmluZyh5Ll9oYXNoKGQpKSwgeS5fbmV3Q3VzdG9tZXJJRHNIYXNoICE9PSBsICYmICh5Ll9jdXN0b21lcklEc0hhc2hDaGFuZ2VkID0gITAsIHkuX21hcEN1c3RvbWVySURzKGkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5LnN5bmNJZGVudGl0eSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5LmlzT3B0ZWRPdXQoKSAmJiB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVC5pc09iamVjdCh0KSB8fCBULmlzT2JqZWN0RW1wdHkodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBhLCBvLCBzLCBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgaW4gKHkuX3JlYWRWaXNpdG9yKCksIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEYocikgJiYgKHkuX2N1cnJlbnRDdXN0b21lcklEcy5uYW1lU3BhY2VzID0geS5fY3VycmVudEN1c3RvbWVySURzLm5hbWVTcGFjZXMgfHwge30sIG4gPSAoYSA9IHRbcl0pLmhhc093blByb3BlcnR5KCdoYXNoVHlwZScpID8gYS5oYXNoVHlwZSA6IG4sIGEgJiYgJ29iamVjdCcgPT09IGUoYSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5pZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEobyA9IFZlKFJlKGEuaWQpLCBuKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5pZCA9IG8sIHUuaGFzaFR5cGUgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUuaWQgPSBhLmlkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IGEuYXV0aFN0YXRlICYmICh1LmF1dGhTdGF0ZSA9IGEuYXV0aFN0YXRlKSwgYS5kYXRhU291cmNlICYmICh5Ll9jdXJyZW50Q3VzdG9tZXJJRHMuZGF0YVNvdXJjZXMgPSB5Ll9jdXJyZW50Q3VzdG9tZXJJRHMuZGF0YVNvdXJjZXMgfHwge30sIHMgPSBhLmRhdGFTb3VyY2UsIHkuX2N1cnJlbnRDdXN0b21lcklEcy5kYXRhU291cmNlc1tzXSA9IHUpLCB5Ll9jdXJyZW50Q3VzdG9tZXJJRHMubmFtZVNwYWNlc1tyXSA9IHU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0geS5nZXRDdXN0b21lcklEcyghMCksIGQgPSB5Ll9nZXRGaWVsZCgnTUNDSURIJyksIGYgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjIGluIChkIHx8IChkID0gJzAnKSwgbCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gbFtjXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVC5pc09iamVjdEVtcHR5KHApKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociBpbiBwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGKHIpICYmIChmICs9IChmID8gJ3wnIDogJycpICsgciArICd8JyArICgoYSA9IHBbcl0pLmlkID8gYS5pZCA6ICcnKSArIChhLmF1dGhTdGF0ZSA/IGEuYXV0aFN0YXRlIDogJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9uZXdDdXN0b21lcklEc0hhc2ggPSBTdHJpbmcoeS5faGFzaChmKSksIHkuX25ld0N1c3RvbWVySURzSGFzaCAhPT0gZCAmJiAoeS5fY3VzdG9tZXJJRHNIYXNoQ2hhbmdlZCA9ICEwLCB5Ll9tYXBDdXN0b21lcklEcyhpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5nZXRDdXN0b21lcklEcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fcmVhZFZpc2l0b3IoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFTb3VyY2VzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWVTcGFjZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkgPSB5Ll9jdXJyZW50Q3VzdG9tZXJJRHMuZGF0YVNvdXJjZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0IGluIGkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEYodCkgJiYgKG4gPSBpW3RdKS5pZCAmJiAoci5kYXRhU291cmNlc1t0XSB8fCAoci5kYXRhU291cmNlc1t0XSA9IHt9KSwgci5kYXRhU291cmNlc1t0XS5pZCA9IG4uaWQsIG51bGwgIT0gbi5hdXRoU3RhdGUgPyByLmRhdGFTb3VyY2VzW3RdLmF1dGhTdGF0ZSA9IG4uYXV0aFN0YXRlIDogci5kYXRhU291cmNlc1t0XS5hdXRoU3RhdGUgPSBELkF1dGhTdGF0ZS5VTktOT1dOLCBuLmhhc2hUeXBlICYmIChyLmRhdGFTb3VyY2VzW3RdLmhhc2hUeXBlID0gbi5oYXNoVHlwZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0geS5fY3VycmVudEN1c3RvbWVySURzLm5hbWVTcGFjZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0IGluIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEYodCkgJiYgKG4gPSBhW3RdKS5pZCAmJiAoci5uYW1lU3BhY2VzW3RdIHx8IChyLm5hbWVTcGFjZXNbdF0gPSB7fSksIHIubmFtZVNwYWNlc1t0XS5pZCA9IG4uaWQsIG51bGwgIT0gbi5hdXRoU3RhdGUgPyByLm5hbWVTcGFjZXNbdF0uYXV0aFN0YXRlID0gbi5hdXRoU3RhdGUgOiByLm5hbWVTcGFjZXNbdF0uYXV0aFN0YXRlID0gRC5BdXRoU3RhdGUuVU5LTk9XTiwgbi5oYXNoVHlwZSAmJiAoci5uYW1lU3BhY2VzW3RdLmhhc2hUeXBlID0gbi5oYXNoVHlwZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gciA6IHIuZGF0YVNvdXJjZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5LnNldEFuYWx5dGljc1Zpc2l0b3JJRCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fc2V0QW5hbHl0aWNzRmllbGRzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5nZXRBbmFseXRpY3NWaXNpdG9ySUQgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghWi5pc1RyYWNraW5nU2VydmVyUG9wdWxhdGVkKCkgJiYgIW4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5Ll9jYWxsQ2FsbGJhY2soZSwgWycnXSksICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gfHwgKHIgPSB5LmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuZ2V0QW5hbHl0aWNzVmlzaXRvcklEKGUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCByIHx8IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuID8geS5tYXJrZXRpbmdDbG91ZFNlcnZlciA6IHkudHJhY2tpbmdTZXJ2ZXIsIGEgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5sb2FkU1NMICYmIChuID8geS5tYXJrZXRpbmdDbG91ZFNlcnZlclNlY3VyZSAmJiAoaSA9IHkubWFya2V0aW5nQ2xvdWRTZXJ2ZXJTZWN1cmUpIDogeS50cmFja2luZ1NlcnZlclNlY3VyZSAmJiAoaSA9IHkudHJhY2tpbmdTZXJ2ZXJTZWN1cmUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gJ2h0dHAnICsgKHkubG9hZFNTTCA/ICdzJyA6ICcnKSArICc6Ly8nICsgaSArICcvaWQnLCBjID0gJ2RfdmlzaWRfdmVyPScgKyB5LnZlcnNpb24gKyAnJm1jb3JnaWQ9JyArIGVuY29kZVVSSUNvbXBvbmVudCh5Lm1hcmtldGluZ0Nsb3VkT3JnSUQpICsgKHIgPyAnJm1pZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KHIpIDogJycpICsgKHkuaWRTeW5jRGlzYWJsZTNyZFBhcnR5U3luY2luZyB8fCB5LmRpc2FibGVUaGlyZFBhcnR5Q29va2llcyA/ICcmZF9jb3BwYT10cnVlJyA6ICcnKSwgdSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NfY19pbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX2luLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnX3NldCcgKyAobiA/ICdNYXJrZXRpbmdDbG91ZCcgOiAnQW5hbHl0aWNzJykgKyAnRmllbGRzJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gcyArICc/JyArIGMgKyAnJmNhbGxiYWNrPXNfY19pbCU1QicgKyB5Ll9pbiArICclNUQuX3NldCcgKyAobiA/ICdNYXJrZXRpbmdDbG91ZCcgOiAnQW5hbHl0aWNzJykgKyAnRmllbGRzJywgby5jb3JzVXJsID0gcyArICc/JyArIGMsIG8uY2FsbGJhY2sgPSB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLnVybCA9IGEsIHkuX2dldFJlbW90ZUZpZWxkKG4gPyBQIDogTSwgYSwgZSwgdCwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeS5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmdldEF1ZGllbmNlTWFuYWdlckxvY2F0aW9uSGludChlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0geS5fZ2V0RmllbGQoTSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbiAmJiBaLmlzVHJhY2tpbmdTZXJ2ZXJQb3B1bGF0ZWQoKSAmJiAobiA9IHkuZ2V0QW5hbHl0aWNzVmlzaXRvcklEKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmdldEF1ZGllbmNlTWFuYWdlckxvY2F0aW9uSGludChlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSksIG4gfHwgIVouaXNUcmFja2luZ1NlcnZlclBvcHVsYXRlZCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHkuX2dldEF1ZGllbmNlTWFuYWdlclVSTERhdGEoKSwgaSA9IHIudXJsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkuX2dldFJlbW90ZUZpZWxkKCdNQ0FBTUxIJywgaSwgZSwgdCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5nZXRMb2NhdGlvbkhpbnQgPSB5LmdldEF1ZGllbmNlTWFuYWdlckxvY2F0aW9uSGludCwgeS5nZXRBdWRpZW5jZU1hbmFnZXJCbG9iID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeS5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmdldEF1ZGllbmNlTWFuYWdlckJsb2IoZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHkuX2dldEZpZWxkKE0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4gJiYgWi5pc1RyYWNraW5nU2VydmVyUG9wdWxhdGVkKCkgJiYgKG4gPSB5LmdldEFuYWx5dGljc1Zpc2l0b3JJRChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5nZXRBdWRpZW5jZU1hbmFnZXJCbG9iKGUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgbiB8fCAhWi5pc1RyYWNraW5nU2VydmVyUG9wdWxhdGVkKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0geS5fZ2V0QXVkaWVuY2VNYW5hZ2VyVVJMRGF0YSgpLCBpID0gci51cmw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5fY3VzdG9tZXJJRHNIYXNoQ2hhbmdlZCAmJiB5Ll9zZXRGaWVsZEV4cGlyZShSLCAtMSksIHkuX2dldFJlbW90ZUZpZWxkKFIsIGksIGUsIHQsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQgPSAnJywgeS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkID0ge30sIHkuX3N1cHBsZW1lbnRhbERhdGFJRExhc3QgPSAnJywgeS5fc3VwcGxlbWVudGFsRGF0YUlETGFzdENvbnN1bWVkID0ge30sIHkuZ2V0U3VwcGxlbWVudGFsRGF0YUlEID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9zdXBwbGVtZW50YWxEYXRhSURDdXJyZW50IHx8IHQgfHwgKHkuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQgPSB5Ll9nZW5lcmF0ZUlEKDEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHkuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkuX3N1cHBsZW1lbnRhbERhdGFJRExhc3QgJiYgIXkuX3N1cHBsZW1lbnRhbERhdGFJRExhc3RDb25zdW1lZFtlXSA/IChuID0geS5fc3VwcGxlbWVudGFsRGF0YUlETGFzdCwgeS5fc3VwcGxlbWVudGFsRGF0YUlETGFzdENvbnN1bWVkW2VdID0gITApIDogbiAmJiAoeS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkW2VdICYmICh5Ll9zdXBwbGVtZW50YWxEYXRhSURMYXN0ID0geS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudCwgeS5fc3VwcGxlbWVudGFsRGF0YUlETGFzdENvbnN1bWVkID0geS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkLCB5Ll9zdXBwbGVtZW50YWxEYXRhSURDdXJyZW50ID0gbiA9IHQgPyAnJyA6IHkuX2dlbmVyYXRlSUQoMSksIHkuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnRDb25zdW1lZCA9IHt9KSwgbiAmJiAoeS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkW2VdID0gITApKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgSiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fbGliZXJhdGVkT3B0T3V0ID0gbnVsbCwgeS5nZXRPcHRPdXQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0geS5fZ2V0QXVkaWVuY2VNYW5hZ2VyVVJMRGF0YSgnX3NldE1hcmtldGluZ0Nsb3VkRmllbGRzJyksIHIgPSBuLnVybDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5fZ2V0UmVtb3RlRmllbGQoJ01DT1BUT1VUJywgciwgZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkuX3JlZ2lzdGVyQ2FsbGJhY2soJ2xpYmVyYXRlZE9wdE91dCcsIGUpLCBudWxsICE9PSB5Ll9saWJlcmF0ZWRPcHRPdXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5Ll9jYWxsQWxsQ2FsbGJhY2tzKCdsaWJlcmF0ZWRPcHRPdXQnLCBbeS5fbGliZXJhdGVkT3B0T3V0XSksIEogPSAhMSwgeS5fbGliZXJhdGVkT3B0T3V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChKKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAnbGliZXJhdGVkR2V0T3B0T3V0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jb3JzVXJsID0gbi5jb3JzVXJsLnJlcGxhY2UoL1wuZGVtZGV4XC5uZXRcL2lkXD8vLCAnLmRlbWRleC5uZXQvb3B0T3V0U3RhdHVzPycpLCBuLmNhbGxiYWNrID0gW2ldLCBiW2ldID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IE9iamVjdChlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIgPSBULnBhcnNlT3B0T3V0KGUsIHQsIE4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHIub3B0T3V0LCBuID0gMTAwMCAqIHIuZF9vdHRsLCB5Ll9saWJlcmF0ZWRPcHRPdXQgPSB0LCBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9saWJlcmF0ZWRPcHRPdXQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fY2FsbEFsbENhbGxiYWNrcygnbGliZXJhdGVkT3B0T3V0JywgW3RdKSwgSiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEIuZmlyZUNPUlMobiksIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5LmlzT3B0ZWRPdXQgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgfHwgKHQgPSBELk9wdE91dC5HTE9CQUwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0geS5nZXRPcHRPdXQoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuID09PSBELk9wdE91dC5HTE9CQUwgfHwgbi5pbmRleE9mKHQpID49IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX2NhbGxDYWxsYmFjayhlLCBbcl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByID8gciA9PT0gRC5PcHRPdXQuR0xPQkFMIHx8IHIuaW5kZXhPZih0KSA+PSAwIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2ZpZWxkcyA9IG51bGwsIHkuX2ZpZWxkc0V4cGlyZWQgPSBudWxsLCB5Ll9oYXNoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCA9IDA7IHQgPCBlLmxlbmd0aDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IChuIDw8IDUpIC0gbiArIGUuY2hhckNvZGVBdCh0KSwgbiAmPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fZ2VuZXJhdGVJRCA9IFgsIHkuX2dlbmVyYXRlTG9jYWxNSUQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB5Ll9nZW5lcmF0ZUlEKDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZS5pc0NsaWVudFNpZGVNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCA9ICEwLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fY2FsbGJhY2tMaXN0ID0gbnVsbCwgeS5fY2FsbENhbGxiYWNrID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiBlID8gZS5hcHBseShJLCB0KSA6IGVbMV0uYXBwbHkoZVswXSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX3JlZ2lzdGVyQ2FsbGJhY2sgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgKG51bGwgPT0geS5fY2FsbGJhY2tMaXN0ICYmICh5Ll9jYWxsYmFja0xpc3QgPSB7fSksIG51bGwgPT0geS5fY2FsbGJhY2tMaXN0W2VdICYmICh5Ll9jYWxsYmFja0xpc3RbZV0gPSBbXSksIHkuX2NhbGxiYWNrTGlzdFtlXS5wdXNoKHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2NhbGxBbGxDYWxsYmFja3MgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IHkuX2NhbGxiYWNrTGlzdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHkuX2NhbGxiYWNrTGlzdFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbi5sZW5ndGggPiAwOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9jYWxsQ2FsbGJhY2sobi5zaGlmdCgpLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9hZGRRdWVyeXN0cmluZ1BhcmFtID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGVuY29kZVVSSUNvbXBvbmVudCh0KSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudChuKSwgYSA9IFoucGFyc2VIYXNoKGUpLCBvID0gWi5oYXNobGVzc1VybChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoLTEgPT09IG8uaW5kZXhPZignPycpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyArICc/JyArIGkgKyBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gby5zcGxpdCgnPycpLCBjID0gc1swXSArICc/JywgdSA9IHNbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgKyBaLmFkZFF1ZXJ5UGFyYW1BdExvY2F0aW9uKHUsIGksIHIpICsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2V4dHJhY3RQYXJhbUZyb21VcmkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IFJlZ0V4cCgnW1xcPyYjXScgKyB0ICsgJz0oW14mI10qKScpLmV4ZWMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gJiYgbi5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkZWNvZGVVUklDb21wb25lbnQoblsxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9wYXJzZUFkb2JlTWNGcm9tVXJsID0gYShRLkFET0JFX01DKSwgeS5fcGFyc2VBZG9iZU1jU2RpZEZyb21VcmwgPSBhKFEuQURPQkVfTUNfU0RJRCksIHkuX2F0dGVtcHRUb1BvcHVsYXRlU2RpZEZyb21VcmwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0geS5fcGFyc2VBZG9iZU1jU2RpZEZyb21VcmwoZSksIHIgPSAxMDAwMDAwMDAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgbi5UUyAmJiAociA9IFouZ2V0VGltZXN0YW1wSW5TZWNvbmRzKCkgLSBuLlRTKSwgbiAmJiBuLlNESUQgJiYgbi5NQ09SR0lEID09PSB0ICYmIHIgPCB5LnNkaWRQYXJhbUV4cGlyeSAmJiAoeS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudCA9IG4uU0RJRCwgeS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkLlNESURfVVJMX1BBUkFNID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fYXR0ZW1wdFRvUG9wdWxhdGVJZHNGcm9tVXJsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0geS5fcGFyc2VBZG9iZU1jRnJvbVVybCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICYmIGUuVFMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBaLmdldFRpbWVzdGFtcEluU2Vjb25kcygpIC0gZS5UUzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE1hdGguZmxvb3IobiAvIDYwKSA+IFEuQURPQkVfTUNfVFRMX0lOX01JTiB8fCBlLk1DT1JHSUQgIT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fbWVyZ2VTZXJ2ZXJTdGF0ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWi5pc09iamVjdChlKSA/IGUgOiBKU09OLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkpW3kubWFya2V0aW5nQ2xvdWRPcmdJRF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbeS5tYXJrZXRpbmdDbG91ZE9yZ0lEXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWi5pc09iamVjdChlKSAmJiB5LnNldEN1c3RvbWVySURzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0odC5jdXN0b21lcklEcyksIHModC5zZGlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdgc2VydmVyU3RhdGVgIGhhcyBhbiBpbnZhbGlkIGZvcm1hdC4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fdGltZW91dCA9IG51bGwsIHkuX2xvYWREYXRhID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0geS5fYWRkUXVlcnlzdHJpbmdQYXJhbSh0LCAnZF9maWVsZGdyb3VwJywgZSwgMSksIHIudXJsID0geS5fYWRkUXVlcnlzdHJpbmdQYXJhbShyLnVybCwgJ2RfZmllbGRncm91cCcsIGUsIDEpLCByLmNvcnNVcmwgPSB5Ll9hZGRRdWVyeXN0cmluZ1BhcmFtKHIuY29yc1VybCwgJ2RfZmllbGRncm91cCcsIGUsIDEpLCBuZS5maWVsZEdyb3VwT2JqW2VdID0gITAsIHIgPT09IE9iamVjdChyKSAmJiByLmNvcnNVcmwgJiYgJ1hNTEh0dHBSZXF1ZXN0JyA9PT0gQi5jb3JzTWV0YWRhdGEuY29yc1R5cGUgJiYgQi5maXJlQ09SUyhyLCBuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2NsZWFyVGltZW91dCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSB5Ll90aW1lb3V0ICYmIHkuX3RpbWVvdXRbZV0gJiYgKGNsZWFyVGltZW91dCh5Ll90aW1lb3V0W2VdKSwgeS5fdGltZW91dFtlXSA9IDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fc2V0dGluZ3NEaWdlc3QgPSAwLCB5Ll9nZXRTZXR0aW5nc0RpZ2VzdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXkuX3NldHRpbmdzRGlnZXN0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0geS52ZXJzaW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmF1ZGllbmNlTWFuYWdlclNlcnZlciAmJiAoZSArPSAnfCcgKyB5LmF1ZGllbmNlTWFuYWdlclNlcnZlciksIHkuYXVkaWVuY2VNYW5hZ2VyU2VydmVyU2VjdXJlICYmIChlICs9ICd8JyArIHkuYXVkaWVuY2VNYW5hZ2VyU2VydmVyU2VjdXJlKSwgeS5fc2V0dGluZ3NEaWdlc3QgPSB5Ll9oYXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5fc2V0dGluZ3NEaWdlc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9yZWFkVmlzaXRvckRvbmUgPSAhMSwgeS5fcmVhZFZpc2l0b3IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5Ll9yZWFkVmlzaXRvckRvbmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fcmVhZFZpc2l0b3JEb25lID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0LCBuLCByLCBpLCBhLCBvID0geS5fZ2V0U2V0dGluZ3NEaWdlc3QoKSwgcyA9ICExLCBjID0geS5jb29raWVSZWFkKHkuY29va2llTmFtZSksIHUgPSBuZXcgRGF0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyB8fCBFIHx8IHkuZGlzY2FyZFRyYWNraW5nU2VydmVyRUNJRCB8fCAoYyA9IHkuY29va2llUmVhZChRLkZJUlNUX1BBUlRZX1NFUlZFUl9DT09LSUUpKSwgbnVsbCA9PSB5Ll9maWVsZHMgJiYgKHkuX2ZpZWxkcyA9IHt9KSwgYyAmJiAnVCcgIT09IGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKChjID0gYy5zcGxpdCgnfCcpKVswXS5tYXRjaCgvXltcLTAtOV0rJC8pICYmIChwYXJzZUludChjWzBdLCAxMCkgIT09IG8gJiYgKHMgPSAhMCksIGMuc2hpZnQoKSksIGMubGVuZ3RoICUgMiA9PSAxICYmIGMucG9wKCksIGUgPSAwOyBlIDwgYy5sZW5ndGg7IGUgKz0gMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gKHQgPSBjW2VdLnNwbGl0KCctJykpWzBdLCByID0gY1tlICsgMV0sIHQubGVuZ3RoID4gMSA/IChpID0gcGFyc2VJbnQodFsxXSwgMTApLCBhID0gdFsxXS5pbmRleE9mKCdzJykgPiAwKSA6IChpID0gMCwgYSA9ICExKSwgcyAmJiAoJ01DQ0lESCcgPT09IG4gJiYgKHIgPSAnJyksIGkgPiAwICYmIChpID0gdS5nZXRUaW1lKCkgLyAxMDAwIC0gNjApKSwgbiAmJiByICYmICh5Ll9zZXRGaWVsZChuLCByLCAxKSwgaSA+IDAgJiYgKHkuX2ZpZWxkc1snZXhwaXJlJyArIG5dID0gaSArIChhID8gJ3MnIDogJycpLCAodS5nZXRUaW1lKCkgPj0gMTAwMCAqIGkgfHwgYSAmJiAheS5jb29raWVSZWFkKHkuc2Vzc2lvbkNvb2tpZU5hbWUpKSAmJiAoeS5fZmllbGRzRXhwaXJlZCB8fCAoeS5fZmllbGRzRXhwaXJlZCA9IHt9KSwgeS5fZmllbGRzRXhwaXJlZFtuXSA9ICEwKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAheS5fZ2V0RmllbGQoTSkgJiYgWi5pc1RyYWNraW5nU2VydmVyUG9wdWxhdGVkKCkgJiYgKGMgPSB5LmNvb2tpZVJlYWQoJ3NfdmknKSkgJiYgKGMgPSBjLnNwbGl0KCd8JykpLmxlbmd0aCA+IDEgJiYgY1swXS5pbmRleE9mKCd2MScpID49IDAgJiYgKChlID0gKHIgPSBjWzFdKS5pbmRleE9mKCdbJykpID49IDAgJiYgKHIgPSByLnN1YnN0cmluZygwLCBlKSksIHIgJiYgci5tYXRjaChRLlZBTElEX1ZJU0lUT1JfSURfUkVHRVgpICYmIHkuX3NldEZpZWxkKE0sIHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9hcHBlbmRWZXJzaW9uVG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJ3ZWZXJzaW9ufCcgKyB5LnZlcnNpb24sIG4gPSBlID8geS5fZ2V0Q29va2llVmVyc2lvbihlKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPyBXLmFyZVZlcnNpb25zRGlmZmVyZW50KG4sIHkudmVyc2lvbikgJiYgKGUgPSBlLnJlcGxhY2UoUS5WRVJTSU9OX1JFR0VYLCB0KSkgOiBlICs9IChlID8gJ3wnIDogJycpICsgdCwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX3dyaXRlVmlzaXRvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSwgdCwgbiA9IHkuX2dldFNldHRpbmdzRGlnZXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlIGluIHkuX2ZpZWxkcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRihlKSAmJiB5Ll9maWVsZHNbZV0gJiYgJ2V4cGlyZScgIT09IGUuc3Vic3RyaW5nKDAsIDYpICYmICh0ID0geS5fZmllbGRzW2VdLCBuICs9IChuID8gJ3wnIDogJycpICsgZSArICh5Ll9maWVsZHNbJ2V4cGlyZScgKyBlXSA/ICctJyArIHkuX2ZpZWxkc1snZXhwaXJlJyArIGVdIDogJycpICsgJ3wnICsgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHkuX2FwcGVuZFZlcnNpb25UbyhuKSwgeS5jb29raWVXcml0ZSh5LmNvb2tpZU5hbWUsIG4sIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fZ2V0RmllbGQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IHkuX2ZpZWxkcyB8fCAhdCAmJiB5Ll9maWVsZHNFeHBpcmVkICYmIHkuX2ZpZWxkc0V4cGlyZWRbZV0gPyBudWxsIDogeS5fZmllbGRzW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fc2V0RmllbGQgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT0geS5fZmllbGRzICYmICh5Ll9maWVsZHMgPSB7fSksIHkuX2ZpZWxkc1tlXSA9IHQsIG4gfHwgeS5fd3JpdGVWaXNpdG9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9nZXRGaWVsZExpc3QgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0geS5fZ2V0RmllbGQoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPyBuLnNwbGl0KCcqJykgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fc2V0RmllbGRMaXN0ID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9zZXRGaWVsZChlLCB0ID8gdC5qb2luKCcqJykgOiAnJywgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9nZXRGaWVsZE1hcCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB5Ll9nZXRGaWVsZExpc3QoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIGkgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyID0gMDsgciA8IG4ubGVuZ3RoOyByICs9IDIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpW25bcl1dID0gbltyICsgMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX3NldEZpZWxkTWFwID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgaSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociBpbiAoaSA9IFtdLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEYocikgJiYgKGkucHVzaChyKSwgaS5wdXNoKHRbcl0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9zZXRGaWVsZExpc3QoZSwgaSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9zZXRGaWVsZEV4cGlyZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuZXcgRGF0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuc2V0VGltZShyLmdldFRpbWUoKSArIDEwMDAgKiB0KSwgbnVsbCA9PSB5Ll9maWVsZHMgJiYgKHkuX2ZpZWxkcyA9IHt9KSwgeS5fZmllbGRzWydleHBpcmUnICsgZV0gPSBNYXRoLmZsb29yKHIuZ2V0VGltZSgpIC8gMTAwMCkgKyAobiA/ICdzJyA6ICcnKSwgdCA8IDAgPyAoeS5fZmllbGRzRXhwaXJlZCB8fCAoeS5fZmllbGRzRXhwaXJlZCA9IHt9KSwgeS5fZmllbGRzRXhwaXJlZFtlXSA9ICEwKSA6IHkuX2ZpZWxkc0V4cGlyZWQgJiYgKHkuX2ZpZWxkc0V4cGlyZWRbZV0gPSAhMSksIG4gJiYgKHkuY29va2llUmVhZCh5LnNlc3Npb25Db29raWVOYW1lKSB8fCB5LmNvb2tpZVdyaXRlKHkuc2Vzc2lvbkNvb2tpZU5hbWUsICcxJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fZmluZFZpc2l0b3JJRCA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgKCdvYmplY3QnID09PSBlKHQpICYmICh0ID0gdC5kX21pZCA/IHQuZF9taWQgOiB0LnZpc2l0b3JJRCA/IHQudmlzaXRvcklEIDogdC5pZCA/IHQuaWQgOiB0LnV1aWQgPyB0LnV1aWQgOiAnJyArIHQpLCB0ICYmICdOT1RBUkdFVCcgPT09ICh0ID0gdC50b1VwcGVyQ2FzZSgpKSAmJiAodCA9IE4pLCB0ICYmICh0ID09PSBOIHx8IHQubWF0Y2goUS5WQUxJRF9WSVNJVE9SX0lEX1JFR0VYKSkgfHwgKHQgPSAnJykpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fc2V0RmllbGRzID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeS5fY2xlYXJUaW1lb3V0KHQpLCBudWxsICE9IHkuX2xvYWRpbmcgJiYgKHkuX2xvYWRpbmdbdF0gPSAhMSksIG5lLmZpZWxkR3JvdXBPYmpbdF0gJiYgbmUuc2V0U3RhdGUodCwgITEpLCB0ID09PSBTKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICEwICE9PSBuZS5pc0NsaWVudFNpZGVNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCAmJiAobmUuaXNDbGllbnRTaWRlTWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQgPSAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0geS5fZ2V0RmllbGQoUCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghciB8fCB5Lm92ZXJ3cml0ZUNyb3NzRG9tYWluTUNJREFuZEFJRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEociA9ICdvYmplY3QnID09PSBlKG4pICYmIG4ubWlkID8gbi5taWQgOiB5Ll9maW5kVmlzaXRvcklEKG4pKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh5Ll91c2Uxc3RQYXJ0eU1hcmtldGluZ0Nsb3VkU2VydmVyICYmICF5LnRyaWVkMXN0UGFydHlNYXJrZXRpbmdDbG91ZFNlcnZlcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkudHJpZWQxc3RQYXJ0eU1hcmtldGluZ0Nsb3VkU2VydmVyID0gITAsIHZvaWQgeS5nZXRBbmFseXRpY3NWaXNpdG9ySUQobnVsbCwgITEsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0geS5fZ2VuZXJhdGVMb2NhbE1JRCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fc2V0RmllbGQoUCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciAmJiByICE9PSBOIHx8IChyID0gJycpLCAnb2JqZWN0JyA9PT0gZShuKSAmJiAoKG4uZF9yZWdpb24gfHwgbi5kY3NfcmVnaW9uIHx8IG4uZF9ibG9iIHx8IG4uYmxvYikgJiYgeS5fc2V0RmllbGRzKFYsIG4pLCB5Ll91c2Uxc3RQYXJ0eU1hcmtldGluZ0Nsb3VkU2VydmVyICYmIG4ubWlkICYmIHkuX3NldEZpZWxkcyhqLCB7IGlkOiBuLmlkIH0pKSwgeS5fY2FsbEFsbENhbGxiYWNrcyhQLCBbcl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9PT0gViAmJiAnb2JqZWN0JyA9PT0gZShuKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IDYwNDgwMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSBuLmlkX3N5bmNfdHRsICYmIG4uaWRfc3luY190dGwgJiYgKGkgPSBwYXJzZUludChuLmlkX3N5bmNfdHRsLCAxMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGVlLmdldFJlZ2lvbkFuZENoZWNrSWZDaGFuZ2VkKG4sIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9jYWxsQWxsQ2FsbGJhY2tzKCdNQ0FBTUxIJywgW2FdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB5Ll9nZXRGaWVsZChSKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG4uZF9ibG9iIHx8IG4uYmxvYikgJiYgKChvID0gbi5kX2Jsb2IpIHx8IChvID0gbi5ibG9iKSwgeS5fc2V0RmllbGRFeHBpcmUoUiwgaSksIHkuX3NldEZpZWxkKFIsIG8pKSwgbyB8fCAobyA9ICcnKSwgeS5fY2FsbEFsbENhbGxiYWNrcyhSLCBbb10pLCAhbi5lcnJvcl9tc2cgJiYgeS5fbmV3Q3VzdG9tZXJJRHNIYXNoICYmIHkuX3NldEZpZWxkKCdNQ0NJREgnLCB5Ll9uZXdDdXN0b21lcklEc0hhc2gpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9PT0gaikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHkuX2dldEZpZWxkKE0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzICYmICF5Lm92ZXJ3cml0ZUNyb3NzRG9tYWluTUNJREFuZEFJRCB8fCAoKHMgPSB5Ll9maW5kVmlzaXRvcklEKG4pKSA/IHMgIT09IE4gJiYgeS5fc2V0RmllbGRFeHBpcmUoUiwgLTEpIDogcyA9IE4sIHkuX3NldEZpZWxkKE0sIHMpKSwgcyAmJiBzICE9PSBOIHx8IChzID0gJycpLCB5Ll9jYWxsQWxsQ2FsbGJhY2tzKE0sIFtzXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh5LmlkU3luY0Rpc2FibGVTeW5jcyB8fCB5LmRpc2FibGVJZFN5bmNzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlZS5pZENhbGxOb3RQcm9jZXNzc2VkID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVlLmlkQ2FsbE5vdFByb2Nlc3NzZWQgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5pYnMgPSBuLmlicywgYy5zdWJkb21haW4gPSBuLnN1YmRvbWFpbiwgZWUucHJvY2Vzc0lEQ2FsbERhdGEoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID09PSBPYmplY3QobikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUsIGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQoKSAmJiB5LmlzQWxsb3dlZCgpICYmICh1ID0geS5fZ2V0RmllbGQoJ01DT1BUT1VUJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IFQucGFyc2VPcHRPdXQobiwgdSwgTik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBmLm9wdE91dCwgbCA9IGYuZF9vdHRsLCB5Ll9zZXRGaWVsZEV4cGlyZSgnTUNPUFRPVVQnLCBsLCAhMCksIHkuX3NldEZpZWxkKCdNQ09QVE9VVCcsIHUpLCB5Ll9jYWxsQWxsQ2FsbGJhY2tzKCdNQ09QVE9VVCcsIFt1XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fbG9hZGluZyA9IG51bGwsIHkuX2dldFJlbW90ZUZpZWxkID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgbyA9ICcnLCBzID0gWi5pc0ZpcnN0UGFydHlBbmFseXRpY3NWaXNpdG9ySURDYWxsKGUpLCBjID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBQU1MSDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUI6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQoKSAmJiB5LmlzQWxsb3dlZCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeS5fcmVhZFZpc2l0b3IoKSwgISghKG8gPSB5Ll9nZXRGaWVsZChlLCAhMCA9PT0gY1tlXSkpIHx8IHkuX2ZpZWxkc0V4cGlyZWQgJiYgeS5fZmllbGRzRXhwaXJlZFtlXSkgfHwgeS5kaXNhYmxlVGhpcmRQYXJ0eUNhbGxzICYmICFzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyB8fCAoZSA9PT0gUCA/ICh5Ll9yZWdpc3RlckNhbGxiYWNrKGUsIG4pLCBvID0geS5fZ2VuZXJhdGVMb2NhbE1JRCgpLCB5LnNldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEKG8pKSA6IGUgPT09IE0gPyAoeS5fcmVnaXN0ZXJDYWxsYmFjayhlLCBuKSwgbyA9ICcnLCB5LnNldEFuYWx5dGljc1Zpc2l0b3JJRChvKSkgOiAobyA9ICcnLCByID0gITApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZSA9PT0gUCB8fCAnTUNPUFRPVVQnID09PSBlID8gYSA9IFMgOiAnTUNBQU1MSCcgPT09IGUgfHwgZSA9PT0gUiA/IGEgPSBWIDogZSA9PT0gTSAmJiAoYSA9IGopLCBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF0IHx8IG51bGwgIT0geS5fbG9hZGluZyAmJiB5Ll9sb2FkaW5nW2FdIHx8IChudWxsID09IHkuX2xvYWRpbmcgJiYgKHkuX2xvYWRpbmcgPSB7fSksIHkuX2xvYWRpbmdbYV0gPSAhMCwgYSA9PT0gViAmJiAoayA9IDApLCB5Ll9sb2FkRGF0YShhLCB0LCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgheS5fZ2V0RmllbGQoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiBuZS5zZXRTdGF0ZShhLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPT09IFAgPyBuID0geS5fZ2VuZXJhdGVMb2NhbE1JRCgpIDogYSA9PT0gViAmJiAobiA9IHsgZXJyb3JfbXNnOiAndGltZW91dCcgfSksIHkuX3NldEZpZWxkcyhhLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpKSksIHkuX3JlZ2lzdGVyQ2FsbGJhY2soZSwgbiksIG8gfHwgKHQgfHwgeS5fc2V0RmllbGRzKGEsIHsgaWQ6IE4gfSksICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAhPT0gUCAmJiBlICE9PSBNIHx8IG8gIT09IE4gfHwgKG8gPSAnJywgciA9ICEwKSwgbiAmJiByICYmIHkuX2NhbGxDYWxsYmFjayhuLCBbb10pLCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fc2V0TWFya2V0aW5nQ2xvdWRGaWVsZHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX3JlYWRWaXNpdG9yKCksIHkuX3NldEZpZWxkcyhTLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX21hcEN1c3RvbWVySURzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmdldEF1ZGllbmNlTWFuYWdlckJsb2IoZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fc2V0QW5hbHl0aWNzRmllbGRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9yZWFkVmlzaXRvcigpLCB5Ll9zZXRGaWVsZHMoaiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9zZXRBdWRpZW5jZU1hbmFnZXJGaWVsZHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX3JlYWRWaXNpdG9yKCksIHkuX3NldEZpZWxkcyhWLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2dldEF1ZGllbmNlTWFuYWdlclVSTERhdGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0geS5hdWRpZW5jZU1hbmFnZXJTZXJ2ZXIsIG4gPSAnJywgciA9IHkuX2dldEZpZWxkKFApLCBpID0geS5fZ2V0RmllbGQoUiwgITApLCBhID0geS5fZ2V0RmllbGQoTSksIG8gPSBhICYmIGEgIT09IE4gPyAnJmRfY2lkX2ljPUFWSUQlMDEnICsgZW5jb2RlVVJJQ29tcG9uZW50KGEpIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkubG9hZFNTTCAmJiB5LmF1ZGllbmNlTWFuYWdlclNlcnZlclNlY3VyZSAmJiAodCA9IHkuYXVkaWVuY2VNYW5hZ2VyU2VydmVyU2VjdXJlKSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcywgYywgdSwgbCA9IHkuZ2V0Q3VzdG9tZXJJRHMoITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYyBpbiBsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBsW2NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVC5pc09iamVjdEVtcHR5KGQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gJ25hbWVTcGFjZXMnID09PSBjID8gJyZkX2NpZF9ucz0nIDogJyZkX2NpZF9pYz0nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHMgaW4gZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEYocykgJiYgKHUgPSBkW3NdLCBvICs9IGYgKyBlbmNvZGVVUklDb21wb25lbnQocykgKyAnJTAxJyArIGVuY29kZVVSSUNvbXBvbmVudCh1LmlkID8gdS5pZCA6ICcnKSArICh1LmF1dGhTdGF0ZSA/ICclMDEnICsgdS5hdXRoU3RhdGUgOiAnJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSB8fCAoZSA9ICdfc2V0QXVkaWVuY2VNYW5hZ2VyRmllbGRzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gJ2h0dHAnICsgKHkubG9hZFNTTCA/ICdzJyA6ICcnKSArICc6Ly8nICsgdCArICcvaWQnLCBtID0gJ2RfdmlzaWRfdmVyPScgKyB5LnZlcnNpb24gKyAoeCAmJiAtMSAhPT0gcC5pbmRleE9mKCdkZW1kZXgubmV0JykgPyAnJmdkcHI9MSZnZHByX2NvbnNlbnQ9JyArIHggOiAnJykgKyAoayAmJiAtMSAhPT0gcC5pbmRleE9mKCdkZW1kZXgubmV0JykgPyAnJmRfY2Y9JyArIGsgOiAnJykgKyAnJmRfcnRiZD1qc29uJmRfdmVyPTInICsgKCFyICYmIHkuX3VzZTFzdFBhcnR5TWFya2V0aW5nQ2xvdWRTZXJ2ZXIgPyAnJmRfdmVyaWZ5PTEnIDogJycpICsgJyZkX29yZ2lkPScgKyBlbmNvZGVVUklDb21wb25lbnQoeS5tYXJrZXRpbmdDbG91ZE9yZ0lEKSArICcmZF9uc2lkPScgKyAoeS5pZFN5bmNDb250YWluZXJJRCB8fCAwKSArIChyID8gJyZkX21pZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KHIpIDogJycpICsgKHkuaWRTeW5jRGlzYWJsZTNyZFBhcnR5U3luY2luZyB8fCB5LmRpc2FibGVUaGlyZFBhcnR5Q29va2llcyA/ICcmZF9jb3BwYT10cnVlJyA6ICcnKSArICghMCA9PT0gQSA/ICcmZF9jb29wX3NhZmU9MScgOiAhMSA9PT0gQSA/ICcmZF9jb29wX3Vuc2FmZT0xJyA6ICcnKSArIChpID8gJyZkX2Jsb2I9JyArIGVuY29kZVVSSUNvbXBvbmVudChpKSA6ICcnKSArIG8sIGcgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NfY19pbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5faW4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbiA9IHAgKyAnPycgKyBtICsgJyZkX2NiPXNfY19pbCU1QicgKyB5Ll9pbiArICclNUQuJyArIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JzVXJsOiBwICsgJz8nICsgbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7IHVybDogbiB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5hcHBlbmRWaXNpdG9ySURzVG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fZ2V0RmllbGQoUCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9nZXRGaWVsZChNKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTUNPUkdJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5tYXJrZXRpbmdDbG91ZE9yZ0lECiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5Ll9hZGRRdWVyeXN0cmluZ1BhcmFtKGUsIFEuQURPQkVfTUMsIGModCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5hcHBlbmRTdXBwbGVtZW50YWxEYXRhSURUbyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodCA9IHQgfHwgeS5nZXRTdXBwbGVtZW50YWxEYXRhSUQoWi5nZW5lcmF0ZVJhbmRvbVN0cmluZygpLCAhMCkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGMoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTRElEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNQ09SR0lEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Lm1hcmtldGluZ0Nsb3VkT3JnSUQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5Ll9hZGRRdWVyeXN0cmluZ1BhcmFtKGUsIFEuQURPQkVfTUNfU0RJRCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFogPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VIYXNoOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuaW5kZXhPZignIycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA+IDAgPyBlLnN1YnN0cih0KSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzaGxlc3NVcmw6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5pbmRleE9mKCcjJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID4gMCA/IGUuc3Vic3RyKDAsIHQpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZFF1ZXJ5UGFyYW1BdExvY2F0aW9uOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuc3BsaXQoJyYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPSBudWxsICE9IG4gPyBuIDogci5sZW5ndGgsIHIuc3BsaWNlKG4sIDAsIHQpLCByLmpvaW4oJyYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRmlyc3RQYXJ0eUFuYWx5dGljc1Zpc2l0b3JJRENhbGw6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBNICYmICh0IHx8ICh0ID0geS50cmFja2luZ1NlcnZlciksIG4gfHwgKG4gPSB5LnRyYWNraW5nU2VydmVyU2VjdXJlKSwgISgnc3RyaW5nJyAhPSB0eXBlb2YgKHIgPSB5LmxvYWRTU0wgPyBuIDogdCkgfHwgIXIubGVuZ3RoKSAmJiByLmluZGV4T2YoJzJvNy5uZXQnKSA8IDAgJiYgci5pbmRleE9mKCdvbXRyZGMubmV0JykgPCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc09iamVjdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJvb2xlYW4oZSAmJiBlID09PSBPYmplY3QoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlQ29va2llOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxLnJlbW92ZShlLCB7IGRvbWFpbjogeS5jb29raWVEb21haW4gfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc1RyYWNraW5nU2VydmVyUG9wdWxhdGVkOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXkudHJhY2tpbmdTZXJ2ZXIgfHwgISF5LnRyYWNraW5nU2VydmVyU2VjdXJlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VGltZXN0YW1wSW5TZWNvbmRzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLnJvdW5kKG5ldyBEYXRlKCkuZ2V0VGltZSgpIC8gMTAwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZVBpcGVEZWxpbWV0ZWRLZXlWYWx1ZXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnNwbGl0KCd8JykucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuc3BsaXQoJz0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW25bMF1dID0gZGVjb2RlVVJJQ29tcG9uZW50KG5bMV0pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZW5lcmF0ZVJhbmRvbVN0cmluZzogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUgfHwgNTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9ICcnLCBuID0gJ2FiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OSc7IGUtLTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9IG5bTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogbi5sZW5ndGgpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3JtYWxpemVCb29sZWFuOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RydWUnID09PSBlIHx8ICdmYWxzZScgIT09IGUgJiYgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlQm9vbGVhbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0cnVlJyA9PT0gZSB8fCAnZmFsc2UnICE9PSBlICYmIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXBsYWNlTWV0aG9kc1dpdGhGdW5jdGlvbjogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5oYXNPd25Qcm9wZXJ0eShuKSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBlW25dICYmIChlW25dID0gdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9oZWxwZXJzID0gWjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlZSA9ICQoeSwgRCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9kZXN0aW5hdGlvblB1Ymxpc2hpbmcgPSBlZSwgeS50aW1lb3V0TWV0cmljc0xvZyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRlLCBuZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNDbGllbnRTaWRlTWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DSURDYWxsVGltZWRPdXQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFuYWx5dGljc0lEQ2FsbFRpbWVkT3V0OiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBQU1JRENhbGxUaW1lZE91dDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRHcm91cE9iajoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFN0YXRlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgITEgPT09IHQgPyAhMCAhPT0gdGhpcy5NQ0lEQ2FsbFRpbWVkT3V0ICYmICh0aGlzLk1DSURDYWxsVGltZWRPdXQgPSAhMSkgOiB0aGlzLk1DSURDYWxsVGltZWRPdXQgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBqOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICExID09PSB0ID8gITAgIT09IHRoaXMuQW5hbHl0aWNzSURDYWxsVGltZWRPdXQgJiYgKHRoaXMuQW5hbHl0aWNzSURDYWxsVGltZWRPdXQgPSAhMSkgOiB0aGlzLkFuYWx5dGljc0lEQ2FsbFRpbWVkT3V0ID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhMSA9PT0gdCA/ICEwICE9PSB0aGlzLkFBTUlEQ2FsbFRpbWVkT3V0ICYmICh0aGlzLkFBTUlEQ2FsbFRpbWVkT3V0ID0gITEpIDogdGhpcy5BQU1JRENhbGxUaW1lZE91dCA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5pc0NsaWVudFNpZGVNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmUuaXNDbGllbnRTaWRlTWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Lk1DSURDYWxsVGltZWRPdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5lLk1DSURDYWxsVGltZWRPdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5LkFuYWx5dGljc0lEQ2FsbFRpbWVkT3V0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZS5BbmFseXRpY3NJRENhbGxUaW1lZE91dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuQUFNSURDYWxsVGltZWRPdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5lLkFBTUlEQ2FsbFRpbWVkT3V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5pZFN5bmNHZXRPblBhZ2VTeW5jSW5mbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5fcmVhZFZpc2l0b3IoKSwgeS5fZ2V0RmllbGQoJ01DU1lOQ1NPUCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5pZFN5bmNCeVVSTCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5LmlzT3B0ZWRPdXQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHUoZSB8fCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmVycm9yKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZXJyb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByLCBpID0gZS51cmwsIGEgPSBlbmNvZGVVUklDb21wb25lbnQsIG8gPSBlZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgPSBpLnJlcGxhY2UoL15odHRwczovLCAnJykucmVwbGFjZSgvXmh0dHA6LywgJycpLCBuID0gVC5lbmNvZGVBbmRCdWlsZFJlcXVlc3QoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmRwaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmRwdXVpZCB8fCAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCAnLCcpLCByID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2licycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKGUuZHBpZCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaW1nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoaSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnR0bCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBvLmFkZE1lc3NhZ2Uoci5qb2luKCd8JykpLCBvLnJlcXVlc3RUb1Byb2Nlc3MoKSwgJ1N1Y2Nlc3NmdWxseSBxdWV1ZWQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuaWRTeW5jQnlEYXRhU291cmNlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXkuaXNPcHRlZE91dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gT2JqZWN0KGUpICYmICdzdHJpbmcnID09IHR5cGVvZiBlLmRwdXVpZCAmJiBlLmRwdXVpZC5sZW5ndGggPyAoZS51cmwgPSAnLy9kcG0uZGVtZGV4Lm5ldC9pYnM6ZHBpZD0nICsgZS5kcGlkICsgJyZkcHV1aWQ9JyArIGUuZHB1dWlkLCB5LmlkU3luY0J5VVJMKGUpKSA6ICdFcnJvcjogY29uZmlnIG9yIGNvbmZpZy5kcHV1aWQgaXMgZW1wdHknOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgTGUoeSwgZWUpLCB5Ll9nZXRDb29raWVWZXJzaW9uID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZSB8fCB5LmNvb2tpZVJlYWQoeS5jb29raWVOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFEuVkVSU0lPTl9SRUdFWC5leGVjKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIHQubGVuZ3RoID4gMSA/IHRbMV0gOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fcmVzZXRBbWN2Q29va2llID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHkuX2dldENvb2tpZVZlcnNpb24oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmICFXLmlzTGVzc1RoYW4odCwgZSkgfHwgWi5yZW1vdmVDb29raWUoeS5jb29raWVOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuc2V0QXNDb29wU2FmZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5LnNldEFzQ29vcFVuc2FmZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkuY29uZmlncyA9IE9iamVjdC5jcmVhdGUobnVsbCksIFouaXNPYmplY3QobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEYoZSkgJiYgKHlbZV0gPSBuW2VdLCB5LmNvbmZpZ3NbZV0gPSBuW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgZigpLCB5LmluaXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCgpICYmIChfLm9wdEluLmZldGNoUGVybWlzc2lvbnMoaCwgITApLCAhXy5vcHRJbi5pc0FwcHJvdmVkKF8ub3B0SW4uQ2F0ZWdvcmllcy5FQ0lEKSkgfHwgdGUgfHwgKHRlID0gITAsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFouaXNPYmplY3QobikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuaWRTeW5jQ29udGFpbmVySUQgPSB5LmlkU3luY0NvbnRhaW5lcklEIHx8IDAsIEEgPSAnYm9vbGVhbicgPT0gdHlwZW9mIHkuaXNDb29wU2FmZSA/IHkuaXNDb29wU2FmZSA6IFoucGFyc2VCb29sZWFuKHkuaXNDb29wU2FmZSksIHkucmVzZXRCZWZvcmVWZXJzaW9uICYmIHkuX3Jlc2V0QW1jdkNvb2tpZSh5LnJlc2V0QmVmb3JlVmVyc2lvbiksIHkuX2F0dGVtcHRUb1BvcHVsYXRlSWRzRnJvbVVybCgpLCB5Ll9hdHRlbXB0VG9Qb3B1bGF0ZVNkaWRGcm9tVXJsKCksIHkuX3JlYWRWaXNpdG9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHkuX2dldEZpZWxkKE8pLCB0ID0gTWF0aC5jZWlsKG5ldyBEYXRlKCkuZ2V0VGltZSgpIC8gUS5NSUxMSVNfUEVSX0RBWSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmlkU3luY0Rpc2FibGVTeW5jcyB8fCB5LmRpc2FibGVJZFN5bmNzIHx8ICFlZS5jYW5NYWtlU3luY0lEQ2FsbChlLCB0KSB8fCAoeS5fc2V0RmllbGRFeHBpcmUoUiwgLTEpLCB5Ll9zZXRGaWVsZChPLCB0KSksIHkuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoKSwgeS5nZXRBdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQoKSwgeS5nZXRBdWRpZW5jZU1hbmFnZXJCbG9iKCksIHkuX21lcmdlU2VydmVyU3RhdGUoeS5zZXJ2ZXJTdGF0ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fYXR0ZW1wdFRvUG9wdWxhdGVJZHNGcm9tVXJsKCksIHkuX2F0dGVtcHRUb1BvcHVsYXRlU2RpZEZyb21VcmwoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5LmlkU3luY0Rpc2FibGVTeW5jcyAmJiAheS5kaXNhYmxlSWRTeW5jcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWUuY2hlY2tEUElmcmFtZVNyYygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBlZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnJlYWR5VG9BdHRhY2hJZnJhbWUoKSAmJiBlLmF0dGFjaElmcmFtZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkuYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBELndpbmRvd0xvYWRlZCA9ICEwLCBlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWS5yZWNlaXZlTWVzc2FnZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlZS5yZWNlaXZlTWVzc2FnZShlLmRhdGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVlLmlmcmFtZUhvc3QpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCB5LndoaXRlbGlzdElmcmFtZURvbWFpbnMgJiYgUS5QT1NUX01FU1NBR0VfRU5BQkxFRCAmJiAoeS53aGl0ZWxpc3RJZnJhbWVEb21haW5zID0geS53aGl0ZWxpc3RJZnJhbWVEb21haW5zIGluc3RhbmNlb2YgQXJyYXkgPyB5LndoaXRlbGlzdElmcmFtZURvbWFpbnMgOiBbeS53aGl0ZWxpc3RJZnJhbWVEb21haW5zXSwgeS53aGl0ZWxpc3RJZnJhbWVEb21haW5zLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBuZXcgTCh0LCBlKSwgciA9IFUoeSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFkucmVjZWl2ZU1lc3NhZ2UociwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZlLmNvbmZpZyA9IFosIGIuVmlzaXRvciA9IEZlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgQmUgPSBGZSwgVWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChULmlzT2JqZWN0KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSkuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJycgIT09IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZShmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBaLm5vcm1hbGl6ZUNvbmZpZyhlW25dKSwgaSA9IFQubm9ybWFsaXplQm9vbGVhbihyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W25dID0gaSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgT2JqZWN0LmNyZWF0ZShudWxsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB6ZSA9IGplLk9wdEluLCBxZSA9IGplLklhYlBsdWdpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQmUuZ2V0SW5zdGFuY2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignVmlzaXRvciByZXF1aXJlcyBBZG9iZSBNYXJrZXRpbmcgQ2xvdWQgT3JnIElELicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5pbmRleE9mKCdAJykgPCAwICYmIChlICs9ICdAQWRvYmVPcmcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYi5zX2NfaWw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgdC5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0W25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgJiYgJ1Zpc2l0b3InID09PSByLl9jICYmIHIubWFya2V0aW5nQ2xvdWRPcmdJRCA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFVlKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5hZG9iZS5vcHRJbiA9IGIuYWRvYmUub3B0SW4gfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFQucGx1Y2soZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdkb2VzT3B0SW5BcHBseScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXZpb3VzUGVybWlzc2lvbnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVPcHRJbkFwcHJvdmFscycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2lzT3B0SW5TdG9yYWdlRW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29wdEluU3RvcmFnZUV4cGlyeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2lzSWFiQ29udGV4dCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBuID0gZS5vcHRJbkNvb2tpZURvbWFpbiB8fCBlLmNvb2tpZURvbWFpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IChuID0gbiB8fCBIKCkpID09PSB3aW5kb3cubG9jYXRpb24uaG9zdG5hbWUgPyAnJyA6IG4sIHQub3B0SW5Db29raWVEb21haW4gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG5ldyB6ZSh0LCB7IGNvb2tpZXM6IHEgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmlzSWFiQ29udGV4dCAmJiB0LmRvZXNPcHRJbkFwcGx5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG5ldyBxZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5yZWdpc3RlclBsdWdpbihpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHIgfHwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLnNwbGl0KCcnKS5yZXZlcnNlKCkuam9pbignJyksIGEgPSBuZXcgQmUoZSwgbnVsbCwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBULmlzT2JqZWN0KHIpICYmIHIuY29va2llRG9tYWluICYmIChhLmNvb2tpZURvbWFpbiA9IHIuY29va2llRG9tYWluKSwgYi5zX2NfaWwuc3BsaWNlKC0tYi5zX2NfaW4sIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBULmdldEllVmVyc2lvbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdudW1iZXInID09IHR5cGVvZiBvICYmIG8gPCAxMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5faGVscGVycy5yZXBsYWNlTWV0aG9kc1dpdGhGdW5jdGlvbihhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi5zZWxmICE9PSBiLnBhcmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkgJiYgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY29va2llV3JpdGUoJ1RFU1RfQU1DVl9DT09LSUUnLCAnVCcsIDEpLCAnVCcgPT09IGUuY29va2llUmVhZCgnVEVTVF9BTUNWX0NPT0tJRScpICYmIChlLl9oZWxwZXJzLnJlbW92ZUNvb2tpZSgnVEVTVF9BTUNWX0NPT0tJRScpLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGEpICYmIGIucGFyZW50ID8gbmV3IFYoZSwgciwgYSwgYi5wYXJlbnQpIDogbmV3IEJlKGUsIHIsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPSBudWxsLCBzLmluaXQoKSwgczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCZS53aW5kb3dMb2FkZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuYWRkRXZlbnRMaXN0ZW5lciA/IGIuYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsIGUpIDogYi5hdHRhY2hFdmVudCAmJiBiLmF0dGFjaEV2ZW50KCdvbmxvYWQnLCBlKSwgQmUuY29kZUxvYWRFbmQgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgVmlzaXRvcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1tY2lkL3NyYy92aWV3L3V0aWxzL3RpbWVVbml0cy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSG91cnM6IDM2MDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERheXM6IDg2NDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXZWVrczogNjA0ODAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNb250aHM6IDI1OTIwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFllYXJzOiAzMTUzNjAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzJzogewogICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQWRvYmUgQW5hbHl0aWNzJywKICAgICAgICAgICAgICAgICAgICBob3N0ZWRMaWJGaWxlc0Jhc2VVcmw6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vZXh0ZW5zaW9ucy9FUGJkZTJmN2NhMTRlNTQwMzk5ZGNjMWY4MjA4ODYwYjdiLycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgb3JnSWQ6ICcxRTIyMTcxQjUyMEU5M0JGMEE0OTBENDRAQWRvYmVPcmcnLAogICAgICAgICAgICAgICAgICAgICAgICBsaWJyYXJ5Q29kZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2N1c3RvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vNjg2YjhmMGM0NTIwLzRjZTQwMWM1MWI1MS82ODA3NmFjYmEyY2MvRVg2M2EzZTdhMjEzMTc0N2I2YjQ0NzBkN2UyM2FhYmIwYi1saWJyYXJ5Q29kZV9zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjY291bnRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhZ2luZzogWydmZWRleGdsYmxkZXYnXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9kdWN0aW9uOiBbJ2ZlZGV4Z2xibCddLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmVsb3BtZW50OiBbJ2ZlZGV4Z2xibGRldiddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclZhcmlhYmxlTmFtZTogJ3MnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIxNzEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVhcHBOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OmNvdW50cnlDb2RlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3AzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpsYW5ndWFnZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6cmVnaW9uJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVuY3lDb2RlOiAnVVNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNraW5nU2VydmVyOiAnbWV0cmljcy5mZWRleC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tJbmxpbmVTdGF0czogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja0Rvd25sb2FkTGlua3M6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tFeHRlcm5hbExpbmtzOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtFeHRlcm5hbEZpbHRlcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb3Blbi5zcG90aWZ5LmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BvZGNhc3RzLmFwcGxlLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NvdW5kY2xvdWQuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd3d3LnN0aXRjaGVyLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2V2ZW50Lm9uMjQuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY3VzdG9tYnJhbmRlZGJveGVzLmZlZGV4LmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JpdC5seScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Nwb3RpLmZpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYXBwbGUuY28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua0ludGVybmFsRmlsdGVyczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2luZ1NlcnZlclNlY3VyZTogJ3NtZXRyaWNzLmZlZGV4LmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rRG93bmxvYWRGaWxlVHlwZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZG9jJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZG9jeCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VwcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2pwZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BuZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N2ZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3hscycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BwdHgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwZGYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd4bHN4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGFiJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY3N2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnemlwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHh0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndnNkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndnhkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAneG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjc3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdyYXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdleGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3bWEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtb3YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhdmknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3bXYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtcDMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3YXYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtNHYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdqcGVnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBtb2R1bGVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnc2VuZC1iZWFjb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdTZW5kIEJlYWNvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbignLi4vc2hhcmVkTW9kdWxlcy9nZXRUcmFja2VyJyksIGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5ub2RlTmFtZSAmJiAnYScgPT09IGUubm9kZU5hbWUudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShlKSA/IGUuaW5uZXJIVE1MIDogJ2xpbmsgY2xpY2tlZCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdwYWdlJyA9PT0gdC50eXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubG9nZ2VyLmluZm8oJ0ZpcmluZyBwYWdlIHZpZXcgYmVhY29uLicpLCBlLnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogdC5saW5rVHlwZSB8fCAnbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiB0LmxpbmtOYW1lIHx8IG8obikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubG9nZ2VyLmluZm8oJ0ZpcmluZyBsaW5rIHRyYWNrIGJlYWNvbiB1c2luZyB0aGUgdmFsdWVzOiAnICsgSlNPTi5zdHJpbmdpZnkoaSkgKyAnLicpLCBlLnRsKGEobikgPyBuIDogJ3RydWUnLCBpLmxpbmtUeXBlLCBpLmxpbmtOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSgpLnRoZW4oZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMobiwgZSwgdC5lbGVtZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubG9nZ2VyLmVycm9yKCdDYW5ub3Qgc2VuZCBiZWFjb246ICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3NldC12YXJpYWJsZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdTZXQgVmFyaWFibGVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuKCcuLi9zaGFyZWRNb2R1bGVzL2dldFRyYWNrZXInKSwgYSA9IG4oJy4uL2hlbHBlcnMvYXBwbHlUcmFja2VyVmFyaWFibGVzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoKS50aGVuKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmxvZ2dlci5pbmZvKCdTZXQgdmFyaWFibGVzIG9uIHRoZSB0cmFja2VyLicpLCBhKG4sIGUudHJhY2tlclByb3BlcnRpZXMpLCBlLmN1c3RvbVNldHVwICYmIGUuY3VzdG9tU2V0dXAuc291cmNlICYmIGUuY3VzdG9tU2V0dXAuc291cmNlLmNhbGwodC5lbGVtZW50LCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubG9nZ2VyLmVycm9yKCdDYW5ub3Qgc2V0IHZhcmlhYmxlczogJyArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjbGVhci12YXJpYWJsZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdDbGVhciBWYXJpYWJsZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4oJy4uL3NoYXJlZE1vZHVsZXMvZ2V0VHJhY2tlcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmNsZWFyVmFycyAmJiAoci5sb2dnZXIuaW5mbygnQ2xlYXIgdmFyaWFibGVzLicpLCBlLmNsZWFyVmFycygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubG9nZ2VyLmVycm9yKCdDYW5ub3QgY2xlYXIgdmFyaWFibGVzOiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9zaGFyZWRNb2R1bGVzL2dldFRyYWNrZXIuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpLCBhID0gbignQGFkb2JlL3JlYWN0b3ItY29va2llJyksIG8gPSBuKCdAYWRvYmUvcmVhY3Rvci1wcm9taXNlJyksIHMgPSBuKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgYyA9IG4oJy4uL2hlbHBlcnMvc2V0dGluZ3NIZWxwZXInKSwgdSA9IG4oJy4uL2hlbHBlcnMvYXVnbWVudGVycycpLCBsID0gbignLi4vaGVscGVycy9hcHBseVRyYWNrZXJWYXJpYWJsZXMnKSwgZCA9IG4oJy4uL2hlbHBlcnMvbG9hZExpYnJhcnknKSwgZiA9IG4oJy4uL2hlbHBlcnMvZ2VuZXJhdGVWZXJzaW9uJykoci5idWlsZEluZm8udHVyYmluZUJ1aWxkRGF0ZSksIHAgPSAnYmVmb3JlU2V0dGluZ3MnLCBtID0gci5nZXRTaGFyZWRNb2R1bGUoJ2Fkb2JlLW1jaWQnLCAnbWNpZC1pbnN0YW5jZScpLCBnID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZSB8fCAndHJ1ZScgPT09IGEuZ2V0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLmFsbCh1Lm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8ucmVzb2x2ZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtICYmIChyLmxvZ2dlci5pbmZvKCdTZXR0aW5nIE1DSUQgaW5zdGFuY2Ugb24gdGhlIHRyYWNrZXIuJyksIGUudmlzaXRvciA9IG0pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBiID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmxvZ2dlci5pbmZvKCdTZXR0aW5nIHZlcnNpb24gb24gdHJhY2tlcjogIicgKyBmICsgJyIuJyksIHZvaWQgMCAhPT0gZS50YWdDb250YWluZXJNYXJrZXIgPyBlLnRhZ0NvbnRhaW5lck1hcmtlciA9IGYgOiAnc3RyaW5nJyA9PSB0eXBlb2YgZS52ZXJzaW9uICYmIGUudmVyc2lvbi5zdWJzdHJpbmcoZS52ZXJzaW9uLmxlbmd0aCAtIDUpICE9PSAnLScgKyBmICYmIChlLnZlcnNpb24gKz0gJy0nICsgZiksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQubG9hZFBoYXNlID09PSBwICYmIHQuc291cmNlICYmIChyLmxvZ2dlci5pbmZvKCdDYWxsaW5nIGN1c3RvbSBzY3JpcHQgYmVmb3JlIHNldHRpbmdzLicpLCB0LnNvdXJjZS5jYWxsKHMsIG4pKSwgbChuLCBlIHx8IHt9KSwgdC5sb2FkUGhhc2UgIT09IHAgJiYgdC5zb3VyY2UgJiYgKHIubG9nZ2VyLmluZm8oJ0NhbGxpbmcgY3VzdG9tIHNjcmlwdCBhZnRlciBzZXR0aW5ncy4nKSwgdC5zb3VyY2UuY2FsbChzLCBuKSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIF8gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuaXNBdWRpZW5jZU1hbmFnZW1lbnRFbmFibGVkKGUpICYmICh0LmxvYWRNb2R1bGUoJ0F1ZGllbmNlTWFuYWdlbWVudCcpLCByLmxvZ2dlci5pbmZvKCdJbml0aWFsaXppbmcgQXVkaWVuY2VNYW5hZ2VtZW50IG1vZHVsZScpLCB0LkF1ZGllbmNlTWFuYWdlbWVudC5zZXR1cChlLm1vZHVsZVByb3BlcnRpZXMuYXVkaWVuY2VNYW5hZ2VyLmNvbmZpZykpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBDID0gKGkgPSByLmdldEV4dGVuc2lvblNldHRpbmdzKCksIGcoaS50cmFja2luZ0Nvb2tpZU5hbWUpID8gZChpKS50aGVuKGgpLnRoZW4odikudGhlbihiKS50aGVuKHkuYmluZChudWxsLCBpLnRyYWNrZXJQcm9wZXJ0aWVzLCBpLmN1c3RvbVNldHVwIHx8IHt9KSkudGhlbihfLmJpbmQobnVsbCwgaSkpIDogby5yZWplY3QoJ0VVIGNvbXBsaWFuY2Ugd2FzIG5vdCBhY2tub3dsZWRnZWQgYnkgdGhlIHVzZXIuJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZ2V0LXRyYWNrZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvc2hhcmVkTW9kdWxlcy9hdWdtZW50VHJhY2tlci5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdhdWdtZW50LXRyYWNrZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVkOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuKCcuLi9oZWxwZXJzL2F1Z21lbnRlcnMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2hlbHBlcnMvc2V0dGluZ3NIZWxwZXIuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbignQGFkb2JlL3JlYWN0b3Itd2luZG93JyksIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMSUJfVFlQRVM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQU5BR0VEOiAnbWFuYWdlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJFSU5TVEFMTEVEOiAncHJlaW5zdGFsbGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRU1PVEU6ICdyZW1vdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENVU1RPTTogJ2N1c3RvbScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQU5BR0VEX0xJQl9QQVRIUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFQUF9NRUFTVVJFTUVOVDogJ0FwcE1lYXN1cmVtZW50LmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBQ1RJVklUWV9NQVA6ICdBcHBNZWFzdXJlbWVudF9Nb2R1bGVfQWN0aXZpdHlNYXAuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElFTkNFX01BTkFHRU1FTlQ6ICdBcHBNZWFzdXJlbWVudF9Nb2R1bGVfQXVkaWVuY2VNYW5hZ2VtZW50LmpzJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFJlcG9ydFN1aXRlczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucHJvZHVjdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtyLmJ1aWxkSW5mby5lbnZpcm9ubWVudF0gJiYgKHQgPSBlW3IuYnVpbGRJbmZvLmVudmlyb25tZW50XSksIHQuam9pbignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQWN0aXZpdHlNYXBFbmFibGVkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKGUubGlicmFyeUNvZGUgJiYgIWUubGlicmFyeUNvZGUudXNlQWN0aXZpdHlNYXAgJiYgITEgPT09IGUubGlicmFyeUNvZGUudXNlQWN0aXZpdHlNYXApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQXVkaWVuY2VNYW5hZ2VtZW50RW5hYmxlZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGUubW9kdWxlUHJvcGVydGllcyAmJiBlLm1vZHVsZVByb3BlcnRpZXMuYXVkaWVuY2VNYW5hZ2VyICYmIGUubW9kdWxlUHJvcGVydGllcy5hdWRpZW5jZU1hbmFnZXIuY29uZmlnICYmIGkgJiYgaS5fc2F0ZWxsaXRlICYmIGkuX3NhdGVsbGl0ZS5jb21wYW55ICYmIGkuX3NhdGVsbGl0ZS5jb21wYW55Lm9yZ0lkICYmICh0ID0gITApLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9oZWxwZXJzL2F1Z21lbnRlcnMuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvaGVscGVycy9hcHBseVRyYWNrZXJWYXJpYWJsZXMuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbignQGFkb2JlL3JlYWN0b3ItcXVlcnktc3RyaW5nJyksIGEgPSBuKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgbyA9IC9lVmFyKFswLTldKykvLCBzID0gL3Byb3AoWzAtOV0rKS8sIGMgPSBuZXcgUmVnRXhwKCdeKGVWYXJbMC05XSspfChwcm9wWzAtOV0rKXwoaGllclswLTldKyl8Y2FtcGFpZ258cHVyY2hhc2VJRHxjaGFubmVsfHNlcnZlcnxzdGF0ZXx6aXB8cGFnZVR5cGUkJyksIHUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uaW5kZXhPZihlKSA9PT0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdC5rZXlzKHQpLmZpbHRlcihjLnRlc3QuYmluZChjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiByLnB1c2goJ2V2ZW50cycpLCAociA9IHIuY29uY2F0KChlLmxpbmtUcmFja1ZhcnMgfHwgJycpLnNwbGl0KCcsJykpKS5maWx0ZXIoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ05vbmUnICE9PSBlICYmIGUgJiYgdShlLCB0LCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJywnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChuID0gbi5jb25jYXQoKGUubGlua1RyYWNrRXZlbnRzIHx8ICcnKS5zcGxpdCgnLCcpKSkuZmlsdGVyKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdOb25lJyAhPT0gZSAmJiB1KGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0gPSBuW3RdLmpvaW4oJywnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4uZHluYW1pY1ZhcmlhYmxlUHJlZml4IHx8ICdEPSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3RdLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3ZhbHVlJyA9PT0gdC50eXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gdC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBvLmV4ZWModC52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHIgKyAndicgKyBpWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gcy5leGVjKHQudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiAobiA9IHIgKyAnYycgKyBhWzFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3QubmFtZV0gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rRG93bmxvYWRGaWxlVHlwZXM6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rRXh0ZXJuYWxGaWx0ZXJzOiBmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua0ludGVybmFsRmlsdGVyczogZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhpZXJhcmNoaWVzOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bdF0uZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3QubmFtZV0gPSB0LnNlY3Rpb25zLmpvaW4odC5kZWxpbWl0ZXIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW1wYWlnbjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3F1ZXJ5UGFyYW0nID09PSBuW3RdLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBpLnBhcnNlKGEubG9jYXRpb24uc2VhcmNoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0XSA9IHJbblt0XS52YWx1ZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0gPSBuW3RdLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG5bdF0ubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5uYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5pZCAmJiAodCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmlkCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uam9pbignOicpKSwgZS52YWx1ZSAmJiAodCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnZhbHVlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uam9pbignPScpKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3RdID0gci5qb2luKCcsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQgfHwge30sIE9iamVjdC5rZXlzKHQpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbVtlXSwgaSA9IHRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID8gcihuLCBlLCB0KSA6IG5bZV0gPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbi5ldmVudHMgJiYgZS5ldmVudHMgJiYgZS5ldmVudHMubGVuZ3RoID4gMCAmJiAobi5ldmVudHMgPSBlLmV2ZW50cyArICcsJyArIG4uZXZlbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0ICYmIHQuZXZlbnRzICYmIHQuZXZlbnRzLmxlbmd0aCA+IDAsIGEgPSBsKGUsIG4sIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhICYmIChuLmxpbmtUcmFja1ZhcnMgPSBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBkKGUsIHQuZXZlbnRzIHx8IFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyAmJiAobi5saW5rVHJhY2tFdmVudHMgPSBvKSwgci5sb2dnZXIuaW5mbygnQXBwbHlpbmcgdGhlIGZvbGxvd2luZyBwcm9wZXJ0aWVzIG9uIHRyYWNrZXI6ICInICsgSlNPTi5zdHJpbmdpZnkobikgKyAnIi4nKSwgT2JqZWN0LmtleXMobikuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0XSA9IG5bdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9oZWxwZXJzL2xvYWRMaWJyYXJ5LmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4oJ0BhZG9iZS9yZWFjdG9yLWxvYWQtc2NyaXB0JyksIGEgPSBuKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgbyA9IG4oJ0BhZG9iZS9yZWFjdG9yLXByb21pc2UnKSwgcyA9IG4oJy4vc2V0dGluZ3NIZWxwZXInKSwgYyA9IG4oJy4vcG9sbEhlbHBlcicpLCB1ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYS5zX2dpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignVW5hYmxlIHRvIGNyZWF0ZSBBcHBNZWFzdXJlbWVudCB0cmFja2VyLCBgc19naWAgZnVuY3Rpb24gbm90IGZvdW5kLicgKyBhLkFwcE1lYXN1cmVtZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubG9nZ2VyLmluZm8oJ0NyZWF0aW5nIEFwcE1lYXN1cmVtZW50IHRyYWNrZXIgd2l0aCB0aGVzZSByZXBvcnQgc3VpdGVzOiAiJyArIHQgKyAnIicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhLnNfZ2kodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5saWJyYXJ5Q29kZS5zY29wZVRyYWNrZXJHbG9iYWxseSAmJiAoci5sb2dnZXIuaW5mbygnU2V0dGluZyB0aGUgdHJhY2tlciBhcyB3aW5kb3cucycpLCBhLnMgPSBuKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLmxpYnJhcnlDb2RlLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugcy5MSUJfVFlQRVMuTUFOQUdFRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goci5nZXRIb3N0ZWRMaWJGaWxlVXJsKHMuTUFOQUdFRF9MSUJfUEFUSFMuQVBQX01FQVNVUkVNRU5UKSksIHMuaXNBY3Rpdml0eU1hcEVuYWJsZWQoZSkgJiYgdC5wdXNoKHIuZ2V0SG9zdGVkTGliRmlsZVVybChzLk1BTkFHRURfTElCX1BBVEhTLkFDVElWSVRZX01BUCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBzLkxJQl9UWVBFUy5DVVNUT006CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKGUubGlicmFyeUNvZGUuc291cmNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugcy5MSUJfVFlQRVMuUkVNT1RFOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaCgnaHR0cHM6JyA9PT0gYS5sb2NhdGlvbi5wcm90b2NvbCA/IGUubGlicmFyeUNvZGUuaHR0cHNVcmwgOiBlLmxpYnJhcnlDb2RlLmh0dHBVcmwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMuaXNBdWRpZW5jZU1hbmFnZW1lbnRFbmFibGVkKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7IG5hbWVzcGFjZTogYS5fc2F0ZWxsaXRlLmNvbXBhbnkub3JnSWQgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm1vZHVsZVByb3BlcnRpZXMuYXVkaWVuY2VNYW5hZ2VyLmNvbmZpZy52aXNpdG9yU2VydmljZSA9IG4sIHQucHVzaChyLmdldEhvc3RlZExpYkZpbGVVcmwocy5NQU5BR0VEX0xJQl9QQVRIUy5BVURJRU5DRV9NQU5BR0VNRU5UKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5hbGwobChlKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5sb2dnZXIuaW5mbygnTG9hZGluZyBzY3JpcHQ6ICcgKyBlKSwgaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5saWJyYXJ5Q29kZS5hY2NvdW50cykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5zYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHMuZ2V0UmVwb3J0U3VpdGVzKGUubGlicmFyeUNvZGUuYWNjb3VudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmxvZ2dlci5pbmZvKCdTZXR0aW5nIHRoZSBmb2xsb3dpbmcgcmVwb3J0IHN1aXRlcyBvbiB0aGUgdHJhY2tlcjogIicgKyBuICsgJyInKSwgdC5zYShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5sb2dnZXIud2FybignQ2Fubm90IHNldCByZXBvcnQgc3VpdGVzIG9uIHRyYWNrZXIuIGBzYWAgbWV0aG9kIG5vdCBhdmFpbGFibGUuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYVtlXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5sb2dnZXIuaW5mbygnRm91bmQgdHJhY2tlciBsb2NhdGVkIGF0OiAiJyArIGUgKyAnIi4nKSwgYVtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQ2Fubm90IGZpbmQgdGhlIGdsb2JhbCB2YXJpYWJsZSBuYW1lOiAiJyArIGUgKyAnIi4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5saWJyYXJ5Q29kZS50eXBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugcy5MSUJfVFlQRVMuTUFOQUdFRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gcy5nZXRSZXBvcnRTdWl0ZXMoZS5saWJyYXJ5Q29kZS5hY2NvdW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50aGVuKHUuYmluZChudWxsLCBlLCBuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugcy5MSUJfVFlQRVMuUFJFSU5TVEFMTEVEOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudGhlbihjLnBvbGwuYmluZChudWxsLCBhLCBlLmxpYnJhcnlDb2RlLnRyYWNrZXJWYXJpYWJsZU5hbWUpKS50aGVuKGYuYmluZChudWxsLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugcy5MSUJfVFlQRVMuQ1VTVE9NOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHMuTElCX1RZUEVTLlJFTU9URToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnRoZW4ocC5iaW5kKG51bGwsIGUubGlicmFyeUNvZGUudHJhY2tlclZhcmlhYmxlTmFtZSkpLnRoZW4oZi5iaW5kKG51bGwsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQ2Fubm90IGxvYWQgbGlicmFyeS4gVHlwZSBub3Qgc3VwcG9ydGVkLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2hlbHBlcnMvZ2VuZXJhdGVWZXJzaW9uLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IDgsIG4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZ2V0VVRDRGF0ZSgpLnRvU3RyaW5nKDM2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdWJzdHIoZS5sZW5ndGggLSAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWF0aC5mbG9vcihlLmdldFVUQ0hvdXJzKCkgLyB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IChlLmdldFVUQ01vbnRoKCkgKyAxICsgMTIgKiBpKGUpKS50b1N0cmluZygzNik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUuZ2V0VVRDRnVsbFllYXIoKSAtIDIwMTApLnRvU3RyaW5nKDM2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG5ldyBEYXRlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNOYU4odCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ludmFsaWQgZGF0ZSBwcm92aWRlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKCdMJyArIG8odCkgKyBhKHQpICsgbih0KSkudG9VcHBlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvaGVscGVycy9wb2xsSGVscGVyLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4oJ0BhZG9iZS9yZWFjdG9yLXByb21pc2UnKSwgYSA9IDQwLCBvID0gMjUwLCBzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubG9nZ2VyLmluZm8oJ0ZvdW5kIHByb3BlcnR5IGxvY2F0ZWQgYXQ6ICInICsgdCArICciXS4nKSwgZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGkoZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVt0XSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMobiwgdCwgZVt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAxLCBjID0gc2V0SW50ZXJ2YWwoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0XSAmJiAocyhuLCB0LCBlW3RdKSwgY2xlYXJJbnRlcnZhbChjKSksIGkgPj0gYSAmJiAoY2xlYXJJbnRlcnZhbChjKSwgcihuZXcgRXJyb3IoJ0JhaWxpbmcgb3V0LiBDYW5ub3QgZmluZCB0aGUgdmFyaWFibGUgbmFtZTogIicgKyB0ICsgJyJdLicpKSksIGkrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvbGw6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5sb2dnZXIuaW5mbygnV2FpdGluZyBmb3IgdGhlIHByb3BlcnR5IHRvIGJlY29tZSBhY2Nlc3NpYmxlIGF0OiAiJyArIHQgKyAnIl0uJyksIGMoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGNvcmU6IHsKICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0NvcmUnLAogICAgICAgICAgICAgICAgICAgIGhvc3RlZExpYkZpbGVzQmFzZVVybDogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS9leHRlbnNpb25zL0VQMGZlNmIxYjMxNzBiNDE0ZTkyZThmN2FkNGY3NGY4NTcvJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY3VzdG9tLWNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdDdXN0b20gQ29kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnNvdXJjZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnamF2YXNjcmlwdC12YXJpYWJsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0phdmFTY3JpcHQgVmFyaWFibGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJy4uL2hlbHBlcnMvZ2V0T2JqZWN0UHJvcGVydHkuanMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih3aW5kb3csIGUucGF0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvcXVlcnlTdHJpbmdQYXJhbWV0ZXIuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncXVlcnktc3RyaW5nLXBhcmFtZXRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ1F1ZXJ5IFN0cmluZyBQYXJhbWV0ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLCBpID0gbignQGFkb2JlL3JlYWN0b3ItcXVlcnktc3RyaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpLnBhcnNlKHIubG9jYXRpb24uc2VhcmNoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlLmNhc2VJbnNlbnNpdGl2ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W2UubmFtZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBlLm5hbWUudG9Mb3dlckNhc2UoKSwgYSA9IE9iamVjdC5rZXlzKHQpLCBvID0gMDsgbyA8IGEubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gYVtvXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzLnRvTG93ZXJDYXNlKCkgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbc107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9saWJyYXJ5TG9hZGVkLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2xpYnJhcnktbG9hZGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnTGlicmFyeSBMb2FkZWQgKFBhZ2UgVG9wKScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbignLi9oZWxwZXJzL3BhZ2VMaWZlY3ljbGVFdmVudHMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnJlZ2lzdGVyTGlicmFyeUxvYWRlZFRyaWdnZXIodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY3VzdG9tLWNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdDdXN0b20gQ29kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpLCBhLCBvLCBzID0gbignQGFkb2JlL3JlYWN0b3ItZG9jdW1lbnQnKSwgYyA9IG4oJy4vaGVscGVycy9kZWNvcmF0ZUNvZGUnKSwgdSA9IG4oJy4vaGVscGVycy9sb2FkQ29kZVNlcXVlbnRpYWxseScpLCBsID0gbignLi4vLi4vLi4vbm9kZV9tb2R1bGVzL3Bvc3RzY3JpYmUvZGlzdC9wb3N0c2NyaWJlJyksIGQgPSByLmdldEV4dGVuc2lvblNldHRpbmdzKCksIGYgPSAoaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsKHMuYm9keSwgZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlZm9yZVdyaXRlVG9rZW46IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkLmNzcE5vbmNlICYmICdzY3JpcHQnID09PSBlLnRhZ05hbWUgJiYgKGUuYXR0cnMubm9uY2UgPSBkLmNzcE5vbmNlKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmxvZ2dlci5lcnJvcihlLm1zZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEgPSBbXSwgbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzLmJvZHkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGEubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShhLnNoaWZ0KCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQobywgMjApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5wdXNoKGUpLCBvKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBwID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMuY3VycmVudFNjcmlwdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5jdXJyZW50U2NyaXB0LmFzeW5jOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHMucXVlcnlTZWxlY3RvckFsbCgnc2NyaXB0JyksIHQgPSAwOyB0IDwgZS5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoLyhsYXVuY2h8c2F0ZWxsaXRlTGliKS1bXlwvXSsuanMoXD8uKik/JC8udGVzdChuLnNyYykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmFzeW5jOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQ6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIgPSBuLnNldHRpbmdzLnNvdXJjZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5zZXR0aW5ncy5pc0V4dGVybmFsID8gdShyKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiBmKGMobiwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiB2b2lkIChwIHx8ICdsb2FkaW5nJyAhPT0gcy5yZWFkeVN0YXRlID8gZihjKG4sIHIpKSA6IHMud3JpdGUgPyBzLndyaXRlKGMobiwgcikpIDogZihjKG4sIHIpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY3VzdG9tLWNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdDdXN0b20gQ29kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnNvdXJjZS5jYWxsKHQuZWxlbWVudCwgdCwgdC50YXJnZXQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL2N1c3RvbUV2ZW50LmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2N1c3RvbS1ldmVudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0N1c3RvbSBFdmVudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbignLi9oZWxwZXJzL2NyZWF0ZUJ1YmJseScpKCksIGkgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUudHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEgPT09IGkuaW5kZXhPZihuKSAmJiAoaS5wdXNoKG4pLCB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcihuLCByLmV2YWx1YXRlRXZlbnQsICEwKSksIHIuYWRkTGlzdGVuZXIoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmF0aXZlRXZlbnQudHlwZSA9PT0gbiAmJiAoZS5kZXRhaWwgPSBlLm5hdGl2ZUV2ZW50LmRldGFpbCwgdChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9wYXRoQW5kUXVlcnlzdHJpbmcuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncGF0aC1hbmQtcXVlcnlzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdQYXRoIEFuZCBRdWVyeSBTdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJ0BhZG9iZS9yZWFjdG9yLWRvY3VtZW50JyksIGkgPSBuKCcuLi9oZWxwZXJzL3RleHRNYXRjaCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gci5sb2NhdGlvbi5wYXRobmFtZSArIHIubG9jYXRpb24uc2VhcmNoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wYXRocy5zb21lKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUudmFsdWVJc1JlZ2V4ID8gbmV3IFJlZ0V4cChlLnZhbHVlLCAnaScpIDogZS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3BhZ2UtYm90dG9tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnUGFnZSBCb3R0b20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJy4vaGVscGVycy9wYWdlTGlmZWN5Y2xlRXZlbnRzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5yZWdpc3RlclBhZ2VCb3R0b21UcmlnZ2VyKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2NsaWNrJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQ2xpY2snLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLCBpID0gbignLi9oZWxwZXJzL2NyZWF0ZUJ1YmJseScpKCksIGEgPSBuZXcgKG4oJy4vaGVscGVycy93ZWFrTWFwJykpKCksIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGU7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnRhZ05hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgJ2EnID09PSB0LnRvTG93ZXJDYXNlKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmdldEF0dHJpYnV0ZSgnaHJlZicpLCBpID0gZS5nZXRBdHRyaWJ1dGUoJ3RhcmdldCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiAoIWkgfHwgJ19zZWxmJyA9PT0gaSB8fCAnX3RvcCcgPT09IGkgJiYgci50b3AgPT09IHIgfHwgaSA9PT0gci5uYW1lKSA/IGUgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLnBhcmVudE5vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCBpLmV2YWx1YXRlRXZlbnQsICEwKSwgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5hZGRMaXN0ZW5lcihlLCBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuLm5hdGl2ZUV2ZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpLnNfZmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5hbmNob3JEZWxheSAmJiAhYS5oYXMoaSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBvKGkudGFyZ2V0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyAmJiAoaS5wcmV2ZW50RGVmYXVsdCgpLCBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubG9jYXRpb24gPSBzLmhyZWY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuYW5jaG9yRGVsYXkpKSwgYS5zZXQoaSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmV4cG9ydHMuX19yZXNldCA9IGkuX19yZXNldDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL3BhdGguanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncGF0aCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ1BhdGggV2l0aG91dCBRdWVyeSBTdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJ0BhZG9iZS9yZWFjdG9yLWRvY3VtZW50JyksIGkgPSBuKCcuLi9oZWxwZXJzL3RleHRNYXRjaCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gci5sb2NhdGlvbi5wYXRobmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucGF0aHMuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLnZhbHVlSXNSZWdleCA/IG5ldyBSZWdFeHAoZS52YWx1ZSwgJ2knKSA6IGUudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvbWVkaWFUaW1lUGxheWVkLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ21lZGlhLXRpbWUtcGxheWVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnTWVkaWEgVGltZSBQbGF5ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJy4vaGVscGVycy9jcmVhdGVCdWJibHknKSgpLCBpID0gbmV3IChuKCcuL2hlbHBlcnMvd2Vha01hcCcpKSgpLCBhID0gW10sIG8gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTRUNPTkQ6ICdzZWNvbmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUEVSQ0VOVDogJ3BlcmNlbnQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnRhcmdldDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LnNlZWthYmxlICYmIHQuc2Vla2FibGUubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LnNlZWthYmxlLCBzID0gbi5zdGFydCgwKSwgYyA9IG4uZW5kKDApLCB1ID0gdC5jdXJyZW50VGltZSAtIHMsIGwgPSBpLmdldCh0KSB8fCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUudW5pdCA9PT0gby5TRUNPTkQgPyBlLmFtb3VudCA6IChjIC0gcykgKiAoZS5hbW91bnQgLyAxMDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID4gbCAmJiBuIDw9IHUgJiYgci5ldmFsdWF0ZUV2ZW50KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldDogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFtb3VudDogZS5hbW91bnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bml0OiBlLnVuaXQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpLnNldCh0LCB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5hZGRFdmVudExpc3RlbmVyKCd0aW1ldXBkYXRlJywgcywgITApLCBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hbW91bnQgPT09IGUuYW1vdW50ICYmIHQudW5pdCA9PT0gZS51bml0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnNvbWUobikgfHwgYS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFtb3VudDogZS5hbW91bnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bml0OiBlLnVuaXQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIuYWRkTGlzdGVuZXIoZSwgZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmFtb3VudCAhPT0gZS5hbW91bnQgfHwgbi51bml0ICE9PSBlLnVuaXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvZWxlbWVudEV4aXN0cy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlbGVtZW50LWV4aXN0cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0VsZW1lbnQgRXhpc3RzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAzMDAwLCBpID0gbmV3IChuKCcuL2hlbHBlcnMvd2Vha01hcCcpKSgpLCBhID0gbignLi9oZWxwZXJzL21hdGNoZXNQcm9wZXJ0aWVzJyksIG8gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRJbnRlcnZhbChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKG8pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBvW2VdLCBuID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbChlKSwgciA9IDA7IHIgPCBuLmxlbmd0aDsgcisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBuW3JdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaS5oYXMocykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5zZXQocywgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IHQubGVuZ3RoOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gdFtjXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEocywgdS5zZXR0aW5ncy5lbGVtZW50UHJvcGVydGllcykgJiYgKHUudHJpZ2dlcih7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudDogcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0LnNwbGljZShjLCAxKSwgYy0tKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXQubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBvW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIpLCBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG9bZS5lbGVtZW50U2VsZWN0b3JdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuIHx8IChuID0gb1tlLmVsZW1lbnRTZWxlY3Rvcl0gPSBbXSksIG4ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyaWdnZXI6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvZG9tUmVhZHkuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZG9tLXJlYWR5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnRE9NIFJlYWR5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuKCcuL2hlbHBlcnMvcGFnZUxpZmVjeWNsZUV2ZW50cycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucmVnaXN0ZXJEb21SZWFkeVRyaWdnZXIodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL3ZhbHVlQ29tcGFyaXNvbi5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICd2YWx1ZS1jb21wYXJpc29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnVmFsdWUgQ29tcGFyaXNvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnbnVtYmVyJyA9PSB0eXBlb2YgZSAmJiBpc0Zpbml0ZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGUgfHwgZSBpbnN0YW5jZW9mIFN0cmluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiBuKGUpID8gZS50b0xvd2VyQ2FzZSgpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdChlKSA/IFN0cmluZyhlKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oZSkgPyBOdW1iZXIoZSkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgciwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gaSh0KSwgciA9IGkociksIG4odCkgJiYgbihyKSAmJiBlKHQsIHIsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9IGEobiksIHIgPSBhKHIpLCB0KG4pICYmIHQocikgJiYgZShuLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUocih0LCBpKSwgcihuLCBpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB1ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXF1YWxzOiBjKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9lc05vdEVxdWFsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF1LmVxdWFscy5hcHBseShudWxsLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRhaW5zOiBvKGMoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgIT09IGUuaW5kZXhPZih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvZXNOb3RDb250YWluOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF1LmNvbnRhaW5zLmFwcGx5KG51bGwsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRzV2l0aDogbyhjKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPT09IGUuaW5kZXhPZih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvZXNOb3RTdGFydFdpdGg6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXUuc3RhcnRzV2l0aC5hcHBseShudWxsLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZHNXaXRoOiBvKGMoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdWJzdHJpbmcoZS5sZW5ndGggLSB0Lmxlbmd0aCwgZS5sZW5ndGgpID09PSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9lc05vdEVuZFdpdGg6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXUuZW5kc1dpdGguYXBwbHkobnVsbCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXRjaGVzUmVnZXg6IG8oZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFJlZ0V4cCh0LCBuID8gJ2knIDogJycpLnRlc3QoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvZXNOb3RNYXRjaFJlZ2V4OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF1Lm1hdGNoZXNSZWdleC5hcHBseShudWxsLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlc3NUaGFuOiBzKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXNzVGhhbk9yRXF1YWw6IHMoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA8PSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBncmVhdGVyVGhhbjogcyhmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3JlYXRlclRoYW5PckVxdWFsOiBzKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPj0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNUcnVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc1RydXRoeTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQm9vbGVhbihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0ZhbHNlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMSA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0ZhbHN5OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdVtlLmNvbXBhcmlzb24ub3BlcmF0b3JdKGUubGVmdE9wZXJhbmQsIGUucmlnaHRPcGVyYW5kLCBCb29sZWFuKGUuY29tcGFyaXNvbi5jYXNlSW5zZW5zaXRpdmUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy90aW1lT25QYWdlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3RpbWUtb24tcGFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ1RpbWUgT24gUGFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbignQGFkb2JlL3JlYWN0b3ItZG9jdW1lbnQnKSwgaSA9IG4oJy4vaGVscGVycy9vbmNlJyksIGEgPSBuKCcuL2hlbHBlcnMvdmlzaWJpbGl0eUFwaScpKCksIG8gPSBuKCcuL2hlbHBlcnMvdGltZXInKSwgcyA9IGEuaGlkZGVuUHJvcGVydHksIGMgPSBhLnZpc2liaWxpdHlDaGFuZ2VFdmVudFR5cGUsIHUgPSB7fSwgbCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHsgdGltZU9uUGFnZTogZSAvIDEwMDAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVbZV0uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IGkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZXcgbygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUub24oJ21hcmtlclBhc3NlZCcsIGwpLCByLmFkZEV2ZW50TGlzdGVuZXIoYywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbc10gPyBlLnBhdXNlKCkgOiBlLnJlc3VtZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApLCBlLnN0YXJ0KCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZCgpLCByID0gMTAwMCAqIGUudGltZU9uUGFnZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5hZGRNYXJrZXIociksIHVbcl0gfHwgKHVbcl0gPSBbXSksIHVbcl0ucHVzaCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9kYXRhRWxlbWVudENoYW5nZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdkYXRhLWVsZW1lbnQtY2hhbmdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnRGF0YSBFbGVtZW50IENoYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0ge30sIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRJbnRlcnZhbChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKGkpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gSlNPTi5zdHJpbmdpZnkoci5nZXREYXRhRWxlbWVudFZhbHVlKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICE9PSBhW2VdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7IGRhdGFFbGVtZW50TmFtZTogZSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlbZV0uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhW2VdID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTAwMCksIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5uYW1lLCBvID0gaVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyB8fCAobyA9IGlbbl0gPSBbXSwgYVtuXSA9IEpTT04uc3RyaW5naWZ5KHIuZ2V0RGF0YUVsZW1lbnRWYWx1ZShuKSkpLCBvLnB1c2godCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2Nvb2tpZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjb29raWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdDb29raWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJ0BhZG9iZS9yZWFjdG9yLWNvb2tpZScpLCBpID0gbignLi4vaGVscGVycy90ZXh0TWF0Y2gnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudmFsdWVJc1JlZ2V4ID8gbmV3IFJlZ0V4cChlLnZhbHVlLCAnaScpIDogZS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoci5nZXQoZS5uYW1lKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2hhbmdlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2NoYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0NoYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbignLi9oZWxwZXJzL2NyZWF0ZUJ1YmJseScpKCksIGkgPSBuKCcuLi9oZWxwZXJzL3RleHRNYXRjaCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ2NoYW5nZScsIHIuZXZhbHVhdGVFdmVudCwgITApLCBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBlLnZhbHVlICYmIChuID0gZS52YWx1ZUlzUmVnZXggPyBuZXcgUmVnRXhwKGUudmFsdWUsICdpJykgOiBlLnZhbHVlKSwgci5hZGRMaXN0ZW5lcihlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gbiAmJiAhaShlLnRhcmdldC52YWx1ZSwgbikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL21heEZyZXF1ZW5jeS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdtYXgtZnJlcXVlbmN5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnTWF4IEZyZXF1ZW5jeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbignLi4vaGVscGVycy92aXNpdG9yVHJhY2tpbmcnKSwgaSA9IG4oJy4uL2hlbHBlcnMvZ2V0TmFtZXNwYWNlZFN0b3JhZ2UnKSgnbG9jYWxTdG9yYWdlJywgJ21heEZyZXF1ZW5jeScpLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vjb25kOiAxMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWludXRlOiA2MDAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhvdXI6IDM2MDAwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXk6IDg2NDAwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2VlazogNjA0ODAwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9udGg6IDI2Nzg0MDAwMDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuJHJ1bGUuaWQgKyAnLicgKyBlLnVuaXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS51bml0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3BhZ2VWaWV3JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gci5nZXRMaWZldGltZVBhZ2VWaWV3Q291bnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvIC0gTnVtYmVyKGkuZ2V0SXRlbShuKSB8fCAwKSA+PSBlLmNvdW50KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLnNldEl0ZW0obiwgbyksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3Nlc3Npb24nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSByLmdldFNlc3Npb25Db3VudCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMgLSBOdW1iZXIoaS5nZXRJdGVtKG4pIHx8IDApID49IGUuY291bnQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuc2V0SXRlbShuLCBzKSwgITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndmlzaXRvcic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWkuZ2V0SXRlbShuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5zZXRJdGVtKG4sICd0cnVlJyksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3NlY29uZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ21pbnV0ZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2hvdXInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdkYXknOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd3ZWVrJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbW9udGgnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChOdW1iZXIoaS5nZXRJdGVtKG4pIHx8IDApIDw9IGMgLSBlLmNvdW50ICogYVtlLnVuaXRdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLnNldEl0ZW0obiwgYyksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvdmFyaWFibGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAndmFyaWFibGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdWYXJpYWJsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbignLi4vaGVscGVycy9nZXRPYmplY3RQcm9wZXJ0eScpLCBpID0gbignLi4vaGVscGVycy90ZXh0TWF0Y2gnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudmFsdWVJc1JlZ2V4ID8gbmV3IFJlZ0V4cChlLnZhbHVlLCAnaScpIDogZS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkocih3aW5kb3csIGUubmFtZSksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvaGVscGVycy9nZXRPYmplY3RQcm9wZXJ0eS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IHQuc3BsaXQoJy4nKSwgciA9IGUsIGkgPSAwLCBhID0gbi5sZW5ndGg7IGkgPCBhOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHJbbltpXV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvaGVscGVycy9wYWdlTGlmZWN5Y2xlRXZlbnRzLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLCBpID0gbignQGFkb2JlL3JlYWN0b3ItZG9jdW1lbnQnKSwgYSA9IC0xICE9PSByLm5hdmlnYXRvci5hcHBWZXJzaW9uLmluZGV4T2YoJ01TSUUgMTAnKSwgbyA9ICdXSU5ET1dfTE9BREVEJywgcyA9ICdET01fUkVBRFknLCBjID0gJ1BBR0VfQk9UVE9NJywgdSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBsID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlRXZlbnQ6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFtlXSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUuc2xpY2UoMCwgbShlKSArIDEpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnKHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHAgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2NvbXBsZXRlJyA9PT0gaS5yZWFkeVN0YXRlID8gbyA6ICdpbnRlcmFjdGl2ZScgPT09IGkucmVhZHlTdGF0ZSA/IGEgPyBudWxsIDogcyA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdS5pbmRleE9mKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBnID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRbdF0uZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZFt0XSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBoID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC50cmlnZ2VyLCByID0gdC5zeW50aGV0aWNFdmVudEZuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihyID8gcihlKSA6IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuX3NhdGVsbGl0ZSA9IHIuX3NhdGVsbGl0ZSB8fCB7fSwgci5fc2F0ZWxsaXRlLnBhZ2VCb3R0b20gPSBmLmJpbmQobnVsbCwgYyksIGkuYWRkRXZlbnRMaXN0ZW5lcignRE9NQ29udGVudExvYWRlZCcsIGYuYmluZChudWxsLCBzKSwgITApLCByLmFkZEV2ZW50TGlzdGVuZXIoJ2xvYWQnLCBmLmJpbmQobnVsbCwgbyksICEwKSwgci5zZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBwKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgJiYgZihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAwKSwgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpc3RlckxpYnJhcnlMb2FkZWRUcmlnZ2VyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpc3RlclBhZ2VCb3R0b21UcmlnZ2VyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFtjXS5wdXNoKHsgdHJpZ2dlcjogZSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVnaXN0ZXJEb21SZWFkeVRyaWdnZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW3NdLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyaWdnZXI6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3ludGhldGljRXZlbnRGbjogbC5iaW5kKG51bGwsIGkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVnaXN0ZXJXaW5kb3dMb2FkZWRUcmlnZ2VyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFtvXS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmlnZ2VyOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN5bnRoZXRpY0V2ZW50Rm46IGwuYmluZChudWxsLCByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2FjdGlvbnMvaGVscGVycy9kZWNvcmF0ZUNvZGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gMCwgYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zZXR0aW5ncy5pc0V4dGVybmFsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnPHNjcmlwdD5cbicgKyB0ICsgJ1xuPC9zY3JpcHQ+JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICdfX3J1blNjcmlwdCcgKyArK2k7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3NhdGVsbGl0ZVtuXSA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5jYWxsKGUuZXZlbnQuZWxlbWVudCwgZS5ldmVudCwgZS5ldmVudC50YXJnZXQpLCBkZWxldGUgX3NhdGVsbGl0ZVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICc8c2NyaXB0Pl9zYXRlbGxpdGVbIicgKyBuICsgJyJdKGZ1bmN0aW9uKGV2ZW50LCB0YXJnZXQpIHtcbicgKyB0ICsgJ1xufSk7PC9zY3JpcHQ+JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGphdmFzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc2V0dGluZ3MuZ2xvYmFsID8gbyhlLCB0KSA6IHMoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShlKSA/IHIucmVwbGFjZVRva2Vucyh0LCBlLmV2ZW50KSA6IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNbZS5zZXR0aW5ncy5sYW5ndWFnZV0oZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2hlbHBlcnMvbG9hZENvZGVTZXF1ZW50aWFsbHkuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbignQGFkb2JlL3JlYWN0b3ItcHJvbWlzZScpLCBpID0gbignLi9nZXRTb3VyY2VCeVVybCcpLCBhID0gci5yZXNvbHZlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuZXcgcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5hbGwoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA9IHQsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvbm9kZV9tb2R1bGVzL3Bvc3RzY3JpYmUvZGlzdC9wb3N0c2NyaWJlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB0aGlzLCByID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuW3JdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbltyXS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbltyXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwb3J0czoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2FkZWQ6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtyXS5jYWxsKGkuZXhwb3J0cywgaSwgaS5leHBvcnRzLCB0KSwgaS5sb2FkZWQgPSAhMCwgaS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lm0gPSBlLCB0LmMgPSBuLCB0LnAgPSAnJywgdCgwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5fX2VzTW9kdWxlID8gZSA6IHsgZGVmYXVsdDogZSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHIobigxKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gaS5kZWZhdWx0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiBlLl9fZXNNb2R1bGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSwgbikgJiYgKHRbbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZGVmYXVsdCA9IGUsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLl9fZXNNb2R1bGUgPyBlIDogeyBkZWZhdWx0OiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbS5zaGlmdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBkLmxhc3QoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmFmdGVyRGVxdWV1ZSgpLCBlLnN0cmVhbSA9IHMuYXBwbHkodm9pZCAwLCBlKSwgdC5hZnRlclN0cmVhbVN0YXJ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IG4uYmVmb3JlV3JpdGUoZSksIGcud3JpdGUoZSksIG4uYWZ0ZXJXcml0ZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZyA9IG5ldyBsLmRlZmF1bHQoZSwgbikpLmlkID0gcCsrLCBnLm5hbWUgPSBuLm5hbWUgfHwgZy5pZCwgYy5zdHJlYW1zW2cubmFtZV0gPSBnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUub3duZXJEb2N1bWVudCwgcyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbG9zZTogaS5jbG9zZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcGVuOiBpLm9wZW4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGU6IGkud3JpdGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGVsbjogaS53cml0ZWxuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1KGksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsb3NlOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3BlbjogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGgsIHQgPSBBcnJheShlKSwgbiA9IDA7IG4gPCBlOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbbl0gPSBhcmd1bWVudHNbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodC5qb2luKCcnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGVsbjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoLCB0ID0gQXJyYXkoZSksIG4gPSAwOyBuIDwgZTsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W25dID0gYXJndW1lbnRzW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQuam9pbignJykgKyAnXG4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gZy53aW4ub25lcnJvciB8fCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy53aW4ub25lcnJvciA9IGZ1bmN0aW9uIChlLCB0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmVycm9yKHsgbXNnOiBlICsgJyAtICcgKyB0ICsgJzogJyArIHIgfSksIGQuYXBwbHkoZy53aW4sIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGcud3JpdGUodCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdShpLCBzKSwgZy53aW4ub25lcnJvciA9IGQsIG4uZG9uZSgpLCBnID0gbnVsbCwgbygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkLmlzRnVuY3Rpb24obikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0geyBkb25lOiBuIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCdjbGVhcicgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbSA9IFtdLCBnID0gbnVsbCwgdm9pZCAocCA9IDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gZC5kZWZhdWx0cyhuLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gL14jLy50ZXN0KGUpID8gd2luZG93LmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGUuc3Vic3RyKDEpKSA6IGUuanF1ZXJ5ID8gZVswXSA6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wb3N0c2NyaWJlID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuY2VsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5zdHJlYW0gPyByLnN0cmVhbS5hYm9ydCgpIDogclsxXSA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4uYmVmb3JlRW5xdWV1ZShyKSwgbS5wdXNoKHIpLCBnIHx8IG8oKSwgZS5wb3N0c2NyaWJlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ll9fZXNNb2R1bGUgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChuLCByKSAmJiAoZVtyXSA9IG5bcl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5kZWZhdWx0ID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGkobigyKSksIGQgPSByKG4oNCkpLCBmID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWZ0ZXJBc3luYzogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFmdGVyRGVxdWV1ZTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFmdGVyU3RyZWFtU3RhcnQ6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZnRlcldyaXRlOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXV0b0ZpeDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiZWZvcmVFbnF1ZXVlOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmVmb3JlV3JpdGVUb2tlbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiZWZvcmVXcml0ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGUubXNnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWxlYXNlQXN5bmM6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHAgPSAwLCBtID0gW10sIGcgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUoYywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJlYW1zOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVldWU6IG0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdyaXRlU3RyZWFtOiBsLmRlZmF1bHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZS5fX2VzTW9kdWxlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsIG4pICYmICh0W25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmRlZmF1bHQgPSBlLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5fX2VzTW9kdWxlID8gZSA6IHsgZGVmYXVsdDogZSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoZSBpbnN0YW5jZW9mIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQ2Fubm90IGNhbGwgYSBjbGFzcyBhcyBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGYgKyB0LCByID0gZS5nZXRBdHRyaWJ1dGUobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsLmV4aXN0eShyKSA/IFN0cmluZyhyKSA6IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzJdID8gYXJndW1lbnRzWzJdIDogbnVsbCwgciA9IGYgKyB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLmV4aXN0eShuKSAmJiAnJyAhPT0gbiA/IGUuc2V0QXR0cmlidXRlKHIsIG4pIDogZS5yZW1vdmVBdHRyaWJ1dGUocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuX19lc01vZHVsZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChuLCByKSAmJiAoZVtyXSA9IG5bcl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHUgPSBpKG4oMykpLCBsID0gcihuKDQpKSwgZCA9ICExLCBmID0gJ2RhdGEtcHMtJywgcCA9ICdwcy1zdHlsZScsIG0gPSAncHMtc2NyaXB0JywgZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKHRoaXMsIGUpLCB0aGlzLnJvb3QgPSB0LCB0aGlzLm9wdGlvbnMgPSBuLCB0aGlzLmRvYyA9IHQub3duZXJEb2N1bWVudCwgdGhpcy53aW4gPSB0aGlzLmRvYy5kZWZhdWx0VmlldyB8fCB0aGlzLmRvYy5wYXJlbnRXaW5kb3csIHRoaXMucGFyc2VyID0gbmV3IHUuZGVmYXVsdCgnJywgeyBhdXRvRml4OiBuLmF1dG9GaXggfSksIHRoaXMuYWN0dWFscyA9IFt0XSwgdGhpcy5wcm94eUhpc3RvcnkgPSAnJywgdGhpcy5wcm94eVJvb3QgPSB0aGlzLmRvYy5jcmVhdGVFbGVtZW50KHQubm9kZU5hbWUpLCB0aGlzLnNjcmlwdFN0YWNrID0gW10sIHRoaXMud3JpdGVRdWV1ZSA9IFtdLCBzKHRoaXMucHJveHlSb290LCAncHJveHlvZicsIDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJvdG90eXBlLndyaXRlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoKGUgPSB0aGlzLndyaXRlUXVldWUpLnB1c2guYXBwbHkoZSwgYXJndW1lbnRzKTsgIXRoaXMuZGVmZXJyZWRSZW1vdGUgJiYgdGhpcy53cml0ZVF1ZXVlLmxlbmd0aDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLndyaXRlUXVldWUuc2hpZnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5pc0Z1bmN0aW9uKHQpID8gdGhpcy5fY2FsbEZ1bmN0aW9uKHQpIDogdGhpcy5fd3JpdGVJbXBsKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9jYWxsRnVuY3Rpb24gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnZnVuY3Rpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZS5uYW1lIHx8IGUudG9TdHJpbmcoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fb25TY3JpcHRTdGFydCh0KSwgZS5jYWxsKHRoaXMud2luLCB0aGlzLmRvYyksIHRoaXMuX29uU2NyaXB0RG9uZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl93cml0ZUltcGwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucGFyc2VyLmFwcGVuZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gdm9pZCAwLCBuID0gdm9pZCAwLCByID0gdm9pZCAwLCBpID0gW107ICh0ID0gdGhpcy5wYXJzZXIucmVhZFRva2VuKCkpICYmICEobiA9IGwuaXNTY3JpcHQodCkpICYmICEociA9IGwuaXNTdHlsZSh0KSk7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodCA9IHRoaXMub3B0aW9ucy5iZWZvcmVXcml0ZVRva2VuKHQpKSAmJiBpLnB1c2godCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5sZW5ndGggPiAwICYmIHRoaXMuX3dyaXRlU3RhdGljVG9rZW5zKGkpLCBuICYmIHRoaXMuX2hhbmRsZVNjcmlwdFRva2VuKHQpLCByICYmIHRoaXMuX2hhbmRsZVN0eWxlVG9rZW4odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fd3JpdGVTdGF0aWNUb2tlbnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcy5fYnVpbGRDaHVuayhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hY3R1YWwgPyAodC5odG1sID0gdGhpcy5wcm94eUhpc3RvcnkgKyB0LmFjdHVhbCwgdGhpcy5wcm94eUhpc3RvcnkgKz0gdC5wcm94eSwgdGhpcy5wcm94eVJvb3QuaW5uZXJIVE1MID0gdC5odG1sLCBkICYmICh0LnByb3h5SW5uZXJIVE1MID0gdGhpcy5wcm94eVJvb3QuaW5uZXJIVE1MKSwgdGhpcy5fd2Fsa0NodW5rKCksIGQgJiYgKHQuYWN0dWFsSW5uZXJIVE1MID0gdGhpcy5yb290LmlubmVySFRNTCksIHQpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9idWlsZENodW5rID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gdGhpcy5hY3R1YWxzLmxlbmd0aCwgbiA9IFtdLCByID0gW10sIGkgPSBbXSwgYSA9IGUubGVuZ3RoLCBvID0gMDsgbyA8IGE7IG8rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGVbb10sIGMgPSBzLnRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLnB1c2goYyksIHMuYXR0cnMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghL15ub3NjcmlwdCQvaS50ZXN0KHMudGFnTmFtZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHQrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnB1c2goYy5yZXBsYWNlKC8oXC8/PikvLCAnICcgKyBmICsgJ2lkPScgKyB1ICsgJyAkMScpKSwgcy5hdHRycy5pZCAhPT0gbSAmJiBzLmF0dHJzLmlkICE9PSBwICYmIGkucHVzaCgnYXRvbWljVGFnJyA9PT0gcy50eXBlID8gJycgOiAnPCcgKyBzLnRhZ05hbWUgKyAnICcgKyBmICsgJ3Byb3h5b2Y9JyArIHUgKyAocy51bmFyeSA/ICcgLz4nIDogJz4nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5wdXNoKGMpLCBpLnB1c2goJ2VuZFRhZycgPT09IHMudHlwZSA/IGMgOiAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRva2VuczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmF3OiBuLmpvaW4oJycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3R1YWw6IHIuam9pbignJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3h5OiBpLmpvaW4oJycpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl93YWxrQ2h1bmsgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHZvaWQgMCwgdCA9IFt0aGlzLnByb3h5Um9vdF07IGwuZXhpc3R5KGUgPSB0LnNoaWZ0KCkpOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IDEgPT09IGUubm9kZVR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbiB8fCAhbyhlLCAncHJveHlvZicpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmICh0aGlzLmFjdHVhbHNbbyhlLCAnaWQnKV0gPSBlLCBzKGUsICdpZCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5wYXJlbnROb2RlICYmIG8oZS5wYXJlbnROb2RlLCAncHJveHlvZicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciAmJiB0aGlzLmFjdHVhbHNbcl0uYXBwZW5kQ2hpbGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC51bnNoaWZ0LmFwcGx5KHQsIGwudG9BcnJheShlLmNoaWxkTm9kZXMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5faGFuZGxlU2NyaXB0VG9rZW4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcywgbiA9IHRoaXMucGFyc2VyLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiB0aGlzLndyaXRlUXVldWUudW5zaGlmdChuKSwgZS5zcmMgPSBlLmF0dHJzLnNyYyB8fCBlLmF0dHJzLlNSQywgKGUgPSB0aGlzLm9wdGlvbnMuYmVmb3JlV3JpdGVUb2tlbihlKSkgJiYgKGUuc3JjICYmIHRoaXMuc2NyaXB0U3RhY2subGVuZ3RoID8gdGhpcy5kZWZlcnJlZFJlbW90ZSA9IGUgOiB0aGlzLl9vblNjcmlwdFN0YXJ0KGUpLCB0aGlzLl93cml0ZVNjcmlwdFRva2VuKGUsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5fb25TY3JpcHREb25lKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9oYW5kbGVTdHlsZVRva2VuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMucGFyc2VyLmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiB0aGlzLndyaXRlUXVldWUudW5zaGlmdCh0KSwgZS50eXBlID0gZS5hdHRycy50eXBlIHx8IGUuYXR0cnMuVFlQRSB8fCAndGV4dC9jc3MnLCAoZSA9IHRoaXMub3B0aW9ucy5iZWZvcmVXcml0ZVRva2VuKGUpKSAmJiB0aGlzLl93cml0ZVN0eWxlVG9rZW4oZSksIHQgJiYgdGhpcy53cml0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX3dyaXRlU3R5bGVUb2tlbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLl9idWlsZFN0eWxlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2luc2VydEN1cnNvcih0LCBwKSwgZS5jb250ZW50ICYmICh0LnN0eWxlU2hlZXQgJiYgIXQuc2hlZXQgPyB0LnN0eWxlU2hlZXQuY3NzVGV4dCA9IGUuY29udGVudCA6IHQuYXBwZW5kQ2hpbGQodGhpcy5kb2MuY3JlYXRlVGV4dE5vZGUoZS5jb250ZW50KSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX2J1aWxkU3R5bGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcy5kb2MuY3JlYXRlRWxlbWVudChlLnRhZ05hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnNldEF0dHJpYnV0ZSgndHlwZScsIGUudHlwZSksIGwuZWFjaEtleShlLmF0dHJzLCBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNldEF0dHJpYnV0ZShlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9pbnNlcnRDdXJzb3IgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3dyaXRlSW1wbCgnPHNwYW4gaWQ9IicgKyB0ICsgJyIvPicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcy5kb2MuZ2V0RWxlbWVudEJ5SWQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiBuLnBhcmVudE5vZGUucmVwbGFjZUNoaWxkKGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX29uU2NyaXB0U3RhcnQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUub3V0ZXJXcml0ZXMgPSB0aGlzLndyaXRlUXVldWUsIHRoaXMud3JpdGVRdWV1ZSA9IFtdLCB0aGlzLnNjcmlwdFN0YWNrLnVuc2hpZnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fb25TY3JpcHREb25lID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID09PSB0aGlzLnNjcmlwdFN0YWNrWzBdID8gKHRoaXMuc2NyaXB0U3RhY2suc2hpZnQoKSwgdGhpcy53cml0ZS5hcHBseSh0aGlzLCBlLm91dGVyV3JpdGVzKSwgIXRoaXMuc2NyaXB0U3RhY2subGVuZ3RoICYmIHRoaXMuZGVmZXJyZWRSZW1vdGUgJiYgKHRoaXMuX29uU2NyaXB0U3RhcnQodGhpcy5kZWZlcnJlZFJlbW90ZSksIHRoaXMuZGVmZXJyZWRSZW1vdGUgPSBudWxsKSkgOiB0aGlzLm9wdGlvbnMuZXJyb3IoeyBtc2c6ICdCYWQgc2NyaXB0IG5lc3Rpbmcgb3Igc2NyaXB0IGZpbmlzaGVkIHR3aWNlJyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl93cml0ZVNjcmlwdFRva2VuID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuX2J1aWxkU2NyaXB0KGUpLCByID0gdGhpcy5fc2hvdWxkUmVsZWFzZShuKSwgaSA9IHRoaXMub3B0aW9ucy5hZnRlckFzeW5jOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc3JjICYmIChuLnNyYyA9IGUuc3JjLCB0aGlzLl9zY3JpcHRMb2FkSGFuZGxlcihuLCByID8gaSA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCgpLCBpKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2luc2VydEN1cnNvcihuLCBtKSwgbi5zcmMgJiYgIXIgfHwgdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5vcHRpb25zLmVycm9yKGUpLCB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX2J1aWxkU2NyaXB0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMuZG9jLmNyZWF0ZUVsZW1lbnQoZS50YWdOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbC5lYWNoS2V5KGUuYXR0cnMsIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2V0QXR0cmlidXRlKGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlLmNvbnRlbnQgJiYgKHQudGV4dCA9IGUuY29udGVudCksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fc2NyaXB0TG9hZEhhbmRsZXIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLm9ubG9hZCA9IGUub25yZWFkeXN0YXRlY2hhbmdlID0gZS5vbmVycm9yID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbigpLCBudWxsICE9IHQgJiYgdCgpLCB0ID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4oKSwgbyhlKSwgbnVsbCAhPSB0ICYmIHQoKSwgdCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGVbJ29uJyArIHRdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IG4gJiYgKGVbJ19vbicgKyB0XSA9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRoaXMub3B0aW9ucy5lcnJvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKGUsICdsb2FkJyksIGEoZSwgJ2Vycm9yJyksIGMoZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbmxvYWQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLl9vbmxvYWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fb25sb2FkLmFwcGx5KHRoaXMsIEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSh7IG1zZzogJ29ubG9hZCBoYW5kbGVyIGZhaWxlZCAnICsgdCArICcgQCAnICsgZS5zcmMgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbmVycm9yOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5fb25lcnJvcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9vbmVycm9yLmFwcGx5KHRoaXMsIEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgaSh7IG1zZzogJ29uZXJyb3IgaGFuZGxlciBmYWlsZWQgJyArIHQgKyAnIEAgJyArIGUuc3JjIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkoeyBtc2c6ICdyZW1vdGUgc2NyaXB0IGZhaWxlZCAnICsgZS5zcmMgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9ucmVhZHlzdGF0ZWNoYW5nZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgL14obG9hZGVkfGNvbXBsZXRlKSQvLnRlc3QoZS5yZWFkeVN0YXRlKSAmJiByKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9zaG91bGRSZWxlYXNlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIS9ec2NyaXB0JC9pLnRlc3QoZS5ub2RlTmFtZSkgfHwgISEodGhpcy5vcHRpb25zLnJlbGVhc2VBc3luYyAmJiBlLnNyYyAmJiBlLmhhc0F0dHJpYnV0ZSgnYXN5bmMnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5kZWZhdWx0ID0gZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5bcl0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuW3JdLmV4cG9ydHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuW3JdID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBvcnRzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvYWRlZDogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3JdLmNhbGwoaS5leHBvcnRzLCBpLCBpLmV4cG9ydHMsIHQpLCBpLmxvYWRlZCA9ICEwLCBpLmV4cG9ydHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQubSA9IGUsIHQuYyA9IG4sIHQucCA9ICcnLCB0KDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLl9fZXNNb2R1bGUgPyBlIDogeyBkZWZhdWx0OiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gcihuKDEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBpLmRlZmF1bHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGUuX19lc01vZHVsZSA/IGUgOiB7IGRlZmF1bHQ6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICYmIGUuX19lc01vZHVsZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLCBuKSAmJiAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5kZWZhdWx0ID0gZSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0Nhbm5vdCBjYWxsIGEgY2xhc3MgYXMgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ll9fZXNNb2R1bGUgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGkobigyKSksIHMgPSBpKG4oMykpLCBjID0gcihuKDYpKSwgdSA9IG4oNSksIGwgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21tZW50OiAvXjwhLS0vLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGFnOiAvXjxcLy8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdG9taWNUYWc6IC9ePFxzKihzY3JpcHR8c3R5bGV8bm9zY3JpcHR8aWZyYW1lfHRleHRhcmVhKVtcc1wvPl0vaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VGFnOiAvXjwvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhcnM6IC9eW148XS8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLCBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiAnJywgciA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSh0aGlzLCBlKSwgdGhpcy5zdHJlYW0gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gITEsIHMgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB1IGluIG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uaGFzT3duUHJvcGVydHkodSkgJiYgKHIuYXV0b0ZpeCAmJiAoc1t1ICsgJ0ZpeCddID0gITApLCBpID0gaSB8fCBzW3UgKyAnRml4J10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPyAodGhpcy5fcmVhZFRva2VuID0gKDAsIGMuZGVmYXVsdCkodGhpcywgcywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5fcmVhZFRva2VuSW1wbCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzLl9wZWVrVG9rZW4gPSAoMCwgYy5kZWZhdWx0KSh0aGlzLCBzLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Ll9wZWVrVG9rZW5JbXBsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIDogKHRoaXMuX3JlYWRUb2tlbiA9IHRoaXMuX3JlYWRUb2tlbkltcGwsIHRoaXMuX3BlZWtUb2tlbiA9IHRoaXMuX3BlZWtUb2tlbkltcGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJvdG90eXBlLmFwcGVuZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdHJlYW0gKz0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnByZXBlbmQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RyZWFtID0gZSArIHRoaXMuc3RyZWFtOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX3JlYWRUb2tlbkltcGwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLl9wZWVrVG9rZW5JbXBsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0cmVhbSA9IHRoaXMuc3RyZWFtLnNsaWNlKGUubGVuZ3RoKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9wZWVrVG9rZW5JbXBsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgaW4gbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGwuaGFzT3duUHJvcGVydHkoZSkgJiYgbFtlXS50ZXN0KHRoaXMuc3RyZWFtKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBzW2VdKHRoaXMuc3RyZWFtKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RhcnRUYWcnID09PSB0LnR5cGUgJiYgL3NjcmlwdHxzdHlsZS9pLnRlc3QodC50YWdOYW1lKSA/IG51bGwgOiAodC50ZXh0ID0gdGhpcy5zdHJlYW0uc3Vic3RyKDAsIHQubGVuZ3RoKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnBlZWtUb2tlbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fcGVla1Rva2VuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5yZWFkVG9rZW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3JlYWRUb2tlbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUucmVhZFRva2VucyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHZvaWQgMDsgdCA9IHRoaXMucmVhZFRva2VuKCk7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVt0LnR5cGVdICYmICExID09PSBlW3QudHlwZV0odCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5jbGVhciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMuc3RyZWFtOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0cmVhbSA9ICcnLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUucmVzdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdHJlYW07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiBpbiAodC5kZWZhdWx0ID0gZCwgZC50b2tlblRvU3RyaW5nID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGQuZXNjYXBlQXR0cmlidXRlcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaGFzT3duUHJvcGVydHkobikgJiYgKHRbbl0gPSAoMCwgdS5lc2NhcGVRdW90ZXMpKGVbbl0sIG51bGwpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkLnN1cHBvcnRzID0gbywgbykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uaGFzT3duUHJvcGVydHkoZikgJiYgKGQuYnJvd3Nlckhhc0ZsYXcgPSBkLmJyb3dzZXJIYXNGbGF3IHx8ICFvW2ZdICYmIGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuX19lc01vZHVsZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gITEsIHIgPSAhMSwgaSA9IHdpbmRvdy5kb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9ICc8UD48ST48L1A+PC9JPic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuaW5uZXJIVE1MID0gYSwgdC50YWdTb3VwID0gbiA9IGkuaW5uZXJIVE1MICE9PSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC50YWdTb3VwID0gbiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmlubmVySFRNTCA9ICc8UD48aT48UD48L1A+PC9pPjwvUD4nLCB0LnNlbGZDbG9zZSA9IHIgPSAyID09PSBpLmNoaWxkTm9kZXMubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zZWxmQ2xvc2UgPSByID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBudWxsLCB0LnRhZ1NvdXAgPSBuLCB0LnNlbGZDbG9zZSA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5pbmRleE9mKCctLT4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPj0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgdS5Db21tZW50VG9rZW4oZS5zdWJzdHIoNCwgdCAtIDEpLCB0ICsgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuaW5kZXhPZignPCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHUuQ2hhcnNUb2tlbih0ID49IDAgPyB0IDogZS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtMSAhPT0gZS5pbmRleE9mKCc+JykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZS5tYXRjaChsLnN0YXJ0VGFnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAodCA9IHt9LCBuID0ge30sIHIgPSBpWzJdLCBpWzJdLnJlcGxhY2UobC5hdHRyLCBmdW5jdGlvbiAoZSwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmd1bWVudHNbMl0gfHwgYXJndW1lbnRzWzNdIHx8IGFyZ3VtZW50c1s0XSB8fCBhcmd1bWVudHNbNV0gPyBhcmd1bWVudHNbNV0gPyAodFthcmd1bWVudHNbNV1dID0gJycsIG5bYXJndW1lbnRzWzVdXSA9ICEwKSA6IHRbaV0gPSBhcmd1bWVudHNbMl0gfHwgYXJndW1lbnRzWzNdIHx8IGFyZ3VtZW50c1s0XSB8fCBsLmZpbGxBdHRyLnRlc3QoaSkgJiYgaSB8fCAnJyA6IHRbaV0gPSAnJywgciA9IHIucmVwbGFjZShlLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHsgdjogbmV3IHUuU3RhcnRUYWdUb2tlbihpWzFdLCBpWzBdLmxlbmd0aCwgdCwgbiwgISFpWzNdLCByLnJlcGxhY2UoL15bXHNcdUZFRkZceEEwXSt8W1xzXHVGRUZGXHhBMF0rJC9nLCAnJykpIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gKHZvaWQgMCA9PT0gYSA/ICd1bmRlZmluZWQnIDogYyhhKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLnY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5zbGljZSh0Lmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5tYXRjaChuZXcgUmVnRXhwKCc8L1xccyonICsgdC50YWdOYW1lICsgJ1xccyo+JywgJ2knKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4ubWF0Y2gobmV3IFJlZ0V4cCgnKFtcXHNcXFNdKj8pPC9cXHMqJyArIHQudGFnTmFtZSArICdcXHMqPicsICdpJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHUuQXRvbWljVGFnVG9rZW4odC50YWdOYW1lLCByWzBdLmxlbmd0aCArIHQubGVuZ3RoLCB0LmF0dHJzLCB0LmJvb2xlYW5BdHRycywgclsxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5tYXRjaChsLmVuZFRhZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB1LkVuZFRhZ1Rva2VuKHRbMV0sIHRbMF0ubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5fX2VzTW9kdWxlID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGUuY29uc3RydWN0b3IgPT09IFN5bWJvbCAmJiBlICE9PSBTeW1ib2wucHJvdG90eXBlID8gJ3N5bWJvbCcgOiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuY29tbWVudCA9IHIsIHQuY2hhcnMgPSBpLCB0LnN0YXJ0VGFnID0gYSwgdC5hdG9taWNUYWcgPSBvLCB0LmVuZFRhZyA9IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBuKDQpLCBsID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUYWc6IC9ePChbXC1BLVphLXowLTlfXSspKCg/OlxzK1tcd1wtXSsoPzpccyo9P1xzKig/Oig/OiJbXiJdKiIpfCg/OidbXiddKicpfFtePlxzXSspKT8pKilccyooXC8/KT4vLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGFnOiAvXjxcLyhbXC1BLVphLXowLTlfXSspW14+XSo+LywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0dHI6IC8oPzooW1wtQS1aYS16MC05X10rKVxzKj1ccyooPzooPzoiKCg/OlxcLnxbXiJdKSopIil8KD86JygoPzpcXC58W14nXSkqKScpfChbXj5cc10rKSkpfCg/OihbXC1BLVphLXowLTlfXSspKFxzfCQpKykvZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGxBdHRyOiAvXihjaGVja2VkfGNvbXBhY3R8ZGVjbGFyZXxkZWZlcnxkaXNhYmxlZHxpc21hcHxtdWx0aXBsZXxub2hyZWZ8bm9yZXNpemV8bm9zaGFkZXxub3dyYXB8cmVhZG9ubHl8c2VsZWN0ZWQpJC9pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0Nhbm5vdCBjYWxsIGEgY2xhc3MgYXMgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ll9fZXNNb2R1bGUgPSAhMCwgdC5FbmRUYWdUb2tlbiA9IHQuQXRvbWljVGFnVG9rZW4gPSB0LlN0YXJ0VGFnVG9rZW4gPSB0LlRhZ1Rva2VuID0gdC5DaGFyc1Rva2VuID0gdC5Db21tZW50VG9rZW4gPSB0LlRva2VuID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbig1KSwgYSA9ICh0LlRva2VuID0gZnVuY3Rpb24gZSh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKHRoaXMsIGUpLCB0aGlzLnR5cGUgPSB0LCB0aGlzLmxlbmd0aCA9IG4sIHRoaXMudGV4dCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LkNvbW1lbnRUb2tlbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIodGhpcywgZSksIHRoaXMudHlwZSA9ICdjb21tZW50JywgdGhpcy5sZW5ndGggPSBuIHx8ICh0ID8gdC5sZW5ndGggOiAwKSwgdGhpcy50ZXh0ID0gJycsIHRoaXMuY29udGVudCA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICc8IS0tJyArIHRoaXMuY29udGVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgdC5DaGFyc1Rva2VuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcih0aGlzLCBlKSwgdGhpcy50eXBlID0gJ2NoYXJzJywgdGhpcy5sZW5ndGggPSB0LCB0aGlzLnRleHQgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50ZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCB0LlRhZ1Rva2VuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSh0LCBuLCBpLCBhLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcih0aGlzLCBlKSwgdGhpcy50eXBlID0gdCwgdGhpcy5sZW5ndGggPSBpLCB0aGlzLnRleHQgPSAnJywgdGhpcy50YWdOYW1lID0gbiwgdGhpcy5hdHRycyA9IGEsIHRoaXMuYm9vbGVhbkF0dHJzID0gbywgdGhpcy51bmFyeSA9ICExLCB0aGlzLmh0bWw1VW5hcnkgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZvcm1hdFRhZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IG51bGwsIG4gPSAnPCcgKyBlLnRhZ05hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBlLmF0dHJzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5hdHRycy5oYXNPd25Qcm9wZXJ0eShyKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiArPSAnICcgKyByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlLmF0dHJzW3JdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBlLmJvb2xlYW5BdHRycyAmJiB2b2lkIDAgIT09IGUuYm9vbGVhbkF0dHJzW3JdIHx8IChuICs9ICc9IicgKyAoMCwgaS5lc2NhcGVRdW90ZXMpKGEpICsgJyInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlc3QgJiYgKG4gKz0gJyAnICsgZS5yZXN0KSwgZS51bmFyeSAmJiAhZS5odG1sNVVuYXJ5ID8gbiArPSAnLz4nIDogbiArPSAnPicsIG51bGwgIT0gdCAmJiAobiArPSB0ICsgJzwvJyArIGUudGFnTmFtZSArICc+JyksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuU3RhcnRUYWdUb2tlbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSh0LCBuLCBpLCBhLCBvLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKHRoaXMsIGUpLCB0aGlzLnR5cGUgPSAnc3RhcnRUYWcnLCB0aGlzLmxlbmd0aCA9IG4sIHRoaXMudGV4dCA9ICcnLCB0aGlzLnRhZ05hbWUgPSB0LCB0aGlzLmF0dHJzID0gaSwgdGhpcy5ib29sZWFuQXR0cnMgPSBhLCB0aGlzLmh0bWw1VW5hcnkgPSAhMSwgdGhpcy51bmFyeSA9IG8sIHRoaXMucmVzdCA9IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuZm9ybWF0VGFnKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgdC5BdG9taWNUYWdUb2tlbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSh0LCBuLCBpLCBhLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKHRoaXMsIGUpLCB0aGlzLnR5cGUgPSAnYXRvbWljVGFnJywgdGhpcy5sZW5ndGggPSBuLCB0aGlzLnRleHQgPSAnJywgdGhpcy50YWdOYW1lID0gdCwgdGhpcy5hdHRycyA9IGksIHRoaXMuYm9vbGVhbkF0dHJzID0gYSwgdGhpcy51bmFyeSA9ICExLCB0aGlzLmh0bWw1VW5hcnkgPSAhMSwgdGhpcy5jb250ZW50ID0gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5mb3JtYXRUYWcodGhpcywgdGhpcy5jb250ZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIHQuRW5kVGFnVG9rZW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcih0aGlzLCBlKSwgdGhpcy50eXBlID0gJ2VuZFRhZycsIHRoaXMubGVuZ3RoID0gbiwgdGhpcy50ZXh0ID0gJycsIHRoaXMudGFnTmFtZSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICc8LycgKyB0aGlzLnRhZ05hbWUgKyAnPic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gZS5yZXBsYWNlKC8oW14iXSopIi9nLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC9cXC8udGVzdCh0KSA/IHQgKyAnIicgOiB0ICsgJ1xcIic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5fX2VzTW9kdWxlID0gITAsIHQuZXNjYXBlUXVvdGVzID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ3N0YXJ0VGFnJyA9PT0gZS50eXBlICYmIChlLnVuYXJ5ID0gcy50ZXN0KGUudGFnTmFtZSkgfHwgZS51bmFyeSwgZS5odG1sNVVuYXJ5ID0gIS9cLz4kLy50ZXN0KGUudGV4dCkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLnN0cmVhbSwgaSA9IG4odCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RyZWFtID0gciwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5wb3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmVwZW5kKCc8LycgKyBuLnRhZ05hbWUgKyAnPicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5sYXN0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbdGhpcy5sZW5ndGggLSAxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5sYXN0VGFnTmFtZUVxID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcy5sYXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiB0LnRhZ05hbWUgJiYgdC50YWdOYW1lLnRvVXBwZXJDYXNlKCkgPT09IGUudG9VcHBlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5jb250YWluc1RhZ05hbWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCwgbiA9IDA7IHQgPSB0aGlzW25dOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQudGFnTmFtZSA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUsIHQsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcihlLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgbFt0LnR5cGVdICYmIGxbdC50eXBlXSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IGEoKSwgbCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydFRhZzogZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLnRhZ05hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUUicgPT09IHIudG9VcHBlckNhc2UoKSAmJiB1Lmxhc3RUYWdOYW1lRXEoJ1RBQkxFJykgPyAoZS5wcmVwZW5kKCc8VEJPRFk+JyksIHMoKSkgOiB0LnNlbGZDbG9zZUZpeCAmJiBjLnRlc3QocikgJiYgdS5jb250YWluc1RhZ05hbWUocikgPyB1Lmxhc3RUYWdOYW1lRXEocikgPyBpKGUsIHUpIDogKGUucHJlcGVuZCgnPC8nICsgbi50YWdOYW1lICsgJz4nKSwgcygpKSA6IG4udW5hcnkgfHwgdS5wdXNoKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVGFnOiBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1Lmxhc3QoKSA/IHQudGFnU291cEZpeCAmJiAhdS5sYXN0VGFnTmFtZUVxKG4udGFnTmFtZSkgPyBpKGUsIHUpIDogdS5wb3AoKSA6IHQudGFnU291cEZpeCAmJiAobygpLCBzKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcygpLCBuKG8oKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuX19lc01vZHVsZSA9ICEwLCB0LmRlZmF1bHQgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gL14oQVJFQXxCQVNFfEJBU0VGT05UfEJSfENPTHxGUkFNRXxIUnxJTUd8SU5QVVR8SVNJTkRFWHxMSU5LfE1FVEF8UEFSQU18RU1CRUQpJC9pLCBjID0gL14oQ09MR1JPVVB8RER8RFR8TEl8T1BUSU9OU3xQfFREfFRGT09UfFRIfFRIRUFEfFRSKSQvaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5leHBvcnRzID0gdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgPT0gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHZvaWQgMCwgaSA9IGUgJiYgZS5sZW5ndGggfHwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyID0gMDsgciA8IGk7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuY2FsbChuLCBlW3JdLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaGFzT3duUHJvcGVydHkocikgJiYgdC5jYWxsKG4sIHIsIGVbcl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBlIHx8IHt9LCBhKHQsIGZ1bmN0aW9uICh0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGVbdF0pIHx8IChlW3RdID0gcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAobiA9IFtdLCBpKGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHsgdjogbiB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gKHZvaWQgMCA9PT0gdCA/ICd1bmRlZmluZWQnIDogZih0KSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW2UubGVuZ3RoIC0gMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISghZSB8fCAnc3RhcnRUYWcnICE9PSBlLnR5cGUgJiYgJ2F0b21pY1RhZycgIT09IGUudHlwZSB8fCAhKCd0YWdOYW1lJyBpbiBlKSB8fCAhfmUudGFnTmFtZS50b0xvd2VyQ2FzZSgpLmluZGV4T2YodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoZSwgJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoZSwgJ3N0eWxlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuX19lc01vZHVsZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3IgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiBlLmNvbnN0cnVjdG9yID09PSBTeW1ib2wgJiYgZSAhPT0gU3ltYm9sLnByb3RvdHlwZSA/ICdzeW1ib2wnIDogdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmV4aXN0eSA9IG4sIHQuaXNGdW5jdGlvbiA9IHIsIHQuZWFjaCA9IGksIHQuZWFjaEtleSA9IGEsIHQuZGVmYXVsdHMgPSBvLCB0LnRvQXJyYXkgPSBzLCB0Lmxhc3QgPSBjLCB0LmlzVGFnID0gdSwgdC5pc1NjcmlwdCA9IGwsIHQuaXNTdHlsZSA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICdvYmplY3QnID09IHR5cGVvZiB0ICYmICdvYmplY3QnID09IHR5cGVvZiBlID8gZS5leHBvcnRzID0gcigpIDogJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZGVmaW5lICYmIGRlZmluZS5hbWQgPyBkZWZpbmUoW10sIHIpIDogJ29iamVjdCcgPT0gdHlwZW9mIHQgPyB0LnBvc3RzY3JpYmUgPSByKCkgOiBuLnBvc3RzY3JpYmUgPSByKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvYWN0aW9ucy9oZWxwZXJzL2dldFNvdXJjZUJ5VXJsLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJ0BhZG9iZS9yZWFjdG9yLWxvYWQtc2NyaXB0JyksIGkgPSBuKCdAYWRvYmUvcmVhY3Rvci1wcm9taXNlJyksIGEgPSB7fSwgbyA9IHt9LCBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvW2VdIHx8IChvW2VdID0gcihlKSksIG9bZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3NhdGVsbGl0ZS5fX3JlZ2lzdGVyU2NyaXB0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtlXSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbZV0gPyBpLnJlc29sdmUoYVtlXSkgOiBuZXcgaShmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyhlKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGFbZV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9oZWxwZXJzL2NyZWF0ZUJ1YmJseS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuKCcuL3dlYWtNYXAnKSwgaSA9IG4oJy4vbWF0Y2hlc1Byb3BlcnRpZXMnKSwgYSA9IG4oJy4vbWF0Y2hlc1NlbGVjdG9yJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFtdLCB0ID0gbmV3IHIoKSwgbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGRMaXN0ZW5lcjogZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsdWF0ZUV2ZW50OiBmdW5jdGlvbiAobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5sZW5ndGggJiYgIXQuaGFzKG4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gbi50YXJnZXQsIHMgPSAhMTsgbzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gITEsIHUgPSAhMSwgbCA9IDA7IGwgPCBlLmxlbmd0aDsgbCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gZVtsXSwgZiA9IGQuc2V0dGluZ3MuZWxlbWVudFNlbGVjdG9yLCBwID0gZC5zZXR0aW5ncy5lbGVtZW50UHJvcGVydGllczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCghMSAhPT0gZC5zZXR0aW5ncy5idWJibGVGaXJlSWZDaGlsZEZpcmVkIHx8ICFzKSAmJiAobyA9PT0gbi50YXJnZXQgfHwgITEgIT09IGQuc2V0dGluZ3MuYnViYmxlRmlyZUlmUGFyZW50KSAmJiAobyA9PT0gbi50YXJnZXQgfHwgZiB8fCBwICYmIE9iamVjdC5rZXlzKHApLmxlbmd0aCkgJiYgKCFmIHx8IGEobywgZikpICYmICghcCB8fCBpKG8sIHApKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPyBPYmplY3Qua2V5cyhuKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVtlXSA9IG5bZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IG0ubmF0aXZlRXZlbnQgPSBuLCBtLmVsZW1lbnQgPSBvLCBtLnRhcmdldCA9IG4udGFyZ2V0LCAhMSAhPT0gZC5jYWxsYmFjayhtKSAmJiAodSA9ICEwLCBkLnNldHRpbmdzLmJ1YmJsZVN0b3AgJiYgKGMgPSAhMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ICYmIChzID0gITApLCBvID0gby5wYXJlbnROb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zZXQobiwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX3Jlc2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9oZWxwZXJzL3dlYWtNYXAuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbignQGFkb2JlL3JlYWN0b3Itd2luZG93JykuV2Vha01hcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gT2JqZWN0LmRlZmluZVByb3BlcnR5LCBhID0gRGF0ZS5ub3coKSAlIDEwMDAwMDAwMDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5uYW1lID0gJ19fc3QnICsgKDEwMDAwMDAwMDAgKiBNYXRoLnJhbmRvbSgpID4+PiAwKSArIGErKyArICdfXyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnByb3RvdHlwZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGVbdGhpcy5uYW1lXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiBuWzBdID09PSBlID8gblsxXSA9IHQgOiBpKGUsIHRoaXMubmFtZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAodCA9IGVbdGhpcy5uYW1lXSkgJiYgdFswXSA9PT0gZSA/IHRbMV0gOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVt0aGlzLm5hbWVdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCF0IHx8IHRbMF0gIT09IGUgfHwgKHRbMF0gPSB0WzFdID0gdm9pZCAwLCAwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVt0aGlzLm5hbWVdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXQgJiYgdFswXSA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvaGVscGVycy9tYXRjaGVzUHJvcGVydGllcy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuKCcuLy4uLy4uL2hlbHBlcnMvdGV4dE1hdGNoJyksIGkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdAdGV4dCcgPT09IHQgfHwgJ2lubmVyVGV4dCcgPT09IHQgPyBlLnRleHRDb250ZW50IHx8IGUuaW5uZXJUZXh0IDogdCBpbiBlID8gZVt0XSA6IGUuZ2V0QXR0cmlidXRlID8gZS5nZXRBdHRyaWJ1dGUodCkgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF0IHx8IHQuZXZlcnkoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gaShlLCB0Lm5hbWUpLCBhID0gdC52YWx1ZUlzUmVnZXggPyBuZXcgUmVnRXhwKHQudmFsdWUsICdpJykgOiB0LnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIobiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL2hlbHBlcnMvbWF0Y2hlc1NlbGVjdG9yLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUubWF0Y2hlcyB8fCBlLm1zTWF0Y2hlc1NlbGVjdG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2FsbChlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5sb2dnZXIud2FybignTWF0Y2hpbmcgZWxlbWVudCBmYWlsZWQuICcgKyB0ICsgJyBpcyBub3QgYSB2YWxpZCBzZWxlY3Rvci4nKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2hlbHBlcnMvdGV4dE1hdGNoLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdJbGxlZ2FsIEFyZ3VtZW50OiBQYXR0ZXJuIGlzIG5vdCBwcmVzZW50Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGUgJiYgKCdzdHJpbmcnID09IHR5cGVvZiB0ID8gZSA9PT0gdCA6IHQgaW5zdGFuY2VvZiBSZWdFeHAgJiYgdC50ZXN0KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9oZWxwZXJzL29uY2UuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgKG4gPSBlLmFwcGx5KHQgfHwgdGhpcywgYXJndW1lbnRzKSwgZSA9IG51bGwpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL2hlbHBlcnMvdmlzaWJpbGl0eUFwaS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhpZGRlbjogJ3Zpc2liaWxpdHljaGFuZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW96SGlkZGVuOiAnbW96dmlzaWJpbGl0eWNoYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc0hpZGRlbjogJ21zdmlzaWJpbGl0eWNoYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ZWJraXRIaWRkZW46ICd3ZWJraXR2aXNpYmlsaXR5Y2hhbmdlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0IGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5oYXNPd25Qcm9wZXJ0eSh0KSAmJiB2b2lkIDAgIT09IGRvY3VtZW50W3RdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhpZGRlblByb3BlcnR5OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aXNpYmlsaXR5Q2hhbmdlRXZlbnRUeXBlOiBlW3RdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL2hlbHBlcnMvdGltZXIuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbignQGFkb2JlL3JlYWN0b3Itb2JqZWN0LWFzc2lnbicpLCBpID0gbignLi4vLi4vLi4vLi4vbm9kZV9tb2R1bGVzL21pdHQvZGlzdC9taXR0JyksIGEgPSAxMDAwLCBvID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmluZGV4T2YoZSkgPT09IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcih0aGlzLCBpKCkpLCB0aGlzLl90b3RhbCA9IDAsIHRoaXMuX2NoZWNrSW50ZXJ2YWwgPSBlIHx8IGEsIHRoaXMuX2ludGVydmFsSWQgPSBudWxsLCB0aGlzLl9tYXJrZXJzID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5wcm90b3R5cGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJlc3VtZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3NldEludGVydmFsVXBkYXRlcigpLCB0aGlzLl9zdGFydE5ld0ludGVybmFsVGltZXIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF1c2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3JlbW92ZUludGVydmFsVXBkYXRlcigpLCB0aGlzLl9jYWxjdWxhdGVUaW1lUGFzc2VkKCksIHRoaXMuX3N0b3BJbnRlcm5hbFRpbWVyKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFRpbWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl90b3RhbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkTWFya2VyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fbWFya2Vycy5wdXNoKGUpLCB0aGlzLl9tYXJrZXJzID0gdGhpcy5fbWFya2Vycy5maWx0ZXIobyksIHRoaXMuX21hcmtlcnMuc29ydCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc2V0SW50ZXJ2YWxVcGRhdGVyOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9pbnRlcnZhbElkID0gd2luZG93LnNldEludGVydmFsKHRoaXMuX2NhbGN1bGF0ZVRpbWVQYXNzZWQuYmluZCh0aGlzKSwgdGhpcy5fY2hlY2tJbnRlcnZhbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9yZW1vdmVJbnRlcnZhbFVwZGF0ZXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5jbGVhckludGVydmFsKHRoaXMuX2ludGVydmFsSWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc3RhcnROZXdJbnRlcm5hbFRpbWVyOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9zdGFydFRpbWUgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3N0b3BJbnRlcm5hbFRpbWVyOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9zdGFydFRpbWUgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfY2FsY3VsYXRlVGltZVBhc3NlZDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fdG90YWwgKz0gbmV3IERhdGUoKS5nZXRUaW1lKCkgLSB0aGlzLl9zdGFydFRpbWUsIHRoaXMuX2NoZWNrTWFya2Vyc0NvbXBsZXRlZCgpLCB0aGlzLl9zdGFydE5ld0ludGVybmFsVGltZXIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX2NoZWNrTWFya2Vyc0NvbXBsZXRlZDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHRoaXMuZ2V0VGltZSgpLCB0ID0gMDsgdCA8IHRoaXMuX21hcmtlcnMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuX21hcmtlcnNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA+PSBuICYmICh0aGlzLmVtaXQoJ21hcmtlclBhc3NlZCcsIG4pLCB0aGlzLl9tYXJrZXJzLnNwbGljZSh0LCAxKSwgdCAtPSAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZXhwb3J0cyA9IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL25vZGVfbW9kdWxlcy9taXR0L2Rpc3QvbWl0dC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBlIHx8IE9iamVjdC5jcmVhdGUobnVsbCksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uOiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChlW3RdIHx8IChlW3RdID0gW10pKS5wdXNoKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9mZjogZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3RdICYmIGVbdF0uc3BsaWNlKGVbdF0uaW5kZXhPZihuKSA+Pj4gMCwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW1pdDogZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZVt0XSB8fCBbXSkuc2xpY2UoKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgKGVbJyonXSB8fCBbXSkuc2xpY2UoKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9oZWxwZXJzL3Zpc2l0b3JUcmFja2luZy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuKCdAYWRvYmUvcmVhY3Rvci1jb29raWUnKSwgaSA9IG4oJ0BhZG9iZS9yZWFjdG9yLWRvY3VtZW50JyksIGEgPSBuKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgbyA9IG4oJy4vZ2V0TmFtZXNwYWNlZFN0b3JhZ2UnKSwgcyA9ICdfc2RzYXRfJywgYyA9ICd2aXNpdG9yVHJhY2tpbmcnLCB1ID0gJ2Nvb2tpZXNNaWdyYXRlZCcsIGwgPSBvKCdsb2NhbFN0b3JhZ2UnLCBjKSwgZCA9IG8oJ3Nlc3Npb25TdG9yYWdlJywgYyksIGYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGQuZ2V0SXRlbSgnbGFuZGluZ1BhZ2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIHx8IChkLnNldEl0ZW0oJ2xhbmRpbmdQYWdlJywgYS5sb2NhdGlvbi5ocmVmKSwgZC5zZXRJdGVtKCdsYW5kaW5nVGltZScsIG5ldyBEYXRlKCkuZ2V0VGltZSgpKSksICFlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBwID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQuZ2V0SXRlbSgnbGFuZGluZ1BhZ2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIoZC5nZXRJdGVtKCdsYW5kaW5nVGltZScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIobC5nZXRJdGVtKCdzZXNzaW9uQ291bnQnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTnVtYmVyKGwuZ2V0SXRlbSgncGFnZXNWaWV3ZWQnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyBEYXRlKCkuZ2V0VGltZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGguZmxvb3IoKGUgLSBtKCkpIC8gMTAwMCAvIDYwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkLmdldEl0ZW0oJ3RyYWZmaWNTb3VyY2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIoZC5nZXRJdGVtKCdwYWdlc1ZpZXdlZCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgXyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxID09PSBnKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiBsLnNldEl0ZW0oJ3Nlc3Npb25Db3VudCcsIGcoKSArIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB4ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5zZXRJdGVtKCdwYWdlc1ZpZXdlZCcsIHkoKSArIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBrID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5zZXRJdGVtKCdwYWdlc1ZpZXdlZCcsIGgoKSArIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5nZXRJdGVtKCd0cmFmZmljU291cmNlJykgfHwgZC5zZXRJdGVtKCd0cmFmZmljU291cmNlJywgaS5yZWZlcnJlcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGYoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMoZSksIGsoKSwgeCgpLCB3KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsLmdldEl0ZW0odSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gci5nZXQocyArICdzZXNzaW9uX2NvdW50Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmIGwuc2V0SXRlbSgnc2Vzc2lvbkNvdW50JywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHIuZ2V0KHMgKyAnbHRfcGFnZXNfdmlld2VkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIGwuc2V0SXRlbSgncGFnZXNWaWV3ZWQnLCB0KSwgbC5zZXRJdGVtKHUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgRSgpLCBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldExhbmRpbmdQYWdlOiBwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRMYW5kaW5nVGltZTogbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TWludXRlc09uU2l0ZTogdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0U2Vzc2lvbkNvdW50OiBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRMaWZldGltZVBhZ2VWaWV3Q291bnQ6IGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFNlc3Npb25QYWdlVmlld0NvdW50OiB5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRUcmFmZmljU291cmNlOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRJc05ld1Zpc2l0b3I6IF8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9oZWxwZXJzL2dldE5hbWVzcGFjZWRTdG9yYWdlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLCBpID0gJ2NvbS5hZG9iZS5yZWFjdG9yLmNvcmUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gaSArICcuJyArIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRJdGVtOiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfZTE3ZjZkMTljMzI4ZjI1YyA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdsb2NhbFN0b3JhZ2UnKSwgJF9fX29sZF9lMTkyYzVmOTNkMTIxODc4ID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ3Nlc3Npb25TdG9yYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfZTE3ZjZkMTljMzI4ZjI1YykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja18yMTNjMmM2OThlNTcwMjcwLmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9lMTkyYzVmOTNkMTIxODc4KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ3Nlc3Npb25TdG9yYWdlJywgJF9fX21vY2tfMjEzYzJjNjk4ZTU3MDI3MC5zZXNzaW9uU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcltlXS5nZXRJdGVtKG4gKyAnLicgKyB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2UxN2Y2ZDE5YzMyOGYyNWMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX29sZF9lMTdmNmQxOWMzMjhmMjVjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2UxOTJjNWY5M2QxMjE4NzgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnc2Vzc2lvblN0b3JhZ2UnLCAkX19fb2xkX2UxOTJjNWY5M2QxMjE4NzgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbTogZnVuY3Rpb24gKHQsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkX2ZmMWM0NzY4ZTA5NTk2OTQgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyksICRfX19vbGRfYWY4ZDZkNWJiMzdlMjJiOCA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdzZXNzaW9uU3RvcmFnZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2ZmMWM0NzY4ZTA5NTk2OTQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX21vY2tfMjEzYzJjNjk4ZTU3MDI3MC5sb2NhbFN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYWY4ZDZkNWJiMzdlMjJiOCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdzZXNzaW9uU3RvcmFnZScsICRfX19tb2NrXzIxM2MyYzY5OGU1NzAyNzAuc2Vzc2lvblN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJbZV0uc2V0SXRlbShuICsgJy4nICsgdCwgaSksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2ZmMWM0NzY4ZTA5NTk2OTQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX29sZF9mZjFjNDc2OGUwOTU5Njk0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2FmOGQ2ZDViYjM3ZTIyYjgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnc2Vzc2lvblN0b3JhZ2UnLCAkX19fb2xkX2FmOGQ2ZDViYjM3ZTIyYjgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnYWRvYmUtdGFyZ2V0LXYyJzogewogICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQWRvYmUgVGFyZ2V0IHYyJywKICAgICAgICAgICAgICAgICAgICBob3N0ZWRMaWJGaWxlc0Jhc2VVcmw6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vZXh0ZW5zaW9ucy9FUGY2ZDY5NDQ2MmJmNjRkMmZiYTgwMzRlOGNlZTIzOTI0LycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0U2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuYWJsZWQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dDogMzAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246ICcyLjIuMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmRwb2ludDogJy9yZXN0L3YxL2RlbGl2ZXJ5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltc09yZ0lkOiAnMUUyMjE3MUI1MjBFOTNCRjBBNDkwRDQ0QEFkb2JlT3JnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudENvZGU6ICdmZWRleCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWN1cmVPbmx5OiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZlclN0YXRlOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGluRW5hYmxlZDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJEb21haW46ICdmZWRleC50dC5vbXRyZGMubmV0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybFNpemVMaW1pdDogMjA0OCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZXdzRW5hYmxlZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRvdXRFbmFibGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHlIaWRkZW5TdHlsZTogJ2JvZHkge29wYWNpdHk6IDB9JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VMb2FkRW5hYmxlZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbmFseXRpY3NMb2dnaW5nOiAnc2VydmVyX3NpZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlSWRMaWZldGltZTogNjMyNDQ4MDAwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5SGlkaW5nRW5hYmxlZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uSWRMaWZldGltZTogMTg2MDAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpc2l0b3JBcGlUaW1lb3V0OiAyMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXV0aG9yaW5nU2NyaXB0VXJsOiAnLy9jZG4udHQub210cmRjLm5ldC9jZG4vdGFyZ2V0LXZlYy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdmVycmlkZU1ib3hFZGdlU2VydmVyOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdG9yc1BvbGxpbmdUaW1lb3V0OiA1MDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdENvbnRlbnRIaWRkZW5TdHlsZTogJ3Zpc2liaWxpdHk6IGhpZGRlbjsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdENvbnRlbnRWaXNpYmxlU3R5bGU6ICd2aXNpYmlsaXR5OiB2aXNpYmxlOycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdmVycmlkZU1ib3hFZGdlU2VydmVyVGltZW91dDogMTg2MDAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1cHBsZW1lbnRhbERhdGFJZFBhcmFtVGltZW91dDogMzAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlczogewogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtdGFyZ2V0LXYyL2xpYi9sb2FkVGFyZ2V0LmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2xvYWQtdGFyZ2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnTG9hZCBUYXJnZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLCBpID0gbignQGFkb2JlL3JlYWN0b3ItZG9jdW1lbnQnKSwgYSA9IG4oJy4vbW9kdWxlcy9sb2FkLXRhcmdldCcpLCBvID0gYS5pbml0TGlicmFyeVNldHRpbmdzLCBzID0gYS5vdmVycmlkZVB1YmxpY0FwaSwgYyA9IG4oJy4vbW9kdWxlcy9vcHRpbicpLCB1ID0gYy5zaG91bGRVc2VPcHRJbiwgbCA9IGMuaXNUYXJnZXRBcHByb3ZlZCwgZCA9IG4oJy4vYW5hbHl0aWNzSW50ZWdyYXRpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmIGUuZW5hYmxlZCA/ICgoMCwgbignLi9tb2R1bGVzL2xpYnMvYXQtbGF1bmNoJykuaW5pdCkociwgaSwgZSksIHUoKSAmJiAhbCgpIHx8IGQoKSkgOiBzKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS10YXJnZXQtdjIvbGliL2ZpcmVQYWdlTG9hZC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdmaXJlLXBhZ2UtbG9hZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0ZpcmUgUGFnZSBMb2FkIFJlcXVlc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hZG9iZSAmJiBhLmFkb2JlLnRhcmdldCAmJiBhLmFkb2JlLnRhcmdldC5WRVJTSU9OOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4oJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLCBvID0gbignLi9tb2R1bGVzL2xpYnMvYXQtbGF1bmNoJyksIHMgPSBvLmluaXRDb25maWcsIGMgPSBvLmluaXREZWxpdmVyeSwgdSA9IG4oJy4vbW9kdWxlcy9wYWdlLWxvYWQnKSwgbCA9IG4oJy4vbWVzc2FnZXMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkoKSA/IChzKHQpLCBjKCkpIDogYS5jb25zb2xlICYmIHIubG9nZ2VyLndhcm4obC5OT19SRVFVRVNUKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtdGFyZ2V0LXYyL2xpYi9hZGRQYWdlTG9hZFBhcmFtcy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdhZGQtcGFnZS1sb2FkLXBhcmFtcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0FkZCBQYXJhbXMgdG8gUGFnZSBMb2FkIFJlcXVlc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4oJy4vbW9kdWxlcy9wYXJhbXMtc3RvcmUnKS5tZXJnZVBhZ2VMb2FkUGFyYW1zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoZS5wYXJhbXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS10YXJnZXQtdjIvbGliL21vZHVsZXMvbG9hZC10YXJnZXQuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuY29tcGF0TW9kZSwgbiA9IGUuZG9jdW1lbnRNb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiAnQ1NTMUNvbXBhdCcgPT09IHQgJiYgKCFuIHx8IG4gPj0gOSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwucmVzb2x2ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5hZG9iZSA9IGUuYWRvYmUgfHwge30sIGUuYWRvYmUudGFyZ2V0ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVkVSU0lPTjogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudDoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRPZmZlcjogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldE9mZmVyczogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwcGx5T2ZmZXI6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcHBseU9mZmVyczogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmROb3RpZmljYXRpb25zOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tFdmVudDogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyaWdnZXJWaWV3OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVnaXN0ZXJFeHRlbnNpb246IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbml0OiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUubWJveENyZWF0ZSA9IHQsIGUubWJveERlZmluZSA9IHQsIGUubWJveFVwZGF0ZSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmFkb2JlICYmIGMuYWRvYmUudGFyZ2V0ICYmIHZvaWQgMCAhPT0gYy5hZG9iZS50YXJnZXQuZ2V0T2ZmZXI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKCkgPyAoci5sb2dnZXIud2FybihkLkFMUkVBRFlfSU5JVElBTElaRUQpLCBudWxsKSA6IChnLm1ib3hQYXJhbXMgPSBwKCksIGcuZ2xvYmFsTWJveFBhcmFtcyA9IG0oKSwgaChnLCBjLnRhcmdldEdsb2JhbFNldHRpbmdzIHx8IHt9LCBiKSwgaChnLCB2IHx8IHt9LCBbJ3ZlcnNpb24nXSksIGkodSkgfHwgKGcuZW5hYmxlZCA9ICExLCByLmxvZ2dlci53YXJuKGQuREVMSVZFUllfRElTQUJMRUQpKSwgZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gbignQGFkb2JlL3JlYWN0b3Itd2luZG93JyksIHUgPSBuKCdAYWRvYmUvcmVhY3Rvci1kb2N1bWVudCcpLCBsID0gbignQGFkb2JlL3JlYWN0b3ItcHJvbWlzZScpLCBkID0gbignLi4vbWVzc2FnZXMnKSwgZiA9IG4oJy4vcGFyYW1zLXN0b3JlJyksIHAgPSBmLmdldFBhcmFtcywgbSA9IGYuZ2V0UGFnZUxvYWRQYXJhbXMsIGcgPSBuKCcuLi90YXJnZXRTZXR0aW5ncycpLnRhcmdldFNldHRpbmdzLCBoID0gbignLi9vYmplY3Qtb3ZlcnJpZGUnKSwgdiA9IG4oJy4uL2xpYnJhcnlTZXR0aW5ncycpLlRBUkdFVF9ERUZBVUxUX1NFVFRJTkdTLCBiID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VuYWJsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NsaWVudENvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ltc09yZ0lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZXJ2ZXJEb21haW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Nvb2tpZURvbWFpbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGltZW91dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGVmYXVsdENvbnRlbnRIaWRkZW5TdHlsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGVmYXVsdENvbnRlbnRWaXNpYmxlU3R5bGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JvZHlIaWRkZW5TdHlsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYm9keUhpZGluZ0VuYWJsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NlbGVjdG9yc1BvbGxpbmdUaW1lb3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2aXNpdG9yQXBpVGltZW91dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb3ZlcnJpZGVNYm94RWRnZVNlcnZlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb3ZlcnJpZGVNYm94RWRnZVNlcnZlclRpbWVvdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29wdG91dEVuYWJsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29wdGluRW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2VjdXJlT25seScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3VwcGxlbWVudGFsRGF0YUlkUGFyYW1UaW1lb3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhdXRob3JpbmdTY3JpcHRVcmwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VybFNpemVMaW1pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZW5kcG9pbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BhZ2VMb2FkRW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndmlld3NFbmFibGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhbmFseXRpY3NMb2dnaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZXJ2ZXJTdGF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ2xvYmFsTWJveE5hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RlY2lzaW9uaW5nTWV0aG9kJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdExpYnJhcnlTZXR0aW5nczogcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGVQdWJsaWNBcGk6IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtdGFyZ2V0LXYyL2xpYi9tb2R1bGVzL29wdGluLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnID09PSAodm9pZCAwID09PSBlID8gJ3VuZGVmaW5lZCcgOiBsKGUpKSB8fCBudWxsID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB2b2lkIDAgPT09IGUgPyAndW5kZWZpbmVkJyA6IGwoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmICgnb2JqZWN0JyA9PT0gdCB8fCAnZnVuY3Rpb24nID09PSB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGVbZ10pICYmIGkoZVtmXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF0ICYmICFyKGUpICYmICFyKGVbbV0pICYmIGEoZVttXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtmXSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkW21dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyhlLCBlW2hdW3ZdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBiW3BdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhkLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGUuY29uc3RydWN0b3IgPT09IFN5bWJvbCAmJiBlICE9PSBTeW1ib2wucHJvdG90eXBlID8gJ3N5bWJvbCcgOiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IG4oJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLmFkb2JlLCBmID0gJ2lzQXBwcm92ZWQnLCBwID0gJ29wdGluRW5hYmxlZCcsIG0gPSAnb3B0SW4nLCBnID0gJ2ZldGNoUGVybWlzc2lvbnMnLCBoID0gJ0NhdGVnb3JpZXMnLCB2ID0gJ1RBUkdFVCcsIGIgPSBuKCcuLi90YXJnZXRTZXR0aW5ncycpLnRhcmdldFNldHRpbmdzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvdWxkVXNlT3B0SW46IHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzVGFyZ2V0QXBwcm92ZWQ6IGMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtdGFyZ2V0LXYyL2xpYi9hbmFseXRpY3NJbnRlZ3JhdGlvbi5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgcyhmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA/IHQudGhlbihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgKGUuYWJvcnQgPSAhMCksIG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG5ldyBzKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUoITEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkLnRhcmdldFNldHRpbmdzLnRpbWVvdXQpLCBuID0gZnVuY3Rpb24gbihyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKCExKSwgY2xlYXJUaW1lb3V0KHQpLCBsKG8sIHIsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUobywgcCwgZnVuY3Rpb24gbihyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuZGV0YWlsICYmICEwID09PSByLmRldGFpbC5yZWRpcmVjdCA/IGUoITApIDogZSghMSksIGNsZWFyVGltZW91dCh0KSwgbChvLCByLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdShvLCBtLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBuKCdAYWRvYmUvcmVhY3Rvci1kb2N1bWVudCcpLCBzID0gbignQGFkb2JlL3JlYWN0b3ItcHJvbWlzZScpLCBjID0gbignLi9tb2R1bGVzL2V2ZW50LXV0aWwnKSwgdSA9IGMuYWRkRXZlbnRMaXN0ZW5lciwgbCA9IGMucmVtb3ZlRXZlbnRMaXN0ZW5lciwgZCA9IG4oJy4vdGFyZ2V0U2V0dGluZ3MnKS5leHRlbnNpb25TZXR0aW5ncywgZiA9IHIuZ2V0U2hhcmVkTW9kdWxlKCdhZG9iZS1hbmFseXRpY3MnLCAnYXVnbWVudC10cmFja2VyJyksIHAgPSAnYXQtcmVxdWVzdC1zdWNjZWVkZWQnLCBtID0gJ2F0LXJlcXVlc3QtZmFpbGVkJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLXRhcmdldC12Mi9saWIvbW9kdWxlcy9saWJzL2F0LWxhdW5jaC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdvYmplY3QnID09IHR5cGVvZiBlICYmICdkZWZhdWx0JyBpbiBlID8gZS5kZWZhdWx0IDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geGwuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGUuY29uc3RydWN0b3IgPT09IFN5bWJvbCAmJiBlICE9PSBTeW1ib2wucHJvdG90eXBlID8gJ3N5bWJvbCcgOiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0IGluIGUgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBlW3RdID0gbiwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiAoJ29iamVjdCcgPT09IHQgfHwgJ2Z1bmN0aW9uJyA9PT0gdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF1KGUpICYmIG8oZSkgPT09IGtsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbChlKSA/IGUgOiBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoZSkgPyBbXSA6IE9iamVjdC5rZXlzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBtKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkodCkgPyBbXSA6IChfbCh0KSA/IElsIDogRGwpKGYoZSksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5sZW5ndGggPyBlWzBdIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoZSkgPyBbXSA6IFtdLmNvbmNhdC5hcHBseShbXSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHYoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gdGhpcywgbiA9IGUgPyBlLmxlbmd0aCA6IDAsIHIgPSBuOyByIC09IDE7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsKGVbcl0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0V4cGVjdGVkIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSAwLCBpID0gYXJndW1lbnRzLmxlbmd0aCwgYSA9IG5ldyBBcnJheShpKSwgbyA9IDA7IG8gPCBpOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtvXSA9IGFyZ3VtZW50c1tvXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSBuID8gZVtyXS5hcHBseSh0LCBhKSA6IGFbMF07IChyICs9IDEpIDwgbjspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IGVbcl0uY2FsbCh0LCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSh0KSB8fCAoX2wodCkgPyB3bCA6IEVsKShmKGUpLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGUgJiYgJ29iamVjdCcgPT09IHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGUgfHwgIV9sKGUpICYmIHkoZSkgJiYgbyhlKSA9PT0gQWw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIV8oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAwLCBuID0gZS5sZW5ndGgsIHIgPSAwOyByIDwgbjsgciArPSAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9ICh0IDw8IDUpIC0gdCArIGUuY2hhckNvZGVBdChyKSAmIDQyOTQ5NjcyOTU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB4KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09IHR5cGVvZiBlICYmIGUgPiAtMSAmJiBlICUgMSA9PSAwICYmIGUgPD0gU2w7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGsoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBlICYmIHgoZS5sZW5ndGgpICYmICFsKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB3KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRsKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMCwgbiA9IGUubGVuZ3RoLCByID0gQXJyYXkobik7IHQgPCBuOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbdF0gPSBlW3RdLCB0ICs9IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBJKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3BsaXQoJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBEKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoZSkgPyBbXSA6IGsoZSkgPyBfKGUpID8gSShlKSA6IEUoZSkgOiB3KHAoZSksIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGsoZSkgJiYgKF9sKGUpIHx8IF8oZSkgfHwgbChlLnNwbGljZSkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9sLmNhbGwoZSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShlKSA/ICcnIDogTGwuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfKGUpID8gIVMoZSkgOiBBKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBQKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09IHR5cGVvZiBlIHx8IHkoZSkgJiYgbyhlKSA9PT0gVmw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldFByb3RvdHlwZU9mKE9iamVjdChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGooZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXkoZSkgfHwgbyhlKSAhPT0gUmwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gTyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gVWwuY2FsbCh0LCAnY29uc3RydWN0b3InKSAmJiB0LmNvbnN0cnVjdG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgbiAmJiBuIGluc3RhbmNlb2YgbiAmJiBCbC5jYWxsKG4pID09PSB6bDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfbCh0KSA/IHQuam9pbihlIHx8ICcnKSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkodCkgPyBbXSA6IChfbCh0KSA/IFRsIDogcWwpKGYoZSksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBWKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IERhdGUoKS5nZXRUaW1lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFIoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShuKSA/IHQgOiAoX2wobikgPyBIbCA6IFdsKShmKGUpLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGUgPyBlIDogWWwuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKHQpID8gW10gOiB0LnNwbGl0KGUgfHwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBCKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgKyBNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiAodCAtIGUgKyAxKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gVigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3h4eHh4eHh4eHh4eDR4eHh5eHh4eHh4eHh4eHh4eHh4Jy5yZXBsYWNlKC9beHldL2csIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IChlICsgQigwLCAxNikpICUgMTYgfCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBNYXRoLmZsb29yKGUgLyAxNiksICgneCcgPT09IHQgPyBuIDogMyAmIG4gfCA4KS50b1N0cmluZygxNik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB6KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzZXRUaW1lb3V0KGUsIE51bWJlcih0KSB8fCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHQgPSB7IGV4cG9ydHM6IHt9IH0sIHQuZXhwb3J0cyksIHQuZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gdCB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc291cmNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJvdG9jb2wnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhdXRob3JpdHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2VySW5mbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwYXNzd29yZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2hvc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwb3J0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmVsYXRpdmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwYXRoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGlyZWN0b3J5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZmlsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3F1ZXJ5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYW5jaG9yJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncXVlcnlLZXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlcjogLyg/Ol58JikoW14mPV0qKT0/KFteJl0qKS9nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaWN0OiAvXig/OihbXjpcLz8jXSspOik/KD86XC9cLygoPzooKFteOkBdKikoPzo6KFteOkBdKikpPyk/QCk/KFteOlwvPyNdKikoPzo6KFxkKikpPykpPygoKCg/OltePyNcL10qXC8pKikoW14/I10qKSkoPzpcPyhbXiNdKikpPyg/OiMoLiopKT8pLywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb29zZTogL14oPzooPyFbXjpAXSs6W146QFwvXSpAKShbXjpcLz8jLl0rKTopPyg/OlwvXC8pPygoPzooKFteOkBdKikoPzo6KFteOkBdKikpPyk/QCk/KFteOlwvPyNdKikoPzo6KFxkKikpPykoKChcLyg/OltePyNdKD8hW14/I1wvXSpcLltePyNcLy5dKyg/Ols/I118JCkpKSpcLz8pPyhbXj8jXC9dKikpKD86XD8oW14jXSopKT8oPzojKC4qKSk/KS8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IG4ucGFyc2VyW3Quc3RyaWN0TW9kZSA/ICdzdHJpY3QnIDogJ2xvb3NlJ10uZXhlYyhlKSwgaSA9IHt9LCBhID0gMTQ7IGEtLTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaVtuLmtleVthXV0gPSByW2FdIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlbbi5xLm5hbWVdID0ge30sIGlbbi5rZXlbMTJdXS5yZXBsYWNlKG4ucS5wYXJzZXIsIGZ1bmN0aW9uIChlLCB0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAoaVtuLnEubmFtZV1bdF0gPSByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEcoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3JwXSAmJiAoaSh0W3VwXSkgfHwgKGVbenBdID0gdFt1cF0pLCBiKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKHRbbl0pIHx8IChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFBtKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuZG9jdW1lbnRNb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXQgfHwgdCA+PSAxMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jb21wYXRNb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiAnQ1NTMUNvbXBhdCcgPT09IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEsoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQW0udGVzdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChLKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gTihGKCcuJywgZSkpLCBuID0gdC5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID49IDMgJiYgU20udGVzdCh0WzFdKSA/IHRbMl0gKyAnLicgKyB0WzFdICsgJy4nICsgdFswXSA6IDEgPT09IG4gPyB0WzBdIDogdFsxXSArICcuJyArIHRbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICQoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmxvY2F0aW9uLnByb3RvY29sID09PSBEbSB8fCAociA9IFEoZS5sb2NhdGlvbi5ob3N0bmFtZSkpLCBuW0VwXSA9IHIsIG5bcnBdID0gWCh0KSAmJiBZKHQpLCBHKG4sIGVbUnBdIHx8IHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQod2luZG93LCBkb2N1bWVudCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gd2luZG93LmxvY2F0aW9uLnByb3RvY29sID09PSBEbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKFRtID0gZ2woe30sIGUpKVttcF0gPSBlW21wXSAvIDEwMDAsIFRtW2dwXSA9IGVbZ3BdIC8gMTAwMCwgVG1bd3BdID0gVG1bQ3BdIHx8IHQgPyAnaHR0cHM6JyA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBaKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVG07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGVlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHRlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG5lKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkZWNvZGVVUklDb21wb25lbnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGllKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE1tW2VdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1tW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMbS5ocmVmID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBKbChMbS5ocmVmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucXVlcnlLZXkgPSBlZSh0LnF1ZXJ5KSwgTW1bZV0gPSB0LCBNbVtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYWUoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJlczogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gRignIycsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh0KSB8fCB0Lmxlbmd0aCA8IDMgfHwgaXNOYU4ocGFyc2VJbnQodFsyXSwgMTApKSA/IG51bGwgOiBhZShuZSh0WzBdKSwgbmUodFsxXSksIE51bWJlcih0WzJdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQoZSkgPyBbXSA6IEYoJ3wnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gY2UoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gTShvZSwgc2UoVm0oRm0pKSksIHQgPSBNYXRoLmNlaWwoVigpIC8gMTAwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBSKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0Lm5hbWVdID0gdCwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30sIG0oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1KGUpICYmIHQgPD0gZS5leHBpcmVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHVlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBjZSgpW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdSh0KSA/IHQudmFsdWUgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbGUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTCgnIycsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlKGUubmFtZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZShlLnZhbHVlKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwaXJlcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZGUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5leHBpcmVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gTShkZSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLm1heC5hcHBseShudWxsLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcGUoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IEQoZSksIGkgPSBNYXRoLmFicygxMDAwICogZmUocikgLSBWKCkpLCBhID0gTCgnfCcsIE0obGUsIHIpKSwgbyA9IG5ldyBEYXRlKFYoKSArIGkpLCBzID0gZ2woewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbjogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBpcmVzOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY3VyZTogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA/IHsgc2FtZVNpdGU6IEVtIH0gOiB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJtKEZtLCBhLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbWUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubmFtZSwgbiA9IGUudmFsdWUsIHIgPSBlLmV4cGlyZXMsIGkgPSBlLmRvbWFpbiwgYSA9IGUuc2VjdXJlLCBvID0gY2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb1t0XSA9IGFlKHQsIG4sIE1hdGguY2VpbChyICsgVigpIC8gMTAwMCkpLCBwZShvLCBpLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZ2UoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWwoVm0oZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZWUoZS5sb2NhdGlvbi5zZWFyY2gpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWwoblt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHZlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpZShlLnJlZmVycmVyKS5xdWVyeUtleTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFpKG4pICYmIE1sKG5bdF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBiZShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZShuKSB8fCBoZShlLCBuKSB8fCB2ZSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geWUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gWigpLCB0ID0gZVtFcF0sIG4gPSBlW0NwXSwgciA9IGdsKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW46IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdXJlOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuID8geyBzYW1lU2l0ZTogRW0gfSA6IHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUm0oVmQsIFJkLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBWbShWZCkgPT09IFJkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTm0oVmQpLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBfZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJlKHdpbmRvdywgZG9jdW1lbnQsIExkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQ2UoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBaKClbcnBdICYmIHllKCkgJiYgIV9lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHhlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYmUod2luZG93LCBkb2N1bWVudCwgamQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBrZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJlKHdpbmRvdywgZG9jdW1lbnQsIE1kKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gd2UoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuY29uc29sZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFpKG4pICYmIGwoblt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmNvbnNvbGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlKGUsICd3YXJuJykgJiYgbi53YXJuLmFwcGx5KG4sIFtCbV0uY29uY2F0KHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSWUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuY29uc29sZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2UoZSwgJ2RlYnVnJykgJiYgeGUoKSAmJiBuLmRlYnVnLmFwcGx5KG4sIFtCbV0uY29uY2F0KHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoLCB0ID0gbmV3IEFycmF5KGUpLCBuID0gMDsgbiA8IGU7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbbl0gPSBhcmd1bWVudHNbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVlKHdpbmRvdywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEFlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCwgdCA9IG5ldyBBcnJheShlKSwgbiA9IDA7IG4gPCBlOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W25dID0gYXJndW1lbnRzW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJZSh3aW5kb3csIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBTZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBSKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtuXSA9IGVbbl0sIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9LCBQbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFRlKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlW1ZwXSB8fCBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVbVnBdID0gciwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSByLnB1c2g7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByW2xwXSA9IFVtLCByW2pwXSA9IFNlKHQpLCByW0xwXSA9IFtdLCByW01wXSA9IFtdLCByLnB1c2ggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbTXBdLnB1c2goZ2woeyB0aW1lc3RhbXA6IFYoKSB9LCBlKSksIGkuY2FsbCh0aGlzLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUGUoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID09PSBNcCAmJiBlW1ZwXS5wdXNoKG4pLCByICYmIHQgIT09IE1wICYmIGVbVnBdW3RdLnB1c2goZ2woeyB0aW1lc3RhbXA6IFYoKSB9LCBuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE9lKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZSh3aW5kb3csIFooKSwgeGUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGplKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGUod2luZG93LCBNcCwgZSwgeGUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGUod2luZG93LCBMcCwgZSwgeGUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE1lKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbChxbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFZlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBxbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUmUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUoJycpLCB0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUudGV4dENvbnRlbnQgPSBlLnRleHRDb250ZW50Lmxlbmd0aCA+IDAgPyAnJyA6ICdhJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFZlKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBuLmxlbmd0aCwgdCA9IDA7IHQgPCBlOyB0ICs9IDEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgblt0XSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5zcGxpY2UoMCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLm9ic2VydmUoZSwgeyBjaGFyYWN0ZXJEYXRhOiAhMCB9KSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucHVzaChlKSwgdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBOZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHptKCc8c2NyaXB0PicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5vbigncmVhZHlzdGF0ZWNoYW5nZScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm9uKCdyZWFkeXN0YXRlY2hhbmdlJywgbnVsbCksIHQucmVtb3ZlKCksIHQgPSBudWxsLCBlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgem0oZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50KS5hcHBlbmQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNZSgpID8gYmwuX3NldEltbWVkaWF0ZUZuKFJlKCkpIDogLTEgIT09IHdpbmRvdy5uYXZpZ2F0b3IudXNlckFnZW50LmluZGV4T2YoJ01TSUUgMTAnKSAmJiBibC5fc2V0SW1tZWRpYXRlRm4oTmUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEJlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBibChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVWUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYmwucmVzb2x2ZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gemUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYmwucmVqZWN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBxZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfbChlKSA/IGJsLnJhY2UoZSkgOiB6ZShuZXcgVHlwZUVycm9yKEhtKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEhlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9sKGUpID8gYmwuYWxsKGUpIDogemUobmV3IFR5cGVFcnJvcihIbSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBXZShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxZShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQmUoZnVuY3Rpb24gKGUsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0geihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKG5ldyBFcnJvcihuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcShyKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IHEociksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBHZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKGVbdW1dKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW3VtXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkodFtsbV0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRbbG1dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbChuW2ZtXSkgJiYgbChuW2RtXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFllKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhdCAmJiBHZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWGUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUdlKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGVbdW1dW2xtXSwgciA9IChlW3VtXVtsbV1bcG1dIHx8IHt9KVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5bZG1dKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBLZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghR2UoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVWUoITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGVbdW1dW2xtXSwgciA9IChlW3VtXVtsbV1bcG1dIHx8IHt9KVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW2ZtXShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbltkbV0ocikgPyBlKCEwKSA6IHQodm0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUWUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gWigpW2htXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFllKHdpbmRvdywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICRlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWGUod2luZG93LCBtbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEplKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWGUod2luZG93LCBnbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFplKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gS2Uod2luZG93LCBtbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGV0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWUod2luZG93LmxvY2F0aW9uLnNlYXJjaClbQXBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0dChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IFBwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBpcmVzOiB0W2dwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbjogdFtFcF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWN1cmU6IHRbQ3BdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBudChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR0KGUsIFooKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJ0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoUWUoKSAmJiAhJGUoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoTWwoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnQoZSksIHVlKFBwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB1ZShQcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKHQpID8gbnQoV20pIDogbnQodCksIHVlKFBwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaXQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFooKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogU3AsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyZXM6IHRbbXBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluOiB0W0VwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY3VyZTogdFtDcF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGF0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdWUoU3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEdtLmV4ZWMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHQpIHx8IDIgIT09IHQubGVuZ3RoID8gJycgOiB0WzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFaKClbYnBdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFZtKFRwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQoZSkgPyAnJyA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGN0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBaKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0W2JwXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0W0VwXSwgciA9IG5ldyBEYXRlKFYoKSArIHRbeXBdKSwgaSA9IHRbQ3BdLCBhID0gVm0oVHApLCBvID0gZ2woewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW46IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyZXM6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY3VyZTogaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkgPyB7IHNhbWVTaXRlOiBFbSB9IDoge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE1sKGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJtKFRwLCBhLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gb3QoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVChzKSB8fCBSbShUcCwgcywgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdXQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC5jcmVhdGVFdmVudCgnQ3VzdG9tRXZlbnQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gbiB8fCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlczogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV0YWlsOiB2b2lkIDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIuaW5pdEN1c3RvbUV2ZW50KGUsIG4uYnViYmxlcywgbi5jYW5jZWxhYmxlLCBuLmRldGFpbCksIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbChlLkN1c3RvbUV2ZW50KSB8fCAobi5wcm90b3R5cGUgPSBlLkV2ZW50LnByb3RvdHlwZSwgZS5DdXN0b21FdmVudCA9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsdChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZSgpLCByID0gdCgpLCBpID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLnNlc3Npb25JZCA9IG4sIE1sKHIpID8gKGkuZGV2aWNlSWQgPSByLCBpKSA6IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGR0KGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuZXcgZS5DdXN0b21FdmVudChuLCB7IGRldGFpbDogciB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5kaXNwYXRjaEV2ZW50KGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmdChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5tYm94LCByID0gdC5lcnJvciwgYSA9IHQudXJsLCBvID0gdC5hbmFseXRpY3NEZXRhaWxzLCBzID0gdC5yZXNwb25zZVRva2VucywgYyA9IHQuZXhlY3V0aW9uLCB1ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tpbmc6IGx0KHJ0LCBhdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKG4pIHx8ICh1Lm1ib3ggPSBuKSwgaShyKSB8fCAodS5lcnJvciA9IHIpLCBpKGEpIHx8ICh1LnVybCA9IGEpLCBBKG8pIHx8ICh1LmFuYWx5dGljc0RldGFpbHMgPSBvKSwgQShzKSB8fCAodS5yZXNwb25zZVRva2VucyA9IHMpLCBBKGMpIHx8ICh1LmV4ZWN1dGlvbiA9IGMpLCB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdChZbSwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdCh3aW5kb3csIGRvY3VtZW50LCBZbSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG10KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBmdChYbSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR0KHdpbmRvdywgZG9jdW1lbnQsIFhtLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZ3QoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGZ0KEttLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5yZWRpcmVjdCA9IHQsIGR0KHdpbmRvdywgZG9jdW1lbnQsIEttLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaHQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGZ0KFFtLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHQod2luZG93LCBkb2N1bWVudCwgUW0sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2dChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZnQoJG0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdCh3aW5kb3csIGRvY3VtZW50LCAkbSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGJ0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBmdChKbSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR0KHdpbmRvdywgZG9jdW1lbnQsIEptLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geXQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGZ0KFptLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHQod2luZG93LCBkb2N1bWVudCwgWm0sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBfdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZnQoZWcsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdCh3aW5kb3csIGRvY3VtZW50LCBlZywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEN0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBmdCh0ZywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR0KHdpbmRvdywgZG9jdW1lbnQsIHRnLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geHQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geShlKSAmJiAxID09PSBlLm5vZGVUeXBlICYmICFqKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBrdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jaGFyQXQoMCksIG4gPSBlLmNoYXJBdCgxKSwgciA9IGUuY2hhckF0KDIpLCBpID0geyBrZXk6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkudmFsID0gJy0nID09PSBuID8gJycgKyB0ICsgbiArICdcXDMnICsgciArICcgJyA6IHQgKyAnXFwzJyArIG4gKyAnICcsIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHd0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLm1hdGNoKGFnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEodCkgPyBlIDogUihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVwbGFjZSh0LmtleSwgdC52YWwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCBNKGt0LCB0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEV0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCwgbiwgciwgaSwgYSA9IFtdLCBvID0gUyhlKSwgcyA9IG8uaW5kZXhPZihuZyk7IC0xICE9PSBzOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBTKG8uc3Vic3RyaW5nKDAsIHMpKSwgaSA9IChuID0gUyhvLnN1YnN0cmluZyhzKSkpLmluZGV4T2YocmcpLCByID0gUyhuLnN1YnN0cmluZyhpZywgaSkpLCBzID0gKG8gPSBTKG4uc3Vic3RyaW5nKGkgKyAxKSkpLmluZGV4T2YobmcpLCB0ICYmIHIgJiYgYS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWw6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXE6IE51bWJlcihyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvICYmIGEucHVzaCh7IHNlbDogbyB9KSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSXQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeHQoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gem0oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghXyhlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6bShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB3dChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC0xID09PSB0LmluZGV4T2YobmcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHptKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IEV0KHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LnNlbCwgciA9IHQuZXE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IGUuZmluZChuKSwgUChyKSAmJiAoZSA9IGUuZXEocikpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB6bShkb2N1bWVudCksIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBEdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJdChlKS5sZW5ndGggPiAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6bSgnPCcgKyBaZCArICcvPicpLmFwcGVuZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gU3QoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gem0oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFR0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEl0KGUpLnByZXYoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUHQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSXQoZSkubmV4dCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBPdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJdChlKS5wYXJlbnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24ganQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSXQodCkuaXMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEx0KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEl0KHQpLmZpbmQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE10KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEl0KGUpLmNoaWxkcmVuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFZ0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3dbY2ddID0gd2luZG93W2NnXSB8fCB7fSwgd2luZG93W2NnXS5xdWVyeVNlbGVjdG9yQWxsID0gSXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFJ0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW1pwXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93W2NnXVtsZ10gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBOdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcihZZCwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwod2luZG93W2NnXVt1Z10pICYmIHdpbmRvd1tjZ11bdWddKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZ0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoa2UoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gWigpW2twXSwgdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE50KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKG9nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQWUoc2cpLCB5bChlKS50aGVuKHQpLmNhdGNoKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEJ0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlSW50KGUsIDEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVXQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEJ0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNOYU4odCkgPyBudWxsIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24genQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRih2ZywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHF0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBGKHZnLCBlKSwgbiA9IFV0KHRbMF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaShuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmFjdGl2aXR5SW5kZXggPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFV0KHRbMV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShhKSB8fCAoci5leHBlcmllbmNlSW5kZXggPSBhKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSHQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbShiZywgTShxdCwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBXdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfbChlKSA/IEh0KGUpIDogSHQoW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gR3QoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVlKGUpLCBuID0gdFtmZ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIudG9rZW4gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHRbbWddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNbChpKSAmJiBpID09PSBSZCAmJiAoci5saXN0ZWRBY3Rpdml0aWVzT25seSA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0W2dnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWwoYSkgJiYgKHIuZXZhbHVhdGVBc1RydWVBdWRpZW5jZUlkcyA9IHp0KGEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0W2hnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWwobykgJiYgKHIuZXZhbHVhdGVBc0ZhbHNlQXVkaWVuY2VJZHMgPSB6dChvKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gdFtwZ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHMpIHx8IChyLnByZXZpZXdJbmRleGVzID0gV3QocykpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBZdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gR3QoZS5sb2NhdGlvbi5zZWFyY2gpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWkodCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IERhdGUoVigpICsgMTg2MDAwMCksIHIgPSBaKClbQ3BdLCBhID0gZ2woewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBpcmVzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWN1cmU6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByID8geyBzYW1lU2l0ZTogRW0gfSA6IHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJtKGRnLCBKU09OLnN0cmluZ2lmeSh0KSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gVm0oZGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoVChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gS3QoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVlKGUpW19nXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQodCkgPyBudWxsIDogeyB0b2tlbjogdCB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBRdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gS3QoZS5sb2NhdGlvbi5zZWFyY2gpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWkodCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IERhdGUoVigpICsgMTg2MDAwMCksIHIgPSBaKClbQ3BdLCBhID0gZ2woewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBpcmVzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWN1cmU6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByID8geyBzYW1lU2l0ZTogRW0gfSA6IHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJtKHlnLCBKU09OLnN0cmluZ2lmeSh0KSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gJHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gVm0oeWcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoVChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSnQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSXQoZSkuZW1wdHkoKS5yZW1vdmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWnQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSXQodCkuYWZ0ZXIoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGVuKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEl0KHQpLmJlZm9yZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdG4oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSXQodCkuYXBwZW5kKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBubihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJdCh0KS5wcmVwZW5kKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBybihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJdCh0KS5odG1sKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJdChlKS5odG1sKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG9uKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEl0KHQpLnRleHQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNuKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICc8JyArIFFkICsgJyAnICsgV2QgKyAnPSInICsgZSArICciICcgKyBHZCArICc9IicgKyBlcCArICciPicgKyB0ICsgJzwvJyArIFFkICsgJz4nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjbihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzbihDZyArIEModCksIHQgKyAnIHsnICsgZSArICd9Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHVuKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNuKHdnLCB0ICsgJyB7JyArIGUgKyAnfScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghMCA9PT0gZVtwcF0gJiYgIUR0KGtnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW2ZwXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRuKHNuKHhnLCB0KSwgWGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgITAgPT09IGVbcHBdICYmIER0KGtnKSAmJiBKdChrZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZuKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFBKHQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG0oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIUR0KCcjJyArIChDZyArIEMoZSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFBKG4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlW2RwXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0bihMKCdcbicsIE0oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNuKHIsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4pKSwgWGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHBuKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQSh0KSB8fCBEdCgnIycgKyB3ZykgfHwgdG4odW4oZVtkcF0sIEwoJywgJywgdCkpLCBYZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG1uKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsbihaKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG4oWigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbihaKCksIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2bihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBuKFooKSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGJuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSnQoJyMnICsgKENnICsgQyhlKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5bigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAnIycgKyB3ZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRHQoZSkgJiYgSnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9uKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFpKGVbV2RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQ24oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWkoZVtxcF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB4bihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmtub3duJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdhdXRoZW50aWNhdGVkJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdsb2dnZWRfb3V0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBrbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW0dwXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gd24oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX24oZSkgfHwgQ24oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVuKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFIoZnVuY3Rpb24gKGUsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaVtXcF0gPSByLCBfbihuKSAmJiAoaVtXZF0gPSBuW1dkXSksIENuKG4pICYmIChpW0hwXSA9IHhuKG5bcXBdKSksIGlbWmxdID0gdCwga24obikgJiYgKGlbR3BdID0gITApLCBlLnB1c2goaSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtdLCBtKHduLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEluKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlLm5hbWVTcGFjZXMgJiYgIWUuZGF0YVNvdXJjZXMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRW4oZSwgTGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uYW1lU3BhY2VzICYmIHQucHVzaC5hcHBseSh0LCBFbihlLm5hbWVTcGFjZXMsIGpnKSksIGUuZGF0YVNvdXJjZXMgJiYgdC5wdXNoLmFwcGx5KHQsIEVuKGUuZGF0YVNvdXJjZXMsIExnKSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbChlW1BnXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtQZ10oT2cpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdSh0KSA/IEluKHQpIDogW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEFuKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoZSkgPyBudWxsIDogbChlW1RnXSkgPyBlW1RnXSh0KSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNuKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShuKSA/IG51bGwgOiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBUbihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKGVbUmddKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWwoZVtSZ11bTmddKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGVbUmddW05nXSh0LCB7IHNkaWRQYXJhbUV4cGlyeTogbiB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUocikgJiYgbChyW0ZnXSkgJiYgcltGZ10oKSA/IHIgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBQbihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbChlLmdldFZpc2l0b3JWYWx1ZXMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVlKHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgbi5wdXNoKFNnKSwgQmUoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2V0VmlzaXRvclZhbHVlcyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBPbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShVZywgZSksIHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBqbihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGUpID8gVWUoe30pIDogV2UoUG4oZSwgbiksIHQsIEJnKS5jYXRjaChPbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExuKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsKGUuZ2V0VmlzaXRvclZhbHVlcykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQWcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgbi5wdXNoKFNnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZ2V0VmlzaXRvclZhbHVlcyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdsKHIsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTW4oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShlKSA/IHt9IDogTG4oZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFZuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFooKSwgdCA9IGVbYXBdLCBuID0gZVt4cF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUbih3aW5kb3csIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBSbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBWbigpLCB0ID0gWigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gam4oZSwgdFt2cF0sIHRbX3BdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTm4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNbihWbigpLCBaKClbX3BdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRm4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEbihWbigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQm4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQW4oVm4oKSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFVuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNuKFZuKCksIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB6bihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHpnW2VdID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcW4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gemdbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEhuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW1JwXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdFtGcF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFfbChuKSB8fCBBKG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gV24oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbSGZdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIV8odCkgfHwgQSh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlW2xwXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFfKG4pIHx8IEEobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZVtzcF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFpKHIpICYmICFQKHIpIHx8ICFsKGVbSmZdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEduKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJlKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShlKSA/IHQocikgOiBuKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBZbihlLCB0LCBuLCByLCBpLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9bZV0gPSB0LCBvW25dID0gciwgb1tpXSA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzW05wXSA9IG8sIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFhuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW0hmXSwgbiA9IGVbbHBdLCByID0gZVtzcF0gfHwgV2c7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXZShHbihlW0pmXSksIHIsIEhnKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFluKEhmLCB0LCBscCwgbiwgR2YsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlKHFnLCBGZiwgciksIExlKHIpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBZbihIZiwgdCwgbHAsIG4sIE1mLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShxZywgTWYsIHIpLCBMZShyKSwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBLbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gUihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdsKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6bihGcCwgdCksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFFuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhuKGUpID8gSGUoTShYbiwgbShXbiwgZVtScF1bRnBdKSkpLnRoZW4oS24pIDogVWUoe30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAkbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBxbihGcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGUpID8ge30gOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFuKHdpbmRvdyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFpuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZXIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVlKGUubG9jYXRpb24uc2VhcmNoKVtHZ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKHQpID8gbnVsbCA6IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHRyKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFZtKFlnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQoZSkgPyBudWxsIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbnIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZXIod2luZG93KSwgdCA9IHRyKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIHx8IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFBKGUpICYmIDIgPT09IGUubGVuZ3RoICYmIE1sKGVbMF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5pbmRleE9mKCc9Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSA9PT0gdCA/IFtdIDogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zdWJzdHIoMCwgdCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnN1YnN0cih0ICsgMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYXIoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKGZ1bmN0aW9uIChlLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1KGUpID8gKHQucHVzaChpKSwgYXIoZSwgdCwgbiwgciksIHQucG9wKCkpIDogQSh0KSA/IG5bcihpKV0gPSBlIDogbltyKEwoJy4nLCB0LmNvbmNhdChpKSkpXSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWwodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVlKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gc3IoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFIoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnB1c2goaXIodCkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBbXSwgbShNbCwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbbmUoUyh0WzBdKSldID0gbmUoUyh0WzFdKSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9LCBtKHJyLCB0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGNyKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkodCkgPyBhcihlLCBbXSwgbiwgZCkgOiBhcihlLCBbXSwgbiwgdCksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHVyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkodCkgPyB7fSA6IF9sKHQpID8gc3IodCkgOiBfKHQpICYmIE1sKHQpID8gb3IodCkgOiB1KHQpID8gY3IodCkgOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2woe30sIGUsIHVyKHdpbmRvdy50YXJnZXRQYWdlUGFyYW1zQWxsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdsKHt9LCBlLCB1cih3aW5kb3cudGFyZ2V0UGFnZVBhcmFtcykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gWigpLCBuID0gdFtjcF0sIHIgPSB0W0lwXSwgaSA9IHRbRHBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAhPT0gZSA/IGxyKHIgfHwge30pIDogZ2wobHIociB8fCB7fSksIGRyKGkgfHwge30pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnY2FudmFzJyksIHQgPSBlLmdldENvbnRleHQoJ3dlYmdsJykgfHwgZS5nZXRDb250ZXh0KCdleHBlcmltZW50YWwtd2ViZ2wnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LmdldEV4dGVuc2lvbignV0VCR0xfZGVidWdfcmVuZGVyZXJfaW5mbycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaShuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQuZ2V0UGFyYW1ldGVyKG4uVU5NQVNLRURfUkVOREVSRVJfV0VCR0wpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShyKSA/IG51bGwgOiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBtcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB3aW5kb3cuZGV2aWNlUGl4ZWxSYXRpbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHdpbmRvdy5zY3JlZW4sIG4gPSB0LnN5c3RlbVhEUEksIHIgPSB0LmxvZ2ljYWxYRFBJOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWkobikgJiYgIWkocikgJiYgbiA+IHIgJiYgKGUgPSBuIC8gciksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGdyKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHdpbmRvdy5zY3JlZW4sIHQgPSBlLm9yaWVudGF0aW9uLCBuID0gZS53aWR0aCwgciA9IGUuaGVpZ2h0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID4gciA/ICdsYW5kc2NhcGUnIDogJ3BvcnRyYWl0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkodC50eXBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IEYoJy0nLCB0LnR5cGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQShhKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGFbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKG8pID8gbnVsbCA6IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGhyKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHZyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IFFnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBicihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSAhPT0gZS5pbmRleE9mKEtnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geXIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gJGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9yKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IEpnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBaZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gZWg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGtyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IHRoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB3cihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBuaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRXIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYnIoZSkgfHwgdnIoZSkgfHwgeXIoZSkgfHwgX3IoZSkgfHwgQ3IoZSkgfHwgeHIoZSkgfHwga3IoZSkgfHwgd3IoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIElyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3Vic3RyaW5nKEtnLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbUWddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlWyRnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gU3IoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtKZ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFRyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbWmddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBQcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gTShTLCBGKCcsJywgZVtlaF0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0oTWwsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBPcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3RoXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24ganIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtuaF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFIoZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFcihuKSB8fCAoZVtuXSA9IGkodCkgPyAnJyA6IHQpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE1yKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFIoZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYnIobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IElyKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQocikgfHwgKGVbcl0gPSBpKHQpID8gJycgOiB0KSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBWcihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm9ubG9hZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gMTIyMyA9PT0gZS5zdGF0dXMgPyAyMDQgOiBlLnN0YXR1czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyIDwgMTAwIHx8IHIgPiA1OTkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihuZXcgRXJyb3IoaWgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBKU09OLnBhcnNlKGUucmVzcG9uc2VUZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIG4obmV3IEVycm9yKG9oKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5nZXRBbGxSZXNwb25zZUhlYWRlcnMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZTogaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBScihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm9uZXJyb3IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KG5ldyBFcnJvcihpaCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBOcihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRpbWVvdXQgPSB0LCBlLm9udGltZW91dCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4obmV3IEVycm9yKGFoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIoZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9sKHQpICYmIGIoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNldFJlcXVlc3RIZWFkZXIobiwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiB7fSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEJyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnVybCwgbiA9IGUuaGVhZGVycywgciA9IGUuYm9keSwgYSA9IGUudGltZW91dCwgbyA9IGUuYXN5bmM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCZShmdW5jdGlvbiAoZSwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF9iZjRjOTI3NjY1MDJlYmFjID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JyksICRfX19vbGRfMmRkZDk0N2FmNmNlMGVhYSA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9iZjRjOTI3NjY1MDJlYmFjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja18zZDA0OWJjZmVjZjk1ZTg5LlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMmRkZDk0N2FmNmNlMGVhYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfM2QwNDliY2ZlY2Y5NWU4OS5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gbmV3IHdpbmRvdy5YTUxIdHRwUmVxdWVzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocyA9IFJyKHMgPSBWcihzLCBlLCBpKSwgaSkpLm9wZW4ocmgsIHQsIG8pLCBzLndpdGhDcmVkZW50aWFscyA9ICEwLCBzID0gRnIocywgbiksIG8gJiYgKHMgPSBOcihzLCBhLCBpKSksIHMuc2VuZChKU09OLnN0cmluZ2lmeShyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9iZjRjOTI3NjY1MDJlYmFjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkX2JmNGM5Mjc2NjUwMmViYWMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8yZGRkOTQ3YWY2Y2UwZWFhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzJkZGQ5NDdhZjZjZTBlYWEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJlc3BvbnNlLCBuID0gdC5zdGF0dXMsIHIgPSB0Lm1lc3NhZ2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWkobikgJiYgIWkocikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBVcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlW1NnXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihFZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB6cigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBSbigpLCB0ID0gSm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhlKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUudGhlbihVciksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBxcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5uKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBabigpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEhyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBaKClbY3BdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2woe30sIGUsIGZyKHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gV3IoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtbmV3IERhdGUoKS5nZXRUaW1lem9uZU9mZnNldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBHcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB3aW5kb3cuc2NyZWVuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IGUud2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IGUuaGVpZ2h0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3JpZW50YXRpb246IGdyKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xvckRlcHRoOiBlLmNvbG9yRGVwdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaXhlbFJhdGlvOiBtcigpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFlyKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGRvY3VtZW50LmRvY3VtZW50RWxlbWVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiBlLmNsaWVudFdpZHRoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBlLmNsaWVudEhlaWdodAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBYcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhvc3Q6IHdpbmRvdy5sb2NhdGlvbi5ob3N0bmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlYkdMUmVuZGVyZXI6IGhyKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gS3IoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHdpbmRvdy5sb2NhdGlvbi5ocmVmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmZXJyaW5nVXJsOiBkb2N1bWVudC5yZWZlcnJlcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBRcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaShlKSAmJiBlLmNoYW5uZWwgPT09IEltKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gKGUgfHwge30pLmJlYWNvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXJBZ2VudDogd2luZG93Lm5hdmlnYXRvci51c2VyQWdlbnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lT2Zmc2V0SW5NaW51dGVzOiBXcigpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbDogSW0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JlZW46IEdyKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3c6IFlyKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicm93c2VyOiBYcigpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkcmVzczogS3IoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdlbzogZSAmJiBlLmdlbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlYWNvbjogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAkcihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQSh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRbRGddLCBhID0gcGFyc2VJbnQociwgMTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc05hTihhKSB8fCAobi5sb2NhdGlvbkhpbnQgPSBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0W0lnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1sKG8pICYmIChuLmJsb2IgPSBvKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSnIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuaWQsIG4gPSBlLmludGVncmF0aW9uQ29kZSwgciA9IGUuYXV0aGVudGljYXRlZFN0YXRlLCBpID0gZS50eXBlLCBhID0gZS5wcmltYXJ5LCBvID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNbCh0KSAmJiAoby5pZCA9IHQpLCBNbChuKSAmJiAoby5pbnRlZ3JhdGlvbkNvZGUgPSBuKSwgTWwocikgJiYgKG8uYXV0aGVudGljYXRlZFN0YXRlID0gciksIE1sKGkpICYmIChvLnR5cGUgPSBpKSwgYSAmJiAoby5wcmltYXJ5ID0gYSksIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFpyKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oSnIsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlaShlLCB0LCBuLCByLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1sKHQpICYmIChhLnRudElkID0gdCksIE1sKG4pICYmIChhLnRoaXJkUGFydHlJZCA9IG4pLCBNbChlLnRoaXJkUGFydHlJZCkgJiYgKGEudGhpcmRQYXJ0eUlkID0gZS50aGlyZFBhcnR5SWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHJbQWddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWwobykgJiYgKGEubWFya2V0aW5nQ2xvdWRWaXNpdG9ySWQgPSBvKSwgTWwoZS5tYXJrZXRpbmdDbG91ZFZpc2l0b3JJZCkgJiYgKGEubWFya2V0aW5nQ2xvdWRWaXNpdG9ySWQgPSBlLm1hcmtldGluZ0Nsb3VkVmlzaXRvcklkKSwgQShlLmN1c3RvbWVySWRzKSA/IChBKGkpIHx8IChhLmN1c3RvbWVySWRzID0gWnIoaSkpLCBhKSA6IChhLmN1c3RvbWVySWRzID0gZS5jdXN0b21lcklkcywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHRpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fSwgciA9ICRyKGUuYXVkaWVuY2VNYW5hZ2VyLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEocikgfHwgKG4uYXVkaWVuY2VNYW5hZ2VyID0gciksIEEoZS5hbmFseXRpY3MpIHx8IChuLmFuYWx5dGljcyA9IGUuYW5hbHl0aWNzKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbmkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWkoZSkgJiYgTWwoZS50b2tlbikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fSwgciA9IEFyKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWwocikgJiYgKG4udG9rZW4gPSByKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcmkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWkoZSkgJiYgTWwoZS5hdXRob3JpemF0aW9uVG9rZW4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge30sIG4gPSBucigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWwobikgJiYgKHQuYXV0aG9yaXphdGlvblRva2VuID0gbiksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGlpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoZSkgPyAkdCgpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYWkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShlKSA/IFh0KCkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge30sIG4gPSBTcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShuKSB8fCAodC5pZCA9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFRyKGUpLCBhID0gcGFyc2VGbG9hdChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNOYU4oYSkgfHwgKHQudG90YWwgPSBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBQcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEobykgfHwgKHQucHVyY2hhc2VkUHJvZHVjdElkcyA9IG8pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge30sIG4gPSBPcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShuKSB8fCAodC5pZCA9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGpyKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShyKSB8fCAodC5jYXRlZ29yeUlkID0gciksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGNpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fSwgciA9IGdsKHt9LCBMcih0KSwgZS5wYXJhbWV0ZXJzIHx8IHt9KSwgaSA9IGdsKHt9LCBNcih0KSwgZS5wcm9maWxlUGFyYW1ldGVycyB8fCB7fSksIGEgPSBnbCh7fSwgb2kodCksIGUub3JkZXIgfHwge30pLCBvID0gZ2woe30sIHNpKHQpLCBlLnByb2R1Y3QgfHwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShyKSB8fCAobi5wYXJhbWV0ZXJzID0gciksIEEoaSkgfHwgKG4ucHJvZmlsZVBhcmFtZXRlcnMgPSBpKSwgQShhKSB8fCAobi5vcmRlciA9IGEpLCBBKG8pIHx8IChuLnByb2R1Y3QgPSBvKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdWkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzJdID8gYXJndW1lbnRzWzJdIDoge30sIHIgPSBaKClbY3BdLCBhID0gZS5pbmRleCwgbyA9IGUubmFtZSwgcyA9IGUuYWRkcmVzcywgYyA9IGNpKGUsIGdsKHt9LCBvID09PSByID8gdCA6IG4sIGZyKG8pKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGEpIHx8IChjLmluZGV4ID0gYSksIE1sKG8pICYmIChjLm5hbWUgPSBvKSwgQShzKSB8fCAoYy5hZGRyZXNzID0gcyksIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGxpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLm5hbWUsIHIgPSBlLmFkZHJlc3MsIGkgPSBjaShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1sKG4pICYmIChpLm5hbWUgPSBuKSwgQShyKSB8fCAoaS5hZGRyZXNzID0gciksIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRpKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLmV4ZWN1dGUsIGEgPSB2b2lkIDAgPT09IHIgPyB7fSA6IHIsIG8gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEEoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBhLnBhZ2VMb2FkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKHMpIHx8IChvLnBhZ2VMb2FkID0gY2kocywgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEubWJveGVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWkoYykgJiYgX2woYykgJiYgIUEoYykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gbSh1aCwgTShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1aShlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEodSkgfHwgKG8ubWJveGVzID0gdSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZpKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLnByZWZldGNoLCBhID0gdm9pZCAwID09PSByID8ge30gOiByLCBvID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBKGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gYS5tYm94ZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkocykgfHwgIV9sKHMpIHx8IEEocykgfHwgKG8ubWJveGVzID0gTShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVpKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYS52aWV3czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoYykgfHwgIV9sKGMpIHx8IEEoYykgfHwgKG8udmlld3MgPSBNKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGkoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGMpKSwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcGkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoUWUoKSAmJiAhSmUoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFooKSwgciA9IEJuKGUpLCBhID0gVW4oTWcpLCBvID0gVW4oVmcpLCBzID0gdC5leHBlcmllbmNlQ2xvdWQsIGMgPSAodm9pZCAwID09PSBzID8ge30gOiBzKS5hbmFseXRpY3MsIHUgPSB2b2lkIDAgPT09IGMgPyB7fSA6IGMsIGwgPSB1LmxvZ2dpbmcsIGQgPSB1LnN1cHBsZW1lbnRhbERhdGFJZCwgZiA9IHUudHJhY2tpbmdTZXJ2ZXIsIHAgPSB1LnRyYWNraW5nU2VydmVyU2VjdXJlLCBtID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGwpID8gbS5sb2dnaW5nID0gbltibV0gOiBtLmxvZ2dpbmcgPSBsLCBpKGQpIHx8IChtLnN1cHBsZW1lbnRhbERhdGFJZCA9IGQpLCBNbChyKSAmJiAobS5zdXBwbGVtZW50YWxEYXRhSWQgPSByKSwgaShmKSB8fCAobS50cmFja2luZ1NlcnZlciA9IGYpLCBNbChhKSAmJiAobS50cmFja2luZ1NlcnZlciA9IGEpLCBpKHApIHx8IChtLnRyYWNraW5nU2VydmVyU2VjdXJlID0gcCksIE1sKG8pICYmIChtLnRyYWNraW5nU2VydmVyU2VjdXJlID0gbyksIEEobSkgPyBudWxsIDogbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbWkoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IEhyKG4pLCBpID0gYXQoKSwgYSA9IERyKHIpLCBvID0gRm4oKSwgcyA9IGVpKGUuaWQgfHwge30sIGksIGEsIHQsIG8pLCBjID0gbmkoZS5wcm9wZXJ0eSwgciksIHUgPSB0aShlLmV4cGVyaWVuY2VDbG91ZCB8fCB7fSwgdCksIGwgPSByaShlLnRyYWNlKSwgZCA9IGlpKGUucHJldmlldyksIGYgPSBhaShlLnFhTW9kZSksIHAgPSBkaShlLCByLCBuKSwgbSA9IGZpKGUsIHIsIG4pLCBnID0gZS5ub3RpZmljYXRpb25zLCBoID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoLnJlcXVlc3RJZCA9IFUoKSwgaC5jb250ZXh0ID0gUXIoZS5jb250ZXh0KSwgQShzKSB8fCAoaC5pZCA9IHMpLCBBKGMpIHx8IChoLnByb3BlcnR5ID0gYyksIEEobCkgfHwgKGgudHJhY2UgPSBsKSwgQSh1KSB8fCAoaC5leHBlcmllbmNlQ2xvdWQgPSB1KSwgQShkKSB8fCAoaC5wcmV2aWV3ID0gZCksIEEoZikgfHwgKGgucWFNb2RlID0gZiksIEEocCkgfHwgKGguZXhlY3V0ZSA9IHApLCBBKG0pIHx8IChoLnByZWZldGNoID0gbSksIEEoZykgfHwgKGgubm90aWZpY2F0aW9ucyA9IGcpLCBoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnaShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gblswXSwgaSA9IG5bMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtaShlLCByLCBnbCh7fSwgaSwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6cigpLnRoZW4oZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnaShlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHZpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdpKGUsIHQsIHFyKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBiaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQKHQpID8gdCA8IDAgPyBlW3NwXSA6IHQgOiBlW3NwXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geWkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbb3BdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVbYnBdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQobikgPyB0IDogJycgKyBzaCArIG4gKyBjaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gX2koZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt3cF0gKyAnLy8nICsgeWkoZSkgKyBlW0JwXSArICc/JyArIHRlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudDogZVtpcF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uSWQ6IHJ0KCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiBlW2xwXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQ2koZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFooKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJyKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogX2kobiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBjKHt9LCB0bSwgW25tXSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dDogYmkobiwgdCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhc3luYzogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdsKGUsIHsgZGVjaXNpb25pbmdNZXRob2Q6IFhsLlNFUlZFUl9TSURFIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geGkoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQWUoJGYsIHQpLCBMZSh7IHJlcXVlc3Q6IHQgfSksIENpKHQsIG4pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShRZiwgZSksIExlKHsgcmVzcG9uc2U6IGUgfSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24ga2koZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiBGZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHdpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogTWYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBFaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBJaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIUVpKGUpICYmIE1sKGUuZXZlbnRUb2tlbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFBKGUpICYmICFUKGUudHlwZSkgJiYgTWwoZS5ldmVudFRva2VuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQWkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFEaShlKSAmJiBNbChlLnNlbGVjdG9yKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gU2koZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1KHQpICYmIE1sKHQudG50SWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBUaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXNwb25zZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNpKHQpICYmIGl0KHQuaWQudG50SWQpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBQaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXNwb25zZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNpKHQpICYmIGN0KHQuaWQudG50SWQpLCBjdChudWxsKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gT2koKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gKGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30pLnRyYWNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBKGUpIHx8IGplKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBqaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXNwb25zZSwgbiA9IHQuZXhlY3V0ZSwgciA9IHZvaWQgMCA9PT0gbiA/IHt9IDogbiwgaSA9IHQucHJlZmV0Y2gsIGEgPSB2b2lkIDAgPT09IGkgPyB7fSA6IGksIG8gPSB0Lm5vdGlmaWNhdGlvbnMsIHMgPSB2b2lkIDAgPT09IG8gPyB7fSA6IG8sIGMgPSByLnBhZ2VMb2FkLCB1ID0gdm9pZCAwID09PSBjID8ge30gOiBjLCBsID0gci5tYm94ZXMsIGQgPSB2b2lkIDAgPT09IGwgPyBbXSA6IGwsIGYgPSBhLm1ib3hlcywgcCA9IHZvaWQgMCA9PT0gZiA/IFtdIDogZiwgbSA9IGEudmlld3MsIGcgPSB2b2lkIDAgPT09IG0gPyBbXSA6IG07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPaSh1KSwgYihPaSwgZCksIGIoT2ksIHApLCBiKE9pLCBnKSwgYihPaSwgcyksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnF1ZXJ5S2V5LCBuID0gdFtPaF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghXyhuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoVChuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE1hdGgucm91bmQoVigpIC8gMTAwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W09oXSA9IG4ucmVwbGFjZSgvXHxUUz1cZCsvLCAnfFRTPScgKyByKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTWkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5xdWVyeUtleTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVmkoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGllKGUpLCBpID0gci5wcm90b2NvbCwgYSA9IHIuaG9zdCwgbyA9IHIucGF0aCwgcyA9ICcnID09PSByLnBvcnQgPyAnJyA6ICc6JyArIHIucG9ydCwgYyA9IFQoci5hbmNob3IpID8gJycgOiAnIycgKyByLmFuY2hvciwgdSA9IG4ociksIGwgPSB0ZShnbCh7fSwgdSwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSArICc6Ly8nICsgYSArIHMgKyBvICsgKFQobCkgPyAnJyA6ICc/JyArIGwpICsgYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUmkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVmkoZSwgdCwgTGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBOaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBWaShlLCB0LCBNaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmNvbnRlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlKEVmLCBlKSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBnbCh7fSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmNvbnRlbnQgPSBSaSh0LCB7fSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEJpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBVaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtOaF0gfHwgVmgsIG4gPSBlW0ZoXSB8fCBCaShNaCksIHIgPSBlW0JoXSB8fCB7fSwgYSA9IGVbVWhdIHx8IG51bGwsIG8gPSBlW3poXSB8fCAhMSwgcyA9IGVbcWhdIHx8IDMwMDAsIGMgPSAhIWkoZVtIaF0pIHx8ICEwID09PSBlW0hoXSwgdSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdVtOaF0gPSB0LCB1W0ZoXSA9IG4sIHVbQmhdID0gciwgdVtVaF0gPSBhLCB1W3poXSA9IG8sIHVbcWhdID0gcywgdVtIaF0gPSBjLCB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB6aShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm9ubG9hZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gMTIyMyA9PT0gZS5zdGF0dXMgPyAyMDQgOiBlLnN0YXR1czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyIDwgMTAwIHx8IHIgPiA1OTkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihuZXcgRXJyb3IoamgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZS5yZXNwb25zZVRleHQsIGEgPSBlLmdldEFsbFJlc3BvbnNlSGVhZGVycygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXM6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlOiBpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHFpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUub25lcnJvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQobmV3IEVycm9yKGpoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEhpKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudGltZW91dCA9IHQsIGUub250aW1lb3V0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihuZXcgRXJyb3IoTGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gV2koZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IHQgJiYgKGUud2l0aENyZWRlbnRpYWxzID0gdCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEdpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIoZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zZXRSZXF1ZXN0SGVhZGVyKG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBZaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gVWkodCksIHIgPSBuW05oXSwgaSA9IG5bRmhdLCBhID0gbltCaF0sIG8gPSBuW1VoXSwgcyA9IG5bemhdLCBjID0gbltxaF0sIHUgPSBuW0hoXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJlKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IG5ldyBlLlhNTEh0dHBSZXF1ZXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobCA9IHFpKGwgPSB6aShsLCB0LCBuKSwgbikpLm9wZW4ociwgaSwgdSksIGwgPSBHaShsID0gV2kobCwgcyksIGEpLCB1ICYmIChsID0gSGkobCwgYywgbikpLCBsLnNlbmQobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBYaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBZaSh3aW5kb3csIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBLaShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByW05oXSA9IFZoLCByW0ZoXSA9IE5pKGUsIHQpLCByW3FoXSA9IG4sIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFFpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPj0gMjAwICYmIGUgPCAzMDAgfHwgMzA0ID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAkaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghUWkoZS5zdGF0dXMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXNwb25zZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFQodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4udHlwZSA9IFVkLCBuLmNvbnRlbnQgPSB0LCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBYaShLaShlLmNvbnRlbnQsIHt9LCBaKClbcWhdKSkudGhlbigkaSkuY2F0Y2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBaaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtjZF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFdoLmV4ZWModCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKG4pIHx8IDIgIT09IG4ubGVuZ3RoID8gJycgOiBuWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudChaZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uaW5uZXJIVE1MID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLmZpcnN0RWxlbWVudENoaWxkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShyKSA/IHQgOiAoci5pZCA9IGUsIHIub3V0ZXJIVE1MKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbZWRdLCBuID0gWmkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKG4pIHx8IFQodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlW2NkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbY2RdID0gci5yZXBsYWNlKEdoLCAnJyksIGVbZWRdID0gZWEobiwgdCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG5hKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFpKGUuc2VsZWN0b3IpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbmEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0YShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8odFtlZF0pID8gdCA6IChBZSh5ZiwgdCksIG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbmEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0YShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8odFtlZF0pID8gdCA6IChBZSh5ZiwgdCksIG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbmEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0YShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8odFtlZF0pID8gdCA6IChBZSh5ZiwgdCksIG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbmEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0YShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8odFtlZF0pID8gdCA6IChBZSh5ZiwgdCksIG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbmEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0YShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8odFtlZF0pID8gdCA6IChBZSh5ZiwgdCksIG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbmEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0YShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8odFtlZF0pID8gdCA6IChBZSh5ZiwgdCksIG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1YShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbmEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0YShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8odFtlZF0pID8gdCA6IChBZSh5ZiwgdCksIG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuYShlKSA/IF8oZVtlZF0pID8gZSA6IChBZSh5ZiwgZSksIG51bGwpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmEoZSkgPyB1KGVbZWRdKSA/IGUgOiAoQWUoX2YsIGUpLCBudWxsKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5hKGUpID8gXyhlW2VkXSkgPyBlIDogKEFlKElmLCBlKSwgbnVsbCkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuYShlKSA/IHUoZVtlZF0pID8gZSA6IChBZShDZiwgZSksIG51bGwpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbWEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmEoZSkgPyB1KGVbZWRdKSA/IGUgOiAoQWUoeGYsIGUpLCBudWxsKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGdhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5hKGUpID8gdShlW2VkXSkgPyBlIDogKEFlKGtmLCBlKSwgbnVsbCkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuYShlKSA/IGUgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2YShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuYShlKSA/IHUoZVtlZF0pID8gZSA6IChBZSh3ZiwgZSksIG51bGwpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYmEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuY29udGVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQodCkgPyAoQWUoRWYsIGUpLCBudWxsKSA6IChlLmNvbnRlbnQgPSBSaSh0LCB7fSksIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5YShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtabF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGxkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGZkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIERkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFNkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9hKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFBkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEVkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIElkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIENkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG1kOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGdkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGhkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGJkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1hKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHlkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIF9kOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGhhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHZkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHhkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gX2EoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbZWRdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIV9sKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbShZaCwgTSh5YSwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQShuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGdsKHt9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuY29udGVudCA9IG4sIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIENhKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IChhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6IHt9KS5vcHRpb25zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2woZSkgPyBBKGUpID8gW10gOiBiaChNKGtoLCBlKSkgOiBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geGEoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiB7fSwgdCA9IGUuZXhlY3V0ZSwgbiA9IHZvaWQgMCA9PT0gdCA/IHt9IDogdCwgciA9IGUucHJlZmV0Y2gsIGkgPSB2b2lkIDAgPT09IHIgPyB7fSA6IHIsIGEgPSBuLnBhZ2VMb2FkLCBvID0gdm9pZCAwID09PSBhID8ge30gOiBhLCBzID0gbi5tYm94ZXMsIGMgPSB2b2lkIDAgPT09IHMgPyBbXSA6IHMsIHUgPSBpLm1ib3hlcywgbCA9IHZvaWQgMCA9PT0gdSA/IFtdIDogdSwgZCA9IGkudmlld3MsIGYgPSB2b2lkIDAgPT09IGQgPyBbXSA6IGQsIHAgPSBDYShvKSwgbSA9IGgoTShDYSwgYykpLCBnID0gaChNKENhLCBsKSksIHYgPSBoKE0oQ2EsIGYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGgoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24ga2EoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gKGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30pLmV4ZWN1dGUsIHQgPSB2b2lkIDAgPT09IGUgPyB7fSA6IGUsIG4gPSB0LnBhZ2VMb2FkLCByID0gdm9pZCAwID09PSBuID8ge30gOiBuLCBpID0gdC5tYm94ZXMsIGEgPSB2b2lkIDAgPT09IGkgPyBbXSA6IGksIG8gPSBfaChyKSB8fCBbXSwgcyA9IGgoYmgoTShfaCwgYSkpKSwgYyA9IGgoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIHUgPSBoKE0oQ2gsIG0oaGgsIGMpKSksIGwgPSBtKHZoLCBjKSwgZCA9IG0odmgsIHUpLCBmID0gbC5jb25jYXQoZCksIHAgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEEoZikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBmWzBdLmNvbnRlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKGcpIHx8IChwLnVybCA9IGcpLCBwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB3YSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAoYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiB7fSkuYW5hbHl0aWNzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShlKSA/IFtdIDogW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBFYSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6IHt9LCB0ID0gZS5leGVjdXRlLCBuID0gdm9pZCAwID09PSB0ID8ge30gOiB0LCByID0gZS5wcmVmZXRjaCwgaSA9IHZvaWQgMCA9PT0gciA/IHt9IDogciwgYSA9IG4ucGFnZUxvYWQsIG8gPSB2b2lkIDAgPT09IGEgPyB7fSA6IGEsIHMgPSBuLm1ib3hlcywgYyA9IHZvaWQgMCA9PT0gcyA/IFtdIDogcywgdSA9IGkubWJveGVzLCBsID0gdm9pZCAwID09PSB1ID8gW10gOiB1LCBkID0gaS52aWV3cywgZiA9IHZvaWQgMCA9PT0gZCA/IFtdIDogZCwgcCA9IGkubWV0cmljcywgbSA9IHZvaWQgMCA9PT0gcCA/IFtdIDogcCwgZyA9IHdhKG8pLCB2ID0gaChNKHdhLCBjKSksIGIgPSBoKE0od2EsIGwpKSwgeSA9IGgoTSh3YSwgZikpLCBfID0gaChNKHdhLCBtKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBJYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucGFyYW1ldGVycyA9IHQucGFyYW1ldGVycywgZS5wcm9maWxlUGFyYW1ldGVycyA9IHQucHJvZmlsZVBhcmFtZXRlcnMsIGUub3JkZXIgPSB0Lm9yZGVyLCBlLnByb2R1Y3QgPSB0LnByb2R1Y3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0WzBdLCByID0gdFsxXSwgaSA9ICFBKG4pLCBhID0gIUEocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpIHx8IGEgPyAoaSAmJiAoZS5vcHRpb25zID0gbiksIGEgJiYgKGUubWV0cmljcyA9IHIpLCBlKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEFhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB4ZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVZShGaShlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgemQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSmkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgWWY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVWUoX2EoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFfbChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVZShbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVlKFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBtKHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShuKSA/IFVlKFtdKSA6IEhlKE0oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBYShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbikpLnRoZW4oYmgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBUYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfbChlKSA/IEEoZSkgPyBVZShbXSkgOiBVZShtKHQsIGUpKSA6IFVlKFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVzcG9uc2UuZXhlY3V0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF1KHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVlKG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQucGFnZUxvYWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdShuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVZShudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLmFuYWx5dGljcywgaSA9IG4ub3B0aW9ucywgYSA9IG4ubWV0cmljcywgbyA9IHsgYW5hbHl0aWNzOiByIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBIZShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTYShpLCBFaSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUYShhLCBBaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERhKG8sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gT2EoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubmFtZSwgbiA9IGUuYW5hbHl0aWNzLCByID0gZS5vcHRpb25zLCBpID0gZS5tZXRyaWNzLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5hbHl0aWNzOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSGUoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2EociwgRWkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGEoaSwgRGkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEYShhLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGphKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJlc3BvbnNlLmV4ZWN1dGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdSh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVZShbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5tYm94ZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhX2wobikgfHwgQShuKSA/IFVlKFtdKSA6IEhlKE0oT2EsIG0oSWgsIG4pKSkudGhlbihiaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExhKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuaW5kZXggPT09IHQgJiYgZS5uYW1lID09PSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNYShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5wcmVmZXRjaCwgaSA9ICh2b2lkIDAgPT09IHIgPyB7fSA6IHIpLm1ib3hlcywgYSA9IHZvaWQgMCA9PT0gaSA/IFtdIDogaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoYSkgPyBudWxsIDogZyhtKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTGEoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVmEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuaW5kZXgsIHIgPSB0Lm5hbWUsIGEgPSB0LnN0YXRlLCBvID0gdC5hbmFseXRpY3MsIHMgPSB0Lm9wdGlvbnMsIGMgPSB0Lm1ldHJpY3MsIHUgPSBNYShlLCBuLCByKSwgbCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuYWx5dGljczogbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkodSkgfHwgSWEobCwgdSksIEhlKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNhKHMsIElpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRhKGMsIERpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGEobCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBSYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXF1ZXN0LCBuID0gZS5yZXNwb25zZS5wcmVmZXRjaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF1KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVlKFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLm1ib3hlczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFfbChyKSB8fCBBKHIpID8gVWUoW10pIDogSGUoTShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFZhKHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBtKERoLCByKSkpLnRoZW4oYmgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBOYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5wcmVmZXRjaCwgbiA9ICh2b2lkIDAgPT09IHQgPyB7fSA6IHQpLnZpZXdzLCByID0gdm9pZCAwID09PSBuID8gW10gOiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShyKSA/IG51bGwgOiByWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBGYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5uYW1lLCByID0gdC5zdGF0ZSwgYSA9IHQuYW5hbHl0aWNzLCBvID0gdC5vcHRpb25zLCBzID0gdC5tZXRyaWNzLCBjID0gTmEoZSksIHUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogbi50b0xvd2VyQ2FzZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuYWx5dGljczogYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoYykgfHwgSWEodSwgYyksIEhlKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNhKG8sIElpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRhKHMsIEFpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGEodSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBCYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXF1ZXN0LCBuID0gZS5yZXNwb25zZS5wcmVmZXRjaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF1KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVlKFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLnZpZXdzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIV9sKHIpIHx8IEEocikgPyBVZShbXSkgOiBIZShNKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRmEodCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG0oQWgsIHIpKSkudGhlbihiaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFVhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJlc3BvbnNlLnByZWZldGNoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdSh0KSA/IFRhKHQubWV0cmljcywgQWkpIDogVWUoW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB6YShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXNwb25zZSwgbiA9IHQucmVtb3RlTWJveGVzLCByID0gdC5yZW1vdGVWaWV3cywgaSA9IHQuZGVjaXNpb25pbmdNZXRob2QsIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUobikgJiYgKGEucmVtb3RlTWJveGVzID0gbiksIHUocikgJiYgKGEucmVtb3RlVmlld3MgPSByKSwgXyhpKSAmJiAoYS5kZWNpc2lvbmluZ01ldGhvZCA9IGkpLCBVZShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcWEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShlKSB8fCBUKGUuaWQpID8gVWUobnVsbCkgOiBVZSh7IGlkOiBlLmlkIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBIYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXNwb25zZS5ub3RpZmljYXRpb25zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2wodCkgPyBIZShNKHFhLCB0KSkudGhlbihiaCkgOiBVZShbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFdhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlWzBdLCBuID0gZVsxXSwgciA9IGVbMl0sIGkgPSBlWzNdLCBhID0gZVs0XSwgbyA9IGVbNV0sIHMgPSBlWzZdLCBjID0ge30sIGwgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSh0KSAmJiAobC5wYWdlTG9hZCA9IHQpLCBBKG4pIHx8IChsLm1ib3hlcyA9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShyKSB8fCAoZC5tYm94ZXMgPSByKSwgQShpKSB8fCAoZC52aWV3cyA9IGkpLCBBKGEpIHx8IChkLm1ldHJpY3MgPSBhKSwgQShsKSB8fCAoYy5leGVjdXRlID0gbCksIEEoZCkgfHwgKGMucHJlZmV0Y2ggPSBkKSwgQShvKSB8fCAoYy5tZXRhID0gbyksIEEocykgfHwgKGMubm90aWZpY2F0aW9ucyA9IHMpLCBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBHYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdihbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBIZShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYSh0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGphKHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUmEodCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCYSh0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVhKHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgemEodCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIYSh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKS50aGVuKFdhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWWEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIUEoa2EoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBYYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0geGEoZSksIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEodCkgfHwgKG4ucmVzcG9uc2VUb2tlbnMgPSB0KSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gS2EoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFhhKGUpLCBuID0gRWEoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKG4pIHx8ICh0LmFuYWx5dGljc0RldGFpbHMgPSBuKSwgQWUoaGYsIGUpLCBndCh0LCBZYShlKSksIFVlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBRYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gWGEodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLm1ib3ggPSBlLCBBZShoZiwgdCksIGd0KG4sIFlhKHQpKSwgVWUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICRhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKGdmLCBlKSwgaHQoeyBlcnJvcjogZSB9KSwgemUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEphKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKGdmLCB0KSwgaHQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWJveDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB6ZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWmEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFooKVtjcF0sIG4gPSBlLm1ib3gsIHIgPSBlLnRpbWVvdXQsIGkgPSB1KGUucGFyYW1zKSA/IGUucGFyYW1zIDoge30sIGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRYShuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKYShuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHMgPSB7fSwgYyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID09PSB0ID8gYy5wYWdlTG9hZCA9IHt9IDogYy5tYm94ZXMgPSBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLCBzLmV4ZWN1dGUgPSBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IHBpKG4sIHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUEobCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLmFuYWx5dGljcyA9IGwsIHMuZXhwZXJpZW5jZUNsb3VkID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbXQoeyBtYm94OiBuIH0pLCBoaShzLCBpKS50aGVuKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geGkoZSwgdCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oR2EpLnRoZW4oYSkuY2F0Y2gobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGVvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBaKClbY3BdLCBuID0gZS5jb25zdW1lcklkLCByID0gdm9pZCAwID09PSBuID8gdCA6IG4sIGkgPSBlLnJlcXVlc3QsIGEgPSBlLnRpbWVvdXQsIG8gPSBwaShyLCBpKSwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEthKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFBKG8pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IGkuZXhwZXJpZW5jZUNsb3VkIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5hbmFseXRpY3MgPSBvLCBpLmV4cGVyaWVuY2VDbG91ZCA9IHU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG10KHt9KSwgaGkoaSwge30pLnRoZW4oZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4aShlLCB0LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihHYSkudGhlbihzKS5jYXRjaChjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSXQodCkuYWRkQ2xhc3MoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG5vKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEl0KHQpLmNzcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcm8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSXQodCkuYXR0cihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaW8oZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSXQobikuYXR0cihlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYW8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSXQodCkucmVtb3ZlQXR0cihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gb28oZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHJvKGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNbChyKSAmJiAoYW8oZSwgbiksIGlvKHQsIHIsIG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gc28oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWwocm8oZSwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgRXJyb3IoJ0NvdWxkIG5vdCBmaW5kOiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHVvKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJlKGZ1bmN0aW9uIChyLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFZlKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQSh0KSB8fCAoYS5kaXNjb25uZWN0KCksIHIodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmRpc2Nvbm5lY3QoKSwgaShjbyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KSwgYS5vYnNlcnZlKGRvY3VtZW50LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGRMaXN0OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJ0cmVlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsbygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50W1hoXSA9PT0gS2g7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZvKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJlKGZ1bmN0aW9uIChyLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBKHQpID8gd2luZG93LnJlcXVlc3RBbmltYXRpb25GcmFtZShhKSA6IHIodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKCksIHooZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkoY28oZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwbyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCZShmdW5jdGlvbiAociwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQSh0KSA/IHooYSwgUWgpIDogcih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoKSwgeihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShjbyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG1vKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IFooKVtocF0sIG4gPSBhcmd1bWVudHMubGVuZ3RoID4gMiAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1syXSA/IGFyZ3VtZW50c1syXSA6IEl0LCByID0gbihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEocikgPyBNZSgpID8gdW8oZSwgdCwgbikgOiBsbygpID8gZm8oZSwgdCwgbikgOiBwbyhlLCB0LCBuKSA6IFVlKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBybyhGZCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGhvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNvKEZkLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdm8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9vKEhkLCBGZCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEQoTHQoSmQsIGUpKSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGJvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvbyhGZCwgSGQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBEKEx0KEpkLCBlKSkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5byhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShTZiwgZSksIHJvKEhkLCBpbyhIZCwgZSwgU3QoJzwnICsgSmQgKyAnLz4nKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBfbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbShobywgRChMdChKZCwgZSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEodCkgfHwgYih5bywgTShnbywgdCkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2KFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX28sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geG8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHJvKEhkLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1sKHQpID8gdCA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGtvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0oTWwsIE0oeG8sIEQoTHQocWQsIGUpKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB3byhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBSKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQWUoTGYsIHQpLCBMZSh7IHJlbW90ZVNjcmlwdDogdCB9KSwgeWwodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgVWUoKSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIElvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKG1mLCB0KSwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIgPSBJdCh0W2NkXSksIGkgPSBDbyhBdCh0W2VkXSkpLCBhID0ga28oaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gVWUoZShyLCBpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6ZShJbyh0LCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoYSkgPyBuLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVvKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElvKHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IG4udGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd28oYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVvKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElvKHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQW8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEF0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTCgnJywgUihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHVzaChhbihBdCh0KSkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBbXSwgRChMdCgkaCwgdCkpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBnbCh7fSwgZSksIG4gPSB0W2VkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFQobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBJdCh0W2NkXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqdChYZCwgcikgPyAodFtabF0gPSBEZCwgdFtlZF0gPSBBbyhuKSwgdCkgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBUbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmluZGV4T2YoJ3B4JykgPT09IGUubGVuZ3RoIC0gMiA/IGUgOiBlICsgJ3B4JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcm4oYW4odCksIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBPbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShiZiwgZSksIERvKFBvLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gam8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEl0KGVbY2RdKSwgbiA9IGVbZWRdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQWUoYmYsIGUpLCBMZSh7IGFjdGlvbjogZSB9KSwgb24obiwgdCksIFVlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBMbyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0bihhbih0KSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE1vKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlKGJmLCBlKSwgRG8oTG8sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBWbyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBubihhbih0KSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFJvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlKGJmLCBlKSwgRG8oVm8sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBObyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gT3QoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKdChlbihhbih0KSwgZSkpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBGbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShiZiwgZSksIERvKE5vLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQm8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVHQoZW4oYW4odCksIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVW8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQWUoYmYsIGUpLCBEbyhCbywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHpvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFB0KFp0KGFuKHQpLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHFvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlKGJmLCBlKSwgRG8oem8sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBIbyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPdChlbihhbih0KSwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBXbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShiZiwgZSksIERvKEhvLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gR28oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbZWRdLCBuID0gSXQoZVtjZF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQWUoYmYsIGUpLCBMZSh7IGFjdGlvbjogZSB9KSwgYW8oSGQsIG4pLCBpbyhIZCwgeW8odCksIG4pLCBVZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWW8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbZWRdLCBuID0gSXQoZVtjZF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQWUoYmYsIGUpLCBMZSh7IGFjdGlvbjogZSB9KSwgYihmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlvKHQsIGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KSwgVWUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFhvKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYihmdW5jdGlvbiAodCwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0eWxlLnNldFByb3BlcnR5KHIsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEQoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBLbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gSXQoZVtjZF0pLCBuID0gZVtlZF0sIHIgPSBuW3NkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlKGJmLCBlKSwgTGUoeyBhY3Rpb246IGUgfSksIFQocikgPyBubyhuLCB0KSA6IFhvKHQsIG4sIHIpLCBVZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUW8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEl0KGVbY2RdKSwgbiA9IGVbZWRdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbltuZF0gPSBUbyhuW25kXSksIG5bdGRdID0gVG8oblt0ZF0pLCBBZShiZiwgZSksIExlKHsgYWN0aW9uOiBlIH0pLCBubyhuLCB0KSwgVWUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICRvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBJdChlW2NkXSksIG4gPSBlW2VkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5bcmRdID0gVG8obltyZF0pLCBuW2lkXSA9IFRvKG5baWRdKSwgQWUoYmYsIGUpLCBMZSh7IGFjdGlvbjogZSB9KSwgbm8obiwgdCksIFVlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gSXQoZVtjZF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQWUoYmYsIGUpLCBMZSh7IGFjdGlvbjogZSB9KSwgSnQodCksIFVlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBabyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gSXQoZVtjZF0pLCBuID0gZVtlZF0sIHIgPSBOdW1iZXIoblthZF0pLCBpID0gTnVtYmVyKG5bb2RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzTmFOKHIpICYmIGlzTmFOKGkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlKEFmLCBlKSwgemUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gRChNdCh0KSksIG8gPSBhW3JdLCBzID0gYVtpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIER0KG8pICYmIER0KHMpID8gKEFlKGJmLCBlKSwgTGUoeyBhY3Rpb246IGUgfSksIHIgPCBpID8gWnQobywgcykgOiBlbihvLCBzKSwgVWUoZSkpIDogKEFlKERmLCBlKSwgemUoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gU28oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodFtabF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBsZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBmZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBEZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBTZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBSbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBQZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBFZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBJZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBtZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBZbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBnZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBHbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBoZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBLbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBiZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB5ZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBfZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB2ZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBabyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0cyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW1psXSA9PT0ga2QgfHwgZVtabF0gPT09IHdkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBucyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtjZF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNbCh0KSB8fCB4dCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcnMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUua2V5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVQodCkgJiYgbnMoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZVtjZF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbyhKaCwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaXMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbdWRdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUKHQpIHx8IGJuKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChucyhlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW2NkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRzKGUpID8gdG8obnAsIHQpIDogKHRvKHRwLCB0KSwgaXMoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIoYXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5rZXk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVtabF0gPT09IENkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbWXBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGVbY2RdLCByID0gcm8oSmgsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciAhPT0gdCB8fCByID09PSB0ICYmICFlW1lwXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gY3MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3MoZSkgPyBlcyhlKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZSh2ZiwgZSksIExlKHsgYWN0aW9uOiBlIH0pLCBycyhlKSwgYXMoZSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZShtZiwgdCksIExlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb246IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZ2woe30sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5bTWZdID0gITAsIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogKGFzKGUpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdXMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG0oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gZVtNZl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh0KSA/IFVlKCkgOiAob3ModCksIHplKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbW8oZVtjZF0pLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZ2woe30sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbTWZdID0gITAsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBscyhlKS50aGVuKGNzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZnMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSGUoTShkcywgZSkpLnRoZW4odXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwcyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJdChuKS5vbihlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbXMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSXQobikub2ZmKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBncyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtbyhlW2NkXSkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTGUoeyBtZXRyaWM6IGUgfSksIGdsKHsgZm91bmQ6ICEwIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGUoWmgsIGUpLCBMZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0cmljOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6IFpoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGhzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLm5hbWUsIG4gPSBxbihLcCkgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bdF0gPSBlLCB6bihLcCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHZzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IHt9LCBuID0gdC5wYWdlLCByID0gdm9pZCAwID09PSBuIHx8IG4sIGEgPSAocW4oS3ApIHx8IHt9KVtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0LmltcHJlc3Npb25JZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkobykgPyBhIDogZ2woewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltcHJlc3Npb25JZDogbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYnMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKGhzLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geXMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtldl1bdHZdKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBfcyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbdG1dID0gW25tXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaVtOaF0gPSBSaCwgaVtGaF0gPSB0LCBpW1VoXSA9IG4sIGlbemhdID0gITAsIGlbSGhdID0gITEsIGlbQmhdID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIENzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGV2IGluIGUgJiYgdHYgaW4gZVtldl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHhzKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIENzKHdpbmRvdykgPyB5cyh3aW5kb3csIGUsIHQpIDogX3MoWGksIGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBrcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcGkoZSwge30pLCBuID0geyBjb250ZXh0OiB7IGJlYWNvbjogITAgfSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUEodCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmFuYWx5dGljcyA9IHQsIG4uZXhwZXJpZW5jZUNsb3VkID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gd3MoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHZpKGtzKGUpLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIubm90aWZpY2F0aW9ucyA9IG4sIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVzKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGhpKGtzKGUpLCB0KS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5ub3RpZmljYXRpb25zID0gbiwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIElzKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogVSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVzdGFtcDogVigpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyczogZS5wYXJhbWV0ZXJzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZmlsZVBhcmFtZXRlcnM6IGUucHJvZmlsZVBhcmFtZXRlcnMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcmRlcjogZS5vcmRlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2R1Y3Q6IGUucHJvZHVjdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShuKSB8fCAoci50b2tlbnMgPSBuKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRHMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUubmFtZSwgaSA9IGUuc3RhdGUsIGEgPSBJcyhlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubWJveCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBcyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5uYW1lLCBpID0gZS5zdGF0ZSwgYSA9IElzKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS52aWV3ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiBpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBfaShaKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geHModCwgSlNPTi5zdHJpbmdpZnkoZSkpID8gKEFlKG52LCB0LCBlKSwgITApIDogKERlKHJ2LCB0LCBlKSwgITEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBUcyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZnIoWigpW2NwXSksIGkgPSBJcyhjaSh7fSwgciksIHQsIFtuXSksIGEgPSB3cyhVKCksIHIsIFtpXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFlKHN2LCBlLCBpKSwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBTcyhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUHMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGZyKGUpLCBpID0gSXMoY2koe30sIHIpLCB0LCBbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLm1ib3ggPSB7IG5hbWU6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB3cyhVKCksIHIsIFtpXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFlKGN2LCBlLCBpKSwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWJveDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgU3MoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE9zKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBaKClbY3BdLCBuID0gW10sIHIgPSBlbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubWJveCwgYSA9IGUuZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWkoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBhLmV2ZW50VG9rZW5zLCBzID0gdm9pZCAwID09PSBvID8gW10gOiBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBKHMpIHx8IG4ucHVzaChEcyh0LCByLCBzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSksICFBKG4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHdzKHQsIHt9LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFlKG92LCBuKSwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogbHYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQ6IGR2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBTcyhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBqcyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZnIoWigpW2NwXSksIGkgPSBJcyhjaSh7fSwgciksIHQsIFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkudmlldyA9IHsgbmFtZTogZSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHdzKFUoKSwgciwgW2ldKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQWUodXYsIGUsIGkpLCBMZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWV3OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBTcyhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudmlld05hbWUsIG4gPSBlLmltcHJlc3Npb25JZCwgciA9IGZyKFooKVtjcF0pLCBpID0gSXMoY2koe30sIHIpLCBlbSwgW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnZpZXcgPSB7IG5hbWU6IHQgfSwgQWUoaXYsIHQpLCBFcyh0LCByLCBbaV0pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaW1wcmVzc2lvbklkID0gbiwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZXc6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQ6IGZ2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBTcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE1zKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudmlldywgbiA9IGUuZGF0YSwgciA9ICh2b2lkIDAgPT09IG4gPyB7fSA6IG4pLmV2ZW50VG9rZW5zLCBhID0gdm9pZCAwID09PSByID8gW10gOiByLCBvID0gdC5uYW1lLCBzID0gdC5pbXByZXNzaW9uSWQsIGMgPSB2cyhvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaShjKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gd3Mobywge30sIFtBcyhjLCBlbSwgYSldKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LmltcHJlc3Npb25JZCA9IHMsIEFlKGF2LCBvLCBhKSwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWV3OiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudDogZHYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IHUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgU3ModSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVnMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID09PSBZZCAmJiB0byhucCwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFJzKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFpKHB2W2VdKSAmJiAhaShwdltlXVt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE5zKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkocHZbZV0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHAocHYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQShyKSB8fCBiKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYihmdW5jdGlvbiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHB2W2VdW3JdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtcyh0LCBpLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBwKHB2W2VdKSksIGRlbGV0ZSBwdltlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZzKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHZbZV0gPSBwdltlXSB8fCB7fSwgcHZbZV1bdF0gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBCcyhlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbi50eXBlLCBhID0gbi5zZWxlY3RvciwgbyA9IG4uZXZlbnRUb2tlbiwgcyA9IEMoaSArICc6JyArIGEgKyAnOicgKyBvKSwgYyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihlLCBpLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZzKGksIGEpLCB0ID8gUnMoZSwgcykgfHwgKE5zKGUsIGksIGEpLCBGcyhlLCBzLCBjKSwgcHMoaSwgYywgYSkpIDogcHMoaSwgYywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFVzKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhlKE0oZ3MsIG4pKS50aGVuKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYihmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCcyhlLCB0LCBuLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG0oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5mb3VuZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4pKSwgdnYoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goYnYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB6cyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVcyhlLm5hbWUsICExLCBodihlKSwgUHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBxcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVcyhlLm5hbWUsICEwLCBodihlKSwganMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBIcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVcyhtdiwgITEsIGh2KGUpLCBUcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFdzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVzKGd2LCAhMSwgaHYoZSksIFRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gR3MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE0oX3YsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBobih5aCh0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFlzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBNKF92LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm4oYmgodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBYcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbShoaCwgX2goZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaChNKHl2LCB0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEtzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoZSkgJiYgZS50eXBlICE9PSBwZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUXMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdsKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG0oS3MsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gJHMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuZXZlbnRUb2tlbiwgaSA9IGUucmVzcG9uc2VUb2tlbnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmcyhRcyhlLmNvbnRlbnQsIHQsIG4pKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBDdih7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRUb2tlbjogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZVRva2VuczogaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKHh2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSnMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShlKSAmJiBlLnR5cGUgIT09IEJkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBacyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNKGUsIG0oSnMsIF9oKHQpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGVjKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBjKHsgc3RhdHVzOiBGZiB9LCBlLCB0KSwgaSA9IE0oVGgsIG0oZ2gsIG4pKSwgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShpKSB8fCAoci5zdGF0dXMgPSBNZiwgYS5lcnJvcnMgPSBpKSwgQShhKSB8fCAoci5kYXRhID0gYSksIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHRjKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBjKHsgc3RhdHVzOiBGZiB9LCBlLCB0KSwgaSA9IE0oVGgsIG0oZ2gsIG4pKSwgYSA9IE0oVGgsIG0oa3YsIG4pKSwgbyA9IGJoKE0oeGgsIGEpKSwgcyA9IGJoKE0oa2gsIGEpKSwgdSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShpKSB8fCAoci5zdGF0dXMgPSBNZiwgdS5lcnJvcnMgPSBpKSwgQShvKSB8fCAodS5ldmVudFRva2VucyA9IG8pLCBBKHMpIHx8ICh1LnJlc3BvbnNlVG9rZW5zID0gcyksIEEodSkgfHwgKHIuZGF0YSA9IHUpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuYyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBIZShacyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRzKGUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSkpLnRoZW4odCkudGhlbihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oZSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByYyhlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdC5uYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSGUoWnMoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkcyhlLCBpLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCkpLnRoZW4oZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0YyhlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuYyhlLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVjKHpmLCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgenMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByYyh6ZiwgZSwgITAsIHpzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gb2MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHcyhYcyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gJiYgYXJndW1lbnRzWzFdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmV4ZWN1dGUsIG4gPSAodm9pZCAwID09PSB0ID8ge30gOiB0KS5wYWdlTG9hZCwgciA9IHZvaWQgMCA9PT0gbiA/IHt9IDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEocikgfHwgb2Mocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gY2MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucHJlZmV0Y2gsIG4gPSAodm9pZCAwID09PSB0ID8ge30gOiB0KS52aWV3cywgciA9IHZvaWQgMCA9PT0gbiA/IFtdIDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQShyKSB8fCBZcyhoKE0oWHMsIHIpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHVjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR3MoWHMoZSkpLCB5bigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuYyhlLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVjKFpmLCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBIZShNKGljLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhlKE0oYWMsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcGMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSGUoW1dzKGUpXSkudGhlbihlYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG1jKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnBhZ2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByYyhYcCwgZSwgdCwgcXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnYygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaGMoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgd3YoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdmMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmVtaXQodCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGJjKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5vbih0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geWMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YyhJdiwgZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9jKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmMoSXYsIGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiB4ZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGUudXJsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHhjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudHlwZSA9IGxkLCB0LmNvbnRlbnQgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24ga2MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0gZmQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB3YyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnR5cGUgPSBEZCwgdC5jb250ZW50ID0gZS5jb250ZW50LCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudHlwZSA9IFNkLCB0LmNvbnRlbnQgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSWMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0gUGQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBEYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnR5cGUgPSBFZCwgdC5jb250ZW50ID0gZS5jb250ZW50LCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEFjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudHlwZSA9IElkLCB0LmNvbnRlbnQgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gU2MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0gQ2QsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBUYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIGUuYXR0cmlidXRlID09PSBIZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnR5cGUgPSBnZCwgdC5jb250ZW50ID0gZS52YWx1ZSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC50eXBlID0gbWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuW2UuYXR0cmlidXRlXSA9IGUudmFsdWUsIHQuY29udGVudCA9IG4sIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFBjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnN0eWxlLCBuID0gdm9pZCAwID09PSB0ID8ge30gOiB0LCByID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLnNlbGVjdG9yID0gZS5zZWxlY3Rvciwgci5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIGkobi5sZWZ0KSB8fCBpKG4udG9wKSA/IGkobi53aWR0aCkgfHwgaShuLmhlaWdodCkgPyAoci50eXBlID0gaGQsIHIuY29udGVudCA9IG4sIHIpIDogKHIudHlwZSA9IGJkLCByLmNvbnRlbnQgPSBuLCByKSA6IChyLnR5cGUgPSB5ZCwgci5jb250ZW50ID0gbiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE9jKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudHlwZSA9IF9kLCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGpjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5mcm9tID0gZS5mcm9tLCB0LnRvID0gZS50bzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4udHlwZSA9IHZkLCBuLnNlbGVjdG9yID0gZS5zZWxlY3Rvciwgbi5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIG4uY29udGVudCA9IHQsIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1sKGUuc2VsZWN0b3IpICYmIE1sKGUuY3NzU2VsZWN0b3IpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gW10sIHIgPSBbXSwgaSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUuYWN0aW9uKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGRkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExjKGUpID8gaS5wdXNoKHhjKGUpKSA6IG4ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IFVkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBlLmNvbnRlbnQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgcGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQShlLmNvbnRlbnQpIHx8IGIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBCZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5jb250ZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKGtjKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKHdjKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKEVjKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgT2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKEljKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKERjKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgSWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKEFjKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKFNjKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKFRjKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgaGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKFBjKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgX2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKE9jKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgdmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKGpjKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgeGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoKENjKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Uga2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogWWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdG9yOiBlLnNlbGVjdG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudFRva2VuOiBlLmNsaWNrVHJhY2tJZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFBKGkpICYmIG4ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogWWYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksICFBKG4pICYmIChhLm9wdGlvbnMgPSBuKSwgIUEocikgJiYgKGEubWV0cmljcyA9IHIpLCBBKGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLnBhZ2VMb2FkID0gYSwgdC5leGVjdXRlID0gbywgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVmMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQSh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFtdLCBpID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5hY3Rpb24pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogVWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGUuY29udGVudAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBwZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBKGUuY29udGVudCkgfHwgYihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IEJkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmNvbnRlbnQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB4ZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnB1c2goQ2MoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3ZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBZZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRUb2tlbjogZS5jbGlja1RyYWNrSWQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0geyBuYW1lOiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghQShyKSAmJiAoYS5vcHRpb25zID0gciksICFBKGkpICYmIChhLm1ldHJpY3MgPSBpKSwgQShhKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHt9LCBzID0gW2FdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5tYm94ZXMgPSBzLCBuLmV4ZWN1dGUgPSBvLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBSYyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID8gTWModCkgOiBWYyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTmMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuc3RhdHVzLCBuID0gZS5kYXRhLCByID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlTG9hZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKG4pIHx8IChyLmRhdGEgPSBuKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRmMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuc3RhdHVzLCBuID0gZS5tYm94LCByID0gZS5kYXRhLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYm94OiBuLm5hbWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKHIpIHx8IChhLmRhdGEgPSByKSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQmMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuc3RhdHVzLCBuID0gZS52aWV3LCByID0gZS5kYXRhLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWV3OiBuLm5hbWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKHIpIHx8IChhLmRhdGEgPSByKSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVWMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuc3RhdHVzLCBuID0gZS5kYXRhLCByID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVmZXRjaE1ldHJpY3M6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShuKSB8fCAoci5kYXRhID0gbiksIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHpjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW251bGxdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE0oTmMsIFtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQdih0KSAmJiBEZShEdiwgZSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHFjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW251bGxdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE0oRmMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHYodCkgJiYgRGUoQXYsIGUpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBIYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiBPczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW251bGxdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE0oRmMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHYobikgJiYgRGUoQXYsIGUpLCB0KGUpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBXYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiBNczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW251bGxdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE0oQmMsIFtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQdihuKSAmJiBEZShTdiwgZSksIGUudmlldy5wYWdlID8gKHQoZSksIG4pIDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gR2MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbbnVsbF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gTShVYywgW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFB2KHQpICYmIERlKFR2LCBlKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWWMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGgoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHpjKGVbMF0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHFjKGVbMV0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEhjKGVbMl0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdjKGVbM10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgbiA9IG0oZmgsIHQpLCByID0gbShnaCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHIpID8gVWUobikgOiB6ZShyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gWGMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gemUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEtjKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFBKHQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQub3B0aW9uczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEobikgfHwgYihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LnR5cGUgPT09IFVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbGQsIHIgPSB0LmNvbnRlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudHlwZSA9IFlmLCB0LmNvbnRlbnQgPSBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0b3I6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUWMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQubWV0cmljczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFBKG4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQubmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm5hbWUgPSByLCB0LnNlbGVjdG9yID0gdC5zZWxlY3RvciB8fCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gJGMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGdsKHt9LCB0KSwgciA9IG4uZXhlY3V0ZSwgaSA9IHZvaWQgMCA9PT0gciA/IHt9IDogciwgYSA9IG4ucHJlZmV0Y2gsIG8gPSB2b2lkIDAgPT09IGEgPyB7fSA6IGEsIHMgPSBpLnBhZ2VMb2FkLCBjID0gdm9pZCAwID09PSBzID8ge30gOiBzLCB1ID0gaS5tYm94ZXMsIGwgPSB2b2lkIDAgPT09IHUgPyBbXSA6IHUsIGQgPSBvLm1ib3hlcywgZiA9IHZvaWQgMCA9PT0gZCA/IFtdIDogZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEtjKGUsIGMpLCBiKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gS2MoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGwpLCBiKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWMoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGwpLCBiKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gS2MoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGYpLCBiKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWMoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGYpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5wcmVmZXRjaCwgbiA9ICh2b2lkIDAgPT09IHQgPyB7fSA6IHQpLnZpZXdzLCByID0gdm9pZCAwID09PSBuID8gW10gOiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBKHIpIHx8IGJzKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBaYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW10sIG4gPSBlLmV4ZWN1dGUsIHIgPSB2b2lkIDAgPT09IG4gPyB7fSA6IG4sIGkgPSByLnBhZ2VMb2FkLCBhID0gdm9pZCAwID09PSBpID8ge30gOiBpLCBvID0gci5tYm94ZXMsIHMgPSB2b2lkIDAgPT09IG8gPyBbXSA6IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEoYSkgPyB0LnB1c2goVWUobnVsbCkpIDogdC5wdXNoKGxjKGEpKSwgQShzKSA/IHQucHVzaChVZShudWxsKSkgOiB0LnB1c2goZGMocykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGUucHJlZmV0Y2gsIHUgPSB2b2lkIDAgPT09IGMgPyB7fSA6IGMsIGwgPSB1Lm1ib3hlcywgZCA9IHZvaWQgMCA9PT0gbCA/IFtdIDogbCwgZiA9IHUubWV0cmljcywgcCA9IHZvaWQgMCA9PT0gZiA/IFtdIDogZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoZCkgPyB0LnB1c2goVWUobnVsbCkpIDogdC5wdXNoKGZjKGQpKSwgX2wocCkgJiYgIUEocCkgPyB0LnB1c2gocGModSkpIDogdC5wdXNoKFVlKG51bGwpKSwgZ24oKSwgSGUodCkudGhlbihZYykuY2F0Y2goWGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBldShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHooZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubG9jYXRpb24ucmVwbGFjZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHR1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1sKGUpIHx8IHh0KGUpID8gZSA6IFhkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBudShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvKHRwLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcnUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubWJveCwgbiA9IGUuc2VsZWN0b3IsIHIgPSBlLm9mZmVyLCBpID0gWigpLCBhID0gdCA9PT0gaVtjcF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBKHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlKE9mKSwgbnUobiksIGduKCksIHZvaWQgX3QoeyBtYm94OiB0IH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9ICRjKG4sIFJjKHQsIHIsIGEpKSwgcyA9IGthKG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUEocykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gcy51cmw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQWUoamYsIHMpLCBDdCh7IHVybDogYyB9KSwgdm9pZCBldSh3aW5kb3csIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZ0KHsgbWJveDogdCB9KSwgc2MobyksIFpjKG8pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEoZSkgfHwgYnQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ib3g6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0aW9uOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5dCh7IGVycm9yOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaXUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiB7fSwgdCA9IGUucHJlZmV0Y2gsIG4gPSB2b2lkIDAgPT09IHQgPyB7fSA6IHQsIHIgPSBlLmV4ZWN1dGUsIGkgPSB2b2lkIDAgPT09IHIgPyB7fSA6IHIsIGEgPSBpLnBhZ2VMb2FkLCBvID0gdm9pZCAwID09PSBhID8ge30gOiBhLCBzID0gaS5tYm94ZXMsIGMgPSB2b2lkIDAgPT09IHMgPyBbXSA6IHMsIHUgPSBuLnBhZ2VMb2FkLCBsID0gdm9pZCAwID09PSB1ID8ge30gOiB1LCBkID0gbi52aWV3cywgZiA9IHZvaWQgMCA9PT0gZCA/IFtdIDogZCwgcCA9IG4ubWJveGVzLCBtID0gdm9pZCAwID09PSBwID8gW10gOiBwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShvKSAmJiBBKGMpICYmIEEobCkgJiYgQShmKSAmJiBBKG0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gJiYgYXJndW1lbnRzWzFdLCBuID0gZS5zZWxlY3RvciwgciA9IGUucmVzcG9uc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdShyKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShPZiksIG51KG4pLCBnbigpLCBfdCh7fSksIHljKGttKSwgVWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAkYyhuLCByKSwgYSA9IGthKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUEoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gYS51cmw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQWUoamYsIGEpLCBDdCh7IHVybDogbyB9KSwgeWMod20pLCBldSh3aW5kb3csIG8pLCBVZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2dCh7fSksIEpjKGkpLCB5Yyh4bSksIHNjKGksIHQpLCBaYyhpKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBKGUpIHx8IGJ0KHsgZXhlY3V0aW9uOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHl0KHsgZXJyb3I6IGUgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVt5bV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQucmVxdWVzdCwgciA9IHQucmVzcG9uc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhQShuKSAmJiAhQShyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gc3UoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt5bV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGN1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGUoT3YsIGltLCBlKSwgeWMoa20pLCBMZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IE92LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGduKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHV1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSAmJiBhcmd1bWVudHNbMV0sIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0b3I6IFhkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBZShPdiwgUWYsIGUpLCBMZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IE92LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2U6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGF1KG4sIHQpLmNhdGNoKGN1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbHUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGdsKHt9LCB0KSwgciA9IG4uZXhlY3V0ZSwgaSA9IG4ucHJlZmV0Y2gsIGEgPSBlW3pwXSwgbyA9IGVbVXBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciAmJiAobi5leGVjdXRlLm1ib3hlcyA9IG51bGwpLCByICYmICFhICYmIChuLmV4ZWN1dGUucGFnZUxvYWQgPSBudWxsKSwgaSAmJiAobi5wcmVmZXRjaC5tYm94ZXMgPSBudWxsKSwgaSAmJiAhbyAmJiAobi5wcmVmZXRjaC52aWV3cyA9IG51bGwpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gc3UoZSksIG4gPSB0LnJlcXVlc3QsIHIgPSB0LnJlc3BvbnNlLCBpID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFlKE92LCBjbSksIExlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogT3YsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJTdGF0ZTogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBsdShlLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2MoYSksIGNjKGEpLCBHYSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2U6IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHV1KGUsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChjdSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZ1KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUNlKCkgJiYgIWtlKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGUoT3YsIGVmKSwgdm9pZCBMZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBPdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZWYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFooKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG91KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW3pwXSwgbiA9IGVbVXBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0ICYmICFuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShPdiwgc20pLCB2b2lkIExlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBPdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IHNtCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB7IHBhZ2VMb2FkOiB7fSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuZXhlY3V0ZSA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0geyB2aWV3czogW3t9XSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHJlZmV0Y2ggPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlW3NwXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFlKE92LCAkZiwgciksIExlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IE92LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lb3V0OiBvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUWUoKSAmJiAhJGUoKSA/IFplKCkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW8ocykudGhlbih1dSkuY2F0Y2goY3UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goY3UpIDogZW8ocykudGhlbih1dSkuY2F0Y2goY3UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHB1KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtOZl0gPSAhMCwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbXUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtOZl0gPSAhMSwgdFtNZl0gPSBlLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBndShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKGUpID8gbXUodWYpIDogZS5sZW5ndGggPiBOZCA/IG11KGxmKSA6IHB1KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGh1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF1KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG11KG5mKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBndShlW3pmXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W05mXSA/IGwoZVtGZl0pID8gbChlW01mXSkgPyBwdSgpIDogbXUoZmYpIDogbXUoZGYpIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdnUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXUoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbXUobmYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVxdWVzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF1KHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG11KHJmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LmV4ZWN1dGUsIHIgPSB0LnByZWZldGNoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShuKSB8fCB1KHIpID8gcHUoKSA6IG11KG9mKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYnUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXUoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbXUobmYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVxdWVzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF1KHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG11KHJmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LmV4ZWN1dGUsIHIgPSB0LnByZWZldGNoLCBpID0gdC5ub3RpZmljYXRpb25zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShuKSB8fCB1KHIpID8gbXUoc2YpIDogX2woaSkgPyBwdSgpIDogbXUoY2YpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5dShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtdShuZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZ3UoZVt6Zl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXRbTmZdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZVtxZl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfbChuKSA/IHB1KCkgOiBtdShwZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF91KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoZSkgPyB1KGUucmVzcG9uc2UpID8gcHUoKSA6IG11KGFmKSA6IG11KG5mKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQ3UoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXUoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbXUobmYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGd1KGVbemZdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbTmZdID8gcHUoKSA6IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHh1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbjogeGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGUuY29udGVudAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBrdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFjdGlvbiA9IGRkLCB0LmNvbnRlbnQgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gd3UoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hY3Rpb24gPSBmZCwgdC5jb250ZW50ID0gZS5jb250ZW50LCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEV1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gQWQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBJdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFjdGlvbiA9IFRkLCB0LmNvbnRlbnQgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRHUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hY3Rpb24gPSBPZCwgdC5jb250ZW50ID0gZS5jb250ZW50LCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEF1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gRWQsIHQuY29udGVudCA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBTdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFjdGlvbiA9IElkLCB0LmNvbnRlbnQgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVHUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hY3Rpb24gPSBDZCwgdC5jb250ZW50ID0gZS5jb250ZW50LCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFB1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBwKGUuY29udGVudClbMF0sIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uYWN0aW9uID0gbWQsIG4uYXR0cmlidXRlID0gdCwgbi52YWx1ZSA9IGUuY29udGVudFt0XSwgbi5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIG4uY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBPdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFjdGlvbiA9IG1kLCB0LmF0dHJpYnV0ZSA9IEhkLCB0LnZhbHVlID0gZS5jb250ZW50LCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGp1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gaGQsIHQuc3R5bGUgPSBlLmNvbnRlbnQsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTHUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hY3Rpb24gPSBoZCwgdC5zdHlsZSA9IGUuY29udGVudCwgdC5zZWxlY3RvciA9IGUuc2VsZWN0b3IsIHQuY3NzU2VsZWN0b3IgPSBlLmNzc1NlbGVjdG9yLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFjdGlvbiA9IGhkLCB0LnN0eWxlID0gZS5jb250ZW50LCB0LnNlbGVjdG9yID0gZS5zZWxlY3RvciwgdC5jc3NTZWxlY3RvciA9IGUuY3NzU2VsZWN0b3IsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFZ1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0aW9uID0gX2QsIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUnUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hY3Rpb24gPSB2ZCwgdC5mcm9tID0gZS5jb250ZW50LmZyb20sIHQudG8gPSBlLmNvbnRlbnQudG8sIHQuc2VsZWN0b3IgPSBlLnNlbGVjdG9yLCB0LmNzc1NlbGVjdG9yID0gZS5jc3NTZWxlY3RvciwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTnUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKGt1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKHd1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKEV1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgU2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKEl1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgUGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKER1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKEF1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgSWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKFN1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKFR1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKFB1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZ2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKE91KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgaGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKGp1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgYmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKEx1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgeWQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKE11KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgX2Q6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKFZ1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgdmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKFJ1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgeGQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKHh1KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZ1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnR5cGUgPT09IFlkICYmIChTaChlKSA/IHQucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiBrZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxlY3RvcjogZS5zZWxlY3RvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGlja1RyYWNrSWQ6IGUuZXZlbnRUb2tlbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiB0LnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbjogd2QsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpY2tUcmFja0lkOiBlLmV2ZW50VG9rZW4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEJ1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW10sIG4gPSBbXSwgciA9IFtdLCBpID0gZS5vcHRpb25zLCBhID0gdm9pZCAwID09PSBpID8gW10gOiBpLCBvID0gZS5tZXRyaWNzLCBzID0gdm9pZCAwID09PSBvID8gW10gOiBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUudHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBVZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goZS5jb250ZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQmQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoKGUuY29udGVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHhkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaCh4dShlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFlmOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaC5hcHBseShyLCBOdShlLmNvbnRlbnQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSksIEEodCkgfHwgci5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbjogZGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiB0LmpvaW4oJycpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBBKG4pIHx8IHIucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb246IHBkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBGdShzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoYykgfHwgci5wdXNoLmFwcGx5KHIsIGMpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBVdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5leGVjdXRlLCBuID0gdm9pZCAwID09PSB0ID8ge30gOiB0LCByID0gbi5wYWdlTG9hZCwgaSA9IHZvaWQgMCA9PT0gciA/IHt9IDogciwgYSA9IG4ubWJveGVzLCBvID0gdm9pZCAwID09PSBhID8gW10gOiBhLCBzID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzLnB1c2guYXBwbHkocywgQnUoaSkpLCBzLnB1c2guYXBwbHkocywgaChNKEJ1LCBvKSkpLCBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB6dShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gVXUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbRmZdKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBxdShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdFtXZl0gfHwgUmY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbTWZdKG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBIdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaHUoZSksIG4gPSB0W01mXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0W05mXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEZShqdiwgbiksIHZvaWQgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZToganYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghQ2UoKSAmJiAha2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6KGVbTWZdKFZmLCBlZikpLCBEZShqdiwgZWYpLCB2b2lkIExlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGp2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6dShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkgPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxdShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFlKGp2LCBlKSwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBqdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIFFlKCkgJiYgISRlKCkgPyBaZSgpLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWmEoZSkudGhlbihyKS5jYXRjaChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBaYShlKS50aGVuKHIpLmNhdGNoKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBXdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdnUoZSksIG4gPSB0W01mXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbTmZdID8gQ2UoKSB8fCBrZSgpID8gKEFlKEx2LCBlKSwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBMdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksICFRZSgpIHx8ICRlKCkgPyBlbyhlKSA6IFplKCkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW8oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSA6IChEZShMdiwgZWYpLCBMZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IEx2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBlZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgemUobmV3IEVycm9yKGVmKSkpIDogKERlKEx2LCBuKSwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBMdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgemUodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBHdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdHUoZS5zZWxlY3RvciksIG4gPSB5dShlKSwgciA9IG5bTWZdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbltOZl0gPyBDZSgpIHx8IGtlKCkgPyAoZS5zZWxlY3RvciA9IHQsIEFlKE12LCBlKSwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBNdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHZvaWQgcnUoZSkpIDogKERlKE12LCBlZiksIExlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogTXYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB2b2lkIG51KHQpKSA6IChEZShNdiwgZSwgciksIExlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogTXYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHZvaWQgbnUodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBZdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdHUoZS5zZWxlY3RvciksIG4gPSBfdShlKSwgciA9IG5bTWZdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbltOZl0gPyBDZSgpIHx8IGtlKCkgPyAoZS5zZWxlY3RvciA9IHQsIEFlKFZ2LCBlKSwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBWdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGF1KGUpKSA6IChEZShWdiwgZWYpLCBMZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IFZ2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBlZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbnUodCksIHplKG5ldyBFcnJvcihlZikpKSA6IChEZShWdiwgZSwgciksIExlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogVnYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG51KHQpLCB6ZShuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFh1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBaKClbY3BdLCBuID0gZS5jb25zdW1lcklkLCByID0gdm9pZCAwID09PSBuID8gdCA6IG4sIGkgPSBlLnJlcXVlc3QsIGEgPSBidShlKSwgbyA9IGFbTWZdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWFbTmZdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKFJ2LCBvKSwgdm9pZCBMZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBSdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFDZSgpICYmICFrZSgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKFJ2LCBlZiksIHZvaWQgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogUnYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZWYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBZShSdiwgZSksIExlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogUnYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHdzKHIsIHt9LCBpLm5vdGlmaWNhdGlvbnMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhUWUoKSB8fCAkZSgpID8gU3MocykgOiBEZShSdiwgdm0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBLdShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdFt6Zl0sIHIgPSBnbCh7fSwgdCksIGkgPSB1KHQucGFyYW1zKSA/IHQucGFyYW1zIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByW0dmXSA9IGdsKHt9LCBmcihuKSwgaSksIHJbc3BdID0gYmkoZSwgdFtzcF0pLCByW0ZmXSA9IGwodFtGZl0pID8gdFtGZl0gOiBLbCwgcltNZl0gPSBsKHRbTWZdKSA/IHRbTWZdIDogS2wsIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFF1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW1psXSwgbiA9IGVbY2RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWwodCkgJiYgKE1sKG4pIHx8IHh0KG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gJHUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubWJveCwgbiA9IGUudHlwZSwgciA9IHZvaWQgMCA9PT0gbiA/IGVtIDogbiwgaSA9IHUoZS5wYXJhbXMpID8gZS5wYXJhbXMgOiB7fSwgYSA9IGdsKHt9LCBmcih0KSwgaSksIG8gPSBJcyhjaSh7fSwgYSksIHIsIFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8ubWJveCA9IHsgbmFtZTogdCB9LCBTcyh3cyh0LCBhLCBbb10pKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZShUZiwgZSksIHZvaWQgZVtGZl0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGUoUGYsIGUpLCBlW01mXShSZiwgUGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChRZSgpICYmICEkZSgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKFBmLCB2bSksIHZvaWQgZVtNZl0oTWYsIHZtKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFp1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEp1KGUpLCAhZS5wcmV2ZW50RGVmYXVsdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZWwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbY2RdLCBuID0gZVtabF0sIHIgPSBEKEl0KHQpKSwgaSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWnUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcHMobiwgaSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0bChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gQ3UoZSksIG4gPSB0W01mXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0W05mXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEZShOdiwgbiksIHZvaWQgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogTnYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gS3UoWigpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFDZSgpICYmICFrZSgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKE52LCBlZiksIHoocltNZl0oVmYsIGVmKSksIHZvaWQgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogTnYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZWYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBZShOdiwgciksIExlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogTnYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBRdShyKSA/IGVsKHIpIDogSnUocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG5sKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVjKGUpLCBtYyhlKS50aGVuKFdjKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBKGUpIHx8IGJ0KHsgZXhlY3V0aW9uOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGUocm0sIGUpLCB5dCh7IGVycm9yOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcmwoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBCdi5sZW5ndGggPiAwOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBCdi5wb3AoKSwgdCA9IGUudmlld05hbWUsIG4gPSBlLnBhZ2UsIHIgPSB2cyh0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkocikgPyBuICYmIExzKGUpIDogbmwocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaWwoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF2ID0genYsIHJsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGFsKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfYyh4bSwgaWwpLCBfYyhrbSwgaWwpLCBfYyh3bSwgaWwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvbChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnZpZXdOYW1lID0gZSwgbi5pbXByZXNzaW9uSWQgPSBVKCksIG4ucGFnZSA9ICEwLCBBKHQpIHx8IChuLnBhZ2UgPSAhIXQucGFnZSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnYucHVzaChlKSwgcXYgIT09IFV2ICYmIHJsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGNsKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFooKVtVcF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghXyhlKSB8fCBUKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEZShGdiwgYW0sIGUpLCB2b2lkIExlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBGdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlldzogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGFtCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUudG9Mb3dlckNhc2UoKSwgciA9IG9sKG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGtlKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlKEZ2LCBuLCByKSwgdm9pZCBSdChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFlKEZ2LCBuLCByKSwgTGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogRnYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlldzogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgc2wocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGUoRnYsIG9tKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdWwoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERlKFd2LCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsbCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGUoR3YsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRsKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZShZdiwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZmwoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERlKFh2LCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwbChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuYWRvYmUgPSBlLmFkb2JlIHx8IHt9LCBlLmFkb2JlLnRhcmdldCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZFUlNJT046ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQ6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0T2ZmZXI6IEtsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0T2ZmZXJzOiBRbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwcGx5T2ZmZXI6IEtsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBwbHlPZmZlcnM6IFFsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VuZE5vdGlmaWNhdGlvbnM6IEtsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tFdmVudDogS2wsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmlnZ2VyVmlldzogS2wsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpc3RlckV4dGVuc2lvbjogS2wsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbml0OiBLbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLm1ib3hDcmVhdGUgPSBLbCwgZS5tYm94RGVmaW5lID0gS2wsIGUubWJveFVwZGF0ZSA9IEtsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBtbChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmFkb2JlICYmIGUuYWRvYmUudGFyZ2V0ICYmIHZvaWQgMCAhPT0gZS5hZG9iZS50YXJnZXQuZ2V0T2ZmZXIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZSh0Zik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSihuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gWigpLCBpID0gcltscF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5hZG9iZSA9IGUuYWRvYmUgfHwge30sIGUuYWRvYmUudGFyZ2V0ID0gZS5hZG9iZS50YXJnZXQgfHwge30sIGUuYWRvYmUudGFyZ2V0LlZFUlNJT04gPSBpLCBlLmFkb2JlLnRhcmdldC5ldmVudCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTElCUkFSWV9MT0FERUQ6IFltLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRVFVRVNUX1NUQVJUOiBYbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVRVUVTVF9TVUNDRUVERUQ6IEttLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRVFVRVNUX0ZBSUxFRDogUW0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENPTlRFTlRfUkVOREVSSU5HX1NUQVJUOiAkbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ09OVEVOVF9SRU5ERVJJTkdfU1VDQ0VFREVEOiBKbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ09OVEVOVF9SRU5ERVJJTkdfRkFJTEVEOiBabSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ09OVEVOVF9SRU5ERVJJTkdfTk9fT0ZGRVJTOiBlZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ09OVEVOVF9SRU5ERVJJTkdfUkVESVJFQ1Q6IHRnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgIXJbcnBdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwbChlKSwgdm9pZCBEZShlZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPZSgpLCBGdCgpLCBZdChlKSwgUXQoZSksIGUuYWRvYmUudGFyZ2V0LmdldE9mZmVyID0gSHUsIGUuYWRvYmUudGFyZ2V0LmdldE9mZmVycyA9IFd1LCBlLmFkb2JlLnRhcmdldC5hcHBseU9mZmVyID0gR3UsIGUuYWRvYmUudGFyZ2V0LmFwcGx5T2ZmZXJzID0gWXUsIGUuYWRvYmUudGFyZ2V0LnNlbmROb3RpZmljYXRpb25zID0gWHUsIGUuYWRvYmUudGFyZ2V0LnRyYWNrRXZlbnQgPSB0bCwgZS5hZG9iZS50YXJnZXQudHJpZ2dlclZpZXcgPSBjbCwgZS5hZG9iZS50YXJnZXQucmVnaXN0ZXJFeHRlbnNpb24gPSB1bCwgZS5tYm94Q3JlYXRlID0gbGwsIGUubWJveERlZmluZSA9IGRsLCBlLm1ib3hVcGRhdGUgPSBmbCwgcHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZ2wgPSByKG4oJ0BhZG9iZS9yZWFjdG9yLW9iamVjdC1hc3NpZ24nKSksIGhsID0gcihuKCdAYWRvYmUvcmVhY3Rvci1jb29raWUnKSksIHZsID0gcihuKCdAYWRvYmUvcmVhY3Rvci1xdWVyeS1zdHJpbmcnKSksIGJsID0gcihuKCdAYWRvYmUvcmVhY3Rvci1wcm9taXNlJykpLCB5bCA9IHIobignQGFkb2JlL3JlYWN0b3ItbG9hZC1zY3JpcHQnKSksIF9sID0gQXJyYXkuaXNBcnJheSwgQ2wgPSBPYmplY3QucHJvdG90eXBlLCB4bCA9IENsLnRvU3RyaW5nLCBrbCA9ICdbb2JqZWN0IEZ1bmN0aW9uXScsIHdsID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmZvckVhY2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEVsID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdsKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodFtuXSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBwKHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSWwgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZmlsdGVyKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBEbCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVsKGZ1bmN0aW9uICh0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCByKSAmJiAobltyXSA9IHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEFsID0gJ1tvYmplY3QgU3RyaW5nXScsIFNsID0gOTAwNzE5OTI1NDc0MDk5MSwgVGwgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQubWFwKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBQbCA9IE9iamVjdC5wcm90b3R5cGUsIE9sID0gUGwuaGFzT3duUHJvcGVydHksIGpsID0gU3RyaW5nLnByb3RvdHlwZSwgTGwgPSBqbC50cmltLCBNbCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIVQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFZsID0gJ1tvYmplY3QgTnVtYmVyXScsIFJsID0gJ1tvYmplY3QgT2JqZWN0XScsIE5sID0gRnVuY3Rpb24ucHJvdG90eXBlLCBGbCA9IE9iamVjdC5wcm90b3R5cGUsIEJsID0gTmwudG9TdHJpbmcsIFVsID0gRmwuaGFzT3duUHJvcGVydHksIHpsID0gQmwuY2FsbChPYmplY3QpLCBxbCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVsKGZ1bmN0aW9uICh0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbltyXSA9IGUodCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSGwgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ucmVkdWNlKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBXbCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRWwoZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gZShyLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4pLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBHbCA9IEFycmF5LnByb3RvdHlwZSwgWWwgPSBHbC5yZXZlcnNlLCBYbCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9OX0RFVklDRTogJ29uLWRldmljZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTRVJWRVJfU0lERTogJ3NlcnZlci1zaWRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEhZQlJJRDogJ2h5YnJpZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgS2wgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFFsID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICRsID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGdsb2JhbFRoaXMgPyBnbG9iYWxUaGlzIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHdpbmRvdyA/IHdpbmRvdyA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBnbG9iYWwgPyBnbG9iYWwgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygc2VsZiA/IHNlbGYgOiB7fSwgSmwgPSAoSChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgciwgaSwgYSwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPSB0eXBlb2YgcGVyZm9ybWFuY2UgJiYgbnVsbCAhPT0gcGVyZm9ybWFuY2UgJiYgcGVyZm9ybWFuY2Uubm93ID8gZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGVyZm9ybWFuY2Uubm93KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBwcm9jZXNzICYmIG51bGwgIT09IHByb2Nlc3MgJiYgcHJvY2Vzcy5ocnRpbWUgPyAoZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHQoKSAtIGEpIC8gMTAwMDAwMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuID0gcHJvY2Vzcy5ocnRpbWUsIGkgPSAodCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxMDAwMDAwMDAwICogKGUgPSBuKCkpWzBdICsgZVsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSgpLCBvID0gMTAwMDAwMDAwMCAqIHByb2Nlc3MudXB0aW1lKCksIGEgPSBpIC0gbykgOiBEYXRlLm5vdyA/IChlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEYXRlLm5vdygpIC0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByID0gRGF0ZS5ub3coKSkgOiAoZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IERhdGUoKS5nZXRUaW1lKCkgLSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmNhbGwoJGwpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIFcpLCBabCA9ICd0eXBlJywgZWQgPSAnY29udGVudCcsIHRkID0gJ2hlaWdodCcsIG5kID0gJ3dpZHRoJywgcmQgPSAnbGVmdCcsIGlkID0gJ3RvcCcsIGFkID0gJ2Zyb20nLCBvZCA9ICd0bycsIHNkID0gJ3ByaW9yaXR5JywgY2QgPSAnc2VsZWN0b3InLCB1ZCA9ICdjc3NTZWxlY3RvcicsIGxkID0gJ3NldEh0bWwnLCBkZCA9ICdzZXRDb250ZW50JywgZmQgPSAnc2V0VGV4dCcsIHBkID0gJ3NldEpzb24nLCBtZCA9ICdzZXRBdHRyaWJ1dGUnLCBnZCA9ICdzZXRJbWFnZVNvdXJjZScsIGhkID0gJ3NldFN0eWxlJywgdmQgPSAncmVhcnJhbmdlJywgYmQgPSAncmVzaXplJywgeWQgPSAnbW92ZScsIF9kID0gJ3JlbW92ZScsIENkID0gJ2N1c3RvbUNvZGUnLCB4ZCA9ICdyZWRpcmVjdCcsIGtkID0gJ3RyYWNrQ2xpY2snLCB3ZCA9ICdzaWduYWxDbGljaycsIEVkID0gJ2luc2VydEJlZm9yZScsIElkID0gJ2luc2VydEFmdGVyJywgRGQgPSAnYXBwZW5kSHRtbCcsIEFkID0gJ2FwcGVuZENvbnRlbnQnLCBTZCA9ICdwcmVwZW5kSHRtbCcsIFRkID0gJ3ByZXBlbmRDb250ZW50JywgUGQgPSAncmVwbGFjZUh0bWwnLCBPZCA9ICdyZXBsYWNlQ29udGVudCcsIGpkID0gJ21ib3hEZWJ1ZycsIExkID0gJ21ib3hEaXNhYmxlJywgTWQgPSAnbWJveEVkaXQnLCBWZCA9ICdhdF9jaGVjaycsIFJkID0gJ3RydWUnLCBOZCA9IDI1MCwgRmQgPSAnZGF0YS1hdC1zcmMnLCBCZCA9ICdqc29uJywgVWQgPSAnaHRtbCcsIHpkID0gJ2R5bmFtaWMnLCBxZCA9ICdzY3JpcHQnLCBIZCA9ICdzcmMnLCBXZCA9ICdpZCcsIEdkID0gJ2NsYXNzJywgWWQgPSAnY2xpY2snLCBYZCA9ICdoZWFkJywgS2QgPSAnc2NyaXB0JywgUWQgPSAnc3R5bGUnLCAkZCA9ICdsaW5rJywgSmQgPSAnaW1nJywgWmQgPSAnZGl2JywgZWYgPSAnQWRvYmUgVGFyZ2V0IGNvbnRlbnQgZGVsaXZlcnkgaXMgZGlzYWJsZWQuIEVuc3VyZSB0aGF0IHlvdSBjYW4gc2F2ZSBjb29raWVzIHRvIHlvdXIgY3VycmVudCBkb21haW4sIHRoZXJlIGlzIG5vICJtYm94RGlzYWJsZSIgY29va2llIGFuZCB0aGVyZSBpcyBubyAibWJveERpc2FibGUiIHBhcmFtZXRlciBpbiBxdWVyeSBzdHJpbmcuJywgdGYgPSAnQWRvYmUgVGFyZ2V0IGhhcyBhbHJlYWR5IGJlZW4gaW5pdGlhbGl6ZWQuJywgbmYgPSAnb3B0aW9ucyBhcmd1bWVudCBpcyByZXF1aXJlZCcsIHJmID0gJ3JlcXVlc3Qgb3B0aW9uIGlzIHJlcXVpcmVkJywgYWYgPSAncmVzcG9uc2Ugb3B0aW9uIGlzIHJlcXVpcmVkJywgb2YgPSAnZXhlY3V0ZSBvciBwcmVmZXRjaCBpcyByZXF1aXJlZCcsIHNmID0gJ2V4ZWN1dGUgb3IgcHJlZmV0Y2ggaXMgbm90IGFsbG93ZWQnLCBjZiA9ICdub3RpZmljYXRpb25zIGFyZSByZXF1aXJlZCcsIHVmID0gJ21ib3ggb3B0aW9uIGlzIHJlcXVpcmVkJywgbGYgPSAnbWJveCBvcHRpb24gaXMgdG9vIGxvbmcnLCBkZiA9ICdzdWNjZXNzIG9wdGlvbiBpcyByZXF1aXJlZCcsIGZmID0gJ2Vycm9yIG9wdGlvbiBpcyByZXF1aXJlZCcsIHBmID0gJ29mZmVyIG9wdGlvbiBpcyByZXF1aXJlZCcsIG1mID0gJ1VuZXhwZWN0ZWQgZXJyb3InLCBnZiA9ICdyZXF1ZXN0IGZhaWxlZCcsIGhmID0gJ3JlcXVlc3Qgc3VjY2VlZGVkJywgdmYgPSAnQWN0aW9uIHJlbmRlcmVkIHN1Y2Nlc3NmdWxseScsIGJmID0gJ1JlbmRlcmluZyBhY3Rpb24nLCB5ZiA9ICdBY3Rpb24gaGFzIG5vIGNvbnRlbnQnLCBfZiA9ICdBY3Rpb24gaGFzIG5vIGF0dHJpYnV0ZXMnLCBDZiA9ICdBY3Rpb24gaGFzIG5vIENTUyBwcm9wZXJ0aWVzJywgeGYgPSAnQWN0aW9uIGhhcyBubyBoZWlnaHQgb3Igd2lkdGgnLCBrZiA9ICdBY3Rpb24gaGFzIG5vIGxlZnQsIHRvcCBvciBwb3NpdGlvbicsIHdmID0gJ0FjdGlvbiBoYXMgbm8gZnJvbSBvciB0bycsIEVmID0gJ0FjdGlvbiBoYXMgbm8gdXJsJywgSWYgPSAnQWN0aW9uIGhhcyBubyBpbWFnZSB1cmwnLCBEZiA9ICdSZWFycmFuZ2UgZWxlbWVudHMgYXJlIG1pc3NpbmcnLCBBZiA9ICdSZWFycmFuZ2UgaGFzIGluY29ycmVjdCAiZnJvbSIgYW5kICJ0byIgaW5kZXhlcycsIFNmID0gJ0xvYWRpbmcgaW1hZ2UnLCBUZiA9ICdUcmFjayBldmVudCByZXF1ZXN0IHN1Y2NlZWRlZCcsIFBmID0gJ1RyYWNrIGV2ZW50IHJlcXVlc3QgZmFpbGVkJywgT2YgPSAnTm8gYWN0aW9ucyB0byBiZSByZW5kZXJlZCcsIGpmID0gJ1JlZGlyZWN0IGFjdGlvbicsIExmID0gJ1NjcmlwdCBsb2FkJywgTWYgPSAnZXJyb3InLCBWZiA9ICd3YXJuaW5nJywgUmYgPSAndW5rbm93bicsIE5mID0gJ3ZhbGlkJywgRmYgPSAnc3VjY2VzcycsIEJmID0gJ3JlbmRlcicsIFVmID0gJ21ldHJpYycsIHpmID0gJ21ib3gnLCBxZiA9ICdvZmZlcicsIEhmID0gJ25hbWUnLCBXZiA9ICdzdGF0dXMnLCBHZiA9ICdwYXJhbXMnLCBZZiA9ICdhY3Rpb25zJywgWGYgPSAncmVzcG9uc2VUb2tlbnMnLCBLZiA9ICdkYXRhJywgUWYgPSAncmVzcG9uc2UnLCAkZiA9ICdyZXF1ZXN0JywgSmYgPSAncHJvdmlkZXInLCBaZiA9ICdwYWdlTG9hZCcsIGVwID0gJ2F0LWZsaWNrZXItY29udHJvbCcsIHRwID0gJ2F0LWVsZW1lbnQtbWFya2VyJywgbnAgPSAnYXQtZWxlbWVudC1jbGljay10cmFja2luZycsIHJwID0gJ2VuYWJsZWQnLCBpcCA9ICdjbGllbnRDb2RlJywgYXAgPSAnaW1zT3JnSWQnLCBvcCA9ICdzZXJ2ZXJEb21haW4nLCBzcCA9ICd0aW1lb3V0JywgY3AgPSAnZ2xvYmFsTWJveE5hbWUnLCB1cCA9ICdnbG9iYWxNYm94QXV0b0NyZWF0ZScsIGxwID0gJ3ZlcnNpb24nLCBkcCA9ICdkZWZhdWx0Q29udGVudEhpZGRlblN0eWxlJywgZnAgPSAnYm9keUhpZGRlblN0eWxlJywgcHAgPSAnYm9keUhpZGluZ0VuYWJsZWQnLCBtcCA9ICdkZXZpY2VJZExpZmV0aW1lJywgZ3AgPSAnc2Vzc2lvbklkTGlmZXRpbWUnLCBocCA9ICdzZWxlY3RvcnNQb2xsaW5nVGltZW91dCcsIHZwID0gJ3Zpc2l0b3JBcGlUaW1lb3V0JywgYnAgPSAnb3ZlcnJpZGVNYm94RWRnZVNlcnZlcicsIHlwID0gJ292ZXJyaWRlTWJveEVkZ2VTZXJ2ZXJUaW1lb3V0JywgX3AgPSAnb3B0b3V0RW5hYmxlZCcsIENwID0gJ3NlY3VyZU9ubHknLCB4cCA9ICdzdXBwbGVtZW50YWxEYXRhSWRQYXJhbVRpbWVvdXQnLCBrcCA9ICdhdXRob3JpbmdTY3JpcHRVcmwnLCB3cCA9ICdzY2hlbWUnLCBFcCA9ICdjb29raWVEb21haW4nLCBJcCA9ICdtYm94UGFyYW1zJywgRHAgPSAnZ2xvYmFsTWJveFBhcmFtcycsIEFwID0gJ21ib3hTZXNzaW9uJywgU3AgPSAnUEMnLCBUcCA9ICdtYm94RWRnZUNsdXN0ZXInLCBQcCA9ICdzZXNzaW9uJywgT3AgPSAnVHJhY2VzJywganAgPSAnc2V0dGluZ3MnLCBMcCA9ICdjbGllbnQnICsgT3AsIE1wID0gJ3NlcnZlcicgKyBPcCwgVnAgPSAnX19fdGFyZ2V0X3RyYWNlcycsIFJwID0gJ3RhcmdldEdsb2JhbFNldHRpbmdzJywgTnAgPSAnZGF0YVByb3ZpZGVyJywgRnAgPSBOcCArICdzJywgQnAgPSAnZW5kcG9pbnQnLCBVcCA9ICd2aWV3c0VuYWJsZWQnLCB6cCA9ICdwYWdlTG9hZEVuYWJsZWQnLCBxcCA9ICdhdXRoU3RhdGUnLCBIcCA9ICdhdXRoZW50aWNhdGVkU3RhdGUnLCBXcCA9ICdpbnRlZ3JhdGlvbkNvZGUnLCBHcCA9ICdwcmltYXJ5JywgWXAgPSAncGFnZScsIFhwID0gJ3ZpZXcnLCBLcCA9ICd2aWV3cycsIFFwID0gJ29wdGlvbnMnLCAkcCA9ICdtZXRyaWNzJywgSnAgPSAnZXZlbnRUb2tlbicsIFpwID0gJ3ZpZXdOYW1lJywgZW0gPSAnZGlzcGxheScsIHRtID0gJ0NvbnRlbnQtVHlwZScsIG5tID0gJ3RleHQvcGxhaW4nLCBybSA9ICdWaWV3IHJlbmRlcmluZyBmYWlsZWQnLCBpbSA9ICdWaWV3IGRlbGl2ZXJ5IGVycm9yJywgYW0gPSAnVmlldyBuYW1lIHNob3VsZCBiZSBhIG5vbi1lbXB0eSBzdHJpbmcnLCBvbSA9ICdWaWV3cyBhcmUgbm90IGVuYWJsZWQnLCBzbSA9ICdQYWdlIGxvYWQgZGlzYWJsZWQnLCBjbSA9ICdVc2luZyBzZXJ2ZXIgc3RhdGUnLCB1bSA9ICdhZG9iZScsIGxtID0gJ29wdEluJywgZG0gPSAnaXNBcHByb3ZlZCcsIGZtID0gJ2ZldGNoUGVybWlzc2lvbnMnLCBwbSA9ICdDYXRlZ29yaWVzJywgbW0gPSAnVEFSR0VUJywgZ20gPSAnQU5BTFlUSUNTJywgaG0gPSAnb3B0aW5FbmFibGVkJywgdm0gPSAnQWRvYmUgVGFyZ2V0IGlzIG5vdCBvcHRlZCBpbicsIGJtID0gJ2FuYWx5dGljc0xvZ2dpbmcnLCB5bSA9ICdzZXJ2ZXJTdGF0ZScsIF9tID0gJ2NzcFNjcmlwdE5vbmNlJywgQ20gPSAnY3NwU3R5bGVOb25jZScsIHhtID0gJ2NhY2hlLXVwZGF0ZWQtZXZlbnQnLCBrbSA9ICduby1vZmZlcnMtZXZlbnQnLCB3bSA9ICdyZWRpcmVjdC1vZmZlci1ldmVudCcsIEVtID0gJ05vbmUnLCBJbSA9ICd3ZWInLCBEbSA9ICdmaWxlOicsIEFtID0gL14oPyEwKSg/IS4qXC4kKSgoMT9cZD9cZHwyNVswLTVdfDJbMC00XVxkKShcLnwkKSl7NH0kLywgU20gPSAvXihjb218ZWR1fGdvdnxuZXR8bWlsfG9yZ3xub218Y298bmFtZXxpbmZvfGJpeikkL2ksIFRtID0ge30sIFBtID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3AsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSXAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RlZmF1bHRDb250ZW50VmlzaWJsZVN0eWxlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1wLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdnAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHlwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3AsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBobSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1cmxTaXplTGltaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6cCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5bSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdkZWNpc2lvbmluZ01ldGhvZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncG9sbGluZ0ludGVydmFsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcnRpZmFjdExvY2F0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcnRpZmFjdEZvcm1hdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYXJ0aWZhY3RQYXlsb2FkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbnZpcm9ubWVudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2RuRW52aXJvbm1lbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RlbGVtZXRyeUVuYWJsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NkbkJhc2VQYXRoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9tLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ20sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBPbSA9IHZsLnBhcnNlLCBqbSA9IHZsLnN0cmluZ2lmeSwgTG0gPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdhJyksIE1tID0ge30sIFZtID0gaGwuZ2V0LCBSbSA9IGhsLnNldCwgTm0gPSBobC5yZW1vdmUsIEZtID0gJ21ib3gnLCBCbSA9ICdBVDonLCBVbSA9ICcxJywgem0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGUgPyBTdHJpbmcoZSkgOiAkW0ouY2FsbChlKV0gfHwgJ29iamVjdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PSB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiBlID09IGUud2luZG93OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiBlLm5vZGVUeXBlID09IGUuRE9DVU1FTlRfTk9ERTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnb2JqZWN0JyA9PSB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoZSkgJiYgIXIoZSkgJiYgT2JqZWN0LmdldFByb3RvdHlwZU9mKGUpID09IE9iamVjdC5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICEhZSAmJiAnbGVuZ3RoJyBpbiBlICYmIGUubGVuZ3RoLCBuID0gRC50eXBlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyAhPSBuICYmICFyKGUpICYmICgnYXJyYXknID09IG4gfHwgMCA9PT0gdCB8fCAnbnVtYmVyJyA9PSB0eXBlb2YgdCAmJiB0ID4gMCAmJiB0IC0gMSBpbiBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqLmNhbGwoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubGVuZ3RoID4gMCA/IEQuZm4uY29uY2F0LmFwcGx5KFtdLCBlKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZXBsYWNlKC86Oi9nLCAnLycpLnJlcGxhY2UoLyhbQS1aXSspKFtBLVpdW2Etel0pL2csICckMV8kMicpLnJlcGxhY2UoLyhbYS16XGRdKShbQS1aXSkvZywgJyQxXyQyJykucmVwbGFjZSgvXy9nLCAnLScpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSBpbiBSID8gUltlXSA6IFJbZV0gPSBuZXcgUmVnRXhwKCcoXnxcXHMpJyArIGUgKyAnKFxcc3wkKScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInICE9IHR5cGVvZiB0IHx8IE5bZChlKV0gPyB0IDogdCArICdweCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFZbZV0gfHwgKHQgPSBNLmNyZWF0ZUVsZW1lbnQoZSksIE0uYm9keS5hcHBlbmRDaGlsZCh0KSwgbiA9IGdldENvbXB1dGVkU3R5bGUodCwgJycpLmdldFByb3BlcnR5VmFsdWUoJ2Rpc3BsYXknKSwgdC5wYXJlbnROb2RlLnJlbW92ZUNoaWxkKHQpLCAnbm9uZScgPT0gbiAmJiAobiA9ICdibG9jaycpLCBWW2VdID0gbiksIFZbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGcoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2NoaWxkcmVuJyBpbiBlID8gTC5jYWxsKGUuY2hpbGRyZW4pIDogRC5tYXAoZS5jaGlsZE5vZGVzLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gZS5ub2RlVHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciA9IGUgPyBlLmxlbmd0aCA6IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPCByOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzW25dID0gZVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sZW5ndGggPSByLCB0aGlzLnNlbGVjdG9yID0gdCB8fCAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoSSBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiAobyh0W0ldKSB8fCByZSh0W0ldKSkgPyAobyh0W0ldKSAmJiAhbyhlW0ldKSAmJiAoZVtJXSA9IHt9KSwgcmUodFtJXSkgJiYgIXJlKGVbSV0pICYmIChlW0ldID0gW10pLCB2KGVbSV0sIHRbSV0sIG4pKSA6IHRbSV0gIT09IEUgJiYgKGVbSV0gPSB0W0ldKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IHQgPyBEKGUpIDogRChlKS5maWx0ZXIodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHkoZSwgdCwgciwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbih0KSA/IHQuY2FsbChlLCByLCBpKSA6IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF8oZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsID09IG4gPyBlLnJlbW92ZUF0dHJpYnV0ZSh0KSA6IGUuc2V0QXR0cmlidXRlKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmNsYXNzTmFtZSB8fCAnJywgciA9IG4gJiYgbi5iYXNlVmFsICE9PSBFOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9PT0gRSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByID8gbi5iYXNlVmFsIDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA/IG4uYmFzZVZhbCA9IHQgOiBlLmNsYXNzTmFtZSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHgoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPyAndHJ1ZScgPT0gZSB8fCAnZmFsc2UnICE9IGUgJiYgKCdudWxsJyA9PSBlID8gbnVsbCA6ICtlICsgJycgPT0gZSA/ICtlIDogL15bXFtce10vLnRlc3QoZSkgPyBELnBhcnNlSlNPTihlKSA6IGUpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gayhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0gZS5jaGlsZE5vZGVzLmxlbmd0aDsgbiA8IHI7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsoZS5jaGlsZE5vZGVzW25dLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5nZXRFbGVtZW50c0J5VGFnTmFtZSgnc2NyaXB0JylbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHIucGFyZW50Tm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlLmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuaW5uZXJIVE1MID0gdCwgTWwobikgJiYgYS5zZXRBdHRyaWJ1dGUoJ25vbmNlJywgbiksIGkuYXBwZW5kQ2hpbGQoYSksIGkucmVtb3ZlQ2hpbGQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEUsIEksIEQsIEEsIFMsIFQsIFAgPSBbXSwgTyA9IFAuY29uY2F0LCBqID0gUC5maWx0ZXIsIEwgPSBQLnNsaWNlLCBNID0gZS5kb2N1bWVudCwgViA9IHt9LCBSID0ge30sIE4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29sdW1uLWNvdW50JzogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbnM6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZm9udC13ZWlnaHQnOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2xpbmUtaGVpZ2h0JzogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wYWNpdHk6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnei1pbmRleCc6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6b29tOiAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEYgPSAvXlxzKjwoXHcrfCEpW14+XSo+LywgQiA9IC9ePChcdyspXHMqXC8/Pig/OjxcL1wxPnwpJC8sIFUgPSAvPCg/IWFyZWF8YnJ8Y29sfGVtYmVkfGhyfGltZ3xpbnB1dHxsaW5rfG1ldGF8cGFyYW0pKChbXHc6XSspW14+XSopXC8+L2dpLCB6ID0gL14oPzpib2R5fGh0bWwpJC9pLCBxID0gLyhbQS1aXSkvZywgSCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2YWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NzcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGV4dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd2lkdGgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2hlaWdodCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb2Zmc2V0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBXID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FmdGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVwZW5kJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdiZWZvcmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FwcGVuZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgRyA9IE0uY3JlYXRlRWxlbWVudCgndGFibGUnKSwgWSA9IE0uY3JlYXRlRWxlbWVudCgndHInKSwgWCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyOiBNLmNyZWF0ZUVsZW1lbnQoJ3Rib2R5JyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ym9keTogRywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZWFkOiBHLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGZvb3Q6IEcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZDogWSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoOiBZLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJyonOiBNLmNyZWF0ZUVsZW1lbnQoJ2RpdicpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEsgPSAvY29tcGxldGV8bG9hZGVkfGludGVyYWN0aXZlLywgUSA9IC9eW1x3LV0qJC8sICQgPSB7fSwgSiA9ICQudG9TdHJpbmcsIGVlID0ge30sIHRlID0gTS5jcmVhdGVFbGVtZW50KCdkaXYnKSwgbmUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWJpbmRleDogJ3RhYkluZGV4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRvbmx5OiAncmVhZE9ubHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yOiAnaHRtbEZvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzczogJ2NsYXNzTmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhsZW5ndGg6ICdtYXhMZW5ndGgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2VsbHNwYWNpbmc6ICdjZWxsU3BhY2luZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjZWxscGFkZGluZzogJ2NlbGxQYWRkaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJvd3NwYW46ICdyb3dTcGFuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHNwYW46ICdjb2xTcGFuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZW1hcDogJ3VzZU1hcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcmFtZWJvcmRlcjogJ2ZyYW1lQm9yZGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnRlZGl0YWJsZTogJ2NvbnRlbnRFZGl0YWJsZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcmUgPSBBcnJheS5pc0FycmF5IHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSBpbnN0YW5jZW9mIEFycmF5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlZS5tYXRjaGVzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0IHx8ICFlIHx8IDEgIT09IGUubm9kZVR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5tYXRjaGVzIHx8IGUud2Via2l0TWF0Y2hlc1NlbGVjdG9yIHx8IGUubW96TWF0Y2hlc1NlbGVjdG9yIHx8IGUub01hdGNoZXNTZWxlY3RvciB8fCBlLm1hdGNoZXNTZWxlY3RvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jYWxsKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgaSA9IGUucGFyZW50Tm9kZSwgYSA9ICFpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSAmJiAoaSA9IHRlKS5hcHBlbmRDaGlsZChlKSwgciA9IH5lZS5xc2EoaSwgdCkuaW5kZXhPZihlKSwgYSAmJiB0ZS5yZW1vdmVDaGlsZChlKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBTID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVwbGFjZSgvLSsoLik/L2csIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA/IHQudG9VcHBlckNhc2UoKSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBUID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGouY2FsbChlLCBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuaW5kZXhPZih0KSA9PSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlZS5mcmFnbWVudCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQi50ZXN0KGUpICYmIChyID0gRChNLmNyZWF0ZUVsZW1lbnQoUmVnRXhwLiQxKSkpLCByIHx8IChlLnJlcGxhY2UgJiYgKGUgPSBlLnJlcGxhY2UoVSwgJzwkMT48LyQyPicpKSwgdCA9PT0gRSAmJiAodCA9IEYudGVzdChlKSAmJiBSZWdFeHAuJDEpLCB0IGluIFggfHwgKHQgPSAnKicpLCAoYSA9IFhbdF0pLmlubmVySFRNTCA9ICcnICsgZSwgciA9IEQuZWFjaChMLmNhbGwoYS5jaGlsZE5vZGVzKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5yZW1vdmVDaGlsZCh0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBvKG4pICYmIChpID0gRChyKSwgRC5lYWNoKG4sIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBILmluZGV4T2YoZSkgPiAtMSA/IGlbZV0odCkgOiBpLmF0dHIoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlZS5aID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBoKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVlLmlzWiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIGluc3RhbmNlb2YgZWUuWjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlZS5pbml0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlZS5aKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnPCcgPT0gKGUgPSBlLnRyaW0oKSlbMF0gJiYgRi50ZXN0KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBlZS5mcmFnbWVudChlLCBSZWdFeHAuJDEsIHQpLCBlID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICE9PSBFKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRCh0KS5maW5kKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBlZS5xc2EoTSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEQoTSkucmVhZHkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZWUuaXNaKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSB1KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoYShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gW2VdLCBlID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKEYudGVzdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gZWUuZnJhZ21lbnQoZS50cmltKCksIFJlZ0V4cC4kMSwgdCksIGUgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgIT09IEUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEKHQpLmZpbmQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IGVlLnFzYShNLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWUuWihyLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAoRCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlZS5pbml0KGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmV4dGVuZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gTC5jYWxsKGFyZ3VtZW50cywgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYm9vbGVhbicgPT0gdHlwZW9mIGUgJiYgKHQgPSBlLCBlID0gbi5zaGlmdCgpKSwgbi5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2KGUsIG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlZS5xc2EgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciA9ICcjJyA9PSB0WzBdLCBpID0gIXIgJiYgJy4nID09IHRbMF0sIGEgPSByIHx8IGkgPyB0LnNsaWNlKDEpIDogdCwgbyA9IFEudGVzdChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZ2V0RWxlbWVudEJ5SWQgJiYgbyAmJiByID8gKG4gPSBlLmdldEVsZW1lbnRCeUlkKGEpKSA/IFtuXSA6IFtdIDogMSAhPT0gZS5ub2RlVHlwZSAmJiA5ICE9PSBlLm5vZGVUeXBlICYmIDExICE9PSBlLm5vZGVUeXBlID8gW10gOiBMLmNhbGwobyAmJiAhciAmJiBlLmdldEVsZW1lbnRzQnlDbGFzc05hbWUgPyBpID8gZS5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lKGEpIDogZS5nZXRFbGVtZW50c0J5VGFnTmFtZSh0KSA6IGUucXVlcnlTZWxlY3RvckFsbCh0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRC5jb250YWlucyA9IE0uZG9jdW1lbnRFbGVtZW50LmNvbnRhaW5zID8gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgIT09IHQgJiYgZS5jb250YWlucyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHQgJiYgKHQgPSB0LnBhcmVudE5vZGUpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEQudHlwZSA9IHQsIEQuaXNGdW5jdGlvbiA9IG4sIEQuaXNXaW5kb3cgPSByLCBELmlzQXJyYXkgPSByZSwgRC5pc1BsYWluT2JqZWN0ID0gbywgRC5pc0VtcHR5T2JqZWN0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRC5pc051bWVyaWMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE51bWJlcihlKSwgbiA9IHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGUgJiYgJ2Jvb2xlYW4nICE9IG4gJiYgKCdzdHJpbmcnICE9IG4gfHwgZS5sZW5ndGgpICYmICFpc05hTih0KSAmJiBpc0Zpbml0ZSh0KSB8fCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBELmluQXJyYXkgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUC5pbmRleE9mLmNhbGwodCwgZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRC5jYW1lbENhc2UgPSBTLCBELnRyaW0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBlID8gJycgOiBTdHJpbmcucHJvdG90eXBlLnRyaW0uY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBELnV1aWQgPSAwLCBELnN1cHBvcnQgPSB7fSwgRC5leHByID0ge30sIEQubm9vcCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBELm1hcCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByLCBpLCBhID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyID0gMDsgciA8IGUubGVuZ3RoOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSAobiA9IHQoZVtyXSwgcikpICYmIGEucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSAobiA9IHQoZVtpXSwgaSkpICYmIGEucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRC5lYWNoID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgZS5sZW5ndGg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoITEgPT09IHQuY2FsbChlW25dLCBuLCBlW25dKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCExID09PSB0LmNhbGwoZVtyXSwgciwgZVtyXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBELmdyZXAgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gai5jYWxsKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuSlNPTiAmJiAoRC5wYXJzZUpTT04gPSBKU09OLnBhcnNlKSwgRC5lYWNoKCdCb29sZWFuIE51bWJlciBTdHJpbmcgRnVuY3Rpb24gQXJyYXkgRGF0ZSBSZWdFeHAgT2JqZWN0IEVycm9yJy5zcGxpdCgnICcpLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkWydbb2JqZWN0ICcgKyB0ICsgJ10nXSA9IHQudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgRC5mbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3RydWN0b3I6IGVlLlosCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbmd0aDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yRWFjaDogUC5mb3JFYWNoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWR1Y2U6IFAucmVkdWNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXNoOiBQLnB1c2gsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvcnQ6IFAuc29ydCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BsaWNlOiBQLnNwbGljZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXhPZjogUC5pbmRleE9mLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25jYXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0LCBuID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSAwOyBlIDwgYXJndW1lbnRzLmxlbmd0aDsgZSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBhcmd1bWVudHNbZV0sIG5bZV0gPSBlZS5pc1oodCkgPyB0LnRvQXJyYXkoKSA6IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTy5hcHBseShlZS5pc1oodGhpcykgPyB0aGlzLnRvQXJyYXkoKSA6IHRoaXMsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRChELm1hcCh0aGlzLCBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNhbGwodCwgbiwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNsaWNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRChMLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkeTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBLLnRlc3QoTS5yZWFkeVN0YXRlKSAmJiBNLmJvZHkgPyBlKEQpIDogTS5hZGRFdmVudExpc3RlbmVyKCdET01Db250ZW50TG9hZGVkJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUoRCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMSksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBFID8gTC5jYWxsKHRoaXMpIDogdGhpc1tlID49IDAgPyBlIDogZSArIHRoaXMubGVuZ3RoXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9BcnJheTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IHRoaXMucGFyZW50Tm9kZSAmJiB0aGlzLnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWFjaDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQsIG4gPSB0aGlzLmxlbmd0aCwgciA9IDA7IHIgPCBuICYmICh0ID0gdGhpc1tyXSwgITEgIT09IGUuY2FsbCh0LCByLCB0KSk7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWx0ZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbihlKSA/IHRoaXMubm90KHRoaXMubm90KGUpKSA6IEQoai5jYWxsKHRoaXMsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVlLm1hdGNoZXModCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEKFQodGhpcy5jb25jYXQoRChlLCB0KSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5sZW5ndGggPiAwICYmIGVlLm1hdGNoZXModGhpc1swXSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobihlKSAmJiBlLmNhbGwgIT09IEUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5lYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbCh0aGlzLCBuKSB8fCB0LnB1c2godGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICdzdHJpbmcnID09IHR5cGVvZiBlID8gdGhpcy5maWx0ZXIoZSkgOiBjKGUpICYmIG4oZS5pdGVtKSA/IEwuY2FsbChlKSA6IEQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaW5kZXhPZihlKSA8IDAgJiYgdC5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbHRlcihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoZSkgPyBELmNvbnRhaW5zKHRoaXMsIGUpIDogRCh0aGlzKS5maW5kKGUpLnNpemUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSA9PT0gZSA/IHRoaXMuc2xpY2UoZSkgOiB0aGlzLnNsaWNlKGUsICtlICsgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpcnN0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXNbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAhYShlKSA/IGUgOiBEKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXNbdGhpcy5sZW5ndGggLSAxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICFhKGUpID8gZSA6IEQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9IGUgPyAnb2JqZWN0JyA9PSBzKGUpID8gRChlKS5maWx0ZXIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUC5zb21lLmNhbGwobiwgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEQuY29udGFpbnModCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IDEgPT0gdGhpcy5sZW5ndGggPyBEKGVlLnFzYSh0aGlzWzBdLCBlKSkgOiB0aGlzLm1hcChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVlLnFzYSh0aGlzLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogRCgpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbG9zZXN0OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBbXSwgciA9ICdvYmplY3QnID09IHMoZSkgJiYgRChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKGEsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbyAmJiAhKHIgPyByLmluZGV4T2YobykgPj0gMCA6IGVlLm1hdGNoZXMobywgZSkpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IG8gIT09IHQgJiYgIWkobykgJiYgby5wYXJlbnROb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gJiYgbi5pbmRleE9mKG8pIDwgMCAmJiBuLnB1c2gobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgRChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyZW50czogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBbXSwgbiA9IHRoaXM7IG4ubGVuZ3RoID4gMDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IEQubWFwKG4sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoZSA9IGUucGFyZW50Tm9kZSkgJiYgIWkoZSkgJiYgdC5pbmRleE9mKGUpIDwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnB1c2goZSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYih0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyZW50OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIoVCh0aGlzLnBsdWNrKCdwYXJlbnROb2RlJykpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGRyZW46IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYih0aGlzLm1hcChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnRzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5tYXAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbnRlbnREb2N1bWVudCB8fCBMLmNhbGwodGhpcy5jaGlsZE5vZGVzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaWJsaW5nczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKHRoaXMubWFwKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGouY2FsbChnKHQucGFyZW50Tm9kZSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICE9PSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbXB0eTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pbm5lckhUTUwgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbHVjazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBELm1hcCh0aGlzLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNob3c6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdub25lJyA9PSB0aGlzLnN0eWxlLmRpc3BsYXkgJiYgKHRoaXMuc3R5bGUuZGlzcGxheSA9ICcnKSwgJ25vbmUnID09IGdldENvbXB1dGVkU3R5bGUodGhpcywgJycpLmdldFByb3BlcnR5VmFsdWUoJ2Rpc3BsYXknKSAmJiAodGhpcy5zdHlsZS5kaXNwbGF5ID0gbSh0aGlzLm5vZGVOYW1lKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVwbGFjZVdpdGg6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5iZWZvcmUoZSkucmVtb3ZlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyYXA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpc1swXSAmJiAhdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IEQoZSkuZ2V0KDApLCBpID0gci5wYXJlbnROb2RlIHx8IHRoaXMubGVuZ3RoID4gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEKHRoaXMpLndyYXBBbGwodCA/IGUuY2FsbCh0aGlzLCBuKSA6IGkgPyByLmNsb25lTm9kZSghMCkgOiByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cmFwQWxsOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXNbMF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKEQodGhpc1swXSkuYmVmb3JlKGUgPSBEKGUpKTsgKHQgPSBlLmNoaWxkcmVuKCkpLmxlbmd0aDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSB0LmZpcnN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRChlKS5hcHBlbmQodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JhcElubmVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gRCh0aGlzKSwgaSA9IHIuY29udGVudHMoKSwgYSA9IHQgPyBlLmNhbGwodGhpcywgbikgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkubGVuZ3RoID8gaS53cmFwQWxsKGEpIDogci5hcHBlbmQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW53cmFwOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wYXJlbnQoKS5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEKHRoaXMpLnJlcGxhY2VXaXRoKEQodGhpcykuY2hpbGRyZW4oKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xvbmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm1hcChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY2xvbmVOb2RlKCEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaWRlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jc3MoJ2Rpc3BsYXknLCAnbm9uZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2dnbGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEQodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGUgPT09IEUgPyAnbm9uZScgPT0gdC5jc3MoJ2Rpc3BsYXknKSA6IGUpID8gdC5zaG93KCkgOiB0LmhpZGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmV2OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEQodGhpcy5wbHVjaygncHJldmlvdXNFbGVtZW50U2libGluZycpKS5maWx0ZXIoZSB8fCAnKicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEQodGhpcy5wbHVjaygnbmV4dEVsZW1lbnRTaWJsaW5nJykpLmZpbHRlcihlIHx8ICcqJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGh0bWw6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCBpbiBhcmd1bWVudHMgPyB0aGlzLmVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuaW5uZXJIVE1MOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEQodGhpcykuZW1wdHkoKS5hcHBlbmQoeSh0aGlzLCBlLCB0LCBuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IDAgaW4gdGhpcyA/IHRoaXNbMF0uaW5uZXJIVE1MIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwIGluIGFyZ3VtZW50cyA/IHRoaXMuZWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0geSh0aGlzLCBlLCB0LCB0aGlzLnRleHRDb250ZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnRleHRDb250ZW50ID0gbnVsbCA9PSBuID8gJycgOiAnJyArIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IDAgaW4gdGhpcyA/IHRoaXMucGx1Y2soJ3RleHRDb250ZW50Jykuam9pbignJykgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHRyOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgIT0gdHlwZW9mIGUgfHwgMSBpbiBhcmd1bWVudHMgPyB0aGlzLmVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PT0gdGhpcy5ub2RlVHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKEkgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfKHRoaXMsIEksIGVbSV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfKHRoaXMsIGUsIHkodGhpcywgdCwgbiwgdGhpcy5nZXRBdHRyaWJ1dGUoZSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogMCBpbiB0aGlzICYmIDEgPT0gdGhpc1swXS5ub2RlVHlwZSAmJiBudWxsICE9IChuID0gdGhpc1swXS5nZXRBdHRyaWJ1dGUoZSkpID8gbiA6IEU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZUF0dHI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxID09PSB0aGlzLm5vZGVUeXBlICYmIGUuc3BsaXQoJyAnKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8odGhpcywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gbmVbZV0gfHwgZSwgMSBpbiBhcmd1bWVudHMgPyB0aGlzLmVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzW2VdID0geSh0aGlzLCB0LCBuLCB0aGlzW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogdGhpc1swXSAmJiB0aGlzWzBdW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVQcm9wOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBuZVtlXSB8fCBlLCB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICdkYXRhLScgKyBlLnJlcGxhY2UocSwgJy0kMScpLnRvTG93ZXJDYXNlKCksIHIgPSAxIGluIGFyZ3VtZW50cyA/IHRoaXMuYXR0cihuLCB0KSA6IHRoaXMuYXR0cihuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSByID8geChyKSA6IEU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwIGluIGFyZ3VtZW50cyA/IChudWxsID09IGUgJiYgKGUgPSAnJyksIHRoaXMuZWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmFsdWUgPSB5KHRoaXMsIGUsIHQsIHRoaXMudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIDogdGhpc1swXSAmJiAodGhpc1swXS5tdWx0aXBsZSA/IEQodGhpc1swXSkuZmluZCgnb3B0aW9uJykuZmlsdGVyKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zZWxlY3RlZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnBsdWNrKCd2YWx1ZScpIDogdGhpc1swXS52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9mZnNldDogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBEKHRoaXMpLCByID0geSh0aGlzLCB0LCBlLCBuLm9mZnNldCgpKSwgaSA9IG4ub2Zmc2V0UGFyZW50KCkub2Zmc2V0KCksIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9wOiByLnRvcCAtIGkudG9wLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IHIubGVmdCAtIGkubGVmdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0YXRpYycgPT0gbi5jc3MoJ3Bvc2l0aW9uJykgJiYgKGEucG9zaXRpb24gPSAncmVsYXRpdmUnKSwgbi5jc3MoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXRoaXMubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE0uZG9jdW1lbnRFbGVtZW50ICE9PSB0aGlzWzBdICYmICFELmNvbnRhaW5zKE0uZG9jdW1lbnRFbGVtZW50LCB0aGlzWzBdKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3A6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzWzBdLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWZ0OiBuLmxlZnQgKyBlLnBhZ2VYT2Zmc2V0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvcDogbi50b3AgKyBlLnBhZ2VZT2Zmc2V0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiBNYXRoLnJvdW5kKG4ud2lkdGgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogTWF0aC5yb3VuZChuLmhlaWdodCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNzczogZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoIDwgMikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdGhpc1swXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5zdHlsZVtTKGUpXSB8fCBnZXRDb21wdXRlZFN0eWxlKHIsICcnKS5nZXRQcm9wZXJ0eVZhbHVlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmUoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHt9LCBhID0gZ2V0Q29tcHV0ZWRTdHlsZShyLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBELmVhY2goZSwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlbdF0gPSByLnN0eWxlW1ModCldIHx8IGEuZ2V0UHJvcGVydHlWYWx1ZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gfHwgMCA9PT0gbiA/IG8gPSBkKGUpICsgJzonICsgcChlLCBuKSA6IHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3R5bGUucmVtb3ZlUHJvcGVydHkoZChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChJIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbSV0gfHwgMCA9PT0gZVtJXSA/IG8gKz0gZChJKSArICc6JyArIHAoSSwgZVtJXSkgKyAnOycgOiB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdHlsZS5yZW1vdmVQcm9wZXJ0eShkKEkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0eWxlLmNzc1RleHQgKz0gJzsnICsgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gdGhpcy5pbmRleE9mKEQoZSlbMF0pIDogdGhpcy5wYXJlbnQoKS5jaGlsZHJlbigpLmluZGV4T2YodGhpc1swXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc0NsYXNzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZSAmJiBQLnNvbWUuY2FsbCh0aGlzLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRlc3QoQyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkQ2xhc3M6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IHRoaXMuZWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnY2xhc3NOYW1lJyBpbiB0aGlzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBDKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5KHRoaXMsIGUsIHQsIG4pLnNwbGl0KC9ccysvZykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRCh0aGlzKS5oYXNDbGFzcyhlKSB8fCBBLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMpLCBBLmxlbmd0aCAmJiBDKHRoaXMsIG4gKyAobiA/ICcgJyA6ICcnKSArIEEuam9pbignICcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZUNsYXNzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnY2xhc3NOYW1lJyBpbiB0aGlzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSBFKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEModGhpcywgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBID0gQyh0aGlzKSwgeSh0aGlzLCBlLCB0LCBBKS5zcGxpdCgvXHMrL2cpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEgPSBBLnJlcGxhY2UoZihlKSwgJyAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIEModGhpcywgQS50cmltKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2dnbGVDbGFzczogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gdGhpcy5lYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBEKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkodGhpcywgZSwgbiwgQyh0aGlzKSkuc3BsaXQoL1xzKy9nKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh0ID09PSBFID8gIXIuaGFzQ2xhc3MoZSkgOiB0KSA/IHIuYWRkQ2xhc3MoZSkgOiByLnJlbW92ZUNsYXNzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JvbGxUb3A6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICdzY3JvbGxUb3AnIGluIHRoaXNbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IEUgPyB0ID8gdGhpc1swXS5zY3JvbGxUb3AgOiB0aGlzWzBdLnBhZ2VZT2Zmc2V0IDogdGhpcy5lYWNoKHQgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsVG9wID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbFRvKHRoaXMuc2Nyb2xsWCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcm9sbExlZnQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICdzY3JvbGxMZWZ0JyBpbiB0aGlzWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBFID8gdCA/IHRoaXNbMF0uc2Nyb2xsTGVmdCA6IHRoaXNbMF0ucGFnZVhPZmZzZXQgOiB0aGlzLmVhY2godCA/IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zY3JvbGxMZWZ0ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbFRvKGUsIHRoaXMuc2Nyb2xsWSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXNbMF0sIHQgPSB0aGlzLm9mZnNldFBhcmVudCgpLCBuID0gdGhpcy5vZmZzZXQoKSwgciA9IHoudGVzdCh0WzBdLm5vZGVOYW1lKSA/IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvcDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IHQub2Zmc2V0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4udG9wIC09IHBhcnNlRmxvYXQoRChlKS5jc3MoJ21hcmdpbi10b3AnKSkgfHwgMCwgbi5sZWZ0IC09IHBhcnNlRmxvYXQoRChlKS5jc3MoJ21hcmdpbi1sZWZ0JykpIHx8IDAsIHIudG9wICs9IHBhcnNlRmxvYXQoRCh0WzBdKS5jc3MoJ2JvcmRlci10b3Atd2lkdGgnKSkgfHwgMCwgci5sZWZ0ICs9IHBhcnNlRmxvYXQoRCh0WzBdKS5jc3MoJ2JvcmRlci1sZWZ0LXdpZHRoJykpIHx8IDAsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9wOiBuLnRvcCAtIHIudG9wLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWZ0OiBuLmxlZnQgLSByLmxlZnQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZmZzZXRQYXJlbnQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm1hcChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHRoaXMub2Zmc2V0UGFyZW50IHx8IE0uYm9keTsgZSAmJiAhei50ZXN0KGUubm9kZU5hbWUpICYmICdzdGF0aWMnID09IEQoZSkuY3NzKCdwb3NpdGlvbicpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUub2Zmc2V0UGFyZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBELmZuLmRldGFjaCA9IEQuZm4ucmVtb3ZlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3aWR0aCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdoZWlnaHQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZXBsYWNlKC8uLywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlWzBdLnRvVXBwZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBELmZuW2VdID0gZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCBvID0gdGhpc1swXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID09PSBFID8gcihvKSA/IG9bJ2lubmVyJyArIHRdIDogaShvKSA/IG8uZG9jdW1lbnRFbGVtZW50WydzY3JvbGwnICsgdF0gOiAoYSA9IHRoaXMub2Zmc2V0KCkpICYmIGFbZV0gOiB0aGlzLmVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobyA9IEQodGhpcykpLmNzcyhlLCB5KHRoaXMsIG4sIHQsIG9bZV0oKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIFcuZm9yRWFjaChmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4gJSAyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBELmZuW2VdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIGksIGEgPSBELm1hcChhcmd1bWVudHMsIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYXJyYXknID09IChlID0gdChuKSkgPyAobi5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5ub2RlVHlwZSAhPT0gRSA/IHIucHVzaChlKSA6IEQuemVwdG8uaXNaKGUpID8gciA9IHIuY29uY2F0KGUuZ2V0KCkpIDogdm9pZCAociA9IHIuY29uY2F0KGVlLmZyYWdtZW50KGUpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByKSA6ICdvYmplY3QnID09IGUgfHwgbnVsbCA9PSBuID8gbiA6IGVlLmZyYWdtZW50KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvID0gdGhpcy5sZW5ndGggPiAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubGVuZ3RoIDwgMSA/IHRoaXMgOiB0aGlzLmVhY2goZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gciA/IHQgOiB0LnBhcmVudE5vZGUsIHQgPSAwID09IG4gPyB0Lm5leHRTaWJsaW5nIDogMSA9PSBuID8gdC5maXJzdENoaWxkIDogMiA9PSBuID8gdCA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBELmNvbnRhaW5zKE0uZG9jdW1lbnRFbGVtZW50LCBpKSwgYyA9IC9eKHRleHR8YXBwbGljYXRpb24pXC8oamF2YXNjcmlwdHxlY21hc2NyaXB0KSQvLCB1ID0gWigpLCBsID0gdVtfbV0sIGQgPSB1W0NtXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5jbG9uZU5vZGUoITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICghaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEKGUpLnJlbW92ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNbChsKSAmJiAnU0NSSVBUJyA9PT0gZS50YWdOYW1lICYmIGUuc2V0QXR0cmlidXRlKCdub25jZScsIGwpLCBNbChkKSAmJiAnU1RZTEUnID09PSBlLnRhZ05hbWUgJiYgZS5zZXRBdHRyaWJ1dGUoJ25vbmNlJywgZCksIGkuaW5zZXJ0QmVmb3JlKGUsIHQpLCBzICYmIGsoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT0gZS5ub2RlTmFtZSB8fCAnU0NSSVBUJyAhPT0gZS5ub2RlTmFtZS50b1VwcGVyQ2FzZSgpIHx8IGUudHlwZSAmJiAhYy50ZXN0KGUudHlwZS50b0xvd2VyQ2FzZSgpKSB8fCBlLnNyYyB8fCB3KE0sIGUuaW5uZXJIVE1MLCBlLm5vbmNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRC5mbltyID8gZSArICdUbycgOiAnaW5zZXJ0JyArIChuID8gJ0JlZm9yZScgOiAnQWZ0ZXInKV0gPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEQodClbZV0odGhpcyksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGVlLloucHJvdG90eXBlID0gaC5wcm90b3R5cGUgPSBELmZuLCBlZS51bmlxID0gVCwgZWUuZGVzZXJpYWxpemVWYWx1ZSA9IHgsIEQuemVwdG8gPSBlZSwgRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5femlkIHx8IChlLl96aWQgPSBwKyspOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUsIHQsIHIsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0ID0gaSh0KSkubnMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGEodC5ucyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAodltuKGUpXSB8fCBbXSkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAoIXQuZSB8fCBlLmUgPT0gdC5lKSAmJiAoIXQubnMgfHwgcy50ZXN0KGUubnMpKSAmJiAoIXIgfHwgbihlLmZuKSA9PT0gbihyKSkgJiYgKCFvIHx8IGUuc2VsID09IG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gKCcnICsgZSkuc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGU6IHRbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuczogdC5zbGljZSgxKS5zb3J0KCkuam9pbignICcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFJlZ0V4cCgnKD86XnwgKScgKyBlLnJlcGxhY2UoJyAnLCAnIC4qID8nKSArICcoPzogfCQpJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5kZWwgJiYgIXkgJiYgZS5lIGluIF8gfHwgISF0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIENbZV0gfHwgeSAmJiBfW2VdIHx8IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSwgciwgYSwgYywgdSwgZCwgcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IG4oZSksIGcgPSB2W21dIHx8ICh2W21dID0gW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnNwbGl0KC9ccy8pLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgncmVhZHknID09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQoZG9jdW1lbnQpLnJlYWR5KGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBpKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5mbiA9IGEsIHIuc2VsID0gdSwgci5lIGluIEMgJiYgKGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5yZWxhdGVkVGFyZ2V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbiB8fCBuICE9PSB0aGlzICYmICF0LmNvbnRhaW5zKHRoaXMsIG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5mbi5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIuZGVsID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gZCB8fCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5wcm94eSA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodCA9IGwodCkpLmlzSW1tZWRpYXRlUHJvcGFnYXRpb25TdG9wcGVkKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5kYXRhID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBtLmFwcGx5KGUsIHQuX2FyZ3MgPT0gZiA/IFt0XSA6IFt0XS5jb25jYXQodC5fYXJncykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITEgPT09IG4gJiYgKHQucHJldmVudERlZmF1bHQoKSwgdC5zdG9wUHJvcGFnYXRpb24oKSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgci5pID0gZy5sZW5ndGgsIGcucHVzaChyKSwgJ2FkZEV2ZW50TGlzdGVuZXInIGluIGUgJiYgZS5hZGRFdmVudExpc3RlbmVyKHMoci5lKSwgci5wcm94eSwgbyhyLCBwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KGUsIHQsIGksIGEsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBuKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodCB8fCAnJykuc3BsaXQoL1xzLykuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihlLCB0LCBpLCBhKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHZbdV1bdC5pXSwgJ3JlbW92ZUV2ZW50TGlzdGVuZXInIGluIGUgJiYgZS5yZW1vdmVFdmVudExpc3RlbmVyKHModC5lKSwgdC5wcm94eSwgbyh0LCBjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiB8fCAhZS5pc0RlZmF1bHRQcmV2ZW50ZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gfHwgKG4gPSBlKSwgdC5lYWNoKEUsIGZ1bmN0aW9uICh0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3JdID0geCwgaSAmJiBpLmFwcGx5KG4sIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZVtyXSA9IGs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS50aW1lU3RhbXAgfHwgKGUudGltZVN0YW1wID0gbmV3IERhdGUoKS5nZXRUaW1lKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG4uZGVmYXVsdFByZXZlbnRlZCAhPT0gZiA/IG4uZGVmYXVsdFByZXZlbnRlZCA6ICdyZXR1cm5WYWx1ZScgaW4gbiA/ICExID09PSBuLnJldHVyblZhbHVlIDogbi5nZXRQcmV2ZW50RGVmYXVsdCAmJiBuLmdldFByZXZlbnREZWZhdWx0KCkpICYmIChlLmlzRGVmYXVsdFByZXZlbnRlZCA9IHgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSB7IG9yaWdpbmFsRXZlbnQ6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0IGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3LnRlc3QodCkgfHwgZVt0XSA9PT0gZiB8fCAoblt0XSA9IGVbdF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbChuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYsIHAgPSAxLCBtID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLCBnID0gdC5pc0Z1bmN0aW9uLCBoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdiA9IHt9LCBiID0ge30sIHkgPSAnb25mb2N1c2luJyBpbiBlLCBfID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9jdXM6ICdmb2N1c2luJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsdXI6ICdmb2N1c291dCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgQyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vdXNlZW50ZXI6ICdtb3VzZW92ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW91c2VsZWF2ZTogJ21vdXNlb3V0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuY2xpY2sgPSBiLm1vdXNlZG93biA9IGIubW91c2V1cCA9IGIubW91c2Vtb3ZlID0gJ01vdXNlRXZlbnRzJywgdC5ldmVudCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkOiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmU6IHUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3h5ID0gZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAyIGluIGFyZ3VtZW50cyAmJiBtLmNhbGwoYXJndW1lbnRzLCAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGcoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHIsIGkgPyBpLmNvbmNhdChtLmNhbGwoYXJndW1lbnRzKSkgOiBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLl96aWQgPSBuKGUpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoKHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgPyAoaS51bnNoaWZ0KGVbcl0sIGUpLCB0LnByb3h5LmFwcGx5KG51bGwsIGkpKSA6IHQucHJveHkoZVtyXSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ2V4cGVjdGVkIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5mbi5iaW5kID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMub24oZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5mbi51bmJpbmQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5vZmYoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5mbi5vbmUgPSBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5vbihlLCB0LCBuLCByLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB4ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBrID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3ID0gL14oW0EtWl18cmV0dXJuVmFsdWUkfGxheWVyW1hZXSR8d2Via2l0TW92ZW1lbnRbWFldJCkvLCBFID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJldmVudERlZmF1bHQ6ICdpc0RlZmF1bHRQcmV2ZW50ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcEltbWVkaWF0ZVByb3BhZ2F0aW9uOiAnaXNJbW1lZGlhdGVQcm9wYWdhdGlvblN0b3BwZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcFByb3BhZ2F0aW9uOiAnaXNQcm9wYWdhdGlvblN0b3BwZWQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5mbi5kZWxlZ2F0ZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm9uKHQsIGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuZm4udW5kZWxlZ2F0ZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm9mZih0LCBlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmZuLmxpdmUgPSBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdChkb2N1bWVudC5ib2R5KS5kZWxlZ2F0ZSh0aGlzLnNlbGVjdG9yLCBlLCBuKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmZuLmRpZSA9IGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KGRvY3VtZW50LmJvZHkpLnVuZGVsZWdhdGUodGhpcy5zZWxlY3RvciwgZSwgbiksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5mbi5vbiA9IGZ1bmN0aW9uIChlLCBuLCByLCBpLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvLCBzLCBsID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgIWgoZSkgPyAodC5lYWNoKGUsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLm9uKGUsIG4sIHIsIHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbCkgOiAoaChuKSB8fCBnKGkpIHx8ICExID09PSBpIHx8IChpID0gciwgciA9IG4sIG4gPSBmKSwgaSAhPT0gZiAmJiAhMSAhPT0gciB8fCAoaSA9IHIsIHIgPSBmKSwgITEgPT09IGkgJiYgKGkgPSBrKSwgbC5lYWNoKGZ1bmN0aW9uIChsLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhICYmIChvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShmLCBlLnR5cGUsIGkpLCBpLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbiAmJiAocyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIGEgPSB0KGUudGFyZ2V0KS5jbG9zZXN0KG4sIGYpLmdldCgwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSAmJiBhICE9PSBmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciA9IHQuZXh0ZW5kKGQoZSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRUYXJnZXQ6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXZlRmlyZWQ6IGYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIChvIHx8IGkpLmFwcGx5KGEsIFtyXS5jb25jYXQobS5jYWxsKGFyZ3VtZW50cywgMSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBjKGYsIGUsIGksIHIsIG4sIHMgfHwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmZuLm9mZiA9IGZ1bmN0aW9uIChlLCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgIWgoZSkgPyAodC5lYWNoKGUsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLm9mZihlLCBuLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkpIDogKGgobikgfHwgZyhyKSB8fCAhMSA9PT0gciB8fCAociA9IG4sIG4gPSBmKSwgITEgPT09IHIgJiYgKHIgPSBrKSwgaS5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUodGhpcywgZSwgciwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmZuLnRyaWdnZXIgPSBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBoKGUpIHx8IHQuaXNQbGFpbk9iamVjdChlKSA/IHQuRXZlbnQoZSkgOiBsKGUpKS5fYXJncyA9IG4sIHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnR5cGUgaW4gXyAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiB0aGlzW2UudHlwZV0gPyB0aGlzW2UudHlwZV0oKSA6ICdkaXNwYXRjaEV2ZW50JyBpbiB0aGlzID8gdGhpcy5kaXNwYXRjaEV2ZW50KGUpIDogdCh0aGlzKS50cmlnZ2VySGFuZGxlcihlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5mbi50cmlnZ2VySGFuZGxlciA9IGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uIChvLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaSA9IGQoaChlKSA/IHQuRXZlbnQoZSkgOiBlKSkuX2FyZ3MgPSBuLCBpLnRhcmdldCA9IHMsIHQuZWFjaChyKHMsIGUudHlwZSB8fCBlKSwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IHQucHJveHkoaSksIGkuaXNJbW1lZGlhdGVQcm9wYWdhdGlvblN0b3BwZWQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICdmb2N1c2luIGZvY3Vzb3V0IGZvY3VzIGJsdXIgbG9hZCByZXNpemUgc2Nyb2xsIHVubG9hZCBjbGljayBkYmxjbGljayBtb3VzZWRvd24gbW91c2V1cCBtb3VzZW1vdmUgbW91c2VvdmVyIG1vdXNlb3V0IG1vdXNlZW50ZXIgbW91c2VsZWF2ZSBjaGFuZ2Ugc2VsZWN0IGtleWRvd24ga2V5cHJlc3Mga2V5dXAgZXJyb3InLnNwbGl0KCcgJykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmZuW2VdID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwIGluIGFyZ3VtZW50cyA/IHRoaXMuYmluZChlLCB0KSA6IHRoaXMudHJpZ2dlcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5FdmVudCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgoZSkgfHwgKGUgPSAodCA9IGUpLnR5cGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KGJbZV0gfHwgJ0V2ZW50cycpLCByID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdidWJibGVzJyA9PSBpID8gciA9ICEhdFtpXSA6IG5baV0gPSB0W2ldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5pbml0RXZlbnQoZSwgciwgITApLCBsKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHQpLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29tcHV0ZWRTdHlsZSh2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBnZXRDb21wdXRlZFN0eWxlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmdldENvbXB1dGVkU3R5bGUgPSBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdChlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnplcHRvLCBuID0gdC5xc2EsIHIgPSAvXlxzKj4vLCBpID0gJ1plcHRvJyArICtuZXcgRGF0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucXNhID0gZnVuY3Rpb24gKHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8sIHMsIGMgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA/IHIudGVzdChjKSAmJiAocyA9IGUodCkuYWRkQ2xhc3MoaSksIGMgPSAnLicgKyBpICsgJyAnICsgYykgOiBjID0gJyonLCBvID0gbih0LCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgJiYgcy5yZW1vdmVDbGFzcyhpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0KSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh3aW5kb3cpLCBxbSA9IHdpbmRvdy5NdXRhdGlvbk9ic2VydmVyIHx8IHdpbmRvdy5XZWJraXRNdXRhdGlvbk9ic2VydmVyLCBIbSA9ICdFeHBlY3RlZCBhbiBhcnJheSBvZiBwcm9taXNlcyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmwuX3NldEltbWVkaWF0ZUZuICYmIEZlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFdtID0gVSgpLCBHbSA9IC8uKlwuKFxkKylfXGQrLzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1dCh3aW5kb3csIGRvY3VtZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgWW0gPSAnYXQtbGlicmFyeS1sb2FkZWQnLCBYbSA9ICdhdC1yZXF1ZXN0LXN0YXJ0JywgS20gPSAnYXQtcmVxdWVzdC1zdWNjZWVkZWQnLCBRbSA9ICdhdC1yZXF1ZXN0LWZhaWxlZCcsICRtID0gJ2F0LWNvbnRlbnQtcmVuZGVyaW5nLXN0YXJ0JywgSm0gPSAnYXQtY29udGVudC1yZW5kZXJpbmctc3VjY2VlZGVkJywgWm0gPSAnYXQtY29udGVudC1yZW5kZXJpbmctZmFpbGVkJywgZWcgPSAnYXQtY29udGVudC1yZW5kZXJpbmctbm8tb2ZmZXJzJywgdGcgPSAnYXQtY29udGVudC1yZW5kZXJpbmctcmVkaXJlY3QnLCBuZyA9ICc6ZXEoJywgcmcgPSAnKScsIGlnID0gbmcubGVuZ3RoLCBhZyA9IC8oKFwufCMpKC0pP1xkezF9KS9nLCBvZyA9ICdVbmFibGUgdG8gbG9hZCB0YXJnZXQtdmVjLmpzJywgc2cgPSAnTG9hZGluZyB0YXJnZXQtdmVjLmpzJywgY2cgPSAnX0FUJywgdWcgPSAnY2xpY2tIYW5kbGVyRm9yRXhwZXJpZW5jZUVkaXRvcicsIGxnID0gJ2N1cnJlbnRWaWV3JywgZGcgPSAnYXRfcWFfbW9kZScsIGZnID0gJ2F0X3ByZXZpZXdfdG9rZW4nLCBwZyA9ICdhdF9wcmV2aWV3X2luZGV4JywgbWcgPSAnYXRfcHJldmlld19saXN0ZWRfYWN0aXZpdGllc19vbmx5JywgZ2cgPSAnYXRfcHJldmlld19ldmFsdWF0ZV9hc190cnVlX2F1ZGllbmNlX2lkcycsIGhnID0gJ2F0X3ByZXZpZXdfZXZhbHVhdGVfYXNfZmFsc2VfYXVkaWVuY2VfaWRzJywgdmcgPSAnXycsIGJnID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeWcgPSAnYXRfcHJldmlld19tb2RlJywgX2cgPSAnYXRfcHJldmlldycsIENnID0gJ2F0LScsIHhnID0gJ2F0LWJvZHktc3R5bGUnLCBrZyA9ICcjJyArIHhnLCB3ZyA9IENnICsgJ3ZpZXdzJywgRWcgPSAnRGlzYWJsZWQgZHVlIHRvIG9wdG91dCcsIElnID0gJ01DQUFNQicsIERnID0gJ01DQUFNTEgnLCBBZyA9ICdNQ01JRCcsIFNnID0gJ01DT1BUT1VUJywgVGcgPSAnZ2V0U3VwcGxlbWVudGFsRGF0YUlEJywgUGcgPSAnZ2V0Q3VzdG9tZXJJRHMnLCBPZyA9ICEwLCBqZyA9ICdOUycsIExnID0gJ0RTJywgTWcgPSAndHJhY2tpbmdTZXJ2ZXInLCBWZyA9IE1nICsgJ1NlY3VyZScsIFJnID0gJ1Zpc2l0b3InLCBOZyA9ICdnZXRJbnN0YW5jZScsIEZnID0gJ2lzQWxsb3dlZCcsIEJnID0gJ1Zpc2l0b3IgQVBJIHJlcXVlc3RzIHRpbWVkIG91dCcsIFVnID0gJ1Zpc2l0b3IgQVBJIHJlcXVlc3RzIGVycm9yJywgemcgPSB7fSwgcWcgPSAnRGF0YSBwcm92aWRlcicsIEhnID0gJ3RpbWVkIG91dCcsIFdnID0gMjAwMCwgR2cgPSAnYXV0aG9yaXphdGlvbicsIFlnID0gJ21ib3hEZWJ1Z1Rvb2xzJywgWGcgPSBwcigpLCBLZyA9ICdwcm9maWxlLicsIFFnID0gJ21ib3gzcmRQYXJ0eUlkJywgJGcgPSAnYXRfcHJvcGVydHknLCBKZyA9ICdvcmRlcklkJywgWmcgPSAnb3JkZXJUb3RhbCcsIGVoID0gJ3Byb2R1Y3RQdXJjaGFzZWRJZCcsIHRoID0gJ3Byb2R1Y3RJZCcsIG5oID0gJ2NhdGVnb3J5SWQnLCByaCA9ICdQT1NUJywgaWggPSAnTmV0d29yayByZXF1ZXN0IGZhaWxlZCcsIGFoID0gJ1JlcXVlc3QgdGltZWQgb3V0Jywgb2ggPSAnTWFsZm9ybWVkIHJlc3BvbnNlIEpTT04nLCBzaCA9ICdtYm94ZWRnZScsIGNoID0gJy50dC5vbXRyZGMubmV0JywgdWggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFBKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBsaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGRoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZoID0gZGgoaSksIHBoID0gZGgoVCksIG1oID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZ2ggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RhdHVzID09PSBNZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaGggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudHlwZSA9PT0gWWY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHZoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnR5cGUgPT09IHhkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBiaCA9IG1oKGZoKSwgeWggPSBtaChwaCksIF9oID0gbGgoUXApLCBDaCA9IGxoKGVkKSwgeGggPSBsaChKcCksIGtoID0gbGgoWGYpLCB3aCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWwoZS5uYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRWggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFpKGUuaW5kZXgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBJaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShlKSAmJiB3aChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRGggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoZSkgJiYgd2goZSkgJiYgRWgoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEFoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1KGUpICYmIHdoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBTaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWwoZS5zZWxlY3Rvcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFRoID0gbGgoS2YpLCBQaCA9IHYoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgT2ggPSAnYWRvYmVfbWNfc2RpZCcsIGpoID0gJ05ldHdvcmsgcmVxdWVzdCBmYWlsZWQnLCBMaCA9ICdSZXF1ZXN0IHRpbWVkIG91dCcsIE1oID0gJ1VSTCBpcyByZXF1aXJlZCcsIFZoID0gJ0dFVCcsIFJoID0gJ1BPU1QnLCBOaCA9ICdtZXRob2QnLCBGaCA9ICd1cmwnLCBCaCA9ICdoZWFkZXJzJywgVWggPSAnZGF0YScsIHpoID0gJ2NyZWRlbnRpYWxzJywgcWggPSAndGltZW91dCcsIEhoID0gJ2FzeW5jJywgV2ggPSAvQ0xLVFJLIyhcUyspLywgR2ggPSAvQ0xLVFJLIyhcUyspXHMvLCBZaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFhoID0gJ3Zpc2liaWxpdHlTdGF0ZScsIEtoID0gJ3Zpc2libGUnLCBRaCA9IDEwMCwgJGggPSBLZCArICcsJyArICRkICsgJywnICsgUWQsIEpoID0gJ2F0LWFjdGlvbi1rZXknLCBaaCA9ICdtZXRyaWMgZWxlbWVudCBub3QgZm91bmQnLCBldiA9ICduYXZpZ2F0b3InLCB0diA9ICdzZW5kQmVhY29uJywgbnYgPSAnQmVhY29uIGRhdGEgc2VudCcsIHJ2ID0gJ0JlYWNvbiBkYXRhIHNlbnQgZmFpbGVkJywgaXYgPSAnVmlldyB0cmlnZ2VyZWQgbm90aWZpY2F0aW9uJywgYXYgPSAnVmlldyByZW5kZXJlZCBub3RpZmljYXRpb24nLCBvdiA9ICdNYm94ZXMgcmVuZGVyZWQgbm90aWZpY2F0aW9uJywgc3YgPSAnRXZlbnQgaGFuZGxlciBub3RpZmljYXRpb24nLCBjdiA9ICdNYm94IGV2ZW50IGhhbmRsZXIgbm90aWZpY2F0aW9uJywgdXYgPSAnVmlldyBldmVudCBoYW5kbGVyIG5vdGlmaWNhdGlvbicsIGx2ID0gJ3ByZWZldGNoTWJveGVzJywgZHYgPSAncmVuZGVyZWQnLCBmdiA9ICd0cmlnZ2VyZWQnLCBwdiA9IHt9LCBtdiA9ICdwYWdlTG9hZE1ldHJpY3MnLCBndiA9ICdwcmVmZXRjaE1ldHJpY3MnLCBodiA9IGxoKCRwKSwgdnYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ga2koVWYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBidiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2koVWYsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5diA9IGxoKGVkKSwgX3YgPSBsaCh1ZCksIEN2ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBraShCZiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHh2ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aShCZiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGt2ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkaChnaCkoZSkgJiYgUGgoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2MucHJvdG90eXBlID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdGhpcy5lIHx8ICh0aGlzLmUgPSB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHJbZV0gfHwgKHJbZV0gPSBbXSkpLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN0eDogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uY2U6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkub2ZmKGUsIHIpLCB0LmFwcGx5KG4sIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5fID0gdCwgdGhpcy5vbihlLCByLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW1pdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBbXS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMSksIG4gPSAoKHRoaXMuZSB8fCAodGhpcy5lID0ge30pKVtlXSB8fCBbXSkuc2xpY2UoKSwgciA9IDAsIGkgPSBuLmxlbmd0aDsgciA8IGk7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3JdLmZuLmFwcGx5KG5bcl0uY3R4LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZmY6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuZSB8fCAodGhpcy5lID0ge30pLCByID0gbltlXSwgaSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgJiYgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gMCwgbyA9IHIubGVuZ3RoOyBhIDwgbzsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByW2FdLmZuICE9PSB0ICYmIHJbYV0uZm4uXyAhPT0gdCAmJiBpLnB1c2goclthXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5sZW5ndGggPyBuW2VdID0gaSA6IGRlbGV0ZSBuW2VdLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgd3YgPSBnYywgRXYgPSBnYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3di5UaW55RW1pdHRlciA9IEV2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBJdiA9IGhjKCksIER2ID0gJ1BhZ2UgbG9hZCByZW5kZXJpbmcgZmFpbGVkJywgQXYgPSAnTWJveGVzIHJlbmRlcmluZyBmYWlsZWQnLCBTdiA9ICdWaWV3IHJlbmRlcmluZyBmYWlsZWQnLCBUdiA9ICdQcmVmZXRjaCByZW5kZXJpbmcgZmFpbGVkJywgUHYgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFBKG0oZ2gsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgT3YgPSAnW3BhZ2UtaW5pdF0nLCBqdiA9ICdbZ2V0T2ZmZXIoKV0nLCBMdiA9ICdbZ2V0T2ZmZXJzKCldJywgTXYgPSAnW2FwcGx5T2ZmZXIoKV0nLCBWdiA9ICdbYXBwbHlPZmZlcnMoKV0nLCBSdiA9ICdbc2VuZE5vdGlmaWNhdGlvbnMoKV0nLCBOdiA9ICdbdHJhY2tFdmVudCgpXScsIEZ2ID0gJ1t0cmlnZ2VyVmlldygpXScsIEJ2ID0gW10sIFV2ID0gMCwgenYgPSAxLCBxdiA9IFV2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEh2ID0gJ2Z1bmN0aW9uIGhhcyBiZWVuIGRlcHJlY2F0ZWQuIFBsZWFzZSB1c2UgZ2V0T2ZmZXIoKSBhbmQgYXBwbHlPZmZlcigpIGZ1bmN0aW9ucyBpbnN0ZWFkLicsIFd2ID0gJ2Fkb2JlLnRhcmdldC5yZWdpc3RlckV4dGVuc2lvbigpIGZ1bmN0aW9uIGhhcyBiZWVuIGRlcHJlY2F0ZWQuIFBsZWFzZSByZXZpZXcgdGhlIGRvY3VtZW50YXRpb24gZm9yIGFsdGVybmF0aXZlcy4nLCBHdiA9ICdtYm94Q3JlYXRlKCkgJyArIEh2LCBZdiA9ICdtYm94RGVmaW5lKCkgJyArIEh2LCBYdiA9ICdtYm94VXBkYXRlKCkgJyArIEh2LCBLdiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXQ6IG1sLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5pdENvbmZpZzogSiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXREZWxpdmVyeTogZnUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBLdjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLXRhcmdldC12Mi9saWIvbWVzc2FnZXMuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxSRUFEWV9JTklUSUFMSVpFRDogJ0FUOiBBZG9iZSBUYXJnZXQgaGFzIGFscmVhZHkgYmVlbiBpbml0aWFsaXplZC4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBERUxJVkVSWV9ESVNBQkxFRDogJ0FUOiBBZG9iZSBUYXJnZXQgY29udGVudCBkZWxpdmVyeSBpcyBkaXNhYmxlZC4gVXBkYXRlIHlvdXIgRE9DVFlQRSB0byBzdXBwb3J0IFN0YW5kYXJkcyBtb2RlLicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5PX1JFUVVFU1Q6ICdBVDogVGFyZ2V0IGxpYnJhcnkgaXMgZWl0aGVyIG5vdCBsb2FkZWQgb3IgZGlzYWJsZWQsIG5vIHJlcXVlc3Qgd2lsbCBiZSBleGVjdXRlZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtdGFyZ2V0LXYyL2xpYi9tb2R1bGVzL3BhcmFtcy1zdG9yZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IGUgJiYgbnVsbCAhPSBlICYmIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLCAndmFsdWUnKSAmJiBudWxsICE9IGUuY2hlY2tlZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGVbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocihpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gaS5jaGVja2VkLCBvID0gaS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhICYmICcnID09PSBvIHx8ICh0W25dID0gbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W25dID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUobCwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUoZCwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBuKCcuL29iamVjdC1vdmVycmlkZScpLCBsID0ge30sIGQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lcmdlUGFyYW1zOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXJnZVBhZ2VMb2FkUGFyYW1zOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRQYXJhbXM6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFBhZ2VMb2FkUGFyYW1zOiBjCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLXRhcmdldC12Mi9saWIvdGFyZ2V0U2V0dGluZ3MuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gci5nZXRFeHRlbnNpb25TZXR0aW5ncygpLCBhID0gaS50YXJnZXRTZXR0aW5ncyB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dGVuc2lvblNldHRpbmdzOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXRTZXR0aW5nczogYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS10YXJnZXQtdjIvbGliL21vZHVsZXMvb2JqZWN0LW92ZXJyaWRlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtuXSAhPT0gciAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFBcnJheS5pc0FycmF5KHRoaXMuc3Vic2V0KSB8fCAtMSAhPT0gdGhpcy5zdWJzZXQuaW5kZXhPZihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHIsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMocikuZmlsdGVyKG4sIHsgc3Vic2V0OiBpIH0pLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoZSwgciwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS10YXJnZXQtdjIvbGliL2xpYnJhcnlTZXR0aW5ncy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7IHZlcnNpb246ICcyLjYuMScgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7IFRBUkdFVF9ERUZBVUxUX1NFVFRJTkdTOiB0IH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS10YXJnZXQtdjIvbGliL21vZHVsZXMvZXZlbnQtdXRpbC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuYWRkRXZlbnRMaXN0ZW5lcih0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucmVtb3ZlRXZlbnRMaXN0ZW5lcih0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGRFdmVudExpc3RlbmVyOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVFdmVudExpc3RlbmVyOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLXRhcmdldC12Mi9saWIvbW9kdWxlcy9wYWdlLWxvYWQuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbignLi4vbGlicmFyeVNldHRpbmdzJyksIGkgPSBuKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgYSA9IG4oJy4vb2JqZWN0LW92ZXJyaWRlJyksIG8gPSBuKCcuL3BhcmFtcy1zdG9yZScpLCBzID0gby5nZXRQYXJhbXMsIGMgPSBvLmdldFBhZ2VMb2FkUGFyYW1zLCB1ID0gbignLi4vdGFyZ2V0U2V0dGluZ3MnKS50YXJnZXRTZXR0aW5nczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdS5tYm94UGFyYW1zID0gcygpLCB1Lmdsb2JhbE1ib3hQYXJhbXMgPSBjKCksIGEodSwgZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JvZHlIaWRpbmdFbmFibGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdib2R5SGlkZGVuU3R5bGUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBhKHUsIGkudGFyZ2V0R2xvYmFsU2V0dGluZ3MgfHwge30sIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbmFibGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdib2R5SGlkaW5nRW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYm9keUhpZGRlblN0eWxlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgYSh1LCByLlRBUkdFVF9ERUZBVUxUX1NFVFRJTkdTIHx8IHt9LCBbJ3ZlcnNpb24nXSksIHU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBjb250ZW50c3F1YXJlOiB7CiAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdDb250ZW50U3F1YXJlJywKICAgICAgICAgICAgICAgICAgICBob3N0ZWRMaWJGaWxlc0Jhc2VVcmw6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vZXh0ZW5zaW9ucy9FUGFiYzQwMjY5MDgyZjQzNDhiYThmYWYyYzY2Yzc5OTdjLycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgY3ZhcnM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBwcm9qZWN0X2lkOiAnJXRhZ0lEOmNvbnRlbnRTcXVhcmUlJwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlczogewogICAgICAgICAgICAgICAgICAgICAgICAnY29udGVudHNxdWFyZS9zcmMvbGliL2FjdGlvbnMvdXhhSW5zdGFsbGF0aW9uLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3V4YS1pbnN0YWxsYXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdNYWluIFRyYWNraW5nIFRhZyBpbnN0YWxsYXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgaSA9IHIuZ2V0RXh0ZW5zaW9uU2V0dGluZ3MoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycgIT09IGUuc2V0UGF0aElucHV0ID8gKHQgPSBlLnNldFBhdGhJbnB1dCwgdCArPSB3aW5kb3cubG9jYXRpb24uaGFzaC5yZXBsYWNlKCcjJywgJz9fXycpKSA6IHQgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWUgKyB3aW5kb3cubG9jYXRpb24uaGFzaC5yZXBsYWNlKCcjJywgJz9fXycpLCBuID0gJycgIT09IGUuc2V0UXVlcnlJbnB1dCA/IGUuc2V0UXVlcnlJbnB1dCA6IHdpbmRvdy5sb2NhdGlvbi5zZWFyY2gsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5fdXhhID0gd2luZG93Ll91eGEgfHwgW10sIHdpbmRvdy5fdXhhLnB1c2goWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZXRQYXRoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgd2luZG93Ll91eGEucHVzaChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NldFF1ZXJ5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkuY3ZhcnMubGVuZ3RoID4gMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IDE7IGUgPCBpLmN2YXJzLmxlbmd0aDsgZSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93Ll91eGEucHVzaChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NldEN1c3RvbVZhcmlhYmxlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuY3ZhcnNbZV0ua2V5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuY3ZhcnNbZV0udmFsdWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIENTX0NPTkYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIudHlwZSA9ICd0ZXh0L2phdmFzY3JpcHQnLCByLmFzeW5jID0gITAsIHIuc3JjID0gJy8vdC5jb250ZW50c3F1YXJlLm5ldC91eGEvJyArIGkucHJvamVjdF9pZCArICcuanMnLCBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnaGVhZCcpWzBdLmFwcGVuZENoaWxkKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93Ll91eGEucHVzaChbJ3RyYWNrUGFnZXZpZXcnXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICBjb21wYW55OiB7IG9yZ0lkOiAnMUUyMjE3MUI1MjBFOTNCRjBBNDkwRDQ0QEFkb2JlT3JnJyB9LAogICAgICAgICAgICBwcm9wZXJ0eTogewogICAgICAgICAgICAgICAgbmFtZTogJ0ZlZEV4JywKICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWydmZWRleC5jb20nXSwKICAgICAgICAgICAgICAgICAgICB1bmRlZmluZWRWYXJzUmV0dXJuRW1wdHk6ICExLAogICAgICAgICAgICAgICAgICAgIHJ1bGVDb21wb25lbnRTZXF1ZW5jaW5nRW5hYmxlZDogITEKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBpZDogJ1BSOGRiZDRhNjU2ZmRhNDA0M2FlMjdhZWQ3ZGRjMTcwN2UnCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIHJ1bGVzOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGZhYjQ3MWE2ZTRhZjRlMmZiNmM5MTFkM2YwNDg4NjM2JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZ1RhZzpHbG9iYWwnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2xpYnJhcnlMb2FkZWQuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIF9mZHggJiYgX3NhdGVsbGl0ZS5nZXRWYXIoJ19mZHhVdGlsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gX2ZkeC5wY2ZVdGlsKCkubWF0Y2goL3d3dyhzYm94LmlkZXZ8YmFzZS5pZGV2fGRldi5pZGV2fGRydC5pZGV2fHN0cmVzcy5kbXouaWRldnxiaXQuaWRldnx0ZXN0fCkuZmVkZXguY29tL2dpKSwgdCA9ICcnID09IF9zYXRlbGxpdGUuZ2V0VmFyKCdnVGFnRGlzYWJsZUxvY2FsZScpLCBuID0gd2luZG93LmxvY2F0aW9uLnBhdGhuYW1lLCByID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6REZBUGFnZUxpc3RNYXBwaW5nJykuaW5kZXhPZihuKSA+PSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIShudWxsID09PSBlIHx8ICFyICYmICF0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJzwhLS0gTG9naWMgdG8gZmV0Y2ggR1RBRyBHbG9iYWwgREMgJiBBVyBJRCAtLT5cbjwhLS0gXG4vL1N0YXJ0IG9mIGdsb2JhbCBzbmlwcGV0OiBQbGVhc2UgZG8gbm90IHJlbW92ZVxuLy9QbGFjZSB0aGlzIHNuaXBwZXQgYmV0d2VlbiB0aGUgPGhlYWQ+IGFuZCA8L2hlYWQ+IHRhZ3Mgb24gZXZlcnkgcGFnZSBvZiB5b3VyIHNpdGUuXG4tLT5cbjwhLS0gR2xvYmFsIHNpdGUgdGFnIChndGFnLmpzKSAtIERvdWJsZUNsaWNrIC0tPlxuPHNjcmlwdD5cbnZhciBjb25maWdEQ0lEID0gIiI7XG52YXIgY29uZmlnQVdJRCA9ICIiO1xudmFyIG9iakNvbmZpZyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCJnVGFnOkNvbmZpZ0xvZ2ljIik7XG52YXIgY291bnRyeUNvZGUgPSBfc2F0ZWxsaXRlLmdldFZhcigiY29udGVudDpjb3VudHJ5Q29kZSIpO1xuaWYgKHR5cGVvZiBvYmpDb25maWcgIT09ICJ1bmRlZmluZWQiICYmIG9iakNvbmZpZyAhPT0gIiIpIHtcblx0Y29uZmlnRENJRCA9IG9iakNvbmZpZ1siRENDb25maWdJRCJdO1xuXHRjb25maWdBV0lEID0gb2JqQ29uZmlnWyJBV0NvbmZpZ0lEIl07XG59XG4vL0dsb2JhbCBzaXRlIHRhZyAoZ3RhZy5qcykgXG5pZiAodHlwZW9mIGd0YWcgPT0gXCd1bmRlZmluZWRcJyl7XG5cdHZhciBzYyA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoInNjcmlwdCIpO1xuXHRpZigoX3NhdGVsbGl0ZS5nZXRWYXIoImdUYWc6RW5hYmxlZExvY2FsZUVwaWMiKSkgIT09ICIiKSB7XG5cdFx0c2Muc2V0QXR0cmlidXRlKCJzcmMiLCAiaHR0cHM6Ly93d3cuZ29vZ2xldGFnbWFuYWdlci5jb20vZ3RhZy9qcz9pZD1EQy0xOTgyNTc0Iilcblx0fVxuXG5cdGVsc2V7XG5cdFx0aWYoY29uZmlnRENJRCAhPT0gIiIpe1xuXHRcdFx0c2Muc2V0QXR0cmlidXRlKCJzcmMiLCAiaHR0cHM6Ly93d3cuZ29vZ2xldGFnbWFuYWdlci5jb20vZ3RhZy9qcz9pZD0iICsgY29uZmlnRENJRClcbiAgICAgICAgfVxuXHRcdGVsc2UgaWYoY29uZmlnQVdJRCAhPT0gIiIpe1xuXHRcdFx0c2Muc2V0QXR0cmlidXRlKCJzcmMiLCAiaHR0cHM6Ly93d3cuZ29vZ2xldGFnbWFuYWdlci5jb20vZ3RhZy9qcz9pZD0iICsgY29uZmlnQVdJRClcblx0XHR9XG5cdH1cblx0c2Muc2V0QXR0cmlidXRlKCJ0eXBlIiwgInRleHQvamF2YXNjcmlwdCIpO1xuXHRzYy5zZXRBdHRyaWJ1dGUoXCdhc3luY1wnLCB0cnVlKTtcblx0ZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChzYyk7XG4gIFxuICAvL3NlY29uZCBndGFnIGFkZGVkIGZvciBDYW5hZGFcbiAgaWYoY29uZmlnQVdJRCAhPT0gIiIgJiYgY291bnRyeUNvZGUgPT09ICJjYSIpe1xuICAgIHZhciBzYzIgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJzY3JpcHQiKTtcbiAgICBzYzIuc2V0QXR0cmlidXRlKCJzcmMiLCAiaHR0cHM6Ly93d3cuZ29vZ2xldGFnbWFuYWdlci5jb20vZ3RhZy9qcz9pZD0iICsgY29uZmlnQVdJRClcbiAgICBzYzIuc2V0QXR0cmlidXRlKCJ0eXBlIiwgInRleHQvamF2YXNjcmlwdCIpO1xuXHRzYzIuc2V0QXR0cmlidXRlKFwnYXN5bmNcJywgdHJ1ZSk7XG5cdGRvY3VtZW50LmhlYWQuYXBwZW5kQ2hpbGQoc2MyKTtcbiAgfVxuICBcblx0d2luZG93LmRhdGFMYXllciA9IHdpbmRvdy5kYXRhTGF5ZXIgfHwgW107XG5cdGZ1bmN0aW9uIGd0YWcoKSB7XG5cdFx0ZGF0YUxheWVyLnB1c2goYXJndW1lbnRzKTtcblx0fVxuXHRndGFnKFwnanNcJywgbmV3IERhdGUoKSk7XG59XG5lbHNle1xuXHRpZigoX3NhdGVsbGl0ZS5nZXRWYXIoImdUYWc6RW5hYmxlZExvY2FsZUVwaWMiKSkgIT09ICIiKXtcblx0Z3RhZyhcJ2NvbmZpZ1wnLCBcJ0RDLTE5ODI1NzRcJyk7XHRcbn1cblx0ZWxzZXtcblxuXHRcdGlmIChjb25maWdEQ0lEICE9PSAiIikge1xuXHRcdFx0Z3RhZyhcJ2NvbmZpZ1wnLCBjb25maWdEQ0lELCB7XG5cdFx0XHRcdFwncGFnZV9sb2NhdGlvblwnIDogd2luZG93LmxvY2F0aW9uLmhyZWYucmVwbGFjZSgvZW1haWw9W14mO10qL2dpLFxuXHRcdFx0XHRcJ2VtYWlsPXJlZGFjdGVkXCcpXG5cdFx0XHR9KTtcblx0XHR9XG5cdFx0ZWxzZSBpZiAoY29uZmlnQVdJRCAhPT0gIiIpIHtcblx0XHRcdGd0YWcoXCdjb25maWdcJywgY29uZmlnQVdJRCwge1xuXHRcdFx0XHRcJ3BhZ2VfbG9jYXRpb25cJyA6IHdpbmRvdy5sb2NhdGlvbi5ocmVmLnJlcGxhY2UoL2VtYWlsPVteJjtdKi9naSxcblx0XHRcdFx0XCdlbWFpbD1yZWRhY3RlZFwnKVxuXHRcdFx0fSk7XG5cdFx0fVxuXG5cdH1cbn1cblxuXG5cbjwvc2NyaXB0PlxuPCEtLSBFbmQgb2YgZ2xvYmFsIHNuaXBwZXQ6IFBsZWFzZSBkbyBub3QgcmVtb3ZlIC0tPlxuXG4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDU2ODBhNWFiNmNjODRkNDE4NzdjOGRlZWJlZWNjOGNlJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnYWRUYWc6dHJhZGVkZXNrJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9saWJyYXJ5TG9hZGVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ3RyYWRlZGVzazpwYWdlTGlzdE1hcHBpbmcnKSwgdCA9IHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpLCBfc2F0ZWxsaXRlLnNldFZhcigndHJhZGVkZXNrVVJMJywgX2ZkeC5wYWdlRmxhZyhlLCB0KSksICExICE9PSBfc2F0ZWxsaXRlLmdldFZhcigndHJhZGVkZXNrVVJMJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICc8aW1nIGhlaWdodD0iMSIgd2lkdGg9IjEiIHN0eWxlPSJib3JkZXItc3R5bGU6bm9uZTsiIGFsdD0iIiBzcmM9JXRyYWRlZGVza1VSTCUgLz4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDMwMzIyNzUxMTFiNDQ1NjZhZDk4NTY2ODFlMjdhZWYzJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnTUFHSUMgUE9DJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jdXN0b21FdmVudC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdldmVudC12aWV3LXN0YXJ0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICdib2R5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzY4NmI4ZjBjNDUyMC80Y2U0MDFjNTFiNTEvNjgwNzZhY2JhMmNjL1JDOGM2OWQxOGFlZGRlNDU4ODlhNmUwNWFlNGJkZGE0Y2Ytc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYzgyN2JmYmQ2NThlNDAzZTlhNGEwYWRlYTVhNDU3ZWUnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdzcDpkaXJlY3RIaXRzJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9wYXRoQW5kUXVlcnlzdHJpbmcuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnc2VhcmNoPXRydWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IFVSTFNlYXJjaFBhcmFtcygpLmdldCgnc3B0ZXJtJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IG4gJiYgJycgIT0gbiAmJiBudWxsICE9PSBuID8gKG4gPSBuLnJlcGxhY2UoL1w7LiovLCAnJyksIHQucHJvcDEgPSB0LmVWYXIxID0gbiwgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9IHQuYXBsKHQuZXZlbnRzLCAnZXZlbnQxMTgnLCAnLCcsIDIpKSA6IHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSB0LmFwbCh0LmV2ZW50cywgJ2V2ZW50MTE5JywgJywnLCAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGI4ZDcwZjZjYmE1MjQzZThiNTUzYTJkZjczZTFiZmZkJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZ1RhZzpUYXJnZXRWaWRlb0V4cGVyaWVuY2UnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnLnZqcy1iaWctcGxheS1idXR0b24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL3BhdGguanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnL2VuLXVzL2Vjb21tZXJjZS8oc2hpcHBpbmctb3B0aW9ucy5odG1sfHRvb2xzLWFuZC1zZXJ2aWNlcy5odG1sKScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6VGFyZ2V0VmlkZW9NYXBwaW5nJyksIHQgPSB0aGlzLnBhcmVudEVsZW1lbnQuZ2V0QXR0cmlidXRlKCdkYXRhLXZpZGVvLWlkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9mZHgucGFnZUZsYWcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcigndGFyZ2V0VmlkZW9HdGFnTGFiZWwnLCBuKSwgITEgIT09IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vNjg2YjhmMGM0NTIwLzRjZTQwMWM1MWI1MS82ODA3NmFjYmEyY2MvUkM5MjBiYzFhM2FlYzg0Nzk3OTBmMjFmNzU2NWZlOGE5OC1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXh0ZXJuYWw6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw5ZDVkYjNhNmJlMGY0ZTdiYjYzM2QzN2VmN2I3ZjM2MycsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ0Fkb2JlVGFyZ2V0OmJlYWNvblYyJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9saWJyYXJ5TG9hZGVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogMQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBGRFguREFUQUxBWUVSLnBhZ2UuY2F0ZWdvcnksIHQgPSBfc2F0ZWxsaXRlLmdldFZhcigndGFyZ2V0ZW5hYmxlZFVybExpc3QnKSwgbiA9IC8uW2Etel17Mn0tW2Etel17Mn0oLiopLy5leGVjKHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBuICYmIChuID0gblsxXSksICdmYWxzZScgPT0gZS5pc0FwcGxpY2F0aW9uICYmICdzaGFyZWRuYXYnICE9PSBGRFguREFUQUxBWUVSLnBhZ2UuY2F0ZWdvcnkucGFnZVR5cGUgfHwgJ3RydWUnID09IGUuaXNBcHBsaWNhdGlvbiAmJiBudWxsICE9PSBuICYmIHZvaWQgMCAhPT0gdCAmJiAnJyAhPT0gdCAmJiB0Lmxlbmd0aCA+IDAgJiYgdC50b1N0cmluZygpLnRvTG93ZXJDYXNlKCkuaW5kZXhPZihuLnRvTG93ZXJDYXNlKCkpID4gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS10YXJnZXQtdjIvbGliL2xvYWRUYXJnZXQuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS10YXJnZXQtdjIvbGliL2FkZFBhZ2VMb2FkUGFyYW1zLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0X3Byb3BlcnR5OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVUYXJnZXQ6YXRfcHJvcGVydHklJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoZWNrZWQ6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZ2dlZGluU3RhdHVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVsb2dpbjpzdGF0dXMlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoZWNrZWQ6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS10YXJnZXQtdjIvbGliL2ZpcmVQYWdlTG9hZC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHlIaWRkZW5TdHlsZTogJ2JvZHkge29wYWNpdHk6IDB9JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5SGlkaW5nRW5hYmxlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGRiMWUzOTVjOTU2NzRmZjdhY2EyNjYxNjIxOWUwYWY3JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnQWRvYmVUYXJnZXQ6Q2F0ZWdvcnkgQWZmaW5pdHknLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL3BhdGhBbmRRdWVyeXN0cmluZy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGhzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnL2VuLXVzL3NoaXBwaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICcvZW4tdXMvdHJhY2tpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJy9lbi11cy9wcmludGluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnL2VuLXVzL2N1c3RvbWVyLXN1cHBvcnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJy9lbi11cy9lY29tbWVyY2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJy9lbi11cy9zbWFsbC1idXNpbmVzcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2Fkb2JlLnRhcmdldC50cmFja0V2ZW50KHtcbiAgIm1ib3giOiAiY2F0ZWdvcnktYWZmaW5pdHkiLFxuICAicGFyYW1zIjoge1xuICAgICAidXNlci5jYXRlZ29yeUlkIjogX3NhdGVsbGl0ZS5nZXRWYXIoImNvbnRlbnQ6cGFnZVBhdGgiKVxuICB9XG59KTtcbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYWNjMmE4NTBiN2RiNGNlYThmZjgwNzA1OTliMTgwMjMnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICd2aWRlbzo1MCUgVmlld2VkJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9tZWRpYVRpbWVQbGF5ZWQuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bml0OiAncGVyY2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW1vdW50OiA1MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcuYnJpZ2h0Y292ZS1jb250YWluZXIgdmlkZW8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gdGhpcy5wYXJlbnRFbGVtZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IHRoaXMucGFyZW50RWxlbWVudC5nZXRBdHRyaWJ1dGUoJ2lkJyksIHIgPSB0aGlzLnBhcmVudEVsZW1lbnQuZ2V0QXR0cmlidXRlKCdkYXRhLXZpZGVvLWlkJyksIGkgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lKCdicmlnaHRjb3ZlLWNvbnRhaW5lcicpLCBhID0gMDsgYSA8IGkubGVuZ3RoOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID09IGlbYV0uZ2V0QXR0cmlidXRlKCdkYXRhLXBsYXllcmlkJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeUNsYXNzTmFtZSgndmpzLWRvY2stdGl0bGUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZVZhcjQyID0gb1thXS5pbm5lclRleHQsIHQuZVZhcjMxID0gciwgdC5saW5rVHJhY2tWYXJzID0gdC5hcGwodC5saW5rVHJhY2tWYXJzLCAnZVZhcjQyLGVWYXIzMScsICcsJywgMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MjA1JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdWaWRlbzo1MCUgVmlld2VkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwwNjNkNWFhMDg1NmE0ZWZlYmI3OTMxOTBjNDFiZTcxNCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2V2ZW50OmN1YmUgY2xpY2snLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnZGl2IC5meGctY3ViZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFByb3BlcnRpZXM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZGF0YS1hbmFseXRpY3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdoZXJvLionLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHZvaWQgMCAhPT0gdGhpcy5nZXRBdHRyaWJ1dGUoJ2RhdGEtYW5hbHl0aWNzJykgPyB0aGlzLmdldEF0dHJpYnV0ZSgnZGF0YS1hbmFseXRpY3MnKSA6ICcnLCByID0gKHQgPSB2b2lkIDAgIT09IHRoaXMuZ2V0QXR0cmlidXRlKCdkYXRhLWxpbmstdGFyZ2V0JykgPyAnbmV3UGFnZScgOiAnc2FtZVBhZ2UnLCB7IGhlcm86ICdldmVudDIwMCcgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbiB8fCBuLmluZGV4T2YoJ1RSQUNLJykgPiAtMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGRFguREFUQUxBWUVSLnBhZ2UubGluay5kYXRhID0gJycsIEZEWC5EQVRBTEFZRVIucGFnZS5saW5rLnR5cGUgPSAnJywgd2luZG93Lm5sdHJrID0gJ3knLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCduZXdQYWdlJyA9PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEZEWC5EQVRBTEFZRVIucGFnZS5saW5rLmRhdGEgPSAnJywgRkRYLkRBVEFMQVlFUi5wYWdlLmxpbmsudHlwZSA9ICcnLCBmZHhfc2V0TGlua1ZpZXcobiksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3NhbWVQYWdlJyA9PSB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHJbbi5zcGxpdCgnfCcpWzBdLnRvTG93ZXJDYXNlKCldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEZEWC5EQVRBTEFZRVIucGFnZS5saW5rLmRhdGEgPSAnJywgRkRYLkRBVEFMQVlFUi5wYWdlLmxpbmsudHlwZSA9ICcnLCBmZHhfbG9nTGlua1ZpZXcobiwgaSksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZTFlOWMyNWRkOTE5NDNiZmJiYmJiOTNlMzg2NjJjYjQnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICd0YXJnZXQ6bG9naW4gc3RhdHVzIHRyaWdnZXInLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gYWRvYmUudGFyZ2V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaWYgKHR5cGVvZiAoYWRvYmUudGFyZ2V0KSAhPSAidW5kZWZpbmVkIil7XG4kKCJib2R5Iikub24oImxvZ2dlZEluIiwgZnVuY3Rpb24gKGUpIHtcbiAgYWRvYmUudGFyZ2V0LmdldE9mZmVycyh7XG4gICAgcmVxdWVzdDoge1xuICAgICAgZXhlY3V0ZToge1xuICAgICAgICBwYWdlTG9hZDoge1xuICAgICAgICAgIHBhcmFtZXRlcnM6IHtcbiAgICAgICAgICAgIGxvZ2dlZEluOiB0cnVlXG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuICB9KS50aGVuKGZ1bmN0aW9uIChyZXNwb25zZSkge1xuICAgIHJldHVybiBhZG9iZS50YXJnZXQuYXBwbHlPZmZlcnMoe1xuICAgICAgcmVzcG9uc2U6IHJlc3BvbnNlXG4gICAgfSk7XG4gIH0pLnRoZW4oZnVuY3Rpb24gKCkge1xuICAgIHJldHVybiA7XG4gIH0pLmNhdGNoKGZ1bmN0aW9uIChlcnJvcikge1xuICAgIHJldHVybiA7XG4gIH0pO1xufSk7XG4kKCJib2R5Iikub24oImxvZ2dlZE91dCIsIGZ1bmN0aW9uICgpIHtcbiAgYWRvYmUudGFyZ2V0LmdldE9mZmVycyh7XG4gICAgcmVxdWVzdDoge1xuICAgICAgZXhlY3V0ZToge1xuICAgICAgICBwYWdlTG9hZDoge1xuICAgICAgICAgIHBhcmFtZXRlcnM6IHtcbiAgICAgICAgICAgIGxvZ2dlZEluOiBmYWxzZVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiAgfSkudGhlbihmdW5jdGlvbiAocmVzcG9uc2UpIHtcbiAgICByZXR1cm4gYWRvYmUudGFyZ2V0LmFwcGx5T2ZmZXJzKHtcbiAgICAgIHJlc3BvbnNlOiByZXNwb25zZVxuICAgIH0pO1xuICB9KS50aGVuKGZ1bmN0aW9uICgpIHtcbiAgICByZXR1cm4gO1xuICB9KS5jYXRjaChmdW5jdGlvbiAoZXJyb3IpIHtcbiAgICByZXR1cm4gO1xuICB9KTtcbn0pO1xufScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYzFkY2JjNmY0NTcxNGNmNjhkMjcxNWNlMWU3MDFmMzYnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICd2aWRlbzoxMDAlIFZpZXdlZCcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvbWVkaWFUaW1lUGxheWVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5pdDogJ3BlcmNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFtb3VudDogMTAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJy5icmlnaHRjb3ZlLWNvbnRhaW5lciB2aWRlbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSB0aGlzLnBhcmVudEVsZW1lbnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gdGhpcy5wYXJlbnRFbGVtZW50LmdldEF0dHJpYnV0ZSgnaWQnKSwgciA9IHRoaXMucGFyZW50RWxlbWVudC5nZXRBdHRyaWJ1dGUoJ2RhdGEtdmlkZW8taWQnKSwgaSA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoJ2JyaWdodGNvdmUtY29udGFpbmVyJyksIGEgPSAwOyBhIDwgaS5sZW5ndGg7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPT0gaVthXS5nZXRBdHRyaWJ1dGUoJ2RhdGEtcGxheWVyaWQnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lKCd2anMtZG9jay10aXRsZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5lVmFyNDIgPSBvW2FdLmlubmVyVGV4dCwgdC5lVmFyMzEgPSByLCB0LmxpbmtUcmFja1ZhcnMgPSB0LmFwbCh0LmxpbmtUcmFja1ZhcnMsICdlVmFyNDIsZVZhcjMxJywgJywnLCAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSAnZXZlbnQyMDcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1ZpZGVvOkNvbXBsZXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxjODU4ZjFkNjE1MGY0YmY0YWYwMzVhNDExY2MyMzIyMycsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2V2ZW50OnBob25lIGNsaWNrJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJ2EnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRQcm9wZXJ0aWVzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2hyZWYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICd0ZWw6JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcigndGVsZScsIHRoaXMudGV4dCksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gdC5hcGwodC5ldmVudHMsICdldmVudDEnLCAnLCcsIDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjE0NycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyV0ZWxlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnUGhvbmUgTnVtYmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxiNWQwMjNlMDI0YjY0ZDkzYjQ3YjZkOGYyMTRiYjkxNicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2dUYWc6Y3RhT3JhbmdlREMnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5jaG9yRGVsYXk6IDYwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICdhLmZ4Zy1idXR0b24uZnhnLWJ1dHRvbi0tb3JhbmdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50UHJvcGVydGllczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdkYXRhLWFuYWx5dGljcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyhsaW5rIFxcfCBTSUdOIFVQIE5PVyl8KGxpbmtcXHxTaWduIHVwIGZvciBmcmVlKXwoaGVyb1xcfFNlZSBDdXJyZW50IE9mZmVycyl8KGhlcm9cXHxGaW5kIGEgV2FsZ3JlZW5zIE5lYXIgWW91KScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDQwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdnVGFnOmN0YU9yYW5nZURDUGFnZUxpc3RNYXBwaW5nJyksIHQgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9mZHgucGFnZUZsYWcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PSB0eXBlb2YgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lKHRoaXMuY2xhc3NOYW1lKSwgaSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3NhdGVsbGl0ZS5zZXRWYXIoJ2RjT3JhbmdlTGFiZWwnLCBfZmR4LmdldEd0YWdMYWJlbChuLCByLCBpKSksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcignZGNPcmFuZ2VMYWJlbCcsIG4pLCAhMSAhPT0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQzJmYjE4Mjk1MjY5MzQxNzFhNjUyNjA4NzI0NzAzNzQ1LXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGI5NjkyYjJmMWViMTQzODJiYjgyMjY3Zjk1NTBmNzJlJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnYWRUYWc6dmVyaXpvbicsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvbGlicmFyeUxvYWRlZC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCd2ZXJpem9uOnBhZ2VMaXN0JyksIHQgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpLCBfc2F0ZWxsaXRlLnNldFZhcigndmVyaXpvblVSTCcsIF9mZHgucGFnZUZsYWcoZSwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICExICE9PSBfc2F0ZWxsaXRlLmdldFZhcigndmVyaXpvblVSTCcpLCByID0gJycgIT09IF9zYXRlbGxpdGUuZ2V0VmFyKCd2ZXJpem9uOnRpbWVGcmFtZScpICYmICExICE9PSBfc2F0ZWxsaXRlLmdldFZhcigndmVyaXpvbjp0aW1lRnJhbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gJiYgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJzxpbWcgaGVpZ2h0PSIxIiB3aWR0aD0iMSIgc3R5bGU9ImJvcmRlci1zdHlsZTpub25lOyIgYWx0PSIiIHNyYz0ldmVyaXpvblVSTCUgLz4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDQzMWE5ZWE5NzYwZjRmNDJiNmY5NjMyZjMxYjE4ZjVmJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZmJUYWc6R2xvYmFsJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9wYXRoQW5kUXVlcnlzdHJpbmcuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ1xcL2VuLXVzXFwvc2hpcHBpbmdcXC8oKGZyZWlnaHQtc2VydmljZXMpfChzY2hlZHVsZS1tYW5hZ2UtcGlja3Vwcyl8KHN0b3JlXFwvZ3JvdW5kKXwocGFja2luZy1zdXBwbGllcyl8KHBhY2tpbmctc3VwcGxpZXNcXC9jdXN0b20tYnJhbmRlZC1ib3hlcyl8KG9mZmljZS1kZXBvdC1vZmZpY2VtYXgpfChob2xkLWF0LWxvY2F0aW9uKSkuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnXFwvZW4tdXNcXC9zaGlwcGluZ1xcL3JldHVybnMoKChcXC9idXNpbmVzcyl8KFxcL3RlY2hub2xvZ3kpKVxcLmh0bWx8XFwuaHRtbCknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ1xcL2VuLXVzXFwvc2hpcHBpbmdcXC9vbnNpdGUoKChcXC93YWxncmVlbnMtcGFja2FnZS1waWNrdXApfChcXC9kb2xsYXItZ2VuZXJhbC1waWNrLXVwLWRyb3Atb2ZmLXBhY2thZ2UpfChcXC90YXJnZXQtcGljay11cC1kcm9wLW9mZi1wYWNrYWdlKSlcXC5odG1sfFxcLmh0bWwpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC9lbi11c1xcL3ByaW50aW5nXFwvKChzbWFsbC1tZWRpdW0tYnVzaW5lc3Mtb2ZmZXJzKXwoY29uc3VtZXItb2ZmZXJzKXwoZmxhc2gtc2FsZS1vZmZlcnMpfChwYXNzcG9ydC1waG90byl8KG5hdGlvbmFsLWJpZC1jZW50ZXIpfChidXNpbmVzcy1zb2x1dGlvbnNcXC9rbm93bGVkZ2UtY2VudGVyKXwoZGVzaWduLXNlcnZpY2VzKSlcXC5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC9lbi11c1xcL2Rpc2NvdW50LXByb2dyYW1zXFwvKGVtMTU2OTIxMTN8ZW0xNTY5MjIxM3xlbTE1NjkyMDEzfGFnMTMzOTg2MDIpXFwuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnXFwvZW4tdXNcXC9kZWxpdmVyeS1tYW5hZ2VyKChcXC9ob3ctdG8tcHJldmVudC1zdG9sZW4tbWlzc2luZy1wYWNrYWdlc3xcXC9tYW5hZ2UteW91ci1kZWxpdmVyaWVzKS5odG1sfC5odG1sKScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6ICcvZW4tdXMvaG9tZS5odG1sP2xvY2F0aW9uPWhvbWUnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnXFwvZW4tdXNcXC8ocG9zc2liaWxpdGllc3xvZmZpY2VcXC93YWxtYXJ0fGNyZWF0ZS1hY2NvdW50fGJpZy1jb21tZXJjZXxjb3Vwb24tb2ZmZXJzXFwvZ3JvdW5kfGhlYWx0aGNhcmVcXC92YWNjaW5lLXNoaXBwaW5nfGVjb21tZXJjZVxcL29mZmVyLXN0b3JlLXBpY2t1cC1hdC1jaGVja291dCkuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnXFwvZW4tdXNcXC8oc21hbGwtYnVzaW5lc3N8c3VzdGFpbmFiaWxpdHkpLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ1xcL2VuLXVzXFwvaG9saWRheShcXC9jb25zdW1lci1zaGlwcGluZy1kZWxpdmVyeS1ndWlkZS5odG1sfC5odG1sKScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnXFwvZW4tdXNcXC9zbWFsbC1idXNpbmVzc1xcLyh0ZWNobm9sb2d5KS5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC9lbi11c1xcL3N3ZWVwc3Rha2VzKChcXC9jb21lLWluLWFuZC1jYXNoLWlufFxcL2hvbGlkYXktZHJvcC1vZmYpLmh0bWx8Lmh0bWwpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC9lbi11c1xcL3NoaXBwaW5nXFwvc2F0dXJkYXktYW5kLXN1bmRheS1kZWxpdmVyeS5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC9lbi11c1xcL3NtYWxsLWJ1c2luZXNzXFwvZ3JhbnQtY29udGVzdC5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnPCEtLSBGYWNlYm9vayBQaXhlbCBDb2RlIC0tPlxuPHNjcmlwdD5cbiAgIWZ1bmN0aW9uKGYsYixlLHYsbix0LHMpXG4gIHtpZihmLmZicSlyZXR1cm47bj1mLmZicT1mdW5jdGlvbigpe24uY2FsbE1ldGhvZD9cbiAgbi5jYWxsTWV0aG9kLmFwcGx5KG4sYXJndW1lbnRzKTpuLnF1ZXVlLnB1c2goYXJndW1lbnRzKX07XG4gIGlmKCFmLl9mYnEpZi5fZmJxPW47bi5wdXNoPW47bi5sb2FkZWQ9ITA7bi52ZXJzaW9uPVwnMi4wXCc7XG4gIG4ucXVldWU9W107dD1iLmNyZWF0ZUVsZW1lbnQoZSk7dC5hc3luYz0hMDtcbiAgdC5zcmM9djtzPWIuZ2V0RWxlbWVudHNCeVRhZ05hbWUoZSlbMF07XG4gIHMucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUodCxzKX0od2luZG93LCBkb2N1bWVudCxcJ3NjcmlwdFwnLFxuICBcJ2h0dHBzOi8vY29ubmVjdC5mYWNlYm9vay5uZXQvZW5fVVMvZmJldmVudHMuanNcJyk7XG4gIGZicShcJ2luaXRcJywgXCczOTg2MTM4NTM5OTkyOTdcJyk7XG4gIGZicShcJ3RyYWNrXCcsIFwnUGFnZVZpZXdcJyk7XG48L3NjcmlwdD5cbjxub3NjcmlwdD48aW1nIGhlaWdodD0iMSIgd2lkdGg9IjEiIHN0eWxlPSJkaXNwbGF5Om5vbmUiXG4gIHNyYz0iaHR0cHM6Ly93d3cuZmFjZWJvb2suY29tL3RyP2lkPTM5ODYxMzg1Mzk5OTI5NyZldj1QYWdlVmlldyZub3NjcmlwdD0xIlxuLz48L25vc2NyaXB0PlxuPCEtLSBFbmQgRmFjZWJvb2sgUGl4ZWwgQ29kZSAtLT4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGJmYTJmNDBkMGYxZjQ3Y2RiZWQ3ODQwMzZjZDljZmNhJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnSFBUcmFja0J0bjpWYWxpZERhdGEnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2VsZW1lbnRFeGlzdHMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgZWxlbWVudFNlbGVjdG9yOiAnZGl2IC5yZWRlc2lnblNuYXBzaG90VFZDJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vNjg2YjhmMGM0NTIwLzRjZTQwMWM1MWI1MS82ODA3NmFjYmEyY2MvUkM3ODkwOWQ1NDgyMzg0OWZlYmQ1YWQ2Y2RlOTRhN2Y2MC1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXh0ZXJuYWw6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmNzViMWEzY2QzOTc0NmQ0ODY2NWU0YzI5ZTJkNWMzNCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3JlZGlyZWN0OmFwcFNlZ0lkVGFyZ2V0JywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kb21SZWFkeS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdsb2JhbDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzY4NmI4ZjBjNDUyMC80Y2U0MDFjNTFiNTEvNjgwNzZhY2JhMmNjL1JDZDU3OTRlYmFkZWE2NDY2OGE1NGM4MmE5NDQ5OThlYjItc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZjQyOTViZmY2ODVkNDdlNjk1ZTI2NjU0ODYxMTI2ODcnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdnVGFnOmN0YU9yYW5nZUFXJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuY2hvckRlbGF5OiA2MDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYS5meGctYnV0dG9uLmZ4Zy1idXR0b24tLW9yYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFByb3BlcnRpZXM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZGF0YS1hbmFseXRpY3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICcoaGVyb1xcfGZyZWUgZG93bmxvYWQpfChsaW5rXFx8Q3JlYXRlIGEgbGFiZWwpfChoZXJvXFx8c2hpcCBub3cpfChoZXJvXFx8Q2hhdCB3aXRoIGEgc2FsZXMgc3BlY2lhbGlzdCl8KGhlcm9cXHxBcHBseSBOb3cpfChsaW5rXFx8U3RhcnQgYSBmcmVlIEJpZ0NvbW1lcmNlIHRyaWFsKXwoaGVyb1xcfEdldCBTdGFydGVkKXwobGlua1xcfFN0YXJ0IE9yZGVyKXwobGlua1xcfFNpZ24gdXAgZm9yIGZyZWUpfChsaW5rXFx8RmluZCBhIERvbGxhciBHZW5lcmFsKXwoaGVyb1xcfFNlZSBDdXJyZW50IE9mZmVycyl8KGhlcm9cXHxGaW5kIGEgV2FsZ3JlZW5zIE5lYXIgWW91KScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdnVGFnOmN0YU9yYW5nZUFXUGFnZUxpc3RNYXBwaW5nJyksIHQgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9mZHgucGFnZUZsYWcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PSB0eXBlb2YgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lKHRoaXMuY2xhc3NOYW1lKSwgaSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3NhdGVsbGl0ZS5zZXRWYXIoJ2F3T3JhbmdlTGFiZWwnLCBfZmR4LmdldEd0YWdMYWJlbChuLCByLCBpKSksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcignYXdPcmFuZ2VMYWJlbCcsIG4pLCAhMSAhPT0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQ2JlNWYzY2EzODA1YjRiYjY4MmQxOWJhMjJjYmQ5NzcxLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGI3YjMwMDFjNjZlOTRlMTI4NmYwYzgxNTdiYTA2MzA1JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAndmlkZW86UGxheScsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvbWVkaWFUaW1lUGxheWVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5pdDogJ3BlcmNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFtb3VudDogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcuYnJpZ2h0Y292ZS1jb250YWluZXIgdmlkZW8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gdGhpcy5wYXJlbnRFbGVtZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IHRoaXMucGFyZW50RWxlbWVudC5nZXRBdHRyaWJ1dGUoJ2lkJyksIHIgPSB0aGlzLnBhcmVudEVsZW1lbnQuZ2V0QXR0cmlidXRlKCdkYXRhLXZpZGVvLWlkJyksIGkgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lKCdicmlnaHRjb3ZlLWNvbnRhaW5lcicpLCBhID0gMDsgYSA8IGkubGVuZ3RoOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID09IGlbYV0uZ2V0QXR0cmlidXRlKCdkYXRhLXBsYXllcmlkJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeUNsYXNzTmFtZSgndmpzLWRvY2stdGl0bGUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZVZhcjQyID0gb1thXS5pbm5lclRleHQsIHQuZVZhcjMxID0gciwgdC5saW5rVHJhY2tWYXJzID0gdC5hcGwodC5saW5rVHJhY2tWYXJzLCAnZVZhcjQyLGVWYXIzMScsICcsJywgMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MjAzJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdWaWRlbzpQbGF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwyM2FmYmRlNjNiOGI0MGRiYmU3MTM0NjkzMmU3MGU3OCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2dUYWc6QWRXb3Jkc0V2ZW50JywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9mZHgucGNmVXRpbCgpLm1hdGNoKC93d3coc2JveC5pZGV2fGJhc2UuaWRldnxkZXYuaWRldnxkcnQuaWRldnxzdHJlc3MuZG16LmlkZXZ8Yml0LmlkZXZ8dGVzdHwpLmZlZGV4LmNvbS9naSksIHQgPSAnJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignZ1RhZ0Rpc2FibGVMb2NhbGUnKSwgbiA9IHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZSwgciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OmNvdW50cnlDb2RlJyksIGkgPSBfc2F0ZWxsaXRlLmdldFZhcignZ1RhZzpBZFdvcmRzRXZlbnRNYXBwaW5nJyksIGEgPSBfZmR4LnBhZ2VGbGFnKGksIHIsICdjb3VudHJ5JyksIG8gPSBfZmR4LnBhZ2VGbGFnKGEsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3NhdGVsbGl0ZS5zZXRWYXIoJ2F3TGFiZWwnLCBvKSwgISghMSA9PT0gbyB8fCBudWxsID09PSBlIHx8ICF0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJzxzY3JpcHQ+XG4gIGd0YWcoXCdldmVudFwnLCBcJ2NvbnZlcnNpb25cJyxcbiAgICB7XG4gICAgICAgIFwnc2VuZF90b1wnOiBfc2F0ZWxsaXRlLmdldFZhcigiYXdMYWJlbCIpXG4gICAgfSk7XG48L3NjcmlwdD5cbjwhLS1cbnZhciBhZHdvcmRzTWFwcGluZyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCJnVGFnOkFkV29yZHNFdmVudE1hcHBpbmciKTsgIFxudmFyIHVybCA9IHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZTsgXG52YXIgb2JqQWRXb3JkcyA9IiI7XG52YXIgZXZlbnRfdHlwZSA9ICIiO1xudmFyIGV2ZW50X25hbWUgPSAiIjtcbnZhciBldmVudF9wYXJhbSA9ICIiO1xuaWYgKCh0eXBlb2YgYWR3b3Jkc01hcHBpbmcgIT09ICJ1bmRlZmluZWQiICYmIGFkd29yZHNNYXBwaW5nICE9PSAiIikgJiYgKHR5cGVvZiB1cmwgIT09ICJ1bmRlZmluZWQiICYmIHVybCAhPT0gIiIpKXtcblx0Zm9yKHZhciBrZXkgaW4gYWR3b3Jkc01hcHBpbmcpe1x0XHRcdFx0XG5cdFx0aWYodXJsLmluZGV4T2Yoa2V5KSA+IC0xKXtcblx0XHRcdG9iakFkV29yZHMgPSBhZHdvcmRzTWFwcGluZ1trZXldO1x0XHRcdCBcblx0XHRcdGJyZWFrO1x0XHRcdFx0ICBcblx0XHR9XG5cdH1cbn0gICAgXG5pZiAoKHR5cGVvZiBvYmpBZFdvcmRzICE9PSAidW5kZWZpbmVkIiAmJiBvYmpBZFdvcmRzICE9PSAiIikgKXtcblx0ZXZlbnRfdHlwZSA9IG9iakFkV29yZHMuZXZlbnRfdHlwZTtcblx0ZXZlbnRfbmFtZSA9IG9iakFkV29yZHMuZXZlbnRfbmFtZTtcblx0ZXZlbnRfcGFyYW0gPSBvYmpBZFdvcmRzLmV2ZW50X3BhcmFtO1xufVxuZ3RhZyhldmVudF90eXBlLCBldmVudF9uYW1lLCBldmVudF9wYXJhbSk7XG48L3NjcmlwdD4tLT4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGNiMzA3NGM0ZjZjZDQ2NmZiN2FjYWZiZDUzZWJkM2U2JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZ1RhZzpidG5GQicsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYS5meGctbGluay5qcy1meGdjLWluaXQuZnhnLWxpbmstLW1kLmZ4Zy1saW5rLS1yb3VuZGVkX2J1dHRvbi5meGctbGluay0tYWxpZ24tbGVmdC5zdXAuc3ViJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA2MAogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJ2EuZnhnLWxpbmsuanMtZnhnYy1pbml0LmZ4Zy1saW5rLS1ibHVlLmZ4Zy1saW5rLS1tb2JpbGUtYWxpZ24tY2VudGVyLmZ4Zy1tb2JpbGUtLWhpZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDYwCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdnVGFnOmJ0bkZCUGFnZUxpc3RNYXBwaW5nJyksIHQgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9mZHgucGFnZUZsYWcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PSB0eXBlb2YgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lKHRoaXMuY2xhc3NOYW1lKSwgaSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3NhdGVsbGl0ZS5zZXRWYXIoJ2ZiRXZlbnQnLCBfZmR4LmdldEd0YWdMYWJlbChuLCByLCBpKSksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcignZmJFdmVudCcsIG4pLCAhMSAhPT0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQzBkM2Y0MTc5NDg4YjQ4MzQ4NTNmYzY0MWIwMWZiNjY0LXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGNjNTJjOTAyOTQ3NDQ2MGM4MGY3NTYzYzc2ZmM4MmFhJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAndHJhZGVkZXNrOmV2ZW50QnRuQ2xpY2tUVEQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJ2EuZnhnLWJ1dHRvbi5meGctYnV0dG9uLS1vcmFuZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRQcm9wZXJ0aWVzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2RhdGEtYW5hbHl0aWNzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnKGxpbmtcXHxGaW5kIGEgRG9sbGFyIEdlbmVyYWwpfChsaW5rXFx8U2lnbiB1cCBmb3IgZnJlZSl8KGhlcm9cXHxGaW5kIGEgV2FsZ3JlZW5zIE5lYXIgWW91KXwoaGVyb1xcfFNlZSBDdXJyZW50IE9mZmVycyknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJ2EuZnhnLWxpbmsuanMtZnhnYy1pbml0LmZ4Zy1saW5rLS1yb3VuZGVkX2J1dHRvbi5meGctYnV0dG9uLS1yb3VuZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFByb3BlcnRpZXM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZGF0YS1hbmFseXRpY3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICcobGlua1xcfHNpZ24gdXAgbm93KXwobGlua1xcfE5leHQgdGltZSB1c2UgRmVkRXggRGVsaXZlcnkgTWFuYWdlclxcfFNJR04gVVAgRk9SIEZSRUUpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvcGF0aEFuZFF1ZXJ5c3RyaW5nLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aHM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC9lbi11c1xcL3NoaXBwaW5nXFwvb25zaXRlXFwvKHdhbGdyZWVucy1wYWNrYWdlLXBpY2t1cHxkb2xsYXItZ2VuZXJhbC1waWNrLXVwLWRyb3Atb2ZmLXBhY2thZ2UpLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ1xcL2VuLXVzXFwvcHJpbnRpbmdcXC9jb25zdW1lci1vZmZlcnMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnXFwvZW4tdXNcXC9kZWxpdmVyeS1tYW5hZ2VyLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCd0cmFkZWRlc2s6YnRuQ2xpY2tQYWdlTGlzdE1hcHBpbmcnKSwgdCA9IHRoaXMuZ2V0QXR0cmlidXRlKCdkYXRhLWFuYWx5dGljcycpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9mZHgucGFnZUZsYWcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcigndGRQaXhlbCcsIG4pLCAhMSAhPT0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQzk1ZmM4YzdkODA4NDQ4YjdhZjkzMTRmMWQ3YjM1ZjAyLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDkxMDEzYzI4NGQyNjQxN2RiZDdiNDM1M2I4Y2EwY2EzJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnYWRUYWc6ZG90VGFnICcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvcGFnZUJvdHRvbS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdkb3RUYWc6ZW5hYmxlZFBhZ2VMaXN0JyksIHQgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyA9PSB0eXBlb2YgX2ZkeCAmJiBfc2F0ZWxsaXRlLmdldFZhcignX2ZkeFV0aWwnKSwgITEgIT09IF9mZHgucGFnZUZsYWcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICd2YXIgZG90VGFnUGl4ZWxJZCA9IF9zYXRlbGxpdGUuZ2V0VmFyKCJkb3RUYWdQaXhlbElkIik7XG4oZnVuY3Rpb24odyxkLHQscix1KXt3W3VdPXdbdV18fFtdO3dbdV0ucHVzaCh7XCdwcm9qZWN0SWRcJzpcJzEwMDAwXCcsXCdwcm9wZXJ0aWVzXCc6e1wncGl4ZWxJZFwnOmRvdFRhZ1BpeGVsSWR9fSk7dmFyIHM9ZC5jcmVhdGVFbGVtZW50KHQpO3Muc3JjPXI7cy5hc3luYz10cnVlO3Mub25sb2FkPXMub25yZWFkeXN0YXRlY2hhbmdlPWZ1bmN0aW9uKCl7dmFyIHkscnM9dGhpcy5yZWFkeVN0YXRlLGM9d1t1XTtpZihycyYmcnMhPSJjb21wbGV0ZSImJnJzIT0ibG9hZGVkIil7cmV0dXJufXRyeXt5PVlBSE9PLnl3YS5JMTNOLmZpcmVCZWFjb247d1t1XT1bXTt3W3VdLnB1c2g9ZnVuY3Rpb24ocCl7eShbcF0pfTt5KGMpfWNhdGNoKGUpe319O3ZhciBzY3I9ZC5nZXRFbGVtZW50c0J5VGFnTmFtZSh0KVswXSxwYXI9c2NyLnBhcmVudE5vZGU7cGFyLmluc2VydEJlZm9yZShzLHNjcil9KSh3aW5kb3csZG9jdW1lbnQsInNjcmlwdCIsImh0dHBzOi8vcy55aW1nLmNvbS93aS95dGMuanMiLCJkb3RxIik7XG5cblxuXG4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDM5NTFkMGQ1NmEwMzQzNGQ4ZmRkMjc2YTlmMzNlNjAwJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnU3Bpa2U6IFF1YWx0cmljcyAtIFRyYWNraW5nJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy90aW1lT25QYWdlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHRpbWVPblBhZ2U6IDUgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvdmFsdWVDb21wYXJpc29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcGFyaXNvbjogeyBvcGVyYXRvcjogJ2VxdWFscycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWZ0T3BlcmFuZDogJyVjb250ZW50OmxvY2FsZSUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpZ2h0T3BlcmFuZDogJ2VuX3VzJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyA9PSB0eXBlb2YgX2ZkeCAmJiBfc2F0ZWxsaXRlLmdldFZhcignX2ZkeFV0aWwnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mZWRleHRyYWNrLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy9mZWRleHRyYWNraW5nLycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHQgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfZmR4LnBhZ2VGbGFnKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yQWxsKCdbZGF0YS10ZXN0LWlkPSJkZWxpdmVyeS1kYXRlLWhlYWRlciJdJylbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RhdHVzRGl2U3RyaW5nID0gZS5pbm5lclRleHQsIHN0YXR1c0RpdlN0cmluZy5pbmRleE9mKCdEZWxpdmVyZWQnKSA+PSAwICYmIChlLnNldEF0dHJpYnV0ZSgnaWQnLCAnc3RhdHVzX2RlbGl2ZXJlZCcpLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vNjg2YjhmMGM0NTIwLzRjZTQwMWM1MWI1MS82ODA3NmFjYmEyY2MvUkNhMDg0Mzc3MTAwNzQ0NjkxYTMyYTFmMjZlZmMxYjNkZi1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2h0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXh0ZXJuYWw6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwyNTIzNzM3MjM4Mzc0MDYzOTFlYzZiOWEwNTI0NmY1NScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2dUYWc6VmlkZW9FdmVudENsaWNrJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJy52anMtYmlnLXBsYXktYnV0dG9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9wYXRoLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJy8oa28ta3J8emgtdHd8ZW4tc2cpL2Fib3V0L3Bvc3NpYmlsaXRpZXMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6VmlkZW9QbGF5QnRuSWRMaXN0JyksIHQgPSB0aGlzLnBhcmVudEVsZW1lbnQuZ2V0QXR0cmlidXRlKCdkYXRhLXZpZGVvLWlkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9mZHgucGFnZUZsYWcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcigndmlkZW9HdGFnTGFiZWwnLCBuKSwgITEgIT09IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vNjg2YjhmMGM0NTIwLzRjZTQwMWM1MWI1MS82ODA3NmFjYmEyY2MvUkMwYjMzNjIwMWU1Y2U0MzYzYmU5OTYyM2YyMTVjMTdlNS1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXh0ZXJuYWw6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxiY2MxYTUwY2JiZjA0MmI1OWEyZjgzYjYzYzRiNjk4ZCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3VzZXI6TG9nZ2VkIEluJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kYXRhRWxlbWVudENoYW5nZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBuYW1lOiAnbG9naW46c3RhdHVzJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2Nvb2tpZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdmZHhfbG9naW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnLionLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5saW5rVHJhY2tWYXJzID0gdC5saW5rVHJhY2tWYXJzICsgJyxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQubGlua1RyYWNrRXZlbnRzICsgJyxldmVudDMsZXZlbnQ0JywgJycgIT09IF9zYXRlbGxpdGUuZ2V0VmFyKCdsb2dpbjp1c2VyLWlkJykgJiYgX3NhdGVsbGl0ZS5nZXRWYXIoJ2xvZ2luOnVzZXItaWQnKSAmJiAodC5ldmVudHMgPSB0LmFwbCh0LmV2ZW50cywgJ2V2ZW50MycsICcsJywgMiksIHQuZXZlbnRzID0gdC5hcGwodC5ldmVudHMsICdldmVudDQnLCAnLCcsIDIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclbG9naW46c3RhdHVzJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIxMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVsb2dpbjpmZHhfY2JpZCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNjAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICcldXNlcjplbWFpbElEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWxvZ2luOnVzZXItaWQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FsaWFzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ2VWYXI0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhbGlhcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdlVmFyNicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3A3NScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyV1c2VyOnVzZXItYWdlbnQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpjb3VudHJ5Q29kZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50Omxhbmd1YWdlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ2hkcnxMb2dnZWQgSW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDBhZjVmZmE4MDNjMDQzOWM5YzdlYzE0NDRkNjI2YjBjJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnc2VhcmNoIC0gUyZQJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kYXRhRWxlbWVudENoYW5nZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBuYW1lOiAnc2VhcmNoOnNwRGF0YSAtIEpTT2JqZWN0Q2hhbmdlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoJ3NlYXJjaC5odG1sP3E9JykgPiAtMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQzE2Mzk3YmFkODMxNTRlM2E5ZWU1NDE4ZTQyMDg0MDVlLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDg3ZWU1YWNlYjE0NTRlOGRhMmNhMDczNTk2NDU3MGJkJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZ1RhZzpidG5BVycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYS5meGctbGluay5qcy1meGdjLWluaXQuZGVmYXVsdC5meGctbGluay0tYWxpZ24tbGVmdC5meGctbGluay0tbW9iaWxlLWFsaWduLWNlbnRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICdhLmZ4Zy1saW5rLmpzLWZ4Z2MtaW5pdC5meGctbGluay0tbWQuZnhnLWxpbmstLXJvdW5kZWRfYnV0dG9uLmZ4Zy1saW5rLS1hbGlnbi1sZWZ0LnN1cC5zdWInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYS5meGctbGluay5qcy1meGdjLWluaXQuZnhnLWxpbmstLWJsdWUuZnhnLWxpbmstLW1vYmlsZS1hbGlnbi1jZW50ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYS5meGctbGluay5qcy1meGdjLWluaXQuZnhnLWxpbmstLXJvdW5kZWRfYnV0dG9uLmZ4Zy1saW5rLS1hbGlnbi1jZW50ZXIuZnhnLWxpbmstLW1vYmlsZS1hbGlnbi1jZW50ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYS5meGctbGluay5qcy1meGdjLWluaXQuZnhnLWxpbmstLXJvdW5kZWRfYnV0dG9uLmZ4Zy1idXR0b24tLXJvdW5kLmZ4Zy1saW5rLS1hbGlnbi1jZW50ZXIuZnhnLWxpbmstLW1vYmlsZS1hbGlnbi1jZW50ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYnV0dG9uLmZ4Zy1idXR0b24uZnhnLWJ1dHRvbi0tc3VibWl0LmZ4Zy1idXR0b24tLW9yYW5nZS5qcy1jbXMtZm9ybS1zdWJtaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdnVGFnOmJ0bkFXUGFnZUxpc3RNYXBwaW5nJyksIHQgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9mZHgucGFnZUZsYWcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PSB0eXBlb2YgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lKHRoaXMuY2xhc3NOYW1lKSwgaSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3NhdGVsbGl0ZS5zZXRWYXIoJ2F3TGFiZWwnLCBfZmR4LmdldEd0YWdMYWJlbChuLCByLCBpKSksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcignYXdMYWJlbCcsIG4pLCAhMSAhPT0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQ2E0M2IyMjk2ZDliMzQzNmJiNGU3NGIwMzA2NDc1OTkwLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDYyZGQwYjZiZGZmMTRmN2Q5NDI5MmNmMzI0YzVlMjJlJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZ1RhZ0luZGlhOkFkd29yZHMnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL3BhdGhBbmRRdWVyeXN0cmluZy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGhzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnXFwvZW4taW5cXC8odHJhY2tpbmd8aG9tZXxjb3JvbmF2aXJ1c3xzaGlwcGluZ3xiaWxsaW5nKS5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC9lbi1pblxcLyhjdXN0b21lci1zdXBwb3J0fG9wZW4tYWNjb3VudHxjdXN0b21zLXRvb2xzfGNvbmRpdGlvbnMtb2YtY2FycmlhZ2UpLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ1xcL2VuLWluXFwvKGFib3V0fGNhbXBhaWdufG9wZW4tYWNjb3VudHxzaGlwcGluZ3x0cnVzdC1jZW50ZXJ8b25saW5lKVxcLyhwb3NzaWJpbGl0aWVzfGRlbGl2ZXJpbmctd2hhdC1tYXR0ZXJzfHN0YXJ0LXNoaXBwaW5nfHN1cmNoYXJnZXN8Z2V0c3RhcnRlZHxyZXNvdXJjZXN8cmF0ZXN8c21hbGwtYnVzaW5lc3N8cmVwb3J0LWZyYXVkfHJhdGluZykuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnXFwvZW4taW5cXC9hYm91dFxcL3Bvc3NpYmlsaXRpZXNcXC9hcnRpY2xlc1xcL2Zsb3dlcnMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnXFwvZW4taW5cXC9hYm91dFxcL3Bvc3NpYmlsaXRpZXNcXC9tYWtpbmctaXQtd29yay5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC9lbi1pblxcL3NoaXBwaW5nXFwvaW5kdXN0cnktc29sdXRpb25zXFwvKGhlYWx0aGNhcmUuaHRtbHwoaGVhbHRoY2FyZVxcL3RlbXBlcmF0dXJlLWNvbnRyb2wuaHRtbCl8KGhlYWx0aGNhcmVcXC9jb250YWN0LXVzLmh0bWwpKScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2d0YWcoXCdldmVudFwnLCBcJ3BhZ2Vfdmlld1wnLCB7XG4gICAgXCdzZW5kX3RvXCc6IFwnQVctNjczNjgxODI5XCcsXG59KTsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDRlMDEyMGI4YWU2YzQ2NDY5OWJkNGIyNGE0MDQzZWU2JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAndXNlcjp1c2VyIGluZm8nLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0xvZ2dlZCBJbicgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2xvZ2luOnN0YXR1cycpICYmICh0LmV2ZW50cyA9IHQuYXBsKHQuZXZlbnRzLCAnZXZlbnQzJywgJywnLCAyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWxvZ2luOnN0YXR1cyUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclbG9naW46ZmR4X2NiaWQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjYwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJXVzZXI6ZW1haWxJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3A0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYWxpYXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnZVZhcjQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wNzUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICcldXNlcjp1c2VyLWFnZW50JScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDNlZmFhZjFmMmFjODQyMTZiNjI0YWY3ZDU3ZDczNzJmJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZm9ybXNPbkNoYW5nZScsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2hhbmdlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnLmpzLWZvcm0tY2F0ZWdvcnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRQcm9wZXJ0aWVzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2RhdGEtaW5kZXgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICcxJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWUsIHQgPSB0aGlzLmNoaWxkcmVuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodFtuXS5zZWxlY3RlZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5pbmRleE9mKCdjb250YWN0JykgPiAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICdDb250YWN0IGZvcm06JyArIHRbbl0udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9zYXRlbGxpdGUuc2V0VmFyKCdmb3JtOmxpbmtOYW1lJywgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSAnQ1MgQWdlbnQgRm9ybTonICsgdFtuXS52YWx1ZSwgX3NhdGVsbGl0ZS5zZXRWYXIoJ2Zvcm06bGlua05hbWUnLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcvZW4tZ2IvY3VzdG9tZXItc3VwcG9ydC9jb250YWN0Lmh0bWwnID09IGUgfHwgJy9lbi1nYi9jdXN0b21lci1zdXBwb3J0Lmh0bWwnID09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJyVmb3JtOmxpbmtOYW1lJScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYjcwYTg1M2IwYjdkNDQ0MTllNmY3ZjU4N2MwMjJiZDInLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdldmVudDpzb2NpYWwgc2hhcmUnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnaW1nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50UHJvcGVydGllczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdkYXRhLWFuYWx5dGljcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ3NvY2lhbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMuZ2V0QXR0cmlidXRlKCdkYXRhLWFuYWx5dGljcycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIShlLmluZGV4T2YoJ05ld3NsZXR0ZXInKSA+PSAwICYmIChmZHhfc2V0TGlua1ZpZXcoZSksIDEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5saW5rVHJhY2tWYXJzID0gdC5hcGwodC5saW5rVHJhY2tWYXJzLCAncHJvcDE4LHByb3AxOSxwcm9wMjAsZVZhcjY1JywgJywnLCAyKSwgdC5ldmVudHMgPSB0LmFwbCh0LmV2ZW50cywgJ2V2ZW50NTYnLCAnLCcsIDIpLCAnTm9uZScgIT09IHQubGlua1RyYWNrRXZlbnRzID8gdC5saW5rVHJhY2tFdmVudHMgPSB0LmxpbmtUcmFja0V2ZW50cyArICcsZXZlbnQ1NicgOiB0LmxpbmtUcmFja0V2ZW50cyA9ICdldmVudDU2Jywgd2luZG93Lm5sdHJrID0gJ3knOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzLmdldEF0dHJpYnV0ZSgnZGF0YS1hbmFseXRpY3MnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnICE9PSBuICYmIG51bGwgIT09IG4gJiYgKHQuZVZhcjY1ID0gbi5zdWJzdHJpbmcobi5sYXN0SW5kZXhPZignfCcpICsgMSksIHQucHJvcDE4ID0gdC5wYWdlTmFtZSwgdC5wcm9wMTkgPSBuLCB0LnByb3AyMCA9IHQucGFnZU5hbWUgKyAnIHwgJyArIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxlODBkZWM4MGJiMWI0NTY2YmQ0ODE3OGM4NmI2MmEzOCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2dUYWc6YnRuT3JhbmdlREMnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYnV0dG9uLmZ4Zy1idXR0b24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRQcm9wZXJ0aWVzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnKHNpZ25VcENvbnRpbnVlQnV0dG9uKXwoc3VibWl0UGluQnV0dG9uKScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL3BhdGhBbmRRdWVyeXN0cmluZy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGhzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC9mZG1lbnJvbGxtZW50XFwvXFw/c2lnbnVwXFw9dHJ1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6YnRuT3JhbmdlRENQYWdlTGlzdE1hcHBpbmcnKSwgdCA9IHRoaXMuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9mZHgucGFnZUZsYWcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcignZGNPcmFuZ2VCdG5MYWJlbCcsIG4pLCAhMSAhPT0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQzQ1ZTE5ODhmOGJhZjQ5ZDRhN2YxNzlhODAyZTA0YTEyLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDAzYjNlMzhjYTRkODQ3N2VhNWM0MWNlMzllYTEyMDJlJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZ1RhZzpidG5EQycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYnV0dG9uLmZ4Zy1idXR0b24uZnhnLWJ1dHRvbi0tc3VibWl0LmZ4Zy1idXR0b24tLW9yYW5nZS5qcy1jbXMtZm9ybS1zdWJtaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDQwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5jaG9yRGVsYXk6IDYwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICdhLmZ4Zy1saW5rLmpzLWZ4Z2MtaW5pdC5meGctbGluay0tc20uZnhnLWxpbmstLXJvdW5kZWRfYnV0dG9uLmZ4Zy1saW5rLS1hbGlnbi1jZW50ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDQwCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdnVGFnOmJ0bkRDUGFnZUxpc3RNYXBwaW5nJyksIHQgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9mZHgucGFnZUZsYWcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PSB0eXBlb2YgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lKHRoaXMuY2xhc3NOYW1lKSwgaSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3NhdGVsbGl0ZS5zZXRWYXIoJ2RjTGFiZWwnLCBfZmR4LmdldEd0YWdMYWJlbChuLCByLCBpKSksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcignZGNMYWJlbCcsIG4pLCAhMSAhPT0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQ2FiZGIwNjE4OTc1MTRmNWY5ODRlMzM4YzUwMzQyYmViLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDA2MDE1OTZlNDFkMTQ3OTg5ZTY1ZGE1NmZkYjIwYzM2JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnb25lVGFnOkZsYXNodGFsa2luZyBUYWcnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBfc2F0ZWxsaXRlLmdldFZhcignRmxhc2hUYWxraW5nOnBhZ2VMaXN0TWFwcGluZycpLCB0ID0gd2luZG93LmxvY2F0aW9uLmhyZWY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAvLmNvbSguKikvLmV4ZWModClbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gMTAwMDAwMDAwMDAwMDAgKiAoTWF0aC5yYW5kb20oKSArICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIF9mZHggJiYgX3NhdGVsbGl0ZS5nZXRWYXIoJ19mZHhVdGlsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gX2ZkeC5wYWdlRmxhZyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgIT0gciAmJiAoX3NhdGVsbGl0ZS5zZXRWYXIoJ2ZsYXNodGFsa2luZ1VSTCcsIHIgKyBuKSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnPGlmcmFtZSBzcmM9JWZsYXNodGFsa2luZ1VSTCUgd2lkdGg9IjEiIGhlaWdodD0iMSIgZnJhbWVib3JkZXI9IjAiIHN0eWxlPSJwb3NpdGlvbjphYnNvbHV0ZSI+PC9pZnJhbWU+JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2h0bWwnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw0NDIzODViOTUwOTY0Nzk4YjE1N2ViZGQzZTM0ZTIzZScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2dUYWc6QnV0dG9uRXZlbnQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnI3N1YnNjcmliZWJ1dHRvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IF9zYXRlbGxpdGUuZ2V0VmFyKCdnVGFnOkVuYWJsZWRMb2NhbGVFcGljJykgJiYgbnVsbCAhPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6RW5hYmxlZExvY2FsZUVwaWMnKSAmJiAnJyAhPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6RW5hYmxlZExvY2FsZUVwaWMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQzBjZTEwNDNlMTgxMDQ3ZGFhNWNlNjA5ZjQxZmEwM2U0LXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGQwYTYzYWMwNWUyYzRhY2VhM2NhMmQ4MTI2YTlmNTY1JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAndmE6cG9waW4nLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RvbVJlYWR5LmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OmRldmljZVR5cGUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIF9mZHggJiYgX3NhdGVsbGl0ZS5nZXRWYXIoJ19mZHhVdGlsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ3ZhOmVuYWJsZWRDb3VudHJ5TGlzdCcpLCBuID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6Y291bnRyeUNvZGUnKSwgciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCd2YTptb2JFbmFibGVkVXJsJyksIGkgPSBfZmR4LnBhZ2VGbGFnKHQsIG4pLCBhID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ3ZhOmNhYXNFbmFibGVkQ291bnRyeUxpc3QnKSwgbyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCd2YTpjYWFzTW9iRW5hYmxlZFVybCcpLCBzID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6bG9jYWxlJyksIGMgPSBfc2F0ZWxsaXRlLmdldFZhcigndmE6Y2Fhc0Rpc2FibGVkQ291bnRyeUxpc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5pbmRleE9mKHMpID4gLTEgPyBpc0NhYXNNb2JFbmFibGVkID0gITAgOiBpc0NhYXNNb2JFbmFibGVkID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gd2luZG93LmxvY2F0aW9uLnBhdGhuYW1lLCBsID0gJy8nICsgX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6bG9jYWxlJykucmVwbGFjZSgnXycsICctJykgKyAnLycsIGQgPSBfc2F0ZWxsaXRlLmdldFZhcigndmE6ZGlzYWJsZWRQYWdlTGlzdCcpLCBmID0gIV9mZHgucGFnZUZsYWcoZCwgdSksIHAgPSAhX2ZkeC5wYWdlRmxhZyhkLCBsKSwgbSA9IF9mZHgucGFnZUZsYWcociwgdSksIGcgPSBfZmR4LnBhZ2VGbGFnKG8sIHUpLCBoID0gaSAmJiBmLCB2ID0gaSAmJiBwICYmIGMsIGIgPSBpICYmIG0sIHkgPSBpICYmIHAgJiYgZyAmJiBpc0NhYXNNb2JFbmFibGVkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSBGRFguQ0FBUyA/ICEoJ2Rlc2t0b3AnICE9IGUgfHwgIWgpIHx8ICEoJ21vYmlsZScgIT0gZSB8fCAhYikgOiAhKCdkZXNrdG9wJyAhPSBlIHx8ICF2KSB8fCAhKCdtb2JpbGUnICE9IGUgfHwgIXkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gX3NhdGVsbGl0ZS5jb29raWUuZ2V0KCd3Y21tb2RlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vNjg2YjhmMGM0NTIwLzRjZTQwMWM1MWI1MS82ODA3NmFjYmEyY2MvUkNlMDdlNTA0ZmUzZWU0NGEwOGNhYmI2MmE3ODA5N2IyMS1zb3VyY2UubWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXh0ZXJuYWw6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw4YTA4M2FmMjIwNjc0OTI5OTk1N2IzN2QxN2YxYjlhMCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2dUYWc6YnRuT3JhbmdlQVcnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYnV0dG9uLmZ4Zy1idXR0b24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRQcm9wZXJ0aWVzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnKHNpZ25VcENvbnRpbnVlQnV0dG9uKXwoc3VibWl0UGluQnV0dG9uKScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL3BhdGhBbmRRdWVyeXN0cmluZy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGhzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnXFwvZmRtZW5yb2xsbWVudFxcL1xcP3NpZ251cFxcPXRydWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ1xcL3NoaXBwaW5nL2luZHVzdHJ5LXNvbHV0aW9ucy9oZWFsdGhjYXJlL2NvbnRhY3QtdXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ1xcLygoZW58ZnIpLWNhKVxcL3NtYWxsLWJ1c2luZXNzXFwvZWNvbW1lcmNlLXNvbHV0aW9ucy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBfc2F0ZWxsaXRlLmdldFZhcignZ1RhZzpidG5PcmFuZ2VBV1BhZ2VMaXN0TWFwcGluZycpLCB0ID0gdGhpcy5pZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIF9mZHggJiYgX3NhdGVsbGl0ZS5nZXRWYXIoJ19mZHhVdGlsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gX2ZkeC5wYWdlRmxhZyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9zYXRlbGxpdGUuc2V0VmFyKCdhd09yYW5nZUJ0bkxhYmVsJywgbiksICExICE9PSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzY4NmI4ZjBjNDUyMC80Y2U0MDFjNTFiNTEvNjgwNzZhY2JhMmNjL1JDM2Q5NDlmMjIzZGNmNDRkZDgzZWQxYzNiYmU0OTgwOTAtc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMODRjNGUxM2Q5MTYxNDFiOWE2YjQ4ZjhjZTZkOTRkMDMnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdnVGFnOmN0YU9yYW5nZUZCJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJ2EuZnhnLWJ1dHRvbi5meGctYnV0dG9uLS1vcmFuZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRQcm9wZXJ0aWVzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2RhdGEtYW5hbHl0aWNzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnKGhlcm9cXHxBcHBseSBOb3cpfChoZXJvXFx8R2V0IFN0YXJ0ZWQpfChsaW5rXFx8U3RhcnQgT3JkZXIpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNjAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6Y3RhT3JhbmdlRkJQYWdlTGlzdE1hcHBpbmcnKSwgdCA9IHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIF9mZHggJiYgX3NhdGVsbGl0ZS5nZXRWYXIoJ19mZHhVdGlsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gX2ZkeC5wYWdlRmxhZyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09IHR5cGVvZiBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUodGhpcy5jbGFzc05hbWUpLCBpID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcignZmJPcmFuZ2VFdmVudCcsIF9mZHguZ2V0R3RhZ0xhYmVsKG4sIHIsIGkpKSwgITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9zYXRlbGxpdGUuc2V0VmFyKCdmYk9yYW5nZUV2ZW50JywgbiksICExICE9PSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzY4NmI4ZjBjNDUyMC80Y2U0MDFjNTFiNTEvNjgwNzZhY2JhMmNjL1JDMThhMTZjZDEzYjIwNGU3Nzk5M2EwYjk5MTA0MmMzN2Mtc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMODQ0OGQwMzUwYjhjNDc3ZmFhMDU1NDkwN2ZiYzQyNzAnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdnVGFnOkJ1dHRvbkV2ZW50X1Bvc3NpYmlsaXRpZXMnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5jaG9yRGVsYXk6IDEwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcjc3Vic2NyaWJlYnV0dG9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IF9zYXRlbGxpdGUuZ2V0VmFyKCdnVGFnOkVuYWJsZWRMb2NhbGVFcGljJykgJiYgbnVsbCAhPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6RW5hYmxlZExvY2FsZUVwaWMnKSAmJiAnJyAhPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6RW5hYmxlZExvY2FsZUVwaWMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9wYXRoQW5kUXVlcnlzdHJpbmcuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aHM6IFt7IHZhbHVlOiAnL2Fib3V0L3Bvc3NpYmlsaXRpZXMnIH1dIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzY4NmI4ZjBjNDUyMC80Y2U0MDFjNTFiNTEvNjgwNzZhY2JhMmNjL1JDNDc1NzdlMTVlZjEwNDJlNTgzZDI1OTNkNDU4M2VlMDUtc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZTU4MTUzZjg2MWQxNGMwZjkyZjExMGI4MjgzYWI2MWYnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdnVGFnOkRGQUV2ZW50JywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9mZHgucGNmVXRpbCgpLm1hdGNoKC93d3coc2JveC5pZGV2fGJhc2UuaWRldnxkZXYuaWRldnxkcnQuaWRldnxzdHJlc3MuZG16LmlkZXZ8Yml0LmlkZXZ8dGVzdHwpLmZlZGV4LmNvbS9naSksIHQgPSAnJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignZ1RhZ0Rpc2FibGVMb2NhbGUnKSwgbiA9IHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZSwgciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OmNvdW50cnlDb2RlJyksIGkgPSBfc2F0ZWxsaXRlLmdldFZhcignZ1RhZzpERkFFdmVudE1hcHBpbmcnKSwgYSA9IF9mZHgucGFnZUZsYWcoaSwgciwgJ2NvdW50cnknKSwgbyA9IF9mZHgucGFnZUZsYWcoYSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcignZGNMYWJlbCcsIG8pLCAhKG51bGwgPT09IGUgfHwgITEgPT09IG8gJiYgIXQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnPHNjcmlwdD5cbiAgZ3RhZyhcJ2V2ZW50XCcsIFwnY29udmVyc2lvblwnLFxuICAgIHtcbiAgICAgICAgImFsbG93X2N1c3RvbV9zY3JpcHRzIjogZmFsc2UsXG4gICAgICAgIFwnc2VuZF90b1wnOiBfc2F0ZWxsaXRlLmdldFZhcigiZGNMYWJlbCIpXG4gICAgfSk7XG48L3NjcmlwdD5cbjwhLS1cbnZhciBkZmFNYXBwaW5nID0gX3NhdGVsbGl0ZS5nZXRWYXIoImdUYWc6REZBRXZlbnRNYXBwaW5nIik7ICBcbnZhciB1cmwgPSB3aW5kb3cubG9jYXRpb24uaHJlZjtcbnVybCA9ICAvLmNvbSguKikvLmV4ZWModXJsKVsxXTtcbnZhciBvYmpERkEgPSIiOyBcbnZhciBldmVudF90eXBlID0gIiI7XG52YXIgZXZlbnRfbmFtZSA9ICIiO1xudmFyIGV2ZW50X3BhcmFtID0gIiI7XG5pZiAoKHR5cGVvZiBkZmFNYXBwaW5nICE9PSAidW5kZWZpbmVkIiAmJiBkZmFNYXBwaW5nICE9PSAiIikgJiYgKHR5cGVvZiB1cmwgIT09ICJ1bmRlZmluZWQiICYmIHVybCAhPT0gIiIpKXtcblx0Zm9yKHZhciBrZXkgaW4gZGZhTWFwcGluZyl7XHRcdFx0XHRcblx0XHRpZih1cmwuaW5kZXhPZihrZXkpID4gLTEpe1xuXHRcdFx0b2JqREZBID0gZGZhTWFwcGluZ1trZXldO1x0XHRcdCBcblx0XHRcdGJyZWFrO1x0XHRcdFx0ICBcblx0XHR9XG5cdH1cbn0gIFxuaWYgKCh0eXBlb2Ygb2JqREZBICE9PSAidW5kZWZpbmVkIiAmJiBvYmpERkEgIT09ICIiKSApe1xuXHRldmVudF90eXBlID0gb2JqREZBWyJldmVudF90eXBlIl07XG5cdGV2ZW50X25hbWUgPSBvYmpERkFbImV2ZW50X25hbWUiXTtcblx0ZXZlbnRfcGFyYW0gPSBvYmpERkFbImV2ZW50X3BhcmFtIl07XG59XG5ndGFnKGV2ZW50X3R5cGUsIGV2ZW50X25hbWUsIGV2ZW50X3BhcmFtKTtcbjwvc2NyaXB0Pi0tPicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdodG1sJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYWFjZmE1ZGFiYTcxNDA5MGJjNmMxOTIyMTVhY2VhYjInLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdnVGFnOlRhcmdldEV4cGVyaWVuY2UnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5jaG9yRGVsYXk6IDEyMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYS5meGctYnV0dG9uLmZ4Zy1idXR0b24tLW9yYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFByb3BlcnRpZXM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZGF0YS1hbmFseXRpY3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICcoVFBcXHwpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvcGF0aC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGhzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnXFwvZW4tdXNcXC9zaGlwcGluZ1xcLyhpbnRlcm5hdGlvbmFsLmh0bWx8Ny1kYXktZGVsaXZlcnkuaHRtbHxob21lLWRlbGl2ZXJ5Lmh0bWwpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogJy9lbi11cy9lY29tbWVyY2UvdG9vbHMtYW5kLXNlcnZpY2VzLmh0bWwnIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6VGFyZ2V0RW5hYmxlZE1hcHBpbmcnKSwgdCA9IHRoaXMuZ2V0QXR0cmlidXRlKCdkYXRhLWFuYWx5dGljcycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyA9PSB0eXBlb2YgX2ZkeCAmJiBfc2F0ZWxsaXRlLmdldFZhcignX2ZkeFV0aWwnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBfZmR4LnBhZ2VGbGFnKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3NhdGVsbGl0ZS5zZXRWYXIoJ3RhcmdldEd0YWdMYWJlbCcsIG4pLCAhMSAhPT0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQzNiNTBhY2M1MDk0MjQ1MjZhOTIwMDg4NjVhM2E4ODIxLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGU3Y2I5YjQxYTU4MTQzM2RiNTNhOWFlYThhYmIyODEzJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAndmlkZW86MjUlIFZpZXdlZCcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvbWVkaWFUaW1lUGxheWVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5pdDogJ3BlcmNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFtb3VudDogMjUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnLmJyaWdodGNvdmUtY29udGFpbmVyIHZpZGVvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IHRoaXMucGFyZW50RWxlbWVudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSB0aGlzLnBhcmVudEVsZW1lbnQuZ2V0QXR0cmlidXRlKCdpZCcpLCByID0gdGhpcy5wYXJlbnRFbGVtZW50LmdldEF0dHJpYnV0ZSgnZGF0YS12aWRlby1pZCcpLCBpID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeUNsYXNzTmFtZSgnYnJpZ2h0Y292ZS1jb250YWluZXInKSwgYSA9IDA7IGEgPCBpLmxlbmd0aDsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9PSBpW2FdLmdldEF0dHJpYnV0ZSgnZGF0YS1wbGF5ZXJpZCcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoJ3Zqcy1kb2NrLXRpdGxlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmVWYXI0MiA9IG9bYV0uaW5uZXJUZXh0LCB0LmVWYXIzMSA9IHIsIHQubGlua1RyYWNrVmFycyA9IHQuYXBsKHQubGlua1RyYWNrVmFycywgJ2VWYXI0MixlVmFyMzEnLCAnLCcsIDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDIwNCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnVmlkZW86MjUlIFZpZXcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDQ2NTU5ZjE2OWNhZDQ5OWU4ZmEwYzRiMWZhOGE1MmQwJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAndmlkZW86NzUlIFZpZXdlZCcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvbWVkaWFUaW1lUGxheWVkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5pdDogJ3BlcmNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFtb3VudDogNzUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnLmJyaWdodGNvdmUtY29udGFpbmVyIHZpZGVvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IHRoaXMucGFyZW50RWxlbWVudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSB0aGlzLnBhcmVudEVsZW1lbnQuZ2V0QXR0cmlidXRlKCdpZCcpLCByID0gdGhpcy5wYXJlbnRFbGVtZW50LmdldEF0dHJpYnV0ZSgnZGF0YS12aWRlby1pZCcpLCBpID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeUNsYXNzTmFtZSgnYnJpZ2h0Y292ZS1jb250YWluZXInKSwgYSA9IDA7IGEgPCBpLmxlbmd0aDsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9PSBpW2FdLmdldEF0dHJpYnV0ZSgnZGF0YS1wbGF5ZXJpZCcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoJ3Zqcy1kb2NrLXRpdGxlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmVWYXI0MiA9IG9bYV0uaW5uZXJUZXh0LCB0LmVWYXIzMSA9IHIsIHQubGlua1RyYWNrVmFycyA9IHQuYXBsKHQubGlua1RyYWNrVmFycywgJ2VWYXI0MixlVmFyMzEnLCAnLCcsIDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5saW5rVHJhY2tFdmVudHMgPSB0LmV2ZW50cyA9ICdldmVudDIwNic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnVmlkZW86NzUlIFZpZXdlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYjMyOGNlODgxNmJhNDhkOWI2ZDg0Y2FiNjM0ZjRhY2UnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdzZWFyY2hSZXN1bHRUcmFjaycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcuY3Etc25wLXJlc3VsdHNldC1oZWFkZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5saW5rVHJhY2tWYXJzID0gJ3Byb3AzMSxlVmFyNDMscHJvcDUxLGVWYXI1MSxlVmFyNTMscHJvcDI5LHByb3AxOCxwcm9wMTkscHJvcDIwLGV2ZW50cycsIHQubGlua1RyYWNrRXZlbnRzID0gJ05vbmUnLCB0LmxpbmtUcmFja0V2ZW50cyA9IHQuZXZlbnRzID0gJ2V2ZW50MTIyJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcy5maXJzdEVsZW1lbnRDaGlsZC5ocmVmLCByID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ3NlYXJjaDp0ZXJtJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gciArICd8JyArIG4sIHQuZVZhcjQzID0gJ0w6SW50U3JjaDonICsgciwgdC5lVmFyNTEgPSB0LnByb3A1MSA9IG4sIHQuZVZhcjUzID0gJysxJywgdC5wcm9wMTggPSB0LnBhZ2VOYW1lLCB0LnByb3AxOSA9IG4sIHQucHJvcDIwID0gdC5wYWdlTmFtZSArICc6JyArIG4sIHQucHJvcDMxID0gJycgIT09IHQudmlzaXRvci5nZXRBbmFseXRpY3NWaXNpdG9ySUQoKSA/ICdbQ1NddjF8JyArIHQudmlzaXRvci5nZXRBbmFseXRpY3NWaXNpdG9ySUQoKSArICdbQ0VdJyA6IHQudmlzaXRvci5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCgpLCBubHRyayA9ICd5JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdTZWFyY2ggUmVzdWx0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw5ZTFkNTA4ZmUwMGY0NTg3ODU2MzYxNjhkNmY3NWRmYScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2V2ZW50OnZhUG9waW4gY2xpY2snLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RhdGFFbGVtZW50Q2hhbmdlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IG5hbWU6ICdldmVudDp2YUNsaWNrJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdm9pZCAwICE9PSBGRFguREFUQUxBWUVSLlZBICYmIEZEWC5EQVRBTEFZRVIuVkEgPyBGRFguREFUQUxBWUVSLlZBIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT0gdHlwZW9mIGZkeF9sb2dDaGF0ICYmIGUgJiYgZmR4X2xvZ0NoYXQoZSwgJ3ZhX05JTkEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy92YWx1ZUNvbXBhcmlzb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wYXJpc29uOiB7IG9wZXJhdG9yOiAnbGVzc1RoYW5PckVxdWFsJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnRPcGVyYW5kOiAnJXZhOnZlcnNpb24gbnVtYmVyJScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlnaHRPcGVyYW5kOiAyMDIxMTAyNjE1MzAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW10KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDJmZGU1ZTQwOGU1YjQ3OTZiMTE2NmQ3NDEwOTAyNTNjJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZXZlbnQ6aHAgbGluayBjbGljaycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICdhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50UHJvcGVydGllczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdkYXRhLWFuYWx5dGljcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJy4qJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdm9pZCAwICE9PSB0aGlzLmdldEF0dHJpYnV0ZSgnZGF0YS1hbmFseXRpY3MnKSA/IHRoaXMuZ2V0QXR0cmlidXRlKCdkYXRhLWFuYWx5dGljcycpIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubGlua05hbWUgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHZvaWQgMCAhPT0gdGhpcy5nZXRBdHRyaWJ1dGUoJ3RhcmdldCcpICYmIG51bGwgIT09IHRoaXMuZ2V0QXR0cmlidXRlKCd0YXJnZXQnKSAmJiAnJyAhPT0gdGhpcy5nZXRBdHRyaWJ1dGUoJ3RhcmdldCcpID8gJ25ld1BhZ2UnIDogJ3NhbWVQYWdlJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCcnICE9IGUgJiYgZS5pbmRleE9mKCdtZnhyJykgPiAtMSAmJiAodCA9ICdzYW1lUGFnZScpLCAnc2FtZVBhZ2UnID09IHQgJiYgZS5pbmRleE9mKCcvY29udGVudC9kYW0vZmVkZXgnKSA+IC0xKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSAnJywgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2NsaWNrOmJsb2NrRmxhZycpKGUsICdjbGljazpibG9ja0xpc3QnKSwgciA9IHsgaGVybzogJ2V2ZW50MjAwJyB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUgfHwgbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGRFguREFUQUxBWUVSLnBhZ2UubGluay5kYXRhID0gJycsIEZEWC5EQVRBTEFZRVIucGFnZS5saW5rLnR5cGUgPSAnJywgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnbmV3UGFnZScgPT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGRFguREFUQUxBWUVSLnBhZ2UubGluay5kYXRhID0gJycsIEZEWC5EQVRBTEFZRVIucGFnZS5saW5rLnR5cGUgPSAnJywgZmR4X3NldExpbmtWaWV3KGUpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzYW1lUGFnZScgPT0gdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSByW2Uuc3BsaXQoJ3wnKVswXS50b0xvd2VyQ2FzZSgpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGRFguREFUQUxBWUVSLnBhZ2UubGluay5kYXRhID0gJycsIEZEWC5EQVRBTEFZRVIucGFnZS5saW5rLnR5cGUgPSAnJywgdGhpcy5ocmVmLmluZGV4T2YoJ3RlbDonKSA+IC0xIHx8IGZkeF9sb2dMaW5rVmlldyhlLCBpKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFtdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwwODE0NTBjMjFkMTQ0YzBjODA0NmFiZjQwNTkzYTBlYicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Zlcml6b246Y3RhT3JhbmdlQnV0dG9uJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICdidXR0b24uZnhnLWJ1dHRvbi5meGctYnV0dG9uLS1zdWJtaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRQcm9wZXJ0aWVzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2RhdGEtYW5hbHl0aWNzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnKEZvcm1cXHxGcmVpZ2h0IFF1b3RlIHdpdGggQWNjb3VudCl8KEZvcm1cXHxFTi1GcmVpZ2h0IFF1b3RlLU5vLUFjY291bnQpfChGb3JtXFx8RlItRnJlaWdodCBRdW90ZS1Oby1BY2NvdW50KXwoRm9ybVxcfEZSLUZyZWlnaHQgUXVvdGUpfChGb3JtXFx8QmV5b25kIHRoZSBCdXkgQnV0dG9uKXwoRm9ybVxcfEJleW9uZCB0aGUgQnV5IEJ1dHRvbi1GUil8KEZvcm1cXHxIZWFsdGhjYXJlXFx8Q29udGFjdCBVcyl8KEZvcm1cXHxIZWFsdGhjYXJlXFx8Q29udGFjdCBVcyAtIENBRlIpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbmNob3JEZWxheTogNjAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICdhLmZ4Zy1idXR0b24uZnhnLWJ1dHRvbi0tb3JhbmdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50UHJvcGVydGllczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdkYXRhLWFuYWx5dGljcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyhsaW5rXFx8U3RhcnQgeW91ciBxdW90ZSl8KGxpbmtcXHxDb21tZW5jZXogdm90cmUgZXN0aW1hdGlvbiknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuY2hvckRlbGF5OiAxMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYS5meGctYnV0dG9uLmZ4Zy1idXR0b24tLW9yYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFByb3BlcnRpZXM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZGF0YS1hbmFseXRpY3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICcoaGVyb1xcfEZJTkQgQSBKT0IpfChoZXJvXFx8VFJPVVZFUiBVTiBFTVBMT0kpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbmNob3JEZWxheTogNjAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICdhLmZ4Zy1saW5rLmZ4Zy1idXR0b24uZnhnLWJ1dHRvbi0tb3JhbmdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50UHJvcGVydGllczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdkYXRhLWFuYWx5dGljcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyhsaW5rXFx8UkVRVUVTVCBBIENPTlNVTFRBVElPTi1GUil8KGxpbmtcXHxSRVFVRVNUIEEgQ09OU1VMVEFUSU9OKScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL3BhdGguanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ1xcLygoZW58ZnIpLWNhKVxcL3NoaXBwaW5nLXRvb2xzXFwvKGZyZWlnaHQtcXVvdGUuaHRtbHxmcmVpZ2h0LXF1b3RlLW5vLWFjY291bnQuaHRtbCknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ1xcLygoZW58ZnIpLWNhKVxcL3NtYWxsLWJ1c2luZXNzXFwvZWNvbW1lcmNlLXNvbHV0aW9ucy5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICcobGlua1xcfFN0YXJ0IHlvdXIgcXVvdGUpfChsaW5rXFx8Q29tbWVuY2V6IHZvdHJlIGVzdGltYXRpb24pJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC8oKGVufGZyKS1jYSlcXC9jYXJlZXJzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ1xcLygoZW58ZnIpLWNhKVxcL3NoaXBwaW5nLXNlcnZpY2VzXFwvaGVhbHRoY2FyZS5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC8oKGVufGZyKS1jYSlcXC9zaGlwcGluZy1zZXJ2aWNlc1xcL2hlYWx0aGNhcmVcXC9jb250YWN0LXVzLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCd2ZXJpem9uQnRuQ2xpY2tNYXBwaW5nJyksIHQgPSB0aGlzLmdldEF0dHJpYnV0ZSgnZGF0YS1hbmFseXRpY3MnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIF9mZHggJiYgX3NhdGVsbGl0ZS5nZXRWYXIoJ19mZHhVdGlsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gX2ZkeC5wYWdlRmxhZyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9zYXRlbGxpdGUuc2V0VmFyKCdwaXhlbElkJywgblswXSksIF9zYXRlbGxpdGUuc2V0VmFyKCdFQycsIG5bMV0pLCAhMSAhPT0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQzVkMzQwZTJiYjUyYjRkMTI4MzAxZmRiZTBkODExMzdhLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGYzMThhN2U3NGQxMDQxMmVhNmIyN2M5N2RlYjcwNDkwJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY29udGVudDphbGwgcGFnZXMnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEodm9pZCAwICE9PSBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpEZWxheWVkIFBhZ2UgVHlwZScpICYmICdkZWxheWVkJyA9PSBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpEZWxheWVkIFBhZ2UgVHlwZScpIHx8IHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoJ3NlYXJjaC5odG1sP3E9JykgPiAtMSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmRleE9mKCdyZWdpc3RlcicpID4gLTEgfHwgd2luZG93LmxvY2F0aW9uLmhyZWYuaW5kZXhPZignL29ubGluZS9yYXRpbmcuaHRtbCcpID4gLTEgfHwgd2luZG93LmxvY2F0aW9uLmhyZWYuaW5kZXhPZignL29ubGluZS9zaGlwcGluZy5odG1sJykgPiAtMSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmRleE9mKCcvdXNlci1wcm9maWxlLWNvbXBsZXRpb24vZW1haWw/bG9jYWxlJykgPiAtMSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmRleE9mKCcvZmVkZXh0cmFja2luZy8nKSA+IC0xIHx8IHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoJ2ZlZGV4LmNvbS9mZG1lbnJvbGxtZW50LycpID4gLTEgfHwgd2luZG93LmxvY2F0aW9uLmhyZWYuaW5kZXhPZignL3NoaXBtZW50LWhpc3RvcnknKSA+IC0xIHx8IHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoJy9mZWRleHRyYWNrL2RpZ2l0YWwtY29kZScpID4gLTEgfHwgd2luZG93LmxvY2F0aW9uLmhyZWYuaW5kZXhPZignL2ZlZGV4dHJhY2svP3Rva2VuJykgPiAtMSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmRleE9mKCcvZmVkZXh0cmFjay8/dHJrbmJyJykgPiAtMSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmRleE9mKCcvZmVkZXh0cmFjay8/YWN0aW9uPXRyYWNrJnRyYWNrbnVtYmVycycpID4gLTEgfHwgd2luZG93LmxvY2F0aW9uLmhyZWYuaW5kZXhPZignL2ZlZGV4dHJhY2svP2FjdGlvbj10cmFjayZ0cmFja2luZ251bWJlcicpID4gLTEgfHwgd2luZG93LmxvY2F0aW9uLmhyZWYuaW5kZXhPZignL2ZlZGV4dHJhY2svP3RyYWNraW5nbnVtYmVyJykgPiAtMSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmRleE9mKCcvZ2V0cmV3YXJkcy5mZWRleC5jb20nKSA+IC0xIHx8IHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoJ3NoaXBvbmxpbmUvIy9zaGlwbWVudD9zZWN0aW9uPVRvJykgPiAtMSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmRleE9mKCdzaGlwb25saW5lJykgPiAtMSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmRleE9mKCc/c2VhcmNoPXRydWUnKSA+IC0xIHx8IHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoJy9mZWRleHRyYWNrLz9hY3Rpb249dHJhY2smdHJhY2tudW1iZXInKSA+IC0xIHx8IHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoJy9mZWRleHRyYWNrL25vLXJlc3VsdHMtZm91bmQ/dHJrbmJyJykgPiAtMSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmRleE9mKCcvZmVkZXh0cmFjay8/dHJrbmJyJykgPiAtMSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmRleE9mKCcvc2hpcHBpbmcvZnJlaWdodC1zZXJ2aWNlcy9pbnRlcm5hdGlvbmFsLWFpci1mcmVpZ2h0LXF1b3RlL2dlbmVyaWNfdGhhbmt5b3UuaHRtbCcpID4gLTEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ3dpbmRvdy5mZHhfbG9jYWxlID0gX3NhdGVsbGl0ZS5nZXRWYXIoImNvbnRlbnQ6bG9jYWxlIik7JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIzMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVzaXRlLWRpYWdub3N0aWNzOnZpZXdwb3J0JScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIzOCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnBhZ2UgbmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNTgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclZXh0ZXJuYWwtY2FtcGFpZ246bGluayUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3AyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6Y291bnRyeUNvZGUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpsYW5ndWFnZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnJlZ2lvbiUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMjAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpwYWdlIG5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDIzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6aGlzdG9yaWNhbFBhZ2VOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3AzMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnBhZ2UgdHlwZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMzgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhbGlhcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdlVmFyMzgnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wNTgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhbGlhcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdlVmFyNTgnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wNjcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhbGlhcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdlVmFyMzAnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5uZWw6ICclY29udGVudDpzaXRlIHNlY3Rpb24lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FtcGFpZ246IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdxdWVyeVBhcmFtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnQ01QJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlTmFtZTogJyVjb250ZW50OnBhZ2UgbmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxiNzVjNGM2MWI2YWY0OTliOGJmZGVmZTM1OGQ3MDE1ZScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ21lZGFsbGlhJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9wYXRoQW5kUXVlcnlzdHJpbmcuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJy8oKChlbnxmcnxkZXxpdCktY2gpfChoZS1pbCl8KHJ1LXJ1KXwodHItdHIpfCh1ay11YSkpL3RyYWNraW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJy8oKGVuLShpbHxydXx0cikpfChmci1mcil8KChlbnxkZXxpdCktY2gpfChoZS1pbCl8KHJ1LXJ1KXwodHItdHIpfCgoZW58cnV8dWspLXVhKSkvb25saW5lL3NoaXBwaW5nLmh0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICd2YXIgdmVyc2lvbiA9ICIyMDA2LjA3MjQyMDIwLjAxIjtcbmlmICh3aW5kb3cubG9jYXRpb24uaG9zdG5hbWUgPT0gInd3dy5mZWRleC5jb20iIHx8IHdpbmRvdy5sb2NhdGlvbi5ob3N0bmFtZSA9PSAid3d3LnNwYWluLmZlZGV4LmNvbSIpIHtcbiAgICB3aW5kb3cuTURJR0lUQUxfT05fUFJFTV9QUkVGSVggPSAiaHR0cHM6Ly9vbi1wcmVtLmthbXB5bGUuY29tL0ZlZGV4UHJvZC9DT0xPIjtcbn0gZWxzZSB7XG4gICAgd2luZG93Lk1ESUdJVEFMX09OX1BSRU1fUFJFRklYID0gImh0dHBzOi8vb24tcHJlbS5rYW1weWxlLmNvbS9GZWRleFRlc3QvQ09MTyI7XG59XG4oZnVuY3Rpb24oKSB7XG4gICAgaWYgKCF3aW5kb3cuS0FNUFlMRV9FTUJFRCkge1xuICAgICAgICB2YXIgb25QcmVtRW1iZWRSZWdleCA9IC9cXC9bYS16QS1aXFxkLV0rXFwvXFxkK1xcL29uc2l0ZVxcL21lZGFsbGlhLWRpZ2l0YWwtZW1iZWRcXC5qcyQvO1xuICAgICAgICB2YXIgZ2VuZXJpY1BhdGhSZWdleCA9IC9cXC9bYS16QS1aXFxkLV0rXFwvXFxkK1xcL29uc2l0ZVxcL2dlbmVyaWNcXGR7MTN9XFwuanMkLztcbiAgICAgICAgd2luZG93LktBTVBZTEVfRU1CRUQgPSB7XG4gICAgICAgICAgICBrYW1weWxlSW5pdDogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgdmFyIHQgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KFwnc2NyaXB0XCcpO1xuICAgICAgICAgICAgICAgIHQudHlwZSA9IFwndGV4dC9qYXZhc2NyaXB0XCc7XG4gICAgICAgICAgICAgICAgdC5hc3luYyA9IHRydWU7XG4gICAgICAgICAgICAgICAgdC5zcmMgPSBLQU1QWUxFX0VNQkVELmdldEdlbmVyaWNMb2NhdGlvbigpO1xuICAgICAgICAgICAgICAgIHQuY2hhcnNldCA9IFwnVVRGLThcJztcbiAgICAgICAgICAgICAgICBkb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKHQpO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGthbXB5bGVMb2FkTG9nZ2VyOiBmdW5jdGlvbigpIHt9LFxuICAgICAgICAgICAga2FtcHlsZUV2ZW50SGFuZGxlcjogZnVuY3Rpb24oZWxlbSwgZXZlbnRUeXBlLCBoYW5kbGVyKSB7XG4gICAgICAgICAgICAgICAgaWYgKGVsZW0uYWRkRXZlbnRMaXN0ZW5lcikge1xuICAgICAgICAgICAgICAgICAgICBlbGVtLmFkZEV2ZW50TGlzdGVuZXIoZXZlbnRUeXBlLCBoYW5kbGVyLCBmYWxzZSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChlbGVtLmF0dGFjaEV2ZW50KSB7XG4gICAgICAgICAgICAgICAgICAgIGVsZW0uYXR0YWNoRXZlbnQoXCdvblwnICsgZXZlbnRUeXBlLCBoYW5kbGVyKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgaXNTdXBwb3J0ZWQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSB7XG4gICAgICAgICAgICAgICAgICAgIGlzSUU6IGZhbHNlLFxuICAgICAgICAgICAgICAgICAgICB0cnVlVmVyc2lvbjogMCxcbiAgICAgICAgICAgICAgICAgICAgYWN0aW5nVmVyc2lvbjogMCxcbiAgICAgICAgICAgICAgICAgICAgY29tcGF0aWJpbGl0eU1vZGU6IGZhbHNlXG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICB2YXIgdHJpZGVudCA9IHdpbmRvdy5LQU1QWUxFX0VNQkVELmdldFVzZXJBZ2VudCgpLm1hdGNoKC9UcmlkZW50XFwvKFxcZCspLyk7XG4gICAgICAgICAgICAgICAgaWYgKHRyaWRlbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LmlzSUUgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQudHJ1ZVZlcnNpb24gPSBwYXJzZUludCh0cmlkZW50WzFdLCAxMCkgKyA0O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB2YXIgbXNpZSA9IG5hdmlnYXRvci51c2VyQWdlbnQubWF0Y2goL01TSUUgKFxcZCspLyk7XG4gICAgICAgICAgICAgICAgaWYgKG1zaWUpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LmlzSUUgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQuYWN0aW5nVmVyc2lvbiA9IHBhcnNlSW50KG1zaWVbMV0pO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdC5hY3RpbmdWZXJzaW9uID0gcmVzdWx0LnRydWVWZXJzaW9uO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAocmVzdWx0LmlzSUUgJiYgcmVzdWx0LnRydWVWZXJzaW9uID4gMCAmJiByZXN1bHQuYWN0aW5nVmVyc2lvbiA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0LmNvbXBhdGliaWxpdHlNb2RlID0gcmVzdWx0LnRydWVWZXJzaW9uICE9IHJlc3VsdC5hY3RpbmdWZXJzaW9uO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gIXJlc3VsdC5pc0lFIHx8IHJlc3VsdC50cnVlVmVyc2lvbiA+IDkgfHwgKHJlc3VsdC5hY3RpbmdWZXJzaW9uID49IDkgJiYgcmVzdWx0LmNvbXBhdGliaWxpdHlNb2RlKTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBnZXRVc2VyQWdlbnQ6IGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBuYXZpZ2F0b3IudXNlckFnZW50O1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGdldEdlbmVyaWNMb2NhdGlvbjogZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgdmFyIGdlbmVyaWNMb2NhdGlvbiA9IGxvY2F0aW9uLnByb3RvY29sICsgXCcvL1wnICsgXCdyZXNvdXJjZXMuZGlnaXRhbC1jbG91ZC1wcmVtLm1lZGFsbGlhLmV1L3dkY2V1cHJlbS8xMDE4OS9vbnNpdGUvZ2VuZXJpYzE1ODI5MTIwMzYwMTMuanNcJztcbiAgICAgICAgICAgICAgICB2YXIgZ2VuZXJpY1BhdGggPSAoZ2VuZXJpY0xvY2F0aW9uLm1hdGNoKGdlbmVyaWNQYXRoUmVnZXgpIHx8IFtdKVswXTtcbiAgICAgICAgICAgICAgICBnZW5lcmljTG9jYXRpb24gPSB3aW5kb3cuS0FNUFlMRV9FTUJFRC5nZXRSZXNvdXJjZXNQcmVmaXgoKSArIGdlbmVyaWNQYXRoO1xuICAgICAgICAgICAgICAgIHJldHVybiBnZW5lcmljTG9jYXRpb247XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgaXNPblByZW1TY3JpcHQ6IGZ1bmN0aW9uKHNjcmlwdFBhdGgpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gb25QcmVtRW1iZWRSZWdleC50ZXN0KHNjcmlwdFBhdGgpO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGlzT25QcmVtOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICBpZiAod2luZG93Lk1ESUdJVEFMX09OX1BSRU1fUFJFRklYKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB2YXIgc2NyaXB0cyA9IChkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZShcJ3NjcmlwdFwnKSB8fCBbXSk7XG4gICAgICAgICAgICAgICAgaWYgKCEoc2NyaXB0cyAmJiBzY3JpcHRzLmxlbmd0aCkpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gc2NyaXB0cy5sZW5ndGggLSAxOyBpID49IDA7IGktLSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LktBTVBZTEVfRU1CRUQuaXNPblByZW1TY3JpcHQoc2NyaXB0c1tpXS5zcmMpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgZ2V0UmVzb3VyY2VzUHJlZml4OiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICBpZiAod2luZG93Lk1ESUdJVEFMX09OX1BSRU1fUFJFRklYKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuTURJR0lUQUxfT05fUFJFTV9QUkVGSVg7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHZhciBzY3JpcHRzID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoXCdzY3JpcHRcJyk7XG4gICAgICAgICAgICAgICAgdmFyIG5lZWRlZFNyY1BhdGggPSBudWxsO1xuICAgICAgICAgICAgICAgIHZhciBpID0gMDtcbiAgICAgICAgICAgICAgICB3aGlsZSAoc2NyaXB0cyAmJiAhbmVlZGVkU3JjUGF0aCAmJiBpIDwgc2NyaXB0cy5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNjcmlwdHNbaV0uc3JjICYmIG9uUHJlbUVtYmVkUmVnZXgudGVzdChzY3JpcHRzW2ldLnNyYykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5lZWRlZFNyY1BhdGggPSBzY3JpcHRzW2ldLnNyYztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpKys7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChuZWVkZWRTcmNQYXRoKSB7XG4gICAgICAgICAgICAgICAgICAgIHdpbmRvdy5NRElHSVRBTF9PTl9QUkVNX1BSRUZJWCA9IG5lZWRlZFNyY1BhdGgucmVwbGFjZShvblByZW1FbWJlZFJlZ2V4LCBcJ1wnKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5NRElHSVRBTF9PTl9QUkVNX1BSRUZJWDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5sb2NhdGlvbiAmJiB3aW5kb3cubG9jYXRpb24ub3JpZ2luKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubG9jYXRpb24ub3JpZ2luO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gXCdcJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgaWYgKHdpbmRvdy5LQU1QWUxFX0VNQkVELmlzU3VwcG9ydGVkKCkpIHtcbiAgICAgICAgICAgIGlmIChkb2N1bWVudC5yZWFkeVN0YXRlID09PSBcJ2NvbXBsZXRlXCcpIHtcbiAgICAgICAgICAgICAgICB3aW5kb3cuS0FNUFlMRV9FTUJFRC5rYW1weWxlSW5pdCgpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB3aW5kb3cuS0FNUFlMRV9FTUJFRC5rYW1weWxlRXZlbnRIYW5kbGVyKHdpbmRvdywgXCdsb2FkXCcsIHdpbmRvdy5LQU1QWUxFX0VNQkVELmthbXB5bGVJbml0KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cbn0pKCk7JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2phdmFzY3JpcHQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmZmE1MGJhY2Y0OGQ0MWU5OWIzOGMzMWJmMTM3NGY2YycsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2V2ZW50OmZvcm1TdWJtaXRCdXR0b24nLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYnV0dG9uLmZ4Zy1idXR0b24uZnhnLWJ1dHRvbi0tb3JhbmdlICcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFByb3BlcnRpZXM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZGF0YS1hbmFseXRpY3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICcoRm9ybVxcfEVOLUZyZWlnaHQgUXVvdGUtTm8tQWNjb3VudCl8KEZvcm1cXHxTdWJtaXQgQnV0dG9uLUxvZ2lzdGljcyBDb250YWN0IFVzKXwoRm9ybVxcfFNvdW1ldHRyZS1Mb2dpc3RpY3MgQ29udGFjdCBVcy1GUil8KG15cXVvdGVcXHxTdWJtaXQgYSBRdW90ZSknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLmdldEF0dHJpYnV0ZSgnZGF0YS1hbmFseXRpY3MnKSwgdCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRm9ybXxFTi1GcmVpZ2h0IFF1b3RlLU5vLUFjY291bnQnOiAnZXZlbnQxOTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGb3JtfFN1Ym1pdCBCdXR0b24tTG9naXN0aWNzIENvbnRhY3QgVXMnOiAnZXZlbnQxOTQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGb3JtfFNvdW1ldHRyZS1Mb2dpc3RpY3MgQ29udGFjdCBVcy1GUic6ICdldmVudDE5NCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ215cXVvdGV8U3VibWl0IGEgUXVvdGUnOiAnZXZlbnQzMDknCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gX2ZkeC5wYWdlRmxhZyh0LCBlKSwgX3NhdGVsbGl0ZS5zZXRWYXIoJ2Zvcm1FdmVudCcsIG4pLCAndW5kZWZpbmVkJyAhPT0gbiAmJiAnJyAhPT0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdmb3JtRXZlbnQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogeyBldmVudHM6IFt7IG5hbWU6ICdldmVudDMwOScgfV0gfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYjU5Y2U5MjVmOTI1NDk0MDk2YmZmMTFhMmIxYWU4NjYnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdhZFRhZzpkZmEnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBfc2F0ZWxsaXRlLmdldFZhcignZGZhOnBhZ2VMaXN0TWFwcGluZycpLCB0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6Y291bnRyeUNvZGUnKSwgbiA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gLy5jb20oLiopLy5leGVjKG4pWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IDEwMDAwMDAwMDAwMDAwICogKE1hdGgucmFuZG9tKCkgKyAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IF9mZHgucGFnZUZsYWcoZSwgdCwgJ2NvdW50cnknKSwgYSA9IF9mZHgucGFnZUZsYWcoaSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcignZGZhTGFiZWwnLCBhICsgciksICExICE9PSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnPGlmcmFtZSBzcmM9IiVkZmFMYWJlbCUiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZyYW1lYm9yZGVyPSIwIiBzdHlsZT0iZGlzcGxheTpub25lIj48L2lmcmFtZT4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDliZmViM2RmMTBjNzRhNGY5ZTY3ZWMwMGE2MTQxODk4JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAncmVjdGFnOkNvbnRlbnRTcXVhcmUnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RvbVJlYWR5LmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9wYXRoQW5kUXVlcnlzdHJpbmcuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ1xcLyhlbi11cylcXC8ocHJpbnRpbmd8b2ZmaWNlKVxcLyhwZXJzb25hbC1wcm9qZWN0c3xvbmxpbmUtcHJpbnRpbmd8YmFubmVyc3xidXNpbmVzcy1jYXJkc3xjb25zdW1lci1vZmZlcnN8ZGVzaWduLXNlcnZpY2VzfGZsYXNoLXNhbGUtb2ZmZXJzfGdyZWV0aW5nLWNhcmRzfG1hcmtldGluZy1tYXRlcmlhbHN8bWVudXN8bmF0aW9uYWwtYmlkLWNlbnRlcnxvbmxpbmUtY3VzdG9tLWZyYW1lc3xwYXNzcG9ydC1waG90b3xwaG90b2Jvb2tzfHBvc3RlcnN8cG9zdGVyLXNpZ24tYmFubmVyLXByaW50aW5nfHByaW50LXByZWZlcnJlZHxzaWduc3xzbWFsbC1tZWRpdW0tYnVzaW5lc3Mtb2ZmZXJzfHNlcnZpY2VzfHByaW50YW5kZ298Y3VzdG9tZXJzdXBwb3J0KS5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC8oZW4tdXMpXFwvKHNoaXBwaW5nfHByaW50aW5nKVxcLyhtYXJrZXRpbmctbWF0ZXJpYWxzfHBhY2tpbmctc3VwcGxpZXN8cG9zdGVycylcXC8oYnJvY2h1cmVzfGZseWVyc3xwb3N0Y2FyZHN8Y3VzdG9tLWJyYW5kZWQtYm94ZXN8cHJpbnRzKS5odG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdcXC8oZW4tdXMpXFwvKG9mZmljZXxwcmludGluZ3xjb3Vwb24tb2ZmZXJzfCkuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29udGVudHNxdWFyZS9zcmMvbGliL2FjdGlvbnMvdXhhSW5zdGFsbGF0aW9uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0UGF0aElucHV0OiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRRdWVyeUlucHV0OiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRQYXRoQ2hlY2tib3g6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFF1ZXJ5Q2hlY2tib3g6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxiZTZlMTI4OWY5Y2Y0ZTc2OTZhMjViNDVmNzk5OGZlMycsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3F1YWx0cmljcyBNYXBwaW5nJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ3F1YWx0cmljczpwYWdlTGlzdE1hcHBpbmdOZXcnKSwgdCA9IHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZSwgbiA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdxdWFsdHJpY3M6cGFnZU5hbWUnKSwgciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OnBhZ2VQYXRoJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnID09IHR5cGVvZiBfZmR4ICYmIF9zYXRlbGxpdGUuZ2V0VmFyKCdfZmR4VXRpbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IF9mZHgucGFnZUZsYWcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpIHx8IF9mZHgucGFnZUZsYWcobiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICc8IS0tQkVHSU4gUVVBTFRSSUNTIFdFQlNJVEUgRkVFREJBQ0sgU05JUFBFVC0tPlxuXG48c2NyaXB0IHR5cGU9XCd0ZXh0L2phdmFzY3JpcHRcJz5cblxuKGZ1bmN0aW9uKCl7dmFyIGc9ZnVuY3Rpb24oZSxoLGYsZyl7XG5cbnRoaXMuZ2V0PWZ1bmN0aW9uKGEpe2Zvcih2YXIgYT1hKyI9IixjPWRvY3VtZW50LmNvb2tpZS5zcGxpdCgiOyIpLGI9MCxlPWMubGVuZ3RoO2I8ZTtiKyspe2Zvcih2YXIgZD1jW2JdOyIgIj09ZC5jaGFyQXQoMCk7KWQ9ZC5zdWJzdHJpbmcoMSxkLmxlbmd0aCk7aWYoMD09ZC5pbmRleE9mKGEpKXJldHVybiBkLnN1YnN0cmluZyhhLmxlbmd0aCxkLmxlbmd0aCl9cmV0dXJuIG51bGx9O1xuXG50aGlzLnNldD1mdW5jdGlvbihhLGMpe3ZhciBiPSIiLGI9bmV3IERhdGU7Yi5zZXRUaW1lKGIuZ2V0VGltZSgpKzYwNDhFNSk7Yj0iOyBleHBpcmVzPSIrYi50b0dNVFN0cmluZygpO2RvY3VtZW50LmNvb2tpZT1hKyI9IitjK2IrIjsgcGF0aD0vOyAifTtcblxudGhpcy5jaGVjaz1mdW5jdGlvbigpe3ZhciBhPXRoaXMuZ2V0KGYpO2lmKGEpYT1hLnNwbGl0KCI6Iik7ZWxzZSBpZigxMDAhPWUpInYiPT1oJiYoZT1NYXRoLnJhbmRvbSgpPj1lLzEwMD8wOjEwMCksYT1baCxlLDBdLHRoaXMuc2V0KGYsYS5qb2luKCI6IikpO2Vsc2UgcmV0dXJuITA7dmFyIGM9YVsxXTtpZigxMDA9PWMpcmV0dXJuITA7c3dpdGNoKGFbMF0pe2Nhc2UgInYiOnJldHVybiExO2Nhc2UgInIiOnJldHVybiBjPWFbMl0lTWF0aC5mbG9vcigxMDAvYyksYVsyXSsrLHRoaXMuc2V0KGYsYS5qb2luKCI6IikpLCFjfXJldHVybiEwfTtcblxudGhpcy5nbz1mdW5jdGlvbigpe2lmKHRoaXMuY2hlY2soKSl7dmFyIGE9ZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgic2NyaXB0Iik7YS50eXBlPSJ0ZXh0L2phdmFzY3JpcHQiO2Euc3JjPWc7ZG9jdW1lbnQuYm9keSYmZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChhKX19O1xuXG50aGlzLnN0YXJ0PWZ1bmN0aW9uKCl7dmFyIHQ9dGhpczsiY29tcGxldGUiIT09ZG9jdW1lbnQucmVhZHlTdGF0ZT93aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcj93aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigibG9hZCIsZnVuY3Rpb24oKXt0LmdvKCl9LCExKTp3aW5kb3cuYXR0YWNoRXZlbnQmJndpbmRvdy5hdHRhY2hFdmVudCgib25sb2FkIixmdW5jdGlvbigpe3QuZ28oKX0pOnQuZ28oKX07fTtcblxudHJ5eyhuZXcgZygxMDAsInIiLCJRU0lfU19aTl9hZ3o0ak84N2xNSVVPMUsiLCJodHRwczovL3puYWd6NGpvODdsbWl1bzFrLWZlZGV4LnNpdGVpbnRlcmNlcHQucXVhbHRyaWNzLmNvbS9TSUUvP1FfWklEPVpOX2FnejRqTzg3bE1JVU8xSyIpKS5zdGFydCgpfWNhdGNoKGkpe319KSgpO1xuXG48L3NjcmlwdD48ZGl2IGlkPVwnWk5fYWd6NGpPODdsTUlVTzFLXCc+PCEtLURPIE5PVCBSRU1PVkUtQ09OVEVOVFMgUExBQ0VEIEhFUkUtLT48L2Rpdj5cblxuPCEtLUVORCBXRUJTSVRFIEZFRURCQUNLIFNOSVBQRVQtLT4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGI1OWVjNmY3OGE4ZjRlYjQ5MmEzMmZmZGE5YjE4YTI2JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZXZlbnQ6YnV0dG9uIGNsaWNrJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuY2hvckRlbGF5OiAxMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnYnV0dG9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ0NoZWNrIEludGVydmFsJyksIHQgPSBfc2F0ZWxsaXRlLmdldFZhcignRGVsYXkgVGltZScpLCBuID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdoZXJvfHRyYWNrJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGVyb3xjdWJlfHJhdGUgJiBzaGlwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGVyb3xjdWJlfHJhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdoZXJvfGN1YmV8dHJhY2snLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdoZXJvfGN1YmV8bG9jYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGVyb3xjdWJlfHNoaXAnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCByID0gc2V0SW50ZXJ2YWwoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gRkRYLkRBVEFMQVlFUi5wYWdlLmJ1dHRvbi5kYXRhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gZSAmJiBlICYmIChjbGVhckludGVydmFsKHIpLCBpICYmIGNsZWFyVGltZW91dChpKSwgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJ3VuZGVmaW5lZCcgIT09IEZEWC5EQVRBTEFZRVIucGFnZS5idXR0b24gJiYgJycgIT09IEZEWC5EQVRBTEFZRVIucGFnZS5idXR0b24uZGF0YSA/IEZEWC5EQVRBTEFZRVIucGFnZS5idXR0b24uZGF0YSA6ICcnLCByID0gJ3VuZGVmaW5lZCcgIT09IEZEWC5EQVRBTEFZRVIucGFnZS5idXR0b24gJiYgJycgIT09IEZEWC5EQVRBTEFZRVIucGFnZS5idXR0b24udHlwZSA/IEZEWC5EQVRBTEFZRVIucGFnZS5idXR0b24udHlwZSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSB0ICYmICcnICE9IHQgJiYgKCcnICE9PSByICYmICduZXdQYWdlJyA9PSByID8gKGZkeF9zZXRMaW5rVmlldyh0KSwgITEpIDogdm9pZCAwICE9PSByICYmICdzYW1lUGFnZScgPT0gciA/IChuLmluZGV4T2YoZS50b0xvd2VyQ2FzZSgpKSA+IC0xID8gZmR4X3NldExpbmtWaWV3KHQpIDogZmR4X2xvZ0xpbmtWaWV3KHQpLCAhMSkgOiB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpLCBpID0gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJJbnRlcnZhbChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDMwMDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW10KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDNjYzkyNjQ0MzUwNzQ4MGNhZDM4YTlkNzU3NjZiNzgzJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAndmE6QWR2YW5jZWQgVHJhY2tpbmcgVVMnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RvbVJlYWR5LmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OmRldmljZVR5cGUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIF9mZHggJiYgX3NhdGVsbGl0ZS5nZXRWYXIoJ19mZHhVdGlsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ3ZhOmVuYWJsZWRDb3VudHJ5TGlzdCcpLCBuID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6Y291bnRyeUNvZGUnKSwgciA9IF9zYXRlbGxpdGUuZ2V0VmFyKCd2YTptb2JFbmFibGVkVXJsJyksIGkgPSBfZmR4LnBhZ2VGbGFnKHQsIG4pLCBhID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ3ZhOmNhYXNFbmFibGVkQ291bnRyeUxpc3QnKSwgbyA9IF9zYXRlbGxpdGUuZ2V0VmFyKCd2YTpjYWFzTW9iRW5hYmxlZFVybCcpLCBzID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6bG9jYWxlJyksIGMgPSBfc2F0ZWxsaXRlLmdldFZhcigndmE6Y2Fhc0Rpc2FibGVkQ291bnRyeUxpc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5pbmRleE9mKHMpID4gLTEgPyBpc0NhYXNNb2JFbmFibGVkID0gITAgOiBpc0NhYXNNb2JFbmFibGVkID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gd2luZG93LmxvY2F0aW9uLnBhdGhuYW1lLCBsID0gJy8nICsgX3NhdGVsbGl0ZS5nZXRWYXIoJ2NvbnRlbnQ6bG9jYWxlJykucmVwbGFjZSgnXycsICctJykgKyAnLycsIGQgPSAnL2N1c3RvbWVyLXN1cHBvcnQuaHRtbCcsIGYgPSBfc2F0ZWxsaXRlLmdldFZhcigndmE6ZGlzYWJsZWRQYWdlTGlzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gZi5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICE9PSBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSAhX2ZkeC5wYWdlRmxhZyhmLCB1KSwgbSA9ICFfZmR4LnBhZ2VGbGFnKGYsIGwpLCBnID0gX2ZkeC5wYWdlRmxhZyhyLCB1KSwgaCA9IF9mZHgucGFnZUZsYWcobywgdSksIHYgPSBpICYmIHAsIGIgPSBpICYmIG0gJiYgYywgeSA9IGkgJiYgZywgXyA9IGkgJiYgbSAmJiBoICYmIGlzQ2Fhc01vYkVuYWJsZWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IEZEWC5DQUFTID8gISgnZGVza3RvcCcgIT0gZSB8fCAhdikgfHwgISgnbW9iaWxlJyAhPSBlIHx8ICF5KSA6ICEoJ2Rlc2t0b3AnICE9IGUgfHwgIWIpIHx8ICEoJ21vYmlsZScgIT0gZSB8fCAhXyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBfc2F0ZWxsaXRlLmNvb2tpZS5nZXQoJ3djbW1vZGUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy92YWx1ZUNvbXBhcmlzb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wYXJpc29uOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wZXJhdG9yOiAnZXF1YWxzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZUluc2Vuc2l0aXZlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVmdE9wZXJhbmQ6ICclY29udGVudDpjb3VudHJ5Q29kZSUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpZ2h0T3BlcmFuZDogJ3VzJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzY4NmI4ZjBjNDUyMC80Y2U0MDFjNTFiNTEvNjgwNzZhY2JhMmNjL1JDZjVhY2U5Y2UyYzAyNDYwMjkyZmZiYmIzM2ZkYWYyY2Utc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQzZmNzAyOGQxYmZkNDRmMjk5ZmIxMWZhNzU5Yzc5ZDc4LXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDUyYjFmYTYxZTcxMDQ4ZjBiY2FkNmQ4YTgzZjkyYWZkJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZ1RhZzpEQ1BhZ2VFdmVudF9Qb3NzaWJpbGl0aWVzJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kb21SZWFkeS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6RW5hYmxlZExvY2FsZUVwaWMnKSAmJiBudWxsICE9PSBfc2F0ZWxsaXRlLmdldFZhcignZ1RhZzpFbmFibGVkTG9jYWxlRXBpYycpICYmICcnICE9PSBfc2F0ZWxsaXRlLmdldFZhcignZ1RhZzpFbmFibGVkTG9jYWxlRXBpYycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL3BhdGhBbmRRdWVyeXN0cmluZy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoczogW3sgdmFsdWU6ICcvYWJvdXQvcG9zc2liaWxpdGllcy5odG1sJyB9XSB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS82ODZiOGYwYzQ1MjAvNGNlNDAxYzUxYjUxLzY4MDc2YWNiYTJjYy9SQ2YzYzY3OGQ2YjAzYjRjOGJiODZjYzc2YzdmMmVlM2IxLXNvdXJjZS5taW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNFeHRlcm5hbDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDgxYzVlZjhmYjcyYzQxNzFiMmU3MWFkNzA0M2ZhMmY5JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAncXVhbHRyaWNzOlNpdGUtd2lkZScsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvcGFnZUJvdHRvbS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyA9PSB0eXBlb2YgX2ZkeCAmJiBfc2F0ZWxsaXRlLmdldFZhcignX2ZkeFV0aWwnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBfZmR4LnBjZlV0aWwoKS5tYXRjaCgvd3d3KHNib3guaWRldnxiYXNlLmlkZXZ8ZGV2LmlkZXZ8ZHJ0LmlkZXZ8c3RyZXNzLmRtei5pZGV2fGJpdC5pZGV2fHRlc3R8KS5mZWRleC5jb20vZ2kpLCB0ID0gJycgPT0gX3NhdGVsbGl0ZS5nZXRWYXIoJ3F1YWx0cmljczpEaXNhYmxlTG9jYWxlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKG51bGwgPT09IGUgfHwgIXQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnPCEtLUJFR0lOIFFVQUxUUklDUyBXRUJTSVRFIEZFRURCQUNLIFNOSVBQRVQtLT5cblxuPHNjcmlwdCB0eXBlPVwndGV4dC9qYXZhc2NyaXB0XCc+XG5cbihmdW5jdGlvbigpe3ZhciBnPWZ1bmN0aW9uKGUsaCxmLGcpe1xuXG50aGlzLmdldD1mdW5jdGlvbihhKXtmb3IodmFyIGE9YSsiPSIsYz1kb2N1bWVudC5jb29raWUuc3BsaXQoIjsiKSxiPTAsZT1jLmxlbmd0aDtiPGU7YisrKXtmb3IodmFyIGQ9Y1tiXTsiICI9PWQuY2hhckF0KDApOylkPWQuc3Vic3RyaW5nKDEsZC5sZW5ndGgpO2lmKDA9PWQuaW5kZXhPZihhKSlyZXR1cm4gZC5zdWJzdHJpbmcoYS5sZW5ndGgsZC5sZW5ndGgpfXJldHVybiBudWxsfTtcblxudGhpcy5zZXQ9ZnVuY3Rpb24oYSxjKXt2YXIgYj0iIixiPW5ldyBEYXRlO2Iuc2V0VGltZShiLmdldFRpbWUoKSs2MDQ4RTUpO2I9IjsgZXhwaXJlcz0iK2IudG9HTVRTdHJpbmcoKTtkb2N1bWVudC5jb29raWU9YSsiPSIrYytiKyI7IHBhdGg9LzsgIn07XG5cbnRoaXMuY2hlY2s9ZnVuY3Rpb24oKXt2YXIgYT10aGlzLmdldChmKTtpZihhKWE9YS5zcGxpdCgiOiIpO2Vsc2UgaWYoMTAwIT1lKSJ2Ij09aCYmKGU9TWF0aC5yYW5kb20oKT49ZS8xMDA/MDoxMDApLGE9W2gsZSwwXSx0aGlzLnNldChmLGEuam9pbigiOiIpKTtlbHNlIHJldHVybiEwO3ZhciBjPWFbMV07aWYoMTAwPT1jKXJldHVybiEwO3N3aXRjaChhWzBdKXtjYXNlICJ2IjpyZXR1cm4hMTtjYXNlICJyIjpyZXR1cm4gYz1hWzJdJU1hdGguZmxvb3IoMTAwL2MpLGFbMl0rKyx0aGlzLnNldChmLGEuam9pbigiOiIpKSwhY31yZXR1cm4hMH07XG5cbnRoaXMuZ289ZnVuY3Rpb24oKXtpZih0aGlzLmNoZWNrKCkpe3ZhciBhPWRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoInNjcmlwdCIpO2EudHlwZT0idGV4dC9qYXZhc2NyaXB0IjthLnNyYz1nO2RvY3VtZW50LmJvZHkmJmRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoYSl9fTtcblxudGhpcy5zdGFydD1mdW5jdGlvbigpe3ZhciB0PXRoaXM7ImNvbXBsZXRlIiE9PWRvY3VtZW50LnJlYWR5U3RhdGU/d2luZG93LmFkZEV2ZW50TGlzdGVuZXI/d2luZG93LmFkZEV2ZW50TGlzdGVuZXIoImxvYWQiLGZ1bmN0aW9uKCl7dC5nbygpfSwhMSk6d2luZG93LmF0dGFjaEV2ZW50JiZ3aW5kb3cuYXR0YWNoRXZlbnQoIm9ubG9hZCIsZnVuY3Rpb24oKXt0LmdvKCl9KTp0LmdvKCl9O307XG5cbnRyeXsobmV3IGcoMTAwLCJyIiwiUVNJX1NfWk5fYWd6NGpPODdsTUlVTzFLIiwiaHR0cHM6Ly96bmFnejRqbzg3bG1pdW8xay1mZWRleC5zaXRlaW50ZXJjZXB0LnF1YWx0cmljcy5jb20vU0lFLz9RX1pJRD1aTl9hZ3o0ak84N2xNSVVPMUsiKSkuc3RhcnQoKX1jYXRjaChpKXt9fSkoKTtcblxuPC9zY3JpcHQ+PGRpdiBpZD1cJ1pOX2FnejRqTzg3bE1JVU8xS1wnPjwhLS1ETyBOT1QgUkVNT1ZFLUNPTlRFTlRTIFBMQUNFRCBIRVJFLS0+PC9kaXY+XG5cbjwhLS1FTkQgV0VCU0lURSBGRUVEQkFDSyBTTklQUEVULS0+JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2h0bWwnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxkOWVlNDI4NTg0MDA0NjZkYmEwMDVkM2M3MWZjOGU0NCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2d0YWc6VmlkZW9QbGF5JywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9tZWRpYVRpbWVQbGF5ZWQuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bml0OiAncGVyY2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW1vdW50OiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJy5icmlnaHRjb3ZlLWNvbnRhaW5lciB2aWRlbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvcGF0aEFuZFF1ZXJ5c3RyaW5nLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJy8oa28ta3J8emgtdHd8ZW4tc2cpL2Fib3V0L3Bvc3NpYmlsaXRpZXMuaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2dUYWc6VmlkZW9QbGF5SWRMaXN0JyksIHQgPSB0aGlzLnBhcmVudEVsZW1lbnQuZ2V0QXR0cmlidXRlKCdkYXRhLXZpZGVvLWlkJyksIG4gPSBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpjb3VudHJ5Q29kZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyA9PSB0eXBlb2YgX2ZkeCAmJiBfc2F0ZWxsaXRlLmdldFZhcignX2ZkeFV0aWwnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBfZmR4LnBhZ2VGbGFnKGUsIG4sICdjb3VudHJ5JyksIGkgPSBfZmR4LnBhZ2VGbGFnKHIsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3NhdGVsbGl0ZS5zZXRWYXIoJ3ZpZGVvR3RhZ0xhYmVsJywgaSksICExICE9PSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaHR0cHM6Ly9hc3NldHMuYWRvYmVkdG0uY29tLzY4NmI4ZjBjNDUyMC80Y2U0MDFjNTFiNTEvNjgwNzZhY2JhMmNjL1JDNTcwYTY5MDc1N2IxNDQ0ZTk0YjBjYzMwZjljMjFiZDItc291cmNlLm1pbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdqYXZhc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0V4dGVybmFsOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYmY1M2U1YmVmNTNjNDFhZmI5OTIzMTNhNmJjMWNjOGMnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICd2YVBvcGluIGV4dGVybmFsIGxpbmsgY2xpY2sgbmV3IHdpbmRvdycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcjbmluYS1mZWRleCBhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnRGlhbG9nJyAhPT0gdGhpcy5nZXRBdHRyaWJ1dGUoJ2RhdGEtdnR6LWxpbmstdHlwZScpICYmICdfYmxhbmsnID09IHRoaXMuZ2V0QXR0cmlidXRlKCd0YXJnZXQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZW5fdXMnICE9PSBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpsb2NhbGUnKSB8fCAnZW5fZ2InICE9PSBsb2NjYWxlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMTgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpwYWdlIG5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDE5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAndmFQb3BpbkFzayAnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMjAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpwYWdlIG5hbWUlOnZhUG9waW5Bc2sgJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnIycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMOTcwMzU1NjI2YmMwNDEyYTllNzVhNDVhY2U0NzkyZjUnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdldmVudDpBV0JUaGFua1BhZ2UnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy92YWx1ZUNvbXBhcmlzb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wYXJpc29uOiB7IG9wZXJhdG9yOiAnZXF1YWxzJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnRPcGVyYW5kOiAnJWNvbnRlbnQ6cGFnZSBuYW1lJScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlnaHRPcGVyYW5kOiAnZmVkZXgvc2hpcHBpbmcvZnJlaWdodC1zZXJ2aWNlcy9pbnRlcm5hdGlvbmFsLWFpci1mcmVpZ2h0LXF1b3RlL2dlbmVyaWNfdGhhbmt5b3UnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfc2F0ZWxsaXRlLnNldFZhcignZm9ybUV2ZW50JywgJ2V2ZW50MzA5JyksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdmb3JtRXZlbnQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlua1RyYWNrRXZlbnRzID0gdC5ldmVudHMgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogeyBldmVudHM6IFt7IG5hbWU6ICdldmVudDMwOScgfV0gfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw1ZDJjZjAwNzVkODE0ZTI1ODc0YzE5YmZlZDBhNjVhYicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3ZhOnBvcGluIEFzaycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGF0YUVsZW1lbnRDaGFuZ2UuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgbmFtZTogJ2V2ZW50OnZhQ2xpY2snIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL21heEZyZXF1ZW5jeS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuaXQ6ICdzZXNzaW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3VudDogMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvdmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnRkRYLkRBVEFMQVlFUi5WQS5zdGF0dXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAndmFQb3BpbkFzaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVJc1JlZ2V4OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvdmFsdWVDb21wYXJpc29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcGFyaXNvbjogeyBvcGVyYXRvcjogJ2dyZWF0ZXJUaGFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnRPcGVyYW5kOiAnJXZhOnZlcnNpb24gbnVtYmVyJScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlnaHRPcGVyYW5kOiAyMDIxMTAyNjE1MzAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdlbl91cycgIT09IF9zYXRlbGxpdGUuZ2V0VmFyKCdjb250ZW50OmxvY2FsZScpIHx8ICdlbl9nYicgIT09IGxvY2NhbGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3AxOCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnBhZ2UgbmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMTknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICd2YVBvcGluQXNrICcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3AyMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnBhZ2UgbmFtZSU6dmFQb3BpbkFzayAnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICd2YV9OSU5BJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw3ZjYzNDRmNTZmNDI0N2I4YTA4NGI0MzBjZGY4ODVhNicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3ZhUG9waW4gaW50ZXJuYWwgbGluayBjbGljayAnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnI25pbmEtZmVkZXggYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0RpYWxvZycgPT09IHRoaXMuZ2V0QXR0cmlidXRlKCdkYXRhLXZ0ei1saW5rLXR5cGUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZW5fdXMnICE9PSBfc2F0ZWxsaXRlLmdldFZhcignY29udGVudDpsb2NhbGUnKSB8fCAnZW5fZ2InICE9PSBsb2NjYWxlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3AxOCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnBhZ2UgbmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMTknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICd2YVBvcGluQXNrICcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3AyMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnBhZ2UgbmFtZSU6dmFQb3BpbkFzayAnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9OwogICAgICAgIHZhciAkX19fdmFyXzU2YjA3ZTVmNzA5MTBmZDEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgZnVuY3Rpb24gZShlKSB7CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ09iamVjdC5hc3NpZ24gY2Fubm90IGJlIGNhbGxlZCB3aXRoIG51bGwgb3IgdW5kZWZpbmVkJyk7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGlmICghT2JqZWN0LmFzc2lnbikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IFN0cmluZygnYWJjJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGVbNV0gPSAnZGUnLCAnNScgPT09IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKGUpWzBdKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHt9LCBuID0gMDsgbiA8IDEwOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHRbJ18nICsgU3RyaW5nLmZyb21DaGFyQ29kZShuKV0gPSBuOwogICAgICAgICAgICAgICAgICAgIGlmICgnMDEyMzQ1Njc4OScgIT09IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKHQpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJycpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7fTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FiY2RlZmdoaWprbG1ub3BxcnN0Jy5zcGxpdCgnJykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByW2VdID0gZTsKICAgICAgICAgICAgICAgICAgICB9KSwgJ2FiY2RlZmdoaWprbG1ub3BxcnN0JyA9PT0gT2JqZWN0LmtleXMoT2JqZWN0LmFzc2lnbih7fSwgcikpLmpvaW4oJycpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgIGlmIChlLl9fZXNNb2R1bGUpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh7fSwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGUsIG4pOwogICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCBuLCByLmdldCA/IHIgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW25dOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgIHZhciB0ID0geyBleHBvcnRzOiB7fSB9OwogICAgICAgICAgICAgICAgcmV0dXJuIGUodCwgdC5leHBvcnRzKSwgdC5leHBvcnRzOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSkgewogICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLmNvbnN0cnVjdG9yOwogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudGhlbihmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnJlc29sdmUoZSgpKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnJlc29sdmUoZSgpKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucmVqZWN0KG4pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQm9vbGVhbihlICYmIHZvaWQgMCAhPT0gZS5sZW5ndGgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIG8oKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcyhlLCB0KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGUuYXBwbHkodCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gYyhlKSB7CiAgICAgICAgICAgICAgICBpZiAoISh0aGlzIGluc3RhbmNlb2YgYykpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignUHJvbWlzZXMgbXVzdCBiZSBjb25zdHJ1Y3RlZCB2aWEgbmV3Jyk7CiAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdub3QgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgdGhpcy5fc3RhdGUgPSAwLCB0aGlzLl9oYW5kbGVkID0gITEsIHRoaXMuX3ZhbHVlID0gdm9pZCAwLCB0aGlzLl9kZWZlcnJlZHMgPSBbXSwgbShlLCB0aGlzKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB1KGUsIHQpIHsKICAgICAgICAgICAgICAgIGZvciAoOyAzID09PSBlLl9zdGF0ZTspCiAgICAgICAgICAgICAgICAgICAgZSA9IGUuX3ZhbHVlOwogICAgICAgICAgICAgICAgMCAhPT0gZS5fc3RhdGUgPyAoZS5faGFuZGxlZCA9ICEwLCBjLl9pbW1lZGlhdGVGbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAxID09PSBlLl9zdGF0ZSA/IHQub25GdWxmaWxsZWQgOiB0Lm9uUmVqZWN0ZWQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHI7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gbihlLl92YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGQodC5wcm9taXNlLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBsKHQucHJvbWlzZSwgcik7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICgxID09PSBlLl9zdGF0ZSA/IGwgOiBkKSh0LnByb21pc2UsIGUuX3ZhbHVlKTsKICAgICAgICAgICAgICAgIH0pKSA6IGUuX2RlZmVycmVkcy5wdXNoKHQpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSwgdCkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAodCA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQSBwcm9taXNlIGNhbm5vdCBiZSByZXNvbHZlZCB3aXRoIGl0c2VsZi4nKTsKICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiAoJ29iamVjdCcgPT0gdHlwZW9mIHQgfHwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LnRoZW47CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0IGluc3RhbmNlb2YgYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLl9zdGF0ZSA9IDMsIGUuX3ZhbHVlID0gdCwgdm9pZCBmKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIG0ocyhuLCB0KSwgZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGUuX3N0YXRlID0gMSwgZS5fdmFsdWUgPSB0LCBmKGUpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgIGQoZSwgdCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gZChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLl9zdGF0ZSA9IDIsIGUuX3ZhbHVlID0gdCwgZihlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBmKGUpIHsKICAgICAgICAgICAgICAgIDIgPT09IGUuX3N0YXRlICYmIDAgPT09IGUuX2RlZmVycmVkcy5sZW5ndGggJiYgYy5faW1tZWRpYXRlRm4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGUuX2hhbmRsZWQgfHwgYy5fdW5oYW5kbGVkUmVqZWN0aW9uRm4oZS5fdmFsdWUpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMCwgbiA9IGUuX2RlZmVycmVkcy5sZW5ndGg7IHQgPCBuOyB0KyspCiAgICAgICAgICAgICAgICAgICAgdShlLCBlLl9kZWZlcnJlZHNbdF0pOwogICAgICAgICAgICAgICAgZS5fZGVmZXJyZWRzID0gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBwKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHRoaXMub25GdWxmaWxsZWQgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBlID8gZSA6IG51bGwsIHRoaXMub25SZWplY3RlZCA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIHQgPyB0IDogbnVsbCwgdGhpcy5wcm9taXNlID0gbjsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBtKGUsIHQpIHsKICAgICAgICAgICAgICAgIHZhciBuID0gITE7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGUoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbiB8fCAobiA9ICEwLCBsKHQsIGUpKTsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBuIHx8IChuID0gITAsIGQodCwgZSkpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChuKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgbiA9ICEwLCBkKHQsIGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGcoZSkgewogICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBYZShlKSAmJiAnW29iamVjdCBPYmplY3RdJyA9PT0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGgoZSwgdCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLCB0KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB2KGUpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PSB0eXBlb2YgZSAmJiAtMSAhPT0gZS5pbmRleE9mKCdbJykgJiYgLTEgIT09IGUuaW5kZXhPZignXScpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGIoZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGUuc3Vic3RyKDAsIGUuaW5kZXhPZignWycpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB5KGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIGlmIChlLmxlbmd0aCAmJiBLZSh0KSkgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gZVswXTsKICAgICAgICAgICAgICAgICAgICBpZiAoMSAhPT0gZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLnNsaWNlKDEpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXYocikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geShpLCB0W3JdLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0W3IgPSBiKHIpXTsKICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShhKSAmJiBhLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5KGksIGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShyKSAmJiAnc3RyaW5nJyA9PSB0eXBlb2YgdFtyXSAmJiAodFtyXSA9IG4odFtyXSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh3aW5kb3cuYXRvYikgewogICAgICAgICAgICAgICAgdmFyIF8gPSBkb2N1bWVudCwgQyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMsIHggPSBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LCBrID0gT2JqZWN0LnByb3RvdHlwZS5wcm9wZXJ0eUlzRW51bWVyYWJsZSwgdyA9IHQoKSA/IE9iamVjdC5hc3NpZ24gOiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuLCByLCBpID0gZSh0KSwgYSA9IDE7IGEgPCBhcmd1bWVudHMubGVuZ3RoOyBhKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gaW4gbiA9IE9iamVjdChhcmd1bWVudHNbYV0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHguY2FsbChuLCBvKSAmJiAoaVtvXSA9IG5bb10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gQyhuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBzID0gMDsgcyA8IHIubGVuZ3RoOyBzKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsuY2FsbChuLCByW3NdKSAmJiAoaVtyW3NdXSA9IG5bcltzXV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgIH0sIEUgPSB3LCBJID0gd2luZG93LCBEID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIGkgPSBBcnJheS5pc0FycmF5KHQpLCBhID0gQm9vbGVhbihpICYmIGUpLCBvID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnYScpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoby5ocmVmID0gZSwgKCEvXmh0dHBzPzpcL1wvLiovLnRlc3QoZSkgfHwgIW8uaG9zdCkgJiYgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBuZXcgRXJyb3IoJ1VuYWJsZSB0byBmaW5kIHRoZSBMaWJyYXJ5IEVtYmVkIENvZGUgZm9yIER5bmFtaWMgSG9zdCBSZXNvbHV0aW9uLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgcy5jb2RlID0gJ2R5bmFtaWNfaG9zdF9yZXNvbHZlcl9jb25zdHJ1Y3Rvcl9lcnJvcicsIHM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgJiYgLTEgPT09IHQuaW5kZXhPZihvLmhvc3RuYW1lKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgRXJyb3IoJ1RoaXMgbGlicmFyeSBpcyBub3QgYXV0aG9yaXplZCBmb3IgdGhpcyBkb21haW4uIFBsZWFzZSBjb250YWN0IHlvdXIgQ1NNIGZvciBtb3JlIGluZm9ybWF0aW9uLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgYy5jb2RlID0gJ2R5bmFtaWNfaG9zdF9ub3RfYWxsb3dlZCcsIGM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBvLmhvc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC86ODAkLy50ZXN0KGUpID8gZSA9IGUucmVwbGFjZSgnOjgwJywgJycpIDogLzo4MFwvJC8udGVzdChlKSA/IGUgPSBlLnJlcGxhY2UoJzo4MC8nLCAnJykgOiAvOjQ0MyQvLnRlc3QoZSkgPyBlID0gZS5yZXBsYWNlKCc6NDQzJywgJycpIDogLzo0NDNcLyQvLnRlc3QoZSkgJiYgKGUgPSBlLnJlcGxhY2UoJzo0NDMvJywgJycpKSwgciA9ICdodHRwczovLycgKyBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBsID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSAmJiAnc3RyaW5nJyA9PSB0eXBlb2YgZSA/IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLycgPT09IGUuY2hhckF0KDApID8gZS5zbGljZSgxKSA6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLmpvaW4oJy8nKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFR1cmJpbmVIb3N0OiB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlY29yYXRlV2l0aER5bmFtaWNIb3N0OiBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldCBpc0R5bmFtaWNFbmZvcmNlZCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEkgJiYgbi5vbkRlYnVnQ2hhbmdlZChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA/IEkuZHluYW1pY0hvc3RSZXNvbHZlciA9IGQgOiBkZWxldGUgSS5keW5hbWljSG9zdFJlc29sdmVyOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgZDsKICAgICAgICAgICAgICAgICAgICB9LCBBID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5ldmVudHMgJiYgZS5ldmVudHMuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50OiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQuc29ydChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZXZlbnQucnVsZU9yZGVyIC0gdC5ldmVudC5ydWxlT3JkZXI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIFMgPSAnZGVidWcnLCBUID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0cnVlJyA9PT0gZS5nZXRJdGVtKFMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zZXRJdGVtKFMsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSA9IFtdLCBhID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5vdXRwdXRFbmFibGVkID0gbigpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkRlYnVnQ2hhbmdlZDogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldERlYnVnRW5hYmxlZDogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldERlYnVnRW5hYmxlZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKCkgIT09IGUgJiYgKHIoZSksIHQub3V0cHV0RW5hYmxlZCA9IGUsIGkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBQID0gJ01vZHVsZSBkaWQgbm90IGV4cG9ydCBhIGZ1bmN0aW9uLicsIE8gPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHIsIGksIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhIHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlLmdldE1vZHVsZUV4cG9ydHMoci5tb2R1bGVQYXRoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nICE9IHR5cGVvZiBvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihQKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gZS5nZXRNb2R1bGVEZWZpbml0aW9uKHIubW9kdWxlUGF0aCksIGMgPSByLnNldHRpbmdzIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIXIuaGFzVHJhbnNmb3JtZWRGaWxlUGF0aHMgJiYgcy5maWxlUGF0aHMgJiYgKG4oYywgcy5maWxlUGF0aHMsIHIubW9kdWxlUGF0aCksIHIuaGFzVHJhbnNmb3JtZWRGaWxlUGF0aHMgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHQoYywgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5iaW5kKG51bGwsIHUpLmFwcGx5KG51bGwsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGogPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGUgPyBlLnJlcGxhY2UoL1xzKy9nLCAnICcpLnRyaW0oKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgfSwgTCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgTE9HOiAnbG9nJywKICAgICAgICAgICAgICAgICAgICAgICAgSU5GTzogJ2luZm8nLAogICAgICAgICAgICAgICAgICAgICAgICBERUJVRzogJ2RlYnVnJywKICAgICAgICAgICAgICAgICAgICAgICAgV0FSTjogJ3dhcm4nLAogICAgICAgICAgICAgICAgICAgICAgICBFUlJPUjogJ2Vycm9yJwogICAgICAgICAgICAgICAgICAgIH0sIE0gPSAnXHVEODNEXHVERTgwJywgViA9IDEwID09PSBwYXJzZUludCgoL21zaWUgKFxkKykvLmV4ZWMobmF2aWdhdG9yLnVzZXJBZ2VudC50b0xvd2VyQ2FzZSgpKSB8fCBbXSlbMV0pID8gJ1tMYXVuY2hdJyA6IE0sIFIgPSAhMSwgTiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChSICYmIHdpbmRvdy5jb25zb2xlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnVuc2hpZnQoViksIGUgIT09IEwuREVCVUcgfHwgd2luZG93LmNvbnNvbGVbZV0gfHwgKGUgPSBMLklORk8pLCB3aW5kb3cuY29uc29sZVtlXS5hcHBseSh3aW5kb3cuY29uc29sZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBGID0gTi5iaW5kKG51bGwsIEwuTE9HKSwgQiA9IE4uYmluZChudWxsLCBMLklORk8pLCBVID0gTi5iaW5kKG51bGwsIEwuREVCVUcpLCB6ID0gTi5iaW5kKG51bGwsIEwuV0FSTiksIHEgPSBOLmJpbmQobnVsbCwgTC5FUlJPUiksIEggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gUjsKICAgICAgICAgICAgICAgICAgICAgICAgUiA9ICEwLCBOLmFwcGx5KG51bGwsIEFycmF5LnByb3RvdHlwZS5jb25jYXQoTC5XQVJOLCBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMpKSksIGUgfHwgKFIgPSAhMSk7CiAgICAgICAgICAgICAgICAgICAgfSwgVyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbG9nOiBGLAogICAgICAgICAgICAgICAgICAgICAgICBpbmZvOiBCLAogICAgICAgICAgICAgICAgICAgICAgICBkZWJ1ZzogVSwKICAgICAgICAgICAgICAgICAgICAgICAgd2FybjogeiwKICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IHEsCiAgICAgICAgICAgICAgICAgICAgICAgIGRlcHJlY2F0aW9uOiBILAogICAgICAgICAgICAgICAgICAgICAgICBnZXQgb3V0cHV0RW5hYmxlZCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBSOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzZXQgb3V0cHV0RW5hYmxlZChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlUHJlZml4ZWRMb2dnZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICdbJyArIGUgKyAnXSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZzogRi5iaW5kKG51bGwsIHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZm86IEIuYmluZChudWxsLCB0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWJ1ZzogVS5iaW5kKG51bGwsIHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdhcm46IHouYmluZChudWxsLCB0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogcS5iaW5kKG51bGwsIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgRyA9ICd1bmRlZmluZWQnICE9IHR5cGVvZiBnbG9iYWxUaGlzID8gZ2xvYmFsVGhpcyA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiB3aW5kb3cgPyB3aW5kb3cgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgZ2xvYmFsID8gZ2xvYmFsIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHNlbGYgPyBzZWxmIDoge30sIFkgPSByKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuZXhwb3J0cyA9IHQoKSwgISEwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB3aW5kb3cuQ29va2llcywgciA9IHdpbmRvdy5Db29raWVzID0gdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubm9Db25mbGljdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5Db29raWVzID0gbiwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IDAsIHQgPSB7fTsgZSA8IGFyZ3VtZW50cy5sZW5ndGg7IGUrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50c1tlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtyXSA9IG5bcl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVwbGFjZSgvKCVbMC05QS1aXXsyfSkrL2csIGRlY29kZVVSSUNvbXBvbmVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKHQsIG4sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBkb2N1bWVudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ251bWJlcicgPT0gdHlwZW9mIChhID0gZSh7IHBhdGg6ICcvJyB9LCBpLmRlZmF1bHRzLCBhKSkuZXhwaXJlcyAmJiAoYS5leHBpcmVzID0gbmV3IERhdGUoMSAqIG5ldyBEYXRlKCkgKyA4NjQwMDAwMCAqIGEuZXhwaXJlcykpLCBhLmV4cGlyZXMgPSBhLmV4cGlyZXMgPyBhLmV4cGlyZXMudG9VVENTdHJpbmcoKSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IEpTT04uc3RyaW5naWZ5KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9eW1x7XFtdLy50ZXN0KG8pICYmIChuID0gbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gci53cml0ZSA/IHIud3JpdGUobiwgdCkgOiBlbmNvZGVVUklDb21wb25lbnQoU3RyaW5nKG4pKS5yZXBsYWNlKC8lKDIzfDI0fDI2fDJCfDNBfDNDfDNFfDNEfDJGfDNGfDQwfDVCfDVEfDVFfDYwfDdCfDdEfDdDKS9nLCBkZWNvZGVVUklDb21wb25lbnQpLCB0ID0gZW5jb2RlVVJJQ29tcG9uZW50KFN0cmluZyh0KSkucmVwbGFjZSgvJSgyM3wyNHwyNnwyQnw1RXw2MHw3QykvZywgZGVjb2RlVVJJQ29tcG9uZW50KS5yZXBsYWNlKC9bXChcKV0vZywgZXNjYXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjIGluIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtjXSAmJiAocyArPSAnOyAnICsgYywgITAgIT09IGFbY10gJiYgKHMgKz0gJz0nICsgYVtjXS5zcGxpdCgnOycpWzBdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuY29va2llID0gdCArICc9JyArIG4gKyBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGRvY3VtZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0ge30sIGEgPSBkb2N1bWVudC5jb29raWUgPyBkb2N1bWVudC5jb29raWUuc3BsaXQoJzsgJykgOiBbXSwgbyA9IDA7IG8gPCBhLmxlbmd0aDsgbysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBhW29dLnNwbGl0KCc9JyksIGMgPSBzLnNsaWNlKDEpLmpvaW4oJz0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuIHx8ICciJyAhPT0gYy5jaGFyQXQoMCkgfHwgKGMgPSBjLnNsaWNlKDEsIC0xKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSB0KHNbMF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IChyLnJlYWQgfHwgcikoYywgdSkgfHwgdChjKSwgbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IEpTT04ucGFyc2UoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpW3VdID0gYywgZSA9PT0gdSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IGlbZV0gOiBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLnNldCA9IGEsIGkuZ2V0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSwgITEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkuZ2V0SlNPTiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKGUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpLnJlbW92ZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEodCwgJycsIGUobiwgeyBleHBpcmVzOiAtMSB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaS5kZWZhdWx0cyA9IHt9LCBpLndpdGhDb252ZXJ0ZXIgPSBuLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0pLCBYID0gewogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IFkuZ2V0LAogICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IFkuc2V0LAogICAgICAgICAgICAgICAgICAgICAgICByZW1vdmU6IFkucmVtb3ZlCiAgICAgICAgICAgICAgICAgICAgfSwgSyA9ICdjb20uYWRvYmUucmVhY3Rvci4nLCBRID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBLICsgKHQgfHwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SXRlbTogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkX2NiNjRjMjJhMGU5YzIzZDcgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfY2I2NGMyMmEwZTljMjNkNykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja18yMTNjMmM2OThlNTcwMjcwLmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSVtlXS5nZXRJdGVtKG4gKyB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2NiNjRjMjJhMGU5YzIzZDcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX29sZF9jYjY0YzIyYTBlOWMyM2Q3KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEl0ZW06IGZ1bmN0aW9uICh0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF8xNDA3MWM3YjE4NzdlYTQ2ID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ2xvY2FsU3RvcmFnZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzE0MDcxYzdiMTg3N2VhNDYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX21vY2tfMjEzYzJjNjk4ZTU3MDI3MC5sb2NhbFN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElbZV0uc2V0SXRlbShuICsgdCwgciksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzE0MDcxYzdiMTg3N2VhNDYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX29sZF8xNDA3MWM3YjE4NzdlYTQ2KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sICQgPSAnX3Nkc2F0XycsIEogPSAnZGF0YUVsZW1lbnRzLicsIFogPSAnZGF0YUVsZW1lbnRDb29raWVzTWlncmF0ZWQnLCBlZSA9IFEoJ2xvY2FsU3RvcmFnZScpLCB0ZSA9IFEoJ3Nlc3Npb25TdG9yYWdlJywgSiksIG5lID0gUSgnbG9jYWxTdG9yYWdlJywgSiksIHJlID0gewogICAgICAgICAgICAgICAgICAgICAgICBQQUdFVklFVzogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICAgICAgU0VTU0lPTjogJ3Nlc3Npb24nLAogICAgICAgICAgICAgICAgICAgICAgICBWSVNJVE9SOiAndmlzaXRvcicKICAgICAgICAgICAgICAgICAgICB9LCBpZSA9IHt9LCBhZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IEpTT04uc3RyaW5naWZ5KGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgb2UgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgcmUuUEFHRVZJRVc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAoaWVbZV0gPSBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSByZS5TRVNTSU9OOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgKChyID0gYWUobikpICYmIHRlLnNldEl0ZW0oZSwgcikpOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHJlLlZJU0lUT1I6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAoKHIgPSBhZShuKSkgJiYgbmUuc2V0SXRlbShlLCByKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBzZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gWC5nZXQoJCArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IG4gJiYgb2UoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgfSwgY2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBlZS5nZXRJdGVtKFopIHx8IChPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZSh0LCBlW3RdLnN0b3JhZ2VEdXJhdGlvbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlZS5zZXRJdGVtKFosICEwKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgdWUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNldFZhbHVlOiBvZSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSByZS5QQUdFVklFVzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaWUuaGFzT3duUHJvcGVydHkoZSkgPyBpZVtlXSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHJlLlNFU1NJT046CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT09IChuID0gdGUuZ2V0SXRlbShlKSkgPyBuIDogSlNPTi5wYXJzZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgcmUuVklTSVRPUjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gKG4gPSBuZS5nZXRJdGVtKGUpKSA/IG4gOiBKU09OLnBhcnNlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBtaWdyYXRlQ29va2llRGF0YTogY2UKICAgICAgICAgICAgICAgICAgICB9LCBsZSA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnRmFpbGVkIHRvIGV4ZWN1dGUgZGF0YSBlbGVtZW50IG1vZHVsZSAnICsgZS5tb2R1bGVQYXRoICsgJyBmb3IgZGF0YSBlbGVtZW50ICcgKyB0ICsgJy4gJyArIG4gKyAociA/ICdcbicgKyByIDogJycpOwogICAgICAgICAgICAgICAgICAgIH0sIGRlID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChhLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPyAnJyA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjLCB1LCBsID0gcy5zdG9yYWdlRHVyYXRpb247CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBlLmdldE1vZHVsZUV4cG9ydHMocy5tb2R1bGVQYXRoKSwgdSA9IGUuZ2V0TW9kdWxlRGVmaW5pdGlvbihzLm1vZHVsZVBhdGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIFcuZXJyb3IobGUocywgYSwgZS5tZXNzYWdlLCBlLnN0YWNrKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkLCBmID0gcy5zZXR0aW5ncyB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhcy5oYXNUcmFuc2Zvcm1lZEZpbGVQYXRocyAmJiB1LmZpbGVQYXRocyAmJiAoaShmLCB1LmZpbGVQYXRocywgcy5tb2R1bGVQYXRoKSwgcy5oYXNUcmFuc2Zvcm1lZEZpbGVQYXRocyA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gYyhuKGYsIG8pLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIFcuZXJyb3IobGUocywgYSwgZS5tZXNzYWdlLCBlLnN0YWNrKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsICYmIChudWxsICE9IGQgPyB1ZS5zZXRWYWx1ZShhLCBsLCBkKSA6IGQgPSB1ZS5nZXRWYWx1ZShhLCBsKSksIG51bGwgPT0gZCAmJiBudWxsICE9IHMuZGVmYXVsdFZhbHVlICYmIChkID0gcy5kZWZhdWx0VmFsdWUpLCAnc3RyaW5nJyA9PSB0eXBlb2YgZCAmJiAocy5jbGVhblRleHQgJiYgKGQgPSBqKGQpKSwgcy5mb3JjZUxvd2VyQ2FzZSAmJiAoZCA9IGQudG9Mb3dlckNhc2UoKSkpLCBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgVy5lcnJvcihsZShzLCBhLCAnTW9kdWxlIGRpZCBub3QgZXhwb3J0IGEgZnVuY3Rpb24uJykpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGZlID0gewogICAgICAgICAgICAgICAgICAgICAgICB0ZXh0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudGV4dENvbnRlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFuVGV4dDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqKGUudGV4dENvbnRlbnQpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgcGUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByLCBpID0gZSwgYSA9IDAsIG8gPSB0Lmxlbmd0aDsgYSA8IG87IGErKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHRbYV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiAmJiAnQCcgPT09IHMuY2hhckF0KDApKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBzLnNsaWNlKDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBmZVtjXShpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaS5nZXRBdHRyaWJ1dGUgJiYgKHIgPSBzLm1hdGNoKC9eZ2V0QXR0cmlidXRlXCgoLispXCkkLykpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSByWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBpLmdldEF0dHJpYnV0ZSh1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBpW3NdOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgIH0sIG1lID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChyLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBuKHIsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByLnNwbGl0KCcuJyksIHMgPSBvLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RoaXMnID09PSBzID8gaSAmJiAoYSA9IHBlKGkuZWxlbWVudCwgbywgITApKSA6ICdldmVudCcgPT09IHMgPyBpICYmIChhID0gcGUoaSwgbykpIDogJ3RhcmdldCcgPT09IHMgPyBpICYmIChhID0gcGUoaS50YXJnZXQsIG8pKSA6IGEgPSBwZShlW3NdLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGdlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4uc3BsaXQoJy4nKVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCb29sZWFuKHQobikgfHwgJ3RoaXMnID09PSByIHx8ICdldmVudCcgPT09IHIgfHwgJ3RhcmdldCcgPT09IHIgfHwgZS5oYXNPd25Qcm9wZXJ0eShyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgaGUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHsgZXhwb3J0czoge30gfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY2FsbChyLmV4cG9ydHMsIHIsIHIuZXhwb3J0cywgdCwgbiksIHIuZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICB9LCB2ZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB7fSwgdCA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdNb2R1bGUgJyArIHQgKyAnIG5vdCBmb3VuZC4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoZSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAnRXJyb3IgaW5pdGlhbGl6aW5nIG1vZHVsZSAnICsgZSArICcuICcgKyBuLm1lc3NhZ2UgKyAobi5zdGFjayA/ICdcbicgKyBuLnN0YWNrIDogJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVy5lcnJvcih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmhhc093blByb3BlcnR5KCdleHBvcnRzJykgfHwgKG4uZXhwb3J0cyA9IGhlKG4uZGVmaW5pdGlvbi5zY3JpcHQsIG4ucmVxdWlyZSwgbi50dXJiaW5lKSksIG4uZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpc3Rlck1vZHVsZTogZnVuY3Rpb24gKHQsIG4sIHIsIGksIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmaW5pdGlvbjogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0ZW5zaW9uTmFtZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHVyYmluZTogYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby5yZXF1aXJlID0gaSwgZVt0XSA9IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaHlkcmF0ZUNhY2hlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TW9kdWxlRXhwb3J0czogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldE1vZHVsZURlZmluaXRpb246IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQoZSkuZGVmaW5pdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRNb2R1bGVFeHRlbnNpb25OYW1lOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KGUpLmV4dGVuc2lvbk5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgYmUgPSAhMSwgeWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5fbW9uaXRvcnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYmIChiZSB8fCAoVy53YXJuKCdUaGUgX3NhdGVsbGl0ZS5fbW9uaXRvcnMgQVBJIG1heSBjaGFuZ2UgYXQgYW55IHRpbWUgYW5kIHNob3VsZCBvbmx5IGJlIHVzZWQgZm9yIGRlYnVnZ2luZy4nKSwgYmUgPSAhMCksIHIuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0gJiYgZVt0XShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBfZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBpLCBhLCBvLCBzID0gW10sIGMgPSBmdW5jdGlvbiAociwgaSwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZShpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5wdXNoKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdChpLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5wb3AoKSwgbnVsbCA9PSBvICYmIG4gPyAnJyA6IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IC9eJShbXiVdKyklJC8uZXhlYyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID8gYyhlLCBuWzFdLCB0KSA6IGUucmVwbGFjZSgvJSguKz8pJS9nLCBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjKGUsIG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IHt9LCByID0gT2JqZWN0LmtleXMoZSksIGkgPSAwOyBpIDwgci5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gcltpXSwgcyA9IGVbYV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgblthXSA9IG8ocywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gW10sIHIgPSAwLCBpID0gZS5sZW5ndGg7IHIgPCBpOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoKG8oZVtyXSwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09IHR5cGVvZiBlID8gcihlLCB0KSA6IEFycmF5LmlzQXJyYXkoZSkgPyBhKGUsIHQpIDogJ29iamVjdCcgPT0gdHlwZW9mIGUgJiYgbnVsbCAhPT0gZSA/IGkoZSwgdCkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMubGVuZ3RoID4gMTAgPyAoVy5lcnJvcignRGF0YSBlbGVtZW50IGNpcmN1bGFyIHJlZmVyZW5jZSBkZXRlY3RlZDogJyArIHMuam9pbignIC0+ICcpKSwgZSkgOiBvKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIENlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgYXJndW1lbnRzWzBdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbYXJndW1lbnRzWzBdXSA9IGFyZ3VtZW50c1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3VtZW50c1swXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtuXSA9IHRbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgeGUgPSBzZXRUaW1lb3V0OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuY2F0Y2ggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRoZW4obnVsbCwgZSk7CiAgICAgICAgICAgICAgICB9LCBjLnByb3RvdHlwZS50aGVuID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG5ldyB0aGlzLmNvbnN0cnVjdG9yKG8pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB1KHRoaXMsIG5ldyBwKGUsIHQsIG4pKSwgbjsKICAgICAgICAgICAgICAgIH0sIGMucHJvdG90eXBlLmZpbmFsbHkgPSBpLCBjLmFsbCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBjKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSAmJiAoJ29iamVjdCcgPT0gdHlwZW9mIGEgfHwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBhLnRoZW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09IHR5cGVvZiBzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgcy5jYWxsKGEsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpW2VdID0gYSwgMCA9PSAtLW8gJiYgdChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKG5ldyBUeXBlRXJyb3IoJ1Byb21pc2UuYWxsIGFjY2VwdHMgYW4gYXJyYXknKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBpLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbyA9IGkubGVuZ3RoLCBzID0gMDsgcyA8IGkubGVuZ3RoOyBzKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByKHMsIGlbc10pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgYy5yZXNvbHZlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgZSAmJiBlLmNvbnN0cnVjdG9yID09PSBjID8gZSA6IG5ldyBjKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQoZSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBjLnJlamVjdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBjKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG4oZSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBjLnJhY2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgYyhmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbihuZXcgVHlwZUVycm9yKCdQcm9taXNlLnJhY2UgYWNjZXB0cyBhbiBhcnJheScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IDAsIGkgPSBlLmxlbmd0aDsgciA8IGk7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMucmVzb2x2ZShlW3JdKS50aGVuKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgYy5faW1tZWRpYXRlRm4gPSAnZnVuY3Rpb24nID09IHR5cGVvZiBzZXRJbW1lZGlhdGUgJiYgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBzZXRJbW1lZGlhdGUoZSk7CiAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgeGUoZSwgMCk7CiAgICAgICAgICAgICAgICB9LCBjLl91bmhhbmRsZWRSZWplY3Rpb25GbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGNvbnNvbGUgJiYgY29uc29sZSAmJiBjb25zb2xlLndhcm4oJ1Bvc3NpYmxlIFVuaGFuZGxlZCBQcm9taXNlIFJlamVjdGlvbjonLCBlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIga2UgPSBuKE9iamVjdC5mcmVlemUoewogICAgICAgICAgICAgICAgICAgICAgICBfX3Byb3RvX186IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6IGMKICAgICAgICAgICAgICAgICAgICB9KSksIHdlID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHdpbmRvdyAmJiB3aW5kb3cuUHJvbWlzZSB8fCB2b2lkIDAgIT09IEcgJiYgRy5Qcm9taXNlIHx8IGtlLmRlZmF1bHQgfHwga2UsIEVlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChyLCBpLCBhLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbywgcyA9IHIuZGVsYXlOZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgd2UoZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlKHIsIGEsIFthXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gci50aW1lb3V0LCB1ID0gbmV3IHdlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KG5ldyBFcnJvcignQSB0aW1lb3V0IG9jY3VycmVkIGJlY2F1c2UgdGhlIGFjdGlvbiB0b29rIGxvbmdlciB0aGFuICcgKyBjIC8gMTAwMCArICcgc2Vjb25kcyB0byBjb21wbGV0ZS4gJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlLnJhY2UoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkudGhlbih0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2xlYXJUaW1lb3V0KG8pLCBlID0gdChlKSwgbihyLCBpLCBlKSwgd2UucmVqZWN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBJZSA9IGZ1bmN0aW9uIChlLCB0LCBuLCByLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYSwgbywgcywgYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB3ZShmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUoYSwgcywgW3NdKSwgaSA9IGEudGltZW91dCwgbyA9IG5ldyB3ZShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChuZXcgRXJyb3IoJ0EgdGltZW91dCBvY2N1cnJlZCBiZWNhdXNlIHRoZSBjb25kaXRpb24gdG9vayBsb25nZXIgdGhhbiAnICsgaSAvIDEwMDAgKyAnIHNlY29uZHMgdG8gY29tcGxldGUuICcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ZS5yYWNlKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLnRoZW4odCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNsZWFyVGltZW91dChjKSwgZSA9IHQoZSksIHIoYSwgbywgZSksIHdlLnJlamVjdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjbGVhclRpbWVvdXQoYyksICFuKGEsIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoYSwgbyksIHdlLnJlamVjdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgRGUgPSB3ZS5yZXNvbHZlKCksIEFlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChyLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5jb25kaXRpb25zICYmIHIuY29uZGl0aW9ucy5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGUgPSBlKHQsIHIsIGksIERlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLmFjdGlvbnMgJiYgci5hY3Rpb25zLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZSA9IHQoZSwgciwgaSwgRGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIERlID0gKERlID0gRGUudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5jYXRjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBTZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCb29sZWFuKGUgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZS50aGVuKTsKICAgICAgICAgICAgICAgICAgICB9LCBUZSA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoaSwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaS5jb25kaXRpb25zKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSAwOyBzIDwgaS5jb25kaXRpb25zLmxlbmd0aDsgcysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBpLmNvbmRpdGlvbnNbc107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGUobywgYSwgW2FdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChTZShjKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1J1bGUgY29tcG9uZW50IHNlcXVlbmNpbmcgbXVzdCBiZSBlbmFibGVkIG9uIHRoZSBwcm9wZXJ0eSBmb3IgdGhpcyBjb25kaXRpb24gdG8gZnVuY3Rpb24gcHJvcGVybHkuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXQobywgYykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4obywgaSksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihvLCBpLCBlKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgUGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUobiwgcikgJiYgdChuLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBPZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmdldE1vZHVsZURlZmluaXRpb24odC5tb2R1bGVQYXRoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICYmIG4uZGlzcGxheU5hbWUgfHwgdC5tb2R1bGVQYXRoOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGplID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQucnVsZSwgciA9IHQuZXZlbnQsIGkgPSBlLmdldE1vZHVsZURlZmluaXRpb24oci5tb2R1bGVQYXRoKS5uYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdHlwZTogZS5nZXRNb2R1bGVFeHRlbnNpb25OYW1lKHIubW9kdWxlUGF0aCkgKyAnLicgKyBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRydWxlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBuLmlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBuLm5hbWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIExlID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIsIGksIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChvLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHMucnVsZSwgdSA9IHMuZXZlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LnNldHRpbmdzID0gdS5zZXR0aW5ncyB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBpKHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQodSwgbnVsbCwgW2Z1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4obCwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHIsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmVycm9yKHIodSwgYywgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIE1lID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChpLCBhLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHQoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmVycm9yKGUocywgYS5uYW1lLCBvKSksIHIoJ3J1bGVBY3Rpb25GYWlsZWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb246IGkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIFZlID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChpLCBhLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHQoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmVycm9yKGUocywgYS5uYW1lLCBvKSksIHIoJ3J1bGVDb25kaXRpb25GYWlsZWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb246IGkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIFJlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChyLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxvZygnQ29uZGl0aW9uICInICsgYSArICciIGZvciBydWxlICInICsgaS5uYW1lICsgJyIgd2FzIG5vdCBtZXQuJyksIG4oJ3J1bGVDb25kaXRpb25GYWlsZWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb246IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIE5lID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmxvZygnUnVsZSAiJyArIG4ubmFtZSArICciIGZpcmVkLicpLCB0KCdydWxlQ29tcGxldGVkJywgeyBydWxlOiBuIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIEZlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChyLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLmFjdGlvbnMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbyA9IDA7IG8gPCByLmFjdGlvbnMubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IHIuYWN0aW9uc1tvXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUoYSwgaSwgW2ldKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgdChhLCByLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ocik7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgQmUgPSBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGksIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoJ3J1bGVUcmlnZ2VyZWQnLCB7IHJ1bGU6IGEgfSksIGUgPyBuKGEsIGkpIDogdChhLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBVZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnRmFpbGVkIHRvIGV4ZWN1dGUgIicgKyBlICsgJyIgZm9yICInICsgdCArICciIHJ1bGUuICcgKyBuLm1lc3NhZ2UgKyAobi5zdGFjayA/ICdcbicgKyBuLnN0YWNrIDogJycpOwogICAgICAgICAgICAgICAgICAgIH0sIHplID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgIWUubmVnYXRlIHx8ICF0ICYmIGUubmVnYXRlOwogICAgICAgICAgICAgICAgICAgIH0sIHFlID0gW10sIEhlID0gITEsIFdlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgSGUgPyBlKCkgOiBxZS5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgIH0sIEdlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSh0KS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKFdlLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIEhlID0gITAsIHFlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHFlID0gW107CiAgICAgICAgICAgICAgICAgICAgfSwgWWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSB8fCAoZSA9IG5ldyBFcnJvcignVGhlIGV4dGVuc2lvbiB0cmlnZ2VyZWQgYW4gZXJyb3IsIGJ1dCBubyBlcnJvciBpbmZvcm1hdGlvbiB3YXMgcHJvdmlkZWQuJykpLCAhKGUgaW5zdGFuY2VvZiBFcnJvcikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJ29iamVjdCcgPT0gdHlwZW9mIGUgPyBKU09OLnN0cmluZ2lmeShlKSA6IFN0cmluZyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBuZXcgRXJyb3IodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgWGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBlICYmICdvYmplY3QnID09IHR5cGVvZiBlICYmICExID09PSBBcnJheS5pc0FycmF5KGUpOwogICAgICAgICAgICAgICAgICAgIH0sIEtlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG47CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMSAhPT0gZyhlKSAmJiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgKHQgPSBlLmNvbnN0cnVjdG9yKSAmJiAoITEgIT09IGcobiA9IHQucHJvdG90eXBlKSAmJiAhMSAhPT0gbi5oYXNPd25Qcm9wZXJ0eSgnaXNQcm90b3R5cGVPZicpKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgUWUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gS2UodCA9IHQgfHwge30pID8gdCA9IEUoe30sIHQsIGUpIDogRSh0LCBlKSwgdC5oYXNPd25Qcm9wZXJ0eSgndHlwZScpIHx8IE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAndHlwZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXLmRlcHJlY2F0aW9uKCdBY2Nlc3NpbmcgZXZlbnQudHlwZSBpbiBBZG9iZSBMYXVuY2ggaGFzIGJlZW4gZGVwcmVjYXRlZCBhbmQgd2lsbCBiZSByZW1vdmVkIHNvb24uIFBsZWFzZSB1c2UgZXZlbnQuJHR5cGUgaW5zdGVhZC4nKSwgdC4kdHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgJGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBpLm1vZHVsZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gPSBPYmplY3Qua2V5cyhhKSwgcyA9IDA7IHMgPCBvLmxlbmd0aDsgcysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG9bc10sIHUgPSBhW2NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUuc2hhcmVkICYmIHUubmFtZSA9PT0gcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5nZXRNb2R1bGVFeHBvcnRzKGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgSmUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPyBlKHQpIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgWmUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSByLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5zcGxpY2UoaS5sZW5ndGggLSAxIHx8IDEsIDAsICdtaW4nKSwgciA9IGkuam9pbignLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodCkgKyByOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGV0ID0gJy5qcycsIHR0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3Vic3RyKDAsIGUubGFzdEluZGV4T2YoJy8nKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgbnQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgIT09IGUuaW5kZXhPZih0LCBlLmxlbmd0aCAtIHQubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB9LCBydCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG50KHQsIGV0KSB8fCAodCArPSBldCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5zcGxpdCgnLycpLCByID0gdHQoZSkuc3BsaXQoJy8nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiAnLicgIT09IGUgJiYgKCcuLicgPT09IGUgPyByLmxlbmd0aCAmJiByLnBvcCgpIDogci5wdXNoKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIuam9pbignLycpOwogICAgICAgICAgICAgICAgICAgIH0sIGl0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB3ZShmdW5jdGlvbiAobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5vbmxvYWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQub25lcnJvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKG5ldyBFcnJvcignRmFpbGVkIHRvIGxvYWQgc2NyaXB0ICcgKyBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBhdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHQuc3JjID0gZSwgdC5hc3luYyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGl0KGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ2hlYWQnKVswXS5hcHBlbmRDaGlsZCh0KSwgbjsKICAgICAgICAgICAgICAgICAgICB9LCBvdCA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0IHx8ICcmJywgbiA9IG4gfHwgJz0nOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT0gdHlwZW9mIGUgfHwgMCA9PT0gZS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAvXCsvZzsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUuc3BsaXQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gMTAwMDsKICAgICAgICAgICAgICAgICAgICAgICAgciAmJiAnbnVtYmVyJyA9PSB0eXBlb2Ygci5tYXhLZXlzICYmIChvID0gci5tYXhLZXlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgbyA+IDAgJiYgcyA+IG8gJiYgKHMgPSBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IDA7IGMgPCBzOyArK2MpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1LCBsLCBkLCBmLCBwID0gZVtjXS5yZXBsYWNlKGEsICclMjAnKSwgbSA9IHAuaW5kZXhPZihuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gPj0gMCA/ICh1ID0gcC5zdWJzdHIoMCwgbSksIGwgPSBwLnN1YnN0cihtICsgMSkpIDogKHUgPSBwLCBsID0gJycpLCBkID0gZGVjb2RlVVJJQ29tcG9uZW50KHUpLCBmID0gZGVjb2RlVVJJQ29tcG9uZW50KGwpLCBoKGksIGQpID8gQXJyYXkuaXNBcnJheShpW2RdKSA/IGlbZF0ucHVzaChmKSA6IGlbZF0gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaVtkXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdIDogaVtkXSA9IGY7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgICAgICAgICAgfSwgc3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHR5cGVvZiBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3N0cmluZyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYm9vbGVhbic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/ICd0cnVlJyA6ICdmYWxzZSc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ251bWJlcic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNGaW5pdGUoZSkgPyBlIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBjdCA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gdCB8fCAnJicsIG4gPSBuIHx8ICc9JywgbnVsbCA9PT0gZSAmJiAoZSA9IHZvaWQgMCksICdvYmplY3QnID09IHR5cGVvZiBlID8gT2JqZWN0LmtleXMoZSkubWFwKGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGVuY29kZVVSSUNvbXBvbmVudChzdChyKSkgKyBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LmlzQXJyYXkoZVtyXSkgPyBlW3JdLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpICsgZW5jb2RlVVJJQ29tcG9uZW50KHN0KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4odCkgOiBpICsgZW5jb2RlVVJJQ29tcG9uZW50KHN0KGVbcl0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbih0KSA6IHIgPyBlbmNvZGVVUklDb21wb25lbnQoc3QocikpICsgbiArIGVuY29kZVVSSUNvbXBvbmVudChzdChlKSkgOiAnJzsKICAgICAgICAgICAgICAgICAgICB9LCB1dCA9IHIoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdC5kZWNvZGUgPSB0LnBhcnNlID0gb3QsIHQuZW5jb2RlID0gdC5zdHJpbmdpZnkgPSBjdDsKICAgICAgICAgICAgICAgICAgICB9KSwgbHQgPSAnQGFkb2JlL3JlYWN0b3ItJywgZHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZTogWCwKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQ6IF8sCiAgICAgICAgICAgICAgICAgICAgICAgICdsb2FkLXNjcmlwdCc6IGF0LAogICAgICAgICAgICAgICAgICAgICAgICAnb2JqZWN0LWFzc2lnbic6IEUsCiAgICAgICAgICAgICAgICAgICAgICAgIHByb21pc2U6IHdlLAogICAgICAgICAgICAgICAgICAgICAgICAncXVlcnktc3RyaW5nJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09IHR5cGVvZiBlICYmIChlID0gZS50cmltKCkucmVwbGFjZSgvXls/IyZdLywgJycpKSwgdXQucGFyc2UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5naWZ5OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1dC5zdHJpbmdpZnkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdzogSQogICAgICAgICAgICAgICAgICAgIH0sIGZ0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gdC5pbmRleE9mKGx0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5zdWJzdHIobHQubGVuZ3RoKSwgciA9IGR0W25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSB0LmluZGV4T2YoJy4vJykgfHwgMCA9PT0gdC5pbmRleE9mKCcuLi8nKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQ2Fubm90IHJlc29sdmUgbW9kdWxlICInICsgdCArICciLicpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIHB0ID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIsIGksIGEsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBlLmV4dGVuc2lvbnMsIGMgPSBlLmJ1aWxkSW5mbywgdSA9IGUuZW52aXJvbm1lbnQsIGwgPSBlLnByb3BlcnR5LnNldHRpbmdzOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAocykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSAkZShzLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKHMpLmZvckVhY2goZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IHNbZl0sIG0gPSBwLnNldHRpbmdzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkocC5maWxlUGF0aHMpICYmIChtID0gYShtLCBwLmZpbGVQYXRocykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gSmUociwgbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHAubW9kdWxlcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IFcuY3JlYXRlUHJlZml4ZWRMb2dnZXIocC5kaXNwbGF5TmFtZSksIHYgPSBaZShvLCBwLmhvc3RlZExpYkZpbGVzQmFzZVVybCwgYy5taW5pZmllZCksIGIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRJbmZvOiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudmlyb25tZW50OiB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGUucHJvcGVydHkubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGUucHJvcGVydHkuaWQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldERhdGFFbGVtZW50VmFsdWU6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RXh0ZW5zaW9uU2V0dGluZ3M6IGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SG9zdGVkTGliRmlsZVVybDogdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRTaGFyZWRNb2R1bGU6IGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyOiBoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5U2V0dGluZ3M6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVwbGFjZVRva2VuczogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkRlYnVnQ2hhbmdlZDogbi5vbkRlYnVnQ2hhbmdlZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQgZGVidWdFbmFibGVkKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5nZXREZWJ1Z0VuYWJsZWQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhwLm1vZHVsZXMpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gcC5tb2R1bGVzW2VdLCByID0gZnQoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBydChlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZ2V0TW9kdWxlRXhwb3J0cyhyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucmVnaXN0ZXJNb2R1bGUoZSwgbiwgZiwgciwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0Lmh5ZHJhdGVDYWNoZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sIG10ID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBXLmNyZWF0ZVByZWZpeGVkTG9nZ2VyKCdDdXN0b20gU2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUudHJhY2sgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgVy5sb2coJyInICsgZSArICciIGRvZXMgbm90IG1hdGNoIGFueSBkaXJlY3QgY2FsbCBpZGVudGlmaWVycy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5nZXRWaXNpdG9ySWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm9wZXJ0eSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IHQucHJvcGVydHkubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiB0LnByb3BlcnR5LmlkCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuY29tcGFueSA9IHQuY29tcGFueSwgZS5idWlsZEluZm8gPSB0LmJ1aWxkSW5mbywgZS5lbnZpcm9ubWVudCA9IHQuZW52aXJvbm1lbnQsIGUubG9nZ2VyID0gYSwgZS5ub3RpZnkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChXLmRlcHJlY2F0aW9uKCdfc2F0ZWxsaXRlLm5vdGlmeSBpcyBkZXByZWNhdGVkLiBQbGVhc2UgdXNlIHRoZSBgX3NhdGVsbGl0ZS5sb2dnZXJgIEFQSS4nKSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuaW5mbyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLndhcm4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5lcnJvcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5sb2coZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZ2V0VmFyID0gciwgZS5zZXRWYXIgPSBpLCBlLnNldENvb2tpZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICcnLCBpID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIChyID0gJywgeyBleHBpcmVzOiAnICsgbiArICcgfScsIGkuZXhwaXJlcyA9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAnX3NhdGVsbGl0ZS5zZXRDb29raWUgaXMgZGVwcmVjYXRlZC4gUGxlYXNlIHVzZSBfc2F0ZWxsaXRlLmNvb2tpZS5zZXQoIicgKyBlICsgJyIsICInICsgdCArICciJyArIHIgKyAnKS4nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgVy5kZXByZWNhdGlvbihhKSwgWC5zZXQoZSwgdCwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucmVhZENvb2tpZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVy5kZXByZWNhdGlvbignX3NhdGVsbGl0ZS5yZWFkQ29va2llIGlzIGRlcHJlY2F0ZWQuIFBsZWFzZSB1c2UgX3NhdGVsbGl0ZS5jb29raWUuZ2V0KCInICsgZSArICciKS4nKSwgWC5nZXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucmVtb3ZlQ29va2llID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFcuZGVwcmVjYXRpb24oJ19zYXRlbGxpdGUucmVtb3ZlQ29va2llIGlzIGRlcHJlY2F0ZWQuIFBsZWFzZSB1c2UgX3NhdGVsbGl0ZS5jb29raWUucmVtb3ZlKCInICsgZSArICciKS4nKSwgWC5yZW1vdmUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuY29va2llID0gWCwgZS5wYWdlQm90dG9tID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnNldERlYnVnID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsICdfY29udGFpbmVyJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gfHwgKFcud2FybignX3NhdGVsbGl0ZS5fY29udGFpbmVyIG1heSBjaGFuZ2UgYXQgYW55IHRpbWUgYW5kIHNob3VsZCBvbmx5IGJlIHVzZWQgZm9yIGRlYnVnZ2luZy4nKSwgbyA9ICEwKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZ3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gXy5xdWVyeVNlbGVjdG9yQWxsKCdzY3JpcHQnKSwgbiA9IDA7IG4gPCB0Lmxlbmd0aDsgbisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS50ZXN0KHIuc3JjKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGh0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuLCByLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBLZShuKSAmJiBPYmplY3Qua2V5cyhuKS5sZW5ndGggJiYgQXJyYXkuaXNBcnJheShyKSAmJiByLmxlbmd0aCA/IChyLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCb29sZWFuKG51bGwgIT0gaSAmJiAvXmNvcmVcLy4qYWN0aW9ucy4qXC9jdXN0b21Db2RlXC5qcyQvLnRlc3QoaSkpICYmICdzb3VyY2UnID09PSBlICYmICFuLmlzRXh0ZXJuYWwgfHwgeShlLnNwbGl0KCcuJyksIG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG4pIDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCB2dCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VHVyYmluZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGd0KG5ldyBSZWdFeHAoLyhsYXVuY2h8c2F0ZWxsaXRlTGliKS1bXlwvXSsuanMoXD8uKik/JC8pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgYnlSZWdleFBhdHRlcm46IGd0CiAgICAgICAgICAgICAgICAgICAgfS5nZXRUdXJiaW5lLCBidCA9IHdpbmRvdy5fc2F0ZWxsaXRlOwogICAgICAgICAgICAgICAgaWYgKGJ0ICYmICF3aW5kb3cuX19zYXRlbGxpdGVMb2FkZWQpIHsKICAgICAgICAgICAgICAgICAgICB3aW5kb3cuX19zYXRlbGxpdGVMb2FkZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICB2YXIgeXQgPSBidC5jb250YWluZXI7CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGJ0LmNvbnRhaW5lcjsKICAgICAgICAgICAgICAgICAgICB2YXIgX3QgPSBFKHt9LCB5dC5idWlsZEluZm8pOwogICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfdCwgJ2Vudmlyb25tZW50JywgewogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXLmRlcHJlY2F0aW9uKCdjb250YWluZXIuYnVpbGRJbmZvLmVudmlyb25tZW50IGlzIGRlcHJlY2F0ZWQuUGxlYXNlIHVzZSBgY29udGFpbmVyLmVudmlyb25tZW50LnN0YWdlYCBpbnN0ZWFkJyksIHl0LmVudmlyb25tZW50LnN0YWdlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSksIHl0LmJ1aWxkSW5mbyA9IF90OwogICAgICAgICAgICAgICAgICAgIHZhciBDdCwgeHQgPSBUKFEoJ2xvY2FsU3RvcmFnZScpLCBXKSwga3QgPSAnJzsKICAgICAgICAgICAgICAgICAgICBfLmN1cnJlbnRTY3JpcHQgJiYgXy5jdXJyZW50U2NyaXB0LmdldEF0dHJpYnV0ZSgnc3JjJykgPyBrdCA9IF8uY3VycmVudFNjcmlwdC5nZXRBdHRyaWJ1dGUoJ3NyYycpIDogdnQoKSAmJiAoa3QgPSB2dCgpLmdldEF0dHJpYnV0ZSgnc3JjJykpOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEN0ID0gRChrdCwgeXQuY29tcGFueS5jZG5BbGxvd0xpc3QsIHh0KTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFcud2FybignUGxlYXNlIHJldmlldyB0aGUgZm9sbG93aW5nIGVycm9yOicpLCBlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgd3QsIEV0ID0gaHQoQ3QuaXNEeW5hbWljRW5mb3JjZWQsIEN0LmRlY29yYXRlV2l0aER5bmFtaWNIb3N0KSwgSXQgPSB2ZSgpLCBEdCA9IHl0LnByb3BlcnR5LnNldHRpbmdzLnVuZGVmaW5lZFZhcnNSZXR1cm5FbXB0eSwgQXQgPSB5dC5wcm9wZXJ0eS5zZXR0aW5ncy5ydWxlQ29tcG9uZW50U2VxdWVuY2luZ0VuYWJsZWQsIFN0ID0geXQuZGF0YUVsZW1lbnRzIHx8IHt9OwogICAgICAgICAgICAgICAgICAgIHVlLm1pZ3JhdGVDb29raWVEYXRhKFN0KTsKICAgICAgICAgICAgICAgICAgICB2YXIgVHQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFN0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBQdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3dC5hcHBseShudWxsLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBPdCA9IGRlKEl0LCBUdCwgUHQsIER0LCBFdCksIGp0ID0ge30sIEx0ID0gQ2UoanQpLCBNdCA9IGdlKGp0LCBUdCksIFZ0ID0gbWUoanQsIFR0LCBPdCk7CiAgICAgICAgICAgICAgICAgICAgd3QgPSBfZShNdCwgVnQsIER0KSwgbXQoYnQsIHl0LCB4dC5zZXREZWJ1Z0VuYWJsZWQsIFZ0LCBMdCksIHB0KHl0LCBJdCwgeHQsIHd0LCBPdCwgRXQsIEN0LmRlY29yYXRlV2l0aER5bmFtaWNIb3N0KTsKICAgICAgICAgICAgICAgICAgICB2YXIgUnQgPSB5ZShidCksIE50ID0gTyhJdCwgd3QsIEV0KSwgRnQgPSBPZShJdCksIEJ0ID0gUmUoRnQsIFcsIFJ0KSwgVXQgPSBWZShVZSwgRnQsIFcsIFJ0KSwgenQgPSBNZShVZSwgRnQsIFcsIFJ0KSwgcXQgPSBOZShXLCBSdCksIEh0ID0gTGUoQmUoQXQsIFBlKFRlKE50LCB6ZSwgQnQsIFV0KSwgRmUoTnQsIHp0LCBxdCkpLCBBZShJZShOdCwgWWUsIHplLCBVdCwgQnQpLCBFZShOdCwgWWUsIHp0KSwgcXQpLCBSdCksIE50LCBRZSwgVWUsIGplKEl0KSwgVyk7CiAgICAgICAgICAgICAgICAgICAgR2UoQSwgeXQucnVsZXMgfHwgW10sIEh0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBidDsKICAgICAgICAgICAgfQogICAgICAgICAgICBjb25zb2xlLndhcm4oJ0Fkb2JlIExhdW5jaCBpcyB1bnN1cHBvcnRlZCBpbiBJRSA5IGFuZCBiZWxvdy4nKTsKICAgICAgICB9KCk7CiAgICAgICAgX3NhdGVsbGl0ZSA9ICRfX192YXJfNTZiMDdlNWY3MDkxMGZkMTsKICAgIH0oKSkKfQ=="},{"name":"sugarcoat-78a233d465e2385b4f1804ca5bfbacecc08cc23b","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfODQ4NjNlYmVhNzg3Mzg5YiA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBsZXQgaXNTZWFsZWQgPSBmYWxzZTsKICAgICAgICBjbGFzcyBTdG9yYWdlIHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBpZiAoaXNTZWFsZWQpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IGxlbmd0aCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyh0aGlzKS5sZW5ndGg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAga2V5KGluZGV4KSB7CiAgICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXModGhpcyk7CiAgICAgICAgICAgICAgICBpZiAoaW5kZXggPCAwIHx8IGluZGV4ID49IGtleXMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4ga2V5c1tpbmRleF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0SXRlbShrZXkpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwodGhpcywga2V5KSA/IHRoaXNba2V5XSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0SXRlbShrZXksIHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW2tleV0gPSBTdHJpbmcodmFsdWUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJlbW92ZUl0ZW0oa2V5KSB7CiAgICAgICAgICAgICAgICBkZWxldGUgdGhpc1trZXldOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGNsZWFyKCkgewogICAgICAgICAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKHRoaXMpOwogICAgICAgICAgICAgICAgZm9yIChjb25zdCBrZXkgb2Yga2V5cykgewogICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2tleV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5TdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBTdG9yYWdlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY29uc3QgbG9jYWxTdG9yYWdlID0gbmV3IFN0b3JhZ2UoKTsKICAgICAgICBleHBvcnRzLmxvY2FsU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbG9jYWxTdG9yYWdlOwogICAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBjb25zdCBzZXNzaW9uU3RvcmFnZSA9IG5ldyBTdG9yYWdlKCk7CiAgICAgICAgZXhwb3J0cy5zZXNzaW9uU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gc2Vzc2lvblN0b3JhZ2U7CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGlzU2VhbGVkID0gdHJ1ZTsKICAgIH0pKCRfX19tb2NrXzg0ODYzZWJlYTc4NzM4OWIpOwogICAgY29uc3QgJF9fX21vY2tfMjc3YzYyYzZkNDc5NTk3NiA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja18yNzdjNjJjNmQ0Nzk1OTc2KTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHZhciByID0gd2luZG93LndlYnBhY2tKc29ucDsKICAgICAgICAgICAgd2luZG93LndlYnBhY2tKc29ucCA9IGZ1bmN0aW9uIChuLCB0LCBvKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjLCBhLCBpLCB1ID0gMCwgcCA9IFtdOyB1IDwgbi5sZW5ndGg7IHUrKykKICAgICAgICAgICAgICAgICAgICBhID0gblt1XSwgX1thXSAmJiBwLnB1c2goX1thXVswXSksIF9bYV0gPSAwOwogICAgICAgICAgICAgICAgZm9yIChjIGluIHQpCiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHQsIGMpICYmIChlW2NdID0gdFtjXSk7CiAgICAgICAgICAgICAgICBmb3IgKHIgJiYgcihuLCB0LCBvKTsgcC5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgIHAuc2hpZnQoKSgpOwogICAgICAgICAgICAgICAgaWYgKG8pCiAgICAgICAgICAgICAgICAgICAgZm9yICh1ID0gMDsgdSA8IG8ubGVuZ3RoOyB1KyspCiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBfX3dlYnBhY2tfcmVxdWlyZV9fKF9fd2VicGFja19yZXF1aXJlX18ucyA9IG9bdV0pOwogICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBuID0ge30sIF8gPSB7IDU6IDAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gX193ZWJwYWNrX3JlcXVpcmVfXyhyKSB7CiAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkX2I5N2E1NzQwNTliZjY0OTUgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyksICRfX19vbGRfY2JlOTgzMDI0MzM1ZWU0YyA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdzZXNzaW9uU3RvcmFnZScpLCAkX19fb2xkX2IyNjVhZmVkYmVhMDQ3ZTQgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYjk3YTU3NDA1OWJmNjQ5NSkKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2xvY2FsU3RvcmFnZScsICRfX19tb2NrXzg0ODYzZWJlYTc4NzM4OWIubG9jYWxTdG9yYWdlKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfY2JlOTgzMDI0MzM1ZWU0YykKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ3Nlc3Npb25TdG9yYWdlJywgJF9fX21vY2tfODQ4NjNlYmVhNzg3Mzg5Yi5zZXNzaW9uU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2IyNjVhZmVkYmVhMDQ3ZTQpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzI3N2M2MmM2ZDQ3OTU5NzYuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAobltyXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuW3JdLmV4cG9ydHM7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBfID0gbltyXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGk6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cG9ydHM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3JdLmNhbGwoXy5leHBvcnRzLCBfLCBfLmV4cG9ydHMsIF9fd2VicGFja19yZXF1aXJlX18pLCBfLmwgPSAhMCwgXy5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYjk3YTU3NDA1OWJmNjQ5NSkKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2xvY2FsU3RvcmFnZScsICRfX19vbGRfYjk3YTU3NDA1OWJmNjQ5NSkpOwogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2NiZTk4MzAyNDMzNWVlNGMpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdzZXNzaW9uU3RvcmFnZScsICRfX19vbGRfY2JlOTgzMDI0MzM1ZWU0YykpOwogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2IyNjVhZmVkYmVhMDQ3ZTQpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfYjI2NWFmZWRiZWEwNDdlNCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIF9fd2VicGFja19yZXF1aXJlX18uZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IF9bZV07CiAgICAgICAgICAgICAgICBpZiAoMCA9PT0gcikKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSgpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgaWYgKHIpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJbMl07CiAgICAgICAgICAgICAgICB2YXIgbiA9IG5ldyBQcm9taXNlKGZ1bmN0aW9uIChuLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgciA9IF9bZV0gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIG4sCiAgICAgICAgICAgICAgICAgICAgICAgIHQKICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICByWzJdID0gbjsKICAgICAgICAgICAgICAgIHZhciB0ID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ2hlYWQnKVswXSwgbyA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgby50eXBlID0gJ3RleHQvamF2YXNjcmlwdCcsIG8uY2hhcnNldCA9ICd1dGYtOCcsIG8uYXN5bmMgPSAhMCwgby50aW1lb3V0ID0gMTIwMDAwLCBfX3dlYnBhY2tfcmVxdWlyZV9fLm5jICYmIG8uc2V0QXR0cmlidXRlKCdub25jZScsIF9fd2VicGFja19yZXF1aXJlX18ubmMpLCBvLnNyYyA9IF9fd2VicGFja19yZXF1aXJlX18ucCArICcnICsgZSArICcuYTExM2IxMzZlYmRjZTAxY2YxNmQuY2h1bmsuanMnOwogICAgICAgICAgICAgICAgdmFyIGMgPSBzZXRUaW1lb3V0KG9uU2NyaXB0Q29tcGxldGUsIDEyMDAwMCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvblNjcmlwdENvbXBsZXRlKCkgewogICAgICAgICAgICAgICAgICAgIG8ub25lcnJvciA9IG8ub25sb2FkID0gbnVsbCwgY2xlYXJUaW1lb3V0KGMpOwogICAgICAgICAgICAgICAgICAgIHZhciByID0gX1tlXTsKICAgICAgICAgICAgICAgICAgICAwICE9PSByICYmIChyICYmIHJbMV0obmV3IEVycm9yKCdMb2FkaW5nIGNodW5rICcgKyBlICsgJyBmYWlsZWQuJykpLCBfW2VdID0gdm9pZCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBvLm9uZXJyb3IgPSBvLm9ubG9hZCA9IG9uU2NyaXB0Q29tcGxldGUsIHQuYXBwZW5kQ2hpbGQobyksIG47CiAgICAgICAgICAgIH0sIF9fd2VicGFja19yZXF1aXJlX18ubSA9IGUsIF9fd2VicGFja19yZXF1aXJlX18uYyA9IG4sIF9fd2VicGFja19yZXF1aXJlX18uaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfSwgX193ZWJwYWNrX3JlcXVpcmVfXy5kID0gZnVuY3Rpb24gKGUsIHIsIG4pIHsKICAgICAgICAgICAgICAgIF9fd2VicGFja19yZXF1aXJlX18ubyhlLCByKSB8fCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgciwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITEsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgZ2V0OiBuCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwgX193ZWJwYWNrX3JlcXVpcmVfXy5uID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHZhciByID0gZSAmJiBlLl9fZXNNb2R1bGUgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZGVmYXVsdDsKICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIF9fd2VicGFja19yZXF1aXJlX18uZChyLCAnYScsIHIpLCByOwogICAgICAgICAgICB9LCBfX3dlYnBhY2tfcmVxdWlyZV9fLm8gPSBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLCByKTsKICAgICAgICAgICAgfSwgX193ZWJwYWNrX3JlcXVpcmVfXy5wID0gJy8nLCBfX3dlYnBhY2tfcmVxdWlyZV9fLm9lID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHRocm93IGNvbnNvbGUuZXJyb3IoZSksIGU7CiAgICAgICAgICAgIH0sIF9fd2VicGFja19yZXF1aXJlX18oX193ZWJwYWNrX3JlcXVpcmVfXy5zID0gMjA4KTsKICAgICAgICB9KHsKICAgICAgICAgICAgMTkxOiBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChlLCByLCBuLCBfLCB0LCBvLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgZS5Hb29nbGVBbmFseXRpY3NPYmplY3QgPSB0LCBlLmdhID0gZS5nYSB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIChlLmdhLnEgPSBlLmdhLnEgfHwgW10pLnB1c2goYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB9LCBlLmdhLmwgPSAxICogbmV3IERhdGUoKSwgbyA9IHIuY3JlYXRlRWxlbWVudChuKSwgYyA9IHIuZ2V0RWxlbWVudHNCeVRhZ05hbWUobilbMF0sIG8uYXN5bmMgPSAxLCBvLnNyYyA9ICdodHRwczovL3d3dy5nb29nbGUtYW5hbHl0aWNzLmNvbS9hbmFseXRpY3MuanMnLCBjLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKG8sIGMpOwogICAgICAgICAgICAgICAgfSh3aW5kb3csIGRvY3VtZW50LCAnc2NyaXB0JywgMCwgJ2dhJyksIGdhKCdjcmVhdGUnLCAnVUEtOTg3NTc4NS0yNScsICdhdXRvJyksIGdhKCdzZW5kJywgJ3BhZ2V2aWV3Jyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDIwODogZnVuY3Rpb24gKGUsIHIsIG4pIHsKICAgICAgICAgICAgICAgIHdpbmRvdy5sb2NhdGlvbi5vcmlnaW4uaW5kZXhPZignbGl2ZS5ob3VzZS5nb3YnKSA+IC0xICYmIG4oMTkxKTsKICAgICAgICAgICAgfQogICAgICAgIH0pOwogICAgfSgpKQp9"},{"name":"sugarcoat-7cf18f09d6a063650697adab76d51d51cddc3f58","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfY2E5MTgwNDNjNzQ1MTE3ZSA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBsZXQgaXNTZWFsZWQgPSBmYWxzZTsKICAgICAgICBjbGFzcyBTdG9yYWdlIHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBpZiAoaXNTZWFsZWQpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IGxlbmd0aCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyh0aGlzKS5sZW5ndGg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAga2V5KGluZGV4KSB7CiAgICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXModGhpcyk7CiAgICAgICAgICAgICAgICBpZiAoaW5kZXggPCAwIHx8IGluZGV4ID49IGtleXMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4ga2V5c1tpbmRleF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0SXRlbShrZXkpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwodGhpcywga2V5KSA/IHRoaXNba2V5XSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0SXRlbShrZXksIHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW2tleV0gPSBTdHJpbmcodmFsdWUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJlbW92ZUl0ZW0oa2V5KSB7CiAgICAgICAgICAgICAgICBkZWxldGUgdGhpc1trZXldOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGNsZWFyKCkgewogICAgICAgICAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKHRoaXMpOwogICAgICAgICAgICAgICAgZm9yIChjb25zdCBrZXkgb2Yga2V5cykgewogICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2tleV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5TdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBTdG9yYWdlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY29uc3QgbG9jYWxTdG9yYWdlID0gbmV3IFN0b3JhZ2UoKTsKICAgICAgICBleHBvcnRzLmxvY2FsU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbG9jYWxTdG9yYWdlOwogICAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBjb25zdCBzZXNzaW9uU3RvcmFnZSA9IG5ldyBTdG9yYWdlKCk7CiAgICAgICAgZXhwb3J0cy5zZXNzaW9uU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gc2Vzc2lvblN0b3JhZ2U7CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGlzU2VhbGVkID0gdHJ1ZTsKICAgIH0pKCRfX19tb2NrX2NhOTE4MDQzYzc0NTExN2UpOwogICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICB3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlRyYWNraW5nUG9pbnRJZCA9IDU5ODk2ODM1OwogICAgICAgIHdpbmRvdy5BZGZvcm0uVHJhY2tpbmcuVHJhY2tpbmdQb2ludE5hbWUgPSAnU2t5X0NvcnBvcmF0ZV9VbmlxdWUnOwogICAgICAgIEFkZm9ybS5UcmFja2luZy5DcmVhdGVJZnJhbWVFbGVtZW50KCdodHRwczovL3RyYWNrLmFkZm9ybS5uZXQvc2VydmluZy9jb250YWluZXIvP3BtPTEyNDA3NiZsaWQ9NTk4OTY4MzUmY3R5cGU9MCZtZWRpYT0wJlBhZ2VOYW1lPVNreV9Db3Jwb3JhdGVfVW5pcXVlJnN5c3ZhcnM9JTdjJTdjJTdjJTdjJml0bT1leUpwWkNJNklpSXNJbk4yT0RZaU9pSm9kSFJ3Y3pvdkwzZDNkeTV6YTNrdWFYUXZJaXdpYzNZNE55STZJbU52Y25CdmNtRjBaU0lzSW5OMk9EZ2lPaUpvYjIxbElpd2ljM1k0T1NJNkluZGxZaUlzSW5OMk9USWlPaUlpTENKemRqa3pJam9pYzJ0NU9taHZiV1VpZlEmcm5kPTE1NDA5NDY2NDEmY3ByZWY9JmxvYz1odHRwcyUzYSUyZiUyZnd3dy5za3kuaXQlMmYnLCBudWxsLCB7CiAgICAgICAgICAgICdfX0FERlNWNjVfXyc6ICcnLAogICAgICAgICAgICAnX19BREZTVjYwX18nOiAnJywKICAgICAgICAgICAgJ19fQURGU1Y2Nl9fJzogJycsCiAgICAgICAgICAgICdfX0FERlNWODZfXyc6ICdodHRwczovL3d3dy5za3kuaXQvJwogICAgICAgIH0pOwogICAgICAgIHRyeSB7CiAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSAnaHR0cHM6Ly93d3cuc2t5Lml0Lyc7CiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC90di9za3lxL2ZpYnJhJykgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICd3d3cuc2t5Lml0fGNvcnBvcmF0ZXxjb21lLXZlZGVyZXxza3lxLWZpYnJhfHNreTpjb21lLXZlZGVyZTpza3lxLWZpYnJhJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSAnaHR0cHM6Ly93d3cuc2t5Lml0Lyc7CiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlJykgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICd3d3cuc2t5Lml0fGNvcnBvcmF0ZXxhY3F1aXN0YXxob21lfHNreTphY3F1aXN0YTpob21lJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSAnaHR0cHM6Ly93d3cuc2t5Lml0Lyc7CiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC90dicpIHsKICAgICAgICAgICAgICAgICAgICBhZGYudHJhY2soMTI0MDc2LCAnd3d3LnNreS5pdHxjb3Jwb3JhdGV8cGFjY2hldHRpLW9mZmVydGV8aW5kZXh8c2t5OnBhY2NoZXR0aS1vZmZlcnRlOmluZGV4Jyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSAnaHR0cHM6Ly93d3cuc2t5Lml0Lyc7CiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC90di9za3ktY2luZW1hJykgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICd3d3cuc2t5Lml0fGNvcnBvcmF0ZXxwYWNjaGV0dGkgZSBvZmZlcnRlfHNreSBjaW5lbWF8c2t5OnBhY2NoZXR0aSBlIG9mZmVydGU6c2t5IGNpbmVtYScpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gJ2h0dHBzOi8vd3d3LnNreS5pdC8nOwogICAgICAgICAgICAgICAgaWYgKHZhbHVlID09ICdodHRwczovL3d3dy5za3kuaXQvdHYvc2t5LXR2JykgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICd3d3cuc2t5Lml0fGNvcnBvcmF0ZXxwYWNjaGV0dGkgZSBvZmZlcnRlfHNreSB0dnxza3k6cGFjY2hldHRpIGUgb2ZmZXJ0ZTpza3kgdHYnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciB2YWx1ZSA9ICdodHRwczovL3d3dy5za3kuaXQvJzsKICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L3NreS10di9zZXJpZS10dicpIHsKICAgICAgICAgICAgICAgICAgICBhZGYudHJhY2soMTI0MDc2LCAnd3d3LnNreS5pdHxza3k6cGFjY2hldHRpLW9mZmVydGU6c2t5LXR2OnNlcmllLXR2Jyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSAnaHR0cHM6Ly93d3cuc2t5Lml0Lyc7CiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2FiYm9uYW1lbnRvLWludHJhdHRlbmltZW50by1wbHVzJykgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICd3d3cuc2t5Lml0fGNvcnBvcmF0ZXxwYWNjaGV0dGktb2ZmZXJ0ZXxpbnRyYXR0ZW5pbWVudG8tcGx1c3xza3k6cGFjY2hldHRpLW9mZmVydGU6aW50cmF0dGVuaW1lbnRvLXBsdXM6bnVvdmktY2xpZW50aScpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gJ2h0dHBzOi8vd3d3LnNreS5pdC8nOwogICAgICAgICAgICAgICAgaWYgKHZhbHVlID09ICdodHRwczovL3d3dy5za3kuaXQvdHYvc2t5LWZhbWlnbGlhJykgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICdza3kuaXR8b2ZmZXJ0YS1za3l8cGFjY2hldHRpLWNhbmFsaXxza3ktZmFtaWdsaWEnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciB2YWx1ZSA9ICdodHRwczovL3d3dy5za3kuaXQvJzsKICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L29mZmVydGUvYWJib25hbWVudG8tY2luZW1hJykgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICd3d3cuc2t5Lml0fGNvcnBvcmF0ZXxsYW5kaW5nfGFiYm9uYXJzaXxza3k6bGFuZGluZzphYmJvbmFyc2k6Y2luZW1hJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSAnaHR0cHM6Ly93d3cuc2t5Lml0Lyc7CiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2FiYm9uYW1lbnRvLWRpZ2l0YWxlLXRlcnJlc3RyZScpIHsKICAgICAgICAgICAgICAgICAgICBhZGYudHJhY2soMTI0MDc2LCAnd3d3LnNreS5pdHxjb3Jwb3JhdGV8bGFuZGluZ3xhYmJvbmFyc2l8c2t5OmxhbmRpbmc6YWJib25hcnNpOnNreS1kaWdpdGFsZS10ZXJyZXN0cmUnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciB2YWx1ZSA9ICdodHRwczovL3d3dy5za3kuaXQvJzsKICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L29mZmVydGUvYWJib25hbWVudG8tc3BvcnQvY2luZW1hJykgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICd3d3cuc2t5Lml0fGNvcnBvcmF0ZXxwYWNjaGV0dGkgZSBvZmZlcnRlfHNreSBzcG9ydHxza3k6cGFjY2hldHRpIGUgb2ZmZXJ0ZTpza3kgc3BvcnQnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciB2YWx1ZSA9ICdodHRwczovL3d3dy5za3kuaXQvJzsKICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L2xhbmRpbmctbmV3L2FiYm9uYXJzaS9zZXJpZXR2JykgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICdMUF9CcmFuZF9zZXJpZVRWJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSAnaHR0cHM6Ly93d3cuc2t5Lml0Lyc7CiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9sYW5kaW5nLW5ldy9hYmJvbmFyc2kvcGFyYXNpdGUnKSB7CiAgICAgICAgICAgICAgICAgICAgYWRmLnRyYWNrKDEyNDA3NiwgJ0xQX0JyYW5kX3BhcmFzaXRlJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgIGlmICgnY29ycG9yYXRlJyA9PSAnY29ycG9yYXRlJyAmJiAoJ2hvbWUnID09ICd0dicgJiYgISdodHRwczovL3d3dy5za3kuaXQvJy5tYXRjaCgncHJpbWFmaWxhJykgfHwgJ2hvbWUnID09ICdvZmZlcnRlJykpIHsKICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICdBbmFsaXNpX09yZ2FuaWNvX0JyYW5kaW5nJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gJ2h0dHBzOi8vd3d3LnNreS5pdC8nOwogICAgICAgICAgICAgICAgaWYgKHZhbHVlID09ICdodHRwczovL3d3dy5za3kuaXQvbGFuZGluZy1uZXcvYWJib25hcnNpL3Byb21vc2t5Y2FsY2lvJykgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICdMUF9DYWxjaW9fZGVza19naXUyMCcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gJ2h0dHBzOi8vd3d3LnNreS5pdC8nOwogICAgICAgICAgICAgICAgaWYgKHZhbHVlID09ICdodHRwczovL3d3dy5za3kuaXQvY2FsbG1lbm93LW5ldy9yZXMvcHJvbW9za3ljYWxjaW9tb2JpbGUnKSB7CiAgICAgICAgICAgICAgICAgICAgYWRmLnRyYWNrKDEyNDA3NiwgJ0xQX0NhbGNpb19tb2JpbGVfZ2l1MjAnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGlmICgnY29ycG9yYXRlJyA9PSAnY29ycG9yYXRlJyAmJiAoJ2hvbWUnICE9PSAnbGFuZGluZy1uZXcnICYmICdob21lJyAhPT0gJ2NhbGxtZW5vdy1uZXcnKSkgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICdTa3lfT3JnYW5pY19Db3Jwb3JhdGUnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9sYW5kaW5nLW5ldy9hYmJvbmFyc2kvc2VyaWV0dicgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvbGFuZGluZy1uZXcvYWJib25hcnNpL2NpbmVtYWJyYW5kJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9sYW5kaW5nLW5ldy9hYmJvbmFyc2kvZ2FuZ3NvZmxvbmRvbicgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvbGFuZGluZy1uZXcvYWJib25hcnNpL3NreXNwb3J0JyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9sYW5kaW5nLW5ldy9hYmJvbmFyc2kvcGFyYXNpdGUnKSB7CiAgICAgICAgICAgICAgICAgICAgYWRmLnRyYWNrKDEyNDA3NiwgJ0xQX0JyYW5kX3NlcmllVFYnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vZXh0cmEuc2t5Lml0L2NvbmNvcnNpL1Rlbm5pczIwMjEvJykgewogICAgICAgICAgICAgICAgICAgIGFkZi50cmFjaygxMjQwNzYsICdFeHRyYSAtIEF0dGVycmFnZ2lvIE11c2V0dGknLCB7IHN2MTM6ICcnIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgX190Y2ZhcGkoJ2dldEN1c3RvbVZlbmRvckNvbnNlbnRzJywgMiwgZnVuY3Rpb24gKHZlbmRvckNvbnNlbnRzLCBzdWNjZXNzKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHZlbmRvckNvbnNlbnRzLmdyYW50c1snNWYxYWFkYTZiOGUwNWMzMDZjMDU5N2Q3J10udmVuZG9yR3JhbnQgPT0gZmFsc2UpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWRmU2NyaXB0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGZTY3JpcHQuc3JjID0gJy8vZG1wLmFkZm9ybS5uZXQvYXVkaWVuY2V0YWcvYWRmb3JtYXQuanMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRmU2NyaXB0Lm9ubG9hZCA9IHJldHJpZXZlX3NlZ21lbnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChhZGZTY3JpcHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByZXRyaWV2ZV9zZWdtZW50cygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5BZGZvcm1BVCA9IHdpbmRvdy5BZGZvcm1BVCB8fCBmdW5jdGlvbiAocSwgZm4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcS5wdXNoKFtdLnNsaWNlLmNhbGwoYXJndW1lbnRzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuLnEgPSBxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRva2VuID0gJ2V5SjBlWEFpT2lKS1YxUWlMQ0poYkdjaU9pSklVekkxTmlKOS5leUpCWkdadmNtMHVSRTFRTGtOc1lXbHRjem82UkdGMFlWQnliM1pwWkdWeWN5STZJbHN4TURFNU1GMGlMQ0pwYzNNaU9pSmtiWEF0WVhCcExtRmtabTl5YlM1amIyMGlMQ0poZFdRaU9pSmhkV1JwWlc1alpWOTBZV2RmWTI5dWMzVnRaWEpmZGpFaUxDSmxlSEFpT2pFNU1UazBNak14TVRBc0ltNWlaaUk2TVRZd05EQTJNekExTUgwLldheUFFcl85aFJxVVg4OVZpdkVKNDZocUpmazdvdVk0R3VpR3JBVGJNam8nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgQWRmb3JtQVQoJ2luaXQnLCB0b2tlbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBBZGZvcm1BVCgnY29va2llU2VnbWVudHMnLCBmdW5jdGlvbiAoc3RhdHVzLCByZXNwb25zZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChKU09OLnN0cmluZ2lmeShyZXNwb25zZSkuaW5kZXhPZignQkJfQ2xpZW50aV9JbnRlcmF6aW9uaV9DbGllbnRpJykgPiAtMSB8fCBKU09OLnN0cmluZ2lmeShyZXNwb25zZSkuaW5kZXhPZignQkJfQ2xpZW50aV9JbnRlcmF6aW9uaV9BQ1FfVHJhZGluZycpID4gLTEgfHwgSlNPTi5zdHJpbmdpZnkocmVzcG9uc2UpLmluZGV4T2YoJ0JCX0NsaWVudGlfSW50ZXJhemlvbmlfQUNRX0JyYW5kaW5nJykgPiAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGbG9vZGxpZ2h0X3BpeGVsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgOwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBGbG9vZGxpZ2h0X3BpeGVsKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYXhlbCA9IE1hdGgucmFuZG9tKCkgKyAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGF4ZWwgKiAxMDAwMDAwMDAwMDAwMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgSW1hZ2UoKS5zcmMgPSAnaHR0cHM6Ly9hZC5kb3VibGVjbGljay5uZXQvZGRtL2FjdGl2aXR5L3NyYz0xMDE1NTI3OTt0eXBlPWludm1lZGlhO2NhdD1za3l3aTA7ZGNfbGF0PTtkY19yZGlkPTt0YWdfZm9yX2NoaWxkX2RpcmVjdGVkX3RyZWF0bWVudD07dGZ1YT07bnBhPTtnZHByPTA7Z2Rwcl9jb25zZW50PTtvcmQ9JyArIGEgKyAnPyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgX190Y2ZhcGkoJ2dldEN1c3RvbVZlbmRvckNvbnNlbnRzJywgMiwgZnVuY3Rpb24gKHZlbmRvckNvbnNlbnRzLCBzdWNjZXNzKSB7CiAgICAgICAgICAgICAgICBpZiAodmVuZG9yQ29uc2VudHMuZ3JhbnRzWyc1ZTdlMTI5OGI4ZTA1YzU0YTg1YzUyZDInXS52ZW5kb3JHcmFudCA9PSBmYWxzZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZmJxKCd0cmFjaycsICdBQ1FfVmlld0NvbnRlbnQnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIF9fdGNmYXBpKCdnZXRDdXN0b21WZW5kb3JDb25zZW50cycsIDIsIGZ1bmN0aW9uICh2ZW5kb3JDb25zZW50cywgc3VjY2VzcykgewogICAgICAgICAgICAgICAgaWYgKHZlbmRvckNvbnNlbnRzLmdyYW50c1snNWYzNjlhMDJiOGUwNWMzMDg3MDFmODI5J10udmVuZG9yR3JhbnQgPT0gZmFsc2UpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuc2t5Lml0LycubWF0Y2goJ2xhbmRpbmctbmV3JykgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nLm1hdGNoKCdjYWxsbWVub3ctbmV3JykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIF9waXggPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnX3BpeF9pZF85MzI0ZTI2Yy04OTA1LWYyNjQtODdkMy00YjU1ZDgwNWNiOTAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFfcGl4KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcHJvdG9jb2wgPSAnLy8nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBNYXRoLnJhbmRvbSgpICogMTAwMDAwMDAwMDAwMDAwMDAwMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9waXggPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdpZnJhbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9waXguc3R5bGUuZGlzcGxheSA9ICdub25lJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9waXguc2V0QXR0cmlidXRlKCdzcmMnLCBwcm90b2NvbCArICdhYXgtZXUuYW1hem9uLWFkc3lzdGVtLmNvbS9zL2l1Mz9kPWdlbmVyaWMmZXgtZmFyZ3M9JTNGaWQlM0Q5MzI0ZTI2Yy04OTA1LWYyNjQtODdkMy00YjU1ZDgwNWNiOTAlMjZ0eXBlJTNEVU5LTk9XTiUyNm0lM0QzNTY5MSZleC1mY2g9NDE2NjEzJmV4LXNyYz1odHRwczovL3d3dy5za3kuaXQvJmV4LWhhcmdzPXYlM0QxLjAlM0JjJTNENTY1MDExMzM1MDYwMiUzQnAlM0Q5MzI0RTI2Qy04OTA1LUYyNjQtODdEMy00QjU1RDgwNUNCOTAnICsgJyZjYj0nICsgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfcGl4LnNldEF0dHJpYnV0ZSgnaWQnLCAnX3BpeF9pZF85MzI0ZTI2Yy04OTA1LWYyNjQtODdkMy00YjU1ZDgwNWNiOTAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoX3BpeCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBsaXN0ID0gWwogICAgICAgICAgICAgICAgJ2h0dHBzOi8vd3d3LnNreS5pdC9hY3F1aXN0YS9pbmRleC5odG1sJywKICAgICAgICAgICAgICAgICdodHRwczovL3d3dy5za3kuaXQvY29tZS12ZWRlcmUvaW5kZXguaHRtbCcsCiAgICAgICAgICAgICAgICAnaHR0cHM6Ly93d3cuc2t5Lml0L2NvbWUtdmVkZXJlL3NreXEtZmlicmEuaHRtbCcsCiAgICAgICAgICAgICAgICAnaHR0cHM6Ly93d3cuc2t5Lml0L2NvbnRlbnQvbmV3YW9sL3Byb21vemlvbmkvY3Jvc3NwYWdlX3Jlc3R5bGluZy5odG1sJywKICAgICAgICAgICAgICAgICdodHRwczovL3d3dy5za3kuaXQvb2ZmZXJ0ZSAgaHR0cHM6Ly93d3cuc2t5Lml0L29mZmVydGUvYWJib25hbWVudG8tY2FsY2lvJywKICAgICAgICAgICAgICAgICdodHRwczovL3d3dy5za3kuaXQvb2ZmZXJ0ZS9hYmJvbmFtZW50by1jYWxjaW8vc2F0ZWxsaXRlJywKICAgICAgICAgICAgICAgICdodHRwczovL3d3dy5za3kuaXQvb2ZmZXJ0ZS9hYmJvbmFtZW50by1jaW5lbWEnLAogICAgICAgICAgICAgICAgJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2FiYm9uYW1lbnRvLWNpbmVtYS9zYXRlbGxpdGUnLAogICAgICAgICAgICAgICAgJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2FiYm9uYW1lbnRvLWRpZ2l0YWxlLXRlcnJlc3RyZScsCiAgICAgICAgICAgICAgICAnaHR0cHM6Ly93d3cuc2t5Lml0L29mZmVydGUvYWJib25hbWVudG8taW50cmF0dGVuaW1lbnRvLXBsdXMnLAogICAgICAgICAgICAgICAgJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2FiYm9uYW1lbnRvLXNwb3J0JywKICAgICAgICAgICAgICAgICdodHRwczovL3d3dy5za3kuaXQvb2ZmZXJ0ZS9hYmJvbmFtZW50by1zcG9ydC9zYXRlbGxpdGUnLAogICAgICAgICAgICAgICAgJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2FiYm9uYW1lbnRvLXNwb3J0LWNpbmVtYScsCiAgICAgICAgICAgICAgICAnaHR0cHM6Ly93d3cuc2t5Lml0L3BhY2NoZXR0aS1vZmZlcnRlL2luZGV4Lmh0bWwnLAogICAgICAgICAgICAgICAgJ2h0dHBzOi8vd3d3LnNreS5pdC9wYWNjaGV0dGktb2ZmZXJ0ZS9pbnRyYXR0ZW5pbWVudG8tcGx1cy9udW92aS1jbGllbnRpLmh0bWwnLAogICAgICAgICAgICAgICAgJ2h0dHBzOi8vd3d3LnNreS5pdC9wYWNjaGV0dGktb2ZmZXJ0ZS9za3ktY2luZW1hLmh0bWwnLAogICAgICAgICAgICAgICAgJ2h0dHBzOi8vd3d3LnNreS5pdC9wYWNjaGV0dGktb2ZmZXJ0ZS9za3ktdHYuaHRtbCcsCiAgICAgICAgICAgICAgICAnaHR0cHM6Ly93d3cuc2t5Lml0L3BhY2NoZXR0aS1vZmZlcnRlL3NreS10di9zZXJpZS10di5odG1sJywKICAgICAgICAgICAgICAgICdodHRwczovL3d3dy5za3kuaXQvdHYnLAogICAgICAgICAgICAgICAgJ2h0dHBzOi8vd3d3LnNreS5pdC90di9za3ktY2FsY2lvJywKICAgICAgICAgICAgICAgICdodHRwczovL3d3dy5za3kuaXQvdHYvc2t5LWNpbmVtYScsCiAgICAgICAgICAgICAgICAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L3NreS1mYW1pZ2xpYScsCiAgICAgICAgICAgICAgICAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L3NreS1zcG9ydCcsCiAgICAgICAgICAgICAgICAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L3NreS10dicsCiAgICAgICAgICAgICAgICAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L3NreS10di9zZXJpZS10dicsCiAgICAgICAgICAgICAgICAnaHR0cHM6Ly93d3cuc2t5Lml0L29mZmVydGUvYWJib25hbWVudG8tdHYnLAogICAgICAgICAgICAgICAgJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2NvbmZpZ3VyYXRvcmUtYWJib25hbWVudG8tc2t5JywKICAgICAgICAgICAgICAgICdodHRwczovL3d3dy5za3kuaXQvdHYvc2t5LXR2L3NlcmllLXR2L3NwZXJhdm8tZGUtbW9yaS1wcmltYScKICAgICAgICAgICAgXTsKICAgICAgICAgICAgX190Y2ZhcGkoJ2dldEN1c3RvbVZlbmRvckNvbnNlbnRzJywgMiwgZnVuY3Rpb24gKHZlbmRvckNvbnNlbnRzLCBzdWNjZXNzKSB7CiAgICAgICAgICAgICAgICBpZiAodmVuZG9yQ29uc2VudHMuZ3JhbnRzWyc1ZjM2OWEwMmI4ZTA1YzMwODcwMWY4MjknXS52ZW5kb3JHcmFudCA9PSBmYWxzZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGxpc3QuaW5jbHVkZXMoJ2h0dHBzOi8vd3d3LnNreS5pdC8nKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgX3BpeCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdfcGl4X2lkXzNjYjM2MzJiLTU4NmMtNjcwMC0xMzlmLTg2MWNhYmRhZDIzOCcpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIV9waXgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwcm90b2NvbCA9ICcvLyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IE1hdGgucmFuZG9tKCkgKiAxMDAwMDAwMDAwMDAwMDAwMDAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgX3BpeCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2lmcmFtZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgX3BpeC5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgX3BpeC5zZXRBdHRyaWJ1dGUoJ3NyYycsIHByb3RvY29sICsgJ2FheC1ldS5hbWF6b24tYWRzeXN0ZW0uY29tL3MvaXUzP2Q9Z2VuZXJpYyZleC1mYXJncz0lM0ZpZCUzRDNjYjM2MzJiLTU4NmMtNjcwMC0xMzlmLTg2MWNhYmRhZDIzOCUyNnR5cGUlM0RVTktOT1dOJTI2bSUzRDM1NjkxJmV4LWZjaD00MTY2MTMmZXgtc3JjPWh0dHBzOi8vd3d3LnNreS5pdC8mZXgtaGFyZ3M9diUzRDEuMCUzQmMlM0Q1NjUwMTEzMzUwNjAyJTNCcCUzRDNDQjM2MzJCLTU4NkMtNjcwMC0xMzlGLTg2MUNBQkRBRDIzOCcgKyAnJmNiPScgKyBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9waXguc2V0QXR0cmlidXRlKCdpZCcsICdfcGl4X2lkXzNjYjM2MzJiLTU4NmMtNjcwMC0xMzlmLTg2MWNhYmRhZDIzOCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChfcGl4KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIF9fdGNmYXBpKCdnZXRDdXN0b21WZW5kb3JDb25zZW50cycsIDIsIGZ1bmN0aW9uICh2ZW5kb3JDb25zZW50cywgc3VjY2VzcykgewogICAgICAgICAgICAgICAgaWYgKHZlbmRvckNvbnNlbnRzLmdyYW50c1snNWU3ZTEyOThiOGUwNWM0ODUyNDZjZDA2J10udmVuZG9yR3JhbnQgPT0gZmFsc2UpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIChmdW5jdGlvbiAodywgZCwgdCwgciwgdSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiwgbiwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgd1t1XSA9IHdbdV0gfHwgW10sIGYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHsgdGk6ICczMDAwMDc4MicgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8ucSA9IHdbdV0sIHdbdV0gPSBuZXcgVUVUKG8pLCB3W3VdLnB1c2goJ3BhZ2VMb2FkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4gPSBkLmNyZWF0ZUVsZW1lbnQodCksIG4uc3JjID0gciwgbi5hc3luYyA9IDEsIG4ub25sb2FkID0gbi5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHRoaXMucmVhZHlTdGF0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgJiYgcyAhPT0gJ2xvYWRlZCcgJiYgcyAhPT0gJ2NvbXBsZXRlJyB8fCAoZigpLCBuLm9ubG9hZCA9IG4ub25yZWFkeXN0YXRlY2hhbmdlID0gbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkgPSBkLmdldEVsZW1lbnRzQnlUYWdOYW1lKHQpWzBdLCBpLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKG4sIGkpOwogICAgICAgICAgICAgICAgICAgIH0od2luZG93LCBkb2N1bWVudCwgJ3NjcmlwdCcsICcvL2JhdC5iaW5nLmNvbS9iYXQuanMnLCAndWV0cScpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBpZiAoJycgIT09ICcnKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHRwID0gbmV3IEltYWdlKCk7CiAgICAgICAgICAgICAgICAgICAgdHAuc3JjID0gJ2h0dHBzOi8vdHJhY2suYWRmb3JtLm5ldC9TZXJ2aW5nL1RyYWNrUG9pbnQvP3BtPTEyNDA3NiZBREZQYWdlTmFtZT1Ta3klMjAlRTIlODAlOTMlMjBDbGllbnRlJTIwUmljb25vc2NpdXRvJTIwQW5hbHl0aWNzJkFERmRpdmlkZXI9fCZpdG09e1wnaXRtc1wnOlt7c3YxMzpcJ1wnfV19JzsKICAgICAgICAgICAgICAgICAgICBfX3RjZmFwaSgnZ2V0Q3VzdG9tVmVuZG9yQ29uc2VudHMnLCAyLCBmdW5jdGlvbiAodmVuZG9yQ29uc2VudHMsIHN1Y2Nlc3MpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZlbmRvckNvbnNlbnRzLmdyYW50c1snNWYxYWFkYTZiOGUwNWMzMDZjMDU5N2Q3J10udmVuZG9yR3JhbnQgPT0gZmFsc2UpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnR5cGUgPSAndGV4dC9qYXZhc2NyaXB0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLmFzeW5jID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnNyYyA9ICdodHRwczovL3d3dy5nb29nbGV0YWdtYW5hZ2VyLmNvbS9ndGFnL2pzP2lkPUFXLTEwMjA1MDQ2NzQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB4ID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ3NjcmlwdCcpWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHgucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUocywgeCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5vbmxvYWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5kYXRhTGF5ZXIgPSB3aW5kb3cuZGF0YUxheWVyIHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBndGFnKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YUxheWVyLnB1c2goYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndGFnKCdqcycsIG5ldyBEYXRlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndGFnKCdjb25maWcnLCAnQVctMTAyMDUwNDY3NCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndGFnKCdldmVudCcsICdjb252ZXJzaW9uJywgeyAnc2VuZF90byc6ICdBVy0xMDIwNTA0Njc0L1VhQU5DTERLd3Q0QkVPTFV6dVlEJyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIF9fdGNmYXBpKCdnZXRDdXN0b21WZW5kb3JDb25zZW50cycsIDIsIGZ1bmN0aW9uICh2ZW5kb3JDb25zZW50cywgc3VjY2VzcykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodmVuZG9yQ29uc2VudHMuZ3JhbnRzWyc1ZTdlMTI5OGI4ZTA1YzU0YTg1YzUyZDInXS52ZW5kb3JHcmFudCA9PSBmYWxzZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChmLCBiLCBlLCB2LCBuLCB0LCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYuZmJxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGYuZmJxID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmNhbGxNZXRob2QgPyBuLmNhbGxNZXRob2QuYXBwbHkobiwgYXJndW1lbnRzKSA6IG4ucXVldWUucHVzaChhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLl9mYnEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuX2ZicSA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmxvYWRlZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4udmVyc2lvbiA9ICcyLjAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucXVldWUgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gYi5jcmVhdGVFbGVtZW50KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuYXN5bmMgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNyYyA9IHY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IGIuZ2V0RWxlbWVudHNCeVRhZ05hbWUoZSlbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5wYXJlbnROb2RlLmluc2VydEJlZm9yZSh0LCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0od2luZG93LCBkb2N1bWVudCwgJ3NjcmlwdCcsICdodHRwczovL2Nvbm5lY3QuZmFjZWJvb2submV0L2VuX1VTL2ZiZXZlbnRzLmpzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYnEoJ2luaXQnLCAnNzY5MTE0OTY2NDY4MTMwJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYnEoJ3RyYWNrJywgJ0NsaWVudGUgUmljb25vc2NpdXRvIEFuYWx5dGljcycpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgX190Y2ZhcGkoJ2dldEN1c3RvbVZlbmRvckNvbnNlbnRzJywgMiwgZnVuY3Rpb24gKHZlbmRvckNvbnNlbnRzLCBzdWNjZXNzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2ZW5kb3JDb25zZW50cy5ncmFudHNbJzVlN2UxMjk4YjhlMDVjNDg1MjQ2Y2QwNiddLnZlbmRvckdyYW50ID09IGZhbHNlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKHcsIGQsIHQsIHIsIHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiwgbiwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3W3VdID0gd1t1XSB8fCBbXSwgZiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB7IHRpOiAnMzAwMDQxMjMnIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8ucSA9IHdbdV0sIHdbdV0gPSBuZXcgVUVUKG8pLCB3W3VdLnB1c2goJ3BhZ2VMb2FkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA9IGQuY3JlYXRlRWxlbWVudCh0KSwgbi5zcmMgPSByLCBuLmFzeW5jID0gMSwgbi5vbmxvYWQgPSBuLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB0aGlzLnJlYWR5U3RhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgJiYgcyAhPT0gJ2xvYWRlZCcgJiYgcyAhPT0gJ2NvbXBsZXRlJyB8fCAoZigpLCBuLm9ubG9hZCA9IG4ub25yZWFkeXN0YXRlY2hhbmdlID0gbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSA9IGQuZ2V0RWxlbWVudHNCeVRhZ05hbWUodClbMF0sIGkucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUobiwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHdpbmRvdywgZG9jdW1lbnQsICdzY3JpcHQnLCAnLy9iYXQuYmluZy5jb20vYmF0LmpzJywgJ3VldHEnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgaWYgKCdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L2xhbmRpbmctbmV3L2FiYm9uYXJzaS9uZXdkaWdpdGFsZXRlcnJlc3RyZScgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvY2FsbG1lbm93LW5ldy9yZXMvbmV3ZGlnaXRhbGV0ZXJyZXN0cmUtbW9iaWxlJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9jYWxsbWVub3ctbmV3L3Jlcy9kaWdpdGFsZXRlcnJlc3RyZS1jYWxjaW8tbW9iaWxlJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9sYW5kaW5nLW5ldy9hYmJvbmFyc2kvZGlnaXRhbGV0ZXJyZXN0cmUtY2FsY2lvJykgewogICAgICAgICAgICAgICAgd2luZG93Ll9xZXZlbnRzID0gd2luZG93Ll9xZXZlbnRzIHx8IFtdOwogICAgICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZWxlbSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgICAgIGVsZW0uc3JjID0gKGRvY3VtZW50LmxvY2F0aW9uLnByb3RvY29sID09ICdodHRwczonID8gJ2h0dHBzOi8vc2VjdXJlJyA6ICdodHRwOi8vZWRnZScpICsgJy5xdWFudHNlcnZlLmNvbS9xdWFudC5qcyc7CiAgICAgICAgICAgICAgICAgICAgZWxlbS5hc3luYyA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgZWxlbS50eXBlID0gJ3RleHQvamF2YXNjcmlwdCc7CiAgICAgICAgICAgICAgICAgICAgdmFyIHNjcHQgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnc2NyaXB0JylbMF07CiAgICAgICAgICAgICAgICAgICAgc2NwdC5wYXJlbnROb2RlLmluc2VydEJlZm9yZShlbGVtLCBzY3B0KTsKICAgICAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgICAgICBfcWV2ZW50cy5wdXNoKHsKICAgICAgICAgICAgICAgICAgICBxYWNjdDogJ3AtQlpTWVNwU1NQbWo2cScsCiAgICAgICAgICAgICAgICAgICAgbGFiZWxzOiAnX2ZwLmV2ZW50LlVwcGVyIEZ1bm5lbCBEVFQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50OiAncmVmcmVzaCcKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuc2t5Lml0LycubWF0Y2goJ2xhbmRpbmctbmV3JykgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nLm1hdGNoKCdjYWxsbWVub3ctbmV3JykpIHsKICAgICAgICAgICAgICAgIHdpbmRvdy5fcWV2ZW50cyA9IHdpbmRvdy5fcWV2ZW50cyB8fCBbXTsKICAgICAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGVsZW0gPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKICAgICAgICAgICAgICAgICAgICBlbGVtLnNyYyA9IChkb2N1bWVudC5sb2NhdGlvbi5wcm90b2NvbCA9PSAnaHR0cHM6JyA/ICdodHRwczovL3NlY3VyZScgOiAnaHR0cDovL2VkZ2UnKSArICcucXVhbnRzZXJ2ZS5jb20vcXVhbnQuanMnOwogICAgICAgICAgICAgICAgICAgIGVsZW0uYXN5bmMgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgIGVsZW0udHlwZSA9ICd0ZXh0L2phdmFzY3JpcHQnOwogICAgICAgICAgICAgICAgICAgIHZhciBzY3B0ID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ3NjcmlwdCcpWzBdOwogICAgICAgICAgICAgICAgICAgIHNjcHQucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUoZWxlbSwgc2NwdCk7CiAgICAgICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAgICAgX3FldmVudHMucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgcWFjY3Q6ICdwLUJaU1lTcFNTUG1qNnEnLAogICAgICAgICAgICAgICAgICAgIGxhYmVsczogJ19mcC5ldmVudC5VcHBlciBGdW5uZWwgRmlicmEnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50OiAncmVmcmVzaCcKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIF9fdGNmYXBpKCdnZXRDdXN0b21WZW5kb3JDb25zZW50cycsIDIsIGZ1bmN0aW9uICh2ZW5kb3JDb25zZW50cywgc3VjY2VzcykgewogICAgICAgICAgICAgICAgaWYgKHZlbmRvckNvbnNlbnRzLmdyYW50c1snNWYxYWFkYTZiOGUwNWMzMDZjMDU5N2Q3J10udmVuZG9yR3JhbnQgPT0gZmFsc2UpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9jYWxsbWVub3ctbmV3L3Jlcy9za3luZXRmbGl4bW9iaWxlJykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYXhlbCA9IE1hdGgucmFuZG9tKCkgKyAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBheGVsICogMTAwMDAwMDAwMDAwMDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhZGZJZnJhbWUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdpZnJhbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgYWRmSWZyYW1lLnNyYyA9ICdodHRwczovLzEwMDE5MzM3LmZscy5kb3VibGVjbGljay5uZXQvYWN0aXZpdHlpO3NyYz0xMDAxOTMzNzt0eXBlPWludm1lZGlhO2NhdD1za3lfdDA7dTE9W0xQXTtkY19sYXQ9O2RjX3JkaWQ9O3RhZ19mb3JfY2hpbGRfZGlyZWN0ZWRfdHJlYXRtZW50PTt0ZnVhPTtucGE9O2dkcHI9MDtnZHByX2NvbnNlbnQ9O29yZD0nICsgYSArICc/JzsKICAgICAgICAgICAgICAgICAgICAgICAgYWRmSWZyYW1lLnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoYWRmSWZyYW1lKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBfX3RjZmFwaSgnZ2V0Q3VzdG9tVmVuZG9yQ29uc2VudHMnLCAyLCBmdW5jdGlvbiAodmVuZG9yQ29uc2VudHMsIHN1Y2Nlc3MpIHsKICAgICAgICAgICAgICAgIGlmICh2ZW5kb3JDb25zZW50cy5ncmFudHNbJzYwZGM0Y2VlY2M1MmViNDMzNmUwYmEwMiddLnZlbmRvckdyYW50ID09IGZhbHNlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKHcsIGQsIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGpzID0gZC5jcmVhdGVFbGVtZW50KHMpOwogICAgICAgICAgICAgICAgICAgICAgICBqcy5hc3luYyA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGpzLnNyYyA9ICcvL2Nkbi5mYW5wbGF5ci5jb20vY3VzdG9tZXJzL3NreS9hZGFwdG9yL2FkYXB0b3IuanMnOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmpzID0gZC5nZXRFbGVtZW50c0J5VGFnTmFtZShzKVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgZmpzLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKGpzLCBmanMpOwogICAgICAgICAgICAgICAgICAgIH0od2luZG93LCBkb2N1bWVudCwgJ3NjcmlwdCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIF9fdGNmYXBpKCdnZXRDdXN0b21WZW5kb3JDb25zZW50cycsIDIsIGZ1bmN0aW9uICh2ZW5kb3JDb25zZW50cywgc3VjY2VzcykgewogICAgICAgICAgICAgICAgaWYgKHZlbmRvckNvbnNlbnRzLmdyYW50c1snNjBjMzZmZDEyNmI0YWUwNWQ0MjAyMDNhJ10udmVuZG9yR3JhbnQgPT0gZmFsc2UpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9sYW5kaW5nLW5ldy9hYmJvbmFyc2kvcHJvdmFza3knKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhZGZJZnJhbWUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdpZnJhbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgYWRmSWZyYW1lLnNyYyA9ICdodHRwczovL3ZmLnIzZi50ZWNobm9sb2d5L3ZmL3N5bmMvdGFncy8zOTQnOwogICAgICAgICAgICAgICAgICAgICAgICBhZGZJZnJhbWUuc3R5bGUuZGlzcGxheSA9ICdub25lJzsKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChhZGZJZnJhbWUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICA7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBfX3RjZmFwaSgnZ2V0Q3VzdG9tVmVuZG9yQ29uc2VudHMnLCAyLCBmdW5jdGlvbiAodmVuZG9yQ29uc2VudHMsIHN1Y2Nlc3MpIHsKICAgICAgICAgICAgICAgIGlmICh2ZW5kb3JDb25zZW50cy5ncmFudHNbJzVmMWFhZGE2YjhlMDVjMzA2YzA1OTdkNyddLnZlbmRvckdyYW50ID09IGZhbHNlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYWRmU2NyaXB0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgYWRmU2NyaXB0LnNyYyA9ICdodHRwczovL3d3dy5nb29nbGV0YWdtYW5hZ2VyLmNvbS9ndGFnL2pzP2lkPUFXLTY3MzYwMzAxNSc7CiAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChhZGZTY3JpcHQpOwogICAgICAgICAgICAgICAgICAgIHdpbmRvdy5kYXRhTGF5ZXIgPSB3aW5kb3cuZGF0YUxheWVyIHx8IFtdOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGd0YWcoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFMYXllci5wdXNoKGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGd0YWcoJ2pzJywgbmV3IERhdGUoKSk7CiAgICAgICAgICAgICAgICAgICAgZ3RhZygnY29uZmlnJywgJ0FXLTY3MzYwMzAxNScpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgX190Y2ZhcGkoJ2dldEN1c3RvbVZlbmRvckNvbnNlbnRzJywgMiwgZnVuY3Rpb24gKHZlbmRvckNvbnNlbnRzLCBzdWNjZXNzKSB7CiAgICAgICAgICAgICAgICBpZiAodmVuZG9yQ29uc2VudHMuZ3JhbnRzWyc1ZjFhYWRhNmI4ZTA1YzMwNmMwNTk3ZDcnXS52ZW5kb3JHcmFudCA9PSBmYWxzZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGFkZlNjcmlwdCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgICAgIGFkZlNjcmlwdC5zcmMgPSAnaHR0cHM6Ly93d3cuZ29vZ2xldGFnbWFuYWdlci5jb20vZ3RhZy9qcz9pZD1BVy0xMDQ4MjY1MjI2JzsKICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5oZWFkLmFwcGVuZENoaWxkKGFkZlNjcmlwdCk7CiAgICAgICAgICAgICAgICAgICAgd2luZG93LmRhdGFMYXllciA9IHdpbmRvdy5kYXRhTGF5ZXIgfHwgW107CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZ3RhZygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZGF0YUxheWVyLnB1c2goYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZ3RhZygnanMnLCBuZXcgRGF0ZSgpKTsKICAgICAgICAgICAgICAgICAgICBndGFnKCdjb25maWcnLCAnQVctMTA0ODI2NTIyNicpOwogICAgICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlJykgewogICAgICAgICAgICAgICAgICAgICAgICBndGFnKCdldmVudCcsICdjb252ZXJzaW9uJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NlbmRfdG8nOiAnQVctMTA0ODI2NTIyNi9MR0JUQ096LW9QVUJFSXFFN2ZNRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAndmFsdWUnOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2N1cnJlbmN5JzogJ0VVUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYXdfcmVtYXJrZXRpbmdfb25seSc6IHRydWUKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIF9fdGNmYXBpKCdnZXRDdXN0b21WZW5kb3JDb25zZW50cycsIDIsIGZ1bmN0aW9uICh2ZW5kb3JDb25zZW50cywgc3VjY2VzcykgewogICAgICAgICAgICAgICAgaWYgKHZlbmRvckNvbnNlbnRzLmdyYW50c1snNWYxYWFkYTZiOGUwNWMzMDZjMDU5N2Q3J10udmVuZG9yR3JhbnQgPT0gZmFsc2UpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHZhciBhZGZTY3JpcHQgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKICAgICAgICAgICAgICAgICAgICBhZGZTY3JpcHQuc3JjID0gJ2h0dHBzOi8vd3d3Lmdvb2dsZXRhZ21hbmFnZXIuY29tL2d0YWcvanM/aWQ9REMtMzkxNzg4Nic7CiAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChhZGZTY3JpcHQpOwogICAgICAgICAgICAgICAgICAgIHdpbmRvdy5kYXRhTGF5ZXIgPSB3aW5kb3cuZGF0YUxheWVyIHx8IFtdOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGd0YWcoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFMYXllci5wdXNoKGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGd0YWcoJ2pzJywgbmV3IERhdGUoKSk7CiAgICAgICAgICAgICAgICAgICAgZ3RhZygnY29uZmlnJywgJ0RDLTM5MTc4ODYnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIF9fdGNmYXBpKCdnZXRDdXN0b21WZW5kb3JDb25zZW50cycsIDIsIGZ1bmN0aW9uICh2ZW5kb3JDb25zZW50cywgc3VjY2VzcykgewogICAgICAgICAgICAgICAgaWYgKHZlbmRvckNvbnNlbnRzLmdyYW50c1snNWU3ZTEyOThiOGUwNWM1NGE4NWM1MmQyJ10udmVuZG9yR3JhbnQgPT0gZmFsc2UpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoZiwgYiwgZSwgdiwgbiwgdCwgcykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZi5mYnEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBmLmZicSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uY2FsbE1ldGhvZCA/IG4uY2FsbE1ldGhvZC5hcHBseShuLCBhcmd1bWVudHMpIDogbi5xdWV1ZS5wdXNoKGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZi5fZmJxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5fZmJxID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgbi5sb2FkZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgbi52ZXJzaW9uID0gJzIuMCc7CiAgICAgICAgICAgICAgICAgICAgICAgIG4ucXVldWUgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IGIuY3JlYXRlRWxlbWVudChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdC5hc3luYyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICB0LnNyYyA9IHY7CiAgICAgICAgICAgICAgICAgICAgICAgIHMgPSBiLmdldEVsZW1lbnRzQnlUYWdOYW1lKGUpWzBdOwogICAgICAgICAgICAgICAgICAgICAgICBzLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKHQsIHMpOwogICAgICAgICAgICAgICAgICAgIH0od2luZG93LCBkb2N1bWVudCwgJ3NjcmlwdCcsICdodHRwczovL2Nvbm5lY3QuZmFjZWJvb2submV0L2VuX1VTL2ZiZXZlbnRzLmpzJyk7CiAgICAgICAgICAgICAgICAgICAgZmJxKCdpbml0JywgJzc2OTExNDk2NjQ2ODEzMCcpOwogICAgICAgICAgICAgICAgICAgIGZicSgndHJhY2snLCAnUGFnZVZpZXcnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIDsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIF9fdGNmYXBpKCdnZXRDdXN0b21WZW5kb3JDb25zZW50cycsIDIsIGZ1bmN0aW9uICh2ZW5kb3JDb25zZW50cywgc3VjY2VzcykgewogICAgICAgICAgICAgICAgaWYgKHZlbmRvckNvbnNlbnRzLmdyYW50c1snNWZjYTA1MjlhMjI4NjM4MTlmMTM0OTQ2J10udmVuZG9yR3JhbnQgPT0gZmFsc2UpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuYW1lVFAgPSB3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlRyYWNraW5nUG9pbnROYW1lOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdmFsdWVJRCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobmFtZVRQID09ICdTa3lfQ29ycG9yYXRlX1VuaXF1ZScgJiYgdmFsdWVJRCAhPT0gJycpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LkFERk9STV9wcmV2ZW50X2RvdWJsZV9hY3RpdmF0aW9uKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LkFERk9STV9wcmV2ZW50X2RvdWJsZV9hY3RpdmF0aW9uID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGF3TWFzdGVydGFnID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGF3TWFzdGVydGFnLnNldEF0dHJpYnV0ZSgnZGVmZXInLCAnZGVmZXInKTsKICAgICAgICAgICAgICAgICAgICAgICAgYXdNYXN0ZXJ0YWcuc3JjID0gJ2h0dHBzOi8vd3d3LmR3aW4xLmNvbS8yMDczMC5qcyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGF3TWFzdGVydGFnLnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdib2R5JylbMF0uYXBwZW5kQ2hpbGQoYXdNYXN0ZXJ0YWcpOwogICAgICAgICAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKCdob21lJyA9PSAnbGFuZGluZy1uZXcnIHx8ICdob21lJyA9PSAnY2FsbG1lbm93LW5ldycpIHsKICAgICAgICAgICAgICAgICAgICBhZGYudHJhY2soMTI0MDc2LCAnU2t5X0xhbmRpbmdfUGFnZScpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKCdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L3NreXEtbmV3MScpIHsKICAgICAgICAgICAgICAgICAgICBhZGYudHJhY2soMTI0MDc2LCAnVGVzdCBQZXJmb3JtYW5jZSAtIFZpc2l0IFByZSAyJywgeyBzdjEzOiAnJyB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC90di9za3lxLW5ldzInKSB7CiAgICAgICAgICAgICAgICAgICAgYWRmLnRyYWNrKDEyNDA3NiwgJ1Rlc3QgUGVyZm9ybWFuY2UgLSBWaXNpdCBQb3N0JywgeyBzdjEzOiAnJyB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgZnVuY3Rpb24gaW5pdCgpIHsKICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC90di9za3lxLW5ldzMnKSB7CiAgICAgICAgICAgICAgICAgICAgYWRmLnRyYWNrKDEyNDA3NiwgJ1Rlc3QgUGVyZm9ybWFuY2UgLSBWaXNpdCBQb3N0IERlZmVyJywgeyBzdjEzOiAnJyB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoZG9jdW1lbnQucmVhZHlTdGF0ZSAhPSAnbG9hZGluZycpIHsKICAgICAgICAgICAgICAgIGluaXQoKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ0RPTUNvbnRlbnRMb2FkZWQnLCBpbml0KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvJykgewogICAgICAgICAgICAgICAgd2luZG93Ll9xZXZlbnRzID0gd2luZG93Ll9xZXZlbnRzIHx8IFtdOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkX2EyNmM5NzdlYzdkZjc5ZTIgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9hMjZjOTc3ZWM3ZGY3OWUyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja19jYTkxODA0M2M3NDUxMTdlLmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcHJlZml4ID0gJycsIGhhc2ggPSAnelBjU29Xd0hIbmNKT0hHY1dkVm0nLCBydGJoVGFncyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ0YmhUYWdzLnB1c2goJ3ByXycgKyBoYXNoICsgJ19vZmZlcl9DLWh0dHBzOi8vd3d3LnNreS5pdC8nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIga2V5ID0gJ19fcnRiaG91c2UubGlkJywgbGlkID0gd2luZG93LmxvY2FsU3RvcmFnZS5nZXRJdGVtKGtleSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsaWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlkID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwb29sID0gJ0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCAyMDsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlkICs9IHBvb2wuY2hhckF0KE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIHBvb2wubGVuZ3RoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5sb2NhbFN0b3JhZ2Uuc2V0SXRlbShrZXksIGxpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ0YmhUYWdzLnB1c2goJ3ByXycgKyBoYXNoICsgJ19saWRfJyArIGxpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGlmciA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2lmcmFtZScpLCBzciA9IGVuY29kZVVSSUNvbXBvbmVudChkb2N1bWVudC5yZWZlcnJlciA/IGRvY3VtZW50LnJlZmVycmVyIDogJycpLCBzdSA9IGVuY29kZVVSSUNvbXBvbmVudChkb2N1bWVudC5sb2NhdGlvbi5ocmVmID8gZG9jdW1lbnQubG9jYXRpb24uaHJlZiA6ICcnKSwgaWZyc3JjID0gJ2h0dHBzOi8vJyArIHByZWZpeCArICdjcmVhdGl2ZWNkbi5jb20vdGFncz90eXBlPWlmcmFtZScsIHRtc3RtcCA9IGVuY29kZVVSSUNvbXBvbmVudCgnJyArIERhdGUubm93KCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcnRiaFRhZ3MubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyc3JjICs9ICcmaWQ9JyArIGVuY29kZVVSSUNvbXBvbmVudChydGJoVGFnc1tpXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmcnNyYyArPSAnJnN1PScgKyBzdSArICcmc3I9JyArIHNyICsgJyZ0cz0nICsgdG1zdG1wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmci5zZXRBdHRyaWJ1dGUoJ3NyYycsIGlmcnNyYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyLnNldEF0dHJpYnV0ZSgnd2lkdGgnLCAnMScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmci5zZXRBdHRyaWJ1dGUoJ2hlaWdodCcsICcxJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyLnNldEF0dHJpYnV0ZSgnc2Nyb2xsaW5nJywgJ25vJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyLnNldEF0dHJpYnV0ZSgnZnJhbWVCb3JkZXInLCAnMCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmci5zZXRBdHRyaWJ1dGUoJ3N0eWxlJywgJ2Rpc3BsYXk6bm9uZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmci5zZXRBdHRyaWJ1dGUoJ3JlZmVycmVycG9saWN5JywgJ25vLXJlZmVycmVyLXdoZW4tZG93bmdyYWRlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRvY3VtZW50LmJvZHkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChpZnIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdET01Db250ZW50TG9hZGVkJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChpZnIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9hMjZjOTc3ZWM3ZGY3OWUyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkX2EyNmM5NzdlYzdkZjc5ZTIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKCdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnbGFuZGluZy1uZXcnIHx8ICdjYWxsbWVub3ctbmV3JykgewogICAgICAgICAgICAgICAgd2luZG93Ll9xZXZlbnRzID0gd2luZG93Ll9xZXZlbnRzIHx8IFtdOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkXzhiNWI0MGRiNWY5NDViMDIgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF84YjViNDBkYjVmOTQ1YjAyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja19jYTkxODA0M2M3NDUxMTdlLmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcHJlZml4ID0gJycsIGhhc2ggPSAnelBjU29Xd0hIbmNKT0hHY1dkVm0nLCBydGJoVGFncyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ0YmhUYWdzLnB1c2goJ3ByXycgKyBoYXNoICsgJ19vZmZlcl9DLWh0dHBzOi8vd3d3LnNreS5pdC8nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIga2V5ID0gJ19fcnRiaG91c2UubGlkJywgbGlkID0gd2luZG93LmxvY2FsU3RvcmFnZS5nZXRJdGVtKGtleSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsaWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlkID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwb29sID0gJ0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCAyMDsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlkICs9IHBvb2wuY2hhckF0KE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIHBvb2wubGVuZ3RoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5sb2NhbFN0b3JhZ2Uuc2V0SXRlbShrZXksIGxpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ0YmhUYWdzLnB1c2goJ3ByXycgKyBoYXNoICsgJ19saWRfJyArIGxpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGlmciA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2lmcmFtZScpLCBzciA9IGVuY29kZVVSSUNvbXBvbmVudChkb2N1bWVudC5yZWZlcnJlciA/IGRvY3VtZW50LnJlZmVycmVyIDogJycpLCBzdSA9IGVuY29kZVVSSUNvbXBvbmVudChkb2N1bWVudC5sb2NhdGlvbi5ocmVmID8gZG9jdW1lbnQubG9jYXRpb24uaHJlZiA6ICcnKSwgaWZyc3JjID0gJ2h0dHBzOi8vJyArIHByZWZpeCArICdjcmVhdGl2ZWNkbi5jb20vdGFncz90eXBlPWlmcmFtZScsIHRtc3RtcCA9IGVuY29kZVVSSUNvbXBvbmVudCgnJyArIERhdGUubm93KCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgcnRiaFRhZ3MubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyc3JjICs9ICcmaWQ9JyArIGVuY29kZVVSSUNvbXBvbmVudChydGJoVGFnc1tpXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmcnNyYyArPSAnJnN1PScgKyBzdSArICcmc3I9JyArIHNyICsgJyZ0cz0nICsgdG1zdG1wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmci5zZXRBdHRyaWJ1dGUoJ3NyYycsIGlmcnNyYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyLnNldEF0dHJpYnV0ZSgnd2lkdGgnLCAnMScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmci5zZXRBdHRyaWJ1dGUoJ2hlaWdodCcsICcxJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyLnNldEF0dHJpYnV0ZSgnc2Nyb2xsaW5nJywgJ25vJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyLnNldEF0dHJpYnV0ZSgnZnJhbWVCb3JkZXInLCAnMCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmci5zZXRBdHRyaWJ1dGUoJ3N0eWxlJywgJ2Rpc3BsYXk6bm9uZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmci5zZXRBdHRyaWJ1dGUoJ3JlZmVycmVycG9saWN5JywgJ25vLXJlZmVycmVyLXdoZW4tZG93bmdyYWRlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRvY3VtZW50LmJvZHkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChpZnIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdET01Db250ZW50TG9hZGVkJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChpZnIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF84YjViNDBkYjVmOTQ1YjAyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkXzhiNWI0MGRiNWY5NDViMDIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgX190Y2ZhcGkoJ2dldEN1c3RvbVZlbmRvckNvbnNlbnRzJywgMiwgZnVuY3Rpb24gKHZlbmRvckNvbnNlbnRzLCBzdWNjZXNzKSB7CiAgICAgICAgICAgICAgICBpZiAodmVuZG9yQ29uc2VudHMuZ3JhbnRzWyc2MTllNTNhMzI5OGYzMzA2YTNlYTk4ZTcnXS52ZW5kb3JHcmFudCA9PSBmYWxzZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGFkZlNjcmlwdCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgICAgIGFkZlNjcmlwdC5zcmMgPSAnLy9ldmVudC5nZXRibHVlLmlvL2pzL2JsdWUtdGFnLm1pbi5qcyc7CiAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChhZGZTY3JpcHQpOwogICAgICAgICAgICAgICAgICAgIHdpbmRvdy5ibHVlX3EgPSB3aW5kb3cuYmx1ZV9xIHx8IFtdOwogICAgICAgICAgICAgICAgICAgIHdpbmRvdy5ibHVlX3EucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50OiAnc2V0Q2FtcGFpZ25JZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnMDAwMDAtMDAwMDAwLTAwMDAwMDAwJwogICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQ6ICdzZXRQYWdlVHlwZScsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAndmlzaXQnCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBpZiAoJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvYWNxdWlzdGEvaW5kZXguaHRtbCcgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvY29tZS12ZWRlcmUvaW5kZXguaHRtbCAnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L2NvbWUtdmVkZXJlL3NreXEtZmlicmEuaHRtbCcgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvY29udGVudC9uZXdhb2wvcHJvbW96aW9uaS9jcm9zc3BhZ2VfcmVzdHlsaW5nLmh0bWwnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L29mZmVydGUnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L29mZmVydGUvYWJib25hbWVudG8tY2FsY2lvJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2FiYm9uYW1lbnRvLWNhbGNpby9zYXRlbGxpdGUnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L29mZmVydGUvYWJib25hbWVudG8tY2luZW1hJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2FiYm9uYW1lbnRvLWNpbmVtYS9zYXRlbGxpdGUnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L29mZmVydGUvYWJib25hbWVudG8tZGlnaXRhbGUtdGVycmVzdHJlJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2FiYm9uYW1lbnRvLWludHJhdHRlbmltZW50by1wbHVzJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2FiYm9uYW1lbnRvLXNwb3J0JyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2FiYm9uYW1lbnRvLXNwb3J0L3NhdGVsbGl0ZScgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvb2ZmZXJ0ZS9hYmJvbmFtZW50by1zcG9ydC1jaW5lbWEnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L3BhY2NoZXR0aS1vZmZlcnRlL2luZGV4Lmh0bWwnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L3BhY2NoZXR0aS1vZmZlcnRlL2ludHJhdHRlbmltZW50by1wbHVzL251b3ZpLWNsaWVudGkuaHRtbCcgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvcGFjY2hldHRpLW9mZmVydGUvc2t5LWNpbmVtYS5odG1sJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9wYWNjaGV0dGktb2ZmZXJ0ZS9za3ktdHYuaHRtbCAnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L3BhY2NoZXR0aS1vZmZlcnRlL3NreS10di9zZXJpZS10di5odG1sICcgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvdHYnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L3NreS1jYWxjaW8nIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L3NreS1jaW5lbWEnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L3NreS1mYW1pZ2xpYScgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvdHYvc2t5LXNwb3J0JyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC9vZmZlcnRlL2NvbmZpZ3VyYXRvcmUtYWJib25hbWVudG8tc2t5JyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC90di9za3ktdHYnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L29mZmVydGUvYWJib25hbWVudG8tdHYnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L3NreS10di9zZXJpZS10dicgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvdHYvc2t5LXR2L3NlcmllLXR2L3NwZXJhdm8tZGUtbW9yaS1wcmltYScgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvb2ZmZXJ0ZS9wcm92YS1za3lxJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC90di9za3lxJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC90di9za3ktc3BvcnQvZXVyb3BlaS0yMDIwJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC90di9za3ktdHYvc2VyaWUtdHYvYW5uYScgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvb2ZmZXJ0ZS9hYmJvbmFtZW50by1pbnRyYXR0ZW5pbWVudG8tcGx1cy1jYWxjaW8nIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L2ludHJhdHRlbmltZW50by1wbHVzJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vYWJib25hbWVudG8uc2t5Lml0L25ld2FvbC9jcm9zc3BhZ2UnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L29mZmVydGUvYWJib25hbWVudG8taW50cmF0dGVuaW1lbnRvLXBsdXMtY2FsY2lvJyB8fCAnaHR0cHM6Ly93d3cuc2t5Lml0LycgPT0gJ2h0dHBzOi8vd3d3LnNreS5pdC90di9za3ktdHYvc2VyaWUtdHYvZ29tb3JyYScgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvdHYvc2t5LXR2LWludHJhdHRlbmltZW50bycgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvdHYvc2t5LWNpbmVtYS1mYW1pZ2xpYScgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvdHYvc2t5LXR2L21hc3RlcmNoZWYnIHx8ICdodHRwczovL3d3dy5za3kuaXQvJyA9PSAnaHR0cHM6Ly93d3cuc2t5Lml0L3R2L3NreS10di9zZXJpZS10di9hLWNhc2EtdHV0dGktYmVuZS1sYS1zZXJpZScgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvb2ZmZXJ0ZS9mYXR0aS11bi1yZWdhbG8tY29uLXNreScgfHwgJ2h0dHBzOi8vd3d3LnNreS5pdC8nID09ICdodHRwczovL3d3dy5za3kuaXQvdHYvc2t5LWNpbmVtYS1mYW1pZ2xpYScpIHsKICAgICAgICAgICAgICAgIHdpbmRvdy5fcWV2ZW50cyA9IHdpbmRvdy5fcWV2ZW50cyB8fCBbXTsKICAgICAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGVsZW0gPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKICAgICAgICAgICAgICAgICAgICBlbGVtLnNyYyA9IChkb2N1bWVudC5sb2NhdGlvbi5wcm90b2NvbCA9PSAnaHR0cHM6JyA/ICdodHRwczovL3NlY3VyZScgOiAnaHR0cDovL2VkZ2UnKSArICcucXVhbnRzZXJ2ZS5jb20vcXVhbnQuanMnOwogICAgICAgICAgICAgICAgICAgIGVsZW0uYXN5bmMgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgIGVsZW0udHlwZSA9ICd0ZXh0L2phdmFzY3JpcHQnOwogICAgICAgICAgICAgICAgICAgIHZhciBzY3B0ID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ3NjcmlwdCcpWzBdOwogICAgICAgICAgICAgICAgICAgIHNjcHQucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUoZWxlbSwgc2NwdCk7CiAgICAgICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAgICAgX3FldmVudHMucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgcWFjY3Q6ICdwLUJaU1lTcFNTUG1qNnEnLAogICAgICAgICAgICAgICAgICAgIGxhYmVsczogJ19mcC5ldmVudC5PcmdhbmljIHZpc2l0YXRvcmknLAogICAgICAgICAgICAgICAgICAgIGV2ZW50OiAncmVmcmVzaCcKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIpIHsKICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3YxKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5BZGZvcm0uVHJhY2tpbmcuVmFycy5PcmRlci5zdjEuc2VhcmNoKCcxJykgIT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGFkZmltYWdlID0gbmV3IEltYWdlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGFkZmltYWdlLnNyYyA9ICdodHRwczovL3RyYWNrLmFkZm9ybS5uZXQvU2VydmluZy9UcmFja1BvaW50Lz9wbT0xMjQwNzYmbGlkPTM5ODAwNDUnOwogICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnYm9keScpWzBdLmFwcGVuZENoaWxkKGFkZmltYWdlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAod2luZG93LkFkZm9ybS5UcmFja2luZy5WYXJzLk9yZGVyLnN2MikgewogICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3YyLnNlYXJjaCgnMScpICE9IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhZGZpbWFnZTEgPSBuZXcgSW1hZ2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYWRmaW1hZ2UxLnNyYyA9ICdodHRwczovL3RyYWNrLmFkZm9ybS5uZXQvU2VydmluZy9UcmFja1BvaW50Lz9wbT0xMjQwNzYmbGlkPTM5ODAwNDYnOwogICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnYm9keScpWzBdLmFwcGVuZENoaWxkKGFkZmltYWdlMSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5BZGZvcm0uVHJhY2tpbmcuVmFycy5PcmRlci5zdjMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LkFkZm9ybS5UcmFja2luZy5WYXJzLk9yZGVyLnN2My5zZWFyY2goJzEnKSAhPSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWRmaW1hZ2UyID0gbmV3IEltYWdlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGFkZmltYWdlMi5zcmMgPSAnaHR0cHM6Ly90cmFjay5hZGZvcm0ubmV0L1NlcnZpbmcvVHJhY2tQb2ludC8/cG09MTI0MDc2JmxpZD0zOTgwMDQ3JzsKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ2JvZHknKVswXS5hcHBlbmRDaGlsZChhZGZpbWFnZTIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3Y0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5BZGZvcm0uVHJhY2tpbmcuVmFycy5PcmRlci5zdjQuc2VhcmNoKCcxJykgIT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGFkZmltYWdlMyA9IG5ldyBJbWFnZSgpOwogICAgICAgICAgICAgICAgICAgICAgICBhZGZpbWFnZTMuc3JjID0gJ2h0dHBzOi8vdHJhY2suYWRmb3JtLm5ldC9TZXJ2aW5nL1RyYWNrUG9pbnQvP3BtPTEyNDA3NiZsaWQ9Mzk4MDA0OCc7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdib2R5JylbMF0uYXBwZW5kQ2hpbGQoYWRmaW1hZ2UzKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAod2luZG93LkFkZm9ybS5UcmFja2luZy5WYXJzLk9yZGVyLnN2NSkgewogICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3Y1LnNlYXJjaCgnMScpICE9IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhZGZpbWFnZTQgPSBuZXcgSW1hZ2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYWRmaW1hZ2U0LnNyYyA9ICdodHRwczovL3RyYWNrLmFkZm9ybS5uZXQvU2VydmluZy9UcmFja1BvaW50Lz9wbT0xMjQwNzYmbGlkPTM5ODAwNDknOwogICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnYm9keScpWzBdLmFwcGVuZENoaWxkKGFkZmltYWdlNCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5BZGZvcm0uVHJhY2tpbmcuVmFycy5PcmRlci5zdjYpIHsKICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LkFkZm9ybS5UcmFja2luZy5WYXJzLk9yZGVyLnN2Ni5zZWFyY2goJzEnKSAhPSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWRmaW1hZ2U1ID0gbmV3IEltYWdlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGFkZmltYWdlNS5zcmMgPSAnaHR0cHM6Ly90cmFjay5hZGZvcm0ubmV0L1NlcnZpbmcvVHJhY2tQb2ludC8/cG09MTI0MDc2JmxpZD0zOTgwMDUwJzsKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ2JvZHknKVswXS5hcHBlbmRDaGlsZChhZGZpbWFnZTUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3Y3KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5BZGZvcm0uVHJhY2tpbmcuVmFycy5PcmRlci5zdjcuc2VhcmNoKCcxJykgIT0gLTEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGFkZmltYWdlNiA9IG5ldyBJbWFnZSgpOwogICAgICAgICAgICAgICAgICAgICAgICBhZGZpbWFnZTYuc3JjID0gJ2h0dHBzOi8vdHJhY2suYWRmb3JtLm5ldC9TZXJ2aW5nL1RyYWNrUG9pbnQvP3BtPTEyNDA3NiZsaWQ9Mzk4MDA1MSc7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdib2R5JylbMF0uYXBwZW5kQ2hpbGQoYWRmaW1hZ2U2KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAod2luZG93LkFkZm9ybS5UcmFja2luZy5WYXJzLk9yZGVyLnN2OCkgewogICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3Y4LnNlYXJjaCgnMScpICE9IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhZGZpbWFnZTcgPSBuZXcgSW1hZ2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYWRmaW1hZ2U3LnNyYyA9ICdodHRwczovL3RyYWNrLmFkZm9ybS5uZXQvU2VydmluZy9UcmFja1BvaW50Lz9wbT0xMjQwNzYmbGlkPTM5ODAwNTInOwogICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnYm9keScpWzBdLmFwcGVuZENoaWxkKGFkZmltYWdlNyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5BZGZvcm0uVHJhY2tpbmcuVmFycy5PcmRlci5zdjkpIHsKICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LkFkZm9ybS5UcmFja2luZy5WYXJzLk9yZGVyLnN2OS5zZWFyY2goJzEnKSAhPSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWRmaW1hZ2U4ID0gbmV3IEltYWdlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGFkZmltYWdlOC5zcmMgPSAnaHR0cHM6Ly90cmFjay5hZGZvcm0ubmV0L1NlcnZpbmcvVHJhY2tQb2ludC8/cG09MTI0MDc2JmxpZD0zOTgwMDUzJzsKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ2JvZHknKVswXS5hcHBlbmRDaGlsZChhZGZpbWFnZTgpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3YxMCkgewogICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3YxMC5zZWFyY2goJzEnKSAhPSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWRmaW1hZ2U5ID0gbmV3IEltYWdlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGFkZmltYWdlOS5zcmMgPSAnaHR0cHM6Ly90cmFjay5hZGZvcm0ubmV0L1NlcnZpbmcvVHJhY2tQb2ludC8/cG09MTI0MDc2JmxpZD0zOTgwMDU0JzsKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ2JvZHknKVswXS5hcHBlbmRDaGlsZChhZGZpbWFnZTkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3YxMSkgewogICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3YxMS5zZWFyY2goJzEnKSAhPSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWRmaW1hZ2UxMCA9IG5ldyBJbWFnZSgpOwogICAgICAgICAgICAgICAgICAgICAgICBhZGZpbWFnZTEwLnNyYyA9ICdodHRwczovL3RyYWNrLmFkZm9ybS5uZXQvU2VydmluZy9UcmFja1BvaW50Lz9wbT0xMjQwNzYmbGlkPTM5ODAwNTUnOwogICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnYm9keScpWzBdLmFwcGVuZENoaWxkKGFkZmltYWdlMTApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3YxMikgewogICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3YxMi5zZWFyY2goJzEnKSAhPSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWRmaW1hZ2UxMSA9IG5ldyBJbWFnZSgpOwogICAgICAgICAgICAgICAgICAgICAgICBhZGZpbWFnZTExLnNyYyA9ICdodHRwczovL3RyYWNrLmFkZm9ybS5uZXQvU2VydmluZy9UcmFja1BvaW50Lz9wbT0xMjQwNzYmbGlkPTM5ODAwNTYnOwogICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnYm9keScpWzBdLmFwcGVuZENoaWxkKGFkZmltYWdlMTEpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3YxNCkgewogICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIuc3YxNC5zZWFyY2goJzEnKSAhPSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWRmaW1hZ2UxMiA9IG5ldyBJbWFnZSgpOwogICAgICAgICAgICAgICAgICAgICAgICBhZGZpbWFnZTEyLnNyYyA9ICdodHRwczovL3RyYWNrLmFkZm9ybS5uZXQvU2VydmluZy9UcmFja1BvaW50Lz9wbT0xMjQwNzYmbGlkPTQyOTUwMDcnOwogICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnYm9keScpWzBdLmFwcGVuZENoaWxkKGFkZmltYWdlMTIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBhZGYuQ29udGFpbmVyKDEyNDA3NiwgMTEwMDQ1MzMpOwogICAgICAgICAgICBfX3RjZmFwaSgnZ2V0Q3VzdG9tVmVuZG9yQ29uc2VudHMnLCAyLCBmdW5jdGlvbiAodmVuZG9yQ29uc2VudHMsIHN1Y2Nlc3MpIHsKICAgICAgICAgICAgICAgIGlmICh2ZW5kb3JDb25zZW50cy5ncmFudHNbJzVmMWFhZGE2YjhlMDVjMzA2YzA1OTdkNyddLnZlbmRvckdyYW50ID09IGZhbHNlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZ29vZ2xlX2NvbnZlcnNpb25faWQgPSAxMDEyMzA3NDcxOwogICAgICAgICAgICAgICAgICAgIHZhciBnb29nbGVfY29udmVyc2lvbl9sYWJlbCA9ICdVODdMQ05DM3Azd1FqNnphNGdNJzsKICAgICAgICAgICAgICAgICAgICB2YXIgZ29vZ2xlX2N1c3RvbV9wYXJhbXMgPSB3aW5kb3cuZ29vZ2xlX3RhZ19wYXJhbXM7CiAgICAgICAgICAgICAgICAgICAgdmFyIGdvb2dsZV9yZW1hcmtldGluZ19vbmx5ID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgYWRmU2NyaXB0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgYWRmU2NyaXB0LnNyYyA9ICcvL3d3dy5nb29nbGVhZHNlcnZpY2VzLmNvbS9wYWdlYWQvY29udmVyc2lvbi5qcyc7CiAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChhZGZTY3JpcHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgX190Y2ZhcGkoJ2dldEN1c3RvbVZlbmRvckNvbnNlbnRzJywgMiwgZnVuY3Rpb24gKHZlbmRvckNvbnNlbnRzLCBzdWNjZXNzKSB7CiAgICAgICAgICAgICAgICBpZiAodmVuZG9yQ29uc2VudHMuZ3JhbnRzWyc1ZjFhYWRhNmI4ZTA1YzMwNmMwNTk3ZDcnXS52ZW5kb3JHcmFudCA9PSBmYWxzZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGdvb2dsZV9jb252ZXJzaW9uX2lkID0gMTA0ODI2NTIyNjsKICAgICAgICAgICAgICAgICAgICB2YXIgZ29vZ2xlX2NvbnZlcnNpb25fbGFiZWwgPSAnMkc5bkNNSEh5MzRRaW9UdDh3TSc7CiAgICAgICAgICAgICAgICAgICAgdmFyIGdvb2dsZV9jdXN0b21fcGFyYW1zID0gd2luZG93Lmdvb2dsZV90YWdfcGFyYW1zOwogICAgICAgICAgICAgICAgICAgIHZhciBnb29nbGVfcmVtYXJrZXRpbmdfb25seSA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGFkZlNjcmlwdCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgICAgIGFkZlNjcmlwdC5zcmMgPSAnLy93d3cuZ29vZ2xlYWRzZXJ2aWNlcy5jb20vcGFnZWFkL2NvbnZlcnNpb24uanMnOwogICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmhlYWQuYXBwZW5kQ2hpbGQoYWRmU2NyaXB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBfcWV2ZW50cyA9IF9xZXZlbnRzIHx8IFtdOwogICAgICAgICAgICAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGVsZW0gPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKICAgICAgICAgICAgICAgIGVsZW0uc3JjID0gKGRvY3VtZW50LmxvY2F0aW9uLnByb3RvY29sID09ICdodHRwczonID8gJ2h0dHBzOi8vc2VjdXJlJyA6ICdodHRwOi8vZWRnZScpICsgJy5xdWFudHNlcnZlLmNvbS9xdWFudC5qcyc7CiAgICAgICAgICAgICAgICBlbGVtLmFzeW5jID0gdHJ1ZTsKICAgICAgICAgICAgICAgIGVsZW0udHlwZSA9ICd0ZXh0L2phdmFzY3JpcHQnOwogICAgICAgICAgICAgICAgdmFyIHNjcHQgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnc2NyaXB0JylbMF07CiAgICAgICAgICAgICAgICBzY3B0LnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKGVsZW0sIHNjcHQpOwogICAgICAgICAgICB9KCkpOwogICAgICAgICAgICBfcWV2ZW50cy5wdXNoKHsKICAgICAgICAgICAgICAgIHFhY2N0OiAncC1CWlNZU3BTU1BtajZxJywKICAgICAgICAgICAgICAgIGxhYmVsczogJ19mcC5ldmVudC5QdXJjaGFzZSBDYXJ0IENvbmZpcm1hdGlvbiAsX2ZwLnBjYXQuSU5TRVJUK1BST0RVQ1QrQ0FURUdPUlksX2ZwLmN1c3RvbWVyLklOU0VSVCtDVVNUT01FUitUWVBFJywKICAgICAgICAgICAgICAgIG9yZGVyaWQ6ICdJTlNFUlQrT1JERVIrSUQnLAogICAgICAgICAgICAgICAgZXZlbnQ6ICdyZWZyZXNoJwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBzZWdtZW50TmFtZXMgPSBbCiAgICAgICAgICAgICAgICAgICAgJ0FMTF8xJywKICAgICAgICAgICAgICAgICAgICAnQVRUUklCVVRPXzE3XzAnLAogICAgICAgICAgICAgICAgICAgICdBVFRSSUJVVE9fMTdfMScsCiAgICAgICAgICAgICAgICAgICAgJ0FUVFJJQlVUT18xOF8wJywKICAgICAgICAgICAgICAgICAgICAnQkJfQ0xJRU5USV9DT1ZFUkFHRV9NQU5VQUxFX0RTUCcsCiAgICAgICAgICAgICAgICAgICAgJ0FUVFJJQlVUT18xOF8xJywKICAgICAgICAgICAgICAgICAgICAnQVRUUklCVVRPXzE5XzAnLAogICAgICAgICAgICAgICAgICAgICdBVFRSSUJVVE9fMTlfMScsCiAgICAgICAgICAgICAgICAgICAgJ0FUVFJJQlVUT18yMV8wJywKICAgICAgICAgICAgICAgICAgICAnQVRUUklCVVRPXzIxXzEnLAogICAgICAgICAgICAgICAgICAgICdIRF9SRUFEWV9EU1AnLAogICAgICAgICAgICAgICAgICAgICdBbnppYW5pdGFfb2x0cmUgMScsCiAgICAgICAgICAgICAgICAgICAgJ0Fuemlhbml0YV9lbnRybyAxJywKICAgICAgICAgICAgICAgICAgICAnQW56aWFuaXRhX29sdHJlIDMnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0FMTF9NSU4xJywKICAgICAgICAgICAgICAgICAgICAnQkJfQ0xJRU5USV9DT1ZFUkFHRV9BTExfTUFHMScsCiAgICAgICAgICAgICAgICAgICAgJ0JCX0NMSUVOVElfQ09WRVJBR0VfQUxMX01BRzMnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0FMTF9NQUc2JywKICAgICAgICAgICAgICAgICAgICAnQkJfQ0xJRU5USV9DT1ZFUkFHRV9BTExfTUFHMTAnLAogICAgICAgICAgICAgICAgICAgICdBbnppYW5pdGFfb2x0cmUgNicsCiAgICAgICAgICAgICAgICAgICAgJ0Fuemlhbml0YV9vbHRyZSAxMCcsCiAgICAgICAgICAgICAgICAgICAgJ0JCX0NMSUVOVElfUlRHX0xQXzE0R0cnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0xVR0xJT19QVF8xXzMnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0xVR0xJT19QVF8yXzMnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX09GX1ZVTEFfQUJfVEVTVF9URUNIX0FMTCcsCiAgICAgICAgICAgICAgICAgICAgJ0JCX0NMSUVOVElfQ09WRVJBR0VfT0ZfVlVMQV9BTEwnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0xVR0xJT19QVF8zXzMnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0xVR0xJT19QVF80XzMnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX1ZVTEFfQUxMJywKICAgICAgICAgICAgICAgICAgICAnSERfTk9fRFNQJywKICAgICAgICAgICAgICAgICAgICAnRVhUUkFfU0lfRElTREVUVEFfTUVESU9BTFRBJywKICAgICAgICAgICAgICAgICAgICAnRVhUUkFfU0lfQ0xJRU5USV9NQUcxX0RJU0RFVFRBX01FRElPQUxUQScsCiAgICAgICAgICAgICAgICAgICAgJ0VYVFJBX05PX0NMSUVOVElfTUFHMV9ESVNERVRUQV9NRURJT0FMVEEnLAogICAgICAgICAgICAgICAgICAgICdFWFRSQV9OT19DTElFTlRJX01BRzEnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0FMTCcsCiAgICAgICAgICAgICAgICAgICAgJ1NLWVFfTl9EU1AnLAogICAgICAgICAgICAgICAgICAgICdTUF9ZX0RTUCcsCiAgICAgICAgICAgICAgICAgICAgJ0NBX1lfRFNQJywKICAgICAgICAgICAgICAgICAgICAnRENTU19SRUFEWV9EU1AnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0xVR0xJT19QVF8xXzNfU0tZUV9OJywKICAgICAgICAgICAgICAgICAgICAnQkJfQ0xJRU5USV9DT1ZFUkFHRV9MVUdMSU9fUFRfMl8zX1NLWVFfTicsCiAgICAgICAgICAgICAgICAgICAgJ0JCX0NMSUVOVElfQ09WRVJBR0VfTFVHTElPX1BUXzNfM19TS1lRX04nLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0xVR0xJT19QVF80XzNfU0tZUV9OJywKICAgICAgICAgICAgICAgICAgICAnQkJfQ0xJRU5USV9DT1ZFUkFHRV9BTExfU0tZUV9OJywKICAgICAgICAgICAgICAgICAgICAnQkJfQ0xJRU5USV9DT1ZFUkFHRV9NQU5VQUxFX0RTUF9TS1lRX04nLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0xVR0xJT19QVF81XzMnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0xVR0xJT19QVF81XzNfTUFHMTAnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0xVR0xJT19QVF81XzNfTUlOMTAnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX1ZVTEFfTUFHXzUwX0FMTCcsCiAgICAgICAgICAgICAgICAgICAgJ0RJR0lUQUxfQkJfUFJFVl9TUE9SVF8yMDIxXzAzXzI1JywKICAgICAgICAgICAgICAgICAgICAnUlRHX0xQX0V4dHJhX1ByaW1pc3NpbWVfMjFHRycsCiAgICAgICAgICAgICAgICAgICAgJ0RJR0lUQUxfQkJfUFJFVl9TUE9SVF8yMDIxLTAzLTI1JywKICAgICAgICAgICAgICAgICAgICAnQ0lfTl9EU1AnLAogICAgICAgICAgICAgICAgICAgICdCQl9DTElFTlRJX0NPVkVSQUdFX0xVR0xJTycKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICB2YXIgc2VnbWVudFJlZ2V4ID0gbmV3IFJlZ0V4cChzZWdtZW50TmFtZXMuam9pbignfCcpLCAnZycpOwogICAgICAgICAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYWRmU2NyaXB0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgYWRmU2NyaXB0LnNyYyA9ICcvL2RtcC5hZGZvcm0ubmV0L2F1ZGllbmNldGFnL2FkZm9ybWF0LmpzJzsKICAgICAgICAgICAgICAgICAgICBhZGZTY3JpcHQub25sb2FkID0gcmV0cmlldmVfc2VnbWVudHM7CiAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChhZGZTY3JpcHQpOwogICAgICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJldHJpZXZlX3NlZ21lbnRzKCkgewogICAgICAgICAgICAgICAgICAgIHdpbmRvdy5BZGZvcm1BVCA9IHdpbmRvdy5BZGZvcm1BVCB8fCBmdW5jdGlvbiAocSwgZm4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBxLnB1c2goW10uc2xpY2UuY2FsbChhcmd1bWVudHMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmbjsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgZm4ucSA9IHE7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmbjsKICAgICAgICAgICAgICAgICAgICB9KFtdKTsKICAgICAgICAgICAgICAgICAgICB2YXIgdG9rZW4gPSAnZXlKMGVYQWlPaUpLVjFRaUxDSmhiR2NpT2lKSVV6STFOaUo5LmV5SkJaR1p2Y20wdVJFMVFMa05zWVdsdGN6bzZSR0YwWVZCeWIzWnBaR1Z5Y3lJNklsc3hNREU1TUYwaUxDSnBjM01pT2lKa2JYQXRZWEJwTG1Ga1ptOXliUzVqYjIwaUxDSmhkV1FpT2lKaGRXUnBaVzVqWlY5MFlXZGZZMjl1YzNWdFpYSmZkakVpTENKbGVIQWlPakU0T1RnMk9URTVORE1zSW01aVppSTZNVFU0TXpNek1UZzRNMzAuTWl3V19lUE9sdjV2TFlCdlhLd1Nlb2xUMWdzYUg1cnk0b1lVVHdQMUJ3Yyc7CiAgICAgICAgICAgICAgICAgICAgQWRmb3JtQVQoJ2luaXQnLCB0b2tlbik7CiAgICAgICAgICAgICAgICAgICAgQWRmb3JtQVQoJ2Nvb2tpZVNlZ21lbnRzJywgZnVuY3Rpb24gKHN0YXR1cywgcmVzcG9uc2UpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHNlZ21lbnRSZXNwb25zZSA9IEpTT04uc3RyaW5naWZ5KHJlc3BvbnNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNlZ21lbnRSZXNwb25zZS5tYXRjaCgnQUxMXzEnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZG1wQWxsR29vZ2xlQWRzUGl4ZWwoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2VnbWVudFJlc3BvbnNlLm1hdGNoKHNlZ21lbnRSZWdleCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZiQmFzZVBpeGVsKCc3NjkxMTQ5NjY0NjgxMzAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc2VnbWVudE5hbWVzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNlZ21lbnRSZXNwb25zZS5pbmRleE9mKHNlZ21lbnROYW1lc1tpXSkgPiAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYnEoJ3RyYWNrJywgJ1NreV9DbGllbnRpX0RNUF8nICsgc2VnbWVudE5hbWVzW2ldKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZmJCYXNlUGl4ZWwoZmJpZCkgewogICAgICAgICAgICAgICAgICAgIF9fdGNmYXBpKCdnZXRDdXN0b21WZW5kb3JDb25zZW50cycsIDIsIGZ1bmN0aW9uICh2ZW5kb3JDb25zZW50cywgc3VjY2VzcykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodmVuZG9yQ29uc2VudHMuZ3JhbnRzWyc1ZTdlMTI5OGI4ZTA1YzU0YTg1YzUyZDInXS52ZW5kb3JHcmFudCA9PSBmYWxzZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChmLCBiLCBlLCB2LCBuLCB0LCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYuZmJxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGYuZmJxID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmNhbGxNZXRob2QgPyBuLmNhbGxNZXRob2QuYXBwbHkobiwgYXJndW1lbnRzKSA6IG4ucXVldWUucHVzaChhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLl9mYnEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuX2ZicSA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmxvYWRlZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4udmVyc2lvbiA9ICcyLjAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucXVldWUgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gYi5jcmVhdGVFbGVtZW50KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuYXN5bmMgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNyYyA9IHY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IGIuZ2V0RWxlbWVudHNCeVRhZ05hbWUoZSlbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5wYXJlbnROb2RlLmluc2VydEJlZm9yZSh0LCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0od2luZG93LCBkb2N1bWVudCwgJ3NjcmlwdCcsICdodHRwczovL2Nvbm5lY3QuZmFjZWJvb2submV0L2VuX1VTL2ZiZXZlbnRzLmpzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYnEoJ2luaXQnLCBmYmlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZicSgndHJhY2snLCAnUGFnZVZpZXcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZG1wQWxsR29vZ2xlQWRzUGl4ZWwoKSB7CiAgICAgICAgICAgICAgICAgICAgX190Y2ZhcGkoJ2dldEN1c3RvbVZlbmRvckNvbnNlbnRzJywgMiwgZnVuY3Rpb24gKHZlbmRvckNvbnNlbnRzLCBzdWNjZXNzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2ZW5kb3JDb25zZW50cy5ncmFudHNbJzVmMWFhZGE2YjhlMDVjMzA2YzA1OTdkNyddLnZlbmRvckdyYW50ID09IGZhbHNlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWRmU2NyaXB0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGZTY3JpcHQuc3JjID0gJ2h0dHBzOi8vd3d3Lmdvb2dsZXRhZ21hbmFnZXIuY29tL2d0YWcvanM/aWQ9QVctMTAyMDUwNDY3NCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5oZWFkLmFwcGVuZENoaWxkKGFkZlNjcmlwdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuZGF0YUxheWVyID0gd2luZG93LmRhdGFMYXllciB8fCBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGd0YWcoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YUxheWVyLnB1c2goYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd0YWcoJ2pzJywgbmV3IERhdGUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBndGFnKCdjb25maWcnLCAnQVctMTAyMDUwNDY3NCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3RhZygnZXZlbnQnLCAnY29udmVyc2lvbicsIHsgJ3NlbmRfdG8nOiAnQVctMTAyMDUwNDY3NC96RndTQ0xqdnNOVUJFT0xVenVZRCcgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSgpKTsKICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgfQogICAgfSgpKQp9"},{"name":"sugarcoat-7ef6938db3b17aa422131955b7760870bc69ac0c","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfMWNmMWU5MDczODU0NmQ0MCA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBsZXQgaXNTZWFsZWQgPSBmYWxzZTsKICAgICAgICBjbGFzcyBTdG9yYWdlIHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBpZiAoaXNTZWFsZWQpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IGxlbmd0aCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyh0aGlzKS5sZW5ndGg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAga2V5KGluZGV4KSB7CiAgICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXModGhpcyk7CiAgICAgICAgICAgICAgICBpZiAoaW5kZXggPCAwIHx8IGluZGV4ID49IGtleXMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4ga2V5c1tpbmRleF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0SXRlbShrZXkpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwodGhpcywga2V5KSA/IHRoaXNba2V5XSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0SXRlbShrZXksIHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW2tleV0gPSBTdHJpbmcodmFsdWUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJlbW92ZUl0ZW0oa2V5KSB7CiAgICAgICAgICAgICAgICBkZWxldGUgdGhpc1trZXldOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGNsZWFyKCkgewogICAgICAgICAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKHRoaXMpOwogICAgICAgICAgICAgICAgZm9yIChjb25zdCBrZXkgb2Yga2V5cykgewogICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2tleV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5TdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBTdG9yYWdlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY29uc3QgbG9jYWxTdG9yYWdlID0gbmV3IFN0b3JhZ2UoKTsKICAgICAgICBleHBvcnRzLmxvY2FsU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbG9jYWxTdG9yYWdlOwogICAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBjb25zdCBzZXNzaW9uU3RvcmFnZSA9IG5ldyBTdG9yYWdlKCk7CiAgICAgICAgZXhwb3J0cy5zZXNzaW9uU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gc2Vzc2lvblN0b3JhZ2U7CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGlzU2VhbGVkID0gdHJ1ZTsKICAgIH0pKCRfX19tb2NrXzFjZjFlOTA3Mzg1NDZkNDApOwogICAgY29uc3QgJF9fX21vY2tfYjQ2YjNiYjQ2NDQyZmM5MCA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja19iNDZiM2JiNDY0NDJmYzkwKTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHZhciB0ID0gd2luZG93LnBianNDaHVuazsKICAgICAgICAgICAgd2luZG93LnBianNDaHVuayA9IGZ1bmN0aW9uIChuLCBvLCBhKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjLCB1LCBzLCBkID0gMCwgZiA9IFtdOyBkIDwgbi5sZW5ndGg7IGQrKykKICAgICAgICAgICAgICAgICAgICB1ID0gbltkXSwgclt1XSAmJiBmLnB1c2goclt1XVswXSksIHJbdV0gPSAwOwogICAgICAgICAgICAgICAgZm9yIChjIGluIG8pCiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG8sIGMpICYmIChlW2NdID0gb1tjXSk7CiAgICAgICAgICAgICAgICBmb3IgKHQgJiYgdChuLCBvLCBhKTsgZi5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgIGYuc2hpZnQoKSgpOwogICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgZm9yIChkID0gMDsgZCA8IGEubGVuZ3RoOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHMgPSBpKGkucyA9IGFbZF0pOwogICAgICAgICAgICAgICAgcmV0dXJuIHM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBuID0ge30sIHIgPSB7IDM5MjogMCB9OwogICAgICAgICAgICBmdW5jdGlvbiBpKHQpIHsKICAgICAgICAgICAgICAgIGlmIChuW3RdKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBuW3RdLmV4cG9ydHM7CiAgICAgICAgICAgICAgICB2YXIgciA9IG5bdF0gPSB7CiAgICAgICAgICAgICAgICAgICAgaTogdCwKICAgICAgICAgICAgICAgICAgICBsOiAhMSwKICAgICAgICAgICAgICAgICAgICBleHBvcnRzOiB7fQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHJldHVybiBlW3RdLmNhbGwoci5leHBvcnRzLCByLCByLmV4cG9ydHMsIGkpLCByLmwgPSAhMCwgci5leHBvcnRzOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGkubSA9IGUsIGkuYyA9IG4sIGkuZCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBpLm8oZSwgdCkgfHwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHQsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICExLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGdldDogbgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sIGkubiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICB2YXIgdCA9IGUgJiYgZS5fX2VzTW9kdWxlID8gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmRlZmF1bHQ7CiAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHJldHVybiBpLmQodCwgJ2EnLCB0KSwgdDsKICAgICAgICAgICAgfSwgaS5vID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSwgdCk7CiAgICAgICAgICAgIH0sIGkucCA9ICcnLCBpLm9lID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHRocm93IGNvbnNvbGUuZXJyb3IoZSksIGU7CiAgICAgICAgICAgIH0sIGkoaS5zID0gOTc0KTsKICAgICAgICB9KHsKICAgICAgICAgICAgMDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCBuLmQodCwgJ2ludGVybmFsJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBDOwogICAgICAgICAgICAgICAgfSksIHQuZ2V0UHJlYmlkSW50ZXJuYWwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFI7CiAgICAgICAgICAgICAgICB9LCBuLmQodCwgJ2JpbmQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEI7CiAgICAgICAgICAgICAgICB9KSwgdC5nZXRVbmlxdWVJZGVudGlmaWVyU3RyID0gRCwgdC5nZW5lcmF0ZVVVSUQgPSBmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA/ICh0IF4gKHdpbmRvdyAmJiB3aW5kb3cuY3J5cHRvICYmIHdpbmRvdy5jcnlwdG8uZ2V0UmFuZG9tVmFsdWVzID8gY3J5cHRvLmdldFJhbmRvbVZhbHVlcyhuZXcgVWludDhBcnJheSgxKSlbMF0gJSAxNiA6IDE2ICogTWF0aC5yYW5kb20oKSkgPj4gdCAvIDQpLnRvU3RyaW5nKDE2KSA6IChbMTAwMDAwMDBdICsgLTEwMDAgKyAtNDAwMCArIC04MDAwICsgLTEwMDAwMDAwMDAwMCkucmVwbGFjZSgvWzAxOF0vZywgZSk7CiAgICAgICAgICAgICAgICB9LCB0LmdldEJpZElkUGFyYW1ldGVyID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiB0W2VdKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtlXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9LCB0LnRyeUFwcGVuZFF1ZXJ5U3RyaW5nID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAobikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgKyB0ICsgJz0nICsgZW5jb2RlVVJJQ29tcG9uZW50KG4pICsgJyYnOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfSwgdC5wYXJzZVF1ZXJ5U3RyaW5nUGFyYW1ldGVycyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAnJzsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIGUuaGFzT3duUHJvcGVydHkobikgJiYgKHQgKz0gbiArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudChlW25dKSArICcmJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSB0LnJlcGxhY2UoLyYkLywgJycpOwogICAgICAgICAgICAgICAgfSwgdC50cmFuc2Zvcm1BZFNlcnZlclRhcmdldGluZ09iaiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXMoZSkubGVuZ3RoID4gMCA/IHNlKGUpLm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJycuY29uY2F0KHQsICc9JykuY29uY2F0KGVuY29kZVVSSUNvbXBvbmVudChkZShlLCB0KSkpOwogICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJyYnKSA6ICcnOwogICAgICAgICAgICAgICAgfSwgdC5nZXRBZFVuaXRTaXplcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICBpZiAoZS5tZWRpYVR5cGVzICYmIGUubWVkaWFUeXBlcy5iYW5uZXIgJiYgQXJyYXkuaXNBcnJheShlLm1lZGlhVHlwZXMuYmFubmVyLnNpemVzKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUubWVkaWFUeXBlcy5iYW5uZXIuc2l6ZXM7CiAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkoblswXSkgPyB0ID0gbiA6IHQucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShlLnNpemVzKSAmJiAoQXJyYXkuaXNBcnJheShlLnNpemVzWzBdKSA/IHQgPSBlLnNpemVzIDogdC5wdXNoKGUuc2l6ZXMpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgIH0sIHQucGFyc2VTaXplc0lucHV0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuc3BsaXQoJywnKSwgciA9IC9eKFxkKSt4KFxkKSskL2k7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVlKG4sIGkpICYmIG5baV0ubWF0Y2gocikgJiYgdC5wdXNoKG5baV0pOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoJ29iamVjdCcgPT09IG0oZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8gPiAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDIgPT09IG8gJiYgJ251bWJlcicgPT0gdHlwZW9mIGVbMF0gJiYgJ251bWJlcicgPT0gdHlwZW9mIGVbMV0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKGsoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSAwOyBhIDwgbzsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goayhlW2FdKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgfSwgdC5wYXJzZUdQVFNpbmdsZVNpemVBcnJheSA9IGssIHQucGFyc2VHUFRTaW5nbGVTaXplQXJyYXlUb1J0YlNpemUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChOKGUpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdzogZVswXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGg6IGVbMV0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIHQuZ2V0V2luZG93VG9wID0gUCwgdC5nZXRXaW5kb3dTZWxmID0gcSwgdC5nZXRXaW5kb3dMb2NhdGlvbiA9IE0sIHQubG9nTWVzc2FnZSA9IEcsIHQubG9nSW5mbyA9IEwsIHQubG9nV2FybiA9IFcsIHQubG9nRXJyb3IgPSBGLCB0Lmhhc0NvbnNvbGVMb2dnZXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEU7CiAgICAgICAgICAgICAgICB9LCB0LmRlYnVnVHVybmVkT24gPSBWLCB0LmNyZWF0ZUludmlzaWJsZUlmcmFtZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2lmcmFtZScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmlkID0gRCgpLCBlLmhlaWdodCA9IDAsIGUud2lkdGggPSAwLCBlLmJvcmRlciA9ICcwcHgnLCBlLmhzcGFjZSA9ICcwJywgZS52c3BhY2UgPSAnMCcsIGUubWFyZ2luV2lkdGggPSAnMCcsIGUubWFyZ2luSGVpZ2h0ID0gJzAnLCBlLnN0eWxlLmJvcmRlciA9ICcwJywgZS5zY3JvbGxpbmcgPSAnbm8nLCBlLmZyYW1lQm9yZGVyID0gJzAnLCBlLnNyYyA9ICdhYm91dDpibGFuaycsIGUuc3R5bGUuZGlzcGxheSA9ICdub25lJywgZTsKICAgICAgICAgICAgICAgIH0sIHQuZ2V0UGFyYW1ldGVyQnlOYW1lID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gamUoTSgpLnNlYXJjaClbZV0gfHwgJyc7CiAgICAgICAgICAgICAgICB9LCB0LmlzQSA9IEgsIHQuaXNGbiA9IEssIHQuaXNTdHIgPSBKLCB0LmlzQXJyYXkgPSBZLCB0LmlzTnVtYmVyID0gUSwgdC5pc1BsYWluT2JqZWN0ID0gJCwgdC5pc0Jvb2xlYW4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBIKGUsICdCb29sZWFuJyk7CiAgICAgICAgICAgICAgICB9LCB0LmlzRW1wdHkgPSBYLCB0LmlzRW1wdHlTdHIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBKKGUpICYmICghZSB8fCAwID09PSBlLmxlbmd0aCk7CiAgICAgICAgICAgICAgICB9LCB0Ll9lYWNoID0gWiwgdC5jb250YWlucyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKFgoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBpZiAoSyhlLmluZGV4T2YpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgIT09IGUuaW5kZXhPZih0KTsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIGZvciAoOyBuLS07KQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVtuXSA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICB9LCB0Ll9tYXAgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChYKGUpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgaWYgKEsoZS5tYXApKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5tYXAodCk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBbXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gWihlLCBmdW5jdGlvbiAociwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICBuLnB1c2godChyLCBpLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICB9LCB0Lmhhc093biA9IGVlLCB0Lmluc2VydEVsZW1lbnQgPSB0ZSwgdC53YWl0Rm9yRWxlbWVudFRvTG9hZCA9IG5lLCB0LnRyaWdnZXJQaXhlbCA9IHJlLCB0LmNhbGxCdXJsID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuc291cmNlLCBuID0gZS5idXJsOwogICAgICAgICAgICAgICAgICAgIHQgPT09IE8uUzJTLlNSQyAmJiBuICYmIEMudHJpZ2dlclBpeGVsKG4pOwogICAgICAgICAgICAgICAgfSwgdC5pbnNlcnRIdG1sSW50b0lmcmFtZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdpZnJhbWUnKTsKICAgICAgICAgICAgICAgICAgICB0LmlkID0gRCgpLCB0LndpZHRoID0gMCwgdC5oZWlnaHQgPSAwLCB0LmhzcGFjZSA9ICcwJywgdC52c3BhY2UgPSAnMCcsIHQubWFyZ2luV2lkdGggPSAnMCcsIHQubWFyZ2luSGVpZ2h0ID0gJzAnLCB0LnN0eWxlLmRpc3BsYXkgPSAnbm9uZScsIHQuc3R5bGUuaGVpZ2h0ID0gJzBweCcsIHQuc3R5bGUud2lkdGggPSAnMHB4JywgdC5zY3JvbGxpbmcgPSAnbm8nLCB0LmZyYW1lQm9yZGVyID0gJzAnLCB0LmFsbG93dHJhbnNwYXJlbmN5ID0gJ3RydWUnLCBDLmluc2VydEVsZW1lbnQodCwgZG9jdW1lbnQsICdib2R5JyksIHQuY29udGVudFdpbmRvdy5kb2N1bWVudC5vcGVuKCksIHQuY29udGVudFdpbmRvdy5kb2N1bWVudC53cml0ZShlKSwgdC5jb250ZW50V2luZG93LmRvY3VtZW50LmNsb3NlKCk7CiAgICAgICAgICAgICAgICB9LCB0Lmluc2VydFVzZXJTeW5jSWZyYW1lID0gaWUsIHQuY3JlYXRlVHJhY2tQaXhlbEh0bWwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZW5jb2RlVVJJKGUpLCBuID0gJzxkaXYgc3R5bGU9InBvc2l0aW9uOmFic29sdXRlO2xlZnQ6MHB4O3RvcDowcHg7dmlzaWJpbGl0eTpoaWRkZW47Ij4nOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuICs9ICc8aW1nIHNyYz0iJyArIHQgKyAnIj48L2Rpdj4nOwogICAgICAgICAgICAgICAgfSwgdC5jcmVhdGVUcmFja1BpeGVsSWZyYW1lSHRtbCA9IG9lLCB0LmdldFZhbHVlU3RyaW5nID0gYWUsIHQudW5pcXVlcyA9IGNlLCB0LmZsYXR0ZW4gPSB1ZSwgdC5nZXRCaWRSZXF1ZXN0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5zb21lKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdSgpKHQuYmlkcywgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JpZElkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWRJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JpZF9pZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uc29tZShmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W25dID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciAmJiAobiA9IHIpLCByOwogICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgfSwgdC5nZXRLZXlzID0gc2UsIHQuZ2V0VmFsdWUgPSBkZSwgdC5nZXRLZXlCeVZhbHVlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmhhc093blByb3BlcnR5KG4pICYmIGVbbl0gPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgIH0sIHQuZ2V0QmlkZGVyQ29kZXMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6IHBianMuYWRVbml0czsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYmlkcy5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmJpZGRlcjsKICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVkdWNlKHVlLCBbXSk7CiAgICAgICAgICAgICAgICAgICAgfSkucmVkdWNlKHVlKS5maWx0ZXIoY2UpOwogICAgICAgICAgICAgICAgfSwgdC5pc0dwdFB1YmFkc0RlZmluZWQgPSBmZSwgdC5pc0FwbkdldFRhZ0RlZmluZWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5hcG50YWcgJiYgSyh3aW5kb3cuYXBudGFnLmdldFRhZykpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIH0sIG4uZCh0LCAnZ2V0SGlnaGVzdENwbScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGU7CiAgICAgICAgICAgICAgICB9KSwgbi5kKHQsICdnZXRPbGRlc3RIaWdoZXN0Q3BtQmlkJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBwZTsKICAgICAgICAgICAgICAgIH0pLCBuLmQodCwgJ2dldExhdGVzdEhpZ2hlc3RDcG1CaWQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdlOwogICAgICAgICAgICAgICAgfSksIHQuc2h1ZmZsZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgdCA+IDA7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHQtLTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICBlW3RdID0gZVtuXSwgZVtuXSA9IHI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfSwgdC5hZFVuaXRzRmlsdGVyID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCgpKGUsIHQgJiYgdC5hZFVuaXRDb2RlKTsKICAgICAgICAgICAgICAgIH0sIHQuZGVlcENsb25lID0gdmUsIHQuaW5JZnJhbWUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMuZ2V0V2luZG93U2VsZigpICE9PSBDLmdldFdpbmRvd1RvcCgpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHQuaXNTYWZhcmlCcm93c2VyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAvXigoPyFjaHJvbWV8YW5kcm9pZHxjcmlvc3xmeGlvcykuKSpzYWZhcmkvaS50ZXN0KG5hdmlnYXRvci51c2VyQWdlbnQpOwogICAgICAgICAgICAgICAgfSwgdC5yZXBsYWNlQXVjdGlvblByaWNlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZXBsYWNlKC9cJFx7QVVDVElPTl9QUklDRVx9L2csIHQpOwogICAgICAgICAgICAgICAgfSwgdC5yZXBsYWNlQ2xpY2tUaHJvdWdoID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIWUgfHwgIXQgfHwgJ3N0cmluZycgIT0gdHlwZW9mIHQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZXBsYWNlKC9cJHtDTElDS1RIUk9VR0h9L2csIHQpOwogICAgICAgICAgICAgICAgfSwgdC50aW1lc3RhbXAgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBEYXRlKCkuZ2V0VGltZSgpOwogICAgICAgICAgICAgICAgfSwgdC5nZXRQZXJmb3JtYW5jZU5vdyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LnBlcmZvcm1hbmNlICYmIHdpbmRvdy5wZXJmb3JtYW5jZS5ub3cgJiYgd2luZG93LnBlcmZvcm1hbmNlLm5vdygpIHx8IDA7CiAgICAgICAgICAgICAgICB9LCB0Lmhhc0RldmljZUFjY2VzcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITEgIT09IHIuYi5nZXRDb25maWcoJ2RldmljZUFjY2VzcycpOwogICAgICAgICAgICAgICAgfSwgdC5jaGVja0Nvb2tpZVN1cHBvcnQgPSB5ZSwgdC5kZWxheUV4ZWN1dGlvbiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQgPCAxKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ251bVJlcXVpcmVkQ2FsbHMgbXVzdCBiZSBhIHBvc2l0aXZlIG51bWJlci4gR290ICcuY29uY2F0KHQpKTsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgKytuID09PSB0ICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgdC5ncm91cEJ5ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZWR1Y2UoZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlW25bdF1dID0gZVtuW3RdXSB8fCBbXSkucHVzaChuKSwgZTsKICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICB9LCB0LmdldERlZmluZWRQYXJhbXMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0XTsKICAgICAgICAgICAgICAgICAgICB9KS5yZWR1Y2UoZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGgodCwgeSh7fSwgbiwgZVtuXSkpOwogICAgICAgICAgICAgICAgICAgIH0sIHt9KTsKICAgICAgICAgICAgICAgIH0sIHQuaXNWYWxpZE1lZGlhVHlwZXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnYmFubmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgJ25hdGl2ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICd2aWRlbycKICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgIGlmICghT2JqZWN0LmtleXMoZSkuZXZlcnkoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKCkodCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUudmlkZW8gJiYgZS52aWRlby5jb250ZXh0KQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCgpKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbnN0cmVhbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb3V0c3RyZWFtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZHBvZCcKICAgICAgICAgICAgICAgICAgICAgICAgXSwgZS52aWRlby5jb250ZXh0KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9LCB0LmdldEJpZGRlclJlcXVlc3QgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB1KCkoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYmlkcy5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmJpZGRlciA9PT0gdCAmJiBlLmFkVW5pdENvZGUgPT09IG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmxlbmd0aCA+IDA7CiAgICAgICAgICAgICAgICAgICAgfSkgfHwgewogICAgICAgICAgICAgICAgICAgICAgICBzdGFydDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgYXVjdGlvbklkOiBudWxsCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIHQuZ2V0VXNlckNvbmZpZ3VyZWRQYXJhbXMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jb2RlID09PSB0OwogICAgICAgICAgICAgICAgICAgIH0pLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5iaWRzOwogICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZSh1ZSwgW10pLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5iaWRkZXIgPT09IG47CiAgICAgICAgICAgICAgICAgICAgfSkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnBhcmFtcyB8fCB7fTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIHQuZ2V0T3JpZ2luID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubG9jYXRpb24ub3JpZ2luID8gd2luZG93LmxvY2F0aW9uLm9yaWdpbiA6IHdpbmRvdy5sb2NhdGlvbi5wcm90b2NvbCArICcvLycgKyB3aW5kb3cubG9jYXRpb24uaG9zdG5hbWUgKyAod2luZG93LmxvY2F0aW9uLnBvcnQgPyAnOicgKyB3aW5kb3cubG9jYXRpb24ucG9ydCA6ICcnKTsKICAgICAgICAgICAgICAgIH0sIHQuZ2V0RE5UID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnMScgPT09IG5hdmlnYXRvci5kb05vdFRyYWNrIHx8ICcxJyA9PT0gd2luZG93LmRvTm90VHJhY2sgfHwgJzEnID09PSBuYXZpZ2F0b3IubXNEb05vdFRyYWNrIHx8ICd5ZXMnID09PSBuYXZpZ2F0b3IuZG9Ob3RUcmFjazsKICAgICAgICAgICAgICAgIH0sIHQuaXNBZFVuaXRDb2RlTWF0Y2hpbmdTbG90ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGhlKGUsIHQpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCB0LmlzU2xvdE1hdGNoaW5nQWRVbml0Q29kZSA9IG1lLCB0LmdldEdwdFNsb3RJbmZvRm9yQWRVbml0Q29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgZmUoKSAmJiAodCA9IHUoKSh3aW5kb3cuZ29vZ2xldGFnLnB1YmFkcygpLmdldFNsb3RzKCksIG1lKGUpKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBncHRTbG90OiB0LmdldEFkVW5pdFBhdGgoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpdklkOiB0LmdldFNsb3RFbGVtZW50SWQoKQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgIH0sIHQudW5zdXBwb3J0ZWRCaWRkZXJNZXNzYWdlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5rZXlzKGUubWVkaWFUeXBlcyB8fCB7IGJhbm5lcjogJ2Jhbm5lcicgfSkuam9pbignLCAnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1xuICAgICcuY29uY2F0KGUuY29kZSwgJyBpcyBhICcpLmNvbmNhdChuLCAnIGFkIHVuaXRcbiAgICBjb250YWluaW5nIGJpZGRlcnMgdGhhdCBkb25cJ3Qgc3VwcG9ydCAnKS5jb25jYXQobiwgJzogJykuY29uY2F0KHQsICcuXG4gICAgVGhpcyBiaWRkZXIgd29uXCd0IGZldGNoIGRlbWFuZC5cbiAgJyk7CiAgICAgICAgICAgICAgICB9LCB0LmlzSW50ZWdlciA9IE9lLCB0LmNvbnZlcnRDYW1lbFRvVW5kZXJzY29yZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVwbGFjZSgvKD86XnxcLj8pKFtBLVpdKS9nLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ18nICsgdC50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgIH0pLnJlcGxhY2UoL15fLywgJycpOwogICAgICAgICAgICAgICAgfSwgdC5jbGVhbk9iaiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGUpLnJlZHVjZShmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBlW25dICYmICh0W25dID0gZVtuXSksIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwge30pOwogICAgICAgICAgICAgICAgfSwgdC5waWNrID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgIT09IG0oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5yZWR1Y2UoZnVuY3Rpb24gKG4sIHIsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByLCBhID0gci5tYXRjaCgvXiguKz8pXHNhc1xzKC4rPykkL2kpOwogICAgICAgICAgICAgICAgICAgICAgICBhICYmIChyID0gYVsxXSwgbyA9IGFbMl0pOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGVbcl07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09IHR5cGVvZiB0W2kgKyAxXSAmJiAoYyA9IHRbaSArIDFdKGMsIG4pKSwgdm9pZCAwICE9PSBjICYmIChuW29dID0gYyksIG47CiAgICAgICAgICAgICAgICAgICAgfSwge30pOwogICAgICAgICAgICAgICAgfSwgdC50cmFuc2Zvcm1CaWRkZXJQYXJhbUtleXdvcmRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDogJ2tleXdvcmRzJywgbiA9IFtdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBaKGUsIGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChZKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgWihlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoZSA9IGFlKHQgKyAnLicgKyByLCBlKSkgfHwgJycgPT09IGUpICYmIGkucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghSihlID0gYWUodCArICcuJyArIHIsIGUpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gW2VdOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIG4ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZQogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9KSwgbjsKICAgICAgICAgICAgICAgIH0sIHQuY29udmVydFR5cGVzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSkuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgdFtuXSAmJiAoSyhlW25dKSA/IHRbbl0gPSBlW25dKHRbbl0pIDogdFtuXSA9IChyID0gZVtuXSwgaSA9IHRbbl0sICdzdHJpbmcnID09PSByID8gaSAmJiBpLnRvU3RyaW5nKCkgOiAnbnVtYmVyJyA9PT0gciA/IE51bWJlcihpKSA6IGkpLCBpc05hTih0W25dKSAmJiBkZWxldGUgdC5rZXkpOwogICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgfSwgdC5pc0FycmF5T2ZOdW1zID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gWShlKSAmJiAoIXQgfHwgZS5sZW5ndGggPT09IHQpICYmIGUuZXZlcnkoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9lKGUpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgdC5maWxsID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gW10sIHIgPSAwOyByIDwgdDsgcisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gJChlKSA/IHZlKGUpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoKGkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgIH0sIHQuY2h1bmsgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBbXSwgciA9IDA7IHIgPCBNYXRoLmNlaWwoZS5sZW5ndGggLyB0KTsgcisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gciAqIHQsIG8gPSBpICsgdDsKICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoKGUuc2xpY2UoaSwgbykpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgIH0sIHQuZ2V0TWluVmFsdWVGcm9tQXJyYXkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLm1pbi5hcHBseShNYXRoLCBnKGUpKTsKICAgICAgICAgICAgICAgIH0sIHQuZ2V0TWF4VmFsdWVGcm9tQXJyYXkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLm1heC5hcHBseShNYXRoLCBnKGUpKTsKICAgICAgICAgICAgICAgIH0sIHQuY29tcGFyZU9uID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbZV0gPCBuW2VdID8gMSA6IHRbZV0gPiBuW2VdID8gLTEgOiAwOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCB0LnBhcnNlUVMgPSBqZSwgdC5mb3JtYXRRUyA9IFNlLCB0LnBhcnNlVXJsID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2EnKTsKICAgICAgICAgICAgICAgICAgICB0ICYmICdub0RlY29kZVdob2xlVVJMJyBpbiB0ICYmIHQubm9EZWNvZGVXaG9sZVVSTCA/IG4uaHJlZiA9IGUgOiBuLmhyZWYgPSBkZWNvZGVVUklDb21wb25lbnQoZSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0ICYmICdkZWNvZGVTZWFyY2hBc1N0cmluZycgaW4gdCAmJiB0LmRlY29kZVNlYXJjaEFzU3RyaW5nOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGhyZWY6IG4uaHJlZiwKICAgICAgICAgICAgICAgICAgICAgICAgcHJvdG9jb2w6IChuLnByb3RvY29sIHx8ICcnKS5yZXBsYWNlKC86JC8sICcnKSwKICAgICAgICAgICAgICAgICAgICAgICAgaG9zdG5hbWU6IG4uaG9zdG5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgIHBvcnQ6ICtuLnBvcnQsCiAgICAgICAgICAgICAgICAgICAgICAgIHBhdGhuYW1lOiBuLnBhdGhuYW1lLnJlcGxhY2UoL14oPyFcLykvLCAnLycpLAogICAgICAgICAgICAgICAgICAgICAgICBzZWFyY2g6IHIgPyBuLnNlYXJjaCA6IEMucGFyc2VRUyhuLnNlYXJjaCB8fCAnJyksCiAgICAgICAgICAgICAgICAgICAgICAgIGhhc2g6IChuLmhhc2ggfHwgJycpLnJlcGxhY2UoL14jLywgJycpLAogICAgICAgICAgICAgICAgICAgICAgICBob3N0OiBuLmhvc3QgfHwgd2luZG93LmxvY2F0aW9uLmhvc3QKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgdC5idWlsZFVybCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlLnByb3RvY29sIHx8ICdodHRwJykgKyAnOi8vJyArIChlLmhvc3QgfHwgZS5ob3N0bmFtZSArIChlLnBvcnQgPyAnOicuY29uY2F0KGUucG9ydCkgOiAnJykpICsgKGUucGF0aG5hbWUgfHwgJycpICsgKGUuc2VhcmNoID8gJz8nLmNvbmNhdChDLmZvcm1hdFFTKGUuc2VhcmNoIHx8ICcnKSkgOiAnJykgKyAoZS5oYXNoID8gJyMnLmNvbmNhdChlLmhhc2gpIDogJycpOwogICAgICAgICAgICAgICAgfSwgdC5kZWVwRXF1YWwgPSBFZSwgdC5tZXJnZURlZXAgPSBmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCwgciA9IG5ldyBBcnJheShuID4gMSA/IG4gLSAxIDogMCksIGkgPSAxOyBpIDwgbjsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICByW2kgLSAxXSA9IGFyZ3VtZW50c1tpXTsKICAgICAgICAgICAgICAgICAgICBpZiAoIXIubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHIuc2hpZnQoKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJCh0KSAmJiAkKG8pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICQob1tuXSkgPyAodFtuXSB8fCBoKHQsIHkoe30sIG4sIHt9KSksIGUodFtuXSwgb1tuXSkpIDogWShvW25dKSAmJiB0W25dID8gWSh0W25dKSAmJiBvW25dLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMSwgaSA9IDA7IGkgPCB0W25dLmxlbmd0aDsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoRWUodFtuXVtpXSwgZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYmIHRbbl0ucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogaCh0LCB5KHt9LCBuLCBvW25dKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgaW4gbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoYyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHZvaWQgMCwgW3RdLmNvbmNhdChyKSk7CiAgICAgICAgICAgICAgICB9LCB0LmN5cmI1M0hhc2ggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQsIG4gPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IDAsIHIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChLKE1hdGguaW11bCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLmltdWwoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAoNDE5NDMwMyAmIGUpICogKHQgfD0gMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDQyOTA3NzI5OTIgJiBlICYmIChuICs9ICg0MjkwNzcyOTkyICYgZSkgKiB0IHwgMCksIDAgfCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSA9IDM3MzU5Mjg1NTkgXiBuLCBvID0gMTEwMzU0Nzk5MSBeIG4sIGEgPSAwOyBhIDwgZS5sZW5ndGg7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IGUuY2hhckNvZGVBdChhKSwgaSA9IHIoaSBeIHQsIDI2NTQ0MzU3NjEpLCBvID0gcihvIF4gdCwgMTU5NzMzNDY3Nyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgPSByKGkgXiBpID4+PiAxNiwgMjI0NjgyMjUwNykgXiByKG8gXiBvID4+PiAxMywgMzI2NjQ4OTkwOSksICg0Mjk0OTY3Mjk2ICogKDIwOTcxNTEgJiAobyA9IHIobyBeIG8gPj4+IDE2LCAyMjQ2ODIyNTA3KSBeIHIoaSBeIGkgPj4+IDEzLCAzMjY2NDg5OTA5KSkpICsgKGkgPj4+IDApKS50b1N0cmluZygpOwogICAgICAgICAgICAgICAgfSwgdC5pc0FsbG93WmVyb0NwbUJpZHNFbmFibGVkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdChpLmEpKCkuYmlkZGVyU2V0dGluZ3M7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbZV0gJiYgITAgPT09IHRbZV0uYWxsb3daZXJvQ3BtQmlkcyB8fCB0LnN0YW5kYXJkICYmICEwID09PSB0LnN0YW5kYXJkLmFsbG93WmVyb0NwbUJpZHM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDMpLCBpID0gbigxNCksIG8gPSBuKDE2NyksIGEgPSBuLm4obyksIGMgPSBuKDExKSwgdSA9IG4ubihjKSwgcyA9IG4oMTIpLCBkID0gbi5uKHMpLCBmID0gbigxNjgpOwogICAgICAgICAgICAgICAgbi5kKHQsICdkZWVwQWNjZXNzJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmLmE7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciBsID0gbigxNjkpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfShlKSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG51bGwgPT0gZSA/IG51bGwgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgU3ltYm9sICYmIGVbU3ltYm9sLml0ZXJhdG9yXSB8fCBlWydAQGl0ZXJhdG9yJ107CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBpLCBvID0gW10sIGEgPSAhMCwgYyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gbi5jYWxsKGUpOyAhKGEgPSAociA9IG4ubmV4dCgpKS5kb25lKSAmJiAoby5wdXNoKHIudmFsdWUpLCAhdCB8fCBvLmxlbmd0aCAhPT0gdCk7IGEgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAhMCwgaSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgfHwgbnVsbCA9PSBuLnJldHVybiB8fCBuLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICB9KGUsIHQpIHx8IGIoZSwgdCkgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbnZhbGlkIGF0dGVtcHQgdG8gZGVzdHJ1Y3R1cmUgbm9uLWl0ZXJhYmxlIGluc3RhbmNlLlxuSW4gb3JkZXIgdG8gYmUgaXRlcmFibGUsIG5vbi1hcnJheSBvYmplY3RzIG11c3QgaGF2ZSBhIFtTeW1ib2wuaXRlcmF0b3JdKCkgbWV0aG9kLicpOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGcoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2KGUpOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBTeW1ib2wgJiYgbnVsbCAhPSBlW1N5bWJvbC5pdGVyYXRvcl0gfHwgbnVsbCAhPSBlWydAQGl0ZXJhdG9yJ10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IGIoZSkgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbnZhbGlkIGF0dGVtcHQgdG8gc3ByZWFkIG5vbi1pdGVyYWJsZSBpbnN0YW5jZS5cbkluIG9yZGVyIHRvIGJlIGl0ZXJhYmxlLCBub24tYXJyYXkgb2JqZWN0cyBtdXN0IGhhdmUgYSBbU3ltYm9sLml0ZXJhdG9yXSgpIG1ldGhvZC4nKTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdihlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoZSkuc2xpY2UoOCwgLTEpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ09iamVjdCcgPT09IG4gJiYgZS5jb25zdHJ1Y3RvciAmJiAobiA9IGUuY29uc3RydWN0b3IubmFtZSksICdNYXAnID09PSBuIHx8ICdTZXQnID09PSBuID8gQXJyYXkuZnJvbShlKSA6ICdBcmd1bWVudHMnID09PSBuIHx8IC9eKD86VWl8SSludCg/Ojh8MTZ8MzIpKD86Q2xhbXBlZCk/QXJyYXkkLy50ZXN0KG4pID8gdihlLCB0KSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAobnVsbCA9PSB0IHx8IHQgPiBlLmxlbmd0aCkgJiYgKHQgPSBlLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDAsIHIgPSBuZXcgQXJyYXkodCk7IG4gPCB0OyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHJbbl0gPSBlW25dOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24geShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgaW4gZSA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSkgOiBlW3RdID0gbiwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChoID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG4sIHIpICYmIChlW3JdID0gbltyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSkuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAobSA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgbi5kKHQsICdkZWVwU2V0VmFsdWUnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwuYTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIE8gPSBuKDUpLCBqID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZywgUyA9IEJvb2xlYW4od2luZG93LmNvbnNvbGUpLCBFID0gQm9vbGVhbihTICYmIHdpbmRvdy5jb25zb2xlLmxvZyksIEEgPSBCb29sZWFuKFMgJiYgd2luZG93LmNvbnNvbGUuaW5mbyksIFQgPSBCb29sZWFuKFMgJiYgd2luZG93LmNvbnNvbGUud2FybiksIEkgPSBCb29sZWFuKFMgJiYgd2luZG93LmNvbnNvbGUuZXJyb3IpLCB3ID0gbigxMCksIEMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoZWNrQ29va2llU3VwcG9ydDogeWUsCiAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZVRyYWNrUGl4ZWxJZnJhbWVIdG1sOiBvZSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0V2luZG93U2VsZjogcSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0V2luZG93VG9wOiBQLAogICAgICAgICAgICAgICAgICAgICAgICBnZXRXaW5kb3dMb2NhdGlvbjogTSwKICAgICAgICAgICAgICAgICAgICAgICAgaW5zZXJ0VXNlclN5bmNJZnJhbWU6IGllLAogICAgICAgICAgICAgICAgICAgICAgICBpbnNlcnRFbGVtZW50OiB0ZSwKICAgICAgICAgICAgICAgICAgICAgICAgaXNGbjogSywKICAgICAgICAgICAgICAgICAgICAgICAgdHJpZ2dlclBpeGVsOiByZSwKICAgICAgICAgICAgICAgICAgICAgICAgbG9nRXJyb3I6IEYsCiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ1dhcm46IFcsCiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ01lc3NhZ2U6IEcsCiAgICAgICAgICAgICAgICAgICAgICAgIGxvZ0luZm86IEwsCiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlUVM6IGplLAogICAgICAgICAgICAgICAgICAgICAgICBmb3JtYXRRUzogU2UsCiAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBFcXVhbDogRWUKICAgICAgICAgICAgICAgICAgICB9LCBSID0ge307CiAgICAgICAgICAgICAgICB2YXIgXywgVSA9IHt9LCBCID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfS5iaW5kKG51bGwsIDEsIFUpKCkgPT09IFUgPyBGdW5jdGlvbi5wcm90b3R5cGUuYmluZCA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcywgbiA9IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hcHBseShlLCBuLmNvbmNhdChBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgeCA9IChfID0gMCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKytfOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gRCgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geCgpICsgTWF0aC5yYW5kb20oKS50b1N0cmluZygxNikuc3Vic3RyKDIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gayhlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE4oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlWzBdICsgJ3gnICsgZVsxXTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE4oZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBZKGUpICYmIDIgPT09IGUubGVuZ3RoICYmICFpc05hTihlWzBdKSAmJiAhaXNOYU4oZVsxXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBQKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cudG9wOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcSgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LnNlbGY7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBNKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubG9jYXRpb247CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBHKCkgewogICAgICAgICAgICAgICAgICAgIFYoKSAmJiBFICYmIGNvbnNvbGUubG9nLmFwcGx5KGNvbnNvbGUsIHooYXJndW1lbnRzLCAnTUVTU0FHRTonKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMKCkgewogICAgICAgICAgICAgICAgICAgIFYoKSAmJiBBICYmIGNvbnNvbGUuaW5mby5hcHBseShjb25zb2xlLCB6KGFyZ3VtZW50cywgJ0lORk86JykpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gVygpIHsKICAgICAgICAgICAgICAgICAgICBWKCkgJiYgVCAmJiBjb25zb2xlLndhcm4uYXBwbHkoY29uc29sZSwgeihhcmd1bWVudHMsICdXQVJOSU5HOicpKSwgdy5lbWl0KE8uRVZFTlRTLkFVQ1RJT05fREVCVUcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ1dBUk5JTkcnLAogICAgICAgICAgICAgICAgICAgICAgICBhcmd1bWVudHM6IGFyZ3VtZW50cwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRigpIHsKICAgICAgICAgICAgICAgICAgICBWKCkgJiYgSSAmJiBjb25zb2xlLmVycm9yLmFwcGx5KGNvbnNvbGUsIHooYXJndW1lbnRzLCAnRVJST1I6JykpLCB3LmVtaXQoTy5FVkVOVFMuQVVDVElPTl9ERUJVRywgewogICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnRVJST1InLAogICAgICAgICAgICAgICAgICAgICAgICBhcmd1bWVudHM6IGFyZ3VtZW50cwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24geihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZSA9IFtdLnNsaWNlLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSByLmIuZ2V0Q3VycmVudEJpZGRlcigpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIGUudW5zaGlmdCh0KSwgbiAmJiBlLnVuc2hpZnQoaSgnI2FhYScpKSwgZS51bnNoaWZ0KGkoJyMzYjg4YzMnKSksIGUudW5zaGlmdCgnJWNQcmViaWQnICsgKG4gPyAnJWMnLmNvbmNhdChuKSA6ICcnKSksIGU7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZGlzcGxheTogaW5saW5lLWJsb2NrOyBjb2xvcjogI2ZmZjsgYmFja2dyb3VuZDogJy5jb25jYXQoZSwgJzsgcGFkZGluZzogMXB4IDRweDsgYm9yZGVyLXJhZGl1czogM3B4OycpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFYoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhci5iLmdldENvbmZpZygnZGVidWcnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEgoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBqLmNhbGwoZSkgPT09ICdbb2JqZWN0ICcgKyB0ICsgJ10nOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSyhlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEgoZSwgJ0Z1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBKKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gSChlLCAnU3RyaW5nJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBZKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gSChlLCAnQXJyYXknKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFEoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBIKGUsICdOdW1iZXInKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uICQoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBIKGUsICdPYmplY3QnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFgoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIGlmIChZKGUpIHx8IEooZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKGUubGVuZ3RoID4gMCk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGFzT3duUHJvcGVydHkuY2FsbChlLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBaKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIVgoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEsoZS5mb3JFYWNoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZvckVhY2godCwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gMCwgciA9IGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAociA+IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbiA8IHI7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGVbbl0sIG4sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNPd25Qcm9wZXJ0eS5jYWxsKGUsIG4pICYmIHQuY2FsbCh0aGlzLCBlW25dLCBuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBlZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuaGFzT3duUHJvcGVydHkgPyBlLmhhc093blByb3BlcnR5KHQpIDogdm9pZCAwICE9PSBlW3RdICYmIGUuY29uc3RydWN0b3IucHJvdG90eXBlW3RdICE9PSBlW3RdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdGUoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHZhciBpOwogICAgICAgICAgICAgICAgICAgIHQgPSB0IHx8IGRvY3VtZW50LCBpID0gbiA/IHQuZ2V0RWxlbWVudHNCeVRhZ05hbWUobikgOiB0LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdoZWFkJyk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChpID0gaS5sZW5ndGggPyBpIDogdC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnYm9keScpKS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBpWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByID8gbnVsbCA6IGkuZmlyc3RDaGlsZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLmluc2VydEJlZm9yZShlLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBuZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiAocikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnJlbW92ZUV2ZW50TGlzdGVuZXIoJ2xvYWQnLCB0KSwgZS5yZW1vdmVFdmVudExpc3RlbmVyKCdlcnJvcicsIHQpLCBudWxsICE9IG4gJiYgd2luZG93LmNsZWFyVGltZW91dChuKSwgcigpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBlLmFkZEV2ZW50TGlzdGVuZXIoJ2xvYWQnLCBpKSwgZS5hZGRFdmVudExpc3RlbmVyKCdlcnJvcicsIGkpLCBudWxsICE9IHQgJiYgKG4gPSB3aW5kb3cuc2V0VGltZW91dChpLCB0KSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByZShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuZXcgSW1hZ2UoKTsKICAgICAgICAgICAgICAgICAgICB0ICYmIEMuaXNGbih0KSAmJiBuZShyLCBuKS50aGVuKHQpLCByLnNyYyA9IGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBpZShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBDLmNyZWF0ZVRyYWNrUGl4ZWxJZnJhbWVIdG1sKGUsICExLCAnYWxsb3ctc2NyaXB0cyBhbGxvdy1zYW1lLW9yaWdpbicpLCBpID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7CiAgICAgICAgICAgICAgICAgICAgaS5pbm5lckhUTUwgPSByOwogICAgICAgICAgICAgICAgICAgIHZhciBvID0gaS5maXJzdENoaWxkOwogICAgICAgICAgICAgICAgICAgIHQgJiYgQy5pc0ZuKHQpICYmIG5lKG8sIG4pLnRoZW4odCksIEMuaW5zZXJ0RWxlbWVudChvLCBkb2N1bWVudCwgJ2h0bWwnLCAhMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvZShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAhKGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdKSB8fCBhcmd1bWVudHNbMV0sIG4gPSBhcmd1bWVudHMubGVuZ3RoID4gMiAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1syXSA/IGFyZ3VtZW50c1syXSA6ICcnOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gKHQgJiYgKGUgPSBlbmNvZGVVUkkoZSkpLCBuICYmIChuID0gJ3NhbmRib3g9IicuY29uY2F0KG4sICciJykpLCAnPGlmcmFtZSAnLmNvbmNhdChuLCAnIGlkPSInKS5jb25jYXQoRCgpLCAnIlxuICAgICAgZnJhbWVib3JkZXI9IjAiXG4gICAgICBhbGxvd3RyYW5zcGFyZW5jeT0idHJ1ZSJcbiAgICAgIG1hcmdpbmhlaWdodD0iMCIgbWFyZ2lud2lkdGg9IjAiXG4gICAgICB3aWR0aD0iMCIgaHNwYWNlPSIwIiB2c3BhY2U9IjAiIGhlaWdodD0iMCJcbiAgICAgIHN0eWxlPSJoZWlnaHQ6MHB4O3dpZHRoOjBweDtkaXNwbGF5Om5vbmU7IlxuICAgICAgc2Nyb2xsaW5nPSJubyJcbiAgICAgIHNyYz0iJykuY29uY2F0KGUsICciPlxuICAgIDwvaWZyYW1lPicpKSA6ICcnOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYWUoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IHQgPyBuIDogSih0KSA/IHQgOiBRKHQpID8gdC50b1N0cmluZygpIDogdm9pZCBDLmxvZ1dhcm4oJ1Vuc3Vwb3J0ZWQgdHlwZSBmb3IgcGFyYW06ICcgKyBlICsgJyByZXF1aXJlZCB0eXBlOiBTdHJpbmcnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGNlKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5pbmRleE9mKGUpID09PSB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdWUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNvbmNhdCh0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNlKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbdF07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBmZSgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93Lmdvb2dsZXRhZyAmJiBLKHdpbmRvdy5nb29nbGV0YWcucHViYWRzKSAmJiBLKHdpbmRvdy5nb29nbGV0YWcucHViYWRzKCkuZ2V0U2xvdHMpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgbGUgPSBiZSgndGltZVRvUmVzcG9uZCcsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID4gdDsKICAgICAgICAgICAgICAgICAgICB9KSwgcGUgPSBiZSgncmVzcG9uc2VUaW1lc3RhbXAnLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA+IHQ7CiAgICAgICAgICAgICAgICAgICAgfSksIGdlID0gYmUoJ3Jlc3BvbnNlVGltZXN0YW1wJywgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPCB0OwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gYmUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jcG0gPT09IHIuY3BtID8gdChuW2VdLCByW2VdKSA/IHIgOiBuIDogbi5jcG0gPCByLmNwbSA/IHIgOiBuOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2ZShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoKShlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHllKCkgewogICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cubmF2aWdhdG9yLmNvb2tpZUVuYWJsZWQgfHwgZG9jdW1lbnQuY29va2llLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGhlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5nZXRBZFVuaXRQYXRoKCkgPT09IHQgfHwgZS5nZXRTbG90RWxlbWVudElkKCkgPT09IHQ7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gbWUoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaGUodCwgZSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE9lKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gTnVtYmVyLmlzSW50ZWdlciA/IE51bWJlci5pc0ludGVnZXIoZSkgOiAnbnVtYmVyJyA9PSB0eXBlb2YgZSAmJiBpc0Zpbml0ZShlKSAmJiBNYXRoLmZsb29yKGUpID09PSBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gamUoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gZS5yZXBsYWNlKC9eXD8vLCAnJykuc3BsaXQoJyYnKS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBwKHQuc3BsaXQoJz0nKSwgMiksIHIgPSBuWzBdLCBpID0gblsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC9cW1xdJC8udGVzdChyKSA/IChlW3IgPSByLnJlcGxhY2UoJ1tdJywgJycpXSA9IGVbcl0gfHwgW10sIGVbcl0ucHVzaChpKSkgOiBlW3JdID0gaSB8fCAnJywgZTsKICAgICAgICAgICAgICAgICAgICB9LCB7fSkgOiB7fTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNlKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSkubWFwKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5pc0FycmF5KGVbdF0pID8gZVt0XS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJy5jb25jYXQodCwgJ1tdPScpLmNvbmNhdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignJicpIDogJycuY29uY2F0KHQsICc9JykuY29uY2F0KGVbdF0pOwogICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJyYnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gbShlKSAmJiBudWxsICE9PSBlICYmICdvYmplY3QnID09PSBtKHQpICYmIG51bGwgIT09IHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5rZXlzKGUpLmxlbmd0aCAhPT0gT2JqZWN0LmtleXModCkubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdC5oYXNPd25Qcm9wZXJ0eShuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUVlKGVbbl0sIHRbbl0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCBuLmQodCwgJ3N0b3JhZ2UnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQ7CiAgICAgICAgICAgICAgICB9KSwgdC5yZWdpc3RlckJpZGRlciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBBcnJheS5pc0FycmF5KGUuc3VwcG9ydGVkTWVkaWFUeXBlcykgPyB7IHN1cHBvcnRlZE1lZGlhVHlwZXM6IGUuc3VwcG9ydGVkTWVkaWFUeXBlcyB9IDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHcoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGkuZGVmYXVsdC5yZWdpc3RlckJpZEFkYXB0ZXIobiwgZS5jb2RlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbihlKSwgQXJyYXkuaXNBcnJheShlLmFsaWFzZXMpICYmIGUuYWxpYXNlcy5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBvLCBhID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHkuaXNQbGFpbk9iamVjdCkodCkgJiYgKGEgPSB0LmNvZGUsIHIgPSB0Lmd2bGlkLCBvID0gdC5za2lwUGJzQWxpYXNpbmcpLCBpLmRlZmF1bHQuYWxpYXNSZWdpc3RyeVthXSA9IGUuY29kZSwgbihBKHt9LCBlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3ZsaWQ6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBza2lwUGJzQWxpYXNpbmc6IG8KICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgdC5uZXdCaWRkZXIgPSB3LCBuLmQodCwgJ3JlZ2lzdGVyU3luY0lubmVyJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBDOwogICAgICAgICAgICAgICAgfSksIHQucHJlbG9hZEJpZGRlck1hcHBpbmdGaWxlID0gUiwgdC5nZXRJYWJTdWJDYXRlZ29yeSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpLmRlZmF1bHQuZ2V0QmlkQWRhcHRlcihlKTsKICAgICAgICAgICAgICAgICAgICBpZiAobi5nZXRTcGVjKCkuZ2V0TWFwcGluZ0ZpbGVJbmZvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbi5nZXRTcGVjKCkuZ2V0TWFwcGluZ0ZpbGVJbmZvKCksIG8gPSByLmxvY2FsU3RvcmFnZUtleSA/IHIubG9jYWxTdG9yYWdlS2V5IDogbi5nZXRCaWRkZXJDb2RlKCksIGEgPSBULmdldERhdGFGcm9tTG9jYWxTdG9yYWdlKG8pOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gSlNPTi5wYXJzZShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoeS5sb2dFcnJvcikoJ0ZhaWxlZCB0byBwYXJzZSAnLmNvbmNhdChlLCAnIG1hcHBpbmcgZGF0YSBzdG9yZWQgaW4gbG9jYWwgc3RvcmFnZScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLm1hcHBpbmdbdF0gPyBhLm1hcHBpbmdbdF0gOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdC5pc1ZhbGlkID0gXzsKICAgICAgICAgICAgICAgIHZhciByID0gbig4MiksIGkgPSBuKDgpLCBvID0gbigzKSwgYSA9IG4oNDMpLCBjID0gbig2MCksIHUgPSBuKDM5KSwgcyA9IG4oMjApLCBkID0gbig1KSwgZiA9IG4ubihkKSwgbCA9IG4oMTApLCBwID0gbi5uKGwpLCBnID0gbigxMiksIGIgPSBuLm4oZyksIHYgPSBuKDQpLCB5ID0gbigwKSwgaCA9IG4oMiksIG0gPSBuKDkpLCBPID0gbig3KTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGooZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBudWxsID09IGUgPyBudWxsIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIFN5bWJvbCAmJiBlW1N5bWJvbC5pdGVyYXRvcl0gfHwgZVsnQEBpdGVyYXRvciddOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgaSwgbyA9IFtdLCBhID0gITAsIGMgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IG4uY2FsbChlKTsgIShhID0gKHIgPSBuLm5leHQoKSkuZG9uZSkgJiYgKG8ucHVzaChyLnZhbHVlKSwgIXQgfHwgby5sZW5ndGggIT09IHQpOyBhID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gITAsIGkgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhIHx8IG51bGwgPT0gbi5yZXR1cm4gfHwgbi5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgfShlLCB0KSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChlKS5zbGljZSg4LCAtMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICdPYmplY3QnID09PSBuICYmIGUuY29uc3RydWN0b3IgJiYgKG4gPSBlLmNvbnN0cnVjdG9yLm5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ01hcCcgPT09IG4gfHwgJ1NldCcgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdBcmd1bWVudHMnID09PSBuIHx8IC9eKD86VWl8SSludCg/Ojh8MTZ8MzIpKD86Q2xhbXBlZCk/QXJyYXkkLy50ZXN0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFMoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgfShlLCB0KSB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ludmFsaWQgYXR0ZW1wdCB0byBkZXN0cnVjdHVyZSBub24taXRlcmFibGUgaW5zdGFuY2UuXG5JbiBvcmRlciB0byBiZSBpdGVyYWJsZSwgbm9uLWFycmF5IG9iamVjdHMgbXVzdCBoYXZlIGEgW1N5bWJvbC5pdGVyYXRvcl0oKSBtZXRob2QuJyk7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgKG51bGwgPT0gdCB8fCB0ID4gZS5sZW5ndGgpICYmICh0ID0gZS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0gbmV3IEFycmF5KHQpOyBuIDwgdDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICByW25dID0gZVtuXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEUoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoRSA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQSgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKEEgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgcikgJiYgKGVbcl0gPSBuW3JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIFQgPSBPYmplY3QoTy5hKSgnYmlkZGVyRmFjdG9yeScpLCBJID0gWwogICAgICAgICAgICAgICAgICAgICAgICAncmVxdWVzdElkJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NwbScsCiAgICAgICAgICAgICAgICAgICAgICAgICd0dGwnLAogICAgICAgICAgICAgICAgICAgICAgICAnY3JlYXRpdmVJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICduZXRSZXZlbnVlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2N1cnJlbmN5JwogICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB3KGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShuZXcgci5hKGUuY29kZSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0U3BlYzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5mcmVlemUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lzdGVyU3luY3M6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxCaWRzOiBmdW5jdGlvbiAociwgYywgdSwgcywgZCwgbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoci5iaWRzKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0ge30sIGIgPSBbXSwgdiA9IHIuYmlkcy5maWx0ZXIobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09IHYubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaFtlLmJpZElkXSA9IGUsIGUuYWRVbml0Q29kZSB8fCAoZS5hZFVuaXRDb2RlID0gZS5wbGFjZW1lbnRDb2RlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gZS5idWlsZFJlcXVlc3RzKHYsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobSAmJiAwICE9PSBtLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShtKSB8fCAobSA9IFttXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgTyA9IE9iamVjdCh5LmRlbGF5RXhlY3V0aW9uKShsKGopLCBtLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcC5hLmVtaXQoZi5hLkVWRU5UUy5CRUZPUkVfQklEREVSX0hUVFAsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG0uZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodC5tZXRob2QpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdHRVQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzKCcnLmNvbmNhdCh0LnVybCkuY29uY2F0KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJz8nLmNvbmNhdCgnb2JqZWN0JyA9PT0gRShlKSA/IE9iamVjdCh5LnBhcnNlUXVlcnlTdHJpbmdQYXJhbWV0ZXJzKShlKSA6IGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHQuZGF0YSkpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWNjZXNzOiBsKG4pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdm9pZCAwLCBBKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ0dFVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aXRoQ3JlZGVudGlhbHM6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQub3B0aW9ucykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdQT1NUJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyh0LnVybCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogbChuKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICdzdHJpbmcnID09IHR5cGVvZiB0LmRhdGEgPyB0LmRhdGEgOiBKU09OLnN0cmluZ2lmeSh0LmRhdGEpLCBBKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFR5cGU6ICd0ZXh0L3BsYWluJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpdGhDcmVkZW50aWFsczogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5vcHRpb25zKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdCh5LmxvZ1dhcm4pKCdTa2lwcGluZyBpbnZhbGlkIHJlcXVlc3QgZnJvbSAnLmNvbmNhdChlLmNvZGUsICcuIFJlcXVlc3QgdHlwZSAnKS5jb25jYXQodC50eXBlLCAnIG11c3QgYmUgR0VUIG9yIFBPU1QnKSksIE8oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihuLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQoZS5jb2RlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBKU09OLnBhcnNlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogeyBnZXQ6IGkuZ2V0UmVzcG9uc2VIZWFkZXIuYmluZChpKSB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGIucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBlLmludGVycHJldFJlc3BvbnNlKG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHkubG9nRXJyb3IpKCdCaWRkZXIgJy5jb25jYXQoZS5jb2RlLCAnIGZhaWxlZCB0byBpbnRlcnByZXQgdGhlIHNlcnZlclwncyByZXNwb25zZS4gQ29udGludWluZyB3aXRob3V0IGJpZHMnKSwgbnVsbCwgdCksIHZvaWQgTygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBoW3QucmVxdWVzdElkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5vcmlnaW5hbENwbSA9IHQuY3BtLCB0Lm9yaWdpbmFsQ3VycmVuY3kgPSB0LmN1cnJlbmN5LCB0Lm1ldGEgPSB0Lm1ldGEgfHwgQSh7fSwgdFtuLmJpZGRlcl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gQShPYmplY3QoYS5hKShmLmEuU1RBVFVTLkdPT0QsIG4pLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ1tlXSA9ICEwLCBfKGUsIHQsIFtyXSkgJiYgYyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG4uYWRVbml0Q29kZSwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoeS5sb2dXYXJuKSgnQmlkZGVyICcuY29uY2F0KGUuY29kZSwgJyBtYWRlIGJpZCBmb3IgdW5rbm93biByZXF1ZXN0IElEOiAnKS5jb25jYXQodC5yZXF1ZXN0SWQsICcuIElnbm9yaW5nLicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvICYmIChPYmplY3QoeS5pc0FycmF5KShvKSA/IG8uZm9yRWFjaCh1KSA6IHUobykpLCBPKG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZChlLmNvZGUpLCBpLmRlZmF1bHQuY2FsbEJpZGRlckVycm9yKGUuY29kZSwgbiwgciksIHAuYS5lbWl0KGYuYS5FVkVOVFMuQklEREVSX0VSUk9SLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlclJlcXVlc3Q6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdCh5LmxvZ0Vycm9yKSgnU2VydmVyIGNhbGwgZm9yICcuY29uY2F0KGUuY29kZSwgJyBmYWlsZWQ6ICcpLmNvbmNhdCh0LCAnICcpLmNvbmNhdChuLnN0YXR1cywgJy4gQ29udGludWluZyB3aXRob3V0IGJpZHMuJykpLCBPKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBqKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUoKSwgby5iLnJ1bldpdGhCaWRkZXIoZS5jb2RlLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAuYS5lbWl0KGYuYS5FVkVOVFMuQklEREVSX0RPTkUsIHIpLCB0KGIsIHIuZ2RwckNvbnNlbnQsIHIudXNwQ29uc2VudCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgQyhlLCB0LCBuLCByKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbih0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWUuaXNCaWRSZXF1ZXN0VmFsaWQodCkgfHwgKE9iamVjdCh5LmxvZ1dhcm4pKCdJbnZhbGlkIGJpZCBzZW50IHRvIGJpZGRlciAnLmNvbmNhdChlLmNvZGUsICc6ICcpLmNvbmNhdChKU09OLnN0cmluZ2lmeSh0KSkpLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIEMgPSBPYmplY3QobS5iKSgnYXN5bmMnLCBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gby5iLmdldENvbmZpZygndXNlclN5bmMuYWxpYXNTeW5jRW5hYmxlZCcpOwogICAgICAgICAgICAgICAgICAgIGlmIChlLmdldFVzZXJTeW5jcyAmJiAoYSB8fCAhaS5kZWZhdWx0LmFsaWFzUmVnaXN0cnlbZS5jb2RlXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBvLmIuZ2V0Q29uZmlnKCd1c2VyU3luYy5maWx0ZXJTZXR0aW5ncycpLCBzID0gZS5nZXRVc2VyU3luY3MoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmcmFtZUVuYWJsZWQ6ICEoIXUgfHwgIXUuaWZyYW1lICYmICF1LmFsbCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxFbmFibGVkOiAhKCF1IHx8ICF1LmltYWdlICYmICF1LmFsbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQsIG4sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICBzICYmIChBcnJheS5pc0FycmF5KHMpIHx8IChzID0gW3NdKSwgcy5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmEucmVnaXN0ZXJTeW5jKHQudHlwZSwgZS5jb2RlLCB0LnVybCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCAncmVnaXN0ZXJTeW5jcycpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gUihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFvLmIuZ2V0Q29uZmlnKCdhZHBvZC5icmFuZENhdGVnb3J5RXhjbHVzaW9uJykpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNhbGwodGhpcywgdCk7CiAgICAgICAgICAgICAgICAgICAgdC5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdCh5LmRlZXBBY2Nlc3MpKGUsICdtZWRpYVR5cGVzLnZpZGVvLmNvbnRleHQnKSA9PT0gaC5hOwogICAgICAgICAgICAgICAgICAgIH0pLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5iaWRzLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYmlkZGVyOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9KS5yZWR1Y2UoeS5mbGF0dGVuLCBbXSkuZmlsdGVyKHkudW5pcXVlcykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkuZGVmYXVsdC5nZXRCaWRBZGFwdGVyKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5nZXRTcGVjKCkuZ2V0TWFwcGluZ0ZpbGVJbmZvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuZ2V0U3BlYygpLmdldE1hcHBpbmdGaWxlSW5mbygpLCByID0gbi5yZWZyZXNoSW5EYXlzID8gbi5yZWZyZXNoSW5EYXlzIDogMSwgbyA9IG4ubG9jYWxTdG9yYWdlS2V5ID8gbi5sb2NhbFN0b3JhZ2VLZXkgOiB0LmdldFNwZWMoKS5jb2RlLCBhID0gVC5nZXREYXRhRnJvbUxvY2FsU3RvcmFnZShvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCEoYSA9IGEgPyBKU09OLnBhcnNlKGEpIDogdm9pZCAwKSB8fCBPYmplY3QoeS50aW1lc3RhbXApKCkgPiBhLmxhc3RVcGRhdGVkICsgMjQgKiByICogNjAgKiA2MCAqIDEwMDApICYmIE9iamVjdCh2LmEpKG4udXJsLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBKU09OLnBhcnNlKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0VXBkYXRlZDogT2JqZWN0KHkudGltZXN0YW1wKSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXBwaW5nOiB0Lm1hcHBpbmcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQuc2V0RGF0YUluTG9jYWxTdG9yYWdlKG8sIEpTT04uc3RyaW5naWZ5KG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoeS5sb2dFcnJvcikoJ0ZhaWxlZCB0byBwYXJzZSAnLmNvbmNhdChlLCAnIGJpZGRlciB0cmFuc2xhdGlvbiBtYXBwaW5nIGZpbGUnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoeS5sb2dFcnJvcikoJ0ZhaWxlZCB0byBsb2FkICcuY29uY2F0KGUsICcgYmlkZGVyIHRyYW5zbGF0aW9uIGZpbGUnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoeS5sb2dFcnJvcikoJ0ZhaWxlZCB0byBwYXJzZSAnLmNvbmNhdChlLCAnIGJpZGRlciB0cmFuc2xhdGlvbiBtYXBwaW5nIGZpbGUnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KSwgZS5jYWxsKHRoaXMsIHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gXyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnSW52YWxpZCBiaWQgZnJvbSAnLmNvbmNhdCh0LmJpZGRlckNvZGUsICcuIElnbm9yaW5nIGJpZDogJykuY29uY2F0KGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IHQgPyAoaSA9IE9iamVjdC5rZXlzKHQpLCBJLmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKCkoaSwgZSkgJiYgIWIoKShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsCiAgICAgICAgICAgICAgICAgICAgICAgIF0sIHRbZV0pOwogICAgICAgICAgICAgICAgICAgIH0pID8gJ25hdGl2ZScgIT09IHQubWVkaWFUeXBlIHx8IE9iamVjdCh1LmcpKHQsIG4pID8gJ3ZpZGVvJyAhPT0gdC5tZWRpYVR5cGUgfHwgT2JqZWN0KHMuZCkodCwgbikgPyAhKCdiYW5uZXInID09PSB0Lm1lZGlhVHlwZSAmJiAhZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0LndpZHRoIHx8IDAgPT09IHBhcnNlSW50KHQud2lkdGgsIDEwKSkgJiYgKHQuaGVpZ2h0IHx8IDAgPT09IHBhcnNlSW50KHQuaGVpZ2h0LCAxMCkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQud2lkdGggPSBwYXJzZUludCh0LndpZHRoLCAxMCksIHQuaGVpZ2h0ID0gcGFyc2VJbnQodC5oZWlnaHQsIDEwKSwgITA7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0KHkuZ2V0QmlkZGVyUmVxdWVzdCkobiwgdC5iaWRkZXJDb2RlLCBlKSwgaSA9IHIgJiYgci5iaWRzICYmIHIuYmlkc1swXSAmJiByLmJpZHNbMF0uc2l6ZXMsIG8gPSBPYmplY3QoeS5wYXJzZVNpemVzSW5wdXQpKGkpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PT0gby5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gaihvWzBdLnNwbGl0KCd4JyksIDIpLCBjID0gYVswXSwgdSA9IGFbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC53aWR0aCA9IHBhcnNlSW50KGMsIDEwKSwgdC5oZWlnaHQgPSBwYXJzZUludCh1LCAxMCksICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICB9KGUsIHQsIG4pKSB8fCAoT2JqZWN0KHkubG9nRXJyb3IpKHIoJ0Jhbm5lciBiaWRzIHJlcXVpcmUgYSB3aWR0aCBhbmQgaGVpZ2h0JykpLCAhMSkgOiAoT2JqZWN0KHkubG9nRXJyb3IpKHIoJ1ZpZGVvIGJpZCBkb2VzIG5vdCBoYXZlIHJlcXVpcmVkIHZhc3RVcmwgb3IgcmVuZGVyZXIgcHJvcGVydHknKSksICExKSA6IChPYmplY3QoeS5sb2dFcnJvcikocignTmF0aXZlIGJpZCBtaXNzaW5nIHNvbWUgcmVxdWlyZWQgcHJvcGVydGllcy4nKSksICExKSA6IChPYmplY3QoeS5sb2dFcnJvcikocignQmlkZGVyICcuY29uY2F0KHQuYmlkZGVyQ29kZSwgJyBpcyBtaXNzaW5nIHJlcXVpcmVkIHBhcmFtcy4gQ2hlY2sgaHR0cDovL3ByZWJpZC5vcmcvZGV2LWRvY3MvYmlkZGVyLWFkYXB0ZXItMS5odG1sIGZvciBsaXN0IG9mIHBhcmFtcy4nKSkpLCAhMSkpIDogKE9iamVjdCh5LmxvZ1dhcm4pKCdTb21lIGFkYXB0ZXIgdHJpZWQgdG8gYWRkIGFuIHVuZGVmaW5lZCBiaWQgZm9yICcuY29uY2F0KGUsICcuJykpLCAhMSkgOiAoT2JqZWN0KHkubG9nV2FybikoJ05vIGFkVW5pdENvZGUgd2FzIHN1cHBsaWVkIHRvIGFkZEJpZFJlc3BvbnNlLicpLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBPYmplY3QobS5hKSgnY2hlY2tBZFVuaXRTZXR1cCcpLmJlZm9yZShSKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTA6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAociA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChuLCByKSAmJiAoZVtyXSA9IG5bcl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0pLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgaSA9IG4oMCksIG8gPSBuKDUpLCBhID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLCBjID0gQXJyYXkucHJvdG90eXBlLnB1c2gsIHUgPSBpLl9tYXAoby5FVkVOVFMsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0pLCBzID0gby5FVkVOVF9JRF9QQVRIUywgZCA9IFtdOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0ge30sIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaS5sb2dNZXNzYWdlKCdFbWl0dGluZyBldmVudCBmb3I6ICcgKyB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuWzBdIHx8IHt9LCBvID0gcltzW3RdXSwgYSA9IGVbdF0gfHwgeyBxdWU6IFtdIH0sIHUgPSBpLl9tYXAoYSwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBmID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGQucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudFR5cGU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGFwc2VkVGltZTogaS5nZXRQZXJmb3JtYW5jZU5vdygpCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvICYmIGkuY29udGFpbnModSwgbykgJiYgYy5hcHBseShmLCBhW29dLnF1ZSksIGMuYXBwbHkoZiwgYS5xdWUpLCBpLl9lYWNoKGYsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmFwcGx5KG51bGwsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5sb2dFcnJvcignRXJyb3IgZXhlY3V0aW5nIGhhbmRsZXI6JywgJ2V2ZW50cy5qcycsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lm9uID0gZnVuY3Rpb24gKHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuY29udGFpbnModSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGVbdF0gfHwgeyBxdWU6IFtdIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByID8gKG9bcl0gPSBvW3JdIHx8IHsgcXVlOiBbXSB9LCBvW3JdLnF1ZS5wdXNoKG4pKSA6IG8ucXVlLnB1c2gobiksIGVbdF0gPSBvOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkubG9nRXJyb3IoJ1dyb25nIGV2ZW50IG5hbWUgOiAnICsgdCArICcgVmFsaWQgZXZlbnQgbmFtZXMgOicgKyB1KTsKICAgICAgICAgICAgICAgICAgICB9LCB0LmVtaXQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEuY2FsbChhcmd1bWVudHMsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICBuKGUsIHQpOwogICAgICAgICAgICAgICAgICAgIH0sIHQub2ZmID0gZnVuY3Rpb24gKHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICBpLmlzRW1wdHkobykgfHwgaS5pc0VtcHR5KG8ucXVlKSAmJiBpLmlzRW1wdHkob1tyXSkgfHwgciAmJiAoaS5pc0VtcHR5KG9bcl0pIHx8IGkuaXNFbXB0eShvW3JdLnF1ZSkpIHx8IChyID8gaS5fZWFjaChvW3JdLnF1ZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gb1tyXS5xdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID09PSBuICYmIHQuc3BsaWNlKHQuaW5kZXhPZihlKSwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogaS5fZWFjaChvLnF1ZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gby5xdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID09PSBuICYmIHQuc3BsaWNlKHQuaW5kZXhPZihlKSwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlW3RdID0gbyk7CiAgICAgICAgICAgICAgICAgICAgfSwgdC5nZXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIHQuZ2V0RXZlbnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5fZWFjaChkLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSByKHt9LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgdDsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTAwOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdC5hID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZS5sYWJlbEFsbCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsQWxsOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsczogZS5sYWJlbEFsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGl2ZUxhYmVsczogdAogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsQWxsOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWxzOiBlLmxhYmVsQW55LAogICAgICAgICAgICAgICAgICAgICAgICBhY3RpdmVMYWJlbHM6IHQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgdC5jID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDogdSwgbiA9IHModCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFuLnNob3VsZEZpbHRlcikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIW4uc2l6ZXNTdXBwb3J0ZWRbZV07CiAgICAgICAgICAgICAgICB9LCB0LmIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6IHt9LCB0ID0gZS5sYWJlbHMsIG4gPSB2b2lkIDAgPT09IHQgPyBbXSA6IHQsIHIgPSBlLmxhYmVsQWxsLCBvID0gdm9pZCAwICE9PSByICYmIHIsIGMgPSBlLmFjdGl2ZUxhYmVscywgZCA9IHZvaWQgMCA9PT0gYyA/IFtdIDogYywgZiA9IGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwLCBsID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgPyBhcmd1bWVudHNbMl0gOiB2b2lkIDAsIHAgPSBhcmd1bWVudHMubGVuZ3RoID4gMyAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1szXSA/IGFyZ3VtZW50c1szXSA6IHUsIGcgPSBzKHApOwogICAgICAgICAgICAgICAgICAgIGYgPSBPYmplY3QoaS5pc1BsYWluT2JqZWN0KShmKSA/IE9iamVjdChpLmRlZXBDbG9uZSkoZikgOiBsID8geyBiYW5uZXI6IHsgc2l6ZXM6IGwgfSB9IDoge307CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBPYmplY3QoaS5kZWVwQWNjZXNzKShmLCAnYmFubmVyLnNpemVzJyk7CiAgICAgICAgICAgICAgICAgICAgZy5zaG91bGRGaWx0ZXIgJiYgYiAmJiAoZi5iYW5uZXIuc2l6ZXMgPSBiLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5zaXplc1N1cHBvcnRlZFtlXTsKICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSBPYmplY3Qua2V5cyhmKSwgeSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGl2ZTogdi5ldmVyeShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYmFubmVyJyAhPT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIHx8IHYuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYmFubmVyJyA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pICYmIE9iamVjdChpLmRlZXBBY2Nlc3MpKGYsICdiYW5uZXIuc2l6ZXMubGVuZ3RoJykgPiAwICYmICgwID09PSBuLmxlbmd0aCB8fCAhbyAmJiAobi5zb21lKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcubGFiZWxzW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgfHwgbi5zb21lKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoKShkLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSB8fCBvICYmIG4ucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPyBnLmxhYmVsc1t0XSB8fCBhKCkoZCwgdCkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhVHlwZXM6IGYKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBiICYmIGIubGVuZ3RoICE9PSBmLmJhbm5lci5zaXplcy5sZW5ndGggJiYgKHkuZmlsdGVyUmVzdWx0cyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYmVmb3JlOiBiLAogICAgICAgICAgICAgICAgICAgICAgICBhZnRlcjogZi5iYW5uZXIuc2l6ZXMKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMyksIGkgPSBuKDApLCBvID0gbigxMiksIGEgPSBuLm4obyk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGMgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGUuY29uc3RydWN0b3IgPT09IFN5bWJvbCAmJiBlICE9PSBTeW1ib2wucHJvdG90eXBlID8gJ3N5bWJvbCcgOiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9KShlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciB1ID0gW107CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09PSBjKHQpICYmICdzdHJpbmcnID09IHR5cGVvZiB0Lm1lZGlhUXVlcnkgJiYgdC5tZWRpYVF1ZXJ5Lmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBPYmplY3QoaS5nZXRXaW5kb3dUb3ApKCkubWF0Y2hNZWRpYSh0Lm1lZGlhUXVlcnkpLm1hdGNoZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nV2FybikoJ1VuZnJpZW5kbHkgaUZyYW1lIGJsb2NrcyBzaXplQ29uZmlnIGZyb20gYmVpbmcgY29ycmVjdGx5IGV2YWx1YXRlZCcpLCBuID0gbWF0Y2hNZWRpYSh0Lm1lZGlhUXVlcnkpLm1hdGNoZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIChBcnJheS5pc0FycmF5KHQuc2l6ZXNTdXBwb3J0ZWQpICYmIChlLnNob3VsZEZpbHRlciA9ICEwKSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsYWJlbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzaXplc1N1cHBvcnRlZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAodFtuXSB8fCBbXSkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtuXVt0XSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChpLmxvZ1dhcm4pKCdzaXplQ29uZmlnIHJ1bGUgbWlzc2luZyByZXF1aXJlZCBwcm9wZXJ0eSAibWVkaWFRdWVyeSInKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgICAgICBsYWJlbHM6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICBzaXplc1N1cHBvcnRlZDoge30sCiAgICAgICAgICAgICAgICAgICAgICAgIHNob3VsZEZpbHRlcjogITEKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHIuYi5nZXRDb25maWcoJ3NpemVDb25maWcnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB1ID0gZTsKICAgICAgICAgICAgICAgICAgICB9KGUuc2l6ZUNvbmZpZyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTAxOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdC5iID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHsgcHV0czogZS5tYXAoYSwgbikgfTsKICAgICAgICAgICAgICAgICAgICBPYmplY3Qoci5hKShpLmIuZ2V0Q29uZmlnKCdjYWNoZS51cmwnKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IEpTT04ucGFyc2UodCkucmVzcG9uc2VzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgZSh0LCBbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPyBlKG51bGwsIG4pIDogZShuZXcgRXJyb3IoJ1RoZSBjYWNoZSBzZXJ2ZXIgZGlkblwndCByZXNwb25kIHdpdGggYSByZXNwb25zZXMgcHJvcGVydHkuJyksIFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKG5ldyBFcnJvcignRXJyb3Igc3RvcmluZyB2aWRlbyBhZCBpbiB0aGUgY2FjaGU6ICcuY29uY2F0KHQsICc6ICcpLmNvbmNhdChKU09OLnN0cmluZ2lmeShuKSkpLCBbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSh0KSwgSlNPTi5zdHJpbmdpZnkobyksIHsKICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFR5cGU6ICd0ZXh0L3BsYWluJywKICAgICAgICAgICAgICAgICAgICAgICAgd2l0aENyZWRlbnRpYWxzOiAhMAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgdC5hID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJycuY29uY2F0KGkuYi5nZXRDb25maWcoJ2NhY2hlLnVybCcpLCAnP3V1aWQ9JykuY29uY2F0KGUpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHZhciByID0gbig0KSwgaSA9IG4oMyksIG8gPSBuKDApOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIsIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAneG1sJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLnZhc3RYbWwgPyBlLnZhc3RYbWwgOiAodCA9IGUudmFzdFVybCwgbiA9IGUudmFzdEltcFVybCwgciA9IG4gPyAnPCFbQ0RBVEFbJy5jb25jYXQobiwgJ11dPicpIDogJycsICc8VkFTVCB2ZXJzaW9uPSIzLjAiPlxuICAgIDxBZD5cbiAgICAgIDxXcmFwcGVyPlxuICAgICAgICA8QWRTeXN0ZW0+cHJlYmlkLm9yZyB3cmFwcGVyPC9BZFN5c3RlbT5cbiAgICAgICAgPFZBU1RBZFRhZ1VSST48IVtDREFUQVsnLmNvbmNhdCh0LCAnXV0+PC9WQVNUQWRUYWdVUkk+XG4gICAgICAgIDxJbXByZXNzaW9uPicpLmNvbmNhdChyLCAnPC9JbXByZXNzaW9uPlxuICAgICAgICA8Q3JlYXRpdmVzPjwvQ3JlYXRpdmVzPlxuICAgICAgPC9XcmFwcGVyPlxuICAgIDwvQWQ+XG4gIDwvVkFTVD4nKSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dGxzZWNvbmRzOiBOdW1iZXIoZS50dGwpCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuYi5nZXRDb25maWcoJ2NhY2hlLnZhc3R0cmFjaycpICYmIChhLmJpZGRlciA9IGUuYmlkZGVyLCBhLmJpZGlkID0gZS5yZXF1ZXN0SWQsIGEuYWlkID0gZS5hdWN0aW9uSWQsIE9iamVjdChvLmlzUGxhaW5PYmplY3QpKHRoaXMpICYmIHRoaXMuaGFzT3duUHJvcGVydHkoJ2F1Y3Rpb25TdGFydCcpICYmIChhLnRpbWVzdGFtcCA9IHRoaXMuYXVjdGlvblN0YXJ0KSksICdzdHJpbmcnID09IHR5cGVvZiBlLmN1c3RvbUNhY2hlS2V5ICYmICcnICE9PSBlLmN1c3RvbUNhY2hlS2V5ICYmIChhLmtleSA9IGUuY3VzdG9tQ2FjaGVLZXkpLCBhOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICAxMDU6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDEwNik7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNTUpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gcignQXJyYXknLCAnZmluZCcpOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxMDY6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpLCBpID0gbig2MykuZmluZCwgbyA9IG4oNTQpLCBhID0gJ2ZpbmQnLCBjID0gITA7CiAgICAgICAgICAgICAgICBhIGluIFtdICYmIEFycmF5KDEpLmZpbmQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGMgPSAhMTsKICAgICAgICAgICAgICAgIH0pLCByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdBcnJheScsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogYwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGZpbmQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKHRoaXMsIGUsIGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgbyhhKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTA3OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDMzKSwgaSA9IG4oMTA4KSwgbyA9IG4oNDQpLCBhID0gbig0OSksIGMgPSBuKDYyKSwgdSA9IG4oMzEpLCBzID0gbig4NCksIGQgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOwogICAgICAgICAgICAgICAgdC5mID0gciA/IGQgOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChlID0gYShlKSwgdCA9IGModCwgITApLCBzKQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICh1KGUsIHQpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyghaS5mLmNhbGwoZSwgdCksIGVbdF0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTA4OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB7fS5wcm9wZXJ0eUlzRW51bWVyYWJsZSwgaSA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IsIG8gPSBpICYmICFyLmNhbGwoeyAxOiAyIH0sIDEpOwogICAgICAgICAgICAgICAgdC5mID0gbyA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpKHRoaXMsIGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXQgJiYgdC5lbnVtZXJhYmxlOwogICAgICAgICAgICAgICAgfSA6IHI7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDEwOTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyOSksIGkgPSAvI3xcLnByb3RvdHlwZVwuLywgbyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gY1thKGUpXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPT0gcyB8fCBuICE9IHUgJiYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIHQgPyByKHQpIDogISF0KTsKICAgICAgICAgICAgICAgICAgICB9LCBhID0gby5ub3JtYWxpemUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gU3RyaW5nKGUpLnJlcGxhY2UoaSwgJy4nKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgIH0sIGMgPSBvLmRhdGEgPSB7fSwgdSA9IG8uTkFUSVZFID0gJ04nLCBzID0gby5QT0xZRklMTCA9ICdQJzsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDExOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEwNSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxMTA6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzApLCBpID0gbigxMTEpLCBvID0gbigyMykoJ3NwZWNpZXMnKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoZSkgJiYgKCdmdW5jdGlvbicgIT0gdHlwZW9mIChuID0gZS5jb25zdHJ1Y3RvcikgfHwgbiAhPT0gQXJyYXkgJiYgIWkobi5wcm90b3R5cGUpID8gcihuKSAmJiBudWxsID09PSAobiA9IG5bb10pICYmIChuID0gdm9pZCAwKSA6IG4gPSB2b2lkIDApLCBuZXcgKHZvaWQgMCA9PT0gbiA/IEFycmF5IDogbikoMCA9PT0gdCA/IDAgOiB0KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDExMTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig1MCk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBBcnJheS5pc0FycmF5IHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdBcnJheScgPT0gcihlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDExMjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNyksIGkgPSBuKDMyKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgaShyLCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJbZV0gPSB0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDExMzogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByLCBpLCBvID0gbigyNyksIGEgPSBuKDExNCksIGMgPSBvLnByb2Nlc3MsIHUgPSBjICYmIGMudmVyc2lvbnMsIHMgPSB1ICYmIHUudjg7CiAgICAgICAgICAgICAgICBzID8gaSA9IChyID0gcy5zcGxpdCgnLicpKVswXSA8IDQgPyAxIDogclswXSArIHJbMV0gOiBhICYmICghKHIgPSBhLm1hdGNoKC9FZGdlXC8oXGQrKS8pKSB8fCByWzFdID49IDc0KSAmJiAociA9IGEubWF0Y2goL0Nocm9tZVwvKFxkKykvKSkgJiYgKGkgPSByWzFdKSwgZS5leHBvcnRzID0gaSAmJiAraTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTE0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI2KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIoJ25hdmlnYXRvcicsICd1c2VyQWdlbnQnKSB8fCAnJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTE1OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDg3KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIgJiYgIVN5bWJvbC5zaGFtICYmICdzeW1ib2wnID09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3I7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDExNjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTE3KTsKICAgICAgICAgICAgICAgIHZhciByID0gbig1NSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByKCdBcnJheScsICdpbmNsdWRlcycpOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxMTc6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpLCBpID0gbig4OCkuaW5jbHVkZXMsIG8gPSBuKDU0KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ0FycmF5JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBpbmNsdWRlczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkodGhpcywgZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pLCBvKCdpbmNsdWRlcycpOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxMTg6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNjQpLCBpID0gTWF0aC5tYXgsIG8gPSBNYXRoLm1pbjsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSByKGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuIDwgMCA/IGkobiArIHQsIDApIDogbyhuLCB0KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDExOTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTIwKSwgbigxMzUpLCBuKDk4KSwgbigxMzcpOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDQ1KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIuU2V0OwogICAgICAgICAgICB9LAogICAgICAgICAgICAxMjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMTYpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTIwOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEyMSksIGkgPSBuKDEyNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByKCdTZXQnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHRoaXMsIGFyZ3VtZW50cy5sZW5ndGggPyBhcmd1bWVudHNbMF0gOiB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTIxOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgaSA9IG4oMjcpLCBvID0gbig5MCksIGEgPSBuKDI5KSwgYyA9IG4oMzIpLCB1ID0gbigyMSksIHMgPSBuKDY4KSwgZCA9IG4oMzApLCBmID0gbig1OSksIGwgPSBuKDM0KS5mLCBwID0gbig2MykuZm9yRWFjaCwgZyA9IG4oMzMpLCBiID0gbig0NiksIHYgPSBiLnNldCwgeSA9IGIuZ2V0dGVyRm9yOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiwgaCA9IC0xICE9PSBlLmluZGV4T2YoJ01hcCcpLCBtID0gLTEgIT09IGUuaW5kZXhPZignV2VhaycpLCBPID0gaCA/ICdzZXQnIDogJ2FkZCcsIGogPSBpW2VdLCBTID0gaiAmJiBqLnByb3RvdHlwZSwgRSA9IHt9OwogICAgICAgICAgICAgICAgICAgIGlmIChnICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGogJiYgKG0gfHwgUy5mb3JFYWNoICYmICFhKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBqKCkuZW50cmllcygpLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSB0KGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2KHModCwgYiwgZSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbGxlY3Rpb246IG5ldyBqKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBudWxsICE9IG4gJiYgdShuLCB0W09dLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhhdDogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBU19FTlRSSUVTOiBoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBBID0geShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWRkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjbGVhcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGVsZXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmb3JFYWNoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2hhcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdrZXlzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2YWx1ZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VudHJpZXMnCiAgICAgICAgICAgICAgICAgICAgICAgIF0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICdhZGQnID09IGUgfHwgJ3NldCcgPT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICEoZSBpbiBTKSB8fCBtICYmICdjbGVhcicgPT0gZSB8fCBjKGIucHJvdG90eXBlLCBlLCBmdW5jdGlvbiAobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gQSh0aGlzKS5jb2xsZWN0aW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdCAmJiBtICYmICFkKG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2dldCcgPT0gZSAmJiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBpW2VdKDAgPT09IG4gPyAwIDogbiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPyB0aGlzIDogbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgbSB8fCBsKGIucHJvdG90eXBlLCAnc2l6ZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh0aGlzKS5jb2xsZWN0aW9uLnNpemU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBiID0gbi5nZXRDb25zdHJ1Y3Rvcih0LCBlLCBoLCBPKSwgby5SRVFVSVJFRCA9ICEwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmKGIsIGUsICExLCAhMCksIEVbZV0gPSBiLCByKHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2xvYmFsOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhMAogICAgICAgICAgICAgICAgICAgIH0sIEUpLCBtIHx8IG4uc2V0U3Ryb25nKGIsIGUsIGgpLCBiOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTIyOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI5KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9ICFyKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmlzRXh0ZW5zaWJsZShPYmplY3QucHJldmVudEV4dGVuc2lvbnMoe30pKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxMjM6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNjcpLCBpID0gbig1OCk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByID8ge30udG9TdHJpbmcgOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0ICcgKyBpKHRoaXMpICsgJ10nOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTI0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI3KSwgaSA9IG4oMTI1KSwgbyA9IHIuV2Vha01hcDsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIG8gJiYgL25hdGl2ZSBjb2RlLy50ZXN0KGkobykpOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxMjU6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNjUpLCBpID0gRnVuY3Rpb24udG9TdHJpbmc7CiAgICAgICAgICAgICAgICAnZnVuY3Rpb24nICE9IHR5cGVvZiByLmluc3BlY3RTb3VyY2UgJiYgKHIuaW5zcGVjdFNvdXJjZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuY2FsbChlKTsKICAgICAgICAgICAgICAgIH0pLCBlLmV4cG9ydHMgPSByLmluc3BlY3RTb3VyY2U7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDEyNjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigzNCkuZiwgaSA9IG4oNzApLCBvID0gbig5NCksIGEgPSBuKDI1KSwgYyA9IG4oNjgpLCB1ID0gbigyMSksIHMgPSBuKDcyKSwgZCA9IG4oMTM0KSwgZiA9IG4oMzMpLCBsID0gbig5MCkuZmFzdEtleSwgcCA9IG4oNDYpLCBnID0gcC5zZXQsIGIgPSBwLmdldHRlckZvcjsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBnZXRDb25zdHJ1Y3RvcjogZnVuY3Rpb24gKGUsIHQsIG4sIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBlKGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhlLCBkLCB0KSwgZyhlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiBpKG51bGwpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdDogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0OiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6IDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZiB8fCAoZS5zaXplID0gMCksIG51bGwgIT0gciAmJiB1KHIsIGVbc10sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhhdDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVNfRU5UUklFUzogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHAgPSBiKHQpLCB2ID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgaSwgbyA9IHAoZSksIGEgPSB5KGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhID8gYS52YWx1ZSA9IG4gOiAoby5sYXN0ID0gYSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IGkgPSBsKHQsICEwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJldmlvdXM6IHIgPSBvLmxhc3QsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlZDogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLmZpcnN0IHx8IChvLmZpcnN0ID0gYSksIHIgJiYgKHIubmV4dCA9IGEpLCBmID8gby5zaXplKysgOiBlLnNpemUrKywgJ0YnICE9PSBpICYmIChvLmluZGV4W2ldID0gYSkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIgPSBwKGUpLCBpID0gbCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ0YnICE9PSBpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5pbmRleFtpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSByLmZpcnN0OyBuOyBuID0gbi5uZXh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5rZXkgPT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZC5wcm90b3R5cGUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHAodGhpcyksIHQgPSBlLmluZGV4LCBuID0gZS5maXJzdDsgbjspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucmVtb3ZlZCA9ICEwLCBuLnByZXZpb3VzICYmIChuLnByZXZpb3VzID0gbi5wcmV2aW91cy5uZXh0ID0gdm9pZCAwKSwgZGVsZXRlIHRbbi5pbmRleF0sIG4gPSBuLm5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5maXJzdCA9IGUubGFzdCA9IHZvaWQgMCwgZiA/IGUuc2l6ZSA9IDAgOiB0aGlzLnNpemUgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMsIG4gPSBwKHQpLCByID0geSh0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHIubmV4dCwgbyA9IHIucHJldmlvdXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBuLmluZGV4W3IuaW5kZXhdLCByLnJlbW92ZWQgPSAhMCwgbyAmJiAoby5uZXh0ID0gaSksIGkgJiYgKGkucHJldmlvdXMgPSBvKSwgbi5maXJzdCA9PSByICYmIChuLmZpcnN0ID0gaSksIG4ubGFzdCA9PSByICYmIChuLmxhc3QgPSBvKSwgZiA/IG4uc2l6ZS0tIDogdC5zaXplLS07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yRWFjaDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0LCBuID0gcCh0aGlzKSwgciA9IGEoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpOyB0ID0gdCA/IHQubmV4dCA6IG4uZmlyc3Q7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIodC52YWx1ZSwgdC5rZXksIHRoaXMpOyB0ICYmIHQucmVtb3ZlZDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gdC5wcmV2aW91czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEheSh0aGlzLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIG8oZC5wcm90b3R5cGUsIG4gPyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB5KHRoaXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIHQudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2KHRoaXMsIDAgPT09IGUgPyAwIDogZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYodGhpcywgZSA9IDAgPT09IGUgPyAwIDogZSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBmICYmIHIoZC5wcm90b3R5cGUsICdzaXplJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAodGhpcykuc2l6ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIGQ7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBzZXRTdHJvbmc6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdCArICcgSXRlcmF0b3InLCBpID0gYih0KSwgbyA9IGIocik7CiAgICAgICAgICAgICAgICAgICAgICAgIHMoZSwgdCwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcodGhpcywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiBpKGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtpbmQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdDogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IG8odGhpcyksIHQgPSBlLmtpbmQsIG4gPSBlLmxhc3Q7IG4gJiYgbi5yZW1vdmVkOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbi5wcmV2aW91czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRhcmdldCAmJiAoZS5sYXN0ID0gbiA9IG4gPyBuLm5leHQgOiBlLnN0YXRlLmZpcnN0KSA/ICdrZXlzJyA9PSB0ID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBuLmtleSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6ICd2YWx1ZXMnID09IHQgPyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4udmFsdWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5rZXksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4udmFsdWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogKGUudGFyZ2V0ID0gdm9pZCAwLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4gPyAnZW50cmllcycgOiAndmFsdWVzJywgIW4sICEwKSwgZCh0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAxMjc6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzMpLCBpID0gbigzNCksIG8gPSBuKDE3KSwgYSA9IG4oMTI4KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyA6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgbyhlKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuLCByID0gYSh0KSwgYyA9IHIubGVuZ3RoLCB1ID0gMDsgYyA+IHU7KQogICAgICAgICAgICAgICAgICAgICAgICBpLmYoZSwgbiA9IHJbdSsrXSwgdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAxMjg6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTI5KSwgaSA9IG4oOTMpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gT2JqZWN0LmtleXMgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihlLCBpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDEyOTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzMSksIGkgPSBuKDQ5KSwgbyA9IG4oODgpLmluZGV4T2YsIGEgPSBuKDU2KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGMgPSBpKGUpLCB1ID0gMCwgcyA9IFtdOwogICAgICAgICAgICAgICAgICAgIGZvciAobiBpbiBjKQogICAgICAgICAgICAgICAgICAgICAgICAhcihhLCBuKSAmJiByKGMsIG4pICYmIHMucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgdC5sZW5ndGggPiB1OykKICAgICAgICAgICAgICAgICAgICAgICAgcihjLCBuID0gdFt1KytdKSAmJiAofm8ocywgbikgfHwgcy5wdXNoKG4pKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gczsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDEzOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdC5hID0gdSwgdC5jID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISghZSB8fCAhZS51cmwpOwogICAgICAgICAgICAgICAgfSwgdC5iID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBlLnJlbmRlcih0KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzUpLCBpID0gbigwKSwgbyA9IG4oMTEpLCBhID0gbi5uKG8pLCBjID0gJ291dHN0cmVhbSc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMsIG4gPSBlLnVybCwgbyA9IGUuY29uZmlnLCBhID0gZS5pZCwgdSA9IGUuY2FsbGJhY2ssIGQgPSBlLmxvYWRlZCwgZiA9IGUuYWRVbml0Q29kZTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnVybCA9IG4sIHRoaXMuY29uZmlnID0gbywgdGhpcy5oYW5kbGVycyA9IHt9LCB0aGlzLmlkID0gYSwgdGhpcy5sb2FkZWQgPSBkLCB0aGlzLmNtZCA9IFtdLCB0aGlzLnB1c2ggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiBlID8gdC5sb2FkZWQgPyBlLmNhbGwoKSA6IHQuY21kLnB1c2goZSkgOiBPYmplY3QoaS5sb2dFcnJvcikoJ0NvbW1hbmRzIGdpdmVuIHRvIFJlbmRlcmVyLnB1c2ggbXVzdCBiZSB3cmFwcGVkIGluIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLmNhbGxiYWNrID0gdSB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQubG9hZGVkID0gITAsIHQucHJvY2VzcygpOwogICAgICAgICAgICAgICAgICAgIH0sIHRoaXMucmVuZGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMsIHQgPSBhcmd1bWVudHMsIG8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fcmVuZGVyID8gZS5fcmVuZGVyLmFwcGx5KGUsIHQpIDogT2JqZWN0KGkubG9nV2FybikoJ05vIHJlbmRlciBmdW5jdGlvbiB3YXMgcHJvdmlkZWQsIHBsZWFzZSB1c2UgLnNldFJlbmRlciBvbiB0aGUgcmVuZGVyZXInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHMoZikgPyAoT2JqZWN0KGkubG9nV2FybikoJ0V4dGVybmFsIEpzIG5vdCBsb2FkZWQgYnkgUmVuZGVyZXIgc2luY2UgcmVuZGVyZXIgdXJsIGFuZCBjYWxsYmFjayBpcyBhbHJlYWR5IGRlZmluZWQgb24gYWRVbml0ICcuY29uY2F0KGYpKSwgbygpKSA6ICh0aGlzLmNtZC51bnNoaWZ0KG8pLCBPYmplY3Qoci5hKShuLCBjLCB0aGlzLmNhbGxiYWNrKSk7CiAgICAgICAgICAgICAgICAgICAgfS5iaW5kKHRoaXMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBwYmpzLmFkVW5pdHMsIG4gPSBhKCkodCwgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmNvZGUgPT09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGlmICghbikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0KGkuZGVlcEFjY2VzcykobiwgJ3JlbmRlcmVyJyksIG8gPSAhIShyICYmIHIudXJsICYmIHIucmVuZGVyKSwgYyA9IE9iamVjdChpLmRlZXBBY2Nlc3MpKG4sICdtZWRpYVR5cGVzLnZpZGVvLnJlbmRlcmVyJyksIHUgPSAhIShjICYmIGMudXJsICYmIGMucmVuZGVyKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISEobyAmJiAhMCAhPT0gci5iYWNrdXBPbmx5IHx8IHUgJiYgITAgIT09IGMuYmFja3VwT25seSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB1Lmluc3RhbGwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgdSh7CiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogZS51cmwsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZzogZS5jb25maWcsCiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBlLmlkLAogICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogZS5jYWxsYmFjaywKICAgICAgICAgICAgICAgICAgICAgICAgbG9hZGVkOiBlLmxvYWRlZCwKICAgICAgICAgICAgICAgICAgICAgICAgYWRVbml0Q29kZTogZS5hZFVuaXRDb2RlCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCB1LnByb3RvdHlwZS5nZXRDb25maWcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29uZmlnOwogICAgICAgICAgICAgICAgfSwgdS5wcm90b3R5cGUuc2V0UmVuZGVyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLl9yZW5kZXIgPSBlOwogICAgICAgICAgICAgICAgfSwgdS5wcm90b3R5cGUuc2V0RXZlbnRIYW5kbGVycyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oYW5kbGVycyA9IGU7CiAgICAgICAgICAgICAgICB9LCB1LnByb3RvdHlwZS5oYW5kbGVWaWRlb0V2ZW50ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuaWQsIG4gPSBlLmV2ZW50TmFtZTsKICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiB0aGlzLmhhbmRsZXJzW25dICYmIHRoaXMuaGFuZGxlcnNbbl0oKSwgT2JqZWN0KGkubG9nTWVzc2FnZSkoJ1ByZWJpZCBSZW5kZXJlciBldmVudCBmb3IgaWQgJy5jb25jYXQodCwgJyB0eXBlICcpLmNvbmNhdChuKSk7CiAgICAgICAgICAgICAgICB9LCB1LnByb3RvdHlwZS5wcm9jZXNzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZvciAoOyB0aGlzLmNtZC5sZW5ndGggPiAwOykKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY21kLnNoaWZ0KCkuY2FsbCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5sb2dFcnJvcikoJ0Vycm9yIHByb2Nlc3NpbmcgUmVuZGVyZXIgY29tbWFuZDogJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDEzMDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByKCdkb2N1bWVudCcsICdkb2N1bWVudEVsZW1lbnQnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTMxOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI5KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9ICFyKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuY29uc3RydWN0b3IgPSBudWxsLCBPYmplY3QuZ2V0UHJvdG90eXBlT2YobmV3IGUoKSkgIT09IGUucHJvdG90eXBlOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDEzMjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNyksIGkgPSBuKDEzMyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgKCdfX3Byb3RvX18nIGluIHt9ID8gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlLCB0ID0gITEsIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAoZSA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoT2JqZWN0LnByb3RvdHlwZSwgJ19fcHJvdG9fXycpLnNldCkuY2FsbChuLCBbXSksIHQgPSBuIGluc3RhbmNlb2YgQXJyYXk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIobiksIGkobyksIHQgPyBlLmNhbGwobiwgbykgOiBuLl9fcHJvdG9fXyA9IG8sIG47CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKSA6IHZvaWQgMCk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDEzMzogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzMCk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghcihlKSAmJiBudWxsICE9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ0NhblwndCBzZXQgJyArIFN0cmluZyhlKSArICcgYXMgYSBwcm90b3R5cGUnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDEzNDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNiksIGkgPSBuKDM0KSwgbyA9IG4oMjMpLCBhID0gbigzMyksIGMgPSBvKCdzcGVjaWVzJyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcihlKSwgbiA9IGkuZjsKICAgICAgICAgICAgICAgICAgICBhICYmIHQgJiYgIXRbY10gJiYgbih0LCBjLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDEzNTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTM2OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDY0KSwgaSA9IG4oNTEpLCBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbywgYSwgYyA9IFN0cmluZyhpKHQpKSwgdSA9IHIobiksIHMgPSBjLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1IDwgMCB8fCB1ID49IHMgPyBlID8gJycgOiB2b2lkIDAgOiAobyA9IGMuY2hhckNvZGVBdCh1KSkgPCA1NTI5NiB8fCBvID4gNTYzMTkgfHwgdSArIDEgPT09IHMgfHwgKGEgPSBjLmNoYXJDb2RlQXQodSArIDEpKSA8IDU2MzIwIHx8IGEgPiA1NzM0MyA/IGUgPyBjLmNoYXJBdCh1KSA6IG8gOiBlID8gYy5zbGljZSh1LCB1ICsgMikgOiBhIC0gNTYzMjAgKyAobyAtIDU1Mjk2IDw8IDEwKSArIDY1NTM2OwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgY29kZUF0OiBvKCExKSwKICAgICAgICAgICAgICAgICAgICBjaGFyQXQ6IG8oITApCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAxMzc6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDk5KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMzgpLCBpID0gbigyNyksIG8gPSBuKDU4KSwgYSA9IG4oMzIpLCBjID0gbig0MSksIHUgPSBuKDIzKSgndG9TdHJpbmdUYWcnKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIHMgaW4gcikgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gaVtzXSwgZiA9IGQgJiYgZC5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICAgICAgZiAmJiBvKGYpICE9PSB1ICYmIGEoZiwgdSwgcyksIGNbc10gPSBjLkFycmF5OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICAxMzg6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgQ1NTUnVsZUxpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgQ1NTU3R5bGVEZWNsYXJhdGlvbjogMCwKICAgICAgICAgICAgICAgICAgICBDU1NWYWx1ZUxpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgQ2xpZW50UmVjdExpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgRE9NUmVjdExpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgRE9NU3RyaW5nTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBET01Ub2tlbkxpc3Q6IDEsCiAgICAgICAgICAgICAgICAgICAgRGF0YVRyYW5zZmVySXRlbUxpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgRmlsZUxpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgSFRNTEFsbENvbGxlY3Rpb246IDAsCiAgICAgICAgICAgICAgICAgICAgSFRNTENvbGxlY3Rpb246IDAsCiAgICAgICAgICAgICAgICAgICAgSFRNTEZvcm1FbGVtZW50OiAwLAogICAgICAgICAgICAgICAgICAgIEhUTUxTZWxlY3RFbGVtZW50OiAwLAogICAgICAgICAgICAgICAgICAgIE1lZGlhTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBNaW1lVHlwZUFycmF5OiAwLAogICAgICAgICAgICAgICAgICAgIE5hbWVkTm9kZU1hcDogMCwKICAgICAgICAgICAgICAgICAgICBOb2RlTGlzdDogMSwKICAgICAgICAgICAgICAgICAgICBQYWludFJlcXVlc3RMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIFBsdWdpbjogMCwKICAgICAgICAgICAgICAgICAgICBQbHVnaW5BcnJheTogMCwKICAgICAgICAgICAgICAgICAgICBTVkdMZW5ndGhMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIFNWR051bWJlckxpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgU1ZHUGF0aFNlZ0xpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgU1ZHUG9pbnRMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIFNWR1N0cmluZ0xpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgU1ZHVHJhbnNmb3JtTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBTb3VyY2VCdWZmZXJMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIFN0eWxlU2hlZXRMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIFRleHRUcmFja0N1ZUxpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgVGV4dFRyYWNrTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBUb3VjaExpc3Q6IDAKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDEzOTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTYpKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwCiAgICAgICAgICAgICAgICB9LCB7IGZyb206IG4oMTQwKSB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB0LmEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5wYmpzOwogICAgICAgICAgICAgICAgfSwgd2luZG93LnBianMgPSB3aW5kb3cucGJqcyB8fCB7fSwgd2luZG93LnBianMuY21kID0gd2luZG93LnBianMuY21kIHx8IFtdLCB3aW5kb3cucGJqcy5xdWUgPSB3aW5kb3cucGJqcy5xdWUgfHwgW10sIHdpbmRvdy5fcGJqc0dsb2JhbHMgPSB3aW5kb3cuX3BianNHbG9iYWxzIHx8IFtdLCB3aW5kb3cuX3BianNHbG9iYWxzLnB1c2goJ3BianMnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTQwOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI0KSwgaSA9IG4oMjUpLCBvID0gbigyMSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBhLCBjLCB1ID0gYXJndW1lbnRzLmxlbmd0aCwgcyA9IHUgPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByKHRoaXMpLCAodCA9IHZvaWQgMCAhPT0gcykgJiYgcihzKSwgbnVsbCA9PSBlID8gbmV3IHRoaXMoKSA6IChuID0gW10sIHQgPyAoYSA9IDAsIGMgPSBpKHMsIHUgPiAyID8gYXJndW1lbnRzWzJdIDogdm9pZCAwLCAyKSwgbyhlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBuLnB1c2goYyhlLCBhKyspKTsKICAgICAgICAgICAgICAgICAgICB9KSkgOiBvKGUsIG4ucHVzaCwgeyB0aGF0OiBuIH0pLCBuZXcgdGhpcyhuKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAxNDE6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDE2KSh7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMAogICAgICAgICAgICAgICAgfSwgeyBvZjogbigxNDIpIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxNDI6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGgsIHQgPSBuZXcgQXJyYXkoZSk7IGUtLTspCiAgICAgICAgICAgICAgICAgICAgICAgIHRbZV0gPSBhcmd1bWVudHNbZV07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB0aGlzKHQpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTQzOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgaSA9IG4oMTgpLCBvID0gbigxNDQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBpCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgYWRkQWxsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE0NDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNyksIGkgPSBuKDI0KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gcih0aGlzKSwgdCA9IGkoZS5hZGQpLCBuID0gMCwgbyA9IGFyZ3VtZW50cy5sZW5ndGg7IG4gPCBvOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHQuY2FsbChlLCBhcmd1bWVudHNbbl0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTQ1OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgaSA9IG4oMTgpLCBvID0gbigxNDYpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBpCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlQWxsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE0NjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNyksIGkgPSBuKDI0KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlLCB0ID0gcih0aGlzKSwgbiA9IGkodC5kZWxldGUpLCBvID0gITAsIGEgPSAwLCBjID0gYXJndW1lbnRzLmxlbmd0aDsgYSA8IGM7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IG4uY2FsbCh0LCBhcmd1bWVudHNbYV0pLCBvID0gbyAmJiBlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIW87CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAxNDc6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpLCBpID0gbigxOCksIG8gPSBuKDE3KSwgYSA9IG4oMjUpLCBjID0gbigzOCksIHUgPSBuKDIxKTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogaQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGV2ZXJ5OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG8odGhpcyksIG4gPSBjKHQpLCByID0gYShlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhdShuLCBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyKGUsIGUsIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElTX0lURVJBVE9SOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElOVEVSUlVQVEVEOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KS5zdG9wcGVkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxNDg6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpLCBpID0gbigxOCksIG8gPSBuKDI2KSwgYSA9IG4oMTcpLCBjID0gbigyNCksIHUgPSBuKDQyKSwgcyA9IG4oMjEpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBpCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZGlmZmVyZW5jZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhKHRoaXMpLCBuID0gbmV3ICh1KHQsIG8oJ1NldCcpKSkodCksIHIgPSBjKG4uZGVsZXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbChuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE0OTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIGkgPSBuKDE4KSwgbyA9IG4oMjYpLCBhID0gbigxNyksIGMgPSBuKDI0KSwgdSA9IG4oMjUpLCBzID0gbig0MiksIGQgPSBuKDM4KSwgZiA9IG4oMjEpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBpCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZmlsdGVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEodGhpcyksIG4gPSBkKHQpLCByID0gdShlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyksIGkgPSBuZXcgKHModCwgbygnU2V0JykpKSgpLCBsID0gYyhpLmFkZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmKG4sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByKGUsIGUsIHQpICYmIGwuY2FsbChpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgeyBJU19JVEVSQVRPUjogITAgfSksIGk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE1MDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIGkgPSBuKDE4KSwgbyA9IG4oMTcpLCBhID0gbigyNSksIGMgPSBuKDM4KSwgdSA9IG4oMjEpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBpCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZmluZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBvKHRoaXMpLCBuID0gYyh0KSwgciA9IGEoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShuLCBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIoZSwgZSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElTX0lURVJBVE9SOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElOVEVSUlVQVEVEOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KS5yZXN1bHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE1MTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIGkgPSBuKDE4KSwgbyA9IG4oMjYpLCBhID0gbigxNyksIGMgPSBuKDI0KSwgdSA9IG4oNDIpLCBzID0gbigyMSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IGkKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBpbnRlcnNlY3Rpb246IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYSh0aGlzKSwgbiA9IG5ldyAodSh0LCBvKCdTZXQnKSkpKCksIHIgPSBjKHQuaGFzKSwgaSA9IGMobi5hZGQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyhlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgci5jYWxsKHQsIGUpICYmIGkuY2FsbChuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE1MjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIGkgPSBuKDE4KSwgbyA9IG4oMTcpLCBhID0gbigyNCksIGMgPSBuKDIxKTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogaQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGlzRGlzam9pbnRGcm9tOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG8odGhpcyksIG4gPSBhKHQuaGFzKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFjKGUsIGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoITAgPT09IG4uY2FsbCh0LCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7IElOVEVSUlVQVEVEOiAhMCB9KS5zdG9wcGVkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxNTM6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpLCBpID0gbigxOCksIG8gPSBuKDI2KSwgYSA9IG4oMTcpLCBjID0gbigyNCksIHUgPSBuKDczKSwgcyA9IG4oMjEpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBpCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgaXNTdWJzZXRPZjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB1KHRoaXMpLCBuID0gYShlKSwgciA9IG4uaGFzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgciAmJiAobiA9IG5ldyAobygnU2V0JykpKGUpLCByID0gYyhuLmhhcykpLCAhcyh0LCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCExID09PSByLmNhbGwobiwgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSU5URVJSVVBURUQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnN0b3BwZWQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE1NDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIGkgPSBuKDE4KSwgbyA9IG4oMTcpLCBhID0gbigyNCksIGMgPSBuKDIxKTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogaQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGlzU3VwZXJzZXRPZjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBvKHRoaXMpLCBuID0gYSh0Lmhhcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhYyhlLCBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCExID09PSBuLmNhbGwodCwgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgeyBJTlRFUlJVUFRFRDogITAgfSkuc3RvcHBlZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTU1OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgaSA9IG4oMTgpLCBvID0gbigxNyksIGEgPSBuKDM4KSwgYyA9IG4oMjEpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBpCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgam9pbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBvKHRoaXMpLCBuID0gYSh0KSwgciA9IHZvaWQgMCA9PT0gZSA/ICcsJyA6IFN0cmluZyhlKSwgaSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyhuLCBpLnB1c2gsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoYXQ6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkuam9pbihyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTU2OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgaSA9IG4oMTgpLCBvID0gbigyNiksIGEgPSBuKDE3KSwgYyA9IG4oMjQpLCB1ID0gbigyNSksIHMgPSBuKDQyKSwgZCA9IG4oMzgpLCBmID0gbigyMSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IGkKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBtYXA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYSh0aGlzKSwgbiA9IGQodCksIHIgPSB1KGUsIGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwLCAzKSwgaSA9IG5ldyAocyh0LCBvKCdTZXQnKSkpKCksIGwgPSBjKGkuYWRkKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYobiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwuY2FsbChpLCByKGUsIGUsIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgeyBJU19JVEVSQVRPUjogITAgfSksIGk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE1NzogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIGkgPSBuKDE4KSwgbyA9IG4oMTcpLCBhID0gbigyNCksIGMgPSBuKDM4KSwgdSA9IG4oMjEpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBpCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgcmVkdWNlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG8odGhpcyksIG4gPSBjKHQpLCByID0gYXJndW1lbnRzLmxlbmd0aCA8IDIsIGkgPSByID8gdm9pZCAwIDogYXJndW1lbnRzWzFdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYShlKSwgdShuLCBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPyAociA9ICExLCBpID0gbikgOiBpID0gZShpLCBuLCBuLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsgSVNfSVRFUkFUT1I6ICEwIH0pLCByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKCdSZWR1Y2Ugb2YgZW1wdHkgc2V0IHdpdGggbm8gaW5pdGlhbCB2YWx1ZScpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTU4OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgaSA9IG4oMTgpLCBvID0gbigxNyksIGEgPSBuKDI1KSwgYyA9IG4oMzgpLCB1ID0gbigyMSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IGkKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBzb21lOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG8odGhpcyksIG4gPSBjKHQpLCByID0gYShlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1KG4sIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocihlLCBlLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbigpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTlRFUlJVUFRFRDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSkuc3RvcHBlZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTU5OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgaSA9IG4oMTgpLCBvID0gbigyNiksIGEgPSBuKDE3KSwgYyA9IG4oMjQpLCB1ID0gbig0MiksIHMgPSBuKDIxKTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogaQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHN5bW1ldHJpY0RpZmZlcmVuY2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYSh0aGlzKSwgbiA9IG5ldyAodSh0LCBvKCdTZXQnKSkpKHQpLCByID0gYyhuLmRlbGV0ZSksIGkgPSBjKG4uYWRkKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbChuLCBlKSB8fCBpLmNhbGwobiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxNjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNyksIGkgPSBuKDEwNykuZiwgbyA9IG4oMTA5KSwgYSA9IG4oNDUpLCBjID0gbigyNSksIHUgPSBuKDMyKSwgcyA9IG4oMzEpLCBkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBmdW5jdGlvbiAodCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMgaW5zdGFuY2VvZiBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChhcmd1bWVudHMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgZSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBlKHQsIG4sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucHJvdG90eXBlID0gZS5wcm90b3R5cGUsIHQ7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGYsIGwsIHAsIGcsIGIsIHYsIHksIGggPSBlLnRhcmdldCwgbSA9IGUuZ2xvYmFsLCBPID0gZS5zdGF0LCBqID0gZS5wcm90bywgUyA9IG0gPyByIDogTyA/IHJbaF0gOiAocltoXSB8fCB7fSkucHJvdG90eXBlLCBFID0gbSA/IGEgOiBhW2hdIHx8IChhW2hdID0ge30pLCBBID0gRS5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICAgICAgZm9yIChsIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAhbyhtID8gbCA6IGggKyAoTyA/ICcuJyA6ICcjJykgKyBsLCBlLmZvcmNlZCkgJiYgUyAmJiBzKFMsIGwpLCBnID0gRVtsXSwgbiAmJiAoYiA9IGUubm9UYXJnZXRHZXQgPyAoeSA9IGkoUywgbCkpICYmIHkudmFsdWUgOiBTW2xdKSwgcCA9IG4gJiYgYiA/IGIgOiB0W2xdLCBuICYmIHR5cGVvZiBnID09IHR5cGVvZiBwIHx8ICh2ID0gZS5iaW5kICYmIG4gPyBjKHAsIHIpIDogZS53cmFwICYmIG4gPyBkKHApIDogaiAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBwID8gYyhGdW5jdGlvbi5jYWxsLCBwKSA6IHAsIChlLnNoYW0gfHwgcCAmJiBwLnNoYW0gfHwgZyAmJiBnLnNoYW0pICYmIHUodiwgJ3NoYW0nLCAhMCksIEVbbF0gPSB2LCBqICYmIChzKGEsIGYgPSBoICsgJ1Byb3RvdHlwZScpIHx8IHUoYSwgZiwge30pLCBhW2ZdW2xdID0gcCwgZS5yZWFsICYmIEEgJiYgIUFbbF0gJiYgdShBLCBsLCBwKSkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTYwOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgaSA9IG4oMTgpLCBvID0gbigyNiksIGEgPSBuKDE3KSwgYyA9IG4oMjQpLCB1ID0gbig0MiksIHMgPSBuKDIxKTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogaQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHVuaW9uOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEodGhpcyksIG4gPSBuZXcgKHUodCwgbygnU2V0JykpKSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMoZSwgYyhuLmFkZCksIHsgdGhhdDogbiB9KSwgbjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTYxOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbig5OCksIG4oMTYyKTsKICAgICAgICAgICAgICAgIHZhciByID0gbig0NSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByLkFycmF5LmZyb207CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE2MjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIGkgPSBuKDE2Myk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdBcnJheScsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhbigxNjYpKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5LmZyb20oZSk7CiAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgIH0sIHsgZnJvbTogaSB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTYzOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI1KSwgaSA9IG4oNTIpLCBvID0gbigxNjQpLCBhID0gbig5MSksIGMgPSBuKDUzKSwgdSA9IG4oMTY1KSwgcyA9IG4oNTcpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgZCwgZiwgbCwgcCwgZyA9IGkoZSksIGIgPSAnZnVuY3Rpb24nID09IHR5cGVvZiB0aGlzID8gdGhpcyA6IEFycmF5LCB2ID0gYXJndW1lbnRzLmxlbmd0aCwgeSA9IHYgPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwLCBoID0gdm9pZCAwICE9PSB5LCBtID0gcyhnKSwgTyA9IDA7CiAgICAgICAgICAgICAgICAgICAgaWYgKGggJiYgKHkgPSByKHksIHYgPiAyID8gYXJndW1lbnRzWzJdIDogdm9pZCAwLCAyKSksIG51bGwgPT0gbSB8fCBiID09IEFycmF5ICYmIGEobSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IG5ldyBiKHQgPSBjKGcubGVuZ3RoKSk7IHQgPiBPOyBPKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwID0gaCA/IHkoZ1tPXSwgTykgOiBnW09dLCB1KG4sIE8sIHApOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsID0gKGYgPSBtLmNhbGwoZykpLm5leHQsIG4gPSBuZXcgYigpOyAhKGQgPSBsLmNhbGwoZikpLmRvbmU7IE8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAgPSBoID8gbyhmLCB5LCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC52YWx1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCAhMCkgOiBkLnZhbHVlLCB1KG4sIE8sIHApOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmxlbmd0aCA9IE8sIG47CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAxNjQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTcpLCBpID0gbig5Mik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbiwgbykgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvID8gdChyKG4pWzBdLCBuWzFdKSA6IHQobik7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBpKGUpLCB0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE2NTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbig2MiksIGkgPSBuKDM0KSwgbyA9IG4oNDQpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHIodCk7CiAgICAgICAgICAgICAgICAgICAgYSBpbiBlID8gaS5mKGUsIGEsIG8oMCwgbikpIDogZVthXSA9IG47CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAxNjY6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMjMpKCdpdGVyYXRvcicpLCBpID0gITE7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHZhciBvID0gMCwgYSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geyBkb25lOiAhIW8rKyB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBhW3JdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9LCBBcnJheS5mcm9tKGEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgMjsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCF0ICYmICFpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAhMTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBvW3JdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7IGRvbmU6IG4gPSAhMCB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUobyk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE2NzogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gQXJyYXkuaXNBcnJheSh0KSA/IFtdIDoge307CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdFtyXTsKICAgICAgICAgICAgICAgICAgICAgICAgbltyXSA9IGkgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGkgPyBlKGkpIDogaTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAxNjg6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB0LmEgPSBmdW5jdGlvbiAoZSwgdCwgbiwgciwgaSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodCA9IHQuc3BsaXQgPyB0LnNwbGl0KCcuJykgOiB0LCByID0gMDsgciA8IHQubGVuZ3RoOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlID8gZVt0W3JdXSA6IGk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IGkgPyBuIDogZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDE2OTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHQuYSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdC5zcGxpdCAmJiAodCA9IHQuc3BsaXQoJy4nKSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciwgaSA9IDAsIG8gPSB0Lmxlbmd0aCwgYSA9IGU7IGkgPCBvOyArK2kpCiAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBhW3RbaV1dLCBhID0gYVt0W2ldXSA9IGkgPT09IG8gLSAxID8gbiA6IG51bGwgIT0gciA/IHIgOiAhfnRbaSArIDFdLmluZGV4T2YoJy4nKSAmJiArdFtpICsgMV0gPiAtMSA/IFtdIDoge307CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAxNzogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzMCk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghcihlKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKFN0cmluZyhlKSArICcgaXMgbm90IGFuIG9iamVjdCcpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMTcwOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgYy5TWU5DID0gMSwgYy5BU1lOQyA9IDIsIGMuUVVFVUUgPSA0OwogICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QuZnJlZXplKHsKICAgICAgICAgICAgICAgICAgICAgICAgdXNlUHJveHk6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICByZWFkeTogMAogICAgICAgICAgICAgICAgICAgIH0pLCByID0gbmV3IFdlYWtNYXAoKSwgaSA9ICcyLDEsMCcgPT09IFsxXS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgIH0sIDIpLnRvU3RyaW5nKCkgPyBBcnJheS5wcm90b3R5cGUucmVkdWNlIDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIgPSBPYmplY3QodGhpcyksIGkgPSByLmxlbmd0aCA+Pj4gMCwgbyA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IG8gPCBpICYmICEobyBpbiByKTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbysrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHJbbysrXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbyA8IGk7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbyBpbiByICYmIChuID0gZShuLCByW29dLCBvLCByKSksIG8rKzsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChlLCB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBhID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBpLmNhbGwobyhhcmd1bWVudHMsIDEpLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiBPYmplY3Qua2V5cyh0KS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW25dID0gdFtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIHUgPSB7fSwgcyA9IFtdOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZSA/IGcuY2FsbChudWxsLCAnc3luYycsIGUsIHQpIDogJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCA/IGcuYXBwbHkobnVsbCwgYXJndW1lbnRzKSA6ICdvYmplY3QnID09IHR5cGVvZiBlID8gZi5hcHBseShudWxsLCBhcmd1bWVudHMpIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSB0ICYmICh0ID0gT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXMoZSksIHIgPSAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0ge30sIG8gPSBbJ2NvbnN0cnVjdG9yJ107CiAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICh0ID0gdC5maWx0ZXIoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISgnZnVuY3Rpb24nICE9IHR5cGVvZiBlW3RdIHx8IC0xICE9PSBvLmluZGV4T2YodCkgfHwgdC5tYXRjaCgvXl8vKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC5zcGxpdCgnOicpLCBvID0gclswXSwgYSA9IHJbMV0gfHwgJ3N5bmMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaVtvXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGVbb107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlbb10gPSBlW29dID0gZyhhLCBjLCBuID8gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSA6IHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGUgPSBPYmplY3QuZ2V0UHJvdG90eXBlT2YoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKHIgJiYgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBBcnJheS5pc0FycmF5KGUpID8gZSA6IGUuc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuY2FsbChuLCBmdW5jdGlvbiAociwgaSwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSByW2ldLCBjID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSB8fCAobyA9PT0gbi5sZW5ndGggLSAxID8gKHQgfHwgcy5wdXNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjIHx8IGNvbnNvbGUud2FybignZnVuLWhvb2tzOiByZWZlcmVuY2VkIFwnJyArIGUgKyAnXCcgYnV0IGl0IHdhcyBuZXZlciBjcmVhdGVkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgcltpXSA9IHAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByW2ldID0gZSwgYyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIDogcltpXSA9IHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdLCBuID0gW10sIGkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlZm9yZTogZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUuY2FsbCh0aGlzLCB0LCAnYmVmb3JlJywgZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZnRlcjogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUuY2FsbCh0aGlzLCBuLCAnYWZ0ZXInLCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEhvb2tzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQuY29uY2F0KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb2JqZWN0JyA9PSB0eXBlb2YgZSAmJiAociA9IHIuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSkuZXZlcnkoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtuXSA9PT0gZVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKHIsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5yZW1vdmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoJ2Vycm9yIGFkZGluZyBgcmVtb3ZlYCB0byBhcnJheSwgZGlkIHlvdSBtb2RpZnkgQXJyYXkucHJvdG90eXBlPycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlQWxsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldEhvb2tzKCkucmVtb3ZlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnN0YWxsOiBmdW5jdGlvbiAociwgbywgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnR5cGUgPSByLCBpID0gYSwgYSh0LCBuKSwgZSAmJiBlKG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLnNldChvLmFmdGVyLCBjKSwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlLCByLCBvLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBob29rOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpb3JpdHk6IGEgfHwgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5pbmRleE9mKGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMSAhPT0gciAmJiAoZS5zcGxpY2UociwgMSksIGkodCwgbikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wdXNoKGMpLCBlLnNvcnQoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5wcmlvcml0eSAtIGUucHJpb3JpdHk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaSh0LCBuKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnKG4sIGksIHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBpLmFmdGVyICYmIHIuZ2V0KGkuYWZ0ZXIpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQudHlwZSAhPT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAnZnVuLWhvb2tzOiByZWNyZWF0ZWQgaG9va2FibGUgd2l0aCBkaWZmZXJlbnQgdHlwZSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiwgZywgYiA9IHUgPyBsKHUpIDogcCgpLCB2ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJbdF0gfHwgUmVmbGVjdC5nZXQuYXBwbHkoUmVmbGVjdCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCB8fCBzLnB1c2goeSksIGUudXNlUHJveHkgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgUHJveHkgJiYgUHJveHkucmV2b2NhYmxlID8gZyA9IG5ldyBQcm94eShpLCB2KSA6IGEoZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2LmFwcGx5ID8gdi5hcHBseShpLCB0aGlzLCBvKGFyZ3VtZW50cykpIDogaS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBiKSwgci5nZXQoZy5hZnRlcikuaW5zdGFsbChuLCBnLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIGkgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubGVuZ3RoIHx8IHQubGVuZ3RoID8gKGUuZm9yRWFjaChhKSwgciA9IGkucHVzaCh2b2lkIDApIC0gMSwgdC5mb3JFYWNoKGEpLCBmID0gZnVuY3Rpb24gKGUsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYywgdSA9IDAsIHMgPSAnYXN5bmMnID09PSBuICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGFbYS5sZW5ndGggLSAxXSAmJiBhLnBvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3luYycgPT09IG4gPyBjID0gZSA6IHMgJiYgcy5hcHBseShudWxsLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlbdV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbyhhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYuYmFpbCA9IGQsIHIudW5zaGlmdChmKSwgaVt1KytdLmFwcGx5KHQsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzeW5jJyA9PT0gbiA/IGMgPSBlIDogcyAmJiBzLmFwcGx5KG51bGwsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpW3JdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG8oYXJndW1lbnRzLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FzeW5jJyA9PT0gbiAmJiBzICYmIChkZWxldGUgZi5iYWlsLCByLnB1c2goZikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUuYXBwbHkodCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzeW5jJyA9PT0gbiAmJiBmKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGYuYXBwbHkobnVsbCwgYSksIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGYgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnB1c2goZS5ob29rKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGc7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHkoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAhdCAmJiAoJ3N5bmMnICE9PSBuIHx8IGUucmVhZHkgJiBjLlNZTkMpICYmICgnYXN5bmMnICE9PSBuIHx8IGUucmVhZHkgJiBjLkFTWU5DKSA/ICdzeW5jJyAhPT0gbiAmJiBlLnJlYWR5ICYgYy5RVUVVRSA/IHYuYXBwbHkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5wdXNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5hcHBseShlWzFdLCBlWzJdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiB2LmFwcGx5ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93ICdmdW4taG9va3M6IGhvb2tlZCBmdW5jdGlvbiBub3QgcmVhZHknOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IHYuYXBwbHkgPSBmOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IGEoe30sIG4sIGUpKS5yZWFkeSA/IGQucmVhZHkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAhMCwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQ7IHQgPSBlLnNoaWZ0KCk7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfShzKTsKICAgICAgICAgICAgICAgICAgICB9IDogdCA9ICEwLCBkLmdldCA9IGwsIGQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBjOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxODogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9ICEwOwogICAgICAgICAgICB9LAogICAgICAgICAgICAxOTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIG4uZCh0LCAnYScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDMpLCBpID0gbigwKTsKICAgICAgICAgICAgICAgIHZhciBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSByLmIuZ2V0Q29uZmlnKCdwYWdlVXJsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUucXVlcnlTZWxlY3RvcignbGlua1tyZWw9XCdjYW5vbmljYWxcJ10nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmhyZWY7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIG8sIGEsIGMgPSBbXSwgdSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlLmxvY2F0aW9uLmFuY2VzdG9yT3JpZ2lucykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubG9jYXRpb24uYW5jZXN0b3JPcmlnaW5zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUpLCBzID0gci5iLmdldENvbmZpZygnbWF4TmVzdGVkSWZyYW1lcycpLCBkID0gITEsIGYgPSAwLCBsID0gITEsIHAgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBuLCBiID0gcCwgdiA9IHZvaWQgMCwgeSA9ICExLCBoID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAgPSAhMSwgbiA9IG4gPyBuLnBhcmVudCA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYgPSBuLmxvY2F0aW9uLmhyZWYgfHwgbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5ID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IGcuY29udGV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBoID0gbS5zb3VyY2VVcmwsIGwgPSAhMCwgbiA9PT0gZS50b3AgJiYgKGQgPSAhMCksIG0uY2Fub25pY2FsVXJsICYmIChhID0gbS5jYW5vbmljYWxVcmwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5sb2dXYXJuKSgnVHJ5aW5nIHRvIGFjY2VzcyBjcm9zcyBkb21haW4gaWZyYW1lLiBDb250aW51aW5nIHdpdGhvdXQgcmVmZXJyZXIgYW5kIGxvY2F0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgTyA9IGcuZG9jdW1lbnQucmVmZXJyZXI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPICYmIChoID0gTywgbiA9PT0gZS50b3AgJiYgKGQgPSAhMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWggJiYgdSAmJiB1W2YgLSAxXSAmJiAoaCA9IHVbZiAtIDFdKSwgaCAmJiAhbCAmJiAobyA9IGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2ICYmIChvID0gaCA9IHYsIGwgPSAhMSwgbiA9PT0gZS50b3ApKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGogPSB0KG4uZG9jdW1lbnQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqICYmIChhID0gaik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uY29udGV4dCAmJiBuLmNvbnRleHQuc291cmNlVXJsICYmIChwID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5wdXNoKGgpLCBmKys7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKG4gIT09IGUudG9wICYmIGYgPCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMucmV2ZXJzZSgpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZlcmVyOiBvIHx8IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFjaGVkVG9wOiBkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNBbXA6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudW1JZnJhbWVzOiBmIC0gMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrOiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2Fub25pY2FsVXJsOiBhIHx8IG51bGwKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSh3aW5kb3cpOwogICAgICAgICAgICB9LAogICAgICAgICAgICAyOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgbi5kKHQsICdjJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgfSksIG4uZCh0LCAnZCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgICAgICAgIH0pLCBuLmQodCwgJ2InLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICB9KSwgbi5kKHQsICdhJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9ICduYXRpdmUnLCBpID0gJ3ZpZGVvJywgbyA9ICdiYW5uZXInLCBhID0gJ2FkcG9kJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMjA6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBuLmQodCwgJ2InLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9KSwgbi5kKHQsICdhJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB1OwogICAgICAgICAgICAgICAgfSksIHQuZCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3Qoci5nZXRCaWRSZXF1ZXN0KShlLnJlcXVlc3RJZCwgdCksIGkgPSBuICYmIE9iamVjdChyLmRlZXBBY2Nlc3MpKG4sICdtZWRpYVR5cGVzLnZpZGVvJyksIG8gPSBpICYmIE9iamVjdChyLmRlZXBBY2Nlc3MpKGksICdjb250ZXh0Jyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMoZSwgbiwgaSwgbyk7CiAgICAgICAgICAgICAgICB9LCBuLmQodCwgJ2MnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHM7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIG4oOCk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMCksIGkgPSBuKDMpLCBvID0gbigxMiksIGEgPSAobi5uKG8pLCBuKDkpKSwgYyA9ICdvdXRzdHJlYW0nLCB1ID0gJ2luc3RyZWFtJzsKICAgICAgICAgICAgICAgIHZhciBzID0gT2JqZWN0KGEuYikoJ3N5bmMnLCBmdW5jdGlvbiAoZSwgdCwgbiwgbykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhdCB8fCBuICYmIG8gIT09IGMgPyBpLmIuZ2V0Q29uZmlnKCdjYWNoZS51cmwnKSB8fCAhZS52YXN0WG1sIHx8IGUudmFzdFVybCA/ICEoIWUudmFzdFVybCAmJiAhZS52YXN0WG1sKSA6IChPYmplY3Qoci5sb2dFcnJvcikoJ1xuICAgICAgICBUaGlzIGJpZCBjb250YWlucyBvbmx5IHZhc3RYbWwgYW5kIHdpbGwgbm90IHdvcmsgd2hlbiBhIHByZWJpZCBjYWNoZSB1cmwgaXMgbm90IHNwZWNpZmllZC5cbiAgICAgICAgVHJ5IGVuYWJsaW5nIHByZWJpZCBjYWNoZSB3aXRoIHBianMuc2V0Q29uZmlnKHsgY2FjaGU6IHt1cmw6ICIuLi4ifSB9KTtcbiAgICAgICcpLCAhMSkgOiBvICE9PSBjIHx8ICEhKGUucmVuZGVyZXIgfHwgdC5yZW5kZXJlciB8fCBuLnJlbmRlcmVyKTsKICAgICAgICAgICAgICAgIH0sICdjaGVja1ZpZGVvQmlkU2V0dXAnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMjE6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTcpLCBpID0gbig5MSksIG8gPSBuKDUzKSwgYSA9IG4oMjUpLCBjID0gbig1NyksIHUgPSBuKDkyKSwgcyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RvcHBlZCA9IGUsIHRoaXMucmVzdWx0ID0gdDsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCwgZiwgbCwgcCwgZywgYiwgdiwgeSA9IG4gJiYgbi50aGF0LCBoID0gISghbiB8fCAhbi5BU19FTlRSSUVTKSwgbSA9ICEoIW4gfHwgIW4uSVNfSVRFUkFUT1IpLCBPID0gISghbiB8fCAhbi5JTlRFUlJVUFRFRCksIGogPSBhKHQsIHksIDEgKyBoICsgTyksIFMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQgJiYgdShkKSwgbmV3IHMoITAsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBFID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoID8gKHIoZSksIE8gPyBqKGVbMF0sIGVbMV0sIFMpIDogaihlWzBdLCBlWzFdKSkgOiBPID8gaihlLCBTKSA6IGooZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgaWYgKG0pCiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBlOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgKGYgPSBjKGUpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignVGFyZ2V0IGlzIG5vdCBpdGVyYWJsZScpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaShmKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsID0gMCwgcCA9IG8oZS5sZW5ndGgpOyBwID4gbDsgbCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoZyA9IEUoZVtsXSkpICYmIGcgaW5zdGFuY2VvZiBzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgcyghMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGYuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZm9yIChiID0gZC5uZXh0OyAhKHYgPSBiLmNhbGwoZCkpLmRvbmU7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gRSh2LnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgdShkKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT0gdHlwZW9mIGcgJiYgZyAmJiBnIGluc3RhbmNlb2YgcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHMoITEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMjI6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBuLmQodCwgJ2EnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHU7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigwKSwgaSA9IG4oMjgpLCBvID0gbigxMSksIGEgPSBuLm4obyksIGMgPSBuKDUpOwogICAgICAgICAgICAgICAgdmFyIHUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBbXSwgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFkZFdpbm5pbmdCaWQgPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEoKShlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZ2V0QXVjdGlvbklkKCkgPT09IHQuYXVjdGlvbklkOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgbiA/ICh0LnN0YXR1cyA9IGMuQklEX1NUQVRVUy5SRU5ERVJFRCwgbi5hZGRXaW5uaW5nQmlkKHQpKSA6IE9iamVjdChyLmxvZ1dhcm4pKCdBdWN0aW9uIG5vdCBmb3VuZCB3aGVuIGFkZGluZyB3aW5uaW5nIGJpZCcpOwogICAgICAgICAgICAgICAgICAgIH0sIHQuZ2V0QWxsV2lubmluZ0JpZHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZ2V0V2lubmluZ0JpZHMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVkdWNlKHIuZmxhdHRlbiwgW10pOwogICAgICAgICAgICAgICAgICAgIH0sIHQuZ2V0Qmlkc1JlcXVlc3RlZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5nZXRCaWRSZXF1ZXN0cygpOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5yZWR1Y2Uoci5mbGF0dGVuLCBbXSk7CiAgICAgICAgICAgICAgICAgICAgfSwgdC5nZXROb0JpZHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZ2V0Tm9CaWRzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZShyLmZsYXR0ZW4sIFtdKTsKICAgICAgICAgICAgICAgICAgICB9LCB0LmdldEJpZHNSZWNlaXZlZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5nZXRBdWN0aW9uU3RhdHVzKCkgPT09IGkuYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5nZXRCaWRzUmVjZWl2ZWQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVkdWNlKHIuZmxhdHRlbiwgW10pLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIHQuZ2V0QWxsQmlkc0ZvckFkVW5pdENvZGUgPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmdldEJpZHNSZWNlaXZlZCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5yZWR1Y2Uoci5mbGF0dGVuLCBbXSkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLmFkVW5pdENvZGUgPT09IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIHQuZ2V0QWRVbml0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5nZXRBZFVuaXRzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZShyLmZsYXR0ZW4sIFtdKTsKICAgICAgICAgICAgICAgICAgICB9LCB0LmdldEFkVW5pdENvZGVzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmdldEFkVW5pdENvZGVzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZShyLmZsYXR0ZW4sIFtdKS5maWx0ZXIoci51bmlxdWVzKTsKICAgICAgICAgICAgICAgICAgICB9LCB0LmNyZWF0ZUF1Y3Rpb24gPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuYWRVbml0cywgciA9IHQuYWRVbml0Q29kZXMsIG8gPSB0LmNhbGxiYWNrLCBhID0gdC5jYlRpbWVvdXQsIGMgPSB0LmxhYmVscywgdSA9IHQuYXVjdGlvbklkLCBzID0gT2JqZWN0KGkuaykoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkVW5pdHM6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRVbml0Q29kZXM6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2JUaW1lb3V0OiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsczogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWN0aW9uSWQ6IHUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHVzaCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfShzKSwgczsKICAgICAgICAgICAgICAgICAgICB9LCB0LmZpbmRCaWRCeUFkSWQgPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSgpKGUubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5nZXRCaWRzUmVjZWl2ZWQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVkdWNlKHIuZmxhdHRlbiwgW10pLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWRJZCA9PT0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgdC5nZXRTdGFuZGFyZEJpZGRlckFkU2VydmVyVGFyZ2V0aW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGkuaikoKVtjLkpTT05fTUFQUElORy5BRFNFUlZFUl9UQVJHRVRJTkddOwogICAgICAgICAgICAgICAgICAgIH0sIHQuc2V0U3RhdHVzRm9yQmlkcyA9IGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdC5maW5kQmlkQnlBZElkKG4pOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSAmJiAoaS5zdGF0dXMgPSByKSwgaSAmJiByID09PSBjLkJJRF9TVEFUVVMuQklEX1RBUkdFVElOR19TRVQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gYSgpKGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZ2V0QXVjdGlvbklkKCkgPT09IGkuYXVjdGlvbklkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvICYmIG8uc2V0QmlkVGFyZ2V0aW5nKGkpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgdC5nZXRMYXN0QXVjdGlvbklkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5sZW5ndGggJiYgZVtlLmxlbmd0aCAtIDFdLmdldEF1Y3Rpb25JZCgpOwogICAgICAgICAgICAgICAgICAgIH0sIHQuY2xlYXJBbGxBdWN0aW9ucyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZS5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgICAgIH0sIHQ7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDIyMDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMjIxKTsKICAgICAgICAgICAgICAgIHZhciByID0gbig1NSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByKCdBcnJheScsICdmaW5kSW5kZXgnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMjIxOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgaSA9IG4oNjMpLmZpbmRJbmRleCwgbyA9IG4oNTQpLCBhID0gJ2ZpbmRJbmRleCcsIGMgPSAhMDsKICAgICAgICAgICAgICAgIGEgaW4gW10gJiYgQXJyYXkoMSkuZmluZEluZGV4KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBjID0gITE7CiAgICAgICAgICAgICAgICB9KSwgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnQXJyYXknLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IGMKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBmaW5kSW5kZXg6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKHRoaXMsIGUsIGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgbyhhKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMjM6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMjcpLCBpID0gbig4NiksIG8gPSBuKDMxKSwgYSA9IG4oNjYpLCBjID0gbig4NyksIHUgPSBuKDExNSksIHMgPSBpKCd3a3MnKSwgZCA9IHIuU3ltYm9sLCBmID0gdSA/IGQgOiBkICYmIGQud2l0aG91dFNldHRlciB8fCBhOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhzLCBlKSAmJiAoYyB8fCAnc3RyaW5nJyA9PSB0eXBlb2Ygc1tlXSkgfHwgKGMgJiYgbyhkLCBlKSA/IHNbZV0gPSBkW2VdIDogc1tlXSA9IGYoJ1N5bWJvbC4nICsgZSkpLCBzW2VdOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMjMwOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdC5hID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgaCwgITEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMCksIGkgPSBuLm4ociksIG8gPSBuKDM5KSwgYSA9IG4oNSksIGMgPSBuLm4oYSksIHUgPSBuKDApLCBzID0gbigyMiksIGQgPSBuKDExKSwgZiA9IG4ubihkKSwgbCA9IG4oMTMpLCBwID0gbigxMiksIGcgPSBuLm4ocCksIGIgPSBuKDMpLCB2ID0gYy5hLkVWRU5UUy5CSURfV09OLCB5ID0gYy5hLkVWRU5UUy5TVEFMRV9SRU5ERVI7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBoKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubWVzc2FnZSA/ICdtZXNzYWdlJyA6ICdkYXRhJywgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBKU09OLnBhcnNlKGVbdF0pOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobiAmJiBuLmFkSWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBmKCkocy5hLmdldEJpZHNSZWNlaXZlZCgpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWRJZCA9PT0gbi5hZElkOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgJiYgJ1ByZWJpZCBSZXF1ZXN0JyA9PT0gbi5tZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5zdGF0dXMgPT09IGMuYS5CSURfU1RBVFVTLlJFTkRFUkVEICYmIChPYmplY3QodS5sb2dXYXJuKSgnQWQgaWQgJy5jb25jYXQoci5hZElkLCAnIGhhcyBiZWVuIHJlbmRlcmVkIGJlZm9yZScpKSwgaS5hLmVtaXQoeSwgciksIE9iamVjdCh1LmRlZXBBY2Nlc3MpKGIuYi5nZXRDb25maWcoJ2F1Y3Rpb25PcHRpb25zJyksICdzdXBwcmVzc1N0YWxlUmVuZGVyJykpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5hZElkLCByID0gZS5hZCwgaSA9IGUuYWRVcmwsIG8gPSBlLndpZHRoLCBhID0gZS5oZWlnaHQsIGMgPSBlLnJlbmRlcmVyLCBzID0gZS5jcG07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGwuYykoYykgPyBPYmplY3QobC5iKShjLCBlKSA6IG4gJiYgKG0oZSksIHQuc291cmNlLnBvc3RNZXNzYWdlKEpTT04uc3RyaW5naWZ5KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogJ1ByZWJpZCBSZXNwb25zZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkOiBPYmplY3QodS5yZXBsYWNlQXVjdGlvblByaWNlKShyLCBzKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRVcmw6IE9iamVjdCh1LnJlcGxhY2VBdWN0aW9uUHJpY2UpKGksIHMpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZElkOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQub3JpZ2luKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHIsIGUpLCBzLmEuYWRkV2lubmluZ0JpZChyKSwgaS5hLmVtaXQodiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgJiYgJ1ByZWJpZCBOYXRpdmUnID09PSBuLm1lc3NhZ2UpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Fzc2V0UmVxdWVzdCcgPT09IG4uYWN0aW9uKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBPYmplY3Qoby5kKShuLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNvdXJjZS5wb3N0TWVzc2FnZShKU09OLnN0cmluZ2lmeShhKSwgZS5vcmlnaW4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgnYWxsQXNzZXRSZXF1ZXN0JyA9PT0gbi5hY3Rpb24pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IE9iamVjdChvLmMpKG4sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc291cmNlLnBvc3RNZXNzYWdlKEpTT04uc3RyaW5naWZ5KGQpLCBlLm9yaWdpbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCdyZXNpemVOYXRpdmVIZWlnaHQnID09PSBuLmFjdGlvbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmhlaWdodCA9IG4uaGVpZ2h0LCByLndpZHRoID0gbi53aWR0aCwgbShyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnY2xpY2snID09PSBPYmplY3Qoby5iKShuLCByKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMuYS5hZGRXaW5uaW5nQmlkKHIpLCBpLmEuZW1pdCh2LCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBtKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuYWRJZCwgbiA9IGUuYWRVbml0Q29kZSwgciA9IGUud2lkdGgsIGkgPSBlLmhlaWdodDsKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdkaXYnLAogICAgICAgICAgICAgICAgICAgICAgICAnaWZyYW1lJwogICAgICAgICAgICAgICAgICAgIF0uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QodS5pc0dwdFB1YmFkc0RlZmluZWQpKCkgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYoKSh3aW5kb3cuZ29vZ2xldGFnLnB1YmFkcygpLmdldFNsb3RzKCksIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYoKSh0LmdldFRhcmdldGluZ0tleXMoKSwgZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcoKSh0LmdldFRhcmdldGluZyhuKSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5nZXRTbG90RWxlbWVudElkKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkgOiBPYmplY3QodS5pc0FwbkdldFRhZ0RlZmluZWQpKCkgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB3aW5kb3cuYXBudGFnLmdldFRhZyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIHQudGFyZ2V0SWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0odCkgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0odCwgbiksIGkgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpICYmIGkucXVlcnlTZWxlY3RvcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfShlICsgJzpub3QoW3N0eWxlKj0iZGlzcGxheTogbm9uZSJdKScpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBvLnN0eWxlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS53aWR0aCA9IHIgKyAncHgnLCBhLmhlaWdodCA9IGkgKyAncHgnOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdCh1LmxvZ1dhcm4pKCdVbmFibGUgdG8gbG9jYXRlIG1hdGNoaW5nIHBhZ2UgZWxlbWVudCBmb3IgYWRVbml0Q29kZSAnLmNvbmNhdChuLCAnLiAgQ2FuXCd0IHJlc2l6ZSBpdCB0byBhZFwncyBkaW1lbnNpb25zLiAgUGxlYXNlIHJldmlldyBzZXR1cC4nKSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDIzMTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHQuYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF80ZmMzMDlkYmQwYjZkOTYyID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ3Nlc3Npb25TdG9yYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfNGZjMzA5ZGJkMGI2ZDk2MikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdzZXNzaW9uU3RvcmFnZScsICRfX19tb2NrXzFjZjFlOTA3Mzg1NDZkNDAuc2Vzc2lvblN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZSB8fCB3aW5kb3cuc2Vzc2lvblN0b3JhZ2UsIHQgPSBKU09OLnBhcnNlKGUuZ2V0SXRlbSh1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIHAodCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfNGZjMzA5ZGJkMGI2ZDk2MikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdzZXNzaW9uU3RvcmFnZScsICRfX19vbGRfNGZjMzA5ZGJkMGI2ZDk2MikpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgciwgaSwgbyA9IG4oMyksIGEgPSBuKDApLCBjID0gbigyOCksIHUgPSAncGJqczpkZWJ1Z2dpbmcnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGEubG9nTWVzc2FnZSkoJ0RFQlVHOiAnICsgZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUpIHsKICAgICAgICAgICAgICAgICAgICBPYmplY3QoYS5sb2dXYXJuKSgnREVCVUc6ICcgKyBlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSkgewogICAgICAgICAgICAgICAgICAgIHIgPSB5LmJpbmQoZSksIGMuYy5iZWZvcmUociwgNSksIGkgPSBoLmJpbmQoZSksIGMuZS5iZWZvcmUoaSwgNSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKCkgewogICAgICAgICAgICAgICAgICAgIGMuYy5nZXRIb29rcyh7IGhvb2s6IHIgfSkucmVtb3ZlKCksIGMuZS5nZXRIb29rcyh7IGhvb2s6IGkgfSkucmVtb3ZlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdICYmIGFyZ3VtZW50c1sxXTsKICAgICAgICAgICAgICAgICAgICBvLmIuc2V0Q29uZmlnKHsgZGVidWc6ICEwIH0pLCBsKCksIGYoZSksIHMoJ2JpZGRlciBvdmVycmlkZXMgZW5hYmxlZCcuY29uY2F0KHQgPyAnIGZyb20gc2Vzc2lvbicgOiAnJykpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIWUuYmlkZGVyIHx8IGUuYmlkZGVyID09PSB0KSB8fCAhKCFlLmFkVW5pdENvZGUgfHwgZS5hZFVuaXRDb2RlID09PSBuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5pc0FycmF5KGUpICYmIC0xID09PSBlLmluZGV4T2YodCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSA9PT0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FkVW5pdENvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JpZGRlcicKICAgICAgICAgICAgICAgICAgICAgICAgXS5pbmRleE9mKGUpOwogICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZShmdW5jdGlvbiAodCwgcikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcygnYmlkZGVyIG92ZXJyaWRlcyBjaGFuZ2VkIFwnJy5jb25jYXQodC5hZFVuaXRDb2RlLCAnLycpLmNvbmNhdCh0LmJpZGRlckNvZGUsICdcJyAnKS5jb25jYXQobiwgJy4nKS5jb25jYXQociwgJyBmcm9tIFwnJykuY29uY2F0KHRbcl0sICcuanNcJyB0byBcJycpLmNvbmNhdChlW3JdLCAnXCcnKSksIHRbcl0gPSBlW3JdLCB0OwogICAgICAgICAgICAgICAgICAgIH0sIHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24geShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgIGIoci5iaWRkZXJzLCBuLmJpZGRlckNvZGUpID8gZCgnYmlkZGVyIFwnJy5jb25jYXQobi5iaWRkZXJDb2RlLCAnXCcgZXhjbHVkZWQgZnJvbSBhdWN0aW9uIGJ5IGJpZGRlciBvdmVycmlkZXMnKSkgOiAoQXJyYXkuaXNBcnJheShyLmJpZHMpICYmIHIuYmlkcy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGcoZSwgbi5iaWRkZXJDb2RlLCB0KSB8fCB2KGUsIG4sICdiaWRkZXInKTsKICAgICAgICAgICAgICAgICAgICB9KSwgZSh0LCBuKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBoKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMsIHIgPSB0LmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFiKG4uYmlkZGVycywgZS5iaWRkZXJDb2RlKSB8fCAoZCgnYmlkUmVxdWVzdCBcJycuY29uY2F0KGUuYmlkZGVyQ29kZSwgJ1wnIGV4Y2x1ZGVkIGZyb20gYXVjdGlvbiBieSBiaWRkZXIgb3ZlcnJpZGVzJykpLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkobi5iaWRSZXF1ZXN0cykgJiYgci5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG4uYmlkUmVxdWVzdHMuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5iaWRzLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnKHQsIGUuYmlkZGVyQ29kZSwgbi5hZFVuaXRDb2RlKSB8fCB2KHQsIG4sICdiaWRSZXF1ZXN0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSksIGUocik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBtKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZS5lbmFibGVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuc2Vzc2lvblN0b3JhZ2Uuc2V0SXRlbSh1LCBKU09OLnN0cmluZ2lmeShlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBwKGUpOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGwoKSwgcygnYmlkZGVyIG92ZXJyaWRlcyBkaXNhYmxlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LnNlc3Npb25TdG9yYWdlLnJlbW92ZUl0ZW0odSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG8uYi5nZXRDb25maWcoJ2RlYnVnZ2luZycsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0oZS5kZWJ1Z2dpbmcpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDI0OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKFN0cmluZyhlKSArICcgaXMgbm90IGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDI1OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI0KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHIoZSksIHZvaWQgMCA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY2FsbCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY2FsbCh0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY2FsbCh0LCBuLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobiwgciwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY2FsbCh0LCBuLCByLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMjY6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNDUpLCBpID0gbigyNyksIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZSA/IGUgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFyZ3VtZW50cy5sZW5ndGggPCAyID8gbyhyW2VdKSB8fCBvKGlbZV0pIDogcltlXSAmJiByW2VdW3RdIHx8IGlbZV0gJiYgaVtlXVt0XTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDI3OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLk1hdGggPT0gTWF0aCAmJiBlOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gbignb2JqZWN0JyA9PSB0eXBlb2YgZ2xvYmFsVGhpcyAmJiBnbG9iYWxUaGlzKSB8fCBuKCdvYmplY3QnID09IHR5cGVvZiB3aW5kb3cgJiYgd2luZG93KSB8fCBuKCdvYmplY3QnID09IHR5cGVvZiBzZWxmICYmIHNlbGYpIHx8IG4oJ29iamVjdCcgPT0gdHlwZW9mIHQgJiYgdCkgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9KCkgfHwgRnVuY3Rpb24oJ3JldHVybiB0aGlzJykoKTsKICAgICAgICAgICAgICAgIH0uY2FsbCh0LCBuKDM3KSkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICAyODogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIG4uZCh0LCAnYicsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRTsKICAgICAgICAgICAgICAgIH0pLCBuLmQodCwgJ2EnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEE7CiAgICAgICAgICAgICAgICB9KSwgdC5rID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgbywgYSwgcyA9IGUuYWRVbml0cywgZCA9IGUuYWRVbml0Q29kZXMsIGYgPSBlLmNhbGxiYWNrLCBwID0gZS5jYlRpbWVvdXQsIHYgPSBlLmxhYmVscywgVSA9IGUuYXVjdGlvbklkLCBrID0gcywgTiA9IHYsIFAgPSBkLCBxID0gW10sIEcgPSBbXSwgTCA9IFtdLCBXID0gVSB8fCBPYmplY3Qoci5nZW5lcmF0ZVVVSUQpKCksIEYgPSBmLCB6ID0gcCwgViA9IFtdLCBIID0gbmV3IFNldCgpOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEsoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWN0aW9uSWQ6IFcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXA6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWN0aW9uRW5kOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVjdGlvblN0YXR1czogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkVW5pdHM6IGssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZFVuaXRDb2RlczogUCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsczogTiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlclJlcXVlc3RzOiBxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9CaWRzOiBMLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkc1JlY2VpdmVkOiBHLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lubmluZ0JpZHM6IFYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lb3V0OiB6CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEooZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiBjbGVhclRpbWVvdXQoYSksIHZvaWQgMCA9PT0gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgJiYgKE9iamVjdChyLmxvZ01lc3NhZ2UpKCdBdWN0aW9uICcuY29uY2F0KFcsICcgdGltZWRPdXQnKSksIGMgPSBILCAoaSA9IHEubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlLmJpZHMgfHwgW10pLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWMuaGFzKGUuYmlkZGVyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZShyLmZsYXR0ZW4sIFtdKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRJZDogZS5iaWRJZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZGVyOiBlLmJpZGRlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRVbml0Q29kZTogZS5hZFVuaXRDb2RlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWN0aW9uSWQ6IGUuYXVjdGlvbklkCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5sZW5ndGggJiYgai5lbWl0KFMuRVZFTlRTLkJJRF9USU1FT1VULCBpKSksIG8gPSBBLCBuID0gRGF0ZS5ub3coKSwgai5lbWl0KFMuRVZFTlRTLkFVQ1RJT05fRU5ELCBLKCkpLCBfKGssIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBGKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFAsIG4gPSBHLmZpbHRlcihyLmJpbmQuY2FsbChyLmFkVW5pdHNGaWx0ZXIsIHRoaXMsIHQpKS5yZWR1Y2UoTSwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRi5hcHBseShwYmpzLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBGID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHIubG9nRXJyb3IpKCdFcnJvciBleGVjdXRpbmcgYmlkc0JhY2tIYW5kbGVyJywgbnVsbCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5sZW5ndGggJiYgTy5jYWxsVGltZWRPdXRCaWRkZXJzKHMsIGksIHopOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHUuYi5nZXRDb25maWcoJ3VzZXJTeW5jJykgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uZW5hYmxlT3ZlcnJpZGUgfHwgbShvLnN5bmNEZWxheSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFkoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHUuYi5yZXNldEJpZGRlcigpLCBPYmplY3Qoci5sb2dJbmZvKSgnQmlkcyBSZWNlaXZlZCBmb3IgQXVjdGlvbiB3aXRoIGlkOiAnLmNvbmNhdChXKSwgRyksIG8gPSBBLCBKKCExLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBILmFkZChlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gJChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBlLCBxID0gcS5jb25jYXQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHt9LCBzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZFJlcXVlc3RzOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcywgcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IEouYmluZChudWxsLCAhMCksIHAgPSBzZXRUaW1lb3V0KHMsIHopLCBhID0gcCwgbyA9IEUsIGouZW1pdChTLkVWRU5UUy5BVUNUSU9OX0lOSVQsIEsoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB2ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gMCwgbyA9ICExLCBhID0gbmV3IFNldCgpLCBzID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4tLSwgbyAmJiAwID09PSBuICYmIGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzW28ucmVxdWVzdElkXSA9ICEwLCBuKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuYWRVbml0Q29kZSwgbiA9IGUuYmlkLCBvID0gZS5iaWRkZXJSZXF1ZXN0LCBhID0gZS5hdWN0aW9uSWQsIHMgPSBvLnN0YXJ0LCBkID0gaCh7fSwgbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1Y3Rpb25JZDogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZVRpbWVzdGFtcDogT2JqZWN0KHIudGltZXN0YW1wKSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3RUaW1lc3RhbXA6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3BtOiBwYXJzZUZsb2F0KG4uY3BtKSB8fCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlcjogbi5iaWRkZXJDb2RlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkVW5pdENvZGU6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnRpbWVUb1Jlc3BvbmQgPSBkLnJlc3BvbnNlVGltZXN0YW1wIC0gZC5yZXF1ZXN0VGltZXN0YW1wLCBqLmVtaXQoUy5FVkVOVFMuQklEX0FESlVTVE1FTlQsIGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IG8uYmlkcyAmJiBsKCkoby5iaWRzLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFkVW5pdENvZGUgPT0gdCAmJiBlLmJpZElkID09IGQucmVxdWVzdElkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHAgPSBmICYmIGYucmVuZGVyZXIsIGcgPSBkLm1lZGlhVHlwZSwgYiA9IGYgJiYgZi5tZWRpYVR5cGVzICYmIGYubWVkaWFUeXBlc1tnXSwgdiA9IGIgJiYgYi5yZW5kZXJlciwgbSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYgJiYgdi51cmwgJiYgdi5yZW5kZXIgJiYgKCEwICE9PSB2LmJhY2t1cE9ubHkgfHwgIW4ucmVuZGVyZXIpID8gbSA9IHYgOiBwICYmIHAudXJsICYmIHAucmVuZGVyICYmICghMCAhPT0gcC5iYWNrdXBPbmx5IHx8ICFuLnJlbmRlcmVyKSAmJiAobSA9IHApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtICYmIChkLnJlbmRlcmVyID0gYy5hLmluc3RhbGwoeyB1cmw6IG0udXJsIH0pLCBkLnJlbmRlcmVyLnNldFJlbmRlcihtLnJlbmRlcikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgTyA9IEQobi5tZWRpYVR5cGUsIGYsIHUuYi5nZXRDb25maWcoJ21lZGlhVHlwZVByaWNlR3JhbnVsYXJpdHknKSksIEUgPSBPYmplY3QoaS5hKShkLmNwbSwgJ29iamVjdCcgPT09IHkoTykgPyBPIDogdS5iLmdldENvbmZpZygnY3VzdG9tUHJpY2VCdWNrZXQnKSwgdS5iLmdldENvbmZpZygnY3VycmVuY3kuZ3JhbnVsYXJpdHlNdWx0aXBsaWVyJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZC5wYkxnID0gRS5sb3csIGQucGJNZyA9IEUubWVkLCBkLnBiSGcgPSBFLmhpZ2gsIGQucGJBZyA9IEUuYXV0bywgZC5wYkRnID0gRS5kZW5zZSwgZC5wYkNnID0gRS5jdXN0b20sIGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkVW5pdENvZGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZDogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZGVyUmVxdWVzdDogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVjdGlvbklkOiB0LmdldEF1Y3Rpb25JZCgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZpZGVvJyA9PT0gZi5tZWRpYVR5cGUgPyBmdW5jdGlvbiAoZSwgdCwgbiwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9ICEwLCBhID0gT2JqZWN0KHIuZ2V0QmlkUmVxdWVzdCkodC5vcmlnaW5hbFJlcXVlc3RJZCB8fCB0LnJlcXVlc3RJZCwgW25dKSwgYyA9IGEgJiYgT2JqZWN0KHIuZGVlcEFjY2VzcykoYSwgJ21lZGlhVHlwZXMudmlkZW8nKSwgcyA9IGMgJiYgT2JqZWN0KHIuZGVlcEFjY2VzcykoYywgJ2NvbnRleHQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5iLmdldENvbmZpZygnY2FjaGUudXJsJykgJiYgcyAhPT0gYi5iICYmICghdC52aWRlb0NhY2hlS2V5IHx8IHUuYi5nZXRDb25maWcoJ2NhY2hlLmlnbm9yZUJpZGRlckNhY2hlS2V5JykgPyAobyA9ICExLCB4KGUsIHQsIGksIGEpKSA6IHQudmFzdFVybCB8fCAoT2JqZWN0KHIubG9nRXJyb3IpKCd2aWRlb0NhY2hlS2V5IHNwZWNpZmllZCBidXQgbm90IHJlcXVpcmVkIHZhc3RVcmwgZm9yIHZpZGVvIGJpZCcpLCBvID0gITEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyAmJiAoQihlLCB0KSwgaSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHQsIGYsIGEsIGQpIDogKEIodCwgZiksIGQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdGhpcywgYyA9IHQuZ2V0QmlkUmVxdWVzdHMoKSwgZCA9IHUuYi5nZXRDb25maWcoJ2F1Y3Rpb25PcHRpb25zJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEuYWRkKGkpLCBkICYmICFPYmplY3Qoci5pc0VtcHR5KShkKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGQuc2Vjb25kYXJ5QmlkZGVyczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiAmJiAhYy5ldmVyeShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcoKShmLCBlLmJpZGRlckNvZGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSAmJiAoYyA9IGMuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWcoKShmLCBlLmJpZGRlckNvZGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBjLmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmhhcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaS5iaWRzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc1tlLmJpZElkXSB8fCAodC5hZGROb0JpZChlKSwgai5lbWl0KFMuRVZFTlRTLk5PX0JJRCwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvICYmIDAgPT09IG4gJiYgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGRCaWRSZXNwb25zZTogZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGFwdGVyRG9uZTogcAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShZLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTy5jYWxsQmlkcyhrLCBlLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCwgdCA9IG5ldyBBcnJheShlKSwgbiA9IDA7IG4gPCBlOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtuXSA9IGFyZ3VtZW50c1tuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMuYXBwbHkoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BhdGNoOiB2LmFkZEJpZFJlc3BvbnNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlclJlcXVlc3Q6IHRoaXMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2LmFkYXB0ZXJEb25lLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYoVCwgdCksIGYobiwgZSksIElbZV0gfHwgKElbZV0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNSQTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yaWdpbjogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuW2VdID4gMSAmJiAoSVtlXS5TUkEgPSAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUW2VdLS0sIHdbMF0gJiYgZCh3WzBdKSAmJiB3LnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHosIFEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAhMCwgbiA9IHUuYi5nZXRDb25maWcoJ21heFJlcXVlc3RzUGVyT3JpZ2luJykgfHwgNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmJpZFJlcXVlc3RzLnNvbWUoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IDEsIGkgPSB2b2lkIDAgIT09IGUuc3JjICYmIGUuc3JjID09PSBTLlMyUy5TUkMgPyAnczJzJyA6IGUuYmlkZGVyQ29kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSVtpXSAmJiAoITEgPT09IElbaV0uU1JBICYmIChyID0gTWF0aC5taW4oZS5iaWRzLmxlbmd0aCwgbikpLCBUW0lbaV0ub3JpZ2luXSArIHIgPiBuICYmICh0ID0gITEpKSwgIXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdCAmJiBlLnJ1bigpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBlW3RdID8gZVt0XSA9IDEgOiBlW3RdKys7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZChzKSB8fCAoT2JqZWN0KHIubG9nV2FybikoJ3F1ZXVlaW5nIGF1Y3Rpb24gZHVlIHRvIGxpbWl0ZWQgZW5kcG9pbnQgY2FwYWNpdHknKSwgdy5wdXNoKHMpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgYWRkQmlkUmVjZWl2ZWQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBHID0gRy5jb25jYXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFkZE5vQmlkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgTCA9IEwuY29uY2F0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBleGVjdXRlQ2FsbGJhY2s6IEosCiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxCaWRzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gJ3N0YXJ0ZWQnLCB0ID0gRGF0ZS5ub3coKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gTy5tYWtlQmlkUmVxdWVzdHMoaywgdCwgVywgeiwgTik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoci5sb2dJbmZvKSgnQmlkcyBSZXF1ZXN0ZWQgZm9yIEF1Y3Rpb24gd2l0aCBpZDogJy5jb25jYXQoVyksIGUpLCBlLmxlbmd0aCA8IDEgPyAoT2JqZWN0KHIubG9nV2FybikoJ05vIHZhbGlkIGJpZCByZXF1ZXN0cyByZXR1cm5lZCBmb3IgYXVjdGlvbicpLCBZKCkpIDogUi5jYWxsKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwYXRjaDogJCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiB0aGlzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgYWRkV2lubmluZ0JpZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFYgPSBWLmNvbmNhdChlKSwgTy5jYWxsQmlkV29uQmlkZGVyKGUuYmlkZGVyLCBlLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc2V0QmlkVGFyZ2V0aW5nOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgTy5jYWxsU2V0VGFyZ2V0aW5nQmlkZGVyKGUuYmlkZGVyLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0V2lubmluZ0JpZHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBWOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBnZXRUaW1lb3V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gejsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QXVjdGlvbklkOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVzsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QXVjdGlvblN0YXR1czogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldEFkVW5pdHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBrOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBnZXRBZFVuaXRDb2RlczogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldEJpZFJlcXVlc3RzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Qmlkc1JlY2VpdmVkOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRzsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Tm9CaWRzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBuLmQodCwgJ2MnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEM7CiAgICAgICAgICAgICAgICB9KSwgbi5kKHQsICdlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBSOwogICAgICAgICAgICAgICAgfSksIHQuZyA9IFUsIHQuZCA9IEIsIG4uZCh0LCAnZicsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geDsKICAgICAgICAgICAgICAgIH0pLCBuLmQodCwgJ2knLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGs7CiAgICAgICAgICAgICAgICB9KSwgbi5kKHQsICdoJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBOOwogICAgICAgICAgICAgICAgfSksIHQuaiA9IFA7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMCksIGkgPSBuKDQ4KSwgbyA9IG4oMzkpLCBhID0gbigxMDEpLCBjID0gbigxMyksIHUgPSBuKDMpLCBzID0gbig2MCksIGQgPSBuKDkpLCBmID0gbigxMSksIGwgPSBuLm4oZiksIHAgPSBuKDEyKSwgZyA9IG4ubihwKSwgYiA9IG4oMjApLCB2ID0gbigyKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHkoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoeSA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaCgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGggPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgcikgJiYgKGVbcl0gPSBuW3JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIG0gPSBzLmEuc3luY1VzZXJzLCBPID0gbig4KS5kZWZhdWx0LCBqID0gbigxMCksIFMgPSBuKDUpLCBFID0gJ2luUHJvZ3Jlc3MnLCBBID0gJ2NvbXBsZXRlZCc7CiAgICAgICAgICAgICAgICBqLm9uKFMuRVZFTlRTLkJJRF9BREpVU1RNRU5ULCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IGUuYmlkZGVyQ29kZSwgaSA9IGUuY3BtOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAocGJqcy5iaWRkZXJTZXR0aW5ncyAmJiAobiAmJiBwYmpzLmJpZGRlclNldHRpbmdzW25dICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIHBianMuYmlkZGVyU2V0dGluZ3Nbbl0uYmlkQ3BtQWRqdXN0bWVudCA/IHQgPSBwYmpzLmJpZGRlclNldHRpbmdzW25dLmJpZENwbUFkanVzdG1lbnQgOiBwYmpzLmJpZGRlclNldHRpbmdzW1MuSlNPTl9NQVBQSU5HLkJEX1NFVFRJTkdfU1RBTkRBUkRdICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIHBianMuYmlkZGVyU2V0dGluZ3NbUy5KU09OX01BUFBJTkcuQkRfU0VUVElOR19TVEFOREFSRF0uYmlkQ3BtQWRqdXN0bWVudCAmJiAodCA9IHBianMuYmlkZGVyU2V0dGluZ3NbUy5KU09OX01BUFBJTkcuQkRfU0VUVElOR19TVEFOREFSRF0uYmlkQ3BtQWRqdXN0bWVudCksIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gdChlLmNwbSwgaCh7fSwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmxvZ0Vycm9yKSgnRXJyb3IgZHVyaW5nIGJpZCBhZGp1c3RtZW50JywgJ2JpZG1hbmFnZXIuanMnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaSA+PSAwICYmIChlLmNwbSA9IGkpOwogICAgICAgICAgICAgICAgICAgIH0oZSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciBUID0ge30sIEkgPSB7fSwgdyA9IFtdOwogICAgICAgICAgICAgICAgdmFyIEMgPSBPYmplY3QoZC5iKSgnYXN5bmMnLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoLmNhbGwodGhpcy5iaWRkZXJSZXF1ZXN0LCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9LCAnYWRkQmlkUmVzcG9uc2UnKSwgUiA9IE9iamVjdChkLmIpKCdzeW5jJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kaXNwYXRjaC5jYWxsKHRoaXMuY29udGV4dCwgZSk7CiAgICAgICAgICAgICAgICAgICAgfSwgJ2FkZEJpZGRlclJlcXVlc3RzJyksIF8gPSBPYmplY3QoZC5iKSgnYXN5bmMnLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB0ICYmIHQoKTsKICAgICAgICAgICAgICAgICAgICB9LCAnYmlkc0JhY2tDYWxsYmFjaycpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gVShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdC50aW1lVG9SZXNwb25kID4gZS5nZXRUaW1lb3V0KCkgKyB1LmIuZ2V0Q29uZmlnKCd0aW1lb3V0QnVmZmVyJykgJiYgZS5leGVjdXRlQ2FsbGJhY2soITApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmdldEJpZFJlcXVlc3RzKCksIGkgPSBsKCkobiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmJpZGRlckNvZGUgPT09IHQuYmlkZGVyQ29kZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCBpID0gT2JqZWN0KHIuaXNBbGxvd1plcm9DcG1CaWRzRW5hYmxlZCkoZS5iaWRkZXJDb2RlKSA/IGUuY3BtID49IDAgOiBlLmNwbSA+IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmJpZGRlckNvZGUgJiYgKGkgfHwgZS5kZWFsSWQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGwoKSh0LmJpZHMsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWRVbml0Q29kZSA9PT0gZS5hZFVuaXRDb2RlICYmIHQuYmlkSWQgPT09IGUucmVxdWVzdElkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHt9LCBpID0gcGJqcy5iaWRkZXJTZXR0aW5nczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxKHIsIFAodC5tZWRpYVR5cGUsIGUpLCB0LCBuKSwgZSAmJiBpW2VdICYmIGlbZV1bUy5KU09OX01BUFBJTkcuQURTRVJWRVJfVEFSR0VUSU5HXSAmJiAocShyLCBpW2VdLCB0LCBuKSwgdC5zZW5kU3RhbmRhcmRUYXJnZXRpbmcgPSBpW2VdLnNlbmRTdGFuZGFyZFRhcmdldGluZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubmF0aXZlICYmIChyID0gaCh7fSwgciwgT2JqZWN0KG8uZSkodCwgbikpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZS5iaWRkZXJDb2RlLCBlLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlLmFkc2VydmVyVGFyZ2V0aW5nID0gaChlLmFkc2VydmVyVGFyZ2V0aW5nIHx8IHt9LCBuKTsKICAgICAgICAgICAgICAgICAgICB9KHQsIGkpLCBqLmVtaXQoUy5FVkVOVFMuQklEX1JFU1BPTlNFLCB0KSwgZS5hZGRCaWRSZWNlaXZlZCh0KSwgVShlLCB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciB4ID0gT2JqZWN0KGQuYikoJ2FzeW5jJywgZnVuY3Rpb24gKGUsIHQsIG4sIGkpIHsKICAgICAgICAgICAgICAgICAgICBPYmplY3QoYS5iKShbdF0sIGZ1bmN0aW9uIChpLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGkgPyAoT2JqZWN0KHIubG9nV2FybikoJ0ZhaWxlZCB0byBzYXZlIHRvIHRoZSB2aWRlbyBjYWNoZTogJy5jb25jYXQoaSwgJy4gVmlkZW8gYmlkIG11c3QgYmUgZGlzY2FyZGVkLicpKSwgVShlLCB0KSkgOiAnJyA9PT0gb1swXS51dWlkID8gKE9iamVjdChyLmxvZ1dhcm4pKCdTdXBwbGllZCB2aWRlbyBjYWNoZSBrZXkgd2FzIGFscmVhZHkgaW4gdXNlIGJ5IFByZWJpZCBDYWNoZTsgY2FjaGluZyBhdHRlbXB0IHdhcyByZWplY3RlZC4gVmlkZW8gYmlkIG11c3QgYmUgZGlzY2FyZGVkLicpLCBVKGUsIHQpKSA6ICh0LnZpZGVvQ2FjaGVLZXkgPSBvWzBdLnV1aWQsIHQudmFzdFVybCB8fCAodC52YXN0VXJsID0gT2JqZWN0KGEuYSkodC52aWRlb0NhY2hlS2V5KSksIEIoZSwgdCksIG4oKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgaSk7CiAgICAgICAgICAgICAgICB9LCAnY2FsbFByZWJpZENhY2hlJyk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBEKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSB2LmQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gT2JqZWN0KHIuZGVlcEFjY2VzcykodCwgJ21lZGlhVHlwZXMuJy5jb25jYXQodi5kLCAnLmNvbnRleHQnKSwgJ2luc3RyZWFtJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoblsnJy5jb25jYXQodi5kLCAnLScpLmNvbmNhdChpKV0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5bJycuY29uY2F0KHYuZCwgJy0nKS5jb25jYXQoaSldOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuW2VdOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBrID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBEKGUsIHQsIHUuYi5nZXRDb25maWcoJ21lZGlhVHlwZVByaWNlR3JhbnVsYXJpdHknKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PSB0eXBlb2YgZSAmJiBuID8gJ3N0cmluZycgPT0gdHlwZW9mIG4gPyBuIDogJ2N1c3RvbScgOiB1LmIuZ2V0Q29uZmlnKCdwcmljZUdyYW51bGFyaXR5Jyk7CiAgICAgICAgICAgICAgICAgICAgfSwgTiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gZSB8fCBrKHQubWVkaWFUeXBlLCBuKSkgPT09IFMuR1JBTlVMQVJJVFlfT1BUSU9OUy5BVVRPID8gdC5wYkFnIDogZSA9PT0gUy5HUkFOVUxBUklUWV9PUFRJT05TLkRFTlNFID8gdC5wYkRnIDogZSA9PT0gUy5HUkFOVUxBUklUWV9PUFRJT05TLkxPVyA/IHQucGJMZyA6IGUgPT09IFMuR1JBTlVMQVJJVFlfT1BUSU9OUy5NRURJVU0gPyB0LnBiTWcgOiBlID09PSBTLkdSQU5VTEFSSVRZX09QVElPTlMuSElHSCA/IHQucGJIZyA6IGUgPT09IFMuR1JBTlVMQVJJVFlfT1BUSU9OUy5DVVNUT00gPyB0LnBiQ2cgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsOiAnZnVuY3Rpb24nID09IHR5cGVvZiB0ID8gZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdChlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qoci5nZXRWYWx1ZSkoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciBpID0gUy5UQVJHRVRJTkdfS0VZUywgbyA9IHBianMuYmlkZGVyU2V0dGluZ3M7CiAgICAgICAgICAgICAgICAgICAgaWYgKG9bUy5KU09OX01BUFBJTkcuQkRfU0VUVElOR19TVEFOREFSRF0gfHwgKG9bUy5KU09OX01BUFBJTkcuQkRfU0VUVElOR19TVEFOREFSRF0gPSB7fSksIG9bUy5KU09OX01BUFBJTkcuQkRfU0VUVElOR19TVEFOREFSRF1bUy5KU09OX01BUFBJTkcuQURTRVJWRVJfVEFSR0VUSU5HXSB8fCAob1tTLkpTT05fTUFQUElORy5CRF9TRVRUSU5HX1NUQU5EQVJEXVtTLkpTT05fTUFQUElORy5BRFNFUlZFUl9UQVJHRVRJTkddID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbihpLkJJRERFUiwgJ2JpZGRlckNvZGUnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4oaS5BRF9JRCwgJ2FkSWQnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4oaS5QUklDRV9CVUNLRVQsIE4oKSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGkuU0laRSwgJ3NpemUnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4oaS5ERUFMLCAnZGVhbElkJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGkuU09VUkNFLCAnc291cmNlJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGkuRk9STUFULCAnbWVkaWFUeXBlJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGkuQURPTUFJTiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5tZXRhICYmIGUubWV0YS5hZHZlcnRpc2VyRG9tYWlucyAmJiBlLm1ldGEuYWR2ZXJ0aXNlckRvbWFpbnMubGVuZ3RoID4gMCA/IGUubWV0YS5hZHZlcnRpc2VyRG9tYWluc1swXSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICAgICAgXSksICd2aWRlbycgPT09IGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBvW1MuSlNPTl9NQVBQSU5HLkJEX1NFVFRJTkdfU1RBTkRBUkRdW1MuSlNPTl9NQVBQSU5HLkFEU0VSVkVSX1RBUkdFVElOR107CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5VVUlELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuQ0FDSEVfSUQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gbCgpKGEsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmtleSA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSAmJiBhLnB1c2gobihlLCAndmlkZW9DYWNoZUtleScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB1LmIuZ2V0Q29uZmlnKCdjYWNoZS51cmwnKSAmJiAoIXQgfHwgITEgIT09IE9iamVjdChyLmRlZXBBY2Nlc3MpKG8sICcnLmNvbmNhdCh0LCAnLnNlbmRTdGFuZGFyZFRhcmdldGluZycpKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gT2JqZWN0KHIucGFyc2VVcmwpKHUuYi5nZXRDb25maWcoJ2NhY2hlLnVybCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gbCgpKGEsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUua2V5ID09PSBpLkNBQ0hFX0hPU1Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSAmJiBhLnB1c2gobihpLkNBQ0hFX0hPU1QsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLmRlZXBBY2Nlc3MpKGUsICdhZHNlcnZlclRhcmdldGluZy4nLmNvbmNhdChpLkNBQ0hFX0hPU1QpKSA/IGUuYWRzZXJ2ZXJUYXJnZXRpbmdbaS5DQUNIRV9IT1NUXSA6IGMuaG9zdG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9bUy5KU09OX01BUFBJTkcuQkRfU0VUVElOR19TVEFOREFSRF07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBxKGUsIHQsIG4sIGkpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRbUy5KU09OX01BUFBJTkcuQURTRVJWRVJfVEFSR0VUSU5HXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5zaXplID0gbi5nZXRTaXplKCksIE9iamVjdChyLl9lYWNoKShvLCBmdW5jdGlvbiAobykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG8ua2V5LCBjID0gby52YWw7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlW2FdICYmIE9iamVjdChyLmxvZ1dhcm4pKCdUaGUga2V5OiAnICsgYSArICcgaXMgYmVpbmcgb3ZlcndyaXR0ZW4nKSwgT2JqZWN0KHIuaXNGbikoYykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBjKG4sIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmxvZ0Vycm9yKSgnYmlkbWFuYWdlcicsICdFUlJPUicsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAodm9pZCAwID09PSB0LnN1cHByZXNzRW1wdHlLZXlzIHx8ICEwICE9PSB0LnN1cHByZXNzRW1wdHlLZXlzKSAmJiBhICE9PSBTLlRBUkdFVElOR19LRVlTLkRFQUwgfHwgIU9iamVjdChyLmlzRW1wdHlTdHIpKGMpICYmIG51bGwgIT0gYyA/IGVbYV0gPSBjIDogT2JqZWN0KHIubG9nSW5mbykoJ3N1cHByZXNzaW5nIGVtcHR5IGtleSBcJycgKyBhICsgJ1wnIGZyb20gYWRzZXJ2ZXIgdGFyZ2V0aW5nJyk7CiAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBNKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0LmFkVW5pdENvZGVdIHx8IChlW3QuYWRVbml0Q29kZV0gPSB7IGJpZHM6IFtdIH0pLCBlW3QuYWRVbml0Q29kZV0uYmlkcy5wdXNoKHQpLCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICAyOTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZSgpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDM6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBuLmQodCwgJ2EnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGo7CiAgICAgICAgICAgICAgICB9KSwgbi5kKHQsICdiJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBUOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNDgpLCBpID0gbigxMSksIG8gPSBuLm4oaSksIGEgPSBuKDEyKSwgYyA9IG4ubihhKSwgdSA9IG4oODkpLCBzID0gbi5uKHUpLCBkID0gbigwKSwgZiA9IFsnZnBkJ107CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5rZXlzKGUpOwogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAociA9IHIuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLCB0KS5lbnVtZXJhYmxlOwogICAgICAgICAgICAgICAgICAgICAgICB9KSksIG4ucHVzaC5hcHBseShuLCByKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIGkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciwgaSA9IHt9LCBvID0gT2JqZWN0LmtleXMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgby5sZW5ndGg7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gb1tyXSwgdC5pbmRleE9mKG4pID49IDAgfHwgKGlbbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgICAgICB9KGUsIHQpOwogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyID0gMDsgciA8IG8ubGVuZ3RoOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gb1tyXSwgdC5pbmRleE9mKG4pID49IDAgfHwgT2JqZWN0LnByb3RvdHlwZS5wcm9wZXJ0eUlzRW51bWVyYWJsZS5jYWxsKGUsIG4pICYmIChpW25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgaW4gZSA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSkgOiBlW3RdID0gbiwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoYiA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdigpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHYgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgcikgJiYgKGVbcl0gPSBuW3JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHkgPSBuKDc0KSwgaCA9IG4oNSksIG0gPSAnVFJVRScgPT09IE9iamVjdChkLmdldFBhcmFtZXRlckJ5TmFtZSkoaC5ERUJVR19NT0RFKS50b1VwcGVyQ2FzZSgpLCBPID0gd2luZG93LmxvY2F0aW9uLm9yaWdpbiwgaiA9ICdyYW5kb20nLCBTID0ge307CiAgICAgICAgICAgICAgICBTW2pdID0gITAsIFMuZml4ZWQgPSAhMDsKICAgICAgICAgICAgICAgIHZhciBFID0gaiwgQSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgTE9XOiAnbG93JywKICAgICAgICAgICAgICAgICAgICAgICAgTUVESVVNOiAnbWVkaXVtJywKICAgICAgICAgICAgICAgICAgICAgICAgSElHSDogJ2hpZ2gnLAogICAgICAgICAgICAgICAgICAgICAgICBBVVRPOiAnYXV0bycsCiAgICAgICAgICAgICAgICAgICAgICAgIERFTlNFOiAnZGVuc2UnLAogICAgICAgICAgICAgICAgICAgICAgICBDVVNUT006ICdjdXN0b20nCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHZhciBUID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlLCB0LCBuLCBpID0gW10sIGEgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfZGVidWc6IG0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQgZGVidWcoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2RlYnVnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldCBkZWJ1ZyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fZGVidWcgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9iaWRkZXJUaW1lb3V0OiAzMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0IGJpZGRlclRpbWVvdXQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2JpZGRlclRpbWVvdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0IGJpZGRlclRpbWVvdXQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2JpZGRlclRpbWVvdXQgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9wdWJsaXNoZXJEb21haW46IE8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQgcHVibGlzaGVyRG9tYWluKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9wdWJsaXNoZXJEb21haW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0IHB1Ymxpc2hlckRvbWFpbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fcHVibGlzaGVyRG9tYWluID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfcHJpY2VHcmFudWxhcml0eTogQS5NRURJVU0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQgcHJpY2VHcmFudWxhcml0eShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhlKSAmJiAoJ3N0cmluZycgPT0gdHlwZW9mIGUgPyB0aGlzLl9wcmljZUdyYW51bGFyaXR5ID0gYShlKSA/IGUgOiBBLk1FRElVTSA6IE9iamVjdChkLmlzUGxhaW5PYmplY3QpKGUpICYmICh0aGlzLl9jdXN0b21QcmljZUJ1Y2tldCA9IGUsIHRoaXMuX3ByaWNlR3JhbnVsYXJpdHkgPSBBLkNVU1RPTSwgT2JqZWN0KGQubG9nTWVzc2FnZSkoJ1VzaW5nIGN1c3RvbSBwcmljZSBncmFudWxhcml0eScpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0IHByaWNlR3JhbnVsYXJpdHkoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3ByaWNlR3JhbnVsYXJpdHk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgX2N1c3RvbVByaWNlQnVja2V0OiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldCBjdXN0b21QcmljZUJ1Y2tldCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fY3VzdG9tUHJpY2VCdWNrZXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgX21lZGlhVHlwZVByaWNlR3JhbnVsYXJpdHk6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0IG1lZGlhVHlwZVByaWNlR3JhbnVsYXJpdHkoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX21lZGlhVHlwZVByaWNlR3JhbnVsYXJpdHk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0IG1lZGlhVHlwZVByaWNlR3JhbnVsYXJpdHkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9tZWRpYVR5cGVQcmljZUdyYW51bGFyaXR5ID0gT2JqZWN0LmtleXMoZSkucmVkdWNlKGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjKGVbcl0pID8gJ3N0cmluZycgPT0gdHlwZW9mIGUgPyBuW3JdID0gYShlW3JdKSA/IGVbcl0gOiB0Ll9wcmljZUdyYW51bGFyaXR5IDogT2JqZWN0KGQuaXNQbGFpbk9iamVjdCkoZSkgJiYgKG5bcl0gPSBlW3JdLCBPYmplY3QoZC5sb2dNZXNzYWdlKSgnVXNpbmcgY3VzdG9tIHByaWNlIGdyYW51bGFyaXR5IGZvciAnLmNvbmNhdChyKSkpIDogT2JqZWN0KGQubG9nV2FybikoJ0ludmFsaWQgcHJpY2UgZ3JhbnVsYXJpdHkgZm9yIG1lZGlhIHR5cGU6ICcuY29uY2F0KHIpKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgX3NlbmRBbGxCaWRzOiB0cnVlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0IGVuYWJsZVNlbmRBbGxCaWRzKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9zZW5kQWxsQmlkczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQgZW5hYmxlU2VuZEFsbEJpZHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3NlbmRBbGxCaWRzID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdXNlQmlkQ2FjaGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0IHVzZUJpZENhY2hlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl91c2VCaWRDYWNoZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQgdXNlQmlkQ2FjaGUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3VzZUJpZENhY2hlID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfZGV2aWNlQWNjZXNzOiB0cnVlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0IGRldmljZUFjY2VzcygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZGV2aWNlQWNjZXNzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldCBkZXZpY2VBY2Nlc3MoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2RldmljZUFjY2VzcyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgX2JpZGRlclNlcXVlbmNlOiBFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0IGJpZGRlclNlcXVlbmNlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9iaWRkZXJTZXF1ZW5jZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQgYmlkZGVyU2VxdWVuY2UoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNbZV0gPyB0aGlzLl9iaWRkZXJTZXF1ZW5jZSA9IGUgOiBPYmplY3QoZC5sb2dXYXJuKSgnSW52YWxpZCBvcmRlcjogJy5jb25jYXQoZSwgJy4gQmlkZGVyIFNlcXVlbmNlIHdhcyBub3Qgc2V0LicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdGltZW91dEJ1ZmZlcjogNDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0IHRpbWVvdXRCdWZmZXIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3RpbWVvdXRCdWZmZXI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0IHRpbWVvdXRCdWZmZXIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3RpbWVvdXRCdWZmZXIgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9kaXNhYmxlQWpheFRpbWVvdXQ6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0IGRpc2FibGVBamF4VGltZW91dCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZGlzYWJsZUFqYXhUaW1lb3V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldCBkaXNhYmxlQWpheFRpbWVvdXQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2Rpc2FibGVBamF4VGltZW91dCA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgX21heE5lc3RlZElmcmFtZXM6IDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0IG1heE5lc3RlZElmcmFtZXMoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX21heE5lc3RlZElmcmFtZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0IG1heE5lc3RlZElmcmFtZXMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX21heE5lc3RlZElmcmFtZXMgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9hdWN0aW9uT3B0aW9uczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQgYXVjdGlvbk9wdGlvbnMoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2F1Y3Rpb25PcHRpb25zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldCBhdWN0aW9uT3B0aW9ucyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghT2JqZWN0KGQuaXNQbGFpbk9iamVjdCkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGQubG9nV2FybikoJ0F1Y3Rpb24gT3B0aW9ucyBtdXN0IGJlIGFuIG9iamVjdCcpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDAsIG4gPSBPYmplY3Qua2V5cyhlKTsgdCA8IG4ubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gblt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc2Vjb25kYXJ5QmlkZGVycycgIT09IHIgJiYgJ3N1cHByZXNzU3RhbGVSZW5kZXInICE9PSByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoZC5sb2dXYXJuKSgnQXVjdGlvbiBPcHRpb25zIGdpdmVuIGFuIGluY29ycmVjdCBwYXJhbTogJy5jb25jYXQocikpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc2Vjb25kYXJ5QmlkZGVycycgPT09IHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIU9iamVjdChkLmlzQXJyYXkpKGVbcl0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGQubG9nV2FybikoJ0F1Y3Rpb24gT3B0aW9ucyAnLmNvbmNhdChyLCAnIG11c3QgYmUgb2YgdHlwZSBBcnJheScpKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlW3JdLmV2ZXJ5KGQuaXNTdHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGQubG9nV2FybikoJ0F1Y3Rpb24gT3B0aW9ucyAnLmNvbmNhdChyLCAnIG11c3QgYmUgb25seSBzdHJpbmcnKSksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgnc3VwcHJlc3NTdGFsZVJlbmRlcicgPT09IHIgJiYgIU9iamVjdChkLmlzQm9vbGVhbikoZVtyXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChkLmxvZ1dhcm4pKCdBdWN0aW9uIE9wdGlvbnMgJy5jb25jYXQociwgJyBtdXN0IGJlIG9mIHR5cGUgYm9vbGVhbicpKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkgJiYgKHRoaXMuX2F1Y3Rpb25PcHRpb25zID0gZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKCkoT2JqZWN0LmtleXMoQSksIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IEFbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGQubG9nRXJyb3IpKCdQcmViaWQgRXJyb3I6IG5vIHZhbHVlIHBhc3NlZCB0byBgc2V0UHJpY2VHcmFudWxhcml0eSgpYCcpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKGUpIHx8IE9iamVjdChkLmxvZ1dhcm4pKCdQcmViaWQgV2FybmluZzogc2V0UHJpY2VHcmFudWxhcml0eSB3YXMgY2FsbGVkIHdpdGggaW52YWxpZCBzZXR0aW5nLCB1c2luZyBgbWVkaXVtYCBhcyBkZWZhdWx0LicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoT2JqZWN0KGQuaXNQbGFpbk9iamVjdCkoZSkgJiYgIU9iamVjdChyLmIpKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoZC5sb2dFcnJvcikoJ0ludmFsaWQgY3VzdG9tIHByaWNlIHZhbHVlIHBhc3NlZCB0byBgc2V0UHJpY2VHcmFudWxhcml0eSgpYCcpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB0ICYmIEMoT2JqZWN0LmtleXModCkucmVkdWNlKGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtuXSAhPT0gaVtuXSAmJiAoZVtuXSA9IGlbbl0gfHwge30pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSkpLCB0ID0gaSwgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoKCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSAmJiBuICYmIE9iamVjdChkLmlzUGxhaW5PYmplY3QpKG5bYV0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5bYV0sIHIgPSBuZXcgcy5hKE9iamVjdC5rZXlzKHQpLmNvbmNhdChPYmplY3Qua2V5cyhlKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkocikucmVkdWNlKGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PT0gZVtyXSA/IG5bcl0gPSB0W3JdIDogdm9pZCAwID09PSB0W3JdID8gbltyXSA9IGVbcl0gOiBPYmplY3QoZC5pc1BsYWluT2JqZWN0KShlW3JdKSA/IG5bcl0gPSBPYmplY3QoZC5tZXJnZURlZXApKHt9LCB0W3JdLCBlW3JdKSA6IG5bcl0gPSBlW3JdLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2KHt9LCB0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICdjb250ZXh0JyA9PT0gbiA/ICdzaXRlJyA6IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W3JdID0gJ3NpdGUnID09PSByIHx8ICd1c2VyJyA9PT0gciA/IE9iamVjdC5rZXlzKGVbbl0pLnJlZHVjZShmdW5jdGlvbiAodCwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZGF0YScgPT09IHIgPyBPYmplY3QoZC5tZXJnZURlZXApKHQsIHsgZXh0OiB7IGRhdGE6IGVbbl1bcl0gfSB9KSA6IE9iamVjdChkLm1lcmdlRGVlcCkodCwgZyh7fSwgciwgZVtuXVtyXSkpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30pIDogZVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2NvbnRleHQnID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhlW25dKS5mb3JFYWNoKGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RhdGEnID09PSByID8gT2JqZWN0KGQubWVyZ2VEZWVwKSh0LCB7IGV4dDogeyBkYXRhOiBlW25dW3JdIH0gfSkgOiAnb2JqZWN0JyAhPT0gYihlW25dW3JdKSB8fCBBcnJheS5pc0FycmF5KGVbbl1bcl0pID8gT2JqZWN0KGQubWVyZ2VEZWVwKSh0LCB7IGV4dDogeyBkYXRhOiBnKHt9LCByLnRvTG93ZXJDYXNlKCksIGVbbl1bcl0pIH0gfSkgOiBPYmplY3Qua2V5cyhlW25dW3JdKS5mb3JFYWNoKGZ1bmN0aW9uIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChkLm1lcmdlRGVlcCkodCwgeyBleHQ6IHsgZGF0YTogZyh7fSwgci50b0xvd2VyQ2FzZSgpLCBnKHt9LCBpLnRvTG93ZXJDYXNlKCksIGVbbl1bcl1baV0pKSB9IH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBJKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChkLmlzUGxhaW5PYmplY3QpKG4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdC5rZXlzKG4pLCBpID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmZvckVhY2goZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9ICdmcGQnID09PSByID8gJ29ydGIyJyA6IHIsIGEgPSAnZnBkJyA9PT0gciA/IGoobltyXSkgOiBuW3JdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChkLmlzUGxhaW5PYmplY3QpKGVbb10pICYmIE9iamVjdChkLmlzUGxhaW5PYmplY3QpKGEpICYmIChhID0gdih7fSwgZVtvXSwgYSkpLCBpW29dID0gdFtvXSA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgQyhpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoZC5sb2dFcnJvcikoJ3NldENvbmZpZyBvcHRpb25zIG11c3QgYmUgYW4gb2JqZWN0Jyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHcoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPSB0eXBlb2YgZSAmJiAobiA9IGUsIGUgPSAnKicpLCAnZnVuY3Rpb24nID09IHR5cGVvZiBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3BpYzogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLnB1c2gociksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnNwbGljZShpLmluZGV4T2YociksIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoZC5sb2dFcnJvcikoJ2xpc3RlbmVyIG11c3QgYmUgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjKCkodCwgZS50b3BpYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuY2FsbGJhY2soZyh7fSwgdC50b3BpYywgZVt0LnRvcGljXSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgaS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnKicgPT09IGUudG9waWM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmNhbGxiYWNrKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gJiYgYXJndW1lbnRzWzFdOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcihlKSwgZS5iaWRkZXJzLmZvckVhY2goZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3JdIHx8IChuW3JdID0ge30pLCBPYmplY3Qua2V5cyhlLmNvbmZpZykuZm9yRWFjaChmdW5jdGlvbiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9ICdmcGQnID09PSBpID8gJ29ydGIyJyA6IGksIGEgPSAnZnBkJyA9PT0gaSA/IGooZS5jb25maWdbaV0pIDogZS5jb25maWdbaV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QoZC5pc1BsYWluT2JqZWN0KShhKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB0ID8gZC5tZXJnZURlZXAgOiBPYmplY3QuYXNzaWduOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbltyXVtvXSA9IGMoe30sIG5bcl1bb10gfHwge30sIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bcl1bb10gPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChkLmxvZ0Vycm9yKShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghT2JqZWN0KGQuaXNQbGFpbk9iamVjdCkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ3NldEJpZGRlckNvbmZpZyBiaWRkZXIgb3B0aW9ucyBtdXN0IGJlIGFuIG9iamVjdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUFycmF5LmlzQXJyYXkoZS5iaWRkZXJzKSB8fCAhZS5iaWRkZXJzLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAnc2V0QmlkZGVyQ29uZmlnIGJpZGRlciBvcHRpb25zIG11c3QgY29udGFpbiBhIGJpZGRlcnMgbGlzdCB3aXRoIGF0IGxlYXN0IDEgYmlkZGVyJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghT2JqZWN0KGQuaXNQbGFpbk9iamVjdCkoZS5jb25maWcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93ICdzZXRCaWRkZXJDb25maWcgYmlkZGVyIG9wdGlvbnMgbXVzdCBjb250YWluIGEgY29uZmlnIG9iamVjdCc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gXyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBVKCkgewogICAgICAgICAgICAgICAgICAgICAgICBhID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoKSwgewogICAgICAgICAgICAgICAgICAgICAgICBnZXRDdXJyZW50QmlkZGVyOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXRCaWRkZXI6IFUsCiAgICAgICAgICAgICAgICAgICAgICAgIGdldENvbmZpZzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFyZ3VtZW50cy5sZW5ndGggPD0gMSAmJiAnZnVuY3Rpb24nICE9IHR5cGVvZiAoYXJndW1lbnRzLmxlbmd0aCA8PSAwID8gdm9pZCAwIDogYXJndW1lbnRzWzBdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA8PSAwID8gdm9pZCAwIDogYXJndW1lbnRzWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gT2JqZWN0KGQuZGVlcEFjY2VzcykoaCgpLCBlKSA6IGgoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3LmFwcGx5KHZvaWQgMCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVhZENvbmZpZzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFyZ3VtZW50cy5sZW5ndGggPD0gMSAmJiAnZnVuY3Rpb24nICE9IHR5cGVvZiAoYXJndW1lbnRzLmxlbmd0aCA8PSAwID8gdm9pZCAwIDogYXJndW1lbnRzWzBdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA8PSAwID8gdm9pZCAwIDogYXJndW1lbnRzWzBdLCB0ID0gT2JqZWN0KGQuZGVlcENsb25lKShoKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gT2JqZWN0KGQuZGVlcEFjY2VzcykodCwgZSkgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHcuYXBwbHkodm9pZCAwLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzZXRDb25maWc6IEksCiAgICAgICAgICAgICAgICAgICAgICAgIG1lcmdlQ29uZmlnOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChkLmlzUGxhaW5PYmplY3QpKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3Qua2V5cyhlKS5yZWR1Y2UoZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBoKClbbl0gfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W25dID0gT2JqZWN0KGQubWVyZ2VEZWVwKShyLCBlW25dKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEkoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbnVsbCAhPSBhcmd1bWVudHNbdF0gPyBhcmd1bWVudHNbdF0gOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJSAyID8gbChPYmplY3QobiksICEwKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyhlLCB0LCBuW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhlLCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyhuKSkgOiBsKE9iamVjdChuKSkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKG4sIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oe30sIHQpKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChkLmxvZ0Vycm9yKSgnbWVyZ2VDb25maWcgaW5wdXQgbXVzdCBiZSBhbiBvYmplY3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc2V0RGVmYXVsdHM6IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoZC5pc1BsYWluT2JqZWN0KShlKSA/ICh2KGUsIG4pLCB2KHQsIG4pKSA6IE9iamVjdChkLmxvZ0Vycm9yKSgnZGVmYXVsdHMgbXVzdCBiZSBhbiBvYmplY3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXRDb25maWc6IHUsCiAgICAgICAgICAgICAgICAgICAgICAgIHJ1bldpdGhCaWRkZXI6IF8sCiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrV2l0aEJpZGRlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09IHR5cGVvZiB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCwgciA9IG5ldyBBcnJheShuKSwgaSA9IDA7IGkgPCBuOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcltpXSA9IGFyZ3VtZW50c1tpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfKGUsIGQuYmluZC5jYWxsLmFwcGx5KGQuYmluZCwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5jb25jYXQocikpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoZC5sb2dXYXJuKSgnY29uZmlnLmNhbGxiYWNrV2l0aEJpZGRlciBjYWxsYmFjayBpcyBub3QgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzZXRCaWRkZXJDb25maWc6IFIsCiAgICAgICAgICAgICAgICAgICAgICAgIGdldEJpZGRlckNvbmZpZzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG1lcmdlQmlkZGVyQ29uZmlnOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFIoZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBjb252ZXJ0QWRVbml0RnBkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZwZCA/IChlLm9ydGIySW1wID8gT2JqZWN0KGQubWVyZ2VEZWVwKShlLm9ydGIySW1wLCBUKGUuZnBkKSkgOiBlLm9ydGIySW1wID0gVChlLmZwZCksIHQucHVzaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZwZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAoZSwgZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlKSkpIDogdC5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldExlZ2FjeUZwZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gYihlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGUpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAnc2l0ZScgPT09IG4gPyAnY29udGV4dCcgOiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W3JdID0gJ2NvbnRleHQnID09PSByIHx8ICd1c2VyJyA9PT0gciA/IE9iamVjdC5rZXlzKGVbbl0pLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdkYXRhJyAhPT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVkdWNlKGZ1bmN0aW9uICh0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2V4dCcgPT09IHIgPyBPYmplY3QoZC5tZXJnZURlZXApKHQsIGVbbl1bcl0pIDogT2JqZWN0KGQubWVyZ2VEZWVwKSh0LCBnKHt9LCByLCBlW25dW3JdKSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9KSA6IGVbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldExlZ2FjeUltcEZwZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gYihlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChkLmRlZXBBY2Nlc3MpKGUsICdleHQuZGF0YScpICYmIE9iamVjdC5rZXlzKGUuZXh0LmRhdGEpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BiYWRzbG90JyA9PT0gbiA/IE9iamVjdChkLm1lcmdlRGVlcCkodCwgeyBjb250ZXh0OiB7IHBiQWRTbG90OiBlLmV4dC5kYXRhW25dIH0gfSkgOiAnYWRzZXJ2ZXInID09PSBuID8gT2JqZWN0KGQubWVyZ2VEZWVwKSh0LCB7IGNvbnRleHQ6IHsgYWRTZXJ2ZXI6IGUuZXh0LmRhdGFbbl0gfSB9KSA6IE9iamVjdChkLm1lcmdlRGVlcCkodCwgeyBjb250ZXh0OiB7IGRhdGE6IGcoe30sIG4sIGUuZXh0LmRhdGFbbl0pIH0gfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICB9LAogICAgICAgICAgICAzMDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnID09IHR5cGVvZiBlID8gbnVsbCAhPT0gZSA6ICdmdW5jdGlvbicgPT0gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAzMTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig1MiksIGkgPSB7fS5oYXNPd25Qcm9wZXJ0eTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IE9iamVjdC5oYXNPd24gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5jYWxsKHIoZSksIHQpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMzI6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzMpLCBpID0gbigzNCksIG8gPSBuKDQ0KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIgPyBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBpLmYoZSwgdCwgbygxLCBuKSk7CiAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0XSA9IG4sIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAzMzogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyOSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhcihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDcgIT0gT2JqZWN0LmRlZmluZVByb3BlcnR5KHt9LCAxLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KVsxXTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICAzNDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzMyksIGkgPSBuKDg0KSwgbyA9IG4oMTcpLCBhID0gbig2MiksIGMgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiAgICAgICAgICAgICAgICB0LmYgPSByID8gYyA6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG8oZSksIHQgPSBhKHQsICEwKSwgbyhuKSwgaSkKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoJ2dldCcgaW4gbiB8fCAnc2V0JyBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ0FjY2Vzc29ycyBub3Qgc3VwcG9ydGVkJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd2YWx1ZScgaW4gbiAmJiAoZVt0XSA9IG4udmFsdWUpLCBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMzU6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB0LmEgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIGlmICghdCB8fCAhZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgT2JqZWN0KG8ubG9nRXJyb3IpKCdjYW5ub3QgbG9hZCBleHRlcm5hbCBzY3JpcHQgd2l0aG91dCB1cmwgYW5kIG1vZHVsZUNvZGUnKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIWkoKShjLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgT2JqZWN0KG8ubG9nRXJyb3IpKCcnLmNvbmNhdCh0LCAnIG5vdCB3aGl0ZWxpc3RlZCBmb3IgbG9hZGluZyBleHRlcm5hbCBKYXZhU2NyaXB0JykpOwogICAgICAgICAgICAgICAgICAgIGlmIChhW2VdKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBuICYmIChhW2VdLmxvYWRlZCA/IG4oKSA6IGFbZV0uY2FsbGJhY2tzLnB1c2gobikpLCBhW2VdLnRhZzsKICAgICAgICAgICAgICAgICAgICBhW2VdID0gewogICAgICAgICAgICAgICAgICAgICAgICBsb2FkZWQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICB0YWc6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrczogW10KICAgICAgICAgICAgICAgICAgICB9LCBuICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIG4gJiYgYVtlXS5jYWxsYmFja3MucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KG8ubG9nV2FybikoJ21vZHVsZSAnLmNvbmNhdCh0LCAnIGlzIGxvYWRpbmcgZXh0ZXJuYWwgSmF2YVNjcmlwdCcpKSwgZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgci50eXBlID0gJ3RleHQvamF2YXNjcmlwdCcsIHIuYXN5bmMgPSAhMCwgYVtlXS50YWcgPSByLCByLnJlYWR5U3RhdGUgPyByLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsb2FkZWQnICE9PSByLnJlYWR5U3RhdGUgJiYgJ2NvbXBsZXRlJyAhPT0gci5yZWFkeVN0YXRlIHx8IChyLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IG51bGwsIG4oKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gOiByLm9ubG9hZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuc3JjID0gdCwgT2JqZWN0KG8uaW5zZXJ0RWxlbWVudCkociksIHI7CiAgICAgICAgICAgICAgICAgICAgfShlLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGFbZV0ubG9hZGVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMDsgdCA8IGFbZV0uY2FsbGJhY2tzLmxlbmd0aDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbZV0uY2FsbGJhY2tzW3RdKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChvLmxvZ0Vycm9yKSgnRXJyb3IgZXhlY3V0aW5nIGNhbGxiYWNrJywgJ2FkbG9hZGVyLmpzOmxvYWRFeHRlcm5hbFNjcmlwdCcsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEyKSwgaSA9IG4ubihyKSwgbyA9IG4oMCksIGEgPSB7fSwgYyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2FkbG9veCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdjcml0ZW8nLAogICAgICAgICAgICAgICAgICAgICAgICAnb3V0c3RyZWFtJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2FkYWdpbycsCiAgICAgICAgICAgICAgICAgICAgICAgICdicm93c2knCiAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMzc6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgIG4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIG4gPSBuIHx8IEZ1bmN0aW9uKCdyZXR1cm4gdGhpcycpKCkgfHwgKDAsIGV2YWwpKCd0aGlzJyk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT0gdHlwZW9mIHdpbmRvdyAmJiAobiA9IHdpbmRvdyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBuOwogICAgICAgICAgICB9LAogICAgICAgICAgICAzODogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxOCksIGkgPSBuKDczKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIgPyBpIDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gU2V0LnByb3RvdHlwZS52YWx1ZXMuY2FsbChlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDM4MTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMzgyKTsKICAgICAgICAgICAgICAgIHZhciByID0gbig1NSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByKCdTdHJpbmcnLCAnaW5jbHVkZXMnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMzgyOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgaSA9IG4oMzgzKSwgbyA9IG4oNTEpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU3RyaW5nJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhbigzODUpKCdpbmNsdWRlcycpCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgaW5jbHVkZXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIX5TdHJpbmcobyh0aGlzKSkuaW5kZXhPZihpKGUpLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDM4MzogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzODQpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAocihlKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKCdUaGUgbWV0aG9kIGRvZXNuXCd0IGFjY2VwdCByZWd1bGFyIGV4cHJlc3Npb25zJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAzODQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzApLCBpID0gbig1MCksIG8gPSBuKDIzKSgnbWF0Y2gnKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoZSkgJiYgKHZvaWQgMCAhPT0gKHQgPSBlW29dKSA/ICEhdCA6ICdSZWdFeHAnID09IGkoZSkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMzg1OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDIzKSgnbWF0Y2gnKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAvLi87CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgJy8uLydbZV0odCk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbcl0gPSAhMSwgJy8uLydbZV0odCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICAzOTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIG4uZCh0LCAnZicsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgIH0pLCBuLmQodCwgJ2EnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGw7CiAgICAgICAgICAgICAgICB9KSwgdC5oID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiBlLnR5cGUgJiYgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSB8fCAhbygpKE9iamVjdC5rZXlzKHApLCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHIubG9nRXJyb3IpKCcnLmNvbmNhdChlLCAnIG5hdGl2ZVBhcmFtIGlzIG5vdCBzdXBwb3J0ZWQnKSksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9KGUudHlwZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwW2UudHlwZV07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9LCB0LmcgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0KHIuZ2V0QmlkUmVxdWVzdCkoZS5yZXF1ZXN0SWQsIHQpOwogICAgICAgICAgICAgICAgICAgIGlmICghbikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIGlmICghT2JqZWN0KHIuZGVlcEFjY2VzcykoZSwgJ25hdGl2ZS5jbGlja1VybCcpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuLm5hdGl2ZVBhcmFtczsKICAgICAgICAgICAgICAgICAgICBpZiAoIWkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IE9iamVjdC5rZXlzKGkpLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlbZV0ucmVxdWlyZWQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBjID0gT2JqZWN0LmtleXMoZS5uYXRpdmUpLmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmF0aXZlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5ldmVyeShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbygpKGMsIGUpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgdC5iID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAnY2xpY2snID09PSBlLmFjdGlvbiA/IG4gPSB0Lm5hdGl2ZSAmJiB0Lm5hdGl2ZS5jbGlja1RyYWNrZXJzIDogKG4gPSB0Lm5hdGl2ZSAmJiB0Lm5hdGl2ZS5pbXByZXNzaW9uVHJhY2tlcnMsIHQubmF0aXZlICYmIHQubmF0aXZlLmphdmFzY3JpcHRUcmFja2VycyAmJiBPYmplY3Qoci5pbnNlcnRIdG1sSW50b0lmcmFtZSkodC5uYXRpdmUuamF2YXNjcmlwdFRyYWNrZXJzKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChuIHx8IFtdKS5mb3JFYWNoKHIudHJpZ2dlclBpeGVsKSwgZS5hY3Rpb247CiAgICAgICAgICAgICAgICB9LCB0LmUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHIuZGVlcEFjY2VzcykodCwgJ25hdGl2ZVBhcmFtcy5yZW5kZXJlclVybCcpID8gZS5uYXRpdmUucmVuZGVyZXJVcmwgPSBnKHQubmF0aXZlUGFyYW1zLnJlbmRlcmVyVXJsKSA6IE9iamVjdChyLmRlZXBBY2Nlc3MpKHQsICduYXRpdmVQYXJhbXMuYWRUZW1wbGF0ZScpICYmIChlLm5hdGl2ZS5hZFRlbXBsYXRlID0gZyh0Lm5hdGl2ZVBhcmFtcy5hZFRlbXBsYXRlKSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAhMSAhPT0gT2JqZWN0KHIuZGVlcEFjY2VzcykodCwgJ25hdGl2ZVBhcmFtcy5zZW5kVGFyZ2V0aW5nS2V5cycpLCBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoci5kZWVwQWNjZXNzKShlLCAnbmF0aXZlUGFyYW1zLmV4dCcpICYmIE9iamVjdC5rZXlzKGUubmF0aXZlUGFyYW1zLmV4dCkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbZV0gPSAnaGJfbmF0aXZlXycuY29uY2F0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdSh1KHt9LCBkLk5BVElWRV9LRVlTKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0odCksIGEgPSB1KHUoe30sIGUubmF0aXZlKSwgZS5uYXRpdmUuZXh0KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGVsZXRlIGEuZXh0LCBPYmplY3Qua2V5cyhhKS5mb3JFYWNoKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gb1thXSwgdSA9IGcoZS5uYXRpdmVbYV0pIHx8IGcoT2JqZWN0KHIuZGVlcEFjY2VzcykoZSwgJ25hdGl2ZS5leHQuJy5jb25jYXQoYSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdhZFRlbXBsYXRlJyAhPT0gYSAmJiBjICYmIHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gT2JqZWN0KHIuZGVlcEFjY2VzcykodCwgJ25hdGl2ZVBhcmFtcy4nLmNvbmNhdChhLCAnLnNlbmRJZCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnYm9vbGVhbicgIT0gdHlwZW9mIHMgJiYgKHMgPSBPYmplY3Qoci5kZWVwQWNjZXNzKSh0LCAnbmF0aXZlUGFyYW1zLmV4dC4nLmNvbmNhdChhLCAnLnNlbmRJZCcpKSksIHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSA9ICcnLmNvbmNhdChjLCAnOicpLmNvbmNhdChlLmFkSWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBPYmplY3Qoci5kZWVwQWNjZXNzKSh0LCAnbmF0aXZlUGFyYW1zLicuY29uY2F0KGEsICcuc2VuZFRhcmdldGluZ0tleXMnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYm9vbGVhbicgIT0gdHlwZW9mIGQgJiYgKGQgPSBPYmplY3Qoci5kZWVwQWNjZXNzKSh0LCAnbmF0aXZlUGFyYW1zLmV4dC4nLmNvbmNhdChhLCAnLnNlbmRUYXJnZXRpbmdLZXlzJykpKSwgKCdib29sZWFuJyA9PSB0eXBlb2YgZCA/IGQgOiBpKSAmJiAobltjXSA9IHUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICB9LCB0LmQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gewogICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnYXNzZXRSZXNwb25zZScsCiAgICAgICAgICAgICAgICAgICAgICAgIGFkSWQ6IGUuYWRJZCwKICAgICAgICAgICAgICAgICAgICAgICAgYXNzZXRzOiBbXQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdC5uYXRpdmUuaGFzT3duUHJvcGVydHkoJ2FkVGVtcGxhdGUnKSAmJiAobi5hZFRlbXBsYXRlID0gZyh0Lm5hdGl2ZS5hZFRlbXBsYXRlKSk7CiAgICAgICAgICAgICAgICAgICAgdC5uYXRpdmUuaGFzT3duUHJvcGVydHkoJ3JlbmRlcmVyVXJsJykgJiYgKG4ucmVuZGVyZXJVcmwgPSBnKHQubmF0aXZlLnJlbmRlcmVyVXJsKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXNzZXRzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBPYmplY3Qoci5nZXRLZXlCeVZhbHVlKShkLk5BVElWRV9LRVlTLCBlKSwgbyA9IGcodC5uYXRpdmVbaV0pOwogICAgICAgICAgICAgICAgICAgICAgICBuLmFzc2V0cy5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBvCiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgfSwgdC5jID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogJ2Fzc2V0UmVzcG9uc2UnLAogICAgICAgICAgICAgICAgICAgICAgICBhZElkOiBlLmFkSWQsCiAgICAgICAgICAgICAgICAgICAgICAgIGFzc2V0czogW10KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyh0Lm5hdGl2ZSkuZm9yRWFjaChmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2FkVGVtcGxhdGUnID09PSBlICYmIHQubmF0aXZlW2VdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5hZFRlbXBsYXRlID0gZyh0Lm5hdGl2ZVtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCdyZW5kZXJlclVybCcgPT09IGUgJiYgdC5uYXRpdmVbZV0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnJlbmRlcmVyVXJsID0gZyh0Lm5hdGl2ZVtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCdleHQnID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXModC5uYXRpdmVbZV0pLmZvckVhY2goZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5uYXRpdmVbZV1bcl0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBnKHQubmF0aXZlW2VdW3JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5hc3NldHMucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAodC5uYXRpdmVbZV0gJiYgZC5OQVRJVkVfS0VZUy5oYXNPd25Qcm9wZXJ0eShlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBnKHQubmF0aXZlW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uYXNzZXRzLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KSwgbjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMCksIGkgPSBuKDEyKSwgbyA9IG4ubihpKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoYSA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgKHIgPSByLmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoZSwgdCkuZW51bWVyYWJsZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBuLnB1c2guYXBwbHkobiwgcik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBudWxsICE9IGFyZ3VtZW50c1t0XSA/IGFyZ3VtZW50c1t0XSA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB0ICUgMiA/IGMoT2JqZWN0KG4pLCAhMCkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcyhlLCB0LCBuW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGUsIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKG4pKSA6IGMoT2JqZWN0KG4pKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihuLCB0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0IGluIGUgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pIDogZVt0XSA9IG4sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgZCA9IG4oNSksIGYgPSBbXSwgbCA9IE9iamVjdC5rZXlzKGQuTkFUSVZFX0tFWVMpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZC5OQVRJVkVfS0VZU1tlXTsKICAgICAgICAgICAgICAgICAgICB9KSwgcCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgaW1hZ2U6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltYWdlOiB7IHJlcXVpcmVkOiAhMCB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHsgcmVxdWlyZWQ6ICEwIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcG9uc29yZWRCeTogeyByZXF1aXJlZDogITAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWNrVXJsOiB7IHJlcXVpcmVkOiAhMCB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogeyByZXF1aXJlZDogITEgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGljb246IHsgcmVxdWlyZWQ6ICExIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBnKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT09IGEoZSkgJiYgZS51cmwgPyBlLnVybCA6IGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBuLmQodCwgJ2EnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9KSwgdC5iID0gdTsKICAgICAgICAgICAgICAgIHZhciByID0gbigzKSwgaSA9IG4oMCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAobyA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChuLCByKSAmJiAoZVtyXSA9IG5bcl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0pLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGEgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGUuY29uc3RydWN0b3IgPT09IFN5bWJvbCAmJiBlICE9PSBTeW1ib2wucHJvdG90eXBlID8gJ3N5bWJvbCcgOiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9KShlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBjID0gdSgpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gdSgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDogMzAwMCwgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDoge30sIG4gPSB0LnJlcXVlc3QsIGMgPSB0LmRvbmU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCB1LCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfMWJjNTE5M2FkY2VmZmU0OCA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpLCAkX19fb2xkXzRmZTRmOWRhOWJlMWVkMzIgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzFiYzUxOTNhZGNlZmZlNDgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfYjQ2YjNiYjQ2NDQyZmM5MC5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfNGZlNGY5ZGE5YmUxZWQzMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja19iNDZiM2JiNDY0NDJmYzkwLlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gYXJndW1lbnRzLmxlbmd0aCA+IDMgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbM10gPyBhcmd1bWVudHNbM10gOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiwgbCA9IGQubWV0aG9kIHx8IChzID8gJ1BPU1QnIDogJ0dFVCcpLCBwID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnYScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLmhyZWYgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9ICdvYmplY3QnID09PSBhKHUpICYmIG51bGwgIT09IHUgPyB1IDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChpLmxvZ01lc3NhZ2UpKCd4aHIgc3VjY2VzcycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChpLmxvZ0Vycm9yKSgneGhyIGVycm9yJywgbnVsbCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09IHR5cGVvZiB1ICYmIChnLnN1Y2Nlc3MgPSB1KSwgKGYgPSBuZXcgd2luZG93LlhNTEh0dHBSZXF1ZXN0KCkpLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoNCA9PT0gZi5yZWFkeVN0YXRlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT0gdHlwZW9mIGMgJiYgYyhwLm9yaWdpbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZi5zdGF0dXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPj0gMjAwICYmIGUgPCAzMDAgfHwgMzA0ID09PSBlID8gZy5zdWNjZXNzKGYucmVzcG9uc2VUZXh0LCBmKSA6IGcuZXJyb3IoZi5zdGF0dXNUZXh0LCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByLmIuZ2V0Q29uZmlnKCdkaXNhYmxlQWpheFRpbWVvdXQnKSB8fCAoZi5vbnRpbWVvdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nRXJyb3IpKCcgIHhociB0aW1lb3V0IGFmdGVyICcsIGYudGltZW91dCwgJ21zJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgJ0dFVCcgPT09IGwgJiYgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBPYmplY3QoaS5wYXJzZVVybCkodCwgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKGIuc2VhcmNoLCBzKSwgdCA9IE9iamVjdChpLmJ1aWxkVXJsKShiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLm9wZW4obCwgdCwgITApLCByLmIuZ2V0Q29uZmlnKCdkaXNhYmxlQWpheFRpbWVvdXQnKSB8fCAoZi50aW1lb3V0ID0gZSksIGQud2l0aENyZWRlbnRpYWxzICYmIChmLndpdGhDcmVkZW50aWFscyA9ICEwKSwgT2JqZWN0KGkuX2VhY2gpKGQuY3VzdG9tSGVhZGVycywgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuc2V0UmVxdWVzdEhlYWRlcih0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGQucHJlZmxpZ2h0ICYmIGYuc2V0UmVxdWVzdEhlYWRlcignWC1SZXF1ZXN0ZWQtV2l0aCcsICdYTUxIdHRwUmVxdWVzdCcpLCBmLnNldFJlcXVlc3RIZWFkZXIoJ0NvbnRlbnQtVHlwZScsIGQuY29udGVudFR5cGUgfHwgJ3RleHQvcGxhaW4nKSwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgbiAmJiBuKHAub3JpZ2luKSwgJ1BPU1QnID09PSBsICYmIHMgPyBmLnNlbmQocykgOiBmLnNlbmQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChpLmxvZ0Vycm9yKSgneGhyIGNvbnN0cnVjdGlvbicsIGUpLCAnb2JqZWN0JyA9PT0gYSh1KSAmJiBudWxsICE9PSB1ICYmIHUuZXJyb3IoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMWJjNTE5M2FkY2VmZmU0OCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzFiYzUxOTNhZGNlZmZlNDgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzRmZTRmOWRhOWJlMWVkMzIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX29sZF80ZmU0ZjlkYTliZTFlZDMyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICA0MDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIG4uZCh0LCAnYScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQTsKICAgICAgICAgICAgICAgIH0pLCBuLmQodCwgJ2InLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFQ7CiAgICAgICAgICAgICAgICB9KSwgdC5jID0gSSwgbi5kKHQsICdkJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB3OwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMCksIGkgPSBuKDMpLCBvID0gbigzOSksIGEgPSBuKDIyKSwgYyA9IG4oMTAwKSwgdSA9IG4oMiksIHMgPSBuKDkpLCBkID0gbigxMiksIGYgPSBuLm4oZCksIGwgPSBuKDExKSwgcCA9IG4ubihsKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGcoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChnID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG4sIHIpICYmIChlW3JdID0gbltyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSkuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0IGluIGUgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pIDogZVt0XSA9IG4sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geShlKTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyAhPSB0eXBlb2YgU3ltYm9sICYmIG51bGwgIT0gZVtTeW1ib2wuaXRlcmF0b3JdIHx8IG51bGwgIT0gZVsnQEBpdGVyYXRvciddKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LmZyb20oZSk7CiAgICAgICAgICAgICAgICAgICAgfShlKSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5KGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChlKS5zbGljZSg4LCAtMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICdPYmplY3QnID09PSBuICYmIGUuY29uc3RydWN0b3IgJiYgKG4gPSBlLmNvbnN0cnVjdG9yLm5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ01hcCcgPT09IG4gfHwgJ1NldCcgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdBcmd1bWVudHMnID09PSBuIHx8IC9eKD86VWl8SSludCg/Ojh8MTZ8MzIpKD86Q2xhbXBlZCk/QXJyYXkkLy50ZXN0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgfShlKSB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ludmFsaWQgYXR0ZW1wdCB0byBzcHJlYWQgbm9uLWl0ZXJhYmxlIGluc3RhbmNlLlxuSW4gb3JkZXIgdG8gYmUgaXRlcmFibGUsIG5vbi1hcnJheSBvYmplY3RzIG11c3QgaGF2ZSBhIFtTeW1ib2wuaXRlcmF0b3JdKCkgbWV0aG9kLicpOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIChudWxsID09IHQgfHwgdCA+IGUubGVuZ3RoKSAmJiAodCA9IGUubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMCwgciA9IG5ldyBBcnJheSh0KTsgbiA8IHQ7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgcltuXSA9IGVbbl07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgaCA9IG4oNSksIG0gPSBbXSwgTyA9ICd0YXJnZXRpbmdDb250cm9scy5hbGxvd1RhcmdldGluZ0tleXMnLCBqID0gJ3RhcmdldGluZ0NvbnRyb2xzLmFkZFRhcmdldGluZ0tleXMnLCBTID0gJ09ubHkgb25lIG9mICInLmNvbmNhdChPLCAnIiBvciAiJykuY29uY2F0KGosICciIGNhbiBiZSBzZXQnKSwgRSA9IE9iamVjdC5rZXlzKGguVEFSR0VUSU5HX0tFWVMpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaC5UQVJHRVRJTkdfS0VZU1tlXTsKICAgICAgICAgICAgICAgICAgICB9KSwgQSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgaXNCaWROb3RFeHBpcmVkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVzcG9uc2VUaW1lc3RhbXAgKyAxMDAwICogZS50dGwgLSAxMDAwID4gT2JqZWN0KHIudGltZXN0YW1wKSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBpc1VudXNlZEJpZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIChlLnN0YXR1cyAmJiAhZigpKFtoLkJJRF9TVEFUVVMuUkVOREVSRURdLCBlLnN0YXR1cykgfHwgIWUuc3RhdHVzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIFQgPSBPYmplY3Qocy5iKSgnc3luYycsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMl0gPyBhcmd1bWVudHNbMl0gOiAwLCBvID0gYXJndW1lbnRzLmxlbmd0aCA+IDMgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbM10gJiYgYXJndW1lbnRzWzNdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gW10sIGMgPSBpLmIuZ2V0Q29uZmlnKCdzZW5kQmlkc0NvbnRyb2wuZGVhbFByaW9yaXRpemF0aW9uJyksIHUgPSBPYmplY3Qoci5ncm91cEJ5KShlLCAnYWRVbml0Q29kZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKHUpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IFtdLCBvID0gT2JqZWN0KHIuZ3JvdXBCeSkodVtlXSwgJ2JpZGRlckNvZGUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhvKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLnB1c2gob1tlXS5yZWR1Y2UodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuID4gMCA/IChpID0gYyA/IGkuc29ydChJKCEwKSkgOiBpLnNvcnQoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuY3BtIC0gZS5jcG07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGEucHVzaC5hcHBseShhLCB2KGkuc2xpY2UoMCwgbikpKSkgOiBhLnB1c2guYXBwbHkoYSwgdihpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEkoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSAmJiBhcmd1bWVudHNbMF07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IHQuYWRzZXJ2ZXJUYXJnZXRpbmcuaGJfZGVhbCAmJiB2b2lkIDAgPT09IG4uYWRzZXJ2ZXJUYXJnZXRpbmcuaGJfZGVhbCA/IC0xIDogdm9pZCAwID09PSB0LmFkc2VydmVyVGFyZ2V0aW5nLmhiX2RlYWwgJiYgdm9pZCAwICE9PSBuLmFkc2VydmVyVGFyZ2V0aW5nLmhiX2RlYWwgPyAxIDogZSA/IG4uY3BtIC0gdC5jcG0gOiBuLmFkc2VydmVyVGFyZ2V0aW5nLmhiX3BiIC0gdC5hZHNlcnZlclRhcmdldGluZy5oYl9wYjsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHcgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge30sIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWRzZXJ2ZXJUYXJnZXRpbmcgJiYgdCAmJiAoT2JqZWN0KHIuaXNBcnJheSkodCkgJiYgZigpKHQsIGUuYWRVbml0Q29kZSkgfHwgJ3N0cmluZycgPT0gdHlwZW9mIHQgJiYgZS5hZFVuaXRDb2RlID09PSB0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghMCA9PT0gaS5iLmdldENvbmZpZygndGFyZ2V0aW5nQ29udHJvbHMuYWx3YXlzSW5jbHVkZURlYWxzJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gRS5jb25jYXQoby5hKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKHQsIHIuZ2V0SGlnaGVzdENwbSkubWFwKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuZGVhbElkICYmIGEodCwgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKHt9LCB0LmFkVW5pdENvZGUsIE4odCwgbi5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IHQuYWRzZXJ2ZXJUYXJnZXRpbmdbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZyh7fSwgaC5UQVJHRVRJTkdfS0VZUywgaC5OQVRJVkVfS0VZUyksIGkgPSBPYmplY3Qua2V5cyhuKSwgbyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoci5sb2dJbmZvKSgnYWxsb3dUYXJnZXRpbmdLZXlzIC0gYWxsb3dlZCBrZXlzIFsgJy5jb25jYXQodC5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuW2VdOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5qb2luKCcsICcpLCAnIF0nKSksIGUubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdC5rZXlzKGUpWzBdLCBhID0gZVtyXS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBPYmplY3Qua2V5cyhlKVswXSwgYSA9IDAgPT09IGkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPT09IHIuaW5kZXhPZihuW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmxlbmd0aCB8fCBwKCkodCwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG5bZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPT09IHIuaW5kZXhPZih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb1tyXSA9ICFhLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtyXSA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IE9iamVjdC5rZXlzKG8pLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9bZV07CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHIubG9nSW5mbykoJ2FsbG93VGFyZ2V0aW5nS2V5cyAtIHJlbW92ZWQga2V5cyBbICcuY29uY2F0KGEuam9pbignLCAnKSwgJyBdJykpLCBlLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbT2JqZWN0LmtleXMoZSlbMF1dLmxlbmd0aCA+IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3Qoci5kZWVwQ2xvbmUpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMobikubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkVW5pdENvZGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRzZXJ2ZXJUYXJnZXRpbmc6IG5bZV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnNvcnQoSSgpKS5yZWR1Y2UoZnVuY3Rpb24gKGUsIGksIG8sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjLCB1ID0gKGMgPSBpLmFkc2VydmVyVGFyZ2V0aW5nLCBPYmplY3Qua2V5cyhjKS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgKyAnJy5jb25jYXQodCwgJyUzZCcpLmNvbmNhdChlbmNvZGVVUklDb21wb25lbnQoY1t0XSksICclMjYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAnJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbyArIDEgPT09IGEubGVuZ3RoICYmICh1ID0gdS5zbGljZSgwLCAtMykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBpLmFkVW5pdENvZGUsIGQgPSB1Lmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkIDw9IHQgPyAodCAtPSBkLCBPYmplY3Qoci5sb2dJbmZvKSgnQWRVbml0IFwnJy5jb25jYXQocywgJ1wnIGF1Y3Rpb24ga2V5cyBjb21wcmlzZWQgb2YgJykuY29uY2F0KGQsICcgY2hhcmFjdGVycy4gIERlZHVjdGVkIGZyb20gcnVubmluZyB0aHJlc2hvbGQ7IG5ldyBsaW1pdCBpcyAnKS5jb25jYXQodCksIG5bc10pLCBlW3NdID0gbltzXSkgOiBPYmplY3Qoci5sb2dXYXJuKSgnVGhlIGZvbGxvd2luZyBrZXlzIGZvciBhZFVuaXRDb2RlIFwnJy5jb25jYXQocywgJ1wnIGV4Y2VlZGVkIHRoZSBjdXJyZW50IGxpbWl0IG9mIHRoZSBcJ2F1Y3Rpb25LZXlNYXhDaGFyc1wnIHNldHRpbmcuXG5UaGUga2V5LXNldCBzaXplIHdhcyAnKS5jb25jYXQoZCwgJywgdGhlIGN1cnJlbnQgYWxsb3R0ZWQgYW1vdW50IHdhcyAnKS5jb25jYXQodCwgJy5cbicpLCBuW3NdKSwgbyArIDEgPT09IGEubGVuZ3RoICYmIDAgPT09IE9iamVjdC5rZXlzKGUpLmxlbmd0aCAmJiBPYmplY3Qoci5sb2dFcnJvcikoJ05vIGF1Y3Rpb24gdGFyZ2V0aW5nIGtleXMgd2VyZSBwZXJtaXR0ZWQgZHVlIHRvIHRoZSBzZXR0aW5nIGluIHNldENvbmZpZyh0YXJnZXRpbmdDb250cm9scy5hdWN0aW9uS2V5TWF4Q2hhcnMpLiAgUGxlYXNlIHJldmlldyBzZXR1cCBhbmQgY29uc2lkZXIgYWRqdXN0aW5nLicpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKHt9LCBPYmplY3Qua2V5cyhlKVswXSwgZVtPYmplY3Qua2V5cyhlKVswXV0ubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIoe30sIE9iamVjdC5rZXlzKGUpWzBdLCBlW09iamVjdC5rZXlzKGUpWzBdXS5qb2luKCcsJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcodCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0LmtleXModClbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtuXSA9IGcoe30sIGVbbl0sIHRbbl0pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHcodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIHQgPyBbdF0gOiBPYmplY3Qoci5pc0FycmF5KSh0KSA/IHQgOiBlLmdldEFkVW5pdENvZGVzKCkgfHwgW107CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEMoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5nZXRCaWRzUmVjZWl2ZWQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuYi5nZXRDb25maWcoJ3VzZUJpZENhY2hlJykgfHwgKHQgPSB0LmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5bZS5hZFVuaXRDb2RlXSA9PT0gZS5hdWN0aW9uSWQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgdCA9IHQuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHIuZGVlcEFjY2VzcykoZSwgJ3ZpZGVvLmNvbnRleHQnKSAhPT0gdS5hOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYmFubmVyJyAhPT0gZS5tZWRpYVR5cGUgfHwgT2JqZWN0KGMuYykoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUud2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5oZWlnaHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5maWx0ZXIoQS5pc1VudXNlZEJpZCkuZmlsdGVyKEEuaXNCaWROb3RFeHBpcmVkKSwgVCh0LCByLmdldE9sZGVzdEhpZ2hlc3RDcG1CaWQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBSKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0LmdldFdpbm5pbmdCaWRzKGUsIG4pLCBpID0gXygpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciA9IHIubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYih7fSwgZS5hZFVuaXRDb2RlLCBPYmplY3Qua2V5cyhlLmFkc2VydmVyVGFyZ2V0aW5nKS5maWx0ZXIoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSBlLnNlbmRTdGFuZGFyZFRhcmdldGluZyB8fCBlLnNlbmRTdGFuZGFyZFRhcmdldGluZyB8fCAtMSA9PT0gaS5pbmRleE9mKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVkdWNlKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBbZS5hZHNlcnZlclRhcmdldGluZ1tuXV0sIGkgPSBiKHt9LCBuLnN1YnN0cmluZygwLCAyMCksIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID09PSBoLlRBUkdFVElOR19LRVlTLkRFQUwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBiKHt9LCAnJy5jb25jYXQobiwgJ18nKS5jb25jYXQoZS5iaWRkZXJDb2RlKS5zdWJzdHJpbmcoMCwgMjApLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtdLmNvbmNhdCh2KHQpLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtdLmNvbmNhdCh2KHQpLCBbaV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgW10pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF8oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmdldFN0YW5kYXJkQmlkZGVyQWRTZXJ2ZXJUYXJnZXRpbmcoKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmtleTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuY29uY2F0KEUpLmZpbHRlcihyLnVuaXF1ZXMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBVKGUsIHQsIG4sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKHQuYWRzZXJ2ZXJUYXJnZXRpbmcpLmZpbHRlcihCKCkpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubGVuZ3RoICYmIGUuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmFkVW5pdENvZGUgPT09IHQuYWRVbml0Q29kZSAmJiBuLmFkc2VydmVyVGFyZ2V0aW5nW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG4pKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmlzQXJyYXkpKG4uYWRzZXJ2ZXJUYXJnZXRpbmdbZV0pIHx8IChuLmFkc2VydmVyVGFyZ2V0aW5nW2VdID0gW24uYWRzZXJ2ZXJUYXJnZXRpbmdbZV1dKSwgbi5hZHNlcnZlclRhcmdldGluZ1tlXSA9IG4uYWRzZXJ2ZXJUYXJnZXRpbmdbZV0uY29uY2F0KHQuYWRzZXJ2ZXJUYXJnZXRpbmdbZV0pLmZpbHRlcihyLnVuaXF1ZXMpLCBkZWxldGUgdC5hZHNlcnZlclRhcmdldGluZ1tlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlLnB1c2godCksIGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gXygpLmNvbmNhdChvLmEpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSA9PT0gZS5pbmRleE9mKHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB4KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIoe30sIGUuYWRVbml0Q29kZSwgT2JqZWN0LmtleXMoZS5hZHNlcnZlclRhcmdldGluZykuZmlsdGVyKEIoKSkubWFwKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYih7fSwgdC5zdWJzdHJpbmcoMCwgMjApLCBbZS5hZHNlcnZlclRhcmdldGluZ1t0XV0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5maWx0ZXIoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmKCkoZSwgdC5hZFVuaXRDb2RlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyh7fSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZShVLCBbXSkubWFwKHgpLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBrKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBFLmNvbmNhdChvLmEpLCBjID0gaS5iLmdldENvbmZpZygnc2VuZEJpZHNDb250cm9sLmJpZExpbWl0JyksIHUgPSBUKHQsIHIuZ2V0SGlnaGVzdENwbSwgYyksIHMgPSBpLmIuZ2V0Q29uZmlnKCd0YXJnZXRpbmdDb250cm9scy5hbGxvd1NlbmRBbGxCaWRzVGFyZ2V0aW5nS2V5cycpLCBkID0gcyA/IHMubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGguVEFSR0VUSU5HX0tFWVNbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IG47CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1Lm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEodCwgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIoe30sIHQuYWRVbml0Q29kZSwgTih0LCBuLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSB0LmFkc2VydmVyVGFyZ2V0aW5nW2VdICYmIC0xICE9PSBkLmluZGV4T2YoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE4oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5tYXAoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKHt9LCAnJy5jb25jYXQodCwgJ18nKS5jb25jYXQoZS5iaWRkZXJDb2RlKS5zdWJzdHJpbmcoMCwgMjApLCBbZS5hZHNlcnZlclRhcmdldGluZ1t0XV0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gUCh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLmRlZXBBY2Nlc3MpKGUsIGguSlNPTl9NQVBQSU5HLkFEU0VSVkVSX1RBUkdFVElORyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZ2V0QWRVbml0cygpLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYoKSh0LCBlLmNvZGUpICYmIG4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIoe30sIGUuY29kZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKHQpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHIuaXNTdHIpKHRbZV0pICYmICh0W2VdID0gdFtlXS5zcGxpdCgnLCcpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudHJpbSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSksIE9iamVjdChyLmlzQXJyYXkpKHRbZV0pIHx8ICh0W2VdID0gW3RbZV1dKSwgYih7fSwgZSwgdFtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnNldExhdGVzdEF1Y3Rpb25Gb3JBZFVuaXQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICBuW2VdID0gdDsKICAgICAgICAgICAgICAgICAgICB9LCB0LnJlc2V0UHJlc2V0VGFyZ2V0aW5nID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChyLmlzR3B0UHViYWRzRGVmaW5lZCkoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB3KHQpLCBvID0gZS5nZXRBZFVuaXRzKCkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmKCkoaSwgZS5jb2RlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYSA9IG0ucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3RdID0gbnVsbCwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuZ29vZ2xldGFnLnB1YmFkcygpLmdldFNsb3RzKCkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0KHIuaXNGbikobikgJiYgbihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG4uY29kZSA9PT0gZS5nZXRBZFVuaXRQYXRoKCkgfHwgbi5jb2RlID09PSBlLmdldFNsb3RFbGVtZW50SWQoKSB8fCBPYmplY3Qoci5pc0ZuKSh0KSAmJiB0KG4uY29kZSkpICYmIGUudXBkYXRlVGFyZ2V0aW5nRnJvbU1hcChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgdC5yZXNldFByZXNldFRhcmdldGluZ0FTVCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoZSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB3aW5kb3cuYXBudGFnLmdldFRhZyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICYmIHQua2V5d29yZHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5rZXlzKHQua2V5d29yZHMpLCByID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYoKShtLCBlLnRvTG93ZXJDYXNlKCkpIHx8IChyW2VdID0gdC5rZXl3b3Jkc1tlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHdpbmRvdy5hcG50YWcubW9kaWZ5VGFnKGUsIHsga2V5d29yZHM6IHIgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIHQuZ2V0QWxsVGFyZ2V0aW5nID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IEMoKSwgbiA9IHcoZSksIG8gPSBSKG4sIHQpLmNvbmNhdChEKG4sIHQpKS5jb25jYXQoaS5iLmdldENvbmZpZygnZW5hYmxlU2VuZEFsbEJpZHMnKSA/IGsobiwgdCkgOiBzKG4sIHQpKS5jb25jYXQoUChuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIG8ubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhlKS5tYXAoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3RdLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMSA9PT0gbS5pbmRleE9mKE9iamVjdC5rZXlzKGUpWzBdKSAmJiAobSA9IE9iamVjdC5rZXlzKGUpLmNvbmNhdChtKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gT2JqZWN0LmtleXMoZyh7fSwgaC5ERUZBVUxUX1RBUkdFVElOR19LRVlTLCBoLk5BVElWRV9LRVlTKSksIGMgPSBpLmIuZ2V0Q29uZmlnKE8pLCB1ID0gaS5iLmdldENvbmZpZyhqKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gdSAmJiBudWxsICE9IGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoUyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBudWxsICE9IHUgPyBhLmNvbmNhdCh1KSA6IGMgfHwgYSwgQXJyYXkuaXNBcnJheShjKSAmJiBjLmxlbmd0aCA+IDAgJiYgKG8gPSBkKG8sIGMpKSwgbyA9IHkobyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gaS5iLmdldENvbmZpZygndGFyZ2V0aW5nQ29udHJvbHMuYXVjdGlvbktleU1heENoYXJzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmICYmIChPYmplY3Qoci5sb2dJbmZvKSgnRGV0ZWN0ZWQgXCd0YXJnZXRpbmdDb250cm9scy5hdWN0aW9uS2V5TWF4Q2hhcnNcJyB3YXMgYWN0aXZlIGZvciB0aGlzIGF1Y3Rpb247IHNldCB3aXRoIGEgbGltaXQgb2YgJy5jb25jYXQoZiwgJyBjaGFyYWN0ZXJzLiAgUnVubmluZyBjaGVja3Mgb24gYXVjdGlvbiBrZXlzLi4uJykpLCBvID0gbChvLCBmKSksIG4uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb1tlXSB8fCAob1tlXSA9IHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG87CiAgICAgICAgICAgICAgICAgICAgfSwgaS5iLmdldENvbmZpZygndGFyZ2V0aW5nQ29udHJvbHMnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IE9iamVjdChyLmRlZXBBY2Nlc3MpKGUsIE8pICYmIG51bGwgIT0gT2JqZWN0KHIuZGVlcEFjY2VzcykoZSwgaikgJiYgT2JqZWN0KHIubG9nRXJyb3IpKFMpOwogICAgICAgICAgICAgICAgICAgIH0pLCB0LnNldFRhcmdldGluZ0ZvckdQVCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5nb29nbGV0YWcucHViYWRzKCkuZ2V0U2xvdHMoKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhlKS5maWx0ZXIodCA/IHQobikgOiBPYmplY3Qoci5pc0FkVW5pdENvZGVNYXRjaGluZ1Nsb3QpKG4pKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoZVt0XSkuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGVbdF1bbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09IHR5cGVvZiByICYmIC0xICE9PSByLmluZGV4T2YoJywnKSAmJiAociA9IHIuc3BsaXQoJywnKSksIGVbdF1bbl0gPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3Qoci5sb2dNZXNzYWdlKSgnQXR0ZW1wdGluZyB0byBzZXQgdGFyZ2V0aW5nLW1hcCBmb3Igc2xvdDogJy5jb25jYXQobi5nZXRTbG90RWxlbWVudElkKCksICcgd2l0aCB0YXJnZXRpbmctbWFwOicpLCBlW3RdKSwgbi51cGRhdGVUYXJnZXRpbmdGcm9tTWFwKGVbdF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIHQuZ2V0V2lubmluZ0JpZHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDogQygpLCBuID0gdyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZigpKG4sIGUuYWRVbml0Q29kZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLmlzQWxsb3daZXJvQ3BtQmlkc0VuYWJsZWQpKGUuYmlkZGVyQ29kZSkgPyBlLmNwbSA+PSAwIDogZS5jcG0gPiAwOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFkVW5pdENvZGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZpbHRlcihyLnVuaXF1ZXMpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWRVbml0Q29kZSA9PT0gZSA/IHQgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVkdWNlKHIuZ2V0SGlnaGVzdENwbSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIHQuc2V0VGFyZ2V0aW5nRm9yQXN0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LmdldEFsbFRhcmdldGluZyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucmVzZXRQcmVzZXRUYXJnZXRpbmdBU1QoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmxvZ0Vycm9yKSgndW5hYmxlIHRvIHJlc2V0IHRhcmdldGluZyBmb3IgQVNUJyArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKG4pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhuW2VdKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChyLmxvZ01lc3NhZ2UpKCdBdHRlbXB0aW5nIHRvIHNldCB0YXJnZXRpbmcgZm9yIHRhcmdldElkOiAnLmNvbmNhdChlLCAnIGtleTogJykuY29uY2F0KHQsICcgdmFsdWU6ICcpLmNvbmNhdChuW2VdW3RdKSksIE9iamVjdChyLmlzU3RyKShuW2VdW3RdKSB8fCBPYmplY3Qoci5pc0FycmF5KShuW2VdW3RdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNlYXJjaCgvcHRbMC05XS8pIDwgMCA/IGlbdC50b1VwcGVyQ2FzZSgpXSA9IG5bZV1bdF0gOiBpW3RdID0gbltlXVt0XSwgd2luZG93LmFwbnRhZy5zZXRLZXl3b3JkcyhlLCBpLCB7IG92ZXJyaWRlS2V5VmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCB0LmlzQXBudGFnRGVmaW5lZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5hcG50YWcgJiYgT2JqZWN0KHIuaXNGbikod2luZG93LmFwbnRhZy5zZXRLZXl3b3JkcykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfSwgdDsKICAgICAgICAgICAgICAgIH0oYS5hKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNDE6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7fTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNDI6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTcpLCBpID0gbigyNCksIG8gPSBuKDIzKSgnc3BlY2llcycpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiwgYSA9IHIoZSkuY29uc3RydWN0b3I7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PT0gYSB8fCBudWxsID09IChuID0gcihhKVtvXSkgPyB0IDogaShuKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDQzOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdC5hID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGkoZSwgdCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDApOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0ICYmIHQuc3JjIHx8ICdjbGllbnQnLCBpID0gZSB8fCAwOwogICAgICAgICAgICAgICAgICAgIHRoaXMuYmlkZGVyQ29kZSA9IHQgJiYgdC5iaWRkZXIgfHwgJycsIHRoaXMud2lkdGggPSAwLCB0aGlzLmhlaWdodCA9IDAsIHRoaXMuc3RhdHVzTWVzc2FnZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnUGVuZGluZyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnQmlkIGF2YWlsYWJsZSc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnQmlkIHJldHVybmVkIGVtcHR5IG9yIGVycm9yIHJlc3BvbnNlJzsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdCaWQgdGltZWQgb3V0JzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oKSwgdGhpcy5hZElkID0gT2JqZWN0KHIuZ2V0VW5pcXVlSWRlbnRpZmllclN0cikoKSwgdGhpcy5yZXF1ZXN0SWQgPSB0ICYmIHQuYmlkSWQsIHRoaXMubWVkaWFUeXBlID0gJ2Jhbm5lcicsIHRoaXMuc291cmNlID0gbiwgdGhpcy5nZXRTdGF0dXNDb2RlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLmdldFNpemUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLndpZHRoICsgJ3gnICsgdGhpcy5oZWlnaHQ7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgNDQ6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEoMSAmIGUpLAogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEoMiAmIGUpLAogICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogISg0ICYgZSksCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB0CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDQ1OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0ge307CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDQ1ODogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oNDU5KTsKICAgICAgICAgICAgICAgIHZhciByID0gbig0NSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByLlVSTFNlYXJjaFBhcmFtczsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNDU5OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgbig5OSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpLCBpID0gbigyNiksIG8gPSBuKDQ2MCksIGEgPSBuKDcxKSwgYyA9IG4oOTQpLCB1ID0gbig1OSksIHMgPSBuKDk1KSwgZCA9IG4oNDYpLCBmID0gbig2OCksIGwgPSBuKDMxKSwgcCA9IG4oMjUpLCBnID0gbig1OCksIGIgPSBuKDE3KSwgdiA9IG4oMzApLCB5ID0gbig3MCksIGggPSBuKDQ0KSwgbSA9IG4oNzMpLCBPID0gbig1NyksIGogPSBuKDIzKSwgUyA9IGkoJ2ZldGNoJyksIEUgPSBpKCdIZWFkZXJzJyksIEEgPSBqKCdpdGVyYXRvcicpLCBUID0gJ1VSTFNlYXJjaFBhcmFtcycsIEkgPSAnVVJMU2VhcmNoUGFyYW1zSXRlcmF0b3InLCB3ID0gZC5zZXQsIEMgPSBkLmdldHRlckZvcihUKSwgUiA9IGQuZ2V0dGVyRm9yKEkpLCBfID0gL1wrL2csIFUgPSBBcnJheSg0KSwgQiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVW2UgLSAxXSB8fCAoVVtlIC0gMV0gPSBSZWdFeHAoJygoPzolW1xcZGEtZl17Mn0peycgKyBlICsgJ30pJywgJ2dpJykpOwogICAgICAgICAgICAgICAgICAgIH0sIHggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRlY29kZVVSSUNvbXBvbmVudChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBEID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJlcGxhY2UoXywgJyAnKSwgbiA9IDQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGVjb2RlVVJJQ29tcG9uZW50KHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbjspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQucmVwbGFjZShCKG4tLSksIHgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBrID0gL1shJygpfl18JTIwL2csIE4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICchJzogJyUyMScsCiAgICAgICAgICAgICAgICAgICAgICAgICdcJyc6ICclMjcnLAogICAgICAgICAgICAgICAgICAgICAgICAnKCc6ICclMjgnLAogICAgICAgICAgICAgICAgICAgICAgICAnKSc6ICclMjknLAogICAgICAgICAgICAgICAgICAgICAgICAnfic6ICclN0UnLAogICAgICAgICAgICAgICAgICAgICAgICAnJTIwJzogJysnCiAgICAgICAgICAgICAgICAgICAgfSwgUCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOW2VdOwogICAgICAgICAgICAgICAgICAgIH0sIHEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW5jb2RlVVJJQ29tcG9uZW50KGUpLnJlcGxhY2UoaywgUCk7CiAgICAgICAgICAgICAgICAgICAgfSwgTSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiwgciwgaSA9IHQuc3BsaXQoJyYnKSwgbyA9IDA7IG8gPCBpLmxlbmd0aDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG4gPSBpW28rK10pLmxlbmd0aCAmJiAociA9IG4uc3BsaXQoJz0nKSwgZS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiBEKHIuc2hpZnQoKSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBEKHIuam9pbignPScpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICB9LCBHID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5lbnRyaWVzLmxlbmd0aCA9IDAsIE0odGhpcy5lbnRyaWVzLCBlKTsKICAgICAgICAgICAgICAgICAgICB9LCBMID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPCB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKCdOb3QgZW5vdWdoIGFyZ3VtZW50cycpOwogICAgICAgICAgICAgICAgICAgIH0sIFcgPSBzKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHcodGhpcywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogSSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZXJhdG9yOiBtKEMoZSkuZW50cmllcyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBraW5kOiB0CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sICdJdGVyYXRvcicsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBSKHRoaXMpLCB0ID0gZS5raW5kLCBuID0gZS5pdGVyYXRvci5uZXh0KCksIHIgPSBuLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5kb25lIHx8IChuLnZhbHVlID0gJ2tleXMnID09PSB0ID8gci5rZXkgOiAndmFsdWVzJyA9PT0gdCA/IHIudmFsdWUgOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmtleSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIudmFsdWUKICAgICAgICAgICAgICAgICAgICAgICAgXSksIG47CiAgICAgICAgICAgICAgICAgICAgfSksIEYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGYodGhpcywgRiwgVCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0LCBuLCByLCBpLCBvLCBhLCBjLCB1LCBzID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgPyBhcmd1bWVudHNbMF0gOiB2b2lkIDAsIGQgPSB0aGlzLCBwID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3KGQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudHJpZXM6IHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlVVJMOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVTZWFyY2hQYXJhbXM6IEcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB2b2lkIDAgIT09IHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodihzKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgKGUgPSBPKHMpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gKHQgPSBlLmNhbGwocykpLm5leHQ7ICEociA9IG4uY2FsbCh0KSkuZG9uZTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoYSA9IChvID0gKGkgPSBtKGIoci52YWx1ZSkpKS5uZXh0KS5jYWxsKGkpKS5kb25lIHx8IChjID0gby5jYWxsKGkpKS5kb25lIHx8ICFvLmNhbGwoaSkuZG9uZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ0V4cGVjdGVkIHNlcXVlbmNlIHdpdGggbGVuZ3RoIDInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiBhLnZhbHVlICsgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGMudmFsdWUgKyAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodSBpbiBzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbChzLCB1KSAmJiBwLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogc1t1XSArICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNKHAsICdzdHJpbmcnID09IHR5cGVvZiBzID8gJz8nID09PSBzLmNoYXJBdCgwKSA/IHMuc2xpY2UoMSkgOiBzIDogcyArICcnKTsKICAgICAgICAgICAgICAgICAgICB9LCB6ID0gRi5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICBjKHosIHsKICAgICAgICAgICAgICAgICAgICBhcHBlbmQ6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEwoYXJndW1lbnRzLmxlbmd0aCwgMik7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gQyh0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgbi5lbnRyaWVzLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiBlICsgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdCArICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuLnVwZGF0ZVVSTCgpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZGVsZXRlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBMKGFyZ3VtZW50cy5sZW5ndGgsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gQyh0aGlzKSwgbiA9IHQuZW50cmllcywgciA9IGUgKyAnJywgaSA9IDA7IGkgPCBuLmxlbmd0aDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW2ldLmtleSA9PT0gciA/IG4uc3BsaWNlKGksIDEpIDogaSsrOwogICAgICAgICAgICAgICAgICAgICAgICB0LnVwZGF0ZVVSTCgpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBMKGFyZ3VtZW50cy5sZW5ndGgsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gQyh0aGlzKS5lbnRyaWVzLCBuID0gZSArICcnLCByID0gMDsgciA8IHQubGVuZ3RoOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodFtyXS5rZXkgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbcl0udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZ2V0QWxsOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBMKGFyZ3VtZW50cy5sZW5ndGgsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gQyh0aGlzKS5lbnRyaWVzLCBuID0gZSArICcnLCByID0gW10sIGkgPSAwOyBpIDwgdC5sZW5ndGg7IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbaV0ua2V5ID09PSBuICYmIHIucHVzaCh0W2ldLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBoYXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEwoYXJndW1lbnRzLmxlbmd0aCwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBDKHRoaXMpLmVudHJpZXMsIG4gPSBlICsgJycsIHIgPSAwOyByIDwgdC5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRbcisrXS5rZXkgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEwoYXJndW1lbnRzLmxlbmd0aCwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4sIHIgPSBDKHRoaXMpLCBpID0gci5lbnRyaWVzLCBvID0gITEsIGEgPSBlICsgJycsIGMgPSB0ICsgJycsIHUgPSAwOyB1IDwgaS5sZW5ndGg7IHUrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChuID0gaVt1XSkua2V5ID09PSBhICYmIChvID8gaS5zcGxpY2UodS0tLCAxKSA6IChvID0gITAsIG4udmFsdWUgPSBjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIG8gfHwgaS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBjCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLnVwZGF0ZVVSTCgpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgc29ydDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSwgdCwgbiwgciA9IEModGhpcyksIGkgPSByLmVudHJpZXMsIG8gPSBpLnNsaWNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaS5sZW5ndGggPSAwLCBuID0gMDsgbiA8IG8ubGVuZ3RoOyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IG9bbl0sIHQgPSAwOyB0IDwgbjsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpW3RdLmtleSA+IGUua2V5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuc3BsaWNlKHQsIDAsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID09PSBuICYmIGkucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByLnVwZGF0ZVVSTCgpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZm9yRWFjaDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCwgbiA9IEModGhpcykuZW50cmllcywgciA9IHAoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpLCBpID0gMDsgaSA8IG4ubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoKHQgPSBuW2krK10pLnZhbHVlLCB0LmtleSwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBrZXlzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVyh0aGlzLCAna2V5cycpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVyh0aGlzLCAndmFsdWVzJyk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBlbnRyaWVzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVyh0aGlzLCAnZW50cmllcycpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHsgZW51bWVyYWJsZTogITAgfSksIGEoeiwgQSwgei5lbnRyaWVzKSwgYSh6LCAndG9TdHJpbmcnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSwgdCA9IEModGhpcykuZW50cmllcywgbiA9IFtdLCByID0gMDsgciA8IHQubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHRbcisrXSwgbi5wdXNoKHEoZS5rZXkpICsgJz0nICsgcShlLnZhbHVlKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uam9pbignJicpOwogICAgICAgICAgICAgICAgfSwgeyBlbnVtZXJhYmxlOiAhMCB9KSwgdShGLCBUKSwgcih7CiAgICAgICAgICAgICAgICAgICAgZ2xvYmFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6ICFvCiAgICAgICAgICAgICAgICB9LCB7IFVSTFNlYXJjaFBhcmFtczogRiB9KSwgbyB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBTIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIEUgfHwgcih7CiAgICAgICAgICAgICAgICAgICAgZ2xvYmFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6ICEwCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZmV0Y2g6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByLCBpID0gW2VdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgKHYodCA9IGFyZ3VtZW50c1sxXSkgJiYgKG4gPSB0LmJvZHksIGcobikgPT09IFQgJiYgKChyID0gdC5oZWFkZXJzID8gbmV3IEUodC5oZWFkZXJzKSA6IG5ldyBFKCkpLmhhcygnY29udGVudC10eXBlJykgfHwgci5zZXQoJ2NvbnRlbnQtdHlwZScsICdhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQ7Y2hhcnNldD1VVEYtOCcpLCB0ID0geSh0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBoKDAsIFN0cmluZyhuKSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBoKDAsIHIpCiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSksIGkucHVzaCh0KSksIFMuYXBwbHkodGhpcywgaSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSksIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBVUkxTZWFyY2hQYXJhbXM6IEYsCiAgICAgICAgICAgICAgICAgICAgZ2V0U3RhdGU6IEMKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDQ2OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIsIGksIG8sIGEgPSBuKDEyNCksIGMgPSBuKDI3KSwgdSA9IG4oMzApLCBzID0gbigzMiksIGQgPSBuKDMxKSwgZiA9IG4oNjUpLCBsID0gbig2OSksIHAgPSBuKDU2KSwgZyA9ICdPYmplY3QgYWxyZWFkeSBpbml0aWFsaXplZCcsIGIgPSBjLldlYWtNYXA7CiAgICAgICAgICAgICAgICBpZiAoYSB8fCBmLnN0YXRlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSBmLnN0YXRlIHx8IChmLnN0YXRlID0gbmV3IGIoKSksIHkgPSB2LmdldCwgaCA9IHYuaGFzLCBtID0gdi5zZXQ7CiAgICAgICAgICAgICAgICAgICAgciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoLmNhbGwodiwgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKGcpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5mYWNhZGUgPSBlLCBtLmNhbGwodiwgZSwgdCksIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5LmNhbGwodiwgZSkgfHwge307CiAgICAgICAgICAgICAgICAgICAgfSwgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoLmNhbGwodiwgZSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIE8gPSBsKCdzdGF0ZScpOwogICAgICAgICAgICAgICAgICAgIHBbT10gPSAhMCwgciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkKGUsIE8pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihnKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZmFjYWRlID0gZSwgcyhlLCBPLCB0KSwgdDsKICAgICAgICAgICAgICAgICAgICB9LCBpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgTykgPyBlW09dIDoge307CiAgICAgICAgICAgICAgICAgICAgfSwgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKGUsIE8pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgc2V0OiByLAogICAgICAgICAgICAgICAgICAgIGdldDogaSwKICAgICAgICAgICAgICAgICAgICBoYXM6IG8sCiAgICAgICAgICAgICAgICAgICAgZW5mb3JjZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSkgPyBpKGUpIDogcihlLCB7fSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBnZXR0ZXJGb3I6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXUodCkgfHwgKG4gPSBpKHQpKS50eXBlICE9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignSW5jb21wYXRpYmxlIHJlY2VpdmVyLCAnICsgZSArICcgcmVxdWlyZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDQ2MDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyOSksIGkgPSBuKDIzKSwgbyA9IG4oMTgpLCBhID0gaSgnaXRlcmF0b3InKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9ICFyKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyBVUkwoJ2I/YT0xJmI9MiZjPTMnLCAnaHR0cDovL2EnKSwgdCA9IGUuc2VhcmNoUGFyYW1zLCBuID0gJyc7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucGF0aG5hbWUgPSAnYyUyMGQnLCB0LmZvckVhY2goZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdC5kZWxldGUoJ2InKSwgbiArPSByICsgZTsKICAgICAgICAgICAgICAgICAgICB9KSwgbyAmJiAhZS50b0pTT04gfHwgIXQuc29ydCB8fCAnaHR0cDovL2EvYyUyMGQ/YT0xJmM9MycgIT09IGUuaHJlZiB8fCAnMycgIT09IHQuZ2V0KCdjJykgfHwgJ2E9MScgIT09IFN0cmluZyhuZXcgVVJMU2VhcmNoUGFyYW1zKCc/YT0xJykpIHx8ICF0W2FdIHx8ICdhJyAhPT0gbmV3IFVSTCgnaHR0cHM6Ly9hQGInKS51c2VybmFtZSB8fCAnYicgIT09IG5ldyBVUkxTZWFyY2hQYXJhbXMobmV3IFVSTFNlYXJjaFBhcmFtcygnYT1iJykpLmdldCgnYScpIHx8ICd4bi0tZTFheWJjJyAhPT0gbmV3IFVSTCgnaHR0cDovL9GC0LXRgdGCJykuaG9zdCB8fCAnIyVEMCVCMScgIT09IG5ldyBVUkwoJ2h0dHA6Ly9hI9CxJykuaGFzaCB8fCAnYTFjMycgIT09IG4gfHwgJ3gnICE9PSBuZXcgVVJMKCdodHRwOi8veCcsIHZvaWQgMCkuaG9zdDsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICA0ODogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIG4uZCh0LCAnYScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgIH0pLCBuLmQodCwgJ2InLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHA7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMSksIGkgPSBuLm4ociksIG8gPSBuKDApLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICBidWNrZXRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heDogNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmNyZW1lbnQ6IDAuNQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgICAgICB9LCBjID0gewogICAgICAgICAgICAgICAgICAgICAgICBidWNrZXRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heDogMjAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5jcmVtZW50OiAwLjEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgfSwgdSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYnVja2V0czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXg6IDIwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluY3JlbWVudDogMC4wMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgICAgICB9LCBzID0gewogICAgICAgICAgICAgICAgICAgICAgICBidWNrZXRzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4OiAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluY3JlbWVudDogMC4wMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXg6IDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5jcmVtZW50OiAwLjA1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heDogMjAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5jcmVtZW50OiAwLjUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sIGQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJ1Y2tldHM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXg6IDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5jcmVtZW50OiAwLjA1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heDogMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5jcmVtZW50OiAwLjEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4OiAyMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmNyZW1lbnQ6IDAuNQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMl0gPyBhcmd1bWVudHNbMl0gOiAxLCByID0gcGFyc2VGbG9hdChlKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNOYU4ocikgJiYgKHIgPSAnJyksIHsKICAgICAgICAgICAgICAgICAgICAgICAgbG93OiAnJyA9PT0gciA/ICcnIDogbChlLCBhLCBuKSwKICAgICAgICAgICAgICAgICAgICAgICAgbWVkOiAnJyA9PT0gciA/ICcnIDogbChlLCBjLCBuKSwKICAgICAgICAgICAgICAgICAgICAgICAgaGlnaDogJycgPT09IHIgPyAnJyA6IGwoZSwgdSwgbiksCiAgICAgICAgICAgICAgICAgICAgICAgIGF1dG86ICcnID09PSByID8gJycgOiBsKGUsIGQsIG4pLAogICAgICAgICAgICAgICAgICAgICAgICBkZW5zZTogJycgPT09IHIgPyAnJyA6IGwoZSwgcywgbiksCiAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbTogJycgPT09IHIgPyAnJyA6IGwoZSwgdCwgbikKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAnJzsKICAgICAgICAgICAgICAgICAgICBpZiAoIXAodCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgIHZhciBvID0gdC5idWNrZXRzLnJlZHVjZShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubWF4ID4gdC5tYXggPyBlIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgeyBtYXg6IDAgfSksIGEgPSAwLCBjID0gaSgpKHQuYnVja2V0cywgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID4gby5tYXggKiBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0LnByZWNpc2lvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGkgJiYgKGkgPSAyKSwgciA9ICh0Lm1heCAqIG4pLnRvRml4ZWQoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIDw9IHQubWF4ICogbiAmJiBlID49IGEgKiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5taW4gPSBhLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB0Lm1heDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgJiYgKHIgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHZvaWQgMCAhPT0gdC5wcmVjaXNpb24gPyB0LnByZWNpc2lvbiA6IDIsIGkgPSB0LmluY3JlbWVudCAqIG4sIG8gPSB0Lm1pbiAqIG4sIGEgPSBNYXRoLnBvdygxMCwgciArIDIpLCBjID0gKGUgKiBhIC0gbyAqIGEpIC8gKGkgKiBhKSwgdSA9IE1hdGguZmxvb3IoYykgKiBpICsgbzsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICh1ID0gTnVtYmVyKHUudG9GaXhlZCgxMCkpKS50b0ZpeGVkKHIpOwogICAgICAgICAgICAgICAgICAgIH0oZSwgYywgbikpLCByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChvLmlzRW1wdHkpKGUpIHx8ICFlLmJ1Y2tldHMgfHwgIUFycmF5LmlzQXJyYXkoZS5idWNrZXRzKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gITA7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYnVja2V0cy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUubWF4ICYmIGUuaW5jcmVtZW50IHx8ICh0ID0gITEpOwogICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICA0OTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig4MyksIGkgPSBuKDUxKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoaShlKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICA1OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgIEpTT05fTUFQUElORzogewogICAgICAgICAgICAgICAgICAgICAgICBQTF9DT0RFOiAnY29kZScsCiAgICAgICAgICAgICAgICAgICAgICAgIFBMX1NJWkU6ICdzaXplcycsCiAgICAgICAgICAgICAgICAgICAgICAgIFBMX0JJRFM6ICdiaWRzJywKICAgICAgICAgICAgICAgICAgICAgICAgQkRfQklEREVSOiAnYmlkZGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgQkRfSUQ6ICdwYXJhbXNkJywKICAgICAgICAgICAgICAgICAgICAgICAgQkRfUExfSUQ6ICdwbGFjZW1lbnRJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIEFEU0VSVkVSX1RBUkdFVElORzogJ2Fkc2VydmVyVGFyZ2V0aW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgQkRfU0VUVElOR19TVEFOREFSRDogJ3N0YW5kYXJkJwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgREVCVUdfTU9ERTogJ3BianNfZGVidWcnLAogICAgICAgICAgICAgICAgICAgIFNUQVRVUzogewogICAgICAgICAgICAgICAgICAgICAgICBHT09EOiAxLAogICAgICAgICAgICAgICAgICAgICAgICBOT19CSUQ6IDIKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIENCOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIFRZUEU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFMTF9CSURTX0JBQ0s6ICdhbGxSZXF1ZXN0ZWRCaWRzQmFjaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBBRF9VTklUX0JJRFNfQkFDSzogJ2FkVW5pdEJpZHNCYWNrJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJJRF9XT046ICdiaWRXb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVRVUVTVF9CSURTOiAncmVxdWVzdEJpZHMnCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIEVWRU5UUzogewogICAgICAgICAgICAgICAgICAgICAgICBBVUNUSU9OX0lOSVQ6ICdhdWN0aW9uSW5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgIEFVQ1RJT05fRU5EOiAnYXVjdGlvbkVuZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIEJJRF9BREpVU1RNRU5UOiAnYmlkQWRqdXN0bWVudCcsCiAgICAgICAgICAgICAgICAgICAgICAgIEJJRF9USU1FT1VUOiAnYmlkVGltZW91dCcsCiAgICAgICAgICAgICAgICAgICAgICAgIEJJRF9SRVFVRVNURUQ6ICdiaWRSZXF1ZXN0ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICBCSURfUkVTUE9OU0U6ICdiaWRSZXNwb25zZScsCiAgICAgICAgICAgICAgICAgICAgICAgIE5PX0JJRDogJ25vQmlkJywKICAgICAgICAgICAgICAgICAgICAgICAgQklEX1dPTjogJ2JpZFdvbicsCiAgICAgICAgICAgICAgICAgICAgICAgIEJJRERFUl9ET05FOiAnYmlkZGVyRG9uZScsCiAgICAgICAgICAgICAgICAgICAgICAgIEJJRERFUl9FUlJPUjogJ2JpZGRlckVycm9yJywKICAgICAgICAgICAgICAgICAgICAgICAgU0VUX1RBUkdFVElORzogJ3NldFRhcmdldGluZycsCiAgICAgICAgICAgICAgICAgICAgICAgIEJFRk9SRV9SRVFVRVNUX0JJRFM6ICdiZWZvcmVSZXF1ZXN0QmlkcycsCiAgICAgICAgICAgICAgICAgICAgICAgIEJFRk9SRV9CSURERVJfSFRUUDogJ2JlZm9yZUJpZGRlckh0dHAnLAogICAgICAgICAgICAgICAgICAgICAgICBSRVFVRVNUX0JJRFM6ICdyZXF1ZXN0QmlkcycsCiAgICAgICAgICAgICAgICAgICAgICAgIEFERF9BRF9VTklUUzogJ2FkZEFkVW5pdHMnLAogICAgICAgICAgICAgICAgICAgICAgICBBRF9SRU5ERVJfRkFJTEVEOiAnYWRSZW5kZXJGYWlsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICBBRF9SRU5ERVJfU1VDQ0VFREVEOiAnYWRSZW5kZXJTdWNjZWVkZWQnLAogICAgICAgICAgICAgICAgICAgICAgICBUQ0YyX0VORk9SQ0VNRU5UOiAndGNmMkVuZm9yY2VtZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgQVVDVElPTl9ERUJVRzogJ2F1Y3Rpb25EZWJ1ZycsCiAgICAgICAgICAgICAgICAgICAgICAgIEJJRF9WSUVXQUJMRTogJ2JpZFZpZXdhYmxlJywKICAgICAgICAgICAgICAgICAgICAgICAgU1RBTEVfUkVOREVSOiAnc3RhbGVSZW5kZXInCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBBRF9SRU5ERVJfRkFJTEVEX1JFQVNPTjogewogICAgICAgICAgICAgICAgICAgICAgICBQUkVWRU5UX1dSSVRJTkdfT05fTUFJTl9ET0NVTUVOVDogJ3ByZXZlbnRXcml0aW5nT25NYWluRG9jdW1lbnQnLAogICAgICAgICAgICAgICAgICAgICAgICBOT19BRDogJ25vQWQnLAogICAgICAgICAgICAgICAgICAgICAgICBFWENFUFRJT046ICdleGNlcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICBDQU5OT1RfRklORF9BRDogJ2Nhbm5vdEZpbmRBZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIE1JU1NJTkdfRE9DX09SX0FESUQ6ICdtaXNzaW5nRG9jT3JBZGlkJwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgRVZFTlRfSURfUEFUSFM6IHsgYmlkV29uOiAnYWRVbml0Q29kZScgfSwKICAgICAgICAgICAgICAgICAgICBHUkFOVUxBUklUWV9PUFRJT05TOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIExPVzogJ2xvdycsCiAgICAgICAgICAgICAgICAgICAgICAgIE1FRElVTTogJ21lZGl1bScsCiAgICAgICAgICAgICAgICAgICAgICAgIEhJR0g6ICdoaWdoJywKICAgICAgICAgICAgICAgICAgICAgICAgQVVUTzogJ2F1dG8nLAogICAgICAgICAgICAgICAgICAgICAgICBERU5TRTogJ2RlbnNlJywKICAgICAgICAgICAgICAgICAgICAgICAgQ1VTVE9NOiAnY3VzdG9tJwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgVEFSR0VUSU5HX0tFWVM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgQklEREVSOiAnaGJfYmlkZGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgQURfSUQ6ICdoYl9hZGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgUFJJQ0VfQlVDS0VUOiAnaGJfcGInLAogICAgICAgICAgICAgICAgICAgICAgICBTSVpFOiAnaGJfc2l6ZScsCiAgICAgICAgICAgICAgICAgICAgICAgIERFQUw6ICdoYl9kZWFsJywKICAgICAgICAgICAgICAgICAgICAgICAgU09VUkNFOiAnaGJfc291cmNlJywKICAgICAgICAgICAgICAgICAgICAgICAgRk9STUFUOiAnaGJfZm9ybWF0JywKICAgICAgICAgICAgICAgICAgICAgICAgVVVJRDogJ2hiX3V1aWQnLAogICAgICAgICAgICAgICAgICAgICAgICBDQUNIRV9JRDogJ2hiX2NhY2hlX2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgQ0FDSEVfSE9TVDogJ2hiX2NhY2hlX2hvc3QnLAogICAgICAgICAgICAgICAgICAgICAgICBBRE9NQUlOOiAnaGJfYWRvbWFpbicKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIERFRkFVTFRfVEFSR0VUSU5HX0tFWVM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgQklEREVSOiAnaGJfYmlkZGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgQURfSUQ6ICdoYl9hZGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgUFJJQ0VfQlVDS0VUOiAnaGJfcGInLAogICAgICAgICAgICAgICAgICAgICAgICBTSVpFOiAnaGJfc2l6ZScsCiAgICAgICAgICAgICAgICAgICAgICAgIERFQUw6ICdoYl9kZWFsJywKICAgICAgICAgICAgICAgICAgICAgICAgRk9STUFUOiAnaGJfZm9ybWF0JywKICAgICAgICAgICAgICAgICAgICAgICAgVVVJRDogJ2hiX3V1aWQnLAogICAgICAgICAgICAgICAgICAgICAgICBDQUNIRV9IT1NUOiAnaGJfY2FjaGVfaG9zdCcKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIE5BVElWRV9LRVlTOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAnaGJfbmF0aXZlX3RpdGxlJywKICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogJ2hiX25hdGl2ZV9ib2R5JywKICAgICAgICAgICAgICAgICAgICAgICAgYm9keTI6ICdoYl9uYXRpdmVfYm9keTInLAogICAgICAgICAgICAgICAgICAgICAgICBwcml2YWN5TGluazogJ2hiX25hdGl2ZV9wcml2YWN5JywKICAgICAgICAgICAgICAgICAgICAgICAgcHJpdmFjeUljb246ICdoYl9uYXRpdmVfcHJpdmljb24nLAogICAgICAgICAgICAgICAgICAgICAgICBzcG9uc29yZWRCeTogJ2hiX25hdGl2ZV9icmFuZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGltYWdlOiAnaGJfbmF0aXZlX2ltYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgaWNvbjogJ2hiX25hdGl2ZV9pY29uJywKICAgICAgICAgICAgICAgICAgICAgICAgY2xpY2tVcmw6ICdoYl9uYXRpdmVfbGlua3VybCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlVcmw6ICdoYl9uYXRpdmVfZGlzcGxheXVybCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGN0YTogJ2hiX25hdGl2ZV9jdGEnLAogICAgICAgICAgICAgICAgICAgICAgICByYXRpbmc6ICdoYl9uYXRpdmVfcmF0aW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgYWRkcmVzczogJ2hiX25hdGl2ZV9hZGRyZXNzJywKICAgICAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRzOiAnaGJfbmF0aXZlX2Rvd25sb2FkcycsCiAgICAgICAgICAgICAgICAgICAgICAgIGxpa2VzOiAnaGJfbmF0aXZlX2xpa2VzJywKICAgICAgICAgICAgICAgICAgICAgICAgcGhvbmU6ICdoYl9uYXRpdmVfcGhvbmUnLAogICAgICAgICAgICAgICAgICAgICAgICBwcmljZTogJ2hiX25hdGl2ZV9wcmljZScsCiAgICAgICAgICAgICAgICAgICAgICAgIHNhbGVQcmljZTogJ2hiX25hdGl2ZV9zYWxlcHJpY2UnLAogICAgICAgICAgICAgICAgICAgICAgICByZW5kZXJlclVybDogJ2hiX3JlbmRlcmVyX3VybCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGFkVGVtcGxhdGU6ICdoYl9hZFRlbXBsYXRlJwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgUzJTOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIFNSQzogJ3MycycsCiAgICAgICAgICAgICAgICAgICAgICAgIERFRkFVTFRfRU5EUE9JTlQ6ICdodHRwczovL3ByZWJpZC5hZG54cy5jb20vcGJzL3YxL29wZW5ydGIyL2F1Y3Rpb24nLAogICAgICAgICAgICAgICAgICAgICAgICBTWU5DRURfQklEREVSU19LRVk6ICdwYmpzU3luY3MnCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBCSURfU1RBVFVTOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIEJJRF9UQVJHRVRJTkdfU0VUOiAndGFyZ2V0aW5nU2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgUkVOREVSRUQ6ICdyZW5kZXJlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIEJJRF9SRUpFQ1RFRDogJ2JpZFJlamVjdGVkJwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDUwOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgdmFyIG4gPSB7fS50b1N0cmluZzsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2FsbChlKS5zbGljZSg4LCAtMSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICA1MTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKCdDYW5cJ3QgY2FsbCBtZXRob2Qgb24gJyArIGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNTI6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNTEpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHIoZSkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNTM6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNjQpLCBpID0gTWF0aC5taW47CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID4gMCA/IGkocihlKSwgOTAwNzE5OTI1NDc0MDk5MSkgOiAwOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNTQ6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICA1NTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByOwogICAgICAgICAgICB9LAogICAgICAgICAgICA1NjogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHt9OwogICAgICAgICAgICB9LAogICAgICAgICAgICA1NzogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig1OCksIGkgPSBuKDQxKSwgbyA9IG4oMjMpKCdpdGVyYXRvcicpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtvXSB8fCBlWydAQGl0ZXJhdG9yJ10gfHwgaVtyKGUpXTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDU4OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDY3KSwgaSA9IG4oNTApLCBvID0gbigyMykoJ3RvU3RyaW5nVGFnJyksIGEgPSAnQXJndW1lbnRzJyA9PSBpKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFyZ3VtZW50czsKICAgICAgICAgICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gciA/IGkgOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGUgPyAnVW5kZWZpbmVkJyA6IG51bGwgPT09IGUgPyAnTnVsbCcgOiAnc3RyaW5nJyA9PSB0eXBlb2YgKG4gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0odCA9IE9iamVjdChlKSwgbykpID8gbiA6IGEgPyBpKHQpIDogJ09iamVjdCcgPT0gKHIgPSBpKHQpKSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiB0LmNhbGxlZSA/ICdBcmd1bWVudHMnIDogcjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDU5OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDY3KSwgaSA9IG4oMzQpLmYsIG8gPSBuKDMyKSwgYSA9IG4oMzEpLCBjID0gbigxMjMpLCB1ID0gbigyMykoJ3RvU3RyaW5nVGFnJyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbiwgcykgewogICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gbiA/IGUgOiBlLnByb3RvdHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgYShkLCB1KSB8fCBpKGQsIHUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgcyAmJiAhciAmJiBvKGQsICd0b1N0cmluZycsIGMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDYwOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgbi5kKHQsICdhJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBwOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMCksIGkgPSBuKDMpLCBvID0gbigxMiksIGEgPSBuLm4obyksIGMgPSBuKDcpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfShlKSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG51bGwgPT0gZSA/IG51bGwgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgU3ltYm9sICYmIGVbU3ltYm9sLml0ZXJhdG9yXSB8fCBlWydAQGl0ZXJhdG9yJ107CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBpLCBvID0gW10sIGEgPSAhMCwgYyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gbi5jYWxsKGUpOyAhKGEgPSAociA9IG4ubmV4dCgpKS5kb25lKSAmJiAoby5wdXNoKHIudmFsdWUpLCAhdCB8fCBvLmxlbmd0aCAhPT0gdCk7IGEgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAhMCwgaSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgfHwgbnVsbCA9PSBuLnJldHVybiB8fCBuLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICB9KGUsIHQpIHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpLnNsaWNlKDgsIC0xKTsKICAgICAgICAgICAgICAgICAgICAgICAgJ09iamVjdCcgPT09IG4gJiYgZS5jb25zdHJ1Y3RvciAmJiAobiA9IGUuY29uc3RydWN0b3IubmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnTWFwJyA9PT0gbiB8fCAnU2V0JyA9PT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5mcm9tKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ0FyZ3VtZW50cycgPT09IG4gfHwgL14oPzpVaXxJKW50KD86OHwxNnwzMikoPzpDbGFtcGVkKT9BcnJheSQvLnRlc3QobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9KGUsIHQpIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSW52YWxpZCBhdHRlbXB0IHRvIGRlc3RydWN0dXJlIG5vbi1pdGVyYWJsZSBpbnN0YW5jZS5cbkluIG9yZGVyIHRvIGJlIGl0ZXJhYmxlLCBub24tYXJyYXkgb2JqZWN0cyBtdXN0IGhhdmUgYSBbU3ltYm9sLml0ZXJhdG9yXSgpIG1ldGhvZC4nKTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAobnVsbCA9PSB0IHx8IHQgPiBlLmxlbmd0aCkgJiYgKHQgPSBlLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDAsIHIgPSBuZXcgQXJyYXkodCk7IG4gPCB0OyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHJbbl0gPSBlW25dOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZCgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGQgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgcikgJiYgKGVbcl0gPSBuW3JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaS5iLnNldERlZmF1bHRzKHsKICAgICAgICAgICAgICAgICAgICB1c2VyU3luYzogT2JqZWN0KHIuZGVlcENsb25lKSh7CiAgICAgICAgICAgICAgICAgICAgICAgIHN5bmNFbmFibGVkOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZmlsdGVyU2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltYWdlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZGVyczogJyonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbHRlcjogJ2luY2x1ZGUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN5bmNzUGVyQmlkZGVyOiA1LAogICAgICAgICAgICAgICAgICAgICAgICBzeW5jRGVsYXk6IDMwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgIGF1Y3Rpb25EZWxheTogMAogICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciBmID0gT2JqZWN0KGMuYSkoJ3VzZXJzeW5jJyk7CiAgICAgICAgICAgICAgICB2YXIgbCA9ICFPYmplY3Qoci5pc1NhZmFyaUJyb3dzZXIpKCkgJiYgZi5jb29raWVzQXJlRW5hYmxlZCgpLCBwID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fSwgbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbWFnZTogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyYW1lOiBbXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbyA9IG5ldyBTZXQoKSwgYyA9IHt9LCBzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltYWdlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZnJhbWU6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmID0gZS5jb25maWc7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZi5zeW5jRW5hYmxlZCAmJiBlLmJyb3dzZXJTdXBwb3J0c0Nvb2tpZXMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzLmlmcmFtZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKG4uaWZyYW1lLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdShlLCAyKSwgaSA9IHRbMF0sIG8gPSB0WzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmxvZ01lc3NhZ2UpKCdJbnZva2luZyBpZnJhbWUgdXNlciBzeW5jIGZvciBiaWRkZXI6ICcuY29uY2F0KGkpKSwgT2JqZWN0KHIuaW5zZXJ0VXNlclN5bmNJZnJhbWUpKG8pLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmltYWdlID0gZS5pbWFnZS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlWzBdICE9PSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG4sIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzLmltYWdlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAobi5pbWFnZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHUoZSwgMiksIG4gPSB0WzBdLCBpID0gdFsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoci5sb2dNZXNzYWdlKSgnSW52b2tpbmcgaW1hZ2UgcGl4ZWwgdXNlciBzeW5jIGZvciBiaWRkZXI6ICcuY29uY2F0KG4pKSwgT2JqZWN0KHIudHJpZ2dlclBpeGVsKShpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHIubG9nRXJyb3IpKCdFcnJvciBmaXJpbmcgdXNlciBzeW5jcycsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbWFnZTogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmcmFtZTogW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHIuc2h1ZmZsZSkoZSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoZSksIG8uYWRkKGVbMF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGYuZmlsdGVyU2V0dGluZ3M7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuYWxsICYmIGVbdF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHIubG9nV2FybikoJ0RldGVjdGVkIHByZXNlbmNlIG9mIHRoZSAiZmlsdGVyU2V0dGluZ3MuYWxsIiBhbmQgImZpbHRlclNldHRpbmdzLicuY29uY2F0KHQsICciIGluIHVzZXJTeW5jIGNvbmZpZy4gIFlvdSBjYW5ub3QgbWl4ICJhbGwiIHdpdGggImlmcmFtZS9pbWFnZSIgY29uZmlnczsgdGhleSBhcmUgbXV0dWFsbHkgZXhjbHVzaXZlLicpKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5hbGwgPyBlLmFsbCA6IGVbdF0sIGkgPSBlLmFsbCA/ICdhbGwnIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG4uZmlsdGVyLCBhID0gbi5iaWRkZXJzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobyAmJiAnaW5jbHVkZScgIT09IG8gJiYgJ2V4Y2x1ZGUnICE9PSBvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLmxvZ1dhcm4pKCdVc2VyU3luYyAiZmlsdGVyU2V0dGluZ3MuJy5jb25jYXQoaSwgJy5maWx0ZXIiIHNldHRpbmcgXCcnKS5jb25jYXQobywgJ1wnIGlzIG5vdCBhIHZhbGlkIG9wdGlvbjsgdXNlIGVpdGhlciBcJ2luY2x1ZGVcJyBvciBcJ2V4Y2x1ZGVcJy4nKSksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJyonICE9PSBhICYmICEoQXJyYXkuaXNBcnJheShhKSAmJiBhLmxlbmd0aCA+IDAgJiYgYS5ldmVyeShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qoci5pc1N0cikoZSkgJiYgJyonICE9PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLmxvZ1dhcm4pKCdEZXRlY3RlZCBhbiBpbnZhbGlkIHNldHVwIGluIHVzZXJTeW5jICJmaWx0ZXJTZXR0aW5ncy4nLmNvbmNhdChpLCAnLmJpZGRlcnMiOyB1c2UgZWl0aGVyIFwnKlwnICh0byByZXByZXNlbnQgYWxsIGJpZGRlcnMpIG9yIGFuIGFycmF5IG9mIGJpZGRlcnMuJykpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0obiwgZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzW2VdID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuLmFsbCA/IG4uYWxsIDogbltlXSwgbyA9ICcqJyA9PT0gaS5iaWRkZXJzID8gW3RdIDogaS5iaWRkZXJzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluY2x1ZGU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWEoKShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhjbHVkZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhKCkoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9W2kuZmlsdGVyIHx8ICdpbmNsdWRlJ10obywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXNbZV07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuYi5nZXRDb25maWcoJ3VzZXJTeW5jJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLnVzZXJTeW5jKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnVzZXJTeW5jLmZpbHRlclNldHRpbmdzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmlzUGxhaW5PYmplY3QpKHQpICYmICh0LmltYWdlIHx8IHQuYWxsIHx8IChlLnVzZXJTeW5jLmZpbHRlclNldHRpbmdzLmltYWdlID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXJzOiAnKicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbHRlcjogJ2luY2x1ZGUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGQoZiwgZS51c2VyU3luYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0LnJlZ2lzdGVyU3luYyA9IGZ1bmN0aW9uIChlLCBpLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5oYXMoaSkgPyBPYmplY3Qoci5sb2dNZXNzYWdlKSgnYWxyZWFkeSBmaXJlZCBzeW5jcyBmb3IgIicuY29uY2F0KGksICciLCBpZ25vcmluZyByZWdpc3RlclN5bmMgY2FsbCcpKSA6IGYuc3luY0VuYWJsZWQgJiYgT2JqZWN0KHIuaXNBcnJheSkobltlXSkgPyBpID8gMCAhPT0gZi5zeW5jc1BlckJpZGRlciAmJiBOdW1iZXIoY1tpXSkgPj0gZi5zeW5jc1BlckJpZGRlciA/IE9iamVjdChyLmxvZ1dhcm4pKCdOdW1iZXIgb2YgdXNlciBzeW5jcyBleGNlZWRlZCBmb3IgIicuY29uY2F0KGksICciJykpIDogdC5jYW5CaWRkZXJSZWdpc3RlclN5bmMoZSwgaSkgPyAobltlXS5wdXNoKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCB2b2lkIChjID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0XSA/IGVbdF0gKz0gMSA6IGVbdF0gPSAxLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShjLCBpKSkpIDogT2JqZWN0KHIubG9nV2FybikoJ0JpZGRlciAiJy5jb25jYXQoaSwgJyIgbm90IHBlcm1pdHRlZCB0byByZWdpc3RlciB0aGVpciAiJykuY29uY2F0KGUsICciIHVzZXJTeW5jIHBpeGVscy4nKSkgOiBPYmplY3Qoci5sb2dXYXJuKSgnQmlkZGVyIGlzIHJlcXVpcmVkIGZvciByZWdpc3RlcmluZyBzeW5jJykgOiBPYmplY3Qoci5sb2dXYXJuKSgnVXNlciBzeW5jIHR5cGUgIicuY29uY2F0KGUsICciIG5vdCBzdXBwb3J0ZWQnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuc3luY1VzZXJzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2V0VGltZW91dChsLCBOdW1iZXIoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnRyaWdnZXJVc2VyU3luY3MgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLmVuYWJsZU92ZXJyaWRlICYmIHQuc3luY1VzZXJzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuY2FuQmlkZGVyUmVnaXN0ZXJTeW5jID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZi5maWx0ZXJTZXR0aW5ncyB8fCAhZyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdDsKICAgICAgICAgICAgICAgICAgICB9KHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnOiBpLmIuZ2V0Q29uZmlnKCd1c2VyU3luYycpLAogICAgICAgICAgICAgICAgICAgICAgICBicm93c2VyU3VwcG9ydHNDb29raWVzOiBsCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDYxOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdC5hID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBvLmFkU2VydmVycyA9IG8uYWRTZXJ2ZXJzIHx8IHt9LCBvLmFkU2VydmVyc1tlXSA9IG8uYWRTZXJ2ZXJzW2VdIHx8IHt9LCBPYmplY3Qua2V5cyh0KS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG8uYWRTZXJ2ZXJzW2VdW25dID8gT2JqZWN0KGkubG9nV2FybikoJ0F0dGVtcHRpbmcgdG8gYWRkIGFuIGFscmVhZHkgcmVnaXN0ZXJlZCBmdW5jdGlvbiBwcm9wZXJ0eSAnLmNvbmNhdChuLCAnIGZvciBBZFNlcnZlciAnKS5jb25jYXQoZSwgJy4nKSkgOiBvLmFkU2VydmVyc1tlXVtuXSA9IHRbbl07CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE0KSwgaSA9IG4oMCksIG8gPSBPYmplY3Qoci5hKSgpOwogICAgICAgICAgICB9LAogICAgICAgICAgICA2MjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzMCk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmICghcihlKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgKG4gPSBlLnRvU3RyaW5nKSAmJiAhcihpID0gbi5jYWxsKGUpKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIChuID0gZS52YWx1ZU9mKSAmJiAhcihpID0gbi5jYWxsKGUpKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCF0ICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIChuID0gZS50b1N0cmluZykgJiYgIXIoaSA9IG4uY2FsbChlKSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignQ2FuXCd0IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZScpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNjM6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMjUpLCBpID0gbig4MyksIG8gPSBuKDUyKSwgYSA9IG4oNTMpLCBjID0gbigxMTApLCB1ID0gW10ucHVzaCwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gMSA9PSBlLCBuID0gMiA9PSBlLCBzID0gMyA9PSBlLCBkID0gNCA9PSBlLCBmID0gNiA9PSBlLCBsID0gNyA9PSBlLCBwID0gNSA9PSBlIHx8IGY7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZywgYiwgdiwgeSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaCwgbSwgTyA9IG8oZyksIGogPSBpKE8pLCBTID0gcihiLCB2LCAzKSwgRSA9IGEoai5sZW5ndGgpLCBBID0gMCwgVCA9IHkgfHwgYywgSSA9IHQgPyBUKGcsIEUpIDogbiB8fCBsID8gVChnLCAwKSA6IHZvaWQgMDsgRSA+IEE7IEErKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHAgfHwgQSBpbiBqKSAmJiAobSA9IFMoaCA9IGpbQV0sIEEsIE8pLCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJW0FdID0gbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAobSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LmNhbGwoSSwgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LmNhbGwoSSwgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZiA/IC0xIDogcyB8fCBkID8gZCA6IEk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBmb3JFYWNoOiBzKDApLAogICAgICAgICAgICAgICAgICAgIG1hcDogcygxKSwKICAgICAgICAgICAgICAgICAgICBmaWx0ZXI6IHMoMiksCiAgICAgICAgICAgICAgICAgICAgc29tZTogcygzKSwKICAgICAgICAgICAgICAgICAgICBldmVyeTogcyg0KSwKICAgICAgICAgICAgICAgICAgICBmaW5kOiBzKDUpLAogICAgICAgICAgICAgICAgICAgIGZpbmRJbmRleDogcyg2KSwKICAgICAgICAgICAgICAgICAgICBmaWx0ZXJPdXQ6IHMoNykKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDY0OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgdmFyIG4gPSBNYXRoLmNlaWwsIHIgPSBNYXRoLmZsb29yOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNOYU4oZSA9ICtlKSA/IDAgOiAoZSA+IDAgPyByIDogbikoZSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICA2NTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNyksIGkgPSBuKDExMiksIG8gPSAnX19jb3JlLWpzX3NoYXJlZF9fJywgYSA9IHJbb10gfHwgaShvLCB7fSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBhOwogICAgICAgICAgICB9LAogICAgICAgICAgICA2NjogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIHZhciBuID0gMCwgciA9IE1hdGgucmFuZG9tKCk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnU3ltYm9sKCcgKyBTdHJpbmcodm9pZCAwID09PSBlID8gJycgOiBlKSArICcpXycgKyAoKytuICsgcikudG9TdHJpbmcoMzYpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNjc6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IHt9OwogICAgICAgICAgICAgICAgcltuKDIzKSgndG9TdHJpbmdUYWcnKV0gPSAneicsIGUuZXhwb3J0cyA9ICdbb2JqZWN0IHpdJyA9PT0gU3RyaW5nKHIpOwogICAgICAgICAgICB9LAogICAgICAgICAgICA2ODogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCEoZSBpbnN0YW5jZW9mIHQpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ0luY29ycmVjdCAnICsgKG4gPyBuICsgJyAnIDogJycpICsgJ2ludm9jYXRpb24nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDY5OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDg2KSwgaSA9IG4oNjYpLCBvID0gcigna2V5cycpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gb1tlXSB8fCAob1tlXSA9IGkoZSkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNzogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIG4uZCh0LCAnYycsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdTsKICAgICAgICAgICAgICAgIH0pLCBuLmQodCwgJ2QnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICB9KSwgdC5hID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyh7CiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZU5hbWU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVR5cGU6ICdjb3JlJwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgdC5iID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyh7CiAgICAgICAgICAgICAgICAgICAgICAgIGd2bGlkOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVOYW1lOiB0CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDkpLCBpID0gbigwKSwgbyA9IG4oMTIpLCBhID0gbi5uKG8pLCBjID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnY29yZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdwcmViaWQtbW9kdWxlJwogICAgICAgICAgICAgICAgICAgIF0sIHUgPSBbXTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6IHt9LCB0ID0gZS5ndmxpZCwgbiA9IGUubW9kdWxlTmFtZSwgciA9IGUubW9kdWxlVHlwZTsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEoKShjLCByKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUoeyB2YWxpZDogITAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG87CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKHQsIG4sIHsgaGFzRW5mb3JjZW1lbnRIb29rOiAhMSB9LCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgdC5oYXNFbmZvcmNlbWVudEhvb2spCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzRW5mb3JjZW1lbnRIb29rOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWQ6IE9iamVjdChpLmhhc0RldmljZUFjY2VzcykoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGUobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGZ1bmN0aW9uIChlLCB0LCBuLCByLCBpLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGZ1bmN0aW9uIChvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8gJiYgby52YWxpZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGkgJiYgJycgIT09IGkgPyAnIDtkb21haW49Jy5jb25jYXQoZW5jb2RlVVJJQ29tcG9uZW50KGkpKSA6ICcnLCBjID0gbiAmJiAnJyAhPT0gbiA/ICcgO2V4cGlyZXM9Jy5jb25jYXQobikgOiAnJywgdSA9IG51bGwgIT0gciAmJiAnbm9uZScgPT0gci50b0xvd2VyQ2FzZSgpID8gJzsgU2VjdXJlJyA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5jb29raWUgPSAnJy5jb25jYXQoZSwgJz0nKS5jb25jYXQoZW5jb2RlVVJJQ29tcG9uZW50KHQpKS5jb25jYXQoYywgJzsgcGF0aD0vJykuY29uY2F0KGEpLmNvbmNhdChyID8gJzsgU2FtZVNpdGU9Jy5jb25jYXQocikgOiAnJykuY29uY2F0KHUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWEgfHwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUucHVzaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBvKGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgdC52YWxpZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHdpbmRvdy5kb2N1bWVudC5jb29raWUubWF0Y2goJyhefDspXFxzKicgKyBlICsgJ1xccyo9XFxzKihbXjtdKilcXHMqKDt8JCknKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPyBkZWNvZGVVUklDb21wb25lbnQoblsyXSkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXQgfHwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUucHVzaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBvKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgbCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF84MDZjZGZlNjdlZWYxZWZlID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ2xvY2FsU3RvcmFnZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzgwNmNkZmU2N2VlZjFlZmUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX21vY2tfMWNmMWU5MDczODU0NmQ0MC5sb2NhbFN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICYmIGUudmFsaWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxvY2FsU3RvcmFnZS5zZXRJdGVtKCdwcmViaWQuY29va2llVGVzdCcsICcxJyksICcxJyA9PT0gbG9jYWxTdG9yYWdlLmdldEl0ZW0oJ3ByZWJpZC5jb29raWVUZXN0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2NhbFN0b3JhZ2UucmVtb3ZlSXRlbSgncHJlYmlkLmNvb2tpZVRlc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfODA2Y2RmZTY3ZWVmMWVmZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkXzgwNmNkZmU2N2VlZjFlZmUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LnB1c2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHAgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFlIHx8ICFlLnZhbGlkKSAmJiAoISFPYmplY3QoaS5jaGVja0Nvb2tpZVN1cHBvcnQpKCkgfHwgKHdpbmRvdy5kb2N1bWVudC5jb29raWUgPSAncHJlYmlkLmNvb2tpZVRlc3QnLCAtMSAhPT0gd2luZG93LmRvY3VtZW50LmNvb2tpZS5pbmRleE9mKCdwcmViaWQuY29va2llVGVzdCcpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LnB1c2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGcgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfN2ZkNjMzZThkNDIxOTk3NCA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdsb2NhbFN0b3JhZ2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF83ZmQ2MzNlOGQ0MjE5OTc0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2xvY2FsU3RvcmFnZScsICRfX19tb2NrXzFjZjFlOTA3Mzg1NDZkNDAubG9jYWxTdG9yYWdlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIG4udmFsaWQgJiYgeSgpICYmIHdpbmRvdy5sb2NhbFN0b3JhZ2Uuc2V0SXRlbShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzdmZDYzM2U4ZDQyMTk5NzQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX29sZF83ZmQ2MzNlOGQ0MjE5OTc0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbiB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5wdXNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG8ocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBiID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkXzFjMWQyODliMGRjNTQ2YTQgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMWMxZDI4OWIwZGM1NDZhNCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja18xY2YxZTkwNzM4NTQ2ZDQwLmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgdC52YWxpZCAmJiB5KCkgPyB3aW5kb3cubG9jYWxTdG9yYWdlLmdldEl0ZW0oZSkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMWMxZDI4OWIwZGM1NDZhNCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkXzFjMWQyODliMGRjNTQ2YTQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0IHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8obik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LnB1c2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbyhuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHYgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgdC52YWxpZCAmJiB5KCkgJiYgd2luZG93LmxvY2FsU3RvcmFnZS5yZW1vdmVJdGVtKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdCB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5wdXNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG8obik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB5ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkXzM1NzdmMGU1NjNkN2M4ZjQgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMzU3N2YwZTU2M2Q3YzhmNCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja18xY2YxZTkwNzM4NTQ2ZDQwLmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZS52YWxpZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF3aW5kb3cubG9jYWxTdG9yYWdlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nRXJyb3IpKCdMb2NhbCBzdG9yYWdlIGFwaSBkaXNhYmxlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzM1NzdmMGU1NjNkN2M4ZjQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX29sZF8zNTc3ZjBlNTYzZDdjOGY0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5wdXNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG8odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBoID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiB0LnZhbGlkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QoaS5oYXNEZXZpY2VBY2Nlc3MpKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gZG9jdW1lbnQuY29va2llLnNwbGl0KCc7Jyk7IHIubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gci5wb3AoKSwgYSA9IG8uaW5kZXhPZignPScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhIDwgMCA/IG8ubGVuZ3RoIDogYSwgZGVjb2RlVVJJQ29tcG9uZW50KG8uc2xpY2UoMCwgYSkucmVwbGFjZSgvXlxzKy8sICcnKSkuaW5kZXhPZihlKSA+PSAwICYmIG4ucHVzaChkZWNvZGVVUklDb21wb25lbnQoby5zbGljZShhICsgMSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdCB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5wdXNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG8obik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNldENvb2tpZTogcywKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29va2llOiBmLAogICAgICAgICAgICAgICAgICAgICAgICBsb2NhbFN0b3JhZ2VJc0VuYWJsZWQ6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZXNBcmVFbmFibGVkOiBwLAogICAgICAgICAgICAgICAgICAgICAgICBzZXREYXRhSW5Mb2NhbFN0b3JhZ2U6IGcsCiAgICAgICAgICAgICAgICAgICAgICAgIGdldERhdGFGcm9tTG9jYWxTdG9yYWdlOiBiLAogICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVEYXRhRnJvbUxvY2FsU3RvcmFnZTogdiwKICAgICAgICAgICAgICAgICAgICAgICAgaGFzTG9jYWxTdG9yYWdlOiB5LAogICAgICAgICAgICAgICAgICAgICAgICBmaW5kU2ltaWxhckNvb2tpZXM6IGgKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGQgPSBPYmplY3Qoci5iKSgnYXN5bmMnLCBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHIobik7CiAgICAgICAgICAgICAgICB9LCAndmFsaWRhdGVTdG9yYWdlRW5mb3JjZW1lbnQnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNzA6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciwgaSA9IG4oMTcpLCBvID0gbigxMjcpLCBhID0gbig5MyksIGMgPSBuKDU2KSwgdSA9IG4oMTMwKSwgcyA9IG4oODUpLCBkID0gbig2OSksIGYgPSBkKCdJRV9QUk9UTycpLCBsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIH0sIHAgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJzxzY3JpcHQ+JyArIGUgKyAnPC8nICsgJ3NjcmlwdD4nOwogICAgICAgICAgICAgICAgICAgIH0sIGcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gZG9jdW1lbnQuZG9tYWluICYmIG5ldyBBY3RpdmVYT2JqZWN0KCdodG1sZmlsZScpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSByID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUud3JpdGUocCgnJykpLCBlLmNsb3NlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucGFyZW50V2luZG93Lk9iamVjdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gbnVsbCwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfShyKSA6ICgodCA9IHMoJ2lmcmFtZScpKS5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnLCB1LmFwcGVuZENoaWxkKHQpLCB0LnNyYyA9IFN0cmluZygnamF2YXNjcmlwdDonKSwgKGUgPSB0LmNvbnRlbnRXaW5kb3cuZG9jdW1lbnQpLm9wZW4oKSwgZS53cml0ZShwKCdkb2N1bWVudC5GPU9iamVjdCcpKSwgZS5jbG9zZSgpLCBlLkYpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gYS5sZW5ndGg7IG4tLTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgZy5wcm90b3R5cGVbYVtuXV07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnKCk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGNbZl0gPSAhMCwgZS5leHBvcnRzID0gT2JqZWN0LmNyZWF0ZSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlID8gKGwucHJvdG90eXBlID0gaShlKSwgbiA9IG5ldyBsKCksIGwucHJvdG90eXBlID0gbnVsbCwgbltmXSA9IGUpIDogbiA9IGcoKSwgdm9pZCAwID09PSB0ID8gbiA6IG8obiwgdCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICA3MTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzMik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbiwgaSkgewogICAgICAgICAgICAgICAgICAgIGkgJiYgaS5lbnVtZXJhYmxlID8gZVt0XSA9IG4gOiByKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNzI6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpLCBpID0gbig5NSksIG8gPSBuKDk3KSwgYSA9IG4oMTMyKSwgYyA9IG4oNTkpLCB1ID0gbigzMiksIHMgPSBuKDcxKSwgZCA9IG4oMjMpLCBmID0gbigxOCksIGwgPSBuKDQxKSwgcCA9IG4oOTYpLCBnID0gcC5JdGVyYXRvclByb3RvdHlwZSwgYiA9IHAuQlVHR1lfU0FGQVJJX0lURVJBVE9SUywgdiA9IGQoJ2l0ZXJhdG9yJyksIHkgPSAna2V5cycsIGggPSAndmFsdWVzJywgbSA9ICdlbnRyaWVzJywgTyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuLCBkLCBwLCBqLCBTKSB7CiAgICAgICAgICAgICAgICAgICAgaShuLCB0LCBkKTsKICAgICAgICAgICAgICAgICAgICB2YXIgRSwgQSwgVCwgSSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9PT0gcCAmJiBVKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFiICYmIGUgaW4gUikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUltlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBoOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBtOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgbih0aGlzLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IG4odGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9LCB3ID0gdCArICcgSXRlcmF0b3InLCBDID0gITEsIFIgPSBlLnByb3RvdHlwZSwgXyA9IFJbdl0gfHwgUlsnQEBpdGVyYXRvciddIHx8IHAgJiYgUltwXSwgVSA9ICFiICYmIF8gfHwgSShwKSwgQiA9ICdBcnJheScgPT0gdCAmJiBSLmVudHJpZXMgfHwgXzsKICAgICAgICAgICAgICAgICAgICBpZiAoQiAmJiAoRSA9IG8oQi5jYWxsKG5ldyBlKCkpKSwgZyAhPT0gT2JqZWN0LnByb3RvdHlwZSAmJiBFLm5leHQgJiYgKGYgfHwgbyhFKSA9PT0gZyB8fCAoYSA/IGEoRSwgZykgOiAnZnVuY3Rpb24nICE9IHR5cGVvZiBFW3ZdICYmIHUoRSwgdiwgTykpLCBjKEUsIHcsICEwLCAhMCksIGYgJiYgKGxbd10gPSBPKSkpLCBwID09IGggJiYgXyAmJiBfLm5hbWUgIT09IGggJiYgKEMgPSAhMCwgVSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBmICYmICFTIHx8IFJbdl0gPT09IFUgfHwgdShSLCB2LCBVKSwgbFt0XSA9IFUsIHApCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogSShoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlzOiBqID8gVSA6IEkoeSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW50cmllczogSShtKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgUykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoVCBpbiBBKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChiIHx8IEMgfHwgIShUIGluIFIpKSAmJiBzKFIsIFQsIEFbVF0pOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcmNlZDogYiB8fCBDCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBBKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDczOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE3KSwgaSA9IG4oNTcpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkoZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT0gdHlwZW9mIHQpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihTdHJpbmcoZSkgKyAnIGlzIG5vdCBpdGVyYWJsZScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQuY2FsbChlKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICA3NDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNjEpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNzU6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBuLmQodCwgJ2EnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigwKSwgaSA9IHt9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGlbZV0gPSBpW2VdIHx8IHsgYmlkZGVyczoge30gfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPyBuLmJpZGRlcnNbdF0gPSBuLmJpZGRlcnNbdF0gfHwge30gOiBuOwogICAgICAgICAgICAgICAgICAgIH0oZSwgbik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJbdF0gPSAoclt0XSB8fCAwKSArIDEsIHJbdF07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgYSA9IHsKICAgICAgICAgICAgICAgICAgICBpbmNyZW1lbnRSZXF1ZXN0c0NvdW50ZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKGUsICdyZXF1ZXN0c0NvdW50ZXInKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGluY3JlbWVudEJpZGRlclJlcXVlc3RzQ291bnRlcjogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSwgJ3JlcXVlc3RzQ291bnRlcicsIHQpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaW5jcmVtZW50QmlkZGVyV2luc0NvdW50ZXI6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKGUsICd3aW5zQ291bnRlcicsIHQpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZ2V0UmVxdWVzdHNDb3VudGVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHIuZGVlcEFjY2VzcykoaSwgJycuY29uY2F0KGUsICcucmVxdWVzdHNDb3VudGVyJykpIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBnZXRCaWRkZXJSZXF1ZXN0c0NvdW50ZXI6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qoci5kZWVwQWNjZXNzKShpLCAnJy5jb25jYXQoZSwgJy5iaWRkZXJzLicpLmNvbmNhdCh0LCAnLnJlcXVlc3RzQ291bnRlcicpKSB8fCAwOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZ2V0QmlkZGVyV2luc0NvdW50ZXI6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qoci5kZWVwQWNjZXNzKShpLCAnJy5jb25jYXQoZSwgJy5iaWRkZXJzLicpLmNvbmNhdCh0LCAnLndpbnNDb3VudGVyJykpIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNzk6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMjIwKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHI7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDg6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgbi5kKHQsICdnZHByRGF0YUhhbmRsZXInLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHg7CiAgICAgICAgICAgICAgICB9KSwgbi5kKHQsICd1c3BEYXRhSGFuZGxlcicsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRDsKICAgICAgICAgICAgICAgIH0pLCBuLmQodCwgJ2NvcHBhRGF0YUhhbmRsZXInLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGs7CiAgICAgICAgICAgICAgICB9KSwgbi5kKHQsICdjbGllbnRUZXN0QWRhcHRlcnMnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE47CiAgICAgICAgICAgICAgICB9KSwgbi5kKHQsICdhbGxTMlNCaWRkZXJzJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBQOwogICAgICAgICAgICAgICAgfSksIHQuZ2V0QWxsUzJTQmlkZGVycyA9IHEsIHQuc2V0UzJTVGVzdGluZ01vZHVsZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgQSA9IGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDApLCBpID0gbigxMDApLCBvID0gbigzOSksIGEgPSBuKDEpLCBjID0gbig0KSwgdSA9IG4oMyksIHMgPSBuKDkpLCBkID0gbigxMiksIGYgPSBuLm4oZCksIGwgPSBuKDExKSwgcCA9IG4ubihsKSwgZyA9IG4oNzUpLCBiID0gbigxOSk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5rZXlzKGUpOwogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAociA9IHIuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLCB0KS5lbnVtZXJhYmxlOwogICAgICAgICAgICAgICAgICAgICAgICB9KSksIG4ucHVzaC5hcHBseShuLCByKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG51bGwgIT0gYXJndW1lbnRzW3RdID8gYXJndW1lbnRzW3RdIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgIHQgJSAyID8gdihPYmplY3QobiksICEwKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoKGUsIHQsIG5bdF0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSA6IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzID8gT2JqZWN0LmRlZmluZVByb3BlcnRpZXMoZSwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMobikpIDogdihPYmplY3QobikpLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKG4sIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgaW4gZSA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSkgOiBlW3RdID0gbiwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBudWxsID09IGUgPyBudWxsIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIFN5bWJvbCAmJiBlW1N5bWJvbC5pdGVyYXRvcl0gfHwgZVsnQEBpdGVyYXRvciddOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgaSwgbyA9IFtdLCBhID0gITAsIGMgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IG4uY2FsbChlKTsgIShhID0gKHIgPSBuLm5leHQoKSkuZG9uZSkgJiYgKG8ucHVzaChyLnZhbHVlKSwgIXQgfHwgby5sZW5ndGggIT09IHQpOyBhID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gITAsIGkgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhIHx8IG51bGwgPT0gbi5yZXR1cm4gfHwgbi5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgfShlLCB0KSB8fCBqKGUsIHQpIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSW52YWxpZCBhdHRlbXB0IHRvIGRlc3RydWN0dXJlIG5vbi1pdGVyYWJsZSBpbnN0YW5jZS5cbkluIG9yZGVyIHRvIGJlIGl0ZXJhYmxlLCBub24tYXJyYXkgb2JqZWN0cyBtdXN0IGhhdmUgYSBbU3ltYm9sLml0ZXJhdG9yXSgpIG1ldGhvZC4nKTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBPKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUyhlKTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyAhPSB0eXBlb2YgU3ltYm9sICYmIG51bGwgIT0gZVtTeW1ib2wuaXRlcmF0b3JdIHx8IG51bGwgIT0gZVsnQEBpdGVyYXRvciddKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LmZyb20oZSk7CiAgICAgICAgICAgICAgICAgICAgfShlKSB8fCBqKGUpIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSW52YWxpZCBhdHRlbXB0IHRvIHNwcmVhZCBub24taXRlcmFibGUgaW5zdGFuY2UuXG5JbiBvcmRlciB0byBiZSBpdGVyYWJsZSwgbm9uLWFycmF5IG9iamVjdHMgbXVzdCBoYXZlIGEgW1N5bWJvbC5pdGVyYXRvcl0oKSBtZXRob2QuJyk7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFMoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpLnNsaWNlKDgsIC0xKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdPYmplY3QnID09PSBuICYmIGUuY29uc3RydWN0b3IgJiYgKG4gPSBlLmNvbnN0cnVjdG9yLm5hbWUpLCAnTWFwJyA9PT0gbiB8fCAnU2V0JyA9PT0gbiA/IEFycmF5LmZyb20oZSkgOiAnQXJndW1lbnRzJyA9PT0gbiB8fCAvXig/OlVpfEkpbnQoPzo4fDE2fDMyKSg/OkNsYW1wZWQpP0FycmF5JC8udGVzdChuKSA/IFMoZSwgdCkgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgKG51bGwgPT0gdCB8fCB0ID4gZS5sZW5ndGgpICYmICh0ID0gZS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0gbmV3IEFycmF5KHQpOyBuIDwgdDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICByW25dID0gZVtuXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEUoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChFID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG4sIHIpICYmIChlW3JdID0gbltyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSkuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBBLCBUID0gbig1KSwgSSA9IG4oMTApLCB3ID0ge30sIEMgPSB3LmJpZGRlclJlZ2lzdHJ5ID0ge30sIFIgPSB3LmFsaWFzUmVnaXN0cnkgPSB7fSwgXyA9IFtdOwogICAgICAgICAgICAgICAgdS5iLmdldENvbmZpZygnczJzQ29uZmlnJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlICYmIGUuczJzQ29uZmlnICYmIChfID0gT2JqZWN0KHIuaXNBcnJheSkoZS5zMnNDb25maWcpID8gZS5zMnNDb25maWcgOiBbZS5zMnNDb25maWddKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIFUgPSB7fTsKICAgICAgICAgICAgICAgIHZhciBCID0gT2JqZWN0KHMuYikoJ3N5bmMnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5iaWRkZXJDb2RlLCBuID0gZS5hdWN0aW9uSWQsIGEgPSBlLmJpZGRlclJlcXVlc3RJZCwgYyA9IGUuYWRVbml0cywgdSA9IGUubGFiZWxzLCBzID0gZS5zcmM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMucmVkdWNlKGZ1bmN0aW9uIChlLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gT2JqZWN0KGkuYikoT2JqZWN0KGkuYSkoYywgdSksIGMubWVkaWFUeXBlcywgYy5zaXplcyksIGYgPSBkLmFjdGl2ZSwgbCA9IGQubWVkaWFUeXBlcywgcCA9IGQuZmlsdGVyUmVzdWx0czsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYgPyBwICYmIE9iamVjdChyLmxvZ0luZm8pKCdTaXplIG1hcHBpbmcgZmlsdGVyZWQgYWRVbml0ICInLmNvbmNhdChjLmNvZGUsICciIGJhbm5lciBzaXplcyBmcm9tICcpLCBwLmJlZm9yZSwgJ3RvICcsIHAuYWZ0ZXIpIDogT2JqZWN0KHIubG9nSW5mbykoJ1NpemUgbWFwcGluZyBkaXNhYmxlZCBhZFVuaXQgIicuY29uY2F0KGMuY29kZSwgJyInKSksIGYgJiYgZS5wdXNoKGMuYmlkcy5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmJpZGRlciA9PT0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGMubmF0aXZlUGFyYW1zIHx8IE9iamVjdChyLmRlZXBBY2Nlc3MpKGMsICdtZWRpYVR5cGVzLm5hdGl2ZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCAmJiAodCA9IEUoe30sIHQsIHsgbmF0aXZlUGFyYW1zOiBPYmplY3Qoby5oKShkKSB9KSksIHQgPSBFKHt9LCB0LCBPYmplY3Qoci5nZXREZWZpbmVkUGFyYW1zKShjLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29ydGIySW1wJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbWVkaWFUeXBlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmVuZGVyZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdG9yZWRBdWN0aW9uUmVzcG9uc2UnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IE9iamVjdChpLmIpKE9iamVjdChpLmEpKHQsIHUpLCBsKSwgcCA9IGYuYWN0aXZlLCBiID0gZi5tZWRpYVR5cGVzLCB2ID0gZi5maWx0ZXJSZXN1bHRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAgPyB2ICYmIE9iamVjdChyLmxvZ0luZm8pKCdTaXplIG1hcHBpbmcgZmlsdGVyZWQgYWRVbml0ICInLmNvbmNhdChjLmNvZGUsICciIGJpZGRlciAiJykuY29uY2F0KHQuYmlkZGVyLCAnIiBiYW5uZXIgc2l6ZXMgZnJvbSAnKSwgdi5iZWZvcmUsICd0byAnLCB2LmFmdGVyKSA6IE9iamVjdChyLmxvZ0luZm8pKCdTaXplIG1hcHBpbmcgZGVhY3RpdmF0ZWQgYWRVbml0ICInLmNvbmNhdChjLmNvZGUsICciIGJpZGRlciAiJykuY29uY2F0KHQuYmlkZGVyLCAnIicpKSwgT2JqZWN0KHIuaXNWYWxpZE1lZGlhVHlwZXMpKGIpID8gdCA9IEUoe30sIHQsIHsgbWVkaWFUeXBlczogYiB9KSA6IE9iamVjdChyLmxvZ0Vycm9yKSgnbWVkaWFUeXBlcyBpcyBub3QgY29ycmVjdGx5IGNvbmZpZ3VyZWQgZm9yIGFkdW5pdCAnLmNvbmNhdChjLmNvZGUpKSwgcCAmJiBlLnB1c2goRSh7fSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkVW5pdENvZGU6IGMuY29kZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2FjdGlvbklkOiBjLnRyYW5zYWN0aW9uSWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZXM6IE9iamVjdChyLmRlZXBBY2Nlc3MpKGIsICdiYW5uZXIuc2l6ZXMnKSB8fCBPYmplY3Qoci5kZWVwQWNjZXNzKShiLCAndmlkZW8ucGxheWVyU2l6ZScpIHx8IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZElkOiB0LmJpZF9pZCB8fCBPYmplY3Qoci5nZXRVbmlxdWVJZGVudGlmaWVyU3RyKSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlclJlcXVlc3RJZDogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWN0aW9uSWQ6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZFJlcXVlc3RzQ291bnQ6IGcuYS5nZXRSZXF1ZXN0c0NvdW50ZXIoYy5jb2RlKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXJSZXF1ZXN0c0NvdW50OiBnLmEuZ2V0QmlkZGVyUmVxdWVzdHNDb3VudGVyKGMuY29kZSwgdC5iaWRkZXIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlcldpbnNDb3VudDogZy5hLmdldEJpZGRlcldpbnNDb3VudGVyKGMuY29kZSwgdC5iaWRkZXIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtdKSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgW10pLnJlZHVjZShyLmZsYXR0ZW4sIFtdKS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnICE9PSBlOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgJ2dldEJpZHMnKTsKICAgICAgICAgICAgICAgIHZhciB4ID0gewogICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50RGF0YTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgc2V0Q29uc2VudERhdGE6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4LmNvbnNlbnREYXRhID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29uc2VudERhdGE6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4LmNvbnNlbnREYXRhOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgRCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudERhdGE6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldENvbnNlbnREYXRhOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgRC5jb25zZW50RGF0YSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldENvbnNlbnREYXRhOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRC5jb25zZW50RGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGsgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdldENvcHBhOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF1LmIuZ2V0Q29uZmlnKCdjb3BwYScpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgTiA9IFtdLCBQID0gW107CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBxKCkgewogICAgICAgICAgICAgICAgICAgIHcuczJTVGVzdGluZ0VuYWJsZWQgPSAhMSwgXy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgJiYgZS5lbmFibGVkICYmIGUuYmlkZGVycyAmJiBlLmJpZGRlcnMubGVuZ3RoICYmIFAucHVzaC5hcHBseShQLCBPKGUuYmlkZGVycykpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5lbmFibGVkICYmIGUudGVzdGluZyAmJiBBOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBDW2VdLmdldFNwZWMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaSAmJiBpW3RdICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGlbdF0gJiYgKE9iamVjdChyLmxvZ0luZm8pKCdJbnZva2luZyAnLmNvbmNhdChlLCAnLicpLmNvbmNhdCh0KSksIHUuYi5ydW5XaXRoQmlkZGVyKGUsIHIuYmluZC5jYWxsKGlbdF0sIGksIG4pKSk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoci5sb2dXYXJuKSgnRXJyb3IgY2FsbGluZyAnLmNvbmNhdCh0LCAnIG9mICcpLmNvbmNhdChlKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdy5tYWtlQmlkUmVxdWVzdHMgPSBPYmplY3Qocy5iKSgnc3luYycsIGZ1bmN0aW9uIChlLCB0LCBuLCBpLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgSS5lbWl0KFQuRVZFTlRTLkJFRk9SRV9SRVFVRVNUX0JJRFMsIGUpOwogICAgICAgICAgICAgICAgICAgIHZhciBhID0gT2JqZWN0KHIuZ2V0QmlkZGVyQ29kZXMpKGUpOwogICAgICAgICAgICAgICAgICAgIHUuYi5nZXRDb25maWcoJ2JpZGRlclNlcXVlbmNlJykgPT09IHUuYSAmJiAoYSA9IE9iamVjdChyLnNodWZmbGUpKGEpKTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IE9iamVjdChiLmEpKCksIHMgPSBhLCBkID0gW107CiAgICAgICAgICAgICAgICAgICAgMCA9PT0gUC5sZW5ndGggJiYgcSgpLCBfLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiB0LmVuYWJsZWQgJiYgKE0odCkgJiYgKEEuY2FsY3VsYXRlQmlkU291cmNlcyh0KSwgQS5nZXRTb3VyY2VCaWRkZXJNYXAoZSwgUClbQS5DTElFTlRdLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYoKShOLCBlKSB8fCBOLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgfSksIHMgPSBhLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWYoKShQLCBlKSB8fCBmKCkoTiwgZSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBQOwogICAgICAgICAgICAgICAgICAgIF8uZm9yRWFjaChmdW5jdGlvbiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSAmJiBpLmVuYWJsZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCb29sZWFuKE0oZSkgJiYgZS50ZXN0U2VydmVyT25seSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGkpICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJvb2xlYW4ocCgpKGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKCkoZS5iaWRzLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlLmJpZFNvdXJjZSB8fCB0LmJpZGRlckNvbnRyb2wgJiYgdC5iaWRkZXJDb250cm9sW2UuYmlkZGVyXSkgJiYgZS5maW5hbFNvdXJjZSA9PT0gQS5TRVJWRVI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSwgaSkgJiYgKE9iamVjdChyLmxvZ1dhcm4pKCd0ZXN0U2VydmVyT25seTogVHJ1ZS4gIEFsbCBjbGllbnQgcmVxdWVzdHMgd2lsbCBiZSBzdXBwcmVzc2VkLicpLCBzLmxlbmd0aCA9IDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LmJpZGRlcnMsIGkgPSBPYmplY3Qoci5kZWVwQ2xvbmUpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmJpZHMgPSBlLmJpZHMuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYoKShuLCBlLmJpZGRlcikgJiYgKCFNKHQpIHx8IGUuZmluYWxTb3VyY2UgIT09IEEuQ0xJRU5UKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmJpZF9pZCA9IE9iamVjdChyLmdldFVuaXF1ZUlkZW50aWZpZXJTdHIpKCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCAhPT0gZS5iaWRzLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlLCBpKSwgdSA9IE9iamVjdChyLmdlbmVyYXRlVVVJRCkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gT2JqZWN0KHIuZ2V0VW5pcXVlSWRlbnRpZmllclN0cikoKSwgZiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlckNvZGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWN0aW9uSWQ6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXJSZXF1ZXN0SWQ6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bmlxdWVQYnNUaWQ6IHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRzOiBCKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXJDb2RlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1Y3Rpb25JZDogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXJSZXF1ZXN0SWQ6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRVbml0czogT2JqZWN0KHIuZGVlcENsb25lKShhKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbHM6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjOiBULlMyUy5TUkMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVjdGlvblN0YXJ0OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dDogaS50aW1lb3V0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjOiBULlMyUy5TUkMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZlcmVySW5mbzogYwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgIT09IGYuYmlkcy5sZW5ndGggJiYgZC5wdXNoKGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGEuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5iaWRzLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcCgpKGQsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcCgpKHQuYmlkcywgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5iaWRJZCA9PT0gZS5iaWRfaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5iaWRzID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBkLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGUuYWRVbml0c1MyU0NvcHkgJiYgKGUuYWRVbml0c1MyU0NvcHkgPSBhLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5iaWRzLmxlbmd0aCA+IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0KHIuZGVlcENsb25lKShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5iaWRzID0gZS5iaWRzLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhTi5sZW5ndGggfHwgZS5maW5hbFNvdXJjZSAhPT0gQS5TRVJWRVI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCAhPT0gZS5iaWRzLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfShlKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gT2JqZWN0KHIuZ2V0VW5pcXVlSWRlbnRpZmllclN0cikoKSwgdSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXJDb2RlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1Y3Rpb25JZDogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXJSZXF1ZXN0SWQ6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkczogQih7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlckNvZGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1Y3Rpb25JZDogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZGVyUmVxdWVzdElkOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZFVuaXRzOiBPYmplY3Qoci5kZWVwQ2xvbmUpKGcpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbHM6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYzogJ2NsaWVudCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWN0aW9uU3RhcnQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dDogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZlcmVySW5mbzogYwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcyA9IENbZV07CiAgICAgICAgICAgICAgICAgICAgICAgIHMgfHwgT2JqZWN0KHIubG9nRXJyb3IpKCdUcnlpbmcgdG8gbWFrZSBhIHJlcXVlc3QgZm9yIGJpZGRlciB0aGF0IGRvZXMgbm90IGV4aXN0OiAnLmNvbmNhdChlKSksIHMgJiYgdS5iaWRzICYmIDAgIT09IHUuYmlkcy5sZW5ndGggJiYgZC5wdXNoKHUpOwogICAgICAgICAgICAgICAgICAgIH0pLCB4LmdldENvbnNlbnREYXRhKCkgJiYgZC5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2RwckNvbnNlbnQgPSB4LmdldENvbnNlbnREYXRhKCk7CiAgICAgICAgICAgICAgICAgICAgfSksIEQuZ2V0Q29uc2VudERhdGEoKSAmJiBkLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZS51c3BDb25zZW50ID0gRC5nZXRDb25zZW50RGF0YSgpOwogICAgICAgICAgICAgICAgICAgIH0pLCBkOwogICAgICAgICAgICAgICAgfSwgJ21ha2VCaWRSZXF1ZXN0cycpLCB3LmNhbGxCaWRzID0gZnVuY3Rpb24gKGUsIHQsIG4sIGksIG8sIGEsIHMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAodC5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBtKHQucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbTnVtYmVyKHZvaWQgMCAhPT0gdC5zcmMgJiYgdC5zcmMgPT09IFQuUzJTLlNSQyldLnB1c2godCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCAyKSwgbCA9IGRbMF0sIHAgPSBkWzFdLCBnID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIHAuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IC0xLCBuID0gMDsgbiA8IGcubGVuZ3RoOyArK24pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUudW5pcXVlUGJzVGlkID09PSBnW25dLnVuaXF1ZVBic1RpZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA8PSAtMSAmJiBnLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IDAsIHYgPSBPYmplY3Qoci5nZW5lcmF0ZVVVSUQpKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZ1tiXSAmJiBmKCkoZS5iaWRkZXJzLCBnW2JdLmJpZGRlckNvZGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3QoYy5iKShhLCBvID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogby5yZXF1ZXN0LmJpbmQobnVsbCwgJ3MycycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogby5kb25lCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiB2b2lkIDApLCB1ID0gZS5iaWRkZXJzLCBzID0gQ1tlLmFkYXB0ZXJdLCBkID0gZ1tiXS51bmlxdWVQYnNUaWQsIGwgPSBnW2JdLmFkVW5pdHNTMlNDb3B5LCBoID0gcC5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnVuaXF1ZVBic1RpZCA9PT0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aWQ6IHYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZF91bml0czogbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMyc0NvbmZpZzogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobS5hZF91bml0cy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBPID0gaC5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RhcnQgPSBPYmplY3Qoci50aW1lc3RhbXApKCksIGkuYmluZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaiA9IG0uYWRfdW5pdHMucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNvbmNhdCgodC5iaWRzIHx8IFtdKS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNvbmNhdCh0LmJpZGRlcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHIubG9nTWVzc2FnZSkoJ0NBTExJTkcgUzJTIEhFQURFUiBCSURERVJTID09PT0gJy5jb25jYXQodS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZigpKGosIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignLCcpKSksIGguZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkuZW1pdChULkVWRU5UUy5CSURfUkVRVUVTVEVELCB5KHkoe30sIGUpLCB7fSwgeyB0aWQ6IHYgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHMuY2FsbEJpZHMobSwgcCwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IE9iamVjdChyLmdldEJpZGRlclJlcXVlc3QpKHAsIHQuYmlkZGVyQ29kZSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSAmJiBuLmNhbGwoaSwgZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE8uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHIubG9nRXJyb3IpKCdtaXNzaW5nICcgKyBlLmFkYXB0ZXIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIGwuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zdGFydCA9IE9iamVjdChyLnRpbWVzdGFtcCkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gQ1tlLmJpZGRlckNvZGVdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5iLnJ1bldpdGhCaWRkZXIoZS5iaWRkZXJDb2RlLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHIubG9nTWVzc2FnZSkoJ0NBTExJTkcgQklEREVSJyksIEkuZW1pdChULkVWRU5UUy5CSURfUkVRVUVTVEVELCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBPYmplY3QoYy5iKShhLCBvID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiBvLnJlcXVlc3QuYmluZChudWxsLCBlLmJpZGRlckNvZGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiBvLmRvbmUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogdm9pZCAwKSwgZiA9IGkuYmluZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5iLnJ1bldpdGhCaWRkZXIoZS5iaWRkZXJDb2RlLCByLmJpbmQuY2FsbCh0LmNhbGxCaWRzLCB0LCBlLCBuLmJpbmQoZSksIGYsIGQsIHMsIHUuYi5jYWxsYmFja1dpdGhCaWRkZXIoZS5iaWRkZXJDb2RlKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmxvZ0Vycm9yKSgnJy5jb25jYXQoZS5iaWRkZXJDb2RlLCAnIEJpZCBBZGFwdGVyIGVtaXR0ZWQgYW4gdW5jYXVnaHQgZXJyb3Igd2hlbiBwYXJzaW5nIHRoZWlyIGJpZFJlcXVlc3QnKSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRSZXF1ZXN0OiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGYoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmxvZ1dhcm4pKCdjYWxsQmlkcyBleGVjdXRlZCB3aXRoIG5vIGJpZFJlcXVlc3RzLiAgV2VyZSB0aGV5IGZpbHRlcmVkIGJ5IGxhYmVscyBvciBzaXppbmc/Jyk7CiAgICAgICAgICAgICAgICB9LCB3LnZpZGVvQWRhcHRlcnMgPSBbXSwgdy5yZWdpc3RlckJpZEFkYXB0ZXIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMl0gPyBhcmd1bWVudHNbMl0gOiB7fSwgaSA9IG4uc3VwcG9ydGVkTWVkaWFUeXBlcywgYSA9IHZvaWQgMCA9PT0gaSA/IFtdIDogaTsKICAgICAgICAgICAgICAgICAgICBlICYmIHQgPyAnZnVuY3Rpb24nID09IHR5cGVvZiBlLmNhbGxCaWRzID8gKENbdF0gPSBlLCBmKCkoYSwgJ3ZpZGVvJykgJiYgdy52aWRlb0FkYXB0ZXJzLnB1c2godCksIGYoKShhLCAnbmF0aXZlJykgJiYgby5mLnB1c2godCkpIDogT2JqZWN0KHIubG9nRXJyb3IpKCdCaWRkZXIgYWRhcHRvciBlcnJvciBmb3IgYmlkZGVyIGNvZGU6ICcgKyB0ICsgJ2JpZGRlciBtdXN0IGltcGxlbWVudCBhIGNhbGxCaWRzKCkgZnVuY3Rpb24nKSA6IE9iamVjdChyLmxvZ0Vycm9yKSgnYmlkQWRhcHRlciBvciBiaWRkZXJDb2RlIG5vdCBzcGVjaWZpZWQnKTsKICAgICAgICAgICAgICAgIH0sIHcuYWxpYXNCaWRBZGFwdGVyID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBDW3RdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gQ1tlXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8uZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmJpZGRlcnMgJiYgbi5iaWRkZXJzLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4gJiYgbi5iaWRkZXJzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIGYoKShyLCB0KSA/IFJbdF0gPSBlIDogYy5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBjLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoci5sb2dFcnJvcikoJ2JpZGRlckNvZGUgIicgKyBlICsgJyIgaXMgbm90IGFuIGV4aXN0aW5nIGJpZGRlci4nLCAnYWRhcHRlck1hbmFnZXIuYWxpYXNCaWRBZGFwdGVyJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1LCBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZigpKHcudmlkZW9BZGFwdGVycywgZSkgJiYgdC5wdXNoKCd2aWRlbycpLCBmKCkoby5mLCBlKSAmJiB0LnB1c2goJ25hdGl2ZScpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpLmNvbnN0cnVjdG9yLnByb3RvdHlwZSAhPSBPYmplY3QucHJvdG90eXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodSA9IG5ldyBpLmNvbnN0cnVjdG9yKCkpLnNldEJpZGRlckNvZGUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gaS5nZXRTcGVjKCksIGwgPSBuICYmIG4uZ3ZsaWQsIHAgPSBuICYmIG4uc2tpcFBic0FsaWFzaW5nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gT2JqZWN0KGEubmV3QmlkZGVyKShFKHt9LCBkLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3ZsaWQ6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBza2lwUGJzQWxpYXNpbmc6IHAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBSW3RdID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdy5yZWdpc3RlckJpZEFkYXB0ZXIodSwgdCwgeyBzdXBwb3J0ZWRNZWRpYVR5cGVzOiBzIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmxvZ0Vycm9yKShlICsgJyBiaWRkZXIgZG9lcyBub3QgY3VycmVudGx5IHN1cHBvcnQgYWxpYXNpbmcuJywgJ2FkYXB0ZXJNYW5hZ2VyLmFsaWFzQmlkQWRhcHRlcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoci5sb2dNZXNzYWdlKSgnYWxpYXMgbmFtZSAiJyArIHQgKyAnIiBoYXMgYmVlbiBhbHJlYWR5IHNwZWNpZmllZC4nKTsKICAgICAgICAgICAgICAgIH0sIHcucmVnaXN0ZXJBbmFseXRpY3NBZGFwdGVyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuYWRhcHRlciwgbiA9IGUuY29kZSwgaSA9IGUuZ3ZsaWQ7CiAgICAgICAgICAgICAgICAgICAgdCAmJiBuID8gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdC5lbmFibGVBbmFseXRpY3MgPyAodC5jb2RlID0gbiwgVVtuXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYWRhcHRlcjogdCwKICAgICAgICAgICAgICAgICAgICAgICAgZ3ZsaWQ6IGkKICAgICAgICAgICAgICAgICAgICB9KSA6IE9iamVjdChyLmxvZ0Vycm9yKSgnUHJlYmlkIEVycm9yOiBBbmFseXRpY3MgYWRhcHRvciBlcnJvciBmb3IgYW5hbHl0aWNzICInLmNvbmNhdChuLCAnIlxuICAgICAgICBhbmFseXRpY3MgYWRhcHRlciBtdXN0IGltcGxlbWVudCBhbiBlbmFibGVBbmFseXRpY3MoKSBmdW5jdGlvbicpKSA6IE9iamVjdChyLmxvZ0Vycm9yKSgnUHJlYmlkIEVycm9yOiBhbmFseXRpY3NBZGFwdGVyIG9yIGFuYWx5dGljc0NvZGUgbm90IHNwZWNpZmllZCcpOwogICAgICAgICAgICAgICAgfSwgdy5lbmFibGVBbmFseXRpY3MgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmlzQXJyYXkpKGUpIHx8IChlID0gW2VdKSwgT2JqZWN0KHIuX2VhY2gpKGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gVVtlLnByb3ZpZGVyXS5hZGFwdGVyOwogICAgICAgICAgICAgICAgICAgICAgICB0ID8gdC5lbmFibGVBbmFseXRpY3MoZSkgOiBPYmplY3Qoci5sb2dFcnJvcikoJ1ByZWJpZCBFcnJvcjogbm8gYW5hbHl0aWNzIGFkYXB0ZXIgZm91bmQgaW4gcmVnaXN0cnkgZm9yXG4gICAgICAgICcuY29uY2F0KGUucHJvdmlkZXIsICcuJykpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgdy5nZXRCaWRBZGFwdGVyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQ1tlXTsKICAgICAgICAgICAgICAgIH0sIHcuZ2V0QW5hbHl0aWNzQWRhcHRlciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVbZV07CiAgICAgICAgICAgICAgICB9LCB3LmNhbGxUaW1lZE91dEJpZGRlcnMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHQgPSB0Lm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5wYXJhbXMgPSBPYmplY3Qoci5nZXRVc2VyQ29uZmlndXJlZFBhcmFtcykoZSwgdC5hZFVuaXRDb2RlLCB0LmJpZGRlciksIHQudGltZW91dCA9IG4sIHQ7CiAgICAgICAgICAgICAgICAgICAgfSksIHQgPSBPYmplY3Qoci5ncm91cEJ5KSh0LCAnYmlkZGVyJyksIE9iamVjdC5rZXlzKHQpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgRyhlLCAnb25UaW1lb3V0JywgdFtlXSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCB3LmNhbGxCaWRXb25CaWRkZXIgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHQucGFyYW1zID0gT2JqZWN0KHIuZ2V0VXNlckNvbmZpZ3VyZWRQYXJhbXMpKG4sIHQuYWRVbml0Q29kZSwgdC5iaWRkZXIpLCBnLmEuaW5jcmVtZW50QmlkZGVyV2luc0NvdW50ZXIodC5hZFVuaXRDb2RlLCB0LmJpZGRlciksIEcoZSwgJ29uQmlkV29uJywgdCk7CiAgICAgICAgICAgICAgICB9LCB3LmNhbGxTZXRUYXJnZXRpbmdCaWRkZXIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIEcoZSwgJ29uU2V0VGFyZ2V0aW5nJywgdCk7CiAgICAgICAgICAgICAgICB9LCB3LmNhbGxCaWRWaWV3YWJsZUJpZGRlciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgRyhlLCAnb25CaWRWaWV3YWJsZScsIHQpOwogICAgICAgICAgICAgICAgfSwgdy5jYWxsQmlkZGVyRXJyb3IgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIEcoZSwgJ29uQmlkZGVyRXJyb3InLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiB0LAogICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXJSZXF1ZXN0OiBuCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCB0LmRlZmF1bHQgPSB3OwogICAgICAgICAgICB9LAogICAgICAgICAgICA4MDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCBuLmQodCwgJ2FkVW5pdFNldHVwQ2hlY2tzJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBLOwogICAgICAgICAgICAgICAgfSksIG4uZCh0LCAnY2hlY2tBZFVuaXRTZXR1cCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gSjsKICAgICAgICAgICAgICAgIH0pLCB0LmV4ZWN1dGVDYWxsYmFja3MgPSBaOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE0KSwgaSA9IG4oMCksIG8gPSBuKDIzMCksIGEgPSBuKDYwKSwgYyA9IG4oMyksIHUgPSBuKDIyKSwgcyA9IG4oNDApLCBkID0gbig5KSwgZiA9IG4oMjMxKSwgbCA9IG4oMTIpLCBwID0gbi5uKGwpLCBnID0gbig3NSksIGIgPSBuKDEzKSwgdiA9IG4oNDMpLCB5ID0gbig3KTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKGUpOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBTeW1ib2wgJiYgbnVsbCAhPSBlW1N5bWJvbC5pdGVyYXRvcl0gfHwgbnVsbCAhPSBlWydAQGl0ZXJhdG9yJ10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0oZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpLnNsaWNlKDgsIC0xKTsKICAgICAgICAgICAgICAgICAgICAgICAgJ09iamVjdCcgPT09IG4gJiYgZS5jb25zdHJ1Y3RvciAmJiAobiA9IGUuY29uc3RydWN0b3IubmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnTWFwJyA9PT0gbiB8fCAnU2V0JyA9PT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5mcm9tKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ0FyZ3VtZW50cycgPT09IG4gfHwgL14oPzpVaXxJKW50KD86OHwxNnwzMikoPzpDbGFtcGVkKT9BcnJheSQvLnRlc3QobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbShlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSW52YWxpZCBhdHRlbXB0IHRvIHNwcmVhZCBub24taXRlcmFibGUgaW5zdGFuY2UuXG5JbiBvcmRlciB0byBiZSBpdGVyYWJsZSwgbm9uLWFycmF5IG9iamVjdHMgbXVzdCBoYXZlIGEgW1N5bWJvbC5pdGVyYXRvcl0oKSBtZXRob2QuJyk7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgKG51bGwgPT0gdCB8fCB0ID4gZS5sZW5ndGgpICYmICh0ID0gZS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0gbmV3IEFycmF5KHQpOyBuIDwgdDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICByW25dID0gZVtuXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE8oKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChPID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG4sIHIpICYmIChlW3JdID0gbltyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSkuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBqID0gT2JqZWN0KHIuYSkoKSwgUyA9IG4oNSksIEUgPSBuKDgpLmRlZmF1bHQsIEEgPSBuKDEwKSwgVCA9IGEuYS50cmlnZ2VyVXNlclN5bmNzLCBJID0gUy5FVkVOVFMsIHcgPSBJLkFERF9BRF9VTklUUywgQyA9IEkuQklEX1dPTiwgUiA9IEkuUkVRVUVTVF9CSURTLCBfID0gSS5TRVRfVEFSR0VUSU5HLCBVID0gSS5BRF9SRU5ERVJfRkFJTEVELCBCID0gSS5BRF9SRU5ERVJfU1VDQ0VFREVELCB4ID0gSS5TVEFMRV9SRU5ERVIsIEQgPSBTLkFEX1JFTkRFUl9GQUlMRURfUkVBU09OLCBrID0gRC5QUkVWRU5UX1dSSVRJTkdfT05fTUFJTl9ET0NVTUVOVCwgTiA9IEQuTk9fQUQsIFAgPSBELkVYQ0VQVElPTiwgcSA9IEQuQ0FOTk9UX0ZJTkRfQUQsIE0gPSBELk1JU1NJTkdfRE9DX09SX0FESUQsIEcgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpZFdvbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdS5hLmdldEJpZHNSZXF1ZXN0ZWQoKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5iaWRzLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hZFVuaXRDb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVkdWNlKGkuZmxhdHRlbikuZmlsdGVyKGkudW5pcXVlcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIU9iamVjdChpLmNvbnRhaW5zKSh0LCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBPYmplY3QoaS5sb2dFcnJvcikoJ1RoZSAiJyArIGUgKyAnIiBwbGFjZW1lbnQgaXMgbm90IGRlZmluZWQuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gTChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgZS5kZWZhdWx0VmlldyAmJiBlLmRlZmF1bHRWaWV3LmZyYW1lRWxlbWVudCAmJiAoZS5kZWZhdWx0Vmlldy5mcmFtZUVsZW1lbnQud2lkdGggPSB0LCBlLmRlZmF1bHRWaWV3LmZyYW1lRWxlbWVudC5oZWlnaHQgPSBuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFcoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gW107CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChpLmlzQXJyYXkpKGUpICYmICh0ID8gZS5sZW5ndGggPT09IHQgOiBlLmxlbmd0aCA+IDApICYmIChlLmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoaS5pc0FycmF5T2ZOdW1zKShlLCAyKTsKICAgICAgICAgICAgICAgICAgICB9KSA/IG4gPSBlIDogT2JqZWN0KGkuaXNBcnJheU9mTnVtcykoZSwgMikgJiYgbi5wdXNoKGUpKSwgbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEYoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0KGkuZGVlcENsb25lKShlKSwgbiA9IHQubWVkaWFUeXBlcy5iYW5uZXIsIHIgPSBXKG4uc2l6ZXMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByLmxlbmd0aCA+IDAgPyAobi5zaXplcyA9IHIsIHQuc2l6ZXMgPSByKSA6IChPYmplY3QoaS5sb2dFcnJvcikoJ0RldGVjdGVkIGEgbWVkaWFUeXBlcy5iYW5uZXIgb2JqZWN0IHdpdGhvdXQgYSBwcm9wZXIgc2l6ZXMgZmllbGQuICBQbGVhc2UgZW5zdXJlIHRoZSBzaXplcyBhcmUgbGlzdGVkIGxpa2U6IFtbMzAwLCAyNTBdLCAuLi5dLiAgUmVtb3ZpbmcgaW52YWxpZCBtZWRpYVR5cGVzLmJhbm5lciBvYmplY3QgZnJvbSByZXF1ZXN0LicpLCBkZWxldGUgdC5tZWRpYVR5cGVzLmJhbm5lciksIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB6KGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdChpLmRlZXBDbG9uZSkoZSksIG4gPSB0Lm1lZGlhVHlwZXMudmlkZW87CiAgICAgICAgICAgICAgICAgICAgaWYgKG4ucGxheWVyU2l6ZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICdudW1iZXInID09IHR5cGVvZiBuLnBsYXllclNpemVbMF0gPyAyIDogMSwgbyA9IFcobi5wbGF5ZXJTaXplLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgby5sZW5ndGggPiAwID8gKDIgPT09IHIgJiYgT2JqZWN0KGkubG9nSW5mbykoJ1RyYW5zZm9ybWluZyB2aWRlby5wbGF5ZXJTaXplIGZyb20gWzY0MCw0ODBdIHRvIFtbNjQwLDQ4MF1dIHNvIGl0XCdzIGluIHRoZSBwcm9wZXIgZm9ybWF0LicpLCBuLnBsYXllclNpemUgPSBvLCB0LnNpemVzID0gbykgOiAoT2JqZWN0KGkubG9nRXJyb3IpKCdEZXRlY3RlZCBpbmNvcnJlY3QgY29uZmlndXJhdGlvbiBvZiBtZWRpYVR5cGVzLnZpZGVvLnBsYXllclNpemUuICBQbGVhc2Ugc3BlY2lmeSBvbmx5IG9uZSBzZXQgb2YgZGltZW5zaW9ucyBpbiBhIGZvcm1hdCBsaWtlOiBbWzY0MCwgNDgwXV0uIFJlbW92aW5nIGludmFsaWQgbWVkaWFUeXBlcy52aWRlby5wbGF5ZXJTaXplIHByb3BlcnR5IGZyb20gcmVxdWVzdC4nKSwgZGVsZXRlIHQubWVkaWFUeXBlcy52aWRlby5wbGF5ZXJTaXplKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBWKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdChpLmRlZXBDbG9uZSkoZSksIG4gPSB0Lm1lZGlhVHlwZXMubmF0aXZlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmltYWdlICYmIG4uaW1hZ2Uuc2l6ZXMgJiYgIUFycmF5LmlzQXJyYXkobi5pbWFnZS5zaXplcykgJiYgKE9iamVjdChpLmxvZ0Vycm9yKSgnUGxlYXNlIHVzZSBhbiBhcnJheSBvZiBzaXplcyBmb3IgbmF0aXZlLmltYWdlLnNpemVzIGZpZWxkLiAgUmVtb3ZpbmcgaW52YWxpZCBtZWRpYVR5cGVzLm5hdGl2ZS5pbWFnZS5zaXplcyBwcm9wZXJ0eSBmcm9tIHJlcXVlc3QuJyksIGRlbGV0ZSB0Lm1lZGlhVHlwZXMubmF0aXZlLmltYWdlLnNpemVzKSwgbi5pbWFnZSAmJiBuLmltYWdlLmFzcGVjdF9yYXRpb3MgJiYgIUFycmF5LmlzQXJyYXkobi5pbWFnZS5hc3BlY3RfcmF0aW9zKSAmJiAoT2JqZWN0KGkubG9nRXJyb3IpKCdQbGVhc2UgdXNlIGFuIGFycmF5IG9mIHNpemVzIGZvciBuYXRpdmUuaW1hZ2UuYXNwZWN0X3JhdGlvcyBmaWVsZC4gIFJlbW92aW5nIGludmFsaWQgbWVkaWFUeXBlcy5uYXRpdmUuaW1hZ2UuYXNwZWN0X3JhdGlvcyBwcm9wZXJ0eSBmcm9tIHJlcXVlc3QuJyksIGRlbGV0ZSB0Lm1lZGlhVHlwZXMubmF0aXZlLmltYWdlLmFzcGVjdF9yYXRpb3MpLCBuLmljb24gJiYgbi5pY29uLnNpemVzICYmICFBcnJheS5pc0FycmF5KG4uaWNvbi5zaXplcykgJiYgKE9iamVjdChpLmxvZ0Vycm9yKSgnUGxlYXNlIHVzZSBhbiBhcnJheSBvZiBzaXplcyBmb3IgbmF0aXZlLmljb24uc2l6ZXMgZmllbGQuICBSZW1vdmluZyBpbnZhbGlkIG1lZGlhVHlwZXMubmF0aXZlLmljb24uc2l6ZXMgcHJvcGVydHkgZnJvbSByZXF1ZXN0LicpLCBkZWxldGUgdC5tZWRpYVR5cGVzLm5hdGl2ZS5pY29uLnNpemVzKSwgdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEgoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0KGkuZGVlcEFjY2VzcykoZSwgJ21lZGlhVHlwZXMuJy5jb25jYXQodCwgJy5wb3MnKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFuIHx8ICFPYmplY3QoaS5pc051bWJlcikobikgfHwgIWlzRmluaXRlKG4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gJ1ZhbHVlIG9mIHByb3BlcnR5IFwncG9zXCcgb24gYWQgdW5pdCAnLmNvbmNhdChlLmNvZGUsICcgc2hvdWxkIGJlIG9mIHR5cGU6IE51bWJlcicpOwogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5sb2dXYXJuKShyKSwgQS5lbWl0KFMuRVZFTlRTLkFVQ1RJT05fREVCVUcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdXQVJOSU5HJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3VtZW50czogcgogICAgICAgICAgICAgICAgICAgICAgICB9KSwgZGVsZXRlIGUubWVkaWFUeXBlc1t0XS5wb3M7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0KGYuYSkoKSwgai5iaWRkZXJTZXR0aW5ncyA9IGouYmlkZGVyU2V0dGluZ3MgfHwge30sIGoubGliTG9hZGVkID0gITAsIGoudmVyc2lvbiA9ICd2Ni42LjAnLCBPYmplY3QoaS5sb2dJbmZvKSgnUHJlYmlkLmpzIHY2LjYuMCBsb2FkZWQnKSwgai5pbnN0YWxsZWRNb2R1bGVzID0gai5pbnN0YWxsZWRNb2R1bGVzIHx8IFtdLCBqLmFkVW5pdHMgPSBqLmFkVW5pdHMgfHwgW10sIGoudHJpZ2dlclVzZXJTeW5jcyA9IFQ7CiAgICAgICAgICAgICAgICB2YXIgSyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRhdGVCYW5uZXJNZWRpYVR5cGU6IEYsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlVmlkZW9NZWRpYVR5cGU6IHosCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlTmF0aXZlTWVkaWFUeXBlOiBWLAogICAgICAgICAgICAgICAgICAgICAgICB2YWxpZGF0ZVNpemVzOiBXCiAgICAgICAgICAgICAgICAgICAgfSwgSiA9IE9iamVjdChkLmIpKCdzeW5jJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8sIGEgPSBlLm1lZGlhVHlwZXMsIGMgPSBlLmJpZHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyAmJiBPYmplY3QoaS5pc0FycmF5KShjKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSAmJiAwICE9PSBPYmplY3Qua2V5cyhhKS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5iYW5uZXIgJiYgKG4gPSBGKGUpLCBhLmJhbm5lci5oYXNPd25Qcm9wZXJ0eSgncG9zJykgJiYgKG4gPSBIKG4sICdiYW5uZXInKSkpLCBhLnZpZGVvICYmIChyID0geihuIHx8IGUpLCBhLnZpZGVvLmhhc093blByb3BlcnR5KCdwb3MnKSAmJiAociA9IEgociwgJ3ZpZGVvJykpKSwgYS5uYXRpdmUgJiYgKG8gPSBWKHIgfHwgKG4gfHwgZSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBPKHt9LCBuLCByLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKHUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5sb2dFcnJvcikoJ0RldGVjdGVkIGFkVW5pdC5jb2RlIFwnJy5jb25jYXQoZS5jb2RlLCAnXCcgZGlkIG5vdCBoYXZlIGEgXCdtZWRpYVR5cGVzXCcgb2JqZWN0IGRlZmluZWQuICBUaGlzIGlzIGEgcmVxdWlyZWQgZmllbGQgZm9yIHRoZSBhdWN0aW9uLCBzbyB0aGlzIGFkVW5pdCBoYXMgYmVlbiByZW1vdmVkLicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5sb2dFcnJvcikoJ0RldGVjdGVkIGFkVW5pdC5jb2RlIFwnJy5jb25jYXQoZS5jb2RlLCAnXCcgZGlkIG5vdCBoYXZlIFwnYWRVbml0LmJpZHNcJyBkZWZpbmVkIG9yIFwnYWRVbml0LmJpZHNcJyBpcyBub3QgYW4gYXJyYXkuIFJlbW92aW5nIGFkVW5pdCBmcm9tIGF1Y3Rpb24uJykpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgICAgICB9LCAnY2hlY2tBZFVuaXRTZXR1cCcpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gWShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB1LmFbZV0oKS5maWx0ZXIoaS5iaW5kLmNhbGwoaS5hZFVuaXRzRmlsdGVyLCB0aGlzLCB1LmEuZ2V0QWRVbml0Q29kZXMoKSkpLCBuID0gdS5hLmdldExhc3RBdWN0aW9uSWQoKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWRVbml0Q29kZTsKICAgICAgICAgICAgICAgICAgICB9KS5maWx0ZXIoaS51bmlxdWVzKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hdWN0aW9uSWQgPT09IG4gJiYgdC5hZFVuaXRDb2RlID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9KS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZVswXSAmJiBlWzBdLmFkVW5pdENvZGU7CiAgICAgICAgICAgICAgICAgICAgfSkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0ge30sIG4gPSBlWzBdLmFkVW5pdENvZGUsIHIgPSB7IGJpZHM6IGUgfSwgbiBpbiB0ID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsIG4sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogdFtuXSA9IHIsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByOwogICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBRKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVhc29uLCBuID0gZS5tZXNzYWdlLCByID0gZS5iaWQsIG8gPSBlLmlkLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhc29uOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogbgogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHIgJiYgKGEuYmlkID0gciksIG8gJiYgKGEuYWRJZCA9IG8pLCBPYmplY3QoaS5sb2dFcnJvcikobiksIEEuZW1pdChVLCBhKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uICQoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5kb2MsIG4gPSBlLmJpZCwgciA9IGUuaWQsIGkgPSB7IGRvYzogdCB9OwogICAgICAgICAgICAgICAgICAgIG4gJiYgKGkuYmlkID0gbiksIHIgJiYgKGkuYWRJZCA9IHIpLCBBLmVtaXQoQiwgaSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBYKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQucXVlcnlTZWxlY3RvcihuKTsKICAgICAgICAgICAgICAgICAgICBlLnBhcmVudE5vZGUgJiYgZS5wYXJlbnROb2RlID09PSByIHx8IE9iamVjdChpLmluc2VydEVsZW1lbnQpKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gWihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQ7IHQgPSBlLnNoaWZ0KCk7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCgpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBuKHkuYyksIG4oZWUpLCBlLmNhbGwodGhpcywgdCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBqLmdldEFkc2VydmVyVGFyZ2V0aW5nRm9yQWRVbml0Q29kZVN0ciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChpLmxvZ0luZm8pKCdJbnZva2luZyBwYmpzLmdldEFkc2VydmVyVGFyZ2V0aW5nRm9yQWRVbml0Q29kZVN0cicsIGFyZ3VtZW50cyksIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBqLmdldEFkc2VydmVyVGFyZ2V0aW5nRm9yQWRVbml0Q29kZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChpLnRyYW5zZm9ybUFkU2VydmVyVGFyZ2V0aW5nT2JqKSh0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nTWVzc2FnZSkoJ05lZWQgdG8gY2FsbCBnZXRBZHNlcnZlclRhcmdldGluZ0ZvckFkVW5pdENvZGVTdHIgd2l0aCBhZHVuaXRDb2RlJyk7CiAgICAgICAgICAgICAgICB9LCBqLmdldEhpZ2hlc3RVbnVzZWRCaWRSZXNwb25zZUZvckFkVW5pdENvZGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdS5hLmdldEFsbEJpZHNGb3JBZFVuaXRDb2RlKGUpLmZpbHRlcihzLmEuaXNVbnVzZWRCaWQpLmZpbHRlcihzLmEuaXNCaWROb3RFeHBpcmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQubGVuZ3RoID8gdC5yZWR1Y2UoaS5nZXRIaWdoZXN0Q3BtKSA6IHt9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5sb2dNZXNzYWdlKSgnTmVlZCB0byBjYWxsIGdldEhpZ2hlc3RVbnVzZWRCaWRSZXNwb25zZUZvckFkVW5pdENvZGUgd2l0aCBhZHVuaXRDb2RlJyk7CiAgICAgICAgICAgICAgICB9LCBqLmdldEFkc2VydmVyVGFyZ2V0aW5nRm9yQWRVbml0Q29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGouZ2V0QWRzZXJ2ZXJUYXJnZXRpbmcoZSlbZV07CiAgICAgICAgICAgICAgICB9LCBqLmdldEFkc2VydmVyVGFyZ2V0aW5nID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGkubG9nSW5mbykoJ0ludm9raW5nIHBianMuZ2V0QWRzZXJ2ZXJUYXJnZXRpbmcnLCBhcmd1bWVudHMpLCBzLmQuZ2V0QWxsVGFyZ2V0aW5nKGUpOwogICAgICAgICAgICAgICAgfSwgai5nZXROb0JpZHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChpLmxvZ0luZm8pKCdJbnZva2luZyBwYmpzLmdldE5vQmlkcycsIGFyZ3VtZW50cyksIFkoJ2dldE5vQmlkcycpOwogICAgICAgICAgICAgICAgfSwgai5nZXROb0JpZHNGb3JBZFVuaXRDb2RlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICBiaWRzOiB1LmEuZ2V0Tm9CaWRzKCkuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hZFVuaXRDb2RlID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBqLmdldEJpZFJlc3BvbnNlcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGkubG9nSW5mbykoJ0ludm9raW5nIHBianMuZ2V0QmlkUmVzcG9uc2VzJywgYXJndW1lbnRzKSwgWSgnZ2V0Qmlkc1JlY2VpdmVkJyk7CiAgICAgICAgICAgICAgICB9LCBqLmdldEJpZFJlc3BvbnNlc0ZvckFkVW5pdENvZGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpZHM6IHUuYS5nZXRCaWRzUmVjZWl2ZWQoKS5maWx0ZXIoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFkVW5pdENvZGUgPT09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIGouc2V0VGFyZ2V0aW5nRm9yR1BUQXN5bmMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QoaS5sb2dJbmZvKSgnSW52b2tpbmcgcGJqcy5zZXRUYXJnZXRpbmdGb3JHUFRBc3luYycsIGFyZ3VtZW50cyksIE9iamVjdChpLmlzR3B0UHViYWRzRGVmaW5lZCkoKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHMuZC5nZXRBbGxUYXJnZXRpbmcoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHMuZC5yZXNldFByZXNldFRhcmdldGluZyhlLCB0KSwgcy5kLnNldFRhcmdldGluZ0ZvckdQVChuLCB0KSwgT2JqZWN0LmtleXMobikuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMobltlXSkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdoYl9hZGlkJyA9PT0gdCAmJiB1LmEuc2V0U3RhdHVzRm9yQmlkcyhuW2VdW3RdLCBTLkJJRF9TVEFUVVMuQklEX1RBUkdFVElOR19TRVQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBBLmVtaXQoXywgbik7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChpLmxvZ0Vycm9yKSgnd2luZG93Lmdvb2dsZXRhZyBpcyBub3QgZGVmaW5lZCBvbiB0aGUgcGFnZScpOwogICAgICAgICAgICAgICAgfSwgai5zZXRUYXJnZXRpbmdGb3JBc3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIE9iamVjdChpLmxvZ0luZm8pKCdJbnZva2luZyBwYmpzLnNldFRhcmdldGluZ0ZvckFuJywgYXJndW1lbnRzKSwgcy5kLmlzQXBudGFnRGVmaW5lZCgpID8gKHMuZC5zZXRUYXJnZXRpbmdGb3JBc3QoZSksIEEuZW1pdChfLCBzLmQuZ2V0QWxsVGFyZ2V0aW5nKCkpKSA6IE9iamVjdChpLmxvZ0Vycm9yKSgnd2luZG93LmFwbnRhZyBpcyBub3QgZGVmaW5lZCBvbiB0aGUgcGFnZScpOwogICAgICAgICAgICAgICAgfSwgai5yZW5kZXJBZCA9IE9iamVjdChkLmIpKCdhc3luYycsIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChpLmxvZ0luZm8pKCdJbnZva2luZyBwYmpzLnJlbmRlckFkJywgYXJndW1lbnRzKSwgT2JqZWN0KGkubG9nTWVzc2FnZSkoJ0NhbGxpbmcgcmVuZGVyQWQgd2l0aCBhZElkIDonICsgdCksIGUgJiYgdCkKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdS5hLmZpbmRCaWRCeUFkSWQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgJiYgci5zdGF0dXMgPT09IFMuQklEX1NUQVRVUy5SRU5ERVJFRCAmJiAoT2JqZWN0KGkubG9nV2FybikoJ0FkIGlkICcuY29uY2F0KHIuYWRJZCwgJyBoYXMgYmVlbiByZW5kZXJlZCBiZWZvcmUnKSksIEEuZW1pdCh4LCByKSwgT2JqZWN0KGkuZGVlcEFjY2VzcykoYy5iLmdldENvbmZpZygnYXVjdGlvbk9wdGlvbnMnKSwgJ3N1cHByZXNzU3RhbGVSZW5kZXInKSAmJiAobyA9ICExKSksIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIuYWQgPSBPYmplY3QoaS5yZXBsYWNlQXVjdGlvblByaWNlKShyLmFkLCByLmNwbSksIHIuYWRVcmwgPSBPYmplY3QoaS5yZXBsYWNlQXVjdGlvblByaWNlKShyLmFkVXJsLCByLmNwbSksIG4gJiYgbi5jbGlja1Rocm91Z2gpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbi5jbGlja1Rocm91Z2g7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmFkID0gT2JqZWN0KGkucmVwbGFjZUNsaWNrVGhyb3VnaCkoci5hZCwgYSksIHIuYWRVcmwgPSBPYmplY3QoaS5yZXBsYWNlQ2xpY2tUaHJvdWdoKShyLmFkVXJsLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LmEuYWRkV2lubmluZ0JpZChyKSwgQS5lbWl0KEMsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHIuaGVpZ2h0LCBkID0gci53aWR0aCwgZiA9IHIuYWQsIGwgPSByLm1lZGlhVHlwZSwgcCA9IHIuYWRVcmwsIGcgPSByLnJlbmRlcmVyLCB2ID0gZG9jdW1lbnQuY3JlYXRlQ29tbWVudCgnQ3JlYXRpdmUgJy5jb25jYXQoci5jcmVhdGl2ZUlkLCAnIHNlcnZlZCBieSAnKS5jb25jYXQoci5iaWRkZXIsICcgUHJlYmlkLmpzIEhlYWRlciBCaWRkaW5nJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0KGkuaW5zZXJ0RWxlbWVudCkodiwgZSwgJ2h0bWwnKSwgT2JqZWN0KGIuYykoZykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoYi5iKShnLCByKSwgWCh2LCBlLCAnaHRtbCcpLCAkKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2M6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZSA9PT0gZG9jdW1lbnQgJiYgIU9iamVjdChpLmluSWZyYW1lKSgpIHx8ICd2aWRlbycgPT09IGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB5ID0gJ0Vycm9yIHRyeWluZyB0byB3cml0ZSBhZC4gQWQgcmVuZGVyIGNhbGwgYWQgaWQgJy5jb25jYXQodCwgJyB3YXMgcHJldmVudGVkIGZyb20gd3JpdGluZyB0byB0aGUgbWFpbiBkb2N1bWVudC4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFEoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYXNvbjogaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiB5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZDogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5hdmlnYXRvci51c2VyQWdlbnQgJiYgbmF2aWdhdG9yLnVzZXJBZ2VudC50b0xvd2VyQ2FzZSgpLmluZGV4T2YoJ2ZpcmVmb3gvJykgPiAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gL2ZpcmVmb3hcLyhbXGRcLl0rKS8sIG0gPSBuYXZpZ2F0b3IudXNlckFnZW50LnRvTG93ZXJDYXNlKCkubWF0Y2goaClbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbSAmJiBwYXJzZUludChtLCAxMCkgPCA2NyAmJiBlLm9wZW4oJ3RleHQvaHRtbCcsICdyZXBsYWNlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLndyaXRlKGYpLCBlLmNsb3NlKCksIEwoZSwgZCwgcyksIFgodiwgZSwgJ2h0bWwnKSwgT2JqZWN0KGkuY2FsbEJ1cmwpKHIpLCAkKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2M6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgTyA9IE9iamVjdChpLmNyZWF0ZUludmlzaWJsZUlmcmFtZSkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE8uaGVpZ2h0ID0gcywgTy53aWR0aCA9IGQsIE8uc3R5bGUuZGlzcGxheSA9ICdpbmxpbmUnLCBPLnN0eWxlLm92ZXJmbG93ID0gJ2hpZGRlbicsIE8uc3JjID0gcCwgT2JqZWN0KGkuaW5zZXJ0RWxlbWVudCkoTywgZSwgJ2JvZHknKSwgTChlLCBkLCBzKSwgWCh2LCBlLCAnaHRtbCcpLCBPYmplY3QoaS5jYWxsQnVybCkociksICQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvYzogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWQ6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGogPSAnRXJyb3IgdHJ5aW5nIHRvIHdyaXRlIGFkLiBObyBhZCBmb3IgYmlkIHJlc3BvbnNlIGlkOiAnLmNvbmNhdCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFEoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYXNvbjogTiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiBqLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZDogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBFID0gJ0Vycm9yIHRyeWluZyB0byB3cml0ZSBhZC4gQ2Fubm90IGZpbmQgYWQgYnkgZ2l2ZW4gaWQgOiAnLmNvbmNhdCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBRKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhc29uOiBxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiBFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgVCA9ICdFcnJvciB0cnlpbmcgdG8gd3JpdGUgYWQgSWQgOicuY29uY2F0KHQsICcgdG8gdGhlIHBhZ2U6JykuY29uY2F0KGUubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBRKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFzb246IFAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogVCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEkgPSAnRXJyb3IgdHJ5aW5nIHRvIHdyaXRlIGFkIElkIDonLmNvbmNhdCh0LCAnIHRvIHRoZSBwYWdlLiBNaXNzaW5nIGRvY3VtZW50IG9yIGFkSWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgUSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFzb246IE0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiBJLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHQKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSksIGoucmVtb3ZlQWRVbml0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAoT2JqZWN0KGkubG9nSW5mbykoJ0ludm9raW5nIHBianMucmVtb3ZlQWRVbml0JywgYXJndW1lbnRzKSwgZSkgPyAoT2JqZWN0KGkuaXNBcnJheSkoZSkgPyBlIDogW2VdKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBqLmFkVW5pdHMubGVuZ3RoIC0gMTsgdCA+PSAwOyB0LS0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqLmFkVW5pdHNbdF0uY29kZSA9PT0gZSAmJiBqLmFkVW5pdHMuc3BsaWNlKHQsIDEpOwogICAgICAgICAgICAgICAgICAgIH0pIDogai5hZFVuaXRzID0gW107CiAgICAgICAgICAgICAgICB9LCBqLnJlcXVlc3RCaWRzID0gT2JqZWN0KGQuYikoJ2FzeW5jJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiB7fSwgdCA9IGUuYmlkc0JhY2tIYW5kbGVyLCBuID0gZS50aW1lb3V0LCByID0gZS5hZFVuaXRzLCBvID0gZS5hZFVuaXRDb2RlcywgYSA9IGUubGFiZWxzLCBkID0gZS5hdWN0aW9uSWQ7CiAgICAgICAgICAgICAgICAgICAgQS5lbWl0KFIpOwogICAgICAgICAgICAgICAgICAgIHZhciBmID0gbiB8fCBjLmIuZ2V0Q29uZmlnKCdiaWRkZXJUaW1lb3V0Jyk7CiAgICAgICAgICAgICAgICAgICAgciA9IHIgJiYgYy5iLmNvbnZlcnRBZFVuaXRGcGQoT2JqZWN0KGkuaXNBcnJheSkocikgPyByIDogW3JdKSB8fCBqLmFkVW5pdHMsIE9iamVjdChpLmxvZ0luZm8pKCdJbnZva2luZyBwYmpzLnJlcXVlc3RCaWRzJywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IFtdLCBiID0gW107CiAgICAgICAgICAgICAgICAgICAgaWYgKGMuYi5nZXRDb25maWcoJ3Myc0NvbmZpZycsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmIGUuczJzQ29uZmlnICYmIChsID0gQXJyYXkuaXNBcnJheShlLnMyc0NvbmZpZykgPyBlLnMyc0NvbmZpZyA6IFtlLnMyc0NvbmZpZ10pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgbC5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLnB1c2guYXBwbHkoYiwgaChlLmJpZGRlcnMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIgPSBKKHIpLCBvICYmIG8ubGVuZ3RoID8gciA9IHIuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcCgpKG8sIGUuY29kZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogbyA9IHIgJiYgci5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNvZGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0LmtleXMoZS5tZWRpYVR5cGVzIHx8IHsgYmFubmVyOiAnYmFubmVyJyB9KSwgbiA9IGUuYmlkcy5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYmlkZGVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByID0gRS5iaWRkZXJSZWdpc3RyeSwgbyA9IGIgPyBuLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXAoKShiLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnRyYW5zYWN0aW9uSWQgPSBPYmplY3QoaS5nZW5lcmF0ZVVVSUQpKCksIG8uZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gcltuXSwgYSA9IG8gJiYgby5nZXRTcGVjICYmIG8uZ2V0U3BlYygpLCBjID0gYSAmJiBhLnN1cHBvcnRlZE1lZGlhVHlwZXMgfHwgWydiYW5uZXInXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNvbWUoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAoKShjLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA/IGcuYS5pbmNyZW1lbnRCaWRkZXJSZXF1ZXN0c0NvdW50ZXIoZS5jb2RlLCBuKSA6IChPYmplY3QoaS5sb2dXYXJuKShPYmplY3QoaS51bnN1cHBvcnRlZEJpZGRlck1lc3NhZ2UpKGUsIG4pKSwgZS5iaWRzID0gZS5iaWRzLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5iaWRkZXIgIT09IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGcuYS5pbmNyZW1lbnRSZXF1ZXN0c0NvdW50ZXIoZS5jb2RlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIgJiYgMCAhPT0gci5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSB1LmEuY3JlYXRlQXVjdGlvbih7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRVbml0czogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZFVuaXRDb2RlczogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYlRpbWVvdXQ6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWxzOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1Y3Rpb25JZDogZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHkgPSByLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgeSA+IDE1ICYmIE9iamVjdChpLmxvZ0luZm8pKCdDdXJyZW50IGF1Y3Rpb24gJy5jb25jYXQodi5nZXRBdWN0aW9uSWQoKSwgJyBjb250YWlucyAnKS5jb25jYXQoeSwgJyBhZFVuaXRzLicpLCByKSwgby5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5kLnNldExhdGVzdEF1Y3Rpb25Gb3JBZFVuaXQoZSwgdi5nZXRBdWN0aW9uSWQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB2LmNhbGxCaWRzKCk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChPYmplY3QoaS5sb2dNZXNzYWdlKSgnTm8gYWRVbml0cyBjb25maWd1cmVkLiBObyBiaWRzIHJlcXVlc3RlZC4nKSwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCkKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nRXJyb3IpKCdFcnJvciBleGVjdXRpbmcgYmlkc0JhY2tIYW5kbGVyJywgbnVsbCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pLCBqLnJlcXVlc3RCaWRzLmJlZm9yZShaLCA0OSksIGouYWRkQWRVbml0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nSW5mbykoJ0ludm9raW5nIHBianMuYWRkQWRVbml0cycsIGFyZ3VtZW50cyksIGouYWRVbml0cy5wdXNoLmFwcGx5KGouYWRVbml0cywgYy5iLmNvbnZlcnRBZFVuaXRGcGQoT2JqZWN0KGkuaXNBcnJheSkoZSkgPyBlIDogW2VdKSksIEEuZW1pdCh3KTsKICAgICAgICAgICAgICAgIH0sIGoub25FdmVudCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nSW5mbykoJ0ludm9raW5nIHBianMub25FdmVudCcsIGFyZ3VtZW50cyksIE9iamVjdChpLmlzRm4pKHQpID8gIW4gfHwgR1tlXS5jYWxsKG51bGwsIG4pID8gQS5vbihlLCB0LCBuKSA6IE9iamVjdChpLmxvZ0Vycm9yKSgnVGhlIGlkIHByb3ZpZGVkIGlzIG5vdCB2YWxpZCBmb3IgZXZlbnQgIicgKyBlICsgJyIgYW5kIG5vIGhhbmRsZXIgd2FzIHNldC4nKSA6IE9iamVjdChpLmxvZ0Vycm9yKSgnVGhlIGV2ZW50IGhhbmRsZXIgcHJvdmlkZWQgaXMgbm90IGEgZnVuY3Rpb24gYW5kIHdhcyBub3Qgc2V0IG9uIGV2ZW50ICInICsgZSArICciLicpOwogICAgICAgICAgICAgICAgfSwgai5vZmZFdmVudCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nSW5mbykoJ0ludm9raW5nIHBianMub2ZmRXZlbnQnLCBhcmd1bWVudHMpLCBuICYmICFHW2VdLmNhbGwobnVsbCwgbikgfHwgQS5vZmYoZSwgdCwgbik7CiAgICAgICAgICAgICAgICB9LCBqLmdldEV2ZW50cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGkubG9nSW5mbykoJ0ludm9raW5nIHBianMuZ2V0RXZlbnRzJyksIEEuZ2V0RXZlbnRzKCk7CiAgICAgICAgICAgICAgICB9LCBqLnJlZ2lzdGVyQmlkQWRhcHRlciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nSW5mbykoJ0ludm9raW5nIHBianMucmVnaXN0ZXJCaWRBZGFwdGVyJywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBFLnJlZ2lzdGVyQmlkQWRhcHRlcihlKCksIHQpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nRXJyb3IpKCdFcnJvciByZWdpc3RlcmluZyBiaWRkZXIgYWRhcHRlciA6ICcgKyBlLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGoucmVnaXN0ZXJBbmFseXRpY3NBZGFwdGVyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5sb2dJbmZvKSgnSW52b2tpbmcgcGJqcy5yZWdpc3RlckFuYWx5dGljc0FkYXB0ZXInLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEUucmVnaXN0ZXJBbmFseXRpY3NBZGFwdGVyKGUpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nRXJyb3IpKCdFcnJvciByZWdpc3RlcmluZyBhbmFseXRpY3MgYWRhcHRlciA6ICcgKyBlLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGouY3JlYXRlQmlkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGkubG9nSW5mbykoJ0ludm9raW5nIHBianMuY3JlYXRlQmlkJywgYXJndW1lbnRzKSwgT2JqZWN0KHYuYSkoZSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIGVlID0gW10sIHRlID0gT2JqZWN0KGQuYikoJ2FzeW5jJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiAhT2JqZWN0KGkuaXNFbXB0eSkoZSkgPyAoT2JqZWN0KGkubG9nSW5mbykoJ0ludm9raW5nIHBianMuZW5hYmxlQW5hbHl0aWNzIGZvcjogJywgZSksIEUuZW5hYmxlQW5hbHl0aWNzKGUpKSA6IE9iamVjdChpLmxvZ0Vycm9yKSgncGJqcy5lbmFibGVBbmFseXRpY3Mgc2hvdWxkIGJlIGNhbGxlZCB3aXRoIG9wdGlvbiB7fScpOwogICAgICAgICAgICAgICAgICAgIH0sICdlbmFibGVBbmFseXRpY3NDYicpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gbmUoZSkgewogICAgICAgICAgICAgICAgICAgIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBlLmNhbGxlZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jYWxsKCksIGUuY2FsbGVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nRXJyb3IpKCdFcnJvciBwcm9jZXNzaW5nIGNvbW1hbmQgOicsICdwcmViaWQuanMnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGouZW5hYmxlQW5hbHl0aWNzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlZS5wdXNoKHRlLmJpbmQodGhpcywgZSkpOwogICAgICAgICAgICAgICAgfSwgai5hbGlhc0JpZGRlciA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nSW5mbykoJ0ludm9raW5nIHBianMuYWxpYXNCaWRkZXInLCBhcmd1bWVudHMpLCBlICYmIHQgPyBFLmFsaWFzQmlkQWRhcHRlcihlLCB0LCBuKSA6IE9iamVjdChpLmxvZ0Vycm9yKSgnYmlkZGVyQ29kZSBhbmQgYWxpYXMgbXVzdCBiZSBwYXNzZWQgYXMgYXJndW1lbnRzJywgJ3BianMuYWxpYXNCaWRkZXInKTsKICAgICAgICAgICAgICAgIH0sIGouZ2V0QWxsV2lubmluZ0JpZHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUuYS5nZXRBbGxXaW5uaW5nQmlkcygpOwogICAgICAgICAgICAgICAgfSwgai5nZXRBbGxQcmViaWRXaW5uaW5nQmlkcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdS5hLmdldEJpZHNSZWNlaXZlZCgpLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdGF0dXMgPT09IFMuQklEX1NUQVRVUy5CSURfVEFSR0VUSU5HX1NFVDsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIGouZ2V0SGlnaGVzdENwbUJpZHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBzLmQuZ2V0V2lubmluZ0JpZHMoZSk7CiAgICAgICAgICAgICAgICB9LCBqLm1hcmtXaW5uaW5nQmlkQXNVc2VkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgIGUuYWRVbml0Q29kZSAmJiBlLmFkSWQgPyB0ID0gdS5hLmdldEJpZHNSZWNlaXZlZCgpLmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hZElkID09PSBlLmFkSWQgJiYgdC5hZFVuaXRDb2RlID09PSBlLmFkVW5pdENvZGU7CiAgICAgICAgICAgICAgICAgICAgfSkgOiBlLmFkVW5pdENvZGUgPyB0ID0gcy5kLmdldFdpbm5pbmdCaWRzKGUuYWRVbml0Q29kZSkgOiBlLmFkSWQgPyB0ID0gdS5hLmdldEJpZHNSZWNlaXZlZCgpLmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hZElkID09PSBlLmFkSWQ7CiAgICAgICAgICAgICAgICAgICAgfSkgOiBPYmplY3QoaS5sb2dXYXJuKSgnSW1wcm9wZXIgdXNlIG9mIG1hcmtXaW5uaW5nQmlkQXNVc2VkLiBJdCBuZWVkcyBhbiBhZFVuaXRDb2RlIG9yIGFuIGFkSWQgdG8gZnVuY3Rpb24uJyksIHQubGVuZ3RoID4gMCAmJiAodFswXS5zdGF0dXMgPSBTLkJJRF9TVEFUVVMuUkVOREVSRUQpOwogICAgICAgICAgICAgICAgfSwgai5nZXRDb25maWcgPSBjLmIuZ2V0Q29uZmlnLCBqLnJlYWRDb25maWcgPSBjLmIucmVhZENvbmZpZywgai5tZXJnZUNvbmZpZyA9IGMuYi5tZXJnZUNvbmZpZywgai5tZXJnZUJpZGRlckNvbmZpZyA9IGMuYi5tZXJnZUJpZGRlckNvbmZpZywgai5zZXRDb25maWcgPSBjLmIuc2V0Q29uZmlnLCBqLnNldEJpZGRlckNvbmZpZyA9IGMuYi5zZXRCaWRkZXJDb25maWcsIGoucXVlLnB1c2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qoby5hKSgpOwogICAgICAgICAgICAgICAgfSksIGouY21kLnB1c2ggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jYWxsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChpLmxvZ0Vycm9yKSgnRXJyb3IgcHJvY2Vzc2luZyBjb21tYW5kIDonLCBlLm1lc3NhZ2UsIGUuc3RhY2spOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5sb2dFcnJvcikoJ0NvbW1hbmRzIHdyaXR0ZW4gaW50byBwYmpzLmNtZC5wdXNoIG11c3QgYmUgd3JhcHBlZCBpbiBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICB9LCBqLnF1ZS5wdXNoID0gai5jbWQucHVzaCwgai5wcm9jZXNzUXVldWUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZC5iLnJlYWR5KCksIG5lKGoucXVlKSwgbmUoai5jbWQpOwogICAgICAgICAgICAgICAgfSwgdC5kZWZhdWx0ID0gajsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgODE6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzgxKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHI7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDgyOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdC5hID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FsbEJpZHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc2V0QmlkZGVyQ29kZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBnZXRCaWRkZXJDb2RlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICA4MzogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyOSksIGkgPSBuKDUwKSwgbyA9ICcnLnNwbGl0OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gcihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFPYmplY3QoJ3onKS5wcm9wZXJ0eUlzRW51bWVyYWJsZSgwKTsKICAgICAgICAgICAgICAgIH0pID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1N0cmluZycgPT0gaShlKSA/IG8uY2FsbChlLCAnJykgOiBPYmplY3QoZSk7CiAgICAgICAgICAgICAgICB9IDogT2JqZWN0OwogICAgICAgICAgICB9LAogICAgICAgICAgICA4NDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzMyksIGkgPSBuKDI5KSwgbyA9IG4oODUpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gIXIgJiYgIWkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiA3ICE9IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvKCdkaXYnKSwgJ2EnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KS5hOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDg1OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI3KSwgaSA9IG4oMzApLCBvID0gci5kb2N1bWVudCwgYSA9IGkobykgJiYgaShvLmNyZWF0ZUVsZW1lbnQpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA/IG8uY3JlYXRlRWxlbWVudChlKSA6IHt9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgODY6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTgpLCBpID0gbig2NSk7CiAgICAgICAgICAgICAgICAoZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaVtlXSB8fCAoaVtlXSA9IHZvaWQgMCAhPT0gdCA/IHQgOiB7fSk7CiAgICAgICAgICAgICAgICB9KSgndmVyc2lvbnMnLCBbXSkucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogJzMuMTUuMScsCiAgICAgICAgICAgICAgICAgICAgbW9kZTogciA/ICdwdXJlJyA6ICdnbG9iYWwnLAogICAgICAgICAgICAgICAgICAgIGNvcHlyaWdodDogJ1x4QTkgMjAyMSBEZW5pcyBQdXNoa2FyZXYgKHpsb2lyb2NrLnJ1KScKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICA4NzogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMTMpLCBpID0gbigyOSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhIU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMgJiYgIWkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gU3ltYm9sKCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFTdHJpbmcoZSkgfHwgIShPYmplY3QoZSkgaW5zdGFuY2VvZiBTeW1ib2wpIHx8ICFTeW1ib2wuc2hhbSAmJiByICYmIHIgPCA0MTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICA4ODogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig0OSksIGkgPSBuKDUzKSwgbyA9IG4oMTE4KSwgYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMsIHUgPSByKHQpLCBzID0gaSh1Lmxlbmd0aCksIGQgPSBvKGEsIHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgbiAhPSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHMgPiBkOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChjID0gdVtkKytdKSAhPSBjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHMgPiBkOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoZSB8fCBkIGluIHUpICYmIHVbZF0gPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSB8fCBkIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWUgJiYgLTE7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBpbmNsdWRlczogYSghMCksCiAgICAgICAgICAgICAgICAgICAgaW5kZXhPZjogYSghMSkKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDg5OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDExOSk7CiAgICAgICAgICAgICAgICBuKDEzOSksIG4oMTQxKSwgbigxNDMpLCBuKDE0NSksIG4oMTQ3KSwgbigxNDgpLCBuKDE0OSksIG4oMTUwKSwgbigxNTEpLCBuKDE1MiksIG4oMTUzKSwgbigxNTQpLCBuKDE1NSksIG4oMTU2KSwgbigxNTcpLCBuKDE1OCksIG4oMTU5KSwgbigxNjApLCBlLmV4cG9ydHMgPSByOwogICAgICAgICAgICB9LAogICAgICAgICAgICA5OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgbi5kKHQsICdiJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSksIG4uZCh0LCAnYScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdTsKICAgICAgICAgICAgICAgIH0pLCB0LmQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMl0gPyBhcmd1bWVudHNbMl0gOiAxNSwgciA9IGUuZ2V0SG9va3MoeyBob29rOiB0IH0pOwogICAgICAgICAgICAgICAgICAgIDAgPT09IHIubGVuZ3RoICYmIGUuYmVmb3JlKHQsIG4pOwogICAgICAgICAgICAgICAgfSwgdC5jID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzJdID8gYXJndW1lbnRzWzJdIDoge30sIHIgPSBuLnBvc3RJbnN0YWxsQWxsb3dlZCwgaSA9IHZvaWQgMCAhPT0gciAmJiByOwogICAgICAgICAgICAgICAgICAgIGMoJ2FzeW5jJywgZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgbi5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5hcHBseSh2b2lkIDAsIG8oZSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgaSAmJiAoc1tlXSA9IHQpOwogICAgICAgICAgICAgICAgICAgIH0sIGUpKFtdKTsKICAgICAgICAgICAgICAgIH0sIHQuZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGgsIG4gPSBuZXcgQXJyYXkodCA+IDEgPyB0IC0gMSA6IDApLCByID0gMTsgciA8IHQ7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgbltyIC0gMV0gPSBhcmd1bWVudHNbcl07CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBzW2VdOwogICAgICAgICAgICAgICAgICAgIGlmIChpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5hcHBseSh2b2lkIDAsIG4pOwogICAgICAgICAgICAgICAgICAgIHUoZSkuYmVmb3JlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChuKSwgZSh0KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTcwKSwgaSA9IG4ubihyKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhKGUpOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBTeW1ib2wgJiYgbnVsbCAhPSBlW1N5bWJvbC5pdGVyYXRvcl0gfHwgbnVsbCAhPSBlWydAQGl0ZXJhdG9yJ10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpLnNsaWNlKDgsIC0xKTsKICAgICAgICAgICAgICAgICAgICAgICAgJ09iamVjdCcgPT09IG4gJiYgZS5jb25zdHJ1Y3RvciAmJiAobiA9IGUuY29uc3RydWN0b3IubmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnTWFwJyA9PT0gbiB8fCAnU2V0JyA9PT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5mcm9tKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ0FyZ3VtZW50cycgPT09IG4gfHwgL14oPzpVaXxJKW50KD86OHwxNnwzMikoPzpDbGFtcGVkKT9BcnJheSQvLnRlc3QobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSW52YWxpZCBhdHRlbXB0IHRvIHNwcmVhZCBub24taXRlcmFibGUgaW5zdGFuY2UuXG5JbiBvcmRlciB0byBiZSBpdGVyYWJsZSwgbm9uLWFycmF5IG9iamVjdHMgbXVzdCBoYXZlIGEgW1N5bWJvbC5pdGVyYXRvcl0oKSBtZXRob2QuJyk7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgKG51bGwgPT0gdCB8fCB0ID4gZS5sZW5ndGgpICYmICh0ID0gZS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0gbmV3IEFycmF5KHQpOyBuIDwgdDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICByW25dID0gZVtuXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBjID0gaSgpKHsgcmVhZHk6IGkuYS5TWU5DIHwgaS5hLkFTWU5DIHwgaS5hLlFVRVVFIH0pLCB1ID0gYy5nZXQ7CiAgICAgICAgICAgICAgICB2YXIgcyA9IHt9OwogICAgICAgICAgICB9LAogICAgICAgICAgICA5MDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig1NiksIGkgPSBuKDMwKSwgbyA9IG4oMzEpLCBhID0gbigzNCkuZiwgYyA9IG4oNjYpLCB1ID0gbigxMjIpLCBzID0gYygnbWV0YScpLCBkID0gMCwgZiA9IE9iamVjdC5pc0V4dGVuc2libGUgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfSwgbCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEoZSwgcywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3RJRDogJ08nICsgKytkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlYWtEYXRhOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBwID0gZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgICAgICBSRVFVSVJFRDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgIGZhc3RLZXk6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzeW1ib2wnID09IHR5cGVvZiBlID8gZSA6ICgnc3RyaW5nJyA9PSB0eXBlb2YgZSA/ICdTJyA6ICdQJykgKyBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFvKGUsIHMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0YnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdFJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbc10ub2JqZWN0SUQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldFdlYWtEYXRhOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFvKGUsIHMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3NdLndlYWtEYXRhOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBvbkZyZWV6ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1ICYmIHAuUkVRVUlSRUQgJiYgZihlKSAmJiAhbyhlLCBzKSAmJiBsKGUpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHJbc10gPSAhMDsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgOTE6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMjMpLCBpID0gbig0MSksIG8gPSByKCdpdGVyYXRvcicpLCBhID0gQXJyYXkucHJvdG90eXBlOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBlICYmIChpLkFycmF5ID09PSBlIHx8IGFbb10gPT09IGUpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgOTI6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTcpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmV0dXJuOwogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQuY2FsbChlKSkudmFsdWU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICA5MzogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IFsKICAgICAgICAgICAgICAgICAgICAnY29uc3RydWN0b3InLAogICAgICAgICAgICAgICAgICAgICdoYXNPd25Qcm9wZXJ0eScsCiAgICAgICAgICAgICAgICAgICAgJ2lzUHJvdG90eXBlT2YnLAogICAgICAgICAgICAgICAgICAgICdwcm9wZXJ0eUlzRW51bWVyYWJsZScsCiAgICAgICAgICAgICAgICAgICAgJ3RvTG9jYWxlU3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAndG9TdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICd2YWx1ZU9mJwogICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgOTQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNzEpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgbi51bnNhZmUgJiYgZVtpXSA/IGVbaV0gPSB0W2ldIDogcihlLCBpLCB0W2ldLCBuKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDk1OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDk2KS5JdGVyYXRvclByb3RvdHlwZSwgaSA9IG4oNzApLCBvID0gbig0NCksIGEgPSBuKDU5KSwgYyA9IG4oNDEpLCB1ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHQgKyAnIEl0ZXJhdG9yJzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUgPSBpKHIsIHsgbmV4dDogbygxLCBuKSB9KSwgYShlLCBzLCAhMSwgITApLCBjW3NdID0gdSwgZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDk2OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIsIGksIG8sIGEgPSBuKDI5KSwgYyA9IG4oOTcpLCB1ID0gbigzMiksIHMgPSBuKDMxKSwgZCA9IG4oMjMpLCBmID0gbigxOCksIGwgPSBkKCdpdGVyYXRvcicpLCBwID0gITE7CiAgICAgICAgICAgICAgICBbXS5rZXlzICYmICgnbmV4dCcgaW4gKG8gPSBbXS5rZXlzKCkpID8gKGkgPSBjKGMobykpKSAhPT0gT2JqZWN0LnByb3RvdHlwZSAmJiAociA9IGkpIDogcCA9ICEwKTsKICAgICAgICAgICAgICAgIHZhciBnID0gbnVsbCA9PSByIHx8IGEoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0ge307CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJbbF0uY2FsbChlKSAhPT0gZTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZyAmJiAociA9IHt9KSwgZiAmJiAhZyB8fCBzKHIsIGwpIHx8IHUociwgbCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgfSksIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBJdGVyYXRvclByb3RvdHlwZTogciwKICAgICAgICAgICAgICAgICAgICBCVUdHWV9TQUZBUklfSVRFUkFUT1JTOiBwCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICA5NzogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzMSksIGkgPSBuKDUyKSwgbyA9IG4oNjkpLCBhID0gbigxMzEpLCBjID0gbygnSUVfUFJPVE8nKSwgdSA9IE9iamVjdC5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBhID8gT2JqZWN0LmdldFByb3RvdHlwZU9mIDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IGkoZSksIHIoZSwgYykgPyBlW2NdIDogJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZS5jb25zdHJ1Y3RvciAmJiBlIGluc3RhbmNlb2YgZS5jb25zdHJ1Y3RvciA/IGUuY29uc3RydWN0b3IucHJvdG90eXBlIDogZSBpbnN0YW5jZW9mIE9iamVjdCA/IHUgOiBudWxsOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgOTc0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gbig4MCk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDk4OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEzNikuY2hhckF0LCBpID0gbig0NiksIG8gPSBuKDcyKSwgYSA9ICdTdHJpbmcgSXRlcmF0b3InLCBjID0gaS5zZXQsIHUgPSBpLmdldHRlckZvcihhKTsKICAgICAgICAgICAgICAgIG8oU3RyaW5nLCAnU3RyaW5nJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBjKHRoaXMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nOiBTdHJpbmcoZSksCiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiAwCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQgPSB1KHRoaXMpLCBuID0gdC5zdHJpbmcsIGkgPSB0LmluZGV4OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBpID49IG4ubGVuZ3RoID8gewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgIH0gOiAoZSA9IHIobiwgaSksIHQuaW5kZXggKz0gZS5sZW5ndGgsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICExCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgOTk6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNDkpLCBpID0gbig1NCksIG8gPSBuKDQxKSwgYSA9IG4oNDYpLCBjID0gbig3MiksIHUgPSAnQXJyYXkgSXRlcmF0b3InLCBzID0gYS5zZXQsIGQgPSBhLmdldHRlckZvcih1KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGMoQXJyYXksICdBcnJheScsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcyh0aGlzLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHUsCiAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldDogcihlKSwKICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIGtpbmQ6IHQKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGQodGhpcyksIHQgPSBlLnRhcmdldCwgbiA9IGUua2luZCwgciA9IGUuaW5kZXgrKzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXQgfHwgciA+PSB0Lmxlbmd0aCA/IChlLnRhcmdldCA9IHZvaWQgMCwgewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgIH0pIDogJ2tleXMnID09IG4gPyB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiByLAogICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMQogICAgICAgICAgICAgICAgICAgIH0gOiAndmFsdWVzJyA9PSBuID8gewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdFtyXSwKICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICB9IDogewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbcl0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgJ3ZhbHVlcycpLCBvLkFyZ3VtZW50cyA9IG8uQXJyYXksIGkoJ2tleXMnKSwgaSgndmFsdWVzJyksIGkoJ2VudHJpZXMnKTsKICAgICAgICAgICAgfQogICAgICAgIH0pOwogICAgICAgIHBianNDaHVuayhbMzQ4XSwgewogICAgICAgICAgICAyODA6IGZ1bmN0aW9uIChlLCB0LCByKSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByKDI4MSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDI4MTogZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCByLmQodCwgJ3NwZWMnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGs7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciBuLCBpLCBhLCBvID0gcigwKSwgcyA9IHIoMSksIGMgPSByKDIpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gdSgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHUgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGFyZ3VtZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwociwgbikgJiYgKGVbbl0gPSByW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChkID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3IgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiBlLmNvbnN0cnVjdG9yID09PSBTeW1ib2wgJiYgZSAhPT0gU3ltYm9sLnByb3RvdHlwZSA/ICdzeW1ib2wnIDogdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgfSkoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCB8fCAodCA9IGUuc2xpY2UoMCkpLCBPYmplY3QuZnJlZXplKE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGUsIHsgcmF3OiB7IHZhbHVlOiBPYmplY3QuZnJlZXplKHQpIH0gfSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGwgPSAnYW9sJywgbSA9ICd2ZXJpem9uJywgZiA9ICdvbmVtb2JpbGUnLCBiID0gJ29uZWRpc3BsYXknLCBoID0geyBHRVQ6ICdkaXNwbGF5LWdldCcgfSwgdiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgR0VUOiAnbW9iaWxlLWdldCcsCiAgICAgICAgICAgICAgICAgICAgICAgIFBPU1Q6ICdtb2JpbGUtcG9zdCcKICAgICAgICAgICAgICAgICAgICB9LCBnID0gewogICAgICAgICAgICAgICAgICAgICAgICBUQUc6ICdpZnJhbWUnLAogICAgICAgICAgICAgICAgICAgICAgICBUWVBFOiAnaWZyYW1lJwogICAgICAgICAgICAgICAgICAgIH0sIHkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFRBRzogJ2ltZycsCiAgICAgICAgICAgICAgICAgICAgICAgIFRZUEU6ICdpbWFnZScKICAgICAgICAgICAgICAgICAgICB9LCBPID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnYWRzZXJ2ZXIub3JnJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NyaXRlby5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAnaWQ1LXN5bmMuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2ludGVudGlxLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICdsaXZlaW50ZW50LmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICdxdWFudGNhc3QuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3Zlcml6b25tZWRpYS5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAnbGl2ZXJhbXAuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3lhaG9vLmNvbScKICAgICAgICAgICAgICAgICAgICBdLCBQID0gQyhuIHx8IChuID0gcChbCiAgICAgICAgICAgICAgICAgICAgICAgICcnLAogICAgICAgICAgICAgICAgICAgICAgICAnL3B1YmFwaS8zLjAvJywKICAgICAgICAgICAgICAgICAgICAgICAgJy8nLAogICAgICAgICAgICAgICAgICAgICAgICAnLycsCiAgICAgICAgICAgICAgICAgICAgICAgICcvJywKICAgICAgICAgICAgICAgICAgICAgICAgJy9BRFRFQ0g7dj0yO2NtZD1iaWQ7Y29ycz15ZXM7YWxpYXM9JywKICAgICAgICAgICAgICAgICAgICAgICAgJzttaXNjPScsCiAgICAgICAgICAgICAgICAgICAgICAgICc7JywKICAgICAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgICAgICBdKSksICdob3N0JywgJ25ldHdvcmsnLCAncGxhY2VtZW50JywgJ3BhZ2VpZCcsICdzaXplaWQnLCAnYWxpYXMnLCAnbWlzYycsICdkeW5hbWljUGFyYW1zJyksIGogPSBDKGkgfHwgKGkgPSBwKFsKICAgICAgICAgICAgICAgICAgICAgICAgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICcvYmlkUmVxdWVzdD8nCiAgICAgICAgICAgICAgICAgICAgXSkpLCAnaG9zdCcpLCBFID0gQyhhIHx8IChhID0gcChbCiAgICAgICAgICAgICAgICAgICAgICAgICdkY249JywKICAgICAgICAgICAgICAgICAgICAgICAgJyZwb3M9JywKICAgICAgICAgICAgICAgICAgICAgICAgJyZjbWQ9YmlkJywKICAgICAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgICAgICBdKSksICdkY24nLCAncG9zJywgJ2R5bmFtaWNQYXJhbXMnKSwgUyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgdXM6ICdhZHNlcnZlci11cy5hZHRlY2guYWR2ZXJ0aXNpbmcuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgZXU6ICdhZHNlcnZlci1ldS5hZHRlY2guYWR2ZXJ0aXNpbmcuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgYXM6ICdhZHNlcnZlci1hcy5hZHRlY2guYWR2ZXJ0aXNpbmcuY29tJwogICAgICAgICAgICAgICAgICAgIH0sIFQgPSAnaHR0cHMnLCB4ID0gMTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEMoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoLCByID0gbmV3IEFycmF5KHQgPiAxID8gdCAtIDEgOiAwKSwgbiA9IDE7IG4gPCB0OyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHJbbiAtIDFdID0gYXJndW1lbnRzW25dOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoLCBuID0gbmV3IEFycmF5KHQpLCBpID0gMDsgaSA8IHQ7IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5baV0gPSBhcmd1bWVudHNbaV07CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbltuLmxlbmd0aCAtIDFdIHx8IHt9LCBzID0gW2VbMF1dOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5mb3JFYWNoKGZ1bmN0aW9uICh0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IE9iamVjdChvLmlzSW50ZWdlcikodCkgPyBuW3RdIDogYVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMucHVzaChpLCBlW3IgKyAxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBzLmpvaW4oJycpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBJKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gbCB8fCBlID09PSBtIHx8IGUgPT09IGY7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB3KGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoSShlLmJpZGRlcikgJiYgZS5wYXJhbXMuaWQgJiYgZS5wYXJhbXMuaW1wICYmIGUucGFyYW1zLmltcFswXSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucGFyYW1zLmltcFswXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuaWQgJiYgdC50YWdpZCAmJiB0LmJhbm5lciAmJiB0LmJhbm5lci53ICYmIHQuYmFubmVyLmg7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUihlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEkoZS5iaWRkZXIpICYmIGUucGFyYW1zLmRjbiAmJiBlLnBhcmFtcy5wb3M7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBVKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKCh0ID0gZS5iaWRkZXIpID09PSBsIHx8IHQgPT09IG0gfHwgdCA9PT0gYikgJiYgZS5wYXJhbXMucGxhY2VtZW50ICYmIGUucGFyYW1zLm5ldHdvcms7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBNKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS51c2VySWRBc0VpZHMuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSAhPT0gTy5pbmRleE9mKGUuc291cmNlKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBrID0gewogICAgICAgICAgICAgICAgICAgIGNvZGU6IGwsCiAgICAgICAgICAgICAgICAgICAgZ3ZsaWQ6IDI1LAogICAgICAgICAgICAgICAgICAgIGFsaWFzZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgZiwKICAgICAgICAgICAgICAgICAgICAgICAgYiwKICAgICAgICAgICAgICAgICAgICAgICAgbQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgc3VwcG9ydGVkTWVkaWFUeXBlczogW2MuYl0sCiAgICAgICAgICAgICAgICAgICAgaXNCaWRSZXF1ZXN0VmFsaWQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVKGUpIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUihlKSB8fCB3KGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9KGUpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgYnVpbGRSZXF1ZXN0czogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzLCBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIChuLmdkcHIgPSB0LmdkcHJDb25zZW50LCBuLnVzcENvbnNlbnQgPSB0LnVzcENvbnNlbnQpLCBlLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBSKGUpID8gdi5HRVQgOiB3KGUpID8gdi5QT1NUIDogVShlKSA/IGguR0VUIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmZvcm1hdEJpZFJlcXVlc3QodCwgZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaW50ZXJwcmV0UmVzcG9uc2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5ib2R5OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzLl9wYXJzZUJpZFJlc3BvbnNlKHIsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG8ubG9nRXJyb3IpKCdFbXB0eSBiaWQgcmVzcG9uc2UnLCB0LmJpZGRlckNvZGUsIHIpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZ2V0VXNlclN5bmNzOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICFPYmplY3Qoby5pc0VtcHR5KSh0KSAmJiB0WzBdLmJvZHk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByICYmIHIuZXh0ICYmIHIuZXh0LnBpeGVscyA/IHRoaXMucGFyc2VQaXhlbEl0ZW1zKHIuZXh0LnBpeGVscykgOiBbXTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGZvcm1hdEJpZFJlcXVlc3Q6IGZ1bmN0aW9uIChlLCB0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBoLkdFVDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB0aGlzLmJ1aWxkTWFya2V0cGxhY2VVcmwodCwgciksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnR0VUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dGw6IDYwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugdi5HRVQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogdGhpcy5idWlsZE9uZU1vYmlsZUdldFVybCh0LCByKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdHRVQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR0bDogMzYwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHYuUE9TVDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB0aGlzLmJ1aWxkT25lTW9iaWxlQmFzZVVybCh0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dGw6IDM2MDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogdGhpcy5idWlsZE9wZW5SdGJSZXF1ZXN0RGF0YSh0LCByKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnRUeXBlOiAnYXBwbGljYXRpb24vanNvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbUhlYWRlcnM6IHsgJ3gtb3BlbnJ0Yi12ZXJzaW9uJzogJzIuMicgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uYmlkZGVyQ29kZSA9IHQuYmlkZGVyLCBuLmJpZElkID0gdC5iaWRJZCwgbi51c2VyU3luY09uID0gdC5wYXJhbXMudXNlclN5bmNPbiwgbjsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGJ1aWxkTWFya2V0cGxhY2VVcmw6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBuID0gZS5wYXJhbXMsIGkgPSBuLnNlcnZlciwgYSA9IG4ucmVnaW9uIHx8ICd1cyc7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTLmhhc093blByb3BlcnR5KGEpIHx8IChPYmplY3Qoby5sb2dXYXJuKSgnVW5rbm93biByZWdpb24gXCcnLmNvbmNhdChhLCAnXCcgZm9yIEFPTCBiaWRkZXIuJykpLCBhID0gJ3VzJyksIHIgPSBpIHx8IFNbYV0sIG4ucmVnaW9uID0gYSwgdGhpcy5hcHBseVByb3RvY29sKFAoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaG9zdDogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldHdvcms6IG4ubmV0d29yaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBsYWNlbWVudDogcGFyc2VJbnQobi5wbGFjZW1lbnQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZWlkOiBuLnBhZ2VJZCB8fCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZWlkOiBuLnNpemVJZCB8fCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxpYXM6IG4uYWxpYXMgfHwgT2JqZWN0KG8uZ2V0VW5pcXVlSWRlbnRpZmllclN0cikoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pc2M6IG5ldyBEYXRlKCkuZ2V0VGltZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZHluYW1pY1BhcmFtczogdGhpcy5mb3JtYXRNYXJrZXRwbGFjZUR5bmFtaWNQYXJhbXMobiwgdCkKICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgYnVpbGRPbmVNb2JpbGVHZXRVcmw6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5wYXJhbXMsIG4gPSByLmRjbiwgaSA9IHIucG9zLCBhID0gci5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09PSBkKGUudXNlcklkKSAmJiAoYSA9IGEgfHwge30sIE0oZSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYVsnZWlkJyArIGUuc291cmNlXSA9IGUudWlkc1swXS5pZDsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRoaXMuYnVpbGRPbmVNb2JpbGVCYXNlVXJsKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobiAmJiBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHRoaXMuZm9ybWF0T25lTW9iaWxlRHluYW1pY1BhcmFtcyhhLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gKz0gRSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGNuOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvczogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkeW5hbWljUGFyYW1zOiBzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGJ1aWxkT25lTW9iaWxlQmFzZVVybDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYXBwbHlQcm90b2NvbChqKHsgaG9zdDogZS5wYXJhbXMuaG9zdCB8fCAnYzJzaGIuc3NwLnlhaG9vLmNvbScgfSkpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgYXBwbHlQcm90b2NvbDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC9eaHR0cHM/OlwvXC8vaS50ZXN0KGUpID8gZSA6IDAgPT09IGUuaW5kZXhPZignLy8nKSA/ICcnLmNvbmNhdChULCAnOicpLmNvbmNhdChlKSA6ICcnLmNvbmNhdChULCAnOi8vJykuY29uY2F0KGUpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZm9ybWF0TWFya2V0cGxhY2VEeW5hbWljUGFyYW1zOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiB7fSwgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDoge30sIHIgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgdShyLCB0aGlzLmZvcm1hdEtleVZhbHVlcyhlLmtleVZhbHVlcykpLCB1KHIsIHRoaXMuZm9ybWF0Q29uc2VudERhdGEodCkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KG8uX2VhY2gpKHIsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICs9ICcnLmNvbmNhdCh0LCAnPScpLmNvbmNhdChlbmNvZGVVUklDb21wb25lbnQoZSksICc7Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZm9ybWF0T25lTW9iaWxlRHluYW1pY1BhcmFtczogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30sIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmlzU2VjdXJlUHJvdG9jb2woKSAmJiAoZS5zZWN1cmUgPSB4KSwgdShlLCB0aGlzLmZvcm1hdENvbnNlbnREYXRhKHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChvLl9lYWNoKShlLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgciArPSAnJicuY29uY2F0KHQsICc9JykuY29uY2F0KGVuY29kZVVSSUNvbXBvbmVudChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgYnVpbGRPcGVuUnRiUmVxdWVzdERhdGE6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiB7fSwgciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogZS5wYXJhbXMuaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW1wOiBlLnBhcmFtcy5pbXAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmlzRVVDb25zZW50UmVxdWlyZWQodCkgJiYgKE9iamVjdChvLmRlZXBTZXRWYWx1ZSkociwgJ3JlZ3MuZXh0LmdkcHInLCB4KSwgdC5nZHByLmNvbnNlbnRTdHJpbmcgJiYgT2JqZWN0KG8uZGVlcFNldFZhbHVlKShyLCAndXNlci5leHQuY29uc2VudCcsIHQuZ2Rwci5jb25zZW50U3RyaW5nKSksIHQudXNwQ29uc2VudCAmJiBPYmplY3Qoby5kZWVwU2V0VmFsdWUpKHIsICdyZWdzLmV4dC51c19wcml2YWN5JywgdC51c3BDb25zZW50KSwgJ29iamVjdCcgPT09IGQoZS51c2VySWQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnVzZXIgPSByLnVzZXIgfHwge30sIHIudXNlci5leHQgPSByLnVzZXIuZXh0IHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBNKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5sZW5ndGggPiAwICYmIChyLnVzZXIuZXh0LmVpZHMgPSBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzRVVDb25zZW50UmVxdWlyZWQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIShlICYmIGUuZ2RwciAmJiBlLmdkcHIuZ2RwckFwcGxpZXMpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZm9ybWF0S2V5VmFsdWVzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KG8uX2VhY2gpKGUsIGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0WydrdicuY29uY2F0KHIpXSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZm9ybWF0Q29uc2VudERhdGE6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmlzRVVDb25zZW50UmVxdWlyZWQoZSkgJiYgKHQuZ2RwciA9IHgsIGUuZ2Rwci5jb25zZW50U3RyaW5nICYmICh0LmV1Y29uc2VudCA9IGUuZ2Rwci5jb25zZW50U3RyaW5nKSksIGUudXNwQ29uc2VudCAmJiAodC51c19wcml2YWN5ID0gZS51c3BDb25zZW50KSwgdDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHBhcnNlUGl4ZWxJdGVtczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAvXHcqKD89XHMpLywgciA9IC9zcmM9KCJ8JykoLio/KVwxLywgbiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLm1hdGNoKC8oaW1nfGlmcmFtZSlbXHNcU10qP3NyY1xzKj1ccyooInwnKSguKj8pXDIvZ2kpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaSAmJiBpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUubWF0Y2godClbMF0sIGEgPSBlLm1hdGNoKHIpWzJdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJiYgYSAmJiBuLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBpID09PSB5LlRBRyA/IHkuVFlQRSA6IGcuVFlQRSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIF9wYXJzZUJpZFJlc3BvbnNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBlLnNlYXRiaWRbMF0uYmlkWzBdOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIuZXh0ICYmIHIuZXh0LmVuY3ApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gci5leHQuZW5jcDsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAobnVsbCA9PT0gKG4gPSByLnByaWNlKSB8fCBpc05hTihuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIE9iamVjdChvLmxvZ0Vycm9yKSgnSW52YWxpZCBwcmljZSBpbiBiaWQgcmVzcG9uc2UnLCBsLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlckNvZGU6IHQuYmlkZGVyQ29kZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3RJZDogdC5iaWRJZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkOiByLmFkbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNwbTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiByLncsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IHIuaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0aXZlSWQ6IHIuY3JpZCB8fCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHViYXBpSWQ6IGUuaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW5jeTogZS5jdXIgfHwgJ1VTRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWFsSWQ6IHIuZGVhbGlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV0UmV2ZW51ZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRhOiB7IGFkdmVydGlzZXJEb21haW5zOiByICYmIHIuYWRvbWFpbiA/IHIuYWRvbWFpbiA6IFtdIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dGw6IHQudHRsCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc09uZU1vYmlsZUJpZGRlcjogSSwKICAgICAgICAgICAgICAgICAgICBpc1NlY3VyZVByb3RvY29sOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaHR0cHM6JyA9PT0gZG9jdW1lbnQubG9jYXRpb24ucHJvdG9jb2w7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIE9iamVjdChzLnJlZ2lzdGVyQmlkZGVyKShrKSwgd2luZG93LnBianMuaW5zdGFsbGVkTW9kdWxlcy5wdXNoKCdhb2xCaWRBZGFwdGVyJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCBbMjgwXSk7CiAgICAgICAgcGJqc0NodW5rKFszNDVdLCB7CiAgICAgICAgICAgIDI5MDogZnVuY3Rpb24gKGUsIHIsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHQoMjkxKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMjkxOiBmdW5jdGlvbiAoZSwgciwgdCkgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHIsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHQuZChyLCAnc3BlYycsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIGEgPSB0KDApLCBuID0gdCgxMyksIGkgPSB0KDMpLCBzID0gdCgxKSwgbyA9IHQoMiksIGQgPSB0KDIyKSwgYyA9IHQoMTEpLCBwID0gdC5uKGMpLCB1ID0gdCgxMiksIGwgPSB0Lm4odSksIG0gPSB0KDIwKSwgZiA9IHQoNyk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGIgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGUuY29uc3RydWN0b3IgPT09IFN5bWJvbCAmJiBlICE9PSBTeW1ib2wucHJvdG90eXBlID8gJ3N5bWJvbCcgOiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9KShlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHYoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICh2ID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMTsgciA8IGFyZ3VtZW50cy5sZW5ndGg7IHIrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHNbcl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHQsIGEpICYmIChlW2FdID0gdFthXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSkuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHkoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnKGUpOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBTeW1ib2wgJiYgbnVsbCAhPSBlW1N5bWJvbC5pdGVyYXRvcl0gfHwgbnVsbCAhPSBlWydAQGl0ZXJhdG9yJ10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcoZSwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpLnNsaWNlKDgsIC0xKTsKICAgICAgICAgICAgICAgICAgICAgICAgJ09iamVjdCcgPT09IHQgJiYgZS5jb25zdHJ1Y3RvciAmJiAodCA9IGUuY29uc3RydWN0b3IubmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnTWFwJyA9PT0gdCB8fCAnU2V0JyA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5mcm9tKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ0FyZ3VtZW50cycgPT09IHQgfHwgL14oPzpVaXxJKW50KD86OHwxNnwzMikoPzpDbGFtcGVkKT9BcnJheSQvLnRlc3QodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyhlLCByKTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSW52YWxpZCBhdHRlbXB0IHRvIHNwcmVhZCBub24taXRlcmFibGUgaW5zdGFuY2UuXG5JbiBvcmRlciB0byBiZSBpdGVyYWJsZSwgbm9uLWFycmF5IG9iamVjdHMgbXVzdCBoYXZlIGEgW1N5bWJvbC5pdGVyYXRvcl0oKSBtZXRob2QuJyk7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgKG51bGwgPT0gciB8fCByID4gZS5sZW5ndGgpICYmIChyID0gZS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAwLCBhID0gbmV3IEFycmF5KHIpOyB0IDwgcjsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICBhW3RdID0gZVt0XTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBoID0gJ2FwcG5leHVzJywgXyA9ICdodHRwczovL2liLmFkbnhzLmNvbS91dC92My9wcmViaWQnLCBrID0gJ2h0dHBzOi8vaWIuYWRueHMtc2ltcGxlLmNvbS91dC92My9wcmViaWQnLCBPID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnbWluZHVyYXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAnbWF4ZHVyYXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAnc2tpcHBhYmxlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3BsYXliYWNrX21ldGhvZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdmcmFtZXdvcmtzJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbnRleHQnLAogICAgICAgICAgICAgICAgICAgICAgICAnc2tpcG9mZnNldCcKICAgICAgICAgICAgICAgICAgICBdLCBqID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnbWluZHVyYXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAnbWF4ZHVyYXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAnc2tpcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdza2lwYWZ0ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAncGxheWJhY2ttZXRob2QnLAogICAgICAgICAgICAgICAgICAgICAgICAnYXBpJwogICAgICAgICAgICAgICAgICAgIF0sIEkgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICdhZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAnZXh0ZXJuYWxVaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnc2VnbWVudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAnZ2VuZGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2RudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdsYW5ndWFnZScKICAgICAgICAgICAgICAgICAgICBdLCBBID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnZ2VvJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2RldmljZV9pZCcKICAgICAgICAgICAgICAgICAgICBdLCB3ID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnZW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdkb25nbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnbWVtYmVyX2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2RlYnVnX3RpbWVvdXQnCiAgICAgICAgICAgICAgICAgICAgXSwgeCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgcGxheWJhY2tfbWV0aG9kOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bmtub3duOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXV0b19wbGF5X3NvdW5kX29uOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXV0b19wbGF5X3NvdW5kX29mZjogMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWNrX3RvX3BsYXk6IDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb3VzZV9vdmVyOiA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXV0b19wbGF5X3NvdW5kX3Vua25vd246IDUKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5rbm93bjogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZV9yb2xsOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlkX3JvbGw6IDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb3N0X3JvbGw6IDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRzdHJlYW06IDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaW4tYmFubmVyJzogNQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgQyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogJ2Rlc2NyaXB0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgYm9keTI6ICdkZXNjMicsCiAgICAgICAgICAgICAgICAgICAgICAgIGN0YTogJ2N0YXRleHQnLAogICAgICAgICAgICAgICAgICAgICAgICBpbWFnZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmVyTmFtZTogJ21haW5faW1hZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZWRQYXJhbXM6IHsgcmVxdWlyZWQ6ICEwIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaWNvbjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmVyTmFtZTogJ2ljb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZWRQYXJhbXM6IHsgcmVxdWlyZWQ6ICEwIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc3BvbnNvcmVkQnk6ICdzcG9uc29yZWRfYnknLAogICAgICAgICAgICAgICAgICAgICAgICBwcml2YWN5TGluazogJ3ByaXZhY3lfbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNhbGVQcmljZTogJ3NhbGVwcmljZScsCiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlVcmw6ICdkaXNwbGF5dXJsJwogICAgICAgICAgICAgICAgICAgIH0sIFMgPSAvXC9cL2NkblwuYWRueHNcLmNvbVwvdnxcL1wvY2RuXC5hZG54c1wtc2ltcGxlXC5jb21cL3YvLCBUID0gT2JqZWN0KGYuYikoMzIsIGgpLCBFID0gewogICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiBoLAogICAgICAgICAgICAgICAgICAgICAgICBndmxpZDogMzIsCiAgICAgICAgICAgICAgICAgICAgICAgIGFsaWFzZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiAnYXBwbmV4dXNBc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd2bGlkOiAzMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgY29kZTogJ2JyZWFsdGltZScgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiAnZW14ZGlnaXRhbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3ZsaWQ6IDE4MwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgY29kZTogJ3BhZ2VzY2llbmNlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgeyBjb2RlOiAnZGVmeW1lZGlhJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgeyBjb2RlOiAnZ291cm1ldGFkcycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgY29kZTogJ21hdG9teScgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgY29kZTogJ2ZlYXR1cmVmb3J3YXJkJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgeyBjb2RlOiAnb2Z0bWVkaWEnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTogJ2Rpc3RyaWN0bScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3ZsaWQ6IDE0NAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgY29kZTogJ2FkYXN0YScgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiAnYmVpbnRvbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3ZsaWQ6IDYxOAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBzdXBwb3J0ZWRNZWRpYVR5cGVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLmIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLmQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLmMKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgaXNCaWRSZXF1ZXN0VmFsaWQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISEoZS5wYXJhbXMucGxhY2VtZW50SWQgfHwgZS5wYXJhbXMubWVtYmVyICYmIGUucGFyYW1zLmludkNvZGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBidWlsZFJlcXVlc3RzOiBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLm1hcChxKSwgbiA9IHAoKShlLCB6KSwgcyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgITAgPT09IGkuYi5nZXRDb25maWcoJ2NvcHBhJykgJiYgKHMgPSB7IGNvcHBhOiAhMCB9KSwgbiAmJiBPYmplY3Qua2V5cyhuLnBhcmFtcy51c2VyKS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbCgpKEksIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0KGEuY29udmVydENhbWVsVG9VbmRlcnNjb3JlKShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3NlZ21lbnRzJyA9PT0gZSAmJiBPYmplY3QoYS5pc0FycmF5KShuLnBhcmFtcy51c2VyW2VdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnBhcmFtcy51c2VyW2VdLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChhLmlzTnVtYmVyKShlKSA/IHQucHVzaCh7IGlkOiBlIH0pIDogT2JqZWN0KGEuaXNQbGFpbk9iamVjdCkoZSkgJiYgdC5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgc1tyXSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZWdtZW50cycgIT09IGUgJiYgKHNbcl0gPSBuLnBhcmFtcy51c2VyW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8sIGQgPSBwKCkoZSwgQik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkICYmIGQucGFyYW1zICYmIGQucGFyYW1zLmFwcCAmJiAobyA9IHt9LCBPYmplY3Qua2V5cyhkLnBhcmFtcy5hcHApLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKCkoQSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9bZV0gPSBkLnBhcmFtcy5hcHBbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYywgdSA9IHAoKShlLCBGKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgJiYgdS5wYXJhbXMgJiYgZC5wYXJhbXMuYXBwICYmIGQucGFyYW1zLmFwcC5pZCAmJiAoYyA9IHsgYXBwaWQ6IHUucGFyYW1zLmFwcC5pZCB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0ge30sIGYgPSB7fSwgYiA9IFQuZ2V0Q29va2llKCdhcG5fcHJlYmlkX2RlYnVnJykgfHwgbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gPSBKU09OLnBhcnNlKGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGEubG9nRXJyb3IpKCdBcHBOZXh1cyBEZWJ1ZyBBdWN0aW9uIENvb2tpZSBFcnJvcjpcblxuJyArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB2ID0gcCgpKGUsIFYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYgJiYgdi5kZWJ1ZyAmJiAobSA9IHYuZGVidWcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbSAmJiBtLmVuYWJsZWQgJiYgT2JqZWN0LmtleXMobSkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwoKSh3LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmW2VdID0gbVtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBwKCkoZSwgRCksIGggPSBnID8gcGFyc2VJbnQoZy5wYXJhbXMubWVtYmVyLCAxMCkgOiAwLCBPID0gZVswXS5zY2hhaW4sIGogPSBwKCkoZSwgVyksIHggPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhZ3M6IHkodCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXI6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNkazogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAncGJqcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiAnNi42LjAnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjaGFpbjogTwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaiAmJiAoeC5pYWJfc3VwcG9ydCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb21pZHBuOiAnQXBwbmV4dXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbWlkcHY6ICc2LjYuMCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaCA+IDAgJiYgKHgubWVtYmVyX2lkID0gaCksIGQgJiYgKHguZGV2aWNlID0gbyksIHUgJiYgKHguYXBwID0gYyksIGkuYi5nZXRDb25maWcoJ2FkcG9kLmJyYW5kQ2F0ZWdvcnlFeGNsdXNpb24nKSAmJiAoeC5icmFuZF9jYXRlZ29yeV91bmlxdWVuZXNzID0gITApLCBmLmVuYWJsZWQgJiYgKHguZGVidWcgPSBmLCBPYmplY3QoYS5sb2dJbmZvKSgnQXBwTmV4dXMgRGVidWcgQXVjdGlvbiBTZXR0aW5nczpcblxuJyArIEpTT04uc3RyaW5naWZ5KGYsIG51bGwsIDQpKSksIHIgJiYgci5nZHByQ29uc2VudCAmJiAoeC5nZHByX2NvbnNlbnQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRfc3RyaW5nOiByLmdkcHJDb25zZW50LmNvbnNlbnRTdHJpbmcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRfcmVxdWlyZWQ6IHIuZ2RwckNvbnNlbnQuZ2RwckFwcGxpZXMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByLmdkcHJDb25zZW50LmFkZHRsQ29uc2VudCAmJiAtMSAhPT0gci5nZHByQ29uc2VudC5hZGR0bENvbnNlbnQuaW5kZXhPZignficpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBDID0gci5nZHByQ29uc2VudC5hZGR0bENvbnNlbnQsIFMgPSBDLnN1YnN0cmluZyhDLmluZGV4T2YoJ34nKSArIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHguZ2Rwcl9jb25zZW50LmFkZHRsX2NvbnNlbnQgPSBTLnNwbGl0KCcuJykubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUludChlLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociAmJiByLnVzcENvbnNlbnQgJiYgKHgudXNfcHJpdmFjeSA9IHIudXNwQ29uc2VudCksIHIgJiYgci5yZWZlcmVySW5mbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBFID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZF9yZWY6IGVuY29kZVVSSUNvbXBvbmVudChyLnJlZmVyZXJJbmZvLnJlZmVyZXIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZF90b3A6IHIucmVmZXJlckluZm8ucmVhY2hlZFRvcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmRfaWZzOiByLnJlZmVyZXJJbmZvLm51bUlmcmFtZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJkX3N0azogci5yZWZlcmVySW5mby5zdGFjay5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJywnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeC5yZWZlcnJlcl9kZXRlY3Rpb24gPSBFOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHAoKShlLCBKKSAmJiBlLmZpbHRlcihKKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHIubWVkaWFUeXBlcy52aWRlbywgbiA9IHQuZHVyYXRpb25SYW5nZVNlYywgaSA9IHQucmVxdWlyZUV4YWN0RHVyYXRpb24sIHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLmFkUG9kRHVyYXRpb25TZWMsIHQgPSBlLmR1cmF0aW9uUmFuZ2VTZWMsIG4gPSBlLnJlcXVpcmVFeGFjdER1cmF0aW9uLCBpID0gT2JqZWN0KGEuZ2V0TWluVmFsdWVGcm9tQXJyYXkpKHQpLCBzID0gTWF0aC5mbG9vcihyIC8gaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA/IE1hdGgubWF4KHMsIHQubGVuZ3RoKSA6IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oci5tZWRpYVR5cGVzLnZpZGVvKSwgbyA9IE9iamVjdChhLmdldE1heFZhbHVlRnJvbUFycmF5KShuKSwgZCA9IGUuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS51dWlkID09PSByLmJpZElkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYyA9IGEuZmlsbC5hcHBseSh2b2lkIDAsIHkoZCkuY29uY2F0KFtzXSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gTWF0aC5jZWlsKHMgLyBuLmxlbmd0aCksIHUgPSBPYmplY3QoYS5jaHVuaykoYywgcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uZm9yRWFjaChmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdVtyXS5tYXAoZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIKHIsICdtaW5kdXJhdGlvbicsIGUpLCBIKHIsICdtYXhkdXJhdGlvbicsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEgoZSwgJ21heGR1cmF0aW9uJywgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0LCBlKSwgbiA9IHgudGFncy5maWx0ZXIoZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci51dWlkICE9PSBlLmJpZElkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHgudGFncyA9IFtdLmNvbmNhdCh5KG4pLCB5KHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZVswXS51c2VySWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgUiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEsoUiwgT2JqZWN0KGEuZGVlcEFjY2VzcykoZVswXSwgJ3VzZXJJZC5mbG9jSWQuaWQnKSwgJ2Nocm9tZS5jb20nLCBudWxsKSwgSyhSLCBPYmplY3QoYS5kZWVwQWNjZXNzKShlWzBdLCAndXNlcklkLmNyaXRlb0lkJyksICdjcml0ZW8uY29tJywgbnVsbCksIEsoUiwgT2JqZWN0KGEuZGVlcEFjY2VzcykoZVswXSwgJ3VzZXJJZC5uZXRJZCcpLCAnbmV0aWQuZGUnLCBudWxsKSwgSyhSLCBPYmplY3QoYS5kZWVwQWNjZXNzKShlWzBdLCAndXNlcklkLmlkbF9lbnYnKSwgJ2xpdmVyYW1wLmNvbScsIG51bGwpLCBLKFIsIE9iamVjdChhLmRlZXBBY2Nlc3MpKGVbMF0sICd1c2VySWQudGRpZCcpLCAnYWRzZXJ2ZXIub3JnJywgJ1RESUQnKSwgSyhSLCBPYmplY3QoYS5kZWVwQWNjZXNzKShlWzBdLCAndXNlcklkLnVpZDIuaWQnKSwgJ3VpZGFwaS5jb20nLCAnVUlEMicpLCBSLmxlbmd0aCAmJiAoeC5laWRzID0gUik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFswXS5wdWJsaXNoZXJfaWQgJiYgKHgucHVibGlzaGVyX2lkID0gdFswXS5wdWJsaXNoZXJfaWQpLCBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW10sIG4gPSB7IHdpdGhDcmVkZW50aWFsczogITAgfSwgcyA9IF87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTihyKSB8fCAocyA9IGspOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUUlVFJyAhPT0gT2JqZWN0KGEuZ2V0UGFyYW1ldGVyQnlOYW1lKSgnYXBuX3Rlc3QnKS50b1VwcGVyQ2FzZSgpICYmICEwICE9PSBpLmIuZ2V0Q29uZmlnKCdhcG5fdGVzdCcpIHx8IChuLmN1c3RvbUhlYWRlcnMgPSB7ICdYLUlzLVRlc3QnOiAxIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLnRhZ3MubGVuZ3RoID4gMTUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBPYmplY3QoYS5kZWVwQ2xvbmUpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoYS5jaHVuaykoZS50YWdzLCAxNSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby50YWdzID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gSlNPTi5zdHJpbmdpZnkobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlclJlcXVlc3Q6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gSlNPTi5zdHJpbmdpZnkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXJSZXF1ZXN0OiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oeCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGludGVycHJldFJlc3BvbnNlOiBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLCBpID0gci5iaWRkZXJSZXF1ZXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUuYm9keTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUgfHwgZS5lcnJvcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gJ2luIHJlc3BvbnNlIGZvciAnLmNvbmNhdChpLmJpZGRlckNvZGUsICcgYWRhcHRlcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGUuZXJyb3IgJiYgKGMgKz0gJzogJy5jb25jYXQoZS5lcnJvcikpLCBPYmplY3QoYS5sb2dFcnJvcikoYyksIGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS50YWdzICYmIGUudGFncy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBjID0gKHIgPSBlKSAmJiByLmFkcyAmJiByLmFkcy5sZW5ndGggJiYgcCgpKHIuYWRzLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJ0YjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyAmJiAoKE9iamVjdChhLmlzQWxsb3daZXJvQ3BtQmlkc0VuYWJsZWQpKGkuYmlkZGVyQ29kZSkgPyBjLmNwbSA+PSAwIDogYy5jcG0gPiAwKSAmJiBsKCkodC5zdXBwb3J0ZWRNZWRpYVR5cGVzLCBjLmFkX3R5cGUpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBmdW5jdGlvbiAoZSwgciwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gT2JqZWN0KGEuZ2V0QmlkUmVxdWVzdCkoZS51dWlkLCBbdF0pLCBkID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdElkOiBlLnV1aWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcG06IHIuY3BtLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRpdmVJZDogci5jcmVhdGl2ZV9pZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlYWxJZDogci5kZWFsX2lkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVuY3k6ICdVU0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV0UmV2ZW51ZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dGw6IDMwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkVW5pdENvZGU6IGkuYWRVbml0Q29kZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwcG5leHVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnV5ZXJNZW1iZXJJZDogci5idXllcl9tZW1iZXJfaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVhbFByaW9yaXR5OiByLmRlYWxfcHJpb3JpdHksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVhbENvZGU6IHIuZGVhbF9jb2RlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5hZG9tYWluICYmIChkLm1ldGEgPSB2KHt9LCBkLm1ldGEsIHsgYWR2ZXJ0aXNlckRvbWFpbnM6IFtdIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmFkdmVydGlzZXJfaWQgJiYgKGQubWV0YSA9IHYoe30sIGQubWV0YSwgeyBhZHZlcnRpc2VySWQ6IHIuYWR2ZXJ0aXNlcl9pZCB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXI6ICcxLjAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcGxldGU6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2RlczogW3sgYnNpZDogZS5idXllcl9tZW1iZXJfaWQudG9TdHJpbmcoKSB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmJ1eWVyX21lbWJlcl9pZCAmJiAoZC5tZXRhID0gdih7fSwgZC5tZXRhLCB7IGRjaGFpbjogYyhyKSB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5icmFuZF9pZCAmJiAoZC5tZXRhID0gdih7fSwgZC5tZXRhLCB7IGJyYW5kSWQ6IHIuYnJhbmRfaWQgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLnJ0Yi52aWRlbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHYoZCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiByLnJ0Yi52aWRlby5wbGF5ZXJfd2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiByLnJ0Yi52aWRlby5wbGF5ZXJfaGVpZ2h0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhc3RJbXBVcmw6IHIubm90aWZ5X3VybCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dGw6IDM2MDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QoYS5kZWVwQWNjZXNzKShpLCAnbWVkaWFUeXBlcy52aWRlby5jb250ZXh0JykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBvLmE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IE9iamVjdChzLmdldElhYlN1YkNhdGVnb3J5KShpLmJpZGRlciwgci5icmFuZF9jYXRlZ29yeV9pZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLm1ldGEgPSB2KHt9LCBkLm1ldGEsIHsgcHJpbWFyeUNhdElkOiB1IH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSByLmRlYWxfcHJpb3JpdHk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnZpZGVvID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IG8uYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdXJhdGlvblNlY29uZHM6IE1hdGguZmxvb3Ioci5ydGIudmlkZW8uZHVyYXRpb25fbXMgLyAxMDAwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWFsVGllcjogbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZC52YXN0VXJsID0gci5ydGIudmlkZW8uYXNzZXRfdXJsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbS5iOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQuYWRSZXNwb25zZSA9IGUsIGQuYWRSZXNwb25zZS5hZCA9IGQuYWRSZXNwb25zZS5hZHNbMF0sIGQuYWRSZXNwb25zZS5hZC52aWRlbyA9IGQuYWRSZXNwb25zZS5hZC5ydGIudmlkZW8sIGQudmFzdFhtbCA9IHIucnRiLnZpZGVvLmNvbnRlbnQsIHIucmVuZGVyZXJfdXJsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBwKCkodC5iaWRzLCBmdW5jdGlvbiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuYmlkSWQgPT09IGUudXVpZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGIgPSBPYmplY3QoYS5kZWVwQWNjZXNzKShmLCAncmVuZGVyZXIub3B0aW9ucycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQucmVuZGVyZXIgPSBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzJdID8gYXJndW1lbnRzWzJdIDoge30sIGkgPSBuLmEuaW5zdGFsbCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHIucmVuZGVyZXJfaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiByLnJlbmRlcmVyX3VybCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWc6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9hZGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZFVuaXRDb2RlOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuc2V0UmVuZGVyKEwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoYS5sb2dXYXJuKSgnUHJlYmlkIEVycm9yIGNhbGxpbmcgc2V0UmVuZGVyIG9uIHJlbmRlcmVyJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuc2V0RXZlbnRIYW5kbGVycyh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbXByZXNzaW9uOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChhLmxvZ01lc3NhZ2UpKCdBcHBOZXh1cyBvdXRzdHJlYW0gdmlkZW8gaW1wcmVzc2lvbiBldmVudCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvYWRlZDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoYS5sb2dNZXNzYWdlKSgnQXBwTmV4dXMgb3V0c3RyZWFtIHZpZGVvIGxvYWRlZCBldmVudCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZGVkOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGEubG9nTWVzc2FnZSkoJ0FwcE5leHVzIG91dHN0cmVhbSByZW5kZXJlciB2aWRlbyBldmVudCcpLCBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCcjJy5jb25jYXQoZSkpLnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZC5hZFVuaXRDb2RlLCByLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG0uYToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQudmFzdFVybCA9IHIubm90aWZ5X3VybCArICcmcmVkaXI9JyArIGVuY29kZVVSSUNvbXBvbmVudChyLnJ0Yi52aWRlby5hc3NldF91cmwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChyLnJ0YltvLmNdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB5ID0gci5ydGJbby5jXSwgZyA9IHIudmlld2FiaWxpdHkuY29uZmlnLnJlcGxhY2UoJ3NyYz0nLCAnZGF0YS1zcmM9JyksIGggPSB5LmphdmFzY3JpcHRfdHJhY2tlcnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT0gaCA/IGggPSBnIDogT2JqZWN0KGEuaXNTdHIpKGgpID8gaCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0gOiBoLnB1c2goZyksIGRbby5jXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB5LnRpdGxlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogeS5kZXNjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keTI6IHkuZGVzYzIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdGE6IHkuY3RhdGV4dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJhdGluZzogeS5yYXRpbmcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcG9uc29yZWRCeTogeS5zcG9uc29yZWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcml2YWN5TGluazogeS5wcml2YWN5X2xpbmssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGRyZXNzOiB5LmFkZHJlc3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3dubG9hZHM6IHkuZG93bmxvYWRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlrZXM6IHkubGlrZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaG9uZTogeS5waG9uZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaWNlOiB5LnByaWNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FsZVByaWNlOiB5LnNhbGVwcmljZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaWNrVXJsOiB5LmxpbmsudXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheVVybDogeS5kaXNwbGF5dXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpY2tUcmFja2VyczogeS5saW5rLmNsaWNrX3RyYWNrZXJzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW1wcmVzc2lvblRyYWNrZXJzOiB5LmltcHJlc3Npb25fdHJhY2tlcnMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqYXZhc2NyaXB0VHJhY2tlcnM6IGgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5tYWluX2ltZyAmJiAoZC5uYXRpdmUuaW1hZ2UgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHkubWFpbl9pbWcudXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiB5Lm1haW5faW1nLmhlaWdodCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiB5Lm1haW5faW1nLndpZHRoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB5Lmljb24gJiYgKGQubmF0aXZlLmljb24gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHkuaWNvbi51cmwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IHkuaWNvbi5oZWlnaHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogeS5pY29uLndpZHRoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYoZCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IHIucnRiLmJhbm5lci53aWR0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogci5ydGIuYmFubmVyLmhlaWdodCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkOiByLnJ0Yi5iYW5uZXIuY29udGVudAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLnJ0Yi50cmFja2VycykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBfID0gMDsgXyA8IHIucnRiLnRyYWNrZXJzWzBdLmltcHJlc3Npb25fdXJscy5sZW5ndGg7IF8rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IHIucnRiLnRyYWNrZXJzWzBdLmltcHJlc3Npb25fdXJsc1tfXSwgTyA9IE9iamVjdChhLmNyZWF0ZVRyYWNrUGl4ZWxIdG1sKShrKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5hZCArPSBPOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGEubG9nRXJyb3IpKCdFcnJvciBhcHBlbmRpbmcgdHJhY2tpbmcgcGl4ZWwnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSwgYywgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1Lm1lZGlhVHlwZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLmFkX3R5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPT09IG8uZCA/IG8uZCA6IHIgPT09IG8uYyA/IG8uYyA6IG8uYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oYyksIGQucHVzaCh1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlLmRlYnVnICYmIGUuZGVidWcuZGVidWdfaW5mbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gJ0FwcE5leHVzIERlYnVnIEF1Y3Rpb24gZm9yIFByZWJpZFxuXG4nICsgZS5kZWJ1Zy5kZWJ1Z19pbmZvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSB1LnJlcGxhY2UoLyg8dGQ+fDx0aD4pL2dtLCAnXHQnKS5yZXBsYWNlKC8oPFwvdGQ+fDxcL3RoPikvZ20sICdcbicpLnJlcGxhY2UoL148YnI+L2dtLCAnJykucmVwbGFjZSgvKDxicj5cbnw8YnI+KS9nbSwgJ1xuJykucmVwbGFjZSgvPGgxPiguKik8XC9oMT4vZ20sICdcblxuPT09PT0gJDEgPT09PT1cblxuJykucmVwbGFjZSgvPGhbMi02XT4oLiopPFwvaFsyLTZdPi9nbSwgJ1xuXG4qKiogJDEgKioqXG5cbicpLnJlcGxhY2UoLyg8KFtePl0rKT4pL2dpbSwgJycpLCBPYmplY3QoYS5sb2dNZXNzYWdlKSgnaHR0cHM6Ly9jb25zb2xlLmFwcG5leHVzLmNvbS9kb2NzL3VuZGVyc3RhbmRpbmctdGhlLWRlYnVnLWF1Y3Rpb24nKSwgT2JqZWN0KGEubG9nTWVzc2FnZSkodSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TWFwcGluZ0ZpbGVJbmZvOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vYWNkbi5hZG54cy1zaW1wbGUuY29tL3ByZWJpZC9hcHBuZXh1cy1tYXBwaW5nL21hcHBpbmdzLmpzb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hJbkRheXM6IDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldFVzZXJTeW5jczogZnVuY3Rpb24gKGUsIHIsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmlmcmFtZUVuYWJsZWQgJiYgTih7IGdkcHJDb25zZW50OiB0IH0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2lmcmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL2FjZG4uYWRueHMuY29tL2RtcC9hc3luY191c2Vyc3luYy5odG1sJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtQmlkUGFyYW1zOiBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBPYmplY3QoYS5jb252ZXJ0VHlwZXMpKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZW1iZXI6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludkNvZGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBsYWNlbWVudElkOiAnbnVtYmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXl3b3JkczogYS50cmFuc2Zvcm1CaWRkZXJQYXJhbUtleXdvcmRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlcklkOiAnbnVtYmVyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSksIHIgJiYgKGUudXNlX3BtdF9ydWxlID0gJ2Jvb2xlYW4nID09IHR5cGVvZiBlLnVzZVBheW1lbnRSdWxlICYmIGUudXNlUGF5bWVudFJ1bGUsIGUudXNlUGF5bWVudFJ1bGUgJiYgZGVsZXRlIGUudXNlUGF5bWVudFJ1bGUsIFIoZS5rZXl3b3JkcykgJiYgZS5rZXl3b3Jkcy5mb3JFYWNoKFApLCBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3QoYS5jb252ZXJ0Q2FtZWxUb1VuZGVyc2NvcmUpKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgIT09IHIgJiYgKGVbdF0gPSBlW3JdLCBkZWxldGUgZVtyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG9uQmlkV29uOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uYXRpdmUgJiYgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0KGEuaXNTdHIpKGUpICYmIFUoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoT2JqZWN0KGEuaXNBcnJheSkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMDsgdCA8IGUubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVShuKSAmJiAociA9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUubmF0aXZlLmphdmFzY3JpcHRUcmFja2Vycyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAncGJqc19hZGlkPScgKyBlLmFkSWQgKyAnO3BianNfYXVjPScgKyBlLmFkVW5pdENvZGUsIG4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuaW5kZXhPZignc3JjPSInKSArIDUsIHQgPSBlLmluZGV4T2YoJyInLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3Vic3RyaW5nKHIsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0ociksIGkgPSBuLnJlcGxhY2UoJ2RvbV9pZD0lbmF0aXZlX2RvbV9pZCUnLCB0KSwgcyA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdpZnJhbWUnKSwgbyA9ICExLCBkID0gMDsgZCA8IHMubGVuZ3RoICYmICFvOyBkKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gc1tkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBjLmNvbnRlbnREb2N1bWVudCB8fCBjLmNvbnRlbnRXaW5kb3cuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHUgPSBwLmdldEVsZW1lbnRzQnlUYWdOYW1lKCdzY3JpcHQnKSwgbCA9IDA7IGwgPCB1Lmxlbmd0aCAmJiAhbzsgbCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IHVbbF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtLmdldEF0dHJpYnV0ZSgnZGF0YS1zcmMnKSA9PSBuICYmIChtLnNldEF0dHJpYnV0ZSgnc3JjJywgaSksIG0uc2V0QXR0cmlidXRlKCdkYXRhLXNyYycsICcnKSwgbS5yZW1vdmVBdHRyaWJ1dGUgJiYgbS5yZW1vdmVBdHRyaWJ1dGUoJ2RhdGEtc3JjJyksIG8gPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgRE9NRXhjZXB0aW9uICYmICdTZWN1cml0eUVycm9yJyA9PT0gZS5uYW1lKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBSKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISEoT2JqZWN0KGEuaXNBcnJheSkoZSkgJiYgZS5sZW5ndGggPiAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFAoZSkgewogICAgICAgICAgICAgICAgICAgIFIoZS52YWx1ZSkgJiYgJycgPT09IGUudmFsdWVbMF0gJiYgZGVsZXRlIGUudmFsdWU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBVKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUubWF0Y2goUyksIHQgPSBudWxsICE9IHIgJiYgci5sZW5ndGggPj0gMSwgYSA9IGUubWF0Y2goJ3Ryay5qcycpLCBuID0gbnVsbCAhPSBhICYmIGEubGVuZ3RoID49IDE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RhcnRzV2l0aCgnPHNjcmlwdCcpICYmIG4gJiYgdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE4oZSkgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gITA7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5nZHByQ29uc2VudCAmJiBlLmdkcHJDb25zZW50LmdkcHJBcHBsaWVzICYmIDIgPT09IGUuZ2RwckNvbnNlbnQuYXBpVmVyc2lvbiAmJiAociA9ICEoITAgIT09IE9iamVjdChhLmRlZXBBY2Nlc3MpKGUuZ2RwckNvbnNlbnQsICd2ZW5kb3JEYXRhLnB1cnBvc2UuY29uc2VudHMuMScpKSksIHI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBxKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHt9OwogICAgICAgICAgICAgICAgICAgIHIuc2l6ZXMgPSBNKGUuc2l6ZXMpLCByLnByaW1hcnlfc2l6ZSA9IHIuc2l6ZXNbMF0sIHIuYWRfdHlwZXMgPSBbXSwgci51dWlkID0gZS5iaWRJZCwgZS5wYXJhbXMucGxhY2VtZW50SWQgPyByLmlkID0gcGFyc2VJbnQoZS5wYXJhbXMucGxhY2VtZW50SWQsIDEwKSA6IHIuY29kZSA9IGUucGFyYW1zLmludkNvZGUsIHIuYWxsb3dfc21hbGxlcl9zaXplcyA9IGUucGFyYW1zLmFsbG93U21hbGxlclNpemVzIHx8ICExLCByLnVzZV9wbXRfcnVsZSA9IGUucGFyYW1zLnVzZVBheW1lbnRSdWxlIHx8ICExLCByLnByZWJpZCA9ICEwLCByLmRpc2FibGVfcHNhID0gITA7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIU9iamVjdChhLmlzRm4pKGUuZ2V0Rmxvb3IpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucGFyYW1zLnJlc2VydmUgPyBlLnBhcmFtcy5yZXNlcnZlIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLmdldEZsb29yKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbmN5OiAnVVNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhVHlwZTogJyonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTogJyonCiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0KGEuaXNQbGFpbk9iamVjdCkocikgJiYgIWlzTmFOKHIuZmxvb3IpICYmICdVU0QnID09PSByLmN1cnJlbmN5KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuZmxvb3I7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0oZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgKHIucmVzZXJ2ZSA9IHQpLCBlLnBhcmFtcy5wb3NpdGlvbiAmJiAoci5wb3NpdGlvbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFib3ZlOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmVsb3c6IDIKICAgICAgICAgICAgICAgICAgICAgICAgfVtlLnBhcmFtcy5wb3NpdGlvbl0gfHwgMCksIGUucGFyYW1zLnRyYWZmaWNTb3VyY2VDb2RlICYmIChyLnRyYWZmaWNfc291cmNlX2NvZGUgPSBlLnBhcmFtcy50cmFmZmljU291cmNlQ29kZSksIGUucGFyYW1zLnByaXZhdGVTaXplcyAmJiAoci5wcml2YXRlX3NpemVzID0gTShlLnBhcmFtcy5wcml2YXRlU2l6ZXMpKSwgZS5wYXJhbXMuc3VwcGx5VHlwZSAmJiAoci5zdXBwbHlfdHlwZSA9IGUucGFyYW1zLnN1cHBseVR5cGUpLCBlLnBhcmFtcy5wdWJDbGljayAmJiAoci5wdWJjbGljayA9IGUucGFyYW1zLnB1YkNsaWNrKSwgZS5wYXJhbXMuZXh0SW52Q29kZSAmJiAoci5leHRfaW52X2NvZGUgPSBlLnBhcmFtcy5leHRJbnZDb2RlKSwgZS5wYXJhbXMucHVibGlzaGVySWQgJiYgKHIucHVibGlzaGVyX2lkID0gcGFyc2VJbnQoZS5wYXJhbXMucHVibGlzaGVySWQsIDEwKSksIGUucGFyYW1zLmV4dGVybmFsSW1wSWQgJiYgKHIuZXh0ZXJuYWxfaW1wX2lkID0gZS5wYXJhbXMuZXh0ZXJuYWxJbXBJZCksICFPYmplY3QoYS5pc0VtcHR5KShlLnBhcmFtcy5rZXl3b3JkcykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QoYS50cmFuc2Zvcm1CaWRkZXJQYXJhbUtleXdvcmRzKShlLnBhcmFtcy5rZXl3b3Jkcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIG4ubGVuZ3RoID4gMCAmJiBuLmZvckVhY2goUCksIHIua2V5d29yZHMgPSBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgaSwgcywgYyA9IE9iamVjdChhLmRlZXBBY2Nlc3MpKGUsICdvcnRiMkltcC5leHQuZGF0YS5wYmFkc2xvdCcpOwogICAgICAgICAgICAgICAgICAgIGlmIChjICYmIChyLmdwaWQgPSBjKSwgKGUubWVkaWFUeXBlID09PSBvLmMgfHwgT2JqZWN0KGEuZGVlcEFjY2VzcykoZSwgJ21lZGlhVHlwZXMuJy5jb25jYXQoby5jKSkpICYmIChyLmFkX3R5cGVzLnB1c2goby5jKSwgMCA9PT0gci5zaXplcy5sZW5ndGggJiYgKHIuc2l6ZXMgPSBNKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgIF0pKSwgZS5uYXRpdmVQYXJhbXMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gKGkgPSBlLm5hdGl2ZVBhcmFtcywgcyA9IHt9LCBPYmplY3Qua2V5cyhpKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IENbZV0gJiYgQ1tlXS5zZXJ2ZXJOYW1lIHx8IENbZV0gfHwgZSwgdCA9IENbZV0gJiYgQ1tlXS5yZXF1aXJlZFBhcmFtczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzW3JdID0gdih7fSwgdCwgaVtlXSksIChyID09PSBDLmltYWdlLnNlcnZlck5hbWUgfHwgciA9PT0gQy5pY29uLnNlcnZlck5hbWUpICYmIHNbcl0uc2l6ZXMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHNbcl0uc2l6ZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKE9iamVjdChhLmlzQXJyYXlPZk51bXMpKG4pIHx8IE9iamVjdChhLmlzQXJyYXkpKG4pICYmIG4ubGVuZ3RoID4gMCAmJiBuLmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoYS5pc0FycmF5T2ZOdW1zKShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgJiYgKHNbcl0uc2l6ZXMgPSBNKHNbcl0uc2l6ZXMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPT09IEMucHJpdmFjeUxpbmsgJiYgKHMucHJpdmFjeV9zdXBwb3J0ZWQgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgcltvLmNdID0geyBsYXlvdXRzOiBbdV0gfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSBPYmplY3QoYS5kZWVwQWNjZXNzKShlLCAnbWVkaWFUeXBlcy4nLmNvbmNhdChvLmQpKSwgZiA9IE9iamVjdChhLmRlZXBBY2Nlc3MpKGUsICdtZWRpYVR5cGVzLnZpZGVvLmNvbnRleHQnKTsKICAgICAgICAgICAgICAgICAgICByLmhiX3NvdXJjZSA9IG0gJiYgJ2FkcG9kJyA9PT0gZiA/IDcgOiAxLCAoZS5tZWRpYVR5cGUgPT09IG8uZCB8fCBtKSAmJiByLmFkX3R5cGVzLnB1c2goby5kKSwgKGUubWVkaWFUeXBlID09PSBvLmQgfHwgbSAmJiAnb3V0c3RyZWFtJyAhPT0gZikgJiYgKHIucmVxdWlyZV9hc3NldF91cmwgPSAhMCksIGUucGFyYW1zLnZpZGVvICYmIChyLnZpZGVvID0ge30sIE9iamVjdC5rZXlzKGUucGFyYW1zLnZpZGVvKS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwoKShPLCBlKTsKICAgICAgICAgICAgICAgICAgICB9KS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdjb250ZXh0JzoKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncGxheWJhY2tfbWV0aG9kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5wYXJhbXMudmlkZW9bdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gT2JqZWN0KGEuaXNBcnJheSkobikgPyBuWzBdIDogbiwgci52aWRlb1t0XSA9IHhbdF1bbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZnJhbWV3b3Jrcyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIudmlkZW9bdF0gPSBlLnBhcmFtcy52aWRlb1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pLCBlLnBhcmFtcy52aWRlby5mcmFtZXdvcmtzICYmIE9iamVjdChhLmlzQXJyYXkpKGUucGFyYW1zLnZpZGVvLmZyYW1ld29ya3MpICYmIChyLnZpZGVvX2ZyYW1ld29ya3MgPSBlLnBhcmFtcy52aWRlby5mcmFtZXdvcmtzKSksIG0gJiYgKHIudmlkZW8gPSByLnZpZGVvIHx8IHt9LCBPYmplY3Qua2V5cyhtKS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwoKShqLCBlKTsKICAgICAgICAgICAgICAgICAgICB9KS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdtaW5kdXJhdGlvbic6CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ21heGR1cmF0aW9uJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdudW1iZXInICE9IHR5cGVvZiByLnZpZGVvW2VdICYmIChyLnZpZGVvW2VdID0gbVtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc2tpcCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYm9vbGVhbicgIT0gdHlwZW9mIHIudmlkZW8uc2tpcHBhYmxlICYmIChyLnZpZGVvLnNraXBwYWJsZSA9IDEgPT09IG1bZV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3NraXBhZnRlcic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbnVtYmVyJyAhPSB0eXBlb2Ygci52aWRlby5za2lwb2Zmc2V0ICYmIChyLnZpZGVvLnNraXBwb2Zmc2V0ID0gbVtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncGxheWJhY2ttZXRob2QnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdudW1iZXInICE9IHR5cGVvZiByLnZpZGVvLnBsYXliYWNrX21ldGhvZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbVtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodCA9IE9iamVjdChhLmlzQXJyYXkpKHQpID8gdFswXSA6IHQpID49IDEgJiYgdCA8PSA0ICYmIChyLnZpZGVvLnBsYXliYWNrX21ldGhvZCA9IHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2FwaSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIudmlkZW9fZnJhbWV3b3JrcyAmJiBPYmplY3QoYS5pc0FycmF5KShtW2VdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbVtlXS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSA0ID09PSBlID8gNSA6IDUgPT09IGUgPyA0IDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPj0gMSAmJiByIDw9IDUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci52aWRlb19mcmFtZXdvcmtzID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pKSwgZS5yZW5kZXJlciAmJiAoci52aWRlbyA9IHYoe30sIHIudmlkZW8sIHsgY3VzdG9tX3JlbmRlcmVyX3ByZXNlbnQ6ICEwIH0pKSwgZS5wYXJhbXMuZnJhbWV3b3JrcyAmJiBPYmplY3QoYS5pc0FycmF5KShlLnBhcmFtcy5mcmFtZXdvcmtzKSAmJiAoci5iYW5uZXJfZnJhbWV3b3JrcyA9IGUucGFyYW1zLmZyYW1ld29ya3MpOwogICAgICAgICAgICAgICAgICAgIHZhciBiID0gcCgpKGQuYS5nZXRBZFVuaXRzKCksIGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRyYW5zYWN0aW9uSWQgPT09IHIudHJhbnNhY3Rpb25JZDsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiAmJiBiLm1lZGlhVHlwZXMgJiYgYi5tZWRpYVR5cGVzLmJhbm5lciAmJiByLmFkX3R5cGVzLnB1c2goby5iKSwgMCA9PT0gci5hZF90eXBlcy5sZW5ndGggJiYgZGVsZXRlIHIuYWRfdHlwZXMsIHI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBNKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFtdLCB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChhLmlzQXJyYXkpKGUpICYmIDIgPT09IGUubGVuZ3RoICYmICFPYmplY3QoYS5pc0FycmF5KShlWzBdKSkKICAgICAgICAgICAgICAgICAgICAgICAgdC53aWR0aCA9IHBhcnNlSW50KGVbMF0sIDEwKSwgdC5oZWlnaHQgPSBwYXJzZUludChlWzFdLCAxMCksIHIucHVzaCh0KTsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgnb2JqZWN0JyA9PT0gYihlKSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCBlLmxlbmd0aDsgbisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGVbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAodCA9IHt9KS53aWR0aCA9IHBhcnNlSW50KGlbMF0sIDEwKSwgdC5oZWlnaHQgPSBwYXJzZUludChpWzFdLCAxMCksIHIucHVzaCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24geihlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZS5wYXJhbXMudXNlcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEQoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXBhcnNlSW50KGUucGFyYW1zLm1lbWJlciwgMTApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQihlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUucGFyYW1zKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlLnBhcmFtcy5hcHA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBGKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wYXJhbXMgJiYgZS5wYXJhbXMuYXBwID8gISFlLnBhcmFtcy5hcHAuaWQgOiAhIWUucGFyYW1zLmFwcDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFYoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWUuZGVidWc7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBKKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5tZWRpYVR5cGVzICYmIGUubWVkaWFUeXBlcy52aWRlbyAmJiBlLm1lZGlhVHlwZXMudmlkZW8uY29udGV4dCA9PT0gby5hOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gVyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAhMSwgdCA9IGUucGFyYW1zLCBuID0gZS5wYXJhbXMudmlkZW87CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZnJhbWV3b3JrcyAmJiBPYmplY3QoYS5pc0FycmF5KSh0LmZyYW1ld29ya3MpICYmIChyID0gbCgpKGUucGFyYW1zLmZyYW1ld29ya3MsIDYpKSwgIXIgJiYgbiAmJiBuLmZyYW1ld29ya3MgJiYgT2JqZWN0KGEuaXNBcnJheSkobi5mcmFtZXdvcmtzKSAmJiAociA9IGwoKShlLnBhcmFtcy52aWRlby5mcmFtZXdvcmtzLCA2KSksIHI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBIKGUsIHIsIHQpIHsKICAgICAgICAgICAgICAgICAgICBPYmplY3QoYS5pc0VtcHR5KShlLnZpZGVvKSAmJiAoZS52aWRlbyA9IHt9KSwgZS52aWRlb1tyXSA9IHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciwgdDsKICAgICAgICAgICAgICAgICAgICByID0gZS5hZFVuaXRDb2RlLCAodCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKHIpLnF1ZXJ5U2VsZWN0b3JBbGwoJ2RpdltpZF49XCdnb29nbGVfYWRzXCddJykpWzBdICYmIHRbMF0uc3R5bGUuc2V0UHJvcGVydHkoJ2Rpc3BsYXknLCAnbm9uZScpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChlKS5xdWVyeVNlbGVjdG9yQWxsKCdzY3JpcHRbaWRePVwnc2FzX3NjcmlwdFwnXScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgclswXS5uZXh0U2libGluZyAmJiAnaWZyYW1lJyA9PT0gclswXS5uZXh0U2libGluZy5sb2NhbE5hbWUgJiYgclswXS5uZXh0U2libGluZy5zdHlsZS5zZXRQcm9wZXJ0eSgnZGlzcGxheScsICdub25lJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oZS5hZFVuaXRDb2RlKSwgZS5yZW5kZXJlci5wdXNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LkFOT3V0c3RyZWFtVmlkZW8ucmVuZGVyQWQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFnSWQ6IGUuYWRSZXNwb25zZS50YWdfaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplczogW2UuZ2V0U2l6ZSgpLnNwbGl0KCd4JyldLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0SWQ6IGUuYWRVbml0Q29kZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV1aWQ6IGUuYWRSZXNwb25zZS51dWlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRSZXNwb25zZTogZS5hZFJlc3BvbnNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVuZGVyZXJPcHRpb25zOiBlLnJlbmRlcmVyLmdldENvbmZpZygpCiAgICAgICAgICAgICAgICAgICAgICAgIH0sICQuYmluZChudWxsLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiAkKGUsIHIsIHQpIHsKICAgICAgICAgICAgICAgICAgICBlLnJlbmRlcmVyLmhhbmRsZVZpZGVvRXZlbnQoewogICAgICAgICAgICAgICAgICAgICAgICBpZDogciwKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnROYW1lOiB0CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBLKGUsIHIsIHQsIGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gciAmJiAoYSA/IGUucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgIHJ0aV9wYXJ0bmVyOiBhCiAgICAgICAgICAgICAgICAgICAgfSkgOiBlLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiByCiAgICAgICAgICAgICAgICAgICAgfSkpLCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0KHMucmVnaXN0ZXJCaWRkZXIpKEUpLCB3aW5kb3cucGJqcy5pbnN0YWxsZWRNb2R1bGVzLnB1c2goJ2FwcG5leHVzQmlkQWRhcHRlcicpOwogICAgICAgICAgICB9CiAgICAgICAgfSwgWzI5MF0pOwogICAgICAgIHBianNDaHVuayhbMzI0XSwgewogICAgICAgICAgICAzMzY6IGZ1bmN0aW9uIChlLCByLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB0KDMzNyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDMzNzogZnVuY3Rpb24gKGUsIHIsIHQpIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShyLCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCB0LmQociwgJ2JyaXRlcG9vbElkU3VibW9kdWxlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB1OwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IHQoMCksIG4gPSB0KDQpLCBpID0gdCg5KTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoYSA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcCgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHAgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSAxOyByIDwgYXJndW1lbnRzLmxlbmd0aDsgcisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50c1tyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwodCwgbykgJiYgKGVbb10gPSB0W29dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHUgPSB7CiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2JyaXRlcG9vbElkJywKICAgICAgICAgICAgICAgICAgICBkZWNvZGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdzdHJpbmcnID09IHR5cGVvZiBlLnByaW1hcnlCUElEID8geyBicml0ZXBvb2xpZDogZS5wcmltYXJ5QlBJRCB9IDogbnVsbDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGdldElkOiBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUgJiYgZS5wYXJhbXMgfHwge30sIGkgPSB1LmNyZWF0ZVBhcmFtcyh0LCByKSwgYSA9IGkucGFyYW1zLCBwID0gaS5oZWFkZXJzLCBsID0gaS51cmwsIGMgPSBpLmdldHRlciwgcyA9IGkuZXJyb3JzLCBmID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgPT0gdHlwZW9mIGMgJiYgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgKGYgPSBjKGEpKSA/IHsgaWQ6IHUubm9ybWFsaXplVmFsdWUoZikgfSA6IChPYmplY3Qoby5pc0VtcHR5KShhKSAmJiBPYmplY3Qoby50cmlnZ2VyUGl4ZWwpKCdodHRwczovL3B4LmJyaXRlcG9vbC5jb20vbmV3P3BhcnRuZXJfaWQ9dCcpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocy5sZW5ndGggPiAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KG8ubG9nRXJyb3IpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdm9pZCBlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmKGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh1Lm5vcm1hbGl6ZVZhbHVlKHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJyAhPT0gciAmJiBPYmplY3Qoby5sb2dFcnJvcikociksIGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG4uYSkobCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHUubm9ybWFsaXplVmFsdWUocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh0ID8geyBwcmltYXJ5QlBJRDogdC5wcmltYXJ5QlBJRCB9IDogbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycgIT09IHIgJiYgT2JqZWN0KG8ubG9nRXJyb3IpKHIpLCBlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEpTT04uc3RyaW5naWZ5KGEpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21IZWFkZXJzOiBwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFR5cGU6ICdhcHBsaWNhdGlvbi9qc29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2l0aENyZWRlbnRpYWxzOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBjcmVhdGVQYXJhbXM6IGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gciAmJiAnYm9vbGVhbicgPT0gdHlwZW9mIHIuZ2RwckFwcGxpZXMgJiYgci5nZHByQXBwbGllcyA/IHIuY29uc2VudFN0cmluZyA6IHZvaWQgMCwgbyA9IFtdLCBuID0ge30sIGkgPSBwKHt9LCBlLCAndW5kZWZpbmVkJyAhPSB0eXBlb2YgYnJpdGVwb29sX3B1YnBhcmFtcyA/IGJyaXRlcG9vbF9wdWJwYXJhbXMgOiB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpLmdldHRlcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT0gdHlwZW9mIGkuZ2V0dGVyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLnB1c2goJ3VzZXJJZFRhcmdldGluZyAtIGJyaXRlcG9vbElkIHN1Ym1vZHVsZSByZXF1aXJlcyBnZXR0ZXIgdG8gYmUgYSBmdW5jdGlvbicpLCB7IGVycm9yczogbyB9OwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuYXBpX2tleSAmJiAoblsneC1hcGkta2V5J10gPSBpLmFwaV9rZXkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGkudXJsIHx8ICdodHRwczovL2FwaS5icml0ZXBvb2wuY29tL3YxL2JyaXRlcG9vbC9pZCcuY29uY2F0KHQgPyAnP2dkcHJTdHJpbmc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh0KSA6ICcnKSwgdSA9IGkuZ2V0dGVyOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGVsZXRlIGkuYXBpX2tleSwgZGVsZXRlIGkudXJsLCBkZWxldGUgaS5nZXR0ZXIsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtczogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXR0ZXI6IHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcnM6IG8KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG5vcm1hbGl6ZVZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gYShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IEpTT04ucGFyc2UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG8ubG9nRXJyb3IpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgT2JqZWN0KGkuZSkoJ3VzZXJJZCcsIHUpLCB3aW5kb3cucGJqcy5pbnN0YWxsZWRNb2R1bGVzLnB1c2goJ2JyaXRlcG9vbElkU3lzdGVtJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCBbMzM2XSk7CiAgICAgICAgcGJqc0NodW5rKFszMDldLCB7CiAgICAgICAgICAgIDM3NTogZnVuY3Rpb24gKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHQoMzc2KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMzc2OiBmdW5jdGlvbiAoZSwgbiwgdCkgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KG4sICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHQuZChuLCAnY29ubmVjdElkU3VibW9kdWxlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IHQoNCksIHIgPSB0KDkpLCBjID0gdCgwKSwgaSA9IHQoMTIpLCBkID0gdC5uKGkpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICh1ID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3IgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiBlLmNvbnN0cnVjdG9yID09PSBTeW1ib2wgJiYgZSAhPT0gU3ltYm9sLnByb3RvdHlwZSA/ICdzeW1ib2wnIDogdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgfSkoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgcCA9ICdjb25uZWN0SWQnLCBzID0gJ19fUElYRUxfSURfXycsIGEgPSAnaHR0cHM6Ly91cHMuYW5hbHl0aWNzLnlhaG9vLmNvbS91cHMvJy5jb25jYXQocywgJy9mZWQnKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIShlICYmIGUuZ2RwciAmJiBlLmdkcHIuZ2RwckFwcGxpZXMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGYgPSB7CiAgICAgICAgICAgICAgICAgICAgbmFtZTogcCwKICAgICAgICAgICAgICAgICAgICBndmxpZDogMjUsCiAgICAgICAgICAgICAgICAgICAgZGVjb2RlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT09IHUoZSkgJiYgZS5jb25uZWN0aWQgPyB7IGNvbm5lY3RJZDogZS5jb25uZWN0aWQgfSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGdldElkOiBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucGFyYW1zIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiAnc3RyaW5nJyA9PSB0eXBlb2YgdC5oZSAmJiAodm9pZCAwICE9PSB0LnBpeGVsSWQgfHwgdm9pZCAwICE9PSB0LmVuZHBvaW50KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzFwJzogZCgpKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHRbJzFwJ10pID8gJzEnIDogJzAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlOiB0LmhlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdkcHI6IGwobikgPyAnMScgOiAnMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2Rwcl9jb25zZW50OiBsKG4pID8gbi5nZHByLmNvbnNlbnRTdHJpbmcgOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c19wcml2YWN5OiBuICYmIG4udXNwQ29uc2VudCA/IG4udXNwQ29uc2VudCA6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5waXhlbElkICYmIChvLnBpeGVsSWQgPSB0LnBpeGVsSWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gSlNPTi5wYXJzZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoYy5sb2dFcnJvcikoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGMubG9nRXJyb3IpKCcnLmNvbmNhdChwLCAnOiBJRCBmZXRjaCBlbmNvdW50ZXJlZCBhbiBlcnJvcicpLCBuKSwgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIgPSBhLnJlcGxhY2UocywgdC5waXhlbElkKSwgaSA9ICcnLmNvbmNhdCh0LmVuZHBvaW50IHx8IHIsICc/JykuY29uY2F0KE9iamVjdChjLmZvcm1hdFFTKShvKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuZ2V0QWpheEZuKCkoaSwgbiwgbnVsbCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnR0VUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpdGhDcmVkZW50aWFsczogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoYy5sb2dFcnJvcikoJ1RoZSBjb25uZWN0SWQgc3VibW9kdWxlIHJlcXVpcmVzIHRoZSBcJ2hlXCcgYW5kIFwncGl4ZWxJZFwnIHBhcmFtZXRlcnMgdG8gYmUgZGVmaW5lZC4nKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGdldEFqYXhGbjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5hOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBPYmplY3Qoci5lKSgndXNlcklkJywgZiksIHdpbmRvdy5wYmpzLmluc3RhbGxlZE1vZHVsZXMucHVzaCgnY29ubmVjdElkU3lzdGVtJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCBbMzc1XSk7CiAgICAgICAgcGJqc0NodW5rKFszMDhdLCB7CiAgICAgICAgICAgIDM3OTogZnVuY3Rpb24gKG4sIHQsIGUpIHsKICAgICAgICAgICAgICAgIG4uZXhwb3J0cyA9IGUoMzgwKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgMzgwOiBmdW5jdGlvbiAobiwgdCwgZSkgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIGUuZCh0LCAnYWxsb3dBdWN0aW9uJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBDOwogICAgICAgICAgICAgICAgfSksIGUuZCh0LCAndXNlckNNUCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgIH0pLCBlLmQodCwgJ2NvbnNlbnRUaW1lb3V0JywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBwOwogICAgICAgICAgICAgICAgfSksIGUuZCh0LCAnZ2RwclNjb3BlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBnOwogICAgICAgICAgICAgICAgfSksIGUuZCh0LCAnc3RhdGljQ29uc2VudERhdGEnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9KSwgdC5yZXF1ZXN0Qmlkc0hvb2sgPSBqLCB0LnJlc2V0Q29uc2VudERhdGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgbSA9IHZvaWQgMCwgZiA9IHZvaWQgMCwgdiA9IDAsIGkuZ2RwckRhdGFIYW5kbGVyLnNldENvbnNlbnREYXRhKG51bGwpOwogICAgICAgICAgICAgICAgfSwgdC5zZXRDb25zZW50Q29uZmlnID0gQTsKICAgICAgICAgICAgICAgIHZhciBvID0gZSgwKSwgYSA9IGUoMyksIGkgPSBlKDgpLCBjID0gZSgxMiksIHIgPSBlLm4oYyksIHMgPSBlKDgxKSwgZCA9IGUubihzKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwobikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAobCA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBuOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgbi5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIG4gIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBuOwogICAgICAgICAgICAgICAgICAgIH0pKG4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdShuLCB0LCBlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgaW4gbiA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShuLCB0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSkgOiBuW3RdID0gZSwgbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBmLCBwLCBnLCBiLCBtLCBDID0gewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdHJ1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgZGVmaW5lZEluQ29uZmlnOiAhMQogICAgICAgICAgICAgICAgICAgIH0sIHYgPSAwLCB3ID0gITEsIHkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlhYjogZnVuY3Rpb24gKG4sIHQsIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoYSwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChvLmxvZ0luZm8pKCdSZWNlaXZlZCBhIHJlc3BvbnNlIGZyb20gQ01QJywgYSksIGkgPyAhMSAhPT0gYS5nZHByQXBwbGllcyAmJiAndGNsb2FkZWQnICE9PSBhLmV2ZW50U3RhdHVzICYmICd1c2VyYWN0aW9uY29tcGxldGUnICE9PSBhLmV2ZW50U3RhdHVzIHx8IG4oYSwgZSkgOiB0KCdDTVAgdW5hYmxlIHRvIHJlZ2lzdGVyIGNhbGxiYWNrIGZ1bmN0aW9uLiAgUGxlYXNlIGNoZWNrIENNUCBzZXR1cC4nLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5nZXRDb25zZW50RGF0YSAmJiB0LmdldFZlbmRvckNvbnNlbnRzICYmIChPYmplY3Qoby5sb2dJbmZvKSgnUmVjZWl2ZWQgYWxsIHJlcXVlc3RlZCByZXNwb25zZXMgZnJvbSBDTVAnLCB0KSwgbih0LCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnREYXRhQ2FsbGJhY2s6IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5nZXRDb25zZW50RGF0YSA9IG4sIGEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JDb25zZW50c0NhbGxiYWNrOiBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZ2V0VmVuZG9yQ29uc2VudHMgPSBuLCBhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCBjID0ge30sIHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4sIHQsIGUgPSB3aW5kb3c7ICFuOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZS5fX3RjZmFwaSB8fCAnZnVuY3Rpb24nID09IHR5cGVvZiBlLl9fY21wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT0gdHlwZW9mIGUuX190Y2ZhcGkgPyAodiA9IDIsIHQgPSBlLl9fdGNmYXBpKSA6ICh2ID0gMSwgdCA9IGUuX19jbXApLCBuID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5mcmFtZXMuX190Y2ZhcGlMb2NhdG9yKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYgPSAyLCBuID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5mcmFtZXMuX19jbXBMb2NhdG9yKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYgPSAxLCBuID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IHdpbmRvdy50b3ApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5wYXJlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcEZyYW1lOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wRnVuY3Rpb246IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIHMgPSByLmNtcEZyYW1lLCBsID0gci5jbXBGdW5jdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCgnQ01QIG5vdCBmb3VuZC4nLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChvLmlzRm4pKGwpID8gKE9iamVjdChvLmxvZ0luZm8pKCdEZXRlY3RlZCBDTVAgQVBJIGlzIGRpcmVjdGx5IGFjY2Vzc2libGUsIGNhbGxpbmcgaXQgbm93Li4uJyksIDEgPT09IHYgPyAobCgnZ2V0Q29uc2VudERhdGEnLCBudWxsLCBpLmNvbnNlbnREYXRhQ2FsbGJhY2spLCBsKCdnZXRWZW5kb3JDb25zZW50cycsIG51bGwsIGkudmVuZG9yQ29uc2VudHNDYWxsYmFjaykpIDogMiA9PT0gdiAmJiBsKCdhZGRFdmVudExpc3RlbmVyJywgdiwgYSkpIDogMSA9PT0gdiAmJiB3aW5kb3cuJHNmICYmIHdpbmRvdy4kc2YuZXh0ICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIHdpbmRvdy4kc2YuZXh0LmNtcCA/IChPYmplY3Qoby5sb2dJbmZvKSgnRGV0ZWN0ZWQgUHJlYmlkLmpzIGlzIGVuY2FzZWQgaW4gYSBTYWZlRnJhbWUgYW5kIENNUCBpcyByZWdpc3RlcmVkLCBjYWxsaW5nIGl0IG5vdy4uLicpLCBmKCdnZXRDb25zZW50RGF0YScsIGkuY29uc2VudERhdGFDYWxsYmFjayksIGYoJ2dldFZlbmRvckNvbnNlbnRzJywgaS52ZW5kb3JDb25zZW50c0NhbGxiYWNrKSkgOiAoT2JqZWN0KG8ubG9nSW5mbykoJ0RldGVjdGVkIENNUCBpcyBvdXRzaWRlIHRoZSBjdXJyZW50IGlmcmFtZSB3aGVyZSBQcmViaWQuanMgaXMgbG9jYXRlZCwgY2FsbGluZyBpdCBub3cuLi4nKSwgMSA9PT0gdiA/IChwKCdnZXRDb25zZW50RGF0YScsIHMsIGkuY29uc2VudERhdGFDYWxsYmFjayksIHAoJ2dldFZlbmRvckNvbnNlbnRzJywgcywgaS52ZW5kb3JDb25zZW50c0NhbGxiYWNrKSkgOiAyID09PSB2ICYmIHAoJ2FkZEV2ZW50TGlzdGVuZXInLCBzLCBhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKG4sIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUuYWRVbml0cywgaSA9IDEsIGMgPSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGEpICYmIGEubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdChvLmdldEFkVW5pdFNpemVzKShhWzBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IHJbMF1bMF0sIGMgPSByWzBdWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuJHNmLmV4dC5yZWdpc3RlcihpLCBjLCBmdW5jdGlvbiAoZSwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2NtcFJldHVybicgPT09IGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gJ2dldENvbnNlbnREYXRhJyA9PT0gbiA/IG8udmVuZG9yQ29uc2VudERhdGEgOiBvLnZlbmRvckNvbnNlbnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB3aW5kb3cuJHNmLmV4dC5jbXAobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKG4sIHQsIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IDIgPT09IHYgPyAnX190Y2ZhcGknIDogJ19fY21wJywgYSA9ICcnLmNvbmNhdChvLCAnQ2FsbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICcnLmNvbmNhdChvLCAnUmV0dXJuJyksIGUgPSAnc3RyaW5nJyA9PSB0eXBlb2Ygbi5kYXRhICYmIGQoKShuLmRhdGEsIHQpID8gSlNPTi5wYXJzZShuLmRhdGEpIDogbi5kYXRhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVt0XSAmJiBlW3RdLmNhbGxJZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBjW2EuY2FsbElkXSAmJiBjW2EuY2FsbElkXShhLnJldHVyblZhbHVlLCBhLnN1Y2Nlc3MpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIgPT09IHYgPyAod2luZG93W29dID0gZnVuY3Rpb24gKG4sIGUsIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBNYXRoLnJhbmRvbSgpICsgJycsIHMgPSB1KHt9LCBhLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tbWFuZDogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtZXRlcjogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsSWQ6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjW3JdID0gbywgdC5wb3N0TWVzc2FnZShzLCAnKicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgaSwgITEpLCB3aW5kb3dbb10obiwgdiwgZSkpIDogKHdpbmRvd1tvXSA9IGZ1bmN0aW9uIChuLCBlLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gTWF0aC5yYW5kb20oKSArICcnLCByID0gdSh7fSwgYSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1hbmQ6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxJZDogaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNbaV0gPSBvLCB0LnBvc3RNZXNzYWdlKHIsICcqJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBpLCAhMSksIHdpbmRvd1tvXShuLCB2b2lkIDAsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGljOiBmdW5jdGlvbiAobiwgdCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbihiLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBqKG4sIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogdGhpcywKICAgICAgICAgICAgICAgICAgICAgICAgYXJnczogW3RdLAogICAgICAgICAgICAgICAgICAgICAgICBuZXh0Rm46IG4sCiAgICAgICAgICAgICAgICAgICAgICAgIGFkVW5pdHM6IHQuYWRVbml0cyB8fCBwYmpzLmFkVW5pdHMsCiAgICAgICAgICAgICAgICAgICAgICAgIGJpZHNCYWNrSGFuZGxlcjogdC5iaWRzQmFja0hhbmRsZXIsCiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmVFeGl0ZWQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICB0aW1lcjogbnVsbAogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0gPyAoT2JqZWN0KG8ubG9nSW5mbykoJ1VzZXIgY29uc2VudCBpbmZvcm1hdGlvbiBhbHJlYWR5IGtub3duLiAgUHVsbGluZyBpbnRlcm5hbGx5IHN0b3JlZCBpbmZvcm1hdGlvbi4uLicpLCBoKG51bGwsIGUpKSA6IHIoKShPYmplY3Qua2V5cyh5KSwgZikgPyAoeVtmXS5jYWxsKHRoaXMsIEQsIE0sIGUpLCB2b2lkIChlLmhhdmVFeGl0ZWQgfHwgKDAgPT09IHAgPyBEKHZvaWQgMCwgZSkgOiBlLnRpbWVyID0gc2V0VGltZW91dChPLmJpbmQobnVsbCwgZSksIHApKSkpIDogKE9iamVjdChvLmxvZ1dhcm4pKCdDTVAgZnJhbWV3b3JrICgnLmNvbmNhdChmLCAnKSBpcyBub3QgYSBzdXBwb3J0ZWQgZnJhbWV3b3JrLiAgQWJvcnRpbmcgY29uc2VudE1hbmFnZW1lbnQgbW9kdWxlIGFuZCByZXN1bWluZyBhdWN0aW9uLicpKSwgZS5uZXh0Rm4uYXBwbHkoZS5jb250ZXh0LCBlLmFyZ3MpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEQobiwgdCkgewogICAgICAgICAgICAgICAgICAgICdzdGF0aWMnID09PSBmICYmIDIgPT09ICh2ID0gbi5nZXRDb25zZW50RGF0YSA/IDEgOiBuLmdldFRDRGF0YSA/IDIgOiAwKSAmJiAobiA9IG4uZ2V0VENEYXRhKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IDEgPT09IHYgPyBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG4gJiYgbi5nZXRDb25zZW50RGF0YSAmJiBuLmdldENvbnNlbnREYXRhLmdkcHJBcHBsaWVzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISgnYm9vbGVhbicgPT0gdHlwZW9mIHQgJiYgKCEwICE9PSB0IHx8IE9iamVjdChvLmlzU3RyKShuLmdldENvbnNlbnREYXRhLmNvbnNlbnREYXRhKSAmJiBPYmplY3Qoby5pc1BsYWluT2JqZWN0KShuLmdldFZlbmRvckNvbnNlbnRzKSAmJiBPYmplY3Qua2V5cyhuLmdldFZlbmRvckNvbnNlbnRzKS5sZW5ndGggPiAxKSk7CiAgICAgICAgICAgICAgICAgICAgfSA6IDIgPT09IHYgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbiAmJiAnYm9vbGVhbicgPT0gdHlwZW9mIG4uZ2RwckFwcGxpZXMgPyBuLmdkcHJBcHBsaWVzIDogZywgZSA9IG4gJiYgbi50Y1N0cmluZzsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoJ2Jvb2xlYW4nID09IHR5cGVvZiB0ICYmICghMCAhPT0gdCB8fCBPYmplY3Qoby5pc1N0cikoZSkpKTsKICAgICAgICAgICAgICAgICAgICB9IDogbnVsbDsKICAgICAgICAgICAgICAgICAgICBDLmRlZmluZWRJbkNvbmZpZyAmJiAyID09PSB2ID8gT2JqZWN0KG8ubG9nV2FybikoJ1wnYWxsb3dBdWN0aW9uV2l0aG91dENvbnNlbnRcJyBpZ25vcmVkIGZvciBUQ0YgMicpIDogQy5kZWZpbmVkSW5Db25maWcgfHwgMSAhPT0gdiB8fCBPYmplY3Qoby5sb2dJbmZvKSgnXCdhbGxvd0F1Y3Rpb25XaXRob3V0Q29uc2VudFwnIHVzaW5nIHN5c3RlbSBkZWZhdWx0OiAoJy5jb25jYXQodHJ1ZSwgJykuJykpLCBPYmplY3Qoby5pc0ZuKShlKSA/IGUobikgPyBNKCdDTVAgcmV0dXJuZWQgdW5leHBlY3RlZCB2YWx1ZSBkdXJpbmcgbG9va3VwIHByb2Nlc3MuJywgdCwgbikgOiAoY2xlYXJUaW1lb3V0KHQudGltZXIpLCBrKG4pLCBoKG51bGwsIHQpKSA6IE0oJ1VuYWJsZSB0byBkZXJpdmUgQ01QIHZlcnNpb24gdG8gcHJvY2VzcyBkYXRhLiAgQ29uc2VudCBvYmplY3QgZG9lcyBub3QgY29uZm9ybSB0byBUQ0YgdjEgb3IgdjIgc3BlY3MuJywgdCwgbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBPKG4pIHsKICAgICAgICAgICAgICAgICAgICAyID09PSB2ID8gKE9iamVjdChvLmxvZ1dhcm4pKCdObyByZXNwb25zZSBmcm9tIENNUCwgY29udGludWluZyBhdWN0aW9uLi4uJyksIGsodm9pZCAwKSwgaChudWxsLCBuKSkgOiBNKCdDTVAgd29ya2Zsb3cgZXhjZWVkZWQgdGltZW91dCB0aHJlc2hvbGQuJywgbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBNKG4sIHQsIGUpIHsKICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQodC50aW1lciksIEMudmFsdWUgJiYgMSA9PT0gdiAmJiBrKHZvaWQgMCksIGgobiwgdCwgZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBrKG4pIHsKICAgICAgICAgICAgICAgICAgICAxID09PSB2ID8gbSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudFN0cmluZzogbiA/IG4uZ2V0Q29uc2VudERhdGEuY29uc2VudERhdGEgOiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckRhdGE6IG4gPyBuLmdldFZlbmRvckNvbnNlbnRzIDogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICBnZHByQXBwbGllczogbiA/IG4uZ2V0Q29uc2VudERhdGEuZ2RwckFwcGxpZXMgOiBnCiAgICAgICAgICAgICAgICAgICAgfSA6IChtID0gewogICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50U3RyaW5nOiBuID8gbi50Y1N0cmluZyA6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yRGF0YTogbiB8fCB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgIGdkcHJBcHBsaWVzOiBuICYmICdib29sZWFuJyA9PSB0eXBlb2Ygbi5nZHByQXBwbGllcyA/IG4uZ2RwckFwcGxpZXMgOiBnCiAgICAgICAgICAgICAgICAgICAgfSwgbiAmJiBuLmFkZHRsQ29uc2VudCAmJiBPYmplY3Qoby5pc1N0cikobi5hZGR0bENvbnNlbnQpICYmIChtLmFkZHRsQ29uc2VudCA9IG4uYWRkdGxDb25zZW50KSksIG0uYXBpVmVyc2lvbiA9IHYsIGkuZ2RwckRhdGFIYW5kbGVyLnNldENvbnNlbnREYXRhKG0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaChuLCB0LCBlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCExID09PSB0LmhhdmVFeGl0ZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXZlRXhpdGVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdC5jb250ZXh0LCBpID0gdC5hcmdzLCBjID0gdC5uZXh0Rm47CiAgICAgICAgICAgICAgICAgICAgICAgIG4gPyBDLnZhbHVlICYmIDEgPT09IHYgPyAoT2JqZWN0KG8ubG9nV2FybikobiArICcgXCdhbGxvd0F1Y3Rpb25XaXRob3V0Q29uc2VudFwnIGFjdGl2YXRlZC4nLCBlKSwgYy5hcHBseShhLCBpKSkgOiAoT2JqZWN0KG8ubG9nRXJyb3IpKG4gKyAnIENhbmNlbGluZyBhdWN0aW9uIGFzIHBlciBjb25zZW50TWFuYWdlbWVudCBjb25maWcuJywgZSksICdmdW5jdGlvbicgPT0gdHlwZW9mIHQuYmlkc0JhY2tIYW5kbGVyID8gdC5iaWRzQmFja0hhbmRsZXIoKSA6IE9iamVjdChvLmxvZ0Vycm9yKSgnRXJyb3IgZXhlY3V0aW5nIGJpZHNCYWNrSGFuZGxlcicpKSA6IGMuYXBwbHkoYSwgaSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQShuKSB7CiAgICAgICAgICAgICAgICAgICAgKG4gPSBuICYmIChuLmdkcHIgfHwgbi51c3AgPyBuLmdkcHIgOiBuKSkgJiYgJ29iamVjdCcgPT09IGwobikgPyAoT2JqZWN0KG8uaXNTdHIpKG4uY21wQXBpKSA/IGYgPSBuLmNtcEFwaSA6IChmID0gJ2lhYicsIE9iamVjdChvLmxvZ0luZm8pKCdjb25zZW50TWFuYWdlbWVudCBjb25maWcgZGlkIG5vdCBzcGVjaWZ5IGNtcC4gIFVzaW5nIHN5c3RlbSBkZWZhdWx0IHNldHRpbmcgKCcuY29uY2F0KCdpYWInLCAnKS4nKSkpLCBPYmplY3Qoby5pc051bWJlcikobi50aW1lb3V0KSA/IHAgPSBuLnRpbWVvdXQgOiAocCA9IDEwMDAwLCBPYmplY3Qoby5sb2dJbmZvKSgnY29uc2VudE1hbmFnZW1lbnQgY29uZmlnIGRpZCBub3Qgc3BlY2lmeSB0aW1lb3V0LiAgVXNpbmcgc3lzdGVtIGRlZmF1bHQgc2V0dGluZyAoJy5jb25jYXQoMTAwMDAsICcpLicpKSksICdib29sZWFuJyA9PSB0eXBlb2Ygbi5hbGxvd0F1Y3Rpb25XaXRob3V0Q29uc2VudCAmJiAoQy52YWx1ZSA9IG4uYWxsb3dBdWN0aW9uV2l0aG91dENvbnNlbnQsIEMuZGVmaW5lZEluQ29uZmlnID0gITApLCBnID0gITAgPT09IG4uZGVmYXVsdEdkcHJTY29wZSwgT2JqZWN0KG8ubG9nSW5mbykoJ2NvbnNlbnRNYW5hZ2VtZW50IG1vZHVsZSBoYXMgYmVlbiBhY3RpdmF0ZWQuLi4nKSwgJ3N0YXRpYycgPT09IGYgJiYgKE9iamVjdChvLmlzUGxhaW5PYmplY3QpKG4uY29uc2VudERhdGEpID8gKGIgPSBuLmNvbnNlbnREYXRhLCBwID0gMCkgOiBPYmplY3Qoby5sb2dFcnJvcikoJ2NvbnNlbnRNYW5hZ2VtZW50IGNvbmZpZyB3aXRoIGNtcEFwaTogXCdzdGF0aWNcJyBkaWQgbm90IHNwZWNpZnkgY29uc2VudERhdGEuIE5vIGNvbnNlbnRzIHdpbGwgYmUgYXZhaWxhYmxlIHRvIGFkYXB0ZXJzLicpKSwgdyB8fCBwYmpzLnJlcXVlc3RCaWRzLmJlZm9yZShqLCA1MCksIHcgPSAhMCkgOiBPYmplY3Qoby5sb2dXYXJuKSgnY29uc2VudE1hbmFnZW1lbnQgY29uZmlnIG5vdCBkZWZpbmVkLCBleGl0aW5nIGNvbnNlbnQgbWFuYWdlcicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYS5iLmdldENvbmZpZygnY29uc2VudE1hbmFnZW1lbnQnLCBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBBKG4uY29uc2VudE1hbmFnZW1lbnQpOwogICAgICAgICAgICAgICAgfSksIHdpbmRvdy5wYmpzLmluc3RhbGxlZE1vZHVsZXMucHVzaCgnY29uc2VudE1hbmFnZW1lbnQnKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIFszNzldKTsKICAgICAgICBwYmpzQ2h1bmsoWzMwN10sIHsKICAgICAgICAgICAgMzg2OiBmdW5jdGlvbiAodCwgbiwgZSkgewogICAgICAgICAgICAgICAgdC5leHBvcnRzID0gZSgzODcpOwogICAgICAgICAgICB9LAogICAgICAgICAgICAzODc6IGZ1bmN0aW9uICh0LCBuLCBlKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkobiwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgZS5kKG4sICdjb25zZW50QVBJJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBzOwogICAgICAgICAgICAgICAgfSksIGUuZChuLCAnY29uc2VudFRpbWVvdXQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICB9KSwgZS5kKG4sICdzdGF0aWNDb25zZW50RGF0YScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdTsKICAgICAgICAgICAgICAgIH0pLCBuLnJlcXVlc3RCaWRzSG9vayA9IGYsIG4ucmVzZXRDb25zZW50RGF0YSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBsID0gdm9pZCAwLCBzID0gdm9pZCAwLCBpLnVzcERhdGFIYW5kbGVyLnNldENvbnNlbnREYXRhKG51bGwpOwogICAgICAgICAgICAgICAgfSwgbi5zZXRDb25zZW50Q29uZmlnID0gUDsKICAgICAgICAgICAgICAgIHZhciBhID0gZSgwKSwgbyA9IGUoMyksIGkgPSBlKDgpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gYyh0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChjID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3IgPyBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIHQ7CiAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiB0LmNvbnN0cnVjdG9yID09PSBTeW1ib2wgJiYgdCAhPT0gU3ltYm9sLnByb3RvdHlwZSA/ICdzeW1ib2wnIDogdHlwZW9mIHQ7CiAgICAgICAgICAgICAgICAgICAgfSkodCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgcywgciwgdSwgbCwgZCA9ICExLCBwID0gewogICAgICAgICAgICAgICAgICAgICAgICBpYWI6IGZ1bmN0aW9uICh0LCBuLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9ICh1ID0ge30sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudERhdGFDYWxsYmFjazogZnVuY3Rpb24gKGEsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gJiYgYS51c3BTdHJpbmcgJiYgKHUudXNQcml2YWN5ID0gYS51c3BTdHJpbmcpLCB1LnVzUHJpdmFjeSA/IHQodSwgZSkgOiBuKCdVbmFibGUgdG8gZ2V0IFVTUCBjb25zZW50IHN0cmluZy4nLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpID0ge30sIGMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQsIG4sIGUgPSB3aW5kb3c7ICF0OykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZS5fX3VzcGFwaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gZS5fX3VzcGFwaSwgdCA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuZnJhbWVzLl9fdXNwYXBpTG9jYXRvcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IHdpbmRvdy50b3ApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5wYXJlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzcGFwaUZyYW1lOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNwYXBpRnVuY3Rpb246IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIHMgPSBjLnVzcGFwaUZyYW1lLCByID0gYy51c3BhcGlGdW5jdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKCdVU1AgQ01QIG5vdCBmb3VuZC4nLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChhLmlzRm4pKHIpID8gKE9iamVjdChhLmxvZ0luZm8pKCdEZXRlY3RlZCBVU1AgQ01QIGlzIGRpcmVjdGx5IGFjY2Vzc2libGUsIGNhbGxpbmcgaXQgbm93Li4uJyksIHIoJ2dldFVTUERhdGEnLCAxLCBvLmNvbnNlbnREYXRhQ2FsbGJhY2spKSA6IChPYmplY3QoYS5sb2dJbmZvKSgnRGV0ZWN0ZWQgVVNQIENNUCBpcyBvdXRzaWRlIHRoZSBjdXJyZW50IGlmcmFtZSB3aGVyZSBQcmViaWQuanMgaXMgbG9jYXRlZCwgY2FsbGluZyBpdCBub3cuLi4nKSwgZnVuY3Rpb24gKHQsIG4sIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0ICYmIHQuZGF0YSAmJiB0LmRhdGEuX191c3BhcGlSZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgbi5jYWxsSWQgJiYgdm9pZCAwICE9PSBpW24uY2FsbElkXSAmJiAoaVtuLmNhbGxJZF0obi5yZXR1cm5WYWx1ZSwgbi5zdWNjZXNzKSwgZGVsZXRlIGlbbi5jYWxsSWRdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93Ll9fdXNwYXBpID0gZnVuY3Rpb24gKHQsIGUsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBNYXRoLnJhbmRvbSgpICsgJycsIGMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX191c3BhcGlDYWxsOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1hbmQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxJZDogbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlbb10gPSBhLCBuLnBvc3RNZXNzYWdlKGMsICcqJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBhLCAhMSksIHdpbmRvdy5fX3VzcGFwaSh0LCAxLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oJ2dldFVTUERhdGEnLCBzLCBvLmNvbnNlbnREYXRhQ2FsbGJhY2spKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGljOiBmdW5jdGlvbiAodCwgbiwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCh1LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogdGhpcywKICAgICAgICAgICAgICAgICAgICAgICAgYXJnczogW25dLAogICAgICAgICAgICAgICAgICAgICAgICBuZXh0Rm46IHQsCiAgICAgICAgICAgICAgICAgICAgICAgIGFkVW5pdHM6IG4uYWRVbml0cyB8fCBwYmpzLmFkVW5pdHMsCiAgICAgICAgICAgICAgICAgICAgICAgIGJpZHNCYWNrSGFuZGxlcjogbi5iaWRzQmFja0hhbmRsZXIsCiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmVFeGl0ZWQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICB0aW1lcjogbnVsbAogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgaWYgKCFwW3NdKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGEubG9nV2FybikoJ1VTUCBmcmFtZXdvcmsgKCcuY29uY2F0KHMsICcpIGlzIG5vdCBhIHN1cHBvcnRlZCBmcmFtZXdvcmsuIEFib3J0aW5nIGNvbnNlbnRNYW5hZ2VtZW50IG1vZHVsZSBhbmQgcmVzdW1pbmcgYXVjdGlvbi4nKSksIGUubmV4dEZuLmFwcGx5KGUuY29udGV4dCwgZS5hcmdzKTsKICAgICAgICAgICAgICAgICAgICBwW3NdLmNhbGwodGhpcywgZywgbSwgZSksIGUuaGF2ZUV4aXRlZCB8fCAoMCA9PT0gciA/IGcodm9pZCAwLCBlKSA6IGUudGltZXIgPSBzZXRUaW1lb3V0KGIuYmluZChudWxsLCBlKSwgcikpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZyh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgIXQgfHwgIXQudXNQcml2YWN5ID8gbSgnVVNQQVBJIHJldHVybmVkIHVuZXhwZWN0ZWQgdmFsdWUgZHVyaW5nIGxvb2t1cCBwcm9jZXNzLicsIG4sIHQpIDogKGNsZWFyVGltZW91dChuLnRpbWVyKSwgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiB0LnVzUHJpdmFjeSAmJiAobCA9IHQudXNQcml2YWN5LCBpLnVzcERhdGFIYW5kbGVyLnNldENvbnNlbnREYXRhKGwpKTsKICAgICAgICAgICAgICAgICAgICB9KHQpLCB5KG51bGwsIG4pKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIodCkgewogICAgICAgICAgICAgICAgICAgIG0oJ1VTUEFQSSB3b3JrZmxvdyBleGNlZWRlZCB0aW1lb3V0IHRocmVzaG9sZC4nLCB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0odCwgbiwgZSkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dChuLnRpbWVyKSwgeSh0LCBuLCBlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHkodCwgbiwgZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghMSA9PT0gbi5oYXZlRXhpdGVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG4uaGF2ZUV4aXRlZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG4uY29udGV4dCwgaSA9IG4uYXJncywgYyA9IG4ubmV4dEZuOwogICAgICAgICAgICAgICAgICAgICAgICB0ICYmIE9iamVjdChhLmxvZ1dhcm4pKHQgKyAnIFJlc3VtaW5nIGF1Y3Rpb24gd2l0aG91dCBjb25zZW50IGRhdGEgYXMgcGVyIGNvbnNlbnRNYW5hZ2VtZW50IGNvbmZpZy4nLCBlKSwgYy5hcHBseShvLCBpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBQKHQpIHsKICAgICAgICAgICAgICAgICAgICAodCA9IHQgJiYgdC51c3ApICYmICdvYmplY3QnID09PSBjKHQpID8gKE9iamVjdChhLmlzU3RyKSh0LmNtcEFwaSkgPyBzID0gdC5jbXBBcGkgOiAocyA9ICdpYWInLCBPYmplY3QoYS5sb2dJbmZvKSgnY29uc2VudE1hbmFnZW1lbnQudXNwIGNvbmZpZyBkaWQgbm90IHNwZWNpZnkgY21wQXBpLiBVc2luZyBzeXN0ZW0gZGVmYXVsdCBzZXR0aW5nICgnLmNvbmNhdCgnaWFiJywgJykuJykpKSwgT2JqZWN0KGEuaXNOdW1iZXIpKHQudGltZW91dCkgPyByID0gdC50aW1lb3V0IDogKHIgPSA1MCwgT2JqZWN0KGEubG9nSW5mbykoJ2NvbnNlbnRNYW5hZ2VtZW50LnVzcCBjb25maWcgZGlkIG5vdCBzcGVjaWZ5IHRpbWVvdXQuIFVzaW5nIHN5c3RlbSBkZWZhdWx0IHNldHRpbmcgKCcuY29uY2F0KDUwLCAnKS4nKSkpLCBPYmplY3QoYS5sb2dJbmZvKSgnVVNQQVBJIGNvbnNlbnRNYW5hZ2VtZW50IG1vZHVsZSBoYXMgYmVlbiBhY3RpdmF0ZWQuLi4nKSwgJ3N0YXRpYycgPT09IHMgJiYgKE9iamVjdChhLmlzUGxhaW5PYmplY3QpKHQuY29uc2VudERhdGEpICYmIE9iamVjdChhLmlzUGxhaW5PYmplY3QpKHQuY29uc2VudERhdGEuZ2V0VVNQRGF0YSkgPyAodC5jb25zZW50RGF0YS5nZXRVU1BEYXRhLnVzcFN0cmluZyAmJiAodSA9IHsgdXNQcml2YWN5OiB0LmNvbnNlbnREYXRhLmdldFVTUERhdGEudXNwU3RyaW5nIH0pLCByID0gMCkgOiBPYmplY3QoYS5sb2dFcnJvcikoJ2NvbnNlbnRNYW5hZ2VtZW50IGNvbmZpZyB3aXRoIGNtcEFwaTogXCdzdGF0aWNcJyBkaWQgbm90IHNwZWNpZnkgY29uc2VudERhdGEuIE5vIGNvbnNlbnRzIHdpbGwgYmUgYXZhaWxhYmxlIHRvIGFkYXB0ZXJzLicpKSwgZCB8fCBwYmpzLnJlcXVlc3RCaWRzLmJlZm9yZShmLCA1MCksIGQgPSAhMCkgOiBPYmplY3QoYS5sb2dXYXJuKSgnY29uc2VudE1hbmFnZW1lbnQudXNwIGNvbmZpZyBub3QgZGVmaW5lZCwgZXhpdGluZyB1c3AgY29uc2VudCBtYW5hZ2VyJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBvLmIuZ2V0Q29uZmlnKCdjb25zZW50TWFuYWdlbWVudCcsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFAodC5jb25zZW50TWFuYWdlbWVudCk7CiAgICAgICAgICAgICAgICB9KSwgd2luZG93LnBianMuaW5zdGFsbGVkTW9kdWxlcy5wdXNoKCdjb25zZW50TWFuYWdlbWVudFVzcCcpOwogICAgICAgICAgICB9CiAgICAgICAgfSwgWzM4Nl0pOwogICAgICAgIHBianNDaHVuayhbMzAxXSwgewogICAgICAgICAgICA0MDA6IGZ1bmN0aW9uIChlLCB0LCBvKSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBvKDQwMSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDQwMTogZnVuY3Rpb24gKGUsIHQsIG8pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCBvLmQodCwgJ3N0b3JhZ2UnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGw7CiAgICAgICAgICAgICAgICB9KSwgby5kKHQsICdjcml0ZW9JZFN1Ym1vZHVsZScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaDsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIG4gPSBvKDApLCBjID0gbyg0KSwgciA9IG8oMTkpLCBpID0gbyg5KSwgYSA9IG8oNyksIGQgPSAnY3JpdGVvJywgbCA9IE9iamVjdChhLmIpKDkxLCBkKSwgdSA9ICdjdG9fYmlkaWQnLCBzID0gJ2N0b19idW5kbGUnLCBiID0gbmV3IERhdGUoMCkudG9TdHJpbmcoKSwgcCA9IG5ldyBEYXRlKE9iamVjdChuLnRpbWVzdGFtcCkoKSArIDMzNjk2MDAwMDAwKS50b1N0cmluZygpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZihlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSAmJiBhcmd1bWVudHNbMV0sIG8gPSBPYmplY3Qobi5wYXJzZVVybCkoZSwgeyBub0RlY29kZVdob2xlVVJMOiAhMCB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA/ICcnLmNvbmNhdChvLmhvc3RuYW1lKSA6ICcnLmNvbmNhdChvLnByb3RvY29sLCAnOi8vJykuY29uY2F0KG8uaG9zdG5hbWUpLmNvbmNhdChvLnBvcnQgPyAnOicgKyBvLnBvcnQgOiAnJywgJy8nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGcoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBsLmdldENvb2tpZShlKSB8fCBsLmdldERhdGFGcm9tTG9jYWxTdG9yYWdlKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbShlLCB0LCBvKSB7CiAgICAgICAgICAgICAgICAgICAgZSAmJiB0ICYmIChsLnNldERhdGFJbkxvY2FsU3RvcmFnZShlLCB0KSwgSShlLCB0LCBwLCBvLCAhMCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSShlLCB0LCBvLCBuLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IG4uc3BsaXQoJy4nKSwgaSA9IDA7IGkgPCByLmxlbmd0aDsgKytpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gci5zbGljZShyLmxlbmd0aCAtIGkgLSAxLCByLmxlbmd0aCkuam9pbignLicpOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGwuc2V0Q29va2llKGUsIHQsIG8sIG51bGwsICcuJyArIGEpLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBsLmdldENvb2tpZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiBkID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdihlLCB0LCBvKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBsLmNvb2tpZXNBcmVFbmFibGVkKCksIGEgPSBsLmxvY2FsU3RvcmFnZUlzRW5hYmxlZCgpLCBkID0gZihPYmplY3Qoci5hKSgpLnJlZmVyZXIpLCBwID0gZihkb2N1bWVudC5sb2NhdGlvbi5ocmVmLCAhMCksIGcgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2YgY3JpdGVvX3B1YnRhZywgdiA9IGZ1bmN0aW9uIChlLCB0LCBvLCBuLCBjLCByLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2h0dHBzOi8vZ3VtLmNyaXRlby5jb20vc2lkL2pzb24/b3JpZ2luPXByZWJpZCcgKyAnJy5jb25jYXQoZSA/ICcmdG9wVXJsPScgKyBlbmNvZGVVUklDb21wb25lbnQoZSkgOiAnJykgKyAnJy5jb25jYXQodCA/ICcmZG9tYWluPScgKyBlbmNvZGVVUklDb21wb25lbnQodCkgOiAnJykgKyAnJy5jb25jYXQobyA/ICcmYnVuZGxlPScgKyBlbmNvZGVVUklDb21wb25lbnQobykgOiAnJykgKyAnJy5jb25jYXQoaSA/ICcmZ2RwclN0cmluZz0nICsgZW5jb2RlVVJJQ29tcG9uZW50KGkpIDogJycpICsgJycuY29uY2F0KG4gPyAnJmN3PTEnIDogJycpICsgJycuY29uY2F0KHIgPyAnJnBidD0xJyA6ICcnKSArICcnLmNvbmNhdChjID8gJyZsc3c9MScgOiAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZCwgcCwgZS5idW5kbGUsIGksIGEsIGcsIHQpLCBoID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgYyA9IEpTT04ucGFyc2UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5hY3dzVXJsID8gKCdzdHJpbmcnID09IHR5cGVvZiBjLmFjd3NVcmwgPyBbYy5hY3dzVXJsXSA6IGMuYWN3c1VybCkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KG4udHJpZ2dlclBpeGVsKShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGMuYnVuZGxlICYmIG0ocywgYy5idW5kbGUsIHApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjLmJpZElkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0odSwgYy5iaWRJZCwgcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0geyBjcml0ZW9JZDogYy5iaWRJZCB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKHQgPSB1LCAnJywgYiwgcCwgITApLCBsLnJlbW92ZURhdGFGcm9tTG9jYWxTdG9yYWdlKHQpLCBvKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG4ubG9nRXJyb3IpKCdjcml0ZW9JZFN5c3RlbTogdW5hYmxlIHRvIHN5bmMgdXNlciBpZCcsIGUpLCBvKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGMuYSkodiwgaCwgdm9pZCAwLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ0dFVCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnRUeXBlOiAnYXBwbGljYXRpb24vanNvbicsCiAgICAgICAgICAgICAgICAgICAgICAgIHdpdGhDcmVkZW50aWFsczogITAKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBoID0gewogICAgICAgICAgICAgICAgICAgIG5hbWU6IGQsCiAgICAgICAgICAgICAgICAgICAgZ3ZsaWQ6IDkxLAogICAgICAgICAgICAgICAgICAgIGRlY29kZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBnZXRJZDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0ICYmICdib29sZWFuJyA9PSB0eXBlb2YgdC5nZHByQXBwbGllcyAmJiB0LmdkcHJBcHBsaWVzID8gdC5jb25zZW50U3RyaW5nIDogdm9pZCAwLCBuID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1bmRsZTogZyhzKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRJZDogZyh1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBuLmJpZElkID8geyBjcml0ZW9JZDogbi5iaWRJZCB9IDogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYobiwgbywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIE9iamVjdChpLmUpKCd1c2VySWQnLCBoKSwgd2luZG93LnBianMuaW5zdGFsbGVkTW9kdWxlcy5wdXNoKCdjcml0ZW9JZFN5c3RlbScpOwogICAgICAgICAgICB9CiAgICAgICAgfSwgWzQwMF0pOwogICAgICAgIHBianNDaHVuayhbMzAwXSwgewogICAgICAgICAgICA0MDI6IGZ1bmN0aW9uIChlLCByLCBuKSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBuKDQwMyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDQwMzogZnVuY3Rpb24gKGUsIHIsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShyLCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCBuLmQociwgJ2N1cnJlbmN5U3VwcG9ydEVuYWJsZWQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGo7CiAgICAgICAgICAgICAgICB9KSwgbi5kKHIsICdjdXJyZW5jeVJhdGVzJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBPOwogICAgICAgICAgICAgICAgfSksIHIuc2V0Q29uZmlnID0gUywgci5hZGRCaWRSZXNwb25zZUhvb2sgPSBEOwogICAgICAgICAgICAgICAgdmFyIG8gPSBuKDApLCBjID0gbigxNCksIHQgPSBuKDQzKSwgaSA9IG4oNSksIHMgPSBuLm4oaSksIGEgPSBuKDQpLCB1ID0gbigzKSwgZiA9IG4oOSk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGQgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGUuY29uc3RydWN0b3IgPT09IFN5bWJvbCAmJiBlICE9PSBTeW1ib2wucHJvdG90eXBlID8gJ3N5bWJvbCcgOiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9KShlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBsLCB5ID0gJ2h0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9naC9wcmViaWQvY3VycmVuY3ktZmlsZUAxL2xhdGVzdC5qc29uP2RhdGU9JCRUT0RBWSQkJywgYiA9IFtdLCBnID0ge30sIHYgPSAhMSwgcCA9ICEwLCBoID0gJ1VTRCcsIGogPSAhMSwgTyA9IHt9LCBDID0ge307CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBTKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09PSBkKGUucmF0ZXMpICYmIChPLmNvbnZlcnNpb25zID0gZS5yYXRlcywgdiA9ICEwLCBwID0gITEpLCAnb2JqZWN0JyA9PT0gZChlLmRlZmF1bHRSYXRlcykgJiYgKGwgPSBlLmRlZmF1bHRSYXRlcywgTy5jb252ZXJzaW9ucyA9IGwsIHYgPSAhMCksICdzdHJpbmcnID09IHR5cGVvZiBlLmFkU2VydmVyQ3VycmVuY3kpIHsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG8ubG9nSW5mbykoJ2VuYWJsaW5nIGN1cnJlbmN5IHN1cHBvcnQnLCBhcmd1bWVudHMpLCBoID0gZS5hZFNlcnZlckN1cnJlbmN5LCBlLmNvbnZlcnNpb25SYXRlRmlsZSAmJiAoT2JqZWN0KG8ubG9nSW5mbykoJ2N1cnJlbmN5IHVzaW5nIG92ZXJyaWRlIGNvbnZlcnNpb25SYXRlRmlsZTonLCBlLmNvbnZlcnNpb25SYXRlRmlsZSksIHIgPSBlLmNvbnZlcnNpb25SYXRlRmlsZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gci5pbmRleE9mKCckJFRPREFZJCQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC0xICE9PSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG5ldyBEYXRlKCksIHQgPSAnJy5jb25jYXQoYy5nZXRNb250aCgpICsgMSksIGkgPSAnJy5jb25jYXQoYy5nZXREYXRlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5sZW5ndGggPCAyICYmICh0ID0gJzAnLmNvbmNhdCh0KSksIGkubGVuZ3RoIDwgMiAmJiAoaSA9ICcwJy5jb25jYXQoaSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSAnJy5jb25jYXQoYy5nZXRGdWxsWWVhcigpKS5jb25jYXQodCkuY29uY2F0KGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9ICcnLmNvbmNhdChyLnN1YnN0cmluZygwLCBuKSkuY29uY2F0KHMpLmNvbmNhdChyLnN1YnN0cmluZyhuICsgOSwgci5sZW5ndGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBSKHIpOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoby5sb2dJbmZvKSgnZGlzYWJsaW5nIGN1cnJlbmN5IHN1cHBvcnQnKSwgdygpOwogICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09PSBkKGUuYmlkZGVyQ3VycmVuY3lEZWZhdWx0KSAmJiAoQyA9IGUuYmlkZGVyQ3VycmVuY3lEZWZhdWx0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oZSkgewogICAgICAgICAgICAgICAgICAgIGwgPyAoT2JqZWN0KG8ubG9nV2FybikoZSksIE9iamVjdChvLmxvZ1dhcm4pKCdDdXJyZW5jeSBmYWlsZWQgbG9hZGluZyByYXRlcywgZmFsbGluZyBiYWNrIHRvIGN1cnJlbmN5LmRlZmF1bHRSYXRlcycpKSA6IE9iamVjdChvLmxvZ0Vycm9yKShlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFIoZSkgewogICAgICAgICAgICAgICAgICAgIGcgPSB7fSwgaiA9ICEwLCBPYmplY3Qoby5sb2dJbmZvKSgnSW5zdGFsbGluZyBhZGRCaWRSZXNwb25zZSBkZWNvcmF0b3IgZm9yIGN1cnJlbmN5IG1vZHVsZScsIGFyZ3VtZW50cyksIE9iamVjdChjLmEpKCkuY29udmVydEN1cnJlbmN5ID0gZnVuY3Rpb24gKGUsIHIsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlRmxvYXQoZSkgKiBGKHIsIG4pOwogICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdChmLmEpKCdhZGRCaWRSZXNwb25zZScpLmJlZm9yZShELCAxMDApLCBwICYmIChwID0gITEsIE9iamVjdChhLmEpKGUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTyA9IEpTT04ucGFyc2UoZSksIE9iamVjdChvLmxvZ0luZm8pKCdjdXJyZW5jeVJhdGVzIHNldCB0byAnICsgSlNPTi5zdHJpbmdpZnkoTykpLCB2ID0gITAsIEkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtKCdGYWlsZWQgdG8gcGFyc2UgY3VycmVuY3lSYXRlcyByZXNwb25zZTogJyArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogbQogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHcoKSB7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG8ubG9nSW5mbykoJ1VuaW5zdGFsbGluZyBhZGRCaWRSZXNwb25zZSBkZWNvcmF0b3IgZm9yIGN1cnJlbmN5IG1vZHVsZScsIGFyZ3VtZW50cyksIE9iamVjdChmLmEpKCdhZGRCaWRSZXNwb25zZScpLmdldEhvb2tzKHsgaG9vazogRCB9KS5yZW1vdmUoKSwgZGVsZXRlIE9iamVjdChjLmEpKCkuY29udmVydEN1cnJlbmN5LCBoID0gJ1VTRCcsIGcgPSB7fSwgaiA9ICExLCB2ID0gITEsIHAgPSAhMCwgTyA9IHt9LCBDID0ge307CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBEKGUsIHIsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIW4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNhbGwodGhpcywgcik7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuLmJpZGRlckNvZGUgfHwgbi5iaWRkZXI7CiAgICAgICAgICAgICAgICAgICAgaWYgKENbY10pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBDW2NdOwogICAgICAgICAgICAgICAgICAgICAgICBuLmN1cnJlbmN5ICYmIGkgIT09IG4uY3VycmVuY3kgPyBPYmplY3Qoby5sb2dXYXJuKSgnQ3VycmVuY3kgZGVmYXVsdCBcJycuY29uY2F0KGMsICc6ICcpLmNvbmNhdChpLCAnXCcgaWdub3JlZC4gYWRhcHRlciBzcGVjaWZpZWQgXCcnKS5jb25jYXQobi5jdXJyZW5jeSwgJ1wnJykpIDogbi5jdXJyZW5jeSA9IGk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChuLmN1cnJlbmN5IHx8IChPYmplY3Qoby5sb2dXYXJuKSgnQ3VycmVuY3kgbm90IHNwZWNpZmllZCBvbiBiaWQuICBEZWZhdWx0ZWQgdG8gIlVTRCInKSwgbi5jdXJyZW5jeSA9ICdVU0QnKSwgbi5nZXRDcG1Jbk5ld0N1cnJlbmN5ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAocGFyc2VGbG9hdCh0aGlzLmNwbSkgKiBGKHRoaXMuY3VycmVuY3ksIGUpKS50b0ZpeGVkKDMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBuLmN1cnJlbmN5ID09PSBoKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jYWxsKHRoaXMsIHIsIG4pOwogICAgICAgICAgICAgICAgICAgIGIucHVzaChmdW5jdGlvbiAoZSwgciwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gYyAmJiAnY3VycmVuY3knIGluIGMgJiYgJ2NwbScgaW4gYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gYy5jdXJyZW5jeTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IEYoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEgIT09IGEgJiYgKGMuY3BtID0gKHBhcnNlRmxvYXQoYy5jcG0pICogYSkudG9GaXhlZCg0KSwgYy5jdXJyZW5jeSA9IGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG8ubG9nV2FybikoJ1JldHVybmluZyBOT19CSUQsIGdldEN1cnJlbmN5Q29udmVyc2lvbiB0aHJldyBlcnJvcjogJywgZSksIG5bMV0gPSBPYmplY3QodC5hKShzLmEuU1RBVFVTLk5PX0JJRCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZGVyOiBjLmJpZGRlckNvZGUgfHwgYy5iaWRkZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRJZDogYy5yZXF1ZXN0SWQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkociwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfShlLCB0aGlzLCBbCiAgICAgICAgICAgICAgICAgICAgICAgIHIsCiAgICAgICAgICAgICAgICAgICAgICAgIG4KICAgICAgICAgICAgICAgICAgICBdKSksIGogJiYgIXYgfHwgSSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSSgpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgYi5sZW5ndGggPiAwOykKICAgICAgICAgICAgICAgICAgICAgICAgYi5zaGlmdCgpKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBGKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciwgbiA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDogaCwgYyA9IG51bGwsIHQgPSAnJy5jb25jYXQoZSwgJy0+JykuY29uY2F0KG4pOwogICAgICAgICAgICAgICAgICAgIGlmICh0IGluIGcpCiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBnW3RdLCBPYmplY3Qoby5sb2dNZXNzYWdlKSgnVXNpbmcgY29udmVyc2lvbkNhY2hlIHZhbHVlICcgKyBjICsgJyBmb3IgJyArIHQpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCExID09PSBqKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnVVNEJyAhPT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignUHJlYmlkIGN1cnJlbmN5IHN1cHBvcnQgaGFzIG5vdCBiZWVuIGVuYWJsZWQgYW5kIGZyb21DdXJyZW5jeSBpcyBub3QgVVNEJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAxOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZSA9PT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IDE7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZSBpbiBPLmNvbnZlcnNpb25zKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG4gaW4gKHIgPSBPLmNvbnZlcnNpb25zW2VdKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1NwZWNpZmllZCBhZFNlcnZlckN1cnJlbmN5IGluIGNvbmZpZyBcJycgKyBuICsgJ1wnIG5vdCBmb3VuZCBpbiB0aGUgY3VycmVuY3kgcmF0ZXMgZmlsZScpOwogICAgICAgICAgICAgICAgICAgICAgICBjID0gcltuXSwgT2JqZWN0KG8ubG9nSW5mbykoJ2dldEN1cnJlbmN5Q29udmVyc2lvbiB1c2luZyBkaXJlY3QgJyArIGUgKyAnIHRvICcgKyBuICsgJyBjb252ZXJzaW9uUmF0ZSAnICsgYyk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChuIGluIE8uY29udmVyc2lvbnMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoZSBpbiAociA9IE8uY29udmVyc2lvbnNbbl0pKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignU3BlY2lmaWVkIGZyb21DdXJyZW5jeSBcJycgKyBlICsgJ1wnIG5vdCBmb3VuZCBpbiB0aGUgY3VycmVuY3kgcmF0ZXMgZmlsZScpOwogICAgICAgICAgICAgICAgICAgICAgICBjID0gVSgxIC8gcltlXSwgNCksIE9iamVjdChvLmxvZ0luZm8pKCdnZXRDdXJyZW5jeUNvbnZlcnNpb24gdXNpbmcgcmVjaXByb2NhbCAnICsgZSArICcgdG8gJyArIG4gKyAnIGNvbnZlcnNpb25SYXRlICcgKyBjKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IE9iamVjdC5rZXlzKE8uY29udmVyc2lvbnMpWzBdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluIE8uY29udmVyc2lvbnNbaV0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdTcGVjaWZpZWQgZnJvbUN1cnJlbmN5IFwnJyArIGUgKyAnXCcgbm90IGZvdW5kIGluIHRoZSBjdXJyZW5jeSByYXRlcyBmaWxlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gMSAvIE8uY29udmVyc2lvbnNbaV1bZV07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG4gaW4gTy5jb252ZXJzaW9uc1tpXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1NwZWNpZmllZCBhZFNlcnZlckN1cnJlbmN5IGluIGNvbmZpZyBcJycgKyBuICsgJ1wnIG5vdCBmb3VuZCBpbiB0aGUgY3VycmVuY3kgcmF0ZXMgZmlsZScpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IE8uY29udmVyc2lvbnNbaV1bbl07CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBVKHMgKiBhLCA0KSwgT2JqZWN0KG8ubG9nSW5mbykoJ2dldEN1cnJlbmN5Q29udmVyc2lvbiB1c2luZyBpbnRlcm1lZGlhdGUgJyArIGUgKyAnIHRocnUgJyArIGkgKyAnIHRvICcgKyBuICsgJyBjb252ZXJzaW9uUmF0ZSAnICsgYyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0IGluIGcgfHwgKE9iamVjdChvLmxvZ01lc3NhZ2UpKCdBZGRpbmcgY29udmVyc2lvbkNhY2hlIHZhbHVlICcgKyBjICsgJyBmb3IgJyArIHQpLCBnW3RdID0gYyksIGM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBVKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMSwgbyA9IDA7IG8gPCByOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgIG4gKz0gJzAnOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLnJvdW5kKGUgKiBuKSAvIG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB1LmIuZ2V0Q29uZmlnKCdjdXJyZW5jeScsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFMoZS5jdXJyZW5jeSk7CiAgICAgICAgICAgICAgICB9KSwgd2luZG93LnBianMuaW5zdGFsbGVkTW9kdWxlcy5wdXNoKCdjdXJyZW5jeScpOwogICAgICAgICAgICB9CiAgICAgICAgfSwgWzQwMl0pOwogICAgICAgIHBianNDaHVuayhbMjgzXSwgewogICAgICAgICAgICA0Mzg6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBuKDQzOSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDQzOTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCBuLmQodCwgJ2NvcmVTdG9yYWdlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB1OwogICAgICAgICAgICAgICAgfSksIHQuZmluZFJvb3REb21haW4gPSBtLCB0LmluaXRTdWJtb2R1bGUgPSB3LCBuLmQodCwgJ2VucmljaG1lbnRzU3VibW9kdWxlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBzOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgaSA9IG4oMCksIG8gPSBuKDkpLCBjID0gbigxOSksIHIgPSBuKDcpLCBkID0ge30sIGEgPSB3aW5kb3cgPT09IHdpbmRvdy50b3AgPyB3aW5kb3cgOiB3aW5kb3cudG9wLCB1ID0gT2JqZWN0KHIuYSkoJ2VucmljaG1lbnRGcGQnKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6IHdpbmRvdy5sb2NhdGlvbi5ob3N0bmFtZTsKICAgICAgICAgICAgICAgICAgICBpZiAoIXUuY29va2llc0FyZUVuYWJsZWQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIG8gPSBlLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDIgPT0gby5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIHZhciBjID0gLTIsIHIgPSAnX3JkYycuY29uY2F0KERhdGUubm93KCkpLCBkID0gJ3dyaXRlYWJsZSc7CiAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICB0ID0gby5zbGljZShjKS5qb2luKCcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IERhdGUoT2JqZWN0KGkudGltZXN0YW1wKSgpICsgMTAwMDApLnRvVVRDU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHUuc2V0Q29va2llKHIsIGQsIGEsICdMYXgnLCB0LCB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IHUuZ2V0Q29va2llKHIsIHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIG0gPT09IGQgPyAobiA9ICExLCB1LnNldENvb2tpZShyLCAnJywgJ1RodSwgMDEgSmFuIDE5NzAgMDA6MDA6MDEgR01UJywgdm9pZCAwLCB0LCB2b2lkIDApKSA6IChjICs9IC0xLCBuID0gTWF0aC5hYnMoYykgPD0gby5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKG4pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbCgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGMuYSkoKS5yZWZlcmVyICYmIE9iamVjdChpLm1lcmdlRGVlcCkoZCwgeyBzaXRlOiB7IHJlZjogT2JqZWN0KGMuYSkoKS5yZWZlcmVyIH0gfSksIE9iamVjdChjLmEpKCkuY2Fub25pY2FsVXJsICYmIE9iamVjdChpLm1lcmdlRGVlcCkoZCwgeyBzaXRlOiB7IHBhZ2U6IE9iamVjdChjLmEpKCkuY2Fub25pY2FsVXJsIH0gfSksIChlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgMCAhPT0gZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5tYXRjaCgvXig/Omh0dHBzPzpcL1wvKT8oPzp3d3dcLik/KC4qPyg/PShcP3xcI3xcL3wkKSkpL2kpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgdFsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oT2JqZWN0KGMuYSkoKS5jYW5vbmljYWxVcmwpKSAmJiAoT2JqZWN0KGkubWVyZ2VEZWVwKShkLCB7IHNpdGU6IHsgZG9tYWluOiBlIH0gfSksIE9iamVjdChpLm1lcmdlRGVlcCkoZCwgeyBzaXRlOiB7IHB1Ymxpc2hlcjogeyBkb21haW46IG0oZSkgfSB9IH0pKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBhLmlubmVyV2lkdGggfHwgYS5kb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuY2xpZW50V2lkdGggfHwgYS5kb2N1bWVudC5ib2R5LmNsaWVudFdpZHRoLCB0ID0gYS5pbm5lckhlaWdodCB8fCBhLmRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5jbGllbnRIZWlnaHQgfHwgYS5kb2N1bWVudC5ib2R5LmNsaWVudEhlaWdodDsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHdpbmRvdy5pbm5lcldpZHRoIHx8IHdpbmRvdy5kb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuY2xpZW50V2lkdGggfHwgd2luZG93LmRvY3VtZW50LmJvZHkuY2xpZW50V2lkdGgsIHQgPSB3aW5kb3cuaW5uZXJIZWlnaHQgfHwgd2luZG93LmRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5jbGllbnRIZWlnaHQgfHwgd2luZG93LmRvY3VtZW50LmJvZHkuY2xpZW50SGVpZ2h0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChpLm1lcmdlRGVlcCkoZCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdzogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0oKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBhLmRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJ21ldGFbbmFtZT1cJ2tleXdvcmRzXCddJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSB3aW5kb3cuZG9jdW1lbnQucXVlcnlTZWxlY3RvcignbWV0YVtuYW1lPVwna2V5d29yZHNcJ10nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlICYmIGUuY29udGVudCAmJiBPYmplY3QoaS5tZXJnZURlZXApKGQsIHsgc2l0ZTogeyBrZXl3b3JkczogZS5jb250ZW50LnJlcGxhY2UoL1xzL2csICcnKSB9IH0pOwogICAgICAgICAgICAgICAgICAgIH0oKSwgZDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHcoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBkID0ge30sIGUuc2tpcEVucmljaG1lbnRzID8gdCA6IE9iamVjdChpLm1lcmdlRGVlcCkobCgpLCB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBzID0gewogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlbnJpY2htZW50cycsCiAgICAgICAgICAgICAgICAgICAgcXVldWU6IDIsCiAgICAgICAgICAgICAgICAgICAgaW5pdDogdwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIE9iamVjdChvLmUpKCdmaXJzdFBhcnR5RGF0YScsIHMpLCB3aW5kb3cucGJqcy5pbnN0YWxsZWRNb2R1bGVzLnB1c2goJ2VucmljaG1lbnRGcGRNb2R1bGUnKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIFs0MzhdKTsKICAgICAgICBwYmpzQ2h1bmsoWzI3NV0sIHsKICAgICAgICAgICAgNDYxOiBmdW5jdGlvbiAoZSwgdCwgbykgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gbyg0NjIpOwogICAgICAgICAgICB9LAogICAgICAgICAgICA0NjI6IGZ1bmN0aW9uIChlLCB0LCBvKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgdC5yZWdpc3RlclN1Ym1vZHVsZXMgPSBmLCB0LmluaXQgPSBjOwogICAgICAgICAgICAgICAgdmFyIG4gPSBvKDMpLCBpID0gbyg5KSwgdSA9IG8oMTQpLCByID0gbygyOCksIHMgPSBbXTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSkgewogICAgICAgICAgICAgICAgICAgIHMucHVzaChlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuLmIuZ2V0Q29uZmlnKCdmaXJzdFBhcnR5RGF0YScpIHx8IHt9LCB0ID0gbi5iLmdldENvbmZpZygnb3J0YjInKSB8fCB7fTsKICAgICAgICAgICAgICAgICAgICBzLnNvcnQoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlLnF1ZXVlIHx8IDEpIC0gKHQucXVldWUgfHwgMSk7CiAgICAgICAgICAgICAgICAgICAgfSkuZm9yRWFjaChmdW5jdGlvbiAobykgewogICAgICAgICAgICAgICAgICAgICAgICB0ID0gby5pbml0KGUsIHQpOwogICAgICAgICAgICAgICAgICAgIH0pLCBuLmIuc2V0Q29uZmlnKHsgb3J0YjI6IHQgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBjKCksIGUuY2FsbCh0aGlzLCB0KSwgci5lLmdldEhvb2tzKHsgaG9vazogYSB9KS5yZW1vdmUoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIoKSB7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkuYSkoJ2FkZEJpZGRlclJlcXVlc3RzJykuYmVmb3JlKGEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0KGkuYykoJ2ZpcnN0UGFydHlEYXRhJywgZiksIGIoKSwgT2JqZWN0KHUuYSkoKS5yZWZyZXNoRnBkID0gYiwgd2luZG93LnBianMuaW5zdGFsbGVkTW9kdWxlcy5wdXNoKCdmcGRNb2R1bGUnKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIFs0NjFdKTsKICAgICAgICBwYmpzQ2h1bmsoWzI3MF0sIHsKICAgICAgICAgICAgNDcxOiBmdW5jdGlvbiAoZSwgciwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gdCg0NzIpOwogICAgICAgICAgICB9LAogICAgICAgICAgICA0NzI6IGZ1bmN0aW9uIChlLCByLCB0KSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkociwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgdC5kKHIsICdwdXJwb3NlMVJ1bGUnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEE7CiAgICAgICAgICAgICAgICB9KSwgdC5kKHIsICdwdXJwb3NlMlJ1bGUnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEM7CiAgICAgICAgICAgICAgICB9KSwgdC5kKHIsICdwdXJwb3NlN1J1bGUnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEQ7CiAgICAgICAgICAgICAgICB9KSwgdC5kKHIsICdlbmZvcmNlbWVudFJ1bGVzJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBFOwogICAgICAgICAgICAgICAgfSksIHQuZChyLCAnaW50ZXJuYWwnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFY7CiAgICAgICAgICAgICAgICB9KSwgci5nZXRHdmxpZCA9IEgsIHIudmFsaWRhdGVSdWxlcyA9IFIsIHIuZGV2aWNlQWNjZXNzSG9vayA9IFQsIHIudXNlclN5bmNIb29rID0gRywgci51c2VySWRIb29rID0gTSwgci5tYWtlQmlkUmVxdWVzdHNIb29rID0gVywgci5lbmFibGVBbmFseXRpY3NIb29rID0gSSwgci5zZXRFbmZvcmNlbWVudENvbmZpZyA9IF87CiAgICAgICAgICAgICAgICB2YXIgbiA9IHQoMCksIG8gPSB0KDMpLCBhID0gdCg4KSwgYyA9IHQoMTEpLCBpID0gdC5uKGMpLCBzID0gdCgxMiksIGwgPSB0Lm4ocyksIHUgPSB0KDEpLCBwID0gdCg5KSwgZCA9IHQoNyksIGYgPSB0KDEwKSwgYiA9IHQubihmKSwgZyA9IHQoNSksIHYgPSB0Lm4oZyk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdC5rZXlzKGUpOwogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgciAmJiAobiA9IG4uZmlsdGVyKGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLCByKS5lbnVtZXJhYmxlOwogICAgICAgICAgICAgICAgICAgICAgICB9KSksIHQucHVzaC5hcHBseSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBPKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMTsgciA8IGFyZ3VtZW50cy5sZW5ndGg7IHIrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG51bGwgIT0gYXJndW1lbnRzW3JdID8gYXJndW1lbnRzW3JdIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgIHIgJSAyID8geShPYmplY3QodCksICEwKS5mb3JFYWNoKGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtKGUsIHIsIHRbcl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSA6IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzID8gT2JqZWN0LmRlZmluZVByb3BlcnRpZXMoZSwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnModCkpIDogeShPYmplY3QodCkpLmZvckVhY2goZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCByLCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHQsIHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbShlLCByLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgaW4gZSA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCByLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB0LAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSkgOiBlW3JdID0gdCwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChoID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMTsgciA8IGFyZ3VtZW50cy5sZW5ndGg7IHIrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHNbcl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHQsIG4pICYmIChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSkuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGooZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoaiA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIEEsIEMsIEQsIEUsIFAgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2UxOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdzdG9yYWdlJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwdXJwb3NlMjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnYmFzaWNBZHMnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2U3OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdtZWFzdXJlbWVudCcKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGsgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2U6ICdzdG9yYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZm9yY2VQdXJwb3NlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZm9yY2VWZW5kb3I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yRXhjZXB0aW9uczogW10KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVycG9zZTogJ2Jhc2ljQWRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZm9yY2VQdXJwb3NlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZm9yY2VWZW5kb3I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yRXhjZXB0aW9uczogW10KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sIHcgPSBbXSwgUyA9IFtdLCBGID0gW10sIEIgPSAhMSwgViA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0R3ZsaWRGb3JCaWRBZGFwdGVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPSBlIHx8IG8uYi5nZXRDdXJyZW50QmlkZGVyKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEuZGVmYXVsdC5nZXRCaWRBZGFwdGVyKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgdC5nZXRTcGVjICYmIChyID0gdC5nZXRTcGVjKCkuZ3ZsaWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldEd2bGlkRm9yVXNlcklkTW9kdWxlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnID09PSBqKGUpID8gZS5ndmxpZCA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldEd2bGlkRm9yQW5hbHl0aWNzQWRhcHRlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmRlZmF1bHQuZ2V0QW5hbHl0aWNzQWRhcHRlcihlKSAmJiAoYS5kZWZhdWx0LmdldEFuYWx5dGljc0FkYXB0ZXIoZSkuZ3ZsaWQgfHwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gSChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gby5iLmdldENvbmZpZygnZ3ZsTWFwcGluZycpLCBuID0gJ3N0cmluZycgPT0gdHlwZW9mIGUgPyBlIDogZS5uYW1lOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiB0W25dKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSB0W25dOwogICAgICAgICAgICAgICAgICAgICAgICByID0gVi5nZXRHdmxpZEZvckJpZEFkYXB0ZXIobikgfHwgVi5nZXRHdmxpZEZvclVzZXJJZE1vZHVsZShlKSB8fCBWLmdldEd2bGlkRm9yQW5hbHl0aWNzQWRhcHRlcihuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBSKGUsIHIsIHQsIG8pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFBbT2JqZWN0LmtleXMoUCkuZmlsdGVyKGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQW3JdLm5hbWUgPT09IGUucHVycG9zZTsKICAgICAgICAgICAgICAgICAgICB9KVswXV0uaWQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKGwoKShlLnZlbmRvckV4Y2VwdGlvbnMgfHwgW10sIHQpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBPYmplY3Qobi5kZWVwQWNjZXNzKShyLCAndmVuZG9yRGF0YS5wdXJwb3NlLmNvbnNlbnRzLicuY29uY2F0KGEpKSwgaSA9IE9iamVjdChuLmRlZXBBY2Nlc3MpKHIsICd2ZW5kb3JEYXRhLnZlbmRvci5jb25zZW50cy4nLmNvbmNhdChvKSksIHMgPSBPYmplY3Qobi5kZWVwQWNjZXNzKShyLCAndmVuZG9yRGF0YS5wdXJwb3NlLmxlZ2l0aW1hdGVJbnRlcmVzdHMuJy5jb25jYXQoYSkpLCB1ID0gITEgPT09IGUuZW5mb3JjZVB1cnBvc2UgfHwgITAgPT09IGMsIHAgPSAhMSA9PT0gZS5lbmZvcmNlVmVuZG9yIHx8ICEwID09PSBpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAyID09PSBhID8gdSAmJiBwIHx8ICEwID09PSBzIDogdSAmJiBwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gVChlLCByLCB0LCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMgPSBoKHt9LCB7IGhhc0VuZm9yY2VtZW50SG9vazogITAgfSksIE9iamVjdChuLmhhc0RldmljZUFjY2VzcykoKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGEuZ2RwckRhdGFIYW5kbGVyLmdldENvbnNlbnREYXRhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpICYmIGkuZ2RwckFwcGxpZXMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMiA9PT0gaS5hcGlWZXJzaW9uKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBvLmIuZ2V0Q3VycmVudEJpZGRlcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBzICYmIHMgIT0gdCAmJiBhLmRlZmF1bHQuYWxpYXNSZWdpc3RyeVtzXSA9PT0gdCA/IEgocykgOiBIKHQpIHx8IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSB0IHx8IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUihBLCBpLCBsLCByKSA/IChjLnZhbGlkID0gITAsIGUuY2FsbCh0aGlzLCByLCB0LCBjKSkgOiAobCAmJiBPYmplY3Qobi5sb2dXYXJuKSgnVENGMiBkZW5pZWQgZGV2aWNlIGFjY2VzcyBmb3IgJy5jb25jYXQobCkpLCBjLnZhbGlkID0gITEsIHcucHVzaChsKSwgZS5jYWxsKHRoaXMsIHIsIHQsIGMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMudmFsaWQgPSAhMCwgZS5jYWxsKHRoaXMsIHIsIHQsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLnZhbGlkID0gITAsIGUuY2FsbCh0aGlzLCByLCB0LCBjKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG4ubG9nV2FybikoJ0RldmljZSBhY2Nlc3MgaXMgZGlzYWJsZWQgYnkgUHVibGlzaGVyJyksIGMudmFsaWQgPSAhMSwgZS5jYWxsKHRoaXMsIHIsIHQsIGMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRyhlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IGEuZ2RwckRhdGFIYW5kbGVyLmdldENvbnNlbnREYXRhKCksIHQgPSBhcmd1bWVudHMubGVuZ3RoLCBjID0gbmV3IEFycmF5KHQgPiAxID8gdCAtIDEgOiAwKSwgaSA9IDE7IGkgPCB0OyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGNbaSAtIDFdID0gYXJndW1lbnRzW2ldOwogICAgICAgICAgICAgICAgICAgIGlmIChyICYmIHIuZ2RwckFwcGxpZXMpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgyID09PSByLmFwaVZlcnNpb24pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gby5iLmdldEN1cnJlbnRCaWRkZXIoKSwgbCA9IEgocyksIHUgPSBSKEEsIHIsIHMsIGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdSA/IGUuY2FsbC5hcHBseShlLCBbdGhpc10uY29uY2F0KGMpKSA6IChPYmplY3Qobi5sb2dXYXJuKSgnVXNlciBzeW5jIG5vdCBhbGxvd2VkIGZvciAnLmNvbmNhdChzKSksIHcucHVzaChzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jYWxsLmFwcGx5KGUsIFt0aGlzXS5jb25jYXQoYykpOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZS5jYWxsLmFwcGx5KGUsIFt0aGlzXS5jb25jYXQoYykpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTShlLCByLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgdC5nZHByQXBwbGllcykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDIgPT09IHQuYXBpVmVyc2lvbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gSChlLnN1Ym1vZHVsZSksIG8gPSBlLnN1Ym1vZHVsZS5uYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChSKEEsIHQsIG8sIHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qobi5sb2dXYXJuKSgnVXNlciBkZW5pZWQgcGVybWlzc2lvbiB0byBmZXRjaCB1c2VyIGlkIGZvciAnLmNvbmNhdChvLCAnIFVzZXIgaWQgbW9kdWxlJykpLCB3LnB1c2gobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jYWxsKHRoaXMsIG8sIE8oTyh7fSwgdCksIHt9LCB7IGhhc1ZhbGlkYXRlZDogITAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbCh0aGlzLCByLCB0KTsKICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbCh0aGlzLCByLCB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFcoZSwgcikgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBhLmdkcHJEYXRhSGFuZGxlci5nZXRDb25zZW50RGF0YSgpLCBvID0gYXJndW1lbnRzLmxlbmd0aCwgYyA9IG5ldyBBcnJheShvID4gMiA/IG8gLSAyIDogMCksIGkgPSAyOyBpIDwgbzsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICBjW2kgLSAyXSA9IGFyZ3VtZW50c1tpXTsKICAgICAgICAgICAgICAgICAgICB0ICYmIHQuZ2RwckFwcGxpZXMgJiYgMiA9PT0gdC5hcGlWZXJzaW9uID8gKHIuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBlLmJpZHMgPSBlLmJpZHMuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuYmlkZGVyLCBvID0gSChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsKCkoUywgcikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAhIVIoQywgdCwgciwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSB8fCAoT2JqZWN0KG4ubG9nV2FybikoJ1RDRjIgYmxvY2tlZCBhdWN0aW9uIGZvciAnLmNvbmNhdChyKSksIFMucHVzaChyKSksIGE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0pLCBlLmNhbGwuYXBwbHkoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLAogICAgICAgICAgICAgICAgICAgICAgICByCiAgICAgICAgICAgICAgICAgICAgXS5jb25jYXQoYykpKSA6IGUuY2FsbC5hcHBseShlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMsCiAgICAgICAgICAgICAgICAgICAgICAgIHIKICAgICAgICAgICAgICAgICAgICBdLmNvbmNhdChjKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBJKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEuZ2RwckRhdGFIYW5kbGVyLmdldENvbnNlbnREYXRhKCk7CiAgICAgICAgICAgICAgICAgICAgdCAmJiB0LmdkcHJBcHBsaWVzICYmIDIgPT09IHQuYXBpVmVyc2lvbiA/IChPYmplY3Qobi5pc0FycmF5KShyKSB8fCAociA9IFtyXSksIHIgPSByLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUucHJvdmlkZXIsIG8gPSBIKHIpLCBhID0gISFSKEQsIHQsIHIsIG8pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSB8fCAoRi5wdXNoKHIpLCBPYmplY3Qobi5sb2dXYXJuKSgnVENGMiBibG9ja2VkIGFuYWx5dGljcyBhZGFwdGVyICcuY29uY2F0KGUucHJvdmlkZXIpKSksIGE7CiAgICAgICAgICAgICAgICAgICAgfSksIGUuY2FsbCh0aGlzLCByKSkgOiBlLmNhbGwodGhpcywgcik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBiLmEub24odi5hLkVWRU5UUy5BVUNUSU9OX0VORCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZpbHRlcihmdW5jdGlvbiAociwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSByICYmIGUuaW5kZXhPZihyKSA9PT0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCByID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUJsb2NrZWQ6IGUodyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXJzQmxvY2tlZDogZShTKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuYWx5dGljc0Jsb2NrZWQ6IGUoRikKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBiLmEuZW1pdCh2LmEuRVZFTlRTLlRDRjJfRU5GT1JDRU1FTlQsIHIpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgTiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnB1cnBvc2UgPT09IFAucHVycG9zZTEubmFtZTsKICAgICAgICAgICAgICAgICAgICB9LCBVID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHVycG9zZSA9PT0gUC5wdXJwb3NlMi5uYW1lOwogICAgICAgICAgICAgICAgICAgIH0sIHggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wdXJwb3NlID09PSBQLnB1cnBvc2U3Lm5hbWU7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF8oZSkgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0KG4uZGVlcEFjY2VzcykoZSwgJ2dkcHIucnVsZXMnKTsKICAgICAgICAgICAgICAgICAgICByID8gRSA9IHIgOiAoT2JqZWN0KG4ubG9nV2FybikoJ1RDRjI6IGVuZm9yY2luZyBQMSBhbmQgUDIgYnkgZGVmYXVsdCcpLCBFID0gayksIEEgPSBpKCkoRSwgTiksIEMgPSBpKCkoRSwgVSksIEQgPSBpKCkoRSwgeCksIEEgfHwgKEEgPSBrWzBdKSwgQyB8fCAoQyA9IGtbMV0pLCBBICYmICFCICYmIChCID0gITAsIGQuZC5iZWZvcmUoVCwgNDkpLCB1LnJlZ2lzdGVyU3luY0lubmVyLmJlZm9yZShHLCA0OCksIE9iamVjdChwLmEpKCd2YWxpZGF0ZUdkcHJFbmZvcmNlbWVudCcpLmJlZm9yZShNLCA0NykpLCBDICYmIE9iamVjdChwLmEpKCdtYWtlQmlkUmVxdWVzdHMnKS5iZWZvcmUoVyksIEQgJiYgT2JqZWN0KHAuYSkoJ2VuYWJsZUFuYWx5dGljc0NiJykuYmVmb3JlKEkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgby5iLmdldENvbmZpZygnY29uc2VudE1hbmFnZW1lbnQnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBfKGUuY29uc2VudE1hbmFnZW1lbnQpOwogICAgICAgICAgICAgICAgfSksIHdpbmRvdy5wYmpzLmluc3RhbGxlZE1vZHVsZXMucHVzaCgnZ2RwckVuZm9yY2VtZW50Jyk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCBbNDcxXSk7CiAgICAgICAgcGJqc0NodW5rKFsyNDldLCB7CiAgICAgICAgICAgIDUxNTogZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIoNTE2KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNTE2OiBmdW5jdGlvbiAoZSwgdCwgcikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHIuZCh0LCAnSUQ1X1NUT1JBR0VfTkFNRScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcDsKICAgICAgICAgICAgICAgIH0pLCByLmQodCwgJ0lENV9QUklWQUNZX1NUT1JBR0VfTkFNRScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgIH0pLCByLmQodCwgJ2lkNUlkU3VibW9kdWxlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBtOwogICAgICAgICAgICAgICAgfSksIHQuZXhwRGF5c1N0ciA9IE8sIHQubmJDYWNoZU5hbWUgPSBqLCB0LnN0b3JlTmJJbkNhY2hlID0gdiwgdC5nZXROYkZyb21DYWNoZSA9IEksIHQuZ2V0RnJvbUxvY2FsU3RvcmFnZSA9IFMsIHQuc3RvcmVJbkxvY2FsU3RvcmFnZSA9IF87CiAgICAgICAgICAgICAgICB2YXIgbyA9IHIoMCksIG4gPSByKDQpLCBhID0gcig5KSwgYyA9IHIoMTkpLCBpID0gcig3KSwgcyA9IHIoOCksIHAgPSAnaWQ1aWQnLCBkID0gJycuY29uY2F0KHAsICdfcHJpdmFjeScpLCB1ID0gJ2h0bWw1JywgZyA9ICdVc2VyIElEIC0gSUQ1IHN1Ym1vZHVsZTogJywgYiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3BianMtaWQ1aWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnaWQ1aWQuMXN0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ2lkNWlkJwogICAgICAgICAgICAgICAgICAgIF0sIGwgPSBPYmplY3QoaS5iKSgxMzEsICdpZDVJZCcpLCBtID0gewogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnaWQ1SWQnLAogICAgICAgICAgICAgICAgICAgICAgICBndmxpZDogMTMxLAogICAgICAgICAgICAgICAgICAgICAgICBkZWNvZGU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiAnc3RyaW5nJyA9PSB0eXBlb2YgZS51bml2ZXJzYWxfdWlkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkNWlkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aWQ6IGUudW5pdmVyc2FsX3VpZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dDogeyBsaW5rVHlwZTogciA9IGUubGlua190eXBlIHx8IHIgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKE9iamVjdChvLmRlZXBBY2Nlc3MpKGUsICdhYl90ZXN0aW5nLnJlc3VsdCcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnY29udHJvbCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChvLmxvZ0luZm8pKGcgKyAnQS9CIFRlc3RpbmcgLSB1c2VyIGlzIGluIHRoZSBDb250cm9sIEdyb3VwOiBJRDUgSUQgaXMgTk9UIGV4cG9zZWQnKSwgT2JqZWN0KG8uZGVlcFNldFZhbHVlKShuLCAnaWQ1aWQuZXh0LmFiVGVzdGluZ0NvbnRyb2xHcm91cCcsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZXJyb3InOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoby5sb2dFcnJvcikoZyArICdBL0IgVGVzdGluZyBFUlJPUiEgY29udHJvbEdyb3VwUGN0IG11c3QgYmUgYSBudW1iZXIgPj0gMCBhbmQgPD0gMScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdub3JtYWwnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoby5sb2dJbmZvKShnICsgJ0EvQiBUZXN0aW5nIC0gdXNlciBpcyBOT1QgaW4gdGhlIENvbnRyb2wgR3JvdXAnKSwgT2JqZWN0KG8uZGVlcFNldFZhbHVlKShuLCAnaWQ1aWQuZXh0LmFiVGVzdGluZ0NvbnRyb2xHcm91cCcsICExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChvLmxvZ0luZm8pKGcgKyAnRGVjb2RlZCBJRCcsIG4pLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBnZXRJZDogZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEsIGkgPSAnaHR0cHM6Ly9pZDUtc3luYy5jb20vZy92Mi8nLmNvbmNhdChlLnBhcmFtcy5wYXJ0bmVyLCAnLmpzb24nKSwgcCA9IHQgJiYgJ2Jvb2xlYW4nID09IHR5cGVvZiB0LmdkcHJBcHBsaWVzICYmIHQuZ2RwckFwcGxpZXMgPyAxIDogMCwgbSA9IHMudXNwRGF0YUhhbmRsZXIuZ2V0Q29uc2VudERhdGEoKSwgaiA9IE9iamVjdChjLmEpKCksIEkgPSByICYmIHIuc2lnbmF0dXJlID8gci5zaWduYXR1cmUgOiAoYi5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLmdldENvb2tpZShlKSAmJiAoYSA9IEpTT04ucGFyc2UobC5nZXRDb29raWUoZSkpIHx8IGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYSAmJiBhLnNpZ25hdHVyZSB8fCAnJyksIFMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJ0bmVyOiBlLnBhcmFtcy5wYXJ0bmVyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2RwcjogcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5iUGFnZTogeShlLnBhcmFtcy5wYXJ0bmVyKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG86ICdwYmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJmOiBqLnJlZmVyZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3A6IGoucmVhY2hlZFRvcCA/IDEgOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdTogai5zdGFja1swXSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHY6ICc2LjYuMCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhcCB8fCB2b2lkIDAgPT09IHQuY29uc2VudFN0cmluZyB8fCBPYmplY3Qoby5pc0VtcHR5KSh0LmNvbnNlbnRTdHJpbmcpIHx8IE9iamVjdChvLmlzRW1wdHlTdHIpKHQuY29uc2VudFN0cmluZykgfHwgKFMuZ2Rwcl9jb25zZW50ID0gdC5jb25zZW50U3RyaW5nKSwgdm9pZCAwID09PSBtIHx8IE9iamVjdChvLmlzRW1wdHkpKG0pIHx8IE9iamVjdChvLmlzRW1wdHlTdHIpKG0pIHx8IChTLnVzX3ByaXZhY3kgPSBtKSwgdm9pZCAwID09PSBJIHx8IE9iamVjdChvLmlzRW1wdHlTdHIpKEkpIHx8IChTLnMgPSBJKSwgdm9pZCAwID09PSBlLnBhcmFtcy5wZCB8fCBPYmplY3Qoby5pc0VtcHR5U3RyKShlLnBhcmFtcy5wZCkgfHwgKFMucGQgPSBlLnBhcmFtcy5wZCksIHZvaWQgMCA9PT0gZS5wYXJhbXMucHJvdmlkZXIgfHwgT2JqZWN0KG8uaXNFbXB0eVN0cikoZS5wYXJhbXMucHJvdmlkZXIpIHx8IChTLnByb3ZpZGVyID0gZS5wYXJhbXMucHJvdmlkZXIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChvLmRlZXBBY2Nlc3MpKGUsICdwYXJhbXMuYWJUZXN0aW5nJywgeyBlbmFibGVkOiAhMSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICEwID09PSBoLmVuYWJsZWQgJiYgKFMuYWJfdGVzdGluZyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5hYmxlZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRyb2xfZ3JvdXBfcGN0OiBoLmNvbnRyb2xHcm91cFBjdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gSlNPTi5wYXJzZShyKSwgT2JqZWN0KG8ubG9nSW5mbykoZyArICdyZXNwb25zZSByZWNlaXZlZCBmcm9tIHRoZSBzZXJ2ZXInLCBuKSwgdihlLnBhcmFtcy5wYXJ0bmVyLCAwKSwgbi5wcml2YWN5ICYmIF8oZCwgSlNPTi5zdHJpbmdpZnkobi5wcml2YWN5KSwgMzApLCBlLnN0b3JhZ2UudHlwZSA9PT0gdSAmJiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoby5sb2dJbmZvKShnICsgJ3JlbW92aW5nIGxlZ2FjeSBjb29raWVzJyksIGIuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5zZXRDb29raWUoJycuY29uY2F0KHQpLCAnICcsIE8oLTEpKSwgbC5zZXRDb29raWUoJycuY29uY2F0KHQsICdfbmInKSwgJyAnLCBPKC0xKSksIGwuc2V0Q29va2llKCcnLmNvbmNhdCh0LCAnXycpLmNvbmNhdChlLCAnX25iJyksICcgJywgTygtMSkpLCBsLnNldENvb2tpZSgnJy5jb25jYXQodCwgJ19sYXN0JyksICcgJywgTygtMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUucGFyYW1zLnBhcnRuZXIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChvLmxvZ0Vycm9yKShnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG8ubG9nRXJyb3IpKGcgKyAnZ2V0SWQgZmV0Y2ggZW5jb3VudGVyZWQgYW4gZXJyb3InLCBlKSwgdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoby5sb2dJbmZvKShnICsgJ3JlcXVlc3RpbmcgYW4gSUQgZnJvbSB0aGUgc2VydmVyJywgUyksIE9iamVjdChuLmEpKGksIHIsIEpTT04uc3RyaW5naWZ5KFMpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2l0aENyZWRlbnRpYWxzOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBleHRlbmRJZDogZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmKGUpLCB5KGUgJiYgZS5wYXJhbXMgJiYgZS5wYXJhbXMucGFydG5lciB8fCAwKSwgT2JqZWN0KG8ubG9nSW5mbykoZyArICd1c2luZyBjYWNoZWQgSUQnLCByKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLnBhcmFtcyAmJiBlLnBhcmFtcy5wYXJ0bmVyICYmICdudW1iZXInID09IHR5cGVvZiBlLnBhcmFtcy5wYXJ0bmVyID8gZS5zdG9yYWdlICYmIGUuc3RvcmFnZS50eXBlICYmIGUuc3RvcmFnZS5uYW1lID8gKGUuc3RvcmFnZS50eXBlICE9PSB1ICYmIE9iamVjdChvLmxvZ1dhcm4pKGcgKyAnc3RvcmFnZSB0eXBlIHJlY29tbWVuZGVkIHRvIGJlIFwnJy5jb25jYXQodSwgJ1wnLiBJbiBhIGZ1dHVyZSByZWxlYXNlIHRoaXMgbWF5IGJlY29tZSBhIHN0cmljdCByZXF1aXJlbWVudCcpKSwgZS5zdG9yYWdlLm5hbWUgIT09IHAgJiYgT2JqZWN0KG8ubG9nV2FybikoZyArICdzdG9yYWdlIG5hbWUgcmVjb21tZW5kZWQgdG8gYmUgXCcnLmNvbmNhdChwLCAnXCcuIEluIGEgZnV0dXJlIHJlbGVhc2UgdGhpcyBtYXkgYmVjb21lIGEgc3RyaWN0IHJlcXVpcmVtZW50JykpLCAhMCkgOiAoT2JqZWN0KG8ubG9nRXJyb3IpKGcgKyAnc3RvcmFnZSByZXF1aXJlZCB0byBiZSBzZXQnKSwgITEpIDogKE9iamVjdChvLmxvZ0Vycm9yKShnICsgJ3BhcnRuZXIgcmVxdWlyZWQgdG8gYmUgZGVmaW5lZCBhcyBhIG51bWJlcicpLCAhMSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBPKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IERhdGUoRGF0ZS5ub3coKSArIDg2NDAwMDAwICogZSkudG9VVENTdHJpbmcoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGooZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnJy5jb25jYXQocCwgJ18nKS5jb25jYXQoZSwgJ19uYicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgXyhqKGUpLCB0LCAzMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBJKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFMoaihlKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPyBwYXJzZUludCh0KSA6IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEkoZSkgKyAxOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB2KGUsIHQpLCB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBsLmdldERhdGFGcm9tTG9jYWxTdG9yYWdlKCcnLmNvbmNhdChlLCAnX2V4cCcpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJycgPT09IHQgfHwgdCAmJiBuZXcgRGF0ZSh0KS5nZXRUaW1lKCkgLSBEYXRlLm5vdygpID4gMCA/IGwuZ2V0RGF0YUZyb21Mb2NhbFN0b3JhZ2UoZSkgOiAobC5yZW1vdmVEYXRhRnJvbUxvY2FsU3RvcmFnZShlKSwgbnVsbCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBfKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICAgICBsLnNldERhdGFJbkxvY2FsU3RvcmFnZSgnJy5jb25jYXQoZSwgJ19leHAnKSwgTyhyKSksIGwuc2V0RGF0YUluTG9jYWxTdG9yYWdlKCcnLmNvbmNhdChlKSwgdCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBPYmplY3QoYS5lKSgndXNlcklkJywgbSksIHdpbmRvdy5wYmpzLmluc3RhbGxlZE1vZHVsZXMucHVzaCgnaWQ1SWRTeXN0ZW0nKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIFs1MTVdKTsKICAgICAgICBwYmpzQ2h1bmsoWzI0OF0sIHsKICAgICAgICAgICAgNTIwOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gbig1MjEpOwogICAgICAgICAgICB9LAogICAgICAgICAgICA1MjE6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgbi5kKHQsICdzdG9yYWdlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBzOwogICAgICAgICAgICAgICAgfSksIG4uZCh0LCAnaWRlbnRpdHlMaW5rU3VibW9kdWxlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgaSA9IG4oMCksIG8gPSBuKDQpLCByID0gbig5KSwgZCA9IG4oNyksIHMgPSBPYmplY3QoZC5iKSgpLCBjID0gewogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnaWRlbnRpdHlMaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgZ3ZsaWQ6IDk3LAogICAgICAgICAgICAgICAgICAgICAgICBkZWNvZGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geyBpZGxfZW52OiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldElkOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlICYmIGUucGFyYW1zIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gJiYgJ3N0cmluZycgPT0gdHlwZW9mIG4ucGlkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0ICYmICdib29sZWFuJyA9PSB0eXBlb2YgdC5nZHByQXBwbGllcyAmJiB0LmdkcHJBcHBsaWVzID8gMSA6IDAsIHIgPSBvID8gdC5jb25zZW50U3RyaW5nIDogJycsIGQgPSAyID09PSBpLmRlZXBBY2Nlc3ModCwgJ3ZlbmRvckRhdGEudGNmUG9saWN5VmVyc2lvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbyB8fCByICYmICcnICE9PSByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gJ2h0dHBzOi8vYXBpLnJsY2RuLmNvbS9hcGkvaWRlbnRpdHkvZW52ZWxvcGU/cGlkPScuY29uY2F0KG4ucGlkKS5jb25jYXQobyA/IChkID8gJyZjdD00JmN2PScgOiAnJmN0PTEmY3Y9JykgKyByIDogJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LmF0cyA/IChpLmxvZ0luZm8oJ2lkZW50aXR5TGluazogQVRTIGV4aXN0cyEnKSwgd2luZG93LmF0cy5yZXRyaWV2ZUVudmVsb3BlKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPyAoaS5sb2dJbmZvKCdpZGVudGl0eUxpbms6IEFuIGVudmVsb3BlIGNhbiBiZSByZXRyaWV2ZWQgZnJvbSBBVFMhJyksIGwoITApLCBlKEpTT04ucGFyc2UodCkuZW52ZWxvcGUpKSA6IGEocywgZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIDogYShzLCBlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5sb2dJbmZvKCdpZGVudGl0eUxpbms6IENvbnNlbnQgc3RyaW5nIGlzIHJlcXVpcmVkIHRvIGNhbGwgZW52ZWxvcGUgQVBJLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5sb2dFcnJvcignaWRlbnRpdHlMaW5rOiByZXF1aXJlcyBwYXJ0bmVyIGlkIHRvIGJlIGRlZmluZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciwgZCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gSlNPTi5wYXJzZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5sb2dJbmZvKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChuICYmIG4uZW52ZWxvcGUgPyBuLmVudmVsb3BlIDogJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkubG9nSW5mbygnaWRlbnRpdHlMaW5rOiBpZGVudGl0eUxpbms6IElEIGZldGNoIGVuY291bnRlcmVkIGFuIGVycm9yJywgZSksIHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBuLm5vdFVzZTNQIHx8IHMuZ2V0Q29va2llKCdfbHJfcmV0cnlfcmVxdWVzdCcpIHx8ICgociA9IG5ldyBEYXRlKCkpLnNldFRpbWUoci5nZXRUaW1lKCkgKyAzNjAwMDAwKSwgcy5zZXRDb29raWUoJ19scl9yZXRyeV9yZXF1ZXN0JywgJ3RydWUnLCByLnRvVVRDU3RyaW5nKCkpLCBpLmxvZ0luZm8oJ2lkZW50aXR5TGluazogQSAzUCByZXRyaWV2YWwgaXMgYXR0ZW1wdGVkIScpLCBsKCExKSwgT2JqZWN0KG8uYSkoZSwgZCwgdm9pZCAwLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ0dFVCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHdpdGhDcmVkZW50aWFsczogITAKICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG5ldyBEYXRlKCk7CiAgICAgICAgICAgICAgICAgICAgdC5zZXRUaW1lKHQuZ2V0VGltZSgpICsgMjU5MjAwMDAwMCksIHMuc2V0Q29va2llKCdfbHJfZW52X3NyY19hdHMnLCBlLCB0LnRvVVRDU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0KHIuZSkoJ3VzZXJJZCcsIGMpLCB3aW5kb3cucGJqcy5pbnN0YWxsZWRNb2R1bGVzLnB1c2goJ2lkZW50aXR5TGlua0lkU3lzdGVtJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCBbNTIwXSk7CiAgICAgICAgcGJqc0NodW5rKFsyMzhdLCB7CiAgICAgICAgICAgIDU0NDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IG4oNTQ1KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNTQ1OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIG4uZCh0LCAnRklSU1RfUEFSVFlfS0VZJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgfSksIG4uZCh0LCAnc3RvcmFnZScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdTsKICAgICAgICAgICAgICAgIH0pLCB0LnJlYWREYXRhID0gcywgbi5kKHQsICdpbnRlbnRJcUlkU3VibW9kdWxlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMCksIGkgPSBuKDQpLCBvID0gbig5KSwgYSA9IG4oNyksIGMgPSAnaW50ZW50SXFJZCcsIGQgPSAnX2lpcV9mZGF0YScsIHUgPSBPYmplY3QoYS5iKSh2b2lkIDAsIGMpLCBwID0gJ0lOVkFMSURfSUQnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUuaGFzTG9jYWxTdG9yYWdlKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdS5nZXREYXRhRnJvbUxvY2FsU3RvcmFnZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUuY29va2llc0FyZUVuYWJsZWQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1LmdldENvb2tpZShlKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmxvZ0Vycm9yKShlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB4KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0KHIubG9nSW5mbykoJ2ludGVudElxSWQ6IHN0b3JpbmcgZGF0YToga2V5PScgKyBlICsgJyB2YWx1ZT0nICsgdCksIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUuaGFzTG9jYWxTdG9yYWdlKCkgJiYgdS5zZXREYXRhSW5Mb2NhbFN0b3JhZ2UoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG5ldyBEYXRlKERhdGUubm93KCkgKyAzMTUzNjAwMDAwMCkudG9VVENTdHJpbmcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUuY29va2llc0FyZUVuYWJsZWQoKSAmJiB1LnNldENvb2tpZShlLCB0LCBuLCAnTEFYJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmxvZ0Vycm9yKShlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5wYXJzZShlKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qoci5sb2dFcnJvcikoZSksIG51bGw7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGYgPSB7CiAgICAgICAgICAgICAgICAgICAgbmFtZTogYywKICAgICAgICAgICAgICAgICAgICBkZWNvZGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICcnICE9IGUgJiYgcCAhPSBlID8geyBpbnRlbnRJcUlkOiBlIH0gOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBnZXRJZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlICYmIGUucGFyYW1zIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiAnbnVtYmVyJyA9PSB0eXBlb2YgdC5wYXJ0bmVyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgbyA9IGwocyhkKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8gfHwgIW8ucGNpZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gKG4gPSBuZXcgRGF0ZSgpLmdldFRpbWUoKSwgJ3h4eHh4eHh4LXh4eHgtNHh4eC15eHh4LXh4eHh4eHh4eHh4eCcucmVwbGFjZSgvW3h5XS9nLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IChuICsgMTYgKiBNYXRoLnJhbmRvbSgpKSAlIDE2IHwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPSBNYXRoLmZsb29yKG4gLyAxNiksICgneCcgPT0gZSA/IHQgOiAzICYgdCB8IDgpLnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IHsgcGNpZDogYSB9LCB4KGQsIEpTT04uc3RyaW5naWZ5KG8pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gJ2h0dHBzOi8vYXBpLmludGVudGlxLmNvbS9wcm9maWxlc19lbmdpbmUvUHJvZmlsZXNFbmdpbmVTZXJ2bGV0P2F0PTM5Jm1pPTEwJmRwaT0nLmNvbmNhdCh0LnBhcnRuZXIsICcmcHQ9MTcmZHBuPTEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgKz0gdC5wY2lkID8gJyZwY2lkPScgKyBlbmNvZGVVUklDb21wb25lbnQodC5wY2lkKSA6ICcnLCBjICs9IHQucGFpID8gJyZwYWk9JyArIGVuY29kZVVSSUNvbXBvbmVudCh0LnBhaSkgOiAnJywgYyArPSBvLnBjaWQgPyAnJmlpcWlkdHlwZT0yJmlpcXBjaWQ9JyArIGVuY29kZVVSSUNvbXBvbmVudChvLnBjaWQpIDogJycsIGMgKz0gby5waWQgPyAnJnBpZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KG8ucGlkKSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWNjZXNzOiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIG4ubHMgPyAoJ3BpZCcgaW4gbiAmJiAoby5waWQgPSBuLnBpZCwgeChkLCBKU09OLnN0cmluZ2lmeShvKSkpLCAnJyA9PSBuLmRhdGEgJiYgKG4uZGF0YSA9IHApLCBlKG4uZGF0YSkpIDogZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmxvZ0Vycm9yKSgnaW50ZW50SXFJZDogSUQgZmV0Y2ggZW5jb3VudGVyZWQgYW4gZXJyb3InLCB0KSwgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5hKShjLCB0LCB2b2lkIDAsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ0dFVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aXRoQ3JlZGVudGlhbHM6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHIubG9nRXJyb3IpKCdVc2VyIElEIC0gaW50ZW50SXFJZCBzdWJtb2R1bGUgcmVxdWlyZXMgYSB2YWxpZCBwYXJ0bmVyIHRvIGJlIGRlZmluZWQnKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgT2JqZWN0KG8uZSkoJ3VzZXJJZCcsIGYpLCB3aW5kb3cucGJqcy5pbnN0YWxsZWRNb2R1bGVzLnB1c2goJ2ludGVudElxSWRTeXN0ZW0nKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIFs1NDRdKTsKICAgICAgICBwYmpzQ2h1bmsoWzIzMF0sIHsKICAgICAgICAgICAgNTYyOiBmdW5jdGlvbiAoZSwgciwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gdCg1NjMpOwogICAgICAgICAgICB9LAogICAgICAgICAgICA1NjM6IGZ1bmN0aW9uIChlLCByLCB0KSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkociwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgdC5kKHIsICdFUlJPUl9DT0RFUycsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gejsKICAgICAgICAgICAgICAgIH0pLCB0LmQociwgJ3N0b3JhZ2UnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEw7CiAgICAgICAgICAgICAgICB9KSwgdC5kKHIsICdzcGVjJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBvZTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIGkgPSB0KDApLCBuID0gdCgyKSwgYSA9IHQoMyksIG8gPSB0KDUpLCBzID0gdC5uKG8pLCBkID0gdCg3KSwgYyA9IHQoMTApLCBwID0gdC5uKGMpLCB1ID0gdCgxMSksIGwgPSB0Lm4odSksIG0gPSB0KDEpLCBiID0gdCgyMCksIGYgPSB0KDEyKSwgeSA9IHQubihmKSwgZyA9IHQoMTMpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gTyhlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFMoZSk7CiAgICAgICAgICAgICAgICAgICAgfShlKSB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIFN5bWJvbCAmJiBudWxsICE9IGVbU3ltYm9sLml0ZXJhdG9yXSB8fCBudWxsICE9IGVbJ0BAaXRlcmF0b3InXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5mcm9tKGUpOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgQShlKSB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ludmFsaWQgYXR0ZW1wdCB0byBzcHJlYWQgbm9uLWl0ZXJhYmxlIGluc3RhbmNlLlxuSW4gb3JkZXIgdG8gYmUgaXRlcmFibGUsIG5vbi1hcnJheSBvYmplY3RzIG11c3QgaGF2ZSBhIFtTeW1ib2wuaXRlcmF0b3JdKCkgbWV0aG9kLicpOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHYoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAodiA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgKGkgPSBpLmZpbHRlcihmdW5jdGlvbiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoZSwgcikuZW51bWVyYWJsZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCB0LnB1c2guYXBwbHkodCwgaSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSShlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IDE7IHIgPCBhcmd1bWVudHMubGVuZ3RoOyByKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9IGFyZ3VtZW50c1tyXSA/IGFyZ3VtZW50c1tyXSA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICByICUgMiA/IGgoT2JqZWN0KHQpLCAhMCkuZm9yRWFjaChmdW5jdGlvbiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaihlLCByLCB0W3JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGUsIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKHQpKSA6IGgoT2JqZWN0KHQpKS5mb3JFYWNoKGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgciwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LCByKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGooZSwgciwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiByIGluIGUgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgciwgewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pIDogZVtyXSA9IHQsIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB4KGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICd1bmRlZmluZWQnICE9IHR5cGVvZiBTeW1ib2wgJiYgZVtTeW1ib2wuaXRlcmF0b3JdIHx8IGVbJ0BAaXRlcmF0b3InXTsKICAgICAgICAgICAgICAgICAgICBpZiAoIXQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkgfHwgKHQgPSBBKGUpKSB8fCByICYmIGUgJiYgJ251bWJlcicgPT0gdHlwZW9mIGUubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIChlID0gdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IDAsIG4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID49IGUubGVuZ3RoID8geyBkb25lOiAhMCB9IDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZVtpKytdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZjogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbnZhbGlkIGF0dGVtcHQgdG8gaXRlcmF0ZSBub24taXRlcmFibGUgaW5zdGFuY2UuXG5JbiBvcmRlciB0byBiZSBpdGVyYWJsZSwgbm9uLWFycmF5IG9iamVjdHMgbXVzdCBoYXZlIGEgW1N5bWJvbC5pdGVyYXRvcl0oKSBtZXRob2QuJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciBhLCBvID0gITAsIHMgPSAhMTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICBzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gdC5jYWxsKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBuOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHQubmV4dCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gPSBlLmRvbmUsIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gITAsIGEgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBmOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gfHwgbnVsbCA9PSB0LnJldHVybiB8fCB0LnJldHVybigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBBKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUyhlLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoZSkuc2xpY2UoOCwgLTEpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ09iamVjdCcgPT09IHQgJiYgZS5jb25zdHJ1Y3RvciAmJiAodCA9IGUuY29uc3RydWN0b3IubmFtZSksICdNYXAnID09PSB0IHx8ICdTZXQnID09PSB0ID8gQXJyYXkuZnJvbShlKSA6ICdBcmd1bWVudHMnID09PSB0IHx8IC9eKD86VWl8SSludCg/Ojh8MTZ8MzIpKD86Q2xhbXBlZCk/QXJyYXkkLy50ZXN0KHQpID8gUyhlLCByKSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBTKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAobnVsbCA9PSByIHx8IHIgPiBlLmxlbmd0aCkgJiYgKHIgPSBlLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDAsIGkgPSBuZXcgQXJyYXkocik7IHQgPCByOyB0KyspCiAgICAgICAgICAgICAgICAgICAgICAgIGlbdF0gPSBlW3RdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIEUgPSAnaXgnLCB3ID0gJ3JvdW5kZWwnLCBfID0gWwogICAgICAgICAgICAgICAgICAgICAgICBuLmIsCiAgICAgICAgICAgICAgICAgICAgICAgIG4uZAogICAgICAgICAgICAgICAgICAgIF0sIEQgPSA4MDAwLCBQID0geyBKUFk6IDEgfSwgVCA9ICdwJywgQyA9ICd4JywgeiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgQklEX1NJWkVfSU5WQUxJRF9GT1JNQVQ6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgIEJJRF9TSVpFX05PVF9JTkNMVURFRDogMiwKICAgICAgICAgICAgICAgICAgICAgICAgUFJPUEVSVFlfTk9UX0lOQ0xVREVEOiAzLAogICAgICAgICAgICAgICAgICAgICAgICBTSVRFX0lEX0lOVkFMSURfVkFMVUU6IDQsCiAgICAgICAgICAgICAgICAgICAgICAgIEJJRF9GTE9PUl9JTlZBTElEX0ZPUk1BVDogNSwKICAgICAgICAgICAgICAgICAgICAgICAgSVhfRlBEX0VYQ0VFRFNfTUFYX1NJWkU6IDYsCiAgICAgICAgICAgICAgICAgICAgICAgIEVYQ0VFRFNfTUFYX1NJWkU6IDcsCiAgICAgICAgICAgICAgICAgICAgICAgIFBCX0ZQRF9FWENFRURTX01BWF9TSVpFOiA4LAogICAgICAgICAgICAgICAgICAgICAgICBWSURFT19EVVJBVElPTl9JTlZBTElEOiA5CiAgICAgICAgICAgICAgICAgICAgfSwgUiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgU0lURTogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICduYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdkb21haW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NhdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2VjdGlvbmNhdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGFnZWNhdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmVmJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZWFyY2gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ21vYmlsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJpdmFjeXBvbGljeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb250ZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdrZXl3b3JkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXh0JwogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBVU0VSOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2J1eWVydWlkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd5b2InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dlbmRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAna2V5d29yZHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2N1c3RvbWRhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dlbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXh0JwogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgfSwgTiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgJ2xpdmVyYW1wLmNvbSc6ICdpZGwnLAogICAgICAgICAgICAgICAgICAgICAgICAnbmV0aWQuZGUnOiAnTkVUSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAnbmV1c3Rhci5iaXonOiAnZmFicmlja0lkJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3plb3RhcC5jb20nOiAnemVvdGFwSWRQbHVzJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3VpZGFwaS5jb20nOiAnVUlEMicsCiAgICAgICAgICAgICAgICAgICAgICAgICdhZHNlcnZlci5vcmcnOiAnVERJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdpZDUtc3luYy5jb20nOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2Nyd2RjbnRybC5uZXQnOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2Vwc2lsb24uY29tJzogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICdhdWRpZ2VudC5jb20nOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3B1YmNpZC5vcmcnOiAnJwogICAgICAgICAgICAgICAgICAgIH0sIFggPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICdicml0ZXBvb2xpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdpZDVpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdsaXBiaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnaGFsb0lkJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NyaXRlb0lkJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xvdGFtZVBhbm9yYW1hSWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnbWVya2xlSWQnLAogICAgICAgICAgICAgICAgICAgICAgICAncGFycmFibGVJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdjb25uZWN0aWQnLAogICAgICAgICAgICAgICAgICAgICAgICAndGFwYWRJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdxdWFudGNhc3RJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdwdWJjaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnVERJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdmbG9jSWQnLAogICAgICAgICAgICAgICAgICAgICAgICAncHViUHJvdmlkZWRJZCcKICAgICAgICAgICAgICAgICAgICBdLCBrID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnbWltZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAnbWluZHVyYXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAnbWF4ZHVyYXRpb24nCiAgICAgICAgICAgICAgICAgICAgXSwgQiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ21pbWVzJywKICAgICAgICAgICAgICAgICAgICAgICAgJ21pbmR1cmF0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgJ21heGR1cmF0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3Byb3RvY29scycsCiAgICAgICAgICAgICAgICAgICAgICAgICdwcm90b2NvbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdzdGFydGRlbGF5JywKICAgICAgICAgICAgICAgICAgICAgICAgJ3BsYWNlbWVudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdsaW5lYXJpdHknLAogICAgICAgICAgICAgICAgICAgICAgICAnc2tpcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdza2lwbWluJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3NraXBhZnRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICdzZXF1ZW5jZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdiYXR0cicsCiAgICAgICAgICAgICAgICAgICAgICAgICdtYXhleHRlbmRlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdtaW5iaXRyYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ21heGJpdHJhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnYm94aW5nYWxsb3dlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdwbGF5YmFja21ldGhvZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdwbGF5YmFja2VuZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdkZWxpdmVyeScsCiAgICAgICAgICAgICAgICAgICAgICAgICdwb3MnLAogICAgICAgICAgICAgICAgICAgICAgICAnY29tcGFuaW9uYWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnYXBpJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbXBhbmlvbnR5cGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnZXh0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ3BsYXllclNpemUnLAogICAgICAgICAgICAgICAgICAgICAgICAndycsCiAgICAgICAgICAgICAgICAgICAgICAgICdoJwogICAgICAgICAgICAgICAgICAgIF0sIEYgPSAnaXhkaWFnJywgVSA9ICExLCBMID0gT2JqZWN0KGQuYikoMTAsIEUpLCBWID0gMjsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE0oZSkgewogICAgICAgICAgICAgICAgICAgIHZhciByID0ge307CiAgICAgICAgICAgICAgICAgICAgci5pZCA9IGUuYmlkSWQsIHIuZXh0ID0ge30sIHIuZXh0LnNpdGVJRCA9IGUucGFyYW1zLnNpdGVJZC50b1N0cmluZygpLCAhZS5wYXJhbXMuaGFzT3duUHJvcGVydHkoJ2lkJykgfHwgJ3N0cmluZycgIT0gdHlwZW9mIGUucGFyYW1zLmlkICYmICdudW1iZXInICE9IHR5cGVvZiBlLnBhcmFtcy5pZCB8fCAoci5leHQuc2lkID0gU3RyaW5nKGUucGFyYW1zLmlkKSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3QoaS5kZWVwQWNjZXNzKShlLCAnb3J0YjJJbXAuZXh0LmRhdGEuYWRzZXJ2ZXIuYWRzbG90Jyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgKHIuZXh0LmRmcF9hZF91bml0X2NvZGUgPSB0KSwgcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHEoZSwgciwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gbnVsbCwgYSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUucGFyYW1zLmJpZEZsb29yICYmIGUucGFyYW1zLmJpZEZsb29yQ3VyICYmIChuID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvb3I6IGUucGFyYW1zLmJpZEZsb29yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVuY3k6IGUucGFyYW1zLmJpZEZsb29yQ3VyCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QoaS5pc0ZuKShlLmdldEZsb29yKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9ICcqJywgcyA9ICcqJzsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgT2JqZWN0KGkuY29udGFpbnMpKF8sIHQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHJbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gdCwgcyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLncsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5oCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gZS5nZXRGbG9vcih7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFUeXBlOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6IHMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5sb2dXYXJuKSgncHJpY2VGbG9vcnMgbW9kdWxlIGNhbGwgZ2V0Rmxvb3IgZmFpbGVkLCBlcnJvciA6ICcsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGEgPyAoci5iaWRmbG9vciA9IGEuZmxvb3IsIHIuYmlkZmxvb3JjdXIgPSBhLmN1cnJlbmN5LCByLmV4dC5mbCA9IFQpIDogbiAmJiAoci5iaWRmbG9vciA9IG4uZmxvb3IsIHIuYmlkZmxvb3JjdXIgPSBuLmN1cnJlbmN5LCByLmV4dC5mbCA9IEMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSihlLCByLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7fSwgbyA9ICEoIU9iamVjdChpLmRlZXBBY2Nlc3MpKGUsICdleHAnKSB8fCAhT2JqZWN0KGkuaXNJbnRlZ2VyKShlLmV4cCkpLCBzID0gT2JqZWN0KGkuZGVlcEFjY2VzcykoZSwgJ2RlYWxpZCcpIHx8IE9iamVjdChpLmRlZXBBY2Nlc3MpKGUsICdleHQuZGVhbGlkJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFAuaGFzT3duUHJvcGVydHkocikgPyBhLmNwbSA9IGUucHJpY2UgLyBQW3JdIDogYS5jcG0gPSBlLnByaWNlIC8gMTAwLCBhLnJlcXVlc3RJZCA9IGUuaW1waWQsIHMgJiYgKGEuZGVhbElkID0gcyksIGEubmV0UmV2ZW51ZSA9IHRydWUsIGEuY3VycmVuY3kgPSByLCBhLmNyZWF0aXZlSWQgPSBlLmhhc093blByb3BlcnR5KCdjcmlkJykgPyBlLmNyaWQgOiAnLScsIGUubXR5cGUgPT0gViA/IGEudmFzdFhtbCA9IGUuYWRtIDogZS5leHQgJiYgZS5leHQudmFzdHVybCAmJiAoYS52YXN0VXJsID0gZS5leHQudmFzdHVybCksIGUuZXh0ICYmIGUuZXh0LnZhc3R1cmwgfHwgZS5tdHlwZSA9PSBWID8gKGEud2lkdGggPSB0LnZpZGVvLncsIGEuaGVpZ2h0ID0gdC52aWRlby5oLCBhLm1lZGlhVHlwZSA9IG4uZCwgYS5tZWRpYVR5cGVzID0gdC5tZWRpYVR5cGVzLCBhLnR0bCA9IG8gPyBlLmV4cCA6IDM2MDApIDogKGEuYWQgPSBlLmFkbSwgYS53aWR0aCA9IGUudywgYS5oZWlnaHQgPSBlLmgsIGEubWVkaWFUeXBlID0gbi5iLCBhLnR0bCA9IG8gPyBlLmV4cCA6IDMwMCksIGEubWV0YSA9IHt9LCBhLm1ldGEubmV0d29ya0lkID0gT2JqZWN0KGkuZGVlcEFjY2VzcykoZSwgJ2V4dC5kc3BpZCcpLCBhLm1ldGEuYnJhbmRJZCA9IE9iamVjdChpLmRlZXBBY2Nlc3MpKGUsICdleHQuYWR2YnJhbmRpZCcpLCBhLm1ldGEuYnJhbmROYW1lID0gT2JqZWN0KGkuZGVlcEFjY2VzcykoZSwgJ2V4dC5hZHZicmFuZCcpLCBlLmFkb21haW4gJiYgZS5hZG9tYWluLmxlbmd0aCA+IDAgJiYgKGEubWV0YS5hZHZlcnRpc2VyRG9tYWlucyA9IGUuYWRvbWFpbiksIGE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBaKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShlKSAmJiAyID09PSBlLmxlbmd0aCAmJiBPYmplY3QoaS5pc0ludGVnZXIpKGVbMF0pICYmIE9iamVjdChpLmlzSW50ZWdlcikoZVsxXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBXKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiBbXSwgciA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDogW107CiAgICAgICAgICAgICAgICAgICAgaWYgKFooZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlWzBdID09PSByWzBdICYmIGVbMV0gPT09IHJbMV07CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDA7IHQgPCBlLmxlbmd0aDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVt0XVswXSA9PT0gclswXSAmJiBlW3RdWzFdID09PSByWzFdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEcoZSwgcikgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgZSB8fCBPYmplY3QoaS5sb2dXYXJuKSgnSVggQmlkIEFkYXB0ZXI6IG1lZGlhVHlwZXMudmlkZW8gaXMgdGhlIHByZWZlcnJlZCBsb2NhdGlvbiBmb3IgdmlkZW8gcGFyYW1zIGluIGFkIHVuaXQnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgbiwgYSA9IHgoayk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChhLnMoKTsgIShuID0gYS5uKCkpLmRvbmU7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG4udmFsdWUsIHMgPSBlICYmIGUuaGFzT3duUHJvcGVydHkobyksIGQgPSByICYmIHIuaGFzT3duUHJvcGVydHkobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzIHx8IGQgfHwgdC5wdXNoKCdJWCBCaWQgQWRhcHRlcjogJy5jb25jYXQobywgJyBpcyBub3QgaW5jbHVkZWQgaW4gZWl0aGVyIHRoZSBhZHVuaXQgb3IgcGFyYW1zIGxldmVsJykpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBhLmUoZSk7CiAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgYS5mKCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciBjID0gZSAmJiBlLmhhc093blByb3BlcnR5KCdwcm90b2NvbCcpLCBwID0gZSAmJiBlLmhhc093blByb3BlcnR5KCdwcm90b2NvbHMnKSwgdSA9IHIgJiYgci5oYXNPd25Qcm9wZXJ0eSgncHJvdG9jb2wnKSwgbCA9IHIgJiYgci5oYXNPd25Qcm9wZXJ0eSgncHJvdG9jb2xzJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgfHwgcCB8fCB1IHx8IGwgfHwgdC5wdXNoKCdJWCBCaWQgQWRhcHRlcjogcHJvdG9jb2wvcHJvdGNvbHMgaXMgbm90IGluY2x1ZGVkIGluIGVpdGhlciB0aGUgYWR1bml0IG9yIHBhcmFtcyBsZXZlbCcpLCB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gWSgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDogW107CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFooZSkgPyBlIDogISFaKGVbMF0pICYmIGVbMF07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBRKGUsIHIsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEkoSSh7fSwgbCgpKHQsIGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5iaWRJZCA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBsKCkociwgZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmlkID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiAkKGUsIHIsIHQsIG8pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgcyA9ICdodHRwczovL2h0bGIuY2FzYWxlbWVkaWEuY29tL2N5Z251cycsIGQgPSBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXSwgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChpLmlzQXJyYXkpKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEsIG8gPSB4KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoby5zKCk7ICEoYSA9IG8ubigpKS5kb25lOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBhLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTi5oYXNPd25Qcm9wZXJ0eShzLnNvdXJjZSkgJiYgT2JqZWN0KGkuZGVlcEFjY2VzcykocywgJ3VpZHMuMCcpICYmIChuW3Muc291cmNlXSA9ICEwLCAnJyAhPSBOW3Muc291cmNlXSAmJiAocy51aWRzWzBdLmV4dCA9IHsgcnRpUGFydG5lcjogTltzLnNvdXJjZV0gfSksIGRlbGV0ZSBzLnVpZHNbMF0uYXR5cGUsIHQucHVzaChzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLmYoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociAmJiByLmlkICYmIHIudmVyc2lvbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdjaHJvbWUuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWlkczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogci5pZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnRpUGFydG5lcjogJ2Zsb2NJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcjogci52ZXJzaW9uCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChkKSwgblsnY2hyb21lLmNvbSddID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvU2VuZDogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWVuU291cmNlczogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfShPYmplY3QoaS5kZWVwQWNjZXNzKShlLCAnMC51c2VySWRBc0VpZHMnKSwgT2JqZWN0KGkuZGVlcEFjY2VzcykoZSwgJzAudXNlcklkLmZsb2NJZCcpKSwgYyA9IGQudG9TZW5kOwogICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuaGVhZGVydGFnICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIHdpbmRvdy5oZWFkZXJ0YWcuZ2V0SWRlbnRpdHlJbmZvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gd2luZG93LmhlYWRlcnRhZy5nZXRJZGVudGl0eUluZm8oKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHAgJiYgJ29iamVjdCcgPT09IHYocCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB1IGluIHApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHAuaGFzT3duUHJvcGVydHkodSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBwW3VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhbC5yZXNwb25zZVBlbmRpbmcgJiYgbC5kYXRhICYmICdvYmplY3QnID09PSB2KGwuZGF0YSkgJiYgT2JqZWN0LmtleXMobC5kYXRhKS5sZW5ndGggJiYgIWQuc2VlblNvdXJjZXNbbC5kYXRhLnNvdXJjZV0gJiYgYy5wdXNoKGwuZGF0YSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAociAmJiByLmJpZGRlckNvZGUgPT09IHcgJiYgIWQuc2VlblNvdXJjZXNbJ2xpdmVyYW1wLmNvbSddKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSB7fTsKICAgICAgICAgICAgICAgICAgICBtLmlkID0gZVswXS5iaWRkZXJSZXF1ZXN0SWQudG9TdHJpbmcoKSwgbS5zaXRlID0ge30sIG0uZXh0ID0ge30sIG0uZXh0LnNvdXJjZSA9ICdwcmViaWQnLCBtLmV4dC5peGRpYWcgPSB7fSwgbS5leHQuaXhkaWFnLm1zZCA9IDAsIG0uZXh0Lml4ZGlhZy5tc2kgPSAwLCBtLmltcCA9IFtdLCBtLmF0ID0gMTsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSBlLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS50cmFuc2FjdGlvbklkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZpbHRlcihmdW5jdGlvbiAoZSwgciwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5pbmRleE9mKGUpID09PSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZnU6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1OiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdTogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnU6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91OiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGx1OiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW46ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiAnNi42LjAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VySWRzOiBIKGVbMF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA9IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvID0gZS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS50cmFuc2FjdGlvbklkID09PSByW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlbMF0sIE9iamVjdChpLmRlZXBBY2Nlc3MpKG8sICdtZWRpYVR5cGVzJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3Qua2V5cyhvLm1lZGlhVHlwZXMpLmxlbmd0aCA+IDEgJiYgdC5tZnUrKywgT2JqZWN0KGkuZGVlcEFjY2VzcykobywgJ21lZGlhVHlwZXMubmF0aXZlJykgJiYgdC5udSsrLCBPYmplY3QoaS5kZWVwQWNjZXNzKShvLCAnbWVkaWFUeXBlcy5iYW5uZXInKSAmJiB0LmJ1KyssICdvdXRzdHJlYW0nID09PSBPYmplY3QoaS5kZWVwQWNjZXNzKShvLCAnbWVkaWFUeXBlcy52aWRlby5jb250ZXh0JykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm91Kys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAnb2JqZWN0JyA9PT0gdihPYmplY3QoaS5kZWVwQWNjZXNzKShvLCAncmVuZGVyZXInKSB8fCBPYmplY3QoaS5kZWVwQWNjZXNzKShvLCAnbWVkaWFUeXBlcy52aWRlby5yZW5kZXJlcicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnJlbiA9IHQucmVuICYmIGEgPyBPYmplY3QoaS5kZWVwQWNjZXNzKSh0LCAncmVuJykgOiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2luc3RyZWFtJyA9PT0gT2JqZWN0KGkuZGVlcEFjY2VzcykobywgJ21lZGlhVHlwZXMudmlkZW8uY29udGV4dCcpICYmIHQuaXUrKywgdC5hbGx1Kys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhID0gMDsgYSA8IHIubGVuZ3RoOyBhKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbihhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICB9KGUpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgaW4gYikKICAgICAgICAgICAgICAgICAgICAgICAgbS5leHQuaXhkaWFnW2ZdID0gYltmXTsKICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFMLmxvY2FsU3RvcmFnZUlzRW5hYmxlZCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSwgciA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IEpTT04ucGFyc2UoTC5nZXREYXRhRnJvbUxvY2FsU3RvcmFnZShGKSB8fCAne30nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChpLmxvZ0Vycm9yKSgnaXggY2FuIG5vdCByZWFkIGl4ZGlhZyBmcm9tIGxvY2FsU3RvcmFnZS4nKSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoZVt0XSkuZm9yRWFjaChmdW5jdGlvbiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdudW1iZXInID09IHR5cGVvZiBlW3RdW2ldICYmIChyW2ldID0gcltpXSA/IHJbaV0gKyBlW3RdW2ldIDogZVt0XVtpXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHI7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QoaS5pc0VtcHR5KSh5KSB8fCAobS5leHQuaXhkaWFnLmVyciA9IHkpLCBlWzBdLnNjaGFpbiAmJiAobS5zb3VyY2UgPSB7IGV4dDogeyBzY2hhaW46IGVbMF0uc2NoYWluIH0gfSksIGMubGVuZ3RoID4gMCAmJiAobS51c2VyID0ge30sIG0udXNlci5laWRzID0gYyksIGRvY3VtZW50LnJlZmVycmVyICYmICcnICE9PSBkb2N1bWVudC5yZWZlcnJlciAmJiAobS5zaXRlLnJlZiA9IGRvY3VtZW50LnJlZmVycmVyKSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5nZHByQ29uc2VudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSByLmdkcHJDb25zZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5oYXNPd25Qcm9wZXJ0eSgnZ2RwckFwcGxpZXMnKSAmJiAobS5yZWdzID0geyBleHQ6IHsgZ2RwcjogZy5nZHByQXBwbGllcyA/IDEgOiAwIH0gfSksIGcuaGFzT3duUHJvcGVydHkoJ2NvbnNlbnRTdHJpbmcnKSAmJiAobS51c2VyID0gbS51c2VyIHx8IHt9LCBtLnVzZXIuZXh0ID0geyBjb25zZW50OiBnLmNvbnNlbnRTdHJpbmcgfHwgJycgfSwgZy5oYXNPd25Qcm9wZXJ0eSgnYWRkdGxDb25zZW50JykgJiYgZy5hZGR0bENvbnNlbnQgJiYgKG0udXNlci5leHQuY29uc2VudGVkX3Byb3ZpZGVyc19zZXR0aW5ncyA9IHsgY29uc2VudGVkX3Byb3ZpZGVyczogZy5hZGR0bENvbnNlbnQgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHIudXNwQ29uc2VudCAmJiBPYmplY3QoaS5kZWVwU2V0VmFsdWUpKG0sICdyZWdzLmV4dC51c19wcml2YWN5Jywgci51c3BDb25zZW50KSwgci5yZWZlcmVySW5mbyAmJiAobS5zaXRlLnBhZ2UgPSByLnJlZmVyZXJJbmZvLnJlZmVyZXIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBhLmIuZ2V0Q29uZmlnKCdjb3BwYScpICYmIE9iamVjdChpLmRlZXBTZXRWYWx1ZSkobSwgJ3JlZ3MuY29wcGEnLCAxKTsKICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IHt9OwogICAgICAgICAgICAgICAgICAgIGgucyA9IGVbMF0ucGFyYW1zLnNpdGVJZCwgaC52ID0gbywgaC5hYyA9ICdqJywgaC5zZCA9IDEsIDguMSA9PT0gbyAmJiAoaC5uZiA9IDEpOwogICAgICAgICAgICAgICAgICAgIHZhciBqID0gciAmJiByLmJpZGRlckNvZGUgfHwgJ2l4JywgQSA9IGEuYi5nZXRDb25maWcoaiksIFMgPSBbXSwgXyA9IDAsIFAgPSBPYmplY3Qua2V5cyh0KSwgVCA9ICcnLmNvbmNhdChzKS5jb25jYXQoT2JqZWN0KGkucGFyc2VRdWVyeVN0cmluZ1BhcmFtZXRlcnMpKEkoSSh7fSwgaCksIHt9LCB7IHI6IEpTT04uc3RyaW5naWZ5KG0pIH0pKSkubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIGlmIChUID4gRCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChpLmxvZ0Vycm9yKSgnSVggQmlkIEFkYXB0ZXI6IEJhc2UgcmVxdWVzdCBzaXplIGhhcyBleGNlZWRlZCBtYXhpbXVtIHJlcXVlc3Qgc2l6ZS4nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXI6IEUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiB6LkVYQ0VFRFNfTUFYX1NJWkUKICAgICAgICAgICAgICAgICAgICAgICAgfSksIFM7CiAgICAgICAgICAgICAgICAgICAgdmFyIEMgPSBULCBYID0gMCwgayA9ICExOwogICAgICAgICAgICAgICAgICAgIGlmIChBKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gdihBLmZpcnN0UGFydHlEYXRhKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEIgPSBBLmZpcnN0UGFydHlEYXRhLCBVID0gJz8nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgViBpbiBCKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEIuaGFzT3duUHJvcGVydHkoVikgJiYgKFUgKz0gJycuY29uY2F0KGVuY29kZVVSSUNvbXBvbmVudChWKSwgJz0nKS5jb25jYXQoZW5jb2RlVVJJQ29tcG9uZW50KEJbVl0pLCAnJicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFUgPSBVLnNsaWNlKDAsIC0xKSwgKFggPSBlbmNvZGVVUklDb21wb25lbnQoVSkubGVuZ3RoKSA8IEQgPyAoJ3BhZ2UnIGluIG0uc2l0ZSA/IG0uc2l0ZS5wYWdlICs9IFUgOiBtLnNpdGUucGFnZSA9IFUsIEMgKz0gWCkgOiBPYmplY3QoaS5sb2dFcnJvcikoJ0lYIEJpZCBBZGFwdGVyOiBJWCBjb25maWcgRlBEIHJlcXVlc3Qgc2l6ZSBoYXMgZXhjZWVkZWQgbWF4aW11bSByZXF1ZXN0IHNpemUuJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlcjogRSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiB6LklYX0ZQRF9FWENFRURTX01BWF9TSVpFCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAnbnVtYmVyJyA9PSB0eXBlb2YgQS50aW1lb3V0ICYmIChoLnQgPSBBLnRpbWVvdXQpLCAnYm9vbGVhbicgPT0gdHlwZW9mIEEuZGV0ZWN0TWlzc2luZ1NpemVzID8gbS5leHQuaXhkaWFnLmRtcyA9IEEuZGV0ZWN0TWlzc2luZ1NpemVzIDogbS5leHQuaXhkaWFnLmRtcyA9ICEwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBNID0gZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQyA+PSBEIHx8IFMubGVuZ3RoID49IDQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYnJlYWsnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gPSB0W1Bbcl1dLCBkID0gby5taXNzaW5nQ291bnQsIGMgPSB2b2lkIDAgPT09IGQgPyAwIDogZCwgcCA9IG8ubWlzc2luZ0ltcHMsIHUgPSB2b2lkIDAgPT09IHAgPyBbXSA6IHAsIGwgPSBvLml4SW1wcywgYiA9ICExLCBmID0gRCAtIEMsIHkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXhJbXBzOiB2b2lkIDAgPT09IGwgPyBbXSA6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlzc2luZ0Jhbm5lckltcHJlc3Npb25zOiB1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBnID0gT2JqZWN0LmtleXMoeSkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHlbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZShmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNvbmNhdC5hcHBseShlLCBPKHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtdKSwgdiA9IGVuY29kZVVSSUNvbXBvbmVudChKU09OLnN0cmluZ2lmeSh7IGltcHJlc3Npb25PYmplY3RzOiBnIH0pKS5sZW5ndGg7IGcubGVuZ3RoICYmIHYgPiBmOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9ICEwLCBnLnBvcCgpLCB2ID0gZW5jb2RlVVJJQ29tcG9uZW50KEpTT04uc3RyaW5naWZ5KHsgaW1wcmVzc2lvbk9iamVjdHM6IGcgfSkpLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZy5sZW5ndGggJiYgbi5iIGluIGdbMF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGogPSBnWzBdLCB4ID0gai5pZCwgQSA9IGouYmFubmVyLnRvcGZyYW1lLCB3ID0gai5leHQsIE4gPSB0W1Bbcl1dLmdwaWQsIFggPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFubmVyOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvcGZyYW1lOiBBLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JtYXQ6IGcubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuYmFubmVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3OiByLncsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaDogci5oLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dDogZS5leHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHcuZGZwX2FkX3VuaXRfY29kZSB8fCBOKSAmJiAoWC5leHQgPSB7fSwgWC5leHQuZGZwX2FkX3VuaXRfY29kZSA9IHcuZGZwX2FkX3VuaXRfY29kZSwgWC5leHQuZ3BpZCA9IE4pLCAnYmlkZmxvb3InIGluIGdbMF0gJiYgKFguYmlkZmxvb3IgPSBnWzBdLmJpZGZsb29yKSwgJ2JpZGZsb29yY3VyJyBpbiBnWzBdICYmIChYLmJpZGZsb29yY3VyID0gZ1swXS5iaWRmbG9vcmN1ciksIG0uaW1wLnB1c2goWCksIG0uZXh0Lml4ZGlhZy5tc2QgKz0gYywgbS5leHQuaXhkaWFnLm1zaSArPSB1Lmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgQjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEIgPSBtLmltcCkucHVzaC5hcHBseShCLCBPKGcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQyArPSB2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBGID0gYS5iLmdldENvbmZpZygnb3J0YjInKSB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIU9iamVjdChpLmlzRW1wdHkpKEYpICYmICFrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0uZXh0Lml4ZGlhZy5mcGQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFUgPSBJKHt9LCBGLnNpdGUgfHwgRi5jb250ZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoVSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEgPT09IFIuU0lURS5pbmRleE9mKGUpICYmIGRlbGV0ZSBVW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEwgPSBJKHt9LCBGLnVzZXIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhMKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMSA9PT0gUi5VU0VSLmluZGV4T2YoZSkgJiYgZGVsZXRlIExbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgViA9IE9iamVjdChpLmRlZXBDbG9uZSkobSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChWLnNpdGUgPSBPYmplY3QoaS5tZXJnZURlZXApKHt9LCBWLnNpdGUsIFUpLCBWLnVzZXIgPSBPYmplY3QoaS5tZXJnZURlZXApKHt9LCBWLnVzZXIsIEwpLCAnJy5jb25jYXQocykuY29uY2F0KE9iamVjdChpLnBhcnNlUXVlcnlTdHJpbmdQYXJhbWV0ZXJzKShJKEkoe30sIGgpLCB7fSwgeyByOiBKU09OLnN0cmluZ2lmeShWKSB9KSkpLmxlbmd0aCA8IEQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0uc2l0ZSA9IE9iamVjdChpLm1lcmdlRGVlcCkoe30sIG0uc2l0ZSwgVSksIG0udXNlciA9IE9iamVjdChpLm1lcmdlRGVlcCkoe30sIG0udXNlciwgTCksIGsgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBNID0gZW5jb2RlVVJJQ29tcG9uZW50KEpTT04uc3RyaW5naWZ5KEkoSSh7fSwgVSksIEwpKSkubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQyArPSBNOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChpLmxvZ0Vycm9yKSgnSVggQmlkIEFkYXB0ZXI6IEZQRCByZXF1ZXN0IHNpemUgaGFzIGV4Y2VlZGVkIG1heGltdW0gcmVxdWVzdCBzaXplLicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXI6IEUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTogei5QQl9GUERfRVhDRUVEU19NQVhfU0laRQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBxID0gciA9PT0gUC5sZW5ndGggLSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiIHx8IHEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEogPSBPYmplY3QoaS5kZWVwQ2xvbmUpKGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxICYmICFfIHx8IChtLmV4dC5peGRpYWcuc24gPSBfLCBKLnNuID0gXyksIF8rKywgSi5yID0gSlNPTi5zdHJpbmdpZnkobSksIFMucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdHRVQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogSiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbGlkQmlkUmVxdWVzdHM6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIEMgPSBULCBtLmltcCA9IFtdLCBtLmV4dC5peGRpYWcubXNkID0gMCwgbS5leHQuaXhkaWFnLm1zaSA9IDAsIGsgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBxID0gMDsgcSA8IFAubGVuZ3RoOyBxKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdicmVhaycgPT09IE0ocSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBIKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUudXNlcklkIHx8IHt9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBYLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcltlXTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEsoZSwgcikgewogICAgICAgICAgICAgICAgICAgIGlmIChyKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMDsgdCA8IGUubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyWzBdID09PSBpWzBdICYmIHJbMV0gPT09IGlbMV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNwbGljZSh0LCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZWUoZSwgcikgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBNKGUpLCB0ID0gT2JqZWN0KGkuZGVlcEFjY2VzcykoZSwgJ21lZGlhVHlwZXMudmlkZW8nKSwgYSA9IE9iamVjdChpLmRlZXBBY2Nlc3MpKGUsICdwYXJhbXMudmlkZW8nKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEcodCwgYSkubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHt9OwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvIGluIChyLnZpZGVvID0gYSA/IE9iamVjdChpLmRlZXBDbG9uZSkoZS5wYXJhbXMudmlkZW8pIDoge30sIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEgPT09IEIuaW5kZXhPZihvKSB8fCByLnZpZGVvLmhhc093blByb3BlcnR5KG8pIHx8IChyLnZpZGVvW29dID0gdFtvXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLnZpZGVvLm1pbmR1cmF0aW9uID4gci52aWRlby5tYXhkdXJhdGlvbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoaS5sb2dFcnJvcikoJ0lYIEJpZCBBZGFwdGVyOiB2aWRlbyBtaW5kdXJhdGlvbiBbJy5jb25jYXQoci52aWRlby5taW5kdXJhdGlvbiwgJ10gY2Fubm90IGJlIGdyZWF0ZXIgdGhhbiB2aWRlbyBtYXhkdXJhdGlvbiBbJykuY29uY2F0KHIudmlkZW8ubWF4ZHVyYXRpb24sICddJyksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXI6IEUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTogei5WSURFT19EVVJBVElPTl9JTlZBTElECiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwge307CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gYSAmJiBhLmNvbnRleHQgfHwgdCAmJiB0LmNvbnRleHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzICYmICFyLnZpZGVvLmhhc093blByb3BlcnR5KCdwbGFjZW1lbnQnKSAmJiAocyA9PT0gYi5hID8gci52aWRlby5wbGFjZW1lbnQgPSAxIDogcyA9PT0gYi5iID8gci52aWRlby5wbGFjZW1lbnQgPSA0IDogT2JqZWN0KGkubG9nV2FybikoJ0lYIEJpZCBBZGFwdGVyOiBWaWRlbyBjb250ZXh0IFwnJy5jb25jYXQocywgJ1wnIGlzIG5vdCBzdXBwb3J0ZWQnKSkpLCAhci52aWRlby53IHx8ICFyLnZpZGVvLmgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gWShPYmplY3QoaS5kZWVwQWNjZXNzKShyLCAndmlkZW8ucGxheWVyU2l6ZScpKSB8fCBZKE9iamVjdChpLmRlZXBBY2Nlc3MpKGUsICdwYXJhbXMuc2l6ZScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGkubG9nV2FybikoJ0lYIEJpZCBBZGFwdGVyOiBWaWRlbyBzaXplIGlzIG1pc3NpbmcgaW4gW21lZGlhVHlwZXMudmlkZW9dIG1pc3NpbmcnKSwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnZpZGVvLncgPSBkWzBdLCByLnZpZGVvLmggPSBkWzFdLCBPYmplY3QoaS5kZWVwQWNjZXNzKShyLCAnZXh0LnNpZCcpIHx8IChyLmV4dC5zaWQgPSBPYmplY3QoaS5wYXJzZUdQVFNpbmdsZVNpemVBcnJheSkoZCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxKGUsIHIsIG4uZCksIHI7CiAgICAgICAgICAgICAgICAgICAgfShlKTsKICAgICAgICAgICAgICAgICAgICAwICE9IE9iamVjdC5rZXlzKHQpLmxlbmd0aCAmJiAocltlLnRyYW5zYWN0aW9uSWRdID0ge30sIHJbZS50cmFuc2FjdGlvbklkXS5peEltcHMgPSBbXSwgcltlLnRyYW5zYWN0aW9uSWRdLml4SW1wcy5wdXNoKHQpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJlKGUsIHIsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IEkoSSh7fSwgeyBkZXRlY3RNaXNzaW5nU2l6ZXM6ICEwIH0pLCBhLmIuZ2V0Q29uZmlnKCdpeCcpKSwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE0oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmJhbm5lciA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3QoaS5kZWVwQWNjZXNzKShlLCAncGFyYW1zLnNpemUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIChyLmJhbm5lci53ID0gdFswXSwgci5iYW5uZXIuaCA9IHRbMV0sIE9iamVjdChpLmRlZXBBY2Nlc3MpKHIsICdleHQuc2lkJykgfHwgKHIuZXh0LnNpZCA9IE9iamVjdChpLnBhcnNlR1BUU2luZ2xlU2l6ZUFycmF5KSh0KSkpLCByLmJhbm5lci50b3BmcmFtZSA9IE9iamVjdChpLmluSWZyYW1lKSgpID8gMCA6IDEsIHEoZSwgciwgbi5iKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgfShlKTsKICAgICAgICAgICAgICAgICAgICBXKE9iamVjdChpLmRlZXBBY2Nlc3MpKGUsICdtZWRpYVR5cGVzLmJhbm5lci5zaXplcycpLCBPYmplY3QoaS5kZWVwQWNjZXNzKShlLCAncGFyYW1zLnNpemUnKSkgJiYgKHQuaGFzT3duUHJvcGVydHkoZS50cmFuc2FjdGlvbklkKSB8fCAodFtlLnRyYW5zYWN0aW9uSWRdID0ge30pLCB0W2UudHJhbnNhY3Rpb25JZF0uaGFzT3duUHJvcGVydHkoJ2l4SW1wcycpIHx8ICh0W2UudHJhbnNhY3Rpb25JZF0uaXhJbXBzID0gW10pLCB0W2UudHJhbnNhY3Rpb25JZF0uaXhJbXBzLnB1c2gocyksIHRbZS50cmFuc2FjdGlvbklkXS5ncGlkID0gT2JqZWN0KGkuZGVlcEFjY2VzcykoZSwgJ29ydGIySW1wLmV4dC5ncGlkJykpLCBvLmhhc093blByb3BlcnR5KCdkZXRlY3RNaXNzaW5nU2l6ZXMnKSAmJiBvLmRldGVjdE1pc3NpbmdTaXplcyAmJiBmdW5jdGlvbiAoZSwgciwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUudHJhbnNhY3Rpb25JZDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIuaGFzT3duUHJvcGVydHkobikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByW25dLmhhc093blByb3BlcnR5KCdtaXNzaW5nU2l6ZXMnKSAmJiAoYSA9IHJbbl0ubWlzc2luZ1NpemVzKSwgSyhhLCBlLnBhcmFtcy5zaXplKSwgcltuXS5taXNzaW5nU2l6ZXMgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKE9iamVjdChpLmRlZXBBY2Nlc3MpKGUsICdtZWRpYVR5cGVzLmJhbm5lci5zaXplcycpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IE9iamVjdChpLmRlZXBDbG9uZSkoZS5tZWRpYVR5cGVzLmJhbm5lci5zaXplcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBLKG8sIGUucGFyYW1zLnNpemUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlzc2luZ1NpemVzOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltcHJlc3Npb246IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByW25dID0gczsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oZSwgciwgcyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB0ZShlLCByLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBPYmplY3QoaS5kZWVwQ2xvbmUpKHIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmV4dC5zaWQgPSBPYmplY3QoaS5wYXJzZUdQVFNpbmdsZVNpemVBcnJheSkodCksIGEuYmFubmVyLncgPSB0WzBdLCBhLmJhbm5lci5oID0gdFsxXSwgcShlLCBhLCBuLmIpLCBhOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaWUoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICgnRVJST1InID09PSBlLnR5cGUgJiYgZS5hcmd1bWVudHMgJiYgZS5hcmd1bWVudHNbMV0gJiYgZS5hcmd1bWVudHNbMV0uYmlkZGVyID09PSBFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzRW5mb3JjZW1lbnRIb29rOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbGlkOiBPYmplY3QoaS5oYXNEZXZpY2VBY2Nlc3MpKCkKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGQuZCkoMTAsIEUsIHIsIGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnZhbGlkICYmIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEwubG9jYWxTdG9yYWdlSXNFbmFibGVkKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gSlNPTi5wYXJzZShMLmdldERhdGFGcm9tTG9jYWxTdG9yYWdlKEYpIHx8ICd7fScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5sb2dXYXJuKSgnaXggY2FuIG5vdCByZWFkIGl4ZGlhZyBmcm9tIGxvY2FsU3RvcmFnZS4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG5ldyBEYXRlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3Qua2V5cyhyKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG5ldyBEYXRlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuc2V0RGF0ZShpLmdldERhdGUoKSArIDcpIC0gdCA8IDAgJiYgZGVsZXRlIHJbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgJ0VSUk9SJyA9PT0gZS50eXBlICYmIGUuYXJndW1lbnRzICYmIGUuYXJndW1lbnRzWzFdICYmIGUuYXJndW1lbnRzWzFdLmJpZGRlciA9PT0gRSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LnRvSVNPU3RyaW5nKCkuc2xpY2UoMCwgMTApLCBhID0gZS5hcmd1bWVudHNbMV0uY29kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgJiYgKHJbbl0gPSByW25dIHx8IHt9LCBOdW1iZXIocltuXVthXSkgfHwgKHJbbl1bYV0gPSAwKSwgcltuXVthXSsrKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMLnNldERhdGFJbkxvY2FsU3RvcmFnZShGLCBKU09OLnN0cmluZ2lmeShyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbmUoZSkgewogICAgICAgICAgICAgICAgICAgIGUucmVuZGVyZXIucHVzaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IGUud2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IGUuaGVpZ2h0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dDogMzAwMAogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBlLnZhc3RYbWwgPyB3aW5kb3cuSVhPdXRzdHJlYW1QbGF5ZXIoZS52YXN0WG1sLCBlLmFkVW5pdENvZGUsIHIpIDogd2luZG93LklYT3V0c3RyZWFtUGxheWVyKGUudmFzdFVybCwgZS5hZFVuaXRDb2RlLCByKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGFlKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGcuYS5pbnN0YWxsKHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vanMtc2VjLmluZGV4d3cuY29tL2h0di92aWRlby1wbGF5ZXIuanMnLAogICAgICAgICAgICAgICAgICAgICAgICBsb2FkZWQ6ICExCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgci5zZXRSZW5kZXIobmUpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGkubG9nV2FybikoJ1ByZWJpZCBFcnJvciBjYWxsaW5nIHNldFJlbmRlciBvbiByZW5kZXJlcicsIGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBvZSA9IHsKICAgICAgICAgICAgICAgICAgICBjb2RlOiBFLAogICAgICAgICAgICAgICAgICAgIGd2bGlkOiAxMCwKICAgICAgICAgICAgICAgICAgICBhbGlhc2VzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTogdywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd2bGlkOiAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNraXBQYnNBbGlhc2luZzogITEKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgc3VwcG9ydGVkTWVkaWFUeXBlczogXywKICAgICAgICAgICAgICAgICAgICBpc0JpZFJlcXVlc3RWYWxpZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgVSB8fCAocC5hLm9uKHMuYS5FVkVOVFMuQVVDVElPTl9ERUJVRywgaWUpLCBwLmEub24ocy5hLkVWRU5UUy5BRF9SRU5ERVJfRkFJTEVELCBpZSksIFUgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCB0LCBuID0gT2JqZWN0KGkuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy52aWRlbycpLCBhID0gT2JqZWN0KGkuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy5zaXplJyksIG8gPSBPYmplY3QoaS5kZWVwQWNjZXNzKShlLCAnbWVkaWFUeXBlcy5iYW5uZXIuc2l6ZXMnKSwgZCA9IE9iamVjdChpLmRlZXBBY2Nlc3MpKGUsICdtZWRpYVR5cGVzLnZpZGVvJyksIGMgPSBPYmplY3QoaS5kZWVwQWNjZXNzKShlLCAnbWVkaWFUeXBlcy52aWRlby5wbGF5ZXJTaXplJyksIHUgPSBlLnBhcmFtcy5oYXNPd25Qcm9wZXJ0eSgnYmlkRmxvb3InKSwgbCA9IGUucGFyYW1zLmhhc093blByb3BlcnR5KCdiaWRGbG9vckN1cicpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5oYXNPd25Qcm9wZXJ0eSgnbWVkaWFUeXBlJykgJiYgIU9iamVjdChpLmNvbnRhaW5zKShfLCBlLm1lZGlhVHlwZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGkubG9nV2FybikoJ0lYIEJpZCBBZGFwdGVyOiBtZWRpYSB0eXBlIGlzIG5vdCBzdXBwb3J0ZWQuJyksICExOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0KGkuZGVlcEFjY2VzcykoZSwgJ21lZGlhVHlwZXMuYmFubmVyJykgJiYgIW8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IFkoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChpLmxvZ0Vycm9yKSgnSVggQmlkIEFkYXB0ZXI6IHNpemUgaGFzIGludmFsaWQgZm9ybWF0LicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZGVyOiBFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiB6LkJJRF9TSVpFX0lOVkFMSURfRk9STUFUCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFXKGUuc2l6ZXMsIG0pICYmICFXKGMsIG0pICYmICFXKG8sIG0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoaS5sb2dFcnJvcikoJ0lYIEJpZCBBZGFwdGVyOiBiaWQgc2l6ZSBpcyBub3QgaW5jbHVkZWQgaW4gYWQgdW5pdCBzaXplcyBvciBwbGF5ZXIgc2l6ZS4nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlcjogRSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTogei5CSURfU0laRV9OT1RfSU5DTFVERUQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9IHR5cGVvZiBlLnBhcmFtcy5zaXRlSWQgJiYgJ251bWJlcicgIT0gdHlwZW9mIGUucGFyYW1zLnNpdGVJZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoaS5sb2dFcnJvcikoJ0lYIEJpZCBBZGFwdGVyOiBzaXRlSWQgbXVzdCBiZSBzdHJpbmcgb3IgbnVtYmVyIHR5cGUuJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlcjogRSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiB6LlNJVEVfSURfSU5WQUxJRF9WQUxVRQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksICExOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT0gdHlwZW9mIGUucGFyYW1zLnNpdGVJZCAmJiBpc05hTihOdW1iZXIoZS5wYXJhbXMuc2l0ZUlkKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGkubG9nRXJyb3IpKCdJWCBCaWQgQWRhcHRlcjogc2l0ZUlkIG11c3QgdmFsaWQgdmFsdWUnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZGVyOiBFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6IHouU0lURV9JRF9JTlZBTElEX1ZBTFVFCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgodSB8fCBsKSAmJiAhKHUgJiYgbCAmJiAociA9IGUucGFyYW1zLmJpZEZsb29yLCB0ID0gZS5wYXJhbXMuYmlkRmxvb3JDdXIsIEJvb2xlYW4oJ251bWJlcicgPT0gdHlwZW9mIHIgJiYgJ3N0cmluZycgPT0gdHlwZW9mIHQgJiYgdC5tYXRjaCgvXltBLVpdezN9JC8pKSkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChpLmxvZ0Vycm9yKSgnSVggQmlkIEFkYXB0ZXI6IGJpZEZsb29yIC8gYmlkRmxvb3JDdXIgcGFyYW1ldGVyIGhhcyBpbnZhbGlkIGZvcm1hdC4nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZGVyOiBFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6IHouQklEX0ZMT09SX0lOVkFMSURfRk9STUFUCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkICYmIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gRyhkLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChpLmxvZ0Vycm9yKShlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaWRkZXI6IEUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiB6LlBST1BFUlRZX05PVF9JTkNMVURFRAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgYnVpbGRSZXF1ZXN0czogZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXSwgYSA9IHt9LCBvID0ge30sIHMgPSB7fSwgZCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjIGluIChlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdC5rZXlzKE9iamVjdChpLmRlZXBBY2Nlc3MpKGUsICdtZWRpYVR5cGVzJywge30pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGkuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy52aWRlbycpICYmIE9iamVjdChpLmRlZXBBY2Nlc3MpKGUsICdtZWRpYVR5cGVzLnZpZGVvJykgPyBuLmQgOiBuLmI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG4uYjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmUoZSwgZCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugbi5kOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlZShlLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeSgpKHIsIG4uYikgJiYgeSgpKHIsIG4uZCkgJiYgKHNbZS50cmFuc2FjdGlvbklkXSA9IGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5rZXlzKHMpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHNbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtlXSB8fCByZShyLCBkLCBhKSwgb1tlXSB8fCBlZShyLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBkKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkLmhhc093blByb3BlcnR5KGMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBkW2NdLm1pc3NpbmdTaXplczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmhhc093blByb3BlcnR5KGMpIHx8IChhW2NdID0ge30pLCBhW2NdLmhhc093blByb3BlcnR5KCdtaXNzaW5nSW1wcycpIHx8IChhW2NdLm1pc3NpbmdJbXBzID0gW10sIGFbY10ubWlzc2luZ0NvdW50ID0gMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdSA9IGRbY10uaW1wcmVzc2lvbiwgbCA9IDA7IGwgPCBwLmxlbmd0aDsgbCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gdGUoZVswXSwgdSwgcFtsXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbY10ubWlzc2luZ0ltcHMucHVzaChtKSwgYVtjXS5taXNzaW5nQ291bnQrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhhKS5sZW5ndGggPiAwICYmIHQucHVzaC5hcHBseSh0LCBPKCQoZSwgciwgYSwgNy4yKSkpLCBPYmplY3Qua2V5cyhvKS5sZW5ndGggPiAwICYmIHQucHVzaC5hcHBseSh0LCBPKCQoZSwgciwgbywgOC4xKSkpLCB0OwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaW50ZXJwcmV0UmVzcG9uc2U6IGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW10sIG4gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUuaGFzT3duUHJvcGVydHkoJ2JvZHknKSB8fCAhZS5ib2R5Lmhhc093blByb3BlcnR5KCdzZWF0YmlkJykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IGUuYm9keSwgbyA9IGEuc2VhdGJpZCwgcyA9IDA7IHMgPCBvLmxlbmd0aDsgcysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9bc10uaGFzT3duUHJvcGVydHkoJ2JpZCcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IG9bc10uYmlkLCBjID0gSlNPTi5wYXJzZShyLmRhdGEuciksIHAgPSAwOyBwIDwgZC5sZW5ndGg7IHArKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IFEoZFtwXS5pbXBpZCwgYy5pbXAsIHIudmFsaWRCaWRSZXF1ZXN0cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBKKGRbcF0sIGEuY3VyLCB1KSwgT2JqZWN0KGkuZGVlcEFjY2VzcykobiwgJ21lZGlhVHlwZXMudmlkZW8ucmVuZGVyZXInKSB8fCAnb3V0c3RyZWFtJyAhPT0gT2JqZWN0KGkuZGVlcEFjY2VzcykobiwgJ21lZGlhVHlwZXMudmlkZW8uY29udGV4dCcpIHx8IChuLm1lZGlhVHlwZXMudmlkZW8ucmVuZGVyZXIgPSBhZShkW3BdLmJpZElkKSksIHQucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChpLmRlZXBBY2Nlc3MpKGMsICdleHQuaXhkaWFnLmVycicpICYmIEwubG9jYWxTdG9yYWdlSXNFbmFibGVkKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMLnJlbW92ZURhdGFGcm9tTG9jYWxTdG9yYWdlKEYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoaS5sb2dFcnJvcikoJ2l4IGNhbiBub3QgY2xlYXIgaXhkaWFnIGZyb20gbG9jYWxTdG9yYWdlLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtQmlkUGFyYW1zOiBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGkuY29udmVydFR5cGVzKSh7IHNpdGVJRDogJ251bWJlcicgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBnZXRVc2VyU3luY3M6IGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmlmcmFtZUVuYWJsZWQgPyBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdpZnJhbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vanMtc2VjLmluZGV4d3cuY29tL3VtL2l4bWF0Y2guaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dIDogW107CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIE9iamVjdChtLnJlZ2lzdGVyQmlkZGVyKShvZSksIHdpbmRvdy5wYmpzLmluc3RhbGxlZE1vZHVsZXMucHVzaCgnaXhCaWRBZGFwdGVyJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCBbNTYyXSk7CiAgICAgICAgcGJqc0NodW5rKFszXSwgewogICAgICAgICAgICA1ODg6IGZ1bmN0aW9uIChlLCBuLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB0KDU4OSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDU4OTogZnVuY3Rpb24gKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShuLCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCB0LmQobiwgJ3N0b3JhZ2UnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHA7CiAgICAgICAgICAgICAgICB9KSwgbi5yZXNldCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB3aW5kb3cgJiYgd2luZG93LmxpUSAmJiAod2luZG93LmxpUSA9IFtdKTsKICAgICAgICAgICAgICAgICAgICBiLnNldE1vZHVsZU1vZGUobnVsbCksIGcgPSAhMSwgbSA9IG51bGw7CiAgICAgICAgICAgICAgICB9LCB0LmQobiwgJ2xpdmVJbnRlbnRJZFN1Ym1vZHVsZScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0KDApLCBvID0gdCg0KSwgaSA9IHQoOSksIGEgPSB0KDU5MCksIGMgPSB0KDgpLCB1ID0gdCg3KSwgZiA9IHQoNTkxKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0LmtleXMoZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBuICYmIChyID0gci5maWx0ZXIoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGUsIG4pLmVudW1lcmFibGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgdC5wdXNoLmFwcGx5KHQsIHIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAxOyBuIDwgYXJndW1lbnRzLmxlbmd0aDsgbisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbnVsbCAhPSBhcmd1bWVudHNbbl0gPyBhcmd1bWVudHNbbl0gOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgbiAlIDIgPyBsKE9iamVjdCh0KSwgITApLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQoZSwgbiwgdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhlLCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyh0KSkgOiBsKE9iamVjdCh0KSkuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIG4sIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IodCwgbikpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiBpbiBlID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIG4sIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICB9KSA6IGVbbl0gPSB0LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGggPSAnbGl2ZUludGVudElkJywgcCA9IE9iamVjdCh1LmIpKG51bGwsIGgpLCB2ID0gewogICAgICAgICAgICAgICAgICAgICAgICBhamF4R2V0OiBmdW5jdGlvbiAoZSwgbiwgdCwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG8uYikocikoZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHZvaWQgMCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ0dFVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2l0aENyZWRlbnRpYWxzOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHBpeGVsR2V0OiBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLnRyaWdnZXJQaXhlbCkoZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBnID0gITEsIG0gPSBudWxsOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gdyhlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG0pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtOwogICAgICAgICAgICAgICAgICAgIHZhciBuID0gewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdwcmViaWQnLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJJZDogKGUgPSBlIHx8IHt9KS5wdWJsaXNoZXJJZCB8fCAnYW55JwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgZS51cmwgJiYgKG4udXJsID0gZS51cmwpLCBlLnBhcnRuZXIgJiYgKG4uc291cmNlID0gZS5wYXJ0bmVyKSwgZS5hamF4VGltZW91dCAmJiAobi5hamF4VGltZW91dCA9IGUuYWpheFRpbWVvdXQpOwogICAgICAgICAgICAgICAgICAgIHZhciB0LCByLCBvID0gKHQgPSBlLmxpQ29sbGVjdENvbmZpZywgciA9IHt9LCAodCA9IHQgfHwge30pLmFwcElkICYmIChyLmFwcElkID0gdC5hcHBJZCksIHQuZnBpU3RvcmFnZVN0cmF0ZWd5ICYmIChyLnN0b3JhZ2VTdHJhdGVneSA9IHQuZnBpU3RvcmFnZVN0cmF0ZWd5KSwgdC5mcGlFeHBpcmF0aW9uRGF5cyAmJiAoci5leHBpcmF0aW9uRGF5cyA9IHQuZnBpRXhwaXJhdGlvbkRheXMpLCB0LmNvbGxlY3RvclVybCAmJiAoci5jb2xsZWN0b3JVcmwgPSB0LmNvbGxlY3RvclVybCksIHIpOwogICAgICAgICAgICAgICAgICAgIG8ud3JhcHBlck5hbWUgPSAncHJlYmlkJywgby5pZGVudGl0eVJlc29sdXRpb25Db25maWcgPSBuLCBvLmlkZW50aWZpZXJzVG9SZXNvbHZlID0gZS5pZGVudGlmaWVyc1RvUmVzb2x2ZSB8fCBbXTsKICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGMudXNwRGF0YUhhbmRsZXIuZ2V0Q29uc2VudERhdGEoKTsKICAgICAgICAgICAgICAgICAgICBpICYmIChvLnVzUHJpdmFjeVN0cmluZyA9IGkpOwogICAgICAgICAgICAgICAgICAgIHZhciBhID0gYy5nZHByRGF0YUhhbmRsZXIuZ2V0Q29uc2VudERhdGEoKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSAmJiAoby5nZHByQXBwbGllcyA9IGEuZ2RwckFwcGxpZXMsIG8uZ2RwckNvbnNlbnQgPSBhLmNvbnNlbnRTdHJpbmcpLCBtID0gYi5nZXRJbml0aWFsaXplcigpKG8sIHAsIHYpLCBlLmVtYWlsSGFzaCAmJiBtLnB1c2goeyBoYXNoOiBlLmVtYWlsSGFzaCB9KSwgbTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHkoKSB7CiAgICAgICAgICAgICAgICAgICAgIWcgJiYgbSAmJiAobS5maXJlKCksIGcgPSAhMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgYiA9IHsKICAgICAgICAgICAgICAgICAgICBtb2R1bGVNb2RlOiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogaCwKICAgICAgICAgICAgICAgICAgICBzZXRNb2R1bGVNb2RlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm1vZHVsZU1vZGUgPSBlOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZ2V0SW5pdGlhbGl6ZXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdtaW5pbWFsJyA9PT0gdGhpcy5tb2R1bGVNb2RlID8gZi5hIDogYS5hOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZGVjb2RlOiBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG4gJiYgbi5wYXJhbXMgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtIHx8IHcodCksIHkoKSwgZSAmJiAnc3RyaW5nJyA9PSB0eXBlb2YgZS51bmlmaWVkSWQgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7IGxpcGJpZDogZS51bmlmaWVkSWQgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkZWxldGUgZS51bmlmaWVkSWQsIHsgbGlwYjogcyhzKHt9LCBuKSwgZSkgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfShlKSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGdldElkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHcoZSAmJiBlLnBhcmFtcyB8fCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnJlc29sdmUoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoci5sb2dFcnJvcikoJycuY29uY2F0KGgsICc6IElEIGZldGNoIGVuY291bnRlcmVkIGFuIGVycm9yOiAnKSwgbiksIGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBPYmplY3QoaS5lKSgndXNlcklkJywgYiksIHdpbmRvdy5wYmpzLmluc3RhbGxlZE1vZHVsZXMucHVzaCgnbGl2ZUludGVudElkU3lzdGVtJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDU5MDogZnVuY3Rpb24gKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAociA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdC5kKG4sICdhJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBvbjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSAnWzAtOWEtZl17OH0tWzAtOWEtZl17NH0tWzAtOWEtZl17NH0tWzAtOWEtZl17NH0tWzAtOWEtZl17MTJ9JywgaSA9IG5ldyBSZWdFeHAoJ14nLmNvbmNhdChvLCAnJCcpLCAnaScpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnID09PSByKGUpID8gSlNPTi5zdHJpbmdpZnkoZSkgOiAnJyArIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tvYmplY3QgQXJyYXldJyA9PT0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHUgPSAhIVN0cmluZy5wcm90b3R5cGUudHJpbTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB1ID8gKCcnICsgZSkudHJpbSgpIDogKCcnICsgZSkucmVwbGFjZSgvXltcc1x1RkVGRlx4QTBdK3xbXHNcdUZFRkZceEEwXSskL2csICcnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBsKGUpICYmIGwobikgJiYgZihlLnRvTG93ZXJDYXNlKCkpID09PSBmKG4udG9Mb3dlckNhc2UoKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlICYmICdvYmplY3QnID09PSByKGUpICYmICFjKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB2KGUsIDg2NDAwMDAwKS50b1VUQ1N0cmluZygpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdihlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBEYXRlKG5ldyBEYXRlKCkuZ2V0VGltZSgpICsgZSAqIG4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhlLCBuLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGUgJiYgZihlKS5sZW5ndGggPiAwOwogICAgICAgICAgICAgICAgICAgIH0obikgPyBbCiAgICAgICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGgodCkgPyB0KG4pIDogbgogICAgICAgICAgICAgICAgICAgIF0gOiBbXTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oZSwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBnKGUsIG4sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQoZSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB3KGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiBkKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYmICFkKHIpICYmIHIubGVuZ3RoICYmIG4ucHVzaChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2RlVVJJQ29tcG9uZW50KHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuY29kZVVSSUNvbXBvbmVudChyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9LCByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKGUpID8gZSA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB9LCBvID0gcihlKSwgaSA9IHIobik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKG8pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdFtlXSA9IG9bZV07CiAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5rZXlzKGkpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdFtlXSA9IGlbZV07CiAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgYiA9ICdsaV9lcnJvcnMnLCBTID0gJ19saV9kdWlkJywgSSA9ICdodHRwczovL2lkeC5saWFkbS5jb20vaWRleCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBDKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICB3aW5kb3cgJiYgd2luZG93Ll9fbGlfX2V2dF9idXMgJiYgd2luZG93Ll9fbGlfX2V2dF9idXMuZW1pdChlLCBuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF8oZSwgbikgewogICAgICAgICAgICAgICAgICAgIEMoZSwgbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB4KGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICBFKGUsIG4ubWVzc2FnZSwgbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBFKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzJdID8gYXJndW1lbnRzWzJdIDoge30sIHIgPSBuZXcgRXJyb3IobiB8fCB0Lm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgIHIuc3RhY2sgPSB0LnN0YWNrLCByLm5hbWUgPSBlIHx8ICd1bmtub3duIGVycm9yJywgci5saW5lTnVtYmVyID0gdC5saW5lTnVtYmVyLCByLmNvbHVtbk51bWJlciA9IHQuY29sdW1uTnVtYmVyLCBDKGIsIHIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTyhlLCBuLCB0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlICYmIGUuY29sbGVjdG9yVXJsIHx8ICdodHRwczovL3JwLmxpYWRtLmNvbSc7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEoZSwgJ3AnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ucGl4ZWxHZXQoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuc2VuZHNQaXhlbCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoKHIpICYmIHIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gJ2R0c3RtcD0nLmNvbmNhdCh1KCkpLCBhID0gZS5hc1F1ZXJ5U3RyaW5nKCksIGMgPSBhID8gJyYnLmNvbmNhdChpKSA6ICc/Jy5jb25jYXQoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KCcnLmNvbmNhdChvLCAnLycpLmNvbmNhdChuKS5jb25jYXQoYSkuY29uY2F0KGMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyBEYXRlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgRGF0ZShlLnRvVVRDU3RyaW5nKCkpLmdldFRpbWUoKSArIGUuZ2V0TWlsbGlzZWNvbmRzKCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRBamF4OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYShlLCAnaicsIGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5hamF4R2V0KHIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgodCkgJiYgdCgpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEpTT04ucGFyc2UoZSkuYmFrZXJzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IHQubGVuZ3RoOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnBpeGVsR2V0KCcnLmNvbmNhdCh0W3JdLCAnP2R0c3RtcD0nKS5jb25jYXQodSgpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRSgnQ2FsbEJha2VycycsICdFcnJvciB3aGlsZSBjYWxsaW5nIGJha2VycycsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkoZSksIEUoJ0FqYXhGYWlsZWQnLCBuLm1lc3NhZ2UsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRQaXhlbDogaQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBqKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNpemUgPSBwYXJzZUludChlKSB8fCA1LCB0aGlzLmggPSB7fSwgdGhpcy5xID0ge307CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBqLnByb3RvdHlwZSA9IHsKICAgICAgICAgICAgICAgICAgICBvbjogZnVuY3Rpb24gKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgKHRoaXMuaFtlXSB8fCAodGhpcy5oW2VdID0gW10pKS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3R4OiB0CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gKHRoaXMucVtlXSB8fCBbXSkubGVuZ3RoLCBvID0gMDsgbyA8IHI7IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uYXBwbHkodCwgdGhpcy5xW2VdW29dKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBvbmNlOiBmdW5jdGlvbiAoZSwgbiwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMsIG8gPSB0aGlzLnFbZV0gfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvLmxlbmd0aCA+IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5hcHBseSh0LCBvWzBdKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBmdW5jdGlvbiBvKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgci5vZmYoZSwgbyksIG4uYXBwbHkodCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuXyA9IG4sIHRoaXMub24oZSwgaSwgdCk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBlbWl0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gW10uc2xpY2UuY2FsbChhcmd1bWVudHMsIDEpLCB0ID0gKHRoaXMuaFtlXSB8fCBbXSkuc2xpY2UoKSwgciA9IDAsIG8gPSB0Lmxlbmd0aDsgciA8IG87IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbcl0uZm4uYXBwbHkodFtyXS5jdHgsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHRoaXMucVtlXSB8fCAodGhpcy5xW2VdID0gW10pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5sZW5ndGggPj0gdGhpcy5zaXplICYmIGkuc2hpZnQoKSwgaS5wdXNoKG4pLCB0aGlzOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgb2ZmOiBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMuaFtlXSwgciA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbyA9IDAsIGkgPSB0Lmxlbmd0aDsgbyA8IGk7IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W29dLmZuICE9PSBuICYmIHRbb10uZm4uXyAhPT0gbiAmJiByLnB1c2godFtvXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmxlbmd0aCA/IHRoaXMuaFtlXSA9IHIgOiBkZWxldGUgdGhpcy5oW2VdLCB0aGlzOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBSKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSA9ICcnLmNvbmNhdChlKSwgbiA9IDA7IG4gPCBlLmxlbmd0aDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuY2hhckNvZGVBdChuKSA+IDI1NSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIHIgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gMDsgbiA8IGUubGVuZ3RoOyBuICs9IDMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9bMF0gPSBlLmNoYXJDb2RlQXQobikgPj4gMiwgb1sxXSA9ICgzICYgZS5jaGFyQ29kZUF0KG4pKSA8PCA0LCBlLmxlbmd0aCA+IG4gKyAxICYmIChvWzFdIHw9IGUuY2hhckNvZGVBdChuICsgMSkgPj4gNCwgb1syXSA9ICgxNSAmIGUuY2hhckNvZGVBdChuICsgMSkpIDw8IDIpLCBlLmxlbmd0aCA+IG4gKyAyICYmIChvWzJdIHw9IGUuY2hhckNvZGVBdChuICsgMikgPj4gNiwgb1szXSA9IDYzICYgZS5jaGFyQ29kZUF0KG4gKyAyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IG8ubGVuZ3RoOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBvW2ldID8gciArPSAnPScgOiByICs9ICh0ID0gb1tpXSkgPj0gMCAmJiB0IDwgNjQgPyAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLydbdF0gOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgfShlKSB8fCAnJzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBrID0gL1srL118PSskL2csIEwgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICcrJzogJy0nLAogICAgICAgICAgICAgICAgICAgICAgICAnLyc6ICdfJwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBEKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gTFtlXSB8fCAnJzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFUoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gbnVsbCwgdCA9IGVuY29kZVVSSUNvbXBvbmVudChlKS5yZXBsYWNlKC8lKFswLTlBLUZdezJ9KS9nLCBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFN0cmluZy5mcm9tQ2hhckNvZGUoJzB4JyArIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBuID0gd2luZG93ICYmIGgod2luZG93LmJ0b2EpID8gd2luZG93LmJ0b2EgOiBSOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbiA9IFI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBuKHQpLnJlcGxhY2UoaywgRCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBOKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gL1xTKyhAfCU0MClcUytcLlxTKy8udGVzdChlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBGID0gLyIoW14iXSsoQHwlNDApW14iXStbLl1bYS16XSooXHMrKT8pKFxcInwiKS87CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBUKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRi50ZXN0KGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQShlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09IHR5cGVvZiBuICYmIE4oZihuKSkgPyAnKioqKioqKioqJyA6IG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmb3IgKHZhciBQID0gW10sIEcgPSAwOyBHIDwgNjQ7KQogICAgICAgICAgICAgICAgICAgIFBbR10gPSAwIHwgNDI5NDk2NzI5NiAqIE1hdGguc2luKCsrRyAlIE1hdGguUEkpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gVihlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHQsIHIsIG8gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gMTczMjU4NDE5MywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSA0MDIzMjMzNDE3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfm4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB+dAogICAgICAgICAgICAgICAgICAgICAgICBdLCBpID0gW10sIGEgPSB1bmVzY2FwZShlbmNvZGVVUkkoZSkpICsgJ1x4ODAnLCBjID0gYS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgZm9yIChlID0gLS1jIC8gNCArIDIgfCAxNSwgaVstLWVdID0gOCAqIGM7IH5jOykKICAgICAgICAgICAgICAgICAgICAgICAgaVtjID4+IDJdIHw9IGEuY2hhckNvZGVBdChjKSA8PCA4ICogYy0tOwogICAgICAgICAgICAgICAgICAgIGZvciAoRyA9IGEgPSAwOyBHIDwgZTsgRyArPSAxNikgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSBvOyBhIDwgNjQ7IGMgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IGNbM10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiArICgociA9IGNbMF0gKyBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiB0IHwgfm4gJiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYgbiB8IH5yICYgdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiBeIHQgXiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0IF4gKG4gfCB+cikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdW2MgPSBhID4+IDRdICsgUFthXSArIH5+aVtHIHwgMTUgJiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUgKiBhICsgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMyAqIGEgKyA1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3ICogYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1bY11dKSA8PCAoYyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXVs0ICogYyArIGErKyAlIDRdKSB8IHIgPj4+IC1jKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gMCB8IGNbMV0sIHQgPSBjWzJdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgPSA0OyBhOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9bLS1hXSArPSBjW2FdOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSAnJzsgYSA8IDMyOykKICAgICAgICAgICAgICAgICAgICAgICAgZSArPSAob1thID4+IDNdID4+IDQgKiAoMSBeIGErKykgJiAxNSkudG9TdHJpbmcoMTYpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHQsIHIsIG8sIGksIGEgPSBbXSwgYyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAxNzMyNTg0MTkzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IDQwMjMyMzM0MTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB+dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH5yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMzI4NTM3NzUyMAogICAgICAgICAgICAgICAgICAgICAgICBdLCB1ID0gW10sIGYgPSB1bmVzY2FwZShlbmNvZGVVUkkoZSkpICsgJ1x4ODAnLCBsID0gZi5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgZm9yICh1W2UgPSAtLWwgLyA0ICsgMiB8IDE1XSA9IDggKiBsOyB+bDspCiAgICAgICAgICAgICAgICAgICAgICAgIHVbbCA+PiAyXSB8PSBmLmNoYXJDb2RlQXQobCkgPDwgOCAqIH5sLS07CiAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gbCA9IDA7IG4gPCBlOyBuICs9IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCA9IGM7IGwgPCA4MDsgdCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0WzRdICsgKGFbbF0gPSBsIDwgMTYgPyB+fnVbbiArIGxdIDogMiAqIGYgfCBmIDwgMCkgKyAxNTE4NTAwMjQ5ICsgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYgbyB8IH5yICYgaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IDM0MTI3NTE0NCArIChyIF4gbyBeIGkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4ODI0NTk0NTkgKyAociAmIG8gfCByICYgaSB8IG8gJiBpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiArIDE1MzU2OTQzODkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdW2wrKyAvIDUgPj4gMl0gKyAoKGYgPSB0WzBdKSA8PCA1IHwgZiA+Pj4gMjcpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA8PCAzMCB8IHIgPj4+IDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGFbbCAtIDNdIF4gYVtsIC0gOF0gXiBhW2wgLSAxNF0gXiBhW2wgLSAxNl0sIHIgPSB0WzFdLCBvID0gdFsyXSwgaSA9IHRbM107CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobCA9IDU7IGw7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgY1stLWxdICs9IHRbbF07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZvciAoZiA9ICcnOyBsIDwgNDA7KQogICAgICAgICAgICAgICAgICAgICAgICBmICs9IChjW2wgPj4gM10gPj4gNCAqICg3IC0gbCsrKSAmIDE1KS50b1N0cmluZygxNik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmb3IgKHZhciBKLCBNID0gMTgsIFcgPSBbXSwgSCA9IFtdOyBNID4gMTsgTS0tKQogICAgICAgICAgICAgICAgICAgIGZvciAoSiA9IE07IEogPCAzMjA7KQogICAgICAgICAgICAgICAgICAgICAgICBXW0ogKz0gTV0gPSAxOwogICAgICAgICAgICAgICAgZnVuY3Rpb24geihlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDQyOTQ5NjcyOTYgKiBNYXRoLnBvdyhlLCAxIC8gbikgfCAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZm9yIChKID0gMDsgSiA8IDY0OykKICAgICAgICAgICAgICAgICAgICBXWysrTV0gfHwgKEhbSl0gPSB6KE0sIDIpLCBXW0orK10gPSB6KE0sIDMpKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHEoZSwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID4+PiBuIHwgZSA8PCAtbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEIoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gSC5zbGljZShNID0gSiA9IDAsIDgpLCB0ID0gW10sIHIgPSB1bmVzY2FwZShlbmNvZGVVUkkoZSkpICsgJ1x4ODAnLCBvID0gci5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgZm9yICh0W2UgPSAtLW8gLyA0ICsgMiB8IDE1XSA9IDggKiBvOyB+bzspCiAgICAgICAgICAgICAgICAgICAgICAgIHRbbyA+PiAyXSB8PSByLmNoYXJDb2RlQXQobykgPDwgOCAqIH5vLS07CiAgICAgICAgICAgICAgICAgICAgZm9yIChvID0gW107IE0gPCBlOyBNICs9IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoeiA9IG4uc2xpY2UoKTsgSiA8IDY0OyB6LnVuc2hpZnQociArIChxKHIgPSB6WzBdLCAyKSBeIHEociwgMTMpIF4gcShyLCAyMikpICsgKHIgJiB6WzFdIF4gelsxXSAmIHpbMl0gXiB6WzJdICYgcikpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgelszXSArPSByID0gMCB8IChvW0pdID0gSiA8IDE2ID8gfn50W0ogKyBNXSA6IChxKHIgPSBvW0ogLSAyXSwgMTcpIF4gcShyLCAxOSkgXiByID4+PiAxMCkgKyBvW0ogLSA3XSArIChxKHIgPSBvW0ogLSAxNV0sIDcpIF4gcShyLCAxOCkgXiByID4+PiAzKSArIG9bSiAtIDE2XSkgKyB6LnBvcCgpICsgKHEociA9IHpbNF0sIDYpIF4gcShyLCAxMSkgXiBxKHIsIDI1KSkgKyAociAmIHpbNV0gXiB+ciAmIHpbNl0pICsgV1tKKytdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKEogPSA4OyBKOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bLS1KXSArPSB6W0pdOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmb3IgKHIgPSAnJzsgSiA8IDY0OykKICAgICAgICAgICAgICAgICAgICAgICAgciArPSAobltKID4+IDNdID4+IDQgKiAoNyAtIEorKykgJiAxNSkudG9TdHJpbmcoMTYpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyICQgPSB7CiAgICAgICAgICAgICAgICAgICAgMzI6ICdtZDUnLAogICAgICAgICAgICAgICAgICAgIDQwOiAnc2hhMScsCiAgICAgICAgICAgICAgICAgICAgNjQ6ICdzaGEyNTYnCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gSyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBYKGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIW4gJiYgbnVsbCAhPSAkW24ubGVuZ3RoXTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFgoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5tYXRjaCgvKFxzKyk/W2EtZjAtOV17MzIsNjR9KFxzKyk/L2dpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiBuLm1hcChmKVswXTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFkoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIG1kNTogVihuKSwKICAgICAgICAgICAgICAgICAgICAgICAgc2hhMTogUShuKSwKICAgICAgICAgICAgICAgICAgICAgICAgc2hhMjU2OiBCKG4pCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFooZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiAxMjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUShlLnJlcGxhY2UoL15cLi8sICcnKSkuc3Vic3RyaW5nKDAsIG4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGVlID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnaXRlbXMnLAogICAgICAgICAgICAgICAgICAgICAgICAnaXRlbWlkcycKICAgICAgICAgICAgICAgICAgICBdLCBuZSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2VtYWlsJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2VtYWlsaGFzaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdoYXNoJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2hhc2hlZGVtYWlsJwogICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICB2YXIgdGUgPSBbCiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiwgdCA9IGUuZXZlbnRTb3VyY2UsIHIgPSAwLCBvID0gT2JqZWN0LmtleXModCk7IHIgPCBvLmxlbmd0aDsgcisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG9bcl0sIGMgPSBpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobmUuaW5kZXhPZihjKSA+IC0xKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBmKGEodFtpXSkpLCBsID0gKG4gPSB2b2lkIDAsIChuID0gdS5tYXRjaCgvXFMrKEB8JTQwKVxTK1wuXFMrLykpICYmIG4ubWFwKGYpWzBdKSwgcyA9IFgodSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBZKGRlY29kZVVSSUNvbXBvbmVudChsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc2hlZEVtYWlsOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5tZDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5zaGExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQuc2hhMjU2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocyAmJiBLKHMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geSh7IGhhc2hlZEVtYWlsOiBbcy50b0xvd2VyQ2FzZSgpXSB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5ldmVudFNvdXJjZTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKG4pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWUuaW5kZXhPZih0KSA+IC0xICYmIGMobltlXSkgJiYgbltlXS5sZW5ndGggPiAxMCAmJiAobltlXS5sZW5ndGggPSAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB7fTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgdmFyIHJlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICcnOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAwID09PSBuLmxlbmd0aCA/ICc/JyA6ICcmJzsKICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiBlLmxlbmd0aCAmJiAyID09PSBlLmxlbmd0aCAmJiBlWzBdICYmIGVbMV0gJiYgKG4gPSAnJy5jb25jYXQobikuY29uY2F0KHQpLmNvbmNhdChlWzBdLCAnPScpLmNvbmNhdChlWzFdKSk7CiAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gb2UoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSA9PT0gZS5pbmRleE9mKCclJykgPyBlIDogZGVjb2RlVVJJQ29tcG9uZW50KGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaWUoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2ZhbHNlJyAhPT0gZSAmJiAoJ3RydWUnID09PSBlIHx8IGUpOwogICAgICAgICAgICAgICAgICAgIH0oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudWxsJyA9PT0gZSB8fCAndW5kZWZpbmVkJyA9PT0gZSA/IG51bGwgOiBlOwogICAgICAgICAgICAgICAgICAgIH0oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlzTmFOKCtlKSA/IGUgOiArZTsKICAgICAgICAgICAgICAgICAgICB9KGUpKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgYWUgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICdzZXRlbWFpbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdzZXRlbWFpbGhhc2gnLAogICAgICAgICAgICAgICAgICAgICAgICAnc2V0aGFzaGVkZW1haWwnCiAgICAgICAgICAgICAgICAgICAgXSwgY2UgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGFwcElkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0oJ2FpZCcsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBldmVudFNvdXJjZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnKCdzZScsIGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFUoSlNPTi5zdHJpbmdpZnkoZSwgQSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGxpdmVDb25uZWN0SWQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbSgnZHVpZCcsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBsZWdhY3lJZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKCdsZHVpZCcsIGUgJiYgZS5kdWlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlck5hbWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbSgndG5hJywgZSB8fCAndW5rbm93bicpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwYWdlVXJsOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0oJ3B1JywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yRGV0YWlsczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnKCdhZScsIGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFUoSlNPTi5zdHJpbmdpZnkoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHJpZXZlZElkZW50aWZpZXJzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5wdXNoKG0oJ2V4dF8nLmNvbmNhdChlLm5hbWUpLCBlLnZhbHVlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaGFzaGVzRnJvbUlkZW50aWZpZXJzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5wdXNoKG0oJ3NjcmUnLCAnJy5jb25jYXQoZS5tZDUsICcsJykuY29uY2F0KGUuc2hhMSwgJywnKS5jb25jYXQoZS5zaGEyNTYpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZGVjaXNpb25JZHM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbSgnbGlfZGlkJywgZS5qb2luKCcsJykpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBoYXNoZWRFbWFpbDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKCdlJywgZS5qb2luKCcsJykpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c1ByaXZhY3lTdHJpbmc6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbSgndXNfcHJpdmFjeScsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB3cmFwcGVyTmFtZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKCd3cG4nLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2RwckFwcGxpZXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZygnZ2RwcicsIGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVuY29kZVVSSUNvbXBvbmVudChlID8gMSA6IDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdkcHJDb25zZW50OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0oJ2dkcHJfY29uc2VudCcsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICByZWZlcnJlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKCdyZWZyJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gdWUoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKG4pLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gblt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjZVt0XSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gY2VbdF0ocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyAmJiBvLmxlbmd0aCAmJiAob1swXSBpbnN0YW5jZW9mIEFycmF5ID8gZSA9IGUuY29uY2F0KG8pIDogZS5wdXNoKG8pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIChuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKGUuZXZlbnRTb3VyY2UpID8gdGUucmVkdWNlKGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5KGUsIG4oZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oSlNPTi5wYXJzZShKU09OLnN0cmluZ2lmeShlKSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRSgnU3RhdGVDb21iaW5lV2l0aCcsICdFcnJvciB3aGlsZSBleHRyYWN0aW5nIGV2ZW50IGRhdGEnLCBlKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oZSkpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbWJpbmVXaXRoOiBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB1ZSh5KGUsIG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgYXNRdWVyeVN0cmluZzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlKHQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFzVHVwbGVzOiB0LAogICAgICAgICAgICAgICAgICAgICAgICBzZW5kc1BpeGVsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGQobi5ldmVudFNvdXJjZSkgPyBuLmV2ZW50U291cmNlIDoge30sIHQgPSBPYmplY3Qua2V5cyhlKS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdldmVudG5hbWUnID09PSBlLnRvTG93ZXJDYXNlKCkgfHwgJ2V2ZW50JyA9PT0gZS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByID0gdCAmJiB0Lmxlbmd0aCA+PSAxICYmIHRbMF0sIG8gPSByICYmIGYobi5ldmVudFNvdXJjZVtyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIW8gfHwgLTEgPT09IGFlLmluZGV4T2Yoby50b0xvd2VyQ2FzZSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBmZSgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuZG9tYWluIHx8IGRvY3VtZW50LmxvY2F0aW9uICYmIGRvY3VtZW50LmxvY2F0aW9uLmhvc3QgfHwgd2luZG93ICYmIHdpbmRvdy5sb2NhdGlvbiAmJiB3aW5kb3cubG9jYXRpb24uaG9zdCB8fCAnbG9jYWxob3N0JzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGxlKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiB3aW5kb3c7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRlKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudG9wLmRvY3VtZW50LnJlZmVycmVyOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gc2UoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSwgbiA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDogd2luZG93LCB0ID0gZGUoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmxvY2F0aW9uLmFuY2VzdG9yT3JpZ2luczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIHx8IHt9LCByID0gW10sIG8gPSBuOyBvICE9PSB0b3A7KQogICAgICAgICAgICAgICAgICAgICAgICByLnB1c2gobyksIG8gPSBvLnBhcmVudDsKICAgICAgICAgICAgICAgICAgICByLnB1c2gobyk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGRlKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJbbl0ubG9jYXRpb24uaHJlZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgMCAhPT0gbiAmJiAoZSB8fCAoZSA9IGRlKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJbbiAtIDFdLmRvY3VtZW50LnJlZmVycmVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgZSB8fCAoZSA9IHRbbiAtIDFdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhID0gci5sZW5ndGggLSAxOyBhID49IDAgJiYgIWU7IGEtLSkKICAgICAgICAgICAgICAgICAgICAgICAgaShhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRlKGUpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSgpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBoZSA9IG51bGw7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBwZShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGhlIHx8IChoZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgcGFnZVVybDogc2UoKSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVmZXJyZXI6IGxlKCkKICAgICAgICAgICAgICAgICAgICB9KSwgaGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgdmUgPSBudWxsLCBnZSA9IG51bGwsIG1lID0gewogICAgICAgICAgICAgICAgICAgICAgICBlcnJvckRldGFpbHM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdVbmtub3duIG1lc3NhZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1Vua25vd24gbmFtZScKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB3ZShlKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAxICogZTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlzTmFOKG4pID8gdm9pZCAwIDogbjsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24geWUoZSkgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGUubGVuZ3RoICYmIGUubGVuZ3RoID4gMTIwID8gJycuY29uY2F0KGUuc3Vic3RyKDAsIDEyMCksICcuLi4nKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGJlKGUpIHsKICAgICAgICAgICAgICAgICAgICBnZSAmJiBnZS5zZW5kUGl4ZWwobmV3IHVlKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JEZXRhaWxzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogeWUoZS5tZXNzYWdlKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiB5ZShlLm5hbWUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrVHJhY2U6IHllKGUuc3RhY2spLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVOdW1iZXI6IHdlKGUubGluZU51bWJlciksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZUNvbHVtbjogd2UoZS5saW5lQ29sdW1uKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxlTmFtZTogeWUoZS5maWxlTmFtZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSA6IG1lOwogICAgICAgICAgICAgICAgICAgIH0oZSkpLmNvbWJpbmVXaXRoKHZlIHx8IHt9KS5jb21iaW5lV2l0aChwZSgpKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgU2UgPSAnMDEyMzQ1Njc4OUFCQ0RFRkdISktNTlBRUlNUVldYWVonLCBJZSA9IFNlLmxlbmd0aCwgQ2UgPSBNYXRoLnBvdygyLCA0OCkgLSAxLCBfZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygd2luZG93ID8gd2luZG93IDogbnVsbCwgbiA9IGUgJiYgKGUuY3J5cHRvIHx8IGUubXNDcnlwdG8pOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZXcgVWludDhBcnJheSgxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5nZXRSYW5kb21WYWx1ZXMoZSksIGVbMF0gLyAyNTU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgucmFuZG9tKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24geGUoZSwgbikgewogICAgICAgICAgICAgICAgICAgIGlmIChlID4gQ2UpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93ICh0ID0gbmV3IEVycm9yKCdjYW5ub3QgZW5jb2RlIHRpbWUgZ3JlYXRlciB0aGFuICcgKyBDZSkpLnNvdXJjZSA9ICdVbGlkJywgdDsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0LCByLCBvID0gJyc7IG4gPiAwOyBuLS0pCiAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBTZS5jaGFyQXQociA9IGUgJSBJZSkgKyBvLCBlID0gKGUgLSByKSAvIEllOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBvOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRWUoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBNYXRoLmZsb29yKF9lKCkgKiBJZSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IEllICYmIChlID0gSWUgLSAxKSwgU2UuY2hhckF0KGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gT2UoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHhlKERhdGUubm93KCksIDEwKSArIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAnJzsgZSA+IDA7IGUtLSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBFZSgpICsgbjsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgfSgxNik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgamUgPSAnbHMnLCBSZSA9ICdub25lJywga2UgPSAnX2xpX2RjZG1fYyc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMZShlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmV4cGlyYXRpb25EYXlzIHx8IDczMCwgciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG4uZ2V0Q29va2llKGtlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IGZlKCksIHIgPSB0LnNwbGl0KCcuJyksIG8gPSByLmxlbmd0aDsgbyA+IDA7IG8tLSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9ICcuJy5jb25jYXQoci5zbGljZShvIC0gMSwgci5sZW5ndGgpLmpvaW4oJy4nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLnNldENvb2tpZShrZSwgaSwgdm9pZCAwLCAnTGF4JywgaSksIG4uZ2V0Q29va2llKGtlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJy4nLmNvbmNhdCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgbyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBpcmVzOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbjogcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbjogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpdmVDb25uZWN0SWQ6IGZ1bmN0aW9uIChlLCB0LCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMobywgamUpID8gZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4ubG9jYWxTdG9yYWdlSXNFbmFibGVkKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9ICcnLmNvbmNhdChlLCAnX2V4cCcpLCBhID0gbi5nZXREYXRhRnJvbUxvY2FsU3RvcmFnZShpKSwgYyA9IHYoci5leHBpcmVzLCA4NjQwMDAwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiBwYXJzZUludChhKSA8PSBuZXcgRGF0ZSgpLmdldFRpbWUoKSAmJiBuLnJlbW92ZURhdGFGcm9tTG9jYWxTdG9yYWdlKGUpLCBuLmdldERhdGFGcm9tTG9jYWxTdG9yYWdlKGUpIHx8IG4uc2V0RGF0YUluTG9jYWxTdG9yYWdlKGUsIHQpLCBuLnNldERhdGFJbkxvY2FsU3RvcmFnZShpLCAnJy5jb25jYXQoYykpLCBvID0gbi5nZXREYXRhRnJvbUxvY2FsU3RvcmFnZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRSgnTFNHZXRPckFkZCcsICdFcnJvciBtYW5pcHVsYXRpbmcgTFMnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUsIHQsIHIpIDogcyhvLCBSZSkgPyBudWxsIDogZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuLmdldENvb2tpZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPyBuLnNldENvb2tpZShlLCBpLCBwKHIuZXhwaXJlcyksICdMYXgnLCByLmRvbWFpbikgOiBuLnNldENvb2tpZShlLCB0LCBwKHIuZXhwaXJlcyksICdMYXgnLCByLmRvbWFpbiksIG8gPSBuLmdldENvb2tpZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRSgnQ29va2llR2V0T3JBZGQnLCAnRmFpbGVkIG1hbmlwdWxhdGluZyBjb29raWUgamFyJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlLCB0LCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oJ19sYzJfZnBpJywgJycuY29uY2F0KFoociksICctLScpLmNvbmNhdChPZSgpKS50b0xvY2FsZUxvd2VyQ2FzZSgpLCBvLCBlLnN0b3JhZ2VTdHJhdGVneSkKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFKCdJZGVudGlmaWVyc1Jlc29sdmUnLCAnRXJyb3Igd2hpbGUgbWFuYWdpbmcgaWRlbnRpZmllcnMnLCBlKSwge307CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIERlID0gcCgzMCksIFVlID0gJ2xpZGlkcy4nLCBOZSA9IGZ1bmN0aW9uIChlLCBuLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmluZGV4T2YoZSkgPT09IG47CiAgICAgICAgICAgICAgICAgICAgfSwgRmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGkudGVzdChmKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfShlKTsKICAgICAgICAgICAgICAgICAgICB9LCBUZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGYoZSkubGVuZ3RoID4gMDsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gQWUoZSwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciB0LCByLCBvLCBpLCBhLCB1ID0ge307CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBlLnBhZ2VVcmwgJiYgKHQgPSBlLnBhZ2VVcmwsIGEgPSB7fSwgdCAmJiAtMSAhPT0gKHIgPSB0LmluZGV4T2YoJz8nKSkgJiYgKG8gPSB0LnNsaWNlKHIgKyAxKSkgJiYgKC0xID09PSAoaSA9IG8uaW5kZXhPZignIycpKSB8fCAobyA9IG8uc2xpY2UoMCwgaSkpKSA/IChvLnNwbGl0KCcmJykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnW10nID09PSAoZSA9ICgoZSA9IGUuc3BsaXQoJz0nKSkgJiYgMiA9PT0gZS5sZW5ndGggPyBlIDogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RydWUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKS5tYXAob2UpKVswXS5zbGljZSgtMikgJiYgKGFbZVswXSA9IGVbMF0uc2xpY2UoMCwgLTIpXSA9IGFbZVswXV0gfHwgW10pLCAhYVtlWzBdXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhW2VbMF1dID0gaWUoZVsxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMoYVtlWzBdXSkgPyBhW2VbMF1dLnB1c2goaWUoZVsxXSkpIDogYVtlWzBdXSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbZVswXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZShlWzFdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhKSA6IGEpIHx8IHt9LCBzID0gW10uY29uY2F0KGwubGlfZGlkIHx8IFtdKSwgZCA9IG4uZmluZFNpbWlsYXJDb29raWVzKFVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcy5tYXAoZikuZmlsdGVyKFRlKS5maWx0ZXIoRmUpLmZpbHRlcihOZSkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSB0LCBvID0gZS5kb21haW4sIHZvaWQgKHIgJiYgbi5zZXRDb29raWUoJycuY29uY2F0KFVlKS5jb25jYXQociksIHIsIERlLCAnTGF4JywgbykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB1ID0geyBkZWNpc2lvbklkczogcy5jb25jYXQoZCkubWFwKGYpLmZpbHRlcihUZSkuZmlsdGVyKEZlKS5maWx0ZXIoTmUpIH07CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBFKCdEZWNpc2lvbnNSZXNvbHZlJywgJ0Vycm9yIHdoaWxlIG1hbmFnaW5nIGRlY2lzaW9uIGlkcycsIGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFBlKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICBlICYmIG4uc2V0RGF0YUluTG9jYWxTdG9yYWdlKFMsIGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gR2UoZSwgbikgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gKG5ldyBEYXRlKCkuZ2V0VGltZSgpIC0gMTU2Mzg0MDAwMDApIC8gMTAwMCwgciA9IGUubGVnYWN5SWQgfHwge30sIG8gPSByLmN1cnJWaXNpdFRzID8gcGFyc2VJbnQoci5jdXJyVmlzaXRUcykgOiAwOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5jdXJyVmlzaXRUcyAmJiB0ID4gbyAmJiBlLmxpdmVDb25uZWN0SWQgJiYgUGUoZS5saXZlQ29ubmVjdElkLCBuKSwgbi5nZXREYXRhRnJvbUxvY2FsU3RvcmFnZShTKSB8fCBQZShyLmR1aWQgfHwgZS5saXZlQ29ubmVjdElkLCBuKSwgeyBwZW9wbGVWZXJpZmllZElkOiBuLmdldERhdGFGcm9tTG9jYWxTdG9yYWdlKFMpIH07CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRSgnUGVvcGxlVmVyaWZpZWRSZXNvbHZlJywgJ0Vycm9yIHdoaWxlIG1hbmFnaW5nIHBlb3BsZSB2ZXJpZmllZCcsIGUpLCB7fTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBWZShlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gW10sIHIgPSBbXSwgbyA9IDA7IG8gPCBlLmxlbmd0aDsgbysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlW29dLCBjID0gbi5nZXRDb29raWUoaSkgfHwgbi5nZXREYXRhRnJvbUxvY2FsU3RvcmFnZShpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IFFlKGEoYykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB1LmlkZW50aWZpZXJXaXRob3V0UmF3RW1haWxzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByID0gci5jb25jYXQodS5oYXNoZXNGcm9tSWRlbnRpZmllcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXRyaWV2ZWRJZGVudGlmaWVyczogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNoZXNGcm9tSWRlbnRpZmllcnM6IEplKHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5pZGVudGlmaWVyc1RvUmVzb2x2ZSAmJiAoYyhlLmlkZW50aWZpZXJzVG9SZXNvbHZlKSA/IG4gPSBlLmlkZW50aWZpZXJzVG9SZXNvbHZlIDogbChlLmlkZW50aWZpZXJzVG9SZXNvbHZlKSAmJiAobiA9IGUuaWRlbnRpZmllcnNUb1Jlc29sdmUuc3BsaXQoJywnKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDA7IHQgPCBuLmxlbmd0aDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bdF0gPSBuW3RdLnRyaW0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICB9KGUpLCBuKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4KCdJZGVudGlmaWVyc0VucmljaGVyJywgZSksIHt9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFFlKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoVChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBbXSwgdCA9IG5ldyBSZWdFeHAoRi5zb3VyY2UsICdnJyksIHIgPSB0LmV4ZWMoZSk7IHI7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucHVzaChmKHJbMV0pKSwgciA9IHQuZXhlYyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUpLCB0ID0gW10sIHIgPSAwOyByIDwgbi5sZW5ndGg7IHIrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gbltyXSwgaSA9IFkobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUucmVwbGFjZShvLCBpLm1kNSksIHQucHVzaChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWRlbnRpZmllcldpdGhvdXRSYXdFbWFpbHM6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzaGVzRnJvbUlkZW50aWZpZXI6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE4oZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBZKGUpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWRlbnRpZmllcldpdGhvdXRSYXdFbWFpbHM6IG4ubWQ1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzaGVzRnJvbUlkZW50aWZpZXI6IFtuXQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICBpZGVudGlmaWVyV2l0aG91dFJhd0VtYWlsczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgaGFzaGVzRnJvbUlkZW50aWZpZXI6IFtdCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEplKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0ge30sIHQgPSBbXSwgciA9IDA7IHIgPCBlLmxlbmd0aDsgcisrKQogICAgICAgICAgICAgICAgICAgICAgICBlW3JdLm1kNSBpbiBuIHx8ICh0LnB1c2goZVtyXSksIG5bZVtyXS5tZDVdID0gITApOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIE1lID0gJ1xcKz9cXGQrJywgV2UgPSAnKCcuY29uY2F0KCdbYS16XS1bYS16MC05XXs0fScsICctLScpLmNvbmNhdChvLCAnKVxcLignKS5jb25jYXQoTWUsICcpXFwuKCcpLmNvbmNhdChNZSwgJylcXC4oJykuY29uY2F0KE1lLCAnKVxcLignKS5jb25jYXQoTWUsICcpXFwuKCcpLmNvbmNhdChvLCAnKScpLCBIZSA9IG5ldyBSZWdFeHAoV2UsICdpJyk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB6ZShlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIHIsIG8sIGkgPSAodCA9IFooKHIgPSBmZSgpLCBvID0gci5sZW5ndGgsICcuJyA9PT0gci5jaGFyQXQoLS1vKSAmJiAociA9IHIuc2xpY2UoMCwgbykpLCAnKi4nID09PSByLnNsaWNlKDAsIDIpICYmIChyID0gci5zbGljZSgxKSksIHIgKyAnLycpLCA0KSwgJycuY29uY2F0KCdfbGl0cmFfaWQuJykuY29uY2F0KHQpKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5hcHBJZCAmJiBuLmxvY2FsU3RvcmFnZUlzRW5hYmxlZCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdhY3lJZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5tYXRjaChIZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiAmJiA3ID09PSBuLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdWlkOiBuWzFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGlvblRzOiBuWzJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uQ291bnQ6IG5bM10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJWaXNpdFRzOiBuWzRdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0U2Vzc2lvblZpc2l0VHM6IG5bNV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb25JZDogbls2XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG4uZ2V0RGF0YUZyb21Mb2NhbFN0b3JhZ2UoaSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgRSgnTGVnYWN5RHVpZEVucmljaCcsICdFcnJvciB3aGlsZSBnZXR0aW5nIGxlZ2FjeSBkdWlkJywgZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBxZSA9ICdfX2xpX2lkZXhfY2FjaGUnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gQmUoZSwgbiwgdCwgcikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IEpTT04ucGFyc2Uobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeCgnSWRlbnRpdHlSZXNvbHZlclBhcnNlcicsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zZXRDb29raWUocWUsIEpTT04uc3RyaW5naWZ5KGkpLCB2KHQsIDM2MDAwMDApLnRvVVRDU3RyaW5nKCksICdMYXgnLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgeCgnSWRlbnRpdHlSZXNvbHZlclN0b3JhZ2UnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByKGkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiAkZShlLCBuLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlIHx8IHt9LCBvID0gci5pZGVudGl0eVJlc29sdXRpb25Db25maWcgfHwge30sIGkgPSByLnJldHJpZXZlZElkZW50aWZpZXJzIHx8IFtdLCBhID0gby5leHBpcmF0aW9uSG91cnMgfHwgMSwgYyA9IG8uc291cmNlIHx8ICd1bmtub3duJywgdSA9IG8ucHVibGlzaGVySWQgfHwgJ2FueScsIGYgPSBvLnVybCB8fCBJLCBsID0gby5hamF4VGltZW91dCB8fCA1MDAwLCBzID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIHMucHVzaChtKCdkdWlkJywgci5wZW9wbGVWZXJpZmllZElkKSksIHMucHVzaChtKCd1c19wcml2YWN5Jywgci51c1ByaXZhY3lTdHJpbmcpKSwgcy5wdXNoKGcoJ2dkcHInLCByLmdkcHJBcHBsaWVzLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVuY29kZVVSSUNvbXBvbmVudChlID8gMSA6IDApOwogICAgICAgICAgICAgICAgICAgICAgICB9KSksIHMucHVzaChtKCdnZHByX2NvbnNlbnQnLCByLmdkcHJDb25zZW50KSksIGkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5wdXNoKG0oZS5uYW1lLCBlLnZhbHVlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHMuc2xpY2UoKS5jb25jYXQodyhlKSksIHQgPSByZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJy5jb25jYXQoZiwgJy8nKS5jb25jYXQoYywgJy8nKS5jb25jYXQodSkuY29uY2F0KHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZTogZnVuY3Rpb24gKGUsIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUsIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gbi5nZXRDb29raWUocWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA/IGUoSlNPTi5wYXJzZShjKSkgOiB0LmFqYXhHZXQoZChpKSwgQmUobiwgci5kb21haW4sIGEsIGUpLCBvLCBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlLCBvLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8oKSwgeCgnSWRlbnRpdHlSZXNvbHZlJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFVybDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4KCdJZGVudGl0eVJlc29sdmVyJywgZSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmU6IGZ1bmN0aW9uIChuLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCgpLCB4KCdJZGVudGl0eVJlc29sdmVyLnJlc29sdmUnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRVcmw6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4KCdJZGVudGl0eVJlc29sdmVyLmdldFVybCcsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBLZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgWGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gWWUoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gW107CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGVbdF0gJiYgaChlW3RdKSA/IGVbdF0gOiAobi5wdXNoKHQpLCBYZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciByID0gewogICAgICAgICAgICAgICAgICAgICAgICBhamF4R2V0OiB0KCdhamF4R2V0JyksCiAgICAgICAgICAgICAgICAgICAgICAgIHBpeGVsR2V0OiB0KCdwaXhlbEdldCcpCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5sZW5ndGggPiAwICYmIEUoJ0NhbGxIYW5kbGVyJywgJ1RoZSBjYWxsIGZ1bmN0aW9ucyBcJycuY29uY2F0KEpTT04uc3RyaW5naWZ5KG4pLCAnXCcgYXJlIG5vdCBwcm92aWRlZCcpKSwgcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBaZSA9IHt9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZW4oZSwgbiwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChlICYmIGQoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmNvbmZpZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEUoJ1N0cmF5Q29uZmlnJywgJ1JlY2VpdmVkIGEgY29uZmlnIGFmdGVyIExDIGhhcyBhbHJlYWR5IGJlZW4gaW5pdGlhbGlzZWQnLCBuZXcgRXJyb3IoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC5jb21iaW5lV2l0aCh7IGV2ZW50U291cmNlOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgWmUuaGFzaGVkRW1haWwgPSBaZS5oYXNoZWRFbWFpbCB8fCByLmRhdGEuaGFzaGVkRW1haWw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHkoeyBldmVudFNvdXJjZTogZSB9LCBaZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnNlbmRBamF4KHQuY29tYmluZVdpdGgobykpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBFKCdFdmVudE5vdEFuT2JqZWN0JywgJ1JlY2VpdmVkIGV2ZW50IHdhcyBub3QgYW4gb2JqZWN0JywgbmV3IEVycm9yKGUpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG5uKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMocikgPyByLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW4oZSwgbiwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGVuKHIsIG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEUoJ0xDUHVzaCcsICdGYWlsZWQgc2VuZGluZyBhbiBldmVudCcsIGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHRuKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgfHwgKGUgPSA1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93IHx8IG4obmV3IEVycm9yKCdCdXMgY2FuIG9ubHkgYmUgYXR0YWNoZWQgdG8gdGhlIHdpbmRvdywgd2hpY2ggaXMgbm90IHByZXNlbnQnKSksIHdpbmRvdyAmJiAhd2luZG93Ll9fbGlfX2V2dF9idXMgJiYgKHdpbmRvdy5fX2xpX19ldnRfYnVzID0gbmV3IGooZSkpLCB3aW5kb3cuX19saV9fZXZ0X2J1czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gWWUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cgJiYgd2luZG93Ll9fbGlfX2V2dF9idXMgJiYgaCh3aW5kb3cuX19saV9fZXZ0X2J1cy5vbikgJiYgd2luZG93Ll9fbGlfX2V2dF9idXMub24oYiwgYmUpLCBnZSA9IG5ldyBPKGUsIG4pLCB2ZSA9IGUgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZSwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiBuW2VdICYmIGgobltlXSkgPyBuW2VdIDogKHQucHVzaChlKSwgS2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyhlLCBSZSkgPyBLZSA6IHIobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2NhbFN0b3JhZ2VJc0VuYWJsZWQ6IG8oJ2xvY2FsU3RvcmFnZUlzRW5hYmxlZCcpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29va2llOiByKCdnZXRDb29raWUnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldENvb2tpZTogbygnc2V0Q29va2llJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXREYXRhRnJvbUxvY2FsU3RvcmFnZTogcignZ2V0RGF0YUZyb21Mb2NhbFN0b3JhZ2UnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZURhdGFGcm9tTG9jYWxTdG9yYWdlOiBvKCdyZW1vdmVEYXRhRnJvbUxvY2FsU3RvcmFnZScpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0RGF0YUluTG9jYWxTdG9yYWdlOiBvKCdzZXREYXRhSW5Mb2NhbFN0b3JhZ2UnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmRTaW1pbGFyQ29va2llczogcignZmluZFNpbWlsYXJDb29raWVzJykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5sZW5ndGggPiAwICYmIEUoJ1N0b3JhZ2VIYW5kbGVyJywgJ1RoZSBzdG9yYWdlIGZ1bmN0aW9ucyBcJycuY29uY2F0KEpTT04uc3RyaW5naWZ5KHQpLCAnXCcgYXJlIG5vdCBwcm92aWRlZCcpKSwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZS5zdG9yYWdlU3RyYXRlZ3ksIG4pLCBpID0gZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jb21iaW5lV2l0aChuKGUuZGF0YSwgbykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgYyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6ZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5yZWR1Y2UoaSwgbmV3IHVlKGUpKSwgdSA9IGEucmVkdWNlKGksIGMpLCBmID0geShlLCB7IHBlb3BsZVZlcmlmaWVkSWQ6IHUuZGF0YS5wZW9wbGVWZXJpZmllZElkIH0pLCBsID0gbmV3IE8oZSwgciwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfKCdsaXBzJywgZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8oJ3ByZV9saXBzJywgJzAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBkID0gJGUodS5kYXRhLCBvLCByKSwgcCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCwgbiA9IG5ldyBBcnJheShlKSwgdCA9IDA7IHQgPCBlOyB0KyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bdF0gPSBhcmd1bWVudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5uKG4sIGwsIHUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1c2g6IHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAoe30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlb3BsZVZlcmlmaWVkSWQ6IHUuZGF0YS5wZW9wbGVWZXJpZmllZElkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVhZHk6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZTogZC5yZXNvbHZlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x1dGlvbkNhbGxVcmw6IGQuZ2V0VXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnOiBlCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBFKCdMQ0NvbnN0cnVjdGlvbicsICdGYWlsZWQgdG8gYnVpbGQgTEMnLCBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgcm4gPSBmdW5jdGlvbiAoZSwgbiwgdCkgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gd2luZG93LmxpUSB8fCBbXSwgbyA9IGQoZSkgJiYgZSB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdyAmJiAod2luZG93LmxpUSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdyAmJiB3aW5kb3cubGlRICYmIHdpbmRvdy5saVEucmVhZHkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gd2luZG93LmxpUS5jb25maWcgJiYgZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5hcHBJZCAhPT0gbi5hcHBJZCB8fCBlLndyYXBwZXJOYW1lICE9PSBuLndyYXBwZXJOYW1lIHx8IGUuY29sbGVjdG9yVXJsICE9PSBuLmNvbGxlY3RvclVybCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwcElkOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5hcHBJZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmFwcElkCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JhcHBlck5hbWU6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLndyYXBwZXJOYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ud3JhcHBlck5hbWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xsZWN0b3JVcmw6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmNvbGxlY3RvclVybCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmNvbGxlY3RvclVybAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh3aW5kb3cubGlRLmNvbmZpZywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbmV3IEVycm9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5uYW1lID0gJ0NvbmZpZ1NlbnQnLCB0Lm1lc3NhZ2UgPSAnQWRkaXRpb25hbCBjb25maWd1cmF0aW9uIHJlY2VpdmVkJywgRSgnTENEdXBsaWNhdGlvbicsIEpTT04uc3RyaW5naWZ5KG4pLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubGlROwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0obykgfHwgdG4obywgbiwgdCkgfHwgciksIGMocikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHIubGVuZ3RoOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LmxpUS5wdXNoKHJbaV0pOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgRSgnTENDb25zdHJ1Y3Rpb24nLCAnRmFpbGVkIHRvIGJ1aWxkIExDJywgZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubGlROwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG9uKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGQoZSkgJiYgZSB8fCB7fTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcm4ociwgbiwgdCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDU5MTogZnVuY3Rpb24gKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAociA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnID09PSByKGUpID8gSlNPTi5zdHJpbmdpZnkoZSkgOiAnJyArIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tvYmplY3QgQXJyYXldJyA9PT0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdC5kKG4sICdhJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBqOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgYSA9ICEhU3RyaW5nLnByb3RvdHlwZS50cmltOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPyAoJycgKyBlKS50cmltKCkgOiAoJycgKyBlKS5yZXBsYWNlKC9eW1xzXHVGRUZGXHhBMF0rfFtcc1x1RkVGRlx4QTBdKyQvZywgJycpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZihlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZSAmJiAnb2JqZWN0JyA9PT0gcihlKSAmJiAhaShlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiBjKGUpLmxlbmd0aCA+IDA7CiAgICAgICAgICAgICAgICAgICAgfShuKSA/IFsKICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgbCh0KSA/IHQobikgOiBuCiAgICAgICAgICAgICAgICAgICAgXSA6IFtdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMoZSwgbiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVuY29kZVVSSUNvbXBvbmVudChlKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoZSwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge30sIHIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYoZSkgPyBlIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8gPSByKGUpLCBpID0gcihuKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMobykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0W2VdID0gb1tlXTsKICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmtleXMoaSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0W2VdID0gaVtlXTsKICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBwID0gJ2xpX2Vycm9ycyc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICB3aW5kb3cgJiYgd2luZG93Ll9fbGlfX2V2dF9idXMgJiYgd2luZG93Ll9fbGlfX2V2dF9idXMuZW1pdChlLCBuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGcoZSwgbikgewogICAgICAgICAgICAgICAgICAgIG0oZSwgbi5tZXNzYWdlLCBuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oZSwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMl0gPyBhcmd1bWVudHNbMl0gOiB7fSwgciA9IG5ldyBFcnJvcihuIHx8IHQubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgci5zdGFjayA9IHQuc3RhY2ssIHIubmFtZSA9IGUgfHwgJ3Vua25vd24gZXJyb3InLCByLmxpbmVOdW1iZXIgPSB0LmxpbmVOdW1iZXIsIHIuY29sdW1uTnVtYmVyID0gdC5jb2x1bW5OdW1iZXIsIHYocCwgcik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB3KGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUgfHwge30sIG8gPSByLmlkZW50aXR5UmVzb2x1dGlvbkNvbmZpZyB8fCB7fSwgaSA9IHIucmV0cmlldmVkSWRlbnRpZmllcnMgfHwgW10sIGEgPSBvLnNvdXJjZSB8fCAndW5rbm93bicsIGMgPSBvLnB1Ymxpc2hlcklkIHx8ICdhbnknLCB1ID0gby51cmwgfHwgJ2h0dHBzOi8vaWR4LmxpYWRtLmNvbS9pZGV4JywgbCA9IG8uYWpheFRpbWVvdXQgfHwgNTAwMCwgaCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBoLnB1c2goZCgnZHVpZCcsIHIucGVvcGxlVmVyaWZpZWRJZCkpLCBoLnB1c2goZCgndXNfcHJpdmFjeScsIHIudXNQcml2YWN5U3RyaW5nKSksIGgucHVzaChzKCdnZHByJywgci5nZHByQXBwbGllcywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQoZSA/IDEgOiAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBoLnB1c2goZCgnZ2Rwcl9jb25zZW50Jywgci5nZHByQ29uc2VudCkpLCBpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgucHVzaChkKGUubmFtZSwgZS52YWx1ZSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAwID09PSBuLmxlbmd0aCA/ICc/JyA6ICcmJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgJiYgZS5sZW5ndGggJiYgMiA9PT0gZS5sZW5ndGggJiYgZVswXSAmJiBlWzFdICYmIChuID0gJycuY29uY2F0KG4pLmNvbmNhdCh0KS5jb25jYXQoZVswXSwgJz0nKS5jb25jYXQoZVsxXSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGguc2xpY2UoKS5jb25jYXQoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZihlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgIWYocikgJiYgci5sZW5ndGggJiYgbi5wdXNoKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2RlVVJJQ29tcG9uZW50KHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmNvZGVVUklDb21wb25lbnQocikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnLmNvbmNhdCh1LCAnLycpLmNvbmNhdChhLCAnLycpLmNvbmNhdChjKS5jb25jYXQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2ID0gZnVuY3Rpb24gKGUsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmFqYXhHZXQocChyKSwgZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IEpTT04ucGFyc2UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnKCdJZGVudGl0eVJlc29sdmVyUGFyc2VyJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KDAsIGUpLCBuLCBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlOiBmdW5jdGlvbiAoZSwgbiwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYoZSwgbiwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKCksIGcoJ0lkZW50aXR5UmVzb2x2ZScsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRVcmw6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZygnSWRlbnRpdHlSZXNvbHZlcicsIGUpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlOiBmdW5jdGlvbiAobiwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoKSwgZygnSWRlbnRpdHlSZXNvbHZlci5yZXNvbHZlJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VXJsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZygnSWRlbnRpdHlSZXNvbHZlci5nZXRVcmwnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gL1xTKyhAfCU0MClcUytcLlxTKy8udGVzdChlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBiID0gLyIoW14iXSsoQHwlNDApW14iXStbLl1bYS16XSooXHMrKT8pKFxcInwiKS87CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBTKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi50ZXN0KGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSShlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmlkZW50aWZpZXJzVG9SZXNvbHZlID0gZS5pZGVudGlmaWVyc1RvUmVzb2x2ZSB8fCBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBpKGUuaWRlbnRpZmllcnNUb1Jlc29sdmUpID8gZS5pZGVudGlmaWVyc1RvUmVzb2x2ZSA6IG8oZS5pZGVudGlmaWVyc1RvUmVzb2x2ZSkuc3BsaXQoJywnKSwgciA9IFtdLCBhID0gMDsgYSA8IHQubGVuZ3RoOyBhKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IGModFthXSksIGYgPSBuLmdldENvb2tpZSh1KSB8fCBuLmdldERhdGFGcm9tTG9jYWxTdG9yYWdlKHUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFmIHx8IFMobyhmKSkgfHwgeShvKGYpKSB8fCByLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbyhmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsgcmV0cmlldmVkSWRlbnRpZmllcnM6IHIgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfShlLCBuKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnKCdJZGVudGlmaWVyc0VucmljaCcsIGUpLCB7fTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgQyA9ICdub25lJywgXyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24geChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gJiYgbltlXSAmJiBsKG5bZV0pID8gbltlXSA6ICh0LnB1c2goZSksIF8pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgbywgaSwgYSwgZiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsU3RvcmFnZUlzRW5hYmxlZDogKG8gPSAnbG9jYWxTdG9yYWdlSXNFbmFibGVkJywgYSA9IEMsIHUoaSA9IGUpICYmIHUoYSkgJiYgYyhpLnRvTG93ZXJDYXNlKCkpID09PSBjKGEudG9Mb3dlckNhc2UoKSkgPyBfIDogcihvKSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDb29raWU6IHIoJ2dldENvb2tpZScpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RGF0YUZyb21Mb2NhbFN0b3JhZ2U6IHIoJ2dldERhdGFGcm9tTG9jYWxTdG9yYWdlJykKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5sZW5ndGggPiAwICYmIG0oJ1N0b3JhZ2VIYW5kbGVyJywgJ1RoZSBzdG9yYWdlIGZ1bmN0aW9ucyBcJycuY29uY2F0KEpTT04uc3RyaW5naWZ5KHQpLCAnXCcgYXJlIG5vdCBwcm92aWRlZCcpKSwgZjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBFID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE8oZSwgbiwgdCkgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlW3RdICYmIGwoZVt0XSkgPyBlW3RdIDogKG4ucHVzaCh0KSwgRSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhamF4R2V0OiB0KCdhamF4R2V0JyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpeGVsR2V0OiB0KCdwaXhlbEdldCcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5sZW5ndGggPiAwICYmIG0oJ0NhbGxIYW5kbGVyJywgJ1RoZSBjYWxsIGZ1bmN0aW9ucyBcJycuY29uY2F0KEpTT04uc3RyaW5naWZ5KG4pLCAnXCcgYXJlIG5vdCBwcm92aWRlZCcpKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0odCksIG8gPSB4KGUuc3RvcmFnZVN0cmF0ZWd5LCBuKSwgaSA9IGgoZSwgZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geyBwZW9wbGVWZXJpZmllZElkOiBuLmdldERhdGFGcm9tTG9jYWxTdG9yYWdlKCdfbGlfZHVpZCcpIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbSgnUGVvcGxlVmVyaWZpZWRFbnJpY2gnLCBlLm1lc3NhZ2UsIGUpLCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KDAsIG8pKSwgYSA9IHcoaChpLCBJKGksIG8pKSwgMCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXNoOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubGlRLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubGlRLnB1c2goe30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlb3BsZVZlcmlmaWVkSWQ6IGkucGVvcGxlVmVyaWZpZWRJZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYWR5OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmU6IGEucmVzb2x2ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdXRpb25DYWxsVXJsOiBhLmdldFVybCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZzogZQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBqKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93ICYmICh3aW5kb3cubGlRID0gd2luZG93LmxpUSB8fCBbXSksIE8oZihlKSAmJiBlIHx8IHt9LCBuLCB0KTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0sIFs1ODhdKTsKICAgICAgICBwYmpzQ2h1bmsoWzE5MV0sIHsKICAgICAgICAgICAgNjYwOiBmdW5jdGlvbiAoZSwgbiwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gdCg2NjEpOwogICAgICAgICAgICB9LAogICAgICAgICAgICA2NjE6IGZ1bmN0aW9uIChlLCBuLCB0KSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkobiwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgdC5kKG4sICduZXRJZFN1Ym1vZHVsZScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIGQgPSB0KDkpLCB1ID0gewogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnbmV0SWQnLAogICAgICAgICAgICAgICAgICAgICAgICBkZWNvZGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnc3RyaW5nJyA9PSB0eXBlb2YgZS5uZXRJZCA/IHsgbmV0SWQ6IGUubmV0SWQgfSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SWQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgT2JqZWN0KGQuZSkoJ3VzZXJJZCcsIHUpLCB3aW5kb3cucGJqcy5pbnN0YWxsZWRNb2R1bGVzLnB1c2goJ25ldElkU3lzdGVtJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCBbNjYwXSk7CiAgICAgICAgcGJqc0NodW5rKFsxODRdLCB7CiAgICAgICAgICAgIDY3NDogZnVuY3Rpb24gKGUsIGksIGEpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGEoNjc1KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgNjc1OiBmdW5jdGlvbiAoZSwgaSwgYSkgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGksICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIGEuZChpLCAnc3BlYycsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBhKDApLCB0ID0gYSgxKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoZSwgaSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgZnVuY3Rpb24gKGUsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBudWxsID09IGUgPyBudWxsIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIFN5bWJvbCAmJiBlW1N5bWJvbC5pdGVyYXRvcl0gfHwgZVsnQEBpdGVyYXRvciddOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgdCwgZCA9IFtdLCBvID0gITAsIG4gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IGEuY2FsbChlKTsgIShvID0gKHIgPSBhLm5leHQoKSkuZG9uZSkgJiYgKGQucHVzaChyLnZhbHVlKSwgIWkgfHwgZC5sZW5ndGggIT09IGkpOyBvID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gITAsIHQgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvIHx8IG51bGwgPT0gYS5yZXR1cm4gfHwgYS5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgfShlLCBpKSB8fCBmdW5jdGlvbiAoZSwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKGUsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChlKS5zbGljZSg4LCAtMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICdPYmplY3QnID09PSBhICYmIGUuY29uc3RydWN0b3IgJiYgKGEgPSBlLmNvbnN0cnVjdG9yLm5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ01hcCcgPT09IGEgfHwgJ1NldCcgPT09IGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdBcmd1bWVudHMnID09PSBhIHx8IC9eKD86VWl8SSludCg/Ojh8MTZ8MzIpKD86Q2xhbXBlZCk/QXJyYXkkLy50ZXN0KGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSwgaSk7CiAgICAgICAgICAgICAgICAgICAgfShlLCBpKSB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ludmFsaWQgYXR0ZW1wdCB0byBkZXN0cnVjdHVyZSBub24taXRlcmFibGUgaW5zdGFuY2UuXG5JbiBvcmRlciB0byBiZSBpdGVyYWJsZSwgbm9uLWFycmF5IG9iamVjdHMgbXVzdCBoYXZlIGEgW1N5bWJvbC5pdGVyYXRvcl0oKSBtZXRob2QuJyk7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgKG51bGwgPT0gaSB8fCBpID4gZS5sZW5ndGgpICYmIChpID0gZS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSAwLCByID0gbmV3IEFycmF5KGkpOyBhIDwgaTsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICByW2FdID0gZVthXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBuID0gewogICAgICAgICAgICAgICAgICAgIGNvZGU6ICdvbmVWaWRlbycsCiAgICAgICAgICAgICAgICAgICAgVkVSU0lPTjogJzMuMS4yJywKICAgICAgICAgICAgICAgICAgICBFTkRQT0lOVDogJ2h0dHBzOi8vYWRzLmFkYXB0di5hZHZlcnRpc2luZy5jb20vcnRiL29wZW5ydGI/ZXh0X2lkPScsCiAgICAgICAgICAgICAgICAgICAgRTJFVEVTVEVORFBPSU5UOiAnaHR0cHM6Ly9hZHMtd2Mudi5zc3AueWFob28uY29tL3J0Yi9vcGVucnRiP2V4dF9pZD0nLAogICAgICAgICAgICAgICAgICAgIFNZTkNfRU5EUE9JTlQxOiAnaHR0cHM6Ly9waXhlbC5hZHZlcnRpc2luZy5jb20vdXBzLzU3MzA0L3N5bmM/Z2Rwcj0mZ2Rwcl9jb25zZW50PSZfb3JpZ2luPTAmcmVkaXI9dHJ1ZScsCiAgICAgICAgICAgICAgICAgICAgU1lOQ19FTkRQT0lOVDI6ICdodHRwczovL21hdGNoLmFkc3J2ci5vcmcvdHJhY2svY21mL2dlbmVyaWM/dHRkX3BpZD1hZGFwdHYmdHRkX3RwaT0xJywKICAgICAgICAgICAgICAgICAgICBzdXBwb3J0ZWRNZWRpYVR5cGVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICd2aWRlbycsCiAgICAgICAgICAgICAgICAgICAgICAgICdiYW5uZXInCiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBpc0JpZFJlcXVlc3RWYWxpZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdvbmVWaWRlbycgIT09IGUuYmlkZGVyIHx8IHZvaWQgMCA9PT0gZS5wYXJhbXMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLnBhcmFtcyAmJiBlLnBhcmFtcy52aWRlbyAmJiBlLnBhcmFtcy52aWRlby5lMmV0ZXN0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBlLm1lZGlhVHlwZXMudmlkZW8gJiYgdm9pZCAwID09PSBlLm1lZGlhVHlwZXMuYmFubmVyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLmxvZ0Vycm9yKSgnRmFpbGVkIHZhbGlkYXRpb246IGFkVW5pdCBtZWRpYVR5cGVzLnZpZGVvIE9SIG1lZGlhVHlwZXMuYmFubmVyIG5vdCBkZWNsYXJlZCcpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUubWVkaWFUeXBlcy52aWRlbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gZS5tZWRpYVR5cGVzLnZpZGVvLnBsYXllclNpemUgJiYgZS5wYXJhbXMudmlkZW8gJiYgKHZvaWQgMCA9PT0gZS5wYXJhbXMudmlkZW8ucGxheWVyV2lkdGggfHwgdm9pZCAwID09PSBlLnBhcmFtcy52aWRlby5wbGF5ZXJIZWlnaHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qoci5sb2dFcnJvcikoJ0ZhaWxlZCB2YWxpZGF0aW9uOiBQbGF5ZXIgc2l6ZSBub3QgZGVjbGFyZWQgaW4gZWl0aGVyIG1lZGlhVHlwZXMucGxheWVyU2l6ZSBPUiBiaWQucGFyYW1zLnZpZGVvLnBsYXVlcldpZHRoICYgYmlkLnBhcmFtcy52aWRlby5wbGF5ZXJIZWlnaHQuJyksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gZS5tZWRpYVR5cGVzLnZpZGVvLm1pbWVzICYmICghZS5wYXJhbXMudmlkZW8gfHwgdm9pZCAwID09PSBlLnBhcmFtcy52aWRlby5taW1lcykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLmxvZ0Vycm9yKSgnRmFpbGVkIHZhbGlkYXRpb246IGFkVW5pdCBtZWRpYVR5cGVzLm1pbWVzIE9SIHBhcmFtcy52aWRlby5taW1lcyBub3QgZGVjbGFyZWQnKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ291dHN0cmVhbScgPT09IGUubWVkaWFUeXBlcy52aWRlby5jb250ZXh0ICYmIGUucGFyYW1zLnZpZGVvICYmIDEgPT09IGUucGFyYW1zLnZpZGVvLmRpc3BsYXkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLmxvZ0Vycm9yKSgnRmFpbGVkIHZhbGlkYXRpb246IER5bmFtaWMgQWQgUGxhY2VtZW50IGNhbm5vdCBiZSB1c2VkIHdpdGggY29udGV4dCBPdXRzdHJlYW0gKHBhcmFtcy52aWRlby5kaXNwbGF5PTEpJyksICExOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IGUucGFyYW1zLnB1YklkIHx8IChPYmplY3Qoci5sb2dFcnJvcikoJ0ZhaWxlZCB2YWxpZGF0aW9uOiBBZGFwdGVyIGNhbm5vdCBzZW5kIHJlcXVlc3RzIHdpdGhvdXQgYmlkLnBhcmFtcy5wdWJJZCcpLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBidWlsZFJlcXVlc3RzOiBmdW5jdGlvbiAoZSwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGkgPyBpLmdkcHJDb25zZW50IDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4uRU5EUE9JTlQsIHQgPSBlLnBhcmFtcy5wdWJJZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnBhcmFtcy52aWRlby5lMmV0ZXN0ICYmIChyID0gbi5FMkVURVNURU5EUE9JTlQsIHQgPSAnSEJFeGNoYW5nZScpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiByICsgdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBtKGUsIGEsIGkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZFJlcXVlc3Q6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaW50ZXJwcmV0UmVzcG9uc2U6IGZ1bmN0aW9uIChlLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCB0LCBkLCBvID0gaS5iaWRSZXF1ZXN0OwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IChlID0gZS5ib2R5KS5zZWF0YmlkWzBdLmJpZFswXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgYSAmJiAoYS5hZG0gfHwgYS5udXJsKSAmJiBhLnByaWNlID8gKHQgPSBzKG8uc2l6ZXMpLCAoZCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3RJZDogby5iaWRJZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlckNvZGU6IG4uY29kZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNwbTogYS5wcmljZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0aXZlSWQ6IGEuY3JpZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiB0LndpZHRoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiB0LmhlaWdodCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbmN5OiBlLmN1ciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR0bDogby5wYXJhbXMudmlkZW8udHRsID4gMCAmJiBvLnBhcmFtcy52aWRlby50dGwgPD0gMzYwMCA/IG8ucGFyYW1zLnZpZGVvLnR0bCA6IDMwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldFJldmVudWU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRVbml0Q29kZTogby5hZFVuaXRDb2RlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0YTogeyBhZHZlcnRpc2VyRG9tYWluczogYS5hZG9tYWluIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSkubWVkaWFUeXBlID0gby5tZWRpYVR5cGVzLmJhbm5lciA/ICdiYW5uZXInIDogJ3ZpZGVvJywgYS5udXJsID8gZC52YXN0VXJsID0gYS5udXJsIDogYS5hZG0gJiYgMSA9PT0gby5wYXJhbXMudmlkZW8uZGlzcGxheSA/IGQuYWQgPSBhLmFkbSA6IGEuYWRtICYmIChkLnZhc3RYbWwgPSBhLmFkbSksIG8ubWVkaWFUeXBlcy52aWRlbyAmJiAoZC5yZW5kZXJlciA9ICdvdXRzdHJlYW0nID09PSBvLm1lZGlhVHlwZXMudmlkZW8uY29udGV4dCA/IGZ1bmN0aW9uIChlLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnJlbmRlcmVyIHx8IChlLnJlbmRlcmVyID0ge30sIGUucmVuZGVyZXIudXJsID0gJ2h0dHBzOi8vY2RuLnZpZGlibGUudHYvcHJvZC9oYi1vdXRzdHJlYW0tcmVuZGVyZXIvcmVuZGVyZXIuanMnLCBlLnJlbmRlcmVyLnJlbmRlciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8yUGxheWVyUmVuZGVyKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDcwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfShvKSA6IHZvaWQgMCksIGQpIDogKE9iamVjdChyLmxvZ1dhcm4pKCdObyB2YWxpZCBiaWRzIGZyb20gJy5jb25jYXQobi5jb2RlLCAnIGJpZGRlcicpKSwgW10pOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZ2V0VXNlclN5bmNzOiBmdW5jdGlvbiAoZSwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzJdID8gYXJndW1lbnRzWzJdIDoge30sIHIgPSBhLmdkcHJBcHBsaWVzLCB0ID0gYS5jb25zZW50U3RyaW5nLCBkID0gdm9pZCAwID09PSB0ID8gJycgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5waXhlbEVuYWJsZWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2ltYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBuLlNZTkNfRU5EUE9JTlQxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdpbWFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vc3luYy10bS5ldmVyZXN0dGVjaC5uZXQvdXBpL3BpZC9tN3k1dDkzaz9nZHByPScuY29uY2F0KHIgPyAxIDogMCwgJyZnZHByX2NvbnNlbnQ9JykuY29uY2F0KGQsICcmcmVkaXI9aHR0cHMlM0ElMkYlMkZwaXhlbC5hZHZlcnRpc2luZy5jb20lMkZ1cHMlMkY1NTk4NiUyRnN5bmMlM0Z1aWQlM0QlMjQlN0JVU0VSX0lEJTdEJTI2X29yaWdpbiUzRDAnKSArIGVuY29kZVVSSSgnJmdkcHI9Jy5jb25jYXQociA/IDEgOiAwLCAnJmdkcHJfY29uc2VudD0nKS5jb25jYXQoZCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdpbWFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbi5TWU5DX0VORFBPSU5UMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBpID0gT2JqZWN0KHIucGFyc2VTaXplc0lucHV0KShlKSwgYSA9IGQoaS5sZW5ndGggPyBpWzBdLnNwbGl0KCd4JykgOiBbXSwgMiksIHQgPSBhWzBdLCBvID0gYVsxXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogcGFyc2VJbnQodCwgMTApIHx8IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBwYXJzZUludChvLCAxMCkgfHwgdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFlIHx8ICFlLmdkcHJBcHBsaWVzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oZSwgaSwgYSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYS5yZWZlcmVySW5mby5yZWZlcmVyLCBkID0gZS5wYXJhbXMuc2l0ZSAmJiBlLnBhcmFtcy5zaXRlLnBhZ2UgPyBlLnBhcmFtcy5zaXRlLnBhZ2UgOiB0LmhyZWYsIG8gPSBlLnBhcmFtcy5zaXRlICYmIGUucGFyYW1zLnNpdGUucmVmZXJyZXIgPyBlLnBhcmFtcy5zaXRlLnJlZmVycmVyIDogYS5yZWZlcmVySW5mby5yZWZlcmVyLCBtID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVuY3k6IGUucGFyYW1zLmN1ciB8fCAnVVNEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lZGlhVHlwZTogJ3ZpZGVvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6ICcqJwogICAgICAgICAgICAgICAgICAgICAgICB9LCB2ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IE9iamVjdChyLmdlbmVyYXRlVVVJRCkoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0OiAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaW1wOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJzEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWN1cmU6ICdodHRwczonID09PSBkb2N1bWVudC5sb2NhdGlvbi5wcm90b2NvbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYjogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWJpZHZlcjogJzYuNi4wJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkYXB0ZXJ2ZXI6IG4uVkVSU0lPTgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXRlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWY6IG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2U6IHsgdWE6IG5hdmlnYXRvci51c2VyQWdlbnQgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRtYXg6IDIwMAogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IGUucGFyYW1zLnZpZGVvLmRpc3BsYXkgfHwgMSAhPSBlLnBhcmFtcy52aWRlby5kaXNwbGF5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2LmltcFswXS52aWRlbyA9IHsgbGluZWFyaXR5OiAxIH0sIGUucGFyYW1zLnZpZGVvLnBsYXllcldpZHRoICYmIGUucGFyYW1zLnZpZGVvLnBsYXllckhlaWdodCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuaW1wWzBdLnZpZGVvLncgPSBlLnBhcmFtcy52aWRlby5wbGF5ZXJXaWR0aCwgdi5pbXBbMF0udmlkZW8uaCA9IGUucGFyYW1zLnZpZGVvLnBsYXllckhlaWdodDsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHMoZS5tZWRpYVR5cGVzLnZpZGVvLnBsYXllclNpemUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5pbXBbMF0udmlkZW8udyA9IGMud2lkdGgsIHYuaW1wWzBdLnZpZGVvLmggPSBjLmhlaWdodDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlLnBhcmFtcy52aWRlby5taW1lcyA/IHYuaW1wWzBdLnZpZGVvLm1pbWVzID0gZS5wYXJhbXMudmlkZW8ubWltZXMgOiB2LmltcFswXS52aWRlby5taW1lcyA9IGUubWVkaWFUeXBlcy52aWRlby5taW1lcywgKGUubWVkaWFUeXBlcy52aWRlby5tYXhiaXRyYXRlIHx8IGUucGFyYW1zLnZpZGVvLm1heGJpdHJhdGUpICYmICh2LmltcFswXS52aWRlby5tYXhiaXRyYXRlID0gZS5wYXJhbXMudmlkZW8ubWF4Yml0cmF0ZSB8fCBlLm1lZGlhVHlwZXMudmlkZW8ubWF4Yml0cmF0ZSksIChlLm1lZGlhVHlwZXMudmlkZW8ubWF4ZHVyYXRpb24gfHwgZS5wYXJhbXMudmlkZW8ubWF4ZHVyYXRpb24pICYmICh2LmltcFswXS52aWRlby5tYXhkdXJhdGlvbiA9IGUucGFyYW1zLnZpZGVvLm1heGR1cmF0aW9uIHx8IGUubWVkaWFUeXBlcy52aWRlby5tYXhkdXJhdGlvbiksIChlLm1lZGlhVHlwZXMudmlkZW8ubWluZHVyYXRpb24gfHwgZS5wYXJhbXMudmlkZW8ubWluZHVyYXRpb24pICYmICh2LmltcFswXS52aWRlby5taW5kdXJhdGlvbiA9IGUucGFyYW1zLnZpZGVvLm1pbmR1cmF0aW9uIHx8IGUubWVkaWFUeXBlcy52aWRlby5taW5kdXJhdGlvbiksIChlLm1lZGlhVHlwZXMudmlkZW8uYXBpIHx8IGUucGFyYW1zLnZpZGVvLmFwaSkgJiYgKHYuaW1wWzBdLnZpZGVvLmFwaSA9IGUucGFyYW1zLnZpZGVvLmFwaSB8fCBlLm1lZGlhVHlwZXMudmlkZW8uYXBpKSwgKGUubWVkaWFUeXBlcy52aWRlby5kZWxpdmVyeSB8fCBlLnBhcmFtcy52aWRlby5kZWxpdmVyeSkgJiYgKHYuaW1wWzBdLnZpZGVvLmRlbGl2ZXJ5ID0gZS5wYXJhbXMudmlkZW8uZGVsaXZlcnkgfHwgZS5tZWRpYVR5cGVzLnZpZGVvLmRlbGl2ZXJ5KSwgKGUubWVkaWFUeXBlcy52aWRlby5wb3NpdGlvbiB8fCBlLnBhcmFtcy52aWRlby5wb3NpdGlvbikgJiYgKHYuaW1wWzBdLnZpZGVvLnBvcyA9IGUucGFyYW1zLnZpZGVvLnBvc2l0aW9uIHx8IGUubWVkaWFUeXBlcy52aWRlby5wb3NpdGlvbiksIChlLm1lZGlhVHlwZXMudmlkZW8ucGxheWJhY2ttZXRob2QgfHwgZS5wYXJhbXMudmlkZW8ucGxheWJhY2ttZXRob2QpICYmICh2LmltcFswXS52aWRlby5wbGF5YmFja21ldGhvZCA9IGUucGFyYW1zLnZpZGVvLnBsYXliYWNrbWV0aG9kIHx8IGUubWVkaWFUeXBlcy52aWRlby5wbGF5YmFja21ldGhvZCksIChlLm1lZGlhVHlwZXMudmlkZW8ucGxhY2VtZW50IHx8IGUucGFyYW1zLnZpZGVvLnBsYWNlbWVudCkgJiYgKHYuaW1wWzBdLnZpZGVvLnBsYWNlbWVudCA9IGUucGFyYW1zLnZpZGVvLnBsYWNlbWVudCB8fCBlLm1lZGlhVHlwZXMudmlkZW8ucGxhY2VtZW50KSwgZS5wYXJhbXMudmlkZW8ucmV3YXJkZWQgJiYgKHYuaW1wWzBdLmV4dC5yZXdhcmRlZCA9IGUucGFyYW1zLnZpZGVvLnJld2FyZGVkKSwgKGUubWVkaWFUeXBlcy52aWRlby5saW5lYXJpdHkgfHwgZS5wYXJhbXMudmlkZW8ubGluZWFyaXR5KSAmJiAodi5pbXBbMF0udmlkZW8ubGluZWFyaXR5ID0gZS5wYXJhbXMudmlkZW8ubGluZWFyaXR5IHx8IGUubWVkaWFUeXBlcy52aWRlby5saW5lYXJpdHkgfHwgMSksIChlLm1lZGlhVHlwZXMudmlkZW8ucHJvdG9jb2xzIHx8IGUucGFyYW1zLnZpZGVvLnByb3RvY29scykgJiYgKHYuaW1wWzBdLnZpZGVvLnByb3RvY29scyA9IGUucGFyYW1zLnZpZGVvLnByb3RvY29scyB8fCBlLm1lZGlhVHlwZXMudmlkZW8ucHJvdG9jb2xzIHx8IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA1CiAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAxID09IGUucGFyYW1zLnZpZGVvLmRpc3BsYXkgJiYgKG0ubWVkaWFUeXBlID0gJ2Jhbm5lcicsIHYuaW1wWzBdLmJhbm5lciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbWVzOiBlLnBhcmFtcy52aWRlby5taW1lcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHc6IGUucGFyYW1zLnZpZGVvLnBsYXllcldpZHRoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaDogZS5wYXJhbXMudmlkZW8ucGxheWVySGVpZ2h0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zOiBlLnBhcmFtcy52aWRlby5wb3NpdGlvbgogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnBhcmFtcy52aWRlby5wbGFjZW1lbnQgJiYgKHYuaW1wWzBdLmJhbm5lci5wbGFjZW1lbnQgPSBlLnBhcmFtcy52aWRlby5wbGFjZW1lbnQpLCBlLnBhcmFtcy52aWRlby5tYXhkdXJhdGlvbiAmJiAodi5pbXBbMF0uYmFubmVyLmV4dCA9IHYuaW1wWzBdLmJhbm5lci5leHQgfHwge30sIHYuaW1wWzBdLmJhbm5lci5leHQubWF4ZHVyYXRpb24gPSBlLnBhcmFtcy52aWRlby5tYXhkdXJhdGlvbiksIGUucGFyYW1zLnZpZGVvLm1pbmR1cmF0aW9uICYmICh2LmltcFswXS5iYW5uZXIuZXh0ID0gdi5pbXBbMF0uYmFubmVyLmV4dCB8fCB7fSwgdi5pbXBbMF0uYmFubmVyLmV4dC5taW5kdXJhdGlvbiA9IGUucGFyYW1zLnZpZGVvLm1pbmR1cmF0aW9uKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChyLmlzRm4pKGUuZ2V0Rmxvb3IpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gZS5nZXRGbG9vcihtKTsKICAgICAgICAgICAgICAgICAgICAgICAgdi5pbXBbMF0uYmlkZmxvb3IgPSBsLmZsb29yLCB2LmN1ciA9IGwuY3VycmVuY3k7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIHYuaW1wWzBdLmJpZGZsb29yID0gZS5wYXJhbXMuYmlkZmxvb3I7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUucGFyYW1zLnZpZGVvLmludmVudG9yeWlkICYmICh2LmltcFswXS5leHQuaW52ZW50b3J5aWQgPSBlLnBhcmFtcy52aWRlby5pbnZlbnRvcnlpZCksIGUucGFyYW1zLnZpZGVvLnNpZCA/ICh2LnNvdXJjZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjaGFpbjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wbGV0ZTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9kZXM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2lkOiBlLnBhcmFtcy52aWRlby5zaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlkOiB2LmlkCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgMSA9PSBlLnBhcmFtcy52aWRlby5ocCAmJiAodi5zb3VyY2UuZXh0LnNjaGFpbi5ub2Rlc1swXS5ocCA9IGUucGFyYW1zLnZpZGVvLmhwKSkgOiBlLnNjaGFpbiAmJiAodi5zb3VyY2UgPSB7IGV4dDogeyBzY2hhaW46IGUuc2NoYWluIH0gfSwgdi5zb3VyY2UuZXh0LnNjaGFpbi5ub2Rlc1swXS5yaWQgPSB2LmlkKSwgZS5wYXJhbXMuc2l0ZSAmJiBlLnBhcmFtcy5zaXRlLmlkICYmICh2LnNpdGUuaWQgPSBlLnBhcmFtcy5zaXRlLmlkKSwgKHAoaSkgfHwgYSAmJiBhLnVzcENvbnNlbnQpICYmICh2LnJlZ3MgPSB7IGV4dDoge30gfSwgcChpKSAmJiAodi5yZWdzLmV4dC5nZHByID0gMSksIGkgJiYgaS5jb25zZW50U3RyaW5nICYmICh2LnVzZXIgPSB7IGV4dDogeyBjb25zZW50OiBpLmNvbnNlbnRTdHJpbmcgfSB9KSwgYSAmJiBhLnVzcENvbnNlbnQgJiYgKHYucmVncy5leHQudXNfcHJpdmFjeSA9IGEudXNwQ29uc2VudCkpLCBlLnBhcmFtcy52aWRlby5lMmV0ZXN0ICYmIChPYmplY3Qoci5sb2dNZXNzYWdlKSgnRTJFIHRlc3QgbW9kZSBlbmFibGVkOiBcbiBUaGUgZm9sbG93aW5nIHBhcmFtZXRlcnMgYXJlIGJlaW5nIG92ZXJyaWRkZW4gYnkgZTJldGVzdCBtb2RlOlxuKiBiaWRmbG9vcjpudWxsXG4qIHdpZHRoOjMwMFxuKiBoZWlnaHQ6MjUwXG4qIG1pbWVzOiB2aWRlby9tcDQsIGFwcGxpY2F0aW9uL2phdmFzY3JpcHRcbiogYXBpOjJcbiogc2l0ZS5wYWdlL3JlZjogdmVyaXpvbm1lZGlhLmNvbVxuKiB0bWF4OjEwMDAnKSwgdi5pbXBbMF0uYmlkZmxvb3IgPSBudWxsLCB2LmltcFswXS52aWRlby53ID0gMzAwLCB2LmltcFswXS52aWRlby5oID0gMjUwLCB2LmltcFswXS52aWRlby5taW1lcyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2aWRlby9tcDQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FwcGxpY2F0aW9uL2phdmFzY3JpcHQnCiAgICAgICAgICAgICAgICAgICAgICAgIF0sIHYuaW1wWzBdLnZpZGVvLmFwaSA9IFsyXSwgdi5zaXRlLnBhZ2UgPSAnaHR0cHM6Ly92ZXJpem9ubWVkaWEuY29tJywgdi5zaXRlLnJlZiA9ICdodHRwczovL3Zlcml6b25tZWRpYS5jb20nLCB2LnRtYXggPSAxMDAwKSwgZS5wYXJhbXMudmlkZW8uY3VzdG9tICYmIE9iamVjdChyLmlzUGxhaW5PYmplY3QpKGUucGFyYW1zLnZpZGVvLmN1c3RvbSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHUgaW4gKHYuaW1wWzBdLmV4dC5jdXN0b20gPSB7fSwgZS5wYXJhbXMudmlkZW8uY3VzdG9tKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChPYmplY3Qoci5pc1N0cikoZS5wYXJhbXMudmlkZW8uY3VzdG9tW3VdKSB8fCBPYmplY3Qoci5pc051bWJlcikoZS5wYXJhbXMudmlkZW8uY3VzdG9tW3VdKSkgJiYgKHYuaW1wWzBdLmV4dC5jdXN0b21bdV0gPSBlLnBhcmFtcy52aWRlby5jdXN0b21bdV0pOwogICAgICAgICAgICAgICAgICAgIGlmIChlLnBhcmFtcy52aWRlby5jb250ZW50ICYmIE9iamVjdChyLmlzUGxhaW5PYmplY3QpKGUucGFyYW1zLnZpZGVvLmNvbnRlbnQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHYuc2l0ZS5jb250ZW50ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB5ID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RpdGxlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2VyaWVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2Vhc29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ2VucmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb250ZW50cmF0aW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGFuZ3VhZ2UnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBiID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlcGlzb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJvZHEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb250ZXh0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGl2ZXN0cmVhbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2xlbicKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIGggPSBbJ2NhdCddLCBmID0gWydleHQnXTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyBpbiBlLnBhcmFtcy52aWRlby5jb250ZW50KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5pbmRleE9mKGcpID4gLTEgJiYgT2JqZWN0KHIuaXNTdHIpKGUucGFyYW1zLnZpZGVvLmNvbnRlbnRbZ10pIHx8IGIuaW5kZXhPZihnKSA+IC0xICYmIE9iamVjdChyLmlzTnVtYmVyKShlLnBhcmFtcy52aWRlby5jb250ZW50W2ddKSB8fCBmLmluZGV4T2YoZykgPiAtMSAmJiBPYmplY3Qoci5pc1BsYWluT2JqZWN0KShlLnBhcmFtcy52aWRlby5jb250ZW50W2ddKSB8fCBoLmluZGV4T2YoZykgPiAtMSAmJiBPYmplY3Qoci5pc0FycmF5KShlLnBhcmFtcy52aWRlby5jb250ZW50W2ddKSAmJiBlLnBhcmFtcy52aWRlby5jb250ZW50W2ddLmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLmlzU3RyKShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pID8gdi5zaXRlLmNvbnRlbnRbZ10gPSBlLnBhcmFtcy52aWRlby5jb250ZW50W2ddIDogT2JqZWN0KHIubG9nTWVzc2FnZSkoJ29uZVZpZGVvIGJpZCBhZGFwdGVyIHZhbGlkYXRpb24gZXJyb3I6ICcsIGcsICcgaXMgZWl0aGVyIG5vdCBzdXBwb3J0ZWQgaXMgT3BlblJUQiBWMi41IG9yIHZhbHVlIGlzIHVuZGVmaW5lZCcpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIE9iamVjdCh0LnJlZ2lzdGVyQmlkZGVyKShuKSwgd2luZG93LnBianMuaW5zdGFsbGVkTW9kdWxlcy5wdXNoKCdvbmVWaWRlb0JpZEFkYXB0ZXInKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIFs2NzRdKTsKICAgICAgICBwYmpzQ2h1bmsoWzE4MV0sIHsKICAgICAgICAgICAgNjg2OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gbig2ODcpOwogICAgICAgICAgICB9LAogICAgICAgICAgICA2ODc6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgbi5kKHQsICdVU0VSX0lEX0NPREVfVE9fUVVFUllfQVJHJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSksIG4uZCh0LCAnc3BlYycsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDApLCBhID0gbigzKSwgaSA9IG4oMSksIG8gPSBuKDIpLCBkID0gbigxMiksIGMgPSBuLm4oZCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHMgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGUuY29uc3RydWN0b3IgPT09IFN5bWJvbCAmJiBlICE9PSBTeW1ib2wucHJvdG90eXBlID8gJ3N5bWJvbCcgOiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9KShlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBudWxsID09IGUgPyBudWxsIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIFN5bWJvbCAmJiBlW1N5bWJvbC5pdGVyYXRvcl0gfHwgZVsnQEBpdGVyYXRvciddOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgYSwgaSA9IFtdLCBvID0gITAsIGQgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IG4uY2FsbChlKTsgIShvID0gKHIgPSBuLm5leHQoKSkuZG9uZSkgJiYgKGkucHVzaChyLnZhbHVlKSwgIXQgfHwgaS5sZW5ndGggIT09IHQpOyBvID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gITAsIGEgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvIHx8IG51bGwgPT0gbi5yZXR1cm4gfHwgbi5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgICAgICAgICAgfShlLCB0KSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChlKS5zbGljZSg4LCAtMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICdPYmplY3QnID09PSBuICYmIGUuY29uc3RydWN0b3IgJiYgKG4gPSBlLmNvbnN0cnVjdG9yLm5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ01hcCcgPT09IG4gfHwgJ1NldCcgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdBcmd1bWVudHMnID09PSBuIHx8IC9eKD86VWl8SSludCg/Ojh8MTZ8MzIpKD86Q2xhbXBlZCk/QXJyYXkkLy50ZXN0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgfShlLCB0KSB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ludmFsaWQgYXR0ZW1wdCB0byBkZXN0cnVjdHVyZSBub24taXRlcmFibGUgaW5zdGFuY2UuXG5JbiBvcmRlciB0byBiZSBpdGVyYWJsZSwgbm9uLWFycmF5IG9iamVjdHMgbXVzdCBoYXZlIGEgW1N5bWJvbC5pdGVyYXRvcl0oKSBtZXRob2QuJyk7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgKG51bGwgPT0gdCB8fCB0ID4gZS5sZW5ndGgpICYmICh0ID0gZS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0gbmV3IEFycmF5KHQpOyBuIDwgdDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICByW25dID0gZVtuXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBtID0gWwogICAgICAgICAgICAgICAgICAgICAgICBvLmIsCiAgICAgICAgICAgICAgICAgICAgICAgIG8uZAogICAgICAgICAgICAgICAgICAgIF0sIGwgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICdzdGFydGRlbGF5JywKICAgICAgICAgICAgICAgICAgICAgICAgJ21pbWVzJywKICAgICAgICAgICAgICAgICAgICAgICAgJ21pbmR1cmF0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgJ21heGR1cmF0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3N0YXJ0ZGVsYXknLAogICAgICAgICAgICAgICAgICAgICAgICAnc2tpcHBhYmxlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3BsYXliYWNrbWV0aG9kJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2FwaScsCiAgICAgICAgICAgICAgICAgICAgICAgICdwcm90b2NvbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAnYm94aW5nYWxsb3dlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdsaW5lYXJpdHknLAogICAgICAgICAgICAgICAgICAgICAgICAnZGVsaXZlcnknLAogICAgICAgICAgICAgICAgICAgICAgICAncHJvdG9jb2wnLAogICAgICAgICAgICAgICAgICAgICAgICAncGxhY2VtZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgJ21pbmJpdHJhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnbWF4Yml0cmF0ZScKICAgICAgICAgICAgICAgICAgICBdLCBiID0gewogICAgICAgICAgICAgICAgICAgICAgICBicml0ZXBvb2xpZDogJ2JyaXRlcG9vbGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgY3JpdGVvSWQ6ICdjcml0ZW9pZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZhYnJpY2tJZDogJ251ZXN0YXJpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGhhbG9JZDogJ2F1ZGlnZW50aWQnLAogICAgICAgICAgICAgICAgICAgICAgICBpZDVpZDogJ2lkNWlkJywKICAgICAgICAgICAgICAgICAgICAgICAgaWRsX2VudjogJ2xyZScsCiAgICAgICAgICAgICAgICAgICAgICAgIElEUDogJ3plb3RhcGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgaWR4SWQ6ICdpZHhpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGludGVudElxSWQ6ICdpbnRlbnRpcWlkJywKICAgICAgICAgICAgICAgICAgICAgICAgbGlwYjogJ2xpcGJpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGxvdGFtZVBhbm9yYW1hSWQ6ICdsb3RhbWVpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIG1lcmtsZUlkOiAnbWVya2xlaWQnLAogICAgICAgICAgICAgICAgICAgICAgICBuZXRJZDogJ25ldGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgcGFycmFibGVJZDogJ3BhcnJhYmxlaWQnLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJjaWQ6ICdwdWJjaWQnLAogICAgICAgICAgICAgICAgICAgICAgICBxdWFudGNhc3RJZDogJ3F1YW50Y2FzdGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgdGFwYWRJZDogJ3RhcGFkaWQnLAogICAgICAgICAgICAgICAgICAgICAgICB0ZGlkOiAndHRkdXVpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHVpZDI6ICd1aWQyJywKICAgICAgICAgICAgICAgICAgICAgICAgZmxvY0lkOiAnZmxvYycsCiAgICAgICAgICAgICAgICAgICAgICAgIGFkbWl4ZXJJZDogJ2FkbWl4ZXJpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBpbnRlbnRJZDogJ2RlZXBpbnRlbnRpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGRtZElkOiAnZG1kaWQnLAogICAgICAgICAgICAgICAgICAgICAgICBuZXh0cm9sbElkOiAnbmV4dHJvbGxpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIG5vdmF0aXE6ICdub3ZhdGlxaWQnLAogICAgICAgICAgICAgICAgICAgICAgICBtd09wZW5MaW5rSWQ6ICdtd29wZW5saW5raWQnLAogICAgICAgICAgICAgICAgICAgICAgICBkYXBJZDogJ2RhcGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgYW14SWQ6ICdhbXhpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGtwdWlkOiAna3B1aWQnLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaW5rSWQ6ICdwdWJsaW5raWQnLAogICAgICAgICAgICAgICAgICAgICAgICBuYXZlZ2dJZDogJ25hdmVnZ2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgaW11aWQ6ICdpbXVpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGFkdGVsbGlnZW50SWQ6ICdhZHRlbGxpZ2VudGlkJwogICAgICAgICAgICAgICAgICAgIH0sIGYgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6ICdvcGVueCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGd2bGlkOiA2OSwKICAgICAgICAgICAgICAgICAgICAgICAgc3VwcG9ydGVkTWVkaWFUeXBlczogbSwKICAgICAgICAgICAgICAgICAgICAgICAgaXNCaWRSZXF1ZXN0VmFsaWQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucGFyYW1zLmRlbERvbWFpbiB8fCBlLnBhcmFtcy5wbGF0Zm9ybTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qoci5kZWVwQWNjZXNzKShlLCAnbWVkaWFUeXBlcy5iYW5uZXInKSAmJiB0ID8gISFlLnBhcmFtcy51bml0IHx8IE9iamVjdChyLmRlZXBBY2Nlc3MpKGUsICdtZWRpYVR5cGVzLmJhbm5lci5zaXplcy5sZW5ndGgnKSA+IDAgOiAhKCFlLnBhcmFtcy51bml0IHx8ICF0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRSZXF1ZXN0czogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBlLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFtdLCBpID0gdShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPSB0LCBPYmplY3Qoci5kZWVwQWNjZXNzKShuLCAnbWVkaWFUeXBlcy52aWRlbycpICYmICFPYmplY3Qoci5kZWVwQWNjZXNzKShuLCAnbWVkaWFUeXBlcy5iYW5uZXInKSB8fCBuLm1lZGlhVHlwZSA9PT0gby5kID8gZVswXS5wdXNoKHQpIDogZVsxXS5wdXNoKHQpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSksIDIpLCBkID0gaVswXSwgcyA9IGlbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5sZW5ndGggPiAwICYmIG4ucHVzaChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gW10sIGkgPSAhMSwgZCA9IHYoZSwgdCksIGMgPSBPYmplY3Qoci5fbWFwKShlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucGFyYW1zLnVuaXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQuYXVzID0gT2JqZWN0KHIuX21hcCkoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLnBhcnNlU2l6ZXNJbnB1dCkoZS5tZWRpYVR5cGVzLmJhbm5lci5zaXplcykuam9pbignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJ3wnKSwgZC5kaXZpZHMgPSBPYmplY3Qoci5fbWFwKShlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW5jb2RlVVJJQ29tcG9uZW50KGUuYWRVbml0Q29kZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignLCcpLCBkLmF1Y3MgPSBPYmplY3Qoci5fbWFwKShlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdChyLmRlZXBBY2Nlc3MpKGUsICdvcnRiMkltcC5leHQuZGF0YS5wYmFkc2xvdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW5jb2RlVVJJQ29tcG9uZW50KHQgfHwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJywnKSwgYy5zb21lKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pICYmIChkLmF1aWQgPSBjLmpvaW4oJywnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zb21lKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnBhcmFtcy5kb05vdFRyYWNrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pICYmIChkLm5zID0gMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCEwID09PSBhLmIuZ2V0Q29uZmlnKCdjb3BwYScpIHx8IGUuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wYXJhbXMuY29wcGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpICYmIChkLnRmY2QgPSAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUucGFyYW1zLmN1c3RvbVBhcmFtcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3Qoci5fbWFwKShPYmplY3Qua2V5cyhlLnBhcmFtcy5jdXN0b21QYXJhbXMpLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChyLmlzQXJyYXkpKG4pICYmIChuID0gbi5qb2luKCcsJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlLnRvTG93ZXJDYXNlKCkgKyAnPScgKyBuLnRvTG93ZXJDYXNlKCkpLnJlcGxhY2UoJysnLCAnLicpLnJlcGxhY2UoJy8nLCAnXycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHQsIGUucGFyYW1zLmN1c3RvbVBhcmFtcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGEgPSB3aW5kb3cuYnRvYSh0LmpvaW4oJyYnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gITAsIG4ucHVzaChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnB1c2goJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpICYmIChkLnRwcyA9IG4uam9pbignLCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyhkLCBvLmIsIGUpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ0dFVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogZC5waCA/ICdodHRwczovL3Uub3BlbngubmV0L3cvMS4wL2FyaicgOiAnaHR0cHM6Ly8nLmNvbmNhdChlWzBdLnBhcmFtcy5kZWxEb21haW4sICcvdy8xLjAvYXJqJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBheWxvYWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZHM6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydFRpbWU6IG5ldyBEYXRlKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHMsIHQpKSwgZC5sZW5ndGggPiAwICYmIGQuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucHVzaChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgYSwgaSA9IE9iamVjdChyLmRlZXBBY2Nlc3MpKGUsICdtZWRpYVR5cGVzLnZpZGVvJyksIGQgPSB2KFtlXSwgdCksIHMgPSBPYmplY3Qoci5kZWVwQWNjZXNzKShlLCAncGFyYW1zLnZpZGVvJykgfHwge30sIHUgPSBPYmplY3Qoci5kZWVwQWNjZXNzKShlLCAnbWVkaWFUeXBlcy52aWRlby5jb250ZXh0JyksIHAgPSBPYmplY3Qoci5kZWVwQWNjZXNzKShlLCAnbWVkaWFUeXBlcy52aWRlby5wbGF5ZXJTaXplJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoci5pc0FycmF5KShlLnNpemVzKSAmJiAyID09PSBlLnNpemVzLmxlbmd0aCAmJiAhT2JqZWN0KHIuaXNBcnJheSkoZS5zaXplc1swXSkgPyAobiA9IHBhcnNlSW50KGUuc2l6ZXNbMF0sIDEwKSwgYSA9IHBhcnNlSW50KGUuc2l6ZXNbMV0sIDEwKSkgOiBPYmplY3Qoci5pc0FycmF5KShlLnNpemVzKSAmJiBPYmplY3Qoci5pc0FycmF5KShlLnNpemVzWzBdKSAmJiAyID09PSBlLnNpemVzWzBdLmxlbmd0aCA/IChuID0gcGFyc2VJbnQoZS5zaXplc1swXVswXSwgMTApLCBhID0gcGFyc2VJbnQoZS5zaXplc1swXVsxXSwgMTApKSA6IE9iamVjdChyLmlzQXJyYXkpKHApICYmIDIgPT09IHAubGVuZ3RoICYmIChuID0gcGFyc2VJbnQocFswXSwgMTApLCBhID0gcGFyc2VJbnQocFsxXSwgMTApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3OiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoOiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYiA9IGUucGFyYW1zLnZpZGVvIHx8IGUucGFyYW1zLm9wZW5ydGIgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLm9wZW5ydGIgJiYgKGIgPSBiLm9wZW5ydGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHIuaXNBcnJheSkoYi5pbXApICYmIChiID0gYi5pbXBbMF0udmlkZW8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoYikuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoKShsLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbVtlXSA9IGJbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmtleXMoaSkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoKShsLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbVtlXSA9IGlbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0geyBpbXA6IFt7IHZpZGVvOiBtIH1dIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLm9wZW5ydGIgPSBKU09OLnN0cmluZ2lmeShmKSwgZC5hdWlkID0gZS5wYXJhbXMudW5pdCwgZC52d2QgPSBuIHx8IHMudndkLCBkLnZodCA9IGEgfHwgcy52aHQsICdvdXRzdHJlYW0nID09PSB1ICYmIChkLnZvcyA9ICcxMDEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubWltZXMgJiYgKGQudm1pbWVzID0gcy5taW1lcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnBhcmFtcy50ZXN0ICYmIChkLnZ0ZXN0ID0gMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IE9iamVjdChyLmRlZXBBY2Nlc3MpKGUsICdvcnRiMkltcC5leHQuZGF0YS5wYmFkc2xvdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCAmJiAoZC5hdWNzID0gZW5jb2RlVVJJQ29tcG9uZW50KGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnKGQsIG8uZCwgW2VdKSwgZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ0dFVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IG4ucGggPyAnaHR0cHM6Ly91Lm9wZW54Lm5ldC92LzEuMC9hdmpwJyA6ICdodHRwczovLycuY29uY2F0KGUucGFyYW1zLmRlbERvbWFpbiwgJy92LzEuMC9hdmpwJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF5bG9hZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydFRpbWU6IG5ldyBEYXRlKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUsIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBpbnRlcnByZXRSZXNwb25zZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5ib2R5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC9hdmpwJC8udGVzdChlLnVybCkgPyBvLmQgOiBvLmI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHQpID09PSBvLmQgPyBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5iaWQsIGEgPSAodC5zdGFydFRpbWUsIFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBlICYmICcnICE9PSBlLnZhc3RVcmwgJiYgZS5wdWJfcmV2ID4gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IE9iamVjdChyLnBhcnNlVXJsKShlLnZhc3RVcmwpLnNlYXJjaCB8fCB7fSwgZCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnJlcXVlc3RJZCA9IG4uYmlkSWQsIGUuZGVhbF9pZCAmJiAoZC5kZWFsSWQgPSBlLmRlYWxfaWQpLCBkLnR0bCA9IDMwMCwgZC5uZXRSZXZlbnVlID0gITAsIGQuY3VycmVuY3kgPSBlLmN1cnJlbmN5LCBkLmNwbSA9IHBhcnNlSW50KGUucHViX3JldiwgMTApIC8gMTAwMCwgZC53aWR0aCA9IHBhcnNlSW50KGUud2lkdGgsIDEwKSwgZC5oZWlnaHQgPSBwYXJzZUludChlLmhlaWdodCwgMTApLCBkLmNyZWF0aXZlSWQgPSBlLmFkaWQsIGQudmFzdFVybCA9IGUudmFzdFVybCwgZC5tZWRpYVR5cGUgPSBvLmQsIGUucGggPSBpLnBoLCBlLmNvbG8gPSBpLmNvbG8sIGUudHMgPSBpLnRzLCBhLnB1c2goZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShuLCB0LnBheWxvYWQpIDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gdC5iaWRzLCByID0gKHQuc3RhcnRUaW1lLCBlLmFkcy5hZCksIGEgPSBbXSwgaSA9IDA7IGkgPCByLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gcltpXSwgZCA9IHBhcnNlSW50KG8uaWR4LCAxMCksIGMgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMucmVxdWVzdElkID0gbltkXS5iaWRJZCwgby5wdWJfcmV2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmNwbSA9IE51bWJlcihvLnB1Yl9yZXYpIC8gMTAwMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gby5jcmVhdGl2ZVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgJiYgKGMud2lkdGggPSBzLndpZHRoLCBjLmhlaWdodCA9IHMuaGVpZ2h0KSwgYy5jcmVhdGl2ZUlkID0gcy5pZCwgYy5hZCA9IG8uaHRtbCwgby5kZWFsX2lkICYmIChjLmRlYWxJZCA9IG8uZGVhbF9pZCksIGMudHRsID0gMzAwLCBjLm5ldFJldmVudWUgPSAhMCwgYy5jdXJyZW5jeSA9IG8uY3VycmVuY3ksIG8udGJkICYmIChjLnRiZCA9IG8udGJkKSwgYy50cyA9IG8udHMsIGMubWV0YSA9IHt9LCBvLmJyYW5kX2lkICYmIChjLm1ldGEuYnJhbmRJZCA9IG8uYnJhbmRfaWQpLCBvLmFkb21haW4gJiYgbGVuZ3RoKG8uYWRvbWFpbikgPiAwID8gYy5tZXRhLmFkdmVydGlzZXJEb21haW5zID0gby5hZG9tYWluIDogYy5tZXRhLmFkdmVydGlzZXJEb21haW5zID0gW10sIG8uYWR2X2lkICYmIChjLm1ldGEuZHNwaWQgPSBvLmFkdl9pZCksIGEucHVzaChjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0obiwgdC5wYXlsb2FkKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VXNlclN5bmNzOiBmdW5jdGlvbiAoZSwgdCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuaWZyYW1lRW5hYmxlZCB8fCBlLnBpeGVsRW5hYmxlZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGUuaWZyYW1lRW5hYmxlZCA/ICdpZnJhbWUnIDogJ2ltYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogT2JqZWN0KHIuZGVlcEFjY2VzcykodCwgJzAuYm9keS5hZHMucGl4ZWxzJykgfHwgT2JqZWN0KHIuZGVlcEFjY2VzcykodCwgJzAuYm9keS5waXhlbHMnKSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJ2h0dHBzOi8vdS5vcGVueC5uZXQvdy8xLjAvcGQnLCByID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiAoci5wdXNoKCdnZHByPScgKyAoZS5nZHByQXBwbGllcyA/IDEgOiAwKSksIHIucHVzaCgnZ2Rwcl9jb25zZW50PScgKyBlbmNvZGVVUklDb21wb25lbnQoZS5jb25zZW50U3RyaW5nIHx8ICcnKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgci5wdXNoKCd1c19wcml2YWN5PScgKyBlbmNvZGVVUklDb21wb25lbnQodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJy5jb25jYXQobikuY29uY2F0KHIubGVuZ3RoID4gMCA/ICc/JyArIHIuam9pbignJicpIDogJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShuLCBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtQmlkUGFyYW1zOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyLmNvbnZlcnRUeXBlcykoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuaXQ6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbUZsb29yOiAnbnVtYmVyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gaChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIsIGEgPSB3aW5kb3csIGkgPSBkb2N1bWVudCwgbyA9IGkuZG9jdW1lbnRFbGVtZW50OwogICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gd2luZG93LnRvcCwgaSA9IHdpbmRvdy50b3AuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBvID0gaS5kb2N1bWVudEVsZW1lbnQsIHIgPSBpLmJvZHksIHQgPSBhLmlubmVyV2lkdGggfHwgby5jbGllbnRXaWR0aCB8fCByLmNsaWVudFdpZHRoLCBuID0gYS5pbm5lckhlaWdodCB8fCBvLmNsaWVudEhlaWdodCB8fCByLmNsaWVudEhlaWdodDsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGkuZG9jdW1lbnRFbGVtZW50LCB0ID0gYS5pbm5lcldpZHRoIHx8IG8uY2xpZW50V2lkdGgsIG4gPSBhLmlubmVySGVpZ2h0IHx8IG8uY2xpZW50SGVpZ2h0OwogICAgICAgICAgICAgICAgICAgIHJldHVybiAnJy5jb25jYXQodCwgJ3gnKS5jb25jYXQobik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiwgaSA9IE9iamVjdChyLmluSWZyYW1lKSgpOwogICAgICAgICAgICAgICAgICAgIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGp1OiBhLmIuZ2V0Q29uZmlnKCdwYWdlVXJsJykgfHwgdC5yZWZlcmVySW5mby5yZWZlcmVyLAogICAgICAgICAgICAgICAgICAgICAgICBjaDogZG9jdW1lbnQuY2hhclNldCB8fCBkb2N1bWVudC5jaGFyYWN0ZXJTZXQsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlczogJycuY29uY2F0KHNjcmVlbi53aWR0aCwgJ3gnKS5jb25jYXQoc2NyZWVuLmhlaWdodCwgJ3gnKS5jb25jYXQoc2NyZWVuLmNvbG9yRGVwdGgpLAogICAgICAgICAgICAgICAgICAgICAgICBpZnI6IGksCiAgICAgICAgICAgICAgICAgICAgICAgIHR6OiBuZXcgRGF0ZSgpLmdldFRpbWV6b25lT2Zmc2V0KCksCiAgICAgICAgICAgICAgICAgICAgICAgIHR3czogaChpKSwKICAgICAgICAgICAgICAgICAgICAgICAgYmU6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgIGJjOiBlWzBdLnBhcmFtcy5iYyB8fCAnJy5jb25jYXQoJ2hiX3BiJywgJ18nKS5jb25jYXQoJzMuMC4zJyksCiAgICAgICAgICAgICAgICAgICAgICAgIGRkZGlkOiBPYmplY3Qoci5fbWFwKShlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudHJhbnNhY3Rpb25JZDsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignLCcpLAogICAgICAgICAgICAgICAgICAgICAgICBub2NhY2hlOiBuZXcgRGF0ZSgpLmdldFRpbWUoKQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB5KCdvcnRiMi51c2VyLmRhdGEnKTsKICAgICAgICAgICAgICAgICAgICBvLmxlbmd0aCA+IDAgJiYgKG4uc20gPSBvKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCwgYywgcywgdSwgcCwgbSA9IHkoJ29ydGIyLnNpdGUuY29udGVudC5kYXRhJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG0ubGVuZ3RoID4gMCAmJiAobi5zY3NtID0gbSksIGVbMF0ucGFyYW1zLnBsYXRmb3JtICYmIChuLnBoID0gZVswXS5wYXJhbXMucGxhdGZvcm0pLCB0LmdkcHJDb25zZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gdC5nZHByQ29uc2VudDsKICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBsLmNvbnNlbnRTdHJpbmcgJiYgKG4uZ2Rwcl9jb25zZW50ID0gbC5jb25zZW50U3RyaW5nKSwgdm9pZCAwICE9PSBsLmdkcHJBcHBsaWVzICYmIChuLmdkcHIgPSBsLmdkcHJBcHBsaWVzID8gMSA6IDApLCAnaWFiJyA9PT0gYS5iLmdldENvbmZpZygnY29uc2VudE1hbmFnZW1lbnQuY21wQXBpJykgJiYgKG4ueF9nZHByX2YgPSAxKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgdC51c3BDb25zZW50ICYmIChuLnVzX3ByaXZhY3kgPSB0LnVzcENvbnNlbnQpLCBPYmplY3Qoci5kZWVwQWNjZXNzKShlWzBdLCAnY3J1bWJzLnB1YmNpZCcpICYmIE9iamVjdChyLmRlZXBTZXRWYWx1ZSkoZVswXSwgJ3VzZXJJZC5wdWJjaWQnLCBPYmplY3Qoci5kZWVwQWNjZXNzKShlWzBdLCAnY3J1bWJzLnB1YmNpZCcpKSwgZCA9IG4sIGMgPSBlWzBdLnVzZXJJZCwgT2JqZWN0KHIuX2VhY2gpKGMsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYlt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIuaGFzT3duUHJvcGVydHkodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ21lcmtsZUlkJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Zsb2NJZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd1aWQyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW25dID0gZS5pZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2xpcGInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkW25dID0gZS5saXBiaWQsIEFycmF5LmlzQXJyYXkoZS5zZWdtZW50cykgJiYgZS5zZWdtZW50cy5sZW5ndGggPiAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gJ2xpdmVpbnRlbnQ6JyArIGUuc2VnbWVudHMuam9pbignfCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnNtID0gJycuY29uY2F0KGQuc20gPyBkLnNtICsgJywnIDogJycpLmNvbmNhdChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdwYXJyYWJsZUlkJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW25dID0gZS5laWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdpZDVpZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFtuXSA9IGUudWlkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbm92YXRpcSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFtuXSA9IGUuc25vd2ZsYWtlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW25dID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KSwgbiA9IGQsIGVbMF0uc2NoYWluICYmIChuLnNjaGFpbiA9IChzID0gZVswXS5zY2hhaW4sICcnLmNvbmNhdChzLnZlciwgJywnKS5jb25jYXQocy5jb21wbGV0ZSwgJyEnKS5jb25jYXQoKHUgPSBzLm5vZGVzLCBwID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnYXNpJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3NpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdocCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdyaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnbmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdkb21haW4nCiAgICAgICAgICAgICAgICAgICAgXSwgdS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAubWFwKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0XSB8fCAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignLCcpOwogICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJyEnKSkpKSksIG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEuYi5nZXRDb25maWcoZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFBcnJheS5pc0FycmF5KHQpIHx8ICF0Lmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LmlzQXJyYXkoZS5zZWdtZW50KSAmJiBlLnNlZ21lbnQubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGUubmFtZSAmJiBlLm5hbWUubGVuZ3RoID4gMDsKICAgICAgICAgICAgICAgICAgICB9KS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAnb2JqZWN0JyA9PT0gcyh0LmV4dCkgJiYgdC5leHQuc2VndGF4ID8gJycuY29uY2F0KHQubmFtZSwgJy8nKS5jb25jYXQodC5leHQuc2VndGF4KSA6IHQubmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbbl0gPSAoZVtuXSB8fCBbXSkuY29uY2F0KHQuc2VnbWVudC5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmlkOwogICAgICAgICAgICAgICAgICAgICAgICB9KSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSwge30pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhuKS5tYXAoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgKyAnOicgKyBuW2VdLmpvaW4oJ3wnKTsKICAgICAgICAgICAgICAgICAgICB9KS5qb2luKCcsJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBnKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFtdLCBpID0gITE7CiAgICAgICAgICAgICAgICAgICAgbi5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge30sIHIgPSBhLmIuZ2V0Q29uZmlnKCdjdXJyZW5jeS5hZFNlcnZlckN1cnJlbmN5JykgfHwgJ1VTRCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiBlLmdldEZsb29yICYmIChuID0gZS5nZXRGbG9vcih7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVuY3k6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFUeXBlOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6ICcqJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuLmZsb29yIHx8IGUucGFyYW1zLmN1c3RvbUZsb29yIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWF0aC5yb3VuZCgxMDAwICogaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIG4gPyAoci5wdXNoKG4pLCBpID0gITApIDogci5wdXNoKDApOwogICAgICAgICAgICAgICAgICAgIH0pLCBpICYmIChlLmF1bWZzID0gci5qb2luKCcsJykpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0KGkucmVnaXN0ZXJCaWRkZXIpKGYpLCB3aW5kb3cucGJqcy5pbnN0YWxsZWRNb2R1bGVzLnB1c2goJ29wZW54QmlkQWRhcHRlcicpOwogICAgICAgICAgICB9CiAgICAgICAgfSwgWzY4Nl0pOwogICAgICAgIHBianNDaHVuayhbMTY5XSwgewogICAgICAgICAgICA3MTc6IGZ1bmN0aW9uIChlLCB0LCByKSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByKDcxOCk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDcxODogZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCByLmQodCwgJ2FsbG93ZWRGaWVsZHMnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGs7CiAgICAgICAgICAgICAgICB9KSwgci5kKHQsICdfZmxvb3JEYXRhRm9yQXVjdGlvbicsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdzsKICAgICAgICAgICAgICAgIH0pLCByLmQodCwgJ2ZpZWxkTWF0Y2hpbmdGdW5jdGlvbnMnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEk7CiAgICAgICAgICAgICAgICB9KSwgdC5nZXRGaXJzdE1hdGNoaW5nRmxvb3IgPSBNLCB0LmdldEJpZGRlcnNDcG1BZGp1c3RtZW50ID0geCwgdC5jYWxjdWxhdGVBZGp1c3RlZEZsb29yID0gViwgdC5nZXRGbG9vciA9IFcsIHQuZ2V0Rmxvb3JzRGF0YUZvckF1Y3Rpb24gPSBHLCB0LmdldEZsb29yRGF0YUZyb21BZFVuaXRzID0gTiwgdC51cGRhdGVBZFVuaXRzRm9yQXVjdGlvbiA9IF8sIHQucGlja1JhbmRvbU1vZGVsID0gSCwgdC5jcmVhdGVGbG9vcnNEYXRhRm9yQXVjdGlvbiA9IEosIHQuY29udGludWVBdWN0aW9uID0gTCwgdC5pc0Zsb29yc0RhdGFWYWxpZCA9IFEsIHQucGFyc2VGbG9vckRhdGEgPSBYLCB0LnJlcXVlc3RCaWRzSG9vayA9IFosIHQuaGFuZGxlRmV0Y2hSZXNwb25zZSA9IGVlLCB0LmdlbmVyYXRlQW5kSGFuZGxlRmV0Y2ggPSByZSwgdC5oYW5kbGVTZXRGbG9vcnNDb25maWcgPSBvZSwgdC5hZGRCaWRSZXNwb25zZUhvb2sgPSBuZTsKICAgICAgICAgICAgICAgIHZhciBvID0gcigwKSwgbiA9IHIoMTQpLCBjID0gcigzKSwgYSA9IHIoNCksIGkgPSByKDEwKSwgdSA9IHIubihpKSwgcyA9IHIoNSksIGQgPSByLm4ocyksIGwgPSByKDkpLCBmID0gcig0MyksIHAgPSByKDExKSwgbSA9IHIubihwKSwgYiA9IHIoMTkpLCBoID0gWydtb2RlbEdyb3VwcyddOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChnID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3IgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiBlLmNvbnN0cnVjdG9yID09PSBTeW1ib2wgJiYgZSAhPT0gU3ltYm9sLnByb3RvdHlwZSA/ICdzeW1ib2wnIDogdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgfSkoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8sIG4gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgbywgbiA9IHt9LCBjID0gT2JqZWN0LmtleXMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG8gPSAwOyBvIDwgYy5sZW5ndGg7IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gY1tvXSwgdC5pbmRleE9mKHIpID49IDAgfHwgKG5bcl0gPSBlW3JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICB9KGUsIHQpOwogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChvID0gMDsgbyA8IGMubGVuZ3RoOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gY1tvXSwgdC5pbmRleE9mKHIpID49IDAgfHwgT2JqZWN0LnByb3RvdHlwZS5wcm9wZXJ0eUlzRW51bWVyYWJsZS5jYWxsKGUsIHIpICYmIChuW3JdID0gZVtyXSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTygpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKE8gPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGFyZ3VtZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gaW4gcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwociwgbykgJiYgKGVbb10gPSByW29dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgKG8gPSBvLmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoZSwgdCkuZW51bWVyYWJsZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCByLnB1c2guYXBwbHkociwgbyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdihlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBudWxsICE9IGFyZ3VtZW50c1t0XSA/IGFyZ3VtZW50c1t0XSA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB0ICUgMiA/IGooT2JqZWN0KHIpLCAhMCkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgRihlLCB0LCByW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGUsIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKHIpKSA6IGooT2JqZWN0KHIpKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihyLCB0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEYoZSwgdCwgcikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0IGluIGUgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pIDogZVt0XSA9IHIsIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgQSwgUyA9ICdQcmljZSBGbG9vcnMnLCBDID0gT2JqZWN0KGEuYikoMTAwMDApLCBrID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnZ3B0U2xvdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdhZFVuaXRDb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3NpemUnLAogICAgICAgICAgICAgICAgICAgICAgICAnZG9tYWluJywKICAgICAgICAgICAgICAgICAgICAgICAgJ21lZGlhVHlwZScKICAgICAgICAgICAgICAgICAgICBdLCBUID0gITEsIEQgPSAhMSwgUiA9IHt9LCBVID0gW10sIHcgPSB7fTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLmNlaWwoKHBhcnNlRmxvYXQoZSkgKiBNYXRoLnBvdygxMCwgdCkpLnRvRml4ZWQoMSkpIC8gTWF0aC5wb3coMTAsIHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIEkgPSB7CiAgICAgICAgICAgICAgICAgICAgc2l6ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChvLnBhcnNlR1BUU2luZ2xlU2l6ZUFycmF5KSh0LnNpemUpIHx8ICcqJzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG1lZGlhVHlwZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQubWVkaWFUeXBlIHx8ICdiYW5uZXInOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZ3B0U2xvdDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2dhbScgPT09IE9iamVjdChvLmRlZXBBY2Nlc3MpKGUsICdvcnRiMkltcC5leHQuZGF0YS5hZHNlcnZlci5uYW1lJykgJiYgZS5vcnRiMkltcC5leHQuZGF0YS5hZHNlcnZlci5hZHNsb3Q7CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgT2JqZWN0KG8uZ2V0R3B0U2xvdEluZm9Gb3JBZFVuaXRDb2RlKShlLmFkVW5pdENvZGUpLmdwdFNsb3Q7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBkb21haW46IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBIHx8IChyID0gT2JqZWN0KGIuYSkoKS5yZWZlcmVyLCBBID0gT2JqZWN0KG8ucGFyc2VVcmwpKHIsIHsgbm9EZWNvZGVXaG9sZVVSTDogITAgfSkuaG9zdG5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGFkVW5pdENvZGU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFkVW5pdENvZGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFAoZSwgdCwgcikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlZHVjZShmdW5jdGlvbiAoZSwgbykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IElbb10odCwgcikgfHwgJyonOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wdXNoKCcqJyA9PT0gbiA/IFsnKiddIDogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbi50b0xvd2VyQ2FzZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJyonCiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0sIFtdKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE0oZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMl0gPyBhcmd1bWVudHNbMl0gOiB7fSwgbiA9IFAoT2JqZWN0KG8uZGVlcEFjY2VzcykoZSwgJ3NjaGVtYS5maWVsZHMnKSB8fCBbXSwgdCwgcik7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFuLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsgbWF0Y2hpbmdGbG9vcjogZS5kZWZhdWx0IH07CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbMF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJy0nKSwgYSA9IE9iamVjdChvLmRlZXBBY2Nlc3MpKGUsICdtYXRjaGluZ0lucHV0cy4nLmNvbmNhdChjKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2KHt9LCBhKTsKICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IEIobiwgT2JqZWN0KG8uZGVlcEFjY2VzcykoZSwgJ3NjaGVtYS5kZWxpbWl0ZXInKSB8fCAnfCcpLCB1ID0gbSgpKGksIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS52YWx1ZXMuaGFzT3duUHJvcGVydHkodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvb3JNaW46IGUuZmxvb3JNaW4gfHwgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb29yUnVsZVZhbHVlOiBlLnZhbHVlc1t1XSB8fCBlLmRlZmF1bHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXRjaGluZ0RhdGE6IGlbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXRjaGluZ1J1bGU6IHUKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5tYXRjaGluZ0Zsb29yID0gTWF0aC5tYXgocy5mbG9vck1pbiwgcy5mbG9vclJ1bGVWYWx1ZSksIE9iamVjdChvLmRlZXBTZXRWYWx1ZSkoZSwgJ21hdGNoaW5nSW5wdXRzLicuY29uY2F0KGMpLCB2KHt9LCBzKSksIHM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBCKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLm1hcChmdW5jdGlvbiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8ucHVzaChlICsgdCArIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvOwogICAgICAgICAgICAgICAgICAgIH0pLnNvcnQoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3BsaXQoJyonKS5sZW5ndGggLSB0LnNwbGl0KCcqJykubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24geChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBhcmd1bWVudHMubGVuZ3RoID4gMiAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1syXSA/IGFyZ3VtZW50c1syXSA6IHt9LCBjID0gT2JqZWN0KG8uZGVlcEFjY2VzcykoT2JqZWN0KG4uYSkoKSwgJ2JpZGRlclNldHRpbmdzLicuY29uY2F0KGUsICcuYmlkQ3BtQWRqdXN0bWVudCcpKSB8fCBPYmplY3Qoby5kZWVwQWNjZXNzKShPYmplY3Qobi5hKSgpLCAnYmlkZGVyU2V0dGluZ3Muc3RhbmRhcmQuYmlkQ3BtQWRqdXN0bWVudCcpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjID8gcGFyc2VGbG9hdChjKHQsIHYodih7fSwgciksIHt9LCB7IGNwbTogdCB9KSkpIDogcGFyc2VGbG9hdCh0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFYoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gTWF0aC5wb3coMTAsIDEwKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAqIHIgLyAodCAqIHIpICogKGUgKiByKSAvIHI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgcSA9IHsKICAgICAgICAgICAgICAgICAgICBiYW5uZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qoby5kZWVwQWNjZXNzKShlLCAnbWVkaWFUeXBlcy5iYW5uZXIuc2l6ZXMnKSB8fCBbXTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHZpZGVvOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KG8uZGVlcEFjY2VzcykoZSwgJ21lZGlhVHlwZXMudmlkZW8ucGxheWVyU2l6ZScpIHx8IFtdOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgbmF0aXZlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KG8uZGVlcEFjY2VzcykoZSwgJ21lZGlhVHlwZXMubmF0aXZlLmltYWdlLnNpemVzJykgPyBbT2JqZWN0KG8uZGVlcEFjY2VzcykoZSwgJ21lZGlhVHlwZXMubmF0aXZlLmltYWdlLnNpemVzJyldIDogW107CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHooZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0LmtleXMoZS5tZWRpYVR5cGVzIHx8IHt9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyonID09PSB0Lm1lZGlhVHlwZSAmJiAxID09PSByLmxlbmd0aCAmJiAodC5tZWRpYVR5cGUgPSByWzBdKSwgJyonID09PSB0LnNpemUgJiYgLTEgIT09IHIuaW5kZXhPZih0Lm1lZGlhVHlwZSkgJiYgcVt0Lm1lZGlhVHlwZV0gJiYgMSA9PT0gcVt0Lm1lZGlhVHlwZV0oZSkubGVuZ3RoICYmICh0LnNpemUgPSBxW3QubWVkaWFUeXBlXShlKVswXSksIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBXKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW5jeTogJ1VTRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYVR5cGU6ICcqJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6ICcqJwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0ID0gdGhpcywgciA9IHdbdC5hdWN0aW9uSWRdOwogICAgICAgICAgICAgICAgICAgIGlmICghciB8fCByLnNraXBwZWQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgICAgICBlID0geih0LCBlKTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IE0oci5kYXRhLCB2KHt9LCB0KSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFUeXBlOiBlLm1lZGlhVHlwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6IGUuc2l6ZQogICAgICAgICAgICAgICAgICAgICAgICB9KSwgYSA9IGUuY3VycmVuY3kgfHwgci5kYXRhLmN1cnJlbmN5OwogICAgICAgICAgICAgICAgICAgIGlmIChjLm1hdGNoaW5nRmxvb3IgJiYgYSAhPT0gci5kYXRhLmN1cnJlbmN5KQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5tYXRjaGluZ0Zsb29yID0gT2JqZWN0KG4uYSkoKS5jb252ZXJ0Q3VycmVuY3koYy5tYXRjaGluZ0Zsb29yLCByLmRhdGEuY3VycmVuY3ksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qoby5sb2dXYXJuKSgnJy5jb25jYXQoUywgJzogVW5hYmxlIHRvIGdldCBjdXJyZW5jeSBjb252ZXJzaW9uIGZvciBnZXRGbG9vciBmb3IgYmlkZGVyICcpLmNvbmNhdCh0LmJpZGRlciwgJy4gWW91IG11c3QgaGF2ZSBjdXJyZW5jeSBtb2R1bGUgZW5hYmxlZCB3aXRoIGRlZmF1bHRSYXRlcyBpbiB5b3VyIGN1cnJlbmN5IGNvbmZpZycpKSwgYSA9IHIuZGF0YS5jdXJyZW5jeTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChyLmVuZm9yY2VtZW50LmJpZEFkanVzdG1lbnQgJiYgYy5tYXRjaGluZ0Zsb29yKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0geCh0LmJpZGRlciwgYy5tYXRjaGluZ0Zsb29yKTsKICAgICAgICAgICAgICAgICAgICAgICAgYy5tYXRjaGluZ0Zsb29yID0gaSA/IFYoYy5tYXRjaGluZ0Zsb29yLCBpKSA6IGMubWF0Y2hpbmdGbG9vcjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMubWF0Y2hpbmdGbG9vciA/IHsKICAgICAgICAgICAgICAgICAgICAgICAgZmxvb3I6IEUoYy5tYXRjaGluZ0Zsb29yLCA0KSwKICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVuY3k6IGEKICAgICAgICAgICAgICAgICAgICB9IDoge307CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBHKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdChvLmRlZXBDbG9uZSkoZSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuc2NoZW1hLmRlbGltaXRlciA9IGUuc2NoZW1hLmRlbGltaXRlciB8fCAnfCcsIHIudmFsdWVzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLnNjaGVtYS5maWVsZHMsIG8gPSBlLnNjaGVtYS5kZWxpbWl0ZXIsIG4gPSB0ICYmIC0xID09PSByLmluZGV4T2YoJ2FkVW5pdENvZGUnKSAmJiByLnVuc2hpZnQoJ2FkVW5pdENvZGUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGUudmFsdWVzKS5yZWR1Y2UoZnVuY3Rpb24gKHIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByWyhuID8gJycuY29uY2F0KHQpLmNvbmNhdChvKS5jb25jYXQoYykgOiBjKS50b0xvd2VyQ2FzZSgpXSA9IGUudmFsdWVzW2NdLCByOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICAgICAgfShyLCB0KSwgci5jdXJyZW5jeSA9IHIuY3VycmVuY3kgfHwgJ1VTRCcsIHI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBOKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFEodC5mbG9vcnMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUudmFsdWVzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBHKHQuZmxvb3JzLCB0LmNvZGUpLnZhbHVlczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPKGUudmFsdWVzLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChlID0gRyh0LmZsb29ycywgdC5jb2RlKSkubG9jYXRpb24gPSAnYWRVbml0JzsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwge30pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gXyhlLCB0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUuYmlkcy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNraXBwZWQgPyBkZWxldGUgZS5nZXRGbG9vciA6IGUuZ2V0Rmxvb3IgPSBXLCBlLmF1Y3Rpb25JZCA9IHIsIGUuZmxvb3JEYXRhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNraXBwZWQ6IHQuc2tpcHBlZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBza2lwUmF0ZTogdC5za2lwUmF0ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9vck1pbjogdC5mbG9vck1pbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlbFZlcnNpb246IE9iamVjdChvLmRlZXBBY2Nlc3MpKHQsICdkYXRhLm1vZGVsVmVyc2lvbicpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZGVsV2VpZ2h0OiBPYmplY3Qoby5kZWVwQWNjZXNzKSh0LCAnZGF0YS5tb2RlbFdlaWdodCcpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZGVsVGltZXN0YW1wOiBPYmplY3Qoby5kZWVwQWNjZXNzKSh0LCAnZGF0YS5tb2RlbFRpbWVzdGFtcCcpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2F0aW9uOiBPYmplY3Qoby5kZWVwQWNjZXNzKSh0LCAnZGF0YS5sb2NhdGlvbicsICdub0RhdGEnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9vclByb3ZpZGVyOiB0LmZsb29yUHJvdmlkZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmV0Y2hTdGF0dXM6IFIuZmV0Y2hTdGF0dXMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIHQgKyAxKSwgbyA9IDA7IG8gPCBlLmxlbmd0aDsgbysrKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHIgLT0gZVtvXS5tb2RlbFdlaWdodCkgPD0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW29dOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBPYmplY3Qoby5kZWVwQ2xvbmUpKFIpOwogICAgICAgICAgICAgICAgICAgIGlmICgyID09PSBPYmplY3Qoby5kZWVwQWNjZXNzKShyLCAnZGF0YS5mbG9vcnNTY2hlbWFWZXJzaW9uJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSByLmRhdGEsIGMgPSBuLm1vZGVsR3JvdXBzLCBhID0geShuLCBoKTsKICAgICAgICAgICAgICAgICAgICAgICAgci5kYXRhID0gTyhhLCBIKGMsIGEubW9kZWxXZWlnaHRTdW0pKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAwID09PSBPYmplY3Qua2V5cyhPYmplY3Qoby5kZWVwQWNjZXNzKShyLCAnZGF0YS52YWx1ZXMnKSB8fCB7fSkubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIGlmIChyLmRhdGEgPSBpID8gTihlKSA6IEcoci5kYXRhKSwgMCA9PT0gT2JqZWN0LmtleXMoT2JqZWN0KG8uZGVlcEFjY2VzcykociwgJ2RhdGEudmFsdWVzJykgfHwge30pLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgci5za2lwcGVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gT2JqZWN0KG8uZ2V0UGFyYW1ldGVyQnlOYW1lKSgncGJqc19za2lwUmF0ZScpIHx8IHIuc2tpcFJhdGUsIHMgPSAxMDAgKiBNYXRoLnJhbmRvbSgpIDwgcGFyc2VGbG9hdCh1KTsKICAgICAgICAgICAgICAgICAgICAgICAgci5za2lwcGVkID0gczsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuaGFzT3duUHJvcGVydHkoJ2Zsb29yTWluJykgJiYgKHIuZGF0YS5mbG9vck1pbiA9IHIuZmxvb3JNaW4pLCBfKGUsIHIsIHQpLCByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5oYXNFeGl0ZWQgfHwgKFUgPSBVLmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50aW1lciAhPT0gZS50aW1lcjsKICAgICAgICAgICAgICAgICAgICB9KSwgZS5yZXFCaWRzQ29uZmlnT2JqLmF1Y3Rpb25JZCA9IGUucmVxQmlkc0NvbmZpZ09iai5hdWN0aW9uSWQgfHwgT2JqZWN0KG8uZ2VuZXJhdGVVVUlEKSgpLCB3W2UucmVxQmlkc0NvbmZpZ09iai5hdWN0aW9uSWRdID0gSihlLnJlcUJpZHNDb25maWdPYmouYWRVbml0cyB8fCBPYmplY3Qobi5hKSgpLmFkVW5pdHMsIGUucmVxQmlkc0NvbmZpZ09iai5hdWN0aW9uSWQpLCBlLm5leHRGbi5hcHBseShlLmNvbnRleHQsIFtlLnJlcUJpZHNDb25maWdPYmpdKSwgZS5oYXNFeGl0ZWQgPSAhMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBZKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9IE9iamVjdChvLmRlZXBBY2Nlc3MpKGUsICdzY2hlbWEuZmllbGRzJyksICEhKEFycmF5LmlzQXJyYXkodCkgJiYgdC5sZW5ndGggPiAwICYmIHQuZXZlcnkoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xICE9PSBrLmluZGV4T2YoZSk7CiAgICAgICAgICAgICAgICAgICAgfSkgfHwgKE9iamVjdChvLmxvZ0Vycm9yKSgnJy5jb25jYXQoUywgJzogRmllbGRzIHJlY2lldmVkIGRvIG5vdCBtYXRjaCBhbGxvd2VkIGZpZWxkcycpKSwgMCkpICYmIChyID0gZSwgbiA9IGUuc2NoZW1hLmZpZWxkcy5sZW5ndGgsIGMgPSBlLnNjaGVtYS5kZWxpbWl0ZXIgfHwgJ3wnLCAnb2JqZWN0JyA9PT0gZyhyLnZhbHVlcykgJiYgKHIudmFsdWVzID0gT2JqZWN0LmtleXMoci52YWx1ZXMpLnJlZHVjZShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUsIHQsIHIsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PSB0eXBlb2YgZSAmJiBlLnNwbGl0KG8pLmxlbmd0aCA9PT0gciAmJiAnbnVtYmVyJyA9PSB0eXBlb2YgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSh0LCByLnZhbHVlc1t0XSwgbiwgYykgJiYgKGVbdF0gPSByLnZhbHVlc1t0XSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSwge30pLCBPYmplY3Qua2V5cyhyLnZhbHVlcykubGVuZ3RoID4gMCkpOwogICAgICAgICAgICAgICAgICAgIHZhciB0LCByLCBuLCBjOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIEsgPSB7CiAgICAgICAgICAgICAgICAgICAgMTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFkoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISghQXJyYXkuaXNBcnJheShlLm1vZGVsR3JvdXBzKSB8fCAwID09PSBlLm1vZGVsR3JvdXBzLmxlbmd0aCkgJiYgKGUubW9kZWxXZWlnaHRTdW0gPSAwLCBlLm1vZGVsR3JvdXBzLmV2ZXJ5KGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISgnbnVtYmVyJyAhPSB0eXBlb2YgdC5tb2RlbFdlaWdodCB8fCAhWSh0KSkgJiYgKGUubW9kZWxXZWlnaHRTdW0gKz0gdC5tb2RlbFdlaWdodCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFEoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnb2JqZWN0JyA9PT0gZyhlKSAmJiAoZS5mbG9vcnNTY2hlbWFWZXJzaW9uID0gZS5mbG9vcnNTY2hlbWFWZXJzaW9uIHx8IDEsICdmdW5jdGlvbicgIT0gdHlwZW9mIEtbZS5mbG9vcnNTY2hlbWFWZXJzaW9uXSA/IChPYmplY3Qoby5sb2dFcnJvcikoJycuY29uY2F0KFMsICc6IFVua25vd24gZmxvb3JzU2NoZW1hVmVyc2lvbjogJyksIGUuZmxvb3JzU2NoZW1hVmVyc2lvbiksICExKSA6IEtbZS5mbG9vcnNTY2hlbWFWZXJzaW9uXShlKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBYKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiAnb2JqZWN0JyA9PT0gZyhlKSAmJiBRKGUpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KG8ubG9nSW5mbykoJycuY29uY2F0KFMsICc6IEEgJykuY29uY2F0KHQsICcgc2V0IHRoZSBhdWN0aW9uIGZsb29yIGRhdGEgc2V0IHRvICcpLCBlKSwgdih2KHt9LCBlKSwge30sIHsgbG9jYXRpb246IHQgfSk7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG8ubG9nRXJyb3IpKCcnLmNvbmNhdChTLCAnOiBUaGUgZmxvb3JzIGRhdGEgZGlkIG5vdCBjb250YWluIGNvcnJlY3QgdmFsdWVzJyksIGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gWihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlcUJpZHNDb25maWdPYmo6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IHRoaXMsCiAgICAgICAgICAgICAgICAgICAgICAgIG5leHRGbjogZSwKICAgICAgICAgICAgICAgICAgICAgICAgaGF2ZUV4aXRlZDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVyOiBudWxsCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBSLmF1Y3Rpb25EZWxheSA+IDAgJiYgVCA/IChyLnRpbWVyID0gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChvLmxvZ1dhcm4pKCcnLmNvbmNhdChTLCAnOiBGZXRjaCBhdHRlbXB0IGRpZCBub3QgcmV0dXJuIGluIHRpbWUgZm9yIGF1Y3Rpb24nKSksIFIuZmV0Y2hTdGF0dXMgPSAndGltZW91dCcsIEwocik7CiAgICAgICAgICAgICAgICAgICAgfSwgUi5hdWN0aW9uRGVsYXkpLCBVLnB1c2gocikpIDogTChyKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uICQoKSB7CiAgICAgICAgICAgICAgICAgICAgVS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dChlLnRpbWVyKSwgTChlKTsKICAgICAgICAgICAgICAgICAgICB9KSwgVSA9IFtdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZWUoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgIFQgPSAhMSwgUi5mZXRjaFN0YXR1cyA9ICdzdWNjZXNzJzsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB0ID0gSlNPTi5wYXJzZShlKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFgodCwgJ2ZldGNoJyk7CiAgICAgICAgICAgICAgICAgICAgciAmJiAoUi5kYXRhID0gciwgUi5za2lwUmF0ZSA9IE9iamVjdChvLmlzTnVtYmVyKShyLnNraXBSYXRlKSA/IHIuc2tpcFJhdGUgOiBSLnNraXBSYXRlLCBSLmZsb29yUHJvdmlkZXIgPSByLmZsb29yUHJvdmlkZXIgfHwgUi5mbG9vclByb3ZpZGVyKSwgJCgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdGUoZSkgewogICAgICAgICAgICAgICAgICAgIFQgPSAhMSwgUi5mZXRjaFN0YXR1cyA9ICdlcnJvcicsIE9iamVjdChvLmxvZ0Vycm9yKSgnJy5jb25jYXQoUywgJzogRmV0Y2ggZXJyb3JlZCB3aXRoOiAnKSwgZSksICQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJlKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLnVybCAmJiAhVCA/ICdHRVQnICE9PSAoZS5tZXRob2QgfHwgJ0dFVCcpID8gT2JqZWN0KG8ubG9nRXJyb3IpKCcnLmNvbmNhdChTLCAnOiBcJ0dFVFwnIGlzIHRoZSBvbmx5IHJlcXVlc3QgbWV0aG9kIHN1cHBvcnRlZCBhdCB0aGlzIHRpbWUhJykpIDogKEMoZS51cmwsIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzczogZWUsCiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiB0ZQogICAgICAgICAgICAgICAgICAgIH0sIG51bGwsIHsgbWV0aG9kOiAnR0VUJyB9KSwgVCA9ICEwKSA6IFQgJiYgT2JqZWN0KG8ubG9nV2FybikoJycuY29uY2F0KFMsICc6IEEgZmV0Y2ggaXMgYWxyZWFkeSBvY2N1cmluZy4gU2tpcHBpbmcuJykpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gb2UoZSkgewogICAgICAgICAgICAgICAgICAgIChSID0gT2JqZWN0KG8ucGljaykoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAnZmxvb3JNaW4nLAogICAgICAgICAgICAgICAgICAgICAgICAnZW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITEgIT09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhdWN0aW9uRGVsYXknLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgfHwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Zsb29yUHJvdmlkZXInLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChvLmRlZXBBY2Nlc3MpKGUsICdkYXRhLmZsb29yUHJvdmlkZXInLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2VuZHBvaW50JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnc2tpcFJhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNOYU4oT2JqZWN0KG8uZGVlcEFjY2VzcykoZSwgJ2RhdGEuc2tpcFJhdGUnKSkgPyBlLnNraXBSYXRlIHx8IDAgOiBlLmRhdGEuc2tpcFJhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdlbmZvcmNlbWVudCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KG8ucGljaykoZSB8fCB7fSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbmZvcmNlSlMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMSAhPT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbmZvcmNlUEJTJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZmxvb3JEZWFscycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JpZEFkanVzdG1lbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMSAhPT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2FkZGl0aW9uYWxTY2hlbWFGaWVsZHMnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnID09PSBnKGUpICYmIE9iamVjdC5rZXlzKGUpLmxlbmd0aCA+IDAgPyAodCA9IGUsIHZvaWQgT2JqZWN0LmtleXModCkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0xID09PSBrLmluZGV4T2YoZSkgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdFtlXSAmJiAoay5wdXNoKGUpLCBJW2VdID0gdFtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2RhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgWChlLCAnc2V0Q29uZmlnJykgfHwgUi5kYXRhOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSkpLmVuYWJsZWQgPyAocmUoUi5lbmRwb2ludCksIEQgfHwgKHUuYS5vbihkLmEuRVZFTlRTLkFVQ1RJT05fRU5ELCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkZWxldGUgd1tlLmF1Y3Rpb25JZF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIDMwMDApOwogICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3Qobi5hKSgpLnJlcXVlc3RCaWRzLmJlZm9yZShaLCA1MCksIE9iamVjdChsLmEpKCdhZGRCaWRSZXNwb25zZScpLmJlZm9yZShuZSwgT2JqZWN0KG8uZGVidWdUdXJuZWRPbikoKSA/IDQgOiA1MCksIEQgPSAhMCkpIDogKE9iamVjdChvLmxvZ0luZm8pKCcnLmNvbmNhdChTLCAnOiBUdXJuaW5nIG9mZiBtb2R1bGUnKSksIFIgPSB7fSwgdyA9IHt9LCBPYmplY3QobC5hKSgnYWRkQmlkUmVzcG9uc2UnKS5nZXRIb29rcyh7IGhvb2s6IG5lIH0pLnJlbW92ZSgpLCBPYmplY3Qobi5hKSgpLnJlcXVlc3RCaWRzLmdldEhvb2tzKHsgaG9vazogWiB9KS5yZW1vdmUoKSwgRCA9ICExKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG5lKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHdbdGhpcy5iaWRkZXJSZXF1ZXN0LmF1Y3Rpb25JZF0sIGEgPSBtKCkodGhpcy5iaWRkZXJSZXF1ZXN0LmJpZHMsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5iaWRJZCAmJiBlLmJpZElkID09PSByLnJlcXVlc3RJZDsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFjIHx8ICFyIHx8IGMuc2tpcHBlZCB8fCAhYSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY2FsbCh0aGlzLCB0LCByKTsKICAgICAgICAgICAgICAgICAgICB2YXIgaSwgdSA9IE0oYy5kYXRhLCB2KHt9LCBhKSwgdih2KHt9LCByKSwge30sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLndpZHRoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaGVpZ2h0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIXUubWF0Y2hpbmdGbG9vcikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChvLmxvZ1dhcm4pKCcnLmNvbmNhdChTLCAnOiB1bmFibGUgdG8gZGV0ZXJtaW5lIGEgbWF0Y2hpbmcgcHJpY2UgZmxvb3IgZm9yIGJpZFJlc3BvbnNlJyksIHIpLCBlLmNhbGwodGhpcywgdCwgcik7CiAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBjLmRhdGEuY3VycmVuY3kudG9VcHBlckNhc2UoKSwgbCA9IHIuY3VycmVuY3kgfHwgJ1VTRCc7CiAgICAgICAgICAgICAgICAgICAgaWYgKHMgPT09IGwudG9VcHBlckNhc2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgaSA9IHIuY3BtOwogICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHIub3JpZ2luYWxDdXJyZW5jeSAmJiBzID09PSByLm9yaWdpbmFsQ3VycmVuY3kudG9VcHBlckNhc2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgaSA9IHIub3JpZ2luYWxDcG07CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IE9iamVjdChuLmEpKCkuY29udmVydEN1cnJlbmN5KHIuY3BtLCBsLnRvVXBwZXJDYXNlKCksIHMpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KG8ubG9nRXJyb3IpKCcnLmNvbmNhdChTLCAnOiBVbmFibGUgZG8gZ2V0IGN1cnJlbmN5IGNvbnZlcnNpb24gZm9yIGJpZFJlc3BvbnNlIHRvIEZsb29yIEN1cnJlbmN5LiBEbyB5b3UgaGF2ZSBDdXJyZW5jeSBtb2R1bGUgZW5hYmxlZD8gJykuY29uY2F0KHIpKSwgZS5jYWxsKHRoaXMsIHQsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKGkgPSB4KHIuYmlkZGVyQ29kZSwgaSwgciksIGZ1bmN0aW9uIChlLCB0LCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmZsb29yRGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9vclZhbHVlOiB0Lm1hdGNoaW5nRmxvb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvb3JSdWxlOiB0Lm1hdGNoaW5nUnVsZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9vclJ1bGVWYWx1ZTogdC5mbG9vclJ1bGVWYWx1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9vckN1cnJlbmN5OiBlLmRhdGEuY3VycmVuY3ksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3BtQWZ0ZXJBZGp1c3RtZW50czogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmZvcmNlbWVudHM6IHYoe30sIGUuZW5mb3JjZW1lbnQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hdGNoZWRGaWVsZHM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRhdGEuc2NoZW1hLmZpZWxkcy5mb3JFYWNoKGZ1bmN0aW9uIChvLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB0Lm1hdGNoaW5nRGF0YS5zcGxpdChlLmRhdGEuc2NoZW1hLmRlbGltaXRlcilbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5mbG9vckRhdGEubWF0Y2hlZEZpZWxkc1tvXSA9IGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfShjLCB1LCByLCBpKSwgZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gITEgIT09IE9iamVjdChvLmRlZXBBY2Nlc3MpKGUsICdlbmZvcmNlbWVudC5lbmZvcmNlSlMnKSwgYyA9ICEwID09PSBPYmplY3Qoby5kZWVwQWNjZXNzKShlLCAnZW5mb3JjZW1lbnQuZmxvb3JEZWFscycpIHx8ICFyLmRlYWxJZCwgYSA9IHIuZmxvb3JEYXRhLmNwbUFmdGVyQWRqdXN0bWVudHMgPCB0Lm1hdGNoaW5nRmxvb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiBhICYmIGM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0oYywgdSwgcikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBPYmplY3QoZi5hKShkLmEuU1RBVFVTLk5PX0JJRCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPKHAsIE9iamVjdChvLnBpY2spKHIsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmbG9vckRhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3dpZHRoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdoZWlnaHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ21lZGlhVHlwZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY3VycmVuY3knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29yaWdpbmFsQ3BtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvcmlnaW5hbEN1cnJlbmN5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnZXRDcG1Jbk5ld0N1cnJlbmN5JwogICAgICAgICAgICAgICAgICAgICAgICBdKSksIHAuc3RhdHVzID0gZC5hLkJJRF9TVEFUVVMuQklEX1JFSkVDVEVELCBwLmNwbSA9IDAsIE9iamVjdChvLmxvZ1dhcm4pKCcnLmNvbmNhdChTLCAnOiAnKS5jb25jYXQocC5iaWRkZXJDb2RlLCAnXCdzIEJpZCBSZXNwb25zZSBmb3IgJykuY29uY2F0KHQsICcgd2FzIHJlamVjdGVkIGR1ZSB0byBmbG9vciBub3QgbWV0JyksIHIpLCBlLmNhbGwodGhpcywgdCwgcCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNhbGwodGhpcywgdCwgcik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjLmIuZ2V0Q29uZmlnKCdmbG9vcnMnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBvZShlLmZsb29ycyk7CiAgICAgICAgICAgICAgICB9KSwgd2luZG93LnBianMuaW5zdGFsbGVkTW9kdWxlcy5wdXNoKCdwcmljZUZsb29ycycpOwogICAgICAgICAgICB9CiAgICAgICAgfSwgWzcxN10pOwogICAgICAgIHBianNDaHVuayhbMTYzXSwgewogICAgICAgICAgICA3MzE6IGZ1bmN0aW9uIChlLCByLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB0KDczMik7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDczMjogZnVuY3Rpb24gKGUsIHIsIHQpIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShyLCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCByLmNoZWNrVmlkZW9QbGFjZW1lbnQgPSBfLCB0LmQociwgJ3NwZWMnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFg7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciBhID0gdCgwKSwgaSA9IHQoMSksIG4gPSB0KDIpLCBzID0gdCgzKSwgbyA9IHQoMTMpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZCgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGQgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSAxOyByIDwgYXJndW1lbnRzLmxlbmd0aDsgcisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50c1tyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwodCwgYSkgJiYgKGVbYV0gPSB0W2FdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgKGEgPSBhLmZpbHRlcihmdW5jdGlvbiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoZSwgcikuZW51bWVyYWJsZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCB0LnB1c2guYXBwbHkodCwgYSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcChlLCByLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgaW4gZSA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCByLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB0LAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSkgOiBlW3JdID0gdCwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAodSA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGwgPSAncHVibWF0aWMnLCBtID0gJ1B1Yk1hdGljOiAnLCBiID0gJ1VTRCcsIGcgPSB2b2lkIDAsIGYgPSAnaHR0cHM6Ly9wdWJtYXRpYy5iYnZtcy5jb20vci8nLmNvbmNhdCgnJFJFTkRFUkVSJywgJy5qcycpLCBoID0gewogICAgICAgICAgICAgICAgICAgICAgICBrYWRwYWdldXJsOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZ2VuZGVyOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgeW9iOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgbGF0OiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgbG9uOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgd2lpZDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIHByb2ZJZDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIHZlcklkOiAnJwogICAgICAgICAgICAgICAgICAgIH0sIHkgPSAnbnVtYmVyJywgdiA9ICdzdHJpbmcnLCBPID0gJ2Jvb2xlYW4nLCBFID0gJ2FycmF5JywgSSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbWltZXM6IEUsCiAgICAgICAgICAgICAgICAgICAgICAgIG1pbmR1cmF0aW9uOiB5LAogICAgICAgICAgICAgICAgICAgICAgICBtYXhkdXJhdGlvbjogeSwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRkZWxheTogeSwKICAgICAgICAgICAgICAgICAgICAgICAgcGxheWJhY2ttZXRob2Q6IEUsCiAgICAgICAgICAgICAgICAgICAgICAgIGFwaTogRSwKICAgICAgICAgICAgICAgICAgICAgICAgcHJvdG9jb2xzOiBFLAogICAgICAgICAgICAgICAgICAgICAgICB3OiB5LAogICAgICAgICAgICAgICAgICAgICAgICBoOiB5LAogICAgICAgICAgICAgICAgICAgICAgICBiYXR0cjogRSwKICAgICAgICAgICAgICAgICAgICAgICAgbGluZWFyaXR5OiB5LAogICAgICAgICAgICAgICAgICAgICAgICBwbGFjZW1lbnQ6IHksCiAgICAgICAgICAgICAgICAgICAgICAgIG1pbmJpdHJhdGU6IHksCiAgICAgICAgICAgICAgICAgICAgICAgIG1heGJpdHJhdGU6IHksCiAgICAgICAgICAgICAgICAgICAgICAgIHNraXA6IHkKICAgICAgICAgICAgICAgICAgICB9LCB3ID0gewogICAgICAgICAgICAgICAgICAgICAgICBUSVRMRTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSUQ6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBLRVk6ICd0aXRsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFOiAwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIElNQUdFOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJRDogMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtFWTogJ2ltYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRZUEU6IDAKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgSUNPTjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSUQ6IDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBLRVk6ICdpY29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRZUEU6IDAKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgU1BPTlNPUkVEQlk6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElEOiA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgS0VZOiAnc3BvbnNvcmVkQnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBCT0RZOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJRDogNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtFWTogJ2JvZHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRTogMgogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBDTElDS1VSTDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSUQ6IDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBLRVk6ICdjbGlja1VybCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFOiAwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIFZJREVPOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJRDogNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtFWTogJ3ZpZGVvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRZUEU6IDAKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgRVhUOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJRDogOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtFWTogJ2V4dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFOiAwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIERBVEE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElEOiA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgS0VZOiAnZGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFOiAwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIExPR086IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElEOiAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtFWTogJ2xvZ28nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRTogMAogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBTUE9OU09SRUQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElEOiAxMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtFWTogJ3Nwb25zb3JlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIERFU0M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElEOiAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtFWTogJ2RhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRTogMgogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBSQVRJTkc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElEOiAxMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtFWTogJ3JhdGluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFOiAzCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIExJS0VTOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJRDogMTQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBLRVk6ICdsaWtlcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFOiA0CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIERPV05MT0FEUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSUQ6IDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgS0VZOiAnZG93bmxvYWRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRZUEU6IDUKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgUFJJQ0U6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElEOiAxNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtFWTogJ3ByaWNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRZUEU6IDYKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgU0FMRVBSSUNFOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJRDogMTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBLRVk6ICdzYWxlcHJpY2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRTogNwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBQSE9ORTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSUQ6IDE4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgS0VZOiAncGhvbmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRTogOAogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBBRERSRVNTOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJRDogMTksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBLRVk6ICdhZGRyZXNzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRZUEU6IDkKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgREVTQzI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElEOiAyMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtFWTogJ2Rlc2MyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRZUEU6IDEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIERJU1BMQVlVUkw6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElEOiAyMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtFWTogJ2Rpc3BsYXl1cmwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRTogMTEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgQ1RBOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJRDogMjIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBLRVk6ICdjdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgVFlQRTogMTIKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGogPSAxLCBQID0gMiwgVCA9IDMsIFMgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiB3LlNQT05TT1JFREJZLklELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZWQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogeyB0eXBlOiAxIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHcuVElUTEUuSUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHcuSU1BR0UuSUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sIEQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIDE6ICdQTVAnLAogICAgICAgICAgICAgICAgICAgICAgICA1OiAnUFJFRicsCiAgICAgICAgICAgICAgICAgICAgICAgIDY6ICdQTVBHJwogICAgICAgICAgICAgICAgICAgIH0sIHggPSAxLCBZID0gMiwgayA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYm9vdHN0cmFwUGxheWVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7IGNvZGU6IGUuYWRVbml0Q29kZSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUudmFzdFhtbCA/IHIudmFzdFhtbCA9IGUudmFzdFhtbCA6IGUudmFzdFVybCAmJiAoci52YXN0VXJsID0gZS52YXN0VXJsKSwgZS52YXN0WG1sIHx8IGUudmFzdFVybCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQsIGkgPSBrLmdldFJlbmRlcmVySWQoJ3B1Ym1hdGljJywgZS5yZW5kZXJlckNvZGUpLCBuID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoZS5hZFVuaXRDb2RlKSwgcyA9IDA7IHMgPCB3aW5kb3cuYmx1ZWJpbGx5d2lnLnJlbmRlcmVycy5sZW5ndGg7IHMrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5ibHVlYmlsbHl3aWcucmVuZGVyZXJzW3NdLl9pZCA9PT0gaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHdpbmRvdy5ibHVlYmlsbHl3aWcucmVuZGVyZXJzW3NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID8gdC5ib290c3RyYXAociwgbikgOiBPYmplY3QoYS5sb2dXYXJuKSgnJy5jb25jYXQobSwgJzogQ291bGRuXCd0IGZpbmQgYSByZW5kZXJlciB3aXRoICcpLmNvbmNhdChpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoYS5sb2dXYXJuKSgnJy5jb25jYXQobSwgJzogTm8gdmFzdFhtbCBvciB2YXN0VXJsIG9uIGJpZCwgYmFpbGluZy4uLicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbmV3UmVuZGVyZXI6IGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGYucmVwbGFjZSgnJFJFTkRFUkVSJywgZSksIGkgPSBvLmEuaW5zdGFsbCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9hZGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRVbml0Q29kZTogcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnNldFJlbmRlcihrLm91dHN0cmVhbVJlbmRlcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGEubG9nV2FybikoJycuY29uY2F0KG0sICc6IEVycm9yIHR5aW5nIHRvIHNldFJlbmRlciBvbiByZW5kZXJlcicpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBvdXRzdHJlYW1SZW5kZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnJlbmRlcmVyLnB1c2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsuYm9vdHN0cmFwUGxheWVyKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldFJlbmRlcmVySWQ6IGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJycuY29uY2F0KGUsICctJykuY29uY2F0KHIpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgUiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgbi5iLAogICAgICAgICAgICAgICAgICAgICAgICBuLmQsCiAgICAgICAgICAgICAgICAgICAgICAgIG4uYwogICAgICAgICAgICAgICAgICAgIF0sIEEgPSAwLCBDID0gITEsIHogPSB7fSwgSyA9IHt9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gTihlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFPYmplY3QoYS5pc1N0cikocikpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByICYmIE9iamVjdChhLmxvZ1dhcm4pKCdQdWJNYXRpYzogSWdub3JpbmcgcGFyYW0ga2V5OiAnICsgZSArICcsIGV4cGVjdHMgc3RyaW5nLXZhbHVlLCBmb3VuZCAnICsgdShyKSksIGc7CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAncG16b25laWQnOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5zcGxpdCgnLCcpLnNsaWNlKDAsIDUwKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRyaW0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbigpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgJ2thZGZsb29yJzoKICAgICAgICAgICAgICAgICAgICBjYXNlICdsYXQnOgogICAgICAgICAgICAgICAgICAgIGNhc2UgJ2xvbic6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUZsb2F0KHIpIHx8IGc7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAneW9iJzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlSW50KHIpIHx8IGc7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHI7CiAgICAgICAgICAgICAgICAgICAgZS5wYXJhbXMuYWRVbml0ID0gJycsIGUucGFyYW1zLmFkVW5pdEluZGV4ID0gJzAnLCBlLnBhcmFtcy53aWR0aCA9IDAsIGUucGFyYW1zLmhlaWdodCA9IDAsIGUucGFyYW1zLmFkU2xvdCA9IChyID0gZS5wYXJhbXMuYWRTbG90LCBPYmplY3QoYS5pc1N0cikocikgPyByLnJlcGxhY2UoL15ccysvZywgJycpLnJlcGxhY2UoL1xzKyQvZywgJycpIDogKHIgJiYgT2JqZWN0KGEubG9nV2FybikoJ3B1Ym1hdGljOiBhZFNsb3QgbXVzdCBiZSBhIHN0cmluZy4gSWdub3JpbmcgYWRTbG90JyksICcnKSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnBhcmFtcy5hZFNsb3QsIGkgPSB0LnNwbGl0KCc6Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQgPSBpWzBdLCAyID09IGkubGVuZ3RoICYmIChlLnBhcmFtcy5hZFVuaXRJbmRleCA9IGlbMV0pLCBpID0gdC5zcGxpdCgnQCcpLCBlLnBhcmFtcy5hZFVuaXQgPSBpWzBdLCBpLmxlbmd0aCA+IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDIgIT0gKGkgPSBpWzFdLnNwbGl0KCd4JykpLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIE9iamVjdChhLmxvZ1dhcm4pKCdQdWJNYXRpYzogQWRTbG90IEVycm9yOiBhZFNsb3Qgbm90IGluIHJlcXVpcmVkIGZvcm1hdCcpOwogICAgICAgICAgICAgICAgICAgICAgICBlLnBhcmFtcy53aWR0aCA9IHBhcnNlSW50KGlbMF0sIDEwKSwgZS5wYXJhbXMuaGVpZ2h0ID0gcGFyc2VJbnQoaVsxXSwgMTApOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZS5oYXNPd25Qcm9wZXJ0eSgnbWVkaWFUeXBlcycpICYmIGUubWVkaWFUeXBlcy5oYXNPd25Qcm9wZXJ0eShuLmIpICYmIGUubWVkaWFUeXBlcy5iYW5uZXIuaGFzT3duUHJvcGVydHkoJ3NpemVzJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgcyA9IDAsIG8gPSBbXTsgcyA8IGUubWVkaWFUeXBlcy5iYW5uZXIuc2l6ZXMubGVuZ3RoOyBzKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAyID09PSBlLm1lZGlhVHlwZXMuYmFubmVyLnNpemVzW3NdLmxlbmd0aCAmJiBvLnB1c2goZS5tZWRpYVR5cGVzLmJhbm5lci5zaXplc1tzXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUubWVkaWFUeXBlcy5iYW5uZXIuc2l6ZXMgPSBvLCBlLm1lZGlhVHlwZXMuYmFubmVyLnNpemVzLmxlbmd0aCA+PSAxICYmIChlLnBhcmFtcy53aWR0aCA9IGUubWVkaWFUeXBlcy5iYW5uZXIuc2l6ZXNbMF1bMF0sIGUucGFyYW1zLmhlaWdodCA9IGUubWVkaWFUeXBlcy5iYW5uZXIuc2l6ZXNbMF1bMV0sIGUubWVkaWFUeXBlcy5iYW5uZXIuc2l6ZXMgPSBlLm1lZGlhVHlwZXMuYmFubmVyLnNpemVzLnNwbGljZSgxLCBlLm1lZGlhVHlwZXMuYmFubmVyLnNpemVzLmxlbmd0aCAtIDEpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBVKGUsIHIsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgaSwgbiA9ICdJZ25vcmluZyBwYXJhbSBrZXk6ICcgKyBlICsgJywgZXhwZWN0cyAnICsgdCArICcsIGZvdW5kICcgKyB1KHIpOwogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgTzoKICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGEuaXNCb29sZWFuOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIHk6CiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBhLmlzTnVtYmVyOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIHY6CiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBhLmlzU3RyOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIEU6CiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBhLmlzQXJyYXk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBpKHIpID8gciA6IChPYmplY3QoYS5sb2dXYXJuKShtICsgbiksIGcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcShlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLktFWTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICBpZDogZS5JRCwKICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZWQ6IHJbdF0ucmVxdWlyZWQgPyAxIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogZS5UWVBFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuOiByW3RdLmxlbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dDogclt0XS5leHQKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHsgYXNzZXRzOiBbXSB9OwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgaW4gZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5oYXNPd25Qcm9wZXJ0eSh0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKHIuYXNzZXRzICYmIHIuYXNzZXRzLmxlbmd0aCA+IDAgJiYgci5hc3NldHMuaGFzT3duUHJvcGVydHkodCkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugdy5USVRMRS5LRVk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0ubGVuIHx8IGVbdF0ubGVuZ3RoID8gaSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiB3LlRJVExFLklELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZWQ6IGVbdF0ucmVxdWlyZWQgPyAxIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuOiBlW3RdLmxlbiB8fCBlW3RdLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHQ6IGVbdF0uZXh0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBPYmplY3QoYS5sb2dXYXJuKSgnUHViTWF0aWM6IEVycm9yOiBUaXRsZSBMZW5ndGggaXMgcmVxdWlyZWQgZm9yIG5hdGl2ZSBhZDogJyArIEpTT04uc3RyaW5naWZ5KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LklNQUdFLktFWToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0XS5zaXplcyAmJiBlW3RdLnNpemVzLmxlbmd0aCA+IDAgPyBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHcuSU1BR0UuSUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlZDogZVt0XS5yZXF1aXJlZCA/IDEgOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW1nOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogVCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3OiBlW3RdLncgfHwgZVt0XS53aWR0aCB8fCAoZVt0XS5zaXplcyA/IGVbdF0uc2l6ZXNbMF0gOiBnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoOiBlW3RdLmggfHwgZVt0XS5oZWlnaHQgfHwgKGVbdF0uc2l6ZXMgPyBlW3RdLnNpemVzWzFdIDogZyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd21pbjogZVt0XS53bWluIHx8IGVbdF0ubWluaW11bVdpZHRoIHx8IChlW3RdLm1pbnNpemVzID8gZVt0XS5taW5zaXplc1swXSA6IGcpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhtaW46IGVbdF0uaG1pbiB8fCBlW3RdLm1pbmltdW1IZWlnaHQgfHwgKGVbdF0ubWluc2l6ZXMgPyBlW3RdLm1pbnNpemVzWzFdIDogZyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWltZXM6IGVbdF0ubWltZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0OiBlW3RdLmV4dAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogT2JqZWN0KGEubG9nV2FybikoJ1B1Yk1hdGljOiBFcnJvcjogSW1hZ2Ugc2l6ZXMgaXMgcmVxdWlyZWQgZm9yIG5hdGl2ZSBhZDogJyArIEpTT04uc3RyaW5naWZ5KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LklDT04uS0VZOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3RdLnNpemVzICYmIGVbdF0uc2l6ZXMubGVuZ3RoID4gMCA/IGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogdy5JQ09OLklELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZWQ6IGVbdF0ucmVxdWlyZWQgPyAxIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltZzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGosCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdzogZVt0XS53IHx8IGVbdF0ud2lkdGggfHwgKGVbdF0uc2l6ZXMgPyBlW3RdLnNpemVzWzBdIDogZyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaDogZVt0XS5oIHx8IGVbdF0uaGVpZ2h0IHx8IChlW3RdLnNpemVzID8gZVt0XS5zaXplc1sxXSA6IGcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBPYmplY3QoYS5sb2dXYXJuKSgnUHViTWF0aWM6IEVycm9yOiBJY29uIHNpemVzIGlzIHJlcXVpcmVkIGZvciBuYXRpdmUgYWQ6ICcgKyBKU09OLnN0cmluZ2lmeShlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugdy5WSURFTy5LRVk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogdy5WSURFTy5JRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmVkOiBlW3RdLnJlcXVpcmVkID8gMSA6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlbzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbmR1cmF0aW9uOiBlW3RdLm1pbmR1cmF0aW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heGR1cmF0aW9uOiBlW3RdLm1heGR1cmF0aW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3RvY29sczogZVt0XS5wcm90b2NvbHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWltZXM6IGVbdF0ubWltZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0OiBlW3RdLmV4dAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHcuRVhULktFWToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiB3LkVYVC5JRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmVkOiBlW3RdLnJlcXVpcmVkID8gMSA6IDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LkxPR08uS0VZOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHcuTE9HTy5JRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmVkOiBlW3RdLnJlcXVpcmVkID8gMSA6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbWc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBQLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHc6IGVbdF0udyB8fCBlW3RdLndpZHRoIHx8IChlW3RdLnNpemVzID8gZVt0XS5zaXplc1swXSA6IGcpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGg6IGVbdF0uaCB8fCBlW3RdLmhlaWdodCB8fCAoZVt0XS5zaXplcyA/IGVbdF0uc2l6ZXNbMV0gOiBnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHcuU1BPTlNPUkVEQlkuS0VZOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugdy5CT0RZLktFWToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHcuUkFUSU5HLktFWToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHcuTElLRVMuS0VZOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugdy5ET1dOTE9BRFMuS0VZOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugdy5QUklDRS5LRVk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LlNBTEVQUklDRS5LRVk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LlBIT05FLktFWToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHcuQUREUkVTUy5LRVk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LkRFU0MyLktFWToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHcuRElTUExBWVVSTC5LRVk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LkNUQS5LRVk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBxKEtbdF0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpICYmIGkuaWQgJiYgKHIuYXNzZXRzW3IuYXNzZXRzLmxlbmd0aF0gPSBpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBTLmxlbmd0aCwgcyA9IDA7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFMuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gci5hc3NldHMubGVuZ3RoLCBhID0gMDsgYSA8IHQ7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmlkID09IHIuYXNzZXRzW2FdLmlkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcysrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pLCBDID0gbiAhPSBzLCByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gVyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIsIHQgPSBlLm1lZGlhVHlwZXMuYmFubmVyLnNpemVzLCBpID0gW107CiAgICAgICAgICAgICAgICAgICAgaWYgKHQgIT09IGcgJiYgT2JqZWN0KGEuaXNBcnJheSkodCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPSB7fSwgZS5wYXJhbXMud2lkdGggfHwgZS5wYXJhbXMuaGVpZ2h0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgci53ID0gZS5wYXJhbXMud2lkdGgsIHIuaCA9IGUucGFyYW1zLmhlaWdodDsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gdC5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSBnLCBPYmplY3QoYS5sb2dXYXJuKSgnUHViTWF0aWM6IEVycm9yOiBtZWRpYVR5cGVzLmJhbm5lci5zaXplIG1pc3NpbmcgZm9yIGFkdW5pdDogJyArIGUucGFyYW1zLmFkVW5pdCArICcuIElnbm9yaW5nIHRoZSBiYW5uZXIgaW1wcmVzc2lvbiBpbiB0aGUgYWR1bml0LicpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgci53ID0gcGFyc2VJbnQodFswXVswXSwgMTApLCByLmggPSBwYXJzZUludCh0WzBdWzFdLCAxMCksIHQgPSB0LnNwbGljZSgxLCB0Lmxlbmd0aCAtIDEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHQubGVuZ3RoID4gMCAmJiAoaSA9IFtdLCB0LmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubGVuZ3RoID4gMSAmJiBpLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHc6IGVbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaDogZVsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpLmxlbmd0aCA+IDAgJiYgKHIuZm9ybWF0ID0gaSkpLCByLnBvcyA9IDAsIHIudG9wZnJhbWUgPSBPYmplY3QoYS5pbklmcmFtZSkoKSA/IDAgOiAxOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoYS5sb2dXYXJuKSgnUHViTWF0aWM6IEVycm9yOiBtZWRpYVR5cGVzLmJhbm5lci5zaXplIG1pc3NpbmcgZm9yIGFkdW5pdDogJyArIGUucGFyYW1zLmFkVW5pdCArICcuIElnbm9yaW5nIHRoZSBiYW5uZXIgaW1wcmVzc2lvbiBpbiB0aGUgYWR1bml0LicpLCByID0gZzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF8oZSwgcikgewogICAgICAgICAgICAgICAgICAgIE9iamVjdChhLmRlZXBBY2Nlc3MpKGUsICdwbGFjZW1lbnQnKSB8fCBPYmplY3QoYS5sb2dXYXJuKSgnVmlkZW8uUGxhY2VtZW50IHBhcmFtIG1pc3NpbmcgZm9yICcgKyByKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFYoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciByLCB0ID0gT2JqZWN0KGEubWVyZ2VEZWVwKShPYmplY3QoYS5kZWVwQWNjZXNzKShlLm1lZGlhVHlwZXMsICd2aWRlbycpLCBlLnBhcmFtcy52aWRlbyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQgIT09IGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSBpbiAociA9IHt9LCBfKHQsIGUuYWRVbml0Q29kZSksIEkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShpKSAmJiAocltpXSA9IFUoaSwgdFtpXSwgSVtpXSkpOwogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoYS5pc0FycmF5KShlLm1lZGlhVHlwZXMudmlkZW8ucGxheWVyU2l6ZVswXSkgPyAoci53ID0gcGFyc2VJbnQoZS5tZWRpYVR5cGVzLnZpZGVvLnBsYXllclNpemVbMF1bMF0sIDEwKSwgci5oID0gcGFyc2VJbnQoZS5tZWRpYVR5cGVzLnZpZGVvLnBsYXllclNpemVbMF1bMV0sIDEwKSkgOiBPYmplY3QoYS5pc051bWJlcikoZS5tZWRpYVR5cGVzLnZpZGVvLnBsYXllclNpemVbMF0pICYmIChyLncgPSBwYXJzZUludChlLm1lZGlhVHlwZXMudmlkZW8ucGxheWVyU2l6ZVswXSwgMTApLCByLmggPSBwYXJzZUludChlLm1lZGlhVHlwZXMudmlkZW8ucGxheWVyU2l6ZVsxXSwgMTApKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgciA9IGcsIE9iamVjdChhLmxvZ1dhcm4pKCdQdWJNYXRpYzogRXJyb3I6IFZpZGVvIGNvbmZpZyBwYXJhbXMgbWlzc2luZyBmb3IgYWR1bml0OiAnICsgZS5wYXJhbXMuYWRVbml0ICsgJyB3aXRoIG1lZGlhVHlwZSBzZXQgYXMgdmlkZW8uIElnbm9yaW5nIHZpZGVvIGltcHJlc3Npb24gaW4gdGhlIGFkdW5pdC4nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEIoZSwgciwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gci5ydGQgJiYgci5ydGQuandwbGF5ZXIgJiYgci5ydGQuandwbGF5ZXIudGFyZ2V0aW5nIHx8IHZvaWQgMCwgaSA9ICcnOwogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IGEgJiYgJycgIT09IGEgJiYgYS5oYXNPd25Qcm9wZXJ0eSgnc2VnbWVudHMnKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgcyA9IGEuc2VnbWVudHMubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICBpICs9ICdqdy1pZD0nICsgYS5jb250ZW50LmlkOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gMDsgbyA8IHM7IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgKz0gJ3xqdy0nICsgYS5zZWdtZW50c1tvXSArICc9MSc7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgPyB2b2lkIDAgPT09IGUuZGN0ciB8fCAwID09IGUuZGN0ci5sZW5ndGggPyBlLmRjdHIgPSBpIDogZS5kY3RyICs9ICd8JyArIGkgOiAobiA9IGUuZXh0KSAmJiB2b2lkIDAgPT09IG4ua2V5X3ZhbCA/IG4ua2V5X3ZhbCA9IGkgOiBuLmtleV92YWwgKz0gJ3wnICsgaTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBHKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCwgaSwgbyA9IHt9LCBkID0ge30sIGwgPSBlLmhhc093blByb3BlcnR5KCdzaXplcycpID8gZS5zaXplcyA6IFtdLCBmID0gJycsIGggPSBbXTsKICAgICAgICAgICAgICAgICAgICBpZiAoZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucGFyYW1zLmRlYWxzICYmIChPYmplY3QoYS5pc0FycmF5KShyLnBhcmFtcy5kZWFscykgPyByLnBhcmFtcy5kZWFscy5mb3JFYWNoKGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGEuaXNTdHIpKHIpICYmIHIubGVuZ3RoID4gMyA/IChlLnBtcCB8fCAoZS5wbXAgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaXZhdGVfYXVjdGlvbjogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVhbHM6IFtdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGUucG1wLmRlYWxzLnB1c2goeyBpZDogciB9KSkgOiBPYmplY3QoYS5sb2dXYXJuKSgnUHViTWF0aWM6IEVycm9yOiBkZWFsLWlkIHByZXNlbnQgaW4gYXJyYXkgYmlkLnBhcmFtcy5kZWFscyBzaG91bGQgYmUgYSBzdHJpbmdzIHdpdGggbW9yZSB0aGFuIDMgY2hhcmF0ZXJzIGxlbmd0aCwgZGVhbC1pZCBpZ25vcmVkOiAnICsgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IE9iamVjdChhLmxvZ1dhcm4pKCdQdWJNYXRpYzogRXJyb3I6IGJpZC5wYXJhbXMuZGVhbHMgc2hvdWxkIGJlIGFuIGFycmF5IG9mIHN0cmluZ3MuJykpOwogICAgICAgICAgICAgICAgICAgICAgICB9KG8gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogZS5iaWRJZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhZ2lkOiBlLnBhcmFtcy5hZFVuaXQgfHwgdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZmxvb3I6IE4oJ2thZGZsb29yJywgZS5wYXJhbXMua2FkZmxvb3IpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdXJlOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0OiB7IHBtWm9uZUlkOiBOKCdwbXpvbmVpZCcsIGUucGFyYW1zLnBtem9uZWlkKSB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZmxvb3JjdXI6IGUucGFyYW1zLmN1cnJlbmN5ID8gTignY3VycmVuY3knLCBlLnBhcmFtcy5jdXJyZW5jeSkgOiBiCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpLCBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIGkgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLnBhcmFtcy5kY3RyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpID0gci5wYXJhbXMuZGN0ciwgT2JqZWN0KGEuaXNTdHIpKGkpICYmIGkubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGkuc3BsaXQoJ3wnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9ICcnLCBuLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgKz0gZS5sZW5ndGggPiAwID8gZS50cmltKCkgKyAnfCcgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQgPSBpLmxlbmd0aCwgJ3wnID09PSBpLnN1YnN0cmluZyh0LCB0IC0gMSkgJiYgKGkgPSBpLnN1YnN0cmluZygwLCB0IC0gMSkpLCBlLmV4dC5rZXlfdmFsID0gaS50cmltKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChhLmxvZ1dhcm4pKCdQdWJNYXRpYzogSWdub3JpbmcgcGFyYW0gOiBkY3RyIHdpdGggdmFsdWUgOiAnICsgaSArICcsIGV4cGVjdHMgc3RyaW5nLXZhbHVlLCBmb3VuZCBlbXB0eSBvciBub24tc3RyaW5nIHZhbHVlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0obywgZSksIEIobywgZSksIGUuaGFzT3duUHJvcGVydHkoJ21lZGlhVHlwZXMnKSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChmIGluIGUubWVkaWFUeXBlcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBuLmI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHQgPSBXKGUpKSAhPT0gZyAmJiAoby5iYW5uZXIgPSB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugbi5jOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQucmVxdWVzdCA9IEpTT04uc3RyaW5naWZ5KEwoZS5uYXRpdmVQYXJhbXMpKSwgQyA/IE9iamVjdChhLmxvZ1dhcm4pKCdQdWJNYXRpYzogRXJyb3I6IEVycm9yIGluIE5hdGl2ZSBhZHVuaXQgJyArIGUucGFyYW1zLmFkVW5pdCArICcuIElnbm9yaW5nIHRoZSBhZHVuaXQuIFJlZmVyIHRvIGh0dHA6Ly9wcmViaWQub3JnL2Rldi1kb2NzL3Nob3ctbmF0aXZlLWFkcy5odG1sIGZvciBtb3JlIGRldGFpbHMuJykgOiBvLm5hdGl2ZSA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG4uZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaSA9IFYoZSkpICE9PSBnICYmIChvLnZpZGVvID0gaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICB0ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdzogZS5wYXJhbXMud2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoOiBlLnBhcmFtcy5oZWlnaHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3BmcmFtZTogT2JqZWN0KGEuaW5JZnJhbWUpKCkgPyAwIDogMQogICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QoYS5pc0FycmF5KShsKSAmJiBsLmxlbmd0aCA+IDEgJiYgKChsID0gbC5zcGxpY2UoMSwgbC5sZW5ndGggLSAxKSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3OiBlWzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGg6IGVbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5mb3JtYXQgPSBoKSwgby5iYW5uZXIgPSB0OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMTsgciA8IGFyZ3VtZW50cy5sZW5ndGg7IHIrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbnVsbCAhPSBhcmd1bWVudHNbcl0gPyBhcmd1bWVudHNbcl0gOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByICUgMiA/IGMoT2JqZWN0KHQpLCAhMCkuZm9yRWFjaChmdW5jdGlvbiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKGUsIHIsIHRbcl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhlLCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyh0KSkgOiBjKE9iamVjdCh0KSkuZm9yRWFjaChmdW5jdGlvbiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgciwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LCByKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSh7fSwgT2JqZWN0KGEuZGVlcEFjY2VzcykociwgJ29ydGIySW1wLmV4dC5kYXRhJykpOwogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyh0KS5mb3JFYWNoKGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGJhZHNsb3QnID09PSByID8gJ3N0cmluZycgPT0gdHlwZW9mIHRbcl0gJiYgdFtyXSAmJiBPYmplY3QoYS5kZWVwU2V0VmFsdWUpKGUsICdleHQuZGF0YS5wYmFkc2xvdCcsIHRbcl0pIDogJ2Fkc2VydmVyJyA9PT0gciA/IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkc2xvdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uZm9yRWFjaChmdW5jdGlvbiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gT2JqZWN0KGEuZGVlcEFjY2VzcykodCwgJ2Fkc2VydmVyLicuY29uY2F0KHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PSB0eXBlb2YgaSAmJiBpICYmIChPYmplY3QoYS5kZWVwU2V0VmFsdWUpKGUsICdleHQuZGF0YS5hZHNlcnZlci4nLmNvbmNhdChyLnRvTG93ZXJDYXNlKCkpLCBpKSwgJ2Fkc2xvdCcgPT09IHIgJiYgT2JqZWN0KGEuZGVlcFNldFZhbHVlKShlLCAnZXh0LmRmcF9hZF91bml0X2NvZGUnLCBpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IE9iamVjdChhLmRlZXBTZXRWYWx1ZSkoZSwgJ2V4dC5kYXRhLicuY29uY2F0KHIpLCB0W3JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfShvLCBlKSwgZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAtMTsKICAgICAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyAhPSB0eXBlb2Ygci5nZXRGbG9vciB8fCBzLmIuZ2V0Q29uZmlnKCdwdWJtYXRpYy5kaXNhYmxlRmxvb3JzJykgfHwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5iLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5kLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5jCiAgICAgICAgICAgICAgICAgICAgICAgIF0uZm9yRWFjaChmdW5jdGlvbiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuaGFzT3duUHJvcGVydHkoaSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdiYW5uZXInID09PSBpICYmIChlW2ldLncgJiYgZVtpXS5oICYmIG4ucHVzaChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbaV0udywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtpXS5oCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIE9iamVjdChhLmlzQXJyYXkpKGVbaV0uZm9ybWF0KSAmJiBlW2ldLmZvcm1hdC5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnB1c2goWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS53LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5oCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgMCA9PT0gbi5sZW5ndGggJiYgbi5wdXNoKCcqJyksIG4uZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHIuZ2V0Rmxvb3IoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVuY3k6IGUuYmlkZmxvb3JjdXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYVR5cGU6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0KGEubG9nSW5mbykobSwgJ2Zsb29yIGZyb20gZmxvb3IgbW9kdWxlIHJldHVybmVkIGZvciBtZWRpYXR5cGU6JywgaSwgJyBhbmQgc2l6ZTonLCBuLCAnIGlzOiBjdXJyZW5jeScsIHMuY3VycmVuY3ksICdmbG9vcicsIHMuZmxvb3IpLCAnb2JqZWN0JyA9PT0gdShzKSAmJiBzLmN1cnJlbmN5ID09PSBlLmJpZGZsb29yY3VyICYmICFpc05hTihwYXJzZUludChzLmZsb29yKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gcGFyc2VGbG9hdChzLmZsb29yKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChhLmxvZ0luZm8pKG0sICdmbG9vciBmcm9tIGZsb29yIG1vZHVsZTonLCBvLCAncHJldmlvdXMgZmxvb3IgdmFsdWUnLCB0LCAnTWluOicsIE1hdGgubWluKG8sIHQpKSwgdCA9IC0xID09PSB0ID8gbyA6IE1hdGgubWluKG8sIHQpLCBPYmplY3QoYS5sb2dJbmZvKShtLCAnbmV3IGZsb29yIHZhbHVlOicsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBlLmJpZGZsb29yICYmIChPYmplY3QoYS5sb2dJbmZvKShtLCAnZmxvb3IgZnJvbSBmbG9vciBtb2R1bGU6JywgdCwgJ2ltcE9iai5iaWRmbG9vcicsIGUuYmlkZmxvb3IsICdNYXg6JywgTWF0aC5tYXgodCwgZS5iaWRmbG9vcikpLCB0ID0gTWF0aC5tYXgodCwgZS5iaWRmbG9vcikpOwogICAgICAgICAgICAgICAgICAgICAgICBlLmJpZGZsb29yID0gIWlzTmFOKHQpICYmIHQgPiAwID8gdCA6IGcsIE9iamVjdChhLmxvZ0luZm8pKG0sICduZXcgaW1wT2JqLmJpZGZsb29yIHZhbHVlOicsIGUuYmlkZmxvb3IpOwogICAgICAgICAgICAgICAgICAgIH0obywgZSksIG8uaGFzT3duUHJvcGVydHkobi5iKSB8fCBvLmhhc093blByb3BlcnR5KG4uYykgfHwgby5oYXNPd25Qcm9wZXJ0eShuLmQpID8gbyA6IGc7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBGKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG51bGwsIGkgPSBPYmplY3QoYS5kZWVwQWNjZXNzKShlLCAnMC51c2VySWQuZmxvY0lkJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGkgJiYgaS5pZCkKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgWToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdGTE9DJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnRkxPQycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0OiB7IHZlcjogaS52ZXJzaW9uIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VnbWVudDogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBpLmlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2Nocm9tZS5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGkuaWQudG9TdHJpbmcoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHg6CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2Nocm9tZS5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpZHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBpLmlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0OiB7IHZlcjogaS52ZXJzaW9uIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEooZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gT2JqZWN0KGEuaXNBcnJheSkoZSkgJiYgZS5sZW5ndGggPiAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0KGEuX2VhY2gpKHcsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgeltlLklEXSA9IGUuS0VZOwogICAgICAgICAgICAgICAgfSksIE9iamVjdChhLl9lYWNoKSh3LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIEtbZS5LRVldID0gZTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIFggPSB7CiAgICAgICAgICAgICAgICAgICAgY29kZTogbCwKICAgICAgICAgICAgICAgICAgICBndmxpZDogNzYsCiAgICAgICAgICAgICAgICAgICAgc3VwcG9ydGVkTWVkaWFUeXBlczogWwogICAgICAgICAgICAgICAgICAgICAgICBuLmIsCiAgICAgICAgICAgICAgICAgICAgICAgIG4uZCwKICAgICAgICAgICAgICAgICAgICAgICAgbi5jCiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBhbGlhc2VzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTogJ2dyb3VwbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBndmxpZDogOTgKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgaXNCaWRSZXF1ZXN0VmFsaWQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICYmIGUucGFyYW1zKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIU9iamVjdChhLmlzU3RyKShlLnBhcmFtcy5wdWJsaXNoZXJJZCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChhLmxvZ1dhcm4pKCdQdWJNYXRpYzogRXJyb3I6IHB1Ymxpc2hlcklkIGlzIG1hbmRhdG9yeSBhbmQgY2Fubm90IGJlIG51bWVyaWMgKHdyYXAgaXQgaW4gcXVvdGVzIGluIHlvdXIgY29uZmlnKS4gQ2FsbCB0byBPcGVuQmlkIHdpbGwgbm90IGJlIHNlbnQgZm9yIGFkIHVuaXQ6ICcgKyBKU09OLnN0cmluZ2lmeShlKSksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuaGFzT3duUHJvcGVydHkoJ21lZGlhVHlwZXMnKSAmJiBlLm1lZGlhVHlwZXMuaGFzT3duUHJvcGVydHkobi5kKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0KGEuZGVlcEFjY2VzcykoZS5tZWRpYVR5cGVzLCAndmlkZW8ubWltZXMnKSwgdCA9IE9iamVjdChhLmRlZXBBY2Nlc3MpKGUsICdwYXJhbXMudmlkZW8ubWltZXMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoITEgPT09IEoocikgJiYgITEgPT09IEoodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoYS5sb2dXYXJuKSgnUHViTWF0aWM6IEVycm9yOiBGb3IgdmlkZW8gYWRzLCBiaWQubWVkaWFUeXBlcy52aWRlby5taW1lcyBPUiBiaWQucGFyYW1zLnZpZGVvLm1pbWVzIHNob3VsZCBiZSBwcmVzZW50IGFuZCBtdXN0IGJlIGEgbm9uLWVtcHR5IGFycmF5LiBDYWxsIHRvIE9wZW5CaWQgd2lsbCBub3QgYmUgc2VudCBmb3IgYWQgdW5pdDonICsgSlNPTi5zdHJpbmdpZnkoZSkpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUubWVkaWFUeXBlc1tuLmRdLmhhc093blByb3BlcnR5KCdjb250ZXh0JykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoYS5sb2dFcnJvcikoJycuY29uY2F0KG0sICc6IG5vIGNvbnRleHQgc3BlY2lmaWVkIGluIGJpZC4gUmVqZWN0aW5nIGJpZDogJyksIGUpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ291dHN0cmVhbScgPT09IGUubWVkaWFUeXBlc1tuLmRdLmNvbnRleHQgJiYgIU9iamVjdChhLmlzU3RyKShlLnBhcmFtcy5vdXRzdHJlYW1BVSkgJiYgIWUuaGFzT3duUHJvcGVydHkoJ3JlbmRlcmVyJykgJiYgIWUubWVkaWFUeXBlc1tuLmRdLmhhc093blByb3BlcnR5KCdyZW5kZXJlcicpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5tZWRpYVR5cGVzLmhhc093blByb3BlcnR5KG4uYikgfHwgZS5tZWRpYVR5cGVzLmhhc093blByb3BlcnR5KG4uYykgPyAoZGVsZXRlIGUubWVkaWFUeXBlc1tuLmRdLCBPYmplY3QoYS5sb2dXYXJuKSgnJy5jb25jYXQobSwgJzogZm9yICJvdXRzdHJlYW0iIGJpZHMgZWl0aGVyIG91dHN0cmVhbUFVIHBhcmFtZXRlciBtdXN0IGJlIHByb3ZpZGVkIG9yIGFkIHVuaXQgc3VwcGxpZWQgcmVuZGVyZXIgaXMgcmVxdWlyZWQuIFJlamVjdGluZyBtZWRpYXR5cGUgVmlkZW8gb2YgYmlkOiAnKSwgZSksICEwKSA6IChPYmplY3QoYS5sb2dFcnJvcikoJycuY29uY2F0KG0sICc6IGZvciAib3V0c3RyZWFtIiBiaWRzIGVpdGhlciBvdXRzdHJlYW1BVSBwYXJhbWV0ZXIgbXVzdCBiZSBwcm92aWRlZCBvciBhZCB1bml0IHN1cHBsaWVkIHJlbmRlcmVyIGlzIHJlcXVpcmVkLiBSZWplY3RpbmcgYmlkOiAnKSwgZSksICExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBidWlsZFJlcXVlc3RzOiBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgciAmJiByLnJlZmVyZXJJbmZvICYmICh0ID0gci5yZWZlcmVySW5mbyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpLCBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlVVJMOiBlICYmIGUucmVmZXJlciA/IGUucmVmZXJlciA6IHdpbmRvdy5sb2NhdGlvbi5ocmVmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZVUkw6IHdpbmRvdy5kb2N1bWVudC5yZWZlcnJlcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHQpLCBjID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJycgKyBuZXcgRGF0ZSgpLmdldFRpbWUoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXQ6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cjogW2JdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbXA6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXRlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiBlLnBhZ2VVUkwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWY6IGUucmVmVVJMLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXZpY2U6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVhOiBuYXZpZ2F0b3IudXNlckFnZW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganM6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbnQ6ICd5ZXMnID09IG5hdmlnYXRvci5kb05vdFRyYWNrIHx8ICcxJyA9PSBuYXZpZ2F0b3IuZG9Ob3RUcmFjayB8fCAnMScgPT0gbmF2aWdhdG9yLm1zRG9Ob3RUcmFjayA/IDEgOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaDogc2NyZWVuLmhlaWdodCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHc6IHNjcmVlbi53aWR0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiBuYXZpZ2F0b3IubGFuZ3VhZ2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlcjoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dDoge30KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShvKSwgcCA9ICcnLCBsID0gW10sIG0gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoaSA9IE9iamVjdChhLmRlZXBDbG9uZSkoZSkpLnBhcmFtcy5hZFNsb3QgPSBpLnBhcmFtcy5hZFNsb3QgfHwgJycsIE0oaSksIGkucGFyYW1zLmhhc093blByb3BlcnR5KCd2aWRlbycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICghKGkuaGFzT3duUHJvcGVydHkoJ21lZGlhVHlwZXMnKSAmJiBpLm1lZGlhVHlwZXMuaGFzT3duUHJvcGVydHkobi5jKSB8fCAwICE9PSBpLnBhcmFtcy53aWR0aCB8fCAwICE9PSBpLnBhcmFtcy5oZWlnaHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBPYmplY3QoYS5sb2dXYXJuKSgnUHViTWF0aWM6IFNraXBwaW5nIHRoZSBub24tc3RhbmRhcmQgYWRzbG90OiAnLCBpLnBhcmFtcy5hZFNsb3QsIEpTT04uc3RyaW5naWZ5KGkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLnB1YklkID0gby5wdWJJZCB8fCBpLnBhcmFtcy5wdWJsaXNoZXJJZCwgKG8gPSBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgaSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0IGluIChyLmthZHBhZ2V1cmwgfHwgKHIua2FkcGFnZXVybCA9IHIucGFnZVVSTCksIGgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5oYXNPd25Qcm9wZXJ0eSh0KSAmJiAoaSA9IGVbdF0pICYmICgnb2JqZWN0JyA9PT0gdShuID0gaFt0XSkgJiYgKGkgPSBuLmYoaSwgcikpLCBPYmplY3QoYS5pc1N0cikoaSkgPyByW3RdID0gaSA6IE9iamVjdChhLmxvZ1dhcm4pKCdQdWJNYXRpYzogSWdub3JpbmcgcGFyYW0gOiAnICsgdCArICcgd2l0aCB2YWx1ZSA6ICcgKyBoW3RdICsgJywgZXhwZWN0cyBzdHJpbmctdmFsdWUsIGZvdW5kICcgKyB1KGkpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oaS5wYXJhbXMsIG8pKS50cmFuc2FjdGlvbklkID0gaS50cmFuc2FjdGlvbklkLCAnJyA9PT0gcCA/IHAgPSBpLnBhcmFtcy5jdXJyZW5jeSB8fCBnIDogaS5wYXJhbXMuaGFzT3duUHJvcGVydHkoJ2N1cnJlbmN5JykgJiYgcCAhPT0gaS5wYXJhbXMuY3VycmVuY3kgJiYgT2JqZWN0KGEubG9nV2FybikoJ1B1Yk1hdGljOiBDdXJyZW5jeSBzcGVjaWZpZXIgaWdub3JlZC4gT25seSBvbmUgY3VycmVuY3kgcGVybWl0dGVkLicpLCBpLnBhcmFtcy5jdXJyZW5jeSA9IHAsIGkucGFyYW1zLmhhc093blByb3BlcnR5KCdkY3RyJykgJiYgT2JqZWN0KGEuaXNTdHIpKGkucGFyYW1zLmRjdHIpICYmIGwucHVzaChpLnBhcmFtcy5kY3RyKSwgaS5wYXJhbXMuaGFzT3duUHJvcGVydHkoJ2JjYXQnKSAmJiBPYmplY3QoYS5pc0FycmF5KShpLnBhcmFtcy5iY2F0KSAmJiAobSA9IG0uY29uY2F0KGkucGFyYW1zLmJjYXQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IEcoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciAmJiBjLmltcC5wdXNoKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIDAgIT0gYy5pbXAubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiwgeTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMuc2l0ZS5wdWJsaXNoZXIuaWQgPSBvLnB1YklkLnRyaW0oKSwgQSA9IG8ucHViSWQudHJpbSgpLCBjLmV4dC53cmFwcGVyID0ge30sIGMuZXh0LndyYXBwZXIucHJvZmlsZSA9IHBhcnNlSW50KG8ucHJvZklkKSB8fCBnLCBjLmV4dC53cmFwcGVyLnZlcnNpb24gPSBwYXJzZUludChvLnZlcklkKSB8fCBnLCBjLmV4dC53cmFwcGVyLndpaWQgPSBvLndpaWQgfHwgci5hdWN0aW9uSWQsIGMuZXh0LndyYXBwZXIud3YgPSAncHJlYmlkX3ByZWJpZF82LjYuMCcsIGMuZXh0LndyYXBwZXIudHJhbnNhY3Rpb25JZCA9IG8udHJhbnNhY3Rpb25JZCwgYy5leHQud3JhcHBlci53cCA9ICdwYmpzJywgYy51c2VyLmdlbmRlciA9IG8uZ2VuZGVyID8gby5nZW5kZXIudHJpbSgpIDogZywgYy51c2VyLmdlbyA9IHt9LCBjLnVzZXIuZ2VvLmxhdCA9IE4oJ2xhdCcsIG8ubGF0KSwgYy51c2VyLmdlby5sb24gPSBOKCdsb24nLCBvLmxvbiksIGMudXNlci55b2IgPSBOKCd5b2InLCBvLnlvYiksIGMuZGV2aWNlLmdlbyA9IGMudXNlci5nZW8sIGMuc2l0ZS5wYWdlID0gby5rYWRwYWdldXJsLnRyaW0oKSB8fCBjLnNpdGUucGFnZS50cmltKCksIGMuc2l0ZS5kb21haW4gPSAoZiA9IGMuc2l0ZS5wYWdlLCAoeSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2EnKSkuaHJlZiA9IGYsIHkuaG9zdG5hbWUpLCAnb2JqZWN0JyA9PT0gdShzLmIuZ2V0Q29uZmlnKCdjb250ZW50JykpICYmIChjLnNpdGUuY29udGVudCA9IHMuYi5nZXRDb25maWcoJ2NvbnRlbnQnKSksICdvYmplY3QnID09PSB1KHMuYi5nZXRDb25maWcoJ2RldmljZScpKSAmJiAoYy5kZXZpY2UgPSBkKGMuZGV2aWNlLCBzLmIuZ2V0Q29uZmlnKCdkZXZpY2UnKSkpLCBPYmplY3QoYS5kZWVwU2V0VmFsdWUpKGMsICdzb3VyY2UudGlkJywgby50cmFuc2FjdGlvbklkKSwgLTEgIT09IHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoJ3B1Ym1hdGljVGVzdD10cnVlJykgJiYgKGMudGVzdCA9IDEpLCBlWzBdLnNjaGFpbiAmJiBPYmplY3QoYS5kZWVwU2V0VmFsdWUpKGMsICdzb3VyY2UuZXh0LnNjaGFpbicsIGVbMF0uc2NoYWluKSwgciAmJiByLmdkcHJDb25zZW50ICYmIChPYmplY3QoYS5kZWVwU2V0VmFsdWUpKGMsICd1c2VyLmV4dC5jb25zZW50Jywgci5nZHByQ29uc2VudC5jb25zZW50U3RyaW5nKSwgT2JqZWN0KGEuZGVlcFNldFZhbHVlKShjLCAncmVncy5leHQuZ2RwcicsIHIuZ2RwckNvbnNlbnQuZ2RwckFwcGxpZXMgPyAxIDogMCkpLCByICYmIHIudXNwQ29uc2VudCAmJiBPYmplY3QoYS5kZWVwU2V0VmFsdWUpKGMsICdyZWdzLmV4dC51c19wcml2YWN5Jywgci51c3BDb25zZW50KSwgITAgPT09IHMuYi5nZXRDb25maWcoJ2NvcHBhJykgJiYgT2JqZWN0KGEuZGVlcFNldFZhbHVlKShjLCAncmVncy5jb3BwYScsIDEpLCBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0KGEuZGVlcEFjY2VzcykociwgJzAudXNlcklkQXNFaWRzJyksIGkgPSBGKHIsIHgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJiYgKHQgfHwgKHQgPSBbXSksIHQucHVzaChpKSksIE9iamVjdChhLmlzQXJyYXkpKHQpICYmIHQubGVuZ3RoID4gMCAmJiBPYmplY3QoYS5kZWVwU2V0VmFsdWUpKGUsICd1c2VyLmVpZHMnLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oYywgZSksIGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHIgPSByLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGUgfHwgKE9iamVjdChhLmxvZ1dhcm4pKCdQdWJNYXRpYzogYmNhdDogRWFjaCBjYXRlZ29yeSBzaG91bGQgYmUgYSBzdHJpbmcsIGlnbm9yaW5nIGNhdGVnb3J5OiAnICsgZSksICExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudHJpbSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZpbHRlcihmdW5jdGlvbiAoZSwgciwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5sZW5ndGggPiAzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuaW5kZXhPZihlKSA9PT0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KGEubG9nV2FybikoJ1B1Yk1hdGljOiBiY2F0OiBFYWNoIGNhdGVnb3J5IHNob3VsZCBoYXZlIGEgdmFsdWUgb2YgYSBsZW5ndGggb2YgbW9yZSB0aGFuIDMgY2hhcmFjdGVycywgaWdub3JpbmcgY2F0ZWdvcnk6ICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkubGVuZ3RoID4gMCAmJiAoT2JqZWN0KGEubG9nV2FybikoJ1B1Yk1hdGljOiBiY2F0OiBTZWxlY3RlZDogJywgciksIGUuYmNhdCA9IHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShjLCBtKSwgZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEYociwgWSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAoZS51c2VyIHx8IChlLnVzZXIgPSB7fSksIGUudXNlci5kYXRhIHx8IChlLnVzZXIuZGF0YSA9IFtdKSwgZS51c2VyLmRhdGEucHVzaCh0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSBzLmIuZ2V0Q29uZmlnKCdvcnRiMicpIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuc2l0ZSAmJiBPYmplY3QoYS5tZXJnZURlZXApKGMsIHsgc2l0ZTogdi5zaXRlIH0pLCB2LnVzZXIgJiYgT2JqZWN0KGEubWVyZ2VEZWVwKShjLCB7IHVzZXI6IHYudXNlciB9KSwgJ29iamVjdCcgPT09IHUocy5iLmdldENvbmZpZygnYXBwJykpICYmIChjLmFwcCA9IHMuYi5nZXRDb25maWcoJ2FwcCcpLCBjLmFwcC5wdWJsaXNoZXIgPSBjLnNpdGUucHVibGlzaGVyLCBjLmFwcC5leHQgPSBjLnNpdGUuZXh0IHx8IGcsICdvYmplY3QnICE9PSB1KGMuYXBwLmNvbnRlbnQpICYmIChjLmFwcC5jb250ZW50ID0gYy5zaXRlLmNvbnRlbnQgfHwgZyksIGRlbGV0ZSBjLnNpdGUpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly9oYm9wZW5iaWQucHVibWF0aWMuY29tL3RyYW5zbGF0b3I/c291cmNlPXByZWJpZC1jbGllbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IEpTT04uc3RyaW5naWZ5KGMpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlclJlcXVlc3Q6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGludGVycHJldFJlc3BvbnNlOiBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdLCBpID0gYiwgcyA9IEpTT04ucGFyc2Uoci5kYXRhKSwgbyA9IHMuc2l0ZSAmJiBzLnNpdGUucmVmID8gcy5zaXRlLnJlZiA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5ib2R5ICYmIGUuYm9keS5zZWF0YmlkICYmIE9iamVjdChhLmlzQXJyYXkpKGUuYm9keS5zZWF0YmlkKSAmJiAoaSA9IGUuYm9keS5jdXIgfHwgaSwgZS5ib2R5LnNlYXRiaWQuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuYmlkICYmIE9iamVjdChhLmlzQXJyYXkpKGUuYmlkKSAmJiBlLmJpZC5mb3JFYWNoKGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdElkOiBkLmltcGlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3BtOiAocGFyc2VGbG9hdChkLnByaWNlKSB8fCAwKS50b0ZpeGVkKDIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IGQudywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogZC5oLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRpdmVJZDogZC5jcmlkIHx8IGQuaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWFsSWQ6IGQuZGVhbGlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVuY3k6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXRSZXZlbnVlOiB0cnVlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHRsOiAzMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZlcnJlcjogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkOiBkLmFkbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBtX3NlYXQ6IGUuc2VhdCB8fCBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG1fZHNwaWQ6IGQuZXh0ICYmIGQuZXh0LmRzcGlkID8gZC5leHQuZHNwaWQgOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFydG5lckltcElkOiBkLmlkIHx8ICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMuaW1wICYmIHMuaW1wLmxlbmd0aCA+IDAgJiYgcy5pbXAuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQuaW1waWQgPT09IGUuaWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuZXh0ICYmIG51bGwgIT0gZS5leHQuYmlkdHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLm1lZGlhVHlwZSA9IFJbZS5leHQuYmlkdHlwZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoYS5sb2dJbmZvKSgnUHViTWF0aWM6IGJpZC5leHQuYmlkdHlwZSBkb2VzIG5vdCBleGlzdCwgY2hlY2tpbmcgYWx0ZXJuYXRpdmVseSBmb3IgbWVkaWFUeXBlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmFkbSwgaSA9ICcnLCBzID0gbmV3IFJlZ0V4cCgvVkFTVFxzK3ZlcnNpb24vKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5pbmRleE9mKCdzcGFuIGNsYXNzPSJQdWJBUElBZCInKSA+PSAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLm1lZGlhVHlwZSA9IG4uYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChzLnRlc3QodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubWVkaWFUeXBlID0gbi5kOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpID0gSlNPTi5wYXJzZSh0LnJlcGxhY2UoL1xcL2csICcnKSkpICYmIGkubmF0aXZlICYmIChyLm1lZGlhVHlwZSA9IG4uYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChhLmxvZ1dhcm4pKCdQdWJNYXRpYzogRXJyb3I6IENhbm5vdCBwYXJzZSBuYXRpdmUgcmVwb25zZSBmb3IgYWQgcmVzcG9uc2U6ICcgKyB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGQsIGMpLCBjLm1lZGlhVHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugbi5iOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG4uZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy53aWR0aCA9IGQuaGFzT3duUHJvcGVydHkoJ3cnKSA/IGQudyA6IGUudmlkZW8udywgYy5oZWlnaHQgPSBkLmhhc093blByb3BlcnR5KCdoJykgPyBkLmggOiBlLnZpZGVvLmgsIGMudmFzdFhtbCA9IGQuYWRtLCBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIGEsIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5iaWRkZXJSZXF1ZXN0ICYmIHIuYmlkZGVyUmVxdWVzdC5iaWRzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgcyA9IDA7IHMgPCByLmJpZGRlclJlcXVlc3QuYmlkcy5sZW5ndGg7IHMrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5iaWRkZXJSZXF1ZXN0LmJpZHNbc10uYmlkSWQgPT09IGUucmVxdWVzdElkICYmICh0ID0gci5iaWRkZXJSZXF1ZXN0LmJpZHNbc10ucGFyYW1zLCBhID0gci5iaWRkZXJSZXF1ZXN0LmJpZHNbc10ubWVkaWFUeXBlc1tuLmRdLmNvbnRleHQsIGkgPSByLmJpZGRlclJlcXVlc3QuYmlkc1tzXS5hZFVuaXRDb2RlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhICYmICdvdXRzdHJlYW0nID09PSBhICYmIHQgJiYgdC5vdXRzdHJlYW1BVSAmJiBpICYmIChlLnJlbmRlcmVyQ29kZSA9IHQub3V0c3RyZWFtQVUsIGUucmVuZGVyZXIgPSBrLm5ld1JlbmRlcmVyKGUucmVuZGVyZXJDb2RlLCBpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oYywgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugbi5jOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLm5hdGl2ZSA9IHt9LCBlLmhhc093blByb3BlcnR5KCdhZG0nKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IEpTT04ucGFyc2UoZS5hZG0ucmVwbGFjZSgvXFwvZywgJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIE9iamVjdChhLmxvZ1dhcm4pKCdQdWJNYXRpYzogRXJyb3I6IENhbm5vdCBwYXJzZSBuYXRpdmUgcmVwb25zZSBmb3IgYWQgcmVzcG9uc2U6ICcgKyByLmFkbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICYmIHQubmF0aXZlICYmIHQubmF0aXZlLmFzc2V0cyAmJiB0Lm5hdGl2ZS5hc3NldHMubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLm1lZGlhVHlwZSA9IG4uYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIHMgPSB0Lm5hdGl2ZS5hc3NldHMubGVuZ3RoOyBpIDwgczsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0Lm5hdGl2ZS5hc3NldHNbaV0uaWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugdy5USVRMRS5JRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLm5hdGl2ZS50aXRsZSA9IHQubmF0aXZlLmFzc2V0c1tpXS50aXRsZSAmJiB0Lm5hdGl2ZS5hc3NldHNbaV0udGl0bGUudGV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugdy5JTUFHRS5JRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLm5hdGl2ZS5pbWFnZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB0Lm5hdGl2ZS5hc3NldHNbaV0uaW1nICYmIHQubmF0aXZlLmFzc2V0c1tpXS5pbWcudXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IHQubmF0aXZlLmFzc2V0c1tpXS5pbWcgJiYgdC5uYXRpdmUuYXNzZXRzW2ldLmltZy5oLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogdC5uYXRpdmUuYXNzZXRzW2ldLmltZyAmJiB0Lm5hdGl2ZS5hc3NldHNbaV0uaW1nLncKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LklDT04uSUQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5uYXRpdmUuaWNvbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB0Lm5hdGl2ZS5hc3NldHNbaV0uaW1nICYmIHQubmF0aXZlLmFzc2V0c1tpXS5pbWcudXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IHQubmF0aXZlLmFzc2V0c1tpXS5pbWcgJiYgdC5uYXRpdmUuYXNzZXRzW2ldLmltZy5oLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogdC5uYXRpdmUuYXNzZXRzW2ldLmltZyAmJiB0Lm5hdGl2ZS5hc3NldHNbaV0uaW1nLncKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LlNQT05TT1JFREJZLklEOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LkJPRFkuSUQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHcuTElLRVMuSUQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHcuRE9XTkxPQURTLklEOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LlBSSUNFOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LlNBTEVQUklDRS5JRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugdy5QSE9ORS5JRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugdy5BRERSRVNTLklEOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LkRFU0MyLklEOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB3LkNUQS5JRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugdy5SQVRJTkcuSUQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHcuRElTUExBWVVSTC5JRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLm5hdGl2ZVt6W3QubmF0aXZlLmFzc2V0c1tpXS5pZF1dID0gdC5uYXRpdmUuYXNzZXRzW2ldLmRhdGEgJiYgdC5uYXRpdmUuYXNzZXRzW2ldLmRhdGEudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubmF0aXZlLmNsaWNrVXJsID0gdC5uYXRpdmUubGluayAmJiB0Lm5hdGl2ZS5saW5rLnVybCwgci5uYXRpdmUuY2xpY2tUcmFja2VycyA9IHQubmF0aXZlLmxpbmsgJiYgdC5uYXRpdmUubGluay5jbGlja3RyYWNrZXJzIHx8IFtdLCByLm5hdGl2ZS5pbXByZXNzaW9uVHJhY2tlcnMgPSB0Lm5hdGl2ZS5pbXB0cmFja2VycyB8fCBbXSwgci5uYXRpdmUuanN0cmFja2VyID0gdC5uYXRpdmUuanN0cmFja2VyIHx8IFtdLCByLndpZHRoIHx8IChyLndpZHRoID0gMCksIHIuaGVpZ2h0IHx8IChyLmhlaWdodCA9IDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShkLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBkLmV4dCAmJiBkLmV4dC5kZWFsX2NoYW5uZWwgJiYgKGMuZGVhbENoYW5uZWwgPSBEW2QuZXh0LmRlYWxfY2hhbm5lbF0gfHwgbnVsbCksIGMubWV0YSA9IHt9LCBkLmV4dCAmJiBkLmV4dC5kc3BpZCAmJiAoYy5tZXRhLm5ldHdvcmtJZCA9IGQuZXh0LmRzcGlkKSwgZC5leHQgJiYgZC5leHQuYWR2aWQgJiYgKGMubWV0YS5idXllcklkID0gZC5leHQuYWR2aWQpLCBkLmFkb21haW4gJiYgZC5hZG9tYWluLmxlbmd0aCA+IDAgJiYgKGMubWV0YS5hZHZlcnRpc2VyRG9tYWlucyA9IGQuYWRvbWFpbiwgYy5tZXRhLmNsaWNrVXJsID0gZC5hZG9tYWluWzBdKSwgZS5leHQgJiYgZS5leHQuYnV5aWQgJiYgKGMuYWRzZXJ2ZXJUYXJnZXRpbmcgPSB7IGhiX2J1eWlkX3B1Ym1hdGljOiBlLmV4dC5idXlpZCB9KSwgdC5wdXNoKGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoYS5sb2dFcnJvcikoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBnZXRVc2VyU3luY3M6IGZ1bmN0aW9uIChlLCByLCB0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gJycgKyBBOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiAoaSArPSAnJmdkcHI9JyArICh0LmdkcHJBcHBsaWVzID8gMSA6IDApLCBpICs9ICcmZ2Rwcl9jb25zZW50PScgKyBlbmNvZGVVUklDb21wb25lbnQodC5jb25zZW50U3RyaW5nIHx8ICcnKSksIGEgJiYgKGkgKz0gJyZ1c19wcml2YWN5PScgKyBlbmNvZGVVUklDb21wb25lbnQoYSkpLCAhMCA9PT0gcy5iLmdldENvbmZpZygnY29wcGEnKSAmJiAoaSArPSAnJmNvcHBhPTEnKSwgZS5pZnJhbWVFbmFibGVkID8gW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnaWZyYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL2Fkcy5wdWJtYXRpYy5jb20vQWRTZXJ2ZXIvanMvdXNlcl9zeW5jLmh0bWw/a2RudHVpZD0xJnA9JyArIGkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dIDogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnaW1hZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vaW1hZ2U4LnB1Ym1hdGljLmNvbS9BZFNlcnZlci9JbWdTeW5jP3A9JyArIGkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtQmlkUGFyYW1zOiBmdW5jdGlvbiAoZSwgciwgdCwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQihlLCB0LmJpZHNbMF0sICEwKSwgT2JqZWN0KGEuY29udmVydFR5cGVzKSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJJZDogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZFNsb3Q6ICdzdHJpbmcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBPYmplY3QoaS5yZWdpc3RlckJpZGRlcikoWCksIHdpbmRvdy5wYmpzLmluc3RhbGxlZE1vZHVsZXMucHVzaCgncHVibWF0aWNCaWRBZGFwdGVyJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCBbNzMxXSk7CiAgICAgICAgcGJqc0NodW5rKFsxMzldLCB7CiAgICAgICAgICAgIDgwMTogZnVuY3Rpb24gKG4sIGksIGUpIHsKICAgICAgICAgICAgICAgIG4uZXhwb3J0cyA9IGUoODAyKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgODAyOiBmdW5jdGlvbiAobiwgaSwgZSkgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGksICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIGkuaXNTY2hhaW5PYmplY3RWYWxpZCA9IGgsIGkuaXNWYWxpZFNjaGFpbkNvbmZpZyA9IHUsIGkubWFrZUJpZFJlcXVlc3RzSG9vayA9IGwsIGkuaW5pdCA9IE87CiAgICAgICAgICAgICAgICB2YXIgdCA9IGUoMyksIGMgPSBlKDgpLCBvID0gZSgwKSwgcyA9ICdJbnZhbGlkIHNjaGFpbiBvYmplY3QgZm91bmQ6ICcsIGEgPSAnIHNob3VsZCBiZSBhIHN0cmluZycsIHIgPSAnIHNob3VsZCBiZSBhbiBJbnRlZ2VyJywgZCA9ICcgc2hvdWxkIGJlIGFuIG9iamVjdCcsIGYgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFNUUklDVDogJ3N0cmljdCcsCiAgICAgICAgICAgICAgICAgICAgICAgIFJFTEFYRUQ6ICdyZWxheGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgT0ZGOiAnb2ZmJwogICAgICAgICAgICAgICAgICAgIH0sIGIgPSBbXTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgobiwgaSkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gJ0RldGVjdGVkIHNvbWV0aGluZyB3cm9uZyB3aXRoaW4gYW4gc2NoYWluIGNvbmZpZzonLCB0ID0gJyc7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gJ1xuJyArIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICEwID09PSBpID8gT2JqZWN0KG8ubG9nRXJyb3IpKGUsIG4sIHQpIDogT2JqZWN0KG8ubG9nV2FybikoZSwgbiwgdCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICghT2JqZWN0KG8uaXNQbGFpbk9iamVjdCkobikgJiYgKGMoJ3NjaGFpbi5jb25maWcnICsgZCksIHMoKSwgaSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0KG8uaXNOdW1iZXIpKG4uY29tcGxldGUpICYmIE9iamVjdChvLmlzSW50ZWdlcikobi5jb21wbGV0ZSkgfHwgYygnc2NoYWluLmNvbmZpZy5jb21wbGV0ZScgKyByKSwgT2JqZWN0KG8uaXNTdHIpKG4udmVyKSB8fCBjKCdzY2hhaW4uY29uZmlnLnZlcicgKyBhKSwgT2JqZWN0KG8uaGFzT3duKShuLCAnZXh0JykgJiYgKE9iamVjdChvLmlzUGxhaW5PYmplY3QpKG4uZXh0KSB8fCBjKCdzY2hhaW4uY29uZmlnLmV4dCcgKyBkKSksIE9iamVjdChvLmlzQXJyYXkpKG4ubm9kZXMpKQogICAgICAgICAgICAgICAgICAgICAgICBuLm5vZGVzLmZvckVhY2goZnVuY3Rpb24gKG4sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChvLmlzU3RyKShuLmFzaSkgfHwgYygnc2NoYWluLmNvbmZpZy5ub2Rlc1snLmNvbmNhdChpLCAnXS5hc2knKSArIGEpLCBPYmplY3Qoby5pc1N0cikobi5zaWQpIHx8IGMoJ3NjaGFpbi5jb25maWcubm9kZXNbJy5jb25jYXQoaSwgJ10uc2lkJykgKyBhKSwgT2JqZWN0KG8uaXNOdW1iZXIpKG4uaHApICYmIE9iamVjdChvLmlzSW50ZWdlcikobi5ocCkgfHwgYygnc2NoYWluLmNvbmZpZy5ub2Rlc1snLmNvbmNhdChpLCAnXS5ocCcpICsgciksIE9iamVjdChvLmhhc093bikobiwgJ3JpZCcpICYmIChPYmplY3Qoby5pc1N0cikobi5yaWQpIHx8IGMoJ3NjaGFpbi5jb25maWcubm9kZXNbJy5jb25jYXQoaSwgJ10ucmlkJykgKyBhKSksIE9iamVjdChvLmhhc093bikobiwgJ25hbWUnKSAmJiAoT2JqZWN0KG8uaXNTdHIpKG4ubmFtZSkgfHwgYygnc2NoYWluLmNvbmZpZy5ub2Rlc1snLmNvbmNhdChpLCAnXS5uYW1lJykgKyBhKSksIE9iamVjdChvLmhhc093bikobiwgJ2RvbWFpbicpICYmIChPYmplY3Qoby5pc1N0cikobi5kb21haW4pIHx8IGMoJ3NjaGFpbi5jb25maWcubm9kZXNbJy5jb25jYXQoaSwgJ10uZG9tYWluJykgKyBhKSksIE9iamVjdChvLmhhc093bikobiwgJ2V4dCcpICYmIChPYmplY3Qoby5pc1BsYWluT2JqZWN0KShuLmV4dCkgfHwgYygnc2NoYWluLmNvbmZpZy5ub2Rlc1snLmNvbmNhdChpLCAnXS5leHQnKSArIGQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoYygnc2NoYWluLmNvbmZpZy5ub2RlcyBzaG91bGQgYmUgYW4gQXJyYXknKSwgcygpLCBpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEodC5sZW5ndGggPiAwICYmIChzKCksIGkpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUobikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IG4gJiYgKCEhT2JqZWN0KG8uaXNQbGFpbk9iamVjdCkobikgfHwgKE9iamVjdChvLmxvZ0Vycm9yKShzICsgJ3RoZSBmb2xsb3dpbmcgc2NoYWluIGNvbmZpZyB3aWxsIG5vdCBiZSB1c2VkIGFzIHNjaGFpbiBpcyBub3QgYW4gb2JqZWN0LicsIG4pLCAhMSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbChuLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0LmIuZ2V0Q29uZmlnKCdzY2hhaW4nKSwgYyA9IHQuYi5nZXRCaWRkZXJDb25maWcoKTsKICAgICAgICAgICAgICAgICAgICBpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuLmJpZGRlckNvZGUsIHQgPSBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjW25dICYmIGNbbl0uc2NoYWluIHx8IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGkpOwogICAgICAgICAgICAgICAgICAgICAgICBuLmJpZHMuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAobiwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZi5TVFJJQ1Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUobikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChvLmlzU3RyKShuLnZhbGlkYXRpb24pICYmIC0xICE9IGIuaW5kZXhPZihuLnZhbGlkYXRpb24pICYmIChlID0gbi52YWxpZGF0aW9uKSwgZSA9PT0gZi5PRkYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jb25maWc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoKG4uY29uZmlnLCAhKGUgIT09IGYuU1RSSUNUKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jb25maWc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChvLmxvZ0Vycm9yKShzICsgJ2R1ZSB0byB0aGUgXCdzdHJpY3RcJyB2YWxpZGF0aW9uIHNldHRpbmcsIHRoaXMgc2NoYWluIGNvbmZpZyB3aWxsIG5vdCBiZSBwYXNzZWQgdG8gYmlkZGVyIFwnJy5jb25jYXQoaSwgJ1wnLiAgU2VlIGFib3ZlIGVycm9yIGZvciBkZXRhaWxzLicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHQsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiAobi5zY2hhaW4gPSBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSksIG4oaSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBPKCkgewogICAgICAgICAgICAgICAgICAgIGMuZGVmYXVsdC5tYWtlQmlkUmVxdWVzdHMuYWZ0ZXIobCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBPYmplY3Qoby5fZWFjaCkoZiwgZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi5wdXNoKG4pOwogICAgICAgICAgICAgICAgfSksIE8oKSwgd2luZG93LnBianMuaW5zdGFsbGVkTW9kdWxlcy5wdXNoKCdzY2hhaW4nKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIFs4MDFdKTsKICAgICAgICBwYmpzQ2h1bmsoWzIzXSwgewogICAgICAgICAgICAxNTogZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHQuYiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmhhc093blByb3BlcnR5KHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdwdWJQcm92aWRlZElkJyA9PT0gcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gdC5jb25jYXQoZS5wdWJQcm92aWRlZElkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gaShlW3JdLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIHQucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgIH0sIHQuYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChuLmlzUGxhaW5PYmplY3QpKGUuaWRPYmopICYmIE9iamVjdC5rZXlzKGUuaWRPYmopLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICB9KS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKGUuaWRPYmopLmZvckVhY2goZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChuLmRlZXBBY2Nlc3MpKGUsICdjb25maWcuYmlkZGVycycpICYmIEFycmF5LmlzQXJyYXkoZS5jb25maWcuYmlkZGVycykgJiYgT2JqZWN0KG4uZGVlcEFjY2VzcykobywgciArICcuc291cmNlJykgJiYgdC5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IG9bcl0uc291cmNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlcnM6IGUuY29uZmlnLmJpZGRlcnMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgbiA9IHIoMCksIG8gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGludGVudElxSWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2ludGVudGlxLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBuYXZlZ2dJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnbmF2ZWdnLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwdWJjaWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ3B1YmNpZC5vcmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdGRpZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnYWRzZXJ2ZXIub3JnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VWlkRXh0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsgcnRpUGFydG5lcjogJ1RESUQnIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGlkNWlkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRWYWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS51aWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaWQ1LXN5bmMuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VWlkRXh0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmV4dCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwYXJyYWJsZUlkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdwYXJyYWJsZS5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRWYWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5laWQgPyBlLmVpZCA6IGUuY2NwYU9wdG91dCA/ICcnIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRVaWRFeHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3Qobi5waWNrKShlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpYmFPcHRvdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2NwYU9wdG91dCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LmtleXModCkubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaWRsX2VudjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnbGl2ZXJhbXAuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAzCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGxpcGI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmxpcGJpZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdsaXZlaW50ZW50LmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEVpZEV4dDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlLnNlZ21lbnRzKSAmJiBlLnNlZ21lbnRzLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsgc2VnbWVudHM6IGUuc2VnbWVudHMgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgYnJpdGVwb29saWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2JyaXRlcG9vbC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDMKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZG1kSWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2hjbi5oZWFsdGgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDMKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbG90YW1lUGFub3JhbWFJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnY3J3ZGNudHJsLm5ldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBjcml0ZW9JZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnY3JpdGVvLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBtZXJrbGVJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnbWVya2xlaW5jLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmlkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFVpZEV4dDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLmtleUlEID8geyBrZXlJRDogZS5rZXlJRCB9IDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBuZXRJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnbmV0aWQuZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgSURQOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICd6ZW90YXAuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGhhbG9JZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnYXVkaWdlbnQuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHF1YW50Y2FzdElkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdxdWFudGNhc3QuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG5leHRyb2xsSWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ25leHRyb2xsLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBpZHg6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2lkeC5sYXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY29ubmVjdGlkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICd2ZXJpem9ubWVkaWEuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAzCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGZhYnJpY2tJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnbmV1c3Rhci5iaXonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbXdPcGVuTGlua0lkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdtZWRpYXdhbGxhaHNjcmlwdC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdGFwYWRJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAndGFwYWQuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG5vdmF0aXE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnNub3dmbGFrZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdub3ZhdGlxLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1aWQyOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICd1aWRhcGkuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRhcElkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdha2FtYWkuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBpbnRlbnRJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnZGVlcGludGVudC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDMKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgYWRtaXhlcklkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdhZG1peGVyLm5ldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBhZHRlbGxpZ2VudElkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdhZHRlbGxpZ2VudC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDMKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgYW14SWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2FteHJ0Yi5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlua0lkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdlcHNpbG9uLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBrcHVpZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAna3B1aWQuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAzCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGltdWlkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdpbnRpbWF0ZW1lcmdlci5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY29ubmVjdElkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICd5YWhvby5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDMKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcWlkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdhZHF1ZXJ5LmlvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBvW3RdOwogICAgICAgICAgICAgICAgICAgIGlmIChyICYmIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgaS5zb3VyY2UgPSByLnNvdXJjZTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBPYmplY3Qobi5pc0ZuKShyLmdldFZhbHVlKSA/IHIuZ2V0VmFsdWUoZSkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0KG4uaXNTdHIpKGEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogci5hdHlwZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3Qobi5pc0ZuKShyLmdldFVpZEV4dCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHIuZ2V0VWlkRXh0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgJiYgKGMuZXh0ID0gdSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaS51aWRzID0gW2NdLCBPYmplY3Qobi5pc0ZuKShyLmdldEVpZEV4dCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHIuZ2V0RWlkRXh0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgJiYgKGkuZXh0ID0gZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgODExOiBmdW5jdGlvbiAoZSwgdCwgcikgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gcig4MTIpOwogICAgICAgICAgICB9LAogICAgICAgICAgICA4MTI6IGZ1bmN0aW9uIChlLCB0LCByKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgci5kKHQsICdzaGFyZXRocm91Z2hJbnRlcm5hbCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0pLCByLmQodCwgJ3NoYXJldGhyb3VnaEFkYXB0ZXJTcGVjJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBnOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbiA9IHIoMCksIG8gPSByKDEpLCBpID0gcigzKSwgYSA9IHIoMiksIGMgPSByKDE1KTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAodSA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgKG4gPSBuLmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoZSwgdCkuZW51bWVyYWJsZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCByLnB1c2guYXBwbHkociwgbik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBudWxsICE9IGFyZ3VtZW50c1t0XSA/IGFyZ3VtZW50c1t0XSA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB0ICUgMiA/IGQoT2JqZWN0KHIpLCAhMCkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcChlLCB0LCByW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGUsIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKHIpKSA6IGQoT2JqZWN0KHIpKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihyLCB0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoZSwgdCwgcikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0IGluIGUgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pIDogZVt0XSA9IHIsIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbnVsbCA9PSBlID8gbnVsbCA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBTeW1ib2wgJiYgZVtTeW1ib2wuaXRlcmF0b3JdIHx8IGVbJ0BAaXRlcmF0b3InXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIG8sIGkgPSBbXSwgYSA9ICEwLCBjID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgPSByLmNhbGwoZSk7ICEoYSA9IChuID0gci5uZXh0KCkpLmRvbmUpICYmIChpLnB1c2gobi52YWx1ZSksICF0IHx8IGkubGVuZ3RoICE9PSB0KTsgYSA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9ICEwLCBvID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSB8fCBudWxsID09IHIucmV0dXJuIHx8IHIucmV0dXJuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgIH0oZSwgdCkgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoZSkuc2xpY2UoOCwgLTEpOwogICAgICAgICAgICAgICAgICAgICAgICAnT2JqZWN0JyA9PT0gciAmJiBlLmNvbnN0cnVjdG9yICYmIChyID0gZS5jb25zdHJ1Y3Rvci5uYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdNYXAnID09PSByIHx8ICdTZXQnID09PSByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LmZyb20oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnQXJndW1lbnRzJyA9PT0gciB8fCAvXig/OlVpfEkpbnQoPzo4fDE2fDMyKSg/OkNsYW1wZWQpP0FycmF5JC8udGVzdChyKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5KGUsIHQpOwogICAgICAgICAgICAgICAgICAgIH0oZSwgdCkgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbnZhbGlkIGF0dGVtcHQgdG8gZGVzdHJ1Y3R1cmUgbm9uLWl0ZXJhYmxlIGluc3RhbmNlLlxuSW4gb3JkZXIgdG8gYmUgaXRlcmFibGUsIG5vbi1hcnJheSBvYmplY3RzIG11c3QgaGF2ZSBhIFtTeW1ib2wuaXRlcmF0b3JdKCkgbWV0aG9kLicpOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIChudWxsID09IHQgfHwgdCA+IGUubGVuZ3RoKSAmJiAodCA9IGUubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMCwgbiA9IG5ldyBBcnJheSh0KTsgciA8IHQ7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgbltyXSA9IGVbcl07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgZiA9ICdzaGFyZXRocm91Z2gnLCBtID0gJ2h0dHBzOi8vYnRsci5zaGFyZXRocm91Z2guY29tL3VuaXZlcnNhbC92MT9zdXBwbHlfaWQ9Jy5jb25jYXQoJ1dZdTJCWHYxJyksIGIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdldFByb3RvY29sOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LmxvY2F0aW9uLnByb3RvY29sOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgZyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgY29kZTogZiwKICAgICAgICAgICAgICAgICAgICAgICAgc3VwcG9ydGVkTWVkaWFUeXBlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5kLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5iCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIGlzQmlkUmVxdWVzdFZhbGlkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZS5wYXJhbXMucGtleSAmJiBlLmJpZGRlciA9PT0gZjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRSZXF1ZXN0czogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gaS5iLmdldENvbmZpZygnYmlkZGVyVGltZW91dCcpLCBvID0gYi5nZXRQcm90b2NvbCgpLmluZGV4T2YoJ2h0dHAnKSA8IDAgfHwgYi5nZXRQcm90b2NvbCgpLmluZGV4T2YoJ2h0dHBzJykgPiAtMSwgYSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IE9iamVjdChuLmdlbmVyYXRlVVVJRCkoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXQ6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cjogWydVU0QnXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG1heDogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l0ZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluOiB3aW5kb3cubG9jYXRpb24uaG9zdG5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiB3aW5kb3cubG9jYXRpb24uaHJlZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZjogdC5yZWZlcmVySW5mbyAmJiB0LnJlZmVyZXJJbmZvLnJlZmVyZXIgfHwgbnVsbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VyOiB7IGV4dDogeyBlaWRzOiBJKGVbMF0pIH0gfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1YTogbmF2aWdhdG9yLnVzZXJBZ2VudCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiBuYXZpZ2F0b3IubGFuZ3VhZ2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqczogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRudDogJzEnID09PSBuYXZpZ2F0b3IuZG9Ob3RUcmFjayA/IDEgOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaDogd2luZG93LnNjcmVlbi5oZWlnaHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3OiB3aW5kb3cuc2NyZWVuLndpZHRoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcHBhOiAhMCA9PT0gaS5iLmdldENvbmZpZygnY29wcGEnKSA/IDEgOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0OiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246ICc2LjYuMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyOiAnNC4wLjEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjaGFpbjogZVswXS5zY2hhaW4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmNhdDogZVswXS5wYXJhbXMuYmNhdCB8fCBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFkdjogZVswXS5wYXJhbXMuYmFkdiB8fCBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVzdDogMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5nZHByQ29uc2VudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gITAgPT09IHQuZ2RwckNvbnNlbnQuZ2RwckFwcGxpZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5yZWdzLmV4dC5nZHByID0gYyA/IDEgOiAwLCBjICYmIChhLnVzZXIuZXh0LmNvbnNlbnQgPSB0LmdkcHJDb25zZW50LmNvbnNlbnRTdHJpbmcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudXNwQ29uc2VudCAmJiAoYS5yZWdzLmV4dC51c19wcml2YWN5ID0gdC51c3BDb25zZW50KSwgZS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9LCByID0gT2JqZWN0KG4uZGVlcEFjY2VzcykoZSwgJ29ydGIySW1wLmV4dC5kYXRhLnBiYWRzbG90Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgJiYgKHQuZXh0ID0geyBncGlkOiByIH0pLCBlLm1lZGlhVHlwZXMgJiYgZS5tZWRpYVR5cGVzLnZpZGVvICYmICdvdXRzdHJlYW0nID09PSBlLm1lZGlhVHlwZXMudmlkZW8uY29udGV4dCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUubWVkaWFUeXBlcyAmJiBlLm1lZGlhVHlwZXMudmlkZW8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLm1lZGlhVHlwZXMudmlkZW8sIGEgPSA2NDAsIGMgPSAzNjA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpLnBsYXllclNpemUgJiYgaS5wbGF5ZXJTaXplWzBdICYmIGkucGxheWVyU2l6ZVsxXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBsKGkucGxheWVyU2l6ZSwgMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gdVswXSwgYyA9IHVbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC52aWRlbyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvczogaihpLnBvcywgMCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3BmcmFtZTogT2JqZWN0KG4uaW5JZnJhbWUpKCkgPyAwIDogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNraXA6IGooaS5za2lwLCAwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVhcml0eTogaihpLmxpbmVhcml0eSwgMSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaW5kdXJhdGlvbjogaihpLm1pbmR1cmF0aW9uLCA1KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heGR1cmF0aW9uOiBqKGkubWF4ZHVyYXRpb24sIDYwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBsYXliYWNrbWV0aG9kOiBpLnBsYXliYWNrbWV0aG9kIHx8IFsyXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwaTogdihpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbWVzOiBpLm1pbWVzIHx8IFsndmlkZW8vbXA0J10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm90b2NvbHM6IGgoaSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3OiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaDogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ZGVsYXk6IGooaS5zdGFydGRlbGF5LCAwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNraXBtaW46IGooaS5za2lwbWluLCAwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNraXBhZnRlcjogaihpLnNraXBhZnRlciwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaS5wbGFjZW1lbnQgJiYgKHQudmlkZW8ucGxhY2VtZW50ID0gaS5wbGFjZW1lbnQpLCBpLmRlbGl2ZXJ5ICYmICh0LnZpZGVvLmRlbGl2ZXJ5ID0gaS5kZWxpdmVyeSksIGkuY29tcGFuaW9udHlwZSAmJiAodC52aWRlby5jb21wYW5pb250eXBlID0gaS5jb21wYW5pb250eXBlKSwgaS5jb21wYW5pb25hZCAmJiAodC52aWRlby5jb21wYW5pb25hZCA9IGkuY29tcGFuaW9uYWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmJhbm5lciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvczogT2JqZWN0KG4uZGVlcEFjY2VzcykoZSwgJ21lZGlhVHlwZXMuYmFubmVyLnBvcycsIDApLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9wZnJhbWU6IE9iamVjdChuLmluSWZyYW1lKSgpID8gMCA6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JtYXQ6IGUuc2l6ZXMubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdzogK2VbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGg6ICtlWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogZS5iaWRJZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFnaWQ6IFN0cmluZyhlLnBhcmFtcy5wa2V5KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdXJlOiBvID8gMSA6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGZsb29yOiBPKGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogcyhzKHt9LCBhKSwge30sIHsgaW1wOiBbZV0gfSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGludGVycHJldFJlc3BvbnNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLmJvZHk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciAmJiByLnNlYXRiaWQgJiYgMCAhPT0gci5zZWF0YmlkLmxlbmd0aCAmJiByLnNlYXRiaWRbMF0uYmlkICYmIDAgIT09IHIuc2VhdGJpZFswXS5iaWQubGVuZ3RoID8gci5zZWF0YmlkWzBdLmJpZC5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdElkOiBlLmltcGlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogK2UudywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiArZS5oLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcG06ICtlLnByaWNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGl2ZUlkOiBlLmNyaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlYWxJZDogZS5kZWFsaWQgfHwgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVkaWFUeXBlOiB0LmRhdGEuaW1wWzBdLnZpZGVvID8gYS5kIDogYS5iLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW5jeTogci5jdXIgfHwgJ1VTRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldFJldmVudWU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dGw6IDM2MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWQ6IGUuYWRtLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudXJsOiBlLm51cmwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGE6IHsgYWR2ZXJ0aXNlckRvbWFpbnM6IGUuYWRvbWFpbiB8fCBbXSB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5tZWRpYVR5cGUgPT09IGEuZCAmJiAobi50dGwgPSAzNjAwLCBuLnZhc3RYbWwgPSBlLmFkbSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IFtdOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBnZXRVc2VyU3luY3M6IGZ1bmN0aW9uIChlLCB0LCByLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG4gPyAnJnVzX3ByaXZhY3k9Jy5jb25jYXQobikgOiAnJywgaSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucGl4ZWxFbmFibGVkICYmIHQubGVuZ3RoID4gMCAmJiB0WzBdLmJvZHkgJiYgdFswXS5ib2R5LmNvb2tpZVN5bmNVcmxzICYmIHRbMF0uYm9keS5jb29raWVTeW5jVXJscy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2ltYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBlICsgbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG9uVGltZW91dDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgb25CaWRXb246IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG9uU2V0VGFyZ2V0aW5nOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHYoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5hcGk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgQXJyYXkuaXNBcnJheSh0KSAmJiB0Lmxlbmd0aCA+IDAgPyB0IDogWzJdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnByb3RvY29sczsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiBBcnJheS5pc0FycmF5KHQpICYmIHQubGVuZ3RoID4gMCA/IHQgOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgIDUsCiAgICAgICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgIDgKICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09IHR5cGVvZiBlLmdldEZsb29yKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5nZXRGbG9vcih7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW5jeTogJ1VTRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYVR5cGU6IGUubWVkaWFUeXBlcyAmJiBlLm1lZGlhVHlwZXMudmlkZW8gPyAndmlkZW8nIDogJ2Jhbm5lcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOiBlLnNpemVzLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHc6IGVbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGg6IGVbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QnICE9PSB1KHIpIHx8ICdVU0QnICE9PSByLmN1cnJlbmN5IHx8IGlzTmFOKHBhcnNlRmxvYXQoci5mbG9vcikpIHx8ICh0ID0gcGFyc2VGbG9hdChyLmZsb29yKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSB0ID8gdCA6IGUucGFyYW1zLmZsb29yOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3QoYy5iKShPYmplY3Qobi5kZWVwQWNjZXNzKShlLCAndXNlcklkJykpIHx8IFtdLCByID0gT2JqZWN0KG4uZGVlcEFjY2VzcykoZSwgJ3VzZXJJZC5mbG9jSWQnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gciAmJiByLmlkICYmIHIudmVyc2lvbiAmJiB0LnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdjaHJvbWUuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgdWlkczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogci5pZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHQ6IHsgdmVyOiByLnZlcnNpb24gfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGooZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGUgPyB0IDogZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIE9iamVjdChvLnJlZ2lzdGVyQmlkZGVyKShnKSwgd2luZG93LnBianMuaW5zdGFsbGVkTW9kdWxlcy5wdXNoKCdzaGFyZXRocm91Z2hCaWRBZGFwdGVyJyk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCBbODExXSk7CiAgICAgICAgcGJqc0NodW5rKFsxMDVdLCB7CiAgICAgICAgICAgIDg5MzogZnVuY3Rpb24gKGUsIG4sIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHQoODk0KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgODk0OiBmdW5jdGlvbiAoZSwgbiwgdCkgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KG4sICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHQuZChuLCAndWlkMklkU3VibW9kdWxlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBzOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IHQoMCksIGkgPSB0KDkpLCByID0gdCg3KSwgZCA9ICd1aWQyJywgdSA9ICdfX3VpZDJfYWR2ZXJ0aXNpbmdfdG9rZW4nOwogICAgICAgICAgICAgICAgdmFyIGEsIGwgPSBPYmplY3Qoci5iKSg4ODcsIGQpLCBjID0gKGEgPSAnVUlEMjogJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCwgbiA9IG5ldyBBcnJheShlKSwgdCA9IDA7IHQgPCBlOyB0KyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3RdID0gYXJndW1lbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICBvLmxvZ0luZm8uYXBwbHkodm9pZCAwLCBbYSArICcgJ10uY29uY2F0KG4pKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciBzID0gewogICAgICAgICAgICAgICAgICAgIG5hbWU6IGQsCiAgICAgICAgICAgICAgICAgICAgZ3ZsaWQ6IDg4NywKICAgICAgICAgICAgICAgICAgICBkZWNvZGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0geyBpZDogZSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnVpZDIgPSB0LCBjKCdEZWNvZGVkIHZhbHVlICcgKyBKU09OLnN0cmluZ2lmeShuKSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBnZXRJZDogZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgYygnQ3JlYXRpbmcgVUlEIDIuMCcpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IChsLmNvb2tpZXNBcmVFbmFibGVkKCkgPyBsLmdldENvb2tpZSh1KSA6IG51bGwpIHx8IChsLmxvY2FsU3RvcmFnZUlzRW5hYmxlZCgpID8gbC5nZXREYXRhRnJvbUxvY2FsU3RvcmFnZSh1KSA6IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYygnVGhlIGFkdmVydGlzaW5nIHRva2VuOiAnICsgdCksIHsgaWQ6IHQgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgT2JqZWN0KGkuZSkoJ3VzZXJJZCcsIHMpLCB3aW5kb3cucGJqcy5pbnN0YWxsZWRNb2R1bGVzLnB1c2goJ3VpZDJJZFN5c3RlbScpOwogICAgICAgICAgICB9CiAgICAgICAgfSwgWzg5M10pOwogICAgICAgIHBianNDaHVuayhbMTJdLCB7CiAgICAgICAgICAgIDE1OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdC5iID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuaGFzT3duUHJvcGVydHkobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3B1YlByb3ZpZGVkSWQnID09PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0LmNvbmNhdChlLnB1YlByb3ZpZGVkSWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBhKGVbbl0sIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gJiYgdC5wdXNoKG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgfSwgdC5hID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KG8uaXNQbGFpbk9iamVjdCkoZS5pZE9iaikgJiYgT2JqZWN0LmtleXMoZS5pZE9iaikubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIH0pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoZS5pZE9iaikuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KG8uZGVlcEFjY2VzcykoZSwgJ2NvbmZpZy5iaWRkZXJzJykgJiYgQXJyYXkuaXNBcnJheShlLmNvbmZpZy5iaWRkZXJzKSAmJiBPYmplY3Qoby5kZWVwQWNjZXNzKShyLCBuICsgJy5zb3VyY2UnKSAmJiB0LnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogcltuXS5zb3VyY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZGVyczogZS5jb25maWcuYmlkZGVycwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHZhciBvID0gbigwKSwgciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgaW50ZW50SXFJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaW50ZW50aXEuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG5hdmVnZ0lkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICduYXZlZ2cuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1YmNpZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAncHViY2lkLm9yZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB0ZGlkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdhZHNlcnZlci5vcmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRVaWRFeHQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geyBydGlQYXJ0bmVyOiAnVERJRCcgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaWQ1aWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnVpZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdpZDUtc3luYy5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRVaWRFeHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuZXh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnJhYmxlSWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ3BhcnJhYmxlLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVpZCA/IGUuZWlkIDogZS5jY3BhT3B0b3V0ID8gJycgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFVpZEV4dDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdChvLnBpY2spKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2liYU9wdG91dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjY3BhT3B0b3V0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3Qua2V5cyh0KS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBpZGxfZW52OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdsaXZlcmFtcC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDMKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbGlwYjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubGlwYmlkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2xpdmVpbnRlbnQuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RWlkRXh0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGUuc2VnbWVudHMpICYmIGUuc2VnbWVudHMubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geyBzZWdtZW50czogZS5zZWdtZW50cyB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBicml0ZXBvb2xpZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnYnJpdGVwb29sLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBkbWRJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaGNuLmhlYWx0aCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBsb3RhbWVQYW5vcmFtYUlkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdjcndkY250cmwubmV0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNyaXRlb0lkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdjcml0ZW8uY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG1lcmtsZUlkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdtZXJrbGVpbmMuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VWlkRXh0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGUua2V5SUQgPyB7IGtleUlEOiBlLmtleUlEIH0gOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICduZXRpZC5kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBJRFA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ3plb3RhcC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaGFsb0lkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdhdWRpZ2VudC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcXVhbnRjYXN0SWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ3F1YW50Y2FzdC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbmV4dHJvbGxJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnbmV4dHJvbGwuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGlkeDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnaWR4LmxhdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBjb25uZWN0aWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ3Zlcml6b25tZWRpYS5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDMKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZmFicmlja0lkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICduZXVzdGFyLmJpeicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBtd09wZW5MaW5rSWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ21lZGlhd2FsbGFoc2NyaXB0LmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB0YXBhZElkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICd0YXBhZC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbm92YXRpcTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc25vd2ZsYWtlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ25vdmF0aXEuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVpZDI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ3VpZGFwaS5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRWYWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5pZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZGFwSWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2FrYW1haS5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZGVlcGludGVudElkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdkZWVwaW50ZW50LmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBhZG1peGVySWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2FkbWl4ZXIubmV0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAzCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFkdGVsbGlnZW50SWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2FkdGVsbGlnZW50LmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBhbXhJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnYW14cnRiLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaW5rSWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2Vwc2lsb24uY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiAzCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGtwdWlkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdrcHVpZC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDMKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaW11aWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2ludGltYXRlbWVyZ2VyLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBjb25uZWN0SWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ3lhaG9vLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHlwZTogMwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBxaWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ2FkcXVlcnkuaW8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXR5cGU6IDEKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHJbdF07CiAgICAgICAgICAgICAgICAgICAgaWYgKG4gJiYgZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBhLnNvdXJjZSA9IG4uc291cmNlOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IE9iamVjdChvLmlzRm4pKG4uZ2V0VmFsdWUpID8gbi5nZXRWYWx1ZShlKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3Qoby5pc1N0cikoaSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0eXBlOiBuLmF0eXBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChvLmlzRm4pKG4uZ2V0VWlkRXh0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gbi5nZXRVaWRFeHQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSAmJiAoYy5leHQgPSB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLnVpZHMgPSBbY10sIE9iamVjdChvLmlzRm4pKG4uZ2V0RWlkRXh0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gbi5nZXRFaWRFeHQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyAmJiAoYS5leHQgPSBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICA5MDU6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBuKDkwNik7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIDkwNjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCBuLmQodCwgJ1BCSlNfVVNFUl9JRF9PUFRPVVRfTkFNRScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQzsKICAgICAgICAgICAgICAgIH0pLCBuLmQodCwgJ2NvcmVTdG9yYWdlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBQOwogICAgICAgICAgICAgICAgfSksIG4uZCh0LCAnc3luY0RlbGF5JywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBJOwogICAgICAgICAgICAgICAgfSksIG4uZCh0LCAnYXVjdGlvbkRlbGF5JywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBrOwogICAgICAgICAgICAgICAgfSksIHQuc2V0U3VibW9kdWxlUmVnaXN0cnkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIEwgPSBlOwogICAgICAgICAgICAgICAgfSwgdC5zZXRTdG9yZWRWYWx1ZSA9IE4sIHQuc2V0U3RvcmVkQ29uc2VudERhdGEgPSBSLCB0LmZpbmRSb290RG9tYWluID0gSCwgdC5yZXF1ZXN0Qmlkc0hvb2sgPSBLLCBuLmQodCwgJ3ZhbGlkYXRlR2RwckVuZm9yY2VtZW50JywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBaOwogICAgICAgICAgICAgICAgfSksIHQuYXR0YWNoSWRTeXN0ZW0gPSBvZSwgdC5pbml0ID0gcmU7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMTEpLCByID0gbi5uKG8pLCBhID0gbigzKSwgaSA9IG4oMTApLCBjID0gbi5uKGkpLCB1ID0gbigxNCksIHMgPSBuKDgpLCBkID0gbig1KSwgbCA9IG4ubihkKSwgZiA9IG4oOSksIGcgPSBuKDE1KSwgYiA9IG4oNyksIHAgPSBuKDApLCBtID0gbigxMiksIHkgPSBuLm4obSk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBPKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICd1bmRlZmluZWQnICE9IHR5cGVvZiBTeW1ib2wgJiYgZVtTeW1ib2wuaXRlcmF0b3JdIHx8IGVbJ0BAaXRlcmF0b3InXTsKICAgICAgICAgICAgICAgICAgICBpZiAoIW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkgfHwgKG4gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoZSkuc2xpY2UoOCwgLTEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdPYmplY3QnID09PSBuICYmIGUuY29uc3RydWN0b3IgJiYgKG4gPSBlLmNvbnN0cnVjdG9yLm5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnTWFwJyA9PT0gbiB8fCAnU2V0JyA9PT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LmZyb20oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdBcmd1bWVudHMnID09PSBuIHx8IC9eKD86VWl8SSludCg/Ojh8MTZ8MzIpKD86Q2xhbXBlZCk/QXJyYXkkLy50ZXN0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdihlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkpIHx8IHQgJiYgZSAmJiAnbnVtYmVyJyA9PSB0eXBlb2YgZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgKGUgPSBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gMCwgciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG46IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gPj0gZS5sZW5ndGggPyB7IGRvbmU6ICEwIH0gOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlW28rK10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmOiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ludmFsaWQgYXR0ZW1wdCB0byBpdGVyYXRlIG5vbi1pdGVyYWJsZSBpbnN0YW5jZS5cbkluIG9yZGVyIHRvIGJlIGl0ZXJhYmxlLCBub24tYXJyYXkgb2JqZWN0cyBtdXN0IGhhdmUgYSBbU3ltYm9sLml0ZXJhdG9yXSgpIG1ldGhvZC4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGEsIGkgPSAhMCwgYyA9ICExOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBuLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG46IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbi5uZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSA9IGUuZG9uZSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAhMCwgYSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGY6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSB8fCBudWxsID09IG4ucmV0dXJuIHx8IG4ucmV0dXJuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHYoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIChudWxsID09IHQgfHwgdCA+IGUubGVuZ3RoKSAmJiAodCA9IGUubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMCwgbyA9IG5ldyBBcnJheSh0KTsgbiA8IHQ7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgb1tuXSA9IGVbbl07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgaiwgaCwgSSwgaywgdywgRCA9ICdVc2VyIElEJywgUyA9ICdjb29raWUnLCBFID0gJ2h0bWw1JywgeCA9ICdfcGJqc191c2VyaWRfY29uc2VudF9kYXRhJywgQSA9IDMwLCBDID0gJ19wYmpzX2lkX29wdG91dCcsIFAgPSBPYmplY3QoYi5hKSgndXNlcmlkJyksIFUgPSBbXSwgXyA9ICExLCBUID0gW10sIFYgPSBbXSwgTCA9IFtdOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gTihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmNvbmZpZy5zdG9yYWdlLCBvID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZS5zdWJtb2R1bGUuZG9tYWluT3ZlcnJpZGUgPyBlLnN1Ym1vZHVsZS5kb21haW5PdmVycmlkZSgpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdChwLmlzUGxhaW5PYmplY3QpKHQpID8gSlNPTi5zdHJpbmdpZnkodCkgOiB0LCBhID0gbmV3IERhdGUoRGF0ZS5ub3coKSArIDg2NDAwMDAwICogbi5leHBpcmVzKS50b1VUQ1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICBuLnR5cGUgPT09IFMgPyAoUC5zZXRDb29raWUobi5uYW1lLCByLCBhLCAnTGF4JywgbyksICdudW1iZXInID09IHR5cGVvZiBuLnJlZnJlc2hJblNlY29uZHMgJiYgUC5zZXRDb29raWUoJycuY29uY2F0KG4ubmFtZSwgJ19sYXN0JyksIG5ldyBEYXRlKCkudG9VVENTdHJpbmcoKSwgYSwgJ0xheCcsIG8pKSA6IG4udHlwZSA9PT0gRSAmJiAoUC5zZXREYXRhSW5Mb2NhbFN0b3JhZ2UoJycuY29uY2F0KG4ubmFtZSwgJ19leHAnKSwgYSksIFAuc2V0RGF0YUluTG9jYWxTdG9yYWdlKG4ubmFtZSwgZW5jb2RlVVJJQ29tcG9uZW50KHIpKSwgJ251bWJlcicgPT0gdHlwZW9mIG4ucmVmcmVzaEluU2Vjb25kcyAmJiBQLnNldERhdGFJbkxvY2FsU3RvcmFnZSgnJy5jb25jYXQobi5uYW1lLCAnX2xhc3QnKSwgbmV3IERhdGUoKS50b1VUQ1N0cmluZygpKSk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QocC5sb2dFcnJvcikoZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3QocC5nZXRQcmViaWRJbnRlcm5hbCkoKS5zZXRFaWRQZXJtaXNzaW9uczsKICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiB0ICYmIE9iamVjdChwLmlzQXJyYXkpKGUpICYmIHQoT2JqZWN0KGcuYSkoZSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRihlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgbyA9IG4gPyAnJy5jb25jYXQoZS5uYW1lLCAnXycpLmNvbmNhdChuKSA6IGUubmFtZTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS50eXBlID09PSBTKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IFAuZ2V0Q29va2llKG8pOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChlLnR5cGUgPT09IEUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gUC5nZXREYXRhRnJvbUxvY2FsU3RvcmFnZSgnJy5jb25jYXQoZS5uYW1lLCAnX2V4cCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnID09PSByID8gdCA9IFAuZ2V0RGF0YUZyb21Mb2NhbFN0b3JhZ2UobykgOiByICYmIG5ldyBEYXRlKHIpLmdldFRpbWUoKSAtIERhdGUubm93KCkgPiAwICYmICh0ID0gZGVjb2RlVVJJQ29tcG9uZW50KFAuZ2V0RGF0YUZyb21Mb2NhbFN0b3JhZ2UobykpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PSB0eXBlb2YgdCAmJiAneycgPT09IHQudHJpbSgpLmNoYXJBdCgwKSAmJiAodCA9IEpTT04ucGFyc2UodCkpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHAubG9nRXJyb3IpKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE0oZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gewogICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50U3RyaW5nOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgZ2RwckFwcGxpZXM6ICExLAogICAgICAgICAgICAgICAgICAgICAgICBhcGlWZXJzaW9uOiAwCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAodC5jb25zZW50U3RyaW5nID0gZS5jb25zZW50U3RyaW5nLCB0LmdkcHJBcHBsaWVzID0gZS5nZHByQXBwbGllcywgdC5hcGlWZXJzaW9uID0gZS5hcGlWZXJzaW9uKSwgT2JqZWN0KHAuY3lyYjUzSGFzaCkoSlNPTi5zdHJpbmdpZnkodCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUihlKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuZXcgRGF0ZShEYXRlLm5vdygpICsgODY0MDAwMDAgKiBBKS50b1VUQ1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICBQLnNldENvb2tpZSh4LCBNKGUpLCB0LCAnTGF4Jyk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QocC5sb2dFcnJvcikoZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRygpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUC5nZXRDb29raWUoeCk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QocC5sb2dFcnJvcikoZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSihlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgJ2Jvb2xlYW4nID09IHR5cGVvZiBlLmdkcHJBcHBsaWVzICYmIGUuZ2RwckFwcGxpZXMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlLmNvbnNlbnRTdHJpbmcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxID09PSBlLmFwaVZlcnNpb24gJiYgITEgPT09IE9iamVjdChwLmRlZXBBY2Nlc3MpKGUsICd2ZW5kb3JEYXRhLnB1cnBvc2VDb25zZW50cy4xJykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgyID09PSBlLmFwaVZlcnNpb24gJiYgITEgPT09IE9iamVjdChwLmRlZXBBY2Nlc3MpKGUsICd2ZW5kb3JEYXRhLnB1cnBvc2UuY29uc2VudHMuMScpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBIKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiB3aW5kb3cubG9jYXRpb24uaG9zdG5hbWU7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFQLmNvb2tpZXNBcmVFbmFibGVkKCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBvID0gZS5zcGxpdCgnLicpOwogICAgICAgICAgICAgICAgICAgIGlmICgyID09IG8ubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IC0yLCBhID0gJ19yZGMnLmNvbmNhdChEYXRlLm5vdygpKSwgaSA9ICd3cml0ZWFibGUnOwogICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IG8uc2xpY2Uocikuam9pbignLicpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG5ldyBEYXRlKE9iamVjdChwLnRpbWVzdGFtcCkoKSArIDEwMDAwKS50b1VUQ1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICBQLnNldENvb2tpZShhLCBpLCBjLCAnTGF4JywgdCwgdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBQLmdldENvb2tpZShhLCB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICB1ID09PSBpID8gKG4gPSAhMSwgUC5zZXRDb29raWUoYSwgJycsICdUaHUsIDAxIEphbiAxOTcwIDAwOjAwOjAxIEdNVCcsIHZvaWQgMCwgdCwgdm9pZCAwKSkgOiAociArPSAtMSwgbiA9IE1hdGguYWJzKHIpIDw9IG8ubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB9IHdoaWxlIChuKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFcoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdCAmJiAobiA9IE9iamVjdChwLmRlbGF5RXhlY3V0aW9uKShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dChoKSwgdCgpOwogICAgICAgICAgICAgICAgICAgIH0sIGUubGVuZ3RoKSksIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBlLmNhbGxiYWNrKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID8gKGUuY29uZmlnLnN0b3JhZ2UgJiYgTihlLCB0KSwgZS5pZE9iaiA9IGUuc3VibW9kdWxlLmRlY29kZSh0LCBlLmNvbmZpZykpIDogT2JqZWN0KHAubG9nSW5mbykoJycuY29uY2F0KEQsICc6ICcpLmNvbmNhdChlLnN1Ym1vZHVsZS5uYW1lLCAnIC0gcmVxdWVzdCBpZCByZXNwb25kZWQgd2l0aCBhbiBlbXB0eSB2YWx1ZScpKSwgbigpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgZS5jYWxsYmFjayA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHooZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5pc0FycmF5KGUpICYmIGUubGVuZ3RoID8gZS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChwLmlzUGxhaW5PYmplY3QpKGUuaWRPYmopICYmIE9iamVjdC5rZXlzKGUuaWRPYmopLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICB9KS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKHQuaWRPYmopLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbbl0gPSB0LmlkT2JqW25dOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgZTsKICAgICAgICAgICAgICAgICAgICB9LCB7fSkgOiB7fTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIFtlXS5zb21lKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhQXJyYXkuaXNBcnJheShlKSB8fCAhZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgfSkgfHwgZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUuYmlkcyAmJiBPYmplY3QocC5pc0FycmF5KShlLmJpZHMpICYmIGUuYmlkcy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LmlzQXJyYXkoZSkgJiYgZS5sZW5ndGggJiYgdCA/IGUuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZS5jb25maWcuYmlkZGVycyB8fCAhT2JqZWN0KHAuaXNBcnJheSkoZS5jb25maWcuYmlkZGVycykgfHwgeSgpKGUuY29uZmlnLmJpZGRlcnMsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHAuaXNQbGFpbk9iamVjdCkoZS5pZE9iaikgJiYgT2JqZWN0LmtleXMoZS5pZE9iaikubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXModC5pZE9iaikuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtuXSA9IHQuaWRPYmpbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9KSA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0LCBlLmJpZGRlcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhuKS5sZW5ndGggJiYgKGUudXNlcklkID0gbiwgZS51c2VySWRBc0VpZHMgPSBPYmplY3QoZy5iKShuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gJChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAhMTsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBqICYmIChqID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gWihlLCB0KSwgbyA9IG4udXNlcklkTW9kdWxlczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbi5oYXNWYWxpZGF0ZWQgJiYgIUoodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChwLmxvZ1dhcm4pKCcnLmNvbmNhdChELCAnIC0gZ2RwciBwZXJtaXNzaW9uIG5vdCB2YWxpZCBmb3IgbG9jYWwgc3RvcmFnZSBvciBjb29raWVzLCBleGl0IG1vZHVsZScpKSwgW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IEcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBSKHQpLCBvLnJlZHVjZShmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlZShuLCB0LCByLCAhMSksIGUucHVzaChuKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfShULCBzLmdkcHJEYXRhSGFuZGxlci5nZXRDb25zZW50RGF0YSgpKSkubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHEoaik7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gai5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QocC5pc0ZuKShlLmNhbGxiYWNrKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICYmIGsgPiAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gITEsIHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvIHx8IChvID0gITAsIGUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHAubG9nSW5mbykoJycuY29uY2F0KEQsICcgLSBhdWN0aW9uIGRlbGF5ZWQgYnkgJykuY29uY2F0KGssICcgYXQgbW9zdCB0byBmZXRjaCBpZHMnKSksIGggPSBzZXRUaW1lb3V0KHIsIGspLCBXKG4sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5hLm9uKGwuYS5FVkVOVFMuQVVDVElPTl9FTkQsIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMuYS5vZmYobC5hLkVWRU5UUy5BVUNUSU9OX0VORCwgZSksIEkgPiAwID8gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBJKSA6IFcobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGUgJiYgIXQgJiYgZSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgJChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEIodC5hZFVuaXRzIHx8IE9iamVjdCh1LmEpKCkuYWRVbml0cywgaik7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdyAmJiAoWCgpIHx8IFtdKS5maW5kKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zb3VyY2UgPT09IHc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobiAmJiAnc3RyaW5nJyA9PSB0eXBlb2YgT2JqZWN0KHAuZGVlcEFjY2VzcykobiwgJ3VpZHMuMC5pZCcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG4udWlkc1swXS5pZC5yZXBsYWNlKC9bXFdfXS9nLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLmxlbmd0aCA+PSAzMiAmJiBvLmxlbmd0aCA8PSAxNTAgPyBPYmplY3QocC5pc0dwdFB1YmFkc0RlZmluZWQpKCkgPyB3aW5kb3cuZ29vZ2xldGFnLnB1YmFkcygpLnNldFB1Ymxpc2hlclByb3ZpZGVkSWQobykgOiAod2luZG93Lmdvb2dsZXRhZyA9IHdpbmRvdy5nb29nbGV0YWcgfHwge30sIHdpbmRvdy5nb29nbGV0YWcuY21kID0gd2luZG93Lmdvb2dsZXRhZy5jbWQgfHwgW10sIHdpbmRvdy5nb29nbGV0YWcuY21kLnB1c2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5nb29nbGV0YWcucHViYWRzKCkuc2V0UHVibGlzaGVyUHJvdmlkZWRJZChvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSA6IE9iamVjdChwLmxvZ1dhcm4pKCdVc2VyIElEIC0gR29vZ2xldGFnIFB1Ymxpc2hlciBQcm92aWRlZCBJRCBmb3IgJy5jb25jYXQodywgJyBpcyBub3QgYmV0d2VlbiAzMiBhbmQgMTUwIGNoYXJhY3RlcnMgLSAnKS5jb25jYXQobykpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbCh0aGlzLCB0KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFEoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoKSwgeihqKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFgoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoKSwgT2JqZWN0KGcuYikoeihqKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBZKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUgPyBlLnN1Ym1vZHVsZU5hbWVzIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICBuIHx8IChuID0gW10pLCAkKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBzLmdkcHJEYXRhSGFuZGxlci5nZXRDb25zZW50RGF0YSgpLCBvID0gWihULCBlKSwgciA9IG8udXNlcklkTW9kdWxlczsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8uaGFzVmFsaWRhdGVkIHx8IEooZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gRygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgUihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpLCBjID0gW10sIHUgPSBPKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHUucygpOyAhKGkgPSB1Lm4oKSkuZG9uZTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBpLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmxlbmd0aCA+IDAgJiYgLTEgPT09IG4uaW5kZXhPZihkLnN1Ym1vZHVsZS5uYW1lKSB8fCAoT2JqZWN0KHAubG9nSW5mbykoJycuY29uY2F0KEQsICcgLSByZWZyZXNoaW5nICcpLmNvbmNhdChkLnN1Ym1vZHVsZS5uYW1lKSksIGVlKGQsIGUsIGEsICEwKSwgdGUoZCksIGoubGVuZ3RoICYmIHEoaiksIE9iamVjdChwLmlzRm4pKGQuY2FsbGJhY2spICYmIGMucHVzaChkKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUuZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5mKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmxlbmd0aCA+IDAgJiYgVyhjKSwgdCAmJiB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHAubG9nV2FybikoJycuY29uY2F0KEQsICcgLSBnZHByIHBlcm1pc3Npb24gbm90IHZhbGlkIGZvciBsb2NhbCBzdG9yYWdlIG9yIGNvb2tpZXMsIGV4aXQgbW9kdWxlJykpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIFogPSBPYmplY3QoZi5iKSgnc3luYycsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgdXNlcklkTW9kdWxlczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgaGFzVmFsaWRhdGVkOiB0ICYmIHQuaGFzVmFsaWRhdGVkCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sICd2YWxpZGF0ZUdkcHJFbmZvcmNlbWVudCcpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZWUoZSwgdCwgbiwgbykgewogICAgICAgICAgICAgICAgICAgIGlmIChlLmNvbmZpZy5zdG9yYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBhID0gRihlLmNvbmZpZy5zdG9yYWdlKSwgaSA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ251bWJlcicgPT0gdHlwZW9mIGUuY29uZmlnLnN0b3JhZ2UucmVmcmVzaEluU2Vjb25kcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgRGF0ZShGKGUuY29uZmlnLnN0b3JhZ2UsICdsYXN0JykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGMgJiYgRGF0ZS5ub3coKSAtIGMuZ2V0VGltZSgpID4gMTAwMCAqIGUuY29uZmlnLnN0b3JhZ2UucmVmcmVzaEluU2Vjb25kczsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAhYSB8fCBpIHx8IG8gfHwgIWZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBlICYmIGUgPT09IE0odCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0obiwgdCkgPyByID0gZS5zdWJtb2R1bGUuZ2V0SWQoZS5jb25maWcsIHQsIGEpIDogJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZS5zdWJtb2R1bGUuZXh0ZW5kSWQgJiYgKHIgPSBlLnN1Ym1vZHVsZS5leHRlbmRJZChlLmNvbmZpZywgdCwgYSkpLCBPYmplY3QocC5pc1BsYWluT2JqZWN0KShyKSAmJiAoci5pZCAmJiAoTihlLCByLmlkKSwgYSA9IHIuaWQpLCAnZnVuY3Rpb24nID09IHR5cGVvZiByLmNhbGxiYWNrICYmIChlLmNhbGxiYWNrID0gci5jYWxsYmFjaykpLCBhICYmIChlLmlkT2JqID0gZS5zdWJtb2R1bGUuZGVjb2RlKGEsIGUuY29uZmlnKSk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChlLmNvbmZpZy52YWx1ZSkKICAgICAgICAgICAgICAgICAgICAgICAgZS5pZE9iaiA9IGUuY29uZmlnLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IGUuc3VibW9kdWxlLmdldElkKGUuY29uZmlnLCB0LCB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QocC5pc1BsYWluT2JqZWN0KSh1KSAmJiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdS5jYWxsYmFjayAmJiAoZS5jYWxsYmFjayA9IHUuY2FsbGJhY2spLCB1LmlkICYmIChlLmlkT2JqID0gZS5zdWJtb2R1bGUuZGVjb2RlKHUuaWQsIGUuY29uZmlnKSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHRlKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gITEsIG4gPSAwOyBuIDwgai5sZW5ndGg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuY29uZmlnLm5hbWUudG9Mb3dlckNhc2UoKSA9PT0galtuXS5jb25maWcubmFtZS50b0xvd2VyQ2FzZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gITAsIGpbbl0gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0IHx8IGoucHVzaChlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG5lKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LmlzQXJyYXkoZSkgPyBlLnJlZHVjZShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF0IHx8IE9iamVjdChwLmlzRW1wdHlTdHIpKHQubmFtZSkgfHwgKCF0LnN0b3JhZ2UgfHwgT2JqZWN0KHAuaXNFbXB0eVN0cikodC5zdG9yYWdlLnR5cGUpIHx8IE9iamVjdChwLmlzRW1wdHlTdHIpKHQuc3RvcmFnZS5uYW1lKSB8fCAtMSA9PT0gbi5pbmRleE9mKHQuc3RvcmFnZS50eXBlKSA/IE9iamVjdChwLmlzUGxhaW5PYmplY3QpKHQudmFsdWUpID8gZS5wdXNoKHQpIDogdC5zdG9yYWdlIHx8IHQudmFsdWUgfHwgZS5wdXNoKHQpIDogZS5wdXNoKHQpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgW10pIDogW107CiAgICAgICAgICAgICAgICAgICAgfShWLCAwLCBVKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBMLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFyKCkoVCwgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5uYW1lID09PSBlLm5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIFQgPSB0Lm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSByKCkoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uYW1lICYmIChlLm5hbWUudG9Mb3dlckNhc2UoKSA9PT0gdC5uYW1lLnRvTG93ZXJDYXNlKCkgfHwgdC5hbGlhc05hbWUgJiYgZS5uYW1lLnRvTG93ZXJDYXNlKCkgPT09IHQuYWxpYXNOYW1lLnRvTG93ZXJDYXNlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiB0Lm5hbWUgIT09IG4ubmFtZSAmJiAobi5uYW1lID0gdC5uYW1lKSwgdC5maW5kUm9vdERvbWFpbiA9IEgsIG4gPyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VibW9kdWxlOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZzogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkT2JqOiB2b2lkIDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB9KS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgIV8gJiYgVC5sZW5ndGggJiYgKE9iamVjdCh1LmEpKCkucmVxdWVzdEJpZHMuYmVmb3JlKEssIDQwKSwgT2JqZWN0KHAubG9nSW5mbykoJycuY29uY2F0KEQsICcgLSB1c2Vyc3luYyBjb25maWcgdXBkYXRlZCBmb3IgJykuY29uY2F0KFQubGVuZ3RoLCAnIHN1Ym1vZHVsZXM6ICcpLCBULm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3VibW9kdWxlLm5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgXyA9ICEwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvZShlKSB7CiAgICAgICAgICAgICAgICAgICAgcigpKEwsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lm5hbWUgPT09IGUubmFtZTsKICAgICAgICAgICAgICAgICAgICB9KSB8fCAoTC5wdXNoKGUpLCBuZSgpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJlKGUpIHsKICAgICAgICAgICAgICAgICAgICB3ID0gdm9pZCAwLCBUID0gW10sIFYgPSBbXSwgXyA9ICExLCBqID0gdm9pZCAwLCAtMSAhPT0gKFUgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIFAubG9jYWxTdG9yYWdlSXNFbmFibGVkKCkgPyBFIDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgUC5jb29raWVzQXJlRW5hYmxlZCgpID8gUyA6IG51bGwKICAgICAgICAgICAgICAgICAgICBdLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gZTsKICAgICAgICAgICAgICAgICAgICB9KSkuaW5kZXhPZihTKSAmJiBQLmdldENvb2tpZShDKSA/IE9iamVjdChwLmxvZ0luZm8pKCcnLmNvbmNhdChELCAnIC0gb3B0LW91dCBjb29raWUgZm91bmQsIGV4aXQgbW9kdWxlJykpIDogLTEgIT09IFUuaW5kZXhPZihFKSAmJiBQLmdldERhdGFGcm9tTG9jYWxTdG9yYWdlKEMpID8gT2JqZWN0KHAubG9nSW5mbykoJycuY29uY2F0KEQsICcgLSBvcHQtb3V0IGxvY2FsU3RvcmFnZSBmb3VuZCwgZXhpdCBtb2R1bGUnKSkgOiAoZS5nZXRDb25maWcoJ3VzZXJTeW5jJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnVzZXJTeW5jOwogICAgICAgICAgICAgICAgICAgICAgICB3ID0gdC5wcGlkLCB0ICYmIHQudXNlcklkcyAmJiAoViA9IHQudXNlcklkcywgSSA9IE9iamVjdChwLmlzTnVtYmVyKSh0LnN5bmNEZWxheSkgPyB0LnN5bmNEZWxheSA6IDUwMCwgayA9IE9iamVjdChwLmlzTnVtYmVyKSh0LmF1Y3Rpb25EZWxheSkgPyB0LmF1Y3Rpb25EZWxheSA6IDAsIG5lKCkpOwogICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QodS5hKSgpLmdldFVzZXJJZHMgPSBRLCBPYmplY3QodS5hKSgpLmdldFVzZXJJZHNBc0VpZHMgPSBYLCBPYmplY3QodS5hKSgpLnJlZnJlc2hVc2VySWRzID0gWSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZShhLmIpLCBPYmplY3QoZi5jKSgndXNlcklkJywgb2UpLCB3aW5kb3cucGJqcy5pbnN0YWxsZWRNb2R1bGVzLnB1c2goJ3VzZXJJZCcpOwogICAgICAgICAgICB9CiAgICAgICAgfSwgWzkwNV0pOwogICAgICAgIHBianNDaHVuayhbNzldLCB7CiAgICAgICAgICAgIDk1MDogZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIoOTUxKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgOTUxOiBmdW5jdGlvbiAoZSwgdCwgcikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHIuZCh0LCAnc3BlYycsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gSTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIGkgPSByKDEpLCBhID0gcigyKSwgcyA9IHIoMCksIGQgPSByKDMpLCBuID0gcigxMyk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdC5rZXlzKGUpOwogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAoaSA9IGkuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLCB0KS5lbnVtZXJhYmxlOwogICAgICAgICAgICAgICAgICAgICAgICB9KSksIHIucHVzaC5hcHBseShyLCBpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCBpbiBlID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICB9KSA6IGVbdF0gPSByLCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHAgPSAnNi42LjAnLCBiID0gJ1VTRCcsIG0gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG1peGVyLm5ldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdhZHNlcnZlci5vcmcnLAogICAgICAgICAgICAgICAgICAgICAgICAnYWR0ZWxsaWdlbnQuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2FrYW1haS5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAnYW14cnRiLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICdhdWRpZ2VudC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAnYnJpdGVwb29sLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICdjcml0ZW8uY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2Nyd2RjbnRybC5uZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGVlcGludGVudC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAnaGNuLmhlYWx0aCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdpZDUtc3luYy5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAnaWR4LmxhdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdpbnRlbnRpcS5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAnaW50aW1hdGVtZXJnZXIuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xpdmVpbnRlbnQuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xpdmVyYW1wLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICdtZWRpYXdhbGxhaHNjcmlwdC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAnbWVya2xlaW5jLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICduZXRpZC5kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICduZXVzdGFyLmJpeicsCiAgICAgICAgICAgICAgICAgICAgICAgICduZXh0cm9sbC5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAnbm92YXRpcS5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAncGFycmFibGUuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3B1YmNpZC5vcmcnLAogICAgICAgICAgICAgICAgICAgICAgICAncXVhbnRjYXN0LmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICdxdWFudGNhc3QuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3RhcGFkLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICd1aWRhcGkuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3Zlcml6b25tZWRpYS5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAneWFob28uY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3plb3RhcC5jb20nCiAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHc6IHBhcnNlSW50KGVbMF0pLAogICAgICAgICAgICAgICAgICAgICAgICBoOiBwYXJzZUludChlWzFdKQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHMuaXNBcnJheSkoZSkgJiYgMiA9PT0gZS5sZW5ndGggJiYgIU9iamVjdChzLmlzQXJyYXkpKGVbMF0pID8gW3UoZSldIDogZS5tYXAodSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHMuaXNBcnJheSkoT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3VzZXJJZEFzRWlkcycpKSA/IGUudXNlcklkQXNFaWRzLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgIT09IG0uaW5kZXhPZihlLnNvdXJjZSk7CiAgICAgICAgICAgICAgICAgICAgfSkgOiBbXTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE8oZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qocy5kZWVwQWNjZXNzKShlLCAncGFyYW1zLmJpZE92ZXJyaWRlLmltcC5zZWN1cmUnKSB8fCAnaHR0cHM6JyA9PT0gZG9jdW1lbnQubG9jYXRpb24ucHJvdG9jb2wgPyAxIDogMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGooZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qocy5kZWVwQWNjZXNzKShlLCAncGFyYW1zLnB1YklkJykgPyB0ID0gITAgOiBPYmplY3Qocy5kZWVwQWNjZXNzKShlLCAncGFyYW1zLmRjbicpICYmIE9iamVjdChzLmRlZXBBY2Nlc3MpKGUsICdwYXJhbXMucG9zJykgJiYgKHQgPSAhMSksIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZC5iLmdldENvbmZpZygneWFob29zc3AubW9kZScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IChlID0gZSA/IGUudG9Mb3dlckNhc2UoKSA6IHZvaWQgMCkgfHwgZSA9PT0gYS5iID8gYS5iIDogZSA9PT0gYS5kID8gYS5kIDogJ2FsbCcgPT09IGUgPyAnKicgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHkoKSwgciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbmN5OiBPYmplY3Qocy5kZWVwQWNjZXNzKShlLCAncGFyYW1zLmJpZE92ZXJyaWRlLmN1cicpIHx8IGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZWRpYVR5cGU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOiAnKicKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFPYmplY3Qocy5pc0ZuKShlLmdldEZsb29yKSAmJiBlLmdldEZsb29yKHIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhlLCB0LCByLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBudWxsICE9IGFyZ3VtZW50c1t0XSA/IGFyZ3VtZW50c1t0XSA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAlIDIgPyBjKE9iamVjdChyKSwgITApLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKGUsIHQsIHJbdF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGUsIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKHIpKSA6IGMoT2JqZWN0KHIpKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHQsIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IociwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSh7fSwgaSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCBpbiByKQogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc3RyaW5nJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0xICE9PSB0LmluZGV4T2YoZCkgJiYgT2JqZWN0KHMuaXNTdHIpKHJbZF0pICYmIChhW2RdID0gcltkXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbnVtYmVyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0xICE9PSB0LmluZGV4T2YoZCkgJiYgT2JqZWN0KHMuaXNOdW1iZXIpKHJbZF0pICYmIChhW2RdID0gcltkXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYXJyYXknOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEgIT09IHQuaW5kZXhPZihkKSAmJiBPYmplY3Qocy5pc0FycmF5KShyW2RdKSAmJiAoYVtkXSA9IHJbZF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ29iamVjdCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMSAhPT0gdC5pbmRleE9mKGQpICYmIE9iamVjdChzLmlzUGxhaW5PYmplY3QpKHJbZF0pICYmIChhW2RdID0gcltkXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnb2JqZWN0QWxsS2V5cyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qocy5pc1BsYWluT2JqZWN0KShyKSAmJiAoYVtkXSA9IHJbZF0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBoKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGQuYi5nZXRDb25maWcoJ3lhaG9vc3NwLnR0bCcpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHQgfHwgT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy50dGwnKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBBKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHMuaXNOdW1iZXIpKGUpICYmIGUgPiAwICYmIGUgPCAzNjAwID8gZSA6IDMwMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHgoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qocy5pc1N0cikoZSkgJiYgZS5sZW5ndGggPiAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gVChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogT2JqZWN0KHMuZ2VuZXJhdGVVVUlEKSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VyOiBbZihlKS5jdXJyZW5jeSB8fCBPYmplY3Qocy5kZWVwQWNjZXNzKSh0LCAncGFyYW1zLmJpZE92ZXJyaWRlLmN1cicpIHx8IGJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaW1wOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpdGU6IHsgcGFnZTogT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3JlZmVyZXJJbmZvLnJlZmVyZXInKSB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG50OiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVhOiBuYXZpZ2F0b3IudXNlckFnZW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlwOiBPYmplY3Qocy5kZWVwQWNjZXNzKSh0LCAncGFyYW1zLmJpZE92ZXJyaWRlLmRldmljZS5pcCcpIHx8IE9iamVjdChzLmRlZXBBY2Nlc3MpKHQsICdwYXJhbXMuZXh0LmlwJykgfHwgdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVnczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c19wcml2YWN5OiBlLnVzcENvbnNlbnQgPyBlLnVzcENvbnNlbnQgOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2RwcjogZS5nZHByQ29uc2VudCAmJiBlLmdkcHJDb25zZW50LmdkcHJBcHBsaWVzID8gMSA6IDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhiOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGFwdGVydmVyOiAnMS4wLjInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmViaWR2ZXI6IHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludGVncmF0aW9uOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJlYmlkLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcjogcAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZDogMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudDogZS5nZHByQ29uc2VudCAmJiBlLmdkcHJDb25zZW50LmdkcHJBcHBsaWVzID8gZS5nZHByQ29uc2VudC5jb25zZW50U3RyaW5nIDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVpZHM6IGwodCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gaih0KSA/IChyLnNpdGUucHVibGlzaGVyID0geyBpZDogdC5wYXJhbXMucHViSWQgfSwgKE9iamVjdChzLmRlZXBBY2Nlc3MpKHQsICdwYXJhbXMuYmlkT3ZlcnJpZGUuc2l0ZS5pZCcpIHx8IE9iamVjdChzLmRlZXBBY2Nlc3MpKHQsICdwYXJhbXMuc2l0ZUlkJykpICYmIChyLnNpdGUuaWQgPSBPYmplY3Qocy5kZWVwQWNjZXNzKSh0LCAncGFyYW1zLmJpZE92ZXJyaWRlLnNpdGUuaWQnKSB8fCB0LnBhcmFtcy5zaXRlSWQpKSA6IHIuc2l0ZS5pZCA9IHQucGFyYW1zLmRjbiwgZC5iLmdldENvbmZpZygnb3J0YjInKSAmJiAociA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGQuYi5nZXRDb25maWcoJ29ydGIyJyksIGkgPSBPYmplY3Qocy5kZWVwQWNjZXNzKShyLCAnc2l0ZScpIHx8IHZvaWQgMCwgYSA9IE9iamVjdChzLmRlZXBBY2Nlc3MpKGksICdjb250ZW50JykgfHwgdm9pZCAwLCBuID0gT2JqZWN0KHMuZGVlcEFjY2VzcykoaSwgJ2NvbnRlbnQuZGF0YScpIHx8IHZvaWQgMCwgYyA9IE9iamVjdChzLmRlZXBBY2Nlc3MpKHIsICdhcHAuY29udGVudCcpIHx8IHZvaWQgMCwgbyA9IE9iamVjdChzLmRlZXBBY2Nlc3MpKHIsICdhcHAuY29udGVudC5kYXRhJykgfHwgdm9pZCAwLCBwID0gT2JqZWN0KHMuZGVlcEFjY2VzcykociwgJ3VzZXInKSB8fCB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSAmJiBPYmplY3Qocy5pc1BsYWluT2JqZWN0KShpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RvbWFpbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmVmJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdrZXl3b3JkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2VhcmNoJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBtID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NhdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2VjdGlvbmNhdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGFnZWNhdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgdSA9IFsnZXh0J107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zaXRlID0gZygnc3RyaW5nJywgYiwgaSwgZS5zaXRlKSwgZS5zaXRlID0gZygnYXJyYXknLCBtLCBpLCBlLnNpdGUpLCBlLnNpdGUgPSBnKCdvYmplY3QnLCB1LCBpLCBlLnNpdGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEgJiYgT2JqZWN0KHMuaXNQbGFpbk9iamVjdCkoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGl0bGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NlcmllcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2Vhc29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnZW5yZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29udGVudHJhdGluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGFuZ3VhZ2UnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIGwgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXBpc29kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJvZHEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbnRleHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2xpdmVzdHJlYW0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2xlbicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgTyA9IFsnY2F0J10sIGogPSBbJ2V4dCddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc2l0ZS5jb250ZW50ID0gZygnc3RyaW5nJywgdiwgYSwgZS5zaXRlLmNvbnRlbnQpLCBlLnNpdGUuY29udGVudCA9IGcoJ251bWJlcicsIGwsIGEsIGUuc2l0ZS5jb250ZW50KSwgZS5zaXRlLmNvbnRlbnQgPSBnKCdhcnJheScsIE8sIGEsIGUuc2l0ZS5jb250ZW50KSwgZS5zaXRlLmNvbnRlbnQgPSBnKCdvYmplY3QnLCBqLCBhLCBlLnNpdGUuY29udGVudCksIG4gJiYgT2JqZWN0KHMuaXNBcnJheSkobikgJiYgbi5ldmVyeShmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHt9LCBpID0gWydzZWdtZW50J10sIGEgPSBbJ2V4dCddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gZygnc3RyaW5nJywgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICduYW1lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCB0LCByKSwgciA9IGcoJ2FycmF5JywgaSwgdCwgciksIHIgPSBnKCdvYmplY3QnLCBhLCB0LCByKSwgZS5zaXRlLmNvbnRlbnQuZGF0YSA9IFtdLCBlLnNpdGUuY29udGVudC5kYXRhLnB1c2gocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjICYmIE9iamVjdChzLmlzUGxhaW5PYmplY3QpKGMpICYmIG8gJiYgT2JqZWN0KHMuaXNBcnJheSkobykgJiYgby5ldmVyeShmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0ge30sIGkgPSBbJ3NlZ21lbnQnXSwgYSA9IFsnZXh0J107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IGcoJ3N0cmluZycsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25hbWUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgdCwgciksIHIgPSBnKCdhcnJheScsIGksIHQsIHIpLCByID0gZygnb2JqZWN0JywgYSwgdCwgciksIGUuYXBwID0geyBjb250ZW50OiB7IGRhdGE6IFtdIH0gfSwgZS5hcHAuY29udGVudC5kYXRhLnB1c2gocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwICYmIE9iamVjdChzLmlzUGxhaW5PYmplY3QpKHApKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHkgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2J1eWVydWlkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnZW5kZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2tleXdvcmRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjdXN0b21kYXRhJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBmID0gWyd5b2InXSwgaCA9IFsnZGF0YSddLCBBID0gWydleHQnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnVzZXIgPSBnKCdzdHJpbmcnLCB5LCBwLCBlLnVzZXIpLCBlLnVzZXIgPSBnKCdudW1iZXInLCBmLCBwLCBlLnVzZXIpLCBlLnVzZXIgPSBnKCdhcnJheScsIGgsIHAsIGUudXNlciksIGUudXNlci5leHQgPSBnKCdvYmplY3QnLCBBLCBwLCBlLnVzZXIuZXh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KHIpKSwgT2JqZWN0KHMuZGVlcEFjY2VzcykodCwgJ3NjaGFpbicpICYmIChyLnNvdXJjZS5leHQuc2NoYWluID0gdC5zY2hhaW4sIHIuc291cmNlLmV4dC5zY2hhaW4ubm9kZXNbMF0ucmlkID0gci5pZCksIHI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB5KCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBlLmJpZElkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdXJlOiBPKGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZmxvb3I6IGYoZSkuZmxvb3IgfHwgT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy5iaWRPdmVycmlkZS5pbXAuYmlkZmxvb3InKQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUubWVkaWFUeXBlcy5iYW5uZXIgfHwgdm9pZCAwICE9PSByICYmIHIgIT09IGEuYiAmJiAnKicgIT09IHIgfHwgKGkuYmFubmVyID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbWVzOiBlLm1lZGlhVHlwZXMuYmFubmVyLm1pbWVzIHx8IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RleHQvaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0ZXh0L2phdmFzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYXBwbGljYXRpb24vamF2YXNjcmlwdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbWFnZS9qcGcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JtYXQ6IHYoZS5zaXplcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUubWVkaWFUeXBlcy5iYW5uZXIucG9zICYmIChpLmJhbm5lci5wb3MgPSBlLm1lZGlhVHlwZXMuYmFubmVyLnBvcykpLCBlLm1lZGlhVHlwZXMudmlkZW8gJiYgKHIgPT09IGEuZCB8fCAnKicgPT09IHIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHYoZS5tZWRpYVR5cGVzLnZpZGVvLnBsYXllclNpemUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaS52aWRlbyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaW1lczogT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy5iaWRPdmVycmlkZS5pbXAudmlkZW8ubWltZXMnKSB8fCBlLm1lZGlhVHlwZXMudmlkZW8ubWltZXMgfHwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndmlkZW8vbXA0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FwcGxpY2F0aW9uL2phdmFzY3JpcHQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3OiBPYmplY3Qocy5kZWVwQWNjZXNzKShlLCAncGFyYW1zLmJpZE92ZXJyaWRlLmltcC52aWRlby53JykgfHwgZFswXS53LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGg6IE9iamVjdChzLmRlZXBBY2Nlc3MpKGUsICdwYXJhbXMuYmlkT3ZlcnJpZGUuaW1wLnZpZGVvLmgnKSB8fCBkWzBdLmgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4Yml0cmF0ZTogT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy5iaWRPdmVycmlkZS5pbXAudmlkZW8ubWF4Yml0cmF0ZScpIHx8IGUubWVkaWFUeXBlcy52aWRlby5tYXhiaXRyYXRlIHx8IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhkdXJhdGlvbjogT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy5iaWRPdmVycmlkZS5pbXAudmlkZW8ubWF4ZHVyYXRpb24nKSB8fCBlLm1lZGlhVHlwZXMudmlkZW8ubWF4ZHVyYXRpb24gfHwgdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbmR1cmF0aW9uOiBPYmplY3Qocy5kZWVwQWNjZXNzKShlLCAncGFyYW1zLmJpZE92ZXJyaWRlLmltcC52aWRlby5taW5kdXJhdGlvbicpIHx8IGUubWVkaWFUeXBlcy52aWRlby5taW5kdXJhdGlvbiB8fCB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBpOiBPYmplY3Qocy5kZWVwQWNjZXNzKShlLCAncGFyYW1zLmJpZE92ZXJyaWRlLmltcC52aWRlby5hcGknKSB8fCBlLm1lZGlhVHlwZXMudmlkZW8uYXBpIHx8IFsyXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxpdmVyeTogT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy5iaWRPdmVycmlkZS5pbXAudmlkZW8uZGVsaXZlcnknKSB8fCBlLm1lZGlhVHlwZXMudmlkZW8uZGVsaXZlcnkgfHwgdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvczogT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy5iaWRPdmVycmlkZS5pbXAudmlkZW8ucG9zJykgfHwgZS5tZWRpYVR5cGVzLnZpZGVvLnBvcyB8fCB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGxheWJhY2ttZXRob2Q6IE9iamVjdChzLmRlZXBBY2Nlc3MpKGUsICdwYXJhbXMuYmlkT3ZlcnJpZGUuaW1wLnZpZGVvLnBsYXliYWNrbWV0aG9kJykgfHwgZS5tZWRpYVR5cGVzLnZpZGVvLnBsYXliYWNrbWV0aG9kIHx8IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwbGFjZW1lbnQ6IE9iamVjdChzLmRlZXBBY2Nlc3MpKGUsICdwYXJhbXMuYmlkT3ZlcnJpZGUuaW1wLnZpZGVvLnBsYWNlbWVudCcpIHx8IGUubWVkaWFUeXBlcy52aWRlby5wbGFjZW1lbnQgfHwgdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVhcml0eTogT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy5iaWRPdmVycmlkZS5pbXAudmlkZW8ubGluZWFyaXR5JykgfHwgZS5tZWRpYVR5cGVzLnZpZGVvLmxpbmVhcml0eSB8fCAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3RvY29sczogT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy5iaWRPdmVycmlkZS5pbXAudmlkZW8ucHJvdG9jb2xzJykgfHwgZS5tZWRpYVR5cGVzLnZpZGVvLnByb3RvY29scyB8fCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ZGVsYXk6IE9iamVjdChzLmRlZXBBY2Nlc3MpKGUsICdwYXJhbXMuYmlkT3ZlcnJpZGUuaW1wLnZpZGVvLnN0YXJ0ZGVsYXknKSB8fCBlLm1lZGlhVHlwZXMudmlkZW8uc3RhcnRkZWxheSB8fCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJld2FyZGVkOiBPYmplY3Qocy5kZWVwQWNjZXNzKShlLCAncGFyYW1zLmJpZE92ZXJyaWRlLmltcC52aWRlby5yZXdhcmRlZCcpIHx8IHZvaWQgMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaS5leHQgPSB7IGRmcF9hZF91bml0X2NvZGU6IGUuYWRVbml0Q29kZSB9LCBPYmplY3Qocy5kZWVwQWNjZXNzKShlLCAncGFyYW1zLmt2cCcpICYmIE9iamVjdChzLmlzUGxhaW5PYmplY3QpKGUucGFyYW1zLmt2cCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIChpLmV4dC5rdnMgPSB7fSwgZS5wYXJhbXMua3ZwKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0KHMuaXNTdHIpKGUucGFyYW1zLmt2cFtuXSkgfHwgT2JqZWN0KHMuaXNOdW1iZXIpKGUucGFyYW1zLmt2cFtuXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuZXh0Lmt2c1tuXSA9IGUucGFyYW1zLmt2cFtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChPYmplY3Qocy5pc0FycmF5KShlLnBhcmFtcy5rdnBbbl0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gZS5wYXJhbXMua3ZwW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoYy5ldmVyeShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChzLmlzU3RyKShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgfHwgYy5ldmVyeShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChzLmlzTnVtYmVyKShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpICYmIChpLmV4dC5rdnNbbl0gPSBlLnBhcmFtcy5rdnBbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ29ydGIySW1wLmV4dC5kYXRhJykgJiYgT2JqZWN0KHMuaXNQbGFpbk9iamVjdCkoZS5vcnRiMkltcC5leHQuZGF0YSkgJiYgKGkuZXh0LmRhdGEgPSBlLm9ydGIySW1wLmV4dC5kYXRhKSwgT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ29ydGIySW1wLmluc3RsJykgJiYgT2JqZWN0KHMuaXNOdW1iZXIpKGUub3J0YjJJbXAuaW5zdGwpICYmIDEgPT09IGUub3J0YjJJbXAuaW5zdGwgJiYgKGkuaW5zdGwgPSBlLm9ydGIySW1wLmluc3RsKSwgITEgPT09IGooZSkgPyAoaS50YWdpZCA9IGUucGFyYW1zLnBvcywgaS5leHQucG9zID0gZS5wYXJhbXMucG9zKSA6IE9iamVjdChzLmRlZXBBY2Nlc3MpKGUsICdwYXJhbXMucGxhY2VtZW50SWQnKSAmJiAoaS50YWdpZCA9IGUucGFyYW1zLnBsYWNlbWVudElkKSwgdC5pbXAucHVzaChpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBrKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucGF5bG9hZCwgciA9IGUucmVxdWVzdE9wdGlvbnMsIGkgPSBlLmJpZGRlclJlcXVlc3QsIG4gPSBqKGkpLCBjID0gZC5iLmdldENvbmZpZygneWFob29zc3AuZW5kcG9pbnQnKSB8fCAnaHR0cHM6Ly9jMnNoYi5wdWJndy55YWhvby5jb20vYmlkUmVxdWVzdCc7CiAgICAgICAgICAgICAgICAgICAgaWYgKCEwID09PSBuICYmIChjID0gZC5iLmdldENvbmZpZygneWFob29zc3AuZW5kcG9pbnQnKSB8fCAnaHR0cHM6Ly9jMnNoYi5wdWJndy55YWhvby5jb20vYWRtYXgvYmlkL3BhcnRuZXJzL1BCSlMnKSwgITAgPT09IE9iamVjdChzLmRlZXBBY2Nlc3MpKGksICdwYXJhbXMudGVzdGluZy5lMmV0ZXN0JykpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3Qocy5sb2dJbmZvKSgneWFob29zc3AgYWRhcHRlciBlMmV0ZXN0IG1vZGUgaXMgYWN0aXZlJyksIHIud2l0aENyZWRlbnRpYWxzID0gITEsICEwID09PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zaXRlLmlkID0gJzEyMzQ1NjcnOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0geSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zaXRlLmlkID0gJzhhOTY5NTE2MDE3YTdhMzk2ZWM1MzlkOTdmNTQwMDExJywgdC5pbXAuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXh0LmUyZVRlc3RNb2RlID0gITAsIG8gPT09IGEuYiA/IGUudGFnaWQgPSAnOGE5Njk5NzgwMTdhN2FhYWJhYjRhYjBiYzAxYTAwMDknIDogbyA9PT0gYS5kID8gZS50YWdpZCA9ICc4YTk2OTU4YTAxN2E3YTU3YWMzNzVkNTBjMGM3MDBjYycgOiAoT2JqZWN0KHMubG9nV2FybikoJ3lhaG9vc3NwIGFkYXB0ZXIgZTJldGVzdCBtb2RlIGRvZXMgbm90IHN1cHBvcnQgeWFob29zc3AubW9kZT0iYWxsIi4gXG4gUGxlYXNlIHNwZWNpZnkgZWl0aGVyICJiYW5uZXIiIG9yICJ2aWRlbyInKSwgT2JqZWN0KHMubG9nV2FybikoJ3lhaG9vc3NwIGFkYXB0ZXIgZTJldGVzdCBtb2RlOiBQbGVhc2UgbWFrZSBzdXJlIHlvdXIgYWRVbml0IG1hdGNoZXMgdGhlIHlhaG9vc3NwLm1vZGUgdmlkZW8gb3IgYmFubmVyJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KHMubG9nV2FybikoJ3lhaG9vc3NwIGFkYXB0ZXIgZW5kcG9pbnQgb3ZlcnJpZGUgZW5hYmxlZC4gUG9pbnRpbmcgcmVxdWVzdHMgdG86ICcsIGMpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogYywKICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlclJlcXVlc3Q6IGkKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIEkgPSB7CiAgICAgICAgICAgICAgICAgICAgY29kZTogJ3lhaG9vc3NwJywKICAgICAgICAgICAgICAgICAgICBhbGlhc2VzOiBbXSwKICAgICAgICAgICAgICAgICAgICBzdXBwb3J0ZWRNZWRpYVR5cGVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIGEuYiwKICAgICAgICAgICAgICAgICAgICAgICAgYS5kCiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBpc0JpZFJlcXVlc3RWYWxpZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnBhcmFtczsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBPYmplY3Qocy5kZWVwQWNjZXNzKSh0LCAndGVzdGluZy5lMmV0ZXN0JykgfHwgKCEoIU9iamVjdChzLmlzUGxhaW5PYmplY3QpKHQpIHx8ICEoeCh0LnB1YklkKSB8fCB4KHQuZGNuKSAmJiB4KHQucG9zKSkpIHx8IChPYmplY3Qocy5sb2dXYXJuKSgneWFob29zc3AgYmlkZGVyIHBhcmFtcyBtaXNzaW5nIG9yIGluY29ycmVjdCwgcGxlYXNlIHBhc3Mgb2JqZWN0IHdpdGggZWl0aGVyOiBkY24gJiBwb3MgT1IgcHViSWQnKSwgITEpKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGJ1aWxkUmVxdWVzdHM6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghT2JqZWN0KHMuaXNFbXB0eSkoZSkgJiYgIU9iamVjdChzLmlzRW1wdHkpKHQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50VHlwZTogJ2FwcGxpY2F0aW9uL2pzb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbUhlYWRlcnM6IHsgJ3gtb3BlbnJ0Yi12ZXJzaW9uJzogJzIuNScgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIud2l0aENyZWRlbnRpYWxzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIShlICYmIGUuZ2RwckNvbnNlbnQgJiYgZS5nZHByQ29uc2VudC5nZHByQXBwbGllcyAmJiAyID09PSBlLmdkcHJDb25zZW50LmFwaVZlcnNpb24pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHkoKSwgciA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID09PSBhLmIgPyByID0gZS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGUubWVkaWFUeXBlcykuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IGEuYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiB0ID09PSBhLmQgPyByID0gZS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGUubWVkaWFUeXBlcykuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IGEuZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiAnKicgPT09IHQgJiYgKHIgPSBlLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZS5tZWRpYVR5cGVzKS5zb21lKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gYS5iIHx8IGUgPT09IGEuZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghMCA9PT0gZC5iLmdldENvbmZpZygneWFob29zc3Auc2luZ2xlUmVxdWVzdE1vZGUnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gVCh0LCBpWzBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcoZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGsoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXlsb2FkOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0T3B0aW9uczogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZGVyUmVxdWVzdDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBUKHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3KGUsIGkpLCBrKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF5bG9hZDogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdE9wdGlvbnM6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpZGRlclJlcXVlc3Q6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChzLmxvZ1dhcm4pKCd5YWhvb3NzcCBBZGFwdGVyOiBidWlsZFJlcXVlc3RzIGNhbGxlZCB3aXRoIGVpdGhlciBlbXB0eSAidmFsaWRCaWRSZXF1ZXN0cyIgb3IgImJpZGRlclJlcXVlc3QiJyk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpbnRlcnByZXRSZXNwb25zZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdC5kYXRhOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQuYmlkZGVyUmVxdWVzdCwgaSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5ib2R5ICYmIEFycmF5LmlzQXJyYXkoZS5ib2R5LnNlYXRiaWQpID8gKGUuYm9keS5zZWF0YmlkLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gZS5iaWRbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHQuZXh0ICYmIHQuZXh0LmVuY3AgPyB0LmV4dC5lbmNwIDogdC5wcmljZSwgYyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRJZDogT2JqZWN0KHMuZGVlcEFjY2VzcykodCwgJ2FkSWQnKSA/IHQuYWRJZCA6IHQuaW1waWQgfHwgdC5jcmlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZFVuaXRDb2RlOiByLmFkVW5pdENvZGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3RJZDogdC5pbXBpZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmlkZGVyQ29kZTogSS5jb2RlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcG06IGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiB0LncsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogdC5oLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGl2ZUlkOiB0LmNyaWQgfHwgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVuY3k6IHQuY3VyIHx8IGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlYWxJZDogdC5kZWFsaWQgPyB0LmRlYWxpZCA6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldFJldmVudWU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0dGw6IGgociksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGE6IHsgYWR2ZXJ0aXNlckRvbWFpbnM6IHQuYWRvbWFpbiB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5hZG07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSAhPT0gdC5pbmRleE9mKCdvMnBsYXllclNldHRpbmdzJykgfHwgLTEgIT09IHQuaW5kZXhPZignWUFIT08uVmlkZW9QbGF0Zm9ybS5WaWRlb1BsYXllcicpIHx8IC0xICE9PSB0LmluZGV4T2YoJ0FkUGxhY2VtZW50JykgPyBhLmIgOiAtMSAhPT0gdC5pbmRleE9mKCdWQVNUJykgPyBhLmQgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPT09IGEuYiA/IChjLm1lZGlhVHlwZSA9IGEuYiwgYy5hZCA9IHQuYWRtLCBjLm1ldGEubWVkaWFUeXBlID0gYS5iKSA6IG8gPT09IGEuZCAmJiAoYy5tZWRpYVR5cGUgPSBhLmQsIGMubWV0YS5tZWRpYVR5cGUgPSBhLmQsIGMudmFzdFhtbCA9IHQuYWRtLCB0Lm51cmwgJiYgKGMudmFzdFVybCA9IHQubnVybCkpLCAnb3V0c3RyZWFtJyAhPT0gT2JqZWN0KHMuZGVlcEFjY2VzcykociwgJ21lZGlhVHlwZXMudmlkZW8uY29udGV4dCcpIHx8IHIucmVuZGVyZXIgfHwgKGMucmVuZGVyZXIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbi5hLmluc3RhbGwoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL2Nkbi52aWRpYmxlLnR2L3Byb2QvaGItb3V0c3RyZWFtLXJlbmRlcmVyL3JlbmRlcmVyLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9hZGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRVbml0Q29kZTogZS5hZFVuaXRDb2RlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5zZXRSZW5kZXIoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8yUGxheWVyUmVuZGVyKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgT2JqZWN0KHMuZGVlcEFjY2VzcykoZSwgJ3BhcmFtcy50ZXN0aW5nLnJlbmRlcmVyLnNldFRpbWVvdXQnKSB8fCA3MDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChzLmxvZ1dhcm4pKCd5YWhvb3NzcCByZW5kZXJlciBlcnJvcjogc2V0UmVuZGVyKCkgZmFpbGVkJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShyKSB8fCB2b2lkIDApLCBpLnB1c2goYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpKSA6IGk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBnZXRVc2VyU3luY3M6IGZ1bmN0aW9uIChlLCB0LCByLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gIU9iamVjdChzLmlzRW1wdHkpKHQpICYmIHRbMF0uYm9keTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgJiYgYS5leHQgJiYgYS5leHQucGl4ZWxzID8gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gL1x3Kig/PVxzKS8sIGkgPSAvc3JjPSgifCcpKC4qPylcMS8sIGEgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB0Lm1hdGNoKC8oaW1nfGlmcmFtZSlbXHNcU10qP3NyY1xzKj1ccyooInwnKSguKj8pXDIvZ2kpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgJiYgcy5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gdC5tYXRjaChyKVswXSwgZCA9IHQubWF0Y2goaSlbMl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzICYmIGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJ2ltZycgPT09IHMudG9Mb3dlckNhc2UoKSA/ICdpbWFnZScgOiAnaWZyYW1lJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5pZnJhbWVFbmFibGVkICYmICdpZnJhbWUnID09PSBuIHx8ICFlLnBpeGVsRW5hYmxlZCAmJiAnaW1hZ2UnID09PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgfShlLCBhLmV4dC5waXhlbHMpIDogW107CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIE9iamVjdChpLnJlZ2lzdGVyQmlkZGVyKShJKSwgd2luZG93LnBianMuaW5zdGFsbGVkTW9kdWxlcy5wdXNoKCd5YWhvb3NzcEJpZEFkYXB0ZXInKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIFs5NTBdKTsKICAgICAgICBwYmpzLnByb2Nlc3NRdWV1ZSgpOwogICAgfSgpKQp9"},{"name":"sugarcoat-821a7439b994eb58f64748b0553bf1d5b78a731d","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfNWE4NGUxOWIyMTIyYmE5NiA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja181YTg0ZTE5YjIxMjJiYTk2KTsKICAgIGNvbnN0ICRfX19tb2NrXzkyM2Q3NzJiZGMyMWZkODggPSB7fTsKICAgIChleHBvcnRzID0+IHsKICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgbGV0IGlzU2VhbGVkID0gZmFsc2U7CiAgICAgICAgY2xhc3MgU3RvcmFnZSB7CiAgICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICAgICAgaWYgKGlzU2VhbGVkKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSWxsZWdhbCBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBsZW5ndGgoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXModGhpcykubGVuZ3RoOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGtleShpbmRleCkgewogICAgICAgICAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKHRoaXMpOwogICAgICAgICAgICAgICAgaWYgKGluZGV4IDwgMCB8fCBpbmRleCA+PSBrZXlzLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGtleXNbaW5kZXhdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldEl0ZW0oa2V5KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHRoaXMsIGtleSkgPyB0aGlzW2tleV0gOiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldEl0ZW0oa2V5LCB2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1trZXldID0gU3RyaW5nKHZhbHVlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZW1vdmVJdGVtKGtleSkgewogICAgICAgICAgICAgICAgZGVsZXRlIHRoaXNba2V5XTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjbGVhcigpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGtleXMgPSBPYmplY3Qua2V5cyh0aGlzKTsKICAgICAgICAgICAgICAgIGZvciAoY29uc3Qga2V5IG9mIGtleXMpIHsKICAgICAgICAgICAgICAgICAgICBkZWxldGUgdGhpc1trZXldOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGV4cG9ydHMuU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogU3RvcmFnZSwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgICAgIGNvbnN0IGxvY2FsU3RvcmFnZSA9IG5ldyBTdG9yYWdlKCk7CiAgICAgICAgZXhwb3J0cy5sb2NhbFN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZ2V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIGxvY2FsU3RvcmFnZTsKICAgICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgY29uc3Qgc2Vzc2lvblN0b3JhZ2UgPSBuZXcgU3RvcmFnZSgpOwogICAgICAgIGV4cG9ydHMuc2Vzc2lvblN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZ2V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHNlc3Npb25TdG9yYWdlOwogICAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICB9KSgkX19fbW9ja185MjNkNzcyYmRjMjFmZDg4KTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgIGZ1bmN0aW9uIG4ocikgewogICAgICAgICAgICAgICAgaWYgKHRbcl0pCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbcl0uZXhwb3J0czsKICAgICAgICAgICAgICAgIHZhciBvID0gdFtyXSA9IHsKICAgICAgICAgICAgICAgICAgICBpOiByLAogICAgICAgICAgICAgICAgICAgIGw6ICExLAogICAgICAgICAgICAgICAgICAgIGV4cG9ydHM6IHt9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIGVbcl0uY2FsbChvLmV4cG9ydHMsIG8sIG8uZXhwb3J0cywgbiksIG8ubCA9ICEwLCBvLmV4cG9ydHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbi5tID0gZSwgbi5jID0gdCwgbi5kID0gZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgIG4ubyhlLCB0KSB8fCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGdldDogcgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sIG4uciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIFN5bWJvbCAmJiBTeW1ib2wudG9TdHJpbmdUYWcgJiYgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIFN5bWJvbC50b1N0cmluZ1RhZywgeyB2YWx1ZTogJ01vZHVsZScgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICB9LCBuLnQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgaWYgKDEgJiB0ICYmIChlID0gbihlKSksIDggJiB0KQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgaWYgKDQgJiB0ICYmICdvYmplY3QnID09PSB0eXBlb2YgZSAmJiBlICYmIGUuX19lc01vZHVsZSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0LmNyZWF0ZShudWxsKTsKICAgICAgICAgICAgICAgIGlmIChuLnIociksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShyLCAnZGVmYXVsdCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlCiAgICAgICAgICAgICAgICAgICAgfSksIDIgJiB0ICYmICdzdHJpbmcnICE9IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgbi5kKHIsIG8sIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgfS5iaW5kKG51bGwsIG8pKTsKICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICB9LCBuLm4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgdmFyIHQgPSBlICYmIGUuX19lc01vZHVsZSA/IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5kZWZhdWx0OwogICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gbi5kKHQsICdhJywgdCksIHQ7CiAgICAgICAgICAgIH0sIG4ubyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsIHQpOwogICAgICAgICAgICB9LCBuLnAgPSAnLycsIG4obi5zID0gMTUwKTsKICAgICAgICB9KFsKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IG4oMjU4KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig2KSwgbyA9IG4oMzUpLmYsIGkgPSBuKDIyKSwgcyA9IG4oMjMpLCBhID0gbig1OCksIHUgPSBuKDgzKSwgYyA9IG4oNjUpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiwgZiwgbCwgcCwgZCwgaCA9IGUudGFyZ2V0LCB2ID0gZS5nbG9iYWwsIHkgPSBlLnN0YXQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSB2ID8gciA6IHkgPyByW2hdIHx8IGEoaCwge30pIDogKHJbaF0gfHwge30pLnByb3RvdHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChmIGluIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwID0gdFtmXSwgbCA9IGUubm9UYXJnZXRHZXQgPyAoZCA9IG8obiwgZikpICYmIGQudmFsdWUgOiBuW2ZdLCAhYyh2ID8gZiA6IGggKyAoeSA/ICcuJyA6ICcjJykgKyBmLCBlLmZvcmNlZCkgJiYgdm9pZCAwICE9PSBsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBwID09PSB0eXBlb2YgbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdShwLCBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIChlLnNoYW0gfHwgbCAmJiBsLnNoYW0pICYmIGkocCwgJ3NoYW0nLCAhMCksIHMobiwgZiwgcCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTIpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIXIoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihTdHJpbmcoZSkgKyAnIGlzIG5vdCBhbiBvYmplY3QnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhMTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyKSwgbyA9IG4oOTUpLCBpID0gbigyNCksIHMgPSBuKDgpLCBhID0gbig2OSksIHUgPSBuKDk0KSwgYyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RvcHBlZCA9IGUsIHRoaXMucmVzdWx0ID0gdDsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZiwgbCwgcCwgZCwgaCwgdiwgeSwgZyA9IG4gJiYgbi50aGF0LCBtID0gISghbiB8fCAhbi5BU19FTlRSSUVTKSwgYiA9ICEoIW4gfHwgIW4uSVNfSVRFUkFUT1IpLCBFID0gISghbiB8fCAhbi5JTlRFUlJVUFRFRCksIEMgPSBzKHQsIGcsIDEgKyBtICsgRSksIF8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYgJiYgdShmKSwgbmV3IGMoITAsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBTID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtID8gKHIoZSksIEUgPyBDKGVbMF0sIGVbMV0sIF8pIDogQyhlWzBdLCBlWzFdKSkgOiBFID8gQyhlLCBfKSA6IEMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgaWYgKGIpCiAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBlOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgKGwgPSBhKGUpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignVGFyZ2V0IGlzIG5vdCBpdGVyYWJsZScpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobyhsKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChwID0gMCwgZCA9IGkoZS5sZW5ndGgpOyBkID4gcDsgcCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoaCA9IFMoZVtwXSkpICYmIGggaW5zdGFuY2VvZiBjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgYyghMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGwuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZm9yICh2ID0gZi5uZXh0OyAhKHkgPSB2LmNhbGwoZikpLmRvbmU7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gUyh5LnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgdShmKSwgdzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT0gdHlwZW9mIGggJiYgaCAmJiBoIGluc3RhbmNlb2YgYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGMoITEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihTdHJpbmcoZSkgKyAnIGlzIG5vdCBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLk1hdGggPT0gTWF0aCAmJiBlOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gbignb2JqZWN0JyA9PSB0eXBlb2YgZ2xvYmFsVGhpcyAmJiBnbG9iYWxUaGlzKSB8fCBuKCdvYmplY3QnID09IHR5cGVvZiB3aW5kb3cgJiYgd2luZG93KSB8fCBuKCdvYmplY3QnID09IHR5cGVvZiBzZWxmICYmIHNlbGYpIHx8IG4oJ29iamVjdCcgPT0gdHlwZW9mIHQgJiYgdCkgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9KCkgfHwgRnVuY3Rpb24oJ3JldHVybiB0aGlzJykoKTsKICAgICAgICAgICAgICAgIH0uY2FsbCh0aGlzLCBuKDE1MykpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig2KSwgbyA9IG4oNjEpLCBpID0gbigxMyksIHMgPSBuKDQ2KSwgYSA9IG4oNjYpLCB1ID0gbig4NyksIGMgPSBvKCd3a3MnKSwgZiA9IHIuU3ltYm9sLCBsID0gdSA/IGYgOiBmICYmIGYud2l0aG91dFNldHRlciB8fCBzOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShjLCBlKSB8fCAoYSAmJiBpKGYsIGUpID8gY1tlXSA9IGZbZV0gOiBjW2VdID0gbCgnU3ltYm9sLicgKyBlKSksIGNbZV07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDUpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAocihlKSwgdm9pZCAwID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jYWxsKHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jYWxsKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jYWxsKHQsIG4sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jYWxsKHQsIG4sIHIsIG8pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0LCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDg0KSwgbyA9IG4oNiksIGkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZSA/IGUgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFyZ3VtZW50cy5sZW5ndGggPCAyID8gaShyW2VdKSB8fCBpKG9bZV0pIDogcltlXSAmJiByW2VdW3RdIHx8IG9bZV0gJiYgb1tlXVt0XTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oODQpLCBvID0gbigxMyksIGkgPSBuKDg5KSwgcyA9IG4oMTgpLmY7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gci5TeW1ib2wgfHwgKHIuU3ltYm9sID0ge30pOwogICAgICAgICAgICAgICAgICAgIG8odCwgZSkgfHwgcyh0LCBlLCB7IHZhbHVlOiBpLmYoZSkgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlKCk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnID09PSB0eXBlb2YgZSA/IG51bGwgIT09IGUgOiAnZnVuY3Rpb24nID09PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICB2YXIgbiA9IHt9Lmhhc093blByb3BlcnR5OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jYWxsKGUsIHQpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSB8fCAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHIobigyNzApKSwgcihuKDI3MSkpLCByKG4oMjcyKSksIHIobigyNzMpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSB8fCAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHIobigxMTkpKSwgcihuKDI3NCkpLCByKG4oMTIwKSksIHIobigxMjEpKSwgcihuKDI3NSkpLCByKG4oODApKSwgcihuKDEyMikpLCByKG4oMjc2KSksIHIobigyNzcpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMzgpLCBvID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnW29iamVjdCBBcnJheV0nID09PSBvLmNhbGwoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgPT09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGUgJiYgJ29iamVjdCcgPT09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0IEZ1bmN0aW9uXScgPT09IG8uY2FsbChlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBlICYmICd1bmRlZmluZWQnICE9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnICE9PSB0eXBlb2YgZSAmJiAoZSA9IFtlXSksIGkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMCwgciA9IGUubGVuZ3RoOyBuIDwgcjsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuY2FsbChudWxsLCBlW25dLCBuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbyBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLCBvKSAmJiB0LmNhbGwobnVsbCwgZVtvXSwgbywgZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgaXNBcnJheTogaSwKICAgICAgICAgICAgICAgICAgICBpc0FycmF5QnVmZmVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tvYmplY3QgQXJyYXlCdWZmZXJdJyA9PT0gby5jYWxsKGUpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNCdWZmZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmICFzKGUpICYmIG51bGwgIT09IGUuY29uc3RydWN0b3IgJiYgIXMoZS5jb25zdHJ1Y3RvcikgJiYgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGUuY29uc3RydWN0b3IuaXNCdWZmZXIgJiYgZS5jb25zdHJ1Y3Rvci5pc0J1ZmZlcihlKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzRm9ybURhdGE6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIEZvcm1EYXRhICYmIGUgaW5zdGFuY2VvZiBGb3JtRGF0YTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzQXJyYXlCdWZmZXJWaWV3OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBBcnJheUJ1ZmZlciAmJiBBcnJheUJ1ZmZlci5pc1ZpZXcgPyBBcnJheUJ1ZmZlci5pc1ZpZXcoZSkgOiBlICYmIGUuYnVmZmVyICYmIGUuYnVmZmVyIGluc3RhbmNlb2YgQXJyYXlCdWZmZXI7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc1N0cmluZzogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzTnVtYmVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ251bWJlcicgPT09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNPYmplY3Q6IGEsCiAgICAgICAgICAgICAgICAgICAgaXNVbmRlZmluZWQ6IHMsCiAgICAgICAgICAgICAgICAgICAgaXNEYXRlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tvYmplY3QgRGF0ZV0nID09PSBvLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc0ZpbGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnW29iamVjdCBGaWxlXScgPT09IG8uY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzQmxvYjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0IEJsb2JdJyA9PT0gby5jYWxsKGUpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNGdW5jdGlvbjogdSwKICAgICAgICAgICAgICAgICAgICBpc1N0cmVhbTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoZSkgJiYgdShlLnBpcGUpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNVUkxTZWFyY2hQYXJhbXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIFVSTFNlYXJjaFBhcmFtcyAmJiBlIGluc3RhbmNlb2YgVVJMU2VhcmNoUGFyYW1zOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNTdGFuZGFyZEJyb3dzZXJFbnY6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICgndW5kZWZpbmVkJyA9PT0gdHlwZW9mIG5hdmlnYXRvciB8fCAnUmVhY3ROYXRpdmUnICE9PSBuYXZpZ2F0b3IucHJvZHVjdCAmJiAnTmF0aXZlU2NyaXB0JyAhPT0gbmF2aWdhdG9yLnByb2R1Y3QgJiYgJ05TJyAhPT0gbmF2aWdhdG9yLnByb2R1Y3QpICYmICgndW5kZWZpbmVkJyAhPT0gdHlwZW9mIHdpbmRvdyAmJiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGRvY3VtZW50KTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGZvckVhY2g6IGMsCiAgICAgICAgICAgICAgICAgICAgbWVyZ2U6IGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4obiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT09IHR5cGVvZiB0W3JdICYmICdvYmplY3QnID09PSB0eXBlb2YgbiA/IHRbcl0gPSBlKHRbcl0sIG4pIDogdFtyXSA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IDAsIG8gPSBhcmd1bWVudHMubGVuZ3RoOyByIDwgbzsgcisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhhcmd1bWVudHNbcl0sIG4pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGRlZXBNZXJnZTogZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb2JqZWN0JyA9PT0gdHlwZW9mIHRbcl0gJiYgJ29iamVjdCcgPT09IHR5cGVvZiBuID8gdFtyXSA9IGUodFtyXSwgbikgOiB0W3JdID0gJ29iamVjdCcgPT09IHR5cGVvZiBuID8gZSh7fSwgbikgOiBuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSAwLCBvID0gYXJndW1lbnRzLmxlbmd0aDsgciA8IG87IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMoYXJndW1lbnRzW3JdLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBleHRlbmQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjKHQsIGZ1bmN0aW9uICh0LCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW29dID0gbiAmJiAnZnVuY3Rpb24nID09PSB0eXBlb2YgdCA/IHIodCwgbikgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgZTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHRyaW06IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlcGxhY2UoL15ccyovLCAnJykucmVwbGFjZSgvXHMqJC8sICcnKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDExKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9ICFyKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gNyAhPSBPYmplY3QuZGVmaW5lUHJvcGVydHkoe30sIDEsIHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gNzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pWzFdOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTcpLCBvID0gbig4MiksIGkgPSBuKDIpLCBzID0gbig0NCksIGEgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiAgICAgICAgICAgICAgICB0LmYgPSByID8gYSA6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGkoZSksIHQgPSBzKHQsICEwKSwgaShuKSwgbykKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoJ2dldCcgaW4gbiB8fCAnc2V0JyBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ0FjY2Vzc29ycyBub3Qgc3VwcG9ydGVkJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd2YWx1ZScgaW4gbiAmJiAoZVt0XSA9IG4udmFsdWUpLCBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSB8fCAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHIobig3OCkpLCByKG4oMTQpKSwgcihuKDE1KSksIHIobigzMCkpLCByKG4oMTMwKSksIHIobigxMzEpKSwgcihuKDEzMikpLCByKG4oMjgzKSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMiksIG8gPSBuKDUpLCBpID0gbig3KSgnc3BlY2llcycpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiwgcyA9IHIoZSkuY29uc3RydWN0b3I7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PT0gcyB8fCB2b2lkIDAgPT0gKG4gPSByKHMpW2ldKSA/IHQgOiBvKG4pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzKSwgbyA9IG4oNzcpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gciA/IG8gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXAucHJvdG90eXBlLmVudHJpZXMuY2FsbChlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTcpLCBvID0gbigxOCksIGkgPSBuKDMyKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIgPyBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBvLmYoZSwgdCwgaSgxLCBuKSk7CiAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0XSA9IG4sIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDYpLCBvID0gbigyMiksIGkgPSBuKDEzKSwgcyA9IG4oNTgpLCBhID0gbig1OSksIHUgPSBuKDM0KSwgYyA9IHUuZ2V0LCBmID0gdS5lbmZvcmNlLCBsID0gU3RyaW5nKFN0cmluZykuc3BsaXQoJ1N0cmluZycpOwogICAgICAgICAgICAgICAgKGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHUsIGMgPSAhIWEgJiYgISFhLnVuc2FmZSwgcCA9ICEhYSAmJiAhIWEuZW51bWVyYWJsZSwgZCA9ICEhYSAmJiAhIWEubm9UYXJnZXRHZXQ7CiAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgbiAmJiAoJ3N0cmluZycgIT0gdHlwZW9mIHQgfHwgaShuLCAnbmFtZScpIHx8IG8obiwgJ25hbWUnLCB0KSwgKHUgPSBmKG4pKS5zb3VyY2UgfHwgKHUuc291cmNlID0gbC5qb2luKCdzdHJpbmcnID09IHR5cGVvZiB0ID8gdCA6ICcnKSkpLCBlICE9PSByID8gKGMgPyAhZCAmJiBlW3RdICYmIChwID0gITApIDogZGVsZXRlIGVbdF0sIHAgPyBlW3RdID0gbiA6IG8oZSwgdCwgbikpIDogcCA/IGVbdF0gPSBuIDogcyh0LCBuKTsKICAgICAgICAgICAgICAgIH0pKEZ1bmN0aW9uLnByb3RvdHlwZSwgJ3RvU3RyaW5nJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09IHR5cGVvZiB0aGlzICYmIGModGhpcykuc291cmNlIHx8IGEodGhpcyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzOCksIG8gPSBNYXRoLm1pbjsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPiAwID8gbyhyKGUpLCA5MDA3MTk5MjU0NzQwOTkxKSA6IDA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNTMpLCBvID0gbigyNjIpLCBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlc2V0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHRoaXMuY21wSWQsIGRlbGV0ZSB0aGlzLmNtcFZlcnNpb24sIGRlbGV0ZSB0aGlzLmV2ZW50U3RhdHVzLCBkZWxldGUgdGhpcy5nZHByQXBwbGllcywgZGVsZXRlIHRoaXMudGNNb2RlbCwgZGVsZXRlIHRoaXMudGNTdHJpbmcsIGRlbGV0ZSB0aGlzLnRjZlBvbGljeVZlcnNpb24sIHRoaXMuY21wU3RhdHVzID0gci5DbXBTdGF0dXMuTE9BRElORywgdGhpcy5kaXNhYmxlZCA9ICExLCB0aGlzLmRpc3BsYXlTdGF0dXMgPSByLkRpc3BsYXlTdGF0dXMuSElEREVOLCB0aGlzLmV2ZW50UXVldWUuY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5hcGlWZXJzaW9uID0gJzInLCBlLmV2ZW50UXVldWUgPSBuZXcgby5FdmVudExpc3RlbmVyUXVldWUoKSwgZS5jbXBTdGF0dXMgPSByLkNtcFN0YXR1cy5MT0FESU5HLCBlLmRpc2FibGVkID0gITEsIGUuZGlzcGxheVN0YXR1cyA9IHIuRGlzcGxheVN0YXR1cy5ISURERU4sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5DbXBBcGlNb2RlbCA9IGk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNTYpLCBvID0gbigzMyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiByKG8oZSkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzMyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QocihlKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE4KS5mLCBvID0gbigxMyksIGkgPSBuKDcpKCd0b1N0cmluZ1RhZycpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBlICYmICFvKGUgPSBuID8gZSA6IGUucHJvdG90eXBlLCBpKSAmJiByKGUsIGksIHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHQKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMyksIG8gPSBuKDc3KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIgPyBvIDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gU2V0LnByb3RvdHlwZS52YWx1ZXMuY2FsbChlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX3ZhbHVlcyB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIFN5bWJvbC5pdGVyYXRvciwgbiA9IHQgJiYgZVt0XSwgciA9IDA7CiAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgJ251bWJlcicgPT0gdHlwZW9mIGUubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIHIgPj0gZS5sZW5ndGggJiYgKGUgPSB2b2lkIDApLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlICYmIGVbcisrXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogIWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IodCA/ICdPYmplY3QgaXMgbm90IGl0ZXJhYmxlLicgOiAnU3ltYm9sLml0ZXJhdG9yIGlzIG5vdCBkZWZpbmVkLicpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJvdG90eXBlLmNsb25lID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMsIHQgPSBuZXcgdGhpcy5jb25zdHJ1Y3RvcigpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXModGhpcykuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLmRlZXBDbG9uZShlW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gciAmJiAodFtuXSA9IHIpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5kZWVwQ2xvbmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgbyA9IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ251bWJlcicgPT09IG8gfHwgJ3N0cmluZycgPT09IG8gfHwgJ2Jvb2xlYW4nID09PSBvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBlICYmICdvYmplY3QnID09PSBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZS5jbG9uZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jbG9uZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgaW5zdGFuY2VvZiBEYXRlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgRGF0ZShlLmdldFRpbWUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBlW1N5bWJvbC5pdGVyYXRvcl0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSByKGUpLCBhID0gcy5uZXh0KCk7ICFhLmRvbmU7IGEgPSBzLm5leHQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBhLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKHRoaXMuZGVlcENsb25lKHUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHsgZXJyb3I6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiAhYS5kb25lICYmIChuID0gcy5yZXR1cm4pICYmIG4uY2FsbChzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IHQuZXJyb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgaW5zdGFuY2VvZiBBcnJheSA/IGkgOiBuZXcgZS5jb25zdHJ1Y3RvcihpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBmIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5oYXNPd25Qcm9wZXJ0eShmKSAmJiAoY1tmXSA9IHRoaXMuZGVlcENsb25lKGVbZl0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuQ2xvbmVhYmxlID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE0KSwgbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5lbmNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgKGUgPSBwYXJzZUludChlLCAxMCkpLCAobiA9IGUudG9TdHJpbmcoMikpLmxlbmd0aCA+IHQgfHwgZSA8IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHIuRW5jb2RpbmdFcnJvcihlICsgJyB0b28gbGFyZ2UgdG8gZW5jb2RlIGludG8gJyArIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ubGVuZ3RoIDwgdCAmJiAobiA9ICcwJy5yZXBlYXQodCAtIG4ubGVuZ3RoKSArIG4pLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRlY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAhPT0gZS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHIuRGVjb2RpbmdFcnJvcignaW52YWxpZCBiaXQgbGVuZ3RoJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VJbnQoZSwgMik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5JbnRFbmNvZGVyID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogISgxICYgZSksCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogISgyICYgZSksCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhKDQgJiBlKSwKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ0NhblwndCBjYWxsIG1ldGhvZCBvbiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIsIG8sIGksIHMgPSBuKDE1NCksIGEgPSBuKDYpLCB1ID0gbigxMiksIGMgPSBuKDIyKSwgZiA9IG4oMTMpLCBsID0gbig2MCksIHAgPSBuKDQ1KSwgZCA9IG4oMzcpLCBoID0gYS5XZWFrTWFwOwogICAgICAgICAgICAgICAgaWYgKHMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdiA9IGwuc3RhdGUgfHwgKGwuc3RhdGUgPSBuZXcgaCgpKSwgeSA9IHYuZ2V0LCBnID0gdi5oYXMsIG0gPSB2LnNldDsKICAgICAgICAgICAgICAgICAgICByID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZmFjYWRlID0gZSwgbS5jYWxsKHYsIGUsIHQpLCB0OwogICAgICAgICAgICAgICAgICAgIH0sIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5jYWxsKHYsIGUpIHx8IHt9OwogICAgICAgICAgICAgICAgICAgIH0sIGkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5jYWxsKHYsIGUpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gcCgnc3RhdGUnKTsKICAgICAgICAgICAgICAgICAgICBkW2JdID0gITAsIHIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5mYWNhZGUgPSBlLCBjKGUsIGIsIHQpLCB0OwogICAgICAgICAgICAgICAgICAgIH0sIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZihlLCBiKSA/IGVbYl0gOiB7fTsKICAgICAgICAgICAgICAgICAgICB9LCBpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYoZSwgYik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBzZXQ6IHIsCiAgICAgICAgICAgICAgICAgICAgZ2V0OiBvLAogICAgICAgICAgICAgICAgICAgIGhhczogaSwKICAgICAgICAgICAgICAgICAgICBlbmZvcmNlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShlKSA/IG8oZSkgOiByKGUsIHt9KTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGdldHRlckZvcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdSh0KSB8fCAobiA9IG8odCkpLnR5cGUgIT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKCdJbmNvbXBhdGlibGUgcmVjZWl2ZXIsICcgKyBlICsgJyByZXF1aXJlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNyksIG8gPSBuKDQzKSwgaSA9IG4oMzIpLCBzID0gbigyNiksIGEgPSBuKDQ0KSwgdSA9IG4oMTMpLCBjID0gbig4MiksIGYgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOwogICAgICAgICAgICAgICAgdC5mID0gciA/IGYgOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChlID0gcyhlKSwgdCA9IGEodCwgITApLCBjKQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICh1KGUsIHQpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSghby5mLmNhbGwoZSwgdCksIGVbdF0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIHZhciBuID0ge30udG9TdHJpbmc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmNhbGwoZSkuc2xpY2UoOCwgLTEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHt9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgdmFyIG4gPSBNYXRoLmNlaWwsIHIgPSBNYXRoLmZsb29yOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNOYU4oZSA9ICtlKSA/IDAgOiAoZSA+IDAgPyByIDogbikoZSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIsIG8gPSBuKDIpLCBpID0gbigxNTcpLCBzID0gbig2MyksIGEgPSBuKDM3KSwgdSA9IG4oODgpLCBjID0gbig1NyksIGYgPSBuKDQ1KSwgbCA9IGYoJ0lFX1BST1RPJyksIHAgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfSwgZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnPHNjcmlwdD4nICsgZSArICc8L3NjcmlwdD4nOwogICAgICAgICAgICAgICAgICAgIH0sIGggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gZG9jdW1lbnQuZG9tYWluICYmIG5ldyBBY3RpdmVYT2JqZWN0KCdodG1sZmlsZScpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaCA9IHIgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS53cml0ZShkKCcnKSksIGUuY2xvc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5wYXJlbnRXaW5kb3cuT2JqZWN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBudWxsLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9KHIpIDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQgPSBjKCdpZnJhbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnN0eWxlLmRpc3BsYXkgPSAnbm9uZScsIHUuYXBwZW5kQ2hpbGQodCksIHQuc3JjID0gU3RyaW5nKCdqYXZhc2NyaXB0OicpLCAoZSA9IHQuY29udGVudFdpbmRvdy5kb2N1bWVudCkub3BlbigpLCBlLndyaXRlKGQoJ2RvY3VtZW50LkY9T2JqZWN0JykpLCBlLmNsb3NlKCksIGUuRjsKICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gcy5sZW5ndGg7IGUtLTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgaC5wcm90b3R5cGVbc1tlXV07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoKCk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGFbbF0gPSAhMCwgZS5leHBvcnRzID0gT2JqZWN0LmNyZWF0ZSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlID8gKHAucHJvdG90eXBlID0gbyhlKSwgbiA9IG5ldyBwKCksIHAucHJvdG90eXBlID0gbnVsbCwgbltsXSA9IGUpIDogbiA9IGgoKSwgdm9pZCAwID09PSB0ID8gbiA6IGkobiwgdCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0ge307CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNSksIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9taXNlID0gbmV3IGUoZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IHQgfHwgdm9pZCAwICE9PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignQmFkIFByb21pc2UgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBlLCBuID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHRoaXMucmVzb2x2ZSA9IHIodCksIHRoaXMucmVqZWN0ID0gcihuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5leHBvcnRzLmYgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgbyhlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiArZSArICcnOwogICAgICAgICAgICAgICAgICAgIH0sIGUuZGVjb2RlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcxJyA9PT0gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5Cb29sZWFuRW5jb2RlciA9IHI7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHt9LnByb3BlcnR5SXNFbnVtZXJhYmxlLCBvID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvciwgaSA9IG8gJiYgIXIuY2FsbCh7IDE6IDIgfSwgMSk7CiAgICAgICAgICAgICAgICB0LmYgPSBpID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG8odGhpcywgZSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhdCAmJiB0LmVudW1lcmFibGU7CiAgICAgICAgICAgICAgICB9IDogcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmICghcihlKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIG87CiAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgKG4gPSBlLnRvU3RyaW5nKSAmJiAhcihvID0gbi5jYWxsKGUpKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIChuID0gZS52YWx1ZU9mKSAmJiAhcihvID0gbi5jYWxsKGUpKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgaWYgKCF0ICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIChuID0gZS50b1N0cmluZykgJiYgIXIobyA9IG4uY2FsbChlKSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvOwogICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignQ2FuXCd0IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZScpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig2MSksIG8gPSBuKDQ2KSwgaSA9IHIoJ2tleXMnKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlbZV0gfHwgKGlbZV0gPSBvKGUpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICB2YXIgbiA9IDAsIHIgPSBNYXRoLnJhbmRvbSgpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1N5bWJvbCgnICsgU3RyaW5nKHZvaWQgMCA9PT0gZSA/ICcnIDogZSkgKyAnKV8nICsgKCsrbiArIHIpLnRvU3RyaW5nKDM2KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzYpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gQXJyYXkuaXNBcnJheSB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnQXJyYXknID09IHIoZSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDg1KSwgbyA9IG4oNjMpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gT2JqZWN0LmtleXMgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihlLCBvKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNyksIG8gPSBuKDM5KSwgaSA9IG4oMTgpLCBzID0gcigndW5zY29wYWJsZXMnKSwgYSA9IEFycmF5LnByb3RvdHlwZTsKICAgICAgICAgICAgICAgIHZvaWQgMCA9PSBhW3NdICYmIGkuZihhLCBzLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbyhudWxsKQogICAgICAgICAgICAgICAgfSksIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgYVtzXVtlXSA9ICEwOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlKCkKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdAogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgfHwgKHRbbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCByKG4oMTE1KSksIHIobigyNjMpKSwgcihuKDI2NCkpLCByKG4oNTIpKSwgcihuKDExNikpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMjUpOwogICAgICAgICAgICAgICAgdC5SZXNwb25zZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmNtcElkID0gci5DbXBBcGlNb2RlbC5jbXBJZCwgdGhpcy5jbXBWZXJzaW9uID0gci5DbXBBcGlNb2RlbC5jbXBWZXJzaW9uLCB0aGlzLmdkcHJBcHBsaWVzID0gci5DbXBBcGlNb2RlbC5nZHByQXBwbGllcywgdGhpcy50Y2ZQb2xpY3lWZXJzaW9uID0gci5DbXBBcGlNb2RlbC50Y2ZQb2xpY3lWZXJzaW9uOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSB8fCAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHIobigyNTkpKSwgcihuKDI2MCkpLCByKG4oMjYxKSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBuKDU1KSwgaSA9IG4oNTEpLCBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5yZXNwb25kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy50aHJvd0lmUGFyYW1JbnZhbGlkKCksIHRoaXMuaW52b2tlQ2FsbGJhY2sobmV3IGkuVENEYXRhKHRoaXMucGFyYW0sIHRoaXMubGlzdGVuZXJJZCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS50aHJvd0lmUGFyYW1JbnZhbGlkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodm9pZCAwID09PSB0aGlzLnBhcmFtIHx8IEFycmF5LmlzQXJyYXkodGhpcy5wYXJhbSkgJiYgdGhpcy5wYXJhbS5ldmVyeShOdW1iZXIuaXNJbnRlZ2VyKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdJbnZhbGlkIFBhcmFtZXRlcicpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgIH0oby5Db21tYW5kKTsKICAgICAgICAgICAgICAgIHQuR2V0VENEYXRhQ29tbWFuZCA9IHM7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN1Y2Nlc3MgPSAhMCwgT2JqZWN0LmFzc2lnbih0aGlzLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpc3RlbmVySWQ6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IHIKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJlc3BvbmQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pbnZva2VDYWxsYmFjayhudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuaW52b2tlQ2FsbGJhY2sgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9PSBlID8gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdGhpcy5uZXh0ID8gdGhpcy5jYWxsYmFjayh0aGlzLm5leHQsIGUsICEwKSA6IHRoaXMuY2FsbGJhY2soZSwgITApIDogdGhpcy5jYWxsYmFjayhlLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuQ29tbWFuZCA9IHI7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTEpLCBvID0gbigzNiksIGkgPSAnJy5zcGxpdDsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhT2JqZWN0KCd6JykucHJvcGVydHlJc0VudW1lcmFibGUoMCk7CiAgICAgICAgICAgICAgICB9KSA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdTdHJpbmcnID09IG8oZSkgPyBpLmNhbGwoZSwgJycpIDogT2JqZWN0KGUpOwogICAgICAgICAgICAgICAgfSA6IE9iamVjdDsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig2KSwgbyA9IG4oMTIpLCBpID0gci5kb2N1bWVudCwgcyA9IG8oaSkgJiYgbyhpLmNyZWF0ZUVsZW1lbnQpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyA/IGkuY3JlYXRlRWxlbWVudChlKSA6IHt9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig2KSwgbyA9IG4oMjIpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBvKHIsIGUsIHQpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcltlXSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig2MCksIG8gPSBGdW5jdGlvbi50b1N0cmluZzsKICAgICAgICAgICAgICAgICdmdW5jdGlvbicgIT0gdHlwZW9mIHIuaW5zcGVjdFNvdXJjZSAmJiAoci5pbnNwZWN0U291cmNlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5jYWxsKGUpOwogICAgICAgICAgICAgICAgfSksIGUuZXhwb3J0cyA9IHIuaW5zcGVjdFNvdXJjZTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig2KSwgbyA9IG4oNTgpLCBpID0gclsnX19jb3JlLWpzX3NoYXJlZF9fJ10gfHwgbygnX19jb3JlLWpzX3NoYXJlZF9fJywge30pOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzKSwgbyA9IG4oNjApOwogICAgICAgICAgICAgICAgKGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9bZV0gfHwgKG9bZV0gPSB2b2lkIDAgIT09IHQgPyB0IDoge30pOwogICAgICAgICAgICAgICAgfSkoJ3ZlcnNpb25zJywgW10pLnB1c2goewogICAgICAgICAgICAgICAgICAgIHZlcnNpb246ICczLjcuMCcsCiAgICAgICAgICAgICAgICAgICAgbW9kZTogciA/ICdwdXJlJyA6ICdnbG9iYWwnLAogICAgICAgICAgICAgICAgICAgIGNvcHlyaWdodDogJ1x4QTkgMjAyMCBEZW5pcyBQdXNoa2FyZXYgKHpsb2lyb2NrLnJ1KScKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDg1KSwgbyA9IG4oNjMpLmNvbmNhdCgnbGVuZ3RoJywgJ3Byb3RvdHlwZScpOwogICAgICAgICAgICAgICAgdC5mID0gT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXMgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihlLCBvKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBbCiAgICAgICAgICAgICAgICAgICAgJ2NvbnN0cnVjdG9yJywKICAgICAgICAgICAgICAgICAgICAnaGFzT3duUHJvcGVydHknLAogICAgICAgICAgICAgICAgICAgICdpc1Byb3RvdHlwZU9mJywKICAgICAgICAgICAgICAgICAgICAncHJvcGVydHlJc0VudW1lcmFibGUnLAogICAgICAgICAgICAgICAgICAgICd0b0xvY2FsZVN0cmluZycsCiAgICAgICAgICAgICAgICAgICAgJ3RvU3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAndmFsdWVPZicKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICB0LmYgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDExKSwgbyA9IC8jfFwucHJvdG90eXBlXC4vLCBpID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhW3MoZSldOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9PSBjIHx8IG4gIT0gdSAmJiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCA/IHIodCkgOiAhIXQpOwogICAgICAgICAgICAgICAgICAgIH0sIHMgPSBpLm5vcm1hbGl6ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTdHJpbmcoZSkucmVwbGFjZShvLCAnLicpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgfSwgYSA9IGkuZGF0YSA9IHt9LCB1ID0gaS5OQVRJVkUgPSAnTicsIGMgPSBpLlBPTFlGSUxMID0gJ1AnOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhIU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMgJiYgIXIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhU3RyaW5nKFN5bWJvbCgpKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEyKSwgbyA9IG4oNDcpLCBpID0gbig3KSgnc3BlY2llcycpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhlKSAmJiAoJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgKG4gPSBlLmNvbnN0cnVjdG9yKSB8fCBuICE9PSBBcnJheSAmJiAhbyhuLnByb3RvdHlwZSkgPyByKG4pICYmIG51bGwgPT09IChuID0gbltpXSkgJiYgKG4gPSB2b2lkIDApIDogbiA9IHZvaWQgMCksIG5ldyAodm9pZCAwID09PSBuID8gQXJyYXkgOiBuKSgwID09PSB0ID8gMCA6IHQpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByLCBvLCBpID0gbig2KSwgcyA9IG4oOTIpLCBhID0gaS5wcm9jZXNzLCB1ID0gYSAmJiBhLnZlcnNpb25zLCBjID0gdSAmJiB1LnY4OwogICAgICAgICAgICAgICAgYyA/IG8gPSAociA9IGMuc3BsaXQoJy4nKSlbMF0gKyByWzFdIDogcyAmJiAoIShyID0gcy5tYXRjaCgvRWRnZVwvKFxkKykvKSkgfHwgclsxXSA+PSA3NCkgJiYgKHIgPSBzLm1hdGNoKC9DaHJvbWVcLyhcZCspLykpICYmIChvID0gclsxXSksIGUuZXhwb3J0cyA9IG8gJiYgK287CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oOTYpLCBvID0gbig0MCksIGkgPSBuKDcpKCdpdGVyYXRvcicpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9IGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW2ldIHx8IGVbJ0BAaXRlcmF0b3InXSB8fCBvW3IoZSldOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0ge307CiAgICAgICAgICAgICAgICByW24oNykoJ3RvU3RyaW5nVGFnJyldID0gJ3onLCBlLmV4cG9ydHMgPSAnW29iamVjdCB6XScgPT09IFN0cmluZyhyKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig3KSgnaXRlcmF0b3InKSwgbyA9ICExOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IDAsIHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsgZG9uZTogISFpKysgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm46IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgc1tyXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgfSwgQXJyYXkuZnJvbShzLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IDI7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChhKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmICghdCAmJiAhbykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHZhciBuID0gITE7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgaVtyXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geyBkb25lOiBuID0gITAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlKGkpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGEpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignSW5jb3JyZWN0ICcgKyAobiA/IG4gKyAnICcgOiAnJykgKyAnaW52b2NhdGlvbicpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyKSwgbyA9IG4oMTg2KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCAoJ19fcHJvdG9fXycgaW4ge30gPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQgPSAhMSwgbiA9IHt9OwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIChlID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihPYmplY3QucHJvdG90eXBlLCAnX19wcm90b19fJykuc2V0KS5jYWxsKG4sIFtdKSwgdCA9IG4gaW5zdGFuY2VvZiBBcnJheTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChpKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobiwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihuKSwgbyhpKSwgdCA/IGUuY2FsbChuLCBpKSA6IG4uX19wcm90b19fID0gaSwgbjsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpIDogdm9pZCAwKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMTg3KSwgaSA9IG4oNzUpLCBzID0gbig3MyksIGEgPSBuKDI4KSwgdSA9IG4oMjIpLCBjID0gbigyMyksIGYgPSBuKDcpLCBsID0gbigzKSwgcCA9IG4oNDApLCBkID0gbigxMDEpLCBoID0gZC5JdGVyYXRvclByb3RvdHlwZSwgdiA9IGQuQlVHR1lfU0FGQVJJX0lURVJBVE9SUywgeSA9IGYoJ2l0ZXJhdG9yJyksIGcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbiwgZiwgZCwgbSwgYikgewogICAgICAgICAgICAgICAgICAgIG8obiwgdCwgZik7CiAgICAgICAgICAgICAgICAgICAgdmFyIEUsIEMsIF8sIFMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IGQgJiYgTCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdiAmJiBlIGluIE8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9bZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2tleXMnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndmFsdWVzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VudHJpZXMnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgbih0aGlzLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IG4odGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9LCB3ID0gdCArICcgSXRlcmF0b3InLCBJID0gITEsIE8gPSBlLnByb3RvdHlwZSwgQSA9IE9beV0gfHwgT1snQEBpdGVyYXRvciddIHx8IGQgJiYgT1tkXSwgTCA9ICF2ICYmIEEgfHwgUyhkKSwgUCA9ICdBcnJheScgPT0gdCAmJiBPLmVudHJpZXMgfHwgQTsKICAgICAgICAgICAgICAgICAgICBpZiAoUCAmJiAoRSA9IGkoUC5jYWxsKG5ldyBlKCkpKSwgaCAhPT0gT2JqZWN0LnByb3RvdHlwZSAmJiBFLm5leHQgJiYgKGwgfHwgaShFKSA9PT0gaCB8fCAocyA/IHMoRSwgaCkgOiAnZnVuY3Rpb24nICE9IHR5cGVvZiBFW3ldICYmIHUoRSwgeSwgZykpLCBhKEUsIHcsICEwLCAhMCksIGwgJiYgKHBbd10gPSBnKSkpLCAndmFsdWVzJyA9PSBkICYmIEEgJiYgJ3ZhbHVlcycgIT09IEEubmFtZSAmJiAoSSA9ICEwLCBMID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEuY2FsbCh0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGwgJiYgIWIgfHwgT1t5XSA9PT0gTCB8fCB1KE8sIHksIEwpLCBwW3RdID0gTCwgZCkKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBTKCd2YWx1ZXMnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlzOiBtID8gTCA6IFMoJ2tleXMnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnRyaWVzOiBTKCdlbnRyaWVzJykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKF8gaW4gQykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodiB8fCBJIHx8ICEoXyBpbiBPKSkgJiYgYyhPLCBfLCBDW19dKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IHYgfHwgSQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgQyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEzKSwgbyA9IG4oMjcpLCBpID0gbig0NSksIHMgPSBuKDE4OCksIGEgPSBpKCdJRV9QUk9UTycpLCB1ID0gT2JqZWN0LnByb3RvdHlwZTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHMgPyBPYmplY3QuZ2V0UHJvdG90eXBlT2YgOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gbyhlKSwgcihlLCBhKSA/IGVbYV0gOiAnZnVuY3Rpb24nID09IHR5cGVvZiBlLmNvbnN0cnVjdG9yICYmIGUgaW5zdGFuY2VvZiBlLmNvbnN0cnVjdG9yID8gZS5jb25zdHJ1Y3Rvci5wcm90b3R5cGUgOiBlIGluc3RhbmNlb2YgT2JqZWN0ID8gdSA6IG51bGw7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDM2KSwgbyA9IG4oNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAncHJvY2VzcycgPT0gcihvLnByb2Nlc3MpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDIpLCBvID0gbig2OSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbyhlKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgdCkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKFN0cmluZyhlKSArICcgaXMgbm90IGl0ZXJhYmxlJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodC5jYWxsKGUpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgfHwgKHRbbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCByKG4oMTE4KSksIHIobig3OSkpLCByKG4oMjc4KSksIHIobigyODIpKSwgcihuKDEyMykpLCByKG4oMTI5KSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNSksIG8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIG8sIGksIHMsIGEsIHUsIGMsIGYsIGwsIHAsIGQsIGgsIHYsIHksIGcsIG0sIGI7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gci5GaWVsZHMuY21wSWQsIG4gPSByLkZpZWxkcy5jbXBWZXJzaW9uLCBvID0gci5GaWVsZHMuY29uc2VudExhbmd1YWdlLCBpID0gci5GaWVsZHMuY29uc2VudFNjcmVlbiwgcyA9IHIuRmllbGRzLmNyZWF0ZWQsIGEgPSByLkZpZWxkcy5pc1NlcnZpY2VTcGVjaWZpYywgdSA9IHIuRmllbGRzLmxhc3RVcGRhdGVkLCBjID0gci5GaWVsZHMucG9saWN5VmVyc2lvbiwgZiA9IHIuRmllbGRzLnB1Ymxpc2hlckNvdW50cnlDb2RlLCBsID0gci5GaWVsZHMucHVibGlzaGVyTGVnaXRpbWF0ZUludGVyZXN0cywgcCA9IHIuRmllbGRzLnB1Ymxpc2hlckNvbnNlbnRzLCBkID0gci5GaWVsZHMucHVycG9zZUNvbnNlbnRzLCBoID0gci5GaWVsZHMucHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMsIHYgPSByLkZpZWxkcy5wdXJwb3NlT25lVHJlYXRtZW50LCB5ID0gci5GaWVsZHMuc3BlY2lhbEZlYXR1cmVPcHRpbnMsIGcgPSByLkZpZWxkcy51c2VOb25TdGFuZGFyZFN0YWNrcywgbSA9IHIuRmllbGRzLnZlbmRvckxpc3RWZXJzaW9uLCBiID0gci5GaWVsZHMudmVyc2lvbiwgZVt0XSA9IDEyLCBlW25dID0gMTIsIGVbb10gPSAxMiwgZVtpXSA9IDYsIGVbc10gPSAzNiwgZVthXSA9IDEsIGVbdV0gPSAzNiwgZVtjXSA9IDYsIGVbZl0gPSAxMiwgZVtsXSA9IDI0LCBlW3BdID0gMjQsIGVbZF0gPSAyNCwgZVtoXSA9IDI0LCBlW3ZdID0gMSwgZVt5XSA9IDEyLCBlW2ddID0gMSwgZVttXSA9IDEyLCBlW2JdID0gNiwgZS5hbnlCb29sZWFuID0gMSwgZS5lbmNvZGluZ1R5cGUgPSAxLCBlLm1heElkID0gMTYsIGUubnVtQ3VzdG9tUHVycG9zZXMgPSA2LCBlLm51bUVudHJpZXMgPSAxMiwgZS5udW1SZXN0cmljdGlvbnMgPSAxMiwgZS5wdXJwb3NlSWQgPSA2LCBlLnJlc3RyaWN0aW9uVHlwZSA9IDIsIGUuc2VnbWVudFR5cGUgPSAzLCBlLnNpbmdsZU9yUmFuZ2UgPSAxLCBlLnZlbmRvcklkID0gMTYsIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5CaXRMZW5ndGggPSBvOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHI7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgKHIgPSB0LlJlc3RyaWN0aW9uVHlwZSB8fCAodC5SZXN0cmljdGlvblR5cGUgPSB7fSkpW3IuTk9UX0FMTE9XRUQgPSAwXSA9ICdOT1RfQUxMT1dFRCcsIHJbci5SRVFVSVJFX0NPTlNFTlQgPSAxXSA9ICdSRVFVSVJFX0NPTlNFTlQnLCByW3IuUkVRVUlSRV9MSSA9IDJdID0gJ1JFUVVJUkVfTEknOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNDIpLCBvID0gbigxNCksIGkgPSBuKDE1KSwgcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5lbmNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9ICcnLCBvID0gMTsgbyA8PSB0OyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiArPSByLkJvb2xlYW5FbmNvZGVyLmVuY29kZShlLmhhcyhvKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5kZWNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUubGVuZ3RoICE9PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBvLkRlY29kaW5nRXJyb3IoJ2JpdGZpZWxkIGVuY29kaW5nIGxlbmd0aCBtaXNtYXRjaCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IG5ldyBpLlZlY3RvcigpLCBzID0gMTsgcyA8PSB0OyBzKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5Cb29sZWFuRW5jb2Rlci5kZWNvZGUoZVtzIC0gMV0pICYmIG4uc2V0KHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uYml0TGVuZ3RoID0gZS5sZW5ndGgsIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5GaXhlZFZlY3RvckVuY29kZXIgPSBzOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE3KSwgbyA9IG4oMTEpLCBpID0gbig1Nyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhciAmJiAhbyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDcgIT0gT2JqZWN0LmRlZmluZVByb3BlcnR5KGkoJ2RpdicpLCAnYScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gNzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pLmE7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMyksIG8gPSBuKDE1NSksIGkgPSBuKDM1KSwgcyA9IG4oMTgpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gbyh0KSwgYSA9IHMuZiwgdSA9IGkuZiwgYyA9IDA7IGMgPCBuLmxlbmd0aDsgYysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gbltjXTsKICAgICAgICAgICAgICAgICAgICAgICAgcihlLCBmKSB8fCBhKGUsIGYsIHUodCwgZikpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEzKSwgbyA9IG4oMjYpLCBpID0gbig4NikuaW5kZXhPZiwgcyA9IG4oMzcpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiwgYSA9IG8oZSksIHUgPSAwLCBjID0gW107CiAgICAgICAgICAgICAgICAgICAgZm9yIChuIGluIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICFyKHMsIG4pICYmIHIoYSwgbikgJiYgYy5wdXNoKG4pOwogICAgICAgICAgICAgICAgICAgIGZvciAoOyB0Lmxlbmd0aCA+IHU7KQogICAgICAgICAgICAgICAgICAgICAgICByKGEsIG4gPSB0W3UrK10pICYmICh+aShjLCBuKSB8fCBjLnB1c2gobikpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNiksIG8gPSBuKDI0KSwgaSA9IG4oMTU2KSwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbiwgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEsIHUgPSByKHQpLCBjID0gbyh1Lmxlbmd0aCksIGYgPSBpKHMsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgbiAhPSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGMgPiBmOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChhID0gdVtmKytdKSAhPSBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGMgPiBmOyBmKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoZSB8fCBmIGluIHUpICYmIHVbZl0gPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSB8fCBmIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWUgJiYgLTE7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBpbmNsdWRlczogcyghMCksCiAgICAgICAgICAgICAgICAgICAgaW5kZXhPZjogcyghMSkKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNjYpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gciAmJiAhU3ltYm9sLnNoYW0gJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig5KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIoJ2RvY3VtZW50JywgJ2RvY3VtZW50RWxlbWVudCcpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDcpOwogICAgICAgICAgICAgICAgdC5mID0gcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig4KSwgbyA9IG4oNTYpLCBpID0gbigyNyksIHMgPSBuKDI0KSwgYSA9IG4oNjcpLCB1ID0gW10ucHVzaCwgYyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gMSA9PSBlLCBuID0gMiA9PSBlLCBjID0gMyA9PSBlLCBmID0gNCA9PSBlLCBsID0gNiA9PSBlLCBwID0gNSA9PSBlIHx8IGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZCwgaCwgdiwgeSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZywgbSwgYiA9IGkoZCksIEUgPSBvKGIpLCBDID0gcihoLCB2LCAzKSwgXyA9IHMoRS5sZW5ndGgpLCBTID0gMCwgdyA9IHkgfHwgYSwgSSA9IHQgPyB3KGQsIF8pIDogbiA/IHcoZCwgMCkgOiB2b2lkIDA7IF8gPiBTOyBTKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChwIHx8IFMgaW4gRSkgJiYgKG0gPSBDKGcgPSBFW1NdLCBTLCBiKSwgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSVtTXSA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKG0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5jYWxsKEksIGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwgPyAtMSA6IGMgfHwgZiA/IGYgOiBJOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgZm9yRWFjaDogYygwKSwKICAgICAgICAgICAgICAgICAgICBtYXA6IGMoMSksCiAgICAgICAgICAgICAgICAgICAgZmlsdGVyOiBjKDIpLAogICAgICAgICAgICAgICAgICAgIHNvbWU6IGMoMyksCiAgICAgICAgICAgICAgICAgICAgZXZlcnk6IGMoNCksCiAgICAgICAgICAgICAgICAgICAgZmluZDogYyg1KSwKICAgICAgICAgICAgICAgICAgICBmaW5kSW5kZXg6IGMoNikKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNDQpLCBvID0gbigxOCksIGkgPSBuKDMyKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSByKHQpOwogICAgICAgICAgICAgICAgICAgIHMgaW4gZSA/IG8uZihlLCBzLCBpKDAsIG4pKSA6IGVbc10gPSBuOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig5KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIoJ25hdmlnYXRvcicsICd1c2VyQWdlbnQnKSB8fCAnJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNyksIG8gPSBuKDExKSwgaSA9IG4oMTMpLCBzID0gT2JqZWN0LmRlZmluZVByb3BlcnR5LCBhID0ge30sIHUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChpKGEsIGUpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYVtlXTsKICAgICAgICAgICAgICAgICAgICB0IHx8ICh0ID0ge30pOwogICAgICAgICAgICAgICAgICAgIHZhciBuID0gW11bZV0sIGMgPSAhIWkodCwgJ0FDQ0VTU09SUycpICYmIHQuQUNDRVNTT1JTLCBmID0gaSh0LCAwKSA/IHRbMF0gOiB1LCBsID0gaSh0LCAxKSA/IHRbMV0gOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbZV0gPSAhIW4gJiYgIW8oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyAmJiAhcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB7IGxlbmd0aDogLTEgfTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA/IHMoZSwgMSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IHUKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBlWzFdID0gMSwgbi5jYWxsKGUsIGYsIGwpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJldHVybjsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSB0KQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LmNhbGwoZSkpLnZhbHVlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig3KSwgbyA9IG4oNDApLCBpID0gcignaXRlcmF0b3InKSwgcyA9IEFycmF5LnByb3RvdHlwZTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gZSAmJiAoby5BcnJheSA9PT0gZSB8fCBzW2ldID09PSBlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNzApLCBvID0gbigzNiksIGkgPSBuKDcpKCd0b1N0cmluZ1RhZycpLCBzID0gJ0FyZ3VtZW50cycgPT0gbyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhcmd1bWVudHM7CiAgICAgICAgICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIgPyBvIDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgcjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSBlID8gJ1VuZGVmaW5lZCcgOiBudWxsID09PSBlID8gJ051bGwnIDogJ3N0cmluZycgPT0gdHlwZW9mIChuID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KHQgPSBPYmplY3QoZSksIGkpKSA/IG4gOiBzID8gbyh0KSA6ICdPYmplY3QnID09IChyID0gbyh0KSkgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdC5jYWxsZWUgPyAnQXJndW1lbnRzJyA6IHI7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig2KSwgaSA9IG4oNjUpLCBzID0gbigyMyksIGEgPSBuKDk4KSwgdSA9IG4oNCksIGMgPSBuKDcyKSwgZiA9IG4oMTIpLCBsID0gbigxMSksIHAgPSBuKDcxKSwgZCA9IG4oMjgpLCBoID0gbigxODUpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdiA9IC0xICE9PSBlLmluZGV4T2YoJ01hcCcpLCB5ID0gLTEgIT09IGUuaW5kZXhPZignV2VhaycpLCBnID0gdiA/ICdzZXQnIDogJ2FkZCcsIG0gPSBvW2VdLCBiID0gbSAmJiBtLnByb3RvdHlwZSwgRSA9IG0sIEMgPSB7fSwgXyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGJbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzKGIsIGUsICdhZGQnID09IGUgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmNhbGwodGhpcywgMCA9PT0gZSA/IDAgOiBlKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiAnZGVsZXRlJyA9PSBlID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISh5ICYmICFmKGUpKSAmJiB0LmNhbGwodGhpcywgMCA9PT0gZSA/IDAgOiBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiAnZ2V0JyA9PSBlID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geSAmJiAhZihlKSA/IHZvaWQgMCA6IHQuY2FsbCh0aGlzLCAwID09PSBlID8gMCA6IGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6ICdoYXMnID09IGUgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKHkgJiYgIWYoZSkpICYmIHQuY2FsbCh0aGlzLCAwID09PSBlID8gMCA6IGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuY2FsbCh0aGlzLCAwID09PSBlID8gMCA6IGUsIG4pLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgaWYgKGkoZSwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgbSB8fCAhKHkgfHwgYi5mb3JFYWNoICYmICFsKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBtKCkuZW50cmllcygpLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpKSkKICAgICAgICAgICAgICAgICAgICAgICAgRSA9IG4uZ2V0Q29uc3RydWN0b3IodCwgZSwgdiwgZyksIGEuUkVRVUlSRUQgPSAhMDsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChpKGUsICEwKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgUyA9IG5ldyBFKCksIHcgPSBTW2ddKHkgPyB7fSA6IC0wLCAxKSAhPSBTLCBJID0gbChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUy5oYXMoMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgTyA9IHAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBBID0gIXkgJiYgbChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IG5ldyBtKCksIHQgPSA1OyB0LS07KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW2ddKHQsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZS5oYXMoLTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIE8gfHwgKChFID0gdChmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyh0LCBFLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gaChuZXcgbSgpLCB0LCBFKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT0gbiAmJiB1KG4sIHJbZ10sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGF0OiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6IHYKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByOwogICAgICAgICAgICAgICAgICAgICAgICB9KSkucHJvdG90eXBlID0gYiwgYi5jb25zdHJ1Y3RvciA9IEUpLCAoSSB8fCBBKSAmJiAoXygnZGVsZXRlJyksIF8oJ2hhcycpLCB2ICYmIF8oJ2dldCcpKSwgKEEgfHwgdykgJiYgXyhnKSwgeSAmJiBiLmNsZWFyICYmIGRlbGV0ZSBiLmNsZWFyOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gQ1tlXSA9IEUsIHIoewogICAgICAgICAgICAgICAgICAgICAgICBnbG9iYWw6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IEUgIT0gbQogICAgICAgICAgICAgICAgICAgIH0sIEMpLCBkKEUsIGUpLCB5IHx8IG4uc2V0U3Ryb25nKEUsIGUsIHYpLCBFOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzNyksIG8gPSBuKDEyKSwgaSA9IG4oMTMpLCBzID0gbigxOCkuZiwgYSA9IG4oNDYpLCB1ID0gbigxODQpLCBjID0gYSgnbWV0YScpLCBmID0gMCwgbCA9IE9iamVjdC5pc0V4dGVuc2libGUgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfSwgcCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHMoZSwgYywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3RJRDogJ08nICsgKytmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlYWtEYXRhOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBkID0gZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgICAgICBSRVFVSVJFRDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgIGZhc3RLZXk6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzeW1ib2wnID09IHR5cGVvZiBlID8gZSA6ICgnc3RyaW5nJyA9PSB0eXBlb2YgZSA/ICdTJyA6ICdQJykgKyBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpKGUsIGMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0YnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdFJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbY10ub2JqZWN0SUQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldFdlYWtEYXRhOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpKGUsIGMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFsKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW2NdLndlYWtEYXRhOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBvbkZyZWV6ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1ICYmIGQuUkVRVUlSRUQgJiYgbChlKSAmJiAhaShlLCBjKSAmJiBwKGUpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHJbY10gPSAhMDsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxOCkuZiwgbyA9IG4oMzkpLCBpID0gbigxMDApLCBzID0gbig4KSwgYSA9IG4oNzIpLCB1ID0gbig0KSwgYyA9IG4oNzQpLCBmID0gbigxMDIpLCBsID0gbigxNyksIHAgPSBuKDk4KS5mYXN0S2V5LCBkID0gbigzNCksIGggPSBkLnNldCwgdiA9IGQuZ2V0dGVyRm9yOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgIGdldENvbnN0cnVjdG9yOiBmdW5jdGlvbiAoZSwgdCwgbiwgYykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGUoZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKGUsIGYsIHQpLCBoKGUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IG8obnVsbCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpcnN0OiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3Q6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTogMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBsIHx8IChlLnNpemUgPSAwKSwgdm9pZCAwICE9IHIgJiYgdShyLCBlW2NdLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoYXQ6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBkID0gdih0KSwgeSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8sIGkgPSBkKGUpLCBzID0gZyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyA/IHMudmFsdWUgPSBuIDogKGkubGFzdCA9IHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiBvID0gcCh0LCAhMCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZXZpb3VzOiByID0gaS5sYXN0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZWQ6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaS5maXJzdCB8fCAoaS5maXJzdCA9IHMpLCByICYmIChyLm5leHQgPSBzKSwgbCA/IGkuc2l6ZSsrIDogZS5zaXplKyssICdGJyAhPT0gbyAmJiAoaS5pbmRleFtvXSA9IHMpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGcgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByID0gZChlKSwgbyA9IHAodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdGJyAhPT0gbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuaW5kZXhbb107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gci5maXJzdDsgbjsgbiA9IG4ubmV4dCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4ua2V5ID09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGYucHJvdG90eXBlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhcjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBkKHRoaXMpLCB0ID0gZS5pbmRleCwgbiA9IGUuZmlyc3Q7IG47KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnJlbW92ZWQgPSAhMCwgbi5wcmV2aW91cyAmJiAobi5wcmV2aW91cyA9IG4ucHJldmlvdXMubmV4dCA9IHZvaWQgMCksIGRlbGV0ZSB0W24uaW5kZXhdLCBuID0gbi5uZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZmlyc3QgPSBlLmxhc3QgPSB2b2lkIDAsIGwgPyBlLnNpemUgPSAwIDogdGhpcy5zaXplID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBkKHRoaXMpLCBuID0gZyh0aGlzLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4ubmV4dCwgbyA9IG4ucHJldmlvdXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0LmluZGV4W24uaW5kZXhdLCBuLnJlbW92ZWQgPSAhMCwgbyAmJiAoby5uZXh0ID0gciksIHIgJiYgKHIucHJldmlvdXMgPSBvKSwgdC5maXJzdCA9PSBuICYmICh0LmZpcnN0ID0gciksIHQubGFzdCA9PSBuICYmICh0Lmxhc3QgPSBvKSwgbCA/IHQuc2l6ZS0tIDogdGhpcy5zaXplLS07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yRWFjaDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0LCBuID0gZCh0aGlzKSwgciA9IHMoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpOyB0ID0gdCA/IHQubmV4dCA6IG4uZmlyc3Q7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIodC52YWx1ZSwgdC5rZXksIHRoaXMpOyB0ICYmIHQucmVtb3ZlZDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gdC5wcmV2aW91czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZyh0aGlzLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkoZi5wcm90b3R5cGUsIG4gPyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBnKHRoaXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIHQudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5KHRoaXMsIDAgPT09IGUgPyAwIDogZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkodGhpcywgZSA9IDAgPT09IGUgPyAwIDogZSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBsICYmIHIoZi5wcm90b3R5cGUsICdzaXplJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQodGhpcykuc2l6ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIGY7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBzZXRTdHJvbmc6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdCArICcgSXRlcmF0b3InLCBvID0gdih0KSwgaSA9IHYocik7CiAgICAgICAgICAgICAgICAgICAgICAgIGMoZSwgdCwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgodGhpcywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiBvKGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtpbmQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdDogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IGkodGhpcyksIHQgPSBlLmtpbmQsIG4gPSBlLmxhc3Q7IG4gJiYgbi5yZW1vdmVkOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbi5wcmV2aW91czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRhcmdldCAmJiAoZS5sYXN0ID0gbiA9IG4gPyBuLm5leHQgOiBlLnN0YXRlLmZpcnN0KSA/ICdrZXlzJyA9PSB0ID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBuLmtleSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6ICd2YWx1ZXMnID09IHQgPyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4udmFsdWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5rZXksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4udmFsdWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogKGUudGFyZ2V0ID0gdm9pZCAwLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4gPyAnZW50cmllcycgOiAndmFsdWVzJywgIW4sICEwKSwgZih0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDIzKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbyBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICByKGUsIG8sIHRbb10sIG4pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByLCBvLCBpLCBzID0gbig3NSksIGEgPSBuKDIyKSwgdSA9IG4oMTMpLCBjID0gbig3KSwgZiA9IG4oMyksIGwgPSBjKCdpdGVyYXRvcicpLCBwID0gITE7CiAgICAgICAgICAgICAgICBbXS5rZXlzICYmICgnbmV4dCcgaW4gKGkgPSBbXS5rZXlzKCkpID8gKG8gPSBzKHMoaSkpKSAhPT0gT2JqZWN0LnByb3RvdHlwZSAmJiAociA9IG8pIDogcCA9ICEwKSwgdm9pZCAwID09IHIgJiYgKHIgPSB7fSksIGYgfHwgdShyLCBsKSB8fCBhKHIsIGwsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgIH0pLCBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgSXRlcmF0b3JQcm90b3R5cGU6IHIsCiAgICAgICAgICAgICAgICAgICAgQlVHR1lfU0FGQVJJX0lURVJBVE9SUzogcAogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbig5KSwgbyA9IG4oMTgpLCBpID0gbig3KSwgcyA9IG4oMTcpLCBhID0gaSgnc3BlY2llcycpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHIoZSksIG4gPSBvLmY7CiAgICAgICAgICAgICAgICAgICAgcyAmJiB0ICYmICF0W2FdICYmIG4odCwgYSwgewogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE3KSwgbyA9IG4oNDgpLCBpID0gbigyNiksIHMgPSBuKDQzKS5mLCBhID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuLCBhID0gaSh0KSwgdSA9IG8oYSksIGMgPSB1Lmxlbmd0aCwgZiA9IDAsIGwgPSBbXTsgYyA+IGY7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB1W2YrK10sIHIgJiYgIXMuY2FsbChhLCBuKSB8fCBsLnB1c2goZSA/IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtuXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0gOiBhW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgZW50cmllczogYSghMCksCiAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBhKCExKQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig2KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIuUHJvbWlzZTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByLCBvLCBpLCBzID0gbig2KSwgYSA9IG4oMTEpLCB1ID0gbig4KSwgYyA9IG4oODgpLCBmID0gbig1NyksIGwgPSBuKDEwNiksIHAgPSBuKDc2KSwgZCA9IHMubG9jYXRpb24sIGggPSBzLnNldEltbWVkaWF0ZSwgdiA9IHMuY2xlYXJJbW1lZGlhdGUsIHkgPSBzLnByb2Nlc3MsIGcgPSBzLk1lc3NhZ2VDaGFubmVsLCBtID0gcy5EaXNwYXRjaCwgYiA9IDAsIEUgPSB7fSwgQyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChFLmhhc093blByb3BlcnR5KGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEVbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgRVtlXSwgdCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgXyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBDKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIFMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBDKGUuZGF0YSk7CiAgICAgICAgICAgICAgICAgICAgfSwgdyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHMucG9zdE1lc3NhZ2UoZSArICcnLCBkLnByb3RvY29sICsgJy8vJyArIGQuaG9zdCk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGggJiYgdiB8fCAoaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IFtdLCBuID0gMTsgYXJndW1lbnRzLmxlbmd0aCA+IG47KQogICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goYXJndW1lbnRzW24rK10pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBFWysrYl0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICgnZnVuY3Rpb24nID09IHR5cGVvZiBlID8gZSA6IEZ1bmN0aW9uKGUpKS5hcHBseSh2b2lkIDAsIHQpOwogICAgICAgICAgICAgICAgICAgIH0sIHIoYiksIGI7CiAgICAgICAgICAgICAgICB9LCB2ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBkZWxldGUgRVtlXTsKICAgICAgICAgICAgICAgIH0sIHAgPyByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB5Lm5leHRUaWNrKF8oZSkpOwogICAgICAgICAgICAgICAgfSA6IG0gJiYgbS5ub3cgPyByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBtLm5vdyhfKGUpKTsKICAgICAgICAgICAgICAgIH0gOiBnICYmICFsID8gKGkgPSAobyA9IG5ldyBnKCkpLnBvcnQyLCBvLnBvcnQxLm9ubWVzc2FnZSA9IFMsIHIgPSB1KGkucG9zdE1lc3NhZ2UsIGksIDEpKSA6IHMuYWRkRXZlbnRMaXN0ZW5lciAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBwb3N0TWVzc2FnZSAmJiAhcy5pbXBvcnRTY3JpcHRzICYmIGQgJiYgJ2ZpbGU6JyAhPT0gZC5wcm90b2NvbCAmJiAhYSh3KSA/IChyID0gdywgcy5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgUywgITEpKSA6IHIgPSAnb25yZWFkeXN0YXRlY2hhbmdlJyBpbiBmKCdzY3JpcHQnKSA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgYy5hcHBlbmRDaGlsZChmKCdzY3JpcHQnKSkub25yZWFkeXN0YXRlY2hhbmdlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBjLnJlbW92ZUNoaWxkKHRoaXMpLCBDKGUpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KF8oZSksIDApOwogICAgICAgICAgICAgICAgfSksIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBzZXQ6IGgsCiAgICAgICAgICAgICAgICAgICAgY2xlYXI6IHYKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oOTIpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gLyhpcGhvbmV8aXBvZHxpcGFkKS4qYXBwbGV3ZWJraXQvaS50ZXN0KHIpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDIpLCBvID0gbigxMiksIGkgPSBuKDQxKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHIoZSksIG8odCkgJiYgdC5jb25zdHJ1Y3RvciA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpLmYoZSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICgwLCBuLnJlc29sdmUpKHQpLCBuLnByb21pc2U7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDIwMik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChyKGUpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ1RoZSBtZXRob2QgZG9lc25cJ3QgYWNjZXB0IHJlZ3VsYXIgZXhwcmVzc2lvbnMnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNykoJ21hdGNoJyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gLy4vOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICcvLi8nW2VdKHQpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W3JdID0gITEsICcvLi8nW2VdKHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigyKSwgbyA9IG4oNSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSwgdCA9IHIodGhpcyksIG4gPSBvKHQuZGVsZXRlKSwgaSA9ICEwLCBzID0gMCwgYSA9IGFyZ3VtZW50cy5sZW5ndGg7IHMgPCBhOyBzKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBuLmNhbGwodCwgYXJndW1lbnRzW3NdKSwgaSA9IGkgJiYgZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbig1KSwgbyA9IG4oOCksIGkgPSBuKDQpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgcywgYSwgdSA9IGFyZ3VtZW50cy5sZW5ndGgsIGMgPSB1ID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0aGlzKSwgKHQgPSB2b2lkIDAgIT09IGMpICYmIHIoYyksIHZvaWQgMCA9PSBlID8gbmV3IHRoaXMoKSA6IChuID0gW10sIHQgPyAocyA9IDAsIGEgPSBvKGMsIHUgPiAyID8gYXJndW1lbnRzWzJdIDogdm9pZCAwLCAyKSwgaShlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBuLnB1c2goYShlLCBzKyspKTsKICAgICAgICAgICAgICAgICAgICB9KSkgOiBpKGUsIG4ucHVzaCwgeyB0aGF0OiBuIH0pLCBuZXcgdGhpcyhuKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoLCB0ID0gbmV3IEFycmF5KGUpOyBlLS07KQogICAgICAgICAgICAgICAgICAgICAgICB0W2VdID0gYXJndW1lbnRzW2VdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgdGhpcyh0KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgfHwgKHRbbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgIH0obigxMTQpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIChyID0gdC5UQ0ZDb21tYW5kIHx8ICh0LlRDRkNvbW1hbmQgPSB7fSkpLlBJTkcgPSAncGluZycsIHIuR0VUX1RDX0RBVEEgPSAnZ2V0VENEYXRhJywgci5HRVRfSU5fQVBQX1RDX0RBVEEgPSAnZ2V0SW5BcHBUQ0RhdGEnLCByLkdFVF9WRU5ET1JfTElTVCA9ICdnZXRWZW5kb3JMaXN0Jywgci5BRERfRVZFTlRfTElTVEVORVIgPSAnYWRkRXZlbnRMaXN0ZW5lcicsIHIuUkVNT1ZFX0VWRU5UX0xJU1RFTkVSID0gJ3JlbW92ZUV2ZW50TGlzdGVuZXInOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzICYmIHRoaXMuX19leHRlbmRzIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCB7IF9fcHJvdG9fXzogW10gfSBpbnN0YW5jZW9mIEFycmF5ICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9fcHJvdG9fXyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pICYmIChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnN0cnVjdG9yID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBvID0gbig1MiksIGkgPSBuKDUzKSwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG51bGwgIT09IGUgJiYgZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5jbXBTdGF0dXMgPSBpLkNtcFN0YXR1cy5FUlJPUiwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdDsKICAgICAgICAgICAgICAgICAgICB9KG8uUmVzcG9uc2UpOwogICAgICAgICAgICAgICAgdC5EaXNhYmxlZCA9IHM7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0oKSwgbyA9IHRoaXMgJiYgdGhpcy5fX3JlYWQgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZVtTeW1ib2wuaXRlcmF0b3JdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8sIGkgPSBuLmNhbGwoZSksIHMgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyAodm9pZCAwID09PSB0IHx8IHQtLSA+IDApICYmICEociA9IGkubmV4dCgpKS5kb25lOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnB1c2goci52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSB7IGVycm9yOiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgIXIuZG9uZSAmJiAobiA9IGkucmV0dXJuKSAmJiBuLmNhbGwoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBvLmVycm9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzOwogICAgICAgICAgICAgICAgICAgIH0sIGkgPSB0aGlzICYmIHRoaXMuX19zcHJlYWQgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gW10sIHQgPSAwOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUuY29uY2F0KG8oYXJndW1lbnRzW3RdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBzID0gbigyNSksIGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5jYWxsKHRoaXMpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5ldmVudFN0YXR1cyA9IHMuQ21wQXBpTW9kZWwuZXZlbnRTdGF0dXMsIHIuY21wU3RhdHVzID0gcy5DbXBBcGlNb2RlbC5jbXBTdGF0dXMsIHIubGlzdGVuZXJJZCA9IG4sIHMuQ21wQXBpTW9kZWwuZ2RwckFwcGxpZXMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHMuQ21wQXBpTW9kZWwudGNNb2RlbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnRjU3RyaW5nID0gcy5DbXBBcGlNb2RlbC50Y1N0cmluZywgci5pc1NlcnZpY2VTcGVjaWZpYyA9IG8uaXNTZXJ2aWNlU3BlY2lmaWMsIHIudXNlTm9uU3RhbmRhcmRTdGFja3MgPSBvLnVzZU5vblN0YW5kYXJkU3RhY2tzLCByLnB1cnBvc2VPbmVUcmVhdG1lbnQgPSBvLnB1cnBvc2VPbmVUcmVhdG1lbnQsIHIucHVibGlzaGVyQ0MgPSBvLnB1Ymxpc2hlckNvdW50cnlDb2RlLCByLm91dE9mQmFuZCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZFZlbmRvcnM6IHIuY3JlYXRlVmVjdG9yRmllbGQoby52ZW5kb3JzQWxsb3dlZCwgdCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc2Nsb3NlZFZlbmRvcnM6IHIuY3JlYXRlVmVjdG9yRmllbGQoby52ZW5kb3JzRGlzY2xvc2VkLCB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIucHVycG9zZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudHM6IHIuY3JlYXRlVmVjdG9yRmllbGQoby5wdXJwb3NlQ29uc2VudHMpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlSW50ZXJlc3RzOiByLmNyZWF0ZVZlY3RvckZpZWxkKG8ucHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgci52ZW5kb3IgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRzOiByLmNyZWF0ZVZlY3RvckZpZWxkKG8udmVuZG9yQ29uc2VudHMsIHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlSW50ZXJlc3RzOiByLmNyZWF0ZVZlY3RvckZpZWxkKG8udmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cywgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByLnNwZWNpYWxGZWF0dXJlT3B0aW5zID0gci5jcmVhdGVWZWN0b3JGaWVsZChvLnNwZWNpYWxGZWF0dXJlT3B0aW5zKSwgci5wdWJsaXNoZXIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRzOiByLmNyZWF0ZVZlY3RvckZpZWxkKG8ucHVibGlzaGVyQ29uc2VudHMpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlSW50ZXJlc3RzOiByLmNyZWF0ZVZlY3RvckZpZWxkKG8ucHVibGlzaGVyTGVnaXRpbWF0ZUludGVyZXN0cyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVB1cnBvc2U6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRzOiByLmNyZWF0ZVZlY3RvckZpZWxkKG8ucHVibGlzaGVyQ3VzdG9tQ29uc2VudHMpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVnaXRpbWF0ZUludGVyZXN0czogci5jcmVhdGVWZWN0b3JGaWVsZChvLnB1Ymxpc2hlckN1c3RvbUxlZ2l0aW1hdGVJbnRlcmVzdHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3RyaWN0aW9uczogci5jcmVhdGVSZXN0cmljdGlvbnMoby5wdWJsaXNoZXJSZXN0cmljdGlvbnMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5jcmVhdGVSZXN0cmljdGlvbnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLm51bVJlc3RyaWN0aW9ucyA+IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IGUuZ2V0TWF4VmVuZG9ySWQoKSwgciA9IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLnRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5nZXRSZXN0cmljdGlvbnMobikuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUucHVycG9zZUlkLnRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbbl0gfHwgKHRbbl0gPSB7fSksIHRbbl1bcl0gPSBlLnJlc3RyaWN0aW9uVHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8gPSAxOyBvIDw9IG47IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5jcmVhdGVWZWN0b3JGaWVsZCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA/IHQucmVkdWNlKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbbiArICcnXSA9IGUuaGFzKCtuKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9KSA6IGkoZSkucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbdFswXS50b1N0cmluZygxMCldID0gdFsxXSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdDsKICAgICAgICAgICAgICAgICAgICB9KG4oNTIpLlJlc3BvbnNlKTsKICAgICAgICAgICAgICAgIHQuVENEYXRhID0gYTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fcmVhZCB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiBlW1N5bWJvbC5pdGVyYXRvcl07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgbywgaSA9IG4uY2FsbChlKSwgcyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7ICh2b2lkIDAgPT09IHQgfHwgdC0tID4gMCkgJiYgIShyID0gaS5uZXh0KCkpLmRvbmU7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMucHVzaChyLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IHsgZXJyb3I6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciAmJiAhci5kb25lICYmIChuID0gaS5yZXR1cm4pICYmIG4uY2FsbChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG8uZXJyb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHM7CiAgICAgICAgICAgICAgICAgICAgfSwgbyA9IHRoaXMgJiYgdGhpcy5fX3NwcmVhZCB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBbXSwgdCA9IDA7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5jb25jYXQocihhcmd1bWVudHNbdF0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIGkgPSBuKDExMyksIHMgPSBuKDI2NiksIGEgPSBuKDI1KSwgdSA9IG4oMTE1KSwgYyA9IG4oMjg2KTsKICAgICAgICAgICAgICAgIHQuQVBJX0tFWSA9ICdfX3RjZmFwaSc7CiAgICAgICAgICAgICAgICB2YXIgZiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jdXN0b21Db21tYW5kcyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNhbGxRdWV1ZSA9IHdpbmRvd1t0LkFQSV9LRVldKCkgfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbFF1ZXVlID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3dbdC5BUElfS0VZXSA9IHRoaXMuYXBpQ2FsbC5iaW5kKHRoaXMpLCB0aGlzLnB1cmdlUXVldWVkQ2FsbHMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuYXBpQ2FsbCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIsIGYgPSBbXSwgbCA9IDM7IGwgPCBhcmd1bWVudHMubGVuZ3RoOyBsKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmW2wgLSAzXSA9IGFyZ3VtZW50c1tsXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbihudWxsLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGMuU3VwcG9ydGVkVmVyc2lvbnMuaGFzKHQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ2ludmFsaWQgY2FsbGJhY2sgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuQ21wQXBpTW9kZWwuZGlzYWJsZWQgPyBuKG5ldyB1LkRpc2FibGVkKCksICExKSA6IHRoaXMuaXNDdXN0b21Db21tYW5kKGUpIHx8IHRoaXMuaXNCdWlsdEluQ29tbWFuZChlKSA/IHRoaXMuaXNDdXN0b21Db21tYW5kKGUpICYmICF0aGlzLmlzQnVpbHRJbkNvbW1hbmQoZSkgPyAociA9IHRoaXMuY3VzdG9tQ29tbWFuZHMpW2VdLmFwcGx5KHIsIG8oW25dLCBmKSkgOiBlID09PSBpLlRDRkNvbW1hbmQuUElORyA/IHRoaXMuaXNDdXN0b21Db21tYW5kKGUpID8gbmV3IHMuQ29tbWFuZE1hcFtlXSh0aGlzLmN1c3RvbUNvbW1hbmRzW2VdLCBmWzBdLCBudWxsLCBuKSA6IG5ldyBzLkNvbW1hbmRNYXBbZV0obiwgZlswXSkgOiB2b2lkIDAgPT09IGEuQ21wQXBpTW9kZWwudGNNb2RlbCA/IHRoaXMuY2FsbFF1ZXVlLnB1c2gobyhbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIGYpKSA6IHRoaXMuaXNDdXN0b21Db21tYW5kKGUpICYmIHRoaXMuaXNCdWlsdEluQ29tbWFuZChlKSA/IG5ldyBzLkNvbW1hbmRNYXBbZV0odGhpcy5jdXN0b21Db21tYW5kc1tlXSwgZlswXSwgbnVsbCwgbikgOiBuZXcgcy5Db21tYW5kTWFwW2VdKG4sIGZbMF0pIDogbihudWxsLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbihudWxsLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUucHVyZ2VRdWV1ZWRDYWxscyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLmNhbGxRdWV1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jYWxsUXVldWUgPSBbXSwgZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3dbdC5BUElfS0VZXS5hcHBseSh3aW5kb3csIG8oZSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5pc0N1c3RvbUNvbW1hbmQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jdXN0b21Db21tYW5kcyAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiB0aGlzLmN1c3RvbUNvbW1hbmRzW2VdOwogICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLmlzQnVpbHRJbkNvbW1hbmQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBzLkNvbW1hbmRNYXBbZV07CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuQ2FsbFJlc3BvbmRlciA9IGY7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNCksIG8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZW5jb2RlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghL15bMC0xXSskLy50ZXN0KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyByLkVuY29kaW5nRXJyb3IoJ0ludmFsaWQgYml0RmllbGQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5sZW5ndGggJSB0aGlzLkxDTTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgKz0gdCA/ICcwJy5yZXBlYXQodGhpcy5MQ00gLSB0KSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9ICcnLCBvID0gMDsgbyA8IGUubGVuZ3RoOyBvICs9IHRoaXMuQkFTSVMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiArPSB0aGlzLkRJQ1RbcGFyc2VJbnQoZS5zdWJzdHIobywgdGhpcy5CQVNJUyksIDIpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRlY29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIS9eW0EtWmEtejAtOVwtX10rJC8udGVzdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgci5EZWNvZGluZ0Vycm9yKCdJbnZhbGlkbHkgZW5jb2RlZCBCYXNlNjRVUkwgc3RyaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gJycsIG4gPSAwOyBuIDwgZS5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdGhpcy5SRVZFUlNFX0RJQ1QuZ2V0KGVbbl0pLnRvU3RyaW5nKDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gJzAnLnJlcGVhdCh0aGlzLkJBU0lTIC0gby5sZW5ndGgpICsgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLkRJQ1QgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODktXycsIGUuUkVWRVJTRV9ESUNUID0gbmV3IE1hcChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0EnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0onLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0snLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdMJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ04nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdPJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1EnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdVJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdYJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnWScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1onLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI4CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyOQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdqJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzYKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2wnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM3CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ28nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAneicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICc0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1NgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU4CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICc3JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1OQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnOCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICctJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2MgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnXycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGUuQkFTSVMgPSA2LCBlLkxDTSA9IDI0LCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuQmFzZTY0VXJsID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5yb290ID0gbnVsbCwgdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIHQucHJvdG90eXBlLmlzRW1wdHkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhdGhpcy5yb290OwogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlnaHQ6IG51bGwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmlzRW1wdHkoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucm9vdCA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCA9IHRoaXMucm9vdDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIDwgdC52YWx1ZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gdC5sZWZ0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxlZnQgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQubGVmdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlID4gdC52YWx1ZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IHQucmlnaHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucmlnaHQgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQucmlnaHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IFtdLCB0ID0gdGhpcy5yb290OyB0OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmxlZnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gdC5sZWZ0OyBuLnJpZ2h0ICYmIG4ucmlnaHQgIT0gdDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBuLnJpZ2h0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucmlnaHQgPT0gdCA/IChuLnJpZ2h0ID0gbnVsbCwgZS5wdXNoKHQudmFsdWUpLCB0ID0gdC5yaWdodCkgOiAobi5yaWdodCA9IHQsIHQgPSB0LmxlZnQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wdXNoKHQudmFsdWUpLCB0ID0gdC5yaWdodDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuY29udGFpbnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gITEsIG4gPSB0aGlzLnJvb3Q7IG47KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi52YWx1ZSA9PT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPiBuLnZhbHVlID8gbiA9IG4ucmlnaHQgOiBlIDwgbi52YWx1ZSAmJiAobiA9IG4ubGVmdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUubWluID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodm9pZCAwID09PSBlICYmIChlID0gdGhpcy5yb290KTsgZTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmxlZnQgPyBlID0gZS5sZWZ0IDogKHQgPSBlLnZhbHVlLCBlID0gbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLm1heCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZvaWQgMCA9PT0gZSAmJiAoZSA9IHRoaXMucm9vdCk7IGU7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5yaWdodCA/IGUgPSBlLnJpZ2h0IDogKHQgPSBlLnZhbHVlLCBlID0gbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnJlbW92ZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gdCAmJiAodCA9IHRoaXMucm9vdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBudWxsLCByID0gJ2xlZnQnOyB0OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIDwgdC52YWx1ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gdCwgdCA9IHQubGVmdCwgciA9ICdsZWZ0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGUgPiB0LnZhbHVlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB0LCB0ID0gdC5yaWdodCwgciA9ICdyaWdodCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5sZWZ0IHx8IHQucmlnaHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmxlZnQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5yaWdodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdGhpcy5taW4odC5yaWdodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yZW1vdmUobywgdC5yaWdodCksIHQudmFsdWUgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA/IG5bcl0gPSB0LmxlZnQgOiB0aGlzLnJvb3QgPSB0LmxlZnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPyBuW3JdID0gdC5yaWdodCA6IHRoaXMucm9vdCA9IHQucmlnaHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID8gbltyXSA9IG51bGwgOiB0aGlzLnJvb3QgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIHQ7CiAgICAgICAgICAgICAgICB9KG4oMzApLkNsb25lYWJsZSk7CiAgICAgICAgICAgICAgICB0LkJpbmFyeVNlYXJjaFRyZWUgPSBvOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jbXBJZCA9ICdjbXBJZCcsIGUuY21wVmVyc2lvbiA9ICdjbXBWZXJzaW9uJywgZS5jb25zZW50TGFuZ3VhZ2UgPSAnY29uc2VudExhbmd1YWdlJywgZS5jb25zZW50U2NyZWVuID0gJ2NvbnNlbnRTY3JlZW4nLCBlLmNyZWF0ZWQgPSAnY3JlYXRlZCcsIGUuc3VwcG9ydE9PQiA9ICdzdXBwb3J0T09CJywgZS5pc1NlcnZpY2VTcGVjaWZpYyA9ICdpc1NlcnZpY2VTcGVjaWZpYycsIGUubGFzdFVwZGF0ZWQgPSAnbGFzdFVwZGF0ZWQnLCBlLm51bUN1c3RvbVB1cnBvc2VzID0gJ251bUN1c3RvbVB1cnBvc2VzJywgZS5wb2xpY3lWZXJzaW9uID0gJ3BvbGljeVZlcnNpb24nLCBlLnB1Ymxpc2hlckNvdW50cnlDb2RlID0gJ3B1Ymxpc2hlckNvdW50cnlDb2RlJywgZS5wdWJsaXNoZXJDdXN0b21Db25zZW50cyA9ICdwdWJsaXNoZXJDdXN0b21Db25zZW50cycsIGUucHVibGlzaGVyQ3VzdG9tTGVnaXRpbWF0ZUludGVyZXN0cyA9ICdwdWJsaXNoZXJDdXN0b21MZWdpdGltYXRlSW50ZXJlc3RzJywgZS5wdWJsaXNoZXJMZWdpdGltYXRlSW50ZXJlc3RzID0gJ3B1Ymxpc2hlckxlZ2l0aW1hdGVJbnRlcmVzdHMnLCBlLnB1Ymxpc2hlckNvbnNlbnRzID0gJ3B1Ymxpc2hlckNvbnNlbnRzJywgZS5wdWJsaXNoZXJSZXN0cmljdGlvbnMgPSAncHVibGlzaGVyUmVzdHJpY3Rpb25zJywgZS5wdXJwb3NlQ29uc2VudHMgPSAncHVycG9zZUNvbnNlbnRzJywgZS5wdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cyA9ICdwdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cycsIGUucHVycG9zZU9uZVRyZWF0bWVudCA9ICdwdXJwb3NlT25lVHJlYXRtZW50JywgZS5zcGVjaWFsRmVhdHVyZU9wdGlucyA9ICdzcGVjaWFsRmVhdHVyZU9wdGlucycsIGUudXNlTm9uU3RhbmRhcmRTdGFja3MgPSAndXNlTm9uU3RhbmRhcmRTdGFja3MnLCBlLnZlbmRvckNvbnNlbnRzID0gJ3ZlbmRvckNvbnNlbnRzJywgZS52ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzID0gJ3ZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMnLCBlLnZlbmRvckxpc3RWZXJzaW9uID0gJ3ZlbmRvckxpc3RWZXJzaW9uJywgZS52ZW5kb3JzQWxsb3dlZCA9ICd2ZW5kb3JzQWxsb3dlZCcsIGUudmVuZG9yc0Rpc2Nsb3NlZCA9ICd2ZW5kb3JzRGlzY2xvc2VkJywgZS52ZXJzaW9uID0gJ3ZlcnNpb24nLCBlOwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5GaWVsZHMgPSByOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzICYmIHRoaXMuX19leHRlbmRzIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCB7IF9fcHJvdG9fXzogW10gfSBpbnN0YW5jZW9mIEFycmF5ICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9fcHJvdG9fXyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pICYmIChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnN0cnVjdG9yID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBvID0gbigzMCksIGkgPSBuKDE0KSwgcyA9IG4oODApLCBhID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuY2FsbCh0aGlzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gdCAmJiAoci5wdXJwb3NlSWQgPSB0KSwgdm9pZCAwICE9PSBuICYmIChyLnJlc3RyaWN0aW9uVHlwZSA9IG4pLCByOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnVuSGFzaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuc3BsaXQodGhpcy5oYXNoU2VwYXJhdG9yKSwgciA9IG5ldyB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMiAhPT0gbi5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuVENNb2RlbEVycm9yKCdoYXNoJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5wdXJwb3NlSWQgPSBwYXJzZUludChuWzBdLCAxMCksIHIucmVzdHJpY3Rpb25UeXBlID0gcGFyc2VJbnQoblsxXSwgMTApLCByOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdoYXNoJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLmlzVmFsaWQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdjYW5ub3QgaGFzaCBpbnZhbGlkIFB1cnBvc2VSZXN0cmljdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJyArIHRoaXMucHVycG9zZUlkICsgdC5oYXNoU2VwYXJhdG9yICsgdGhpcy5yZXN0cmljdGlvblR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdwdXJwb3NlSWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wdXJwb3NlSWRfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnB1cnBvc2VJZF8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5wcm90b3R5cGUuaXNWYWxpZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIuaXNJbnRlZ2VyKHRoaXMucHVycG9zZUlkKSAmJiB0aGlzLnB1cnBvc2VJZCA+IDAgJiYgKHRoaXMucmVzdHJpY3Rpb25UeXBlID09PSBzLlJlc3RyaWN0aW9uVHlwZS5OT1RfQUxMT1dFRCB8fCB0aGlzLnJlc3RyaWN0aW9uVHlwZSA9PT0gcy5SZXN0cmljdGlvblR5cGUuUkVRVUlSRV9DT05TRU5UIHx8IHRoaXMucmVzdHJpY3Rpb25UeXBlID09PSBzLlJlc3RyaWN0aW9uVHlwZS5SRVFVSVJFX0xJKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuaXNTYW1lQXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucHVycG9zZUlkID09PSBlLnB1cnBvc2VJZCAmJiB0aGlzLnJlc3RyaWN0aW9uVHlwZSA9PT0gZS5yZXN0cmljdGlvblR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuaGFzaFNlcGFyYXRvciA9ICctJywgdDsKICAgICAgICAgICAgICAgICAgICB9KG8uQ2xvbmVhYmxlKTsKICAgICAgICAgICAgICAgIHQuUHVycG9zZVJlc3RyaWN0aW9uID0gYTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIChyID0gdC5TZWdtZW50IHx8ICh0LlNlZ21lbnQgPSB7fSkpLkNPUkUgPSAnY29yZScsIHIuVkVORE9SU19ESVNDTE9TRUQgPSAndmVuZG9yc0Rpc2Nsb3NlZCcsIHIuVkVORE9SU19BTExPV0VEID0gJ3ZlbmRvcnNBbGxvd2VkJywgci5QVUJMSVNIRVJfVEMgPSAncHVibGlzaGVyVEMnOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pIHx8ICh0W25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgcihuKDQyKSksIHIobigxMjQpKSwgcihuKDI3OSkpLCByKG4oODEpKSwgcihuKDMxKSksIHIobigxMjUpKSwgcihuKDEyNikpLCByKG4oMTI4KSksIHIobigxMjcpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDMxKSwgbyA9IG4oMTQpLCBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5JbnRFbmNvZGVyLmVuY29kZShNYXRoLnJvdW5kKGUuZ2V0VGltZSgpIC8gMTAwKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZGVjb2RlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICE9PSBlLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgby5EZWNvZGluZ0Vycm9yKCdpbnZhbGlkIGJpdCBsZW5ndGgnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IERhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnNldFRpbWUoMTAwICogci5JbnRFbmNvZGVyLmRlY29kZShlLCB0KSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5EYXRlRW5jb2RlciA9IGk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigzMSksIG8gPSBuKDE0KSwgaSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5lbmNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAoZSA9IGUudG9VcHBlckNhc2UoKSkuY2hhckNvZGVBdCgwKSAtIDY1LCBpID0gZS5jaGFyQ29kZUF0KDEpIC0gNjU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA8IDAgfHwgbiA+IDI1IHx8IGkgPCAwIHx8IGkgPiAyNSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgby5FbmNvZGluZ0Vycm9yKCdpbnZhbGlkIGxhbmd1YWdlIGNvZGU6ICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICUgMiA9PSAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBvLkVuY29kaW5nRXJyb3IoJ251bUJpdHMgbXVzdCBiZSBldmVuLCAnICsgdCArICcgaXMgbm90IHZhbGlkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAvPSAyLCByLkludEVuY29kZXIuZW5jb2RlKG4sIHQpICsgci5JbnRFbmNvZGVyLmVuY29kZShpLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5kZWNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgIT09IGUubGVuZ3RoIHx8IGUubGVuZ3RoICUgMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgby5EZWNvZGluZ0Vycm9yKCdpbnZhbGlkIGJpdCBsZW5ndGggZm9yIGxhbmd1YWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUubGVuZ3RoIC8gMiwgaSA9IHIuSW50RW5jb2Rlci5kZWNvZGUoZS5zbGljZSgwLCBuKSwgbikgKyA2NSwgcyA9IHIuSW50RW5jb2Rlci5kZWNvZGUoZS5zbGljZShuKSwgbikgKyA2NTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlKGkpICsgU3RyaW5nLmZyb21DaGFyQ29kZShzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkxhbmdFbmNvZGVyID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDc5KSwgbyA9IG4oNDIpLCBpID0gbigxNCksIHMgPSBuKDMxKSwgYSA9IG4oMTUpLCB1ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHMuSW50RW5jb2Rlci5lbmNvZGUoZS5udW1SZXN0cmljdGlvbnMsIHIuQml0TGVuZ3RoLm51bVJlc3RyaWN0aW9ucyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5pc0VtcHR5KCkgfHwgZS5nZXRSZXN0cmljdGlvbnMoKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSBzLkludEVuY29kZXIuZW5jb2RlKG4ucHVycG9zZUlkLCByLkJpdExlbmd0aC5wdXJwb3NlSWQpLCB0ICs9IHMuSW50RW5jb2Rlci5lbmNvZGUobi5yZXN0cmljdGlvblR5cGUsIHIuQml0TGVuZ3RoLnJlc3RyaWN0aW9uVHlwZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IGUuZ2V0VmVuZG9ycyhuKSwgYSA9IGkubGVuZ3RoLCB1ID0gMCwgYyA9IDAsIGYgPSAnJywgbCA9IDA7IGwgPCBhOyBsKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBpW2xdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gYyAmJiAodSsrLCBjID0gcCksIGwgPT09IGEgLSAxIHx8IGlbbCArIDFdID4gcCArIDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gIShwID09PSBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgKz0gby5Cb29sZWFuRW5jb2Rlci5lbmNvZGUoZCksIGYgKz0gcy5JbnRFbmNvZGVyLmVuY29kZShjLCByLkJpdExlbmd0aC52ZW5kb3JJZCksIGQgJiYgKGYgKz0gcy5JbnRFbmNvZGVyLmVuY29kZShwLCByLkJpdExlbmd0aC52ZW5kb3JJZCkpLCBjID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9IHMuSW50RW5jb2Rlci5lbmNvZGUodSwgci5CaXRMZW5ndGgubnVtRW50cmllcyksIHQgKz0gZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRlY29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IDAsIG4gPSBuZXcgYS5QdXJwb3NlUmVzdHJpY3Rpb25WZWN0b3IoKSwgdSA9IHMuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgubnVtUmVzdHJpY3Rpb25zKSwgci5CaXRMZW5ndGgubnVtUmVzdHJpY3Rpb25zKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gci5CaXRMZW5ndGgubnVtUmVzdHJpY3Rpb25zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IDA7IGMgPCB1OyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHMuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgucHVycG9zZUlkKSwgci5CaXRMZW5ndGgucHVycG9zZUlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9IHIuQml0TGVuZ3RoLnB1cnBvc2VJZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IHMuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgucmVzdHJpY3Rpb25UeXBlKSwgci5CaXRMZW5ndGgucmVzdHJpY3Rpb25UeXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9IHIuQml0TGVuZ3RoLnJlc3RyaWN0aW9uVHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IG5ldyBhLlB1cnBvc2VSZXN0cmljdGlvbihmLCBsKSwgZCA9IHMuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgubnVtRW50cmllcyksIHIuQml0TGVuZ3RoLm51bUVudHJpZXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gci5CaXRMZW5ndGgubnVtRW50cmllczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBoID0gMDsgaCA8IGQ7IGgrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdiA9IG8uQm9vbGVhbkVuY29kZXIuZGVjb2RlKGUuc3Vic3RyKHQsIHIuQml0TGVuZ3RoLmFueUJvb2xlYW4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSByLkJpdExlbmd0aC5hbnlCb29sZWFuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IHMuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgudmVuZG9ySWQpLCByLkJpdExlbmd0aC52ZW5kb3JJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICs9IHIuQml0TGVuZ3RoLnZlbmRvcklkLCB2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IHMuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgudmVuZG9ySWQpLCByLkJpdExlbmd0aC52ZW5kb3JJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCArPSByLkJpdExlbmd0aC52ZW5kb3JJZCwgZyA8IHkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuRGVjb2RpbmdFcnJvcignSW52YWxpZCBSYW5nZUVudHJ5OiBlbmRWZW5kb3JJZCAnICsgZyArICcgaXMgbGVzcyB0aGFuICcgKyB5KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG0gPSB5OyBtIDw9IGc7IG0rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmFkZChtLCBwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmFkZCh5LCBwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5iaXRMZW5ndGggPSB0LCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuUHVycG9zZVJlc3RyaWN0aW9uVmVjdG9yRW5jb2RlciA9IHU7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNSksIG8gPSBuKDc4KSwgaSA9IG4oMzEpLCBzID0gbig0MiksIGEgPSBuKDgxKSwgdSA9IG4oMTI4KSwgYyA9IG4oMTQpLCBmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IFtdLCByID0gW10sIGEgPSBpLkludEVuY29kZXIuZW5jb2RlKGUubWF4SWQsIG8uQml0TGVuZ3RoLm1heElkKSwgYyA9ICcnLCBmID0gby5CaXRMZW5ndGgubWF4SWQgKyBvLkJpdExlbmd0aC5lbmNvZGluZ1R5cGUsIGwgPSBmICsgZS5tYXhJZCwgcCA9IDIgKiBvLkJpdExlbmd0aC52ZW5kb3JJZCArIG8uQml0TGVuZ3RoLnNpbmdsZU9yUmFuZ2UgKyBvLkJpdExlbmd0aC5udW1FbnRyaWVzLCBkID0gZiArIG8uQml0TGVuZ3RoLm51bUVudHJpZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5mb3JFYWNoKGZ1bmN0aW9uIChpLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyArPSBzLkJvb2xlYW5FbmNvZGVyLmVuY29kZShpKSwgKHQgPSBlLm1heElkID4gcCAmJiBkIDwgbCkgJiYgaSAmJiAoZS5oYXMoYSArIDEpID8gMCA9PT0gci5sZW5ndGggJiYgKHIucHVzaChhKSwgZCArPSBvLkJpdExlbmd0aC5zaW5nbGVPclJhbmdlLCBkICs9IG8uQml0TGVuZ3RoLnZlbmRvcklkKSA6IChyLnB1c2goYSksIGQgKz0gby5CaXRMZW5ndGgudmVuZG9ySWQsIG4ucHVzaChyKSwgciA9IFtdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdCA/IChhICs9IHUuVmVjdG9yRW5jb2RpbmdUeXBlLlJBTkdFICsgJycsIGEgKz0gdGhpcy5idWlsZFJhbmdlRW5jb2RpbmcobikpIDogKGEgKz0gdS5WZWN0b3JFbmNvZGluZ1R5cGUuRklFTEQgKyAnJywgYSArPSBjKSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5kZWNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGYgPSAwLCBsID0gaS5JbnRFbmNvZGVyLmRlY29kZShlLnN1YnN0cihmLCBvLkJpdExlbmd0aC5tYXhJZCksIG8uQml0TGVuZ3RoLm1heElkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgKz0gby5CaXRMZW5ndGgubWF4SWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IGkuSW50RW5jb2Rlci5kZWNvZGUoZS5jaGFyQXQoZiksIG8uQml0TGVuZ3RoLmVuY29kaW5nVHlwZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZiArPSBvLkJpdExlbmd0aC5lbmNvZGluZ1R5cGUsIHAgPT09IHUuVmVjdG9yRW5jb2RpbmdUeXBlLlJBTkdFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSBuZXcgci5WZWN0b3IoKSwgMSA9PT0gdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJzEnID09PSBlLnN1YnN0cihmLCAxKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBjLkRlY29kaW5nRXJyb3IoJ1VuYWJsZSB0byBkZWNvZGUgZGVmYXVsdCBjb25zZW50PTEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZisrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGkuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIoZiwgby5CaXRMZW5ndGgubnVtRW50cmllcyksIG8uQml0TGVuZ3RoLm51bUVudHJpZXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgKz0gby5CaXRMZW5ndGgubnVtRW50cmllczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBoID0gMDsgaCA8IGQ7IGgrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdiA9IHMuQm9vbGVhbkVuY29kZXIuZGVjb2RlKGUuY2hhckF0KGYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiArPSBvLkJpdExlbmd0aC5zaW5nbGVPclJhbmdlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IGkuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIoZiwgby5CaXRMZW5ndGgudmVuZG9ySWQpLCBvLkJpdExlbmd0aC52ZW5kb3JJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmICs9IG8uQml0TGVuZ3RoLnZlbmRvcklkLCB2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGkuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIoZiwgby5CaXRMZW5ndGgudmVuZG9ySWQpLCBvLkJpdExlbmd0aC52ZW5kb3JJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmICs9IG8uQml0TGVuZ3RoLnZlbmRvcklkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbSA9IHk7IG0gPD0gZzsgbSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uc2V0KG0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uc2V0KHkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBlLnN1YnN0cihmLCBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmICs9IGwsIG4gPSBhLkZpeGVkVmVjdG9yRW5jb2Rlci5kZWNvZGUoYiwgbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5iaXRMZW5ndGggPSBmLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmJ1aWxkUmFuZ2VFbmNvZGluZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubGVuZ3RoLCBuID0gaS5JbnRFbmNvZGVyLmVuY29kZSh0LCBvLkJpdExlbmd0aC5udW1FbnRyaWVzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IDEgPT09IGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gKz0gcy5Cb29sZWFuRW5jb2Rlci5lbmNvZGUoIXQpLCBuICs9IGkuSW50RW5jb2Rlci5lbmNvZGUoZVswXSwgby5CaXRMZW5ndGgudmVuZG9ySWQpLCB0IHx8IChuICs9IGkuSW50RW5jb2Rlci5lbmNvZGUoZVsxXSwgby5CaXRMZW5ndGgudmVuZG9ySWQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuVmVuZG9yVmVjdG9yRW5jb2RlciA9IGY7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCAociA9IHQuVmVjdG9yRW5jb2RpbmdUeXBlIHx8ICh0LlZlY3RvckVuY29kaW5nVHlwZSA9IHt9KSlbci5GSUVMRCA9IDBdID0gJ0ZJRUxEJywgcltyLlJBTkdFID0gMV0gPSAnUkFOR0UnOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pIHx8ICh0W25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgcihuKDI4MCkpLCByKG4oMjgxKSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0oKSwgbyA9IHRoaXMgJiYgdGhpcy5fX2F3YWl0ZXIgfHwgZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyAobiB8fCAobiA9IFByb21pc2UpKShmdW5jdGlvbiAobywgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdShyLm5leHQoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1KHIudGhyb3coZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmRvbmUgPyBvKGUudmFsdWUpIDogKHQgPSBlLnZhbHVlLCB0IGluc3RhbmNlb2YgbiA/IHQgOiBuZXcgbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS50aGVuKHMsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdSgociA9IHIuYXBwbHkoZSwgdCB8fCBbXSkpLm5leHQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIGkgPSB0aGlzICYmIHRoaXMuX19nZW5lcmF0b3IgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8sIGksIHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWw6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VudDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSAmIG9bMF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBvWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeXM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wczogW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogYSgwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93OiBhKDEpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOiBhKDIpCiAgICAgICAgICAgICAgICAgICAgICAgIH0sICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAoaVtTeW1ib2wuaXRlcmF0b3JdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpOwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0dlbmVyYXRvciBpcyBhbHJlYWR5IGV4ZWN1dGluZy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHM7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9IDEsIHIgJiYgKG8gPSAyICYgaVswXSA/IHIucmV0dXJuIDogaVswXSA/IHIudGhyb3cgfHwgKChvID0gci5yZXR1cm4pICYmIG8uY2FsbChyKSwgMCkgOiByLm5leHQpICYmICEobyA9IG8uY2FsbChyLCBpWzFdKSkuZG9uZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChyID0gMCwgbyAmJiAoaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIgJiBpWzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby52YWx1ZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgaVswXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzLmxhYmVsKyssIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBpWzFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubGFiZWwrKywgciA9IGlbMV0sIGkgPSBbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IHMub3BzLnBvcCgpLCBzLnRyeXMucG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG8gPSAobyA9IHMudHJ5cykubGVuZ3RoID4gMCAmJiBvW28ubGVuZ3RoIC0gMV0pICYmICg2ID09PSBpWzBdIHx8IDIgPT09IGlbMF0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgzID09PSBpWzBdICYmICghbyB8fCBpWzFdID4gb1swXSAmJiBpWzFdIDwgb1szXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubGFiZWwgPSBpWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDYgPT09IGlbMF0gJiYgcy5sYWJlbCA8IG9bMV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubGFiZWwgPSBvWzFdLCBvID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvICYmIHMubGFiZWwgPCBvWzJdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLmxhYmVsID0gb1syXSwgcy5vcHMucHVzaChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9bMl0gJiYgcy5vcHMucG9wKCksIHMudHJ5cy5wb3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSB0LmNhbGwoZSwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHIgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbyA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg1ICYgaVswXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGlbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogaVswXSA/IGlbMV0gOiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHMgPSBuKDMwKSwgYSA9IG4oMTQpLCB1ID0gbigxMzEpLCBjID0gbigxNSksIGYgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5jYWxsKHRoaXMpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmlzUmVhZHlfID0gITEsIHIuaXNMYXRlc3QgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdC5iYXNlVXJsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIubGFuZ18gPSB0LkRFRkFVTFRfTEFOR1VBR0UsIHIuaXNWZW5kb3JMaXN0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucG9wdWxhdGUobiksIHIucmVhZHlQcm9taXNlID0gUHJvbWlzZS5yZXNvbHZlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBhLkdWTEVycm9yKCdtdXN0IHNwZWNpZnkgR1ZMLmJhc2VVcmwgYmVmb3JlIGxvYWRpbmcgR1ZMIGpzb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LkNBQ0hFLmhhcyhpKSA/IChyLnBvcHVsYXRlKHQuQ0FDSEUuZ2V0KGkpKSwgci5yZWFkeVByb21pc2UgPSBQcm9taXNlLnJlc29sdmUoKSkgOiAobyArPSB0LnZlcnNpb25lZEZpbGVuYW1lLnJlcGxhY2UoJ1tWRVJTSU9OXScsIGkgKyAnJyksIHIucmVhZHlQcm9taXNlID0gci5mZXRjaEpzb24obykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LkNBQ0hFLmhhcyh0LkxBVEVTVF9DQUNIRV9LRVkpID8gKHIucG9wdWxhdGUodC5DQUNIRS5nZXQodC5MQVRFU1RfQ0FDSEVfS0VZKSksIHIucmVhZHlQcm9taXNlID0gUHJvbWlzZS5yZXNvbHZlKCkpIDogKHIuaXNMYXRlc3QgPSAhMCwgci5yZWFkeVByb21pc2UgPSByLmZldGNoSnNvbihvICsgdC5sYXRlc3RGaWxlbmFtZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnYmFzZVVybCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmJhc2VVcmxfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoL15odHRwcz86XC9cL3ZlbmRvcmxpc3RcLmNvbnNlbnN1XC5vcmdcLy8udGVzdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGEuR1ZMRXJyb3IoJ0ludmFsaWQgYmFzZVVybCEgIFlvdSBtYXkgbm90IHB1bGwgZGlyZWN0bHkgZnJvbSB2ZW5kb3JsaXN0LmNvbnNlbnN1Lm9yZyBhbmQgbXVzdCBwcm92aWRlIHlvdXIgb3duIGNhY2hlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5sZW5ndGggPiAwICYmICcvJyAhPT0gZVtlLmxlbmd0aCAtIDFdICYmIChlICs9ICcvJyksIHRoaXMuYmFzZVVybF8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5lbXB0eUxhbmd1YWdlQ2FjaGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGUgJiYgdC5MQU5HVUFHRV9DQUNIRS5zaXplID4gMCA/ICh0LkxBTkdVQUdFX0NBQ0hFID0gbmV3IE1hcCgpLCBuID0gITApIDogJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgdGhpcy5jb25zZW50TGFuZ3VhZ2VzLmhhcyhlLnRvVXBwZXJDYXNlKCkpICYmICh0LkxBTkdVQUdFX0NBQ0hFLmRlbGV0ZShlLnRvVXBwZXJDYXNlKCkpLCBuID0gITApLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmVtcHR5Q2FjaGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIuaXNJbnRlZ2VyKGUpICYmIGUgPj0gMCA/ICh0LkNBQ0hFLmRlbGV0ZShlKSwgbiA9ICEwKSA6IHZvaWQgMCA9PT0gZSAmJiAodC5DQUNIRSA9IG5ldyBNYXAoKSwgbiA9ICEwKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuY2FjaGVMYW5ndWFnZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuTEFOR1VBR0VfQ0FDSEUuaGFzKHRoaXMubGFuZ18pIHx8IHQuTEFOR1VBR0VfQ0FDSEUuc2V0KHRoaXMubGFuZ18sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXJwb3NlczogdGhpcy5wdXJwb3NlcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsUHVycG9zZXM6IHRoaXMuc3BlY2lhbFB1cnBvc2VzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlYXR1cmVzOiB0aGlzLmZlYXR1cmVzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxGZWF0dXJlczogdGhpcy5zcGVjaWFsRmVhdHVyZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2tzOiB0aGlzLnN0YWNrcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmZldGNoSnNvbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyh0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKHRoaXMsIGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoci5sYWJlbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci50cnlzLnB1c2goWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIHQgPSB0aGlzLnBvcHVsYXRlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1Lkpzb24uZmV0Y2goZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFwcGx5KHRoaXMsIFtyLnNlbnQoKV0pLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuID0gci5zZW50KCksIG5ldyBhLkdWTEVycm9yKG4ubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbMl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRKc29uID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04ucGFyc2UoSlNPTi5zdHJpbmdpZnkoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd2bFNwZWNpZmljYXRpb25WZXJzaW9uOiB0aGlzLmd2bFNwZWNpZmljYXRpb25WZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckxpc3RWZXJzaW9uOiB0aGlzLnZlbmRvckxpc3RWZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRjZlBvbGljeVZlcnNpb246IHRoaXMudGNmUG9saWN5VmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0VXBkYXRlZDogdGhpcy5sYXN0VXBkYXRlZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXJwb3NlczogdGhpcy5wdXJwb3NlcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsUHVycG9zZXM6IHRoaXMuc3BlY2lhbFB1cnBvc2VzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlYXR1cmVzOiB0aGlzLmZlYXR1cmVzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxGZWF0dXJlczogdGhpcy5zcGVjaWFsRmVhdHVyZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2tzOiB0aGlzLnN0YWNrcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JzOiB0aGlzLmZ1bGxWZW5kb3JMaXN0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmNoYW5nZUxhbmd1YWdlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8sIHMsIHU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkodGhpcywgZnVuY3Rpb24gKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChpLmxhYmVsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID0gZS50b1VwcGVyQ2FzZSgpLCAhdC5jb25zZW50TGFuZ3VhZ2VzLmhhcyhuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID09PSB0aGlzLmxhbmdfKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMubGFuZ18gPSBuLCAhdC5MQU5HVUFHRV9DQUNIRS5oYXMobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG8gaW4gciA9IHQuTEFOR1VBR0VfQ0FDSEUuZ2V0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaGFzT3duUHJvcGVydHkobykgJiYgKHRoaXNbb10gPSByW29dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gdC5iYXNlVXJsICsgdC5sYW5ndWFnZUZpbGVuYW1lLnJlcGxhY2UoJ1tMQU5HXScsIGUpLCBpLmxhYmVsID0gMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkudHJ5cy5wdXNoKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZldGNoSnNvbihzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuc2VudCgpLCB0aGlzLmNhY2hlTGFuZ3VhZ2UoKSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgdSA9IGkuc2VudCgpLCBuZXcgYS5HVkxFcnJvcigndW5hYmxlIHRvIGxvYWQgbGFuZ3VhZ2U6ICcgKyB1Lm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGEuR1ZMRXJyb3IoJ3Vuc3VwcG9ydGVkIGxhbmd1YWdlICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2xhbmd1YWdlJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubGFuZ187CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0LnByb3RvdHlwZS5pc1ZlbmRvckxpc3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gZSAmJiB2b2lkIDAgIT09IGUudmVuZG9yczsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUucG9wdWxhdGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdXJwb3NlcyA9IGUucHVycG9zZXMsIHRoaXMuc3BlY2lhbFB1cnBvc2VzID0gZS5zcGVjaWFsUHVycG9zZXMsIHRoaXMuZmVhdHVyZXMgPSBlLmZlYXR1cmVzLCB0aGlzLnNwZWNpYWxGZWF0dXJlcyA9IGUuc3BlY2lhbEZlYXR1cmVzLCB0aGlzLnN0YWNrcyA9IGUuc3RhY2tzLCB0aGlzLmlzVmVuZG9yTGlzdChlKSAmJiAodGhpcy5ndmxTcGVjaWZpY2F0aW9uVmVyc2lvbiA9IGUuZ3ZsU3BlY2lmaWNhdGlvblZlcnNpb24sIHRoaXMudGNmUG9saWN5VmVyc2lvbiA9IGUudGNmUG9saWN5VmVyc2lvbiwgdGhpcy52ZW5kb3JMaXN0VmVyc2lvbiA9IGUudmVuZG9yTGlzdFZlcnNpb24sIHRoaXMubGFzdFVwZGF0ZWQgPSBlLmxhc3RVcGRhdGVkLCAnc3RyaW5nJyA9PSB0eXBlb2YgdGhpcy5sYXN0VXBkYXRlZCAmJiAodGhpcy5sYXN0VXBkYXRlZCA9IG5ldyBEYXRlKHRoaXMubGFzdFVwZGF0ZWQpKSwgdGhpcy52ZW5kb3JzXyA9IGUudmVuZG9ycywgdGhpcy5mdWxsVmVuZG9yTGlzdCA9IGUudmVuZG9ycywgdGhpcy5tYXBWZW5kb3JzKCksIHRoaXMuaXNSZWFkeV8gPSAhMCwgdGhpcy5pc0xhdGVzdCAmJiB0LkNBQ0hFLnNldCh0LkxBVEVTVF9DQUNIRV9LRVksIHRoaXMuZ2V0SnNvbigpKSwgdC5DQUNIRS5oYXModGhpcy52ZW5kb3JMaXN0VmVyc2lvbikgfHwgdC5DQUNIRS5zZXQodGhpcy52ZW5kb3JMaXN0VmVyc2lvbiwgdGhpcy5nZXRKc29uKCkpKSwgdGhpcy5jYWNoZUxhbmd1YWdlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLm1hcFZlbmRvcnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ieVB1cnBvc2VWZW5kb3JNYXAgPSB7fSwgdGhpcy5ieVNwZWNpYWxQdXJwb3NlVmVuZG9yTWFwID0ge30sIHRoaXMuYnlGZWF0dXJlVmVuZG9yTWFwID0ge30sIHRoaXMuYnlTcGVjaWFsRmVhdHVyZVZlbmRvck1hcCA9IHt9LCBPYmplY3Qua2V5cyh0aGlzLnB1cnBvc2VzKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVB1cnBvc2VWZW5kb3JNYXBbZV0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZ0ludDogbmV3IFNldCgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50OiBuZXcgU2V0KCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsZXhpYmxlOiBuZXcgU2V0KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5rZXlzKHRoaXMuc3BlY2lhbFB1cnBvc2VzKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVNwZWNpYWxQdXJwb3NlVmVuZG9yTWFwW2VdID0gbmV3IFNldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5rZXlzKHRoaXMuZmVhdHVyZXMpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmJ5RmVhdHVyZVZlbmRvck1hcFtlXSA9IG5ldyBTZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3Qua2V5cyh0aGlzLnNwZWNpYWxGZWF0dXJlcykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuYnlTcGVjaWFsRmVhdHVyZVZlbmRvck1hcFtlXSA9IG5ldyBTZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBBcnJheS5pc0FycmF5KGUpIHx8IChlID0gT2JqZWN0LmtleXModGhpcy5mdWxsVmVuZG9yTGlzdCkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICtlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCB0aGlzLnZlbmRvcklkcyA9IG5ldyBTZXQoZSksIHRoaXMudmVuZG9yc18gPSBlLnJlZHVjZShmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC52ZW5kb3JzX1snJyArIG5dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByICYmIHZvaWQgMCA9PT0gci5kZWxldGVkRGF0ZSAmJiAoci5wdXJwb3Nlcy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuYnlQdXJwb3NlVmVuZG9yTWFwW2UgKyAnJ10uY29uc2VudC5hZGQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIuc3BlY2lhbFB1cnBvc2VzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVNwZWNpYWxQdXJwb3NlVmVuZG9yTWFwW2UgKyAnJ10uYWRkKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLmxlZ0ludFB1cnBvc2VzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVB1cnBvc2VWZW5kb3JNYXBbZSArICcnXS5sZWdJbnQuYWRkKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLmZsZXhpYmxlUHVycG9zZXMgJiYgci5mbGV4aWJsZVB1cnBvc2VzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVB1cnBvc2VWZW5kb3JNYXBbZSArICcnXS5mbGV4aWJsZS5hZGQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIuZmVhdHVyZXMuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmJ5RmVhdHVyZVZlbmRvck1hcFtlICsgJyddLmFkZChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgci5zcGVjaWFsRmVhdHVyZXMuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmJ5U3BlY2lhbEZlYXR1cmVWZW5kb3JNYXBbZSArICcnXS5hZGQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGVbbl0gPSByKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZ2V0RmlsdGVyZWRWZW5kb3JzID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdGhpcywgaSA9IGUuY2hhckF0KDApLnRvVXBwZXJDYXNlKCkgKyBlLnNsaWNlKDEpLCBzID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKCdwdXJwb3NlJyA9PT0gZSAmJiBuID8gdGhpc1snYnknICsgaSArICdWZW5kb3JNYXAnXVt0ICsgJyddW25dIDogdGhpc1snYnknICsgKHIgPyAnU3BlY2lhbCcgOiAnJykgKyBpICsgJ1ZlbmRvck1hcCddW3QgKyAnJ10pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzW2UgKyAnJ10gPSBvLnZlbmRvcnNbZSArICcnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBzOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRWZW5kb3JzV2l0aENvbnNlbnRQdXJwb3NlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldEZpbHRlcmVkVmVuZG9ycygncHVycG9zZScsIGUsICdjb25zZW50Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFZlbmRvcnNXaXRoTGVnSW50UHVycG9zZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5nZXRGaWx0ZXJlZFZlbmRvcnMoJ3B1cnBvc2UnLCBlLCAnbGVnSW50Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFZlbmRvcnNXaXRoRmxleGlibGVQdXJwb3NlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldEZpbHRlcmVkVmVuZG9ycygncHVycG9zZScsIGUsICdmbGV4aWJsZScpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRWZW5kb3JzV2l0aFNwZWNpYWxQdXJwb3NlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldEZpbHRlcmVkVmVuZG9ycygncHVycG9zZScsIGUsIHZvaWQgMCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRWZW5kb3JzV2l0aEZlYXR1cmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RmlsdGVyZWRWZW5kb3JzKCdmZWF0dXJlJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFZlbmRvcnNXaXRoU3BlY2lhbEZlYXR1cmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RmlsdGVyZWRWZW5kb3JzKCdmZWF0dXJlJywgZSwgdm9pZCAwLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ3ZlbmRvcnMnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy52ZW5kb3JzXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQucHJvdG90eXBlLm5hcnJvd1ZlbmRvcnNUbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm1hcFZlbmRvcnMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2lzUmVhZHknLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5pc1JlYWR5XzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQucHJvdG90eXBlLmNsb25lID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB0KHRoaXMuZ2V0SnNvbigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5pc0luc3RhbmNlT2YgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnID09IHR5cGVvZiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGUubmFycm93VmVuZG9yc1RvOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LkxBTkdVQUdFX0NBQ0hFID0gbmV3IE1hcCgpLCB0LkNBQ0hFID0gbmV3IE1hcCgpLCB0LkxBVEVTVF9DQUNIRV9LRVkgPSAwLCB0LkRFRkFVTFRfTEFOR1VBR0UgPSAnRU4nLCB0LmNvbnNlbnRMYW5ndWFnZXMgPSBuZXcgYy5Db25zZW50TGFuZ3VhZ2VzKCksIHQubGF0ZXN0RmlsZW5hbWUgPSAndmVuZG9yLWxpc3QuanNvbicsIHQudmVyc2lvbmVkRmlsZW5hbWUgPSAnYXJjaGl2ZXMvdmVuZG9yLWxpc3QtdltWRVJTSU9OXS5qc29uJywgdC5sYW5ndWFnZUZpbGVuYW1lID0gJ3B1cnBvc2VzLVtMQU5HXS5qc29uJywgdDsKICAgICAgICAgICAgICAgICAgICB9KHMuQ2xvbmVhYmxlKTsKICAgICAgICAgICAgICAgIHQuR1ZMID0gZjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJzQ2FsbCA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiAobywgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF8zNDZkMjA4ZTRhYTc2MGUwID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JyksICRfX19vbGRfMWJlMmIyZDM3ZWZmM2Y1YiA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8zNDZkMjA4ZTRhYTc2MGUwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja181YTg0ZTE5YjIxMjJiYTk2LlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMWJlMmIyZDM3ZWZmM2Y1YikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfNWE4NGUxOWIyMTIyYmE5Ni5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gbmV3IFhNTEh0dHBSZXF1ZXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMud2l0aENyZWRlbnRpYWxzID0gbiwgcy5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF9jNmIyZjBiY2Q4MTNiZTA1ID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2M2YjJmMGJjZDgxM2JlMDUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzVhODRlMTliMjEyMmJhOTYuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocy5yZWFkeVN0YXRlID09IFhNTEh0dHBSZXF1ZXN0LkRPTkUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocy5zdGF0dXMgPj0gMjAwICYmIHMuc3RhdHVzIDwgMzAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBzLnJlc3BvbnNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBKU09OLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShuZXcgRXJyb3IoJ0hUVFAgU3RhdHVzOiAnICsgcy5zdGF0dXMgKyAnIHJlc3BvbnNlIHR5cGU6ICcgKyBzLnJlc3BvbnNlVHlwZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYzZiMmYwYmNkODEzYmUwNSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX29sZF9jNmIyZjBiY2Q4MTNiZTA1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBzLmFkZEV2ZW50TGlzdGVuZXIoJ2Vycm9yJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShuZXcgRXJyb3IoJ2Vycm9yJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgcy5hZGRFdmVudExpc3RlbmVyKCdhYm9ydCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkobmV3IEVycm9yKCdhYm9ydGVkJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbnVsbCA9PT0gdCA/IHMub3BlbignR0VUJywgZSwgITApIDogcy5vcGVuKCdQT1NUJywgZSwgITApLCBzLnJlc3BvbnNlVHlwZSA9ICdqc29uJywgcy50aW1lb3V0ID0gciwgcy5vbnRpbWVvdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKG5ldyBFcnJvcignVGltZW91dCAnICsgciArICdtcyAnICsgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBzLnNlbmQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8zNDZkMjA4ZTRhYTc2MGUwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzM0NmQyMDhlNGFhNzYwZTApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8xYmUyYjJkMzdlZmYzZjViKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzFiZTJiMmQzN2VmZjNmNWIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5wb3N0ID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PT0gbiAmJiAobiA9ICExKSwgdm9pZCAwID09PSByICYmIChyID0gMCksIHRoaXMuYWJzQ2FsbChlLCBKU09OLnN0cmluZ2lmeSh0KSwgbiwgcik7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5mZXRjaCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IHQgJiYgKHQgPSAhMSksIHZvaWQgMCA9PT0gbiAmJiAobiA9IDApLCB0aGlzLmFic0NhbGwoZSwgbnVsbCwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuSnNvbiA9IHI7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBuKDMwKSwgaSA9IG4oMTQpLCBzID0gbigxMzApLCBhID0gbigxNSksIHUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5jYWxsKHRoaXMpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5pc1NlcnZpY2VTcGVjaWZpY18gPSAhMSwgbi5zdXBwb3J0T09CXyA9ICEwLCBuLnVzZU5vblN0YW5kYXJkU3RhY2tzXyA9ICExLCBuLnB1cnBvc2VPbmVUcmVhdG1lbnRfID0gITEsIG4ucHVibGlzaGVyQ291bnRyeUNvZGVfID0gJ0FBJywgbi52ZXJzaW9uXyA9IDIsIG4uY29uc2VudFNjcmVlbl8gPSAwLCBuLnBvbGljeVZlcnNpb25fID0gMiwgbi5jb25zZW50TGFuZ3VhZ2VfID0gJ0VOJywgbi5jbXBJZF8gPSAwLCBuLmNtcFZlcnNpb25fID0gMCwgbi52ZW5kb3JMaXN0VmVyc2lvbl8gPSAwLCBuLm51bUN1c3RvbVB1cnBvc2VzXyA9IDAsIG4uc3BlY2lhbEZlYXR1cmVPcHRpbnMgPSBuZXcgYS5WZWN0b3IoKSwgbi5wdXJwb3NlQ29uc2VudHMgPSBuZXcgYS5WZWN0b3IoKSwgbi5wdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cyA9IG5ldyBhLlZlY3RvcigpLCBuLnB1Ymxpc2hlckNvbnNlbnRzID0gbmV3IGEuVmVjdG9yKCksIG4ucHVibGlzaGVyTGVnaXRpbWF0ZUludGVyZXN0cyA9IG5ldyBhLlZlY3RvcigpLCBuLnB1Ymxpc2hlckN1c3RvbUNvbnNlbnRzID0gbmV3IGEuVmVjdG9yKCksIG4ucHVibGlzaGVyQ3VzdG9tTGVnaXRpbWF0ZUludGVyZXN0cyA9IG5ldyBhLlZlY3RvcigpLCBuLnZlbmRvckNvbnNlbnRzID0gbmV3IGEuVmVjdG9yKCksIG4udmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cyA9IG5ldyBhLlZlY3RvcigpLCBuLnZlbmRvcnNEaXNjbG9zZWQgPSBuZXcgYS5WZWN0b3IoKSwgbi52ZW5kb3JzQWxsb3dlZCA9IG5ldyBhLlZlY3RvcigpLCBuLnB1Ymxpc2hlclJlc3RyaWN0aW9ucyA9IG5ldyBhLlB1cnBvc2VSZXN0cmljdGlvblZlY3RvcigpLCB0ICYmIChuLmd2bCA9IHQpLCBuLmNyZWF0ZWQgPSBuZXcgRGF0ZSgpLCBuLnVwZGF0ZWQoKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAnZ3ZsJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ3ZsXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5HVkwuaXNJbnN0YW5jZU9mKGUpIHx8IChlID0gbmV3IHMuR1ZMKGUpKSwgdGhpcy5ndmxfID0gZSwgdGhpcy5wdWJsaXNoZXJSZXN0cmljdGlvbnMuZ3ZsID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2NtcElkJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY21wSWRfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShOdW1iZXIuaXNJbnRlZ2VyKCtlKSAmJiBlID4gMSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBpLlRDTW9kZWxFcnJvcignY21wSWQnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNtcElkXyA9ICtlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAnY21wVmVyc2lvbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNtcFZlcnNpb25fOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShOdW1iZXIuaXNJbnRlZ2VyKCtlKSAmJiBlID4gLTEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgaS5UQ01vZGVsRXJyb3IoJ2NtcFZlcnNpb24nLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNtcFZlcnNpb25fID0gK2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdjb25zZW50U2NyZWVuJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29uc2VudFNjcmVlbl87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKE51bWJlci5pc0ludGVnZXIoK2UpICYmIGUgPiAtMSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBpLlRDTW9kZWxFcnJvcignY29uc2VudFNjcmVlbicsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc2VudFNjcmVlbl8gPSArZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2NvbnNlbnRMYW5ndWFnZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbnNlbnRMYW5ndWFnZV87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc2VudExhbmd1YWdlXyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdwdWJsaXNoZXJDb3VudHJ5Q29kZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnB1Ymxpc2hlckNvdW50cnlDb2RlXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEvXihbQS16XSl7Mn0kLy50ZXN0KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgaS5UQ01vZGVsRXJyb3IoJ3B1Ymxpc2hlckNvdW50cnlDb2RlJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdWJsaXNoZXJDb3VudHJ5Q29kZV8gPSBlLnRvVXBwZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICd2ZW5kb3JMaXN0VmVyc2lvbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmd2bCA/IHRoaXMuZ3ZsLnZlbmRvckxpc3RWZXJzaW9uIDogdGhpcy52ZW5kb3JMaXN0VmVyc2lvbl87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoZSA9ICtlID4+IDApIDwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuVENNb2RlbEVycm9yKCd2ZW5kb3JMaXN0VmVyc2lvbicsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmVuZG9yTGlzdFZlcnNpb25fID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ3BvbGljeVZlcnNpb24nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5ndmwgPyB0aGlzLmd2bC50Y2ZQb2xpY3lWZXJzaW9uIDogdGhpcy5wb2xpY3lWZXJzaW9uXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMucG9saWN5VmVyc2lvbl8gPSBwYXJzZUludChlLCAxMCksIHRoaXMucG9saWN5VmVyc2lvbl8gPCAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgaS5UQ01vZGVsRXJyb3IoJ3BvbGljeVZlcnNpb24nLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ3ZlcnNpb24nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy52ZXJzaW9uXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52ZXJzaW9uXyA9IHBhcnNlSW50KGUsIDEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2lzU2VydmljZVNwZWNpZmljJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaXNTZXJ2aWNlU3BlY2lmaWNfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmlzU2VydmljZVNwZWNpZmljXyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICd1c2VOb25TdGFuZGFyZFN0YWNrcycsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnVzZU5vblN0YW5kYXJkU3RhY2tzXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy51c2VOb25TdGFuZGFyZFN0YWNrc18gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAnc3VwcG9ydE9PQicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN1cHBvcnRPT0JfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN1cHBvcnRPT0JfID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ3B1cnBvc2VPbmVUcmVhdG1lbnQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wdXJwb3NlT25lVHJlYXRtZW50XzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdXJwb3NlT25lVHJlYXRtZW50XyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0LnByb3RvdHlwZS5zZXRBbGxWZW5kb3JDb25zZW50cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmVuZG9yQ29uc2VudHMuc2V0KHRoaXMuZ3ZsLnZlbmRvcnMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS51bnNldEFsbFZlbmRvckNvbnNlbnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52ZW5kb3JDb25zZW50cy5lbXB0eSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5zZXRBbGxWZW5kb3JzRGlzY2xvc2VkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52ZW5kb3JzRGlzY2xvc2VkLnNldCh0aGlzLmd2bC52ZW5kb3JzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUudW5zZXRBbGxWZW5kb3JzRGlzY2xvc2VkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52ZW5kb3JzRGlzY2xvc2VkLmVtcHR5KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnNldEFsbFZlbmRvcnNBbGxvd2VkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52ZW5kb3JzQWxsb3dlZC5zZXQodGhpcy5ndmwudmVuZG9ycyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnVuc2V0QWxsVmVuZG9yc0FsbG93ZWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZlbmRvcnNBbGxvd2VkLmVtcHR5KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnNldEFsbFZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMuc2V0KHRoaXMuZ3ZsLnZlbmRvcnMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS51bnNldEFsbFZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMuZW1wdHkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuc2V0QWxsUHVycG9zZUNvbnNlbnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdXJwb3NlQ29uc2VudHMuc2V0KHRoaXMuZ3ZsLnB1cnBvc2VzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUudW5zZXRBbGxQdXJwb3NlQ29uc2VudHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnB1cnBvc2VDb25zZW50cy5lbXB0eSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5zZXRBbGxQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMuc2V0KHRoaXMuZ3ZsLnB1cnBvc2VzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUudW5zZXRBbGxQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMuZW1wdHkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuc2V0QWxsU3BlY2lhbEZlYXR1cmVPcHRpbnMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNwZWNpYWxGZWF0dXJlT3B0aW5zLnNldCh0aGlzLmd2bC5zcGVjaWFsRmVhdHVyZXMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS51bnNldEFsbFNwZWNpYWxGZWF0dXJlT3B0aW5zID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zcGVjaWFsRmVhdHVyZU9wdGlucy5lbXB0eSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5zZXRBbGwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNldEFsbFZlbmRvckNvbnNlbnRzKCksIHRoaXMuc2V0QWxsUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMoKSwgdGhpcy5zZXRBbGxTcGVjaWFsRmVhdHVyZU9wdGlucygpLCB0aGlzLnNldEFsbFB1cnBvc2VDb25zZW50cygpLCB0aGlzLnNldEFsbFZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUudW5zZXRBbGwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnVuc2V0QWxsVmVuZG9yQ29uc2VudHMoKSwgdGhpcy51bnNldEFsbFB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzKCksIHRoaXMudW5zZXRBbGxTcGVjaWFsRmVhdHVyZU9wdGlucygpLCB0aGlzLnVuc2V0QWxsUHVycG9zZUNvbnNlbnRzKCksIHRoaXMudW5zZXRBbGxWZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ251bUN1c3RvbVB1cnBvc2VzJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLm51bUN1c3RvbVB1cnBvc2VzXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT0gdHlwZW9mIHRoaXMuY3VzdG9tUHVycG9zZXMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3Qua2V5cyh0aGlzLmN1c3RvbVB1cnBvc2VzKS5zb3J0KGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gK2UgLSArdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBwYXJzZUludCh0LnBvcCgpLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5udW1DdXN0b21QdXJwb3Nlc18gPSBwYXJzZUludChlLCAxMCksIHRoaXMubnVtQ3VzdG9tUHVycG9zZXNfIDwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuVENNb2RlbEVycm9yKCdudW1DdXN0b21QdXJwb3NlcycsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5wcm90b3R5cGUudXBkYXRlZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubGFzdFVwZGF0ZWQgPSBuZXcgRGF0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmNvbnNlbnRMYW5ndWFnZXMgPSBzLkdWTC5jb25zZW50TGFuZ3VhZ2VzLCB0OwogICAgICAgICAgICAgICAgICAgIH0oby5DbG9uZWFibGUpOwogICAgICAgICAgICAgICAgdC5UQ01vZGVsID0gdTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IFsKICAgICAgICAgICAgICAgICAgICAnZW4nLAogICAgICAgICAgICAgICAgICAgICdmcicsCiAgICAgICAgICAgICAgICAgICAgJ2RlJywKICAgICAgICAgICAgICAgICAgICAnaXQnLAogICAgICAgICAgICAgICAgICAgICdlcycsCiAgICAgICAgICAgICAgICAgICAgJ2RhJywKICAgICAgICAgICAgICAgICAgICAnbmwnLAogICAgICAgICAgICAgICAgICAgICdlbCcsCiAgICAgICAgICAgICAgICAgICAgJ2h1JywKICAgICAgICAgICAgICAgICAgICAncHQnLAogICAgICAgICAgICAgICAgICAgICdybycsCiAgICAgICAgICAgICAgICAgICAgJ2ZpJywKICAgICAgICAgICAgICAgICAgICAncGwnLAogICAgICAgICAgICAgICAgICAgICdzaycsCiAgICAgICAgICAgICAgICAgICAgJ3N2JywKICAgICAgICAgICAgICAgICAgICAnbm8nLAogICAgICAgICAgICAgICAgICAgICdydScsCiAgICAgICAgICAgICAgICAgICAgJ2JnJywKICAgICAgICAgICAgICAgICAgICAnY2EnLAogICAgICAgICAgICAgICAgICAgICdjcycsCiAgICAgICAgICAgICAgICAgICAgJ2V0JywKICAgICAgICAgICAgICAgICAgICAnaHInLAogICAgICAgICAgICAgICAgICAgICdsdCcsCiAgICAgICAgICAgICAgICAgICAgJ2x2JywKICAgICAgICAgICAgICAgICAgICAnbXQnLAogICAgICAgICAgICAgICAgICAgICdzbCcsCiAgICAgICAgICAgICAgICAgICAgJ3RyJywKICAgICAgICAgICAgICAgICAgICAnemgnCiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gbmV3IEFycmF5KGFyZ3VtZW50cy5sZW5ndGgpLCByID0gMDsgciA8IG4ubGVuZ3RoOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3JdID0gYXJndW1lbnRzW3JdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNik7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW5jb2RlVVJJQ29tcG9uZW50KGUpLnJlcGxhY2UoLyU0MC9naSwgJ0AnKS5yZXBsYWNlKC8lM0EvZ2ksICc6JykucmVwbGFjZSgvJTI0L2csICckJykucmVwbGFjZSgvJTJDL2dpLCAnLCcpLnJlcGxhY2UoLyUyMC9nLCAnKycpLnJlcGxhY2UoLyU1Qi9naSwgJ1snKS5yZXBsYWNlKC8lNUQvZ2ksICddJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIGlmICghdCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBuKHQpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHIuaXNVUkxTZWFyY2hQYXJhbXModCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSB0LnRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIHIuZm9yRWFjaCh0LCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gZSAmJiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGUgJiYgKHIuaXNBcnJheShlKSA/IHQgKz0gJ1tdJyA6IGUgPSBbZV0sIHIuZm9yRWFjaChlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaXNEYXRlKGUpID8gZSA9IGUudG9JU09TdHJpbmcoKSA6IHIuaXNPYmplY3QoZSkgJiYgKGUgPSBKU09OLnN0cmluZ2lmeShlKSksIHMucHVzaChvKHQpICsgJz0nICsgbyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpID0gcy5qb2luKCcmJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5pbmRleE9mKCcjJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIC0xICE9PSBhICYmIChlID0gZS5zbGljZSgwLCBhKSksIGUgKz0gKC0xID09PSBlLmluZGV4T2YoJz8nKSA/ICc/JyA6ICcmJykgKyBpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFlIHx8ICFlLl9fQ0FOQ0VMX18pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIG8gPSBuKDI5MyksIGkgPSB7ICdDb250ZW50LVR5cGUnOiAnYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkJyB9OwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAhci5pc1VuZGVmaW5lZChlKSAmJiByLmlzVW5kZWZpbmVkKGVbJ0NvbnRlbnQtVHlwZSddKSAmJiAoZVsnQ29udGVudC1UeXBlJ10gPSB0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGFkYXB0ZXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfZTFkNTdhYWRkNWVjNmViNSA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9lMWQ1N2FhZGQ1ZWM2ZWI1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja181YTg0ZTE5YjIxMjJiYTk2LlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBYTUxIdHRwUmVxdWVzdCB8fCAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIHQgJiYgJ1tvYmplY3QgcHJvY2Vzc10nID09PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwodCkpICYmIChlID0gbigxNDIpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2UxZDU3YWFkZDVlYzZlYjUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfZTFkNTdhYWRkNWVjNmViNSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KCksCiAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybVJlcXVlc3Q6IFtmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKHQsICdBY2NlcHQnKSwgbyh0LCAnQ29udGVudC1UeXBlJyksIHIuaXNGb3JtRGF0YShlKSB8fCByLmlzQXJyYXlCdWZmZXIoZSkgfHwgci5pc0J1ZmZlcihlKSB8fCByLmlzU3RyZWFtKGUpIHx8IHIuaXNGaWxlKGUpIHx8IHIuaXNCbG9iKGUpID8gZSA6IHIuaXNBcnJheUJ1ZmZlclZpZXcoZSkgPyBlLmJ1ZmZlciA6IHIuaXNVUkxTZWFyY2hQYXJhbXMoZSkgPyAocyh0LCAnYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkO2NoYXJzZXQ9dXRmLTgnKSwgZS50b1N0cmluZygpKSA6IHIuaXNPYmplY3QoZSkgPyAocyh0LCAnYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PXV0Zi04JyksIEpTT04uc3RyaW5naWZ5KGUpKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtUmVzcG9uc2U6IFtmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gSlNPTi5wYXJzZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgeHNyZkNvb2tpZU5hbWU6ICdYU1JGLVRPS0VOJywKICAgICAgICAgICAgICAgICAgICAgICAgeHNyZkhlYWRlck5hbWU6ICdYLVhTUkYtVE9LRU4nLAogICAgICAgICAgICAgICAgICAgICAgICBtYXhDb250ZW50TGVuZ3RoOiAtMSwKICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRhdGVTdGF0dXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA+PSAyMDAgJiYgZSA8IDMwMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogeyBjb21tb246IHsgQWNjZXB0OiAnYXBwbGljYXRpb24vanNvbiwgdGV4dC9wbGFpbiwgKi8qJyB9IH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHIuZm9yRWFjaChbCiAgICAgICAgICAgICAgICAgICAgICAgICdkZWxldGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnZ2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ2hlYWQnCiAgICAgICAgICAgICAgICAgICAgXSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYS5oZWFkZXJzW2VdID0ge307CiAgICAgICAgICAgICAgICAgICAgfSksIHIuZm9yRWFjaChbCiAgICAgICAgICAgICAgICAgICAgICAgICdwb3N0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ3B1dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdwYXRjaCcKICAgICAgICAgICAgICAgICAgICBdLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBhLmhlYWRlcnNbZV0gPSByLm1lcmdlKGkpOwogICAgICAgICAgICAgICAgICAgIH0pLCBlLmV4cG9ydHMgPSBhOwogICAgICAgICAgICAgICAgfS5jYWxsKHRoaXMsIG4oMjkyKSkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgbyA9IG4oMjk0KSwgaSA9IG4oMTM5KSwgcyA9IG4oMjk2KSwgYSA9IG4oMjk5KSwgdSA9IG4oMzAwKSwgYyA9IG4oMTQzKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKGZ1bmN0aW9uICh0LCBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfODJiMTEzYThjMTU0Mjc3MiA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpLCAkX19fb2xkX2YwNjE4YTc3YWY5NTk1NTIgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzgyYjExM2E4YzE1NDI3NzIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfNWE4NGUxOWIyMTIyYmE5Ni5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfZjA2MThhNzdhZjk1OTU1MikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja181YTg0ZTE5YjIxMjJiYTk2LlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gZS5kYXRhLCBwID0gZS5oZWFkZXJzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaXNGb3JtRGF0YShsKSAmJiBkZWxldGUgcFsnQ29udGVudC1UeXBlJ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5hdXRoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZS5hdXRoLnVzZXJuYW1lIHx8ICcnLCB2ID0gZS5hdXRoLnBhc3N3b3JkIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLkF1dGhvcml6YXRpb24gPSAnQmFzaWMgJyArIGJ0b2EoaCArICc6JyArIHYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IHMoZS5iYXNlVVJMLCBlLnVybCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQub3BlbihlLm1ldGhvZC50b1VwcGVyQ2FzZSgpLCBpKHksIGUucGFyYW1zLCBlLnBhcmFtc1NlcmlhbGl6ZXIpLCAhMCksIGQudGltZW91dCA9IGUudGltZW91dCwgZC5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiA0ID09PSBkLnJlYWR5U3RhdGUgJiYgKDAgIT09IGQuc3RhdHVzIHx8IGQucmVzcG9uc2VVUkwgJiYgMCA9PT0gZC5yZXNwb25zZVVSTC5pbmRleE9mKCdmaWxlOicpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJ2dldEFsbFJlc3BvbnNlSGVhZGVycycgaW4gZCA/IGEoZC5nZXRBbGxSZXNwb25zZUhlYWRlcnMoKSkgOiBudWxsLCByID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogZS5yZXNwb25zZVR5cGUgJiYgJ3RleHQnICE9PSBlLnJlc3BvbnNlVHlwZSA/IGQucmVzcG9uc2UgOiBkLnJlc3BvbnNlVGV4dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogZC5zdGF0dXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXNUZXh0OiBkLnN0YXR1c1RleHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8odCwgZiwgciksIGQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkLm9uYWJvcnQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkICYmIChmKGMoJ1JlcXVlc3QgYWJvcnRlZCcsIGUsICdFQ09OTkFCT1JURUQnLCBkKSksIGQgPSBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZC5vbmVycm9yID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZihjKCdOZXR3b3JrIEVycm9yJywgZSwgbnVsbCwgZCkpLCBkID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZC5vbnRpbWVvdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICd0aW1lb3V0IG9mICcgKyBlLnRpbWVvdXQgKyAnbXMgZXhjZWVkZWQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS50aW1lb3V0RXJyb3JNZXNzYWdlICYmICh0ID0gZS50aW1lb3V0RXJyb3JNZXNzYWdlKSwgZihjKHQsIGUsICdFQ09OTkFCT1JURUQnLCBkKSksIGQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByLmlzU3RhbmRhcmRCcm93c2VyRW52KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBuKDMwMSksIG0gPSAoZS53aXRoQ3JlZGVudGlhbHMgfHwgdSh5KSkgJiYgZS54c3JmQ29va2llTmFtZSA/IGcucmVhZChlLnhzcmZDb29raWVOYW1lKSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbSAmJiAocFtlLnhzcmZIZWFkZXJOYW1lXSA9IG0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3NldFJlcXVlc3RIZWFkZXInIGluIGQgJiYgci5mb3JFYWNoKHAsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyA9PT0gdHlwZW9mIGwgJiYgJ2NvbnRlbnQtdHlwZScgPT09IHQudG9Mb3dlckNhc2UoKSA/IGRlbGV0ZSBwW3RdIDogZC5zZXRSZXF1ZXN0SGVhZGVyKHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgci5pc1VuZGVmaW5lZChlLndpdGhDcmVkZW50aWFscykgfHwgKGQud2l0aENyZWRlbnRpYWxzID0gISFlLndpdGhDcmVkZW50aWFscyksIGUucmVzcG9uc2VUeXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5yZXNwb25zZVR5cGUgPSBlLnJlc3BvbnNlVHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdqc29uJyAhPT0gZS5yZXNwb25zZVR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT09IHR5cGVvZiBlLm9uRG93bmxvYWRQcm9ncmVzcyAmJiBkLmFkZEV2ZW50TGlzdGVuZXIoJ3Byb2dyZXNzJywgZS5vbkRvd25sb2FkUHJvZ3Jlc3MpLCAnZnVuY3Rpb24nID09PSB0eXBlb2YgZS5vblVwbG9hZFByb2dyZXNzICYmIGQudXBsb2FkICYmIGQudXBsb2FkLmFkZEV2ZW50TGlzdGVuZXIoJ3Byb2dyZXNzJywgZS5vblVwbG9hZFByb2dyZXNzKSwgZS5jYW5jZWxUb2tlbiAmJiBlLmNhbmNlbFRva2VuLnByb21pc2UudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkICYmIChkLmFib3J0KCksIGYoZSksIGQgPSBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdm9pZCAwID09PSBsICYmIChsID0gbnVsbCksIGQuc2VuZChsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzgyYjExM2E4YzE1NDI3NzIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX29sZF84MmIxMTNhOGMxNTQyNzcyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9mMDYxOGE3N2FmOTU5NTUyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfZjA2MThhNzdhZjk1OTU1MikpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI5NSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbiwgbywgaSkgewogICAgICAgICAgICAgICAgICAgIHZhciBzID0gbmV3IEVycm9yKGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByKHMsIHQsIG4sIG8sIGkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHQgPSB0IHx8IHt9OwogICAgICAgICAgICAgICAgICAgIHZhciBuID0ge30sIG8gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXJsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtZXRob2QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BhcmFtcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGF0YScKICAgICAgICAgICAgICAgICAgICAgICAgXSwgaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdoZWFkZXJzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhdXRoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcm94eScKICAgICAgICAgICAgICAgICAgICAgICAgXSwgcyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdiYXNlVVJMJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1cmwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RyYW5zZm9ybVJlcXVlc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RyYW5zZm9ybVJlc3BvbnNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwYXJhbXNTZXJpYWxpemVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0aW1lb3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3aXRoQ3JlZGVudGlhbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FkYXB0ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Jlc3BvbnNlVHlwZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAneHNyZkNvb2tpZU5hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3hzcmZIZWFkZXJOYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvblVwbG9hZFByb2dyZXNzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvbkRvd25sb2FkUHJvZ3Jlc3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ21heENvbnRlbnRMZW5ndGgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZhbGlkYXRlU3RhdHVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtYXhSZWRpcmVjdHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2h0dHBBZ2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaHR0cHNBZ2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2FuY2VsVG9rZW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NvY2tldFBhdGgnCiAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgci5mb3JFYWNoKG8sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnICE9PSB0eXBlb2YgdFtlXSAmJiAobltlXSA9IHRbZV0pOwogICAgICAgICAgICAgICAgICAgIH0pLCByLmZvckVhY2goaSwgZnVuY3Rpb24gKG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgci5pc09iamVjdCh0W29dKSA/IG5bb10gPSByLmRlZXBNZXJnZShlW29dLCB0W29dKSA6ICd1bmRlZmluZWQnICE9PSB0eXBlb2YgdFtvXSA/IG5bb10gPSB0W29dIDogci5pc09iamVjdChlW29dKSA/IG5bb10gPSByLmRlZXBNZXJnZShlW29dKSA6ICd1bmRlZmluZWQnICE9PSB0eXBlb2YgZVtvXSAmJiAobltvXSA9IGVbb10pOwogICAgICAgICAgICAgICAgICAgIH0pLCByLmZvckVhY2gocywgZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiB0W3JdID8gbltyXSA9IHRbcl0gOiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGVbcl0gJiYgKG5bcl0gPSBlW3JdKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG8uY29uY2F0KGkpLmNvbmNhdChzKSwgdSA9IE9iamVjdC5rZXlzKHQpLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xID09PSBhLmluZGV4T2YoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByLmZvckVhY2godSwgZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiB0W3JdID8gbltyXSA9IHRbcl0gOiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGVbcl0gJiYgKG5bcl0gPSBlW3JdKTsKICAgICAgICAgICAgICAgICAgICB9KSwgbjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLm1lc3NhZ2UgPSBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgci5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdDYW5jZWwnICsgKHRoaXMubWVzc2FnZSA/ICc6ICcgKyB0aGlzLm1lc3NhZ2UgOiAnJyk7CiAgICAgICAgICAgICAgICB9LCByLnByb3RvdHlwZS5fX0NBTkNFTF9fID0gITAsIGUuZXhwb3J0cyA9IHI7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgfHwgKHRbbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCByKG4oMTEzKSksIHIobig1MSkpLCByKG4oNTMpKSwgcihuKDI2NSkpOwogICAgICAgICAgICAgICAgdmFyIG8gPSBuKDExNyk7CiAgICAgICAgICAgICAgICB0LkFQSV9LRVkgPSBvLkFQSV9LRVk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBuKDI4Nyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiBlKHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKHMsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFuW3NdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXRbc10pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkocywgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQ2Fubm90IGZpbmQgbW9kdWxlIFwnJyArIHMgKyAnXCcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gbltzXSA9IHsgZXhwb3J0czoge30gfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbc11bMF0uY2FsbCh1LmV4cG9ydHMsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8odFtzXVsxXVtlXSB8fCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHUsIHUuZXhwb3J0cywgZSwgdCwgbiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5bc10uZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9ICExLCBzID0gMDsgcyA8IHIubGVuZ3RoOyBzKyspCiAgICAgICAgICAgICAgICAgICAgICAgIG8ocltzXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICB9KHsKICAgICAgICAgICAgICAgICAgICAxOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKHIsIG8sIGksIHMsIGEsIHUsIGMsIGYsIGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBlKCdjcnlwdG8nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IChuID0gJ3Bhc3N0aHJvdWdoJyAhPT0gdC5hbGdvcml0aG0gPyBwLmNyZWF0ZUhhc2godC5hbGdvcml0aG0pIDogbmV3IGIoKSkud3JpdGUgJiYgKG4ud3JpdGUgPSBuLnVwZGF0ZSwgbi5lbmQgPSBuLnVwZGF0ZSksIG0odCwgbikuZGlzcGF0Y2goZSksIG4udXBkYXRlIHx8IG4uZW5kKCcnKSwgbi5kaWdlc3QpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uZGlnZXN0KCdidWZmZXInID09PSB0LmVuY29kaW5nID8gdm9pZCAwIDogdC5lbmNvZGluZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4ucmVhZCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdidWZmZXInICE9PSB0LmVuY29kaW5nID8gci50b1N0cmluZyh0LmVuY29kaW5nKSA6IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSwgdCA9IHkoZSwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobiA9IHQuZXhwb3J0cyA9IGQpLnNoYTEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuLmtleXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZChlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleGNsdWRlVmFsdWVzOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsZ29yaXRobTogJ3NoYTEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2Rpbmc6ICdoZXgnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4uTUQ1ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQoZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxnb3JpdGhtOiAnbWQ1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuY29kaW5nOiAnaGV4JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuLmtleXNNRDUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZChlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGdvcml0aG06ICdtZDUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2Rpbmc6ICdoZXgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhjbHVkZVZhbHVlczogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IHAuZ2V0SGFzaGVzID8gcC5nZXRIYXNoZXMoKS5zbGljZSgpIDogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2hhMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtZDUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLnB1c2goJ3Bhc3N0aHJvdWdoJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdidWZmZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaGV4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JpbmFyeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdiYXNlNjQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmFsZ29yaXRobSA9IHQuYWxnb3JpdGhtIHx8ICdzaGExJywgbi5lbmNvZGluZyA9IHQuZW5jb2RpbmcgfHwgJ2hleCcsIG4uZXhjbHVkZVZhbHVlcyA9ICEhdC5leGNsdWRlVmFsdWVzLCBuLmFsZ29yaXRobSA9IG4uYWxnb3JpdGhtLnRvTG93ZXJDYXNlKCksIG4uZW5jb2RpbmcgPSBuLmVuY29kaW5nLnRvTG93ZXJDYXNlKCksIG4uaWdub3JlVW5rbm93biA9ICEwID09PSB0Lmlnbm9yZVVua25vd24sIG4ucmVzcGVjdFR5cGUgPSAhMSAhPT0gdC5yZXNwZWN0VHlwZSwgbi5yZXNwZWN0RnVuY3Rpb25OYW1lcyA9ICExICE9PSB0LnJlc3BlY3RGdW5jdGlvbk5hbWVzLCBuLnJlc3BlY3RGdW5jdGlvblByb3BlcnRpZXMgPSAhMSAhPT0gdC5yZXNwZWN0RnVuY3Rpb25Qcm9wZXJ0aWVzLCBuLnVub3JkZXJlZEFycmF5cyA9ICEwID09PSB0LnVub3JkZXJlZEFycmF5cywgbi51bm9yZGVyZWRTZXRzID0gITEgIT09IHQudW5vcmRlcmVkU2V0cywgbi51bm9yZGVyZWRPYmplY3RzID0gITEgIT09IHQudW5vcmRlcmVkT2JqZWN0cywgbi5yZXBsYWNlciA9IHQucmVwbGFjZXIgfHwgdm9pZCAwLCBuLmV4Y2x1ZGVLZXlzID0gdC5leGNsdWRlS2V5cyB8fCB2b2lkIDAsIHZvaWQgMCA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignT2JqZWN0IGFyZ3VtZW50IHJlcXVpcmVkLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IGgubGVuZ3RoOyArK3IpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoW3JdLnRvTG93ZXJDYXNlKCkgPT09IG4uYWxnb3JpdGhtLnRvTG93ZXJDYXNlKCkgJiYgKG4uYWxnb3JpdGhtID0gaFtyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtMSA9PT0gaC5pbmRleE9mKG4uYWxnb3JpdGhtKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQWxnb3JpdGhtICInICsgbi5hbGdvcml0aG0gKyAnIiAgbm90IHN1cHBvcnRlZC4gc3VwcG9ydGVkIHZhbHVlczogJyArIGguam9pbignLCAnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtMSA9PT0gdi5pbmRleE9mKG4uZW5jb2RpbmcpICYmICdwYXNzdGhyb3VnaCcgIT09IG4uYWxnb3JpdGhtKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdFbmNvZGluZyAiJyArIG4uZW5jb2RpbmcgKyAnIiAgbm90IHN1cHBvcnRlZC4gc3VwcG9ydGVkIHZhbHVlczogJyArIHYuam9pbignLCAnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSAvXmZ1bmN0aW9uXHMrXHcqXHMqXChccypcKVxzKntccytcW25hdGl2ZSBjb2RlXF1ccyt9JC9pLmV4ZWMoRnVuY3Rpb24ucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBtKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC51cGRhdGUgPyB0LnVwZGF0ZShlLCAndXRmOCcpIDogdC53cml0ZShlLCAndXRmOCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gbiB8fCBbXSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2g6IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5yZXBsYWNlciAmJiAodCA9IGUucmVwbGFjZXIodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdHlwZW9mIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT09IHQgJiYgKG4gPSAnbnVsbCcpLCB0aGlzWydfJyArIG5dKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9vYmplY3Q6IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8sIHMgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwodCksIGEgPSAvXFtvYmplY3QgKC4qKVxdL2kuZXhlYyhzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IChhID0gYSA/IGFbMV0gOiAndW5rbm93bjpbJyArIHMgKyAnXScpLnRvTG93ZXJDYXNlKCksIDAgPD0gKG8gPSBuLmluZGV4T2YodCkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5kaXNwYXRjaCgnW0NJUkNVTEFSOicgKyBvICsgJ10nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5wdXNoKHQpLCB2b2lkIDAgIT09IGkgJiYgaS5pc0J1ZmZlciAmJiBpLmlzQnVmZmVyKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcignYnVmZmVyOicpLCByKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gYSB8fCAnZnVuY3Rpb24nID09PSBhIHx8ICdhc3luY2Z1bmN0aW9uJyA9PT0gYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IE9iamVjdC5rZXlzKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnVub3JkZXJlZE9iamVjdHMgJiYgKHUgPSB1LnNvcnQoKSksICExID09PSBlLnJlc3BlY3RUeXBlIHx8IGcodCkgfHwgdS5zcGxpY2UoMCwgMCwgJ3Byb3RvdHlwZScsICdfX3Byb3RvX18nLCAnY29uc3RydWN0b3InKSwgZS5leGNsdWRlS2V5cyAmJiAodSA9IHUuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWUuZXhjbHVkZUtleXModCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgcignb2JqZWN0OicgKyB1Lmxlbmd0aCArICc6Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5kaXNwYXRjaChuKSwgcignOicpLCBlLmV4Y2x1ZGVWYWx1ZXMgfHwgYy5kaXNwYXRjaCh0W25dKSwgcignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzWydfJyArIGFdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmlnbm9yZVVua25vd24pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcignWycgKyBhICsgJ10nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdVbmtub3duIG9iamVjdCB0eXBlICInICsgYSArICciJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbJ18nICsgYV0odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX2FycmF5OiBmdW5jdGlvbiAodCwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSB2b2lkIDAgIT09IG8gPyBvIDogITEgIT09IGUudW5vcmRlcmVkQXJyYXlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocignYXJyYXk6JyArIHQubGVuZ3RoICsgJzonKSwgIW8gfHwgdC5sZW5ndGggPD0gMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuZGlzcGF0Y2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gW10sIGEgPSB0Lm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuZXcgYigpLCBvID0gbi5zbGljZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0oZSwgciwgbykuZGlzcGF0Y2godCksIHMgPSBzLmNvbmNhdChvLnNsaWNlKG4ubGVuZ3RoKSksIHIucmVhZCgpLnRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gbi5jb25jYXQocyksIGEuc29ydCgpLCB0aGlzLl9hcnJheShhLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX2RhdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ2RhdGU6JyArIGUudG9KU09OKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9zeW1ib2w6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3N5bWJvbDonICsgZS50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfZXJyb3I6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ2Vycm9yOicgKyBlLnRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9ib29sZWFuOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCdib29sOicgKyBlLnRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9zdHJpbmc6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcignc3RyaW5nOicgKyBlLmxlbmd0aCArICc6JyksIHIoZS50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfZnVuY3Rpb246IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcignZm46JyksIGcodCkgPyB0aGlzLmRpc3BhdGNoKCdbbmF0aXZlXScpIDogdGhpcy5kaXNwYXRjaCh0LnRvU3RyaW5nKCkpLCAhMSAhPT0gZS5yZXNwZWN0RnVuY3Rpb25OYW1lcyAmJiB0aGlzLmRpc3BhdGNoKCdmdW5jdGlvbi1uYW1lOicgKyBTdHJpbmcodC5uYW1lKSksIGUucmVzcGVjdEZ1bmN0aW9uUHJvcGVydGllcyAmJiB0aGlzLl9vYmplY3QodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX251bWJlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcignbnVtYmVyOicgKyBlLnRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF94bWw6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3htbDonICsgZS50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfbnVsbDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCdOdWxsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3VuZGVmaW5lZDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCdVbmRlZmluZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfcmVnZXhwOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCdyZWdleDonICsgZS50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdWludDhhcnJheTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigndWludDhhcnJheTonKSwgdGhpcy5kaXNwYXRjaChBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3VpbnQ4Y2xhbXBlZGFycmF5OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCd1aW50OGNsYW1wZWRhcnJheTonKSwgdGhpcy5kaXNwYXRjaChBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX2ludDhhcnJheTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigndWludDhhcnJheTonKSwgdGhpcy5kaXNwYXRjaChBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3VpbnQxNmFycmF5OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCd1aW50MTZhcnJheTonKSwgdGhpcy5kaXNwYXRjaChBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX2ludDE2YXJyYXk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3VpbnQxNmFycmF5OicpLCB0aGlzLmRpc3BhdGNoKEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdWludDMyYXJyYXk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3VpbnQzMmFycmF5OicpLCB0aGlzLmRpc3BhdGNoKEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfaW50MzJhcnJheTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigndWludDMyYXJyYXk6JyksIHRoaXMuZGlzcGF0Y2goQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9mbG9hdDMyYXJyYXk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ2Zsb2F0MzJhcnJheTonKSwgdGhpcy5kaXNwYXRjaChBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX2Zsb2F0NjRhcnJheTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcignZmxvYXQ2NGFycmF5OicpLCB0aGlzLmRpc3BhdGNoKEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfYXJyYXlidWZmZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ2FycmF5YnVmZmVyOicpLCB0aGlzLmRpc3BhdGNoKG5ldyBVaW50OEFycmF5KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdXJsOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCd1cmw6JyArIGUudG9TdHJpbmcoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX21hcDogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKCdtYXA6Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBBcnJheS5mcm9tKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9hcnJheShuLCAhMSAhPT0gZS51bm9yZGVyZWRTZXRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc2V0OiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoJ3NldDonKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IEFycmF5LmZyb20odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2FycmF5KG4sICExICE9PSBlLnVub3JkZXJlZFNldHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9ibG9iOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuaWdub3JlVW5rbm93bikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ1tibG9iXScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdIYXNoaW5nIEJsb2Igb2JqZWN0cyBpcyBjdXJyZW50bHkgbm90IHN1cHBvcnRlZFxuKHNlZSBodHRwczovL2dpdGh1Yi5jb20vcHVsZW9zL29iamVjdC1oYXNoL2lzc3Vlcy8yNilcblVzZSAib3B0aW9ucy5yZXBsYWNlciIgb3IgIm9wdGlvbnMuaWdub3JlVW5rbm93biJcbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9kb213aW5kb3c6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcignZG9td2luZG93Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3Byb2Nlc3M6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigncHJvY2VzcycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF90aW1lcjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCd0aW1lcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9waXBlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3BpcGUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdGNwOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3RjcCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF91ZHA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigndWRwJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3R0eTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCd0dHknKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc3RhdHdhdGNoZXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcignc3RhdHdhdGNoZXInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc2VjdXJlY29udGV4dDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCdzZWN1cmVjb250ZXh0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX2Nvbm5lY3Rpb246IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcignY29ubmVjdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF96bGliOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3psaWInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfY29udGV4dDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCdjb250ZXh0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX25vZGVzY3JpcHQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcignbm9kZXNjcmlwdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9odHRwcGFyc2VyOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ2h0dHBwYXJzZXInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfZGF0YXZpZXc6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcignZGF0YXZpZXcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc2lnbmFsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3NpZ25hbCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9mc2V2ZW50OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ2ZzZXZlbnQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdGxzd3JhcDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCd0bHN3cmFwJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWY6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5idWYgKz0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5idWYgKz0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYnVmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLndyaXRlVG9TdHJlYW0gPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSBuICYmIChuID0gdCwgdCA9IHt9KSwgbSh0ID0geShlLCB0KSwgbikuZGlzcGF0Y2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0uY2FsbCh0aGlzLCBlKCdsWXBvSTInKSwgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHNlbGYgPyBzZWxmIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHdpbmRvdyA/IHdpbmRvdyA6IHt9LCBlKCdidWZmZXInKS5CdWZmZXIsIGFyZ3VtZW50c1szXSwgYXJndW1lbnRzWzRdLCBhcmd1bWVudHNbNV0sIGFyZ3VtZW50c1s2XSwgJy9mYWtlXzc5NGZjZjRkLmpzJywgJy8nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlcjogMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyeXB0bzogNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxZcG9JMjogMTAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgMjogWwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uIChlLCB0LCByLCBvLCBpLCBzLCBhLCB1LCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2YgVWludDhBcnJheSA/IFVpbnQ4QXJyYXkgOiBBcnJheSwgbiA9ICcrJy5jaGFyQ29kZUF0KDApLCByID0gJy8nLmNoYXJDb2RlQXQoMCksIG8gPSAnMCcuY2hhckNvZGVBdCgwKSwgaSA9ICdhJy5jaGFyQ29kZUF0KDApLCBzID0gJ0EnLmNoYXJDb2RlQXQoMCksIGEgPSAnLScuY2hhckNvZGVBdCgwKSwgdSA9ICdfJy5jaGFyQ29kZUF0KDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jaGFyQ29kZUF0KDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPT09IG4gfHwgdCA9PT0gYSA/IDYyIDogdCA9PT0gciB8fCB0ID09PSB1ID8gNjMgOiB0IDwgbyA/IC0xIDogdCA8IG8gKyAxMCA/IHQgLSBvICsgMjYgKyAyNiA6IHQgPCBzICsgMjYgPyB0IC0gcyA6IHQgPCBpICsgMjYgPyB0IC0gaSArIDI2IDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUudG9CeXRlQXJyYXkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8sIGksIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA8IGUubGVuZ3RoICUgNCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ludmFsaWQgc3RyaW5nLiBMZW5ndGggbXVzdCBiZSBhIG11bHRpcGxlIG9mIDQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gJz0nID09PSBlLmNoYXJBdChhIC0gMikgPyAyIDogJz0nID09PSBlLmNoYXJBdChhIC0gMSkgPyAxIDogMCwgcyA9IG5ldyB0KDMgKiBlLmxlbmd0aCAvIDQgLSBpKSwgciA9IDAgPCBpID8gZS5sZW5ndGggLSA0IDogZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzW3UrK10gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gMDsgbiA8IHI7IG4gKz0gNCwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmKCgxNjcxMTY4MCAmIChvID0gYyhlLmNoYXJBdChuKSkgPDwgMTggfCBjKGUuY2hhckF0KG4gKyAxKSkgPDwgMTIgfCBjKGUuY2hhckF0KG4gKyAyKSkgPDwgNiB8IGMoZS5jaGFyQXQobiArIDMpKSkpID4+IDE2KSwgZigoNjUyODAgJiBvKSA+PiA4KSwgZigyNTUgJiBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAyID09IGkgPyBmKDI1NSAmIChvID0gYyhlLmNoYXJBdChuKSkgPDwgMiB8IGMoZS5jaGFyQXQobiArIDEpKSA+PiA0KSkgOiAxID09IGkgJiYgKGYoKG8gPSBjKGUuY2hhckF0KG4pKSA8PCAxMCB8IGMoZS5jaGFyQXQobiArIDEpKSA8PCA0IHwgYyhlLmNoYXJBdChuICsgMikpID4+IDIpID4+IDggJiAyNTUpLCBmKDI1NSAmIG8pKSwgczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5mcm9tQnl0ZUFycmF5ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByLCBvLCBpID0gZS5sZW5ndGggJSAzLCBzID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky8nLmNoYXJBdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCA9IDAsIHIgPSBlLmxlbmd0aCAtIGk7IHQgPCByOyB0ICs9IDMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyArPSBhKChvID0gbiA9IChlW3RdIDw8IDE2KSArIChlW3QgKyAxXSA8PCA4KSArIGVbdCArIDJdKSA+PiAxOCAmIDYzKSArIGEobyA+PiAxMiAmIDYzKSArIGEobyA+PiA2ICYgNjMpICsgYSg2MyAmIG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyArPSBhKChuID0gZVtlLmxlbmd0aCAtIDFdKSA+PiAyKSwgcyArPSBhKG4gPDwgNCAmIDYzKSwgcyArPSAnPT0nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgKz0gYSgobiA9IChlW2UubGVuZ3RoIC0gMl0gPDwgOCkgKyBlW2UubGVuZ3RoIC0gMV0pID4+IDEwKSwgcyArPSBhKG4gPj4gNCAmIDYzKSwgcyArPSBhKG4gPDwgMiAmIDYzKSwgcyArPSAnPSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHZvaWQgMCA9PT0gbiA/IHRoaXMuYmFzZTY0anMgPSB7fSA6IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5jYWxsKHRoaXMsIGUoJ2xZcG9JMicpLCAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygc2VsZiA/IHNlbGYgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygd2luZG93ID8gd2luZG93IDoge30sIGUoJ2J1ZmZlcicpLkJ1ZmZlciwgYXJndW1lbnRzWzNdLCBhcmd1bWVudHNbNF0sIGFyZ3VtZW50c1s1XSwgYXJndW1lbnRzWzZdLCAnL25vZGVfbW9kdWxlcy9ndWxwLWJyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2Jhc2U2NC1qcy9saWIvYjY0LmpzJywgJy9ub2RlX21vZHVsZXMvZ3VscC1icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9iYXNlNjQtanMvbGliJykpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWZmZXI6IDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsWXBvSTI6IDEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIDM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChmdW5jdGlvbiAodCwgciwgbywgaSwgcywgYSwgdSwgYywgZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gZSgnYmFzZTY0LWpzJyksIHAgPSBlKCdpZWVlNzU0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKHRoaXMgaW5zdGFuY2VvZiBvKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgbyhlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIGksIHMsIGEsIHUsIGMgPSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdiYXNlNjQnID09PSB0ICYmICdzdHJpbmcnID09IGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSAociA9IGUpLnRyaW0gPyByLnRyaW0oKSA6IHIucmVwbGFjZSgvXlxzK3xccyskL2csICcnKTsgZS5sZW5ndGggJSA0ICE9IDA7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgKz0gJz0nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ251bWJlcicgPT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBQKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgnc3RyaW5nJyA9PSBjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IG8uYnl0ZUxlbmd0aChlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgIT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ZpcnN0IGFyZ3VtZW50IG5lZWRzIHRvIGJlIGEgbnVtYmVyLCBhcnJheSBvciBzdHJpbmcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gUChlLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8uX3VzZVR5cGVkQXJyYXlzID8gcyA9IG8uX2F1Z21lbnQobmV3IFVpbnQ4QXJyYXkoaSkpIDogKChzID0gdGhpcykubGVuZ3RoID0gaSwgcy5faXNCdWZmZXIgPSAhMCksIG8uX3VzZVR5cGVkQXJyYXlzICYmICdudW1iZXInID09IHR5cGVvZiBlLmJ5dGVMZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLl9zZXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKFQodSA9IGUpIHx8IG8uaXNCdWZmZXIodSkgfHwgdSAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgdSAmJiAnbnVtYmVyJyA9PSB0eXBlb2YgdS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgPSAwOyBhIDwgaTsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uaXNCdWZmZXIoZSkgPyBzW2FdID0gZS5yZWFkVUludDgoYSkgOiBzW2FdID0gZVthXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoJ3N0cmluZycgPT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMud3JpdGUoZSwgMCwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCdudW1iZXInID09IGMgJiYgIW8uX3VzZVR5cGVkQXJyYXlzICYmICFuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChhID0gMDsgYSA8IGk7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzW2FdID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5fY2hhcnNXcml0dGVuID0gTihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IFtdLCBuID0gMDsgbiA8IGUubGVuZ3RoOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKDI1NSAmIGUuY2hhckNvZGVBdChuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0KSwgZSwgbiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gTWF0aC5taW4oZS5sZW5ndGgsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gdDsgbyA8IG47IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShlW29dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHYoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByIHx8IChNKCdib29sZWFuJyA9PSB0eXBlb2YgbiwgJ21pc3Npbmcgb3IgaW52YWxpZCBlbmRpYW4nKSwgTShudWxsICE9IHQsICdtaXNzaW5nIG9mZnNldCcpLCBNKHQgKyAxIDwgZS5sZW5ndGgsICdUcnlpbmcgdG8gcmVhZCBiZXlvbmQgYnVmZmVyIGxlbmd0aCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8sIGkgPSBlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoaSA8PSB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID8gKG8gPSBlW3RdLCB0ICsgMSA8IGkgJiYgKG8gfD0gZVt0ICsgMV0gPDwgOCkpIDogKG8gPSBlW3RdIDw8IDgsIHQgKyAxIDwgaSAmJiAobyB8PSBlW3QgKyAxXSkpLCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciB8fCAoTSgnYm9vbGVhbicgPT0gdHlwZW9mIG4sICdtaXNzaW5nIG9yIGludmFsaWQgZW5kaWFuJyksIE0obnVsbCAhPSB0LCAnbWlzc2luZyBvZmZzZXQnKSwgTSh0ICsgMyA8IGUubGVuZ3RoLCAnVHJ5aW5nIHRvIHJlYWQgYmV5b25kIGJ1ZmZlciBsZW5ndGgnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvLCBpID0gZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGkgPD0gdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA/ICh0ICsgMiA8IGkgJiYgKG8gPSBlW3QgKyAyXSA8PCAxNiksIHQgKyAxIDwgaSAmJiAobyB8PSBlW3QgKyAxXSA8PCA4KSwgbyB8PSBlW3RdLCB0ICsgMyA8IGkgJiYgKG8gKz0gZVt0ICsgM10gPDwgMjQgPj4+IDApKSA6ICh0ICsgMSA8IGkgJiYgKG8gPSBlW3QgKyAxXSA8PCAxNiksIHQgKyAyIDwgaSAmJiAobyB8PSBlW3QgKyAyXSA8PCA4KSwgdCArIDMgPCBpICYmIChvIHw9IGVbdCArIDNdKSwgbyArPSBlW3RdIDw8IDI0ID4+PiAwKSwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyIHx8IChNKCdib29sZWFuJyA9PSB0eXBlb2YgbiwgJ21pc3Npbmcgb3IgaW52YWxpZCBlbmRpYW4nKSwgTShudWxsICE9IHQsICdtaXNzaW5nIG9mZnNldCcpLCBNKHQgKyAxIDwgZS5sZW5ndGgsICdUcnlpbmcgdG8gcmVhZCBiZXlvbmQgYnVmZmVyIGxlbmd0aCcpKSwgIShlLmxlbmd0aCA8PSB0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB2KGUsIHQsIG4sICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAzMjc2OCAmIG8gPyAtMSAqICg2NTUzNSAtIG8gKyAxKSA6IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbShlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyIHx8IChNKCdib29sZWFuJyA9PSB0eXBlb2YgbiwgJ21pc3Npbmcgb3IgaW52YWxpZCBlbmRpYW4nKSwgTShudWxsICE9IHQsICdtaXNzaW5nIG9mZnNldCcpLCBNKHQgKyAzIDwgZS5sZW5ndGgsICdUcnlpbmcgdG8gcmVhZCBiZXlvbmQgYnVmZmVyIGxlbmd0aCcpKSwgIShlLmxlbmd0aCA8PSB0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB5KGUsIHQsIG4sICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAyMTQ3NDgzNjQ4ICYgbyA/IC0xICogKDQyOTQ5NjcyOTUgLSBvICsgMSkgOiBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciB8fCAoTSgnYm9vbGVhbicgPT0gdHlwZW9mIG4sICdtaXNzaW5nIG9yIGludmFsaWQgZW5kaWFuJyksIE0odCArIDMgPCBlLmxlbmd0aCwgJ1RyeWluZyB0byByZWFkIGJleW9uZCBidWZmZXIgbGVuZ3RoJykpLCBwLnJlYWQoZSwgdCwgbiwgMjMsIDQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBFKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgfHwgKE0oJ2Jvb2xlYW4nID09IHR5cGVvZiBuLCAnbWlzc2luZyBvciBpbnZhbGlkIGVuZGlhbicpLCBNKHQgKyA3IDwgZS5sZW5ndGgsICdUcnlpbmcgdG8gcmVhZCBiZXlvbmQgYnVmZmVyIGxlbmd0aCcpKSwgcC5yZWFkKGUsIHQsIG4sIDUyLCA4KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQyhlLCB0LCBuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gfHwgKE0obnVsbCAhPSB0LCAnbWlzc2luZyB2YWx1ZScpLCBNKCdib29sZWFuJyA9PSB0eXBlb2YgciwgJ21pc3Npbmcgb3IgaW52YWxpZCBlbmRpYW4nKSwgTShudWxsICE9IG4sICdtaXNzaW5nIG9mZnNldCcpLCBNKG4gKyAxIDwgZS5sZW5ndGgsICd0cnlpbmcgdG8gd3JpdGUgYmV5b25kIGJ1ZmZlciBsZW5ndGgnKSwgVSh0LCA2NTUzNSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShpIDw9IG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgcyA9IDAsIGEgPSBNYXRoLm1pbihpIC0gbiwgMik7IHMgPCBhOyBzKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtuICsgc10gPSAodCAmIDI1NSA8PCA4ICogKHIgPyBzIDogMSAtIHMpKSA+Pj4gOCAqIChyID8gcyA6IDEgLSBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gXyhlLCB0LCBuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gfHwgKE0obnVsbCAhPSB0LCAnbWlzc2luZyB2YWx1ZScpLCBNKCdib29sZWFuJyA9PSB0eXBlb2YgciwgJ21pc3Npbmcgb3IgaW52YWxpZCBlbmRpYW4nKSwgTShudWxsICE9IG4sICdtaXNzaW5nIG9mZnNldCcpLCBNKG4gKyAzIDwgZS5sZW5ndGgsICd0cnlpbmcgdG8gd3JpdGUgYmV5b25kIGJ1ZmZlciBsZW5ndGgnKSwgVSh0LCA0Mjk0OTY3Mjk1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGkgPD0gbikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBzID0gMCwgYSA9IE1hdGgubWluKGkgLSBuLCA0KTsgcyA8IGE7IHMrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW24gKyBzXSA9IHQgPj4+IDggKiAociA/IHMgOiAzIC0gcykgJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFMoZSwgdCwgbiwgciwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvIHx8IChNKG51bGwgIT0gdCwgJ21pc3NpbmcgdmFsdWUnKSwgTSgnYm9vbGVhbicgPT0gdHlwZW9mIHIsICdtaXNzaW5nIG9yIGludmFsaWQgZW5kaWFuJyksIE0obnVsbCAhPSBuLCAnbWlzc2luZyBvZmZzZXQnKSwgTShuICsgMSA8IGUubGVuZ3RoLCAnVHJ5aW5nIHRvIHdyaXRlIGJleW9uZCBidWZmZXIgbGVuZ3RoJyksIGoodCwgMzI3NjcsIC0zMjc2OCkpLCBlLmxlbmd0aCA8PSBuIHx8IEMoZSwgMCA8PSB0ID8gdCA6IDY1NTM1ICsgdCArIDEsIG4sIHIsIG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB3KGUsIHQsIG4sIHIsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyB8fCAoTShudWxsICE9IHQsICdtaXNzaW5nIHZhbHVlJyksIE0oJ2Jvb2xlYW4nID09IHR5cGVvZiByLCAnbWlzc2luZyBvciBpbnZhbGlkIGVuZGlhbicpLCBNKG51bGwgIT0gbiwgJ21pc3Npbmcgb2Zmc2V0JyksIE0obiArIDMgPCBlLmxlbmd0aCwgJ1RyeWluZyB0byB3cml0ZSBiZXlvbmQgYnVmZmVyIGxlbmd0aCcpLCBqKHQsIDIxNDc0ODM2NDcsIC0yMTQ3NDgzNjQ4KSksIGUubGVuZ3RoIDw9IG4gfHwgXyhlLCAwIDw9IHQgPyB0IDogNDI5NDk2NzI5NSArIHQgKyAxLCBuLCByLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSShlLCB0LCBuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gfHwgKE0obnVsbCAhPSB0LCAnbWlzc2luZyB2YWx1ZScpLCBNKCdib29sZWFuJyA9PSB0eXBlb2YgciwgJ21pc3Npbmcgb3IgaW52YWxpZCBlbmRpYW4nKSwgTShudWxsICE9IG4sICdtaXNzaW5nIG9mZnNldCcpLCBNKG4gKyAzIDwgZS5sZW5ndGgsICdUcnlpbmcgdG8gd3JpdGUgYmV5b25kIGJ1ZmZlciBsZW5ndGgnKSwgQih0LCAzLjQwMjgyMzQ2NjM4NTI4ODZlKzM4LCAtMy40MDI4MjM0NjYzODUyODg2ZSszOCkpLCBlLmxlbmd0aCA8PSBuIHx8IHAud3JpdGUoZSwgdCwgbiwgciwgMjMsIDQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBPKGUsIHQsIG4sIHIsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyB8fCAoTShudWxsICE9IHQsICdtaXNzaW5nIHZhbHVlJyksIE0oJ2Jvb2xlYW4nID09IHR5cGVvZiByLCAnbWlzc2luZyBvciBpbnZhbGlkIGVuZGlhbicpLCBNKG51bGwgIT0gbiwgJ21pc3Npbmcgb2Zmc2V0JyksIE0obiArIDcgPCBlLmxlbmd0aCwgJ1RyeWluZyB0byB3cml0ZSBiZXlvbmQgYnVmZmVyIGxlbmd0aCcpLCBCKHQsIDEuNzk3NjkzMTM0ODYyMzE1N2UrMzA4LCAtMS43OTc2OTMxMzQ4NjIzMTU3ZSszMDgpKSwgZS5sZW5ndGggPD0gbiB8fCBwLndyaXRlKGUsIHQsIG4sIHIsIDUyLCA4KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5CdWZmZXIgPSBvLCBuLlNsb3dCdWZmZXIgPSBvLCBuLklOU1BFQ1RfTUFYX0JZVEVTID0gNTAsIG8ucG9vbFNpemUgPSA4MTkyLCBvLl91c2VUeXBlZEFycmF5cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IEFycmF5QnVmZmVyKDApLCB0ID0gbmV3IFVpbnQ4QXJyYXkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5mb28gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDQyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgNDIgPT09IHQuZm9vKCkgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdC5zdWJhcnJheTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCBvLmlzRW5jb2RpbmcgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKFN0cmluZyhlKS50b0xvd2VyQ2FzZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2hleCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3V0ZjgnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd1dGYtOCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2FzY2lpJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYmluYXJ5JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYmFzZTY0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncmF3JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndWNzMic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3Vjcy0yJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndXRmMTZsZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3V0Zi0xNmxlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8uaXNCdWZmZXIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIShudWxsID09IGUgfHwgIWUuX2lzQnVmZmVyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLmJ5dGVMZW5ndGggPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlICs9ICcnLCB0IHx8ICd1dGY4JykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdoZXgnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGUubGVuZ3RoIC8gMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd1dGY4JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndXRmLTgnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHgoZSkubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2FzY2lpJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYmluYXJ5JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncmF3JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdiYXNlNjQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IFIoZSkubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3VjczInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd1Y3MtMic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3V0ZjE2bGUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd1dGYtMTZsZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gMiAqIGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1Vua25vd24gZW5jb2RpbmcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLmNvbmNhdCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNKFQoZSksICdVc2FnZTogQnVmZmVyLmNvbmNhdChsaXN0LCBbdG90YWxMZW5ndGhdKVxubGlzdCBzaG91bGQgYmUgYW4gQXJyYXkuJyksIDAgPT09IGUubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBvKDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PT0gZS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnbnVtYmVyJyAhPSB0eXBlb2YgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IHQgPSAwOyBuIDwgZS5sZW5ndGg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9IGVbbl0ubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG5ldyBvKHQpLCBpID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gMDsgbiA8IGUubGVuZ3RoOyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gZVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMuY29weShyLCBpKSwgaSArPSBzLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS53cml0ZSA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc0Zpbml0ZSh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRmluaXRlKG4pIHx8IChyID0gbiwgbiA9IHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHQsIHQgPSBuLCBuID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gTnVtYmVyKHQpIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzLCBhLCB1LCBjLCBmLCBsID0gdGhpcy5sZW5ndGggLSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKCghbiB8fCBsIDwgKG4gPSBOdW1iZXIobikpKSAmJiAobiA9IGwpLCByID0gU3RyaW5nKHIgfHwgJ3V0ZjgnKS50b0xvd2VyQ2FzZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2hleCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gTnVtYmVyKG4pIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLmxlbmd0aCAtIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCFyIHx8IGkgPCAociA9IE51bWJlcihyKSkpICYmIChyID0gaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB0Lmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNKHMgJSAyID09IDAsICdJbnZhbGlkIGhleCBzdHJpbmcnKSwgcyAvIDIgPCByICYmIChyID0gcyAvIDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSAwOyBhIDwgcjsgYSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gcGFyc2VJbnQodC5zdWJzdHIoMiAqIGEsIDIpLCAxNik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE0oIWlzTmFOKHUpLCAnSW52YWxpZCBoZXggc3RyaW5nJyksIGVbbiArIGFdID0gdTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8uX2NoYXJzV3JpdHRlbiA9IDIgKiBhLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0aGlzLCBlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd1dGY4JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndXRmLTgnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IHQsIGYgPSBuLCBzID0gby5fY2hhcnNXcml0dGVuID0gTih4KGUpLCB0aGlzLCBjLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdhc2NpaSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2JpbmFyeSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gZCh0aGlzLCBlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdiYXNlNjQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IHQsIHUgPSBuLCBzID0gby5fY2hhcnNXcml0dGVuID0gTihSKGUpLCB0aGlzLCBhLCB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd1Y3MyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndWNzLTInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd1dGYxNmxlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndXRmLTE2bGUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8uX2NoYXJzV3JpdHRlbiA9IE4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCwgbiwgciwgbyA9IFtdLCBpID0gMDsgaSA8IGUubGVuZ3RoOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gKHQgPSBlLmNoYXJDb2RlQXQoaSkpID4+IDgsIHIgPSB0ICUgMjU2LCBvLnB1c2gociksIG8ucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0KSwgZSwgbiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHRoaXMsIGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1Vua25vd24gZW5jb2RpbmcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBvLCBpLCBzLCBhID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPSBTdHJpbmcoZSB8fCAndXRmOCcpLnRvTG93ZXJDYXNlKCksIHQgPSBOdW1iZXIodCkgfHwgMCwgKG4gPSB2b2lkIDAgIT09IG4gPyBOdW1iZXIobikgOiBuID0gYS5sZW5ndGgpID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaGV4JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCF0IHx8IHQgPCAwKSAmJiAodCA9IDApLCAoIW4gfHwgbiA8IDAgfHwgciA8IG4pICYmIChuID0gcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbyA9ICcnLCBpID0gdDsgaSA8IG47IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyArPSBrKGVbaV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShhLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd1dGY4JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndXRmLTgnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAnJywgbyA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBNYXRoLm1pbihlLmxlbmd0aCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IHQ7IGkgPCBuOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbaV0gPD0gMTI3ID8gKHIgKz0gVihvKSArIFN0cmluZy5mcm9tQ2hhckNvZGUoZVtpXSksIG8gPSAnJykgOiBvICs9ICclJyArIGVbaV0udG9TdHJpbmcoMTYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByICsgVihvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oYSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYXNjaWknOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdiaW5hcnknOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IGgoYSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYmFzZTY0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBhLCBzID0gbiwgciA9IDAgPT09IChpID0gdCkgJiYgcyA9PT0gby5sZW5ndGggPyBsLmZyb21CeXRlQXJyYXkobykgOiBsLmZyb21CeXRlQXJyYXkoby5zbGljZShpLCBzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndWNzMic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3Vjcy0yJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndXRmMTZsZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3V0Zi0xNmxlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSBlLnNsaWNlKHQsIG4pLCBvID0gJycsIGkgPSAwOyBpIDwgci5sZW5ndGg7IGkgKz0gMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHJbaV0gKyAyNTYgKiByW2kgKyAxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGEsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1Vua25vd24gZW5jb2RpbmcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS50b0pTT04gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnQnVmZmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKHRoaXMuX2FyciB8fCB0aGlzLCAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLmNvcHkgPSBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9IG4gfHwgMCwgciB8fCAwID09PSByIHx8IChyID0gdGhpcy5sZW5ndGgpLCB0ID0gdCB8fCAwLCByICE9PSBuICYmIDAgIT09IGUubGVuZ3RoICYmIDAgIT09IHRoaXMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNKG4gPD0gciwgJ3NvdXJjZUVuZCA8IHNvdXJjZVN0YXJ0JyksIE0oMCA8PSB0ICYmIHQgPCBlLmxlbmd0aCwgJ3RhcmdldFN0YXJ0IG91dCBvZiBib3VuZHMnKSwgTSgwIDw9IG4gJiYgbiA8IHRoaXMubGVuZ3RoLCAnc291cmNlU3RhcnQgb3V0IG9mIGJvdW5kcycpLCBNKDAgPD0gciAmJiByIDw9IHRoaXMubGVuZ3RoLCAnc291cmNlRW5kIG91dCBvZiBib3VuZHMnKSwgciA+IHRoaXMubGVuZ3RoICYmIChyID0gdGhpcy5sZW5ndGgpLCBlLmxlbmd0aCAtIHQgPCByIC0gbiAmJiAociA9IGUubGVuZ3RoIC0gdCArIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSByIC0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpIDwgMTAwIHx8ICFvLl91c2VUeXBlZEFycmF5cykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBzID0gMDsgcyA8IGk7IHMrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtzICsgdF0gPSB0aGlzW3MgKyBuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9zZXQodGhpcy5zdWJhcnJheShuLCBuICsgaSksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgby5wcm90b3R5cGUuc2xpY2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9IEwoZSwgbiwgMCksIHQgPSBMKHQsIG4sIG4pLCBvLl91c2VUeXBlZEFycmF5cykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLl9hdWdtZW50KHRoaXMuc3ViYXJyYXkoZSwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gdCAtIGUsIGkgPSBuZXcgbyhyLCB2b2lkIDAsICEwKSwgcyA9IDA7IHMgPCByOyBzKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpW3NdID0gdGhpc1tzICsgZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLmdldCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb25zb2xlLmxvZygnLmdldCgpIGlzIGRlcHJlY2F0ZWQuIEFjY2VzcyB1c2luZyBhcnJheSBpbmRleGVzIGluc3RlYWQuJyksIHRoaXMucmVhZFVJbnQ4KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLnNldCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb25zb2xlLmxvZygnLnNldCgpIGlzIGRlcHJlY2F0ZWQuIEFjY2VzcyB1c2luZyBhcnJheSBpbmRleGVzIGluc3RlYWQuJyksIHRoaXMud3JpdGVVSW50OChlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5yZWFkVUludDggPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCB8fCAoTShudWxsICE9IGUsICdtaXNzaW5nIG9mZnNldCcpLCBNKGUgPCB0aGlzLmxlbmd0aCwgJ1RyeWluZyB0byByZWFkIGJleW9uZCBidWZmZXIgbGVuZ3RoJykpLCAhKGUgPj0gdGhpcy5sZW5ndGgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgby5wcm90b3R5cGUucmVhZFVJbnQxNkxFID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYodGhpcywgZSwgITAsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLnJlYWRVSW50MTZCRSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2KHRoaXMsIGUsICExLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5yZWFkVUludDMyTEUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geSh0aGlzLCBlLCAhMCwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgby5wcm90b3R5cGUucmVhZFVJbnQzMkJFID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkodGhpcywgZSwgITEsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLnJlYWRJbnQ4ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgfHwgKE0obnVsbCAhPSBlLCAnbWlzc2luZyBvZmZzZXQnKSwgTShlIDwgdGhpcy5sZW5ndGgsICdUcnlpbmcgdG8gcmVhZCBiZXlvbmQgYnVmZmVyIGxlbmd0aCcpKSwgIShlID49IHRoaXMubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxMjggJiB0aGlzW2VdID8gLTEgKiAoMjU1IC0gdGhpc1tlXSArIDEpIDogdGhpc1tlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5yZWFkSW50MTZMRSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnKHRoaXMsIGUsICEwLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5yZWFkSW50MTZCRSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnKHRoaXMsIGUsICExLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5yZWFkSW50MzJMRSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKHRoaXMsIGUsICEwLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5yZWFkSW50MzJCRSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKHRoaXMsIGUsICExLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5yZWFkRmxvYXRMRSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKHRoaXMsIGUsICEwLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5yZWFkRmxvYXRCRSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKHRoaXMsIGUsICExLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5yZWFkRG91YmxlTEUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRSh0aGlzLCBlLCAhMCwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgby5wcm90b3R5cGUucmVhZERvdWJsZUJFID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEUodGhpcywgZSwgITEsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLndyaXRlVUludDggPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuIHx8IChNKG51bGwgIT0gZSwgJ21pc3NpbmcgdmFsdWUnKSwgTShudWxsICE9IHQsICdtaXNzaW5nIG9mZnNldCcpLCBNKHQgPCB0aGlzLmxlbmd0aCwgJ3RyeWluZyB0byB3cml0ZSBiZXlvbmQgYnVmZmVyIGxlbmd0aCcpLCBVKGUsIDI1NSkpLCB0ID49IHRoaXMubGVuZ3RoIHx8ICh0aGlzW3RdID0gZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgby5wcm90b3R5cGUud3JpdGVVSW50MTZMRSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEModGhpcywgZSwgdCwgITAsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLndyaXRlVUludDE2QkUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDKHRoaXMsIGUsIHQsICExLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS53cml0ZVVJbnQzMkxFID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXyh0aGlzLCBlLCB0LCAhMCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgby5wcm90b3R5cGUud3JpdGVVSW50MzJCRSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8odGhpcywgZSwgdCwgITEsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLndyaXRlSW50OCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gfHwgKE0obnVsbCAhPSBlLCAnbWlzc2luZyB2YWx1ZScpLCBNKG51bGwgIT0gdCwgJ21pc3Npbmcgb2Zmc2V0JyksIE0odCA8IHRoaXMubGVuZ3RoLCAnVHJ5aW5nIHRvIHdyaXRlIGJleW9uZCBidWZmZXIgbGVuZ3RoJyksIGooZSwgMTI3LCAtMTI4KSksIHQgPj0gdGhpcy5sZW5ndGggfHwgKDAgPD0gZSA/IHRoaXMud3JpdGVVSW50OChlLCB0LCBuKSA6IHRoaXMud3JpdGVVSW50OCgyNTUgKyBlICsgMSwgdCwgbikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLndyaXRlSW50MTZMRSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFModGhpcywgZSwgdCwgITAsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLndyaXRlSW50MTZCRSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFModGhpcywgZSwgdCwgITEsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLndyaXRlSW50MzJMRSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcodGhpcywgZSwgdCwgITAsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLndyaXRlSW50MzJCRSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcodGhpcywgZSwgdCwgITEsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLndyaXRlRmxvYXRMRSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkodGhpcywgZSwgdCwgITAsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLndyaXRlRmxvYXRCRSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkodGhpcywgZSwgdCwgITEsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLndyaXRlRG91YmxlTEUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPKHRoaXMsIGUsIHQsICEwLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS53cml0ZURvdWJsZUJFID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTyh0aGlzLCBlLCB0LCAhMSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgby5wcm90b3R5cGUuZmlsbCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID0gZSB8fCAwLCB0ID0gdCB8fCAwLCBuID0gbiB8fCB0aGlzLmxlbmd0aCwgJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgKGUgPSBlLmNoYXJDb2RlQXQoMCkpLCBNKCdudW1iZXInID09IHR5cGVvZiBlICYmICFpc05hTihlKSwgJ3ZhbHVlIGlzIG5vdCBhIG51bWJlcicpLCBNKHQgPD0gbiwgJ2VuZCA8IHN0YXJ0JyksIG4gIT09IHQgJiYgMCAhPT0gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE0oMCA8PSB0ICYmIHQgPCB0aGlzLmxlbmd0aCwgJ3N0YXJ0IG91dCBvZiBib3VuZHMnKSwgTSgwIDw9IG4gJiYgbiA8PSB0aGlzLmxlbmd0aCwgJ2VuZCBvdXQgb2YgYm91bmRzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gdDsgciA8IG47IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3JdID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLmluc3BlY3QgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBbXSwgdCA9IHRoaXMubGVuZ3RoLCByID0gMDsgciA8IHQ7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlW3JdID0gayh0aGlzW3JdKSwgciA9PT0gbi5JTlNQRUNUX01BWF9CWVRFUykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbciArIDFdID0gJy4uLic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnPEJ1ZmZlciAnICsgZS5qb2luKCcgJykgKyAnPic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgby5wcm90b3R5cGUudG9BcnJheUJ1ZmZlciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnID09IHR5cGVvZiBVaW50OEFycmF5KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdCdWZmZXIudG9BcnJheUJ1ZmZlciBub3Qgc3VwcG9ydGVkIGluIHRoaXMgYnJvd3NlcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoby5fdXNlVHlwZWRBcnJheXMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IG8odGhpcykuYnVmZmVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gbmV3IFVpbnQ4QXJyYXkodGhpcy5sZW5ndGgpLCB0ID0gMCwgbiA9IGUubGVuZ3RoOyB0IDwgbjsgdCArPSAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0XSA9IHRoaXNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmJ1ZmZlcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBBID0gby5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gTChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnbnVtYmVyJyAhPSB0eXBlb2YgZSA/IG4gOiB0IDw9IChlID0gfn5lKSA/IHQgOiAwIDw9IGUgfHwgMCA8PSAoZSArPSB0KSA/IGUgOiAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBQKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gfn5NYXRoLmNlaWwoK2UpKSA8IDAgPyAwIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoQXJyYXkuaXNBcnJheSB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0IEFycmF5XScgPT09IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGsoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA8IDE2ID8gJzAnICsgZS50b1N0cmluZygxNikgOiBlLnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBbXSwgbiA9IDA7IG4gPCBlLmxlbmd0aDsgbisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuY2hhckNvZGVBdChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyIDw9IDEyNykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goZS5jaGFyQ29kZUF0KG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1NTI5NiA8PSByICYmIHIgPD0gNTczNDMgJiYgbisrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSBlbmNvZGVVUklDb21wb25lbnQoZS5zbGljZShvLCBuICsgMSkpLnN1YnN0cigxKS5zcGxpdCgnJScpLCBzID0gMDsgcyA8IGkubGVuZ3RoOyBzKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChwYXJzZUludChpW3NdLCAxNikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBSKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwudG9CeXRlQXJyYXkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE4oZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gMDsgbyA8IHIgJiYgIShvICsgbiA+PSB0Lmxlbmd0aCB8fCBvID49IGUubGVuZ3RoKTsgbysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtvICsgbl0gPSBlW29dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGVjb2RlVVJJQ29tcG9uZW50KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gU3RyaW5nLmZyb21DaGFyQ29kZSg2NTUzMyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE0oJ251bWJlcicgPT0gdHlwZW9mIGUsICdjYW5ub3Qgd3JpdGUgYSBub24tbnVtYmVyIGFzIGEgbnVtYmVyJyksIE0oMCA8PSBlLCAnc3BlY2lmaWVkIGEgbmVnYXRpdmUgdmFsdWUgZm9yIHdyaXRpbmcgYW4gdW5zaWduZWQgdmFsdWUnKSwgTShlIDw9IHQsICd2YWx1ZSBpcyBsYXJnZXIgdGhhbiBtYXhpbXVtIHZhbHVlIGZvciB0eXBlJyksIE0oTWF0aC5mbG9vcihlKSA9PT0gZSwgJ3ZhbHVlIGhhcyBhIGZyYWN0aW9uYWwgY29tcG9uZW50Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGooZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNKCdudW1iZXInID09IHR5cGVvZiBlLCAnY2Fubm90IHdyaXRlIGEgbm9uLW51bWJlciBhcyBhIG51bWJlcicpLCBNKGUgPD0gdCwgJ3ZhbHVlIGxhcmdlciB0aGFuIG1heGltdW0gYWxsb3dlZCB2YWx1ZScpLCBNKG4gPD0gZSwgJ3ZhbHVlIHNtYWxsZXIgdGhhbiBtaW5pbXVtIGFsbG93ZWQgdmFsdWUnKSwgTShNYXRoLmZsb29yKGUpID09PSBlLCAndmFsdWUgaGFzIGEgZnJhY3Rpb25hbCBjb21wb25lbnQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE0oJ251bWJlcicgPT0gdHlwZW9mIGUsICdjYW5ub3Qgd3JpdGUgYSBub24tbnVtYmVyIGFzIGEgbnVtYmVyJyksIE0oZSA8PSB0LCAndmFsdWUgbGFyZ2VyIHRoYW4gbWF4aW11bSBhbGxvd2VkIHZhbHVlJyksIE0obiA8PSBlLCAndmFsdWUgc21hbGxlciB0aGFuIG1pbmltdW0gYWxsb3dlZCB2YWx1ZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBNKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKHQgfHwgJ0ZhaWxlZCBhc3NlcnRpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby5fYXVnbWVudCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLl9pc0J1ZmZlciA9ICEwLCBlLl9nZXQgPSBlLmdldCwgZS5fc2V0ID0gZS5zZXQsIGUuZ2V0ID0gQS5nZXQsIGUuc2V0ID0gQS5zZXQsIGUud3JpdGUgPSBBLndyaXRlLCBlLnRvU3RyaW5nID0gQS50b1N0cmluZywgZS50b0xvY2FsZVN0cmluZyA9IEEudG9TdHJpbmcsIGUudG9KU09OID0gQS50b0pTT04sIGUuY29weSA9IEEuY29weSwgZS5zbGljZSA9IEEuc2xpY2UsIGUucmVhZFVJbnQ4ID0gQS5yZWFkVUludDgsIGUucmVhZFVJbnQxNkxFID0gQS5yZWFkVUludDE2TEUsIGUucmVhZFVJbnQxNkJFID0gQS5yZWFkVUludDE2QkUsIGUucmVhZFVJbnQzMkxFID0gQS5yZWFkVUludDMyTEUsIGUucmVhZFVJbnQzMkJFID0gQS5yZWFkVUludDMyQkUsIGUucmVhZEludDggPSBBLnJlYWRJbnQ4LCBlLnJlYWRJbnQxNkxFID0gQS5yZWFkSW50MTZMRSwgZS5yZWFkSW50MTZCRSA9IEEucmVhZEludDE2QkUsIGUucmVhZEludDMyTEUgPSBBLnJlYWRJbnQzMkxFLCBlLnJlYWRJbnQzMkJFID0gQS5yZWFkSW50MzJCRSwgZS5yZWFkRmxvYXRMRSA9IEEucmVhZEZsb2F0TEUsIGUucmVhZEZsb2F0QkUgPSBBLnJlYWRGbG9hdEJFLCBlLnJlYWREb3VibGVMRSA9IEEucmVhZERvdWJsZUxFLCBlLnJlYWREb3VibGVCRSA9IEEucmVhZERvdWJsZUJFLCBlLndyaXRlVUludDggPSBBLndyaXRlVUludDgsIGUud3JpdGVVSW50MTZMRSA9IEEud3JpdGVVSW50MTZMRSwgZS53cml0ZVVJbnQxNkJFID0gQS53cml0ZVVJbnQxNkJFLCBlLndyaXRlVUludDMyTEUgPSBBLndyaXRlVUludDMyTEUsIGUud3JpdGVVSW50MzJCRSA9IEEud3JpdGVVSW50MzJCRSwgZS53cml0ZUludDggPSBBLndyaXRlSW50OCwgZS53cml0ZUludDE2TEUgPSBBLndyaXRlSW50MTZMRSwgZS53cml0ZUludDE2QkUgPSBBLndyaXRlSW50MTZCRSwgZS53cml0ZUludDMyTEUgPSBBLndyaXRlSW50MzJMRSwgZS53cml0ZUludDMyQkUgPSBBLndyaXRlSW50MzJCRSwgZS53cml0ZUZsb2F0TEUgPSBBLndyaXRlRmxvYXRMRSwgZS53cml0ZUZsb2F0QkUgPSBBLndyaXRlRmxvYXRCRSwgZS53cml0ZURvdWJsZUxFID0gQS53cml0ZURvdWJsZUxFLCBlLndyaXRlRG91YmxlQkUgPSBBLndyaXRlRG91YmxlQkUsIGUuZmlsbCA9IEEuZmlsbCwgZS5pbnNwZWN0ID0gQS5pbnNwZWN0LCBlLnRvQXJyYXlCdWZmZXIgPSBBLnRvQXJyYXlCdWZmZXIsIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0uY2FsbCh0aGlzLCBlKCdsWXBvSTInKSwgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHNlbGYgPyBzZWxmIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHdpbmRvdyA/IHdpbmRvdyA6IHt9LCBlKCdidWZmZXInKS5CdWZmZXIsIGFyZ3VtZW50c1szXSwgYXJndW1lbnRzWzRdLCBhcmd1bWVudHNbNV0sIGFyZ3VtZW50c1s2XSwgJy9ub2RlX21vZHVsZXMvZ3VscC1icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9idWZmZXIvaW5kZXguanMnLCAnL25vZGVfbW9kdWxlcy9ndWxwLWJyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2J1ZmZlcicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Jhc2U2NC1qcyc6IDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWZmZXI6IDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZWVlNzU0OiAxMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxZcG9JMjogMTAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgNDogWwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uIChuLCByLCBvLCBpLCBzLCBhLCB1LCBjLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBuZXcgKG8gPSAoZSgnYnVmZmVyJykpLkJ1ZmZlcikoNCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5maWxsKDApLCB0LmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc2g6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5pc0J1ZmZlcihlKSB8fCAoZSA9IG5ldyBvKGUpKSwgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gbmV3IG8odCksIGkgPSBuID8gci53cml0ZUludDMyQkUgOiByLndyaXRlSW50MzJMRSwgcyA9IDA7IHMgPCBlLmxlbmd0aDsgcysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmNhbGwociwgZVtzXSwgNCAqIHMsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0odChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmxlbmd0aCAlIDQgIT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUubGVuZ3RoICsgKDQgLSBlLmxlbmd0aCAlIDQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gby5jb25jYXQoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSBbXSwgaSA9IHQgPyBlLnJlYWRJbnQzMkJFIDogZS5yZWFkSW50MzJMRSwgcyA9IDA7IHMgPCBlLmxlbmd0aDsgcyArPSA0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnB1c2goaS5jYWxsKGUsIHMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSwgciksIDggKiBlLmxlbmd0aCksIG4sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0uY2FsbCh0aGlzLCBlKCdsWXBvSTInKSwgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHNlbGYgPyBzZWxmIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHdpbmRvdyA/IHdpbmRvdyA6IHt9LCBlKCdidWZmZXInKS5CdWZmZXIsIGFyZ3VtZW50c1szXSwgYXJndW1lbnRzWzRdLCBhcmd1bWVudHNbNV0sIGFyZ3VtZW50c1s2XSwgJy9ub2RlX21vZHVsZXMvZ3VscC1icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9jcnlwdG8tYnJvd3NlcmlmeS9oZWxwZXJzLmpzJywgJy9ub2RlX21vZHVsZXMvZ3VscC1icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9jcnlwdG8tYnJvd3NlcmlmeScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyOiAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbFlwb0kyOiAxMAogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICA1OiBbCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKHQsIHIsIG8sIGksIHMsIGEsIHUsIGMsIGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gZSgnYnVmZmVyJykuQnVmZmVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gZSgnLi9zaGEnKSwgcCA9IGUoJy4vc2hhMjU2JyksIGQgPSBlKCcuL3JuZycpLCBoID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hhMTogbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNoYTI1NjogcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1kNTogZSgnLi9tZDUnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2ID0gNjQsIHkgPSBuZXcgbyh2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBoW2UgPSBlIHx8ICdzaGExJ10sIHIgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gfHwgbSgnYWxnb3JpdGhtOicsIGUsICdpcyBub3QgeWV0IHN1cHBvcnRlZCcpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8uaXNCdWZmZXIoZSkgfHwgKGUgPSBuZXcgbyhlKSksIHIucHVzaChlKSwgZS5sZW5ndGgsIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlnZXN0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gby5jb25jYXQociksIHMgPSB0ID8gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uaXNCdWZmZXIodCkgfHwgKHQgPSBuZXcgbyh0KSksIG8uaXNCdWZmZXIobikgfHwgKG4gPSBuZXcgbyhuKSksIHQubGVuZ3RoID4gdiA/IHQgPSBlKHQpIDogdC5sZW5ndGggPCB2ICYmICh0ID0gby5jb25jYXQoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgdikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IG5ldyBvKHYpLCBpID0gbmV3IG8odiksIHMgPSAwOyBzIDwgdjsgcysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbc10gPSA1NCBeIHRbc10sIGlbc10gPSA5MiBeIHRbc107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUoby5jb25jYXQoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUoby5jb25jYXQoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG4sIHQsIGkpIDogbihpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciA9IG51bGwsIGUgPyBzLnRvU3RyaW5nKGUpIDogczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBbXS5zbGljZS5jYWxsKGFyZ3VtZW50cykuam9pbignICcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3ZSBhY2NlcHQgcHVsbCByZXF1ZXN0cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaHR0cDovL2dpdGh1Yi5jb20vZG9taW5pY3RhcnIvY3J5cHRvLWJyb3dzZXJpZnknCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uam9pbignXG4nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuZmlsbCgwKSwgbi5jcmVhdGVIYXNoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbi5jcmVhdGVIbWFjID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbi5yYW5kb21CeXRlcyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdCB8fCAhdC5jYWxsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBvKGQoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5jYWxsKHRoaXMsIHZvaWQgMCwgbmV3IG8oZChlKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChlW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NyZWF0ZUNyZWRlbnRpYWxzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NyZWF0ZUNpcGhlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjcmVhdGVDaXBoZXJpdicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjcmVhdGVEZWNpcGhlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjcmVhdGVEZWNpcGhlcml2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NyZWF0ZVNpZ24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY3JlYXRlVmVyaWZ5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NyZWF0ZURpZmZpZUhlbGxtYW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGJrZGYyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bZV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtKCdzb3JyeSwnLCBlLCAnaXMgbm90IGltcGxlbWVudGVkIHlldCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5jYWxsKHRoaXMsIGUoJ2xZcG9JMicpLCAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygc2VsZiA/IHNlbGYgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygd2luZG93ID8gd2luZG93IDoge30sIGUoJ2J1ZmZlcicpLkJ1ZmZlciwgYXJndW1lbnRzWzNdLCBhcmd1bWVudHNbNF0sIGFyZ3VtZW50c1s1XSwgYXJndW1lbnRzWzZdLCAnL25vZGVfbW9kdWxlcy9ndWxwLWJyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2NyeXB0by1icm93c2VyaWZ5L2luZGV4LmpzJywgJy9ub2RlX21vZHVsZXMvZ3VscC1icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9jcnlwdG8tYnJvd3NlcmlmeScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJy4vbWQ1JzogNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcuL3JuZyc6IDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLi9zaGEnOiA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJy4vc2hhMjU2JzogOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlcjogMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxZcG9JMjogMTAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgNjogWwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uIChuLCByLCBvLCBpLCBzLCBhLCB1LCBjLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBlKCcuL2hlbHBlcnMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0ID4+IDVdIHw9IDEyOCA8PCB0ICUgMzIsIGVbMTQgKyAodCArIDY0ID4+PiA5IDw8IDQpXSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAxNzMyNTg0MTkzLCByID0gLTI3MTczMzg3OSwgbyA9IC0xNzMyNTg0MTk0LCBpID0gMjcxNzMzODc4LCBzID0gMDsgcyA8IGUubGVuZ3RoOyBzICs9IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4sIHUgPSByLCBjID0gbywgZiA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gaChuLCByLCBvLCBpLCBlW3MgKyAwXSwgNywgLTY4MDg3NjkzNiksIGkgPSBoKGksIG4sIHIsIG8sIGVbcyArIDFdLCAxMiwgLTM4OTU2NDU4NiksIG8gPSBoKG8sIGksIG4sIHIsIGVbcyArIDJdLCAxNywgNjA2MTA1ODE5KSwgciA9IGgociwgbywgaSwgbiwgZVtzICsgM10sIDIyLCAtMTA0NDUyNTMzMCksIG4gPSBoKG4sIHIsIG8sIGksIGVbcyArIDRdLCA3LCAtMTc2NDE4ODk3KSwgaSA9IGgoaSwgbiwgciwgbywgZVtzICsgNV0sIDEyLCAxMjAwMDgwNDI2KSwgbyA9IGgobywgaSwgbiwgciwgZVtzICsgNl0sIDE3LCAtMTQ3MzIzMTM0MSksIHIgPSBoKHIsIG8sIGksIG4sIGVbcyArIDddLCAyMiwgLTQ1NzA1OTgzKSwgbiA9IGgobiwgciwgbywgaSwgZVtzICsgOF0sIDcsIDE3NzAwMzU0MTYpLCBpID0gaChpLCBuLCByLCBvLCBlW3MgKyA5XSwgMTIsIC0xOTU4NDE0NDE3KSwgbyA9IGgobywgaSwgbiwgciwgZVtzICsgMTBdLCAxNywgLTQyMDYzKSwgciA9IGgociwgbywgaSwgbiwgZVtzICsgMTFdLCAyMiwgLTE5OTA0MDQxNjIpLCBuID0gaChuLCByLCBvLCBpLCBlW3MgKyAxMl0sIDcsIDE4MDQ2MDM2ODIpLCBpID0gaChpLCBuLCByLCBvLCBlW3MgKyAxM10sIDEyLCAtNDAzNDExMDEpLCBvID0gaChvLCBpLCBuLCByLCBlW3MgKyAxNF0sIDE3LCAtMTUwMjAwMjI5MCksIG4gPSB2KG4sIHIgPSBoKHIsIG8sIGksIG4sIGVbcyArIDE1XSwgMjIsIDEyMzY1MzUzMjkpLCBvLCBpLCBlW3MgKyAxXSwgNSwgLTE2NTc5NjUxMCksIGkgPSB2KGksIG4sIHIsIG8sIGVbcyArIDZdLCA5LCAtMTA2OTUwMTYzMiksIG8gPSB2KG8sIGksIG4sIHIsIGVbcyArIDExXSwgMTQsIDY0MzcxNzcxMyksIHIgPSB2KHIsIG8sIGksIG4sIGVbcyArIDBdLCAyMCwgLTM3Mzg5NzMwMiksIG4gPSB2KG4sIHIsIG8sIGksIGVbcyArIDVdLCA1LCAtNzAxNTU4NjkxKSwgaSA9IHYoaSwgbiwgciwgbywgZVtzICsgMTBdLCA5LCAzODAxNjA4MyksIG8gPSB2KG8sIGksIG4sIHIsIGVbcyArIDE1XSwgMTQsIC02NjA0NzgzMzUpLCByID0gdihyLCBvLCBpLCBuLCBlW3MgKyA0XSwgMjAsIC00MDU1Mzc4NDgpLCBuID0gdihuLCByLCBvLCBpLCBlW3MgKyA5XSwgNSwgNTY4NDQ2NDM4KSwgaSA9IHYoaSwgbiwgciwgbywgZVtzICsgMTRdLCA5LCAtMTAxOTgwMzY5MCksIG8gPSB2KG8sIGksIG4sIHIsIGVbcyArIDNdLCAxNCwgLTE4NzM2Mzk2MSksIHIgPSB2KHIsIG8sIGksIG4sIGVbcyArIDhdLCAyMCwgMTE2MzUzMTUwMSksIG4gPSB2KG4sIHIsIG8sIGksIGVbcyArIDEzXSwgNSwgLTE0NDQ2ODE0NjcpLCBpID0gdihpLCBuLCByLCBvLCBlW3MgKyAyXSwgOSwgLTUxNDAzNzg0KSwgbyA9IHYobywgaSwgbiwgciwgZVtzICsgN10sIDE0LCAxNzM1MzI4NDczKSwgbiA9IHkobiwgciA9IHYociwgbywgaSwgbiwgZVtzICsgMTJdLCAyMCwgLTE5MjY2MDc3MzQpLCBvLCBpLCBlW3MgKyA1XSwgNCwgLTM3ODU1OCksIGkgPSB5KGksIG4sIHIsIG8sIGVbcyArIDhdLCAxMSwgLTIwMjI1NzQ0NjMpLCBvID0geShvLCBpLCBuLCByLCBlW3MgKyAxMV0sIDE2LCAxODM5MDMwNTYyKSwgciA9IHkociwgbywgaSwgbiwgZVtzICsgMTRdLCAyMywgLTM1MzA5NTU2KSwgbiA9IHkobiwgciwgbywgaSwgZVtzICsgMV0sIDQsIC0xNTMwOTkyMDYwKSwgaSA9IHkoaSwgbiwgciwgbywgZVtzICsgNF0sIDExLCAxMjcyODkzMzUzKSwgbyA9IHkobywgaSwgbiwgciwgZVtzICsgN10sIDE2LCAtMTU1NDk3NjMyKSwgciA9IHkociwgbywgaSwgbiwgZVtzICsgMTBdLCAyMywgLTEwOTQ3MzA2NDApLCBuID0geShuLCByLCBvLCBpLCBlW3MgKyAxM10sIDQsIDY4MTI3OTE3NCksIGkgPSB5KGksIG4sIHIsIG8sIGVbcyArIDBdLCAxMSwgLTM1ODUzNzIyMiksIG8gPSB5KG8sIGksIG4sIHIsIGVbcyArIDNdLCAxNiwgLTcyMjUyMTk3OSksIHIgPSB5KHIsIG8sIGksIG4sIGVbcyArIDZdLCAyMywgNzYwMjkxODkpLCBuID0geShuLCByLCBvLCBpLCBlW3MgKyA5XSwgNCwgLTY0MDM2NDQ4NyksIGkgPSB5KGksIG4sIHIsIG8sIGVbcyArIDEyXSwgMTEsIC00MjE4MTU4MzUpLCBvID0geShvLCBpLCBuLCByLCBlW3MgKyAxNV0sIDE2LCA1MzA3NDI1MjApLCBuID0gZyhuLCByID0geShyLCBvLCBpLCBuLCBlW3MgKyAyXSwgMjMsIC05OTUzMzg2NTEpLCBvLCBpLCBlW3MgKyAwXSwgNiwgLTE5ODYzMDg0NCksIGkgPSBnKGksIG4sIHIsIG8sIGVbcyArIDddLCAxMCwgMTEyNjg5MTQxNSksIG8gPSBnKG8sIGksIG4sIHIsIGVbcyArIDE0XSwgMTUsIC0xNDE2MzU0OTA1KSwgciA9IGcociwgbywgaSwgbiwgZVtzICsgNV0sIDIxLCAtNTc0MzQwNTUpLCBuID0gZyhuLCByLCBvLCBpLCBlW3MgKyAxMl0sIDYsIDE3MDA0ODU1NzEpLCBpID0gZyhpLCBuLCByLCBvLCBlW3MgKyAzXSwgMTAsIC0xODk0OTg2NjA2KSwgbyA9IGcobywgaSwgbiwgciwgZVtzICsgMTBdLCAxNSwgLTEwNTE1MjMpLCByID0gZyhyLCBvLCBpLCBuLCBlW3MgKyAxXSwgMjEsIC0yMDU0OTIyNzk5KSwgbiA9IGcobiwgciwgbywgaSwgZVtzICsgOF0sIDYsIDE4NzMzMTMzNTkpLCBpID0gZyhpLCBuLCByLCBvLCBlW3MgKyAxNV0sIDEwLCAtMzA2MTE3NDQpLCBvID0gZyhvLCBpLCBuLCByLCBlW3MgKyA2XSwgMTUsIC0xNTYwMTk4MzgwKSwgciA9IGcociwgbywgaSwgbiwgZVtzICsgMTNdLCAyMSwgMTMwOTE1MTY0OSksIG4gPSBnKG4sIHIsIG8sIGksIGVbcyArIDRdLCA2LCAtMTQ1NTIzMDcwKSwgaSA9IGcoaSwgbiwgciwgbywgZVtzICsgMTFdLCAxMCwgLTExMjAyMTAzNzkpLCBvID0gZyhvLCBpLCBuLCByLCBlW3MgKyAyXSwgMTUsIDcxODc4NzI1OSksIHIgPSBnKHIsIG8sIGksIG4sIGVbcyArIDldLCAyMSwgLTM0MzQ4NTU1MSksIG4gPSBtKG4sIGEpLCByID0gbShyLCB1KSwgbyA9IG0obywgYyksIGkgPSBtKGksIGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheShuLCByLCBvLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZChlLCB0LCBuLCByLCBvLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKChzID0gbShtKHQsIGUpLCBtKHIsIGkpKSkgPDwgKGEgPSBvKSB8IHMgPj4+IDMyIC0gYSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoKGUsIHQsIG4sIHIsIG8sIGksIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQodCAmIG4gfCB+dCAmIHIsIGUsIHQsIG8sIGksIHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KGUsIHQsIG4sIHIsIG8sIGksIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQodCAmIHIgfCBuICYgfnIsIGUsIHQsIG8sIGksIHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUsIHQsIG4sIHIsIG8sIGksIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQodCBeIG4gXiByLCBlLCB0LCBvLCBpLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhlLCB0LCBuLCByLCBvLCBpLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKG4gXiAodCB8IH5yKSwgZSwgdCwgbywgaSwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICg2NTUzNSAmIGUpICsgKDY1NTM1ICYgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA+PiAxNikgKyAodCA+PiAxNikgKyAobiA+PiAxNikgPDwgMTYgfCA2NTUzNSAmIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsLmhhc2goZSwgcCwgMTYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmNhbGwodGhpcywgZSgnbFlwb0kyJyksICd1bmRlZmluZWQnICE9IHR5cGVvZiBzZWxmID8gc2VsZiA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiB3aW5kb3cgPyB3aW5kb3cgOiB7fSwgZSgnYnVmZmVyJykuQnVmZmVyLCBhcmd1bWVudHNbM10sIGFyZ3VtZW50c1s0XSwgYXJndW1lbnRzWzVdLCBhcmd1bWVudHNbNl0sICcvbm9kZV9tb2R1bGVzL2d1bHAtYnJvd3NlcmlmeS9ub2RlX21vZHVsZXMvY3J5cHRvLWJyb3dzZXJpZnkvbWQ1LmpzJywgJy9ub2RlX21vZHVsZXMvZ3VscC1icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9jcnlwdG8tYnJvd3NlcmlmeScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJy4vaGVscGVycyc6IDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWZmZXI6IDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsWXBvSTI6IDEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIDc6IFsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChmdW5jdGlvbiAoZSwgbiwgciwgbywgaSwgcywgYSwgdSwgYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0LCBuID0gbmV3IEFycmF5KGUpLCByID0gMDsgciA8IGU7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPT0gKDMgJiByKSAmJiAodCA9IDQyOTQ5NjcyOTYgKiBNYXRoLnJhbmRvbSgpKSwgbltyXSA9IHQgPj4+ICgoMyAmIHIpIDw8IDMpICYgMjU1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmV4cG9ydHMgPSBmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5jYWxsKHRoaXMsIGUoJ2xZcG9JMicpLCAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygc2VsZiA/IHNlbGYgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygd2luZG93ID8gd2luZG93IDoge30sIGUoJ2J1ZmZlcicpLkJ1ZmZlciwgYXJndW1lbnRzWzNdLCBhcmd1bWVudHNbNF0sIGFyZ3VtZW50c1s1XSwgYXJndW1lbnRzWzZdLCAnL25vZGVfbW9kdWxlcy9ndWxwLWJyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2NyeXB0by1icm93c2VyaWZ5L3JuZy5qcycsICcvbm9kZV9tb2R1bGVzL2d1bHAtYnJvd3NlcmlmeS9ub2RlX21vZHVsZXMvY3J5cHRvLWJyb3dzZXJpZnknKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlcjogMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxZcG9JMjogMTAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgODogWwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uIChuLCByLCBvLCBpLCBzLCBhLCB1LCBjLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBlKCcuL2hlbHBlcnMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0ID4+IDVdIHw9IDEyOCA8PCAyNCAtIHQgJSAzMiwgZVsxNSArICh0ICsgNjQgPj4gOSA8PCA0KV0gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuLCByID0gQXJyYXkoODApLCBvID0gMTczMjU4NDE5MywgaSA9IC0yNzE3MzM4NzksIHMgPSAtMTczMjU4NDE5NCwgYSA9IDI3MTczMzg3OCwgdSA9IC0xMDA5NTg5Nzc2LCBjID0gMDsgYyA8IGUubGVuZ3RoOyBjICs9IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBmID0gbywgbCA9IGksIHAgPSBzLCB5ID0gYSwgZyA9IHUsIG0gPSAwOyBtIDwgODA7IG0rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbbV0gPSBtIDwgMTYgPyBlW2MgKyBtXSA6IHYoclttIC0gM10gXiByW20gLSA4XSBeIHJbbSAtIDE0XSBeIHJbbSAtIDE2XSwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBoKGgodihvLCA1KSwgZChtLCBpLCBzLCBhKSksIGgoaCh1LCByW21dKSwgKG4gPSBtKSA8IDIwID8gMTUxODUwMDI0OSA6IG4gPCA0MCA/IDE4NTk3NzUzOTMgOiBuIDwgNjAgPyAtMTg5NDAwNzU4OCA6IC04OTk0OTc1MTQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gYSwgYSA9IHMsIHMgPSB2KGksIDMwKSwgaSA9IG8sIG8gPSBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGgobywgZiksIGkgPSBoKGksIGwpLCBzID0gaChzLCBwKSwgYSA9IGgoYSwgeSksIHUgPSBoKHUsIGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheShvLCBpLCBzLCBhLCB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIDwgMjAgPyB0ICYgbiB8IH50ICYgciA6ICEoZSA8IDQwKSAmJiBlIDwgNjAgPyB0ICYgbiB8IHQgJiByIHwgbiAmIHIgOiB0IF4gbiBeIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICg2NTUzNSAmIGUpICsgKDY1NTM1ICYgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA+PiAxNikgKyAodCA+PiAxNikgKyAobiA+PiAxNikgPDwgMTYgfCA2NTUzNSAmIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHYoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA8PCB0IHwgZSA+Pj4gMzIgLSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbC5oYXNoKGUsIHAsIDIwLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0uY2FsbCh0aGlzLCBlKCdsWXBvSTInKSwgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHNlbGYgPyBzZWxmIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHdpbmRvdyA/IHdpbmRvdyA6IHt9LCBlKCdidWZmZXInKS5CdWZmZXIsIGFyZ3VtZW50c1szXSwgYXJndW1lbnRzWzRdLCBhcmd1bWVudHNbNV0sIGFyZ3VtZW50c1s2XSwgJy9ub2RlX21vZHVsZXMvZ3VscC1icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9jcnlwdG8tYnJvd3NlcmlmeS9zaGEuanMnLCAnL25vZGVfbW9kdWxlcy9ndWxwLWJyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL2NyeXB0by1icm93c2VyaWZ5JykpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLi9oZWxwZXJzJzogNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1ZmZlcjogMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxZcG9JMjogMTAKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgOTogWwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uIChuLCByLCBvLCBpLCBzLCBhLCB1LCBjLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gKDY1NTM1ICYgZSkgKyAoNjU1MzUgJiB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID4+IDE2KSArICh0ID4+IDE2KSArIChuID4+IDE2KSA8PCAxNiB8IDY1NTM1ICYgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID4+PiB0IHwgZSA8PCAzMiAtIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA+Pj4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByLCBvLCBpLCBzLCBhLCB1LCBjLCBmLCBoLCB2LCB5LCBnLCBtLCBiLCBFLCBDLCBfLCBTID0gbmV3IEFycmF5KDExMTYzNTI0MDgsIDE4OTk0NDc0NDEsIDMwNDkzMjM0NzEsIDM5MjEwMDk1NzMsIDk2MTk4NzE2MywgMTUwODk3MDk5MywgMjQ1MzYzNTc0OCwgMjg3MDc2MzIyMSwgMzYyNDM4MTA4MCwgMzEwNTk4NDAxLCA2MDcyMjUyNzgsIDE0MjY4ODE5ODcsIDE5MjUwNzgzODgsIDIxNjIwNzgyMDYsIDI2MTQ4ODgxMDMsIDMyNDgyMjI1ODAsIDM4MzUzOTA0MDEsIDQwMjIyMjQ3NzQsIDI2NDM0NzA3OCwgNjA0ODA3NjI4LCA3NzAyNTU5ODMsIDEyNDkxNTAxMjIsIDE1NTUwODE2OTIsIDE5OTYwNjQ5ODYsIDI1NTQyMjA4ODIsIDI4MjE4MzQzNDksIDI5NTI5OTY4MDgsIDMyMTAzMTM2NzEsIDMzMzY1NzE4OTEsIDM1ODQ1Mjg3MTEsIDExMzkyNjk5MywgMzM4MjQxODk1LCA2NjYzMDcyMDUsIDc3MzUyOTkxMiwgMTI5NDc1NzM3MiwgMTM5NjE4MjI5MSwgMTY5NTE4MzcwMCwgMTk4NjY2MTA1MSwgMjE3NzAyNjM1MCwgMjQ1Njk1NjAzNywgMjczMDQ4NTkyMSwgMjgyMDMwMjQxMSwgMzI1OTczMDgwMCwgMzM0NTc2NDc3MSwgMzUxNjA2NTgxNywgMzYwMDM1MjgwNCwgNDA5NDU3MTkwOSwgMjc1NDIzMzQ0LCA0MzAyMjc3MzQsIDUwNjk0ODYxNiwgNjU5MDYwNTU2LCA4ODM5OTc4NzcsIDk1ODEzOTU3MSwgMTMyMjgyMjIxOCwgMTUzNzAwMjA2MywgMTc0Nzg3Mzc3OSwgMTk1NTU2MjIyMiwgMjAyNDEwNDgxNSwgMjIyNzczMDQ1MiwgMjM2MTg1MjQyNCwgMjQyODQzNjQ3NCwgMjc1NjczNDE4NywgMzIwNDAzMTQ3OSwgMzMyOTMyNTI5OCksIHcgPSBuZXcgQXJyYXkoMTc3OTAzMzcwMywgMzE0NDEzNDI3NywgMTAxMzkwNDI0MiwgMjc3MzQ4MDc2MiwgMTM1OTg5MzExOSwgMjYwMDgyMjkyNCwgNTI4NzM0NjM1LCAxNTQxNDU5MjI1KSwgSSA9IG5ldyBBcnJheSg2NCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdCA+PiA1XSB8PSAxMjggPDwgMjQgLSB0ICUgMzIsIGVbMTUgKyAodCArIDY0ID4+IDkgPDwgNCldID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgTyA9IDA7IE8gPCBlLmxlbmd0aDsgTyArPSAxNikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHdbMF0sIHIgPSB3WzFdLCBvID0gd1syXSwgaSA9IHdbM10sIHMgPSB3WzRdLCBhID0gd1s1XSwgdSA9IHdbNl0sIGMgPSB3WzddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgQSA9IDA7IEEgPCA2NDsgQSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElbQV0gPSBBIDwgMTYgPyBlW0EgKyBPXSA6IGwobChsKHAoXyA9IElbQSAtIDJdLCAxNykgXiBwKF8sIDE5KSBeIGQoXywgMTApLCBJW0EgLSA3XSksIHAoQyA9IElbQSAtIDE1XSwgNykgXiBwKEMsIDE4KSBeIGQoQywgMykpLCBJW0EgLSAxNl0pLCBmID0gbChsKGwobChjLCBwKEUgPSBzLCA2KSBeIHAoRSwgMTEpIF4gcChFLCAyNSkpLCAoYiA9IHMpICYgYSBeIH5iICYgdSksIFNbQV0pLCBJW0FdKSwgaCA9IGwocChtID0gbiwgMikgXiBwKG0sIDEzKSBeIHAobSwgMjIpLCAodiA9IG4pICYgKHkgPSByKSBeIHYgJiAoZyA9IG8pIF4geSAmIGcpLCBjID0gdSwgdSA9IGEsIGEgPSBzLCBzID0gbChpLCBmKSwgaSA9IG8sIG8gPSByLCByID0gbiwgbiA9IGwoZiwgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3WzBdID0gbChuLCB3WzBdKSwgd1sxXSA9IGwociwgd1sxXSksIHdbMl0gPSBsKG8sIHdbMl0pLCB3WzNdID0gbChpLCB3WzNdKSwgd1s0XSA9IGwocywgd1s0XSksIHdbNV0gPSBsKGEsIHdbNV0pLCB3WzZdID0gbCh1LCB3WzZdKSwgd1s3XSA9IGwoYywgd1s3XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB2ID0gZSgnLi9oZWxwZXJzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuaGFzaChlLCBoLCAzMiwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmNhbGwodGhpcywgZSgnbFlwb0kyJyksICd1bmRlZmluZWQnICE9IHR5cGVvZiBzZWxmID8gc2VsZiA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiB3aW5kb3cgPyB3aW5kb3cgOiB7fSwgZSgnYnVmZmVyJykuQnVmZmVyLCBhcmd1bWVudHNbM10sIGFyZ3VtZW50c1s0XSwgYXJndW1lbnRzWzVdLCBhcmd1bWVudHNbNl0sICcvbm9kZV9tb2R1bGVzL2d1bHAtYnJvd3NlcmlmeS9ub2RlX21vZHVsZXMvY3J5cHRvLWJyb3dzZXJpZnkvc2hhMjU2LmpzJywgJy9ub2RlX21vZHVsZXMvZ3VscC1icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9jcnlwdG8tYnJvd3NlcmlmeScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJy4vaGVscGVycyc6IDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWZmZXI6IDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsWXBvSTI6IDEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIDEwOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKGUsIG4sIHIsIG8sIGksIHMsIGEsIHUsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZSA9IHQuZXhwb3J0cyA9IHt9KS5uZXh0VGljayA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygd2luZG93ICYmIHdpbmRvdy5zZXRJbW1lZGlhdGUsIHQgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygd2luZG93ICYmIHdpbmRvdy5wb3N0TWVzc2FnZSAmJiB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LnNldEltbWVkaWF0ZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuc291cmNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgIT09IHdpbmRvdyAmJiBudWxsICE9PSB0IHx8ICdwcm9jZXNzLXRpY2snICE9PSBlLmRhdGEgfHwgKGUuc3RvcFByb3BhZ2F0aW9uKCksIDAgPCBuLmxlbmd0aCAmJiBuLnNoaWZ0KCkoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMCksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoKGUpLCB3aW5kb3cucG9zdE1lc3NhZ2UoJ3Byb2Nlc3MtdGljaycsICcqJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChlLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIGUudGl0bGUgPSAnYnJvd3NlcicsIGUuYnJvd3NlciA9ICEwLCBlLmVudiA9IHt9LCBlLmFyZ3YgPSBbXSwgZS5vbiA9IGYsIGUuYWRkTGlzdGVuZXIgPSBmLCBlLm9uY2UgPSBmLCBlLm9mZiA9IGYsIGUucmVtb3ZlTGlzdGVuZXIgPSBmLCBlLnJlbW92ZUFsbExpc3RlbmVycyA9IGYsIGUuZW1pdCA9IGYsIGUuYmluZGluZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigncHJvY2Vzcy5iaW5kaW5nIGlzIG5vdCBzdXBwb3J0ZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmN3ZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcvJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmNoZGlyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdwcm9jZXNzLmNoZGlyIGlzIG5vdCBzdXBwb3J0ZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5jYWxsKHRoaXMsIGUoJ2xZcG9JMicpLCAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygc2VsZiA/IHNlbGYgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygd2luZG93ID8gd2luZG93IDoge30sIGUoJ2J1ZmZlcicpLkJ1ZmZlciwgYXJndW1lbnRzWzNdLCBhcmd1bWVudHNbNF0sIGFyZ3VtZW50c1s1XSwgYXJndW1lbnRzWzZdLCAnL25vZGVfbW9kdWxlcy9ndWxwLWJyb3dzZXJpZnkvbm9kZV9tb2R1bGVzL3Byb2Nlc3MvYnJvd3Nlci5qcycsICcvbm9kZV9tb2R1bGVzL2d1bHAtYnJvd3NlcmlmeS9ub2RlX21vZHVsZXMvcHJvY2VzcycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyOiAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbFlwb0kyOiAxMAogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAxMTogWwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uIChlLCB0LCByLCBvLCBpLCBzLCBhLCB1LCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5yZWFkID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGksIHMsIGEgPSA4ICogbyAtIHIgLSAxLCB1ID0gKDEgPDwgYSkgLSAxLCBjID0gdSA+PiAxLCBmID0gLTcsIGwgPSBuID8gbyAtIDEgOiAwLCBwID0gbiA/IC0xIDogMSwgZCA9IGVbdCArIGxdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGwgKz0gcCwgaSA9IGQgJiAoMSA8PCAtZikgLSAxLCBkID4+PSAtZiwgZiArPSBhOyAwIDwgZjsgaSA9IDI1NiAqIGkgKyBlW3QgKyBsXSwgbCArPSBwLCBmIC09IDgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHMgPSBpICYgKDEgPDwgLWYpIC0gMSwgaSA+Pj0gLWYsIGYgKz0gcjsgMCA8IGY7IHMgPSAyNTYgKiBzICsgZVt0ICsgbF0sIGwgKz0gcCwgZiAtPSA4KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IGkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gMSAtIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT09IHUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMgPyBOYU4gOiAxIC8gMCAqIChkID8gLTEgOiAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgKz0gTWF0aC5wb3coMiwgciksIGkgLT0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGQgPyAtMSA6IDEpICogcyAqIE1hdGgucG93KDIsIGkgLSByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuLndyaXRlID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIsIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMsIGEsIHUsIGMgPSA4ICogaSAtIG8gLSAxLCBmID0gKDEgPDwgYykgLSAxLCBsID0gZiA+PiAxLCBwID0gMjMgPT09IG8gPyBNYXRoLnBvdygyLCAtMjQpIC0gTWF0aC5wb3coMiwgLTc3KSA6IDAsIGQgPSByID8gMCA6IGkgLSAxLCBoID0gciA/IDEgOiAtMSwgdiA9IHQgPCAwIHx8IDAgPT09IHQgJiYgMSAvIHQgPCAwID8gMSA6IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCA9IE1hdGguYWJzKHQpLCBpc05hTih0KSB8fCB0ID09PSAxIC8gMCA/IChhID0gaXNOYU4odCkgPyAxIDogMCwgcyA9IGYpIDogKHMgPSBNYXRoLmZsb29yKE1hdGgubG9nKHQpIC8gTWF0aC5MTjIpLCB0ICogKHUgPSBNYXRoLnBvdygyLCAtcykpIDwgMSAmJiAocy0tLCB1ICo9IDIpLCAyIDw9ICh0ICs9IDEgPD0gcyArIGwgPyBwIC8gdSA6IHAgKiBNYXRoLnBvdygyLCAxIC0gbCkpICogdSAmJiAocysrLCB1IC89IDIpLCBmIDw9IHMgKyBsID8gKGEgPSAwLCBzID0gZikgOiAxIDw9IHMgKyBsID8gKGEgPSAodCAqIHUgLSAxKSAqIE1hdGgucG93KDIsIG8pLCBzICs9IGwpIDogKGEgPSB0ICogTWF0aC5wb3coMiwgbCAtIDEpICogTWF0aC5wb3coMiwgbyksIHMgPSAwKSk7IDggPD0gbzsgZVtuICsgZF0gPSAyNTUgJiBhLCBkICs9IGgsIGEgLz0gMjU2LCBvIC09IDgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHMgPSBzIDw8IG8gfCBhLCBjICs9IG87IDAgPCBjOyBlW24gKyBkXSA9IDI1NSAmIHMsIGQgKz0gaCwgcyAvPSAyNTYsIGMgLT0gOCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbbiArIGQgLSBoXSB8PSAxMjggKiB2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmNhbGwodGhpcywgZSgnbFlwb0kyJyksICd1bmRlZmluZWQnICE9IHR5cGVvZiBzZWxmID8gc2VsZiA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiB3aW5kb3cgPyB3aW5kb3cgOiB7fSwgZSgnYnVmZmVyJykuQnVmZmVyLCBhcmd1bWVudHNbM10sIGFyZ3VtZW50c1s0XSwgYXJndW1lbnRzWzVdLCBhcmd1bWVudHNbNl0sICcvbm9kZV9tb2R1bGVzL2llZWU3NTQvaW5kZXguanMnLCAnL25vZGVfbW9kdWxlcy9pZWVlNzU0JykpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWZmZXI6IDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsWXBvSTI6IDEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LCB7fSwgWzFdKSgxKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9ICdkYXRhOmltYWdlL3N2Zyt4bWwsJTNDc3ZnIHZpZXdCb3g9XCcwIDAgMTYgMTdcJyB2ZXJzaW9uPVwnMS4xXCcgeG1sbnM9XCdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Z1wnIHhtbG5zOnhsaW5rPVwnaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGlua1wnIHN0eWxlPVwnbWFyZ2luLXJpZ2h0OiA1cHg7IGhlaWdodDogMTdweDtcJyUzRSUzQ2cgaWQ9XCdQYWdlLTFcJyBzdHJva2U9XCdub25lXCcgc3Ryb2tlLXdpZHRoPVwnMVwnIGZpbGw9XCdub25lXCcgZmlsbC1ydWxlPVwnZXZlbm9kZFwnJTNFJTNDZyBpZD1cJ2NvZ1wnIGZpbGw9XCclMjNGRkZGRkZcJyBmaWxsLXJ1bGU9XCdub256ZXJvXCclM0UlM0NwYXRoIGQ9XCdNMTUuNTk2OTE3LDkuOTgzMjY5MzggTDE0LjUwNDEwNzksOS4zMzc5ODgxNiBDMTQuNTcyODA2NCw4Ljc4MTUzODYgMTQuNTcyODA2NCw4LjIxODQ2MTQgMTQuNTA0MTA3OSw3LjY2MjAxMTg0IEwxNS41OTY5MTcsNy4wMTY3MzA2MiBDMTUuOTE3ODIyOSw2LjgyNzI2MjU5IDE2LjA3MjYxMjQsNi40Mzc0MjczMiAxNS45NjcwODQ4LDYuMDc0MTU0NiBDMTUuNTkxMjg3MSw0Ljc4MDMzNjExIDE0LjkyMjM2NDYsMy42MTU3MzE1MyAxNC4wMzkwMDIxLDIuNjYwNjExMTMgQzEzLjc4MzE3NTUsMi4zODQwMTc5NyAxMy4zNzQ5MDUzLDIuMzIzNDg5NjUgMTMuMDUyNTI0OSwyLjUxMzg0ODgxIEwxMS45NjEzMjQzLDMuMTU4MTM2MDggQzExLjUyNDg1MTksMi44MTg0MDExNyAxMS4wNDgxMjIxLDIuNTM2NDg2NjMgMTAuNTQyNDgyLDIuMzE5MTAyNTUgTDEwLjU0MjQ4MiwxLjAyOTkxMTA4IEMxMC41NDI0ODIsMC42NDg0Mzg3MzMgMTAuMjg2MDUyMiwwLjMxNjg2OTY4MyA5LjkyMzA1NTkyLDAuMjI5MDI0NzkyIEM4LjY2MTU1LC0wLjA3NjMyNDQ2IDcuMzM4NzE4MDksLTAuMDc2MzU4NzM0MiA2LjA3Njk0NDA4LDAuMjI5MDI0NzkyIEM1LjcxMzk4MTMxLDAuMzE2ODY5NjgzIDUuNDU3NTE4LDAuNjQ4NDA0NDU4IDUuNDU3NTE4LDEuMDI5OTExMDggTDUuNDU3NTE4LDIuMzE5MTAyNTUgQzQuOTUxODc0MDYsMi41MzY0Nzg3MiA0LjQ3NTE0MzM0LDIuODE4MzkzODIgNC4wMzg2NzU3MiwzLjE1ODEzNjA4IEwyLjk0NzQ3NTExLDIuNTEzODQ4ODEgQzIuNjI1MDYxMjIsMi4zMjM0ODk2NSAyLjIxNjc5MDk0LDIuMzg0MDE3OTcgMS45NjA5OTc4NiwyLjY2MDYxMTEzIEMxLjA3NzYzNTQyLDMuNjE1NzMxNTMgMC40MDg3MTI4OSw0Ljc4MDM3MDM4IDAuMDMyOTE1MjIzNiw2LjA3NDE1NDYgQy0wLjA3MjYxMjQwNyw2LjQzNzQyNzMyIDAuMDgyMTc3MDg5OSw2LjgyNzIyODMyIDAuNDAzMDgyOTYyLDcuMDE2NzMwNjIgTDEuNDk1ODkyMTIsNy42NjIwMTE4NCBDMS40MjcxOTM1Niw4LjIxODQ2MTQgMS40MjcxOTM1Niw4Ljc4MTUzODYgMS40OTU4OTIxMiw5LjMzNzk4ODE2IEwwLjQwMzA4Mjk2Miw5Ljk4MzI2OTM4IEMwLjA4MjE3NzA4OTksMTAuMTcyNzM3NCAtMC4wNzI2MTI0MDcsMTAuNTYyNTcyNyAwLjAzMjkxNTIyMzYsMTAuOTI1ODQ1NCBDMC40MDg3MTI4OSwxMi4yMTk2Mjk2IDEuMDc3NjM1NDIsMTMuMzg0MjY4NSAxLjk2MDk5Nzg2LDE0LjMzOTM4ODkgQzIuMjE2ODI0NDUsMTQuNjE1OTgyIDIuNjI1MDk0NzQsMTQuNjc2NTEwMyAyLjk0NzQ3NTExLDE0LjQ4NjE4NTUgTDQuMDM4Njc1NzIsMTMuODQxODk4MiBDNC40NzUxNDA5NiwxNC4xODE2MzQ5IDQuOTUxODcyNDMsMTQuNDYzNTM4OSA1LjQ1NzUxOCwxNC42ODA4OTc1IEw1LjQ1NzUxOCwxNS45NzAwODg5IEM1LjQ1NzUxOCwxNi4zNTE1NjEzIDUuNzEzOTQ3OCwxNi42ODMxMzAzIDYuMDc2OTQ0MDgsMTYuNzcwOTc1MiBDNy4zMzg0ODM1MSwxNy4wNzYzMjQ1IDguNjYxMjgxOTEsMTcuMDc2MzU4NyA5LjkyMzA1NTkyLDE2Ljc3MDk3NTIgQzEwLjI4NjAxODcsMTYuNjgzMTMwMyAxMC41NDI0ODIsMTYuMzUxNTk1NSAxMC41NDI0ODIsMTUuOTcwMDg4OSBMMTAuNTQyNDgyLDE0LjY4MDg5NzUgQzExLjA0ODExODMsMTQuNDYzNTE5OCAxMS41MjQ4NDc1LDE0LjE4MTYxNzEgMTEuOTYxMzI0MywxMy44NDE4OTgyIEwxMy4wNTI1MjQ5LDE0LjQ4NjE4NTUgQzEzLjM3NDkwNTMsMTQuNjc2NTQ0NiAxMy43ODMxNzU1LDE0LjYxNjAxNjMgMTQuMDM5MDAyMSwxNC4zMzkzODg5IEMxNC45MjIzNjQ2LDEzLjM4NDI2ODUgMTUuNTkxMjg3MSwxMi4yMTk2Mjk2IDE1Ljk2NzA4NDgsMTAuOTI1ODQ1NCBDMTYuMDcyNjEyNCwxMC41NjI1NzI3IDE1LjkxNzgyMjksMTAuMTcyNzcxNyAxNS41OTY5MTcsOS45ODMyNjkzOCBaIE0xMy40MDI2MTkzLDEzLjQyNjQ5NDMgTDExLjg1MDczNjQsMTIuNTEwMDAxIEMxMC45NDYzMjg4LDEzLjMwMDc0MjEgMTAuNjI1NTkwNSwxMy40OTk3MDQxIDkuNDcwMTE0ODQsMTMuOTE3MjY3MyBMOS40NzAxMTQ4NCwxNS43NTAyMTk2IEM4LjUwMDI0ODA4LDE1Ljk1NDgzNzMgNy40OTk3NTE5MiwxNS45NTQ4MzczIDYuNTI5ODg1MTYsMTUuNzUwMjE5NiBMNi41Mjk4ODUxNiwxMy45MTcyNjczIEM1LjQwMzE5NTksMTMuNTEwMTIzNSA1LjA3Njk5NTIyLDEzLjMyMTA2NjggNC4xNDkyNjM1OCwxMi41MTAwMDEgTDIuNTk3MzgwNzUsMTMuNDI2NDk0MyBDMS45MzY4Njk2LDEyLjY2OTM3NjMgMS40MzQ5MDEyNCwxMS43ODE3MDc2IDEuMTI1MjU1MjIsMTAuODIzMDkxMiBMMi42Nzc4MDgyOCw5LjkwNjU5Nzg5IEMyLjQ1ODgxMDgsOC42OTI3MDY5NCAyLjQ1ODcxMDI3LDguMzA3OTA5OTkgMi42Nzc4MDgyOCw3LjA5MzQwMjExIEwxLjEyNTI1NTIyLDYuMTc2OTA4NzkgQzEuNDM0OTAxMjQsNS4yMTgyOTI0MiAxLjkzNjkwMzExLDQuMzMwNTg5NDYgMi41OTczODA3NSwzLjU3MzEyODY0IEw0LjE0OTI2MzU4LDQuNDkwMzA3NDUgQzUuMDY2NzA3MiwzLjY4NzEyNDc4IDUuMzkxMjk5MzMsMy40OTQxMjY1IDYuNTI5ODg1MTYsMy4wODI2OTg0NiBMNi41Mjk4ODUxNiwxLjI0OTc4MDM3IEM3LjQ5OTcxNzc0LDEuMDQ0ODIwNTkgOC41MDAyODIyNiwxLjA0NDgyMDU5IDkuNDcwMTE0ODQsMS4yNDk3ODAzNyBMOS40NzAxMTQ4NCwzLjA4MjczMjc0IEMxMC42MDg3Njc3LDMuNDk0MTk1MDUgMTAuOTMzMzkzMywzLjY4NzIyNzYgMTEuODUwNzM2NCw0LjQ5MDM0MTcyIEwxMy40MDI2MTkzLDMuNTczMTYyOTEgQzE0LjA2MzA5NjksNC4zMzA1ODk0NiAxNC41NjUwOTg4LDUuMjE4MjkyNDIgMTQuODc0NzQ0OCw2LjE3Njk0MzA2IEwxMy4zMjIxOTE3LDcuMDkzNDM2MzggQzEzLjU0MTIyMjcsOC4zMDc2MzU4IDEzLjU0MTI4OTcsOC42OTIxMjQyOCAxMy4zMjIxOTE3LDkuOTA2NjMyMTcgTDE0Ljg3NDc0NDgsMTAuODIzMTI1NSBDMTQuNTY1MDk4OCwxMS43ODE3MDc2IDE0LjA2MzEzMDQsMTIuNjY5NDEwNSAxMy40MDI2MTkzLDEzLjQyNjQ5NDMgWiBNOCw1LjIwOTY4OTU4IEM2LjIyNjA3MDE0LDUuMjA5Njg5NTggNC43ODI4OTg1Myw2LjY4NTcwOTk2IDQuNzgyODk4NTMsOC41MDAwMTcxNCBDNC43ODI4OTg1MywxMC4zMTQzMjQzIDYuMjI2MDcwMTQsMTEuNzkwMzQ0NyA4LDExLjc5MDM0NDcgQzkuNzczOTI5ODYsMTEuNzkwMzQ0NyAxMS4yMTcxMDE1LDEwLjMxNDMyNDMgMTEuMjE3MTAxNSw4LjUwMDAxNzE0IEMxMS4yMTcxMDE1LDYuNjg1NzA5OTYgOS43NzM5Mjk4Niw1LjIwOTY4OTU4IDgsNS4yMDk2ODk1OCBaIE04LDEwLjY5MzU2ODggQzYuODE3MzgwMDksMTAuNjkzNTY4OCA1Ljg1NTI2NTY4LDkuNzA5NTU1MjYgNS44NTUyNjU2OCw4LjUwMDAxNzE0IEM1Ljg1NTI2NTY4LDcuMjkwNDc5MDIgNi44MTczODAwOSw2LjMwNjQ2NTQzIDgsNi4zMDY0NjU0MyBDOS4xODI2MTk5MSw2LjMwNjQ2NTQzIDEwLjE0NDczNDMsNy4yOTA0NzkwMiAxMC4xNDQ3MzQzLDguNTAwMDE3MTQgQzEwLjE0NDczNDMsOS43MDk1NTUyNiA5LjE4MjYxOTkxLDEwLjY5MzU2ODggOCwxMC42OTM1Njg4IFpcJyBpZD1cJ1NoYXBlXCclM0UlM0MvcGF0aCUzRSUzQy9nJTNFJTNDL2clM0UlM0Mvc3ZnJTNFJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTUxKSwgZS5leHBvcnRzID0gbigzMDQpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgbi5yKHQpOwogICAgICAgICAgICAgICAgbigxNTIpLCBuKDE1OSksIG4oMTYwKSwgbigxNjEpLCBuKDE2MiksIG4oMTYzKSwgbigxNjQpLCBuKDE2NSksIG4oMTY2KSwgbigxNjcpLCBuKDE2OCksIG4oMTY5KSwgbigxNzApLCBuKDE3MSksIG4oMTcyKSwgbigxNzQpLCBuKDE3NSksIG4oMTc3KSwgbigxODApLCBuKDE4MSksIG4oMTgyKSwgbigxODMpLCBuKDE4OSksIG4oMTkwKSwgbigxOTIpLCBuKDE5MyksIG4oMTk1KSwgbigxOTYpLCBuKDE5OSksIG4oMjAwKSwgbigyMDEpLCBuKDIwMyksIG4oMjA1KSwgbigyMDcpLCBuKDIwOCksIG4oMjEwKSwgbigyMTEpLCBuKDIxMiksIG4oMjEzKSwgbigyMTQpLCBuKDIxNSksIG4oMjE2KSwgbigyMTcpLCBuKDIxOSksIG4oMjIwKSwgbigyMjEpLCBuKDIyMiksIG4oMjIzKSwgbigyMjQpLCBuKDIyNSksIG4oMjI2KSwgbigyMjcpLCBuKDIyOCksIG4oMjMwKSwgbigyMzIpLCBuKDIzMyksIG4oMjM1KSwgbigyMzYpLCBuKDIzNyksIG4oMjM4KSwgbigyMzkpLCBuKDI0MCksIG4oMjQxKSwgbigyNDIpLCBuKDI0MyksIG4oMjQ0KSwgbigyNDUpLCBuKDI0NiksIG4oMjQ3KSwgbigyNDgpLCBuKDI0OSksIG4oMjUwKSwgbigyNTEpLCBuKDI1MiksIG4oMjUzKSwgbigyNTQpLCBuKDI1NSk7CiAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXJndW1lbnRzW1N5bWJvbC5pdGVyYXRvcl07CiAgICAgICAgICAgICAgICB9KCkgJiYgT2JqZWN0LmRlZmluZVByb3BlcnR5ICYmIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShPYmplY3QucHJvdG90eXBlLCBTeW1ib2wuaXRlcmF0b3IsIHsKICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0IEFyZ3VtZW50c10nID09PSBbXS50b1N0cmluZy5jYWxsKHRoaXMpID8gW11bU3ltYm9sLml0ZXJhdG9yXSA6IHRoaXMuX19TeW1ib2xfaXRlcmF0b3I7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCAnX19TeW1ib2xfaXRlcmF0b3InLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSksIE51bWJlci5pc0ludGVnZXIgPSBOdW1iZXIuaXNJbnRlZ2VyIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09PSB0eXBlb2YgZSAmJiBpc0Zpbml0ZShlKSAmJiBNYXRoLmZsb29yKGUpID09PSBlOwogICAgICAgICAgICAgICAgfSwgTnVtYmVyLmlzTmFOID0gTnVtYmVyLmlzTmFOIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09PSB0eXBlb2YgZSAmJiBlICE9PSBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNiksIGkgPSBuKDkpLCBzID0gbigzKSwgYSA9IG4oMTcpLCB1ID0gbig2NiksIGMgPSBuKDg3KSwgZiA9IG4oMTEpLCBsID0gbigxMyksIHAgPSBuKDQ3KSwgZCA9IG4oMTIpLCBoID0gbigyKSwgdiA9IG4oMjcpLCB5ID0gbigyNiksIGcgPSBuKDQ0KSwgbSA9IG4oMzIpLCBiID0gbigzOSksIEUgPSBuKDQ4KSwgQyA9IG4oNjIpLCBfID0gbigxNTgpLCBTID0gbig2NCksIHcgPSBuKDM1KSwgSSA9IG4oMTgpLCBPID0gbig0MyksIEEgPSBuKDIyKSwgTCA9IG4oMjMpLCBQID0gbig2MSksIFQgPSBuKDQ1KSwgayA9IG4oMzcpLCB4ID0gbig0NiksIFIgPSBuKDcpLCBOID0gbig4OSksIFYgPSBuKDEwKSwgVSA9IG4oMjgpLCBqID0gbigzNCksIEIgPSBuKDkwKS5mb3JFYWNoLCBNID0gVCgnaGlkZGVuJyksIEQgPSBSKCd0b1ByaW1pdGl2ZScpLCBGID0gai5zZXQsIEcgPSBqLmdldHRlckZvcignU3ltYm9sJyksIEggPSBPYmplY3QucHJvdG90eXBlLCBxID0gby5TeW1ib2wsIFkgPSBpKCdKU09OJywgJ3N0cmluZ2lmeScpLCB6ID0gdy5mLCBXID0gSS5mLCBKID0gXy5mLCBLID0gTy5mLCBRID0gUCgnc3ltYm9scycpLCBaID0gUCgnb3Atc3ltYm9scycpLCBYID0gUCgnc3RyaW5nLXRvLXN5bWJvbC1yZWdpc3RyeScpLCAkID0gUCgnc3ltYm9sLXRvLXN0cmluZy1yZWdpc3RyeScpLCBlZSA9IFAoJ3drcycpLCB0ZSA9IG8uUU9iamVjdCwgbmUgPSAhdGUgfHwgIXRlLnByb3RvdHlwZSB8fCAhdGUucHJvdG90eXBlLmZpbmRDaGlsZCwgcmUgPSBhICYmIGYoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gNyAhPSBiKFcoe30sICdhJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFcodGhpcywgJ2EnLCB7IHZhbHVlOiA3IH0pLmE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5hOwogICAgICAgICAgICAgICAgICAgIH0pID8gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB6KEgsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICByICYmIGRlbGV0ZSBIW3RdLCBXKGUsIHQsIG4pLCByICYmIGUgIT09IEggJiYgVyhILCB0LCByKTsKICAgICAgICAgICAgICAgICAgICB9IDogVywgb2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFFbZV0gPSBiKHEucHJvdG90eXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEYobiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ1N5bWJvbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWc6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogdAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgYSB8fCAobi5kZXNjcmlwdGlvbiA9IHQpLCBuOwogICAgICAgICAgICAgICAgICAgIH0sIGllID0gYyA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3ltYm9sJyA9PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChlKSBpbnN0YW5jZW9mIHE7CiAgICAgICAgICAgICAgICAgICAgfSwgc2UgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBlID09PSBIICYmIHNlKFosIHQsIG4pLCBoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGcodCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaChuKSwgbChRLCByKSA/IChuLmVudW1lcmFibGUgPyAobChlLCBNKSAmJiBlW01dW3JdICYmIChlW01dW3JdID0gITEpLCBuID0gYihuLCB7IGVudW1lcmFibGU6IG0oMCwgITEpIH0pKSA6IChsKGUsIE0pIHx8IFcoZSwgTSwgbSgxLCB7fSkpLCBlW01dW3JdID0gITApLCByZShlLCByLCBuKSkgOiBXKGUsIHIsIG4pOwogICAgICAgICAgICAgICAgICAgIH0sIGFlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB5KHQpLCByID0gRShuKS5jb25jYXQobGUobikpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQihyLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiAhdWUuY2FsbChuLCB0KSB8fCBzZShlLCB0LCBuW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgdWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGcoZSwgITApLCBuID0gSy5jYWxsKHRoaXMsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISh0aGlzID09PSBIICYmIGwoUSwgdCkgJiYgIWwoWiwgdCkpICYmICghKG4gfHwgIWwodGhpcywgdCkgfHwgIWwoUSwgdCkgfHwgbCh0aGlzLCBNKSAmJiB0aGlzW01dW3RdKSB8fCBuKTsKICAgICAgICAgICAgICAgICAgICB9LCBjZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0geShlKSwgciA9IGcodCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobiAhPT0gSCB8fCAhbChRLCByKSB8fCBsKFosIHIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHoobiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIW8gfHwgIWwoUSwgcikgfHwgbChuLCBNKSAmJiBuW01dW3JdIHx8IChvLmVudW1lcmFibGUgPSAhMCksIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBmZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gSih5KGUpKSwgbiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQih0LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbChRLCBlKSB8fCBsKGssIGUpIHx8IG4ucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgfSwgbGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUgPT09IEgsIG4gPSBKKHQgPyBaIDogeShlKSksIHIgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEIobiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICFsKFEsIGUpIHx8IHQgJiYgIWwoSCwgZSkgfHwgci5wdXNoKFFbZV0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgcjsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgKHUgfHwgKEwoKHEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMgaW5zdGFuY2VvZiBxKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ1N5bWJvbCBpcyBub3QgYSBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IFN0cmluZyhhcmd1bWVudHNbMF0pIDogdm9pZCAwLCB0ID0geChlKSwgbiA9IGZ1bmN0aW9uIGUobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcyA9PT0gSCAmJiBlLmNhbGwoWiwgbiksIGwodGhpcywgTSkgJiYgbCh0aGlzW01dLCB0KSAmJiAodGhpc1tNXVt0XSA9ICExKSwgcmUodGhpcywgdCwgbSgxLCBuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgJiYgbmUgJiYgcmUoSCwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IG4KICAgICAgICAgICAgICAgICAgICB9KSwgb2UodCwgZSk7CiAgICAgICAgICAgICAgICB9KS5wcm90b3R5cGUsICd0b1N0cmluZycsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRyh0aGlzKS50YWc7CiAgICAgICAgICAgICAgICB9KSwgTChxLCAnd2l0aG91dFNldHRlcicsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9lKHgoZSksIGUpOwogICAgICAgICAgICAgICAgfSksIE8uZiA9IHVlLCBJLmYgPSBzZSwgdy5mID0gY2UsIEMuZiA9IF8uZiA9IGZlLCBTLmYgPSBsZSwgTi5mID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2UoUihlKSwgZSk7CiAgICAgICAgICAgICAgICB9LCBhICYmIChXKHEucHJvdG90eXBlLCAnZGVzY3JpcHRpb24nLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEcodGhpcykuZGVzY3JpcHRpb247CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSksIHMgfHwgTChILCAncHJvcGVydHlJc0VudW1lcmFibGUnLCB1ZSwgeyB1bnNhZmU6ICEwIH0pKSksIHIoewogICAgICAgICAgICAgICAgICAgIGdsb2JhbDogITAsCiAgICAgICAgICAgICAgICAgICAgd3JhcDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhdSwKICAgICAgICAgICAgICAgICAgICBzaGFtOiAhdQogICAgICAgICAgICAgICAgfSwgeyBTeW1ib2w6IHEgfSksIEIoRShlZSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgVihlKTsKICAgICAgICAgICAgICAgIH0pLCByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTeW1ib2wnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogIXUKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBmb3I6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gU3RyaW5nKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobChYLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBYW3RdOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHEodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBYW3RdID0gbiwgJFtuXSA9IHQsIG47CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBrZXlGb3I6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaWUoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoZSArICcgaXMgbm90IGEgc3ltYm9sJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsKCQsIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRbZV07CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB1c2VTZXR0ZXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbmUgPSAhMDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHVzZVNpbXBsZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBuZSA9ICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pLCByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdPYmplY3QnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogIXUsCiAgICAgICAgICAgICAgICAgICAgc2hhbTogIWEKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBjcmVhdGU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IHQgPyBiKGUpIDogYWUoYihlKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBkZWZpbmVQcm9wZXJ0eTogc2UsCiAgICAgICAgICAgICAgICAgICAgZGVmaW5lUHJvcGVydGllczogYWUsCiAgICAgICAgICAgICAgICAgICAgZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOiBjZQogICAgICAgICAgICAgICAgfSksIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ09iamVjdCcsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhdQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGdldE93blByb3BlcnR5TmFtZXM6IGZlLAogICAgICAgICAgICAgICAgICAgIGdldE93blByb3BlcnR5U3ltYm9sczogbGUKICAgICAgICAgICAgICAgIH0pLCByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdPYmplY3QnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogZihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFMuZigxKTsKICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGdldE93blByb3BlcnR5U3ltYm9sczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFMuZih2KGUpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgWSkgJiYgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnSlNPTicsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhdSB8fCBmKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBxKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnW251bGxdJyAhPSBZKFtlXSkgfHwgJ3t9JyAhPSBZKHsgYTogZSB9KSB8fCAne30nICE9IFkoT2JqZWN0KGUpKTsKICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHN0cmluZ2lmeTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciwgbyA9IFtlXSwgaSA9IDE7IGFyZ3VtZW50cy5sZW5ndGggPiBpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8ucHVzaChhcmd1bWVudHNbaSsrXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyID0gdCwgKGQodCkgfHwgdm9pZCAwICE9PSBlKSAmJiAhaWUoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcCh0KSB8fCAodCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIHIgJiYgKHQgPSByLmNhbGwodGhpcywgZSwgdCkpLCAhaWUodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG9bMV0gPSB0LCBZLmFwcGx5KG51bGwsIG8pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcS5wcm90b3R5cGVbRF0gfHwgQShxLnByb3RvdHlwZSwgRCwgcS5wcm90b3R5cGUudmFsdWVPZiksIFUocSwgJ1N5bWJvbCcpLCBrW01dID0gITA7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgIG4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIG4gPSBuIHx8IG5ldyBGdW5jdGlvbigncmV0dXJuIHRoaXMnKSgpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAocikgewogICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09PSB0eXBlb2Ygd2luZG93ICYmIChuID0gd2luZG93KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IG47CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNiksIG8gPSBuKDU5KSwgaSA9IHIuV2Vha01hcDsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBpICYmIC9uYXRpdmUgY29kZS8udGVzdChvKGkpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig5KSwgbyA9IG4oNjIpLCBpID0gbig2NCksIHMgPSBuKDIpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gcignUmVmbGVjdCcsICdvd25LZXlzJykgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG8uZihzKGUpKSwgbiA9IGkuZjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA/IHQuY29uY2F0KG4oZSkpIDogdDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzgpLCBvID0gTWF0aC5tYXgsIGkgPSBNYXRoLm1pbjsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSByKGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuIDwgMCA/IG8obiArIHQsIDApIDogaShuLCB0KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTcpLCBvID0gbigxOCksIGkgPSBuKDIpLCBzID0gbig0OCk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByID8gT2JqZWN0LmRlZmluZVByb3BlcnRpZXMgOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGkoZSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiwgciA9IHModCksIGEgPSByLmxlbmd0aCwgdSA9IDA7IGEgPiB1OykKICAgICAgICAgICAgICAgICAgICAgICAgby5mKGUsIG4gPSByW3UrK10sIHRbbl0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNiksIG8gPSBuKDYyKS5mLCBpID0ge30udG9TdHJpbmcsIHMgPSAnb2JqZWN0JyA9PSB0eXBlb2Ygd2luZG93ICYmIHdpbmRvdyAmJiBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyA/IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKHdpbmRvdykgOiBbXTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cy5mID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyAmJiAnW29iamVjdCBXaW5kb3ddJyA9PSBpLmNhbGwoZSkgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzLnNsaWNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KGUpIDogbyhyKGUpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDE3KSwgaSA9IG4oNiksIHMgPSBuKDEzKSwgYSA9IG4oMTIpLCB1ID0gbigxOCkuZiwgYyA9IG4oODMpLCBmID0gaS5TeW1ib2w7CiAgICAgICAgICAgICAgICBpZiAobyAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBmICYmICghKCdkZXNjcmlwdGlvbicgaW4gZi5wcm90b3R5cGUpIHx8IHZvaWQgMCAhPT0gZigpLmRlc2NyaXB0aW9uKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBsID0ge30sIHAgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGggPCAxIHx8IHZvaWQgMCA9PT0gYXJndW1lbnRzWzBdID8gdm9pZCAwIDogU3RyaW5nKGFyZ3VtZW50c1swXSksIHQgPSB0aGlzIGluc3RhbmNlb2YgcCA/IG5ldyBmKGUpIDogdm9pZCAwID09PSBlID8gZigpIDogZihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJyA9PT0gZSAmJiAobFt0XSA9ICEwKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBjKHAsIGYpOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gcC5wcm90b3R5cGUgPSBmLnByb3RvdHlwZTsKICAgICAgICAgICAgICAgICAgICBkLmNvbnN0cnVjdG9yID0gcDsKICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGQudG9TdHJpbmcsIHYgPSAnU3ltYm9sKHRlc3QpJyA9PSBTdHJpbmcoZigndGVzdCcpKSwgeSA9IC9eU3ltYm9sXCgoLiopXClbXildKyQvOwogICAgICAgICAgICAgICAgICAgIHUoZCwgJ2Rlc2NyaXB0aW9uJywgewogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYSh0aGlzKSA/IHRoaXMudmFsdWVPZigpIDogdGhpcywgdCA9IGguY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzKGwsIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdiA/IHQuc2xpY2UoNywgLTEpIDogdC5yZXBsYWNlKHksICckMScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnID09PSBuID8gdm9pZCAwIDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pLCByKHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2xvYmFsOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhMAogICAgICAgICAgICAgICAgICAgIH0sIHsgU3ltYm9sOiBwIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxMCkoJ2FzeW5jSXRlcmF0b3InKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTApKCdoYXNJbnN0YW5jZScpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxMCkoJ2lzQ29uY2F0U3ByZWFkYWJsZScpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxMCkoJ2l0ZXJhdG9yJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDEwKSgnbWF0Y2gnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTApKCdyZXBsYWNlJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDEwKSgnc2VhcmNoJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDEwKSgnc3BlY2llcycpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxMCkoJ3NwbGl0Jyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDEwKSgndG9QcmltaXRpdmUnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTApKCd0b1N0cmluZ1RhZycpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxMCkoJ3Vuc2NvcGFibGVzJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDExKSwgaSA9IG4oNDcpLCBzID0gbigxMiksIGEgPSBuKDI3KSwgdSA9IG4oMjQpLCBjID0gbig5MSksIGYgPSBuKDY3KSwgbCA9IG4oMTczKSwgcCA9IG4oNyksIGQgPSBuKDY4KSwgaCA9IHAoJ2lzQ29uY2F0U3ByZWFkYWJsZScpLCB2ID0gZCA+PSA1MSB8fCAhbyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW2hdID0gITEsIGUuY29uY2F0KClbMF0gIT09IGU7CiAgICAgICAgICAgICAgICAgICAgfSksIHkgPSBsKCdjb25jYXQnKSwgZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcyhlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW2hdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSB0ID8gISF0IDogaShlKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnQXJyYXknLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6ICF2IHx8ICF5CiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgY29uY2F0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgciwgbywgaSwgcyA9IGEodGhpcyksIGwgPSBmKHMsIDApLCBwID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0ID0gLTEsIHIgPSBhcmd1bWVudHMubGVuZ3RoOyB0IDwgcjsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGcoaSA9IC0xID09PSB0ID8gcyA6IGFyZ3VtZW50c1t0XSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocCArIChvID0gdShpLmxlbmd0aCkpID4gOTAwNzE5OTI1NDc0MDk5MSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKCdNYXhpbXVtIGFsbG93ZWQgaW5kZXggZXhjZWVkZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgbzsgbisrLCBwKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gaW4gaSAmJiBjKGwsIHAsIGlbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocCA+PSA5MDA3MTk5MjU0NzQwOTkxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ01heGltdW0gYWxsb3dlZCBpbmRleCBleGNlZWRlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMobCwgcCsrLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwubGVuZ3RoID0gcCwgbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMSksIG8gPSBuKDcpLCBpID0gbig2OCksIHMgPSBvKCdzcGVjaWVzJyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBpID49IDUxIHx8ICFyKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICh0LmNvbnN0cnVjdG9yID0ge30pW3NdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsgZm9vOiAxIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIDEgIT09IHRbZV0oQm9vbGVhbikuZm9vOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oOTApLmZpbmQsIGkgPSBuKDQ5KSwgcyA9IG4oOTMpLCBhID0gITAsIHUgPSBzKCdmaW5kJyk7CiAgICAgICAgICAgICAgICAnZmluZCcgaW4gW10gJiYgQXJyYXkoMSkuZmluZChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9ICExOwogICAgICAgICAgICAgICAgfSksIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ0FycmF5JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBhIHx8ICF1CiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZmluZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8odGhpcywgZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pLCBpKCdmaW5kJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDE3NiksIGkgPSBuKDI3KSwgcyA9IG4oMjQpLCBhID0gbigzOCksIHUgPSBuKDY3KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ0FycmF5JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBmbGF0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCA/IGFyZ3VtZW50c1swXSA6IHZvaWQgMCwgdCA9IGkodGhpcyksIG4gPSBzKHQubGVuZ3RoKSwgciA9IHUodCwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmxlbmd0aCA9IG8ociwgdCwgdCwgbiwgMCwgdm9pZCAwID09PSBlID8gMSA6IGEoZSkpLCByOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDQ3KSwgbyA9IG4oMjQpLCBpID0gbig4KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGUodCwgbiwgcywgYSwgdSwgYywgZiwgbCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHAsIGQgPSB1LCBoID0gMCwgdiA9ICEhZiAmJiBpKGYsIGwsIDMpOyBoIDwgYTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGggaW4gcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHAgPSB2ID8gdihzW2hdLCBoLCBuKSA6IHNbaF0sIGMgPiAwICYmIHIocCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGUodCwgbiwgcCwgbyhwLmxlbmd0aCksIGQsIGMgLSAxKSAtIDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCA+PSA5MDA3MTk5MjU0NzQwOTkxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ0V4Y2VlZCB0aGUgYWNjZXB0YWJsZSBhcnJheSBsZW5ndGgnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W2RdID0gcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQrKzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBoKys7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMTc4KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ0FycmF5JywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6ICFuKDcxKShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBBcnJheS5mcm9tKGUpOwogICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICB9LCB7IGZyb206IG8gfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oOCksIG8gPSBuKDI3KSwgaSA9IG4oMTc5KSwgcyA9IG4oOTUpLCBhID0gbigyNCksIHUgPSBuKDkxKSwgYyA9IG4oNjkpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgZiwgbCwgcCwgZCwgaCA9IG8oZSksIHYgPSAnZnVuY3Rpb24nID09IHR5cGVvZiB0aGlzID8gdGhpcyA6IEFycmF5LCB5ID0gYXJndW1lbnRzLmxlbmd0aCwgZyA9IHkgPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwLCBtID0gdm9pZCAwICE9PSBnLCBiID0gYyhoKSwgRSA9IDA7CiAgICAgICAgICAgICAgICAgICAgaWYgKG0gJiYgKGcgPSByKGcsIHkgPiAyID8gYXJndW1lbnRzWzJdIDogdm9pZCAwLCAyKSksIHZvaWQgMCA9PSBiIHx8IHYgPT0gQXJyYXkgJiYgcyhiKSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gbmV3IHYodCA9IGEoaC5sZW5ndGgpKTsgdCA+IEU7IEUrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBtID8gZyhoW0VdLCBFKSA6IGhbRV0sIHUobiwgRSwgZCk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHAgPSAobCA9IGIuY2FsbChoKSkubmV4dCwgbiA9IG5ldyB2KCk7ICEoZiA9IHAuY2FsbChsKSkuZG9uZTsgRSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IG0gPyBpKGwsIGcsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnZhbHVlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sICEwKSA6IGYudmFsdWUsIHUobiwgRSwgZCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ubGVuZ3RoID0gRSwgbjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMiksIG8gPSBuKDk0KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgPyB0KHIobilbMF0sIG5bMV0pIDogdChuKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG8oZSksIHM7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oODYpLmluY2x1ZGVzLCBpID0gbig0OSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdBcnJheScsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogIW4oOTMpKCdpbmRleE9mJywgewogICAgICAgICAgICAgICAgICAgICAgICBBQ0NFU1NPUlM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAxOiAwCiAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBpbmNsdWRlczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8odGhpcywgZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pLCBpKCdpbmNsdWRlcycpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbig0OSkoJ2ZsYXQnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig2KTsKICAgICAgICAgICAgICAgIG4oMjgpKHIuSlNPTiwgJ0pTT04nLCAhMCk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oOTcpLCBvID0gbig5OSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByKCdNYXAnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHRoaXMsIGFyZ3VtZW50cy5sZW5ndGggPyBhcmd1bWVudHNbMF0gOiB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBvKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhcihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5pc0V4dGVuc2libGUoT2JqZWN0LnByZXZlbnRFeHRlbnNpb25zKHt9KSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMiksIG8gPSBuKDczKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGksIHM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgKGkgPSB0LmNvbnN0cnVjdG9yKSAmJiBpICE9PSBuICYmIHIocyA9IGkucHJvdG90eXBlKSAmJiBzICE9PSBuLnByb3RvdHlwZSAmJiBvKGUsIHMpLCBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghcihlKSAmJiBudWxsICE9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ0NhblwndCBzZXQgJyArIFN0cmluZyhlKSArICcgYXMgYSBwcm90b3R5cGUnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTAxKS5JdGVyYXRvclByb3RvdHlwZSwgbyA9IG4oMzkpLCBpID0gbigzMiksIHMgPSBuKDI4KSwgYSA9IG4oNDApLCB1ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHQgKyAnIEl0ZXJhdG9yJzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUgPSBvKHIsIHsgbmV4dDogaSgxLCBuKSB9KSwgcyhlLCBjLCAhMSwgITApLCBhW2NdID0gdSwgZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTEpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gIXIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS5jb25zdHJ1Y3RvciA9IG51bGwsIE9iamVjdC5nZXRQcm90b3R5cGVPZihuZXcgZSgpKSAhPT0gZS5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMjgpKE1hdGgsICdNYXRoJywgITApOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigxOTEpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnT2JqZWN0JywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IE9iamVjdC5hc3NpZ24gIT09IG8KICAgICAgICAgICAgICAgIH0sIHsgYXNzaWduOiBvIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE3KSwgbyA9IG4oMTEpLCBpID0gbig0OCksIHMgPSBuKDY0KSwgYSA9IG4oNDMpLCB1ID0gbigyNyksIGMgPSBuKDU2KSwgZiA9IE9iamVjdC5hc3NpZ24sIGwgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhZiB8fCBvKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAociAmJiAxICE9PSBmKHsgYjogMSB9LCBmKGwoe30sICdhJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsKHRoaXMsICdiJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIHsgYjogMiB9KSkuYikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0ge30sIHQgPSB7fSwgbiA9IFN5bWJvbCgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlW25dID0gNywgJ2FiY2RlZmdoaWprbG1ub3BxcnN0Jy5zcGxpdCgnJykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0W2VdID0gZTsKICAgICAgICAgICAgICAgICAgICB9KSwgNyAhPSBmKHt9LCBlKVtuXSB8fCAnYWJjZGVmZ2hpamtsbW5vcHFyc3QnICE9IGkoZih7fSwgdCkpLmpvaW4oJycpOwogICAgICAgICAgICAgICAgfSkgPyBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSB1KGUpLCBvID0gYXJndW1lbnRzLmxlbmd0aCwgZiA9IDEsIGwgPSBzLmYsIHAgPSBhLmY7IG8gPiBmOykKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCwgaCA9IGMoYXJndW1lbnRzW2YrK10pLCB2ID0gbCA/IGkoaCkuY29uY2F0KGwoaCkpIDogaShoKSwgeSA9IHYubGVuZ3RoLCBnID0gMDsgeSA+IGc7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IHZbZysrXSwgciAmJiAhcC5jYWxsKGgsIGQpIHx8IChuW2RdID0gaFtkXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICB9IDogZjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMTAzKS5lbnRyaWVzOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnT2JqZWN0JywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMAogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGVudHJpZXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDcwKSwgbyA9IG4oMjMpLCBpID0gbigxOTQpOwogICAgICAgICAgICAgICAgciB8fCBvKE9iamVjdC5wcm90b3R5cGUsICd0b1N0cmluZycsIGksIHsgdW5zYWZlOiAhMCB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbig3MCksIG8gPSBuKDk2KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIgPyB7fS50b1N0cmluZyA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tvYmplY3QgJyArIG8odGhpcykgKyAnXSc7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigxMDMpLnZhbHVlczsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ09iamVjdCcsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIsIG8sIGksIHMsIGEgPSBuKDEpLCB1ID0gbigzKSwgYyA9IG4oNiksIGYgPSBuKDkpLCBsID0gbigxMDQpLCBwID0gbigyMyksIGQgPSBuKDEwMCksIGggPSBuKDI4KSwgdiA9IG4oMTAyKSwgeSA9IG4oMTIpLCBnID0gbig1KSwgbSA9IG4oNzIpLCBiID0gbig1OSksIEUgPSBuKDQpLCBDID0gbig3MSksIF8gPSBuKDIwKSwgUyA9IG4oMTA1KS5zZXQsIHcgPSBuKDE5NyksIEkgPSBuKDEwNyksIE8gPSBuKDE5OCksIEEgPSBuKDQxKSwgTCA9IG4oNTApLCBQID0gbigzNCksIFQgPSBuKDY1KSwgayA9IG4oNyksIHggPSBuKDc2KSwgUiA9IG4oNjgpLCBOID0gaygnc3BlY2llcycpLCBWID0gJ1Byb21pc2UnLCBVID0gUC5nZXQsIGogPSBQLnNldCwgQiA9IFAuZ2V0dGVyRm9yKFYpLCBNID0gbCwgRCA9IGMuVHlwZUVycm9yLCBGID0gYy5kb2N1bWVudCwgRyA9IGMucHJvY2VzcywgSCA9IGYoJ2ZldGNoJyksIHEgPSBBLmYsIFkgPSBxLCB6ID0gISEoRiAmJiBGLmNyZWF0ZUV2ZW50ICYmIGMuZGlzcGF0Y2hFdmVudCksIFcgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBQcm9taXNlUmVqZWN0aW9uRXZlbnQsIEogPSBUKFYsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoYihNKSAhPT0gU3RyaW5nKE0pKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDY2ID09PSBSKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgheCAmJiAhVykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUgJiYgIU0ucHJvdG90eXBlLmZpbmFsbHkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChSID49IDUxICYmIC9uYXRpdmUgY29kZS8udGVzdChNKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBNLnJlc29sdmUoMSksIHQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZS5jb25zdHJ1Y3RvciA9IHt9KVtOXSA9IHQsICEoZS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfSkgaW5zdGFuY2VvZiB0KTsKICAgICAgICAgICAgICAgICAgICB9KSwgSyA9IEogfHwgIUMoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgTS5hbGwoZSkuY2F0Y2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9KSwgUSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISgheShlKSB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiAodCA9IGUudGhlbikpICYmIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgWiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5ub3RpZmllZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5ub3RpZmllZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLnJlYWN0aW9uczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSBlLnZhbHVlLCBvID0gMSA9PSBlLnN0YXRlLCBpID0gMDsgbi5sZW5ndGggPiBpOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcywgYSwgdSwgYyA9IG5baSsrXSwgZiA9IG8gPyBjLm9rIDogYy5mYWlsLCBsID0gYy5yZXNvbHZlLCBwID0gYy5yZWplY3QsIGQgPSBjLmRvbWFpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPyAobyB8fCAoMiA9PT0gZS5yZWplY3Rpb24gJiYgdGUoZSksIGUucmVqZWN0aW9uID0gMSksICEwID09PSBmID8gcyA9IHIgOiAoZCAmJiBkLmVudGVyKCksIHMgPSBmKHIpLCBkICYmIChkLmV4aXQoKSwgdSA9ICEwKSksIHMgPT09IGMucHJvbWlzZSA/IHAoRCgnUHJvbWlzZS1jaGFpbiBjeWNsZScpKSA6IChhID0gUShzKSkgPyBhLmNhbGwocywgbCwgcCkgOiBsKHMpKSA6IHAocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgJiYgIXUgJiYgZC5leGl0KCksIHAoaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5yZWFjdGlvbnMgPSBbXSwgZS5ub3RpZmllZCA9ICExLCB0ICYmICFlLnJlamVjdGlvbiAmJiAkKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBYID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG87CiAgICAgICAgICAgICAgICAgICAgICAgIHogPyAoKHIgPSBGLmNyZWF0ZUV2ZW50KCdFdmVudCcpKS5wcm9taXNlID0gdCwgci5yZWFzb24gPSBuLCByLmluaXRFdmVudChlLCAhMSwgITApLCBjLmRpc3BhdGNoRXZlbnQocikpIDogciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb21pc2U6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFzb246IG4KICAgICAgICAgICAgICAgICAgICAgICAgfSwgIVcgJiYgKG8gPSBjWydvbicgKyBlXSkgPyBvKHIpIDogJ3VuaGFuZGxlZHJlamVjdGlvbicgPT09IGUgJiYgTygnVW5oYW5kbGVkIHByb21pc2UgcmVqZWN0aW9uJywgbik7CiAgICAgICAgICAgICAgICAgICAgfSwgJCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFMuY2FsbChjLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IGUuZmFjYWRlLCByID0gZS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlZShlKSAmJiAodCA9IEwoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ID8gRy5lbWl0KCd1bmhhbmRsZWRSZWplY3Rpb24nLCByLCBuKSA6IFgoJ3VuaGFuZGxlZHJlamVjdGlvbicsIG4sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlLnJlamVjdGlvbiA9IHggfHwgZWUoZSkgPyAyIDogMSwgdC5lcnJvcikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgdC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMSAhPT0gZS5yZWplY3Rpb24gJiYgIWUucGFyZW50OwogICAgICAgICAgICAgICAgICAgIH0sIHRlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgUy5jYWxsKGMsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5mYWNhZGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ID8gRy5lbWl0KCdyZWplY3Rpb25IYW5kbGVkJywgdCkgOiBYKCdyZWplY3Rpb25oYW5kbGVkJywgdCwgZS52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIG5lID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQsIHIsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIHJlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZS5kb25lIHx8IChlLmRvbmUgPSAhMCwgbiAmJiAoZSA9IG4pLCBlLnZhbHVlID0gdCwgZS5zdGF0ZSA9IDIsIFooZSwgITApKTsKICAgICAgICAgICAgICAgICAgICB9LCBvZSA9IGZ1bmN0aW9uIGUodCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXQuZG9uZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5kb25lID0gITAsIHIgJiYgKHQgPSByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuZmFjYWRlID09PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBEKCdQcm9taXNlIGNhblwndCBiZSByZXNvbHZlZCBpdHNlbGYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IFEobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA/IHcoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHsgZG9uZTogITEgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uY2FsbChuLCBuZShlLCByLCB0KSwgbmUocmUsIHIsIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmUociwgaSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6ICh0LnZhbHVlID0gbiwgdC5zdGF0ZSA9IDEsIFoodCwgITEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZSh7IGRvbmU6ICExIH0sIGksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIEogJiYgKE0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIG0odGhpcywgTSwgViksIGcoZSksIHIuY2FsbCh0aGlzKTsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgZShuZShvZSwgdCksIG5lKHJlLCB0KSk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICByZSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCAociA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaih0aGlzLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IFYsCiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICExLAogICAgICAgICAgICAgICAgICAgICAgICBub3RpZmllZDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmVudDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWN0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdGlvbjogITEsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiAwLAogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KS5wcm90b3R5cGUgPSBkKE0ucHJvdG90eXBlLCB7CiAgICAgICAgICAgICAgICAgICAgdGhlbjogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBCKHRoaXMpLCByID0gcShfKHRoaXMsIE0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIub2sgPSAnZnVuY3Rpb24nICE9IHR5cGVvZiBlIHx8IGUsIHIuZmFpbCA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIHQgJiYgdCwgci5kb21haW4gPSB4ID8gRy5kb21haW4gOiB2b2lkIDAsIG4ucGFyZW50ID0gITAsIG4ucmVhY3Rpb25zLnB1c2gociksIDAgIT0gbi5zdGF0ZSAmJiBaKG4sICExKSwgci5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgY2F0Y2g6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRoZW4odm9pZCAwLCBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyByKCksIHQgPSBVKGUpOwogICAgICAgICAgICAgICAgICAgIHRoaXMucHJvbWlzZSA9IGUsIHRoaXMucmVzb2x2ZSA9IG5lKG9lLCB0KSwgdGhpcy5yZWplY3QgPSBuZShyZSwgdCk7CiAgICAgICAgICAgICAgICB9LCBBLmYgPSBxID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gTSB8fCBlID09PSBpID8gbmV3IG8oZSkgOiBZKGUpOwogICAgICAgICAgICAgICAgfSwgdSB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBsIHx8IChzID0gbC5wcm90b3R5cGUudGhlbiwgcChsLnByb3RvdHlwZSwgJ3RoZW4nLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpczsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IE0oZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcy5jYWxsKG4sIGUsIHQpOwogICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZSwgdCk7CiAgICAgICAgICAgICAgICB9LCB7IHVuc2FmZTogITAgfSksICdmdW5jdGlvbicgPT0gdHlwZW9mIEggJiYgYSh7CiAgICAgICAgICAgICAgICAgICAgZ2xvYmFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6ICEwCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZmV0Y2g6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJKE0sIEguYXBwbHkoYywgYXJndW1lbnRzKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSkpKSwgYSh7CiAgICAgICAgICAgICAgICAgICAgZ2xvYmFsOiAhMCwKICAgICAgICAgICAgICAgICAgICB3cmFwOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IEoKICAgICAgICAgICAgICAgIH0sIHsgUHJvbWlzZTogTSB9KSwgaChNLCBWLCAhMSwgITApLCB2KFYpLCBpID0gZihWKSwgYSh7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBWLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogSgogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHJlamVjdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBxKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5yZWplY3QuY2FsbCh2b2lkIDAsIGUpLCB0LnByb21pc2U7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSksIGEoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogViwKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IHUgfHwgSgogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHJlc29sdmU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJKHUgJiYgdGhpcyA9PT0gaSA/IE0gOiB0aGlzLCBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgYSh7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBWLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogSwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGFsbDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLCBuID0gcSh0KSwgciA9IG4ucmVzb2x2ZSwgbyA9IG4ucmVqZWN0LCBpID0gTChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBnKHQucmVzb2x2ZSksIGkgPSBbXSwgcyA9IDAsIGEgPSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEUoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBzKyssIGMgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKHZvaWQgMCksIGErKywgbi5jYWxsKHQsIGUpLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgfHwgKGMgPSAhMCwgaVt1XSA9IGUsIC0tYSB8fCByKGkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIC0tYSB8fCByKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLmVycm9yICYmIG8oaS52YWx1ZSksIG4ucHJvbWlzZTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHJhY2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcywgbiA9IHEodCksIHIgPSBuLnJlamVjdCwgbyA9IEwoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZyh0LnJlc29sdmUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEUoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby5jYWxsKHQsIGUpLnRoZW4obi5yZXNvbHZlLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5lcnJvciAmJiByKG8udmFsdWUpLCBuLnByb21pc2U7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciwgbywgaSwgcywgYSwgdSwgYywgZiwgbCA9IG4oNiksIHAgPSBuKDM1KS5mLCBkID0gbigxMDUpLnNldCwgaCA9IG4oMTA2KSwgdiA9IG4oNzYpLCB5ID0gbC5NdXRhdGlvbk9ic2VydmVyIHx8IGwuV2ViS2l0TXV0YXRpb25PYnNlcnZlciwgZyA9IGwuZG9jdW1lbnQsIG0gPSBsLnByb2Nlc3MsIGIgPSBsLlByb21pc2UsIEUgPSBwKGwsICdxdWV1ZU1pY3JvdGFzaycpLCBDID0gRSAmJiBFLnZhbHVlOwogICAgICAgICAgICAgICAgQyB8fCAociA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSwgdDsKICAgICAgICAgICAgICAgICAgICBmb3IgKHYgJiYgKGUgPSBtLmRvbWFpbikgJiYgZS5leGl0KCk7IG87KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBvLmZuLCBvID0gby5uZXh0OwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBvID8gcygpIDogaSA9IHZvaWQgMCwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpID0gdm9pZCAwLCBlICYmIGUuZW50ZXIoKTsKICAgICAgICAgICAgICAgIH0sICFoICYmICF2ICYmIHkgJiYgZyA/IChhID0gITAsIHUgPSBnLmNyZWF0ZVRleHROb2RlKCcnKSwgbmV3IHkocikub2JzZXJ2ZSh1LCB7IGNoYXJhY3RlckRhdGE6ICEwIH0pLCBzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHUuZGF0YSA9IGEgPSAhYTsKICAgICAgICAgICAgICAgIH0pIDogYiAmJiBiLnJlc29sdmUgPyAoYyA9IGIucmVzb2x2ZSh2b2lkIDApLCBmID0gYy50aGVuLCBzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGYuY2FsbChjLCByKTsKICAgICAgICAgICAgICAgIH0pIDogcyA9IHYgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgbS5uZXh0VGljayhyKTsKICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZC5jYWxsKGwsIHIpOwogICAgICAgICAgICAgICAgfSksIGUuZXhwb3J0cyA9IEMgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgZm46IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IHZvaWQgMAogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgaSAmJiAoaS5uZXh0ID0gdCksIG8gfHwgKG8gPSB0LCBzKCkpLCBpID0gdDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gci5jb25zb2xlOwogICAgICAgICAgICAgICAgICAgIG4gJiYgbi5lcnJvciAmJiAoMSA9PT0gYXJndW1lbnRzLmxlbmd0aCA/IG4uZXJyb3IoZSkgOiBuLmVycm9yKGUsIHQpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbigxMDQpLCBzID0gbigxMSksIGEgPSBuKDkpLCB1ID0gbigyMCksIGMgPSBuKDEwNyksIGYgPSBuKDIzKTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1Byb21pc2UnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6ICEhaSAmJiBzKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaS5wcm90b3R5cGUuZmluYWxseS5jYWxsKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZW46IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGZpbmFsbHk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdSh0aGlzLCBhKCdQcm9taXNlJykpLCBuID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudGhlbihuID8gZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjKHQsIGUoKSkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGUsIG4gPyBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGModCwgZSgpKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgbyB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBpIHx8IGkucHJvdG90eXBlLmZpbmFsbHkgfHwgZihpLnByb3RvdHlwZSwgJ2ZpbmFsbHknLCBhKCdQcm9taXNlJykucHJvdG90eXBlLmZpbmFsbHkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDk3KSwgbyA9IG4oOTkpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gcignU2V0JywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0aGlzLCBhcmd1bWVudHMubGVuZ3RoID8gYXJndW1lbnRzWzBdIDogdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgbyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDEwOCksIGkgPSBuKDMzKTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogIW4oMTA5KSgnaW5jbHVkZXMnKQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGluY2x1ZGVzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF+U3RyaW5nKGkodGhpcykpLmluZGV4T2YobyhlKSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEyKSwgbyA9IG4oMzYpLCBpID0gbig3KSgnbWF0Y2gnKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoZSkgJiYgKHZvaWQgMCAhPT0gKHQgPSBlW2ldKSA/ICEhdCA6ICdSZWdFeHAnID09IG8oZSkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigyMDQpLmNoYXJBdCwgbyA9IG4oMzQpLCBpID0gbig3NCksIHMgPSBvLnNldCwgYSA9IG8uZ2V0dGVyRm9yKCdTdHJpbmcgSXRlcmF0b3InKTsKICAgICAgICAgICAgICAgIGkoU3RyaW5nLCAnU3RyaW5nJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBzKHRoaXMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ1N0cmluZyBJdGVyYXRvcicsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZzogU3RyaW5nKGUpLAogICAgICAgICAgICAgICAgICAgICAgICBpbmRleDogMAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlLCB0ID0gYSh0aGlzKSwgbiA9IHQuc3RyaW5nLCBvID0gdC5pbmRleDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyA+PSBuLmxlbmd0aCA/IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITAKICAgICAgICAgICAgICAgICAgICB9IDogKGUgPSByKG4sIG8pLCB0LmluZGV4ICs9IGUubGVuZ3RoLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzgpLCBvID0gbigzMyksIGkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpLCBzLCBhID0gU3RyaW5nKG8odCkpLCB1ID0gcihuKSwgYyA9IGEubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUgPCAwIHx8IHUgPj0gYyA/IGUgPyAnJyA6IHZvaWQgMCA6IChpID0gYS5jaGFyQ29kZUF0KHUpKSA8IDU1Mjk2IHx8IGkgPiA1NjMxOSB8fCB1ICsgMSA9PT0gYyB8fCAocyA9IGEuY2hhckNvZGVBdCh1ICsgMSkpIDwgNTYzMjAgfHwgcyA+IDU3MzQzID8gZSA/IGEuY2hhckF0KHUpIDogaSA6IGUgPyBhLnNsaWNlKHUsIHUgKyAyKSA6IHMgLSA1NjMyMCArIChpIC0gNTUyOTYgPDwgMTApICsgNjU1MzY7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBjb2RlQXQ6IGkoITEpLAogICAgICAgICAgICAgICAgICAgIGNoYXJBdDogaSghMCkKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDEpKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTdHJpbmcnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMAogICAgICAgICAgICAgICAgfSwgeyByZXBlYXQ6IG4oMjA2KSB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigzOCksIG8gPSBuKDMzKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9ICcnLnJlcGVhdCB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gU3RyaW5nKG8odGhpcykpLCBuID0gJycsIGkgPSByKGUpOwogICAgICAgICAgICAgICAgICAgIGlmIChpIDwgMCB8fCBpID09IDEgLyAwKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBSYW5nZUVycm9yKCdXcm9uZyBudW1iZXIgb2YgcmVwZXRpdGlvbnMnKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgaSA+IDA7IChpID4+Pj0gMSkgJiYgKHQgKz0gdCkpCiAgICAgICAgICAgICAgICAgICAgICAgIDEgJiBpICYmIChuICs9IHQpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMzUpLmYsIGkgPSBuKDI0KSwgcyA9IG4oMTA4KSwgYSA9IG4oMzMpLCB1ID0gbigxMDkpLCBjID0gbigzKSwgZiA9ICcnLnN0YXJ0c1dpdGgsIGwgPSBNYXRoLm1pbiwgcCA9IHUoJ3N0YXJ0c1dpdGgnKTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogISghYyAmJiAhcCAmJiAhIWZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBvKFN0cmluZy5wcm90b3R5cGUsICdzdGFydHNXaXRoJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICFlLndyaXRhYmxlOwogICAgICAgICAgICAgICAgICAgIH0oKSkgJiYgIXAKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBzdGFydHNXaXRoOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFN0cmluZyhhKHRoaXMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpKGwoYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIHQubGVuZ3RoKSksIHIgPSBTdHJpbmcoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmID8gZi5jYWxsKHQsIHIsIG4pIDogdC5zbGljZShuLCBuICsgci5sZW5ndGgpID09PSByOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigyMDkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig3NSksIGkgPSBuKDczKSwgcyA9IG4oMzkpLCBhID0gbigyMiksIHUgPSBuKDMyKSwgYyA9IG4oNCksIGYgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG4gaW5zdGFuY2VvZiBmKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgZihlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgaSAmJiAobiA9IGkobmV3IEVycm9yKHZvaWQgMCksIG8obikpKSwgdm9pZCAwICE9PSB0ICYmIGEobiwgJ21lc3NhZ2UnLCBTdHJpbmcodCkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyhlLCByLnB1c2gsIHsgdGhhdDogciB9KSwgYShuLCAnZXJyb3JzJywgciksIG47CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGYucHJvdG90eXBlID0gcyhFcnJvci5wcm90b3R5cGUsIHsKICAgICAgICAgICAgICAgICAgICBjb25zdHJ1Y3RvcjogdSg1LCBmKSwKICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiB1KDUsICcnKSwKICAgICAgICAgICAgICAgICAgICBuYW1lOiB1KDUsICdBZ2dyZWdhdGVFcnJvcicpCiAgICAgICAgICAgICAgICB9KSwgcih7IGdsb2JhbDogITAgfSwgeyBBZ2dyZWdhdGVFcnJvcjogZiB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMyksIGkgPSBuKDExMCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBkZWxldGVBbGw6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMyksIGkgPSBuKDIpLCBzID0gbig4KSwgYSA9IG4oMjEpLCB1ID0gbig0KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ01hcCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGV2ZXJ5OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkodGhpcyksIG4gPSBhKHQpLCByID0gcyhlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhdShuLCBmdW5jdGlvbiAoZSwgbiwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyKG4sIGUsIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSU5URVJSVVBURUQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnN0b3BwZWQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbig5KSwgcyA9IG4oMiksIGEgPSBuKDUpLCB1ID0gbig4KSwgYyA9IG4oMjApLCBmID0gbigyMSksIGwgPSBuKDQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnTWFwJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZmlsdGVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHModGhpcyksIG4gPSBmKHQpLCByID0gdShlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyksIG8gPSBuZXcgKGModCwgaSgnTWFwJykpKSgpLCBwID0gYShvLnNldCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKG4sIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByKG4sIGUsIHQpICYmIHAuY2FsbChvLCBlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgQVNfRU5UUklFUzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG87CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbigyKSwgcyA9IG4oOCksIGEgPSBuKDIxKSwgdSA9IG4oNCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBmaW5kOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkodGhpcyksIG4gPSBhKHQpLCByID0gcyhlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1KG4sIGZ1bmN0aW9uIChlLCBuLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocihuLCBlLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgQVNfRU5UUklFUzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTlRFUlJVUFRFRDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVzdWx0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigzKSwgaSA9IG4oMiksIHMgPSBuKDgpLCBhID0gbigyMSksIHUgPSBuKDQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnTWFwJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZmluZEtleTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpKHRoaXMpLCBuID0gYSh0KSwgciA9IHMoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShuLCBmdW5jdGlvbiAoZSwgbiwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIobiwgZSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSU5URVJSVVBURUQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlc3VsdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMSkoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ01hcCcsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAKICAgICAgICAgICAgICAgIH0sIHsgZnJvbTogbigxMTEpIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oNSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZ3JvdXBCeTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBuZXcgdGhpcygpOwogICAgICAgICAgICAgICAgICAgICAgICBpKHQpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGkobi5oYXMpLCBzID0gaShuLmdldCksIGEgPSBpKG4uc2V0KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbChuLCBvKSA/IHMuY2FsbChuLCBvKS5wdXNoKGUpIDogYS5jYWxsKG4sIG8sIFtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigzKSwgaSA9IG4oMiksIHMgPSBuKDIxKSwgYSA9IG4oMjE4KSwgdSA9IG4oNCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBpbmNsdWRlczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUocyhpKHRoaXMpKSwgZnVuY3Rpb24gKHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhKG4sIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSU5URVJSVVBURUQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnN0b3BwZWQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSB0IHx8IGUgIT0gZSAmJiB0ICE9IHQ7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oNSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAga2V5Qnk6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IHRoaXMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBpKG4uc2V0KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbChuLCB0KGUpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbigyKSwgcyA9IG4oMjEpLCBhID0gbig0KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ01hcCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGtleU9mOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShzKGkodGhpcykpLCBmdW5jdGlvbiAodCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSU5URVJSVVBURUQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlc3VsdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMyksIGkgPSBuKDkpLCBzID0gbigyKSwgYSA9IG4oNSksIHUgPSBuKDgpLCBjID0gbigyMCksIGYgPSBuKDIxKSwgbCA9IG4oNCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBtYXBLZXlzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHModGhpcyksIG4gPSBmKHQpLCByID0gdShlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyksIG8gPSBuZXcgKGModCwgaSgnTWFwJykpKSgpLCBwID0gYShvLnNldCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKG4sIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLmNhbGwobywgcihuLCBlLCB0KSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigzKSwgaSA9IG4oOSksIHMgPSBuKDIpLCBhID0gbig1KSwgdSA9IG4oOCksIGMgPSBuKDIwKSwgZiA9IG4oMjEpLCBsID0gbig0KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ01hcCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIG1hcFZhbHVlczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBzKHRoaXMpLCBuID0gZih0KSwgciA9IHUoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpLCBvID0gbmV3IChjKHQsIGkoJ01hcCcpKSkoKSwgcCA9IGEoby5zZXQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbChuLCBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcC5jYWxsKG8sIGUsIHIobiwgZSwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBBU19FTlRSSUVTOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElTX0lURVJBVE9SOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgbzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMyksIGkgPSBuKDIpLCBzID0gbig1KSwgYSA9IG4oNCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBtZXJnZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IGkodGhpcyksIG4gPSBzKHQuc2V0KSwgciA9IDA7IHIgPCBhcmd1bWVudHMubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoYXJndW1lbnRzW3IrK10sIG4sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGF0OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDEpKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwCiAgICAgICAgICAgICAgICB9LCB7IG9mOiBuKDExMikgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbigyKSwgcyA9IG4oNSksIGEgPSBuKDIxKSwgdSA9IG4oNCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICByZWR1Y2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaSh0aGlzKSwgbiA9IGEodCksIHIgPSBhcmd1bWVudHMubGVuZ3RoIDwgMiwgbyA9IHIgPyB2b2lkIDAgOiBhcmd1bWVudHNbMV07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzKGUpLCB1KG4sIGZ1bmN0aW9uIChuLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA/IChyID0gITEsIG8gPSBpKSA6IG8gPSBlKG8sIGksIG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElTX0lURVJBVE9SOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ1JlZHVjZSBvZiBlbXB0eSBtYXAgd2l0aCBubyBpbml0aWFsIHZhbHVlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigzKSwgaSA9IG4oMiksIHMgPSBuKDgpLCBhID0gbigyMSksIHUgPSBuKDQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnTWFwJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgc29tZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpKHRoaXMpLCBuID0gYSh0KSwgciA9IHMoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShuLCBmdW5jdGlvbiAoZSwgbiwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIobiwgZSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgQVNfRU5UUklFUzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTlRFUlJVUFRFRDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSkuc3RvcHBlZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMyksIGkgPSBuKDIpLCBzID0gbig1KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ01hcCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHVwZGF0ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpKHRoaXMpLCByID0gYXJndW1lbnRzLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgcyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBuLmhhcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFvICYmIHIgPCAzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKCdVcGRhdGluZyBhYnNlbnQgdmFsdWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBvID8gbi5nZXQoZSkgOiBzKHIgPiAyID8gYXJndW1lbnRzWzJdIDogdm9pZCAwKShlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uc2V0KGUsIHQoYSwgZSwgbikpLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigyMjkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig1KSwgaSA9IG4oNDEpLCBzID0gbig1MCksIGEgPSBuKDQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnUHJvbWlzZScsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBhbGxTZXR0bGVkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMsIG4gPSBpLmYodCksIHIgPSBuLnJlc29sdmUsIHUgPSBuLnJlamVjdCwgYyA9IHMoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbyh0LnJlc29sdmUpLCBpID0gW10sIHMgPSAwLCB1ID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gcysrLCBhID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkucHVzaCh2b2lkIDApLCB1KyssIG4uY2FsbCh0LCBlKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhIHx8IChhID0gITAsIGlbb10gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiAnZnVsZmlsbGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgLS11IHx8IHIoaSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSB8fCAoYSA9ICEwLCBpW29dID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogJ3JlamVjdGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFzb246IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIC0tdSB8fCByKGkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIC0tdSB8fCByKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmVycm9yICYmIHUoYy52YWx1ZSksIG4ucHJvbWlzZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMjMxKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNSksIGkgPSBuKDkpLCBzID0gbig0MSksIGEgPSBuKDUwKSwgdSA9IG4oNCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdQcm9taXNlJywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMAogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGFueTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLCBuID0gcy5mKHQpLCByID0gbi5yZXNvbHZlLCBjID0gbi5yZWplY3QsIGYgPSBhKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG8odC5yZXNvbHZlKSwgcyA9IFtdLCBhID0gMCwgZiA9IDEsIGwgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1KGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gYSsrLCB1ID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMucHVzaCh2b2lkIDApLCBmKyssIG4uY2FsbCh0LCBlKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1IHx8IGwgfHwgKGwgPSAhMCwgcihlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1IHx8IGwgfHwgKHUgPSAhMCwgc1tvXSA9IGUsIC0tZiB8fCBjKG5ldyAoaSgnQWdncmVnYXRlRXJyb3InKSkocywgJ05vIG9uZSBwcm9taXNlIHJlc29sdmVkJykpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIC0tZiB8fCBjKG5ldyAoaSgnQWdncmVnYXRlRXJyb3InKSkocywgJ05vIG9uZSBwcm9taXNlIHJlc29sdmVkJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmLmVycm9yICYmIGMoZi52YWx1ZSksIG4ucHJvbWlzZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNDEpLCBpID0gbig1MCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdQcm9taXNlJywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMAogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHRyeTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBvLmYodGhpcyksIG4gPSBpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG4uZXJyb3IgPyB0LnJlamVjdCA6IHQucmVzb2x2ZSkobi52YWx1ZSksIHQucHJvbWlzZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMyksIGkgPSBuKDIzNCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBhZGRBbGw6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigyKSwgbyA9IG4oNSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHIodGhpcyksIHQgPSBvKGUuYWRkKSwgbiA9IDAsIGkgPSBhcmd1bWVudHMubGVuZ3RoOyBuIDwgaTsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICB0LmNhbGwoZSwgYXJndW1lbnRzW25dKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbigxMTApOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlQWxsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbig5KSwgcyA9IG4oMiksIGEgPSBuKDUpLCB1ID0gbigyMCksIGMgPSBuKDQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZGlmZmVyZW5jZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBzKHRoaXMpLCBuID0gbmV3ICh1KHQsIGkoJ1NldCcpKSkodCksIHIgPSBhKG4uZGVsZXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbChuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbigyKSwgcyA9IG4oOCksIGEgPSBuKDI5KSwgdSA9IG4oNCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBldmVyeTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpKHRoaXMpLCBuID0gYSh0KSwgciA9IHMoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXUobiwgZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcihlLCBlLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbigpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTlRFUlJVUFRFRDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSkuc3RvcHBlZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMyksIGkgPSBuKDkpLCBzID0gbigyKSwgYSA9IG4oNSksIHUgPSBuKDgpLCBjID0gbigyMCksIGYgPSBuKDI5KSwgbCA9IG4oNCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBmaWx0ZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcyh0aGlzKSwgbiA9IGYodCksIHIgPSB1KGUsIGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwLCAzKSwgbyA9IG5ldyAoYyh0LCBpKCdTZXQnKSkpKCksIHAgPSBhKG8uYWRkKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwobiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoZSwgZSwgdCkgJiYgcC5jYWxsKG8sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7IElTX0lURVJBVE9SOiAhMCB9KSwgbzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMyksIGkgPSBuKDIpLCBzID0gbig4KSwgYSA9IG4oMjkpLCB1ID0gbig0KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGZpbmQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaSh0aGlzKSwgbiA9IGEodCksIHIgPSBzKGUsIGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwLCAzKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUobiwgZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKGUsIGUsIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTlRFUlJVUFRFRDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVzdWx0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxKSh7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMAogICAgICAgICAgICAgICAgfSwgeyBmcm9tOiBuKDExMSkgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbig5KSwgcyA9IG4oMiksIGEgPSBuKDUpLCB1ID0gbigyMCksIGMgPSBuKDQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgaW50ZXJzZWN0aW9uOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHModGhpcyksIG4gPSBuZXcgKHUodCwgaSgnU2V0JykpKSgpLCByID0gYSh0LmhhcyksIG8gPSBhKG4uYWRkKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbCh0LCBlKSAmJiBvLmNhbGwobiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigzKSwgaSA9IG4oMiksIHMgPSBuKDUpLCBhID0gbig0KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGlzRGlzam9pbnRGcm9tOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkodGhpcyksIG4gPSBzKHQuaGFzKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFhKGUsIGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoITAgPT09IG4uY2FsbCh0LCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7IElOVEVSUlVQVEVEOiAhMCB9KS5zdG9wcGVkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigzKSwgaSA9IG4oOSksIHMgPSBuKDIpLCBhID0gbig1KSwgdSA9IG4oNzcpLCBjID0gbig0KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGlzU3Vic2V0T2Y6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdSh0aGlzKSwgbiA9IHMoZSksIHIgPSBuLmhhczsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgIT0gdHlwZW9mIHIgJiYgKG4gPSBuZXcgKGkoJ1NldCcpKShlKSwgciA9IGEobi5oYXMpKSwgIWModCwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghMSA9PT0gci5jYWxsKG4sIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElTX0lURVJBVE9SOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElOVEVSUlVQVEVEOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KS5zdG9wcGVkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigzKSwgaSA9IG4oMiksIHMgPSBuKDUpLCBhID0gbig0KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGlzU3VwZXJzZXRPZjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpKHRoaXMpLCBuID0gcyh0Lmhhcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhYShlLCBmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCExID09PSBuLmNhbGwodCwgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgeyBJTlRFUlJVUFRFRDogITAgfSkuc3RvcHBlZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMyksIGkgPSBuKDIpLCBzID0gbigyOSksIGEgPSBuKDQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgam9pbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpKHRoaXMpLCBuID0gcyh0KSwgciA9IHZvaWQgMCA9PT0gZSA/ICcsJyA6IFN0cmluZyhlKSwgbyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShuLCBvLnB1c2gsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoYXQ6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG8uam9pbihyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMyksIGkgPSBuKDkpLCBzID0gbigyKSwgYSA9IG4oNSksIHUgPSBuKDgpLCBjID0gbigyMCksIGYgPSBuKDI5KSwgbCA9IG4oNCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBtYXA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcyh0aGlzKSwgbiA9IGYodCksIHIgPSB1KGUsIGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwLCAzKSwgbyA9IG5ldyAoYyh0LCBpKCdTZXQnKSkpKCksIHAgPSBhKG8uYWRkKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwobiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAuY2FsbChvLCByKGUsIGUsIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgeyBJU19JVEVSQVRPUjogITAgfSksIG87CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDEpKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwCiAgICAgICAgICAgICAgICB9LCB7IG9mOiBuKDExMikgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbigyKSwgcyA9IG4oNSksIGEgPSBuKDI5KSwgdSA9IG4oNCk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICByZWR1Y2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaSh0aGlzKSwgbiA9IGEodCksIHIgPSBhcmd1bWVudHMubGVuZ3RoIDwgMiwgbyA9IHIgPyB2b2lkIDAgOiBhcmd1bWVudHNbMV07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzKGUpLCB1KG4sIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA/IChyID0gITEsIG8gPSBuKSA6IG8gPSBlKG8sIG4sIG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeyBJU19JVEVSQVRPUjogITAgfSksIHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ1JlZHVjZSBvZiBlbXB0eSBzZXQgd2l0aCBubyBpbml0aWFsIHZhbHVlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigzKSwgaSA9IG4oMiksIHMgPSBuKDgpLCBhID0gbigyOSksIHUgPSBuKDQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgc29tZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpKHRoaXMpLCBuID0gYSh0KSwgciA9IHMoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShuLCBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIoZSwgZSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSU5URVJSVVBURUQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnN0b3BwZWQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbig5KSwgcyA9IG4oMiksIGEgPSBuKDUpLCB1ID0gbigyMCksIGMgPSBuKDQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgc3ltbWV0cmljRGlmZmVyZW5jZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBzKHRoaXMpLCBuID0gbmV3ICh1KHQsIGkoJ1NldCcpKSkodCksIHIgPSBhKG4uZGVsZXRlKSwgbyA9IGEobi5hZGQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyhlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgci5jYWxsKG4sIGUpIHx8IG8uY2FsbChuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDMpLCBpID0gbig5KSwgcyA9IG4oMiksIGEgPSBuKDUpLCB1ID0gbigyMCksIGMgPSBuKDQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgdW5pb246IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcyh0aGlzKSwgbiA9IG5ldyAodSh0LCBpKCdTZXQnKSkpKHQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyhlLCBhKG4uYWRkKSwgeyB0aGF0OiBuIH0pLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxMCkoJ2Rpc3Bvc2UnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTApKCdvYnNlcnZhYmxlJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDEwKSgncGF0dGVybk1hdGNoJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNiksIG8gPSBuKDI1NiksIGkgPSBuKDI1NyksIHMgPSBuKDIyKSwgYSA9IG4oNyksIHUgPSBhKCdpdGVyYXRvcicpLCBjID0gYSgndG9TdHJpbmdUYWcnKSwgZiA9IGkudmFsdWVzOwogICAgICAgICAgICAgICAgZm9yICh2YXIgbCBpbiBvKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSByW2xdLCBkID0gcCAmJiBwLnByb3RvdHlwZTsKICAgICAgICAgICAgICAgICAgICBpZiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZFt1XSAhPT0gZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyhkLCB1LCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW3VdID0gZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRbY10gfHwgcyhkLCBjLCBsKSwgb1tsXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGggaW4gaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZFtoXSAhPT0gaVtoXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMoZCwgaCwgaVtoXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRbaF0gPSBpW2hdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgIENTU1J1bGVMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIENTU1N0eWxlRGVjbGFyYXRpb246IDAsCiAgICAgICAgICAgICAgICAgICAgQ1NTVmFsdWVMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIENsaWVudFJlY3RMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIERPTVJlY3RMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIERPTVN0cmluZ0xpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgRE9NVG9rZW5MaXN0OiAxLAogICAgICAgICAgICAgICAgICAgIERhdGFUcmFuc2Zlckl0ZW1MaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIEZpbGVMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIEhUTUxBbGxDb2xsZWN0aW9uOiAwLAogICAgICAgICAgICAgICAgICAgIEhUTUxDb2xsZWN0aW9uOiAwLAogICAgICAgICAgICAgICAgICAgIEhUTUxGb3JtRWxlbWVudDogMCwKICAgICAgICAgICAgICAgICAgICBIVE1MU2VsZWN0RWxlbWVudDogMCwKICAgICAgICAgICAgICAgICAgICBNZWRpYUxpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgTWltZVR5cGVBcnJheTogMCwKICAgICAgICAgICAgICAgICAgICBOYW1lZE5vZGVNYXA6IDAsCiAgICAgICAgICAgICAgICAgICAgTm9kZUxpc3Q6IDEsCiAgICAgICAgICAgICAgICAgICAgUGFpbnRSZXF1ZXN0TGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBQbHVnaW46IDAsCiAgICAgICAgICAgICAgICAgICAgUGx1Z2luQXJyYXk6IDAsCiAgICAgICAgICAgICAgICAgICAgU1ZHTGVuZ3RoTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBTVkdOdW1iZXJMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIFNWR1BhdGhTZWdMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIFNWR1BvaW50TGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBTVkdTdHJpbmdMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIFNWR1RyYW5zZm9ybUxpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgU291cmNlQnVmZmVyTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBTdHlsZVNoZWV0TGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBUZXh0VHJhY2tDdWVMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIFRleHRUcmFja0xpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgVG91Y2hMaXN0OiAwCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI2KSwgbyA9IG4oNDkpLCBpID0gbig0MCksIHMgPSBuKDM0KSwgYSA9IG4oNzQpLCB1ID0gcy5zZXQsIGMgPSBzLmdldHRlckZvcignQXJyYXkgSXRlcmF0b3InKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGEoQXJyYXksICdBcnJheScsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdSh0aGlzLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdBcnJheSBJdGVyYXRvcicsCiAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldDogcihlKSwKICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIGtpbmQ6IHQKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGModGhpcyksIHQgPSBlLnRhcmdldCwgbiA9IGUua2luZCwgciA9IGUuaW5kZXgrKzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXQgfHwgciA+PSB0Lmxlbmd0aCA/IChlLnRhcmdldCA9IHZvaWQgMCwgewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgIH0pIDogJ2tleXMnID09IG4gPyB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiByLAogICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMQogICAgICAgICAgICAgICAgICAgIH0gOiAndmFsdWVzJyA9PSBuID8gewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdFtyXSwKICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICB9IDogewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbcl0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgJ3ZhbHVlcycpLCBpLkFyZ3VtZW50cyA9IGkuQXJyYXksIG8oJ2tleXMnKSwgbygndmFsdWVzJyksIG8oJ2VudHJpZXMnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3QucHJvdG90eXBlLCBuID0gdC5oYXNPd25Qcm9wZXJ0eSwgciA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBTeW1ib2wgPyBTeW1ib2wgOiB7fSwgbyA9IHIuaXRlcmF0b3IgfHwgJ0BAaXRlcmF0b3InLCBpID0gci5hc3luY0l0ZXJhdG9yIHx8ICdAQGFzeW5jSXRlcmF0b3InLCBzID0gci50b1N0cmluZ1RhZyB8fCAnQEB0b1N0cmluZ1RhZyc7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGVbdF07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEoe30sICcnKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChPKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbdF0gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0ICYmIHQucHJvdG90eXBlIGluc3RhbmNlb2YgbCA/IHQgOiBsLCBpID0gT2JqZWN0LmNyZWF0ZShvLnByb3RvdHlwZSksIHMgPSBuZXcgUyhyIHx8IFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuX2ludm9rZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICdzdXNwZW5kZWRTdGFydCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2V4ZWN1dGluZycgPT09IHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignR2VuZXJhdG9yIGlzIGFscmVhZHkgcnVubmluZycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnY29tcGxldGVkJyA9PT0gcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3Rocm93JyA9PT0gbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobi5tZXRob2QgPSBvLCBuLmFyZyA9IGk7OykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG4uZGVsZWdhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IEUocywgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhID09PSBmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ25leHQnID09PSBuLm1ldGhvZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uc2VudCA9IG4uX3NlbnQgPSBuLmFyZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoJ3Rocm93JyA9PT0gbi5tZXRob2QpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3VzcGVuZGVkU3RhcnQnID09PSByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IHIgPSAnY29tcGxldGVkJywgbi5hcmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmRpc3BhdGNoRXhjZXB0aW9uKG4uYXJnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmV0dXJuJyA9PT0gbi5tZXRob2QgJiYgbi5hYnJ1cHQoJ3JldHVybicsIG4uYXJnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9ICdleGVjdXRpbmcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IGMoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnbm9ybWFsJyA9PT0gdS50eXBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociA9IG4uZG9uZSA/ICdjb21wbGV0ZWQnIDogJ3N1c3BlbmRlZFlpZWxkJywgdS5hcmcgPT09IGYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB1LmFyZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiBuLmRvbmUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Rocm93JyA9PT0gdS50eXBlICYmIChyID0gJ2NvbXBsZXRlZCcsIG4ubWV0aG9kID0gJ3Rocm93Jywgbi5hcmcgPSB1LmFyZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfShlLCBuLCBzKSwgaTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdub3JtYWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZzogZS5jYWxsKHQsIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChPKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd0aHJvdycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJnOiBPCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGUud3JhcCA9IHU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSB7fTsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IHt9OwogICAgICAgICAgICAgICAgICAgIGhbb10gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSBPYmplY3QuZ2V0UHJvdG90eXBlT2YsIHkgPSB2ICYmIHYodih3KFtdKSkpOwogICAgICAgICAgICAgICAgICAgIHkgJiYgeSAhPT0gdCAmJiBuLmNhbGwoeSwgbykgJiYgKGggPSB5KTsKICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGQucHJvdG90eXBlID0gbC5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKGgpOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0oZSkgewogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbmV4dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAndGhyb3cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3JldHVybicKICAgICAgICAgICAgICAgICAgICAgICAgXS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKGUsIHQsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2ludm9rZSh0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9pbnZva2UgPSBmdW5jdGlvbiAobywgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcygpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHQoZnVuY3Rpb24gKHIsIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIHIobywgaSwgcywgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBjKGVbb10sIGUsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd0aHJvdycgIT09IHUudHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gdS5hcmcsIGwgPSBmLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsICYmICdvYmplY3QnID09PSB0eXBlb2YgbCAmJiBuLmNhbGwobCwgJ19fYXdhaXQnKSA/IHQucmVzb2x2ZShsLl9fYXdhaXQpLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcignbmV4dCcsIGUsIHMsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoJ3Rocm93JywgZSwgcywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiB0LnJlc29sdmUobCkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnZhbHVlID0gZSwgcyhmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigndGhyb3cnLCBlLCBzLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEodS5hcmcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG8sIGksIHIsIHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSByID8gci50aGVuKHMsIHMpIDogcygpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBFKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLml0ZXJhdG9yW3QubWV0aG9kXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuZGVsZWdhdGUgPSBudWxsLCAndGhyb3cnID09PSB0Lm1ldGhvZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLml0ZXJhdG9yLnJldHVybiAmJiAodC5tZXRob2QgPSAncmV0dXJuJywgdC5hcmcgPSB2b2lkIDAsIEUoZSwgdCksICd0aHJvdycgPT09IHQubWV0aG9kKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tZXRob2QgPSAndGhyb3cnLCB0LmFyZyA9IG5ldyBUeXBlRXJyb3IoJ1RoZSBpdGVyYXRvciBkb2VzIG5vdCBwcm92aWRlIGEgXCd0aHJvd1wnIG1ldGhvZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBjKG4sIGUuaXRlcmF0b3IsIHQuYXJnKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd0aHJvdycgPT09IHIudHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lm1ldGhvZCA9ICd0aHJvdycsIHQuYXJnID0gci5hcmcsIHQuZGVsZWdhdGUgPSBudWxsLCBmOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHIuYXJnOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyA/IG8uZG9uZSA/ICh0W2UucmVzdWx0TmFtZV0gPSBvLnZhbHVlLCB0Lm5leHQgPSBlLm5leHRMb2MsICdyZXR1cm4nICE9PSB0Lm1ldGhvZCAmJiAodC5tZXRob2QgPSAnbmV4dCcsIHQuYXJnID0gdm9pZCAwKSwgdC5kZWxlZ2F0ZSA9IG51bGwsIGYpIDogbyA6ICh0Lm1ldGhvZCA9ICd0aHJvdycsIHQuYXJnID0gbmV3IFR5cGVFcnJvcignaXRlcmF0b3IgcmVzdWx0IGlzIG5vdCBhbiBvYmplY3QnKSwgdC5kZWxlZ2F0ZSA9IG51bGwsIGYpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBDKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7IHRyeUxvYzogZVswXSB9OwogICAgICAgICAgICAgICAgICAgICAgICAxIGluIGUgJiYgKHQuY2F0Y2hMb2MgPSBlWzFdKSwgMiBpbiBlICYmICh0LmZpbmFsbHlMb2MgPSBlWzJdLCB0LmFmdGVyTG9jID0gZVszXSksIHRoaXMudHJ5RW50cmllcy5wdXNoKHQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBfKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmNvbXBsZXRpb24gfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgIHQudHlwZSA9ICdub3JtYWwnLCBkZWxldGUgdC5hcmcsIGUuY29tcGxldGlvbiA9IHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnRyeUVudHJpZXMgPSBbeyB0cnlMb2M6ICdyb290JyB9XSwgZS5mb3JFYWNoKEMsIHRoaXMpLCB0aGlzLnJlc2V0KCEwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbb107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5jYWxsKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT09IHR5cGVvZiBlLm5leHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzTmFOKGUubGVuZ3RoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gLTEsIGkgPSBmdW5jdGlvbiB0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7ICsrciA8IGUubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5jYWxsKGUsIHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC52YWx1ZSA9IGVbcl0sIHQuZG9uZSA9ICExLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudmFsdWUgPSB2b2lkIDAsIHQuZG9uZSA9ICEwLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLm5leHQgPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7IG5leHQ6IEkgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gcC5wcm90b3R5cGUgPSBnLmNvbnN0cnVjdG9yID0gZCwgZC5jb25zdHJ1Y3RvciA9IHAsIHAuZGlzcGxheU5hbWUgPSBhKGQsIHMsICdHZW5lcmF0b3JGdW5jdGlvbicpLCBlLmlzR2VuZXJhdG9yRnVuY3Rpb24gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBlICYmIGUuY29uc3RydWN0b3I7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXQgJiYgKHQgPT09IHAgfHwgJ0dlbmVyYXRvckZ1bmN0aW9uJyA9PT0gKHQuZGlzcGxheU5hbWUgfHwgdC5uYW1lKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5tYXJrID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5zZXRQcm90b3R5cGVPZiA/IE9iamVjdC5zZXRQcm90b3R5cGVPZihlLCBkKSA6IChlLl9fcHJvdG9fXyA9IGQsIGEoZSwgcywgJ0dlbmVyYXRvckZ1bmN0aW9uJykpLCBlLnByb3RvdHlwZSA9IE9iamVjdC5jcmVhdGUoZyksIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5hd3JhcCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7IF9fYXdhaXQ6IGUgfTsKICAgICAgICAgICAgICAgICAgICB9LCBtKGIucHJvdG90eXBlKSwgYi5wcm90b3R5cGVbaV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgIH0sIGUuQXN5bmNJdGVyYXRvciA9IGIsIGUuYXN5bmMgPSBmdW5jdGlvbiAodCwgbiwgciwgbywgaSkgewogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGkgJiYgKGkgPSBQcm9taXNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBuZXcgYih1KHQsIG4sIHIsIG8pLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuaXNHZW5lcmF0b3JGdW5jdGlvbihuKSA/IHMgOiBzLm5leHQoKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5kb25lID8gZS52YWx1ZSA6IHMubmV4dCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBtKGcpLCBhKGcsIHMsICdHZW5lcmF0b3InKSwgZ1tvXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgfSwgZy50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0IEdlbmVyYXRvcl0nOwogICAgICAgICAgICAgICAgICAgIH0sIGUua2V5cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucmV2ZXJzZSgpLCBmdW5jdGlvbiBuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHQubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC5wb3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi52YWx1ZSA9IHIsIG4uZG9uZSA9ICExLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uZG9uZSA9ICEwLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGUudmFsdWVzID0gdywgUy5wcm90b3R5cGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0cnVjdG9yOiBTLAogICAgICAgICAgICAgICAgICAgICAgICByZXNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPSAwLCB0aGlzLm5leHQgPSAwLCB0aGlzLnNlbnQgPSB0aGlzLl9zZW50ID0gdm9pZCAwLCB0aGlzLmRvbmUgPSAhMSwgdGhpcy5kZWxlZ2F0ZSA9IG51bGwsIHRoaXMubWV0aG9kID0gJ25leHQnLCB0aGlzLmFyZyA9IHZvaWQgMCwgdGhpcy50cnlFbnRyaWVzLmZvckVhY2goXyksICFlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgaW4gdGhpcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3QnID09PSB0LmNoYXJBdCgwKSAmJiBuLmNhbGwodGhpcywgdCkgJiYgIWlzTmFOKCt0LnNsaWNlKDEpKSAmJiAodGhpc1t0XSA9IHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3A6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZG9uZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnRyeUVudHJpZXNbMF0uY29tcGxldGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndGhyb3cnID09PSBlLnR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZS5hcmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5ydmFsOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBkaXNwYXRjaEV4Y2VwdGlvbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmRvbmUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzLnR5cGUgPSAndGhyb3cnLCBzLmFyZyA9IGUsIHQubmV4dCA9IG4sIHIgJiYgKHQubWV0aG9kID0gJ25leHQnLCB0LmFyZyA9IHZvaWQgMCksICEhcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gPSB0aGlzLnRyeUVudHJpZXMubGVuZ3RoIC0gMTsgbyA+PSAwOyAtLW8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHRoaXMudHJ5RW50cmllc1tvXSwgcyA9IGkuY29tcGxldGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3Jvb3QnID09PSBpLnRyeUxvYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ2VuZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpLnRyeUxvYyA8PSB0aGlzLnByZXYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuLmNhbGwoaSwgJ2NhdGNoTG9jJyksIHUgPSBuLmNhbGwoaSwgJ2ZpbmFsbHlMb2MnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEgJiYgdSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGkuY2F0Y2hMb2MpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoaS5jYXRjaExvYywgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGkuZmluYWxseUxvYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihpLmZpbmFsbHlMb2MpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBpLmNhdGNoTG9jKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGkuY2F0Y2hMb2MsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ3RyeSBzdGF0ZW1lbnQgd2l0aG91dCBjYXRjaCBvciBmaW5hbGx5Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgaS5maW5hbGx5TG9jKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGkuZmluYWxseUxvYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFicnVwdDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSB0aGlzLnRyeUVudHJpZXMubGVuZ3RoIC0gMTsgciA+PSAwOyAtLXIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRoaXMudHJ5RW50cmllc1tyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoby50cnlMb2MgPD0gdGhpcy5wcmV2ICYmIG4uY2FsbChvLCAnZmluYWxseUxvYycpICYmIHRoaXMucHJldiA8IG8uZmluYWxseUxvYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJiYgKCdicmVhaycgPT09IGUgfHwgJ2NvbnRpbnVlJyA9PT0gZSkgJiYgaS50cnlMb2MgPD0gdCAmJiB0IDw9IGkuZmluYWxseUxvYyAmJiAoaSA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBpID8gaS5jb21wbGV0aW9uIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy50eXBlID0gZSwgcy5hcmcgPSB0LCBpID8gKHRoaXMubWV0aG9kID0gJ25leHQnLCB0aGlzLm5leHQgPSBpLmZpbmFsbHlMb2MsIGYpIDogdGhpcy5jb21wbGV0ZShzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY29tcGxldGU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3Rocm93JyA9PT0gZS50eXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGUuYXJnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdicmVhaycgPT09IGUudHlwZSB8fCAnY29udGludWUnID09PSBlLnR5cGUgPyB0aGlzLm5leHQgPSBlLmFyZyA6ICdyZXR1cm4nID09PSBlLnR5cGUgPyAodGhpcy5ydmFsID0gdGhpcy5hcmcgPSBlLmFyZywgdGhpcy5tZXRob2QgPSAncmV0dXJuJywgdGhpcy5uZXh0ID0gJ2VuZCcpIDogJ25vcm1hbCcgPT09IGUudHlwZSAmJiB0ICYmICh0aGlzLm5leHQgPSB0KSwgZjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZmluaXNoOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyB0ID49IDA7IC0tdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcy50cnlFbnRyaWVzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmZpbmFsbHlMb2MgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbXBsZXRlKG4uY29tcGxldGlvbiwgbi5hZnRlckxvYyksIF8obiksIGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGNoOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyB0ID49IDA7IC0tdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcy50cnlFbnRyaWVzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLnRyeUxvYyA9PT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4uY29tcGxldGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd0aHJvdycgPT09IHIudHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByLmFyZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8obik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdpbGxlZ2FsIGNhdGNoIGF0dGVtcHQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZGVsZWdhdGVZaWVsZDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmRlbGVnYXRlID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZXJhdG9yOiB3KGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdE5hbWU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dExvYzogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgJ25leHQnID09PSB0aGlzLm1ldGhvZCAmJiAodGhpcy5hcmcgPSB2b2lkIDApLCBmOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0oZS5leHBvcnRzKTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgcmVnZW5lcmF0b3JSdW50aW1lID0gcjsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG8pIHsKICAgICAgICAgICAgICAgICAgICBGdW5jdGlvbigncicsICdyZWdlbmVyYXRvclJ1bnRpbWUgPSByJykocik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCAociA9IHQuQ21wU3RhdHVzIHx8ICh0LkNtcFN0YXR1cyA9IHt9KSkuU1RVQiA9ICdzdHViJywgci5MT0FESU5HID0gJ2xvYWRpbmcnLCByLkxPQURFRCA9ICdsb2FkZWQnLCByLkVSUk9SID0gJ2Vycm9yJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIChyID0gdC5EaXNwbGF5U3RhdHVzIHx8ICh0LkRpc3BsYXlTdGF0dXMgPSB7fSkpLlZJU0lCTEUgPSAndmlzaWJsZScsIHIuSElEREVOID0gJ2hpZGRlbicsIHIuRElTQUJMRUQgPSAnZGlzYWJsZWQnOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHI7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgKHIgPSB0LkV2ZW50U3RhdHVzIHx8ICh0LkV2ZW50U3RhdHVzID0ge30pKS5UQ19MT0FERUQgPSAndGNsb2FkZWQnLCByLkNNUF9VSV9TSE9XTiA9ICdjbXB1aXNob3duJywgci5VU0VSX0FDVElPTl9DT01QTEVURSA9ICd1c2VyYWN0aW9uY29tcGxldGUnOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNTQpLCBvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ldmVudFF1ZXVlID0gbmV3IE1hcCgpLCB0aGlzLnF1ZXVlTnVtYmVyID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmV2ZW50UXVldWUuc2V0KHRoaXMucXVldWVOdW1iZXIsIGUpLCB0aGlzLnF1ZXVlTnVtYmVyKys7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnJlbW92ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5ldmVudFF1ZXVlLmRlbGV0ZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuZXhlYyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZXZlbnRRdWV1ZS5mb3JFYWNoKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IHIuR2V0VENEYXRhQ29tbWFuZChlLmNhbGxiYWNrLCBlLnBhcmFtLCB0LCBlLm5leHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLmNsZWFyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5xdWV1ZU51bWJlciA9IDAsIHRoaXMuZXZlbnRRdWV1ZS5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZS5wcm90b3R5cGUsICdzaXplJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZXZlbnRRdWV1ZS5zaXplOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkV2ZW50TGlzdGVuZXJRdWV1ZSA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0oKSwgbyA9IHRoaXMgJiYgdGhpcy5fX3JlYWQgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZVtTeW1ib2wuaXRlcmF0b3JdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8sIGkgPSBuLmNhbGwoZSksIHMgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyAodm9pZCAwID09PSB0IHx8IHQtLSA+IDApICYmICEociA9IGkubmV4dCgpKS5kb25lOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnB1c2goci52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSB7IGVycm9yOiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgIXIuZG9uZSAmJiAobiA9IGkucmV0dXJuKSAmJiBuLmNhbGwoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBvLmVycm9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzOwogICAgICAgICAgICAgICAgICAgIH0sIGkgPSB0aGlzICYmIHRoaXMuX19zcHJlYWQgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gW10sIHQgPSAwOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUuY29uY2F0KG8oYXJndW1lbnRzW3RdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmNhbGwodGhpcywgdCkgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRlbGV0ZSBuLm91dE9mQmFuZCwgbjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIHQucHJvdG90eXBlLmNyZWF0ZVZlY3RvckZpZWxkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkoZSkucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSArICh0WzFdID8gJzEnIDogJzAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgJycpOwogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmNyZWF0ZVJlc3RyaWN0aW9ucyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLm51bVJlc3RyaWN0aW9ucyA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5nZXRNYXhWZW5kb3JJZCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5nZXRSZXN0cmljdGlvbnMoKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtlLnB1cnBvc2VJZC50b1N0cmluZygpXSA9ICdfJy5yZXBlYXQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuICsgMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2V0UmVzdHJpY3Rpb25zKHIpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUucmVzdHJpY3Rpb25UeXBlLnRvU3RyaW5nKCksIG8gPSBlLnB1cnBvc2VJZC50b1N0cmluZygpLCBpID0gdFtvXS5zdWJzdHIoMCwgbiksIHMgPSB0W29dLnN1YnN0cihuICsgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtvXSA9IGkgKyByICsgczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvID0gMDsgbyA8IG47IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKG8pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sIHQ7CiAgICAgICAgICAgICAgICB9KG4oMTE2KS5UQ0RhdGEpOwogICAgICAgICAgICAgICAgdC5JbkFwcFRDRGF0YSA9IHM7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBuKDI1KSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuY2FsbCh0aGlzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuY21wTG9hZGVkID0gITAsIHQuY21wU3RhdHVzID0gby5DbXBBcGlNb2RlbC5jbXBTdGF0dXMsIHQuZGlzcGxheVN0YXR1cyA9IG8uQ21wQXBpTW9kZWwuZGlzcGxheVN0YXR1cywgdC5hcGlWZXJzaW9uID0gJycgKyBvLkNtcEFwaU1vZGVsLmFwaVZlcnNpb24sIG8uQ21wQXBpTW9kZWwudGNNb2RlbCAmJiBvLkNtcEFwaU1vZGVsLnRjTW9kZWwudmVuZG9yTGlzdFZlcnNpb24gJiYgKHQuZ3ZsVmVyc2lvbiA9ICtvLkNtcEFwaU1vZGVsLnRjTW9kZWwudmVuZG9yTGlzdFZlcnNpb24pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0OwogICAgICAgICAgICAgICAgICAgIH0obig1MikuUmVzcG9uc2UpOwogICAgICAgICAgICAgICAgdC5QaW5nID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI1KSwgbyA9IG4oNTMpLCBpID0gbigxMTcpLCBzID0gbigxOSksIGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoZSwgdCwgbiwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBuICYmIChuID0gITEpLCB0aGlzLm51bVVwZGF0ZXMgPSAwLCB0aGlzLnRocm93SWZJbnZhbGlkSW50KGUsICdjbXBJZCcsIDIpLCB0aGlzLnRocm93SWZJbnZhbGlkSW50KHQsICdjbXBWZXJzaW9uJywgMCksIHIuQ21wQXBpTW9kZWwuY21wSWQgPSBlLCByLkNtcEFwaU1vZGVsLmNtcFZlcnNpb24gPSB0LCB0aGlzLmlzU2VydmljZVNwZWNpZmljID0gISFuLCB0aGlzLmNhbGxSZXNwb25kZXIgPSBuZXcgaS5DYWxsUmVzcG9uZGVyKG8pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QuZGVmaW5lUHJvcGVydHkoZS5wcm90b3R5cGUsICd0Y01vZGVsJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoJ0BpYWJ0Y2YvY21wYXBpOiBBcyBvZiB2MS4wLjAtYmV0YS4yMSBzZXR0aW5nIHRjTW9kZWwgdmlhIENtcEFwaS50Y01vZGVsIGlzIGRlcHJlY2F0ZWQuICBVc2UgY21wQXBpLnVwZGF0ZSh0Y1N0cmluZywgdWlWaXNpYmxlKSBpbnN0ZWFkJyksIGNvbnNvbGUubG9nKCcgIHNlZTogaHR0cHM6Ly9naXRodWIuY29tL0ludGVyYWN0aXZlQWR2ZXJ0aXNpbmdCdXJlYXUvaWFidGNmLWVzL3RyZWUvbWFzdGVyL21vZHVsZXMvY21wYXBpI2NtcGFwaS1leGFtcGxlcycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUucHJvdG90eXBlLCAndGNTdHJpbmcnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcignQGlhYnRjZi9jbXBhcGk6IEFzIG9mIHYxLjAuMC1iZXRhLjIxIHNldHRpbmcgdGNTdHJpbmcgdmlhIENtcEFwaS50Y1N0cmluZyBpcyBkZXByZWNhdGVkLiAgVXNlIGNtcEFwaS51cGRhdGUodGNTdHJpbmcsIHVpVmlzaWJsZSkgaW5zdGVhZCcpLCBjb25zb2xlLmxvZygnICBzZWU6IGh0dHBzOi8vZ2l0aHViLmNvbS9JbnRlcmFjdGl2ZUFkdmVydGlzaW5nQnVyZWF1L2lhYnRjZi1lcy90cmVlL21hc3Rlci9tb2R1bGVzL2NtcGFwaSNjbXBhcGktZXhhbXBsZXMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLnByb3RvdHlwZSwgJ3VpVmlzaWJsZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKCdAaWFidGNmL2NtcGFwaTogQXMgb2YgdjEuMC4wLWJldGEuMjEgc2V0dGluZyB1aVZpc2libGUgdmlhIENtcEFwaS51aVZpc2libGUgaXMgZGVwcmVjYXRlZC4gIFVzZSBjbXBBcGkudXBkYXRlKHRjU3RyaW5nLCB1aVZpc2libGUpIGluc3RlYWQnKSwgY29uc29sZS5sb2coJyAgc2VlOiBodHRwczovL2dpdGh1Yi5jb20vSW50ZXJhY3RpdmVBZHZlcnRpc2luZ0J1cmVhdS9pYWJ0Y2YtZXMvdHJlZS9tYXN0ZXIvbW9kdWxlcy9jbXBhcGkjY21wYXBpLWV4YW1wbGVzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlLnByb3RvdHlwZS50aHJvd0lmSW52YWxpZEludCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISgnbnVtYmVyJyA9PSB0eXBlb2YgZSAmJiBOdW1iZXIuaXNJbnRlZ2VyKGUpICYmIGUgPj0gbikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdJbnZhbGlkICcgKyB0ICsgJzogJyArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS51cGRhdGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gdCAmJiAodCA9ICExKSwgci5DbXBBcGlNb2RlbC5kaXNhYmxlZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0NtcEFwaSBEaXNhYmxlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgci5DbXBBcGlNb2RlbC5jbXBTdGF0dXMgPSBvLkNtcFN0YXR1cy5MT0FERUQsIHQgPyAoci5DbXBBcGlNb2RlbC5kaXNwbGF5U3RhdHVzID0gby5EaXNwbGF5U3RhdHVzLlZJU0lCTEUsIHIuQ21wQXBpTW9kZWwuZXZlbnRTdGF0dXMgPSBvLkV2ZW50U3RhdHVzLkNNUF9VSV9TSE9XTikgOiB2b2lkIDAgPT09IHIuQ21wQXBpTW9kZWwudGNNb2RlbCA/IChyLkNtcEFwaU1vZGVsLmRpc3BsYXlTdGF0dXMgPSBvLkRpc3BsYXlTdGF0dXMuRElTQUJMRUQsIHIuQ21wQXBpTW9kZWwuZXZlbnRTdGF0dXMgPSBvLkV2ZW50U3RhdHVzLlRDX0xPQURFRCkgOiAoci5DbXBBcGlNb2RlbC5kaXNwbGF5U3RhdHVzID0gby5EaXNwbGF5U3RhdHVzLkhJRERFTiwgci5DbXBBcGlNb2RlbC5ldmVudFN0YXR1cyA9IG8uRXZlbnRTdGF0dXMuVVNFUl9BQ1RJT05fQ09NUExFVEUpLCByLkNtcEFwaU1vZGVsLmdkcHJBcHBsaWVzID0gbnVsbCAhPT0gZSwgci5DbXBBcGlNb2RlbC5nZHByQXBwbGllcyA/ICgnJyA9PT0gZSA/IChyLkNtcEFwaU1vZGVsLnRjTW9kZWwgPSBuZXcgcy5UQ01vZGVsKCksIHIuQ21wQXBpTW9kZWwudGNNb2RlbC5jbXBJZCA9IHIuQ21wQXBpTW9kZWwuY21wSWQsIHIuQ21wQXBpTW9kZWwudGNNb2RlbC5jbXBWZXJzaW9uID0gci5DbXBBcGlNb2RlbC5jbXBWZXJzaW9uKSA6IHIuQ21wQXBpTW9kZWwudGNNb2RlbCA9IHMuVENTdHJpbmcuZGVjb2RlKGUpLCByLkNtcEFwaU1vZGVsLnRjTW9kZWwuaXNTZXJ2aWNlU3BlY2lmaWMgPSB0aGlzLmlzU2VydmljZVNwZWNpZmljLCByLkNtcEFwaU1vZGVsLnRjZlBvbGljeVZlcnNpb24gPSArci5DbXBBcGlNb2RlbC50Y01vZGVsLnBvbGljeVZlcnNpb24sIHIuQ21wQXBpTW9kZWwudGNTdHJpbmcgPSBlKSA6IHIuQ21wQXBpTW9kZWwudGNNb2RlbCA9IG51bGwsIDAgPT09IHRoaXMubnVtVXBkYXRlcyA/IHRoaXMuY2FsbFJlc3BvbmRlci5wdXJnZVF1ZXVlZENhbGxzKCkgOiByLkNtcEFwaU1vZGVsLmV2ZW50UXVldWUuZXhlYygpLCB0aGlzLm51bVVwZGF0ZXMrKzsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuZGlzYWJsZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuQ21wQXBpTW9kZWwuZGlzYWJsZWQgPSAhMCwgci5DbXBBcGlNb2RlbC5jbXBTdGF0dXMgPSBvLkNtcFN0YXR1cy5FUlJPUjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkNtcEFwaSA9IGE7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNjcpLCBvID0gbig1NCksIGkgPSBuKDI2OCksIHMgPSBuKDI2OSksIGEgPSBuKDI4NCksIHUgPSBuKDI4NSksIGMgPSBuKDExNCksIGYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIGYsIGwsIHAsIGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gYy5UQ0ZDb21tYW5kLlBJTkcsIG4gPSBjLlRDRkNvbW1hbmQuR0VUX1RDX0RBVEEsIGYgPSBjLlRDRkNvbW1hbmQuR0VUX0lOX0FQUF9UQ19EQVRBLCBsID0gYy5UQ0ZDb21tYW5kLkdFVF9WRU5ET1JfTElTVCwgcCA9IGMuVENGQ29tbWFuZC5BRERfRVZFTlRfTElTVEVORVIsIGQgPSBjLlRDRkNvbW1hbmQuUkVNT1ZFX0VWRU5UX0xJU1RFTkVSLCBlW3RdID0gci5QaW5nQ29tbWFuZCwgZVtuXSA9IG8uR2V0VENEYXRhQ29tbWFuZCwgZVtmXSA9IGkuR2V0SW5BcHBUQ0RhdGFDb21tYW5kLCBlW2xdID0gcy5HZXRWZW5kb3JMaXN0Q29tbWFuZCwgZVtwXSA9IGEuQWRkRXZlbnRMaXN0ZW5lckNvbW1hbmQsIGVbZF0gPSB1LlJlbW92ZUV2ZW50TGlzdGVuZXJDb21tYW5kLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuQ29tbWFuZE1hcCA9IGY7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBuKDUxKSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gZSAmJiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdC5wcm90b3R5cGUucmVzcG9uZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW52b2tlQ2FsbGJhY2sobmV3IG8uUGluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdDsKICAgICAgICAgICAgICAgICAgICB9KG4oNTUpLkNvbW1hbmQpOwogICAgICAgICAgICAgICAgdC5QaW5nQ29tbWFuZCA9IGk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBuKDU0KSwgaSA9IG4oNTEpLCBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5yZXNwb25kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy50aHJvd0lmUGFyYW1JbnZhbGlkKCksIHRoaXMuaW52b2tlQ2FsbGJhY2sobmV3IGkuSW5BcHBUQ0RhdGEodGhpcy5wYXJhbSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgIH0oby5HZXRUQ0RhdGFDb21tYW5kKTsKICAgICAgICAgICAgICAgIHQuR2V0SW5BcHBUQ0RhdGFDb21tYW5kID0gczsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMjUpLCBpID0gbig1NSksIHMgPSBuKDE5KSwgYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gZSAmJiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdC5wcm90b3R5cGUucmVzcG9uZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0ID0gdGhpcywgbiA9IG8uQ21wQXBpTW9kZWwudGNNb2RlbCwgciA9IG4udmVuZG9yTGlzdFZlcnNpb247CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IHRoaXMucGFyYW0gJiYgKHRoaXMucGFyYW0gPSByKSwgKGUgPSB0aGlzLnBhcmFtID09PSByICYmIG4uZ3ZsID8gbi5ndmwgOiBuZXcgcy5HVkwodGhpcy5wYXJhbSkpLnJlYWR5UHJvbWlzZS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmludm9rZUNhbGxiYWNrKGUuZ2V0SnNvbigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgIH0oaS5Db21tYW5kKTsKICAgICAgICAgICAgICAgIHQuR2V0VmVuZG9yTGlzdENvbW1hbmQgPSBhOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzICYmIHRoaXMuX19leHRlbmRzIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCB7IF9fcHJvdG9fXzogW10gfSBpbnN0YW5jZW9mIEFycmF5ICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9fcHJvdG9fXyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pICYmIChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnN0cnVjdG9yID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmNhbGwodGhpcywgdCkgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ubmFtZSA9ICdEZWNvZGluZ0Vycm9yJywgbjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIHQ7CiAgICAgICAgICAgICAgICB9KEVycm9yKTsKICAgICAgICAgICAgICAgIHQuRGVjb2RpbmdFcnJvciA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQodCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuY2FsbCh0aGlzLCB0KSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5uYW1lID0gJ0VuY29kaW5nRXJyb3InLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdDsKICAgICAgICAgICAgICAgIH0oRXJyb3IpOwogICAgICAgICAgICAgICAgdC5FbmNvZGluZ0Vycm9yID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5jYWxsKHRoaXMsIHQpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLm5hbWUgPSAnR1ZMRXJyb3InLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdDsKICAgICAgICAgICAgICAgIH0oRXJyb3IpOwogICAgICAgICAgICAgICAgdC5HVkxFcnJvciA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQodCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IHIgJiYgKHIgPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZS5jYWxsKHRoaXMsICdpbnZhbGlkIHZhbHVlICcgKyBuICsgJyBwYXNzZWQgZm9yICcgKyB0ICsgJyAnICsgcikgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8ubmFtZSA9ICdUQ01vZGVsRXJyb3InLCBvOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdDsKICAgICAgICAgICAgICAgIH0oRXJyb3IpOwogICAgICAgICAgICAgICAgdC5UQ01vZGVsRXJyb3IgPSBvOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuaGFzID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubGFuZ1NldC5oYXModCk7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuZm9yRWFjaCA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUubGFuZ1NldC5mb3JFYWNoKHQpOwogICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLnByb3RvdHlwZSwgJ3NpemUnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubGFuZ1NldC5zaXplOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pLCBlLmxhbmdTZXQgPSBuZXcgU2V0KFsKICAgICAgICAgICAgICAgICAgICAgICAgJ0JHJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0NBJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0NTJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0RBJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0RFJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0VMJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0VOJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0VTJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0VUJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0ZJJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0ZSJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0hSJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0hVJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0lUJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0pBJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0xUJywKICAgICAgICAgICAgICAgICAgICAgICAgJ0xWJywKICAgICAgICAgICAgICAgICAgICAgICAgJ01UJywKICAgICAgICAgICAgICAgICAgICAgICAgJ05MJywKICAgICAgICAgICAgICAgICAgICAgICAgJ05PJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1BMJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1BUJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1JPJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1JVJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1NLJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1NMJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1NWJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1RSJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1pIJwogICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5Db25zZW50TGFuZ3VhZ2VzID0gcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMTIxKSwgaSA9IG4oMTE5KSwgcyA9IG4oODApLCBhID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbnVsbCAhPT0gZSAmJiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmJpdExlbmd0aCA9IDAsIHQubWFwID0gbmV3IE1hcCgpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5oYXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWFwLmhhcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuaXNPa1RvSGF2ZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgbyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IChyID0gdGhpcy5ndmwpIHx8IHZvaWQgMCA9PT0gciA/IHZvaWQgMCA6IHIudmVuZG9ycykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdGhpcy5ndmwudmVuZG9yc1tuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IHMuUmVzdHJpY3Rpb25UeXBlLk5PVF9BTExPV0VEKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGkubGVnSW50UHVycG9zZXMuaW5jbHVkZXModCkgfHwgaS5wdXJwb3Nlcy5pbmNsdWRlcyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoaS5mbGV4aWJsZVB1cnBvc2VzLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBzLlJlc3RyaWN0aW9uVHlwZS5SRVFVSVJFX0NPTlNFTlQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGkuZmxleGlibGVQdXJwb3Nlcy5pbmNsdWRlcyh0KSAmJiBpLmxlZ0ludFB1cnBvc2VzLmluY2x1ZGVzKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBzLlJlc3RyaWN0aW9uVHlwZS5SRVFVSVJFX0xJOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBpLmZsZXhpYmxlUHVycG9zZXMuaW5jbHVkZXModCkgJiYgaS5wdXJwb3Nlcy5pbmNsdWRlcyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5pc09rVG9IYXZlKHQucmVzdHJpY3Rpb25UeXBlLCB0LnB1cnBvc2VJZCwgZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuaGFzaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmhhcyhuKSB8fCAodGhpcy5tYXAuc2V0KG4sIG5ldyBpLkJpbmFyeVNlYXJjaFRyZWUoKSksIHRoaXMuYml0TGVuZ3RoID0gMCksIHRoaXMubWFwLmdldChuKS5hZGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFZlbmRvcnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmhhc2g7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5oYXMobikgJiYgKHQgPSB0aGlzLm1hcC5nZXQobikuZ2V0KCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG5ldyBTZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm1hcC5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2V0KCkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5hZGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0ID0gQXJyYXkuZnJvbShyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRSZXN0cmljdGlvblR5cGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5nZXRSZXN0cmljdGlvbnMoZSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHVycG9zZUlkID09PSB0ICYmICh2b2lkIDAgPT09IG4gfHwgbiA+IGUucmVzdHJpY3Rpb25UeXBlKSAmJiAobiA9IGUucmVzdHJpY3Rpb25UeXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS52ZW5kb3JIYXNSZXN0cmljdGlvbiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gITEsIHIgPSB0aGlzLmdldFJlc3RyaWN0aW9ucyhlKSwgbyA9IDA7IG8gPCByLmxlbmd0aCAmJiAhbjsgbysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB0LmlzU2FtZUFzKHJbb10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldE1heFZlbmRvcklkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWFwLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gTWF0aC5tYXgodC5tYXgoKSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZ2V0UmVzdHJpY3Rpb25zID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5tYXAuZm9yRWFjaChmdW5jdGlvbiAobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPyBuLmNvbnRhaW5zKGUpICYmIHQucHVzaChvLlB1cnBvc2VSZXN0cmljdGlvbi51bkhhc2gocikpIDogdC5wdXNoKG8uUHVycG9zZVJlc3RyaWN0aW9uLnVuSGFzaChyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZ2V0UHVycG9zZXMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyBTZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm1hcC5mb3JFYWNoKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5hZGQoby5QdXJwb3NlUmVzdHJpY3Rpb24udW5IYXNoKG4pLnB1cnBvc2VJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUucmVtb3ZlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5oYXNoLCByID0gdGhpcy5tYXAuZ2V0KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgciAmJiAoci5yZW1vdmUoZSksIHIuaXNFbXB0eSgpICYmICh0aGlzLm1hcC5kZWxldGUobiksIHRoaXMuYml0TGVuZ3RoID0gMCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdndmwnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5ndmxfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ndmxfIHx8ICh0aGlzLmd2bF8gPSBlLCB0aGlzLm1hcC5mb3JFYWNoKGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gby5QdXJwb3NlUmVzdHJpY3Rpb24udW5IYXNoKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmdldCgpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaXNPa1RvSGF2ZShyLnJlc3RyaWN0aW9uVHlwZSwgci5wdXJwb3NlSWQsIG4pIHx8IGUucmVtb3ZlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0LnByb3RvdHlwZS5pc0VtcHR5ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPT09IHRoaXMubWFwLnNpemU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ251bVJlc3RyaWN0aW9ucycsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm1hcC5zaXplOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgICAgICB9KG4oMzApLkNsb25lYWJsZSk7CiAgICAgICAgICAgICAgICB0LlB1cnBvc2VSZXN0cmljdGlvblZlY3RvciA9IGE7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBuKDEyMiksIGkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuSURfVE9fS0VZID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgby5TZWdtZW50LkNPUkUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLlNlZ21lbnQuVkVORE9SU19ESVNDTE9TRUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLlNlZ21lbnQuVkVORE9SU19BTExPV0VELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgby5TZWdtZW50LlBVQkxJU0hFUl9UQwogICAgICAgICAgICAgICAgICAgICAgICBdLCBlLktFWV9UT19JRCA9ICgociA9IHt9KVtvLlNlZ21lbnQuQ09SRV0gPSAwLCByW28uU2VnbWVudC5WRU5ET1JTX0RJU0NMT1NFRF0gPSAxLCByW28uU2VnbWVudC5WRU5ET1JTX0FMTE9XRURdID0gMiwgcltvLlNlZ21lbnQuUFVCTElTSEVSX1RDXSA9IDMsIHIpLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuU2VnbWVudElEcyA9IGk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0oKSwgbyA9IHRoaXMgJiYgdGhpcy5fX2dlbmVyYXRvciB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciwgbywgaSwgcyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW50OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxICYgb1swXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG9bMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5czogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3BzOiBbXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBhKDApLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3c6IGEoMSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm46IGEoMikKICAgICAgICAgICAgICAgICAgICAgICAgfSwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIChpW1N5bWJvbC5pdGVyYXRvcl0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignR2VuZXJhdG9yIGlzIGFscmVhZHkgZXhlY3V0aW5nLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgczspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID0gMSwgciAmJiAobyA9IDIgJiBpWzBdID8gci5yZXR1cm4gOiBpWzBdID8gci50aHJvdyB8fCAoKG8gPSByLnJldHVybikgJiYgby5jYWxsKHIpLCAwKSA6IHIubmV4dCkgJiYgIShvID0gby5jYWxsKHIsIGlbMV0pKS5kb25lKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHIgPSAwLCBvICYmIChpID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiAmIGlbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLnZhbHVlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBpWzBdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMubGFiZWwrKywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGlbMV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5sYWJlbCsrLCByID0gaVsxXSwgaSA9IFswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gcy5vcHMucG9wKCksIHMudHJ5cy5wb3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEobyA9IChvID0gcy50cnlzKS5sZW5ndGggPiAwICYmIG9bby5sZW5ndGggLSAxXSkgJiYgKDYgPT09IGlbMF0gfHwgMiA9PT0gaVswXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDMgPT09IGlbMF0gJiYgKCFvIHx8IGlbMV0gPiBvWzBdICYmIGlbMV0gPCBvWzNdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5sYWJlbCA9IGlbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoNiA9PT0gaVswXSAmJiBzLmxhYmVsIDwgb1sxXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5sYWJlbCA9IG9bMV0sIG8gPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8gJiYgcy5sYWJlbCA8IG9bMl0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMubGFiZWwgPSBvWzJdLCBzLm9wcy5wdXNoKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb1syXSAmJiBzLm9wcy5wb3AoKSwgcy50cnlzLnBvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IHQuY2FsbChlLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgciA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBvID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDUgJiBpWzBdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgaVsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBpWzBdID8gaVsxXSA6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgaSA9IG4oMzApLCBzID0gbigxNCksIGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYml0TGVuZ3RoID0gMCwgdC5tYXhJZF8gPSAwLCB0LnNldF8gPSBuZXcgU2V0KCksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIHQucHJvdG90eXBlW1N5bWJvbC5pdGVyYXRvcl0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKHRoaXMsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0LmxhYmVsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gMSwgdC5sYWJlbCA9IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA8PSB0aGlzLm1heElkID8gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaGFzKGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0gOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zZW50KCksIHQubGFiZWwgPSAzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUrKywgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbMl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnZhbHVlcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNldF8udmFsdWVzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ21heElkJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWF4SWRfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5wcm90b3R5cGUuaGFzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNldF8uaGFzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS51bnNldCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBBcnJheS5pc0FycmF5KGUpID8gZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudW5zZXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6ICdvYmplY3QnID09IHR5cGVvZiBlID8gdGhpcy51bnNldChPYmplY3Qua2V5cyhlKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gK2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgOiAodGhpcy5zZXRfLmRlbGV0ZShlKSwgdGhpcy5iaXRMZW5ndGggPSAwLCBlID09PSB0aGlzLm1heElkICYmICh0aGlzLm1heElkXyA9IDAsIHRoaXMuc2V0Xy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5tYXhJZF8gPSBNYXRoLm1heCh0Lm1heElkLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmlzSW50TWFwID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcywgbiA9ICdvYmplY3QnID09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gJiYgT2JqZWN0LmtleXMoZSkuZXZlcnkoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE51bWJlci5pc0ludGVnZXIocGFyc2VJbnQobiwgMTApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHIgPSByICYmIHQuaXNWYWxpZE51bWJlcihlW25dLmlkKSkgJiYgdm9pZCAwICE9PSBlW25dLm5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuaXNWYWxpZE51bWJlciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VJbnQoZSwgMTApID4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuaXNTZXQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIGluc3RhbmNlb2YgU2V0ICYmICh0ID0gQXJyYXkuZnJvbShlKS5ldmVyeSh0aGlzLmlzVmFsaWROdW1iZXIpKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuc2V0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5zZXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICh0aGlzLmlzU2V0KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0KEFycmF5LmZyb20oZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAodGhpcy5pc0ludE1hcChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNldChPYmplY3Qua2V5cyhlKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICtlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdGhpcy5pc1ZhbGlkTnVtYmVyKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgcy5UQ01vZGVsRXJyb3IoJ3NldCgpJywgZSwgJ211c3QgYmUgcG9zaXRpdmUgaW50ZWdlciBhcnJheSwgcG9zaXRpdmUgaW50ZWdlciwgU2V0PG51bWJlcj4sIG9yIEludE1hcCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0Xy5hZGQoZSksIHRoaXMubWF4SWRfID0gTWF0aC5tYXgodGhpcy5tYXhJZCwgZSksIHRoaXMuYml0TGVuZ3RoID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZW1wdHkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNldF8gPSBuZXcgU2V0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmZvckVhY2ggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPD0gdGhpcy5tYXhJZDsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUodGhpcy5oYXModCksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdzaXplJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2V0Xy5zaXplOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5wcm90b3R5cGUuc2V0QWxsID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgIH0oaS5DbG9uZWFibGUpOwogICAgICAgICAgICAgICAgdC5WZWN0b3IgPSBhOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTE4KSwgbyA9IG4oNzkpLCBpID0gbigxMjMpLCBzID0gbigxMjkpLCBhID0gbigxNCksIHUgPSBuKDEyMCksIGMgPSBuKDE1KSwgZiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5lbmNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHMgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gdGhpcy5maWVsZFNlcXVlbmNlWycnICsgZS52ZXJzaW9uXVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgYS5FbmNvZGluZ0Vycm9yKCdVbmFibGUgdG8gZW5jb2RlIHZlcnNpb246ICcgKyBlLnZlcnNpb24gKyAnLCBzZWdtZW50OiAnICsgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgIT09IGMuU2VnbWVudC5DT1JFICYmIChmID0gaS5JbnRFbmNvZGVyLmVuY29kZShjLlNlZ21lbnRJRHMuS0VZX1RPX0lEW3RdLCBvLkJpdExlbmd0aC5zZWdtZW50VHlwZSkpLCBuLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGVbbl0sIGMgPSBpLkZpZWxkRW5jb2Rlck1hcFtuXSwgbCA9IG8uQml0TGVuZ3RoW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gbCAmJiBzLmlzUHVibGlzaGVyQ3VzdG9tKG4pICYmIChsID0gK2VbdS5GaWVsZHMubnVtQ3VzdG9tUHVycG9zZXNdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmICs9IGMuZW5jb2RlKHIsIGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGEuRW5jb2RpbmdFcnJvcignRXJyb3IgZW5jb2RpbmcgJyArIHQgKyAnLT4nICsgbiArICc6ICcgKyBlLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLkJhc2U2NFVybC5lbmNvZGUoZik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZGVjb2RlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gdGhpcywgZiA9IHIuQmFzZTY0VXJsLmRlY29kZShlKSwgbCA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9PT0gYy5TZWdtZW50LkNPUkUgJiYgKHQudmVyc2lvbiA9IGkuSW50RW5jb2Rlci5kZWNvZGUoZi5zdWJzdHIobCwgby5CaXRMZW5ndGhbdS5GaWVsZHMudmVyc2lvbl0pLCBvLkJpdExlbmd0aFt1LkZpZWxkcy52ZXJzaW9uXSkpLCBuICE9PSBjLlNlZ21lbnQuQ09SRSAmJiAobCArPSBvLkJpdExlbmd0aC5zZWdtZW50VHlwZSksIHRoaXMuZmllbGRTZXF1ZW5jZVsnJyArIHQudmVyc2lvbl1bbl0uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gaS5GaWVsZEVuY29kZXJNYXBbZV0sIHIgPSBvLkJpdExlbmd0aFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSByICYmIHMuaXNQdWJsaXNoZXJDdXN0b20oZSkgJiYgKHIgPSArdFt1LkZpZWxkcy5udW1DdXN0b21QdXJwb3Nlc10pLCAwICE9PSByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gZi5zdWJzdHIobCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID09PSBpLlZlbmRvclZlY3RvckVuY29kZXIgPyB0W2VdID0gbi5kZWNvZGUoYywgdC52ZXJzaW9uKSA6IHRbZV0gPSBuLmRlY29kZShjLCByKSwgTnVtYmVyLmlzSW50ZWdlcihyKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgKz0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIU51bWJlci5pc0ludGVnZXIodFtlXS5iaXRMZW5ndGgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBhLkRlY29kaW5nRXJyb3IoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsICs9IHRbZV0uYml0TGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuaXNQdWJsaXNoZXJDdXN0b20gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPT09IGUuaW5kZXhPZigncHVibGlzaGVyQ3VzdG9tJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZmllbGRTZXF1ZW5jZSA9IG5ldyBzLkZpZWxkU2VxdWVuY2UoKSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LlNlZ21lbnRFbmNvZGVyID0gZjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE1KSwgbyA9IG4oNDIpLCBpID0gbigxMjQpLCBzID0gbig4MSksIGEgPSBuKDMxKSwgdSA9IG4oMTI1KSwgYyA9IG4oMTI2KSwgZiA9IG4oMTI3KSwgbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgbCwgcCwgZCwgaCwgdiwgeSwgZywgbSwgYiwgRSwgQywgXywgUywgdywgSSwgTywgQSwgTCwgUCwgVCwgaywgeCwgUiwgTjsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSByLkZpZWxkcy52ZXJzaW9uLCBuID0gci5GaWVsZHMuY3JlYXRlZCwgbCA9IHIuRmllbGRzLmxhc3RVcGRhdGVkLCBwID0gci5GaWVsZHMuY21wSWQsIGQgPSByLkZpZWxkcy5jbXBWZXJzaW9uLCBoID0gci5GaWVsZHMuY29uc2VudFNjcmVlbiwgdiA9IHIuRmllbGRzLmNvbnNlbnRMYW5ndWFnZSwgeSA9IHIuRmllbGRzLnZlbmRvckxpc3RWZXJzaW9uLCBnID0gci5GaWVsZHMucG9saWN5VmVyc2lvbiwgbSA9IHIuRmllbGRzLmlzU2VydmljZVNwZWNpZmljLCBiID0gci5GaWVsZHMudXNlTm9uU3RhbmRhcmRTdGFja3MsIEUgPSByLkZpZWxkcy5zcGVjaWFsRmVhdHVyZU9wdGlucywgQyA9IHIuRmllbGRzLnB1cnBvc2VDb25zZW50cywgXyA9IHIuRmllbGRzLnB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzLCBTID0gci5GaWVsZHMucHVycG9zZU9uZVRyZWF0bWVudCwgdyA9IHIuRmllbGRzLnB1Ymxpc2hlckNvdW50cnlDb2RlLCBJID0gci5GaWVsZHMudmVuZG9yQ29uc2VudHMsIE8gPSByLkZpZWxkcy52ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzLCBBID0gci5GaWVsZHMucHVibGlzaGVyUmVzdHJpY3Rpb25zLCBMID0gci5GaWVsZHMudmVuZG9yc0Rpc2Nsb3NlZCwgUCA9IHIuRmllbGRzLnZlbmRvcnNBbGxvd2VkLCBUID0gci5GaWVsZHMucHVibGlzaGVyQ29uc2VudHMsIGsgPSByLkZpZWxkcy5wdWJsaXNoZXJMZWdpdGltYXRlSW50ZXJlc3RzLCB4ID0gci5GaWVsZHMubnVtQ3VzdG9tUHVycG9zZXMsIFIgPSByLkZpZWxkcy5wdWJsaXNoZXJDdXN0b21Db25zZW50cywgTiA9IHIuRmllbGRzLnB1Ymxpc2hlckN1c3RvbUxlZ2l0aW1hdGVJbnRlcmVzdHMsIGVbdF0gPSBhLkludEVuY29kZXIsIGVbbl0gPSBpLkRhdGVFbmNvZGVyLCBlW2xdID0gaS5EYXRlRW5jb2RlciwgZVtwXSA9IGEuSW50RW5jb2RlciwgZVtkXSA9IGEuSW50RW5jb2RlciwgZVtoXSA9IGEuSW50RW5jb2RlciwgZVt2XSA9IHUuTGFuZ0VuY29kZXIsIGVbeV0gPSBhLkludEVuY29kZXIsIGVbZ10gPSBhLkludEVuY29kZXIsIGVbbV0gPSBvLkJvb2xlYW5FbmNvZGVyLCBlW2JdID0gby5Cb29sZWFuRW5jb2RlciwgZVtFXSA9IHMuRml4ZWRWZWN0b3JFbmNvZGVyLCBlW0NdID0gcy5GaXhlZFZlY3RvckVuY29kZXIsIGVbX10gPSBzLkZpeGVkVmVjdG9yRW5jb2RlciwgZVtTXSA9IG8uQm9vbGVhbkVuY29kZXIsIGVbd10gPSB1LkxhbmdFbmNvZGVyLCBlW0ldID0gZi5WZW5kb3JWZWN0b3JFbmNvZGVyLCBlW09dID0gZi5WZW5kb3JWZWN0b3JFbmNvZGVyLCBlW0FdID0gYy5QdXJwb3NlUmVzdHJpY3Rpb25WZWN0b3JFbmNvZGVyLCBlLnNlZ21lbnRUeXBlID0gYS5JbnRFbmNvZGVyLCBlW0xdID0gZi5WZW5kb3JWZWN0b3JFbmNvZGVyLCBlW1BdID0gZi5WZW5kb3JWZWN0b3JFbmNvZGVyLCBlW1RdID0gcy5GaXhlZFZlY3RvckVuY29kZXIsIGVba10gPSBzLkZpeGVkVmVjdG9yRW5jb2RlciwgZVt4XSA9IGEuSW50RW5jb2RlciwgZVtSXSA9IHMuRml4ZWRWZWN0b3JFbmNvZGVyLCBlW05dID0gcy5GaXhlZFZlY3RvckVuY29kZXIsIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5GaWVsZEVuY29kZXJNYXAgPSBsOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTUpOwogICAgICAgICAgICAgICAgdC5GaWVsZFNlcXVlbmNlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlLCB0OwogICAgICAgICAgICAgICAgICAgIHRoaXNbMV0gPSAoKGUgPSB7fSlbci5TZWdtZW50LkNPUkVdID0gWwogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy52ZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5jcmVhdGVkLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5sYXN0VXBkYXRlZCwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY21wSWQsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmNtcFZlcnNpb24sCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmNvbnNlbnRTY3JlZW4sCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmNvbnNlbnRMYW5ndWFnZSwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMudmVuZG9yTGlzdFZlcnNpb24sCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnB1cnBvc2VDb25zZW50cywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMudmVuZG9yQ29uc2VudHMKICAgICAgICAgICAgICAgICAgICBdLCBlKSwgdGhpc1syXSA9ICgodCA9IHt9KVtyLlNlZ21lbnQuQ09SRV0gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnZlcnNpb24sCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmNyZWF0ZWQsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmxhc3RVcGRhdGVkLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5jbXBJZCwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY21wVmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY29uc2VudFNjcmVlbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY29uc2VudExhbmd1YWdlLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy52ZW5kb3JMaXN0VmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucG9saWN5VmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuaXNTZXJ2aWNlU3BlY2lmaWMsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnVzZU5vblN0YW5kYXJkU3RhY2tzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5zcGVjaWFsRmVhdHVyZU9wdGlucywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucHVycG9zZUNvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucHVycG9zZU9uZVRyZWF0bWVudCwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucHVibGlzaGVyQ291bnRyeUNvZGUsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnZlbmRvckNvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy52ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdWJsaXNoZXJSZXN0cmljdGlvbnMKICAgICAgICAgICAgICAgICAgICBdLCB0W3IuU2VnbWVudC5QVUJMSVNIRVJfVENdID0gWwogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdWJsaXNoZXJDb25zZW50cywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucHVibGlzaGVyTGVnaXRpbWF0ZUludGVyZXN0cywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMubnVtQ3VzdG9tUHVycG9zZXMsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnB1Ymxpc2hlckN1c3RvbUNvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdWJsaXNoZXJDdXN0b21MZWdpdGltYXRlSW50ZXJlc3RzCiAgICAgICAgICAgICAgICAgICAgXSwgdFtyLlNlZ21lbnQuVkVORE9SU19BTExPV0VEXSA9IFtyLkZpZWxkcy52ZW5kb3JzQWxsb3dlZF0sIHRbci5TZWdtZW50LlZFTkRPUlNfRElTQ0xPU0VEXSA9IFtyLkZpZWxkcy52ZW5kb3JzRGlzY2xvc2VkXSwgdCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTUpOwogICAgICAgICAgICAgICAgdC5TZWdtZW50U2VxdWVuY2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzWzFdID0gW3IuU2VnbWVudC5DT1JFXSwgdGhpc1syXSA9IFtyLlNlZ21lbnQuQ09SRV0sIDIgPT09IGUudmVyc2lvbikKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuaXNTZXJ2aWNlU3BlY2lmaWMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzWzJdLnB1c2goci5TZWdtZW50LlBVQkxJU0hFUl9UQyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAhKCF0IHx8ICF0LmlzRm9yVmVuZG9ycyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmICEwICE9PSBlW3IuRmllbGRzLnN1cHBvcnRPT0JdIHx8IHRoaXNbMl0ucHVzaChyLlNlZ21lbnQuVkVORE9SU19ESVNDTE9TRUQpLCBuICYmIChlW3IuRmllbGRzLnN1cHBvcnRPT0JdICYmIGVbci5GaWVsZHMudmVuZG9yc0FsbG93ZWRdLnNpemUgPiAwICYmIHRoaXNbMl0ucHVzaChyLlNlZ21lbnQuVkVORE9SU19BTExPV0VEKSwgdGhpc1syXS5wdXNoKHIuU2VnbWVudC5QVUJMSVNIRVJfVEMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE0KSwgbyA9IG4oMTUpLCBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb2Nlc3MgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIG8sIGkgPSBlLmd2bDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgci5FbmNvZGluZ0Vycm9yKCdVbmFibGUgdG8gZW5jb2RlIFRDTW9kZWwgd2l0aG91dCBhIEdWTCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpLmlzUmVhZHkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHIuRW5jb2RpbmdFcnJvcignVW5hYmxlIHRvIGVuY29kZSBUQ01vZGVsIHRjTW9kZWwuZ3ZsLnJlYWR5UHJvbWlzZSBpcyBub3QgcmVzb2x2ZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChlID0gZS5jbG9uZSgpKS5jb25zZW50TGFuZ3VhZ2UgPSBpLmxhbmd1YWdlLnRvVXBwZXJDYXNlKCksIChudWxsID09PSAobiA9IHQpIHx8IHZvaWQgMCA9PT0gbiA/IHZvaWQgMCA6IG4udmVyc2lvbikgPiAwICYmIChudWxsID09PSAobyA9IHQpIHx8IHZvaWQgMCA9PT0gbyA/IHZvaWQgMCA6IG8udmVyc2lvbikgPD0gdGhpcy5wcm9jZXNzb3IubGVuZ3RoID8gZS52ZXJzaW9uID0gdC52ZXJzaW9uIDogZS52ZXJzaW9uID0gdGhpcy5wcm9jZXNzb3IubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBlLnZlcnNpb24gLSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLnByb2Nlc3NvcltzXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgci5FbmNvZGluZ0Vycm9yKCdJbnZhbGlkIHZlcnNpb246ICcgKyBlLnZlcnNpb24pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucHJvY2Vzc29yW3NdKGUsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb2Nlc3NvciA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnB1Ymxpc2hlclJlc3RyaWN0aW9ucy5ndmwgPSB0LCBlLnB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzLnVuc2V0KDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IE1hcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnNldCgnbGVnSW50UHVycG9zZXMnLCBlLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMpLCBuLnNldCgncHVycG9zZXMnLCBlLnZlbmRvckNvbnNlbnRzKSwgbi5mb3JFYWNoKGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uZm9yRWFjaChmdW5jdGlvbiAoaSwgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQudmVuZG9yc1tzXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWEgfHwgYS5kZWxldGVkRGF0ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi51bnNldChzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgwID09PSBhW3JdLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuaXNTZXJ2aWNlU3BlY2lmaWMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gYS5mbGV4aWJsZVB1cnBvc2VzLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnVuc2V0KHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdSA9IGUucHVibGlzaGVyUmVzdHJpY3Rpb25zLmdldFJlc3RyaWN0aW9ucyhzKSwgYyA9ICExLCBmID0gMCwgbCA9IHUubGVuZ3RoOyBmIDwgbCAmJiAhYzsgZisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gdVtmXS5yZXN0cmljdGlvblR5cGUgPT09IG8uUmVzdHJpY3Rpb25UeXBlLlJFUVVJUkVfQ09OU0VOVCAmJiAncHVycG9zZXMnID09PSByIHx8IHVbZl0ucmVzdHJpY3Rpb25UeXBlID09PSBvLlJlc3RyaWN0aW9uVHlwZS5SRVFVSVJFX0xJICYmICdsZWdJbnRQdXJwb3NlcycgPT09IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyB8fCBuLnVuc2V0KHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnVuc2V0KHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZS52ZW5kb3JzRGlzY2xvc2VkLnNldCh0LnZlbmRvcnMpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuU2VtYW50aWNQcmVFbmNvZGVyID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDc4KSwgbyA9IG4oMTUpLCBpID0gbigzMSksIHMgPSBuKDEzMiksIGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZW5jb2RlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCBvLCBpID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IHIuU2VtYW50aWNQcmVFbmNvZGVyLnByb2Nlc3MoZSwgdCksIChvID0gQXJyYXkuaXNBcnJheShudWxsID09PSAobiA9IHQpIHx8IHZvaWQgMCA9PT0gbiA/IHZvaWQgMCA6IG4uc2VnbWVudHMpID8gdC5zZWdtZW50cyA6IG5ldyByLlNlZ21lbnRTZXF1ZW5jZShlLCB0KVsnJyArIGUudmVyc2lvbl0pLmZvckVhY2goZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPCBvLmxlbmd0aCAtIDEgJiYgKHMgPSAnLicpLCBpICs9IHIuU2VnbWVudEVuY29kZXIuZW5jb2RlKGUsIHQpICsgczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRlY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuc3BsaXQoJy4nKSwgYSA9IG4ubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCB8fCAodCA9IG5ldyBzLlRDTW9kZWwoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB1ID0gMDsgdSA8IGE7IHUrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gblt1XSwgZiA9IHIuQmFzZTY0VXJsLmRlY29kZShjLmNoYXJBdCgwKSkuc3Vic3RyKDAsIHIuQml0TGVuZ3RoLnNlZ21lbnRUeXBlKSwgbCA9IG8uU2VnbWVudElEcy5JRF9UT19LRVlbaS5JbnRFbmNvZGVyLmRlY29kZShmLCByLkJpdExlbmd0aC5zZWdtZW50VHlwZSkudG9TdHJpbmcoKV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5TZWdtZW50RW5jb2Rlci5kZWNvZGUoYywgdCwgbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LlRDU3RyaW5nID0gYTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMjUpLCBpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5yZXNwb25kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5saXN0ZW5lcklkID0gby5DbXBBcGlNb2RlbC5ldmVudFF1ZXVlLmFkZCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IHRoaXMuY2FsbGJhY2ssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW06IHRoaXMucGFyYW0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogdGhpcy5uZXh0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZS5wcm90b3R5cGUucmVzcG9uZC5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgIH0obig1NCkuR2V0VENEYXRhQ29tbWFuZCk7CiAgICAgICAgICAgICAgICB0LkFkZEV2ZW50TGlzdGVuZXJDb21tYW5kID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMjUpLCBpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnByb3RvdHlwZS5yZXNwb25kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pbnZva2VDYWxsYmFjayhvLkNtcEFwaU1vZGVsLmV2ZW50UXVldWUucmVtb3ZlKHRoaXMucGFyYW0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdDsKICAgICAgICAgICAgICAgICAgICB9KG4oNTUpLkNvbW1hbmQpOwogICAgICAgICAgICAgICAgdC5SZW1vdmVFdmVudExpc3RlbmVyQ29tbWFuZCA9IGk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmhhcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PSB0eXBlb2YgZSAmJiAoZSA9ICtlKSwgdGhpcy5zZXRfLmhhcyhlKTsKICAgICAgICAgICAgICAgICAgICB9LCBlLnNldF8gPSBuZXcgU2V0KFsKICAgICAgICAgICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICBudWxsCiAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LlN1cHBvcnRlZFZlcnNpb25zID0gcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIG8gPSBuKDEzOCksIGkgPSBuKDI4OCksIHMgPSBuKDE0NCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG5ldyBpKGUpLCBuID0gbyhpLnByb3RvdHlwZS5yZXF1ZXN0LCB0KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5leHRlbmQobiwgaS5wcm90b3R5cGUsIHQpLCByLmV4dGVuZChuLCB0KSwgbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciB1ID0gYShuKDE0MSkpOwogICAgICAgICAgICAgICAgdS5BeGlvcyA9IGksIHUuY3JlYXRlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShzKHUuZGVmYXVsdHMsIGUpKTsKICAgICAgICAgICAgICAgIH0sIHUuQ2FuY2VsID0gbigxNDUpLCB1LkNhbmNlbFRva2VuID0gbigzMDIpLCB1LmlzQ2FuY2VsID0gbigxNDApLCB1LmFsbCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UuYWxsKGUpOwogICAgICAgICAgICAgICAgfSwgdS5zcHJlYWQgPSBuKDMwMyksIGUuZXhwb3J0cyA9IHUsIGUuZXhwb3J0cy5kZWZhdWx0ID0gdTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIG8gPSBuKDEzOSksIGkgPSBuKDI4OSksIHMgPSBuKDI5MCksIGEgPSBuKDE0NCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KGUpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRlZmF1bHRzID0gZSwgdGhpcy5pbnRlcmNlcHRvcnMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3Q6IG5ldyBpKCksCiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlOiBuZXcgaSgpCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHUucHJvdG90eXBlLnJlcXVlc3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2YgZSA/IChlID0gYXJndW1lbnRzWzFdIHx8IHt9KS51cmwgPSBhcmd1bWVudHNbMF0gOiBlID0gZSB8fCB7fSwgKGUgPSBhKHRoaXMuZGVmYXVsdHMsIGUpKS5tZXRob2QgPyBlLm1ldGhvZCA9IGUubWV0aG9kLnRvTG93ZXJDYXNlKCkgOiB0aGlzLmRlZmF1bHRzLm1ldGhvZCA/IGUubWV0aG9kID0gdGhpcy5kZWZhdWx0cy5tZXRob2QudG9Mb3dlckNhc2UoKSA6IGUubWV0aG9kID0gJ2dldCc7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgIF0sIG4gPSBQcm9taXNlLnJlc29sdmUoZSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh0aGlzLmludGVyY2VwdG9ycy5yZXF1ZXN0LmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudW5zaGlmdChlLmZ1bGZpbGxlZCwgZS5yZWplY3RlZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzLmludGVyY2VwdG9ycy5yZXNwb25zZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goZS5mdWxmaWxsZWQsIGUucmVqZWN0ZWQpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsgdC5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgICAgICBuID0gbi50aGVuKHQuc2hpZnQoKSwgdC5zaGlmdCgpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgIH0sIHUucHJvdG90eXBlLmdldFVyaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBhKHRoaXMuZGVmYXVsdHMsIGUpLCBvKGUudXJsLCBlLnBhcmFtcywgZS5wYXJhbXNTZXJpYWxpemVyKS5yZXBsYWNlKC9eXD8vLCAnJyk7CiAgICAgICAgICAgICAgICB9LCByLmZvckVhY2goWwogICAgICAgICAgICAgICAgICAgICdkZWxldGUnLAogICAgICAgICAgICAgICAgICAgICdnZXQnLAogICAgICAgICAgICAgICAgICAgICdoZWFkJywKICAgICAgICAgICAgICAgICAgICAnb3B0aW9ucycKICAgICAgICAgICAgICAgIF0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdS5wcm90b3R5cGVbZV0gPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZXF1ZXN0KHIubWVyZ2UobiB8fCB7fSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB0CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSksIHIuZm9yRWFjaChbCiAgICAgICAgICAgICAgICAgICAgJ3Bvc3QnLAogICAgICAgICAgICAgICAgICAgICdwdXQnLAogICAgICAgICAgICAgICAgICAgICdwYXRjaCcKICAgICAgICAgICAgICAgIF0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdS5wcm90b3R5cGVbZV0gPSBmdW5jdGlvbiAodCwgbiwgbykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZXF1ZXN0KHIubWVyZ2UobyB8fCB7fSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogbgogICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0pLCBlLmV4cG9ydHMgPSB1OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oYW5kbGVycyA9IFtdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgby5wcm90b3R5cGUudXNlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5oYW5kbGVycy5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVsZmlsbGVkOiBlLAogICAgICAgICAgICAgICAgICAgICAgICByZWplY3RlZDogdAogICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzLmhhbmRsZXJzLmxlbmd0aCAtIDE7CiAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5lamVjdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oYW5kbGVyc1tlXSAmJiAodGhpcy5oYW5kbGVyc1tlXSA9IG51bGwpOwogICAgICAgICAgICAgICAgfSwgby5wcm90b3R5cGUuZm9yRWFjaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgci5mb3JFYWNoKHRoaXMuaGFuZGxlcnMsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IHQgJiYgZSh0KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIGUuZXhwb3J0cyA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpLCBvID0gbigyOTEpLCBpID0gbigxNDApLCBzID0gbigxNDEpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5jYW5jZWxUb2tlbiAmJiBlLmNhbmNlbFRva2VuLnRocm93SWZSZXF1ZXN0ZWQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoZSksIGUuaGVhZGVycyA9IGUuaGVhZGVycyB8fCB7fSwgZS5kYXRhID0gbyhlLmRhdGEsIGUuaGVhZGVycywgZS50cmFuc2Zvcm1SZXF1ZXN0KSwgZS5oZWFkZXJzID0gci5tZXJnZShlLmhlYWRlcnMuY29tbW9uIHx8IHt9LCBlLmhlYWRlcnNbZS5tZXRob2RdIHx8IHt9LCBlLmhlYWRlcnMpLCByLmZvckVhY2goWwogICAgICAgICAgICAgICAgICAgICAgICAnZGVsZXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2dldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdoZWFkJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3Bvc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAncHV0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ3BhdGNoJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbW1vbicKICAgICAgICAgICAgICAgICAgICBdLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgZS5oZWFkZXJzW3RdOwogICAgICAgICAgICAgICAgICAgIH0pLCAoZS5hZGFwdGVyIHx8IHMuYWRhcHRlcikoZSkudGhlbihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShlKSwgdC5kYXRhID0gbyh0LmRhdGEsIHQuaGVhZGVycywgZS50cmFuc2Zvcm1SZXNwb25zZSksIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkodCkgfHwgKGEoZSksIHQgJiYgdC5yZXNwb25zZSAmJiAodC5yZXNwb25zZS5kYXRhID0gbyh0LnJlc3BvbnNlLmRhdGEsIHQucmVzcG9uc2UuaGVhZGVycywgZS50cmFuc2Zvcm1SZXNwb25zZSkpKSwgUHJvbWlzZS5yZWplY3QodCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuZm9yRWFjaChuLCBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICBlID0gbihlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9KSwgZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICB2YXIgbiwgciwgbyA9IGUuZXhwb3J0cyA9IHt9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gaSgpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ3NldFRpbWVvdXQgaGFzIG5vdCBiZWVuIGRlZmluZWQnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdjbGVhclRpbWVvdXQgaGFzIG5vdCBiZWVuIGRlZmluZWQnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChuID09PSBzZXRUaW1lb3V0KQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2V0VGltZW91dChlLCAwKTsKICAgICAgICAgICAgICAgICAgICBpZiAoKG4gPT09IGkgfHwgIW4pICYmIHNldFRpbWVvdXQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gc2V0VGltZW91dCwgc2V0VGltZW91dChlLCAwKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbihlLCAwKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jYWxsKG51bGwsIGUsIDApOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jYWxsKHRoaXMsIGUsIDApOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIWZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBuID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHNldFRpbWVvdXQgPyBzZXRUaW1lb3V0IDogaTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGNsZWFyVGltZW91dCA/IGNsZWFyVGltZW91dCA6IHM7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByID0gczsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB2YXIgdSwgYyA9IFtdLCBmID0gITEsIGwgPSAtMTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoKSB7CiAgICAgICAgICAgICAgICAgICAgZiAmJiB1ICYmIChmID0gITEsIHUubGVuZ3RoID8gYyA9IHUuY29uY2F0KGMpIDogbCA9IC0xLCBjLmxlbmd0aCAmJiBkKCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZCgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIWYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhKHApOwogICAgICAgICAgICAgICAgICAgICAgICBmID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBjLmxlbmd0aDsgdDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodSA9IGMsIGMgPSBbXTsgKytsIDwgdDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSAmJiB1W2xdLnJ1bigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IC0xLCB0ID0gYy5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdSA9IG51bGwsIGYgPSAhMSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyID09PSBjbGVhclRpbWVvdXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNsZWFyVGltZW91dChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgociA9PT0gcyB8fCAhcikgJiYgY2xlYXJUaW1lb3V0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByID0gY2xlYXJUaW1lb3V0LCBjbGVhclRpbWVvdXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuY2FsbChudWxsLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmNhbGwodGhpcywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZnVuID0gZSwgdGhpcy5hcnJheSA9IHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KCkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgby5uZXh0VGljayA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuZXcgQXJyYXkoYXJndW1lbnRzLmxlbmd0aCAtIDEpOwogICAgICAgICAgICAgICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoID4gMSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDE7IG4gPCBhcmd1bWVudHMubGVuZ3RoOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W24gLSAxXSA9IGFyZ3VtZW50c1tuXTsKICAgICAgICAgICAgICAgICAgICBjLnB1c2gobmV3IGgoZSwgdCkpLCAxICE9PSBjLmxlbmd0aCB8fCBmIHx8IGEoZCk7CiAgICAgICAgICAgICAgICB9LCBoLnByb3RvdHlwZS5ydW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5mdW4uYXBwbHkobnVsbCwgdGhpcy5hcnJheSk7CiAgICAgICAgICAgICAgICB9LCBvLnRpdGxlID0gJ2Jyb3dzZXInLCBvLmJyb3dzZXIgPSAhMCwgby5lbnYgPSB7fSwgby5hcmd2ID0gW10sIG8udmVyc2lvbiA9ICcnLCBvLnZlcnNpb25zID0ge30sIG8ub24gPSB2LCBvLmFkZExpc3RlbmVyID0gdiwgby5vbmNlID0gdiwgby5vZmYgPSB2LCBvLnJlbW92ZUxpc3RlbmVyID0gdiwgby5yZW1vdmVBbGxMaXN0ZW5lcnMgPSB2LCBvLmVtaXQgPSB2LCBvLnByZXBlbmRMaXN0ZW5lciA9IHYsIG8ucHJlcGVuZE9uY2VMaXN0ZW5lciA9IHYsIG8ubGlzdGVuZXJzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICB9LCBvLmJpbmRpbmcgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigncHJvY2Vzcy5iaW5kaW5nIGlzIG5vdCBzdXBwb3J0ZWQnKTsKICAgICAgICAgICAgICAgIH0sIG8uY3dkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnLyc7CiAgICAgICAgICAgICAgICB9LCBvLmNoZGlyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ3Byb2Nlc3MuY2hkaXIgaXMgbm90IHN1cHBvcnRlZCcpOwogICAgICAgICAgICAgICAgfSwgby51bWFzayA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByLmZvckVhY2goZSwgZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgciAhPT0gdCAmJiByLnRvVXBwZXJDYXNlKCkgPT09IHQudG9VcHBlckNhc2UoKSAmJiAoZVt0XSA9IG4sIGRlbGV0ZSBlW3JdKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTQzKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBuLmNvbmZpZy52YWxpZGF0ZVN0YXR1czsKICAgICAgICAgICAgICAgICAgICAhbyB8fCBvKG4uc3RhdHVzKSA/IGUobikgOiB0KHIoJ1JlcXVlc3QgZmFpbGVkIHdpdGggc3RhdHVzIGNvZGUgJyArIG4uc3RhdHVzLCBuLmNvbmZpZywgbnVsbCwgbi5yZXF1ZXN0LCBuKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIsIG8pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jb25maWcgPSB0LCBuICYmIChlLmNvZGUgPSBuKSwgZS5yZXF1ZXN0ID0gciwgZS5yZXNwb25zZSA9IG8sIGUuaXNBeGlvc0Vycm9yID0gITAsIGUudG9KU09OID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZTogdGhpcy5tZXNzYWdlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogdGhpcy5uYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb246IHRoaXMuZGVzY3JpcHRpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudW1iZXI6IHRoaXMubnVtYmVyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsZU5hbWU6IHRoaXMuZmlsZU5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5lTnVtYmVyOiB0aGlzLmxpbmVOdW1iZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW5OdW1iZXI6IHRoaXMuY29sdW1uTnVtYmVyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2s6IHRoaXMuc3RhY2ssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWc6IHRoaXMuY29uZmlnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZTogdGhpcy5jb2RlCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMjk3KSwgbyA9IG4oMjk4KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgIXIodCkgPyBvKGUsIHQpIDogdDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAvXihbYS16XVthLXpcZFwrXC1cLl0qOik/XC9cLy9pLnRlc3QoZSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA/IGUucmVwbGFjZSgvXC8rJC8sICcnKSArICcvJyArIHQucmVwbGFjZSgvXlwvKy8sICcnKSA6IGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgbyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2FnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdhdXRob3JpemF0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbnRlbnQtbGVuZ3RoJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbnRlbnQtdHlwZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdldGFnJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2V4cGlyZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAnZnJvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICdob3N0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ2lmLW1vZGlmaWVkLXNpbmNlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2lmLXVubW9kaWZpZWQtc2luY2UnLAogICAgICAgICAgICAgICAgICAgICAgICAnbGFzdC1tb2RpZmllZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdsb2NhdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICdtYXgtZm9yd2FyZHMnLAogICAgICAgICAgICAgICAgICAgICAgICAncHJveHktYXV0aG9yaXphdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICdyZWZlcmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3JldHJ5LWFmdGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZXItYWdlbnQnCiAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIGksIHMgPSB7fTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IChyLmZvckVhY2goZS5zcGxpdCgnXG4nKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPSBlLmluZGV4T2YoJzonKSwgdCA9IHIudHJpbShlLnN1YnN0cigwLCBpKSkudG9Mb3dlckNhc2UoKSwgbiA9IHIudHJpbShlLnN1YnN0cihpICsgMSkpLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc1t0XSAmJiBvLmluZGV4T2YodCkgPj0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzW3RdID0gJ3NldC1jb29raWUnID09PSB0ID8gKHNbdF0gPyBzW3RdIDogW10pLmNvbmNhdChbbl0pIDogc1t0XSA/IHNbdF0gKyAnLCAnICsgbiA6IG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KSwgcykgOiBzOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByLmlzU3RhbmRhcmRCcm93c2VyRW52KCkgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQgPSAvKG1zaWV8dHJpZGVudCkvaS50ZXN0KG5hdmlnYXRvci51c2VyQWdlbnQpLCBuID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnYScpOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIChuLnNldEF0dHJpYnV0ZSgnaHJlZicsIHIpLCByID0gbi5ocmVmKSwgbi5zZXRBdHRyaWJ1dGUoJ2hyZWYnLCByKSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaHJlZjogbi5ocmVmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvdG9jb2w6IG4ucHJvdG9jb2wgPyBuLnByb3RvY29sLnJlcGxhY2UoLzokLywgJycpIDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBob3N0OiBuLmhvc3QsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWFyY2g6IG4uc2VhcmNoID8gbi5zZWFyY2gucmVwbGFjZSgvXlw/LywgJycpIDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNoOiBuLmhhc2ggPyBuLmhhc2gucmVwbGFjZSgvXiMvLCAnJykgOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhvc3RuYW1lOiBuLmhvc3RuYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9ydDogbi5wb3J0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aG5hbWU6ICcvJyA9PT0gbi5wYXRobmFtZS5jaGFyQXQoMCkgPyBuLnBhdGhuYW1lIDogJy8nICsgbi5wYXRobmFtZQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IG8od2luZG93LmxvY2F0aW9uLmhyZWYpLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHIuaXNTdHJpbmcodCkgPyBvKHQpIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ucHJvdG9jb2wgPT09IGUucHJvdG9jb2wgJiYgbi5ob3N0ID09PSBlLmhvc3Q7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKSA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIuaXNTdGFuZGFyZEJyb3dzZXJFbnYoKSA/IHsKICAgICAgICAgICAgICAgICAgICB3cml0ZTogZnVuY3Rpb24gKGUsIHQsIG4sIG8sIGksIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgYS5wdXNoKGUgKyAnPScgKyBlbmNvZGVVUklDb21wb25lbnQodCkpLCByLmlzTnVtYmVyKG4pICYmIGEucHVzaCgnZXhwaXJlcz0nICsgbmV3IERhdGUobikudG9HTVRTdHJpbmcoKSksIHIuaXNTdHJpbmcobykgJiYgYS5wdXNoKCdwYXRoPScgKyBvKSwgci5pc1N0cmluZyhpKSAmJiBhLnB1c2goJ2RvbWFpbj0nICsgaSksICEwID09PSBzICYmIGEucHVzaCgnc2VjdXJlJyksIGRvY3VtZW50LmNvb2tpZSA9IGEuam9pbignOyAnKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHJlYWQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZG9jdW1lbnQuY29va2llLm1hdGNoKG5ldyBSZWdFeHAoJyhefDtcXHMqKSgnICsgZSArICcpPShbXjtdKiknKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID8gZGVjb2RlVVJJQ29tcG9uZW50KHRbM10pIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHJlbW92ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy53cml0ZShlLCAnJywgRGF0ZS5ub3coKSAtIDg2NDAwMDAwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IDogewogICAgICAgICAgICAgICAgICAgIHdyaXRlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICByZWFkOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcmVtb3ZlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNDUpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdleGVjdXRvciBtdXN0IGJlIGEgZnVuY3Rpb24uJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9taXNlID0gbmV3IFByb21pc2UoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IGU7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzOwogICAgICAgICAgICAgICAgICAgIGUoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbi5yZWFzb24gfHwgKG4ucmVhc29uID0gbmV3IHIoZSksIHQobi5yZWFzb24pKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG8ucHJvdG90eXBlLnRocm93SWZSZXF1ZXN0ZWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMucmVhc29uKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyB0aGlzLnJlYXNvbjsKICAgICAgICAgICAgICAgIH0sIG8uc291cmNlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRva2VuOiBuZXcgbyhmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgICAgICBjYW5jZWw6IGUKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgZS5leHBvcnRzID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KG51bGwsIHQpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgaW4gZSA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSkgOiBlW3RdID0gbiwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0LmtleXMoZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB0ICYmIChyID0gci5maWx0ZXIoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGUsIHQpLmVudW1lcmFibGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgbi5wdXNoLmFwcGx5KG4sIHIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbnVsbCAhPSBhcmd1bWVudHNbdF0gPyBhcmd1bWVudHNbdF0gOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgdCAlIDIgPyBvKE9iamVjdChuKSwgITApLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoZSwgdCwgblt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhlLCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyhuKSkgOiBvKE9iamVjdChuKSkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHQsIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IobiwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBuLnIodCksIG4uZCh0LCAncWNDbXBBcGknLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHV0OwogICAgICAgICAgICAgICAgfSksIG4uZCh0LCAndXNwQXBpJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjdDsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIHMgPSBuKDApLCBhID0gbi5uKHMpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlLCB0LCBuLCByLCBvLCBpLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlW2ldKHMpLCB1ID0gYS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIG4oYyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGEuZG9uZSA/IHQodSkgOiBQcm9taXNlLnJlc29sdmUodSkudGhlbihyLCBvKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcywgbiA9IGFyZ3VtZW50czsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKGZ1bmN0aW9uIChyLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUuYXBwbHkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1KGksIHIsIG8sIHMsIGEsICduZXh0JywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1KGksIHIsIG8sIHMsIGEsICd0aHJvdycsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcyh2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCEoZSBpbnN0YW5jZW9mIHQpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdDYW5ub3QgY2FsbCBhIGNsYXNzIGFzIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgdC5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRbbl07CiAgICAgICAgICAgICAgICAgICAgICAgIHIuZW51bWVyYWJsZSA9IHIuZW51bWVyYWJsZSB8fCAhMSwgci5jb25maWd1cmFibGUgPSAhMCwgJ3ZhbHVlJyBpbiByICYmIChyLndyaXRhYmxlID0gITApLCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgci5rZXksIHIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIGwoZS5wcm90b3R5cGUsIHQpLCBuICYmIGwoZSwgbiksIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgZCwgaCwgdiwgeSwgZyA9IG4oMTQ2KTsKICAgICAgICAgICAgICAgIG4oMTMzKSwgbigxMzQpLCBuKDEzNSk7CiAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlW2UuVE9QX0xFRlQgPSAxXSA9ICdUT1BfTEVGVCcsIGVbZS5UT1BfUklHSFQgPSAyXSA9ICdUT1BfUklHSFQnLCBlW2UuQk9UVE9NX1JJR0hUID0gM10gPSAnQk9UVE9NX1JJR0hUJywgZVtlLkJPVFRPTV9MRUZUID0gNF0gPSAnQk9UVE9NX0xFRlQnOwogICAgICAgICAgICAgICAgfShkIHx8IChkID0ge30pKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLllFUyA9ICdZJywgZS5OT1QgPSAnTic7CiAgICAgICAgICAgICAgICB9KGggfHwgKGggPSB7fSkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuR0xPQkFMID0gJ2dsb2JhbCcsIGUuU0VSVklDRSA9ICdzZXJ2aWNlJywgZS5HTE9CQUxfR1JPVVAgPSAnZ2xvYmFsIGdyb3VwJywgZS5TRVJWSUNFX0dST1VQID0gJ3NlcnZpY2UgZ3JvdXAnOwogICAgICAgICAgICAgICAgfSh2IHx8ICh2ID0ge30pKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLkdEUFIgPSAnR0RQUicsIGUuVVNQID0gJ1VTUCc7CiAgICAgICAgICAgICAgICB9KHkgfHwgKHkgPSB7fSkpOwogICAgICAgICAgICAgICAgdmFyIG0gPSB7IGhhc0Nvb2tpZTogITEgfSwgYiA9IGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGYodGhpcywgZSksIHRoaXMudmVuZG9yQ29uc2VudHMgPSBpKHt9LCBtKSwgdGhpcy5wdXJwb3Nlc0NvbnNlbnRzID0gaSh7fSwgbSksIHRoaXMuc3BlY2lhbEZlYXR1cmVzID0gaSh7fSwgbSksIHRoaXMudmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0ID0gaSh7fSwgbSksIHRoaXMubGVnaXRpbWF0ZVB1cnBvc2VzQ29uc2VudHMgPSBpKHt9LCBtKSwgdGhpcy5ub25JYWJDb25zZW50cyA9IGkoe30sIG0pLCB0aGlzLmdvb2dsZUNvbnNlbnRzID0gaSh7fSwgbSksIHRoaXMuY29uc2VudFNjcmVlbiA9IDAsIHRoaXMuYWxsQ29uc2VudHMgPSAhMTsKICAgICAgICAgICAgICAgICAgICB9LCBFID0gKG4oMTM2KSwgewogICAgICAgICAgICAgICAgICAgICAgICB1c3BWZXJzaW9uOiAxLAogICAgICAgICAgICAgICAgICAgICAgICB1c3BKdXJpc2RpY3Rpb246IFtdLAogICAgICAgICAgICAgICAgICAgICAgICB1c3BMc3BhY3Q6IGguTk9ULAogICAgICAgICAgICAgICAgICAgICAgICB1c3BQcml2YWN5UG9saWN5TGluazogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcERlbGV0ZURhdGFMaW5rOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgdXNwQWNjZXNzRGF0YUxpbms6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBjb29raWVEb21haW46IHdpbmRvdy5sb2NhdGlvbi5ob3N0bmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgc3VwcHJlc3NDY3BhTGlua3M6ICEwCiAgICAgICAgICAgICAgICAgICAgfSksIEMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRUb2dnbGVWYWx1ZTogJ29mZicsCiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlVaTogJ2Fsd2F5cycsCiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlQZXJzaXN0ZW50Q29uc2VudExpbms6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBoYXNoQ29kZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIGdyb3VwU2l0ZXNVcmw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBpbml0U2NyZWVuUmVqZWN0QnV0dG9uU2hvd2luZzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5Cb2R5VGV4dE9wdGlvbjogMSwKICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ186ICdlbicsCiAgICAgICAgICAgICAgICAgICAgICAgIG5vbmNvbnNlbnREaXNwbGF5RnJlcXVlbmN5OiAxLAogICAgICAgICAgICAgICAgICAgICAgICBwZXJzaXN0ZW50Q29uc2VudExpbmtMb2NhdGlvbjogZC5CT1RUT01fUklHSFQsCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlckxvZ286ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJOYW1lOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2tzOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyRmVhdHVyZXNJZHM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJTcGVjaWFsRmVhdHVyZXNJZHM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJTcGVjaWFsUHVycG9zZXNJZHM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJQdXJwb3NlSWRzOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlclZlbmRvckxpc3RVcmw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJDb3VudHJ5Q29kZTogJ0dCJywKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yUHVycG9zZUlkczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JTcGVjaWFsRmVhdHVyZXNJZHM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvclNwZWNpYWxQdXJwb3Nlc0lkczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yRmVhdHVyZXNJZHM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICByZWplY3RDb25zZW50UmVkaXJlY3RVcmw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBzb2Z0T3B0SW5FbmFibGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgdWlMYXlvdXQ6ICdwb3B1cCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckxpc3RVcGRhdGVGcmVxOiAzMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudFNjb3BlR3JvdXBVUkw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBjb29raWVEb21haW46IHdpbmRvdy5sb2NhdGlvbi5ob3N0bmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgY29va2llUGF0aDogJy8nLAogICAgICAgICAgICAgICAgICAgICAgICB0aGlyZFBhcnR5U3RvcmFnZVR5cGU6ICdpZnJhbWUnLAogICAgICAgICAgICAgICAgICAgICAgICBzaG93U3VtbWFyeVZpZXc6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBnb29nbGVFbmFibGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudE9uU2FmYXJpOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgaXNBTVA6ICExLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJDb25zZW50UmVzdHJpY3Rpb25JZHM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJMSVJlc3RyaWN0aW9uSWRzOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudElkZW50aXR5RW5hYmxlZDogITEKICAgICAgICAgICAgICAgICAgICB9LCBfID0gewogICAgICAgICAgICAgICAgICAgICAgICBpbml0U2NyZWVuQ3VzdG9tTGlua3M6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBsaW5rc1RpdGxlOiAnQWRkaXRpb25hbCBMaW5rcycsCiAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvcnNMYWJlbDogJ05vbi1JQUIgVmVuZG9ycycKICAgICAgICAgICAgICAgICAgICB9LCBTID0gewogICAgICAgICAgICAgICAgICAgICAgICB1c3BEbnNUaXRsZTogJ0RvIE5vdCBTZWxsIE15IFBlcnNvbmFsIEluZm9ybWF0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgdXNwRG5zVGV4dDogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1dlLCBhbmQgb3VyIHBhcnRuZXJzLCB1c2UgdGVjaG5vbG9naWVzIHRvIHByb2Nlc3MgcGVyc29uYWwgICAgIGluZm9ybWF0aW9uLCBpbmNsdWRpbmcgSVAgYWRkcmVzc2VzLCBwc2V1ZG9ueW1vdXMgaWRlbnRpZmllcnMgYXNzb2NpYXRlZCAgICAgd2l0aCBjb29raWVzLCBhbmQgaW4gc29tZSBjYXNlcyBtb2JpbGUgYWQgSURzLiBUaGlzIGluZm9ybWF0aW9uIGlzIHByb2Nlc3NlZCAgICAgdG8gcGVyc29uYWxpemUgY29udGVudCBiYXNlZCBvbiB5b3VyIGludGVyZXN0cywgcnVuIGFuZCBvcHRpbWl6ZSBtYXJrZXRpbmcgICAgIGNhbXBhaWducywgbWVhc3VyZSB0aGUgcGVyZm9ybWFuY2Ugb2YgYWRzIGFuZCBjb250ZW50LCBhbmQgZGVyaXZlIGluc2lnaHRzICAgICBhYm91dCB0aGUgYXVkaWVuY2VzIHdobyBlbmdhZ2Ugd2l0aCBhZHMgYW5kIGNvbnRlbnQuIFRoaXMgZGF0YSBpcyBhbiBpbnRlZ3JhbCAgICAgcGFydCBvZiBob3cgd2Ugb3BlcmF0ZSBvdXIgc2l0ZSwgbWFrZSByZXZlbnVlIHRvIHN1cHBvcnQgb3VyIHN0YWZmLCBhbmQgZ2VuZXJhdGUgICAgIHJlbGV2YW50IGNvbnRlbnQgZm9yIG91ciBhdWRpZW5jZS4gWW91IGNhbiBsZWFybiBtb3JlIGFib3V0IG91ciBkYXRhIGNvbGxlY3Rpb24gICAgIGFuZCB1c2UgcHJhY3RpY2VzIGluIG91ciBQcml2YWN5IFBvbGljeS4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0lmIHlvdSB3aXNoIHRvIHJlcXVlc3QgdGhhdCB5b3VyIHBlcnNvbmFsIGluZm9ybWF0aW9uIGlzIG5vdCBzaGFyZWQgd2l0aCB0aGlyZCAgICAgcGFydGllcywgcGxlYXNlIGNsaWNrIG9uIHRoZSBiZWxvdyBjaGVja2JveCBhbmQgY29uZmlybSB5b3VyIHNlbGVjdGlvbi4gUGxlYXNlIG5vdGUgICAgIHRoYXQgYWZ0ZXIgeW91ciBvcHQgb3V0IHJlcXVlc3QgaXMgcHJvY2Vzc2VkLCB3ZSBtYXkgc3RpbGwgY29sbGVjdCB5b3VyICAgICBpbmZvcm1hdGlvbiBpbiBvcmRlciB0byBvcGVyYXRlIG91ciBzaXRlLicKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNwRG9Ob3RTZWxsVG9nZ2xlVGV4dDogJ0kgd2FudCB0byBtYWtlIGEgIkRvIE5vdCBTZWxsIE15IFBlcnNvbmFsIEluZm9ybWF0aW9uIiByZXF1ZXN0LiBOb3RlOiB0aGlzIGFjdGlvbiB3aWxsIG1ha2UgaXQgaGFyZGVyIHRvIHVzIHRvIHRhaWxvciBjb250ZW50IGZvciB5b3UuJywKICAgICAgICAgICAgICAgICAgICAgICAgdXNwUHJpdmFjeVBvbGljeUxpbmtUZXh0OiAnUHJpdmFjeSBQb2xpY3knLAogICAgICAgICAgICAgICAgICAgICAgICB1c3BEZWxldGVEYXRhTGlua1RleHQ6ICdEYXRhIERlbGV0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgdXNwQWNjZXNzRGF0YUxpbmtUZXh0OiAnRGF0YSBBY2Nlc3MnLAogICAgICAgICAgICAgICAgICAgICAgICB1c3BBY2NlcHRCdXR0b246ICdDT05GSVJNJwogICAgICAgICAgICAgICAgICAgIH0sIHcgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5UaXRsZTogJ1dlIHZhbHVlIHlvdXIgcHJpdmFjeScsCiAgICAgICAgICAgICAgICAgICAgICAgIGFncmVlQnV0dG9uOiAnQUdSRUUnLAogICAgICAgICAgICAgICAgICAgICAgICBpbml0U2NyZWVuUmVqZWN0QnV0dG9uOiAnRElTQUdSRUUnLAogICAgICAgICAgICAgICAgICAgICAgICBpbml0U2NyZWVuU2V0dGluZ3NCdXR0b246ICdNT1JFIE9QVElPTlMnLAogICAgICAgICAgICAgICAgICAgICAgICBzdW1tYXJ5U2NyZWVuQm9keU5vUmVqZWN0U2VydmljZTogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1dlIGFuZCBvdXIgcGFydG5lcnMgc3RvcmUgYW5kL29yIGFjY2VzcyBpbmZvcm1hdGlvbiBvbiBhIGRldmljZSwgc3VjaCBhcyBjb29raWVzIGFuZCBwcm9jZXNzIHBlcnNvbmFsIGRhdGEsIHN1Y2ggYXMgdW5pcXVlIGlkZW50aWZpZXJzIGFuZCBzdGFuZGFyZCBpbmZvcm1hdGlvbiBzZW50IGJ5IGEgZGV2aWNlIGZvciBwZXJzb25hbGlzZWQgYWRzIGFuZCBjb250ZW50LCBhZCBhbmQgY29udGVudCBtZWFzdXJlbWVudCwgYW5kIGF1ZGllbmNlIGluc2lnaHRzLCBhcyB3ZWxsIGFzIHRvIGRldmVsb3AgYW5kIGltcHJvdmUgcHJvZHVjdHMuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcgV2l0aCB5b3VyIHBlcm1pc3Npb24gd2UgYW5kIG91ciBwYXJ0bmVycyBtYXkgdXNlIHByZWNpc2UgZ2VvbG9jYXRpb24gZGF0YSBhbmQgaWRlbnRpZmljYXRpb24gdGhyb3VnaCBkZXZpY2Ugc2Nhbm5pbmcuIFlvdSBtYXkgY2xpY2sgdG8gY29uc2VudCB0byBvdXIgYW5kIG91ciBwYXJ0bmVyc1x1MjAxOSBwcm9jZXNzaW5nIGFzIGRlc2NyaWJlZCBhYm92ZS4gQWx0ZXJuYXRpdmVseSB5b3UgbWF5IGFjY2VzcyBtb3JlIGRldGFpbGVkIGluZm9ybWF0aW9uIGFuZCBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBiZWZvcmUgY29uc2VudGluZyBvciB0byByZWZ1c2UgY29uc2VudGluZy4gUGxlYXNlIG5vdGUgdGhhdCBzb21lIHByb2Nlc3Npbmcgb2YgeW91ciBwZXJzb25hbCBkYXRhIG1heSBub3QgcmVxdWlyZSB5b3VyIGNvbnNlbnQsIGJ1dCB5b3UgaGF2ZSBhIHJpZ2h0IHRvIG9iamVjdCB0byBzdWNoIHByb2Nlc3NpbmcuIFlvdXIgcHJlZmVyZW5jZXMgd2lsbCBhcHBseSB0byB0aGlzIHdlYnNpdGUgb25seS4gWW91IGNhbiBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBhdCBhbnkgdGltZSBieSByZXR1cm5pbmcgdG8gdGhpcyBzaXRlIG9yIHZpc2l0IG91ciBwcml2YWN5IHBvbGljeS5cbicKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgc3VtbWFyeVNjcmVlbkJvZHlOb1JlamVjdEdsb2JhbDogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1dlIGFuZCBvdXIgcGFydG5lcnMgc3RvcmUgYW5kL29yIGFjY2VzcyBpbmZvcm1hdGlvbiBvbiBhIGRldmljZSwgc3VjaCBhcyBjb29raWVzIGFuZCBwcm9jZXNzIHBlcnNvbmFsIGRhdGEsIHN1Y2ggYXMgdW5pcXVlIGlkZW50aWZpZXJzIGFuZCBzdGFuZGFyZCBpbmZvcm1hdGlvbiBzZW50IGJ5IGEgZGV2aWNlIGZvciBwZXJzb25hbGlzZWQgYWRzIGFuZCBjb250ZW50LCBhZCBhbmQgY29udGVudCBtZWFzdXJlbWVudCwgYW5kIGF1ZGllbmNlIGluc2lnaHRzLCBhcyB3ZWxsIGFzIHRvIGRldmVsb3AgYW5kIGltcHJvdmUgcHJvZHVjdHMuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcgV2l0aCB5b3VyIHBlcm1pc3Npb24gd2UgYW5kIG91ciBwYXJ0bmVycyBtYXkgdXNlIHByZWNpc2UgZ2VvbG9jYXRpb24gZGF0YSBhbmQgaWRlbnRpZmljYXRpb24gdGhyb3VnaCBkZXZpY2Ugc2Nhbm5pbmcuIFlvdSBtYXkgY2xpY2sgdG8gY29uc2VudCB0byBvdXIgYW5kIG91ciBwYXJ0bmVyc1x1MjAxOSBwcm9jZXNzaW5nIGFzIGRlc2NyaWJlZCBhYm92ZS4gQWx0ZXJuYXRpdmVseSB5b3UgbWF5IGFjY2VzcyBtb3JlIGRldGFpbGVkIGluZm9ybWF0aW9uIGFuZCBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBiZWZvcmUgY29uc2VudGluZyBvciB0byByZWZ1c2UgY29uc2VudGluZy4gUGxlYXNlIG5vdGUgdGhhdCBzb21lIHByb2Nlc3Npbmcgb2YgeW91ciBwZXJzb25hbCBkYXRhIG1heSBub3QgcmVxdWlyZSB5b3VyIGNvbnNlbnQsIGJ1dCB5b3UgaGF2ZSBhIHJpZ2h0IHRvIG9iamVjdCB0byBzdWNoIHByb2Nlc3NpbmcuIFlvdXIgcHJlZmVyZW5jZXMgd2lsbCBhcHBseSBhY3Jvc3MgdGhlIHdlYi4gWW91IGNhbiBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBhdCBhbnkgdGltZSBieSByZXR1cm5pbmcgdG8gdGhpcyBzaXRlIG9yIHZpc2l0IG91ciBwcml2YWN5IHBvbGljeS4nCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5Tm9SZWplY3RHcm91cDogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1dlIGFuZCBvdXIgcGFydG5lcnMgc3RvcmUgYW5kL29yIGFjY2VzcyBpbmZvcm1hdGlvbiBvbiBhIGRldmljZSwgc3VjaCBhcyBjb29raWVzIGFuZCBwcm9jZXNzIHBlcnNvbmFsIGRhdGEsIHN1Y2ggYXMgdW5pcXVlIGlkZW50aWZpZXJzIGFuZCBzdGFuZGFyZCBpbmZvcm1hdGlvbiBzZW50IGJ5IGEgZGV2aWNlIGZvciBwZXJzb25hbGlzZWQgYWRzIGFuZCBjb250ZW50LCBhZCBhbmQgY29udGVudCBtZWFzdXJlbWVudCwgYW5kIGF1ZGllbmNlIGluc2lnaHRzLCBhcyB3ZWxsIGFzIHRvIGRldmVsb3AgYW5kIGltcHJvdmUgcHJvZHVjdHMuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcgV2l0aCB5b3VyIHBlcm1pc3Npb24gd2UgYW5kIG91ciBwYXJ0bmVycyBtYXkgdXNlIHByZWNpc2UgZ2VvbG9jYXRpb24gZGF0YSBhbmQgaWRlbnRpZmljYXRpb24gdGhyb3VnaCBkZXZpY2Ugc2Nhbm5pbmcuIFlvdSBtYXkgY2xpY2sgdG8gY29uc2VudCB0byBvdXIgYW5kIG91ciBwYXJ0bmVyc1x1MjAxOSBwcm9jZXNzaW5nIGFzIGRlc2NyaWJlZCBhYm92ZS4gQWx0ZXJuYXRpdmVseSB5b3UgbWF5IGFjY2VzcyBtb3JlIGRldGFpbGVkIGluZm9ybWF0aW9uIGFuZCBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBiZWZvcmUgY29uc2VudGluZyBvciB0byByZWZ1c2UgY29uc2VudGluZy4gUGxlYXNlIG5vdGUgdGhhdCBzb21lIHByb2Nlc3Npbmcgb2YgeW91ciBwZXJzb25hbCBkYXRhIG1heSBub3QgcmVxdWlyZSB5b3VyIGNvbnNlbnQsIGJ1dCB5b3UgaGF2ZSBhIHJpZ2h0IHRvIG9iamVjdCB0byBzdWNoIHByb2Nlc3NpbmcuIFlvdXIgcHJlZmVyZW5jZXMgd2lsbCBhcHBseSB0byBhIGdyb3VwIG9mIHdlYnNpdGVzIFtoeXBlcmxpbmtlZCB0byBkb21haW4gd2hlcmUgYWxsIHRoZSBwcm9wZXJ0aWVzIGFyZSBsaXN0ZWQgZm9yIHRoaXMgZ3JvdXAgY29uZmlndXJhdGlvbl0uWW91IGNhbiBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBhdCBhbnkgdGltZSBieSByZXR1cm5pbmcgdG8gdGhpcyBzaXRlIG9yIHZpc2l0IG91ciBwcml2YWN5IHBvbGljeS4nCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5UmVqZWN0U2VydmljZTogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1dlIGFuZCBvdXIgcGFydG5lcnMgc3RvcmUgYW5kL29yIGFjY2VzcyBpbmZvcm1hdGlvbiBvbiBhIGRldmljZSwgc3VjaCBhcyBjb29raWVzIGFuZCBwcm9jZXNzIHBlcnNvbmFsIGRhdGEsIHN1Y2ggYXMgdW5pcXVlIGlkZW50aWZpZXJzIGFuZCBzdGFuZGFyZCBpbmZvcm1hdGlvbiBzZW50IGJ5IGEgZGV2aWNlIGZvciBwZXJzb25hbGlzZWQgYWRzIGFuZCBjb250ZW50LCBhZCBhbmQgY29udGVudCBtZWFzdXJlbWVudCwgYW5kIGF1ZGllbmNlIGluc2lnaHRzLCBhcyB3ZWxsIGFzIHRvIGRldmVsb3AgYW5kIGltcHJvdmUgcHJvZHVjdHMuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcgV2l0aCB5b3VyIHBlcm1pc3Npb24gd2UgYW5kIG91ciBwYXJ0bmVycyBtYXkgdXNlIHByZWNpc2UgZ2VvbG9jYXRpb24gZGF0YSBhbmQgaWRlbnRpZmljYXRpb24gdGhyb3VnaCBkZXZpY2Ugc2Nhbm5pbmcuIFlvdSBtYXkgY2xpY2sgdG8gY29uc2VudCB0byBvdXIgYW5kIG91ciBwYXJ0bmVyc1x1MjAxOSBwcm9jZXNzaW5nIGFzIGRlc2NyaWJlZCBhYm92ZS4gQWx0ZXJuYXRpdmVseSB5b3UgbWF5IGNsaWNrIHRvIHJlZnVzZSB0byBjb25zZW50IG9yIGFjY2VzcyBtb3JlIGRldGFpbGVkIGluZm9ybWF0aW9uIGFuZCBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBiZWZvcmUgY29uc2VudGluZy4gUGxlYXNlIG5vdGUgdGhhdCBzb21lIHByb2Nlc3Npbmcgb2YgeW91ciBwZXJzb25hbCBkYXRhIG1heSBub3QgcmVxdWlyZSB5b3VyIGNvbnNlbnQsIGJ1dCB5b3UgaGF2ZSBhIHJpZ2h0IHRvIG9iamVjdCB0byBzdWNoIHByb2Nlc3NpbmcuIFlvdXIgcHJlZmVyZW5jZXMgd2lsbCBhcHBseSB0byB0aGlzIHdlYnNpdGUgb25seS4gWW91IGNhbiBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBhdCBhbnkgdGltZSBieSByZXR1cm5pbmcgdG8gdGhpcyBzaXRlIG9yIHZpc2l0IG91ciBwcml2YWN5IHBvbGljeS4nCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5UmVqZWN0R2xvYmFsOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnV2UgYW5kIG91ciBwYXJ0bmVycyBzdG9yZSBhbmQvb3IgYWNjZXNzIGluZm9ybWF0aW9uIG9uIGEgZGV2aWNlLCBzdWNoIGFzIGNvb2tpZXMgYW5kIHByb2Nlc3MgcGVyc29uYWwgZGF0YSwgc3VjaCBhcyB1bmlxdWUgaWRlbnRpZmllcnMgYW5kIHN0YW5kYXJkIGluZm9ybWF0aW9uIHNlbnQgYnkgYSBkZXZpY2UgZm9yIHBlcnNvbmFsaXNlZCBhZHMgYW5kIGNvbnRlbnQsIGFkIGFuZCBjb250ZW50IG1lYXN1cmVtZW50LCBhbmQgYXVkaWVuY2UgaW5zaWdodHMsIGFzIHdlbGwgYXMgdG8gZGV2ZWxvcCBhbmQgaW1wcm92ZSBwcm9kdWN0cy4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJyBXaXRoIHlvdXIgcGVybWlzc2lvbiB3ZSBhbmQgb3VyIHBhcnRuZXJzIG1heSB1c2UgcHJlY2lzZSBnZW9sb2NhdGlvbiBkYXRhIGFuZCBpZGVudGlmaWNhdGlvbiB0aHJvdWdoIGRldmljZSBzY2FubmluZy5Zb3UgbWF5IGNsaWNrIHRvIGNvbnNlbnQgdG8gb3VyIGFuZCBvdXIgcGFydG5lcnNcdTIwMTkgcHJvY2Vzc2luZyBhcyBkZXNjcmliZWQgYWJvdmUuIEFsdGVybmF0aXZlbHkgeW91IG1heSBjbGljayB0byByZWZ1c2UgdG8gY29uc2VudCBvciBhY2Nlc3MgbW9yZSBkZXRhaWxlZCBpbmZvcm1hdGlvbiBhbmQgY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYmVmb3JlIGNvbnNlbnRpbmcuIFBsZWFzZSBub3RlIHRoYXQgc29tZSBwcm9jZXNzaW5nIG9mIHlvdXIgcGVyc29uYWwgZGF0YSBtYXkgbm90IHJlcXVpcmUgeW91ciBjb25zZW50LCBidXQgeW91IGhhdmUgYSByaWdodCB0byBvYmplY3QgdG8gc3VjaCBwcm9jZXNzaW5nLiBZb3VyIHByZWZlcmVuY2VzIHdpbGwgYXBwbHkgYWNyb3NzIHRoZSB3ZWIuWW91IGNhbiBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBhdCBhbnkgdGltZSBieSByZXR1cm5pbmcgdG8gdGhpcyBzaXRlIG9yIHZpc2l0IG91ciBwcml2YWN5IHBvbGljeS4nCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5UmVqZWN0R3JvdXA6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdXZSBhbmQgb3VyIHBhcnRuZXJzIHN0b3JlIGFuZC9vciBhY2Nlc3MgaW5mb3JtYXRpb24gb24gYSBkZXZpY2UsIHN1Y2ggYXMgY29va2llcyBhbmQgcHJvY2VzcyBwZXJzb25hbCBkYXRhLCBzdWNoIGFzIHVuaXF1ZSBpZGVudGlmaWVycyBhbmQgc3RhbmRhcmQgaW5mb3JtYXRpb24gc2VudCBieSBhIGRldmljZSBmb3IgcGVyc29uYWxpc2VkIGFkcyBhbmQgY29udGVudCwgYWQgYW5kIGNvbnRlbnQgbWVhc3VyZW1lbnQsIGFuZCBhdWRpZW5jZSBpbnNpZ2h0cywgYXMgd2VsbCBhcyB0byBkZXZlbG9wIGFuZCBpbXByb3ZlIHByb2R1Y3RzLicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnIFdpdGggeW91ciBwZXJtaXNzaW9uIHdlIGFuZCBvdXIgcGFydG5lcnMgbWF5IHVzZSBwcmVjaXNlIGdlb2xvY2F0aW9uIGRhdGEgYW5kIGlkZW50aWZpY2F0aW9uIHRocm91Z2ggZGV2aWNlIHNjYW5uaW5nLiBZb3UgbWF5IGNsaWNrIHRvIGNvbnNlbnQgdG8gb3VyIGFuZCBvdXIgcGFydG5lcnNcdTIwMTkgcHJvY2Vzc2luZyBhcyBkZXNjcmliZWQgYWJvdmUuIEFsdGVybmF0aXZlbHkgeW91IG1heSBjbGljayB0byByZWZ1c2UgdG8gY29uc2VudCBvciBhY2Nlc3MgbW9yZSBkZXRhaWxlZCBpbmZvcm1hdGlvbiBhbmQgY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYmVmb3JlIGNvbnNlbnRpbmcuIFBsZWFzZSBub3RlIHRoYXQgc29tZSBwcm9jZXNzaW5nIG9mIHlvdXIgcGVyc29uYWwgZGF0YSBtYXkgbm90IHJlcXVpcmUgeW91ciBjb25zZW50LCBidXQgeW91IGhhdmUgYSByaWdodCB0byBvYmplY3QgdG8gc3VjaCBwcm9jZXNzaW5nLiBZb3VyIHByZWZlcmVuY2VzIHdpbGwgYXBwbHkgdG8gYSBncm91cCBvZiB3ZWJzaXRlcyBbbGlua3MgdG8gZG9tYWluIHdoZXJlIGFsbCB0aGUgcHJvcGVydGllcyBhcmUgbGlzdGVkIGZvciB0aGlzIGdyb3VwIGNvbmZpZ3VyYXRpb25dLiBZb3UgY2FuIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGF0IGFueSB0aW1lIGJ5IHJldHVybmluZyB0byB0aGlzIHNpdGUgb3IgdmlzaXQgb3VyIHByaXZhY3kgcG9saWN5LicKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNjcmVlbkJvZHlHbG9iYWw6ICdXZSBhbmQgb3VyIHBhcnRuZXJzIHN0b3JlIG9yIGFjY2VzcyBpbmZvcm1hdGlvbiBvbiBkZXZpY2VzLCBzdWNoIGFzIGNvb2tpZXMgYW5kIHByb2Nlc3MgcGVyc29uYWwgZGF0YSwgc3VjaCBhcyB1bmlxdWUgaWRlbnRpZmllcnMgYW5kIHN0YW5kYXJkIGluZm9ybWF0aW9uIHNlbnQgYnkgYSBkZXZpY2UgZm9yIHRoZSBwdXJwb3NlcyBkZXNjcmliZWQgYmVsb3cuIFlvdSBtYXkgY2xpY2sgdG8gY29uc2VudCB0byBvdXIgYW5kIG91ciBwYXJ0bmVyc1x1MjAxOSBwcm9jZXNzaW5nIGZvciBzdWNoIHB1cnBvc2VzLiBBbHRlcm5hdGl2ZWx5LCB5b3UgbWF5IGNsaWNrIHRvIHJlZnVzZSB0byBjb25zZW50LCBvciBhY2Nlc3MgbW9yZSBkZXRhaWxlZCBpbmZvcm1hdGlvbiB0byBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBiZWZvcmUgY29uc2VudGluZy4gWW91ciBwcmVmZXJlbmNlcyB3aWxsIGFwcGx5IGFjcm9zcyB0aGUgd2ViLiBQbGVhc2Ugbm90ZSB0aGF0IHNvbWUgcHJvY2Vzc2luZyBvZiB5b3VyIHBlcnNvbmFsIGRhdGEgbWF5IG5vdCByZXF1aXJlIHlvdXIgY29uc2VudCwgYnV0IHlvdSBoYXZlIGEgcmlnaHQgdG8gb2JqZWN0IHRvIHN1Y2ggcHJvY2Vzc2luZy4gWW91IGNhbiBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBhdCBhbnkgdGltZSBieSByZXR1cm5pbmcgdG8gdGhpcyBzaXRlIG9yIHZpc2l0IG91ciBwcml2YWN5IHBvbGljeS4nLAogICAgICAgICAgICAgICAgICAgICAgICBpbml0U2NyZWVuQm9keVNlcnZpY2U6ICdXZSBhbmQgb3VyIHBhcnRuZXJzIHN0b3JlIG9yIGFjY2VzcyBpbmZvcm1hdGlvbiBvbiBkZXZpY2VzLCBzdWNoIGFzIGNvb2tpZXMgYW5kIHByb2Nlc3MgcGVyc29uYWwgZGF0YSwgc3VjaCBhcyB1bmlxdWUgaWRlbnRpZmllcnMgYW5kIHN0YW5kYXJkIGluZm9ybWF0aW9uIHNlbnQgYnkgYSBkZXZpY2UgZm9yIHRoZSBwdXJwb3NlcyBkZXNjcmliZWQgYmVsb3cuIFlvdSBtYXkgY2xpY2sgdG8gY29uc2VudCB0byBvdXIgYW5kIG91ciBwYXJ0bmVyc1x1MjAxOSBwcm9jZXNzaW5nIGZvciBzdWNoIHB1cnBvc2VzLiBBbHRlcm5hdGl2ZWx5LCB5b3UgbWF5IGNsaWNrIHRvIHJlZnVzZSB0byBjb25zZW50LCBvciBhY2Nlc3MgbW9yZSBkZXRhaWxlZCBpbmZvcm1hdGlvbiBhbmQgY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYmVmb3JlIGNvbnNlbnRpbmcuIFlvdXIgcHJlZmVyZW5jZXMgd2lsbCBhcHBseSB0byB0aGlzIHdlYnNpdGUgb25seS4gUGxlYXNlIG5vdGUgdGhhdCBzb21lIHByb2Nlc3Npbmcgb2YgeW91ciBwZXJzb25hbCBkYXRhIG1heSBub3QgcmVxdWlyZSB5b3VyIGNvbnNlbnQsIGJ1dCB5b3UgaGF2ZSBhIHJpZ2h0IHRvIG9iamVjdCB0byBzdWNoIHByb2Nlc3NpbmcuIFlvdSBjYW4gY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYXQgYW55IHRpbWUgYnkgcmV0dXJuaW5nIHRvIHRoaXMgc2l0ZSBvciB2aXNpdCBvdXIgcHJpdmFjeSBwb2xpY3kuJywKICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNjcmVlbkJvZHlHcm91cDogJ1dlIGFuZCBvdXIgcGFydG5lcnMgc3RvcmUgb3IgYWNjZXNzIGluZm9ybWF0aW9uIG9uIGRldmljZXMsIHN1Y2ggYXMgY29va2llcyBhbmQgcHJvY2VzcyBwZXJzb25hbCBkYXRhLCBzdWNoIGFzIHVuaXF1ZSBpZGVudGlmaWVycyBhbmQgc3RhbmRhcmQgaW5mb3JtYXRpb24gc2VudCBieSBhIGRldmljZSBmb3IgdGhlIHB1cnBvc2VzIGRlc2NyaWJlZCBiZWxvdy4gWW91IG1heSBjbGljayB0byBjb25zZW50IHRvIG91ciBhbmQgb3VyIHBhcnRuZXJzXHUyMDE5IHByb2Nlc3NpbmcgZm9yIHN1Y2ggcHVycG9zZXMuIEFsdGVybmF0aXZlbHksIHlvdSBtYXkgY2xpY2sgdG8gcmVmdXNlIHRvIGNvbnNlbnQsIG9yIGFjY2VzcyBtb3JlIGRldGFpbGVkIGluZm9ybWF0aW9uIGFuZCBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBiZWZvcmUgY29uc2VudGluZy4gWW91ciBwcmVmZXJlbmNlcyB3aWxsIGFwcGx5IHRvIGEgZ3JvdXAgb2Ygd2Vic2l0ZXMgW2xpbmtzIHRvIGRvbWFpbiB3aGVyZSBhbGwgdGhlIHByb3BlcnRpZXMgYXJlIGxpc3RlZCBmb3IgdGhpcyBncm91cCBjb25maWd1cmF0aW9uXS4gUGxlYXNlIG5vdGUgdGhhdCBzb21lIHByb2Nlc3Npbmcgb2YgeW91ciBwZXJzb25hbCBkYXRhIG1heSBub3QgcmVxdWlyZSB5b3VyIGNvbnNlbnQsIGJ1dCB5b3UgaGF2ZSBhIHJpZ2h0IHRvIG9iamVjdCB0byBzdWNoIHByb2Nlc3NpbmcuIFlvdSBjYW4gY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYXQgYW55IHRpbWUgYnkgcmV0dXJuaW5nIHRvIHRoaXMgc2l0ZSBvciB2aXNpdCBvdXIgcHJpdmFjeSBwb2xpY3kuJywKICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lhbFB1cnBvc2VzQW5kRmVhdHVyZXM6ICdTcGVjaWFsIFB1cnBvc2VzIGFuZCBGZWF0dXJlcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVBbmRFeGl0QnV0dG9uOiAnU0FWRSAmIEVYSVQnLAogICAgICAgICAgICAgICAgICAgICAgICBwdXJwb3NlU2NyZWVuVmVuZG9yTGluazogJ1BBUlRORVJTJywKICAgICAgICAgICAgICAgICAgICAgICAgbGVnaXRpbWF0ZUludGVyZXN0TGluazogJ0xFR0lUSU1BVEUgSU5URVJFU1QgJywKICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lhbFB1cnBvc2VzTGFiZWw6ICdTcGVjaWFsIFB1cnBvc2VzJywKICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lhbEZlYXR1cmVzTGFiZWw6ICdTcGVjaWFsIEZlYXR1cmVzJywKICAgICAgICAgICAgICAgICAgICAgICAgZmVhdHVyZXNMYWJlbDogJ0ZlYXR1cmVzJywKICAgICAgICAgICAgICAgICAgICAgICAgYmFjazogJ0JhY2snLAogICAgICAgICAgICAgICAgICAgICAgICBvbkxhYmVsOiAnT04nLAogICAgICAgICAgICAgICAgICAgICAgICBvZmZMYWJlbDogJ09GRicsCiAgICAgICAgICAgICAgICAgICAgICAgIG11bHRpTGFiZWw6ICdNVUxUSScsCiAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2FsRGVzY3JpcHRpb246ICdMZWdhbCBEZXNjcmlwdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgIHNob3dQYXJ0bmVyczogJ1Nob3cgUGFydG5lcnMnLAogICAgICAgICAgICAgICAgICAgICAgICBoaWRlUGFydG5lcnM6ICdIaWRlIFBhcnRuZXJzJywKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yU2NyZWVuQm9keTogJ1JldmlldyBhbmQgc2V0IHlvdXIgY29uc2VudCBwcmVmZXJlbmNlcyBmb3IgZWFjaCBwYXJ0bmVyIGJlbG93LiBFeHBhbmQgZWFjaCBwYXJ0bmVyIGxpc3QgaXRlbSBmb3IgbW9yZSBpbmZvcm1hdGlvbiB0byBoZWxwIG1ha2UgeW91ciBjaG9pY2UuIFNvbWUgcGVyc29uYWwgZGF0YSBpcyBwcm9jZXNzZWQgd2l0aG91dCB5b3VyIGNvbnNlbnQsIGJ1dCB5b3UgaGF2ZSB0aGUgcmlnaHQgdG8gb2JqZWN0LicsCiAgICAgICAgICAgICAgICAgICAgICAgIHByaXZhY3lQb2xpY3lMYWJlbDogJ1ByaXZhY3kgUG9saWN5JywKICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb25MYWJlbDogJ1ZlbmRvciBEZXNjcmlwdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2l0aW1hdGVTY3JlZW5Cb2R5OiAnUmV2aWV3IGFuZCBvYmplY3QgdG8gcHJvY2Vzc2luZyBvZiBwZXJzb25hbCBkYXRhIHdpdGhvdXQgeW91ciBjb25zZW50IG9uIHRoZSBiYXNpcyBvZiBhIGxlZ2l0aW1hdGUgaW50ZXJlc3QgZm9yIGVhY2ggcHVycG9zZSBhbmQgYnkgZWFjaCBwYXJ0bmVyIGJlbG93LiBFeHBhbmQgZWFjaCBwdXJwb3NlIG9yIHBhcnRuZXIgbGlzdCBpdGVtIGZvciBtb3JlIGluZm9ybWF0aW9uIHRvIGhlbHAgbWFrZSB5b3VyIGNob2ljZS4gVG8gb2JqZWN0IHRvIHRoZSBzcGVjaWFsIHB1cnBvc2VzIG9mIGVuc3VyaW5nIHNlY3VyaXR5LCBwcmV2ZW50aW5nIGZyYXVkLCBhbmQgZGVidWdnaW5nLCBhbmQgdGVjaG5pY2FsbHkgZGVsaXZlcmluZyBhZHMgb3IgY29udGVudCBjbGljayBvbiBhIHBhcnRuZXJcJ3MgcHJpdmFjeSBwb2xpY3kgbGluay4nLAogICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlSW50ZXJlc3RQdXJwb3Nlc0xhYmVsOiAnTGVnaXRpbWF0ZSBJbnRlcmVzdCBQdXJwb3NlKHMpJywKICAgICAgICAgICAgICAgICAgICAgICAgbGVnaXRpbWF0ZUludGVyZXN0VmVuZG9yTGFiZWw6ICdMZWdpdGltYXRlIEludGVyZXN0IFZlbmRvcnMnLAogICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlU2NyZWVuT2JqZWN0OiAnT0JKRUNUICh0cmFuc2xhdGlvbiBoaW50OiB2ZXJiIHRvIG9iamVjdCknLAogICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlU2NyZWVuT2JqZWN0ZWQ6ICdPQkpFQ1RFRCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2l0aW1hdGVTY3JlZW5BY2NlcHQ6ICdSRU1PVkUgT0JKRUNUSU9OJywKICAgICAgICAgICAgICAgICAgICAgICAgb2JqZWN0QWxsQnV0dG9uOiAnT0JKRUNUIEFMTCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHBlcnNpc3RlbnRDb25zZW50TGlua0xhYmVsOiAnUHJpdmFjeScsCiAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvcnNOb3RpY2U6ICdWZW5kb3JzIHdobyBkbyBub3QgcGFydGljaXBhdGUgaW4gdGhlIElBQiBFdXJvcGUgVHJhbnNwYXJlbmN5IGFuZCBDb25zZW50IEZyYW1ld29yayBhbmQgZG8gbm90IGFkaGVyZSB0byBpdHMgcG9saWNpZXMgb3IgdGVjaG5pY2FsIHNwZWNpZmljYXRpb25zJywKICAgICAgICAgICAgICAgICAgICAgICAgZ29vZ2xlUGFydG5lcnM6ICdHb29nbGUgUGFydG5lcnMnLAogICAgICAgICAgICAgICAgICAgICAgICBjb29raWVNYXhBZ2VMYWJlbDogJ01heCBjb29raWUgYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgc2Vjb25kc0xhYmVsOiAnc2Vjb25kcycsCiAgICAgICAgICAgICAgICAgICAgICAgIGRheXNMYWJlbDogJ2RheXMnLAogICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRGlzY2xvc3VyZUxhYmVsOiAnQ29va2llIGRpc2Nsb3N1cmUnCiAgICAgICAgICAgICAgICAgICAgfSwgSSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yTGlzdFVybDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckJsYWNrbGlzdDogW10sCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvcldoaXRlbGlzdDogW10KICAgICAgICAgICAgICAgICAgICB9LCBPID0gewogICAgICAgICAgICAgICAgICAgICAgICB1eEJhY2tncm91bmRDb2xvcjogJyNmZmYnLAogICAgICAgICAgICAgICAgICAgICAgICB1eFByaW1hcnlCdXR0b25Db2xvcjogJyMyMDZEQzUnLAogICAgICAgICAgICAgICAgICAgICAgICB1eFByaW1hcnlCdXR0b25UZXh0Q29sb3I6ICcjZmZmJywKICAgICAgICAgICAgICAgICAgICAgICAgdXhTZWNvbmRhcnlCdXR0b25Db2xvcjogJyNmZmYnLAogICAgICAgICAgICAgICAgICAgICAgICB1eFNlY29uZGFyeUJ1dHRvblRleHRDb2xvcjogJyMyMDZEQzUnLAogICAgICAgICAgICAgICAgICAgICAgICB1eFRvb2dsZUFjdGl2ZUNvbG9yOiAnIzIwNkRDNScsCiAgICAgICAgICAgICAgICAgICAgICAgIHV4TGlua0NvbG9yOiAnIzIwNkRDNScsCiAgICAgICAgICAgICAgICAgICAgICAgIHV4Rm9udENvbG9yOiAnIzE0MWUyMycKICAgICAgICAgICAgICAgICAgICB9LCBBID0gcGFyc2VJbnQoJycuY29uY2F0KCcyMycpKSwgTCA9IE51bWJlci5pc05hTihBKSA/IDEgOiBBLCBQID0gewogICAgICAgICAgICAgICAgICAgICAgICBWRU5ET1JfQ09OU0VOVDogJ2NtcGNvbnNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICBOT05JQUJWRU5ET1JfQ09OU0VOVDogJ2NtcG5vbmlhYicsCiAgICAgICAgICAgICAgICAgICAgICAgIFJFUFJPTVBUX0hBU0g6ICdjbXByZXByb21wdGhhc2gnCiAgICAgICAgICAgICAgICAgICAgfSwgVCA9IGkoaSh7fSwgUCksIHt9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgIFFVQU5UQ0FTVF9BQ0NPVU5UX0lEOiAnY21wYWNjb3VudGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgUkVGRVJSRVI6ICdyZWYnCiAgICAgICAgICAgICAgICAgICAgfSksIGsgPSBpKGkoe30sIFApLCB7fSwgewogICAgICAgICAgICAgICAgICAgICAgICBESVNQTEFZX1VJOiAnZGlzcGxheWNvbnNlbnR1aScsCiAgICAgICAgICAgICAgICAgICAgICAgIExPR0dFRF9JTjogJ2NtcGxvZ2dlZGluJwogICAgICAgICAgICAgICAgICAgIH0pLCB4ID0gewogICAgICAgICAgICAgICAgICAgICAgICBDTVBMSVNUOiAnQ01QTGlzdCcsCiAgICAgICAgICAgICAgICAgICAgICAgIFZFTkRPUl9DT05TRU5UOiAnZXVjb25zZW50LXYyJywKICAgICAgICAgICAgICAgICAgICAgICAgTk9OSUFCVkVORE9SX0NPTlNFTlQ6ICdub25pYWJ2ZW5kb3Jjb25zZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgUFVCTElTSEVSX0NPTlNFTlQ6ICdldXB1YmNvbnNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICBCTE9DS0VEX0hBU0g6ICdfY21wQmxvY2tlZFZlbmRvcnNIYXNoJywKICAgICAgICAgICAgICAgICAgICAgICAgTk9OX0lBQl9IQVNIOiAnX2NtcE5vbklhYlZlbmRvcnNIYXNoJywKICAgICAgICAgICAgICAgICAgICAgICAgUkVQUk9NUFRfSEFTSDogJ19jbXBSZXByb21wdEhhc2gnLAogICAgICAgICAgICAgICAgICAgICAgICBVU19QUklWQUNZOiAndXNwcml2YWN5JywKICAgICAgICAgICAgICAgICAgICAgICAgR09PR0xFX0NPTlNFTlQ6ICdhZGR0bF9jb25zZW50JwogICAgICAgICAgICAgICAgICAgIH0sIFIgPSBuKDEzNyksIE4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHF1YW50Y2FzdEFjY291bnRJZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRTY29wZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LkdMT0JBTCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LlNFUlZJQ0UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5HTE9CQUxfR1JPVVAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdi5TRVJWSUNFX0dST1VQCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRUb2dnbGVWYWx1ZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvZmYnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlVaTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbmV2ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpbkVVJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWx3YXlzJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5UGVyc2lzdGVudENvbnNlbnRMaW5rOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdyb3VwU2l0ZXNVcmw6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBoYXNoQ29kZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5SZWplY3RCdXR0b25TaG93aW5nOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGlzQU1QOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5Cb2R5VGV4dE9wdGlvbjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ251bWJlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGxhbmdfOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogUgogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBub25jb25zZW50RGlzcGxheUZyZXF1ZW5jeTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ251bWJlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHBlcnNpc3RlbnRDb25zZW50TGlua0xvY2F0aW9uOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbnVtYmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyTG9nbzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlck5hbWU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJGZWF0dXJlc0lkczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlclNwZWNpYWxGZWF0dXJlc0lkczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbkJlRW1wdHk6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlclNwZWNpYWxQdXJwb3Nlc0lkczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJQdXJwb3NlSWRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuQmVFbXB0eTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0SWRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuQmVFbXB0eTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJWZW5kb3JMaXN0VXJsOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyQ291bnRyeUNvZGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FGJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQVgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBTCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0RaJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQVMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FPJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQUknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBUScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FHJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQVInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBTScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FXJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQVUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FaJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQlMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCSCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQkInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCWScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQlonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCSicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JNJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQlQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCTycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JBJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQlcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCVicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JSJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSU8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCTicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0JHJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQkYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCSScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0tIJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ00nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDQScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NWJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnS1knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDRicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1REJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ0wnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDTicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NYJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ0MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDTycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0tNJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ0cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NLJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ1InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDSScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0hSJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ1UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDWScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0NaJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnREsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdESicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0RNJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRE8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdFQycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0VHJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU1YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHUScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0VSJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRUUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdFVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0ZLJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRk8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdGSicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0ZJJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRlInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHRicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1BGJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVEYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHQScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dNJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnR0UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdERScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dIJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnR0knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dMJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnR0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHUCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dVJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnR1QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHRycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0dOJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnR1cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHWScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0hUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSE0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdWQScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0hOJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSEsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdIVScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0lTJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSU4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0lSJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSVEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdJRScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0lNJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSUwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdJVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0pNJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnSlAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdKRScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0pPJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnS1onLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdLRScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0tJJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnS1InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdLVycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0tHJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTEEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdMVicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0xCJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTFMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdMUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0xZJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTEknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdMVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0xVJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTU8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNSycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01HJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTVcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNWScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01WJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTUwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01IJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTVEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01VJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnWVQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNWCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0ZNJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNQycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01OJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTUUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNUycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01BJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTVonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdNTScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ05BJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTlInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdOUCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ05MJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQU4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdOQycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ05aJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTkknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdORScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ05HJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTlUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdORicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01QJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTk8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdPTScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1BLJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUFcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdQUycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1BBJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUEcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdQWScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1BFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUEgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdQTicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1BMJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUFQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdQUicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1FBJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUkUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSTycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1JVJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUlcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdCTCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NIJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnS04nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdMQycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ01GJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUE0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdWQycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1dTJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU00nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NBJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU04nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSUycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NDJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU0wnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTRycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NLJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU0knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTQicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NPJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnWkEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHUycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0VTJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTEsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NSJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU0onLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTWicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ0gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdTWScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1RXJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVEonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUWicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1RIJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVEwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdURycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1RLJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVE8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1ROJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVFInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdUTScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1RDJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVFYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdVRycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1VBJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQUUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHQicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1VTJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVU0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdVWScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1VaJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVlUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdWRScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1ZOJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVkcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdWSScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1dGJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnRUgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdZRScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1pNJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnWlcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvclB1cnBvc2VJZHM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW5CZUVtcHR5OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW5CZUVtcHR5OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvclNwZWNpYWxGZWF0dXJlc0lkczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbkJlRW1wdHk6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvclNwZWNpYWxQdXJwb3Nlc0lkczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbkJlRW1wdHk6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckZlYXR1cmVzSWRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuQmVFbXB0eTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICByZWplY3RDb25zZW50UmVkaXJlY3RVcmw6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzdGFja3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzb2Z0T3B0SW5FbmFibGVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVpTGF5b3V0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwb3B1cCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Jhbm5lcicKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yTGlzdFVwZGF0ZUZyZXE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdudW1iZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50U2NvcGVHcm91cFVSTDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZURvbWFpbjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZVBhdGg6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB0aGlyZFBhcnR5U3RvcmFnZVR5cGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2lmcmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FwaScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc2hvd1N1bW1hcnlWaWV3OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHByaXZhY3lNb2RlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5HRFBSLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuVVNQCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcFZlcnNpb246IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdudW1iZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNwSnVyaXNkaWN0aW9uOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1VTJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ0EnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcExzcGFjdDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLllFUywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLk5PVAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c3BQcml2YWN5UG9saWN5TGluazogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcERlbGV0ZURhdGFMaW5rOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNwQWNjZXNzRGF0YUxpbms6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzdXBwcmVzc0NjcGFMaW5rczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2Jvb2xlYW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBnb29nbGVFbmFibGVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlckNvbnNlbnRSZXN0cmljdGlvbklkczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcnJheVR5cGU6ICdudW1iZXInCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlckxJUmVzdHJpY3Rpb25JZHM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyYXlUeXBlOiAnbnVtYmVyJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50T25TYWZhcmk6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudElkZW50aXR5RW5hYmxlZDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2Jvb2xlYW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgViA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYWNjZXB0QWxsOiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5SZWplY3RCdXR0b246IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNjcmVlblNldHRpbmdzQnV0dG9uOiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRTY3JlZW5UaXRsZTogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICBwZXJzaXN0ZW50Q29uc2VudExpbmtMYWJlbDogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21Jbml0U2NyZWVuQm9keVRleHQ6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2Vjb25kU2NyZWVuQm9keVRleHQ6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tVmVuZG9yU2NyZWVuQm9keVRleHQ6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tTGVnaXRpbWF0ZVNjcmVlbkJvZHlUZXh0OiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5Tm9SZWplY3RTZXJ2aWNlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzdW1tYXJ5U2NyZWVuQm9keU5vUmVqZWN0R2xvYmFsOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzdW1tYXJ5U2NyZWVuQm9keU5vUmVqZWN0R3JvdXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5UmVqZWN0U2VydmljZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc3VtbWFyeVNjcmVlbkJvZHlSZWplY3RHbG9iYWw6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHN1bW1hcnlTY3JlZW5Cb2R5UmVqZWN0R3JvdXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdyb3VwT2ZTaXRlc0xhYmVsOiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVBbmRFeGl0QnV0dG9uOiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFncmVlVG9TZWxlY3RlZEJ1dHRvbjogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICBhZ3JlZUJ1dHRvbjogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICBhZ3JlZUFsbEJ1dHRvbjogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICBvYmplY3RBbGxCdXR0b246IHsgdHlwZTogJ3N0cmluZycgfQogICAgICAgICAgICAgICAgICAgIH0sIFUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvckxpc3RVcmw6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JXaGl0ZWxpc3Q6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyYXlUeXBlOiAnbnVtYmVyJwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JCbGFja2xpc3Q6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdhcnJheScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyYXlUeXBlOiAnbnVtYmVyJwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgaiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNjcmVlbkN1c3RvbUxpbmtzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYXJyYXknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFycmF5VHlwZTogJ29iamVjdCcKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbGlua3NUaXRsZTogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICBub25JYWJWZW5kb3JzTGFiZWw6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNwRG5zVGl0bGU6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNwRG5zVGV4dDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcnJheVR5cGU6ICdzdHJpbmcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcERvTm90U2VsbFRvZ2dsZVRleHQ6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNwUHJpdmFjeVBvbGljeUxpbmtUZXh0OiB7IHR5cGU6ICdzdHJpbmcnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzcERlbGV0ZURhdGFMaW5rVGV4dDogeyB0eXBlOiAnc3RyaW5nJyB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c3BBY2Nlc3NEYXRhTGlua1RleHQ6IHsgdHlwZTogJ3N0cmluZycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNwQWNjZXB0QnV0dG9uOiB7IHR5cGU6ICdzdHJpbmcnIH0KICAgICAgICAgICAgICAgICAgICB9LCBCID0gewogICAgICAgICAgICAgICAgICAgICAgICB1eEJhY2tncm91bmRDb2xvcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHV4UHJpbWFyeUJ1dHRvbkNvbG9yOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXhQcmltYXJ5QnV0dG9uVGV4dENvbG9yOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXhTZWNvbmRhcnlCdXR0b25Db2xvcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHV4U2Vjb25kYXJ5QnV0dG9uVGV4dENvbG9yOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXhUb29nbGVBY3RpdmVDb2xvcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHV4TGlua0NvbG9yOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXhGb250Q29sb3I6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgTSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yTGlzdDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcnJheVR5cGU6ICdvYmplY3QnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUF0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yc0hhc2g6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgRCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0IGluIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZVt0XSwgbyA9IG5bdF0udHlwZSwgaSA9IG5bdF0udmFsdWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnICE9PSByICYmICh0eXBlb2YgciA9PT0gbyA/ICdudW1iZXInID09PSBvICYmIHIgPCAwID8gKGNvbnNvbGUud2FybignJy5jb25jYXQodCwgJyBtdXN0IGJlIGEgdmFsaWQgbnVtYmVyJykpLCAhMSkgOiAnJyA9PT0gaSB8fCAoISFpLmluY2x1ZGVzKHIpIHx8IChjb25zb2xlLndhcm4oJycuY29uY2F0KHQsICcgbXVzdCBiZSBhIHZhbGlkIHZhbHVlJykpLCAhMSkpIDogKGNvbnNvbGUud2FybignJy5jb25jYXQodCwgJyBtdXN0IGJlICcpLmNvbmNhdChvKSksICExKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbnNvbGUud2FybignJy5jb25jYXQodCwgJyBpcyBub3QgYSB2YWxpZCBjb25maWcgdmFsdWUnKSksICExOwogICAgICAgICAgICAgICAgICAgIH0sIEYgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KHIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gblt0XS5jYW5CZUVtcHR5ICYmIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2Ygblt0XS52YWx1ZXMgPyB0eXBlb2YgZSA9PT0gblt0XS5hcnJheVR5cGUgPyBvLnB1c2goZSkgOiBjb25zb2xlLndhcm4oJycuY29uY2F0KGUsICcgJykuY29uY2F0KCdpcyBub3QgYSB2YWxpZCB2YWx1ZSBmb3InLCAnICcpLmNvbmNhdCh0KSkgOiBuW3RdLnZhbHVlcy5pbmNsdWRlcyhlKSA/IG8ucHVzaChlKSA6IGNvbnNvbGUud2FybignJy5jb25jYXQoZSwgJyAnKS5jb25jYXQoJ2lzIG5vdCBhIHZhbGlkIHZhbHVlIGZvcicsICcgJykuY29uY2F0KHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAhIW8ubGVuZ3RoICYmIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbnNvbGUud2FybignJy5jb25jYXQodCwgJyBtdXN0IGJlIGFuIGFycmF5JykpLCAhMTsKICAgICAgICAgICAgICAgICAgICB9LCBHID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYodGhpcywgZSksIHRoaXMuX2NvcmVDb25maWcgPSB2b2lkIDAsIHRoaXMuX3ByZW1pdW1Qcm9wZXJ0aWVzID0gdm9pZCAwLCB0aGlzLl9jb3JlVWlMYWJlbHMgPSB2b2lkIDAsIHRoaXMuX3ByZW1pdW1VaUxhYmVscyA9IHZvaWQgMCwgdGhpcy5fdGhlbWUgPSB2b2lkIDAsIHRoaXMuX25vbklhYlZlbmRvcnNJbmZvID0gdm9pZCAwLCB0aGlzLmNsZWFuQ29uZmlnID0gdm9pZCAwLCB0aGlzLmNoZWNrUmVxdWlyZWRWYWx1ZXMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuLmNsZWFuQ29uZmlnLmNvcmVDb25maWc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbnNlbnRTY29wZScgaW4gZSB8fCAobi5jbGVhbkNvbmZpZy5jb3JlQ29uZmlnLmNvbnNlbnRTY29wZSA9IHYuU0VSVklDRSksICdwcml2YWN5TW9kZScgaW4gZSB8fCAobi5jbGVhbkNvbmZpZy5jb3JlQ29uZmlnLnByaXZhY3lNb2RlID0gW3kuR0RQUl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy52YWxpZGF0ZUNvbmZpZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fSwgciA9IHt9LCBvID0ge30sIGkgPSB7fSwgcyA9IHt9LCBhID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNvcmVDb25maWcgJiYgKHQgPSBuLmZpbHRlckNvbmZpZyhlLmNvcmVDb25maWcsIE4pKSwgZS5jb3JlVWlMYWJlbHMgJiYgKHIgPSBuLmZpbHRlckxhYmVscyhlLmNvcmVVaUxhYmVscywgVikpLCBlLnByZW1pdW1Qcm9wZXJ0aWVzICYmIChvID0gbi5maWx0ZXJDb25maWcoZS5wcmVtaXVtUHJvcGVydGllcywgVSkpLCBlLnByZW1pdW1VaUxhYmVscyAmJiAoaSA9IG4uZmlsdGVyTGFiZWxzKGUucHJlbWl1bVVpTGFiZWxzLCBqKSksIGUudGhlbWUgJiYgKHMgPSBuLmZpbHRlckNvbmZpZyhlLnRoZW1lLCBCKSksIGUubm9uSWFiVmVuZG9yc0luZm8gJiYgKGEgPSBuLmZpbHRlckNvbmZpZyhlLm5vbklhYlZlbmRvcnNJbmZvLCBNKSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZUNvbmZpZzogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZVVpTGFiZWxzOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVtaXVtUHJvcGVydGllczogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlbWl1bVVpTGFiZWxzOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGVtZTogcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yc0luZm86IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5maWx0ZXJDb25maWcgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdhcnJheScgPT09IHRbcl0udHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gRihlLCByLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvICYmIChuW3JdID0gbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEKGUsIHIsIHQpICYmIChuW3JdID0gZVtyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLmZpbHRlckxhYmVscyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT09IHRbcl0udHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJyAhPT0gZVtyXSA/IG5bcl0gPSBlW3JdIDogY29uc29sZS53YXJuKCcnLmNvbmNhdChyLCAnIGNhbm5vdCBiZSBlbXB0eScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gRihlLCByLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvICYmIChuW3JdID0gbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLmdldEN1c3RvbUNvcmVVaUxhYmVscyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jbGVhbkNvbmZpZy5jb3JlVWlMYWJlbHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLmluaXRpYWxpemVDb25maWcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMobi5jbGVhbkNvbmZpZykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW2VdICYmIChuW2VdID0gaShpKHt9LCBuW2VdKSwgbi5jbGVhbkNvbmZpZ1tlXSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5jbGVhbkNvbmZpZyA9IHRoaXMudmFsaWRhdGVDb25maWcodCksIHRoaXMuY2hlY2tSZXF1aXJlZFZhbHVlcygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzLmNsZWFuQ29uZmlnLCBvID0gci5jb3JlQ29uZmlnLCBzID0gby5wcml2YWN5TW9kZSwgYSA9IG8uY29uc2VudFNjb3BlLCB1ID0gby5xdWFudGNhc3RBY2NvdW50SWQsIGMgPSByLm5vbklhYlZlbmRvcnNJbmZvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5pbmNsdWRlcyh5LkdEUFIpICYmIHMuaW5jbHVkZXMoeS5VU1ApID8gKHRoaXMuX2NvcmVDb25maWcgPSBpKGkoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1YW50Y2FzdEFjY291bnRJZDogdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50U2NvcGU6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpdmFjeU1vZGU6IHMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEMpLCBFKSwgdGhpcy5fcHJlbWl1bVVpTGFiZWxzID0gaShpKHt9LCBTKSwgXyksIHRoaXMuX3ByZW1pdW1Qcm9wZXJ0aWVzID0gaSh7fSwgSSksIHRoaXMuX2NvcmVVaUxhYmVscyA9IGkoe30sIHcpLCB0aGlzLl90aGVtZSA9IGkoe30sIE8pLCBjICYmICh0aGlzLl9ub25JYWJWZW5kb3JzSW5mbyA9IGMpKSA6IHMuaW5jbHVkZXMoJ0dEUFInKSA/ICh0aGlzLl9jb3JlQ29uZmlnID0gaSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVhbnRjYXN0QWNjb3VudElkOiB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRTY29wZTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcml2YWN5TW9kZTogcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgQyksIHRoaXMuX3ByZW1pdW1VaUxhYmVscyA9IGkoe30sIF8pLCB0aGlzLl9wcmVtaXVtUHJvcGVydGllcyA9IGkoe30sIEkpLCB0aGlzLl9jb3JlVWlMYWJlbHMgPSBpKHt9LCB3KSwgdGhpcy5fdGhlbWUgPSBpKHt9LCBPKSwgYyAmJiAodGhpcy5fbm9uSWFiVmVuZG9yc0luZm8gPSBjKSkgOiAodGhpcy5fY29yZUNvbmZpZyA9IGkoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1YW50Y2FzdEFjY291bnRJZDogdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50U2NvcGU6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpdmFjeU1vZGU6IHMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEUpLCB0aGlzLl9wcmVtaXVtVWlMYWJlbHMgPSBpKHt9LCBTKSwgdGhpcy5fcHJlbWl1bVByb3BlcnRpZXMgPSB7fSwgdGhpcy5fY29yZVVpTGFiZWxzID0ge30sIHRoaXMuX3RoZW1lID0gaSh7fSwgTykpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXRDdXN0b21QcmVtaXVtVWlMYWJlbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsZWFuQ29uZmlnLnByZW1pdW1VaUxhYmVsczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2NvcmVDb25maWcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fY29yZUNvbmZpZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLCBuID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdWJsaXNoZXJMb2dvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyTmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3B1Ymxpc2hlckZlYXR1cmVzSWRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyU3BlY2lhbEZlYXR1cmVzSWRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyU3BlY2lhbFB1cnBvc2VzSWRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyUHVycG9zZUlkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3B1Ymxpc2hlclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdWJsaXNoZXJWZW5kb3JMaXN0VXJsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyVmVuZG9yTGlzdFVybCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3B1Ymxpc2hlckNvdW50cnlDb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndmVuZG9yUHVycG9zZUlkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlbmRvclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZW5kb3JTcGVjaWFsRmVhdHVyZXNJZHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZW5kb3JTcGVjaWFsUHVycG9zZXNJZHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZW5kb3JGZWF0dXJlc0lkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3JlamVjdENvbnNlbnRSZWRpcmVjdFVybCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0YWNrcycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHIgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25vbmNvbnNlbnREaXNwbGF5RnJlcXVlbmN5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndmVuZG9yTGlzdFVwZGF0ZUZyZXEnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVtvXSAhPT0gdC5jb3JlQ29uZmlnW29dKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC0xICE9PSBuLmluZGV4T2YobykgJiYgKCcnID09PSBlW29dIHx8IGVbb10gPT09IFtdKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCcnLmNvbmNhdChvLCAnIGNhbm5vdCBiZSBlbXB0eScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5pbmRleE9mKG8pICYmIGVbb10gPCAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJycuY29uY2F0KG8sICcgY2Fubm90IGJlIGEgbmVnYXRpdmUgbnVtYmVyJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5fY29yZUNvbmZpZyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdwcmVtaXVtUHJvcGVydGllcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9wcmVtaXVtUHJvcGVydGllczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5wcmVtaXVtUHJvcGVydGllc1tuXSAhPT0gZVtuXSAmJiAoJycgPT09IGVbbl0gfHwgZVtuXSA9PT0gW10pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignJy5jb25jYXQobiwgJyBjYW5ub3QgYmUgZW1wdHknKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzLl9wcmVtaXVtUHJvcGVydGllcyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdjb3JlVWlMYWJlbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fY29yZVVpTGFiZWxzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKGUpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmNvcmVVaUxhYmVsc1tuXSAhPT0gZVtuXSAmJiAnJyA9PT0gZVtuXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJycuY29uY2F0KG4sICcgY2Fubm90IGJlIGVtcHR5JykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5fY29yZVVpTGFiZWxzID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3RoZW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3RoZW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKGUpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LnRoZW1lW25dICE9PSBlW25dICYmICcnID09PSBlW25dKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignJy5jb25jYXQobiwgJyBjYW5ub3QgYmUgZW1wdHknKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzLl90aGVtZSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdub25JYWJWZW5kb3JzSW5mbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9ub25JYWJWZW5kb3JzSW5mbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fbm9uSWFiVmVuZG9yc0luZm8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAncHJlbWl1bVVpTGFiZWxzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3ByZW1pdW1VaUxhYmVsczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5wcmVtaXVtVWlMYWJlbHNbbl0gIT09IGVbbl0gJiYgIWVbbl0ubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignJy5jb25jYXQobiwgJyBjYW5ub3QgYmUgZW1wdHknKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0aGlzLl9wcmVtaXVtVWlMYWJlbHMgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gSChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgKG51bGwgPT0gdCB8fCB0ID4gZS5sZW5ndGgpICYmICh0ID0gZS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0gbmV3IEFycmF5KHQpOyBuIDwgdDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICByW25dID0gZVtuXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSChlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoZSkuc2xpY2UoOCwgLTEpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ09iamVjdCcgPT09IG4gJiYgZS5jb25zdHJ1Y3RvciAmJiAobiA9IGUuY29uc3RydWN0b3IubmFtZSksICdNYXAnID09PSBuIHx8ICdTZXQnID09PSBuID8gQXJyYXkuZnJvbShuKSA6ICdBcmd1bWVudHMnID09PSBuIHx8IC9eKD86VWl8SSludCg/Ojh8MTZ8MzIpKD86Q2xhbXBlZCk/QXJyYXkkLy50ZXN0KG4pID8gSChlLCB0KSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBZKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyAhPT0gdHlwZW9mIFN5bWJvbCAmJiBTeW1ib2wuaXRlcmF0b3IgaW4gT2JqZWN0KGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFtdLCByID0gITAsIG8gPSAhMSwgaSA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgcywgYSA9IGVbU3ltYm9sLml0ZXJhdG9yXSgpOyAhKHIgPSAocyA9IGEubmV4dCgpKS5kb25lKSAmJiAobi5wdXNoKHMudmFsdWUpLCAhdCB8fCBuLmxlbmd0aCAhPT0gdCk7IHIgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICEwLCBpID0gdTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciB8fCBudWxsID09IGEucmV0dXJuIHx8IGEucmV0dXJuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfShlLCB0KSB8fCBxKGUsIHQpIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSW52YWxpZCBhdHRlbXB0IHRvIGRlc3RydWN0dXJlIG5vbi1pdGVyYWJsZSBpbnN0YW5jZS5cbkluIG9yZGVyIHRvIGJlIGl0ZXJhYmxlLCBub24tYXJyYXkgb2JqZWN0cyBtdXN0IGhhdmUgYSBbU3ltYm9sLml0ZXJhdG9yXSgpIG1ldGhvZC4nKTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgeiA9IG4oMTkpLCBXID0gbigxMzcpLCBKID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZih0aGlzLCBlKSwgdGhpcy5fX3RjZmFwaXVpID0gdm9pZCAwLCB0aGlzLl9fdGNmYXBpdWkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSB0Ll9fdGNmYXBpdWkuYSA9IHQuX190Y2ZhcGl1aS5hIHx8IFtdLCByID0gd2luZG93LmRvY3VtZW50LCBvID0gYXJndW1lbnRzLmxlbmd0aCwgaSA9IG5ldyBBcnJheShvID4gMSA/IG8gLSAxIDogMCksIHMgPSAxOyBzIDwgbzsgcysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpW3MgLSAxXSA9IGFyZ3VtZW50c1tzXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5wdXNoKFtlXS5jb25jYXQoaSkpLCAhci5nZXRFbGVtZW50QnlJZCgnX190Y2ZhcGl1aXNjcmlwdCcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0JyksIHUgPSAoSWUuY29yZUNvbmZpZy5sYW5nXyB8fCAnZW4nKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXLmluY2x1ZGVzKHUpIHx8ICh1ID0gJ2VuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gJ2h0dHBzOi8vcXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvMjMvY21wMnVpLmpzJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMucmVwbGFjZSgnLmpzJywgJy0nLmNvbmNhdCh1LCAnLmpzJykpLCBhLnR5cGUgPSAndGV4dC9qYXZhc2NyaXB0JywgYS5pZCA9ICdfX3RjZmFwaXVpc2NyaXB0JywgYS5zcmMgPSBjLCByLmhlYWQuYXBwZW5kQ2hpbGQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgd2luZG93Ll9fdGNmYXBpdWkgfHwgKHdpbmRvdy5fX3RjZmFwaXVpID0gdGhpcy5fX3RjZmFwaXVpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcChlLCBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2Rpc3BsYXlVaScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8sIGksIHMsIHUsIGMsIGYgPSBhcmd1bWVudHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociA9IGYubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGZbMV0gPyBmWzFdIDogMSwgbyA9IGYubGVuZ3RoID4gMiAmJiB2b2lkIDAgIT09IGZbMl0gJiYgZlsyXSwgaSA9IG51bGwgPT09IChuID0gSWUuY29yZUNvbmZpZy5wcml2YWN5TW9kZSkgfHwgdm9pZCAwID09PSBuID8gdm9pZCAwIDogbi5pbmNsdWRlcyh0KSwgd2UudXBkYXRlQXBpVmlzaWJsZSh0LCBpKSwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY29uc29sZS53YXJuKCdhdHRlbXB0IHRvIHNob3cgZGlzYWJsZWQgQ01QIFVJIHJlZ3VsYXRpb249Jy5jb25jYXQodCkpLCBlLmFicnVwdCgncmV0dXJuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKHMgPSAnR0RQUicgPT09IHQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gMTEsIHdlLmxvYWRHVkwoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUudDAgPSBlLnNlbnQsIGUubmV4dCA9IDE1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnQwID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUgPSBlLnQwLCBlLnQxID0gdCwgZS50MiA9IHIsIGUudDMgPSBvLCBlLnQ0ID0gSWUsIGUudDUgPSB1LCAhcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDI3OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDI0LCB3ZS5nZXRDb25zZW50cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS50NiA9IGUuc2VudCwgZS5uZXh0ID0gMjg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUudDYgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUudDcgPSBlLnQ2LCBlLnQ4ID0gcyA/IFBlLmRhdGEuZGF0YS5ub25JYWJWZW5kb3JMaXN0IDoge30sIGUudDkgPSBzID8gVWUuZGF0YSA6IHt9LCBjID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ3VsYXRpb246IGUudDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogZS50MiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc01hbmRhdG9yeTogZS50MywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWc6IGUudDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3ZsOiBlLnQ1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRJbmZvOiBlLnQ3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvckxpc3Q6IGUudDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ29vZ2xlRGF0YTogZS50OQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgd2luZG93Ll9fdGNmYXBpdWkoJ2Rpc3BsYXlVaScsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDMzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCBLID0gbigxNDcpLCBRID0gbi5uKEspLmEuY3JlYXRlKHsgeHNyZkNvb2tpZU5hbWU6IG51bGwgfSksIFogPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgTk9ERV9FTlY6ICdwcm9kdWN0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBVQkxJQ19VUkw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0xPR19BUEk6ICdodHRwczovL2F1ZGl0LXRjZnYyLnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9HRU9JUF9BUElfVVJMOiAnaHR0cHM6Ly9hcGlzLnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL2dlb2lwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9DTVBfQ09PS0lFX0FQSTogJ2h0dHBzOi8vYXBpcy5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9Db29raWVBY2Nlc3NWMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfR09PR0xFX0FUUF9VUkw6ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL3RjZnYyL2dvb2dsZS1hdHAtbGlzdC5qc29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9DT05TRU5URURfSURFTlRJVFlfV0VCU0lURV9BUEk6ICdodHRwczovL2FwcC5wZXJtaXNpby5jb20vYXBpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9WRVJTSU9OOiAnMjMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0NNUFVJX1NSQzogJ2h0dHBzOi8vcXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvMjMvY21wMnVpLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9HVkxfQkFTRV9VUkw6ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL0dWTC12Mi8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX1RSQU5TTEFUSU9OX0JBU0VfVVJMOiAnaHR0cHM6Ly93d3cucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvdHJhbnNsYXRpb25zLycKICAgICAgICAgICAgICAgICAgICAgICAgfSkuUkVBQ1RfQVBQX0RFQlVHICYmIGNvbnNvbGUubG9nKCdEZWJ1ZzogJyArIGUpOwogICAgICAgICAgICAgICAgICAgIH0sIFggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChmKHRoaXMsIGUpLCB0aGlzLl9pc1VzZXJJbkVVID0gdm9pZCAwLCB0aGlzLl9pc1VzZXJJblVTID0gdm9pZCAwLCB0aGlzLl91c2VyU3BlY2lmaWNMb2NhdGlvbiA9IHZvaWQgMCwgdGhpcy5fdXNlclNwZWNpZmljTG9jYXRpb24gPSBudWxsLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdpblVTJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9pc1VzZXJJbkVVID0gZmFsc2UsIHRoaXMuX2lzVXNlckluVVMgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaW5FVSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5faXNVc2VySW5FVSA9IGZhbHNlLCB0aGlzLl9pc1VzZXJJblVTID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5faXNVc2VySW5FVSA9IGZhbHNlLCB0aGlzLl9pc1VzZXJJblVTID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcChlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnY2hlY2tTcGVjaWZpY0xvY2F0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMoYS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPSBJZS5jb3JlQ29uZmlnLnByaXZhY3lNb2RlLCB0aGlzLl91c2VyU3BlY2lmaWNMb2NhdGlvbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDIzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFooJ2luaXRVc3BMb2NhdGlvbjogZXhhY3QgbG9jYXRpb24gcmVxdWVzdCcpLCAhdC5pbmNsdWRlcygnVVNQJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAyMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID0gSWUuY29yZUNvbmZpZy51c3BKdXJpc2RpY3Rpb24sICF0aGlzLmlzVXNlckluVVMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAyMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmluY2x1ZGVzKCdVUycpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcmV2ID0gNywgZS5uZXh0ID0gMTAsIFEuZ2V0KCdodHRwczovL2FwaXMucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvZ2VvaXAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBlLnNlbnQsIHRoaXMuX3VzZXJTcGVjaWZpY0xvY2F0aW9uID0gci5kYXRhLCBlLm5leHQgPSAxNzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmV2ID0gMTQsIGUudDAgPSBlLmNhdGNoKDcpLCBjb25zb2xlLmxvZyhlLnQwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDIwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl91c2VyU3BlY2lmaWNMb2NhdGlvbiA9ICdVUyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAyMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDIyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fdXNlclNwZWNpZmljTG9jYXRpb24gPSAnbm9uLVVTJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJywgdGhpcy5fdXNlclNwZWNpZmljTG9jYXRpb24pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCB0aGlzLCBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnaXNVc2VySW5FVScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBaKCd0aGlzIHNob3VsZCBvbmx5IGJlIHVzZWQgZm9yIHRlc3RpbmcnKSwgdGhpcy5faXNVc2VySW5FVSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2lzVXNlckluRVU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdpc1VzZXJJblVTJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFooJ3RoaXMgc2hvdWxkIG9ubHkgYmUgdXNlZCBmb3IgdGVzdGluZycpLCB0aGlzLl9pc1VzZXJJblVTID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5faXNVc2VySW5VUzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3VzZXJTcGVjaWZpY0xvY2F0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFooJ3RoaXMgc2hvdWxkIG9ubHkgYmUgdXNlZCBmb3IgdGVzdGluZycpLCB0aGlzLl91c2VyU3BlY2lmaWNMb2NhdGlvbiA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3VzZXJTcGVjaWZpY0xvY2F0aW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCAkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmKHRoaXMsIGUpLCB0aGlzLl9zZWFyY2hQYXJhbXMgPSB2b2lkIDAsIHRoaXMuX2NvbnNlbnRWYWx1ZXMgPSB2b2lkIDAsIHRoaXMuX3NlYXJjaFBhcmFtcyA9IHt9LCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBPYmplY3Qua2V5cyhrKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBrW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbyA9IG5ldyBSZWdFeHAoJyg/Ol58Wz8mXSkoJy5jb25jYXQoci5qb2luKCd8JyksICcpKD86PShbXiZdKikpPycpLCAnZycpLCBpID0gbmV3IFVSTCh3aW5kb3cubG9jYXRpb24uaHJlZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5zZWFyY2ggPSB3aW5kb3cubG9jYXRpb24uc2VhcmNoLnJlcGxhY2UobywgZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uX3NlYXJjaFBhcmFtc1t0XSA9IHIgfHwgbnVsbCwgJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVwbGFjZSgvXiYvLCAnPycpLnJlcGxhY2UoL15cPyQvLCAnJyksIHdpbmRvdy5oaXN0b3J5LnJlcGxhY2VTdGF0ZSh7fSwgJycsIGkudG9TdHJpbmcoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3Nob3VsZFJlZGlyZWN0Rm9yQ29uc2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gSWUuY29yZUNvbmZpZy5xdWFudGNhc3RBY2NvdW50SWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LmtleXMoUCkuc29tZShmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5oYXNQYXJhbShQW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KCExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gJycuY29uY2F0KFQuUVVBTlRDQVNUX0FDQ09VTlRfSUQsICc9JykuY29uY2F0KG4pICsgJyYnLmNvbmNhdChULlJFRkVSUkVSLCAnPScpLmNvbmNhdChlbmNvZGVVUklDb21wb25lbnQod2luZG93LmxvY2F0aW9uLmhyZWYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmNoZWNrUmVkaXJlY3RBUEkoKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCghMCksIHdpbmRvdy5sb2NhdGlvbi5hc3NpZ24oJycuY29uY2F0KCdodHRwczovL2FwcC5wZXJtaXNpby5jb20vYXBpJywgJy9jaGVjaz8nKS5jb25jYXQocikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCghMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnY2hlY2tSZWRpcmVjdEFQSScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hYnJ1cHQoJ3JldHVybicsIG5ldyBQcm9taXNlKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMoYS5hLm1hcmsoZnVuY3Rpb24gZSh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByID0gJycuY29uY2F0KCdodHRwczovL2FwcC5wZXJtaXNpby5jb20vYXBpJy5yZXBsYWNlKCcvYXBpJywgJy9hbGl2ZScpKSwgZS5wcmV2ID0gMSwgZS5uZXh0ID0gNCwgUS5nZXQociwgeyB0aW1lb3V0OiAxMDAwIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29rJyA9PT0gZS5zZW50LmRhdGEgPyB0KCdhbGl2ZScpIDogbignYmFkIHJlc3BvbnNlJyksIGUubmV4dCA9IDExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHJldiA9IDgsIGUudDAgPSBlLmNhdGNoKDEpLCBuKCdlcnJvcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgbnVsbCwgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzYXZlQ29uc2VudEZyb21SZWRpcmVjdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLmdldENvbnNlbnRGcm9tUGFyYW1zKCksIHQgPSBlW3guVkVORE9SX0NPTlNFTlRdLCBuID0gZVt4LlJFUFJPTVBUX0hBU0hdLCByID0gZVt4Lk5PTklBQlZFTkRPUl9DT05TRU5UXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiBuICYmIHdlLnNldERhdGEodCwgciwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzYXZlQ29uc2VudFRvUGVybWlzaW8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IEllLmNvcmVDb25maWcucXVhbnRjYXN0QWNjb3VudElkLCBvID0gZW5jb2RlVVJJQ29tcG9uZW50KHdpbmRvdy5sb2NhdGlvbi5ocmVmKSwgaSA9ICcnLmNvbmNhdChULlFVQU5UQ0FTVF9BQ0NPVU5UX0lELCAnPScpLmNvbmNhdChyKSArICcmJy5jb25jYXQoVC5SRUZFUlJFUiwgJz0nKS5jb25jYXQobykgKyAnJicuY29uY2F0KFQuVkVORE9SX0NPTlNFTlQsICc9JykuY29uY2F0KGUgfHwgJycpICsgJyYnLmNvbmNhdChULk5PTklBQlZFTkRPUl9DT05TRU5ULCAnPScpLmNvbmNhdCh0IHx8ICcnKSArICcmJy5jb25jYXQoVC5SRVBST01QVF9IQVNILCAnPScpLmNvbmNhdChuIHx8ICcnKSwgcyA9ICcnLmNvbmNhdCgnaHR0cHM6Ly9hcHAucGVybWlzaW8uY29tL2FwaScsICcvc2F2ZT8nKS5jb25jYXQoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmlzTG9nZ2VkSW5Ub1Blcm1pc2lvKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNoZWNrUmVkaXJlY3RBUEkoKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cubG9jYXRpb24uYXNzaWduKHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gd2luZG93Lm9wZW4ocywgJ0xvZ0luVG9QZXJtaXNpb1dpbmRvdycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiBhLmZvY3VzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2hhc1BhcmFtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3NlYXJjaFBhcmFtcy5oYXNPd25Qcm9wZXJ0eShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2hhc0VkaXRDb25zZW50UGFyYW0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmhhc1BhcmFtKGsuRElTUExBWV9VSSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdpc0xvZ2dlZEluVG9QZXJtaXNpbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaGFzUGFyYW0oay5MT0dHRURfSU4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Q29uc2VudEZyb21QYXJhbXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLl9jb25zZW50VmFsdWVzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMuX3NlYXJjaFBhcmFtc1tQLlZFTkRPUl9DT05TRU5UXSAmJiB0aGlzLl9zZWFyY2hQYXJhbXNbUC5SRVBST01QVF9IQVNIXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2NvbnNlbnRWYWx1ZXMgPSBPYmplY3Qua2V5cyhQKS5yZWR1Y2UoZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IFBbcl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5beFtyXV0gPSB0ICYmIGUuX3NlYXJjaFBhcmFtc1tvXSB8fCBudWxsLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9jb25zZW50VmFsdWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCBlZSA9IG4oMTQ4KSwgdGUgPSBuLm4oZWUpLCBuZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYodGhpcywgZSksIHRoaXMuX3ZhbHVlcyA9IHZvaWQgMCwgdGhpcy5fdmFsdWVzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV1Y29uc2VudDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yQ29uc2VudDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yc0hhc2g6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZldGNoZWQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb21pc2U6IFByb21pc2UucmVzb2x2ZSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAndmFsdWVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3ZhbHVlcyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3ZhbHVlczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcmUoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHZhciBvID0gbiAmJiBkb2N1bWVudC5nZXRFbGVtZW50QnlJZChuKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyB8fCAobyA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoZSksIHQgJiYgKG8uY2xhc3NOYW1lID0gdCksIG4gJiYgKG8uaWQgPSBuKSwgciAmJiByLmluc2VydEJlZm9yZShvLCByLmZpcnN0Q2hpbGQpKSwgbzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBvZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jb3JlQ29uZmlnLCBuID0gdC5wdWJsaXNoZXJGZWF0dXJlc0lkcywgciA9IHQucHVibGlzaGVyU3BlY2lhbEZlYXR1cmVzSWRzLCBvID0gdC5wdWJsaXNoZXJTcGVjaWFsUHVycG9zZXNJZHMsIGkgPSB0LnB1Ymxpc2hlclB1cnBvc2VJZHMsIHMgPSB0LnB1Ymxpc2hlclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMsIGEgPSB0LnZlbmRvclB1cnBvc2VJZHMsIHUgPSB0LnZlbmRvclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMsIGMgPSB0LnZlbmRvclNwZWNpYWxGZWF0dXJlc0lkcywgZiA9IHQudmVuZG9yU3BlY2lhbFB1cnBvc2VzSWRzLCBsID0gdC52ZW5kb3JGZWF0dXJlc0lkcywgcCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBkID0gKGEgfHwgW10pLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAodCA9IGUpICYmIHQuc29ydChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIC0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVycG9zZUlkczogKGQgPyBhIDogaSkgfHwgW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0SWRzOiAoZCA/IHUgOiBzKSB8fCBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxGZWF0dXJlc0lkczogKGQgPyBjIDogcikgfHwgW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsUHVycG9zZXNJZHM6IChkID8gZiA6IG8pIHx8IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZmVhdHVyZXNJZHM6IChkID8gbCA6IG4pIHx8IFtdCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgaWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IGUubWF0Y2goL1xkKy9nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uc2hpZnQoKSwgbnVsbCA9PT0gbiB8fCB2b2lkIDAgPT09IG4gPyB2b2lkIDAgOiBuLnJlZHVjZShmdW5jdGlvbiAoZSwgbiwgciwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSBwYXJzZUludChuLCAxMCksIGUuY29uY2F0KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBvW3JdID8gcGFyc2VJbnQobiwgMTApICsgdCA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9IGksIGkgPyBlLmNvbmNhdCgnLicuY29uY2F0KGkpKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sICcnLmNvbmNhdChlWzBdLCAnficpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gc2UoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmICdzdHJpbmcnID09PSB0eXBlb2YgdCA/IGUodCkgOiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGFlLCB1ZSwgY2UsIGZlLCBsZSwgcGUsIGRlLCBoZSwgdmUsIHllID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZih0aGlzLCBlKSwgdGhpcy5kYXRhID0gdm9pZCAwLCB0aGlzLl9yZXByb21wdE9wdGlvbnNIYXNoID0gdm9pZCAwLCB0aGlzLl9zdG9yZWRIYXNoID0gdm9pZCAwLCB0aGlzLmRhdGEgPSBuZXcgbmUoKSwgdGhpcy5fcmVwcm9tcHRPcHRpb25zSGFzaCA9ICcnLCB0aGlzLl9zdG9yZWRIYXNoID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3Nob3VsZFJlcHJvbXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMuZ2VuZXJhdGVSZXByb21wdE9wdGlvbnNIYXNoKCksIHQgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3N0b3JlZEhhc2ggIT09IGUgJiYgKHQgPSAhMCksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZW5lcmF0ZVJlcHJvbXB0T3B0aW9uc0hhc2gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5kYXRhLnZhbHVlcywgdCA9IGUuZXVjb25zZW50LCBuID0gZS5ub25JYWJWZW5kb3JDb25zZW50LCByID0gZS5ub25JYWJWZW5kb3JzSGFzaCwgbyA9IEllLmNvcmVDb25maWcsIGkgPSBvLnN0YWNrcywgcyA9IG8uaW5pdFNjcmVlbkJvZHlUZXh0T3B0aW9uLCBhID0gSWUucHJlbWl1bVByb3BlcnRpZXMsIHUgPSBhLnZlbmRvcldoaXRlbGlzdCwgYyA9IGEudmVuZG9yQmxhY2tsaXN0LCBmID0gb2UoSWUpLCBsID0gZi5wdXJwb3NlSWRzLCBwID0gZi5wdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0SWRzLCBkID0gZi5zcGVjaWFsRmVhdHVyZXNJZHMsIGggPSBmLnNwZWNpYWxQdXJwb3Nlc0lkcywgdiA9IGYuZmVhdHVyZXNJZHMsIHkgPSB0aGlzLmNyZWF0ZU5ld0hhc2goWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIGcgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyA9ICcnLmNvbmNhdChnLCAnLicpLmNvbmNhdChzLCAnLicpLmNvbmNhdCh5KSwgZyA9IG4gPyAnJy5jb25jYXQoZywgJy4nKS5jb25jYXQobikgOiBnLCBnID0gciA/ICcnLmNvbmNhdChnLCAnLicpLmNvbmNhdChyKSA6IGcsIHRoaXMuX3JlcHJvbXB0T3B0aW9uc0hhc2ggPSBnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnY3JlYXRlTmV3SGFzaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ZSgpKGUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsZ29yaXRobTogJ21kNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmNvZGluZzogJ2Jhc2U2NCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXRWYWx1ZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRhdGEudmFsdWVzID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldFZhbHVlcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZGF0YS52YWx1ZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzdG9yZWRIYXNoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3N0b3JlZEhhc2ggPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCBnZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYodGhpcywgZSksIHRoaXMuTE9XRVJDQVNFX1NUQVJUID0gOTcsIHRoaXMuUEFEX1pFUk9TID0gJzAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwJywgdGhpcy5DT09LSUVfTUFYX0FHRSA9IDMzNjk2MDAwLCB0aGlzLmJpdFNpemVzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcElkOiAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVkOiAzNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50U2NyZWVuOiA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRMYW5ndWFnZTogMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wVmVyc2lvbjogMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wVmVyc2lvbk9sZDogNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50VmFsdWU6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdENvbnNlbnQ6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kVmVuZG9ySWQ6IDE2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuY29kaW5nVHlwZTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc1JhbmdlOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RVcGRhdGVkOiAzNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhWZW5kb3JJZDogMTYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtYmVyQ3VzdG9tUHVycG9zZXM6IDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtRW50cmllczogMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyUHVycG9zZXNWZXJzaW9uOiAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXJwb3Nlc0Fsb3dlZDogMjQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhbmRhcmRQdXJwb3Nlc0FsbG93ZWQ6IDI0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VmVuZG9ySWQ6IDE2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yTGlzdFZlcnNpb246IDEyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLl9iaW5hcnlTdHIgPSB2b2lkIDAsIHRoaXMuX2JpdFBvc2l0aW9uID0gdm9pZCAwLCB0aGlzLlRDU3RyaW5nID0gdm9pZCAwLCB0aGlzLl9iaW5hcnlTdHIgPSAnJywgdGhpcy5fYml0UG9zaXRpb24gPSAwLCB0aGlzLlRDU3RyaW5nID0gbmV3IHouVENTdHJpbmcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcChlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZW5jb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5jb29raWVOYW1lKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgeC5OT05JQUJWRU5ET1JfQ09OU0VOVDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBaZShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Nvb2tpZU5hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjcmVhdGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGFzdFVwZGF0ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjbXBJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NtcFZlcnNpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtYXhWZW5kb3JJZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlbmRvckNvbnNlbnRzJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgZSksIHIgPSAnbm9uSWFiVmVuZG9yVG9CaW5hcnknOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgeC5QVUJMSVNIRVJfQ09OU0VOVDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBaZShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Nvb2tpZU5hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdWJsaXNoZXJQdXJwb3Nlc1ZlcnNpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdGFuZGFyZFB1cnBvc2VzQWxsb3dlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ251bWJlckN1c3RvbVB1cnBvc2VzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndmVyc2lvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NyZWF0ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsYXN0VXBkYXRlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NtcElkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY21wVmVyc2lvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbnNlbnRTY3JlZW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb25zZW50TGFuZ3VhZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZW5kb3JMaXN0VmVyc2lvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2N1c3RvbVB1cnBvc2VDb25zZW50cycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIGUpLCByID0gJ3B1Ymxpc2hlckNvbnNlbnRUb0JpbmFyeSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB4LlZFTkRPUl9DT05TRU5UOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IFplKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29va2llTmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlbmRvckNvbnNlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVycG9zZUNvbnNlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3BlY2lhbEZlYXR1cmVPcHRpbnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3B1Ymxpc2hlckNvbnNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwdWJsaXNoZXJMZWdpdGltYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHVibGlzaGVyUHVycG9zZUlkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3B1Ymxpc2hlclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBlKSwgciA9ICdlbmNvZGVFdUNvbnNlbnQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgeC5HT09HTEVfQ09OU0VOVDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBaZShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Nvb2tpZU5hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2ZW5kb3JDb25zZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZlcnNpb24nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBlKSwgciA9ICdlbmNvZGVHb29nbGVDb25zZW50JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociAmJiBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5ub3RGb3VuZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEVycm9yKCcnLmNvbmNhdChuLm5vdEZvdW5kLCAnIGtleXMgbm90IGZvdW5kJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIuaW5jbHVkZXMoJ1RvQmluYXJ5JykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRoaXNbcl0oewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyaWZpZWRPYmplY3Q6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRhZGF0YU9ubHk6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkgPSB0aGlzLmJpbmFyeVRvQnl0ZXMobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudG9XZWJTYWZlQmFzZTY0KGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbcl0obik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBFcnJvcignSW52YWxpZCBjb29raWUgbmFtZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZGVjb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgeC5OT05JQUJWRU5ET1JfQ09OU0VOVDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAnZGVjb2RlTm9uSWFiVmVuZG9yQmluYXJ5JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHguUFVCTElTSEVSX0NPTlNFTlQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gJ2RlY29kZVB1Ymxpc2hlckJpbmFyeSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB4LlZFTkRPUl9DT05TRU5UOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICdkZWNvZGVFdUNvbnNlbnQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgeC5HT09HTEVfQ09OU0VOVDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAnZGVjb2RlR29vZ2xlQ29uc2VudCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmluY2x1ZGVzKCdCaW5hcnknKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdGhpcy5mcm9tV2ViU2FmZUJhc2U2NCh0KSwgbyA9IHRoaXMuYnl0ZXNUb0JpbmFyeShyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1tuXShvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW25dKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgRXJyb3IoJ0ludmFsaWQgY29va2llIG5hbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2FkZEJpbmFyeUZpZWxkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAoZSB8fCAwKS50b1N0cmluZygyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoci5sZW5ndGggPD0gdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0VuY291bnRlcmVkIGFuIG92ZXJmbG93IHNldHRpbmcgY29va2llIGZpZWxkICcuY29uY2F0KG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHRoaXMuUEFEX1pFUk9TLnN1YnN0cigwLCB0IC0gci5sZW5ndGgpICsgciwgdGhpcy5iaW5hcnlTdHIgKz0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2VuY29kZUdvb2dsZUNvbnNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS52ZW5kb3JDb25zZW50cy5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNvbmNhdCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gcltuXSA/IHQgLSByW24gLSAxXSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyA/IGUuY29uY2F0KCcuJy5jb25jYXQobykpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgJycuY29uY2F0KGUudmVyc2lvbiwgJ34nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkZWNvZGVHb29nbGVDb25zZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSBudWxsID09PSAodCA9IGllKGUpLm1hdGNoKC9cZCsvZykpIHx8IHZvaWQgMCA9PT0gdCA/IHZvaWQgMCA6IHQubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlSW50KGUsIDEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogbnVsbCA9PT0gbiB8fCB2b2lkIDAgPT09IG4gPyB2b2lkIDAgOiBuLnNoaWZ0KCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50SWRzOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdlbmNvZGVFdUNvbnNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkoe30sIGUudmVuZG9yQ29uc2VudHMpLCBuID0gaSh7fSwgZS52ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS52ZW5kb3JDb25zZW50cyA9IHQsIGUudmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cyA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZVt0XSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3RdW25dID8gTmVbdF0uc2V0KHBhcnNlSW50KG4pKSA6IE5lW3RdLnVuc2V0KHBhcnNlSW50KG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZS5wdWJsaXNoZXJDb25zZW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRjTW9kZWxOYW1lOiAncHVibGlzaGVyQ29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZHVjZUFycmF5OiBlLnB1Ymxpc2hlclB1cnBvc2VJZHMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGUucHVibGlzaGVyTGVnaXRpbWF0ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Y01vZGVsTmFtZTogJ3B1Ymxpc2hlckxlZ2l0aW1hdGVJbnRlcmVzdHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZHVjZUFycmF5OiBlLnB1Ymxpc2hlclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IHQudmFsdWUgJiYgKGVbdC50Y01vZGVsTmFtZV0gPSB0LnJlZHVjZUFycmF5LnJlZHVjZShmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGkoe30sIGUpLCB7fSwgcih7fSwgbiwgdC52YWx1ZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG8oJ3ZlbmRvckNvbnNlbnRzJyksIG8oJ3B1cnBvc2VDb25zZW50cycpLCBvKCdzcGVjaWFsRmVhdHVyZU9wdGlucycpLCBvKCd2ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzJyksIG8oJ3B1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzJyksIG8oJ3B1Ymxpc2hlckNvbnNlbnRzJyksIG8oJ3B1Ymxpc2hlckxlZ2l0aW1hdGVJbnRlcmVzdHMnKSwgbnQoTmUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZGVjb2RlRXVDb25zZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJ0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnbm9uSWFiVmVuZG9yVG9CaW5hcnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudmVyaWZpZWRPYmplY3QsIG4gPSBlLm1ldGFkYXRhT25seTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuYmluYXJ5U3RyID0gJycsIHRoaXMuYWRkQmluYXJ5RmllbGQoS2UodC5jcmVhdGVkKSwgdGhpcy5iaXRTaXplcy5jcmVhdGVkLCAnY3JlYXRlZCcpLCB0aGlzLmFkZEJpbmFyeUZpZWxkKEtlKHQubGFzdFVwZGF0ZWQpLCB0aGlzLmJpdFNpemVzLmxhc3RVcGRhdGVkLCAnbGFzdFVwZGF0ZWQnKSwgdGhpcy5hZGRCaW5hcnlGaWVsZCh0LmNtcElkLCB0aGlzLmJpdFNpemVzLmNtcElkLCAnY21wSWQnKSwgdGhpcy5hZGRCaW5hcnlGaWVsZCh0LmNtcFZlcnNpb24sIHRoaXMuYml0U2l6ZXMuY21wVmVyc2lvbiwgJ2NtcFZlcnNpb24nKSwgbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmJpbmFyeVN0cjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5hZGRCaW5hcnlGaWVsZCh0Lm1heFZlbmRvcklkLCB0aGlzLmJpdFNpemVzLm1heFZlbmRvcklkLCAnbWF4VmVuZG9ySWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IDE7IHIgPD0gdC5tYXhWZW5kb3JJZDsgcisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5iaW5hcnlTdHIgKz0gdC52ZW5kb3JDb25zZW50c1tyXSA/ICcxJyA6ICcwJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYmluYXJ5U3RyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZGVjb2RlTm9uSWFiVmVuZG9yQmluYXJ5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5iaXRQb3NpdGlvbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZWQ6IFFlKHRoaXMuZ2V0Qml0cyh0aGlzLmJpdFNpemVzLmNyZWF0ZWQsIGUpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFVwZGF0ZWQ6IFFlKHRoaXMuZ2V0Qml0cyh0aGlzLmJpdFNpemVzLmxhc3RVcGRhdGVkLCBlKSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcElkOiB0aGlzLmdldEJpdHModGhpcy5iaXRTaXplcy5jbXBJZCwgZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcFZlcnNpb246IHRoaXMuZ2V0Qml0cyh0aGlzLmJpdFNpemVzLmNtcFZlcnNpb24sIGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhWZW5kb3JJZDogdGhpcy5nZXRCaXRzKHRoaXMuYml0U2l6ZXMubWF4VmVuZG9ySWQsIGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JDb25zZW50czogW3ZvaWQgMF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuID0gdC5tYXhWZW5kb3JJZCB8fCAxLCByID0gbmV3IEFycmF5KG4pLCBvID0gMDsgbyA8IHQubWF4VmVuZG9ySWQ7IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbbyArIDFdID0gJzEnID09PSBlLmNoYXJBdCh0aGlzLl9iaXRQb3NpdGlvbiArIG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC52ZW5kb3JDb25zZW50cyA9IHIsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdwdWJsaXNoZXJDb25zZW50VG9CaW5hcnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudmVyaWZpZWRPYmplY3QsIG4gPSBlLm1ldGFkYXRhT25seTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuYmluYXJ5U3RyID0gJycsIDIgIT09IHQudmVyc2lvbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigndmVyc2lvbiAnICsgdC52ZXJzaW9uICsgJyBub3Qgc3VwcG9ydGVkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmFkZEJpbmFyeUZpZWxkKHQudmVyc2lvbiwgdGhpcy5iaXRTaXplcy52ZXJzaW9uLCAndmVyc2lvbicpLCB0aGlzLmFkZEJpbmFyeUZpZWxkKEtlKHQuY3JlYXRlZCksIHRoaXMuYml0U2l6ZXMuY3JlYXRlZCwgJ2NyZWF0ZWQnKSwgdGhpcy5hZGRCaW5hcnlGaWVsZChLZSh0Lmxhc3RVcGRhdGVkKSwgdGhpcy5iaXRTaXplcy5sYXN0VXBkYXRlZCwgJ2xhc3RVcGRhdGVkJyksIHRoaXMuYWRkQmluYXJ5RmllbGQodC5jbXBJZCwgdGhpcy5iaXRTaXplcy5jbXBJZCwgJ2NtcElkJyksIHRoaXMuYWRkQmluYXJ5RmllbGQodC5jbXBWZXJzaW9uLCB0aGlzLmJpdFNpemVzLmNtcFZlcnNpb24sICdjbXBWZXJzaW9uJyksIHRoaXMuYWRkQmluYXJ5RmllbGQodC5jb25zZW50U2NyZWVuLCB0aGlzLmJpdFNpemVzLmNvbnNlbnRTY3JlZW4sICdjb25zZW50U2NyZWVuJyksIHRoaXMuYWRkQmluYXJ5RmllbGQodGhpcy5sYW5ndWFnZVRvQ29va2llVmFsdWUodC5jb25zZW50TGFuZ3VhZ2UpLCB0aGlzLmJpdFNpemVzLmNvbnNlbnRMYW5ndWFnZSwgJ2NvbnNlbnRMYW5ndWFnZScpLCB0aGlzLmFkZEJpbmFyeUZpZWxkKHQudmVuZG9yTGlzdFZlcnNpb24sIHRoaXMuYml0U2l6ZXMudmVuZG9yTGlzdFZlcnNpb24sICd2ZW5kb3JMaXN0VmVyc2lvbicpLCB0aGlzLmFkZEJpbmFyeUZpZWxkKHQucHVibGlzaGVyUHVycG9zZXNWZXJzaW9uLCB0aGlzLmJpdFNpemVzLnB1Ymxpc2hlclB1cnBvc2VzVmVyc2lvbiwgJ3B1Ymxpc2hlclB1cnBvc2VzVmVyc2lvbicpLCBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYmluYXJ5U3RyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZEJpbmFyeUZpZWxkKHQuc3RhbmRhcmRQdXJwb3Nlc0FsbG93ZWQsIHRoaXMuYml0U2l6ZXMuc3RhbmRhcmRQdXJwb3Nlc0FsbG93ZWQsICdzdGFuZGFyZFB1cnBvc2VzQWxsb3dlZCcpLCB0aGlzLmFkZEJpbmFyeUZpZWxkKHQubnVtYmVyQ3VzdG9tUHVycG9zZXMsIHRoaXMuYml0U2l6ZXMubnVtYmVyQ3VzdG9tUHVycG9zZXMsICdudW1iZXJDdXN0b21QdXJwb3NlcycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMTsgciA8PSB0Lm51bWJlckN1c3RvbVB1cnBvc2VzOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmJpbmFyeVN0ciArPSB0LmN1c3RvbVB1cnBvc2VDb25zZW50c1tyXSA/ICcxJyA6ICcwJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYmluYXJ5U3RyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZGVjb2RlUHVibGlzaGVyQmluYXJ5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5iaXRQb3NpdGlvbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IHRoaXMuZ2V0Qml0cyh0aGlzLmJpdFNpemVzLnZlcnNpb24sIGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVkOiBRZSh0aGlzLmdldEJpdHModGhpcy5iaXRTaXplcy5jcmVhdGVkLCBlKSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RVcGRhdGVkOiBRZSh0aGlzLmdldEJpdHModGhpcy5iaXRTaXplcy5sYXN0VXBkYXRlZCwgZSkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXBJZDogdGhpcy5nZXRCaXRzKHRoaXMuYml0U2l6ZXMuY21wSWQsIGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXBWZXJzaW9uOiB0aGlzLmdldEJpdHModGhpcy5iaXRTaXplcy5jbXBWZXJzaW9uLCBlKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudFNjcmVlbjogdGhpcy5nZXRCaXRzKHRoaXMuYml0U2l6ZXMuY29uc2VudFNjcmVlbiwgZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRMYW5ndWFnZTogdGhpcy5sYW5ndWFnZUZyb21Db29raWVWYWx1ZSh0aGlzLmdldEJpdHModGhpcy5iaXRTaXplcy5jb25zZW50TGFuZ3VhZ2UsIGUpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yTGlzdFZlcnNpb246IHRoaXMuZ2V0Qml0cyh0aGlzLmJpdFNpemVzLnZlbmRvckxpc3RWZXJzaW9uLCBlKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyUHVycG9zZXNWZXJzaW9uOiB0aGlzLmdldEJpdHModGhpcy5iaXRTaXplcy5wdWJsaXNoZXJQdXJwb3Nlc1ZlcnNpb24sIGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFuZGFyZFB1cnBvc2VzQWxsb3dlZDogdGhpcy5nZXRCaXRzKHRoaXMuYml0U2l6ZXMuc3RhbmRhcmRQdXJwb3Nlc0FsbG93ZWQsIGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudW1iZXJDdXN0b21QdXJwb3NlczogdGhpcy5nZXRCaXRzKHRoaXMuYml0U2l6ZXMubnVtYmVyQ3VzdG9tUHVycG9zZXMsIGUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21QdXJwb3NlQ29uc2VudHM6IFt2b2lkIDBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA9IG5ldyBBcnJheSh0Lm51bWJlckN1c3RvbVB1cnBvc2VzICsgMSksIHIgPSAwOyByIDwgdC5udW1iZXJDdXN0b21QdXJwb3NlczsgcisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbltyICsgMV0gPSAnMScgPT09IGUuY2hhckF0KHRoaXMuX2JpdFBvc2l0aW9uICsgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmN1c3RvbVB1cnBvc2VDb25zZW50cyA9IG4sIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdiaW5hcnlUb0J5dGVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSArPSB0aGlzLlBBRF9aRVJPUy5zdWJzdHIoMCwgNyAtIChlLmxlbmd0aCArIDcpICUgOCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgZS5sZW5ndGg7IG4gKz0gOCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShwYXJzZUludChlLnN1YnN0cihuLCA4KSwgMikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2J5dGVzVG9CaW5hcnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gJycsIG4gPSAwOyBuIDwgZS5sZW5ndGg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gdGhpcy5iaW5hcnk4Qml0cyhlLmNoYXJDb2RlQXQobikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2JpbmFyeThCaXRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMDAwMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMDAwMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMDAxMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMDAxMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMDEwMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMDEwMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMDExMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMDExMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTAwMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTAwMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTAxMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTAxMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTEwMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTEwMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTExMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTExMScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbZSA+Pj4gNCAmIDE1XSArIHRbMTUgJiBlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldEJpdHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHBhcnNlSW50KHQuc3Vic3RyKHRoaXMuYml0UG9zaXRpb24sIGUpLCAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYml0UG9zaXRpb24gKz0gZSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3RvV2ViU2FmZUJhc2U2NCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBidG9hKGUpLnJlcGxhY2UoL1wrL2csICctJykucmVwbGFjZSgvXC8vZywgJ18nKS5yZXBsYWNlKC89KyQvLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdmcm9tV2ViU2FmZUJhc2U2NCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhdG9iKGUucmVwbGFjZSgvLS9nLCAnKycpLnJlcGxhY2UoL18vZywgJy8nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdsYW5ndWFnZVRvQ29va2llVmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gNjQgKiAoZS5jaGFyQ29kZUF0KDApIC0gdGhpcy5MT1dFUkNBU0VfU1RBUlQpICsgKGUuY2hhckNvZGVBdCgxKSAtIHRoaXMuTE9XRVJDQVNFX1NUQVJUKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2xhbmd1YWdlRnJvbUNvb2tpZVZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFN0cmluZy5mcm9tQ2hhckNvZGUodGhpcy5MT1dFUkNBU0VfU1RBUlQgKyBlIC8gNjQgPj4+IDApICsgU3RyaW5nLmZyb21DaGFyQ29kZSh0aGlzLkxPV0VSQ0FTRV9TVEFSVCArIGUgJSA2NCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkZWxldGVDb29raWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5jb29raWUgPSAnJy5jb25jYXQoZSwgJz07IGV4cGlyZXM9VGh1LCAwMSBKYW4gMTk3MCAwMDowMDowMCBVVEM7IHBhdGg9LzsgbWF4LWFnZT0tMTsgZG9tYWluPScpLmNvbmNhdCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2ZhbGxiYWNrVG9Mb2NhbFN0b3JhZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNhdmVPbkxvY2FsU3RvcmFnZShlLCB0KSAmJiB0aGlzLmRlbGV0ZUNvb2tpZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NhdmVPbkxvY2FsU3RvcmFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfN2Q5ZjYzYmJjZDU5MWYzZiA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdsb2NhbFN0b3JhZ2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzdkOWY2M2JiY2Q1OTFmM2YpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2xvY2FsU3RvcmFnZScsICRfX19tb2NrXzkyM2Q3NzJiZGMyMWZkODgubG9jYWxTdG9yYWdlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubG9jYWxTdG9yYWdlLnNldEl0ZW0oZSwgdCksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbnNvbGUud2FybignQ291bGQgbm90IHNhdmUgZGF0YSBvbiBsb2NhbCBzdG9yYWdlOiBOb3QgZW5vdWdoIHNwYWNlLicpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF83ZDlmNjNiYmNkNTkxZjNmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkXzdkOWY2M2JiY2Q1OTFmM2YpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAhKGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzJdKSB8fCBhcmd1bWVudHNbMl0sIHIgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiAociA9IHRoaXMuc2F2ZU9uTG9jYWxTdG9yYWdlKGUsIHQpKSwgciB8fCB0dCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29raWVOYW1lOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2RlZFZhbHVlOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4QWdlOiB0aGlzLkNPT0tJRV9NQVhfQUdFCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF9kMDk5NDc4Zjk1Zjg5ZWM0ID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ2xvY2FsU3RvcmFnZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfZDA5OTQ3OGY5NWY4OWVjNCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX21vY2tfOTIzZDc3MmJkYzIxZmQ4OC5sb2NhbFN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5sb2NhbFN0b3JhZ2UuZ2V0SXRlbShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5sb2NhbFN0b3JhZ2UuZ2V0SXRlbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudHJpbSgpLCBuID0gZG9jdW1lbnQuY29va2llLnNwbGl0KCc7JykuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS50cmltKCkuc3RhcnRzV2l0aCh0ICsgJz0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS50cmltKCkuc3Vic3RyaW5nKHQubGVuZ3RoICsgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciA9IGUgPT09IHguVkVORE9SX0NPTlNFTlQgPyBpdChuKSA6IG5bMF0sIGUgIT09IHguVkVORE9SX0NPTlNFTlQgJiYgZSAhPT0geC5VU19QUklWQUNZICYmIGUgIT09IHguR09PR0xFX0NPTlNFTlQgJiYgdGhpcy5mYWxsYmFja1RvTG9jYWxTdG9yYWdlKHQsIHIpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEVycm9yKCcnLmNvbmNhdChlLCAnIG5vdCBmb3VuZC4nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9kMDk5NDc4Zjk1Zjg5ZWM0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkX2QwOTk0NzhmOTVmODllYzQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnYml0UG9zaXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fYml0UG9zaXRpb247CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2JpdFBvc2l0aW9uID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2JpbmFyeVN0cicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9iaW5hcnlTdHIgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9iaW5hcnlTdHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdKSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBtZShlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnID09PSB0eXBlb2YgU3ltYm9sIHx8IG51bGwgPT0gZVtTeW1ib2wuaXRlcmF0b3JdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGUpIHx8IChlID0gcShlKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gMCwgbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG46IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPj0gZS5sZW5ndGggPyB7IGRvbmU6ICEwIH0gOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlW3QrK10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ludmFsaWQgYXR0ZW1wdCB0byBpdGVyYXRlIG5vbi1pdGVyYWJsZSBpbnN0YW5jZS5cbkluIG9yZGVyIHRvIGJlIGl0ZXJhYmxlLCBub24tYXJyYXkgb2JqZWN0cyBtdXN0IGhhdmUgYSBbU3ltYm9sLml0ZXJhdG9yXSgpIG1ldGhvZC4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8sIGkgPSAhMCwgcyA9ICExOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBlW1N5bWJvbC5pdGVyYXRvcl0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSByLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID0gZS5kb25lLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9ICEwLCBvID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpIHx8IG51bGwgPT0gci5yZXR1cm4gfHwgci5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYmUoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBIKGUpOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9PSB0eXBlb2YgU3ltYm9sICYmIFN5bWJvbC5pdGVyYXRvciBpbiBPYmplY3QoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IHEoZSkgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbnZhbGlkIGF0dGVtcHQgdG8gc3ByZWFkIG5vbi1pdGVyYWJsZSBpbnN0YW5jZS5cbkluIG9yZGVyIHRvIGJlIGl0ZXJhYmxlLCBub24tYXJyYXkgb2JqZWN0cyBtdXN0IGhhdmUgYSBbU3ltYm9sLml0ZXJhdG9yXSgpIG1ldGhvZC4nKTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLkdPX1RPX1BBR0UgPSAnZ29Ub1BhZ2UnLCBlLlBVUlBPU0UgPSAncHVycG9zZScsIGUuTEVHSVRJTUFURV9QVVJQT1NFID0gJ2xlZ2l0aW1hdGVQdXJwb3NlJywgZS5MRUdJVElNQVRFX1ZFTkRPUiA9ICdsZWdpdGltYXRlVmVuZG9yJywgZS5TUEVDSUFMX0ZFQVRVUkUgPSAnc3BlY2lhbEZlYXR1cmUnLCBlLlNUQUNLID0gJ3N0YWNrJywgZS5QQVJUSUFMX0NPTlNFTlQgPSAncGFydGlhbCcsIGUuU0FWRV9BTkRfRVhJVCA9ICdzYXZlQW5kRXhpdCcsIGUuQUNDRVBUX0FMTCA9ICdhY2NlcHRBbGwnLCBlLlJFSkVDVF9BTEwgPSAncmVqZWN0QWxsJywgZS5BQ0NFUFRfQUxMX0xFR0lUSU1BVEUgPSAnYWNjZXB0QWxsTGVnaXRpbWF0ZScsIGUuT0JKRUNUX0FMTF9MRUdJVElNQVRFID0gJ29iamVjdEFsbExlZ2l0aW1hdGUnLCBlLlZFTkRPUiA9ICd2ZW5kb3InLCBlLk5PTl9JQUJfVkVORE9SID0gJ25vbklhYlZlbmRvcicsIGUuRElTTUlTU19VSSA9ICdkaXNtaXNzVWknLCBlLlNUQVJUX09OX1BBR0UgPSAnc3RhcnRPblBhZ2UnLCBlLk9QVF9PVVRfVE9HR0xFID0gJ29wdE91dFRvZ2dsZScsIGUuT1BUX09VVF9DT05GSVJNID0gJ29wdE91dENvbmZpcm0nLCBlLkVYUEFORF9FTEVNRU5UID0gJ2V4cGFuZEVsZW1lbnQnLCBlLkNPTExBUFNFX0VMRU1FTlQgPSAnY29sbGFwc2VFbGVtZW50JywgZS5HT09HTEUgPSAnZ29vZ2xlUGFydG5lcic7CiAgICAgICAgICAgICAgICB9KGFlIHx8IChhZSA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5NQU5EQVRPUlkgPSAndGNmdWk6bWFuZGF0b3J5JywgZS5DSEFOR0VfT0ZfQ09OU0VOVCA9ICd0Y2Z1aTpjaGFuZ2VvZmNvbnNlbnQnLCBlLkNDUEEgPSAndXNwdWk6ZG9ub3RzZWxsJzsKICAgICAgICAgICAgICAgIH0odWUgfHwgKHVlID0ge30pKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLkZFQVRVUkVTID0gJ0ZlYXR1cmVzJywgZS5OT05fSUFCID0gJ05vbiBJQUInLCBlLlBVUlBPU0VTID0gJ1B1cnBvc2VzJywgZS5MRUdJVElNQVRFX1BVUlBPU0VTID0gJ0xlZ2l0aW1hdGUgUHVycG9zZXMnLCBlLkxFR0lUSU1BVEVfVkVORE9SUyA9ICdMZWdpdGltYXRlIFZlbmRvcnMnLCBlLlNQRUNJQUxfUFVSUE9TRVMgPSAnU3BlY2lhbCBQdXJwb3NlcycsIGUuU1BFQ0lBTF9GRUFUVVJFUyA9ICdTcGVjaWFsIEZlYXR1cmVzJywgZS5WRU5ET1JTID0gJ1ZlbmRvcnMnLCBlLlNUQUNLUyA9ICdTdGFja3MnLCBlLkdPT0dMRSA9ICdHb29nbGUnOwogICAgICAgICAgICAgICAgfShjZSB8fCAoY2UgPSB7fSkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuSU5JVCA9ICdpbml0JywgZS5OQVZJR0FUSU9OID0gJ25hdmlnYXRpb24nLCBlLkRPTkUgPSAnZG9uZSc7CiAgICAgICAgICAgICAgICB9KGZlIHx8IChmZSA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5BQ0NFUFRfQUxMID0gJ0FsbCcsIGUuQUNDRVBUX1BBUlRJQUwgPSAnUGFydGlhbCcsIGUuUkVKRUNUID0gJ1JlamVjdCc7CiAgICAgICAgICAgICAgICB9KGxlIHx8IChsZSA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5OT05FX09CSkVDVEVEID0gJ05vbmUnLCBlLkFMTF9PQkpFQ1RFRCA9ICdBbGwnOwogICAgICAgICAgICAgICAgfShwZSB8fCAocGUgPSB7fSkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuU1RBQ0tTID0gJ3N0YWNrcycsIGUuVkVORE9SUyA9ICd2ZW5kb3JzJywgZS5GRUFUVVJFUyA9ICdmZWF0dXJlcycsIGUuUFVSUE9TRVMgPSAncHVycG9zZXMnLCBlLlNQRUNJQUxfRkVBVFVSRVMgPSAnc3BlY2lhbEZlYXR1cmVzJywgZS5TUEVDSUFMX1BVUlBPU0VTID0gJ3NwZWNpYWxQdXJwb3NlcycsIGUuRkxFWElCTEVfUFVSUE9TRVMgPSAnZmxleGlibGVQdXJwb3NlcycsIGUuTEVHSVRJTUFURV9WRU5ET1JTID0gJ2xlZ2l0aW1hdGVWZW5kb3JzJywgZS5MRUdJVElNQVRFX1BVUlBPU0VTID0gJ2xlZ2l0aW1hdGVQdXJwb3NlcycsIGUuVU5GSUxURVJFRF9GRUFUVVJFUyA9ICd1bmZpbHRlcmVkRmVhdHVyZXMnLCBlLlVORklMVEVSRURfUFVSUE9TRVMgPSAndW5maWx0ZXJlZFB1cnBvc2VzJywgZS5VTkZJTFRFUkVEX1NQRUNJQUxfRkVBVFVSRVMgPSAndW5maWx0ZXJlZFNwZWNpYWxGZWF0dXJlcycsIGUuVU5GSUxURVJFRF9TUEVDSUFMX1BVUlBPU0VTID0gJ3VuZmlsdGVyZWRTcGVjaWFsUHVycG9zZXMnOwogICAgICAgICAgICAgICAgfShkZSB8fCAoZGUgPSB7fSkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuQ09OU0VOVF9SRVNQT05TRSA9ICdjb25zZW50LXJlc3BvbnNlJywgZS5DT05TRU5UX1VJID0gJ2NvbnNlbnQtdWknOwogICAgICAgICAgICAgICAgfShoZSB8fCAoaGUgPSB7fSkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuQUNDRVBUID0gJ2FjY2VwdCcsIGUuUkVKRUNUID0gJ3JlamVjdCcsIGUuRElTTUlTUyA9ICdkaXNtaXNzJywgZS5FTlRFUl9GVUxMU0NSRUVOID0gJ2VudGVyLWZ1bGxzY3JlZW4nOwogICAgICAgICAgICAgICAgfSh2ZSB8fCAodmUgPSB7fSkpOwogICAgICAgICAgICAgICAgdmFyIEVlID0gbigxNDkpLCBDZSA9IG4ubihFZSksIF9lID0gewogICAgICAgICAgICAgICAgICAgICAgICBlbjogJ1ByaXZhY3knLAogICAgICAgICAgICAgICAgICAgICAgICBmcjogJ0NvbmZpZGVudGlhbGl0w6knLAogICAgICAgICAgICAgICAgICAgICAgICBkZTogJ0RhdGVuc2NodXR6JywKICAgICAgICAgICAgICAgICAgICAgICAgaXQ6ICdSaXNlcnZhdGV6emEnLAogICAgICAgICAgICAgICAgICAgICAgICBlczogJ1ByaXZhY2lkYWQnLAogICAgICAgICAgICAgICAgICAgICAgICBkYTogJ1ByaXZhdGxpdmV0cyBmcmVkJywKICAgICAgICAgICAgICAgICAgICAgICAgbmw6ICdQcml2YWN5JywKICAgICAgICAgICAgICAgICAgICAgICAgZWw6ICfOkc+Az4zPgc+BzrfPhM6/JywKICAgICAgICAgICAgICAgICAgICAgICAgaHU6ICdBZGF0dsOpZGVsZW0nLAogICAgICAgICAgICAgICAgICAgICAgICBwdDogJ1ByaXZhY2lkYWRlJywKICAgICAgICAgICAgICAgICAgICAgICAgcm86ICdDb25maWRlbsibaWFsaXRhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICBmaTogJ1lrc2l0eWlzeXlzJywKICAgICAgICAgICAgICAgICAgICAgICAgcGw6ICdQcnl3YXRub8WbxIcnLAogICAgICAgICAgICAgICAgICAgICAgICBzazogJ1PDumtyb21pZScsCiAgICAgICAgICAgICAgICAgICAgICAgIHN2OiAnSW50ZWdyaXRldCcsCiAgICAgICAgICAgICAgICAgICAgICAgIG5vOiAnUGVyc29udmVybicsCiAgICAgICAgICAgICAgICAgICAgICAgIHJ1OiAn0JrQvtC90YTQuNC00LXQvdGG0LjQsNC70YzQvdC+0YHRgtGMJywKICAgICAgICAgICAgICAgICAgICAgICAgYXI6ICfYpdi52K/Yp9iv2KfYqiDYp9mE2K7YtdmI2LXZitipJywKICAgICAgICAgICAgICAgICAgICAgICAgZmE6ICfYqtmG2LjbjNmF2KfYqiDYrdix24zZhSDYrti12YjYtduMJwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBTZShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG8sIGkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9ICdxYy1jbXAyLWNvbnRhaW5lcic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmUoJ2RpdicsIGUsIGUsIGRvY3VtZW50LmJvZHkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KCksIHMgPSAncWMtY21wMi1wZXJzaXN0ZW50LWxpbmsnLCBhID0gcmUoJ2EnLCBzLCBzLCBpKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5maXJzdENoaWxkKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICBhLm9uY2xpY2sgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuX190Y2ZhcGkoJ2Rpc3BsYXlDb25zZW50VWknLCAyLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSByZSgnaW1nJywgdm9pZCAwLCB2b2lkIDAsIGEpLCBjID0gZSB8fCBfZVsodCB8fCAnZW4nKS50b0xvd2VyQ2FzZSgpXSB8fCBfZS5lbjsKICAgICAgICAgICAgICAgICAgICB1LnNyYyA9IENlLmEsIHUuYWx0ID0gYzsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGRvY3VtZW50LmNyZWF0ZVRleHROb2RlKGMpOwogICAgICAgICAgICAgICAgICAgIGEuYXBwZW5kQ2hpbGQoZik7CiAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSByZSgnc3R5bGUnLCB2b2lkIDAsICdxYy1jbXAyJywgZG9jdW1lbnQuaGVhZCksIHAgPSBZKChvID0ge30sIHIobywgZC5UT1BfTEVGVCwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RvcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGVmdCcKICAgICAgICAgICAgICAgICAgICAgICAgXSksIHIobywgZC5UT1BfUklHSFQsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0b3AnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3JpZ2h0JwogICAgICAgICAgICAgICAgICAgICAgICBdKSwgcihvLCBkLkJPVFRPTV9MRUZULCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYm90dG9tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsZWZ0JwogICAgICAgICAgICAgICAgICAgICAgICBdKSwgcihvLCBkLkJPVFRPTV9SSUdIVCwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2JvdHRvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmlnaHQnCiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBvKVtuXSwgMiksIGggPSBwWzBdLCB2ID0gcFsxXSwgeSA9ICd0b3AnID09PSBoID8gJ2JvdHRvbScgOiAndG9wJzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbC5pbm5lckhUTUwgPSAnLnFjLWNtcDItcGVyc2lzdGVudC1saW5rIHtjdXJzb3I6cG9pbnRlcjsgcG9zaXRpb246Zml4ZWQ7IGJhY2tncm91bmQtY29sb3I6IzM2OEJENjtwYWRkaW5nOjVweCAxNXB4OyBjb2xvcjojRkZGOyBkaXNwbGF5OmZsZXg7YWxpZ24taXRlbXM6Y2VudGVyOyBtYXgtaGVpZ2h0OjMwcHg7IHotaW5kZXg6MjE0NzQ4MzY0MDsnICsgJycuY29uY2F0KGgsICc6MDsgJykuY29uY2F0KHYsICc6MDsnKSArICdib3JkZXItJy5jb25jYXQoeSwgJy1sZWZ0LXJhZGl1czozcHg7JykgKyAnYm9yZGVyLScuY29uY2F0KHksICctcmlnaHQtcmFkaXVzOjNweDsnKSArICd9LnFjLWNtcDItcGVyc2lzdGVudC1saW5rIGltZyB7d2lkdGg6MTZweDsgaGVpZ2h0OjE3cHg7IG1hcmdpbi1yaWdodDo1cHg7fScsIGE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgd2UsIEllLCBPZSwgQWUsIExlLCBQZSwgVGUsIGtlLCB4ZSwgUmUsIE5lLCBWZSwgVWUsIGplID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZih0aGlzLCBlKSwgdGhpcy5fY29va2llVmFsdWVzID0gdm9pZCAwLCB0aGlzLl9kZWxldGVkVmVuZG9ycyA9IHZvaWQgMCwgdGhpcy5pc1NhZmFyaSA9IHZvaWQgMCwgdGhpcy5yZXNvbHZlQ29va2llID0gdm9pZCAwLCB0aGlzLnJlc29sdmVDb29raWUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLl9jb29raWVWYWx1ZXMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXVjb25zZW50OiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25JYWJWZW5kb3JDb25zZW50OiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnb29nbGVDb29raWVWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmV0Y2hlZDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvbWlzZTogbmV3IFByb21pc2UoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucmVzb2x2ZUNvb2tpZSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuX2RlbGV0ZWRWZW5kb3JzID0gW10sIHRoaXMuaXNTYWZhcmkgPSBvdCgnc2FmYXJpJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAoZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldENvcmVDb25maWcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJZS5jb3JlQ29uZmlnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Q29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYyhhLmEubWFyayhmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIG8sIHMsIHUsIGMsIGYsIGwsIHAsIGQsIGgsIHYsIHksIGcsIG0sIEUsIEM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9IGNlLlZFTkRPUlMsIG4gPSBjZS5MRUdJVElNQVRFX1ZFTkRPUlMsIG8gPSBjZS5MRUdJVElNQVRFX1BVUlBPU0VTLCBzID0gY2UuUFVSUE9TRVMsIHUgPSBjZS5TUEVDSUFMX0ZFQVRVUkVTLCBjID0gY2UuTk9OX0lBQiwgZiA9IGNlLkdPT0dMRSwgdGhpcy5fY29va2llVmFsdWVzLmZldGNoZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDQsIHRoaXMuX2Nvb2tpZVZhbHVlcy5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbCA9IHNlKGtlLmRlY29kZSwgdGhpcy5fY29va2llVmFsdWVzLmV1Y29uc2VudCksIHAgPSBuZXcgYigpLCBkID0gTmUuZ3ZsLCBoID0gSWUuY29yZUNvbmZpZy5wdWJsaXNoZXJOYW1lIHx8IEllLmNvcmVDb25maWcuY29va2llRG9tYWluIHx8ICcnLCB2ID0gSWUuY29yZUNvbmZpZywgeSA9IHYucHVibGlzaGVyUHVycG9zZUlkcywgZyA9IHYucHVibGlzaGVyUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkcywgbSA9IGQudmVuZG9ycywgKHkgfHwgZykgJiYgKG0gPSBpKGkoe30sIG0pLCB7fSwgcih7fSwgaCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSksIHRoaXMucG9wdWxhdGVDb25zZW50cyhwLCB0LCBtLCBsKSwgdGhpcy5wb3B1bGF0ZUNvbnNlbnRzKHAsIHMsIGQucHVycG9zZXMsIGwpLCB0aGlzLnBvcHVsYXRlQ29uc2VudHMocCwgdSwgZC5zcGVjaWFsRmVhdHVyZXMsIGwpLCB0aGlzLnBvcHVsYXRlQ29uc2VudHMocCwgbiwgbSwgbCksIHRoaXMucG9wdWxhdGVDb25zZW50cyhwLCBvLCBkLnB1cnBvc2VzLCBsKSwgRSA9IHNlKFBlLmRlY29kZSwgdGhpcy5fY29va2llVmFsdWVzLm5vbklhYlZlbmRvckNvbnNlbnQpLCB0aGlzLnBvcHVsYXRlQ29uc2VudHMocCwgYywgUGUuZGF0YS5kYXRhLm5vbklhYlZlbmRvckxpc3QsIEUpLCBDID0gc2UoVWUuZGVjb2RlLCB0aGlzLl9jb29raWVWYWx1ZXMuZ29vZ2xlQ29va2llVmFsdWUpLCB0aGlzLnBvcHVsYXRlQ29uc2VudHMocCwgZiwgVWUuZGF0YSwgQyksIGUuYWJydXB0KCdyZXR1cm4nLCBwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2V4dHJhY3ROdW1lcmljS2V5cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBwYXJzZUludChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzTmFOKHIpIHx8ICh0W25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXRDb25zZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gSWUuY29yZUNvbmZpZywgbiA9IHQucHVibGlzaGVyUHVycG9zZUlkcywgciA9IHQucHVibGlzaGVyUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkcywgbyA9IHQucHVibGlzaGVyTmFtZSwgcyA9IHQuY29uc2VudElkZW50aXR5RW5hYmxlZCwgYSA9IHQuaXNBTVA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuY29uc2VudFNjcmVlbiAmJiAoTmUuY29uc2VudFNjcmVlbiA9IGUuY29uc2VudFNjcmVlbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1LCBjID0ga2UuZW5jb2RlKHRoaXMuZXh0cmFjdE51bWVyaWNLZXlzKGUudmVuZG9yQ29uc2VudHMpLCB0aGlzLmV4dHJhY3ROdW1lcmljS2V5cyhlLnB1cnBvc2VzQ29uc2VudHMpLCB0aGlzLmV4dHJhY3ROdW1lcmljS2V5cyhlLnNwZWNpYWxGZWF0dXJlcyksIHRoaXMuZXh0cmFjdE51bWVyaWNLZXlzKGUudmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0KSwgdGhpcy5leHRyYWN0TnVtZXJpY0tleXMoZS5sZWdpdGltYXRlUHVycG9zZXNDb25zZW50cyksIGUudmVuZG9yQ29uc2VudHNbb10sIGUudmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0W29dLCBuLCByKSwgZiA9IHRoaXMuZm9ybWF0Q29uc2VudHMoZS5ub25JYWJDb25zZW50cyksIGwgPSBJZS5wcmVtaXVtUHJvcGVydGllcy5ub25JYWJWZW5kb3JMaXN0VXJsID8gUGUuZW5jb2RlKGYuY29uc2VudEFycmF5LCBmLm1heFZlbmRvcklkKSA6ICcnLCBwID0gdGhpcy5mb3JtYXRHb29nbGVDb25zZW50cyhlKSwgZCA9IEllLmNvcmVDb25maWcuZ29vZ2xlRW5hYmxlZCAmJiBwLmxlbmd0aCA/IFVlLmVuY29kZShwKSA6ICcnLCBoID0gUGUuZGF0YS5kYXRhLm5vbklhYlZlbmRvcnNIYXNoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcC5sZW5ndGggfHwgYSB8fCBMZS5kZWxldGVDb29raWUoeC5HT09HTEVfQ09OU0VOVCwgSWUuY29yZUNvbmZpZy5jb29raWVEb21haW4pLCBSZS5zZXRWYWx1ZXMoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXVjb25zZW50OiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yQ29uc2VudDogbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvcnNIYXNoOiBoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB1ID0gUmUuZ2VuZXJhdGVSZXByb21wdE9wdGlvbnNIYXNoKCksIHRoaXMuc2V0RGF0YShjLCBsLCB1LCBkKSwgdGhpcy51cGRhdGVBcGlWaXNpYmxlKCdHRFBSJywgITEpLCBzICYmIHhlLnNhdmVDb25zZW50VG9QZXJtaXNpbyhjLCBsLCB1KSwgaShpKHt9LCB0aGlzLl9jb29raWVWYWx1ZXMpLCB7fSwgeyBhbGxDb25zZW50czogZS5hbGxDb25zZW50cyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3VwZGF0ZUFwaVZpc2libGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ1VTUCcgIT09IGUgJiYgWGUoT2UuaXNVc2VySW5FVSwgSWUuY29yZUNvbmZpZy5kaXNwbGF5VWkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuX2Nvb2tpZVZhbHVlcy5ldWNvbnNlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmICFuLm1lc3NhZ2UgfHwgKG4gPSAnJyksIHV0LmNtcEFwaS51cGRhdGUobiwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXQuY21wQXBpLnVwZGF0ZShudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSWUuY29yZUNvbmZpZy5wcml2YWN5TW9kZS5pbmNsdWRlcygnR0RQUicpICYmIEllLmNvcmVDb25maWcuZGlzcGxheVBlcnNpc3RlbnRDb25zZW50TGluayAmJiAhSWUuY29yZUNvbmZpZy5pc0FNUCAmJiB0aGlzLmhhc0Nvb2tpZSgpICYmIFNlKEllLmdldEN1c3RvbUNvcmVVaUxhYmVscygpLnBlcnNpc3RlbnRDb25zZW50TGlua0xhYmVsLCBJZS5jb3JlQ29uZmlnLmxhbmdfLCBJZS5jb3JlQ29uZmlnLnBlcnNpc3RlbnRDb25zZW50TGlua0xvY2F0aW9uKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldERhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IEllLmNvcmVDb25maWcsIGkgPSBvLmNvbnNlbnRTY29wZSwgcyA9IG8udGhpcmRQYXJ0eVN0b3JhZ2VUeXBlLCBhID0gby5jb25zZW50U2NvcGVHcm91cFVSTCwgdSA9IG8uY29uc2VudE9uU2FmYXJpLCBjID0gby5pc0FNUCwgZiA9ICdhcGknID09PSBzLCBsID0gdGhpcy5pc1NhZmFyaSAmJiB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjIHx8IChsID8gdGhpcy5zZXREYXRhVXNpbmdBcGkoITAsIGEsIGUsIHQsIG4sIHIpIDogaSA9PT0gdi5TRVJWSUNFIHx8IHRoaXMuaXNTYWZhcmkgPyB0aGlzLnNldERhdGFVc2luZ0ZpcnN0UGFydHkoZSwgdCwgbiwgcikgOiBpID09PSB2LkdMT0JBTCA/ICh0aGlzLnNldERhdGFVc2luZ0FwaSghMCwgJ2h0dHBzOi8vYXBpcy5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9Db29raWVBY2Nlc3NWMicsIGUpLCB0aGlzLnNldERhdGFVc2luZ0ZpcnN0UGFydHkoJycsIHQsIG4pKSA6IGkgPT09IHYuR0xPQkFMX0dST1VQID8gZiA/ICh0aGlzLnNldERhdGFVc2luZ0FwaSghMCwgJ2h0dHBzOi8vYXBpcy5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9Db29raWVBY2Nlc3NWMicsIGUpLCB0aGlzLnNldERhdGFVc2luZ0FwaSghMCwgYSwgJycsIHQsIG4pKSA6ICh0aGlzLnNldERhdGFVc2luZ0FwaSghMCwgJ2h0dHBzOi8vYXBpcy5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9Db29raWVBY2Nlc3NWMicsIGUpLCB0aGlzLnNldERhdGFVc2luZ0lmcmFtZSgnJywgdCwgbikpIDogaSA9PT0gdi5TRVJWSUNFX0dST1VQICYmIChmID8gdGhpcy5zZXREYXRhVXNpbmdBcGkoITAsIGEsIGUsIHQsIG4sIHIpIDogdGhpcy5zZXREYXRhVXNpbmdJZnJhbWUoZSwgdCwgbiwgcikpKSwgdGhpcy5fY29va2llVmFsdWVzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXVjb25zZW50OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yQ29uc2VudDogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvb2dsZUNvb2tpZVZhbHVlOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmV0Y2hlZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlOiB0aGlzLl9jb29raWVWYWx1ZXMucHJvbWlzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0RGF0YVVzaW5nQXBpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQsIG4sIHIsIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiAoc1t4LlZFTkRPUl9DT05TRU5UXSA9IG4pLCByICYmIChzW3guTk9OSUFCVkVORE9SX0NPTlNFTlRdID0gciksIG8gJiYgKHNbeC5SRVBST01QVF9IQVNIXSA9IG8pLCBpICYmIChzW3guR09PR0xFX0NPTlNFTlRdID0gaSksIFEoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAncG9zdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2l0aENyZWRlbnRpYWxzOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coJ3RoZSBjb29raWVzIHdhcyBzYXZlZCBzdWNjZXNzZnVsbHknKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXREYXRhVXNpbmdJZnJhbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmIHplLnRyeUdyb3VwQ29va2llQWNjZXNzQ2FsbCgnc2V0JywgeC5WRU5ET1JfQ09OU0VOVCwgZSksIHQgJiYgemUudHJ5R3JvdXBDb29raWVBY2Nlc3NDYWxsKCdzZXQnLCB4Lk5PTklBQlZFTkRPUl9DT05TRU5ULCB0KSwgbiAmJiB6ZS50cnlHcm91cENvb2tpZUFjY2Vzc0NhbGwoJ3NldCcsIHguUkVQUk9NUFRfSEFTSCwgbiksIHIgJiYgemUudHJ5R3JvdXBDb29raWVBY2Nlc3NDYWxsKCdzZXQnLCB4LkdPT0dMRV9DT05TRU5ULCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldERhdGFVc2luZ0ZpcnN0UGFydHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmIGtlLnNldENvb2tpZShlKSwgdCAmJiBQZS5zZXRDb29raWUodCksIG4gJiYgTGUuc2V0KHguUkVQUk9NUFRfSEFTSCwgbiksIHIgJiYgVWUuc2V0Q29va2llKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZmV0Y2hDb29raWVWYWx1ZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYyhhLmEubWFyayhmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIsIG8sIGksIHMsIHUsIGMsIGYsIGwsIHAsIGQsIGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9IEllLmNvcmVDb25maWcsIG4gPSB0LmNvbnNlbnRTY29wZSwgciA9IHQuY29uc2VudFNjb3BlR3JvdXBVUkwsIG8gPSB0LnRoaXJkUGFydHlTdG9yYWdlVHlwZSwgaSA9IHQuY29uc2VudE9uU2FmYXJpLCBzID0gdC5pc0FNUCwgdSA9ICcnLCBjID0gJycsIGYgPSAnJywgbCA9IHt9LCBwID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSA9IGUubm9uSWFiQ29va2llVmFsdWUsIGMgPSBlLnZlbmRvckNvb2tpZVZhbHVlLCBmID0gZS5nb29nbGVDb29raWVWYWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkID0gdGhpcy5pc1NhZmFyaSAmJiBpLCAhcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDEzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IEpTT04ucGFyc2Uod2luZG93Lm5hbWUpLCBjID0gaC5jb25zZW50U3RyaW5nLCBoLmNvbnNlbnRNZXRhZGF0YSAmJiBoLmNvbnNlbnRNZXRhZGF0YS5hZGRpdGlvbmFsQ29uc2VudCAmJiAoZiA9IGguY29uc2VudE1ldGFkYXRhLmFkZGl0aW9uYWxDb25zZW50KSwgZS5uZXh0ID0gNjg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDIwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDE2LCB0aGlzLmdldERhdGFVc2luZ0FwaSghMCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsID0gZS5zZW50LCBwKGwpLCBlLm5leHQgPSA2ODsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDIwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gIT09IHYuU0VSVklDRSAmJiAhdGhpcy5pc1NhZmFyaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDI1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IHRoaXMuZ2V0RGF0YVVzaW5nRmlyc3RQYXJ0eSgpLCBwKGwpLCBlLm5leHQgPSA2ODsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gIT09IHYuR0xPQkFMKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMzQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gMjgsIHRoaXMuZ2V0RGF0YVVzaW5nQXBpKCEwLCAnaHR0cHM6Ly9hcGlzLnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL0Nvb2tpZUFjY2Vzc1YyJywgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGUuc2VudCwgYyA9IGwudmVuZG9yQ29va2llVmFsdWUsIGwgPSB0aGlzLmdldERhdGFVc2luZ0ZpcnN0UGFydHkoITApLCB1ID0gbC5ub25JYWJDb29raWVWYWx1ZSwgZS5uZXh0ID0gNjg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuICE9PSB2LkdMT0JBTF9HUk9VUCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDU2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdhcGknICE9PSBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gNDY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gMzgsIHRoaXMuZ2V0RGF0YVVzaW5nQXBpKCEwLCAnaHR0cHM6Ly9hcGlzLnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL0Nvb2tpZUFjY2Vzc1YyJywgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwgPSBlLnNlbnQsIGMgPSBsLnZlbmRvckNvb2tpZVZhbHVlLCBlLm5leHQgPSA0MiwgdGhpcy5nZXREYXRhVXNpbmdBcGkoITAsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGUuc2VudCwgdSA9IGwubm9uSWFiQ29va2llVmFsdWUsIGUubmV4dCA9IDU0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gNDgsIHRoaXMuZ2V0RGF0YVVzaW5nQXBpKCEwLCAnaHR0cHM6Ly9hcGlzLnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL0Nvb2tpZUFjY2Vzc1YyJywgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwgPSBlLnNlbnQsIGMgPSBsLnZlbmRvckNvb2tpZVZhbHVlLCBlLm5leHQgPSA1MiwgdGhpcy5nZXREYXRhVXNpbmdJZnJhbWUoITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDUyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGUuc2VudCwgdSA9IGwubm9uSWFiQ29va2llVmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNTQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA2ODsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gIT09IHYuU0VSVklDRV9HUk9VUCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDY4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdhcGknICE9PSBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gNjQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gNjAsIHRoaXMuZ2V0RGF0YVVzaW5nQXBpKCEwLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2MDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBlLnNlbnQsIHAobCksIGUubmV4dCA9IDY4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNjQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gNjYsIHRoaXMuZ2V0RGF0YVVzaW5nSWZyYW1lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNjY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsID0gZS5zZW50LCBwKGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fY29va2llVmFsdWVzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV1Y29uc2VudDogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25JYWJWZW5kb3JDb25zZW50OiB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvb2dsZUNvb2tpZVZhbHVlOiBmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZldGNoZWQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb21pc2U6IHRoaXMuX2Nvb2tpZVZhbHVlcy5wcm9taXNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLnJlc29sdmVDb29raWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3MDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldERhdGFVc2luZ0FwaScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUodCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8sIGksIHMsIHUsIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyA9IEllLmNvcmVDb25maWcuY29uc2VudElkZW50aXR5RW5hYmxlZCwgaSA9IHhlLmdldENvbnNlbnRGcm9tUGFyYW1zKCksIGUubmV4dCA9IDQsIFEoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ2dldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpdGhDcmVkZW50aWFsczogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzID0gZS5zZW50LCB1ID0ge30sIHIgPyB1LnZlbmRvckNvb2tpZVZhbHVlID0gbyAmJiBpW3guVkVORE9SX0NPTlNFTlRdIHx8IHMuZGF0YVt4LlZFTkRPUl9DT05TRU5UXSA6IChjID0gbyAmJiBpW3guUkVQUk9NUFRfSEFTSF0gfHwgcy5kYXRhW3guUkVQUk9NUFRfSEFTSF0sIFJlLnN0b3JlZEhhc2ggPSBjLCB1LnZlbmRvckNvb2tpZVZhbHVlID0gbyAmJiBpW3guVkVORE9SX0NPTlNFTlRdIHx8IHMuZGF0YVt4LlZFTkRPUl9DT05TRU5UXSwgdS5ub25JYWJDb29raWVWYWx1ZSA9IG8gJiYgaVt4Lk5PTklBQlZFTkRPUl9DT05TRU5UXSB8fCBzLmRhdGFbeC5OT05JQUJWRU5ET1JfQ09OU0VOVF0sIHUuZ29vZ2xlQ29va2llVmFsdWUgPSBzLmRhdGEuYWRkdGxfY29uc2VudCksIGUuYWJydXB0KCdyZXR1cm4nLCB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldERhdGFVc2luZ0lmcmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8sIGksIHMsIHUsIGMsIGYsIGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9IEllLmNvcmVDb25maWcsIHIgPSBuLmdvb2dsZUVuYWJsZWQsIG8gPSBuLmNvbnNlbnRJZGVudGl0eUVuYWJsZWQsIGkgPSBJZS5wcmVtaXVtUHJvcGVydGllcy5ub25JYWJWZW5kb3JMaXN0VXJsLCBzID0geGUuZ2V0Q29uc2VudEZyb21QYXJhbXMoKSwgdSA9IHt9LCBlLnQwID0gbyAmJiBzW3guUkVQUk9NUFRfSEFTSF0sIGUudDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDcsIHplLnRyeUdyb3VwQ29va2llQWNjZXNzQ2FsbCgnZ2V0JywgeC5SRVBST01QVF9IQVNILCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUudDAgPSBlLnNlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID0gZS50MCwgUmUuc3RvcmVkSGFzaCA9IGMsICF0IHx8ICFpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS50MSA9IG8gJiYgc1t4Lk5PTklBQlZFTkRPUl9DT05TRU5UXSwgZS50MSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDE2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDE1LCB6ZS50cnlHcm91cENvb2tpZUFjY2Vzc0NhbGwoJ2dldCcsIHguTk9OSUFCVkVORE9SX0NPTlNFTlQsICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUudDEgPSBlLnNlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1Lm5vbklhYkNvb2tpZVZhbHVlID0gZS50MSwgZS5uZXh0ID0gMzc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLnQyID0gbyAmJiBzW3guVkVORE9SX0NPTlNFTlRdLCBlLnQyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMjQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gMjMsIHplLnRyeUdyb3VwQ29va2llQWNjZXNzQ2FsbCgnZ2V0JywgeC5WRU5ET1JfQ09OU0VOVCwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDIzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS50MiA9IGUuc2VudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1LnZlbmRvckNvb2tpZVZhbHVlID0gZS50MiwgIWkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAzMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSAyOCwgemUudHJ5R3JvdXBDb29raWVBY2Nlc3NDYWxsKCdnZXQnLCB4Lk5PTklBQlZFTkRPUl9DT05TRU5ULCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZiA9IGUuc2VudCkgJiYgQXJyYXkuaXNBcnJheShmKSA/IGYgPSBmWzBdIDogZiB8fCAoZiA9IG51bGwpLCB1Lm5vbklhYkNvb2tpZVZhbHVlID0gbyAmJiBzW3guTk9OSUFCVkVORE9SX0NPTlNFTlRdIHx8IGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAzNzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSAzNCwgemUudHJ5R3JvdXBDb29raWVBY2Nlc3NDYWxsKCdnZXQnLCB4LkdPT0dMRV9DT05TRU5ULCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobCA9IGUuc2VudCkgJiYgQXJyYXkuaXNBcnJheShsKSA/IGwgPSBsWzBdIDogbCB8fCAobCA9IG51bGwpLCB1Lmdvb2dsZUNvb2tpZVZhbHVlID0gbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJywgdSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0RGF0YVVzaW5nRmlyc3RQYXJ0eScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge30sIG4gPSBJZS5jb3JlQ29uZmlnLCByID0gbi5nb29nbGVFbmFibGVkLCBvID0gbi5jb25zZW50SWRlbnRpdHlFbmFibGVkLCBpID0gSWUucHJlbWl1bVByb3BlcnRpZXMubm9uSWFiVmVuZG9yTGlzdFVybCwgcyA9IHhlLmdldENvbnNlbnRGcm9tUGFyYW1zKCksIGEgPSBzW3guVkVORE9SX0NPTlNFTlRdLCB1ID0gc1t4LlJFUFJPTVBUX0hBU0hdLCBjID0gc1t4Lk5PTklBQlZFTkRPUl9DT05TRU5UXSwgZiA9IExlLmdldCh4LlZFTkRPUl9DT05TRU5UKSwgbCA9IExlLmdldCh4LlJFUFJPTVBUX0hBU0gpLCBwID0gTGUuZ2V0KHguTk9OSUFCVkVORE9SX0NPTlNFTlQpLCBkID0gTGUuZ2V0KHguR09PR0xFX0NPTlNFTlQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSZS5zdG9yZWRIYXNoID0gbCB8fCBvICYmIHU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZiB8fCBvICYmIGEsIHYgPSBwIHx8IG8gJiYgYywgeSA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIHx8ICgnc3RyaW5nJyA9PT0gdHlwZW9mIGggJiYgKHQudmVuZG9yQ29va2llVmFsdWUgPSBoKSwgciAmJiAnc3RyaW5nJyA9PT0gdHlwZW9mIHkgJiYgKHQuZ29vZ2xlQ29va2llVmFsdWUgPSB5KSksIGkgJiYgJ3N0cmluZycgPT09IHR5cGVvZiB2ICYmICh0Lm5vbklhYkNvb2tpZVZhbHVlID0gdiksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdyZXByb21wdER1ZVRvSW52YWxpZENNUElEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMoYS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByLCBvLCBpLCBzLCB1LCBjLCBmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPSBJZS5jb3JlQ29uZmlnLmlzQU1QLCBuID0gITEsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAyNTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyID0gJ2h0dHBzOi8vdGVzdC5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9HVkwtdjIvY21wLWxpc3QuanNvbicsIG8gPSBbXSwgaSA9IG5ldyBEYXRlKCksIHMgPSBMZS5nZXQoeC5DTVBMSVNUKSwgISgodSA9IHMgJiYgIXMubWVzc2FnZSA/IEpTT04ucGFyc2UocykgOiBudWxsKSAmJiB1LkNNUCAmJiB1LkNNUC5pbmNsdWRlcyhTdHJpbmcoTmUuY21wSWQpKSAmJiBpLmdldFRpbWUoKSA8IHUuZXhwaXJ5KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDEyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICExLCBlLm5leHQgPSAyNTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJldiA9IDEyLCBlLm5leHQgPSAxNSwgUS5nZXQocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gZS5zZW50LCBvLnB1c2guYXBwbHkobywgYmUoT2JqZWN0LmtleXMoYy5kYXRhLmNtcHMpKSksIGYgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFVwZGF0ZWQ6IGMuZGF0YS5sYXN0VXBkYXRlZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDTVA6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJ5OiBpLmdldFRpbWUoKSArIDI1OTIwMDAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgTGUuc2V0KHguQ01QTElTVCwgSlNPTi5zdHJpbmdpZnkoZikpLCBlLm5leHQgPSAyNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDIxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmV2ID0gMjEsIGUudDAgPSBlLmNhdGNoKDEyKSwgY29uc29sZS5sb2coZS50MCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gIW8uaW5jbHVkZXMoU3RyaW5nKE5lLmNtcElkKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hYnJ1cHQoJ3JldHVybicsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCBudWxsLCBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3JlcHJvbXB0RHVlVG9PdXRkYXRlZEd2bCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgciwgbywgaSwgcywgdSwgYywgZiwgbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID0gSWUuY29yZUNvbmZpZy52ZW5kb3JMaXN0VXBkYXRlRnJlcSwgdGhpcy5fY29va2llVmFsdWVzLmZldGNoZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDQsIHRoaXMuX2Nvb2tpZVZhbHVlcy5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9IHNlKGtlLmRlY29kZSwgdGhpcy5fY29va2llVmFsdWVzLmV1Y29uc2VudCksIHIgPSAhMSwgIW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxNzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvID0gbi52ZW5kb3JMaXN0VmVyc2lvbiwgaSA9IG4ucG9saWN5VmVyc2lvbiwgcyA9IG4ubGFzdFVwZGF0ZWQsIHUgPSBEYXRlLm5vdygpIC0gcy5nZXRUaW1lKCkgPiA4NjQwMDAwMCAqIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dGRhdGVkR3ZsUmVwcm9tcHQ6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVjb2RlZEV1Q29uc2VudDogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gMTMsIHRoaXMubG9hZEdWTCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IE5lLmd2bCwgZiA9IGMudmVuZG9yTGlzdFZlcnNpb24sIGwgPSBjLnRjZlBvbGljeVZlcnNpb24sIHUgJiYgKGYgPiBvIHx8IGwgPiBpKSAmJiAociA9ICEwKSwgZS5uZXh0ID0gMTg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dGRhdGVkR3ZsUmVwcm9tcHQ6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVjb2RlZEV1Q29uc2VudDogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdyZXByb21wdER1ZVRvQ29uc2VudE9uRGVsZXRlZFZlbmRvcnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9ICExLCByID0gbWUodGhpcy5fZGVsZXRlZFZlbmRvcnMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyLnMoKTsgISh0ID0gci5uKCkpLmRvbmU7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0LnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmhhcyhvKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5lKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5mKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdmZXRjaERhdGFUb1JlcHJvbXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMoYS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByLCBvLCBzLCB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDIsIHRoaXMucmVwcm9tcHREdWVUb091dGRhdGVkR3ZsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gZS5zZW50LCBuID0gdC5vdXRkYXRlZEd2bFJlcHJvbXB0LCByID0gdC5kZWNvZGVkRXVDb25zZW50LCBlLm5leHQgPSA3LCB0aGlzLnJlcHJvbXB0RHVlVG9JbnZhbGlkQ01QSUQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gPSBlLnNlbnQsIHMgPSBJZS5jb3JlQ29uZmlnLmNvbnNlbnRTY29wZSwgKHUgPSBuIHx8IG8pIHx8ICh1ID0gdGhpcy5yZXByb21wdER1ZVRvQ29uc2VudE9uRGVsZXRlZFZlbmRvcnMoci52ZW5kb3JDb25zZW50cy5zZXRfKSkgfHwgJ2dsb2JhbCcgPT09IHMgfHwgKFJlLnNldFZhbHVlcyhpKGkoe30sIHRoaXMuX2Nvb2tpZVZhbHVlcyksIHt9LCB7IG5vbklhYlZlbmRvcnNIYXNoOiBQZS5kYXRhLmRhdGEubm9uSWFiVmVuZG9yc0hhc2ggfSkpLCB1ID0gUmUuc2hvdWxkUmVwcm9tcHQoKSksIGUuYWJydXB0KCdyZXR1cm4nLCB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3BvcHVsYXRlQ29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbywgaSA9IGNlLk5PTl9JQUIsIHMgPSBjZS5QVVJQT1NFUywgYSA9IGNlLkxFR0lUSU1BVEVfUFVSUE9TRVMsIHUgPSBjZS5MRUdJVElNQVRFX1ZFTkRPUlMsIGMgPSBjZS5WRU5ET1JTLCBmID0gY2UuU1BFQ0lBTF9GRUFUVVJFUywgbCA9IGNlLkdPT0dMRSwgcCA9ICcnLCBkID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gJ25vbklhYkNvbnNlbnRzJywgcCA9ICd2ZW5kb3JDb25zZW50cyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBjOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICd2ZW5kb3JDb25zZW50cycsIHAgPSAndmVuZG9yQ29uc2VudHMnLCBkID0gJ3B1Ymxpc2hlckNvbnNlbnRzJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gJ3B1cnBvc2VzQ29uc2VudHMnLCBwID0gJ3B1cnBvc2VDb25zZW50cyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBhOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICdsZWdpdGltYXRlUHVycG9zZXNDb25zZW50cycsIHAgPSAncHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgdToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSAndmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0JywgcCA9ICd2ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzJywgZCA9ICdwdWJsaXNoZXJMZWdpdGltYXRlSW50ZXJlc3RzJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gJ3NwZWNpYWxGZWF0dXJlcycsIHAgPSAnc3BlY2lhbEZlYXR1cmVPcHRpbnMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSAnZ29vZ2xlQ29uc2VudHMnLCBwID0gJ2NvbnNlbnRJZHMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBudWxsICE9PSByICYmICFyLm1lc3NhZ2UsIHYgPSBJZS5jb3JlQ29uZmlnLnB1Ymxpc2hlck5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlW29dLmhhc0Nvb2tpZSA9IGgsIGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgaToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSwgZyA9IG1lKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChnLnMoKTsgISh5ID0gZy5uKCkpLmRvbmU7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSB5LnZhbHVlLCBiID0gcltwXVttLmlkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW29dW20uaWRdID0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoQSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5lKEEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5mKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGw6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEUsIEMgPSBtZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoQy5zKCk7ICEoRSA9IEMubigpKS5kb25lOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBfID0gRS52YWx1ZSwgUyA9IHBhcnNlSW50KF8uaWQsIDEwKSwgdyA9IHJbcF0uaW5jbHVkZXMoUyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtvXVtTXSA9IHc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMuZShBKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMuZigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBJIGluIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIE8gPSBJID09PSB2ICYmIGQgPyBiZShyW2RdLnNldF8pLmxlbmd0aCA+IDAgOiByW3BdLmhhcyhwYXJzZUludChJKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbb11bSV0gPSBPOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2Zvcm1hdENvbnNlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAwLCBuID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBwYXJzZUludChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzTmFOKG8pIHx8IChvID4gdCAmJiAodCA9IG8pLCBuLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnQ6IGVbcl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudEFycmF5OiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4VmVuZG9ySWQ6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2Zvcm1hdEdvb2dsZUNvbnNlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlLmdvb2dsZUNvbnNlbnRzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgITAgPT09IGUuZ29vZ2xlQ29uc2VudHNbbl0gJiYgdC5wdXNoKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5zb3J0KGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAtIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAncmVndWxhdGlvblRvSW5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgciwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID0gSWUuY29yZUNvbmZpZy5wcml2YWN5TW9kZSwgbiA9ICcnLCAhdC5pbmNsdWRlcygnVVNQJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyID0gSWUuY29yZUNvbmZpZy51c3BKdXJpc2RpY3Rpb24sICFPZS5pc1VzZXJJblVTIHx8ICFyLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDE0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFooJ2luaXRVc3BMb2NhdGlvbjogVVMnKSwgci5pbmNsdWRlcygnVVMnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDEzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDksIE9lLmNoZWNrU3BlY2lmaWNMb2NhdGlvbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBaKCdpbml0VXNwTG9jYXRpb246IHNwZWNpZmljIGxvY2F0aW9uJyArIEpTT04uc3RyaW5naWZ5KE9lLnVzZXJTcGVjaWZpY0xvY2F0aW9uKSksIE9lLnVzZXJTcGVjaWZpY0xvY2F0aW9uICYmIE9lLnVzZXJTcGVjaWZpY0xvY2F0aW9uLnJlZ2lvbiAmJiByLmluY2x1ZGVzKE9lLnVzZXJTcGVjaWZpY0xvY2F0aW9uLnJlZ2lvbi50b1VwcGVyQ2FzZSgpKSAmJiAobiA9ICdVU1AnKSwgZS5uZXh0ID0gMTQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAnVVNQJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmluY2x1ZGVzKCdHRFBSJykgJiYgJ1VTUCcgIT09IG4gJiYgKG8gPSBJZS5jb3JlQ29uZmlnLmRpc3BsYXlVaSwgKE9lLmlzVXNlckluRVUgJiYgJ2luRVUnID09PSBvIHx8ICdhbHdheXMnID09PSBvKSAmJiAobiA9ICdHRFBSJykpLCBlLmFicnVwdCgncmV0dXJuJywgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdsb2FkR1ZMJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMoYS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByLCBvLCBpLCBzLCB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPSBJZS5jb3JlQ29uZmlnLCBuID0gdC5wcml2YWN5TW9kZSwgciA9IHQubGFuZ18sIG8gPSBJZS5wcmVtaXVtUHJvcGVydGllcywgaSA9IG8udmVuZG9yV2hpdGVsaXN0LCBzID0gby52ZW5kb3JCbGFja2xpc3QsIHUgPSBudWxsID09PSByIHx8IHZvaWQgMCA9PT0gciA/IHZvaWQgMCA6IHIudG9VcHBlckNhc2UoKSwgTmUuZ3ZsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTmUuZ3ZsID0gbmV3IHouR1ZMKCdMQVRFU1QnKSwgZS5uZXh0ID0gNiwgTmUuZ3ZsLnJlYWR5UHJvbWlzZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFuLmluY2x1ZGVzKCdHRFBSJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSA5LCBOZS5ndmwuY2hhbmdlTGFuZ3VhZ2UodSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVyR3ZsKE5lLmd2bCwgaSwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDE0LCBOZS5ndmwucmVhZHlQcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJydXB0KCdyZXR1cm4nLCBOZS5ndmwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZmlsdGVyR3ZsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLnZlbmRvcnMsIG8gPSBbXSwgaSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhyKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByW2VdLmRlbGV0ZWREYXRlID8gaS5wdXNoKHJbZV0uaWQpIDogby5wdXNoKHJbZV0uaWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5kZWxldGVkVmVuZG9ycyA9IGksIHQubGVuZ3RoICYmIChvID0gdC5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLmluY2x1ZGVzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSksIG4ubGVuZ3RoID8gZS5uYXJyb3dWZW5kb3JzVG8oby5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhbi5pbmNsdWRlcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIDogZS5uYXJyb3dWZW5kb3JzVG8obyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdoYXNDb29raWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXRoaXMuX2Nvb2tpZVZhbHVlcy5ldWNvbnNlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXRQdWJsaXNoZXJSZXN0cmljdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5lLnB1Ymxpc2hlclJlc3RyaWN0aW9ucy5hZGQoZS5pZCwgZS5wdXJwb3NlUmVzdHJpY3Rpb24pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnY29va2llVmFsdWVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2Nvb2tpZVZhbHVlczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2RlbGV0ZWRWZW5kb3JzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2RlbGV0ZWRWZW5kb3JzID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKSwgQmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmKHRoaXMsIGUpLCB0aGlzLl9kYXRhID0gdm9pZCAwLCB0aGlzLl9maWVsZHMgPSB2b2lkIDAsIHRoaXMuX2ZpZWxkcyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVkOiBuZXcgRGF0ZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RVcGRhdGVkOiBuZXcgRGF0ZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcElkOiAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXBWZXJzaW9uOiAyNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhWZW5kb3JJZDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JDb25zZW50czogW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuX2RhdGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiVmVuZG9yTGlzdDogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlQXQ6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvcnNIYXNoOiAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcChlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9kYXRhID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2ZpZWxkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9maWVsZHMgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9maWVsZHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdKSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCksIE1lID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZih0aGlzLCBlKSwgdGhpcy5fZGF0YSA9IHZvaWQgMCwgdGhpcy5jcmVhdGVkID0gdm9pZCAwLCB0aGlzLl9kYXRhID0gbmV3IEJlKCksIHRoaXMuY3JlYXRlZCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdlbmNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW2UuaWRdID0gZS5jb25zZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgITEgPT09IHRoaXMuY3JlYXRlZCA/ICh0aGlzLmNyZWF0ZWQgPSAhMCwgdGhpcy5fZGF0YS5maWVsZHMgPSBpKGkoe30sIHRoaXMuX2RhdGEuZmllbGRzKSwge30sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckNvbnNlbnRzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlZDogbmV3IERhdGUoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RVcGRhdGVkOiBuZXcgRGF0ZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4VmVuZG9ySWQ6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIDogdGhpcy5fZGF0YS5maWVsZHMgPSBpKGkoe30sIHRoaXMuX2RhdGEuZmllbGRzKSwge30sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckNvbnNlbnRzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFVwZGF0ZWQ6IG5ldyBEYXRlKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIExlLmVuY29kZShpKHsgY29va2llTmFtZTogeC5OT05JQUJWRU5ET1JfQ09OU0VOVCB9LCB0aGlzLl9kYXRhLmZpZWxkcykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZGVjb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIExlLmRlY29kZSh4Lk5PTklBQlZFTkRPUl9DT05TRU5ULCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldENvb2tpZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2YgZSA/IExlLnNldCh4Lk5PTklBQlZFTkRPUl9DT05TRU5ULCBlKSA6IGNvbnNvbGUuZXJyb3IoZS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldENvb2tpZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBMZS5nZXQoeC5OT05JQUJWRU5ET1JfQ09OU0VOVCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdzdHJpbmcnID09PSB0eXBlb2YgZSA/IHRoaXMuZGVjb2RlKGUpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2ZldGNoTGlzdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChJZS5wcmVtaXVtUHJvcGVydGllcy5ub25JYWJWZW5kb3JMaXN0VXJsIHx8IEllLm5vbklhYlZlbmRvcnNJbmZvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLnByZXYgPSAyLCAndW5kZWZpbmVkJyA9PT0gdHlwZW9mIEllLm5vbklhYlZlbmRvcnNJbmZvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gOTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChJZS5ub25JYWJWZW5kb3JzSW5mby5ub25JYWJWZW5kb3JMaXN0ICYmIDAgIT09IEllLm5vbklhYlZlbmRvcnNJbmZvLm5vbklhYlZlbmRvckxpc3QubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gNjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBJZS5ub25JYWJWZW5kb3JzSW5mbywgZS5uZXh0ID0gMTM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDExLCBRLmdldChJZS5wcmVtaXVtUHJvcGVydGllcy5ub25JYWJWZW5kb3JMaXN0VXJsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBlLnNlbnQsIHQgPSBuLmRhdGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gW10sIHQubm9uSWFiVmVuZG9yTGlzdC5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGUubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGUudmVuZG9ySWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvbGljeVVybDogISFlLnByaXZhY3lQb2xpY3lVcmwgJiYgZS5wcml2YWN5UG9saWN5VXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogISFlLmRlc2NyaXB0aW9uICYmIGUuZGVzY3JpcHRpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VzOiAnbm9uSWFiUHVycG9zZUNvbnNlbnRJZHMnIGluIGUgJiYgZS5ub25JYWJQdXJwb3NlQ29uc2VudElkcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVnSW50UHVycG9zZXM6ICdub25JYWJQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0SWRzJyBpbiBlICYmIGUubm9uSWFiUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5wdXNoKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHRoaXMuX2RhdGEuZGF0YSA9IGkoaSh7fSwgdCksIHt9LCB7IG5vbklhYlZlbmRvckxpc3Q6IHIgfSksIGUubmV4dCA9IDIxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXYgPSAxOCwgZS50MCA9IGUuY2F0Y2goMiksIGNvbnNvbGUubG9nKCdlcnJvciBwcm9jZXNzaW5nIG5vbklhYlZlbmRvcnMnLCBlLnQwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgdGhpcywgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2RhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKSwgRGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmKHRoaXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdlbmNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgciwgbywgaSwgcywgYSwgdSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTGUuZW5jb2RlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZU5hbWU6IHguVkVORE9SX0NPTlNFTlQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JDb25zZW50czogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VDb25zZW50czogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxGZWF0dXJlT3B0aW5zOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0czogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyQ29uc2VudDogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1Ymxpc2hlckxlZ2l0aW1hdGU6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXJQdXJwb3NlSWRzOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVibGlzaGVyUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkczogdQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2RlY29kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBMZS5kZWNvZGUoeC5WRU5ET1JfQ09OU0VOVCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXRDb29raWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PT0gdHlwZW9mIGUgPyBMZS5zZXQoeC5WRU5ET1JfQ09OU0VOVCwgZSwgITEpIDogY29uc29sZS5lcnJvcihlLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Q29va2llJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IExlLmdldCh4LlZFTkRPUl9DT05TRU5UKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ3N0cmluZycgPT09IHR5cGVvZiBlID8gdGhpcy5kZWNvZGUoZSkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCBGZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYodGhpcywgZSksIHRoaXMuX3VzcFZlcnNpb24gPSB2b2lkIDAsIHRoaXMuX2Jhc2VTdHJpbmcgPSB2b2lkIDAsIHRoaXMuX25vdGljZWdpdmVuID0gdm9pZCAwLCB0aGlzLl9vcHRlZG91dCA9IHZvaWQgMCwgdGhpcy5fbHNwYWN0ID0gdm9pZCAwLCB0aGlzLl91c3BWZXJzaW9uID0gMSwgdGhpcy5fbm90aWNlZ2l2ZW4gPSAnLScsIHRoaXMuX29wdGVkb3V0ID0gJy0nLCB0aGlzLl9sc3BhY3QgPSAnLScsIHRoaXMuX2Jhc2VTdHJpbmcgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdiYXNlU3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2Jhc2VTdHJpbmcgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9iYXNlU3RyaW5nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnbm90aWNlZ2l2ZW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fbm90aWNlZ2l2ZW4gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9ub3RpY2VnaXZlbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ29wdGVkb3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX29wdGVkb3V0ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fb3B0ZWRvdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdsc3BhY3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fbHNwYWN0ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fbHNwYWN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAndXNwVmVyc2lvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl91c3BWZXJzaW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCBHZSA9IC9eWzFdW25OeVktXVtuTnlZLV1bbk55WS1dJC8sIEhlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZih0aGlzLCBlKSwgdGhpcy5fZGF0YSA9IHZvaWQgMCwgdGhpcy5fZGF0YSA9IG5ldyBGZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdlbmNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZGF0YS5iYXNlU3RyaW5nID0gJycuY29uY2F0KGUsICdZJykuY29uY2F0KHQgPyAnWScgOiAnTicpLmNvbmNhdChJZS5jb3JlQ29uZmlnLnVzcExzcGFjdCksIHRoaXMuX2RhdGEuYmFzZVN0cmluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldENvb2tpZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2YgZSA/IEdlLnRlc3QoZSkgJiYgTGUuc2V0KHguVVNfUFJJVkFDWSwgZSwgITEpIDogZSAmJiAnbWVzc2FnZScgaW4gZSAmJiBjb25zb2xlLmVycm9yKGUubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXRDb29raWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBMZS5nZXQoeC5VU19QUklWQUNZKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKSwgcWUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZih0aGlzLCBlKSwgdGhpcy5fY29va2llQWNjZXNzSWZyYW1lID0gdm9pZCAwLCB0aGlzLl9pc0Nvb2tpZUFjY2Vzc0lmcmFtZVJlYWR5ID0gdm9pZCAwLCB0aGlzLmdyb3VwQ29va2llQWNjZXNzQ2FsbGJhY2tzID0gdm9pZCAwLCB0aGlzLl9jb29raWVBY2Nlc3NJZnJhbWUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdpZnJhbWUnKSwgdGhpcy5faXNDb29raWVBY2Nlc3NJZnJhbWVSZWFkeSA9ICExLCB0aGlzLmdyb3VwQ29va2llQWNjZXNzQ2FsbGJhY2tzID0ge30sIHRoaXMuZ3JvdXBDb29raWVBY2Nlc3NIYW5kbGVyID0gdGhpcy5ncm91cENvb2tpZUFjY2Vzc0hhbmRsZXIuYmluZCh0aGlzKSwgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIgPyB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignbWVzc2FnZScsIHRoaXMuZ3JvdXBDb29raWVBY2Nlc3NIYW5kbGVyLCAhMSkgOiB3aW5kb3cuYXR0YWNoRXZlbnQoJ29ubWVzc2FnZScsIHRoaXMuZ3JvdXBDb29raWVBY2Nlc3NIYW5kbGVyKSwgdGhpcy5jcmVhdGVHcm91cENvb2tpZUFjY2Vzc0lmcmFtZSh0LmNvcmVDb25maWcuY29uc2VudFNjb3BlR3JvdXBVUkwsICdfcWNfY29va2llX2FjY2VzcycpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICd0cnlHcm91cENvb2tpZUFjY2Vzc0NhbGwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiAobykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBzZXRJbnRlcnZhbChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5faXNDb29raWVBY2Nlc3NJZnJhbWVSZWFkeSAmJiByLl9jb29raWVBY2Nlc3NJZnJhbWUuY29udGVudFdpbmRvdyAmJiAoY2xlYXJJbnRlcnZhbChpKSwgci5ncm91cENvb2tpZUFjY2Vzc0NhbGwoZSwgdCwgbiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCA1MCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ3JvdXBDb29raWVBY2Nlc3NDYWxsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBNYXRoLnJhbmRvbSgpLnRvU3RyaW5nKCksIGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbElkOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fcWNDbXBDb29raWVBY2Nlc3NDYWxsOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtZDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llTmFtZTogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc2V0JyA9PT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ncm91cENvb2tpZUFjY2Vzc0NhbGxiYWNrc1tvXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29raWVOYW1lOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZVZhbHVlOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBuZXcgRGF0ZShEYXRlLm5vdygpICsgMzM2OTYwMDAwMDApLnRvVVRDU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLl9fcWNDbXBDb29raWVBY2Nlc3NDYWxsLmNvb2tpZVZhbHVlID0gbiwgaS5fX3FjQ21wQ29va2llQWNjZXNzQ2FsbC5jb29raWVQYXRoID0gSWUuY29yZUNvbmZpZy5jb29raWVQYXRoLCBpLl9fcWNDbXBDb29raWVBY2Nlc3NDYWxsLmV4cGlyZXMgPSBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZ3JvdXBDb29raWVBY2Nlc3NDYWxsYmFja3Nbb10gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llTmFtZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlOiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9jb29raWVBY2Nlc3NJZnJhbWUuY29udGVudFdpbmRvdy5wb3N0TWVzc2FnZShpLCAnKicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnY3JlYXRlR3JvdXBDb29raWVBY2Nlc3NJZnJhbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuX2Nvb2tpZUFjY2Vzc0lmcmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5zcmMgPSBlLCBuLnN0eWxlLmRpc3BsYXkgPSAnbm9uZScsIG4uaWQgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkgPyBkb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKG4pIDogc2V0VGltZW91dChlLCA1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ3JvdXBDb29raWVBY2Nlc3NIYW5kbGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgodCA9ICdzdHJpbmcnID09PSB0eXBlb2YgZS5kYXRhID8gLTEgIT09IGUuZGF0YS5pbmRleE9mKCdfX3FjQ21wQ29va2llQWNjZXNzUmV0dXJuJykgPyBKU09OLnBhcnNlKGUuZGF0YSkgOiB7fSA6IGUuZGF0YSkuX19xY0NtcENvb2tpZUFjY2Vzc1JldHVybikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuX19xY0NtcENvb2tpZUFjY2Vzc1JldHVybi5pc0hhbmRsZXJSZWdpc3RlcmVkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkICh0aGlzLl9pc0Nvb2tpZUFjY2Vzc0lmcmFtZVJlYWR5ID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0Ll9fcWNDbXBDb29raWVBY2Nlc3NSZXR1cm4sIHIgPSB0aGlzLmdyb3VwQ29va2llQWNjZXNzQ2FsbGJhY2tzW3QuY2FsbElkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLnJlc29sdmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dldCcgPT09IG4uY21kICYmIChvID0gLTEgIT09IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2V1Y29uc2VudC12MicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhZGR0bF9jb25zZW50JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uaW5kZXhPZihyLmNvb2tpZU5hbWUpID8gJ2V1Y29uc2VudC12MicgPT09IHIuY29va2llTmFtZSA/IHRoaXMucmV0dXJuTGF0ZXN0VmVuZG9yQ29va2llKG4uY29va2llcykgOiBuLmlzU3VjY2VzcyA/IG4uY29va2llc1swXSA6IG51bGwgOiBuLmNvb2tpZXMsIHIucmVzb2x2ZShvKSksIGRlbGV0ZSB0aGlzLmdyb3VwQ29va2llQWNjZXNzQ2FsbGJhY2tzW3QuY2FsbElkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAncmV0dXJuTGF0ZXN0VmVuZG9yQ29va2llJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5sZW5ndGggPyBpdChlKSA6IG5ldyBFcnJvcignZXVjb25zZW50LXYyIG5vdCBmb3VuZC4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2lzQ29va2llQWNjZXNzSWZyYW1lUmVhZHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5pc0Nvb2tpZUFjY2Vzc0lmcmFtZVJlYWR5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnY29va2llQWNjZXNzSWZyYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2Nvb2tpZUFjY2Vzc0lmcmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKSwgWWUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmKHRoaXMsIGUpLCB0aGlzLnZlcnNpb24gPSB2b2lkIDAsIHRoaXMuX2RhdGEgPSB2b2lkIDAsIHRoaXMudmVyc2lvbiA9IDEsIHRoaXMuX2RhdGEgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcChlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZW5jb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIExlLmVuY29kZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb29raWVOYW1lOiB4LkdPT0dMRV9DT05TRU5ULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yQ29uc2VudHM6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiB0aGlzLnZlcnNpb24KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkZWNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTGUuZGVjb2RlKHguR09PR0xFX0NPTlNFTlQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0Q29va2llJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgPT09IHR5cGVvZiBlID8gTGUuc2V0KHguR09PR0xFX0NPTlNFTlQsIGUsICExKSA6IGNvbnNvbGUuZXJyb3IoZS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldENvb2tpZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gTGUuZ2V0KHguR09PR0xFX0NPTlNFTlQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiAnc3RyaW5nJyA9PT0gdHlwZW9mIHQgPyBlID8gdCA6IHRoaXMuZGVjb2RlKHQpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2ZldGNoUGFydG5lcnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYyhhLmEubWFyayhmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIsIG8sIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoSWUuY29yZUNvbmZpZy5nb29nbGVFbmFibGVkICYmICFJZS5jb3JlQ29uZmlnLmNvbnNlbnRTY29wZS5pbmNsdWRlcygnZ2xvYmFsJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJydXB0KCdyZXR1cm4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJldiA9IDIsICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL3RjZnYyL2dvb2dsZS1hdHAtbGlzdC5qc29uJywgZS5uZXh0ID0gNiwgUS5nZXQoJ2h0dHBzOi8vcXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvZ29vZ2xlLWF0cC1saXN0Lmpzb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyIGluICh0ID0gZS5zZW50LCBuID0gW10sIHQuZGF0YSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiAobyA9IHQuZGF0YVtyXSkucHJvdmlkZXJfaWQgJiYgJycgIT09IG8ucHJvdmlkZXJfaWQgJiYgKGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IG8ucHJvdmlkZXJfbmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IG8ucHJvdmlkZXJfaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvbGljeVVybDogby5wb2xpY3lfdXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogby5kb21haW5zCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbi5wdXNoKGkpKSwgdGhpcy5fZGF0YSA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDExOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmV2ID0gMTEsIGUudDAgPSBlLmNhdGNoKDIpLCBjb25zb2xlLmxvZyhlLnQwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgdGhpcywgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2RhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHouR1ZMLmJhc2VVcmwgPSAnaHR0cHM6Ly9xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9HVkwtdjIvJzsKICAgICAgICAgICAgICAgIHZhciB6ZSwgV2UgPSBuZXcgSigpLCBKZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGkoaShpKHt9LCBlLmNvcmVDb25maWcpLCBlLnByZW1pdW1Qcm9wZXJ0aWVzKSwgZS5jb3JlVWlMYWJlbHMpLCBlLnByZW1pdW1VaUxhYmVscyk7CiAgICAgICAgICAgICAgICAgICAgfSwgS2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWF0aC5mbG9vcihlLmdldFRpbWUoKSAvIDEwMCk7CiAgICAgICAgICAgICAgICAgICAgfSwgUWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IERhdGUoMTAwICogZSk7CiAgICAgICAgICAgICAgICAgICAgfSwgWmUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5rZXlzKHQpLmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xID09PSBlLmluZGV4T2YodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5sZW5ndGggJiYgKHQubm90Rm91bmQgPSBuKSwgdDsKICAgICAgICAgICAgICAgICAgICB9LCBYZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFlICYmICdhbHdheXMnICE9PSB0KTsKICAgICAgICAgICAgICAgICAgICB9LCAkZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNvcmVDb25maWcuY29uc2VudFNjb3BlID09PSB2LkdMT0JBTCB8fCBlLmNvcmVDb25maWcuY29uc2VudFNjb3BlID09PSB2LkdMT0JBTF9HUk9VUDsKICAgICAgICAgICAgICAgICAgICB9LCBldCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIHQubGVuZ3RoID4gMCA/ICh0LmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gZVt0XSA/IG5bdF0gPSBlW3RdIDogblt0XSA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgbikgOiBlOwogICAgICAgICAgICAgICAgICAgIH0sIHR0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuZXcgRGF0ZShEYXRlLm5vdygpICsgMTAwMCAqIGUubWF4QWdlKS50b1VUQ1N0cmluZygpLCBuID0gJ2h0dHBzOicgPT09IHdpbmRvdy5sb2NhdGlvbi5wcm90b2NvbCA/ICc7U2FtZVNpdGU9TGF4O3NlY3VyZScgOiAnJywgciA9IEllLmNvcmVDb25maWcuY29va2llUGF0aCB8fCAnLyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmNvb2tpZSA9IGUuY29va2llTmFtZSArICc9JyArIGUuZW5jb2RlZFZhbHVlICsgJztwYXRoPScgKyByICsgJzttYXgtYWdlPScgKyBlLm1heEFnZSArICc7ZXhwaXJlcz0nICsgdCArICc7ZG9tYWluPScgKyBJZS5jb3JlQ29uZmlnLmNvb2tpZURvbWFpbiArIG47CiAgICAgICAgICAgICAgICAgICAgfSwgbnQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gei5UQ1N0cmluZy5lbmNvZGUoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwgcnQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gei5UQ1N0cmluZy5kZWNvZGUoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwgb3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZmlyZWZveCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gbmF2aWdhdG9yLnVzZXJBZ2VudC50b0xvd2VyQ2FzZSgpLmluZGV4T2YoZSkgPiAtMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdzYWZhcmknOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IG5hdmlnYXRvci51c2VyQWdlbnQudG9Mb3dlckNhc2UoKS5pbmRleE9mKGUpID4gLTEgJiYgLTEgPT09IG5hdmlnYXRvci51c2VyQWdlbnQudG9Mb3dlckNhc2UoKS5pbmRleE9mKCdjaHJvbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICB9LCBpdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbnVsbCwgbiA9IG5ldyBFcnJvcignZXVjb25zZW50LXYyIG5vdCB2YWxpZCcpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBydChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKCdGYWlsZWQgdG8gZGVjb2RlIGV1Y29uc2VudC12MiBjb29raWU6ICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgci5sYXN0VXBkYXRlZCAmJiByLmxhc3RVcGRhdGVkID4gdCAmJiAodCA9IHIubGFzdFVwZGF0ZWQsIG4gPSBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgfSwgc3QgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmKHRoaXMsIGUpLCB0aGlzLmNtcEFwaSA9IHZvaWQgMCwgdGhpcy5pc0luaXRpYWxpemVkID0gdm9pZCAwLCB0aGlzLmNvbmZpZyA9IHZvaWQgMCwgdGhpcy5NeUN1c3RvbUNvbW1hbmRzID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIgPSB3aW5kb3cuX190Y2ZhcGkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubGVuZ3RoICYmIHIuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgJiYgJ2luaXQnID09PSBlWzBdICYmIChuID0gZVszXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5pc0luaXRpYWxpemVkID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9ICd0aGlyZFBhcnR5U3RvcmFnZVR5cGUnIGluIG4uY29yZUNvbmZpZyA/IG4uY29yZUNvbmZpZy50aGlyZFBhcnR5U3RvcmFnZVR5cGUgOiAnaWZyYW1lJywgaSA9ICdjb25zZW50U2NvcGUnIGluIG4uY29yZUNvbmZpZyA/IG4uY29yZUNvbmZpZy5jb25zZW50U2NvcGUgOiAnc2VydmljZScsIHMgPSAnY29uc2VudFNjb3BlR3JvdXBVUkwnIGluIG4uY29yZUNvbmZpZyA/IG4uY29yZUNvbmZpZy5jb25zZW50U2NvcGVHcm91cFVSTCA6ICcnLCB1ID0gaS5pbmNsdWRlcygnc2VydmljZScpLCBsID0gaS5pbmNsdWRlcygnZ3JvdXAnKSwgcCA9IGwgJiYgJ2FwaScgPT09IG8sIGQgPSBsICYmICdpZnJhbWUnID09PSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCAmJiBzICYmICh6ZSA9IG5ldyBxZShuKSksIHRoaXMuTXlDdXN0b21Db21tYW5kcyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDb25maWc6IGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC5nZXRDb25maWcobiksIG8gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT09IHR5cGVvZiByICYmIChvID0gITApLCBlKHIsIG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Tm9uSUFCVmVuZG9yQ29uc2VudHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8sIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gMiwgdC5nZXROb25JQUJWZW5kb3JDb25zZW50cyhyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGUuc2VudCwgaSA9ICExLCAnb2JqZWN0JyA9PT0gdHlwZW9mIG8gJiYgKGkgPSAhMCksIG4obywgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5Q29uc2VudFVpOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0LmRpc3BsYXlDb25zZW50VWkoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRDb25zZW50SW5mbzogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUod2Uuc2V0Q29uc2VudHModCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0UHVibGlzaGVyUmVzdHJpY3Rpb246IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHdlLnNldFB1Ymxpc2hlclJlc3RyaWN0aW9uKHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmeVVpU3RhdGU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHdlLnVwZGF0ZUFwaVZpc2libGUodC5yZWd1bGF0aW9uLCB0LnZpc2libGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXQ6IGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHQuaW5pdChuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5hZGRHZXRUQ0RhdGFUb1N1cHBvcnRHb29nbGUobiwgdSwgcCwgZCksIHRoaXMuY21wQXBpID0gbmV3IGcuQ21wQXBpKDEwLCBMLCB1LCB0aGlzLk15Q3VzdG9tQ29tbWFuZHMpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdhZGRHZXRUQ0RhdGFUb1N1cHBvcnRHb29nbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYyhhLmEubWFyayhmdW5jdGlvbiBlKHQsIG4sIHIsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpLCBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9ICdnb29nbGVFbmFibGVkJyBpbiB0LmNvcmVDb25maWcgJiYgdC5jb3JlQ29uZmlnLmdvb2dsZUVuYWJsZWQsIG4gJiYgaSAmJiAocyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMoYS5hLm1hcmsoZnVuY3Rpb24gZSh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nICE9PSB0eXBlb2YgdCB8fCAnb2JqZWN0JyAhPT0gdHlwZW9mIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod2UuY29va2llVmFsdWVzLmZldGNoZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5uZXh0ID0gNCwgd2UuY29va2llVmFsdWVzLnByb21pc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gd2UuY29va2llVmFsdWVzLmdvb2dsZUNvb2tpZVZhbHVlLCBvID0gciA/IGllKHIpIDogdm9pZCAwLCBuLmFkZHRsQ29uc2VudCA9IG8sIHQobiwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgdGhpcy5NeUN1c3RvbUNvbW1hbmRzLmdldFRDRGF0YSA9IHMsIHRoaXMuTXlDdXN0b21Db21tYW5kcy5hZGRFdmVudExpc3RlbmVyID0gcywgdGhpcy5NeUN1c3RvbUNvbW1hbmRzLmdldEluQXBwVENEYXRhID0gcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkaXNwbGF5Q29uc2VudFVpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXZS5kaXNwbGF5VWkoJ0dEUFInLCAxLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdpbml0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pc0luaXRpYWxpemVkID8gY29uc29sZS53YXJuKCdpbml0IGhhcyBhbHJlYWR5IGJlZW4gY2FsbGVkIGFuZCBzaG91bGQgb25seSBiZSBydW4gb25lIHRpbWUuJykgOiAodGhpcy5pc0luaXRpYWxpemVkID0gITAsIHRoaXMuY29uZmlnIHx8ICh0aGlzLmNvbmZpZyA9IG5ldyBHKGUpLCB0aGlzLmNvbmZpZy5pbml0aWFsaXplQ29uZmlnKCkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAoSWUgPSBlKS5jb3JlQ29uZmlnLCBuID0gdC5jb25zZW50U2NvcGUsIHIgPSB0LnByaXZhY3lNb2RlLCBvID0gdC5wdWJsaXNoZXJDb3VudHJ5Q29kZSwgaSA9IHQuc2hvd1N1bW1hcnlWaWV3LCBzID0gdC5jb25zZW50SWRlbnRpdHlFbmFibGVkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2UgPSBuZXcgamUoKSwgT2UgPSBuZXcgWCgnaW5VUycpLCBBZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMoYS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSAnJywgZS5wcmV2ID0gMSwgZS5uZXh0ID0gNCwgd2UucmVndWxhdGlvblRvSW5pdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1VTUCcgPT09ICh0ID0gZS5zZW50KSB8fCByLmluY2x1ZGVzKCdVU1AnKSA/IGN0LmluaXRVc3AoKSA6IChuID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnZXRVU1BEYXRhJyA9PT0gZSAmJiAxID09PSB0ICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiBuICYmIG4oewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNwU3RyaW5nOiAnMS0tLScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgT2JqZWN0LmFzc2lnbih3aW5kb3csIHsgX191c3BhcGk6IG4gfSkpLCBlLm5leHQgPSAxMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXYgPSA4LCBlLnQwID0gZS5jYXRjaCgxKSwgY29uc29sZS5sb2coZS50MCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJydXB0KCdyZXR1cm4nLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIG51bGwsIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgTGUgPSBuZXcgZ2UoKSwgUGUgPSBuZXcgTWUoKSwgVGUgPSBuZXcgSGUoKSwga2UgPSBuZXcgRGUoKSwgVWUgPSBuZXcgWWUoKSwgeGUgPSBuZXcgJChzKSwgUmUgPSBuZXcgeWUoKSwgVmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBpLCBzLCB1LCBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID0gbi5pbmNsdWRlcygnc2VydmljZScpLCBzID0gci5pbmNsdWRlcygnR0RQUicpLCAoTmUgPSBuZXcgei5UQ01vZGVsKCkpLmNtcElkID0gMTAsIE5lLmNtcFZlcnNpb24gPSBMLCBzICYmIChOZS5wdWJsaXNoZXJDb3VudHJ5Q29kZSA9IG8pLCBpICYmIHMgJiYgKHUgPSBvZShJZSksIGMgPSB1LnB1cnBvc2VJZHMsIE5lLmlzU2VydmljZVNwZWNpZmljID0gITAsIGMuaW5jbHVkZXMoMSkgfHwgKCdERScgPT09IG8gPyBOZS5wdXJwb3NlT25lVHJlYXRtZW50ID0gITAgOiBjLnB1c2goMSkpKSwgZS5wcmV2ID0gNywgZS5uZXh0ID0gMTAsIHdlLmZldGNoQ29va2llVmFsdWVzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxNTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSAxMywgUGUuZmV0Y2hMaXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDE1LCBVZS5mZXRjaFBhcnRuZXJzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDE3LCB3ZS5mZXRjaERhdGFUb1JlcHJvbXB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodCA9IGUuc2VudCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDIxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDIxLCB3ZS5sb2FkR1ZMKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMjY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHJldiA9IDIzLCBlLnQwID0gZS5jYXRjaCg3KSwgY29uc29sZS5lcnJvcihlLnQwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hYnJ1cHQoJ3JldHVybicsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgbnVsbCwgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgcyAmJiB4ZS5zYXZlQ29uc2VudEZyb21SZWRpcmVjdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBWZSgpLCBmID0gQWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFByb21pc2UuYWxsKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYyhhLmEubWFyayhmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSBZKHQsIDIpLCByID0gblswXSwgbyA9IG5bMV0sICFzIHx8ICF4ZS5oYXNFZGl0Q29uc2VudFBhcmFtKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXZS5kaXNwbGF5VWkoJ0dEUFInLCAxLCAhMSksIGUubmV4dCA9IDE2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghciB8fCAnR0RQUicgIT09IG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDE1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSA5LCB4ZS5zaG91bGRSZWRpcmVjdEZvckNvbnNlbnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5zZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2UuZGlzcGxheVVpKCdHRFBSJywgaSA/IDAgOiAxLCAhMCksIGUubmV4dCA9IDE2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ZS51cGRhdGVBcGlWaXNpYmxlKG8sICExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0aGlzLmNvbmZpZykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Q29uZmlnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDogJ2FsbCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmNvbmZpZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYWxsJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlQ29uZmlnOiB0aGlzLmNvbmZpZy5jb3JlQ29uZmlnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlVWlMYWJlbHM6IHRoaXMuY29uZmlnLmNvcmVVaUxhYmVscywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlbWl1bVByb3BlcnRpZXM6IHRoaXMuY29uZmlnLnByZW1pdW1Qcm9wZXJ0aWVzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVtaXVtVWlMYWJlbHM6IHRoaXMuY29uZmlnLnByZW1pdW1VaUxhYmVscywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhlbWU6IHRoaXMuY29uZmlnLnRoZW1lCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ0NvcmUgQ29uZmlnJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb25maWcuY29yZUNvbmZpZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1ByZW1pdW0gUHJvcGVydGllcyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29uZmlnLnByZW1pdW1Qcm9wZXJ0aWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnQ29yZSBVSSBMYWJlbHMnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbmZpZy5jb3JlVWlMYWJlbHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdQcmVtaXVtIFVJIExhYmVscyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29uZmlnLnByZW1pdW1VaUxhYmVsczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1RoZW1lJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb25maWcudGhlbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gSmUodGhpcy5jb25maWcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0W2VdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oJyInLmNvbmNhdChlLCAnIjogd2FzIG5vdCBmb3VuZCBpbiBjb25maWdzJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKCdTaG91bGQgcnVuIGluaXQgYmVmb3JlIHJ1bm5pbmcgZ2V0Q29uZmlnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXRDb25maWdJbnN0YW5jZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29uZmlnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Tm9uSUFCVmVuZG9yQ29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYyhhLmEubWFyayhmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByLCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLmNvbmZpZyB8fCAobnVsbCA9PT0gKG4gPSB0aGlzLmNvbmZpZy5jb3JlQ29uZmlnLnByaXZhY3lNb2RlKSB8fCB2b2lkIDAgPT09IG4gPyB2b2lkIDAgOiBuLmluY2x1ZGVzKCdHRFBSJykpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyA9PT0gdHlwZW9mIHRoaXMuY29uZmlnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod2UuY29va2llVmFsdWVzLmZldGNoZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDYsIHdlLmNvb2tpZVZhbHVlcy5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciA9IHNlKFBlLmRlY29kZSwgd2UuY29va2llVmFsdWVzLm5vbklhYlZlbmRvckNvbnNlbnQpLCBvID0gbnVsbCwgciAmJiB0ID8gbyA9IGV0KHIudmVuZG9yQ29uc2VudHMsIHQpIDogciAmJiAobyA9IGkoe30sIHIudmVuZG9yQ29uc2VudHMpKSwgZS5hYnJ1cHQoJ3JldHVybicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByQXBwbGllczogWGUoT2UuaXNVc2VySW5FVSwgdGhpcy5jb25maWcuY29yZUNvbmZpZy5kaXNwbGF5VWkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc0dsb2JhbENvbnNlbnQ6ICRlKHRoaXMuY29uZmlnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNHbG9iYWxTY29wZTogJGUodGhpcy5jb25maWcpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGFkYXRhOiBvID8gTGUuZW5jb2RlKGkoaSh7fSwgciksIHt9LCB7IGNvb2tpZU5hbWU6ICdub25pYWJ2ZW5kb3Jjb25zZW50JyB9KSwgITApIDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25JYWJWZW5kb3JDb25zZW50czogbyB8fCBudWxsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCdDb25maWcgd2FzIG5vdCBmb3VuZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKSwgYXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmKHRoaXMsIGUpLCB0aGlzLl9fdXNwYXBpID0gdm9pZCAwLCB0aGlzLl91c3BWZXJzaW9uID0gMSwgdGhpcy5jaGVja0xvY2F0aW9uVG9TdG9wRXhlY3V0aW9uID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYyhhLmEubWFyayhmdW5jdGlvbiBlKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8sIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSAhMSwgbyA9IEllLmNvcmVDb25maWcudXNwSnVyaXNkaWN0aW9uLCBlLm5leHQgPSA0LCBPZS5jaGVja1NwZWNpZmljTG9jYXRpb24oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoaSA9IGUuc2VudCkgJiYgJ29iamVjdCcgPT09IHR5cGVvZiBpICYmIChpID0gaS5yZWdpb24udG9VcHBlckNhc2UoKSksIG8uaW5jbHVkZXMoaSkgfHwgKCdmdW5jdGlvbicgPT09IHR5cGVvZiBuICYmIG4oewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogdC5fdXNwVmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzcFN0cmluZzogJzEtLS0nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKSwgciA9ICEwKSwgZS5hYnJ1cHQoJ3JldHVybicsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgdGhpcy5fX3VzcGFwaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IDEsIHIgPSBhcmd1bWVudHMubGVuZ3RoID4gMiA/IGFyZ3VtZW50c1syXSA6IHZvaWQgMCwgbyA9IGFyZ3VtZW50cy5sZW5ndGggPiAzID8gYXJndW1lbnRzWzNdIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID09PSB0Ll91c3BWZXJzaW9uKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gbyA/IHRbZV0ociwgbykgOiB0W2VdKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoJ1RoZSBmdW5jdGlvbiAnLmNvbmNhdChlLCAnIGlzIG5vdCBkZWZpbmVkJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICh2b2lkIDAgPT09IHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbZV0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKCdUaGUgZnVuY3Rpb24gJy5jb25jYXQoZSwgJyBpcyBtaXNzaW5nIHJlcXVpcmVkIHBhcmFtZXRlcnMnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybignVGhlIHRoaXJkIHBhcmFtZXRlciBzaG91bGQgYmUgYSBjYWxsYmFjayBmb3IgdGhlICcuY29uY2F0KGUsICcgZnVuY3Rpb24nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oJ3RoaXMgY29tbWFuZCBpcyBvbmx5IGF2YWlsYWJsZSBmb3IgdXNwVmVyc2lvbiAxJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdpbml0VXNwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMuX191c3BhcGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5hc3NpZ24od2luZG93LCB7IF9fdXNwYXBpOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAndXNwUGluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSA4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDMsIE9lLmNoZWNrU3BlY2lmaWNMb2NhdGlvbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobiA9IGUuc2VudCkgJiYgJ29iamVjdCcgPT09IHR5cGVvZiBuICYmIChuID0gbi5yZWdpb24pLCB0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiBJZS5jb3JlQ29uZmlnLnByaXZhY3lNb2RlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGp1cmlzZGljdGlvbjogSWUuY29yZUNvbmZpZy51c3BKdXJpc2RpY3Rpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9jYXRpb246IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wTG9hZGVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApLCBlLm5leHQgPSA5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoJ1RoZSBjYWxsYmFjayBmdW5jdGlvbiBpcyBtaXNzaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0b3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXRVc3BEZnREYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMoYS5hLm1hcmsoZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nICE9PSB0eXBlb2YgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPSBUZS5nZXRDb29raWUoKSwgZS5uZXh0ID0gNCwgdGhpcy5jaGVja0xvY2F0aW9uVG9TdG9wRXhlY3V0aW9uKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUuc2VudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCA9IDc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hYnJ1cHQoJ3JldHVybicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyAhPT0gdHlwZW9mIG4gPyAociA9IFRlLmVuY29kZSh0aGlzLl91c3BWZXJzaW9uLCAhMSksIFRlLnNldENvb2tpZShyKSwgdCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogdGhpcy5fdXNwVmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c3BTdHJpbmc6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKSkgOiAobyA9IG4uc3BsaXQoJycpWzBdLCB0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzcFN0cmluZzogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApKSwgZS5uZXh0ID0gMTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoJ1RoZSBjYWxsYmFjayBmdW5jdGlvbiBpcyBtaXNzaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0VXNwRGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgPSAxMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByID0gVGUuZW5jb2RlKHRoaXMuX3VzcFZlcnNpb24sIG4pLCBlLm5leHQgPSA0LCB0aGlzLmNoZWNrTG9jYXRpb25Ub1N0b3BFeGVjdXRpb24odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5zZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gNzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnICE9PSB0eXBlb2YgciA/IHQobnVsbCwgITEpIDogKFRlLnNldENvb2tpZShyKSwgdCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogdGhpcy5fdXNwVmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c3BTdHJpbmc6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKSksIGUubmV4dCA9IDExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKCdUaGUgY2FsbGJhY2sgZnVuY3Rpb24gaXMgbWlzc2luZycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDExOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldFVTUERhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYyhhLmEubWFyayhmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYS53cmFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLnByZXYgPSBlLm5leHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT09IHR5cGVvZiB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gMTA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9IFRlLmdldENvb2tpZSgpLCBlLm5leHQgPSA0LCB0aGlzLmNoZWNrTG9jYXRpb25Ub1N0b3BFeGVjdXRpb24odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5zZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gNzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFicnVwdCgncmV0dXJuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2YgbiA/IChyID0gbi5zcGxpdCgnJylbMF0sIHQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNwU3RyaW5nOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMCkpIDogdChudWxsLCAhMSksIGUubmV4dCA9IDExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKCdUaGUgY2FsbGJhY2sgZnVuY3Rpb24gaXMgbWlzc2luZycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDExOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2Rpc3BsYXlVc3BVaScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjKGEuYS5tYXJrKGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIgPSBhcmd1bWVudHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hLndyYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9IHIubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IHJbMV0gPyByWzFdIDogMSwgZS5uZXh0ID0gMywgdGhpcy5jaGVja0xvY2F0aW9uVG9TdG9wRXhlY3V0aW9uKHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5zZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uZXh0ID0gNzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb25zb2xlLndhcm4oJ2Nhbm5vdCBkaXNwbGF5IFVTUCBVSSBvdXRzaWRlIG9mIGNvbmZpZ3VyZWQganVyaXNkaWN0aW9uKHMpJyksIGUuYWJydXB0KCdyZXR1cm4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSA9PT0gbiAmJiBXZS5kaXNwbGF5VWkoJ1VTUCcsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpLCB1dCA9IG5ldyBzdCgpLCBjdCA9IG5ldyBhdCgpOwogICAgICAgICAgICB9CiAgICAgICAgXSk7CiAgICB9KCkpCn0="},{"name":"sugarcoat-8a781a44c232f576b9148f440e69f1a64d74d543","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfNDQ4Yjk1YTQ3ZGQ0OWYwYSA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja180NDhiOTVhNDdkZDQ5ZjBhKTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgZnVuY3Rpb24gYihkLCBhKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHZhciBtID0gZC5mcmFtZXM7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChxKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAobSkgewogICAgICAgICAgICAgICAgICAgIChhID0gYSB8fCBbXSkucHVzaChkKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMDsgbSAmJiB0IDwgbS5sZW5ndGg7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgYihkLmZyYW1lc1t0XSwgYSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBhKGQsIGEsIG0pIHsKICAgICAgICAgICAgICAgIGQuYWRkRXZlbnRMaXN0ZW5lciA/IGQuYWRkRXZlbnRMaXN0ZW5lcihhLCBtLCAhMSkgOiBkLmF0dGFjaEV2ZW50ICYmIGQuYXR0YWNoRXZlbnQoJ29uJyArIGEsIG0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGsoZCwgYSwgbSkgewogICAgICAgICAgICAgICAgZC5yZW1vdmVFdmVudExpc3RlbmVyID8gZC5yZW1vdmVFdmVudExpc3RlbmVyKGEsIG0sICExKSA6IGQuZGV0YWNoRXZlbnQgJiYgZC5kZXRhY2hFdmVudCgnb24nICsgYSwgbSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24geChkKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IGQuZGF0YTsKICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2YgYSAmJiAoYSA9IEkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuSlNPTi5wYXJzZShhKTsKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIGEgJiYgKGEgPSBhLl9fdXNwYXBpUmV0dXJuIHx8IHt9KTsKICAgICAgICAgICAgICAgIGEgJiYgYS5zdWNjZXNzICYmIChrKHdpbmRvdywgJ21lc3NhZ2UnLCB4KSwgdyhhLnJldHVyblZhbHVlKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gdyhkKSB7CiAgICAgICAgICAgICAgICBkID0gdm9pZCAwID09PSBkID8ge30gOiBkOwogICAgICAgICAgICAgICAgZygnQWRmb3JtJywge30pLnVzX3ByaXZhY3kgPSBkLnVzcFN0cmluZzsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBIKGQsIGEsIG0pIHsKICAgICAgICAgICAgICAgIGEgPSB2b2lkIDAgPT09IGEgPyAxMDAwMCA6IGE7CiAgICAgICAgICAgICAgICBtID0gdm9pZCAwID09PSBtID8gITEgOiBtOwogICAgICAgICAgICAgICAgQSgpOwogICAgICAgICAgICAgICAgRyB8fCB3aW5kb3cuX190Y2ZhcGkgPyAobSA/IEUucHVzaChkKSA6IE4ucHVzaChkKSwgQygpLCBKKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEIoTiwgZCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBCKEUsIGQpCiAgICAgICAgICAgICAgICAgICAgICAgIF0sIG0gPSBnKCdBZGZvcm0nLCB7fSksIGIgPSBtLmdkcHIsIHQgPSBtLmdkcHJfY29uc2VudCwgZiA9IG0uYWRmb3JtX2NvbnNlbnQ7CiAgICAgICAgICAgICAgICAgICAgbSA9IG0udXNfcHJpdmFjeTsKICAgICAgICAgICAgICAgICAgICBpZiAoLTEgPCBhWzBdKQogICAgICAgICAgICAgICAgICAgICAgICBOLnNwbGljZShhWzBdLCAxKVswXSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2Rwcl9jb25zZW50OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRmb3JtX2NvbnNlbnQ6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c19wcml2YWN5OiBtCiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGlmICgtMSA8IGFbMV0pCiAgICAgICAgICAgICAgICAgICAgICAgIEUuc3BsaWNlKGFbMV0sIDEpWzBdKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdkcHI6IGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByX2NvbnNlbnQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGZvcm1fY29uc2VudDogZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzX3ByaXZhY3k6IG0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBhKSkgOiBkKG51bGwsICdDTVAgbm90IGZvdW5kLicpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEEoKSB7CiAgICAgICAgICAgICAgICBpZiAoIUcpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHQoJ19fdGNmYXBpTG9jYXRvcicpOwogICAgICAgICAgICAgICAgICAgIGQuZnJhbWVSZWYgJiYgKEcgPSBkLmZyYW1lUmVmLCBQID0gZC5pc0Nyb3NzRG9tYWluKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgY21wRnJhbWU6IEcsCiAgICAgICAgICAgICAgICAgICAgaXNDcm9zc0RvbWFpbjogUAogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBDKCkgewogICAgICAgICAgICAgICAgaWYgKFAgJiYgRyAmJiBHLnBvc3RNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB3aW5kb3cuX190Y2ZhcGk7CiAgICAgICAgICAgICAgICAgICAgayh3aW5kb3csICdtZXNzYWdlJywgeik7CiAgICAgICAgICAgICAgICAgICAgYSh3aW5kb3csICdtZXNzYWdlJywgeik7CiAgICAgICAgICAgICAgICAgICAgRy5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgICAgIF9fdGNmYXBpQ2FsbDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tbWFuZDogJ2FkZEV2ZW50TGlzdGVuZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbElkOiBWKysKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sICcqJyk7CiAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICBkID0gRyAmJiAhUCA/IEcuX190Y2ZhcGkgOiB3aW5kb3cuX190Y2ZhcGk7CiAgICAgICAgICAgICAgICBkICYmIEkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBkKCdhZGRFdmVudExpc3RlbmVyJywgbnVsbCwgbCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB6KGQpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gZC5kYXRhOwogICAgICAgICAgICAgICAgJ3N0cmluZycgPT09IHR5cGVvZiBhICYmIChhID0gSShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5KU09OLnBhcnNlKGEpOwogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgYSAmJiAoYSA9IChhLl9fdGNmYXBpUmV0dXJuIHx8IHt9KS5yZXR1cm5WYWx1ZSk7CiAgICAgICAgICAgICAgICBhICYmIG51bGwgIT0gYS5nZHByQXBwbGllcyAmJiAoZCA9IGEsIGwoewogICAgICAgICAgICAgICAgICAgIGdkcHJBcHBsaWVzOiBkLmdkcHJBcHBsaWVzLAogICAgICAgICAgICAgICAgICAgIHRjU3RyaW5nOiBkLnRjU3RyaW5nLAogICAgICAgICAgICAgICAgICAgIHB1cnBvc2U6IGQucHVycG9zZSwKICAgICAgICAgICAgICAgICAgICB2ZW5kb3I6IGQudmVuZG9yLAogICAgICAgICAgICAgICAgICAgIHJlc3RyaWN0aW9uczogZC5yZXN0cmljdGlvbnMsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRTdGF0dXM6IGQuZXZlbnRTdGF0dXMKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBsKGQpIHsKICAgICAgICAgICAgICAgIGQgPSB2b2lkIDAgPT09IGQgPyB7fSA6IGQ7CiAgICAgICAgICAgICAgICBpZiAoJ2NtcHVpc2hvd24nICE9PSBkLmV2ZW50U3RhdHVzKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBGKGQuZ2RwckFwcGxpZXMpLCBtID0gZygnQWRmb3JtJywge30pOwogICAgICAgICAgICAgICAgICAgIG0uZ2RwciA9IGE7CiAgICAgICAgICAgICAgICAgICAgbS5nZHByX2NvbnNlbnQgPSBkLnRjU3RyaW5nOwogICAgICAgICAgICAgICAgICAgIGlmIChhID0gISghZC5wdXJwb3NlIHx8ICFkLnZlbmRvcikgfHwgMCA9PT0gYSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBiLmdkcHJBcHBsaWVzOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGYoYiwgJ3B1cnBvc2UuY29uc2VudHMuMScsICExKSwgTSA9IGYoYiwgJ3ZlbmRvci5jb25zZW50cy41MCcsICExKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGYoYiwgJ3Jlc3RyaWN0aW9ucy4xLjUwJywgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSAwID09PSBGKGQpID8gITAgOiB0ICYmIE0gJiYgMCAhPT0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgbS5hZGZvcm1fY29uc2VudCA9IGQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGQgPSBtLmdkcHI7CiAgICAgICAgICAgICAgICAgICAgdCA9IG0uZ2Rwcl9jb25zZW50OwogICAgICAgICAgICAgICAgICAgIG0gPSBtLmFkZm9ybV9jb25zZW50OwogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IG0gJiYgYSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IEUubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEUuc2hpZnQoKSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2RwcjogZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByX2NvbnNlbnQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRmb3JtX2NvbnNlbnQ6IG0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGZvciAoOyBOLmxlbmd0aDspCiAgICAgICAgICAgICAgICAgICAgICAgIE4uc2hpZnQoKSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByOiBkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2Rwcl9jb25zZW50OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRmb3JtX2NvbnNlbnQ6IG0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gRihkKSB7CiAgICAgICAgICAgICAgICBpZiAoJzEnID09IGQpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgICAgICBpZiAoJzAnID09IGQpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gQihkLCBhKSB7CiAgICAgICAgICAgICAgICB2YXIgbSA9IGQubGVuZ3RoOwogICAgICAgICAgICAgICAgaWYgKGQuaW5kZXhPZikKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZC5pbmRleE9mKGEpOwogICAgICAgICAgICAgICAgZm9yICg7IG0tLSAmJiBkW21dICE9PSBhOyk7CiAgICAgICAgICAgICAgICByZXR1cm4gbTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBmKGQsIGEsIG0pIHsKICAgICAgICAgICAgICAgIGEgPSBhLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gMDsgYiA8IGEubGVuZ3RoOyBiKyspCiAgICAgICAgICAgICAgICAgICAgaWYgKGQgPSBkW2FbYl1dLCB2b2lkIDAgPT09IGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBnID0gZnVuY3Rpb24gKGQsIGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbSwgdCwgZiA9IGIod2luZG93LnRvcCk7CiAgICAgICAgICAgICAgICAgICAgZm9yIChtID0gZi5sZW5ndGg7IG0tLTspCiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHQgPSBmW21dKSAmJiAodCA9IHRbZF0pICYmICh0ID0gdC5zaGFyZWQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93W2RdLnNoYXJlZCA9IGE7CiAgICAgICAgICAgICAgICB9LCBJID0gZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCgpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHkpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCB0ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBtLCBiLCB0ID0gd2luZG93OyB0OykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoSShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZnJhbWVzW2FdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPT09IGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQucGFyZW50OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBtICYmIChiID0gIUkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFtLmRvY3VtZW50LmdldEVsZW1lbnRCeUlkOwogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICBmcmFtZVJlZjogbSwKICAgICAgICAgICAgICAgICAgICAgICAgaXNDcm9zc0RvbWFpbjogYgogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBkID0gd2luZG93LnRvcDsKICAgICAgICAgICAgd2luZG93LkFkZm9ybSA9IHdpbmRvdy5BZGZvcm0gfHwge307CiAgICAgICAgICAgIHZhciBtID0gd2luZG93Ll9fdXNwYXBpLCBNID0gdCgnX191c3BhcGlMb2NhdG9yJyksIEsgPSBNLmZyYW1lUmVmOwogICAgICAgICAgICAoTSA9IE0uaXNDcm9zc0RvbWFpbikgJiYgSyAmJiBLLnBvc3RNZXNzYWdlID8gKGEod2luZG93LCAnbWVzc2FnZScsIHgpLCBLLnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIF9fdXNwYXBpQ2FsbDogewogICAgICAgICAgICAgICAgICAgIGNvbW1hbmQ6ICdnZXRVU1BEYXRhJywKICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiAxLAogICAgICAgICAgICAgICAgICAgIGNhbGxJZDogMQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LCAnKicpKSA6IEsgJiYgIU0gJiYgSy5fX3VzcGFwaSAmJiAobSA9IEsuX191c3BhcGkpOwogICAgICAgICAgICBtICYmIEkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIG0oJ2dldFVTUERhdGEnLCAxLCB3KTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBKID0gd2luZG93LnNldFRpbWVvdXQsIEcsIFAsIFYgPSAxLCBOID0gW10sIEUgPSBbXTsKICAgICAgICAgICAgSyA9IHdpbmRvdy5BZGZvcm0gPSB3aW5kb3cuQWRmb3JtIHx8IHt9OwogICAgICAgICAgICBLLmdldENvbnNlbnQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBDKCk7CiAgICAgICAgICAgICAgICB2YXIgZCA9IGcoJ0FkZm9ybScsIHt9KTsKICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgZ2RwcjogZC5nZHByLAogICAgICAgICAgICAgICAgICAgIGdkcHJfY29uc2VudDogZC5nZHByX2NvbnNlbnQsCiAgICAgICAgICAgICAgICAgICAgdXNfcHJpdmFjeTogZC51c19wcml2YWN5CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICBLLndhaXRGb3JDb25zZW50ID0gSDsKICAgICAgICAgICAgSy5oYXNDb25zZW50ID0gZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgIEgoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBkKG51bGwgPT09IGEgPyAhMCA6IGEuYWRmb3JtX2NvbnNlbnQpOwogICAgICAgICAgICAgICAgfSwgMTAwMDAsICEwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSy5nZXRVU1BTdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZygnQWRmb3JtJywge30pLnVzX3ByaXZhY3k7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEEoKTsKICAgICAgICAgICAgZygnQWRmb3JtJywge30pOwogICAgICAgICAgICBDKCk7CiAgICAgICAgfSgpKTsKICAgICAgICAoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgdmFyIGEgPSBiLkFkZm9ybSA9IGIuQWRmb3JtIHx8IHt9LCBrID0gewogICAgICAgICAgICAgICAgICAgICdcXCc6ICdcXFxcJywKICAgICAgICAgICAgICAgICAgICAnXGInOiAnXFxiJywKICAgICAgICAgICAgICAgICAgICAnXHQnOiAnXFx0JywKICAgICAgICAgICAgICAgICAgICAnXG4nOiAnXFxuJywKICAgICAgICAgICAgICAgICAgICAnXGYnOiAnXFxmJywKICAgICAgICAgICAgICAgICAgICAnXHInOiAnXFxyJywKICAgICAgICAgICAgICAgICAgICAnIic6ICdcXCInCiAgICAgICAgICAgICAgICB9LCB4ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9ICcnOwogICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PT0gdHlwZW9mIGEgJiYgbnVsbCAhPSBhICYmIDAgPCBhLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdyA9IDA7IHcgPCBhLmxlbmd0aDsgdysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgeCA9IGEuY2hhckF0KHcpLCB6ID0ga1t4XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSAnc3RyaW5nJyA9PT0gdHlwZW9mIHogPyBiICsgeiA6IGIgKyB4OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBhLkpTT04gPSB7fTsKICAgICAgICAgICAgYS5KU09OLnN0cmluZ2lmeSA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICB2YXIgayA9IHR5cGVvZiBiOwogICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnICE9IGsgfHwgbnVsbCA9PT0gYikKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gayAmJiAoYiA9ICciJyArIHgoYikgKyAnIicpLCBTdHJpbmcoYik7CiAgICAgICAgICAgICAgICB2YXIgdywgQyA9IFtdLCB6ID0gYiAmJiBiLmNvbnN0cnVjdG9yID09IEFycmF5OwogICAgICAgICAgICAgICAgZm9yICh3IGluIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGJbd107CiAgICAgICAgICAgICAgICAgICAgayA9IHR5cGVvZiBsOwogICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnICE9IGsgJiYgJ2Z1bmN0aW9uJyAhPSBrICYmIGIuaGFzT3duUHJvcGVydHkodykgJiYgKCdzdHJpbmcnID09IGsgPyBsID0gJyInICsgeChsKSArICciJyA6ICdvYmplY3QnID09IGsgJiYgbnVsbCAhPT0gbCAmJiAobCA9IGEuSlNPTi5zdHJpbmdpZnkobCkpLCBDLnB1c2goKHogPyAnJyA6ICciJyArIHcgKyAnIjonKSArIFN0cmluZyhsKSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuICh6ID8gJ1snIDogJ3snKSArIFN0cmluZyhDKSArICh6ID8gJ10nIDogJ30nKTsKICAgICAgICAgICAgfTsKICAgICAgICB9KHdpbmRvdykpOwogICAgICAgIHdpbmRvdy5BZGZvcm0gPSB3aW5kb3cuQWRmb3JtIHx8IHt9OwogICAgICAgIEFkZm9ybS5DcnlwdG9KUyA9IEFkZm9ybS5DcnlwdG9KUyB8fCBmdW5jdGlvbiAoYiwgYSkgewogICAgICAgICAgICB2YXIgayA9IHt9LCB4ID0gay5saWIgPSB7fSwgdyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH0sIEggPSB4LkJhc2UgPSB7CiAgICAgICAgICAgICAgICAgICAgZXh0ZW5kOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICB3LnByb3RvdHlwZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IHcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiBiLm1peEluKGEpOwogICAgICAgICAgICAgICAgICAgICAgICBiLmhhc093blByb3BlcnR5KCdpbml0JykgfHwgKGIuaW5pdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuJHN1cGVyLmluaXQuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGIuaW5pdC5wcm90b3R5cGUgPSBiOwogICAgICAgICAgICAgICAgICAgICAgICBiLiRzdXBlciA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgY3JlYXRlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5leHRlbmQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYS5pbml0LmFwcGx5KGEsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaW5pdDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgbWl4SW46IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGIgaW4gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuaGFzT3duUHJvcGVydHkoYikgJiYgKHRoaXNbYl0gPSBhW2JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgYS5oYXNPd25Qcm9wZXJ0eSgndG9TdHJpbmcnKSAmJiAodGhpcy50b1N0cmluZyA9IGEudG9TdHJpbmcpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgY2xvbmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaW5pdC5wcm90b3R5cGUuZXh0ZW5kKHRoaXMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIEEgPSB4LldvcmRBcnJheSA9IEguZXh0ZW5kKHsKICAgICAgICAgICAgICAgICAgICBpbml0OiBmdW5jdGlvbiAoYiwgZikgewogICAgICAgICAgICAgICAgICAgICAgICBiID0gdGhpcy53b3JkcyA9IGIgfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2lnQnl0ZXMgPSBmICE9IGEgPyBmIDogNCAqIGIubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgdG9TdHJpbmc6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoYSB8fCB6KS5zdHJpbmdpZnkodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBjb25jYXQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gdGhpcy53b3JkcywgZiA9IGEud29yZHMsIGQgPSB0aGlzLnNpZ0J5dGVzOwogICAgICAgICAgICAgICAgICAgICAgICBhID0gYS5zaWdCeXRlczsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jbGFtcCgpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCAlIDQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBnID0gMDsgZyA8IGE7IGcrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiW2QgKyBnID4+PiAyXSB8PSAoZltnID4+PiAyXSA+Pj4gMjQgLSBnICUgNCAqIDggJiAyNTUpIDw8IDI0IC0gKGQgKyBnKSAlIDQgKiA4OwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICg2NTUzNSA8IGYubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChnID0gMDsgZyA8IGE7IGcgKz0gNCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiW2QgKyBnID4+PiAyXSA9IGZbZyA+Pj4gMl07CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIucHVzaC5hcHBseShiLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zaWdCeXRlcyArPSBhOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGNsYW1wOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy53b3JkcywgZiA9IHRoaXMuc2lnQnl0ZXM7CiAgICAgICAgICAgICAgICAgICAgICAgIGFbZiA+Pj4gMl0gJj0gNDI5NDk2NzI5NSA8PCAzMiAtIGYgJSA0ICogODsKICAgICAgICAgICAgICAgICAgICAgICAgYS5sZW5ndGggPSBiLmNlaWwoZiAvIDQpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgY2xvbmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBILmNsb25lLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEud29yZHMgPSB0aGlzLndvcmRzLnNsaWNlKDApOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHJhbmRvbTogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiA9IFtdLCBnID0gMDsgZyA8IGE7IGcgKz0gNCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYucHVzaCg0Mjk0OTY3Mjk2ICogYi5yYW5kb20oKSB8IDApOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEEuaW5pdChmLCBhKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgQyA9IGsuZW5jID0ge30sIHogPSBDLkhleCA9IHsKICAgICAgICAgICAgICAgICAgICBzdHJpbmdpZnk6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gYS53b3JkczsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEuc2lnQnl0ZXM7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSBbXSwgZCA9IDA7IGQgPCBhOyBkKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gYltkID4+PiAyXSA+Pj4gMjQgLSBkICUgNCAqIDggJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnB1c2goKGcgPj4+IDQpLnRvU3RyaW5nKDE2KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnB1c2goKGcgJiAxNSkudG9TdHJpbmcoMTYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZi5qb2luKCcnKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHBhcnNlOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gYS5sZW5ndGgsIGYgPSBbXSwgZCA9IDA7IGQgPCBiOyBkICs9IDIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmW2QgPj4+IDNdIHw9IHBhcnNlSW50KGEuc3Vic3RyKGQsIDIpLCAxNikgPDwgMjQgLSBkICUgOCAqIDQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQS5pbml0KGYsIGIgLyAyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBsID0gQy5MYXRpbjEgPSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5naWZ5OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEud29yZHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLnNpZ0J5dGVzOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBmID0gW10sIGQgPSAwOyBkIDwgYTsgZCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5wdXNoKFN0cmluZy5mcm9tQ2hhckNvZGUoYltkID4+PiAyXSA+Pj4gMjQgLSBkICUgNCAqIDggJiAyNTUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYuam9pbignJyk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBwYXJzZTogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IGEubGVuZ3RoLCBmID0gW10sIGQgPSAwOyBkIDwgYjsgZCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZltkID4+PiAyXSB8PSAoYS5jaGFyQ29kZUF0KGQpICYgMjU1KSA8PCAyNCAtIGQgJSA0ICogODsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBBLmluaXQoZiwgYik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgRiA9IEMuVXRmOCA9IHsKICAgICAgICAgICAgICAgICAgICBzdHJpbmdpZnk6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGVjb2RlVVJJQ29tcG9uZW50KGVzY2FwZShsLnN0cmluZ2lmeShhKSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChJKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignTWFsZm9ybWVkIFVURi04IGRhdGEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcGFyc2U6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsLnBhcnNlKHVuZXNjYXBlKGVuY29kZVVSSUNvbXBvbmVudChhKSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIEIgPSB4LkJ1ZmZlcmVkQmxvY2tBbGdvcml0aG0gPSBILmV4dGVuZCh7CiAgICAgICAgICAgICAgICAgICAgcmVzZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fZGF0YSA9IG5ldyBBLmluaXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fbkRhdGFCeXRlcyA9IDA7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBfYXBwZW5kOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PSB0eXBlb2YgYSAmJiAoYSA9IEYucGFyc2UoYSkpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9kYXRhLmNvbmNhdChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fbkRhdGFCeXRlcyArPSBhLnNpZ0J5dGVzOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgX3Byb2Nlc3M6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gdGhpcy5fZGF0YSwgZyA9IGYud29yZHMsIGQgPSBmLnNpZ0J5dGVzLCBtID0gdGhpcy5ibG9ja1NpemUsIGsgPSBkIC8gKDQgKiBtKTsKICAgICAgICAgICAgICAgICAgICAgICAgayA9IGEgPyBiLmNlaWwoaykgOiBiLm1heCgoayB8IDApIC0gdGhpcy5fbWluQnVmZmVyU2l6ZSwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBrICogbTsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGIubWluKDQgKiBhLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGwgPSAwOyBsIDwgYTsgbCArPSBtKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2RvUHJvY2Vzc0Jsb2NrKGcsIGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGcuc3BsaWNlKDAsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5zaWdCeXRlcyAtPSBkOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQS5pbml0KGwsIGQpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgY2xvbmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBILmNsb25lLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuX2RhdGEgPSB0aGlzLl9kYXRhLmNsb25lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgX21pbkJ1ZmZlclNpemU6IDAKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB4Lkhhc2hlciA9IEIuZXh0ZW5kKHsKICAgICAgICAgICAgICAgIGNmZzogSC5leHRlbmQoKSwKICAgICAgICAgICAgICAgIGluaXQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5jZmcgPSB0aGlzLmNmZy5leHRlbmQoYSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZXNldCgpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHJlc2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgQi5yZXNldC5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuX2RvUmVzZXQoKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB1cGRhdGU6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5fYXBwZW5kKGEpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuX3Byb2Nlc3MoKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBmaW5hbGl6ZTogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBhICYmIHRoaXMuX2FwcGVuZChhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZG9GaW5hbGl6ZSgpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGJsb2NrU2l6ZTogMTYsCiAgICAgICAgICAgICAgICBfY3JlYXRlSGVscGVyOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYiwgZikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGEuaW5pdChmKS5maW5hbGl6ZShiKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIF9jcmVhdGVIbWFjSGVscGVyOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYiwgZykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGYuSE1BQy5pbml0KGEsIGcpLmZpbmFsaXplKGIpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgZiA9IGsuYWxnbyA9IHt9OwogICAgICAgICAgICByZXR1cm4gazsKICAgICAgICB9KE1hdGgpOwogICAgICAgIChmdW5jdGlvbiAoYikgewogICAgICAgICAgICBmdW5jdGlvbiBhKGEsIGIsIGcsIGssIGwsIGQsIG0pIHsKICAgICAgICAgICAgICAgIGEgPSBhICsgKGIgJiBnIHwgfmIgJiBrKSArIGwgKyBtOwogICAgICAgICAgICAgICAgcmV0dXJuIChhIDw8IGQgfCBhID4+PiAzMiAtIGQpICsgYjsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBrKGEsIGIsIGcsIGssIGwsIGQsIG0pIHsKICAgICAgICAgICAgICAgIGEgPSBhICsgKGIgJiBrIHwgZyAmIH5rKSArIGwgKyBtOwogICAgICAgICAgICAgICAgcmV0dXJuIChhIDw8IGQgfCBhID4+PiAzMiAtIGQpICsgYjsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB4KGEsIGIsIGcsIGssIGwsIGQsIG0pIHsKICAgICAgICAgICAgICAgIGEgPSBhICsgKGIgXiBnIF4gaykgKyBsICsgbTsKICAgICAgICAgICAgICAgIHJldHVybiAoYSA8PCBkIHwgYSA+Pj4gMzIgLSBkKSArIGI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gdyhhLCBiLCBnLCBrLCBsLCBkLCBtKSB7CiAgICAgICAgICAgICAgICBhID0gYSArIChnIF4gKGIgfCB+aykpICsgbCArIG07CiAgICAgICAgICAgICAgICByZXR1cm4gKGEgPDwgZCB8IGEgPj4+IDMyIC0gZCkgKyBiOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBIID0gQWRmb3JtLkNyeXB0b0pTLCBBID0gSC5saWIsIEMgPSBBLldvcmRBcnJheSwgeiA9IEEuSGFzaGVyOwogICAgICAgICAgICBBID0gSC5hbGdvOwogICAgICAgICAgICBmb3IgKHZhciBsID0gW10sIEYgPSAwOyA2NCA+IEY7IEYrKykKICAgICAgICAgICAgICAgIGxbRl0gPSA0Mjk0OTY3Mjk2ICogYi5hYnMoYi5zaW4oRiArIDEpKSB8IDA7CiAgICAgICAgICAgIEEgPSBBLk1ENSA9IHouZXh0ZW5kKHsKICAgICAgICAgICAgICAgIF9kb1Jlc2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5faGFzaCA9IG5ldyBDLmluaXQoWwogICAgICAgICAgICAgICAgICAgICAgICAxNzMyNTg0MTkzLAogICAgICAgICAgICAgICAgICAgICAgICA0MDIzMjMzNDE3LAogICAgICAgICAgICAgICAgICAgICAgICAyNTYyMzgzMTAyLAogICAgICAgICAgICAgICAgICAgICAgICAyNzE3MzM4NzgKICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBfZG9Qcm9jZXNzQmxvY2s6IGZ1bmN0aW9uIChiLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyA9IDA7IDE2ID4gZzsgZysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBJID0gZiArIGcsIHQgPSBiW0ldOwogICAgICAgICAgICAgICAgICAgICAgICBiW0ldID0gKHQgPDwgOCB8IHQgPj4+IDI0KSAmIDE2NzExOTM1IHwgKHQgPDwgMjQgfCB0ID4+PiA4KSAmIDQyNzgyNTUzNjA7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGcgPSB0aGlzLl9oYXNoLndvcmRzOwogICAgICAgICAgICAgICAgICAgIEkgPSBiW2YgKyAwXTsKICAgICAgICAgICAgICAgICAgICB0ID0gYltmICsgMV07CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBiW2YgKyAyXSwgbSA9IGJbZiArIDNdLCBBID0gYltmICsgNF0sIEIgPSBiW2YgKyA1XSwgeiA9IGJbZiArIDZdLCBHID0gYltmICsgN10sIEMgPSBiW2YgKyA4XSwgRiA9IGJbZiArIDldLCBIID0gYltmICsgMTBdLCBFID0gYltmICsgMTFdLCBMID0gYltmICsgMTJdLCB5ID0gYltmICsgMTNdLCBPID0gYltmICsgMTRdOwogICAgICAgICAgICAgICAgICAgIGIgPSBiW2YgKyAxNV07CiAgICAgICAgICAgICAgICAgICAgZiA9IGdbMF07CiAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBnWzFdLCBxID0gZ1syXSwgciA9IGdbM107CiAgICAgICAgICAgICAgICAgICAgZiA9IGEoZiwgcCwgcSwgciwgSSwgNywgbFswXSk7CiAgICAgICAgICAgICAgICAgICAgciA9IGEociwgZiwgcCwgcSwgdCwgMTIsIGxbMV0pOwogICAgICAgICAgICAgICAgICAgIHEgPSBhKHEsIHIsIGYsIHAsIGQsIDE3LCBsWzJdKTsKICAgICAgICAgICAgICAgICAgICBwID0gYShwLCBxLCByLCBmLCBtLCAyMiwgbFszXSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IGEoZiwgcCwgcSwgciwgQSwgNywgbFs0XSk7CiAgICAgICAgICAgICAgICAgICAgciA9IGEociwgZiwgcCwgcSwgQiwgMTIsIGxbNV0pOwogICAgICAgICAgICAgICAgICAgIHEgPSBhKHEsIHIsIGYsIHAsIHosIDE3LCBsWzZdKTsKICAgICAgICAgICAgICAgICAgICBwID0gYShwLCBxLCByLCBmLCBHLCAyMiwgbFs3XSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IGEoZiwgcCwgcSwgciwgQywgNywgbFs4XSk7CiAgICAgICAgICAgICAgICAgICAgciA9IGEociwgZiwgcCwgcSwgRiwgMTIsIGxbOV0pOwogICAgICAgICAgICAgICAgICAgIHEgPSBhKHEsIHIsIGYsIHAsIEgsIDE3LCBsWzEwXSk7CiAgICAgICAgICAgICAgICAgICAgcCA9IGEocCwgcSwgciwgZiwgRSwgMjIsIGxbMTFdKTsKICAgICAgICAgICAgICAgICAgICBmID0gYShmLCBwLCBxLCByLCBMLCA3LCBsWzEyXSk7CiAgICAgICAgICAgICAgICAgICAgciA9IGEociwgZiwgcCwgcSwgeSwgMTIsIGxbMTNdKTsKICAgICAgICAgICAgICAgICAgICBxID0gYShxLCByLCBmLCBwLCBPLCAxNywgbFsxNF0pOwogICAgICAgICAgICAgICAgICAgIHAgPSBhKHAsIHEsIHIsIGYsIGIsIDIyLCBsWzE1XSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IGsoZiwgcCwgcSwgciwgdCwgNSwgbFsxNl0pOwogICAgICAgICAgICAgICAgICAgIHIgPSBrKHIsIGYsIHAsIHEsIHosIDksIGxbMTddKTsKICAgICAgICAgICAgICAgICAgICBxID0gayhxLCByLCBmLCBwLCBFLCAxNCwgbFsxOF0pOwogICAgICAgICAgICAgICAgICAgIHAgPSBrKHAsIHEsIHIsIGYsIEksIDIwLCBsWzE5XSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IGsoZiwgcCwgcSwgciwgQiwgNSwgbFsyMF0pOwogICAgICAgICAgICAgICAgICAgIHIgPSBrKHIsIGYsIHAsIHEsIEgsIDksIGxbMjFdKTsKICAgICAgICAgICAgICAgICAgICBxID0gayhxLCByLCBmLCBwLCBiLCAxNCwgbFsyMl0pOwogICAgICAgICAgICAgICAgICAgIHAgPSBrKHAsIHEsIHIsIGYsIEEsIDIwLCBsWzIzXSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IGsoZiwgcCwgcSwgciwgRiwgNSwgbFsyNF0pOwogICAgICAgICAgICAgICAgICAgIHIgPSBrKHIsIGYsIHAsIHEsIE8sIDksIGxbMjVdKTsKICAgICAgICAgICAgICAgICAgICBxID0gayhxLCByLCBmLCBwLCBtLCAxNCwgbFsyNl0pOwogICAgICAgICAgICAgICAgICAgIHAgPSBrKHAsIHEsIHIsIGYsIEMsIDIwLCBsWzI3XSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IGsoZiwgcCwgcSwgciwgeSwgNSwgbFsyOF0pOwogICAgICAgICAgICAgICAgICAgIHIgPSBrKHIsIGYsIHAsIHEsIGQsIDksIGxbMjldKTsKICAgICAgICAgICAgICAgICAgICBxID0gayhxLCByLCBmLCBwLCBHLCAxNCwgbFszMF0pOwogICAgICAgICAgICAgICAgICAgIHAgPSBrKHAsIHEsIHIsIGYsIEwsIDIwLCBsWzMxXSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IHgoZiwgcCwgcSwgciwgQiwgNCwgbFszMl0pOwogICAgICAgICAgICAgICAgICAgIHIgPSB4KHIsIGYsIHAsIHEsIEMsIDExLCBsWzMzXSk7CiAgICAgICAgICAgICAgICAgICAgcSA9IHgocSwgciwgZiwgcCwgRSwgMTYsIGxbMzRdKTsKICAgICAgICAgICAgICAgICAgICBwID0geChwLCBxLCByLCBmLCBPLCAyMywgbFszNV0pOwogICAgICAgICAgICAgICAgICAgIGYgPSB4KGYsIHAsIHEsIHIsIHQsIDQsIGxbMzZdKTsKICAgICAgICAgICAgICAgICAgICByID0geChyLCBmLCBwLCBxLCBBLCAxMSwgbFszN10pOwogICAgICAgICAgICAgICAgICAgIHEgPSB4KHEsIHIsIGYsIHAsIEcsIDE2LCBsWzM4XSk7CiAgICAgICAgICAgICAgICAgICAgcCA9IHgocCwgcSwgciwgZiwgSCwgMjMsIGxbMzldKTsKICAgICAgICAgICAgICAgICAgICBmID0geChmLCBwLCBxLCByLCB5LCA0LCBsWzQwXSk7CiAgICAgICAgICAgICAgICAgICAgciA9IHgociwgZiwgcCwgcSwgSSwgMTEsIGxbNDFdKTsKICAgICAgICAgICAgICAgICAgICBxID0geChxLCByLCBmLCBwLCBtLCAxNiwgbFs0Ml0pOwogICAgICAgICAgICAgICAgICAgIHAgPSB4KHAsIHEsIHIsIGYsIHosIDIzLCBsWzQzXSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IHgoZiwgcCwgcSwgciwgRiwgNCwgbFs0NF0pOwogICAgICAgICAgICAgICAgICAgIHIgPSB4KHIsIGYsIHAsIHEsIEwsIDExLCBsWzQ1XSk7CiAgICAgICAgICAgICAgICAgICAgcSA9IHgocSwgciwgZiwgcCwgYiwgMTYsIGxbNDZdKTsKICAgICAgICAgICAgICAgICAgICBwID0geChwLCBxLCByLCBmLCBkLCAyMywgbFs0N10pOwogICAgICAgICAgICAgICAgICAgIGYgPSB3KGYsIHAsIHEsIHIsIEksIDYsIGxbNDhdKTsKICAgICAgICAgICAgICAgICAgICByID0gdyhyLCBmLCBwLCBxLCBHLCAxMCwgbFs0OV0pOwogICAgICAgICAgICAgICAgICAgIHEgPSB3KHEsIHIsIGYsIHAsIE8sIDE1LCBsWzUwXSk7CiAgICAgICAgICAgICAgICAgICAgcCA9IHcocCwgcSwgciwgZiwgQiwgMjEsIGxbNTFdKTsKICAgICAgICAgICAgICAgICAgICBmID0gdyhmLCBwLCBxLCByLCBMLCA2LCBsWzUyXSk7CiAgICAgICAgICAgICAgICAgICAgciA9IHcociwgZiwgcCwgcSwgbSwgMTAsIGxbNTNdKTsKICAgICAgICAgICAgICAgICAgICBxID0gdyhxLCByLCBmLCBwLCBILCAxNSwgbFs1NF0pOwogICAgICAgICAgICAgICAgICAgIHAgPSB3KHAsIHEsIHIsIGYsIHQsIDIxLCBsWzU1XSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IHcoZiwgcCwgcSwgciwgQywgNiwgbFs1Nl0pOwogICAgICAgICAgICAgICAgICAgIHIgPSB3KHIsIGYsIHAsIHEsIGIsIDEwLCBsWzU3XSk7CiAgICAgICAgICAgICAgICAgICAgcSA9IHcocSwgciwgZiwgcCwgeiwgMTUsIGxbNThdKTsKICAgICAgICAgICAgICAgICAgICBwID0gdyhwLCBxLCByLCBmLCB5LCAyMSwgbFs1OV0pOwogICAgICAgICAgICAgICAgICAgIGYgPSB3KGYsIHAsIHEsIHIsIEEsIDYsIGxbNjBdKTsKICAgICAgICAgICAgICAgICAgICByID0gdyhyLCBmLCBwLCBxLCBFLCAxMCwgbFs2MV0pOwogICAgICAgICAgICAgICAgICAgIHEgPSB3KHEsIHIsIGYsIHAsIGQsIDE1LCBsWzYyXSk7CiAgICAgICAgICAgICAgICAgICAgcCA9IHcocCwgcSwgciwgZiwgRiwgMjEsIGxbNjNdKTsKICAgICAgICAgICAgICAgICAgICBnWzBdID0gZ1swXSArIGYgfCAwOwogICAgICAgICAgICAgICAgICAgIGdbMV0gPSBnWzFdICsgcCB8IDA7CiAgICAgICAgICAgICAgICAgICAgZ1syXSA9IGdbMl0gKyBxIHwgMDsKICAgICAgICAgICAgICAgICAgICBnWzNdID0gZ1szXSArIHIgfCAwOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIF9kb0ZpbmFsaXplOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLl9kYXRhLCBmID0gYS53b3JkcywgZyA9IDggKiB0aGlzLl9uRGF0YUJ5dGVzLCBrID0gOCAqIGEuc2lnQnl0ZXM7CiAgICAgICAgICAgICAgICAgICAgZltrID4+PiA1XSB8PSAxMjggPDwgMjQgLSBrICUgMzI7CiAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBiLmZsb29yKGcgLyA0Mjk0OTY3Mjk2KTsKICAgICAgICAgICAgICAgICAgICBmWyhrICsgNjQgPj4+IDkgPDwgNCkgKyAxNV0gPSAobCA8PCA4IHwgbCA+Pj4gMjQpICYgMTY3MTE5MzUgfCAobCA8PCAyNCB8IGwgPj4+IDgpICYgNDI3ODI1NTM2MDsKICAgICAgICAgICAgICAgICAgICBmWyhrICsgNjQgPj4+IDkgPDwgNCkgKyAxNF0gPSAoZyA8PCA4IHwgZyA+Pj4gMjQpICYgMTY3MTE5MzUgfCAoZyA8PCAyNCB8IGcgPj4+IDgpICYgNDI3ODI1NTM2MDsKICAgICAgICAgICAgICAgICAgICBhLnNpZ0J5dGVzID0gNCAqIChmLmxlbmd0aCArIDEpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuX3Byb2Nlc3MoKTsKICAgICAgICAgICAgICAgICAgICBhID0gdGhpcy5faGFzaDsKICAgICAgICAgICAgICAgICAgICBmID0gYS53b3JkczsKICAgICAgICAgICAgICAgICAgICBmb3IgKGcgPSAwOyA0ID4gZzsgZysrKQogICAgICAgICAgICAgICAgICAgICAgICBrID0gZltnXSwgZltnXSA9IChrIDw8IDggfCBrID4+PiAyNCkgJiAxNjcxMTkzNSB8IChrIDw8IDI0IHwgayA+Pj4gOCkgJiA0Mjc4MjU1MzYwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGNsb25lOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB6LmNsb25lLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgYS5faGFzaCA9IHRoaXMuX2hhc2guY2xvbmUoKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIEguTUQ1ID0gei5fY3JlYXRlSGVscGVyKEEpOwogICAgICAgICAgICBILkhtYWNNRDUgPSB6Ll9jcmVhdGVIbWFjSGVscGVyKEEpOwogICAgICAgIH0oTWF0aCkpOwogICAgICAgIChmdW5jdGlvbiAoYikgewogICAgICAgICAgICB2YXIgYSA9IEFkZm9ybS5DcnlwdG9KUywgayA9IGEubGliLCB4ID0gay5Xb3JkQXJyYXksIHcgPSBrLkhhc2hlcjsKICAgICAgICAgICAgayA9IGEuYWxnbzsKICAgICAgICAgICAgZm9yICh2YXIgSCA9IFtdLCBBID0gW10sIEMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gNDI5NDk2NzI5NiAqIChhIC0gKGEgfCAwKSkgfCAwOwogICAgICAgICAgICAgICAgICAgIH0sIHogPSAyLCBsID0gMDsgNjQgPiBsOykgewogICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgIHZhciBGID0gejsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBCID0gYi5zcXJ0KEYpLCBmID0gMjsgZiA8PSBCOyBmKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKEYgJSBmKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgRiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIEYgPSAhMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIEYgJiYgKDggPiBsICYmIChIW2xdID0gQyhiLnBvdyh6LCAwLjUpKSksIEFbbF0gPSBDKGIucG93KHosIDEgLyAzKSksIGwrKyk7CiAgICAgICAgICAgICAgICB6Kys7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIGcgPSBbXTsKICAgICAgICAgICAgayA9IGsuU0hBMjU2ID0gdy5leHRlbmQoewogICAgICAgICAgICAgICAgX2RvUmVzZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLl9oYXNoID0gbmV3IHguaW5pdChILnNsaWNlKDApKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBfZG9Qcm9jZXNzQmxvY2s6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IHRoaXMuX2hhc2gud29yZHMsIGYgPSBkWzBdLCBrID0gZFsxXSwgbCA9IGRbMl0sIHQgPSBkWzNdLCB3ID0gZFs0XSwgeCA9IGRbNV0sIHogPSBkWzZdLCBDID0gZFs3XSwgRSA9IDA7IDY0ID4gRTsgRSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxNiA+IEUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnW0VdID0gYVtiICsgRV0gfCAwOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBCID0gZ1tFIC0gMTVdLCB5ID0gZ1tFIC0gMl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnW0VdID0gKChCIDw8IDI1IHwgQiA+Pj4gNykgXiAoQiA8PCAxNCB8IEIgPj4+IDE4KSBeIEIgPj4+IDMpICsgZ1tFIC0gN10gKyAoKHkgPDwgMTUgfCB5ID4+PiAxNykgXiAoeSA8PCAxMyB8IHkgPj4+IDE5KSBeIHkgPj4+IDEwKSArIGdbRSAtIDE2XTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBCID0gQyArICgodyA8PCAyNiB8IHcgPj4+IDYpIF4gKHcgPDwgMjEgfCB3ID4+PiAxMSkgXiAodyA8PCA3IHwgdyA+Pj4gMjUpKSArICh3ICYgeCBeIH53ICYgeikgKyBBW0VdICsgZ1tFXTsKICAgICAgICAgICAgICAgICAgICAgICAgeSA9ICgoZiA8PCAzMCB8IGYgPj4+IDIpIF4gKGYgPDwgMTkgfCBmID4+PiAxMykgXiAoZiA8PCAxMCB8IGYgPj4+IDIyKSkgKyAoZiAmIGsgXiBmICYgbCBeIGsgJiBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgQyA9IHo7CiAgICAgICAgICAgICAgICAgICAgICAgIHogPSB4OwogICAgICAgICAgICAgICAgICAgICAgICB4ID0gdzsKICAgICAgICAgICAgICAgICAgICAgICAgdyA9IHQgKyBCIHwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBrOwogICAgICAgICAgICAgICAgICAgICAgICBrID0gZjsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IEIgKyB5IHwgMDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZFswXSA9IGRbMF0gKyBmIHwgMDsKICAgICAgICAgICAgICAgICAgICBkWzFdID0gZFsxXSArIGsgfCAwOwogICAgICAgICAgICAgICAgICAgIGRbMl0gPSBkWzJdICsgbCB8IDA7CiAgICAgICAgICAgICAgICAgICAgZFszXSA9IGRbM10gKyB0IHwgMDsKICAgICAgICAgICAgICAgICAgICBkWzRdID0gZFs0XSArIHcgfCAwOwogICAgICAgICAgICAgICAgICAgIGRbNV0gPSBkWzVdICsgeCB8IDA7CiAgICAgICAgICAgICAgICAgICAgZFs2XSA9IGRbNl0gKyB6IHwgMDsKICAgICAgICAgICAgICAgICAgICBkWzddID0gZFs3XSArIEMgfCAwOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIF9kb0ZpbmFsaXplOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLl9kYXRhLCBmID0gYS53b3JkcywgZCA9IDggKiB0aGlzLl9uRGF0YUJ5dGVzLCBnID0gOCAqIGEuc2lnQnl0ZXM7CiAgICAgICAgICAgICAgICAgICAgZltnID4+PiA1XSB8PSAxMjggPDwgMjQgLSBnICUgMzI7CiAgICAgICAgICAgICAgICAgICAgZlsoZyArIDY0ID4+PiA5IDw8IDQpICsgMTRdID0gYi5mbG9vcihkIC8gNDI5NDk2NzI5Nik7CiAgICAgICAgICAgICAgICAgICAgZlsoZyArIDY0ID4+PiA5IDw8IDQpICsgMTVdID0gZDsKICAgICAgICAgICAgICAgICAgICBhLnNpZ0J5dGVzID0gNCAqIGYubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIHRoaXMuX3Byb2Nlc3MoKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5faGFzaDsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBjbG9uZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gdy5jbG9uZS5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgICAgIGEuX2hhc2ggPSB0aGlzLl9oYXNoLmNsb25lKCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBhLlNIQTI1NiA9IHcuX2NyZWF0ZUhlbHBlcihrKTsKICAgICAgICAgICAgYS5IbWFjU0hBMjU2ID0gdy5fY3JlYXRlSG1hY0hlbHBlcihrKTsKICAgICAgICB9KE1hdGgpKTsKICAgICAgICAoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgZnVuY3Rpb24gYShjLCBlLCBoKSB7CiAgICAgICAgICAgICAgICBudWxsICE9IGMgJiYgKCdudW1iZXInID09IHR5cGVvZiBjID8gdGhpcy5mcm9tTnVtYmVyKGMsIGUsIGgpIDogbnVsbCA9PSBlICYmICdzdHJpbmcnICE9IHR5cGVvZiBjID8gdGhpcy5mcm9tU3RyaW5nKGMsIDI1NikgOiB0aGlzLmZyb21TdHJpbmcoYywgZSkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGsoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGEobnVsbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24geChjLCBlLCBoLCBhLCBuLCBiKSB7CiAgICAgICAgICAgICAgICBmb3IgKDsgMCA8PSAtLWI7KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBlICogdGhpc1tjKytdICsgaFthXSArIG47CiAgICAgICAgICAgICAgICAgICAgbiA9IE1hdGguZmxvb3IodSAvIDY3MTA4ODY0KTsKICAgICAgICAgICAgICAgICAgICBoW2ErK10gPSB1ICYgNjcxMDg4NjM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB3KGMsIGUsIGgsIGEsIG4sIGIpIHsKICAgICAgICAgICAgICAgIHZhciB1ID0gZSAmIDMyNzY3OwogICAgICAgICAgICAgICAgZm9yIChlID4+PSAxNTsgMCA8PSAtLWI7KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB0aGlzW2NdICYgMzI3NjcsIGYgPSB0aGlzW2MrK10gPj4gMTUsIFEgPSBlICogZCArIGYgKiB1OwogICAgICAgICAgICAgICAgICAgIGQgPSB1ICogZCArICgoUSAmIDMyNzY3KSA8PCAxNSkgKyBoW2FdICsgKG4gJiAxMDczNzQxODIzKTsKICAgICAgICAgICAgICAgICAgICBuID0gKGQgPj4+IDMwKSArIChRID4+PiAxNSkgKyBlICogZiArIChuID4+PiAzMCk7CiAgICAgICAgICAgICAgICAgICAgaFthKytdID0gZCAmIDEwNzM3NDE4MjM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBIKGMsIGUsIGgsIGEsIG4sIGIpIHsKICAgICAgICAgICAgICAgIHZhciB1ID0gZSAmIDE2MzgzOwogICAgICAgICAgICAgICAgZm9yIChlID4+PSAxNDsgMCA8PSAtLWI7KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB0aGlzW2NdICYgMTYzODMsIGYgPSB0aGlzW2MrK10gPj4gMTQsIFEgPSBlICogZCArIGYgKiB1OwogICAgICAgICAgICAgICAgICAgIGQgPSB1ICogZCArICgoUSAmIDE2MzgzKSA8PCAxNCkgKyBoW2FdICsgbjsKICAgICAgICAgICAgICAgICAgICBuID0gKGQgPj4gMjgpICsgKFEgPj4gMTQpICsgZSAqIGY7CiAgICAgICAgICAgICAgICAgICAgaFthKytdID0gZCAmIDI2ODQzNTQ1NTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEEoYywgZSkgewogICAgICAgICAgICAgICAgYyA9IE5bYy5jaGFyQ29kZUF0KGUpXTsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGMgPyAtMSA6IGM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gQyhjKSB7CiAgICAgICAgICAgICAgICB2YXIgZSA9IGsoKTsKICAgICAgICAgICAgICAgIGUuZnJvbUludChjKTsKICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHooYykgewogICAgICAgICAgICAgICAgdmFyIGUgPSAxLCBoOwogICAgICAgICAgICAgICAgMCAhPSAoaCA9IGMgPj4+IDE2KSAmJiAoYyA9IGgsIGUgKz0gMTYpOwogICAgICAgICAgICAgICAgMCAhPSAoaCA9IGMgPj4gOCkgJiYgKGMgPSBoLCBlICs9IDgpOwogICAgICAgICAgICAgICAgMCAhPSAoaCA9IGMgPj4gNCkgJiYgKGMgPSBoLCBlICs9IDQpOwogICAgICAgICAgICAgICAgMCAhPSAoaCA9IGMgPj4gMikgJiYgKGMgPSBoLCBlICs9IDIpOwogICAgICAgICAgICAgICAgMCAhPSBjID4+IDEgJiYgKGUgKz0gMSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBsKGMpIHsKICAgICAgICAgICAgICAgIHRoaXMubSA9IGM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gRihjKSB7CiAgICAgICAgICAgICAgICB0aGlzLm0gPSBjOwogICAgICAgICAgICAgICAgdGhpcy5tcCA9IGMuaW52RGlnaXQoKTsKICAgICAgICAgICAgICAgIHRoaXMubXBsID0gdGhpcy5tcCAmIDMyNzY3OwogICAgICAgICAgICAgICAgdGhpcy5tcGggPSB0aGlzLm1wID4+IDE1OwogICAgICAgICAgICAgICAgdGhpcy51bSA9ICgxIDw8IGMuREIgLSAxNSkgLSAxOwogICAgICAgICAgICAgICAgdGhpcy5tdDIgPSAyICogYy50OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEIoYywgZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGMgJiBlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGYoYywgZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGMgfCBlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGcoYywgZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGMgXiBlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEkoYywgZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGMgJiB+ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB0KCkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGQoYykgewogICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gbShjKSB7CiAgICAgICAgICAgICAgICB0aGlzLnIyID0gaygpOwogICAgICAgICAgICAgICAgdGhpcy5xMyA9IGsoKTsKICAgICAgICAgICAgICAgIGEuT05FLmRsU2hpZnRUbygyICogYy50LCB0aGlzLnIyKTsKICAgICAgICAgICAgICAgIHRoaXMubXUgPSB0aGlzLnIyLmRpdmlkZShjKTsKICAgICAgICAgICAgICAgIHRoaXMubSA9IGM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gTSgpIHsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IHRoaXMuaSA9IDA7CiAgICAgICAgICAgICAgICB0aGlzLlMgPSBbXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBLKCkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEooYywgZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBhKGMsIGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEcoKSB7CiAgICAgICAgICAgICAgICB0aGlzLm4gPSBudWxsOwogICAgICAgICAgICAgICAgdGhpcy5lID0gMDsKICAgICAgICAgICAgICAgIHRoaXMuY29lZmYgPSB0aGlzLmRtcTEgPSB0aGlzLmRtcDEgPSB0aGlzLnEgPSB0aGlzLnAgPSB0aGlzLmQgPSBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFAoYykgewogICAgICAgICAgICAgICAgdmFyIGUsIGggPSAnJzsKICAgICAgICAgICAgICAgIGZvciAoZSA9IDA7IGUgKyAzIDw9IGMubGVuZ3RoOyBlICs9IDMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHBhcnNlSW50KGMuc3Vic3RyaW5nKGUsIGUgKyAzKSwgMTYpOwogICAgICAgICAgICAgICAgICAgIGggKz0gJ0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky8nLmNoYXJBdChhID4+IDYpICsgJ0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky8nLmNoYXJBdChhICYgNjMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZSArIDEgPT0gYy5sZW5ndGggPyAoYSA9IHBhcnNlSW50KGMuc3Vic3RyaW5nKGUsIGUgKyAxKSwgMTYpLCBoICs9ICdBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OSsvJy5jaGFyQXQoYSA8PCAyKSkgOiBlICsgMiA9PSBjLmxlbmd0aCAmJiAoYSA9IHBhcnNlSW50KGMuc3Vic3RyaW5nKGUsIGUgKyAyKSwgMTYpLCBoICs9ICdBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OSsvJy5jaGFyQXQoYSA+PiAyKSArICdBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OSsvJy5jaGFyQXQoKGEgJiAzKSA8PCA0KSk7CiAgICAgICAgICAgICAgICBmb3IgKDsgMCA8IChoLmxlbmd0aCAmIDMpOykKICAgICAgICAgICAgICAgICAgICBoICs9ICc9JzsKICAgICAgICAgICAgICAgIHJldHVybiBoOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFYoYykgewogICAgICAgICAgICAgICAgdmFyIGUgPSAnJywgYSwgdSA9IDA7CiAgICAgICAgICAgICAgICBmb3IgKGEgPSAwOyBhIDwgYy5sZW5ndGggJiYgJz0nICE9IGMuY2hhckF0KGEpOyArK2EpCiAgICAgICAgICAgICAgICAgICAgaWYgKHYgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLycuaW5kZXhPZihjLmNoYXJBdChhKSksICEoMCA+IHYpKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSB1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICs9ICcwMTIzNDU2Nzg5YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXonLmNoYXJBdCh2ID4+IDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB2ICYgMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSAxOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEgPT0gdSA/IChlICs9ICcwMTIzNDU2Nzg5YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXonLmNoYXJBdChuIDw8IDIgfCB2ID4+IDQpLCBuID0gdiAmIDE1LCB1ID0gMikgOiAyID09IHUgPyAoZSArPSAnMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6Jy5jaGFyQXQobiksIGUgKz0gJzAxMjM0NTY3ODlhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5eicuY2hhckF0KHYgPj4gMiksIG4gPSB2ICYgMywgdSA9IDMpIDogKGUgKz0gJzAxMjM0NTY3ODlhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5eicuY2hhckF0KG4gPDwgMiB8IHYgPj4gNCksIGUgKz0gJzAxMjM0NTY3ODlhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5eicuY2hhckF0KHYgJiAxNSksIHUgPSAwKTsKICAgICAgICAgICAgICAgIDEgPT0gdSAmJiAoZSArPSAnMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6Jy5jaGFyQXQobiA8PCAyKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfQogICAgICAgICAgICB3aW5kb3cuQWRmb3JtID0gd2luZG93LkFkZm9ybSB8fCB7fTsKICAgICAgICAgICAgd2luZG93LkFkZm9ybS5KU0VuY3J5cHRIZWxwZXJzID0ge307CiAgICAgICAgICAgICdNaWNyb3NvZnQgSW50ZXJuZXQgRXhwbG9yZXInID09IG5hdmlnYXRvci5hcHBOYW1lID8gKGEucHJvdG90eXBlLmFtID0gdywgYiA9IDMwKSA6ICdOZXRzY2FwZScgIT0gbmF2aWdhdG9yLmFwcE5hbWUgPyAoYS5wcm90b3R5cGUuYW0gPSB4LCBiID0gMjYpIDogKGEucHJvdG90eXBlLmFtID0gSCwgYiA9IDI4KTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuREIgPSBiOwogICAgICAgICAgICBhLnByb3RvdHlwZS5ETSA9ICgxIDw8IGIpIC0gMTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuRFYgPSAxIDw8IGI7CiAgICAgICAgICAgIGEucHJvdG90eXBlLkZWID0gTWF0aC5wb3coMiwgNTIpOwogICAgICAgICAgICBhLnByb3RvdHlwZS5GMSA9IDUyIC0gYjsKICAgICAgICAgICAgYS5wcm90b3R5cGUuRjIgPSAyICogYiAtIDUyOwogICAgICAgICAgICB2YXIgTiA9IFtdLCBFOwogICAgICAgICAgICBiID0gNDg7CiAgICAgICAgICAgIGZvciAoRSA9IDA7IDkgPj0gRTsgKytFKQogICAgICAgICAgICAgICAgTltiKytdID0gRTsKICAgICAgICAgICAgYiA9IDk3OwogICAgICAgICAgICBmb3IgKEUgPSAxMDsgMzYgPiBFOyArK0UpCiAgICAgICAgICAgICAgICBOW2IrK10gPSBFOwogICAgICAgICAgICBiID0gNjU7CiAgICAgICAgICAgIGZvciAoRSA9IDEwOyAzNiA+IEU7ICsrRSkKICAgICAgICAgICAgICAgIE5bYisrXSA9IEU7CiAgICAgICAgICAgIGwucHJvdG90eXBlLmNvbnZlcnQgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgcmV0dXJuIDAgPiBjLnMgfHwgMCA8PSBjLmNvbXBhcmVUbyh0aGlzLm0pID8gYy5tb2QodGhpcy5tKSA6IGM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGwucHJvdG90eXBlLnJldmVydCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbC5wcm90b3R5cGUucmVkdWNlID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIGMuZGl2UmVtVG8odGhpcy5tLCBudWxsLCBjKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbC5wcm90b3R5cGUubXVsVG8gPSBmdW5jdGlvbiAoYywgZSwgYSkgewogICAgICAgICAgICAgICAgYy5tdWx0aXBseVRvKGUsIGEpOwogICAgICAgICAgICAgICAgdGhpcy5yZWR1Y2UoYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGwucHJvdG90eXBlLnNxclRvID0gZnVuY3Rpb24gKGMsIGUpIHsKICAgICAgICAgICAgICAgIGMuc3F1YXJlVG8oZSk7CiAgICAgICAgICAgICAgICB0aGlzLnJlZHVjZShlKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRi5wcm90b3R5cGUuY29udmVydCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICB2YXIgZSA9IGsoKTsKICAgICAgICAgICAgICAgIGMuYWJzKCkuZGxTaGlmdFRvKHRoaXMubS50LCBlKTsKICAgICAgICAgICAgICAgIGUuZGl2UmVtVG8odGhpcy5tLCBudWxsLCBlKTsKICAgICAgICAgICAgICAgIDAgPiBjLnMgJiYgMCA8IGUuY29tcGFyZVRvKGEuWkVSTykgJiYgdGhpcy5tLnN1YlRvKGUsIGUpOwogICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEYucHJvdG90eXBlLnJldmVydCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICB2YXIgZSA9IGsoKTsKICAgICAgICAgICAgICAgIGMuY29weVRvKGUpOwogICAgICAgICAgICAgICAgdGhpcy5yZWR1Y2UoZSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRi5wcm90b3R5cGUucmVkdWNlID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIGZvciAoOyBjLnQgPD0gdGhpcy5tdDI7KQogICAgICAgICAgICAgICAgICAgIGNbYy50KytdID0gMDsKICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSAwOyBlIDwgdGhpcy5tLnQ7ICsrZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gY1tlXSAmIDMyNzY3LCB1ID0gYSAqIHRoaXMubXBsICsgKChhICogdGhpcy5tcGggKyAoY1tlXSA+PiAxNSkgKiB0aGlzLm1wbCAmIHRoaXMudW0pIDw8IDE1KSAmIGMuRE07CiAgICAgICAgICAgICAgICAgICAgYSA9IGUgKyB0aGlzLm0udDsKICAgICAgICAgICAgICAgICAgICBmb3IgKGNbYV0gKz0gdGhpcy5tLmFtKDAsIHUsIGMsIGUsIDAsIHRoaXMubS50KTsgY1thXSA+PSBjLkRWOykKICAgICAgICAgICAgICAgICAgICAgICAgY1thXSAtPSBjLkRWLCBjWysrYV0rKzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGMuY2xhbXAoKTsKICAgICAgICAgICAgICAgIGMuZHJTaGlmdFRvKHRoaXMubS50LCBjKTsKICAgICAgICAgICAgICAgIDAgPD0gYy5jb21wYXJlVG8odGhpcy5tKSAmJiBjLnN1YlRvKHRoaXMubSwgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEYucHJvdG90eXBlLm11bFRvID0gZnVuY3Rpb24gKGMsIGUsIGEpIHsKICAgICAgICAgICAgICAgIGMubXVsdGlwbHlUbyhlLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMucmVkdWNlKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBGLnByb3RvdHlwZS5zcXJUbyA9IGZ1bmN0aW9uIChjLCBlKSB7CiAgICAgICAgICAgICAgICBjLnNxdWFyZVRvKGUpOwogICAgICAgICAgICAgICAgdGhpcy5yZWR1Y2UoZSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmNvcHlUbyA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gdGhpcy50IC0gMTsgMCA8PSBlOyAtLWUpCiAgICAgICAgICAgICAgICAgICAgY1tlXSA9IHRoaXNbZV07CiAgICAgICAgICAgICAgICBjLnQgPSB0aGlzLnQ7CiAgICAgICAgICAgICAgICBjLnMgPSB0aGlzLnM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmZyb21JbnQgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgdGhpcy50ID0gMTsKICAgICAgICAgICAgICAgIHRoaXMucyA9IDAgPiBjID8gLTEgOiAwOwogICAgICAgICAgICAgICAgMCA8IGMgPyB0aGlzWzBdID0gYyA6IC0xID4gYyA/IHRoaXNbMF0gPSBjICsgdGhpcy5EViA6IHRoaXMudCA9IDA7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmZyb21TdHJpbmcgPSBmdW5jdGlvbiAoYywgZSkgewogICAgICAgICAgICAgICAgaWYgKDE2ID09IGUpCiAgICAgICAgICAgICAgICAgICAgZSA9IDQ7CiAgICAgICAgICAgICAgICBlbHNlIGlmICg4ID09IGUpCiAgICAgICAgICAgICAgICAgICAgZSA9IDM7CiAgICAgICAgICAgICAgICBlbHNlIGlmICgyNTYgPT0gZSkKICAgICAgICAgICAgICAgICAgICBlID0gODsKICAgICAgICAgICAgICAgIGVsc2UgaWYgKDIgPT0gZSkKICAgICAgICAgICAgICAgICAgICBlID0gMTsKICAgICAgICAgICAgICAgIGVsc2UgaWYgKDMyID09IGUpCiAgICAgICAgICAgICAgICAgICAgZSA9IDU7CiAgICAgICAgICAgICAgICBlbHNlIGlmICg0ID09IGUpCiAgICAgICAgICAgICAgICAgICAgZSA9IDI7CiAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmZyb21SYWRpeChjLCBlKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0aGlzLnMgPSB0aGlzLnQgPSAwOwogICAgICAgICAgICAgICAgZm9yICh2YXIgaCA9IGMubGVuZ3RoLCB1ID0gITEsIG4gPSAwOyAwIDw9IC0taDspIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IDggPT0gZSA/IGNbaF0gJiAyNTUgOiBBKGMsIGgpOwogICAgICAgICAgICAgICAgICAgIDAgPiBiID8gJy0nID09IGMuY2hhckF0KGgpICYmICh1ID0gITApIDogKHUgPSAhMSwgMCA9PSBuID8gdGhpc1t0aGlzLnQrK10gPSBiIDogbiArIGUgPiB0aGlzLkRCID8gKHRoaXNbdGhpcy50IC0gMV0gfD0gKGIgJiAoMSA8PCB0aGlzLkRCIC0gbikgLSAxKSA8PCBuLCB0aGlzW3RoaXMudCsrXSA9IGIgPj4gdGhpcy5EQiAtIG4pIDogdGhpc1t0aGlzLnQgLSAxXSB8PSBiIDw8IG4sIG4gKz0gZSwgbiA+PSB0aGlzLkRCICYmIChuIC09IHRoaXMuREIpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIDggPT0gZSAmJiAwICE9IChjWzBdICYgMTI4KSAmJiAodGhpcy5zID0gLTEsIDAgPCBuICYmICh0aGlzW3RoaXMudCAtIDFdIHw9ICgxIDw8IHRoaXMuREIgLSBuKSAtIDEgPDwgbikpOwogICAgICAgICAgICAgICAgdGhpcy5jbGFtcCgpOwogICAgICAgICAgICAgICAgdSAmJiBhLlpFUk8uc3ViVG8odGhpcywgdGhpcyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmNsYW1wID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IHRoaXMucyAmIHRoaXMuRE07IDAgPCB0aGlzLnQgJiYgdGhpc1t0aGlzLnQgLSAxXSA9PSBjOykKICAgICAgICAgICAgICAgICAgICAtLXRoaXMudDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuZGxTaGlmdFRvID0gZnVuY3Rpb24gKGMsIGUpIHsKICAgICAgICAgICAgICAgIHZhciBhOwogICAgICAgICAgICAgICAgZm9yIChhID0gdGhpcy50IC0gMTsgMCA8PSBhOyAtLWEpCiAgICAgICAgICAgICAgICAgICAgZVthICsgY10gPSB0aGlzW2FdOwogICAgICAgICAgICAgICAgZm9yIChhID0gYyAtIDE7IDAgPD0gYTsgLS1hKQogICAgICAgICAgICAgICAgICAgIGVbYV0gPSAwOwogICAgICAgICAgICAgICAgZS50ID0gdGhpcy50ICsgYzsKICAgICAgICAgICAgICAgIGUucyA9IHRoaXMuczsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuZHJTaGlmdFRvID0gZnVuY3Rpb24gKGMsIGUpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSBjOyBhIDwgdGhpcy50OyArK2EpCiAgICAgICAgICAgICAgICAgICAgZVthIC0gY10gPSB0aGlzW2FdOwogICAgICAgICAgICAgICAgZS50ID0gTWF0aC5tYXgodGhpcy50IC0gYywgMCk7CiAgICAgICAgICAgICAgICBlLnMgPSB0aGlzLnM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmxTaGlmdFRvID0gZnVuY3Rpb24gKGMsIGUpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gYyAlIHRoaXMuREIsIHUgPSB0aGlzLkRCIC0gYSwgbiA9ICgxIDw8IHUpIC0gMTsKICAgICAgICAgICAgICAgIGMgPSBNYXRoLmZsb29yKGMgLyB0aGlzLkRCKTsKICAgICAgICAgICAgICAgIHZhciBiID0gdGhpcy5zIDw8IGEgJiB0aGlzLkRNLCBkOwogICAgICAgICAgICAgICAgZm9yIChkID0gdGhpcy50IC0gMTsgMCA8PSBkOyAtLWQpCiAgICAgICAgICAgICAgICAgICAgZVtkICsgYyArIDFdID0gdGhpc1tkXSA+PiB1IHwgYiwgYiA9ICh0aGlzW2RdICYgbikgPDwgYTsKICAgICAgICAgICAgICAgIGZvciAoZCA9IGMgLSAxOyAwIDw9IGQ7IC0tZCkKICAgICAgICAgICAgICAgICAgICBlW2RdID0gMDsKICAgICAgICAgICAgICAgIGVbY10gPSBiOwogICAgICAgICAgICAgICAgZS50ID0gdGhpcy50ICsgYyArIDE7CiAgICAgICAgICAgICAgICBlLnMgPSB0aGlzLnM7CiAgICAgICAgICAgICAgICBlLmNsYW1wKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLnJTaGlmdFRvID0gZnVuY3Rpb24gKGMsIGUpIHsKICAgICAgICAgICAgICAgIGUucyA9IHRoaXMuczsKICAgICAgICAgICAgICAgIHZhciBhID0gTWF0aC5mbG9vcihjIC8gdGhpcy5EQik7CiAgICAgICAgICAgICAgICBpZiAoYSA+PSB0aGlzLnQpCiAgICAgICAgICAgICAgICAgICAgZS50ID0gMDsKICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgIGMgJT0gdGhpcy5EQjsKICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHRoaXMuREIgLSBjLCBuID0gKDEgPDwgYykgLSAxOwogICAgICAgICAgICAgICAgICAgIGVbMF0gPSB0aGlzW2FdID4+IGM7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IGEgKyAxOyBiIDwgdGhpcy50OyArK2IpCiAgICAgICAgICAgICAgICAgICAgICAgIGVbYiAtIGEgLSAxXSB8PSAodGhpc1tiXSAmIG4pIDw8IHUsIGVbYiAtIGFdID0gdGhpc1tiXSA+PiBjOwogICAgICAgICAgICAgICAgICAgIDAgPCBjICYmIChlW3RoaXMudCAtIGEgLSAxXSB8PSAodGhpcy5zICYgbikgPDwgdSk7CiAgICAgICAgICAgICAgICAgICAgZS50ID0gdGhpcy50IC0gYTsKICAgICAgICAgICAgICAgICAgICBlLmNsYW1wKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLnN1YlRvID0gZnVuY3Rpb24gKGMsIGUpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSAwLCB1ID0gMCwgbiA9IE1hdGgubWluKGMudCwgdGhpcy50KTsgYSA8IG47KQogICAgICAgICAgICAgICAgICAgIHUgKz0gdGhpc1thXSAtIGNbYV0sIGVbYSsrXSA9IHUgJiB0aGlzLkRNLCB1ID4+PSB0aGlzLkRCOwogICAgICAgICAgICAgICAgaWYgKGMudCA8IHRoaXMudCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodSAtPSBjLnM7IGEgPCB0aGlzLnQ7KQogICAgICAgICAgICAgICAgICAgICAgICB1ICs9IHRoaXNbYV0sIGVbYSsrXSA9IHUgJiB0aGlzLkRNLCB1ID4+PSB0aGlzLkRCOwogICAgICAgICAgICAgICAgICAgIHUgKz0gdGhpcy5zOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHUgKz0gdGhpcy5zOyBhIDwgYy50OykKICAgICAgICAgICAgICAgICAgICAgICAgdSAtPSBjW2FdLCBlW2ErK10gPSB1ICYgdGhpcy5ETSwgdSA+Pj0gdGhpcy5EQjsKICAgICAgICAgICAgICAgICAgICB1IC09IGMuczsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGUucyA9IDAgPiB1ID8gLTEgOiAwOwogICAgICAgICAgICAgICAgLTEgPiB1ID8gZVthKytdID0gdGhpcy5EViArIHUgOiAwIDwgdSAmJiAoZVthKytdID0gdSk7CiAgICAgICAgICAgICAgICBlLnQgPSBhOwogICAgICAgICAgICAgICAgZS5jbGFtcCgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5tdWx0aXBseVRvID0gZnVuY3Rpb24gKGMsIGUpIHsKICAgICAgICAgICAgICAgIHZhciBoID0gdGhpcy5hYnMoKSwgdSA9IGMuYWJzKCksIG4gPSBoLnQ7CiAgICAgICAgICAgICAgICBmb3IgKGUudCA9IG4gKyB1LnQ7IDAgPD0gLS1uOykKICAgICAgICAgICAgICAgICAgICBlW25dID0gMDsKICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPCB1LnQ7ICsrbikKICAgICAgICAgICAgICAgICAgICBlW24gKyBoLnRdID0gaC5hbSgwLCB1W25dLCBlLCBuLCAwLCBoLnQpOwogICAgICAgICAgICAgICAgZS5zID0gMDsKICAgICAgICAgICAgICAgIGUuY2xhbXAoKTsKICAgICAgICAgICAgICAgIHRoaXMucyAhPSBjLnMgJiYgYS5aRVJPLnN1YlRvKGUsIGUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5zcXVhcmVUbyA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gdGhpcy5hYnMoKSwgYSA9IGMudCA9IDIgKiBlLnQ7IDAgPD0gLS1hOykKICAgICAgICAgICAgICAgICAgICBjW2FdID0gMDsKICAgICAgICAgICAgICAgIGZvciAoYSA9IDA7IGEgPCBlLnQgLSAxOyArK2EpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IGUuYW0oYSwgZVthXSwgYywgMiAqIGEsIDAsIDEpOwogICAgICAgICAgICAgICAgICAgIChjW2EgKyBlLnRdICs9IGUuYW0oYSArIDEsIDIgKiBlW2FdLCBjLCAyICogYSArIDEsIHUsIGUudCAtIGEgLSAxKSkgPj0gZS5EViAmJiAoY1thICsgZS50XSAtPSBlLkRWLCBjW2EgKyBlLnQgKyAxXSA9IDEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgMCA8IGMudCAmJiAoY1tjLnQgLSAxXSArPSBlLmFtKGEsIGVbYV0sIGMsIDIgKiBhLCAwLCAxKSk7CiAgICAgICAgICAgICAgICBjLnMgPSAwOwogICAgICAgICAgICAgICAgYy5jbGFtcCgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5kaXZSZW1UbyA9IGZ1bmN0aW9uIChjLCBlLCBoKSB7CiAgICAgICAgICAgICAgICB2YXIgdSA9IGMuYWJzKCk7CiAgICAgICAgICAgICAgICBpZiAoISgwID49IHUudCkpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuYWJzKCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG4udCA8IHUudCkKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSBlICYmIGUuZnJvbUludCgwKSwgbnVsbCAhPSBoICYmIHRoaXMuY29weVRvKGgpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09IGggJiYgKGggPSBrKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGsoKSwgZCA9IHRoaXMuczsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMuczsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSB0aGlzLkRCIC0geih1W3UudCAtIDFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgMCA8IGYgPyAodS5sU2hpZnRUbyhmLCBiKSwgbi5sU2hpZnRUbyhmLCBoKSkgOiAodS5jb3B5VG8oYiksIG4uY29weVRvKGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdSA9IGIudDsKICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGJbdSAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCAhPSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IG4gKiAoMSA8PCB0aGlzLkYxKSArICgxIDwgdSA/IGJbdSAtIDJdID4+IHRoaXMuRjIgOiAwKSwgbSA9IHRoaXMuRlYgLyBnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9ICgxIDw8IHRoaXMuRjEpIC8gZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gMSA8PCB0aGlzLkYyLCBxID0gaC50LCBwID0gcSAtIHUsIHIgPSBudWxsID09IGUgPyBrKCkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5kbFNoaWZ0VG8ocCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwIDw9IGguY29tcGFyZVRvKHIpICYmIChoW2gudCsrXSA9IDEsIGguc3ViVG8ociwgaCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5PTkUuZGxTaGlmdFRvKHUsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyLnN1YlRvKGIsIGIpOyBiLnQgPCB1OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiW2IudCsrXSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgMCA8PSAtLXA7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBoWy0tcV0gPT0gbiA/IHRoaXMuRE0gOiBNYXRoLmZsb29yKGhbcV0gKiBtICsgKGhbcSAtIDFdICsgbCkgKiBnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGhbcV0gKz0gYi5hbSgwLCB0LCBoLCBwLCAwLCB1KSkgPCB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGIuZGxTaGlmdFRvKHAsIHIpLCBoLnN1YlRvKHIsIGgpOyBoW3FdIDwgLS10OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGguc3ViVG8ociwgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IGUgJiYgKGguZHJTaGlmdFRvKHUsIGUpLCBkICE9IGMgJiYgYS5aRVJPLnN1YlRvKGUsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgudCA9IHU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLmNsYW1wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwIDwgZiAmJiBoLnJTaGlmdFRvKGYsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMCA+IGQgJiYgYS5aRVJPLnN1YlRvKGgsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5pbnZEaWdpdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGlmICgxID4gdGhpcy50KQogICAgICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICAgICAgdmFyIGMgPSB0aGlzWzBdOwogICAgICAgICAgICAgICAgaWYgKDAgPT0gKGMgJiAxKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgIHZhciBlID0gYyAmIDM7CiAgICAgICAgICAgICAgICBlID0gZSAqICgyIC0gKGMgJiAxNSkgKiBlKSAmIDE1OwogICAgICAgICAgICAgICAgZSA9IGUgKiAoMiAtIChjICYgMjU1KSAqIGUpICYgMjU1OwogICAgICAgICAgICAgICAgZSA9IGUgKiAoMiAtICgoYyAmIDY1NTM1KSAqIGUgJiA2NTUzNSkpICYgNjU1MzU7CiAgICAgICAgICAgICAgICBlID0gZSAqICgyIC0gYyAqIGUgJSB0aGlzLkRWKSAlIHRoaXMuRFY7CiAgICAgICAgICAgICAgICByZXR1cm4gMCA8IGUgPyB0aGlzLkRWIC0gZSA6IC1lOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5pc0V2ZW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMCA9PSAoMCA8IHRoaXMudCA/IHRoaXNbMF0gJiAxIDogdGhpcy5zKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuZXhwID0gZnVuY3Rpb24gKGMsIGUpIHsKICAgICAgICAgICAgICAgIGlmICg0Mjk0OTY3Mjk1IDwgYyB8fCAxID4gYykKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5PTkU7CiAgICAgICAgICAgICAgICB2YXIgaCA9IGsoKSwgdSA9IGsoKSwgbiA9IGUuY29udmVydCh0aGlzKSwgYiA9IHooYykgLSAxOwogICAgICAgICAgICAgICAgZm9yIChuLmNvcHlUbyhoKTsgMCA8PSAtLWI7KQogICAgICAgICAgICAgICAgICAgIGlmIChlLnNxclRvKGgsIHUpLCAwIDwgKGMgJiAxIDw8IGIpKQogICAgICAgICAgICAgICAgICAgICAgICBlLm11bFRvKHUsIG4sIGgpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGg7CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSB1OwogICAgICAgICAgICAgICAgICAgICAgICB1ID0gZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gZS5yZXZlcnQoaCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIGlmICgwID4gdGhpcy5zKQogICAgICAgICAgICAgICAgICAgIHJldHVybiAnLScgKyB0aGlzLm5lZ2F0ZSgpLnRvU3RyaW5nKGMpOwogICAgICAgICAgICAgICAgaWYgKDE2ID09IGMpCiAgICAgICAgICAgICAgICAgICAgYyA9IDQ7CiAgICAgICAgICAgICAgICBlbHNlIGlmICg4ID09IGMpCiAgICAgICAgICAgICAgICAgICAgYyA9IDM7CiAgICAgICAgICAgICAgICBlbHNlIGlmICgyID09IGMpCiAgICAgICAgICAgICAgICAgICAgYyA9IDE7CiAgICAgICAgICAgICAgICBlbHNlIGlmICgzMiA9PSBjKQogICAgICAgICAgICAgICAgICAgIGMgPSA1OwogICAgICAgICAgICAgICAgZWxzZSBpZiAoNCA9PSBjKQogICAgICAgICAgICAgICAgICAgIGMgPSAyOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRvUmFkaXgoYyk7CiAgICAgICAgICAgICAgICB2YXIgZSA9ICgxIDw8IGMpIC0gMSwgYSwgYiA9ICExLCBuID0gJycsIGQgPSB0aGlzLnQsIGYgPSB0aGlzLkRCIC0gZCAqIHRoaXMuREIgJSBjOwogICAgICAgICAgICAgICAgaWYgKDAgPCBkLS0pCiAgICAgICAgICAgICAgICAgICAgZm9yIChmIDwgdGhpcy5EQiAmJiAwIDwgKGEgPSB0aGlzW2RdID4+IGYpICYmIChiID0gITAsIG4gPSAnMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6Jy5jaGFyQXQoYSkpOyAwIDw9IGQ7KQogICAgICAgICAgICAgICAgICAgICAgICBmIDwgYyA/IChhID0gKHRoaXNbZF0gJiAoMSA8PCBmKSAtIDEpIDw8IGMgLSBmLCBhIHw9IHRoaXNbLS1kXSA+PiAoZiArPSB0aGlzLkRCIC0gYykpIDogKGEgPSB0aGlzW2RdID4+IChmIC09IGMpICYgZSwgMCA+PSBmICYmIChmICs9IHRoaXMuREIsIC0tZCkpLCAwIDwgYSAmJiAoYiA9ICEwKSwgYiAmJiAobiArPSAnMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6Jy5jaGFyQXQoYSkpOwogICAgICAgICAgICAgICAgcmV0dXJuIGIgPyBuIDogJzAnOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5uZWdhdGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IGsoKTsKICAgICAgICAgICAgICAgIGEuWkVSTy5zdWJUbyh0aGlzLCBjKTsKICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5hYnMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMCA+IHRoaXMucyA/IHRoaXMubmVnYXRlKCkgOiB0aGlzOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5jb21wYXJlVG8gPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnMgLSBjLnM7CiAgICAgICAgICAgICAgICBpZiAoMCAhPSBlKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLnQ7CiAgICAgICAgICAgICAgICBlID0gYSAtIGMudDsKICAgICAgICAgICAgICAgIGlmICgwICE9IGUpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPiB0aGlzLnMgPyAtZSA6IGU7CiAgICAgICAgICAgICAgICBmb3IgKDsgMCA8PSAtLWE7KQogICAgICAgICAgICAgICAgICAgIGlmICgwICE9IChlID0gdGhpc1thXSAtIGNbYV0pKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5iaXRMZW5ndGggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMCA+PSB0aGlzLnQgPyAwIDogdGhpcy5EQiAqICh0aGlzLnQgLSAxKSArIHoodGhpc1t0aGlzLnQgLSAxXSBeIHRoaXMucyAmIHRoaXMuRE0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5tb2QgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgdmFyIGUgPSBrKCk7CiAgICAgICAgICAgICAgICB0aGlzLmFicygpLmRpdlJlbVRvKGMsIG51bGwsIGUpOwogICAgICAgICAgICAgICAgMCA+IHRoaXMucyAmJiAwIDwgZS5jb21wYXJlVG8oYS5aRVJPKSAmJiBjLnN1YlRvKGUsIGUpOwogICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLm1vZFBvd0ludCA9IGZ1bmN0aW9uIChjLCBlKSB7CiAgICAgICAgICAgICAgICBlID0gMjU2ID4gYyB8fCBlLmlzRXZlbigpID8gbmV3IGwoZSkgOiBuZXcgRihlKTsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmV4cChjLCBlKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5aRVJPID0gQygwKTsKICAgICAgICAgICAgYS5PTkUgPSBDKDEpOwogICAgICAgICAgICB0LnByb3RvdHlwZS5jb252ZXJ0ID0gZDsKICAgICAgICAgICAgdC5wcm90b3R5cGUucmV2ZXJ0ID0gZDsKICAgICAgICAgICAgdC5wcm90b3R5cGUubXVsVG8gPSBmdW5jdGlvbiAoYywgZSwgYSkgewogICAgICAgICAgICAgICAgYy5tdWx0aXBseVRvKGUsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB0LnByb3RvdHlwZS5zcXJUbyA9IGZ1bmN0aW9uIChjLCBlKSB7CiAgICAgICAgICAgICAgICBjLnNxdWFyZVRvKGUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBtLnByb3RvdHlwZS5jb252ZXJ0ID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIGlmICgwID4gYy5zIHx8IGMudCA+IDIgKiB0aGlzLm0udCkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5tb2QodGhpcy5tKTsKICAgICAgICAgICAgICAgIGlmICgwID4gYy5jb21wYXJlVG8odGhpcy5tKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIHZhciBlID0gaygpOwogICAgICAgICAgICAgICAgYy5jb3B5VG8oZSk7CiAgICAgICAgICAgICAgICB0aGlzLnJlZHVjZShlKTsKICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICB9OwogICAgICAgICAgICBtLnByb3RvdHlwZS5yZXZlcnQgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIG0ucHJvdG90eXBlLnJlZHVjZSA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICBjLmRyU2hpZnRUbyh0aGlzLm0udCAtIDEsIHRoaXMucjIpOwogICAgICAgICAgICAgICAgYy50ID4gdGhpcy5tLnQgKyAxICYmIChjLnQgPSB0aGlzLm0udCArIDEsIGMuY2xhbXAoKSk7CiAgICAgICAgICAgICAgICB0aGlzLm11Lm11bHRpcGx5VXBwZXJUbyh0aGlzLnIyLCB0aGlzLm0udCArIDEsIHRoaXMucTMpOwogICAgICAgICAgICAgICAgZm9yICh0aGlzLm0ubXVsdGlwbHlMb3dlclRvKHRoaXMucTMsIHRoaXMubS50ICsgMSwgdGhpcy5yMik7IDAgPiBjLmNvbXBhcmVUbyh0aGlzLnIyKTspCiAgICAgICAgICAgICAgICAgICAgYy5kQWRkT2Zmc2V0KDEsIHRoaXMubS50ICsgMSk7CiAgICAgICAgICAgICAgICBmb3IgKGMuc3ViVG8odGhpcy5yMiwgYyk7IDAgPD0gYy5jb21wYXJlVG8odGhpcy5tKTspCiAgICAgICAgICAgICAgICAgICAgYy5zdWJUbyh0aGlzLm0sIGMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBtLnByb3RvdHlwZS5tdWxUbyA9IGZ1bmN0aW9uIChjLCBlLCBhKSB7CiAgICAgICAgICAgICAgICBjLm11bHRpcGx5VG8oZSwgYSk7CiAgICAgICAgICAgICAgICB0aGlzLnJlZHVjZShhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbS5wcm90b3R5cGUuc3FyVG8gPSBmdW5jdGlvbiAoYywgYSkgewogICAgICAgICAgICAgICAgYy5zcXVhcmVUbyhhKTsKICAgICAgICAgICAgICAgIHRoaXMucmVkdWNlKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgTCA9IFsKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgNSwKICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgIDExLAogICAgICAgICAgICAgICAgICAgIDEzLAogICAgICAgICAgICAgICAgICAgIDE3LAogICAgICAgICAgICAgICAgICAgIDE5LAogICAgICAgICAgICAgICAgICAgIDIzLAogICAgICAgICAgICAgICAgICAgIDI5LAogICAgICAgICAgICAgICAgICAgIDMxLAogICAgICAgICAgICAgICAgICAgIDM3LAogICAgICAgICAgICAgICAgICAgIDQxLAogICAgICAgICAgICAgICAgICAgIDQzLAogICAgICAgICAgICAgICAgICAgIDQ3LAogICAgICAgICAgICAgICAgICAgIDUzLAogICAgICAgICAgICAgICAgICAgIDU5LAogICAgICAgICAgICAgICAgICAgIDYxLAogICAgICAgICAgICAgICAgICAgIDY3LAogICAgICAgICAgICAgICAgICAgIDcxLAogICAgICAgICAgICAgICAgICAgIDczLAogICAgICAgICAgICAgICAgICAgIDc5LAogICAgICAgICAgICAgICAgICAgIDgzLAogICAgICAgICAgICAgICAgICAgIDg5LAogICAgICAgICAgICAgICAgICAgIDk3LAogICAgICAgICAgICAgICAgICAgIDEwMSwKICAgICAgICAgICAgICAgICAgICAxMDMsCiAgICAgICAgICAgICAgICAgICAgMTA3LAogICAgICAgICAgICAgICAgICAgIDEwOSwKICAgICAgICAgICAgICAgICAgICAxMTMsCiAgICAgICAgICAgICAgICAgICAgMTI3LAogICAgICAgICAgICAgICAgICAgIDEzMSwKICAgICAgICAgICAgICAgICAgICAxMzcsCiAgICAgICAgICAgICAgICAgICAgMTM5LAogICAgICAgICAgICAgICAgICAgIDE0OSwKICAgICAgICAgICAgICAgICAgICAxNTEsCiAgICAgICAgICAgICAgICAgICAgMTU3LAogICAgICAgICAgICAgICAgICAgIDE2MywKICAgICAgICAgICAgICAgICAgICAxNjcsCiAgICAgICAgICAgICAgICAgICAgMTczLAogICAgICAgICAgICAgICAgICAgIDE3OSwKICAgICAgICAgICAgICAgICAgICAxODEsCiAgICAgICAgICAgICAgICAgICAgMTkxLAogICAgICAgICAgICAgICAgICAgIDE5MywKICAgICAgICAgICAgICAgICAgICAxOTcsCiAgICAgICAgICAgICAgICAgICAgMTk5LAogICAgICAgICAgICAgICAgICAgIDIxMSwKICAgICAgICAgICAgICAgICAgICAyMjMsCiAgICAgICAgICAgICAgICAgICAgMjI3LAogICAgICAgICAgICAgICAgICAgIDIyOSwKICAgICAgICAgICAgICAgICAgICAyMzMsCiAgICAgICAgICAgICAgICAgICAgMjM5LAogICAgICAgICAgICAgICAgICAgIDI0MSwKICAgICAgICAgICAgICAgICAgICAyNTEsCiAgICAgICAgICAgICAgICAgICAgMjU3LAogICAgICAgICAgICAgICAgICAgIDI2MywKICAgICAgICAgICAgICAgICAgICAyNjksCiAgICAgICAgICAgICAgICAgICAgMjcxLAogICAgICAgICAgICAgICAgICAgIDI3NywKICAgICAgICAgICAgICAgICAgICAyODEsCiAgICAgICAgICAgICAgICAgICAgMjgzLAogICAgICAgICAgICAgICAgICAgIDI5MywKICAgICAgICAgICAgICAgICAgICAzMDcsCiAgICAgICAgICAgICAgICAgICAgMzExLAogICAgICAgICAgICAgICAgICAgIDMxMywKICAgICAgICAgICAgICAgICAgICAzMTcsCiAgICAgICAgICAgICAgICAgICAgMzMxLAogICAgICAgICAgICAgICAgICAgIDMzNywKICAgICAgICAgICAgICAgICAgICAzNDcsCiAgICAgICAgICAgICAgICAgICAgMzQ5LAogICAgICAgICAgICAgICAgICAgIDM1MywKICAgICAgICAgICAgICAgICAgICAzNTksCiAgICAgICAgICAgICAgICAgICAgMzY3LAogICAgICAgICAgICAgICAgICAgIDM3MywKICAgICAgICAgICAgICAgICAgICAzNzksCiAgICAgICAgICAgICAgICAgICAgMzgzLAogICAgICAgICAgICAgICAgICAgIDM4OSwKICAgICAgICAgICAgICAgICAgICAzOTcsCiAgICAgICAgICAgICAgICAgICAgNDAxLAogICAgICAgICAgICAgICAgICAgIDQwOSwKICAgICAgICAgICAgICAgICAgICA0MTksCiAgICAgICAgICAgICAgICAgICAgNDIxLAogICAgICAgICAgICAgICAgICAgIDQzMSwKICAgICAgICAgICAgICAgICAgICA0MzMsCiAgICAgICAgICAgICAgICAgICAgNDM5LAogICAgICAgICAgICAgICAgICAgIDQ0MywKICAgICAgICAgICAgICAgICAgICA0NDksCiAgICAgICAgICAgICAgICAgICAgNDU3LAogICAgICAgICAgICAgICAgICAgIDQ2MSwKICAgICAgICAgICAgICAgICAgICA0NjMsCiAgICAgICAgICAgICAgICAgICAgNDY3LAogICAgICAgICAgICAgICAgICAgIDQ3OSwKICAgICAgICAgICAgICAgICAgICA0ODcsCiAgICAgICAgICAgICAgICAgICAgNDkxLAogICAgICAgICAgICAgICAgICAgIDQ5OSwKICAgICAgICAgICAgICAgICAgICA1MDMsCiAgICAgICAgICAgICAgICAgICAgNTA5LAogICAgICAgICAgICAgICAgICAgIDUyMSwKICAgICAgICAgICAgICAgICAgICA1MjMsCiAgICAgICAgICAgICAgICAgICAgNTQxLAogICAgICAgICAgICAgICAgICAgIDU0NywKICAgICAgICAgICAgICAgICAgICA1NTcsCiAgICAgICAgICAgICAgICAgICAgNTYzLAogICAgICAgICAgICAgICAgICAgIDU2OSwKICAgICAgICAgICAgICAgICAgICA1NzEsCiAgICAgICAgICAgICAgICAgICAgNTc3LAogICAgICAgICAgICAgICAgICAgIDU4NywKICAgICAgICAgICAgICAgICAgICA1OTMsCiAgICAgICAgICAgICAgICAgICAgNTk5LAogICAgICAgICAgICAgICAgICAgIDYwMSwKICAgICAgICAgICAgICAgICAgICA2MDcsCiAgICAgICAgICAgICAgICAgICAgNjEzLAogICAgICAgICAgICAgICAgICAgIDYxNywKICAgICAgICAgICAgICAgICAgICA2MTksCiAgICAgICAgICAgICAgICAgICAgNjMxLAogICAgICAgICAgICAgICAgICAgIDY0MSwKICAgICAgICAgICAgICAgICAgICA2NDMsCiAgICAgICAgICAgICAgICAgICAgNjQ3LAogICAgICAgICAgICAgICAgICAgIDY1MywKICAgICAgICAgICAgICAgICAgICA2NTksCiAgICAgICAgICAgICAgICAgICAgNjYxLAogICAgICAgICAgICAgICAgICAgIDY3MywKICAgICAgICAgICAgICAgICAgICA2NzcsCiAgICAgICAgICAgICAgICAgICAgNjgzLAogICAgICAgICAgICAgICAgICAgIDY5MSwKICAgICAgICAgICAgICAgICAgICA3MDEsCiAgICAgICAgICAgICAgICAgICAgNzA5LAogICAgICAgICAgICAgICAgICAgIDcxOSwKICAgICAgICAgICAgICAgICAgICA3MjcsCiAgICAgICAgICAgICAgICAgICAgNzMzLAogICAgICAgICAgICAgICAgICAgIDczOSwKICAgICAgICAgICAgICAgICAgICA3NDMsCiAgICAgICAgICAgICAgICAgICAgNzUxLAogICAgICAgICAgICAgICAgICAgIDc1NywKICAgICAgICAgICAgICAgICAgICA3NjEsCiAgICAgICAgICAgICAgICAgICAgNzY5LAogICAgICAgICAgICAgICAgICAgIDc3MywKICAgICAgICAgICAgICAgICAgICA3ODcsCiAgICAgICAgICAgICAgICAgICAgNzk3LAogICAgICAgICAgICAgICAgICAgIDgwOSwKICAgICAgICAgICAgICAgICAgICA4MTEsCiAgICAgICAgICAgICAgICAgICAgODIxLAogICAgICAgICAgICAgICAgICAgIDgyMywKICAgICAgICAgICAgICAgICAgICA4MjcsCiAgICAgICAgICAgICAgICAgICAgODI5LAogICAgICAgICAgICAgICAgICAgIDgzOSwKICAgICAgICAgICAgICAgICAgICA4NTMsCiAgICAgICAgICAgICAgICAgICAgODU3LAogICAgICAgICAgICAgICAgICAgIDg1OSwKICAgICAgICAgICAgICAgICAgICA4NjMsCiAgICAgICAgICAgICAgICAgICAgODc3LAogICAgICAgICAgICAgICAgICAgIDg4MSwKICAgICAgICAgICAgICAgICAgICA4ODMsCiAgICAgICAgICAgICAgICAgICAgODg3LAogICAgICAgICAgICAgICAgICAgIDkwNywKICAgICAgICAgICAgICAgICAgICA5MTEsCiAgICAgICAgICAgICAgICAgICAgOTE5LAogICAgICAgICAgICAgICAgICAgIDkyOSwKICAgICAgICAgICAgICAgICAgICA5MzcsCiAgICAgICAgICAgICAgICAgICAgOTQxLAogICAgICAgICAgICAgICAgICAgIDk0NywKICAgICAgICAgICAgICAgICAgICA5NTMsCiAgICAgICAgICAgICAgICAgICAgOTY3LAogICAgICAgICAgICAgICAgICAgIDk3MSwKICAgICAgICAgICAgICAgICAgICA5NzcsCiAgICAgICAgICAgICAgICAgICAgOTgzLAogICAgICAgICAgICAgICAgICAgIDk5MSwKICAgICAgICAgICAgICAgICAgICA5OTcKICAgICAgICAgICAgICAgIF0sIHkgPSA2NzEwODg2NCAvIExbTC5sZW5ndGggLSAxXTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuY2h1bmtTaXplID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLmZsb29yKE1hdGguTE4yICogdGhpcy5EQiAvIE1hdGgubG9nKGMpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUudG9SYWRpeCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICBudWxsID09IGMgJiYgKGMgPSAxMCk7CiAgICAgICAgICAgICAgICBpZiAoMCA9PSB0aGlzLnNpZ251bSgpIHx8IDIgPiBjIHx8IDM2IDwgYykKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJzAnOwogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLmNodW5rU2l6ZShjKTsKICAgICAgICAgICAgICAgIGEgPSBNYXRoLnBvdyhjLCBhKTsKICAgICAgICAgICAgICAgIHZhciBoID0gQyhhKSwgYiA9IGsoKSwgbiA9IGsoKSwgZCA9ICcnOwogICAgICAgICAgICAgICAgZm9yICh0aGlzLmRpdlJlbVRvKGgsIGIsIG4pOyAwIDwgYi5zaWdudW0oKTspCiAgICAgICAgICAgICAgICAgICAgZCA9IChhICsgbi5pbnRWYWx1ZSgpKS50b1N0cmluZyhjKS5zdWJzdHIoMSkgKyBkLCBiLmRpdlJlbVRvKGgsIGIsIG4pOwogICAgICAgICAgICAgICAgcmV0dXJuIG4uaW50VmFsdWUoKS50b1N0cmluZyhjKSArIGQ7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmZyb21SYWRpeCA9IGZ1bmN0aW9uIChjLCBlKSB7CiAgICAgICAgICAgICAgICB0aGlzLmZyb21JbnQoMCk7CiAgICAgICAgICAgICAgICBudWxsID09IGUgJiYgKGUgPSAxMCk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBoID0gdGhpcy5jaHVua1NpemUoZSksIGIgPSBNYXRoLnBvdyhlLCBoKSwgbiA9ICExLCBkID0gMCwgZiA9IDAsIGcgPSAwOyBnIDwgYy5sZW5ndGg7ICsrZykgewogICAgICAgICAgICAgICAgICAgIHZhciBtID0gQShjLCBnKTsKICAgICAgICAgICAgICAgICAgICAwID4gbSA/ICctJyA9PSBjLmNoYXJBdChnKSAmJiAwID09IHRoaXMuc2lnbnVtKCkgJiYgKG4gPSAhMCkgOiAoZiA9IGUgKiBmICsgbSwgKytkID49IGggJiYgKHRoaXMuZE11bHRpcGx5KGIpLCB0aGlzLmRBZGRPZmZzZXQoZiwgMCksIGYgPSBkID0gMCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgMCA8IGQgJiYgKHRoaXMuZE11bHRpcGx5KE1hdGgucG93KGUsIGQpKSwgdGhpcy5kQWRkT2Zmc2V0KGYsIDApKTsKICAgICAgICAgICAgICAgIG4gJiYgYS5aRVJPLnN1YlRvKHRoaXMsIHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5mcm9tTnVtYmVyID0gZnVuY3Rpb24gKGMsIGUsIGgpIHsKICAgICAgICAgICAgICAgIGlmICgnbnVtYmVyJyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICBpZiAoMiA+IGMpCiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZnJvbUludCgxKTsKICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodGhpcy5mcm9tTnVtYmVyKGMsIGgpLCB0aGlzLnRlc3RCaXQoYyAtIDEpIHx8IHRoaXMuYml0d2lzZVRvKGEuT05FLnNoaWZ0TGVmdChjIC0gMSksIGYsIHRoaXMpLCB0aGlzLmlzRXZlbigpICYmIHRoaXMuZEFkZE9mZnNldCgxLCAwKTsgIXRoaXMuaXNQcm9iYWJsZVByaW1lKGUpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZEFkZE9mZnNldCgyLCAwKSwgdGhpcy5iaXRMZW5ndGgoKSA+IGMgJiYgdGhpcy5zdWJUbyhhLk9ORS5zaGlmdExlZnQoYyAtIDEpLCB0aGlzKTsKICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgIGggPSBbXTsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGMgJiA3OwogICAgICAgICAgICAgICAgICAgIGgubGVuZ3RoID0gKGMgPj4gMykgKyAxOwogICAgICAgICAgICAgICAgICAgIGUubmV4dEJ5dGVzKGgpOwogICAgICAgICAgICAgICAgICAgIGhbMF0gPSAwIDwgYiA/IGhbMF0gJiAoMSA8PCBiKSAtIDEgOiAwOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZnJvbVN0cmluZyhoLCAyNTYpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5iaXR3aXNlVG8gPSBmdW5jdGlvbiAoYywgYSwgaCkgewogICAgICAgICAgICAgICAgdmFyIGUsIG4gPSBNYXRoLm1pbihjLnQsIHRoaXMudCk7CiAgICAgICAgICAgICAgICBmb3IgKGUgPSAwOyBlIDwgbjsgKytlKQogICAgICAgICAgICAgICAgICAgIGhbZV0gPSBhKHRoaXNbZV0sIGNbZV0pOwogICAgICAgICAgICAgICAgaWYgKGMudCA8IHRoaXMudCkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gYy5zICYgdGhpcy5ETTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSBuOyBlIDwgdGhpcy50OyArK2UpCiAgICAgICAgICAgICAgICAgICAgICAgIGhbZV0gPSBhKHRoaXNbZV0sIGIpOwogICAgICAgICAgICAgICAgICAgIGgudCA9IHRoaXMudDsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IHRoaXMucyAmIHRoaXMuRE07CiAgICAgICAgICAgICAgICAgICAgZm9yIChlID0gbjsgZSA8IGMudDsgKytlKQogICAgICAgICAgICAgICAgICAgICAgICBoW2VdID0gYShiLCBjW2VdKTsKICAgICAgICAgICAgICAgICAgICBoLnQgPSBjLnQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBoLnMgPSBhKHRoaXMucywgYy5zKTsKICAgICAgICAgICAgICAgIGguY2xhbXAoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuY2hhbmdlQml0ID0gZnVuY3Rpb24gKGMsIGUpIHsKICAgICAgICAgICAgICAgIGMgPSBhLk9ORS5zaGlmdExlZnQoYyk7CiAgICAgICAgICAgICAgICB0aGlzLmJpdHdpc2VUbyhjLCBlLCBjKTsKICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5hZGRUbyA9IGZ1bmN0aW9uIChjLCBhKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gMCwgYiA9IDAsIG4gPSBNYXRoLm1pbihjLnQsIHRoaXMudCk7IGUgPCBuOykKICAgICAgICAgICAgICAgICAgICBiICs9IHRoaXNbZV0gKyBjW2VdLCBhW2UrK10gPSBiICYgdGhpcy5ETSwgYiA+Pj0gdGhpcy5EQjsKICAgICAgICAgICAgICAgIGlmIChjLnQgPCB0aGlzLnQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKGIgKz0gYy5zOyBlIDwgdGhpcy50OykKICAgICAgICAgICAgICAgICAgICAgICAgYiArPSB0aGlzW2VdLCBhW2UrK10gPSBiICYgdGhpcy5ETSwgYiA+Pj0gdGhpcy5EQjsKICAgICAgICAgICAgICAgICAgICBiICs9IHRoaXMuczsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZm9yIChiICs9IHRoaXMuczsgZSA8IGMudDspCiAgICAgICAgICAgICAgICAgICAgICAgIGIgKz0gY1tlXSwgYVtlKytdID0gYiAmIHRoaXMuRE0sIGIgPj49IHRoaXMuREI7CiAgICAgICAgICAgICAgICAgICAgYiArPSBjLnM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBhLnMgPSAwID4gYiA/IC0xIDogMDsKICAgICAgICAgICAgICAgIDAgPCBiID8gYVtlKytdID0gYiA6IC0xID4gYiAmJiAoYVtlKytdID0gdGhpcy5EViArIGIpOwogICAgICAgICAgICAgICAgYS50ID0gZTsKICAgICAgICAgICAgICAgIGEuY2xhbXAoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuZE11bHRpcGx5ID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIHRoaXNbdGhpcy50XSA9IHRoaXMuYW0oMCwgYyAtIDEsIHRoaXMsIDAsIDAsIHRoaXMudCk7CiAgICAgICAgICAgICAgICArK3RoaXMudDsKICAgICAgICAgICAgICAgIHRoaXMuY2xhbXAoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuZEFkZE9mZnNldCA9IGZ1bmN0aW9uIChjLCBhKSB7CiAgICAgICAgICAgICAgICBpZiAoMCAhPSBjKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICg7IHRoaXMudCA8PSBhOykKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t0aGlzLnQrK10gPSAwOwogICAgICAgICAgICAgICAgICAgIGZvciAodGhpc1thXSArPSBjOyB0aGlzW2FdID49IHRoaXMuRFY7KQogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW2FdIC09IHRoaXMuRFYsICsrYSA+PSB0aGlzLnQgJiYgKHRoaXNbdGhpcy50KytdID0gMCksICsrdGhpc1thXTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUubXVsdGlwbHlMb3dlclRvID0gZnVuY3Rpb24gKGMsIGEsIGgpIHsKICAgICAgICAgICAgICAgIHZhciBlID0gTWF0aC5taW4odGhpcy50ICsgYy50LCBhKTsKICAgICAgICAgICAgICAgIGgucyA9IDA7CiAgICAgICAgICAgICAgICBmb3IgKGgudCA9IGU7IDAgPCBlOykKICAgICAgICAgICAgICAgICAgICBoWy0tZV0gPSAwOwogICAgICAgICAgICAgICAgdmFyIGI7CiAgICAgICAgICAgICAgICBmb3IgKGIgPSBoLnQgLSB0aGlzLnQ7IGUgPCBiOyArK2UpCiAgICAgICAgICAgICAgICAgICAgaFtlICsgdGhpcy50XSA9IHRoaXMuYW0oMCwgY1tlXSwgaCwgZSwgMCwgdGhpcy50KTsKICAgICAgICAgICAgICAgIGZvciAoYiA9IE1hdGgubWluKGMudCwgYSk7IGUgPCBiOyArK2UpCiAgICAgICAgICAgICAgICAgICAgdGhpcy5hbSgwLCBjW2VdLCBoLCBlLCAwLCBhIC0gZSk7CiAgICAgICAgICAgICAgICBoLmNsYW1wKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLm11bHRpcGx5VXBwZXJUbyA9IGZ1bmN0aW9uIChjLCBhLCBoKSB7CiAgICAgICAgICAgICAgICAtLWE7CiAgICAgICAgICAgICAgICB2YXIgZSA9IGgudCA9IHRoaXMudCArIGMudCAtIGE7CiAgICAgICAgICAgICAgICBmb3IgKGgucyA9IDA7IDAgPD0gLS1lOykKICAgICAgICAgICAgICAgICAgICBoW2VdID0gMDsKICAgICAgICAgICAgICAgIGZvciAoZSA9IE1hdGgubWF4KGEgLSB0aGlzLnQsIDApOyBlIDwgYy50OyArK2UpCiAgICAgICAgICAgICAgICAgICAgaFt0aGlzLnQgKyBlIC0gYV0gPSB0aGlzLmFtKGEgLSBlLCBjW2VdLCBoLCAwLCAwLCB0aGlzLnQgKyBlIC0gYSk7CiAgICAgICAgICAgICAgICBoLmNsYW1wKCk7CiAgICAgICAgICAgICAgICBoLmRyU2hpZnRUbygxLCBoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUubW9kSW50ID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIGlmICgwID49IGMpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMuRFYgJSBjLCBoID0gMCA+IHRoaXMucyA/IGMgLSAxIDogMDsKICAgICAgICAgICAgICAgIGlmICgwIDwgdGhpcy50KQogICAgICAgICAgICAgICAgICAgIGlmICgwID09IGEpCiAgICAgICAgICAgICAgICAgICAgICAgIGggPSB0aGlzWzBdICUgYzsKICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSB0aGlzLnQgLSAxOyAwIDw9IGI7IC0tYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSAoYSAqIGggKyB0aGlzW2JdKSAlIGM7CiAgICAgICAgICAgICAgICByZXR1cm4gaDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUubWlsbGVyUmFiaW4gPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnN1YnRyYWN0KGEuT05FKSwgaCA9IGUuZ2V0TG93ZXN0U2V0Qml0KCk7CiAgICAgICAgICAgICAgICBpZiAoMCA+PSBoKQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIHZhciBiID0gZS5zaGlmdFJpZ2h0KGgpOwogICAgICAgICAgICAgICAgYyA9IGMgKyAxID4+IDE7CiAgICAgICAgICAgICAgICBjID4gTC5sZW5ndGggJiYgKGMgPSBMLmxlbmd0aCk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gaygpLCBkID0gMDsgZCA8IGM7ICsrZCkgewogICAgICAgICAgICAgICAgICAgIG4uZnJvbUludChMW01hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIEwubGVuZ3RoKV0pOwogICAgICAgICAgICAgICAgICAgIHZhciBmID0gbi5tb2RQb3coYiwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT0gZi5jb21wYXJlVG8oYS5PTkUpICYmIDAgIT0gZi5jb21wYXJlVG8oZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyA9IDE7IGcrKyA8IGggJiYgMCAhPSBmLmNvbXBhcmVUbyhlKTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZiA9IGYubW9kUG93SW50KDIsIHRoaXMpLCAwID09IGYuY29tcGFyZVRvKGEuT05FKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwICE9IGYuY29tcGFyZVRvKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuY2xvbmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IGsoKTsKICAgICAgICAgICAgICAgIHRoaXMuY29weVRvKGMpOwogICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmludFZhbHVlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKDAgPiB0aGlzLnMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSB0aGlzLnQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzWzBdIC0gdGhpcy5EVjsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSB0aGlzLnQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gdGhpcy50KQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1swXTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSB0aGlzLnQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuICh0aGlzWzFdICYgKDEgPDwgMzIgLSB0aGlzLkRCKSAtIDEpIDw8IHRoaXMuREIgfCB0aGlzWzBdOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5ieXRlVmFsdWUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMCA9PSB0aGlzLnQgPyB0aGlzLnMgOiB0aGlzWzBdIDw8IDI0ID4+IDI0OwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5zaG9ydFZhbHVlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIDAgPT0gdGhpcy50ID8gdGhpcy5zIDogdGhpc1swXSA8PCAxNiA+PiAxNjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuc2lnbnVtID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIDAgPiB0aGlzLnMgPyAtMSA6IDAgPj0gdGhpcy50IHx8IDEgPT0gdGhpcy50ICYmIDAgPj0gdGhpc1swXSA/IDAgOiAxOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS50b0J5dGVBcnJheSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gdGhpcy50LCBhID0gW107CiAgICAgICAgICAgICAgICBhWzBdID0gdGhpcy5zOwogICAgICAgICAgICAgICAgdmFyIGggPSB0aGlzLkRCIC0gYyAqIHRoaXMuREIgJSA4LCBiLCBuID0gMDsKICAgICAgICAgICAgICAgIGlmICgwIDwgYy0tKQogICAgICAgICAgICAgICAgICAgIGZvciAoaCA8IHRoaXMuREIgJiYgKGIgPSB0aGlzW2NdID4+IGgpICE9ICh0aGlzLnMgJiB0aGlzLkRNKSA+PiBoICYmIChhW24rK10gPSBiIHwgdGhpcy5zIDw8IHRoaXMuREIgLSBoKTsgMCA8PSBjOykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDggPiBoID8gKGIgPSAodGhpc1tjXSAmICgxIDw8IGgpIC0gMSkgPDwgOCAtIGgsIGIgfD0gdGhpc1stLWNdID4+IChoICs9IHRoaXMuREIgLSA4KSkgOiAoYiA9IHRoaXNbY10gPj4gKGggLT0gOCkgJiAyNTUsIDAgPj0gaCAmJiAoaCArPSB0aGlzLkRCLCAtLWMpKSwgMCAhPSAoYiAmIDEyOCkgJiYgKGIgfD0gLTI1NiksIDAgPT0gbiAmJiAodGhpcy5zICYgMTI4KSAhPSAoYiAmIDEyOCkgJiYgKytuLCAwIDwgbiB8fCBiICE9IHRoaXMucykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbbisrXSA9IGI7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuZXF1YWxzID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwID09IHRoaXMuY29tcGFyZVRvKGMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5taW4gPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgcmV0dXJuIDAgPiB0aGlzLmNvbXBhcmVUbyhjKSA/IHRoaXMgOiBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5tYXggPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgcmV0dXJuIDAgPCB0aGlzLmNvbXBhcmVUbyhjKSA/IHRoaXMgOiBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5hbmQgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgdmFyIGEgPSBrKCk7CiAgICAgICAgICAgICAgICB0aGlzLmJpdHdpc2VUbyhjLCBCLCBhKTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5vciA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IGsoKTsKICAgICAgICAgICAgICAgIHRoaXMuYml0d2lzZVRvKGMsIGYsIGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLnhvciA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IGsoKTsKICAgICAgICAgICAgICAgIHRoaXMuYml0d2lzZVRvKGMsIGcsIGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmFuZE5vdCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IGsoKTsKICAgICAgICAgICAgICAgIHRoaXMuYml0d2lzZVRvKGMsIEksIGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLm5vdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBrKCksIGEgPSAwOyBhIDwgdGhpcy50OyArK2EpCiAgICAgICAgICAgICAgICAgICAgY1thXSA9IHRoaXMuRE0gJiB+dGhpc1thXTsKICAgICAgICAgICAgICAgIGMudCA9IHRoaXMudDsKICAgICAgICAgICAgICAgIGMucyA9IH50aGlzLnM7CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuc2hpZnRMZWZ0ID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gaygpOwogICAgICAgICAgICAgICAgMCA+IGMgPyB0aGlzLnJTaGlmdFRvKC1jLCBhKSA6IHRoaXMubFNoaWZ0VG8oYywgYSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuc2hpZnRSaWdodCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IGsoKTsKICAgICAgICAgICAgICAgIDAgPiBjID8gdGhpcy5sU2hpZnRUbygtYywgYSkgOiB0aGlzLnJTaGlmdFRvKGMsIGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmdldExvd2VzdFNldEJpdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwOyBjIDwgdGhpcy50OyArK2MpCiAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT0gdGhpc1tjXSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGMgKiB0aGlzLkRCOwogICAgICAgICAgICAgICAgICAgICAgICBjID0gdGhpc1tjXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAtMTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwID09IChjICYgNjU1MzUpICYmIChjID4+PSAxNiwgYiArPSAxNik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwID09IChjICYgMjU1KSAmJiAoYyA+Pj0gOCwgYiArPSA4KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPT0gKGMgJiAxNSkgJiYgKGMgPj49IDQsIGIgKz0gNCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwID09IChjICYgMykgJiYgKGMgPj49IDIsIGIgKz0gMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwID09IChjICYgMSkgJiYgKytiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgKyBjOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiAwID4gdGhpcy5zID8gdGhpcy50ICogdGhpcy5EQiA6IC0xOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5iaXRDb3VudCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwLCBhID0gdGhpcy5zICYgdGhpcy5ETSwgYiA9IDA7IGIgPCB0aGlzLnQ7ICsrYikgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSB0aGlzW2JdIF4gYSwgbiA9IDA7IDAgIT0gZDspCiAgICAgICAgICAgICAgICAgICAgICAgIGQgJj0gZCAtIDEsICsrbjsKICAgICAgICAgICAgICAgICAgICBjICs9IG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUudGVzdEJpdCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IE1hdGguZmxvb3IoYyAvIHRoaXMuREIpOwogICAgICAgICAgICAgICAgcmV0dXJuIGEgPj0gdGhpcy50ID8gMCAhPSB0aGlzLnMgOiAwICE9ICh0aGlzW2FdICYgMSA8PCBjICUgdGhpcy5EQik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLnNldEJpdCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jaGFuZ2VCaXQoYywgZik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmNsZWFyQml0ID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNoYW5nZUJpdChjLCBJKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuZmxpcEJpdCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jaGFuZ2VCaXQoYywgZyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IGsoKTsKICAgICAgICAgICAgICAgIHRoaXMuYWRkVG8oYywgYSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuc3VidHJhY3QgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgdmFyIGEgPSBrKCk7CiAgICAgICAgICAgICAgICB0aGlzLnN1YlRvKGMsIGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLm11bHRpcGx5ID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gaygpOwogICAgICAgICAgICAgICAgdGhpcy5tdWx0aXBseVRvKGMsIGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmRpdmlkZSA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IGsoKTsKICAgICAgICAgICAgICAgIHRoaXMuZGl2UmVtVG8oYywgYSwgbnVsbCk7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUucmVtYWluZGVyID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gaygpOwogICAgICAgICAgICAgICAgdGhpcy5kaXZSZW1UbyhjLCBudWxsLCBhKTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5kaXZpZGVBbmRSZW1haW5kZXIgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgdmFyIGEgPSBrKCksIGIgPSBrKCk7CiAgICAgICAgICAgICAgICB0aGlzLmRpdlJlbVRvKGMsIGEsIGIpOwogICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICBhLAogICAgICAgICAgICAgICAgICAgIGIKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLm1vZFBvdyA9IGZ1bmN0aW9uIChjLCBhKSB7CiAgICAgICAgICAgICAgICB2YXIgZSA9IGMuYml0TGVuZ3RoKCksIGIgPSBDKDEpOwogICAgICAgICAgICAgICAgaWYgKDAgPj0gZSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIHZhciBuID0gMTggPiBlID8gMSA6IDQ4ID4gZSA/IDMgOiAxNDQgPiBlID8gNCA6IDc2OCA+IGUgPyA1IDogNjsKICAgICAgICAgICAgICAgIGEgPSA4ID4gZSA/IG5ldyBsKGEpIDogYS5pc0V2ZW4oKSA/IG5ldyBtKGEpIDogbmV3IEYoYSk7CiAgICAgICAgICAgICAgICB2YXIgZCA9IFtdLCBmID0gMywgZyA9IG4gLSAxLCBxID0gKDEgPDwgbikgLSAxOwogICAgICAgICAgICAgICAgZFsxXSA9IGEuY29udmVydCh0aGlzKTsKICAgICAgICAgICAgICAgIGlmICgxIDwgbikKICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSBrKCksIGEuc3FyVG8oZFsxXSwgZSk7IGYgPD0gcTspCiAgICAgICAgICAgICAgICAgICAgICAgIGRbZl0gPSBrKCksIGEubXVsVG8oZSwgZFtmIC0gMl0sIGRbZl0pLCBmICs9IDI7CiAgICAgICAgICAgICAgICB2YXIgcCA9IGMudCAtIDEsIHIgPSAhMCwgdCA9IGsoKTsKICAgICAgICAgICAgICAgIGZvciAoZSA9IHooY1twXSkgLSAxOyAwIDw9IHA7KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUgPj0gZykKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEIgPSBjW3BdID4+IGUgLSBnICYgcTsKICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIEIgPSAoY1twXSAmICgxIDw8IGUgKyAxKSAtIDEpIDw8IGcgLSBlLCAwIDwgcCAmJiAoQiB8PSBjW3AgLSAxXSA+PiB0aGlzLkRCICsgZSAtIGcpOwogICAgICAgICAgICAgICAgICAgIGZvciAoZiA9IG47IDAgPT0gKEIgJiAxKTspCiAgICAgICAgICAgICAgICAgICAgICAgIEIgPj49IDEsIC0tZjsKICAgICAgICAgICAgICAgICAgICAwID4gKGUgLT0gZikgJiYgKGUgKz0gdGhpcy5EQiwgLS1wKTsKICAgICAgICAgICAgICAgICAgICBpZiAocikKICAgICAgICAgICAgICAgICAgICAgICAgZFtCXS5jb3B5VG8oYiksIHIgPSAhMTsKICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IDEgPCBmOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuc3FyVG8oYiwgdCksIGEuc3FyVG8odCwgYiksIGYgLT0gMjsKICAgICAgICAgICAgICAgICAgICAgICAgMCA8IGYgPyBhLnNxclRvKGIsIHQpIDogKGYgPSBiLCBiID0gdCwgdCA9IGYpOwogICAgICAgICAgICAgICAgICAgICAgICBhLm11bFRvKHQsIGRbQl0sIGIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmb3IgKDsgMCA8PSBwICYmIDAgPT0gKGNbcF0gJiAxIDw8IGUpOykKICAgICAgICAgICAgICAgICAgICAgICAgYS5zcXJUbyhiLCB0KSwgZiA9IGIsIGIgPSB0LCB0ID0gZiwgMCA+IC0tZSAmJiAoZSA9IHRoaXMuREIgLSAxLCAtLXApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGEucmV2ZXJ0KGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhLnByb3RvdHlwZS5tb2RJbnZlcnNlID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgIHZhciBlID0gYy5pc0V2ZW4oKTsKICAgICAgICAgICAgICAgIGlmICh0aGlzLmlzRXZlbigpICYmIGUgfHwgMCA9PSBjLnNpZ251bSgpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLlpFUk87CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gYy5jbG9uZSgpLCBkID0gdGhpcy5jbG9uZSgpLCBuID0gQygxKSwgZiA9IEMoMCksIFIgPSBDKDApLCBnID0gQygxKTsgMCAhPSBiLnNpZ251bSgpOykgewogICAgICAgICAgICAgICAgICAgIGZvciAoOyBiLmlzRXZlbigpOykKICAgICAgICAgICAgICAgICAgICAgICAgYi5yU2hpZnRUbygxLCBiKSwgZSA/IChuLmlzRXZlbigpICYmIGYuaXNFdmVuKCkgfHwgKG4uYWRkVG8odGhpcywgbiksIGYuc3ViVG8oYywgZikpLCBuLnJTaGlmdFRvKDEsIG4pKSA6IGYuaXNFdmVuKCkgfHwgZi5zdWJUbyhjLCBmKSwgZi5yU2hpZnRUbygxLCBmKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZC5pc0V2ZW4oKTspCiAgICAgICAgICAgICAgICAgICAgICAgIGQuclNoaWZ0VG8oMSwgZCksIGUgPyAoUi5pc0V2ZW4oKSAmJiBnLmlzRXZlbigpIHx8IChSLmFkZFRvKHRoaXMsIFIpLCBnLnN1YlRvKGMsIGcpKSwgUi5yU2hpZnRUbygxLCBSKSkgOiBnLmlzRXZlbigpIHx8IGcuc3ViVG8oYywgZyksIGcuclNoaWZ0VG8oMSwgZyk7CiAgICAgICAgICAgICAgICAgICAgMCA8PSBiLmNvbXBhcmVUbyhkKSA/IChiLnN1YlRvKGQsIGIpLCBlICYmIG4uc3ViVG8oUiwgbiksIGYuc3ViVG8oZywgZikpIDogKGQuc3ViVG8oYiwgZCksIGUgJiYgUi5zdWJUbyhuLCBSKSwgZy5zdWJUbyhmLCBnKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoMCAhPSBkLmNvbXBhcmVUbyhhLk9ORSkpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuWkVSTzsKICAgICAgICAgICAgICAgIGlmICgwIDw9IGcuY29tcGFyZVRvKGMpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBnLnN1YnRyYWN0KGMpOwogICAgICAgICAgICAgICAgaWYgKDAgPiBnLnNpZ251bSgpKQogICAgICAgICAgICAgICAgICAgIGcuYWRkVG8oYywgZyk7CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGc7CiAgICAgICAgICAgICAgICByZXR1cm4gMCA+IGcuc2lnbnVtKCkgPyBnLmFkZChjKSA6IGc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLnBvdyA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5leHAoYywgbmV3IHQoKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLmdjZCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IDAgPiB0aGlzLnMgPyB0aGlzLm5lZ2F0ZSgpIDogdGhpcy5jbG9uZSgpOwogICAgICAgICAgICAgICAgYyA9IDAgPiBjLnMgPyBjLm5lZ2F0ZSgpIDogYy5jbG9uZSgpOwogICAgICAgICAgICAgICAgaWYgKDAgPiBhLmNvbXBhcmVUbyhjKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gYTsKICAgICAgICAgICAgICAgICAgICBhID0gYzsKICAgICAgICAgICAgICAgICAgICBjID0gYjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGIgPSBhLmdldExvd2VzdFNldEJpdCgpOwogICAgICAgICAgICAgICAgdmFyIGQgPSBjLmdldExvd2VzdFNldEJpdCgpOwogICAgICAgICAgICAgICAgaWYgKDAgPiBkKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgYiA8IGQgJiYgKGQgPSBiKTsKICAgICAgICAgICAgICAgIDAgPCBkICYmIChhLnJTaGlmdFRvKGQsIGEpLCBjLnJTaGlmdFRvKGQsIGMpKTsKICAgICAgICAgICAgICAgIGZvciAoOyAwIDwgYS5zaWdudW0oKTspCiAgICAgICAgICAgICAgICAgICAgMCA8IChiID0gYS5nZXRMb3dlc3RTZXRCaXQoKSkgJiYgYS5yU2hpZnRUbyhiLCBhKSwgMCA8IChiID0gYy5nZXRMb3dlc3RTZXRCaXQoKSkgJiYgYy5yU2hpZnRUbyhiLCBjKSwgMCA8PSBhLmNvbXBhcmVUbyhjKSA/IChhLnN1YlRvKGMsIGEpLCBhLnJTaGlmdFRvKDEsIGEpKSA6IChjLnN1YlRvKGEsIGMpLCBjLnJTaGlmdFRvKDEsIGMpKTsKICAgICAgICAgICAgICAgIDAgPCBkICYmIGMubFNoaWZ0VG8oZCwgYyk7CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYS5wcm90b3R5cGUuaXNQcm9iYWJsZVByaW1lID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBjLCBiID0gdGhpcy5hYnMoKTsKICAgICAgICAgICAgICAgIGlmICgxID09IGIudCAmJiBiWzBdIDw9IExbTC5sZW5ndGggLSAxXSkgewogICAgICAgICAgICAgICAgICAgIGZvciAoYyA9IDA7IGMgPCBMLmxlbmd0aDsgKytjKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYlswXSA9PSBMW2NdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChiLmlzRXZlbigpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIGZvciAoYyA9IDE7IGMgPCBMLmxlbmd0aDspIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gTFtjXSwgbiA9IGMgKyAxOyBuIDwgTC5sZW5ndGggJiYgZCA8IHk7KQogICAgICAgICAgICAgICAgICAgICAgICBkICo9IExbbisrXTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGQgPSBiLm1vZEludChkKTsgYyA8IG47KQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSBkICUgTFtjKytdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGIubWlsbGVyUmFiaW4oYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGEucHJvdG90eXBlLnNxdWFyZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gaygpOwogICAgICAgICAgICAgICAgdGhpcy5zcXVhcmVUbyhhKTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICBNLnByb3RvdHlwZS5pbml0ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBjLCBiOwogICAgICAgICAgICAgICAgZm9yIChjID0gMDsgMjU2ID4gYzsgKytjKQogICAgICAgICAgICAgICAgICAgIHRoaXMuU1tjXSA9IGM7CiAgICAgICAgICAgICAgICBmb3IgKGMgPSBiID0gMDsgMjU2ID4gYzsgKytjKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IGIgKyB0aGlzLlNbY10gKyBhW2MgJSBhLmxlbmd0aF0gJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB0aGlzLlNbY107CiAgICAgICAgICAgICAgICAgICAgdGhpcy5TW2NdID0gdGhpcy5TW2JdOwogICAgICAgICAgICAgICAgICAgIHRoaXMuU1tiXSA9IGQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0aGlzLmogPSB0aGlzLmkgPSAwOwogICAgICAgICAgICB9OwogICAgICAgICAgICBNLnByb3RvdHlwZS5uZXh0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5pID0gdGhpcy5pICsgMSAmIDI1NTsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IHRoaXMuaiArIHRoaXMuU1t0aGlzLmldICYgMjU1OwogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLlNbdGhpcy5pXTsKICAgICAgICAgICAgICAgIHRoaXMuU1t0aGlzLmldID0gdGhpcy5TW3RoaXMual07CiAgICAgICAgICAgICAgICB0aGlzLlNbdGhpcy5qXSA9IGE7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5TW2EgKyB0aGlzLlNbdGhpcy5pXSAmIDI1NV07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBPOwogICAgICAgICAgICBpZiAobnVsbCA9PSBwKSB7CiAgICAgICAgICAgICAgICB2YXIgcCA9IFtdOwogICAgICAgICAgICAgICAgdmFyIHEgPSAwOwogICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5jcnlwdG8gJiYgd2luZG93LmNyeXB0by5nZXRSYW5kb21WYWx1ZXMpCiAgICAgICAgICAgICAgICAgICAgZm9yIChFID0gbmV3IFVpbnQzMkFycmF5KDI1NiksIHdpbmRvdy5jcnlwdG8uZ2V0UmFuZG9tVmFsdWVzKEUpLCBiID0gMDsgYiA8IEUubGVuZ3RoOyArK2IpCiAgICAgICAgICAgICAgICAgICAgICAgIHBbcSsrXSA9IEVbYl0gJiAyNTU7CiAgICAgICAgICAgICAgICB2YXIgciA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb3VudCA9IHRoaXMuY291bnQgfHwgMDsKICAgICAgICAgICAgICAgICAgICBpZiAoMjU2IDw9IHRoaXMuY291bnQgfHwgMjU2IDw9IHEpCiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5yZW1vdmVFdmVudExpc3RlbmVyID8gd2luZG93LnJlbW92ZUV2ZW50TGlzdGVuZXIoJ21vdXNlbW92ZScsIHIsICExKSA6IHdpbmRvdy5kZXRhY2hFdmVudCAmJiB3aW5kb3cuZGV0YWNoRXZlbnQoJ29ubW91c2Vtb3ZlJywgcik7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLnggKyBhLnk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwW3ErK10gPSBjICYgMjU1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb3VudCArPSAxOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lciA/IHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdtb3VzZW1vdmUnLCByLCAhMSkgOiB3aW5kb3cuYXR0YWNoRXZlbnQgJiYgd2luZG93LmF0dGFjaEV2ZW50KCdvbm1vdXNlbW92ZScsIHIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIEsucHJvdG90eXBlLm5leHRCeXRlcyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgIGZvciAoYyA9IDA7IGMgPCBhLmxlbmd0aDsgKytjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBjOwogICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IE8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChPID0gbmV3IE0oKTsgMjU2ID4gcTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gTWF0aC5mbG9vcig2NTUzNiAqIE1hdGgucmFuZG9tKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcFtxKytdID0gZCAmIDI1NTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBPLmluaXQocCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocSA9IDA7IHEgPCBwLmxlbmd0aDsgKytxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcFtxXSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHEgPSAwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBkID0gTy5uZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgYVtiXSA9IGQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEcucHJvdG90eXBlLmRvUHVibGljID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhLm1vZFBvd0ludCh0aGlzLmUsIHRoaXMubik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEcucHJvdG90eXBlLnNldFB1YmxpYyA9IGZ1bmN0aW9uIChhLCBlKSB7CiAgICAgICAgICAgICAgICBudWxsICE9IGEgJiYgbnVsbCAhPSBlICYmIDAgPCBhLmxlbmd0aCAmJiAwIDwgZS5sZW5ndGggPyAodGhpcy5uID0gSihhLCAxNiksIHRoaXMuZSA9IHBhcnNlSW50KGUsIDE2KSkgOiBjb25zb2xlLmVycm9yKCdJbnZhbGlkIFJTQSBwdWJsaWMga2V5Jyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEcucHJvdG90eXBlLmVuY3J5cHQgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLm4uYml0TGVuZ3RoKCkgKyA3ID4+IDM7CiAgICAgICAgICAgICAgICBpZiAoZSA8IGMubGVuZ3RoICsgMTEpCiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcignTWVzc2FnZSB0b28gbG9uZyBmb3IgUlNBJyksIGUgPSBudWxsOwogICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IFtdLCBkID0gYy5sZW5ndGggLSAxOyAwIDw9IGQgJiYgMCA8IGU7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYy5jaGFyQ29kZUF0KGQtLSk7CiAgICAgICAgICAgICAgICAgICAgICAgIDEyOCA+IG4gPyBiWy0tZV0gPSBuIDogMTI3IDwgbiAmJiAyMDQ4ID4gbiA/IChiWy0tZV0gPSBuICYgNjMgfCAxMjgsIGJbLS1lXSA9IG4gPj4gNiB8IDE5MikgOiAoYlstLWVdID0gbiAmIDYzIHwgMTI4LCBiWy0tZV0gPSBuID4+IDYgJiA2MyB8IDEyOCwgYlstLWVdID0gbiA+PiAxMiB8IDIyNCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGJbLS1lXSA9IDA7CiAgICAgICAgICAgICAgICAgICAgYyA9IG5ldyBLKCk7CiAgICAgICAgICAgICAgICAgICAgZm9yIChkID0gW107IDIgPCBlOykgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGRbMF0gPSAwOyAwID09IGRbMF07KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5uZXh0Qnl0ZXMoZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJbLS1lXSA9IGRbMF07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGJbLS1lXSA9IDI7CiAgICAgICAgICAgICAgICAgICAgYlstLWVdID0gMDsKICAgICAgICAgICAgICAgICAgICBlID0gbmV3IGEoYik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgZSA9IHRoaXMuZG9QdWJsaWMoZSk7CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgZSA9IGUudG9TdHJpbmcoMTYpOwogICAgICAgICAgICAgICAgcmV0dXJuIDAgPT0gKGUubGVuZ3RoICYgMSkgPyBlIDogJzAnICsgZTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRy5wcm90b3R5cGUuZG9Qcml2YXRlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmIChudWxsID09IHRoaXMucCB8fCBudWxsID09IHRoaXMucSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5tb2RQb3codGhpcy5kLCB0aGlzLm4pOwogICAgICAgICAgICAgICAgdmFyIGMgPSBhLm1vZCh0aGlzLnApLm1vZFBvdyh0aGlzLmRtcDEsIHRoaXMucCk7CiAgICAgICAgICAgICAgICBmb3IgKGEgPSBhLm1vZCh0aGlzLnEpLm1vZFBvdyh0aGlzLmRtcTEsIHRoaXMucSk7IDAgPiBjLmNvbXBhcmVUbyhhKTspCiAgICAgICAgICAgICAgICAgICAgYyA9IGMuYWRkKHRoaXMucCk7CiAgICAgICAgICAgICAgICByZXR1cm4gYy5zdWJ0cmFjdChhKS5tdWx0aXBseSh0aGlzLmNvZWZmKS5tb2QodGhpcy5wKS5tdWx0aXBseSh0aGlzLnEpLmFkZChhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRy5wcm90b3R5cGUuc2V0UHJpdmF0ZSA9IGZ1bmN0aW9uIChhLCBlLCBiKSB7CiAgICAgICAgICAgICAgICBudWxsICE9IGEgJiYgbnVsbCAhPSBlICYmIDAgPCBhLmxlbmd0aCAmJiAwIDwgZS5sZW5ndGggPyAodGhpcy5uID0gSihhLCAxNiksIHRoaXMuZSA9IHBhcnNlSW50KGUsIDE2KSwgdGhpcy5kID0gSihiLCAxNikpIDogY29uc29sZS5lcnJvcignSW52YWxpZCBSU0EgcHJpdmF0ZSBrZXknKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRy5wcm90b3R5cGUuc2V0UHJpdmF0ZUV4ID0gZnVuY3Rpb24gKGEsIGUsIGIsIGQsIG4sIGYsIGcsIG0pIHsKICAgICAgICAgICAgICAgIG51bGwgIT0gYSAmJiBudWxsICE9IGUgJiYgMCA8IGEubGVuZ3RoICYmIDAgPCBlLmxlbmd0aCA/ICh0aGlzLm4gPSBKKGEsIDE2KSwgdGhpcy5lID0gcGFyc2VJbnQoZSwgMTYpLCB0aGlzLmQgPSBKKGIsIDE2KSwgdGhpcy5wID0gSihkLCAxNiksIHRoaXMucSA9IEoobiwgMTYpLCB0aGlzLmRtcDEgPSBKKGYsIDE2KSwgdGhpcy5kbXExID0gSihnLCAxNiksIHRoaXMuY29lZmYgPSBKKG0sIDE2KSkgOiBjb25zb2xlLmVycm9yKCdJbnZhbGlkIFJTQSBwcml2YXRlIGtleScpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBHLnByb3RvdHlwZS5nZW5lcmF0ZSA9IGZ1bmN0aW9uIChjLCBlKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IG5ldyBLKCksIGQgPSBjID4+IDE7CiAgICAgICAgICAgICAgICB0aGlzLmUgPSBwYXJzZUludChlLCAxNik7CiAgICAgICAgICAgICAgICBmb3IgKGUgPSBuZXcgYShlLCAxNik7OykgewogICAgICAgICAgICAgICAgICAgIGZvciAoOyB0aGlzLnAgPSBuZXcgYShjIC0gZCwgMSwgYiksIDAgIT0gdGhpcy5wLnN1YnRyYWN0KGEuT05FKS5nY2QoZSkuY29tcGFyZVRvKGEuT05FKSB8fCAhdGhpcy5wLmlzUHJvYmFibGVQcmltZSgxMCk7KTsKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgdGhpcy5xID0gbmV3IGEoZCwgMSwgYiksIDAgIT0gdGhpcy5xLnN1YnRyYWN0KGEuT05FKS5nY2QoZSkuY29tcGFyZVRvKGEuT05FKSB8fCAhdGhpcy5xLmlzUHJvYmFibGVQcmltZSgxMCk7KTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA+PSB0aGlzLnAuY29tcGFyZVRvKHRoaXMucSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzLnA7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucCA9IHRoaXMucTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5xID0gbjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbiA9IHRoaXMucC5zdWJ0cmFjdChhLk9ORSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSB0aGlzLnEuc3VidHJhY3QoYS5PTkUpLCBnID0gbi5tdWx0aXBseShmKTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSBnLmdjZChlKS5jb21wYXJlVG8oYS5PTkUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubiA9IHRoaXMucC5tdWx0aXBseSh0aGlzLnEpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmQgPSBlLm1vZEludmVyc2UoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZG1wMSA9IHRoaXMuZC5tb2Qobik7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZG1xMSA9IHRoaXMuZC5tb2QoZik7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29lZmYgPSB0aGlzLnEubW9kSW52ZXJzZSh0aGlzLnApOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEcucHJvdG90eXBlLmRlY3J5cHQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYSA9IEooYSwgMTYpOwogICAgICAgICAgICAgICAgYSA9IHRoaXMuZG9Qcml2YXRlKGEpOwogICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHRoaXMubi5iaXRMZW5ndGgoKSArIDcgPj4gMzsKICAgICAgICAgICAgICAgICAgICBhID0gYS50b0J5dGVBcnJheSgpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSAwOyBiIDwgYS5sZW5ndGggJiYgMCA9PSBhW2JdOykKICAgICAgICAgICAgICAgICAgICAgICAgKytiOwogICAgICAgICAgICAgICAgICAgIGlmIChhLmxlbmd0aCAtIGIgIT0gYyAtIDEgfHwgMiAhPSBhW2JdKQogICAgICAgICAgICAgICAgICAgICAgICBhID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICgrK2I7IDAgIT0gYVtiXTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKytiID49IGEubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjID0gJyc7ICsrYiA8IGEubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhW2JdICYgMjU1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTI4ID4gZCA/IGMgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShkKSA6IDE5MSA8IGQgJiYgMjI0ID4gZCA/IChjICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoKGQgJiAzMSkgPDwgNiB8IGFbYiArIDFdICYgNjMpLCArK2IpIDogKGMgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSgoZCAmIDE1KSA8PCAxMiB8IChhW2IgKyAxXSAmIDYzKSA8PCA2IHwgYVtiICsgMl0gJiA2MyksIGIgKz0gMik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGM7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBHLnByb3RvdHlwZS5nZW5lcmF0ZUFzeW5jID0gZnVuY3Rpb24gKGMsIGUsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IG5ldyBLKCksIG4gPSBjID4+IDE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5lID0gcGFyc2VJbnQoZSwgMTYpOwogICAgICAgICAgICAgICAgICAgIHZhciBmID0gbmV3IGEoZSwgMTYpLCBoID0gdGhpcywgZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA+PSBoLnAuY29tcGFyZVRvKGgucSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gaC5wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5wID0gaC5xOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5xID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gaC5wLnN1YnRyYWN0KGEuT05FKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBoLnEuc3VidHJhY3QoYS5PTkUpLCBkID0gYy5tdWx0aXBseShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCA9PSBkLmdjZChmKS5jb21wYXJlVG8oYS5PTkUpID8gKGgubiA9IGgucC5tdWx0aXBseShoLnEpLCBoLmQgPSBmLm1vZEludmVyc2UoZCksIGguZG1wMSA9IGguZC5tb2QoYyksIGguZG1xMSA9IGguZC5tb2QoZSksIGguY29lZmYgPSBoLnEubW9kSW52ZXJzZShoLnApLCBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMCkpIDogc2V0VGltZW91dChnLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB1ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLnEgPSBrKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgucS5mcm9tTnVtYmVyQXN5bmMobiwgMSwgZCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5xLnN1YnRyYWN0KGEuT05FKS5nY2RhKGYsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCA9PSBjLmNvbXBhcmVUbyhhLk9ORSkgJiYgaC5xLmlzUHJvYmFibGVQcmltZSgxMCkgPyBzZXRUaW1lb3V0KGUsIDApIDogc2V0VGltZW91dCh1LCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBRID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLnAgPSBrKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgucC5mcm9tTnVtYmVyQXN5bmMoYyAtIG4sIDEsIGQsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgucC5zdWJ0cmFjdChhLk9ORSkuZ2NkYShmLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPT0gYy5jb21wYXJlVG8oYS5PTkUpICYmIGgucC5pc1Byb2JhYmxlUHJpbWUoMTApID8gc2V0VGltZW91dCh1LCAwKSA6IHNldFRpbWVvdXQoUSwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoUSwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChnLCAwKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBhLnByb3RvdHlwZS5nY2RhID0gZnVuY3Rpb24gKGEsIGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IDAgPiB0aGlzLnMgPyB0aGlzLm5lZ2F0ZSgpIDogdGhpcy5jbG9uZSgpLCBiID0gMCA+IGEucyA/IGEubmVnYXRlKCkgOiBhLmNsb25lKCk7CiAgICAgICAgICAgICAgICAgICAgMCA+IGMuY29tcGFyZVRvKGIpICYmIChhID0gYywgYyA9IGIsIGIgPSBhKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGMuZ2V0TG93ZXN0U2V0Qml0KCksIGYgPSBiLmdldExvd2VzdFNldEJpdCgpOwogICAgICAgICAgICAgICAgICAgIGlmICgwID4gZikKICAgICAgICAgICAgICAgICAgICAgICAgZShjKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgZCA8IGYgJiYgKGYgPSBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgMCA8IGYgJiYgKGMuclNoaWZ0VG8oZiwgYyksIGIuclNoaWZ0VG8oZiwgYikpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPCAoZCA9IGMuZ2V0TG93ZXN0U2V0Qml0KCkpICYmIGMuclNoaWZ0VG8oZCwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwIDwgKGQgPSBiLmdldExvd2VzdFNldEJpdCgpKSAmJiBiLnJTaGlmdFRvKGQsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMCA8PSBjLmNvbXBhcmVUbyhiKSA/IChjLnN1YlRvKGIsIGMpLCBjLnJTaGlmdFRvKDEsIGMpKSA6IChiLnN1YlRvKGMsIGIpLCBiLnJTaGlmdFRvKDEsIGIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPCBjLnNpZ251bSgpID8gc2V0VGltZW91dChnLCAwKSA6ICgwIDwgZiAmJiBiLmxTaGlmdFRvKGYsIGIpLCBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGcsIDEwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYS5wcm90b3R5cGUuZnJvbU51bWJlckFzeW5jID0gZnVuY3Rpb24gKGMsIGUsIGIsIGQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ251bWJlcicgPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgyID4gYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZnJvbUludCgxKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZyb21OdW1iZXIoYywgYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnRlc3RCaXQoYyAtIDEpIHx8IHRoaXMuYml0d2lzZVRvKGEuT05FLnNoaWZ0TGVmdChjIC0gMSksIGYsIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pc0V2ZW4oKSAmJiB0aGlzLmRBZGRPZmZzZXQoMSwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMsIGggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uZEFkZE9mZnNldCgyLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5iaXRMZW5ndGgoKSA+IGMgJiYgbi5zdWJUbyhhLk9ORS5zaGlmdExlZnQoYyAtIDEpLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5pc1Byb2JhYmxlUHJpbWUoZSkgPyBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMCkgOiBzZXRUaW1lb3V0KGgsIDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGgsIDApOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBjICYgNzsKICAgICAgICAgICAgICAgICAgICAgICAgYi5sZW5ndGggPSAoYyA+PiAzKSArIDE7CiAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dEJ5dGVzKGIpOwogICAgICAgICAgICAgICAgICAgICAgICBiWzBdID0gMCA8IGcgPyBiWzBdICYgKDEgPDwgZykgLSAxIDogMDsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5mcm9tU3RyaW5nKGIsIDI1Nik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgdmFyIEQgPSBEIHx8IHt9OwogICAgICAgICAgICBELmVudiA9IEQuZW52IHx8IHt9OwogICAgICAgICAgICB2YXIgVSA9IEQsIFMgPSBPYmplY3QucHJvdG90eXBlLCBYID0gWwogICAgICAgICAgICAgICAgICAgICd0b1N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgJ3ZhbHVlT2YnCiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICBELmVudi5wYXJzZVVBID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VGbG9hdChhLnJlcGxhY2UoL1wuL2csIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxID09IGMrKyA/ICcnIDogJy4nOwogICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgfSwgYiA9IG5hdmlnYXRvcjsKICAgICAgICAgICAgICAgIGIgPSB7CiAgICAgICAgICAgICAgICAgICAgaWU6IDAsCiAgICAgICAgICAgICAgICAgICAgb3BlcmE6IDAsCiAgICAgICAgICAgICAgICAgICAgZ2Vja286IDAsCiAgICAgICAgICAgICAgICAgICAgd2Via2l0OiAwLAogICAgICAgICAgICAgICAgICAgIGNocm9tZTogMCwKICAgICAgICAgICAgICAgICAgICBtb2JpbGU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgYWlyOiAwLAogICAgICAgICAgICAgICAgICAgIGlwYWQ6IDAsCiAgICAgICAgICAgICAgICAgICAgaXBob25lOiAwLAogICAgICAgICAgICAgICAgICAgIGlwb2Q6IDAsCiAgICAgICAgICAgICAgICAgICAgaW9zOiBudWxsLAogICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6IDAsCiAgICAgICAgICAgICAgICAgICAgd2Vib3M6IDAsCiAgICAgICAgICAgICAgICAgICAgY2FqYTogYiAmJiBiLmNhamFWZXJzaW9uLAogICAgICAgICAgICAgICAgICAgIHNlY3VyZTogITEsCiAgICAgICAgICAgICAgICAgICAgb3M6IG51bGwKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBhID0gYSB8fCBuYXZpZ2F0b3IgJiYgbmF2aWdhdG9yLnVzZXJBZ2VudDsKICAgICAgICAgICAgICAgIHZhciBkID0gd2luZG93ICYmIHdpbmRvdy5sb2NhdGlvbjsKICAgICAgICAgICAgICAgIGQgPSBkICYmIGQuaHJlZjsKICAgICAgICAgICAgICAgIGIuc2VjdXJlID0gZCAmJiAwID09PSBkLnRvTG93ZXJDYXNlKCkuaW5kZXhPZignaHR0cHMnKTsKICAgICAgICAgICAgICAgIGlmIChhKSB7CiAgICAgICAgICAgICAgICAgICAgL3dpbmRvd3N8d2luMzIvaS50ZXN0KGEpID8gYi5vcyA9ICd3aW5kb3dzJyA6IC9tYWNpbnRvc2gvaS50ZXN0KGEpID8gYi5vcyA9ICdtYWNpbnRvc2gnIDogL3JoaW5vL2kudGVzdChhKSAmJiAoYi5vcyA9ICdyaGlubycpOwogICAgICAgICAgICAgICAgICAgIC9LSFRNTC8udGVzdChhKSAmJiAoYi53ZWJraXQgPSAxKTsKICAgICAgICAgICAgICAgICAgICBpZiAoKGQgPSBhLm1hdGNoKC9BcHBsZVdlYktpdFwvKFteXHNdKikvKSkgJiYgZFsxXSkgewogICAgICAgICAgICAgICAgICAgICAgICBiLndlYmtpdCA9IGMoZFsxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgvIE1vYmlsZVwvLy50ZXN0KGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5tb2JpbGUgPSAnQXBwbGUnLCAoZCA9IGEubWF0Y2goL09TIChbXlxzXSopLykpICYmIGRbMV0gJiYgKGQgPSBjKGRbMV0ucmVwbGFjZSgnXycsICcuJykpKSwgYi5pb3MgPSBkLCBiLmlwYWQgPSBiLmlwb2QgPSBiLmlwaG9uZSA9IDAsIChkID0gYS5tYXRjaCgvaVBhZHxpUG9kfGlQaG9uZS8pKSAmJiBkWzBdICYmIChiW2RbMF0udG9Mb3dlckNhc2UoKV0gPSBiLmlvcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgPSBhLm1hdGNoKC9Ob2tpYU5bXlwvXSp8QW5kcm9pZCBcZFwuXGR8d2ViT1NcL1xkXC5cZC8pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIubW9iaWxlID0gZFswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC93ZWJPUy8udGVzdChhKSAmJiAoYi5tb2JpbGUgPSAnV2ViT1MnLCAoZCA9IGEubWF0Y2goL3dlYk9TXC8oW15cc10qKTsvKSkgJiYgZFsxXSAmJiAoYi53ZWJvcyA9IGMoZFsxXSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8gQW5kcm9pZC8udGVzdChhKSAmJiAoYi5tb2JpbGUgPSAnQW5kcm9pZCcsIChkID0gYS5tYXRjaCgvQW5kcm9pZCAoW15cc10qKTsvKSkgJiYgZFsxXSAmJiAoYi5hbmRyb2lkID0gYyhkWzFdKSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoZCA9IGEubWF0Y2goL0Nocm9tZVwvKFteXHNdKikvKSkgJiYgZFsxXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuY2hyb21lID0gYyhkWzFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZCA9IGEubWF0Y2goL0Fkb2JlQUlSXC8oW15cc10qKS8pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5haXIgPSBkWzBdOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoIWIud2Via2l0KQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGQgPSBhLm1hdGNoKC9PcGVyYVtcc1wvXShbXlxzXSopLykpICYmIGRbMV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiLm9wZXJhID0gYyhkWzFdKSwgKGQgPSBhLm1hdGNoKC9WZXJzaW9uXC8oW15cc10qKS8pKSAmJiBkWzFdICYmIChiLm9wZXJhID0gYyhkWzFdKSksIGQgPSBhLm1hdGNoKC9PcGVyYSBNaW5pW147XSovKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLm1vYmlsZSA9IGRbMF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoKGQgPSBhLm1hdGNoKC9NU0lFXHMoW147XSopLykpICYmIGRbMV0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLmllID0gYyhkWzFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZCA9IGEubWF0Y2goL0dlY2tvXC8oW15cc10qKS8pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5nZWNrbyA9IDEsIChkID0gYS5tYXRjaCgvcnY6KFteXHNcKV0qKS8pKSAmJiBkWzFdICYmIChiLmdlY2tvID0gYyhkWzFdKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRC5lbnYudWEgPSBELmVudi5wYXJzZVVBKCk7CiAgICAgICAgICAgIEQuaXNGdW5jdGlvbiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGEgfHwgJ1tvYmplY3QgRnVuY3Rpb25dJyA9PT0gUy50b1N0cmluZy5hcHBseShhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRC5fSUVFbnVtRml4ID0gRC5lbnYudWEuaWUgPyBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICBmb3IgKGMgPSAwOyBjIDwgWC5sZW5ndGg7IGMgKz0gMSkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gWFtjXTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGJbZV07CiAgICAgICAgICAgICAgICAgICAgVS5pc0Z1bmN0aW9uKGQpICYmIGQgIT0gU1tlXSAmJiAoYVtlXSA9IGQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICB9OwogICAgICAgICAgICBELmV4dGVuZCA9IGZ1bmN0aW9uIChhLCBiLCBkKSB7CiAgICAgICAgICAgICAgICBpZiAoIWIgfHwgIWEpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ2V4dGVuZCBmYWlsZWQsIHBsZWFzZSBjaGVjayB0aGF0IGFsbCBkZXBlbmRlbmNpZXMgYXJlIGluY2x1ZGVkLicpOwogICAgICAgICAgICAgICAgdmFyIGMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlID0gYi5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICBhLnByb3RvdHlwZSA9IG5ldyBjKCk7CiAgICAgICAgICAgICAgICBhLnByb3RvdHlwZS5jb25zdHJ1Y3RvciA9IGE7CiAgICAgICAgICAgICAgICBhLnN1cGVyY2xhc3MgPSBiLnByb3RvdHlwZTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLmNvbnN0cnVjdG9yID09IFMuY29uc3RydWN0b3IgJiYgKGIucHJvdG90eXBlLmNvbnN0cnVjdG9yID0gYik7CiAgICAgICAgICAgICAgICBpZiAoZCkgewogICAgICAgICAgICAgICAgICAgIGZvciAoZSBpbiBkKQogICAgICAgICAgICAgICAgICAgICAgICBVLmhhc093blByb3BlcnR5KGQsIGUpICYmIChhLnByb3RvdHlwZVtlXSA9IGRbZV0pOwogICAgICAgICAgICAgICAgICAgIFUuX0lFRW51bUZpeChhLnByb3RvdHlwZSwgZCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgICd1bmRlZmluZWQnICE9IHR5cGVvZiBLSlVSICYmIEtKVVIgfHwgKEtKVVIgPSB7fSk7CiAgICAgICAgICAgICd1bmRlZmluZWQnICE9IHR5cGVvZiBLSlVSLmFzbjEgJiYgS0pVUi5hc24xIHx8IChLSlVSLmFzbjEgPSB7fSk7CiAgICAgICAgICAgIEtKVVIuYXNuMS5BU04xVXRpbCA9IG5ldyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLmludGVnZXJUb0J5dGVIZXggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEgPSBhLnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgICAgICAxID09IGEubGVuZ3RoICUgMiAmJiAoYSA9ICcwJyArIGEpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHRoaXMuYmlnSW50VG9NaW5Ud29zQ29tcGxlbWVudHNIZXggPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gYy50b1N0cmluZygxNik7CiAgICAgICAgICAgICAgICAgICAgaWYgKCctJyAhPSBiLnN1YnN0cigwLCAxKSkKICAgICAgICAgICAgICAgICAgICAgICAgMSA9PSBiLmxlbmd0aCAlIDIgPyBiID0gJzAnICsgYiA6IGIubWF0Y2goL15bMC03XS8pIHx8IChiID0gJzAwJyArIGIpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGIuc3Vic3RyKDEpLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgMSA9PSBkICUgMiA/IGQgKz0gMSA6IGIubWF0Y2goL15bMC03XS8pIHx8IChkICs9IDIpOwogICAgICAgICAgICAgICAgICAgICAgICBiID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSAwOyBmIDwgZDsgZisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiArPSAnZic7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBuZXcgYShiLCAxNikueG9yKGMpLmFkZChhLk9ORSkudG9TdHJpbmcoMTYpLnJlcGxhY2UoL14tLywgJycpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLmdldFBFTVN0cmluZ0Zyb21IZXggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSBDcnlwdG9KUy5lbmMuSGV4LnBhcnNlKGEpOwogICAgICAgICAgICAgICAgICAgIGEgPSBDcnlwdG9KUy5lbmMuQmFzZTY0LnN0cmluZ2lmeShhKS5yZXBsYWNlKC8oLns2NH0pL2csICckMVxyXG4nKTsKICAgICAgICAgICAgICAgICAgICBhID0gYS5yZXBsYWNlKC9cclxuJC8sICcnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJy0tLS0tQkVHSU4gJyArIGIgKyAnLS0tLS1cclxuJyArIGEgKyAnXHJcbi0tLS0tRU5EICcgKyBiICsgJy0tLS0tXHJcbic7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9KCk7CiAgICAgICAgICAgIEtKVVIuYXNuMS5BU04xT2JqZWN0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5nZXRMZW5ndGhIZXhGcm9tVmFsdWUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnID09IHR5cGVvZiB0aGlzLmhWIHx8IG51bGwgPT0gdGhpcy5oVikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ3RoaXMuaFYgaXMgbnVsbCBvciB1bmRlZmluZWQuJzsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSB0aGlzLmhWLmxlbmd0aCAlIDIpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93ICd2YWx1ZSBoZXggbXVzdCBiZSBldmVuIGxlbmd0aDogbj0wLHY9JyArIHRoaXMuaFY7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLmhWLmxlbmd0aCAvIDIsIGIgPSBhLnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgICAgICAxID09IGIubGVuZ3RoICUgMiAmJiAoYiA9ICcwJyArIGIpOwogICAgICAgICAgICAgICAgICAgIGlmICgxMjggPiBhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGIubGVuZ3RoIC8gMjsKICAgICAgICAgICAgICAgICAgICBpZiAoMTUgPCBkKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAnQVNOLjEgbGVuZ3RoIHRvbyBsb25nIHRvIHJlcHJlc2VudCBieSA4eDogbiA9ICcgKyBhLnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKDEyOCArIGQpLnRvU3RyaW5nKDE2KSArIGI7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5nZXRFbmNvZGVkSGV4ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IHRoaXMuaFRMViB8fCB0aGlzLmlzTW9kaWZpZWQpCiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaFYgPSB0aGlzLmdldEZyZXNoVmFsdWVIZXgoKSwgdGhpcy5oTCA9IHRoaXMuZ2V0TGVuZ3RoSGV4RnJvbVZhbHVlKCksIHRoaXMuaFRMViA9IHRoaXMuaFQgKyB0aGlzLmhMICsgdGhpcy5oViwgdGhpcy5pc01vZGlmaWVkID0gITE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaFRMVjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLmdldFZhbHVlSGV4ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZ2V0RW5jb2RlZEhleCgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmhWOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0RnJlc2hWYWx1ZUhleCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICBLSlVSLmFzbjEuREVSQWJzdHJhY3RTdHJpbmcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgS0pVUi5hc24xLkRFUkFic3RyYWN0U3RyaW5nLnN1cGVyY2xhc3MuY29uc3RydWN0b3IuY2FsbCh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0U3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5zZXRTdHJpbmcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaFRMViA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pc01vZGlmaWVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhWID0gc3RvaGV4KHRoaXMucyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5zZXRTdHJpbmdIZXggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaFRMViA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pc01vZGlmaWVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhWID0gYTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLmdldEZyZXNoVmFsdWVIZXggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaFY7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEgJiYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBhLnN0ciA/IHRoaXMuc2V0U3RyaW5nKGEuc3RyKSA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBhLmhleCAmJiB0aGlzLnNldFN0cmluZ0hleChhLmhleCkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELmV4dGVuZChLSlVSLmFzbjEuREVSQWJzdHJhY3RTdHJpbmcsIEtKVVIuYXNuMS5BU04xT2JqZWN0KTsKICAgICAgICAgICAgS0pVUi5hc24xLkRFUkFic3RyYWN0VGltZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBLSlVSLmFzbjEuREVSQWJzdHJhY3RUaW1lLnN1cGVyY2xhc3MuY29uc3RydWN0b3IuY2FsbCh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubG9jYWxEYXRlVG9VVEMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHV0YyA9IGEuZ2V0VGltZSgpICsgNjAwMDAgKiBhLmdldFRpbWV6b25lT2Zmc2V0KCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBEYXRlKHV0Yyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5mb3JtYXREYXRlID0gZnVuY3Rpb24gKGEsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHRoaXMuemVyb1BhZGRpbmcsIGUgPSB0aGlzLmxvY2FsRGF0ZVRvVVRDKGEpOwogICAgICAgICAgICAgICAgICAgIGEgPSBTdHJpbmcoZS5nZXRGdWxsWWVhcigpKTsKICAgICAgICAgICAgICAgICAgICAndXRjJyA9PSBjICYmIChhID0gYS5zdWJzdHIoMiwgMikpOwogICAgICAgICAgICAgICAgICAgIGMgPSBiKFN0cmluZyhlLmdldE1vbnRoKCkgKyAxKSwgMik7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBiKFN0cmluZyhlLmdldERhdGUoKSksIDIpLCBmID0gYihTdHJpbmcoZS5nZXRIb3VycygpKSwgMiksIGggPSBiKFN0cmluZyhlLmdldE1pbnV0ZXMoKSksIDIpOwogICAgICAgICAgICAgICAgICAgIGIgPSBiKFN0cmluZyhlLmdldFNlY29uZHMoKSksIDIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhICsgYyArIGQgKyBmICsgaCArIGIgKyAnWic7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy56ZXJvUGFkZGluZyA9IGZ1bmN0aW9uIChhLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubGVuZ3RoID49IGMgPyBhIDogQXJyYXkoYyAtIGEubGVuZ3RoICsgMSkuam9pbignMCcpICsgYTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLmdldFN0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHRoaXMuc2V0U3RyaW5nID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhUTFYgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaXNNb2RpZmllZCA9ICEwOwogICAgICAgICAgICAgICAgICAgIHRoaXMucyA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oViA9IHN0b2hleCh0aGlzLnMpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHRoaXMuc2V0QnlEYXRlVmFsdWUgPSBmdW5jdGlvbiAoYSwgYywgYiwgZCwgZiwgZykgewogICAgICAgICAgICAgICAgICAgIGEgPSBuZXcgRGF0ZShEYXRlLlVUQyhhLCBjIC0gMSwgYiwgZCwgZiwgZywgMCkpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0QnlEYXRlKGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0RnJlc2hWYWx1ZUhleCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5oVjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEQuZXh0ZW5kKEtKVVIuYXNuMS5ERVJBYnN0cmFjdFRpbWUsIEtKVVIuYXNuMS5BU04xT2JqZWN0KTsKICAgICAgICAgICAgS0pVUi5hc24xLkRFUkFic3RyYWN0U3RydWN0dXJlZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBLSlVSLmFzbjEuREVSQWJzdHJhY3RTdHJpbmcuc3VwZXJjbGFzcy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5zZXRCeUFTTjFPYmplY3RBcnJheSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oVExWID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmlzTW9kaWZpZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmFzbjFBcnJheSA9IGE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5hcHBlbmRBU04xT2JqZWN0ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhUTFYgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaXNNb2RpZmllZCA9ICEwOwogICAgICAgICAgICAgICAgICAgIHRoaXMuYXNuMUFycmF5LnB1c2goYSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5hc24xQXJyYXkgPSBbXTsKICAgICAgICAgICAgICAgICd1bmRlZmluZWQnICE9IHR5cGVvZiBhICYmICd1bmRlZmluZWQnICE9IHR5cGVvZiBhLmFycmF5ICYmICh0aGlzLmFzbjFBcnJheSA9IGEuYXJyYXkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELmV4dGVuZChLSlVSLmFzbjEuREVSQWJzdHJhY3RTdHJ1Y3R1cmVkLCBLSlVSLmFzbjEuQVNOMU9iamVjdCk7CiAgICAgICAgICAgIEtKVVIuYXNuMS5ERVJCb29sZWFuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgS0pVUi5hc24xLkRFUkJvb2xlYW4uc3VwZXJjbGFzcy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5oVCA9ICcwMSc7CiAgICAgICAgICAgICAgICB0aGlzLmhUTFYgPSAnMDEwMWZmJzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRC5leHRlbmQoS0pVUi5hc24xLkRFUkJvb2xlYW4sIEtKVVIuYXNuMS5BU04xT2JqZWN0KTsKICAgICAgICAgICAgS0pVUi5hc24xLkRFUkludGVnZXIgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgS0pVUi5hc24xLkRFUkludGVnZXIuc3VwZXJjbGFzcy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5oVCA9ICcwMic7CiAgICAgICAgICAgICAgICB0aGlzLnNldEJ5QmlnSW50ZWdlciA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oVExWID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmlzTW9kaWZpZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhWID0gS0pVUi5hc24xLkFTTjFVdGlsLmJpZ0ludFRvTWluVHdvc0NvbXBsZW1lbnRzSGV4KGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHRoaXMuc2V0QnlJbnRlZ2VyID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gbmV3IGEoU3RyaW5nKGMpLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRCeUJpZ0ludGVnZXIoYyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5zZXRWYWx1ZUhleCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oViA9IGE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5nZXRGcmVzaFZhbHVlSGV4ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmhWOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICd1bmRlZmluZWQnICE9IHR5cGVvZiBjICYmICgndW5kZWZpbmVkJyAhPSB0eXBlb2YgYy5iaWdpbnQgPyB0aGlzLnNldEJ5QmlnSW50ZWdlcihjLmJpZ2ludCkgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgY1snaW50J10gPyB0aGlzLnNldEJ5SW50ZWdlcihjWydpbnQnXSkgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgYy5oZXggJiYgdGhpcy5zZXRWYWx1ZUhleChjLmhleCkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELmV4dGVuZChLSlVSLmFzbjEuREVSSW50ZWdlciwgS0pVUi5hc24xLkFTTjFPYmplY3QpOwogICAgICAgICAgICBLSlVSLmFzbjEuREVSQml0U3RyaW5nID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEtKVVIuYXNuMS5ERVJCaXRTdHJpbmcuc3VwZXJjbGFzcy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5oVCA9ICcwMyc7CiAgICAgICAgICAgICAgICB0aGlzLnNldEhleFZhbHVlSW5jbHVkaW5nVW51c2VkQml0cyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oVExWID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmlzTW9kaWZpZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhWID0gYTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLnNldFVudXNlZEJpdHNBbmRIZXhWYWx1ZSA9IGZ1bmN0aW9uIChhLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPiBhIHx8IDcgPCBhKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAndW51c2VkIGJpdHMgc2hhbGwgYmUgZnJvbSAwIHRvIDc6IHUgPSAnICsgYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhUTFYgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaXNNb2RpZmllZCA9ICEwOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaFYgPSAnMCcgKyBhICsgYzsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLnNldEJ5QmluYXJ5U3RyaW5nID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBhID0gYS5yZXBsYWNlKC8wKyQvLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSA4IC0gYS5sZW5ndGggJSA4OwogICAgICAgICAgICAgICAgICAgIDggPT0gYyAmJiAoYyA9IDApOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSAwOyBiIDw9IGM7IGIrKykKICAgICAgICAgICAgICAgICAgICAgICAgYSArPSAnMCc7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAnJzsKICAgICAgICAgICAgICAgICAgICBmb3IgKGIgPSAwOyBiIDwgYS5sZW5ndGggLSAxOyBiICs9IDgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLnN1YnN0cihiLCA4KTsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IHBhcnNlSW50KGQsIDIpLnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgMSA9PSBkLmxlbmd0aCAmJiAoZCA9ICcwJyArIGQpOwogICAgICAgICAgICAgICAgICAgICAgICBlICs9IGQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHRoaXMuaFRMViA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pc01vZGlmaWVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oViA9ICcwJyArIGMgKyBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHRoaXMuc2V0QnlCb29sZWFuQXJyYXkgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAnJywgYiA9IDA7IGIgPCBhLmxlbmd0aDsgYisrKQogICAgICAgICAgICAgICAgICAgICAgICBjID0gMSA9PSBhW2JdID8gYyArICcxJyA6IGMgKyAnMCc7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRCeUJpbmFyeVN0cmluZyhjKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLm5ld0ZhbHNlQXJyYXkgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBBcnJheShhKSwgYiA9IDA7IGIgPCBhOyBiKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGNbYl0gPSAhMTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLmdldEZyZXNoVmFsdWVIZXggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaFY7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEgJiYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBhLmhleCA/IHRoaXMuc2V0SGV4VmFsdWVJbmNsdWRpbmdVbnVzZWRCaXRzKGEuaGV4KSA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBhLmJpbiA/IHRoaXMuc2V0QnlCaW5hcnlTdHJpbmcoYS5iaW4pIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEuYXJyYXkgJiYgdGhpcy5zZXRCeUJvb2xlYW5BcnJheShhLmFycmF5KSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEQuZXh0ZW5kKEtKVVIuYXNuMS5ERVJCaXRTdHJpbmcsIEtKVVIuYXNuMS5BU04xT2JqZWN0KTsKICAgICAgICAgICAgS0pVUi5hc24xLkRFUk9jdGV0U3RyaW5nID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEtKVVIuYXNuMS5ERVJPY3RldFN0cmluZy5zdXBlcmNsYXNzLmNvbnN0cnVjdG9yLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgICAgICB0aGlzLmhUID0gJzA0JzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRC5leHRlbmQoS0pVUi5hc24xLkRFUk9jdGV0U3RyaW5nLCBLSlVSLmFzbjEuREVSQWJzdHJhY3RTdHJpbmcpOwogICAgICAgICAgICBLSlVSLmFzbjEuREVSTnVsbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIEtKVVIuYXNuMS5ERVJOdWxsLnN1cGVyY2xhc3MuY29uc3RydWN0b3IuY2FsbCh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuaFQgPSAnMDUnOwogICAgICAgICAgICAgICAgdGhpcy5oVExWID0gJzA1MDAnOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELmV4dGVuZChLSlVSLmFzbjEuREVSTnVsbCwgS0pVUi5hc24xLkFTTjFPYmplY3QpOwogICAgICAgICAgICBLSlVSLmFzbjEuREVST2JqZWN0SWRlbnRpZmllciA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IGEudG9TdHJpbmcoMTYpOwogICAgICAgICAgICAgICAgICAgIDEgPT0gYS5sZW5ndGggJiYgKGEgPSAnMCcgKyBhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBLSlVSLmFzbjEuREVST2JqZWN0SWRlbnRpZmllci5zdXBlcmNsYXNzLmNvbnN0cnVjdG9yLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLmhUID0gJzA2JzsKICAgICAgICAgICAgICAgIHRoaXMuc2V0VmFsdWVIZXggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaFRMViA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pc01vZGlmaWVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhWID0gYTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLnNldFZhbHVlT2lkU3RyaW5nID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIWMubWF0Y2goL15bMC05Ll0rJC8pKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAnbWFsZm9ybWVkIG9pZCBzdHJpbmc6ICcgKyBjOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gJyc7CiAgICAgICAgICAgICAgICAgICAgYyA9IGMuc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IDQwICogcGFyc2VJbnQoY1swXSkgKyBwYXJzZUludChjWzFdKTsKICAgICAgICAgICAgICAgICAgICBkICs9IGIoZSk7CiAgICAgICAgICAgICAgICAgICAgYy5zcGxpY2UoMCwgMik7CiAgICAgICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IGMubGVuZ3RoOyBlKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSAnJywgaCA9IG5ldyBhKGNbZV0sIDEwKS50b1N0cmluZygyKSwgZyA9IDcgLSBoLmxlbmd0aCAlIDc7CiAgICAgICAgICAgICAgICAgICAgICAgIDcgPT0gZyAmJiAoZyA9IDApOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBtID0gJycsIGsgPSAwOyBrIDwgZzsgaysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbSArPSAnMCc7CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSBtICsgaDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChrID0gMDsgayA8IGgubGVuZ3RoIC0gMTsgayArPSA3KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGguc3Vic3RyKGssIDcpLCBrICE9IGgubGVuZ3RoIC0gNyAmJiAoZyA9ICcxJyArIGcpLCBmICs9IGIocGFyc2VJbnQoZywgMikpOwogICAgICAgICAgICAgICAgICAgICAgICBkICs9IGY7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHRoaXMuaFRMViA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pc01vZGlmaWVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhWID0gZDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLnNldFZhbHVlTmFtZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBLSlVSLmFzbjEueDUwOS5PSUQubmFtZTJvaWRMaXN0W2FdKQogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNldFZhbHVlT2lkU3RyaW5nKEtKVVIuYXNuMS54NTA5Lk9JRC5uYW1lMm9pZExpc3RbYV0pOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ0RFUk9iamVjdElkZW50aWZpZXIgb2lkTmFtZSB1bmRlZmluZWQ6ICcgKyBhOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0RnJlc2hWYWx1ZUhleCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5oVjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPSB0eXBlb2YgYyAmJiAoJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGMub2lkID8gdGhpcy5zZXRWYWx1ZU9pZFN0cmluZyhjLm9pZCkgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgYy5oZXggPyB0aGlzLnNldFZhbHVlSGV4KGMuaGV4KSA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBjLm5hbWUgJiYgdGhpcy5zZXRWYWx1ZU5hbWUoYy5uYW1lKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEQuZXh0ZW5kKEtKVVIuYXNuMS5ERVJPYmplY3RJZGVudGlmaWVyLCBLSlVSLmFzbjEuQVNOMU9iamVjdCk7CiAgICAgICAgICAgIEtKVVIuYXNuMS5ERVJVVEY4U3RyaW5nID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEtKVVIuYXNuMS5ERVJVVEY4U3RyaW5nLnN1cGVyY2xhc3MuY29uc3RydWN0b3IuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMuaFQgPSAnMGMnOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELmV4dGVuZChLSlVSLmFzbjEuREVSVVRGOFN0cmluZywgS0pVUi5hc24xLkRFUkFic3RyYWN0U3RyaW5nKTsKICAgICAgICAgICAgS0pVUi5hc24xLkRFUk51bWVyaWNTdHJpbmcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgS0pVUi5hc24xLkRFUk51bWVyaWNTdHJpbmcuc3VwZXJjbGFzcy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgdGhpcy5oVCA9ICcxMic7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEQuZXh0ZW5kKEtKVVIuYXNuMS5ERVJOdW1lcmljU3RyaW5nLCBLSlVSLmFzbjEuREVSQWJzdHJhY3RTdHJpbmcpOwogICAgICAgICAgICBLSlVSLmFzbjEuREVSUHJpbnRhYmxlU3RyaW5nID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEtKVVIuYXNuMS5ERVJQcmludGFibGVTdHJpbmcuc3VwZXJjbGFzcy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgdGhpcy5oVCA9ICcxMyc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEQuZXh0ZW5kKEtKVVIuYXNuMS5ERVJQcmludGFibGVTdHJpbmcsIEtKVVIuYXNuMS5ERVJBYnN0cmFjdFN0cmluZyk7CiAgICAgICAgICAgIEtKVVIuYXNuMS5ERVJUZWxldGV4U3RyaW5nID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEtKVVIuYXNuMS5ERVJUZWxldGV4U3RyaW5nLnN1cGVyY2xhc3MuY29uc3RydWN0b3IuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMuaFQgPSAnMTQnOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELmV4dGVuZChLSlVSLmFzbjEuREVSVGVsZXRleFN0cmluZywgS0pVUi5hc24xLkRFUkFic3RyYWN0U3RyaW5nKTsKICAgICAgICAgICAgS0pVUi5hc24xLkRFUklBNVN0cmluZyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBLSlVSLmFzbjEuREVSSUE1U3RyaW5nLnN1cGVyY2xhc3MuY29uc3RydWN0b3IuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMuaFQgPSAnMTYnOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELmV4dGVuZChLSlVSLmFzbjEuREVSSUE1U3RyaW5nLCBLSlVSLmFzbjEuREVSQWJzdHJhY3RTdHJpbmcpOwogICAgICAgICAgICBLSlVSLmFzbjEuREVSVVRDVGltZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBLSlVSLmFzbjEuREVSVVRDVGltZS5zdXBlcmNsYXNzLmNvbnN0cnVjdG9yLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgICAgICB0aGlzLmhUID0gJzE3JzsKICAgICAgICAgICAgICAgIHRoaXMuc2V0QnlEYXRlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhUTFYgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaXNNb2RpZmllZCA9ICEwOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGF0ZSA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zID0gdGhpcy5mb3JtYXREYXRlKHRoaXMuZGF0ZSwgJ3V0YycpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaFYgPSBzdG9oZXgodGhpcy5zKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPSB0eXBlb2YgYSAmJiAoJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEuc3RyID8gdGhpcy5zZXRTdHJpbmcoYS5zdHIpIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEuaGV4ID8gdGhpcy5zZXRTdHJpbmdIZXgoYS5oZXgpIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEuZGF0ZSAmJiB0aGlzLnNldEJ5RGF0ZShhLmRhdGUpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRC5leHRlbmQoS0pVUi5hc24xLkRFUlVUQ1RpbWUsIEtKVVIuYXNuMS5ERVJBYnN0cmFjdFRpbWUpOwogICAgICAgICAgICBLSlVSLmFzbjEuREVSR2VuZXJhbGl6ZWRUaW1lID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEtKVVIuYXNuMS5ERVJHZW5lcmFsaXplZFRpbWUuc3VwZXJjbGFzcy5jb25zdHJ1Y3Rvci5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgdGhpcy5oVCA9ICcxOCc7CiAgICAgICAgICAgICAgICB0aGlzLnNldEJ5RGF0ZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oVExWID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmlzTW9kaWZpZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRhdGUgPSBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMucyA9IHRoaXMuZm9ybWF0RGF0ZSh0aGlzLmRhdGUsICdnZW4nKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhWID0gc3RvaGV4KHRoaXMucyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEgJiYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBhLnN0ciA/IHRoaXMuc2V0U3RyaW5nKGEuc3RyKSA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBhLmhleCA/IHRoaXMuc2V0U3RyaW5nSGV4KGEuaGV4KSA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBhLmRhdGUgJiYgdGhpcy5zZXRCeURhdGUoYS5kYXRlKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEQuZXh0ZW5kKEtKVVIuYXNuMS5ERVJHZW5lcmFsaXplZFRpbWUsIEtKVVIuYXNuMS5ERVJBYnN0cmFjdFRpbWUpOwogICAgICAgICAgICBLSlVSLmFzbjEuREVSU2VxdWVuY2UgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgS0pVUi5hc24xLkRFUlNlcXVlbmNlLnN1cGVyY2xhc3MuY29uc3RydWN0b3IuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMuaFQgPSAnMzAnOwogICAgICAgICAgICAgICAgdGhpcy5nZXRGcmVzaFZhbHVlSGV4ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSAnJywgYyA9IDA7IGMgPCB0aGlzLmFzbjFBcnJheS5sZW5ndGg7IGMrKykKICAgICAgICAgICAgICAgICAgICAgICAgYSArPSB0aGlzLmFzbjFBcnJheVtjXS5nZXRFbmNvZGVkSGV4KCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaFYgPSBhOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRC5leHRlbmQoS0pVUi5hc24xLkRFUlNlcXVlbmNlLCBLSlVSLmFzbjEuREVSQWJzdHJhY3RTdHJ1Y3R1cmVkKTsKICAgICAgICAgICAgS0pVUi5hc24xLkRFUlNldCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBLSlVSLmFzbjEuREVSU2V0LnN1cGVyY2xhc3MuY29uc3RydWN0b3IuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMuaFQgPSAnMzEnOwogICAgICAgICAgICAgICAgdGhpcy5nZXRGcmVzaFZhbHVlSGV4ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSBbXSwgYyA9IDA7IGMgPCB0aGlzLmFzbjFBcnJheS5sZW5ndGg7IGMrKykKICAgICAgICAgICAgICAgICAgICAgICAgYS5wdXNoKHRoaXMuYXNuMUFycmF5W2NdLmdldEVuY29kZWRIZXgoKSk7CiAgICAgICAgICAgICAgICAgICAgYS5zb3J0KCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaFYgPSBhLmpvaW4oJycpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRC5leHRlbmQoS0pVUi5hc24xLkRFUlNldCwgS0pVUi5hc24xLkRFUkFic3RyYWN0U3RydWN0dXJlZCk7CiAgICAgICAgICAgIEtKVVIuYXNuMS5ERVJUYWdnZWRPYmplY3QgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgS0pVUi5hc24xLkRFUlRhZ2dlZE9iamVjdC5zdXBlcmNsYXNzLmNvbnN0cnVjdG9yLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLmhUID0gJ2EwJzsKICAgICAgICAgICAgICAgIHRoaXMuaFYgPSAnJzsKICAgICAgICAgICAgICAgIHRoaXMuaXNFeHBsaWNpdCA9ICEwOwogICAgICAgICAgICAgICAgdGhpcy5hc24xT2JqZWN0ID0gbnVsbDsKICAgICAgICAgICAgICAgIHRoaXMuc2V0QVNOMU9iamVjdCA9IGZ1bmN0aW9uIChhLCBjLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oVCA9IGM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pc0V4cGxpY2l0ID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmFzbjFPYmplY3QgPSBiOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaXNFeHBsaWNpdCA/ICh0aGlzLmhWID0gdGhpcy5hc24xT2JqZWN0LmdldEVuY29kZWRIZXgoKSwgdGhpcy5oVExWID0gbnVsbCwgdGhpcy5pc01vZGlmaWVkID0gITApIDogKHRoaXMuaFYgPSBudWxsLCB0aGlzLmhUTFYgPSBiLmdldEVuY29kZWRIZXgoKSwgdGhpcy5oVExWID0gdGhpcy5oVExWLnJlcGxhY2UoL14uLi8sIGMpLCB0aGlzLmlzTW9kaWZpZWQgPSAhMSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5nZXRGcmVzaFZhbHVlSGV4ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmhWOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICd1bmRlZmluZWQnICE9IHR5cGVvZiBhICYmICgndW5kZWZpbmVkJyAhPSB0eXBlb2YgYS50YWcgJiYgKHRoaXMuaFQgPSBhLnRhZyksICd1bmRlZmluZWQnICE9IHR5cGVvZiBhLmV4cGxpY2l0ICYmICh0aGlzLmlzRXhwbGljaXQgPSBhLmV4cGxpY2l0KSwgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEub2JqICYmICh0aGlzLmFzbjFPYmplY3QgPSBhLm9iaiwgdGhpcy5zZXRBU04xT2JqZWN0KHRoaXMuaXNFeHBsaWNpdCwgdGhpcy5oVCwgdGhpcy5hc24xT2JqZWN0KSkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELmV4dGVuZChLSlVSLmFzbjEuREVSVGFnZ2VkT2JqZWN0LCBLSlVSLmFzbjEuQVNOMU9iamVjdCk7CiAgICAgICAgICAgIChmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGMgPSB7fSwgYjsKICAgICAgICAgICAgICAgIGMuZGVjb2RlID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZDsKICAgICAgICAgICAgICAgICAgICBpZiAoYiA9PT0gYSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9ICcwMTIzNDU2Nzg5QUJDREVGJzsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGQgPSAwOyAxNiA+IGQ7ICsrZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJbZS5jaGFyQXQoZCldID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChkID0gMTA7IDE2ID4gZDsgKytkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYltlLmNoYXJBdChkKV0gPSBkOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGQgPSAwOyA4ID4gZDsgKytkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYlsnIFxmXG5cclx0XHhBMFx1MjAyOFx1MjAyOScuY2hhckF0KGQpXSA9IC0xOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBlID0gW107CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSAwLCBnID0gMDsKICAgICAgICAgICAgICAgICAgICBmb3IgKGQgPSAwOyBkIDwgYy5sZW5ndGg7ICsrZCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGMuY2hhckF0KGQpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJz0nID09IGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgaCA9IGJbaF07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtMSAhPSBoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCA9PT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAnSWxsZWdhbCBjaGFyYWN0ZXIgYXQgb2Zmc2V0ICcgKyBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiB8PSBoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMiA8PSArK2cgPyAoZVtlLmxlbmd0aF0gPSBmLCBnID0gZiA9IDApIDogZiA8PD0gNDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoZykKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ0hleCBlbmNvZGluZyBpbmNvbXBsZXRlOiA0IGJpdHMgbWlzc2luZyc7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgQWRmb3JtLkpTRW5jcnlwdEhlbHBlcnMuSGV4ID0gYzsKICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IHt9LCBiOwogICAgICAgICAgICAgICAgYy5kZWNvZGUgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkOwogICAgICAgICAgICAgICAgICAgIGlmIChiID09PSBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChkID0gMDsgNjQgPiBkOyArK2QpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiWydBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OSsvJy5jaGFyQXQoZCldID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChkID0gMDsgOSA+IGQ7ICsrZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJbJz0gXGZcblxyXHRceEEwXHUyMDI4XHUyMDI5Jy5jaGFyQXQoZCldID0gLTE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciBlID0gW10sIGYgPSAwLCBnID0gMDsKICAgICAgICAgICAgICAgICAgICBmb3IgKGQgPSAwOyBkIDwgYy5sZW5ndGg7ICsrZCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGMuY2hhckF0KGQpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJz0nID09IGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgaCA9IGJbaF07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtMSAhPSBoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCA9PT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAnSWxsZWdhbCBjaGFyYWN0ZXIgYXQgb2Zmc2V0ICcgKyBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiB8PSBoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgNCA8PSArK2cgPyAoZVtlLmxlbmd0aF0gPSBmID4+IDE2LCBlW2UubGVuZ3RoXSA9IGYgPj4gOCAmIDI1NSwgZVtlLmxlbmd0aF0gPSBmICYgMjU1LCBnID0gZiA9IDApIDogZiA8PD0gNjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGcpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93ICdCYXNlNjQgZW5jb2RpbmcgaW5jb21wbGV0ZTogYXQgbGVhc3QgMiBiaXRzIG1pc3NpbmcnOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgZVtlLmxlbmd0aF0gPSBmID4+IDEwOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgIGVbZS5sZW5ndGhdID0gZiA+PiAxNiwgZVtlLmxlbmd0aF0gPSBmID4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucmUgPSAvLS0tLS1CRUdJTiBbXi1dKy0tLS0tKFtBLVphLXowLTkrXC89XHNdKyktLS0tLUVORCBbXi1dKy0tLS0tfGJlZ2luLWJhc2U2NFteXG5dK1xuKFtBLVphLXowLTkrXC89XHNdKyk9PT09LzsKICAgICAgICAgICAgICAgIGMudW5hcm1vciA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBjLnJlLmV4ZWMoYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGIpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiWzFdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGJbMV07CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGJbMl0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gYlsyXTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ1JlZ0V4cCBvdXQgb2Ygc3luYyc7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuZGVjb2RlKGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIEFkZm9ybS5KU0VuY3J5cHRIZWxwZXJzLkJhc2U2NCA9IGM7CiAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgIChmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYSBpbnN0YW5jZW9mIGMgPyAodGhpcy5lbmMgPSBhLmVuYywgdGhpcy5wb3MgPSBhLnBvcykgOiAodGhpcy5lbmMgPSBhLCB0aGlzLnBvcyA9IGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYihhLCBjLCBiLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdHJlYW0gPSBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaGVhZGVyID0gYzsKICAgICAgICAgICAgICAgICAgICB0aGlzLmxlbmd0aCA9IGI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy50YWcgPSBkOwogICAgICAgICAgICAgICAgICAgIHRoaXMuc3ViID0gZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBkID0gewogICAgICAgICAgICAgICAgICAgIHRhZzogZnVuY3Rpb24gKGEsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuY2xhc3NOYW1lID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB0ZXh0OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUoYSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLmdldCA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgYyA9PT0gYSAmJiAoYyA9IHRoaXMucG9zKyspOwogICAgICAgICAgICAgICAgICAgIGlmIChjID49IHRoaXMuZW5jLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ1JlcXVlc3RpbmcgYnl0ZSBvZmZzZXQgJyArIGMgKyAnIG9uIGEgc3RyZWFtIG9mIGxlbmd0aCAnICsgdGhpcy5lbmMubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVuY1tjXTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBjLnByb3RvdHlwZS5oZXhEaWdpdHMgPSAnMDEyMzQ1Njc4OUFCQ0RFRic7CiAgICAgICAgICAgICAgICBjLnByb3RvdHlwZS5oZXhCeXRlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5oZXhEaWdpdHMuY2hhckF0KGEgPj4gNCAmIDE1KSArIHRoaXMuaGV4RGlnaXRzLmNoYXJBdChhICYgMTUpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLmhleER1bXAgPSBmdW5jdGlvbiAoYSwgYywgYikgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSAnJzsgYSA8IGM7ICsrYSkKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgKz0gdGhpcy5oZXhCeXRlKHRoaXMuZ2V0KGEpKSwgITAgIT09IGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGEgJiAxNSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgKz0gJyAgJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCArPSAnXG4nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkICs9ICcgJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBjLnByb3RvdHlwZS5wYXJzZVN0cmluZ0lTTyA9IGZ1bmN0aW9uIChhLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9ICcnOyBhIDwgYzsgKythKQogICAgICAgICAgICAgICAgICAgICAgICBiICs9IFN0cmluZy5mcm9tQ2hhckNvZGUodGhpcy5nZXQoYSkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLnBhcnNlU3RyaW5nVVRGID0gZnVuY3Rpb24gKGEsIGMpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gJyc7IGEgPCBjOykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHRoaXMuZ2V0KGErKyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSAxMjggPiBkID8gYiArIFN0cmluZy5mcm9tQ2hhckNvZGUoZCkgOiAxOTEgPCBkICYmIDIyNCA+IGQgPyBiICsgU3RyaW5nLmZyb21DaGFyQ29kZSgoZCAmIDMxKSA8PCA2IHwgdGhpcy5nZXQoYSsrKSAmIDYzKSA6IGIgKyBTdHJpbmcuZnJvbUNoYXJDb2RlKChkICYgMTUpIDw8IDEyIHwgKHRoaXMuZ2V0KGErKykgJiA2MykgPDwgNiB8IHRoaXMuZ2V0KGErKykgJiA2Myk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLnBhcnNlU3RyaW5nQk1QID0gZnVuY3Rpb24gKGEsIGMpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gJyc7IGEgPCBjOyBhICs9IDIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB0aGlzLmdldChhKSwgZSA9IHRoaXMuZ2V0KGEgKyAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKChkIDw8IDgpICsgZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLnJlVGltZSA9IC9eKCg/OjFbODldfDJcZCk/XGRcZCkoMFsxLTldfDFbMC0yXSkoMFsxLTldfFsxMl1cZHwzWzAxXSkoWzAxXVxkfDJbMC0zXSkoPzooWzAtNV1cZCkoPzooWzAtNV1cZCkoPzpbLixdKFxkezEsM30pKT8pPyk/KFp8Wy0rXSg/OlswXVxkfDFbMC0yXSkoWzAtNV1cZCk/KT8kLzsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLnBhcnNlVGltZSA9IGZ1bmN0aW9uIChhLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IHRoaXMucGFyc2VTdHJpbmdJU08oYSwgYyk7CiAgICAgICAgICAgICAgICAgICAgYyA9IHRoaXMucmVUaW1lLmV4ZWMoYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFjKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1VucmVjb2duaXplZCB0aW1lOiAnICsgYTsKICAgICAgICAgICAgICAgICAgICBhID0gY1sxXSArICctJyArIGNbMl0gKyAnLScgKyBjWzNdICsgJyAnICsgY1s0XTsKICAgICAgICAgICAgICAgICAgICBjWzVdICYmIChhICs9ICc6JyArIGNbNV0sIGNbNl0gJiYgKGEgKz0gJzonICsgY1s2XSwgY1s3XSAmJiAoYSArPSAnLicgKyBjWzddKSkpOwogICAgICAgICAgICAgICAgICAgIGNbOF0gJiYgKGEgKz0gJyBVVEMnLCAnWicgIT0gY1s4XSAmJiAoYSArPSBjWzhdLCBjWzldICYmIChhICs9ICc6JyArIGNbOV0pKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUucGFyc2VJbnRlZ2VyID0gZnVuY3Rpb24gKGEsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGMgLSBhOwogICAgICAgICAgICAgICAgICAgIGlmICg0IDwgYikgewogICAgICAgICAgICAgICAgICAgICAgICBiIDw8PSAzOwogICAgICAgICAgICAgICAgICAgICAgICBjID0gdGhpcy5nZXQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiAtPSA4OwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgMTI4ID4gYzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA8PD0gMSwgLS1iOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJygnICsgYiArICcgYml0KSc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZvciAoYiA9IDA7IGEgPCBjOyArK2EpCiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBiIDw8IDggfCB0aGlzLmdldChhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBjLnByb3RvdHlwZS5wYXJzZUJpdFN0cmluZyA9IGZ1bmN0aW9uIChhLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSB0aGlzLmdldChhKSwgZCA9IChjIC0gYSAtIDEgPDwgMykgLSBiLCBlID0gJygnICsgZCArICcgYml0KSc7CiAgICAgICAgICAgICAgICAgICAgaWYgKDIwID49IGQpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSArPSAnICcsIC0tYzsgYyA+IGE7IC0tYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChkID0gdGhpcy5nZXQoYyk7IDggPiBiOyArK2IpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSArPSBkID4+IGIgJiAxID8gJzEnIDogJzAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBjLnByb3RvdHlwZS5wYXJzZU9jdGV0U3RyaW5nID0gZnVuY3Rpb24gKGEsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGMgLSBhLCBkID0gJygnICsgYiArICcgYnl0ZSkgJzsKICAgICAgICAgICAgICAgICAgICBmb3IgKDEwMCA8IGIgJiYgKGMgPSBhICsgMTAwKTsgYSA8IGM7ICsrYSkKICAgICAgICAgICAgICAgICAgICAgICAgZCArPSB0aGlzLmhleEJ5dGUodGhpcy5nZXQoYSkpOwogICAgICAgICAgICAgICAgICAgIDEwMCA8IGIgJiYgKGQgKz0gJ1x1MjAyNicpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLnBhcnNlT0lEID0gZnVuY3Rpb24gKGEsIGMpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gJycsIGQgPSAwLCBlID0gMDsgYSA8IGM7ICsrYSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHRoaXMuZ2V0KGEpOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gZCA8PCA3IHwgZiAmIDEyNzsKICAgICAgICAgICAgICAgICAgICAgICAgZSArPSA3OwogICAgICAgICAgICAgICAgICAgICAgICBmICYgMTI4IHx8ICgnJyA9PT0gYiA/IChiID0gODAgPiBkID8gNDAgPiBkID8gMCA6IDEgOiAyLCBiID0gYiArICcuJyArIChkIC0gNDAgKiBiKSkgOiBiICs9ICcuJyArICgzMSA8PSBlID8gJ2JpZ2ludCcgOiBkKSwgZCA9IGUgPSAwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUudHlwZU5hbWUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMudGFnID09PSBhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3Vua25vd24nOwogICAgICAgICAgICAgICAgICAgIHZhciBjID0gdGhpcy50YWcgJiAzMTsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXMudGFnID4+IDYpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0VPQyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnQk9PTEVBTic7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnSU5URUdFUic7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnQklUX1NUUklORyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnT0NURVRfU1RSSU5HJzsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdOVUxMJzsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdPQkpFQ1RfSURFTlRJRklFUic7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnT2JqZWN0RGVzY3JpcHRvcic7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnRVhURVJOQUwnOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1JFQUwnOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdFTlVNRVJBVEVEJzsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnRU1CRURERURfUERWJzsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnVVRGOFN0cmluZyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1NFUVVFTkNFJzsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnU0VUJzsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnTnVtZXJpY1N0cmluZyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1ByaW50YWJsZVN0cmluZyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1RlbGV0ZXhTdHJpbmcnOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDIxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdWaWRlb3RleFN0cmluZyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0lBNVN0cmluZyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1VUQ1RpbWUnOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdHZW5lcmFsaXplZFRpbWUnOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdHcmFwaGljU3RyaW5nJzsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyNjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnVmlzaWJsZVN0cmluZyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0dlbmVyYWxTdHJpbmcnOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdVbml2ZXJzYWxTdHJpbmcnOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDMwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdCTVBTdHJpbmcnOwogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdVbml2ZXJzYWxfJyArIGMudG9TdHJpbmcoMTYpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0FwcGxpY2F0aW9uXycgKyBjLnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnWycgKyBjICsgJ10nOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdQcml2YXRlXycgKyBjLnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUucmVTZWVtc0FTQ0lJID0gL15bIC1+XSskLzsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLmNvbnRlbnQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMudGFnID09PSBhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHRoaXMudGFnID4+IDYsIGIgPSB0aGlzLnRhZyAmIDMxLCBkID0gdGhpcy5wb3NDb250ZW50KCksIGUgPSBNYXRoLmFicyh0aGlzLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09IGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHRoaXMuc3ViKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcoJyArIHRoaXMuc3ViLmxlbmd0aCArICcgZWxlbSknOwogICAgICAgICAgICAgICAgICAgICAgICBjID0gdGhpcy5zdHJlYW0ucGFyc2VTdHJpbmdJU08oZCwgZCArIE1hdGgubWluKGUsIDEwMCkpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZVNlZW1zQVNDSUkudGVzdChjKSA/IGMuc3Vic3RyaW5nKDAsIDIwMCkgKyAoMjAwIDwgYy5sZW5ndGggPyAnXHUyMDI2JyA6ICcnKSA6IHRoaXMuc3RyZWFtLnBhcnNlT2N0ZXRTdHJpbmcoZCwgZCArIGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwID09PSB0aGlzLnN0cmVhbS5nZXQoZCkgPyAnZmFsc2UnIDogJ3RydWUnOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3RyZWFtLnBhcnNlSW50ZWdlcihkLCBkICsgZSk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdWIgPyAnKCcgKyB0aGlzLnN1Yi5sZW5ndGggKyAnIGVsZW0pJyA6IHRoaXMuc3RyZWFtLnBhcnNlQml0U3RyaW5nKGQsIGQgKyBlKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN1YiA/ICcoJyArIHRoaXMuc3ViLmxlbmd0aCArICcgZWxlbSknIDogdGhpcy5zdHJlYW0ucGFyc2VPY3RldFN0cmluZyhkLCBkICsgZSk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdHJlYW0ucGFyc2VPSUQoZCwgZCArIGUpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTY6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxNzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcoJyArIHRoaXMuc3ViLmxlbmd0aCArICcgZWxlbSknOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0cmVhbS5wYXJzZVN0cmluZ1VURihkLCBkICsgZSk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxODoKICAgICAgICAgICAgICAgICAgICBjYXNlIDE5OgogICAgICAgICAgICAgICAgICAgIGNhc2UgMjA6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAyMToKICAgICAgICAgICAgICAgICAgICBjYXNlIDIyOgogICAgICAgICAgICAgICAgICAgIGNhc2UgMjY6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0cmVhbS5wYXJzZVN0cmluZ0lTTyhkLCBkICsgZSk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzMDoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3RyZWFtLnBhcnNlU3RyaW5nQk1QKGQsIGQgKyBlKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDIzOgogICAgICAgICAgICAgICAgICAgIGNhc2UgMjQ6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0cmVhbS5wYXJzZVRpbWUoZCwgZCArIGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50eXBlTmFtZSgpICsgJ0AnICsgdGhpcy5zdHJlYW0ucG9zICsgJ1toZWFkZXI6JyArIHRoaXMuaGVhZGVyICsgJyxsZW5ndGg6JyArIHRoaXMubGVuZ3RoICsgJyxzdWI6JyArIChudWxsID09PSB0aGlzLnN1YiA/ICdudWxsJyA6IHRoaXMuc3ViLmxlbmd0aCkgKyAnXSc7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUucHJpbnQgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIGMgPT09IGEgJiYgKGMgPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQud3JpdGVsbihjICsgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHRoaXMuc3ViKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgKz0gJyAgJzsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IDAsIGQgPSB0aGlzLnN1Yi5sZW5ndGg7IGIgPCBkOyArK2IpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN1YltiXS5wcmludChjKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUudG9QcmV0dHlTdHJpbmcgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIGMgPT09IGEgJiYgKGMgPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBjICsgdGhpcy50eXBlTmFtZSgpICsgJyBAJyArIHRoaXMuc3RyZWFtLnBvczsKICAgICAgICAgICAgICAgICAgICAwIDw9IHRoaXMubGVuZ3RoICYmIChiICs9ICcrJyk7CiAgICAgICAgICAgICAgICAgICAgYiArPSB0aGlzLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICB0aGlzLnRhZyAmIDMyID8gYiArPSAnIChjb25zdHJ1Y3RlZCknIDogMyAhPSB0aGlzLnRhZyAmJiA0ICE9IHRoaXMudGFnIHx8IG51bGwgPT09IHRoaXMuc3ViIHx8IChiICs9ICcgKGVuY2Fwc3VsYXRlcyknKTsKICAgICAgICAgICAgICAgICAgICBiICs9ICdcbic7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHRoaXMuc3ViKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgKz0gJyAgJzsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IDAsIGUgPSB0aGlzLnN1Yi5sZW5ndGg7IGQgPCBlOyArK2QpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiICs9IHRoaXMuc3ViW2RdLnRvUHJldHR5U3RyaW5nKGMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS50b0RPTSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGQudGFnKCdkaXYnLCAnbm9kZScpOwogICAgICAgICAgICAgICAgICAgIGEuYXNuMSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBkLnRhZygnZGl2JywgJ2hlYWQnKSwgYiA9IHRoaXMudHlwZU5hbWUoKS5yZXBsYWNlKC9fL2csICcgJyk7CiAgICAgICAgICAgICAgICAgICAgYy5pbm5lckhUTUwgPSBiOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5jb250ZW50KCk7CiAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gZSAmJiAoZSA9IFN0cmluZyhlKS5yZXBsYWNlKC88L2csICcmbHQ7JyksIGIgPSBkLnRhZygnc3BhbicsICdwcmV2aWV3JyksIGIuYXBwZW5kQ2hpbGQoZC50ZXh0KGUpKSwgYy5hcHBlbmRDaGlsZChiKSk7CiAgICAgICAgICAgICAgICAgICAgYS5hcHBlbmRDaGlsZChjKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm5vZGUgPSBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaGVhZCA9IGM7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBkLnRhZygnZGl2JywgJ3ZhbHVlJyk7CiAgICAgICAgICAgICAgICAgICAgYiA9ICdPZmZzZXQ6ICcgKyB0aGlzLnN0cmVhbS5wb3MgKyAnPGJyLz4nOwogICAgICAgICAgICAgICAgICAgIGIgKz0gJ0xlbmd0aDogJyArIHRoaXMuaGVhZGVyICsgJysnOwogICAgICAgICAgICAgICAgICAgIGIgPSAwIDw9IHRoaXMubGVuZ3RoID8gYiArIHRoaXMubGVuZ3RoIDogYiArICgtdGhpcy5sZW5ndGggKyAnICh1bmRlZmluZWQpJyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy50YWcgJiAzMiA/IGIgKz0gJzxici8+KGNvbnN0cnVjdGVkKScgOiAzICE9IHRoaXMudGFnICYmIDQgIT0gdGhpcy50YWcgfHwgbnVsbCA9PT0gdGhpcy5zdWIgfHwgKGIgKz0gJzxici8+KGVuY2Fwc3VsYXRlcyknKTsKICAgICAgICAgICAgICAgICAgICBudWxsICE9PSBlICYmIChiICs9ICc8YnIvPlZhbHVlOjxici8+PGI+JyArIGUgKyAnPC9iPicsICdvYmplY3QnID09PSB0eXBlb2Ygb2lkcyAmJiA2ID09IHRoaXMudGFnICYmIChlID0gb2lkc1tlXSkpICYmIChlLmQgJiYgKGIgKz0gJzxici8+JyArIGUuZCksIGUuYyAmJiAoYiArPSAnPGJyLz4nICsgZS5jKSwgZS53ICYmIChiICs9ICc8YnIvPih3YXJuaW5nISknKSk7CiAgICAgICAgICAgICAgICAgICAgZi5pbm5lckhUTUwgPSBiOwogICAgICAgICAgICAgICAgICAgIGEuYXBwZW5kQ2hpbGQoZik7CiAgICAgICAgICAgICAgICAgICAgYiA9IGQudGFnKCdkaXYnLCAnc3ViJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHRoaXMuc3ViKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSAwLCBmID0gdGhpcy5zdWIubGVuZ3RoOyBlIDwgZjsgKytlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5hcHBlbmRDaGlsZCh0aGlzLnN1YltlXS50b0RPTSgpKTsKICAgICAgICAgICAgICAgICAgICBhLmFwcGVuZENoaWxkKGIpOwogICAgICAgICAgICAgICAgICAgIGMub25jbGljayA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYS5jbGFzc05hbWUgPSAnbm9kZSBjb2xsYXBzZWQnID09IGEuY2xhc3NOYW1lID8gJ25vZGUnIDogJ25vZGUgY29sbGFwc2VkJzsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLnBvc1N0YXJ0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0cmVhbS5wb3M7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUucG9zQ29udGVudCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdHJlYW0ucG9zICsgdGhpcy5oZWFkZXI7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUucG9zRW5kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0cmVhbS5wb3MgKyB0aGlzLmhlYWRlciArIE1hdGguYWJzKHRoaXMubGVuZ3RoKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS5mYWtlSG92ZXIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMubm9kZS5jbGFzc05hbWUgKz0gJyBob3Zlcic7CiAgICAgICAgICAgICAgICAgICAgYSAmJiAodGhpcy5oZWFkLmNsYXNzTmFtZSArPSAnIGhvdmVyJyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuZmFrZU91dCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAvID9ob3Zlci87CiAgICAgICAgICAgICAgICAgICAgdGhpcy5ub2RlLmNsYXNzTmFtZSA9IHRoaXMubm9kZS5jbGFzc05hbWUucmVwbGFjZShjLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgYSAmJiAodGhpcy5oZWFkLmNsYXNzTmFtZSA9IHRoaXMuaGVhZC5jbGFzc05hbWUucmVwbGFjZShjLCAnJykpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLnRvSGV4RE9NX3N1YiA9IGZ1bmN0aW9uIChhLCBjLCBiLCBlLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgZSA+PSBmIHx8IChjID0gZC50YWcoJ3NwYW4nLCBjKSwgYy5hcHBlbmRDaGlsZChkLnRleHQoYi5oZXhEdW1wKGUsIGYpKSksIGEuYXBwZW5kQ2hpbGQoYykpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLnRvSGV4RE9NID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGQudGFnKCdzcGFuJywgJ2hleCcpOwogICAgICAgICAgICAgICAgICAgIGMgPT09IGEgJiYgKGMgPSBiKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhlYWQuaGV4Tm9kZSA9IGI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkLm9ubW91c2VvdmVyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmhleE5vZGUuY2xhc3NOYW1lID0gJ2hleEN1cnJlbnQnOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkLm9ubW91c2VvdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaGV4Tm9kZS5jbGFzc05hbWUgPSAnaGV4JzsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGIuYXNuMSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgYi5vbm1vdXNlb3ZlciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAhYy5zZWxlY3RlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiAoYy5zZWxlY3RlZCA9IHRoaXMuYXNuMSwgdGhpcy5jbGFzc05hbWUgPSAnaGV4Q3VycmVudCcpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFzbjEuZmFrZUhvdmVyKGEpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYi5vbm1vdXNlb3V0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGMuc2VsZWN0ZWQgPT0gdGhpcy5hc24xOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFzbjEuZmFrZU91dChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiAoYy5zZWxlY3RlZCA9IG51bGwsIHRoaXMuY2xhc3NOYW1lID0gJ2hleCcpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhpcy50b0hleERPTV9zdWIoYiwgJ3RhZycsIHRoaXMuc3RyZWFtLCB0aGlzLnBvc1N0YXJ0KCksIHRoaXMucG9zU3RhcnQoKSArIDEpOwogICAgICAgICAgICAgICAgICAgIHRoaXMudG9IZXhET01fc3ViKGIsIDAgPD0gdGhpcy5sZW5ndGggPyAnZGxlbicgOiAndWxlbicsIHRoaXMuc3RyZWFtLCB0aGlzLnBvc1N0YXJ0KCkgKyAxLCB0aGlzLnBvc0NvbnRlbnQoKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IHRoaXMuc3ViKQogICAgICAgICAgICAgICAgICAgICAgICBiLmFwcGVuZENoaWxkKGQudGV4dCh0aGlzLnN0cmVhbS5oZXhEdW1wKHRoaXMucG9zQ29udGVudCgpLCB0aGlzLnBvc0VuZCgpKSkpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKDAgPCB0aGlzLnN1Yi5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnN1YlswXSwgZiA9IHRoaXMuc3ViW3RoaXMuc3ViLmxlbmd0aCAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnRvSGV4RE9NX3N1YihiLCAnaW50cm8nLCB0aGlzLnN0cmVhbSwgdGhpcy5wb3NDb250ZW50KCksIGUucG9zU3RhcnQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBnID0gdGhpcy5zdWIubGVuZ3RoOyBlIDwgZzsgKytlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5hcHBlbmRDaGlsZCh0aGlzLnN1YltlXS50b0hleERPTShjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudG9IZXhET01fc3ViKGIsICdvdXRybycsIHRoaXMuc3RyZWFtLCBmLnBvc0VuZCgpLCB0aGlzLnBvc0VuZCgpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUudG9IZXhTdHJpbmcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0cmVhbS5oZXhEdW1wKHRoaXMucG9zU3RhcnQoKSwgdGhpcy5wb3NFbmQoKSwgITApOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIuZGVjb2RlTGVuZ3RoID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEuZ2V0KCksIGIgPSBjICYgMTI3OwogICAgICAgICAgICAgICAgICAgIGlmIChiID09IGMpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgICAgIGlmICgzIDwgYikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ0xlbmd0aCBvdmVyIDI0IGJpdHMgbm90IHN1cHBvcnRlZCBhdCBwb3NpdGlvbiAnICsgKGEucG9zIC0gMSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IGIpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gYyA9IDA7IGQgPCBiOyArK2QpCiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBjIDw8IDggfCBhLmdldCgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIuaGFzQ29udGVudCA9IGZ1bmN0aW9uIChhLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEgJiAzMikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIGlmICgzID4gYSB8fCA0IDwgYSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHZhciBmID0gbmV3IGMoZSk7CiAgICAgICAgICAgICAgICAgICAgMyA9PSBhICYmIGYuZ2V0KCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGYuZ2V0KCkgPj4gNiAmIDEpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGIuZGVjb2RlTGVuZ3RoKGYpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZi5wb3MgLSBlLnBvcyArIGcgPT0gZDsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChZKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5kZWNvZGUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEgaW5zdGFuY2VvZiBjIHx8IChhID0gbmV3IGMoYSwgMCkpOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gbmV3IGMoYSksIGUgPSBhLmdldCgpLCBmID0gYi5kZWNvZGVMZW5ndGgoYSksIGcgPSBhLnBvcyAtIGQucG9zLCBoID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZiAoYi5oYXNDb250ZW50KGUsIGYsIGEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gYS5wb3M7CiAgICAgICAgICAgICAgICAgICAgICAgIDMgPT0gZSAmJiBhLmdldCgpOwogICAgICAgICAgICAgICAgICAgICAgICBoID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwIDw9IGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBtICsgZjsgYS5wb3MgPCBuOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoW2gubGVuZ3RoXSA9IGIuZGVjb2RlKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEucG9zICE9IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ0NvbnRlbnQgc2l6ZSBpcyBub3QgY29ycmVjdCBmb3IgY29udGFpbmVyIHN0YXJ0aW5nIGF0IG9mZnNldCAnICsgbTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGIuZGVjb2RlKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gbi50YWcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaFtoLmxlbmd0aF0gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gbSAtIGEucG9zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93ICdFeGNlcHRpb24gd2hpbGUgZGVjb2RpbmcgdW5kZWZpbmVkIGxlbmd0aCBjb250ZW50OiAnICsgVzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgYS5wb3MgKz0gZjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGIoZCwgZywgZiwgZSwgaCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi50ZXN0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogWzM5XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWQ6IDM5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMjksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWQ6IDIwMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTMxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjU0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjIwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTg2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkOiAxNjcwMjY1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIGQgPSAwLCBlID0gYS5sZW5ndGg7IGQgPCBlOyArK2QpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBuZXcgYyhhW2RdLnZhbHVlLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGIuZGVjb2RlTGVuZ3RoKGYpOwogICAgICAgICAgICAgICAgICAgICAgICBmICE9IGFbZF0uZXhwZWN0ZWQgJiYgZG9jdW1lbnQud3JpdGUoJ0luIHRlc3RbJyArIGQgKyAnXSBleHBlY3RlZCAnICsgYVtkXS5leHBlY3RlZCArICcgZ290ICcgKyBmICsgJ1xuJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIEFkZm9ybS5KU0VuY3J5cHRIZWxwZXJzLkFTTjEgPSBiOwogICAgICAgICAgICB9KCkpOwogICAgICAgICAgICBBZGZvcm0uSlNFbmNyeXB0SGVscGVycy5BU04xLnByb3RvdHlwZS5nZXRIZXhTdHJpbmdWYWx1ZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRvSGV4U3RyaW5nKCkuc3Vic3RyKDIgKiB0aGlzLmhlYWRlciwgMiAqIHRoaXMubGVuZ3RoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRy5wcm90b3R5cGUucGFyc2VLZXkgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IDAsIGIgPSAwLCBkID0gL15ccyooPzpbMC05QS1GYS1mXVswLTlBLUZhLWZdXHMqKSskLy50ZXN0KGEpID8gQWRmb3JtLkpTRW5jcnlwdEhlbHBlcnMuSGV4LmRlY29kZShhKSA6IEFkZm9ybS5KU0VuY3J5cHRIZWxwZXJzLkJhc2U2NC51bmFybW9yKGEpLCBmID0gQWRmb3JtLkpTRW5jcnlwdEhlbHBlcnMuQVNOMS5kZWNvZGUoZCk7CiAgICAgICAgICAgICAgICAgICAgMyA9PT0gZi5zdWIubGVuZ3RoICYmIChmID0gZi5zdWJbMl0uc3ViWzBdKTsKICAgICAgICAgICAgICAgICAgICBpZiAoOSA9PT0gZi5zdWIubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBmLnN1YlsxXS5nZXRIZXhTdHJpbmdWYWx1ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm4gPSBKKGMsIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGYuc3ViWzJdLmdldEhleFN0cmluZ1ZhbHVlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZSA9IHBhcnNlSW50KGIsIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBmLnN1YlszXS5nZXRIZXhTdHJpbmdWYWx1ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmQgPSBKKGcsIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSBmLnN1Yls0XS5nZXRIZXhTdHJpbmdWYWx1ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnAgPSBKKG0sIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSBmLnN1Yls1XS5nZXRIZXhTdHJpbmdWYWx1ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnEgPSBKKGssIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBmLnN1Yls2XS5nZXRIZXhTdHJpbmdWYWx1ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRtcDEgPSBKKGwsIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBmLnN1Yls3XS5nZXRIZXhTdHJpbmdWYWx1ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRtcTEgPSBKKHAsIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHEgPSBmLnN1Yls4XS5nZXRIZXhTdHJpbmdWYWx1ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvZWZmID0gSihxLCAxNik7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgyID09PSBmLnN1Yi5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBmLnN1YlsxXS5zdWJbMF07CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSByLnN1YlswXS5nZXRIZXhTdHJpbmdWYWx1ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm4gPSBKKGMsIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IHIuc3ViWzFdLmdldEhleFN0cmluZ1ZhbHVlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZSA9IHBhcnNlSW50KGIsIDE2KTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEcucHJvdG90eXBlLmdldFByaXZhdGVCYXNlS2V5ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgYXJyYXk6IFsKICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEtKVVIuYXNuMS5ERVJJbnRlZ2VyKHsgJ2ludCc6IDAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBLSlVSLmFzbjEuREVSSW50ZWdlcih7IGJpZ2ludDogdGhpcy5uIH0pLAogICAgICAgICAgICAgICAgICAgICAgICBuZXcgS0pVUi5hc24xLkRFUkludGVnZXIoeyAnaW50JzogdGhpcy5lIH0pLAogICAgICAgICAgICAgICAgICAgICAgICBuZXcgS0pVUi5hc24xLkRFUkludGVnZXIoeyBiaWdpbnQ6IHRoaXMuZCB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEtKVVIuYXNuMS5ERVJJbnRlZ2VyKHsgYmlnaW50OiB0aGlzLnAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBLSlVSLmFzbjEuREVSSW50ZWdlcih7IGJpZ2ludDogdGhpcy5xIH0pLAogICAgICAgICAgICAgICAgICAgICAgICBuZXcgS0pVUi5hc24xLkRFUkludGVnZXIoeyBiaWdpbnQ6IHRoaXMuZG1wMSB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEtKVVIuYXNuMS5ERVJJbnRlZ2VyKHsgYmlnaW50OiB0aGlzLmRtcTEgfSksCiAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBLSlVSLmFzbjEuREVSSW50ZWdlcih7IGJpZ2ludDogdGhpcy5jb2VmZiB9KQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEtKVVIuYXNuMS5ERVJTZXF1ZW5jZShhKS5nZXRFbmNvZGVkSGV4KCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEcucHJvdG90eXBlLmdldFByaXZhdGVCYXNlS2V5QjY0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIFAodGhpcy5nZXRQcml2YXRlQmFzZUtleSgpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRy5wcm90b3R5cGUuZ2V0UHVibGljQmFzZUtleSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gewogICAgICAgICAgICAgICAgICAgICAgICBhcnJheTogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEtKVVIuYXNuMS5ERVJPYmplY3RJZGVudGlmaWVyKHsgb2lkOiAnMS4yLjg0MC4xMTM1NDkuMS4xLjEnIH0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEtKVVIuYXNuMS5ERVJOdWxsKCkKICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sIGIgPSBuZXcgS0pVUi5hc24xLkRFUlNlcXVlbmNlKGEpOwogICAgICAgICAgICAgICAgYSA9IHsKICAgICAgICAgICAgICAgICAgICBhcnJheTogWwogICAgICAgICAgICAgICAgICAgICAgICBuZXcgS0pVUi5hc24xLkRFUkludGVnZXIoeyBiaWdpbnQ6IHRoaXMubiB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEtKVVIuYXNuMS5ERVJJbnRlZ2VyKHsgJ2ludCc6IHRoaXMuZSB9KQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBhID0geyBoZXg6ICcwMCcgKyBuZXcgS0pVUi5hc24xLkRFUlNlcXVlbmNlKGEpLmdldEVuY29kZWRIZXgoKSB9OwogICAgICAgICAgICAgICAgYSA9IG5ldyBLSlVSLmFzbjEuREVSQml0U3RyaW5nKGEpOwogICAgICAgICAgICAgICAgYSA9IHsKICAgICAgICAgICAgICAgICAgICBhcnJheTogWwogICAgICAgICAgICAgICAgICAgICAgICBiLAogICAgICAgICAgICAgICAgICAgICAgICBhCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgS0pVUi5hc24xLkRFUlNlcXVlbmNlKGEpLmdldEVuY29kZWRIZXgoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRy5wcm90b3R5cGUuZ2V0UHVibGljQmFzZUtleUI2NCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBQKHRoaXMuZ2V0UHVibGljQmFzZUtleSgpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRy5wcm90b3R5cGUud29yZHdyYXAgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgYiA9IGIgfHwgNjQ7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEubWF0Y2goUmVnRXhwKCcoLnsxLCcgKyBiICsgJ30pKCArfCRcbj8pfCguezEsJyArIGIgKyAnfSknLCAnZycpKS5qb2luKCdcbicpIDogYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRy5wcm90b3R5cGUuZ2V0UHJpdmF0ZUtleSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnLS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLVxuJyArICh0aGlzLndvcmR3cmFwKHRoaXMuZ2V0UHJpdmF0ZUJhc2VLZXlCNjQoKSkgKyAnXG4nKSArICctLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLSc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEcucHJvdG90eXBlLmdldFB1YmxpY0tleSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnLS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS1cbicgKyAodGhpcy53b3Jkd3JhcCh0aGlzLmdldFB1YmxpY0Jhc2VLZXlCNjQoKSkgKyAnXG4nKSArICctLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0nOwogICAgICAgICAgICB9OwogICAgICAgICAgICBHLnByb3RvdHlwZS5oYXNQdWJsaWNLZXlQcm9wZXJ0eSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gYSB8fCB7fTsKICAgICAgICAgICAgICAgIHJldHVybiBhLmhhc093blByb3BlcnR5KCduJykgJiYgYS5oYXNPd25Qcm9wZXJ0eSgnZScpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBHLnByb3RvdHlwZS5oYXNQcml2YXRlS2V5UHJvcGVydHkgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYSA9IGEgfHwge307CiAgICAgICAgICAgICAgICByZXR1cm4gYS5oYXNPd25Qcm9wZXJ0eSgnbicpICYmIGEuaGFzT3duUHJvcGVydHkoJ2UnKSAmJiBhLmhhc093blByb3BlcnR5KCdkJykgJiYgYS5oYXNPd25Qcm9wZXJ0eSgncCcpICYmIGEuaGFzT3duUHJvcGVydHkoJ3EnKSAmJiBhLmhhc093blByb3BlcnR5KCdkbXAxJykgJiYgYS5oYXNPd25Qcm9wZXJ0eSgnZG1xMScpICYmIGEuaGFzT3duUHJvcGVydHkoJ2NvZWZmJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEcucHJvdG90eXBlLnBhcnNlUHJvcGVydGllc0Zyb20gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5uID0gYS5uOwogICAgICAgICAgICAgICAgdGhpcy5lID0gYS5lOwogICAgICAgICAgICAgICAgYS5oYXNPd25Qcm9wZXJ0eSgnZCcpICYmICh0aGlzLmQgPSBhLmQsIHRoaXMucCA9IGEucCwgdGhpcy5xID0gYS5xLCB0aGlzLmRtcDEgPSBhLmRtcDEsIHRoaXMuZG1xMSA9IGEuZG1xMSwgdGhpcy5jb2VmZiA9IGEuY29lZmYpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBHLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICBhICYmICgnc3RyaW5nJyA9PT0gdHlwZW9mIGEgPyB0aGlzLnBhcnNlS2V5KGEpIDogKHRoaXMuaGFzUHJpdmF0ZUtleVByb3BlcnR5KGEpIHx8IHRoaXMuaGFzUHVibGljS2V5UHJvcGVydHkoYSkpICYmIHRoaXMucGFyc2VQcm9wZXJ0aWVzRnJvbShhKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFQucHJvdG90eXBlID0gbmV3IEcoKTsKICAgICAgICAgICAgVC5wcm90b3R5cGUuY29uc3RydWN0b3IgPSBUOwogICAgICAgICAgICBEID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgPSBhIHx8IHt9OwogICAgICAgICAgICAgICAgdGhpcy5kZWZhdWx0X2tleV9zaXplID0gcGFyc2VJbnQoYS5kZWZhdWx0X2tleV9zaXplKSB8fCAxMDI0OwogICAgICAgICAgICAgICAgdGhpcy5kZWZhdWx0X3B1YmxpY19leHBvbmVudCA9IGEuZGVmYXVsdF9wdWJsaWNfZXhwb25lbnQgfHwgJzAxMDAwMSc7CiAgICAgICAgICAgICAgICB0aGlzLmxvZyA9IGEubG9nIHx8ICExOwogICAgICAgICAgICAgICAgdGhpcy5rZXkgPSBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELnByb3RvdHlwZS5zZXRLZXkgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5sb2cgJiYgdGhpcy5rZXkgJiYgY29uc29sZS53YXJuKCdBIGtleSB3YXMgYWxyZWFkeSBzZXQsIG92ZXJyaWRpbmcgZXhpc3RpbmcuJyk7CiAgICAgICAgICAgICAgICB0aGlzLmtleSA9IG5ldyBUKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELnByb3RvdHlwZS5zZXRQcml2YXRlS2V5ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuc2V0S2V5KGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELnByb3RvdHlwZS5zZXRQdWJsaWNLZXkgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5zZXRLZXkoYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEQucHJvdG90eXBlLmRlY3J5cHQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5nZXRLZXkoKS5kZWNyeXB0KFYoYSkpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgRC5wcm90b3R5cGUuZW5jcnlwdCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBQKHRoaXMuZ2V0S2V5KCkuZW5jcnlwdChhKSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBELnByb3RvdHlwZS5nZXRLZXkgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKCF0aGlzLmtleSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMua2V5ID0gbmV3IFQoKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYSAmJiAnW29iamVjdCBGdW5jdGlvbl0nID09PSB7fS50b1N0cmluZy5jYWxsKGEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMua2V5LmdlbmVyYXRlQXN5bmModGhpcy5kZWZhdWx0X2tleV9zaXplLCB0aGlzLmRlZmF1bHRfcHVibGljX2V4cG9uZW50LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0aGlzLmtleS5nZW5lcmF0ZSh0aGlzLmRlZmF1bHRfa2V5X3NpemUsIHRoaXMuZGVmYXVsdF9wdWJsaWNfZXhwb25lbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMua2V5OwogICAgICAgICAgICB9OwogICAgICAgICAgICBELnByb3RvdHlwZS5nZXRQcml2YXRlS2V5ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0S2V5KCkuZ2V0UHJpdmF0ZUtleSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBELnByb3RvdHlwZS5nZXRQcml2YXRlS2V5QjY0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0S2V5KCkuZ2V0UHJpdmF0ZUJhc2VLZXlCNjQoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRC5wcm90b3R5cGUuZ2V0UHVibGljS2V5ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0S2V5KCkuZ2V0UHVibGljS2V5KCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEQucHJvdG90eXBlLmdldFB1YmxpY0tleUI2NCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldEtleSgpLmdldFB1YmxpY0Jhc2VLZXlCNjQoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRC52ZXJzaW9uID0gJzIuMy4xJzsKICAgICAgICAgICAgd2luZG93LkFkZm9ybS5KU0VuY3J5cHQgPSBEOwogICAgICAgIH0oKSk7CiAgICAgICAgKGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgIHZhciBhID0gYi5zY3JlZW4sIGsgPSBiLm5hdmlnYXRvciwgeCA9IGIuQWRmb3JtID0gYi5BZGZvcm0gfHwge307CiAgICAgICAgICAgIGlmICgheC5Ccm93c2VySW5mbykgewogICAgICAgICAgICAgICAgayA9IGsgJiYgay5sYW5ndWFnZSA/IGsubGFuZ3VhZ2UgOiBrICYmIGsuYnJvd3Nlckxhbmd1YWdlID8gay5icm93c2VyTGFuZ3VhZ2UgOiAnJzsKICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgIHZhciB3ID0gYS53aWR0aCArICd4JyArIGEuaGVpZ2h0OwogICAgICAgICAgICAgICAgZWxzZSBpZiAoIWEgJiYgYi5qYXZhKQogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBIID0gYi5qYXZhLmF3dC5Ub29sa2l0LmdldERlZmF1bHRUb29sa2l0KCkuZ2V0U2NyZWVuU2l6ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB3ID0gSC53aWR0aCArICd4JyArIEguaGVpZ2h0OwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEEpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB4LkJyb3dzZXJJbmZvID0gewogICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiBrLAogICAgICAgICAgICAgICAgICAgIHNjcmVlblNpemU6IHcsCiAgICAgICAgICAgICAgICAgICAgY29sb3JEZXB0aDogYSA/IGEuY29sb3JEZXB0aCA6ICcnCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9CiAgICAgICAgfSh3aW5kb3cpKTsKICAgICAgICAoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgdmFyIGEgPSBiLmRvY3VtZW50LCBrID0gYi5sb2NhdGlvbjsKICAgICAgICAgICAgYi5hZGYgPSBiLmFkZiB8fCB7fTsKICAgICAgICAgICAgYi5hZGYuZnBjID0gYi5hZGYuZnBjIHx8IHsKICAgICAgICAgICAgICAgIHNldENvb2tpZTogZnVuY3Rpb24gKGIsIGssIEgsIEEsIEMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdyA9ICcnOwogICAgICAgICAgICAgICAgICAgIEggJiYgKHcgPSBuZXcgRGF0ZSgpLCB3LnNldFRpbWUody5nZXRUaW1lKCkgKyA4NjQwMDAwMCAqIEgpLCB3ID0gJzsgZXhwaXJlcz0nICsgdy50b0dNVFN0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBhLmNvb2tpZSA9IGIgKyAnPScgKyBrICsgdyArICc7IHBhdGg9LzsgJyArIChBID8gJ2RvbWFpbj0nICsgQSArICc7ICcgOiAnJykgKyAoQyA/IEMgOiAnJyk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICByZWFkQ29va2llOiBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIGIgKz0gJz0nOwogICAgICAgICAgICAgICAgICAgIHZhciBrID0gW107CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgayA9IGEuY29va2llLnNwbGl0KCc7Jyk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoQykgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB4ID0gMDsgeCA8IGsubGVuZ3RoOyB4KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgQSA9IGtbeF07ICcgJyA9PSBBLmNoYXJBdCgwKTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBBID0gQS5zdWJzdHJpbmcoMSwgQS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSBBLmluZGV4T2YoYikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQS5zdWJzdHJpbmcoYi5sZW5ndGgsIEEubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgaXNPcHRlZE91dDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnMScgPT0gdGhpcy5yZWFkQ29va2llKCdhZGZvcHRvdXQnKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICByZWFkQ29va2llU2FmZWx5OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmlzT3B0ZWRPdXQoKSA/IG51bGwgOiB0aGlzLnJlYWRDb29raWUoYSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgc2V0Q29va2llU2FmZWx5OiBmdW5jdGlvbiAoYSwgYiwgaywgQSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaXNPcHRlZE91dCgpIHx8IHRoaXMuc2V0Q29va2llKGEsIGIsIGssIEEpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGVyYXNlQ29va2llOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPyB0aGlzLnNldENvb2tpZShhLCAnJywgLTEsIGIpIDogdGhpcy5zZXRDb29raWUoYSwgJycsIC0xKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBzZXRGUENvb2tpZTogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNldENvb2tpZVNhZmVseSgnYWRmY2lkJywgYSwgNjAsIGIpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHJlYWRGUENvb2tpZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5yZWFkQ29va2llU2FmZWx5KCdhZGZjaWQnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEgJiYgYSA/IGEgOiAwOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGdldFFTUGFyYW06IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHcgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2YgYiAmJiBiID8gYiA6IGsuc2VhcmNoOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIHcgfHwgIXcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgJz8nID09IHdbMF0gJiYgKHcgPSB3LnN1YnN0cmluZygxKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBBID0gdy5zcGxpdCgnJicpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIEEgfHwgIUEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChiID0gMDsgYiA8IEEubGVuZ3RoOyBiKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB4ID0gQVtiXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyAhPSB0eXBlb2YgeCAmJiB4KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHogPSB4LnNwbGl0KCc9Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0geiAmJiAxIDwgei5sZW5ndGggJiYgelswXS50b0xvd2VyQ2FzZSgpID09IGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkZWNvZGVVUklDb21wb25lbnQoelsxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChsKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHByb2Nlc3NGaXJzdFBhcnR5Q29va2llOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gdGhpcy5nZXRRU1BhcmFtKCd1aWQnKSwgayA9IHRoaXMuZ2V0UVNQYXJhbSgncmRpcicpLCBBID0gdGhpcy5nZXRRU1BhcmFtKCdkb21haW4nKSwgeCA9IDAsIHogPSAwOwogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmlzT3B0ZWRPdXQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgeCA9IDM7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoeiA9IHRoaXMucmVhZEZQQ29va2llKCksIHogPSAndW5kZWZpbmVkJyAhPSB0eXBlb2YgeiAmJiB6ID8geiA6IGIpCiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0RlBDb29raWUoeiwgQSksIHggPSAoYiA9IHRoaXMucmVhZEZQQ29va2llKCkpICYmIGIgPT0geiA/IDEgOiAyOwogICAgICAgICAgICAgICAgICAgIChrID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGsgJiYgayA/IGsucmVwbGFjZSgne2ZwY2lkfScsIHopLnJlcGxhY2UoJ3tmcGNvbn0nLCB4KSA6IGEpICYmIHRoaXMucmVkaXJlY3RCYWNrKGspOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHJlZGlyZWN0QmFjazogZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICBiICYmIChhLmxvY2F0aW9uLmhyZWYgPSBiKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBvcHRPdXRGb3JOdW1iZXJPZkRheXM6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRDb29raWUoJ2FkZm9wdG91dCcsICcxJywgYiwgYSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5lcmFzZUNvb2tpZSgnYWRmY2lkJywgYSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgb3B0T3V0OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMub3B0T3V0Rm9yTnVtYmVyT2ZEYXlzKGEsIDczMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgfSh3aW5kb3cpKTsKICAgICAgICAoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgdmFyIGEgPSBiLkFkZm9ybSA9IGIuQWRmb3JtIHx8IHt9OwogICAgICAgICAgICBpZiAoIWEuVHJhY2tpbmdQaXhlbCkgewogICAgICAgICAgICAgICAgdmFyIGsgPSBiLkltYWdlLCB4ID0gYi5kb2N1bWVudDsKICAgICAgICAgICAgICAgIGEuVHJhY2tpbmdQaXhlbCA9IHsKICAgICAgICAgICAgICAgICAgICBpbWdzOiBbXSwKICAgICAgICAgICAgICAgICAgICBsb2FkUGl4ZWw6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gayA/IG5ldyBrKDEsIDEpIDogeC5jcmVhdGVFbGVtZW50KCdpbWcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5zcmMgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmltZ3MucHVzaChiKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9CiAgICAgICAgfSh3aW5kb3cpKTsKICAgICAgICAoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgY29uc3QgJF9fX29sZF8zMzY0ZjkyNDQ1NjQ2YjEwID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0Jyk7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8zMzY0ZjkyNDQ1NjQ2YjEwKQogICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzQ0OGI5NWE0N2RkNDlmMGEuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBsLlRyYWNraW5nLnBlbmRpbmdSZXF1ZXN0cywgZCA9IGwuZ2V0Q29uc2VudCgpLCBtOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG0gaW4gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbbV0gJiYgYS5oYXNPd25Qcm9wZXJ0eShtKSAmJiAobmV3IGIuSW1hZ2UoKS5zcmMgPSB3KG0sIGQpLnJlcGxhY2UoJ0FERnRwbW9kZT0yJywgJ0FERnRwbW9kZT0wJyksIGRlbGV0ZSBhW21dKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gayhhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAoYSB8fCAnJykuc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZm9ybTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZm9ybWRzcDogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlYWRmb3JtOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRmbmV0OiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH1bYVthLmxlbmd0aCAtIDJdXTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLnNyYzsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBGLmNyZWF0ZUVsZW1lbnQoJ2EnKTsKICAgICAgICAgICAgICAgICAgICAgICAgZC5ocmVmID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGQuaG9zdG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChrKGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHcoYSwgZCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IFtdLCB0ID0gYi5BZGZvcm0uVHJhY2tpbmcsIGYgPSB0LkdkcHIgPSB0LkdkcHIgfHwgZC5nZHByLCBnID0gdC5HZHByQ29uc2VudCA9IHQuR2RwckNvbnNlbnQgfHwgZC5nZHByX2NvbnNlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSB0LnVzX3ByaXZhY3kgPSB0LnVzX3ByaXZhY3kgfHwgZC51c19wcml2YWN5IHx8IGwuZ2V0VVNQU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIDEgPT0gZiA/IG0ucHVzaCgnZ2Rwcj0xJykgOiAoMCA9PT0gZiB8fCAnMCcgPT09IGYgfHwgITEgPT09IGYpICYmIG0ucHVzaCgnZ2Rwcj0wJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgJiYgZy5sZW5ndGggJiYgbS5wdXNoKCdnZHByX2NvbnNlbnQ9JyArIGcpOwogICAgICAgICAgICAgICAgICAgICAgICBkICYmIG0ucHVzaCgndXNfcHJpdmFjeT0nICsgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIG0ubGVuZ3RoICYmIChhICs9ICcmJyArIG0uam9pbignJicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEgoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCBkLCBiOwogICAgICAgICAgICAgICAgICAgICAgICAoYSA9IEYuY3VycmVudFNjcmlwdCkgJiYgKGIgPSB4KGEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChhID0gRi5nZXRFbGVtZW50c0J5VGFnTmFtZSgnc2NyaXB0JyksIGQgPSBhLmxlbmd0aDsgZC0tICYmICEoMCA8IGFbZF0uc3JjLmluZGV4T2YoJ3NlcnZpbmcvc2NyaXB0cy90cmFja3BvaW50JykgJiYgKGIgPSB4KGFbZF0pKSk7KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgfHwgJ2ExLmFkZm9ybS5uZXQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBBKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gYS5sb2NhdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gZC5ocmVmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBkLnByb3RvY29sOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBkLmhvc3RuYW1lOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChKKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaHR0cDonOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOic6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZmlsZTonOiAxCiAgICAgICAgICAgICAgICAgICAgICAgIH1bZl0gfHwgayhnKSAmJiBhICE9PSBhLnRvcCA/IGEgIT09IGEucGFyZW50ID8gQShiLnBhcmVudCkgOiAnJyA6IG07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEMoYSwgZCwgYikgewogICAgICAgICAgICAgICAgICAgICAgICBhLmFkZEV2ZW50TGlzdGVuZXIgPyBhLmFkZEV2ZW50TGlzdGVuZXIoZCwgYiwgITEpIDogYS5hdHRhY2hFdmVudCAmJiBhLmF0dGFjaEV2ZW50KCdvbicgKyBkLCBiKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geihhLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkICYmIGQubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IDA7IGIgPCBkLmxlbmd0aDsgYisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBkW2JdIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gZi5zb3VyY2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGYudWlkczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZyAmJiBmICYmIGYubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMDsgdCA8IGYubGVuZ3RoOyB0KyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmW3RdICYmIGZbdF0uaWQgJiYgYS5wdXNoKGVuY29kZVVSSUNvbXBvbmVudCgnZWlkXycgKyBnICsgJ18nICsgKHBhcnNlSW50KGZbdF0uYXR5cGUsIDEwKSB8fCAwKSkgKyAnPScgKyBlbmNvZGVVUklDb21wb25lbnQoZlt0XS5pZCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGIuQWRmb3JtID0gYi5BZGZvcm0gfHwge30sIEYgPSBiLmRvY3VtZW50LCBCID0gYi5zZXRUaW1lb3V0LCBmID0gYi50b3AsIGcgPSBiLlhNTEh0dHBSZXF1ZXN0LCBJID0gYi5BY3RpdmVYT2JqZWN0OwogICAgICAgICAgICAgICAgICAgIEMoYiwgJ2JlZm9yZXVubG9hZCcsIGEpOwogICAgICAgICAgICAgICAgICAgIEMoYiwgJ3Zpc2liaWxpdHljaGFuZ2UnLCBhKTsKICAgICAgICAgICAgICAgICAgICBDKGIsICdwYWdlaGlkZScsIGEpOwogICAgICAgICAgICAgICAgICAgIGIuQWRmb3JtLlRyYWNraW5nID0gYi5BZGZvcm0uVHJhY2tpbmcgfHwge307CiAgICAgICAgICAgICAgICAgICAgYi5BZGZvcm0uVHJhY2tpbmcuUGFyYW1zID0gYi5BZGZvcm0uVHJhY2tpbmcuUGFyYW1zIHx8IHt9OwogICAgICAgICAgICAgICAgICAgIGIuQWRmb3JtLlRyYWNraW5nLlBhcmFtcy5IdHRwSG9zdCA9IGIuQWRmb3JtLlRyYWNraW5nLlBhcmFtcy5IdHRwSG9zdCB8fCBIKCk7CiAgICAgICAgICAgICAgICAgICAgYi5BZGZvcm0uVHJhY2tpbmcuVmFycyA9IGIuQWRmb3JtLlRyYWNraW5nLlZhcnMgfHwge307CiAgICAgICAgICAgICAgICAgICAgYi5BZGZvcm0uVHJhY2tpbmcuVmFycy5DdXN0b20gPSBiLkFkZm9ybS5UcmFja2luZy5WYXJzLkN1c3RvbSB8fCB7fTsKICAgICAgICAgICAgICAgICAgICBiLkFkZm9ybS5UcmFja2luZy5WYXJzLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhLCBkID0gJycsIG0sIGYgPSAnQURGX19TYWxlIEFERl9fT3JkZXJJRCBBREZfX1REIEFERl9fQmFza2V0U2l6ZSBBREZfX0NvdW50cnkgQURGX192YXIxIEFERl9fdmFyMiBBREZfX3ZhcjMgQURGX192YXI0IEFERl9fdmFyNSBBREZfX3ZhcjYgQURGX192YXI3IEFERl9fdmFyOCBBREZfX3ZhcjkgQURGX192YXIxMCcuc3BsaXQoJyAnKSwgZyA9IDA7IGcgPCBmLmxlbmd0aDsgZysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gKHRoaXNbZltnXS5zdWJzdHJpbmcoNSldIHx8IGJbZltnXV0gfHwgJycpLnRvU3RyaW5nKCksIG0gPSAtMSA8IGEudG9Mb3dlckNhc2UoKS5pbmRleE9mKCc8aW5zZXJ0JykgPyAnJyA6IGVuY29kZVVSSUNvbXBvbmVudChhLnRvU3RyaW5nKCkucmVwbGFjZSgvXHx8QEAvZywgJycpKSwgZCArPSAnJyAhPSBtID8gZltnXS5zdWJzdHJpbmcoNSkgKyAnPScgKyBtICsgJ3wnIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChKKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICcnICE9IGQgJiYgKGQgPSBkLnN1YnN0cmluZygwLCBkLmxlbmd0aCAtIDEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBiLkFkZm9ybS5Ccm93c2VySW5mbyA9IGIuQWRmb3JtLkJyb3dzZXJJbmZvIHx8IHsKICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICBzY3JlZW5TaXplOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgY29sb3JEZXB0aDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZsYXNoVmVyc2lvbjogJycKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGIuQWRmb3JtLlRyYWNraW5nID0gewogICAgICAgICAgICAgICAgICAgICAgICBWYXJzOiBiLkFkZm9ybS5UcmFja2luZy5WYXJzLAogICAgICAgICAgICAgICAgICAgICAgICBQYXJhbXM6IGIuQWRmb3JtLlRyYWNraW5nLlBhcmFtcywKICAgICAgICAgICAgICAgICAgICAgICAgUHJvZHVjdHM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBTdGVwczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlldzogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJhc2tldDogMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFB1cmNoYXNlOiAzCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHBlbmRpbmdSZXF1ZXN0czogYi5BZGZvcm0uVHJhY2tpbmcucGVuZGluZ1JlcXVlc3RzIHx8IHt9LAogICAgICAgICAgICAgICAgICAgICAgICBhZGRQcm9kdWN0OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB7fSwgbSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGlkOiAncGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZHVjdGlkOiAncGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2VpZ2h0OiAnd2VpZ2h0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RlcDogJ3N0ZXAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncG5tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZHVjdG5hbWU6ICdwbm0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBncm91cDogJ3BncicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVnb3J5bmFtZTogJ3BncicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVnb3J5aWQ6ICdjaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9kdWN0c2FsZXM6ICdwc2wnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9kdWN0Y291bnQ6ICdwY250JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tOiAnY3ZyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGYgaW4gbSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPSB0eXBlb2YgYVtmXSAmJiBtLmhhc093blByb3BlcnR5KGYpICYmIChkW21bZl1dID0gYVtmXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmdldEN1c3RvbVZhcnMoYSwgZCwgJ3N2JywgMjU1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZ2V0Q3VzdG9tVmFycyhhLCBkLCAnc3ZuJywgMjU1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT0gYi5BZGZvcm0uVHJhY2tpbmcuT3JkZXIgPyAoYi5BZGZvcm0uVHJhY2tpbmcuT3JkZXIuaXRtcyA9IGIuQWRmb3JtLlRyYWNraW5nLk9yZGVyLml0bXMgfHwgW10sIGIuQWRmb3JtLlRyYWNraW5nLk9yZGVyLml0bXMucHVzaChkKSkgOiBiLkFkZm9ybS5UcmFja2luZy5Qcm9kdWN0cy5wdXNoKGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGIuQWRmb3JtLlRyYWNraW5nLlZhcnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPSB0eXBlb2YgZC5PcmRlciAmJiBudWxsICE9IGQuT3JkZXIgPyAoZC5PcmRlci5wcm9kdWN0cyA9IGQuT3JkZXIucHJvZHVjdHMgfHwgW10sIGQuT3JkZXIucHJvZHVjdHMucHVzaChhKSkgOiAoZC5Qcm9kdWN0cyA9IGQuUHJvZHVjdHMgfHwgW10sIGQuUHJvZHVjdHMucHVzaChhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZU9yZGVyOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB7fSwgbSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FsZXM6ICdzbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yZGVyaWQ6ICdpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvdW50cnk6ICdjbnRyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFza2V0c2l6ZTogJ2JzeicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFnZWdyb3VwOiAnYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2VuZGVyOiAnZ2VuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVuY3k6ICdjdXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9kdWN0Z3JvdXA6ICdwZ3InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcmRlcnN0YXR1czogJ29zdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChmIGluIG0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGFbZl0gJiYgbS5oYXNPd25Qcm9wZXJ0eShmKSAmJiAoZFttW2ZdXSA9IGFbZl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5nZXRDdXN0b21WYXJzKGEsIGQsICd2YXInLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmdldEN1c3RvbVZhcnMoYSwgZCwgJ3N2JywgMjU1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZ2V0Q3VzdG9tVmFycyhhLCBkLCAnc3ZuJywgMjU1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuQWRmb3JtLlRyYWNraW5nLk9yZGVyID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuQWRmb3JtLlRyYWNraW5nLlZhcnMuT3JkZXIgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBnZXRDdXN0b21WYXJzOiBmdW5jdGlvbiAoYSwgZCwgYiwgZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbSBpbiBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09IG0udG9Mb3dlckNhc2UoKS5pbmRleE9mKGIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gbS5zbGljZShiLmxlbmd0aCksIHQgPSBwYXJzZUludChnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC50b1N0cmluZygpID09IGcgJiYgMCA8IHQgJiYgdCA8PSBmICYmICgoZyA9IGFbbV0pICYmIGcuZW5jcnlwdCAmJiAhZy5pc0VuY3J5cHRlZCAmJiAoZy52YWx1ZSA9IHRoaXMuZW5jcnlwdChnLnZhbHVlKSwgZy5pc0VuY3J5cHRlZCA9ICEwKSwgZFtiICsgdC50b1N0cmluZygpXSA9IGcgJiYgZy5lbmNyeXB0ID8gZy52YWx1ZSA6IGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZW5jcnlwdDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChiLmFkZi5QYXJhbXMuZW5jcnlwdG9yKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdNRDUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBsLkNyeXB0b0pTLk1ENShhKS50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnU0hBMjU2JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gbC5DcnlwdG9KUy5TSEEyNTYoYSkudG9TdHJpbmcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1JTQSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IG5ldyBsLkpTRW5jcnlwdCgpLCBkLnNldEtleShiLmFkZi5QYXJhbXMucHVibGljS2V5KSwgZCA9IGQuZW5jcnlwdChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBDaGVja0VzY2FwZTogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhID0gKC0xICE9IGEuaW5kZXhPZignJScpID8gYSA6IGVuY29kZVVSSUNvbXBvbmVudChhKSkucmVwbGFjZSgvXCsvZywgJyUyQicpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBHZXRRdWVyeVZhcjogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IGIubG9jYXRpb24uc2VhcmNoLnN1YnN0cmluZygxKS5zcGxpdCgnJicpLCBtID0gMDsgbSA8IGQubGVuZ3RoOyBtKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBkW21dLnNwbGl0KCc9Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmWzBdLnRvTG93ZXJDYXNlKCkgPT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgQ3JlYXRlSWZyYW1lRWxlbWVudDogZnVuY3Rpb24gSyhhLCBtLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChGLmJvZHkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBmICYmICdvYmplY3QnID09PSB0eXBlb2YgZiA/ICcgbmFtZT1cJycgKyBKU09OLnN0cmluZ2lmeShmKSArICdcJycgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBGLmNyZWF0ZUVsZW1lbnQoJ2RpdicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLmlubmVySFRNTCA9ICc8aWZyYW1lIHNyYz0iJyArIGEgKyAnIiBhbGxvd3RyYW5zcGFyZW5jeT0idHJ1ZSIgd2Via2l0YWxsb3dmdWxsc2NyZWVuIG1vemFsbG93ZnVsbHNjcmVlbiBhbGxvd2Z1bGxzY3JlZW4gbWFyZ2lud2lkdGg9IjAiIG1hcmdpbmhlaWdodD0iMCIgaHNwYWNlPSIwIiB2c3BhY2U9IjAiIGZyYW1lYm9yZGVyPSIwIiBzY3JvbGxpbmc9Im5vIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBzdHlsZT0iZGlzcGxheTpub25lIicgKyBkICsgJz48L2lmcmFtZT4nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGLmJvZHkuYXBwZW5kQ2hpbGQoZy5yZW1vdmVDaGlsZChnLmZpcnN0Q2hpbGQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQyhiLCAnbG9hZCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEsoYSwgbSwgZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoUCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBMb2FkU2NyaXB0OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBGLmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpLCBiID0gRi5nZXRFbGVtZW50c0J5VGFnTmFtZSgnc2NyaXB0JylbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnR5cGUgPSAndGV4dC9qYXZhc2NyaXB0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQuc3JjID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUoZCwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIEJhc2U2NDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgX2tleVN0cjogJ0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5LV89JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuY29kZTogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IFtdLCBiID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgPSB0aGlzLl91dGY4X2VuY29kZShhKTsgYiA8IGEubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGEuY2hhckNvZGVBdChiKyspOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGEuY2hhckNvZGVBdChiKyspOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IGEuY2hhckNvZGVBdChiKyspOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGYgPj4gMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IChmICYgMykgPDwgNCB8IGcgPj4gNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEkgPSAoZyAmIDE1KSA8PCAyIHwgayA+PiA2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgQiA9IGsgJiA2MzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNOYU4oZykgPyBJID0gQiA9IDY0IDogaXNOYU4oaykgJiYgKEIgPSA2NCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQucHVzaCh0aGlzLl9rZXlTdHIuY2hhckF0KGwpLCB0aGlzLl9rZXlTdHIuY2hhckF0KGYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjQgIT0gSSAmJiBkLnB1c2godGhpcy5fa2V5U3RyLmNoYXJBdChJKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDY0ICE9IEIgJiYgZC5wdXNoKHRoaXMuX2tleVN0ci5jaGFyQXQoQikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZC5qb2luKCcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfdXRmOF9lbmNvZGU6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEucmVwbGFjZSgvXHJcbi9nLCAnXG4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gJycsIGIgPSAwOyBiIDwgYS5sZW5ndGg7IGIrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGEuY2hhckNvZGVBdChiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTI4ID4gZiA/IGQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShmKSA6ICgxMjcgPCBmICYmIDIwNDggPiBmID8gZCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGYgPj4gNiB8IDE5MikgOiAoZCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGYgPj4gMTIgfCAyMjQpLCBkICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoZiA+PiA2ICYgNjMgfCAxMjgpKSwgZCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGYgJiA2MyB8IDEyOCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgQ2xpY2tUcmFjazogZnVuY3Rpb24gKGEsIGYsIGcsIGssIGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnICE9IHR5cGVvZiBhLmhyZWYgPyAodGhpcy5UcmFjayhmLCBnLCBrLCBsLCAwLCAxMCksICd1bmRlZmluZWQnICE9IHR5cGVvZiBhLnRhcmdldCAmJiAnJyAhPSBhLnRhcmdldCA/IEIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIub3BlbihhLmhyZWYsIGEudGFyZ2V0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDEwMCkgOiBCKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLmxvY2F0aW9uID0gYS5ocmVmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTAwKSkgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgYS50eXBlICYmICdzdWJtaXQnID09IGEudHlwZSA/ICh0aGlzLlRyYWNrKGYsIGcsIGssIGwsIDAsIDEwKSwgQihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5mb3JtLnN1Ym1pdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTAwKSkgOiB0aGlzLlRyYWNrKGYsIGcsIGssIGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5DbGVhblVwKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIENvbnRhaW5lcjogZnVuY3Rpb24gKGEsIGIsIGYsIGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuVHJhY2soYSwgYiwgZiwgZywgJ0NvbnRhaW5lcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5DbGVhblVwKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIFRyYWNrOiBmdW5jdGlvbiAoYSwgbSwgZywgaywgSSwgQikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB0aGlzLCB4ID0gZW5jb2RlVVJJQ29tcG9uZW50KGwuQnJvd3NlckluZm8ubGFuZ3VhZ2UgKyAnfCcgKyBsLkJyb3dzZXJJbmZvLmxhbmd1YWdlICsgJ3wnICsgbC5Ccm93c2VySW5mby5zY3JlZW5TaXplICsgJ3wnICsgbC5Ccm93c2VySW5mby5jb2xvckRlcHRoKSwgRyA9ICdodHRwczovLycgKyBsLlRyYWNraW5nLlBhcmFtcy5IdHRwSG9zdCwgRSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFID0gZi5kb2N1bWVudC5yZWZlcnJlcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFID0gRi5yZWZlcnJlcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBLID0gQShiKSwgeSA9IGIuQWRmb3JtLlRyYWNraW5nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5QYXJhbXMuUGFnZU5hbWUgPSB5LlBhcmFtcy5QYWdlTmFtZSB8fCBiLkFERlBhZ2VOYW1lIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5QYXJhbXMuRGl2aWRlciA9ICcnID09IHkuUGFyYW1zLlBhZ2VOYW1lID8gJycgOiB5LlBhcmFtcy5EaXZpZGVyIHx8IGIuQURGZGl2aWRlciB8fCAnfCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LlZhcnMuU2FsZSA9IHkuVmFycy5TYWxlIHx8IGIuQURGX19TYWxlIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5WYXJzLk9yZGVySUQgPSB5LlZhcnMuT3JkZXJJRCB8fCBiLkFERl9fT3JkZXJJRCB8fCAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuVmFycy5TdWJPcmRlcnMgPSB5LlZhcnMuU3ViT3JkZXJzIHx8IGIuQURGX19TdWJPcmRlcnMgfHwgJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LlZhcnMuQ1ByZWYgPSBFIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5WYXJzLmxvYyA9IEsgfHwgJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LkFkdmVydGlzZXJJZCA9IHkuQWR2ZXJ0aXNlcklkIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5UaGlyZFBhcnR5SWQgPSB5LlRoaXJkUGFydHlJZCB8fCAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBNID0gTWF0aC5mbG9vcigxMDAwMDAwMDAwMDAwICogTWF0aC5yYW5kb20oKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIG0gJiYgbSA/IG0gOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuSXNOdW1iZXIobSkgfHwgJycgIT0geS5QYXJhbXMuUGFnZU5hbWUgfHwgKHkuUGFyYW1zLlBhZ2VOYW1lID0gbSwgeS5QYXJhbXMuRGl2aWRlciA9ICd8JywgbSA9ICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0geS5WYXJzLnRvU3RyaW5nKCksIHEgPSBlbmNvZGVVUklDb21wb25lbnQoeS5WYXJzLlN1Yk9yZGVycyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwID0gbnVsbCAhPSBwICYmICcnICE9IHAgfHwgbnVsbCAhPSBxICYmICcnICE9IHEgPyBwICsgJ0BAJyArIHEgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnICE9IHR5cGVvZiBnICYmIG51bGwgIT0gZyAmJiAodGhpcy5Jc1N0cmluZyhnKSA/IHAgPSBnICsgJ0BAJyA6IHRoaXMuQ3JlYXRlT3JkZXJBbmRQcm9kdWN0VmFycyhnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLlB1c2hJZk5vdEVtcHR5KGcsIHRoaXMuSm9pbklmTm90RW1wdHkoJ0FERlBhZ2VOYW1lJywgdGhpcy5DaGVja0VzY2FwZSh5LlBhcmFtcy5QYWdlTmFtZSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuUHVzaElmTm90RW1wdHkoZywgdGhpcy5Kb2luSWZOb3RFbXB0eSgnQURGZGl2aWRlcicsIHRoaXMuQ2hlY2tFc2NhcGUoeS5QYXJhbXMuRGl2aWRlcikpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuUHVzaElmTm90RW1wdHkoZywgdGhpcy5Kb2luSWZOb3RFbXB0eSgnQURGc3lzdmFycycsIHApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuUHVzaElmTm90RW1wdHkoZywgdGhpcy5Kb2luSWZOb3RFbXB0eSgnb3JkJywgTSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5QdXNoSWZOb3RFbXB0eShnLCB0aGlzLkpvaW5JZk5vdEVtcHR5KCdTZXQxJywgeCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5QdXNoSWZOb3RFbXB0eShnLCB0aGlzLkpvaW5BbmRFbmNvZGVJZk5vdEVtcHR5KCdDUHJlZicsIEUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuUHVzaElmTm90RW1wdHkoZywgdGhpcy5Kb2luQW5kRW5jb2RlSWZOb3RFbXB0eSgnaXByb2RncnAnLCB5LlZhcnMuSW50ZXJlc3RQcm9kdWN0R3JvdXApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuUHVzaElmTm90RW1wdHkoZywgdGhpcy5Kb2luQW5kRW5jb2RlSWZOb3RFbXB0eSgnaXByb2QnLCB5LlZhcnMuSW50ZXJlc3RQcm9kdWN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLlB1c2hJZk5vdEVtcHR5KGcsIHRoaXMuSm9pbkFuZEVuY29kZUlmTm90RW1wdHkoJ2lwcm9kd2dodCcsIHkuVmFycy5JbnRlcmVzdFByb2R1Y3RXZWlnaHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnICE9IHR5cGVvZiBrICYmICcnICE9IGsgJiYgayA/IHRoaXMuUHVzaElmTm90RW1wdHkoZywgdGhpcy5Kb2luQW5kRW5jb2RlSWZOb3RFbXB0eSgncmRpcicsIGspKSA6ICgnQ29udGFpbmVyJyA9PSBJID8gZy5wdXNoKCdBREZ0cG1vZGU9MycpIDogZy5wdXNoKCdBREZ0cG1vZGU9MicpLCB0aGlzLlB1c2hJZk5vdEVtcHR5KGcsIHRoaXMuSm9pbkFuZEVuY29kZUlmTm90RW1wdHkoJ0FERnNhbGUnLCB5LlZhcnMuU2FsZSkpLCB0aGlzLlB1c2hJZk5vdEVtcHR5KGcsIHRoaXMuSm9pbkFuZEVuY29kZUlmTm90RW1wdHkoJ0FERm9yZGVyaWQnLCB5LlZhcnMuT3JkZXJJRCkpLCB0aGlzLlB1c2hJZk5vdEVtcHR5KGcsIHRoaXMuSm9pbkFuZEVuY29kZUlmTm90RW1wdHkoJ0FERlN1Yk9yZGVycycsIHkuVmFycy5TdWJPcmRlcnMpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICEwLCBEOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChEIGluIHkuVmFycy5DdXN0b20pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkuVmFycy5DdXN0b20uaGFzT3duUHJvcGVydHkoRCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuUHVzaElmTm90RW1wdHkoZywgdGhpcy5Kb2luSWYoJ2FkZmN1c3R2YXJzJywgZW5jb2RlVVJJQ29tcG9uZW50KGIuQWRmb3JtLkpTT04uc3RyaW5naWZ5KHkuVmFycy5DdXN0b20pKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCB0aGlzLlB1c2hJZk5vdEVtcHR5KGcsIHRoaXMuSm9pbklmKCdlY3ByJywgdGhpcy5CYXNlNjQuZW5jb2RlKGIuQWRmb3JtLkpTT04uc3RyaW5naWZ5KHkuUHJvZHVjdHMpKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA8IHkuUHJvZHVjdHMubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgdGhpcy5QdXNoSWZOb3RFbXB0eShnLCB0aGlzLkpvaW5JZignaXRtJywgdGhpcy5CYXNlNjQuZW5jb2RlKGIuQWRmb3JtLkpTT04uc3RyaW5naWZ5KHkuT3JkZXIpKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSB5Lk9yZGVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgdGhpcy5QdXNoSWZOb3RFbXB0eShnLCB0aGlzLkpvaW5BbmRFbmNvZGVJZk5vdEVtcHR5KCdsb2MnLCBLKSksIHRoaXMuUHVzaElmTm90RW1wdHkoZywgdGhpcy5Kb2luSWYoJ21zcmMnLCAnMScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPCB5LkFkdmVydGlzZXJJZC5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCB0aGlzLlB1c2hJZk5vdEVtcHR5KGcsIHRoaXMuSm9pbklmKCdhZGlkJywgZW5jb2RlVVJJQ29tcG9uZW50KHkuQWR2ZXJ0aXNlcklkKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA8IHkuQWR2ZXJ0aXNlcklkLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChTKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB6KGcsIHkuZWlkcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gYSA/ICcvU2VydmluZy9UcmFja1BvaW50Lz9wbT0nICsgYSArICgnJyA9PSBtID8gJycgOiAnJmxpZD0nICsgbSkgKyAnJicgKyBnLmpvaW4oJyYnKSA6ICcvQmFubmVycy9JbnZpc2libGUuZ2lmJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBDID0gRyArIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnBlbmRpbmdSZXF1ZXN0c1tDXSA9IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLndhaXRGb3JDb25zZW50KGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEgfHwge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5wZW5kaW5nUmVxdWVzdHNbQ10gJiYgKGQuTG9hZFNjcmlwdCh3KEMsIGEpKSwgZGVsZXRlIGQucGVuZGluZ1JlcXVlc3RzW0NdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEIgfHwgMTAwMDApOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBKb2luSWY6IGZ1bmN0aW9uIChhLCBiLCBnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZygpID8gYSArICc9JyArIGIgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgSm9pbklmTm90RW1wdHk6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5Kb2luSWYoYSwgYiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGIgJiYgJycgIT0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBKb2luQW5kRW5jb2RlSWZOb3RFbXB0eTogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLkpvaW5JZihhLCBlbmNvZGVVUklDb21wb25lbnQoYiksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBiICYmICcnICE9IGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgUHVzaElmTm90RW1wdHk6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IGIgJiYgJycgIT0gYiAmJiBhLnB1c2goYik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIFRyYWNrQ2xlYW46IGZ1bmN0aW9uIChhLCBiLCBnLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLlRyYWNrKGEsIGIsIGcsIGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5DbGVhblVwKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIENyZWF0ZU9yZGVyQW5kUHJvZHVjdFZhcnM6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLklzU3RyaW5nKGEpIHx8ICh0aGlzLklzT2JqZWN0KGEpICYmICh0aGlzLk9yZGVyID0gbnVsbCwgdGhpcy5Qcm9kdWN0cyA9IFtdLCB0aGlzLmNyZWF0ZU9yZGVyKGEpLCB0aGlzLklzQXJyYXkoYS5pdG1zKSAmJiB0aGlzLkFkZFByb2R1Y3RzRnJvbUFycmF5KGEuaXRtcykpLCB0aGlzLklzQXJyYXkoYSkgJiYgdGhpcy5BZGRQcm9kdWN0c0Zyb21BcnJheShhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIElzQXJyYXk6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEgJiYgJ1tvYmplY3QgQXJyYXldJyA9PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIElzT2JqZWN0OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnICE9IHR5cGVvZiBhICYmICdbb2JqZWN0IE9iamVjdF0nID09IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgSXNTdHJpbmc6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEgJiYgJ1tvYmplY3QgU3RyaW5nXScgPT0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBJc051bWJlcjogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhaXNOYU4ocGFyc2VGbG9hdChhKSkgJiYgaXNGaW5pdGUoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIEFkZFByb2R1Y3RzRnJvbUFycmF5OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gMDsgYiA8IGEubGVuZ3RoOyBiKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYWRkUHJvZHVjdChhW2JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKE0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgQ2xlYW5VcDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IGwuVHJhY2tpbmcuVmFycywgYiA9ICd2YXIxIHZhcjIgdmFyMyB2YXI0IHZhcjUgdmFyNiB2YXI3IHZhcjggdmFyOSB2YXIxMCBTYWxlIE9yZGVySUQgU3ViT3JkZXJzJy5zcGxpdCgnICcpLCBnID0gMDsgZyA8IGIubGVuZ3RoOyBnKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtiW2ddXSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5UcmFja2luZy5Qcm9kdWN0cyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5UcmFja2luZy5PcmRlciA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLlRyYWNraW5nLlBhcmFtcy5QYWdlTmFtZSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5UcmFja2luZy5QYXJhbXMuRGl2aWRlciA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBhcHBlbmRGaXJzdFBhcnR5SWQ6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHRoaXMuZnBjLnJlYWRDb29raWUoJ2FkZm9ybWZycGlkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZwYy5zZXRDb29raWUoJ2FkZm9ybWZycGlkJywgZCB8fCBiLCAzMCwgdm9pZCAwLCAnc2VjdXJlOyBTYW1lU2l0ZT1MYXgnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSB0aGlzLmZwYy5yZWFkQ29va2llKCdhZGZvcm1mcnBpZCcpIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLkxvYWRTY3JpcHQoYSArICcmZnJwaWQ9JyArIGIpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBQb3N0OiBmdW5jdGlvbiAoYSwgZiwgaykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCcnICE9IGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gdGhpcy5Jc051bWJlcihmKSA/ICcmbGlkPScgKyBmIDogJyZBREZQYWdlTmFtZT0nICsgZiArICcmQURGZGl2aWRlcj18JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuUHVzaElmTm90RW1wdHkoZCwgdGhpcy5Kb2luSWYoJ2VjcHInLCB0aGlzLkJhc2U2NC5lbmNvZGUoYi5BZGZvcm0uSlNPTi5zdHJpbmdpZnkoYi5BZGZvcm0uVHJhY2tpbmcuUHJvZHVjdHMpKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPCBiLkFkZm9ybS5UcmFja2luZy5Qcm9kdWN0cy5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgdGhpcy5QdXNoSWZOb3RFbXB0eShkLCB0aGlzLkpvaW5JZignaXRtJywgdGhpcy5CYXNlNjQuZW5jb2RlKGIuQWRmb3JtLkpTT04uc3RyaW5naWZ5KGIuQWRmb3JtLlRyYWNraW5nLk9yZGVyKSksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGIuQWRmb3JtLlRyYWNraW5nLk9yZGVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoTikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPCBkLmxlbmd0aCAmJiAobSA9ICcmJyArIGQuam9pbignJicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJ2h0dHBzOi8vJyArIGwuVHJhY2tpbmcuUGFyYW1zLkh0dHBIb3N0ICsgKGEgPyAnL1NlcnZpbmcvVHJhY2tQb2ludC8/cG09JyArIGEgKyBmICsgJyZBREZ0cG1vZGU9MicgKyBtIDogJy9CYW5uZXJzL0ludmlzaWJsZS5naWYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgQjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBKU09OKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHcgPSBKU09OLnN0cmluZ2lmeShrKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ID0gJ1wneyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB4IGluIGspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdyArPSAnIicgKyB4ICsgJyI6IicgKyBrW3hdICsgJyIsJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcgKz0gJ31cJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5YTUxIdHRwUmVxdWVzdCA/IEIgPSBuZXcgZygpIDogSSAmJiAoQiA9IG5ldyBJKCdNaWNyb3NvZnQuWE1MSFRUUCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQi5vcGVuKCdQT1NUJywgYSwgITEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCLnNldFJlcXVlc3RIZWFkZXIoJ0NvbnRlbnQtVHlwZScsICdhcHBsaWNhdGlvbi9qc29uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEIuc2VuZCh3KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChOKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBiLkFkZm9ybS5UcmFja2luZy5mcGMgPSBiLmFkZi5mcGMgfHwge307CiAgICAgICAgICAgICAgICAgICAgYi5BZGZvcm0uVHJhY2tpbmcuYXN5bmMgPSBiLmFkZi5hc3luYyB8fCB7fTsKICAgICAgICAgICAgICAgICAgICBiLmFkZiA9IGIuQWRmb3JtLlRyYWNraW5nOwogICAgICAgICAgICAgICAgICAgIGIuYWRmLnRyYWNrID0gYi5BZGZvcm0uVHJhY2tpbmcuVHJhY2tDbGVhbjsKICAgICAgICAgICAgICAgICAgICBiLmFkZi5jbGlja3RyYWNrID0gYi5BZGZvcm0uVHJhY2tpbmcuQ2xpY2tUcmFjazsKICAgICAgICAgICAgICAgICAgICBiLmFkZi5jb250YWluZXIgPSBiLkFkZm9ybS5UcmFja2luZy5Db250YWluZXI7CiAgICAgICAgICAgICAgICAgICAgYi5hZGYucG9zdCA9IGIuQWRmb3JtLlRyYWNraW5nLlBvc3Q7CiAgICAgICAgICAgICAgICAgICAgYi5hZGYuY3JlYXRlSXRlbSA9IGIuYWRmLmNyZWF0ZU9yZGVyOwogICAgICAgICAgICAgICAgICAgIGIuYWRmLmFkZFN1Ykl0ZW0gPSBiLmFkZi5hZGRQcm9kdWN0OwogICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMzM2NGY5MjQ0NTY0NmIxMCkKICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzMzNjRmOTI0NDU2NDZiMTApKTsKICAgICAgICAgICAgfQogICAgICAgIH0od2luZG93KSk7CiAgICAgICAgKGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgIGIuYWRmID0gYi5hZGYgfHwge307CiAgICAgICAgICAgIGIuYWRmLlBhcmFtcyA9IGIuYWRmLlBhcmFtcyB8fCB7fTsKICAgICAgICAgICAgYi5hZGYuYXN5bmMgPSBiLmFkZi5hc3luYyB8fCB7fTsKICAgICAgICAgICAgYi5hZGYuYXN5bmMuSXNBcnJheSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEgJiYgJ1tvYmplY3QgQXJyYXldJyA9PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGIuYWRmLmFzeW5jLklzT2JqZWN0ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgYSAmJiAnW29iamVjdCBPYmplY3RdJyA9PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGIuYWRmLmFzeW5jLlRyYWNrT25lID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmIChhICYmICFhLmlzVHJhY2tlZCkgewogICAgICAgICAgICAgICAgICAgIHZhciBrID0gYS5wbSB8fCBudWxsLCB4ID0gYS5pZCB8fCBudWxsLCB3ID0gYS5vcmRlciB8fCBhLnByb2R1Y3RzIHx8IG51bGwsIEggPSBhLnJkaXIgfHwgbnVsbCwgQSA9IGEucGFnZW5hbWUgfHwgbnVsbCwgQyA9IGEuZGl2aWRlciB8fCBudWxsLCB6ID0gYS5lbmNyeXB0b3IgfHwgbnVsbCwgbCA9IGEucHVibGljS2V5IHx8IG51bGwsIEYgPSBhLmFkaWQgfHwgbnVsbCwgQiA9IGEudHBpZCB8fCBudWxsLCBmID0gYS5nZHByIHx8IG51bGwsIGcgPSBhLmdkcHJfY29uc2VudCB8fCBudWxsLCBJID0gYS5IdHRwSG9zdCB8fCBudWxsLCB0ID0gYS51c19wcml2YWN5IHx8IG51bGwsIGQgPSBhLmVpZHMgfHwgbnVsbDsKICAgICAgICAgICAgICAgICAgICBudWxsICE9IGsgJiYgKEYgJiYgKGIuYWRmLkFkdmVydGlzZXJJZCA9IEYpLCBCICYmIChiLmFkZi5UaGlyZFBhcnR5SWQgPSBCKSwgeiAmJiAoYi5hZGYuUGFyYW1zLmVuY3J5cHRvciA9IHopLCBsICYmIChiLmFkZi5QYXJhbXMucHVibGljS2V5ID0gbCksIGYgJiYgKGIuYWRmLkdkcHIgPSBmKSwgZyAmJiAoYi5hZGYuR2RwckNvbnNlbnQgPSBnKSwgSSAmJiAoYi5hZGYuUGFyYW1zLkh0dHBIb3N0ID0gSSksIHQgJiYgKGIuYWRmLnVzX3ByaXZhY3kgPSB0KSwgZCAmJiAoYi5hZGYuZWlkcyA9IGQpLCBBID8gKGIuYWRmLlBhcmFtcy5QYWdlTmFtZSA9IEEsIGIuYWRmLlBhcmFtcy5EaXZpZGVyID0gQywgYi5hZGYudHJhY2soaywgbnVsbCwgdywgSCkpIDogYi5hZGYudHJhY2soaywgeCwgdywgSCksIGEuaXNUcmFja2VkID0gITApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBiLmFkZi5hc3luYy50cmFjayA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSB0aGlzLklzQXJyYXkoYi5fYWRmdHJhY2spID8gYi5fYWRmdHJhY2sgOiB0aGlzLklzT2JqZWN0KGIuX2FkZnRyYWNrKSA/IFtiLl9hZGZ0cmFja10gOiBbXSwgayA9IDA7IGsgPCBhLmxlbmd0aDsgaysrKQogICAgICAgICAgICAgICAgICAgIHRoaXMuVHJhY2tPbmUoYVtrXSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGIuYWRmLmFzeW5jLnRyYWNrKGIuYWRmKTsKICAgICAgICB9KHdpbmRvdykpOwogICAgfSgpKQp9"},{"name":"sugarcoat-8c173320401d8fc5291c1ea5e26e89a50fb17a42","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfZDBjMmUyNzAzY2I1MjJkNyA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBsZXQgaXNTZWFsZWQgPSBmYWxzZTsKICAgICAgICBjbGFzcyBTdG9yYWdlIHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBpZiAoaXNTZWFsZWQpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IGxlbmd0aCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyh0aGlzKS5sZW5ndGg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAga2V5KGluZGV4KSB7CiAgICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXModGhpcyk7CiAgICAgICAgICAgICAgICBpZiAoaW5kZXggPCAwIHx8IGluZGV4ID49IGtleXMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4ga2V5c1tpbmRleF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0SXRlbShrZXkpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwodGhpcywga2V5KSA/IHRoaXNba2V5XSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0SXRlbShrZXksIHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW2tleV0gPSBTdHJpbmcodmFsdWUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJlbW92ZUl0ZW0oa2V5KSB7CiAgICAgICAgICAgICAgICBkZWxldGUgdGhpc1trZXldOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGNsZWFyKCkgewogICAgICAgICAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKHRoaXMpOwogICAgICAgICAgICAgICAgZm9yIChjb25zdCBrZXkgb2Yga2V5cykgewogICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2tleV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5TdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBTdG9yYWdlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY29uc3QgbG9jYWxTdG9yYWdlID0gbmV3IFN0b3JhZ2UoKTsKICAgICAgICBleHBvcnRzLmxvY2FsU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbG9jYWxTdG9yYWdlOwogICAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBjb25zdCBzZXNzaW9uU3RvcmFnZSA9IG5ldyBTdG9yYWdlKCk7CiAgICAgICAgZXhwb3J0cy5zZXNzaW9uU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gc2Vzc2lvblN0b3JhZ2U7CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGlzU2VhbGVkID0gdHJ1ZTsKICAgIH0pKCRfX19tb2NrX2QwYzJlMjcwM2NiNTIyZDcpOwogICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICBNYXJrZXRpbmcuYmluZERlcGVuZGVuY3lET01QYXJzZWQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICB2YXIgQm9vdHN0cmFwcGVyID0gd2luZG93WydNYXJrZXRpbmcnXTsKICAgICAgICAgICAgdmFyIGVuc2lnaHRlbk9wdGlvbnMgPSBNYXJrZXRpbmcuZW5zaWdodGVuT3B0aW9uczsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ1N0YXJ0KCdydWxlSWQtJyArIHRoaXMuaWQgKyAnLWRlcGxveW1lbnRJZC0nICsgdGhpcy5kZXBsb3ltZW50SWQpOwogICAgICAgICAgICAgICAgdmFyIGdlb0xvY2F0aW9uID0gWwogICAgICAgICAgICAgICAgICAgICdhdScsCiAgICAgICAgICAgICAgICAgICAgJ256JywKICAgICAgICAgICAgICAgICAgICAnaW4nLAogICAgICAgICAgICAgICAgICAgICdzZycsCiAgICAgICAgICAgICAgICAgICAgJ215JywKICAgICAgICAgICAgICAgICAgICAnanAnLAogICAgICAgICAgICAgICAgICAgICdrcicsCiAgICAgICAgICAgICAgICAgICAgJ3R3JywKICAgICAgICAgICAgICAgICAgICAnaGsnCiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgdmFyIGZpcmVQaXhlbCA9IGZ1bmN0aW9uIChwaXhlbElEKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHNjcmlwdFVybCA9IHBpeGVsSUQgKyAnJnMxPScgKyBlbmNvZGVVUklDb21wb25lbnQod2luZG93LmxvY2F0aW9uLmhyZWYpICsgJyZzMj0nICsgZW5jb2RlVVJJQ29tcG9uZW50KGRvY3VtZW50LnJlZmVycmVyKSArICcmczM9JyArIE1hcmtldGluZy5VRE8ucHJvbW9pZCArICcmczQ9JnM1PScgKyBNYXJrZXRpbmcuVURPLnByb2RjYXQgKyAnJnM2PSZzNz0nICsgTWFya2V0aW5nLlVETy5vcmRlcmNvZGUgKyAnJnM4PScgKyBlbmNvZGVVUklDb21wb25lbnQoTWFya2V0aW5nLlVETy5jYXRlZ29yeSkgKyAnJnM5PScgKyBlbmNvZGVVUklDb21wb25lbnQoTWFya2V0aW5nLlVETy5mYW1pbHkpICsgJyZzMTA9JyArIE1hcmtldGluZy5VRE8ucHJvZHVjdCArICcmdjE9JyArIE1hcmtldGluZy5VRE8ucmV2ZW51ZSArICcmdjI9JyArIE1hcmtldGluZy5VRE8uZGVhbHMgKyAnJnYzPSZ2ND0mdjU9JyArIE1hcmtldGluZy5zY0RhdGFPYmouY291bnRyeSArICcmdjY9JyArIE1hcmtldGluZy5zY0RhdGFPYmoubGFuZ3VhZ2UgKyAnJnY3PScgKyBNYXJrZXRpbmcuVURPLmNzZWcgKyAnJnY4PScgKyBNYXJrZXRpbmcuc2NEYXRhT2JqLnNlZ21lbnQgKyAnJnY5PScgKyBNYXJrZXRpbmcuVURPLnBsYXRmb3JtICsgJyZ2MTA9JyArIE1hcmtldGluZy5VRE8uZHBpZDsKICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCcvL3BpeGVsLm1hdGh0YWcuY29tL2V2ZW50L2pzPycgKyBzY3JpcHRVcmwpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGlmIChNYXJrZXRpbmcuVURPLmNvdW50cnkgPT0gJ3VzJykgewogICAgICAgICAgICAgICAgICAgIGZpcmVQaXhlbCgnbXRfaWQ9Nzc2MjIxJm10X2FkaWQ9MTI5ODA1Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE1hcmtldGluZy5zY0RhdGFPYmouY21zID09ICdvbHInKQogICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigndWRvUmVhZHknLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJlUGl4ZWwoJ210X2lkPTc3NjIyMSZtdF9hZGlkPTEyOTgwNScpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChNYXJrZXRpbmcuVURPLmNvdW50cnkgPT0gJ2luJyAmJiBNYXJrZXRpbmcuc2NEYXRhT2JqLmNtcyAhPSAnZGVsbGVtYycgJiYgTWFya2V0aW5nLnNjRGF0YU9iai5jbXMgIT0gJ2RlbGx0ZWNoJykKICAgICAgICAgICAgICAgICAgICBmaXJlUGl4ZWwoJ210X2lkPTc2OTgxNyZtdF9hZGlkPTE0MTYyOScpOwogICAgICAgICAgICAgICAgaWYgKGdlb0xvY2F0aW9uLmluZGV4T2YoTWFya2V0aW5nLlVETy5jb3VudHJ5KSA+IC0xICYmIE1hcmtldGluZy5zY0RhdGFPYmouY21zICE9ICdjb21wdWluZGlhJykgewogICAgICAgICAgICAgICAgICAgIGZpcmVQaXhlbCgnbXRfaWQ9MTMyNDY3NiZtdF9hZGlkPTE4OTE2NiZtdF9leGVtPSZtdF9leGNsPScpOwogICAgICAgICAgICAgICAgICAgIGlmICgoTWFya2V0aW5nLlVETy5jb3VudHJ5ID09ICdhdScgfHwgTWFya2V0aW5nLlVETy5jb3VudHJ5ID09ICdzZycgfHwgTWFya2V0aW5nLlVETy5jb3VudHJ5ID09ICdteScpICYmIE1hcmtldGluZy5zY0RhdGFPYmouY21zID09ICdvbHInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNYXJrZXRpbmcuVURPLnByb21vaWQgPT0gJzEwMCcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJlUGl4ZWwoJ210X2lkPTE1NTg0MjImbXRfYWRpZD0xODkxNjYmbXRfZXhlbT0mbXRfZXhjbD0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoJ3Vkb1JlYWR5JywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyZVBpeGVsKCdtdF9pZD0xMzI0Njc2Jm10X2FkaWQ9MTg5MTY2Jm10X2V4ZW09Jm10X2V4Y2w9Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoTWFya2V0aW5nLlVETy5wcm9tb2lkID09ICcxMDAnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpcmVQaXhlbCgnbXRfaWQ9MTU1ODQyMiZtdF9hZGlkPTE4OTE2NiZtdF9leGVtPSZtdF9leGNsPScpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGRlbGxfbWFya2V0aW5nX3V0aWwuZGVidWcoZSk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCAzNjQ0Mjk4LCBbMzYwNjMyOV0sIDYzMDY4MCwgWzYxMDMyM10pOwogICAgICAgIE1hcmtldGluZy5iaW5kRGVwZW5kZW5jeURPTVBhcnNlZChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHZhciBCb290c3RyYXBwZXIgPSB3aW5kb3dbJ01hcmtldGluZyddOwogICAgICAgICAgICB2YXIgZW5zaWdodGVuT3B0aW9ucyA9IE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5wZXJmVGltaW5nU3RhcnQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgICAgICB2YXIgbWFya2V0aW5nc2NEYXRhT2JqID0gTWFya2V0aW5nLnNjRGF0YU9iajsKICAgICAgICAgICAgICAgIHZhciBtYXJrZXRpbmdVRE8gPSBNYXJrZXRpbmcuVURPOwogICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ3NjRGF0YU9iai5zZWdtZW50ID09ICdic2QnKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5wcm9tb2lkID09ICcyJykKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmltYWdlUmVxdWVzdCgnLy9yLnR1cm4uY29tL3IvYmVhY29uP2IyPTFEUFFrYk1Qb2JyUHR1MUU3RjRhLXR2Nml1Tk5lRUphdVF0bkd4QWlxcGFmbm9PVG9jTnZGd0VFNFlnSEhrdmJ4TDRqSkd5TkswWm1oQ0xYR3kydEt3JmNpZD0nKTsKICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nc2NEYXRhT2JqLmNhdGVnb3J5aWQgPT0gJ3BjYWFzJyAmJiBtYXJrZXRpbmdzY0RhdGFPYmoucGFnZSA9PSAnY2FtcGFpZ24nIHx8IG1hcmtldGluZ3NjRGF0YU9iai5jYXRlZ29yeWlkID09ICdwb3dlcmVkZ2UtdG93ZXItc2VydmVyLWRlYWxzJyAmJiBtYXJrZXRpbmdzY0RhdGFPYmoucGFnZSA9PSAnZGVhbHMnIHx8IChtYXJrZXRpbmdzY0RhdGFPYmouY2F0ZWdvcnlpZCA9PSAneHBzLWxhcHRvcHMnIHx8IG1hcmtldGluZ3NjRGF0YU9iai5jYXRlZ29yeWlkID09ICc4MTQxJyB8fCBtYXJrZXRpbmdzY0RhdGFPYmouY2F0ZWdvcnlpZCA9PSAnb3B0aXBsZXgtZGVza3RvcHMnIHx8IG1hcmtldGluZ3NjRGF0YU9iai5jYXRlZ29yeWlkID09ICd2b3N0cm8tbGFwdG9wcycpICYmIG1hcmtldGluZ3NjRGF0YU9iai5wYWdlID09ICdwcm9kdWN0ZGV0YWlscycpIHsKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmltYWdlUmVxdWVzdCgnLy9yLnR1cm4uY29tL3IvYmVhY29uP2IyPUhldTdkMmYxSnVuZkF2NGlmU2ZPTGJxTjBKNDVJcGJfSzY0S21WUHljQjJmbm9PVG9jTnZGd0VFNFlnSEhrdmJid3h6ZUNGUld0OUxCejZGRklLNm1RJmNpZD0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmltYWdlUmVxdWVzdCgnLy9yLnR1cm4uY29tL3IvYmVhY29uP2IyPU9wdUNUZGdtd2k4S0V6UUdGaF9sNnNrbGtDTUVkdEZmM0x2bmlRUngyckNmbm9PVG9jTnZGd0VFNFlnSEhrdmI5eE5EVXJqRjZ2ZDh0UDVUOGV5V3F3JmNpZD0nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ3NjRGF0YU9iai5jYXRlZ29yeWlkID09ICdzbWFsbC1idXNpbmVzcy1jZW50cmFsJyAmJiBtYXJrZXRpbmdzY0RhdGFPYmoucGFnZSA9PSAnY2FtcGFpZ24nKQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW1hZ2VSZXF1ZXN0KCcvL3IudHVybi5jb20vci9iZWFjb24/YjI9Yng5Mm5lNko2REVjOEdOMlIxTXRqdTg4Z1ItREJzREI3aVJZR0FQbHhlZWZub09Ub2NOdkZ3RUU0WWdISGt2YjhwNHRZNU1Za1BFb0lVRXVUR2pHRlEmY2lkPScpOwogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdzY0RhdGFPYmoucGFnZSA9PSAnY29uZmlybWF0aW9uJykKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmltYWdlUmVxdWVzdCgnLy9yLnR1cm4uY29tL3IvYmVhY29uP2IyPTR5WnRLc253em1qdjVnSEZxLXItdElObnR2VXZkSTFabS05RDRjbFRtdUNmbm9PVG9jTnZGd0VFNFlnSEhrdmItcjdjWUQ2bm9lSi1sam5GeF95V2VnJmNpZD0nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdzY0RhdGFPYmouc2VnbWVudCA9PSAnZGhzJykgewogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnMicpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbWFnZVJlcXVlc3QoJy8vci50dXJuLmNvbS9yL2JlYWNvbj9iMj1xRy12TWs3U0hCM1RmYjhNbHFzVzlwWW1ZS0ltdFhrRXpsWnE0OG8zSXZlZm5vT1RvY052RndFRTRZZ0hIa3ZiZEZ6OUtJV0xtSWFzM1JuR3VQdUlSdyZjaWQ9Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5wcm9tb2lkID09ICc0JykKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmltYWdlUmVxdWVzdCgnLy9yLnR1cm4uY29tL3IvYmVhY29uP2IyPWJiRjgyOUhFS0NhRkdfNUx5WGZBR2Q5NlAxdGhNZXpEUHF6VnJYaHFJQU9mbm9PVG9jTnZGd0VFNFlnSEhrdmI2NmRRTlpLeDY5cS1aVkp0U0FhZVJnJmNpZD0nKTsKICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nc2NEYXRhT2JqLnBhZ2UgPT0gJ2NvbmZpcm1hdGlvbicpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbWFnZVJlcXVlc3QoJy8vci50dXJuLmNvbS9yL2JlYWNvbj9iMj0tN19vcGNHTXhYUTdwR1owV1B0Rmo4NFBZdHEtLWliNkRnbWpxd05YY3VXZm5vT1RvY052RndFRTRZZ0hIa3ZiVU41eE5FaEhSWjNlR19tQV9VeW5CdyZjaWQ9JmJwcmljZT0nICsgbWFya2V0aW5nVURPLnJldmVudWUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ3NjRGF0YU9iai5zZWdtZW50ID09ICdlZXAnKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5wcm9tb2lkID09ICcyJykKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmltYWdlUmVxdWVzdCgnLy9yLnR1cm4uY29tL3IvYmVhY29uP2IyPTFTSzdoTmw0SkVXU0g4QkhoaWFBMU9tSUYxOXBfYTBpNU55TVFwVk5mbHFmbm9PVG9jTnZGd0VFNFlnSEhrdmJxVU0zbXVqOE1UNnI3Vl8tdFcxWU53JmNpZD0nKTsKICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzQnKQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW1hZ2VSZXF1ZXN0KCcvL3IudHVybi5jb20vci9iZWFjb24/YjI9QU1IcFQ2dFdRNkFsSjVHUWFyank5TVcxdzJEaDN6Q1hKR2VRSENqLV9PbWZub09Ub2NOdkZ3RUU0WWdISGt2YmVLMWFLWjF5Wmlmd2xUMHc3Y1VuV3cmY2lkPScpOwogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdzY0RhdGFPYmoucGFnZSA9PSAnY29uZmlybWF0aW9uJykKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmltYWdlUmVxdWVzdCgnLy9yLnR1cm4uY29tL3IvYmVhY29uP2IyPWdNOU01ZDJMYkNocXJnRW1KUDhvZDNZV0t6LXlqZW5tNUtWSmZqWlY4SU9mbm9PVG9jTnZGd0VFNFlnSEhrdmJqdmxqX0JhQk00Vmp4UEpINi1hR3p3JmNpZD0mYnByaWNlPScgKyBtYXJrZXRpbmdVRE8ucmV2ZW51ZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nc2NEYXRhT2JqLmNhdGVnb3J5aWQuaW5jbHVkZXMoJ2dhbWUnKSB8fCBtYXJrZXRpbmdzY0RhdGFPYmouY2F0ZWdvcnlpZC5pbmNsdWRlcygnZ2FtaW5nJykgfHwgbWFya2V0aW5nc2NEYXRhT2JqLmNhdGVnb3J5aWQuaW5jbHVkZXMoJ2ctc2VyaWVzJykgfHwgbWFya2V0aW5nc2NEYXRhT2JqLnBhZ2UuaW5jbHVkZXMoJ2FsaWVud2FyZScpIHx8IG1hcmtldGluZ3NjRGF0YU9iai5jYXRlZ29yeWlkLmluY2x1ZGVzKCdhbGllbndhcmUnKSB8fCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmNsdWRlcygnZ2FtaW5nJykpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzInIHx8IG1hcmtldGluZ1VETy5wcm9tb2lkID09ICczJyB8fCBtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnMTMnKQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW1hZ2VSZXF1ZXN0KCcvL3IudHVybi5jb20vci9iZWFjb24/YjI9NVo5b1JldTVlVUZEZGpsYnpFdDJCNnZjRjZEX21BeUk1aEdEYmUzTV9vU2Zub09Ub2NOdkZ3RUU0WWdISGt2Ykh6Qm15SUJNTW9qOFZnLXE0d3RWaEEmY2lkPScpOwogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8uY2F0ZWdvcnkuaW5jbHVkZXMoJ2RlYWxzJykpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbWFnZVJlcXVlc3QoJy8vci50dXJuLmNvbS9yL2JlYWNvbj9iMj05Q2JmeXZpV0NNa2hKaUZaaEMyNmtpY0hKOXIyOWNHb0NraHJVVWJ5NVltZm5vT1RvY052RndFRTRZZ0hIa3ZiMXdCSUhnbUxUdWMwUDB2MHhyRS1TdyZjaWQ9Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ3NjRGF0YU9iai5wYWdlID09ICdjb25maXJtYXRpb24nKQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW1hZ2VSZXF1ZXN0KCcvL3IudHVybi5jb20vci9iZWFjb24/YjI9a1RyQktvYlZaeFdjYWRhbHg4QVRVZnRzX2NSWURBUWFwREVNNUp0U1JLdWZub09Ub2NOdkZ3RUU0WWdISGt2YnZkT0pJN3lNOG5ObTFqeU80MVhCZGcmY2lkPSZicHJpY2U9JyArIG1hcmtldGluZ1VETy5yZXZlbnVlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ0VuZCgncnVsZUlkLScgKyB0aGlzLmlkICsgJy1kZXBsb3ltZW50SWQtJyArIHRoaXMuZGVwbG95bWVudElkKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgZGVsbF9tYXJrZXRpbmdfdXRpbC5kZWJ1ZyhlKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIDM2MDAyNzMsIFszNjA2MzI5XSwgNjMxOTI4LCBbNjEwMzIzXSk7CiAgICAgICAgTWFya2V0aW5nLmJpbmREZXBlbmRlbmN5RE9NUGFyc2VkKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgdmFyIEJvb3RzdHJhcHBlciA9IHdpbmRvd1snTWFya2V0aW5nJ107CiAgICAgICAgICAgIHZhciBlbnNpZ2h0ZW5PcHRpb25zID0gTWFya2V0aW5nLmVuc2lnaHRlbk9wdGlvbnM7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdTdGFydCgncnVsZUlkLScgKyB0aGlzLmlkICsgJy1kZXBsb3ltZW50SWQtJyArIHRoaXMuZGVwbG95bWVudElkKTsKICAgICAgICAgICAgICAgIHZhciBtYXJrZXRpbmdzY0RhdGFPYmogPSBNYXJrZXRpbmcuc2NEYXRhT2JqOwogICAgICAgICAgICAgICAgdmFyIG1hcmtldGluZ1VETyA9IE1hcmtldGluZy5VRE87CiAgICAgICAgICAgICAgICB2YXIgcGl4X2lkID0gJycsIHR5cGUgPSAnJzsKICAgICAgICAgICAgICAgIHZhciBzaXRlVXJsID0gd2luZG93LmxvY2F0aW9uLm9yaWdpbiArIHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZTsKICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8uc2VnbWVudCA9PSAnYnNkJykgewogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnOScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJzY3NDZjNjhjLWRlNmUtYTIwMC04YmYxLTk2NmI0Njc4YzJjNCc7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnMTAnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzMnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICc3MTczYmRlNS1iM2Y2LWE1MTUtMDQyZi04ZWMwZTM4NDlkNzknOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzcnICYmIG1hcmtldGluZ3NjRGF0YU9iai5tb2R1bGUuaW5jbHVkZXMoJ2NvbmZpZ3VyYXRvcicpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICc5OGYwMGNkYi0yNDY1LTY3OTUtNTUyMi04Y2I4Y2ZmOWVkYTEnOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzQnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICc4YWEzNzlhMS1lYjU3LWZmOWMtMTRhMy1mODBmNzMyODZmNWUnOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzUnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICcxZTlkZGUxNy1lMTQ5LWJiNTEtZGJmMi0zZDQ1ZjNkZDQ2NWYnOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICc3NTI1NWFlZC1kMWE4LTA0ODYtMTJhNy0xNTBmYmUzNGQwYWYnOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzU1JzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5wcm9tb2lkID09ICc3JyAmJiBtYXJrZXRpbmdzY0RhdGFPYmoubW9kdWxlLmluY2x1ZGVzKCdwcm9kdWN0ZGV0YWlsJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJzU0M2Y3YTc4LWEwYTUtYWZkOC01OGY5LTM5ZTg3ZDZlNjlmYSc7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNTQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8uc2VnbWVudCA9PSAnZWVwJykgewogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnOScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJzVhNzhjNjNjLTUyODYtNzBlMS02YWJmLWEwMjdiYjNkYzNjMic7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnMTAnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzMnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICcxNzFhYjRmNi0wMTg0LWJlNzUtN2U5Yy04NDVmZWRmMTBlN2InOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzcnICYmIG1hcmtldGluZ3NjRGF0YU9iai5tb2R1bGUuaW5jbHVkZXMoJ2NvbmZpZ3VyYXRvcicpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICc5OGVjNmViMC0zZTMwLWFkZWEtYzcwZC1mZGE1MWVmZGY4MTcnOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzQnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICdjMzczYjM4ZC1mNGI2LWU1MTktMTMwZi05MGJlMDhiZDEzNGMnOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzUnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICcwYjYzZDI4Ny0wOWM3LWM5YjgtODVjZi00YzkxZDg3NzY0ZTknOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICdjNmVlMzcwNi1hYjA4LWJjYjItNjEzMC03NWYxZDBjNGIxNTcnOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzU1JzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5wcm9tb2lkID09ICc3JyAmJiBtYXJrZXRpbmdzY0RhdGFPYmoubW9kdWxlLmluY2x1ZGVzKCdwcm9kdWN0ZGV0YWlsJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJzhmMTk3OTE3LWMyNmQtNzU2Ni1mYTkwLTU3MWFmZjQ4ZmJlZCc7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNTQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8uc2VnbWVudCA9PSAnZGhzJykgewogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnOScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJ2FmY2U2OTQyLWQ2MjQtMTcwMi1jM2EzLWI1ZDM5ZmJhMWNhMyc7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnMTAnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzMnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICcxNjAwNDZmNy03YTI1LTZlMDEtMTNhNS0yY2NiNTkwNjYwZDQnOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzcnICYmIG1hcmtldGluZ3NjRGF0YU9iai5tb2R1bGUuaW5jbHVkZXMoJ2NvbmZpZ3VyYXRvcicpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICc0NTY0ZWNlYS1hZDNjLTNlNTQtZWNmMy1hZTg3MTRhYzliMzcnOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzQnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICdiOWY3YTM1Yi03OGI5LTU4ODctZmYxMy05ZGE0YmUyMjhkNzknOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzUnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICcxZjAzYTdkZS1lNmYzLTc3NDctMDk0Yi0wOTFhZjQ3OTAwNjInOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICdhNDVmNmVmNS1mYjgxLWMwZmEtMGNkMC00ODlmMWFmYjMwNzInOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzU1JzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5wcm9tb2lkID09ICc3JyAmJiBtYXJrZXRpbmdzY0RhdGFPYmoubW9kdWxlLmluY2x1ZGVzKCdwcm9kdWN0ZGV0YWlsJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJ2FmMTQyNjYyLTMwYTctNTFhOC0yMDhmLTc2ZWFiYmYzZTI5Yyc7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNTQnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8uY2F0ZWdvcnkuaW5jbHVkZXMoJ2FsaWVud2FyZScpIHx8IHNpdGVVcmwuaW5jbHVkZXMoJ2FsaWVud2FyZWFyZW5hLmNvbScpKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5wcm9tb2lkID09ICc5JykgewogICAgICAgICAgICAgICAgICAgICAgICBwaXhfaWQgPSAnMDhjMmQ2ZGYtMjFjZi0wZjljLTE4ZjItOGQ1OTA3YTQ1N2IxJzsKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSA9ICcxMCc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnMycpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJ2ZjYThjOGUxLTEyOWMtODA5NC1jZmYyLWNlMTFmZWRjODFhYyc7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNCc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnNycgJiYgbWFya2V0aW5nc2NEYXRhT2JqLm1vZHVsZS5pbmNsdWRlcygnY29uZmlndXJhdG9yJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJzBhMGFhM2JkLTg2MjUtNDVjOC0wZDZiLTJlODkwYWE2YjBlZSc7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNCc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnNCcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJzNkNjFlZmRjLTYyNWEtMmY0MC1jMWJkLTI1MWNhYjI4NzljZCc7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNCc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnMicpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJzRlMDI4NTY0LTdhMmItOWFkYy03MGE5LTA2YjQwZTE0ZTEyNCc7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNTUnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzcnICYmIG1hcmtldGluZ3NjRGF0YU9iai5tb2R1bGUuaW5jbHVkZXMoJ3Byb2R1Y3RkZXRhaWwnKSkgewogICAgICAgICAgICAgICAgICAgICAgICBwaXhfaWQgPSAnMDM1OTZhY2UtNDNiZC1iMWFlLTJmODEtMjYzYWI0MWMxNDg2JzsKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSA9ICc1NCc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnMScgfHwgc2l0ZVVybC5pbmNsdWRlcygnYWxpZW53YXJlYXJlbmEuY29tJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJzExNzUwYThhLTY1ODAtZmQ1Zi0yOGMxLTlhZjYxYmM0MzE4OCc7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNCc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5jYXRlZ29yeS5pbmNsdWRlcygnZ2FtJykpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzknKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBpeF9pZCA9ICdkZTJlZmJmNS04N2VkLWU4YjQtOTIxZi01MDU0MmYzMmM3ODAnOwogICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gJzEwJzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5wcm9tb2lkID09ICcxMycpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJzI0ZTAyYmRjLWRiMTItNTRiNy1mNTIwLWYxYzBjOWQ2NjFmYic7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNCc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnNycgJiYgbWFya2V0aW5nc2NEYXRhT2JqLm1vZHVsZS5pbmNsdWRlcygnY29uZmlndXJhdG9yJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJ2QyZDBjM2NjLTE2MjUtZGNkZi01ODc1LTU0NDEzZmQ1YzBhZic7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNCc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnNCcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJ2Q1ODgzMjlmLTVjOTktNTIxMi01OGIwLTViNmFmMGE1YWY2Yic7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNCc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnMicpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGl4X2lkID0gJ2ViNjUzMGU1LTUzYzktODRlMS1iNzE4LTYwOWJkN2I1NmMyOSc7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSAnNTUnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzcnICYmIG1hcmtldGluZ3NjRGF0YU9iai5tb2R1bGUuaW5jbHVkZXMoJ3Byb2R1Y3RkZXRhaWwnKSkgewogICAgICAgICAgICAgICAgICAgICAgICBwaXhfaWQgPSAnNjA4NTc3YzItNjg4Zi0yZGE5LTg2NDUtMTBhM2IyMDliNjI0JzsKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSA9ICc1NCc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHBpeF9pZCAmJiB0eXBlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIF9waXggPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnX3BpeF9pZF8nICsgcGl4X2lkKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIV9waXgpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbWFnZVJlcXVlc3QoJy8vcy5hbWF6b24tYWRzeXN0ZW0uY29tL2l1aTM/ZD1mb3Jlc3Rlci1kaWQmZXgtZmFyZ3M9JTNGaWQlM0QnICsgcGl4X2lkICsgJyUyNnR5cGUlM0QnICsgdHlwZSArICclMjZtJTNEMSZleC1mY2g9NDE2NjEzJmV4LXNyYz0nICsgc2l0ZVVybCArICcmZXgtaGFyZ3M9diUzRDEuMCUzQmMlM0Q1MjY3NTkyNTYwNDAxJTNCcCUzRCcgKyBwaXhfaWQudG9VcHBlckNhc2UoKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGRlbGxfbWFya2V0aW5nX3V0aWwuZGVidWcoZSk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCAzNjAwMjY0LCBbMzYwNjMyOV0sIDY2MjcyOCwgWzYxMDMyM10pOwogICAgICAgIE1hcmtldGluZy5iaW5kRGVwZW5kZW5jeURPTVBhcnNlZChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHZhciBCb290c3RyYXBwZXIgPSB3aW5kb3dbJ01hcmtldGluZyddOwogICAgICAgICAgICB2YXIgZW5zaWdodGVuT3B0aW9ucyA9IE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5wZXJmVGltaW5nU3RhcnQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgICAgICB2YXIgZmlyZVBpeGVsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfMzMzMjczNTQwOTNmMGRhYiA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdzZXNzaW9uU3RvcmFnZScpOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzMzMzI3MzU0MDkzZjBkYWIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnc2Vzc2lvblN0b3JhZ2UnLCAkX19fbW9ja19kMGMyZTI3MDNjYjUyMmQ3LnNlc3Npb25TdG9yYWdlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdWRvID0gTWFya2V0aW5nLlVETzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjYWNoZWJ1c3RlciA9IE1hdGgucmFuZG9tKCkgKiAxMDAwMDAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE1hcmtldGluZy5VRE8ucHJvbW9pZCA9PSAnMTAwJyB8fCBsb2NhdGlvbi5ocmVmLmluY2x1ZGVzKCd0aGFua3lvdScpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbWFnZVJlcXVlc3QoJy8vdC5teXZpc3VhbGlxLm5ldC9hY3Rpdml0eV9waXhlbD9wdD1pJmV0PWEmcj0nICsgY2FjaGVidXN0ZXIgKyAnJmFnbz0yMTImYW89MTAxOCZweD0xMTI5Jm9yZD0nICsgdWRvLmRwaWQgKyAnJnJldmVudWU9JyArIHVkby5yZXZlbnVlICsgJyZ1MT0nICsgdWRvLm9naWQgKyAnJnUyPScgKyB1ZG8uZHBpZCArICcmb3RoZXJjb29raWVfaWQ9JyArIHVkby5tY21pZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmluc2VydFNjcmlwdCgnLy92dC5teXZpc3VhbGlxLm5ldC8yLzRPamZNTXYzelNNazJLT0RVRThsZVElM0QlM0QvdnQtMzM1LmpzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaHZlUGl4ZWwgPSAnLy90Lm15dmlzdWFsaXEubmV0L2FjdGl2aXR5X3BpeGVsP3B0PWkmZXQ9YSZyPScgKyBjYWNoZWJ1c3RlciArICcmYWdvPTIxMiZhbz0xMDE4JnB4PTExMzAmb3JkPScgKyB1ZG8uZHBpZCArICcmcmV2ZW51ZT0nICsgdWRvLnJldmVudWUgKyAnJnUxPScgKyB1ZG8uZ2FjZCArICcmb3RoZXJjb29raWVfaWQ9JyArIHVkby5tY21pZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVkby5odmVfYmNvdmUoaHZlUGl4ZWwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdWRvLmh2ZV9jaGF0KGh2ZVBpeGVsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVkby5odmVfY29udGFjdFVzKGh2ZVBpeGVsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVkby5odmVfZG93bmxvYWQoaHZlUGl4ZWwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdWRvLmh2ZV9tcHYoaHZlUGl4ZWwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdWRvLmh2ZV9yZnFfc3VibWl0KGh2ZVBpeGVsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVkby5odmVfc29jaWFsKGh2ZVBpeGVsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVkby5odmVfeXR1YmUoaHZlUGl4ZWwpOwogICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMzMzMjczNTQwOTNmMGRhYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdzZXNzaW9uU3RvcmFnZScsICRfX19vbGRfMzMzMjczNTQwOTNmMGRhYikpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmaXJlUGl4ZWwoKTsKICAgICAgICAgICAgICAgIGlmIChNYXJrZXRpbmcuc2NEYXRhT2JqLmNtcyA9PSAnb2xyJykKICAgICAgICAgICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigndWRvUmVhZHknLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZpcmVQaXhlbCgpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5wZXJmVGltaW5nRW5kKCdydWxlSWQtJyArIHRoaXMuaWQgKyAnLWRlcGxveW1lbnRJZC0nICsgdGhpcy5kZXBsb3ltZW50SWQpOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBkZWxsX21hcmtldGluZ191dGlsLmRlYnVnKGUpOwogICAgICAgICAgICB9CiAgICAgICAgfSwgMzY0NDMwOSwgWzM2MDYzMjldLCA2ODM3NTEsIFs2MTAzMjNdKTsKICAgICAgICBNYXJrZXRpbmcuYmluZERlcGVuZGVuY3lET01QYXJzZWQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICB2YXIgQm9vdHN0cmFwcGVyID0gd2luZG93WydNYXJrZXRpbmcnXTsKICAgICAgICAgICAgdmFyIGVuc2lnaHRlbk9wdGlvbnMgPSBNYXJrZXRpbmcuZW5zaWdodGVuT3B0aW9uczsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ1N0YXJ0KCdydWxlSWQtJyArIHRoaXMuaWQgKyAnLWRlcGxveW1lbnRJZC0nICsgdGhpcy5kZXBsb3ltZW50SWQpOwogICAgICAgICAgICAgICAgaWYgKE1hcmtldGluZy5VRE8ucHJvbW9pZCAhPT0gJzEwMCcpIHsKICAgICAgICAgICAgICAgICAgICB3aW5kb3cuYTkgPSB7fTsKICAgICAgICAgICAgICAgICAgICBhOS5ldmVudFR5cGUgPSAndmlzaXRvcic7CiAgICAgICAgICAgICAgICAgICAgYTkuc2VnbWVudE51bWJlciA9ICcwJzsKICAgICAgICAgICAgICAgICAgICBhOS5zZWdtZW50TmFtZSA9ICdTaXRlIFZpc2l0b3InOwogICAgICAgICAgICAgICAgICAgIGlmICgvYWxpZW53YXJlL2kudGVzdChNYXJrZXRpbmcuVURPLmNhdGVnb3J5IHx8IE1hcmtldGluZy5VRE8uZmFtaWx5IHx8IE1hcmtldGluZy5VRE8ucHJvZHVjdCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYTkuY2xpZW50TmFtZSA9ICdEZWxsJTIwQWxpZW53YXJlJzsKICAgICAgICAgICAgICAgICAgICAgICAgYTkuY2xpZW50SUQgPSAnNzkzODYzJzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKE1hcmtldGluZy5VRE8uc2VnbWVudCA9PSAnZGhzJykgewogICAgICAgICAgICAgICAgICAgICAgICBhOS5jbGllbnROYW1lID0gJ0RlbGwlMjBDb25zdW1lcic7CiAgICAgICAgICAgICAgICAgICAgICAgIGE5LmNsaWVudElEID0gJzc5Mzg3Myc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChKU09OLnN0cmluZ2lmeShhOSkgIT09ICd7fScgJiYgYTkuY2xpZW50TmFtZSAmJiBhOS5jbGllbnRJRCAmJiBhOS5ldmVudFR5cGUgJiYgYTkuc2VnbWVudE51bWJlciAmJiBhOS5zZWdtZW50TmFtZSkKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmluc2VydFNjcmlwdCgnLy9hLnRyaWJhbGZ1c2lvbi5jb20vcGl4ZWwvdGFncy8nICsgYTkuY2xpZW50TmFtZSArICcvJyArIGE5LmNsaWVudElEICsgJy9waXhlbC5qcycpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5wZXJmVGltaW5nRW5kKCdydWxlSWQtJyArIHRoaXMuaWQgKyAnLWRlcGxveW1lbnRJZC0nICsgdGhpcy5kZXBsb3ltZW50SWQpOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBkZWxsX21hcmtldGluZ191dGlsLmRlYnVnKGUpOwogICAgICAgICAgICB9CiAgICAgICAgfSwgMzU4MjQ3NCwgWzM2MDYzMjldLCA2OTI3MTgsIFs2MTAzMjNdKTsKICAgICAgICBNYXJrZXRpbmcuYmluZERlcGVuZGVuY3lET01QYXJzZWQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICB2YXIgQm9vdHN0cmFwcGVyID0gd2luZG93WydNYXJrZXRpbmcnXTsKICAgICAgICAgICAgdmFyIGVuc2lnaHRlbk9wdGlvbnMgPSBNYXJrZXRpbmcuZW5zaWdodGVuT3B0aW9uczsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ1N0YXJ0KCdydWxlSWQtJyArIHRoaXMuaWQgKyAnLWRlcGxveW1lbnRJZC0nICsgdGhpcy5kZXBsb3ltZW50SWQpOwogICAgICAgICAgICAgICAgdmFyIG1hcmtldGluZ1VETyA9IE1hcmtldGluZy5VRE87CiAgICAgICAgICAgICAgICB2YXIgbWFya2V0aW5nc2NEYXRhT2JqID0gTWFya2V0aW5nLnNjRGF0YU9iajsKICAgICAgICAgICAgICAgIChmdW5jdGlvbiAodywgZCwgdCwgciwgdSkgewogICAgICAgICAgICAgICAgICAgIHdbdV0gPSB3W3VdIHx8IFtdOwogICAgICAgICAgICAgICAgICAgIHdbdV0ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICdwcm9qZWN0SWQnOiAnMTAwMDAnLAogICAgICAgICAgICAgICAgICAgICAgICAncHJvcGVydGllcyc6IHsgJ3BpeGVsSWQnOiAnMTAwOTQ2MjMnIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGQuY3JlYXRlRWxlbWVudCh0KTsKICAgICAgICAgICAgICAgICAgICBzLnNyYyA9IHI7CiAgICAgICAgICAgICAgICAgICAgcy5hc3luYyA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgcy5vbmxvYWQgPSBzLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHksIHJzID0gdGhpcy5yZWFkeVN0YXRlLCBjID0gd1t1XTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJzICYmIHJzICE9ICdjb21wbGV0ZScgJiYgcnMgIT0gJ2xvYWRlZCcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5ID0gWUFIT08ueXdhLkkxM04uZmlyZUJlYWNvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdbdV0gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdbdV0ucHVzaCA9IGZ1bmN0aW9uIChwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeShbcF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdmFyIHNjciA9IGQuZ2V0RWxlbWVudHNCeVRhZ05hbWUodClbMF0sIHBhciA9IHNjci5wYXJlbnROb2RlOwogICAgICAgICAgICAgICAgICAgIGlmIChNYXJrZXRpbmcuc2NEYXRhT2JqLnBhZ2UgIT0gJ2NvbmZpcm1hdGlvbicgfHwgTWFya2V0aW5nLnNjRGF0YU9iai5wYWdlID09ICdjb25maXJtYXRpb24nKQogICAgICAgICAgICAgICAgICAgICAgICBwYXIuaW5zZXJ0QmVmb3JlKHMsIHNjcik7CiAgICAgICAgICAgICAgICB9KHdpbmRvdywgZG9jdW1lbnQsICdzY3JpcHQnLCAnaHR0cHM6Ly9zLnlpbWcuY29tL3dpL3l0Yy5qcycsICdkb3RxJykpOwogICAgICAgICAgICAgICAgd2luZG93LmRvdHEgPSB3aW5kb3cuZG90cSB8fCBbXTsKICAgICAgICAgICAgICAgIHZhciBlY1ZhbHVlID0gJycsIHFzdHJpbmdQYXJhbSA9IHt9OwogICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ3NjRGF0YU9iai5jYXRlZ29yeWlkLmluY2x1ZGVzKCdnYW0nKSB8fCBtYXJrZXRpbmdzY0RhdGFPYmouY2F0ZWdvcnlpZC5pbmNsdWRlcygnZy1zZXJpZXMnKSB8fCBtYXJrZXRpbmdzY0RhdGFPYmoucGFnZS5pbmNsdWRlcygnYWxpZW53YXJlJykgfHwgbWFya2V0aW5nc2NEYXRhT2JqLmNhdGVnb3J5aWQuaW5jbHVkZXMoJ2FsaWVud2FyZScpKQogICAgICAgICAgICAgICAgICAgIGVjVmFsdWUgPSBtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnMTAwJyA/ICdnYW1pbmcnIDogJ2dhbSc7CiAgICAgICAgICAgICAgICBlbHNlIGlmIChtYXJrZXRpbmdVRE8uc2VnbWVudCA9PSAnZGhzJykKICAgICAgICAgICAgICAgICAgICBlY1ZhbHVlID0gbWFya2V0aW5nVURPLnByb21vaWQgPT0gJzEwMCcgPyAnY29uc3VtZXJjb252ZXJzaW9uJyA6ICdjb24nOwogICAgICAgICAgICAgICAgZWxzZSBpZiAobWFya2V0aW5nVURPLnNlZ21lbnQgPT0gJ2JzZCcpCiAgICAgICAgICAgICAgICAgICAgZWNWYWx1ZSA9IG1hcmtldGluZ1VETy5wcm9tb2lkID09ICcxMDAnID8gJ3B1cmNoYXNlJyA6ICdzYnJ0Zyc7CiAgICAgICAgICAgICAgICBlbHNlIGlmIChtYXJrZXRpbmdVRE8uc2VnbWVudCA9PSAnZWVwJykKICAgICAgICAgICAgICAgICAgICBlY1ZhbHVlID0gbWFya2V0aW5nVURPLnByb21vaWQgPT0gJzEwMCcgPyAnbXBwY29udmVyc2lvbicgOiAnbWVtYmVyJzsKICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnMTAwJykKICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnNlZ21lbnQgPT0gJ2RocycgfHwgbWFya2V0aW5nVURPLnNlZ21lbnQgPT0gJ2JzZCcpCiAgICAgICAgICAgICAgICAgICAgICAgIHFzdHJpbmdQYXJhbSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdldCc6ICdjdXN0b20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2VjJzogZWNWYWx1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlYSc6ICdQdXJjaGFzZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJvZHVjdF9pZCc6IG1hcmtldGluZ1VETy5vcmRlcmNvZGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ3YnOiBtYXJrZXRpbmdVRE8ucmV2ZW51ZQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgcXN0cmluZ1BhcmFtID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2V0JzogJ2N1c3RvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZWMnOiBlY1ZhbHVlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2d2JzogbWFya2V0aW5nVURPLnJldmVudWUKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICBxc3RyaW5nUGFyYW0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICdldCc6ICdjdXN0b20nLAogICAgICAgICAgICAgICAgICAgICAgICAnZWMnOiBlY1ZhbHVlCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8ucHJvbW9pZCA9PSAnNycpCiAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5zZWdtZW50ID09ICdkaHMnIHx8IG1hcmtldGluZ1VETy5zZWdtZW50ID09ICdic2QnKQogICAgICAgICAgICAgICAgICAgICAgICBxc3RyaW5nUGFyYW0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXQnOiAnY3VzdG9tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlYSc6ICdWaWV3UHJvZHVjdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJvZHVjdF9pZCc6IG1hcmtldGluZ1VETy5vcmRlcmNvZGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZWMnOiBlY1ZhbHVlCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnByb21vaWQgPT0gJzknKQogICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8uc2VnbWVudCA9PSAnZGhzJyB8fCBtYXJrZXRpbmdVRE8uc2VnbWVudCA9PSAnYnNkJykKICAgICAgICAgICAgICAgICAgICAgICAgcXN0cmluZ1BhcmFtID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2V0JzogJ2N1c3RvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZWEnOiAnQWRkVG9DYXJ0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcm9kdWN0X2lkJzogbWFya2V0aW5nVURPLm9yZGVyY29kZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlYyc6IGVjVmFsdWUKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGlmIChlY1ZhbHVlICE9PSAnJykKICAgICAgICAgICAgICAgICAgICB3aW5kb3cuZG90cS5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgJ3Byb2plY3RJZCc6ICcxMDAwMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdwcm9wZXJ0aWVzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BpeGVsSWQnOiAnMTAwOTQ2MjMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3FzdHJpbmdzJzogcXN0cmluZ1BhcmFtCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ0VuZCgncnVsZUlkLScgKyB0aGlzLmlkICsgJy1kZXBsb3ltZW50SWQtJyArIHRoaXMuZGVwbG95bWVudElkKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgZGVsbF9tYXJrZXRpbmdfdXRpbC5kZWJ1ZyhlKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIDM1OTMzMDAsIFszNjA2MzI5XSwgNjMyMzE3LCBbNjEwMzIzXSk7CiAgICB9KCkpCn0="},{"name":"sugarcoat-8db49593133758f7fe84678381f329915b2ccbe3","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfNjBjMTkwYjQzMTg2NTIxYiA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCBmZXRjaCA9IGFzeW5jIChyZXNvdXJjZSwgaW5pdCA9IG51bGwpID0+IHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignRmFpbGVkIHRvIGZldGNoJyk7CiAgICAgICAgfTsKICAgICAgICBleHBvcnRzLmZldGNoID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBmZXRjaCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgfSkoJF9fX21vY2tfNjBjMTkwYjQzMTg2NTIxYik7CiAgICBjb25zdCAkX19fbW9ja19kMGMyZTI3MDNjYjUyMmQ3ID0ge307CiAgICAoZXhwb3J0cyA9PiB7CiAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgIGxldCBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgIGNsYXNzIFN0b3JhZ2UgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgbGVuZ3RoKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKHRoaXMpLmxlbmd0aDsKICAgICAgICAgICAgfQogICAgICAgICAgICBrZXkoaW5kZXgpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGtleXMgPSBPYmplY3Qua2V5cyh0aGlzKTsKICAgICAgICAgICAgICAgIGlmIChpbmRleCA8IDAgfHwgaW5kZXggPj0ga2V5cy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBrZXlzW2luZGV4XTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXRJdGVtKGtleSkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbCh0aGlzLCBrZXkpID8gdGhpc1trZXldIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRJdGVtKGtleSwgdmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNba2V5XSA9IFN0cmluZyh2YWx1ZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmVtb3ZlSXRlbShrZXkpIHsKICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2tleV07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2xlYXIoKSB7CiAgICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXModGhpcyk7CiAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGtleSBvZiBrZXlzKSB7CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHRoaXNba2V5XTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFN0b3JhZ2UsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjb25zdCBsb2NhbFN0b3JhZ2UgPSBuZXcgU3RvcmFnZSgpOwogICAgICAgIGV4cG9ydHMubG9jYWxTdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIGdldCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBsb2NhbFN0b3JhZ2U7CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGNvbnN0IHNlc3Npb25TdG9yYWdlID0gbmV3IFN0b3JhZ2UoKTsKICAgICAgICBleHBvcnRzLnNlc3Npb25TdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIGdldCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBzZXNzaW9uU3RvcmFnZTsKICAgICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgaXNTZWFsZWQgPSB0cnVlOwogICAgfSkoJF9fX21vY2tfZDBjMmUyNzAzY2I1MjJkNyk7CiAgICAoZnVuY3Rpb24gKCkgewogICAgICAgIE1hcmtldGluZy5iaW5kRGVwZW5kZW5jeURPTVBhcnNlZChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHZhciBCb290c3RyYXBwZXIgPSB3aW5kb3dbJ01hcmtldGluZyddOwogICAgICAgICAgICB2YXIgZW5zaWdodGVuT3B0aW9ucyA9IE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5wZXJmVGltaW5nU3RhcnQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgICAgICB2YXIgZmlyZVBpeGVsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGlmIChNYXJrZXRpbmcuVURPLnByb21vaWQgIT09ICcxMDAnICYmICFsb2NhdGlvbi5ocmVmLmluY2x1ZGVzKCd0aGFua3lvdScpKQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcubG9hZFNjcmlwdENhbGxiYWNrKCdodHRwczovL2F0cy5ybGNkbi5jb20vYXRzLmpzJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF8zNzg4ODk0OWM4MTg0ZGMxID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ2ZldGNoJyksICRfX19vbGRfMmI0MGZjYzgxMDk2Y2FhZCA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdsb2NhbFN0b3JhZ2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMzc4ODg5NDljODE4NGRjMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2ZldGNoJywgJF9fX21vY2tfNjBjMTkwYjQzMTg2NTIxYi5mZXRjaCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzJiNDBmY2M4MTA5NmNhYWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja19kMGMyZTI3MDNjYjUyMmQ3LmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5hdHMuc3RhcnQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BsYWNlbWVudElEJzogJzEzNDQyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdG9yYWdlVHlwZSc6ICdsb2NhbFN0b3JhZ2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RldGVjdGlvblR5cGUnOiAnc2NyYXBlQW5kVXJsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1cmxQYXJhbWV0ZXInOiAnZW52JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlbWFpbEhhc2hlcyc6IFtNYXJrZXRpbmcuVURPLmVtYWlsaGFzaF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbG9nZ2luZyc6ICdlcnJvcicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkb21haW5NYXAgPSBsb2NhdGlvbi5ob3N0LmluY2x1ZGVzKCdkZWxsdGVjaG5vbG9naWVzJykgPyAnZGVsbHRlY2hub2xvZ2llcy5jb20nIDogJ2RlbGwuY29tJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHByb21vaWRNYXAgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOiAnbWFpbl9ob21lcGFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyOiAnc2VnX2hvbWVwYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM6ICdwcm9kdWN0Y2F0ZWdvcnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDogJ2RlYWxzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU6ICdmYW1pbHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjogJ2ZlYXR1cmVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDc6ICdwcm9kdWN0ZGV0YWlscycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4OiAnY29uZmlndXJhdG9yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDk6ICdjYXJ0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcGFnZU5hbWUgPSBwcm9tb2lkTWFwW01hcmtldGluZy5VRE8ucHJvbW9pZF0gPyBwcm9tb2lkTWFwW01hcmtldGluZy5VRE8ucHJvbW9pZF0gOiBkb21haW5NYXAuaW5jbHVkZXMoJ2RlbGwuY29tJykgPyAnZGVsbF9wYWdlJyA6ICdkZWxsdGVjaF9wYWdlJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGVudmVsb3BWYWx1ZSA9IGxvY2FsU3RvcmFnZS5nZXRJdGVtKCdfbHJfZW52JykgPyBKU09OLnBhcnNlKGF0b2IobG9jYWxTdG9yYWdlLmdldEl0ZW0oJ19scl9lbnYnKSkpLmVudmVsb3BlIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwZGF0YU1hcCA9ICdjb3VudHJ5PScgKyBNYXJrZXRpbmcuVURPLmNvdW50cnkgKyAnLGxhbmd1YWdlPScgKyBNYXJrZXRpbmcuVURPLmxhbmd1YWdlICsgJyxzZWdtZW50PScgKyBNYXJrZXRpbmcuVURPLnNlZ21lbnQgKyAnLGRvbWFpbj0nICsgZG9tYWluTWFwICsgJyxwYWdlPScgKyBwYWdlTmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmltYWdlUmVxdWVzdCgnLy90LnJsY2RuLmNvbS9hcGkvc2VnbWVudD9waWQ9NzExMzk0Jml0PTE5Jml2PScgKyBlbnZlbG9wVmFsdWUgKyAnJnBkYXRhPScgKyBlbmNvZGVVUklDb21wb25lbnQocGRhdGFNYXApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzM3ODg4OTQ5YzgxODRkYzEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdmZXRjaCcsICRfX19vbGRfMzc4ODg5NDljODE4NGRjMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzJiNDBmY2M4MTA5NmNhYWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fb2xkXzJiNDBmY2M4MTA5NmNhYWQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZmlyZVBpeGVsKCk7CiAgICAgICAgICAgICAgICBpZiAoTWFya2V0aW5nLnNjRGF0YU9iai5jbXMgPT0gJ29scicpCiAgICAgICAgICAgICAgICAgICAgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoJ3Vkb1JlYWR5JywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZmlyZVBpeGVsKCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGRlbGxfbWFya2V0aW5nX3V0aWwuZGVidWcoZSk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCAzNTkzMjkxLCBbMzYwNjMyOV0sIDY4NzE0OSwgWzYxMDMyM10pOwogICAgfSgpKQp9"},{"name":"sugarcoat-972e8be011822bca0cb25ecca1f34fd347ca4875","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfNWM1NWVhOTUyZGY0M2NiZSA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCBmZXRjaCA9IGFzeW5jIChyZXNvdXJjZSwgaW5pdCA9IG51bGwpID0+IHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignRmFpbGVkIHRvIGZldGNoJyk7CiAgICAgICAgfTsKICAgICAgICBleHBvcnRzLmZldGNoID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBmZXRjaCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgfSkoJF9fX21vY2tfNWM1NWVhOTUyZGY0M2NiZSk7CiAgICBjb25zdCAkX19fbW9ja181OTUxZmQ5NjhhOWU0ODliID0ge307CiAgICAoZXhwb3J0cyA9PiB7CiAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgIGxldCBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgIGNsYXNzIFN0b3JhZ2UgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgbGVuZ3RoKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKHRoaXMpLmxlbmd0aDsKICAgICAgICAgICAgfQogICAgICAgICAgICBrZXkoaW5kZXgpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGtleXMgPSBPYmplY3Qua2V5cyh0aGlzKTsKICAgICAgICAgICAgICAgIGlmIChpbmRleCA8IDAgfHwgaW5kZXggPj0ga2V5cy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBrZXlzW2luZGV4XTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXRJdGVtKGtleSkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbCh0aGlzLCBrZXkpID8gdGhpc1trZXldIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRJdGVtKGtleSwgdmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNba2V5XSA9IFN0cmluZyh2YWx1ZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmVtb3ZlSXRlbShrZXkpIHsKICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2tleV07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2xlYXIoKSB7CiAgICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXModGhpcyk7CiAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGtleSBvZiBrZXlzKSB7CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHRoaXNba2V5XTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFN0b3JhZ2UsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjb25zdCBsb2NhbFN0b3JhZ2UgPSBuZXcgU3RvcmFnZSgpOwogICAgICAgIGV4cG9ydHMubG9jYWxTdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIGdldCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBsb2NhbFN0b3JhZ2U7CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGNvbnN0IHNlc3Npb25TdG9yYWdlID0gbmV3IFN0b3JhZ2UoKTsKICAgICAgICBleHBvcnRzLnNlc3Npb25TdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIGdldCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBzZXNzaW9uU3RvcmFnZTsKICAgICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgaXNTZWFsZWQgPSB0cnVlOwogICAgfSkoJF9fX21vY2tfNTk1MWZkOTY4YTllNDg5Yik7CiAgICBjb25zdCAkX19fbW9ja18wMDQ2NTI4NDAwNGQ0YWE4ID0ge307CiAgICAoZXhwb3J0cyA9PiB7CiAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgIGNvbnN0IHhoclVuc2VudCA9IDA7CiAgICAgICAgY29uc3QgeGhyT3BlbmVkID0gMTsKICAgICAgICBjb25zdCB4aHJIZWFkZXJzUmVjZWl2ZWQgPSAyOwogICAgICAgIGNvbnN0IHhockxvYWRpbmcgPSAzOwogICAgICAgIGNvbnN0IHhockRvbmUgPSA0OwogICAgICAgIGNvbnN0IHhockRlZmVycmVkSGFuZGxlU3ltYm9sID0gU3ltYm9sKCdkZWZlcnJlZEhhbmRsZScpOwogICAgICAgIGNvbnN0IHhock9uTG9hZFN0YXJ0U3ltYm9sID0gU3ltYm9sKCdvbmxvYWRzdGFydCcpOwogICAgICAgIGNvbnN0IHhock9uUHJvZ3Jlc3NTeW1ib2wgPSBTeW1ib2woJ29ucHJvZ3Jlc3MnKTsKICAgICAgICBjb25zdCB4aHJPbkFib3J0U3ltYm9sID0gU3ltYm9sKCdvbmFib3J0Jyk7CiAgICAgICAgY29uc3QgeGhyT25FcnJvclN5bWJvbCA9IFN5bWJvbCgnb25lcnJvcicpOwogICAgICAgIGNvbnN0IHhock9uTG9hZFN5bWJvbCA9IFN5bWJvbCgnb25sb2FkJyk7CiAgICAgICAgY29uc3QgeGhyT25UaW1lb3V0U3ltYm9sID0gU3ltYm9sKCdvbnRpbWVvdXQnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRFbmRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZGVuZCcpOwogICAgICAgIGNvbnN0IHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCA9IFN5bWJvbCgnb25yZWFkeXN0YXRlY2hhbmdlJyk7CiAgICAgICAgY29uc3QgeGhyUmVhZHlTdGF0ZVN5bWJvbCA9IFN5bWJvbCgncmVhZHlTdGF0ZScpOwogICAgICAgIGNvbnN0IHhoclRpbWVvdXRTeW1ib2wgPSBTeW1ib2woJ3RpbWVvdXQnKTsKICAgICAgICBjb25zdCB4aHJXaXRoQ3JlZGVudGlhbHNTeW1ib2wgPSBTeW1ib2woJ3dpdGhDcmVkZW50aWFscycpOwogICAgICAgIGNvbnN0IHhoclVwbG9hZFN5bWJvbCA9IFN5bWJvbCgndXBsb2FkJyk7CiAgICAgICAgY29uc3QgeGhyUmVzcG9uc2VUeXBlU3ltYm9sID0gU3ltYm9sKCdyZXNwb25zZVR5cGUnKTsKICAgICAgICBjb25zdCBkZWZpbmVFdmVudCA9IChvYmosIHN5bWJvbCkgPT4gewogICAgICAgICAgICBjb25zdCB0eXBlID0gc3ltYm9sLmRlc2NyaXB0aW9uLnN1YnN0cmluZygyKTsKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KG9iaiwgc3ltYm9sLCB7CiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICB2YWx1ZTogbnVsbCwKICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBvYmouYWRkRXZlbnRMaXN0ZW5lcih0eXBlLCBmdW5jdGlvbiAoZXZlbnQpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGhhbmRsZXIgPSB0aGlzW3N5bWJvbF07CiAgICAgICAgICAgICAgICBpZiAoaGFuZGxlcikgewogICAgICAgICAgICAgICAgICAgIGhhbmRsZXIuY2FsbCh0aGlzLCBldmVudCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgIH07CiAgICAgICAgY29uc3QgY2hhbmdlUmVhZHlTdGF0ZSA9ICh4aHIsIHJlYWR5U3RhdGUpID0+IHsKICAgICAgICAgICAgeGhyW3hoclJlYWR5U3RhdGVTeW1ib2xdID0gcmVhZHlTdGF0ZTsKICAgICAgICAgICAgeGhyLmRpc3BhdGNoRXZlbnQobmV3IEV2ZW50KCdyZWFkeXN0YXRlY2hhbmdlJykpOwogICAgICAgIH07CiAgICAgICAgbGV0IGlzU2VhbGVkID0gdHJ1ZTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0IGV4dGVuZHMgRXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpZiAoISh0aGlzIGluc3RhbmNlb2YgWE1MSHR0cFJlcXVlc3QpICYmICEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0VXBsb2FkKSkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZFN0YXJ0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUHJvZ3Jlc3NTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25BYm9ydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkVycm9yU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblRpbWVvdXRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Mb2FkRW5kU3ltYm9sKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2Fkc3RhcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ubG9hZHN0YXJ0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZFN0YXJ0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbnByb2dyZXNzKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Qcm9ncmVzc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucHJvZ3Jlc3ModmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25Qcm9ncmVzc1N5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25hYm9ydCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uQWJvcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmFib3J0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uQWJvcnRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uZXJyb3IoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkVycm9yU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25lcnJvcih2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkVycm9yU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbnRpbWVvdXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPblRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnRpbWVvdXQodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmxvYWRlbmQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkxvYWRFbmRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRlbmQodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgICAgIGNsYXNzIFhNTEh0dHBSZXF1ZXN0VXBsb2FkIGV4dGVuZHMgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCB7CiAgICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICAgICAgaWYgKGlzU2VhbGVkKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSWxsZWdhbCBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3VwZXIoKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0VXBsb2FkID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBYTUxIdHRwUmVxdWVzdFVwbG9hZCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgICAgIGNsYXNzIFhNTEh0dHBSZXF1ZXN0IGV4dGVuZHMgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCB7CiAgICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICAgICAgc3VwZXIoKTsKICAgICAgICAgICAgICAgIGlzU2VhbGVkID0gZmFsc2U7CiAgICAgICAgICAgICAgICBjb25zdCB4aHJVcGxvYWQgPSBuZXcgWE1MSHR0cFJlcXVlc3RVcGxvYWQoKTsKICAgICAgICAgICAgICAgIGlzU2VhbGVkID0gdHJ1ZTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25SZWFkeVN0YXRlQ2hhbmdlU3ltYm9sKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZWFkeVN0YXRlU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogeGhyVW5zZW50LAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJUaW1lb3V0U3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogMCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhoclVwbG9hZFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVwbG9hZCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhoclJlc3BvbnNlVHlwZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25yZWFkeXN0YXRlY2hhbmdlKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25SZWFkeVN0YXRlQ2hhbmdlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25yZWFkeXN0YXRlY2hhbmdlKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVhZHlTdGF0ZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG9wZW4obWV0aG9kLCB1cmwpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJVbnNlbnQ6CiAgICAgICAgICAgICAgICBjYXNlIHhockRvbmU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlUmVhZHlTdGF0ZSh0aGlzLCB4aHJPcGVuZWQpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0UmVxdWVzdEhlYWRlcihuYW1lLCB2YWx1ZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFRydXN0VG9rZW4odHJ1c3RUb2tlbikgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCB0aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyVGltZW91dFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHRpbWVvdXQodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgd2l0aENyZWRlbnRpYWxzKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgd2l0aENyZWRlbnRpYWxzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJPcGVuZWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZGVmYXVsdDogewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCdGYWlsZWQgdG8gc2V0IHRoZSBcJ3dpdGhDcmVkZW50aWFsc1wnIHByb3BlcnR5IG9uIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIHZhbHVlIG1heSBvbmx5IGJlIHNldCBpZiB0aGUgb2JqZWN0XCdzIHN0YXRlIGlzIFVOU0VOVCBvciBPUEVORUQuJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpc1t4aHJXaXRoQ3JlZGVudGlhbHNTeW1ib2xdID0gISF2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdXBsb2FkKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyVXBsb2FkU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZW5kKCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9PT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdID0gc2V0VGltZW91dCgoKSA9PiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlUmVhZHlTdGF0ZSh0aGlzLCB4aHJEb25lKTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCdlcnJvcicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCdsb2FkZW5kJykpOwogICAgICAgICAgICAgICAgICAgIH0sIDApOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCdGYWlsZWQgdG8gZXhlY3V0ZSBcJ3NlbmRcJyBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSBvYmplY3RcJ3Mgc3RhdGUgbXVzdCBiZSBPUEVORUQuJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYWJvcnQoKSB7CiAgICAgICAgICAgICAgICBpZiAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSA9PT0geGhyT3BlbmVkICYmIHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdICE9PSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdKTsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgY2hhbmdlUmVhZHlTdGF0ZSh0aGlzLCB4aHJVbnNlbnQpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnYWJvcnQnKSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCdsb2FkZW5kJykpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVVSTCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgc3RhdHVzKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1c1RleHQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0UmVzcG9uc2VIZWFkZXIobmFtZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgb3ZlcnJpZGVNaW1lVHlwZShtaW1lKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlVHlwZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHJlc3BvbnNlVHlwZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhockRvbmU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCdyZXNwb25zZVR5cGVcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSByZXNwb25zZSB0eXBlIGNhbm5vdCBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBMT0FESU5HIG9yIERPTkUuJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3dpdGNoICh2YWx1ZSkgewogICAgICAgICAgICAgICAgY2FzZSAnJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2FycmF5YnVmZmVyJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2Jsb2InOgogICAgICAgICAgICAgICAgY2FzZSAnZG9jdW1lbnQnOgogICAgICAgICAgICAgICAgY2FzZSAnanNvbic6CiAgICAgICAgICAgICAgICBjYXNlICd0ZXh0JzogewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZSgpIHsKICAgICAgICAgICAgICAgIGNvbnN0IHJlc3BvbnNlVHlwZSA9IHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXTsKICAgICAgICAgICAgICAgIHJldHVybiByZXNwb25zZVR5cGUgPT09ICcnIHx8IHJlc3BvbnNlVHlwZSA9PT0gJ3RleHQnID8gJycgOiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVRleHQoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHJlYWQgdGhlIFwncmVzcG9uc2VUZXh0XCcgcHJvcGVydHkgZnJvbSBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBpcyBvbmx5IGFjY2Vzc2libGUgaWYgdGhlIG9iamVjdFwncyBcJ3Jlc3BvbnNlVHlwZVwnIGlzIFwnXCcgb3IgXCd0ZXh0XCcgKHdhcyBcJ2FycmF5YnVmZmVyXCcpLicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVhNTCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShYTUxIdHRwUmVxdWVzdCwgJ1VOU0VOVCcsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudAogICAgICAgIH0pOwogICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShYTUxIdHRwUmVxdWVzdCwgJ09QRU5FRCcsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhock9wZW5lZAogICAgICAgIH0pOwogICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShYTUxIdHRwUmVxdWVzdCwgJ0hFQURFUlNfUkVDRUlWRUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJIZWFkZXJzUmVjZWl2ZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdMT0FESU5HJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyTG9hZGluZwogICAgICAgIH0pOwogICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShYTUxIdHRwUmVxdWVzdCwgJ0RPTkUnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJEb25lCiAgICAgICAgfSk7CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3QsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgIH0pKCRfX19tb2NrXzAwNDY1Mjg0MDA0ZDRhYTgpOwogICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAoZnVuY3Rpb24gKF8pIHsKICAgICAgICAgICAgdmFyIHAsIGJhLCBmYSwgaGEsIGlhLCBtYSwgb2EsIHFhLCBuYSwgcmEsIHNhLCB0YSwgdWEsIHZhLCB5YSwgemEsIEFhLCBCYSwgQ2EsIERhLCBGYSwgRWEsIEdhLCBIYSwgSWEsIEthLCBOYSwgUWEsIFJhLCBTYSwgVmEsIFlhLCBaYSwgJGEsIGFiLCBiYiwgY2IsIGViLCBnYiwgb2IsIHJiLCB2YiwgeWIsIEFiLCBCYiwgRmIsIEhiLCBKYiwgSWIsIEtiLCBOYiwgUGIsIFFiLCBUYiwgVmIsIFliLCBaYiwgZGMsIGZjLCBBLCBoYywga2MsIG1jLCBuYywgb2MsIHBjLCBxYywgcmMsIHNjLCB0YywgdWMsIHdjLCB5YywgRWMsIEtjLCBNYywgVGMsIFpjLCBiZCwgdGQsIHpkLCBCZCwgRGQsIEZkLCBJZCwgSmQsIEtkLCBNZCwgTGQsIFFkLCBTZCwgVGQsIFVkLCBWZCwgWGQsIFlkLCAkZCwgYWUsIGJlLCBjZSwgZWUsIGtlLCBtZSwgbmUsIG9lLCBxZSwgRGUsIFBlLCBTZSwgVGUsIFVlLCBWZSwgWGUsIFdlLCAkZSwgZ2YsIEssIHBmLCByZiwgTWYsIFBmLCBSZiwgVmYsIFhmLCBaZiwgJGYsIGJnLCBjZywgZGcsIGdnLCBqZywgbGcsIG9nLCBwZywgc2csIHhnLCB5ZywgemcsIEFnLCBxZywgQmcsIEVnLCBGZywgR2csIHJnLCBLZywgTGcsIE5nLCBQZywgU2csIFVnLCBWZywgV2csIFpnLCBpaCwgamgsIG1oLCBuaCwgcGgsIHJoLCBzaCwgdWgsIHFoLCB4aCwgemgsIEFoLCBJaCwgS2gsIFNoLCBUaCwgTWgsIFdoLCBaaCwgYWksIGdpLCBoaSwga2ksIGxpLCBtaSwgcGksIHFpLCByaSwgdWksIHZpLCB4aSwgeWksIEFpLCB6aSwgQ2ksIEJpLCBEaSwgTmksIFBpLCBTaSwgYmosIGNqLCBkaiwgZWosIGpqLCBraiwgbWosIG5qLCBvaiwgcGosIHFqLCByaiwgc2osIGprLCBvaywgcGssIHVrLCBEaywgRWssIEdrLCBMaywgTWssIE5rLCBQaywgUWssIFNrLCBVaywgVmssIFlrLCBYaywgZGwsIGVsLCBmbCwgaGwsIGtsLCBubCwgb2wsIHBsLCBxbCwgcmwsIHNsLCB0bCwgdWwsIHhsLCB2bCwgd2wsIHlsLCBBbCwgRWwsIEdsLCBIbCwgS2wsIE1sLCBwYSwgT2wsIFFsLCBSbCwgJGwsIGRtLCBnbSwgaG0sIG9tLCBybSwgTCwgc20sIHRtLCB1bSwgdm0sIHdtLCB2LCB4bSwgeW0sIHptLCBQLCBBbSwgQm0sIENtLCBEbSwgSG0sIEltLCBKbSwgWG0sIGFoLCBsYSwgWW0sIFptLCAkbSwgYW4sIHhkOwogICAgICAgICAgICBiYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IGEubGVuZ3RoLCBkID0gJ3N0cmluZycgPT09IHR5cGVvZiBhID8gYS5zcGxpdCgnJykgOiBhLCBlID0gMDsgZSA8IGM7IGUrKykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgaW4gZCAmJiBiLmNhbGwodm9pZCAwLCBkW2VdLCBlLCBhKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYiA9IC0xOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIDAgPiBiID8gbnVsbCA6ICdzdHJpbmcnID09PSB0eXBlb2YgYSA/IGEuY2hhckF0KGIpIDogYVtiXTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZmEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgYiA9IF8uZGEoYSwgYik7CiAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgIChjID0gMCA8PSBiKSAmJiBBcnJheS5wcm90b3R5cGUuc3BsaWNlLmNhbGwoYSwgYiwgMSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgaGEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBhLmxlbmd0aDsKICAgICAgICAgICAgICAgIGlmICgwIDwgYikgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBBcnJheShiKSwgZCA9IDA7IGQgPCBiOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGNbZF0gPSBhW2RdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIFtdOwogICAgICAgICAgICB9OwogICAgICAgICAgICBpYSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMiA+PSBhcmd1bWVudHMubGVuZ3RoID8gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYSwgYikgOiBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhLCBiLCBjKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbWEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IDAsIGMgPSAwLCBkID0ge307IGMgPCBhLmxlbmd0aDspIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGFbYysrXSwgZiA9IF8uamEoZSkgPyAnbycgKyBsYShlKSA6ICh0eXBlb2YgZSkuY2hhckF0KDApICsgZTsKICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZCwgZikgfHwgKGRbZl0gPSAhMCwgYVtiKytdID0gZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBhLmxlbmd0aCA9IGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIG9hID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGEuc29ydChiIHx8IG5hKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcWEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IHBhLCBjID0gQXJyYXkoYS5sZW5ndGgpLCBkID0gMDsgZCA8IGEubGVuZ3RoOyBkKyspCiAgICAgICAgICAgICAgICAgICAgY1tkXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IGQsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBhW2RdCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHZhciBlID0gYiB8fCBuYTsKICAgICAgICAgICAgICAgIG9hKGMsIGZ1bmN0aW9uIChmLCBnKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUoZi52YWx1ZSwgZy52YWx1ZSkgfHwgZi5pbmRleCAtIGcuaW5kZXg7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGZvciAoYiA9IDA7IGIgPCBhLmxlbmd0aDsgYisrKQogICAgICAgICAgICAgICAgICAgIGFbYl0gPSBjW2JdLnZhbHVlOwogICAgICAgICAgICB9OwogICAgICAgICAgICBuYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA+IGIgPyAxIDogYSA8IGIgPyAtMSA6IDA7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHJhID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID09PSBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBzYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0ge30sIGQgPSAwOyBkIDwgYS5sZW5ndGg7IGQrKykgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gYVtkXSwgZiA9IGIuY2FsbCh2b2lkIDAsIGUsIGQsIGEpOwogICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gZiAmJiAoY1tmXSB8fCAoY1tmXSA9IFtdKSkucHVzaChlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICB0YSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gW10sIGMgPSAwOyBjIDwgYXJndW1lbnRzLmxlbmd0aDsgYysrKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhcmd1bWVudHNbY107CiAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSAwOyBlIDwgZC5sZW5ndGg7IGUgKz0gODE5MikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSB0YS5hcHBseShudWxsLCBpYShkLCBlLCBlICsgODE5MikpLCBnID0gMDsgZyA8IGYubGVuZ3RoOyBnKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5wdXNoKGZbZ10pOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgYi5wdXNoKGQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHVhID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMgaW4gYSkKICAgICAgICAgICAgICAgICAgICBiLmNhbGwodm9pZCAwLCBhW2NdLCBjLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYyBpbiBhKQogICAgICAgICAgICAgICAgICAgIGlmIChiLmNhbGwodm9pZCAwLCBhW2NdLCBjLCBhKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHlhID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMsIGQsIGUgPSAxOyBlIDwgYXJndW1lbnRzLmxlbmd0aDsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgZCA9IGFyZ3VtZW50c1tlXTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGMgaW4gZCkKICAgICAgICAgICAgICAgICAgICAgICAgYVtjXSA9IGRbY107CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiA9IDA7IGYgPCB3YS5sZW5ndGg7IGYrKykKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IHdhW2ZdLCBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZCwgYykgJiYgKGFbY10gPSBkW2NdKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgemEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IF8uci5uYXZpZ2F0b3I7CiAgICAgICAgICAgICAgICByZXR1cm4gYSAmJiAoYSA9IGEudXNlckFnZW50KSA/IGEgOiAnJzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQWEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIC0xICE9IHphKCkuaW5kZXhPZihhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQmEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IFJlZ0V4cCgnKFtBLVpdW1xcdyBdKykvKFteXFxzXSspXFxzKig/OlxcKCguKj8pXFwpKT8nLCAnZycpLCBjID0gW10sIGQ7IGQgPSBiLmV4ZWMoYSk7KQogICAgICAgICAgICAgICAgICAgIGMucHVzaChbCiAgICAgICAgICAgICAgICAgICAgICAgIGRbMV0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRbMl0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRbM10gfHwgdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQ2EgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQWEoJ1RyaWRlbnQnKSB8fCBBYSgnTVNJRScpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBEYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBBYSgnRmlyZWZveCcpIHx8IEFhKCdGeGlPUycpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBGYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBBYSgnU2FmYXJpJykgJiYgIShFYSgpIHx8IEFhKCdDb2FzdCcpIHx8IEFhKCdPcGVyYScpIHx8IEFhKCdFZGdlJykgfHwgQWEoJ0VkZy8nKSB8fCBBYSgnT1BSJykgfHwgRGEoKSB8fCBBYSgnU2lsaycpIHx8IEFhKCdBbmRyb2lkJykpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBFYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAoQWEoJ0Nocm9tZScpIHx8IEFhKCdDcmlPUycpKSAmJiAhQWEoJ0VkZ2UnKSB8fCBBYSgnU2lsaycpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBHYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHt9OwogICAgICAgICAgICAgICAgYS5mb3JFYWNoKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgYltjWzBdXSA9IGNbMV07CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiW18udChjLCAnZmluZCcpLmNhbGwoYywgZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQgaW4gYjsKICAgICAgICAgICAgICAgICAgICB9KV0gfHwgJyc7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICBIYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gemEoKTsKICAgICAgICAgICAgICAgIGlmIChDYSgpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSAvcnY6ICooW1xkXC5dKikvLmV4ZWMoYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGIgJiYgYlsxXSkKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGJbMV07CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAvTVNJRSArKFtcZFwuXSspLy5leGVjKGEpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyAmJiBjWzFdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEgPSAvVHJpZGVudFwvKFxkLlxkKS8uZXhlYyhhKSwgJzcuMCcgPT0gY1sxXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSAmJiBhWzFdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGFbMV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnNC4wJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSAnOC4wJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICc1LjAnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9ICc5LjAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzYuMCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gJzEwLjAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJzcuMCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gJzExLjAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gJzcuMCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGNbMV07CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBiOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGEgPSBCYShhKTsKICAgICAgICAgICAgICAgIGIgPSBHYShhKTsKICAgICAgICAgICAgICAgIHJldHVybiBBYSgnT3BlcmEnKSA/IGIoWwogICAgICAgICAgICAgICAgICAgICdWZXJzaW9uJywKICAgICAgICAgICAgICAgICAgICAnT3BlcmEnCiAgICAgICAgICAgICAgICBdKSA6IEFhKCdFZGdlJykgPyBiKFsnRWRnZSddKSA6IEFhKCdFZGcvJykgPyBiKFsnRWRnJ10pIDogQWEoJ1NpbGsnKSA/IGIoWydTaWxrJ10pIDogRWEoKSA/IGIoWwogICAgICAgICAgICAgICAgICAgICdDaHJvbWUnLAogICAgICAgICAgICAgICAgICAgICdDcmlPUycsCiAgICAgICAgICAgICAgICAgICAgJ0hlYWRsZXNzQ2hyb21lJwogICAgICAgICAgICAgICAgXSkgOiAoYSA9IGFbMl0pICYmIGFbMV0gfHwgJyc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIElhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIHdpbmRvdyA/IHdpbmRvdy50cnVzdGVkVHlwZXMgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gYSAmJiB2b2lkIDAgIT09IGEgPyBhIDogbnVsbDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgS2EgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSwgYjsKICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IEphKQogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEphID0gbnVsbCAhPT0gKGIgPSBudWxsID09PSAoYSA9IElhKCkpIHx8IHZvaWQgMCA9PT0gYSA/IHZvaWQgMCA6IGEuY3JlYXRlUG9saWN5KCdnb29nbGUjc2FmZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZUhUTUw6IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlU2NyaXB0OiBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZVNjcmlwdFVSTDogZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSkpICYmIHZvaWQgMCAhPT0gYiA/IGIgOiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgSmEgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBKYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTmEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIsIGMgPSBudWxsID09PSAoYiA9IEthKCkpIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuY3JlYXRlSFRNTChhKTsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTGEobnVsbCAhPT0gYyAmJiB2b2lkIDAgIT09IGMgPyBjIDogYSwgXy5NYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFFhID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiLCBjID0gbnVsbCA9PT0gKGIgPSBLYSgpKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLmNyZWF0ZVNjcmlwdFVSTChhKTsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgT2EobnVsbCAhPT0gYyAmJiB2b2lkIDAgIT09IGMgPyBjIDogYSwgXy5NYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFJhID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmIChhIGluc3RhbmNlb2YgT2EpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuajsKICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCcnKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgU2EgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGI7CiAgICAgICAgICAgICAgICBhID0gUmEoYSk7CiAgICAgICAgICAgICAgICByZXR1cm4gKG51bGwgPT09IChiID0gSWEoKSkgfHwgdm9pZCAwID09PSBiID8gMCA6IGIuaXNTY3JpcHRVUkwoYSkpID8gVHJ1c3RlZFNjcmlwdFVSTC5wcm90b3R5cGUudG9TdHJpbmcuYXBwbHkoYSkgOiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICBWYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBpZiAoYSBpbnN0YW5jZW9mIFRhKQogICAgICAgICAgICAgICAgICAgIGlmIChhIGluc3RhbmNlb2YgTGEpCiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLmo7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignJyk7CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgYSA9IFVhKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFlhID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhIGluc3RhbmNlb2YgV2EgPyBSYShhKSA6IFhhKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBaYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSBpbnN0YW5jZW9mIFdhID8gUmEoYSkudG9TdHJpbmcoKSA6IFhhKGEpLnRvU3RyaW5nKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgICRhID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBhICYmIHZvaWQgMCAhPT0gYS50YWdOYW1lKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdzY3JpcHQnID09PSBhLnRhZ05hbWUudG9Mb3dlckNhc2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1VzZSBzZXRUZXh0Q29udGVudCB3aXRoIGEgU2FmZVNjcmlwdC4nKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0eWxlJyA9PT0gYS50YWdOYW1lLnRvTG93ZXJDYXNlKCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdVc2Ugc2V0VGV4dENvbnRlbnQgd2l0aCBhIFNhZmVTdHlsZVNoZWV0LicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYS5pbm5lckhUTUwgPSBWYShiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYWIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIsIGMgPSAoYS5vd25lckRvY3VtZW50ICYmIGEub3duZXJEb2N1bWVudC5kZWZhdWx0VmlldyB8fCB3aW5kb3cpLmRvY3VtZW50LCBkID0gbnVsbCA9PT0gKGIgPSBjLnF1ZXJ5U2VsZWN0b3IpIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuY2FsbChjLCAnc2NyaXB0W25vbmNlXScpOwogICAgICAgICAgICAgICAgKGIgPSBkID8gZC5ub25jZSB8fCBkLmdldEF0dHJpYnV0ZSgnbm9uY2UnKSB8fCAnJyA6ICcnKSAmJiBhLnNldEF0dHJpYnV0ZSgnbm9uY2UnLCBiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYmIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgYS5zcmMgPSBZYShiKTsKICAgICAgICAgICAgICAgIGFiKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBjYiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkXzcyMTE4ZjU0YTE5MDM3Y2QgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnZmV0Y2gnKTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfNzIxMThmNTRhMTkwMzdjZCkKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2ZldGNoJywgJF9fX21vY2tfNWM1NWVhOTUyZGY0M2NiZS5mZXRjaCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEud3JpdGUoVmEoYikpOwogICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfNzIxMThmNTRhMTkwMzdjZCkKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2ZldGNoJywgJF9fX29sZF83MjExOGY1NGExOTAzN2NkKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGViID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYS5wYXNzaXZlICYmIGRiKCkgPyBhIDogYS5jYXB0dXJlIHx8ICExIDogITE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGdiID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gd2luZG93LCBjID0gITA7CiAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gITEgOiBjOwogICAgICAgICAgICAgICAgbmV3IHYuUHJvbWlzZShmdW5jdGlvbiAoZCwgZSkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoOwogICAgICAgICAgICAgICAgICAgICAgICBnLm9ubG9hZCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGcub25lcnJvciA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT09IChoID0gZy5wYXJlbnRFbGVtZW50KSB8fCB2b2lkIDAgPT09IGggPyB2b2lkIDAgOiBoLnJlbW92ZUNoaWxkKGcpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGIuZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgZy5vbmxvYWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGYoKTsKICAgICAgICAgICAgICAgICAgICAgICAgZCgpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgZy5vbmVycm9yID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUodm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGcudHlwZSA9ICd0ZXh0L2phdmFzY3JpcHQnOwogICAgICAgICAgICAgICAgICAgIGJiKGcsIGEpOwogICAgICAgICAgICAgICAgICAgIGMgJiYgJ2NvbXBsZXRlJyAhPT0gYi5kb2N1bWVudC5yZWFkeVN0YXRlID8gXy5mYihiLCAnbG9hZCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYi5kb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKGcpOwogICAgICAgICAgICAgICAgICAgIH0pIDogYi5kb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKGcpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIG9iID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiLCBjLCBkLCBlLCBmLCBnOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChoLmopIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiID0gJ2h0dHBzOi8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20vZ2V0Y29uZmlnL3NvZGFyP3N2PTIwMCZ0aWQ9JyArIGEuaiArICgnJnR2PScgKyBhLm0gKyAnJnN0PScpICsgYS5hYiwgYyA9IHZvaWQgMCwgaC5GID0gMiwgamIoaCwga2IoYiksIDQpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGgubTsKICAgICAgICAgICAgICAgICAgICAgICAgbGIoaCwgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgbWIoaCk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaC5yZXR1cm4odm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGEucmIgfHwgYy5zb2Rhcl9xdWVyeV9pZDsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHZvaWQgMCAhPT0gYy5yY19lbmFibGUgJiYgYS5GID8gYy5yY19lbmFibGUgOiAnbic7CiAgICAgICAgICAgICAgICAgICAgICAgIGYgPSB2b2lkIDAgPT09IGMuYmdfc25hcHNob3RfZGVsYXlfbXMgPyAnMCcgOiBjLmJnX3NuYXBzaG90X2RlbGF5X21zOwogICAgICAgICAgICAgICAgICAgICAgICBnID0gdm9pZCAwID09PSBjLmlzX2dlbl8yMDQgPyAnMScgOiBjLmlzX2dlbl8yMDQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkICYmIGMuYmdfaGFzaF9iYXNlbmFtZSAmJiBjLmJnX2JpbmFyeSA/IGgucmV0dXJuKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IGEuQSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5kOiBjLmJnX2hhc2hfYmFzZW5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZDogYy5iZ19iaW5hcnksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBVZDogYS5qICsgJ18nICsgYS5tLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmI6IGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhYjogYS5hYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEliOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgU2I6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBIYjogZwogICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGgucmV0dXJuKHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHJiID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gYy5qKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamIoYywgb2IoYSksIDIpOwogICAgICAgICAgICAgICAgICAgIGlmIChiID0gYy5tKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gJ3NvZGFyMic7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSB2b2lkIDAgPT09IGQgPyAnc29kYXIyJyA6IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gd2luZG93LCBmID0gZS5Hb29nbGVHY0xLaE9tczsKICAgICAgICAgICAgICAgICAgICAgICAgZiAmJiAnZnVuY3Rpb24nID09PSB0eXBlb2YgZi5wdXNoIHx8IChmID0gZS5Hb29nbGVHY0xLaE9tcyA9IFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgZi5wdXNoKChnLl9jdHhfID0gYi5jb250ZXh0LCBnLl9iZ3ZfID0gYi5uZCwgZy5fYmdwXyA9IGIubWQsIGcuX2xpXyA9IGIuVWQsIGcuX2prXyA9IGIucmIsIGcuX3N0XyA9IGIuYWIsIGcuX3JjXyA9IGIuSWIsIGcuX2RsXyA9IGIuU2IsIGcuX2cyXyA9IGIuSGIsIGcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYgPSBlLkdvb2dsZURYNVlLVVNrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5Hb29nbGVEWDVZS1VTayA9IHZvaWQgMCwgZlsxXSgpOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gcGIocWIsIHsgYmFzZW5hbWU6IGQgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGdiKGQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5yZXR1cm4oYik7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKHNiKQogICAgICAgICAgICAgICAgICAgIGEgPSAodWIgfHwgKHViID0gbmV3IFRleHRFbmNvZGVyKCkpKS5lbmNvZGUoYSk7CiAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gITEgOiBiOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwLCBkID0gbmV3IFVpbnQ4QXJyYXkoMyAqIGEubGVuZ3RoKSwgZSA9IDA7IGUgPCBhLmxlbmd0aDsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gYS5jaGFyQ29kZUF0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMTI4ID4gZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRbYysrXSA9IGY7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDIwNDggPiBmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRbYysrXSA9IGYgPj4gNiB8IDE5MjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg1NTI5NiA8PSBmICYmIDU3MzQzID49IGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDU2MzE5ID49IGYgJiYgZSA8IGEubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGEuY2hhckNvZGVBdCgrK2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDU2MzIwIDw9IGcgJiYgNTczNDMgPj0gZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSAxMDI0ICogKGYgLSA1NTI5NikgKyBnIC0gNTYzMjAgKyA2NTUzNjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW2MrK10gPSBmID4+IDE4IHwgMjQwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRbYysrXSA9IGYgPj4gMTIgJiA2MyB8IDEyODsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW2MrK10gPSBmID4+IDYgJiA2MyB8IDEyODsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW2MrK10gPSBmICYgNjMgfCAxMjg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLS07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignRm91bmQgYW4gdW5wYWlyZWQgc3Vycm9nYXRlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSA2NTUzMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFtjKytdID0gZiA+PiAxMiB8IDIyNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW2MrK10gPSBmID4+IDYgJiA2MyB8IDEyODsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRbYysrXSA9IGYgJiA2MyB8IDEyODsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBhID0gZC5zdWJhcnJheSgwLCBjKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICB5YiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IDAgPiBhOwogICAgICAgICAgICAgICAgYSA9IE1hdGguYWJzKGEpOwogICAgICAgICAgICAgICAgdmFyIGMgPSBhID4+PiAwOwogICAgICAgICAgICAgICAgYSA9IE1hdGguZmxvb3IoKGEgLSBjKSAvIDQyOTQ5NjcyOTYpOwogICAgICAgICAgICAgICAgYSA+Pj49IDA7CiAgICAgICAgICAgICAgICBiICYmIChhID0gfmEgPj4+IDAsIGMgPSAofmMgPj4+IDApICsgMSwgNDI5NDk2NzI5NSA8IGMgJiYgKGMgPSAwLCBhKyssIDQyOTQ5NjcyOTUgPCBhICYmIChhID0gMCkpKTsKICAgICAgICAgICAgICAgIHdiID0gYzsKICAgICAgICAgICAgICAgIHhiID0gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQWIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgT2JqZWN0LmlzRnJvemVuKGEpIHx8ICh6YiA/IGFbemJdIHw9IDEgOiB2b2lkIDAgIT09IGEuR2IgPyBhLkdiIHw9IDEgOiBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhhLCB7CiAgICAgICAgICAgICAgICAgICAgR2I6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITEKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQmIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGEgJiYgJ29iamVjdCcgPT09IHR5cGVvZiBhICYmICFBcnJheS5pc0FycmF5KGEpICYmIGEuY29uc3RydWN0b3IgPT09IE9iamVjdDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRmIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYSA9IG51bGwgPT0gYSB8fCAnc3RyaW5nJyA9PT0gdHlwZW9mIGEgPyBhIDogQ2IgJiYgYSBpbnN0YW5jZW9mIFVpbnQ4QXJyYXkgPyBFYihhKSA6IG51bGw7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSGIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0eXBlb2YgYSkgewogICAgICAgICAgICAgICAgY2FzZSAnbnVtYmVyJzoKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNGaW5pdGUoYSkgPyBhIDogU3RyaW5nKGEpOwogICAgICAgICAgICAgICAgY2FzZSAnb2JqZWN0JzoKICAgICAgICAgICAgICAgICAgICBpZiAoYSAmJiAhQXJyYXkuaXNBcnJheShhKSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQ2IgJiYgbnVsbCAhPSBhICYmIGEgaW5zdGFuY2VvZiBVaW50OEFycmF5KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEViKGEpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSBpbnN0YW5jZW9mIEdiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuT2EoKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSmIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShhKSB8fCBCYihhKSA/IEliKGEsIGIpIDogYihhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSWIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoYSkpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gQXJyYXkoYS5sZW5ndGgpLCBkID0gMDsgZCA8IGEubGVuZ3RoOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGNbZF0gPSBKYihhW2RdLCBiKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IEFycmF5LmlzQXJyYXkoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHpiID8gZSA9IGFbemJdIDogZSA9IGEuR2I7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSAobnVsbCA9PSBlID8gMCA6IGUpICYgMTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYiAmJiBBYihjKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGUgPSB7fTsKICAgICAgICAgICAgICAgIGZvciAoYyBpbiBhKQogICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChhLCBjKSAmJiAoZVtjXSA9IEpiKGFbY10sIGIpKTsKICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICB9OwogICAgICAgICAgICBLYiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBpZiAoYSAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgYSAmJiBhLnRvSlNPTikKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS50b0pTT04oKTsKICAgICAgICAgICAgICAgIGEgPSBIYihhKTsKICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5pc0FycmF5KGEpID8gSWIoYSwgS2IpIDogYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTmIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKENiICYmIG51bGwgIT0gYSAmJiBhIGluc3RhbmNlb2YgVWludDhBcnJheSkKICAgICAgICAgICAgICAgICAgICBhID0gbmV3IFVpbnQ4QXJyYXkoYSk7CiAgICAgICAgICAgICAgICBlbHNlIGlmIChhIGluc3RhbmNlb2YgR2IpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEuRiwgYyA9IG5ldyBHYihBYihbXSksIGIpLCBkOwogICAgICAgICAgICAgICAgICAgIGZvciAoZCBpbiBhLm1hcCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGEubWFwW2RdOwogICAgICAgICAgICAgICAgICAgICAgICBiID8gYy5zZXQoZVswXSwgTGIoTWIoYSwgZSkpKSA6IGMuc2V0KGVbMF0sIEpiKGVbMV0sIE5iKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGEgPSBjOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFBiID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIE9iID0gYjsKICAgICAgICAgICAgICAgIGEgPSBuZXcgYShiKTsKICAgICAgICAgICAgICAgIE9iID0gbnVsbDsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICBRYiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBjICE9PSBkID8gdyhhLCBiLCBjKSA6IHcoYSwgYiwgdm9pZCAwLCAhMSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgVGIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIEhiKGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBWYiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBiLmwgJiYgKGEubCA9IGIubC5zbGljZSgpKTsKICAgICAgICAgICAgICAgIHZhciBjID0gYi5qOwogICAgICAgICAgICAgICAgaWYgKGMpIHsKICAgICAgICAgICAgICAgICAgICBiID0gYi5tOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgaW4gYykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChjLCBkKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjW2RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9ICEoIWIgfHwgIWJbZF0pLCBnID0gK2Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChmID0gVWIoYSwgZVswXS5jb25zdHJ1Y3RvciwgZywgZiksIGcgPSAwOyBnIDwgTWF0aC5taW4oZi5sZW5ndGgsIGUubGVuZ3RoKTsgZysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZiKGZbZ10sIGVbZ10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZiA9IFdiKGEsIGUuY29uc3RydWN0b3IsIGcsIHZvaWQgMCwgZikpICYmIFZiKGYsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFliID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHJldHVybiBYYihhLCBiKSA9PT0gYyA/IGMgOiAtMTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWmIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgc3dpdGNoIChhKSB7CiAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdnZGEnOwogICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgIHJldHVybiAnZ3B0JzsKICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2ltYSc7CiAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdwYWwnOwogICAgICAgICAgICAgICAgY2FzZSA1OgogICAgICAgICAgICAgICAgICAgIHJldHVybiAneGZhZCc7CiAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdkdjNuJzsKICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3NwYSc7CiAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5rJzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgZGMgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/IFtdIDogZDsKICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IGEuTXV0YXRpb25PYnNlcnZlcihmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgIGYgPSBfLnkoZik7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyA9IGYubmV4dCgpOyAhZy5kb25lOyBnID0gZi5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IF8ueShnLnZhbHVlLnJlbW92ZWROb2Rlcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGggPSBnLm5leHQoKTsgIWguZG9uZTsgaCA9IGcubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGggPSBoLnZhbHVlLCBkICYmIChoID09PSBiIHx8ICRiKGgsIGIpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBfLnkoZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChnID0gZi5uZXh0KCk7ICFnLmRvbmU7IGcgPSBmLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZy52YWx1ZS5kaXNjb25uZWN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBkLnB1c2goZSk7CiAgICAgICAgICAgICAgICBlLm9ic2VydmUoYS5kb2N1bWVudC5kb2N1bWVudEVsZW1lbnQsIHsKICAgICAgICAgICAgICAgICAgICBjaGlsZExpc3Q6ICEwLAogICAgICAgICAgICAgICAgICAgIHN1YnRyZWU6ICEwCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGFjKGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFmLnBhcmVudCB8fCAhYmMoZi5wYXJlbnQpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyA9IGYucGFyZW50LmRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdpZnJhbWUnKSwgaCA9IDA7IGggPCBnLmxlbmd0aDsgaCsrKQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNjKGdbaF0pID09IGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYyhmLnBhcmVudCwgZ1toXSwgYywgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0sICExLCAhMSwgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGZjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgXy5lYyhmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiLnN1YnN0cigwLCBhLmxlbmd0aCArIDEpLnRvTG93ZXJDYXNlKCkgPT09IGEgKyAnOic7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGdjLmFwcGx5KDEsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICBpZiAoMCA9PT0gYi5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFhKGFbMF0pOwogICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IFthWzBdXSwgZCA9IDA7IGQgPCBiLmxlbmd0aDsgZCsrKQogICAgICAgICAgICAgICAgICAgIGMucHVzaChlbmNvZGVVUklDb21wb25lbnQoYltkXSkpLCBjLnB1c2goYVtkICsgMV0pOwogICAgICAgICAgICAgICAgcmV0dXJuIFFhKGMuam9pbignJykpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBoYyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IFNhKGEpOwogICAgICAgICAgICAgICAgaWYgKC8jLy50ZXN0KGMpKQogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCcnKTsKICAgICAgICAgICAgICAgIHZhciBkID0gL1w/Ly50ZXN0KGMpID8gJyYnIDogJz8nOwogICAgICAgICAgICAgICAgYi5mb3JFYWNoKGZ1bmN0aW9uIChlLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgZSA9IGUgaW5zdGFuY2VvZiBBcnJheSA/IGUgOiBbZV07CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyA9IDA7IGcgPCBlLmxlbmd0aDsgZysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZVtnXTsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gaCAmJiB2b2lkIDAgIT09IGggJiYgKGMgKz0gZCArIGVuY29kZVVSSUNvbXBvbmVudChmKSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudChTdHJpbmcoaCkpLCBkID0gJyYnKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBRYShjKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAga2MgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGdjLmFwcGx5KDAsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYXBwbHkodGhpcywgYik7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIG1jID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEuWmMuYXBwbHkoYSwgXy5sYyhnYy5hcHBseSgxLCBhcmd1bWVudHMpLm1hcChmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICRjOiAyLAogICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiBiCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIG5jID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEuWmMuYXBwbHkoYSwgXy5sYyhnYy5hcHBseSgxLCBhcmd1bWVudHMpLm1hcChmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICRjOiA1LAogICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiBiCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIG9jID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgYS51YSAmJiBhLnVhKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHBjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICBxYyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBpZiAoIWIoYSkpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoU3RyaW5nKGEpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcmMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcWMoYSwgYik7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgc2MgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgaWYgKCFhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMgJiYgMCA8IGMubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignWycgKyBjLm1hcChTdHJpbmcpLmpvaW4oJywnKSArICddJyk7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoU3RyaW5nKGEpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdGMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF80YWM1MTljYTdlYmE5MzZhID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ2xvY2FsU3RvcmFnZScpOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF80YWM1MTljYTdlYmE5MzZhKQogICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX21vY2tfNTk1MWZkOTY4YTllNDg5Yi5sb2NhbFN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gd2luZG93IDogYjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEUoYSwgNSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiLmxvY2FsU3RvcmFnZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF80YWM1MTljYTdlYmE5MzZhKQogICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX29sZF80YWM1MTljYTdlYmE5MzZhKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHVjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnbnVsbCcgIT09IGEub3JpZ2luOwogICAgICAgICAgICB9OwogICAgICAgICAgICB3YyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBiID0gRShiLCA1KSAmJiB1YyhjKSA/IGMuZG9jdW1lbnQuY29va2llIDogbnVsbDsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09PSBiID8gbnVsbCA6IG5ldyB2Yyh7IGNvb2tpZTogYiB9KS5nZXQoYSkgfHwgJyc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHljID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjLCBkLCBlOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gZi5qKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyA9IDAgPCBiID8gYS5maWx0ZXIoZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZy5EYzsKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBhLCBqYihmLCB2LlByb21pc2UuYWxsKGMubWFwKGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5HYy5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICB9KSksIDIpOwogICAgICAgICAgICAgICAgICAgIGlmICgzICE9IGYuaikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5sZW5ndGggPT09IGMubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYucmV0dXJuKDApOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gYS5maWx0ZXIoZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnLkRjOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IF8ueGMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGYsIHYuUHJvbWlzZS5yYWNlKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYuUHJvbWlzZS5hbGwoZC5tYXAoZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5HYy5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IHYuUHJvbWlzZShmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIHNldFRpbWVvdXQoZywgYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgICAgICAgICBdKSwgMyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBmLnJldHVybihfLnhjKCkgLSBlKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBFYyA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gbnVsbCA6IGM7CiAgICAgICAgICAgICAgICBkID0gdm9pZCAwID09PSBkID8ge30gOiBkOwogICAgICAgICAgICAgICAgaWYgKE1hdGgucmFuZG9tKCkgPCBfLnpjKEFjKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0ge307CiAgICAgICAgICAgICAgICAgICAgQmMoXy50KE9iamVjdCwgJ2Fzc2lnbicpLmNhbGwoT2JqZWN0LCAoZS5jID0gU3RyaW5nKGEpLCBlLnBjID0gU3RyaW5nKENjKHdpbmRvdykpLCBlLmVtID0gYywgZS5saWQgPSBiLCBlLmVpZHMgPSBEYygpLm0oKS5qb2luKCksIGUpLCBkKSwgJ2VzcCcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBLYyA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBFYygxOCwgYSk7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gXy54YygpOwogICAgICAgICAgICAgICAgICAgIF8uemMoRmMpICYmIChHYyhiLCBOdW1iZXIoKCgwLCBGLkgpKEhjKGIsIDgpKSAtIDEpLnRvRml4ZWQoMykpKSwgdyhiLCA3LCBNYXRoLnJvdW5kKGUgLyAxMDAwIC8gNjApKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoKS50aGVuKGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEVjKDI5LCBhLCBudWxsLCB7IGRlbHRhOiBTdHJpbmcoXy54YygpIC0gZSkgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoYiwgMywgRGF0ZS5ub3coKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIEljKGEsIGIsIGYsIGQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICBJYyhhLCBiLCBHKGIsIDIpLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgRWMoMjgsIGEsIEpjKGYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChmKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEljKGEsIGIsIEcoYiwgMiksIGQpLCBFYygxLCBhLCBKYyhmKSksIHYuUHJvbWlzZS5yZXNvbHZlKGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBNYyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gd2luZG93OwogICAgICAgICAgICAgICAgdmFyIGIgPSB2b2lkIDAgPT09IGIgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB9IDogYjsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgdi5Qcm9taXNlKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMoYigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgXy5MYyhhLCAnbG9hZCcsIGQpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgXy5mYihhLCAnbG9hZCcsIGQpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFRjID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIHZhciBlLCBmLCBnLCBoLCBrOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChsKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gbC5qKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IG5ldyBOYyhhLCBiLCBjLCBkKSwgZiA9IG5ldyBPYyhlLm8sIGUuQiwgYywgZCksIGcgPSBuZXcgUGMoZi5vLCBmLkIsIGMsIGQpLCBoID0gbmV3IFFjKCksIFJjKGgsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZwogICAgICAgICAgICAgICAgICAgICAgICBdKSwgU2MoaCksIGpiKGwsIGYubC5wcm9taXNlLCAyKTsKICAgICAgICAgICAgICAgICAgICBrID0gbC5tOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBsLnJldHVybihrID8gayA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbGxlY3RvckdlbmVyYXRlZERhdGE6IG51bGwKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBaYyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZDsKICAgICAgICAgICAgICAgIGlmIChiKQogICAgICAgICAgICAgICAgICAgIGlmIChVYygpID09PSBWYyh3aW5kb3cpIHx8IF8uSChXYykpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmVuY3J5cHRlZFNpZ25hbFByb3ZpZGVycyBpbnN0YW5jZW9mIFhjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5lbmNyeXB0ZWRTaWduYWxQcm92aWRlcnMuYWRkRXJyb3JIYW5kbGVyKGMpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IFljKG51bGwgIT09IChkID0gYS5lbmNyeXB0ZWRTaWduYWxQcm92aWRlcnMpICYmIHZvaWQgMCAhPT0gZCA/IGQgOiBbXSwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmVuY3J5cHRlZFNpZ25hbFByb3ZpZGVycyA9IG5ldyBYYyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuYWRkRXJyb3JIYW5kbGVyKGMpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBFYygxNiwgJycpOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIEVjKDE1LCAnJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGJkID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHZhciBkLCBlID0gYi50b1N0cmluZygpOwogICAgICAgICAgICAgICAgaWYgKGMgJiYgIWRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJ1tzcmM9IicgKyBlICsgJyJdJykpCiAgICAgICAgICAgICAgICAgICAgaWYgKGMgPSAkYygpLmdldChhLCBjKSwgYy5nZXRFcnJvcigpKQogICAgICAgICAgICAgICAgICAgICAgICBFYyhjLmdldEVycm9yKCksIGEsIGMuZXJyb3JNZXNzYWdlKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChjID0gYy5VYiwgIWMgfHwgISgwID09PSBhZChjKSB8fCAxID4gKG51bGwgIT09IChkID0gSGMoYywgOCkpICYmIHZvaWQgMCAhPT0gZCA/IGQgOiAwKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgRWMoMzAsIGEsIG51bGwsIHsgdXJsOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgICAgICAgICBmLnNldEF0dHJpYnV0ZSgnZXNwLXNpZ25hbCcsICd0cnVlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJiKGYsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVjKDMxLCBhLCBudWxsLCB7IHVybDogZSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8uTGMoZiwgJ2Vycm9yJywgZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmhlYWQuYXBwZW5kQ2hpbGQoZik7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uZmIoZiwgJ2Vycm9yJywgZyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB0ZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGEuaWQsIGMgPSBbJ2lkJ10sIGQgPSB7fSwgZTsKICAgICAgICAgICAgICAgIGZvciAoZSBpbiBhKQogICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChhLCBlKSAmJiAwID4gYy5pbmRleE9mKGUpICYmIChkW2VdID0gYVtlXSk7CiAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBhICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSAwOwogICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoYSk7IGYgPCBlLmxlbmd0aDsgZisrKQogICAgICAgICAgICAgICAgICAgICAgICAwID4gYy5pbmRleE9mKGVbZl0pICYmIChkW2VbZl1dID0gYVtlW2ZdXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoXy50KE9iamVjdCwgJ2tleXMnKS5jYWxsKE9iamVjdCwgZCkubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdJbnZhbGlkIGF0dHJpYnV0ZShzKTogJyArIF8udChPYmplY3QsICdrZXlzJykuY2FsbChPYmplY3QsIGQpKTsKICAgICAgICAgICAgICAgIGEgPSB7IGlkOiBiIH07CiAgICAgICAgICAgICAgICBpZiAoIWNkLnRlc3QoJ2RpdicpKQogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCcnKTsKICAgICAgICAgICAgICAgIGlmICgnRElWJyBpbiBkZCkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignJyk7CiAgICAgICAgICAgICAgICBjID0gdm9pZCAwOwogICAgICAgICAgICAgICAgYiA9IG51bGw7CiAgICAgICAgICAgICAgICBkID0gJyc7CiAgICAgICAgICAgICAgICBpZiAoYSkKICAgICAgICAgICAgICAgICAgICBmb3IgKGggaW4gYSkKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChhLCBoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjZC50ZXN0KGgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBhW2hdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmIGluc3RhbmNlb2YgZWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBmZChmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHlsZScgPT0gZS50b0xvd2VyQ2FzZSgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoL15vbi9pLnRlc3QoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLnRvTG93ZXJDYXNlKCkgaW4gZ2QpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZiBpbnN0YW5jZW9mIGhkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBYYShmKS50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZiBpbnN0YW5jZW9mIGlkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBfLmpkKGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoJ3N0cmluZycgPT09IHR5cGVvZiBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoZiBpbnN0YW5jZW9mIGlkKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYgPSAnb2JqZWN0JyA9PSB0eXBlb2YgZiAmJiBmLkhhID8gZi5FYSgpIDogU3RyaW5nKGYpLCBrZC50ZXN0KGYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IG5ldyBpZChmLCBsZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IFN0cmluZyhmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBmLnJlcGxhY2UoLyglMEF8JTBEKS9nLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGYubWF0Y2gobWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGcgJiYgbmQudGVzdChnWzFdKSA/IG5ldyBpZChmLCBsZCkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IChmIHx8IG9kKS5FYSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLkhhICYmIChmID0gZi5FYSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZSArICc9IicgKyBwZChTdHJpbmcoZikpICsgJyInOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgKz0gJyAnICsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGggPSAnPGRpdicgKyBkOwogICAgICAgICAgICAgICAgbnVsbCA9PSBjID8gYyA9IFtdIDogQXJyYXkuaXNBcnJheShjKSB8fCAoYyA9IFtjXSk7CiAgICAgICAgICAgICAgICAhMCA9PT0gcWQuZGl2ID8gaCArPSAnPicgOiAoYiA9IHJkKGMpLCBoICs9ICc+JyArIFVhKGIpLnRvU3RyaW5nKCkgKyAnPC9kaXY+JywgYiA9IGIuWmEoKSk7CiAgICAgICAgICAgICAgICAoYSA9IGEgJiYgYS5kaXIpICYmICgvXihsdHJ8cnRsfGF1dG8pJC9pLnRlc3QoYSkgPyBiID0gMCA6IGIgPSBudWxsKTsKICAgICAgICAgICAgICAgIGggPSBzZChoLCBiKTsKICAgICAgICAgICAgICAgIHJldHVybiBOYShWYShoKS50b1N0cmluZygpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgemQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdWQoKTsKICAgICAgICAgICAgICAgIHZhciBiID0gdmQuZ29vZ2xlVG9rZW5bNV0gfHwgMDsKICAgICAgICAgICAgICAgIGEgJiYgKDAgIT0gYiB8fCB3ZFszXSA+PSB4ZCgpID8geWQuRmMoYSkgOiAoeWQuSmMoKS5wdXNoKGEpLCB5ZC5VYygpKSk7CiAgICAgICAgICAgICAgICB3ZFszXSA+PSB4ZCgpICYmIHdkWzJdID49IHhkKCkgfHwgeWQuVWMoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQmQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYSA9IF8uQWQoYS5zcGxpdCgvXHMrLyksIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChiID0gL14oLT9cZCspKHB4fCUpJC8uZXhlYyhiKSkgPyB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwYXJzZUZsb2F0KGJbMV0pLAogICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBiWzJdCiAgICAgICAgICAgICAgICAgICAgfSA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdweCcKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBhWzFdID0gYVsxXSB8fCBhWzBdOwogICAgICAgICAgICAgICAgYVsyXSA9IGFbMl0gfHwgYVswXTsKICAgICAgICAgICAgICAgIGFbM10gPSBhWzNdIHx8IGFbMV07CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRGQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKCFhKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBbMF07CiAgICAgICAgICAgICAgICBhID0gJ251bWJlcicgPT09IHR5cGVvZiBhID8gW2FdIDogYTsKICAgICAgICAgICAgICAgIGEgPSBfLkNkKGEsIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09PSB0eXBlb2YgYiAmJiAwIDw9IGIgJiYgMSA+PSBiID8gITAgOiAhMTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgbWEoYSk7CiAgICAgICAgICAgICAgICBvYShhLCBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiIC0gYzsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEZkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGIgPyB7CiAgICAgICAgICAgICAgICAgICAgdG9wOiBiLnRvcCwKICAgICAgICAgICAgICAgICAgICByaWdodDogYi5yaWdodCwKICAgICAgICAgICAgICAgICAgICBib3R0b206IGIuYm90dG9tLAogICAgICAgICAgICAgICAgICAgIGxlZnQ6IGIubGVmdCwKICAgICAgICAgICAgICAgICAgICB3aWR0aDogYi53aWR0aCB8fCBiLnJpZ2h0IC0gYi5sZWZ0LAogICAgICAgICAgICAgICAgICAgIGhlaWdodDogYi5oZWlnaHQgfHwgYi5ib3R0b20gLSBiLnRvcAogICAgICAgICAgICAgICAgfSA6IHsKICAgICAgICAgICAgICAgICAgICB0b3A6IDAsCiAgICAgICAgICAgICAgICAgICAgcmlnaHQ6IDAsCiAgICAgICAgICAgICAgICAgICAgYm90dG9tOiAwLAogICAgICAgICAgICAgICAgICAgIGxlZnQ6IDAsCiAgICAgICAgICAgICAgICAgICAgd2lkdGg6IDAsCiAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiAwCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICBJZCA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICB2YXIgZSwgZiwgZywgaCwgaywgbCwgbSwgbiA9IG5ldyBHZCgpLCBxID0gJycsIHUgPSBmdW5jdGlvbiAoQikgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHggPSAnb2JqZWN0JyA9PT0gdHlwZW9mIEIuZGF0YSA/IEIuZGF0YSA6IEpTT04ucGFyc2UoQi5kYXRhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHEgPT09IHgucGF3X2lkICYmIChfLkxjKGEsICdtZXNzYWdlJywgdSksIHguZXJyb3IgPyBuLnJlamVjdChFcnJvcih4LmVycm9yKSkgOiBuLnJlc29sdmUoZCh4KSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh6KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgPT09IHR5cGVvZiAobnVsbCA9PT0gKGUgPSBhLmdtYVNkaykgfHwgdm9pZCAwID09PSBlID8gdm9pZCAwIDogZS5nZXRRdWVyeUluZm8pID8gKF8uZmIoYSwgJ21lc3NhZ2UnLCB1KSwgcSA9IGMoYS5nbWFTZGspLCBuLnByb21pc2UpIDogJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIChudWxsID09PSAoaCA9IG51bGwgPT09IChnID0gbnVsbCA9PT0gKGYgPSBhLndlYmtpdCkgfHwgdm9pZCAwID09PSBmID8gdm9pZCAwIDogZi5tZXNzYWdlSGFuZGxlcnMpIHx8IHZvaWQgMCA9PT0gZyA/IHZvaWQgMCA6IGcuZ2V0R21hUXVlcnlJbmZvKSB8fCB2b2lkIDAgPT09IGggPyB2b2lkIDAgOiBoLnBvc3RNZXNzYWdlKSB8fCAnZnVuY3Rpb24nID09PSB0eXBlb2YgKG51bGwgPT09IChtID0gbnVsbCA9PT0gKGwgPSBudWxsID09PSAoayA9IGEud2Via2l0KSB8fCB2b2lkIDAgPT09IGsgPyB2b2lkIDAgOiBrLm1lc3NhZ2VIYW5kbGVycykgfHwgdm9pZCAwID09PSBsID8gdm9pZCAwIDogbC5nZXRHbWFTaWcpIHx8IHZvaWQgMCA9PT0gbSA/IHZvaWQgMCA6IG0ucG9zdE1lc3NhZ2UpID8gKHEgPSBTdHJpbmcoTWF0aC5mbG9vcigyMTQ3NDgzNjQ3ICogSGQoKSkpLCBfLmZiKGEsICdtZXNzYWdlJywgdSksIGIoYS53ZWJraXQubWVzc2FnZUhhbmRsZXJzLCBxKSwgbi5wcm9taXNlKSA6IG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEpkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBJZChhLCBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIChudWxsICE9PSAoZCA9IGIuZ2V0R21hUXVlcnlJbmZvKSAmJiB2b2lkIDAgIT09IGQgPyBkIDogYi5nZXRHbWFTaWcpLnBvc3RNZXNzYWdlKGMpOwogICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi5nZXRRdWVyeUluZm8oKTsKICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIuc2lnbmFsOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEtkID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEuc2V0QXR0cmlidXRlKCdkYXRhLWdvb2dsZS1xdWVyeS1pZCcsIGMpLCAhZCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSwgZjsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gKGUgPSBiLmdvb2dsZXRhZykgJiYgdm9pZCAwICE9PSBlID8gZSA6IGIuZ29vZ2xldGFnID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gbnVsbCAhPT0gKGYgPSBiLmdvb2dsZXRhZy5xdWVyeUlkcykgJiYgdm9pZCAwICE9PSBmID8gZiA6IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBnLnB1c2goYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIDUwMCA8IGcubGVuZ3RoICYmIGcuc2hpZnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5nb29nbGV0YWcucXVlcnlJZHMgPSBnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGgpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgTWQgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/IG51bGwgOiBjOwogICAgICAgICAgICAgICAgYiA9IF8ueShiKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSBiLm5leHQoKTsgIWQuZG9uZTsgZCA9IGIubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhLCBmID0gZC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICBkID0gYzsKICAgICAgICAgICAgICAgICAgICBkID0gdm9pZCAwID09PSBkID8gbnVsbCA6IGQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBlLmRvY3VtZW50OwogICAgICAgICAgICAgICAgICAgIHZhciBoID0gZi54LCBrID0gZi55OwogICAgICAgICAgICAgICAgICAgIGcuaGFzT3duUHJvcGVydHkoJ19nb29nX2VmcF9jYWxsZWRfJykgfHwgKGcuX2dvb2dfZWZwX2NhbGxlZF8gPSBnLmVsZW1lbnRGcm9tUG9pbnQoaCwgaykpOwogICAgICAgICAgICAgICAgICAgIGlmIChnID0gZy5lbGVtZW50RnJvbVBvaW50KGgsIGspKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGggPSBMZChnLCBlLCBmLCBkKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/IG51bGwgOiBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBlLmRvY3VtZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZyA9IGcub2Zmc2V0UGFyZW50OyBnICYmIGcgIT0gaC5ib2R5OyBnID0gZy5vZmZzZXRQYXJlbnQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChrID0gTGQoZywgZSwgZiwgZCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBkID0gaCB8fCBudWxsOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBkID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZiAoZCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTGQgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/IG51bGwgOiBkOwogICAgICAgICAgICAgICAgaWYgKCdmaXhlZCcgIT09IE5kKGEsICdwb3NpdGlvbicpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgdmFyIGUgPSAnR29vZ2xlQWN0aXZlVmlld0lubmVyQ29udGFpbmVyJyA9PSBhLmdldEF0dHJpYnV0ZSgnY2xhc3MnKSB8fCAxID49IF8uT2QoXy5QZCwgYSkud2lkdGggJiYgMSA+PSBfLk9kKF8uUGQsIGEpLmhlaWdodCA/ICEwIDogITE7CiAgICAgICAgICAgICAgICBkICYmIGQuaignYWNoX2V2dCcsIHsKICAgICAgICAgICAgICAgICAgICB1cmw6IGIubG9jYXRpb24uaHJlZiwKICAgICAgICAgICAgICAgICAgICB0bjogYS50YWdOYW1lLAogICAgICAgICAgICAgICAgICAgIGlkOiBhLmdldEF0dHJpYnV0ZSgnaWQnKSwKICAgICAgICAgICAgICAgICAgICBjbHM6IGEuZ2V0QXR0cmlidXRlKCdjbGFzcycpLAogICAgICAgICAgICAgICAgICAgIGlnbjogZSwKICAgICAgICAgICAgICAgICAgICBwdzogYi5pbm5lcldpZHRoLAogICAgICAgICAgICAgICAgICAgIHBoOiBiLmlubmVySGVpZ2h0LAogICAgICAgICAgICAgICAgICAgIHg6IGMueCwKICAgICAgICAgICAgICAgICAgICB5OiBjLnkKICAgICAgICAgICAgICAgIH0sIDEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGUgPyBudWxsIDogYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgUWQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IFtdIDogYjsKICAgICAgICAgICAgICAgIHZhciBjID0gRGF0ZS5ub3coKTsKICAgICAgICAgICAgICAgIHJldHVybiBfLkNkKGIsIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgLSBkIDwgMTAwMCAqIGE7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgU2QgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEuZ2V0SXRlbSgnX19sc3ZfXycpOwogICAgICAgICAgICAgICAgICAgIGlmICghYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtdOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gSlNPTi5wYXJzZShjKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICghQXJyYXkuaXNBcnJheShkKSB8fCBfLlJkKGQsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIV8udChOdW1iZXIsICdpc0ludGVnZXInKS5jYWxsKE51bWJlciwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5yZW1vdmVJdGVtKCdfX2xzdl9fJyksIFtdOwogICAgICAgICAgICAgICAgICAgIGQgPSBRZChiLCBkKTsKICAgICAgICAgICAgICAgICAgICBkLmxlbmd0aCB8fCBudWxsID09IGEgfHwgYS5yZW1vdmVJdGVtKCdfX2xzdl9fJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFRkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIDAuMDAxID4gSGQoKSAmJiBCYyh7CiAgICAgICAgICAgICAgICAgICAgYzogYSwKICAgICAgICAgICAgICAgICAgICBzOiBiCiAgICAgICAgICAgICAgICB9LCAnZ3B0X3doaXJzJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFVkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnbnVtYmVyJyA9PT0gdHlwZW9mIGEgfHwgJ3N0cmluZycgPT09IHR5cGVvZiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICBWZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKGEpIHsKICAgICAgICAgICAgICAgIGNhc2Ugdm9pZCAwOgogICAgICAgICAgICAgICAgY2FzZSBudWxsOgogICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdVbmV4cGVjdGVkIGVuY3J5cHRpb24gbW9kZTogJyArIGEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBYZCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gV2QgOiBjOwogICAgICAgICAgICAgICAgYS5nb29nX3Nkcl9sIHx8IChPYmplY3QuZGVmaW5lUHJvcGVydHkoYSwgJ2dvb2dfc2RyX2wnLCB7IHZhbHVlOiAhMCB9KSwgJ2NvbXBsZXRlJyA9PT0gYS5kb2N1bWVudC5yZWFkeVN0YXRlID8gYyhhLCBiKSA6IF8uZmIoYSwgJ2xvYWQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgYyhhLCBiKTsKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWWQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIsIGM7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAobnVsbCAhPT0gKGMgPSBudWxsID09PSAoYiA9IGEudG9wKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLmZyYW1lcykgJiYgdm9pZCAwICE9PSBjID8gYyA6IHt9KS5nb29nbGVfYWRzX3RvcF9mcmFtZTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICAkZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IFJlZ0V4cCgnXmh0dHBzPzovL1teLyM/XSsvPyQnKTsKICAgICAgICAgICAgICAgIHJldHVybiAhIWEgJiYgIWIudGVzdChhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYWUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKGEgPT09IGEudG9wIHx8IGJjKGEudG9wKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdi5Qcm9taXNlLnJlc29sdmUoeyBzdGF0dXM6IDQgfSk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IFlkKGEpOwogICAgICAgICAgICAgICAgaWYgKCFiKQogICAgICAgICAgICAgICAgICAgIHJldHVybiB2LlByb21pc2UucmVzb2x2ZSh7IHN0YXR1czogMiB9KTsKICAgICAgICAgICAgICAgIGlmIChhLnBhcmVudCA9PT0gYS50b3AgJiYgJGQoYS5kb2N1bWVudC5yZWZlcnJlcikpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuUHJvbWlzZS5yZXNvbHZlKHsgc3RhdHVzOiAzIH0pOwogICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgR2QoKTsKICAgICAgICAgICAgICAgIGEgPSBuZXcgTWVzc2FnZUNoYW5uZWwoKTsKICAgICAgICAgICAgICAgIGEucG9ydDEub25tZXNzYWdlID0gZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICAnX19nb29nX3RvcF91cmxfcmVzcCcgPT09IGQuZGF0YS5tc2dUeXBlICYmIGMucmVzb2x2ZSh7CiAgICAgICAgICAgICAgICAgICAgICAgIG5iOiBkLmRhdGEudG9wVXJsLAogICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXM6IGQuZGF0YS50b3BVcmwgPyAwIDogMQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucG9zdE1lc3NhZ2UoeyBtc2dUeXBlOiAnX19nb29nX3RvcF91cmxfcmVxJyB9LCAnKicsIFthLnBvcnQyXSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYy5wcm9taXNlOwogICAgICAgICAgICB9OwogICAgICAgICAgICBiZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9ICcnOwogICAgICAgICAgICAgICAgYWMoZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZDsKICAgICAgICAgICAgICAgICAgICBpZiAoYyA9PT0gYy50b3ApCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gKGQgPSBjLmRvY3VtZW50KSB8fCB2b2lkIDAgPT09IGQgPyAwIDogZC5yZWZlcnJlcikKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGMuZG9jdW1lbnQucmVmZXJyZXI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfSwgITEsICExLCBhKTsKICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBjZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYjsKICAgICAgICAgICAgICAgIGlmIChhID0gbnVsbCA9PT0gKGIgPSBhLm5hdmlnYXRvcikgfHwgdm9pZCAwID09PSBiID8gdm9pZCAwIDogYi51c2VyQWN0aXZhdGlvbikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gMDsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gYSB8fCB2b2lkIDAgPT09IGEgPyAwIDogYS5oYXNCZWVuQWN0aXZlKQogICAgICAgICAgICAgICAgICAgICAgICBjIHw9IDE7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGEgfHwgdm9pZCAwID09PSBhID8gMCA6IGEuaXNBY3RpdmUpCiAgICAgICAgICAgICAgICAgICAgICAgIGMgfD0gMjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgZWUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKCFkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnZ2F0Yzpob3N0OnNjcmlwdCcpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKICAgICAgICAgICAgICAgICAgICBjLmlkID0gJ2dhdGM6aG9zdDpzY3JpcHQnOwogICAgICAgICAgICAgICAgICAgIGJiKGMsIGEuY2QuSWQpOwogICAgICAgICAgICAgICAgICAgIGEuS2MuYXBwZW5kQ2hpbGQoYyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBhID0gd2luZG93LmdhdGNfaG9zdDsKICAgICAgICAgICAgICAgIGRlKGEpID8gYihhKSA6IEFycmF5LmlzQXJyYXkoYSkgJiYgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGEucHVzaCA/IGEucHVzaChiKSA6IHdpbmRvdy5nYXRjX2hvc3QgPSBbYl07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGtlID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gZmU7CiAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gZ2UgOiBiOwogICAgICAgICAgICAgICAgdmFyIGQgPSBmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PT0gdHlwZW9mIGYgJiYgKGYgPSBjLmooZiksIGEoZikpOwogICAgICAgICAgICAgICAgICAgIH0sIGUgPSBuZXcgaGUoKTsKICAgICAgICAgICAgICAgIGVlKGIsIGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGRlKGYpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gbmV3IGllKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIFFiKGcsIDEsIGMubSwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGYub3BlbkNvbnNvbGVUYWIoZy5YKCksIGQsIGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlLmogaW5zdGFuY2VvZiBNZXNzYWdlUG9ydCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IGUuajsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmogPSBoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBfLnkoamUoaykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoayA9IGgubmV4dCgpOyAhay5kb25lOyBrID0gaC5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc2VuZChrLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbWUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgKDAsIEYuamIpKCFsZS5oYXMoYSkpOwogICAgICAgICAgICAgICAgbGUuc2V0KGEsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBuZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChhID0gXy5yLmdvb2dsZXRhZykgJiYgdm9pZCAwICE9PSBhID8gYSA6IF8uci5nb29nbGV0YWcgPSB7fTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgb2UgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBuZSgpOwogICAgICAgICAgICAgICAgYy5oYXNPd25Qcm9wZXJ0eShhKSB8fCAoY1thXSA9IGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBxZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYjsKICAgICAgICAgICAgICAgIGEgPSBwZVthXTsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSAoYiA9IG5lKClbYV0oKSkgJiYgdm9pZCAwICE9PSBiID8gYiA6IG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIERlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IHJlKCk7CiAgICAgICAgICAgICAgICBpZiAoc2UoYSkpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRlKGIsIDEsIHVlLCBhKSwgYjsKICAgICAgICAgICAgICAgIGlmICh2ZShhKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGUoYiwgMiwgdWUsIGEpLCBiOwogICAgICAgICAgICAgICAgaWYgKHdlKGEpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ZShiLCAzLCB1ZSwgYSksIGI7CiAgICAgICAgICAgICAgICBpZiAoeGUoYSkpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRlKGIsIDQsIHVlLCAyKSwgYjsKICAgICAgICAgICAgICAgIGlmICh5ZShhKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGUoYiwgNCwgdWUsIDEpLCBiOwogICAgICAgICAgICAgICAgaWYgKHplKGEpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ZShiLCA3LCB1ZSwgYS50b1N0cmluZygpKSwgYjsKICAgICAgICAgICAgICAgIGlmIChBZShhKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IEJlKCk7CiAgICAgICAgICAgICAgICAgICAgQ2UoYywgYS5tYXAoZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKGgpOwogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICBFZShiLCA1LCB1ZSwgYyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjID0gbmV3IEZlKCk7CiAgICAgICAgICAgICAgICB2YXIgZCA9IEdlKGMpLCBlID0gITE7CiAgICAgICAgICAgICAgICBpZiAoYSA9PT0gbmUoKSkKICAgICAgICAgICAgICAgICAgICB3KGMsIDIsIDEpLCBlID0gITA7CiAgICAgICAgICAgICAgICBlbHNlIGlmICh2b2lkIDAgIT09IGEuY29uc3RydWN0b3IgJiYgbGUuaGFzKGEuY29uc3RydWN0b3IpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSAoMCwgRi5IKShsZS5nZXQoYS5jb25zdHJ1Y3RvcikpOwogICAgICAgICAgICAgICAgICAgIHcoYywgMiwgZik7CiAgICAgICAgICAgICAgICAgICAgZSA9ICEwOwogICAgICAgICAgICAgICAgICAgIDggPT09IGYgPyAoZiA9IGEuZ2V0U2xvdElkKCkuZ2V0RG9tSWQoKSwgSGUoYywgSWUobmV3IEplKCksIEtlLk8oKS5tW2ZdKSkpIDogNyA9PT0gZiAmJiAoZiA9IEtlLk8oKS5qLCBIZShjLCBPZShmKSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYSA9IF8ueShfLnQoT2JqZWN0LCAnZW50cmllcycpLmNhbGwoT2JqZWN0LCBhKSk7CiAgICAgICAgICAgICAgICBmb3IgKGYgPSBhLm5leHQoKTsgIWYuZG9uZTsgZiA9IGEubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBfLnkoZi52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IGcubmV4dCgpLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIGcgPSBnLm5leHQoKS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICBlICYmIHplKGcpIHx8IGQuc2V0KGYsIERlKGcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIEVlKGIsIDYsIHVlLCBjKTsKICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBQZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGEuc3BsaXQoJy8nKTsKICAgICAgICAgICAgICAgIHJldHVybiAnLycgPT09IGEuY2hhckF0KDApICYmIDIgPD0gYi5sZW5ndGggPyBiWzFdIDogJy8nICE9PSBhLmNoYXJBdCgwKSAmJiAxIDw9IGIubGVuZ3RoID8gYlswXSA6ICcnOwogICAgICAgICAgICB9OwogICAgICAgICAgICBTZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBpZiAoMTUzNjAgPj0gYS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGE7CiAgICAgICAgICAgICAgICAxNTM2MCA8IGIubGVuZ3RoICYmIChiID0gYi5zdWJzdHJpbmcoMCwgMTUzNTIpLCBiID0gYi5yZXBsYWNlKC8lXHc/JC8sICcnKSwgYiA9IGIucmVwbGFjZSgvJltePV0qPT8kLywgJycpLCBiICs9ICcmdHJ1bmM9MScpOwogICAgICAgICAgICAgICAgUWUoUmUuTygpLCA5IC50b1N0cmluZygpLCA5LCBhLmxlbmd0aCAtIGIubGVuZ3RoICsgOCk7CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgVGUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBhLmluZGV4T2YoJ2dvb2dsZV9wcmV2aWV3PScsIGEubGFzdEluZGV4T2YoJz8nKSksIGMgPSBhLmluZGV4T2YoJyYnLCBiKTsKICAgICAgICAgICAgICAgIC0xID09PSBjICYmIChjID0gYS5sZW5ndGggLSAxLCAtLWIpOwogICAgICAgICAgICAgICAgcmV0dXJuIGEuc3Vic3RyaW5nKDAsIGIpICsgYS5zdWJzdHJpbmcoYyArIDEsIGEubGVuZ3RoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgVWUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IHdpbmRvdyA6IGI7CiAgICAgICAgICAgICAgICByZXR1cm4gYi5sb2NhdGlvbiA/IGIuVVJMU2VhcmNoUGFyYW1zID8gKGEgPSBuZXcgVVJMU2VhcmNoUGFyYW1zKGIubG9jYXRpb24uc2VhcmNoKS5nZXQoYSksIChudWxsID09PSBhIHx8IHZvaWQgMCA9PT0gYSA/IDAgOiBhLmxlbmd0aCkgPyBhIDogbnVsbCkgOiAoYSA9IG5ldyBSZWdFeHAoJ1s/Jl0nICsgYSArICc9KFteJl0qKScpLmV4ZWMoYi5sb2NhdGlvbi5zZWFyY2gpKSA/IGRlY29kZVVSSUNvbXBvbmVudChhWzFdKSA6IG51bGwgOiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICBWZSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gd2luZG93IDogYjsKICAgICAgICAgICAgICAgIHJldHVybiAhIVVlKGEsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBYZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBXZSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBXZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gWWUsIGIgPSBOdW1iZXIoYSk7CiAgICAgICAgICAgICAgICByZXR1cm4gMSA+IGIgfHwgTWF0aC5mbG9vcihiKSAhPT0gYiA/IChCYyh7IHY6IGEgfSwgJ2dwdF9pbnZfdmVyJyksICcxJykgOiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICAkZSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBhID0geyBtZXRob2RJZDogYSB9OwogICAgICAgICAgICAgICAgYi5uYW1lICYmIChhLm5hbWUgPSBiLm5hbWUpOwogICAgICAgICAgICAgICAgYi5tZXNzYWdlICYmIChhLm1lc3NhZ2UgPSBiLm1lc3NhZ2Uuc3Vic3RyaW5nKDAsIDUxMikpOwogICAgICAgICAgICAgICAgYi5maWxlTmFtZSAmJiAoYS5maWxlTmFtZSA9IGIuZmlsZU5hbWUpOwogICAgICAgICAgICAgICAgYi5saW5lTnVtYmVyICYmIChhLmxpbmVOdW1iZXIgPSBiLmxpbmVOdW1iZXIpOwogICAgICAgICAgICAgICAgYi5zdGFjayAmJiAoYS5zdGFjayA9IFplKGIuc3RhY2ssICcnKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZ2YgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSB2b2lkIDAgPT09IGMgPyBhZiA6IGM7CiAgICAgICAgICAgICAgICBpZiAoIWIuaXNSZXBvcnRlZCkKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBiLmlzUmVwb3J0ZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdfX3Rocm93X2Zvcl90ZXN0aW5nJyA9PT0gYi5uYW1lICYmIF8uYmZbMTQ4XSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCd0aHJvd2luZyBlcnJvciBmb3IgdGVzdGluZycpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9ICRlKGEsIGIpLCBlID0gbmV3IGNmKCdncHRfZXhjZXB0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZikgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF8uZWYoZCwgZnVuY3Rpb24gKGYsIGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkoZSwgZywgZik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBmZihlLCBjKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChmKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBLID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGMgPSB2b2lkIDAgPT09IGMgPyAhMSA6IGM7CiAgICAgICAgICAgICAgICB2YXIgZCA9IHZvaWQgMCA9PT0gZCA/IGhmIDogZDsKICAgICAgICAgICAgICAgIF8uYmZbMTQ4XSAmJiAoamYgfHwgKGpmID0gbmV3IGtmKCksIGpmLmluaXRpYWxpemUoKSksIGIgPSBsZihhLCBiKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gXy5tZihhLCBiLCBjLCBfLkgobmYpLCBkKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcGYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKDAuMSA+IE1hdGgucmFuZG9tKCkpCiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBFcnJvcigpOwogICAgICAgICAgICAgICAgICAgICAgICBvZignZ3B0X2FwaV91c2FnZScsIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKGQsICdtZXRob2RJZCcsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgSShkLCAnYXJncycsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5zdGFjayAmJiBJKGQsICdzdGFjaycsIFplKGMuc3RhY2ssIGMubWVzc2FnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGYoZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsgcGE6IDEgfSk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5tZiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gITEgOiBjOwogICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/ICExIDogZDsKICAgICAgICAgICAgICAgIGUgPSB2b2lkIDAgPT09IGUgPyBoZiA6IGU7CiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBmID0gZ2MuYXBwbHkoMCwgYXJndW1lbnRzKSwgZyA9IHZvaWQgMCwgaCA9ICExLCBrID0gbnVsbCwgbCA9IFJlLk8oKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IF8uSChxZik7CiAgICAgICAgICAgICAgICAgICAgICAgIG0gJiYgbCAmJiAoayA9IGwuc3RhcnQoYS50b1N0cmluZygpLCAzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBiLmFwcGx5KHRoaXMsIGYpOwogICAgICAgICAgICAgICAgICAgICAgICBoID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIG0gJiYgbCAmJiBsLmVuZChrKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZi5jYWxsKHRoaXMsIDExMCwgbiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChyZi5jYWxsKHRoaXMsIGEsIG4sIGUpLCAhYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoayAmJiBzZiAmJiB0ZigpICYmIChzZi5jbGVhck1hcmtzKCdnb29nXycgKyBrLmxhYmVsICsgJ18nICsgay51bmlxdWVJZCArICdfc3RhcnQnKSwgc2YuY2xlYXJNYXJrcygnZ29vZ18nICsgay5sYWJlbCArICdfJyArIGsudW5pcXVlSWQgKyAnX2VuZCcpKSwgIWggJiYgIWMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBkICYmIHBmLmNhbGwodGhpcywgYSwgZi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBnOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy51ZiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZCA9IHZvaWQgMCA9PT0gZCA/IGhmIDogZDsKICAgICAgICAgICAgICAgIHJldHVybiBfLm1mKGEsIGIsIHZvaWQgMCA9PT0gYyA/ICExIDogYywgITEsIGQpKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHJmID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGMgPSB2b2lkIDAgPT09IGMgPyBoZiA6IGM7CiAgICAgICAgICAgICAgICBiID0gYi5lcnJvciAmJiBiLm1ldGEgJiYgYi5pZCA/IGIuZXJyb3IgOiBiOwogICAgICAgICAgICAgICAgaWYgKF8uSCh2ZikpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IGMoKSwgYy5xZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IG5ldyB3ZigpLCBlID0gbmV3IHhmKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IENjKHdpbmRvdyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBRYihlLCAxLCBmLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodSkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IERjKCkubSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeWYoZSwgMiwgZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgUWIoZSwgMywgd2luZG93LmRvY3VtZW50LlVSTCwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZiA9IHpmKGQsIDIsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICBnID0gbmV3IEFmKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBRYihnLCAxLCBhLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gc2UobnVsbCA9PT0gYiB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLm5hbWUpID8gYi5uYW1lIDogJ1Vua25vd24gZXJyb3InOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgUWIoYSwgMiwgaCwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBrID0gc2UobnVsbCA9PT0gYiB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLm1lc3NhZ2UpID8gYi5tZXNzYWdlIDogJ0NhdWdodCAnICsgYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFFiKGEsIDMsIGssICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodSkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IHNlKG51bGwgPT09IGIgfHwgdm9pZCAwID09PSBiID8gdm9pZCAwIDogYi5zdGFjaykgPyBiLnN0YWNrIDogRXJyb3IoKS5zdGFjazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgJiYgeWYoYSwgNCwgbC5zcGxpdCgvXG5ccyovKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBoID0gemYoZiwgMSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGsgPSBuZXcgQmYoKTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gV2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFFiKGssIDEsIG0sICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodSkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IENmKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBRYihrLCAyLCBuLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodSkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcSA9IFtdLmNvbmNhdChfLmxjKF8udChEZiwgJ2tleXMnKS5jYWxsKERmKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeWYoaywgMywgcSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBFZShoLCA0LCBFZiwgayk7CiAgICAgICAgICAgICAgICAgICAgICAgIFFiKGgsIDUsIGMuemQsIDApOwogICAgICAgICAgICAgICAgICAgICAgICBtYyhjLnNiLCBoKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICBnZi5jYWxsKHRoaXMsIGEsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBNZiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gbnVsbCA6IGM7CiAgICAgICAgICAgICAgICBiID0gKHZvaWQgMCA9PT0gYiA/IDAgOiBiKSA/IF8uemMoXy5GZikgfHwgMzYwMCA6IC0xOwogICAgICAgICAgICAgICAgdmFyIGQgPSAwOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBkIHw9IGEgIT0gYS50b3AgPyA1MTIgOiAwLCBkIHw9IGEubmF2aWdhdG9yICYmIC9BbmRyb2lkIDIvLnRlc3QoYS5uYXZpZ2F0b3IudXNlckFnZW50KSA/IDEwNDg1NzYgOiAwOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZykgewogICAgICAgICAgICAgICAgICAgIGQgfD0gMzI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjID0gYyA/IHRjKGMpIDogbnVsbDsKICAgICAgICAgICAgICAgIHZhciBlID0gMDsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgZSB8PSBHZihhLCAyNTAwKTsKICAgICAgICAgICAgICAgICAgICBpZiAoXy5IKEhmKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IF8uSWYoYSkuY2xpZW50SGVpZ2h0OwogICAgICAgICAgICAgICAgICAgICAgICBlIHw9IGYgPyAzMjAgPiBmID8gLTIxNDc0ODM2NDggOiAwIDogMTA3Mzc0MTgyNDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZSB8PSBKZihhKTsKICAgICAgICAgICAgICAgICAgICAwIDwgYiAmJiAhXy5LZihfLkxmKGMsIGIpKSAmJiAoZSB8PSAxMzQyMTc3MjgpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZykgewogICAgICAgICAgICAgICAgICAgIGUgfD0gMzI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gZCB8IGU7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFBmID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIGlmICg1ICE9PSBOZihiKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICB2YXIgZSA9IE1mKGMsICcyMjYzOTM4ODExNScgIT09IFBlKGEuZ2V0QWRVbml0UGF0aCgpKSwgZCk7CiAgICAgICAgICAgICAgICBlICYmIG9mKCdncHRfaW50X25zJywgZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICBJKGYsICduc3InLCBlKTsKICAgICAgICAgICAgICAgICAgICBkZihmKTsKICAgICAgICAgICAgICAgIH0sIHsgcGE6IF8uemMoT2YpIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuICEhZTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgUmYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICBhID0gXy50KGEsICdmaW5kJykuY2FsbChhLCBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgIGQgPSAoMCwgRi5IKShXYihkLCBRZiwgMSkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkLmdldFdpZHRoKCkgPD0gYi5nZXRXaWR0aCgpICYmIGQuZ2V0SGVpZ2h0KCkgPD0gYi5nZXRIZWlnaHQoKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChjID0gbnVsbCA9PT0gYSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBVYihhLCBRZiwgMikpICYmIHZvaWQgMCAhPT0gYyA/IGMgOiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICBWZiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJ251bWJlcicgPT09IHR5cGVvZiBiICYmICdudW1iZXInID09PSB0eXBlb2YgYyAmJiBVYihhLCBTZiwgNikubGVuZ3RoID8gUmYoVWIoYSwgU2YsIDYpLCBUZihVZihuZXcgUWYoKSwgYiksIGMpKSA6IFViKGEsIFFmLCA1KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWGYgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSB2b2lkIDAgPT09IGIgPyB3aW5kb3cgOiBiOwogICAgICAgICAgICAgICAgdmFyIGMgPSBudWxsOwogICAgICAgICAgICAgICAgYi50b3AgPT09IGIgJiYgKGIgPSBXZighMSwgYiksIGMgPSBWZihhLCBiLndpZHRoLCBiLmhlaWdodCkpOwogICAgICAgICAgICAgICAgbnVsbCAhPT0gYyAmJiB2b2lkIDAgIT09IGMgPyBjIDogYyA9IFZmKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gYyA/IFtdIDogYy5tYXAoZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRShkLCAzKSA/ICdmbHVpZCcgOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICgwLCBGLnZhKShkLmdldFdpZHRoKCkpLAogICAgICAgICAgICAgICAgICAgICAgICAoMCwgRi52YSkoZC5nZXRIZWlnaHQoKSkKICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFpmID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmICghWGYoYSkubGVuZ3RoICYmIFlmKGEsIDE2KSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJzF4MSc7CiAgICAgICAgICAgICAgICB2YXIgYiA9IFtdLCBjID0gITE7CiAgICAgICAgICAgICAgICBhID0gXy55KFhmKGEpKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSBhLm5leHQoKTsgIWQuZG9uZTsgZCA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgIGQgPSBkLnZhbHVlLCBBcnJheS5pc0FycmF5KGQpID8gYi5wdXNoKGQuam9pbigneCcpKSA6ICdmbHVpZCcgPT09IGQgPyBjID0gITAgOiBiLnB1c2goZCk7CiAgICAgICAgICAgICAgICBjICYmIGIudW5zaGlmdCgnMzIweDUwJyk7CiAgICAgICAgICAgICAgICByZXR1cm4gYi5qb2luKCd8Jyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgICRmID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAoTCA9IFhmKGEpLCBfLnQoTCwgJ2luY2x1ZGVzJykpLmNhbGwoTCwgJ2ZsdWlkJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGJnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBudWxsIDogYjsKICAgICAgICAgICAgICAgIHZhciBjID0gW107CiAgICAgICAgICAgICAgICBhICYmIChjLnB1c2goYS5nZXRBZFVuaXRQYXRoKCkpLCBjLnB1c2goWmYoYSkpLCBjLnB1c2goYS5nZXREb21JZCgpKSk7CiAgICAgICAgICAgICAgICBpZiAoYikgewogICAgICAgICAgICAgICAgICAgIGEgPSBbXTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gMDsgYiAmJiAyNSA+IGQ7IGIgPSBiLnBhcmVudE5vZGUsICsrZCkKICAgICAgICAgICAgICAgICAgICAgICAgOSA9PT0gYi5ub2RlVHlwZSA/IGEucHVzaCgnJykgOiBhLnB1c2goYi5pZCk7CiAgICAgICAgICAgICAgICAgICAgKGIgPSBhLmpvaW4oKSkgJiYgYy5wdXNoKGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGMubGVuZ3RoID8gYWcoYy5qb2luKCc6JykpLnRvU3RyaW5nKCkgOiAnMCc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGNnID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwICE9PSBhICYmIDEgIT09IGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGRnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjOwogICAgICAgICAgICAgICAgcmV0dXJuICEobnVsbCAhPT0gKGMgPSBFKGIsIDIyKSkgJiYgdm9pZCAwICE9PSBjID8gIWMgOiAhRShhLCAxNSkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBnZyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGEuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICByZXR1cm4gZmcoYSkgPyBiLlVSTCA6IGIucmVmZXJyZXI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGpnID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGhnKGEsIHdpbmRvdy50b3ApOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgXy5pZygtMTIyNDU5MzMsIC0xMjI0NTkzMyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGxnID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgaWYgKCFhKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgYSA9IGtnKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChiID0gbnVsbCA9PT0gYSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBhLmZsb29yKCkpICYmIHZvaWQgMCAhPT0gYiA/IGIgOiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICBvZyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0ge30sIGQgPSBfLnkoXy50KE9iamVjdCwgJ2tleXMnKS5jYWxsKE9iamVjdCwgYikpLCBlID0gZC5uZXh0KCk7ICFlLmRvbmU7IGUgPSBkLm5leHQoKSkgewogICAgICAgICAgICAgICAgICAgIGUgPSBlLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIHZhciBmID0gTGIoYltlXSksIGcgPSBtZy5PKCksIGggPSBnLmouZ2V0KGUpOwogICAgICAgICAgICAgICAgICAgIG51bGwgPT0gaCA/IGggPSArK1JlLk8oKS5tIDogZy5qLmRlbGV0ZShlKTsKICAgICAgICAgICAgICAgICAgICB3KGYsIDIwLCBoKTsKICAgICAgICAgICAgICAgICAgICBjW2VdID0gZjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGEgPSBMYihhKTsKICAgICAgICAgICAgICAgIGIgPSBuZXcgRGF0ZShEYXRlLm5vdygpKTsKICAgICAgICAgICAgICAgIGIgPSBiLmdldFVUQ0Z1bGxZZWFyKCkgKyBuZyhiLmdldFVUQ01vbnRoKCkgKyAxKSArIG5nKGIuZ2V0VVRDRGF0ZSgpKTsKICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgVTogYSwKICAgICAgICAgICAgICAgICAgICBQOiBjLAogICAgICAgICAgICAgICAgICAgIFJiOiBiCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICBwZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhLCBiLCBjOwogICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT09IHR5cGVvZiAobnVsbCA9PT0gKGEgPSB3aW5kb3cuY3J5cHRvKSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBhLmdldFJhbmRvbVZhbHVlcykpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IG5ldyBVaW50OEFycmF5KDE2KTsKICAgICAgICAgICAgICAgICAgICBudWxsID09PSAoYiA9IHdpbmRvdy5jcnlwdG8pIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuZ2V0UmFuZG9tVmFsdWVzKGQpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZCA9IHdpbmRvdzsKICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09PSB0eXBlb2YgKG51bGwgPT09IChjID0gZC5tc0NyeXB0bykgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5nZXRSYW5kb21WYWx1ZXMpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZXcgVWludDhBcnJheSgxNik7CiAgICAgICAgICAgICAgICAgICAgZC5tc0NyeXB0by5nZXRSYW5kb21WYWx1ZXMoZSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkID0gQXJyYXkoMTYpOwogICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IGQubGVuZ3RoOyBlKyspCiAgICAgICAgICAgICAgICAgICAgZFtlXSA9IE1hdGguZmxvb3IoMjU1ICogTWF0aC5yYW5kb20oKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgc2cgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIHFnKGEsIGIpIHx8IHJnKGEsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB4ZyA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICB2YXIgZSwgZiwgZyA9IHNnKGIsIGEpOwogICAgICAgICAgICAgICAgaWYgKCFnKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgdmFyIGggPSBqZyhnKSwgayA9IGcgPT09IHJnKGIsIGEpLCBsID0gdGcoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcSA9IGsgPyByZyhiLCBhKSA6IGc7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxICYmIHVnKHEsIHdpbmRvdyk7CiAgICAgICAgICAgICAgICAgICAgfSksIG0gPSBmdW5jdGlvbiAocSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT09ICh1ID0gbCgpKSB8fCB2b2lkIDAgPT09IHUgPyB2b2lkIDAgOiB1LmdldFByb3BlcnR5VmFsdWUocSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMgPSBYZihjKVswXTsKICAgICAgICAgICAgICAgIHZhciBuID0gITE7CiAgICAgICAgICAgICAgICBBcnJheS5pc0FycmF5KGMpICYmIChuID0gZCA/IGsgOiAwID09PSBoLnggJiYgJ2NlbnRlcicgPT09IG0oJ3RleHQtYWxpZ24nKSk7CiAgICAgICAgICAgICAgICBuICYmIChoLnggKz0gTWF0aC5yb3VuZChNYXRoLm1heCgwLCAoayA/IGcuY2xpZW50V2lkdGggOiBnLnBhcmVudEVsZW1lbnQuY2xpZW50V2lkdGgpIC0gTnVtYmVyKGNbMF0pKSAvIDIpKTsKICAgICAgICAgICAgICAgIGsgJiYgKGgueSArPSBNYXRoLnJvdW5kKE1hdGgubWluKG51bGwgIT09IChlID0gdmcobSgncGFkZGluZy10b3AnKSkpICYmIHZvaWQgMCAhPT0gZSA/IGUgOiAwLCBnLmNsaWVudEhlaWdodCkpLCBuIHx8IChkID0gZy5jbGllbnRXaWR0aCwgaC54ICs9IE1hdGgucm91bmQoTWF0aC5taW4obnVsbCAhPT0gKGYgPSB2ZyhtKCdwYWRkaW5nLWxlZnQnKSkpICYmIHZvaWQgMCAhPT0gZiA/IGYgOiAwLCBkKSkpKTsKICAgICAgICAgICAgICAgIHJldHVybiBoICYmIHdnKGcpID8gaCA6IG5ldyBfLmlnKC0xMjI0NTkzMywgLTEyMjQ1OTMzKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgeWcgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgdmFyIGUgPSByZyhhLCBjKSwgZiA9ICdub25lJyA9PT0gKG51bGwgPT09IGUgfHwgdm9pZCAwID09PSBlID8gdm9pZCAwIDogZS5zdHlsZS5kaXNwbGF5KTsKICAgICAgICAgICAgICAgIGYgJiYgKGUuc3R5bGUuZGlzcGxheSA9ICdibG9jaycpOwogICAgICAgICAgICAgICAgYSA9IHhnKGMsIGEsIGIsIGQpOwogICAgICAgICAgICAgICAgZiAmJiAoZS5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnKTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICB6ZyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJ2dvb2dsZV9hZHNfaWZyYW1lXycgKyBhLnRvU3RyaW5nKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEFnID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiB6ZyhhKSArICdfX2NvbnRhaW5lcl9fJzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcWcgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgYiA9IHJnKGEsIGIpOwogICAgICAgICAgICAgICAgcmV0dXJuIChudWxsID09PSBiIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIucXVlcnlTZWxlY3RvcignW2lkPSInICsgQWcoYSkgKyAnIl0nKSkgfHwgbnVsbDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQmcgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMsIGQ7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gKGQgPSBudWxsID09PSAoYyA9IHFnKGEsIGIpKSB8fCB2b2lkIDAgPT09IGMgPyB2b2lkIDAgOiBjLnF1ZXJ5U2VsZWN0b3IoJ2lmcmFtZVtpZD0iJyArIHpnKGEpICsgJyJdJykpICYmIHZvaWQgMCAhPT0gZCA/IGQgOiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICBFZyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gbmV3IENnKCksIGQgPSAwOyBkIDwgYS5sZW5ndGg7IGQrKykKICAgICAgICAgICAgICAgICAgICBjLnNldChhLmxlbmd0aCAtIGQgLSAxLCBiKGFbZF0pKTsKICAgICAgICAgICAgICAgIHJldHVybiBEZyhjKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRmcgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgdmFyIGUgPSAwOwogICAgICAgICAgICAgICAgZSA9IHZvaWQgMCA9PT0gZSA/ICcnIDogZTsKICAgICAgICAgICAgICAgIGMgPSB2b2lkIDAgPT09IGMgPyBmdW5jdGlvbiAobCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWw7CiAgICAgICAgICAgICAgICB9IDogYzsKICAgICAgICAgICAgICAgIGQgPSB2b2lkIDAgPT09IGQgPyAnLCcgOiBkOwogICAgICAgICAgICAgICAgdmFyIGYgPSBbXSwgZyA9ICExOwogICAgICAgICAgICAgICAgYSA9IF8ueShhKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGggPSBhLm5leHQoKTsgIWguZG9uZTsgaCA9IGEubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSAoaCA9IGIoaC52YWx1ZSkpID8gYyhoKSA6ICExOwogICAgICAgICAgICAgICAgICAgIGcgPSBnIHx8IGs7CiAgICAgICAgICAgICAgICAgICAgZi5wdXNoKFN0cmluZyhrID8gaCA6IGUpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBnID8gZi5qb2luKGQpIDogbnVsbDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgR2cgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSB3aW5kb3c7CiAgICAgICAgICAgICAgICBfLnVmKDgzMSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBjLCBkOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIChudWxsID09PSAoZCA9IG51bGwgPT09IChjID0gYi5wZXJmb3JtYW5jZSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5tYXJrKSB8fCB2b2lkIDAgPT09IGQgPyB2b2lkIDAgOiBkLmNhbGwoYywgYSkpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHJnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBkb2N1bWVudCA6IGI7CiAgICAgICAgICAgICAgICByZXR1cm4gS2UuTygpLkYuZ2V0KGEpIHx8IGIuZ2V0RWxlbWVudEJ5SWQoYS5nZXREb21JZCgpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgS2cgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIF8uYmZbMjYwXSA/IF8uSGcoSWcpLmwudGhlbihfLm1mKDg5NSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBKZyhhKTsKICAgICAgICAgICAgICAgIH0pKSA6IHYuUHJvbWlzZS5yZXNvbHZlKEpnKGEpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTGcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuICEhYSAmJiAhIUcoYSwgMSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE5nID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgPSAoYmMoYS50b3ApID8gYS50b3AgOiBhKS5BTVA7CiAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT09IHR5cGVvZiBhICYmICEhTWcoYSwgZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gIS9eaW5hYm94L2kudGVzdChjKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBQZyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHYuTWFwKFsKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdhcnAnLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBOZyhhKSA/IDEgOiBudWxsIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2FieGUnLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBiYyhhLnRvcCkgfHwgT2coYS5JbnRlcnNlY3Rpb25PYnNlcnZlcikgPyAxIDogbnVsbCB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFNnID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAoMCwgRi52YSkoUWcoYSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUmcoYSk7CiAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFVnID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUZyhhLCBbXS5jb25jYXQoXy5sYyhnYy5hcHBseSgwLCBhcmd1bWVudHMpKSkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgVmcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuICdbJyArIGEubWFwKGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09PSB0eXBlb2YgYiA/ICdcJycgKyBiICsgJ1wnJyA6IEFycmF5LmlzQXJyYXkoYikgPyBWZyhiKSA6IFN0cmluZyhiKTsKICAgICAgICAgICAgICAgIH0pLmpvaW4oJywgJykgKyAnXSc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFdnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGIgPSBWZyhiKTsKICAgICAgICAgICAgICAgIGIgPSBiLnN1YnN0cmluZygxLCBiLmxlbmd0aCAtIDEpOwogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUZyg5NiwgWwogICAgICAgICAgICAgICAgICAgIGEsCiAgICAgICAgICAgICAgICAgICAgYgogICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFpnID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBfLkgoWGcpICYmICdyZXdhcmRlZFNsb3RDYW5jZWxlZCcgPT09IGEgPyBudWxsIDogKEwgPSBfLnQoT2JqZWN0LCAndmFsdWVzJykuY2FsbChPYmplY3QsIFlnKSwgXy50KEwsICdmaW5kJykpLmNhbGwoTCwgZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiA9PT0gYTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBpaCA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT09IHR5cGVvZiBjIHx8ICRnKGMpKQogICAgICAgICAgICAgICAgICAgIE0oZSwgV2coJ1Nsb3Quc2V0VGFyZ2V0aW5nJywgWwogICAgICAgICAgICAgICAgICAgICAgICBjLAogICAgICAgICAgICAgICAgICAgICAgICBkCiAgICAgICAgICAgICAgICAgICAgXSksIGEpOwogICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBbXTsKICAgICAgICAgICAgICAgICAgICBBcnJheS5pc0FycmF5KGQpID8gZiA9IGQgOiBhaChkKSA/IGYgPSBfLnQoQXJyYXksICdmcm9tJykuY2FsbChBcnJheSwgZCkgOiBkICYmIChmID0gW2RdKTsKICAgICAgICAgICAgICAgICAgICBmID0gZi5tYXAoU3RyaW5nKTsKICAgICAgICAgICAgICAgICAgICAoZCA9IChMID0gYmgoYiksIF8udChMLCAnZmluZCcpKS5jYWxsKEwsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjaChnKSA9PT0gYzsKICAgICAgICAgICAgICAgICAgICB9KSkgPyBkaChkLCBmKSA6IChkID0gZGgoZWgobmV3IGZoKCksIGMpLCBmKSwgZ2goYiwgOSwgZmgsIGQpKTsKICAgICAgICAgICAgICAgICAgICBlLmluZm8oaGgoYywgZi5qb2luKCksICgwLCBGLkgpKGIuZ2V0QWRVbml0UGF0aCgpKSksIGEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBqaCA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBjICYmICdvYmplY3QnID09PSB0eXBlb2YgYykKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gXy55KF8udChPYmplY3QsICdrZXlzJykuY2FsbChPYmplY3QsIGMpKSwgZiA9IGUubmV4dCgpOyAhZi5kb25lOyBmID0gZS5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBmLnZhbHVlLCBpaChhLCBiLCBmLCBjW2ZdLCBkKTsKICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICBkLmVycm9yKFdnKCdTbG90LnVwZGF0ZVRhcmdldGluZ0Zyb21NYXAnLCBbY10pLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbWggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LmlzQXJyYXkoYSkgJiYgMiA9PT0gYS5sZW5ndGggPyBhLmV2ZXJ5KGxoKSA6ICdmbHVpZCcgPT09IGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIG5oID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5pc0FycmF5KGEpICYmIDIgPT09IGEubGVuZ3RoICYmIGxoKGFbMF0pICYmIGxoKGFbMV0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwaCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShhKSA/IFRmKFVmKG5ldyBRZigpLCAoMCwgRi52YSkoYVswXSkpLCAoMCwgRi52YSkoYVsxXSkpIDogb2goKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcmggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBbXTsKICAgICAgICAgICAgICAgIGlmIChxaChhKSkKICAgICAgICAgICAgICAgICAgICBiLnB1c2gocGgoKDAsIEYuSCkoYSkpKTsKICAgICAgICAgICAgICAgIGVsc2UgaWYgKEFycmF5LmlzQXJyYXkoYSkpIHsKICAgICAgICAgICAgICAgICAgICBhID0gXy55KGEpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBhLm5leHQoKTsgIWMuZG9uZTsgYyA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IGMudmFsdWUsIHFoKGMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5wdXNoKHBoKCgwLCBGLkgpKGMpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gWydmbHVpZCddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhaChjKSAmJiBhaChkKSAmJiBjLmxlbmd0aCA9PSBkLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYy5sZW5ndGgsIGYgPSByYSwgZyA9IDA7IGcgPCBlOyBnKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYoY1tnXSwgZFtnXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjICYmIGIucHVzaChvaCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHNoID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmICghQXJyYXkuaXNBcnJheShhKSB8fCAyICE9PSBhLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIHZhciBiID0gYVswXTsKICAgICAgICAgICAgICAgIGEgPSBhWzFdOwogICAgICAgICAgICAgICAgaWYgKCdudW1iZXInID09PSB0eXBlb2YgYiAmJiAwIDw9IGIpCiAgICAgICAgICAgICAgICAgICAgYiA9IE1hdGguZmxvb3IoYik7CiAgICAgICAgICAgICAgICBlbHNlIGlmIChudWxsICE9PSBiKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgaWYgKCdudW1iZXInID09PSB0eXBlb2YgYSAmJiAwIDw9IGEpCiAgICAgICAgICAgICAgICAgICAgYSA9IE1hdGguZmxvb3IoYSk7CiAgICAgICAgICAgICAgICBlbHNlIGlmIChudWxsICE9PSBhKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgcmV0dXJuIFRmKFVmKG5ldyBRZigpLCBiKSwgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHVoID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gdm9pZCAwID09PSBiID8gd2luZG93IDogYjsKICAgICAgICAgICAgICAgIHZhciBjLCBkOwogICAgICAgICAgICAgICAgaWYgKCFhKQogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGVjOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgRmE6IG51bGwKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoYSkgPyAwIDogQXJyYXkuaXNBcnJheShhLmZpeGVkKSB8fCAnZmx1aWQnID09PSBhLmZpeGVkIHx8IEFycmF5LmlzQXJyYXkoYS5tYXgpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSByaChhLmZpeGVkKSwgZjsKICAgICAgICAgICAgICAgICAgICBpZiAoZiA9IHNoKGEubWF4KSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGEubWluID8gc2goYS5taW4pIDogbmV3IFFmKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT0gKG51bGwgPT09IGcgfHwgdm9pZCAwID09PSBnID8gdm9pZCAwIDogZy5nZXRXaWR0aCgpKSAmJiAobnVsbCA9PT0gZyB8fCB2b2lkIDAgPT09IGcgPyB2b2lkIDAgOiBVZihnLCAwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT0gKG51bGwgPT09IGcgfHwgdm9pZCAwID09PSBnID8gdm9pZCAwIDogZy5nZXRIZWlnaHQoKSkgJiYgKG51bGwgPT09IGcgfHwgdm9pZCAwID09PSBnID8gdm9pZCAwIDogVGYoZywgMCkpOwogICAgICAgICAgICAgICAgICAgICAgICBmID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF4OiBmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbWluOiBnCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIGYgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXg6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaW46IG51bGwKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBnID0gZjsKICAgICAgICAgICAgICAgICAgICBmID0gZy5tYXg7CiAgICAgICAgICAgICAgICAgICAgZyA9IGcubWluOwogICAgICAgICAgICAgICAgICAgIHZhciBoOwogICAgICAgICAgICAgICAgICAgIGlmIChhLm1heCAmJiAhZikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0ludmFsaWQgR1BUIG1heGltdW0gc2l6ZTogJyArIEpTT04uc3RyaW5naWZ5KGEpKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5taW4gJiYgIWcpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdJbnZhbGlkIEdQVCBtaW5pbXVtIHNpemU6ICcgKyBKU09OLnN0cmluZ2lmeShhKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IChoID0gYS5maXhlZCkgJiYgdm9pZCAwICE9PSBoICYmIGgubGVuZ3RoIHx8IGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9ICgwLCBGLkgpKGYpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gYi5nZXRXaWR0aCgpIHx8IDAgPT09IGIuZ2V0SGVpZ2h0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignSW52YWxpZCBHUFQgc2l6ZSxcbiAgICAgICAgbWF4aW11bXMgY2Fubm90IGJlIHplcm86ICcgKyBKU09OLnN0cmluZ2lmeShhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gKDAsIEYuSCkoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IGguZ2V0V2lkdGgoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gYi5nZXRXaWR0aCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gayAmJiBudWxsICE9IGwgJiYgayA+IGwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0ludmFsaWQgR1BUIHNpemU6IG1pbmltdW0gd2lkdGggbGFyZ2VyIHRoYW4gbWF4aW11bSB3aWR0aDogJyArIEpTT04uc3RyaW5naWZ5KGEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBoLmdldEhlaWdodCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGIuZ2V0SGVpZ2h0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBoICYmIG51bGwgIT0gYiAmJiBoID4gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignIEludmFsaWQgR1BUIHNpemU6IG1pbmltdW0gaGVpZ2h0IGxhcmdlciB0aGFuIG1heGltdW0gaGVpZ2h0OiAnICsgSlNPTi5zdHJpbmdpZnkoYSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT09IChsID0gbnVsbCA9PT0gKGsgPSBiLmNvbnNvbGUpIHx8IHZvaWQgMCA9PT0gayA/IHZvaWQgMCA6IGsud2FybikgfHwgdm9pZCAwID09PSBsID8gdm9pZCAwIDogbC5jYWxsKGssICdJbnZhbGlkIEdQVCBmaXhlZCBzaXplIHNwZWNpZmljYXRpb246ICcgKyBKU09OLnN0cmluZ2lmeShhKSk7CiAgICAgICAgICAgICAgICAgICAgZiAmJiBnID8gKGEgPSBuZXcgdGgoKSwgYSA9IHpmKGEsIDEsIGYpLCBhID0gemYoYSwgMiwgZykpIDogYSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgZWM6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIEZhOiBhCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGEubGVuZ3RoIHx8IChudWxsID09PSAoZCA9IG51bGwgPT09IChjID0gYi5jb25zb2xlKSB8fCB2b2lkIDAgPT09IGMgPyB2b2lkIDAgOiBjLndhcm4pIHx8IHZvaWQgMCA9PT0gZCA/IHZvaWQgMCA6IGQuY2FsbChjLCAnSW52YWxpZCBHUFQgZml4ZWQgc2l6ZSBzcGVjaWZpY2F0aW9uOiAnICsgSlNPTi5zdHJpbmdpZnkoYSkpKTsKICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgZWM6IHJoKGEpLAogICAgICAgICAgICAgICAgICAgIEZhOiBudWxsCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICBxaCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShhKSAmJiAxIDwgYS5sZW5ndGggPyAnbnVtYmVyJyA9PT0gdHlwZW9mIGFbMF0gJiYgJ251bWJlcicgPT09IHR5cGVvZiBhWzFdIDogJ2ZsdWlkJyA9PT0gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgeGggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKCFBcnJheS5pc0FycmF5KGEpIHx8IDIgIT09IGEubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyB2aCgnRWFjaCBtYXBwaW5nIGVudHJ5IG11c3QgYmUgYW4gYXJyYXkgb2Ygc2l6ZSAyJyk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGFbMF07CiAgICAgICAgICAgICAgICBpZiAoIW5oKGIpKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyB2aCgnU2l6ZSBtdXN0IGJlIGFuIGFycmF5IG9mIHR3byBub24tbmVnYXRpdmUgaW50ZWdlcnMnKTsKICAgICAgICAgICAgICAgIGIgPSBUZihVZihuZXcgUWYoKSwgYlswXSksIGJbMV0pOwogICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoYVsxXSkgJiYgMCA9PT0gYVsxXS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgYSA9IFtdOwogICAgICAgICAgICAgICAgZWxzZSBpZiAoYSA9IHJoKGFbMV0pLCAwID09PSBhLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgdmgoJ0F0IGxlYXN0IG9uZSBzbG90IHNpemUgbXVzdCBiZSBwcmVzZW50Jyk7CiAgICAgICAgICAgICAgICB2YXIgYyA9IG5ldyBTZigpOwogICAgICAgICAgICAgICAgYiA9IHpmKGMsIDEsIGIpOwogICAgICAgICAgICAgICAgcmV0dXJuIHdoKGIsIDIsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB6aCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gUWcoYSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgeWgoYSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQWggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKDQgPT09IGEpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDExOwogICAgICAgICAgICAgICAgc3dpdGNoIChhKSB7CiAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDg7CiAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBJaCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gQWgoYSk7CiAgICAgICAgICAgICAgICBpZiAoIWEpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB2YXIgYiA9IDA7CiAgICAgICAgICAgICAgICBpZiAoMTEgIT09IGEpIHsKICAgICAgICAgICAgICAgICAgICBiIHw9IF8uciAhPSBfLnIudG9wID8gNTEyIDogMDsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IF8uQmgoXy5yKTsKICAgICAgICAgICAgICAgICAgICBjID0gMjYgIT09IGEgJiYgMjcgIT09IGEgJiYgNDAgIT09IGEgJiYgMTAgIT09IGEgJiYgYy5hZENvdW50ID8gMSA9PSBhIHx8IDIgPT0gYSA/ICEoIWMuYWRDb3VudFsxXSAmJiAhYy5hZENvdW50WzJdKSA6IChjID0gYy5hZENvdW50W2FdKSA/IDEgPD0gYyA6ICExIDogITE7CiAgICAgICAgICAgICAgICAgICAgYyAmJiAoYiB8PSA2NCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGIpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKDIgPT09IGEgfHwgMSA9PT0gYSkgewogICAgICAgICAgICAgICAgICAgIDAgPT09IENoKCkgJiYgKGIgfD0gNTM2ODcwOTEyKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgaGE6IF8uciwKICAgICAgICAgICAgICAgICAgICAgICAgVmQ6IERoCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBjID0gMDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGQuaGE7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgfD0gZSAhPSBlLnRvcCA/IDUxMiA6IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gZC5oYSwgZyA9IE1hdGgubWluKGYuc2NyZWVuLndpZHRoIHx8IDAsIGYuc2NyZWVuLmhlaWdodCB8fCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGMgfD0gZyA/IDMyMCA+IGcgPyA4MTkyIDogMCA6IDIwNDg7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZC5oYSwgazsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGsgPSBoLm5hdmlnYXRvcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBoLm5hdmlnYXRvci51c2VyQWdlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrID0gIV8uSChFaCkgJiYgL0ZpcmVmb3gvLnRlc3QobCkgfHwgL0FuZHJvaWQgMi8udGVzdChsKSB8fCAvaVBob25lIE9TIFszNF1fLy50ZXN0KGwpIHx8IC9XaW5kb3dzIFBob25lICg/Ok9TICk/WzY3XS8udGVzdChsKSB8fCAvTVNJRS4qV2luZG93cyBOVC8udGVzdChsKSB8fCAvV2luZG93cyBOVC4qVHJpZGVudC8udGVzdChsKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBjID0gZSB8IChrID8gMTA0ODU3NiA6IDApOwogICAgICAgICAgICAgICAgICAgICAgICBjID0gZC5ZZCA/IGMgfCAoZC5oYS5pbm5lckhlaWdodCA+PSBkLllkID8gMCA6IDEwMjQpIDogYyB8IChfLkZoKGQuaGEpID8gMCA6IDgpOwogICAgICAgICAgICAgICAgICAgICAgICBjIHw9IEdmKGQuaGEsIGQuVmQpOwogICAgICAgICAgICAgICAgICAgICAgICBjIHw9IEpmKGQuaGEpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgYyB8PSAzMjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChkLnVmKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICBoID0gZC5oYTsKICAgICAgICAgICAgICAgICAgICAgICAgayA9IGQuTmE7CiAgICAgICAgICAgICAgICAgICAgICAgIGsgPSB2b2lkIDAgPT09IGsgPyBudWxsIDogazsKICAgICAgICAgICAgICAgICAgICAgICAgbCA9IEdoKGguaW5uZXJXaWR0aCwgMCwgTWF0aC5taW4oTWF0aC5yb3VuZChoLmlubmVyV2lkdGggLyAzMjAgKiA1MCksIEhoKSArIDE1KTsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSBNZChoLCBsLCB2b2lkIDAgPT09IGsgPyBudWxsIDogaykgJiYgKGMgfD0gMTY3NzcyMTYpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSBkLmhhLCBrID0gZC5OYSwgayA9IHZvaWQgMCA9PT0gayA/IG51bGwgOiBrLCBsID0gaC5pbm5lcldpZHRoLCBlID0gaC5pbm5lckhlaWdodCwgZiA9IE1hdGgubWluKE1hdGgucm91bmQoaC5pbm5lcldpZHRoIC8gMzIwICogNTApLCBIaCkgKyAxNSwgZyA9IEdoKGwsIGUgLSBmLCBlKSwgMjUgPCBmICYmIGcucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4OiBsIC0gMjUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5OiBlIC0gMjUKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG51bGwgIT0gTWQoaCwgZywgdm9pZCAwID09PSBrID8gbnVsbCA6IGspICYmIChjIHw9IDE2Nzc3MjE2KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYiB8PSBjOwogICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgOCA9PT0gYSA/IGIgfD0gTWYoXy5yKSA6IDExICE9PSBhICYmIChiIHw9IDMyKTsKICAgICAgICAgICAgICAgIGIgfHwgKGMgPSBfLkJoKF8uciksIGMuYWRDb3VudCA9IGMuYWRDb3VudCB8fCB7fSwgYy5hZENvdW50W2FdID0gYy5hZENvdW50W2FdICsgMSB8fCAxKTsKICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBLaCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IG5ldyBSZWdFeHAoJyhefCx8LyknICsgYSArICcoJHwsfC8pJyk7CiAgICAgICAgICAgICAgICByZXR1cm4gW10uY29uY2F0KF8ubGMoXy5IZyhKaCkuY2EpKS5zb21lKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIudGVzdChQZShjLmdldEFkVW5pdFBhdGgoKSkpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFNoID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gTGgoKSwgYyA9IE1oKGEpLCBkID0gYy5zbG90SWQsIGUgPSBjLnVkOwogICAgICAgICAgICAgICAgYyA9IGMudmQ7CiAgICAgICAgICAgICAgICBpZiAoZCkgewogICAgICAgICAgICAgICAgICAgIGlmIChjID0gS2UuTygpLCAoYSA9IE5oKGMsIGQuZ2V0RG9tSWQoKSkpICYmICFFKGEsIDE5KSkKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgYy5GLnNldChkLCBlKSwgcmcoZCkgfHwgY2coTmYoYSkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh3KGEsIDE5LCAhMCksIGIgPSBvZyhjLmosIGMubSksIGUgPSBfLnkoT2goYSwgNCkpLCBhID0gZS5uZXh0KCk7ICFhLmRvbmU7IGEgPSBlLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gcWUoYS52YWx1ZSksIGEgPSAoMCwgRi5IKShQaC5nZXQoKDAsIEYuSCkoYSkpKSwgYS5BICYmIGEuUihiLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgTShiLCBRaChTdHJpbmcoYS5nZXRBZFVuaXRQYXRoKCkpLCBTdHJpbmcoYS5nZXREb21JZCgpKSksIGQpOwogICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgYyA/IGIuZXJyb3IoUmgoYykpIDogYi5lcnJvcihXZygnZ29vZ2xldGFnLmRpc3BsYXknLCBbU3RyaW5nKGEpXSkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBUaCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIG9lKCdkaXNwbGF5JywgSyg5NSwgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBTaChhKTsKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTWggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIsIGMgPSBudWxsLCBkID0gbnVsbCwgZSA9ICcnOwogICAgICAgICAgICAgICAgYyA9IF8uSGcoSmgpOwogICAgICAgICAgICAgICAgJ3N0cmluZycgPT09IHR5cGVvZiBhID8gKGUgPSBhLCBjID0gVWgoYywgZSkpIDogXy5qYShhKSAmJiAxID09IGEubm9kZVR5cGUgPyAoZCA9IGEsIGUgPSBkLmlkLCBjID0gVWgoYywgZSkpIDogYyA9IG51bGwgIT09IChiID0gKEwgPSBbXS5jb25jYXQoXy5sYyhjLmNhKSksIF8udChMLCAnZmluZCcpKS5jYWxsKEwsIGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYuaiA9PT0gYTsKICAgICAgICAgICAgICAgIH0pKSAmJiB2b2lkIDAgIT09IGIgPyBiIDogbnVsbDsKICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgc2xvdElkOiBjLAogICAgICAgICAgICAgICAgICAgIHVkOiBkLAogICAgICAgICAgICAgICAgICAgIHZkOiBlCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICBXaCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gUWcoYSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVmgoYSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWmggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IFhoLk8oKTsKICAgICAgICAgICAgICAgIHJldHVybiBRZyhhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBZaChhKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhaSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiwgYyA9IGdnKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChiID0gKEwgPSBbCiAgICAgICAgICAgICAgICAgICAgJ2dvb2dsZV9kZWJ1ZycsCiAgICAgICAgICAgICAgICAgICAgJ2RmcGRlYicsCiAgICAgICAgICAgICAgICAgICAgJ2dvb2dsZV9jb25zb2xlJywKICAgICAgICAgICAgICAgICAgICAnZ29vZ2xlX2ZvcmNlX2NvbnNvbGUnLAogICAgICAgICAgICAgICAgICAgICdnb29nZmMnCiAgICAgICAgICAgICAgICBdLCBfLnQoTCwgJ2ZpbmQnKSkuY2FsbChMLCBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSAkaChjLCBkKTsKICAgICAgICAgICAgICAgIH0pKSAmJiB2b2lkIDAgIT09IGIgPyBiIDogbnVsbDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZ2kgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYSA9IHZvaWQgMCA9PT0gYSA/IF8uciA6IGE7CiAgICAgICAgICAgICAgICBpZiAoIWJpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBuZXcgY2YoJ2dwdF9wdWJjb25zb2xlX2xvYWRlZCcpOwogICAgICAgICAgICAgICAgICAgIGRmKGIpOwogICAgICAgICAgICAgICAgICAgIEkoYiwgJ3BhcmFtJywgU3RyaW5nKGFpKGEpKSk7CiAgICAgICAgICAgICAgICAgICAgSShiLCAnYXBpJywgU3RyaW5nKGNpKSk7CiAgICAgICAgICAgICAgICAgICAgZmYoYiwgMSk7CiAgICAgICAgICAgICAgICAgICAgZGkoYS5kb2N1bWVudCwgZWkoWWEoZmkpLnRvU3RyaW5nKCkpKTsKICAgICAgICAgICAgICAgICAgICBiaSA9ICEwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBoaSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIG5lKCkuX3B1YmNvbnNvbGVfZGlzYWJsZV8gPSAhMDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAga2kgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBpaSAmJiAobmUoKS5jb25zb2xlLm9wZW5Db25zb2xlKGppKSwgamkgPSBudWxsLCBpaSA9ICExKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbGkgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYSA9IHZvaWQgMCA9PT0gYSA/ICcnIDogYTsKICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgY2kgPSAhMDsKICAgICAgICAgICAgICAgIChudWxsID09PSAoYiA9IG5lKCkpIHx8IHZvaWQgMCA9PT0gYiA/IDAgOiBiLmNvbnNvbGUpID8gbmUoKS5jb25zb2xlLm9wZW5Db25zb2xlKGEpIDogKGEgJiYgKGppID0gYSksIGlpID0gITAsIGdpKCkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBtaSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgIHJldHVybiAhKG51bGwgIT09IChjID0gRShhLCAxMSkpICYmIHZvaWQgMCAhPT0gYyA/ICFjIDogIUUoYiwgMTApKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcGkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICBpZiAoYSA9IHJnKGEsIGIpKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMgPSBudWxsICE9PSAoZSA9IEUoYywgMjQpKSAmJiB2b2lkIDAgIT09IGUgPyBlIDogRShkLCAzMCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBhLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLCBkID0gYi50b3AsIGMgPSBiLmJvdHRvbSwgMCA9PT0gYi5oZWlnaHQgPyBjID0gITEgOiAoYiA9IF8uci5pbm5lckhlaWdodCwgYyA9IDAgPCBjICYmIGMgPCBiIHx8IDAgPCBkICYmIGQgPCBiKTsKICAgICAgICAgICAgICAgICAgICBjIHx8IChhLnN0eWxlLmRpc3BsYXkgPSAnbm9uZScpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBxaSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gYSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBhLnJlcGxhY2UoL1wkXHtBVUNUSU9OX1BSSUNFXH0vZywgU3RyaW5nKGIpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcmkgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSB7fTsKICAgICAgICAgICAgICAgIGEgPSBfLnkoYSk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gYS5uZXh0KCk7ICFjLmRvbmU7IGMgPSBhLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICBjID0gYy52YWx1ZSwgYltHKGMsIDEpXSA9IEcoYywgMik7CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdWkgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICByZXR1cm4gc2koYSwgdGksIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgZCA9IGQuZGV0YWlsLmRhdGE7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgPSBKU09OLnBhcnNlKGQpLCAncmV3YXJkZWQnID09PSBjLnR5cGUgJiYgYy5tZXNzYWdlID09PSBiOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZpID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLnJvdW5kKE51bWJlcih2ZyhhKSkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB4aSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gMTAwOyBhICYmIGEgIT09IGIgJiYgLS1kOykKICAgICAgICAgICAgICAgICAgICBfLndpKGEsIGMpLCBhID0gYS5wYXJlbnRFbGVtZW50OwogICAgICAgICAgICB9OwogICAgICAgICAgICB5aSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICBfLndpKGEsIHsKICAgICAgICAgICAgICAgICAgICAnbWFyZ2luLWxlZnQnOiAnMHB4JywKICAgICAgICAgICAgICAgICAgICAnbWFyZ2luLXJpZ2h0JzogJzBweCcKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIGYgPSB7ICd6LWluZGV4JzogJzAnIH07CiAgICAgICAgICAgICAgICAnYWJzb2x1dGUnICE9PSBkLnBvc2l0aW9uICYmICdmaXhlZCcgIT09IGQucG9zaXRpb24gJiYgJ3JlbGF0aXZlJyAhPT0gZC5wb3NpdGlvbiAmJiAoZi5wb3NpdGlvbiA9ICdyZWxhdGl2ZScpOwogICAgICAgICAgICAgICAgdmFyIGcgPSAncnRsJyA9PT0gZC5kaXJlY3Rpb24sIGggPSAoKGUgJiYgLTEyMjQ1OTMzICE9PSBlLndpZHRoID8gZS53aWR0aCA6IGIuaW5uZXJXaWR0aCkgLSBjKSAvIDI7CiAgICAgICAgICAgICAgICBkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBrID0gYS5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKS5sZWZ0OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBnID8gaCAtIGsgOiBrIC0gaDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBiID0gZCgpOwogICAgICAgICAgICAgICAgcmV0dXJuIDAgIT09IGIgPyAoYyA9IGZ1bmN0aW9uIChrKSB7CiAgICAgICAgICAgICAgICAgICAgZyA/IGZbJ21hcmdpbi1yaWdodCddID0gayArICdweCcgOiBmWydtYXJnaW4tbGVmdCddID0gayArICdweCc7CiAgICAgICAgICAgICAgICB9LCBjKC1iKSwgXy53aShhLCBmKSwgZCA9IGQoKSwgMCAhPT0gZCAmJiBiICE9PSBkICYmIChjKGIgLyAoZCAtIGIpICogYiksIF8ud2koYSwgZikpLCAhMCkgOiAhMTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQWkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZywgaCkgewogICAgICAgICAgICAgICAgdmFyIGsgPSBaZihjKTsKICAgICAgICAgICAgICAgIF8uci5zZXRUaW1lb3V0KF8ubWYoNDU5LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgemkoYSwgYiwgZCwgZSwgZiwgaywgZywgaCk7CiAgICAgICAgICAgICAgICB9KSwgNTAwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgemkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZywgaCkgewogICAgICAgICAgICAgICAgdmFyIGs7CiAgICAgICAgICAgICAgICBpZiAoXy5yLkludGVyc2VjdGlvbk9ic2VydmVyKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBudWxsLCBtID0gbnVsbCAhPT0gKGsgPSBCZyhiLCBhKSkgJiYgdm9pZCAwICE9PSBrID8gayA6IHJnKGIsIGEpLCBuID0gXy5tZig0NTksIGZ1bmN0aW9uIChxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocSA9IHEgJiYgcVswXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gcS5ib3VuZGluZ0NsaWVudFJlY3QsIEIgPSB3aW5kb3cuaW5uZXJXaWR0aCwgeCA9IE1hdGgucm91bmQodS5sZWZ0KSwgeiA9IE1hdGgucm91bmQodS5yaWdodCksIEMgPSAwID4geCArIDIsIEQgPSAwIDwgeiAtIChCICsgMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHEuaW50ZXJzZWN0aW9uUmF0aW8gPj0gMSAtICgoMCA8PSBNYXRoLnJvdW5kKHUubGVmdCkgPyAwIDogMikgKyAoTWF0aC5yb3VuZCh1LnJpZ2h0KSA8PSB3aW5kb3cuaW5uZXJXaWR0aCA/IDAgOiAyKSkgLyBkIHx8IEMgfHwgRCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2YoZywgZnVuY3Rpb24gKEopIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDIHx8IEQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgVCA9IG5ldyBDZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQuc2V0KDgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJpKG0pICYmIFQuc2V0KDEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUID0gRGcoVCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUID0gQ2koYSwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWEgPSBEaShiLCBtLCBlKSwgWCA9IGFhLk9kOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWEgPSBhYS5QZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRmKEopOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSShKLCAncWlkJywgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKEosICdpdScsIGIuZ2V0QWRVbml0UGF0aCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkoSiwgJ2UnLCBTdHJpbmcoVCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQyAmJiBJKEosICdvZmwnLCBTdHJpbmcoeCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRCAmJiBJKEosICdvZnInLCBTdHJpbmcoeiAtIEIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkoSiwgJ3JldCcsIGQgKyAneCcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkoSiwgJ3JlcScsIGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSShKLCAnYm0nLCBTdHJpbmcoYykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSShKLCAnZWZoJywgTnVtYmVyKFgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkoSiwgJ3N0aycsIE51bWJlcihhYSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSShKLCAnaWZpJywgRWkod2luZG93KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsgcGE6IF8uemMoRmkpIH0pLCBsICYmIGwudW5vYnNlcnZlKCgwLCBGLkgpKG0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgbSAmJiAobCA9IG5ldyBfLnIuSW50ZXJzZWN0aW9uT2JzZXJ2ZXIobiwgeyB0aHJlc2hvbGQ6IFsxXSB9KSwgKDAsIEYuSCkobCkub2JzZXJ2ZShtKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIENpID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gQmcoYiwgYSkgfHwgcmcoYiwgYSksIGQgPSBuZXcgQ2coKTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLCBmID0gZS5sZWZ0LCBnID0gZS50b3AsIGggPSBlLndpZHRoLCBrID0gZS5oZWlnaHQsIGwgPSByZyhiLCBhKSwgbSA9ICgwLCBGLkgpKHVnKGwsIHdpbmRvdykpOwogICAgICAgICAgICAgICAgICAgIGlmICgnaGlkZGVuJyA9PT0gbS52aXNpYmlsaXR5IHx8ICdub25lJyA9PT0gbS5kaXNwbGF5KQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGcoZCk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB2aShtLmdldFByb3BlcnR5VmFsdWUoJ2JvcmRlci10b3Atd2lkdGgnKSB8fCAwKSArIDE7CiAgICAgICAgICAgICAgICAgICAgYiA9IGYgKyBoOwogICAgICAgICAgICAgICAgICAgIGsgPSBnICsgazsKICAgICAgICAgICAgICAgICAgICB2YXIgcSA9IGEuZWxlbWVudHNGcm9tUG9pbnQoZiArIG4gKyAyLCBnICsgbik7CiAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBhLmVsZW1lbnRzRnJvbVBvaW50KGIgLSBuIC0gMiwgZyArIG4pOwogICAgICAgICAgICAgICAgICAgIHZhciBCID0gYS5lbGVtZW50c0Zyb21Qb2ludChiIC0gbiAtIDIsIGsgLSBuKTsKICAgICAgICAgICAgICAgICAgICB2YXIgeCA9IGEuZWxlbWVudHNGcm9tUG9pbnQoZiArIG4gKyAyLCBrIC0gbik7CiAgICAgICAgICAgICAgICAgICAgdmFyIHogPSBhLmVsZW1lbnRzRnJvbVBvaW50KGIgLyAyLCBrIC0gbik7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChEKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQuc2V0KDEpLCBEZyhkKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICghKHEgJiYgcS5sZW5ndGggJiYgdSAmJiB1Lmxlbmd0aCAmJiBCICYmIEIubGVuZ3RoICYmIHggJiYgeC5sZW5ndGggJiYgeiAmJiB6Lmxlbmd0aCkpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQuc2V0KDcpLCBEZyhkKTsKICAgICAgICAgICAgICAgIGEgPSBmdW5jdGlvbiAoRCwgSikgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIFQgPSAhMSwgYWEgPSAwOyBhYSA8IEQubGVuZ3RoOyBhYSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBYID0gRFthYV07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChUKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgUyA9IHVnKFgsIHdpbmRvdyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2hpZGRlbicgIT09IFMudmlzaWJpbGl0eSAmJiAhR2koWCkgJiYgIUMoYywgWCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnNldChKKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWJzb2x1dGUnID09PSBTLnBvc2l0aW9uICYmIGQuc2V0KDExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID09PSBYICYmIChUID0gITApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBIaShjKSAmJiBkLnNldCg5KTsKICAgICAgICAgICAgICAgIHZhciBDID0gZnVuY3Rpb24gKEQsIEopIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gSWkoRCwgSikgfHwgSWkoSiwgRCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZiA9IHFbMF07CiAgICAgICAgICAgICAgICBjID09PSBmIHx8IEMoYywgZikgfHwgR2koZikgfHwgZC5zZXQoMik7CiAgICAgICAgICAgICAgICBmID0gdVswXTsKICAgICAgICAgICAgICAgIGMgPT09IGYgfHwgQyhjLCBmKSB8fCBHaShmKSB8fCBkLnNldCgzKTsKICAgICAgICAgICAgICAgIGYgPSBCWzBdOwogICAgICAgICAgICAgICAgYyA9PT0gZiB8fCBDKGMsIGYpIHx8IEdpKGYpIHx8IGQuc2V0KDQpOwogICAgICAgICAgICAgICAgZiA9IHhbMF07CiAgICAgICAgICAgICAgICBjID09PSBmIHx8IEMoYywgZikgfHwgR2koZikgfHwgZC5zZXQoNSk7CiAgICAgICAgICAgICAgICBpZiAoR2koYykpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERnKGQpOwogICAgICAgICAgICAgICAgYShxLCAxMik7CiAgICAgICAgICAgICAgICBhKHUsIDEzKTsKICAgICAgICAgICAgICAgIGEoQiwgMTQpOwogICAgICAgICAgICAgICAgYSh4LCAxNSk7CiAgICAgICAgICAgICAgICBhKHosIDYpOwogICAgICAgICAgICAgICAgcmV0dXJuIERnKGQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBCaSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9ICExLCBjID0gITE7CiAgICAgICAgICAgICAgICByZXR1cm4gSmkoYSwgZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICBjID0gYyB8fCAnc2Nyb2xsJyA9PT0gZC5vdmVyZmxvd1ggfHwgJ2F1dG8nID09PSBkLm92ZXJmbG93WDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGIgPSBiIHx8ICdmbGV4JyA9PT0gZC5kaXNwbGF5KSAmJiBjOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIERpID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHZhciBkID0gKGEgPSByZyhhKSkgJiYgdWcoYSwgd2luZG93KSwgZSA9IGQgPyAnYWJzb2x1dGUnICE9PSBkLnBvc2l0aW9uIDogITAsIGYgPSAhMSwgZyA9IGEgJiYgYS5wYXJlbnRFbGVtZW50LCBoID0gITE7CiAgICAgICAgICAgICAgICBLaShiLCBmdW5jdGlvbiAoaykgewogICAgICAgICAgICAgICAgICAgIHZhciBsID0gay5zdHlsZTsKICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGggfHwgKGggPSBrID09PSBnKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBMaShrLCBfLnIsICEwLCAtMSwgLTEpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBsICYmIGwuaGVpZ2h0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSAobCAmJiBfLnQobCwgJ2VuZHNXaXRoJykuY2FsbChsLCAncHgnKSA/IHZpKGwpIDogMCkgPj0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICFsIHx8IG0gfHwgJ3N0cmluZycgPT09IHR5cGVvZiBsICYmIF8udChNaSwgJ2luY2x1ZGVzJykuY2FsbChNaSwgbCkgfHwgKGUgPSAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmIHx8IChrID0gdWcoaywgXy5yKSwgJ3N0aWNreScgIT09IGsucG9zaXRpb24gJiYgJ2ZpeGVkJyAhPT0gay5wb3NpdGlvbikgfHwgKGYgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoZiAmJiAhZSk7CiAgICAgICAgICAgICAgICB9LCAxMDApOwogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBPZDogZSwKICAgICAgICAgICAgICAgICAgICBQZDogZgogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTmkgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgJGYoYikgJiYgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgb2YoJ2dwdF9mbHVpZF9zeicsIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gQmcoYSwgZG9jdW1lbnQpOwogICAgICAgICAgICAgICAgICAgICAgICBlID0gZSA/IGtnKGUpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgSShkLCAnc3onLCBlID8gZS53aWR0aCArICd4JyArIGUuaGVpZ2h0IDogJ251bGwnKTsKICAgICAgICAgICAgICAgICAgICAgICAgSShkLCAncXFpZCcsIGMpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgMjUwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgUGkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgdmFyIGUgPSBfLk9pKCdESVYnKTsKICAgICAgICAgICAgICAgIGUuaWQgPSBiOwogICAgICAgICAgICAgICAgZS5uYW1lID0gYjsKICAgICAgICAgICAgICAgIGIgPSBlLnN0eWxlOwogICAgICAgICAgICAgICAgYi5ib3JkZXIgPSAnMHB0IG5vbmUnOwogICAgICAgICAgICAgICAgYyAmJiAoYi5tYXJnaW4gPSAnYXV0bycsIGIudGV4dEFsaWduID0gJ2NlbnRlcicpOwogICAgICAgICAgICAgICAgZCAmJiAoYyA9IEFycmF5LmlzQXJyYXkoZCksIGIud2lkdGggPSBjID8gZFswXSArICdweCcgOiAnMTAwJScsIGIuaGVpZ2h0ID0gYyA/IGRbMV0gKyAncHgnIDogJzAlJyk7CiAgICAgICAgICAgICAgICBhLmFwcGVuZENoaWxkKGUpOwogICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFNpID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHZhciBkID0gUWk7CiAgICAgICAgICAgICAgICBjID0gXy5PaSgodm9pZCAwID09PSBjID8gMCA6IGMpID8gJ2ZlbmNlZGZyYW1lJyA6ICdJRlJBTUUnKTsKICAgICAgICAgICAgICAgIGMuaWQgPSBhOwogICAgICAgICAgICAgICAgYy50aXRsZSA9IGQ7CiAgICAgICAgICAgICAgICBjLm5hbWUgPSBhOwogICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShiKSA/IG51bGwgIT0gYlswXSAmJiBudWxsICE9IGJbMV0gJiYgKGMud2lkdGggPSBTdHJpbmcoYlswXSksIGMuaGVpZ2h0ID0gU3RyaW5nKGJbMV0pKSA6IChjLndpZHRoID0gJzEwMCUnLCBjLmhlaWdodCA9ICcwJyk7CiAgICAgICAgICAgICAgICBjLmFsbG93VHJhbnNwYXJlbmN5ID0gJ3RydWUnOwogICAgICAgICAgICAgICAgYy5zY3JvbGxpbmcgPSAnbm8nOwogICAgICAgICAgICAgICAgYy5tYXJnaW5XaWR0aCA9ICcwJzsKICAgICAgICAgICAgICAgIGMubWFyZ2luSGVpZ2h0ID0gJzAnOwogICAgICAgICAgICAgICAgYy5mcmFtZUJvcmRlciA9ICcwJzsKICAgICAgICAgICAgICAgIGMuc3R5bGUuYm9yZGVyID0gJzAnOwogICAgICAgICAgICAgICAgYy5zdHlsZS52ZXJ0aWNhbEFsaWduID0gJ2JvdHRvbSc7CiAgICAgICAgICAgICAgICBfLkgoUmkpICYmIChjLnNldEF0dHJpYnV0ZSgncm9sZScsICdyZWdpb24nKSwgYy5zZXRBdHRyaWJ1dGUoJ2FyaWEtbGFiZWwnLCAnQWR2ZXJ0aXNlbWVudCcpLCBjLnRhYkluZGV4ID0gMCk7CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYmogPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZywgaCwgaywgbCwgbSwgbiwgcSwgdSwgQiwgeCwgeikgewogICAgICAgICAgICAgICAgdmFyIEMgPSBfLkhnKFRpKS5ob3N0cGFnZUxpYnJhcnlUb2tlbnM7CiAgICAgICAgICAgICAgICB2YXIgRDsKICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkoZSkgPyBEID0gbmV3IF8uVWkoTnVtYmVyKGVbMF0pLCBOdW1iZXIoZVsxXSkpIDogRCA9IDE7CiAgICAgICAgICAgICAgICBlID0gbnVsbDsKICAgICAgICAgICAgICAgIG51bGwgIT09IGQgJiYgKGUgPSBudWxsID09PSBuID8gVmkoZCwgJycsICdzZicpIDogJzxzdGFydGd1YXJkPicgKyBkICsgJzxlbmRndWFyZD4nKTsKICAgICAgICAgICAgICAgIGQgPSBlOwogICAgICAgICAgICAgICAgZyA9IHsKICAgICAgICAgICAgICAgICAgICB6YjogWWYoZywgMSkgPyAhIUUoZywgMSkgOiAhbCwKICAgICAgICAgICAgICAgICAgICBBYjogWWYoZywgMikgPyAhIUUoZywgMikgOiAhMQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGwgPSAhIW5lKCkuZmlmV2luOwogICAgICAgICAgICAgICAgZSA9IFdpKCk7CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBYaSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIEogPSBZaShaaSksIFQgPSBbXSwgYWEgPSAwOyBhYSA8IEoubGVuZ3RoOyBhYSArPSAyKQogICAgICAgICAgICAgICAgICAgICAgICAkaShKW2FhXSwgSlthYSArIDFdLCBUKTsKICAgICAgICAgICAgICAgICAgICBYaSA9IFQuam9pbignJicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBhaih7CiAgICAgICAgICAgICAgICAgICAgd2M6IGEsCiAgICAgICAgICAgICAgICAgICAgTGM6IGIsCiAgICAgICAgICAgICAgICAgICAgSmQ6IGMsCiAgICAgICAgICAgICAgICAgICAgY29udGVudDogZCwKICAgICAgICAgICAgICAgICAgICBzaXplOiBELAogICAgICAgICAgICAgICAgICAgIHhkOiBtLAogICAgICAgICAgICAgICAgICAgIFFjOiBmLAogICAgICAgICAgICAgICAgICAgIFljOiBrIHx8IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICBwZXJtaXNzaW9uczogZywKICAgICAgICAgICAgICAgICAgICBxYjogbCwKICAgICAgICAgICAgICAgICAgICBuZTogZSwKICAgICAgICAgICAgICAgICAgICBxZDogWGksCiAgICAgICAgICAgICAgICAgICAgZGQ6ICExLAogICAgICAgICAgICAgICAgICAgIGhvc3RwYWdlTGlicmFyeVRva2VuczogQywKICAgICAgICAgICAgICAgICAgICB6YTogcmYsCiAgICAgICAgICAgICAgICAgICAgU2E6IG51bGwgPT09IG4gPyB2b2lkIDAgOiBuLAogICAgICAgICAgICAgICAgICAgIHVuaXF1ZUlkOiB1LAogICAgICAgICAgICAgICAgICAgIFJiOiBxLAogICAgICAgICAgICAgICAgICAgIFFiOiBoIHx8IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICBDYjogQiB8fCB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgcGI6IHggfHwgdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICRhOiB6IHx8IHZvaWQgMAogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGNqID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnc3RpY2t5JyA9PT0gKG51bGwgPT09IGEgfHwgdm9pZCAwID09PSBhID8gdm9pZCAwIDogYS5wb3NpdGlvbikgfHwgJ2ZpeGVkJyA9PT0gKG51bGwgPT09IGEgfHwgdm9pZCAwID09PSBhID8gdm9pZCAwIDogYS5wb3NpdGlvbik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGRqID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFFpID0gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZWogPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgL151cm46dXVpZDpbMC05YS1mQS1GLV0qJC8udGVzdChiKSAmJiAoYiA9IGVpKGIpLCBhLnNyYyA9IFphKGIpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgamogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgc3dpdGNoIChhLmlkKSB7CiAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBmaihhKTsKICAgICAgICAgICAgICAgIGNhc2UgNjoKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGdqKGEpOwogICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgaGooYSk7CiAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgaWooYSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGtqID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmICghYmMoYSkpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgICAgICAgYSA9IGEucGFnZVlPZmZzZXQ7CiAgICAgICAgICAgICAgICByZXR1cm4gMCA+IGEgPyAtMSA6IGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIG1qID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gewogICAgICAgICAgICAgICAgICAgIHRocmVzaG9sZDogWwogICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAwLjMsCiAgICAgICAgICAgICAgICAgICAgICAgIDAuNSwKICAgICAgICAgICAgICAgICAgICAgICAgMC43NSwKICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LkludGVyc2VjdGlvbk9ic2VydmVyID8gbmV3IEludGVyc2VjdGlvbk9ic2VydmVyKGEsIGIpIDogbmV3IGxqKGEsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBuaiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgPT09IHR5cGVvZiBJbnRlcnNlY3Rpb25PYnNlcnZlciA/IG5ldyBsaihiLCB7IHJvb3RNYXJnaW46IGEgfSkgOiBuZXcgSW50ZXJzZWN0aW9uT2JzZXJ2ZXIoYiwgeyByb290TWFyZ2luOiBhIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBvaiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSAmJiAoYSA9IFdiKGEsIFFmLCAxKSkgPyBhLmdldFdpZHRoKCkgfHwgYi5pbm5lcldpZHRoIDogMDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcGogPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgJiYgKGEgPSBXYihhLCBRZiwgMSkpID8gYS5nZXRIZWlnaHQoKSB8fCBiLmlubmVySGVpZ2h0IDogMDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcWogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgJiYgKGEgPSBXYihhLCBRZiwgMikpID8gYS5nZXRXaWR0aCgpIHx8IDAgOiAwOwogICAgICAgICAgICB9OwogICAgICAgICAgICByaiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSAmJiAoYSA9IFdiKGEsIFFmLCAyKSkgPyBhLmdldEhlaWdodCgpIHx8IDAgOiAwOwogICAgICAgICAgICB9OwogICAgICAgICAgICBzaiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBhID0gYS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYltlLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgZCA9IGEuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBZZihlLCAxNik7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgdi5NYXAoWwogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3J0Z3MnLAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZCA/IGEubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFlmKGUsIDE2KSA/IFhmKGUpLmxlbmd0aCA/ICcxJyA6ICcyJyA6ICcwJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgeWE6ICchJyB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ21heF93JywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGQgPyBhLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvaihXYihlLCB0aCwgMTYpLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgeWE6ICchJyB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ21heF9oJywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGQgPyBhLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwaihXYihlLCB0aCwgMTYpLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgeWE6ICchJyB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ21pbl93JywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGQgPyBhLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxaihXYihlLCB0aCwgMTYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgeWE6ICchJyB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ21pbl9oJywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGQgPyBhLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByaihXYihlLCB0aCwgMTYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgeWE6ICchJyB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgamsgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZykgewogICAgICAgICAgICAgICAgdmFyIGggPSBuZXcgUWMoKSwgayA9IFdmKCEwLCB3aW5kb3cpLCBsID0gYy5VLCBtID0gYy5QW2EuZ2V0RG9tSWQoKV0sIG4gPSBuZXcgdGood2luZG93KTsKICAgICAgICAgICAgICAgIE4oaCwgbik7CiAgICAgICAgICAgICAgICB2YXIgcSA9IGQuR2QsIHUgPSBkLmFjLCBCID0gZC5sZCwgeCA9IGQueWQsIHogPSBkLk1kLCBDID0gZC55ZSwgRCA9IGQuSGQsIEogPSBkLkRkLCBUID0gZC53YiwgYWEgPSBkLnplLCBYID0gZC5NYywgUyA9IGQueGUsIGNhID0gZC5DZSwga2EgPSBkLkRlLCBlYSA9IGQuS2QsIHhhID0gZC5BZSwgaGIgPSBkLnliLCBQYSA9IGQuQmQsIERiID0gZC52ZSwgaWMgPSBkLnVlLCBraCA9IGQuYmUsIGpjID0gbmV3IHVqKGIsIGEsIGQub2IsIGQudGIsIGQuamEsIGQuRWUpOwogICAgICAgICAgICAgICAgTihoLCBqYyk7CiAgICAgICAgICAgICAgICBkID0gbmV3IHZqKCk7CiAgICAgICAgICAgICAgICBkLmooZik7CiAgICAgICAgICAgICAgICBmID0gbmV3IHdqKCk7CiAgICAgICAgICAgICAgICBmLm5vdGlmeSgpOwogICAgICAgICAgICAgICAgZiA9IG5ldyB4aih3aW5kb3cudG9wLCBkLCBmKTsKICAgICAgICAgICAgICAgIE4oaCwgZik7CiAgICAgICAgICAgICAgICBQYSA9IG5ldyB5aihQZShhLmdldEFkVW5pdFBhdGgoKSksIFBhLCBmLkMpOwogICAgICAgICAgICAgICAgTihoLCBQYSk7CiAgICAgICAgICAgICAgICB2YXIgdGIgPSBuZXcgemooTmYobSksIGsuaGVpZ2h0LCBKLCBqYy5vYik7CiAgICAgICAgICAgICAgICBOKGgsIHRiKTsKICAgICAgICAgICAgICAgIFBhID0gbmV3IEFqKGEsIHJnKGEsIGUpLCBhLmdldERvbUlkKCksIEFnKGEpLCBlLCBOZihtKSwgYik7CiAgICAgICAgICAgICAgICBOKGgsIFBhKTsKICAgICAgICAgICAgICAgIHZhciBuYiA9IG5ldyBCaihqYy5qYSwgQiwgeCwgeiwgQyk7CiAgICAgICAgICAgICAgICBOKGgsIG5iKTsKICAgICAgICAgICAgICAgIEMgPSBuZXcgQ2oobCwgbSwgd2luZG93LCBCLCB4LCBDKTsKICAgICAgICAgICAgICAgIE4oaCwgQyk7CiAgICAgICAgICAgICAgICBjYSA9IG5ldyBEaihXYihsLCBFaiwgNSksIGNhKTsKICAgICAgICAgICAgICAgIE4oaCwgY2EpOwogICAgICAgICAgICAgICAgdGIgPSBuZXcgRmooYS5nZXRBZFVuaXRQYXRoKCksIG0sIGsud2lkdGgsIHdpbmRvdywgVCwgamMudGIsIHRiLkMsIG5iLmphLCBQYS5DKTsKICAgICAgICAgICAgICAgIE4oaCwgdGIpOwogICAgICAgICAgICAgICAgVCA9IG5ldyBHaihhLCBsLCBtLCBOZihtKSwgZSwgYiwgUGEuQywgQy5DLCB0Yi5vLCBxKTsKICAgICAgICAgICAgICAgIE4oaCwgVCk7CiAgICAgICAgICAgICAgICBuYiA9IG5ldyBIaihULkMpOwogICAgICAgICAgICAgICAgTihoLCBuYik7CiAgICAgICAgICAgICAgICB2YXIgRWQgPSBuZXcgSWooYSwgaywgYiwgbmIuQywgY2EubCk7CiAgICAgICAgICAgICAgICBOKGgsIEVkKTsKICAgICAgICAgICAgICAgIG5iID0gbmV3IEpqKHdpbmRvdywgUGEuQyk7CiAgICAgICAgICAgICAgICBOKGgsIG5iKTsKICAgICAgICAgICAgICAgIGthID0gbmV3IEtqKEVkLkMsIFQuQywga2EsIGNhLmwpOwogICAgICAgICAgICAgICAgTihoLCBrYSk7CiAgICAgICAgICAgICAgICBrID0gbmV3IExqKGUsIGEsIG0sIGssIHEsIFBhLkMsIFQuQywgdGIubywgdGIud2IsIG5iLkMsIHUpOwogICAgICAgICAgICAgICAgTihoLCBrKTsKICAgICAgICAgICAgICAgIGNhID0gbmV3IE1qKGljKTsKICAgICAgICAgICAgICAgIE4oaCwgY2EpOwogICAgICAgICAgICAgICAgaWMgPSBuZXcgTmooaWMsIGNhLkMsIHRiLmphLCB0Yi5vKTsKICAgICAgICAgICAgICAgIE4oaCwgaWMpOwogICAgICAgICAgICAgICAgQyA9IG5ldyBPaihDLkMsIGljLmphKTsKICAgICAgICAgICAgICAgIE4oaCwgQyk7CiAgICAgICAgICAgICAgICBhYSA9IG5ldyBQaihsLCBtLCBDLkMsIEIsIHosIGFhKTsKICAgICAgICAgICAgICAgIE4oaCwgYWEpOwogICAgICAgICAgICAgICAgaGIgPSBuZXcgUWood2luZG93LCBoYiwgbi5DKTsKICAgICAgICAgICAgICAgIE4oaCwgaGIpOwogICAgICAgICAgICAgICAgeGEgPSBuZXcgUmooYSwgYywgeiwgeGEpOwogICAgICAgICAgICAgICAgTihoLCB4YSk7CiAgICAgICAgICAgICAgICBjYSA9IG5ldyBTaihEYik7CiAgICAgICAgICAgICAgICBOKGgsIGNhKTsKICAgICAgICAgICAgICAgIHRiID0gbmV3IFRqKGUpOwogICAgICAgICAgICAgICAgTihoLCB0Yik7CiAgICAgICAgICAgICAgICBEYiA9IG5ldyBVaihOZihtKSwgSiwgRCk7CiAgICAgICAgICAgICAgICBOKGgsIERiKTsKICAgICAgICAgICAgICAgIHogPSBuZXcgVmooYSwgYiwgYywgZywgd2luZG93LCBpYy5qYSwgeGEuQywga2EuQywgUGEuQywgVC5DLCBpYy5vLCBDLkMsIHgsIHUsIHEsIGFhLkMsIHosIFgsIFMsIGsuQywgaGIuQywgY2EuQywgdGIuQywgRGIuQywgamMubCk7CiAgICAgICAgICAgICAgICBOKGgsIHopOwogICAgICAgICAgICAgICAgXy5IKFdqKSAmJiAoWCA9IG5ldyBYaih3aW5kb3csIGEsIHouQiwgZCksIE4oaCwgWCkpOwogICAgICAgICAgICAgICAgSiA9IG5ldyBZaihiLCBOZihtKSwgYSwgd2luZG93LCBKLCB6LmwsIFBhLkMsIERiLkMpOwogICAgICAgICAgICAgICAgTihoLCBKKTsKICAgICAgICAgICAgICAgIGMgPSBuZXcgWmooYSwgTmYobSksICgwLCBGLkgpKGMuZWIpLCBELCB6LmwsIFBhLkMsIGYuQywgRGIuQyk7CiAgICAgICAgICAgICAgICBOKGgsIGMpOwogICAgICAgICAgICAgICAgYyA9IG5ldyBhayhhLCB3aW5kb3csIEIsIHoubCwgei5vKTsKICAgICAgICAgICAgICAgIE4oaCwgYyk7CiAgICAgICAgICAgICAgICBtID0gbmV3IGJrKGEsIE5mKG0pLCBnLCB3aW5kb3csIHoubCwgUGEuQyk7CiAgICAgICAgICAgICAgICBOKGgsIG0pOwogICAgICAgICAgICAgICAgZSA9IG5ldyBjayhhLCB6LmwsIGUsIGcpOwogICAgICAgICAgICAgICAgTihoLCBlKTsKICAgICAgICAgICAgICAgIGIgPSBuZXcgZGsoZWsoYiwgYSksIHdpbmRvdy50b3AsIHoubCwgbi5DKTsKICAgICAgICAgICAgICAgIE4oaCwgYik7CiAgICAgICAgICAgICAgICBhID0gbmV3IGZrKGEsIHUsIHEsIHgsIEIsIFMsIHoubCwgVC5DLCB6Lm8pOwogICAgICAgICAgICAgICAgTihoLCBhKTsKICAgICAgICAgICAgICAgIGVhID0gbmV3IGdrKHdpbmRvdywgZWEsIHoubCwgVC5DLCBQYS5DKTsKICAgICAgICAgICAgICAgIE4oaCwgZWEpOwogICAgICAgICAgICAgICAgXy5IKGhrKSAmJiBOKGgsIG5ldyBpayhraCwgbmUoKSwgbCkpOwogICAgICAgICAgICAgICAgcmV0dXJuIGg7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIG9rID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChjID0gKEwgPSBVYihhLCBraywgMiksIF8udChMLCAnZmluZCcpKS5jYWxsKEwsIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxrKGQsIDEpID09PSBiOwogICAgICAgICAgICAgICAgfSkpICYmIHZvaWQgMCAhPT0gYyA/IGMgOiBtayhhLCBuayhuZXcga2soKSwgYikpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwayA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBZZihhLCAzKSB8fCAoYyA9PT0gYi5nZXRBZFVuaXRQYXRoKCkgPyB3KGEsIDMsIDEpIDogYyA9PT0gYi5nZXREb21JZCgpICYmIHcoYSwgMywgMikpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB1ayA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICB2YXIgZiwgZywgaCwgaywgbCwgbSwgbiwgcSwgdSA9IGZ1bmN0aW9uIChKLCBUKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IGQgJiYgdm9pZCAwICE9PSBkID8gZCA6IGQgPSBxayhjKTsKICAgICAgICAgICAgICAgICAgICAgICAgcGsoZCwgZSwgVCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvayhkLCBKKTsKICAgICAgICAgICAgICAgICAgICB9LCBCID0gITEsIHggPSBudWxsICE9PSAoZyA9IG51bGwgPT09IChmID0gbnVsbCA9PT0gYSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBhLmdldEV2ZW50cykgfHwgdm9pZCAwID09PSBmID8gdm9pZCAwIDogZi5jYWxsKGEpKSAmJiB2b2lkIDAgIT09IGcgPyBnIDogW107CiAgICAgICAgICAgICAgICB4ID0gXy55KHgpOwogICAgICAgICAgICAgICAgZm9yICh2YXIgeiA9IHgubmV4dCgpOyAhei5kb25lOyB6ID0geC5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh6ID0gei52YWx1ZSwgei5ldmVudFR5cGUpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlICdiaWRSZXF1ZXN0ZWQnOgogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUFycmF5LmlzQXJyYXkoei5hcmdzKSAmJiBBcnJheS5pc0FycmF5KHouYXJncy5iaWRzKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIEMgPSBfLnkoei5hcmdzLmJpZHMpLCBEID0gQy5uZXh0KCk7ICFELmRvbmU7IEQgPSBDLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEID0gRC52YWx1ZSwgRC5iaWRkZXIgJiYgRC5hZFVuaXRDb2RlICYmIEQuYXVjdGlvbklkID09PSBiICYmIChCIHx8IChCID0gITApLCBudWxsID09PSAoaCA9IHUoRC5iaWRkZXIsIEQuYWRVbml0Q29kZSkpIHx8IHZvaWQgMCA9PT0gaCA/IHZvaWQgMCA6IHJrKGgsIHouZWxhcHNlZFRpbWUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnYmlkUmVzcG9uc2UnOgogICAgICAgICAgICAgICAgICAgICAgICAhQXJyYXkuaXNBcnJheSh6LmFyZ3MpICYmIHouYXJncy5iaWRkZXIgJiYgei5hcmdzLmFkVW5pdENvZGUgJiYgei5hcmdzLmF1Y3Rpb25JZCA9PT0gYiAmJiAoQiB8fCAoQiA9ICEwKSwgQyA9IHUoei5hcmdzLmJpZGRlciwgei5hcmdzLmFkVW5pdENvZGUpLCBudWxsID09PSBDIHx8IHZvaWQgMCA9PT0gQyA/IHZvaWQgMCA6IHJrKEMsIHouZWxhcHNlZFRpbWUgLSAobnVsbCAhPT0gKGsgPSBudWxsID09PSBDIHx8IHZvaWQgMCA9PT0gQyA/IHZvaWQgMCA6IHNrKEMsIDIpKSAmJiB2b2lkIDAgIT09IGsgPyBrIDogMCkpLCBudWxsID09PSBDIHx8IHZvaWQgMCA9PT0gQyA/IHZvaWQgMCA6IHcoQywgNCwgMSkpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlICdiaWRUaW1lb3V0JzoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoei5hcmdzKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoeiA9IF8ueSh6LmFyZ3MpLCBEID0gei5uZXh0KCk7ICFELmRvbmU7IEQgPSB6Lm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDID0gRC52YWx1ZSwgQy5iaWRkZXIgJiYgQy5hZFVuaXRDb2RlICYmIEMuYXVjdGlvbklkID09PSBiICYmIChCIHx8IChCID0gITApLCBDID0gdShDLmJpZGRlciwgQy5hZFVuaXRDb2RlKSwgbnVsbCA9PT0gQyB8fCB2b2lkIDAgPT09IEMgPyB2b2lkIDAgOiB3KEMsIDQsIDMpLCBudWxsID09PSBDIHx8IHZvaWQgMCA9PT0gQyA/IHZvaWQgMCA6IHJrKEMsIG51bGwgIT09IChuID0gbnVsbCA9PT0gKG0gPSBudWxsID09PSAobCA9IG51bGwgPT09IGEgfHwgdm9pZCAwID09PSBhID8gdm9pZCAwIDogYS5nZXRDb25maWcpIHx8IHZvaWQgMCA9PT0gbCA/IHZvaWQgMCA6IGwuY2FsbChhKSkgfHwgdm9pZCAwID09PSBtID8gdm9pZCAwIDogbS5iaWRkZXJUaW1lb3V0KSAmJiB2b2lkIDAgIT09IG4gPyBuIDogMCkpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlICdub0JpZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICFBcnJheS5pc0FycmF5KHouYXJncykgJiYgei5hcmdzLmJpZGRlciAmJiB6LmFyZ3MuYWRVbml0Q29kZSAmJiB6LmFyZ3MuYXVjdGlvbklkID09PSBiICYmIChCIHx8IChCID0gITApLCBDID0gdSh6LmFyZ3MuYmlkZGVyLCB6LmFyZ3MuYWRVbml0Q29kZSksIDMgIT09IChudWxsID09PSBDIHx8IHZvaWQgMCA9PT0gQyA/IHZvaWQgMCA6IHRrKEMsIDQsIDApKSAmJiAobnVsbCA9PT0gQyB8fCB2b2lkIDAgPT09IEMgPyB2b2lkIDAgOiB3KEMsIDQsIDIpLCBudWxsID09PSBDIHx8IHZvaWQgMCA9PT0gQyA/IHZvaWQgMCA6IHJrKEMsIHouZWxhcHNlZFRpbWUgLSAobnVsbCAhPT0gKHEgPSBzayhDLCAyKSkgJiYgdm9pZCAwICE9PSBxID8gcSA6IDApKSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBCOwogICAgICAgICAgICB9OwogICAgICAgICAgICBEayA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gW10gOiBjOwogICAgICAgICAgICAgICAgdmFyIGQsIGUgPSBuZXcgdmsoKTsKICAgICAgICAgICAgICAgICdudW1iZXInID09PSB0eXBlb2YgYS5jcG0gJiYgdyhlLCAyLCAxMDAwMDAwICogYS5jcG0pOwogICAgICAgICAgICAgICAgJ3N0cmluZycgPT09IHR5cGVvZiBhLmN1cnJlbmN5ICYmIHdrKGUsICgwLCBGLkgpKGEuY3VycmVuY3kpKTsKICAgICAgICAgICAgICAgIGlmICgnbnVtYmVyJyA9PT0gdHlwZW9mIGEuZGVhbElkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBuZXcgeGsoKTsKICAgICAgICAgICAgICAgICAgICB3KGYsIDEsIFN0cmluZyhhLmRlYWxJZCkpOwogICAgICAgICAgICAgICAgICAgIHpmKGUsIDYsIGYpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGEuYWRzZXJ2ZXJUYXJnZXRpbmcgJiYgJ29iamVjdCcgPT09IHR5cGVvZiBhLmFkc2VydmVyVGFyZ2V0aW5nKSB7CiAgICAgICAgICAgICAgICAgICAgYyA9IF8udChPYmplY3QsICdmcm9tRW50cmllcycpLmNhbGwoT2JqZWN0LCBjLm1hcChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2gobiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPaChuLCAyKQogICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICBmID0gXy55KFsKICAgICAgICAgICAgICAgICAgICAgICAgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICdfJyArIGEuYmlkZGVyCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyA9IGYubmV4dCgpOyAhZy5kb25lOyBnID0gZi5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGcudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGggPSBbXSwgayA9IF8ueShfLnQoT2JqZWN0LCAnZW50cmllcycpLmNhbGwoT2JqZWN0LCBhLmFkc2VydmVyVGFyZ2V0aW5nKSksIGwgPSBrLm5leHQoKTsgIWwuZG9uZTsgbCA9IGsubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IF8ueShsLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBtLm5leHQoKS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gPSBtLm5leHQoKS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgKz0gZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSAoZCA9IGNbbF0pICYmIHZvaWQgMCAhPT0gZCAmJiBkLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY1tsXVswXSA9PT0gU3RyaW5nKG0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLnB1c2gobCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHlrKGUsIE9oKGUsIDQpLmNvbmNhdChoKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3dpdGNoIChhLm1lZGlhVHlwZSB8fCAnYmFubmVyJykgewogICAgICAgICAgICAgICAgY2FzZSAnYmFubmVyJzoKICAgICAgICAgICAgICAgICAgICB3KGUsIDUsIDEpOwogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgY2FzZSAnbmF0aXZlJzoKICAgICAgICAgICAgICAgICAgICB3KGUsIDUsIDIpOwogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgY2FzZSAndmlkZW8nOgogICAgICAgICAgICAgICAgICAgIHcoZSwgNSwgMyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjID0gJ251bWJlcicgPT09IHR5cGVvZiBhLmhlaWdodCA/IGEuaGVpZ2h0IDogdm9pZCAwOwogICAgICAgICAgICAgICAgZiA9ICdudW1iZXInID09PSB0eXBlb2YgYS5oZWlnaHQgPyBhLndpZHRoIDogdm9pZCAwOwogICAgICAgICAgICAgICAgdm9pZCAwICE9PSBjICYmIHZvaWQgMCAhPT0gZiAmJiB6ayhlLCBBayhCayhmKSwgYykpOwogICAgICAgICAgICAgICAgJ3N0cmluZycgPT09IHR5cGVvZiBhLmFkSWQgJiYgKENrKGUsICgwLCBGLkgpKGEuYWRJZCkpLCBiLnNldCgoMCwgRi5IKShhLmFkSWQpLCB7CiAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBjLAogICAgICAgICAgICAgICAgICAgIHdpZHRoOiBmLAogICAgICAgICAgICAgICAgICAgIGFkVXJsOiAnc3RyaW5nJyA9PT0gdHlwZW9mIGEuYWRVcmwgPyBhLmFkVXJsIDogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgIGpkOiAnc3RyaW5nJyA9PT0gdHlwZW9mIGEuYWQgPyBhLmFkIDogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgIGZvcm1hdDogdGsoZSwgNSwgMCksCiAgICAgICAgICAgICAgICAgICAgY3BtOiBZZihlLCAyKSA/IHNrKGUsIDIpIDogdm9pZCAwCiAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRWsgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgdi5NYXAoKSwgZCA9IGZ1bmN0aW9uIChsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gYy5nZXQobCk7CiAgICAgICAgICAgICAgICAgICAgICAgIG0gfHwgKG0gPSB7fSwgYy5zZXQobCwgbSkpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYSA9IF8ueShhKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBhLm5leHQoKTsgIWUuZG9uZTsgZSA9IGEubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBlLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIGUgPSBmLmVsYXBzZWRUaW1lOwogICAgICAgICAgICAgICAgICAgIHZhciBnID0gZi5hcmdzLCBoID0gZy5iaWRJZCwgayA9IGcuYmlkczsKICAgICAgICAgICAgICAgICAgICBpZiAoZy5hdWN0aW9uSWQgPT09IGIpCiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZi5ldmVudFR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYmlkUmVxdWVzdGVkJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghQXJyYXkuaXNBcnJheShrKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBfLnkoayk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGcgPSBmLm5leHQoKTsgIWcuZG9uZTsgZyA9IGYubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChnID0gZy52YWx1ZS5iaWRJZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZChnKS5yZXF1ZXN0VGltZSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbm9CaWQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgaCAmJiAoZChoKS5pZSA9IGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBiID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgICAgICBkID0gXy55KF8udChjLCAnZW50cmllcycpLmNhbGwoYykpOwogICAgICAgICAgICAgICAgZm9yIChhID0gZC5uZXh0KCk7ICFhLmRvbmU7IGEgPSBkLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICBlID0gXy55KGEudmFsdWUpLCBhID0gZS5uZXh0KCkudmFsdWUsIGYgPSBlLm5leHQoKS52YWx1ZSwgZSA9IGYucmVxdWVzdFRpbWUsIGYgPSBmLmllLCBlICYmIGYgJiYgYi5zZXQoYSwgZiAtIGUpOwogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEdrID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IEZrKCk7CiAgICAgICAgICAgICAgICBiID0gUWIoYiwgMSwgRGF0ZS5ub3coKSwgMCk7CiAgICAgICAgICAgICAgICBiID0gUWIoYiwgMiwgYS5jZSwgMCk7CiAgICAgICAgICAgICAgICBiID0gUWIoYiwgMywgYS5pYywgJycpOwogICAgICAgICAgICAgICAgdmFyIGMgPSBEYygpLm0oKTsKICAgICAgICAgICAgICAgIGIgPSB5ZihiLCA0LCBjKTsKICAgICAgICAgICAgICAgIHJldHVybiBRYihiLCA1LCBhLlRkLCAwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTGsgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBIaygpOwogICAgICAgICAgICAgICAgaWYgKGEuQmMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGEuc2I7CiAgICAgICAgICAgICAgICAgICAgYSA9IEdrKGEpOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IElrKCk7CiAgICAgICAgICAgICAgICAgICAgYiA9IEprKGUsIDEsIGIpOwogICAgICAgICAgICAgICAgICAgIGMgPSBRYihiLCAyLCBjLCAwKTsKICAgICAgICAgICAgICAgICAgICBjID0gRWUoYSwgNiwgS2ssIGMpOwogICAgICAgICAgICAgICAgICAgIG5jKGQsIGMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBNayA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBvZignZ3B0X2ZjX2hhc19uYW1lc3BhY2VfYnV0X25vX2lmcmFtZXMnLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIGRmKGIpOwogICAgICAgICAgICAgICAgICAgIEkoYiwgJ25ldHdvcmtJZCcsIGEpOwogICAgICAgICAgICAgICAgfSwgeyBwYTogMSB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTmsgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5JbnRlcnNlY3Rpb25PYnNlcnZlciA/IG5ldyBJbnRlcnNlY3Rpb25PYnNlcnZlcihhLCB7IHJvb3RNYXJnaW46IGIgfSkgOiBuZXcgbGooYSwgeyByb290TWFyZ2luOiBiIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBQayA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGlmIChGYSgpKQogICAgICAgICAgICAgICAgICAgIHZhciBhID0gMCA8PSBPayhIYSgpLCAxMSk7CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgYSA9IEJhKHphKCkpLCBHYShhKSwgYSA9IERhKCkgPyAoYSA9IGFbMl0pICYmIGFbMV0gfHwgJycgOiAnJywgJycgPT09IGEgPyBhID0gTmFOIDogKGEgPSBhLnNwbGl0KCcuJyksIGEgPSAwID09PSBhLmxlbmd0aCA/IE5hTiA6IE51bWJlcihhWzBdKSksIGEgPSA2NSA8PSBhOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFFrID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gYSwgYyA9IDA7CiAgICAgICAgICAgICAgICBLaShiLCBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAxID09PSAobnVsbCA9PT0gKGUgPSBkLnBhcmVudEVsZW1lbnQpIHx8IHZvaWQgMCA9PT0gZSA/IHZvaWQgMCA6IGUuY2hpbGRFbGVtZW50Q291bnQpID8gKGIgPSBkLnBhcmVudEVsZW1lbnQsIGMrKywgITApIDogITE7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgcGU6IGIsCiAgICAgICAgICAgICAgICAgICAgZGVwdGg6IGMKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFNrID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB2b2lkIDAgPT09IGEgPyB3aW5kb3cgOiBhOwogICAgICAgICAgICAgICAgUmsgPSBfLnhjKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBVayA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBhID0gYS5tYXAoZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYltjLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBhID0gbmV3IHYuTWFwKFsKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdpc3RzJywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IEVnKGEsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgIT09IE5mKGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgfHwgbnVsbAogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdmYXMnLAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogRmcoYSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQWgoTmYoYykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgKDAsIEYuamIpKCFfLkgoVGspKTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICBWayA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHYuTWFwKFtbCiAgICAgICAgICAgICAgICAgICAgICAgICdyYnZzJywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IEVnKGEsIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDQgPT09IE5mKGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgfHwgbnVsbAogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXV0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBZayA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IFtdLCBkID0gW107CiAgICAgICAgICAgICAgICBhID0gXy55KGEpOwogICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IGEubmV4dCgpOyAhZS5kb25lOyBlID0gYS5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHZvaWQgMCwgZyA9IHZvaWQgMCwgaCA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB2YXIgayA9IGI7CiAgICAgICAgICAgICAgICAgICAgZSA9IHJnKGUudmFsdWUpOwogICAgICAgICAgICAgICAgICAgIHZhciBsID0gV2soKG51bGwgPT09IGUgfHwgdm9pZCAwID09PSBlID8gdm9pZCAwIDogZS5wYXJlbnRFbGVtZW50KSAmJiB1ZyhlLnBhcmVudEVsZW1lbnQsIGspIHx8IG51bGwpOwogICAgICAgICAgICAgICAgICAgICFsIHx8IDEgPT09IGxbMF0gJiYgMSA9PT0gbFszXSA/IChsID0gbnVsbCAhPT0gKGggPSBudWxsID09PSBlIHx8IHZvaWQgMCA9PT0gZSA/IHZvaWQgMCA6IGUucGFyZW50RWxlbWVudCkgJiYgdm9pZCAwICE9PSBoID8gaCA6IG51bGwsIGggPSBudWxsICE9PSAoZyA9IGxnKGwpKSAmJiB2b2lkIDAgIT09IGcgPyBnIDogbmV3IF8uVWkoMCwgMCksIFhrKGgsIGwsIGssIDEwMCksIGcgPSBudWxsICE9PSAoZiA9IGxnKGUpKSAmJiB2b2lkIDAgIT09IGYgPyBmIDogbmV3IF8uVWkoMCwgMCksIFhrKGcsIGUsIGssIDEpLCAtMSA9PT0gaC5oZWlnaHQgJiYgKGcuaGVpZ2h0ID0gLTEpLCBrID0gaCwgZyA9IGYgPSBnLCBmID0gay53aWR0aCArICd4JyArIGsuaGVpZ2h0LCBrID0gZy53aWR0aCArICd4JyArIGcuaGVpZ2h0KSA6IGsgPSBmID0gJy0xeC0xJzsKICAgICAgICAgICAgICAgICAgICBjLnB1c2goZik7CiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKGspOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB2Lk1hcChbCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAncHN6JywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7IHlhOiAnfCcgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdtc3onLAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgeWE6ICd8JyB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWGsgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICB2YXIgZTsKICAgICAgICAgICAgICAgICAgICBpZiAoIShlID0gIWIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShmID0gIVprKGIsIGMsIGQpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSB1ZyhiLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGcgJiYgJ2ZpeGVkJyA9PSBnLnBvc2l0aW9uKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGIgPSBiLnBhcmVudEVsZW1lbnQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSAhaDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlID0gZjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZSAmJiAoYS5oZWlnaHQgPSAtMSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChrKSB7CiAgICAgICAgICAgICAgICAgICAgYS53aWR0aCA9IC0xLCBhLmhlaWdodCA9IC0xOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBkbCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiwgYywgZCwgZSwgZiwgZywgaDsKICAgICAgICAgICAgICAgIHZhciBrID0gYTsKICAgICAgICAgICAgICAgIGsgPSB2b2lkIDAgPT09IGsgPyAkayA6IGs7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHZhciBsID0gay5oaXN0b3J5Lmxlbmd0aDsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGNhKSB7CiAgICAgICAgICAgICAgICAgICAgbCA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBrID0gdi5NYXA7CiAgICAgICAgICAgICAgICBsID0gWwogICAgICAgICAgICAgICAgICAgICd1X2hpcycsCiAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogbCB9CiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgdmFyIG0gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICd1X2gnLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBudWxsID09PSAoYiA9IGEuc2NyZWVuKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLmhlaWdodCB9CiAgICAgICAgICAgICAgICAgICAgXSwgbiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3VfdycsCiAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6IG51bGwgPT09IChjID0gYS5zY3JlZW4pIHx8IHZvaWQgMCA9PT0gYyA/IHZvaWQgMCA6IGMud2lkdGggfQogICAgICAgICAgICAgICAgICAgIF0sIHEgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICd1X2FoJywKICAgICAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogbnVsbCA9PT0gKGQgPSBhLnNjcmVlbikgfHwgdm9pZCAwID09PSBkID8gdm9pZCAwIDogZC5hdmFpbEhlaWdodCB9CiAgICAgICAgICAgICAgICAgICAgXSwgdSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3VfYXcnLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBudWxsID09PSAoZSA9IGEuc2NyZWVuKSB8fCB2b2lkIDAgPT09IGUgPyB2b2lkIDAgOiBlLmF2YWlsV2lkdGggfQogICAgICAgICAgICAgICAgICAgIF0sIEIgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICd1X2NkJywKICAgICAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogbnVsbCA9PT0gKGYgPSBhLnNjcmVlbikgfHwgdm9pZCAwID09PSBmID8gdm9pZCAwIDogZi5jb2xvckRlcHRoIH0KICAgICAgICAgICAgICAgICAgICBdLCB4ID0gYTsKICAgICAgICAgICAgICAgIHggPSB2b2lkIDAgPT09IHggPyBfLnIgOiB4OwogICAgICAgICAgICAgICAgeCA9IHguZGV2aWNlUGl4ZWxSYXRpbzsKICAgICAgICAgICAgICAgIGsgPSBuZXcgayhbCiAgICAgICAgICAgICAgICAgICAgbCwKICAgICAgICAgICAgICAgICAgICBtLAogICAgICAgICAgICAgICAgICAgIG4sCiAgICAgICAgICAgICAgICAgICAgcSwKICAgICAgICAgICAgICAgICAgICB1LAogICAgICAgICAgICAgICAgICAgIEIsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAndV9zZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6ICdudW1iZXInID09PSB0eXBlb2YgeCA/ICt4LnRvRml4ZWQoMykgOiBudWxsIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3VfdHonLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiAtbmV3IERhdGUoKS5nZXRUaW1lem9uZU9mZnNldCgpIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgIGlmIChfLkgoYWwpKSB7CiAgICAgICAgICAgICAgICAgICAgbCA9IGsuc2V0OwogICAgICAgICAgICAgICAgICAgIHZhciB6LCBDLCBELCBKLCBUOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhYSA9IG51bGwgIT09IChKID0gbnVsbCA9PT0gKEQgPSBudWxsID09PSAoQyA9IG51bGwgPT09ICh6ID0gYS5leHRlcm5hbCkgfHwgdm9pZCAwID09PSB6ID8gdm9pZCAwIDogei56ZikgfHwgdm9pZCAwID09PSBDID8gdm9pZCAwIDogQy5iaW5kKGEuZXh0ZXJuYWwpKSB8fCB2b2lkIDAgPT09IEQgPyB2b2lkIDAgOiBEKCdvcy1tb2RlJykpICYmIHZvaWQgMCAhPT0gSiA/IEogOiAnJywgWCA9IE51bWJlcihudWxsID09PSAoVCA9IEpTT04ucGFyc2UoYWEpKSB8fCB2b2lkIDAgPT09IFQgPyB2b2lkIDAgOiBUWydvcy1tb2RlJ10pOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgUyA9IDAgPD0gWCA/IFggKyAxIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChjYSkgewogICAgICAgICAgICAgICAgICAgICAgICBTID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbC5jYWxsKGssICd3c20nLCB7IHZhbHVlOiBTIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgXy5IKGJsKSAmJiAoay5zZXQoJ2ZsYXNoJywgewogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBjbChhKSwKICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJhOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgcWE6ICEwCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSksIGsuc2V0KCdkbWMnLCB7IHZhbHVlOiBudWxsICE9PSAoaCA9IG51bGwgPT09IChnID0gYS5uYXZpZ2F0b3IpIHx8IHZvaWQgMCA9PT0gZyA/IHZvaWQgMCA6IGcuZGV2aWNlTWVtb3J5KSAmJiB2b2lkIDAgIT09IGggPyBoIDogbnVsbCB9KSk7CiAgICAgICAgICAgICAgICByZXR1cm4gazsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZWwgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB2Lk1hcChbWwogICAgICAgICAgICAgICAgICAgICAgICAnY2xpY2snLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiAhYiAmJiBhLmdldENsaWNrVXJsKCkgPyBhLmdldENsaWNrVXJsKCkgOiBudWxsIH0KICAgICAgICAgICAgICAgICAgICBdXSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGZsID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gbmV3IHYuTWFwKFsKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdmbG9jX2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogYS5pZCB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdmbG9jX3ZlcicsCiAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6IGEudmVyc2lvbiB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSkgOiBuZXcgdi5NYXAoWwogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2Zsb2NfaWQnLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBudWxsIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2Zsb2NfdmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogbnVsbCB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGhsID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmIChfLkgoZ2wpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgdi5NYXAoKTsKICAgICAgICAgICAgICAgIHZhciBiID0gYS5XYiwgYyA9IGEueWMsIGQgPSAwID09PSBhLnNkOwogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB2Lk1hcChbCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnYWRzaWQnLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBkID8gYiA6IG51bGwgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAncHVjcmQnLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBkID8gYyA6IG51bGwgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnamFyJywKICAgICAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogYS5vYyB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGtsID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjLCBkLCBlLCBmOwogICAgICAgICAgICAgICAgYSA9IGlsKGEpIHx8IG5ldyBqbCgpOwogICAgICAgICAgICAgICAgdmFyIGcgPSB0ayhhLCA2LCAyKTsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgdi5NYXAoWwogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3JkcCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6IEUoYSwgMSkgPyAnMScgOiBudWxsIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2x0ZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6IEUoYSwgOSkgPyAnMScgOiBudWxsIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2dkcHJfY29uc2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6IG51bGwgIT09IChjID0gRyhiLCAyKSkgJiYgdm9pZCAwICE9PSBjID8gYyA6IG51bGwgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnZ2RwcicsCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBZZihiLCAzKSA/IEUoYiwgMykgPyAnMScgOiAnMCcgOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogeyBxYTogITAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdhZGR0bF9jb25zZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogbnVsbCAhPT0gKGQgPSBHKGIsIDQpKSAmJiB2b2lkIDAgIT09IGQgPyBkIDogbnVsbCB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICd0Y2ZlJywKICAgICAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogbnVsbCAhPT0gKGUgPSBHKGIsIDcpKSAmJiB2b2lkIDAgIT09IGUgPyBlIDogbnVsbCB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICd1c19wcml2YWN5JywKICAgICAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogbnVsbCAhPT0gKGYgPSBHKGIsIDEpKSAmJiB2b2lkIDAgIT09IGYgPyBmIDogbnVsbCB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICducGEnLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBFKGIsIDYpIHx8IEUoYSwgOCkgPyAxIDogbnVsbCB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICd0ZnVhJywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDIgIT09IGcgPyBnIDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgcWE6ICEwIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAndGZjZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBZZihhLCA1KSA/IEcoYSwgNSkgOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogeyBxYTogITAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICd0cnQnLAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogWWYoYSwgMTApID8gRyhhLCAxMCkgOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogeyBxYTogITAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdtYWNyJywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IFlmKGEsIDExKSA/IHRrKGEsIDExLCAwKSA6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7IHFhOiAhMCB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbmwgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgdmFyIGQgPSB3aW5kb3c7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHYuTWFwKFsKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdyaXMnLAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogRmcoYiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiwgZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gbnVsbCAhPT0gKGcgPSBudWxsID09PSAoZiA9IGEuai5nZXQoZSkpIHx8IHZvaWQgMCA9PT0gZiA/IHZvaWQgMCA6IGYuUGMpICYmIHZvaWQgMCAhPT0gZyA/IGcgOiAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBfLmxsKGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLnJvdW5kKE1hdGgubWluKChlICYmIGYgPyBmIC0gZSA6IDApIC8gMTAwMCwgMTgwMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdm9pZCAwLCAnficpCiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3JjcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBGZyhiLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHZvaWQgMCA9PT0gZiA/IF8uciA6IGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gYS5qLmdldChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyAmJiAoZy5QYyA9IF8ubGwoZikgfHwgMCwgZy5XYysrKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1sKGEsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBvbCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IFtdOwogICAgICAgICAgICAgICAgYSA9IGEubWFwKGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQuZ2V0QWRVbml0UGF0aCgpLnJlcGxhY2UoLywvZywgJzonKS5zcGxpdCgnLycpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gXy50KGMsICdmaW5kSW5kZXgnKS5jYWxsKGMsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwIDw9IGYgPyBmIDogYy5wdXNoKGUpIC0gMTsKICAgICAgICAgICAgICAgICAgICB9KS5qb2luKCcvJyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgdi5NYXAoWwogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2l1X3BhcnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogYyB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdlbmNfcHJldl9pdXMnLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBhIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXZfaXVfc3pzJywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGIubWFwKGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFpmKGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnZmx1aWQnLAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gITEsIGUgPSBiLm1hcChmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9ICRmKGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCB8fCAoZCA9IGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYgPyAnaGVpZ2h0JyA6ICcwJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQgPyBlIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHBsID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHZhciBkLCBlID0gRShhLCAyMSk7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHYuTWFwKFsKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdoeHZhJywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGUgPyAxIDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgYmE6ICExIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnY21zaWQnLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBlID8gRyhhLCAyMykgOiBudWxsIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3ZpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6IGUgPyBHKGEsIDIyKSA6IG51bGwgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAncG9kJywKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGlzTmFOKGMpID8gbnVsbCA6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7IGJhOiAhMSB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3Bwb3MnLAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogaXNOYU4oYikgPyBudWxsIDogYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgYmE6ICExIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnc2NvcicsCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsICE9PSAoZCA9IEcoYSwgMjkpKSAmJiB2b2lkIDAgIT09IGQgPyBkIDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgYmE6ICExIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBxbCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJ3dibicgPT09IGEgPyBuZXcgdi5NYXAoWwogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3dic3UnLAogICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBYYSgoMCwgRi5IKShiKSkudG9TdHJpbmcoKS5yZXBsYWNlKC9edXJuOnV1aWQ6LywgJycpIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2NhbGxiYWNrJywKICAgICAgICAgICAgICAgICAgICAgICAgeyB2YWx1ZTogYyB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSkgOiBuZXcgdi5NYXAoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcmwgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYiwgYyA9IHt9LCBkID0gXy55KGJoKGEpKSwgZSA9IGQubmV4dCgpOyAhZS5kb25lOyBlID0gZC5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgZSA9IGUudmFsdWUsIGNbKDAsIEYuSCkoY2goZSkpXSA9IE9oKGUsIDIpOwogICAgICAgICAgICAgICAgYSA9IE9oKGEsIDgpOwogICAgICAgICAgICAgICAgYS5sZW5ndGggJiYgKG51bGwgIT09IChiID0gYy5leGNsX2NhdCkgJiYgdm9pZCAwICE9PSBiID8gYiA6IGMuZXhjbF9jYXQgPSBhKTsKICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBzbCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gcmwoYSk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IFtdOwogICAgICAgICAgICAgICAgXy5lZihhLCBmdW5jdGlvbiAoYywgZCkgewogICAgICAgICAgICAgICAgICAgIGMubGVuZ3RoICYmIChjID0gYy5tYXAoZW5jb2RlVVJJQ29tcG9uZW50KSwgZCA9IGVuY29kZVVSSUNvbXBvbmVudChkKSwgYi5wdXNoKGQgKyAnPScgKyBjLmpvaW4oKSkpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdGwgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSAhMSwgYyA9IFViKGEsIGZoLCAyKS5tYXAoZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAoMCwgRi5IKShjaChkKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSAnZXhjbF9jYXQnID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gT2goZCwgMik7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQoZSkgKyAnPScgKyBlbmNvZGVVUklDb21wb25lbnQoZC5qb2luKCkpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgYSA9IE9oKGEsIDMpOwogICAgICAgICAgICAgICAgIWIgJiYgYS5sZW5ndGggJiYgYy5wdXNoKGVuY29kZVVSSUNvbXBvbmVudCgnZXhjbF9jYXQnKSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudChhLmpvaW4oKSkpOwogICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHVsID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IChiID0gYS5sb2NhdGlvbikgfHwgdm9pZCAwID09PSBiID8gMCA6IGIuYW5jZXN0b3JPcmlnaW5zKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmxvY2F0aW9uLmFuY2VzdG9yT3JpZ2lucy5sZW5ndGg7CiAgICAgICAgICAgICAgICB2YXIgYyA9IDA7CiAgICAgICAgICAgICAgICBhYyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYysrOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0sICEwLCAhMCwgYSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgeGwgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuICEhdmwoYi5VKSB8fCBhLnNvbWUoZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gd2woYi5QW2MuZ2V0RG9tSWQoKV0pOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZsID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgcmV0dXJuIChudWxsID09PSAoYiA9IChMID0gVWIoYSwgZmgsIDE0KSwgXy50KEwsICdmaW5kJykpLmNhbGwoTCwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3BhZ2VfdXJsJyA9PT0gY2goYyk7CiAgICAgICAgICAgICAgICB9KSkgfHwgdm9pZCAwID09PSBiID8gdm9pZCAwIDogT2goYiwgMilbMF0pIHx8IG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHdsID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgcmV0dXJuIChudWxsID09PSAoYiA9IChMID0gVWIoYSwgZmgsIDMpLCBfLnQoTCwgJ2ZpbmQnKSkuY2FsbChMLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAncGFnZV91cmwnID09PSBjaChjKTsKICAgICAgICAgICAgICAgIH0pKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBPaChiLCAyKVswXSkgfHwgbnVsbDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgeWwgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIGIgPyBlbmNvZGVVUklDb21wb25lbnQoYS50b1N0cmluZygpKSA6IGEudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQWwgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhnKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBnOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBrID0gZ2MuYXBwbHkoMCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5hcHBseShudWxsLCBfLmxjKGspKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgZCA9IG51bGwsIGUgPSAwLCBmID0gMDsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcsIGgsIGssIGw7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxID09IG0uaikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGNsZWFyVGltZW91dChlKSwgZSA9IDAsIGcgPSBuZXcgR2QoKSwgaCA9IGMoZy5yZXNvbHZlKSwgayA9ICsrZiwgamIobSwgMCwgMik7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmICE9PSBrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGgoITEpLCBtLnJldHVybihnLnByb21pc2UpOwogICAgICAgICAgICAgICAgICAgICAgICBkID8gZCghMSkgOiBoKCEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGMoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgoITApOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHNldFRpbWVvdXQobCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uemwoYiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgaCghMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gaDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0ucmV0dXJuKGcucHJvbWlzZSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICBFbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIG9lKCdwdWJhZHNSZWFkeScsICEwKTsKICAgICAgICAgICAgICAgIGlmIChfLkgoQmwpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAwOwogICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShuZSgpLCAncHViYWRzUmVhZHknLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgTShMaCgpLCBDbCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg1ID4gYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gXy56YyhEbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2YoJ2dwdF9wdWJhZHNfcmVhZHknLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKythOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZihjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBFcnJvcigncHViYWRzUmVhZHknKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSShjLCAnc3RhY2snLCBaZShudWxsICE9PSAoZCA9IGUuc3RhY2spICYmIHZvaWQgMCAhPT0gZCA/IGQgOiAnJywgZS5tZXNzYWdlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeyBwYTogYiB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgR2wgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIFFnKGEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEZsKGEsIGEuaik7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSGwgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIF8udChPYmplY3QsICdhc3NpZ24nKS5jYWxsKE9iamVjdCwgXy50KE9iamVjdCwgJ2Fzc2lnbicpLmNhbGwoT2JqZWN0LCB7fSwgYSksIF8udChPYmplY3QsICdmcm9tRW50cmllcycpLmNhbGwoT2JqZWN0LCBfLnQoT2JqZWN0LCAnZW50cmllcycpLmNhbGwoT2JqZWN0LCBhKS5tYXAoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICBiID0gXy55KGIpOwogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYi5uZXh0KCkudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgYi5uZXh0KCkudmFsdWUsCiAgICAgICAgICAgICAgICAgICAgICAgIGMKICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgfSkpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgS2wgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgdmFyIGQgPSBJbChiLCBjLCB2b2lkIDAsICEwKSwgZSA9IGQuc2xvdElkOwogICAgICAgICAgICAgICAgZCA9IGQuSmE7CiAgICAgICAgICAgICAgICBpZiAoIWUgfHwgIWQpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oTGgoKSwgV2coJ1B1YkFkc1NlcnZpY2UuZGVmaW5lUGFzc2JhY2snLCBbCiAgICAgICAgICAgICAgICAgICAgICAgIGIsCiAgICAgICAgICAgICAgICAgICAgICAgIGMKICAgICAgICAgICAgICAgICAgICBdKSksIG51bGw7CiAgICAgICAgICAgICAgICB3KGQsIDE3LCAhMCk7CiAgICAgICAgICAgICAgICBhLkthKGUsIGQpOwogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBTYzogR2wobmV3IEpsKGUsIGEpKSwKICAgICAgICAgICAgICAgICAgICBKYTogZAogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTWwgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIFFnKGEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IExsKGEpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHBhID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGEgPSAoMCwgRi52YSkoYVswXSk7CiAgICAgICAgICAgICAgICBiID0gKDAsIEYudmEpKGJbMF0pOwogICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBuYSwgZCA9IE1hdGgubWluKGIubGVuZ3RoLCBhLmxlbmd0aCksIGUgPSAwOyBlIDwgZDsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gYyhiW2VdLCBhW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT0gZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGEgPSBuYShiLmxlbmd0aCwgYS5sZW5ndGgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE9sID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAhIU1nKE5sLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiID09PSBhOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFFsID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGMgPSBfLkhnKEpoKS5hZGQoYSwgWwogICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgXSwgewogICAgICAgICAgICAgICAgICAgIFJhOiBjLAogICAgICAgICAgICAgICAgICAgIGZvcm1hdDogYgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBhID0gYy5zbG90SWQ7CiAgICAgICAgICAgICAgICBjID0gYy5KYTsKICAgICAgICAgICAgICAgIGlmIChhICYmIGMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoNSA9PT0gYiAmJiBfLkgoUGwpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB3KGMsIDE1LCBiKTsKICAgICAgICAgICAgICAgICAgICBfLnpsKGEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB3aW5kb3csIGUgPSBBaChiKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IF8uQmgoZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGQuYWRDb3VudCAmJiBkLmFkQ291bnRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmICYmIChkLmFkQ291bnRbZV0gPSBmIC0gMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBhICYmIHZvaWQgMCAhPT0gYSA/IGEgOiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICBSbCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5SZWZsZWN0LmNvbnN0cnVjdChhLkhUTUxFbGVtZW50LCBbXSwgdGhpcy5jb25zdHJ1Y3Rvcik7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUgPSBhLkhUTUxFbGVtZW50LnByb3RvdHlwZTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLmNvbnN0cnVjdG9yID0gYjsKICAgICAgICAgICAgICAgIF8udChPYmplY3QsICdzZXRQcm90b3R5cGVPZicpLmNhbGwoT2JqZWN0LCBiLCBhLkhUTUxFbGVtZW50KTsKICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICAkbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gd2luZG93OwogICAgICAgICAgICAgICAgdmFyIGIgPSB2b2lkIDAgPT09IGIgPyByYiA6IGI7CiAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgIGlmIChhLmN1c3RvbUVsZW1lbnRzICYmIG51bGwgIT09IChjID0gYS5SZWZsZWN0KSAmJiB2b2lkIDAgIT09IGMgJiYgYy5jb25zdHJ1Y3QgJiYgIWEuY3VzdG9tRWxlbWVudHMuZ2V0KCdnb29nbGUtcHJvZHVjdC1hZCcpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBSbChhKSwgZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBfLk8oZSwgZCk7CiAgICAgICAgICAgICAgICAgICAgZS5wcm90b3R5cGUuY29ubmVjdGVkQ2FsbGJhY2sgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gdGhpcy5kYXRhc2V0LnJlbmRlcmluZzsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBTbChUbCwgVWwoZikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGcgfHwgdm9pZCAwID09PSBnID8gMCA6IFlmKGcsIDEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBuZXcgVmwoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gUWIoaCwgNCwgMSwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IFFiKGgsIDIsIDcsIDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBXZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBRYihoLCAzLCBmLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IFdiKGcsIFdsLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gemYoaCwgNSwgZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSBKayhoLCA2LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMaCgpLmVycm9yKFhsKCdpbnZhbGlkIGRhdGEtcmVuZGVyaW5nIGF0dHJpYnV0ZScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBudWxsID09PSBnIHx8IHZvaWQgMCA9PT0gZyA/IHZvaWQgMCA6IGxrKGcsIDIpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIExoKCkuZXJyb3IoWGwoJ21pc3NpbmcgZGF0YS1yZW5kZXJpbmcgYXR0cmlidXRlJykpOwogICAgICAgICAgICAgICAgICAgICAgICAoZyA9IGspICYmIGIoWWwod2luZG93LCBnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGggJiYgWmwoaCk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBhLmN1c3RvbUVsZW1lbnRzLmRlZmluZSgnZ29vZ2xlLXByb2R1Y3QtYWQnLCBlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgZG0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gXy55KF8udChBcnJheSwgJ2Zyb20nKS5jYWxsKEFycmF5LCBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnc2NyaXB0JykpKSwgYiA9IGEubmV4dCgpOyAhYi5kb25lOyBiID0gYS5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGIudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgYiA9IGM7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBjLnNyYzsKICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiAoLTEgIT0gZC5pbmRleE9mKCcvdGFnL2pzL2dwdC5qcycpIHx8IC0xICE9IGQuaW5kZXhPZignL3RhZy9qcy9ncHRfbW9iaWxlLmpzJykpICYmICFiLmdvb2dsZXRhZ19leGVjdXRlZCAmJiBjLnRleHRDb250ZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIuZ29vZ2xldGFnX2V4ZWN1dGVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdzY3JpcHQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMudGV4dENvbnRlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbnVsbCA9PT0gKGQgPSBLYSgpKSB8fCB2b2lkIDAgPT09IGQgPyB2b2lkIDAgOiBkLmNyZWF0ZVNjcmlwdChjKTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IG5ldyBhbShudWxsICE9PSBlICYmIHZvaWQgMCAhPT0gZSA/IGUgOiBjLCBfLk1hKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgaW5zdGFuY2VvZiBibSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjIGluc3RhbmNlb2YgYW0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMuajsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBjIGluc3RhbmNlb2YgY20gJiYgYy5jb25zdHJ1Y3RvciA9PT0gY20gPyBjLmogOiAndHlwZV9lcnJvcjpTYWZlU2NyaXB0JzsKICAgICAgICAgICAgICAgICAgICAgICAgYi50ZXh0Q29udGVudCA9IGM7CiAgICAgICAgICAgICAgICAgICAgICAgIGFiKGIpOwogICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5oZWFkLmFwcGVuZENoaWxkKGIpOwogICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5oZWFkLnJlbW92ZUNoaWxkKGIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgZ20gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBbXTsKICAgICAgICAgICAgICAgIGIgPSBfLkhnKEpoKTsKICAgICAgICAgICAgICAgIGIgPSBbXS5jb25jYXQoXy5sYyhiLmNhKSkuc2xpY2UoKTsKICAgICAgICAgICAgICAgIGlmIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFBcnJheS5pc0FycmF5KGEpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShMaCgpLCBXZygnZ29vZ2xldGFnLmRlc3Ryb3lTbG90cycsIFthXSkpLCAhMTsKICAgICAgICAgICAgICAgICAgICBtYShhKTsKICAgICAgICAgICAgICAgICAgICBiID0gYi5maWx0ZXIoZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8udChhLCAnaW5jbHVkZXMnKS5jYWxsKGEsIGMuaik7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoIWIubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIGVtKGIpOwogICAgICAgICAgICAgICAgZm0oYik7CiAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGhtID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEsIGI7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGRtKCk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgcmYoMjk3LCBjKSwgbnVsbCA9PT0gKGIgPSBudWxsID09PSAoYSA9IHdpbmRvdy5jb25zb2xlKSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBhLmVycm9yKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLmNhbGwoYSwgYyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIG9tID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB3aW5kb3csIGIgPSBuZXcgaW0oYSk7CiAgICAgICAgICAgICAgICBLZyhiKS50aGVuKF8ubWYoODk0LCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIG9mKCdjbXBNZXQnLCBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICBkZihkKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZXcgam0oYSksIGYgPSBuZXcga20oYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIEkoZCwgJ2ZjJywgTnVtYmVyKG51bGwgIT09IGMgJiYgdm9pZCAwICE9PSBjID8gYyA6IDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgSShkLCAndGNmdjEnLCBhLl9fY21wID8gMSA6IDApOwogICAgICAgICAgICAgICAgICAgICAgICBJKGQsICd0Y2Z2MicsIGxtKGUpID8gMSA6IDApOwogICAgICAgICAgICAgICAgICAgICAgICBJKGQsICd1c3AnLCBtbShmKSA/IDEgOiAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgSShkLCAncHR0JywgMTcpOwogICAgICAgICAgICAgICAgICAgIH0sIHsgcGE6IF8uemMobm0pIH0pOwogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBybSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gV2UoKSwgYiA9IENjKHdpbmRvdyksIGMgPSBuZXcgcG0oKSwgZCA9IF8uemMocW0pOwogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBpYzogYSwKICAgICAgICAgICAgICAgICAgICBjZTogYiwKICAgICAgICAgICAgICAgICAgICBzYjogYywKICAgICAgICAgICAgICAgICAgICBCYzogMCA8IGQgJiYgSGQoKSA8IDEgLyBkLAogICAgICAgICAgICAgICAgICAgIFRkOiBkCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICBzbSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IDA7CiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiIDwgYS5sZW5ndGggPyB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICExLAogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogYVtiKytdCiAgICAgICAgICAgICAgICAgICAgfSA6IHsgZG9uZTogITAgfTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHRtID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgT2JqZWN0LmRlZmluZVByb3BlcnRpZXMgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkgOiBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgaWYgKGEgPT0gQXJyYXkucHJvdG90eXBlIHx8IGEgPT0gT2JqZWN0LnByb3RvdHlwZSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIGFbYl0gPSBjLnZhbHVlOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHVtID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgPSBbCiAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT0gdHlwZW9mIGdsb2JhbFRoaXMgJiYgZ2xvYmFsVGhpcywKICAgICAgICAgICAgICAgICAgICBhLAogICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09IHR5cGVvZiB3aW5kb3cgJiYgd2luZG93LAogICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09IHR5cGVvZiBzZWxmICYmIHNlbGYsCiAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT0gdHlwZW9mIGdsb2JhbCAmJiBnbG9iYWwKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gMDsgYiA8IGEubGVuZ3RoOyArK2IpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGFbYl07CiAgICAgICAgICAgICAgICAgICAgaWYgKGMgJiYgYy5NYXRoID09IE1hdGgpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0Nhbm5vdCBmaW5kIGdsb2JhbCBvYmplY3QnKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdm0gPSB1bSh0aGlzKTsKICAgICAgICAgICAgd20gPSAnZnVuY3Rpb24nID09PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09PSB0eXBlb2YgU3ltYm9sKCd4Jyk7CiAgICAgICAgICAgIHYgPSB7fTsKICAgICAgICAgICAgeG0gPSB7fTsKICAgICAgICAgICAgXy50ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0geG1bYl07CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBjKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhW2JdOwogICAgICAgICAgICAgICAgYyA9IGFbY107CiAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBjID8gYyA6IGFbYl07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHltID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGlmIChiKQogICAgICAgICAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAxID09PSBkLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkWzBdLCBmOwogICAgICAgICAgICAgICAgICAgICAgICAhYSAmJiBlIGluIHYgPyBmID0gdiA6IGYgPSB2bTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IGQubGVuZ3RoIC0gMTsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShnIGluIGYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gZltnXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBkID0gZFtkLmxlbmd0aCAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgICBjID0gd20gJiYgJ2VzNicgPT09IGMgPyBmW2RdIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGIoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT0gYiAmJiAoYSA/IHRtKHYsIGQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogYgogICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGIgIT09IGMgJiYgKHZvaWQgMCA9PT0geG1bZF0gJiYgKGEgPSAxMDAwMDAwMDAwICogTWF0aC5yYW5kb20oKSA+Pj4gMCwgeG1bZF0gPSB3bSA/IHZtLlN5bWJvbChkKSA6ICckanNjcCQnICsgYSArICckJyArIGQpLCB0bShmLCB4bVtkXSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBiCiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB5bSgnU3ltYm9sJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgdmFyIGIgPSBmdW5jdGlvbiAoZiwgZykgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IGY7CiAgICAgICAgICAgICAgICAgICAgdG0odGhpcywgJ2Rlc2NyaXB0aW9uJywgewogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBnCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuajsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgYyA9ICdqc2NvbXBfc3ltYm9sXycgKyAoMTAwMDAwMDAwMCAqIE1hdGgucmFuZG9tKCkgPj4+IDApICsgJ18nLCBkID0gMCwgZSA9IGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzIGluc3RhbmNlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1N5bWJvbCBpcyBub3QgYSBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGIoYyArIChmIHx8ICcnKSArICdfJyArIGQrKywgZik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHltKCdTeW1ib2wuaXRlcmF0b3InLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICBhID0gKDAsIHYuU3ltYm9sKSgnU3ltYm9sLml0ZXJhdG9yJyk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gJ0FycmF5IEludDhBcnJheSBVaW50OEFycmF5IFVpbnQ4Q2xhbXBlZEFycmF5IEludDE2QXJyYXkgVWludDE2QXJyYXkgSW50MzJBcnJheSBVaW50MzJBcnJheSBGbG9hdDMyQXJyYXkgRmxvYXQ2NEFycmF5Jy5zcGxpdCgnICcpLCBjID0gMDsgYyA8IGIubGVuZ3RoOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHZtW2JbY11dOwogICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT09IHR5cGVvZiBkICYmICdmdW5jdGlvbicgIT0gdHlwZW9mIGQucHJvdG90eXBlW2FdICYmIHRtKGQucHJvdG90eXBlLCBhLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6bShzbSh0aGlzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHptID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgPSB7IG5leHQ6IGEgfTsKICAgICAgICAgICAgICAgIGFbXy50KHYuU3ltYm9sLCAnaXRlcmF0b3InKV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFAgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEucmF3ID0gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy55ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHYuU3ltYm9sICYmIF8udCh2LlN5bWJvbCwgJ2l0ZXJhdG9yJykgJiYgYVtfLnQodi5TeW1ib2wsICdpdGVyYXRvcicpXTsKICAgICAgICAgICAgICAgIHJldHVybiBiID8gYi5jYWxsKGEpIDogeyBuZXh0OiBzbShhKSB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICBBbSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiLCBjID0gW107ICEoYiA9IGEubmV4dCgpKS5kb25lOykKICAgICAgICAgICAgICAgICAgICBjLnB1c2goYi52YWx1ZSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5sYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSBpbnN0YW5jZW9mIEFycmF5ID8gYSA6IEFtKF8ueShhKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEJtID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgT2JqZWN0LmNyZWF0ZSA/IE9iamVjdC5jcmVhdGUgOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUgPSBhOwogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBiKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIENtID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgZnVuY3Rpb24gYSgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBuZXcgYygpOwogICAgICAgICAgICAgICAgICAgIF8udCh2LlJlZmxlY3QsICdjb25zdHJ1Y3QnKS5jYWxsKHYuUmVmbGVjdCwgYywgW10sIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGMoKSBpbnN0YW5jZW9mIGM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAod20gJiYgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHYuUmVmbGVjdCAmJiBfLnQodi5SZWZsZWN0LCAnY29uc3RydWN0JykpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYSgpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXy50KHYuUmVmbGVjdCwgJ2NvbnN0cnVjdCcpOwogICAgICAgICAgICAgICAgICAgIHZhciBiID0gXy50KHYuUmVmbGVjdCwgJ2NvbnN0cnVjdCcpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICBjID0gYihjLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiBfLnQodi5SZWZsZWN0LCAnc2V0UHJvdG90eXBlT2YnKS5jYWxsKHYuUmVmbGVjdCwgYywgZS5wcm90b3R5cGUpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBlICYmIChlID0gYyk7CiAgICAgICAgICAgICAgICAgICAgZSA9IEJtKGUucHJvdG90eXBlIHx8IE9iamVjdC5wcm90b3R5cGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBGdW5jdGlvbi5wcm90b3R5cGUuYXBwbHkuY2FsbChjLCBlLCBkKSB8fCBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSgpOwogICAgICAgICAgICBpZiAod20gJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgXy50KE9iamVjdCwgJ3NldFByb3RvdHlwZU9mJykpCiAgICAgICAgICAgICAgICBEbSA9IF8udChPYmplY3QsICdzZXRQcm90b3R5cGVPZicpOwogICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgIHZhciBFbTsKICAgICAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgICAgICB2YXIgRm0gPSB7IGE6ICEwIH0sIEdtID0ge307CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgR20uX19wcm90b19fID0gRm07CiAgICAgICAgICAgICAgICAgICAgICAgIEVtID0gR20uYTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChhKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIEVtID0gITE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBEbSA9IEVtID8gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBhLl9fcHJvdG9fXyA9IGI7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEuX19wcm90b19fICE9PSBiKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKGEgKyAnIGlzIG5vdCBleHRlbnNpYmxlJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9IDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBIbSA9IERtOwogICAgICAgICAgICBfLk8gPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgYS5wcm90b3R5cGUgPSBCbShiLnByb3RvdHlwZSk7CiAgICAgICAgICAgICAgICBhLnByb3RvdHlwZS5jb25zdHJ1Y3RvciA9IGE7CiAgICAgICAgICAgICAgICBpZiAoSG0pCiAgICAgICAgICAgICAgICAgICAgSG0oYSwgYik7CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyBpbiBiKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3Byb3RvdHlwZScgIT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuZGVmaW5lUHJvcGVydGllcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihiLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkICYmIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShhLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbY10gPSBiW2NdOwogICAgICAgICAgICAgICAgYS5WZiA9IGIucHJvdG90eXBlOwogICAgICAgICAgICB9OwogICAgICAgICAgICBJbSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMubCA9ICExOwogICAgICAgICAgICAgICAgdGhpcy5BID0gbnVsbDsKICAgICAgICAgICAgICAgIHRoaXMubSA9IHZvaWQgMDsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IDE7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSB0aGlzLkYgPSAwOwogICAgICAgICAgICAgICAgdGhpcy5EID0gbnVsbDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSm0gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKGEubCkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdHZW5lcmF0b3IgaXMgYWxyZWFkeSBydW5uaW5nJyk7CiAgICAgICAgICAgICAgICBhLmwgPSAhMDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSW0ucHJvdG90eXBlLm8gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5tID0gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEttID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGEuRCA9IHsKICAgICAgICAgICAgICAgICAgICBJYzogYiwKICAgICAgICAgICAgICAgICAgICBOZDogITAKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBhLmogPSBhLkYgfHwgYS5COwogICAgICAgICAgICB9OwogICAgICAgICAgICBJbS5wcm90b3R5cGUucmV0dXJuID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuRCA9IHsgcmV0dXJuOiBhIH07CiAgICAgICAgICAgICAgICB0aGlzLmogPSB0aGlzLkI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBqYiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYS5qID0gYzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geyB2YWx1ZTogYiB9OwogICAgICAgICAgICAgICAgfSwgTG0gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEuaiA9IDA7CiAgICAgICAgICAgICAgICB9LCBsYiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYS5qID0gYjsKICAgICAgICAgICAgICAgICAgICBhLkYgPSAwOwogICAgICAgICAgICAgICAgfSwgbWIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEuRiA9IDA7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLkQuSWM7CiAgICAgICAgICAgICAgICAgICAgYS5EID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0sIE1tID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBuZXcgSW0oKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSBhOwogICAgICAgICAgICAgICAgfSwgUG0gPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIEptKGEuaik7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmouQTsKICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5tKGEsICdyZXR1cm4nIGluIGMgPyBjWydyZXR1cm4nXSA6IGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9LCBiLCBhLmoucmV0dXJuKTsKICAgICAgICAgICAgICAgICAgICBhLmoucmV0dXJuKGIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBPbShhKTsKICAgICAgICAgICAgICAgIH0sIE5tID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGIuY2FsbChhLmouQSwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiBPYmplY3QpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSXRlcmF0b3IgcmVzdWx0ICcgKyBlICsgJyBpcyBub3QgYW4gb2JqZWN0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5kb25lKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuai5sID0gITEsIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gZS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmouQSA9IG51bGwsIEttKGEuaiwgZyksIE9tKGEpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBhLmouQSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgZC5jYWxsKGEuaiwgZik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9tKGEpOwogICAgICAgICAgICAgICAgfSwgT20gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGZvciAoOyBhLmouajspCiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEubShhLmopOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuai5sID0gITEsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGIudmFsdWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5qLm0gPSB2b2lkIDAsIEttKGEuaiwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBhLmoubCA9ICExOwogICAgICAgICAgICAgICAgICAgIGlmIChhLmouRCkgewogICAgICAgICAgICAgICAgICAgICAgICBiID0gYS5qLkQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuai5EID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIuTmQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBiLkljOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGIucmV0dXJuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITAKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgUW0gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMubmV4dCA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEptKGEuaik7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuai5BID8gYiA9IE5tKGEsIGEuai5BLm5leHQsIGIsIGEuai5vKSA6IChhLmoubyhiKSwgYiA9IE9tKGEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnRocm93ID0gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgSm0oYS5qKTsKICAgICAgICAgICAgICAgICAgICAgICAgYS5qLkEgPyBiID0gTm0oYSwgYS5qLkFbJ3Rocm93J10sIGIsIGEuai5vKSA6IChLbShhLmosIGIpLCBiID0gT20oYSkpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRoaXMucmV0dXJuID0gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBtKGEsIGIpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhpc1tfLnQodi5TeW1ib2wsICdpdGVyYXRvcicpXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIFJtID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubmV4dChkKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLnRocm93KGQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHYuUHJvbWlzZShmdW5jdGlvbiAoZCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcuZG9uZSA/IGQoZy52YWx1ZSkgOiB2LlByb21pc2UucmVzb2x2ZShnLnZhbHVlKS50aGVuKGIsIGMpLnRoZW4oZiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZihhLm5leHQoKSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBpYiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFJtKG5ldyBRbShuZXcgTW0oYSkpKTsKICAgICAgICAgICAgICAgIH0sIGdjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSBOdW1iZXIodGhpcyksIGIgPSBbXSwgYyA9IGE7IGMgPCBhcmd1bWVudHMubGVuZ3RoOyBjKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGJbYyAtIGFdID0gYXJndW1lbnRzW2NdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgeW0oJ1JlZmxlY3QnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhIDoge307CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgeW0oJ1JlZmxlY3QuY29uc3RydWN0JywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIENtOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHltKCdSZWZsZWN0LnNldFByb3RvdHlwZU9mJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IEhtID8gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSG0oYiwgYyksICEwOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gOiBudWxsOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHltKCdQcm9taXNlJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBnIGluc3RhbmNlb2YgZSA/IGcgOiBuZXcgZShmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICBoKGcpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS5tID0gZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSB0aGlzLmopIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5GKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGguRCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qLnB1c2goZyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIGQgPSB2bS5zZXRUaW1lb3V0OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuRiA9IGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgZChnLCAwKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS5EID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZvciAoOyB0aGlzLmogJiYgdGhpcy5qLmxlbmd0aDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSB0aGlzLmo7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBoID0gMDsgaCA8IGcubGVuZ3RoOyArK2gpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBrID0gZ1toXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdbaF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5BKGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IG51bGw7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuQSA9IGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5GKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZzsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tID0gMDsKICAgICAgICAgICAgICAgICAgICB0aGlzLkYgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gW107CiAgICAgICAgICAgICAgICAgICAgdGhpcy5vID0gITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGggPSB0aGlzLkEoKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBnKGgucmVzb2x2ZSwgaC5yZWplY3QpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgaC5yZWplY3Qoayk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUucHJvdG90eXBlLkEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgayB8fCAoayA9ICEwLCBsLmNhbGwoaCwgbSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IHRoaXMsIGsgPSAhMTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlOiBnKHRoaXMuVCksCiAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdDogZyh0aGlzLkQpCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLnByb3RvdHlwZS5UID0gZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZyA9PT0gdGhpcykKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5EKG5ldyBUeXBlRXJyb3IoJ0EgUHJvbWlzZSBjYW5ub3QgcmVzb2x2ZSB0byBpdHNlbGYnKSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZyBpbnN0YW5jZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuSihnKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgYToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodHlwZW9mIGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ29iamVjdCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBudWxsICE9IGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Z1bmN0aW9uJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBoID8gdGhpcy5SKGcpIDogdGhpcy5sKGcpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLnByb3RvdHlwZS5SID0gZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBoID0gZy50aGVuOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5EKGspOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT0gdHlwZW9mIGggPyB0aGlzLk4oaCwgZykgOiB0aGlzLmwoZyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5wcm90b3R5cGUuRCA9IGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5CKDIsIGcpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUucHJvdG90eXBlLmwgPSBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIHRoaXMuQigxLCBnKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLnByb3RvdHlwZS5CID0gZnVuY3Rpb24gKGcsIGgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMCAhPSB0aGlzLm0pCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdDYW5ub3Qgc2V0dGxlKCcgKyBnICsgJywgJyArIGggKyAnKTogUHJvbWlzZSBhbHJlYWR5IHNldHRsZWQgaW4gc3RhdGUnICsgdGhpcy5tKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSBnOwogICAgICAgICAgICAgICAgICAgIHRoaXMuRiA9IGg7CiAgICAgICAgICAgICAgICAgICAgMiA9PT0gdGhpcy5tICYmIHRoaXMuRygpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuTSgpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUucHJvdG90eXBlLkcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgIGQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZy5pYSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IHZtLmNvbnNvbGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGggJiYgaC5lcnJvcihnLkYpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgMSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5wcm90b3R5cGUuaWEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMubykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHZhciBnID0gdm0uQ3VzdG9tRXZlbnQsIGggPSB2bS5FdmVudCwgayA9IHZtLmRpc3BhdGNoRXZlbnQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnID09PSB0eXBlb2YgaykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT09IHR5cGVvZiBnID8gZyA9IG5ldyBnKCd1bmhhbmRsZWRyZWplY3Rpb24nLCB7IGNhbmNlbGFibGU6ICEwIH0pIDogJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGggPyBnID0gbmV3IGgoJ3VuaGFuZGxlZHJlamVjdGlvbicsIHsgY2FuY2VsYWJsZTogITAgfSkgOiAoZyA9IHZtLmRvY3VtZW50LmNyZWF0ZUV2ZW50KCdDdXN0b21FdmVudCcpLCBnLmluaXRDdXN0b21FdmVudCgndW5oYW5kbGVkcmVqZWN0aW9uJywgITEsICEwLCBnKSk7CiAgICAgICAgICAgICAgICAgICAgZy5wcm9taXNlID0gdGhpczsKICAgICAgICAgICAgICAgICAgICBnLnJlYXNvbiA9IHRoaXMuRjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gayhnKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLnByb3RvdHlwZS5NID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IHRoaXMuaikgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBnID0gMDsgZyA8IHRoaXMuai5sZW5ndGg7ICsrZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYubSh0aGlzLmpbZ10pOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBudWxsOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgZiA9IG5ldyBiKCk7CiAgICAgICAgICAgICAgICBlLnByb3RvdHlwZS5KID0gZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IHRoaXMuQSgpOwogICAgICAgICAgICAgICAgICAgIGcueGIoaC5yZXNvbHZlLCBoLnJlamVjdCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5wcm90b3R5cGUuTiA9IGZ1bmN0aW9uIChnLCBoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSB0aGlzLkEoKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBnLmNhbGwoaCwgay5yZXNvbHZlLCBrLnJlamVjdCk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobCkgewogICAgICAgICAgICAgICAgICAgICAgICBrLnJlamVjdChsKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5wcm90b3R5cGUudGhlbiA9IGZ1bmN0aW9uIChnLCBoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gayhxLCB1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09IHR5cGVvZiBxID8gZnVuY3Rpb24gKEIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbChxKEIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtKHgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IDogdTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGwsIG0sIG4gPSBuZXcgZShmdW5jdGlvbiAocSwgdSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IHE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtID0gdTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy54YihrKGcsIGwpLCBrKGgsIG0pKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLnByb3RvdHlwZS5jYXRjaCA9IGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudGhlbih2b2lkIDAsIGcpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUucHJvdG90eXBlLnhiID0gZnVuY3Rpb24gKGcsIGgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBrKCkgewogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGwubSkgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnKGwuRik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgaChsLkYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignVW5leHBlY3RlZCBzdGF0ZTogJyArIGwubSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgIG51bGwgPT0gdGhpcy5qID8gZi5tKGspIDogdGhpcy5qLnB1c2goayk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5vID0gITA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5yZXNvbHZlID0gYzsKICAgICAgICAgICAgICAgIGUucmVqZWN0ID0gZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGUoZnVuY3Rpb24gKGgsIGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgayhnKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLnJhY2UgPSBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgZShmdW5jdGlvbiAoaCwgaykgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBsID0gXy55KGcpLCBtID0gbC5uZXh0KCk7ICFtLmRvbmU7IG0gPSBsLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMobS52YWx1ZSkueGIoaCwgayk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5hbGwgPSBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIHZhciBoID0gXy55KGcpLCBrID0gaC5uZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGsuZG9uZSA/IGMoW10pIDogbmV3IGUoZnVuY3Rpb24gKGwsIG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihCKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxW0JdID0geDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LS07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCA9PSB1ICYmIGwocSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBxID0gW10sIHUgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICBkbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcS5wdXNoKHZvaWQgMCksIHUrKywgYyhrLnZhbHVlKS54YihuKHEubGVuZ3RoIC0gMSksIG0pLCBrID0gaC5uZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlICghay5kb25lKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICB5bSgnT2JqZWN0LnNldFByb3RvdHlwZU9mJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhIHx8IEhtOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHZhciBTbSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChhLCBiKTsKICAgICAgICAgICAgICAgIH0sIFRtID0gd20gJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgXy50KE9iamVjdCwgJ2Fzc2lnbicpID8gXy50KE9iamVjdCwgJ2Fzc2lnbicpIDogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMTsgYyA8IGFyZ3VtZW50cy5sZW5ndGg7IGMrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGFyZ3VtZW50c1tjXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlIGluIGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU20oZCwgZSkgJiYgKGFbZV0gPSBkW2VdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB5bSgnT2JqZWN0LmFzc2lnbicsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSB8fCBUbTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICB5bSgnV2Vha01hcCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKCkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhnKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGggPSB0eXBlb2YgZzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT09IGggJiYgbnVsbCAhPT0gZyB8fCAnZnVuY3Rpb24nID09PSBoOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8ICFPYmplY3Quc2VhbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gT2JqZWN0LnNlYWwoe30pLCBoID0gT2JqZWN0LnNlYWwoe30pLCBrID0gbmV3IGEoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMiAhPSBrLmdldChnKSB8fCAzICE9IGsuZ2V0KGgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsuZGVsZXRlKGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgay5zZXQoaCwgNCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWsuaGFzKGcpICYmIDQgPT0gay5nZXQoaCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIHZhciBkID0gJyRqc2NvbXBfaGlkZGVuXycgKyBNYXRoLnJhbmRvbSgpLCBlID0gMCwgZiA9IGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IChlICs9IE1hdGgucmFuZG9tKCkgKyAxKS50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IF8ueShnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGg7ICEoaCA9IGcubmV4dCgpKS5kb25lOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gaC52YWx1ZSwgdGhpcy5zZXQoaFswXSwgaFsxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZi5wcm90b3R5cGUuc2V0ID0gZnVuY3Rpb24gKGcsIGgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIWMoZykpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdJbnZhbGlkIFdlYWtNYXAga2V5Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFTbShnLCBkKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IG5ldyBiKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRtKGcsIGQsIHsgdmFsdWU6IGsgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICghU20oZywgZCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdXZWFrTWFwIGtleSBmYWlsOiAnICsgZyk7CiAgICAgICAgICAgICAgICAgICAgZ1tkXVt0aGlzLmpdID0gaDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmLnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjKGcpICYmIFNtKGcsIGQpID8gZ1tkXVt0aGlzLmpdIDogdm9pZCAwOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGYucHJvdG90eXBlLmhhcyA9IGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoZykgJiYgU20oZywgZCkgJiYgU20oZ1tkXSwgdGhpcy5qKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmLnByb3RvdHlwZS5kZWxldGUgPSBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjKGcpICYmIFNtKGcsIGQpICYmIFNtKGdbZF0sIHRoaXMuaikgPyBkZWxldGUgZ1tkXVt0aGlzLmpdIDogITE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgeW0oJ01hcCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBpZiAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWEgfHwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgYSB8fCAhXy50KGEucHJvdG90eXBlLCAnZW50cmllcycpIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIE9iamVjdC5zZWFsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBPYmplY3Quc2VhbCh7IHg6IDQgfSksIGsgPSBuZXcgYShfLnkoW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgncycgIT0gay5nZXQoaCkgfHwgMSAhPSBrLnNpemUgfHwgay5nZXQoeyB4OiA0IH0pIHx8IGsuc2V0KHsgeDogNCB9LCAndCcpICE9IGsgfHwgMiAhPSBrLnNpemUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBfLnQoaywgJ2VudHJpZXMnKS5jYWxsKGspLCBtID0gbC5uZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobS5kb25lIHx8IG0udmFsdWVbMF0gIT0gaCB8fCAncycgIT0gbS52YWx1ZVsxXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtID0gbC5uZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbS5kb25lIHx8IDQgIT0gbS52YWx1ZVswXS54IHx8ICd0JyAhPSBtLnZhbHVlWzFdIHx8ICFsLm5leHQoKS5kb25lID8gITEgOiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSgpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgdmFyIGIgPSBuZXcgdi5XZWFrTWFwKCksIGMgPSBmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gZigpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNpemUgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IF8ueShoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGs7ICEoayA9IGgubmV4dCgpKS5kb25lOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrID0gay52YWx1ZSwgdGhpcy5zZXQoa1swXSwga1sxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuc2V0ID0gZnVuY3Rpb24gKGgsIGspIHsKICAgICAgICAgICAgICAgICAgICBoID0gMCA9PT0gaCA/IDAgOiBoOwogICAgICAgICAgICAgICAgICAgIHZhciBsID0gZCh0aGlzLCBoKTsKICAgICAgICAgICAgICAgICAgICBsLmxpc3QgfHwgKGwubGlzdCA9IHRoaXMubVtsLmlkXSA9IFtdKTsKICAgICAgICAgICAgICAgICAgICBsLm9hID8gbC5vYS52YWx1ZSA9IGsgOiAobC5vYSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogdGhpcy5qLAogICAgICAgICAgICAgICAgICAgICAgICBJYTogdGhpcy5qLklhLAogICAgICAgICAgICAgICAgICAgICAgICBoZWFkOiB0aGlzLmosCiAgICAgICAgICAgICAgICAgICAgICAgIGtleTogaCwKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGsKICAgICAgICAgICAgICAgICAgICB9LCBsLmxpc3QucHVzaChsLm9hKSwgdGhpcy5qLklhLm5leHQgPSBsLm9hLCB0aGlzLmouSWEgPSBsLm9hLCB0aGlzLnNpemUrKyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuZGVsZXRlID0gZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICBoID0gZCh0aGlzLCBoKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaC5vYSAmJiBoLmxpc3QgPyAoaC5saXN0LnNwbGljZShoLmluZGV4LCAxKSwgaC5saXN0Lmxlbmd0aCB8fCBkZWxldGUgdGhpcy5tW2guaWRdLCBoLm9hLklhLm5leHQgPSBoLm9hLm5leHQsIGgub2EubmV4dC5JYSA9IGgub2EuSWEsIGgub2EuaGVhZCA9IG51bGwsIHRoaXMuc2l6ZS0tLCAhMCkgOiAhMTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBjLnByb3RvdHlwZS5jbGVhciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSB7fTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSB0aGlzLmouSWEgPSBmKCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zaXplID0gMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBjLnByb3RvdHlwZS5oYXMgPSBmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWQodGhpcywgaCkub2E7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuZ2V0ID0gZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGggPSBkKHRoaXMsIGgpLm9hKSAmJiBoLnZhbHVlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLmVudHJpZXMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodGhpcywgZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgua2V5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaC52YWx1ZQogICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLmtleXMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodGhpcywgZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGgua2V5OwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLnZhbHVlcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0aGlzLCBmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBjLnByb3RvdHlwZS5mb3JFYWNoID0gZnVuY3Rpb24gKGgsIGspIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBsID0gXy50KHRoaXMsICdlbnRyaWVzJykuY2FsbCh0aGlzKSwgbTsgIShtID0gbC5uZXh0KCkpLmRvbmU7KQogICAgICAgICAgICAgICAgICAgICAgICBtID0gbS52YWx1ZSwgaC5jYWxsKGssIG1bMV0sIG1bMF0sIHRoaXMpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlW18udCh2LlN5bWJvbCwgJ2l0ZXJhdG9yJyldID0gXy50KGMucHJvdG90eXBlLCAnZW50cmllcycpOwogICAgICAgICAgICAgICAgdmFyIGQgPSBmdW5jdGlvbiAoaCwgaykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGsgJiYgdHlwZW9mIGs7CiAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09IGwgfHwgJ2Z1bmN0aW9uJyA9PSBsID8gYi5oYXMoaykgPyBsID0gYi5nZXQoaykgOiAobCA9ICcnICsgKytnLCBiLnNldChrLCBsKSkgOiBsID0gJ3BfJyArIGs7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gaC5tW2xdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobSAmJiBTbShoLm0sIGwpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChoID0gMDsgaCA8IG0ubGVuZ3RoOyBoKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG1baF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGsgIT09IGsgJiYgbi5rZXkgIT09IG4ua2V5IHx8IGsgPT09IG4ua2V5KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0OiBtLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYTogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0OiBtLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IC0xLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb2E6IHZvaWQgMAogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGUgPSBmdW5jdGlvbiAoaCwgaykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGguajsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHptKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGwuaGVhZCAhPSBoLmo7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsID0gbC5JYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbC5uZXh0ICE9IGwuaGVhZDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsID0gbC5uZXh0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBrKGwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB2b2lkIDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIGYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoLklhID0gaC5uZXh0ID0gaC5oZWFkID0gaDsKICAgICAgICAgICAgICAgICAgICB9LCBnID0gMDsKICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHZhciBVbSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBhKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1RoZSBcJ3RoaXNcJyB2YWx1ZSBmb3IgU3RyaW5nLnByb3RvdHlwZS4nICsgYyArICcgbXVzdCBub3QgYmUgbnVsbCBvciB1bmRlZmluZWQnKTsKICAgICAgICAgICAgICAgIGlmIChiIGluc3RhbmNlb2YgUmVnRXhwKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ZpcnN0IGFyZ3VtZW50IHRvIFN0cmluZy5wcm90b3R5cGUuJyArIGMgKyAnIG11c3Qgbm90IGJlIGEgcmVndWxhciBleHByZXNzaW9uJyk7CiAgICAgICAgICAgICAgICByZXR1cm4gYSArICcnOwogICAgICAgICAgICB9OwogICAgICAgICAgICB5bSgnU3RyaW5nLnByb3RvdHlwZS5lbmRzV2l0aCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gVW0odGhpcywgYiwgJ2VuZHNXaXRoJyk7CiAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBjICYmIChjID0gZC5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIGMgPSBNYXRoLm1heCgwLCBNYXRoLm1pbihjIHwgMCwgZC5sZW5ndGgpKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYi5sZW5ndGg7IDAgPCBlICYmIDAgPCBjOykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRbLS1jXSAhPSBiWy0tZV0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPj0gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgdmFyIFZtID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGEgaW5zdGFuY2VvZiBTdHJpbmcgJiYgKGEgPSBTdHJpbmcoYSkpOwogICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IGEubGVuZ3RoLCBlID0gMDsgZSA8IGQ7IGUrKykgewogICAgICAgICAgICAgICAgICAgIHZhciBmID0gYVtlXTsKICAgICAgICAgICAgICAgICAgICBpZiAoYi5jYWxsKGMsIGYsIGUsIGEpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVkOiBmCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgIGk6IC0xLAogICAgICAgICAgICAgICAgICAgIGVkOiB2b2lkIDAKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHltKCdBcnJheS5wcm90b3R5cGUuZmluZCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBWbSh0aGlzLCBiLCBjKS5lZDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgdmFyIFdtID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGEgaW5zdGFuY2VvZiBTdHJpbmcgJiYgKGEgKz0gJycpOwogICAgICAgICAgICAgICAgdmFyIGMgPSAwLCBkID0gITEsIGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZCAmJiBjIDwgYS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGMrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogYihmLCBhW2ZdKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGVbXy50KHYuU3ltYm9sLCAnaXRlcmF0b3InKV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHltKCdBcnJheS5wcm90b3R5cGUuZW50cmllcycsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFdtKHRoaXMsIGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYwogICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICB5bSgnU3RyaW5nLnByb3RvdHlwZS5zdGFydHNXaXRoJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBVbSh0aGlzLCBiLCAnc3RhcnRzV2l0aCcpLCBlID0gZC5sZW5ndGgsIGYgPSBiLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICBjID0gTWF0aC5tYXgoMCwgTWF0aC5taW4oYyB8IDAsIGQubGVuZ3RoKSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyA9IDA7IGcgPCBmICYmIGMgPCBlOykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRbYysrXSAhPSBiW2crK10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcgPj0gZjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgeW0oJ051bWJlci5pc0Zpbml0ZScsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnbnVtYmVyJyAhPT0gdHlwZW9mIGIgPyAhMSA6ICFpc05hTihiKSAmJiBJbmZpbml0eSAhPT0gYiAmJiAtSW5maW5pdHkgIT09IGI7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHltKCdnbG9iYWxUaGlzJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhIHx8IHZtOwogICAgICAgICAgICB9LCAnZXNfMjAyMCcpOwogICAgICAgICAgICB5bSgnQXJyYXkucHJvdG90eXBlLmZpbmRJbmRleCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBWbSh0aGlzLCBiLCBjKS5pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICB5bSgnU2V0JywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYSB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBhIHx8ICFfLnQoYS5wcm90b3R5cGUsICdlbnRyaWVzJykgfHwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgT2JqZWN0LnNlYWwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IE9iamVjdC5zZWFsKHsgeDogNCB9KSwgZCA9IG5ldyBhKF8ueShbY10pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZC5oYXMoYykgfHwgMSAhPSBkLnNpemUgfHwgZC5hZGQoYykgIT0gZCB8fCAxICE9IGQuc2l6ZSB8fCBkLmFkZCh7IHg6IDQgfSkgIT0gZCB8fCAyICE9IGQuc2l6ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF8udChkLCAnZW50cmllcycpLmNhbGwoZCksIGYgPSBlLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmLmRvbmUgfHwgZi52YWx1ZVswXSAhPSBjIHx8IGYudmFsdWVbMV0gIT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gZS5uZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZi5kb25lIHx8IGYudmFsdWVbMF0gPT0gYyB8fCA0ICE9IGYudmFsdWVbMF0ueCB8fCBmLnZhbHVlWzFdICE9IGYudmFsdWVbMF0gPyAhMSA6IGUubmV4dCgpLmRvbmU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIHZhciBiID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBuZXcgdi5NYXAoKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBjID0gXy55KGMpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkOyAhKGQgPSBjLm5leHQoKSkuZG9uZTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZChkLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zaXplID0gdGhpcy5qLnNpemU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gMCA9PT0gYyA/IDAgOiBjOwogICAgICAgICAgICAgICAgICAgIHRoaXMuai5zZXQoYywgYyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zaXplID0gdGhpcy5qLnNpemU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuZGVsZXRlID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gdGhpcy5qLmRlbGV0ZShjKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNpemUgPSB0aGlzLmouc2l6ZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS5jbGVhciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmouY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNpemUgPSAwOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLmhhcyA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuai5oYXMoYyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuZW50cmllcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gXy50KHRoaXMuaiwgJ2VudHJpZXMnKS5jYWxsKHRoaXMuaik7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUudmFsdWVzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBfLnQodGhpcy5qLCAndmFsdWVzJykuY2FsbCh0aGlzLmopOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLmtleXMgPSBfLnQoYi5wcm90b3R5cGUsICd2YWx1ZXMnKTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlW18udCh2LlN5bWJvbCwgJ2l0ZXJhdG9yJyldID0gXy50KGIucHJvdG90eXBlLCAndmFsdWVzJyk7CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS5mb3JFYWNoID0gZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qLmZvckVhY2goZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuY2FsbChkLCBmLCBmLCBlKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICB5bSgnT2JqZWN0LmVudHJpZXMnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhIDogZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IFtdLCBkOwogICAgICAgICAgICAgICAgICAgIGZvciAoZCBpbiBiKQogICAgICAgICAgICAgICAgICAgICAgICBTbShiLCBkKSAmJiBjLnB1c2goWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJbZF0KICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LCAnZXM4Jyk7CiAgICAgICAgICAgIHltKCdBcnJheS5wcm90b3R5cGUua2V5cycsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFdtKHRoaXMsIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICB5bSgnQXJyYXkuZnJvbScsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIGMgPSBudWxsICE9IGMgPyBjIDogZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGg7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFtdLCBmID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHYuU3ltYm9sICYmIF8udCh2LlN5bWJvbCwgJ2l0ZXJhdG9yJykgJiYgYltfLnQodi5TeW1ib2wsICdpdGVyYXRvcicpXTsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZikgewogICAgICAgICAgICAgICAgICAgICAgICBiID0gZi5jYWxsKGIpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBnID0gMDsgIShmID0gYi5uZXh0KCkpLmRvbmU7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wdXNoKGMuY2FsbChkLCBmLnZhbHVlLCBnKyspKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChmID0gYi5sZW5ndGgsIGcgPSAwOyBnIDwgZjsgZysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wdXNoKGMuY2FsbChkLCBiW2ddLCBnKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHltKCdBcnJheS5wcm90b3R5cGUudmFsdWVzJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gV20odGhpcywgZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LCAnZXM4Jyk7CiAgICAgICAgICAgIHltKCdPYmplY3QudmFsdWVzJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBbXSwgZDsKICAgICAgICAgICAgICAgICAgICBmb3IgKGQgaW4gYikKICAgICAgICAgICAgICAgICAgICAgICAgU20oYiwgZCkgJiYgYy5wdXNoKGJbZF0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzOCcpOwogICAgICAgICAgICB5bSgnT2JqZWN0LmlzJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgPT09IGMgPyAwICE9PSBiIHx8IDEgLyBiID09PSAxIC8gYyA6IGIgIT09IGIgJiYgYyAhPT0gYzsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgeW0oJ0FycmF5LnByb3RvdHlwZS5pbmNsdWRlcycsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gdGhpczsKICAgICAgICAgICAgICAgICAgICBkIGluc3RhbmNlb2YgU3RyaW5nICYmIChkID0gU3RyaW5nKGQpKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGQubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIGMgPSBjIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgZm9yICgwID4gYyAmJiAoYyA9IE1hdGgubWF4KGMgKyBlLCAwKSk7IGMgPCBlOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBkW2NdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZiA9PT0gYiB8fCBfLnQoT2JqZWN0LCAnaXMnKS5jYWxsKE9iamVjdCwgZiwgYikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczcnKTsKICAgICAgICAgICAgeW0oJ1N0cmluZy5wcm90b3R5cGUuaW5jbHVkZXMnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhIDogZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgIT09IFVtKHRoaXMsIGIsICdpbmNsdWRlcycpLmluZGV4T2YoYiwgYyB8fCAwKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgeW0oJ051bWJlci5pc0ludGVnZXInLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhIDogZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gXy50KE51bWJlciwgJ2lzRmluaXRlJykuY2FsbChOdW1iZXIsIGIpID8gYiA9PT0gTWF0aC5mbG9vcihiKSA6ICExOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICB5bSgnT2JqZWN0LmZyb21FbnRyaWVzJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB7fTsKICAgICAgICAgICAgICAgICAgICBpZiAoIShfLnQodi5TeW1ib2wsICdpdGVyYXRvcicpIGluIGIpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCcnICsgYiArICcgaXMgbm90IGl0ZXJhYmxlJyk7CiAgICAgICAgICAgICAgICAgICAgYiA9IGJbXy50KHYuU3ltYm9sLCAnaXRlcmF0b3InKV0uY2FsbChiKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gYi5uZXh0KCk7ICFkLmRvbmU7IGQgPSBiLm5leHQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICBkID0gZC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdChkKSAhPT0gZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ2l0ZXJhYmxlIGZvciBmcm9tRW50cmllcyBzaG91bGQgeWllbGQgb2JqZWN0cycpOwogICAgICAgICAgICAgICAgICAgICAgICBjW2RbMF1dID0gZFsxXTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LCAnZXNfMjAxOScpOwogICAgICAgICAgICB5bSgnTnVtYmVyLmlzTmFOJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09PSB0eXBlb2YgYiAmJiBpc05hTihiKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgXy5yID0gdGhpcyB8fCBzZWxmOwogICAgICAgICAgICBYbSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhLlVhID0gdm9pZCAwOwogICAgICAgICAgICAgICAgYS5PID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLlVhID8gYS5VYSA6IGEuVWEgPSBuZXcgYSgpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYWggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSB0eXBlb2YgYTsKICAgICAgICAgICAgICAgIGIgPSAnb2JqZWN0JyAhPSBiID8gYiA6IGEgPyBBcnJheS5pc0FycmF5KGEpID8gJ2FycmF5JyA6IGIgOiAnbnVsbCc7CiAgICAgICAgICAgICAgICByZXR1cm4gJ2FycmF5JyA9PSBiIHx8ICdvYmplY3QnID09IGIgJiYgJ251bWJlcicgPT0gdHlwZW9mIGEubGVuZ3RoOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLmphID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gdHlwZW9mIGE7CiAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT0gYiAmJiBudWxsICE9IGEgfHwgJ2Z1bmN0aW9uJyA9PSBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBsYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGEsIFltKSAmJiBhW1ltXSB8fCAoYVtZbV0gPSArK1ptKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWW0gPSAnY2xvc3VyZV91aWRfJyArICgxMDAwMDAwMDAwICogTWF0aC5yYW5kb20oKSA+Pj4gMCk7CiAgICAgICAgICAgIFptID0gMDsKICAgICAgICAgICAgJG0gPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgcmV0dXJuIGEuY2FsbC5hcHBseShhLmJpbmQsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGFuID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGlmICghYSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcigpOwogICAgICAgICAgICAgICAgaWYgKDIgPCBhcmd1bWVudHMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXkucHJvdG90eXBlLnVuc2hpZnQuYXBwbHkoZSwgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmFwcGx5KGIsIGUpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmFwcGx5KGIsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLmJuID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIEZ1bmN0aW9uLnByb3RvdHlwZS5iaW5kICYmIC0xICE9IEZ1bmN0aW9uLnByb3RvdHlwZS5iaW5kLnRvU3RyaW5nKCkuaW5kZXhPZignbmF0aXZlIGNvZGUnKSA/IF8uYm4gPSAkbSA6IF8uYm4gPSBhbjsKICAgICAgICAgICAgICAgIHJldHVybiBfLmJuLmFwcGx5KG51bGwsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uY24gPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGMuc2xpY2UoKTsKICAgICAgICAgICAgICAgICAgICBkLnB1c2guYXBwbHkoZCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hcHBseSh0aGlzLCBkKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHhkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIERhdGUubm93KCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBkbjsKICAgICAgICAgICAgdmFyIGVkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IGEgPT09IGVuICYmIGIgfHwgJyc7CiAgICAgICAgICAgICAgICB0aGlzLm0gPSBmbjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZWQucHJvdG90eXBlLkhhID0gITA7CiAgICAgICAgICAgIGVkLnByb3RvdHlwZS5FYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmo7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBmZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgaW5zdGFuY2VvZiBlZCAmJiBhLmNvbnN0cnVjdG9yID09PSBlZCAmJiBhLm0gPT09IGZuID8gYS5qIDogJ3R5cGVfZXJyb3I6Q29uc3QnOwogICAgICAgICAgICAgICAgfSwgZ24gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgZWQoZW4sIGEpOwogICAgICAgICAgICAgICAgfSwgZm4gPSB7fSwgZW4gPSB7fTsKICAgICAgICAgICAgdmFyIHFiID0gZ24oJ2h0dHBzOi8vdHBjLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9zb2Rhci8le2Jhc2VuYW1lfS5qcycpOwogICAgICAgICAgICB2YXIgam47CiAgICAgICAgICAgIF8uZGEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LnByb3RvdHlwZS5pbmRleE9mLmNhbGwoYSwgYiwgdm9pZCAwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5obiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBBcnJheS5wcm90b3R5cGUuZm9yRWFjaC5jYWxsKGEsIGIsIHZvaWQgMCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uQ2QgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LnByb3RvdHlwZS5maWx0ZXIuY2FsbChhLCBiLCB2b2lkIDApOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLkFkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5wcm90b3R5cGUubWFwLmNhbGwoYSwgYiwgdm9pZCAwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgam4gPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LnByb3RvdHlwZS5yZWR1Y2UuY2FsbChhLCBiLCAwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5SZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkucHJvdG90eXBlLnNvbWUuY2FsbChhLCBiLCB2b2lkIDApOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgd2EgPSAnY29uc3RydWN0b3IgaGFzT3duUHJvcGVydHkgaXNQcm90b3R5cGVPZiBwcm9wZXJ0eUlzRW51bWVyYWJsZSB0b0xvY2FsZVN0cmluZyB0b1N0cmluZyB2YWx1ZU9mJy5zcGxpdCgnICcpOwogICAgICAgICAgICB2YXIgcWQgPSB7CiAgICAgICAgICAgICAgICBhcmVhOiAhMCwKICAgICAgICAgICAgICAgIGJhc2U6ICEwLAogICAgICAgICAgICAgICAgYnI6ICEwLAogICAgICAgICAgICAgICAgY29sOiAhMCwKICAgICAgICAgICAgICAgIGNvbW1hbmQ6ICEwLAogICAgICAgICAgICAgICAgZW1iZWQ6ICEwLAogICAgICAgICAgICAgICAgaHI6ICEwLAogICAgICAgICAgICAgICAgaW1nOiAhMCwKICAgICAgICAgICAgICAgIGlucHV0OiAhMCwKICAgICAgICAgICAgICAgIGtleWdlbjogITAsCiAgICAgICAgICAgICAgICBsaW5rOiAhMCwKICAgICAgICAgICAgICAgIG1ldGE6ICEwLAogICAgICAgICAgICAgICAgcGFyYW06ICEwLAogICAgICAgICAgICAgICAgc291cmNlOiAhMCwKICAgICAgICAgICAgICAgIHRyYWNrOiAhMCwKICAgICAgICAgICAgICAgIHdicjogITAKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGtuID0ge30sIGNtID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBiID09PSBrbiA/IGEgOiAnJzsKICAgICAgICAgICAgICAgICAgICB0aGlzLkhhID0gITA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBjbS5wcm90b3R5cGUuRWEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5qLnRvU3RyaW5nKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGNtLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmoudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGhkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IGIgPT09IHZuID8gYSA6ICcnOwogICAgICAgICAgICB9OwogICAgICAgICAgICBoZC5wcm90b3R5cGUuSGEgPSAhMDsKICAgICAgICAgICAgaGQucHJvdG90eXBlLkVhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuai50b1N0cmluZygpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBoZC5wcm90b3R5cGUuamMgPSAhMDsKICAgICAgICAgICAgaGQucHJvdG90eXBlLlphID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB5biA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBhID0gWGEoYSkudG9TdHJpbmcoKTsKICAgICAgICAgICAgICAgIGEgPSB3bi5leGVjKGEpOwogICAgICAgICAgICAgICAgdmFyIGMgPSBhWzNdIHx8ICcnOwogICAgICAgICAgICAgICAgcmV0dXJuIGVpKGFbMV0gKyB4bignPycsIGFbMl0gfHwgJycsIGIpICsgeG4oJyMnLCBjLCB2b2lkIDApKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgaGQucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaiArICcnOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWGEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhIGluc3RhbmNlb2YgaGQgJiYgYS5jb25zdHJ1Y3RvciA9PT0gaGQgPyBhLmogOiAndHlwZV9lcnJvcjpUcnVzdGVkUmVzb3VyY2VVcmwnOwogICAgICAgICAgICAgICAgfSwgcGIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gZmQoYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCF6bi50ZXN0KGMpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignSW52YWxpZCBUcnVzdGVkUmVzb3VyY2VVcmwgZm9ybWF0OiAnICsgYyk7CiAgICAgICAgICAgICAgICAgICAgYSA9IGMucmVwbGFjZShBbiwgZnVuY3Rpb24gKGQsIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYiwgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignRm91bmQgbWFya2VyLCAiJyArIGUgKyAnIiwgaW4gZm9ybWF0IHN0cmluZywgIicgKyBjICsgJyIsIGJ1dCBubyB2YWxpZCBsYWJlbCBtYXBwaW5nIGZvdW5kIGluIGFyZ3M6ICcgKyBKU09OLnN0cmluZ2lmeShiKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBiW2VdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCBpbnN0YW5jZW9mIGVkID8gZmQoZCkgOiBlbmNvZGVVUklDb21wb25lbnQoU3RyaW5nKGQpKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWkoYSk7CiAgICAgICAgICAgICAgICB9LCBBbiA9IC8leyhcdyspfS9nLCB6biA9IFJlZ0V4cCgnXigoaHR0cHM6KT8vL1swLTlhLXouOltcXF0tXSsvfC9bXi9cXFxcXXxbXjovXFxcXCVdKy98W146L1xcXFwlXSpbPyNdfGFib3V0OmJsYW5rIyknLCAnaScpLCB3biA9IC9eKFtePyNdKikoXD9bXiNdKik/KCNbXHNcU10qKT8vLCB2biA9IHt9LCBlaSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBoZChhLCB2bik7CiAgICAgICAgICAgICAgICB9LCB4biA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09PSB0eXBlb2YgYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgPyBhICsgZW5jb2RlVVJJQ29tcG9uZW50KGMpIDogJyc7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCBpbiBjKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGMsIGQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGNbZF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gQXJyYXkuaXNBcnJheShlKSA/IGUgOiBbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBmID0gMDsgZiA8IGUubGVuZ3RoOyBmKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGVbZl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSBnICYmIChiIHx8IChiID0gYSksIGIgKz0gKGIubGVuZ3RoID4gYS5sZW5ndGggPyAnJicgOiAnJykgKyBlbmNvZGVVUklDb21wb25lbnQoZCkgKyAnPScgKyBlbmNvZGVVUklDb21wb25lbnQoU3RyaW5nKGcpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBCbiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmxlbmd0aCAtIGIubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAwIDw9IGMgJiYgYS5pbmRleE9mKGIsIGMpID09IGM7CiAgICAgICAgICAgICAgICB9LCAkZyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC9eW1xzXHhhMF0qJC8udGVzdChhKTsKICAgICAgICAgICAgICAgIH0sIENuID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gL15bXHNceGEwXSooW1xzXFNdKj8pW1xzXHhhMF0qJC8uZXhlYyhhKVsxXTsKICAgICAgICAgICAgICAgIH0sIHBkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYikKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEucmVwbGFjZShEbiwgJyZhbXA7JykucmVwbGFjZShFbiwgJyZsdDsnKS5yZXBsYWNlKEZuLCAnJmd0OycpLnJlcGxhY2UoR24sICcmcXVvdDsnKS5yZXBsYWNlKEhuLCAnJiMzOTsnKS5yZXBsYWNlKEluLCAnJiMwOycpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUpuLnRlc3QoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgLTEgIT0gYS5pbmRleE9mKCcmJykgJiYgKGEgPSBhLnJlcGxhY2UoRG4sICcmYW1wOycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgLTEgIT0gYS5pbmRleE9mKCc8JykgJiYgKGEgPSBhLnJlcGxhY2UoRW4sICcmbHQ7JykpOwogICAgICAgICAgICAgICAgICAgICAgICAtMSAhPSBhLmluZGV4T2YoJz4nKSAmJiAoYSA9IGEucmVwbGFjZShGbiwgJyZndDsnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIC0xICE9IGEuaW5kZXhPZignIicpICYmIChhID0gYS5yZXBsYWNlKEduLCAnJnF1b3Q7JykpOwogICAgICAgICAgICAgICAgICAgICAgICAtMSAhPSBhLmluZGV4T2YoJ1wnJykgJiYgKGEgPSBhLnJlcGxhY2UoSG4sICcmIzM5OycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgLTEgIT0gYS5pbmRleE9mKCdcMCcpICYmIChhID0gYS5yZXBsYWNlKEluLCAnJiMwOycpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9LCBEbiA9IC8mL2csIEVuID0gLzwvZywgRm4gPSAvPi9nLCBHbiA9IC8iL2csIEhuID0gLycvZywgSW4gPSAvXHgwMC9nLCBKbiA9IC9bXHgwMCY8PiInXS8sIE9rID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IDA7CiAgICAgICAgICAgICAgICAgICAgYSA9IENuKFN0cmluZyhhKSkuc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgICAgICBiID0gQ24oU3RyaW5nKGIpKS5zcGxpdCgnLicpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSBNYXRoLm1heChhLmxlbmd0aCwgYi5sZW5ndGgpLCBlID0gMDsgMCA9PSBjICYmIGUgPCBkOyBlKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBhW2VdIHx8ICcnLCBnID0gYltlXSB8fCAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IC8oXGQqKShcRCopKC4qKS8uZXhlYyhmKSB8fCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gLyhcZCopKFxEKikoLiopLy5leGVjKGcpIHx8IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09IGZbMF0ubGVuZ3RoICYmIDAgPT0gZ1swXS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gS24oMCA9PSBmWzFdLmxlbmd0aCA/IDAgOiBwYXJzZUludChmWzFdLCAxMCksIDAgPT0gZ1sxXS5sZW5ndGggPyAwIDogcGFyc2VJbnQoZ1sxXSwgMTApKSB8fCBLbigwID09IGZbMl0ubGVuZ3RoLCAwID09IGdbMl0ubGVuZ3RoKSB8fCBLbihmWzJdLCBnWzJdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBmWzNdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGdbM107CiAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKDAgPT0gYyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSwgS24gPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhIDwgYiA/IC0xIDogYSA+IGIgPyAxIDogMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBpZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gYiA9PT0gbGQgPyBhIDogJyc7CiAgICAgICAgICAgICAgICB9LCBuZCwgbWQsIGtkLCBsZCwgb2Q7CiAgICAgICAgICAgIHAgPSBpZC5wcm90b3R5cGU7CiAgICAgICAgICAgIHAuSGEgPSAhMDsKICAgICAgICAgICAgcC5FYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmoudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5qYyA9ICEwOwogICAgICAgICAgICBwLlphID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5qLnRvU3RyaW5nKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uamQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgaW5zdGFuY2VvZiBpZCAmJiBhLmNvbnN0cnVjdG9yID09PSBpZCA/IGEuaiA6ICd0eXBlX2Vycm9yOlNhZmVVcmwnOwogICAgICAgICAgICB9OwogICAgICAgICAgICBuZCA9IFJlZ0V4cCgnXig/OmF1ZGlvLyg/OjNncHAyfDNncHB8YWFjfEwxNnxtaWRpfG1wM3xtcDR8bXBlZ3xvZ2F8b2dnfG9wdXN8eC1tNGF8eC1tYXRyb3NrYXx4LXdhdnx3YXZ8d2VibSl8Zm9udC9cXHcrfGltYWdlLyg/OmJtcHxnaWZ8anBlZ3xqcGd8cG5nfHRpZmZ8d2VicHx4LWljb24pfHZpZGVvLyg/Om1wZWd8bXA0fG9nZ3x3ZWJtfHF1aWNrdGltZXx4LW1hdHJvc2thKSkoPzo7XFx3Kz0oPzpcXHcrfCJbXFx3Oyw9IF0rIikpKiQnLCAnaScpOwogICAgICAgICAgICBtZCA9IC9eZGF0YTooLiopO2Jhc2U2NCxbYS16MC05K1wvXSs9KiQvaTsKICAgICAgICAgICAga2QgPSAvXig/Oig/Omh0dHBzP3xtYWlsdG98ZnRwKTp8W146Lz8jXSooPzpbLz8jXXwkKSkvaTsKICAgICAgICAgICAgbGQgPSB7fTsKICAgICAgICAgICAgb2QgPSBuZXcgaWQoJ2Fib3V0OmludmFsaWQjekNsb3N1cmV6JywgbGQpOwogICAgICAgICAgICB2YXIgTG4gPSB7fSwgTW4gPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IGMgPT09IExuID8gYSA6ICcnOwogICAgICAgICAgICAgICAgICAgIHRoaXMubSA9IGI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5IYSA9IHRoaXMuamMgPSAhMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIE1uLnByb3RvdHlwZS5aYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE1uLnByb3RvdHlwZS5FYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmoudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTW4ucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuai50b1N0cmluZygpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVWEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhIGluc3RhbmNlb2YgTW4gJiYgYS5jb25zdHJ1Y3RvciA9PT0gTW4gPyBhLmogOiAndHlwZV9lcnJvcjpTYWZlSHRtbCc7CiAgICAgICAgICAgICAgICB9LCBObiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEgaW5zdGFuY2VvZiBNbikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSAnb2JqZWN0JyA9PSB0eXBlb2YgYSwgYyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgYiAmJiBhLmpjICYmIChjID0gYS5aYSgpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2QocGQoYiAmJiBhLkhhID8gYS5FYSgpIDogU3RyaW5nKGEpKSwgYyk7CiAgICAgICAgICAgICAgICB9LCBQbiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBObihPbiksIGMgPSBiLlphKCksIGQgPSBbXSwgZSA9IGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBBcnJheS5pc0FycmF5KGYpID8gZi5mb3JFYWNoKGUpIDogKGYgPSBObihmKSwgZC5wdXNoKFVhKGYpLnRvU3RyaW5nKCkpLCBmID0gZi5aYSgpLCAwID09IGMgPyBjID0gZiA6IDAgIT0gZiAmJiBjICE9IGYgJiYgKGMgPSBudWxsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYS5mb3JFYWNoKGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBzZChkLmpvaW4oVWEoYikudG9TdHJpbmcoKSksIGMpOwogICAgICAgICAgICAgICAgfSwgcmQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBQbihBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMpKTsKICAgICAgICAgICAgICAgIH0sIHNkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IE1uKGEsIGIsIExuKTsKICAgICAgICAgICAgICAgIH0sIGNkID0gL15bYS16QS1aMC05LV0rJC8sIGdkID0gewogICAgICAgICAgICAgICAgICAgIGFjdGlvbjogITAsCiAgICAgICAgICAgICAgICAgICAgY2l0ZTogITAsCiAgICAgICAgICAgICAgICAgICAgZGF0YTogITAsCiAgICAgICAgICAgICAgICAgICAgZm9ybWFjdGlvbjogITAsCiAgICAgICAgICAgICAgICAgICAgaHJlZjogITAsCiAgICAgICAgICAgICAgICAgICAgbWFuaWZlc3Q6ICEwLAogICAgICAgICAgICAgICAgICAgIHBvc3RlcjogITAsCiAgICAgICAgICAgICAgICAgICAgc3JjOiAhMAogICAgICAgICAgICAgICAgfSwgZGQgPSB7CiAgICAgICAgICAgICAgICAgICAgQVBQTEVUOiAhMCwKICAgICAgICAgICAgICAgICAgICBCQVNFOiAhMCwKICAgICAgICAgICAgICAgICAgICBFTUJFRDogITAsCiAgICAgICAgICAgICAgICAgICAgSUZSQU1FOiAhMCwKICAgICAgICAgICAgICAgICAgICBMSU5LOiAhMCwKICAgICAgICAgICAgICAgICAgICBNQVRIOiAhMCwKICAgICAgICAgICAgICAgICAgICBNRVRBOiAhMCwKICAgICAgICAgICAgICAgICAgICBPQkpFQ1Q6ICEwLAogICAgICAgICAgICAgICAgICAgIFNDUklQVDogITAsCiAgICAgICAgICAgICAgICAgICAgU1RZTEU6ICEwLAogICAgICAgICAgICAgICAgICAgIFNWRzogITAsCiAgICAgICAgICAgICAgICAgICAgVEVNUExBVEU6ICEwCiAgICAgICAgICAgICAgICB9LCBPbiA9IG5ldyBNbihfLnIudHJ1c3RlZFR5cGVzICYmIF8uci50cnVzdGVkVHlwZXMuZW1wdHlIVE1MIHx8ICcnLCAwLCBMbik7CiAgICAgICAgICAgIF8uTWEgPSB7fTsKICAgICAgICAgICAgdmFyIEphOwogICAgICAgICAgICB2YXIgVGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB9LCBMYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gYTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhMYSwgVGEpOwogICAgICAgICAgICBMYS5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5qLnRvU3RyaW5nKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBXYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH0sIE9hID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBhOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKE9hLCBXYSk7CiAgICAgICAgICAgIE9hLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmoudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGJtID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgfSwgYW0gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IGE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oYW0sIGJtKTsKICAgICAgICAgICAgYW0ucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuai50b1N0cmluZygpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLlFuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICB9OwogICAgICAgICAgICBfLlJuID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhfLlJuLCBfLlFuKTsKICAgICAgICAgICAgXy5Sbi5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5qOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLlNuID0gbmV3IF8uUm4oJ2Fib3V0OmludmFsaWQjelRTeicsIF8uTWEpOwogICAgICAgICAgICB2YXIgVG4sIFVuLCB0ZywgV247CiAgICAgICAgICAgIFRuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICB9OwogICAgICAgICAgICBVbiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhYS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdGcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSAhMSwgYzsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYiB8fCAoYyA9IGEoKSwgYiA9ICEwKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uVm4gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBhOwogICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGI7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBjKCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgV24gPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgdmFyIGQgPSAwLCBlID0gITEsIGYgPSBbXSwgZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgJiYgKGUgPSAhMSwgaCgpKTsKICAgICAgICAgICAgICAgICAgICB9LCBoID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBkID0gXy5yLnNldFRpbWVvdXQoZywgYik7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBrID0gZjsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBhLmFwcGx5KGMsIGspOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGspIHsKICAgICAgICAgICAgICAgICAgICBmID0gYXJndW1lbnRzOwogICAgICAgICAgICAgICAgICAgIGQgPyBlID0gITAgOiBoKCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZGI7CiAgICAgICAgICAgIGRiID0gdGcoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSAhMTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBPYmplY3QuZGVmaW5lUHJvcGVydHkoe30sICdwYXNzaXZlJywgewogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIF8uci5hZGRFdmVudExpc3RlbmVyKCd0ZXN0JywgbnVsbCwgYik7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIF8uZmIgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEuYWRkRXZlbnRMaXN0ZW5lciA/IChhLmFkZEV2ZW50TGlzdGVuZXIoYiwgYywgZWIoZCkpLCAhMCkgOiAhMTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5MYyA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYS5yZW1vdmVFdmVudExpc3RlbmVyID8gKGEucmVtb3ZlRXZlbnRMaXN0ZW5lcihiLCBjLCBlYihkKSksICEwKSA6ICExOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIga2IgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB2LlByb21pc2UoZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkXzIyZDg4NDM2YTlmNTEwMDkgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKSwgJF9fX29sZF9iNWQyYTU1MmYxNDlmZTAyID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0Jyk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMjJkODg0MzZhOWY1MTAwOSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzAwNDY1Mjg0MDA0ZDRhYTguWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYjVkMmE1NTJmMTQ5ZmUwMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzAwNDY1Mjg0MDA0ZDRhYTguWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gbmV3IFhNTEh0dHBSZXF1ZXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnJlYWR5U3RhdGUgPT09IGQuRE9ORSAmJiAoMjAwIDw9IGQuc3RhdHVzICYmIDMwMCA+IGQuc3RhdHVzID8gYihKU09OLnBhcnNlKGQucmVzcG9uc2VUZXh0KSkgOiBjKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQub3BlbignR0VUJywgYSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5zZW5kKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8yMmQ4ODQzNmE5ZjUxMDA5KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX29sZF8yMmQ4ODQzNmE5ZjUxMDA5KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2I1ZDJhNTUyZjE0OWZlMDIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkX2I1ZDJhNTUyZjE0OWZlMDIpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHViLCBzYiA9ICd1bmRlZmluZWQnICE9PSB0eXBlb2YgVGV4dEVuY29kZXI7CiAgICAgICAgICAgIHZhciBYbiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBYblsnICddKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFhuWycgJ10gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBZbiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFhuKGFbYl0pLCAhMDsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0sIFpuID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICBkID0gZCA/IGQoYikgOiBiOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgZCkgPyBhW2RdIDogYVtkXSA9IGMoYik7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgJG4sIGJvLCBjbywgZW8sIGZvLCBnbywgaG8sIGlvOwogICAgICAgICAgICAkbiA9IEFhKCdPcGVyYScpOwogICAgICAgICAgICBfLmFvID0gQ2EoKTsKICAgICAgICAgICAgYm8gPSBBYSgnRWRnZScpOwogICAgICAgICAgICBjbyA9IEFhKCdHZWNrbycpICYmICEoLTEgIT0gemEoKS50b0xvd2VyQ2FzZSgpLmluZGV4T2YoJ3dlYmtpdCcpICYmICFBYSgnRWRnZScpKSAmJiAhKEFhKCdUcmlkZW50JykgfHwgQWEoJ01TSUUnKSkgJiYgIUFhKCdFZGdlJyk7CiAgICAgICAgICAgIGVvID0gLTEgIT0gemEoKS50b0xvd2VyQ2FzZSgpLmluZGV4T2YoJ3dlYmtpdCcpICYmICFBYSgnRWRnZScpOwogICAgICAgICAgICBmbyA9IGVvICYmIEFhKCdNb2JpbGUnKTsKICAgICAgICAgICAgZ28gPSBBYSgnQW5kcm9pZCcpOwogICAgICAgICAgICBobyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gXy5yLmRvY3VtZW50OwogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhLmRvY3VtZW50TW9kZSA6IHZvaWQgMDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgdmFyIGpvID0gJycsIGtvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHphKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAvcnY6KFteXCk7XSspKFwpfDspLy5leGVjKGEpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYm8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gL0VkZ2VcLyhbXGRcLl0rKS8uZXhlYyhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKF8uYW8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gL1xiKD86TVNJRXxydilbOiBdKFteXCk7XSspKFwpfDspLy5leGVjKGEpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZW8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gL1dlYktpdFwvKFxTKykvLmV4ZWMoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAvKD86VmVyc2lvbilbIFwvXT8oXFMrKS8uZXhlYyhhKTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBrbyAmJiAoam8gPSBrbyA/IGtvWzFdIDogJycpOwogICAgICAgICAgICAgICAgaWYgKF8uYW8pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbG8gPSBobygpOwogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IGxvICYmIGxvID4gcGFyc2VGbG9hdChqbykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaW8gPSBTdHJpbmcobG8pOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlvID0gam87CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIG1vID0gaW8sIG5vID0ge30sIG9vID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gWm4obm8sIGEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPD0gT2sobW8sIGEpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgcG87CiAgICAgICAgICAgIGlmIChfLnIuZG9jdW1lbnQgJiYgXy5hbykgewogICAgICAgICAgICAgICAgdmFyIHFvID0gaG8oKTsKICAgICAgICAgICAgICAgIHBvID0gcW8gPyBxbyA6IHBhcnNlSW50KG1vLCAxMCkgfHwgdm9pZCAwOwogICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgIHBvID0gdm9pZCAwOwogICAgICAgICAgICB2YXIgcm8gPSBwbzsKICAgICAgICAgICAgIUFhKCdBbmRyb2lkJykgfHwgRWEoKTsKICAgICAgICAgICAgRWEoKTsKICAgICAgICAgICAgRmEoKTsKICAgICAgICAgICAgdmFyIHNvID0ge30sIHRvID0gbnVsbCwgdW8gPSBjbyB8fCBlbyB8fCAnZnVuY3Rpb24nID09IHR5cGVvZiBfLnIuYnRvYSwgRWIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gYiAmJiAoYiA9IDApOwogICAgICAgICAgICAgICAgICAgIHZvKCk7CiAgICAgICAgICAgICAgICAgICAgYiA9IHNvW2JdOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBBcnJheShNYXRoLmZsb29yKGEubGVuZ3RoIC8gMykpLCBkID0gYls2NF0gfHwgJycsIGUgPSAwLCBmID0gMDsgZSA8IGEubGVuZ3RoIC0gMjsgZSArPSAzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gYVtlXSwgaCA9IGFbZSArIDFdLCBrID0gYVtlICsgMl0sIGwgPSBiW2cgPj4gMl07CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBiWyhnICYgMykgPDwgNCB8IGggPj4gNF07CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSBiWyhoICYgMTUpIDw8IDIgfCBrID4+IDZdOwogICAgICAgICAgICAgICAgICAgICAgICBrID0gYltrICYgNjNdOwogICAgICAgICAgICAgICAgICAgICAgICBjW2YrK10gPSBsICsgZyArIGggKyBrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBsID0gMDsKICAgICAgICAgICAgICAgICAgICBrID0gZDsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGEubGVuZ3RoIC0gZSkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGFbZSArIDFdLCBrID0gYlsobCAmIDE1KSA8PCAyXSB8fCBkOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGFbZV0sIGNbZl0gPSBiW2EgPj4gMl0gKyBiWyhhICYgMykgPDwgNCB8IGwgPj4gNF0gKyBrICsgZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuam9pbignJyk7CiAgICAgICAgICAgICAgICB9LCB3byA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHVvICYmICFiKQogICAgICAgICAgICAgICAgICAgICAgICBhID0gXy5yLmJ0b2EoYSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBbXSwgZCA9IDAsIGUgPSAwOyBlIDwgYS5sZW5ndGg7IGUrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBhLmNoYXJDb2RlQXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNTUgPCBmICYmIChjW2QrK10gPSBmICYgMjU1LCBmID4+PSA4KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNbZCsrXSA9IGY7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYSA9IEViKGMsIGIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0sIFVsID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9ICcnOwogICAgICAgICAgICAgICAgICAgIHhvKGEsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShjKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0sIHhvID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGQgPCBhLmxlbmd0aDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gYS5jaGFyQXQoZCsrKSwgbSA9IHRvW2xdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gbSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghJGcobCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1Vua25vd24gYmFzZTY0IGVuY29kaW5nIGF0IGNoYXI6ICcgKyBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdm8oKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gMDs7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYygtMSksIGYgPSBjKDApLCBnID0gYyg2NCksIGggPSBjKDY0KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDY0ID09PSBoICYmIC0xID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGIoZSA8PCAyIHwgZiA+PiA0KTsKICAgICAgICAgICAgICAgICAgICAgICAgNjQgIT0gZyAmJiAoYihmIDw8IDQgJiAyNDAgfCBnID4+IDIpLCA2NCAhPSBoICYmIGIoZyA8PCA2ICYgMTkyIHwgaCkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHZvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGlmICghdG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdG8gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9ICdBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OScuc3BsaXQoJycpLCBiID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnKy89JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJysvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy1fPScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICctXy4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLV8nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgYyA9IDA7IDUgPiBjOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gYS5jb25jYXQoYltjXS5zcGxpdCgnJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc29bY10gPSBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IDA7IGUgPCBkLmxlbmd0aDsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBkW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gdG9bZl0gJiYgKHRvW2ZdID0gZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQ2IgPSAnZnVuY3Rpb24nID09PSB0eXBlb2YgVWludDhBcnJheTsKICAgICAgICAgICAgdmFyIHdiID0gMCwgeGIgPSAwOwogICAgICAgICAgICB2YXIgeW8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBbXTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgeW8ucHJvdG90eXBlLmxlbmd0aCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmoubGVuZ3RoOwogICAgICAgICAgICB9OwogICAgICAgICAgICB5by5wcm90b3R5cGUuZW5kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLmo7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBbXTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgem8gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSB3YiwgYyA9IHhiOyAwIDwgYyB8fCAxMjcgPCBiOykKICAgICAgICAgICAgICAgICAgICAgICAgYS5qLnB1c2goYiAmIDEyNyB8IDEyOCksIGIgPSAoYiA+Pj4gNyB8IGMgPDwgMjUpID4+PiAwLCBjID4+Pj0gNzsKICAgICAgICAgICAgICAgICAgICBhLmoucHVzaChiKTsKICAgICAgICAgICAgICAgIH0sIEFvID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgMTI3IDwgYjspCiAgICAgICAgICAgICAgICAgICAgICAgIGEuai5wdXNoKGIgJiAxMjcgfCAxMjgpLCBiID4+Pj0gNzsKICAgICAgICAgICAgICAgICAgICBhLmoucHVzaChiKTsKICAgICAgICAgICAgICAgIH0sIEJvID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA8PSBiKQogICAgICAgICAgICAgICAgICAgICAgICBBbyhhLCBiKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IDA7IDkgPiBjOyBjKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmoucHVzaChiICYgMTI3IHwgMTI4KSwgYiA+Pj0gNzsKICAgICAgICAgICAgICAgICAgICAgICAgYS5qLnB1c2goMSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIENvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuRiA9IFtdOwogICAgICAgICAgICAgICAgICAgIHRoaXMubSA9IDA7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gbmV3IHlvKCk7CiAgICAgICAgICAgICAgICB9LCBEbyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgMCAhPT0gYi5sZW5ndGggJiYgKGEuRi5wdXNoKGIpLCBhLm0gKz0gYi5sZW5ndGgpOwogICAgICAgICAgICAgICAgfSwgRW8gPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIEFvKGEuaiwgOCAqIGIgKyAyKTsKICAgICAgICAgICAgICAgICAgICBiID0gYS5qLmVuZCgpOwogICAgICAgICAgICAgICAgICAgIERvKGEsIGIpOwogICAgICAgICAgICAgICAgICAgIGIucHVzaChhLm0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSwgRm8gPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYi5wb3AoKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSBhLm0gKyBhLmoubGVuZ3RoKCkgLSBjOyAxMjcgPCBjOykKICAgICAgICAgICAgICAgICAgICAgICAgYi5wdXNoKGMgJiAxMjcgfCAxMjgpLCBjID4+Pj0gNywgYS5tKys7CiAgICAgICAgICAgICAgICAgICAgYi5wdXNoKGMpOwogICAgICAgICAgICAgICAgICAgIGEubSsrOwogICAgICAgICAgICAgICAgfSwgR28gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIERvKGEsIGEuai5lbmQoKSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IG5ldyBVaW50OEFycmF5KGEubSksIGMgPSBhLkYsIGQgPSBjLmxlbmd0aCwgZSA9IDAsIGYgPSAwOyBmIDwgZDsgZisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gY1tmXTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5zZXQoZywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgKz0gZy5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGEuRiA9IFtiXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0sIEhvID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBudWxsICE9IGMgJiYgbnVsbCAhPSBjICYmIChBbyhhLmosIDggKiBiKSwgQm8oYS5qLCBjKSk7CiAgICAgICAgICAgICAgICB9LCBJbyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSBjICYmIG51bGwgIT0gYyAmJiAoQW8oYS5qLCA4ICogYiksIGEgPSBhLmosIHliKGMpLCB6byhhKSk7CiAgICAgICAgICAgICAgICB9LCBKbyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSBjICYmIChBbyhhLmosIDggKiBiKSwgYS5qLmoucHVzaChjID8gMSA6IDApKTsKICAgICAgICAgICAgICAgIH0sIEtvID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBudWxsICE9IGMgJiYgKGMgPSBwYXJzZUludChjLCAxMCksIEFvKGEuaiwgOCAqIGIpLCBCbyhhLmosIGMpKTsKICAgICAgICAgICAgICAgIH0sIExvID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBBbyhhLmosIDggKiBiICsgMik7CiAgICAgICAgICAgICAgICAgICAgQW8oYS5qLCBjLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgRG8oYSwgYS5qLmVuZCgpKTsKICAgICAgICAgICAgICAgICAgICBEbyhhLCBjKTsKICAgICAgICAgICAgICAgIH0sIE1vID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICBudWxsICE9IGMgJiYgKGIgPSBFbyhhLCBiKSwgZChjLCBhKSwgRm8oYSwgYikpOwogICAgICAgICAgICAgICAgfSwgTm8gPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IGMpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSAwOyBlIDwgYy5sZW5ndGg7IGUrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBFbyhhLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQoY1tlXSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBGbyhhLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHpiID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHYuU3ltYm9sICYmICdzeW1ib2wnID09PSB0eXBlb2YgKDAsIHYuU3ltYm9sKSgpID8gKDAsIHYuU3ltYm9sKSh2b2lkIDApIDogdm9pZCAwOwogICAgICAgICAgICB2YXIgT287CiAgICAgICAgICAgIHZhciBHYiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBhOwogICAgICAgICAgICAgICAgdGhpcy5GID0gYjsKICAgICAgICAgICAgICAgIHRoaXMubWFwID0ge307CiAgICAgICAgICAgICAgICB0aGlzLm0gPSAhMTsKICAgICAgICAgICAgICAgIGZvciAoYSA9IHRoaXMuc2l6ZSA9IDA7IGEgPCB0aGlzLmoubGVuZ3RoOyBhKyspIHsKICAgICAgICAgICAgICAgICAgICBiID0gdGhpcy5qW2FdOwogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYlswXS50b1N0cmluZygpLCBkID0gdGhpcy5tYXBbY107CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tYXBbY10gPSBiOwogICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gZCAmJiB0aGlzLnNpemUrKzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgcCA9IEdiLnByb3RvdHlwZTsKICAgICAgICAgICAgcC5PYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGlmICghdGhpcy5tKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBQbyh0aGlzKTsKICAgICAgICAgICAgICAgICAgICBhLnNvcnQoKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gMDsgYiA8IGEubGVuZ3RoOyBiKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMualtiXSA9IHRoaXMubWFwW2FbYl1dOwogICAgICAgICAgICAgICAgICAgIGEubGVuZ3RoIDwgdGhpcy5qLmxlbmd0aCAmJiAodGhpcy5qLmxlbmd0aCA9IGEubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSAhMDsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNpemUgPSB0aGlzLmoubGVuZ3RoOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuajsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5jbGVhciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMubWFwID0ge307CiAgICAgICAgICAgICAgICB0aGlzLnNpemUgPSB0aGlzLmoubGVuZ3RoID0gMDsKICAgICAgICAgICAgICAgIHRoaXMubSA9ICEwOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwLmRlbGV0ZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gYS50b1N0cmluZygpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWFwLmhhc093blByb3BlcnR5KGEpID8gKGRlbGV0ZSB0aGlzLm1hcFthXSwgdGhpcy5zaXplLS0sIHRoaXMubSA9ICExLCAhMCkgOiAhMTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5lbnRyaWVzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSBbXSwgYiA9IFBvKHRoaXMpOwogICAgICAgICAgICAgICAgYi5zb3J0KCk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IGIubGVuZ3RoOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHRoaXMubWFwW2JbY11dOwogICAgICAgICAgICAgICAgICAgIGEucHVzaChbCiAgICAgICAgICAgICAgICAgICAgICAgIGRbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgIE1iKHRoaXMsIGQpCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFFvKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwLmtleXMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IFtdLCBiID0gUG8odGhpcyk7CiAgICAgICAgICAgICAgICBiLnNvcnQoKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwOyBjIDwgYi5sZW5ndGg7IGMrKykKICAgICAgICAgICAgICAgICAgICBhLnB1c2godGhpcy5tYXBbYltjXV1bMF0pOwogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBRbyhhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC52YWx1ZXMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IFtdLCBiID0gUG8odGhpcyk7CiAgICAgICAgICAgICAgICBiLnNvcnQoKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwOyBjIDwgYi5sZW5ndGg7IGMrKykKICAgICAgICAgICAgICAgICAgICBhLnB1c2goTWIodGhpcywgdGhpcy5tYXBbYltjXV0pKTsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUW8oYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuZm9yRWFjaCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IFBvKHRoaXMpOwogICAgICAgICAgICAgICAgYy5zb3J0KCk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gMDsgZCA8IGMubGVuZ3RoOyBkKyspIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFwW2NbZF1dOwogICAgICAgICAgICAgICAgICAgIGEuY2FsbChiLCBNYih0aGlzLCBlKSwgZVswXSwgdGhpcyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuc2V0ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gYS50b1N0cmluZygpLCBkID0gdGhpcy5tYXBbY107CiAgICAgICAgICAgICAgICBkID8gZFsxXSA9IGIgOiAoYSA9IFsKICAgICAgICAgICAgICAgICAgICBhLAogICAgICAgICAgICAgICAgICAgIGIKICAgICAgICAgICAgICAgIF0sIHRoaXMubWFwW2NdID0gYSwgdGhpcy5qLnB1c2goYSksIHRoaXMubSA9ICExLCB0aGlzLnNpemUrKyk7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE1iID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gYlsxXTsKICAgICAgICAgICAgICAgIGEuRiAmJiAoQXJyYXkuaXNBcnJheShjKSB8fCBudWxsID09IGMpICYmIChhID0gbmV3IGEuRihjKSwgYyA9IGJbMV0gPSBhKTsKICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBHYi5wcm90b3R5cGUuZ2V0ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmIChhID0gdGhpcy5tYXBbYS50b1N0cmluZygpXSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWIodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEdiLnByb3RvdHlwZS5oYXMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEudG9TdHJpbmcoKSBpbiB0aGlzLm1hcDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFBvID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgPSBhLm1hcDsKICAgICAgICAgICAgICAgIHZhciBiID0gW10sIGM7CiAgICAgICAgICAgICAgICBmb3IgKGMgaW4gYSkKICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgYykgJiYgYi5wdXNoKGMpOwogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEdiLnByb3RvdHlwZVtfLnQodi5TeW1ib2wsICdpdGVyYXRvcicpXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBfLnQodGhpcywgJ2VudHJpZXMnKS5jYWxsKHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUW8gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5tID0gMDsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFFvLnByb3RvdHlwZS5uZXh0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubSA8IHRoaXMuai5sZW5ndGggPyB7CiAgICAgICAgICAgICAgICAgICAgZG9uZTogITEsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHRoaXMualt0aGlzLm0rK10KICAgICAgICAgICAgICAgIH0gOiB7CiAgICAgICAgICAgICAgICAgICAgZG9uZTogITAsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHZvaWQgMAogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgUW8ucHJvdG90eXBlW18udCh2LlN5bWJvbCwgJ2l0ZXJhdG9yJyldID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBPYjsKICAgICAgICAgICAgdmFyIFEgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gT2I7CiAgICAgICAgICAgICAgICAgICAgT2IgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGEgfHwgKGEgPSBkKTsKICAgICAgICAgICAgICAgICAgICBkID0gdGhpcy5jb25zdHJ1Y3Rvci5tZXNzYWdlSWQ7CiAgICAgICAgICAgICAgICAgICAgYSB8fCAoYSA9IGQgPyBbZF0gOiBbXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5BID0gKGQgPyAwIDogLTEpIC0gKHRoaXMuY29uc3RydWN0b3IuQ2YgfHwgMCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIHRoaXMuRiA9IGE7CiAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICBkID0gdGhpcy5GLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGQgLSAxOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiAoZCA9IHRoaXMuRlthXSwgQmIoZCkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLkQgPSBhIC0gdGhpcy5BOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5tID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBiICYmIC0xIDwgYiA/ICh0aGlzLkQgPSBNYXRoLm1heChiLCBhICsgMSAtIHRoaXMuQSksIHRoaXMubSA9IHZvaWQgMCkgOiB0aGlzLkQgPSBOdW1iZXIuTUFYX1ZBTFVFOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChiID0gMDsgYiA8IGMubGVuZ3RoOyBiKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IGNbYl0sIGEgPCB0aGlzLkQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSArPSB0aGlzLkEsIChkID0gdGhpcy5GW2FdKSA/IEFycmF5LmlzQXJyYXkoZCkgJiYgQWIoZCkgOiB0aGlzLkZbYV0gPSBSbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSB0aGlzLm0gfHwgKHRoaXMubSA9IHRoaXMuRlt0aGlzLkQgKyB0aGlzLkFdID0ge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZFthXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID8gQXJyYXkuaXNBcnJheShlKSAmJiBBYihlKSA6IGRbYV0gPSBSbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIFJvID0gT2JqZWN0LmZyZWV6ZShBYihbXSkpLCBHID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgPT09IGIgPyBudWxsIDogYiA+PSBhLkQgPyBhLm0gPyBhLm1bYl0gOiB2b2lkIDAgOiAodm9pZCAwID09PSBjID8gMCA6IGMpICYmIGEubSAmJiAoYyA9IGEubVtiXSwgbnVsbCAhPSBjKSA/IGMgOiBhLkZbYiArIGEuQV07CiAgICAgICAgICAgICAgICB9LCBZZiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gRyhhLCBiKTsKICAgICAgICAgICAgICAgIH0sIE9oID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gITEgOiBjOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gRyhhLCBiLCBjKTsKICAgICAgICAgICAgICAgICAgICBudWxsID09IGQgJiYgKGQgPSBSbyk7CiAgICAgICAgICAgICAgICAgICAgZCA9PT0gUm8gJiYgKGQgPSBBYihkLnNsaWNlKCkpLCB3KGEsIGIsIGQsIGMpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgIH0sIEhjID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBhID0gRyhhLCBiKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBhID8gYSA6ICthOwogICAgICAgICAgICAgICAgfSwgRSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IEcoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gYSA/IGEgOiAhIWE7CiAgICAgICAgICAgICAgICB9LCB0ayA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IEcoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gYSA/IGMgOiBhOwogICAgICAgICAgICAgICAgfSwgU28gPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIGEgPSBFKGEsIGIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGEgPyB2b2lkIDAgPT09IGMgPyAhMSA6IGMgOiBhOwogICAgICAgICAgICAgICAgfSwgdyA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgKHZvaWQgMCA9PT0gZCA/IDAgOiBkKSB8fCBiID49IGEuRCA/IChhLm0gfHwgKGEubSA9IGEuRlthLkQgKyBhLkFdID0ge30pKVtiXSA9IGMgOiBhLkZbYiArIGEuQV0gPSBjOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSwgeWYgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gdm9pZCAwID09PSBkID8gITEgOiBkOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB3KGEsIGIsIG51bGwgPT0gYyA/IEFiKFtdKSA6IEFycmF5LmlzQXJyYXkoYykgPyBBYihjKSA6IGMsIGQpOwogICAgICAgICAgICAgICAgfSwgVG8gPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIE9oKGEsIGIpLnB1c2goYyk7CiAgICAgICAgICAgICAgICB9LCB0ZSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgKGMgPSBYYihhLCBjKSkgJiYgYyAhPT0gYiAmJiBudWxsICE9IGQgJiYgKGEuaiAmJiBjIGluIGEuaiAmJiAoYS5qW2NdID0gdm9pZCAwKSwgdyhhLCBjLCB2b2lkIDApKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdyhhLCBiLCBkKTsKICAgICAgICAgICAgICAgIH0sIFhiID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMCwgZCA9IDA7IGQgPCBiLmxlbmd0aDsgZCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYltkXTsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSBHKGEsIGUpICYmICgwICE9PSBjICYmIHcoYSwgYywgdm9pZCAwLCAhMSksIGMgPSBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9LCBXYiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKC0xID09PSBjKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICBhLmogfHwgKGEuaiA9IHt9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGEualtjXTsKICAgICAgICAgICAgICAgICAgICBpZiAoZikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgICAgICAgICAgZSA9IEcoYSwgYywgdm9pZCAwID09PSBlID8gITEgOiBlKTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlICYmICFkKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgICAgICBiID0gbmV3IGIoZSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEualtjXSA9IGI7CiAgICAgICAgICAgICAgICB9LCBVYiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgYS5qIHx8IChhLmogPSB7fSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhLmpbY107CiAgICAgICAgICAgICAgICAgICAgaWYgKCFlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBPaChhLCBjLCB2b2lkIDAgPT09IGQgPyAhMSA6IGQpOwogICAgICAgICAgICAgICAgICAgICAgICBlID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSAwOyBmIDwgZC5sZW5ndGg7IGYrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbZl0gPSBuZXcgYihkW2ZdKTsKICAgICAgICAgICAgICAgICAgICAgICAgYS5qW2NdID0gZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9LCB6ZiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB2b2lkIDAgPT09IGQgPyAhMSA6IGQ7CiAgICAgICAgICAgICAgICAgICAgYS5qIHx8IChhLmogPSB7fSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjID8gYy5PYSgpIDogYzsKICAgICAgICAgICAgICAgICAgICBhLmpbYl0gPSBjOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB3KGEsIGIsIGUsIGQpOwogICAgICAgICAgICAgICAgfSwgRWUgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIGEuaiB8fCAoYS5qID0ge30pOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZCA/IGQuT2EoKSA6IGQ7CiAgICAgICAgICAgICAgICAgICAgYS5qW2JdID0gZDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGUoYSwgYiwgYywgZSk7CiAgICAgICAgICAgICAgICB9LCB3aCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB2b2lkIDAgPT09IGQgPyAhMSA6IGQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBBYihbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSAwOyBmIDwgYy5sZW5ndGg7IGYrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbZl0gPSBjW2ZdLk9hKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuaiB8fCAoYS5qID0ge30pOwogICAgICAgICAgICAgICAgICAgICAgICBhLmpbYl0gPSBjOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBhLmogJiYgKGEualtiXSA9IHZvaWQgMCksIGUgPSBSbzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdyhhLCBiLCBlLCBkKTsKICAgICAgICAgICAgICAgIH0sIGdoID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFViKGEsIGMsIGIsIHZvaWQgMCA9PT0gZSA/ICExIDogZSk7CiAgICAgICAgICAgICAgICAgICAgYyA9IGQgPyBkIDogbmV3IGMoKTsKICAgICAgICAgICAgICAgICAgICBhID0gT2goYSwgYik7CiAgICAgICAgICAgICAgICAgICAgZS5wdXNoKGMpOwogICAgICAgICAgICAgICAgICAgIGEucHVzaChjLk9hKCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgUS5wcm90b3R5cGUudG9KU09OID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLk9hKCk7CiAgICAgICAgICAgICAgICByZXR1cm4gT28gPyBhIDogSWIoYSwgS2IpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBRLnByb3RvdHlwZS5PYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLkY7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFEucHJvdG90eXBlLlggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBPbyA9ICEwOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkodGhpcy50b0pTT04oKSwgVGIpOwogICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICBPbyA9ICExOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgU2wgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBQYihhLCBiID8gSlNPTi5wYXJzZShiKSA6IG51bGwpOwogICAgICAgICAgICAgICAgfSwgTGIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gYS5jb25zdHJ1Y3RvciwgYyA9IEliKGEuT2EoKSwgTmIpOwogICAgICAgICAgICAgICAgICAgIGIgPSBQYihiLCBjKTsKICAgICAgICAgICAgICAgICAgICBWYihiLCBhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0sIHNrID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGsoYSwgYiwgdm9pZCAwID09PSBjID8gMCA6IGMpOwogICAgICAgICAgICAgICAgfSwgbGsgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ayhhLCBiLCB2b2lkIDAgPT09IGMgPyAnJyA6IGMpOwogICAgICAgICAgICAgICAgfSwgVm8gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBzayhhLCBZYihhLCBVbywgMyksIHZvaWQgMCk7CiAgICAgICAgICAgICAgICB9LCBXbyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxrKGEsIFliKGEsIFVvLCAyKSwgdm9pZCAwKTsKICAgICAgICAgICAgICAgIH0sIEprID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWIoYSwgYiwgYywgITEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFhvID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IGEubCkgewogICAgICAgICAgICAgICAgICAgICAgICBEbyhiLCBiLmouZW5kKCkpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IGEubGVuZ3RoOyBjKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBEbyhiLCBhW2NdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBZbyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgQ28oKTsKICAgICAgICAgICAgICAgICAgICBiKGEsIGMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBHbyhjKTsKICAgICAgICAgICAgICAgIH0sIFpvID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBiID0gRyhiLCBjKTsKICAgICAgICAgICAgICAgICAgICBudWxsICE9IGIgJiYgbnVsbCAhPSBiICYmIChBbyhhLmosIDggKiBjKSwgYSA9IGEuaiwgeWIoYiksIHpvKGEpKTsKICAgICAgICAgICAgICAgIH0sICRvID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBiID0gRyhiLCBjKTsKICAgICAgICAgICAgICAgICAgICBudWxsICE9IGIgJiYgTG8oYSwgYywgdmIoYikpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFZsID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFZsLCBRKTsKICAgICAgICAgICAgdmFyIFdsID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFdsLCBRKTsKICAgICAgICAgICAgdmFyIGFwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBhLm07CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tID0gYS5GOwogICAgICAgICAgICAgICAgICAgIHRoaXMuQSA9IGEuQTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnJiID0gYS5yYjsKICAgICAgICAgICAgICAgICAgICB0aGlzLkkgPSBhLkk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5hYiA9IGEuYWI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5JYiA9IGEuSWI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5TYiA9IGEuU2I7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5IYiA9IGEuSGI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5GID0gYS5qOwogICAgICAgICAgICAgICAgfSwgYnAgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHRoaXMubSA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5GID0gYjsKICAgICAgICAgICAgICAgICAgICB0aGlzLkEgPSBjOwogICAgICAgICAgICAgICAgICAgIHRoaXMuSSA9IHdpbmRvdzsKICAgICAgICAgICAgICAgICAgICB0aGlzLmFiID0gJ2Vudic7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5JYiA9ICduJzsKICAgICAgICAgICAgICAgICAgICB0aGlzLlNiID0gJzAnOwogICAgICAgICAgICAgICAgICAgIHRoaXMuSGIgPSAnMSc7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gITA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBicC5wcm90b3R5cGUuYnVpbGQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGFwKHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWWwgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMsIGQsIGUgPSB2b2lkIDAgPT09IFNvKGIsIDYpID8gITAgOiBTbyhiLCA2KTsKICAgICAgICAgICAgICAgIGE6CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0ayhiLCA0LCAwKSkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSAncHQnOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgZiA9ICdjcic7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgZiA9ICcnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGYgPSBuZXcgYnAoWmIodGsoYiwgMiwgMCkpLCBsayhiLCAzKSwgZik7CiAgICAgICAgICAgICAgICBiID0gbnVsbCAhPT0gKGQgPSBudWxsID09PSAoYyA9IFdiKGIsIFdsLCA1KSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogbGsoYywgMSkpICYmIHZvaWQgMCAhPT0gZCA/IGQgOiAnJzsKICAgICAgICAgICAgICAgIGYucmIgPSBiOwogICAgICAgICAgICAgICAgZi5qID0gZTsKICAgICAgICAgICAgICAgIGYuSSA9IGE7CiAgICAgICAgICAgICAgICByZXR1cm4gZi5idWlsZCgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIga2sgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEsIC0xLCBjcCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhraywgUSk7CiAgICAgICAgICAgIHZhciBuayA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHcoYSwgMSwgYik7CiAgICAgICAgICAgICAgICB9LCByayA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdyhhLCAyLCBiKTsKICAgICAgICAgICAgICAgIH0sIGRwID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBnaChhLCAzLCB2aywgYik7CiAgICAgICAgICAgICAgICB9LCBmcCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgJG8oYiwgYSwgMSk7CiAgICAgICAgICAgICAgICAgICAgWm8oYiwgYSwgMik7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBlcDsKICAgICAgICAgICAgICAgICAgICBObyhiLCAzLCBVYihhLCB2aywgMyksIGMpOwogICAgICAgICAgICAgICAgICAgIEtvKGIsIDQsIEcoYSwgNCkpOwogICAgICAgICAgICAgICAgICAgIFhvKGEsIGIpOwogICAgICAgICAgICAgICAgfSwgdmsgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgZ3ApOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHZrLCBRKTsKICAgICAgICAgICAgdmFyIENrID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB3KGEsIDEsIGIpOwogICAgICAgICAgICAgICAgfSwgd2sgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHcoYSwgMywgYik7CiAgICAgICAgICAgICAgICB9LCB5ayA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgeWYoYSwgNCwgYik7CiAgICAgICAgICAgICAgICB9LCB6ayA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgemYoYSwgNywgYik7CiAgICAgICAgICAgICAgICB9LCBlcCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgJG8oYiwgYSwgMSk7CiAgICAgICAgICAgICAgICAgICAgWm8oYiwgYSwgMik7CiAgICAgICAgICAgICAgICAgICAgJG8oYiwgYSwgMyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBPaChhLCA0KTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBjKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gMDsgZCA8IGMubGVuZ3RoOyBkKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gY1tkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT0gZSAmJiBMbyhiLCA0LCB2YihlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBLbyhiLCA1LCBHKGEsIDUpKTsKICAgICAgICAgICAgICAgICAgICBjID0gaHA7CiAgICAgICAgICAgICAgICAgICAgTW8oYiwgNiwgV2IoYSwgeGssIDYpLCBjKTsKICAgICAgICAgICAgICAgICAgICBjID0gaXA7CiAgICAgICAgICAgICAgICAgICAgTW8oYiwgNywgV2IoYSwganAsIDcpLCBjKTsKICAgICAgICAgICAgICAgICAgICBYbyhhLCBiKTsKICAgICAgICAgICAgICAgIH0sIHhrID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oeGssIFEpOwogICAgICAgICAgICB4ay5wcm90b3R5cGUuZ2V0SWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbGsodGhpcywgMSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBocCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgJG8oYiwgYSwgMSk7CiAgICAgICAgICAgICAgICAgICAgWG8oYSwgYik7CiAgICAgICAgICAgICAgICB9LCBqcCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGpwLCBRKTsKICAgICAgICAgICAganAucHJvdG90eXBlLmdldFdpZHRoID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHNrKHRoaXMsIDEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQmsgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBuZXcganAoKTsKICAgICAgICAgICAgICAgIHJldHVybiB3KGIsIDEsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBqcC5wcm90b3R5cGUuZ2V0SGVpZ2h0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHNrKHRoaXMsIDIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQWsgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB3KGEsIDIsIGIpOwogICAgICAgICAgICAgICAgfSwgaXAgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIEhvKGIsIDEsIEcoYSwgMSkpOwogICAgICAgICAgICAgICAgICAgIEhvKGIsIDIsIEcoYSwgMikpOwogICAgICAgICAgICAgICAgICAgIFhvKGEsIGIpOwogICAgICAgICAgICAgICAgfSwgY3AgPSBbM10sIGdwID0gWzRdOwogICAgICAgICAgICB2YXIgbHAgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEsIC0xLCBrcCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhscCwgUSk7CiAgICAgICAgICAgIHZhciBtayA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdoKGEsIDIsIGtrLCBiKTsKICAgICAgICAgICAgICAgIH0sIG1wID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBLbyhiLCAxLCBHKGEsIDEpKTsKICAgICAgICAgICAgICAgICAgICBObyhiLCAyLCBVYihhLCBraywgMiksIGZwKTsKICAgICAgICAgICAgICAgICAgICBLbyhiLCAzLCBHKGEsIDMpKTsKICAgICAgICAgICAgICAgICAgICAkbyhiLCBhLCA0KTsKICAgICAgICAgICAgICAgICAgICBYbyhhLCBiKTsKICAgICAgICAgICAgICAgIH0sIGtwID0gWzJdOwogICAgICAgICAgICB2YXIgb3AgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEsIC0xLCBucCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhvcCwgUSk7CiAgICAgICAgICAgIHZhciBxayA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBuZXcgbHAoKTsKICAgICAgICAgICAgICAgICAgICBiID0gdyhiLCAxLCAxKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2goYSwgMSwgbHAsIGIpOwogICAgICAgICAgICAgICAgfSwgcHAgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIE5vKGIsIDEsIFViKGEsIGxwLCAxKSwgbXApOwogICAgICAgICAgICAgICAgICAgIFhvKGEsIGIpOwogICAgICAgICAgICAgICAgfSwgbnAgPSBbMV07CiAgICAgICAgICAgIHZhciBycCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSwgLTEsIHFwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHJwLCBRKTsKICAgICAgICAgICAgdmFyIHRwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgc3ApOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8odHAsIFEpOwogICAgICAgICAgICB2YXIgdXAgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8odXAsIFEpOwogICAgICAgICAgICB2YXIgcXAgPSBbMV0sIHNwID0gWzFdLCBVbyA9IFsKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgIHZhciB3cCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSwgLTEsIHZwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHdwLCBRKTsKICAgICAgICAgICAgdmFyIHhwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHhwLCBRKTsKICAgICAgICAgICAgdmFyIHZwID0gWzRdOwogICAgICAgICAgICB2YXIgenAgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEsIC0xLCB5cCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyh6cCwgUSk7CiAgICAgICAgICAgIHZhciB5cCA9IFs0XTsKICAgICAgICAgICAgdmFyIEFwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEFwLCBRKTsKICAgICAgICAgICAgdmFyIENwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgQnApOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oQ3AsIFEpOwogICAgICAgICAgICB2YXIgQnAgPSBbMV07CiAgICAgICAgICAgIHZhciBFcCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSwgLTEsIERwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEVwLCBRKTsKICAgICAgICAgICAgdmFyIEZwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEZwLCBRKTsKICAgICAgICAgICAgdmFyIERwID0gWzFdOwogICAgICAgICAgICB2YXIgSHAgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEsIC0xLCBHcCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhIcCwgUSk7CiAgICAgICAgICAgIHZhciBHcCA9IFs0XTsKICAgICAgICAgICAgdmFyIElwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKElwLCBRKTsKICAgICAgICAgICAgdmFyIEtwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgSnApOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oS3AsIFEpOwogICAgICAgICAgICB2YXIgSnAgPSBbMTNdOwogICAgICAgICAgICB2YXIgTXAgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEsIC0xLCBMcCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhNcCwgUSk7CiAgICAgICAgICAgIHZhciBMcCA9IFsxM107CiAgICAgICAgICAgIHZhciBPcCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSwgLTEsIE5wKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKE9wLCBRKTsKICAgICAgICAgICAgdmFyIFRwID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IFBwOwogICAgICAgICAgICAgICAgICAgIE5vKGIsIDEsIFViKGEsIFFwLCAxKSwgYyk7CiAgICAgICAgICAgICAgICAgICAgYyA9IFJwOwogICAgICAgICAgICAgICAgICAgIE5vKGIsIDIsIFViKGEsIFNwLCAyKSwgYyk7CiAgICAgICAgICAgICAgICAgICAgWG8oYSwgYik7CiAgICAgICAgICAgICAgICB9LCBRcCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFFwLCBRKTsKICAgICAgICAgICAgdmFyIFBwID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBJbyhiLCAxLCBHKGEsIDEpKTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IFVwOwogICAgICAgICAgICAgICAgICAgIE1vKGIsIDIsIFdiKGEsIFZwLCAyKSwgYyk7CiAgICAgICAgICAgICAgICAgICAgYyA9IFVwOwogICAgICAgICAgICAgICAgICAgIE1vKGIsIDMsIFdiKGEsIFZwLCAzKSwgYyk7CiAgICAgICAgICAgICAgICAgICAgJG8oYiwgYSwgNCk7CiAgICAgICAgICAgICAgICAgICAgJG8oYiwgYSwgNSk7CiAgICAgICAgICAgICAgICAgICAgSm8oYiwgNiwgRyhhLCA2KSk7CiAgICAgICAgICAgICAgICAgICAgWG8oYSwgYik7CiAgICAgICAgICAgICAgICB9LCBWcCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFZwLCBRKTsKICAgICAgICAgICAgdmFyIFVwID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBJbyhiLCAxLCBHKGEsIDEpKTsKICAgICAgICAgICAgICAgICAgICBJbyhiLCAyLCBHKGEsIDIpKTsKICAgICAgICAgICAgICAgICAgICBJbyhiLCAzLCBHKGEsIDMpKTsKICAgICAgICAgICAgICAgICAgICBYbyhhLCBiKTsKICAgICAgICAgICAgICAgIH0sIFNwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oU3AsIFEpOwogICAgICAgICAgICB2YXIgR2MgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB3KGEsIDgsIGIpOwogICAgICAgICAgICAgICAgfSwgUnAgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgICRvKGIsIGEsIDEpOwogICAgICAgICAgICAgICAgICAgICRvKGIsIGEsIDIpOwogICAgICAgICAgICAgICAgICAgIFpvKGIsIGEsIDMpOwogICAgICAgICAgICAgICAgICAgIFpvKGIsIGEsIDcpOwogICAgICAgICAgICAgICAgICAgIHZhciBjID0gRyhhLCA4KTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEFvKGIuaiwgNjkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGIuaiwgZSA9IGM7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSAoYyA9IDAgPiBlID8gMSA6IDApID8gLWUgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPCAxIC8gZSA/IHdiID0geGIgPSAwIDogKHhiID0gMCwgd2IgPSAyMTQ3NDgzNjQ4KTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoaXNOYU4oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4YiA9IDAsIHdiID0gMjE0NzQ4MzY0NzsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoMy40MDI4MjM0NjYzODUyODg2ZSszOCA8IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4YiA9IDAsIHdiID0gKGMgPDwgMzEgfCAyMTM5MDk1MDQwKSA+Pj4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoMS4xNzU0OTQzNTA4MjIyODc1ZS0zOCA+IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gTWF0aC5yb3VuZChlIC8gTWF0aC5wb3coMiwgLTE0OSkpLCB4YiA9IDAsIHdiID0gKGMgPDwgMzEgfCBlKSA+Pj4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IE1hdGguZmxvb3IoTWF0aC5sb2coZSkgLyBNYXRoLkxOMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICo9IE1hdGgucG93KDIsIC1mKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBNYXRoLnJvdW5kKDgzODg2MDggKiBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE2Nzc3MjE2IDw9IGUgJiYgKytmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeGIgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2IgPSAoYyA8PCAzMSB8IGYgKyAxMjcgPDwgMjMgfCBlICYgODM4ODYwNykgPj4+IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYyA9IHdiOwogICAgICAgICAgICAgICAgICAgICAgICBkLmoucHVzaChjID4+PiAwICYgMjU1KTsKICAgICAgICAgICAgICAgICAgICAgICAgZC5qLnB1c2goYyA+Pj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQuai5wdXNoKGMgPj4+IDE2ICYgMjU1KTsKICAgICAgICAgICAgICAgICAgICAgICAgZC5qLnB1c2goYyA+Pj4gMjQgJiAyNTUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBIbyhiLCA0LCBHKGEsIDQpKTsKICAgICAgICAgICAgICAgICAgICBIbyhiLCA1LCBHKGEsIDUpKTsKICAgICAgICAgICAgICAgICAgICBIbyhiLCA2LCBHKGEsIDYpKTsKICAgICAgICAgICAgICAgICAgICBKbyhiLCA5LCBHKGEsIDkpKTsKICAgICAgICAgICAgICAgICAgICBYbyhhLCBiKTsKICAgICAgICAgICAgICAgIH0sIE5wID0gWwogICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgMgogICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgdmFyIFdwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFdwLCBRKTsKICAgICAgICAgICAgdmFyIFlwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgWHApOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oWXAsIFEpOwogICAgICAgICAgICB2YXIgWHAgPSBbMV07CiAgICAgICAgICAgIHZhciBacCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhacCwgUSk7CiAgICAgICAgICAgIHZhciAkcCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTygkcCwgUSk7CiAgICAgICAgICAgICRwLnByb3RvdHlwZS5nZXRWZXJzaW9uID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEcodGhpcywgNSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBhcSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhhcSwgUSk7CiAgICAgICAgICAgIHZhciBicSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhicSwgUSk7CiAgICAgICAgICAgIHZhciBjcSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhjcSwgUSk7CiAgICAgICAgICAgIHZhciBkcSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhkcSwgUSk7CiAgICAgICAgICAgIHZhciBlcSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhlcSwgUSk7CiAgICAgICAgICAgIGVxLnByb3RvdHlwZS5nZXRBZFVuaXRQYXRoID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIGxrKHRoaXMsIDIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZ3EgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEsIC0xLCBmcSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhncSwgUSk7CiAgICAgICAgICAgIGdxLnByb3RvdHlwZS5nZXRFc2NhcGVkUWVtUXVlcnlJZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBsayh0aGlzLCA0KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGZxID0gWzJdOwogICAgICAgICAgICB2YXIgaHEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oaHEsIFEpOwogICAgICAgICAgICB2YXIgaXEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oaXEsIFEpOwogICAgICAgICAgICBpcS5wcm90b3R5cGUuZ2V0RXNjYXBlZFFlbVF1ZXJ5SWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbGsodGhpcywgMik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBrcSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSwgLTEsIGpxKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGtxLCBRKTsKICAgICAgICAgICAga3EucHJvdG90eXBlLmdldFdpZHRoID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHNrKHRoaXMsIDkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBrcS5wcm90b3R5cGUuZ2V0SGVpZ2h0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHNrKHRoaXMsIDEwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGpxID0gWwogICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgIDcKICAgICAgICAgICAgXTsKICAgICAgICAgICAgdmFyIG1xID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgbHEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8obXEsIFEpOwogICAgICAgICAgICBtcS5wcm90b3R5cGUuZ2V0SGVpZ2h0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEcodGhpcywgNik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIG1xLnByb3RvdHlwZS5nZXRXaWR0aCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBHKHRoaXMsIDcpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBtcS5wcm90b3R5cGUuZ2V0RXNjYXBlZFFlbVF1ZXJ5SWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gRyh0aGlzLCAzNCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBucSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhucSwgUSk7CiAgICAgICAgICAgIG5xLnByb3RvdHlwZS5nZXRIdG1sID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEcodGhpcywgMSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBscSA9IFsKICAgICAgICAgICAgICAgICAgICAxNCwKICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAxNiwKICAgICAgICAgICAgICAgICAgICAxNywKICAgICAgICAgICAgICAgICAgICAxOCwKICAgICAgICAgICAgICAgICAgICAxOSwKICAgICAgICAgICAgICAgICAgICAyMCwKICAgICAgICAgICAgICAgICAgICAyMSwKICAgICAgICAgICAgICAgICAgICAyMiwKICAgICAgICAgICAgICAgICAgICA0NSwKICAgICAgICAgICAgICAgICAgICAyMywKICAgICAgICAgICAgICAgICAgICAyNywKICAgICAgICAgICAgICAgICAgICAyOCwKICAgICAgICAgICAgICAgICAgICAzOCwKICAgICAgICAgICAgICAgICAgICA1MywKICAgICAgICAgICAgICAgICAgICA2MgogICAgICAgICAgICAgICAgXSwgb3EgPSBbCiAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICA0MQogICAgICAgICAgICAgICAgXSwgcHEgPSBbCiAgICAgICAgICAgICAgICAgICAgMzksCiAgICAgICAgICAgICAgICAgICAgNDgKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgIHZhciBUbCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhUbCwgUSk7CiAgICAgICAgICAgIHZhciBxcSA9IGRvY3VtZW50LCAkayA9IHdpbmRvdzsKICAgICAgICAgICAgdmFyIHNxID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgcnEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oc3EsIFEpOwogICAgICAgICAgICB2YXIgdXEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuZXcgc3EoKSwgYiA9IF8uSCh0cSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEprKGEsIDcsIGIpOwogICAgICAgICAgICAgICAgfSwgd3EgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB1cSgpLCBiID0gXy5IKHZxKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gSmsoYSwgOCwgYik7CiAgICAgICAgICAgICAgICB9LCB5cSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHdxKCksIGIgPSBfLkgoeHEpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBKayhhLCA5LCBiKTsKICAgICAgICAgICAgICAgIH0sIHJxID0gWzE1XTsKICAgICAgICAgICAgdmFyIHpxID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHpxLCBRKTsKICAgICAgICAgICAgenEucHJvdG90eXBlLmdldENvcnJlbGF0b3IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gc2sodGhpcywgMSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHpxLnByb3RvdHlwZS5zZXRDb3JyZWxhdG9yID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBRYih0aGlzLCAxLCBhLCAwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEFxID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEFxLCBRKTsKICAgICAgICAgICAgdmFyIEJxID0gXy5hbyB8fCBlbzsKICAgICAgICAgICAgdmFyIERxID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBhLnJlbCA9IGM7CiAgICAgICAgICAgICAgICAgICAgLTEgIT0gYy50b0xvd2VyQ2FzZSgpLmluZGV4T2YoJ3N0eWxlc2hlZXQnKSA/IChhLmhyZWYgPSBYYShiKS50b1N0cmluZygpLCAoYiA9IENxKCdzdHlsZVtub25jZV0sbGlua1tyZWw9InN0eWxlc2hlZXQiXVtub25jZV0nLCBhLm93bmVyRG9jdW1lbnQgJiYgYS5vd25lckRvY3VtZW50LmRlZmF1bHRWaWV3KSkgJiYgYS5zZXRBdHRyaWJ1dGUoJ25vbmNlJywgYikpIDogKGIgaW5zdGFuY2VvZiBoZCA/IGIgPSBYYShiKS50b1N0cmluZygpIDogYiBpbnN0YW5jZW9mIGlkID8gYiA9IF8uamQoYikgOiAoYiBpbnN0YW5jZW9mIGlkIHx8IChiID0gJ29iamVjdCcgPT0gdHlwZW9mIGIgJiYgYi5IYSA/IGIuRWEoKSA6IFN0cmluZyhiKSwga2QudGVzdChiKSB8fCAoYiA9ICdhYm91dDppbnZhbGlkI3pDbG9zdXJleicpLCBiID0gbmV3IGlkKGIsIGxkKSksIGIgPSBfLmpkKGIpKSwgYS5ocmVmID0gYik7CiAgICAgICAgICAgICAgICB9LCBFcSA9IC9eW1x3Ky9fLV0rWz1dezAsMn0kLywgQ3EgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPSAoYiB8fCBfLnIpLmRvY3VtZW50OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiLnF1ZXJ5U2VsZWN0b3IgPyAoYSA9IGIucXVlcnlTZWxlY3RvcihhKSkgJiYgKGEgPSBhLm5vbmNlIHx8IGEuZ2V0QXR0cmlidXRlKCdub25jZScpKSAmJiBFcS50ZXN0KGEpID8gYSA6ICcnIDogJyc7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBfLmlnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHRoaXMueCA9IHZvaWQgMCAhPT0gYSA/IGEgOiAwOwogICAgICAgICAgICAgICAgdGhpcy55ID0gdm9pZCAwICE9PSBiID8gYiA6IDA7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uaWcucHJvdG90eXBlLmNlaWwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLnggPSBNYXRoLmNlaWwodGhpcy54KTsKICAgICAgICAgICAgICAgIHRoaXMueSA9IE1hdGguY2VpbCh0aGlzLnkpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uaWcucHJvdG90eXBlLmZsb29yID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy54ID0gTWF0aC5mbG9vcih0aGlzLngpOwogICAgICAgICAgICAgICAgdGhpcy55ID0gTWF0aC5mbG9vcih0aGlzLnkpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uaWcucHJvdG90eXBlLnJvdW5kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy54ID0gTWF0aC5yb3VuZCh0aGlzLngpOwogICAgICAgICAgICAgICAgdGhpcy55ID0gTWF0aC5yb3VuZCh0aGlzLnkpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uVWkgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdGhpcy53aWR0aCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmhlaWdodCA9IGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAgPSBfLlVpLnByb3RvdHlwZTsKICAgICAgICAgICAgcC5hc3BlY3RSYXRpbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLndpZHRoIC8gdGhpcy5oZWlnaHQ7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuaXNFbXB0eSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAhKHRoaXMud2lkdGggKiB0aGlzLmhlaWdodCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuY2VpbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMud2lkdGggPSBNYXRoLmNlaWwodGhpcy53aWR0aCk7CiAgICAgICAgICAgICAgICB0aGlzLmhlaWdodCA9IE1hdGguY2VpbCh0aGlzLmhlaWdodCk7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5mbG9vciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMud2lkdGggPSBNYXRoLmZsb29yKHRoaXMud2lkdGgpOwogICAgICAgICAgICAgICAgdGhpcy5oZWlnaHQgPSBNYXRoLmZsb29yKHRoaXMuaGVpZ2h0KTsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwLnJvdW5kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy53aWR0aCA9IE1hdGgucm91bmQodGhpcy53aWR0aCk7CiAgICAgICAgICAgICAgICB0aGlzLmhlaWdodCA9IE1hdGgucm91bmQodGhpcy5oZWlnaHQpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBGcSwgR3EsIG5nLCBIcSwgSXEsIEtxOwogICAgICAgICAgICBGcSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA9IHBkKGEsIHZvaWQgMCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEdxID0gU3RyaW5nLnByb3RvdHlwZS5yZXBlYXQgPyBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIGEucmVwZWF0KGIpOwogICAgICAgICAgICB9IDogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHJldHVybiBBcnJheShiICsgMSkuam9pbihhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbmcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKCFfLnQoTnVtYmVyLCAnaXNGaW5pdGUnKS5jYWxsKE51bWJlciwgYSkpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFN0cmluZyhhKTsKICAgICAgICAgICAgICAgIGEgPSBTdHJpbmcoYSk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGEuaW5kZXhPZignLicpOwogICAgICAgICAgICAgICAgLTEgPT09IGIgJiYgKGIgPSBhLmxlbmd0aCk7CiAgICAgICAgICAgICAgICB2YXIgYyA9ICctJyA9PT0gYVswXSA/ICctJyA6ICcnOwogICAgICAgICAgICAgICAgYyAmJiAoYSA9IGEuc3Vic3RyaW5nKDEpKTsKICAgICAgICAgICAgICAgIHJldHVybiBjICsgR3EoJzAnLCBNYXRoLm1heCgwLCAyIC0gYikpICsgYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSHEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gTWF0aC5mbG9vcigyMTQ3NDgzNjQ4ICogTWF0aC5yYW5kb20oKSkudG9TdHJpbmcoMzYpICsgTWF0aC5hYnMoTWF0aC5mbG9vcigyMTQ3NDgzNjQ4ICogTWF0aC5yYW5kb20oKSkgXiB4ZCgpKS50b1N0cmluZygzNik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIElxID0gMjE0NzQ4MzY0OCAqIE1hdGgucmFuZG9tKCkgfCAwOwogICAgICAgICAgICBfLkpxID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBTdHJpbmcoYSkucmVwbGFjZSgvXC0oW2Etel0pL2csIGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMudG9VcHBlckNhc2UoKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBLcSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYS5yZXBsYWNlKFJlZ0V4cCgnKF58W1xcc10rKShbYS16XSknLCAnZycpLCBmdW5jdGlvbiAoYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjICsgZC50b1VwcGVyQ2FzZSgpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBOcSwgUHEsIE9xLCBTcSwgVXEsICRiLCBjYywgTHE7CiAgICAgICAgICAgIE5xID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gbmV3IExxKF8uTXEoYSkpIDogZG4gfHwgKGRuID0gbmV3IExxKCkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBQcSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB1YShiLCBmdW5jdGlvbiAoYywgZCkgewogICAgICAgICAgICAgICAgICAgIGMgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGMgJiYgYy5IYSAmJiAoYyA9IGMuRWEoKSk7CiAgICAgICAgICAgICAgICAgICAgJ3N0eWxlJyA9PSBkID8gYS5zdHlsZS5jc3NUZXh0ID0gYyA6ICdjbGFzcycgPT0gZCA/IGEuY2xhc3NOYW1lID0gYyA6ICdmb3InID09IGQgPyBhLmh0bWxGb3IgPSBjIDogT3EuaGFzT3duUHJvcGVydHkoZCkgPyBhLnNldEF0dHJpYnV0ZShPcVtkXSwgYykgOiAwID09IGQubGFzdEluZGV4T2YoJ2FyaWEtJywgMCkgfHwgMCA9PSBkLmxhc3RJbmRleE9mKCdkYXRhLScsIDApID8gYS5zZXRBdHRyaWJ1dGUoZCwgYykgOiBhW2RdID0gYzsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBPcSA9IHsKICAgICAgICAgICAgICAgIGNlbGxwYWRkaW5nOiAnY2VsbFBhZGRpbmcnLAogICAgICAgICAgICAgICAgY2VsbHNwYWNpbmc6ICdjZWxsU3BhY2luZycsCiAgICAgICAgICAgICAgICBjb2xzcGFuOiAnY29sU3BhbicsCiAgICAgICAgICAgICAgICBmcmFtZWJvcmRlcjogJ2ZyYW1lQm9yZGVyJywKICAgICAgICAgICAgICAgIGhlaWdodDogJ2hlaWdodCcsCiAgICAgICAgICAgICAgICBtYXhsZW5ndGg6ICdtYXhMZW5ndGgnLAogICAgICAgICAgICAgICAgbm9uY2U6ICdub25jZScsCiAgICAgICAgICAgICAgICByb2xlOiAncm9sZScsCiAgICAgICAgICAgICAgICByb3dzcGFuOiAncm93U3BhbicsCiAgICAgICAgICAgICAgICB0eXBlOiAndHlwZScsCiAgICAgICAgICAgICAgICB1c2VtYXA6ICd1c2VNYXAnLAogICAgICAgICAgICAgICAgdmFsaWduOiAndkFsaWduJywKICAgICAgICAgICAgICAgIHdpZHRoOiAnd2lkdGgnCiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uUnEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYSA9IGEuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICBhID0gXy5RcShhKSA/IGEuZG9jdW1lbnRFbGVtZW50IDogYS5ib2R5OwogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBfLlVpKGEuY2xpZW50V2lkdGgsIGEuY2xpZW50SGVpZ2h0KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgU3EgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEuc2Nyb2xsaW5nRWxlbWVudCA/IGEuc2Nyb2xsaW5nRWxlbWVudCA6ICFlbyAmJiBfLlFxKGEpID8gYS5kb2N1bWVudEVsZW1lbnQgOiBhLmJvZHkgfHwgYS5kb2N1bWVudEVsZW1lbnQ7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uVHEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhLnBhcmVudFdpbmRvdyB8fCBhLmRlZmF1bHRWaWV3IDogd2luZG93OwogICAgICAgICAgICB9OwogICAgICAgICAgICBVcSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGgpIHsKICAgICAgICAgICAgICAgICAgICBoICYmIGIuYXBwZW5kQ2hpbGQoJ3N0cmluZycgPT09IHR5cGVvZiBoID8gYS5jcmVhdGVUZXh0Tm9kZShoKSA6IGgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IDE7IGUgPCBjLmxlbmd0aDsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBjW2VdOwogICAgICAgICAgICAgICAgICAgIGlmICghYWgoZikgfHwgXy5qYShmKSAmJiAwIDwgZi5ub2RlVHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgZChmKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYgJiYgJ251bWJlcicgPT0gdHlwZW9mIGYubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKF8uamEoZikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBmLml0ZW0gfHwgJ3N0cmluZycgPT0gdHlwZW9mIGYuaXRlbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT09IHR5cGVvZiBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBmLml0ZW07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF8uaG4oZyA/IGhhKGYpIDogZiwgZCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBfLlFxID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnQ1NTMUNvbXBhdCcgPT0gYS5jb21wYXRNb2RlOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLlZxID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhICYmIGEucGFyZW50Tm9kZSA/IGEucGFyZW50Tm9kZS5yZW1vdmVDaGlsZChhKSA6IG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uV3EgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGI7CiAgICAgICAgICAgICAgICBpZiAoQnEgJiYgIShfLmFvICYmIG9vKCc5JykgJiYgIW9vKCcxMCcpICYmIF8uci5TVkdFbGVtZW50ICYmIGEgaW5zdGFuY2VvZiBfLnIuU1ZHRWxlbWVudCkgJiYgKGIgPSBhLnBhcmVudEVsZW1lbnQpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgYiA9IGEucGFyZW50Tm9kZTsKICAgICAgICAgICAgICAgIHJldHVybiBfLmphKGIpICYmIDEgPT0gYi5ub2RlVHlwZSA/IGIgOiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICAkYiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiwgYyA9IGFyZ3VtZW50cy5sZW5ndGg7CiAgICAgICAgICAgICAgICBpZiAoIWMpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICBpZiAoMSA9PSBjKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhcmd1bWVudHNbMF07CiAgICAgICAgICAgICAgICB2YXIgZCA9IFtdLCBlID0gSW5maW5pdHk7CiAgICAgICAgICAgICAgICBmb3IgKGIgPSAwOyBiIDwgYzsgYisrKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiA9IFtdLCBnID0gYXJndW1lbnRzW2JdOyBnOykKICAgICAgICAgICAgICAgICAgICAgICAgZi51bnNoaWZ0KGcpLCBnID0gZy5wYXJlbnROb2RlOwogICAgICAgICAgICAgICAgICAgIGQucHVzaChmKTsKICAgICAgICAgICAgICAgICAgICBlID0gTWF0aC5taW4oZSwgZi5sZW5ndGgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZiA9IG51bGw7CiAgICAgICAgICAgICAgICBmb3IgKGIgPSAwOyBiIDwgZTsgYisrKSB7CiAgICAgICAgICAgICAgICAgICAgZyA9IGRbMF1bYl07CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaCA9IDE7IGggPCBjOyBoKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChnICE9IGRbaF1bYl0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgICAgICBmID0gZzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBmOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk1xID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiA5ID09IGEubm9kZVR5cGUgPyBhIDogYS5vd25lckRvY3VtZW50IHx8IGEuZG9jdW1lbnQ7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGNjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuY29udGVudFdpbmRvdyB8fCAoYS5jb250ZW50RG9jdW1lbnQgPyBfLlRxKGEuY29udGVudERvY3VtZW50KSA6IG51bGwpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIExxID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IGEgfHwgXy5yLmRvY3VtZW50IHx8IGRvY3VtZW50OwogICAgICAgICAgICB9OwogICAgICAgICAgICBwID0gTHEucHJvdG90eXBlOwogICAgICAgICAgICBwLmdldEVsZW1lbnRzQnlUYWdOYW1lID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHJldHVybiAoYiB8fCB0aGlzLmopLmdldEVsZW1lbnRzQnlUYWdOYW1lKFN0cmluZyhhKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuY3JlYXRlRWxlbWVudCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHRoaXMuajsKICAgICAgICAgICAgICAgIGEgPSBTdHJpbmcoYSk7CiAgICAgICAgICAgICAgICAnYXBwbGljYXRpb24veGh0bWwreG1sJyA9PT0gYi5jb250ZW50VHlwZSAmJiAoYSA9IGEudG9Mb3dlckNhc2UoKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYi5jcmVhdGVFbGVtZW50KGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwLmNyZWF0ZVRleHROb2RlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmouY3JlYXRlVGV4dE5vZGUoU3RyaW5nKGEpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5hcHBlbmQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgVXEoXy5NcShhKSwgYSwgYXJndW1lbnRzKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5nZCA9IF8uVnE7CiAgICAgICAgICAgIHZhciBYcSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBBYSgnaVBhZCcpIHx8IEFhKCdBbmRyb2lkJykgJiYgIUFhKCdNb2JpbGUnKSB8fCBBYSgnU2lsaycpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWnEsICRpLCAkcSwgJGg7CiAgICAgICAgICAgIF8uWXEgPSBSZWdFeHAoJ14oPzooW146Lz8jLl0rKTopPyg/Oi8vKD86KFteXFxcXC8/I10qKUApPyhbXlxcXFwvPyNdKj8pKD86OihbMC05XSspKT8oPz1bXFxcXC8/I118JCkpPyhbXj8jXSspPyg/OlxcPyhbXiNdKikpPyg/OiMoW1xcc1xcU10qKSk/JCcpOwogICAgICAgICAgICBacSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGRlY29kZVVSSShhKSA6IGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgICRpID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGIpKQogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSAwOyBkIDwgYi5sZW5ndGg7IGQrKykKICAgICAgICAgICAgICAgICAgICAgICAgJGkoYSwgU3RyaW5nKGJbZF0pLCBjKTsKICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICBudWxsICE9IGIgJiYgYy5wdXNoKGEgKyAoJycgPT09IGIgPyAnJyA6ICc9JyArIGVuY29kZVVSSUNvbXBvbmVudChTdHJpbmcoYikpKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgICRxID0gLyN8JC87CiAgICAgICAgICAgICRoID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gYS5zZWFyY2goJHEpOwogICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gMDsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYi5sZW5ndGg7IDAgPD0gKGQgPSBhLmluZGV4T2YoYiwgZCkpICYmIGQgPCBjOykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGEuY2hhckNvZGVBdChkIC0gMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgzOCA9PSBmIHx8IDYzID09IGYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZiA9IGEuY2hhckNvZGVBdChkICsgZSksICFmIHx8IDYxID09IGYgfHwgMzggPT0gZiB8fCAzNSA9PSBmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgKz0gZSArIDE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGQgPSAtMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgwID4gZCkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIGUgPSBhLmluZGV4T2YoJyYnLCBkKTsKICAgICAgICAgICAgICAgIGlmICgwID4gZSB8fCBlID4gYykKICAgICAgICAgICAgICAgICAgICBlID0gYzsKICAgICAgICAgICAgICAgIGQgKz0gYi5sZW5ndGggKyAxOwogICAgICAgICAgICAgICAgcmV0dXJuIGRlY29kZVVSSUNvbXBvbmVudChhLnN1YnN0cihkLCBlIC0gZCkucmVwbGFjZSgvXCsvZywgJyAnKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBiYywgYWMsIFVjLCBhciwgVmMsIGRpLCB1ZywgSGQsIGJyLCBjciwgTWcsIGFnLCBmciwgZ3IsIGVyLCBociwgaXIsIHZnLCBqciwga3IsIGxyLCBtciwgbnIsIG9yLCBPZywgcHIsIHFyLCByciwgQ2gsIElpLCBLaSwgR2ksIEhpLCBKaSwgV2ssIHNyLCB1ciwgdnIsIHdyLCB4ciwgeXIsIENjLCB6ciwgQXIsIGxoLCBCciwgQ3IsIERyLCBFciwgRnI7CiAgICAgICAgICAgIGJjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhYSAmJiBudWxsICE9IGEubG9jYXRpb24uaHJlZiAmJiBZbihhLCAnZm9vJyk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBhYyA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBkID0gZCB8fCBfLnI7CiAgICAgICAgICAgICAgICBjICYmIChkID0gYXIoZCkpOwogICAgICAgICAgICAgICAgZm9yIChjID0gMDsgZCAmJiA0MCA+IGMrKyAmJiAoIWIgJiYgIWJjKGQpIHx8ICFhKGQpKTspCiAgICAgICAgICAgICAgICAgICAgZCA9IGFyKGQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBVYyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhLCBiID0gYSA9IHZvaWQgMCA9PT0gYSA/IF8uciA6IGE7CiAgICAgICAgICAgICAgICBhYyhmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIGIgPSBjOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGFyID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLnBhcmVudDsKICAgICAgICAgICAgICAgICAgICBpZiAoYiAmJiBiICE9IGEpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFZjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBiYyhhLnRvcCkgPyBhLnRvcCA6IG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGRpID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gXy5PaSgnU0NSSVBUJywgYSk7CiAgICAgICAgICAgICAgICBiYihjLCBiKTsKICAgICAgICAgICAgICAgIHJldHVybiAoYSA9IGEuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ3NjcmlwdCcpWzBdKSAmJiBhLnBhcmVudE5vZGUgPyAoYS5wYXJlbnROb2RlLmluc2VydEJlZm9yZShjLCBhKSwgYykgOiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICB1ZyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYi5nZXRDb21wdXRlZFN0eWxlID8gYi5nZXRDb21wdXRlZFN0eWxlKGEsIG51bGwpIDogYS5jdXJyZW50U3R5bGU7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEhkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKCF2Lmdsb2JhbFRoaXMuY3J5cHRvKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLnJhbmRvbSgpOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG5ldyBVaW50MzJBcnJheSgxKTsKICAgICAgICAgICAgICAgICAgICB2Lmdsb2JhbFRoaXMuY3J5cHRvLmdldFJhbmRvbVZhbHVlcyhhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYVswXSAvIDY1NTM2IC8gNjU1MzY7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgucmFuZG9tKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uZWYgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCBpbiBhKQogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgZCkgJiYgYi5jYWxsKGMsIGFbZF0sIGQsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBiciA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiIGluIGEpCiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChhLCBiKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICB9OwogICAgICAgICAgICBjciA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IFtdOwogICAgICAgICAgICAgICAgXy5lZihhLCBmdW5jdGlvbiAoYywgZCkgewogICAgICAgICAgICAgICAgICAgIGIucHVzaChkKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uZHIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBbXTsKICAgICAgICAgICAgICAgIF8uZWYoYSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICBiLnB1c2goYyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBNZyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdmEoYSwgZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGEsIGQpICYmIGIoYywgZCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYWcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBhLmxlbmd0aDsKICAgICAgICAgICAgICAgIGlmICgwID09IGIpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMzA1NDE5ODk2LCBkID0gMDsgZCA8IGI7IGQrKykKICAgICAgICAgICAgICAgICAgICBjIF49IChjIDw8IDUpICsgKGMgPj4gMikgKyBhLmNoYXJDb2RlQXQoZCkgJiA0Mjk0OTY3Mjk1OwogICAgICAgICAgICAgICAgcmV0dXJuIDAgPCBjID8gYyA6IDQyOTQ5NjcyOTYgKyBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBmciA9IHRnKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBfLlJkKFsKICAgICAgICAgICAgICAgICAgICAnR29vZ2xlIFdlYiBQcmV2aWV3JywKICAgICAgICAgICAgICAgICAgICAnTWVkaWFwYXJ0bmVycy1Hb29nbGUnLAogICAgICAgICAgICAgICAgICAgICdHb29nbGUtUmVhZC1BbG91ZCcsCiAgICAgICAgICAgICAgICAgICAgJ0dvb2dsZS1BZHdvcmRzJwogICAgICAgICAgICAgICAgXSwgZXIpIHx8IDAuMDAwMSA+IE1hdGgucmFuZG9tKCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBnciA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5zZXRJdGVtKCdnb29nbGVfZXhwZXJpbWVudF9tb2QnLCBiKSwgYjsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICBlciA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gLTEgIT0gemEoKS5pbmRleE9mKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBociA9IC9eKFswLTkuXSspcHgkLzsKICAgICAgICAgICAgaXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gL150cnVlJC8udGVzdCgnZmFsc2UnKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIChhID0gaHIuZXhlYyhhKSkgPyArYVsxXSA6IG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGpyID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyAhMCA6IGI7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBudWxsOyBjICE9IGE7IGMgPSBhLCBhID0gYS5wYXJlbnQpCiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYS5sb2NhdGlvbi5wcm90b2NvbCkgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdodHRwczonOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdmaWxlOic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaHR0cDonOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGNhdGNoIChkKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGtyID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmICghYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB2YXIgYiA9IFJlZ0V4cCgnLipbJiM/XWdvb2dsZV9kZWJ1Zyg9W14mXSopPygmLiopPyQnKTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBiLmV4ZWMoZGVjb2RlVVJJQ29tcG9uZW50KGEpKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNbMV0gJiYgMSA8IGNbMV0ubGVuZ3RoID8gY1sxXS5zdWJzdHJpbmcoMSkgOiAndHJ1ZSc7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChkKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGxyID0gewogICAgICAgICAgICAgICAgSWU6ICdhbGxvdy1mb3JtcycsCiAgICAgICAgICAgICAgICBKZTogJ2FsbG93LW1vZGFscycsCiAgICAgICAgICAgICAgICBLZTogJ2FsbG93LW9yaWVudGF0aW9uLWxvY2snLAogICAgICAgICAgICAgICAgTGU6ICdhbGxvdy1wb2ludGVyLWxvY2snLAogICAgICAgICAgICAgICAgTWU6ICdhbGxvdy1wb3B1cHMnLAogICAgICAgICAgICAgICAgTmU6ICdhbGxvdy1wb3B1cHMtdG8tZXNjYXBlLXNhbmRib3gnLAogICAgICAgICAgICAgICAgT2U6ICdhbGxvdy1wcmVzZW50YXRpb24nLAogICAgICAgICAgICAgICAgUGU6ICdhbGxvdy1zYW1lLW9yaWdpbicsCiAgICAgICAgICAgICAgICBRZTogJ2FsbG93LXNjcmlwdHMnLAogICAgICAgICAgICAgICAgUmU6ICdhbGxvdy10b3AtbmF2aWdhdGlvbicsCiAgICAgICAgICAgICAgICBTZTogJ2FsbG93LXRvcC1uYXZpZ2F0aW9uLWJ5LXVzZXItYWN0aXZhdGlvbicKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbXIgPSB0ZyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gXy5kcihscik7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBuciA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IG1yKCk7CiAgICAgICAgICAgICAgICByZXR1cm4gYS5sZW5ndGggPyBfLkNkKGIsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoMCA8PSBfLmRhKGEsIGMpKTsKICAgICAgICAgICAgICAgIH0pIDogYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgb3IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IF8uT2koJ0lGUkFNRScpLCBiID0ge307CiAgICAgICAgICAgICAgICBfLmhuKG1yKCksIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgYS5zYW5kYm94ICYmIGEuc2FuZGJveC5zdXBwb3J0cyAmJiBhLnNhbmRib3guc3VwcG9ydHMoYykgJiYgKGJbY10gPSAhMCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBPZyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gYSAmJiBhLnRvU3RyaW5nICYmIGEudG9TdHJpbmcoKTsKICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PT0gdHlwZW9mIGEgJiYgLTEgIT0gYS5pbmRleE9mKCdbbmF0aXZlIGNvZGVdJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHByID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIWEuZnJhbWVzIHx8ICFhLmZyYW1lc1tiXSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBxciA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgNTAgPiBjOyArK2MpIHsKICAgICAgICAgICAgICAgICAgICBpZiAocHIoYSwgYikpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgIGlmICghKGEgPSBhcihhKSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHJyID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGlmICghYiB8fCAhYi5mcmFtZXMpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICBpZiAoYi5mcmFtZXNbYV0pCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIuZnJhbWVzW2FdLmZyYW1lRWxlbWVudDsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBiLmRvY3VtZW50LCBkID0gYy5oZWFkLCBlLCBmID0gbnVsbCAhPSAoZSA9IGMuYm9keSkgPyBlIDogbnVsbCA9PSBkID8gdm9pZCAwIDogZC5wYXJlbnRFbGVtZW50OwogICAgICAgICAgICAgICAgICAgIGlmIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gXy5PaSgnSUZSQU1FJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGcubmFtZSA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgIGcuaWQgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICBnLnNldEF0dHJpYnV0ZSgnc3R5bGUnLCAnZGlzcGxheTpub25lO3Bvc2l0aW9uOmZpeGVkO2xlZnQ6LTk5OXB4O3RvcDotOTk5cHg7d2lkdGg6MHB4O2hlaWdodDowcHg7Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGYuYXBwZW5kQ2hpbGQoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGgpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICBDaCA9IHRnKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAhWHEoKSAmJiAoQWEoJ2lQb2QnKSB8fCBBYSgnaVBob25lJykgfHwgQWEoJ0FuZHJvaWQnKSB8fCBBYSgnSUVNb2JpbGUnKSkgPyAyIDogWHEoKSA/IDEgOiAwOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgSWkgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICBmb3IgKGMgPSB2b2lkIDAgPT09IGMgPyAxMDAgOiBjOyBhICYmIGMtLTspIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYSA9PSBiKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgYSA9IGEucGFyZW50RWxlbWVudDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy53aSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBfLmVmKGIsIGZ1bmN0aW9uIChjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgYS5zdHlsZS5zZXRQcm9wZXJ0eShkLCBjLCAnaW1wb3J0YW50Jyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgS2kgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgZm9yIChjID0gdm9pZCAwID09PSBjID8gMTAwIDogYzsgYSAmJiBjLS0gJiYgITEgIT09IGIoYSk7KQogICAgICAgICAgICAgICAgICAgIGEgPSBhLnBhcmVudEVsZW1lbnQ7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEdpID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBKaShhLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnZml4ZWQnID09IGIucG9zaXRpb24gfHwgJ3N0aWNreScgPT0gYi5wb3NpdGlvbjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBIaSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gSmkoYSwgZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2xlZnQnID09IGJbJ2Zsb2F0J10gfHwgJ3JpZ2h0JyA9PSBiWydmbG9hdCddIHx8ICdsZWZ0JyA9PSBiLmNzc0Zsb2F0IHx8ICdyaWdodCcgPT0gYi5jc3NGbG9hdDsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBKaSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgIGZvciAoYyA9IHZvaWQgMCA9PT0gYyA/IDEwMCA6IGM7IGEgJiYgYy0tOykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gdWcoYSwgd2luZG93KTsKICAgICAgICAgICAgICAgICAgICBpZiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYihkKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEucGFyZW50RWxlbWVudDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFdrID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmICghYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIGEgPSBhLnRyYW5zZm9ybTsKICAgICAgICAgICAgICAgIGlmICghYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIGEgPSBhLnJlcGxhY2UoL14uKlwoKFswLTkuLCAtXSspXCkkLywgJyQxJykuc3BsaXQoLywgLyk7CiAgICAgICAgICAgICAgICByZXR1cm4gNiAhPSBhLmxlbmd0aCA/IG51bGwgOiBfLkFkKGEsIHBhcnNlRmxvYXQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBzciA9IHt9OwogICAgICAgICAgICBfLnRyID0gKHNyWydodHRwOi8vZ29vZ2xlYWRzLmcuZG91YmxlY2xpY2submV0J10gPSAhMCwgc3JbJ2h0dHA6Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbSddID0gITAsIHNyWydodHRwczovL2dvb2dsZWFkcy5nLmRvdWJsZWNsaWNrLm5ldCddID0gITAsIHNyWydodHRwczovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tJ10gPSAhMCwgc3IpOwogICAgICAgICAgICB1ciA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBfLnIuY29uc29sZSAmJiBfLnIuY29uc29sZS53YXJuICYmIF8uci5jb25zb2xlLndhcm4oYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZyID0gW107CiAgICAgICAgICAgIHdyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB2cjsKICAgICAgICAgICAgICAgIHZyID0gW107CiAgICAgICAgICAgICAgICBhID0gXy55KGEpOwogICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IGEubmV4dCgpOyAhYi5kb25lOyBiID0gYS5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICBiID0gYi52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBiKCk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgeHIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEucmVwbGFjZSgvXFwobnxyfFxcKS9nLCBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnbicgPT0gYyA/ICdcbicgOiAncicgPT0gYyA/ICdccicgOiAnXFwnOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHlyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIE1hdGgucG93KDIsIDUyKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIENjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmICgnbnVtYmVyJyAhPT0gdHlwZW9mIGEuZ29vZ19wdnNpZCkKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoYSwgJ2dvb2dfcHZzaWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogeXIoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIoYS5nb29nX3B2c2lkKSB8fCAtMTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgenIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgZGMoXy5UcShfLk1xKGEpKSwgYSwgYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEFyID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICdjb21wbGV0ZScgPT09IGEucmVhZHlTdGF0ZSB8fCAnaW50ZXJhY3RpdmUnID09PSBhLnJlYWR5U3RhdGUgPyAodnIucHVzaChiKSwgMSA9PSB2ci5sZW5ndGggJiYgKHYuUHJvbWlzZSA/IHYuUHJvbWlzZS5yZXNvbHZlKCkudGhlbih3cikgOiB3aW5kb3cuc2V0SW1tZWRpYXRlID8gc2V0SW1tZWRpYXRlKHdyKSA6IHNldFRpbWVvdXQod3IsIDApKSkgOiBhLmFkZEV2ZW50TGlzdGVuZXIoJ0RPTUNvbnRlbnRMb2FkZWQnLCBiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbGggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDAgPT09IGEgfHwgJ251bWJlcicgPT09IHR5cGVvZiBhICYmIGlzRmluaXRlKGEpICYmIDAgPT0gYSAlIDEgJiYgMCA8IGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEJyID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgucm91bmQoRGF0ZS5wYXJzZShhLmxhc3RNb2RpZmllZCkgLyAxMDAwKSB8fCBudWxsOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBDciA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IF8uT2koJ0RJVicpOwogICAgICAgICAgICAgICAgYy5pZCA9IGE7CiAgICAgICAgICAgICAgICBjLnRleHRDb250ZW50ID0gYjsKICAgICAgICAgICAgICAgIF8ud2koYywgewogICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzI0cHgnLAogICAgICAgICAgICAgICAgICAgICdsaW5lLWhlaWdodCc6ICcyNHB4JywKICAgICAgICAgICAgICAgICAgICAndGV4dC1hbGlnbic6ICdjZW50ZXInLAogICAgICAgICAgICAgICAgICAgICd2ZXJ0aWNhbC1hbGlnbic6ICdtaWRkbGUnLAogICAgICAgICAgICAgICAgICAgIGNvbG9yOiAnd2hpdGUnLAogICAgICAgICAgICAgICAgICAgICdiYWNrZ3JvdW5kLWNvbG9yJzogJ2JsYWNrJywKICAgICAgICAgICAgICAgICAgICBtYXJnaW46ICcwJywKICAgICAgICAgICAgICAgICAgICAnZm9udC1mYW1pbHknOiAnUm9ib3RvJywKICAgICAgICAgICAgICAgICAgICAnZm9udC1zdHlsZSc6ICdub3JtYWwnLAogICAgICAgICAgICAgICAgICAgICdmb250LXdlaWdodCc6ICc1MDAnLAogICAgICAgICAgICAgICAgICAgICdmb250LXNpemUnOiAnMTFweCcsCiAgICAgICAgICAgICAgICAgICAgJ2xldHRlci1zcGFjaW5nJzogJzAuMDhlbScKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIERyID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgdi5Qcm9taXNlKGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGIoJ3RpbWVvdXQnKTsKICAgICAgICAgICAgICAgICAgICB9LCBhKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBFciA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gSlNPTi5zdHJpbmdpZnkoYSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYiB8fCBTdHJpbmcoYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uT2kgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IGRvY3VtZW50IDogYjsKICAgICAgICAgICAgICAgIHJldHVybiBiLmNyZWF0ZUVsZW1lbnQoU3RyaW5nKGEpLnRvTG93ZXJDYXNlKCkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBGciA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gYTsgYSAmJiBhICE9IGEucGFyZW50OykKICAgICAgICAgICAgICAgICAgICBhID0gYS5wYXJlbnQsIGJjKGEpICYmIChiID0gYSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5HciA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICB0aGlzLnRvcCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLnJpZ2h0ID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuYm90dG9tID0gYzsKICAgICAgICAgICAgICAgIHRoaXMubGVmdCA9IGQ7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uR3IucHJvdG90eXBlLmdldFdpZHRoID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucmlnaHQgLSB0aGlzLmxlZnQ7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uR3IucHJvdG90eXBlLmdldEhlaWdodCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmJvdHRvbSAtIHRoaXMudG9wOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLkhyID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgXy5HcihhLnRvcCwgYS5yaWdodCwgYS5ib3R0b20sIGEubGVmdCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uR3IucHJvdG90eXBlLmNlaWwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLnRvcCA9IE1hdGguY2VpbCh0aGlzLnRvcCk7CiAgICAgICAgICAgICAgICB0aGlzLnJpZ2h0ID0gTWF0aC5jZWlsKHRoaXMucmlnaHQpOwogICAgICAgICAgICAgICAgdGhpcy5ib3R0b20gPSBNYXRoLmNlaWwodGhpcy5ib3R0b20pOwogICAgICAgICAgICAgICAgdGhpcy5sZWZ0ID0gTWF0aC5jZWlsKHRoaXMubGVmdCk7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5Hci5wcm90b3R5cGUuZmxvb3IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLnRvcCA9IE1hdGguZmxvb3IodGhpcy50b3ApOwogICAgICAgICAgICAgICAgdGhpcy5yaWdodCA9IE1hdGguZmxvb3IodGhpcy5yaWdodCk7CiAgICAgICAgICAgICAgICB0aGlzLmJvdHRvbSA9IE1hdGguZmxvb3IodGhpcy5ib3R0b20pOwogICAgICAgICAgICAgICAgdGhpcy5sZWZ0ID0gTWF0aC5mbG9vcih0aGlzLmxlZnQpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uR3IucHJvdG90eXBlLnJvdW5kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy50b3AgPSBNYXRoLnJvdW5kKHRoaXMudG9wKTsKICAgICAgICAgICAgICAgIHRoaXMucmlnaHQgPSBNYXRoLnJvdW5kKHRoaXMucmlnaHQpOwogICAgICAgICAgICAgICAgdGhpcy5ib3R0b20gPSBNYXRoLnJvdW5kKHRoaXMuYm90dG9tKTsKICAgICAgICAgICAgICAgIHRoaXMubGVmdCA9IE1hdGgucm91bmQodGhpcy5sZWZ0KTsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgSXIgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMubGVmdCA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy50b3AgPSBiOwogICAgICAgICAgICAgICAgICAgIHRoaXMud2lkdGggPSBjOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaGVpZ2h0ID0gZDsKICAgICAgICAgICAgICAgIH0sIEpyID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IF8uR3IoYS50b3AsIGEubGVmdCArIGEud2lkdGgsIGEudG9wICsgYS5oZWlnaHQsIGEubGVmdCk7CiAgICAgICAgICAgICAgICB9LCBLciA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBNYXRoLm1heChhLmxlZnQsIGIubGVmdCksIGQgPSBNYXRoLm1pbihhLmxlZnQgKyBhLndpZHRoLCBiLmxlZnQgKyBiLndpZHRoKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYyA8PSBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gTWF0aC5tYXgoYS50b3AsIGIudG9wKTsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IE1hdGgubWluKGEudG9wICsgYS5oZWlnaHQsIGIudG9wICsgYi5oZWlnaHQpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA8PSBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBJcihjLCBlLCBkIC0gYywgYSAtIGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIElyLnByb3RvdHlwZS5jZWlsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5sZWZ0ID0gTWF0aC5jZWlsKHRoaXMubGVmdCk7CiAgICAgICAgICAgICAgICB0aGlzLnRvcCA9IE1hdGguY2VpbCh0aGlzLnRvcCk7CiAgICAgICAgICAgICAgICB0aGlzLndpZHRoID0gTWF0aC5jZWlsKHRoaXMud2lkdGgpOwogICAgICAgICAgICAgICAgdGhpcy5oZWlnaHQgPSBNYXRoLmNlaWwodGhpcy5oZWlnaHQpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIElyLnByb3RvdHlwZS5mbG9vciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMubGVmdCA9IE1hdGguZmxvb3IodGhpcy5sZWZ0KTsKICAgICAgICAgICAgICAgIHRoaXMudG9wID0gTWF0aC5mbG9vcih0aGlzLnRvcCk7CiAgICAgICAgICAgICAgICB0aGlzLndpZHRoID0gTWF0aC5mbG9vcih0aGlzLndpZHRoKTsKICAgICAgICAgICAgICAgIHRoaXMuaGVpZ2h0ID0gTWF0aC5mbG9vcih0aGlzLmhlaWdodCk7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSXIucHJvdG90eXBlLnJvdW5kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5sZWZ0ID0gTWF0aC5yb3VuZCh0aGlzLmxlZnQpOwogICAgICAgICAgICAgICAgdGhpcy50b3AgPSBNYXRoLnJvdW5kKHRoaXMudG9wKTsKICAgICAgICAgICAgICAgIHRoaXMud2lkdGggPSBNYXRoLnJvdW5kKHRoaXMud2lkdGgpOwogICAgICAgICAgICAgICAgdGhpcy5oZWlnaHQgPSBNYXRoLnJvdW5kKHRoaXMuaGVpZ2h0KTsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgTHIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEgPSB2b2lkIDAgPT09IGEgPyBfLnIgOiBhOwogICAgICAgICAgICAgICAgICAgIHZhciBiID0gYS5jb250ZXh0IHx8IGEuQU1QX0NPTlRFWFRfREFUQTsKICAgICAgICAgICAgICAgICAgICBpZiAoIWIpCiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gYS5wYXJlbnQuY29udGV4dCB8fCBhLnBhcmVudC5BTVBfQ09OVEVYVF9EQVRBOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiAmJiBiLnBhZ2VWaWV3SWQgJiYgYi5jYW5vbmljYWxVcmwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfSwgTXIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoYSA9IGEgfHwgTHIoKSkgPyBiYyhhLm1hc3RlcikgPyBhLm1hc3RlciA6IG51bGwgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgT3IgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGlmIChhLmFtcEluYWJveEluaXRpYWxpemVkKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMsIGQgPSAnYW1wLWluaS1sb2FkJyA9PT0gYi5kYXRhOwogICAgICAgICAgICAgICAgICAgIGEuYW1wSW5hYm94UGVuZGluZ01lc3NhZ2VzICYmICFkICYmIChjID0gL15hbXAtKFxkezE1LDIwfSk/Ly5leGVjKGIuZGF0YSkpICYmIChhLmFtcEluYWJveFBlbmRpbmdNZXNzYWdlcy5wdXNoKGIpLCBOcihhLCBjWzFdKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfSwgUHIgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gITA7CiAgICAgICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/ICExIDogZDsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGEuYW1wSW5hYm94SWZyYW1lcyA9IGEuYW1wSW5hYm94SWZyYW1lcyB8fCBbXSwgZiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBiICYmIChlLnB1c2goYiksIGcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuQU1QICYmIGEuQU1QLmluYWJveFVucmVnaXN0ZXJJZnJhbWUgJiYgYS5BTVAuaW5hYm94VW5yZWdpc3RlcklmcmFtZShiKTsKICAgICAgICAgICAgICAgICAgICAgICAgZmEoZSwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgIGYoKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5hbXBJbmFib3hJbml0aWFsaXplZCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGc7CiAgICAgICAgICAgICAgICAgICAgYS5hbXBJbmFib3hQZW5kaW5nTWVzc2FnZXMgPSBhLmFtcEluYWJveFBlbmRpbmdNZXNzYWdlcyB8fCBbXTsKICAgICAgICAgICAgICAgICAgICBjICYmIC9eXGR7MTUsMjB9JC8udGVzdChjKSAmJiBOcihhLCBjKTsKICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGZ1bmN0aW9uIChrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIE9yKGEsIGspICYmIGYoKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGQgfHwgZS5nb29nbGVfYW1wX2xpc3RlbmVyX2FkZGVkIHx8IChlLmdvb2dsZV9hbXBfbGlzdGVuZXJfYWRkZWQgPSAhMCwgXy5mYihhLCAnbWVzc2FnZScsIGgpLCBmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBfLkxjKGEsICdtZXNzYWdlJywgaCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGc7CiAgICAgICAgICAgICAgICB9LCBOciA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYS5hbXBJbmFib3hJbml0aWFsaXplZCB8fCBiICYmICEvXlxkezE1LDIwfSQvLnRlc3QoYikgfHwgYS5kb2N1bWVudC5xdWVyeVNlbGVjdG9yKCdzY3JpcHRbc3JjJD0iYW1wNGFkcy1ob3N0LXYwLmpzIl0nKSB8fCBkaShhLmRvY3VtZW50LCBiID8gcGIoZ24oJ2h0dHBzOi8vY2RuLmFtcHByb2plY3Qub3JnL3J0di8le2FtcFZlcnNpb259L2FtcDRhZHMtaG9zdC12MC5qcycpLCB7IGFtcFZlcnNpb246IGIgfSkgOiBlaShmZChnbignaHR0cHM6Ly9jZG4uYW1wcHJvamVjdC5vcmcvYW1wNGFkcy1ob3N0LXYwLmpzJykpKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQmMsIFpsOwogICAgICAgICAgICBfLlFyID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGEuZ29vZ2xlX2ltYWdlX3JlcXVlc3RzIHx8IChhLmdvb2dsZV9pbWFnZV9yZXF1ZXN0cyA9IFtdKTsKICAgICAgICAgICAgICAgIHZhciBjID0gXy5PaSgnSU1HJywgYS5kb2N1bWVudCk7CiAgICAgICAgICAgICAgICBjLnNyYyA9IGI7CiAgICAgICAgICAgICAgICBhLmdvb2dsZV9pbWFnZV9yZXF1ZXN0cy5wdXNoKGMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBCYyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9ICdodHRwczovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL3BhZ2VhZC9nZW5fMjA0P2lkPScgKyBiOwogICAgICAgICAgICAgICAgXy5lZihhLCBmdW5jdGlvbiAoZCwgZSkgewogICAgICAgICAgICAgICAgICAgIGQgJiYgKGMgKz0gJyYnICsgZSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudChkKSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIFpsKGMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBabCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHdpbmRvdzsKICAgICAgICAgICAgICAgIGIuZmV0Y2ggPyBiLmZldGNoKGEsIHsKICAgICAgICAgICAgICAgICAgICBrZWVwYWxpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgIGNyZWRlbnRpYWxzOiAnaW5jbHVkZScsCiAgICAgICAgICAgICAgICAgICAgcmVkaXJlY3Q6ICdmb2xsb3cnLAogICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ2dldCcsCiAgICAgICAgICAgICAgICAgICAgbW9kZTogJ25vLWNvcnMnCiAgICAgICAgICAgICAgICB9KSA6IF8uUXIoYiwgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uZWMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5RZCA9IGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uUnIgPSBbCiAgICAgICAgICAgICAgICBmYygnZGF0YScpLAogICAgICAgICAgICAgICAgZmMoJ2h0dHAnKSwKICAgICAgICAgICAgICAgIGZjKCdodHRwcycpLAogICAgICAgICAgICAgICAgZmMoJ21haWx0bycpLAogICAgICAgICAgICAgICAgZmMoJ2Z0cCcpLAogICAgICAgICAgICAgICAgbmV3IF8uZWMoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gL15bXjpdKihbLz8jXXwkKS8udGVzdChhKTsKICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgIF07CiAgICAgICAgICAgIHZhciBVciwgTmQsIFdyLCBYciwgWXIsIGhnLCBrZzsKICAgICAgICAgICAgXy5UciA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT09IHR5cGVvZiBiKQogICAgICAgICAgICAgICAgICAgIChiID0gXy5TcihhLCBiKSkgJiYgKGEuc3R5bGVbYl0gPSBjKTsKICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkIGluIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYltkXSwgZiA9IF8uU3IoYywgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGYgJiYgKGMuc3R5bGVbZl0gPSBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFVyID0ge307CiAgICAgICAgICAgIF8uU3IgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBVcltiXTsKICAgICAgICAgICAgICAgIGlmICghYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gXy5KcShiKTsKICAgICAgICAgICAgICAgICAgICBjID0gZDsKICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGEuc3R5bGVbZF0gJiYgKGQgPSAoZW8gPyAnV2Via2l0JyA6IGNvID8gJ01veicgOiBfLmFvID8gJ21zJyA6IG51bGwpICsgS3EoZCksIHZvaWQgMCAhPT0gYS5zdHlsZVtkXSAmJiAoYyA9IGQpKTsKICAgICAgICAgICAgICAgICAgICBVcltiXSA9IGM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5WciA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IF8uTXEoYSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYy5kZWZhdWx0VmlldyAmJiBjLmRlZmF1bHRWaWV3LmdldENvbXB1dGVkU3R5bGUgJiYgKGEgPSBjLmRlZmF1bHRWaWV3LmdldENvbXB1dGVkU3R5bGUoYSwgbnVsbCkpID8gYVtiXSB8fCBhLmdldFByb3BlcnR5VmFsdWUoYikgfHwgJycgOiAnJzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTmQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIF8uVnIoYSwgYikgfHwgKGEuY3VycmVudFN0eWxlID8gYS5jdXJyZW50U3R5bGVbYl0gOiBudWxsKSB8fCBhLnN0eWxlICYmIGEuc3R5bGVbYl07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFdyID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgbGVmdDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgdG9wOiAwLAogICAgICAgICAgICAgICAgICAgICAgICByaWdodDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgYm90dG9tOiAwCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgWHIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKF8uYW8gJiYgISg4IDw9IE51bWJlcihybykpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLm9mZnNldFBhcmVudDsKICAgICAgICAgICAgICAgIHZhciBiID0gXy5NcShhKSwgYyA9IE5kKGEsICdwb3NpdGlvbicpLCBkID0gJ2ZpeGVkJyA9PSBjIHx8ICdhYnNvbHV0ZScgPT0gYzsKICAgICAgICAgICAgICAgIGZvciAoYSA9IGEucGFyZW50Tm9kZTsgYSAmJiBhICE9IGI7IGEgPSBhLnBhcmVudE5vZGUpCiAgICAgICAgICAgICAgICAgICAgaWYgKDExID09IGEubm9kZVR5cGUgJiYgYS5ob3N0ICYmIChhID0gYS5ob3N0KSwgYyA9IE5kKGEsICdwb3NpdGlvbicpLCBkID0gZCAmJiAnc3RhdGljJyA9PSBjICYmIGEgIT0gYi5kb2N1bWVudEVsZW1lbnQgJiYgYSAhPSBiLmJvZHksICFkICYmIChhLnNjcm9sbFdpZHRoID4gYS5jbGllbnRXaWR0aCB8fCBhLnNjcm9sbEhlaWdodCA+IGEuY2xpZW50SGVpZ2h0IHx8ICdmaXhlZCcgPT0gYyB8fCAnYWJzb2x1dGUnID09IGMgfHwgJ3JlbGF0aXZlJyA9PSBjKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWXIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBfLk1xKGEpLCBjID0gbmV3IF8uaWcoMCwgMCk7CiAgICAgICAgICAgICAgICB2YXIgZCA9IGIgPyBfLk1xKGIpIDogZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICBkID0gIV8uYW8gfHwgOSA8PSBOdW1iZXIocm8pIHx8IF8uUXEoTnEoZCkuaikgPyBkLmRvY3VtZW50RWxlbWVudCA6IGQuYm9keTsKICAgICAgICAgICAgICAgIGlmIChhID09IGQpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICBhID0gV3IoYSk7CiAgICAgICAgICAgICAgICBkID0gTnEoYikuajsKICAgICAgICAgICAgICAgIGIgPSBTcShkKTsKICAgICAgICAgICAgICAgIGQgPSBkLnBhcmVudFdpbmRvdyB8fCBkLmRlZmF1bHRWaWV3OwogICAgICAgICAgICAgICAgYiA9IF8uYW8gJiYgb28oJzEwJykgJiYgZC5wYWdlWU9mZnNldCAhPSBiLnNjcm9sbFRvcCA/IG5ldyBfLmlnKGIuc2Nyb2xsTGVmdCwgYi5zY3JvbGxUb3ApIDogbmV3IF8uaWcoZC5wYWdlWE9mZnNldCB8fCBiLnNjcm9sbExlZnQsIGQucGFnZVlPZmZzZXQgfHwgYi5zY3JvbGxUb3ApOwogICAgICAgICAgICAgICAgYy54ID0gYS5sZWZ0ICsgYi54OwogICAgICAgICAgICAgICAgYy55ID0gYS50b3AgKyBiLnk7CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgaGcgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgXy5pZygwLCAwKSwgZCA9IF8uVHEoXy5NcShhKSk7CiAgICAgICAgICAgICAgICBpZiAoIVluKGQsICdwYXJlbnQnKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGQgPT0gYiA/IFlyKGEpIDogXy5acihhKTsKICAgICAgICAgICAgICAgICAgICBjLnggKz0gZS54OwogICAgICAgICAgICAgICAgICAgIGMueSArPSBlLnk7CiAgICAgICAgICAgICAgICB9IHdoaWxlIChkICYmIGQgIT0gYiAmJiBkICE9IGQucGFyZW50ICYmIChhID0gZC5mcmFtZUVsZW1lbnQpICYmIChkID0gZC5wYXJlbnQpKTsKICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLlpyID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgPSBXcihhKTsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgXy5pZyhhLmxlZnQsIGEudG9wKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy4kciA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAnbnVtYmVyJyA9PSB0eXBlb2YgYSAmJiAoYSA9IChiID8gTWF0aC5yb3VuZChhKSA6IGEpICsgJ3B4Jyk7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBpZiAoJ25vbmUnICE9IE5kKGIsICdkaXNwbGF5JykpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoYik7CiAgICAgICAgICAgICAgICB2YXIgYyA9IGIuc3R5bGUsIGQgPSBjLmRpc3BsYXksIGUgPSBjLnZpc2liaWxpdHksIGYgPSBjLnBvc2l0aW9uOwogICAgICAgICAgICAgICAgYy52aXNpYmlsaXR5ID0gJ2hpZGRlbic7CiAgICAgICAgICAgICAgICBjLnBvc2l0aW9uID0gJ2Fic29sdXRlJzsKICAgICAgICAgICAgICAgIGMuZGlzcGxheSA9ICdpbmxpbmUnOwogICAgICAgICAgICAgICAgYSA9IGEoYik7CiAgICAgICAgICAgICAgICBjLmRpc3BsYXkgPSBkOwogICAgICAgICAgICAgICAgYy5wb3NpdGlvbiA9IGY7CiAgICAgICAgICAgICAgICBjLnZpc2liaWxpdHkgPSBlOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uUGQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBhLm9mZnNldFdpZHRoLCBjID0gYS5vZmZzZXRIZWlnaHQsIGQgPSBlbyAmJiAhYiAmJiAhYzsKICAgICAgICAgICAgICAgIHJldHVybiAodm9pZCAwID09PSBiIHx8IGQpICYmIGEuZ2V0Qm91bmRpbmdDbGllbnRSZWN0ID8gKGEgPSBXcihhKSwgbmV3IF8uVWkoYS5yaWdodCAtIGEubGVmdCwgYS5ib3R0b20gLSBhLnRvcCkpIDogbmV3IF8uVWkoYiwgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGtnID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmICghYS5nZXRCb3VuZGluZ0NsaWVudFJlY3QpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICBhID0gXy5PZChXciwgYSk7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IF8uVWkoYS5yaWdodCAtIGEubGVmdCwgYS5ib3R0b20gLSBhLnRvcCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBFaSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IE1yKExyKGEpKSB8fCBhOwogICAgICAgICAgICAgICAgICAgIGEgPSBhLmdvb2dsZV91bmlxdWVfaWQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09PSB0eXBlb2YgYSA/IGEgOiAwOwogICAgICAgICAgICAgICAgfSwgYXMgPSAhIXdpbmRvdy5nb29nbGVfYXN5bmNfaWZyYW1lX2lkLCBicyA9IGFzICYmIHdpbmRvdy5wYXJlbnQgfHwgd2luZG93LCBjcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYXMgJiYgIWJjKGJzKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9ICcuJyArIHFxLmRvbWFpbjsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyAyIDwgYS5zcGxpdCgnLicpLmxlbmd0aCAmJiAhYmMoYnMpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxcS5kb21haW4gPSBhID0gYS5zdWJzdHIoYS5pbmRleE9mKCcuJykgKyAxKSwgYnMgPSB3aW5kb3cucGFyZW50OwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYmMoYnMpIHx8IChicyA9IHdpbmRvdyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGJzICE9PSB3aW5kb3cgJiYgMC4wMSA+IE1hdGgucmFuZG9tKCkgJiYgQmMoewogICAgICAgICAgICAgICAgICAgICAgICBzdGFjazogRXJyb3IoKS5zdGFjaywKICAgICAgICAgICAgICAgICAgICAgICAgYXN3aWZ0OiB3aW5kb3cuZ29vZ2xlX2FzeW5jX2lmcmFtZV9pZAogICAgICAgICAgICAgICAgICAgIH0sICdiYWRwdWJ3aW4nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYnM7CiAgICAgICAgICAgICAgICB9LCBkcyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLkFjdGl2ZVhPYmplY3Q7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEubmF2aWdhdG9yLnBsdWdpbnMgJiYgYS5uYXZpZ2F0b3IubWltZVR5cGVzLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGIgPSBhLm5hdmlnYXRvci5wbHVnaW5zWydTaG9ja3dhdmUgRmxhc2gnXSkgJiYgYi5kZXNjcmlwdGlvbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiLmRlc2NyaXB0aW9uLnJlcGxhY2UoLyhbYS16QS1aXXxccykrLywgJycpLnJlcGxhY2UoLyhccykrci8sICcuJyk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEubmF2aWdhdG9yLnVzZXJBZ2VudCAmJiAwIDw9IGEubmF2aWdhdG9yLnVzZXJBZ2VudC5pbmRleE9mKCdXaW5kb3dzIENFJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IDE7IGE7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBuZXcgYignU2hvY2t3YXZlRmxhc2guU2hvY2t3YXZlRmxhc2guJyArIChjICsgMSkpLCBjKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDYSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IG5ldyBiKCdTaG9ja3dhdmVGbGFzaC5TaG9ja3dhdmVGbGFzaC43Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IG5ldyBiKCdTaG9ja3dhdmVGbGFzaC5TaG9ja3dhdmVGbGFzaC42JyksIGMgPSA2LCBhLkFsbG93U2NyaXB0QWNjZXNzID0gJ2Fsd2F5cyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoNiA9PT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLnRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBuZXcgYignU2hvY2t3YXZlRmxhc2guU2hvY2t3YXZlRmxhc2gnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgPSBhLkdldFZhcmlhYmxlKCckdmVyc2lvbicpLnNwbGl0KCcgJylbMV0sIGMucmVwbGFjZSgvLC9nLCAnLicpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAnMCc7CiAgICAgICAgICAgICAgICB9LCBjbCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IHZvaWQgMCA9PT0gYSA/IHdpbmRvdyA6IGE7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRzKGEpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcwJzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZXMgPSBrYyhmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBbXSwgYyA9IHt9OwogICAgICAgICAgICAgICAgYSA9IF8ueShhKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSBhLm5leHQoKTsgIWQuZG9uZTsgYyA9IHsgdmI6IGMudmIgfSwgZCA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgIGMudmIgPSBkLnZhbHVlLCBrYyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5wdXNoKCdbeyInICsgZS52Yi4kYyArICciOicgKyBlLnZiLm1lc3NhZ2UuWCgpICsgJ31dJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfShjKSkoKTsKICAgICAgICAgICAgICAgIHJldHVybiAnW1snICsgYi5qb2luKCcsJykgKyAnXV0nOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIGZzID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGlmICh2Lmdsb2JhbFRoaXMuZmV0Y2gpCiAgICAgICAgICAgICAgICAgICAgdi5nbG9iYWxUaGlzLmZldGNoKGEsIHsKICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IGIsCiAgICAgICAgICAgICAgICAgICAgICAgIGtlZXBhbGl2ZTogNjU1MzYgPiBiLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgY3JlZGVudGlhbHM6ICdvbWl0JywKICAgICAgICAgICAgICAgICAgICAgICAgbW9kZTogJ25vLWNvcnMnLAogICAgICAgICAgICAgICAgICAgICAgICByZWRpcmVjdDogJ2ZvbGxvdycKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IFhNTEh0dHBSZXF1ZXN0KCk7CiAgICAgICAgICAgICAgICAgICAgYy5vcGVuKCdQT1NUJywgYSwgITApOwogICAgICAgICAgICAgICAgICAgIGMuc2VuZChiKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHBtID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gdm9pZCAwID09PSBiID8gZnMgOiBiOwogICAgICAgICAgICAgICAgdGhpcy5BID0gdm9pZCAwID09PSBhID8gMTAwMCA6IGE7CiAgICAgICAgICAgICAgICB0aGlzLkYgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5tID0gW107CiAgICAgICAgICAgICAgICB0aGlzLmogPSBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwbS5wcm90b3R5cGUuWmMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IGdjLmFwcGx5KDAsIGFyZ3VtZW50cyksIGIgPSB0aGlzOwogICAgICAgICAgICAgICAga2MoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGIubS5wdXNoLmFwcGx5KGIubSwgXy5sYyhhKSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBrYyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gZXMoYi5tKTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5GKCdodHRwczovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL3BhZ2VhZC9waW5nP2U9MScsIGQpOwogICAgICAgICAgICAgICAgICAgICAgICBiLm0gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5qID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAxMDAgPD0gYi5tLmxlbmd0aCA/IChudWxsICE9PSBiLmogJiYgY2xlYXJUaW1lb3V0KGIuaiksIGIuaiA9IHNldFRpbWVvdXQoYywgMCkpIDogbnVsbCA9PT0gYi5qICYmIChiLmogPSBzZXRUaW1lb3V0KGMsIGIuQSkpOwogICAgICAgICAgICAgICAgfSkoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWZhdWx0VmFsdWUgPSB2b2lkIDAgPT09IGIgPyAhMSA6IGI7CiAgICAgICAgICAgICAgICB9LCBncyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRlZmF1bHRWYWx1ZSA9IHZvaWQgMCA9PT0gYiA/IDAgOiBiOwogICAgICAgICAgICAgICAgfSwgaHMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWZhdWx0VmFsdWUgPSB2b2lkIDAgPT09IGIgPyAnJyA6IGI7CiAgICAgICAgICAgICAgICB9LCBpcyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IFtdIDogYjsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGVmYXVsdFZhbHVlID0gYjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBUaywgQmwsIERsLCBuZiwganMsIGtzLCBscywgbXMsIEZpLCBucywgb3MsIHBzLCBxcywgcnMsIHNzLCB0cywgdXMsIHZzLCB3cywgeHMsIHlzLCB6cywgQXMsIEJzLCBDcywgRHMsIEVzLCBGcywgR3MsIEhzLCBJcywgSnMsIEtzLCB2ZiwgTHMsIE1zLCBOcywgT3MsIFBzLCBRcywgUnMsIFNzLCBUcywgVXMsIFZzLCBXcywgV2osIFhzLCBZcywgYmwsIFpzLCAkcywgYXQsIGJ0LCBjdCwgYWwsIGR0LCBldCwgZ2wsIGZ0LCBQbCwgT2YsIGd0LCBodCwgcWYsIGl0LCBxbSwganQsIGt0LCBsdCwgbXQsIG50LCBvdCwgcHQsIHF0LCBoaywgcnQsIHN0LCBaaSwgdHQsIHV0LCBYZywgdnQsIHd0LCB4dCwgeXQsIHp0LCBBdCwgQnQsIEN0LCBEdCwgRXQsIG5tLCBGdCwgR3QsIEh0LCBJdCwgV2MsIEp0LCBLdCwgRmMsIEx0LCBNdCwgTnQsIEFjLCBPdCwgdnEsIHhxLCBIZiwgUHQsIFF0LCBFaCwgUnQsIHRxLCBTdCwgVXQsIFZ0LCBXdCwgUmksIFh0LCBZdCwgWnQsICR0LCBhdSwgYnUsIGN1OwogICAgICAgICAgICBUayA9IG5ldyBSKDk4KTsKICAgICAgICAgICAgQmwgPSBuZXcgUigyMDYpOwogICAgICAgICAgICBEbCA9IG5ldyBncyg0NjUpOwogICAgICAgICAgICBuZiA9IG5ldyBSKDE0NCk7CiAgICAgICAgICAgIGpzID0gbmV3IFIoMzY4Mjc5NTU2KTsKICAgICAgICAgICAga3MgPSBuZXcgUigzNjY4MDk0MTMpOwogICAgICAgICAgICBscyA9IG5ldyBocygzKTsKICAgICAgICAgICAgbXMgPSBuZXcgaXMoNDgxKTsKICAgICAgICAgICAgRmkgPSBuZXcgZ3MoNywgMC4xKTsKICAgICAgICAgICAgbnMgPSBuZXcgUigyMTIpOwogICAgICAgICAgICBvcyA9IG5ldyBncygzODM0NzQzMjQpOwogICAgICAgICAgICBwcyA9IG5ldyBncyg0MTM3MjUwNDYpOwogICAgICAgICAgICBxcyA9IG5ldyBncygzODcxNjU1MzIpOwogICAgICAgICAgICBycyA9IG5ldyBSKDQxMDgwMzY5MCk7CiAgICAgICAgICAgIHNzID0gbmV3IFIoNDAxODUxOTU4KTsKICAgICAgICAgICAgdHMgPSBuZXcgUigzNTkzNTExNDUpOwogICAgICAgICAgICB1cyA9IG5ldyBSKDM5ODc3Njg3OCk7CiAgICAgICAgICAgIHZzID0gbmV3IFIoMzkxMzg1NTA1KTsKICAgICAgICAgICAgd3MgPSBuZXcgUigyMyk7CiAgICAgICAgICAgIHhzID0gbmV3IFIoMzY5NDMwKTsKICAgICAgICAgICAgeXMgPSBuZXcgZ3MoMzU3MDQ1MTI4KTsKICAgICAgICAgICAgenMgPSBuZXcgUig0MTA4ODM1NzYpOwogICAgICAgICAgICBBcyA9IG5ldyBSKDQxMTE3MDE0Nyk7CiAgICAgICAgICAgIEJzID0gbmV3IFIoNDAyOTA1MDM1KTsKICAgICAgICAgICAgQ3MgPSBuZXcgUigzOTU4NDIxMzkpOwogICAgICAgICAgICBEcyA9IG5ldyBSKDQwMzQwNTkzMik7CiAgICAgICAgICAgIEVzID0gbmV3IGdzKDQwODM4MDk5MiwgMC4wMSk7CiAgICAgICAgICAgIEZzID0gbmV3IFIoNDAwOTYzODA2KTsKICAgICAgICAgICAgR3MgPSBuZXcgUig0MDA5NjM4MDUpOwogICAgICAgICAgICBIcyA9IG5ldyBSKDQwMDk5MjQ2OSk7CiAgICAgICAgICAgIElzID0gbmV3IFIoNDAwOTkyNDY4LCAhMCk7CiAgICAgICAgICAgIEpzID0gbmV3IGdzKDM5NzMxNjkzOCwgMTAwMCk7CiAgICAgICAgICAgIEtzID0gbmV3IGdzKDM4NTQ0MDEzNSwgMTAwMCk7CiAgICAgICAgICAgIHZmID0gbmV3IFIoMzc4MjkwOTczKTsKICAgICAgICAgICAgTHMgPSBuZXcgZ3MoMzc3Mjg5MDE5LCAxMDAwMCk7CiAgICAgICAgICAgIE1zID0gbmV3IGdzKDM4NTYxMDE0OSwgMzAwKTsKICAgICAgICAgICAgTnMgPSBuZXcgUigzODQ3MzQ2NDIpOwogICAgICAgICAgICBPcyA9IG5ldyBncyg0ODgpOwogICAgICAgICAgICBQcyA9IG5ldyBncyg1MjksIDIwKTsKICAgICAgICAgICAgUXMgPSBuZXcgaHMoMTApOwogICAgICAgICAgICBScyA9IG5ldyBncyg0MDU4ODExMDYpOwogICAgICAgICAgICBTcyA9IG5ldyBSKDM2MDI0NTU5Nyk7CiAgICAgICAgICAgIFRzID0gbmV3IFIoNDUzNjAyNTQpOwogICAgICAgICAgICBVcyA9IG5ldyBncyg0OTQsIDUwMDApOwogICAgICAgICAgICBWcyA9IG5ldyBncyg1MTcpOwogICAgICAgICAgICBXcyA9IG5ldyBSKDM4NDcwMDM2MCk7CiAgICAgICAgICAgIFdqID0gbmV3IFIoMzg0NzAwMzYxKTsKICAgICAgICAgICAgWHMgPSBuZXcgUig0MTA1NzM5NTIpOwogICAgICAgICAgICBZcyA9IG5ldyBSKDQxMTg0MDk0OSk7CiAgICAgICAgICAgIGJsID0gbmV3IFIoNDEzNjgxNjg2KTsKICAgICAgICAgICAgWnMgPSBuZXcgUigzNzEzOTAzOTApOwogICAgICAgICAgICAkcyA9IG5ldyBSKDQxMzQ3NzcyOSk7CiAgICAgICAgICAgIGF0ID0gbmV3IFIoNDEzOTI1MzA1KTsKICAgICAgICAgICAgYnQgPSBuZXcgUigzODc2MjY2OTIpOwogICAgICAgICAgICBjdCA9IG5ldyBSKDQwMjE4MTgwMSk7CiAgICAgICAgICAgIGFsID0gbmV3IFIoNDEzNjY3NTE2KTsKICAgICAgICAgICAgZHQgPSBuZXcgUigyMCk7CiAgICAgICAgICAgIGV0ID0gbmV3IFIoMjIwKTsKICAgICAgICAgICAgZ2wgPSBuZXcgUigyMDApOwogICAgICAgICAgICBmdCA9IG5ldyBSKDExMSk7CiAgICAgICAgICAgIFBsID0gbmV3IFIoMzIzKTsKICAgICAgICAgICAgXy5GZiA9IG5ldyBncygzODg1MjkxOTEpOwogICAgICAgICAgICBPZiA9IG5ldyBncyg0OTIsIDAuMDEpOwogICAgICAgICAgICBndCA9IG5ldyBncygzNjM2NTAyNTEpOwogICAgICAgICAgICBodCA9IG5ldyBSKDgzKTsKICAgICAgICAgICAgcWYgPSBuZXcgUig4NSk7CiAgICAgICAgICAgIGl0ID0gbmV3IFIoNDAyODQ3MDE2KTsKICAgICAgICAgICAgcW0gPSBuZXcgZ3MoMzg5MzU3MjMwLCAxMDAwKTsKICAgICAgICAgICAganQgPSBuZXcgZ3MoMzk4Nzc2ODc3LCA2MDAwMCk7CiAgICAgICAgICAgIGt0ID0gbmV3IGdzKDM3NDIwMTI2OSwgNjAwMDApOwogICAgICAgICAgICBsdCA9IG5ldyBncygzNzEzNjQyMTMsIDYwMDAwKTsKICAgICAgICAgICAgbXQgPSBuZXcgZ3MoMzczNDQwOTIzLCAwLjAwMDEpOwogICAgICAgICAgICBudCA9IG5ldyBncygzNzYxNDk3NTcsIDAuMDAyNSk7CiAgICAgICAgICAgIG90ID0gbmV3IGdzKDM5NjY2ODkxNSwgNSk7CiAgICAgICAgICAgIHB0ID0gbmV3IFIoMzk2NjY4OTE0KTsKICAgICAgICAgICAgcXQgPSBuZXcgUigzOTk5ODI3NTksICEwKTsKICAgICAgICAgICAgaGsgPSBuZXcgUigzNzc5MzY1MTYpOwogICAgICAgICAgICBydCA9IG5ldyBncyg0NywgMSk7CiAgICAgICAgICAgIHN0ID0gbmV3IGdzKDI1KTsKICAgICAgICAgICAgWmkgPSBuZXcgaXMoMSk7CiAgICAgICAgICAgIHR0ID0gbmV3IGhzKDIsICcxLTAtMzgnKTsKICAgICAgICAgICAgdXQgPSBuZXcgUigxMTYpOwogICAgICAgICAgICBYZyA9IG5ldyBSKDQxNik7CiAgICAgICAgICAgIHZ0ID0gbmV3IFIoNDE0NDQwMDcwKTsKICAgICAgICAgICAgd3QgPSBuZXcgUig0MDkxNDc0MTYpOwogICAgICAgICAgICB4dCA9IG5ldyBpcyg0ODkpOwogICAgICAgICAgICB5dCA9IG5ldyBSKDM3MTE1NzkxMCk7CiAgICAgICAgICAgIHp0ID0gbmV3IFIoMzkyMDY1OTA1KTsKICAgICAgICAgICAgQXQgPSBuZXcgUigzNjAyNDU1OTgpOwogICAgICAgICAgICBCdCA9IG5ldyBncygzNjAyNDU1OTUsIDUwMCk7CiAgICAgICAgICAgIEN0ID0gbmV3IFIoMzYwMjQ1NTk2KTsKICAgICAgICAgICAgRHQgPSBuZXcgUigzOTY0NDI1OTgsICEwKTsKICAgICAgICAgICAgRXQgPSBuZXcgZ3MoMzU5MzQ2OTU2KTsKICAgICAgICAgICAgbm0gPSBuZXcgZ3MoNjEsIDAuMDAxKTsKICAgICAgICAgICAgRnQgPSBuZXcgUigzOTk3MDUzNTUpOwogICAgICAgICAgICBHdCA9IG5ldyBSKDUyMik7CiAgICAgICAgICAgIEh0ID0gbmV3IFIoNTAxKTsKICAgICAgICAgICAgSXQgPSBuZXcgaHMoMzYzOTMxMDIyKTsKICAgICAgICAgICAgV2MgPSBuZXcgUigxOTMwKTsKICAgICAgICAgICAgSnQgPSBuZXcgUig0NTMpOwogICAgICAgICAgICBLdCA9IG5ldyBSKDQ1NCk7CiAgICAgICAgICAgIEZjID0gbmV3IGdzKDM2MDI2MTk3MSk7CiAgICAgICAgICAgIEx0ID0gbmV3IGdzKDE5MjEsIDcyKTsKICAgICAgICAgICAgTXQgPSBuZXcgZ3MoMTkyMCwgMjQpOwogICAgICAgICAgICBOdCA9IG5ldyBncygxOTE3LCAzMDApOwogICAgICAgICAgICBBYyA9IG5ldyBncygxOTE2LCAwLjAwMSk7CiAgICAgICAgICAgIE90ID0gbmV3IGlzKDE5MzQsIFsKICAgICAgICAgICAgICAgICdBOEZIUzFObWRDd0dxRDlEd09pY25ISFkreTI3a2RXZnhLYTBZSFNHRGZ2MENTcERLUkhUUWRRbVpWUERVZGFGV1VzeGRnVnhsd0FkNm8rZGhKeWtQQTBBQUFDV2V5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwyUnZkV0pzWldOc2FXTnJMbTVsZERvME5ETWlMQ0ptWldGMGRYSmxJam9pUTI5dWRtVnljMmx2YmsxbFlYTjFjbVZ0Wlc1MElpd2laWGh3YVhKNUlqb3hOalF6TVRVMU1UazVMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsTENKMWMyRm5aU0k2SW5OMVluTmxkQ0o5JywKICAgICAgICAgICAgICAgICdBOHpkWGk2ZHIxaHdYRVVqUXJZaXlZUUdsVTM1NTd5NVFXRG5OMEx3Z2o5ZVB0NjZYTUV2TmtWV09FT1dQZDdUUDlzQlEyNVgwUTE1THIxTm40b0dGUWtBQUFDY2V5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwyZHZiMmRzWlhONWJtUnBZMkYwYVc5dUxtTnZiVG8wTkRNaUxDSm1aV0YwZFhKbElqb2lRMjl1ZG1WeWMybHZiazFsWVhOMWNtVnRaVzUwSWl3aVpYaHdhWEo1SWpveE5qUXpNVFUxTVRrNUxDSnBjMU4xWW1SdmJXRnBiaUk2ZEhKMVpTd2lhWE5VYUdseVpGQmhjblI1SWpwMGNuVmxMQ0oxYzJGblpTSTZJbk4xWW5ObGRDSjknLAogICAgICAgICAgICAgICAgJ0E0L0h0ZXJuMnVkTjl3M3lKSzlRZ1dReFFGcnV4T1hzWEw3Y1c2MER5Q2wwRVpGR0NTbWUvSjMzUS9XekY3YkJrVnZoRVdEbGNCaVV5WmFpbTVDcEZRd0FBQUNjZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJkdmIyZHNaWFJoWjNObGNuWnBZMlZ6TG1OdmJUbzBORE1pTENKbVpXRjBkWEpsSWpvaVEyOXVkbVZ5YzJsdmJrMWxZWE4xY21WdFpXNTBJaXdpWlhod2FYSjVJam94TmpRek1UVTFNVGs1TENKcGMxTjFZbVJ2YldGcGJpSTZkSEoxWlN3aWFYTlVhR2x5WkZCaGNuUjVJanAwY25WbExDSjFjMkZuWlNJNkluTjFZbk5sZENKOScKICAgICAgICAgICAgXSk7CiAgICAgICAgICAgIHZxID0gbmV3IFIoNzcpOwogICAgICAgICAgICB4cSA9IG5ldyBSKDc4KTsKICAgICAgICAgICAgSGYgPSBuZXcgUigzMDkpOwogICAgICAgICAgICBQdCA9IG5ldyBSKDE5NTkpOwogICAgICAgICAgICBRdCA9IG5ldyBSKDE5NTMsICEwKTsKICAgICAgICAgICAgRWggPSBuZXcgUigxOTYwKTsKICAgICAgICAgICAgUnQgPSBuZXcgUig4MCk7CiAgICAgICAgICAgIHRxID0gbmV3IFIoNzYpOwogICAgICAgICAgICBTdCA9IG5ldyBSKDgxKTsKICAgICAgICAgICAgXy5UdCA9IG5ldyBSKDE5NDcpOwogICAgICAgICAgICBVdCA9IG5ldyBSKDg0KTsKICAgICAgICAgICAgVnQgPSBuZXcgUigxOTU4KTsKICAgICAgICAgICAgV3QgPSBuZXcgUigxODgpOwogICAgICAgICAgICBSaSA9IG5ldyBSKDE5NDgsICEwKTsKICAgICAgICAgICAgWHQgPSBuZXcgUigxOTI4KTsKICAgICAgICAgICAgWXQgPSBuZXcgUigxOTQxKTsKICAgICAgICAgICAgWnQgPSBuZXcgUigzNzA5NDYzNDkpOwogICAgICAgICAgICAkdCA9IG5ldyBSKDM5MjczNjQ3Nik7CiAgICAgICAgICAgIGF1ID0gbmV3IGdzKDQwNjE0OTgzNSk7CiAgICAgICAgICAgIGJ1ID0gbmV3IFIoMzk3ODQxODI4KTsKICAgICAgICAgICAgY3UgPSBuZXcgaXMoMTkzMiwgWwogICAgICAgICAgICAgICAgJ0F4dWpLRzlJTmpzWjgvZ1VxOCtkVHJ1TnZrN1JqWlExb0ZoaGdRYmNUSktEblpmYnpTVEU4MXd2QzJIemFmM1RXNGF2QTc2TFRaRU1kaWVkRjF2SWJBNEFBQUJ1ZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJsdFlYTmtheTVuYjI5bmJHVmhjR2x6TG1OdmJUbzBORE1pTENKbVpXRjBkWEpsSWpvaVZISjFjM1JVYjJ0bGJuTWlMQ0psZUhCcGNua2lPakUyTlRJM056UTBNREFzSW1selZHaHBjbVJRWVhKMGVTSTZkSEoxWlgwPScsCiAgICAgICAgICAgICAgICAnQXp1Y2U4NU9SdFNuV2UxTVpEVHY2OHFwYVczaUh5Zkw5WWJMUnkwY3djQ1p3Vm5lUG5PbWtVSmxHOEhHaWttT3doWlUyMmRFbENjZnJmWDJIaHJCUEFrQUFBQjdleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMlJ2ZFdKc1pXTnNhV05yTG01bGREbzBORE1pTENKbVpXRjBkWEpsSWpvaVZISjFjM1JVYjJ0bGJuTWlMQ0psZUhCcGNua2lPakUyTlRJM056UTBNREFzSW1selUzVmlaRzl0WVdsdUlqcDBjblZsTENKcGMxUm9hWEprVUdGeWRIa2lPblJ5ZFdWOScsCiAgICAgICAgICAgICAgICAnQTE2bnZjZGVvT0FxckpjbWpMUnBsMUk2ZjNNY0REOEVmb2ZBWVR0L1AvSDQvQVd3Qjk5bnhpUHA2a0EwZlhvaVphdjkwOFo4ZXR1TDE2bGFGUFVkZlFzQUFBQ0JleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMmR2YjJkc1pYUmhaM05sY25acFkyVnpMbU52YlRvME5ETWlMQ0ptWldGMGRYSmxJam9pVkhKMWMzUlViMnRsYm5NaUxDSmxlSEJwY25raU9qRTJOVEkzTnpRME1EQXNJbWx6VTNWaVpHOXRZV2x1SWpwMGNuVmxMQ0pwYzFSb2FYSmtVR0Z5ZEhraU9uUnlkV1Y5JywKICAgICAgICAgICAgICAgICdBeEJIZHIwSjQ0dkZCUXRaVXFYOXNqaXFmNXlXWi9PY0hSY1JNTjNIOVRIK3Q5MFYvajNFTlc2QzgraWdCWkZYTUo3RzNQcjhEZDEzNjMyYUxuZzQyd2dBQUFDQmV5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwyZHZiMmRzWlhONWJtUnBZMkYwYVc5dUxtTnZiVG8wTkRNaUxDSm1aV0YwZFhKbElqb2lWSEoxYzNSVWIydGxibk1pTENKbGVIQnBjbmtpT2pFMk5USTNOelEwTURBc0ltbHpVM1ZpWkc5dFlXbHVJanAwY25WbExDSnBjMVJvYVhKa1VHRnlkSGtpT25SeWRXVjknLAogICAgICAgICAgICAgICAgJ0E4OEJXSEZqY2F3VWZLVTNsSWVqTG9yeVhveWpvb0JYTGdXbUdoK2hOY3FNSzQ0Y3VndnNJNVlaYk5hcll2aTNyb2MxZlliSEExQVZiaEF0dUhaZmxnRUFBQUIyZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJkdmIyZHNaUzVqYjIwNk5EUXpJaXdpWm1WaGRIVnlaU0k2SWxSeWRYTjBWRzlyWlc1eklpd2laWGh3YVhKNUlqb3hOalV5TnpjME5EQXdMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsZlE9PScKICAgICAgICAgICAgXSk7CiAgICAgICAgICAgIHZhciBkdSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBhLmosIGggPSBfLk9pKCdTQ1JJUFQnLCBnKTsKICAgICAgICAgICAgICAgICAgICAgICAgaC5hc3luYyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICBiYihoLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgZy5oZWFkLmFwcGVuZENoaWxkKGgpOwogICAgICAgICAgICAgICAgICAgICAgICBoLmFkZEV2ZW50TGlzdGVuZXIoJ2xvYWQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkICYmIGcuaGVhZC5yZW1vdmVDaGlsZChoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGguYWRkRXZlbnRMaXN0ZW5lcignZXJyb3InLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwIDwgYyA/IGR1KGEsIGIsIGMgLSAxLCBkLCBlLCBmKSA6IChkICYmIGcuaGVhZC5yZW1vdmVDaGlsZChoKSwgZigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaykgewogICAgICAgICAgICAgICAgICAgICAgICBmKCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgZXUgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIGMgPSB2b2lkIDAgPT09IGMgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfSA6IGM7CiAgICAgICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9IDogZDsKICAgICAgICAgICAgICAgICAgICBkdShOcShhKSwgYiwgMCwgITEsIGMsIGQpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGZ1ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gYS5kb2N1bWVudCwgYyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhLmZyYW1lcy5nb29nbGVmY1ByZXNlbnQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYi5ib2R5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBfLk9pKCdJRlJBTUUnLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnN0eWxlLmRpc3BsYXkgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5zdHlsZS53aWR0aCA9ICcwcHgnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQuc3R5bGUuaGVpZ2h0ID0gJzBweCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5zdHlsZS5ib3JkZXIgPSAnbm9uZSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5zdHlsZS56SW5kZXggPSAnLTEwMDAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQuc3R5bGUubGVmdCA9ICctMTAwMHB4JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnN0eWxlLnRvcCA9ICctMTAwMHB4JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLm5hbWUgPSAnZ29vZ2xlZmNQcmVzZW50JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLmJvZHkuYXBwZW5kQ2hpbGQoZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnNldFRpbWVvdXQoYywgNSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5ndSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMubSA9IHRoaXMubTsKICAgICAgICAgICAgICAgIHRoaXMuaWEgPSB0aGlzLmlhOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLmd1LnByb3RvdHlwZS5tID0gITE7CiAgICAgICAgICAgIF8uZ3UucHJvdG90eXBlLnVhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5tIHx8ICh0aGlzLm0gPSAhMCwgdGhpcy5GKCkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLmh1ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIF8uemwoYSwgXy5jbihvYywgYikpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLnpsID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGEubSA/IGIoKSA6IChhLmlhIHx8IChhLmlhID0gW10pLCBhLmlhLnB1c2goYikpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLmd1LnByb3RvdHlwZS5GID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXMuaWEpCiAgICAgICAgICAgICAgICAgICAgZm9yICg7IHRoaXMuaWEubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pYS5zaGlmdCgpKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBpdSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBhLmFkZHRsQ29uc2VudCAmJiAnc3RyaW5nJyAhPT0gdHlwZW9mIGEuYWRkdGxDb25zZW50ICYmIChhLmFkZHRsQ29uc2VudCA9IHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBhLmdkcHJBcHBsaWVzICYmICdib29sZWFuJyAhPT0gdHlwZW9mIGEuZ2RwckFwcGxpZXMgJiYgKGEuZ2RwckFwcGxpZXMgPSB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IGEudGNTdHJpbmcgJiYgJ3N0cmluZycgIT09IHR5cGVvZiBhLnRjU3RyaW5nIHx8IHZvaWQgMCAhPT0gYS5saXN0ZW5lcklkICYmICdudW1iZXInICE9PSB0eXBlb2YgYS5saXN0ZW5lcklkID8gMiA6IGEuY21wU3RhdHVzICYmICdlcnJvcicgIT09IGEuY21wU3RhdHVzID8gMCA6IDM7CiAgICAgICAgICAgICAgICB9LCBqbSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IDUwMCA6IGI7CiAgICAgICAgICAgICAgICAgICAgXy5ndS5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5BID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmwgPSB7fTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkIgPSAwOwogICAgICAgICAgICAgICAgICAgIHRoaXMubyA9IGI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5EID0gbnVsbDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhqbSwgXy5ndSk7CiAgICAgICAgICAgIGptLnByb3RvdHlwZS5GID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5sID0ge307CiAgICAgICAgICAgICAgICB0aGlzLkQgJiYgKF8uTGModGhpcy5qLCAnbWVzc2FnZScsIHRoaXMuRCksIGRlbGV0ZSB0aGlzLkQpOwogICAgICAgICAgICAgICAgZGVsZXRlIHRoaXMubDsKICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzLmo7CiAgICAgICAgICAgICAgICBkZWxldGUgdGhpcy5BOwogICAgICAgICAgICAgICAgXy5ndS5wcm90b3R5cGUuRi5jYWxsKHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbG0gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgPT09IHR5cGVvZiBhLmouX190Y2ZhcGkgfHwgbnVsbCAhPSBqdShhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgam0ucHJvdG90eXBlLmFkZEV2ZW50TGlzdGVuZXIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSB7fSwgYyA9IF8uVm4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShiKTsKICAgICAgICAgICAgICAgICAgICB9KSwgZCA9IDA7CiAgICAgICAgICAgICAgICAtMSAhPT0gdGhpcy5vICYmIChkID0gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYi50Y1N0cmluZyA9ICd0Y3VuYXZhaWxhYmxlJzsKICAgICAgICAgICAgICAgICAgICBiLmludGVybmFsRXJyb3JTdGF0ZSA9IDE7CiAgICAgICAgICAgICAgICAgICAgYygpOwogICAgICAgICAgICAgICAgfSwgdGhpcy5vKSk7CiAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uIChmLCBnKSB7CiAgICAgICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KGQpOwogICAgICAgICAgICAgICAgICAgIGYgPyAoYiA9IGYsIGIuaW50ZXJuYWxFcnJvclN0YXRlID0gaXUoYiksIGcgJiYgMCA9PT0gYi5pbnRlcm5hbEVycm9yU3RhdGUgfHwgKGIudGNTdHJpbmcgPSAndGN1bmF2YWlsYWJsZScsIGcgfHwgKGIuaW50ZXJuYWxFcnJvclN0YXRlID0gMykpKSA6IChiLnRjU3RyaW5nID0gJ3RjdW5hdmFpbGFibGUnLCBiLmludGVybmFsRXJyb3JTdGF0ZSA9IDMpOwogICAgICAgICAgICAgICAgICAgIGEoYik7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBrdSh0aGlzLCAnYWRkRXZlbnRMaXN0ZW5lcicsIGUpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZikgewogICAgICAgICAgICAgICAgICAgIGIudGNTdHJpbmcgPSAndGN1bmF2YWlsYWJsZScsIGIuaW50ZXJuYWxFcnJvclN0YXRlID0gMywgZCAmJiAoY2xlYXJUaW1lb3V0KGQpLCBkID0gMCksIGMoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgam0ucHJvdG90eXBlLnJlbW92ZUV2ZW50TGlzdGVuZXIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYSAmJiBhLmxpc3RlbmVySWQgJiYga3UodGhpcywgJ3JlbW92ZUV2ZW50TGlzdGVuZXInLCBudWxsLCBhLmxpc3RlbmVySWQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbXUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0geyBpbnRlcm5hbEVycm9yU3RhdGU6IDAgfSwgZCA9IF8uVm4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlID0gMDsKICAgICAgICAgICAgICAgICAgICAtMSAhPT0gYS5vICYmIChlID0gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMudGNTdHJpbmcgPSAndGN1bmF2YWlsYWJsZSc7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuaW50ZXJuYWxFcnJvclN0YXRlID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgZCgpOwogICAgICAgICAgICAgICAgICAgIH0sIGEubykpOwogICAgICAgICAgICAgICAgICAgIGt1KGEsICdhZGRFdmVudExpc3RlbmVyJywgZnVuY3Rpb24gKGYsIGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiAoY2xlYXJUaW1lb3V0KGUpLCBlID0gMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgJiYgKGMgPSBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgYy5pbnRlcm5hbEVycm9yU3RhdGUgPSBpdShjKTsKICAgICAgICAgICAgICAgICAgICAgICAgMCAhPSBjLmludGVybmFsRXJyb3JTdGF0ZSAmJiAoYy50Y1N0cmluZyA9ICd0Y3VuYXZhaWxhYmxlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwICE9IGMuaW50ZXJuYWxFcnJvclN0YXRlIHx8IGx1KGMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAga3UoYSwgJ3JlbW92ZUV2ZW50TGlzdGVuZXInLCBudWxsLCBjLmxpc3RlbmVySWQpLCBkKCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBrdSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgYyB8fCAoYyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGEuai5fX3RjZmFwaSkKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEuai5fX3RjZmFwaSwgYShiLCAyLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChqdShhKSkgewogICAgICAgICAgICAgICAgICAgICAgICBudShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSArK2EuQjsKICAgICAgICAgICAgICAgICAgICAgICAgYS5sW2VdID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgYS5BICYmIChjID0ge30sIGEuQS5wb3N0TWVzc2FnZSgoYy5fX3RjZmFwaUNhbGwgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21tYW5kOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxJZDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtZXRlcjogZAogICAgICAgICAgICAgICAgICAgICAgICB9LCBjKSwgJyonKSk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIGMoe30sICExKTsKICAgICAgICAgICAgICAgIH0sIGp1ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5BKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5BOwogICAgICAgICAgICAgICAgICAgIGEuQSA9IHFyKGEuaiwgJ19fdGNmYXBpTG9jYXRvcicpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLkE7CiAgICAgICAgICAgICAgICB9LCBudSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYS5EIHx8IChhLkQgPSBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAoJ3N0cmluZycgPT09IHR5cGVvZiBiLmRhdGEgPyBKU09OLnBhcnNlKGIuZGF0YSkgOiBiLmRhdGEpLl9fdGNmYXBpUmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5sW2MuY2FsbElkXShjLnJldHVyblZhbHVlLCBjLnN1Y2Nlc3MpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBfLmZiKGEuaiwgJ21lc3NhZ2UnLCBhLkQpKTsKICAgICAgICAgICAgICAgIH0sIGx1ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoITEgPT09IGEuZ2RwckFwcGxpZXMpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGEuaW50ZXJuYWxFcnJvclN0YXRlICYmIChhLmludGVybmFsRXJyb3JTdGF0ZSA9IGl1KGEpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Vycm9yJyA9PT0gYS5jbXBTdGF0dXMgfHwgMCAhPT0gYS5pbnRlcm5hbEVycm9yU3RhdGUgfHwgJ2xvYWRlZCcgPT09IGEuY21wU3RhdHVzICYmICgndGNsb2FkZWQnID09PSBhLmV2ZW50U3RhdHVzIHx8ICd1c2VyYWN0aW9uY29tcGxldGUnID09PSBhLmV2ZW50U3RhdHVzKSA/ICEwIDogITE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgb3UgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5GID0gYjsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSB2b2lkIDAgPT09IGMgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfSA6IGM7CiAgICAgICAgICAgICAgICB9LCBwdSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBvdShhLCBiLCBjKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIG91LnByb3RvdHlwZS5zdGFydCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgZnUodGhpcy5qKSwgcXUodGhpcyk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChhKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBxdSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHBiKGduKCdodHRwczovL2Z1bmRpbmdjaG9pY2VzbWVzc2FnZXMuZ29vZ2xlLmNvbS9pLyV7aWR9P2Vycz0le2Vyc30nKSwgewogICAgICAgICAgICAgICAgICAgIGlkOiBhLkYsCiAgICAgICAgICAgICAgICAgICAgZXJzOiAzCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGV1KGEuaiwgYiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGEubSghMCk7CiAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYS5tKCExKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgRiA9IHsKICAgICAgICAgICAgICAgIFplOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgQWY6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgVmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgRi5NYSA9IHBjOwogICAgICAgICAgICB2YXIgcnUgPSBwYyhmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGEgJiYgdm9pZCAwICE9PSBhOwogICAgICAgICAgICB9LCAnZXhpc3RzJyk7CiAgICAgICAgICAgIEYuYXNzZXJ0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICB9OwogICAgICAgICAgICBGLnZhID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICBGLktmID0gcWM7CiAgICAgICAgICAgIEYuTmYgPSByYzsKICAgICAgICAgICAgRi5qYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRi50ZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRi5NZiA9IHNjOwogICAgICAgICAgICBGLlBmID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHNjKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEYuc2YgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEYuSCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRi5MZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBxYyhhLCBydSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEYuT2YgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIHJjKGEsIHJ1KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRi55ZiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYShiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRi5mdW5jdGlvbk5hbWUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBhLm5hbWU7CiAgICAgICAgICAgICAgICBiIHx8IChiID0gKGEgPSAvZnVuY3Rpb25ccysoW15cKF0rKS9tLmV4ZWMoU3RyaW5nKGEpKSkgPyBhWzFdIDogJyhBbm9ueW1vdXMpJyk7CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHZlID0gKDAsIEYuTWEpKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09PSB0eXBlb2YgYTsKICAgICAgICAgICAgICAgIH0sICdudW1iZXInKSwgc2UgPSAoMCwgRi5NYSkoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT09IHR5cGVvZiBhOwogICAgICAgICAgICAgICAgfSwgJ3N0cmluZycpLCB3ZSA9ICgwLCBGLk1hKShmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnYm9vbGVhbicgPT09IHR5cGVvZiBhOwogICAgICAgICAgICAgICAgfSwgJ2Jvb2xlYW4nKSwgeWUgPSAoMCwgRi5NYSkoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gYTsKICAgICAgICAgICAgICAgIH0sICdudWxsJyksIHhlID0gKDAsIEYuTWEpKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PT0gYTsKICAgICAgICAgICAgICAgIH0sICd1bmRlZmluZWQnKSwgemUgPSAoMCwgRi5NYSkoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGE7CiAgICAgICAgICAgICAgICB9LCAnRnVuY3Rpb24nKSwgQWUgPSAoMCwgRi5NYSkoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShhKTsKICAgICAgICAgICAgICAgIH0sICdBcnJheTx1bmtub3duPicpOwogICAgICAgICAgICB2YXIgc3UgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oc3UsIFEpOwogICAgICAgICAgICB2YXIgdHUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8odHUsIFEpOwogICAgICAgICAgICB2YXIgSWsgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oSWssIFEpOwogICAgICAgICAgICB2YXIgRmsgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEsIC0xLCB1dSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhGaywgUSk7CiAgICAgICAgICAgIEZrLnByb3RvdHlwZS5nZXRUYWdTZXNzaW9uQ29ycmVsYXRvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBzayh0aGlzLCAyKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHV1ID0gWzRdLCBLayA9IFsKICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgOAogICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgdmFyIEJmID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgdnUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oQmYsIFEpOwogICAgICAgICAgICB2YXIgdnUgPSBbM107CiAgICAgICAgICAgIHZhciBBZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSwgLTEsIHd1KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEFmLCBRKTsKICAgICAgICAgICAgdmFyIHd1ID0gWzRdOwogICAgICAgICAgICB2YXIgeGYgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEsIC0xLCB4dSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyh4ZiwgUSk7CiAgICAgICAgICAgIHhmLnByb3RvdHlwZS5nZXRUYWdTZXNzaW9uQ29ycmVsYXRvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBzayh0aGlzLCAxKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHh1ID0gWzJdOwogICAgICAgICAgICB2YXIgd2YgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8od2YsIFEpOwogICAgICAgICAgICB2YXIgRWYgPSBbNF07CiAgICAgICAgICAgIF8uSGcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSAnVWEnOwogICAgICAgICAgICAgICAgaWYgKGEuVWEgJiYgYS5oYXNPd25Qcm9wZXJ0eShiKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5VYTsKICAgICAgICAgICAgICAgIGIgPSBuZXcgYSgpOwogICAgICAgICAgICAgICAgcmV0dXJuIGEuVWEgPSBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgeXUsIHp1LCBZaTsKICAgICAgICAgICAgeXUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgdGhpcy5tID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBhW2JdID8gYVtiXSA6IGM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5GID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBhW2JdID8gYVtiXSA6IGM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5BID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBhW2JdID8gYVtiXSA6IGM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5EID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBhW2JdID8gYVtiXSA6IGM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5IID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBfLkhnKHl1KS5tKGEuaiwgYS5kZWZhdWx0VmFsdWUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLnpjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBfLkhnKHl1KS5GKGEuaiwgYS5kZWZhdWx0VmFsdWUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB6dSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gXy5IZyh5dSkuQShhLmosIGEuZGVmYXVsdFZhbHVlKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWWkgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIF8uSGcoeXUpLkQoYS5qLCBhLmRlZmF1bHRWYWx1ZSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBBdSA9IG5hdmlnYXRvciwgSXUgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZikgewogICAgICAgICAgICAgICAgICAgIGlmIChMcigpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY3MoKS5nYUdsb2JhbCB8fCB7fTsKICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IE1hdGgucm91bmQobmV3IERhdGUoKS5nZXRUaW1lKCkgLyAxMDAwKSwgaCA9IGYuZ29vZ2xlX2FuYWx5dGljc19kb21haW5fbmFtZTsKICAgICAgICAgICAgICAgICAgICBhID0gJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIGggPyBCdSgnYXV0bycsIGEpIDogQnUoaCwgYSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSAtMSA8IGIuaW5kZXhPZignX191dG1hPScgKyBhICsgJy4nKSwgbCA9IC0xIDwgYi5pbmRleE9mKCdfX3V0bWI9JyArIGEpOwogICAgICAgICAgICAgICAgICAgIChmID0gKE1yKCkgfHwgY3MoKSkuZ2FHbG9iYWwpIHx8IChmID0ge30sIChNcigpIHx8IGNzKCkpLmdhR2xvYmFsID0gZik7CiAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSAhMTsKICAgICAgICAgICAgICAgICAgICBpZiAoaykKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGIuc3BsaXQoJ19fdXRtYT0nICsgYSArICcuJylbMV0uc3BsaXQoJzsnKVswXS5zcGxpdCgnLicpLCBsID8gZi5zaWQgPSBlWzNdIDogZi5zaWQgfHwgKGYuc2lkID0gZyArICcnKSwgZi52aWQgPSBlWzBdICsgJy4nICsgZVsxXSwgZi5mcm9tX2Nvb2tpZSA9ICEwOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBmLnNpZCB8fCAoZi5zaWQgPSBnICsgJycpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYudmlkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsID0gTWF0aC5yb3VuZCgyMTQ3NDgzNjQ3ICogTWF0aC5yYW5kb20oKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrID0gQXUuYXBwTmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gQXUudmVyc2lvbiwgcSA9IEF1Lmxhbmd1YWdlID8gQXUubGFuZ3VhZ2UgOiBBdS5icm93c2VyTGFuZ3VhZ2UsIHUgPSBBdS5wbGF0Zm9ybSwgQiA9IEF1LnVzZXJBZ2VudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHggPSBBdS5qYXZhRW5hYmxlZCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoQykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggPyAxIDogMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5qb2luKCcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPyB4ICs9IGQud2lkdGggKyAneCcgKyBkLmhlaWdodCArIGQuY29sb3JEZXB0aCA6IF8uci5qYXZhICYmIF8uci5qYXZhLmF3dCAmJiAoZCA9IF8uci5qYXZhLmF3dC5Ub29sa2l0LmdldERlZmF1bHRUb29sa2l0KCkuZ2V0U2NyZWVuU2l6ZSgpLCB4ICs9IGQuc2NyZWVuLndpZHRoICsgJ3gnICsgZC5zY3JlZW4uaGVpZ2h0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggPSB4ICsgYiArIChlIHx8ICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IHgubGVuZ3RoOyAwIDwgYzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeCArPSBjLS0gXiBlKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnZpZCA9IChsIF4gQ3UoeCkgJiAyMTQ3NDgzNjQ3KSArICcuJyArIGc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXy5IKFF0KSAmJiBmLmZyb21fY29va2llIHx8IChmLmZyb21fY29va2llID0gITEpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoIWYuY2lkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGcgPSA5OTksIGggJiYgKGggPSAwID09IGguaW5kZXhPZignLicpID8gaC5zdWJzdHIoMSkgOiBoLCBnID0gaC5zcGxpdCgnLicpLmxlbmd0aCksIGggPSA5OTksIGIgPSBiLnNwbGl0KCc7JyksIGUgPSAwOyBlIDwgYi5sZW5ndGg7IGUrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCA9IER1LmV4ZWMoYltlXSkgfHwgRXUuZXhlYyhiW2VdKSB8fCBGdS5leGVjKGJbZV0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggPSBkWzFdIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh4ID09IGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB6ID0gZFsyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeCA8IGggJiYgKGggPSB4LCB6ID0gZFsyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBtICYmIHogJiYgLTEgIT0gei5zZWFyY2goL15cZCtcLlxkKyQvKSA/IChmLnZpZCA9IHosIGYuZnJvbV9jb29raWUgPSAhMCkgOiB6ICE9IGYudmlkICYmIChmLmNpZCA9IHopOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmLmRoID0gYTsKICAgICAgICAgICAgICAgICAgICBmLmhpZCB8fCAoZi5oaWQgPSBNYXRoLnJvdW5kKDIxNDc0ODM2NDcgKiBNYXRoLnJhbmRvbSgpKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgICAgICB9LCBDdSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSAxLCBjOwogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT0gYSAmJiAnJyAhPSBhKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGIgPSAwLCBjID0gYS5sZW5ndGggLSAxOyAwIDw9IGM7IGMtLSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLmNoYXJDb2RlQXQoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gKGIgPDwgNiAmIDI2ODQzNTQ1NSkgKyBkICsgKGQgPDwgMTQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGIgJiAyNjYzMzgzMDQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gMCAhPSBkID8gYiBeIGQgPj4gMjEgOiBiOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9LCBCdSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8ICdub25lJyA9PSBhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgICAgICAgICAgICBhID0gU3RyaW5nKGEpOwogICAgICAgICAgICAgICAgICAgICdhdXRvJyA9PSBhICYmIChhID0gYiwgJ3d3dy4nID09IGEuc3Vic3RyaW5nKDAsIDQpICYmIChhID0gYS5zdWJzdHJpbmcoNCwgYS5sZW5ndGgpKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEN1KGEudG9Mb3dlckNhc2UoKSk7CiAgICAgICAgICAgICAgICB9LCBEdSA9IFJlZ0V4cCgnXlxccypfZ2E9XFxzKjFcXC4oXFxkKylbXi5dKlxcLiguKj8pXFxzKiQnKSwgRXUgPSBSZWdFeHAoJ15bXj1dKz1cXHMqR0ExXFwuKFxcZCspW14uXSpcXC4oLio/KVxccyokJyksIEZ1ID0gUmVnRXhwKCdeXFxzKl9nYT1cXHMqKCkoYW1wLVtcXHcuLV17MjIsNjR9KSQnKTsKICAgICAgICAgICAgdmFyIGZnID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFhICYmIGEudG9wID09IGE7CiAgICAgICAgICAgICAgICB9LCBKdSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgYyA9IGMgfHwgYS5nb29nbGVfYWRfd2lkdGg7CiAgICAgICAgICAgICAgICAgICAgZCA9IGQgfHwgYS5nb29nbGVfYWRfaGVpZ2h0OwogICAgICAgICAgICAgICAgICAgIGlmIChmZyhhKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gYi5kb2N1bWVudEVsZW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMgJiYgZCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IDEsIGcgPSAxOwogICAgICAgICAgICAgICAgICAgICAgICBhLmlubmVySGVpZ2h0ID8gKGYgPSBhLmlubmVyV2lkdGgsIGcgPSBhLmlubmVySGVpZ2h0KSA6IGUgJiYgZS5jbGllbnRIZWlnaHQgPyAoZiA9IGUuY2xpZW50V2lkdGgsIGcgPSBlLmNsaWVudEhlaWdodCkgOiBiLmJvZHkgJiYgKGYgPSBiLmJvZHkuY2xpZW50V2lkdGgsIGcgPSBiLmJvZHkuY2xpZW50SGVpZ2h0KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGcgPiAyICogZCB8fCBmID4gMiAqIGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBLdSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IHZvaWQgMCA9PT0gYSA/IHdpbmRvdyA6IGE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuX2dtcHRubCA/ICdhZm1hLWdwdC1zZGstYScgOiBhLndlYmtpdCAmJiBhLndlYmtpdC5tZXNzYWdlSGFuZGxlcnMgJiYgYS53ZWJraXQubWVzc2FnZUhhbmRsZXJzLl9nbXB0bmwgPyAnYWZtYS1ncHQtc2RrLWknIDogbnVsbDsKICAgICAgICAgICAgICAgIH0sIEx1ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gd2luZG93IDogYjsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IEt1KGIpOwogICAgICAgICAgICAgICAgICAgIGlmICghYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICdhZm1hLWdwdC1zZGstYScgPT0gYyA/IGQgPSBiLl9nbXB0bmwucG0oJ0dBTT0nLCBhKSB8fCAnNScgOiAoZCA9IGIuX19nbXB0bmxfbiB8fCAnNScsIGIud2Via2l0Lm1lc3NhZ2VIYW5kbGVycy5fZ21wdG5sLnBvc3RNZXNzYWdlKCdHQU09JykpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICczJzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09PSB0eXBlb2YgZCA/IGQgOiAnMyc7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQ2cgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBbXTsKICAgICAgICAgICAgICAgIHRoaXMubSA9IC0xOwogICAgICAgICAgICB9OwogICAgICAgICAgICBDZy5wcm90b3R5cGUuc2V0ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyAhMCA6IGI7CiAgICAgICAgICAgICAgICAwIDw9IGEgJiYgNTIgPiBhICYmIDAgPT09IGEgJSAxICYmIHRoaXMualthXSAhPSBiICYmICh0aGlzLmpbYV0gPSBiLCB0aGlzLm0gPSAtMSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIENnLnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuICEhdGhpcy5qW2FdOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgRGcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgLTEgPT0gYS5tICYmIChhLm0gPSBqbihhLmosIGZ1bmN0aW9uIChiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgPyBiICsgTWF0aC5wb3coMiwgZCkgOiBiOwogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgcmV0dXJuIGEubTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE51ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgTXUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oTnUsIFEpOwogICAgICAgICAgICB2YXIgUHUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGdoKGEsIDEsIE91LCBiKTsKICAgICAgICAgICAgICAgIH0sIE91ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oT3UsIFEpOwogICAgICAgICAgICB2YXIgUXUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IE91KCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFiKGIsIDEsIGEsIDApOwogICAgICAgICAgICAgICAgfSwgUnUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBRYihhLCAyLCBiLCAwKTsKICAgICAgICAgICAgICAgIH0sIE11ID0gWzFdOwogICAgICAgICAgICB2YXIgVHUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmdldEl0ZW0oJ2dvb2dsZV9leHBlcmltZW50X21vZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBjID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBjIHx8ICcnOwogICAgICAgICAgICAgICAgICAgIGMgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID0gU2woTnUsIGQpLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFNsKE51LCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFB1KGUsIFJ1KFF1KDEpLCAtMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5YKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFN1KGQpLCBjID0gbmV3IE51KCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGUgPSBVYihjLCBPdSwgMSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUgPSBiYShlLCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRrKGcsIDEsIDApID09PSBiOwogICAgICAgICAgICAgICAgICAgICAgICB9KSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHNrKGUsIDIpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gZiB8fCBpc05hTihmKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN1KGQpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZCA9IGZyKCkgPyBudWxsIDogTWF0aC5mbG9vcigxMDAwICogSGQoKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIGUgPyBSdShlLCBkKSA6IFB1KGMsIFJ1KFF1KGIpLCBkKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdyKGEsIGMuWCgpKSA/IGQgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgU3UgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIDAuMDEgPiBNYXRoLnJhbmRvbSgpICYmIEJjKHsgZGF0YTogYSB9LCAnbHNfdGFtcCcpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHZjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBhIHx8IHsgY29va2llOiAnJyB9OwogICAgICAgICAgICAgICAgfSwgVnUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBVdTsKICAgICAgICAgICAgICAgICAgICBpZiAoIV8uci5uYXZpZ2F0b3IuY29va2llRW5hYmxlZCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIGlmICghYS5pc0VtcHR5KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICBhLnNldCgnVEVTVENPT0tJRVNFTkFCTEVEJywgJzEnLCB7IHFjOiA2MCB9KTsKICAgICAgICAgICAgICAgICAgICBpZiAoJzEnICE9PSBhLmdldCgnVEVTVENPT0tJRVNFTkFCTEVEJykpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBhLnJlbW92ZSgnVEVTVENPT0tJRVNFTkFCTEVEJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgcCA9IHZjLnByb3RvdHlwZTsKICAgICAgICAgICAgcC5zZXQgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgdmFyIGQgPSAhMTsKICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gdHlwZW9mIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMuUWY7CiAgICAgICAgICAgICAgICAgICAgZCA9IGMub2UgfHwgITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBjLmRvbWFpbiB8fCB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBjLnBhdGggfHwgdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIHZhciBoID0gYy5xYzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgvWzs9XHNdLy50ZXN0KGEpKQogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdJbnZhbGlkIGNvb2tpZSBuYW1lICInICsgYSArICciJyk7CiAgICAgICAgICAgICAgICBpZiAoL1s7XHJcbl0vLnRlc3QoYikpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0ludmFsaWQgY29va2llIHZhbHVlICInICsgYiArICciJyk7CiAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGggJiYgKGggPSAtMSk7CiAgICAgICAgICAgICAgICB0aGlzLmouY29va2llID0gYSArICc9JyArIGIgKyAoZiA/ICc7ZG9tYWluPScgKyBmIDogJycpICsgKGcgPyAnO3BhdGg9JyArIGcgOiAnJykgKyAoMCA+IGggPyAnJyA6IDAgPT0gaCA/ICc7ZXhwaXJlcz0nICsgbmV3IERhdGUoMTk3MCwgMSwgMSkudG9VVENTdHJpbmcoKSA6ICc7ZXhwaXJlcz0nICsgbmV3IERhdGUoRGF0ZS5ub3coKSArIDEwMDAgKiBoKS50b1VUQ1N0cmluZygpKSArIChkID8gJztzZWN1cmUnIDogJycpICsgKG51bGwgIT0gZSA/ICc7c2FtZXNpdGU9JyArIGUgOiAnJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuZ2V0ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBhICsgJz0nLCBkID0gKHRoaXMuai5jb29raWUgfHwgJycpLnNwbGl0KCc7JyksIGUgPSAwLCBmOyBlIDwgZC5sZW5ndGg7IGUrKykgewogICAgICAgICAgICAgICAgICAgIGYgPSBDbihkW2VdKTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSBmLmxhc3RJbmRleE9mKGMsIDApKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZi5zdWJzdHIoYy5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgIGlmIChmID09IGEpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwLnJlbW92ZSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZCA9IHZvaWQgMCAhPT0gdGhpcy5nZXQoYSk7CiAgICAgICAgICAgICAgICB0aGlzLnNldChhLCAnJywgewogICAgICAgICAgICAgICAgICAgIHFjOiAwLAogICAgICAgICAgICAgICAgICAgIHBhdGg6IGIsCiAgICAgICAgICAgICAgICAgICAgZG9tYWluOiBjCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwLmlzRW1wdHkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gIXRoaXMuai5jb29raWU7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuY2xlYXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gKHRoaXMuai5jb29raWUgfHwgJycpLnNwbGl0KCc7JyksIGIgPSBbXSwgYyA9IFtdLCBkLCBlLCBmID0gMDsgZiA8IGEubGVuZ3RoOyBmKyspCiAgICAgICAgICAgICAgICAgICAgZSA9IENuKGFbZl0pLCBkID0gZS5pbmRleE9mKCc9JyksIC0xID09IGQgPyAoYi5wdXNoKCcnKSwgYy5wdXNoKGUpKSA6IChiLnB1c2goZS5zdWJzdHJpbmcoMCwgZCkpLCBjLnB1c2goZS5zdWJzdHJpbmcoZCArIDEpKSk7CiAgICAgICAgICAgICAgICBmb3IgKGEgPSBiLmxlbmd0aCAtIDE7IDAgPD0gYTsgYS0tKQogICAgICAgICAgICAgICAgICAgIHRoaXMucmVtb3ZlKGJbYV0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgV3UgPSBuZXcgdmMoJ3VuZGVmaW5lZCcgPT0gdHlwZW9mIGRvY3VtZW50ID8gbnVsbCA6IGRvY3VtZW50KTsKICAgICAgICAgICAgdmFyIFh1ID0gbnVsbCwgWXUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IFh1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFh1ID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gXy5yLnRvcC5sb2NhdGlvbi5oYXNoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBfLnIubG9jYXRpb24uaGFzaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLm1hdGNoKC9cYmRlaWQ9KFtcZCxdKykvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBYdSA9IGIgPyBiWzFdIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gWHU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWnUsIEhrOwogICAgICAgICAgICBfLnhjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgPSB2b2lkIDAgPT09IGEgPyBfLnIgOiBhOwogICAgICAgICAgICAgICAgcmV0dXJuIChhID0gYS5wZXJmb3JtYW5jZSkgJiYgYS5ub3cgJiYgYS50aW1pbmcgPyBNYXRoLmZsb29yKGEubm93KCkgKyBhLnRpbWluZy5uYXZpZ2F0aW9uU3RhcnQpIDogeGQoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5sbCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gdm9pZCAwID09PSBhID8gXy5yIDogYTsKICAgICAgICAgICAgICAgIHJldHVybiAoYSA9IGEucGVyZm9ybWFuY2UpICYmIGEubm93ID8gYS5ub3coKSA6IG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFp1ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBfLnIgOiBiOwogICAgICAgICAgICAgICAgdmFyIGMsIGQ7CiAgICAgICAgICAgICAgICByZXR1cm4gKG51bGwgPT0gKGMgPSBiLnBlcmZvcm1hbmNlKSA/IHZvaWQgMCA6IG51bGwgPT0gKGQgPSBjLnRpbWluZykgPyB2b2lkIDAgOiBkW2FdKSB8fCAwOwogICAgICAgICAgICB9OwogICAgICAgICAgICBIayA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gdm9pZCAwID09PSBhID8gXy5yIDogYTsKICAgICAgICAgICAgICAgIHZhciBiID0gTWF0aC5taW4oWnUoJ2RvbUxvYWRpbmcnLCBhKSB8fCBJbmZpbml0eSwgWnUoJ2RvbUludGVyYWN0aXZlJywgYSkgfHwgSW5maW5pdHkpOwogICAgICAgICAgICAgICAgcmV0dXJuIEluZmluaXR5ID09IGIgPyBNYXRoLm1heChadSgncmVzcG9uc2VFbmQnLCBhKSwgWnUoJ25hdmlnYXRpb25TdGFydCcsIGEpKSA6IGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciAkdSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICB0aGlzLmxhYmVsID0gYTsKICAgICAgICAgICAgICAgIHRoaXMudHlwZSA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLnZhbHVlID0gYzsKICAgICAgICAgICAgICAgIHRoaXMuZHVyYXRpb24gPSB2b2lkIDAgPT09IGQgPyAwIDogZDsKICAgICAgICAgICAgICAgIHRoaXMudW5pcXVlSWQgPSBNYXRoLnJhbmRvbSgpOwogICAgICAgICAgICAgICAgdGhpcy5zbG90SWQgPSBlOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgc2YgPSBfLnIucGVyZm9ybWFuY2UsIGF2ID0gISEoc2YgJiYgc2YubWFyayAmJiBzZi5tZWFzdXJlICYmIHNmLmNsZWFyTWFya3MpLCB0ZiA9IHRnKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IGF2KQogICAgICAgICAgICAgICAgICAgICAgICBhID0gWXUoKSwgYSA9ICEhYS5pbmRleE9mICYmIDAgPD0gYS5pbmRleE9mKCcxMzM3Jyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9KSwgYnYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZXZlbnRzID0gW107CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGIgJiYgKGIuZ29vZ2xlX2pzX3JlcG9ydGluZ19xdWV1ZSA9IGIuZ29vZ2xlX2pzX3JlcG9ydGluZ19xdWV1ZSB8fCBbXSwgdGhpcy5ldmVudHMgPSBiLmdvb2dsZV9qc19yZXBvcnRpbmdfcXVldWUsIGMgPSBiLmdvb2dsZV9tZWFzdXJlX2pzX3RpbWluZyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gdGYoKSB8fCAobnVsbCAhPSBjID8gYyA6IE1hdGgucmFuZG9tKCkgPCBhKTsKICAgICAgICAgICAgICAgIH0sIFFlID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYpIHsKICAgICAgICAgICAgICAgICAgICBhLmogJiYgKGIgPSBuZXcgJHUoYiwgYywgZCwgdm9pZCAwID09PSBlID8gMCA6IGUsIGYpLCAhYS5qIHx8IDIwNDggPCBhLmV2ZW50cy5sZW5ndGggfHwgYS5ldmVudHMucHVzaChiKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBidi5wcm90b3R5cGUuc3RhcnQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKCF0aGlzLmopCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICBhID0gbmV3ICR1KGEsIGIsIF8ubGwoKSB8fCBfLnhjKCkpOwogICAgICAgICAgICAgICAgYiA9ICdnb29nXycgKyBhLmxhYmVsICsgJ18nICsgYS51bmlxdWVJZCArICdfc3RhcnQnOwogICAgICAgICAgICAgICAgc2YgJiYgdGYoKSAmJiBzZi5tYXJrKGIpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGJ2LnByb3RvdHlwZS5lbmQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKHRoaXMuaiAmJiAnbnVtYmVyJyA9PT0gdHlwZW9mIGEudmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICBhLmR1cmF0aW9uID0gKF8ubGwoKSB8fCBfLnhjKCkpIC0gYS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9ICdnb29nXycgKyBhLmxhYmVsICsgJ18nICsgYS51bmlxdWVJZCArICdfZW5kJzsKICAgICAgICAgICAgICAgICAgICBzZiAmJiB0ZigpICYmIHNmLm1hcmsoYik7CiAgICAgICAgICAgICAgICAgICAgIXRoaXMuaiB8fCAyMDQ4IDwgdGhpcy5ldmVudHMubGVuZ3RoIHx8IHRoaXMuZXZlbnRzLnB1c2goYSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBjdiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZCA9IF8ubGwoKTsKICAgICAgICAgICAgICAgIGQgJiYgUWUoYSwgYiwgOSwgZCwgMCwgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBaZSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIC0xID09IGEuaW5kZXhPZihiKSAmJiAoYSA9IGIgKyAnXG4nICsgYSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYzsgYSAhPSBjOykKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGEsIGEgPSBhLnJlcGxhY2UoLygoaHR0cHM/OlwvLi4qXC8pW15cLzpdKjpcZCsoPzoufFxuKSopXDIvLCAnJDEnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5yZXBsYWNlKC9cbiAqL2csICdcbicpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgdmggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYSA9IEVycm9yLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgICAgICB0aGlzLm1lc3NhZ2UgPSBhLm1lc3NhZ2U7CiAgICAgICAgICAgICAgICAnc3RhY2snIGluIGEgJiYgKHRoaXMuc3RhY2sgPSBhLnN0YWNrKTsKICAgICAgICAgICAgICAgIF8udChPYmplY3QsICdzZXRQcm90b3R5cGVPZicpLmNhbGwoT2JqZWN0LCB0aGlzLCB2aC5wcm90b3R5cGUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8odmgsIEVycm9yKTsKICAgICAgICAgICAgdmgucHJvdG90eXBlLm5hbWUgPSAnUHVibGlzaGVySW5wdXRFcnJvcic7CiAgICAgICAgICAgIHZhciBkdiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gRXJyb3IuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMubWVzc2FnZSA9IGEubWVzc2FnZTsKICAgICAgICAgICAgICAgICdzdGFjaycgaW4gYSAmJiAodGhpcy5zdGFjayA9IGEuc3RhY2spOwogICAgICAgICAgICAgICAgXy50KE9iamVjdCwgJ3NldFByb3RvdHlwZU9mJykuY2FsbChPYmplY3QsIHRoaXMsIGR2LnByb3RvdHlwZSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhkdiwgRXJyb3IpOwogICAgICAgICAgICBkdi5wcm90b3R5cGUubmFtZSA9ICdTZXJ2ZXJFcnJvcic7CiAgICAgICAgICAgIHZhciBldiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gRXJyb3IuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMubWVzc2FnZSA9IGEubWVzc2FnZTsKICAgICAgICAgICAgICAgICdzdGFjaycgaW4gYSAmJiAodGhpcy5zdGFjayA9IGEuc3RhY2spOwogICAgICAgICAgICAgICAgXy50KE9iamVjdCwgJ3NldFByb3RvdHlwZU9mJykuY2FsbChPYmplY3QsIHRoaXMsIGV2LnByb3RvdHlwZSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhldiwgRXJyb3IpOwogICAgICAgICAgICBldi5wcm90b3R5cGUubmFtZSA9ICdOZXR3b3JrRXJyb3InOwogICAgICAgICAgICB2YXIgZnYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBfLmd1LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBbXTsKICAgICAgICAgICAgICAgIHRoaXMuQSA9IFtdOwogICAgICAgICAgICAgICAgdGhpcy5EID0gW107CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhmdiwgXy5ndSk7CiAgICAgICAgICAgIHZhciBndiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBhLkEucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgRGM6IHZvaWQgMCA9PT0gYyA/ICExIDogYywKICAgICAgICAgICAgICAgICAgICBHYzogYgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGZ2LnByb3RvdHlwZS5GID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5qLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICB0aGlzLkQubGVuZ3RoID0gMDsKICAgICAgICAgICAgICAgIHRoaXMuQS5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgXy5ndS5wcm90b3R5cGUuRi5jYWxsKHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgR2QgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICB0aGlzLnByb21pc2UgPSBuZXcgdi5Qcm9taXNlKGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYS5yZXNvbHZlID0gYjsKICAgICAgICAgICAgICAgICAgICBhLnJlamVjdCA9IGM7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGh2ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgPSBFcnJvci5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgdGhpcy5tZXNzYWdlID0gYS5tZXNzYWdlOwogICAgICAgICAgICAgICAgJ3N0YWNrJyBpbiBhICYmICh0aGlzLnN0YWNrID0gYS5zdGFjayk7CiAgICAgICAgICAgICAgICBfLnQoT2JqZWN0LCAnc2V0UHJvdG90eXBlT2YnKS5jYWxsKE9iamVjdCwgdGhpcywgaHYucHJvdG90eXBlKTsKICAgICAgICAgICAgICAgIHRoaXMubmFtZSA9ICdJbnB1dEVycm9yJzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGh2LCBFcnJvcik7CiAgICAgICAgICAgIHZhciBpdiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5NID0gdGhpcy5GID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLkQgPSAtMTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkEgPSBuZXcgR2QoKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSAhMTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkEucHJvbWlzZS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgLTEgIT09IGEuRCAmJiAoYS5NID0gXy54YygpIC0gYS5EKTsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCB2aiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpdi5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHZqLCBpdik7CiAgICAgICAgICAgIHZqLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMubSB8fCAodGhpcy5tID0gITAsIHRoaXMuRiA9IGEsIHRoaXMuQS5yZXNvbHZlKGEpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmoucHJvdG90eXBlLmZhID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIG51bGwgPT0gYSA/IGp2KHRoaXMpIDogdGhpcy5qKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIganYgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEubSB8fCAoYS5tID0gITAsIGEuRiA9IG51bGwsIGEuQS5yZXNvbHZlKG51bGwpKTsKICAgICAgICAgICAgICAgIH0sIGt2ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBhLm0gfHwgKGEubSA9ICEwLCBhLkYgPSBudWxsLCBhLkIgPSBiLCBhLkEucmVqZWN0KGIpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZtLk9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKHZqLnByb3RvdHlwZSwgewogICAgICAgICAgICAgICAgcHJvbWlzZTogewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLkEucHJvbWlzZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgbDogewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIG86IHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5NOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBsdiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBpdi5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5qID0gYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGx2LCBpdik7CiAgICAgICAgICAgIHZhciBtdiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gYS5qLkY7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZtLk9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGx2LnByb3RvdHlwZSwgewogICAgICAgICAgICAgICAgZXJyb3I6IHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5qLkI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIG52ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGx2LmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8obnYsIGx2KTsKICAgICAgICAgICAgdm0uT2JqZWN0LmRlZmluZVByb3BlcnRpZXMobnYucHJvdG90eXBlLCB7CiAgICAgICAgICAgICAgICB2YWx1ZTogewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmouRjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgb3YgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBsdi5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8ob3YsIGx2KTsKICAgICAgICAgICAgdm0uT2JqZWN0LmRlZmluZVByb3BlcnRpZXMob3YucHJvdG90eXBlLCB7CiAgICAgICAgICAgICAgICB2YWx1ZTogewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmouRjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgd2ogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2ai5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8od2osIHZqKTsKICAgICAgICAgICAgd2oucHJvdG90eXBlLm5vdGlmeSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGp2KHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgcHYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IDAgOiBiOwogICAgICAgICAgICAgICAgXy5ndS5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5pZCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmdhID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuRCA9IG5ldyBmdigpOwogICAgICAgICAgICAgICAgdGhpcy5hYSA9ICExOwogICAgICAgICAgICAgICAgdGhpcy5UID0gLTE7CiAgICAgICAgICAgICAgICBfLmh1KHRoaXMsIHRoaXMuRCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhwdiwgXy5ndSk7CiAgICAgICAgICAgIHB2LnByb3RvdHlwZS5zdGFydCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYywgZCwgZSwgZjsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZy5qKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5hYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgICAgICBhLmFhID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIGcuRiA9IDI7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamIoZywgeWMoYS5ELkEsIGEuZ2EpLCA0KTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgIGIuVCA9IGcubTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEubSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5qID0gNTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGggPSAwLCBrID0gXy55KGEuRC5EKSwgbCA9IGsubmV4dCgpOyAhbC5kb25lOyBsID0gay5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbXYobC52YWx1ZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ21pc3NpbmcgaW5wdXQ6ICcgKyBhLmlkICsgJy8nICsgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICArK2g7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYyA9IF8ueShhLkQuaik7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZCA9IGMubmV4dCgpOyAhZC5kb25lOyBkID0gYy5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZC52YWx1ZSwgZS5EID0gXy54YygpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamIoZywgYS5qKCksIDUpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgbGIoZywgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IG1iKGcpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5tKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcucmV0dXJuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGYgaW5zdGFuY2VvZiBodiA/IGEuTShmKSA6IGYgaW5zdGFuY2VvZiBFcnJvciAmJiAoYS5SKGYpLCBhLkEoZikpOwogICAgICAgICAgICAgICAgICAgICAgICBMbShnKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IHZqKCk7CiAgICAgICAgICAgICAgICAgICAgYS5ELmoucHVzaChiKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0sIHF2ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IG5ldyB3aigpOwogICAgICAgICAgICAgICAgICAgIGEuRC5qLnB1c2goYik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9LCBWID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBndihhLkQsIGIpOwogICAgICAgICAgICAgICAgICAgIGIgPSBuZXcgb3YoYik7CiAgICAgICAgICAgICAgICAgICAgYS5ELkQucHVzaChiKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0sIFcgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGd2KGEuRCwgYik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBudihiKTsKICAgICAgICAgICAgICAgIH0sIHJ2ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBndihhLkQsIGIsICEwKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IG52KGIpOwogICAgICAgICAgICAgICAgfSwgc3YgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGd2KGEuRCwgYik7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBwdi5wcm90b3R5cGUuTSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcHYucHJvdG90eXBlLkEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKHRoaXMuRC5qLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIGEgPSBuZXcgaHYoYS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gXy55KHRoaXMuRC5qKSwgYyA9IGIubmV4dCgpOyAhYy5kb25lOyBjID0gYi5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID0gYy52YWx1ZSwgIWMubCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5tID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLkIgPSBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5BLnJlamVjdChkKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgdHYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcHYuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMuaWQgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5KID0gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHR2LCBwdik7CiAgICAgICAgICAgIHR2LnByb3RvdHlwZS5SID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuSih0aGlzLmlkLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHV2ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZXJyb3JNZXNzYWdlID0gdGhpcy5pbmZvID0gdGhpcy5lcnJvciA9IHRoaXMuVWIgPSBudWxsOwogICAgICAgICAgICAgICAgfSwgdnYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEuVWIgPSBiOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdXYucHJvdG90eXBlLmdldEVycm9yID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZXJyb3I7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB3diA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYS5lcnJvck1lc3NhZ2UgPSBiOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSwgeHYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYWNoZSA9IHt9OwogICAgICAgICAgICAgICAgfSwgJGMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgeXYgfHwgKHp2ID0gXy56YyhNdCksIEF2ID0gXy56YyhMdCksIHl2ID0gbmV3IHh2KCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB5djsKICAgICAgICAgICAgICAgIH0sIGFkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IEcoYSwgMyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFiKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMzsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBHKGEsIDIpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gNDsKICAgICAgICAgICAgICAgICAgICBhID0gRGF0ZS5ub3coKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA+IGIgKyAzNjAwMDAwICogQXYgPyAyIDogYSA+IGIgKyAzNjAwMDAwICogenYgPyAxIDogMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHh2LnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgdXYoKTsKICAgICAgICAgICAgICAgIGlmICh0aGlzLmNhY2hlW2FdKQogICAgICAgICAgICAgICAgICAgIHJldHVybiB2dihjLCB0aGlzLmNhY2hlW2FdKTsKICAgICAgICAgICAgICAgIHZhciBkID0gJyc7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGQgPSBiLmdldEl0ZW0oJ19HRVNQU0stJyArIGEpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmVycm9yID0gNiwgd3YoYywgZS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICghZCkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHV2KCk7CiAgICAgICAgICAgICAgICBiID0gbnVsbDsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IFNsKFNwLCBkKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA9IG5ldyB1digpLCBhLmVycm9yID0gNSwgd3YoYSwgZS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGIgJiYgKHRoaXMuY2FjaGVbYV0gPSBiKTsKICAgICAgICAgICAgICAgIHJldHVybiB2dihuZXcgdXYoKSwgYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHh2LnByb3RvdHlwZS5zZXQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSAoMCwgRi5IKShHKGEsIDEpKSwgZCA9ICdfR0VTUFNLLScgKyBjLCBlID0gdnYobmV3IHV2KCksIGEpOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBiLnNldEl0ZW0oZCwgYS5YKCkpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZikgewogICAgICAgICAgICAgICAgICAgIGUuaW5mbyA9IDcsIHd2KGUsIGYubWVzc2FnZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0aGlzLmNhY2hlW2NdID0gYTsKICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgeXYgPSBudWxsLCB6diA9IDI0LCBBdiA9IDcyOwogICAgICAgICAgICB2YXIgQnY7CiAgICAgICAgICAgIEJ2ID0gewogICAgICAgICAgICAgICAgY2Y6IDAsCiAgICAgICAgICAgICAgICBmZDogMywKICAgICAgICAgICAgICAgIGhkOiA0LAogICAgICAgICAgICAgICAgcWY6IDUKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEN2ID0gQnYuZmQsIER2ID0gQnYuaGQ7CiAgICAgICAgICAgIHZhciBFdiA9IGlyKCk7CiAgICAgICAgICAgIHZhciBGdiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tZXRob2ROYW1lID0gYTsKICAgICAgICAgICAgICAgIH0sIEd2ID0gbmV3IEZ2KDEpLCBIdiA9IG5ldyBGdigxNSksIEl2ID0gbmV3IEZ2KDIpLCBKdiA9IG5ldyBGdigzKSwgS3YgPSBuZXcgRnYoNSksIEx2ID0gbmV3IEZ2KDYpLCBNdiA9IG5ldyBGdig3KSwgTnYgPSBuZXcgRnYoOCksIE92ID0gbmV3IEZ2KDE0KSwgUHYgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiW2EubWV0aG9kTmFtZV0gfHwgYyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBRdiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLkYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRoaXMubSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtdOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBSdiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYS5GID0gUHYoR3YsIGIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBhLmogPSBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHYoSXYsIGIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkoZCwgYyk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBhLm0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQdihKdiwgYiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtdOwogICAgICAgICAgICAgICAgICAgICAgICB9KShjKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgRGMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8uSGcoUXYpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE5jID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIHR2LmNhbGwodGhpcywgNjU1LCBkKTsKICAgICAgICAgICAgICAgIHRoaXMuR2EgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5jb2xsZWN0b3JGdW5jdGlvbiA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLnN0b3JhZ2UgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5vID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBfLnpjKEZjKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKE5jLCB0dik7CiAgICAgICAgICAgIE5jLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEsIGIgPSAkYygpLmdldCh0aGlzLkdhLCB0aGlzLnN0b3JhZ2UpOwogICAgICAgICAgICAgICAgaWYgKGIuZ2V0RXJyb3IoKSkKICAgICAgICAgICAgICAgICAgICBFYyhiLmdldEVycm9yKCksIHRoaXMuR2EsIGIuZXJyb3JNZXNzYWdlKSwganYodGhpcy5vKSwganYodGhpcy5CKTsKICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gRGF0ZS5ub3coKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IGIuVWIpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmwgJiYgKFlmKGIsIDgpIHx8IChFYygzMywgdGhpcy5HYSksIEdjKGIsIHRoaXMubCkpLCBZZihiLCA3KSB8fCAoRWMoMzQsIHRoaXMuR2EpLCB3KGIsIDcsIE1hdGgucm91bmQoRGF0ZS5ub3coKSAvIDEwMDAgLyA2MCkpKSksIFlmKGIsIDMpIHx8IEVjKDM1LCB0aGlzLkdhKSwgdGhpcy5sKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9ICgwLCBGLkgpKEhjKGIsIDgpKSwgZSA9IG51bGwgIT09IChhID0gRyhiLCA3KSkgJiYgdm9pZCAwICE9PSBhID8gYSA6IGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkIDwgdGhpcy5sICYmIEdjKGIsIE1hdGgubWluKGQgKyBOdW1iZXIoKHRoaXMubCAqIChjIC8gMTAwMCAvIDYwIC0gZSkgLyA2MCkudG9GaXhlZCgzKSksIHRoaXMubCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSA+ICgwLCBGLkgpKEhjKGIsIDgpKSA/IChjID0ge30sIEVjKDIyLCB0aGlzLkdhLCBudWxsLCAoYy50ID0gU3RyaW5nKGUpLCBjLmNyID0gU3RyaW5nKGQpLCBjLmNzID0gU3RyaW5nKGFkKGIpKSwgYykpLCBqdih0aGlzLm8pLCBqdih0aGlzLkIpKSA6ICh0aGlzLm8uaih0aGlzLmNvbGxlY3RvckZ1bmN0aW9uKSwgdGhpcy5CLmooYikpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuby5qKHRoaXMuY29sbGVjdG9yRnVuY3Rpb24pLCB0aGlzLkIuaihiKTsKICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuby5qKHRoaXMuY29sbGVjdG9yRnVuY3Rpb24pLCBiID0gdGhpcy5CLCBkID0gYi5qLCBlID0gbmV3IFNwKCksIGUgPSB3KGUsIDEsIHRoaXMuR2EpLCBlID0gR2MoZSwgdGhpcy5sKSwgYyA9IHcoZSwgMywgYyksIGQuY2FsbChiLCBjKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEljID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyAhPT0gdHlwZW9mIGMgPyBFYygyMSwgYSkgOiBjIHx8IEVjKDIwLCBhKTsKICAgICAgICAgICAgICAgICAgICB3KGIsIDIsIGMpOwogICAgICAgICAgICAgICAgICAgIGIgPSAkYygpLnNldChiLCBkKTsKICAgICAgICAgICAgICAgICAgICBiLmVycm9yTWVzc2FnZSA/IEVjKCgwLCBGLkgpKGIuaW5mbyksIGEsIGIuZXJyb3JNZXNzYWdlKSA6IEVjKDI3LCBhKTsKICAgICAgICAgICAgICAgIH0sIEpjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT09IHR5cGVvZiBhID8gYSA6IGEgaW5zdGFuY2VvZiBFcnJvciA/IGEubWVzc2FnZSA6IG51bGw7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgT2MgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgdHYuY2FsbCh0aGlzLCA2NTgsIGQpOwogICAgICAgICAgICAgICAgdGhpcy5zdG9yYWdlID0gYzsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IFcodGhpcywgYSk7CiAgICAgICAgICAgICAgICB0aGlzLk4gPSBXKHRoaXMsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oT2MsIHR2KTsKICAgICAgICAgICAgT2MucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICBpZiAodGhpcy5HLnZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5sLmooewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAoMCwgRi5IKShHKGcsIDEpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xsZWN0b3JHZW5lcmF0ZWREYXRhOiBHKGcsIDIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgYyA9IHRoaXMuRy52YWx1ZSwgZCA9ICgwLCBGLkgpKHRoaXMuTi52YWx1ZSksIGUgPSAoMCwgRi5IKShHKGQsIDEpKSwgZiA9IGFkKGQpOwogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZikgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgRWMoMjQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIEVjKDI1LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICBFYygyNiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgRWMoOSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgRWMoMjMsIGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGYpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgIGIoZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIFN2KHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIGIoZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuby5qKGMpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLkIuaihkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgIHcoZCwgMiwgbnVsbCksIEtjKGUsIGQsIGMsIHRoaXMuc3RvcmFnZSkudGhlbihiKSwgU3YodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAganYodGhpcy5sKSwgU3YodGhpcyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBTdiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBqdihhLm8pOwogICAgICAgICAgICAgICAganYoYS5CKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFBjID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIHR2LmNhbGwodGhpcywgNjYyLCBkKTsKICAgICAgICAgICAgICAgIHRoaXMuc3RvcmFnZSA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBXKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgdGhpcy5vID0gVyh0aGlzLCBiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFBjLCB0dik7CiAgICAgICAgICAgIFBjLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzOwogICAgICAgICAgICAgICAgdGhpcy5vLnZhbHVlICYmIHRoaXMubC52YWx1ZSAmJiBNYygpLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gKDAsIEYuSCkoYS5vLnZhbHVlKSwgYyA9ICgwLCBGLkgpKEcoYiwgMSkpOwogICAgICAgICAgICAgICAgICAgIEtjKGMsIGIsICgwLCBGLkgpKGEubC52YWx1ZSksIGEuc3RvcmFnZSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFFjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgXy5ndS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgdGhpcy5qID0gW107CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhRYywgXy5ndSk7CiAgICAgICAgICAgIHZhciBSYyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IF8ueShiKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gYi5uZXh0KCk7ICFjLmRvbmU7IGMgPSBiLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMudmFsdWUsIF8uaHUoYSwgYyksIGEuai5wdXNoKGMpOwogICAgICAgICAgICAgICAgfSwgTiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgUmMoYSwgW2JdKTsKICAgICAgICAgICAgICAgIH0sIFNjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5qLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICBhID0gXy55KGEuaik7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSBhLm5leHQoKTsgIWIuZG9uZTsgYiA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYi52YWx1ZS5zdGFydCgpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIFFjLnByb3RvdHlwZS5GID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgXy5ndS5wcm90b3R5cGUuRi5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5qLmxlbmd0aCA9IDA7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBZYyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB0aGlzLnN0b3JhZ2UgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5GID0gW107CiAgICAgICAgICAgICAgICB0aGlzLm0gPSBbXTsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IFtdOwogICAgICAgICAgICAgICAgYSA9IF8ueShhKTsKICAgICAgICAgICAgICAgIGZvciAoYiA9IGEubmV4dCgpOyAhYi5kb25lOyBiID0gYS5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgdGhpcy5wdXNoKGIudmFsdWUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBZYy5wcm90b3R5cGUucHVzaCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGEuaWQ7CiAgICAgICAgICAgICAgICBhID0gYS5jb2xsZWN0b3JGdW5jdGlvbjsKICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPT0gdHlwZW9mIGIpCiAgICAgICAgICAgICAgICAgICAgRWMoMzcsICdpbnZhbGlkLWlkJyk7CiAgICAgICAgICAgICAgICBlbHNlIGlmICgnZnVuY3Rpb24nICE9PSB0eXBlb2YgYSkKICAgICAgICAgICAgICAgICAgICBFYygxNCwgYik7CiAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHt9OwogICAgICAgICAgICAgICAgICAgIEVjKDE3LCBiLCBudWxsLCAoYy5hcGkgPSAnMScsIGMpKTsKICAgICAgICAgICAgICAgICAgICBiID0gVGMoYiwgYSwgdGhpcy5zdG9yYWdlLCB0aGlzLkEpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuRi5wdXNoKGIpOwogICAgICAgICAgICAgICAgICAgIGEgPSBfLnkodGhpcy5tKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSBhLm5leHQoKTsgIWMuZG9uZTsgYyA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICBiLnRoZW4oYy52YWx1ZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFljLnByb3RvdHlwZS5hZGRPblNpZ25hbFJlc29sdmVDYWxsYmFjayA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB0aGlzLm0ucHVzaChhKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSBfLnkodGhpcy5GKSwgYyA9IGIubmV4dCgpOyAhYy5kb25lOyBjID0gYi5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgYy52YWx1ZS50aGVuKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBZYy5wcm90b3R5cGUuYWRkRXJyb3JIYW5kbGVyID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuai5wdXNoKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBZYy5wcm90b3R5cGUuQSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gXy55KHRoaXMuaiksIGQgPSBjLm5leHQoKTsgIWQuZG9uZTsgZCA9IGMubmV4dCgpKQogICAgICAgICAgICAgICAgICAgIGQgPSBkLnZhbHVlLCBkKGEsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWGMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5wdXNoID0gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICBhLnB1c2goYik7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5hZGRPblNpZ25hbFJlc29sdmVDYWxsYmFjayA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgYS5hZGRPblNpZ25hbFJlc29sdmVDYWxsYmFjayhiKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLmFkZEVycm9ySGFuZGxlciA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgYS5hZGRFcnJvckhhbmRsZXIoYik7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVHYgPSAwLCBVdiA9IGVpKGZkKGduKCdodHRwczovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL3BhZ2VhZC9leHBhbnNpb25fZW1iZWQuanMnKSkpOwogICAgICAgICAgICB2YXIgVnYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBYdiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IF8uSGcoV3YpLkQ7CiAgICAgICAgICAgICAgICAgICAgXy5IZyhWdikuaihhKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBadiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHZvaWQgMCwgYiA9IDI7CiAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gYSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHZvaWQgMCA9PT0gYyA/IF8uciA6IGM7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBjLmdnZWFjIHx8IChjLmdnZWFjID0ge30pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gMCA6IGI7CiAgICAgICAgICAgICAgICAgICAgYyA9IGE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBiOwogICAgICAgICAgICAgICAgICAgIGQgPSB2b2lkIDAgPT09IGQgPyAwIDogZDsKICAgICAgICAgICAgICAgICAgICBSdihEYygpLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICBZdihhLCBiKTsKICAgICAgICAgICAgICAgICAgICBiID0gYTsKICAgICAgICAgICAgICAgICAgICBfLkhnKFZ2KS5qID0gUHYoT3YsIGIpOwogICAgICAgICAgICAgICAgICAgIF8uSGcoeXUpLmooKTsKICAgICAgICAgICAgICAgIH0sIFl2ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IF8uSGcoeXUpOwogICAgICAgICAgICAgICAgICAgIGMubSA9IGZ1bmN0aW9uIChkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQdihLdiwgYSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB9KShkLCBlLCBiKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGMuRiA9IGZ1bmN0aW9uIChkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQdihMdiwgYSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKGQsIGUsIGIpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYy5BID0gZnVuY3Rpb24gKGQsIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFB2KE12LCBhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKGQsIGUsIGIpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYy5EID0gZnVuY3Rpb24gKGQsIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFB2KE52LCBhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKGQsIGUsIGIpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYy5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBQdihIdiwgYSkoYik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBXZiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYSAmJiBudWxsICE9PSBiICYmIGIgIT0gYi50b3AgJiYgKGIgPSBiLnRvcCk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICh2b2lkIDAgPT09IGMgPyAwIDogYykgPyBuZXcgXy5VaShiLmlubmVyV2lkdGgsIGIuaW5uZXJIZWlnaHQpLnJvdW5kKCkgOiBfLlJxKGIgfHwgd2luZG93KS5yb3VuZCgpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBfLlVpKC0xMjI0NTkzMywgLTEyMjQ1OTMzKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCAkdiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdDU1MxQ29tcGF0JyA9PSBhLmNvbXBhdE1vZGUgPyBhLmRvY3VtZW50RWxlbWVudCA6IGEuYm9keTsKICAgICAgICAgICAgICAgIH0sIGF3ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gXy5yIDogYjsKICAgICAgICAgICAgICAgICAgICBhID0gYS5zY3JvbGxpbmdFbGVtZW50IHx8ICR2KGEpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgXy5pZyhiLnBhZ2VYT2Zmc2V0IHx8IGEuc2Nyb2xsTGVmdCwgYi5wYWdlWU9mZnNldCB8fCBhLnNjcm9sbFRvcCk7CiAgICAgICAgICAgICAgICB9LCB3ZyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIWEgfHwgIShhLm9mZnNldFdpZHRoIHx8IGEub2Zmc2V0SGVpZ2h0IHx8IGEuZ2V0Q2xpZW50UmVjdHMoKS5sZW5ndGgpKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgYncgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oYncsIFEpOwogICAgICAgICAgICB2YXIgY3cgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tID0gMDsKICAgICAgICAgICAgICAgIH0sIGV3ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gYS5tKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkdyhhLCAnX19nYWRzJywgYikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmo7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBFKGIsIDUpICYmIHVjKGMpICYmIG5ldyB2YyhjLmRvY3VtZW50KS5zZXQoJ0dvb2dsZUFkU2VydmluZ1Rlc3QnLCAnR29vZCcsIHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9ICdHb29kJyA9PT0gd2MoJ0dvb2dsZUFkU2VydmluZ1Rlc3QnLCBiLCBhLmopKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLmo7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRShiLCA1KSAmJiB1YyhkKSAmJiBuZXcgdmMoZC5kb2N1bWVudCkucmVtb3ZlKCdHb29nbGVBZFNlcnZpbmdUZXN0Jywgdm9pZCAwLCB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYS5tID0gYiA/IDIgOiAxOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gMiA9PT0gYS5tOwogICAgICAgICAgICAgICAgfSwgZHcgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjID8gd2MoYiwgYywgYS5qKSA6IG51bGw7CiAgICAgICAgICAgICAgICB9LCBmdyA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBxYzogRyhjLCAyKSAtIERhdGUubm93KCkgLyAxMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogRyhjLCAzKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbjogRyhjLCA0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9lOiAhMQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBhID0gYS5qOwogICAgICAgICAgICAgICAgICAgICAgICBFKGQsIDUpICYmIHVjKGEpICYmIG5ldyB2YyhhLmRvY3VtZW50KS5zZXQoYiwgRyhjLCAxKSwgZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgZ3cgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIGlmIChjICYmIHdjKGIsIGMsIGEuaikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLmoubG9jYXRpb24uaG9zdG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnbG9jYWxob3N0JyA9PT0gZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBbJ2xvY2FsaG9zdCddOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChkID0gZC5zcGxpdCgnLicpLCAyID4gZC5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IFtdLCBmID0gMDsgZiA8IGQubGVuZ3RoIC0gMTsgKytmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHVzaChkLnNsaWNlKGYpLmpvaW4oJy4nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBkID0gXy55KGQpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSBkLm5leHQoKTsgIWUuZG9uZTsgZSA9IGQubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGEuaiwgRShjLCA1KSAmJiB1YyhmKSAmJiBuZXcgdmMoZi5kb2N1bWVudCkucmVtb3ZlKGIsICcvJywgZS52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGh3ID0ge30sIGl3ID0gKGh3WzNdID0gZWkoZmQoZ24oJ2h0dHBzOi8vczAuMm1kbi5uZXQvYWRzL3JpY2htZWRpYS9zdHVkaW8vbXUvdGVtcGxhdGVzL2hpZmkvaGlmaS5qcycpKSksIGh3KSwgancgPSB7fSwga3cgPSAoandbM10gPSBlaShmZChnbignaHR0cHM6Ly9zMC4ybWRuLm5ldC9hZHMvcmljaG1lZGlhL3N0dWRpb19jYW5hcnkvbXUvdGVtcGxhdGVzL2hpZmkvaGlmaV9jYW5hcnkuanMnKSkpLCBqdyk7CiAgICAgICAgICAgIHZhciBsdyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSBIcSgpOwogICAgICAgICAgICAgICAgfSwgbXcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0ge307CiAgICAgICAgICAgICAgICAgICAgXy5obihhLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBiW2Mual0gPSBjLm07CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbncgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBvdyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuYWQvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgcHcgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmFlL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHF3ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20uYWYvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgcncgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5hZy9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBzdyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLmFpL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHR3ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5hbC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCB1dyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY28uYW8vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgdncgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5hci9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCB3dyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuYXMvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgeHcgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmF0L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHl3ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20uYXUvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgencgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmF6L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEF3ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20uYmQvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgQncgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmJlL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEN3ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5iZi9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBEdyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuYmcvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgRXcgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5iaC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBGdyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuYmkvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgR3cgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmJqL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEh3ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20uYm4vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgSXcgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5iby9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBKdyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLmJyL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEt3ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5icy9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBMdyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuYnQvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgTXcgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvLmJ3L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIE53ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20uYnovYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgT3cgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNhL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIFB3ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jZC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBRdyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY2YvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgUncgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNnL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIFN3ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jaC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBUdyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY2kvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgVXcgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvLmNrL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIFZ3ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jbC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBXdyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY20vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgWHcgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5jby9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBZdyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY28uY3IvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgWncgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5jdS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCAkdyA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY3YvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgYXggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5jeS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBieCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY3ovYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgY3ggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmRlL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIGR4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5kai9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBleCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuZGsvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgZnggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmRtL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIGd4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5kei9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBoeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLmVjL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIGl4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5lZS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBqeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLmVnL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIGt4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5lcy9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBseCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLmV0L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIG14ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5maS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBueCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLmZqL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIG94ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5mbS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBweCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuZnIvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgcXggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmdhL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHJ4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5nZS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBzeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuZ2cvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgdHggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5naC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCB1eCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLmdpL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHZ4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5nbC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCB3eCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuZ20vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgeHggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmdyL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHl4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20uZ3QvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgenggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmd5L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEF4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20uaGsvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgQnggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmhuL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEN4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5oci9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBEeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuaHQvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgRXggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmh1L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEZ4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jby5pZC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBHeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuaWUvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgSHggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvLmlsL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEl4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5pbS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBKeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY28uaW4vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgS3ggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmlxL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEx4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5pcy9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBNeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuaXQvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgTnggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmplL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIE94ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20uam0vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgUHggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmpvL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIFF4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jby5qcC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBSeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY28ua2UvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgU3ggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5raC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBUeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUua2kvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgVXggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmtnL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIFZ4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jby5rci9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBXeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLmt3L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIFh4ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5rei9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBZeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUubGEvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgWnggPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5sYi9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCAkeCA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUubGkvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgYXkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmxrL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIGJ5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jby5scy9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBjeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUubHQvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgZHkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmx1L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIGV5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5sdi9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBmeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLmx5L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIGd5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5tZC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBoeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUubWUvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgaXkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLm1nL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIGp5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5tay9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBreSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUubWwvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgbHkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5tbS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBteSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUubW4vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgbnkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLm1zL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIG95ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20ubXQvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgcHkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLm11L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHF5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5tdi9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCByeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUubXcvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgc3kgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5teC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCB0eSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLm15L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHV5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jby5tei9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCB2eSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLm5hL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHd5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20ubmcvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgeHkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5uaS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCB5eSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUubmUvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgenkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLm5sL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEF5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5uby9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBCeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLm5wL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEN5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5uci9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBEeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUubnUvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgRXkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvLm56L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEZ5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20ub20vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgR3kgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5wYS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBIeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLnBlL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEl5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20ucGcvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgSnkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5waC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBLeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLnBrL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEx5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5wbC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBNeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUucG4vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgTnkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5wci9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBPeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUucHMvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgUHkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLnB0L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIFF5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20ucHkvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgUnkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5xYS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBTeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUucm8vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgVHkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLnJ1L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIFV5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5ydy9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBWeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLnNhL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIFd5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jb20uc2IvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgWHkgPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLnNjL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIFl5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5zZS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBaeSA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLnNnL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksICR5ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5zaC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBheiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuc2kvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgYnogPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLnNrL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIGN6ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5zbi9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBkeiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuc28vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgZXogPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLnNtL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIGZ6ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5zci9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBneiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuc3QvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgaHogPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS5zdi9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBpeiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUudGQvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwganogPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLnRnL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIGt6ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jby50aC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBseiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLnRqL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIG16ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS50bC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBueiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUudG0vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgb3ogPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLnRuL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHB6ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS50by9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBxeiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLnRyL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHJ6ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS50dC9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBzeiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLnR3L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHR6ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jby50ei9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCB1eiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLnVhL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIHZ6ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jby51Zy9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCB3eiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY28udWsvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgeHogPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS51eS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCB5eiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY28udXovYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgenogPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbS52Yy9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBBeiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY28udmUvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgQnogPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLnZnL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEN6ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jby52aS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBEeiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY29tLnZuL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEV6ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS52dS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBGeiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUud3MvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgR3ogPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLnJzL2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEh6ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jby56YS9hZHNpZC9pbnRlZ3JhdG9yLicsCiAgICAgICAgICAgICAgICAgICAgJycKICAgICAgICAgICAgICAgIF0pLCBJeiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL2Fkc2VydmljZS5nb29nbGUuY28uem0vYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgSnogPSBQKFsKICAgICAgICAgICAgICAgICAgICAnaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvLnp3L2Fkc2lkL2ludGVncmF0b3IuJywKICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgXSksIEt6ID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vYWRzZXJ2aWNlLmdvb2dsZS5jYXQvYWRzaWQvaW50ZWdyYXRvci4nLAogICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICBdKSwgTHogPSBuZXcgdi5NYXAoWwogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKG53LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5hZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShvdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuYWUnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEocHcsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5hZicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShxdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLmFnJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHJ3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20uYWknLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoc3csIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmFsJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHR3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jby5hbycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh1dywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLmFyJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHZ3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5hcycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh3dywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuYXQnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoeHcsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5hdScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh5dywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuYXonLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoencsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5iZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShBdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuYmUnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoQncsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmJmJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEN3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5iZycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShEdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLmJoJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEV3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5iaScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShGdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuYmonLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoR3csIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5ibicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShIdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLmJvJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEl3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20uYnInLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoSncsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmJzJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEt3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5idCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShMdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY28uYncnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoTXcsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5ieicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShOdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY2EnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoT3csIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNkJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFB3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jZicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShRdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY2cnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoUncsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNoJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFN3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jaScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShUdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY28uY2snLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoVXcsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNsJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFZ3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jbScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShXdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLmNvJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFh3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jby5jcicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShZdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLmN1JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFp3LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jdicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSgkdywgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLmN5JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGF4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jeicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShieCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuZGUnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoY3gsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmRqJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGR4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5kaycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShleCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuZG0nLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoZngsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmR6JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGd4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20uZWMnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoaHgsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmVlJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGl4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20uZWcnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoangsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmVzJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGt4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20uZXQnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEobHgsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmZpJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKG14LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20uZmonLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEobngsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmZtJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKG94LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5mcicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShweCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuZ2EnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEocXgsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmdlJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHJ4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5nZycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShzeCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLmdoJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHR4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20uZ2knLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEodXgsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmdsJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHZ4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5nbScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh3eCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuZ3InLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoeHgsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5ndCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh5eCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuZ3knLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoengsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5oaycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShBeCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuaG4nLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoQngsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmhyJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEN4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5odCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShEeCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuaHUnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoRXgsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvLmlkJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEZ4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5pZScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShHeCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY28uaWwnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoSHgsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmltJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEl4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jby5pbicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShKeCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuaXEnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoS3gsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmlzJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEx4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5pdCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShNeCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuamUnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoTngsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5qbScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShPeCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuam8nLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoUHgsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvLmpwJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFF4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jby5rZScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShSeCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLmtoJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFN4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5raScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShUeCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUua2cnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoVXgsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvLmtyJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFZ4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20ua3cnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoV3gsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmt6JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFh4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5sYScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShZeCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLmxiJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFp4LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5saScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSgkeCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUubGsnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoYXksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvLmxzJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGJ5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5sdCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShjeSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUubHUnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoZHksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmx2JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGV5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20ubHknLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoZnksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLm1kJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGd5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5tZScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShoeSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUubWcnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoaXksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLm1rJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGp5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5tbCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShreSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLm1tJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGx5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5tbicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShteSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUubXMnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEobnksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5tdCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShveSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUubXUnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEocHksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLm12JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHF5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5tdycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShyeSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLm14JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHN5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20ubXknLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEodHksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvLm16JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHV5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20ubmEnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEodnksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5uZycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh3eSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLm5pJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHh5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5uZScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh5eSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUubmwnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoenksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLm5vJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEF5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20ubnAnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoQnksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLm5yJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEN5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5udScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShEeSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY28ubnonLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoRXksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5vbScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShGeSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLnBhJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEd5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20ucGUnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoSHksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5wZycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShJeSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLnBoJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEp5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20ucGsnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoS3ksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLnBsJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEx5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5wbicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShNeSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLnByJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKE55LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5wcycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShPeSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUucHQnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoUHksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5weScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShReSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLnFhJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFJ5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5ybycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShTeSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUucnUnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoVHksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLnJ3JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFV5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20uc2EnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoVnksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbS5zYicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShXeSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuc2MnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoWHksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLnNlJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKFl5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20uc2cnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoWnksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLnNoJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKCR5LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5zaScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShheiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuc2snLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoYnosIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLnNuJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGN6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5zbycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShkeiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuc20nLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoZXosIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLnNyJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGZ6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5zdCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShneiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLnN2JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGh6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS50ZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShpeiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUudGcnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoanosIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvLnRoJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGt6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20udGonLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEobHosIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLnRsJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKG16LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS50bScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShueiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUudG4nLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEob3osIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLnRvJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHB6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20udHInLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEocXosIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLnR0JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHJ6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20udHcnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoc3osIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvLnR6JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHR6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20udWEnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEodXosIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvLnVnJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHZ6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jby51aycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh3eiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLnV5JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHh6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jby51eicsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQSh5eiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY29tLnZjJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKHp6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jby52ZScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShBeiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUudmcnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoQnosIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvLnZpJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEN6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jb20udm4nLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoRHosIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLnZ1JywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEV6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS53cycsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShGeiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUucnMnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoR3osIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvLnphJywKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKEh6LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnLmdvb2dsZS5jby56bScsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShJeiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJy5nb29nbGUuY28uencnLAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEEoSnosIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNhdCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShLeiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLm1hcChmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gXy55KGEpOwogICAgICAgICAgICAgICAgICAgIGEgPSBiLm5leHQoKS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICBiID0gYi5uZXh0KCkudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB7fTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICBhLAogICAgICAgICAgICAgICAgICAgICAgICAoYy5qc29uID0gYignanNvbicpLCBjLmpzID0gYignanMnKSwgY1snc3luYy5qcyddID0gYignc3luYy5qcycpLCBjKQogICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgIHZhciBNeiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZCA9ICdzY3JpcHQnOwogICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/ICcnIDogZDsKICAgICAgICAgICAgICAgIHZhciBlID0gXy5PaSgnTElOSycsIGEpOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBEcShlLCBiLCAncHJlbG9hZCcpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZikgewogICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGQgJiYgKGUuYXMgPSBkKTsKICAgICAgICAgICAgICAgIGMgJiYgZS5zZXRBdHRyaWJ1dGUoJ25vbmNlJywgYyk7CiAgICAgICAgICAgICAgICBpZiAoYSA9IGEuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ2hlYWQnKVswXSkKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBhLmFwcGVuZENoaWxkKGUpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGYpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB2ZCA9IF8uciwgTnogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IHYuTWFwKFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZG9tYWluJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8uci5sb2NhdGlvbi5ob3N0bmFtZQogICAgICAgICAgICAgICAgICAgICAgICBdXSk7CiAgICAgICAgICAgICAgICAgICAgd2RbM10gPj0geGQoKSAmJiBiLnNldCgnYWRzaWQnLCB3ZFsxXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGhjKEx6LmdldChhKS5qcywgYik7CiAgICAgICAgICAgICAgICB9LCB3ZCwgT3osIHVkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZkID0gXy5yOwogICAgICAgICAgICAgICAgICAgIHdkID0gdmQuZ29vZ2xlVG9rZW4gPSB2ZC5nb29nbGVUb2tlbiB8fCB7fTsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHhkKCk7CiAgICAgICAgICAgICAgICAgICAgd2RbMV0gJiYgd2RbM10gPiBhICYmIDAgPCB3ZFsyXSB8fCAod2RbMV0gPSAnJywgd2RbMl0gPSAtMSwgd2RbM10gPSAtMSwgd2RbNF0gPSAnJywgd2RbNl0gPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgT3ogPSB2ZC5nb29nbGVJTVN0YXRlID0gdmQuZ29vZ2xlSU1TdGF0ZSB8fCB7fTsKICAgICAgICAgICAgICAgICAgICBMei5oYXMoT3pbMV0pIHx8IChPelsxXSA9ICcuZ29vZ2xlLmNvbScpOwogICAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkoT3pbNV0pIHx8IChPels1XSA9IFtdKTsKICAgICAgICAgICAgICAgICAgICAnYm9vbGVhbicgIT09IHR5cGVvZiBPels2XSAmJiAoT3pbNl0gPSAhMSk7CiAgICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShPels3XSkgfHwgKE96WzddID0gW10pOwogICAgICAgICAgICAgICAgICAgICdudW1iZXInICE9PSB0eXBlb2YgT3pbOF0gJiYgKE96WzhdID0gMCk7CiAgICAgICAgICAgICAgICB9LCBQeiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdWQoKTsKICAgICAgICAgICAgICAgICAgICBMei5oYXMoYSkgJiYgKE96WzFdID0gYSk7CiAgICAgICAgICAgICAgICB9LCB5ZCA9IHsKICAgICAgICAgICAgICAgICAgICBoYzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA8IE96WzhdOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgT3pbOF0rKzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGdlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIDAgPCBPels4XSAmJiBPels4XS0tOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgT3pbOF0gPSAwOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgVWY6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgSmM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE96WzVdOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgRmM6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8uci5zZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIFVjOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgheWQuaGMoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBfLnIuZG9jdW1lbnQsIGIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gTnooZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBDcSgnc2NyaXB0W25vbmNlXScsIHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXooYSwgZS50b1N0cmluZygpLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IF8uT2koJ1NDUklQVCcsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnR5cGUgPSAndGV4dC9qYXZhc2NyaXB0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5vbmVycm9yID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8uci5wcm9jZXNzR29vZ2xlVG9rZW4oe30sIDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYihmLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChhLmhlYWQgfHwgYS5ib2R5IHx8IGEuZG9jdW1lbnRFbGVtZW50KS5hcHBlbmRDaGlsZChmKSwgeWQuZmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYyA9IE96WzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYihjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcuZ29vZ2xlLmNvbScgIT0gYyAmJiBiKCcuZ29vZ2xlLmNvbScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSAoYi5uZXdUb2tlbiA9ICdGQlQnLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8uci5zZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXy5yLnByb2Nlc3NHb29nbGVUb2tlbihkLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDEwMDApOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgUXogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIF8uci5wcm9jZXNzR29vZ2xlVG9rZW4gPSBfLnIucHJvY2Vzc0dvb2dsZVRva2VuIHx8IGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/IHt9IDogZDsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/IDAgOiBjOwogICAgICAgICAgICAgICAgICAgICAgICBiID0gZC5uZXdUb2tlbiB8fCAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAnTlQnID09IGIsIGYgPSBwYXJzZUludChkLmZyZXNoTGlmZXRpbWVTZWNzIHx8ICcnLCAxMCksIGcgPSBwYXJzZUludChkLnZhbGlkTGlmZXRpbWVTZWNzIHx8ICcnLCAxMCksIGggPSBkWycxcF9qYXInXSB8fCAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGQucHVjcmQgfHwgJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIHVkKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIDEgPT0gYyA/IHlkLmhlKCkgOiB5ZC5nZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IHZkLmdvb2dsZVRva2VuID0gdmQuZ29vZ2xlVG9rZW4gfHwge30sIGwgPSAwID09IGMgJiYgYiAmJiAnc3RyaW5nJyA9PT0gdHlwZW9mIGIgJiYgIWUgJiYgJ251bWJlcicgPT09IHR5cGVvZiBmICYmIDAgPCBmICYmICdudW1iZXInID09PSB0eXBlb2YgZyAmJiAwIDwgZyAmJiAnc3RyaW5nJyA9PT0gdHlwZW9mIGg7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlICYmICF5ZC5oYygpICYmICghKHdkWzNdID49IHhkKCkpIHx8ICdOVCcgPT0gd2RbMV0pOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9ICEod2RbM10gPj0geGQoKSkgJiYgMCAhPSBjOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobCB8fCBlIHx8IG0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0geGQoKSwgZiA9IGUgKyAxMDAwICogZiwgZyA9IGUgKyAxMDAwICogZywgMC4wMDAwMSA+IE1hdGgucmFuZG9tKCkgJiYgXy5RcihfLnIsICdodHRwczovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL3BhZ2VhZC9nZW5fMjA0P2lkPWltZXJyJmVycj0nICsgYyksIGtbNV0gPSBjLCBrWzFdID0gYiwga1syXSA9IGYsIGtbM10gPSBnLCBrWzRdID0gaCwga1s2XSA9IGQsIHVkKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsIHx8ICF5ZC5oYygpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0geWQuSmMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYiA9IDA7IGIgPCBjLmxlbmd0aDsgYisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHlkLkZjKGNbYl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB6ZChhKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBsaiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IHt9IDogYjsKICAgICAgICAgICAgICAgICAgICB0aGlzLnJvb3QgPSBiLnJvb3QgPyBiLnJvb3QgOiBudWxsOwogICAgICAgICAgICAgICAgICAgIHRoaXMubyA9IGIucm9vdE1hcmdpbiA/IEJkKGIucm9vdE1hcmdpbikgOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3B4JwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdweCcKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAncHgnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3B4JwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnJvb3RNYXJnaW4gPSBfLkFkKHRoaXMubywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnICsgYy52YWx1ZSArIGMudHlwZTsKICAgICAgICAgICAgICAgICAgICB9KS5qb2luKCcgJyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5NID0gRGQoYi50aHJlc2hvbGQpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuQiA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gW107CiAgICAgICAgICAgICAgICAgICAgdGhpcy5BID0gW107CiAgICAgICAgICAgICAgICAgICAgdGhpcy5EID0gITE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLkYgPSBXbih0aGlzLmwsIDEwMCwgdGhpcyk7CiAgICAgICAgICAgICAgICB9LCBSeiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEucm9vdCkKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBGZChhLnJvb3QpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IF8uUnEod2luZG93KTsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvcDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpZ2h0OiBjLndpZHRoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYm90dG9tOiBjLmhlaWdodCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogYy53aWR0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogYy5oZWlnaHQKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYSA9IF8uQWQoYS5vLCBmdW5jdGlvbiAoZCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3B4JyA9PSBkLnR5cGUgPyBkLnZhbHVlIDogZC52YWx1ZSAqIChlICUgMiA/IGIud2lkdGggOiBiLmhlaWdodCkgLyAxMDA7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgdG9wOiBiLnRvcCAtIGFbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgIHJpZ2h0OiBiLnJpZ2h0ICsgYVsxXSwKICAgICAgICAgICAgICAgICAgICAgICAgYm90dG9tOiBiLmJvdHRvbSArIGFbMl0sCiAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IGIubGVmdCAtIGFbM10sCiAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiBiLndpZHRoICsgYVsxXSArIGFbM10sCiAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogYi5oZWlnaHQgKyBhWzBdICsgYVsyXQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBTeiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFiIHx8IGIuaXNJbnRlcnNlY3RpbmcgIT0gYy5pc0ludGVyc2VjdGluZykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gYi5pbnRlcnNlY3Rpb25SYXRpbywgZSA9IGMuaW50ZXJzZWN0aW9uUmF0aW87CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQgPT0gZSA/ICExIDogXy5SZChhLk0sIGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmIDwgZCAhPSBmIDwgZTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIGxqLnByb3RvdHlwZS5sID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiID0gUnoodGhpcyk7CiAgICAgICAgICAgICAgICBfLmhuKHRoaXMuaiwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGMudGFyZ2V0LCBlID0gRmQoZCksIGYgPSBlLndpZHRoICogZS5oZWlnaHQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBNYXRoLm1heChiLnRvcCwgZS50b3ApOwogICAgICAgICAgICAgICAgICAgIHZhciBoID0gTWF0aC5taW4oYi5yaWdodCwgZS5yaWdodCksIGsgPSBNYXRoLm1pbihiLmJvdHRvbSwgZS5ib3R0b20pLCBsID0gTWF0aC5tYXgoYi5sZWZ0LCBlLmxlZnQpLCBtID0gaCAtIGwsIG4gPSBrIC0gZzsKICAgICAgICAgICAgICAgICAgICBnID0gMCA8PSBtICYmIDAgPD0gbiA/IHsKICAgICAgICAgICAgICAgICAgICAgICAgdG9wOiBnLAogICAgICAgICAgICAgICAgICAgICAgICByaWdodDogaCwKICAgICAgICAgICAgICAgICAgICAgICAgYm90dG9tOiBrLAogICAgICAgICAgICAgICAgICAgICAgICBsZWZ0OiBsLAogICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogbSwKICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBuCiAgICAgICAgICAgICAgICAgICAgfSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgaCA9ICEhZzsKICAgICAgICAgICAgICAgICAgICBrID0gZyA/IGcud2lkdGggKiBnLmhlaWdodCA6IDA7CiAgICAgICAgICAgICAgICAgICAgbCA9IHdpbmRvdy5wZXJmb3JtYW5jZTsKICAgICAgICAgICAgICAgICAgICBkID0gewogICAgICAgICAgICAgICAgICAgICAgICBib3VuZGluZ0NsaWVudFJlY3Q6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGludGVyc2VjdGlvblJhdGlvOiBmID8gayAvIGYgOiBoID8gMSA6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIGludGVyc2VjdGlvblJlY3Q6IGcgfHwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9wOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYm90dG9tOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVmdDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpZ2h0OiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IDAKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaXNJbnRlcnNlY3Rpbmc6IGgsCiAgICAgICAgICAgICAgICAgICAgICAgIHJvb3RCb3VuZHM6IGIsCiAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldDogZCwKICAgICAgICAgICAgICAgICAgICAgICAgdGltZTogbCAmJiBsLm5vdyA/IGwubm93KCkgOiAwCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBTeihhLCBjLm9hLCBkKSAmJiBhLkEucHVzaChkKTsKICAgICAgICAgICAgICAgICAgICBjLm9hID0gZDsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5BLmxlbmd0aCAmJiB0aGlzLkIoVHoodGhpcyksIHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBsai5wcm90b3R5cGUub2JzZXJ2ZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBfLlJkKHRoaXMuaiwgZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi50YXJnZXQgPT0gYTsKICAgICAgICAgICAgICAgIH0pIHx8ICh0aGlzLmoucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBhLAogICAgICAgICAgICAgICAgICAgIG9hOiBudWxsCiAgICAgICAgICAgICAgICB9KSwgdGhpcy5sKCksIHRoaXMuRCB8fCAodGhpcy5EID0gITAsIF8uZmIoXy5yLCAnc2Nyb2xsJywgdGhpcy5GKSwgXy5mYihfLnIsICdyZXNpemUnLCB0aGlzLkYpLCBfLnIuTXV0YXRpb25PYnNlcnZlciAmJiAhdGhpcy5tICYmICh0aGlzLm0gPSBuZXcgTXV0YXRpb25PYnNlcnZlcih0aGlzLkYpLCB0aGlzLm0ub2JzZXJ2ZShfLnIuZG9jdW1lbnQsIHsKICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzOiAhMCwKICAgICAgICAgICAgICAgICAgICBjaGlsZExpc3Q6ICEwLAogICAgICAgICAgICAgICAgICAgIGNoYXJhY3RlckRhdGE6ICEwLAogICAgICAgICAgICAgICAgICAgIHN1YnRyZWU6ICEwCiAgICAgICAgICAgICAgICB9KSkpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbGoucHJvdG90eXBlLnVub2JzZXJ2ZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBfLkNkKHRoaXMuaiwgZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi50YXJnZXQgIT0gYTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgMCA9PSB0aGlzLmoubGVuZ3RoICYmIHRoaXMuZGlzY29ubmVjdCgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBsai5wcm90b3R5cGUuZGlzY29ubmVjdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMuRCA9ICExOwogICAgICAgICAgICAgICAgdGhpcy5qLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICBfLkxjKF8uciwgJ3Njcm9sbCcsIHRoaXMuRik7CiAgICAgICAgICAgICAgICBfLkxjKF8uciwgJ3Jlc2l6ZScsIHRoaXMuRik7CiAgICAgICAgICAgICAgICB0aGlzLm0gJiYgKHRoaXMubS5kaXNjb25uZWN0KCksIHRoaXMubSA9IG51bGwpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVHogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBbXS5jb25jYXQoXy5sYyhhLkEpKTsKICAgICAgICAgICAgICAgIGEuQS5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBVeiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmKSB7CiAgICAgICAgICAgICAgICBfLmd1LmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5zdGF0dXMgPSAxOwogICAgICAgICAgICAgICAgdGhpcy5EID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuQSA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLkogPSBkOwogICAgICAgICAgICAgICAgdGhpcy5xYiA9ICEhZTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IE1hdGgucmFuZG9tKCk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSB7fTsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IG51bGw7CiAgICAgICAgICAgICAgICB0aGlzLlIgPSAoMCwgXy5ibikodGhpcy5HLCB0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuTSA9IGY7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhVeiwgXy5ndSk7CiAgICAgICAgICAgIFV6LnByb3RvdHlwZS5HID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmICghKCcqJyAhPT0gdGhpcy5BICYmIGEub3JpZ2luICE9PSB0aGlzLkEgfHwgIXRoaXMucWIgJiYgYS5zb3VyY2UgIT0gdGhpcy5EKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBiID0gSlNPTi5wYXJzZShhLmRhdGEpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKF8uamEoYikgJiYgKGEgPSBiLmksIGIuYyA9PT0gdGhpcy5sICYmIGEgIT0gdGhpcy5vKSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMiAhPT0gdGhpcy5zdGF0dXMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhdHVzID0gMiwgVnoodGhpcyksIHRoaXMuaiAmJiAodGhpcy5qKCksIHRoaXMuaiA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBhID0gYi5zOwogICAgICAgICAgICAgICAgICAgICAgICBiID0gYi5wOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT09IHR5cGVvZiBhICYmICgnc3RyaW5nJyA9PT0gdHlwZW9mIGIgfHwgXy5qYShiKSkgJiYgdGhpcy5CLmhhc093blByb3BlcnR5KGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5CW2FdKGIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFZ6ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0ge307CiAgICAgICAgICAgICAgICBiLmMgPSBhLmw7CiAgICAgICAgICAgICAgICBiLmkgPSBhLm87CiAgICAgICAgICAgICAgICBhLk0gJiYgKGIuZSA9IGEuTSk7CiAgICAgICAgICAgICAgICBhLkQucG9zdE1lc3NhZ2UoSlNPTi5zdHJpbmdpZnkoYiksIGEuQSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFV6LnByb3RvdHlwZS5UID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKDEgPT09IHRoaXMuc3RhdHVzKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ELnBvc3RNZXNzYWdlICYmIFZ6KHRoaXMpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGEpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgd2luZG93LnNldFRpbWVvdXQoKDAsIF8uYm4pKHRoaXMuVCwgdGhpcyksIDUwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgVXoucHJvdG90eXBlLmNvbm5lY3QgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYSAmJiAodGhpcy5qID0gYSk7CiAgICAgICAgICAgICAgICBfLmZiKHdpbmRvdywgJ21lc3NhZ2UnLCB0aGlzLlIpOwogICAgICAgICAgICAgICAgdGhpcy5KICYmIHRoaXMuVCgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgV3ogPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgYS5CW2JdID0gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgVXoucHJvdG90eXBlLnNlbmQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSB7fTsKICAgICAgICAgICAgICAgIGMuYyA9IHRoaXMubDsKICAgICAgICAgICAgICAgIGMuaSA9IHRoaXMubzsKICAgICAgICAgICAgICAgIGMucyA9IGE7CiAgICAgICAgICAgICAgICBjLnAgPSBiOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICB0aGlzLkQucG9zdE1lc3NhZ2UoSlNPTi5zdHJpbmdpZnkoYyksIHRoaXMuQSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChkKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFV6LnByb3RvdHlwZS5GID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5zdGF0dXMgPSAzOwogICAgICAgICAgICAgICAgXy5MYyh3aW5kb3csICdtZXNzYWdlJywgdGhpcy5SKTsKICAgICAgICAgICAgICAgIF8uZ3UucHJvdG90eXBlLkYuY2FsbCh0aGlzKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFh6ID0gbmV3IHYuTWFwKFsKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICduYXZpZ2F0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3JlbG9hZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2JhY2tfZm9yd2FyZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXJlbmRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgIDQKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdKSwgWXogPSBuZXcgdi5NYXAoWwogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgWWkoT3QpOwogICAgICAgICAgICB2YXIgWnogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oWnosIFEpOwogICAgICAgICAgICB2YXIgJHogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oJHosIFEpOwogICAgICAgICAgICB2YXIgYUEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oYUEsIFEpOwogICAgICAgICAgICBlaShmZChnbignaHR0cHM6Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9wYWdlYWQvb3NkLmpzJykpKTsKICAgICAgICAgICAgdmFyIGNBID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAwICE9IGJBKGRvY3VtZW50KTsKICAgICAgICAgICAgICAgIH0sIGJBID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gXy5IKFB0KSAmJiBhLnByZXJlbmRlcmluZyA/IDMgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZpc2libGU6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgIGhpZGRlbjogMiwKICAgICAgICAgICAgICAgICAgICAgICAgcHJlcmVuZGVyOiAzLAogICAgICAgICAgICAgICAgICAgICAgICBwcmV2aWV3OiA0LAogICAgICAgICAgICAgICAgICAgICAgICB1bmxvYWRlZDogNQogICAgICAgICAgICAgICAgICAgIH1bYS52aXNpYmlsaXR5U3RhdGUgfHwgYS53ZWJraXRWaXNpYmlsaXR5U3RhdGUgfHwgYS5tb3pWaXNpYmlsaXR5U3RhdGUgfHwgJyddIHx8IDA7CiAgICAgICAgICAgICAgICB9LCBkQSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGI7CiAgICAgICAgICAgICAgICAgICAgYS52aXNpYmlsaXR5U3RhdGUgPyBiID0gJ3Zpc2liaWxpdHljaGFuZ2UnIDogYS5tb3pWaXNpYmlsaXR5U3RhdGUgPyBiID0gJ21venZpc2liaWxpdHljaGFuZ2UnIDogYS53ZWJraXRWaXNpYmlsaXR5U3RhdGUgJiYgKGIgPSAnd2Via2l0dmlzaWJpbGl0eWNoYW5nZScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSwgZUEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGEuaGlkZGVuID8gYS5oaWRkZW4gOiBudWxsICE9IGEubW96SGlkZGVuID8gYS5tb3pIaWRkZW4gOiBudWxsICE9IGEud2Via2l0SGlkZGVuID8gYS53ZWJraXRIaWRkZW4gOiBudWxsOwogICAgICAgICAgICAgICAgfSwgZkEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGlmICgzID09IGJBKGIpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgYSgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIH0sIGdBID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIWZBKGEsIGIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gITEsIGQgPSBkQShiKSwgZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhYyAmJiBmQShhLCBiKSAmJiAoYyA9ICEwLCBfLkxjKGIsIGQsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIGQgJiYgXy5mYihiLCBkLCBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaUEsIGhBOwogICAgICAgICAgICBpQSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMud2FzUGxhVGFnUHJvY2Vzc2VkID0gITE7CiAgICAgICAgICAgICAgICB0aGlzLndhc1JlYWN0aXZlQWRDb25maWdSZWNlaXZlZCA9IHt9OwogICAgICAgICAgICAgICAgdGhpcy5hZENvdW50ID0ge307CiAgICAgICAgICAgICAgICB0aGlzLndhc1JlYWN0aXZlQWRWaXNpYmxlID0ge307CiAgICAgICAgICAgICAgICB0aGlzLnN0YXRlRm9yVHlwZSA9IHt9OwogICAgICAgICAgICAgICAgdGhpcy5yZWFjdGl2ZVR5cGVFbmFibGVkSW5Bc2ZlID0ge307CiAgICAgICAgICAgICAgICB0aGlzLndhc1JlYWN0aXZlVGFnUmVxdWVzdFNlbnQgPSAhMTsKICAgICAgICAgICAgICAgIHRoaXMucmVhY3RpdmVUeXBlRGlzYWJsZWRCeVB1Ymxpc2hlciA9IHt9OwogICAgICAgICAgICAgICAgdGhpcy50YWdTcGVjaWZpY1N0YXRlID0ge307CiAgICAgICAgICAgICAgICB0aGlzLm1lc3NhZ2VWYWxpZGF0aW9uRW5hYmxlZCA9ICExOwogICAgICAgICAgICAgICAgdGhpcy5mbG9hdGluZ0Fkc1N0YWNraW5nID0gbmV3IGhBKCk7CiAgICAgICAgICAgICAgICB0aGlzLnNpZGVSYWlsUHJvY2Vzc2VkRml4ZWRFbGVtZW50cyA9IG5ldyB2LlNldCgpOwogICAgICAgICAgICAgICAgdGhpcy5zaWRlUmFpbEF2YWlsYWJsZVNwYWNlID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uQmggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYS5nb29nbGVfcmVhY3RpdmVfYWRzX2dsb2JhbF9zdGF0ZSA/IChudWxsID09IGEuZ29vZ2xlX3JlYWN0aXZlX2Fkc19nbG9iYWxfc3RhdGUuc2lkZVJhaWxQcm9jZXNzZWRGaXhlZEVsZW1lbnRzICYmIChhLmdvb2dsZV9yZWFjdGl2ZV9hZHNfZ2xvYmFsX3N0YXRlLnNpZGVSYWlsUHJvY2Vzc2VkRml4ZWRFbGVtZW50cyA9IG5ldyB2LlNldCgpKSwgbnVsbCA9PSBhLmdvb2dsZV9yZWFjdGl2ZV9hZHNfZ2xvYmFsX3N0YXRlLnNpZGVSYWlsQXZhaWxhYmxlU3BhY2UgJiYgKGEuZ29vZ2xlX3JlYWN0aXZlX2Fkc19nbG9iYWxfc3RhdGUuc2lkZVJhaWxBdmFpbGFibGVTcGFjZSA9IG5ldyB2Lk1hcCgpKSkgOiBhLmdvb2dsZV9yZWFjdGl2ZV9hZHNfZ2xvYmFsX3N0YXRlID0gbmV3IGlBKCk7CiAgICAgICAgICAgICAgICByZXR1cm4gYS5nb29nbGVfcmVhY3RpdmVfYWRzX2dsb2JhbF9zdGF0ZTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgaEEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLm1heFpJbmRleFJlc3RyaWN0aW9ucyA9IHt9OwogICAgICAgICAgICAgICAgdGhpcy5uZXh0UmVzdHJpY3Rpb25JZCA9IDA7CiAgICAgICAgICAgICAgICB0aGlzLm1heFpJbmRleExpc3RlbmVycyA9IFtdOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbEE7CiAgICAgICAgICAgIF8uakEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5qID0gXy5CaChhKS5mbG9hdGluZ0Fkc1N0YWNraW5nOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLmtBID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgPSBfLmRyKGEuai5tYXhaSW5kZXhSZXN0cmljdGlvbnMpOwogICAgICAgICAgICAgICAgcmV0dXJuIGEubGVuZ3RoID8gTWF0aC5taW4uYXBwbHkobnVsbCwgYSkgOiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICBsQSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IF8ua0EoYSk7CiAgICAgICAgICAgICAgICBfLmhuKGEuai5tYXhaSW5kZXhMaXN0ZW5lcnMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoYik7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5tQSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB0aGlzLm0gPSBhOwogICAgICAgICAgICAgICAgdGhpcy5qID0gbnVsbDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5uQSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBhLmopIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEubSwgYyA9IGIuai5uZXh0UmVzdHJpY3Rpb25JZCsrOwogICAgICAgICAgICAgICAgICAgIGIuai5tYXhaSW5kZXhSZXN0cmljdGlvbnNbY10gPSAyMTQ3NDgzNjQ2OwogICAgICAgICAgICAgICAgICAgIGxBKGIpOwogICAgICAgICAgICAgICAgICAgIGEuaiA9IGM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8ub0EgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gYS5qKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLm07CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGIuai5tYXhaSW5kZXhSZXN0cmljdGlvbnNbYS5qXTsKICAgICAgICAgICAgICAgICAgICBsQShiKTsKICAgICAgICAgICAgICAgICAgICBhLmogPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgRGgsIEdmLCBKZjsKICAgICAgICAgICAgRGggPSA3MjggKiAxLjM4OwogICAgICAgICAgICBfLkZoID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhLmlubmVySGVpZ2h0ID49IGEuaW5uZXJXaWR0aDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5wQSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IF8uSWYoYSkuY2xpZW50V2lkdGg7CiAgICAgICAgICAgICAgICBhID0gYS5pbm5lcldpZHRoOwogICAgICAgICAgICAgICAgcmV0dXJuIGIgJiYgYSA/IGIgLyBhIDogMDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgR2YgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIChhID0gXy5JZihhKS5jbGllbnRXaWR0aCkgPyBhID4gKHZvaWQgMCA9PT0gYiA/IDQyMCA6IGIpID8gMzI3NjggOiAzMjAgPiBhID8gNjU1MzYgOiAwIDogMTYzODQ7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEpmID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAoYSA9IF8ucEEoYSkpID8gMS4wNSA8IGEgPyAyNjIxNDQgOiAwLjk1ID4gYSA/IDUyNDI4OCA6IDAgOiAxMzEwNzI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uSWYgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYSA9IGEuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHt9OwogICAgICAgICAgICAgICAgYSAmJiAoYiA9ICdDU1MxQ29tcGF0JyA9PSBhLmNvbXBhdE1vZGUgPyBhLmRvY3VtZW50RWxlbWVudCA6IGEuYm9keSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYiB8fCB7fTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5xQSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSBhLnBhZ2VZT2Zmc2V0ID8gKGEuZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50IHx8IGEuZG9jdW1lbnQuYm9keS5wYXJlbnROb2RlIHx8IGEuZG9jdW1lbnQuYm9keSkuc2Nyb2xsVG9wIDogYS5wYWdlWU9mZnNldDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEdoID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gW10sIGUgPSAwOyAzID4gZTsgZSsrKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBmID0gMDsgMyA+IGY7IGYrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5wdXNoLmNhbGwoZywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHg6IGYgLyAyICogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5OiBiICsgZSAvIDIgKiAoYyAtIGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgfSwgSGggPSA5MCAqIDEuMzg7CiAgICAgICAgICAgIHZhciByQTsKICAgICAgICAgICAgXy5zQSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBpZiAoIWEuYm9keSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IHJBKCk7CiAgICAgICAgICAgICAgICBjLmFwcGx5KGEsIGIpOwogICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBfLlRyKGEuYm9keSwgewogICAgICAgICAgICAgICAgICAgICAgICBmaWx0ZXI6IGMuaiwKICAgICAgICAgICAgICAgICAgICAgICAgd2Via2l0RmlsdGVyOiBjLmosCiAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJmbG93OiBjLkYsCiAgICAgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uOiBjLkEsCiAgICAgICAgICAgICAgICAgICAgICAgIHRvcDogYy5ECiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgYi5zY3JvbGxUbygwLCBjLm0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgckEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLmogPSB0aGlzLkQgPSB0aGlzLkEgPSB0aGlzLkYgPSBudWxsOwogICAgICAgICAgICAgICAgdGhpcy5tID0gMDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgckEucHJvdG90eXBlLmFwcGx5ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHRoaXMuRiA9IGEuYm9keS5zdHlsZS5vdmVyZmxvdzsKICAgICAgICAgICAgICAgIHRoaXMuQSA9IGEuYm9keS5zdHlsZS5wb3NpdGlvbjsKICAgICAgICAgICAgICAgIHRoaXMuRCA9IGEuYm9keS5zdHlsZS50b3A7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBhLmJvZHkuc3R5bGUuZmlsdGVyID8gYS5ib2R5LnN0eWxlLmZpbHRlciA6IGEuYm9keS5zdHlsZS53ZWJraXRGaWx0ZXI7CiAgICAgICAgICAgICAgICB0aGlzLm0gPSBfLnFBKGIpOwogICAgICAgICAgICAgICAgXy5UcihhLmJvZHksICd0b3AnLCAtdGhpcy5tICsgJ3B4Jyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTGYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICBpZiAoIShjID0gMCA+PSBiKSAmJiAhKGMgPSBudWxsID09IGEpKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgYS5zZXRJdGVtKCdfX3N0b3JhZ2VfdGVzdF9fJywgJ19fc3RvcmFnZV90ZXN0X18nKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLmdldEl0ZW0oJ19fc3RvcmFnZV90ZXN0X18nKTsKICAgICAgICAgICAgICAgICAgICAgICAgYS5yZW1vdmVJdGVtKCdfX3N0b3JhZ2VfdGVzdF9fJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gJ19fc3RvcmFnZV90ZXN0X18nID09PSBkOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9ICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBjID0gIWU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYyA/IG51bGwgOiBTZChhLCBiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5LZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gISFhICYmIDEgPiBhLmxlbmd0aDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGttID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyA1MDAgOiBiOwogICAgICAgICAgICAgICAgXy5ndS5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5BID0gYTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBudWxsOwogICAgICAgICAgICAgICAgdGhpcy5sID0ge307CiAgICAgICAgICAgICAgICB0aGlzLkIgPSAwOwogICAgICAgICAgICAgICAgdGhpcy5EID0gbnVsbDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGttLCBfLmd1KTsKICAgICAgICAgICAga20ucHJvdG90eXBlLkYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSB7fTsKICAgICAgICAgICAgICAgIHRoaXMuRCAmJiAoXy5MYyh0aGlzLkEsICdtZXNzYWdlJywgdGhpcy5EKSwgZGVsZXRlIHRoaXMuRCk7CiAgICAgICAgICAgICAgICBkZWxldGUgdGhpcy5sOwogICAgICAgICAgICAgICAgZGVsZXRlIHRoaXMuQTsKICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzLmo7CiAgICAgICAgICAgICAgICBfLmd1LnByb3RvdHlwZS5GLmNhbGwodGhpcyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBtbSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgPT09IHR5cGVvZiAobnVsbCA9PT0gKGIgPSBhLkEpIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuX191c3BhcGkpIHx8IG51bGwgIT0gdEEoYSk7CiAgICAgICAgICAgICAgICB9LCB2QSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB7fTsKICAgICAgICAgICAgICAgICAgICBpZiAobW0oYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBfLlZuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKGMpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgdUEoYSwgZnVuY3Rpb24gKGUsIGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgJiYgKGMgPSBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZCwgYS5vKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgYihjKTsKICAgICAgICAgICAgICAgIH0sIHVBID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIChudWxsID09PSAoYyA9IGEuQSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5fX3VzcGFwaSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLkEuX191c3BhcGksIGEoJ2dldFVTUERhdGEnLCAxLCBiKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICh0QShhKSkgewogICAgICAgICAgICAgICAgICAgICAgICB3QShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSArK2EuQjsKICAgICAgICAgICAgICAgICAgICAgICAgYS5sW2RdID0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgYS5qICYmIChiID0ge30sIGEuai5wb3N0TWVzc2FnZSgoYi5fX3VzcGFwaUNhbGwgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21tYW5kOiAnZ2V0VVNQRGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbElkOiBkCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGIpLCAnKicpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCB0QSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEuaikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuajsKICAgICAgICAgICAgICAgICAgICBhLmogPSBxcihhLkEsICdfX3VzcGFwaUxvY2F0b3InKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5qOwogICAgICAgICAgICAgICAgfSwgd0EgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEuRCB8fCAoYS5EID0gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgPT09IHR5cGVvZiBiLmRhdGEgPyBkID0gSlNPTi5wYXJzZShiLmRhdGEpIDogZCA9IGIuZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZC5fX3VzcGFwaVJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT09IChjID0gYS5sKSB8fCB2b2lkIDAgPT09IGMgPyB2b2lkIDAgOiBjW2UuY2FsbElkXShlLnJldHVyblZhbHVlLCBlLnN1Y2Nlc3MpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBfLmZiKGEuQSwgJ21lc3NhZ2UnLCBhLkQpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB4QSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyh4QSwgUSk7CiAgICAgICAgICAgIHZhciB6QSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSwgLTEsIHlBKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHpBLCBRKTsKICAgICAgICAgICAgdmFyIHlBID0gWwogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgXTsKICAgICAgICAgICAgdmFyIEFBID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEFBLCBRKTsKICAgICAgICAgICAgdmFyIEJBID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEJBLCBRKTsKICAgICAgICAgICAgdmFyIGltID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIF8uZ3UuY2FsbCh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuQSA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkQgPSB0aGlzLmogPSBudWxsOwogICAgICAgICAgICAgICAgdGhpcy5sID0ge307CiAgICAgICAgICAgICAgICB0aGlzLkIgPSAwOwogICAgICAgICAgICAgICAgdGhpcy5vID0gITE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhpbSwgXy5ndSk7CiAgICAgICAgICAgIHZhciBKZyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYS5vIHx8IChhLmogfHwgKGEuaiA9IGEuQS5nb29nbGVmYyA/IGEuQSA6IHFyKGEuQSwgJ2dvb2dsZWZjUHJlc2VudCcpKSwgYS5vID0gITApOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWEuajsKICAgICAgICAgICAgICAgIH0sIERBID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoSmcoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmogPT09IGEuQSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLmouZ29vZ2xlZmMgfHwgKGEuai5nb29nbGVmYyA9IHt9KSwgYS5fX2ZjaSA9IGEuX19mY2kgfHwgW10sIGEuX19mY2kucHVzaChiLCBmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMoU2woQkEsIGYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIENBKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLkIrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubFtkXSA9IGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5qLnBvc3RNZXNzYWdlKChlLl9fZmNpQ2FsbCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21tYW5kOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxJZDogZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSksICcqJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIEVBID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHYuUHJvbWlzZShmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBEQShhLCBiLCBjKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIENBID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBhLkQgfHwgKGEuRCA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IFNsKEJBLCBiLmRhdGEuX19mY2lSZXR1cm4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgKDAsIGEubFtHKGMsIDEpXSkoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIF8uZmIoYS5BLCAnbWVzc2FnZScsIGEuRCkpOwogICAgICAgICAgICAgICAgfSwgRkEgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIGlmICghYikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuUHJvbWlzZS5yZXNvbHZlKG51bGwpOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gV2IoYiwgeEEsIDMpOwogICAgICAgICAgICAgICAgICAgIGIgPSBXYihiLCBBQSwgMik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgYiAmJiAxID09PSBHKGIsIDEpICYmIDIgPT09IEcoZSwgMSkgPyBFQShhLCAnZ2V0TTI1Q29uc2VudCcpLnRoZW4oZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBXYihmLCB6QSwgNCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZiA9IGQsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IE9oKGcsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggJiYgXy50KGgsICdpbmNsdWRlcycpLmNhbGwoaCwgYykgJiYgKGYgPSAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGcgPSBPaChnLCAyKSkgJiYgXy50KGcsICdpbmNsdWRlcycpLmNhbGwoZywgYykgJiYgKGYgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmOwogICAgICAgICAgICAgICAgICAgIH0pIDogdi5Qcm9taXNlLnJlc29sdmUobnVsbCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVmkgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgdmFyIGQgPSAhMDsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyAnJyA6IGI7CiAgICAgICAgICAgICAgICBkID0gdm9pZCAwID09PSBkID8gITEgOiBkOwogICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/ICcnIDogYzsKICAgICAgICAgICAgICAgIGlmICghYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCAmJiBUZChjLCAxKSwgYTsKICAgICAgICAgICAgICAgIHZhciBlID0gYS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgaWYgKC0xIDwgZS5pbmRleE9mKCc8IWRvY3R5cGUnKSB8fCAtMSA8IGUuaW5kZXhPZignPGh0bWwnKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCAmJiBUZChjLCAyKSwgYTsKICAgICAgICAgICAgICAgIGQgJiYgVGQoYywgMyk7CiAgICAgICAgICAgICAgICByZXR1cm4gXy5IKFZ0KSA/IGEgOiAnPCFkb2N0eXBlIGh0bWw+PGh0bWw+PGhlYWQ+JyArIGIgKyAnPC9oZWFkPjxib2R5PicgKyBhICsgJzwvYm9keT48L2h0bWw+JzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE1pID0gWwogICAgICAgICAgICAgICAgICAgICdhdXRvJywKICAgICAgICAgICAgICAgICAgICAnaW5oZXJpdCcsCiAgICAgICAgICAgICAgICAgICAgJzEwMCUnCiAgICAgICAgICAgICAgICBdLCBHQSA9IE1pLmNvbmNhdChbJ25vbmUnXSksIEhBID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYpIHsKICAgICAgICAgICAgICAgICAgICBlID0gdm9pZCAwID09PSBlID8gMTAgOiBlOwogICAgICAgICAgICAgICAgICAgIGYgPSB2b2lkIDAgPT09IGYgPyAxMCA6IGY7CiAgICAgICAgICAgICAgICAgICAgYiA9IGIuc3R5bGVTaGVldHM7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFiKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBhLm1hdGNoZXMgfHwgYS53ZWJraXRNYXRjaGVzU2VsZWN0b3IgfHwgYS5tb3pNYXRjaGVzU2VsZWN0b3IgfHwgYS5tc01hdGNoZXNTZWxlY3RvciB8fCBhLm9NYXRjaGVzU2VsZWN0b3I7CiAgICAgICAgICAgICAgICAgICAgZSA9IC0xID09IGUgPyBJbmZpbml0eSA6IGU7CiAgICAgICAgICAgICAgICAgICAgZiA9IC0xID09IGYgPyBJbmZpbml0eSA6IGY7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaCA9IDA7IGggPCBNYXRoLm1pbihiLmxlbmd0aCwgZSk7ICsraCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gYltoXSwgbSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gPSBsLmNzc1J1bGVzIHx8IGwucnVsZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDE1ID09IEQuY29kZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRC5zdHlsZVNoZWV0ID0gbCwgRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsgPSBtOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoayAmJiAwIDwgay5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG0gPSAwOyBtIDwgTWF0aC5taW4oay5sZW5ndGgsIGYpOyArK20pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGtbbV0sIHE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHEgPSAxID09IG4udHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxID0gZy5jYWxsKGEsIHEuc2VsZWN0b3JUZXh0KSAmJiB1KHEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXEgJiYgKHEgPSBkICYmIDQgPT0gbi50eXBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcSA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBCID0gZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBuLmNzc1J1bGVzIHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgeCA9IDA7IHggPCBNYXRoLm1pbihuLmxlbmd0aCwgQik7IHgrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB6ID0gblt4XSwgQzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQyA9IDEgPT09IHoudHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQyA9IHUsIEMgPSBnLmNhbGwocSwgei5zZWxlY3RvclRleHQpICYmIEMoeik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHEgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0sIFprID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHZvaWQgMCA9PT0gZCA/IDEwIDogZDsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHZvaWQgMCA9PT0gZSA/IDEwIDogZTsKICAgICAgICAgICAgICAgICAgICBpZiAoIWEpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9ICEwOwogICAgICAgICAgICAgICAgICAgIEtpKGEsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmID0gTGkoZywgYiwgITEsIGQsIGUpOwogICAgICAgICAgICAgICAgICAgIH0sIHZvaWQgMCA9PT0gYyA/IDEwMCA6IGMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmOwogICAgICAgICAgICAgICAgfSwgTGkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBmID0gYS5zdHlsZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZiAmJiBmLmhlaWdodCAmJiAhKDAgPD0gXy5kYShNaSwgZi5oZWlnaHQpKSB8fCBmICYmIGYubWF4SGVpZ2h0ICYmICEoMCA8PSBfLmRhKEdBLCBmLm1heEhlaWdodCkpIHx8IEhBKGEsIGIuZG9jdW1lbnQsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZy5zdHlsZS5oZWlnaHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBnLnN0eWxlWydtYXgtaGVpZ2h0J107CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoICYmICEoMCA8PSBfLmRhKE1pLCBoKSkgfHwgZyAmJiAhKDAgPD0gXy5kYShHQSwgZykpOwogICAgICAgICAgICAgICAgICAgIH0sIGMsIGQsIGUpID8gITEgOiAhMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBJQSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmKSB7CiAgICAgICAgICAgICAgICB0aGlzLkYgPSBfLkhyKGEpOwogICAgICAgICAgICAgICAgdGhpcy5tID0gXy5IcihiKTsKICAgICAgICAgICAgICAgIHRoaXMuQSA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBfLkhyKGQpOwogICAgICAgICAgICAgICAgdGhpcy5EID0gZTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IGY7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIElBLnByb3RvdHlwZS5YID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHsKICAgICAgICAgICAgICAgICAgICB3aW5kb3dDb29yZHNfdDogdGhpcy5GLnRvcCwKICAgICAgICAgICAgICAgICAgICB3aW5kb3dDb29yZHNfcjogdGhpcy5GLnJpZ2h0LAogICAgICAgICAgICAgICAgICAgIHdpbmRvd0Nvb3Jkc19iOiB0aGlzLkYuYm90dG9tLAogICAgICAgICAgICAgICAgICAgIHdpbmRvd0Nvb3Jkc19sOiB0aGlzLkYubGVmdCwKICAgICAgICAgICAgICAgICAgICBmcmFtZUNvb3Jkc190OiB0aGlzLm0udG9wLAogICAgICAgICAgICAgICAgICAgIGZyYW1lQ29vcmRzX3I6IHRoaXMubS5yaWdodCwKICAgICAgICAgICAgICAgICAgICBmcmFtZUNvb3Jkc19iOiB0aGlzLm0uYm90dG9tLAogICAgICAgICAgICAgICAgICAgIGZyYW1lQ29vcmRzX2w6IHRoaXMubS5sZWZ0LAogICAgICAgICAgICAgICAgICAgIHN0eWxlWkluZGV4OiB0aGlzLkEsCiAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEV4cGFuc2lvbl90OiB0aGlzLmoudG9wLAogICAgICAgICAgICAgICAgICAgIGFsbG93ZWRFeHBhbnNpb25fcjogdGhpcy5qLnJpZ2h0LAogICAgICAgICAgICAgICAgICAgIGFsbG93ZWRFeHBhbnNpb25fYjogdGhpcy5qLmJvdHRvbSwKICAgICAgICAgICAgICAgICAgICBhbGxvd2VkRXhwYW5zaW9uX2w6IHRoaXMuai5sZWZ0LAogICAgICAgICAgICAgICAgICAgIHhJblZpZXc6IHRoaXMuRCwKICAgICAgICAgICAgICAgICAgICB5SW5WaWV3OiB0aGlzLmwKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgSkEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSB3aW5kb3csIGQgPSBjLnNjcmVlblggfHwgYy5zY3JlZW5MZWZ0IHx8IDAsIGUgPSBjLnNjcmVlblkgfHwgYy5zY3JlZW5Ub3AgfHwgMDsKICAgICAgICAgICAgICAgIGMgPSBuZXcgXy5HcihlLCBkICsgKGMub3V0ZXJXaWR0aCB8fCBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuY2xpZW50V2lkdGggfHwgMCksIGUgKyAoYy5vdXRlckhlaWdodCB8fCBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuY2xpZW50SGVpZ2h0IHx8IDApLCBkKTsKICAgICAgICAgICAgICAgIHZhciBmID0gWXIoYSk7CiAgICAgICAgICAgICAgICBkID0gXy5PZChfLlBkLCBhKTsKICAgICAgICAgICAgICAgIHZhciBnID0gbmV3IElyKGYueCwgZi55LCBkLndpZHRoLCBkLmhlaWdodCk7CiAgICAgICAgICAgICAgICBkID0gSnIoZyk7CiAgICAgICAgICAgICAgICBlID0gU3RyaW5nKE5kKGEsICd6SW5kZXgnKSk7CiAgICAgICAgICAgICAgICB2YXIgaCA9IG5ldyBfLkdyKDAsIEluZmluaXR5LCBJbmZpbml0eSwgMCk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBrID0gTnEoYSksIGwgPSBrLmouYm9keSwgbSA9IGsuai5kb2N1bWVudEVsZW1lbnQsIG4gPSBTcShrLmopOyBhID0gWHIoYSk7KQogICAgICAgICAgICAgICAgICAgIGlmICghKF8uYW8gJiYgMCA9PSBhLmNsaWVudFdpZHRoIHx8IGVvICYmIDAgPT0gYS5jbGllbnRIZWlnaHQgJiYgYSA9PSBsKSAmJiBhICE9IGwgJiYgYSAhPSBtICYmICd2aXNpYmxlJyAhPSBOZChhLCAnb3ZlcmZsb3cnKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcSA9IFlyKGEpLCB1ID0gbmV3IF8uaWcoYS5jbGllbnRMZWZ0LCBhLmNsaWVudFRvcCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHEueCArPSB1Lng7CiAgICAgICAgICAgICAgICAgICAgICAgIHEueSArPSB1Lnk7CiAgICAgICAgICAgICAgICAgICAgICAgIGgudG9wID0gTWF0aC5tYXgoaC50b3AsIHEueSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGgucmlnaHQgPSBNYXRoLm1pbihoLnJpZ2h0LCBxLnggKyBhLmNsaWVudFdpZHRoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaC5ib3R0b20gPSBNYXRoLm1pbihoLmJvdHRvbSwgcS55ICsgYS5jbGllbnRIZWlnaHQpOwogICAgICAgICAgICAgICAgICAgICAgICBoLmxlZnQgPSBNYXRoLm1heChoLmxlZnQsIHEueCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYSA9IG4uc2Nyb2xsTGVmdDsKICAgICAgICAgICAgICAgIG4gPSBuLnNjcm9sbFRvcDsKICAgICAgICAgICAgICAgIGgubGVmdCA9IE1hdGgubWF4KGgubGVmdCwgYSk7CiAgICAgICAgICAgICAgICBoLnRvcCA9IE1hdGgubWF4KGgudG9wLCBuKTsKICAgICAgICAgICAgICAgIGsgPSBrLmo7CiAgICAgICAgICAgICAgICBrID0gXy5ScShrLnBhcmVudFdpbmRvdyB8fCBrLmRlZmF1bHRWaWV3IHx8IHdpbmRvdyk7CiAgICAgICAgICAgICAgICBoLnJpZ2h0ID0gTWF0aC5taW4oaC5yaWdodCwgYSArIGsud2lkdGgpOwogICAgICAgICAgICAgICAgaC5ib3R0b20gPSBNYXRoLm1pbihoLmJvdHRvbSwgbiArIGsuaGVpZ2h0KTsKICAgICAgICAgICAgICAgIGggPSAoaCA9IDAgPD0gaC50b3AgJiYgMCA8PSBoLmxlZnQgJiYgaC5ib3R0b20gPiBoLnRvcCAmJiBoLnJpZ2h0ID4gaC5sZWZ0ID8gaCA6IG51bGwpID8gbmV3IElyKGgubGVmdCwgaC50b3AsIGgucmlnaHQgLSBoLmxlZnQsIGguYm90dG9tIC0gaC50b3ApIDogbnVsbDsKICAgICAgICAgICAgICAgIGIgPyAoayA9IGIuYm91bmRpbmdDbGllbnRSZWN0LCBiID0gbmV3IElyKGYueCAtIGsubGVmdCwgZi55IC0gay50b3AsIGIucm9vdEJvdW5kcy53aWR0aCwgYi5yb290Qm91bmRzLmhlaWdodCkpIDogYiA9IGg7CiAgICAgICAgICAgICAgICBrID0gaCA/IEtyKGcsIGgpIDogbnVsbDsKICAgICAgICAgICAgICAgIGggPSBmID0gMDsKICAgICAgICAgICAgICAgIGsgJiYgIW5ldyBfLlVpKGsud2lkdGgsIGsuaGVpZ2h0KS5pc0VtcHR5KCkgJiYgKGYgPSBrLndpZHRoIC8gZy53aWR0aCwgaCA9IGsuaGVpZ2h0IC8gZy5oZWlnaHQpOwogICAgICAgICAgICAgICAgayA9IG5ldyBfLkdyKDAsIDAsIDAsIDApOwogICAgICAgICAgICAgICAgaWYgKGEgPSBiKQogICAgICAgICAgICAgICAgICAgIChnID0gS3IoZywgYikpID8gKG4gPSBKcihiKSwgbCA9IEpyKGcpLCBhID0gbC5yaWdodCAhPSBuLmxlZnQgJiYgbi5yaWdodCAhPSBsLmxlZnQsIG4gPSBsLmJvdHRvbSAhPSBuLnRvcCAmJiBuLmJvdHRvbSAhPSBsLnRvcCwgYSA9ICgwICE9IGcud2lkdGggfHwgYSkgJiYgKDAgIT0gZy5oZWlnaHQgfHwgbikpIDogYSA9ICExOwogICAgICAgICAgICAgICAgYSAmJiAoayA9IG5ldyBfLkdyKE1hdGgubWF4KGQudG9wIC0gYi50b3AsIDApLCBNYXRoLm1heChiLmxlZnQgKyBiLndpZHRoIC0gZC5yaWdodCwgMCksIE1hdGgubWF4KGIudG9wICsgYi5oZWlnaHQgLSBkLmJvdHRvbSwgMCksIE1hdGgubWF4KGQubGVmdCAtIGIubGVmdCwgMCkpKTsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgSUEoYywgZCwgZSwgaywgZiwgaCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBLQSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB0aGlzLkEgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5EID0gbnVsbDsKICAgICAgICAgICAgICAgIHRoaXMuUiA9IHRoaXMuc3RhdHVzID0gMDsKICAgICAgICAgICAgICAgIHRoaXMubSA9IG51bGw7CiAgICAgICAgICAgICAgICB0aGlzLmthID0gJ3NmY2hhbm5lbCcgKyBhOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVXUgPSBXdTsKICAgICAgICAgICAgdmFyIExBID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIExBLnByb3RvdHlwZS5YID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHRoaXMuaik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBNQSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB0aGlzLnpiID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuQWIgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5tID0gdGhpcy5qID0gITE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE1BLnByb3RvdHlwZS5YID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHsKICAgICAgICAgICAgICAgICAgICBleHBhbmRCeU92ZXJsYXk6IHRoaXMuemIsCiAgICAgICAgICAgICAgICAgICAgZXhwYW5kQnlQdXNoOiB0aGlzLkFiLAogICAgICAgICAgICAgICAgICAgIHJlYWRDb29raWU6IHRoaXMuaiwKICAgICAgICAgICAgICAgICAgICB3cml0ZUNvb2tpZTogdGhpcy5tCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE5BID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYsIGcsIGgsIGssIGwpIHsKICAgICAgICAgICAgICAgIGsgPSB2b2lkIDAgPT09IGsgPyBbXSA6IGs7CiAgICAgICAgICAgICAgICB0aGlzLm0gPSBhOwogICAgICAgICAgICAgICAgdGhpcy5GID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuQSA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLnBlcm1pc3Npb25zID0gZDsKICAgICAgICAgICAgICAgIHRoaXMubWV0YWRhdGEgPSBlOwogICAgICAgICAgICAgICAgdGhpcy5EID0gZjsKICAgICAgICAgICAgICAgIHRoaXMucWIgPSBnOwogICAgICAgICAgICAgICAgdGhpcy5ob3N0cGFnZUxpYnJhcnlUb2tlbnMgPSBrOwogICAgICAgICAgICAgICAgdGhpcy5qID0gJyc7CiAgICAgICAgICAgICAgICB0aGlzLlNhID0gaDsKICAgICAgICAgICAgICAgIHRoaXMuJGEgPSB2b2lkIDAgPT09IGwgPyAnJyA6IGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE5BLnByb3RvdHlwZS5YID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB7fTsKICAgICAgICAgICAgICAgIGEgPSAoYS51aWQgPSB0aGlzLm0sIGEuaG9zdFBlZXJOYW1lID0gdGhpcy5GLCBhLmluaXRpYWxHZW9tZXRyeSA9IHRoaXMuQS5YKCksIGEucGVybWlzc2lvbnMgPSB0aGlzLnBlcm1pc3Npb25zLlgoKSwgYS5tZXRhZGF0YSA9IHRoaXMubWV0YWRhdGEuWCgpLCBhLnJlcG9ydENyZWF0aXZlR2VvbWV0cnkgPSB0aGlzLkQsIGEuaXNEaWZmZXJlbnRTb3VyY2VXaW5kb3cgPSB0aGlzLnFiLCBhLmdvb2dfc2FmZWZyYW1lX2hsdCA9IG13KHRoaXMuaG9zdHBhZ2VMaWJyYXJ5VG9rZW5zKSwgYS5lbmNyeXB0aW9uTW9kZSA9IHRoaXMuU2EsIGEpOwogICAgICAgICAgICAgICAgdGhpcy5qICYmIChhLnNlbnRpbmVsID0gdGhpcy5qKTsKICAgICAgICAgICAgICAgIHRoaXMuJGEgJiYgKGEucGJqc0FkQ29uZmlnID0gdGhpcy4kYSk7CiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkoYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBPQSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBhOwogICAgICAgICAgICAgICAgdGhpcy5GID0gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgT0EucHJvdG90eXBlLlggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5GICYmIGEgJiYgKGEuc2VudGluZWwgPSB0aGlzLkYpOwogICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUEEgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgT0EuY2FsbCh0aGlzLCBhLCB2b2lkIDAgPT09IGMgPyAnJyA6IGMpOwogICAgICAgICAgICAgICAgdGhpcy52ZXJzaW9uID0gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFBBLCBPQSk7CiAgICAgICAgICAgIFBBLnByb3RvdHlwZS5YID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9BLnByb3RvdHlwZS5YLmNhbGwodGhpcywgewogICAgICAgICAgICAgICAgICAgIHVpZDogdGhpcy5qLAogICAgICAgICAgICAgICAgICAgIHZlcnNpb246IHRoaXMudmVyc2lvbgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBRQSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBPQS5jYWxsKHRoaXMsIGEsIHZvaWQgMCA9PT0gZCA/ICcnIDogZCk7CiAgICAgICAgICAgICAgICB0aGlzLkEgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5tID0gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFFBLCBPQSk7CiAgICAgICAgICAgIFFBLnByb3RvdHlwZS5YID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9BLnByb3RvdHlwZS5YLmNhbGwodGhpcywgewogICAgICAgICAgICAgICAgICAgIHVpZDogdGhpcy5qLAogICAgICAgICAgICAgICAgICAgIGluaXRpYWxXaWR0aDogdGhpcy5BLAogICAgICAgICAgICAgICAgICAgIGluaXRpYWxIZWlnaHQ6IHRoaXMubQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBSQSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBPQS5jYWxsKHRoaXMsIGEsIHZvaWQgMCA9PT0gYyA/ICcnIDogYyk7CiAgICAgICAgICAgICAgICB0aGlzLmRlc2NyaXB0aW9uID0gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFJBLCBPQSk7CiAgICAgICAgICAgIFJBLnByb3RvdHlwZS5YID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9BLnByb3RvdHlwZS5YLmNhbGwodGhpcywgewogICAgICAgICAgICAgICAgICAgIHVpZDogdGhpcy5qLAogICAgICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uOiB0aGlzLmRlc2NyaXB0aW9uCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFNBID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIE9BLmNhbGwodGhpcywgYSwgdm9pZCAwID09PSBkID8gJycgOiBkKTsKICAgICAgICAgICAgICAgIHRoaXMubSA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLnB1c2ggPSBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oU0EsIE9BKTsKICAgICAgICAgICAgU0EucHJvdG90eXBlLlggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT0EucHJvdG90eXBlLlguY2FsbCh0aGlzLCB7CiAgICAgICAgICAgICAgICAgICAgdWlkOiB0aGlzLmosCiAgICAgICAgICAgICAgICAgICAgZXhwYW5kX3Q6IHRoaXMubS50b3AsCiAgICAgICAgICAgICAgICAgICAgZXhwYW5kX3I6IHRoaXMubS5yaWdodCwKICAgICAgICAgICAgICAgICAgICBleHBhbmRfYjogdGhpcy5tLmJvdHRvbSwKICAgICAgICAgICAgICAgICAgICBleHBhbmRfbDogdGhpcy5tLmxlZnQsCiAgICAgICAgICAgICAgICAgICAgcHVzaDogdGhpcy5wdXNoCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFRBID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIE9BLmNhbGwodGhpcywgYSwgdm9pZCAwID09PSBiID8gJycgOiBiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFRBLCBPQSk7CiAgICAgICAgICAgIFRBLnByb3RvdHlwZS5YID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9BLnByb3RvdHlwZS5YLmNhbGwodGhpcywgeyB1aWQ6IHRoaXMuaiB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFVBID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIE9BLmNhbGwodGhpcywgYSwgdm9pZCAwID09PSBjID8gJycgOiBjKTsKICAgICAgICAgICAgICAgIHRoaXMuQSA9IGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhVQSwgT0EpOwogICAgICAgICAgICBVQS5wcm90b3R5cGUuWCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gewogICAgICAgICAgICAgICAgICAgIHVpZDogdGhpcy5qLAogICAgICAgICAgICAgICAgICAgIG5ld0dlb21ldHJ5OiB0aGlzLkEuWCgpCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIE9BLnByb3RvdHlwZS5YLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBWQSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmKSB7CiAgICAgICAgICAgICAgICBVQS5jYWxsKHRoaXMsIGEsIGMsIHZvaWQgMCA9PT0gZiA/ICcnIDogZik7CiAgICAgICAgICAgICAgICB0aGlzLnN1Y2Nlc3MgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5tID0gZDsKICAgICAgICAgICAgICAgIHRoaXMucHVzaCA9IGU7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhWQSwgVUEpOwogICAgICAgICAgICBWQS5wcm90b3R5cGUuWCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gewogICAgICAgICAgICAgICAgICAgIHVpZDogdGhpcy5qLAogICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IHRoaXMuc3VjY2VzcywKICAgICAgICAgICAgICAgICAgICBuZXdHZW9tZXRyeTogdGhpcy5BLlgoKSwKICAgICAgICAgICAgICAgICAgICBleHBhbmRfdDogdGhpcy5tLnRvcCwKICAgICAgICAgICAgICAgICAgICBleHBhbmRfcjogdGhpcy5tLnJpZ2h0LAogICAgICAgICAgICAgICAgICAgIGV4cGFuZF9iOiB0aGlzLm0uYm90dG9tLAogICAgICAgICAgICAgICAgICAgIGV4cGFuZF9sOiB0aGlzLm0ubGVmdCwKICAgICAgICAgICAgICAgICAgICBwdXNoOiB0aGlzLnB1c2gKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0aGlzLkYgJiYgKGEuc2VudGluZWwgPSB0aGlzLkYpOwogICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgV0EgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgT0EuY2FsbCh0aGlzLCBhLCB2b2lkIDAgPT09IGQgPyAnJyA6IGQpOwogICAgICAgICAgICAgICAgdGhpcy53aWR0aCA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLmhlaWdodCA9IGM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhXQSwgT0EpOwogICAgICAgICAgICBXQS5wcm90b3R5cGUuWCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPQS5wcm90b3R5cGUuWC5jYWxsKHRoaXMsIHsKICAgICAgICAgICAgICAgICAgICB1aWQ6IHRoaXMuaiwKICAgICAgICAgICAgICAgICAgICB3aWR0aDogdGhpcy53aWR0aCwKICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IHRoaXMuaGVpZ2h0CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFhBID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IFtdOwogICAgICAgICAgICAgICAgfSwgWkEgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIGEuai5wdXNoKG5ldyBZQShiLCBjLCBkLCBlKSk7CiAgICAgICAgICAgICAgICB9LCAkQSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgWkEoYSwgYiwgYywgZCArICdweCcsIHZvaWQgMCk7CiAgICAgICAgICAgICAgICB9LCBhQiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IGEuai5sZW5ndGggLSAxOyAwIDw9IGI7IGItLSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEualtiXTsKICAgICAgICAgICAgICAgICAgICAgICAgYy5tID8gKGMuRi5zdHlsZS5yZW1vdmVQcm9wZXJ0eShjLmopLCBjLkYuc3R5bGUuc2V0UHJvcGVydHkoYy5qLCBTdHJpbmcoYy5BKSwgYy5EKSkgOiBjLkYuc3R5bGVbYy5qXSA9IGMuQTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYS5qLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICB9LCBZQSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5GID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSAodGhpcy5tID0gISh2b2lkIDAgPT09IGQgfHwgIWEuc3R5bGUgfHwgIWEuc3R5bGUuZ2V0UHJvcGVydHlQcmlvcml0eSkpID8gU3RyaW5nKGIpLnJlcGxhY2UoLyhbQS1aXSkvZywgJy0kMScpLnRvTG93ZXJDYXNlKCkgOiBiOwogICAgICAgICAgICAgICAgICAgIHRoaXMuQSA9IHRoaXMubSA/IGEuc3R5bGUuZ2V0UHJvcGVydHlWYWx1ZSh0aGlzLmopIDogYS5zdHlsZVt0aGlzLmpdOwogICAgICAgICAgICAgICAgICAgIHRoaXMuRCA9IHRoaXMubSA/IGEuc3R5bGUuZ2V0UHJvcGVydHlQcmlvcml0eSh0aGlzLmopIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIHRoaXMubSA/IChhLnN0eWxlLnJlbW92ZVByb3BlcnR5KHRoaXMuaiksIGEuc3R5bGUuc2V0UHJvcGVydHkodGhpcy5qLCBTdHJpbmcoYyksIGQpKSA6IGEuc3R5bGVbdGhpcy5qXSA9IFN0cmluZyhjKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBiQiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHdpbmRvdywgYiA9IF8ubGwoYSk7CiAgICAgICAgICAgICAgICAgICAgYiAmJiAoYiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWw6ICcyJywKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogOSwKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGIKICAgICAgICAgICAgICAgICAgICB9LCBhID0gYS5nb29nbGVfanNfcmVwb3J0aW5nX3F1ZXVlID0gYS5nb29nbGVfanNfcmVwb3J0aW5nX3F1ZXVlIHx8IFtdLCAyMDQ4ID4gYS5sZW5ndGggJiYgYS5wdXNoKGIpKTsKICAgICAgICAgICAgICAgIH0sIGNCID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHdpbmRvdzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF8ubGwoKSwgZiA9IDM7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGIuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IDEzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoYSwgaCksIGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBoOwogICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5nb29nbGVfbWVhc3VyZV9qc190aW1pbmcgJiYgZSAmJiAoZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbDogYS50b1N0cmluZygpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR1cmF0aW9uOiAoXy5sbCgpIHx8IDApIC0gZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmID0gZC5nb29nbGVfanNfcmVwb3J0aW5nX3F1ZXVlID0gZC5nb29nbGVfanNfcmVwb3J0aW5nX3F1ZXVlIHx8IFtdLCAyMDQ4ID4gZi5sZW5ndGggJiYgZi5wdXNoKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZzsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGFqID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEtBLmNhbGwodGhpcywgYS51bmlxdWVJZCk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHRoaXM7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBhLkZmOwogICAgICAgICAgICAgICAgdGhpcy5pYSA9IDEgPT09IGEuc2l6ZTsKICAgICAgICAgICAgICAgIHRoaXMuZ2EgPSBuZXcgTUEoYS5wZXJtaXNzaW9ucy56YiAmJiAhdGhpcy5pYSwgYS5wZXJtaXNzaW9ucy5BYiAmJiAhdGhpcy5pYSk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBhLndjOwogICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICB0aGlzLnJhID0gbnVsbCAhPSAoYyA9IGEuaG9zdHBhZ2VMaWJyYXJ5VG9rZW5zKSA/IGMgOiBbXTsKICAgICAgICAgICAgICAgIHZhciBkID0gd2luZG93LmxvY2F0aW9uOwogICAgICAgICAgICAgICAgYyA9IGQucHJvdG9jb2w7CiAgICAgICAgICAgICAgICBkID0gZC5ob3N0OwogICAgICAgICAgICAgICAgdGhpcy50YSA9ICdmaWxlOicgPT0gYyA/ICcqJyA6IGMgKyAnLy8nICsgZDsKICAgICAgICAgICAgICAgIHRoaXMueGEgPSAhIWEucWI7CiAgICAgICAgICAgICAgICBjID0gITEgPT09IGEuZGQgPyAnaHR0cHM6JyA6IHdpbmRvdy5sb2NhdGlvbi5wcm90b2NvbDsKICAgICAgICAgICAgICAgIHRoaXMuTiA9IGEuUWIgPyAnLy8nICsgYS5RYiArICcuc2FmZWZyYW1lLmdvb2dsZXN5bmRpY2F0aW9uLmNvbScgOiAnLy90cGMuZ29vZ2xlc3luZGljYXRpb24uY29tJzsKICAgICAgICAgICAgICAgIHRoaXMuc2EgPSBhLnBiID8gJyonIDogVmQoYS5TYSkgPyAnaHR0cHM6Ly9zZWN1cmVmcmFtZS5kb3VibGVjbGljay5uZXQnIDogYyArIHRoaXMuTjsKICAgICAgICAgICAgICAgIHRoaXMuWSA9ICEhYS54ZDsKICAgICAgICAgICAgICAgIHRoaXMuZWEgPSBkQihhKTsKICAgICAgICAgICAgICAgIHRoaXMuRiA9IG5ldyBYQSgpOwogICAgICAgICAgICAgICAgZUIodGhpcywgYS53YywgYS5zaXplKTsKICAgICAgICAgICAgICAgIHRoaXMuRCA9IHRoaXMuZGEgPSBKQShhLndjKTsKICAgICAgICAgICAgICAgIHRoaXMuSiA9IGEubmUgfHwgJzEtMC0zOCc7CiAgICAgICAgICAgICAgICB2YXIgZTsKICAgICAgICAgICAgICAgIHRoaXMubmEgPSBudWxsICE9IChlID0gYS5xZCkgPyBlIDogJyc7CiAgICAgICAgICAgICAgICB2YXIgZjsKICAgICAgICAgICAgICAgIHRoaXMuWiA9IG51bGwgIT0gKGYgPSBhLlNhKSA/IGYgOiBudWxsOwogICAgICAgICAgICAgICAgdGhpcy5MYSA9IGEuJGE7CiAgICAgICAgICAgICAgICBmQih0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMuYWEgPSBudWxsOwogICAgICAgICAgICAgICAgdGhpcy5UID0gY0IoNDEyLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdCKGIpOwogICAgICAgICAgICAgICAgfSwgYS56YSk7CiAgICAgICAgICAgICAgICB0aGlzLkcgPSAtMTsKICAgICAgICAgICAgICAgIHRoaXMuTSA9IDA7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBudWxsOwogICAgICAgICAgICAgICAgIWEuWGYgfHwgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIEludGVyc2VjdGlvbk9ic2VydmVyIHx8IGdvIHx8IGZvIHx8ICh0aGlzLkIgPSBuZXcgSW50ZXJzZWN0aW9uT2JzZXJ2ZXIoY0IoNDE0LCBmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgIGIuYWEgPSBoW2gubGVuZ3RoIC0gMV07CiAgICAgICAgICAgICAgICAgICAgZ0IoYik7CiAgICAgICAgICAgICAgICB9LCBhLnphKSkpOwogICAgICAgICAgICAgICAgdGhpcy5tID0gbmV3IFV6KHRoaXMua2EsIHRoaXMuai5jb250ZW50V2luZG93LCB0aGlzLnNhLCAhMSk7CiAgICAgICAgICAgICAgICBXeih0aGlzLm0sICdpbml0X2RvbmUnLCAoMCwgXy5ibikodGhpcy5rYywgdGhpcykpOwogICAgICAgICAgICAgICAgV3oodGhpcy5tLCAncmVnaXN0ZXJfZG9uZScsICgwLCBfLmJuKSh0aGlzLnpjLCB0aGlzKSk7CiAgICAgICAgICAgICAgICBXeih0aGlzLm0sICdyZXBvcnRfZXJyb3InLCAoMCwgXy5ibikodGhpcy5BYywgdGhpcykpOwogICAgICAgICAgICAgICAgV3oodGhpcy5tLCAnZXhwYW5kX3JlcXVlc3QnLCAoMCwgXy5ibikodGhpcy5iYywgdGhpcykpOwogICAgICAgICAgICAgICAgV3oodGhpcy5tLCAnY29sbGFwc2VfcmVxdWVzdCcsICgwLCBfLmJuKSh0aGlzLlliLCB0aGlzKSk7CiAgICAgICAgICAgICAgICBXeih0aGlzLm0sICdjcmVhdGl2ZV9nZW9tZXRyeV91cGRhdGUnLCAoMCwgXy5ibikodGhpcy5WLCB0aGlzKSk7CiAgICAgICAgICAgICAgICB0aGlzLm0uY29ubmVjdCgoMCwgXy5ibikodGhpcy5yYywgdGhpcykpOwogICAgICAgICAgICAgICAgdmFyIGcgPSBjQig0MTUsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBiLmogJiYgKGIuai5uYW1lID0gJycsIGEuUWMgJiYgYS5RYygpLCBfLkxjKGIuaiwgJ2xvYWQnLCBnKSk7CiAgICAgICAgICAgICAgICB9LCBhLnphKTsKICAgICAgICAgICAgICAgIF8uZmIodGhpcy5qLCAnbG9hZCcsIGcpOwogICAgICAgICAgICAgICAgdGhpcy5rYyA9IGNCKDQxMywgdGhpcy5rYywgYS56YSk7CiAgICAgICAgICAgICAgICB0aGlzLnpjID0gY0IoNDE3LCB0aGlzLnpjLCBhLnphKTsKICAgICAgICAgICAgICAgIHRoaXMuQWMgPSBjQig0MTksIHRoaXMuQWMsIGEuemEpOwogICAgICAgICAgICAgICAgdGhpcy5iYyA9IGNCKDQxMSwgdGhpcy5iYywgYS56YSk7CiAgICAgICAgICAgICAgICB0aGlzLlliID0gY0IoNDA5LCB0aGlzLlliLCBhLnphKTsKICAgICAgICAgICAgICAgIHRoaXMuViA9IGNCKDQxMCwgdGhpcy5WLCBhLnphKTsKICAgICAgICAgICAgICAgIHRoaXMucmMgPSBjQig0MTYsIHRoaXMucmMsIGEuemEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oYWosIEtBKTsKICAgICAgICAgICAgdmFyIGVCID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBhLmlhID8gKGIuc3R5bGUud2lkdGggPSBfLiRyKCcxMDAlJywgITApLCBiLnN0eWxlLmhlaWdodCA9IF8uJHIoJ2F1dG8nLCAhMCkpIDogKGIuc3R5bGUud2lkdGggPSBfLiRyKGMud2lkdGgsICEwKSwgYi5zdHlsZS5oZWlnaHQgPSBfLiRyKGMuaGVpZ2h0LCAhMCkpOwogICAgICAgICAgICAgICAgfSwgZkIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjLCBkID0gYi5wYiA/ICcnIDogbnVsbCAhPSAoYyA9IGIuY29udGVudCkgPyBjIDogJyc7CiAgICAgICAgICAgICAgICAgICAgYyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZl92ZXI6IGEuSiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNrX29uOiBWdSgpID8gMSA6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGFzaF92ZXI6ICcwJwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGEuSiArICc7JyArIGQubGVuZ3RoICsgJzsnICsgZCArIG5ldyBOQShhLkEsIGEudGEsIGEuZGEsIGEuZ2EsIG5ldyBMQShjKSwgYS5pYSwgYS54YSwgYS5aLCBhLnJhLCBhLkxhKS5YKCk7CiAgICAgICAgICAgICAgICAgICAgYyA9ICExID09PSBiLmRkOwogICAgICAgICAgICAgICAgICAgIGlmIChhLlkgJiYgYi5zaXplIGluc3RhbmNlb2YgXy5VaSkgewogICAgICAgICAgICAgICAgICAgICAgICBkID0gVmQoYi5TYSkgPyAnaHR0cHM6Ly9zZWN1cmVmcmFtZS5kb3VibGVjbGljay5uZXQnIDogXy5UcShfLk1xKGEubCkpLmxvY2F0aW9uLnByb3RvY29sICsgYS5OOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IF8uVHEoXy5NcShhLmwpKSwgZyA9IGIuTGMsIGggPSBiLnNpemU7CiAgICAgICAgICAgICAgICAgICAgICAgIFR2IHx8IGRpKGYuZG9jdW1lbnQsIFV2KTsKICAgICAgICAgICAgICAgICAgICAgICAgVHYrKzsKICAgICAgICAgICAgICAgICAgICAgICAgZi5nb29nbGVfZWFzX3F1ZXVlID0gZi5nb29nbGVfZWFzX3F1ZXVlIHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBmLmdvb2dsZV9lYXNfcXVldWUucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhOiBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYjogZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGM6IGgud2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkOiBoLmhlaWdodCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGU6ICdzZi1nZG4tZXhwLScgKyBUdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGY6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGc6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGg6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGk6IHZvaWQgMAogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZCA9IF8uSChSaSkgPyAnM3JkIHBhcnR5IGFkIGNvbnRlbnQnIDogJyc7CiAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSBiLnNpemU7CiAgICAgICAgICAgICAgICAgICAgZyA9IGIuUmI7CiAgICAgICAgICAgICAgICAgICAgaCA9IGIuSmQgfHwgZDsKICAgICAgICAgICAgICAgICAgICBkID0gYi5DYjsKICAgICAgICAgICAgICAgICAgICBmID0gdm9pZCAwID09PSBiLnBiOwogICAgICAgICAgICAgICAgICAgIHZhciBsID0gay53aWR0aDsKICAgICAgICAgICAgICAgICAgICBrID0gay5oZWlnaHQ7CiAgICAgICAgICAgICAgICAgICAgYS5pYSAmJiAoayA9IGwgPSAwKTsKICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IHt9OwogICAgICAgICAgICAgICAgICAgIGUgPSAobS5pZCA9IGIuTGMsIG0udGl0bGUgPSBoLCBtLm5hbWUgPSBlLCBtLnNjcm9sbGluZyA9ICdubycsIG0ubWFyZ2luV2lkdGggPSAnMCcsIG0ubWFyZ2luSGVpZ2h0ID0gJzAnLCBtLndpZHRoID0gU3RyaW5nKGwpLCBtLmhlaWdodCA9IFN0cmluZyhrKSwgbVsnZGF0YS1pcy1zYWZlZnJhbWUnXSA9ICd0cnVlJywgbSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IF8uVHEoXy5NcShhLmwpKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFZkKGEuWikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gJ2h0dHBzOi8vc2VjdXJlZnJhbWUuZG91YmxlY2xpY2submV0L2NvbnRhaW5lci5odG1sP2Vjcz0nICsgZzsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gYS5uYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBhLk47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAobCA9IGcpICYmIChsID0gJz8nICsgbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gKHZvaWQgMCA9PT0gaCA/ICcvL3RwYy5nb29nbGVzeW5kaWNhdGlvbi5jb20nIDogaCkgKyAoJy9zYWZlZnJhbWUvJyArIGEuSiArICcvaHRtbC9jb250YWluZXIuaHRtbCcgKyBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChrID0gMDsgbCAhPSBsLnBhcmVudDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaysrLCBsID0gbC5wYXJlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAobCA9IGspICYmIChoICs9IChnID8gJyYnIDogJz8nKSArICduPScgKyBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAoYyB8fCBqcihmLCAhMSkgPyAnaHR0cHM6JyA6ICdodHRwOicpICsgaDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBnID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGEuWSAmJiAoaCA9IGtyKGYubG9jYXRpb24uaHJlZiksIGYgPSBnLnB1c2gsIGggPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwIDwgaC5sZW5ndGggPyAnZ29vZ2xlX2RlYnVnJyArIChoID8gJz0nICsgaCA6ICcnKSArICcmJyA6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3hwYz0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NmLWdkbi1leHAtJyArIGEuQSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcmcD0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2RlVVJJQ29tcG9uZW50KF8uci5kb2N1bWVudC5sb2NhdGlvbi5wcm90b2NvbCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLy8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2RlVVJJQ29tcG9uZW50KF8uci5kb2N1bWVudC5sb2NhdGlvbi5ob3N0KQogICAgICAgICAgICAgICAgICAgICAgICBdLmpvaW4oJycpLCBmLmNhbGwoZywgaCkpOwogICAgICAgICAgICAgICAgICAgICAgICBnLmxlbmd0aCAmJiAoYyArPSAnIycgKyBnLmpvaW4oJyYnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUuc3JjID0gYzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gYS5lYSAmJiAoZS5zYW5kYm94ID0gYS5lYSk7CiAgICAgICAgICAgICAgICAgICAgZCAmJiAoZS5hbGxvdyA9IGQpOwogICAgICAgICAgICAgICAgICAgIF8uSChSaSkgJiYgKGUucm9sZSA9ICdyZWdpb24nLCBlWydhcmlhLWxhYmVsJ10gPSAnQWR2ZXJ0aXNlbWVudCcsIGUudGFiSW5kZXggPSAnMCcpOwogICAgICAgICAgICAgICAgICAgIGIucGIgPyAoYS5qID0gYi5wYiwgUHEoYS5qLCBlKSkgOiAoYiA9IHt9LCBiID0gKGIuZnJhbWVib3JkZXIgPSAwLCBiLmFsbG93VHJhbnNwYXJlbmN5ID0gJ3RydWUnLCBiLnN0eWxlID0gJ2JvcmRlcjowO3ZlcnRpY2FsLWFsaWduOmJvdHRvbTsnLCBiLnNyYyA9ICdhYm91dDpibGFuaycsIGIpLCBlICYmIHlhKGIsIGUpLCBkID0gXy5PaSgnSUZSQU1FJyksIFBxKGQsIGIpLCBhLmogPSBkKTsKICAgICAgICAgICAgICAgICAgICBhLmlhICYmIChhLmouc3R5bGUubWluV2lkdGggPSAnMTAwJScpOwogICAgICAgICAgICAgICAgICAgIGEubC5hcHBlbmRDaGlsZChhLmopOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgcCA9IGFqLnByb3RvdHlwZTsKICAgICAgICAgICAgcC5yYyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMuQiAmJiB0aGlzLmogPyB0aGlzLkIub2JzZXJ2ZSh0aGlzLmopIDogKF8uZmIod2luZG93LCAncmVzaXplJywgdGhpcy5UKSwgXy5mYih3aW5kb3csICdzY3JvbGwnLCB0aGlzLlQpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5rYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGlmICgwICE9IHRoaXMuc3RhdHVzKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignQ29udGFpbmVyIGFscmVhZHkgaW5pdGlhbGl6ZWQnKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT09IHR5cGVvZiBhKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignQ291bGQgbm90IHBhcnNlIHNlcmlhbGl6ZWQgbWVzc2FnZScpOwogICAgICAgICAgICAgICAgICAgIHZhciBiID0gSlNPTi5wYXJzZShhKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIV8uamEoYikgfHwgIVVkKGIudWlkKSB8fCAnc3RyaW5nJyAhPT0gdHlwZW9mIGIudmVyc2lvbikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0Nhbm5vdCBwYXJzZSBKU09OIG1lc3NhZ2UnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG5ldyBQQShiLnVpZCwgYi52ZXJzaW9uLCBiLnNlbnRpbmVsKTsKICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5BICE9PSBjLmogfHwgdGhpcy5KICE9PSBjLnZlcnNpb24pCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdXcm9uZyBzb3VyY2UgY29udGFpbmVyJyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zdGF0dXMgPSAxOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBkOwogICAgICAgICAgICAgICAgICAgIG51bGwgPT0gKGQgPSB0aGlzLm8pIHx8IGQuZXJyb3IoJ0ludmFsaWQgSU5JVElBTElaRV9ET05FIG1lc3NhZ2UuIFJlYXNvbjogJyArIGUubWVzc2FnZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuemMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoMSAhPSB0aGlzLnN0YXR1cykKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0NvbnRhaW5lciBub3QgaW5pdGlhbGl6ZWQnKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT09IHR5cGVvZiBhKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignQ291bGQgbm90IHBhcnNlIHNlcmlhbGl6ZWQgbWVzc2FnZScpOwogICAgICAgICAgICAgICAgICAgIHZhciBiID0gSlNPTi5wYXJzZShhKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIV8uamEoYikgfHwgIVVkKGIudWlkKSB8fCAnbnVtYmVyJyAhPT0gdHlwZW9mIGIuaW5pdGlhbFdpZHRoIHx8ICdudW1iZXInICE9PSB0eXBlb2YgYi5pbml0aWFsSGVpZ2h0KQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignQ2Fubm90IHBhcnNlIEpTT04gbWVzc2FnZScpOwogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLkEgIT09IG5ldyBRQShiLnVpZCwgYi5pbml0aWFsV2lkdGgsIGIuaW5pdGlhbEhlaWdodCwgYi5zZW50aW5lbCkuaikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1dyb25nIHNvdXJjZSBjb250YWluZXInKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXR1cyA9IDI7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSAoYyA9IHRoaXMubykgfHwgYy5lcnJvcignSW52YWxpZCBSRUdJU1RFUl9ET05FIG1lc3NhZ2UuIFJlYXNvbjogJyArIGQubWVzc2FnZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuQWMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT09IHR5cGVvZiBhKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignQ291bGQgbm90IHBhcnNlIHNlcmlhbGl6ZWQgbWVzc2FnZScpOwogICAgICAgICAgICAgICAgICAgIHZhciBiID0gSlNPTi5wYXJzZShhKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIV8uamEoYikgfHwgIVVkKGIudWlkKSB8fCAnc3RyaW5nJyAhPT0gdHlwZW9mIGIuZGVzY3JpcHRpb24pCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdDYW5ub3QgcGFyc2UgSlNPTiBtZXNzYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgUkEoYi51aWQsIGIuZGVzY3JpcHRpb24sIGIuc2VudGluZWwpOwogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLkEgIT09IGMuaikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1dyb25nIHNvdXJjZSBjb250YWluZXInKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZDsKICAgICAgICAgICAgICAgICAgICBudWxsID09IChkID0gdGhpcy5vKSB8fCBkLmluZm8oJ0V4dCByZXBvcnRlZCBhbiBlcnJvci4gRGVzY3JpcHRpb246ICcgKyBjLmRlc2NyaXB0aW9uKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGYpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZTsKICAgICAgICAgICAgICAgICAgICBudWxsID09IChlID0gdGhpcy5vKSB8fCBlLmVycm9yKCdJbnZhbGlkIFJFUE9SVF9FUlJPUiBtZXNzYWdlLiBSZWFzb246ICcgKyBmLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBwLmJjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDIgIT0gdGhpcy5zdGF0dXMpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdDb250YWluZXIgaXMgbm90IHJlZ2lzdGVyZWQnKTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCAhPSB0aGlzLlIpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdDb250YWluZXIgaXMgbm90IGNvbGxhcHNlZCcpOwogICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPT0gdHlwZW9mIGEpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdDb3VsZCBub3QgcGFyc2Ugc2VyaWFsaXplZCBtZXNzYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBKU09OLnBhcnNlKGEpOwogICAgICAgICAgICAgICAgICAgIGlmICghXy5qYShiKSB8fCAhVWQoYi51aWQpIHx8ICdudW1iZXInICE9PSB0eXBlb2YgYi5leHBhbmRfdCB8fCAnbnVtYmVyJyAhPT0gdHlwZW9mIGIuZXhwYW5kX3IgfHwgJ251bWJlcicgIT09IHR5cGVvZiBiLmV4cGFuZF9iIHx8ICdudW1iZXInICE9PSB0eXBlb2YgYi5leHBhbmRfbCB8fCAnYm9vbGVhbicgIT09IHR5cGVvZiBiLnB1c2gpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdDYW5ub3QgcGFyc2UgSlNPTiBtZXNzYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgU0EoYi51aWQsIG5ldyBfLkdyKGIuZXhwYW5kX3QsIGIuZXhwYW5kX3IsIGIuZXhwYW5kX2IsIGIuZXhwYW5kX2wpLCBiLnB1c2gsIGIuc2VudGluZWwpOwogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLkEgIT09IGMuaikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1dyb25nIHNvdXJjZSBjb250YWluZXInKTsKICAgICAgICAgICAgICAgICAgICBpZiAoISgwIDw9IGMubS50b3AgJiYgMCA8PSBjLm0ubGVmdCAmJiAwIDw9IGMubS5ib3R0b20gJiYgMCA8PSBjLm0ucmlnaHQpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignSW52YWxpZCBleHBhbnNpb24gYW1vdW50cycpOwogICAgICAgICAgICAgICAgICAgIHZhciBkOwogICAgICAgICAgICAgICAgICAgIGlmIChkID0gYy5wdXNoICYmIHRoaXMuZ2EuQWIgfHwgIWMucHVzaCAmJiB0aGlzLmdhLnpiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYy5tLCBmID0gYy5wdXNoLCBnID0gdGhpcy5EID0gSkEodGhpcy5qKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUudG9wIDw9IGcuai50b3AgJiYgZS5yaWdodCA8PSBnLmoucmlnaHQgJiYgZS5ib3R0b20gPD0gZy5qLmJvdHRvbSAmJiBlLmxlZnQgPD0gZy5qLmxlZnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBoID0gdGhpcy5qLnBhcmVudE5vZGU7IGggJiYgaC5zdHlsZTsgaCA9IGgucGFyZW50Tm9kZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWkEodGhpcy5GLCBoLCAnb3ZlcmZsb3dYJywgJ3Zpc2libGUnLCAnaW1wb3J0YW50JyksIFpBKHRoaXMuRiwgaCwgJ292ZXJmbG93WScsICd2aXNpYmxlJywgJ2ltcG9ydGFudCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSBKcihuZXcgSXIoMCwgMCwgdGhpcy5ELm0uZ2V0V2lkdGgoKSwgdGhpcy5ELm0uZ2V0SGVpZ2h0KCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8uamEoZSkgPyAoay50b3AgLT0gZS50b3AsIGsucmlnaHQgKz0gZS5yaWdodCwgay5ib3R0b20gKz0gZS5ib3R0b20sIGsubGVmdCAtPSBlLmxlZnQpIDogKGsudG9wIC09IGUsIGsucmlnaHQgKz0gTnVtYmVyKHZvaWQgMCksIGsuYm90dG9tICs9IE51bWJlcih2b2lkIDApLCBrLmxlZnQgLT0gTnVtYmVyKHZvaWQgMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgWkEodGhpcy5GLCB0aGlzLmwsICdwb3NpdGlvbicsICdyZWxhdGl2ZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgWkEodGhpcy5GLCB0aGlzLmosICdwb3NpdGlvbicsICdhYnNvbHV0ZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA/ICgkQSh0aGlzLkYsIHRoaXMubCwgJ3dpZHRoJywgay5nZXRXaWR0aCgpKSwgJEEodGhpcy5GLCB0aGlzLmwsICdoZWlnaHQnLCBrLmdldEhlaWdodCgpKSkgOiBaQSh0aGlzLkYsIHRoaXMuaiwgJ3pJbmRleCcsICcxMDAwMCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJEEodGhpcy5GLCB0aGlzLmosICd3aWR0aCcsIGsuZ2V0V2lkdGgoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkQSh0aGlzLkYsIHRoaXMuaiwgJ2hlaWdodCcsIGsuZ2V0SGVpZ2h0KCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJEEodGhpcy5GLCB0aGlzLmosICdsZWZ0Jywgay5sZWZ0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICRBKHRoaXMuRiwgdGhpcy5qLCAndG9wJywgay50b3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5SID0gMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuRCA9IEpBKHRoaXMuaik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9ICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBhID0gZDsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0uc2VuZCgnZXhwYW5kX3Jlc3BvbnNlJywgbmV3IFZBKHRoaXMuQSwgYSwgdGhpcy5ELCBjLm0sIGMucHVzaCkuWCgpKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIWEpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdWaWV3cG9ydCBvciBkb2N1bWVudCBib2R5IG5vdCBsYXJnZSBlbm91Z2ggdG8gZXhwYW5kIGludG8uJyk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChtKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGw7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSAobCA9IHRoaXMubykgfHwgbC5lcnJvcignSW52YWxpZCBFWFBBTkRfUkVRVUVTVCBtZXNzYWdlLiBSZWFzb246ICcgKyBtLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBwLlliID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDIgIT0gdGhpcy5zdGF0dXMpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdDb250YWluZXIgaXMgbm90IHJlZ2lzdGVyZWQnKTsKICAgICAgICAgICAgICAgICAgICBpZiAoMiAhPSB0aGlzLlIpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdDb250YWluZXIgaXMgbm90IGV4cGFuZGVkJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9PSB0eXBlb2YgYSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0NvdWxkIG5vdCBwYXJzZSBzZXJpYWxpemVkIG1lc3NhZ2UnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IEpTT04ucGFyc2UoYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFfLmphKGIpIHx8ICFVZChiLnVpZCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdDYW5ub3QgcGFyc2UgSlNPTiBtZXNzYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuQSAhPT0gbmV3IFRBKGIudWlkLCBiLnNlbnRpbmVsKS5qKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignV3Jvbmcgc291cmNlIGNvbnRhaW5lcicpOwogICAgICAgICAgICAgICAgICAgIGFCKHRoaXMuRik7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5SID0gMDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogJiYgKHRoaXMuRCA9IEpBKHRoaXMuaikpOwogICAgICAgICAgICAgICAgICAgIHRoaXMubS5zZW5kKCdjb2xsYXBzZV9yZXNwb25zZScsIG5ldyBVQSh0aGlzLkEsIHRoaXMuRCkuWCgpKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgICAgICBudWxsID09IChjID0gdGhpcy5vKSB8fCBjLmVycm9yKCdJbnZhbGlkIENPTExBUFNFX1JFUVVFU1QgbWVzc2FnZS4gUmVhc29uOiAnICsgZC5tZXNzYWdlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGdCID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmICgxID09IGEuc3RhdHVzIHx8IDIgPT0gYS5zdGF0dXMpCiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChhLk0pIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgIGhCKGEpOwogICAgICAgICAgICAgICAgICAgICAgICBhLkcgPSB3aW5kb3cuc2V0VGltZW91dCgoMCwgXy5ibikoYS4kLCBhKSwgMTAwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuTSA9IDE7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgYS5NID0gMjsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICBhLk0gPSAyOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgYWoucHJvdG90eXBlLlYgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT09IHR5cGVvZiBhKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignQ291bGQgbm90IHBhcnNlIHNlcmlhbGl6ZWQgbWVzc2FnZScpOwogICAgICAgICAgICAgICAgICAgIHZhciBiID0gSlNPTi5wYXJzZShhKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIV8uamEoYikgfHwgIVVkKGIudWlkKSB8fCAnbnVtYmVyJyAhPT0gdHlwZW9mIGIud2lkdGggfHwgJ251bWJlcicgIT09IHR5cGVvZiBiLmhlaWdodCB8fCBiLnNlbnRpbmVsICYmICdzdHJpbmcnICE9PSB0eXBlb2YgYi5zZW50aW5lbCkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0Nhbm5vdCBwYXJzZSBKU09OIG1lc3NhZ2UnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG5ldyBXQShiLnVpZCwgYi53aWR0aCwgYi5oZWlnaHQsIGIuc2VudGluZWwpOwogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLkEgIT09IGMuaikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1dyb25nIHNvdXJjZSBjb250YWluZXInKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IFN0cmluZyhjLmhlaWdodCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuaWEpCiAgICAgICAgICAgICAgICAgICAgICAgIGQgIT09IHRoaXMuai5oZWlnaHQgJiYgKHRoaXMuai5oZWlnaHQgPSBkLCBnQih0aGlzKSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlOwogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09IChlID0gdGhpcy5vKSB8fCBlLmVycm9yKCdHb3QgQ3JlYXRpdmVHZW9tZXRyeVVwZGF0ZSBtZXNzYWdlIGluIG5vbi1mbHVpZGNvbnRhaW5lci4gVGhlIGNvbnRhaW5lciBpcyBub3QgcmVzaXplZC4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGNhdGNoIChnKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGY7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSAoZiA9IHRoaXMubykgfHwgZi5lcnJvcignSW52YWxpZCBDUkVBVElWRV9HRU9NRVRSWV9VUERBVEUgbWVzc2FnZS4gUmVhc29uOiAnICsgZy5tZXNzYWdlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgYWoucHJvdG90eXBlLiQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBpZiAoMSA9PSB0aGlzLnN0YXR1cyB8fCAyID09IHRoaXMuc3RhdHVzKQogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpcy5NKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLk0gPSAwOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgIGhCKHRoaXMpLCB0aGlzLkcgPSB3aW5kb3cuc2V0VGltZW91dCgoMCwgXy5ibikodGhpcy4kLCB0aGlzKSwgMTAwMCksIHRoaXMuTSA9IDE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaEIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEuRCA9IEpBKGEuaiwgYS5hYSk7CiAgICAgICAgICAgICAgICAgICAgYS5hYSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgYS5tLnNlbmQoJ2dlb21ldHJ5X3VwZGF0ZScsIG5ldyBVQShhLkEsIGEuRCkuWCgpKTsKICAgICAgICAgICAgICAgIH0sIGRCID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgYS5ZYyAmJiAoYiA9IGEuWWMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGIgPyBudWxsIDogYi5qb2luKCcgJyk7CiAgICAgICAgICAgICAgICB9LCBpQiA9IFsKICAgICAgICAgICAgICAgICAgICAnYWxsb3ctbW9kYWxzJywKICAgICAgICAgICAgICAgICAgICAnYWxsb3ctb3JpZW50YXRpb24tbG9jaycsCiAgICAgICAgICAgICAgICAgICAgJ2FsbG93LXByZXNlbnRhdGlvbicsCiAgICAgICAgICAgICAgICAgICAgJ2FsbG93LXBvaW50ZXItbG9jaycKICAgICAgICAgICAgICAgIF0sIGpCID0gWydhbGxvdy10b3AtbmF2aWdhdGlvbiddLCBrQiA9IFsnYWxsb3ctc2FtZS1vcmlnaW4nXSwgbEIgPSBucihbXS5jb25jYXQoXy5sYyhpQiksIF8ubGMoakIpKSk7CiAgICAgICAgICAgIG5yKFtdLmNvbmNhdChfLmxjKGlCKSwgXy5sYyhrQikpKTsKICAgICAgICAgICAgbnIoW10uY29uY2F0KF8ubGMoaUIpLCBfLmxjKGpCKSwgXy5sYyhrQikpKTsKICAgICAgICAgICAgdmFyIG1CID0gUChbCiAgICAgICAgICAgICAgICAgICAgJ2h0dHBzOi8vdHBjLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9zYWZlZnJhbWUvJywKICAgICAgICAgICAgICAgICAgICAnL2h0bWwvY29udGFpbmVyLmh0bWwnCiAgICAgICAgICAgICAgICBdKSwgbkIgPSBQKFsnaHR0cHM6Ly9zZWN1cmVmcmFtZS5kb3VibGVjbGljay5uZXQvY29udGFpbmVyLmh0bWwnXSksIG9CID0gewogICAgICAgICAgICAgICAgICAgIFJkOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT09IHR5cGVvZiBhLnZlcnNpb24pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCd2ZXJzaW9uIGlzIG5vdCBhIHN0cmluZycpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIS9eWzAtOV0rLVswLTldKy1bMC05XSskLy50ZXN0KGEudmVyc2lvbikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcignSW52YWxpZCB2ZXJzaW9uOiAnICsgYS52ZXJzaW9uKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9PSB0eXBlb2YgYS5UYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ3N1YmRvbWFpbiBpcyBub3QgYSBzdHJpbmcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEvXlthLXowLTldKFthLXowLTktXXswLDYxfVthLXowLTldKT8kLy50ZXN0KGEuVGIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoJ0ludmFsaWQgc3ViZG9tYWluOiAnICsgYS5UYik7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRYSgnaHR0cHM6Ly8nICsgYS5UYiArICcuc2FmZWZyYW1lLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9zYWZlZnJhbWUvJyArIGEudmVyc2lvbiArICcvaHRtbC9jb250YWluZXIuaHRtbCcpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgU2Y6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKG1CLCBhKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIFJmOiBBKG5CKQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFdkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgcmIoWWwoYSwgYikpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgcEIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8ocEIsIFEpOwogICAgICAgICAgICB2YXIgcUIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgWm8oYiwgYSwgNCk7CiAgICAgICAgICAgICAgICBabyhiLCBhLCAyKTsKICAgICAgICAgICAgICAgIFpvKGIsIGEsIDEpOwogICAgICAgICAgICAgICAgWm8oYiwgYSwgMyk7CiAgICAgICAgICAgICAgICBKbyhiLCA1LCBHKGEsIDUpKTsKICAgICAgICAgICAgICAgIFhvKGEsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgckIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBzQiA9IFsKICAgICAgICAgICAgICAgICAgICAwLjA1LAogICAgICAgICAgICAgICAgICAgIDAuMSwKICAgICAgICAgICAgICAgICAgICAwLjIsCiAgICAgICAgICAgICAgICAgICAgMC41CiAgICAgICAgICAgICAgICBdLCB0QiA9IFsKICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgIDAuNSwKICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICBdLCB1QiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IFZjKGEpOwogICAgICAgICAgICAgICAgICAgIGlmICghYSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gJHYoYS5kb2N1bWVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IF8uVWkoYi5jbGllbnRXaWR0aCwgYi5jbGllbnRIZWlnaHQpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IG5ldyBfLlVpKC0xMjI0NTkzMywgLTEyMjQ1OTMzKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xMjI0NTkzMyA9PSBjLndpZHRoIHx8IC0xMjI0NTkzMyA9PSBjLmhlaWdodCA/IC0xIDogYy53aWR0aCAqIGMuaGVpZ2h0OwogICAgICAgICAgICAgICAgfSwgdkIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAwID4gYSA/IFtdIDogXy5BZChzQiwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWluKGEgLyBiICogYywgMSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCB5QiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gYS5JOwogICAgICAgICAgICAgICAgICAgIHRoaXMuRiA9IGEuUmE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5NID0gYS5XYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkEgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHRoaXMuRCA9IGEuemE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tID0gd0IodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5CID0gYS5yZSB8fCAhMTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm8gPSBhLlRmIHx8ICExOwogICAgICAgICAgICAgICAgICAgIHRoaXMubCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5vICYmIHhCKHRoaXMpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgeUIucHJvdG90eXBlLmdldFNsb3RJZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLkE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBBQiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEubSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBhLkEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgekIoYSwgTWF0aC5yb3VuZChwZXJmb3JtYW5jZS5ub3coKSksIDAsIDAsIDAsICExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLkQgJiYgYS5EKGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5tICYmIGEubS51bm9ic2VydmUoYS5GKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYS5BID0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgYS5tLm9ic2VydmUoYS5GKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEubykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IE1hdGgucm91bmQocGVyZm9ybWFuY2Uubm93KCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLkYuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCksIGQgPSBjLndpZHRoICogYy5oZWlnaHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZUEoYS5qLmRvY3VtZW50KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gVmMoYS5qKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gJHYoZS5kb2N1bWVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBNYXRoLm1pbihmLmNsaWVudFdpZHRoLCBjLmxlZnQgKyBjLndpZHRoKSAtIE1hdGgubWF4KDAsIGMubGVmdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBNYXRoLm1pbihmLmNsaWVudEhlaWdodCwgYy50b3AgKyBjLmhlaWdodCkgLSBNYXRoLm1heCgwLCBjLnRvcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSAwIDwgZSAmJiAwIDwgYyA/IGUgKiBjIDogMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmwgPSBuZXcgckIoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWU6IGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWY6IDAgPCBkID8gYyAvIGQgPiAoMjQyNTAwIDwgZCA/IDAuMyA6IDAuNSkgOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZjogMSA9PSBiQShhLmouZG9jdW1lbnQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHdCID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEuRi5vZmZzZXRXaWR0aCAqIGEuRi5vZmZzZXRIZWlnaHQsIGMgPSB1QihhLmopOwogICAgICAgICAgICAgICAgICAgIGIgPSBbXS5jb25jYXQoXy5sYyh0QiksIF8ubGModkIoYywgYikpKTsKICAgICAgICAgICAgICAgICAgICBtYShiKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gXy5yLkludGVyc2VjdGlvbk9ic2VydmVyID8gbmV3IF8uci5JbnRlcnNlY3Rpb25PYnNlcnZlcihmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQkIoYSwgZCk7CiAgICAgICAgICAgICAgICAgICAgfSwgeyB0aHJlc2hvbGQ6IGIgfSkgOiBuZXcgbGooZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJCKGEsIGQpOwogICAgICAgICAgICAgICAgICAgIH0sIHsgdGhyZXNob2xkOiBiIH0pOwogICAgICAgICAgICAgICAgfSwgQkIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gdUIoYS5qKTsKICAgICAgICAgICAgICAgICAgICAgICAgXy5obihiLCBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBNYXRoLnJvdW5kKGQudGltZSksIGYgPSBkLmJvdW5kaW5nQ2xpZW50UmVjdC53aWR0aCAqIGQuYm91bmRpbmdDbGllbnRSZWN0LmhlaWdodCwgZyA9IGQuaW50ZXJzZWN0aW9uUmVjdC53aWR0aCAqIGQuaW50ZXJzZWN0aW9uUmVjdC5oZWlnaHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gZC5pc0ludGVyc2VjdGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuQiAmJiB6QihhLCBlLCBmLCBnLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICBhLkQgJiYgYS5EKGQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHpCID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBhLkEpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdOb3QgQXR0YWNoZWQuJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBuZXcgcEIoKTsKICAgICAgICAgICAgICAgICAgICBjID0gdyhnLCAxLCBjKTsKICAgICAgICAgICAgICAgICAgICBkID0gdyhjLCAyLCBkKTsKICAgICAgICAgICAgICAgICAgICBlID0gdyhkLCAzLCBlKTsKICAgICAgICAgICAgICAgICAgICBiID0gdyhlLCA0LCBiKTsKICAgICAgICAgICAgICAgICAgICBmID0gdyhiLCA1LCBmKTsKICAgICAgICAgICAgICAgICAgICBmID0gRWIoWW8oZiwgcUIpLCA0KTsKICAgICAgICAgICAgICAgICAgICBRZShhLk0sICcxJywgMTAsIGYsIHZvaWQgMCwgYS5BKTsKICAgICAgICAgICAgICAgIH0sIHhCID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGRBKGEuai5kb2N1bWVudCk7CiAgICAgICAgICAgICAgICAgICAgYiAmJiBfLmZiKGEuai5kb2N1bWVudCwgYiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBhLmwgJiYgYkEoYS5qLmRvY3VtZW50KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBDQiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSBiOwogICAgICAgICAgICAgICAgfSwgREIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGlmIChhLmouZnJhbWVzLmdvb2dsZV9hZHNfdG9wX2ZyYW1lKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBycignZ29vZ2xlX2Fkc190b3BfZnJhbWUnLCBhLmopOwogICAgICAgICAgICAgICAgICAgIGIgPSBiICYmIGIuY29udGVudFdpbmRvdzsKICAgICAgICAgICAgICAgICAgICBpZiAoIWIpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBiLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGMucG9ydHM7CiAgICAgICAgICAgICAgICAgICAgICAgICdfX2dvb2dfdG9wX3VybF9yZXEnID09PSBjLmRhdGEubXNnVHlwZSAmJiBkLmxlbmd0aCAmJiBkWzBdLnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1zZ1R5cGU6ICdfX2dvb2dfdG9wX3VybF9yZXNwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvcFVybDogYS5tCiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sICExKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgRUIgPSB7CiAgICAgICAgICAgICAgICAgICAgaXNzdWVyT3JpZ2luOiAnaHR0cHM6Ly9hdHRlc3RhdGlvbi5hbmRyb2lkLmNvbScsCiAgICAgICAgICAgICAgICAgICAgaXNzdWFuY2VQYXRoOiAnL2F0dC9pJywKICAgICAgICAgICAgICAgICAgICByZWRlbXB0aW9uUGF0aDogJy9hdHQvcicKICAgICAgICAgICAgICAgIH0sIEZCID0gewogICAgICAgICAgICAgICAgICAgIGlzc3Vlck9yaWdpbjogJ2h0dHBzOi8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20nLAogICAgICAgICAgICAgICAgICAgIGlzc3VhbmNlUGF0aDogJy9kdHQvaScsCiAgICAgICAgICAgICAgICAgICAgcmVkZW1wdGlvblBhdGg6ICcvZHR0L3InLAogICAgICAgICAgICAgICAgICAgIGdldFN0YXRlUGF0aDogJy9kdHQvcycKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBHQiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdm9pZCAwID09PSBhID8gd2luZG93IDogYTsKICAgICAgICAgICAgICAgIGEgPSBhLm5hdmlnYXRvci51c2VyQWdlbnQ7CiAgICAgICAgICAgICAgICB2YXIgYiA9IC9DaHJvbWUvLnRlc3QoYSk7CiAgICAgICAgICAgICAgICByZXR1cm4gL0FuZHJvaWQvLnRlc3QoYSkgJiYgYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWWkoY3UpOwogICAgICAgICAgICB2YXIgSEIgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgYSA9IHZvaWQgMCA9PT0gYSA/ICExIDogYTsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyAhMSA6IGI7CiAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gITEgOiBjOwogICAgICAgICAgICAgICAgXy5ndS5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdmFyIGQgPSB0aGlzOwogICAgICAgICAgICAgICAgdGhpcy5qID0gYTsKICAgICAgICAgICAgICAgIGEgPSBbXTsKICAgICAgICAgICAgICAgIGIgJiYgR0IoKSAmJiBhLnB1c2goRUIpOwogICAgICAgICAgICAgICAgYyAmJiBhLnB1c2goRkIpOwogICAgICAgICAgICAgICAgaWYgKGRvY3VtZW50Lmhhc1RydXN0VG9rZW4gJiYgIV8uSChadCkgJiYgIUFycmF5LmlzQXJyYXkod2luZG93Lmdvb2dfdHRfc3RhdGUpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhLm1hcChmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNzdWVyT3JpZ2luOiBmLmlzc3Vlck9yaWdpbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiBkLmogPyAxIDogMTIKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkod2luZG93LCAnZ29vZ190dF9zdGF0ZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zbGljZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhIQiwgXy5ndSk7CiAgICAgICAgICAgIHZhciBJQiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHdpbmRvdzsKICAgICAgICAgICAgICAgICAgICBhID0gdm9pZCAwID09PSBhID8gd2luZG93IDogYTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWEuUGVyaW9kaWNTeW5jTWFuYWdlcjsKICAgICAgICAgICAgICAgIH0sIEpCID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gdm9pZCAwID09PSBhID8gd2luZG93IDogYTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5nb29nX3R0X3N0YXRlOwogICAgICAgICAgICAgICAgfSwgS0IgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLnNvbWUoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIuaGFzUmVkZW1wdGlvblJlY29yZDsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIExCID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gd2luZG93LCBiID0gXy5iZlsxNTBdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBfLmJmWzIyMV0gfHwgJy5nb29nbGUuY2gnID09PSBiIHx8ICdmdW5jdGlvbicgPT09IHR5cGVvZiBhLl9fdGNmYXBpOwogICAgICAgICAgICAgICAgfSwgTUIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSBhLmZpbHRlcihmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5oYXNSZWRlbXB0aW9uUmVjb3JkOwogICAgICAgICAgICAgICAgICAgIH0pLm1hcChmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5pc3N1ZXJPcmlnaW47CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT0gYS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzZW5kLXJlZGVtcHRpb24tcmVjb3JkJywKICAgICAgICAgICAgICAgICAgICAgICAgaXNzdWVyczogYSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBvbGljeTogJ25vbmUnLAogICAgICAgICAgICAgICAgICAgICAgICBzaWduUmVxdWVzdERhdGE6ICdpbmNsdWRlJywKICAgICAgICAgICAgICAgICAgICAgICAgaW5jbHVkZVRpbWVzdGFtcEhlYWRlcjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGFkZGl0aW9uYWxTaWduZWRIZWFkZXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2VjLXRpbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1NlYy1SZWRlbXB0aW9uLVJlY29yZCcKICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYiAmJiAwIDwgXy50KE9iamVjdCwgJ2tleXMnKS5jYWxsKE9iamVjdCwgYikubGVuZ3RoICYmIChhLmFkZGl0aW9uYWxTaWduaW5nRGF0YSA9IHdvKEpTT04uc3RyaW5naWZ5KGIpLCAzKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9LCBOQiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBKQigpLCBjID0gXy5iZlsyNTJdOwogICAgICAgICAgICAgICAgICAgIGlmIChhLnNldFRydXN0VG9rZW4gJiYgYiAmJiBLQihiKSkKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gTUIoYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkICYmIGEuc2V0VHJ1c3RUb2tlbihkKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBPQiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQsIGUgPSBudWxsID09IChkID0gd2luZG93Lmdvb2dfdHRfc3RhdGUpID8gdm9pZCAwIDogXy50KGQsICdmaW5kJykuY2FsbChkLCBmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYuaXNzdWVyT3JpZ2luID09PSBhOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBlICYmIChlLnN0YXRlID0gYiwgdm9pZCAwICE9IGMgJiYgKGUuaGFzUmVkZW1wdGlvblJlY29yZCA9IGMpKTsKICAgICAgICAgICAgICAgIH0sIFBCID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gRUIuaXNzdWVyT3JpZ2luICsgRUIucmVkZW1wdGlvblBhdGgsIGIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwYWxpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ1c3RUb2tlbjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd0b2tlbi1yZWRlbXB0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc3N1ZXI6IEVCLmlzc3Vlck9yaWdpbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUG9saWN5OiAnbm9uZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBPQihFQi5pc3N1ZXJPcmlnaW4sIDIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuZmV0Y2goYSwgYikudGhlbihmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWMub2spCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihjLnN0YXR1cyArICc6IE5ldHdvcmsgcmVzcG9uc2Ugd2FzIG5vdCBvayEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgT0IoRUIuaXNzdWVyT3JpZ2luLCA2LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYyAmJiAnTm9Nb2RpZmljYXRpb25BbGxvd2VkRXJyb3InID09PSBjLm5hbWUgPyBPQihFQi5pc3N1ZXJPcmlnaW4sIDYsICEwKSA6IE9CKEVCLmlzc3Vlck9yaWdpbiwgNSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBRQiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IEVCLmlzc3Vlck9yaWdpbiArIEVCLmlzc3VhbmNlUGF0aDsKICAgICAgICAgICAgICAgICAgICBPQihFQi5pc3N1ZXJPcmlnaW4sIDgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuZmV0Y2goYSwgewogICAgICAgICAgICAgICAgICAgICAgICBrZWVwYWxpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB0cnVzdFRva2VuOiB7IHR5cGU6ICd0b2tlbi1yZXF1ZXN0JyB9CiAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWIub2spCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihiLnN0YXR1cyArICc6IE5ldHdvcmsgcmVzcG9uc2Ugd2FzIG5vdCBvayEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgT0IoRUIuaXNzdWVyT3JpZ2luLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQQigpOwogICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiICYmICdOb01vZGlmaWNhdGlvbkFsbG93ZWRFcnJvcicgPT09IGIubmFtZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPQihFQi5pc3N1ZXJPcmlnaW4sIDEwKSwgUEIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgT0IoRUIuaXNzdWVyT3JpZ2luLCA5KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIFJCID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIE9CKEVCLmlzc3Vlck9yaWdpbiwgMTMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkb2N1bWVudC5oYXNUcnVzdFRva2VuKEVCLmlzc3Vlck9yaWdpbikudGhlbihmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA/IFBCKCkgOiBRQigpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgU0IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgT0IoRkIuaXNzdWVyT3JpZ2luLCAxMyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHYuUHJvbWlzZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGRvY3VtZW50Lmhhc1RydXN0VG9rZW4oRkIuaXNzdWVyT3JpZ2luKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2LlByb21pc2UucmVqZWN0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IDE5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGIgPSBGQi5pc3N1ZXJPcmlnaW4gKyBGQi5yZWRlbXB0aW9uUGF0aCwgYyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwYWxpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRydXN0VG9rZW46IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3Rva2VuLXJlZGVtcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUG9saWN5OiAnbm9uZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBPQihGQi5pc3N1ZXJPcmlnaW4sIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5mZXRjaChiLCBjKS50aGVuKGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLm9rKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihmLnN0YXR1cyArICc6IE5ldHdvcmsgcmVzcG9uc2Ugd2FzIG5vdCBvayEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPQihGQi5pc3N1ZXJPcmlnaW4sIDE4LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmICYmICdOb01vZGlmaWNhdGlvbkFsbG93ZWRFcnJvcicgPT09IGYubmFtZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT0IoRkIuaXNzdWVyT3JpZ2luLCAxOCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2LlByb21pc2UucmVqZWN0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogMTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPQihGQi5pc3N1ZXJPcmlnaW4sIDE3KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuaGFzVHJ1c3RUb2tlbihGQi5pc3N1ZXJPcmlnaW4pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuUHJvbWlzZS5yZWplY3QoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogMTksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBGQi5pc3N1ZXJPcmlnaW4gKyBGQi5nZXRTdGF0ZVBhdGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPQihGQi5pc3N1ZXJPcmlnaW4sIDIwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuZmV0Y2goZiArICc/aHQ9JyArIGUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVzdFRva2VuOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzZW5kLXJlZGVtcHRpb24tcmVjb3JkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNzdWVyczogW0ZCLmlzc3Vlck9yaWdpbl0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFnLm9rKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihnLnN0YXR1cyArICc6IE5ldHdvcmsgcmVzcG9uc2Ugd2FzIG5vdCBvayEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPQihGQi5pc3N1ZXJPcmlnaW4sIDIyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy50ZXh0KCkudGhlbihmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5wYXJzZShoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuUHJvbWlzZS5yZWplY3QoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogMjEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gQ2Mod2luZG93KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBGQi5pc3N1ZXJPcmlnaW4gKyBGQi5pc3N1YW5jZVBhdGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLnNycXQgJiYgZS5jcyA/IChPQihGQi5pc3N1ZXJPcmlnaW4sIDIzKSwgd2luZG93LmZldGNoKGYgKyAnP2NzPScgKyBlLmNzICsgJyZjb3JyZWxhdG9yPScgKyBkLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2VlcGFsaXZlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVzdFRva2VuOiB7IHR5cGU6ICd0b2tlbi1yZXF1ZXN0JyB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFnLm9rKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihnLnN0YXR1cyArICc6IE5ldHdvcmsgcmVzcG9uc2Ugd2FzIG5vdCBvayEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPQihGQi5pc3N1ZXJPcmlnaW4sIDI1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYuUHJvbWlzZS5yZWplY3QoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogMjQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiBlLnNyZHQgJiYgZS5jcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT0IoRkIuaXNzdWVyT3JpZ2luLCAyNiksIHdpbmRvdy5mZXRjaChiICsgJz9jcz0nICsgZS5jcyArICcmY29ycmVsYXRvcj0nICsgZCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwYWxpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVzdFRva2VuOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndG9rZW4tcmVkZW1wdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUG9saWN5OiAncmVmcmVzaCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLm9rKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoZi5zdGF0dXMgKyAnOiBOZXR3b3JrIHJlc3BvbnNlIHdhcyBub3Qgb2shJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9CKEZCLmlzc3Vlck9yaWdpbiwgMjgsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdi5Qcm9taXNlLnJlamVjdCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogMjcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPQihGQi5pc3N1ZXJPcmlnaW4sIDI5KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIGluc3RhbmNlb2YgT2JqZWN0ICYmIGUuaGFzT3duUHJvcGVydHkoJ3N0YXRlJykgJiYgZS5oYXNPd25Qcm9wZXJ0eSgnZXJyb3InKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ251bWJlcicgPT09IHR5cGVvZiBlLnN0YXRlICYmIGUuZXJyb3IgaW5zdGFuY2VvZiBFcnJvcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPQihGQi5pc3N1ZXJPcmlnaW4sIGUuc3RhdGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IF8uemMoYXUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYXRoLnJhbmRvbSgpIDw9IGYgJiYgQmMoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IGUuc3RhdGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnI6IGUuZXJyb3IudG9TdHJpbmcoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAnZHR0X2VycicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBUQiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGRvY3VtZW50Lmhhc1RydXN0VG9rZW4gJiYgIV8uSChadCkgJiYgYS5qKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3aW5kb3cuZ29vZ190dF9wcm9taXNlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5nb29nX3R0X3Byb21pc2U7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB3aW5kb3cuZ29vZ190dF9zdGF0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfLnQoYSwgJ2ZpbmQnKS5jYWxsKGEsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuaXNzdWVyT3JpZ2luID09PSBFQi5pc3N1ZXJPcmlnaW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSAmJiBiLnB1c2goUkIoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfLnQoYSwgJ2ZpbmQnKS5jYWxsKGEsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuaXNzdWVyT3JpZ2luID09PSBGQi5pc3N1ZXJPcmlnaW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSAmJiBiLnB1c2goU0IoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodi5Qcm9taXNlICYmIHYuUHJvbWlzZS5hbGwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPSB2LlByb21pc2UuYWxsKGIpLCAnb2JqZWN0JyAhPSB0eXBlb2Ygd2luZG93Lmdvb2dfdHRfcHJvbWlzZSAmJiBPYmplY3QuZGVmaW5lUHJvcGVydHkod2luZG93LCAnZ29vZ190dF9wcm9taXNlJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZGUgPSAoMCwgRi5NYSkoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAhIWEgJiYgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGEub3BlbkNvbnNvbGVUYWIgJiYgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGEuYXR0YWNoT3ZlcmxheTsKICAgICAgICAgICAgfSwgJ0hvc3RNb2R1bGUnKTsKICAgICAgICAgICAgdmFyIGllID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGllLCBRKTsKICAgICAgICAgICAgdmFyIFVCID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMubSA9IDA7CiAgICAgICAgICAgICAgICB0aGlzLkYgPSBhIHx8IDEwMDsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IFtdOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwID0gVUIucHJvdG90eXBlOwogICAgICAgICAgICBwLmFkZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHRoaXMualt0aGlzLm1dOwogICAgICAgICAgICAgICAgdGhpcy5qW3RoaXMubV0gPSBhOwogICAgICAgICAgICAgICAgdGhpcy5tID0gKHRoaXMubSArIDEpICUgdGhpcy5GOwogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuZ2V0ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgPSBWQih0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmpbYV07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuc2V0ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGEgPSBWQih0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMualthXSA9IGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuaXNFbXB0eSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwID09IHRoaXMuai5sZW5ndGg7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuY2xlYXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLm0gPSB0aGlzLmoubGVuZ3RoID0gMDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGplID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gYS5qLmxlbmd0aCwgYyA9IFtdLCBkID0gYS5qLmxlbmd0aCAtIGEuai5sZW5ndGg7IGQgPCBiOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGMucHVzaChhLmdldChkKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9LCBWQiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGIgPj0gYS5qLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ091dCBvZiBib3VuZHMgZXhjZXB0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuai5sZW5ndGggPCBhLkYgPyBiIDogKGEubSArIE51bWJlcihiKSkgJSBhLkY7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBuZXcgVUIoMTAwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgaGUucHJvdG90eXBlLnNlbmQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5qIGluc3RhbmNlb2YgTWVzc2FnZVBvcnQgPyB0aGlzLmoucG9zdE1lc3NhZ2UoYS5YKCkpIDogdGhpcy5qLmFkZChhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFdCID0gUChbJ2h0dHBzOi8vd3d3Lmdvb2dsZXRhZ3NlcnZpY2VzLmNvbS9jb25zb2xlL2hvc3QvaG9zdC5qcyddKSwgWEIgPSBQKFsnaHR0cHM6Ly93d3cuZ29vZ2xldGFnc2VydmljZXMuY29tL2NvbnNvbGUvcGFuZWwvaW5kZXguaHRtbCddKSwgWUIgPSBQKFsnaHR0cHM6Ly93d3cuZ29vZ2xldGFnc2VydmljZXMuY29tL2NvbnNvbGUvb3ZlcmxheS9pbmRleC5odG1sJ10pLCBaQiA9IHsKICAgICAgICAgICAgICAgICAgICBJZDogQShXQiksCiAgICAgICAgICAgICAgICAgICAgSWY6IEEoWEIpLAogICAgICAgICAgICAgICAgICAgIEdmOiBBKFlCKQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGdlID0gewogICAgICAgICAgICAgICAgS2M6IGRvY3VtZW50LmJvZHksCiAgICAgICAgICAgICAgICBjZDogWkIKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGZoID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgJEIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oZmgsIFEpOwogICAgICAgICAgICB2YXIgY2ggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBHKGEsIDEpOwogICAgICAgICAgICAgICAgfSwgZWggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB3KGEsIDEsIGIpOwogICAgICAgICAgICAgICAgfSwgZGggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB5ZihhLCAyLCBiKTsKICAgICAgICAgICAgICAgIH0sICRCID0gWzJdOwogICAgICAgICAgICB2YXIgRWogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oRWosIFEpOwogICAgICAgICAgICB2YXIgamwgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oamwsIFEpOwogICAgICAgICAgICBqbC5wcm90b3R5cGUuc2V0VGFnRm9yQ2hpbGREaXJlY3RlZFRyZWF0bWVudCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdyh0aGlzLCA1LCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgamwucHJvdG90eXBlLmNsZWFyVGFnRm9yQ2hpbGREaXJlY3RlZFRyZWF0bWVudCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB3KHRoaXMsIDUsIHZvaWQgMCwgITEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBqbC5wcm90b3R5cGUuc2V0VGFnRm9yVW5kZXJBZ2VPZkNvbnNlbnQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIHcodGhpcywgNiwgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBiQyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSwgLTEsIGFDKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGJDLCBRKTsKICAgICAgICAgICAgYkMucHJvdG90eXBlLmdldFRheG9ub215ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEcodGhpcywgMSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBjQyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdyhhLCAxLCBiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYkMucHJvdG90eXBlLmNsZWFyVGF4b25vbXkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdyh0aGlzLCAxLCB2b2lkIDAsICExKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGRDID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geWYoYSwgMiwgYik7CiAgICAgICAgICAgICAgICB9LCBhQyA9IFsyXTsKICAgICAgICAgICAgdmFyIGVDID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGVDLCBRKTsKICAgICAgICAgICAgdmFyIGdDID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgZkMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oZ0MsIFEpOwogICAgICAgICAgICBnQy5wcm90b3R5cGUuQmEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gV2IodGhpcywgZUMsIDE4KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGlsID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBXYihhLCBqbCwgMjUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBnQy5wcm90b3R5cGUuZ2V0Q29ycmVsYXRvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBHKHRoaXMsIDI2KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZ0MucHJvdG90eXBlLnNldENvcnJlbGF0b3IgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIHcodGhpcywgMjYsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaEMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGdoKGEsIDMyLCBiQywgYik7CiAgICAgICAgICAgICAgICB9LCBmQyA9IFsKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgMTQsCiAgICAgICAgICAgICAgICAgICAgMzIKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgIHZhciBRZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhRZiwgUSk7CiAgICAgICAgICAgIFFmLnByb3RvdHlwZS5nZXRXaWR0aCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBHKHRoaXMsIDEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVWYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIHcoYSwgMSwgYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFFmLnByb3RvdHlwZS5nZXRIZWlnaHQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gRyh0aGlzLCAyKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFRmID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdyhhLCAyLCBiKTsKICAgICAgICAgICAgICAgIH0sIG9oID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IFFmKCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHcoYSwgMywgITApOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHRoID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHRoLCBRKTsKICAgICAgICAgICAgdmFyIFNmID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFEuY2FsbCh0aGlzLCBhLCAtMSwgaUMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oU2YsIFEpOwogICAgICAgICAgICB2YXIgaUMgPSBbMl07CiAgICAgICAgICAgIHZhciBrQyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSwgLTEsIGpDKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGtDLCBRKTsKICAgICAgICAgICAga0MucHJvdG90eXBlLmdldEFkVW5pdFBhdGggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gRyh0aGlzLCAxKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAga0MucHJvdG90eXBlLmdldERvbUlkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEcodGhpcywgMik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBsQyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB3KGEsIDIsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBrQy5wcm90b3R5cGUuZ2V0Q2xpY2tVcmwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gRyh0aGlzLCA3KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAga0MucHJvdG90eXBlLnNldENsaWNrVXJsID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiB3KHRoaXMsIDcsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgYmggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIFViKGEsIGZoLCA5KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAga0MucHJvdG90eXBlLkJhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIFdiKHRoaXMsIGVDLCAxMyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBOZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRrKGEsIDE1LCAwKTsKICAgICAgICAgICAgICAgIH0sIGpDID0gWwogICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICA1LAogICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICA5CiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICB2YXIgSmUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oSmUsIFEpOwogICAgICAgICAgICB2YXIgSWUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBFZShhLCAxLCBtQywgYik7CiAgICAgICAgICAgICAgICB9LCBPZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBuZXcgSmUoKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRWUoYiwgMiwgbUMsIGEpOwogICAgICAgICAgICAgICAgfSwgbUMgPSBbCiAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICB2YXIgcmUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8ocmUsIFEpOwogICAgICAgICAgICB2YXIgQmUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEsIC0xLCBuQyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhCZSwgUSk7CiAgICAgICAgICAgIHZhciBDZSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgd2goYSwgMSwgYik7CiAgICAgICAgICAgICAgICB9LCBGZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEZlLCBRKTsKICAgICAgICAgICAgdmFyIEdlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IEcoYSwgMSk7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSBiICYmIChiID0gQWIoW10pKTsKICAgICAgICAgICAgICAgICAgICBiLmNvbnN0cnVjdG9yID09PSBHYiA/IGEgPSBiIDogKGIgPSBuZXcgR2IoYiwgcmUpLCB3KGEsIDEsIGIsICExKSwgYSA9IGIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSwgSGUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHpmKGEsIDMsIGIpOwogICAgICAgICAgICAgICAgfSwgdWUgPSBbCiAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgIDUsCiAgICAgICAgICAgICAgICAgICAgNgogICAgICAgICAgICAgICAgXSwgbkMgPSBbMV07CiAgICAgICAgICAgIHZhciBwQyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSwgLTEsIG9DKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHBDLCBRKTsKICAgICAgICAgICAgdmFyIHFDID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWIoYSwgMSwgYiwgMCk7CiAgICAgICAgICAgICAgICB9LCByQyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHpmKGEsIDIsIGIpOwogICAgICAgICAgICAgICAgfSwgc0MgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB3aChhLCAzLCBiKTsKICAgICAgICAgICAgICAgIH0sIG9DID0gWzNdOwogICAgICAgICAgICB2YXIgdEMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8odEMsIFEpOwogICAgICAgICAgICB0Qy5wcm90b3R5cGUuZ2V0VGltZXN0YW1wID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHNrKHRoaXMsIDEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgdkMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IHRDKCk7CiAgICAgICAgICAgICAgICAgICAgYiA9IFFiKGIsIDEsIERhdGUubm93KCksIDApOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBFZShiLCAyLCB1QywgYSk7CiAgICAgICAgICAgICAgICB9LCB1QyA9IFsKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgIHZhciB3QyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBRLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyh3QywgUSk7CiAgICAgICAgICAgIHZhciB4QyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IG5ldyB3QygpOwogICAgICAgICAgICAgICAgcmV0dXJuIHpmKGIsIDEsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgeUMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgUS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oeUMsIFEpOwogICAgICAgICAgICB2YXIgZmUgPSBuZXcgZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLm0gPSBjOwogICAgICAgICAgICB9KGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gU2wod0MsIGEpOwogICAgICAgICAgICB9LCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIFNsKHlDLCBhKTsKICAgICAgICAgICAgfSwgNCk7CiAgICAgICAgICAgIHZhciBsZSA9IG5ldyB2Lk1hcCgpOwogICAgICAgICAgICB2YXIgekMgPSB7fSwgcGUgPSAoekMuY29tcGFuaW9uX2FkcyA9ICdjb21wYW5pb25BZHMnLCB6Qy5jb250ZW50ID0gJ2NvbnRlbnQnLCB6Qy5wdWJsaXNoZXJfYWRzID0gJ3B1YmFkcycsIHpDKSwgQUMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhICsgJ0NvcnJlbGF0b3IgaGFzIGJlZW4gZGVwcmVjYXRlZC4gUGxlYXNlIHNlZSB0aGUgR29vZ2xlIEFkIE1hbmFnZXIgaGVscCBwYWdlIG9uICJQYWdldmlld3MgaW4gR1BUIiBmb3IgbW9yZSBpbmZvcm1hdGlvbjogaHR0cHM6Ly9zdXBwb3J0Lmdvb2dsZS5jb20vYWRtYW5hZ2VyL2Fuc3dlci8xODMyODE/aGw9ZW4nOwogICAgICAgICAgICAgICAgfSwgWWcgPSB7CiAgICAgICAgICAgICAgICAgICAgaGY6ICdyZXdhcmRlZFNsb3RSZWFkeScsCiAgICAgICAgICAgICAgICAgICAgZ2Y6ICdyZXdhcmRlZFNsb3RHcmFudGVkJywKICAgICAgICAgICAgICAgICAgICBkZjogJ3Jld2FyZGVkU2xvdENhbmNlbGVkJywKICAgICAgICAgICAgICAgICAgICBlZjogJ3Jld2FyZGVkU2xvdENsb3NlZCcsCiAgICAgICAgICAgICAgICAgICAgZmY6ICdyZXdhcmRlZFNsb3RDb21wbGV0ZWQnLAogICAgICAgICAgICAgICAgICAgIGpmOiAnc2xvdEFkZGVkJywKICAgICAgICAgICAgICAgICAgICBtZjogJ3Nsb3RSZXF1ZXN0ZWQnLAogICAgICAgICAgICAgICAgICAgIG5mOiAnc2xvdFJlc3BvbnNlUmVjZWl2ZWQnLAogICAgICAgICAgICAgICAgICAgIGxmOiAnc2xvdFJlbmRlckVuZGVkJywKICAgICAgICAgICAgICAgICAgICBrZjogJ3Nsb3RPbmxvYWQnLAogICAgICAgICAgICAgICAgICAgIHBmOiAnc2xvdFZpc2liaWxpdHlDaGFuZ2VkJywKICAgICAgICAgICAgICAgICAgICAkZTogJ2ltcHJlc3Npb25WaWV3YWJsZScKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBCQyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGJ2LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhCQywgYnYpOwogICAgICAgICAgICBCQy5PID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ011c3QgYmUgb3ZlcnJpZGRlbicpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBCQy5jYWxsKHRoaXMsIF8uSChxZikgfHwgXy5IKFV0KSA/IDEgOiAwLCBfLnIpOwogICAgICAgICAgICAgICAgdGhpcy5tID0gMDsKICAgICAgICAgICAgICAgIHZhciBhID0gXy5IKHFmKSB8fCBfLkgoVXQpOwogICAgICAgICAgICAgICAgXy5yLmdvb2dsZV9tZWFzdXJlX2pzX3RpbWluZyA9IGEgfHwgXy5yLmdvb2dsZV9tZWFzdXJlX2pzX3RpbWluZzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFJlLCBCQyk7CiAgICAgICAgICAgIFhtKFJlKTsKICAgICAgICAgICAgdmFyIENDID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICB9OwogICAgICAgICAgICBDQy5PID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ011c3QgYmUgb3ZlcnJpZGRlbicpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbWcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBuZXcgdi5NYXAoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKG1nLCBDQyk7CiAgICAgICAgICAgIFhtKG1nKTsKICAgICAgICAgICAgdmFyIERDLCBFQzsKICAgICAgICAgICAgREMgPSB7fTsKICAgICAgICAgICAgXy5iZiA9IChEQ1syM10gPSAwLjAwMSwgRENbMzhdID0gMC4wMDEsIERDWzU4XSA9IDEsIERDWzE1MF0gPSAnJywgRENbMjExXSA9ICExLCBEQ1syNTNdID0gITEsIERDWzE3Ml0gPSBudWxsLCBEQ1syNDZdID0gW10sIERDWzIyNl0gPSBbXSwgRENbMjUyXSA9IG51bGwsIERDWzI1OF0gPSBudWxsLCBEQ1syNTFdID0gbnVsbCwgRENbMjU5XSA9IG51bGwsIERDWzZdID0ganIod2luZG93KSwgRENbMzZdID0gaXIoKSwgRENbMTQ4XSA9IEV2LCBEQ1syMjFdID0gaXIoKSwgRENbMjU3XSA9IGlyKCksIERDWzI2MF0gPSB2b2lkIDAsIERDWzI2Ml0gPSBpcigpLCBEQyk7CiAgICAgICAgICAgIEVDID0gbmUoKTsKICAgICAgICAgICAgXy50KE9iamVjdCwgJ2Fzc2lnbicpLmNhbGwoT2JqZWN0LCBfLmJmLCBFQy5fdmFyc18pOwogICAgICAgICAgICBFQy5fdmFyc18gPSBfLmJmOwogICAgICAgICAgICB2YXIgRkMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEZDLk8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignTXVzdCBiZSBvdmVycmlkZGVuJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBLZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMubSA9IHt9OwogICAgICAgICAgICAgICAgdGhpcy5qID0gbmV3IGdDKCk7CiAgICAgICAgICAgICAgICB0aGlzLkYgPSBuZXcgdi5NYXAoKTsKICAgICAgICAgICAgICAgIHRoaXMuai5zZXRDb3JyZWxhdG9yKHlyKCkpOwogICAgICAgICAgICAgICAgXy5iZlszNl0gJiYgdyh0aGlzLmosIDE1LCAhMCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhLZSwgRkMpOwogICAgICAgICAgICB2YXIgR0MgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gS2UuTygpLCBjID0gYS5nZXREb21JZCgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjICYmICFiLm0uaGFzT3duUHJvcGVydHkoYykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBtZy5PKCksIGUgPSArK1JlLk8oKS5tOwogICAgICAgICAgICAgICAgICAgICAgICBkLmouc2V0KGMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB3KGEsIDIwLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5tW2NdID0gYTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBOaCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChjID0gYS5tW2JdKSAmJiB2b2lkIDAgIT09IGMgPyBjIDogbnVsbDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIFhtKEtlKTsKICAgICAgICAgICAgdmFyIEhDID0gewogICAgICAgICAgICAgICAgICAgIEtjOiBkb2N1bWVudC5ib2R5LAogICAgICAgICAgICAgICAgICAgIGNkOiBaQgogICAgICAgICAgICAgICAgfSwga2YgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB2b2lkIDAgPT09IGEgPyBIQyA6IGE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSB2b2lkIDAgPT09IGIgPyBkb2N1bWVudC5VUkwgOiBiOwogICAgICAgICAgICAgICAgICAgIHRoaXMuRiA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy51cmwgPSBiOwogICAgICAgICAgICAgICAgICAgIHRoaXMubSA9ICExOwogICAgICAgICAgICAgICAgfSwgamY7CiAgICAgICAgICAgIGtmLnByb3RvdHlwZS5pbml0aWFsaXplID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGE7CiAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gJGgodGhpcy51cmwsICdnb29ndGltZScpICYmICF0aGlzLmopCiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0ga2UoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLkYpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCA9PT0gKGEgPSBudWxsID09PSBjb25zb2xlIHx8IHZvaWQgMCA9PT0gY29uc29sZSA/IHZvaWQgMCA6IGNvbnNvbGUuZXJyb3IpIHx8IHZvaWQgMCA9PT0gYSA/IHZvaWQgMCA6IGEuY2FsbChjb25zb2xlLCBiKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGtmLnByb3RvdHlwZS5zZW5kTWVzc2FnZSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBhID0gc0MockMocUMobmV3IHBDKCksIGEpLCBEZShiKSksIGMubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKGUpOwogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgZCAmJiB3KGEsIDQsIGQpOwogICAgICAgICAgICAgICAgZCA9IHZDKGEpOwogICAgICAgICAgICAgICAgZCA9IHhDKGQpOwogICAgICAgICAgICAgICAgKDAsIEYuSCkodGhpcy5qKS5zZW5kKGQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbGYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBqZjsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBnYy5hcHBseSgwLCBhcmd1bWVudHMpLCBlOwogICAgICAgICAgICAgICAgICAgIGlmIChjLmogJiYgIWMubSkgewogICAgICAgICAgICAgICAgICAgICAgICBjLm0gPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMuc2VuZE1lc3NhZ2UoYSwgdGhpcywgZCwgRXJyb3IoKS5zdGFjayk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT09IChlID0gbnVsbCA9PT0gY29uc29sZSB8fCB2b2lkIDAgPT09IGNvbnNvbGUgPyB2b2lkIDAgOiBjb25zb2xlLmVycm9yKSB8fCB2b2lkIDAgPT09IGUgPyB2b2lkIDAgOiBlLmNhbGwoY29uc29sZSwgZik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLm0gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi5hcHBseSh0aGlzLCBkKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBJQyA9IHRnKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAhIWtyKF8uci5sb2NhdGlvbi5ocmVmKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBZZSA9ICcyMDIyMDExMDAyJzsKICAgICAgICAgICAgdmFyIGNmID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gJ2h0dHBzOi8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20nIDogYjsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHZvaWQgMCA9PT0gYyA/IENjKF8ucikgOiBjOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaWQgPSBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMuWGIgPSBiOwogICAgICAgICAgICAgICAgICAgIHRoaXMubSA9IE1hdGgucmFuZG9tKCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gZCB8fCAwID4gZCB8fCAxIDwgZCkKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBfLmJmWzIzXTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkYgPSB0aGlzLm0gPCBkOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaiA9IHsgcHZzaWQ6IFN0cmluZyhjKSB9OwogICAgICAgICAgICAgICAgfSwgSkMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgICAgIGEgPSBQZShhKTsKICAgICAgICAgICAgICAgICAgICBEZi5zZXQoYSwgKG51bGwgIT09IChiID0gRGYuZ2V0KGEpKSAmJiB2b2lkIDAgIT09IGIgPyBiIDogMCkgKyAxKTsKICAgICAgICAgICAgICAgIH0sIENmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBbXS5jb25jYXQoXy5sYyhfLnQoRGYsICd2YWx1ZXMnKS5jYWxsKERmKSkpLnJlZHVjZShmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSArIGI7CiAgICAgICAgICAgICAgICAgICAgfSwgMCk7CiAgICAgICAgICAgICAgICB9LCBJID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyAhPT0gdHlwZW9mIGMgJiYgKGMgPSBTdHJpbmcoYykpOwogICAgICAgICAgICAgICAgICAgIC9eXHcrJC8udGVzdChiKSAmJiAoYyA/IGEualtiXSA9IGMgOiBkZWxldGUgYS5qW2JdKTsKICAgICAgICAgICAgICAgIH0sIGZmID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gbnVsbCA6IGI7CiAgICAgICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/ICExIDogYzsKICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gbnVsbCA6IGI7CiAgICAgICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/ICExIDogYzsKICAgICAgICAgICAgICAgICAgICBpZiAoSUMoKSkKICAgICAgICAgICAgICAgICAgICAgICAgYiA9ICEwOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGEuRjsKICAgICAgICAgICAgICAgICAgICAgICAgYiAmJiAwIDw9IGIgJiYgKGQgPSAoYyA/IGEubSA6IE1hdGgucmFuZG9tKCkpIDwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBkICYmICEhYS5pZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYiAmJiAoYSA9IEtDKGEpIHx8ICcnLCBfLlFyKHdpbmRvdywgYSkpOwogICAgICAgICAgICAgICAgfSwgS0MgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gYS5YYiArICcvcGFnZWFkL2dlbl8yMDQ/aWQ9JyArIGVuY29kZVVSSUNvbXBvbmVudChhLmlkKTsKICAgICAgICAgICAgICAgICAgICBfLmVmKGEuaiwgZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYyAmJiAoYiArPSAnJicgKyBkICsgJz0nICsgZW5jb2RlVVJJQ29tcG9uZW50KGMpKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0sIExDID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBiID0gYi5tYXAoZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMucmVwbGFjZSgvLC9nLCAnXFwsJyk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgMyA+PSBiLmxlbmd0aCA/IEkoYSwgJ253X2lkJywgYi5qb2luKCkpIDogKGIgPSBiLnNsaWNlKDAsIDMpLCBiLnB1c2goJ19fZXh0cmFfXycpLCBJKGEsICdud19pZCcsIGIuam9pbigpKSk7CiAgICAgICAgICAgICAgICB9LCBkZiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgSShhLCAndnJnJywgV2UoKSk7CiAgICAgICAgICAgICAgICAgICAgYiA/IChMQyhhLCBiKSwgSShhLCAnbnNsb3RzJywgYi5sZW5ndGgudG9TdHJpbmcoKSkpIDogKExDKGEsIFtdLmNvbmNhdChfLmxjKF8udChEZiwgJ2tleXMnKS5jYWxsKERmKSkpKSwgSShhLCAnbnNsb3RzJywgQ2YoKS50b1N0cmluZygpKSk7CiAgICAgICAgICAgICAgICAgICAgYiA9IERjKCkubSgpOwogICAgICAgICAgICAgICAgICAgIGIubGVuZ3RoICYmIEkoYSwgJ2VpZCcsIGIuam9pbigpKTsKICAgICAgICAgICAgICAgICAgICBJKGEsICdwdWJfdXJsJywgZG9jdW1lbnQuVVJMKTsKICAgICAgICAgICAgICAgIH0sIG9mID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gewogICAgICAgICAgICAgICAgICAgICAgICBYYjogJ2h0dHBzOi8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICBwYTogXy5iZlsyM10KICAgICAgICAgICAgICAgICAgICB9IDogYzsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGMuWGIgfHwgJ2h0dHBzOi8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20nOwogICAgICAgICAgICAgICAgICAgIGMgPSBjLnBhOwogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IGMgfHwgMCA+IGMgfHwgMSA8IGMpCiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBfLmJmWzIzXTsKICAgICAgICAgICAgICAgICAgICBNYXRoLnJhbmRvbSgpIDwgYyAmJiAoYSA9IG5ldyBjZihhLCBkKSwgYihhKSwgZmYoYSwgMSwgITApKTsKICAgICAgICAgICAgICAgIH0sIERmID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgIHZhciBhZiwgaGY7CiAgICAgICAgICAgIGFmID0gXy5iZlszOF07CiAgICAgICAgICAgIGhmID0gdGcoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSBfLnpjKEpzKTsKICAgICAgICAgICAgICAgIGEgPSBuZXcgcG0oYSk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IF8uemMoS3MpOwogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBzYjogYSwKICAgICAgICAgICAgICAgICAgICBxZTogMCA8IGIgPyBIZCgpIDwgMSAvIGIgOiAhMSwKICAgICAgICAgICAgICAgICAgICB6ZDogYgogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIF8uTUMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBOQyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmlkID0gJ2dvb2dfJyArIElxKys7CiAgICAgICAgICAgICAgICB9LCBPQyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBfLmd1LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oT0MsIF8uZ3UpOwogICAgICAgICAgICBPQy5wcm90b3R5cGUuRiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIF8uZ3UucHJvdG90eXBlLkYuY2FsbCh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubC5jbGVhcigpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUUMgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkLCBlOwogICAgICAgICAgICAgICAgICAgIGlmIChhLm0pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSAnc3RyaW5nJyA9PT0gdHlwZW9mIGIgPyBiIDogYi5pZCwgZyA9IG51bGwgIT09IChlID0gbnVsbCA9PT0gKGQgPSBhLmwuZ2V0KGYpKSB8fCB2b2lkIDAgPT09IGQgPyB2b2lkIDAgOiBkLmFkZChjKSkgJiYgdm9pZCAwICE9PSBlID8gZSA6IG5ldyB2LlNldChbY10pOwogICAgICAgICAgICAgICAgICAgIGEubC5zZXQoZiwgZyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgUEMoYSwgYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIHNpID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfSA6IGM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB2LlByb21pc2UoZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBRQyhhLCBiLCBmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhmKSAmJiAoZSgpLCBkKGYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBQQyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEobnVsbCA9PT0gKGQgPSBhLmwuZ2V0KCdzdHJpbmcnID09PSB0eXBlb2YgYiA/IGIgOiBiLmlkKSkgfHwgdm9pZCAwID09PSBkIHx8ICFkLmRlbGV0ZShjKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBPQy5wcm90b3R5cGUuZGlzcGF0Y2hFdmVudCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZCA9IHRoaXMsIGUsIGYsIGcsIGgsIGssIGwsIG07CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAxID09IG4uaiAmJiAoZiA9ICdzdHJpbmcnID09PSB0eXBlb2YgYSA/IGEgOiBhLmlkLCBnID0gZG9jdW1lbnQuY3JlYXRlRXZlbnQoJ0N1c3RvbUV2ZW50JyksIGcuaW5pdEN1c3RvbUV2ZW50KGYsICEwLCAhMCwgYyksIGggPSBudWxsICE9PSAoZSA9IGQubC5nZXQoZikpICYmIHZvaWQgMCAhPT0gZSA/IGUgOiBuZXcgdi5TZXQoKSwgayA9IHt9LCBsID0gXy55KGgpLCBtID0gbC5uZXh0KCkpOwogICAgICAgICAgICAgICAgICAgIGlmICg1ICE9IG4uaikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAobS5kb25lKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmogPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGsudWIgPSBtLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamIobiwgMCwgNSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF8udWYoYiwgZnVuY3Rpb24gKHEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQubC5oYXMoZikgJiYgaC5oYXMocS51YikgJiYgcS51YihnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KGspLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgayA9IHsgdWI6IGsudWIgfTsKICAgICAgICAgICAgICAgICAgICBtID0gbC5uZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgbi5qID0gMjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUkMgPSBuZXcgTkMoKSwgU0MgPSBuZXcgTkMoKSwgVEMgPSBuZXcgTkMoKSwgVUMgPSBuZXcgTkMoKSwgVkMgPSBuZXcgTkMoKSwgV0MgPSBuZXcgTkMoKSwgWEMgPSBuZXcgTkMoKSwgdGkgPSBuZXcgTkMoKSwgWUMgPSBuZXcgTkMoKTsKICAgICAgICAgICAgdmFyIFkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBwdi5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oWSwgcHYpOwogICAgICAgICAgICBZLnByb3RvdHlwZS5SID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiLCBjOwogICAgICAgICAgICAgICAgcmYodGhpcy5pZCwgYSk7CiAgICAgICAgICAgICAgICBudWxsID09PSAoYyA9IG51bGwgPT09IChiID0gd2luZG93LmNvbnNvbGUpIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuZXJyb3IpIHx8IHZvaWQgMCA9PT0gYyA/IHZvaWQgMCA6IGMuY2FsbChiLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFpDID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUpIHsKICAgICAgICAgICAgICAgIHZhciBmID0gbnVsbCwgZyA9IF8ubWYoYiwgZSk7CiAgICAgICAgICAgICAgICBfLmZiKGMsIGQsIGcpICYmIChmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBfLkxjKGMsIGQsIGcpOwogICAgICAgICAgICAgICAgfSwgXy56bChhLCBmKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyICRDID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA5MzcsIF8uemMoanQpKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IHJ2KHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oJEMsIFkpOwogICAgICAgICAgICAkQy5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhLCBiLCBjID0gdGhpcy5HLnZhbHVlOwogICAgICAgICAgICAgICAgaWYgKF8uSCh1cykgJiYgYykgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSB7fSwgZSA9IG5ldyB2LlNldCgpLCBmID0gXy55KFViKGMsIHpwLCAxKSksIGcgPSBmLm5leHQoKTsgIWcuZG9uZTsgZyA9IGYubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBnLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICBkW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxrKGcsIDIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGsoZywgMSkKICAgICAgICAgICAgICAgICAgICAgICAgXS5maWx0ZXIoZnVuY3Rpb24gKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWs7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oKV0gPSB7IFdkOiBTbyhnLCAzKSB9OwogICAgICAgICAgICAgICAgICAgICAgICBnID0gXy55KE9oKGcsIDQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaCA9IGcubmV4dCgpOyAhaC5kb25lOyBoID0gZy5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmFkZChoLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdGhpcy5vLmZhKGQpOwogICAgICAgICAgICAgICAgICAgIHRoaXMubC5mYShbXS5jb25jYXQoXy5sYyhlKSkpOwogICAgICAgICAgICAgICAgICAgIGMgPSBudWxsID09PSAoYiA9IG51bGwgPT09IChhID0gV2IoYywgQXAsIDIpKSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBXYihhLCBycCwgMSkpIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IFViKGIsIHRwLCAxKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkIuZmEoKG51bGwgPT09IGMgfHwgdm9pZCAwID09PSBjID8gMCA6IGMubGVuZ3RoKSA/IGMgOiBudWxsKTsKICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgIGp2KHRoaXMubyksIGp2KHRoaXMubCksIGp2KHRoaXMuQik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgICRDLnByb3RvdHlwZS5NID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuQShhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgJEMucHJvdG90eXBlLkEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBqdih0aGlzLm8pOwogICAgICAgICAgICAgICAganYodGhpcy5sKTsKICAgICAgICAgICAgICAgIGp2KHRoaXMuQik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBQaCA9IG5ldyB2Lk1hcCgpLCBhRCA9IG5ldyB2Lk1hcCgpLCBiRCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH0sIFFnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGFELmdldChhKTsKICAgICAgICAgICAgICAgICAgICBjIHx8IChiID0gYyA9IGIoKSwgUGguc2V0KGIsIGEpLCBhRC5zZXQoYSwgYikpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGNEID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMucHVzaCA9IEsoOTMyLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIGEucHVzaChiKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oY0QsIGJEKTsKICAgICAgICAgICAgdmFyIGREID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHRoaXMucGJqcyA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBkRC5wcm90b3R5cGUucHVzaCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiwgYywgZCwgZSwgZiwgZywgaCwgaywgbCwgbSwgbiA9IGEuY29udGV4dCwgcSA9IGEubmV4dEZ1bmN0aW9uOwogICAgICAgICAgICAgICAgYSA9IGEucmVxdWVzdEJpZHNDb25maWc7CiAgICAgICAgICAgICAgICB2YXIgdSA9IG51bGwgIT09IChkID0gbnVsbCAhPT0gKGIgPSBudWxsID09PSBhIHx8IHZvaWQgMCA9PT0gYSA/IHZvaWQgMCA6IGEuYWRVbml0cykgJiYgdm9pZCAwICE9PSBiID8gYiA6IG51bGwgPT09IChjID0gdGhpcy5wYmpzKSB8fCB2b2lkIDAgPT09IGMgPyB2b2lkIDAgOiBjLmFkVW5pdHMpICYmIHZvaWQgMCAhPT0gZCA/IGQgOiBbXSwgQiA9IHt9OwogICAgICAgICAgICAgICAgdSA9IF8ueSh1KTsKICAgICAgICAgICAgICAgIGZvciAodmFyIHggPSB1Lm5leHQoKTsgIXguZG9uZTsgQiA9IHsgZ2I6IEIuZ2IgfSwgeCA9IHUubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHogPSB4LnZhbHVlOwogICAgICAgICAgICAgICAgICAgIGlmICgoeCA9IHouY29kZSkgJiYgKG51bGwgIT09IChlID0gei5iaWRzKSAmJiB2b2lkIDAgIT09IGUgPyBlIDogW10pLmxlbmd0aCAmJiAoQi5nYiA9IG51bGwgIT09IChrID0gbnVsbCAhPT0gKGcgPSBudWxsID09PSAoZiA9IHRoaXMuaikgfHwgdm9pZCAwID09PSBmID8gdm9pZCAwIDogZlt4XSkgJiYgdm9pZCAwICE9PSBnID8gZyA6IG51bGwgPT09IChoID0gdGhpcy5qKSB8fCB2b2lkIDAgPT09IGggPyB2b2lkIDAgOiBoW2FnKHgpXSkgJiYgdm9pZCAwICE9PSBrID8gayA6IF8uemMocXMpLCBCLmdiICYmICEoMCA+IEIuZ2IpKSkgewogICAgICAgICAgICAgICAgICAgICAgICB4ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIHogPSBfLnkobnVsbCAhPT0gKGwgPSB6LmJpZHMpICYmIHZvaWQgMCAhPT0gbCA/IGwgOiBbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIEMgPSB6Lm5leHQoKTsgIUMuZG9uZTsgeCA9IHsgVmI6IHguVmIgfSwgQyA9IHoubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgQyA9IEMudmFsdWUsIHguVmIgPSBudWxsICE9PSAobSA9IEMuZ2V0Rmxvb3IpICYmIHZvaWQgMCAhPT0gbSA/IG0gOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVuY3k6ICdVU0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9vcjogMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBDLmdldEZsb29yID0gZnVuY3Rpb24gKEQsIEopIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgVCA9IEQuVmIuYXBwbHkobiwgZ2MuYXBwbHkoMCwgYXJndW1lbnRzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnVVNEJyAhPT0gVC5jdXJyZW5jeSA/IFQgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW5jeTogJ1VTRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9vcjogTWF0aC5tYXgoKG51bGwgPT09IFQgfHwgdm9pZCAwID09PSBUID8gdm9pZCAwIDogVC5mbG9vcikgfHwgMCwgSi5nYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh4LCBCKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBudWxsID09PSBxIHx8IHZvaWQgMCA9PT0gcSA/IHZvaWQgMCA6IHEuYXBwbHkobiwgW2FdKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGVEID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA5MzEpOwogICAgICAgICAgICAgICAgdGhpcy5JID0gd2luZG93OwogICAgICAgICAgICAgICAgdGhpcy5sID0gVyh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGVELCBZKTsKICAgICAgICAgICAgZUQucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSwgYiwgYywgZCwgZSwgZiwgZzsKICAgICAgICAgICAgICAgIGlmIChfLnpjKHFzKSB8fCB0aGlzLmwudmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICBudWxsICE9PSAoYSA9IChmID0gdGhpcy5JKS5wYmpzKSAmJiB2b2lkIDAgIT09IGEgPyBhIDogZi5wYmpzID0ge307CiAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gKGIgPSAoZyA9IHRoaXMuSS5wYmpzKS5xdWUpICYmIHZvaWQgMCAhPT0gYiA/IGIgOiBnLnF1ZSA9IFtdOwogICAgICAgICAgICAgICAgICAgIHZhciBoID0gbnVsbCAhPT0gKGMgPSBuZSgpLnBianNfaG9va3MpICYmIHZvaWQgMCAhPT0gYyA/IGMgOiBbXSwgayA9IHt9OwogICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSAoZCA9IHRoaXMubC52YWx1ZSkgfHwgdm9pZCAwID09PSBkID8gMCA6IGQubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBsID0gXy55KHRoaXMubC52YWx1ZSksIG0gPSBsLm5leHQoKTsgIW0uZG9uZTsgbSA9IGwubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtID0gbS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gVWIobSwgdXAsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IDEgPT09IHRrKG5bMF0sIDEsIDApID8gVm8oblswXSkgOiBXbyhuWzBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gPSBzayhtLCAyKSAvIDEwMDAwMDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrW25dID0gTWF0aC5taW4obnVsbCAhPT0gKGUgPSBrW25dKSAmJiB2b2lkIDAgIT09IGUgPyBlIDogTnVtYmVyLk1BWF9WQUxVRSwgbSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgcSA9IG5ldyBkRCh0aGlzLkkucGJqcywgayk7CiAgICAgICAgICAgICAgICAgICAgaCA9IF8ueShoKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGsgPSBoLm5leHQoKTsgIWsuZG9uZTsgayA9IGgubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICBxLnB1c2goay52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgaCA9ICEhbmUoKS5wYmpzX2hvb2tzOwogICAgICAgICAgICAgICAgICAgIG5lKCkucGJqc19ob29rcyA9IFFnKHEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBjRChxKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBoIHx8IGZEKHRoaXMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZkQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIsIGMsIGQgPSAoMCwgRi5IKShudWxsID09PSAoYyA9IG51bGwgPT09IChiID0gYS5JKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLnBianMpIHx8IHZvaWQgMCA9PT0gYyA/IHZvaWQgMCA6IGMucXVlKSwgZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYsIGc7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT09IChnID0gbnVsbCA9PT0gKGYgPSBhLkkucGJqcykgfHwgdm9pZCAwID09PSBmID8gdm9pZCAwIDogZi5yZXF1ZXN0QmlkcykgfHwgdm9pZCAwID09PSBnID8gdm9pZCAwIDogZy5iZWZvcmUuY2FsbChhLkksIGZ1bmN0aW9uIChoLCBrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmUoKS5wYmpzX2hvb2tzLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IGEuSSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0RnVuY3Rpb246IGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdEJpZHNDb25maWc6IGsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZC5oYXNPd25Qcm9wZXJ0eSgncHVzaCcpID8gZC5wdXNoKGUpIDogZC51bnNoaWZ0KGUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZ0QgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg5MiwgXy56YyhsdCkpOwogICAgICAgICAgICAgICAgdGhpcy5vID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuSiA9IHJ2KHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oZ0QsIFkpOwogICAgICAgICAgICBnRC5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5KLnZhbHVlOwogICAgICAgICAgICAgICAgaWYgKCFhKQogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdjb25maWcgdGltZW91dCcpOwogICAgICAgICAgICAgICAgdGhpcy5vLmZhKFdiKGEsIENwLCAzKSk7CiAgICAgICAgICAgICAgICB0aGlzLkIuZmEoV2IoYSwgd3AsIDEpKTsKICAgICAgICAgICAgICAgIHRoaXMuRy5mYShXYihhLCBFcCwgMikpOwogICAgICAgICAgICAgICAgdGhpcy5sLmZhKE9oKGEsIDQpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZ0QucHJvdG90eXBlLk0gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5BKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBnRC5wcm90b3R5cGUuQSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBrdih0aGlzLm8sIGEpOwogICAgICAgICAgICAgICAga3YodGhpcy5HLCBhKTsKICAgICAgICAgICAgICAgIGt2KHRoaXMuQiwgYSk7CiAgICAgICAgICAgICAgICBqdih0aGlzLmwpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaEQgPSBbCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnSW50ZXJzdGl0aWFsJywKICAgICAgICAgICAgICAgICAgICAgICAgY2M6IDEKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1RvcEFuY2hvcicsCiAgICAgICAgICAgICAgICAgICAgICAgIGNjOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdCb3R0b21BbmNob3InLAogICAgICAgICAgICAgICAgICAgICAgICBjYzogMwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIF0sIGlEID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNzg5KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmwgPSBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMuQyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oaUQsIFkpOwogICAgICAgICAgICBpRC5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpczsKICAgICAgICAgICAgICAgIHRoaXMuQy5qKGhELmZpbHRlcihmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUmVnRXhwKCdnYW0nICsgYi5uYW1lICsgJ0RlbW8nLCAnaScpLnRlc3QoYS5sKTsKICAgICAgICAgICAgICAgIH0pLm1hcChmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYi5uYW1lOwogICAgICAgICAgICAgICAgICAgIGIgPSBiLmNjOwogICAgICAgICAgICAgICAgICAgIHZhciBkLCBlOwogICAgICAgICAgICAgICAgICAgIG51bGwgPT09IChlID0gbnVsbCA9PT0gKGQgPSB3aW5kb3cuY29uc29sZSkgfHwgdm9pZCAwID09PSBkID8gdm9pZCAwIDogZC53YXJuKSB8fCB2b2lkIDAgPT09IGUgPyB2b2lkIDAgOiBlLmNhbGwoZCwgJ0dQVCAtIERlbW8gJyArIGMgKyAnIEVOQUJMRUQnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IG5ldyBlcSgpOwogICAgICAgICAgICAgICAgICAgIGIgPSB3KGYsIDMsIGIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB3KGIsIDIsICcvMjI2MzkzODgxMTUvZXhhbXBsZS8nICsgYy50b0xvd2VyQ2FzZSgpKTsKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGpEID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA5MDYsIF8uemMoa3QpKTsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IHJ2KHRoaXMsIGIpOwogICAgICAgICAgICAgICAgdGhpcy5vID0gc2koYywgV0MpLnRoZW4oZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUGUoKDAsIEYuSCkoZC5kZXRhaWwuUC5nZXRBZFVuaXRQYXRoKCkpKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5JICE9PSB0aGlzLkkudG9wICYmIHRoaXMubC5ub3RpZnkoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGpELCBZKTsKICAgICAgICAgICAgakQucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGI7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5JICE9PSBhLkkudG9wKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IGEuQi52YWx1ZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGMsIGtEKGEsIGIpLCAwKTsKICAgICAgICAgICAgICAgICAgICBhLmwubm90aWZ5KCk7CiAgICAgICAgICAgICAgICAgICAgYy5qID0gMDsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIga0QgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjLCBkOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBjID0gVWIoYiwgRnAsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWMubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubC5ub3RpZnkoKSwgZS5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGNbMF07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoTCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgIF0sIF8udChMLCAnaW5jbHVkZXMnKSkuY2FsbChMLCB0ayhkLCAzLCAwKSkgPyAobEQoYSwgbGsoZCwgMSkpLCBlLnJldHVybigpKSA6IGpiKGUsIF8udWYoOTE3LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbUQoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAwKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIG1EID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYywgZDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gZS5qKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGUsIGEubywgMik7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBlLm07CiAgICAgICAgICAgICAgICAgICAgICAgIChkID0gVWIoYiwgRnAsIDEpLnNvbWUoZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsayhmLCAxKSA9PT0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpID8gbEQoYSwgYykgOiAob2YoJ3BwX2lyaXNfZmFpbHVyZScsIGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKGYsICdmbmMnLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRmKGYpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7IHBhOiBfLnpjKG50KSB9KSwgYS5sLm5vdGlmeSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgTG0oZSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBsRCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBwdShhLkksIGIsIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IE5xKGMuaik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gXy55KGRvY3VtZW50LmdldEVsZW1lbnRzQnlOYW1lKCdnb29nbGVmY1ByZXNlbnQnKSksIGYgPSBlLm5leHQoKTsgIWYuZG9uZTsgZiA9IGUubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQuZ2QoZi52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYS5sLm5vdGlmeSgpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGMuc3RhcnQoKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIGpELnByb3RvdHlwZS5NID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuQShhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgakQucHJvdG90eXBlLkEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLmwubm90aWZ5KCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBuRCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgOTAxKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFcodGhpcywgYSk7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBzaShiLCBXQykudGhlbihmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoMCwgRi5IKShjLmRldGFpbC5QLmdldEFkVW5pdFBhdGgoKSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKG5ELCBZKTsKICAgICAgICAgICAgbkQucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGIsIGMsIGQsIGUsIGY7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSBnLmopCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoYyA9IGEubC52YWx1ZSkgPyBqYihnLCBhLm8sIDIpIDogZy5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICBkID0gZy5tOwogICAgICAgICAgICAgICAgICAgIGUgPSBQZShkKTsKICAgICAgICAgICAgICAgICAgICBmID0gbnVsbCA9PT0gKGIgPSBVYihjLCB4cCwgNCkpIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuc29tZShmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGsoaCwgMikgPT09IGU7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgb2YoJ3BwX2ZzbScsIGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEkoaCwgJ2ZzbmMnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgSShoLCAnYXVwJywgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIEkoaCwgJ3RsZCcsIGxrKGMsIDEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgSShoLCAncGR1JywgbGsoYywgMikpOwogICAgICAgICAgICAgICAgICAgICAgICBJKGgsICdpZHUnLCBsayhjLCAzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIEkoaCwgJ3BuYycsIGxrKGMsIDUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgSShoLCAnZG0nLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgZGYoaCk7CiAgICAgICAgICAgICAgICAgICAgfSwgeyBwYTogXy56YyhtdCkgfSk7CiAgICAgICAgICAgICAgICAgICAgTG0oZyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIG9EID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg5MSk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBVKHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8ob0QsIFkpOwogICAgICAgICAgICBvRC5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYzsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IGQuaikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGQsIG5ldyB2LlByb21pc2UoZnVuY3Rpb24gKGUsIGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCA9PT0gKGcgPSBfLmJmWzI2MF0pIHx8IHZvaWQgMCA9PT0gZyA/IHZvaWQgMCA6IGcoZnVuY3Rpb24gKGgsIGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrID8gZihrKSA6IGUoaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIDIpOwogICAgICAgICAgICAgICAgICAgIGIgPSBkLm07CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgPT09IHR5cGVvZiBiICYmIChjID0gSlNPTi5wYXJzZShiIHx8ICdbXScpKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChjICYmIEFycmF5LmlzQXJyYXkoYykpCiAgICAgICAgICAgICAgICAgICAgICAgIGEubC5qKG5ldyBIcChjKSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignbWFsZm9ybWVkIHJlc3BvbnNlJyk7CiAgICAgICAgICAgICAgICAgICAgTG0oZCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHBEID0gbmV3IHYuTWFwKFsKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgMgogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSksIGlrID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICBkID0gdm9pZCAwID09PSBkID8gZG9jdW1lbnQgOiBkOwogICAgICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA5MTIpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZ29vZ2xldGFnID0gYjsKICAgICAgICAgICAgICAgICAgICB0aGlzLlUgPSBjOwogICAgICAgICAgICAgICAgICAgIHRoaXMuVyA9IGQ7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gVih0aGlzLCBhKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhpaywgWSk7CiAgICAgICAgICAgIGlrLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IHRoaXMsIGIgPSB7fSwgYyA9IF8ueSh0aGlzLmwudmFsdWUpLCBkID0gYy5uZXh0KCk7ICFkLmRvbmU7IGIgPSB7IFhhOiBiLlhhIH0sIGQgPSBjLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICBkID0gZC52YWx1ZSwgcEQuaGFzKHRrKGQsIDMsIDApKSAmJiBkLmdldEFkVW5pdFBhdGgoKSAmJiAoYi5YYSA9IHRoaXMuZ29vZ2xldGFnLmRlZmluZU91dE9mUGFnZVNsb3QoKDAsIEYuSCkoZC5nZXRBZFVuaXRQYXRoKCkpLCAoMCwgRi5IKShwRC5nZXQodGsoZCwgMywgMCkpKSksIGIuWGEgJiYgKGIuWGEuYWRkU2VydmljZSh0aGlzLmdvb2dsZXRhZy5wdWJhZHMoKSksIEFyKHRoaXMuVywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5nb29nbGV0YWcuZGlzcGxheShlLlhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEUobnVsbCAhPT0gKGYgPSBhLlUpICYmIHZvaWQgMCAhPT0gZiA/IGYgOiBLZS5PKCkuaiwgNCkgJiYgYS5nb29nbGV0YWcucHViYWRzKCkucmVmcmVzaChbZS5YYV0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0oYikpKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBJZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLm8gPSBuZXcgb0QoKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBuZXcgZ0QodGhpcy5vLmwpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuRCA9IHRoaXMuai5sOwogICAgICAgICAgICAgICAgICAgIHRoaXMubSA9IG5ldyAkQyh0aGlzLmoubyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLkEgPSB0aGlzLm0ubzsKICAgICAgICAgICAgICAgICAgICB0aGlzLkYgPSB0aGlzLm0ubDsKICAgICAgICAgICAgICAgICAgICBfLmJmWzI2MF0gfHwgKGp2KHRoaXMuRCksIGp2KHRoaXMuQSksIGp2KHRoaXMuRikpOwogICAgICAgICAgICAgICAgfSwgcUQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gXy5IZyhJZyksIGMsIGQgPSBuZXcgUWMoKTsKICAgICAgICAgICAgICAgICAgICBOKGQsIGIubyk7CiAgICAgICAgICAgICAgICAgICAgTihkLCBiLmopOwogICAgICAgICAgICAgICAgICAgIE4oZCwgYi5tKTsKICAgICAgICAgICAgICAgICAgICBOKGQsIG5ldyBlRChiLm0uQikpOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IGpEKHdpbmRvdywgYi5qLkcsIGEpOwogICAgICAgICAgICAgICAgICAgIGIubCA9IGUubC5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgIE4oZCwgZSk7CiAgICAgICAgICAgICAgICAgICAgTihkLCBuZXcgbkQoYi5qLkIsIGEpKTsKICAgICAgICAgICAgICAgICAgICBhID0gbmV3IGlEKG51bGwgIT09IChjID0gd2luZG93LmxvY2F0aW9uLmhhc2gpICYmIHZvaWQgMCAhPT0gYyA/IGMgOiAnJyk7CiAgICAgICAgICAgICAgICAgICAgTihkLCBhKTsKICAgICAgICAgICAgICAgICAgICBOKGQsIG5ldyBpayhhLkMsIG5lKCksIG51bGwpKTsKICAgICAgICAgICAgICAgICAgICBTYyhkKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciByRCA9IHRnKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSAnJywgYiA9IF8ueShwZygpKSwgYyA9IGIubmV4dCgpOyAhYy5kb25lOyBjID0gYi5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgYyA9IGMudmFsdWUsIDE1ID49IGMgJiYgKGEgKz0gJzAnKSwgYSArPSBjLnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIHNEID0gMCwgdEQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB9LCB6RCwgREQsIGVrLCBtbCwgRUQsIHlELCB4RCwgd0QsIEZEOwogICAgICAgICAgICB0RC5PID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ011c3QgYmUgb3ZlcnJpZGRlbicpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgdUQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLm0gPSBuZXcgdi5NYXAoKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IDA7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBDYyhfLnIpOwogICAgICAgICAgICAgICAgdGhpcy5BID0gdGhpcy5uYiA9IG51bGw7CiAgICAgICAgICAgICAgICB0aGlzLkQgPSAwOwogICAgICAgICAgICAgICAgdGhpcy5sID0gXy5WbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgR2coJ2dwdC1maXJzdC1hZC1yZXF1ZXN0Jyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IG5ldyB2Lk1hcCgpOwogICAgICAgICAgICAgICAgdGhpcy5GID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyh1RCwgdEQpOwogICAgICAgICAgICB6RCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBhLmouZ2V0KGIpIHx8IChhLmouc2V0KGIsIHsKICAgICAgICAgICAgICAgICAgICBWYTogITAsCiAgICAgICAgICAgICAgICAgICAgdmM6ICcnLAogICAgICAgICAgICAgICAgICAgIFlhOiAnJywKICAgICAgICAgICAgICAgICAgICBXYzogMCwKICAgICAgICAgICAgICAgICAgICBQYzogMCwKICAgICAgICAgICAgICAgICAgICB0YzogW10sCiAgICAgICAgICAgICAgICAgICAgdWM6IFtdLAogICAgICAgICAgICAgICAgICAgIFRhOiAhMQogICAgICAgICAgICAgICAgfSksIF8uemwoYiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZEKGEsIGIpOwogICAgICAgICAgICAgICAgICAgIGEuai5kZWxldGUoYik7CiAgICAgICAgICAgICAgICAgICAgd0QoYSwgYik7CiAgICAgICAgICAgICAgICB9KSwgUUMoYiwgU0MsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgYyA9IGMuZGV0YWlsOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gKDAsIEYuSCkoYS5qLmdldChiKSk7CiAgICAgICAgICAgICAgICAgICAgZC52YyA9IEcoYywgMzMpIHx8ICcnOwogICAgICAgICAgICAgICAgICAgIGQuVGEgPSAhMDsKICAgICAgICAgICAgICAgICAgICB4RChhLCBiLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGQudmMgPSAnJzsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB5RChhLCBiLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGQuVGEgPSAhMTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5BRCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYywgZDsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSAoZCA9IG51bGwgPT09IChjID0gYS5qLmdldChiKSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5WYSkgJiYgdm9pZCAwICE9PSBkID8gZCA6ICExOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLkJEID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGEuai5nZXQoYikgJiYgKGEuai5nZXQoYikuVmEgPSAhMSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uQ0QgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgYS5qLmdldChiKSAmJiAoYS5qLmdldChiKS5WYSA9ICEwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgREQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKCFiLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICB2YXIgYyA9IFBlKGJbMF0uZ2V0QWRVbml0UGF0aCgpKTsKICAgICAgICAgICAgICAgICgwLCBGLmpiKShiLmV2ZXJ5KGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBlKGcuZ2V0QWRVbml0UGF0aCgpKSA9PT0gYzsKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIHZhciBkID0gW107CiAgICAgICAgICAgICAgICBhID0gXy55KGEuaik7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYS5uZXh0KCk7ICFlLmRvbmU7IGUgPSBhLm5leHQoKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBmID0gXy55KGUudmFsdWUpOwogICAgICAgICAgICAgICAgICAgIGUgPSBmLm5leHQoKS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAoZiA9IGYubmV4dCgpLnZhbHVlLnZjKSAmJiBQZShlLmdldEFkVW5pdFBhdGgoKSkgPT09IGMgJiYgIV8udChiLCAnaW5jbHVkZXMnKS5jYWxsKGIsIGUpICYmIGQucHVzaChmKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICB9OwogICAgICAgICAgICBlayA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYywgZDsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSAoZCA9IG51bGwgPT09IChjID0gYS5qLmdldChiKSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5ZYSkgJiYgdm9pZCAwICE9PSBkID8gZCA6ICcnOwogICAgICAgICAgICB9OwogICAgICAgICAgICBtbCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gKGEgPSBhLmouZ2V0KGIpKSAmJiBhLldjIC0gMSB8fCAwOwogICAgICAgICAgICB9OwogICAgICAgICAgICBFRCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAoMCwgRi5qYikoIWEubS5oYXMoYikpOwogICAgICAgICAgICAgICAgYS5tLnNldChiLCBjKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgeUQgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgKGEgPSBhLmouZ2V0KGIpKSAmJiBhLnRjLnB1c2goYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHhEID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIChhID0gYS5qLmdldChiKSkgJiYgYS51Yy5wdXNoKGMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB3RCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBpZiAoYSA9IGEuai5nZXQoYikpCiAgICAgICAgICAgICAgICAgICAgZm9yIChiID0gYS51Yy5zbGljZSgpLCBhLnVjLmxlbmd0aCA9IDAsIGEgPSBfLnkoYiksIGIgPSBhLm5leHQoKTsgIWIuZG9uZTsgYiA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICBiID0gYi52YWx1ZSwgYigpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBGRCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBpZiAoYSA9IGEuai5nZXQoYikpCiAgICAgICAgICAgICAgICAgICAgZm9yIChiID0gYS50Yy5zbGljZSgpLCBhLnRjLmxlbmd0aCA9IDAsIGEgPSBfLnkoYiksIGIgPSBhLm5leHQoKTsgIWIuZG9uZTsgYiA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICBiID0gYi52YWx1ZSwgYigpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB1RC5wcm90b3R5cGUuVGEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIsIGM7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gKGMgPSBudWxsID09PSAoYiA9IHRoaXMuai5nZXQoYSkpIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuVGEpICYmIHZvaWQgMCAhPT0gYyA/IGMgOiAhMTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHZEID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IGEuai5nZXQoYikpCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT09IChjID0gYS54YykgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy51YSgpLCBkZWxldGUgYS54YzsKICAgICAgICAgICAgICAgIH0sIEdEID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEuRi5nZXQoYik7CiAgICAgICAgICAgICAgICAgICAgYyB8fCAoYyA9IHdpbmRvdyA9PT0gd2luZG93LnRvcCA/ICgrK3NEKS50b1N0cmluZygzNikgOiBIcSgpLCBhLkYuc2V0KGIsIGMpLCBfLnpsKGIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYS5GLmRlbGV0ZShiKTsKICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9LCBJRCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgKDAsIEYuSCkoYS5qLmdldChiKSkuRWMgPSBjOwogICAgICAgICAgICAgICAgICAgIHlEKGEsIGIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgSEQoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBIRCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PT0gKGMgPSBhLmouZ2V0KGIpKSB8fCB2b2lkIDAgPT09IGMgPyAhMCA6IGRlbGV0ZSBjLkVjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgWG0odUQpOwogICAgICAgICAgICB2YXIgSkQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgcmV0dXJuIGEuYWRzZW5zZV9jaGFubmVsX2lkcyA9ICdjaGFubmVsJywgYS5hZHNlbnNlX2FkX3R5cGVzID0gJ2FkX3R5cGUnLCBhLmFkc2Vuc2VfYWRfZm9ybWF0ID0gJ2Zvcm1hdCcsIGEuYWRzZW5zZV9iYWNrZ3JvdW5kX2NvbG9yID0gJ2NvbG9yX2JnJywgYS5hZHNlbnNlX2JvcmRlcl9jb2xvciA9ICdjb2xvcl9ib3JkZXInLCBhLmFkc2Vuc2VfbGlua19jb2xvciA9ICdjb2xvcl9saW5rJywgYS5hZHNlbnNlX3RleHRfY29sb3IgPSAnY29sb3JfdGV4dCcsIGEuYWRzZW5zZV91cmxfY29sb3IgPSAnY29sb3JfdXJsJywgYS5wYWdlX3VybCA9ICd1cmwnLCBhLmFkc2Vuc2VfYWxsb3dfZXhwYW5kYWJsZV9hZHMgPSAnZWEnLCBhLmFkc2Vuc2VfZW5jb2RpbmcgPSAnb2UnLCBhLmFkc2Vuc2VfZmFtaWx5X3NhZmUgPSAnYWRzYWZlJywgYS5hZHNlbnNlX2ZsYXNoX3ZlcnNpb24gPSAnZmxhc2gnLCBhLmFkc2Vuc2VfZm9udF9mYWNlID0gJ2YnLCBhLmFkc2Vuc2VfaGludHMgPSAnaGludHMnLCBhLmFkc2Vuc2Vfa2V5d29yZF90eXBlID0gJ2t3X3R5cGUnLCBhLmFkc2Vuc2Vfa2V5d29yZHMgPSAna3cnLCBhLmFkc2Vuc2VfdGVzdF9tb2RlID0gJ2FkdGVzdCcsIGEuYWx0ZXJuYXRlX2FkX2lmcmFtZV9jb2xvciA9ICdhbHRfY29sb3InLCBhLmFsdGVybmF0ZV9hZF91cmwgPSAnYWx0ZXJuYXRlX2FkX3VybCcsIGEuZGVtb2dyYXBoaWNfYWdlID0gJ2N1c3RfYWdlJywgYS5kZW1vZ3JhcGhpY19nZW5kZXIgPSAnY3VzdF9nZW5kZXInLCBhLmRvY3VtZW50X2xhbmd1YWdlID0gJ2hsJywgYTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGZrID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYsIGcsIGgsIGspIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA3MTgpOwogICAgICAgICAgICAgICAgdGhpcy5HID0gVyh0aGlzLCBiKTsKICAgICAgICAgICAgICAgIHRoaXMuSiA9IFcodGhpcywgYyk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBXKHRoaXMsIGQpOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVyh0aGlzLCBlKTsKICAgICAgICAgICAgICAgIHN2KHRoaXMsIGYpOwogICAgICAgICAgICAgICAgdGhpcy5OID0gVih0aGlzLCBnKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFYodGhpcywgaCk7CiAgICAgICAgICAgICAgICB0aGlzLlYgPSBWKHRoaXMsIGspOwogICAgICAgICAgICAgICAgdGhpcy5ZID0gc2koYSwgWUMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oZmssIFkpOwogICAgICAgICAgICBmay5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYywgZDsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IGUuaikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUtEKGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmV0dXJuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBhLk4udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBhLm8udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uVHIoYywgJ3Zpc2liaWxpdHknLCAnaGlkZGVuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uVHIoYywgJ21pbi13aWR0aCcsICcxMDAlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uVHIoYiwgJ21pbi13aWR0aCcsICcxMDAlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqYihlLCBhLlksIDIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoYS5tKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICBkID0gYi5jb250ZW50RG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFkKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2YoJ2dwdF9hbXBfZmx1aWRfbm9faWZyYW1lZG9jJywgZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRmKGYpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgZS5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICBMRChhLCBiLCBjLCAoMCwgRi5IKShkLmJvZHkpLm9mZnNldFdpZHRoLCBkLmJvZHkub2Zmc2V0SGVpZ2h0KTsKICAgICAgICAgICAgICAgICAgICBMbShlKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgS0QgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gIWEuVi52YWx1ZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBhLmwudmFsdWUgfHwgYS5CLnZhbHVlIHx8ICdoZWlnaHQnICE9PSBhLkoudmFsdWUgfHwgYiA/ICExIDogITA7CiAgICAgICAgICAgICAgICB9LCBMRCA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgYi5zZXRBdHRyaWJ1dGUoJ2hlaWdodCcsIFN0cmluZyhlKSk7CiAgICAgICAgICAgICAgICAgICAgYi5zZXRBdHRyaWJ1dGUoJ3dpZHRoJywgU3RyaW5nKGQpKTsKICAgICAgICAgICAgICAgICAgICBfLlRyKGMsICd2aXNpYmlsaXR5JywgJ3Zpc2libGUnKTsKICAgICAgICAgICAgICAgICAgICBNRChhLCBlLCBkKTsKICAgICAgICAgICAgICAgIH0sIE1EID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGEuRy52YWx1ZTsKICAgICAgICAgICAgICAgICAgICBvZignZ3B0X2ZsdWlkX3N6JywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgSShlLCAnc3onLCBjICsgJ3gnICsgYik7CiAgICAgICAgICAgICAgICAgICAgICAgIEkoZSwgJ3FxaWQnLCBkIHx8ICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgZGYoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIEkoZSwgJ2ZmJywgMSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgYWsgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDY4NSk7CiAgICAgICAgICAgICAgICB2YXIgZiA9IHRoaXM7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkkgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVyh0aGlzLCBjKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFYodGhpcywgZCk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBWKHRoaXMsIGUpOwogICAgICAgICAgICAgICAgc2kodGhpcy5zbG90SWQsIHRpLCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBPcihmLkksIGcuZGV0YWlsKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oYWssIFkpOwogICAgICAgICAgICBhay5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhLCBiOwogICAgICAgICAgICAgICAgaWYgKCFfLkgoZnQpICYmICF0aGlzLkIudmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG51bGwgIT09IChiID0gbnVsbCA9PT0gKGEgPSB0aGlzLmwudmFsdWUpIHx8IHZvaWQgMCA9PT0gYSA/IHZvaWQgMCA6IEcoYSwgMSkpICYmIHZvaWQgMCAhPT0gYiA/IGIgOiAnJywgZCA9IFByKHRoaXMuSSwgdGhpcy5vLnZhbHVlLCBjKTsKICAgICAgICAgICAgICAgICAgICBfLnpsKHRoaXMsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmYoNDkzLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgTkQgPSAvKDxoZWFkKFxzK1tePl0qKT8+KS9pLCBCaiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDY2NSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qYSA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gVih0aGlzLCBhKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm8gPSBXKHRoaXMsIGIpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuQiA9IFcodGhpcywgYyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5HID0gVyh0aGlzLCBkKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkogPSBXKHRoaXMsIGUpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEJqLCBZKTsKICAgICAgICAgICAgQmoucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBpZiAoMCAhPT0gdGhpcy5sLnZhbHVlLmtpbmQgfHwgIUxnKHRoaXMuby52YWx1ZSkgfHwgbXYodGhpcy5CKSkKICAgICAgICAgICAgICAgICAgICB0aGlzLmphLmoodGhpcy5sLnZhbHVlKTsKICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5sLnZhbHVlLndhIHx8ICcnLCBiID0gISF0aGlzLkcudmFsdWUsIGMgPSAhIXRoaXMuSi52YWx1ZTsKICAgICAgICAgICAgICAgICAgICBjIHx8IERhKCkgfHwgKGEgPSBhLnJlcGxhY2UoTkQsICckMTxtZXRhIGh0dHAtZXF1aXY9Q29udGVudC1TZWN1cml0eS1Qb2xpY3kgY29udGVudD0ic2NyaXB0LXNyYyBodHRwczovL2Nkbi5hbXBwcm9qZWN0Lm9yZy87b2JqZWN0LXNyYyBcJ25vbmVcJztjaGlsZC1zcmMgYmxvYjo7ZnJhbWUtc3JjIFwnbm9uZVwnIj4nKSk7CiAgICAgICAgICAgICAgICAgICAgYiAmJiAhYyAmJiAoYSA9IGEucmVwbGFjZShORCwgJyQxPG1ldGEgbmFtZT0icmVmZXJyZXIiIGNvbnRlbnQ9Im9yaWdpbiI+JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuamEuaih7CiAgICAgICAgICAgICAgICAgICAgICAgIGtpbmQ6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdhOiBhCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBSZyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB0aGlzLnB1c2ggPSBLKDc2LCBhLnB1c2guYmluZChhKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhSZywgYkQpOwogICAgICAgICAgICBtZShSZywgMik7CiAgICAgICAgICAgIHZhciBPRCA9IFsKICAgICAgICAgICAgICAgICAgICAnRGVidWcnLAogICAgICAgICAgICAgICAgICAgICdJbmZvJywKICAgICAgICAgICAgICAgICAgICAnV2FybmluZycsCiAgICAgICAgICAgICAgICAgICAgJ0Vycm9yJywKICAgICAgICAgICAgICAgICAgICAnRmF0YWwnCiAgICAgICAgICAgICAgICBdLCBQRCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm1lc3NhZ2UgPSBiOwogICAgICAgICAgICAgICAgICAgIHRoaXMubSA9IGM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy50aW1lc3RhbXAgPSBuZXcgRGF0ZSgpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgcCA9IFBELnByb3RvdHlwZTsKICAgICAgICAgICAgcC5nZXRTbG90ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5nZXRMZXZlbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmo7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuZ2V0VGltZXN0YW1wID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudGltZXN0YW1wOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwLmdldE1lc3NhZ2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5tZXNzYWdlOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudGltZXN0YW1wLnRvVGltZVN0cmluZygpICsgJzogJyArIE9EW3RoaXMual0gKyAnOiAnICsgdGhpcy5tZXNzYWdlOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUUQgPSB7CiAgICAgICAgICAgICAgICAgICAgMjA6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnSWdub3JpbmcgYSBjYWxsIHRvIHNldENvbGxhcHNlRW1wdHlEaXYoZmFsc2UsIHRydWUpLiBTbG90cyB0aGF0IHN0YXJ0IG91dCBjb2xsYXBzZWQgc2hvdWxkIGFsc28gY29sbGFwc2Ugd2hlbiBlbXB0eS4gU2xvdDogJyArIGFbMF0gKyAnLic7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAyMzogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdFcnJvciBpbiBnb29nbGV0YWcuZGlzcGxheTogY291bGQgbm90IGZpbmQgZGl2IHdpdGggaWQgIicgKyBhWzFdICsgJyIgaW4gRE9NIGZvciBzbG90OiAnICsgYVswXSArICcuJzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIDM0OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1NpemUgbWFwcGluZyBpcyBudWxsIGJlY2F1c2UgaW52YWxpZCBtYXBwaW5ncyB3ZXJlIGFkZGVkOiAnICsgYVswXSArICcuJzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIDYwOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0lnbm9yaW5nIHRoZSAnICsgYVswXSArICcoJyArIChhWzFdIHx8ICcnKSArICcpIGNhbGwgc2luY2UgdGhlIHNlcnZpY2UgaXMgYWxyZWFkeSBlbmFibGVkLic7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICA2NjogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdTbG90ICcgKyBhWzBdICsgJyBjYW5ub3QgYmUgcmVmcmVzaGVkIHVudGlsIFB1YkFkc1NlcnZpY2UgaXMgZW5hYmxlZC4nOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgNjg6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdTbG90cyBjYW5ub3QgYmUgY2xlYXJlZCB1bnRpbCBzZXJ2aWNlIGlzIGVuYWJsZWQuJzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIDgwOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1Nsb3Qgb2JqZWN0IGF0IHBvc2l0aW9uICcgKyBhWzBdICsgJyBpcyBvZiBpbmNvcnJlY3QgdHlwZS4nOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgODQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnQ2Fubm90IGZpbmQgdGFyZ2V0aW5nIGF0dHJpYnV0ZSAiJyArIGFbMF0gKyAnIiBmb3IgIicgKyBhWzFdICsgJyIuJzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIDkzOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0ZhaWxlZCB0byByZWdpc3RlciBsaXN0ZW5lci4gVW5rbm93biBldmVudCB0eXBlOiAnICsgYVswXSArICcuJzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIDk2OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0ludmFsaWQgYXJndW1lbnRzOiAnICsgYVswXSArICcoJyArIGFbMV0gKyAnKS4nOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgMTIyOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0ludmFsaWQgYXJndW1lbnQ6ICcgKyBhWzBdICsgJygnICsgYVsxXSArICcpLiBWYWxpZCB2YWx1ZXM6ICcgKyBhWzJdICsgJy4nOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgMTIxOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0ludmFsaWQgb2JqZWN0IHBhc3NlZCB0byAnICsgYVswXSArICcoJyArIGFbMV0gKyAnKSwgZm9yICcgKyBhWzJdICsgJzogJyArIGFbM10gKyAnLic7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAxMDU6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnU1JBIHJlcXVlc3RzIG1heSBpbmNsdWRlIGEgbWF4aW11bSBvZiAzMCBhZCBzbG90cy4gJyArIGFbMV0gKyAnIHdlcmUgcmVxdWVzdGVkLCBzbyB0aGUgbGFzdCAnICsgYVsyXSArICcgd2VyZSBpZ25vcmVkLic7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAxMDY6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnUHVibGlzaGVyIGJldGFzICcgKyBhWzBdICsgJyB3ZXJlIGRlY2xhcmVkIGFmdGVyIGVuYWJsZVNlcnZpY2VzKCkgd2FzIGNhbGxlZC4nOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgMTA3OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1B1Ymxpc2hlciBiZXRhcyBtYXkgb25seSBiZSBkZWNsYXJlZCBvbmNlLiAnICsgYVswXSArICcgd2VyZSBhZGRlZCBhZnRlciBiZXRhcyBoYWQgYWxyZWFkeSBiZWVuIGRlY2xhcmVkLic7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAxMDg6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnQmV0YSBrZXlzIGNhbm5vdCBiZSBjbGVhcmVkLiBjbGVhclRhcmdldGluZygpIHdhcyBjYWxsZWQgb24gJyArIGFbMF0gKyAnLic7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAxMjM6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnUmVmcmVzaCB3YXMgdGhyb3R0bGVkIGZvciBzbG90OiAnICsgYVswXSArICcuJzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIDExMzogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbMF0gKyAnIGFkIHNsb3QgaW5lbGlnaWJsZSBhcyBwYWdlIGlzIG5vdCBtb2JpbGUgb3B0aW1pemVkOiAnICsgYVsxXSArICcuJzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIDExNjogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdUaGUgdW5pcXVlIFNhZmVGcmFtZSBkb21haW4gc2V0dGluZyBpbiBHb29nbGUgQWQgTWFuYWdlciBjb25mbGljdHMgd2l0aCB0aGUgInVzZVVuaXF1ZURvbWFpbiIgc2V0dGluZyBwYXNzZWQgdG8gdGhlIHNldFNhZmVGcmFtZUNvbmZpZyBBUEkgbWV0aG9kLiBHUFQgd2lsbCB1c2UgdXNlVW5pcXVlRG9tYWluPScgKyBhWzBdICsgJyBiYXNlZCBvbiB0aGUgQVBJIGNhbGwuJzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIDExNDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3NldENvcnJlbGF0b3IgaGFzIGJlZW4gZGVwcmVjYXRlZC4gU2VlIHRoZSBHb29nbGUgQWQgTWFuYWdlciBoZWxwIHBhZ2Ugb24gIkNyZWF0aXZlIHNlbGVjdGlvbiBmb3IgbXVsdGlwbGUgYWQgc2xvdHMiIGZvciBtb3JlIGluZm9ybWF0aW9uOiBodHRwczovL3N1cHBvcnQuZ29vZ2xlLmNvbS9hZG1hbmFnZXIvYW5zd2VyLzE4MzI4MS4nOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgMTE1OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndXBkYXRlQ29ycmVsYXRvciBoYXMgYmVlbiBkZXByZWNhdGVkLiBTZWUgdGhlIEdvb2dsZSBBZCBNYW5hZ2VyIGhlbHAgcGFnZSBvbiAiQ3JlYXRpdmUgc2VsZWN0aW9uIGZvciBtdWx0aXBsZSBhZCBzbG90cyIgZm9yIG1vcmUgaW5mb3JtYXRpb246IGh0dHBzOi8vc3VwcG9ydC5nb29nbGUuY29tL2FkbWFuYWdlci9hbnN3ZXIvMTgzMjgxLic7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAxMjA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdDaGVja2luZyBnb29nbGV0YWcucHViYWRzUmVhZHkgaXMgZGlzY291cmFnZWQuIFBsZWFzZSB1c2UgZ29vZ2xldGFnLmNtZC5wdXNoIGluc3RlYWQuJzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIDEyNDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdUbyByZXNlcnZlIHNwYWNlIGFuZCByZWR1Y2UgbGF5b3V0IHNoaWZ0cywgY29uc2lkZXIgc2V0dGluZyBtaW4td2lkdGg9JyArIGFbMl0gKyAncHgsIG1pbi1oZWlnaHQ9JyArIGFbM10gKyAncHggc3R5bGVzIG9uIHRoZSBkaXYgZWxlbWVudCB3aXRoIGlkPScgKyBhWzFdICsgJy4gTGVhcm4gbW9yZTogaHR0cHM6Ly9kZXZlbG9wZXJzLmdvb2dsZS5jb20vcHVibGlzaGVyLXRhZy9ndWlkZXMvbWluaW1pemUtbGF5b3V0LXNoaWZ0JzsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIDEyODogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0NvbnRlbnRTZXJ2aWNlIGlzIGRlcHJlY2F0ZWQuIFRoZSBzZXRDb250ZW50KCkgbWV0aG9kIHdpbGwgaGF2ZSBubyBlZmZlY3QgYWZ0ZXIgSmFudWFyeSAxOCwgMjAyMi4gVGhlIGNvbnRlbnQoKSBtZXRob2Qgd2lsbCBiZSByZW1vdmVkIGZyb20gZ29vZ2xldGFnIGFmdGVyIEp1bHkgMTksIDIwMjIuIFVzZSB0aGUgYnJvd3NlclwncyBidWlsdC1pbiBET00gQVBJcyB0byBkaXJlY3RseSBhZGQgY29udGVudCB0byBkaXYgZWxlbWVudHMgaW5zdGVhZC4nOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgMTMyOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1RheG9ub215IHdpdGggaWQgJyArIGFbMF0gKyAnIGhhcyByZWFjaGVkIHRoZSBsaW1pdCBvZiAnICsgYVsxXSArICcgdmFsdWVzLic7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAxMzM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdObyB0YXhvbm9teSB2YWx1ZXMgd2VyZSBjbGVhcmVkLCBlaXRoZXIgZHVlIHRvIGFuIGludmFsaWQgdGF4b25vbXkgb3Igbm8gdmFsdWVzIHByZXNlbnQuJzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBSRCA9IHsKICAgICAgICAgICAgICAgICAgICAyNjogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdEaXYgSUQgcGFzc2VkIHRvIGdvb2dsZXRhZy5kaXNwbGF5KCkgZG9lcyBub3QgbWF0Y2ggYW55IGRlZmluZWQgc2xvdHM6ICcgKyBhWzBdICsgJy4nOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgMjg6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnRXJyb3IgaW4gZ29vZ2xldGFnLmRlZmluZVNsb3Q6IENhbm5vdCBjcmVhdGUgc2xvdCAnICsgYVsxXSArICcuIERpdiBlbGVtZW50ICInICsgYVswXSArICciIGlzIGFscmVhZHkgYXNzb2NpYXRlZCB3aXRoIGFub3RoZXIgc2xvdDogJyArIGFbMl0gKyAnLic7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICA5MjogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdFeGNlcHRpb24gaW4gJyArIGFbMV0gKyAnIGV2ZW50IGxpc3RlbmVyOiAiJyArIGFbMF0gKyAnIi4nOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgMzA6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnRXhjZXB0aW9uIGluIGdvb2dsZXRhZy5jbWQgZnVuY3Rpb246ICcgKyBhWzBdICsgJy4nOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgMTI1OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2dvb2dsZS1wcm9kdWN0LWFkIGVsZW1lbnQgaXMgaW52YWxpZDogJyArIGFbMF0gKyAnLic7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAxMjY6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdBdHRlbXB0ZWQgdG8gY29sbGVjdCBwcmViaWQgZGF0YSBidXQgd2luZG93LnBianMgaXMgdW5kZWZpbmVkLic7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAxMjc6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnRW5jb3VudGVyZWQgdGhlIGZvbGxvd2luZyBlcnJvciB3aGlsZSBhdHRlbXB0aW5nIHRvIGNvbGxlY3QgcHJlYmlkIG1ldGFkYXRhOiAnICsgYVswXSArICcuJzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgU0QgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5ldmVudHMgPSBuZXcgVUIoMTAwMCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gdGhpcy5tID0gMDsKICAgICAgICAgICAgICAgICAgICB0aGlzLkYgPSB3aW5kb3c7CiAgICAgICAgICAgICAgICB9LCBURCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGplKGEuZXZlbnRzKS5maWx0ZXIoZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuZ2V0U2xvdCgpID09PSBiOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgVUQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBqZShhLmV2ZW50cykuZmlsdGVyKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmdldExldmVsKCkgPj0gYjsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIFNELnByb3RvdHlwZS5sb2cgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzOwogICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/IG51bGwgOiBjOwogICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/ICExIDogZDsKICAgICAgICAgICAgICAgIHZhciBmOwogICAgICAgICAgICAgICAgYyA9IG5ldyBQRChhLCBiLCBudWxsICE9PSAoZiA9IG51bGwgPT09IGMgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5qKSAmJiB2b2lkIDAgIT09IGYgPyBmIDogbnVsbCk7CiAgICAgICAgICAgICAgICB0aGlzLmV2ZW50cy5hZGQoYyk7CiAgICAgICAgICAgICAgICB2YXIgZyA9IF8uSChOcykgJiYgdGhpcy5GID09PSB0b3AsIGggPSBfLnpjKE9zKSAmJiAxMDAgPiB0aGlzLm0sIGsgPSAyID09PSBhIHx8IDMgPT09IGEsIGwgPSB0aGlzLmogPCBfLnpjKFBzKSAmJiBrICYmIF8uci5jb25zb2xlLCBtID0gYi5nZXRNZXNzYWdlQXJncygpLCBuID0gYi5nZXRNZXNzYWdlSWQoKSwgcSA9IFFEW25dIHx8IFJEW25dOwogICAgICAgICAgICAgICAgaCAmJiBrICYmIChiID0gXy56YyhPcyksIG9mKCdncHRfZXZlbnRsb2dfbWVzc2FnZXMnLCBmdW5jdGlvbiAodSkgewogICAgICAgICAgICAgICAgICAgIHZhciBCOwogICAgICAgICAgICAgICAgICAgICsrZS5tOwogICAgICAgICAgICAgICAgICAgIGRmKHUpOwogICAgICAgICAgICAgICAgICAgIEkodSwgJ2xldmVsJywgYSk7CiAgICAgICAgICAgICAgICAgICAgSSh1LCAnbWVzc2FnZUlkJywgbik7CiAgICAgICAgICAgICAgICAgICAgSSh1LCAnYXJncycsIG0uam9pbignfCcpKTsKICAgICAgICAgICAgICAgICAgICBxIHx8IEkodSwgJ25vTXNnJywgITApOwogICAgICAgICAgICAgICAgICAgIHZhciB4ID0gRXJyb3IoKTsKICAgICAgICAgICAgICAgICAgICBJKHUsICdzdGFjaycsIFplKG51bGwgIT09IChCID0geC5zdGFjaykgJiYgdm9pZCAwICE9PSBCID8gQiA6ICcnLCB4Lm1lc3NhZ2UpKTsKICAgICAgICAgICAgICAgIH0sIHsgcGE6IGIgfSkpOwogICAgICAgICAgICAgICAgaWYgKHEpIHsKICAgICAgICAgICAgICAgICAgICBiID0gJ1tHUFRdICcgKyBxKG0pOwogICAgICAgICAgICAgICAgICAgIGlmIChkKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgdmgoYik7CiAgICAgICAgICAgICAgICAgICAgZyAmJiBsICYmIChmdW5jdGlvbiAodSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgQiwgeCwgeiwgQzsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgKDIgPT09IGEgPyBudWxsID09PSAoeCA9IChCID0gXy5yLmNvbnNvbGUpLndhcm4pIHx8IHZvaWQgMCA9PT0geCA/IHZvaWQgMCA6IHguY2FsbChCLCB1KSA6IG51bGwgPT09IChDID0gKHogPSBfLnIuY29uc29sZSkuZXJyb3IpIHx8IHZvaWQgMCA9PT0gQyA/IHZvaWQgMCA6IEMuY2FsbCh6LCB1KSk7CiAgICAgICAgICAgICAgICAgICAgfShiKSwgdGhpcy5qKyspOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFNELnByb3RvdHlwZS5pbmZvID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmxvZygxLCBhLCB2b2lkIDAgPT09IGIgPyBudWxsIDogYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBNID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGEubG9nKDIsIGIsIGMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBTRC5wcm90b3R5cGUuZXJyb3IgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubG9nKDMsIGEsIGIsIHZvaWQgMCA9PT0gYyA/ICExIDogYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBMaCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBfLkhnKFNEKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFRnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBbXSA6IGI7CiAgICAgICAgICAgICAgICB0aGlzLm1lc3NhZ2VJZCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmFyZ3MgPSBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBUZy5wcm90b3R5cGUuZ2V0TWVzc2FnZUlkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWVzc2FnZUlkOwogICAgICAgICAgICB9OwogICAgICAgICAgICBUZy5wcm90b3R5cGUuZ2V0TWVzc2FnZUFyZ3MgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5hcmdzOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVkQgPSBVZygyKSwgV0QgPSBVZygzKSwgWEQgPSBVZyg0KSwgWUQgPSBVZyg1KSwgWkQgPSBVZyg2KSwgJEQgPSBVZygxMiksIGFFID0gVWcoMTQpLCBiRSA9IFVnKDE2KSwgY0UgPSBVZygxOSksIGRFID0gVWcoMjApLCBRaCA9IFVnKDIzKSwgUmggPSBVZygyNiksIGVFID0gVWcoMjgpLCBmRSA9IFVnKDMwKSwgZ0UgPSBVZygzMSksIGhFID0gVWcoMzQpLCBpRSA9IFVnKDM1KSwgakUgPSBVZygzNiksIGtFID0gVWcoMzgpLCBsRSA9IFVnKDQwKSwgbUUgPSBVZyg0OCksIG5FID0gVWcoNTApLCBvRSA9IFVnKDYwKSwgcEUgPSBVZyg2MyksIHFFID0gVWcoNjQpLCByRSA9IFVnKDY2KSwgc0UgPSBVZyg2OCksIHRFID0gVWcoNjkpLCB1RSA9IFVnKDcwKSwgdkUgPSBVZyg3MSksIHdFID0gVWcoNzgpLCB4RSA9IFVnKDgwKSwgeUUgPSBVZyg4MiksIHpFID0gVWcoODQpLCBBRSA9IFVnKDg1KSwgQkUgPSBVZyg4NyksIGhoID0gVWcoODgpLCBDRSA9IFVnKDkyKSwgREUgPSBVZyg5MyksIEVFID0gVWcoOTkpLCBGRSA9IFVnKDEwMyksIEdFID0gVWcoMTA0KSwgSEUgPSBVZygxMDUpLCBJRSA9IFVnKDEwNiksIEpFID0gVWcoMTA3KSwgS0UgPSBVZygxMDgpLCBMRSA9IFVnKDExMyksIE1FID0gVWcoMTE0KSwgTkUgPSBVZygxMTUpLCBPRSA9IFVnKDExNiksIFBFID0gVWcoMTE3KSwgUUUgPSBVZygxMTgpLCBSRSA9IFVnKDExOSksIENsID0gVWcoMTIwKSwgU0UgPSBVZygxMjEpLCBURSA9IFVnKDEyMiksIFVFID0gVWcoMTIzKSwgWGwgPSBVZygxMjUpLCBWRSA9IFVnKDEyNiksIFdFID0gVWcoMTI3KSwgWEUgPSBVZygxMjgpLCBZRSA9IFVnKDEyOSksIFpFID0gVWcoMTMwKSwgJEUgPSBVZygxMzEpLCBhRiA9IFVnKDEzMiksIGJGID0gVWcoMTMzKTsKICAgICAgICAgICAgdmFyIGNGID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNlcnZpY2VOYW1lID0gYjsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNsb3QgPSBhLmo7CiAgICAgICAgICAgICAgICB9LCBkRiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgY0YuY2FsbCh0aGlzLCBhLCBiKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmlzRW1wdHkgPSAhMTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNsb3RDb250ZW50Q2hhbmdlZCA9ICEwOwogICAgICAgICAgICAgICAgICAgIHRoaXMuc291cmNlQWdub3N0aWNMaW5lSXRlbUlkID0gdGhpcy5zb3VyY2VBZ25vc3RpY0NyZWF0aXZlSWQgPSB0aGlzLmxpbmVJdGVtSWQgPSB0aGlzLmxhYmVsSWRzID0gdGhpcy5jcmVhdGl2ZVRlbXBsYXRlSWQgPSB0aGlzLmNyZWF0aXZlSWQgPSB0aGlzLmNhbXBhaWduSWQgPSB0aGlzLmFkdmVydGlzZXJJZCA9IHRoaXMuc2l6ZSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pc0JhY2tmaWxsID0gITE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb21wYW55SWRzID0gdGhpcy55aWVsZEdyb3VwSWRzID0gbnVsbDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhkRiwgY0YpOwogICAgICAgICAgICB2YXIgZUYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBjRi5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oZUYsIGNGKTsKICAgICAgICAgICAgdmFyIGZGID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGNGLmNhbGwodGhpcywgYSwgYik7CiAgICAgICAgICAgICAgICB0aGlzLmluVmlld1BlcmNlbnRhZ2UgPSBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oZkYsIGNGKTsKICAgICAgICAgICAgdmFyIGdGID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgY0YuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGdGLCBjRik7CiAgICAgICAgICAgIHZhciBoRiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGNGLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhoRiwgY0YpOwogICAgICAgICAgICB2YXIgaUYgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgY0YuY2FsbCh0aGlzLCBhLCBiKTsKICAgICAgICAgICAgICAgIHRoaXMucGF5bG9hZCA9IGQ7CiAgICAgICAgICAgICAgICB0aGlzLm1ha2VSZXdhcmRlZFZpc2libGUgPSBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oaUYsIGNGKTsKICAgICAgICAgICAgdmFyIGpGID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGNGLmNhbGwodGhpcywgYSwgYik7CiAgICAgICAgICAgICAgICB0aGlzLnBheWxvYWQgPSB0aGlzLnBheWxvYWQgPSBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oakYsIGNGKTsKICAgICAgICAgICAgdmFyIGtGID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgY0YuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGtGLCBjRik7CiAgICAgICAgICAgIHZhciBsRiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGNGLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhsRiwgY0YpOwogICAgICAgICAgICB2YXIgbUYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBjRi5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8obUYsIGNGKTsKICAgICAgICAgICAgdmFyIG5GID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgY0YuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKG5GLCBjRik7CiAgICAgICAgICAgIHZhciBvRiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGNGLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhvRiwgY0YpOwogICAgICAgICAgICB2YXIgcEYgPSBuZXcgdi5TZXQoKSwgcUYgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gMCwgZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICBkIHx8IChkID0gXy5yLnNldFRpbWVvdXQoZSwgYiksIGEuYXBwbHkoYywgYXJndW1lbnRzKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyB2aCgnUmVhY2hlZCBMaW1pdCBmb3IgYWRkRXZlbnRMaXN0ZW5lcicpOwogICAgICAgICAgICAgICAgfSwgMTAwMCAqIF8uemMoTXMpKSwgckYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgT0MuY2FsbCh0aGlzKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBbXTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkEgPSAhMTsKICAgICAgICAgICAgICAgICAgICB0aGlzLk0gPSAwOwogICAgICAgICAgICAgICAgICAgIHRoaXMubyA9IG5ldyB2Lk1hcCgpOwogICAgICAgICAgICAgICAgICAgIHRoaXMubG9nID0gTGgoKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkcgPSBbXTsKICAgICAgICAgICAgICAgICAgICBwRi5hZGQodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2cuaW5mbyhpRSh0aGlzLmdldE5hbWUoKSkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHJGLCBPQyk7CiAgICAgICAgICAgIHAgPSByRi5wcm90b3R5cGU7CiAgICAgICAgICAgIHAuZW5hYmxlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKCF0aGlzLkEpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLkEgPSAhMDsKICAgICAgICAgICAgICAgICAgICBEYygpLmooNik7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sYygpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSBfLnkodGhpcy5HKSwgYiA9IGEubmV4dCgpOyAhYi5kb25lOyBiID0gYS5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGIudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0aGlzLkcubGVuZ3RoID0gMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5LYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB0aGlzLmoucHVzaChhKTsKICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IGhGKGEsIHRoaXMuZ2V0TmFtZSgpKTsKICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudCgnc2xvdEFkZGVkJywgODE4LCBjKTsKICAgICAgICAgICAgICAgIHRoaXMubG9nLmluZm8obEUodGhpcy5nZXROYW1lKCksIGEuZ2V0QWRVbml0UGF0aCgpKSwgYSk7CiAgICAgICAgICAgICAgICBhID0gdGhpcy5nZXROYW1lKCk7CiAgICAgICAgICAgICAgICBUbyhiLCA0LCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5kZXN0cm95U2xvdHMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSB0aGlzOwogICAgICAgICAgICAgICAgcmV0dXJuIGEuZmlsdGVyKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhKGIuaiwgYyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5hZGRFdmVudExpc3RlbmVyID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gdGhpcywgZDsKICAgICAgICAgICAgICAgIGlmICh0aGlzLk0gPj0gXy56YyhMcykgJiYgMCA8IF8uemMoTHMpKQogICAgICAgICAgICAgICAgICAgIHFGKCk7CiAgICAgICAgICAgICAgICBlbHNlIGlmIChudWxsID09PSAoZCA9IHRoaXMuby5nZXQoYSkpIHx8IHZvaWQgMCA9PT0gZCB8fCAhZC5oYXMoYikpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLm8uaGFzKGEpIHx8IHRoaXMuby5zZXQoYSwgbmV3IHYuTWFwKCkpOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGYuZGV0YWlsOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZywgaDsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIoZik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMubG9nLmVycm9yKENFKFN0cmluZyhrKSwgYSkpLCBudWxsID09PSAoaCA9IG51bGwgPT09IChnID0gd2luZG93LmNvbnNvbGUpIHx8IHZvaWQgMCA9PT0gZyA/IHZvaWQgMCA6IGcuZXJyb3IpIHx8IHZvaWQgMCA9PT0gaCA/IHZvaWQgMCA6IGguY2FsbChnLCBrKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgKDAsIEYuSCkodGhpcy5vLmdldChhKSkuc2V0KGIsIGUpOwogICAgICAgICAgICAgICAgICAgIFFDKHRoaXMsIGEsIGUpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuTSsrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBwLnJlbW92ZUV2ZW50TGlzdGVuZXIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMsIGQgPSBudWxsID09PSAoYyA9IHRoaXMuby5nZXQoYSkpIHx8IHZvaWQgMCA9PT0gYyA/IHZvaWQgMCA6IGMuZ2V0KGIpOwogICAgICAgICAgICAgICAgaWYgKCFkIHx8ICFQQyh0aGlzLCBhLCBkKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICB0aGlzLk0tLTsKICAgICAgICAgICAgICAgIHJldHVybiAoMCwgRi5IKSh0aGlzLm8uZ2V0KGEpKS5kZWxldGUoYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBlbSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gXy55KHBGKSwgYyA9IGIubmV4dCgpOyAhYy5kb25lOyBjID0gYi5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgYy52YWx1ZS5kZXN0cm95U2xvdHMoYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBzRiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHRoaXM7CiAgICAgICAgICAgICAgICB0aGlzLmFkZEV2ZW50TGlzdGVuZXIgPSBLKDg2LCBmdW5jdGlvbiAoYywgZCkgewogICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nICE9PSB0eXBlb2YgZCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oTGgoKSwgV2coJ1NlcnZpY2UuYWRkRXZlbnRMaXN0ZW5lcicsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkCiAgICAgICAgICAgICAgICAgICAgICAgIF0pKSwgYjsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFpnKGMpOwogICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oTGgoKSwgREUoYykpLCBiOwogICAgICAgICAgICAgICAgICAgIGEuYWRkRXZlbnRMaXN0ZW5lcihlLCBkKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVFdmVudExpc3RlbmVyID0gSyg5MDQsIGZ1bmN0aW9uIChjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBaZyhjKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGQgJiYgZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEucmVtb3ZlRXZlbnRMaXN0ZW5lcihlLCBkKTsKICAgICAgICAgICAgICAgICAgICBNKExoKCksIFdnKCdTZXJ2aWNlLnJlbW92ZUV2ZW50TGlzdGVuZXInLCBbCiAgICAgICAgICAgICAgICAgICAgICAgIGMsCiAgICAgICAgICAgICAgICAgICAgICAgIGQKICAgICAgICAgICAgICAgICAgICBdKSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0U2xvdHMgPSBLKDU3MywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmoubWFwKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmo7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0U2xvdElkTWFwID0gSyg1NzQsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0ge30sIGQgPSBfLnkoYS5qKSwgZSA9IGQubmV4dCgpOyAhZS5kb25lOyBlID0gZC5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLnZhbHVlLCBjW2UudG9TdHJpbmcoKV0gPSBlLmo7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZW5hYmxlID0gSyg4NywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmVuYWJsZSgpOwogICAgICAgICAgICAgICAgfSwgITApOwogICAgICAgICAgICAgICAgdGhpcy5nZXROYW1lID0gSyg1NzUsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5nZXROYW1lKCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHNGLCBiRCk7CiAgICAgICAgICAgIHZhciB0RiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB0aGlzLmdldElkID0gSyg1OTMsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5nZXRJZCgpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmdldEFkVW5pdFBhdGggPSBLKDU5NCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmdldEFkVW5pdFBhdGgoKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5nZXROYW1lID0gSyg1OTUsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5nZXROYW1lKCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMudG9TdHJpbmcgPSBLKDU5NiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLnRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0RG9tSWQgPSBLKDU5NywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmdldERvbUlkKCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHVGID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5zb3VyY2VBZ25vc3RpY0xpbmVJdGVtSWQgPSB0aGlzLnNvdXJjZUFnbm9zdGljQ3JlYXRpdmVJZCA9IHRoaXMubGluZUl0ZW1JZCA9IHRoaXMuY3JlYXRpdmVJZCA9IHRoaXMuY2FtcGFpZ25JZCA9IHRoaXMuYWR2ZXJ0aXNlcklkID0gbnVsbDsKICAgICAgICAgICAgICAgIHRoaXMuaXNCYWNrZmlsbCA9ICExOwogICAgICAgICAgICAgICAgdGhpcy5lbmNyeXB0ZWRUcm91Ymxlc2hvb3RpbmdJbmZvID0gdGhpcy5jcmVhdGl2ZVRlbXBsYXRlSWQgPSB0aGlzLmNvbXBhbnlJZHMgPSB0aGlzLnlpZWxkR3JvdXBJZHMgPSBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgdkYgPSAnJywgWGkgPSBudWxsLCB3RiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0genUodHQpIHx8ICcwLTAtMCcsIGIgPSBhLnNwbGl0KCctJykubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE51bWJlcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBjID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzM4JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTnVtYmVyKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGQgPSAwOyBkIDwgYi5sZW5ndGg7IGQrKykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYltkXSA+IGNbZF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJbZF0gPCBjW2RdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAnMS0wLTM4JzsKICAgICAgICAgICAgICAgIH0sIFdpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZGIHx8ICh2RiA9IHdGKCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB2RjsKICAgICAgICAgICAgICAgIH0sIHhGID0gXy5WbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEsIGI7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PT0gKGIgPSBudWxsID09PSAoYSA9IHdpbmRvdy5jb25zb2xlKSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBhLndhcm4pIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuY2FsbChhLCAnZ29vZ2xldGFnLnB1YmFkcygpLnNldFNhZmVGcmFtZUNvbmZpZyh7dXNlVW5pcXVlRG9tYWluOiAuLi59KSBpcyBkZXByZWNhdGVkLCBhbmQgd2lsbCBzdG9wIGhhdmluZyBhbiBlZmZlY3QgaW4gZWFybHkgMjAyMi4nKTsKICAgICAgICAgICAgICAgIH0pLCB5RiA9IF8uVm4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhLCBiOwogICAgICAgICAgICAgICAgICAgIG51bGwgPT09IChiID0gbnVsbCA9PT0gKGEgPSB3aW5kb3cuY29uc29sZSkgfHwgdm9pZCAwID09PSBhID8gdm9pZCAwIDogYS53YXJuKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLmNhbGwoYSwgJ2dvb2dsZXRhZy5wdWJhZHMoKS5zZXRTYWZlRnJhbWVDb25maWcoe3VzZVVuaXF1ZURvbWFpbjogLi4ufSkgaGFzIGJlZW4gcmVtb3ZlZCwgYW5kIG5vIGxvbmdlciBoYXMgYW55IGVmZmVjdC4nKTsKICAgICAgICAgICAgICAgIH0pLCB6RiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBMaCgpLCBjID0gbmV3IGVDKCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8ICFfLmphKGEpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9ICExOwogICAgICAgICAgICAgICAgICAgIF8uZWYoYSwgZnVuY3Rpb24gKGUsIGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2FsbG93T3ZlcmxheUV4cGFuc2lvbic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYm9vbGVhbicgPT09IHR5cGVvZiBlID8gdyhjLCAxLCBhLmFsbG93T3ZlcmxheUV4cGFuc2lvbikgOiBkID0gZyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2FsbG93UHVzaEV4cGFuc2lvbic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYm9vbGVhbicgPT09IHR5cGVvZiBlID8gdyhjLCAyLCBhLmFsbG93UHVzaEV4cGFuc2lvbikgOiBkID0gZyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3NhbmRib3gnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgITAgPT09IGUgPyB3KGMsIDMsIGEuc2FuZGJveCkgOiBkID0gZyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3VzZVVuaXF1ZURvbWFpbic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoXy5IKEhzKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHlGKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXy5IKElzKSAmJiB4RigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Jvb2xlYW4nID09PSB0eXBlb2YgZSA/IHcoYywgNCwgYS51c2VVbmlxdWVEb21haW4pIDogbnVsbCAhPT0gZSAmJiAoZCA9IGcgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBnICYmIGIuZXJyb3IoU0UoJ3NldFNhZmVGcmFtZUNvbmZpZycsIEVyKGEpLCBmLCBFcihlKSkpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkID8gbnVsbCA6IGM7CiAgICAgICAgICAgICAgICB9LCBBRiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBuZXcgZUMoKTsKICAgICAgICAgICAgICAgICAgICBhID0gXy55KGEpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBhLm5leHQoKTsgIWMuZG9uZTsgYyA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IGMudmFsdWUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBZZihjLCAxKSAmJiB3KGIsIDEsIEUoYywgMSkpLCBZZihjLCAyKSAmJiB3KGIsIDIsIEUoYywgMikpLCBZZihjLCAzKSAmJiB3KGIsIDMsIEUoYywgMykpLCBZZihjLCA0KSAmJiB3KGIsIDQsIEUoYywgNCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEJGID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHRoaXMud2lkdGggPSBhOwogICAgICAgICAgICAgICAgdGhpcy5oZWlnaHQgPSBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBCRi5wcm90b3R5cGUuZ2V0V2lkdGggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy53aWR0aDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgQkYucHJvdG90eXBlLmdldEhlaWdodCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmhlaWdodDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIENGID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIE9DLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLkEgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5pbnN0YW5jZSA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLlJhID0gYzsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IG51bGw7CiAgICAgICAgICAgICAgICB0aGlzLmlkID0gdGhpcy5BICsgJ18nICsgdGhpcy5pbnN0YW5jZTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKENGLCBPQyk7CiAgICAgICAgICAgIHAgPSBDRi5wcm90b3R5cGU7CiAgICAgICAgICAgIHAuZ2V0SWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5pZDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5nZXRBZFVuaXRQYXRoID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuQTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5nZXROYW1lID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuQTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcC5PID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaW5zdGFuY2U7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5nZXRJZCgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwLmdldERvbUlkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuUmE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBERiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBhLmogPSBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgeWggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSB0aGlzLCBjID0gTGgoKSwgZCA9IE5oKEtlLk8oKSwgYS5nZXREb21JZCgpKSwgZSA9ICcnLCBmID0gITE7CiAgICAgICAgICAgICAgICBRQyhhLCBUQywgZnVuY3Rpb24gKG0pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG0uZGV0YWlsOwogICAgICAgICAgICAgICAgICAgIG0gPSBuLiRiOwogICAgICAgICAgICAgICAgICAgIG4gPSBuLmlzQmFja2ZpbGw7CiAgICAgICAgICAgICAgICAgICAgbSAmJiAoZSA9IG0sIGYgPSBuKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5zZXQgPSBLKDQwLCBmdW5jdGlvbiAobSwgbikgewogICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPT0gdHlwZW9mIG0gfHwgJ3N0cmluZycgIT09IHR5cGVvZiBuIHx8IHZvaWQgMCA9PT0gSkQoKVttXSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgV2coJ1Nsb3Quc2V0JywgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGEpLCBiOwogICAgICAgICAgICAgICAgICAgIHZhciBxID0gKEwgPSBVYihkLCBmaCwgMyksIF8udChMLCAnZmluZCcpKS5jYWxsKEwsIGZ1bmN0aW9uICh1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjaCh1KSA9PT0gbTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBxID8gZGgocSwgW25dKSA6IChxID0gZWgobmV3IGZoKCksIG0pLCBUbyhxLCAyLCBuKSwgZ2goZCwgMywgZmgsIHEpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5nZXQgPSBLKDQxLCBmdW5jdGlvbiAobSkgewogICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPT0gdHlwZW9mIG0pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNKGMsIFdnKCdTbG90LmdldCcsIFttXSksIGEpLCBudWxsOwogICAgICAgICAgICAgICAgICAgIHZhciBuID0gKEwgPSBVYihkLCBmaCwgMyksIF8udChMLCAnZmluZCcpKS5jYWxsKEwsIGZ1bmN0aW9uIChxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjaChxKSA9PT0gbTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG4gPSBuICYmIE9oKG4sIDIpKSA/IG5bMF0gOiBudWxsOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmdldEF0dHJpYnV0ZUtleXMgPSBLKDQyLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFViKGQsIGZoLCAzKS5tYXAoZnVuY3Rpb24gKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNoKG0pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmFkZFNlcnZpY2UgPSBLKDQzLCBmdW5jdGlvbiAobSkgewogICAgICAgICAgICAgICAgICAgIG0gPSBQaC5nZXQobSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFtKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShjLCBXZygnU2xvdC5hZGRTZXJ2aWNlJywgW21dKSwgYSksIGI7CiAgICAgICAgICAgICAgICAgICAgaWYgKChMID0gT2goZCwgNCksIF8udChMLCAnaW5jbHVkZXMnKSkuY2FsbChMLCBtLmdldE5hbWUoKSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmluZm8oJEQobS5nZXROYW1lKCksIGEudG9TdHJpbmcoKSksIGEpLCBiOwogICAgICAgICAgICAgICAgICAgIG0uS2EoYSwgZCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZGVmaW5lU2l6ZU1hcHBpbmcgPSBLKDQ0LCBmdW5jdGlvbiAobSkgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghQXJyYXkuaXNBcnJheShtKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyB2aCgnU2l6ZSBtYXBwaW5nIG11c3QgYmUgYW4gYXJyYXknKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBtLm1hcCh4aCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHdoKGQsIDYsIG4pOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmYoNDQsIHEpLCB1cignSW5jb3JyZWN0IHVzYWdlIG9mIFNsb3RJbnRlcmZhY2UgZGVmaW5lU2l6ZU1hcHBpbmc6ICcgKyBxLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5zZXRDbGlja1VybCA9IEsoNDUsIGZ1bmN0aW9uIChtKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9PSB0eXBlb2YgbSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgV2coJ1Nsb3Quc2V0Q2xpY2tVcmwnLCBbbV0pLCBhKSwgYjsKICAgICAgICAgICAgICAgICAgICBkLnNldENsaWNrVXJsKG0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLnNldENhdGVnb3J5RXhjbHVzaW9uID0gSyg0NiwgZnVuY3Rpb24gKG0pIHsKICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyAhPT0gdHlwZW9mIG0gfHwgJGcobSkgPyBNKGMsIFdnKCdTbG90LnNldENhdGVnb3J5RXhjbHVzaW9uJywgW21dKSwgYSkgOiAoKEwgPSBPaChkLCA4KSwgXy50KEwsICdpbmNsdWRlcycpKS5jYWxsKEwsIG0pIHx8IFRvKGQsIDgsIG0pLCBjLmluZm8oYUUobSksIGEpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5jbGVhckNhdGVnb3J5RXhjbHVzaW9ucyA9IEsoNDcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB3KGQsIDgsIFJvKTsKICAgICAgICAgICAgICAgICAgICBjLmluZm8oYkUoKSwgYSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0Q2F0ZWdvcnlFeGNsdXNpb25zID0gSyg0OCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBPaChkLCA4KS5zbGljZSgpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLnNldFRhcmdldGluZyA9IEsoNDksIGZ1bmN0aW9uIChtLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWgoYSwgZCwgbSwgbiwgYyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMudXBkYXRlVGFyZ2V0aW5nRnJvbU1hcCA9IEsoNjQ5LCBmdW5jdGlvbiAobSkgewogICAgICAgICAgICAgICAgICAgIGpoKGEsIGQsIG0sIGMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmNsZWFyVGFyZ2V0aW5nID0gSyg1MCwgZnVuY3Rpb24gKG0pIHsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBtKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2goZCwgOSwgdm9pZCAwKSwgYy5pbmZvKGNFKGEuZ2V0QWRVbml0UGF0aCgpKSwgYSksIGI7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBiaChkKSwgcSA9IF8udChuLCAnZmluZEluZGV4JykuY2FsbChuLCBmdW5jdGlvbiAodSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNoKHUpID09PSBtOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA+IHEpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNKGMsIHpFKG0sIGEuZ2V0QWRVbml0UGF0aCgpKSwgYSksIGI7CiAgICAgICAgICAgICAgICAgICAgbi5zcGxpY2UocSwgMSk7CiAgICAgICAgICAgICAgICAgICAgd2goZCwgOSwgbik7CiAgICAgICAgICAgICAgICAgICAgYy5pbmZvKEZFKG0sIGEuZ2V0QWRVbml0UGF0aCgpKSwgYSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0VGFyZ2V0aW5nID0gSyg1MSwgZnVuY3Rpb24gKG0pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT09IHR5cGVvZiBtKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShjLCBXZygnU2xvdC5nZXRUYXJnZXRpbmcnLCBbbV0pLCBhKSwgW107CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAoTCA9IGJoKGQpLCBfLnQoTCwgJ2ZpbmQnKSkuY2FsbChMLCBmdW5jdGlvbiAocSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2gocSkgPT09IG07CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPyBPaChuLCAyKS5zbGljZSgpIDogW107CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0VGFyZ2V0aW5nS2V5cyA9IEsoNTIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYmgoZCkubWFwKGZ1bmN0aW9uIChtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjaChtKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5zZXRDb2xsYXBzZUVtcHR5RGl2ID0gSyg1MywgZnVuY3Rpb24gKG0sIG4pIHsKICAgICAgICAgICAgICAgICAgICBuID0gdm9pZCAwID09PSBuID8gITEgOiBuOwogICAgICAgICAgICAgICAgICAgIGlmICgnYm9vbGVhbicgIT09IHR5cGVvZiBtIHx8ICdib29sZWFuJyAhPT0gdHlwZW9mIG4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNKGMsIFdnKCdTbG90LnNldENvbGxhcHNlRW1wdHlEaXYnLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgICAgICAgICBdKSwgYSksIGI7CiAgICAgICAgICAgICAgICAgICAgdyhkLCAxMCwgbSk7CiAgICAgICAgICAgICAgICAgICAgdyhkLCAxMSwgbSAmJiBuKTsKICAgICAgICAgICAgICAgICAgICBvZignZ3B0X2NlZCcsIGZ1bmN0aW9uIChxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEkocSwgJ3NjJywgRShkLCAxMSkgPyAndCcgOiAnZicpOwogICAgICAgICAgICAgICAgICAgICAgICBJKHEsICdsZXZlbCcsICdzbG90Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGRmKHEpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIG4gJiYgIW0gJiYgTShjLCBkRShhLnRvU3RyaW5nKCkpLCBhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5nZXRBZFVuaXRQYXRoID0gSyg1NCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmdldEFkVW5pdFBhdGgoKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5nZXRTbG90RWxlbWVudElkID0gSyg1OTgsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5nZXREb21JZCgpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLnNldEZvcmNlU2FmZUZyYW1lID0gSyg1NSwgZnVuY3Rpb24gKG0pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Jvb2xlYW4nICE9PSB0eXBlb2YgbSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgV2coJ1Nsb3Quc2V0Rm9yY2VTYWZlRnJhbWUnLCBbU3RyaW5nKG0pXSksIGEpLCBiOwogICAgICAgICAgICAgICAgICAgIHcoZCwgMTIsIG0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLnNldFNhZmVGcmFtZUNvbmZpZyA9IEsoNTYsIGZ1bmN0aW9uIChtKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB6RihtKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIW4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmVycm9yKFdnKCdTbG90LnNldFNhZmVGcmFtZUNvbmZpZycsIFttXSksIGEpLCBiOwogICAgICAgICAgICAgICAgICAgIHpmKGQsIDEzLCBuKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIGcgPSBudWxsOwogICAgICAgICAgICAgICAgUUMoYSwgU0MsIGZ1bmN0aW9uIChtKSB7CiAgICAgICAgICAgICAgICAgICAgbSA9IG0uZGV0YWlsOwogICAgICAgICAgICAgICAgICAgIGlmIChFKG0sIDgpKQogICAgICAgICAgICAgICAgICAgICAgICBnID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IG5ldyB1RigpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICEhRShtLCA5KTsKICAgICAgICAgICAgICAgICAgICAgICAgZy5pc0JhY2tmaWxsID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHEgPSBPaChtLCAxNSksIHUgPSBPaChtLCAxNik7CiAgICAgICAgICAgICAgICAgICAgICAgIHEubGVuZ3RoICYmIHUubGVuZ3RoICYmIChnLnNvdXJjZUFnbm9zdGljQ3JlYXRpdmVJZCA9IHFbMF0sIGcuc291cmNlQWdub3N0aWNMaW5lSXRlbUlkID0gdVswXSwgbiB8fCAoZy5jcmVhdGl2ZUlkID0gcVswXSwgZy5saW5lSXRlbUlkID0gdVswXSwgKG4gPSBPaChtLCAyMikpICYmIG4ubGVuZ3RoICYmIChnLmNyZWF0aXZlVGVtcGxhdGVJZCA9IG5bMF0pKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIE9oKG0sIDE3KS5sZW5ndGggJiYgKG4gPSBPaChtLCAxNylbMF0sIGcuYWR2ZXJ0aXNlcklkID0gbik7CiAgICAgICAgICAgICAgICAgICAgICAgIE9oKG0sIDE4KS5sZW5ndGggJiYgKG4gPSBPaChtLCAxOClbMF0sIGcuY2FtcGFpZ25JZCA9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICBPaChtLCAxOSkubGVuZ3RoICYmIChuID0gT2gobSwgMTkpLCBnLnlpZWxkR3JvdXBJZHMgPSBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgT2gobSwgMjApLmxlbmd0aCAmJiAobiA9IE9oKG0sIDIwKSwgZy5jb21wYW55SWRzID0gbik7CiAgICAgICAgICAgICAgICAgICAgICAgIG0gPSBPaChtLCA0NSk7CiAgICAgICAgICAgICAgICAgICAgICAgIG0gPSBtLmxlbmd0aCAmJiAnc3RyaW5nJyAhPT0gdHlwZW9mIG1bMF0gPyBfLkFkKG0sIEZiKSA6IG07CiAgICAgICAgICAgICAgICAgICAgICAgIG0ubGVuZ3RoICYmIChnLmVuY3J5cHRlZFRyb3VibGVzaG9vdGluZ0luZm8gPSBtWzBdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0UmVzcG9uc2VJbmZvcm1hdGlvbiA9IEsoMzU1LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGc7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0TmFtZSA9IEsoMTcwLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgd2luZG93LmNvbnNvbGUgJiYgY29uc29sZS5lcnJvciAmJiBjb25zb2xlLmVycm9yKCdnZXROYW1lIG9uIFNsb3RJbnRlcmZhY2UgaXMgZGVwcmVjYXRlZCBhbmQgd2lsbCBiZSByZW1vdmVkLiBVc2UgZ2V0QWRVbml0UGF0aCBpbnN0ZWFkLicpOwogICAgICAgICAgICAgICAgICAgIHZhciBtID0gbmV3IGNmKCdzbG90X2dldF9uYW1lJyk7CiAgICAgICAgICAgICAgICAgICAgZGYobSk7CiAgICAgICAgICAgICAgICAgICAgZmYobSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuZ2V0QWRVbml0UGF0aCgpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgaCA9IG5ldyB0RihhKTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0U2xvdElkID0gSyg1NzksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaDsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5nZXRTZXJ2aWNlcyA9IEsoNTgwLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9oKGQsIDQpLm1hcChmdW5jdGlvbiAobSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcWUobSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0U2l6ZXMgPSBLKDU4MSwgZnVuY3Rpb24gKG0sIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG0gPSBWZihkLCBtLCBuKSkgPyBtLm1hcChmdW5jdGlvbiAocSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRShxLCAzKSA/ICdmbHVpZCcgOiBuZXcgQkYocS5nZXRXaWR0aCgpLCBxLmdldEhlaWdodCgpKTsKICAgICAgICAgICAgICAgICAgICB9KSA6IG51bGw7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0Q2xpY2tVcmwgPSBLKDU4MiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBZZihkLCA3KSA/IGQuZ2V0Q2xpY2tVcmwoKSA6ICcnOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmdldFRhcmdldGluZ01hcCA9IEsoNTgzLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbSA9IHt9LCBuID0gXy55KGJoKGQpKSwgcSA9IG4ubmV4dCgpOyAhcS5kb25lOyBxID0gbi5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHEgPSBxLnZhbHVlLCBtW2NoKHEpXSA9IE9oKHEsIDIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBtOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmdldE91dE9mUGFnZSA9IEsoNTg0LCBmdW5jdGlvbiAobSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnbnVtYmVyJyA9PT0gdHlwZW9mIG0gPyBOZihkKSA9PT0gbSA6IDAgIT09IE5mKGQpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmdldENvbGxhcHNlRW1wdHlEaXYgPSBLKDU4NSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBZZihkLCAxMCkgPyBFKGQsIDEwKSA6IG51bGw7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0RGl2U3RhcnRzQ29sbGFwc2VkID0gSyg1ODYsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gWWYoZCwgMTEpID8gRShkLCAxMSkgOiBudWxsOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgayA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgUUMoYSwgVUMsIGZ1bmN0aW9uIChtKSB7CiAgICAgICAgICAgICAgICAgICAgayA9IG0uZGV0YWlsLnJkOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmdldENvbnRlbnRVcmwgPSBLKDU4NywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBrKCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0Rmlyc3RMb29rID0gSyg1ODgsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB1cignVGhlIGdldEZpcnN0TG9vayBtZXRob2Qgb2YgU2xvdEludGVyZmFjZSBpcyBkZXByZWNhdGVkLiBQbGVhc2UgdXBkYXRlIHlvdXIgY29kZSB0byBubyBsb25nZXIgY2FsbCB0aGlzIG1ldGhvZC4nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIGwgPSAnJzsKICAgICAgICAgICAgICAgIFFDKGEsIFNDLCBmdW5jdGlvbiAobSkgewogICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgIGwgPSBudWxsICE9IChuID0gbS5kZXRhaWwuZ2V0RXNjYXBlZFFlbVF1ZXJ5SWQoKSkgPyBuIDogJyc7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0RXNjYXBlZFFlbVF1ZXJ5SWQgPSBLKDU5MSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBsOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmdldEh0bWwgPSBLKDU5MiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmID8gKHdpbmRvdy5jb25zb2xlICYmIGNvbnNvbGUud2FybiAmJiBjb25zb2xlLndhcm4oJ1RoaXMgYWRcJ3MgaHRtbCBjYW5ub3QgYmUgYWNjZXNzZWQgdXNpbmcgdGhlIGdldEh0bWwgbWV0aG9kIG9uIFNsb3RJbnRlcmZhY2UuIFJldHVybmluZyB0aGUgZW1wdHkgc3RyaW5nIGluc3RlYWQuJyksICcnKSA6IGU7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHloLCBiRCk7CiAgICAgICAgICAgIG1lKHloLCA4KTsKICAgICAgICAgICAgdmFyIFRpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMubSA9IFtdOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaG9zdHBhZ2VMaWJyYXJ5VG9rZW5zID0gW107CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0ge307CiAgICAgICAgICAgICAgICB9LCBFRiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFfLnQoYS5tLCAnaW5jbHVkZXMnKS5jYWxsKGEubSwgYikgJiYgKEwgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgXSwgXy50KEwsICdpbmNsdWRlcycpKS5jYWxsKEwsIGIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IF8uSCh1dCkgPyBrd1tiXSA6IGl3W2JdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGIgKyAnX2hvc3RwYWdlX2xpYnJhcnknOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgPSBkaShkb2N1bWVudCwgYykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5pZCA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYS5tLnB1c2goYik7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBuZXcgbHcoYik7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuaG9zdHBhZ2VMaWJyYXJ5VG9rZW5zLnB1c2goYik7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBuZSgpOwogICAgICAgICAgICAgICAgICAgICAgICBhLmhvc3RwYWdlTGlicmFyeVRva2VucyB8fCAoYS5ob3N0cGFnZUxpYnJhcnlUb2tlbnMgPSB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuaG9zdHBhZ2VMaWJyYXJ5VG9rZW5zW2Iual0gPSBiLm07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgRkYgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkOwogICAgICAgICAgICAgICAgICAgIGEualtiXSA9IG51bGwgIT09IChkID0gYS5qW2JdKSAmJiB2b2lkIDAgIT09IGQgPyBkIDogbmV3IHYuU2V0KCk7CiAgICAgICAgICAgICAgICAgICAgYS5qW2JdLmFkZChjKTsKICAgICAgICAgICAgICAgIH0sIEdGID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYywgZDsKICAgICAgICAgICAgICAgICAgICBhID0gbnVsbCAhPT0gKGQgPSBudWxsID09PSAoYyA9IGEualtiXSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogXy50KGMsICd2YWx1ZXMnKS5jYWxsKGMpKSAmJiB2b2lkIDAgIT09IGQgPyBkIDogW107CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtdLmNvbmNhdChfLmxjKGEpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBXdiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgIGEgPSB2b2lkIDAgPT09IGEgPyBLZS5PKCkuaiA6IGE7CiAgICAgICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IF8uciA6IGI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5BID0gJyc7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gdGhpcy5zdG9yYWdlID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSAhMTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHZhciBkID0ge30sIGUgPSB7fSwgZiA9IHt9OwogICAgICAgICAgICAgICAgICAgIHRoaXMuRCA9IChmW0N2XSA9IChkWzE5XSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhRShhLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgfSwgZFsxM10gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnYy5hcHBseSgwLCBhcmd1bWVudHMpLnNvbWUoZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwID09IGMuQS5sYXN0SW5kZXhPZihnLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZFsxMl0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIUUoYSwgNik7CiAgICAgICAgICAgICAgICAgICAgfSwgZFsxMV0gPSBjQSwgZFsxNV0gPSBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5GKGcpOwogICAgICAgICAgICAgICAgICAgIH0sIGRbN10gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIShudWxsID09PSAoZyA9IGIuY3J5cHRvKSB8fCB2b2lkIDAgPT09IGcgfHwgIWcuc3VidGxlKTsKICAgICAgICAgICAgICAgICAgICB9LCBkWzQ4XSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhYy5zdG9yYWdlOwogICAgICAgICAgICAgICAgICAgIH0sIGRbNTFdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5tOwogICAgICAgICAgICAgICAgICAgIH0sIGRbNTNdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhXy5PaSgnTElOSycpLnJlbExpc3Quc3VwcG9ydHMoJ3dlYmJ1bmRsZScpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBkKSwgZltEdl0gPSAoZVs4XSA9IGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gKGggPSBUdShjLnN0b3JhZ2UsIE51bWJlcihnKSkpICYmIHZvaWQgMCAhPT0gaCA/IGggOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgfSwgZVsxMF0gPSBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5qID8gYWcoZyArIGMuaikgJSAxMDAwIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIH0sIGUpLCBmKTsKICAgICAgICAgICAgICAgIH0sIEhGID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBiICYmICFhLmogJiYgKGEuaiA9IF8udChiLnNwbGl0KCc6JyksICdmaW5kJykuY2FsbChiLnNwbGl0KCc6JyksIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwID09PSBjLmluZGV4T2YoJ0lEPScpOwogICAgICAgICAgICAgICAgICAgIH0pIHx8IG51bGwpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIElGID0gXy5WbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdXIoJ1RoZSBnb29nbGV0YWcucHViYWRzKCkuZGVmaW5lUGFzc2JhY2sgZnVuY3Rpb24gaGFzIGJlZW4gZGVwcmVjYXRlZC4gVGhlIGZ1bmN0aW9uIG1heSBicmVhayBpbiBjZXJ0YWluIGNvbnRleHRzLCBzZWUgaHR0cHM6Ly9kZXZlbG9wZXJzLmdvb2dsZS5jb20vcHVibGlzaGVyLXRhZy9ndWlkZXMvcGFzc2JhY2stdGFncyNjb25zdHJ1Y3RfcGFzc2JhY2tfdGFncyBmb3IgaG93IHRvIGNvcnJlY3RseSBjcmVhdGUgYSBwYXNzYmFjay4nKTsKICAgICAgICAgICAgICAgIH0pLCBKaCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSBuZXcgdi5NYXAoKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmNhID0gbmV3IHYuU2V0KCk7CiAgICAgICAgICAgICAgICAgICAgXy5IZyhXdikuRiA9IEtoOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgSmgucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZCA9IHRoaXMsIGUgPSB2b2lkIDAgPT09IGMgPyB7fSA6IGM7CiAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBlLlJhID8gdm9pZCAwIDogZS5SYTsKICAgICAgICAgICAgICAgIHZhciBmID0gdm9pZCAwID09PSBlLmZvcm1hdCA/IDAgOiBlLmZvcm1hdDsKICAgICAgICAgICAgICAgIGUgPSB2b2lkIDAgPT09IGUuUmMgPyAhMSA6IGUuUmM7CiAgICAgICAgICAgICAgICB2YXIgZywgaCA9IEloKGYpOwogICAgICAgICAgICAgICAgaWYgKGgpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9mKCdncHRfcGxhX25zJywgZnVuY3Rpb24gKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgSShsLCAnaXUnLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgSShsLCAnZicsIG51bGwgIT09IGYgJiYgdm9pZCAwICE9PSBmID8gZiA6ICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgSShsLCAnbnNyJywgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGRmKGwpOwogICAgICAgICAgICAgICAgICAgIH0pLCB7fTsKICAgICAgICAgICAgICAgIGUgJiYgSUYoKTsKICAgICAgICAgICAgICAgIGUgPSB0aGlzLmouZ2V0KGEpIHx8IE51bWJlcihlKTsKICAgICAgICAgICAgICAgIGIgPSBudWxsICE9PSAoZyA9IEpGKGEsIGUsIGIsIGMgfHwgJ2dwdF91bml0XycgKyBhICsgJ18nICsgZSkpICYmIHZvaWQgMCAhPT0gZyA/IGcgOiB7fTsKICAgICAgICAgICAgICAgIGMgPSBiLkphOwogICAgICAgICAgICAgICAgdmFyIGsgPSBiLnNsb3RJZDsKICAgICAgICAgICAgICAgIGlmICghaykKICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICB0aGlzLmouc2V0KGEsIGUgKyAxKTsKICAgICAgICAgICAgICAgIHRoaXMuY2EuYWRkKGspOwogICAgICAgICAgICAgICAgXy56bChrLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgZC5jYS5kZWxldGUoayk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIEpDKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBzbG90SWQ6IGssCiAgICAgICAgICAgICAgICAgICAgSmE6IGMKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBLRiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEdGKF8uSGcoVGkpLCBhKS5tYXAoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09PSAoYyA9IEJnKGIsIGRvY3VtZW50KSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5jb250ZW50V2luZG93OwogICAgICAgICAgICAgICAgICAgIH0pLmZpbHRlcihmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFiOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgZm0gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEgPSBfLnkoYSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IGEubmV4dCgpOyAhYi5kb25lOyBiID0gYS5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIG9jKGIudmFsdWUpOwogICAgICAgICAgICAgICAgfSwgVWggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSBfLnkoYS5jYSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IGEubmV4dCgpOyAhYy5kb25lOyBjID0gYS5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID0gYy52YWx1ZSwgYy5nZXREb21JZCgpID09PSBiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9LCBJbCA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/ICExIDogZDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT09IHR5cGVvZiBhICYmIDAgPCBhLmxlbmd0aCAmJiBiICYmICh2b2lkIDAgPT09IGMgfHwgJ3N0cmluZycgPT09IHR5cGVvZiBjKSA/IF8uSGcoSmgpLmFkZChhLCBiLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIFJhOiBjLAogICAgICAgICAgICAgICAgICAgICAgICBSYzogZAogICAgICAgICAgICAgICAgICAgIH0pIDoge307CiAgICAgICAgICAgICAgICB9LCBMRiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBJbChhLCBiLCBjKS5zbG90SWQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKGQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkLmo7CiAgICAgICAgICAgICAgICAgICAgTGgoKS5lcnJvcihXZygnZ29vZ2xldGFnLmRlZmluZVNsb3QnLCBbCiAgICAgICAgICAgICAgICAgICAgICAgIGEsCiAgICAgICAgICAgICAgICAgICAgICAgIGIsCiAgICAgICAgICAgICAgICAgICAgICAgIGMKICAgICAgICAgICAgICAgICAgICBdKSwgdm9pZCAwLCBfLkgoa3MpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0sIE1GID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gXy5tZig3NCwgTEYpOwogICAgICAgICAgICAgICAgICAgIG9lKCdkZWZpbmVTbG90JywgYSk7CiAgICAgICAgICAgICAgICAgICAgb2UoJ2RlZmluZVVuaXQnLCBhKTsKICAgICAgICAgICAgICAgICAgICBvZSgnZ2V0V2luZG93c1RoYXRDYW5Db21tdW5pY2F0ZVdpdGhIb3N0cGFnZUxpYnJhcnknLCBLRik7CiAgICAgICAgICAgICAgICB9LCBKRiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBVaChfLkhnKEpoKSwgZCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBMaCgpLmVycm9yKGVFKGQsIGEsIGUuZ2V0QWRVbml0UGF0aCgpKSksIG51bGw7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBuZXcga0MoKTsKICAgICAgICAgICAgICAgICAgICBsQyh3KGYsIDEsIGEpLCBkKTsKICAgICAgICAgICAgICAgICAgICBjID0gdWgoYyk7CiAgICAgICAgICAgICAgICAgICAgZSA9IGMuRmE7CiAgICAgICAgICAgICAgICAgICAgd2goZiwgNSwgYy5lYyk7CiAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gZSAmJiB6ZihmLCAxNiwgZSk7CiAgICAgICAgICAgICAgICAgICAgR0MoZik7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBuZXcgQ0YoYSwgYiwgZCk7CiAgICAgICAgICAgICAgICAgICAgREYoZywgemgoZykpOwogICAgICAgICAgICAgICAgICAgIF8uemwoZywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IEtlLk8oKSwgayA9IGcuZ2V0RG9tSWQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGgubVtrXTsKICAgICAgICAgICAgICAgICAgICAgICAgaC5GLmRlbGV0ZShnKTsKICAgICAgICAgICAgICAgICAgICAgICAgaCA9IGcuZ2V0QWRVbml0UGF0aCgpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbDsKICAgICAgICAgICAgICAgICAgICAgICAgaCA9IFBlKGgpOwogICAgICAgICAgICAgICAgICAgICAgICBrID0gKG51bGwgIT09IChsID0gRGYuZ2V0KGgpKSAmJiB2b2lkIDAgIT09IGwgPyBsIDogMCkgLSAxOwogICAgICAgICAgICAgICAgICAgICAgICAwID49IGsgPyBEZi5kZWxldGUoaCkgOiBEZi5zZXQoaCwgayk7CiAgICAgICAgICAgICAgICAgICAgICAgIExoKCkuaW5mbyhFRShnLnRvU3RyaW5nKCkpLCBnKTsKICAgICAgICAgICAgICAgICAgICAgICAgXy5IKHpzKSAmJiAoKGwgPSBhRC5nZXQoZykpICYmIFBoLmRlbGV0ZShsKSwgYUQuZGVsZXRlKGcpKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBMaCgpLmluZm8oVkQoZy50b1N0cmluZygpKSwgZyk7CiAgICAgICAgICAgICAgICAgICAgUUMoZywgVUMsIGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSBoLmRldGFpbC5rZTsKICAgICAgICAgICAgICAgICAgICAgICAgTGgoKS5pbmZvKFdEKGcuZ2V0QWRVbml0UGF0aCgpKSwgZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIFFlKFJlLk8oKSwgJzcnLCA5LCBtbCh1RC5PKCksIGcpLCAwLCBoKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBRQyhnLCBTQywgZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSBoLmRldGFpbCwgbDsKICAgICAgICAgICAgICAgICAgICAgICAgTGgoKS5pbmZvKFhEKGcuZ2V0QWRVbml0UGF0aCgpKSwgZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSBSZS5PKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gRyhmLCAyMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGsgPSBudWxsICE9PSAobCA9IGsuZ2V0RXNjYXBlZFFlbVF1ZXJ5SWQoKSkgJiYgdm9pZCAwICE9PSBsID8gbCA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICBoLmogJiYgKF8uci5nb29nbGVfdGltaW5nX3BhcmFtcyA9IF8uci5nb29nbGVfdGltaW5nX3BhcmFtcyB8fCB7fSwgXy5yLmdvb2dsZV90aW1pbmdfcGFyYW1zWydxcWlkLicgKyBtXSA9IGspOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIFFDKGcsIFRDLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIExoKCkuaW5mbyhZRChnLmdldEFkVW5pdFBhdGgoKSksIGcpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIFFDKGcsIFZDLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIExoKCkuaW5mbyhaRChnLmdldEFkVW5pdFBhdGgoKSksIGcpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIEphOiBmLAogICAgICAgICAgICAgICAgICAgICAgICBzbG90SWQ6IGcKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE5GID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJGLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5hZHMgPSBuZXcgdi5NYXAoKTsKICAgICAgICAgICAgICAgIHRoaXMuRCA9IHt9OwogICAgICAgICAgICAgICAgdGhpcy5UID0gdGhpcy5WYSA9ICExOwogICAgICAgICAgICAgICAgXy5IZyhXdikubSA9ICEwOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oTkYsIHJGKTsKICAgICAgICAgICAgcCA9IE5GLnByb3RvdHlwZTsKICAgICAgICAgICAgcC5zZXQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgJ3N0cmluZycgPT09IHR5cGVvZiBhICYmIGEubGVuZ3RoID8gKHRoaXMuRFthXSA9IGIsIHRoaXMubG9nLmluZm8oakUoYSwgU3RyaW5nKGIpLCB0aGlzLmdldE5hbWUoKSkpKSA6IE0odGhpcy5sb2csIFdnKCdDb21wYW5pb25BZHNTZXJ2aWNlLnNldCcsIFsKICAgICAgICAgICAgICAgICAgICBhLAogICAgICAgICAgICAgICAgICAgIGIKICAgICAgICAgICAgICAgIF0pKTsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICB9OwogICAgICAgICAgICBwLmdldCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYjsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSAoYiA9IHRoaXMuRFthXSkgJiYgdm9pZCAwICE9PSBiID8gYiA6IG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuZGlzcGxheSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICB0aGlzLmVuYWJsZSgpOwogICAgICAgICAgICAgICAgYiA9IElsKGEsIGIsIGMpOwogICAgICAgICAgICAgICAgYSA9IGIuc2xvdElkOwogICAgICAgICAgICAgICAgYiA9IGIuSmE7CiAgICAgICAgICAgICAgICB0aGlzLkthKCgwLCBGLkgpKGEpLCAoMCwgRi5IKShiKSk7CiAgICAgICAgICAgICAgICBudWxsID09PSBiIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuc2V0Q2xpY2tVcmwoZCk7CiAgICAgICAgICAgICAgICBTaChudWxsID09PSBhIHx8IHZvaWQgMCA9PT0gYSA/IHZvaWQgMCA6IGEuZ2V0RG9tSWQoKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuS2EgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSB0aGlzOwogICAgICAgICAgICAgICAgUUMoYSwgU0MsIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgRShkLmRldGFpbCwgMTEpICYmIChPRihjLCBhKS5hZSA9ICEwKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgckYucHJvdG90eXBlLkthLmNhbGwodGhpcywgYSwgYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAubGMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHAuc2V0UmVmcmVzaFVuZmlsbGVkU2xvdHMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgJ2Jvb2xlYW4nID09PSB0eXBlb2YgYSAmJiAodGhpcy5WYSA9IGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUEYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIChiID0gdm9pZCAwID09PSBiID8gJycgOiBiKSAmJiAhYS5UICYmIG9mKCdpbWFfc2RrX3YnLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBhLlQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgSShjLCAndicsIGIpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBTdHJpbmcoS2UuTygpLmouZ2V0Q29ycmVsYXRvcigpKTsKICAgICAgICAgICAgICAgIH0sIFFGID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IEtlLk8oKS5qLCBkID0gS2UuTygpLm07CiAgICAgICAgICAgICAgICAgICAgaWYgKGEuQi5BKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0geyBDYTogMyB9OwogICAgICAgICAgICAgICAgICAgICAgICBhLkogJiYgKGUuUGEgPSBhLkopOwogICAgICAgICAgICAgICAgICAgICAgICBhLk4gJiYgKGUuUWEgPSBhLk4pOwogICAgICAgICAgICAgICAgICAgICAgICBiID0gbnVsbCAhPT0gYiAmJiB2b2lkIDAgIT09IGIgPyBiIDogYS5qOwogICAgICAgICAgICAgICAgICAgICAgICBjID0gb2coYywgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBlLlBhOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGUuUWE7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgJiYgJ251bWJlcicgIT09IHR5cGVvZiBkIHx8IGYgJiYgJ251bWJlcicgIT09IHR5cGVvZiBmIHx8IGEuQi5yZWZyZXNoKGMsIGIsIGUpOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAobnVsbCA9PT0gYiB8fCB2b2lkIDAgPT09IGIgPyAwIDogYlswXSkgJiYgYS5sb2cuZXJyb3IockUoYlswXS5nZXREb21JZCgpKSk7CiAgICAgICAgICAgICAgICB9LCBSRiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuQi5BICYmICEobnVsbCA9PT0gKGMgPSBhLmFkcy5nZXQoYikpIHx8IHZvaWQgMCA9PT0gYyB8fCAhYy5hZSk7CiAgICAgICAgICAgICAgICB9LCBTRiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuai5maWx0ZXIoZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8udChiLCAnaW5jbHVkZXMnKS5jYWxsKGIsIGMudG9TdHJpbmcoKSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBORi5wcm90b3R5cGUuZ2V0TmFtZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnY29tcGFuaW9uX2Fkcyc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE5GLnByb3RvdHlwZS5SID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVEYgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIGIgPSBuZXcgZEYoYiwgYS5nZXROYW1lKCkpOwogICAgICAgICAgICAgICAgICAgIG51bGwgIT0gYyAmJiBudWxsICE9IGQgJiYgKGIuc2l6ZSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgYywKICAgICAgICAgICAgICAgICAgICAgICAgZAogICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgIGEuZGlzcGF0Y2hFdmVudCgnc2xvdFJlbmRlckVuZGVkJywgNjcsIGIpOwogICAgICAgICAgICAgICAgfSwgT0YgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYS5hZHMuZ2V0KGIpOwogICAgICAgICAgICAgICAgICAgIGMgfHwgKGMgPSB7fSwgYS5hZHMuc2V0KGIsIGMpLCBfLnpsKGIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYWRzLmRlbGV0ZShiKTsKICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVmggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgc0YuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHZhciBiID0gdGhpczsKICAgICAgICAgICAgICAgIHRoaXMuc2V0ID0gSyg1NzYsIGZ1bmN0aW9uIChjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgYS5zZXQoYywgZCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0ID0gSyg1NzcsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuZ2V0KGMpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmdldEF0dHJpYnV0ZUtleXMgPSBLKDU3OCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjcihhLkQpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmRpc3BsYXkgPSBLKDU1OCwgZnVuY3Rpb24gKGMsIGQsIGUsIGYpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5kaXNwbGF5KGMsIGQsIG51bGwgIT0gZSA/IGUgOiAnJywgbnVsbCAhPSBmID8gZiA6ICcnKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5ub3RpZnlVbmZpbGxlZFNsb3RzID0gSyg2OSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICBhLlZhICYmIFFGKGEsIFNGKGEsIGMpKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5yZWZyZXNoQWxsU2xvdHMgPSBLKDYwLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYS5WYSAmJiBRRihhKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5zZXRWaWRlb1Nlc3Npb24gPSBLKDYxLCBmdW5jdGlvbiAoYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIGEuSiA9IGQ7CiAgICAgICAgICAgICAgICAgICAgYS5OID0gZTsKICAgICAgICAgICAgICAgICAgICAnbnVtYmVyJyA9PT0gdHlwZW9mIGMgJiYgdyhLZS5PKCkuaiwgMjksIGMpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmdldERpc3BsYXlBZHNDb3JyZWxhdG9yID0gSyg2MiwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUEYoYSwgdm9pZCAwID09PSBjID8gJycgOiBjKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5nZXRWaWRlb1N0cmVhbUNvcnJlbGF0b3IgPSBLKDYzLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChjID0gRyhLZS5PKCkuaiwgMjkpKSAmJiB2b2lkIDAgIT09IGMgPyBjIDogMDsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5pc1Nsb3RBUGVyc2lzdGVudFJvYWRibG9jayA9IEsoNjQsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBfLnQoYS5qLCAnZmluZCcpLmNhbGwoYS5qLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5qID09PSBjOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWQgJiYgUkYoYSwgZCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMub25JbXBsZW1lbnRhdGlvbkxvYWRlZCA9IEsoNjUsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBhLmxvZy5pbmZvKG1FKCdHUFQgQ29tcGFuaW9uQWRzJykpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RSZW5kZXJFbmRlZCA9IEsoNjcsIGZ1bmN0aW9uIChjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBfLnQoYS5qLCAnZmluZCcpLmNhbGwoYS5qLCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5qID09PSBjOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmICYmIFRGKGEsIGYsIGQsIGUpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLnNldFJlZnJlc2hVbmZpbGxlZFNsb3RzID0gSyg1OSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5zZXRSZWZyZXNoVW5maWxsZWRTbG90cyhjKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oVmgsIHNGKTsKICAgICAgICAgICAgbWUoVmgsIDMpOwogICAgICAgICAgICB2YXIgVUYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByRi5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oVUYsIHJGKTsKICAgICAgICAgICAgVUYuTyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdNdXN0IGJlIG92ZXJyaWRkZW4nKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFhoID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgVUYuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIHRoaXMuRCA9IG5ldyB2Lk1hcCgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oWGgsIFVGKTsKICAgICAgICAgICAgWGgucHJvdG90eXBlLmdldE5hbWUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJ2NvbnRlbnQnOwogICAgICAgICAgICB9OwogICAgICAgICAgICBYaC5wcm90b3R5cGUuZGlzcGxheSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gJycgOiBjOwogICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/ICcnIDogZDsKICAgICAgICAgICAgICAgIHRoaXMuZW5hYmxlKCk7CiAgICAgICAgICAgICAgICBiID0gSWwoYSwgYiwgYyk7CiAgICAgICAgICAgICAgICBhID0gYi5zbG90SWQ7CiAgICAgICAgICAgICAgICBiID0gYi5KYTsKICAgICAgICAgICAgICAgIHRoaXMuS2EoKDAsIEYuSCkoYSksICgwLCBGLkgpKGIpKTsKICAgICAgICAgICAgICAgIGIuc2V0Q2xpY2tVcmwoZCk7CiAgICAgICAgICAgICAgICBTaChhLmdldERvbUlkKCkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBYaC5wcm90b3R5cGUuZGVzdHJveVNsb3RzID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEgPSBVRi5wcm90b3R5cGUuZGVzdHJveVNsb3RzLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gXy55KGEpLCBjID0gYi5uZXh0KCk7ICFjLmRvbmU7IGMgPSBiLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICB0aGlzLkQuZGVsZXRlKGMudmFsdWUpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBWRiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IGEuRC5nZXQoYiksIGQgPSByZyhiKTsKICAgICAgICAgICAgICAgICEoYyAmJiB2b2lkIDAgIT09IGMuY29udGVudCAmJiBkICYmIGEuQSkgfHwgYyAmJiBjLlZjIHx8IChjLlZjID0gITAsICRhKGQsIE5hKGMuY29udGVudCkpLCBvZignZ3B0X2NvbnRfc3ZjJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZjsKICAgICAgICAgICAgICAgICAgICBJKGUsICdjbCcsIFN0cmluZyhudWxsID09PSAoZiA9IG51bGwgPT09IGMgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5jb250ZW50KSB8fCB2b2lkIDAgPT09IGYgPyB2b2lkIDAgOiBmLmxlbmd0aCkpOwogICAgICAgICAgICAgICAgICAgIGRmKGUsIFtiLmdldEFkVW5pdFBhdGgoKV0pOwogICAgICAgICAgICAgICAgfSksIGEuZGlzcGF0Y2hFdmVudCgnc2xvdFJlbmRlckVuZGVkJywgODE5LCBuZXcgZEYoYiwgYS5nZXROYW1lKCkpKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFhoLnByb3RvdHlwZS5sYyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWGgucHJvdG90eXBlLlIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgVkYodGhpcywgYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFhoLnByb3RvdHlwZS5zZXRDb250ZW50ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gdGhpczsKICAgICAgICAgICAgICAgIGlmIChfLnQodGhpcy5qLCAnaW5jbHVkZXMnKS5jYWxsKHRoaXMuaiwgYSkgJiYgJ3N0cmluZycgPT09IHR5cGVvZiBiICYmIGIubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB0aGlzLkQuZ2V0KGEpOwogICAgICAgICAgICAgICAgICAgIGQgPyBkLmNvbnRlbnQgPSBiIDogdGhpcy5ELnNldChhLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGIsCiAgICAgICAgICAgICAgICAgICAgICAgIFZjOiB2b2lkIDAKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBfLnpsKGEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgYy5ELmRlbGV0ZShhKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBWRih0aGlzLCBhKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgWG0oWGgpOwogICAgICAgICAgICB2YXIgWWggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgc0YuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMuc2V0Q29udGVudCA9IEsoNzIsIGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBfLnQoYS5qLCAnZmluZCcpLmNhbGwoYS5qLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5qID09PSBiOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWQgJiYgYS5zZXRDb250ZW50KGQsIGMpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhZaCwgc0YpOwogICAgICAgICAgICBtZShZaCwgNCk7CiAgICAgICAgICAgIHZhciBXRiA9IFAoWydodHRwczovL2NvbnNvbGUuZ29vZ2xldGFnc2VydmljZXMuY29tL3B1YmNvbnNvbGUvbG9hZGVyLmpzJ10pLCBYRiA9IFAoWycvcHViY29uc29sZS9sb2FkZXIuanMnXSksIGppID0gbnVsbCwgaWkgPSAhMSwgYmkgPSAhMSwgY2kgPSAhMSwgZmkgPSBBKFdGKTsKICAgICAgICAgICAgQShYRik7CiAgICAgICAgICAgIHZhciBZRiA9IF8ubWYoOTQsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gdm9pZCAwID09PSBhID8gXy5yIDogYTsKICAgICAgICAgICAgICAgIG5lKCkuX3B1YmNvbnNvbGVfZGlzYWJsZV8gfHwgbnVsbCAhPT0gYWkoYSkgJiYgZ2koYSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICAnY29tcGxldGUnID09PSBfLnIuZG9jdW1lbnQucmVhZHlTdGF0ZSA/IFlGKCkgOiBfLmZiKF8uciwgJ2xvYWQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBZRigpOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIFpGID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSBMaCgpOwogICAgICAgICAgICAgICAgdGhpcy5nZXRBbGxFdmVudHMgPSBLKDU2MywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiaSA/IGplKGEuZXZlbnRzKS5zbGljZSgpIDogW107CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0RXZlbnRzQnlTbG90ID0gSyg1NjUsIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJpID8gVEQoYSwgYikuc2xpY2UoKSA6IFtdOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLmdldEV2ZW50c0J5TGV2ZWwgPSBLKDU2NiwgZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYmkgPyBVRChhLCBiKS5zbGljZSgpIDogW107CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFpGLCBiRCk7CiAgICAgICAgICAgIG1lKFpGLCA1KTsKICAgICAgICAgICAgdmFyIEpsID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIE9DLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmogPSBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oSmwsIE9DKTsKICAgICAgICAgICAgSmwucHJvdG90eXBlLmdldFNsb3RJZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNsb3RJZDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGJHID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5XYSA9IFJlLk8oKTsKICAgICAgICAgICAgICAgICAgICB3aW5kb3cucGVyZm9ybWFuY2UgJiYgT2cod2luZG93LnBlcmZvcm1hbmNlLm5vdykgJiYgKF8uZmIod2luZG93LCAnRE9NQ29udGVudExvYWRlZCcsIF8ubWYoMzM0LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBfLnkoYi5qKSwgZCA9IGMubmV4dCgpOyAhZC5kb25lOyBkID0gYy5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gXy55KGQudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGUubmV4dCgpLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUubmV4dCgpLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJEYoYiwgZCwgZSkgJiYgYi5qLmRlbGV0ZShkKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pKSwgUUMoYSwgV0MsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gYy5kZXRhaWw7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBkLkNjOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gZC5QOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBhRyhiLCAoMCwgRi5IKShVaChfLkhnKEpoKSwgYykpLCAoMCwgRi5IKShHKGQsIDIwKSkpOwogICAgICAgICAgICAgICAgICAgIH0pLCBRQyhhLCBYQywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBjLmRldGFpbDsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGQuQ2M7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBkLlA7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAoMCwgRi5IKShVaChfLkhnKEpoKSwgYykpOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gKDAsIEYuSCkoRyhkLCAyMCkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGIubS5nZXQoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT0gZSA/IEFCKGUsIGQpIDogYUcoYiwgYywgZCk7CiAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgfSwgYUcgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgICRGKGEsIGIsIGMpID8gYS5qLmRlbGV0ZShiKSA6IChhLmouc2V0KGIsIGMpLCBfLnpsKGIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYS5qLmRlbGV0ZShiKTsKICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICB9LCAkRiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSByZyhiKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiAnRElWJyA9PT0gZC5ub2RlTmFtZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF8uSChVdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBuZXcgeUIoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSTogd2luZG93LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgV2E6IGEuV2EsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSYTogZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHphOiBmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJmKDMzNiwgZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmU6IGUKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkLm0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQUIoZCwgYyksIGEubS5zZXQoYiwgZCksIHlEKHVELk8oKSwgYiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGEubS5kZWxldGUoYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgITA7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBjRyA9IG5ldyB2Lk1hcChbWwogICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICB7IFpkOiAncGFnZV9sZXZlbF9hZHMnIH0KICAgICAgICAgICAgICAgICAgICBdXSksIGRHID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgfSwgZ0c7CiAgICAgICAgICAgIGRHLk8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignTXVzdCBiZSBvdmVycmlkZGVuJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uZUcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5qID0gYSA9IHZvaWQgMCA9PT0gYSA/IGNHIDogYTsKICAgICAgICAgICAgICAgIHRoaXMubSA9IG5ldyB2Lk1hcCgpOwogICAgICAgICAgICAgICAgdGhpcy5sb2FkZWQgPSBuZXcgdi5TZXQoKTsKICAgICAgICAgICAgICAgIHRoaXMuRiA9IG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhfLmVHLCBkRyk7CiAgICAgICAgICAgIF8uZkcgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgYiA9IGIubW9kdWxlOwogICAgICAgICAgICAgICAgYS5tLmhhcyhiKSB8fCBhLm0uc2V0KGIsIG5ldyBHZCgpKTsKICAgICAgICAgICAgICAgIHJldHVybiAoMCwgRi5IKShhLm0uZ2V0KGIpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZ0cgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBiLm1vZHVsZTsKICAgICAgICAgICAgICAgIGIgPSAnX2dwdF9qc19sb2FkXycgKyBjICsgJ18nOwogICAgICAgICAgICAgICAgdmFyIGQgPSBfLm1mKDM0MCwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5qLmhhcyhjKSAmJiAnZnVuY3Rpb24nID09PSB0eXBlb2YgZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9ICgwLCBGLkgpKGEuai5nZXQoYykpOwogICAgICAgICAgICAgICAgICAgICAgICBmID0gKHZvaWQgMCA9PT0gZi50ZCA/IFtdIDogZi50ZCkubWFwKGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXy5mRyhhLCBnKS5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgdi5Qcm9taXNlLmFsbChmKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbCh3aW5kb3csIF8pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShuZSgpLCBiLCB7CiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uZUcucHJvdG90eXBlLmxvYWQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIsIGMgPSBfLmZHKHRoaXMsIGEpLCBkID0gKG51bGwgIT09IChiID0gdGhpcy5qLmdldChhLm1vZHVsZSkpICYmIHZvaWQgMCAhPT0gYiA/IGIgOiB7fSkuWmQ7CiAgICAgICAgICAgICAgICBpZiAoIWQpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ2Nhbm5vdCBsb2FkIGludmFsaWQgbW9kdWxlOiAnICsgZCk7CiAgICAgICAgICAgICAgICBpZiAoIXRoaXMubG9hZGVkLmhhcyhhLm1vZHVsZSkpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IF8uYmZbMTcyXTsKICAgICAgICAgICAgICAgICAgICBlID0gZSAmJiAncGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20nID09PSBacSgoZS5zcmMgfHwgJycpLm1hdGNoKF8uWXEpWzNdIHx8IG51bGwpOwogICAgICAgICAgICAgICAgICAgIHZhciBmID0gKDAsIEYuSCkodGhpcy5GKTsKICAgICAgICAgICAgICAgICAgICBkID0gZWkoWWEoZSA/IGYub2QoZCkgOiBmLnBkKGQpKS50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICBkID0gKGUgPSBfLnpjKHN0KSkgPyB5bihkLCB7IGNiOiBlIH0pIDogZDsKICAgICAgICAgICAgICAgICAgICBnRyh0aGlzLCBhKTsKICAgICAgICAgICAgICAgICAgICBkaShkb2N1bWVudCwgZCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2FkZWQuYWRkKGEubW9kdWxlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBjLnByb21pc2U7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFhtKF8uZUcpOwogICAgICAgICAgICB2YXIgaEcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLnJlc291cmNlcyA9IHt9OwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgdWogPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZikgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg1Nik7CiAgICAgICAgICAgICAgICB0aGlzLksgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5zbG90SWQgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5vYiA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLnRiID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuamEgPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5KID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBXKHRoaXMsIGMpOwogICAgICAgICAgICAgICAgdGhpcy5HID0gVyh0aGlzLCBkKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFcodGhpcywgZSk7CiAgICAgICAgICAgICAgICB0aGlzLk4gPSBXKHRoaXMsIGYpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8odWosIFkpOwogICAgICAgICAgICB2YXIgaUcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgYS5vYi5mYShhLkIudmFsdWUpOwogICAgICAgICAgICAgICAgYS50Yi5mYShhLkcudmFsdWUpOwogICAgICAgICAgICAgICAgYS5qYS5mYShhLm8udmFsdWUpOwogICAgICAgICAgICAgICAganYoYS5KKTsKICAgICAgICAgICAgICAgIGp2KGEubCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHVqLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLk4udmFsdWUsIGIgPSB0aGlzLm8udmFsdWU7CiAgICAgICAgICAgICAgICBpZiAoXy5IKHRzKSAmJiBhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBudWxsID09PSAoYyA9IHRoaXMuSy5qLmdldCh0aGlzLnNsb3RJZCkpIHx8IHZvaWQgMCA9PT0gYyA/IHZvaWQgMCA6IGMuRWM7CiAgICAgICAgICAgICAgICAgICAgZCA9IG51bGwgPT09IGQgfHwgdm9pZCAwID09PSBkID8gdm9pZCAwIDogZC5nZXQoYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFkKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgdmgoJ0NvdWxkIG5vdCBmaW5kIGJpZCB3aXRoIGlkOiAnICsgYSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5KLmooZCk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkLmhlaWdodDsKICAgICAgICAgICAgICAgICAgICBjID0gZC53aWR0aDsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGQuYWRVcmwsIGcgPSBkLmpkLCBoID0gZC5jcG07CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgIT09IGQuZm9ybWF0KQogICAgICAgICAgICAgICAgICAgICAgICBpRyh0aGlzKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFnICYmICFmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHZoKCdDb3VsZCBub3QgZmluZCBhZCB0byByZW5kZXIgZm9yIGJpZCBpZDogJyArIGEpOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gbnVsbCAhPT0gZSAmJiB2b2lkIDAgIT09IGUgPyBlIDogdGhpcy5CLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICBjID0gbnVsbCAhPT0gYyAmJiB2b2lkIDAgIT09IGMgPyBjIDogdGhpcy5HLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICBmID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWQ6IHFpKGcsIG51bGwgIT09IGggJiYgdm9pZCAwICE9PSBoID8gaCA6IDApLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRVcmw6IHFpKGYsIG51bGwgIT09IGggJiYgdm9pZCAwICE9PSBoID8gaCA6IDApLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRJZDogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBkCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSBidG9hKEpTT04uc3RyaW5naWZ5KGYpKTsKICAgICAgICAgICAgICAgICAgICAgICAgMCA9PT0gKG51bGwgPT09IGIgfHwgdm9pZCAwID09PSBiID8gdm9pZCAwIDogYi5raW5kKSA/IChmID0gdGhpcy5qYSwgZyA9IGYuaiwgYiA9IGIud2EucmVwbGFjZShuZXcgUmVnRXhwKCd7e0dPT0dMRV9QQkpTX0FEX0NPTkZJR319Jy5yZXBsYWNlKC8oWy0oKVxbXF17fSs/Ki4kXF58LDojPCFcXF0pL2csICdcXCQxJykucmVwbGFjZSgvXHgwOC9nLCAnXFx4MDgnKSwgJ2cnKSwgaC5yZXBsYWNlKC9cJC9nLCAnJCQkJCcpKSwgZy5jYWxsKGYsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtpbmQ6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3YTogYgogICAgICAgICAgICAgICAgICAgICAgICB9KSwganYodGhpcy5sKSkgOiAodGhpcy5qYS5mYShiKSwgdGhpcy5sLmZhKGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5vYi5mYShudWxsICE9PSBkICYmIHZvaWQgMCAhPT0gZCA/IGQgOiBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy50Yi5mYShudWxsICE9PSBjICYmIHZvaWQgMCAhPT0gYyA/IGMgOiBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LnBvc3RNZXNzYWdlKEpTT04uc3RyaW5naWZ5KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdQcmViaWQgUmVxdWVzdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZElkOiBhCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAnKicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBIRCh0aGlzLkssIHRoaXMuc2xvdElkKTsKICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgIGlHKHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWWogPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZywgaCkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDY4Mik7CiAgICAgICAgICAgICAgICB0aGlzLksgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5mb3JtYXQgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5zbG90SWQgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5JID0gZDsKICAgICAgICAgICAgICAgIHRoaXMuQyA9IHF2KHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVyh0aGlzLCBlKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFYodGhpcywgZik7CiAgICAgICAgICAgICAgICB0aGlzLkcgPSBWKHRoaXMsIGcpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gVyh0aGlzLCBoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFlqLCBZKTsKICAgICAgICAgICAgWWoucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGIsIGMsIGQsIGUsIGYsIGcsIGgsIGssIGw7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKG0pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMiAhPT0gYS5mb3JtYXQgJiYgMyAhPT0gYS5mb3JtYXQgfHwgIW12KGEubCkgfHwgIVNvKGEubC52YWx1ZSwgMTIsICExKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuQy5ub3RpZnkoKSwgbS5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICBiID0gKDAsIEYuSCkoYS5CLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICBjID0gYi5FZDsKICAgICAgICAgICAgICAgICAgICBkID0gXy5BRChhLkssIGEuc2xvdElkKTsKICAgICAgICAgICAgICAgICAgICBlID0gYS5HLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIGYgPSBhLm8udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgXy53aShmLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICdtYXgtaGVpZ2h0JzogJzMwdmgnLAogICAgICAgICAgICAgICAgICAgICAgICBvdmVyZmxvdzogJ2hpZGRlbicKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBpZiAoakcpCiAgICAgICAgICAgICAgICAgICAgICAgIGpHLndlKGYpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBqRyA9IG5ldyBjKGEuZm9ybWF0LCBmLCBhLkksIGUsIGEuSywgYS5zbG90SWQpOwogICAgICAgICAgICAgICAgICAgICAgICBnID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSBfLnkoVWIoYS5sLnZhbHVlLCBJcCwgMTMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChrID0gaC5uZXh0KCk7ICFrLmRvbmU7IGsgPSBoLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBrLnZhbHVlLCBnW0cobCwgMSldID0gRyhsLCAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgakcuQmUoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGpHLmtiKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHhEKGEuSywgYS5zbG90SWQsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpHICYmIChqRy51YSgpLCBqRyA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCAmJiBfLkNEKGEuSywgYS5zbG90SWQpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXy56bChhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfLlZxKGYpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGEuQy5ub3RpZnkoKTsKICAgICAgICAgICAgICAgICAgICBMbShtKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgakcgPSBudWxsOwogICAgICAgICAgICB2YXIgWmogPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZywgaCkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDY4Myk7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmZvcm1hdCA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLlYgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5vID0gVyh0aGlzLCBkKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFYodGhpcywgZSk7CiAgICAgICAgICAgICAgICB0aGlzLkogPSBWKHRoaXMsIGYpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gVyh0aGlzLCBnKTsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IFcodGhpcywgaCk7CiAgICAgICAgICAgICAgICB0aGlzLk4gPSBzaShhLCB0aSwgZnVuY3Rpb24gKGspIHsKICAgICAgICAgICAgICAgICAgICBrID0gay5kZXRhaWw7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBKU09OLnBhcnNlKGsuZGF0YSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RoJyA9PT0gbC5nb29nTXNnVHlwZSAmJiAnaS1hZGZyYW1lLWxvYWQnID09PSBsLm1zZ190eXBlOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oWmosIFkpOwogICAgICAgICAgICBaai5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYywgZCwgZSwgZiwgZywgaCwgazsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAobCkgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IGwuaikgewogICAgICAgICAgICAgICAgICAgICAgICBiID0gYS5vLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWIgfHwgNSAhPT0gYS5mb3JtYXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbC5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGEuSi52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGEubC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9ICgwLCBGLkgpKGEuRy52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBlLkxkOwogICAgICAgICAgICAgICAgICAgICAgICBnID0gbmV3IF8uTUMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaCA9IG5ldyBmKHdpbmRvdywgZCwgYywgZywgYS5WLCByaShVYihiLCBJcCwgMTMpKSwgJzIyNjM5Mzg4MTE1JyA9PT0gUGUoYS5zbG90SWQuZ2V0QWRVbml0UGF0aCgpKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgYS51YSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBhLkIudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICBfLmh1KGEsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICBrID0gXy56YyhndCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoaykgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLkooKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLmogPSAyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDQgIT0gbC5qKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGwsIGEuTiwgNCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLm0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbC5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgaC5KKCEwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbC5qID0gMDsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIga0cgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLm1vZHVsZSA9IDI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGtHLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBTdHJpbmcodGhpcy5tb2R1bGUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLmxHID0gbmV3IGtHKCk7CiAgICAgICAgICAgIHZhciBVaiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODQ2KTsKICAgICAgICAgICAgICAgIHRoaXMuZm9ybWF0ID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuQyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBXKHRoaXMsIGIpOwogICAgICAgICAgICAgICAgdGhpcy5vID0gVyh0aGlzLCBjKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFVqLCBZKTsKICAgICAgICAgICAgVWoucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGIsIGMsIGQsIGUsIGY7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSBnLmopIHsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9ICgyID09PSBhLmZvcm1hdCB8fCAzID09PSBhLmZvcm1hdCkgJiYgIShudWxsID09PSAoYiA9IGEubC52YWx1ZSkgfHwgdm9pZCAwID09PSBiIHx8ICFTbyhiLCAxMiwgITEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IDUgPT09IGEuZm9ybWF0ICYmIGEuby52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjICYmICFkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqdihhLkMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5qID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlID0gYS5DOwogICAgICAgICAgICAgICAgICAgICAgICBmID0gZS5qOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamIoZywgXy5lRy5PKCkubG9hZChfLmxHKSwgMyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGYuY2FsbChlLCBnLm0pOwogICAgICAgICAgICAgICAgICAgIExtKGcpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBtRyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNjk2KTsKICAgICAgICAgICAgICAgIHRoaXMuc2xvdElkID0gYTsKICAgICAgICAgICAgICAgIHRoaXMubWEgPSBiOwogICAgICAgICAgICAgICAgc3YodGhpcywgYyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBuZXcgdi5Qcm9taXNlKGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICdjYW5jZWxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdoYV9iZWZvcmVfbWFrZV92aXNpYmxlJwogICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgXy5IKFhnKSB8fCBlLnB1c2goJ2Nsb3NlZCcpOwogICAgICAgICAgICAgICAgICAgIGUgPSBfLnkoZSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiA9IGUubmV4dCgpOyAhZi5kb25lOyBmID0gZS5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHVpKGEsIGYudmFsdWUpLnRoZW4oZCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKG1HLCBZKTsKICAgICAgICAgICAgbUcucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGIuaikgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGIsIGEubCwgMik7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5tKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIucmV0dXJuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChfLkgoWGcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLmogPSAzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGIsIGEubWEuZGlzcGF0Y2hFdmVudCgncmV3YXJkZWRTbG90Q2FuY2VsZWQnLCA3MDMsIG5ldyBrRihhLnNsb3RJZCwgJ3B1Ymxpc2hlcl9hZHMnKSksIDMpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGIsIGEubWEuZGlzcGF0Y2hFdmVudCgncmV3YXJkZWRTbG90Q2xvc2VkJywgNzAzLCBuZXcgbEYoYS5zbG90SWQsICdwdWJsaXNoZXJfYWRzJykpLCA1KTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgIGEudWEoKSwgTG0oYik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBuRyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNjk3KTsKICAgICAgICAgICAgICAgIHRoaXMuc2xvdElkID0gYTsKICAgICAgICAgICAgICAgIHRoaXMubWEgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5sID0gdWkoYSwgJ2NvbXBsZXRlZCcpOwogICAgICAgICAgICAgICAgc3YodGhpcywgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhuRywgWSk7CiAgICAgICAgICAgIG5HLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gYi5qKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamIoYiwgYS5sLCAyKTsKICAgICAgICAgICAgICAgICAgICBpZiAoMyAhPSBiLmopCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLm0gPyBiLnJldHVybigpIDogamIoYiwgYS5tYS5kaXNwYXRjaEV2ZW50KCdyZXdhcmRlZFNsb3RDb21wbGV0ZWQnLCA3MDQsIG5ldyBtRihhLnNsb3RJZCwgJ3B1Ymxpc2hlcl9hZHMnKSksIDMpOwogICAgICAgICAgICAgICAgICAgIGEudWEoKTsKICAgICAgICAgICAgICAgICAgICBMbShiKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgb0cgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDY5NCk7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLm1hID0gYjsKICAgICAgICAgICAgICAgIHN2KHRoaXMsIGMpOwogICAgICAgICAgICAgICAgdGhpcy5vID0gdWkoYSwgJ2dyYW50ZWQnKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IHVpKGEsICdjbG9zZWQnKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKG9HLCBZKTsKICAgICAgICAgICAgb0cucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGIsIGMsIGQ7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSBlLmopCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqYihlLCBhLm8sIDIpOwogICAgICAgICAgICAgICAgICAgIGlmICgzICE9IGUuaikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgPSBlLm0sIGMgPSBiLnBheWxvYWQsIGEubSA/IGUucmV0dXJuKCkgOiBqYihlLCBhLm1hLmRpc3BhdGNoRXZlbnQoJ3Jld2FyZGVkU2xvdEdyYW50ZWQnLCA3MDIsIG5ldyBqRihhLnNsb3RJZCwgJ3B1Ymxpc2hlcl9hZHMnLCBudWxsICE9PSBjICYmIHZvaWQgMCAhPT0gYyA/IGMgOiBudWxsKSksIDMpOwogICAgICAgICAgICAgICAgICAgIF8uSCh2dCkgPyAoYS5sLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBhLnVhKCk7CiAgICAgICAgICAgICAgICAgICAgfSksIGQgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKSwgWkMoYSwgYS5pZCwgd2luZG93LCAncGFnZWhpZGUnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG9mKCdncHRfcmV3X2NsbycsIGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZihmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkoZiwgJ21zJywgbmV3IERhdGUoKS5nZXRUaW1lKCkgLSBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgeyBwYTogMSB9KTsKICAgICAgICAgICAgICAgICAgICB9KSkgOiBhLnVhKCk7CiAgICAgICAgICAgICAgICAgICAgTG0oZSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHBHID0gewogICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMTAwJScsCiAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiAnMTAwJScsCiAgICAgICAgICAgICAgICAgICAgbGVmdDogJzAnLAogICAgICAgICAgICAgICAgICAgIHRvcDogJzAnCiAgICAgICAgICAgICAgICB9LCBxRyA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDY5Myk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5JID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkcgPSBlOwogICAgICAgICAgICAgICAgICAgIHRoaXMuQyA9IHF2KHRoaXMpOwogICAgICAgICAgICAgICAgICAgIHRoaXMubCA9IFYodGhpcywgYik7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5vID0gVih0aGlzLCBjKTsKICAgICAgICAgICAgICAgICAgICBzdih0aGlzLCBkKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkIgPSBuZXcgXy5qQSh0aGlzLkkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHFHLCBZKTsKICAgICAgICAgICAgcUcucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICBpZiAoIXRoaXMuRy5sKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSAwID09PSBDaCgpID8gJ3JnYmEoMSwxLDEsMC41KScgOiAnd2hpdGUnOwogICAgICAgICAgICAgICAgICAgIF8ud2kodGhpcy5vLnZhbHVlLCBfLnQoT2JqZWN0LCAnYXNzaWduJykuY2FsbChPYmplY3QsIHsKICAgICAgICAgICAgICAgICAgICAgICAgJ2JhY2tncm91bmQtY29sb3InOiBiLAogICAgICAgICAgICAgICAgICAgICAgICBvcGFjaXR5OiAnMScsCiAgICAgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uOiAnZml4ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICBtYXJnaW46ICcwJywKICAgICAgICAgICAgICAgICAgICAgICAgcGFkZGluZzogJzAnLAogICAgICAgICAgICAgICAgICAgICAgICAnei1pbmRleCc6ICcyMTQ3NDgzNjQ3JywKICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheTogJ2Jsb2NrJwogICAgICAgICAgICAgICAgICAgIH0sIHBHKSk7CiAgICAgICAgICAgICAgICAgICAgXy56bCh0aGlzLCBfLnNBKHRoaXMuSS5kb2N1bWVudCwgdGhpcy5JKSk7CiAgICAgICAgICAgICAgICAgICAgY2ModGhpcy5sLnZhbHVlKS5wb3N0TWVzc2FnZShKU09OLnN0cmluZ2lmeSh7CiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdyZXdhcmRlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICd2aXNpYmxlJwogICAgICAgICAgICAgICAgICAgIH0pLCAnKicpOwogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLkkgPT09IHRoaXMuSS50b3ApIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5JLmxvY2F0aW9uLmhhc2ggPSAnZ29vZ19yZXdhcmRlZCc7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IF8ubUEodGhpcy5CKTsKICAgICAgICAgICAgICAgICAgICAgICAgXy5uQShjKTsKICAgICAgICAgICAgICAgICAgICAgICAgXy56bCh0aGlzLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfLm9BKGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dvb2dfcmV3YXJkZWQnID09PSBhLkkubG9jYXRpb24uaGFzaCAmJiAoYS5JLmxvY2F0aW9uLmhhc2ggPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0aGlzLkMubm90aWZ5KCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciByRyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNjk1KTsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBWKHRoaXMsIGIpOwogICAgICAgICAgICAgICAgc3YodGhpcywgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhyRywgWSk7CiAgICAgICAgICAgIHJHLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXMuSSA9PT0gdGhpcy5JLnRvcCkKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9ICgwLCBGLkgpKGNjKHRoaXMubC52YWx1ZSkpLCBiID0gWkModGhpcywgNTAzLCB0aGlzLkksICdoYXNoY2hhbmdlJywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJuKGMub2xkVVJMLCAnI2dvb2dfcmV3YXJkZWQnKSAmJiAoYS5wb3N0TWVzc2FnZShKU09OLnN0cmluZ2lmeSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3Jld2FyZGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiAnYmFja19idXR0b24nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgJyonKSwgYigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBzRyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNjkyKTsKICAgICAgICAgICAgICAgIHRoaXMuc2xvdElkID0gYTsKICAgICAgICAgICAgICAgIHRoaXMubWEgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5DID0gcXYodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBWKHRoaXMsIGMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oc0csIFkpOwogICAgICAgICAgICBzRy5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYywgZCwgZSwgZjsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IGcuaikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgPSBhLmwudmFsdWUsIGQgPSBuZXcgR2QoKSwgZSA9IGQucHJvbWlzZSwgZiA9IGQucmVzb2x2ZSwgYS5tYS5kaXNwYXRjaEV2ZW50KCdyZXdhcmRlZFNsb3RSZWFkeScsIDcwMSwgbmV3IGlGKGEuc2xvdElkLCAncHVibGlzaGVyX2FkcycsIGYsIG51bGwgIT09IChiID0gYy5wYXlsb2FkKSAmJiB2b2lkIDAgIT09IGIgPyBiIDogbnVsbCkpLCBqYihnLCBlLCAyKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5tKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICBhLkMubm90aWZ5KCk7CiAgICAgICAgICAgICAgICAgICAgYS51YSgpOwogICAgICAgICAgICAgICAgICAgIExtKGcpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB0RyA9IHsKICAgICAgICAgICAgICAgICAgICB3aWR0aDogJzEwMCUnLAogICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzEwMCUnLAogICAgICAgICAgICAgICAgICAgIGxlZnQ6ICcwJywKICAgICAgICAgICAgICAgICAgICB0b3A6ICcwJwogICAgICAgICAgICAgICAgfSwgdUcgPSB7CiAgICAgICAgICAgICAgICAgICAgd2lkdGg6ICc2MCUnLAogICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzYwJScsCiAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtOiAndHJhbnNsYXRlKC01MCUsIC01MCUpJywKICAgICAgICAgICAgICAgICAgICBsZWZ0OiAnNTAlJywKICAgICAgICAgICAgICAgICAgICB0b3A6ICc1MCUnCiAgICAgICAgICAgICAgICB9LCB2RyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDY5MSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgIHRoaXMubyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gcXYodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5CID0gVih0aGlzLCBiKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkcgPSB1aShhLCAncHJlZmV0Y2hlZCcpOwogICAgICAgICAgICAgICAgICAgIHVpKGEsICdoYV9iZWZvcmVfbWFrZV92aXNpYmxlJykudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGMubC5ub3RpZnkoKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyh2RywgWSk7CiAgICAgICAgICAgIHZHLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gYy5qKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmwubCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgICAgICBfLndpKGEuQi52YWx1ZSwgXy50KE9iamVjdCwgJ2Fzc2lnbicpLmNhbGwoT2JqZWN0LCB7IHBvc2l0aW9uOiAnYWJzb2x1dGUnIH0sIDAgPT09IENoKCkgPyB1RyA6IHRHKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqYihjLCBhLkcsIDIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBiID0gYy5tOwogICAgICAgICAgICAgICAgICAgIGlmIChhLm0pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgIGEuby5qKGIpOwogICAgICAgICAgICAgICAgICAgIExtKGMpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBiayA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNjg4KTsKICAgICAgICAgICAgICAgIGlmICg0ID09PSBiKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gbmV3IFFjKCk7CiAgICAgICAgICAgICAgICAgICAgXy5odSh0aGlzLCB0aGlzLmwpOwogICAgICAgICAgICAgICAgICAgIHZhciBnID0gbmV3IHZHKGEsIGUpOwogICAgICAgICAgICAgICAgICAgIE4odGhpcy5sLCBnKTsKICAgICAgICAgICAgICAgICAgICBiID0gbmV3IHNHKGEsIGMsIGcubyk7CiAgICAgICAgICAgICAgICAgICAgTih0aGlzLmwsIGIpOwogICAgICAgICAgICAgICAgICAgIGYgPSBuZXcgcUcoZCwgZSwgZiwgYi5DLCBnLmwpOwogICAgICAgICAgICAgICAgICAgIE4odGhpcy5sLCBmKTsKICAgICAgICAgICAgICAgICAgICBOKHRoaXMubCwgbmV3IHJHKGQsIGUsIGYuQykpOwogICAgICAgICAgICAgICAgICAgIE4odGhpcy5sLCBuZXcgb0coYSwgYywgYi5DKSk7CiAgICAgICAgICAgICAgICAgICAgTih0aGlzLmwsIG5ldyBtRyhhLCBjLCBiLkMpKTsKICAgICAgICAgICAgICAgICAgICBOKHRoaXMubCwgbmV3IG5HKGEsIGMsIGIuQykpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oYmssIFkpOwogICAgICAgICAgICBiay5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhOwogICAgICAgICAgICAgICAgbnVsbCA9PT0gKGEgPSB0aGlzLmwpIHx8IHZvaWQgMCA9PT0gYSA/IHZvaWQgMCA6IFNjKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgeGogPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDcwNik7CiAgICAgICAgICAgICAgICB0aGlzLkkgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5DID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFcodGhpcywgYik7CiAgICAgICAgICAgICAgICBzdih0aGlzLCBjKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHhqLCBZKTsKICAgICAgICAgICAgeGoucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMubC52YWx1ZTsKICAgICAgICAgICAgICAgIHRoaXMuQy5mYShhID8gdGMoYSwgdGhpcy5JKSA6IG51bGwpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUWkgPSAnM3JkIHBhcnR5IGFkIGNvbnRlbnQnOwogICAgICAgICAgICB2YXIgd0cgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgXy5ndS5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5qID0gYTsKICAgICAgICAgICAgICAgIHZhciBiID0gYS5zaXplOwogICAgICAgICAgICAgICAgdGhpcy5BID0gJ2hlaWdodCcgPT09IGEuRmQgPyAnZmx1aWQnIDogWwogICAgICAgICAgICAgICAgICAgIGIud2lkdGgsCiAgICAgICAgICAgICAgICAgICAgYi5oZWlnaHQKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyh3RywgXy5ndSk7CiAgICAgICAgICAgIHdHLnByb3RvdHlwZS5yZW5kZXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMuaiwgYiA9IGEuc2xvdElkLCBjID0gYS5MLCBkID0gYS5XLCBlID0gYS5zaXplLCBmID0gYS5EYSwgZyA9IGEuYmIsIGggPSBhLkhjLCBrID0gYS5pc0JhY2tmaWxsOwogICAgICAgICAgICAgICAgYSA9IGEuYmQ7CiAgICAgICAgICAgICAgICBnICYmIEtkKGcsIF8uVHEoZCksIG51bGwgIT09IGggJiYgdm9pZCAwICE9PSBoID8gaCA6ICcnLCAhMSk7CiAgICAgICAgICAgICAgICBjdihSZS5PKCksICc1JywgKDAsIEYuSCkoRyhjLlBbYi5nZXREb21JZCgpXSwgMjApKSk7CiAgICAgICAgICAgICAgICBiLmRpc3BhdGNoRXZlbnQoVEMsIDgwMSwgewogICAgICAgICAgICAgICAgICAgICRiOiAwID09PSBmLmtpbmQgPyBmLndhIDogJycsCiAgICAgICAgICAgICAgICAgICAgaXNCYWNrZmlsbDogISFrCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGMgPSB0aGlzLmwoKTsKICAgICAgICAgICAgICAgIGEgJiYgYyAmJiBjLnNldEF0dHJpYnV0ZSgnZGF0YS1nb29nbGUtY29udGFpbmVyLWlkJywgYSk7CiAgICAgICAgICAgICAgICBiLmRpc3BhdGNoRXZlbnQoVkMsIDgyNSwgeyBzaXplOiBlIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHdHLnByb3RvdHlwZS5sb2FkZWQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSB0aGlzLmosIGMgPSBiLnNsb3RJZCwgZCA9IGIubWE7CiAgICAgICAgICAgICAgICBiID0gYi5MOwogICAgICAgICAgICAgICAgYy5kaXNwYXRjaEV2ZW50KFlDLCA4NDQsIHZvaWQgMCk7CiAgICAgICAgICAgICAgICBhICYmIGEuc2V0QXR0cmlidXRlKCdkYXRhLWxvYWQtY29tcGxldGUnLCAhMCk7CiAgICAgICAgICAgICAgICBkLmRpc3BhdGNoRXZlbnQoJ3Nsb3RPbmxvYWQnLCA3MTAsIG5ldyBnRihjLCAncHVibGlzaGVyX2FkcycpKTsKICAgICAgICAgICAgICAgIGN2KFJlLk8oKSwgJzYnLCAoMCwgRi5IKShHKGIuUFtjLmdldERvbUlkKCldLCAyMCkpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgd0cucHJvdG90eXBlLkYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgIF8uZ3UucHJvdG90eXBlLkYuY2FsbCh0aGlzKTsKICAgICAgICAgICAgICAgIG51bGwgPT09IChhID0gdGhpcy5qLmJiKSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBhLnJlbW92ZUF0dHJpYnV0ZSgnZGF0YS1nb29nbGUtcXVlcnktaWQnKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgd0cucHJvdG90eXBlLm8gPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSB0aGlzLCBkID0gdGhpcy5qLCBlID0gZC5EYSwgZiA9IGQuYmQsIGcgPSBkLkNiLCBoID0gZC4kYSwgayA9IGQuU2E7CiAgICAgICAgICAgICAgICBlID0gMCA9PT0gZS5raW5kID8gZS53YSA6ICcnOwogICAgICAgICAgICAgICAgdmFyIGwgPSBiaihkLlpiLCB6ZyhkLnNsb3RJZCksIFFpLCBiID8gbnVsbCA6IGUsIHRoaXMuQSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGMubG9hZGVkKCgwLCBGLkgpKGwuaikpOwogICAgICAgICAgICAgICAgfSwgYSwgZC5RYiB8fCBudWxsLCBkLlhjIHx8IG51bGwsICEhZC5pc0JhY2tmaWxsLCAhIWQubmMsIG51bGwgIT09IGsgJiYgdm9pZCAwICE9PSBrID8gayA6IG51bGwsICgwLCBGLkgpKGQuTC5SYiksICgwLCBGLkgpKGYpLCBudWxsICE9PSBnICYmIHZvaWQgMCAhPT0gZyA/IGcgOiAnJywgYiwgbnVsbCAhPT0gaCAmJiB2b2lkIDAgIT09IGggPyBoIDogdm9pZCAwKTsKICAgICAgICAgICAgICAgIF8uemwodGhpcywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIDEwMCAhPSBsLnN0YXR1cyAmJiAoMiA9PSBsLlIgJiYgKGFCKGwuRiksIGwuUiA9IDApLCB3aW5kb3cuY2xlYXJUaW1lb3V0KGwuRyksIGwuRyA9IC0xLCBsLk0gPSAzLCBsLm0gJiYgKGwubS51YSgpLCBsLm0gPSBudWxsKSwgbC5CICYmIGwuaiA/IGwuQi51bm9ic2VydmUobC5qKSA6IChfLkxjKHdpbmRvdywgJ3Jlc2l6ZScsIGwuVCksIF8uTGMod2luZG93LCAnc2Nyb2xsJywgbC5UKSksIGwubCAmJiBsLmogJiYgbC5sID09IF8uV3EobC5qKSAmJiBsLmwucmVtb3ZlQ2hpbGQobC5qKSwgbC5qID0gbnVsbCwgbC5sID0gbnVsbCwgbC5CICYmIChsLkIuZGlzY29ubmVjdCgpLCBsLkIgPSBudWxsKSwgbC5zdGF0dXMgPSAxMDApOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICByZXR1cm4gbDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGlqID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgd0cuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGlqLCB3Ryk7CiAgICAgICAgICAgIGlqLnByb3RvdHlwZS5sID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLmosIGIgPSBhLkwsIGMgPSBiLlU7CiAgICAgICAgICAgICAgICBhID0gYi5QW2Euc2xvdElkLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgYiA9IG5ldyBlQygpOwogICAgICAgICAgICAgICAgYyA9IEFGKFsKICAgICAgICAgICAgICAgICAgICBiLAogICAgICAgICAgICAgICAgICAgIGMuQmEoKSwKICAgICAgICAgICAgICAgICAgICBudWxsID09PSBhIHx8IHZvaWQgMCA9PT0gYSA/IHZvaWQgMCA6IGEuQmEoKQogICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICBjID0gd0cucHJvdG90eXBlLm8uY2FsbCh0aGlzLCBjKTsKICAgICAgICAgICAgICAgIHJldHVybiAoMCwgRi5IKShjLmopOwogICAgICAgICAgICB9OwogICAgICAgICAgICBpai5wcm90b3R5cGUubG9hZGVkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gdGhpcy5qLCBjID0gYi5zbG90SWQsIGQgPSBiLkw7CiAgICAgICAgICAgICAgICBiID0gYi5IYzsKICAgICAgICAgICAgICAgIHdHLnByb3RvdHlwZS5sb2FkZWQuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIGEgPSBkLlBbYy5nZXREb21JZCgpXTsKICAgICAgICAgICAgICAgIE5pKGMsIGEsIG51bGwgIT09IGIgJiYgdm9pZCAwICE9PSBiID8gYiA6ICcnKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgaWoucHJvdG90eXBlLkQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB4RyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHdHLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyh4Rywgd0cpOwogICAgICAgICAgICB2YXIgeUcgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgJ3N0cmluZycgIT09IHR5cGVvZiBjICYmIChiLndpZHRoID0gU3RyaW5nKGNbMF0pLCBiLmhlaWdodCA9IFN0cmluZyhjWzFdKSk7CiAgICAgICAgICAgICAgICB2YXIgZSA9IF8ubWYoNzc0LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYS5sb2FkZWQoYik7CiAgICAgICAgICAgICAgICAgICAgXy5MYyhiLCAnbG9hZCcsIGUpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBfLmZiKGIsICdsb2FkJywgZSk7CiAgICAgICAgICAgICAgICBfLnpsKGEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gXy5MYyhiLCAnbG9hZCcsIGUpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBkLmFwcGVuZENoaWxkKGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaGogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB4Ry5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oaGosIHhHKTsKICAgICAgICAgICAgaGoucHJvdG90eXBlLmwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMuaiwgYiA9IGEuRGEsIGMgPSBhLlpiLCBkID0gYS5YYzsKICAgICAgICAgICAgICAgIGEgPSBhLkNiOwogICAgICAgICAgICAgICAgdmFyIGUgPSBTaSh6Zyh0aGlzLmouc2xvdElkKSwgdGhpcy5BLCB2b2lkIDApOwogICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGQgfHwgdm9pZCAwID09PSBkID8gMCA6IGQubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgIGlmIChfLmFvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBfLnkoZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSBkLm5leHQoKTsgIWYuZG9uZTsgZiA9IGQubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zYW5kYm94LmFkZChmLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZS5zYW5kYm94LmFkZC5hcHBseShlLnNhbmRib3gsIF8ubGMoZCkpOwogICAgICAgICAgICAgICAgYSAmJiAoZS5hbGxvdyA9IGEpOwogICAgICAgICAgICAgICAgLTEgPT0gemEoKS5pbmRleE9mKCdpUGhvbmUnKSAmJiAoZS5zcmNkb2MgPSBWYShPbikpOwogICAgICAgICAgICAgICAgeUcodGhpcywgZSwgdGhpcy5BLCBjKTsKICAgICAgICAgICAgICAgIF8udWYoNjUzLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBiLndhLCBoLCBrLCBsLCBtLCBuLCBxLCB1OwogICAgICAgICAgICAgICAgICAgIGcgPSBWaShnLCAnPHNjcmlwdD52YXIgaW5EYXBJRj10cnVlLGluR3B0SUY9dHJ1ZTs8L3NjcmlwdD4nLCAnc2QnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgQiA9IG51bGwgIT09IChrID0gbnVsbCA9PT0gKGggPSBlLmNvbnRlbnRXaW5kb3cpIHx8IHZvaWQgMCA9PT0gaCA/IHZvaWQgMCA6IGguZG9jdW1lbnQpICYmIHZvaWQgMCAhPT0gayA/IGsgOiBlLmNvbnRlbnREb2N1bWVudDsKICAgICAgICAgICAgICAgICAgICBEYSgpICYmIEIub3BlbigndGV4dC9odG1sJywgJ3JlcGxhY2UnKTsKICAgICAgICAgICAgICAgICAgICBjYihCLCBzZChnLCBudWxsKSk7CiAgICAgICAgICAgICAgICAgICAgQm4obnVsbCAhPT0gKG4gPSBudWxsID09PSAobSA9IG51bGwgPT09IChsID0gZS5jb250ZW50V2luZG93KSB8fCB2b2lkIDAgPT09IGwgPyB2b2lkIDAgOiBsLmxvY2F0aW9uKSB8fCB2b2lkIDAgPT09IG0gPyB2b2lkIDAgOiBtLmhyZWYpICYmIHZvaWQgMCAhPT0gbiA/IG4gOiAnJywgJyMnKSAmJiAobnVsbCA9PT0gKHUgPSBudWxsID09PSAocSA9IGUuY29udGVudFdpbmRvdykgfHwgdm9pZCAwID09PSBxID8gdm9pZCAwIDogcS5oaXN0b3J5KSB8fCB2b2lkIDAgPT09IHUgPyB2b2lkIDAgOiB1LnJlcGxhY2VTdGF0ZShudWxsLCAnJywgJyMnICsgTWF0aC5yYW5kb20oKSkpOwogICAgICAgICAgICAgICAgICAgIEIuY2xvc2UoKTsKICAgICAgICAgICAgICAgIH0sICEwKTsKICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICB9OwogICAgICAgICAgICBoai5wcm90b3R5cGUuRCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHpHID0gJzAxMjM0NTY3ODlBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6Jy5zcGxpdCgnJyk7CiAgICAgICAgICAgIHZhciBnaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHhHLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhnaiwgeEcpOwogICAgICAgICAgICBnai5wcm90b3R5cGUubCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5qLCBiID0gYS5EYTsKICAgICAgICAgICAgICAgIGEgPSBhLlpiOwogICAgICAgICAgICAgICAgdmFyIGMgPSBTaSh6Zyh0aGlzLmouc2xvdElkKSwgdGhpcy5BLCAhMCk7CiAgICAgICAgICAgICAgICBlaihjLCBiLnRlKTsKICAgICAgICAgICAgICAgIHlHKHRoaXMsIGMsIHRoaXMuQSwgYSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZ2oucHJvdG90eXBlLkQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBmaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHhHLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhmaiwgeEcpOwogICAgICAgICAgICBmai5wcm90b3R5cGUubCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5qLCBiID0gYS5MLCBjID0gYS5EYS51cmwsIGQgPSBiLlU7CiAgICAgICAgICAgICAgICBhID0gYi5QW2Euc2xvdElkLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgZCA9IEFGKFsKICAgICAgICAgICAgICAgICAgICBkLkJhKCksCiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PT0gYSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBhLkJhKCkKICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgdmFyIGUgPSBTaSh6Zyh0aGlzLmouc2xvdElkKSwgdGhpcy5BLCB2b2lkIDApOwogICAgICAgICAgICAgICAgZWooZSwgYyk7CiAgICAgICAgICAgICAgICB4Ry5wcm90b3R5cGUuby5jYWxsKHRoaXMsIGQsIGUpOwogICAgICAgICAgICAgICAgdmFyIGYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZS5yZW1vdmVFdmVudExpc3RlbmVyKCdsb2FkJywgZik7CiAgICAgICAgICAgICAgICAgICAgQUcoYyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgZik7CiAgICAgICAgICAgICAgICB6cihlLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgQUcoYyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQUcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yQWxsKCdsaW5rW3JlbD13ZWJidW5kbGVdW3Jlc291cmNlcyo9XCcnICsgYSArICdcJ10nKTsKICAgICAgICAgICAgICAgIGlmICgxID09PSBiLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYlswXTsKICAgICAgICAgICAgICAgICAgICBjLnJlc291cmNlcy5yZW1vdmUoYSk7CiAgICAgICAgICAgICAgICAgICAgYy5yZXNvdXJjZXMubGVuZ3RoIHx8IGJbMF0ucmVtb3ZlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGZqLnByb3RvdHlwZS5EID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVmogPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZywgaCwgaywgbCwgbSwgbiwgcSwgdSwgQiwgeCwgeiwgQywgRCwgSiwgVCwgYWEsIFgsIFMsIGNhKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNjgwKTsKICAgICAgICAgICAgICAgIHRoaXMuc2xvdElkID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuSyA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLkwgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5tYSA9IGQ7CiAgICAgICAgICAgICAgICB0aGlzLkkgPSBlOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuSiA9IFYodGhpcywgZik7CiAgICAgICAgICAgICAgICBzdih0aGlzLCBoKTsKICAgICAgICAgICAgICAgIHRoaXMuZWEgPSBWKHRoaXMsIGspOwogICAgICAgICAgICAgICAgdGhpcy5HID0gVih0aGlzLCBsKTsKICAgICAgICAgICAgICAgIHRoaXMuZGEgPSBWKHRoaXMsIG0pOwogICAgICAgICAgICAgICAgdGhpcy4kID0gVih0aGlzLCBuKTsKICAgICAgICAgICAgICAgIHN2KHRoaXMsIEopOwogICAgICAgICAgICAgICAgdGhpcy5OID0gVyh0aGlzLCBxKTsKICAgICAgICAgICAgICAgIHRoaXMuViA9IFcodGhpcywgdSk7CiAgICAgICAgICAgICAgICB0aGlzLlkgPSBXKHRoaXMsIEIpOwogICAgICAgICAgICAgICAgdGhpcy50YSA9IFcodGhpcywgeCk7CiAgICAgICAgICAgICAgICB0aGlzLlogPSBXKHRoaXMsIHopOwogICAgICAgICAgICAgICAgdGhpcy5uYSA9IFcodGhpcywgQyk7CiAgICAgICAgICAgICAgICB0aGlzLnhhID0gVyh0aGlzLCBEKTsKICAgICAgICAgICAgICAgIHRoaXMuc2EgPSBXKHRoaXMsIGcpOwogICAgICAgICAgICAgICAgc3YodGhpcywgVCk7CiAgICAgICAgICAgICAgICBzdih0aGlzLCBhYSk7CiAgICAgICAgICAgICAgICB0aGlzLmthID0gVih0aGlzLCBYKTsKICAgICAgICAgICAgICAgIHN2KHRoaXMsIFMpOwogICAgICAgICAgICAgICAgdGhpcy5yYSA9IFcodGhpcywgY2EpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oVmosIFkpOwogICAgICAgICAgICBWai5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiA9IHRoaXMuTi52YWx1ZSwgYyA9IHRoaXMuSi52YWx1ZTsKICAgICAgICAgICAgICAgIGlmICgwID09PSBjLmtpbmQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IG51bGwgPT09IGIgfHwgdm9pZCAwID09PSBiID8gdm9pZCAwIDogRmIoYi5nZXRIdG1sKCkpOwogICAgICAgICAgICAgICAgICAgIGQgJiYgKGMud2EgPSBkKTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBjLndhKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgZHYoJ2ludmFsaWQgaHRtbCcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYiA9IGpqKHsKICAgICAgICAgICAgICAgICAgICBpZDogdGhpcy4kLnZhbHVlLAogICAgICAgICAgICAgICAgICAgIFc6IGRvY3VtZW50LAogICAgICAgICAgICAgICAgICAgIHNsb3RJZDogdGhpcy5zbG90SWQsCiAgICAgICAgICAgICAgICAgICAgSzogdGhpcy5LLAogICAgICAgICAgICAgICAgICAgIEw6IHRoaXMuTCwKICAgICAgICAgICAgICAgICAgICBtYTogdGhpcy5tYSwKICAgICAgICAgICAgICAgICAgICBzaXplOiB0aGlzLmRhLnZhbHVlLAogICAgICAgICAgICAgICAgICAgIERhOiBjLAogICAgICAgICAgICAgICAgICAgIGJiOiB0aGlzLmVhLnZhbHVlLAogICAgICAgICAgICAgICAgICAgIFpiOiB0aGlzLkcudmFsdWUsCiAgICAgICAgICAgICAgICAgICAgSGM6IHRoaXMuVi52YWx1ZSwKICAgICAgICAgICAgICAgICAgICBGZDogdGhpcy5ZLnZhbHVlLAogICAgICAgICAgICAgICAgICAgIFhjOiB0aGlzLnRhLnZhbHVlLAogICAgICAgICAgICAgICAgICAgIFNhOiBudWxsID09PSBiIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IEcoYiwgMiksCiAgICAgICAgICAgICAgICAgICAgaXNCYWNrZmlsbDogdGhpcy5aLnZhbHVlLAogICAgICAgICAgICAgICAgICAgIG5jOiB0aGlzLm5hLnZhbHVlLAogICAgICAgICAgICAgICAgICAgIGJkOiB0aGlzLnhhLnZhbHVlLAogICAgICAgICAgICAgICAgICAgIFFiOiB0aGlzLnNhLnZhbHVlLAogICAgICAgICAgICAgICAgICAgIENiOiB0aGlzLmthLnZhbHVlLAogICAgICAgICAgICAgICAgICAgICRhOiB0aGlzLnJhLnZhbHVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIF8uaHUodGhpcywgYik7CiAgICAgICAgICAgICAgICB2YXIgZSA9IGIucmVuZGVyKCk7CiAgICAgICAgICAgICAgICBaQyh0aGlzLCB0aGlzLmlkLCB0aGlzLkksICdtZXNzYWdlJywgZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICBlLmNvbnRlbnRXaW5kb3cgPT09IGYuc291cmNlICYmIGEuc2xvdElkLmRpc3BhdGNoRXZlbnQodGksIDgyNCwgZik7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuQi5ub3RpZnkoKTsKICAgICAgICAgICAgICAgIHRoaXMubC5qKGUpOwogICAgICAgICAgICAgICAgdGhpcy5vLmooYi5EKCkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZGsgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg2Myk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5ZYSA9IE51bWJlcihhKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFYodGhpcywgYyk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBWKHRoaXMsIGQpOwogICAgICAgICAgICAgICAgdGhpcy5HID0gQkcodGhpcyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhkaywgWSk7CiAgICAgICAgICAgIHZhciBCRyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi5yZXR1cm4obmV3IHYuUHJvbWlzZShmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgWkMoYSwgYS5pZCwgYS5sLCAnbWVzc2FnZScsIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FzbXJlcScgPT09IChudWxsID09PSAoZSA9IGQuZGF0YSkgfHwgdm9pZCAwID09PSBlID8gdm9pZCAwIDogZS50eXBlKSAmJiBzayhTbChaeiwgZC5kYXRhLnBheWxvYWQpLCAxKSA9PT0gYS5ZYSAmJiBjKGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBkay5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYywgZCwgZSwgZiwgZzsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IGguaikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgPSBraihhLmwpLCBjID0gYS5vLnZhbHVlLCBkID0gYS5CLnZhbHVlLCBqYihoLCBhLkcsIDIpOwogICAgICAgICAgICAgICAgICAgIGUgPSBoLm07CiAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSBhLmwsIGwgPSBraihrKTsKICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IGMuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBiYyhrKSA/IGhnKGMsIGspIDogewogICAgICAgICAgICAgICAgICAgICAgICB4OiAwLAogICAgICAgICAgICAgICAgICAgICAgICB5OiAwCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBrID0gbi54OwogICAgICAgICAgICAgICAgICAgIG4gPSBuLnk7CiAgICAgICAgICAgICAgICAgICAgbSA9IG5ldyBfLkdyKG4sIGsgKyBtLnJpZ2h0LCBuICsgbS5ib3R0b20sIGspOwogICAgICAgICAgICAgICAgICAgIGsgPSBuZXcgYUEoKTsKICAgICAgICAgICAgICAgICAgICBrID0gdyhrLCAxLCBtLnRvcCk7CiAgICAgICAgICAgICAgICAgICAgayA9IHcoaywgMywgbS5ib3R0b20pOwogICAgICAgICAgICAgICAgICAgIGsgPSB3KGssIDIsIG0ubGVmdCk7CiAgICAgICAgICAgICAgICAgICAgbSA9IHcoaywgNCwgbS5yaWdodCk7CiAgICAgICAgICAgICAgICAgICAgayA9IG5ldyAkeigpOwogICAgICAgICAgICAgICAgICAgIGsgPSB3KGssIDEsIGEuWWEpOwogICAgICAgICAgICAgICAgICAgIGsgPSB3KGssIDIsICFkKTsKICAgICAgICAgICAgICAgICAgICBtID0gemYoaywgMywgbSk7CiAgICAgICAgICAgICAgICAgICAgbSA9IHcobSwgNCwgYik7CiAgICAgICAgICAgICAgICAgICAgZiA9IHcobSwgNSwgbCk7CiAgICAgICAgICAgICAgICAgICAgZyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2FzbXJlcycsCiAgICAgICAgICAgICAgICAgICAgICAgIHBheWxvYWQ6IGYuWCgpCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBlLnBvcnRzWzBdLnBvc3RNZXNzYWdlKGcpOwogICAgICAgICAgICAgICAgICAgIExtKGgpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBMaiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmLCBnLCBoLCBrLCBsLCBtKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNjk5KTsKICAgICAgICAgICAgICAgIHRoaXMuVyA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZCA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5lYiA9IGQ7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuSiA9IFcodGhpcywgZSk7CiAgICAgICAgICAgICAgICB0aGlzLlYgPSBWKHRoaXMsIGYpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gVih0aGlzLCBnKTsKICAgICAgICAgICAgICAgIHRoaXMuTiA9IFYodGhpcywgaCk7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBXKHRoaXMsIGspOwogICAgICAgICAgICAgICAgdGhpcy5ZID0gVih0aGlzLCBsKTsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IFYodGhpcywgbSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhMaiwgWSk7CiAgICAgICAgICAgIExqLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEsIGIgPSB0aGlzLlYudmFsdWUsIGMgPSB0aGlzLkIudmFsdWU7CiAgICAgICAgICAgICAgICBjLnN0eWxlLndpZHRoID0gJyc7CiAgICAgICAgICAgICAgICBjLnN0eWxlLmhlaWdodCA9ICcnOwogICAgICAgICAgICAgICAgaWYgKCdoZWlnaHQnICE9PSB0aGlzLkoudmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IG51bGwgIT09IChhID0gdGhpcy5vLnZhbHVlKSAmJiB2b2lkIDAgIT09IGEgPyBhIDogMCwgZSA9IHRoaXMuTi52YWx1ZSwgZiA9IHRoaXMuWS52YWx1ZSwgZyA9IHRoaXMuRy52YWx1ZSwgaCA9ICExOwogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZCkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSB0aGlzLlc7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBrID0gdGhpcy5zbG90SWQsIGwgPSB0aGlzLmwsIG0gPSB0aGlzLmViOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUud2lkdGgsIHEgPSBlLmhlaWdodCwgdSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBCID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHggPSBYZihsKTsKICAgICAgICAgICAgICAgICAgICAgICAgeCA9IF8ueSh4KTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgeiA9IHgubmV4dCgpOyAhei5kb25lOyB6ID0geC5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBDID0gei52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkoQykgJiYgKHogPSAoMCwgRi52YSkoQ1swXSksIEMgPSAoMCwgRi52YSkoQ1sxXSksIHUgPCB6ICYmICh1ID0geiksIEIgPCBDICYmIChCID0gQykpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIEIgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgQgogICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICB1ID0gQlswXSA8IG47CiAgICAgICAgICAgICAgICAgICAgICAgIHEgPSBCWzFdIDwgcTsKICAgICAgICAgICAgICAgICAgICAgICAgdSB8fCBxID8gKEIgPSBuICsgJ3B4JywgeCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtYXgtaGVpZ2h0JzogJ25vbmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ21heC13aWR0aCc6IEIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWRkaW5nOiAnMHB4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiBCCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHEgJiYgKHguaGVpZ2h0ID0gJ2F1dG8nKSwgeGkoYywgYiwgeCksIGMgPSB7fSwgdSAmJiAodSA9IHZpKGYud2lkdGgpLCBuID4gdSAmJiAoYy53aWR0aCA9IEIsIGNbJ21heC13aWR0aCddID0gQikpLCBxICYmIChjLmhlaWdodCA9ICdhdXRvJywgY1snbWF4LWhlaWdodCddID0gJ25vbmUnKSwgYnIoYykgPyBjID0gITEgOiAoY1sncGFkZGluZy0nICsgKCdsdHInID09PSBmLmRpcmVjdGlvbiA/ICdsZWZ0JyA6ICdyaWdodCcpXSA9ICcwcHgnLCBfLndpKGIsIGMpLCBjID0gITApKSA6IGMgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgYjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoeCA9IGUud2lkdGgsIG4gPSBoLmRlZmF1bHRWaWV3IHx8IGgucGFyZW50V2luZG93IHx8IF8uciwgZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSB5aShiLCBuLCB4LCBmLCBtKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBELCBKOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmID0gYi5wYXJlbnRFbGVtZW50KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobSA9IGxnKGYpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDID0gbS53aWR0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gPSByZyhrLCBuLmRvY3VtZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHEgPSAoMCwgRi5IKSh1ZyhtLCBuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gcS5wb3NpdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBUID0gdmkocS53aWR0aCkgfHwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEIgPSB1ZyhmLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHogPSAncnRsJyA9PT0gQi5kaXJlY3Rpb24gPyAnUmlnaHQnIDogJ0xlZnQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbSA9IHoudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAnYWJzb2x1dGUnID09PSB1ID8gMCA6IHZpKEJbJ3BhZGRpbmcnICsgel0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQiA9IHZpKEJbJ2JvcmRlcicgKyB6ICsgJ1dpZHRoJ10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeCA9IE1hdGgubWF4KE1hdGgucm91bmQoKEMgLSBNYXRoLm1heChULCB4KSkgLyAyKSwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhYSA9IFdrKHEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWEgJiYgKFQgPSBhYVs0XSAqICgnUmlnaHQnID09PSB6ID8gLTEgOiAxKSwgeiA9IGFhWzNdIHx8IDEsIDEgIT09IChhYVswXSB8fCAxKSB8fCAxICE9PSB6KSAmJiAoYWFbMF0gPSAxLCBhYVszXSA9IDEsIEMudHJhbnNmb3JtID0gJ21hdHJpeCgnICsgYWEuam9pbignLCcpICsgJyknKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHogPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdmaXhlZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFggPSBudWxsICE9PSAoRCA9IE51bWJlcih2ZyhxLmdldFByb3BlcnR5VmFsdWUobSkpKSkgJiYgdm9pZCAwICE9PSBEID8gRCA6IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRCA9IG51bGwgIT09IChKID0gZi5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKS5sZWZ0KSAmJiB2b2lkIDAgIT09IEogPyBKIDogMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6ID0gWCAtIEQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdyZWxhdGl2ZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeiA9IG51bGwgIT09IChYID0gTnVtYmVyKHZnKHEuZ2V0UHJvcGVydHlWYWx1ZShtKSkpKSAmJiB2b2lkIDAgIT09IFggPyBYIDogMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Fic29sdXRlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDW21dID0gJzAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ1snbWFyZ2luLScgKyBtXSA9IHggLSBuIC0gQiAtIHogLSBUICsgJ3B4JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8ud2koYiwgQyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYyB8fCBiID8gKEFpKGgsIGssIGwsIGQsIGUud2lkdGgsIGUuaGVpZ2h0LCAnZ3B0X3Nsb3RleHAnLCBnKSwgaCA9ICEwKSA6IGggPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICBkID0gdGhpcy5XLCBoID0gdGhpcy5zbG90SWQsIGsgPSB0aGlzLmwsIEQgPSB0aGlzLmViLCBsID0gZS53aWR0aCwgSiA9IGUuaGVpZ2h0LCBYID0gdmkoZi5oZWlnaHQpIHx8IDAsIEogPj0gWCB8fCAnbm9uZScgPT09IGYuZGlzcGxheSB8fCAnaGlkZGVuJyA9PT0gZi52aXNpYmlsaXR5IHx8ICFEIHx8IC0xMjI0NTkzMyA9PT0gRC53aWR0aCB8fCBiLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLmJvdHRvbSA8PSBELmhlaWdodCA/IGggPSAhMSA6IChEID0geyBoZWlnaHQ6IEogKyAncHgnIH0sIHhpKGMsIGIsIEQpLCBfLndpKGIsIEQpLCBBaShkLCBoLCBrLCAzLCBsLCBKLCAnZ3B0X3Nsb3RyZWQnLCBnKSwgaCA9ICEwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIWggJiYgXy5IKG5zKSAmJiBBaSh0aGlzLlcsIHRoaXMuc2xvdElkLCB0aGlzLmwsIDAsIGUud2lkdGgsIGUuaGVpZ2h0LCAnZ3B0X3BnYnJrJywgZyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0aGlzLkMubm90aWZ5KCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB6aiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNzIwKTsKICAgICAgICAgICAgICAgIHRoaXMuZm9ybWF0ID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVyh0aGlzLCBjKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFcodGhpcywgZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyh6aiwgWSk7CiAgICAgICAgICAgIHpqLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLm8udmFsdWU7CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBhKQogICAgICAgICAgICAgICAgICAgIGp2KHRoaXMuQyk7CiAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IE1hdGgucm91bmQoMC4zICogdGhpcy5CKTsKICAgICAgICAgICAgICAgICAgICAyICE9PSB0aGlzLmZvcm1hdCAmJiAzICE9PSB0aGlzLmZvcm1hdCB8fCAhbXYodGhpcy5sKSB8fCAhU28odGhpcy5sLnZhbHVlLCAxMiwgITEpIHx8IDAgPj0gYiB8fCBhIDw9IGIgPyB0aGlzLkMuaihhKSA6IHRoaXMuQy5qKGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgR2ogPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZywgaCwgaywgbCkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDY3NCk7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLlUgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5vID0gYzsKICAgICAgICAgICAgICAgIHRoaXMuVyA9IGU7CiAgICAgICAgICAgICAgICB0aGlzLksgPSBmOwogICAgICAgICAgICAgICAgdGhpcy5DID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IDIgPT09IGQgfHwgMyA9PT0gZDsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFYodGhpcywgZyk7CiAgICAgICAgICAgICAgICB0aGlzLk4gPSBWKHRoaXMsIGgpOwogICAgICAgICAgICAgICAgdGhpcy5KID0gVyh0aGlzLCBrKTsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IFcodGhpcywgbCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhHaiwgWSk7CiAgICAgICAgICAgIEdqLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSBkZyh0aGlzLlUsIHRoaXMubyksIGIgPSBxZyh0aGlzLnNsb3RJZCwgdGhpcy5XKSB8fCBQaSh0aGlzLmwudmFsdWUsIEFnKHRoaXMuc2xvdElkKSwgYSk7CiAgICAgICAgICAgICAgICB0aGlzLk4udmFsdWUgJiYgIWEgJiYgKGIuc3R5bGUuZGlzcGxheSA9ICdpbmxpbmUtYmxvY2snKTsKICAgICAgICAgICAgICAgIHRoaXMuRyA/IHhEKHRoaXMuSywgdGhpcy5zbG90SWQsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBfLlZxKGIpOwogICAgICAgICAgICAgICAgfSkgOiBfLnpsKHRoaXMsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBfLlZxKGIpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBhID0gQ0codGhpcyk7CiAgICAgICAgICAgICAgICAwIDwgYSAmJiAoYi5zdHlsZS5wYWRkaW5nVG9wID0gYSArICdweCcpOwogICAgICAgICAgICAgICAgdGhpcy5DLmooYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBDRyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiwgYyA9IGEubC52YWx1ZSwgZCA9IG51bGwgPT09IChiID0gKDAsIEYuSCkoYS5KKS52YWx1ZSkgfHwgdm9pZCAwID09PSBiID8gdm9pZCAwIDogYi5oZWlnaHQ7CiAgICAgICAgICAgICAgICBpZiAoYyAmJiAhKDAsIEYuSCkoYS5CKS52YWx1ZSAmJiBkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSAobnVsbCAhPT0gKGUgPSBFKGEubywgMjMpKSAmJiB2b2lkIDAgIT09IGUgPyBlIDogRShhLlUsIDMxKSkgPyBNYXRoLmZsb29yKChjLm9mZnNldEhlaWdodCAtIGQpIC8gMikgOiAwOwogICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgZiA9IDA7CiAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHRqID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA4NTkpOwogICAgICAgICAgICAgICAgdGhpcy5JID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuQyA9IFUodGhpcyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyh0aiwgWSk7CiAgICAgICAgICAgIHRqLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5DLmooIWJjKHRoaXMuSS50b3ApKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEpqID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA2OTgpOwogICAgICAgICAgICAgICAgdGhpcy5JID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuQyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBWKHRoaXMsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oSmosIFkpOwogICAgICAgICAgICBKai5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMuQy5mYSh1Zyh0aGlzLmwudmFsdWUsIHRoaXMuSSkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgeWogPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDgxMyk7CiAgICAgICAgICAgICAgICB0aGlzLkFhID0gYTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBXKHRoaXMsIGIpOwogICAgICAgICAgICAgICAgdGhpcy5vID0gVyh0aGlzLCBjKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHlqLCBZKTsKICAgICAgICAgICAgeWoucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSwgYiA9IHRoaXMuQi52YWx1ZTsKICAgICAgICAgICAgICAgIGlmICghYiB8fCBfLkgoSnQpKQogICAgICAgICAgICAgICAgICAgIHRoaXMubC5qKCExKTsKICAgICAgICAgICAgICAgIGVsc2UgaWYgKERHLmhhcyh0aGlzLkFhKSkKICAgICAgICAgICAgICAgICAgICB0aGlzLmwuaighMSk7CiAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBERy5hZGQodGhpcy5BYSk7CiAgICAgICAgICAgICAgICAgICAgYiA9IF8ueShiKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gYi5uZXh0KCk7ICFjLmRvbmU7IGMgPSBiLm5leHQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGMudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBkLkdhOwogICAgICAgICAgICAgICAgICAgICAgICAoZCA9IGQuU2QpICYmIGJkKGMsIGQsIG51bGwgIT09IChhID0gdGhpcy5vLnZhbHVlKSAmJiB2b2lkIDAgIT09IGEgPyBhIDogbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHRoaXMubC5qKCEwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIERHID0gbmV3IHYuU2V0KCk7CiAgICAgICAgICAgIHZhciBUaiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODQwKTsKICAgICAgICAgICAgICAgIHRoaXMuVyA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBVKHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oVGosIFkpOwogICAgICAgICAgICBUai5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhOwogICAgICAgICAgICAgICAgdmFyIGIgPSB2b2lkIDAgPT09IGIgPyB3aW5kb3cubmF2aWdhdG9yLnVzZXJBZ2VudCA6IGI7CiAgICAgICAgICAgICAgICBiID0gKGIgPSBiLm1hdGNoKC9DaHJvbWVcLyhbMC05XSspLykpICYmIDkyID4gTnVtYmVyKGJbMV0pID8gJ2NvbnZlcnNpb24tbWVhc3VyZW1lbnQnIDogJ2F0dHJpYnV0aW9uLXJlcG9ydGluZyc7CiAgICAgICAgICAgICAgICAobnVsbCA9PT0gKGEgPSB0aGlzLlcuZmVhdHVyZVBvbGljeSkgfHwgdm9pZCAwID09PSBhID8gMCA6IChMID0gYS5mZWF0dXJlcygpLCBfLnQoTCwgJ2luY2x1ZGVzJykpLmNhbGwoTCwgYikpID8gdGhpcy5DLmooYikgOiB0aGlzLkMuaignJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBYaiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgOTM0KTsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZCA9IGI7CiAgICAgICAgICAgICAgICBzdih0aGlzLCBjKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFcodGhpcywgZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhYaiwgWSk7CiAgICAgICAgICAgIFhqLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzOwogICAgICAgICAgICAgICAgUUModGhpcy5zbG90SWQsIHRpLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIGIgPSBiLmRldGFpbDsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IEpTT04ucGFyc2UoYi5kYXRhKSwgIWMgfHwgJ2dwaS11b28nICE9PSBjLmdvb2dNc2dUeXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBiID0gYzsKICAgICAgICAgICAgICAgICAgICBjID0gYS5sLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gbmV3ICRwKCk7CiAgICAgICAgICAgICAgICAgICAgZCA9IHcoZCwgMSwgYi51c2VyT3B0T3V0ID8gJzEnIDogJzAnKTsKICAgICAgICAgICAgICAgICAgICBkID0gdyh3KGQsIDIsIDIxNDc0ODM2NDcpLCAzLCAnLycpOwogICAgICAgICAgICAgICAgICAgIGQgPSB3KGQsIDQsIGEuSS5sb2NhdGlvbi5ob3N0bmFtZSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZXcgY3coYS5JKTsKICAgICAgICAgICAgICAgICAgICBmdyhlLCAnX19ncGlfb3B0X291dCcsIGQsIGMpOwogICAgICAgICAgICAgICAgICAgIGlmIChiLnVzZXJPcHRPdXQgfHwgYi5jbGVhckFkc0RhdGEpCiAgICAgICAgICAgICAgICAgICAgICAgIGd3KGUsICdfX2dhZHMnLCBjKSwgZ3coZSwgJ19fZ3BpJywgYyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEVHID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYsIGcpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA3NTgpOwogICAgICAgICAgICAgICAgdGhpcy5zbG90SWQgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5MID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuSyA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLldhID0gZDsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGU7CiAgICAgICAgICAgICAgICB0aGlzLlcgPSBmOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVyh0aGlzLCBnKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEVHLCBZKTsKICAgICAgICAgICAgRUcucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSBiLmopIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMsIGQgPSByZyhhLnNsb3RJZCwgYS5XKTsKICAgICAgICAgICAgICAgICAgICAgICAgZCAmJiBLZChkLCBhLkksIG51bGwgIT09IChjID0gYS5sLnZhbHVlKSAmJiB2b2lkIDAgIT09IGMgPyBjIDogJycsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgY3YoYS5XYSwgJzUnLCAoMCwgRi5IKShHKGEuTC5QW2Euc2xvdElkLmdldERvbUlkKCldLCAyMCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGIsIGEuc2xvdElkLmRpc3BhdGNoRXZlbnQoVEMsIDgwMSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJGI6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0JhY2tmaWxsOiAhMQogICAgICAgICAgICAgICAgICAgICAgICB9KSwgMik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChfLkFEKGEuSywgYS5zbG90SWQpICYmICFCZyhhLnNsb3RJZCwgYS5XKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGEuTDsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGUuVTsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUuUFthLnNsb3RJZC5nZXREb21JZCgpXTsKICAgICAgICAgICAgICAgICAgICAgICAgKG51bGwgIT09IChkID0gRShlLCAxMCkpICYmIHZvaWQgMCAhPT0gZCA/IGQgOiBFKGMsIDExKSkgJiYgcGkoYS5zbG90SWQsIGEuVywgZSwgYyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBqYihiLCBhLnNsb3RJZC5kaXNwYXRjaEV2ZW50KFZDLCA4MjUsIHsgaXNFbXB0eTogITAgfSksIDApOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBnayA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNzIxKTsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkcgPSBXKHRoaXMsIGIpOwogICAgICAgICAgICAgICAgdGhpcy5vID0gVih0aGlzLCBjKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFYodGhpcywgZCk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBWKHRoaXMsIGUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oZ2ssIFkpOwogICAgICAgICAgICBnay5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYywgZCwgZSA9IHRoaXMuRy52YWx1ZSwgZiA9IG51bGwgPT09IChiID0gbnVsbCA9PT0gZSB8fCB2b2lkIDAgPT09IGUgPyB2b2lkIDAgOiBHKGUsIDEpKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLnRvVXBwZXJDYXNlKCk7CiAgICAgICAgICAgICAgICBlID0gbnVsbCA9PT0gKGMgPSBudWxsID09PSBlIHx8IHZvaWQgMCA9PT0gZSA/IHZvaWQgMCA6IEcoZSwgMikpIHx8IHZvaWQgMCA9PT0gYyA/IHZvaWQgMCA6IGMudG9VcHBlckNhc2UoKTsKICAgICAgICAgICAgICAgIGlmIChmICYmIGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IHRoaXMuby52YWx1ZSwgaCA9IHRoaXMubC52YWx1ZSwgayA9IHRoaXMuQi52YWx1ZSwgbCA9IGsuc3R5bGUuaGVpZ2h0LCBtID0gay5zdHlsZS53aWR0aCwgbiA9IGsuc3R5bGUuZGlzcGxheSwgcSA9IGsuc3R5bGUucG9zaXRpb24sIHUgPSBDcihnLmlkICsgJ190b3AnLCBmKSwgQiA9IENyKGcuaWQgKyAnX2JvdHRvbScsIGUpOwogICAgICAgICAgICAgICAgICAgIF8ud2koQiwgewogICAgICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbjogJ3JlbGF0aXZlJywKICAgICAgICAgICAgICAgICAgICAgICAgdG9wOiAnY2FsYygxMDB2aCAtIDQ4cHgpJwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGsuYXBwZW5kQ2hpbGQodSk7CiAgICAgICAgICAgICAgICAgICAgay5hcHBlbmRDaGlsZChCKTsKICAgICAgICAgICAgICAgICAgICBfLndpKGgsIHsKICAgICAgICAgICAgICAgICAgICAgICAgcG9zaXRpb246ICdhYnNvbHV0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgIHRvcDogJzI0cHgnLAogICAgICAgICAgICAgICAgICAgICAgICBjbGlwOiAncmVjdCgwLCBhdXRvLCBhdXRvLCAwKScsCiAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMTAwdncnLAogICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6ICdjYWxjKDEwMHZoIC0gNDhweCknCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgXy53aShnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uOiAnZml4ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICB0b3A6ICcwJywKICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiAnMTAwdmgnCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgXy53aShrLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uOiAncmVsYXRpdmUnLAogICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAobnVsbCA9PT0gKGQgPSB0aGlzLkkuc2NyZWVuLm9yaWVudGF0aW9uKSB8fCB2b2lkIDAgPT09IGQgPyAwIDogZC5hbmdsZSkgPyAnbm9uZScgOiAnYmxvY2snLAogICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogJzEwMHZ3JywKICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiAnMTAwdmgnCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgWkModGhpcywgNzIyLCB0aGlzLkksICdvcmllbnRhdGlvbmNoYW5nZScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHg7CiAgICAgICAgICAgICAgICAgICAgICAgIChudWxsID09PSAoeCA9IGEuSS5zY3JlZW4ub3JpZW50YXRpb24pIHx8IHZvaWQgMCA9PT0geCA/IDAgOiB4LmFuZ2xlKSA/IF8ud2koaywgeyBkaXNwbGF5OiAnbm9uZScgfSkgOiBfLndpKGssIHsgZGlzcGxheTogJ2Jsb2NrJyB9KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBfLnpsKHRoaXMsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgXy5WcSh1KTsKICAgICAgICAgICAgICAgICAgICAgICAgXy5WcShCKTsKICAgICAgICAgICAgICAgICAgICAgICAgay5zdHlsZS5wb3NpdGlvbiA9IHE7CiAgICAgICAgICAgICAgICAgICAgICAgIGsuc3R5bGUuaGVpZ2h0ID0gbDsKICAgICAgICAgICAgICAgICAgICAgICAgay5zdHlsZS53aWR0aCA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgIGsuc3R5bGUuZGlzcGxheSA9IG47CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBjayA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICBlID0gdm9pZCAwID09PSBlID8gbWogOiBlOwogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDc4Myk7CiAgICAgICAgICAgICAgICB2YXIgZiA9IHRoaXM7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLlcgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5tYSA9IGQ7CiAgICAgICAgICAgICAgICB0aGlzLkogPSBlOwogICAgICAgICAgICAgICAgdGhpcy5HID0gITE7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBudWxsOwogICAgICAgICAgICAgICAgdGhpcy5CID0gdGhpcy5vID0gLTE7CiAgICAgICAgICAgICAgICB0aGlzLlYgPSBfLlZuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmLm1hLmRpc3BhdGNoRXZlbnQoJ2ltcHJlc3Npb25WaWV3YWJsZScsIDcxNSwgbmV3IGVGKGYuc2xvdElkLCAncHVibGlzaGVyX2FkcycpKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5ZID0gV24oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGYubWEuZGlzcGF0Y2hFdmVudCgnc2xvdFZpc2liaWxpdHlDaGFuZ2VkJywgNzE2LCBuZXcgZkYoZi5zbG90SWQsICdwdWJsaXNoZXJfYWRzJywgZi5CKSk7CiAgICAgICAgICAgICAgICB9LCAyMDApOwogICAgICAgICAgICAgICAgdGhpcy5OID0gVih0aGlzLCBiKTsKICAgICAgICAgICAgICAgIHZhciBnID0gbmV3IHdqKCk7CiAgICAgICAgICAgICAgICBzaSh0aGlzLnNsb3RJZCwgWUMpLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGcubm90aWZ5KCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHN2KHRoaXMsIGcpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oY2ssIFkpOwogICAgICAgICAgICBjay5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiA9IHRoaXMuSihfLm1mKHRoaXMuaWQsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBfLnkoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSBjLm5leHQoKTsgIWQuZG9uZTsgZCA9IGMubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5vID0gMTAwICogZC52YWx1ZS5pbnRlcnNlY3Rpb25SYXRpbywgXy50KE51bWJlciwgJ2lzRmluaXRlJykuY2FsbChOdW1iZXIsIGEubykgJiYgRkcoYSk7CiAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgYi5vYnNlcnZlKHRoaXMuTi52YWx1ZSk7CiAgICAgICAgICAgICAgICBaQyh0aGlzLCB0aGlzLmlkLCB0aGlzLlcsICd2aXNpYmlsaXR5Y2hhbmdlJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIEZHKGEpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBfLnpsKHRoaXMsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBiLmRpc2Nvbm5lY3QoKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgRkcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gIWVBKGEuVyk7CiAgICAgICAgICAgICAgICAgICAgR0coYSwgNTAgPD0gYS5vICYmIGIpOwogICAgICAgICAgICAgICAgICAgIGIgPSBNYXRoLmZsb29yKGIgPyBhLm8gOiAwKTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA+IGIgfHwgMTAwIDwgYiB8fCBiID09PSBhLkIgPyAwIDogLTEgIT09IGEuQiB8fCAwICE9PSBiKQogICAgICAgICAgICAgICAgICAgICAgICBhLkIgPSBiLCBhLlkoKTsKICAgICAgICAgICAgICAgIH0sIEdHID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBhLkcgfHwgKGIgPyBudWxsID09PSBhLmwgJiYgKGEubCA9IHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBlQShhLlcpIHx8IChhLlYoKSwgYS5HID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICBhLmwgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIH0sIDEwMDApKSA6IG51bGwgIT09IGEubCAmJiAoY2xlYXJUaW1lb3V0KGEubCksIGEubCA9IG51bGwpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBEaiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNjY2KTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gVyh0aGlzLCBiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKERqLCBZKTsKICAgICAgICAgICAgRGoucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IG5ldyBFaigpOwogICAgICAgICAgICAgICAgbXYodGhpcy5CKSAmJiAodyhhLCAyLCB0aGlzLkIudmFsdWUpLCB3KGEsIDMsIDEpKTsKICAgICAgICAgICAgICAgIGlmICh0aGlzLm8pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEKICAgICAgICAgICAgICAgICAgICAgICAgXSwgYyA9IG5ldyBFaigpOwogICAgICAgICAgICAgICAgICAgIGIgPSBfLnkoYik7CiAgICAgICAgICAgICAgICAgICAgZm9yIChhID0gYi5uZXh0KCk7ICFhLmRvbmU7IGEgPSBiLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEudmFsdWUsIFlmKGEsIDEpICYmIHcoYywgMSwgRyhhLCAxKSksIFlmKGEsIDIpICYmIHcoYywgMiwgRyhhLCAyKSksIFlmKGEsIDMpICYmIHcoYywgMywgSGMoYSwgMykpOwogICAgICAgICAgICAgICAgICAgIGEgPSBjOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYyA9IHRoaXMubDsKICAgICAgICAgICAgICAgIGIgPSBjLmZhOwogICAgICAgICAgICAgICAgYSA9IFlmKGEsIDIpID8gWWYoYSwgMykgJiYgMCAhPT0gQ2goKSA/ICgwLCBGLnZhKShHKGEsIDIpKSAqICgwLCBGLnZhKShIYyhhLCAzKSkgOiBHKGEsIDIpIDogbnVsbDsKICAgICAgICAgICAgICAgIGIuY2FsbChjLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEtqID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA2NjYpOwogICAgICAgICAgICAgICAgdGhpcy5DID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHN2KHRoaXMsIGEpOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVih0aGlzLCBiKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFcodGhpcywgZCk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBXKHRoaXMsIGMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oS2osIFkpOwogICAgICAgICAgICBLai5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhLCBiID0gdGhpcy5vLnZhbHVlLCBjID0gbnVsbCAhPT0gKGEgPSB0aGlzLkIudmFsdWUpICYmIHZvaWQgMCAhPT0gYSA/IGEgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBiIHx8IDAgPiBiIHx8IDAgPT09IGMpCiAgICAgICAgICAgICAgICAgICAgdGhpcy5DLmooITEpOwogICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB0aGlzLmwudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgd2coZCkgPyBIRyh0aGlzLCBiLCBjLCBkKSA6IHRoaXMuQy5qKCExKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEhHID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIHZhciBlID0gbmooYiArICclJywgXy5tZigyOTEsIGZ1bmN0aW9uIChmLCBnKSB7CiAgICAgICAgICAgICAgICAgICAgZiA9IF8ueShmKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBoID0gZi5uZXh0KCk7ICFoLmRvbmU7IGggPSBmLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGggPSBoLnZhbHVlLCAhKDAgPj0gaC5pbnRlcnNlY3Rpb25SYXRpbykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcudW5vYnNlcnZlKGgudGFyZ2V0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuQy5qKCEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICBudWxsICE9IGMgJiYgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYS5DLmooITApOwogICAgICAgICAgICAgICAgICAgIGUuZGlzY29ubmVjdCgpOwogICAgICAgICAgICAgICAgfSwgYyk7CiAgICAgICAgICAgICAgICBlLm9ic2VydmUoZCk7CiAgICAgICAgICAgICAgICBfLnpsKGEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBlLmRpc2Nvbm5lY3QoKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgSWogPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDY2NCk7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmViID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuSyA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFcodGhpcywgZCk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBXKHRoaXMsIGUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oSWosIFkpOwogICAgICAgICAgICBJai5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYyA9IG51bGwgIT09IChiID0gdGhpcy5sLnZhbHVlKSAmJiB2b2lkIDAgIT09IGIgPyBiIDogMDsKICAgICAgICAgICAgICAgIGlmIChfLkgoZHQpIHx8IDAgPCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBkb2N1bWVudDsKICAgICAgICAgICAgICAgICAgICBjID0gZEEoZCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGVBKGQpICYmIGMgJiYgKDAgPCBtbCh0aGlzLkssIHRoaXMuc2xvdElkKSB8fCAhSUcodGhpcykpICYmIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBaQyh0aGlzLCAzMjQsIGQsIGMsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVBKGQpIHx8IChlICYmIGUoKSwgYS5DLm5vdGlmeSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXMuQy5ub3RpZnkoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIElHID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gYS5vLnZhbHVlOwogICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gYikKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gbnVsbCAhPT0gdG9wICYmIHZvaWQgMCAhPT0gdG9wID8gdG9wIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IGMpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGF3KG51bGwgPT09IGMgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5kb2N1bWVudCwgYykueSwgZSA9IGQgKyBhLmViLmhlaWdodDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi55ID49IGQgJiYgYi55IDw9IGU7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChmKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgT2ogPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDc2Mik7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5vID0gVih0aGlzLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFYodGhpcywgYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhPaiwgWSk7CiAgICAgICAgICAgIE9qLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLmwudmFsdWUua2luZCwgYiA9IDA7CiAgICAgICAgICAgICAgICAxID09PSBhID8gYiA9IDUgOiAyID09PSBhID8gYiA9IDYgOiB0aGlzLm8udmFsdWUgJiYgKGIgPSAxKTsKICAgICAgICAgICAgICAgIHRoaXMuQy5qKGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQ2ogPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZikgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDY2OSk7CiAgICAgICAgICAgICAgICB0aGlzLlUgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5QID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVyh0aGlzLCBkKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFcodGhpcywgZSk7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBXKHRoaXMsIGYpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oQ2osIFkpOwogICAgICAgICAgICBDai5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhOwogICAgICAgICAgICAgICAgaWYgKCEoYSA9IG12KHRoaXMubykpKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IHRoaXMuUDsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHRoaXMuSTsKICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gd2luZG93IDogYjsKICAgICAgICAgICAgICAgICAgICBhID0gISEoenUobHMpIHx8IGEgJiYgWWYoYSwgMTYpICYmIFZlKCdnb29nbGVfcmFuZ2VfZGVidWcnLCBiKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBhID8gdGhpcy5DLmooITApIDogdGhpcy5DLmooISEoTGcodGhpcy5sLnZhbHVlKSAmJiAoRSh0aGlzLlAsIDEyKSB8fCBFKHRoaXMuVSwgMTMpKSB8fCB0aGlzLkIudmFsdWUpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFJqID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA4MjgpOwogICAgICAgICAgICAgICAgdGhpcy5zbG90SWQgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5MID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuQyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBXKHRoaXMsIGMpOwogICAgICAgICAgICAgICAgdGhpcy5vID0gVyh0aGlzLCBkKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFJqLCBZKTsKICAgICAgICAgICAgUmoucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGIsIGMsIGQsIGUsIGYsIGcsIGgsIGssIGwsIG0sIG47CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKHEpIHsKICAgICAgICAgICAgICAgICAgICBjID0gYS5MOwogICAgICAgICAgICAgICAgICAgIGQgPSBjLlU7CiAgICAgICAgICAgICAgICAgICAgZSA9IGMuUDsKICAgICAgICAgICAgICAgICAgICBmID0gZVthLnNsb3RJZC5nZXREb21JZCgpXTsKICAgICAgICAgICAgICAgICAgICBnID0gYS5vLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIGggPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGsgPSBudWxsICE9PSAoYiA9IG51bGwgPT09IGYgfHwgdm9pZCAwID09PSBmID8gdm9pZCAwIDogZi5CYSgpKSAmJiB2b2lkIDAgIT09IGIgPyBiIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICBsID0gZC5CYSgpOwogICAgICAgICAgICAgICAgICAgIChudWxsID09PSBrIHx8IHZvaWQgMCA9PT0gayA/IDAgOiBZZihrLCA0KSkgPyBoID0gRShrLCA0KSA6IChudWxsID09PSBsIHx8IHZvaWQgMCA9PT0gbCA/IDAgOiBZZihsLCA0KSkgPyBoID0gRShsLCA0KSA6IG51bGwgIT0gZyAmJiAoaCA9IGcpOwogICAgICAgICAgICAgICAgICAgIG0gPSBTdHJpbmcoaCk7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSBnIHx8IGcgPT09IGggfHwgYS5sLnZhbHVlIHx8IE0oTGgoKSwgT0UobSwgU3RyaW5nKGcpKSk7CiAgICAgICAgICAgICAgICAgICAgYS5sLnZhbHVlIHx8IG9mKCdncHRfc2ZfcicsIGZ1bmN0aW9uICh1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRmKHUpOwogICAgICAgICAgICAgICAgICAgICAgICBJKHUsICdHQU0nLCBTdHJpbmcoZykpOwogICAgICAgICAgICAgICAgICAgICAgICBJKHUsICdGaW5hbCcsIG0pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIG4gPSBfLkgoSHMpIHx8IGEubC52YWx1ZSB8fCBoIHx8IG51bGwgPT0gaDsKICAgICAgICAgICAgICAgICAgICBpZiAoIW4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqdihhLkMpLCBxLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgIGEuQy5qKHJEKCkpOwogICAgICAgICAgICAgICAgICAgIExtKHEpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBQaiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNzE5KTsKICAgICAgICAgICAgICAgIHRoaXMuVSA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5DID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFYodGhpcywgYyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBXKHRoaXMsIGQpOwogICAgICAgICAgICAgICAgdGhpcy5HID0gVyh0aGlzLCBmKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFBqLCBZKTsKICAgICAgICAgICAgUGoucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMubC52YWx1ZSwgYiA9IHRoaXMuby52YWx1ZTsKICAgICAgICAgICAgICAgIGlmICgxID09PSBiIHx8IDUgPT09IGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IHRoaXMuRy52YWx1ZSwgYiA9IG5ldyBlQygpLCBhID0gdyhiLCAzLCBhKSwgRShBRihbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5VLkJhKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLkIuQmEoKQogICAgICAgICAgICAgICAgICAgICAgICBdKSwgMykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5DLmoobEIpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IDAgPT09IGIgJiYgYSkKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IG9yKCksIGEgPSAhKCFhWydhbGxvdy10b3AtbmF2aWdhdGlvbi1ieS11c2VyLWFjdGl2YXRpb24nXSB8fCAhYVsnYWxsb3ctcG9wdXBzLXRvLWVzY2FwZS1zYW5kYm94J10pOwogICAgICAgICAgICAgICAgICAgIGlmIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuQy5qKGxCKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGp2KHRoaXMuQyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBGaiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmLCBnLCBoLCBrKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgNjgxKTsKICAgICAgICAgICAgICAgIHRoaXMuTiA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmRhID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuSiA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLndpbmRvdyA9IGQ7CiAgICAgICAgICAgICAgICB0aGlzLmphID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLndiID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IHp1KGxzKS5zcGxpdCgnLCcpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gWWkobXMpOwogICAgICAgICAgICAgICAgdGhpcy5GYSA9IFlmKGIsIDE2KSA/IFdiKGIsIHRoLCAxNikgOiBudWxsOwogICAgICAgICAgICAgICAgdGhpcy5HID0gVWUoJ2dvb2dsZV9yYW5nZV9kZWJ1ZycsIHRoaXMud2luZG93KTsKICAgICAgICAgICAgICAgIHRoaXMuViA9IFcodGhpcywgZSk7CiAgICAgICAgICAgICAgICB0aGlzLmVhID0gVyh0aGlzLCBmKTsKICAgICAgICAgICAgICAgIHRoaXMuWiA9IFcodGhpcywgZyk7CiAgICAgICAgICAgICAgICB0aGlzLlkgPSBWKHRoaXMsIGgpOwogICAgICAgICAgICAgICAgdGhpcy4kID0gVih0aGlzLCBrKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEZqLCBZKTsKICAgICAgICAgICAgRmoucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgIGlmIChhID0gISEodGhpcy5sLmxlbmd0aCB8fCB0aGlzLkZhICYmIHRoaXMuRykpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYjsKICAgICAgICAgICAgICAgICAgICBiOgogICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5sLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuQi5sZW5ndGggJiYgKGEgPSB0aGlzLk4uc3BsaXQoJy8nKSwgIV8udCh0aGlzLkIsICdpbmNsdWRlcycpLmNhbGwodGhpcy5CLCBhW2EubGVuZ3RoIC0gMV0pKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAhMTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGE7CiAgICAgICAgICAgICAgICAgICAgYSA9IGMgPyBKRyh0aGlzKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMgJiYgYSkgewogICAgICAgICAgICAgICAgICAgICAgICBjID0gdGhpcy4kLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGxnKGMucGFyZW50RWxlbWVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBudWxsICE9PSAoYiA9IG51bGwgPT09IGQgfHwgdm9pZCAwID09PSBkID8gdm9pZCAwIDogZC53aWR0aCkgJiYgdm9pZCAwICE9PSBiID8gYiA6IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSAncCcgPT09IHRoaXMubFswXTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBOdW1iZXIodGhpcy5sWzBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIgPSAnZicgPT09IHRoaXMubFswXSA/IHRoaXMuSiA6IGUgJiYgMCA8IGUgPyBlIDogYiA/IE1hdGgubWluKGQsIHRoaXMuSikgOiBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gYS53aWR0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gYS5oZWlnaHQsIGcgPSB0aGlzLmxbMV0sIGggPSBOdW1iZXIoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gJ3JhdGlvJyA9PT0gZyAmJiBlID8gTWF0aC5mbG9vcihmIC8gZSAqIGIpIDogaCAmJiAwIDwgaCA/IGYgKiBoIDogZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtHKHRoaXMsIGIsIGUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBraW5kOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdhOiBMRyhiLCBlLCAnPHA+UmVxdWVzdGVkIHNpemU6JyArIGEud2lkdGggKyAneCcgKyBhLmhlaWdodCArICc8L3A+JykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGIgPD0gZCA/IDEgOiAyLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gITE7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAhMTsKICAgICAgICAgICAgICAgICAgICBpZiAoIWEpCiAgICAgICAgICAgICAgICAgICAgICAgIGE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5GYSAmJiB0aGlzLkcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gb2oodGhpcy5GYSwgdGhpcy53aW5kb3cpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBwaih0aGlzLkZhLCB0aGlzLndpbmRvdyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IHFqKHRoaXMuRmEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSByaih0aGlzLkZhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXMuRykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ21heCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWluJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdiYW5uZXInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IDkwID4gYyA/IGMgOiA5MCA8IGIgPyBiIDogOTA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3NreXNjcmFwZXInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gOTAgPiBhID8gYSA6IDkwIDwgZCA/IGQgOiA5MDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS0codGhpcywgZSwgZiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBraW5kOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3YTogTEcoZSwgZiwgJzxwPk1pbmltdW0gc2l6ZTonICsgZCArICd4JyArIGIgKyAnPC9wPjxwPk1heGltdW0gc2l6ZTonICsgKGEgKyAneCcgKyBjICsgJzwvcD48ZGl2IGlkPXRvb3dpZGUgc3R5bGU9ImRpc3BsYXk6bm9uZTsgYmFja2dyb3VuZDojZmFhIj5TbG90IGRvZXMgbm90IGZpdCBob3Jpem9udGFsbHk8c2NyaXB0Pm5ldyBJbnRlcnNlY3Rpb25PYnNlcnZlcigoZSkgPT4ge3Rvb3dpZGUuc3R5bGUuZGlzcGxheSA9ICAgKGVbZS5sZW5ndGgtMV0uYm91bmRpbmdDbGllbnRSZWN0LndpZHRoID4gICAgZVtlLmxlbmd0aC0xXS5pbnRlcnNlY3Rpb25SZWN0LndpZHRoKSA/IFwnYmxvY2tcJyA6IFwnbm9uZVwnO30se3RocmVzaG9sZDoxfSkub2JzZXJ2ZShkb2N1bWVudC5ib2R5KTs8L3NjcmlwdD48L2Rpdj4nKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gITE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoIWEpIHsKICAgICAgICAgICAgICAgICAgICBhID0gdGhpcy5lYS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBhKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgdmgoJ01pc3NpbmcgXCd3aWR0aFwnLicpOwogICAgICAgICAgICAgICAgICAgIGMgPSB0aGlzLloudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHZoKCdNaXNzaW5nIFwnaGVpZ2h0XCcuJyk7CiAgICAgICAgICAgICAgICAgICAgS0codGhpcywgYSwgYywgdGhpcy5ZLnZhbHVlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEpHID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBhID0gWGYoYS5kYSlbMF07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LmlzQXJyYXkoYSkgJiYgYS5ldmVyeShmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ251bWJlcicgPT09IHR5cGVvZiBiOwogICAgICAgICAgICAgICAgICAgIH0pID8gbmV3IF8uVWkoYVswXSwgYVsxXSkgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgTEcgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnPGh0bWw+PGJvZHkgc3R5bGU9ImhlaWdodDonICsgKGIgLSAyICsgJ3B4O3dpZHRoOicgKyAoYSAtIDIgKyAncHg7YmFja2dyb3VuZC1jb2xvcjojZGRkO2NvbG9yOiMwMDA7Ym9yZGVyOjFweCBzb2xpZCAjZjAwOyI+JykpICsgYyArICgnPHA+UmVuZGVyZWQgc2l6ZTonICsgYSArICd4JyArIGIgKyAnPC9wPjwvYm9keT48L2h0bWw+Jyk7CiAgICAgICAgICAgICAgICB9LCBLRyA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgZSA9IHZvaWQgMCA9PT0gZSA/IGEuVi52YWx1ZSA6IGU7CiAgICAgICAgICAgICAgICAgICAgYS5vLmoobmV3IF8uVWkoYiwgYykpOwogICAgICAgICAgICAgICAgICAgIGEuamEuaihkKTsKICAgICAgICAgICAgICAgICAgICBhLndiLmZhKGUpOwogICAgICAgICAgICAgICAgICAgIGYgJiYgXy5UcihmLCAnb3BhY2l0eScsIDAuNSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQWogPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZykgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDY3Myk7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmJiID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBkOwogICAgICAgICAgICAgICAgdGhpcy5XID0gZTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IGY7CiAgICAgICAgICAgICAgICB0aGlzLksgPSBnOwogICAgICAgICAgICAgICAgdGhpcy5DID0gVSh0aGlzKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEFqLCBZKTsKICAgICAgICAgICAgQWoucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGIsIGM7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSBkLmopIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEuYmIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1HKGEsIGEuYmIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5DLmooYS5iYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLmogPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjZyhhLmwpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLkMuaihORyhhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLmogPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqYihkLCBzaShhLnNsb3RJZCwgUkMpLCA0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYiA9IGQubTsKICAgICAgICAgICAgICAgICAgICBjID0gYi5kZXRhaWw7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEubSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQucmV0dXJuKCk7CiAgICAgICAgICAgICAgICAgICAgTUcoYSwgYyk7CiAgICAgICAgICAgICAgICAgICAgYS5DLmooYyk7CiAgICAgICAgICAgICAgICAgICAgTG0oZCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE5HID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IF8uT2koJ0lOUycpOwogICAgICAgICAgICAgICAgICAgIGIuaWQgPSBhLkI7CiAgICAgICAgICAgICAgICAgICAgXy53aShiLCB7IGRpc3BsYXk6ICdub25lJyB9KTsKICAgICAgICAgICAgICAgICAgICBhLlcuZG9jdW1lbnRFbGVtZW50LmFwcGVuZENoaWxkKGIpOwogICAgICAgICAgICAgICAgICAgIHZhciBjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBfLlZxKGIpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgMiA9PT0gYS5sIHx8IDMgPT09IGEubCA/IHhEKGEuSywgYS5zbG90SWQsIGMpIDogXy56bChhLCBjKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH0sIE1HID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMiAhPT0gYS5sICYmIDMgIT09IGEubCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gXy55KF8udChBcnJheSwgJ2Zyb20nKS5jYWxsKEFycmF5LCBiLmNoaWxkTm9kZXMpKSwgZCA9IGMubmV4dCgpOyAhZC5kb25lOyBkID0gYy5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gZC52YWx1ZSwgMSA9PT0gZC5ub2RlVHlwZSAmJiBkLmlkICE9PSBhLm8gJiYgXy5WcShkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5zdHlsZS5kaXNwbGF5ID0gJyc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEhqID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA2NzYpOwogICAgICAgICAgICAgICAgdGhpcy5DID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFYodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhIaiwgWSk7CiAgICAgICAgICAgIEhqLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSBqZyh0aGlzLmwudmFsdWUpOwogICAgICAgICAgICAgICAgdGhpcy5DLmooYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBRaiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODA3KTsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFcodGhpcywgYik7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBXKHRoaXMsIGMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oUWosIFkpOwogICAgICAgICAgICBRai5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gXy56YyhFdCk7CiAgICAgICAgICAgICAgICBpZiAoMCAhPT0gYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gdGhpcy5sLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIGlmIChiICYmICF0aGlzLm8udmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBGcih0aGlzLkkpOwogICAgICAgICAgICAgICAgICAgICAgICBiID0gbmV3IENCKGMsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICAxID09PSBhID8gYiA9IERCKGIpIDogKGIgPSBycignZ29vZ2xlX2Fkc190b3BfZnJhbWVfY3RybCcsIGIuaiksIGIgPSAhKCFiIHx8ICFiLmNvbnRlbnRXaW5kb3cpKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiB8fCB0aGlzLlIobmV3IHZoKCdDYW5ub3QgY3JlYXRlIHRvcCB3aW5kb3cgZnJhbWU6ICcgKyBhKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpcy5DLm5vdGlmeSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgTWogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg4MSk7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVyh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKE1qLCBZKTsKICAgICAgICAgICAgTWoucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgIGlmIChfLkgoRnQpIHx8ICF0aGlzLmwudmFsdWUpCiAgICAgICAgICAgICAgICAgICAganYodGhpcy5DKTsKICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSB0aGlzLmwudmFsdWUsIGMgPSB7fSwgZCA9IF8ueShVYihiLCBocSwgNykpLCBlID0gZC5uZXh0KCk7ICFlLmRvbmU7IGUgPSBkLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUudmFsdWUsIGNbbGsoZSwgMSldID0gSlNPTi5wYXJzZShsayhlLCAyKSk7CiAgICAgICAgICAgICAgICAgICAgKGQgPSBXYihiLCBncSwgNikpICYmIChjWydodHRwczovL2dvb2dsZWFkcy5nLmRvdWJsZWNsaWNrLm5ldCddID0gZC50b0pTT04oKSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5DLmooewogICAgICAgICAgICAgICAgICAgICAgICBzZWxsZXI6ICdodHRwczovL3B1YmFkcy5nLmRvdWJsZWNsaWNrLm5ldCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGRlY2lzaW9uTG9naWNVcmw6IGxrKGIsIDEpLAogICAgICAgICAgICAgICAgICAgICAgICB0cnVzdGVkU2NvcmluZ1NpZ25hbHNVcmw6IGxrKGIsIDIpLAogICAgICAgICAgICAgICAgICAgICAgICBpbnRlcmVzdEdyb3VwQnV5ZXJzOiBPaChiLCAzKSwKICAgICAgICAgICAgICAgICAgICAgICAgYWRkaXRpb25hbEJpZHM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBhdWN0aW9uU2lnbmFsczogSlNPTi5wYXJzZShsayhiLCA0KSB8fCAne30nKSwKICAgICAgICAgICAgICAgICAgICAgICAgc2VsbGVyU2lnbmFsczogKG51bGwgPT09IChhID0gV2IoYiwgaXEsIDUpKSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBhLnRvSlNPTigpKSB8fCBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgcGVyQnV5ZXJTaWduYWxzOiBjCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE1qLnByb3RvdHlwZS5BID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAganYodGhpcy5DKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE9HID0gbmF2aWdhdG9yLCBOaiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg4Mik7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qYSA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5vID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmwgPSBXKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuQiA9IFcodGhpcywgYik7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5HID0gVyh0aGlzLCBjKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkogPSBXKHRoaXMsIGQpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKE5qLCBZKTsKICAgICAgICAgICAgdmFyIFBHID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEuamEuZmEoYS5HLnZhbHVlKTsKICAgICAgICAgICAgICAgIGEuby5mYShhLkoudmFsdWUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBOai5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYywgZCwgZSwgZiwgZywgaCwgaywgbCwgbSwgbjsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAocSkgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IHEuaikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoXy5IKEZ0KSB8fCAhYS5CLnZhbHVlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBHKGEpLCBxLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgICAgICBmID0gbnVsbCA9PT0gKGIgPSBhLmwudmFsdWUpIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuZ2V0V2lkdGgoKTsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IG51bGwgPT09IChjID0gYS5sLnZhbHVlKSB8fCB2b2lkIDAgPT09IGMgPyB2b2lkIDAgOiBjLmdldEhlaWdodCgpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYgfHwgIWcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUEcoYSksIHEucmV0dXJuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSBwZXJmb3JtYW5jZS5ub3coKTsKICAgICAgICAgICAgICAgICAgICAgICAgayA9IChudWxsID09PSAoZCA9IGEubC52YWx1ZSkgfHwgdm9pZCAwID09PSBkID8gdm9pZCAwIDogc2soZCwgOCkpIHx8IDEwMDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqYihxLCB2LlByb21pc2UucmFjZShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsID09PSAoZSA9IE9HLnJ1bkFkQXVjdGlvbikgfHwgdm9pZCAwID09PSBlID8gdm9pZCAwIDogZS5jYWxsKE9HLCBhLkIudmFsdWUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgRHIoaykKICAgICAgICAgICAgICAgICAgICAgICAgXSksIDIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBsID0gcS5tOwogICAgICAgICAgICAgICAgICAgIG0gPSBwZXJmb3JtYW5jZS5ub3coKSAtIGg7CiAgICAgICAgICAgICAgICAgICAgbiA9ICd0aW1lb3V0JyA9PT0gbDsKICAgICAgICAgICAgICAgICAgICBpZiAoIWwgfHwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSwgQiwgeCwgeiwgQywgRCwgSiwgVCwgYWEgPSAnaHR0cHM6Ly9nb29nbGVhZHMuZy5kb3VibGVjbGljay5uZXQvdGQvYXVjdGlvbndpbm5lcj9zdGF0dXM9bm93aW5uZXImaXNDb250ZXh0dWFsV2lubmVyPTEnLCBYID0gbnVsbCA9PT0gKEIgPSBudWxsID09PSAodSA9IGEubC52YWx1ZSkgfHwgdm9pZCAwID09PSB1ID8gdm9pZCAwIDogV2IodSwgaXEsIDUpKSB8fCB2b2lkIDAgPT09IEIgPyB2b2lkIDAgOiBCLmdldEVzY2FwZWRRZW1RdWVyeUlkKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIFggJiYgKGFhICs9ICcmcXFpZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KFgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgKHUgPSBudWxsID09PSAoeiA9IG51bGwgPT09ICh4ID0gYS5sLnZhbHVlKSB8fCB2b2lkIDAgPT09IHggPyB2b2lkIDAgOiBXYih4LCBpcSwgNSkpIHx8IHZvaWQgMCA9PT0geiA/IHZvaWQgMCA6IGxrKHosIDYpKSAmJiAoYWEgKz0gJyZ4ZnBRaWQ9JyArIGVuY29kZVVSSUNvbXBvbmVudCh1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSAoRCA9IG51bGwgPT09IChDID0gYS5sLnZhbHVlKSB8fCB2b2lkIDAgPT09IEMgPyB2b2lkIDAgOiBXYihDLCBpcSwgNSkpIHx8IHZvaWQgMCA9PT0gRCA/IDAgOiBTbyhELCA0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFhICs9ICcmaXNfcGxvZz0xJzsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IChUID0gbnVsbCA9PT0gKEogPSBhLmwudmFsdWUpIHx8IHZvaWQgMCA9PT0gSiA/IHZvaWQgMCA6IFdiKEosIGlxLCA1KSkgfHwgdm9pZCAwID09PSBUID8gMCA6IFNvKFQsIDcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWEgKz0gJyZoYXNYZnBBZHM9MSc7CiAgICAgICAgICAgICAgICAgICAgICAgIGFhICs9ICcmYXBwbGllZF90aW1lb3V0X21zPScgKyAobiA/IGsgOiAwKSArICcmZHVyYXRpb25fbXM9JyArIE1hdGgucm91bmQobSk7CiAgICAgICAgICAgICAgICAgICAgICAgIFpsKGFhKTsKICAgICAgICAgICAgICAgICAgICAgICAgUEcoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBhLmphLmooewogICAgICAgICAgICAgICAgICAgICAgICBraW5kOiAyLAogICAgICAgICAgICAgICAgICAgICAgICB0ZTogbAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGEuby5qKG5ldyBfLlVpKGYsIGcpKTsKICAgICAgICAgICAgICAgICAgICBMbShxKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBOai5wcm90b3R5cGUuQSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIFBHKHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgU2ogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDgzOSk7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFcodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhTaiwgWSk7CiAgICAgICAgICAgIFNqLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiLCBjLCBkLCBlOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChmLmopIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChfLkgoR3QpIHx8ICFtdihhLmwpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuQy5ub3RpZnkoKSwgZi5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGEubC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IFdiKGIsIGNxLCAzKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGMgfHwgdm9pZCAwID09PSBjIHx8ICFTbyhjLCAxMSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuaiA9IDI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBkID0gcGVyZm9ybWFuY2Uubm93KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBzayhjLCAxMik7CiAgICAgICAgICAgICAgICAgICAgICAgIGYuRiA9IDM7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqYihmLCBuZXcgdi5Qcm9taXNlKGZ1bmN0aW9uIChnLCBoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9ICdodHRwczovL3B1YmFkcy5nLmRvdWJsZWNsaWNrLm5ldC90ZC9zdHM/cmVuZGVyX3VybHM9JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFlmKGMsIDEzKSAmJiAoayArPSBsayhjLCAxMykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwub3BlbignR0VUJywgayk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLnRpbWVvdXQgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5vbmxvYWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAwIDw9IGwuc3RhdHVzICYmIDMwMCA+IGwuc3RhdHVzID8gKG9mKCdncHRfdGRfc3RzX3JwYycsIGZ1bmN0aW9uIChtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRmKG0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKG0sICd0aW1lb3V0X21zJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkobSwgJ2R1cmF0aW9uX21zJywgTWF0aC5yb3VuZChwZXJmb3JtYW5jZS5ub3coKSAtIGQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSShtLCAndXJsX2NvdW50Jywgc2soYywgMTQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSksIGcoKSkgOiBoKEVycm9yKCdzdGF0dXM6ICcgKyBsLnN0YXR1cy50b1N0cmluZygpICsgJyAnICsgbC5zdGF0dXNUZXh0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5vbmVycm9yID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgoRXJyb3IoJ3N0YXR1czogJyArIGwuc3RhdHVzLnRvU3RyaW5nKCkgKyAnICcgKyBsLnN0YXR1c1RleHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLm9udGltZW91dCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZignZ3B0X3RkX3N0c19ycGNfdGltZW91dCcsIGZ1bmN0aW9uIChtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRmKG0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKG0sICd0aW1lb3V0X21zJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkobSwgJ2R1cmF0aW9uX21zJywgTWF0aC5yb3VuZChwZXJmb3JtYW5jZS5ub3coKSAtIGQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSShtLCAndXJsX2NvdW50Jywgc2soYywgMTQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwuc2VuZCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgNSk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA1OgogICAgICAgICAgICAgICAgICAgICAgICBsYihmLCAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICBtYihmKSwgb2YoJ2dwdF90ZF9zdHNfcnBjX2Vycm9yJywgZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRmKGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgSShnLCAndGltZW91dF9tcycsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgSShnLCAnZHVyYXRpb25fbXMnLCBNYXRoLnJvdW5kKHBlcmZvcm1hbmNlLm5vdygpIC0gZCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgSShnLCAndXJsX2NvdW50Jywgc2soYywgMTQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgeyBwYTogMSB9KTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgIGEuQy5ub3RpZnkoKSwgTG0oZik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFNqLnByb3RvdHlwZS5BID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5DLm5vdGlmeSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUUcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgICAgICB9LCBSRyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgYiAmJiAobnVsbCA9PT0gKGMgPSBhLmouZ2V0KGIpKSB8fCB2b2lkIDAgPT09IGMgPyB2b2lkIDAgOiBjLnVhKCksIGEuai5kZWxldGUoYikpOwogICAgICAgICAgICAgICAgfSwgVEcgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZywgaCkgewogICAgICAgICAgICAgICAgICAgIHZhciBrID0gZG9jdW1lbnQsIGwgPSB3aW5kb3c7CiAgICAgICAgICAgICAgICAgICAgUkcoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgUUMoYiwgVkMsIFNHKTsKICAgICAgICAgICAgICAgICAgICBoICYmIF8uSChjdCkgPyAoZiA9IG5ldyBRYygpLCBjID0gbmV3IEVHKGIsIGQsIGMsIFJlLk8oKSwgbCwgaywgZS5hYyksIE4oZiwgYyksIGEuai5zZXQoYiwgZiksIF8uemwoYiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBSRyhhLCBiKTsKICAgICAgICAgICAgICAgICAgICB9KSwgU2MoZikpIDogKGMgPSBqayhiLCBjLCBkLCBlLCBrLCBmLCBnKSwgYS5qLnNldChiLCBjKSwgXy56bChiLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIFJHKGEsIGIpOwogICAgICAgICAgICAgICAgICAgIH0pLCBTYyhjKSk7CiAgICAgICAgICAgICAgICB9LCBTRyA9IF8uVm4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIEdnKCdncHQtZmlyc3QtYWQtcmVuZGVyJyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIFVHID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA5MjApOwogICAgICAgICAgICAgICAgdGhpcy5QID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuQWEgPSBkOwogICAgICAgICAgICAgICAgdGhpcy5LID0gZTsKICAgICAgICAgICAgICAgIHRoaXMuQyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBWKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gVyh0aGlzLCBjKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IF8uYmZbMTQ4XSAmJiBfLkgoc3MpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oVUcsIFkpOwogICAgICAgICAgICBVRy5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhLCBiLCBjLCBkLCBlLCBmLCBnLCBoLCBrLCBsLCBtLCBuLCBxLCB1LCBCLCB4LCB6LCBDID0gd2luZG93LnBianM7CiAgICAgICAgICAgICAgICBvZignaGJtX2JjYScsIGZ1bmN0aW9uIChhYSkgewogICAgICAgICAgICAgICAgICAgIGRmKGFhKTsKICAgICAgICAgICAgICAgICAgICB2YXIgWCA9ICgwLCBGLkgpKEMpLCBTLCBjYSwga2EsIGVhID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgICAgICAgICAgWCA9IF8ueShfLnQoT2JqZWN0LCAnZW50cmllcycpLmNhbGwoT2JqZWN0LCBudWxsICE9PSAoUyA9IFguYmlkZGVyU2V0dGluZ3MpICYmIHZvaWQgMCAhPT0gUyA/IFMgOiB7fSkpOwogICAgICAgICAgICAgICAgICAgIGZvciAoUyA9IFgubmV4dCgpOyAhUy5kb25lOyBTID0gWC5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHhhID0gXy55KFMudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICBTID0geGEubmV4dCgpLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICB4YSA9IHhhLm5leHQoKS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoYiA9IG51bGwgPT09IChjYSA9IHhhLmJpZENwbUFkanVzdG1lbnQpIHx8IHZvaWQgMCA9PT0gY2EgPyB2b2lkIDAgOiBjYS5jYWxsKHhhLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gaGIgJiYgZWEuc2V0KFMsIGhiKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoUGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVhLnNldChTLCAnZXJyXycgKyAobnVsbCA9PT0gKGthID0gUGEpIHx8IHZvaWQgMCA9PT0ga2EgPyB2b2lkIDAgOiBrYS5tZXNzYWdlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgY2EgPSBfLnkoXy50KGVhLCAnZW50cmllcycpLmNhbGwoZWEpKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGthID0gY2EubmV4dCgpOyAha2EuZG9uZTsga2EgPSBjYS5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGVhID0gXy55KGthLnZhbHVlKSwga2EgPSBlYS5uZXh0KCkudmFsdWUsIGVhID0gZWEubmV4dCgpLnZhbHVlLCBJKGFhLCBrYSwgZWEpOwogICAgICAgICAgICAgICAgfSwgeyBwYTogQyA/IF8uemMocHMpIDogMCB9KTsKICAgICAgICAgICAgICAgIGlmICghXy5IKHZzKSAmJiAhXy5IKHVzKSkKICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5sKQogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09PSAoYiA9IG51bGwgPT09IChhID0gd2luZG93LmNvbnNvbGUpIHx8IHZvaWQgMCA9PT0gYSA/IHZvaWQgMCA6IGEubG9nKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLmNhbGwoYSwgJ1tHUFRdIG1ldGFkYXRhIGRlYnVnOiBkaXNhYmxlZCBieSBjb25maWd1cmF0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGp2KHRoaXMuQyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoXy5IKHVzKSAmJiAobnVsbCA9PT0gKGQgPSBudWxsID09PSAoYyA9IHRoaXMuQi52YWx1ZSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogY1t0aGlzLkFhXSkgfHwgdm9pZCAwID09PSBkIHx8ICFkLldkKSkKICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5sKQogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09PSAoZiA9IG51bGwgPT09IChlID0gd2luZG93LmNvbnNvbGUpIHx8IHZvaWQgMCA9PT0gZSA/IHZvaWQgMCA6IGUubG9nKSB8fCB2b2lkIDAgPT09IGYgPyB2b2lkIDAgOiBmLmNhbGwoZSwgJ1tHUFRdIG1ldGFkYXRhIGRlYnVnOiBjb2xsZWN0aW9uIG5vdCBlbmFibGVkJyk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGp2KHRoaXMuQyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gQyB8fCB2b2lkIDAgPT09IEMgfHwgIUMubGliTG9hZGVkKQogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmwpCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT09IChoID0gbnVsbCA9PT0gKGcgPSB3aW5kb3cuY29uc29sZSkgfHwgdm9pZCAwID09PSBnID8gdm9pZCAwIDogZy5sb2cpIHx8IHZvaWQgMCA9PT0gaCA/IHZvaWQgMCA6IGguY2FsbChnLCAnW0dQVF0gbWV0YWRhdGEgZGVidWc6IHByZWJpZCBub3QgbG9hZGVkJyk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGp2KHRoaXMuQyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIChudWxsID09PSBDIHx8IHZvaWQgMCA9PT0gQyA/IHZvaWQgMCA6IEMuZ2V0RXZlbnRzKSkKICAgICAgICAgICAgICAgICAgICBpZiAoTGgoKS5lcnJvcihWRSgpKSwgdGhpcy5sKQogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09PSAobCA9IG51bGwgPT09IChrID0gd2luZG93LmNvbnNvbGUpIHx8IHZvaWQgMCA9PT0gayA/IHZvaWQgMCA6IGsubG9nKSB8fCB2b2lkIDAgPT09IGwgPyB2b2lkIDAgOiBsLmNhbGwoaywgJ1tHUFRdIG1ldGFkYXRhIGRlYnVnOiBldmVudHMgdW5hdmFpbGFibGUnKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAganYodGhpcy5DKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBEID0gXy5IKHJzKSA/IFZHKHRoaXMsIEMpIDogV0codGhpcywgQyk7CiAgICAgICAgICAgICAgICBpZiAoRCkKICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5sKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT09IChuID0gbnVsbCA9PT0gKG0gPSB3aW5kb3cuY29uc29sZSkgfHwgdm9pZCAwID09PSBtID8gdm9pZCAwIDogbS5ncm91cCkgfHwgdm9pZCAwID09PSBuID8gdm9pZCAwIDogbi5jYWxsKG0sICdbR1BUXSBtZXRhZGF0YSBkZWJ1ZyBmb3IgJyArIHRoaXMuby52YWx1ZS5sZW5ndGggKyAnIHNsb3RzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIEogPSAwOyBKIDwgdGhpcy5vLnZhbHVlLmxlbmd0aDsgSisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgVCA9IG5ldyBDbygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHAoRFtKXSwgVCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBUID0gRWIoR28oVCksIDMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCA9PT0gKHUgPSBudWxsID09PSAocSA9IHdpbmRvdy5jb25zb2xlKSB8fCB2b2lkIDAgPT09IHEgPyB2b2lkIDAgOiBxLmxvZykgfHwgdm9pZCAwID09PSB1ID8gdm9pZCAwIDogdS5jYWxsKHEsICdbR1BUXSBzbG90ICcgKyB0aGlzLm8udmFsdWVbSl0gKyAnOiBodHRwOi8vZ28vbWV0YWRhdGEtZGVidWcvJyArIFQpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT09IChCID0gd2luZG93LmNvbnNvbGUpIHx8IHZvaWQgMCA9PT0gQiA/IHZvaWQgMCA6IEIuZ3JvdXBFbmQoKTsKICAgICAgICAgICAgICAgICAgICAgICAganYodGhpcy5DKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5DLmooRCk7CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID8gKG51bGwgPT09ICh6ID0gbnVsbCA9PT0gKHggPSB3aW5kb3cuY29uc29sZSkgfHwgdm9pZCAwID09PSB4ID8gdm9pZCAwIDogeC5sb2cpIHx8IHZvaWQgMCA9PT0geiA/IHZvaWQgMCA6IHouY2FsbCh4LCAnW0dQVF0gbWV0YWRhdGEgZGVidWc6IG5vIGJpZGRpbmcgZGF0YScpLCBqdih0aGlzLkMpKSA6IHRoaXMuQy5qKFtdKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgVUcucHJvdG90eXBlLk0gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5BKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBVRy5wcm90b3R5cGUuQSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBMaCgpLmVycm9yKFdFKGEubWVzc2FnZSkpOwogICAgICAgICAgICAgICAganYodGhpcy5DKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFdHID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYywgZCA9IGIgPyBudWxsICE9PSAoYyA9ICgwLCBGLkgpKGIuZ2V0RXZlbnRzKSgpLmZpbHRlcihmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2F1Y3Rpb25FbmQnID09PSBmLmV2ZW50VHlwZSAmJiAobnVsbCA9PT0gKGcgPSBmLmFyZ3MpIHx8IHZvaWQgMCA9PT0gZyA/IHZvaWQgMCA6IGcuYXVjdGlvbklkKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpICYmIHZvaWQgMCAhPT0gYyA/IGMgOiBbXSA6IFtdLCBlID0gITE7CiAgICAgICAgICAgICAgICAgICAgYiA9IGEuby52YWx1ZS5tYXAoZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcsIGgsIGssIGwsIG0sIG4sIHEgPSBuZXcgb3AoKSwgdSA9IGYuZ2V0QWRVbml0UGF0aCgpLCBCID0gbnVsbCAhPT0gKGcgPSBYRy5nZXQoZikpICYmIHZvaWQgMCAhPT0gZyA/IGcgOiAwLCB4ID0gbnVsbCAhPT0gKGggPSBkLmZpbHRlcihmdW5jdGlvbiAoWCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBTLCBjYSwga2EsIGVhLCB4YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTnVtYmVyKG51bGwgPT09IChTID0gWC5hcmdzKSB8fCB2b2lkIDAgPT09IFMgPyB2b2lkIDAgOiBTLnRpbWVzdGFtcCkgPiBCICYmICgobnVsbCA9PT0gKGthID0gbnVsbCA9PT0gKGNhID0gWC5hcmdzKSB8fCB2b2lkIDAgPT09IGNhID8gdm9pZCAwIDogY2EuYWRVbml0Q29kZXMpIHx8IHZvaWQgMCA9PT0ga2EgPyB2b2lkIDAgOiBfLnQoa2EsICdpbmNsdWRlcycpLmNhbGwoa2EsIGYuZ2V0RG9tSWQoKSkpIHx8IChudWxsID09PSAoeGEgPSBudWxsID09PSAoZWEgPSBYLmFyZ3MpIHx8IHZvaWQgMCA9PT0gZWEgPyB2b2lkIDAgOiBlYS5hZFVuaXRDb2RlcykgfHwgdm9pZCAwID09PSB4YSA/IHZvaWQgMCA6IF8udCh4YSwgJ2luY2x1ZGVzJykuY2FsbCh4YSwgdSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSAmJiB2b2lkIDAgIT09IGggPyBoIDogW107CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgheC5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHogPSB4LnJlZHVjZShmdW5jdGlvbiAoWCwgUykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIoUy5hcmdzLnRpbWVzdGFtcCkgPiBOdW1iZXIoWC5hcmdzLnRpbWVzdGFtcCkgPyBTIDogWDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBDID0gbnVsbCA9PT0gKGsgPSBudWxsID09PSB6IHx8IHZvaWQgMCA9PT0geiA/IHZvaWQgMCA6IHouYXJncykgfHwgdm9pZCAwID09PSBrID8gdm9pZCAwIDogay5hdWN0aW9uSWQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghQykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgRCA9IG51bGwgIT09IChuID0gbnVsbCA9PT0gKG0gPSBudWxsID09PSAobCA9IHouYXJncykgfHwgdm9pZCAwID09PSBsID8gdm9pZCAwIDogbC5iaWRzUmVjZWl2ZWQpIHx8IHZvaWQgMCA9PT0gbSA/IHZvaWQgMCA6IG0uZmlsdGVyKGZ1bmN0aW9uIChYKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWC5hZFVuaXRDb2RlID09PSBmLmdldERvbUlkKCkgfHwgWC5hZFVuaXRDb2RlID09PSB1OwogICAgICAgICAgICAgICAgICAgICAgICB9KSkgJiYgdm9pZCAwICE9PSBuID8gbiA6IFtdOwogICAgICAgICAgICAgICAgICAgICAgICB4ID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBKID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgRCA9IF8ueShEKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgVCA9IEQubmV4dCgpOyAhVC5kb25lOyBUID0gRC5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoVCA9IFQudmFsdWUsICdzdHJpbmcnID09PSB0eXBlb2YgVC5iaWRkZXIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9PSBKICYmIHZvaWQgMCAhPT0gSiA/IEogOiBKID0gcWsocSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGsoSiwgZiwgVC5hZFVuaXRDb2RlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYWEgPSBvayhKLCAoMCwgRi5IKShULmJpZGRlcikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcoYWEsIDQsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRwKGFhLCBEayhULCB4LCBiaChhLlBbZi5nZXREb21JZCgpXSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlIHx8IChlID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFhHLnNldChmLCAoMCwgRi5IKSh6LmFyZ3MudGltZXN0YW1wKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHogPSB1aygoMCwgRi5IKSh3aW5kb3cucGJqcyksIEMsIHEsIEosIGYpOwogICAgICAgICAgICAgICAgICAgICAgICBlIHx8IChlID0geik7CiAgICAgICAgICAgICAgICAgICAgICAgIFhHLmhhcyhmKSB8fCBfLnpsKGYsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBYRy5kZWxldGUoZik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBJRChhLkssIGYsIHgpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IGIgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgVkcgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYiA/ICgwLCBGLkgpKGIuZ2V0RXZlbnRzKSgpIDogW10sIGQgPSBjLmZpbHRlcihmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBmLmFyZ3M7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2F1Y3Rpb25FbmQnID09PSBmLmV2ZW50VHlwZSAmJiBnLmF1Y3Rpb25JZDsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGUgPSAhMTsKICAgICAgICAgICAgICAgICAgICBiID0gYS5vLnZhbHVlLm1hcChmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZywgaCwgaywgbCA9IG5ldyBvcCgpLCBtID0gZnVuY3Rpb24gKGNhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNhID09PSBmLmdldERvbUlkKCkgfHwgY2EgPT09IGYuZ2V0QWRVbml0UGF0aCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbiA9IG51bGwgIT09IChnID0gWEcuZ2V0KGYpKSAmJiB2b2lkIDAgIT09IGcgPyBnIDogMCwgcSA9IG51bGwgIT09IChoID0gZC5maWx0ZXIoZnVuY3Rpb24gKGNhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGthLCBlYSwgeGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE51bWJlcihudWxsID09PSAoa2EgPSBjYS5hcmdzKSB8fCB2b2lkIDAgPT09IGthID8gdm9pZCAwIDoga2EudGltZXN0YW1wKSA+IG4gJiYgKG51bGwgPT09ICh4YSA9IG51bGwgPT09IChlYSA9IGNhLmFyZ3MpIHx8IHZvaWQgMCA9PT0gZWEgPyB2b2lkIDAgOiBlYS5hZFVuaXRDb2RlcykgfHwgdm9pZCAwID09PSB4YSA/IHZvaWQgMCA6IF8udCh4YSwgJ2ZpbmQnKS5jYWxsKHhhLCBtKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgJiYgdm9pZCAwICE9PSBoID8gaCA6IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXEubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gbnVsbCA9PT0gKGsgPSBxLnJlZHVjZShmdW5jdGlvbiAoY2EsIGthKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTnVtYmVyKGthLmFyZ3MudGltZXN0YW1wKSA+IE51bWJlcihjYS5hcmdzLnRpbWVzdGFtcCkgPyBrYSA6IGNhOwogICAgICAgICAgICAgICAgICAgICAgICB9KSkgfHwgdm9pZCAwID09PSBrID8gdm9pZCAwIDogay5hcmdzOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEIgPSB2b2lkIDAgPT09IHUuYmlkZGVyUmVxdWVzdHMgPyBbXSA6IHUuYmlkZGVyUmVxdWVzdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIHEgPSB2b2lkIDAgPT09IHUuYmlkc1JlY2VpdmVkID8gW10gOiB1LmJpZHNSZWNlaXZlZDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHggPSB1LmF1Y3Rpb25JZDsKICAgICAgICAgICAgICAgICAgICAgICAgdSA9IHUudGltZXN0YW1wOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXggfHwgdm9pZCAwID09IHUgfHwgIUIubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGw7CiAgICAgICAgICAgICAgICAgICAgICAgIFhHLmhhcyhmKSB8fCBfLnpsKGYsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBYRy5kZWxldGUoZik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBYRy5zZXQoZiwgdSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBxayhsKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHogPSBuZXcgdi5NYXAoKSwgQyA9IHRnKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRWsoYywgeCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgQiA9IF8ueShCKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgRCA9IEIubmV4dCgpOyAhRC5kb25lOyBEID0gQi5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBKID0gRC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEQgPSBKLmJpZGRlckNvZGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgVCA9IEoudGltZW91dCwgYWEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEogPSBfLnkoSi5iaWRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIFggPSBKLm5leHQoKTsgIVguZG9uZTsgYWEgPSB7IGZiOiBhYS5mYiB9LCBYID0gSi5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgUyA9IFgudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWEuZmIgPSBTLmJpZElkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFggPSBTLnRyYW5zYWN0aW9uSWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUyA9IFMuYWRVbml0Q29kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhYS5mYiAmJiBtKFMpICYmIChlID0gITAsIHBrKHUsIGYsIFMpLCBYICYmICFZZih1LCA0KSAmJiB3KHUsIDQsIFgpLCBTID0gXy50KHEsICdmaW5kJykuY2FsbChxLCBmdW5jdGlvbiAoY2EpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChrYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGthLnJlcXVlc3RJZCA9PT0gY2EuZmI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShhYSkpLCBYID0gbWsodSwgbmsobmV3IGtrKCksIEQpKSwgUyA/ICh3KFgsIDQsIDEpLCAnbnVtYmVyJyA9PT0gdHlwZW9mIFMudGltZVRvUmVzcG9uZCAmJiByayhYLCBTLnRpbWVUb1Jlc3BvbmQpLCBkcChYLCBEayhTLCB6LCBiaChhLlBbZi5nZXREb21JZCgpXSkpKSkgOiAoUyA9IEMoKS5nZXQoYWEuZmIpKSA/ICh3KFgsIDQsIDIpLCByayhYLCBNYXRoLnJvdW5kKFMpKSkgOiAodyhYLCA0LCAzKSwgcmsoWCwgVCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBJRChhLkssIGYsIHopOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbDsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IGIgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgWEcgPSBuZXcgdi5NYXAoKTsKICAgICAgICAgICAgdmFyIFlHID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA4NzYpOwogICAgICAgICAgICAgICAgdGhpcy5KID0gYTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gVyh0aGlzLCBjKTsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IFcodGhpcywgZCk7CiAgICAgICAgICAgICAgICB0aGlzLk4gPSBXKHRoaXMsIGUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oWUcsIFkpOwogICAgICAgICAgICBZRy5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYywgZCwgZSwgZjsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIGQgPSBuZXcgYncoKTsKICAgICAgICAgICAgICAgICAgICBlID0gbnVsbCA9PT0gKGIgPSBhLkopIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IEUoYiwgOSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IGEuTi52YWx1ZTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCA9ICFlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IHZvaWQgMCA9PT0gayA/ICExIDogazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsdShmKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoITEgPT09IGYuZ2RwckFwcGxpZXMgfHwgJ3RjdW5hdmFpbGFibGUnID09PSBmLnRjU3RyaW5nIHx8IHZvaWQgMCA9PT0gZi5nZHByQXBwbGllcyAmJiAhayB8fCAnc3RyaW5nJyAhPT0gdHlwZW9mIGYudGNTdHJpbmcgfHwgIWYudGNTdHJpbmcubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsID0gdm9pZCAwID09PSBsID8gJzc1NScgOiBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZi5wdWJsaXNoZXIgJiYgZi5wdWJsaXNoZXIucmVzdHJpY3Rpb25zICYmIChoID0gZi5wdWJsaXNoZXIucmVzdHJpY3Rpb25zWycxJ10sIHZvaWQgMCAhPT0gaCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gaFt2b2lkIDAgPT09IGwgPyAnNzU1JyA6IGxdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPT09IGggPyBsID0gITEgOiBmLnB1cnBvc2UgJiYgZi52ZW5kb3IgPyAoaCA9IGYudmVuZG9yLmNvbnNlbnRzLCAobCA9ICEoIWggfHwgIWhbdm9pZCAwID09PSBsID8gJzc1NScgOiBsXSkpICYmIGYucHVycG9zZU9uZVRyZWF0bWVudCAmJiAnQ0gnID09PSBmLnB1Ymxpc2hlckNDID8gbCA9ICEwIDogbCAmJiAobCA9IGYucHVycG9zZS5jb25zZW50cywgbCA9ICEoIWwgfHwgIWxbJzEnXSkpKSA6IGwgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgbCA9IHcoZCwgNSwgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGwgPSB3KGwsIDIsIGYudGNTdHJpbmcpOwogICAgICAgICAgICAgICAgICAgICAgICBoID0gbnVsbCAhPT0gKGMgPSBmLmFkZHRsQ29uc2VudCkgJiYgdm9pZCAwICE9PSBjID8gYyA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICBsID0gdyhsLCA0LCBoKTsKICAgICAgICAgICAgICAgICAgICAgICAgdyhsLCA3LCBmLmludGVybmFsRXJyb3JTdGF0ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT0gZi5nZHByQXBwbGllcyAmJiB3KGQsIDMsIGYuZ2RwckFwcGxpZXMpOwogICAgICAgICAgICAgICAgICAgICAgICAndGN1bmF2YWlsYWJsZScgPT09IGYudGNTdHJpbmcgPyBhLmwuaW5mbyhSRSgnZmFpbGVkJykpIDogYS5sLmluZm8oUkUoJ3N1Y2NlZWRlZCcpKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgdyhkLCA1LCAhZSk7CiAgICAgICAgICAgICAgICAgICAgYS5HLnZhbHVlICYmIHcoZCwgMSwgYS5HLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICBudWxsICE9IGEuQi52YWx1ZSAmJiB3KGQsIDYsIGEuQi52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgYS5vLmooZCk7CiAgICAgICAgICAgICAgICAgICAgTG0oZyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFpHID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYpIHsKICAgICAgICAgICAgICAgIGYgPSB2b2lkIDAgPT09IGYgPyBNayA6IGY7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODc5KTsKICAgICAgICAgICAgICAgIHRoaXMuQWEgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5vID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGQ7CiAgICAgICAgICAgICAgICB0aGlzLmhhID0gZTsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IGY7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gbnVsbDsKICAgICAgICAgICAgICAgIF8uYmZbMjYwXSAmJiAodGhpcy5CID0gVih0aGlzLCBjKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhaRywgWSk7CiAgICAgICAgICAgIFpHLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiLCBjLCBkOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gZS5qKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gYS5oYTsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IHZvaWQgMCA9PT0gZiA/IF8uci50b3AgOiBmOwogICAgICAgICAgICAgICAgICAgICAgICBmID0gcHIoZiwgJ2dvb2dsZWZjUHJlc2VudCcpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGEuSTsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IHZvaWQgMCA9PT0gZyA/IF8uciA6IGc7CiAgICAgICAgICAgICAgICAgICAgICAgIGcuZ29vZ2xlZmMgJiYgIWYgJiYgYS5HKGEuQWEpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gKGMgPSBudWxsID09PSAoYiA9IGEuQikgfHwgdm9pZCAwID09PSBiID8gdm9pZCAwIDogYi52YWx1ZSkgJiYgdm9pZCAwICE9PSBjID8gIWMgOiAhSmcoYS5vKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAganYoYS5sKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGUsIEVBKGEubywgJ2xvYWRlZCcpLCAzKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZCA9IGUubTsKICAgICAgICAgICAgICAgICAgICBhLmwuaihkKTsKICAgICAgICAgICAgICAgICAgICBMbShlKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgJEcgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg3Nyk7CiAgICAgICAgICAgICAgICB0aGlzLkFhID0gYTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLkcgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IFcodGhpcywgZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTygkRywgWSk7CiAgICAgICAgICAgICRHLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiLCBjOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gZC5qKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiA9IGEuQi52YWx1ZSwgamIoZCwgRkEoYS5vLCBiLCBhLkFhLCBhLkcpLCAyKTsKICAgICAgICAgICAgICAgICAgICBjID0gZC5tOwogICAgICAgICAgICAgICAgICAgIGEubC5mYShjKTsKICAgICAgICAgICAgICAgICAgICBMbShkKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgYUggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg3NCk7CiAgICAgICAgICAgICAgICB0aGlzLkkgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHN2KHRoaXMsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oYUgsIFkpOwogICAgICAgICAgICBhSC5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYzsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgIGIgPSBuZXcgam0oYS5JLCAtMSk7CiAgICAgICAgICAgICAgICAgICAgXy5odShhLCBiKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIWxtKGIpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ganYoYS5sKSwgZC5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICBMaCgpLmluZm8oUUUoKSk7CiAgICAgICAgICAgICAgICAgICAgYyA9IF8ubWYoNjYxLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBhLmwuZmEoZSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgbXUoYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgTG0oZCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGJIID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA4NzUpOwogICAgICAgICAgICAgICAgdGhpcy5vID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgc3YodGhpcywgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhiSCwgWSk7CiAgICAgICAgICAgIGJILnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiLCBjOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IG5ldyBrbShhLkkpOwogICAgICAgICAgICAgICAgICAgIF8uaHUoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFtbShiKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGp2KGEubCksIGQucmV0dXJuKCk7CiAgICAgICAgICAgICAgICAgICAgYyA9IF8ubWYoNjYwLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBlICYmICdzdHJpbmcnID09PSB0eXBlb2YgZS51c3BTdHJpbmcgPyBhLmwuaihlLnVzcFN0cmluZykgOiBqdihhLmwpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGEuby5pbmZvKFBFKCkpOwogICAgICAgICAgICAgICAgICAgIHZBKGIsIGMpOwogICAgICAgICAgICAgICAgICAgIExtKGQpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBjSCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODk2KTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBVKHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oY0gsIFkpOwogICAgICAgICAgICBjSC5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYjsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IGMuaikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGMsIEtnKGEubyksIDIpOwogICAgICAgICAgICAgICAgICAgIGIgPSBjLm07CiAgICAgICAgICAgICAgICAgICAgYS5sLmooYik7CiAgICAgICAgICAgICAgICAgICAgTG0oYyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGRIID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUpIHsKICAgICAgICAgICAgICAgIGQgPSB2b2lkIDAgPT09IGQgPyBOayA6IGQ7CiAgICAgICAgICAgICAgICBlID0gdm9pZCAwID09PSBlID8gZG9jdW1lbnQgOiBlOwogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg4Nik7CiAgICAgICAgICAgICAgICB0aGlzLmNhID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuSyA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLkwgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5sID0gZDsKICAgICAgICAgICAgICAgIHRoaXMuVyA9IGU7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBxdih0aGlzKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGRILCBZKTsKICAgICAgICAgICAgZEgucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGIsIGMsIGQsIGUsIGYsIGc7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSBoLmopCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfLkgoaXQpICYmIDMgPT09IGJBKGEuVykgPyBoID0gamIoaCwgbmV3IHYuUHJvbWlzZShmdW5jdGlvbiAoaykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgZ0EoaywgYS5XKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIDIpIDogKGguaiA9IDIsIGggPSB2b2lkIDApLCBoOwogICAgICAgICAgICAgICAgICAgIGlmICg0ICE9IGguaikgewogICAgICAgICAgICAgICAgICAgICAgICBjID0gYS5MOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gYy5VOwogICAgICAgICAgICAgICAgICAgICAgICBlID0gbnVsbCAhPT0gKGIgPSBXYihkLCBFaiwgNSkpICYmIHZvaWQgMCAhPT0gYiA/IGIgOiBuZXcgRWooKTsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IFlmKGUsIDEpID8gWWYoZSwgMykgJiYgMCAhPT0gQ2goKSA/ICgwLCBGLnZhKShHKGUsIDEpKSAqICgwLCBGLnZhKShIYyhlLCAzKSkgOiBHKGUsIDEpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLkMubm90aWZ5KCksIGgucmV0dXJuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBhLmNhLmV2ZXJ5KGZ1bmN0aW9uIChrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2cocmcoaykpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcgPyBqYihoLCBlSChhLCBmKSwgNCkgOiAoYS5DLm5vdGlmeSgpLCBoLnJldHVybigpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYS5DLm5vdGlmeSgpOwogICAgICAgICAgICAgICAgICAgIExtKGgpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBlSCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5yZXR1cm4obmV3IHYuUHJvbWlzZShmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGEubChmdW5jdGlvbiAoaywgbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgay5zb21lKGZ1bmN0aW9uIChtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPCBtLmludGVyc2VjdGlvblJhdGlvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgJiYgKGwuZGlzY29ubmVjdCgpLCBkKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBiICsgJyUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgXy56bChhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmRpc2Nvbm5lY3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSB7fSwgZyA9IF8ueShhLmNhKSwgaCA9IGcubmV4dCgpOyAhaC5kb25lOyBmID0geyBoYjogZi5oYiB9LCBoID0gZy5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gaC52YWx1ZSwgZi5oYiA9IHJnKGgpLCBmLmhiICYmIChlLm9ic2VydmUoZi5oYiksIHlEKGEuSywgaCwgZnVuY3Rpb24gKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnVub2JzZXJ2ZShrLmhiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShmKSkpOwogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZkggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDk0NCk7CiAgICAgICAgICAgICAgICB0aGlzLkkgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5sID0gbmV3IGN3KHRoaXMuSSk7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBXKHRoaXMsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oZkgsIFkpOwogICAgICAgICAgICBmSC5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5vLnZhbHVlOwogICAgICAgICAgICAgICAgaWYgKGEgJiYgZXcodGhpcy5sLCBhKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gZHcodGhpcy5sLCAnX19ncGlfb3B0X291dCcsIGEpOwogICAgICAgICAgICAgICAgICAgIGlmIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gbmV3ICRwKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSB3KGMsIDEsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICBiID0gdyh3KGIsIDIsIDIxNDc0ODM2NDcpLCAzLCAnLycpOwogICAgICAgICAgICAgICAgICAgICAgICBiID0gdyhiLCA0LCB0aGlzLkkubG9jYXRpb24uaG9zdG5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICBmdyh0aGlzLmwsICdfX2dwaV9vcHRfb3V0JywgYiwgYSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZ0ggPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/IFBrIDogYzsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA4ODMpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFYodGhpcywgYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhnSCwgWSk7CiAgICAgICAgICAgIGdILnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gYi5qKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghRShhLm8udmFsdWUsIDUpIHx8IF8uSChnbCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5sLm5vdGlmeSgpLCBiLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgICAgICBfLkgoZXQpIHx8IFB6KGEuQik7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYS5HKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFF6KG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5qID0gMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamIoYiwgbmV3IHYuUHJvbWlzZShmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgUXooYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYS5sLm5vdGlmeSgpOwogICAgICAgICAgICAgICAgICAgIExtKGIpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBoSCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODg0KTsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IFcodGhpcywgYik7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBWKHRoaXMsIGMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oaEgsIFkpOwogICAgICAgICAgICBoSC5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIF8uSGcoV3YpLnN0b3JhZ2UgPSB0aGlzLkcudmFsdWU7CiAgICAgICAgICAgICAgICBIRihfLkhnKFd2KSwgZHcodGhpcy5CLCAnX19nYWRzJywgdGhpcy5vLnZhbHVlKSk7CiAgICAgICAgICAgICAgICBEYygpLmooMjApOwogICAgICAgICAgICAgICAgRGMoKS5qKDIpOwogICAgICAgICAgICAgICAgdGhpcy5sLm5vdGlmeSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaUggPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg5MCk7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBhOwogICAgICAgICAgICAgICAgdGhpcy5jb25zb2xlID0gYjsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFcodGhpcywgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhpSCwgWSk7CiAgICAgICAgICAgIGlILnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzOwogICAgICAgICAgICAgICAgWmModGhpcy5vLCB0aGlzLmwudmFsdWUsIGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQsIGU7CiAgICAgICAgICAgICAgICAgICAgcmYoYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PT0gKGUgPSBudWxsID09PSAoZCA9IGEuY29uc29sZSkgfHwgdm9pZCAwID09PSBkID8gdm9pZCAwIDogZC5lcnJvcikgfHwgdm9pZCAwID09PSBlID8gdm9pZCAwIDogZS5jYWxsKGQsIGMpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBqSCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODczKTsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBWKHRoaXMsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oakgsIFkpOwogICAgICAgICAgICBqSC5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5sLnZhbHVlLCBiID0gdGhpcy5JOwogICAgICAgICAgICAgICAgIW5lKCkuX3B1YmNvbnNvbGVfZGlzYWJsZV8gJiYgKGEgPSB3YygnZ29vZ2xlX3B1YmNvbnNvbGUnLCBhLCBiKSkgJiYgKGEgPSBhLnNwbGl0KCd8JyksICcxJyAhPT0gYVswXSAmJiAnMCcgIT09IGFbMF0gfHwgZ2koKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBrSCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODc4KTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLlcgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5MID0gYzsKICAgICAgICAgICAgICAgIHRoaXMuQyA9IHF2KHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oa0gsIFkpOwogICAgICAgICAgICBrSC5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSBfLnkodGhpcy5sKSwgYiA9IGEubmV4dCgpOyAhYi5kb25lOyBiID0gYS5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICBiID0gYi52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHJnKGIsIHRoaXMuVyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFxZyhiLCB0aGlzLlcpICYmIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB0aGlzLkwsIGUgPSBkLlU7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBkLlBbYi5nZXREb21JZCgpXTsKICAgICAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSB0aGlzLkwuUFtmLmdldERvbUlkKCldLCBoID0gWGYoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZiA9IHJnKGYsIHRoaXMuVykpICYmIGxIKHRoaXMsIGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSBnID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBfLnkoaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBsID0gaC5uZXh0KCk7ICFsLmRvbmU7IGwgPSBoLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobCA9IGwudmFsdWUsIEFycmF5LmlzQXJyYXkobCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSBfLnkobCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBtLm5leHQoKS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbSA9IG0ubmV4dCgpLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISgnbnVtYmVyJyAhPT0gdHlwZW9mIGwgfHwgJ251bWJlcicgIT09IHR5cGVvZiBtIHx8IDEgPj0gbCB8fCAxID49IG0pICYmIChnID0gZyB8fCBsLCBrID0gTWF0aC5taW4oayB8fCBJbmZpbml0eSwgbSksIGwgPSBfLlRxKHRoaXMuVyksIGYgJiYgIWNqKHVnKGYsIGwpKSAmJiBmLnBhcmVudEVsZW1lbnQgJiYgIWNqKHVnKGYucGFyZW50RWxlbWVudCwgbCkpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGcgfHwgayA/IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0gOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIFBpKGMsIEFnKGIpLCBkZyhlLCBkKSwgZik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpcy5DLm5vdGlmeSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbEggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKE1hdGgucmFuZG9tKCkgPCBfLmJmWzIzXSkgewogICAgICAgICAgICAgICAgICAgIGIgPSBRayhiKTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGIuZGVwdGg7CiAgICAgICAgICAgICAgICAgICAgYiA9IGIucGUuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IChudWxsID09PSBiIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuaGVpZ2h0KSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IDAgPD0gYi50b3AgJiYgYi5ib3R0b20gPD0gKF8uci5pbm5lckhlaWdodCB8fCBhLlcuZG9jdW1lbnRFbGVtZW50LmNsaWVudEhlaWdodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIG9mKCdncHRfbm90X3Jlc2VydmVkJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRmKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgSShlLCAnaW5WaWV3cG9ydCcsIGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgSShlLCAnZGVwdGgnLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgeyBwYTogMSB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBtSCA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODg1KTsKICAgICAgICAgICAgICAgIHRoaXMuTCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkkgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5vID0gYzsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IGQ7CiAgICAgICAgICAgICAgICB0aGlzLlcgPSBlOwogICAgICAgICAgICAgICAgdGhpcy5LID0gZjsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFUodGhpcyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhtSCwgWSk7CiAgICAgICAgICAgIG1ILnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiLCBjLCBkLCBlOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gZi5qKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYS5vKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGp2KGEubCksIGYucmV0dXJuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBhLm87CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBiLkFhOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gYi5jYTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGYsIG5IKGEsIGMsIGQsIGEuTCwgYS5XLCBhLkspLCAyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZSA9IGYubTsKICAgICAgICAgICAgICAgICAgICBhLmwuaihlKTsKICAgICAgICAgICAgICAgICAgICBMbShmKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbkggPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZikgewogICAgICAgICAgICAgICAgdmFyIGcsIGgsIGssIGwsIG0sIG4sIHEsIHUsIEIsIHgsIHosIEMsIEQsIEosIFQsIGFhLCBYLCBTOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChjYSkgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoY2EuaikgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgayA9IG5ldyBRYygpOwogICAgICAgICAgICAgICAgICAgICAgICBfLmh1KGEsIGspOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIga2EgPSBhLkwsIGVhID0gYS5JLCB4YSA9IG5ldyBRYygpLCBoYiA9IG5ldyBpbShlYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uaHUoeGEsIGhiKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFBhID0gbmV3IGNIKGhiKTsKICAgICAgICAgICAgICAgICAgICAgICAgTih4YSwgUGEpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgRGIgPSBuZXcgWkcoYiwgaGIsIFBhLmwsIGVhLCBlYS50b3ApOwogICAgICAgICAgICAgICAgICAgICAgICBOKHhhLCBEYik7CiAgICAgICAgICAgICAgICAgICAgICAgIFBhID0gbmV3IGJIKExoKCksIGVhLCBEYi5sKTsKICAgICAgICAgICAgICAgICAgICAgICAgTih4YSwgUGEpOwogICAgICAgICAgICAgICAgICAgICAgICBoYiA9IG5ldyAkRyhiLCBoYiwgXy5iZlsyMjFdLCBEYi5sKTsKICAgICAgICAgICAgICAgICAgICAgICAgTih4YSwgaGIpOwogICAgICAgICAgICAgICAgICAgICAgICBlYSA9IG5ldyBhSChlYSwgRGIubCk7CiAgICAgICAgICAgICAgICAgICAgICAgIE4oeGEsIGVhKTsKICAgICAgICAgICAgICAgICAgICAgICAga2EgPSBuZXcgWUcoaWwoa2EuVSksIExoKCksIGhiLmwsIFBhLmwsIGVhLmwpOwogICAgICAgICAgICAgICAgICAgICAgICBOKHhhLCBrYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIFNjKHhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGthLm87CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSB4YTsKICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGc7CiAgICAgICAgICAgICAgICAgICAgICAgIG0gPSBoOwogICAgICAgICAgICAgICAgICAgICAgICBfLmh1KGEsIG0pOwogICAgICAgICAgICAgICAgICAgICAgICBuID0gbmV3IGpIKGEuSSwgbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIE4oaywgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uSChXcykgJiYgKHEgPSBuZXcgZkgoYS5JLCBsKSwgTihrLCBxKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBuZXcgZ0goXy5iZlsxNTBdLCBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgTihrLCB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgQiA9IG5ldyB4aihhLkksIGwsIHUubCk7CiAgICAgICAgICAgICAgICAgICAgICAgIE4oaywgQik7CiAgICAgICAgICAgICAgICAgICAgICAgIHggPSBuZXcgaEgoYS5CLCBCLkMsIGwpOwogICAgICAgICAgICAgICAgICAgICAgICBOKGssIHgpOwogICAgICAgICAgICAgICAgICAgICAgICBfLkgoSnQpIHx8ICh6ID0gbmV3IGlIKG5lKCksIGEuSS5jb25zb2xlLCBCLkMpLCBOKGssIHopKTsKICAgICAgICAgICAgICAgICAgICAgICAgQyA9IG5ldyBrSChjLCBlLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgTihrLCBDKTsKICAgICAgICAgICAgICAgICAgICAgICAgRCA9IG5ldyBkSChjLCBmLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgTihrLCBEKTsKICAgICAgICAgICAgICAgICAgICAgICAgU2Moayk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqYihjYSwgdi5Qcm9taXNlLmFsbChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4LmwucHJvbWlzZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMuQy5wcm9taXNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgRC5DLnByb21pc2UKICAgICAgICAgICAgICAgICAgICAgICAgXSksIDIpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEogPSBjLCBUID0gRiwgYWEgPSBULkgsIFggPSBULCBqYihjYSwgbC5wcm9taXNlLCAzKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTID0gYWEuY2FsbChYLCBjYS5tKSwgamIoY2EsIEIuQy5wcm9taXNlLCA0KTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjYS5yZXR1cm4oewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2E6IEosCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYTogUywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2U6IGNhLm0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBSayA9IDA7CiAgICAgICAgICAgIHZhciBvSCA9IG5ldyB2LldlYWtNYXAoKSwgcEggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSBbYV07CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IGIubGVuZ3RoIC0gMTsgMCA8PSBjOyAtLWMpCiAgICAgICAgICAgICAgICAgICAgICAgIGEucHVzaCh0eXBlb2YgYltjXSwgYltjXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuam9pbignXHgwQicpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHFIID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBwSCA6IGI7CiAgICAgICAgICAgICAgICB2YXIgYyA9IGxhKGEpLCBkID0gZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IF8ueShmKTsKICAgICAgICAgICAgICAgICAgICAgICAgZi5uZXh0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBBbShmKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIoYywgZik7CiAgICAgICAgICAgICAgICAgICAgfSwgZSA9IGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gXy55KGYpOwogICAgICAgICAgICAgICAgICAgICAgICBmID0gZy5uZXh0KCkudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBBbShnKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYXBwbHkoZiwgZyk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBnYy5hcHBseSgwLCBhcmd1bWVudHMpLCBnID0gdGhpcyB8fCBfLnIsIGggPSBvSC5nZXQoZyk7CiAgICAgICAgICAgICAgICAgICAgaCB8fCAoaCA9IHt9LCBvSC5zZXQoZywgaCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBabihoLCBbdGhpc10uY29uY2F0KF8ubGMoZikpLCBlLCBkKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0oZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAobnVsbCA9PT0gYSB8fCB2b2lkIDAgPT09IGEgPyAwIDogYS5zcmMpID8gL14oPzpodHRwcz86KT9cL1wvKD86d3d3XC5nb29nbGV0YWdzZXJ2aWNlc1wuY29tfHNlY3VyZXB1YmFkc1wuZ1wuZG91YmxlY2xpY2tcLm5ldHxwYWdlYWQyXC5nb29nbGVzeW5kaWNhdGlvblwuY29tKVwvdGFnXC9qc1wvZ3B0KD86X1thLXpdKykqXC5qcy8udGVzdChhLnNyYykgPyAwIDogMSA6IDI7CiAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgIHJldHVybiBhICsgJ1x4MEInICsgKG51bGwgPT09IChjID0gYlswXSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5zcmMpOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIHJIID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYsIGcsIGgsIGssIGwsIG0sIG4sIHEsIHUsIEIsIHgsIHosIEMsIEQsIEopIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmNhID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSBiOwogICAgICAgICAgICAgICAgICAgIHRoaXMuSyA9IGM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pYSA9IGQ7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sYSA9IGU7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5MID0gZjsKICAgICAgICAgICAgICAgICAgICB0aGlzLkEgPSBnOwogICAgICAgICAgICAgICAgICAgIHRoaXMuQ2EgPSBoOwogICAgICAgICAgICAgICAgICAgIHRoaXMuUWEgPSBrOwogICAgICAgICAgICAgICAgICAgIHRoaXMuUGEgPSBsOwogICAgICAgICAgICAgICAgICAgIHRoaXMuVCA9IG07CiAgICAgICAgICAgICAgICAgICAgdGhpcy5XYiA9IG47CiAgICAgICAgICAgICAgICAgICAgdGhpcy5vYyA9IHE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy55YyA9IHU7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5HID0gQjsKICAgICAgICAgICAgICAgICAgICB0aGlzLmludGVyZXN0Q29ob3J0ID0geDsKICAgICAgICAgICAgICAgICAgICB0aGlzLlIgPSB6OwogICAgICAgICAgICAgICAgICAgIHRoaXMuTSA9IEM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gRDsKICAgICAgICAgICAgICAgICAgICB0aGlzLm8gPSB2b2lkIDAgPT09IEogPyAhMSA6IEo7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5EID0gW107CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gJyc7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5GID0gW107CiAgICAgICAgICAgICAgICAgICAgdGhpcy5CID0gW107CiAgICAgICAgICAgICAgICAgICAgdGhpcy5KID0gbmV3IHYuU2V0KFlpKHh0KSk7CiAgICAgICAgICAgICAgICB9LCB1SCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSB2b2lkIDAgPT09IGIgPyB3aW5kb3cgOiBiOwogICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBhLmNhLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgIHNIKGEsIGEuY2EsIGIpOwogICAgICAgICAgICAgICAgICAgIHZhciBjLCBkOwogICAgICAgICAgICAgICAgICAgIGIgPSBudWxsICE9PSAoZCA9IG51bGwgPT09IChjID0gaWwoYS5MLlUpKSB8fCB2b2lkIDAgPT09IGMgPyB2b2lkIDAgOiBFKGMsIDkpKSAmJiB2b2lkIDAgIT09IGQgJiYgZCB8fCAhRShhLmxhLCA1KSA/ICdodHRwczovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL2dhbXBhZC9hZHM/JyA6ICdodHRwczovL3NlY3VyZXB1YmFkcy5nLmRvdWJsZWNsaWNrLm5ldC9nYW1wYWQvYWRzPyc7CiAgICAgICAgICAgICAgICAgICAgYS5qID0gYjsKICAgICAgICAgICAgICAgICAgICBjID0gYS5EOwogICAgICAgICAgICAgICAgICAgIGlmIChfLkgoWnMpKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGQgPSBNYXRoLnJhbmRvbSwgYiA9IGMubGVuZ3RoIC0gMTsgMCA8IGI7IGItLSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBNYXRoLmZsb29yKGQoKSAqIChiICsgMSkpLCBmID0gY1tiXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNbYl0gPSBjW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY1tlXSA9IGY7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBjID0gXy55KGMpOwogICAgICAgICAgICAgICAgICAgIGZvciAoYiA9IGMubmV4dCgpOyAhYi5kb25lOyBiID0gYy5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkID0gYSwgYiA9IGIudmFsdWUsIGUgPSB0SChiKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICc/JyAhPT0gZC5qW2Quai5sZW5ndGggLSAxXSAmJiAoZC5qICs9ICcmJyksIGQuaiArPSBiLiRkICsgJz0nICsgZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5qOwogICAgICAgICAgICAgICAgfSwgdkggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gKDAsIEYuSCkoYi50b3ApOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGF3KGMuZG9jdW1lbnQsIGMpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IG5ldyBfLmlnKC0xMjI0NTkzMywgLTEyMjQ1OTMzKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgWihhLCAnc2NyX3gnLCBNYXRoLnJvdW5kKGQueCksIHsgcWE6ICEwIH0pOwogICAgICAgICAgICAgICAgICAgIFooYSwgJ3Njcl95JywgTWF0aC5yb3VuZChkLnkpLCB7IHFhOiAhMCB9KTsKICAgICAgICAgICAgICAgIH0sIHdIID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYywgZDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG51bGwgPT09IChkID0gbnVsbCA9PT0gKGMgPSBiLmV4dGVybmFsKSB8fCB2b2lkIDAgPT09IGMgPyB2b2lkIDAgOiBjLmdldEhvc3RFbnZpcm9ubWVudFZhbHVlKSB8fCB2b2lkIDAgPT09IGQgPyB2b2lkIDAgOiBkLmJpbmQoYi5leHRlcm5hbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHBhcnNlSW50KEpTT04ucGFyc2UoZSgnb3MtbW9kZScpKVsnb3MtbW9kZSddLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwIDw9IGYgJiYgWihhLCAnd3NtJywgZiArIDEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZykgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHhIID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoXy5IKER0KSkgewogICAgICAgICAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYywgZCwgZSwgZiwgZywgaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSBudWxsID09PSAoZCA9IG51bGwgPT09IChjID0gYi5wZXJmb3JtYW5jZSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5nZXRFbnRyaWVzQnlUeXBlKCduYXZpZ2F0aW9uJykpIHx8IHZvaWQgMCA9PT0gZCA/IHZvaWQgMCA6IGRbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGsgfHwgdm9pZCAwID09PSBrID8gMCA6IGsudHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IG51bGwgIT09IChlID0gWHouZ2V0KGsudHlwZSkpICYmIHZvaWQgMCAhPT0gZSA/IGUgOiAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBudWxsICE9PSAoaCA9IFl6LmdldChudWxsID09PSAoZyA9IG51bGwgPT09IChmID0gYi5wZXJmb3JtYW5jZSkgfHwgdm9pZCAwID09PSBmID8gdm9pZCAwIDogZi5uYXZpZ2F0aW9uKSB8fCB2b2lkIDAgPT09IGcgPyB2b2lkIDAgOiBnLnR5cGUpKSAmJiB2b2lkIDAgIT09IGggPyBoIDogMDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBiID0gbDsKICAgICAgICAgICAgICAgICAgICAgICAgMCAhPT0gYiAmJiBaKGEsICdudnQnLCBiKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBzSCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/IHdpbmRvdyA6IGM7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQsIGUsIGYgPSBjLmRvY3VtZW50LCBnID0gYS5MLCBoID0gZy5VLCBrID0gZy5QLCBsID0gZy5SYjsKICAgICAgICAgICAgICAgICAgICBnID0gYS5LLkI7CiAgICAgICAgICAgICAgICAgICAgWihhLCAnZ2RmcF9yZXEnLCAxLCB7IGJhOiAhMSB9KTsKICAgICAgICAgICAgICAgICAgICBaKGEsICdwdnNpZCcsIGcpOwogICAgICAgICAgICAgICAgICAgIFooYSwgJ2NvcnJlbGF0b3InLCBoLmdldENvcnJlbGF0b3IoKSk7CiAgICAgICAgICAgICAgICAgICAgWihhLCAnb3V0cHV0JywgYS5BLCB7IGJhOiAhMSB9KTsKICAgICAgICAgICAgICAgICAgICB5SChhLCBxbChhLkEsIGEuUiwgYS5NKSk7CiAgICAgICAgICAgICAgICAgICAgWihhLCAnaW1wbCcsIEUoaCwgNikgPyAnZmlmcycgOiAnZmlmJywgeyBiYTogITEgfSk7CiAgICAgICAgICAgICAgICAgICAgeUgoYSwgaGwoewogICAgICAgICAgICAgICAgICAgICAgICBzZDogdGsoaCwgMjQsIDApLAogICAgICAgICAgICAgICAgICAgICAgICBXYjogYS5XYiwKICAgICAgICAgICAgICAgICAgICAgICAgeWM6IGEueWMsCiAgICAgICAgICAgICAgICAgICAgICAgIG9jOiBhLm9jCiAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgIHlIKGEsIHBsKGgsIGEuUWEsIGEuUGEpKTsKICAgICAgICAgICAgICAgICAgICB5SChhLCBuZXcgdi5NYXAoWwogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZWlkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6IGEuVCB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdkZWJ1Z19leHBlcmltZW50X2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6IFl1KCkuc3BsaXQoJywnKSB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICBdKSk7CiAgICAgICAgICAgICAgICAgICAgWihhLCAndnJnJywgV2UoKSk7CiAgICAgICAgICAgICAgICAgICAgWihhLCAncHR0JywgMTcpOwogICAgICAgICAgICAgICAgICAgIHlIKGEsIG5ldyB2Lk1hcChbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogMCAhPT0gdGsoaCwgMjQsIDApID8gdGsoaCwgMjQsIDApIDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7IHFhOiAhMCB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF1dKSk7CiAgICAgICAgICAgICAgICAgICAgeUgoYSwga2woaCwgYS5sYSkpOwogICAgICAgICAgICAgICAgICAgIFooYSwgJ3NjJywgXy5iZls2XSA/IDEgOiAwLCB7IHFhOiAhMCB9KTsKICAgICAgICAgICAgICAgICAgICB3aW5kb3cucG9zdE1lc3NhZ2UgJiYgWihhLCAnc2Z2JywgV2koKSk7CiAgICAgICAgICAgICAgICAgICAgWihhLCAnZWNzJywgbCk7CiAgICAgICAgICAgICAgICAgICAgekgoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgQUgoYSk7CiAgICAgICAgICAgICAgICAgICAgQkgoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgQ0goYSwgYik7CiAgICAgICAgICAgICAgICAgICAgREgoYSwgYyk7CiAgICAgICAgICAgICAgICAgICAgVmUoJ2dvb2dsZV9wcmV2aWV3JykgJiYgWihhLCAnZ2N0JywgVWUoJ2dvb2dsZV9wcmV2aWV3JykpOwogICAgICAgICAgICAgICAgICAgIHlIKGEsIFBnKGMpKTsKICAgICAgICAgICAgICAgICAgICB5SChhLCBuZXcgdi5NYXAoW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdleHBmbGFncycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBfLmJmWzI1M10gPyB6dShRcykgfHwgbnVsbCA6IG51bGwgfQogICAgICAgICAgICAgICAgICAgICAgICBdXSkpOwogICAgICAgICAgICAgICAgICAgIEVIKGEsIGIsIGMpOwogICAgICAgICAgICAgICAgICAgIHlIKGEsIGRsKGMpKTsKICAgICAgICAgICAgICAgICAgICBfLkgoYmwpIHx8IFooYSwgJ2ZsYXNoJywgY2woKSwgewogICAgICAgICAgICAgICAgICAgICAgICBiYTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgIHFhOiAhMAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIEZIKGEsIGIsIGMpOwogICAgICAgICAgICAgICAgICAgIChfLkgoVXQpIHx8IFJlLk8oKS5qKSAmJiBaKGEsICdydW1jJywgZywgeyBiYTogITEgfSk7CiAgICAgICAgICAgICAgICAgICAgXy5IKGh0KSAmJiBaKGEsICdydW1lJywgMSwgeyBiYTogITEgfSk7CiAgICAgICAgICAgICAgICAgICAgWihhLCAndmlzJywgYkEoZiksIHsgYmE6ICExIH0pOwogICAgICAgICAgICAgICAgICAgIDAgPT09IHFIKF8uYmZbMTcyXSkgfHwgWihhLCAnc3RzcycsIHFIKF8uYmZbMTcyXSkpOwogICAgICAgICAgICAgICAgICAgICFfLkgoYmwpICYmIChudWxsID09PSAoZCA9IF8uci5uYXZpZ2F0b3IpIHx8IHZvaWQgMCA9PT0gZCA/IDAgOiBkLmRldmljZU1lbW9yeSkgJiYgWihhLCAnZG1jJywgXy5yLm5hdmlnYXRvci5kZXZpY2VNZW1vcnkpOwogICAgICAgICAgICAgICAgICAgIHZIKGEsIGMpOwogICAgICAgICAgICAgICAgICAgIHlIKGEsIFlrKGIsIGMpKTsKICAgICAgICAgICAgICAgICAgICB5SChhLCBzaihiLCBrLCBjKSk7CiAgICAgICAgICAgICAgICAgICAgeUgoYSwgbmV3IHYuTWFwKFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHN0cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBERChhLkssIGIpIH0KICAgICAgICAgICAgICAgICAgICAgICAgXV0pKTsKICAgICAgICAgICAgICAgICAgICBmID0gSXUoYy5kb2N1bWVudC5kb21haW4sIG51bGwgIT09IChlID0gRShhLmxhLCA1KSAmJiB1YyhjKSA/IGMuZG9jdW1lbnQuY29va2llIDogbnVsbCkgJiYgdm9pZCAwICE9PSBlID8gZSA6ICcnLCBjLmhpc3RvcnkubGVuZ3RoLCBjLnNjcmVlbiwgYy5kb2N1bWVudC5yZWZlcnJlciwgYyk7CiAgICAgICAgICAgICAgICAgICAgeUgoYSwgZi5mcm9tX2Nvb2tpZSAmJiAhRShhLmxhLCA1KSA/IG5ldyB2Lk1hcCgpIDogbmV3IHYuTWFwKFsKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dhX3ZpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGYudmlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgYmE6ICExIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dhX3NpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGYuc2lkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgYmE6ICExIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dhX2hpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGYuaGlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgYmE6ICExIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dhX2ZjJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZi5mcm9tX2Nvb2tpZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7IGJhOiAhMSB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnYV9jaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmLmNpZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7IGJhOiAhMSB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnYV93cGlkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7IHZhbHVlOiBjLmdvb2dsZV9hbmFseXRpY3NfdWFjY3QgfQogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgXSkpOwogICAgICAgICAgICAgICAgICAgIF8uYmZbMjIxXSB8fCBaKGEsICd1YXMnLCBjZShjKSk7CiAgICAgICAgICAgICAgICAgICAgXy5IKGFsKSB8fCB3SChhLCBjKTsKICAgICAgICAgICAgICAgICAgICBfLkgod3MpICYmIChaKGEsICdqcycsIEt1KGMpKSwgWihhLCAnbXMnLCBMdShnLnRvU3RyaW5nKCksIGMpKSk7CiAgICAgICAgICAgICAgICAgICAgR0goYSwgYywgYik7CiAgICAgICAgICAgICAgICAgICAgSEgoYSwgYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgeUgoYSwgZmwoYS5pbnRlcmVzdENvaG9ydCkpOwogICAgICAgICAgICAgICAgICAgICdydW5BZEF1Y3Rpb24nIGluIG5hdmlnYXRvciAmJiAnam9pbkFkSW50ZXJlc3RHcm91cCcgaW4gbmF2aWdhdG9yICYmIFooYSwgJ3RkJywgMSk7CiAgICAgICAgICAgICAgICAgICAgSUgoYSk7CiAgICAgICAgICAgICAgICAgICAgSkgoYSk7CiAgICAgICAgICAgICAgICAgICAgS0goYSk7CiAgICAgICAgICAgICAgICAgICAgYS5sICYmIFooYSwgJ2NiaWRzcCcsIGEubC5tYXAoZnVuY3Rpb24gKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBuZXcgQ28oKTsKICAgICAgICAgICAgICAgICAgICAgICAgcHAobSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFYihHbyhuKSwgMyk7CiAgICAgICAgICAgICAgICAgICAgfSkuam9pbignficpKTsKICAgICAgICAgICAgICAgICAgICB4SChhLCBjKTsKICAgICAgICAgICAgICAgIH0sIElIID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IF8uYmZbMjUxXTsKICAgICAgICAgICAgICAgICAgICBiICYmIFooYSwgJ3VhY2gnLCB3byhiLCAzKSk7CiAgICAgICAgICAgICAgICB9LCBKSCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBKQigpOwogICAgICAgICAgICAgICAgICAgIG51bGwgIT09IGIgJiYgdm9pZCAwICE9PSBiICYmIGIubGVuZ3RoICYmIFooYSwgJ3R0X3N0YXRlJywgd28oSlNPTi5zdHJpbmdpZnkoYiksIDMpKTsKICAgICAgICAgICAgICAgIH0sIEdIID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IDAgIT09IENoKCksIGUgPSBXZighMCwgYiwgZCkud2lkdGgsIGYgPSBbXSwgZyA9IFtdLCBoID0gW107CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGIgJiYgYiAhPSBiLnRvcCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IFdmKCExLCBiKS53aWR0aDsKICAgICAgICAgICAgICAgICAgICAgICAgKC0xMjI0NTkzMyA9PT0gZSB8fCAtMTIyNDU5MzMgPT09IGsgfHwgayA8IGUpICYmIGgucHVzaCg4KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgLTEyMjQ1OTMzICE9PSBlICYmICgxLjUgKiBlIDwgYi5kb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuc2Nyb2xsV2lkdGggPyBoLnB1c2goMTApIDogZCAmJiAxLjUgKiBiLm91dGVyV2lkdGggPCBlICYmIGgucHVzaCgxMCkpOwogICAgICAgICAgICAgICAgICAgIGMgPSBfLnkoYyk7CiAgICAgICAgICAgICAgICAgICAgZm9yIChrID0gYy5uZXh0KCk7ICFrLmRvbmU7IGsgPSBjLm5leHQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICBkID0gbmV3IENnKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gcmcoay52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGsgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9ICExLCBuID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBxID0gMCwgdSA9IGw7IHUgJiYgMTAwID4gcTsgcSsrLCB1ID0gdS5wYXJlbnRFbGVtZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEIgPSB1Zyh1LCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgeCA9IEIsIHogPSB4LmRpc3BsYXksIEMgPSB4Lm92ZXJmbG93WDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd2aXNpYmxlJyAhPT0geC5vdmVyZmxvd1kgJiYgKGQuc2V0KDIpLCAoeCA9IGxnKHUpKSAmJiAoayA9IGsgPyBNYXRoLm1pbihrLCB4LndpZHRoKSA6IHgud2lkdGgpLCBkLmdldCg5KSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2ooQikgJiYgZC5zZXQoOSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdub25lJyA9PT0geiAmJiBkLnNldCg3KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0lGUkFNRScgPT09IHUubm9kZU5hbWUgJiYgKEIgPSBwYXJzZUludChCLndpZHRoLCAxMCksIEIgPCBlICYmIChkLnNldCg4KSwgayA9IGsgPyBNYXRoLm1pbihCLCBrKSA6IEIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiB8fCAobiA9ICdzY3JvbGwnID09PSBDIHx8ICdhdXRvJyA9PT0gQyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gfHwgKG0gPSAnZmxleCcgPT09IHopOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnNldCgzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgbSAmJiAobCA9IGwuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCkubGVmdCwgKGwgPiBlIHx8IDAgPiBsKSAmJiBkLnNldCgxMSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQuc2V0KDEpOwogICAgICAgICAgICAgICAgICAgICAgICBsID0gXy55KGgpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG0gPSBsLm5leHQoKTsgIW0uZG9uZTsgbSA9IGwubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5zZXQobS52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGYucHVzaChEZyhkKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGcucHVzaChrKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgWihhLCAnZndzJywgZik7CiAgICAgICAgICAgICAgICAgICAgWihhLCAnb2h3JywgZyk7CiAgICAgICAgICAgICAgICB9LCBISCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSAoMCwgRi5IKShjLnRvcCksIGUgPSBhdyhkLmRvY3VtZW50LCBkKS55OwogICAgICAgICAgICAgICAgICAgICAgICBaKGEsICdidHZpJywgYi5tYXAoZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnLCBoID0gYS5MLCBrID0gaC5VOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IGguUFtmLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IG51bGwgPT09IChnID0geWcoZiwgaCwgYy5kb2N1bWVudCwgZGcoaywgaCkpKSB8fCB2b2lkIDAgPT09IGcgPyB2b2lkIDAgOiBnLnk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrID0gV2YoITAsIGMpLmhlaWdodDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGYgfHwgLTEyMjQ1OTMzID09PSBmIHx8IC0xMjI0NTkzMyA9PT0gayA/IC0xIDogZiA8IGUgKyBrID8gMCA6ICsrTEg7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBxYTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5YTogJ3wnCiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGYpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBNSCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLkwuUDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5tID8gYi5tYXAoZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjW2QuZ2V0RG9tSWQoKV07CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBiZyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgPSBhLksuai5nZXQoZCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLllhID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSkuam9pbignLCcpIDogYi5tYXAoZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhLkwuUFtkLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgICAgICAgICBlID0gZWsoYS5LLCBkKSB8fCBiZyhlLCBFKGEuTC5VLCA2KSB8fCBFKGUsIDE3KSA/IG51bGwgOiByZyhkKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkID0gYS5LLmouZ2V0KGQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5ZYSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJywnKTsKICAgICAgICAgICAgICAgIH0sIEZIID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gdm9pZCAwID09PSBjID8gd2luZG93IDogYzsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IFZlKCdnb29nbGVfcHJldmlldycpLCBlID0gYy5kb2N1bWVudCwgZiA9IGQgPyBUZShlLlVSTCkgOiBlLlVSTDsKICAgICAgICAgICAgICAgICAgICBlID0gZCA/IFRlKGUucmVmZXJyZXIpIDogZS5yZWZlcnJlcjsKICAgICAgICAgICAgICAgICAgICBkID0gITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGc7CiAgICAgICAgICAgICAgICAgICAgYiA9IGEubSA/IHZsKGEuTC5VKSA6IG51bGwgIT09IChnID0gd2woYS5MLlBbYlswXS5nZXREb21JZCgpXSkpICYmIHZvaWQgMCAhPT0gZyA/IGcgOiB2bChhLkwuVSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gYikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGY7CiAgICAgICAgICAgICAgICAgICAgICAgIGZnKGMpIHx8IChlID0gJycsIGQgPSAhXy5IKHl0KSB8fCAhYS5LLm5iKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGY7CiAgICAgICAgICAgICAgICAgICAgZiA9IHVsKGMpOwogICAgICAgICAgICAgICAgICAgIFooYSwgJ25oZCcsIGYgfHwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgWihhLCAndXJsJywgYik7CiAgICAgICAgICAgICAgICAgICAgZyA9IF8uYmZbMjUyXSB8fCB7fTsKICAgICAgICAgICAgICAgICAgICBnLnVybCA9IGI7CiAgICAgICAgICAgICAgICAgICAgXy5iZlsyNTJdID0gZzsKICAgICAgICAgICAgICAgICAgICBudWxsICE9IGggJiYgaCAhPT0gYiAmJiBaKGEsICdsb2MnLCBoKTsKICAgICAgICAgICAgICAgICAgICBaKGEsICdyZWYnLCBlKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaywgbCwgbTsKICAgICAgICAgICAgICAgICAgICAgICAgaCA9IGJjKGMudG9wKSAmJiAobnVsbCA9PT0gKG0gPSBudWxsID09PSAobCA9IGMudG9wKSB8fCB2b2lkIDAgPT09IGwgPyB2b2lkIDAgOiBsLmxvY2F0aW9uKSB8fCB2b2lkIDAgPT09IG0gPyB2b2lkIDAgOiBtLmhyZWYpOwogICAgICAgICAgICAgICAgICAgICAgICBsID0gbnVsbCA9PT0gKGsgPSBjLmxvY2F0aW9uKSB8fCB2b2lkIDAgPT09IGsgPyB2b2lkIDAgOiBrLmFuY2VzdG9yT3JpZ2luczsKICAgICAgICAgICAgICAgICAgICAgICAgKGsgPSBoIHx8IGJlKGMpIHx8IChudWxsID09PSBsIHx8IHZvaWQgMCA9PT0gbCA/IHZvaWQgMCA6IGxbbC5sZW5ndGggLSAxXSkgfHwgJycpICYmIFooYSwgJ3RvcCcsIGQgPyBacShrLm1hdGNoKF8uWXEpWzNdIHx8IG51bGwpIDogayk7CiAgICAgICAgICAgICAgICAgICAgICAgIFooYSwgJ2V0dScsIGEuSy5uYik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIFooYSwgJ3NjYXInLCBhLkcpOwogICAgICAgICAgICAgICAgfSwgQkggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYS5MLlAsIGQgPSBiID0gYi5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBjW2UuZ2V0RG9tSWQoKV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2woZSkuam9pbignJicpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBkLmpvaW4oJ3wnKS5sZW5ndGggPT09IGIubGVuZ3RoIC0gMSAmJiAoZCA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgIFooYSwgJ3ByZXZfc2NwJywgZCwgeyB5YTogJ3wnIH0pOwogICAgICAgICAgICAgICAgfSwgQUggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gYS5MLlU7CiAgICAgICAgICAgICAgICAgICAgMSAhPT0gdGsoYiwgMjQsIDApICYmIFlmKGIsIDE2KSAmJiBaKGEsICdwcGlkJywgRyhiLCAxNiksIHsgcWE6ICEwIH0pOwogICAgICAgICAgICAgICAgfSwgQ0ggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYS5MLCBkID0gYy5VLCBlID0gYy5QW2JbMF0uZ2V0RG9tSWQoKV07CiAgICAgICAgICAgICAgICAgICAgYyA9IDEgIT09IGEuQ2E7CiAgICAgICAgICAgICAgICAgICAgZSA9ICEhRShlLCAxNyk7CiAgICAgICAgICAgICAgICAgICAgYiA9IHhsKGIsIGEuTCk7CiAgICAgICAgICAgICAgICAgICAgZCA9IEUoZCwgMjcpIHx8ICExOwogICAgICAgICAgICAgICAgICAgIHZhciBmID0gMyA9PT0gYS5DYSwgZyA9IG5ldyBDZygpOwogICAgICAgICAgICAgICAgICAgIGcuc2V0KDAsIGMpOwogICAgICAgICAgICAgICAgICAgIGcuc2V0KDEsIGUpOwogICAgICAgICAgICAgICAgICAgIGcuc2V0KDIsIGIpOwogICAgICAgICAgICAgICAgICAgIGcuc2V0KDMsIGQpOwogICAgICAgICAgICAgICAgICAgIGcuc2V0KDQsIGYpOwogICAgICAgICAgICAgICAgICAgIGMgPSBEZyhnKTsKICAgICAgICAgICAgICAgICAgICAwIDwgYyAmJiBaKGEsICdlcmknLCBjKTsKICAgICAgICAgICAgICAgIH0sIERIID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEuTC5VLCBkID0gdGwoYyk7CiAgICAgICAgICAgICAgICAgICAgWihhLCAnY3VzdF9wYXJhbXMnLCBkLCB7IHlhOiAnJicgfSk7CiAgICAgICAgICAgICAgICAgICAgZCA9IGEuaWE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhLmxhLCBmID0gdmwoYyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IHRrKGMsIDI0LCAwKSAmJiBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gbnVsbCA9PT0gZCB8fCB2b2lkIDAgPT09IGQgPyB2b2lkIDAgOiBkdyhkLCAnX19nYWRzJywgZSksIGggPSB2Lk1hcCwgayA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY29va2llX2VuYWJsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICFnICYmIChudWxsID09PSBkIHx8IHZvaWQgMCA9PT0gZCA/IDAgOiBldyhkLCBlKSkgPyAnMScgOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7IHFhOiAhMCB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgbCA9IGIuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2RtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6IChmIHx8IGdnKGIpKSA9PT0gbC5VUkwgPyAnJyA6IGwuZG9tYWluIH0KICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IF8uSChXaikgJiYgXy5IKFdzKSA/IChmID0gZHcoZCwgJ19fZ3BpJywgZSkpICYmICFfLnQoZiwgJ2luY2x1ZGVzJykuY2FsbChmLCAnJicpID8gZiA6IG51bGwgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gbmV3IGgoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb29raWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgcWE6ICEwIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2dwaWMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6IGYgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ3BpY28nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsgdmFsdWU6IF8uSChXaikgJiYgJzEnID09PSBkdyhkLCAnX19ncGlfb3B0X291dCcsIGUpID8gJzEnIDogbnVsbCB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBkID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgICAgICAgICAgeUgoYSwgZCk7CiAgICAgICAgICAgICAgICAgICAgKGMgPSBHKGMsIDgpKSA/ICg1MCA8IGMubGVuZ3RoICYmIChjID0gYy5zdWJzdHJpbmcoMCwgNTApKSwgYyA9ICdhICcgKyB3bygncm9sZToxIHByb2R1Y2VyOjEyIGxvYzoiJyArIGMgKyAnIicpKSA6IGMgPSAnJzsKICAgICAgICAgICAgICAgICAgICBjICYmIFooYSwgJ3V1bGUnLCBjKTsKICAgICAgICAgICAgICAgICAgICBjID0gbmV3IENnKCk7CiAgICAgICAgICAgICAgICAgICAgXy5yLlNWR0VsZW1lbnQgJiYgXy5yLmRvY3VtZW50LmNyZWF0ZUVsZW1lbnROUyAmJiBjLnNldCgwKTsKICAgICAgICAgICAgICAgICAgICBkID0gb3IoKTsKICAgICAgICAgICAgICAgICAgICBkWydhbGxvdy10b3AtbmF2aWdhdGlvbi1ieS11c2VyLWFjdGl2YXRpb24nXSAmJiBjLnNldCgxKTsKICAgICAgICAgICAgICAgICAgICBkWydhbGxvdy1wb3B1cHMtdG8tZXNjYXBlLXNhbmRib3gnXSAmJiBjLnNldCgyKTsKICAgICAgICAgICAgICAgICAgICBfLnIuY3J5cHRvICYmIF8uci5jcnlwdG8uc3VidGxlICYmIGMuc2V0KDMpOwogICAgICAgICAgICAgICAgICAgIF8uci5UZXh0RGVjb2RlciAmJiBfLnIuVGV4dEVuY29kZXIgJiYgYy5zZXQoNCk7CiAgICAgICAgICAgICAgICAgICAgYyA9IERnKGMpOwogICAgICAgICAgICAgICAgICAgIFooYSwgJ2JjJywgYyk7CiAgICAgICAgICAgICAgICB9LCBOSCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLkwsIGQgPSBjLlAsIGUgPSBuZXcgdi5NYXAoKTsKICAgICAgICAgICAgICAgICAgICBjID0gXy55KFViKGMuVSwgZmgsIDE0KSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiA9IGMubmV4dCgpOyAhZi5kb25lOyBmID0gYy5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBmLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICBlLnNldCgoMCwgRi5IKShjaChnKSksIFtPaChnLCAyKVswXV0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSAwOyBjIDwgYi5sZW5ndGg7IGMrKykgewogICAgICAgICAgICAgICAgICAgICAgICBnID0gZFtiW2NdLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBfLnkoVWIoZywgZmgsIDMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChmID0gZy5uZXh0KCk7ICFmLmRvbmU7IGYgPSBnLm5leHQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBmLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9ICgwLCBGLkgpKGNoKGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBrID0gZS5nZXQoZikgfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gT2goaCwgMilbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxID09PSBiLmxlbmd0aCA/IGtbMF0gPSBoIDogaCAhPT0ga1swXSAmJiAoa1tjICsgMV0gPSBoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc2V0KGYsIGspOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGIgPSBbXTsKICAgICAgICAgICAgICAgICAgICBkID0gXy55KF8udChlLCAna2V5cycpLmNhbGwoZSkpOwogICAgICAgICAgICAgICAgICAgIGZvciAoYyA9IGQubmV4dCgpOyAhYy5kb25lOyBjID0gZC5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBjLnZhbHVlLCBjID0gSkQoKVtnXSwgZyA9IGUuZ2V0KGcpLCBjICYmIGcgJiYgKDEgPCBnLmxlbmd0aCA/IChnID0gZy5tYXAoZnVuY3Rpb24gKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQobCB8fCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oKSwgYi5wdXNoKGMgKyAnLCcgKyBnKSkgOiAxID09PSBnLmxlbmd0aCAmJiAndXJsJyAhPT0gYyAmJiBaKGEsIGMsIGdbMF0pKTsKICAgICAgICAgICAgICAgICAgICBiLmxlbmd0aCAmJiBaKGEsICdzcHMnLCBiLmpvaW4oJ3wnKSk7CiAgICAgICAgICAgICAgICB9LCBFSCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKF8uSChhdCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB2bChhLkwuVSksIGYgPSBuZXcgdi5NYXAoW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2R0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG5ldyBEYXRlKCkuZ2V0VGltZSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogeyBiYTogITEgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0pOwogICAgICAgICAgICAgICAgICAgICAgICBlIHx8IGYuc2V0KCdsbXQnLCB7IHZhbHVlOiBCcihjLmRvY3VtZW50KSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IFJrOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IEhrKGMpOwogICAgICAgICAgICAgICAgICAgICAgICAwIDwgZyAmJiBlID49IGcgJiYgKGYuc2V0KCdkbHQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHsgYmE6ICExIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIGYuc2V0KCdpZHQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZSAtIGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7IGJhOiAhMSB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgeUgoYSwgZik7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmwoYS5MLlUpIHx8IChlID0gQnIoYy5kb2N1bWVudCksIFooYSwgJ2xtdCcsIGUgPyBlLnRvU3RyaW5nKCkgOiBudWxsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIFooYSwgJ2R0JywgbmV3IERhdGUoKS5nZXRUaW1lKCksIHsgYmE6ICExIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IFJrLCBmID0gSGsoKSwgMCA8IGYgJiYgZSA+PSBmICYmIChaKGEsICdkbHQnLCBmLCB7IGJhOiAhMSB9KSwgWihhLCAnaWR0JywgZSAtIGYsIHsgYmE6ICExIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAocSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgWihhLCAnaWR0JywgLTksIHsgYmE6ICExIH0pLCBxIGluc3RhbmNlb2YgRXJyb3IgJiYgcmYoNDc5LCBxKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gKGQgPSBPSCkgJiYgdm9pZCAwICE9PSBkKQogICAgICAgICAgICAgICAgICAgICAgICBkOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gYy5uYXZpZ2F0b3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gYy5kb2N1bWVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBmLnVzZXJBZ2VudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZi5wbGF0Zm9ybSwgayA9IC9XZWJLaXRcLyhcZCspLywgbCA9IC9ydjooXGQrXC5cZCspLywgbSA9IC9ydjoxXC44KFteLl18XC4wKS87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoL1dpbnxNYWN8TGludXh8aVBhZHxpUG9kfGlQaG9uZS8udGVzdChoKSAmJiAhL15PcGVyYS8udGVzdChnKSAmJiAoayA9IChrLmV4ZWMoZykgfHwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSlbMV0sIGwgPSAobC5leGVjKGcpIHx8IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pWzFdLCAvV2luLy50ZXN0KGgpICYmIC9UcmlkZW50Ly50ZXN0KGcpICYmIDExIDw9IGUuZG9jdW1lbnRNb2RlIHx8ICFrICYmICdHZWNrbycgPT09IGYucHJvZHVjdCAmJiAyNyA8PSBsICYmICFtLnRlc3QoZykgfHwgNTM2IDw9IGspKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSA9IEp1KGMsIGMuZG9jdW1lbnQsIDUwMCwgMzAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgT0ggPSBmICYmICFlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBPSCB8fCBaKGEsICdlYScsICcwJywgeyBxYTogITAgfSk7CiAgICAgICAgICAgICAgICAgICAgZiA9IGMuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgaCA9IEZyKGNzKCkpOwogICAgICAgICAgICAgICAgICAgIGUgPSBoLmxvY2F0aW9uLmhyZWY7CiAgICAgICAgICAgICAgICAgICAgaCA9PSBoLnRvcCA/IGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgT2M6ICEwCiAgICAgICAgICAgICAgICAgICAgfSA6IChnID0gITEsIChtID0gaC5kb2N1bWVudCkgJiYgbS5yZWZlcnJlciAmJiAoZSA9IG0ucmVmZXJyZXIsIGgucGFyZW50ID09IGgudG9wICYmIChnID0gITApKSwgKGggPSBoLmxvY2F0aW9uLmFuY2VzdG9yT3JpZ2lucykgJiYgKGggPSBoW2gubGVuZ3RoIC0gMV0pICYmIC0xID09IGUuaW5kZXhPZihoKSAmJiAoZyA9ICExLCBlID0gaCksIGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgT2M6IGcKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBmID0gSnUoY3MoKSwgZiwgYy5nb29nbGVfYWRfd2lkdGgsIGMuZ29vZ2xlX2FkX2hlaWdodCk7CiAgICAgICAgICAgICAgICAgICAgZSA9IGUuT2M7CiAgICAgICAgICAgICAgICAgICAgZyA9IGNzKCk7CiAgICAgICAgICAgICAgICAgICAgZyA9IGcudG9wID09IGcgPyAwIDogYmMoZy50b3ApID8gMSA6IDI7CiAgICAgICAgICAgICAgICAgICAgaCA9IDQ7CiAgICAgICAgICAgICAgICAgICAgZiB8fCAxICE9IGcgPyBmIHx8IDIgIT0gZyA/IGYgJiYgMSA9PSBnID8gaCA9IDcgOiBmICYmIDIgPT0gZyAmJiAoaCA9IDgpIDogaCA9IDYgOiBoID0gNTsKICAgICAgICAgICAgICAgICAgICBlICYmIChoIHw9IDE2KTsKICAgICAgICAgICAgICAgICAgICBmID0gJycgKyBoOwogICAgICAgICAgICAgICAgICAgIGUgPSBjcygpOwogICAgICAgICAgICAgICAgICAgIGlmIChlICE9IGUudG9wKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZSAmJiBlICE9IGUudG9wICYmIGJjKGUpICYmICFlLnNmXyAmJiAhZS4kc2YgJiYgIWUuaW5HcHRJRiAmJiAhZS5pbkRhcElGOyBlID0gZS5wYXJlbnQpOwogICAgICAgICAgICAgICAgICAgIFooYSwgJ2ZybScsIGYgfHwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGYgPSBXZighMCwgYykpCiAgICAgICAgICAgICAgICAgICAgICAgIGEuTC5lYiA9IGYsIFooYSwgJ2JpdycsIGYud2lkdGgpLCBaKGEsICdiaWgnLCBmLmhlaWdodCk7CiAgICAgICAgICAgICAgICAgICAgIWZnKGMpICYmIChmID0gV2YoITEsIGMpKSAmJiAoWihhLCAnaXN3JywgZi53aWR0aCksIFooYSwgJ2lzaCcsIGYuaGVpZ2h0KSk7CiAgICAgICAgICAgICAgICAgICAgWihhLCAnb2lkJywgMik7CiAgICAgICAgICAgICAgICAgICAgZiA9IGMuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgZSA9IFtdOwogICAgICAgICAgICAgICAgICAgIGcgPSBbXTsKICAgICAgICAgICAgICAgICAgICBtID0gYS5MOwogICAgICAgICAgICAgICAgICAgIGggPSBtLlU7CiAgICAgICAgICAgICAgICAgICAgbSA9IG0uUDsKICAgICAgICAgICAgICAgICAgICBsID0gXy55KGIpOwogICAgICAgICAgICAgICAgICAgIGZvciAoayA9IGwubmV4dCgpOyAhay5kb25lOyBrID0gbC5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgayA9IGsudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbVtrLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgICAgICAgICBrID0geWcoaywgbiwgZiwgZGcoaCwgbikpOwogICAgICAgICAgICAgICAgICAgICAgICBhLm0gJiYgKGsgPSBrIHx8IG5ldyBfLmlnKC05LCAtOSkpOwogICAgICAgICAgICAgICAgICAgICAgICBrICYmIChlLnB1c2goTWF0aC5yb3VuZChrLngpKSwgZy5wdXNoKE1hdGgucm91bmQoay55KSkpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWEubSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBaKGEsICdhZHhzJywgZSk7CiAgICAgICAgICAgICAgICAgICAgWihhLCAnYWR5cycsIGcpOwogICAgICAgICAgICAgICAgICAgIFooYSwgJ2Fka3MnLCBNSChhLCBiKSk7CiAgICAgICAgICAgICAgICAgICAgUEgoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgTkgoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgZiA9IEVpKGMpOwogICAgICAgICAgICAgICAgICAgIGEubyA/IFooYSwgJ2lmaScsIGYpIDogKFooYSwgJ2lmaScsIGYgKyAxKSwgYSA9IGMsIGIgPSBiLmxlbmd0aCwgYiA9IHZvaWQgMCA9PT0gYiA/IDEgOiBiLCBhID0gTXIoTHIoYSkpIHx8IGEsIGEuZ29vZ2xlX3VuaXF1ZV9pZCA9IChhLmdvb2dsZV91bmlxdWVfaWQgfHwgMCkgKyBiKTsKICAgICAgICAgICAgICAgIH0sIHpIID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEuTCwgZCA9IGMuVSwgZSA9IGMuUCwgZiA9IGIubWFwKGZ1bmN0aW9uIChrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtrLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBpZiAoXy5IKCRzKSkKICAgICAgICAgICAgICAgICAgICAgICAgeUgoYSwgb2woYiwgZikpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBjID0gXy55KGIpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBnID0gYy5uZXh0KCk7ICFnLmRvbmU7IGcgPSBjLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFFIKGEsIGcudmFsdWUuZ2V0QWRVbml0UGF0aCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgWihhLCAnaXVfcGFydHMnLCBhLkYpOwogICAgICAgICAgICAgICAgICAgICAgICBaKGEsICdlbmNfcHJldl9pdXMnLCBhLkIpOwogICAgICAgICAgICAgICAgICAgICAgICBaKGEsICdwcmV2X2l1X3N6cycsIGYubWFwKGZ1bmN0aW9uIChrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWmYoayk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGYuc29tZShmdW5jdGlvbiAoaykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRmKGspOwogICAgICAgICAgICAgICAgICAgICAgICB9KSAmJiAoYyA9IGYubWFwKGZ1bmN0aW9uIChrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGYoaykgPyAnaGVpZ2h0JyA6ICcwJzsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIFooYSwgJ2ZsdWlkJywgYykpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBaKGEsICdmc2ZzJywgRmcoYiwgZnVuY3Rpb24gKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGsgPSBlW2suZ2V0RG9tSWQoKV07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIobnVsbCAhPT0gKGwgPSBudWxsID09PSBrIHx8IHZvaWQgMCA9PT0gayA/IHZvaWQgMCA6IEUoaywgMTIpKSAmJiB2b2lkIDAgIT09IGwgPyBsIDogRShkLCAxMykpOwogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICBaKGEsICdmc2JzJywgRmcoYiwgZnVuY3Rpb24gKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBhLkwuUFtrLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgICAgICAgICBrID0gYS5MLlUuQmEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgbCA9IG51bGwgPT09IGwgfHwgdm9pZCAwID09PSBsID8gdm9pZCAwIDogbC5CYSgpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG51bGwgPT09IGwgfHwgdm9pZCAwID09PSBsID8gMCA6IEUobCwgMykpIHx8IChudWxsID09PSBrIHx8IHZvaWQgMCA9PT0gayA/IDAgOiBFKGssIDMpKSA/IDEgOiAwOwogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICB5SChhLCBubChhLkssIGIsIGEubykpOwogICAgICAgICAgICAgICAgICAgIHlIKGEsIGVsKGVbYlswXS5nZXREb21JZCgpXSwgYS5tKSk7CiAgICAgICAgICAgICAgICAgICAgeUgoYSwgVWsoYiwgZSkpOwogICAgICAgICAgICAgICAgICAgIHlIKGEsIFZrKGYpKTsKICAgICAgICAgICAgICAgICAgICBjID0ge307CiAgICAgICAgICAgICAgICAgICAgZiA9IF8ueShmKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGcgPSBmLm5leHQoKTsgIWcuZG9uZTsgZyA9IGYubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAoZyA9IGcudmFsdWUuZ2V0Q2xpY2tVcmwoKSkgJiYgKGNbZ10gPSAoY1tnXSB8fCAwKSArIDEpOwogICAgICAgICAgICAgICAgICAgIGlmICghYnIoYykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IG5ldyBjZignZ3B0X3NyYV9zZXRjbGlja3VybCcpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBfLmVmKGMsIGZ1bmN0aW9uIChrLCBsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLnB1c2goU3RyaW5nKGwubGVuZ3RoKSArICc6JyArIFN0cmluZyhrKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBJKGYsICdsZW5mcmVxcycsIGguam9pbigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgZGYoZik7CiAgICAgICAgICAgICAgICAgICAgICAgIGZmKGYsIF8uYmZbNThdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXy5IKHp0KSAmJiBaKGEsICdkaWRrJywgYi5tYXAoZnVuY3Rpb24gKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFnKGsuZ2V0RG9tSWQoKSk7CiAgICAgICAgICAgICAgICAgICAgfSkuam9pbignficpKTsKICAgICAgICAgICAgICAgIH0sIFJIID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBiID0gXy55KGIpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBiLm5leHQoKTsgIWMuZG9uZTsgYyA9IGIubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IGMudmFsdWUsICcnICE9PSBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gITEsIGUgPSBfLnkoYS5GKSwgZiA9IGUubmV4dCgpOyAhZi5kb25lOyBmID0gZS5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgPT09IGYudmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkIHx8IGEuRi5wdXNoKGMpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBTSCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9ICcnLCBkID0gMDsgZCA8IGIubGVuZ3RoOyBkKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPCBkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyArPSAnLyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCcnID09PSBiWzBdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSAwOyBlIDwgYS5GLmxlbmd0aDsgZSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJbZF0gPT09IGEuRltlXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgKz0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9LCBRSCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAnJzsKICAgICAgICAgICAgICAgICAgICAnJyAhPT0gYiAmJiAoYiA9IGIuc3BsaXQoJy8nKS5tYXAoZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQucmVwbGFjZSgvLC9nLCAnOicpOwogICAgICAgICAgICAgICAgICAgIH0pLCBSSChhLCBiKSwgYyA9IFNIKGEsIGIpKTsKICAgICAgICAgICAgICAgICAgICBhLkIucHVzaChjKTsKICAgICAgICAgICAgICAgIH0sIFBIID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBiID0gYi5tYXAoZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSAoZCA9IEdEKGEuSywgYykpICYmIHZvaWQgMCAhPT0gZCA/IGQgOiBbXTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBaKGEsICd1Y2lzJywgYiwgeyB5YTogJ3wnIH0pOwogICAgICAgICAgICAgICAgfSwgS0ggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGlmICghXy5IKEt0KSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIgPSB0YyhhLmxhLCB3aW5kb3cpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG5ldyBPcCgpLCBkID0gXy56YyhOdCksIGUgPSBbXSwgZiA9IFJlZ0V4cCgnXl9HRVNQU0stKC4rKSQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyA9IDA7IGcgPCBiLmxlbmd0aDsgZysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gKGYuZXhlYyhiLmtleShnKSkgfHwgW10pWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoICYmIGUucHVzaChoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gXy55KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChmID0gZS5uZXh0KCk7ICFmLmRvbmU7IGYgPSBlLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZiA9IGYudmFsdWUsIGcgPSAkYygpLmdldChmLCBiKSwgZy5nZXRFcnJvcigpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFYyhnLmdldEVycm9yKCksIGYsIGcuZXJyb3JNZXNzYWdlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChnID0gZy5VYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGggPSBhZChnKSwgMCA9PT0gaCB8fCAxID09PSBoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IEcoZywgMiksIDAgPD0gZCAmJiBoICYmIGgubGVuZ3RoID4gZCA/IEVjKDEyLCBmKSA6IChnaChjLCAyLCBTcCwgZyksIEVjKDE5LCBmKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gVWIoYywgU3AsIDIpLmxlbmd0aCA/IEViKFlvKGMsIFRwKSwgMikgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBaKGEsICdhM3AnLCBiKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBaID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICBkID0gdm9pZCAwID09PSBkID8ge30gOiBkOwogICAgICAgICAgICAgICAgICAgIGEuSi5oYXMoYikgfHwgbnVsbCA9PSBjIHx8IGEuRC5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgJGQ6IGIsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBjLAogICAgICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiBkCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCB5SCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IF8ueShfLnQoYiwgJ2VudHJpZXMnKS5jYWxsKGIpKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gYi5uZXh0KCk7ICFjLmRvbmU7IGMgPSBiLm5leHQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IF8ueShjLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGQubmV4dCgpLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gZC5uZXh0KCkudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIFooYSwgYywgZC52YWx1ZSwgZC5vcHRpb25zKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCB0SCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLnZhbHVlLCBjID0gYS5vcHRpb25zLCBkID0gdm9pZCAwID09PSBjLmJhID8gITAgOiBjLmJhOwogICAgICAgICAgICAgICAgICAgIGEgPSB2b2lkIDAgPT09IGMueWEgPyAnLCcgOiBjLnlhOwogICAgICAgICAgICAgICAgICAgIGMgPSB2b2lkIDAgPT09IGMucWEgPyAhMSA6IGMucWE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnICE9PSB0eXBlb2YgYiA/IG51bGwgPT0gYiB8fCAhYyAmJiAwID09PSBiID8gbnVsbCA6IHlsKGIsIGQpIDogQXJyYXkuaXNBcnJheShiKSAmJiBiLmxlbmd0aCA/IGIubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5bChlLCBkKTsKICAgICAgICAgICAgICAgICAgICB9KS5qb2luKHlsKGEsIGQpKSA6IG51bGw7CiAgICAgICAgICAgICAgICB9LCBMSCA9IDAsIE9IID0gbnVsbDsKICAgICAgICAgICAgdmFyIFRIID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYsIGcsIGgsIGssIGwsIG0sIG4sIHEsIHUsIEIsIHgsIHosIEMsIEQsIEopIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA3OTgpOwogICAgICAgICAgICAgICAgdGhpcy5LID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuTCA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5ZID0gZDsKICAgICAgICAgICAgICAgIHRoaXMuViA9IGU7CiAgICAgICAgICAgICAgICB0aGlzLkNhID0gZjsKICAgICAgICAgICAgICAgIHRoaXMuUWEgPSBnOwogICAgICAgICAgICAgICAgdGhpcy5QYSA9IGg7CiAgICAgICAgICAgICAgICB0aGlzLiQgPSBsOwogICAgICAgICAgICAgICAgdGhpcy5vID0gbTsKICAgICAgICAgICAgICAgIHRoaXMuQyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLm5hID0gVih0aGlzLCBuKTsKICAgICAgICAgICAgICAgIHRoaXMuWiA9IFYodGhpcywgcSk7CiAgICAgICAgICAgICAgICB0aGlzLkcgPSBWKHRoaXMsIGspOwogICAgICAgICAgICAgICAgdGhpcy5OID0gcnYodGhpcywgdSk7CiAgICAgICAgICAgICAgICB0aGlzLkogPSBydih0aGlzLCBCKTsKICAgICAgICAgICAgICAgIHRoaXMuZGEgPSBWKHRoaXMsIHgpOwogICAgICAgICAgICAgICAgdGhpcy5lYSA9IFYodGhpcywgeik7CiAgICAgICAgICAgICAgICB0aGlzLmthID0gVih0aGlzLCBDKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFcodGhpcywgRCk7CiAgICAgICAgICAgICAgICBzdih0aGlzLCBKKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFRILCBZKTsKICAgICAgICAgICAgVEgucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gdGhpcywgYiA9IG5ldyB2Lk1hcCgpLCBjID0gXy55KHRoaXMuWi52YWx1ZSksIGQgPSBjLm5leHQoKTsgIWQuZG9uZTsgZCA9IGMubmV4dCgpKQogICAgICAgICAgICAgICAgICAgIGQgPSBkLnZhbHVlLCBiLnNldChkLCB0aGlzLlYgPyBVSCh0aGlzLCBkKSA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubmEudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLkMuaihiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFVIID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0ZyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMsIGQgPSBuZXcgYncoKTsKICAgICAgICAgICAgICAgICAgICBkID0gbmV3IHJIKFtiXSwgITEsIGEuSywgYS5CLCBkLCBhLkwsIGEuWSwgYS5DYSwgYS5RYSwgYS5QYSwgYS5HLnZhbHVlLCBhLmRhLnZhbHVlLCBhLmVhLnZhbHVlLCBhLmthLnZhbHVlLCBudWxsICE9PSAoYyA9IGEuTi52YWx1ZSkgJiYgdm9pZCAwICE9PSBjID8gYyA6ICcwJywgYS5KLnZhbHVlLCBhLiQsIGEubywgYS5sLnZhbHVlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNlKHVIKGQpKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVkggPSBuZXcgdi5NYXAoKSwgV0ggPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBWSCA6IGI7CiAgICAgICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDgzNCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5jYSA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gYjsKICAgICAgICAgICAgICAgICAgICB0aGlzLm8gPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuQiA9IHYuUHJvbWlzZS5hbGwodGhpcy5jYS5tYXAodGhpcy5HLCB0aGlzKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oV0gsIFkpOwogICAgICAgICAgICBXSC5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYjsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IGMuaikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGMsIGEuQiwgMik7CiAgICAgICAgICAgICAgICAgICAgYiA9IGMubTsKICAgICAgICAgICAgICAgICAgICBhLm8uaihiLmZpbHRlcihmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBkICYmICFkLm07CiAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgIExtKGMpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFdILnByb3RvdHlwZS5HID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gdGhpcywgYywgZCwgZTsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IGYuaikgewogICAgICAgICAgICAgICAgICAgICAgICBjID0gMTAwMCAqIF8uemMocnQpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5tKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYucmV0dXJuKG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA+PSBjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYucmV0dXJuKGEpOwogICAgICAgICAgICAgICAgICAgICAgICBiLmwuaGFzKGEpIHx8IChiLmwuc2V0KGEsIEFsKGMsIGEpKSwgXy56bChhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBiLmwuZGVsZXRlKGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSAoMCwgRi5IKShiLmwuZ2V0KGEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKGYsIGQoKSwgMik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGUgPSBmLm07CiAgICAgICAgICAgICAgICAgICAgaWYgKGIubSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYucmV0dXJuKG51bGwpOwogICAgICAgICAgICAgICAgICAgIGlmIChlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZi5yZXR1cm4oYSk7CiAgICAgICAgICAgICAgICAgICAgTShMaCgpLCBVRShhLmdldEFkVW5pdFBhdGgoKSkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmLnJldHVybihudWxsKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWEggPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDkzNik7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBhOwogICAgICAgICAgICAgICAgdGhpcy5DID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFcodGhpcywgYik7CiAgICAgICAgICAgICAgICB0aGlzLkIgPSBXKHRoaXMsIGMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oWEgsIFkpOwogICAgICAgICAgICBYSC5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhLCBiOwogICAgICAgICAgICAgICAgdGhpcy5DLmooW10uY29uY2F0KF8ubGModGhpcy5vKSwgXy5sYyhudWxsICE9PSAoYSA9IHRoaXMubC52YWx1ZSkgJiYgdm9pZCAwICE9PSBhID8gYSA6IFtdKSwgXy5sYyhudWxsICE9PSAoYiA9IHRoaXMuQi52YWx1ZSkgJiYgdm9pZCAwICE9PSBiID8gYiA6IFtdKSkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWUggPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZywgaCwgaywgbCwgbSwgbikgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg2Nik7CiAgICAgICAgICAgICAgICB0aGlzLk4gPSBhOwogICAgICAgICAgICAgICAgdGhpcy5WID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuSiA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBlOwogICAgICAgICAgICAgICAgdGhpcy5HID0gZjsKICAgICAgICAgICAgICAgIHRoaXMuVyA9IGc7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IFYodGhpcywgaCk7CiAgICAgICAgICAgICAgICB0aGlzLlogPSBWKHRoaXMsIGspOwogICAgICAgICAgICAgICAgc3YodGhpcywgbCk7CiAgICAgICAgICAgICAgICB0aGlzLlkgPSBWKHRoaXMsIG0pOwogICAgICAgICAgICAgICAgdGhpcy5vID0gVih0aGlzLCBuKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKFlILCBZKTsKICAgICAgICAgICAgWUgucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGIsIGMsIGQsIGUsIGYsIGcsIGgsIGssIGwsIG07CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSBuLmopIHsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGEuWi52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuQy5ub3RpZnkoKSwgbi5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9IF8uT2koJ0xJTksnKTsKICAgICAgICAgICAgICAgICAgICAgICAgKC9eaHR0cHM6Ly50ZXN0KGMpIHx8IF8uYmZbMjU3XSkgJiYgRHEoZCwgbmV3IGlkKGMsIGxkKSwgJ3dlYmJ1bmRsZScpOwogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09PSAoYiA9IGQucmVzb3VyY2VzKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLmFkZChYYShhLkcpLnRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICBkLmNyb3NzT3JpZ2luID0gYS5ZLnZhbHVlID8gJ3VzZS1jcmVkZW50aWFscycgOiAnYW5vbnltb3VzJzsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IF8uT2koJ1NDUklQVCcpOwogICAgICAgICAgICAgICAgICAgICAgICBiYihlLCBhLkcpOwogICAgICAgICAgICAgICAgICAgICAgICBhLlcuaGVhZC5hcHBlbmRDaGlsZChkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYS5XLmhlYWQuYXBwZW5kQ2hpbGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuQy5ub3RpZnkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKG4sIFpIKGEpLCAyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZiA9IG4ubTsKICAgICAgICAgICAgICAgICAgICBnID0gZi5rZDsKICAgICAgICAgICAgICAgICAgICBoID0gZi5YZDsKICAgICAgICAgICAgICAgICAgICBfLkgoQXMpICYmIGRlbGV0ZSBuZSgpW2EubC5yZXBsYWNlKCdnb29nbGV0YWcuJywgJycpXTsKICAgICAgICAgICAgICAgICAgICBkLnJlc291cmNlcy5yZW1vdmUoZC5yZXNvdXJjZXNbMF0pOwogICAgICAgICAgICAgICAgICAgIGlmIChnLmxlbmd0aCAhPT0gaC5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLlYobmV3IGR2KCdSZWNlaXZlZCAnICsgZy5sZW5ndGggKyAnIGJ1dCAnICsgaC5sZW5ndGggKyAnIG1ldGFkYXRhcycpKSwgbi5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDwgZy5sZW5ndGg7IGsrKykKICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGdba10sIG0gPSBoW2tdLCBsICYmIGQucmVzb3VyY2VzLmFkZChsKSwgYS5OKGssIG0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtpbmQ6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGwKICAgICAgICAgICAgICAgICAgICAgICAgfSwgYS5CLnZhbHVlLCBhLm8udmFsdWUpOwogICAgICAgICAgICAgICAgICAgIGQucmVzb3VyY2VzLmxlbmd0aCB8fCBkLnJlbW92ZSgpOwogICAgICAgICAgICAgICAgICAgIGEuSihnLmxlbmd0aCAtIDEsIGEuQi52YWx1ZSwgYS5vLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICBMbShuKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWkggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBuZSgpLCBjID0gYS5sLnJlcGxhY2UoJ2dvb2dsZXRhZy4nLCAnJyk7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHYuUHJvbWlzZShmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gITE7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGIsIGMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChmLCBnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlIHx8IGQoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtkOiBmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFhkOiBnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICExLAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciAkSCA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODEwKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkogPSBiOwogICAgICAgICAgICAgICAgdGhpcy5MID0gYzsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IGQ7CiAgICAgICAgICAgICAgICB0aGlzLkkgPSBlOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IFYodGhpcywgZik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTygkSCwgWSk7CiAgICAgICAgICAgICRILnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiID0gdGhpcy5vOwogICAgICAgICAgICAgICAgIXRoaXMuSiAmJiAxIDwgdGhpcy5vLmxlbmd0aCAmJiAoYiA9IFtiWzBdXSk7CiAgICAgICAgICAgICAgICBiID0gYi5maWx0ZXIoZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGEuTC5QW2MuZ2V0RG9tSWQoKV07CiAgICAgICAgICAgICAgICAgICAgaWYgKEpmKGEuSSkgJiYgNCA9PT0gTmYoZCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgTShMaCgpLCBMRSgnZ29vZ2xldGFnLmVudW1zLk91dE9mUGFnZUZvcm1hdC5SRVdBUkRFRCcsIFN0cmluZyhjLmdldEFkVW5pdFBhdGgoKSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAhMDsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZSA9ICExOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhZSAmJiAhUGYoYywgZCwgYS5JLCBhLkIudmFsdWUpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAzMCA8IGIubGVuZ3RoICYmIChNKHRoaXMuRywgSEUoJzMwJywgU3RyaW5nKGIubGVuZ3RoKSwgU3RyaW5nKGIubGVuZ3RoIC0gMzApKSksIGIgPSBiLnNsaWNlKDAsIDMwKSk7CiAgICAgICAgICAgICAgICB0aGlzLmwuaihiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGFJID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA4MjYpOwogICAgICAgICAgICAgICAgdGhpcy5LID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuQyA9IFUodGhpcyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhhSSwgWSk7CiAgICAgICAgICAgIGFJLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiLCBjOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gZC5qKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiA9IGEuQywgYyA9IGIuZmEsIGpiKGQsIGEuSy5BLCAyKTsKICAgICAgICAgICAgICAgICAgICBjLmNhbGwoYiwgZC5tKTsKICAgICAgICAgICAgICAgICAgICBMbShkKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICBhSS5wcm90b3R5cGUuQSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGp2KHRoaXMuQyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBiSSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODAyKTsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBVKHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oYkksIFkpOwogICAgICAgICAgICBiSS5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYywgZCwgZSwgZjsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IGcuaikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIV8uSChTcykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5sLmooJycpLCBnLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgICAgICBjID0gXy56YyhScyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSAwIDwgYyA/IG5ldyB2LlByb21pc2UoZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGgoJzAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGMpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSA6IEpkKGEuSSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5sLmooJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5qID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBnLkYgPSAzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamIoZywgZCwgNSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICgzICE9IGcuaikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBudWxsICE9PSAoYiA9IGcubSkgJiYgdm9pZCAwICE9PSBiID8gYiA6ICcwJywgZS5sZW5ndGggPiBfLnpjKFVzKSAmJiAocmYoYS5pZCwgbmV3IHZoKCdNTDonICsgKF8uSChUcykgPyBlIDogZS5sZW5ndGgpKSksIGUgPSAnMCcpLCBhLmwuaihlKSwgbGIoZywgMCk7CiAgICAgICAgICAgICAgICAgICAgZiA9IG1iKGcpOwogICAgICAgICAgICAgICAgICAgIHJmKGEuaWQsIGYpOwogICAgICAgICAgICAgICAgICAgIGEubC5qKCcwJyk7CiAgICAgICAgICAgICAgICAgICAgTG0oZyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgYkkucHJvdG90eXBlLkEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLmwuaignJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBjSSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODQ3KTsKICAgICAgICAgICAgICAgIHRoaXMuSyA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBiOwogICAgICAgICAgICAgICAgdGhpcy5CID0gYzsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLkcgPSBWKHRoaXMsIGQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oY0ksIFkpOwogICAgICAgICAgICBjSS5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5HLnZhbHVlOwogICAgICAgICAgICAgICAgaWYgKGEubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IF8ueShhKSwgYyA9IGIubmV4dCgpOyAhYy5kb25lOyBjID0gYi5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIEZEKHRoaXMuSywgYy52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5CID8ganYodGhpcy5sKSA6IHRoaXMubyA/IChiID0gUGUoYVswXS5nZXRBZFVuaXRQYXRoKCkpLCBhID0gZEkoYSwgYiksIHRoaXMubC5qKGEpKSA6IChhID0gYS5tYXAoZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFhOiBQZShkLmdldEFkVW5pdFBhdGgoKSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYTogW2RdCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSksIHRoaXMubC5qKGEpKTsKICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgIGp2KHRoaXMubCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBkSSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IFtdOwogICAgICAgICAgICAgICAgYSA9IHNhKGEsIGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBlKGYuZ2V0QWRVbml0UGF0aCgpKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgYSA9IF8ueShfLnQoT2JqZWN0LCAnZW50cmllcycpLmNhbGwoT2JqZWN0LCBhKSk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gYS5uZXh0KCk7ICFkLmRvbmU7IGQgPSBhLm5leHQoKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gXy55KGQudmFsdWUpOwogICAgICAgICAgICAgICAgICAgIGQgPSBlLm5leHQoKS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICBlID0gZS5uZXh0KCkudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgZCA9PT0gYiA/IGMudW5zaGlmdCh7CiAgICAgICAgICAgICAgICAgICAgICAgIEFhOiBkLAogICAgICAgICAgICAgICAgICAgICAgICBjYTogZQogICAgICAgICAgICAgICAgICAgIH0pIDogYy5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgQWE6IGQsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhOiBlCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGVJID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA4NDUpOwogICAgICAgICAgICAgICAgdGhpcy5QID0gYTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gVih0aGlzLCBiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGVJLCBZKTsKICAgICAgICAgICAgZUkucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGIgPSBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICBkID0gYS5QW2QuZ2V0RG9tSWQoKV07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIVhmKGQpLmxlbmd0aCB8fCBZZihkLCAxNik7CiAgICAgICAgICAgICAgICAgICAgfSwgYyA9IHRoaXMuQi52YWx1ZTsKICAgICAgICAgICAgICAgIHRoaXMubC5qKGMuZmlsdGVyKGIpKTsKICAgICAgICAgICAgICAgIHRoaXMuby5qKGMuZmlsdGVyKFVuKGIpKSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBmSSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgOTE5KTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5sID0gVih0aGlzLCBiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGZJLCBZKTsKICAgICAgICAgICAgZkkucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSwgYiA9ICEobnVsbCA9PT0gKGEgPSB0aGlzLm8pIHx8IHZvaWQgMCA9PT0gYSA/IDAgOiBFKGEsIDkpKSAmJiAhIUUodGhpcy5sLnZhbHVlLCA1KTsKICAgICAgICAgICAgICAgIHRoaXMuQy5qKGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZ0kgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDkzNSk7CiAgICAgICAgICAgICAgICB0aGlzLksgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5MID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuVyA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFYodGhpcywgZCk7CiAgICAgICAgICAgICAgICBzdih0aGlzLCBlKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKGdJLCBZKTsKICAgICAgICAgICAgZ0kucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMuTCwgYiA9IGEuVTsKICAgICAgICAgICAgICAgIGEgPSBhLlA7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gXy55KHRoaXMubC52YWx1ZSksIGQgPSBjLm5leHQoKTsgIWQuZG9uZTsgZCA9IGMubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgZCA9IGQudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhW2QuZ2V0RG9tSWQoKV0sIGYgPSB0aGlzLlc7CiAgICAgICAgICAgICAgICAgICAgZiA9IHZvaWQgMCA9PT0gZiA/IGRvY3VtZW50IDogZjsKICAgICAgICAgICAgICAgICAgICBtaShlLCBiKSAmJiAhdGhpcy5LLlRhKGQpICYmIHBpKGQsIGYsIGUsIGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpcy5DLm5vdGlmeSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaEkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg2NCk7CiAgICAgICAgICAgICAgICB0aGlzLksgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5MID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuVyA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFYodGhpcywgZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhoSSwgWSk7CiAgICAgICAgICAgIGhJLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IF8ueSh0aGlzLm8udmFsdWUpLCBiID0gYS5uZXh0KCk7ICFiLmRvbmU7IGIgPSBhLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IGIudmFsdWUsIF8uQUQodGhpcy5LLCBiKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHRoaXMuTCwgZCA9IGMuVTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMuUFtiLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgICAgICAgICBtaShjLCBkKSAmJiBwaShiLCB0aGlzLlcsIGMsIGQpOwogICAgICAgICAgICAgICAgICAgICAgICBGRCh0aGlzLkssIGIpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHZvaWQgMCwgZiA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gKGUgPSBudWxsICE9PSAoZiA9IEUoYywgMTApKSAmJiB2b2lkIDAgIT09IGYgPyBmIDogRShkLCAxMSkpICYmIHZvaWQgMCAhPT0gZSAmJiBlICYmIHBpKGIsIHRoaXMuVywgYywgZCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpcy5sLm5vdGlmeSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaUkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZikgewogICAgICAgICAgICAgICAgZiA9IHZvaWQgMCA9PT0gZiA/IFhkIDogZjsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA5MzkpOwogICAgICAgICAgICAgICAgdGhpcy5CID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuaWMgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5JID0gYzsKICAgICAgICAgICAgICAgIHRoaXMubyA9IGY7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBWKHRoaXMsIGQpOwogICAgICAgICAgICAgICAgc3YodGhpcywgZSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhpSSwgWSk7CiAgICAgICAgICAgIGlJLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKEUodGhpcy5sLnZhbHVlLCA1KSkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5vLCBiID0gdGhpcy5JLCBjID0gbmV3IFZsKCk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBuZXcgV2woKTsKICAgICAgICAgICAgICAgICAgICBkID0gUWIoZCwgMSwgU3RyaW5nKHRoaXMuQiksICcnKTsKICAgICAgICAgICAgICAgICAgICBjID0gemYoYywgNSwgZCk7CiAgICAgICAgICAgICAgICAgICAgYyA9IFFiKGMsIDQsIDEsIDApOwogICAgICAgICAgICAgICAgICAgIGMgPSBRYihjLCAyLCAyLCAwKTsKICAgICAgICAgICAgICAgICAgICBjID0gUWIoYywgMywgdGhpcy5pYywgJycpOwogICAgICAgICAgICAgICAgICAgIGEuY2FsbCh0aGlzLCBiLCBKayhjLCA2LCAhMCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgakkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDkwNSk7CiAgICAgICAgICAgICAgICB0aGlzLkwgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5sID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuQyA9IHF2KHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5vID0gVih0aGlzLCBjKTsKICAgICAgICAgICAgICAgIHN2KHRoaXMsIGQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oakksIFkpOwogICAgICAgICAgICBqSS5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGEsIGIgPSBfLnkodGhpcy5vLnZhbHVlKSwgYyA9IGIubmV4dCgpOyAhYy5kb25lOyBjID0gYi5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChudWxsID09PSAoYSA9IHRoaXMuTC5QW2MudmFsdWUuZ2V0RG9tSWQoKV0pIHx8IHZvaWQgMCA9PT0gYSA/IHZvaWQgMCA6IE5mKGEpKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubC5sb2FkKF8ubEcpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpcy5DLm5vdGlmeSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIga0kgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDgzMyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5vID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGM7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHN2KHRoaXMsIGQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oa0ksIFkpOwogICAgICAgICAgICBrSS5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGlmICgnd2JuJyAhPT0gdGhpcy5sKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLm8sIGIgPSB0aGlzLkksIGMgPSByRCgpLCBkOwogICAgICAgICAgICAgICAgICAgIGMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IFdpKCksCiAgICAgICAgICAgICAgICAgICAgICAgIFRiOiBjCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBjID0gb0IuUmQoYyk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IGIsIGYgPSAwOyBlICE9PSBlLnBhcmVudDspCiAgICAgICAgICAgICAgICAgICAgICAgIGYrKywgZSA9IGUucGFyZW50OwogICAgICAgICAgICAgICAgICAgIGMgPSBmID8gaGMoYywgbmV3IHYuTWFwKFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcoZikKICAgICAgICAgICAgICAgICAgICAgICAgXV0pKSA6IGM7CiAgICAgICAgICAgICAgICAgICAgZSA9IFlpKFppKTsKICAgICAgICAgICAgICAgICAgICBmID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyA9IDA7IGcgPCBlLmxlbmd0aDsgZyArPSAyKQogICAgICAgICAgICAgICAgICAgICAgICBmLnNldChlW2ddLCBlW2cgKyAxXSk7CiAgICAgICAgICAgICAgICAgICAgYyA9IGhjKGMsIGYpOwogICAgICAgICAgICAgICAgICAgIGEucmVzb3VyY2VzW2MudG9TdHJpbmcoKV0gfHwgKG51bGwgPT09IChkID0gbmUoKSkgfHwgdm9pZCAwID09PSBkID8gMCA6IGQuZmlmV2luKSB8fCAoYS5yZXNvdXJjZXNbYy50b1N0cmluZygpXSA9IDEsIGIgPSBiLmRvY3VtZW50LCBhID0gXy5PaSgnSUZSQU1FJyksIGEuc3JjID0gWmEoYyksIGEuc3R5bGUudmlzaWJpbGl0eSA9ICdoaWRkZW4nLCBhLnN0eWxlLmRpc3BsYXkgPSAnbm9uZScsIGIgPSBiLmdldEVsZW1lbnRzQnlUYWdOYW1lKCdzY3JpcHQnKSwgYi5sZW5ndGggJiYgKGIgPSBiW2IubGVuZ3RoIC0gMV0sIGIucGFyZW50Tm9kZSAmJiBiLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKGEsIGIubmV4dFNpYmxpbmcpKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0aGlzLkMubm90aWZ5KCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBsSSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgOTI4KTsKICAgICAgICAgICAgICAgIHRoaXMuSyA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLmNvbnRleHQgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5DID0gcXYodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBWKHRoaXMsIGMpOwogICAgICAgICAgICAgICAgc3YodGhpcywgZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhsSSwgWSk7CiAgICAgICAgICAgIGxJLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5LLmwoKTsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5jb250ZXh0LCBiID0gdGhpcy5sLnZhbHVlLmxlbmd0aDsKICAgICAgICAgICAgICAgIGlmIChhLkJjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLnNiOwogICAgICAgICAgICAgICAgICAgIGEgPSBHayhhKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IG5ldyBzdSgpOwogICAgICAgICAgICAgICAgICAgIGIgPSBRYihkLCAxLCBiLCAwKTsKICAgICAgICAgICAgICAgICAgICBiID0gRWUoYSwgNywgS2ssIGIpOwogICAgICAgICAgICAgICAgICAgIG5jKGMsIGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpcy5DLm5vdGlmeSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbUkgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDg2Nyk7CiAgICAgICAgICAgICAgICB0aGlzLm1hID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuTCA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFYodGhpcywgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhtSSwgWSk7CiAgICAgICAgICAgIG1JLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IF8ueSh0aGlzLmwudmFsdWUpLCBiID0gYS5uZXh0KCk7ICFiLmRvbmU7IGIgPSBhLm5leHQoKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gXy55KGIudmFsdWUpOwogICAgICAgICAgICAgICAgICAgIGIgPSBjLm5leHQoKS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICBjID0gYy5uZXh0KCkudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBHKHRoaXMuTC5QW2IuZ2V0RG9tSWQoKV0sIDIwKTsKICAgICAgICAgICAgICAgICAgICBiLmRpc3BhdGNoRXZlbnQoVUMsIDgwOCwgewogICAgICAgICAgICAgICAgICAgICAgICByZDogYywKICAgICAgICAgICAgICAgICAgICAgICAga2U6IGQKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLm1hLmRpc3BhdGNoRXZlbnQoJ3Nsb3RSZXF1ZXN0ZWQnLCA3MDUsIG5ldyBuRihiLCAncHVibGlzaGVyX2FkcycpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXMuQy5ub3RpZnkoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIG5JID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYsIGcsIGgsIGssIGwsIG0sIG4sIHEsIHUsIEIsIHgsIHosIEMpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA3ODUsIF8uemMoQnQpKTsKICAgICAgICAgICAgICAgIHRoaXMuc2EgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5LID0gYjsKICAgICAgICAgICAgICAgIHRoaXMuZGEgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5MID0gZDsKICAgICAgICAgICAgICAgIHRoaXMudGEgPSBlOwogICAgICAgICAgICAgICAgdGhpcy5DYSA9IGY7CiAgICAgICAgICAgICAgICB0aGlzLlFhID0gZzsKICAgICAgICAgICAgICAgIHRoaXMuUGEgPSBoOwogICAgICAgICAgICAgICAgdGhpcy5yYSA9IGw7CiAgICAgICAgICAgICAgICB0aGlzLlogPSBtOwogICAgICAgICAgICAgICAgdGhpcy5KID0gcTsKICAgICAgICAgICAgICAgIHRoaXMueWIgPSB1OwogICAgICAgICAgICAgICAgdGhpcy5sID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuRyA9IFUodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLk4gPSBVKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5WID0gVSh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuJCA9IFYodGhpcywgbik7CiAgICAgICAgICAgICAgICB0aGlzLm5hID0gcnYodGhpcywgcSk7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBydih0aGlzLCB1KTsKICAgICAgICAgICAgICAgIHRoaXMuZWEgPSBWKHRoaXMsIGspOwogICAgICAgICAgICAgICAgdGhpcy5CID0gVyh0aGlzLCBCKTsKICAgICAgICAgICAgICAgIHRoaXMua2EgPSBydih0aGlzLCB4KTsKICAgICAgICAgICAgICAgIHRoaXMuWSA9IFcodGhpcywgQyk7CiAgICAgICAgICAgICAgICBndih0aGlzLkQsIHosICEwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKG5JLCBZKTsKICAgICAgICAgICAgbkkucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGIsIGMsIGQsIGUsIGYsIGcsIGgsIGs7CiAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKGwpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSBsLmopIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IChiID0gYS5CLnZhbHVlKSB8fCB2b2lkIDAgPT09IGIgfHwgIWIubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubC5qKCcnKSwgbC5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgZCA9ICFfLkgoZ2wpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdWQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gd2RbMV07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICBlID0gbTsKICAgICAgICAgICAgICAgICAgICAgICAgZCA/ICh1ZCgpLCBtID0gd2RbNF0pIDogbSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICBmID0gbTsKICAgICAgICAgICAgICAgICAgICAgICAgZCA/ICh1ZCgpLCBtID0gd2RbNl0pIDogbSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICBnID0gbTsKICAgICAgICAgICAgICAgICAgICAgICAgaCA9IG51bGwgIT09IChjID0gYS5uYS52YWx1ZSkgJiYgdm9pZCAwICE9PSBjID8gYyA6ICcwJzsKICAgICAgICAgICAgICAgICAgICAgICAgYS5vLnZhbHVlICYmIChhLksubmIgPSBhLm8udmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICBrID0gbmV3IHJIKGEuQi52YWx1ZSwgYS5zYSwgYS5LLCBhLmRhLCBhLiQudmFsdWUsIGEuTCwgYS50YSwgYS5DYSwgYS5RYSwgYS5QYSwgYS5lYS52YWx1ZSwgZSwgZiwgZywgaCwgYS5rYS52YWx1ZSwgYS5yYSwgYS5aLCBhLlkudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICBhLmwuaihTZSh1SChrKSkpOwogICAgICAgICAgICAgICAgICAgICAgICBhLkcuaihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgYS5OLmooZik7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuVi5qKGcpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamIobCwgYS5KLnByb21pc2UsIDIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoNCAhPSBsLmopIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEubSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgICAgICBvZignZ3B0X3BhdycsIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcSwgdTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRmKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgSShuLCAnc2lnJywgbnVsbCAhPT0gKHEgPSBhLkoubykgJiYgdm9pZCAwICE9PSBxID8gcSA6IC0xKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkobiwgJ3JlcScsIGEuVCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKG4sICdyZXFfY250JywgYS5LLkQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgSShuLCAnZG0nLCBudWxsICE9PSAodSA9IHdpbmRvdy5uYXZpZ2F0b3IuZGV2aWNlTWVtb3J5KSAmJiB2b2lkIDAgIT09IHUgPyB1IDogLTEpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7IHBhOiBfLnpjKFZzKSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgYS5vLnZhbHVlID8gbCA9IGpiKGwsIGEueWIucHJvbWlzZSwgNCkgOiAobC5qID0gMCwgbCA9IHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBvZignZ3B0X2V0dScsIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBxOwogICAgICAgICAgICAgICAgICAgICAgICBkZihuKTsKICAgICAgICAgICAgICAgICAgICAgICAgSShuLCAnc2lnJywgbnVsbCAhPT0gKHEgPSBhLnliLm8pICYmIHZvaWQgMCAhPT0gcSA/IHEgOiAtMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIEkobiwgJ3JlcScsIGEuVCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgTG0obCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIG9JID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLkQgPSBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMubCA9IGI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5BID0gYzsKICAgICAgICAgICAgICAgICAgICB0aGlzLmNhID0gZDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmxhID0gZTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkYgPSAnJzsKICAgICAgICAgICAgICAgICAgICB0aGlzLm0gPSAtMTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnN0YXRlID0gMTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSAnJzsKICAgICAgICAgICAgICAgIH0sIHBJID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBhLnN0YXRlID0gNDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBhLmwoYik7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBxSSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmLCBnLCBoLCBrKSB7CiAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkX2MzM2E2OWM0NzBhNmJjMzEgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKSwgJF9fX29sZF9mNmEyNDk0NThmZWM2MWEwID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0Jyk7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2MzM2E2OWM0NzBhNmJjMzEpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzAwNDY1Mjg0MDA0ZDRhYTguWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9mNmEyNDk0NThmZWM2MWEwKQogICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja18wMDQ2NTI4NDAwNGQ0YWE4LlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDc4OCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuSiA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuTiA9IGI7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuRyA9IGM7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuQyA9IHF2KHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLkIgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm8gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gbnVsbCAhPT0gayAmJiB2b2lkIDAgIT09IGsgPyBrIDogbmV3IFhNTEh0dHBSZXF1ZXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuWiA9IFYodGhpcywgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuJCA9IFYodGhpcywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHN2KHRoaXMsIGYpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLlkgPSBWKHRoaXMsIGcpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLlYgPSBWKHRoaXMsIGgpOwogICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYzMzYTY5YzQ3MGE2YmMzMSkKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX29sZF9jMzNhNjljNDcwYTZiYzMxKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfZjZhMjQ5NDU4ZmVjNjFhMCkKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX29sZF9mNmEyNDk0NThmZWM2MWEwKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhxSSwgWSk7CiAgICAgICAgICAgIHFJLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiID0gdGhpcy4kLnZhbHVlOwogICAgICAgICAgICAgICAgaWYgKGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG5ldyBvSSh0aGlzLkosIHRoaXMuTiwgdGhpcy5HLCB0aGlzLloudmFsdWUsIHRoaXMuVi52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sLm9wZW4oJ0dFVCcsIGIpOwogICAgICAgICAgICAgICAgICAgIHRoaXMubC53aXRoQ3JlZGVudGlhbHMgPSB0aGlzLlkudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgTkIodGhpcy5sKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmwub25yZWFkeXN0YXRlY2hhbmdlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBySShhLCBjLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmwub25sb2FkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBySShhLCBjLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmwub25lcnJvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcEkoYywgbmV3IGV2KCdYSFIgZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmwuc2VuZCgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpcy5DLm5vdGlmeSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgckkgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoMyA9PT0gYS5sLnJlYWR5U3RhdGUgfHwgNCA9PT0gYS5sLnJlYWR5U3RhdGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDMwMCA8PSBhLmwuc3RhdHVzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5vKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBJKGIsIG5ldyBldigneGhyX2Vyci0nICsgYS5sLnN0YXR1cykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5vID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoXy5IKFlzKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLmwucmVzcG9uc2VUZXh0LnN1YnN0cihhLkIpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiBkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgIT09IGIuc3RhdGUgJiYgMiAhPT0gYi5zdGF0ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwSShiLCBuZXcgZHYoJ3N0YXRlIGVycjogKCcgKyAoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLnN0YXRlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLmoubGVuZ3RoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5qb2luKCkgKyAnKScpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLmogJiYgKGQgPSBiLmogKyBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IDAsIGYgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gZC5pbmRleE9mKCdcbicsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gLTEgIT09IGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGIsIGsgPSBkLnN1YnN0cihlLCBnIC0gZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxID09PSBoLnN0YXRlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5GID0gaywgKytoLm0sIGguc3RhdGUgPSAyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5EKGgubSwgaC5GLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtpbmQ6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdhOiB4cihrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGguY2EsIGgubGEpLCBoLkYgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGguc3RhdGUgPSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBnICsgMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlIChmICYmIGUgPCBkLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5qID0gZC5zdWJzdHIoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGEuQiA9IGEubC5yZXNwb25zZVRleHQubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICBjICYmIDQgPT09IGEubC5yZWFkeVN0YXRlICYmICgxICE9PSBiLnN0YXRlIHx8IGIuaiA/IHBJKGIsIG5ldyBkdignc3RhdGUgZXJyICgnICsgKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuc3RhdGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLmoubGVuZ3RoCiAgICAgICAgICAgICAgICAgICAgICAgIF0uam9pbigpICsgJyknKSkpIDogKGIuc3RhdGUgPSAzLCBiLkEoYi5tLCBiLmNhLCBiLmxhKSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGwpIHsKICAgICAgICAgICAgICAgICAgICBwSShiLCBsKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHNJID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA5MTgpOwogICAgICAgICAgICAgICAgdGhpcy5MID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuV2EgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5DID0gcXYodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBWKHRoaXMsIGQpOwogICAgICAgICAgICAgICAgc3YodGhpcywgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhzSSwgWSk7CiAgICAgICAgICAgIHNJLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLmwudmFsdWU7CiAgICAgICAgICAgICAgICBhLmxlbmd0aCAmJiBjdih0aGlzLldhLCAnMycsICgwLCBGLkgpKEcodGhpcy5MLlBbYVswXS5nZXREb21JZCgpXSwgMjApKSk7CiAgICAgICAgICAgICAgICB0aGlzLkMubm90aWZ5KCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB0SSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODIwKTsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBVKHRoaXMpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8odEksIFkpOwogICAgICAgICAgICB0SS5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiwgYywgZDsKICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IGUuaikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8uSChDdCkgPyBqYihlLCBhZShhLkkpLCAyKSA6IChhLkMuaignJyksIGUucmV0dXJuKCkpOwogICAgICAgICAgICAgICAgICAgIGIgPSBlLm07CiAgICAgICAgICAgICAgICAgICAgYyA9IGIubmI7CiAgICAgICAgICAgICAgICAgICAgZCA9IGIuc3RhdHVzOwogICAgICAgICAgICAgICAgICAgIGMgfHwgb2YoJ2dwdF9ldHUnLCBmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICBkZihmKTsKICAgICAgICAgICAgICAgICAgICAgICAgSShmLCAncnNuJywgZCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgYS5DLmoobnVsbCAhPT0gYyAmJiB2b2lkIDAgIT09IGMgPyBjIDogJycpOwogICAgICAgICAgICAgICAgICAgIExtKGUpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB1SSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODU4KTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkMgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMubCA9IFYodGhpcywgYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyh1SSwgWSk7CiAgICAgICAgICAgIHVJLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiLCBjLCBkLCBlLCBmLCBnLCBoOwogICAgICAgICAgICAgICAgcmV0dXJuIGliKGZ1bmN0aW9uIChrKSB7CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChrLmopIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIGsuRiA9IDI7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChMQigpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQgPSAhSUIoKSAmJiBfLkgoWHQpIHx8IElCKCkgJiYgXy5IKFl0KSwgZSA9IF8uSCgkdCksIGYgPSBuZXcgSEIoISFFKGEubC52YWx1ZSwgNSksIGQsIGUpLCBqYihrLCBUQihmKSwgNyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBfLmJmWzI1OF07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqYihrLCBjLCA2KTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgIGEuQy5ub3RpZnkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgay5qID0gNTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICBhLkMubm90aWZ5KCk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA1OgogICAgICAgICAgICAgICAgICAgICAgICBfLkgoYnUpICYmIChnID0gbnVsbCA9PT0gKGIgPSBhLm8pIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IEUoYiwgOSkpICYmICFMQigpICYmIEJjKHsgbWM6ICcxJyB9LCAnZ3B0dHRtYycpOwogICAgICAgICAgICAgICAgICAgICAgICBsYihrLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICBoID0gbWIoayksIGggaW5zdGFuY2VvZiBFcnJvciAmJiBhLlIoaCksIGEuQy5ub3RpZnkoKSwgTG0oayk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB3SSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmLCBnLCBoLCBrLCBsKSB7CiAgICAgICAgICAgICAgICB2YXIgbSA9IGdjLmFwcGx5KDEwLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDgxNCk7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkwgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5LID0gYzsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IGQ7CiAgICAgICAgICAgICAgICB0aGlzLmxhID0gZTsKICAgICAgICAgICAgICAgIHRoaXMubWEgPSBnOwogICAgICAgICAgICAgICAgdGhpcy5XID0gaDsKICAgICAgICAgICAgICAgIHRoaXMuSSA9IGs7CiAgICAgICAgICAgICAgICB0aGlzLkcgPSBsOwogICAgICAgICAgICAgICAgdGhpcy5sID0gcXYodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBXKHRoaXMsIGwuTmMpOwogICAgICAgICAgICAgICAgdGhpcy5uYyA9IFcodGhpcywgbC5NYyk7CiAgICAgICAgICAgICAgICBtID0gXy55KG0pOwogICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IG0ubmV4dCgpOyAhbi5kb25lOyBuID0gbS5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgc3YodGhpcywgbi52YWx1ZSk7CiAgICAgICAgICAgICAgICBRQyh0aGlzLnNsb3RJZCwgVkMsIHZJKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHdJLCBZKTsKICAgICAgICAgICAgd0kucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBpZiAoISh0aGlzLkIgfHwgdGhpcy5vLnZhbHVlIHx8IF8uSChYcykgJiYgdGhpcy5uYy52YWx1ZSkpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGprKHRoaXMuc2xvdElkLCB0aGlzLkssIHRoaXMuTCwgdGhpcy5HLCB0aGlzLlcsIHRoaXMubGEsIHRoaXMubWEpLCBiLCBjID0gdGhpcy5LLmouZ2V0KHRoaXMuc2xvdElkKTsKICAgICAgICAgICAgICAgICAgICBjICYmIChudWxsID09PSAoYiA9IGMueGMpIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIudWEoKSwgYy54YyA9IGEpOwogICAgICAgICAgICAgICAgICAgIFNjKGEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpcy5sLm5vdGlmeSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgdkkgPSBfLlZuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIEdnKCdncHQtZmlyc3QtYWQtcmVuZGVyJyk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgeUkgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDgwNCk7CiAgICAgICAgICAgICAgICB0aGlzLkRhID0gYjsKICAgICAgICAgICAgICAgIHRoaXMubyA9IFtdOwogICAgICAgICAgICAgICAgdGhpcy5tZXRhZGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICB3ZjogeEkodGhpcywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEcoYywgWWIoYywgb3EsIDQpKTsKICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICBvYjogeEkodGhpcywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuZ2V0SGVpZ2h0KCk7CiAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgdGI6IHhJKHRoaXMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmdldFdpZHRoKCk7CiAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgTmM6IHhJKHRoaXMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFKGMsIDgpOwogICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgIEdkOiB4SSh0aGlzLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRyhjLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgeGY6IHhJKHRoaXMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPaChjLCAxNSk7CiAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgYWM6IHhJKHRoaXMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmdldEVzY2FwZWRRZW1RdWVyeUlkKCk7CiAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgbGQ6IHhJKHRoaXMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXYihjLCBacCwgNDMpOwogICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgIHlkOiB4SSh0aGlzLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gV2IoYywgbnEsIFliKGMsIG9xLCA0MSkpOwogICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgIE1kOiB4SSh0aGlzLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRShjLCA5KTsKICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICB5ZTogeEkodGhpcywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEUoYywgMTIpOwogICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgIEhkOiB4SSh0aGlzLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gV2IoYywgTXAsIFliKGMsIHBxLCA0OCkpOwogICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgIERkOiB4SSh0aGlzLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gV2IoYywgS3AsIFliKGMsIHBxLCAzOSkpOwogICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgIHdiOiB4SSh0aGlzLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRyhjLCAzNik7CiAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgemU6IHhJKHRoaXMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFKGMsIDEzKTsKICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICBNYzogeEkodGhpcywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEUoYywgMyk7CiAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgeGU6IHhJKHRoaXMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBHKGMsIDQ5KTsKICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICBDZTogeEkodGhpcywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEcoYywgMjkpOwogICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgIERlOiB4SSh0aGlzLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRyhjLCAzMCk7CiAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgS2Q6IHhJKHRoaXMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXYihjLCBicSwgNTEpOwogICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgIEFlOiB4SSh0aGlzLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRShjLCA1Mik7CiAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgeWI6IHhJKHRoaXMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBHKGMsIDYxKTsKICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICBCZDogeEkodGhpcywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChjID0gV2IoYywgWXAsIDU0KSkgPyBVYihjLCBXcCwgMSkuZmlsdGVyKGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsayhkLCAxKSB8fCBFYygzMiwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhbGsoZCwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLm1hcChmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBsayhkLCAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR2E6IGxrKGQsIDEpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNkOiBlICYmIChfLnQoZSwgJ3N0YXJ0c1dpdGgnKS5jYWxsKGUsIHdpbmRvdy5sb2NhdGlvbi5wcm90b2NvbCkgfHwgXy50KGUsICdzdGFydHNXaXRoJykuY2FsbChlLCAnZGF0YTonKSAmJiA0MCA+PSBlLmxlbmd0aCkgPyBRYShlKSA6IHZvaWQgMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBbXTsKICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICBCZjogeEkodGhpcywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9oKGMsIDIzKTsKICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICB2ZjogeEkodGhpcywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFViKGMsICRwLCAxNCk7CiAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgSmY6IHhJKHRoaXMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFKGMsIDExKTsKICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICBIZjogeEkodGhpcywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEcoYywgMzMpOwogICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgIHJmOiB4SSh0aGlzLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2goYywgMjcpOwogICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgIGphOiBVKHRoaXMpLAogICAgICAgICAgICAgICAgICAgIHZlOiB4SSh0aGlzLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gV2IoYywgZHEsIDU1KTsKICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICB1ZTogeEkodGhpcywgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFdiKGMsIGtxLCA1OCk7CiAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgRWU6IHhJKHRoaXMsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkLCBlOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gKGUgPSBudWxsID09PSAoZCA9IFdiKGMsIGFxLCA1NikpIHx8IHZvaWQgMCA9PT0gZCA/IHZvaWQgMCA6IEcoZCwgMSkpICYmIHZvaWQgMCAhPT0gZSA/IGUgOiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgIGJlOiB4SSh0aGlzLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChkID0gVWIoYywgZXEsIDYyKSkgJiYgdm9pZCAwICE9PSBkID8gZCA6IFtdOwogICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdGhpcy5sID0gVih0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKHlJLCBZKTsKICAgICAgICAgICAgdmFyIHhJID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gVShhKTsKICAgICAgICAgICAgICAgIGEuby5wdXNoKHsKICAgICAgICAgICAgICAgICAgICBDOiBjLAogICAgICAgICAgICAgICAgICAgIENkOiBiCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICB5SS5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSBfLnkodGhpcy5vKSwgYiA9IGEubmV4dCgpOyAhYi5kb25lOyBiID0gYS5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICBiID0gYi52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGIuQ2Q7CiAgICAgICAgICAgICAgICAgICAgYi5DLmZhKGModGhpcy5sLnZhbHVlKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAwID09PSB0aGlzLkRhLmtpbmQgfHwgMSA9PT0gdGhpcy5EYS5raW5kICYmIHRoaXMuRGEudXJsID8gdGhpcy5tZXRhZGF0YS5qYS5qKHRoaXMuRGEpIDogKGEgPSB0aGlzLm1ldGFkYXRhLmphLCBiID0gYS5qLCBjID0gdGhpcy5sLnZhbHVlLCBjID0gRyhjLCBZYihjLCBvcSwgNCkpLCBiLmNhbGwoYSwgewogICAgICAgICAgICAgICAgICAgIGtpbmQ6IDAsCiAgICAgICAgICAgICAgICAgICAgd2E6IGMgfHwgJycKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHpJID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIFkuY2FsbCh0aGlzLCA4MjIpOwogICAgICAgICAgICAgICAgdGhpcy5zbG90SWQgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5sID0gcXYodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBWKHRoaXMsIGIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oekksIFkpOwogICAgICAgICAgICB6SS5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGEsIGIgPSBudWxsICE9PSAoYSA9IE9oKHRoaXMuby52YWx1ZSwgMjMpKSAmJiB2b2lkIDAgIT09IGEgPyBhIDogW10sIGMgPSBfLkhnKFRpKSwgZCA9IF8ueShiKSwgZSA9IGQubmV4dCgpOyAhZS5kb25lOyBlID0gZC5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgZSA9IGUudmFsdWUsIEVGKGMsIGUpLCBGRihjLCBlLCB0aGlzLnNsb3RJZCk7CiAgICAgICAgICAgICAgICB0aGlzLmwubm90aWZ5KCk7CiAgICAgICAgICAgICAgICBiLmxlbmd0aCAmJiBvZignZ3B0X2hwJywgZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICBkZihmKTsKICAgICAgICAgICAgICAgICAgICBJKGYsICdscycsIGIuam9pbigpKTsKICAgICAgICAgICAgICAgIH0sIHsgcGE6IF8uemMoRXMpIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQUkgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDgwMyk7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5zbG90SWQgPSBiOwogICAgICAgICAgICAgICAgdGhpcy5DID0gVSh0aGlzKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEFJLCBZKTsKICAgICAgICAgICAgQUkucHJvdG90eXBlLmogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSwgYiA9IEpTT04ucGFyc2UodGhpcy5sKSwgYyA9IGIgPyBNZyhiLCBUbikgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICBpZiAoIWMpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ21pc3NpbmcgYWQgdW5pdCBwYXRoJyk7CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gYiB8fCB2b2lkIDAgPT09IGIgfHwgIWJbY10pCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ2ludmFsaWQgYWQgdW5pdCBwYXRoOiAnICsgYyk7CiAgICAgICAgICAgICAgICBiID0gYltjXTsKICAgICAgICAgICAgICAgIGlmICghQXJyYXkuaXNBcnJheShiKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignZGljdGlvbmFyeSBub3QgYW4gYXJyYXk6ICcgKyB0aGlzLmwpOwogICAgICAgICAgICAgICAgYiA9IG5ldyBtcShiLnNsaWNlKCkpOwogICAgICAgICAgICAgICAgYyA9IF8ueShudWxsICE9PSAoYSA9IE9oKGIsIDI3KSkgJiYgdm9pZCAwICE9PSBhID8gYSA6IFtdKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSBjLm5leHQoKTsgIWQuZG9uZTsgZCA9IGMubmV4dCgpKQogICAgICAgICAgICAgICAgICAgIGQgPSBkLnZhbHVlLCBEYygpLkYoZCk7CiAgICAgICAgICAgICAgICBEYygpLmooNCk7CiAgICAgICAgICAgICAgICB0aGlzLnNsb3RJZC5kaXNwYXRjaEV2ZW50KFNDLCA4MDAsIGIpOwogICAgICAgICAgICAgICAgdGhpcy5DLmooYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBCSSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBZLmNhbGwodGhpcywgODIzKTsKICAgICAgICAgICAgICAgIHRoaXMuc2xvdElkID0gYTsKICAgICAgICAgICAgICAgIHRoaXMuTCA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLksgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5sID0gcXYodGhpcyk7CiAgICAgICAgICAgICAgICB0aGlzLm8gPSBWKHRoaXMsIGQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oQkksIFkpOwogICAgICAgICAgICBCSS5wcm90b3R5cGUuaiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgYiA9IHRoaXMuTC5QW3RoaXMuc2xvdElkLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBiICYmICg0ID09PSBOZihiKSB8fCA1ID09PSBOZihiKSB8fCBFKHRoaXMuby52YWx1ZSwgMTEpKSAmJiAoXy5CRCh0aGlzLkssIHRoaXMuc2xvdElkKSwgeEQodGhpcy5LLCB0aGlzLnNsb3RJZCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBfLkNEKGEuSywgYS5zbG90SWQpOwogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sLm5vdGlmeSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQ0kgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgWS5jYWxsKHRoaXMsIDgyMSk7CiAgICAgICAgICAgICAgICB0aGlzLmxhID0gYTsKICAgICAgICAgICAgICAgIHRoaXMubyA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBxdih0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IFYodGhpcywgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIF8uTyhDSSwgWSk7CiAgICAgICAgICAgIENJLnByb3RvdHlwZS5qID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXMubGEgJiYgRSh0aGlzLmxhLCA1KSkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IHYuU2V0KCksIGIgPSBVYih0aGlzLkIudmFsdWUsICRwLCAxNCk7CiAgICAgICAgICAgICAgICAgICAgYiA9IF8ueShiKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gYi5uZXh0KCk7ICFjLmRvbmU7IGMgPSBiLm5leHQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICBjID0gYy52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBjLmdldFZlcnNpb24oKSB8fCAxOwogICAgICAgICAgICAgICAgICAgICAgICAxID09PSBkID8gYS5oYXMoMSkgfHwgKGZ3KHRoaXMubywgJ19fZ2FkcycsIGMsIHRoaXMubGEpLCBhLmFkZChkKSkgOiBfLkgoV3MpICYmIDIgPT09IGQgJiYgIWEuaGFzKDIpICYmICcxJyAhPT0gZHcodGhpcy5vLCAnX19ncGlfb3B0X291dCcsIHRoaXMubGEpICYmIChmdyh0aGlzLm8sICdfX2dwaScsIGMsIHRoaXMubGEpLCBhLmFkZChkKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpcy5sLm5vdGlmeSgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgREkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gbmV3IHYuTWFwKCk7CiAgICAgICAgICAgICAgICB9LCBISSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmLCBnLCBoLCBrLCBsLCBtKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBkb2N1bWVudCwgcSA9IHdpbmRvdywgdSA9ICsrZS5vOwogICAgICAgICAgICAgICAgICAgIEVJKGEsIHUsIGIsIGUsIGQpLnRoZW4oXy5tZig4NzIsIGZ1bmN0aW9uIChCKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBCICYmIHZvaWQgMCAhPT0gQiAmJiBCLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgRUQoZSwgdSwgQi5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgQiA9IF8ueShCKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHggPSBCLm5leHQoKTsgIXguZG9uZTsgeCA9IEIubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZJKGEsIHUsIHgudmFsdWUsIGQsIGYsIG4sIGUsIHEpLnRoZW4oXy5tZig5MDcsIGZ1bmN0aW9uICh6KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh6KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgQyA9IHouY2E7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB6ID0gei5sYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBEID0gYy5DYSwgSiA9IGMuUWEgfHwgTmFOLCBUID0gYy5QYSB8fCBOYU4sIGFhID0gbnVsbCwgWCA9IG51bGwsIFMgPSArK2UuRCwgY2EgPSB3aW5kb3cuaXNTZWN1cmVDb250ZXh0ICYmIF8uSChIdCkgPyAnd2JuJyA6ICdsZGpoJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnd2JuJyA9PT0gY2EpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhYSA9IEFycmF5KDM2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBYID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBrYSwgZWEgPSAwOyAzNiA+IGVhOyBlYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4ID09IGVhIHx8IDEzID09IGVhIHx8IDE4ID09IGVhIHx8IDIzID09IGVhID8gYWFbZWFdID0gJy0nIDogMTQgPT0gZWEgPyBhYVtlYV0gPSAnNCcgOiAoMiA+PSBYICYmIChYID0gMzM1NTQ0MzIgKyAxNjc3NzIxNiAqIE1hdGgucmFuZG9tKCkgfCAwKSwga2EgPSBYICYgMTUsIFggPj49IDQsIGFhW2VhXSA9IHpHWzE5ID09IGVhID8ga2EgJiAzIHwgOCA6IGthXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWEgPSBlaSgndXJuOnV1aWQ6JyArIGFhLmpvaW4oJycpLnRvTG93ZXJDYXNlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFggPSAnZ29vZ2xldGFnLndibicgKyBTOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR0koYSwgdSwgQywgZSwgY2EsIHosIGQsIGYsICEhRShkLlUsIDYpLCBELCBKLCBULCBEYygpLm0oKSwgUGUoQ1swXS5nZXRBZFVuaXRQYXRoKCkpLCBhYSwgWCwgbiwgcSwgZywgaCwgaywgbCwgbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICB9LCBFSSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBWZSgnZ29vZ2xlX25vZmV0Y2gnKSwgZywgaCwgaywgbCwgbTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaWIoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDEgPT0gbi5qID8gKGcgPSBuZXcgUWMoKSwgKDAsIEYuamIpKCFhLmouaGFzKGIpKSwgYS5qLnNldChiLCBnKSwgaCA9IG5ldyBXSChjKSwgTihnLCBoKSwgayA9IG5ldyBlSShlLlAsIGgubyksIE4oZywgayksIGwgPSBuZXcgY0koZCwgISFFKGUuVSwgNiksIGYsIGsubCksIE4oZywgbCksIG0gPSBuZXcgaEkoZCwgZSwgZG9jdW1lbnQsIGsubyksIE4oZywgbSksIFNjKGcpLCBqYihuLCBtLmwucHJvbWlzZSwgMikpIDogbi5yZXR1cm4obC5sLnByb21pc2UpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgRkkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZywgaCkgewogICAgICAgICAgICAgICAgICAgIHZhciBrLCBsOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAobSkgewogICAgICAgICAgICAgICAgICAgICAgICBrID0gbmV3IFFjKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uaHUoKDAsIEYuSCkoYS5qLmdldChiKSksIGspOwogICAgICAgICAgICAgICAgICAgICAgICBsID0gbmV3IG1IKGQsIGgsIGMsIGUsIGYsIGcpOwogICAgICAgICAgICAgICAgICAgICAgICBOKGssIGwpOwogICAgICAgICAgICAgICAgICAgICAgICBTYyhrKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0ucmV0dXJuKGwubC5wcm9taXNlKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIEdJID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYsIGcsIGgsIGssIGwsIG0sIG4sIHEsIHUsIEIsIHgsIHosIEMsIEQsIEosIFQsIGFhLCBYKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIFMsIGNhLCBrYSwgZWEsIHhhLCBoYiwgUGEsIERiLCBpYywga2gsIGpjLCB0YiwgbmIsIEVkLCBuaSwgbG4sIG1uLCBHdSwgbm4sIExlLCBvbiwgcG4sIHFuLCBybiwgc24sIHRuLCBIdTsKICAgICAgICAgICAgICAgICAgICBpYihmdW5jdGlvbiAoQ0spIHsKICAgICAgICAgICAgICAgICAgICAgICAgUyA9IG5ldyBRYygpOwogICAgICAgICAgICAgICAgICAgICAgICBfLmh1KCgwLCBGLkgpKGEuai5nZXQoYikpLCBTKTsKICAgICAgICAgICAgICAgICAgICAgICAgY2EgPSBuZXcgdmooKTsKICAgICAgICAgICAgICAgICAgICAgICAgY2EuaihmKTsKICAgICAgICAgICAgICAgICAgICAgICAga2EgPSBuZXcgYkkoQyk7CiAgICAgICAgICAgICAgICAgICAgICAgIE4oUywga2EpOwogICAgICAgICAgICAgICAgICAgICAgICBlYSA9IG5ldyAkSChjLCBrLCBnLCBMaCgpLCBDLCBjYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIE4oUywgZWEpOwogICAgICAgICAgICAgICAgICAgICAgICB4YSA9IG5ldyB0SShDKTsKICAgICAgICAgICAgICAgICAgICAgICAgTihTLCB4YSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGhiID0gbmV3IGFJKGQpOwogICAgICAgICAgICAgICAgICAgICAgICBOKFMsIGhiKTsKICAgICAgICAgICAgICAgICAgICAgICAgUGEgPSBuZXcgdUkoaWwoZy5VKSwgY2EpOwogICAgICAgICAgICAgICAgICAgICAgICBOKFMsIFBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgRGIgPSAoMCwgRi5IKShfLkhnKElnKS5EKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWMgPSAoMCwgRi5IKShfLkhnKElnKS5BKTsKICAgICAgICAgICAgICAgICAgICAgICAga2ggPSAoMCwgRi5IKShfLkhnKElnKS5GKTsKICAgICAgICAgICAgICAgICAgICAgICAgamMgPSBuZXcgVUcoZWEubCwgZy5QLCBpYywgdSwgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIE4oUywgamMpOwogICAgICAgICAgICAgICAgICAgICAgICB0YiA9IG5ldyBYSChxLCBraCwgRGIpOwogICAgICAgICAgICAgICAgICAgICAgICBOKFMsIHRiKTsKICAgICAgICAgICAgICAgICAgICAgICAgbmIgPSBuZXcgbkkoaywgZCwgaCwgZywgZSwgbCwgbSwgbiwgdGIuQywgQiwgeCwgY2EsIGthLmwsIHhhLkMsIGVhLmwsIGhiLkMsIFBhLkMsIGpjLkMpOwogICAgICAgICAgICAgICAgICAgICAgICBOKFMsIG5iKTsKICAgICAgICAgICAgICAgICAgICAgICAgRWQgPSBuZXcgc0koZywgUmUuTygpLCBuYi5sLCBlYS5sKTsKICAgICAgICAgICAgICAgICAgICAgICAgTihTLCBFZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIG5pID0gbmV3IGZJKGlsKGcuVSksIGNhKTsKICAgICAgICAgICAgICAgICAgICAgICAgTihTLCBuaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGxuID0gXy5tZig2NDYsIGZ1bmN0aW9uIChSYiwgTWUsIHVuLCBvaSwgZWcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBOZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBJSShlZywgZywgUmIsIE1lLCB1biwgb2ksIGQsIGgsIEosIFgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPCBSYiAmJiBfLkgoeHMpID8gc2V0VGltZW91dChOZSwgMCkgOiBOZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgbW4gPSBfLm1mKDY0NywgZnVuY3Rpb24gKFJiLCBNZSwgdW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvaSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZWcgPSBSYiArIDEsIE5lID0gTWUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChELkJjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBTYiA9IEQuc2IsIFpkID0gR2soRCksIERLID0gbmV3IHR1KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVnID0gUWIoREssIDEsIGVnLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTmUgPSBRYihlZywgMiwgTmUsIDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBaZCA9IEVlKFpkLCA4LCBLaywgTmUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYyhTYiwgWmQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKFNiID0gUmIgKyAxOyBTYiA8IE1lLmxlbmd0aDsgKytTYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWVbU2JdICYmIChaZCA9IG5ldyBtcSgpLCBaZCA9ICd7ImVtcHR5IjonICsgdyhaZCwgOCwgITApLlgoKSArICd9JywgSUkodW4sIGcsIFNiLCBaZCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2luZDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdhOiAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBNZSwgZCwgaCwgSiwgWCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNiID0gKDAsIEYuSCkoZC5tLmdldChiKSkgLSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPT09IFNiID8gZC5tLmRlbGV0ZShiKSA6IGQubS5zZXQoYiwgU2IpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPT09IFNiICYmIChTYiA9IGEuai5nZXQoYikpICYmIChhLmouZGVsZXRlKGIpLCBTYi51YSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfLkgoeHMpID8gc2V0VGltZW91dChvaSwgMCkgOiBvaSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgR3UgPSBmdW5jdGlvbiAoUmIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJiID0gUmIgaW5zdGFuY2VvZiBFcnJvciA/IFJiIDogRXJyb3IoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJiLm1lc3NhZ2UgPSBSYi5tZXNzYWdlIHx8ICdzdHJtX2Vycic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZigyODksIFJiKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgbm4gPSBfLm1mKDI4OSwgR3UpOwogICAgICAgICAgICAgICAgICAgICAgICBMZSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICdsZGpoJyA9PT0gZSA/IExlID0gbmV3IHFJKGxuLCBubiwgbW4sIGVhLmwsIG5iLmwsIEVkLkMsIG5pLkMsIGNhKSA6IExlID0gbmV3IFlIKGxuLCBubiwgbW4sIGUsICgwLCBGLkgpKHgpLCAoMCwgRi5IKShCKSwgeiwgZWEubCwgbmIubCwgRWQuQywgbmkuQywgY2EpOwogICAgICAgICAgICAgICAgICAgICAgICBOKFMsIExlKTsKICAgICAgICAgICAgICAgICAgICAgICAgb24gPSBuZXcgbEkoZCwgRCwgZWEubCwgTGUuQyk7CiAgICAgICAgICAgICAgICAgICAgICAgIE4oUywgb24pOwogICAgICAgICAgICAgICAgICAgICAgICBwbiA9IG5ldyBUSChkLCBnLCBoLCBlLCBrLCBsLCBtLCBuLCB0Yi5DLCBCLCB4LCBuYi5sLCBlYS5sLCBrYS5sLCBoYi5DLCBuYi5HLCBuYi5OLCBuYi5WLCBqYy5DLCBvbi5DKTsKICAgICAgICAgICAgICAgICAgICAgICAgTihTLCBwbik7CiAgICAgICAgICAgICAgICAgICAgICAgIHFuID0gbmV3IG1JKEosIGcsIHBuLkMpOwogICAgICAgICAgICAgICAgICAgICAgICBOKFMsIHFuKTsKICAgICAgICAgICAgICAgICAgICAgICAgcm4gPSBuZXcga0koZSwgVCwgQywgcW4uQyk7CiAgICAgICAgICAgICAgICAgICAgICAgIE4oUywgcm4pOwogICAgICAgICAgICAgICAgICAgICAgICBzbiA9IG5ldyBqSShnLCBhYSwgZWEubCwgcm4uQyk7CiAgICAgICAgICAgICAgICAgICAgICAgIE4oUywgc24pOwogICAgICAgICAgICAgICAgICAgICAgICB0biA9IG5ldyBnSShkLCBnLCB6LCBlYS5sLCBzbi5DKTsKICAgICAgICAgICAgICAgICAgICAgICAgTihTLCB0bik7CiAgICAgICAgICAgICAgICAgICAgICAgIEh1ID0gbmV3IGlJKENjKEMpLCBXZSgpLCBDLCBjYSwgTGUuQyk7CiAgICAgICAgICAgICAgICAgICAgICAgIE4oUywgSHUpOwogICAgICAgICAgICAgICAgICAgICAgICBTYyhTKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGpiKENLLCB0bi5DLnByb21pc2UsIDApOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgSUkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZywgaCwgaywgbCkgewogICAgICAgICAgICAgICAgICAgIHZhciBtLCBuOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAocSkgewogICAgICAgICAgICAgICAgICAgICAgICBtID0gZltjXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFtKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJmKDY0NiwgRXJyb3IoJ21pc3Npbmcgc2xvdCcpKSwgcS5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgMCA9PT0gYyAmJiAobiA9ICgwLCBGLkgpKEcoYi5QW20uZ2V0RG9tSWQoKV0sIDIwKSksIGN2KFJlLk8oKSwgJzQnLCBuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqYihxLCBKSShtLCBkLCBlLCBnLCBiLCBhLCBoLCBrLCBsKSwgMCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBKSSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlLCBmLCBnLCBoLCBrKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGwsIG0sIG4sIHEsIHUsIEIsIHgsIHosIEMsIEQsIEosIFQsIGFhLCBYOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBpYihmdW5jdGlvbiAoUykgewogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKFMuaikgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gVmUoJ2dvb2dsZV9ub3JlbmRlcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcSA9IF8uSChidCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gbmV3IFFjKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBCID0gbmV3IEFJKGIsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgTih1LCBCKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggPSBuZXcgQ0koZiwgZywgQi5DKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE4odSwgeCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB6ID0gbmV3IHpJKGEsIEIuQyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBOKHUsIHopOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgQyA9IG5ldyBCSShhLCBlLCBkLCBCLkMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgTih1LCBDKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEQgPSBuZXcgeUkoQi5DLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE4odSwgRCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBKID0gRC5tZXRhZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUID0gbmV3IHdJKGEsIGUsIGQsIG4sIGYsIGcsIGgsIGRvY3VtZW50LCB3aW5kb3csIEosIHgubCwgei5sLCBDLmwpLCBOKHUsIFQpLCBTYyh1KSwgamIoUywgVC5sLnByb21pc2UsIDMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgU2ModSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamIoUywgdi5Qcm9taXNlLmFsbChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeC5sLnByb21pc2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgei5sLnByb21pc2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQy5sLnByb21pc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCAzKTsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubSA/IFMucmV0dXJuKCkgOiBqYihTLCBKLk5jLnByb21pc2UsIDYpOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYWEgPSBudWxsICE9PSAobCA9IFMubSkgJiYgdm9pZCAwICE9PSBsID8gbCA6ICExLCBqYihTLCBKLmFjLnByb21pc2UsIDcpOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBYID0gbnVsbCAhPT0gKG0gPSBTLm0pICYmIHZvaWQgMCAhPT0gbSA/IG0gOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYWEgJiYgIW4gfHwgXy5IKGN0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBxIHx8IFRHKGssIGEsIGQsIGUsIEosIGYsIGgsIGFhIHx8IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGNhID0gcmcoYSwgZG9jdW1lbnQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhICYmIEtkKGNhLCB3aW5kb3csIFgsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdihSZS5PKCksICc1JywgKDAsIEYuSCkoRyhlLlBbYS5nZXREb21JZCgpXSwgMjApKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5kaXNwYXRjaEV2ZW50KFRDLCA4MDEsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJGI6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQmFja2ZpbGw6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGthOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChfLkFEKGQsIGEpICYmICFCZyhhLCBkb2N1bWVudCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2EgPSBlLlU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlYSA9IGUuUFthLmdldERvbUlkKCldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobnVsbCAhPT0gKGthID0gRShlYSwgMTApKSAmJiB2b2lkIDAgIT09IGthID8ga2EgOiBFKGNhLCAxMSkpICYmIHBpKGEsIGRvY3VtZW50LCBlYSwgY2EpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmRpc3BhdGNoRXZlbnQoVkMsIDgyNSwgeyBpc0VtcHR5OiAhMCB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUudWEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTLnJldHVybigpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgS0kgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgckYuY2FsbCh0aGlzKTsKICAgICAgICAgICAgICAgIHRoaXMuY29udGV4dCA9IGE7CiAgICAgICAgICAgICAgICB0aGlzLkQgPSBuZXcgdi5TZXQoKTsKICAgICAgICAgICAgICAgIHRoaXMuQiA9IHt9OwogICAgICAgICAgICAgICAgdGhpcy5LID0gdUQuTygpOwogICAgICAgICAgICAgICAgdGhpcy5hYSA9IG5ldyBESSgpOwogICAgICAgICAgICAgICAgdGhpcy5UID0gbmV3IFFHKCk7CiAgICAgICAgICAgICAgICB0aGlzLkogPSBuZXcgY3cod2luZG93KTsKICAgICAgICAgICAgICAgIHRoaXMuViA9IF8uSGcoaEcpOwogICAgICAgICAgICAgICAgdGhpcy5OID0gXy5lRy5PKCk7CiAgICAgICAgICAgICAgICBfLkgoVXQpICYmIG5ldyBiRyh0aGlzKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEtJLCByRik7CiAgICAgICAgICAgIEtJLnByb3RvdHlwZS5nZXROYW1lID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICdwdWJsaXNoZXJfYWRzJzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgS0kucHJvdG90eXBlLmRpc3BsYXkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/ICcnIDogYzsKICAgICAgICAgICAgICAgIGQgPSB2b2lkIDAgPT09IGQgPyAnJyA6IGQ7CiAgICAgICAgICAgICAgICB2YXIgZSA9ICcnOwogICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgaWYgKF8uamEoYykgJiYgMSA9PSBjLm5vZGVUeXBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGYuaWQ7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBjOwogICAgICAgICAgICAgICAgdGhpcy5lbmFibGUoKTsKICAgICAgICAgICAgICAgIHZhciBnID0gSWwoYSwgYiwgZSksIGggPSBnLnNsb3RJZDsKICAgICAgICAgICAgICAgIGcgPSBnLkphOwogICAgICAgICAgICAgICAgaCAmJiBnID8gKGYgJiYgIWUgJiYgKGYuaWQgPSBoLmdldERvbUlkKCkpLCB0aGlzLkthKGgsIGcpLCBnLnNldENsaWNrVXJsKGQpLCBTaChudWxsICE9PSBmICYmIHZvaWQgMCAhPT0gZiA/IGYgOiBoLmdldERvbUlkKCkpKSA6IE0odGhpcy5sb2csIFdnKCdQdWJBZHNTZXJ2aWNlLmRpc3BsYXknLCBbCiAgICAgICAgICAgICAgICAgICAgYSwKICAgICAgICAgICAgICAgICAgICBiLAogICAgICAgICAgICAgICAgICAgIGMKICAgICAgICAgICAgICAgIF0pKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE1JID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHZhciBkID0gdm9pZCAwID09PSBkID8gZG9jdW1lbnQgOiBkOwogICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICBudWxsID09PSAoZSA9IGMuUFtiLmdldERvbUlkKCldKSB8fCB2b2lkIDAgPT09IGUgPyB2b2lkIDAgOiB3KGUsIDE5LCAhMCk7CiAgICAgICAgICAgICAgICB2YXIgZiA9IHsgaWQ6IEZxKGIuZ2V0RG9tSWQoKSkgfTsKICAgICAgICAgICAgICAgIGNiKGQsIHRkKGYpKTsKICAgICAgICAgICAgICAgIHJnKGIsIGQpID8gKGEuZW5hYmxlKCksIHpEKGEuSywgYiksIExJKGEsIGMsIGIpKSA6IG9mKCdncHRfcGJfd3JpdGUnLCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIGRmKGcpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEtJLnByb3RvdHlwZS5LYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IHRoaXM7CiAgICAgICAgICAgICAgICBFKGIsIDE3KSB8fCB0aGlzLkEgJiYgekQodGhpcy5LLCBhKTsKICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChXQywgNzI0LCB7CiAgICAgICAgICAgICAgICAgICAgQ2M6IGEuZ2V0RG9tSWQoKSwKICAgICAgICAgICAgICAgICAgICBQOiBiCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIFFDKGEsIFZDLCBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZC5kZXRhaWw7CiAgICAgICAgICAgICAgICAgICAgZCA9IGUuc2l6ZTsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGUuaXNFbXB0eTsKICAgICAgICAgICAgICAgICAgICBlID0gbmV3IGRGKGEsICdwdWJsaXNoZXJfYWRzJyk7CiAgICAgICAgICAgICAgICAgICAgZiAmJiAoZS5pc0VtcHR5ID0gZik7CiAgICAgICAgICAgICAgICAgICAgZiA9IGEuai5nZXRSZXNwb25zZUluZm9ybWF0aW9uKCk7CiAgICAgICAgICAgICAgICAgICAgZCAmJiBmICYmIChlLnNpemUgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIGQud2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgIGQuaGVpZ2h0CiAgICAgICAgICAgICAgICAgICAgXSwgZS5zb3VyY2VBZ25vc3RpY0NyZWF0aXZlSWQgPSBmLnNvdXJjZUFnbm9zdGljQ3JlYXRpdmVJZCwgZS5zb3VyY2VBZ25vc3RpY0xpbmVJdGVtSWQgPSBmLnNvdXJjZUFnbm9zdGljTGluZUl0ZW1JZCwgZS5pc0JhY2tmaWxsID0gZi5pc0JhY2tmaWxsLCBlLmNyZWF0aXZlSWQgPSBmLmNyZWF0aXZlSWQsIGUubGluZUl0ZW1JZCA9IGYubGluZUl0ZW1JZCwgZS5jcmVhdGl2ZVRlbXBsYXRlSWQgPSBmLmNyZWF0aXZlVGVtcGxhdGVJZCwgZS5hZHZlcnRpc2VySWQgPSBmLmFkdmVydGlzZXJJZCwgZS5jYW1wYWlnbklkID0gZi5jYW1wYWlnbklkLCBlLnlpZWxkR3JvdXBJZHMgPSBmLnlpZWxkR3JvdXBJZHMsIGUuY29tcGFueUlkcyA9IGYuY29tcGFueUlkcyk7CiAgICAgICAgICAgICAgICAgICAgYy5kaXNwYXRjaEV2ZW50KCdzbG90UmVuZGVyRW5kZWQnLCA3MDgsIGUpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBRQyhhLCBTQywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGMuZGlzcGF0Y2hFdmVudCgnc2xvdFJlc3BvbnNlUmVjZWl2ZWQnLCA3MDksIG5ldyBvRihhLCBjLmdldE5hbWUoKSkpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICByRi5wcm90b3R5cGUuS2EuY2FsbCh0aGlzLCBhLCBiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgS0kucHJvdG90eXBlLlIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdGhpcy5lbmFibGUoKTsKICAgICAgICAgICAgICAgIHRoaXMuQSAmJiB6RCh0aGlzLkssIGIpOwogICAgICAgICAgICAgICAgdGhpcy5sb2cuaW5mbyhuRSgpKTsKICAgICAgICAgICAgICAgIHZhciBjID0gRShhLlUsIDYpOwogICAgICAgICAgICAgICAgaWYgKGMgfHwgIXRoaXMuSy5UYShiKSkgewogICAgICAgICAgICAgICAgICAgIGMgJiYgKGMgPSByZyhiKSkgJiYgYi5kaXNwYXRjaEV2ZW50KFJDLCA3NzgsIGMpOwogICAgICAgICAgICAgICAgICAgIGlmIChFKGEuVSwgNCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGEuVTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLlBbYi5nZXREb21JZCgpXSwgZSA9IGRvY3VtZW50OwogICAgICAgICAgICAgICAgICAgICAgICBlID0gdm9pZCAwID09PSBlID8gZG9jdW1lbnQgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICBtaShkLCBjKSAmJiAhdGhpcy5LLlRhKGIpICYmIHBpKGIsIGUsIGQsIGMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBMSSh0aGlzLCBhLCBiKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIExJID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IE5JKGEsIGIsIGMpOwogICAgICAgICAgICAgICAgICAgIE9JKGEsIGQsIGIsIHsgQ2E6IDEgfSk7CiAgICAgICAgICAgICAgICAgICAgYiA9IGMuZ2V0QWRVbml0UGF0aCgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjID0gYS5CW2JdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBfLnkoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZCA9IGMubmV4dCgpOyAhZC5kb25lOyBkID0gYy5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gZC52YWx1ZSwgT0koYSwgZC5jYSwgZC5MLCBkLmVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGEuQltiXTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBOSSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEUoYi5VLCA0KSA/IFtdIDogIUUoYi5VLCA2KSB8fCAobnVsbCA9PT0gKGQgPSBiLlBbYy5nZXREb21JZCgpXSkgfHwgdm9pZCAwID09PSBkID8gMCA6IEUoZCwgMTcpKSA/IChhLkQuYWRkKGMpLCBfLnpsKGMsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgYS5ELmRlbGV0ZShjKTsKICAgICAgICAgICAgICAgICAgICB9KSwgW2NdKSA6IGEuai5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEuRC5oYXMoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuRC5hZGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uemwoZSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgYS5ELmRlbGV0ZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIE9JID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICBhLmxvZy5pbmZvKHVFKCkpOwogICAgICAgICAgICAgICAgICAgIGlmIChQSShhLCBiLCBkLCBjKSAmJiAxICE9PSBkLkNhKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGIgPSBfLnkoYiksIGQgPSBiLm5leHQoKTsgIWQuZG9uZTsgZCA9IGIubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGQudmFsdWUuZ2V0RG9tSWQoKSwgYS5kaXNwYXRjaEV2ZW50KFhDLCA3MjUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDYzogZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQOiBjLlBbZF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgUEkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIGIgPSBiLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXy5BRChhLkssIGUpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGlmICghYi5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIEhJKGEuYWEsIGIsIGMsIGQsIGEuSywgYS5KLCBhLmNvbnRleHQsIGEsIGEuViwgYS5OLCBhLlQpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgS0kucHJvdG90eXBlLnJlZnJlc2ggPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgYiA9IGIgPyBRSSh0aGlzLCBiKSA6IHRoaXMuajsKICAgICAgICAgICAgICAgIGlmICghYi5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgUkkodGhpcywgYSwgYiwgbnVsbCAhPT0gYyAmJiB2b2lkIDAgIT09IGMgPyBjIDogeyBDYTogMiB9KTsKICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFFJID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi5maWx0ZXIoZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjLm0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIE0oYS5sb2csIHhFKFN0cmluZyhkKSkpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBSSSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIGYsIGcgPSBjWzBdLCBoID0gbnVsbCAhPT0gKGUgPSBudWxsID09PSBnIHx8IHZvaWQgMCA9PT0gZyA/IHZvaWQgMCA6IGcuZ2V0RG9tSWQoKSkgJiYgdm9pZCAwICE9PSBlID8gZSA6ICcnOwogICAgICAgICAgICAgICAgICAgIGlmIChhLkEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBoID0gXy55KGMpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBrID0gaC5uZXh0KCk7ICFrLmRvbmU7IGcgPSB7IGliOiBnLmliIH0sIGsgPSBoLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcuaWIgPSBrLnZhbHVlLCBhLkQuYWRkKGcuaWIpLCBfLnpsKGcuaWIsIGZ1bmN0aW9uIChsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgYS5ELmRlbGV0ZShsLmliKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIE9JKGEsIGMsIGIsIGQpOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBjLmxlbmd0aCAmJiBFKGIuVSwgNikgPyAoTShhLmxvZywgdEUoaCksIGcpLCBnID0gZy5nZXRBZFVuaXRQYXRoKCksIGggPSBudWxsICE9PSAoZiA9IGEuQltnXSkgJiYgdm9pZCAwICE9PSBmID8gZiA6IFtdLCBoLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2E6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBMOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWU6IGQKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGEuQltnXSA9IGgpIDogTShhLmxvZywgckUoaCksIGcpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgS0kucHJvdG90eXBlLmxjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiID0gS2UuTygpLmo7CiAgICAgICAgICAgICAgICBpZiAoRShiLCA2KSkKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gXy55KHRoaXMuaiksIGQgPSBjLm5leHQoKTsgIWQuZG9uZTsgZCA9IGMubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLkEgJiYgekQodGhpcy5LLCBkLnZhbHVlKTsKICAgICAgICAgICAgICAgIFNJKHRoaXMsIGIpOwogICAgICAgICAgICAgICAgUUModGhpcywgJ3Jld2FyZGVkU2xvdENsb3NlZCcsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBlLmRldGFpbC5zbG90OwogICAgICAgICAgICAgICAgICAgIGUgPSBfLnQoYS5qLCAnZmluZCcpLmNhbGwoYS5qLCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZiA9PT0gZy5qOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIFRJKGEsIFtlXSwgS2UuTygpLmosIEtlLk8oKS5tLCBhLkspOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBFbCgpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBLSS5wcm90b3R5cGUuZGVzdHJveVNsb3RzID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjLCBkOwogICAgICAgICAgICAgICAgYSA9IHJGLnByb3RvdHlwZS5kZXN0cm95U2xvdHMuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIGlmIChhLmxlbmd0aCAmJiB0aGlzLkEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG51bGwgIT09IChjID0gbnVsbCA9PT0gYiB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLlUpICYmIHZvaWQgMCAhPT0gYyA/IGMgOiBLZS5PKCkuajsKICAgICAgICAgICAgICAgICAgICBiID0gbnVsbCAhPT0gKGQgPSBudWxsID09PSBiIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuUCkgJiYgdm9pZCAwICE9PSBkID8gZCA6IEtlLk8oKS5tOwogICAgICAgICAgICAgICAgICAgIFVJKHRoaXMsIGEsIGUsIGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBWSSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFhLkEpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNKGEubG9nLCBzRSgpLCBkWzBdKSwgITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBRSShhLCBkKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIWUubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShhLmxvZywgV2coJ1B1YkFkc1NlcnZpY2UuY2xlYXInLCBbZF0uZmlsdGVyKGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBmOwogICAgICAgICAgICAgICAgICAgICAgICB9KSkpLCAhMTsKICAgICAgICAgICAgICAgICAgICBhLmxvZy5pbmZvKHZFKCkpOwogICAgICAgICAgICAgICAgICAgIFVJKGEsIGUsIGIsIGMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIH0sIFVJID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gXy55KGIpLCBmID0gZS5uZXh0KCk7ICFmLmRvbmU7IGYgPSBlLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgd0QoYS5LLCBmLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICBUSShhLCBiLCBjLCBkLCBhLkspOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgS0kucHJvdG90eXBlLmZvcmNlRXhwZXJpbWVudCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gTnVtYmVyKGEpOwogICAgICAgICAgICAgICAgMCA8IGEgJiYgRGMoKS5GKGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgVEkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBmID0gdm9pZCAwID09PSBmID8gd2luZG93IDogZjsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBnID0gXy5IKGJ0KSwgaCA9IF8ueShiKSwgayA9IGgubmV4dCgpOyAhay5kb25lOyBrID0gaC5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGsgPSBrLnZhbHVlLCBnID8gdkQoZSwgaykgOiBSRyhhLlQsIGspOwogICAgICAgICAgICAgICAgICAgIGEgPSBfLnkoYik7CiAgICAgICAgICAgICAgICAgICAgZm9yIChrID0gYS5uZXh0KCk7ICFrLmRvbmU7IGsgPSBhLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGsudmFsdWUsIGcgPSBkW2IuZ2V0RG9tSWQoKV0sIG1pKGcsIGMpICYmIHBpKGIsIGYuZG9jdW1lbnQsIGcsIGMpLCBGRChlLCBiKTsKICAgICAgICAgICAgICAgIH0sIFdJID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICB3KGQsIDIxLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgdyhkLCAyMiwgU3RyaW5nKG51bGwgIT09IGIgJiYgdm9pZCAwICE9PSBiID8gYiA6ICcnKSk7CiAgICAgICAgICAgICAgICAgICAgdyhkLCAyMywgU3RyaW5nKG51bGwgIT09IGMgJiYgdm9pZCAwICE9PSBjID8gYyA6ICcnKSk7CiAgICAgICAgICAgICAgICAgICAgU0koYSwgZCk7CiAgICAgICAgICAgICAgICB9LCBYSSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMsIGQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuQSA/IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmlkOiBudWxsICE9PSAoYyA9IEcoYiwgMjIpKSAmJiB2b2lkIDAgIT09IGMgPyBjIDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgIGNtc2lkOiBudWxsICE9PSAoZCA9IEcoYiwgMjMpKSAmJiB2b2lkIDAgIT09IGQgPyBkIDogJycKICAgICAgICAgICAgICAgICAgICB9IDogbnVsbDsKICAgICAgICAgICAgICAgIH0sIFNJID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBFKGIsIDIxKSAmJiBhLkEgJiYgdyhiLCAyOSwgeXIoKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgRmwgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSB0aGlzLCBkID0gTGgoKSwgZSA9IGEuZ2V0U2xvdElkKCksIGYgPSBLZS5PKCkuaiwgZyA9IE5oKEtlLk8oKSwgZS5nZXREb21JZCgpKTsKICAgICAgICAgICAgICAgIHRoaXMuc2V0ID0gSyg4MywgZnVuY3Rpb24gKGgsIGspIHsKICAgICAgICAgICAgICAgICAgICAncGFnZV91cmwnID09PSBoICYmIGsgJiYgKGggPSBbZGgoZWgobmV3IGZoKCksIGgpLCBbU3RyaW5nKGspXSldLCB3aChnLCAzLCBoKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuZ2V0ID0gSyg4NCwgZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3BhZ2VfdXJsJyAhPT0gaCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgdmFyIGs7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gKGsgPSAoTCA9IFViKGcsIGZoLCAzKSwgXy50KEwsICdmaW5kJykpLmNhbGwoTCwgZnVuY3Rpb24gKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNoKGwpID09PSBoOwogICAgICAgICAgICAgICAgICAgIH0pKSA/IHZvaWQgMCA6IE9oKGssIDIpWzBdOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0aGlzLnNldENsaWNrVXJsID0gSyg3OSwgZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT09IHR5cGVvZiBoKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShkLCBXZygnU2xvdC5zZXRDbGlja1VybCcsIFtoXSksIGUpLCBjOwogICAgICAgICAgICAgICAgICAgIGcuc2V0Q2xpY2tVcmwoaCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFyZ2V0aW5nID0gSyg4MSwgZnVuY3Rpb24gKGgsIGspIHsKICAgICAgICAgICAgICAgICAgICBpaChlLCBnLCBoLCBrLCBkKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy51cGRhdGVUYXJnZXRpbmdGcm9tTWFwID0gSyg4NSwgZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICBqaChlLCBnLCBoLCBkKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdGhpcy5kaXNwbGF5ID0gSyg3OCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIE1JKGIsIGUsIG9nKGYsIEtlLk8oKS5tKSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFnRm9yQ2hpbGREaXJlY3RlZFRyZWF0bWVudCA9IEsoODAsIGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IGggfHwgMSA9PT0gaCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IGlsKGYpIHx8IG5ldyBqbCgpOwogICAgICAgICAgICAgICAgICAgICAgICBrLnNldFRhZ0ZvckNoaWxkRGlyZWN0ZWRUcmVhdG1lbnQoaCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHpmKGYsIDI1LCBrKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuc2V0Rm9yY2VTYWZlRnJhbWUgPSBLKDU2NywgZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Jvb2xlYW4nICE9PSB0eXBlb2YgaCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oZCwgV2coJ1Bhc3NiYWNrU2xvdC5zZXRGb3JjZVNhZmVGcmFtZScsIFtTdHJpbmcoaCldKSwgZSksIGM7CiAgICAgICAgICAgICAgICAgICAgdyhnLCAxMiwgaCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFnRm9yVW5kZXJBZ2VPZkNvbnNlbnQgPSBLKDQ0OCwgZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gaCB8fCAxID09PSBoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBrID0gaWwoZikgfHwgbmV3IGpsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGsuc2V0VGFnRm9yVW5kZXJBZ2VPZkNvbnNlbnQoaCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHpmKGYsIDI1LCBrKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKEZsLCBiRCk7CiAgICAgICAgICAgIG1lKEZsLCA2KTsKICAgICAgICAgICAgdmFyIE5sID0gewogICAgICAgICAgICAgICAgICAgIFJFV0FSREVEOiA0LAogICAgICAgICAgICAgICAgICAgIFRPUF9BTkNIT1I6IDIsCiAgICAgICAgICAgICAgICAgICAgQk9UVE9NX0FOQ0hPUjogMywKICAgICAgICAgICAgICAgICAgICBJTlRFUlNUSVRJQUw6IDUKICAgICAgICAgICAgICAgIH0sIFlJID0gewogICAgICAgICAgICAgICAgICAgIElBQl9BVURJRU5DRV8xXzE6IDEsCiAgICAgICAgICAgICAgICAgICAgSUFCX0NPTlRFTlRfMl8xOiAyCiAgICAgICAgICAgICAgICB9LCBaSSA9IHsKICAgICAgICAgICAgICAgICAgICBQVVJDSEFTRUQ6IDEsCiAgICAgICAgICAgICAgICAgICAgT1JHQU5JQzogMgogICAgICAgICAgICAgICAgfSwgJEkgPSB7CiAgICAgICAgICAgICAgICAgICAgRVZFUllPTkU6IDEsCiAgICAgICAgICAgICAgICAgICAgUEFSRU5UQUxfR1VJREFOQ0U6IDIsCiAgICAgICAgICAgICAgICAgICAgVEVFTjogMywKICAgICAgICAgICAgICAgICAgICBNQVRVUkVfQVVESUVOQ0U6IDQKICAgICAgICAgICAgICAgIH0sIGFKID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGlmICghbmUoKS5lbnVtcykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHt9LCBiID0gSGwoTmwpOwogICAgICAgICAgICAgICAgICAgICAgICBhLk91dE9mUGFnZUZvcm1hdCA9IGI7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uSChxdCkgJiYgKGIgPSBIbChaSSksIGEuVHJhZmZpY1NvdXJjZSA9IGIpOwogICAgICAgICAgICAgICAgICAgICAgICBfLkgocHQpICYmIChiID0gSGwoWUkpLCBhLlRheG9ub21pZXMgPSBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgXy5IKERzKSAmJiAoYiA9IEhsKCRJKSwgYS5BZENvbnRlbnRSYXRpbmcgPSBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgbmUoKS5lbnVtcyA9IGE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGJKID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGIuajsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5tYXAoZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF8udChjLCAnZmluZCcpLmNhbGwoYywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmogPT09IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0pLmZpbHRlcihmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFkOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgY0ogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gXy5IZyhXdiksIGMgPSBbXTsKICAgICAgICAgICAgICAgICAgICBhID0gXy55KGEpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSBhLm5leHQoKTsgIWQuZG9uZTsgZCA9IGEubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBkLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICBiLkEgPSBkOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IERjKCkuaig5KTsKICAgICAgICAgICAgICAgICAgICAgICAgMSA9PT0gZS5sZW5ndGggJiYgKGMucHVzaChkKSwgYy5wdXNoKGQgKyAnLScgKyBlWzBdKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSwgZEogPSBfLlZuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXIoJ2dvb2dsZV9EaXNhYmxlSW5pdGlhbExvYWQgaXMgZGVwcmVjYXRlZCBhbmQgd2lsbCBiZSByZW1vdmVkLiBQbGVhc2UgdXNlIGdvb2dsZXRhZy5wdWJhZHMoKS5pc0luaXRpYWxMb2FkRGlzYWJsZWQoKSBpbnN0ZWFkIHRvIGNoZWNrIGlmIGluaXRpYWwgbG9hZCBoYXMgYmVlbiBkaXNhYmxlZC4nKTsKICAgICAgICAgICAgICAgIH0pLCBlSiA9IF8uVm4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB1cignZ29vZ2xldGFnLnB1YmFkZHMoKS5zZXRDb29raWVPcHRpb25zKCkgaXMgZGVwcmVjYXRlZCwgYW5kIHdpbGwgc3RvcCBoYXZpbmcgYW4gZWZmZWN0IGluIGVhcmx5IDIwMjIuICBDb25zaWRlciBtaWdyYXRpbmcgdG8gTGltaXRlZCBBZHMuJyk7CiAgICAgICAgICAgICAgICB9KSwgZkogPSBfLlZuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXIoJ2dvb2dsZXRhZy5wdWJhZGRzKCkuc2V0Q29va2llT3B0aW9ucygpIGhhcyBiZWVuIHJlbW92ZWQsIGFuZCBubyBsb25nZXIgaGFzIGFueSBlZmZlY3QuICBDb25zaWRlciBtaWdyYXRpbmcgdG8gTGltaXRlZCBBZHMuJyk7CiAgICAgICAgICAgICAgICB9KSwgZ0ogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2dvb2dsZV9EaXNhYmxlSW5pdGlhbExvYWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZEooKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkSigpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBMbCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgc0YuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHRoaXMsIGMgPSBMaCgpLCBkID0gS2UuTygpLmosIGUgPSBLZS5PKCkubSwgZiA9ICExOwogICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFyZ2V0aW5nID0gSygxLCBmdW5jdGlvbiAoZywgaCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2YgaCA/IGsgPSBbaF0gOiBBcnJheS5pc0FycmF5KGgpID8gayA9IGggOiBhaChoKSAmJiAoayA9IF8udChBcnJheSwgJ2Zyb20nKS5jYWxsKEFycmF5LCBoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gJ3N0cmluZycgPT09IHR5cGVvZiBnICYmICEkZyhnKTsKICAgICAgICAgICAgICAgICAgICAgICAgayA9IGsgJiYgdGEoayk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtLCBuID0gbnVsbCAhPSAobSA9IG51bGwgPT0gayA/IHZvaWQgMCA6IGsuZXZlcnkoZnVuY3Rpb24gKHEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT09IHR5cGVvZiBxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpID8gbSA6ICExOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWwgfHwgIW4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShjLCBXZygnUHViQWRzU2VydmljZS5zZXRUYXJnZXRpbmcnLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSksIGI7CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSAoTCA9IFViKGQsIGZoLCAyKSwgXy50KEwsICdmaW5kJykpLmNhbGwoTCwgZnVuY3Rpb24gKHEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjaChxKSA9PT0gZzsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZ3B0LWJldGEnID09PSBnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5BKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNKGMsIElFKGsuam9pbigpKSksIGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShjLCBKRShrLmpvaW4oKSkpLCBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgayA9IGNKKGspOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGggPyBkaChoLCBrKSA6IChoID0gZGgoZWgobmV3IGZoKCksIGcpLCBrKSwgZ2goZCwgMiwgZmgsIGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgYy5pbmZvKGhoKGcsIGsuam9pbigpLCBhLmdldE5hbWUoKSkpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFyVGFyZ2V0aW5nID0gSygyLCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdoKGQsIDIsIHZvaWQgMCksIGMuaW5mbyhHRShhLmdldE5hbWUoKSkpLCBiOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2dwdC1iZXRhJyA9PT0gZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNKGMsIEtFKGcpKSwgYjsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBVYihkLCBmaCwgMiksIGsgPSBfLnQoaCwgJ2ZpbmRJbmRleCcpLmNhbGwoaCwgZnVuY3Rpb24gKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2gobCkgPT09IGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPiBrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgekUoZywgYS5nZXROYW1lKCkpKSwgYjsKICAgICAgICAgICAgICAgICAgICAgICAgaC5zcGxpY2UoaywgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHdoKGQsIDIsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICBjLmluZm8oeUUoZywgYS5nZXROYW1lKCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nZXRUYXJnZXRpbmcgPSBLKDM4LCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT09IHR5cGVvZiBnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgV2coJ1B1YkFkc1NlcnZpY2UuZ2V0VGFyZ2V0aW5nJywgW2ddKSksIFtdOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IChMID0gVWIoZCwgZmgsIDIpLCBfLnQoTCwgJ2ZpbmQnKSkuY2FsbChMLCBmdW5jdGlvbiAoaykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNoKGspID09PSBnOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGggPyBPaChoLCAyKS5zbGljZSgpIDogW107CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nZXRUYXJnZXRpbmdLZXlzID0gSygzOSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVWIoZCwgZmgsIDIpLm1hcChmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNoKGcpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNldENhdGVnb3J5RXhjbHVzaW9uID0gSygzLCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT09IHR5cGVvZiBnIHx8ICRnKGcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgV2coJ1B1YkFkc1NlcnZpY2Uuc2V0Q2F0ZWdvcnlFeGNsdXNpb24nLCBbZ10pKSwgYjsKICAgICAgICAgICAgICAgICAgICAgICAgKEwgPSBPaChkLCAzKSwgXy50KEwsICdpbmNsdWRlcycpKS5jYWxsKEwsIGcpIHx8IFRvKGQsIDMsIGcpOwogICAgICAgICAgICAgICAgICAgICAgICBjLmluZm8oQUUoZykpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmNsZWFyQ2F0ZWdvcnlFeGNsdXNpb25zID0gSyg0LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoZCwgMywgUm8pOwogICAgICAgICAgICAgICAgICAgICAgICBjLmluZm8oQkUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzYWJsZUluaXRpYWxMb2FkID0gSyg1LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoZCwgNCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICBmIHx8IChmID0gITAsIGdKKCkpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZW5hYmxlU2luZ2xlUmVxdWVzdCA9IEsoNiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5BICYmICFFKGQsIDYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgb0UoJ1B1YkFkc1NlcnZpY2UuZW5hYmxlU2luZ2xlUmVxdWVzdCcpKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuaW5mbyhwRSgnc2luZ2xlIHJlcXVlc3QnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoZCwgNiwgITApOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5lbmFibGVBc3luY1JlbmRlcmluZyA9IEsoNywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5lbmFibGVTeW5jUmVuZGVyaW5nID0gSyg4LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHVyKCdHUFQgc3luY2hyb25vdXMgcmVuZGVyaW5nIGlzIG5vIGxvbmdlciBzdXBwb3J0ZWQsIGFkcyB3aWxsIGJlIHJlcXVlc3RlZCBhbmQgcmVuZGVyZWQgYXN5bmNocm9ub3VzbHkuIFNlZSBodHRwczovL3N1cHBvcnQuZ29vZ2xlLmNvbS9hZG1hbmFnZXIvYW5zd2VyLzkyMTI1OTQgZm9yIG1vcmUgZGV0YWlscy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZW5hYmxlTGF6eUxvYWQgPSBLKDQ4NSwgZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBuZXcgRWooKTsKICAgICAgICAgICAgICAgICAgICAgICAgdyhoLCAxLCA4MDApOwogICAgICAgICAgICAgICAgICAgICAgICB3KGgsIDIsIDQwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoaCwgMywgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChfLmphKGcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IGcuZmV0Y2hNYXJnaW5QZXJjZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ251bWJlcicgPT09IHR5cGVvZiBrICYmICgwIDw9IGsgPyB3KGgsIDEsIGspIDogLTEgPT0gayAmJiB3KGgsIDEsIHZvaWQgMCwgITEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsgPSBnLnJlbmRlck1hcmdpblBlcmNlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbnVtYmVyJyA9PT0gdHlwZW9mIGsgJiYgKDAgPD0gayA/IHcoaCwgMiwgaykgOiAtMSA9PSBrICYmIHcoaCwgMiwgdm9pZCAwLCAhMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGcubW9iaWxlU2NhbGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdudW1iZXInID09PSB0eXBlb2YgZyAmJiAoMCA8IGcgPyB3KGgsIDMsIGcpIDogLTEgPT0gZyAmJiB3KGgsIDMsIDEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB6ZihkLCA1LCBoKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNldENlbnRlcmluZyA9IEsoOSwgZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9ICEhZzsKICAgICAgICAgICAgICAgICAgICAgICAgYy5pbmZvKHFFKCdjZW50ZXJpbmcnLCBTdHJpbmcoZykpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdyhkLCAxNSwgZyk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWZpbmVQYXNzYmFjayA9IEsoMTAsIGZ1bmN0aW9uIChnLCBoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZyA9IEtsKGEsIGcsIGgpKSAmJiBnLlNjOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMucmVmcmVzaCA9IEsoMTEsIGZ1bmN0aW9uIChnLCBoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSB2b2lkIDAgPT09IGggPyB7fSA6IGg7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChnICYmICFBcnJheS5pc0FycmF5KGcpIHx8ICFfLmphKGgpIHx8IGguY2hhbmdlQ29ycmVsYXRvciAmJiAnYm9vbGVhbicgIT09IHR5cGVvZiBoLmNoYW5nZUNvcnJlbGF0b3IpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBNKGMsIFdnKCdQdWJBZHNTZXJ2aWNlLnJlZnJlc2gnLCBfLnQoQXJyYXksICdmcm9tJykuY2FsbChBcnJheSwgYXJndW1lbnRzKSkpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggJiYgMCA9PSBoLmNoYW5nZUNvcnJlbGF0b3IgfHwgZC5zZXRDb3JyZWxhdG9yKHlyKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSBnID8gYkooZywgYSkgOiBhLmo7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnJlZnJlc2gob2coZCwgZSksIGspIHx8IE0oYywgV2coJ1B1YkFkc1NlcnZpY2UucmVmcmVzaCcsIF8udChBcnJheSwgJ2Zyb20nKS5jYWxsKEFycmF5LCBhcmd1bWVudHMpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmVuYWJsZVZpZGVvQWRzID0gSygxMiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB3KGQsIDIxLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIFNJKGEsIGQpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VmlkZW9Db250ZW50ID0gSygxMywgZnVuY3Rpb24gKGcsIGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgV0koYSwgZywgaCwgZCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb2xsYXBzZUVtcHR5RGl2cyA9IEsoMTQsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSB2b2lkIDAgPT09IGcgPyAhMSA6IGc7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoZCwgMTEsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSAhIWc7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoZCwgMTAsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICBvZignZ3B0X2NlZCcsIGZ1bmN0aW9uIChrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKGssICdzYycsIGggPyAndCcgOiAnZicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgSShrLCAnbGV2ZWwnLCAncGFnZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGYoayk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBjLmluZm8od0UoU3RyaW5nKGgpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIUUoZCwgMTEpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuY2xlYXIgPSBLKDE1LCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShnKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBWSShhLCBkLCBlLCBiSihnLCBhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IGcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVkkoYSwgZCwgZSwgYS5qKTsKICAgICAgICAgICAgICAgICAgICAgICAgTShjLCBXZygnUHViQWRzU2VydmljZS5jbGVhcicsIFtnXSkpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRMb2NhdGlvbiA9IEsoMTYsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPT0gdHlwZW9mIGcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShjLCBXZygnUHViQWRzU2VydmljZS5zZXRMb2NhdGlvbicsIFtnXSkpLCBiOwogICAgICAgICAgICAgICAgICAgICAgICB3KGQsIDgsIGcpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNldENvb2tpZU9wdGlvbnMgPSBLKDE3LCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoXy5IKEZzKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmSigpLCBiOwogICAgICAgICAgICAgICAgICAgICAgICBfLkgoR3MpICYmIGVKKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwICE9PSBnICYmIDEgIT09IGcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShjLCBURSgnUHViYWRzU2VydmljZS5zZXRDb29raWVPcHRpb25zJywgRXIoZyksICcwLDEnKSksIGI7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoZCwgMjQsIGcpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNldFRhZ0ZvckNoaWxkRGlyZWN0ZWRUcmVhdG1lbnQgPSBLKDE4LCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSAhPT0gZyAmJiAwICE9PSBnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgVEUoJ1B1YmFkc1NlcnZpY2Uuc2V0VGFnRm9yQ2hpbGREaXJlY3RlZFRyZWF0bWVudCcsIEVyKGcpLCAnMCwxJykpLCBiOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGlsKGQpIHx8IG5ldyBqbCgpOwogICAgICAgICAgICAgICAgICAgICAgICBoLnNldFRhZ0ZvckNoaWxkRGlyZWN0ZWRUcmVhdG1lbnQoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHpmKGQsIDI1LCBoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5jbGVhclRhZ0ZvckNoaWxkRGlyZWN0ZWRUcmVhdG1lbnQgPSBLKDE5LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gaWwoZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgICAgICAgICBnLmNsZWFyVGFnRm9yQ2hpbGREaXJlY3RlZFRyZWF0bWVudCgpOwogICAgICAgICAgICAgICAgICAgICAgICB6ZihkLCAyNSwgZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0UHVibGlzaGVyUHJvdmlkZWRJZCA9IEsoMjAsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBTdHJpbmcoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuaW5mbyhxRSgnUFBJRCcsIGcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdyhkLCAxNiwgZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0ID0gSygyMSwgZnVuY3Rpb24gKGcsIGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9PSB0eXBlb2YgZyB8fCAhZy5sZW5ndGggfHwgdm9pZCAwID09PSBKRCgpW2ddIHx8ICdzdHJpbmcnICE9PSB0eXBlb2YgaCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNKGMsIFdnKCdQdWJBZHNTZXJ2aWNlLnNldCcsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pKSwgYjsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSAoTCA9IFViKGQsIGZoLCAxNCksIF8udChMLCAnZmluZCcpKS5jYWxsKEwsIGZ1bmN0aW9uIChsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2gobCkgPT09IGc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBrID8gZGgoaywgW2hdKSA6IChrID0gZWgobmV3IGZoKCksIGcpLCBUbyhrLCAyLCBoKSwgZ2goZCwgMTQsIGZoLCBrKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuaW5mbyhqRShnLCBTdHJpbmcoaCksIGEuZ2V0TmFtZSgpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZ2V0ID0gSygyMiwgZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9PSB0eXBlb2YgZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNKGMsIFdnKCdQdWJBZHNTZXJ2aWNlLmdldCcsIFtnXSkpLCBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IChMID0gVWIoZCwgZmgsIDE0KSwgXy50KEwsICdmaW5kJykpLmNhbGwoTCwgZnVuY3Rpb24gKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjaChrKSA9PT0gZzsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoaCA9IGggJiYgT2goaCwgMikpID8gaFswXSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nZXRBdHRyaWJ1dGVLZXlzID0gSygyMywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVWIoZCwgZmgsIDE0KS5tYXAoZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjaChnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kaXNwbGF5ID0gSygyNCwgZnVuY3Rpb24gKGcsIGgsIGssIGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgYS5kaXNwbGF5KGcsIGgsIHZvaWQgMCA9PT0gayA/ICcnIDogaywgdm9pZCAwID09PSBsID8gJycgOiBsKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnVwZGF0ZUNvcnJlbGF0b3IgPSBLKDI1LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHVyKEFDKCd1cGRhdGUnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIE0oYywgTkUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQuc2V0Q29ycmVsYXRvcih5cigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWZpbmVPdXRPZlBhZ2VQYXNzYmFjayA9IEsoMzUsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBLbChhLCBnLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoZy5KYSwgMTUsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5TYzsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNldEZvcmNlU2FmZUZyYW1lID0gSygzNiwgZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdib29sZWFuJyAhPT0gdHlwZW9mIGcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShjLCBXZygnUHViQWRzU2VydmljZS5zZXRGb3JjZVNhZmVGcmFtZScsIFtFcihnKV0pKSwgYjsKICAgICAgICAgICAgICAgICAgICAgICAgdyhkLCAxMywgZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0U2FmZUZyYW1lQ29uZmlnID0gSygzNywgZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSB6RihnKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgV2coJ1B1YkFkc1NlcnZpY2Uuc2V0U2FmZUZyYW1lQ29uZmlnJywgW2ddKSksIGI7CiAgICAgICAgICAgICAgICAgICAgICAgIHpmKGQsIDE4LCBoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRSZXF1ZXN0Tm9uUGVyc29uYWxpemVkQWRzID0gSyg0NDUsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwICE9PSBnICYmIDEgIT09IGcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShjLCBURSgnUHViQWRzU2VydmljZS5zZXRSZXF1ZXN0Tm9uUGVyc29uYWxpemVkQWRzJywgRXIoZyksICcwLDEnKSksIGI7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gaWwoZCkgfHwgbmV3IGpsKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoaCwgOCwgISFnKTsKICAgICAgICAgICAgICAgICAgICAgICAgemYoZCwgMjUsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNldFRhZ0ZvclVuZGVyQWdlT2ZDb25zZW50ID0gSyg0NDcsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSB2b2lkIDAgPT09IGcgPyAyIDogZzsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDIgIT09IGcgJiYgMCAhPT0gZyAmJiAxICE9PSBnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgVEUoJ1B1YmFkc1NlcnZpY2Uuc2V0VGFnRm9yVW5kZXJBZ2VPZkNvbnNlbnQnLCBFcihnKSwgJzIsMCwxJykpLCBiOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGlsKGQpIHx8IG5ldyBqbCgpOwogICAgICAgICAgICAgICAgICAgICAgICBoLnNldFRhZ0ZvclVuZGVyQWdlT2ZDb25zZW50KGcpOwogICAgICAgICAgICAgICAgICAgICAgICB6ZihkLCAyNSwgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZ2V0Q29ycmVsYXRvciA9IEsoMjcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFN0cmluZyhkLmdldENvcnJlbGF0b3IoKSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nZXRUYWdTZXNzaW9uQ29ycmVsYXRvciA9IEsoNjMxLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBDYyhfLnIpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZ2V0VmlkZW9Db250ZW50ID0gSygzMCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWEkoYSwgZCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nZXRWZXJzaW9uID0gSyg1NjgsIFhlKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmZvcmNlRXhwZXJpbWVudCA9IEsoNTY5LCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBhLmZvcmNlRXhwZXJpbWVudChnKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNldENvcnJlbGF0b3IgPSBLKDI4LCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICB1cihBQygnc2V0JykpOwogICAgICAgICAgICAgICAgICAgICAgICBNKGMsIE1FKCkpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmcod2luZG93KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoISgnbnVtYmVyJyA9PT0gdHlwZW9mIGcgJiYgaXNGaW5pdGUoZykgJiYgMCA9PSBnICUgMSAmJiAwIDwgZykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShjLCBXZygnUHViYWRzU2VydmljZS5zZXRDb3JyZWxhdG9yJywgW0VyKGcpXSkpLCBiOwogICAgICAgICAgICAgICAgICAgICAgICBkLnNldENvcnJlbGF0b3IoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoZCwgMjcsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tYXJrQXNBbXAgPSBLKDU3MCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuY29uc29sZSAmJiB3aW5kb3cuY29uc29sZS53YXJuICYmIHdpbmRvdy5jb25zb2xlLndhcm4oJ2dvb2dsZXRhZy5wdWJhZHMoKS5tYXJrQXNBbXAoKSBpcyBkZXByZWNhdGVkIGFuZCBpZ25vcmVkLicpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaXNTUkEgPSBLKDU3MSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFFKGQsIDYpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0SW1hQ29udGVudCA9IEsoMzI4LCBmdW5jdGlvbiAoZywgaCkgewogICAgICAgICAgICAgICAgICAgICAgICBZZihkLCAyMikgPyBXSShhLCBnLCBoLCBkKSA6ICh3KGQsIDIxLCAhMCksIFNJKGEsIGQpLCAnc3RyaW5nJyA9PT0gdHlwZW9mIGcgJiYgdyhkLCAxOSwgZyksICdzdHJpbmcnID09PSB0eXBlb2YgaCAmJiB3KGQsIDIwLCBoKSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nZXRJbWFDb250ZW50ID0gSygzMjksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFlmKGQsIDIyKSA/IFhJKGEsIGQpIDogYS5BID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlkOiBHKGQsIDE5KSB8fCAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtc2lkOiBHKGQsIDIwKSB8fCAnJwogICAgICAgICAgICAgICAgICAgICAgICB9IDogbnVsbDsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmlzSW5pdGlhbExvYWREaXNhYmxlZCA9IEsoNTcyLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIUUoZCwgNCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRQcml2YWN5U2V0dGluZ3MgPSBLKDY0OCwgZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFfLmphKGcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgV2coJ1B1YkFkc1NlcnZpY2Uuc2V0UHJpdmFjeVNldHRpbmdzJywgW2ddKSksIGI7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZy5yZXN0cmljdERhdGFQcm9jZXNzaW5nLCBrID0gZy5jaGlsZERpcmVjdGVkVHJlYXRtZW50LCBsID0gZy51bmRlckFnZU9mQ29uc2VudCwgbSA9IGcubGltaXRlZEFkcywgbiA9IGcubm9uUGVyc29uYWxpemVkQWRzLCBxID0gZy50cmFmZmljU291cmNlLCB1ID0gZy5hZENvbnRlbnRSYXRpbmcsIEIsIHggPSBudWxsICE9IChCID0gaWwoZCkpID8gQiA6IG5ldyBqbCgpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoXy5IKERzKSAmJiB2b2lkIDAgIT09IHUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gdSB8fCAwID09PSB1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcoeCwgMTEsIHZvaWQgMCwgITEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoTWcoJEksIGZ1bmN0aW9uICh6KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6ID09PSB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcoeCwgMTEsIHUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdJbnZhbGlkIEFkIENvbnRlbnQgUmF0aW5nIHZhbHVlICcgKyBFcih1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICdib29sZWFuJyA9PT0gdHlwZW9mIG4gPyB3KHgsIDgsIG4pIDogdm9pZCAwICE9PSBuICYmIE0oYywgU0UoJ1B1YkFkc1NlcnZpY2Uuc2V0UHJpdmFjeVNldHRpbmdzJywgRXIoZyksICdub25QZXJzb25hbGl6ZWRBZHMnLCBFcihuKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAnYm9vbGVhbicgPT09IHR5cGVvZiBoID8gdyh4LCAxLCBoKSA6IHZvaWQgMCAhPT0gaCAmJiBNKGMsIFNFKCdQdWJBZHNTZXJ2aWNlLnNldFByaXZhY3lTZXR0aW5ncycsIEVyKGcpLCAncmVzdHJpY3REYXRhUHJvY2Vzc2luZycsIEVyKGgpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICdib29sZWFuJyA9PT0gdHlwZW9mIG0gPyB3KHgsIDksIG0pIDogdm9pZCAwICE9PSBtICYmIE0oYywgU0UoJ1B1YkFkc1NlcnZpY2Uuc2V0UHJpdmFjeVNldHRpbmdzJywgRXIoZyksICdsaW1pdGVkQWRzJywgRXIobSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBsICYmIChudWxsID09PSBsID8geC5zZXRUYWdGb3JVbmRlckFnZU9mQ29uc2VudCgyKSA6ICExID09PSBsID8geC5zZXRUYWdGb3JVbmRlckFnZU9mQ29uc2VudCgwKSA6ICEwID09PSBsID8geC5zZXRUYWdGb3JVbmRlckFnZU9mQ29uc2VudCgxKSA6IE0oYywgU0UoJ1B1YkFkc1NlcnZpY2Uuc2V0UHJpdmFjeVNldHRpbmdzJywgRXIoZyksICd1bmRlckFnZU9mQ29uc2VudCcsIEVyKGwpKSkpOwogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IGsgJiYgKG51bGwgPT09IGsgPyB4LmNsZWFyVGFnRm9yQ2hpbGREaXJlY3RlZFRyZWF0bWVudCgpIDogITEgPT09IGsgPyB4LnNldFRhZ0ZvckNoaWxkRGlyZWN0ZWRUcmVhdG1lbnQoMCkgOiAhMCA9PT0gayA/IHguc2V0VGFnRm9yQ2hpbGREaXJlY3RlZFRyZWF0bWVudCgxKSA6IE0oYywgU0UoJ1B1YkFkc1NlcnZpY2Uuc2V0UHJpdmFjeVNldHRpbmdzJywgRXIoZyksICdjaGlsZERpcmVjdGVkVHJlYXRtZW50JywgRXIoaykpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uSChxdCkgJiYgdm9pZCAwICE9PSBxICYmIChudWxsID09PSBxID8gdyh4LCAxMCwgdm9pZCAwLCAhMSkgOiBNZyhaSSwgZnVuY3Rpb24gKHopIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6ID09PSBxOwogICAgICAgICAgICAgICAgICAgICAgICB9KSA/IHcoeCwgMTAsIHEpIDogTShjLCBTRSgnUHViQWRzU2VydmljZS5zZXRQcml2YWN5U2V0dGluZ3MnLCBFcihnKSwgJ3RyYWZmaWNTb3VyY2UnLCBFcihxKSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgemYoZCwgMjUsIHgpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBfLkgocHQpICYmICh0aGlzLmFkZFRheG9ub215VmFsdWUgPSBLKDkyMiwgZnVuY3Rpb24gKGcsIGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFNZyhZSSwgZnVuY3Rpb24gKHopIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geiA9PT0gZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIHx8IG51bGwgPT0gaCB8fCAnb2JqZWN0JyA9PT0gdHlwZW9mIGggJiYgIUFycmF5LmlzQXJyYXkoaCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShjLCBXZygnUHViQWRzU2VydmljZS5hZGRUYXhvbm9teVZhbHVlJywgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkpLCBiOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IChMID0gVWIoZCwgYkMsIDMyKSwgXy50KEwsICdmaW5kJykpLmNhbGwoTCwgZnVuY3Rpb24gKHopIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gei5nZXRUYXhvbm9teSgpID09PSBnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGwgPSBrID8gW10uY29uY2F0KF8ubGMoT2goaywgMikpKSA6IFtdLCBtID0gbC5sZW5ndGgsIG4gPSBfLnpjKG90KSwgcSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBoID0gXy55KEFycmF5LmlzQXJyYXkoaCkgPyBoIDogW2hdKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdSA9IGgubmV4dCgpOyAhdS5kb25lOyB1ID0gaC5uZXh0KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSB1LnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEIgPSBOdW1iZXIodSksIHggPSBTdHJpbmcodSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAhXy50KE51bWJlciwgJ2lzSW50ZWdlcicpLmNhbGwoTnVtYmVyLCBCKSB8fCAwID49IEIgfHwgOTk5OTk5IDwgQiA/IHEucHVzaCh1KSA6IF8udChsLCAnaW5jbHVkZXMnKS5jYWxsKGwsIHgpIHx8IGwucHVzaCh4KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBxLmxlbmd0aCAmJiBNKGMsIFdnKCdQdWJBZHNTZXJ2aWNlLmFkZFRheG9ub215VmFsdWUnLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcQogICAgICAgICAgICAgICAgICAgICAgICBdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGwubGVuZ3RoID4gbiAmJiAoTShjLCBhRihnLnRvU3RyaW5nKCksIFN0cmluZyhuKSkpLCBsLnNwbGljZShuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGwubGVuZ3RoID4gbSAmJiAoYy5pbmZvKFlFKEpTT04uc3RyaW5naWZ5KGwuc2xpY2UobSkpLCBnKSksIGsgPyBkQyhrLCBsKSA6IGhDKGQsIGRDKGNDKG5ldyBiQygpLCBnKSwgbCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgfSksIHRoaXMuZ2V0VGF4b25vbXkgPSBLKDkyMywgZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFNZyhZSSwgZnVuY3Rpb24gKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbCA9PT0gZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgV2coJ1B1YkFkc1NlcnZpY2UuZ2V0VGF4b25vbXknLCBbZ10pKSwgW107CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoLCBrOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSAoayA9IG51bGwgPT0gKGggPSAoTCA9IFViKGQsIGJDLCAzMiksIF8udChMLCAnZmluZCcpKS5jYWxsKEwsIGZ1bmN0aW9uIChsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbC5nZXRUYXhvbm9teSgpID09PSBnOwogICAgICAgICAgICAgICAgICAgICAgICB9KSkgPyB2b2lkIDAgOiBPaChoLCAyKS5zbGljZSgpKSA/IGsgOiBbXTsKICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5nZXRUYXhvbm9taWVzID0gSyg5MjQsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyA9IG5ldyB2Lk1hcCgpLCBoID0gXy55KFViKGQsIGJDLCAzMikpLCBrID0gaC5uZXh0KCk7ICFrLmRvbmU7IGsgPSBoLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsgPSBrLnZhbHVlLCBnLnNldChrLmdldFRheG9ub215KCksIE9oKGssIDIpLnNsaWNlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZzsKICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5jbGVhclRheG9ub215ID0gSyg5MjUsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVWIoZCwgYkMsIDMyKS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oYywgYkYoKSksIGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aChkLCAzMiwgdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMuaW5mbygkRSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gVWIoZCwgYkMsIDMyKSwgayA9IGguZmlsdGVyKGZ1bmN0aW9uIChsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsLmdldFRheG9ub215KCkgIT09IGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLmxlbmd0aCA9PT0gay5sZW5ndGggPyBNKGMsIGJGKCkpIDogKHdoKGQsIDMyLCBrKSwgYy5pbmZvKFpFKGcpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgXy5PKExsLCBzRik7CiAgICAgICAgICAgIG1lKExsLCA3KTsKICAgICAgICAgICAgdmFyIGhKID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBiID0gW10sIGMgPSBbXSwgZCA9IExoKCk7CiAgICAgICAgICAgICAgICB0aGlzLmFkZFNpemUgPSBfLm1mKDg4LCBmdW5jdGlvbiAoZSwgZikgewogICAgICAgICAgICAgICAgICAgIHZhciBnOwogICAgICAgICAgICAgICAgICAgIGlmIChnID0gbmgoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBtaChmKSB8fCBBcnJheS5pc0FycmF5KGYpICYmIGYuZXZlcnkobWgpOwogICAgICAgICAgICAgICAgICAgIGcgPyBiLnB1c2goWwogICAgICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgICAgICBmCiAgICAgICAgICAgICAgICAgICAgXSkgOiAoYy5wdXNoKFsKICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgZgogICAgICAgICAgICAgICAgICAgIF0pLCBNKGQsIFdnKCdTaXplTWFwcGluZ0J1aWxkZXIuYWRkU2l6ZScsIFsKICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgZgogICAgICAgICAgICAgICAgICAgIF0pKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHRoaXMuYnVpbGQgPSBfLm1mKDg5LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTShkLCBoRShFcihjKSkpLCBudWxsOwogICAgICAgICAgICAgICAgICAgIHFhKGIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBpSiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIE9DLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB0aGlzLkEgPSB0aGlzLmogPSAwOwogICAgICAgICAgICB9OwogICAgICAgICAgICBfLk8oaUosIE9DKTsKICAgICAgICAgICAgaUoucHJvdG90eXBlLnB1c2ggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkX2I1NTMxM2Q5NjBhNDBlOTIgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnc2Vzc2lvblN0b3JhZ2UnKTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYjU1MzEzZDk2MGE0MGU5MikKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ3Nlc3Npb25TdG9yYWdlJywgJF9fX21vY2tfNTk1MWZkOTY4YTllNDg5Yi5zZXNzaW9uU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEsIGIgPSBMaCgpLCBjID0gMDsgYyA8IGFyZ3VtZW50cy5sZW5ndGg7ICsrYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT09IHR5cGVvZiBhcmd1bWVudHNbY10pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKF8uSChCcykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoMCwgYXJndW1lbnRzW2NdKSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmd1bWVudHNbY10oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5qKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuQSsrLCBudWxsID09PSAoYSA9IG51bGwgPT09IHdpbmRvdyB8fCB2b2lkIDAgPT09IHdpbmRvdyA/IHZvaWQgMCA6IHdpbmRvdy5jb25zb2xlKSB8fCB2b2lkIDAgPT09IGEgPyB2b2lkIDAgOiBhLmVycm9yKCdFeGNlcHRpb24gaW4gcXVldWVkIEdQVCBjb21tYW5kJywgZCksIGIuZXJyb3IoZkUoU3RyaW5nKGQpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGIuaW5mbyhnRShTdHJpbmcodGhpcy5qKSwgU3RyaW5nKHRoaXMuQSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuajsKICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2I1NTMxM2Q5NjBhNDBlOTIpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdzZXNzaW9uU3RvcmFnZScsICRfX19vbGRfYjU1MzEzZDk2MGE0MGU5MikpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgakogPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IG5ldyB6cSgpLCBiID0gbmV3IEFxKCk7CiAgICAgICAgICAgICAgICBhLnNldENvcnJlbGF0b3IoQ2MoXy5yKSk7CiAgICAgICAgICAgICAgICB2YXIgYyA9IERjKCkubSgpLmpvaW4oKTsKICAgICAgICAgICAgICAgIFFiKGEsIDUsIGMsICcnKTsKICAgICAgICAgICAgICAgIFFiKGEsIDIsIDEsIDApOwogICAgICAgICAgICAgICAgemYoYiwgMSwgYSk7CiAgICAgICAgICAgICAgICBhID0geXEoKTsKICAgICAgICAgICAgICAgIGEgPSBKayhhLCAxMCwgITApOwogICAgICAgICAgICAgICAgYyA9IF8uSChSdCk7CiAgICAgICAgICAgICAgICBhID0gSmsoYSwgMTMsIGMpOwogICAgICAgICAgICAgICAgYyA9IF8uSChTdCk7CiAgICAgICAgICAgICAgICBhID0gSmsoYSwgMTQsIGMpOwogICAgICAgICAgICAgICAgYSA9IEprKGEsIDE2LCAhMCk7CiAgICAgICAgICAgICAgICB6ZihiLCAyLCBhKTsKICAgICAgICAgICAgICAgIHdpbmRvdy5nb29nbGVfcnVtX2NvbmZpZyA9IGIudG9KU09OKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBrSiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL3NlY3VyZXB1YmFkcy5nLmRvdWJsZWNsaWNrLm5ldC9ncHQvcHViYWRzX2ltcGxfJywKICAgICAgICAgICAgICAgICAgICAnXycsCiAgICAgICAgICAgICAgICAgICAgJy5qcycKICAgICAgICAgICAgICAgIF0pLCBsSiA9IFAoWwogICAgICAgICAgICAgICAgICAgICdodHRwczovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL2dwdC9wdWJhZHNfaW1wbF8nLAogICAgICAgICAgICAgICAgICAgICdfJywKICAgICAgICAgICAgICAgICAgICAnLmpzJwogICAgICAgICAgICAgICAgXSksIG1KID0gUChbJ2h0dHBzOi8vc2VjdXJlcHViYWRzLmcuZG91YmxlY2xpY2submV0L3BhZ2VhZC9qcy9ydW0uanMnXSksIG5KID0gUChbJ2h0dHBzOi8vc2VjdXJlcHViYWRzLmcuZG91YmxlY2xpY2submV0L3BhZ2VhZC9qcy9ydW1fZGVidWcuanMnXSk7CiAgICAgICAgICAgIChmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgdmFyIGQsIGU7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHZhciBmID0gd2luZG93Lmdvb2dsZXRhZzsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gZiB8fCB2b2lkIDAgPT09IGYgPyAwIDogZi5ldmFsU2NyaXB0cykKICAgICAgICAgICAgICAgICAgICAgICAgZi5ldmFsU2NyaXB0cygpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBiQigpOwogICAgICAgICAgICAgICAgICAgICAgICBvZSgnZXZhbFNjcmlwdHMnLCBobSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBadigpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZig0MDgsIEQpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIFNrKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBYdigpLCBEYygpLmooMTMpLCBEYygpLmooMyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJmKDQwOCwgRCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgR2coJ2dwdC10YWctbG9hZCcpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IG51bGwgIT09IGMgJiYgdm9pZCAwICE9PSBjID8gYyA6IHJtKCksIGggPSAhIV8uYmZbMjU5XTsKICAgICAgICAgICAgICAgICAgICAgICAgTGsoZywgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uSGcoSmgpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IG5ldyBLSShnKTsKICAgICAgICAgICAgICAgICAgICAgICAgXy5iZlsyNjBdICYmIHFEKGspOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGIoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIF8uZUcuTygpLkYgPSBsOwogICAgICAgICAgICAgICAgICAgICAgICBfLnpjKG5tKSAmJiBvbSgpOwogICAgICAgICAgICAgICAgICAgICAgICBfLnVmKDgyNywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEQsIEogPSBkb2N1bWVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT09IHR5cGVvZiBKLmludGVyZXN0Q29ob3J0ICYmIF8uSChBdCkgJiYgKHVELk8oKS5BID0gbnVsbCA9PT0gKEQgPSBKLmludGVyZXN0Q29ob3J0KSB8fCB2b2lkIDAgPT09IEQgPyB2b2lkIDAgOiBELmNhbGwoSikpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0genUoSXQpOwogICAgICAgICAgICAgICAgICAgICAgICBtICYmIF8udWYoODYyLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgRCA9IGRvY3VtZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgRCA9IHZvaWQgMCA9PT0gRCA/IHdpbmRvdy5kb2N1bWVudCA6IEQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobSAmJiBELmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgSiA9IF8uT2koJ01FVEEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBELmhlYWQuYXBwZW5kQ2hpbGQoSik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSi5odHRwRXF1aXYgPSAnb3JpZ2luLXRyaWFsJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKLmNvbnRlbnQgPSBtOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIG9lKCdkZWZpbmVPdXRPZlBhZ2VTbG90JywgSyg3MywgZnVuY3Rpb24gKEQsIEopIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBUOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgPT09IHR5cGVvZiBEICYmIEQubGVuZ3RoICYmIChudWxsID09IEogfHwgJ3N0cmluZycgPT09IHR5cGVvZiBKIHx8ICdudW1iZXInID09PSB0eXBlb2YgSiAmJiBPbChKKSkgPyBEID0gUWwoRCwgJ251bWJlcicgPT09IHR5cGVvZiBKID8gSiA6IDEsICdzdHJpbmcnID09PSB0eXBlb2YgSiA/IEogOiB2b2lkIDApIDogKExoKCkuZXJyb3IoV2coJ2dvb2dsZXRhZy5kZWZpbmVPdXRPZlBhZ2VTbG90JywgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIHZvaWQgMCwgXy5IKGpzKSksIEQgPSBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEID8gbnVsbCAhPT0gKFQgPSBELmopICYmIHZvaWQgMCAhPT0gVCA/IFQgOiBudWxsIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICBNRigpOwogICAgICAgICAgICAgICAgICAgICAgICBUaCgpOwogICAgICAgICAgICAgICAgICAgICAgICBhSigpOwogICAgICAgICAgICAgICAgICAgICAgICBvZSgnZ2V0VmVyc2lvbicsIEsoOTQ2LCBYZSkpOwogICAgICAgICAgICAgICAgICAgICAgICBvZSgncHViYWRzJywgSyg5NDcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNbChrKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIG9lKCdjb21wYW5pb25BZHMnLCBLKDgxNiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gbiAmJiB2b2lkIDAgIT09IG4gPyBuIDogbiA9IG5ldyBORihrKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBXaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcSA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICBvZSgnY29udGVudCcsIEsoODE3LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfLkgod3QpICYmICFxICYmIChNKExoKCksIFhFKCkpLCBxID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFpoKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgb2UoJ3NldEFkSWZyYW1lVGl0bGUnLCBLKDcyOSwgZGopKTsKICAgICAgICAgICAgICAgICAgICAgICAgb2UoJ2dldEV2ZW50TG9nJywgSyg5NDUsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgWkYoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICBvZSgnc2l6ZU1hcHBpbmcnLCBLKDkwLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGhKKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgb2UoJ2VuYWJsZVNlcnZpY2VzJywgSyg5MSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgRCA9IF8ueShwRiksIEogPSBELm5leHQoKTsgIUouZG9uZTsgSiA9IEQubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEogPSBKLnZhbHVlLCBKLkEgJiYgTGgoKS5pbmZvKGtFKCkpLCBKLmVuYWJsZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIG9lKCdkZXN0cm95U2xvdHMnLCBLKDc1LCBnbSkpOwogICAgICAgICAgICAgICAgICAgICAgICBvZSgnYXBpUmVhZHknLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgXy51Zig3NywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBEID0gbmUoKS5jbWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFEIHx8IEFycmF5LmlzQXJyYXkoRCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEogPSBuZXcgaUooKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmUoKS5jbWQgPSBTZyhKKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gRCAmJiB2b2lkIDAgIT09IEQgJiYgRC5sZW5ndGggJiYgSi5wdXNoLmFwcGx5KEosIEQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBuZSgpLmZpZldpbiAmJiAnY29tcGxldGUnICE9PSBkb2N1bWVudC5yZWFkeVN0YXRlID8gXy5mYih3aW5kb3csICdsb2FkJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LnNldFRpbWVvdXQodSwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogdSgpOwogICAgICAgICAgICAgICAgICAgICAgICBkbSgpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoXy5IKFV0KSB8fCBSZS5PKCkuaikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpKKCksIGRpKGRvY3VtZW50LCBlaShZYShfLkgoV3QpID8gbC5qZSA6IGwubGUpLnRvU3RyaW5nKCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgJGwoKTsKICAgICAgICAgICAgICAgICAgICAgICAgb2UoJ2Rpc2FibGVQdWJsaXNoZXJDb25zb2xlJywgSyg5MywgaGkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgb2UoJ29uUHViQ29uc29sZUpzTG9hZCcsIEsoNzMxLCBraSkpOwogICAgICAgICAgICAgICAgICAgICAgICBvZSgnb3BlbkNvbnNvbGUnLCBLKDczMiwgbGkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEIgPSBfLnpjKHlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09IEIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB4ID0gXy5PaSgnU0NSSVBUJyksIHogPSAxID09PSBCID8gZWkoZmQoZ24oJ2h0dHBzOi8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20vcGFnZWFkL21hbmFnZWQvanMvbTIwMjEwMjE2MDEwMS9wdWJhZHNfaW1wbC5qcycpKSkgOiBlaShmZChnbignaHR0cHM6Ly9zZWN1cmVwdWJhZHMuZy5kb3VibGVjbGljay5uZXQvZ3B0L3B1YmFkc19pbXBsXzIwMjEwMjE2MDIuanMnKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmIoeCwgeW4oeiwgU3RyaW5nKE1hdGgucmFuZG9tKCkpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgQyA9IF8ueGMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChudWxsICE9PSAoZSA9IG51bGwgIT09IChkID0gZG9jdW1lbnQuaGVhZCkgJiYgdm9pZCAwICE9PSBkID8gZCA6IGRvY3VtZW50LmJvZHkpICYmIHZvaWQgMCAhPT0gZSA/IGUgOiBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQpLmFwcGVuZENoaWxkKHgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeC5vbmxvYWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2YoJ2dwdF9idnNsdCcsIGZ1bmN0aW9uIChEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRmKEQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJKEQsICd0JywgXy54YygpIC0gQyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkoRCwgJ2YnLCBCKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7IHBhOiAxIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBvZignZ3B0X2lsYScsIGZ1bmN0aW9uIChEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZihEKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkoRCwgJ2lsYScsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7IHBhOiBfLnpjKG9zKSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKF8uSChDcykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBTaGFyZWRBcnJheUJ1ZmZlcigxKSwgQmMoeyBzYWI6ICcxJyB9LCAnZ3B0X3NhYicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMDEgPj0gTWF0aC5yYW5kb20oKSAmJiBCYyh7IHNhYjogJzAnIH0sICdncHRfc2FiJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBjYXRjaCAoRCkgewogICAgICAgICAgICAgICAgICAgIHJmKDEwNiwgRCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0oV2UoKSwgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgcGQ6IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGtKLCBiLCBhKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG9kOiBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQShsSiwgYiwgYSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBsZTogQShtSiksCiAgICAgICAgICAgICAgICAgICAgamU6IEEobkopCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9KSk7CiAgICAgICAgfS5jYWxsKHRoaXMsIHt9KSk7CiAgICB9KCkpCn0="},{"name":"sugarcoat-a8259f1424fe238ddadb822d18e5b54e9da87475","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfZGQ4YWVmMmJkZDhkMDQxMyA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja19kZDhhZWYyYmRkOGQwNDEzKTsKICAgIGNvbnN0ICRfX19tb2NrX2QwYzJlMjcwM2NiNTIyZDcgPSB7fTsKICAgIChleHBvcnRzID0+IHsKICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgbGV0IGlzU2VhbGVkID0gZmFsc2U7CiAgICAgICAgY2xhc3MgU3RvcmFnZSB7CiAgICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICAgICAgaWYgKGlzU2VhbGVkKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSWxsZWdhbCBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBsZW5ndGgoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXModGhpcykubGVuZ3RoOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGtleShpbmRleCkgewogICAgICAgICAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKHRoaXMpOwogICAgICAgICAgICAgICAgaWYgKGluZGV4IDwgMCB8fCBpbmRleCA+PSBrZXlzLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGtleXNbaW5kZXhdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldEl0ZW0oa2V5KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHRoaXMsIGtleSkgPyB0aGlzW2tleV0gOiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldEl0ZW0oa2V5LCB2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1trZXldID0gU3RyaW5nKHZhbHVlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZW1vdmVJdGVtKGtleSkgewogICAgICAgICAgICAgICAgZGVsZXRlIHRoaXNba2V5XTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjbGVhcigpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGtleXMgPSBPYmplY3Qua2V5cyh0aGlzKTsKICAgICAgICAgICAgICAgIGZvciAoY29uc3Qga2V5IG9mIGtleXMpIHsKICAgICAgICAgICAgICAgICAgICBkZWxldGUgdGhpc1trZXldOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGV4cG9ydHMuU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogU3RvcmFnZSwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgICAgIGNvbnN0IGxvY2FsU3RvcmFnZSA9IG5ldyBTdG9yYWdlKCk7CiAgICAgICAgZXhwb3J0cy5sb2NhbFN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZ2V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIGxvY2FsU3RvcmFnZTsKICAgICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgY29uc3Qgc2Vzc2lvblN0b3JhZ2UgPSBuZXcgU3RvcmFnZSgpOwogICAgICAgIGV4cG9ydHMuc2Vzc2lvblN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZ2V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHNlc3Npb25TdG9yYWdlOwogICAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICB9KSgkX19fbW9ja19kMGMyZTI3MDNjYjUyMmQ3KTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgTWFya2V0aW5nLmJpbmREZXBlbmRlbmN5RE9NUGFyc2VkKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgdmFyIEJvb3RzdHJhcHBlciA9IHdpbmRvd1snTWFya2V0aW5nJ107CiAgICAgICAgICAgIHZhciBlbnNpZ2h0ZW5PcHRpb25zID0gTWFya2V0aW5nLmVuc2lnaHRlbk9wdGlvbnM7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdTdGFydCgncnVsZUlkLScgKyB0aGlzLmlkICsgJy1kZXBsb3ltZW50SWQtJyArIHRoaXMuZGVwbG95bWVudElkKTsKICAgICAgICAgICAgICAgIChmdW5jdGlvbiAodywgZCwgdCwgciwgdSkgewogICAgICAgICAgICAgICAgICAgIHZhciBmLCBuLCBpOwogICAgICAgICAgICAgICAgICAgIHdbdV0gPSB3W3VdIHx8IFtdLCBmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkX2Y2MzBiMTJmMDY3N2EwYzAgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKSwgJF9fX29sZF9jZWZlYWM2MzNhMzVkYjJjID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ2xvY2FsU3RvcmFnZScpOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfZjYzMGIxMmYwNjc3YTBjMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja19kZDhhZWYyYmRkOGQwNDEzLlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9jZWZlYWM2MzNhMzVkYjJjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdsb2NhbFN0b3JhZ2UnLCAkX19fbW9ja19kMGMyZTI3MDNjYjUyMmQ3LmxvY2FsU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHsgdGk6ICc1MTAyMjYxJyB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8ucSA9IHdbdV0sIHdbdV0gPSBuZXcgVUVUKG8pLCB3W3VdLnB1c2goJ3BhZ2VMb2FkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9mNjMwYjEyZjA2NzdhMGMwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfZjYzMGIxMmYwNjc3YTBjMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfY2VmZWFjNjMzYTM1ZGIyYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX29sZF9jZWZlYWM2MzNhMzVkYjJjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBuID0gZC5jcmVhdGVFbGVtZW50KHQpLCBuLnNyYyA9IHIsIG4uYXN5bmMgPSAxLCBuLm9ubG9hZCA9IG4ub25yZWFkeXN0YXRlY2hhbmdlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHRoaXMucmVhZHlTdGF0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgcyAmJiBzICE9PSAnbG9hZGVkJyAmJiBzICE9PSAnY29tcGxldGUnIHx8IChmKCksIG4ub25sb2FkID0gbi5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBudWxsKTsKICAgICAgICAgICAgICAgICAgICB9LCBpID0gZC5nZXRFbGVtZW50c0J5VGFnTmFtZSh0KVswXSwgaS5wYXJlbnROb2RlLmluc2VydEJlZm9yZShuLCBpKTsKICAgICAgICAgICAgICAgIH0od2luZG93LCBkb2N1bWVudCwgJ3NjcmlwdCcsICcvL2JhdC5iaW5nLmNvbS9iYXQuanMnLCAndWV0cScpKTsKICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ0VuZCgncnVsZUlkLScgKyB0aGlzLmlkICsgJy1kZXBsb3ltZW50SWQtJyArIHRoaXMuZGVwbG95bWVudElkKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgZGVsbF9tYXJrZXRpbmdfdXRpbC5kZWJ1ZyhlKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIDM2MDUyNDIsIFszNjA2MzI5XSwgNjk1ODc0LCBbNjEwMzIzXSk7CiAgICAgICAgTWFya2V0aW5nLmJpbmRET01QYXJzZWQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICB2YXIgQm9vdHN0cmFwcGVyID0gd2luZG93WydNYXJrZXRpbmcnXTsKICAgICAgICAgICAgdmFyIGVuc2lnaHRlbk9wdGlvbnMgPSBNYXJrZXRpbmcuZW5zaWdodGVuT3B0aW9uczsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ1N0YXJ0KCdydWxlSWQtJyArIHRoaXMuaWQgKyAnLWRlcGxveW1lbnRJZC0nICsgdGhpcy5kZXBsb3ltZW50SWQpOwogICAgICAgICAgICAgICAgaWYgKE1hcmtldGluZy5VRE8ucHJpb3Jjb25zZW50KQogICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbWFnZVJlcXVlc3QoJ2h0dHBzOi8vcHguYWRzLmxpbmtlZGluLmNvbS9jb2xsZWN0Lz9waWQ9NzUxMyZmbXQ9Z2lmJyk7CiAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGRlbGxfbWFya2V0aW5nX3V0aWwuZGVidWcoZSk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCAzNTkzMjg3LCA2MTkwODkpOwogICAgICAgIE1hcmtldGluZy5iaW5kRGVwZW5kZW5jeUltbWVkaWF0ZShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHZhciBCb290c3RyYXBwZXIgPSB3aW5kb3dbJ01hcmtldGluZyddOwogICAgICAgICAgICB2YXIgZW5zaWdodGVuT3B0aW9ucyA9IE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zOwogICAgICAgICAgICBNYXJrZXRpbmcuVURPLmdfZG93bmxvYWQgPSBmdW5jdGlvbiAoaWRTdHJpbmcsIGV2ZW50VHlwZSwgY2F0ZWdvcnkpIHsKICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdodmUnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8uaHZlb3ZlcmxheSA9IGZhbHNlOwogICAgICAgICAgICAgICAgICAgIGlmIChlLmRldGFpbC50eXBlID09PSAnZG93bmxvYWQnKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWNhdGVnb3J5KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmdFdmVudChpZFN0cmluZywgZXZlbnRUeXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZG9jVXJsID0gZS5kZXRhaWwuZXZlbnQgJiYgZS5kZXRhaWwuZXZlbnQudGFyZ2V0ID8gZS5kZXRhaWwuZXZlbnQudGFyZ2V0LmJhc2VVUkkgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvY1VybCA9IGRvY1VybC5zdWJzdHJpbmcoZG9jVXJsLmxhc3RJbmRleE9mKCcvJykgKyAxKS5yZXBsYWNlKCcucGRmJywgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3RhZyhpZFN0cmluZywgZXZlbnRUeXBlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2V2ZW50X2NhdGVnb3J5JzogY2F0ZWdvcnksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2V2ZW50X2xhYmVsJzogZG9jVXJsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBpZiAoTWFya2V0aW5nLlVETy5odmVvdmVybGF5KQogICAgICAgICAgICAgICAgICAgIGlmICghY2F0ZWdvcnkpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5nRXZlbnQoaWRTdHJpbmcsIGV2ZW50VHlwZSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkb2NVcmwgPSB3aW5kb3cubG9jYXRpb24uaHJlZiA/IHdpbmRvdy5sb2NhdGlvbi5ocmVmIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY1VybCA9IGRvY1VybC5zdWJzdHJpbmcoZG9jVXJsLmxhc3RJbmRleE9mKCcvJykgKyAxKS5yZXBsYWNlKCcucGRmJywgJycpOwogICAgICAgICAgICAgICAgICAgICAgICBndGFnKGlkU3RyaW5nLCBldmVudFR5cGUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdldmVudF9jYXRlZ29yeSc6IGNhdGVnb3J5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2V2ZW50X2xhYmVsJzogZG9jVXJsCiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgTWFya2V0aW5nLlVETy5nX3NoYXJlID0gZnVuY3Rpb24gKGlkU3RyaW5nLCBldmVudFR5cGUpIHsKICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdodmUnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChlLmRldGFpbC50eXBlID09PSAnc2hhcmUnKQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuZ0V2ZW50KGlkU3RyaW5nLCBldmVudFR5cGUpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE1hcmtldGluZy5VRE8uZ19tcHYgPSBmdW5jdGlvbiAoaWRTdHJpbmcsIGV2ZW50VHlwZSwgY2F0ZWdvcnkpIHsKICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfN2JhYTFlODA4OWIyM2QwZCA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdzZXNzaW9uU3RvcmFnZScpOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF83YmFhMWU4MDg5YjIzZDBkKQogICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnc2Vzc2lvblN0b3JhZ2UnLCAkX19fbW9ja19kMGMyZTI3MDNjYjUyMmQ3LnNlc3Npb25TdG9yYWdlKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNlc3Npb25TdG9yYWdlLmVuc3BhZ2Vjb3VudEZMVCA9PSAzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjYXRlZ29yeSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuZ0V2ZW50KGlkU3RyaW5nLCBldmVudFR5cGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd0YWcoaWRTdHJpbmcsIGV2ZW50VHlwZSwgeyAnZXZlbnRfY2F0ZWdvcnknOiBjYXRlZ29yeSB9KTsKICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzdiYWExZTgwODliMjNkMGQpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdzZXNzaW9uU3RvcmFnZScsICRfX19vbGRfN2JhYTFlODA4OWIyM2QwZCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBNYXJrZXRpbmcuVURPLmdfYmNfc3RhcnQgPSBmdW5jdGlvbiAoaWRTdHJpbmcsIGV2ZW50VHlwZSkgewogICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB2aWRlb2pzICE9PSAndW5kZWZpbmVkJyAmJiB2aWRlb2pzLnBsYXllcnMpCiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdiBpbiB2aWRlb2pzLnBsYXllcnMpCiAgICAgICAgICAgICAgICAgICAgICAgIHZpZGVvanMucGxheWVyc1t2XS5yZWFkeShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbXlwbGF5ZXIgPSB0aGlzLCB1c2VyVmlkZW8gPSAhbXlwbGF5ZXIuZWxfLmhhc0F0dHJpYnV0ZSgnbXV0ZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1c2VyVmlkZW8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbXlwbGF5ZXIub24oJ3N0YXJ0JywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW15cGxheWVyLnZpZGVvX3N0YXJ0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBteXBsYXllci52aWRlb181MF9wZXJjZW50ID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBteXBsYXllci52aWRlb184MF9wZXJjZW50ID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuZ0V2ZW50KGlkU3RyaW5nLCBldmVudFR5cGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdodmUnLCBmdW5jdGlvbiBfaGFuZGxlcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmRldGFpbC50eXBlID09PSAnYnJpZ2h0Y292ZScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8uZ19iY19zdGFydChpZFN0cmluZywgZXZlbnRUeXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5yZW1vdmVFdmVudExpc3RlbmVyKCdodmUnLCBfaGFuZGxlcik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTWFya2V0aW5nLlVETy5nX2JjXzUwID0gZnVuY3Rpb24gKGlkU3RyaW5nLCBldmVudFR5cGUpIHsKICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdicmlnaHRjb3ZlNTAnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5nRXZlbnQoaWRTdHJpbmcsIGV2ZW50VHlwZSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTWFya2V0aW5nLlVETy5nX2JjXzgwID0gZnVuY3Rpb24gKGlkU3RyaW5nLCBldmVudFR5cGUsIGNhdGVnb3J5KSB7CiAgICAgICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignYnJpZ2h0Y292ZTgwJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIWNhdGVnb3J5KQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuZ0V2ZW50KGlkU3RyaW5nLCBldmVudFR5cGUpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHR5cGVvZiB2aWRlb2pzICE9PSAndW5kZWZpbmVkJyAmJiB2aWRlb2pzLnBsYXllcnMpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodiBpbiB2aWRlb2pzLnBsYXllcnMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2aWRlb2pzLnBsYXllcnNbdl0ucmVhZHkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBteXBsYXllciA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG15cGxheWVyICYmIG15cGxheWVyLm1lZGlhaW5mbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3RhZyhpZFN0cmluZywgZXZlbnRUeXBlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXZlbnRfY2F0ZWdvcnknOiBjYXRlZ29yeSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdldmVudF9sYWJlbCc6IG15cGxheWVyLm1lZGlhaW5mby5uYW1lCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTWFya2V0aW5nLlVETy5nX2JjX2VuZCA9IGZ1bmN0aW9uIChpZFN0cmluZywgZXZlbnRUeXBlKSB7CiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHZpZGVvanMgIT09ICd1bmRlZmluZWQnICYmIHZpZGVvanMucGxheWVycykKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB2IGluIHZpZGVvanMucGxheWVycykKICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW9qcy5wbGF5ZXJzW3ZdLnJlYWR5KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBteXBsYXllciA9IHRoaXMsIHVzZXJWaWRlbyA9ICFteXBsYXllci5lbF8uaGFzQXR0cmlidXRlKCdtdXRlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHVzZXJWaWRlbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBteXBsYXllci5vbignZW5kZWQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5nRXZlbnQoaWRTdHJpbmcsIGV2ZW50VHlwZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG15cGxheWVyLnZpZGVvX3N0YXJ0ID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdodmUnLCBmdW5jdGlvbiBfaGFuZGxlcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmRldGFpbC50eXBlID09PSAnYnJpZ2h0Y292ZScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8uZ19iY19lbmQoaWRTdHJpbmcsIGV2ZW50VHlwZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cucmVtb3ZlRXZlbnRMaXN0ZW5lcignaHZlJywgX2hhbmRsZXIpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE1hcmtldGluZy5VRE8uZ19jb250YWN0dXMgPSBmdW5jdGlvbiAoaWRTdHJpbmcsIGV2ZW50VHlwZSwgY2F0ZWdvcnkpIHsKICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdodmUnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChlLmRldGFpbC50eXBlID09PSAnY29udGFjdHVzJykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjYXRlZ29yeSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5nRXZlbnQoaWRTdHJpbmcsIGV2ZW50VHlwZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHBhZ2VOYW1lID0gZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRzY01hcCgncGFnZW5hbWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd0YWcoaWRTdHJpbmcsIGV2ZW50VHlwZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdldmVudF9jYXRlZ29yeSc6IGNhdGVnb3J5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdldmVudF9sYWJlbCc6IHBhZ2VOYW1lCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE1hcmtldGluZy5VRE8uZ19jaGF0ID0gZnVuY3Rpb24gKGlkU3RyaW5nLCBldmVudFR5cGUpIHsKICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdodmUnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChlLmRldGFpbC50eXBlID09PSAnY2hhdCcpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5nRXZlbnQoaWRTdHJpbmcsIGV2ZW50VHlwZSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTWFya2V0aW5nLlVETy5nX2FkZHRvY2FydCA9IGZ1bmN0aW9uIChpZFN0cmluZywgZXZlbnRUeXBlKSB7CiAgICAgICAgICAgICAgICBpZiAoZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRzY01hcCgnd2Fjb250cm9sbGVyJykgPT09ICdjb250ZW50cycgfHwgZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRzY01hcCgnd29ya2Zsb3dzdGVwJykgPT09ICdjYXJ0JykKICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuZ0V2ZW50KGlkU3RyaW5nLCBldmVudFR5cGUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBNYXJrZXRpbmcuVURPLmdfY2hlY2tvdXQgPSBmdW5jdGlvbiAoaWRTdHJpbmcsIGV2ZW50VHlwZSkgewogICAgICAgICAgICAgICAgaWYgKGRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0c2NNYXAoJ3dhY29udHJvbGxlcicpID09PSAnY29uZmlybWF0aW9uJykKICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuZ0V2ZW50KGlkU3RyaW5nLCBldmVudFR5cGUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBNYXJrZXRpbmcuVURPLmdfcG9kY2FzdF9saXN0ZW4gPSBmdW5jdGlvbiAoaWRTdHJpbmcsIGV2ZW50VHlwZSkgewogICAgICAgICAgICAgICAgd2luZG93LmFkZEV2ZW50TGlzdGVuZXIoJ2h2ZScsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUuZGV0YWlsLnR5cGUgPT09ICdwb2RjYXN0X2xpc3RlbicpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5nRXZlbnQoaWRTdHJpbmcsIGV2ZW50VHlwZSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTWFya2V0aW5nLlVETy5nX3BvZGNhc3Rfc3Vic2NyaWJlID0gZnVuY3Rpb24gKGlkU3RyaW5nLCBldmVudFR5cGUpIHsKICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdodmUnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChlLmRldGFpbC50eXBlID09PSAncG9kY2FzdF9zdWJzY3JpYmUnKQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuZ0V2ZW50KGlkU3RyaW5nLCBldmVudFR5cGUpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE1hcmtldGluZy5VRE8uZ19yZnFfc3VibWl0ID0gZnVuY3Rpb24gKGlkU3RyaW5nLCBldmVudFR5cGUpIHsKICAgICAgICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCdodmUnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChlLmRldGFpbC50eXBlID09PSAncmZxX3N1Ym1pdCcpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5nRXZlbnQoaWRTdHJpbmcsIGV2ZW50VHlwZSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTWFya2V0aW5nLlVETy5nX2lvbl9zdWJtaXQgPSBmdW5jdGlvbiAoaWRTdHJpbmcsIGV2ZW50VHlwZSkgewogICAgICAgICAgICAgICAgaWYgKC9saXZlYmFsbC4qY29tcGxldGVkL2dpLnRlc3QoZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRzY01hcCgncGFnZW5hbWUnKSkpCiAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmdFdmVudChpZFN0cmluZywgZXZlbnRUeXBlKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTWFya2V0aW5nLlVETy5nX2dhdGVkX3N1Ym1pdCA9IGZ1bmN0aW9uIChpZFN0cmluZywgZXZlbnRUeXBlKSB7CiAgICAgICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignaHZlJywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZS5kZXRhaWwudHlwZSA9PT0gJ2dhdGVkX3N1Ym1pdCcpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5nRXZlbnQoaWRTdHJpbmcsIGV2ZW50VHlwZSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICB9LCAzNjQ0MzE3LCBbMzYxNzY4Ml0sIDYyMDgxOCwgWzYxOTQwNF0pOwogICAgICAgIE1hcmtldGluZy5iaW5kRGVwZW5kZW5jeURPTVBhcnNlZChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHZhciBCb290c3RyYXBwZXIgPSB3aW5kb3dbJ01hcmtldGluZyddOwogICAgICAgICAgICB2YXIgZW5zaWdodGVuT3B0aW9ucyA9IE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5wZXJmVGltaW5nU3RhcnQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgICAgICB2YXIgZ2FfZGltZW5zaW9uX21hcCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAnZGltZW5zaW9uMSc6ICdhY2NvdW50aWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGltZW5zaW9uMic6ICdsb2dpbl9zdGF0dXMnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGltZW5zaW9uMyc6ICdsYW5ndWFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdkaW1lbnNpb240JzogJ3NpdGVfc2VnbWVudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdkaW1lbnNpb241JzogJ2N1cnJlbmN5JywKICAgICAgICAgICAgICAgICAgICAgICAgJ2RpbWVuc2lvbjYnOiAnY2F0ZWdvcnknLAogICAgICAgICAgICAgICAgICAgICAgICAnZGltZW5zaW9uNyc6ICdjYXRlZ29yeV9wYXRoJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2RpbWVuc2lvbjgnOiAnY3NlZycsCiAgICAgICAgICAgICAgICAgICAgICAgICdkaW1lbnNpb245JzogJ2VtYWlsaGFzaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdkaW1lbnNpb24xMCc6ICdwbGF0Zm9ybScsCiAgICAgICAgICAgICAgICAgICAgICAgICdkaW1lbnNpb24xMSc6ICdkZ2MnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGltZW5zaW9uMTInOiAnbGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2RpbWVuc2lvbjEzJzogJ3ZlbjEnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGltZW5zaW9uMTQnOiAndGZjaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGltZW5zaW9uMTUnOiAnZHBpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdkaW1lbnNpb24xNic6ICdnY2xpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdkaW1lbnNpb24xNyc6ICdkZW1hbmRnZW5fdmVoaWNsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdkaW1lbnNpb24xOCc6ICdnYWNkJwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIGdhX2NvbmZpZ19tYXAgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgJ2FjY291bnRpZCc6IE1hcmtldGluZy5VRE8uYWNjb3VudGlkLAogICAgICAgICAgICAgICAgICAgICAgICAncGFnZV90aXRsZSc6IGRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0c2NNYXAoJ3BhZ2VuYW1lJyksCiAgICAgICAgICAgICAgICAgICAgICAgICdsb2dpbl9zdGF0dXMnOiBkZWxsX21hcmtldGluZ191dGlsLmdldENvb2tpZSgnR0FBdXRoJykgPyAnbG9nZ2VkX2luJyA6ICdub3RfbG9nZ2VkX2luJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xhbmd1YWdlJzogTWFya2V0aW5nLlVETy5sYW5ndWFnZSwKICAgICAgICAgICAgICAgICAgICAgICAgJ3NpdGVfc2VnbWVudCc6IE1hcmtldGluZy5VRE8uc2VnbWVudCwKICAgICAgICAgICAgICAgICAgICAgICAgJ2N1cnJlbmN5JzogTWFya2V0aW5nLlVETy5jdXJyZW5jeSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NhdGVnb3J5JzogTWFya2V0aW5nLlVETy5jYXRlZ29yeSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NhdGVnb3J5X3BhdGgnOiBNYXJrZXRpbmcuVURPLmNhdGVnb3J5cGF0aCwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NzZWcnOiBNYXJrZXRpbmcuVURPLmNzZWcsCiAgICAgICAgICAgICAgICAgICAgICAgICdlbWFpbGhhc2gnOiBNYXJrZXRpbmcuVURPLmVtYWlsaGFzaCwKICAgICAgICAgICAgICAgICAgICAgICAgJ3BsYXRmb3JtJzogTWFya2V0aW5nLlVETy5wbGF0Zm9ybSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2RnYyc6IGRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0UGFyYW1ldGVyQnlOYW1lKCdkZ2MnLCBsb2NhdGlvbi50b1N0cmluZygpLnRvTG93ZXJDYXNlKCkpLAogICAgICAgICAgICAgICAgICAgICAgICAnbGlkJzogZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRQYXJhbWV0ZXJCeU5hbWUoJ2xpZCcsIGxvY2F0aW9uLnRvU3RyaW5nKCkudG9Mb3dlckNhc2UoKSksCiAgICAgICAgICAgICAgICAgICAgICAgICd2ZW4xJzogTWFya2V0aW5nLlVETy52ZW4xLAogICAgICAgICAgICAgICAgICAgICAgICAndGZjaWQnOiBkZWxsX21hcmtldGluZ191dGlsLmdldFBhcmFtZXRlckJ5TmFtZSgndGZjaWQnLCBsb2NhdGlvbi50b1N0cmluZygpLnRvTG93ZXJDYXNlKCkpLAogICAgICAgICAgICAgICAgICAgICAgICAnZ2NsaWQnOiBkZWxsX21hcmtldGluZ191dGlsLmdldFBhcmFtZXRlckJ5TmFtZSgnZ2NsaWQnLCBsb2NhdGlvbi50b1N0cmluZygpLnRvTG93ZXJDYXNlKCkpLAogICAgICAgICAgICAgICAgICAgICAgICAnZGVtYW5kZ2VuX3ZlaGljbGUnOiAnZGVtYW5kZ2VuX3ZlaGljbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnZ2FjZCc6IE1hcmtldGluZy5VRE8uZ2FjZCwKICAgICAgICAgICAgICAgICAgICAgICAgJ2RwaWQnOiBNYXJrZXRpbmcuVURPLmRwaWQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHZhciBwcm9kdWN0X2l0ZW1fbGlzdCA9IGZ1bmN0aW9uIChsaXN0TmFtZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBwcm9kTGlzdCA9IFtdOwogICAgICAgICAgICAgICAgICAgIGlmIChNYXJrZXRpbmcuVURPLnByb2R1Y3RsaXN0ICYmIE1hcmtldGluZy5VRE8ucHJvZHVjdGxpc3QubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnByb2R1Y3RsaXN0LmZvckVhY2goZnVuY3Rpb24gKGxpc3QsIGluZGV4KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgcHJvZERldGFpbHMgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2REZXRhaWxzWydpZCddID0gbGlzdC5JVEVNID8gbGlzdC5JVEVNIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9kRGV0YWlsc1snbmFtZSddID0gbGlzdC5QUk9EVUNUSUQgPyBsaXN0LlBST0RVQ1RJRCA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZERldGFpbHNbJ3ZhcmlhbnQnXSA9IGxpc3QuUFJPRFVDVElEID8gbGlzdC5QUk9EVUNUSUQgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2REZXRhaWxzWydxdWFudGl0eSddID0gbGlzdC5RVFkgPyBsaXN0LlFUWSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZERldGFpbHNbJ3ByaWNlJ10gPSBsaXN0LkFNVCA/IGxpc3QuQU1UIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9kRGV0YWlsc1snYnJhbmQnXSA9IE1hcmtldGluZy5VRE8uZmFtaWx5LnNwbGl0KCd8JylbaW5kZXhdID8gTWFya2V0aW5nLlVETy5mYW1pbHkuc3BsaXQoJ3wnKVtpbmRleF0gOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2REZXRhaWxzWydjYXRlZ29yeSddID0gTWFya2V0aW5nLlVETy5jYXRlZ29yeS5zcGxpdCgnfCcpW2luZGV4XSA/IE1hcmtldGluZy5VRE8uY2F0ZWdvcnkuc3BsaXQoJ3wnKVtpbmRleF0gOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2REZXRhaWxzWydsaXN0X25hbWUnXSA9IGxpc3ROYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZERldGFpbHNbJ2xpc3RfcG9zaXRpb24nXSA9IGluZGV4ICsgMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2RMaXN0LnB1c2gocHJvZERldGFpbHMpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHByb2RMaXN0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBndGFnKCdzZXQnLCB7ICdjdXN0b21fbWFwJzogZ2FfZGltZW5zaW9uX21hcCgpIH0pOwogICAgICAgICAgICAgICAgaWYgKE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zLnB1Ymxpc2hQYXRoID09ICdtYXJrZXRpbmcnKQogICAgICAgICAgICAgICAgICAgIGd0YWcoJ2NvbmZpZycsICdVQS0yMDg1MzM5MzItMScsIGdhX2NvbmZpZ19tYXAoKSk7CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgZ3RhZygnY29uZmlnJywgJ1VBLTIwODUzMzkzMi0yJywgZ2FfY29uZmlnX21hcCgpKTsKICAgICAgICAgICAgICAgIGlmIChNYXJrZXRpbmcuVURPLnByb21vaWQgPT0gJzcnKQogICAgICAgICAgICAgICAgICAgIGd0YWcoJ2V2ZW50JywgJ3ZpZXdfaXRlbScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgJ2l0ZW1zJzogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaWQnOiBNYXJrZXRpbmcuVURPLm9yZGVyY29kZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYnJhbmQnOiBNYXJrZXRpbmcuVURPLmZhbWlseSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbmFtZSc6IE1hcmtldGluZy5VRE8ucHJvZHVjdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndmFyaWFudCc6IE1hcmtldGluZy5VRE8ucHJvZHVjdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2F0ZWdvcnknOiBNYXJrZXRpbmcuVURPLmNhdGVnb3J5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsaXN0X25hbWUnOiAnU2luZ2xlIFByb2R1Y3QgVmlldycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2xpc3RfcG9zaXRpb24nOiAnMScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBpZiAoTWFya2V0aW5nLlVETy5wcm9tb2lkID09ICc5JykgewogICAgICAgICAgICAgICAgICAgIGlmIChkb2N1bWVudC5yZWZlcnJlci5pbmRleE9mKCdzaG9wL3JlYycpID4gMCkKICAgICAgICAgICAgICAgICAgICAgICAgZ3RhZygnZXZlbnQnLCAnYWRkX3RvX2NhcnQnLCB7ICdpdGVtcyc6IHByb2R1Y3RfaXRlbV9saXN0KCdDYXJ0IEFkZCcpIH0pOwogICAgICAgICAgICAgICAgICAgIGd0YWcoJ2V2ZW50JywgJ3ZpZXdfY2FydCcsIHsgJ2l0ZW1zJzogcHJvZHVjdF9pdGVtX2xpc3QoJ0NhcnQgVmlldycpIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKE1hcmtldGluZy5VRE8ucHJvbW9pZCA9PSAnMTAwJykgewogICAgICAgICAgICAgICAgICAgIHZhciB0cmFuc2FjdGlvbkRhdGEgPSBEZWxsICYmIERlbGwuVHJhbnNhY3Rpb25hbCAmJiBEZWxsLlRyYW5zYWN0aW9uYWwuQ2FydCA/IERlbGwuVHJhbnNhY3Rpb25hbC5DYXJ0Lk1ldHJpY3MuRGF0YS5BbmFseXRpY3MgOiAnJzsKICAgICAgICAgICAgICAgICAgICBndGFnKCdldmVudCcsICdwdXJjaGFzZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgJ3RyYW5zYWN0aW9uX2lkJzogTWFya2V0aW5nLlVETy5kcGlkLAogICAgICAgICAgICAgICAgICAgICAgICAndmFsdWUnOiBNYXJrZXRpbmcuVURPLnJldmVudWUsCiAgICAgICAgICAgICAgICAgICAgICAgICdjdXJyZW5jeSc6IE1hcmtldGluZy5VRE8uY3VycmVuY3ksCiAgICAgICAgICAgICAgICAgICAgICAgICdkaXNjb3VudCc6IE1hcmtldGluZy5VRE8uZGlzY291bnQsCiAgICAgICAgICAgICAgICAgICAgICAgICd0YXgnOiB0cmFuc2FjdGlvbkRhdGEgPyB0cmFuc2FjdGlvbkRhdGEuT3JkZXJUYXhUb3RhbCA6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICdzaGlwcGluZyc6IHRyYW5zYWN0aW9uRGF0YSA/IHRyYW5zYWN0aW9uRGF0YS5PcmRlclRheGVzU2hpcHBpbmdGZWVzVG90YWwgOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAnaXJuX2RwaWQnOiBNYXJrZXRpbmcuVURPLmRwaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3Vwb24nOiBNYXJrZXRpbmcuVURPLmNvdXBvbiwKICAgICAgICAgICAgICAgICAgICAgICAgJ2l0ZW1zJzogcHJvZHVjdF9pdGVtX2xpc3QoJ1B1cmNoYXNlIEl0ZW0nKQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5nX2Rvd25sb2FkKCdldmVudCcsICdwZGZfZG93bmxvYWQnLCAnZG93bmxvYWQnKTsKICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8uZ19tcHYoJ2V2ZW50JywgJ211bHRpLXBhZ2UgdmlldycsICd1c2VyX2ludGVyYWN0aW9uJyk7CiAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLmdfYmNfODAoJ2V2ZW50JywgJ3ZpZGVvOjgwJywgJ21lZGlhJyk7CiAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLmdfY29udGFjdHVzKCdldmVudCcsICdjb250YWN0IHVzJywgJ3VzZXJfaW50ZXJhY3Rpb24nKTsKICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ0VuZCgncnVsZUlkLScgKyB0aGlzLmlkICsgJy1kZXBsb3ltZW50SWQtJyArIHRoaXMuZGVwbG95bWVudElkKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgZGVsbF9tYXJrZXRpbmdfdXRpbC5kZWJ1ZyhlKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIDM2NDQzNTQsIFsKICAgICAgICAgICAgMzYxNzY4MiwKICAgICAgICAgICAgMzY0NDMxNwogICAgICAgIF0sIDY5OTI3NywgWwogICAgICAgICAgICA2MTk0MDQsCiAgICAgICAgICAgIDYyMDgxOAogICAgICAgIF0pOwogICAgICAgIE1hcmtldGluZy5iaW5kRGVwZW5kZW5jeUltbWVkaWF0ZShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHZhciBCb290c3RyYXBwZXIgPSB3aW5kb3dbJ01hcmtldGluZyddOwogICAgICAgICAgICB2YXIgZW5zaWdodGVuT3B0aW9ucyA9IE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5wZXJmVGltaW5nU3RhcnQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgICAgICBpZiAoZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXRQYXJhbWV0ZXJCeU5hbWUoJ21kZWJ1ZycsIGxvY2F0aW9uLnNlYXJjaCkgPT0gJ3RydWUnKSB7CiAgICAgICAgICAgICAgICAgICAgZGVsbF9tYXJrZXRpbmdfdXRpbC5nZXREcGlkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IERhdGUoKS5nZXRUaW1lKCk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuZ0V2ZW50KCdEQy05NjMyNjQ1L3NhbGVzMC9jc2JfdGVzdCt0cmFuc2FjdGlvbnMnLCAncHVyY2hhc2UnKTsKICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yQWxsKCdpZnJhbWUnKS5mb3JFYWNoKGZ1bmN0aW9uIChrZXkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGtleS5zcmMuaW5jbHVkZXMoJ3R5cGU9c2FsZXMnKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleS5jb250ZW50V2luZG93LnBvc3RNZXNzYWdlKEpTT04uc3RyaW5naWZ5KE1hcmtldGluZyksICcqJyk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIGRlbGxfbWFya2V0aW5nX3V0aWwuZGVidWcoZSk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCAzNjAwMzExLCBbMzYxNzY4Ml0sIDYzNjE0MiwgWzYxOTQwNF0pOwogICAgICAgIE1hcmtldGluZy5iaW5kRGVwZW5kZW5jeURPTVBhcnNlZChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHZhciBCb290c3RyYXBwZXIgPSB3aW5kb3dbJ01hcmtldGluZyddOwogICAgICAgICAgICB2YXIgZW5zaWdodGVuT3B0aW9ucyA9IE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgTWFya2V0aW5nLlVETy5wZXJmVGltaW5nU3RhcnQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgICAgICBpZiAoTWFya2V0aW5nLlVETy5wcmlvcmNvbnNlbnQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IE1hcmtldGluZy5zY0RhdGFPYmouY291bnRyeTsKICAgICAgICAgICAgICAgICAgICBpZiAoYyA9PT0gJ3VzJykKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmluc2VydFNjcmlwdCgnLy92dC5teXZpc3VhbGlxLm5ldC8yL1R4VVFOSFNLdkdXSWlNajFPaDN0ZnclM0QlM0QvdnQtMjg4LmpzJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMgPT09ICdjYScpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbnNlcnRTY3JpcHQoJy8vdnQubXl2aXN1YWxpcS5uZXQvMi9UeFVRTkhTS3ZHV0lpTWoxT2gzdGZ3JTNEJTNEL3Z0LTI4OS5qcycpOwogICAgICAgICAgICAgICAgICAgIGlmIChjID09PSAnYnInKQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCcvL3Z0Lm15dmlzdWFsaXEubmV0LzIvd1FRdFRpaXpsNFNpeHJoSVR5VHFiZyUzRCUzRC92dC0yODYuanMnKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYyA9PT0gJ3VrJykKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmluc2VydFNjcmlwdCgnLy92dC5teXZpc3VhbGlxLm5ldC8yL2FtaTdlV0Q3TWE5cWt1OUhERzIzMnclM0QlM0QvdnQtMjEzLmpzJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMgPT09ICdqcCcpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbnNlcnRTY3JpcHQoJy8vdnQubXl2aXN1YWxpcS5uZXQvMi82JTJCeFQlMkJPM3oxemgxNHl1bEpCRE42ZyUzRCUzRC92dC0yODcuanMnKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYyA9PT0gJ2F1JykKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmluc2VydFNjcmlwdCgnLy92dC5teXZpc3VhbGlxLm5ldC8yL2lwZWV5SGh0NG5wUUVpemlDV2FZenclM0QlM0QvdnQtMjk5LmpzJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMgPT09ICdueicpCiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5pbnNlcnRTY3JpcHQoJy8vdnQubXl2aXN1YWxpcS5uZXQvMi9pcGVleUhodDRucFFFaXppQ1dhWXp3JTNEJTNEL3Z0LTMwMS5qcycpOwogICAgICAgICAgICAgICAgICAgIGlmIChjID09PSAnaW4nKQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCcvL3Z0Lm15dmlzdWFsaXEubmV0LzIvdUJGJTJCbmRKVDduMHI5V3lzTkkxVnd3JTNEJTNEL3Z0LTI5OC5qcycpOwogICAgICAgICAgICAgICAgICAgIGlmIChjID09PSAnZnInKQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCcvL3Z0Lm15dmlzdWFsaXEubmV0LzIvR1hPZE4lMkJXdWdZM04zbjRhNUxBa05RJTNEJTNEL3Z0LTMwMC5qcycpOwogICAgICAgICAgICAgICAgICAgIGlmIChjID09PSAnZGUnKQogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuaW5zZXJ0U2NyaXB0KCcvL3Z0Lm15dmlzdWFsaXEubmV0LzIvdjlCSk9HY2dsNHdmam43cFhCaHVuQSUzRCUzRC92dC0zMDIuanMnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ0VuZCgncnVsZUlkLScgKyB0aGlzLmlkICsgJy1kZXBsb3ltZW50SWQtJyArIHRoaXMuZGVwbG95bWVudElkKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgZGVsbF9tYXJrZXRpbmdfdXRpbC5kZWJ1ZyhlKTsKICAgICAgICAgICAgfQogICAgICAgIH0sIDM1OTMzNjUsIFsKICAgICAgICAgICAgMzUwNjkyNCwKICAgICAgICAgICAgMzYwNjMyOQogICAgICAgIF0sIDYyMTkxOSwgWwogICAgICAgICAgICA2MTAzMTAsCiAgICAgICAgICAgIDYxMDMyMwogICAgICAgIF0pOwogICAgICAgIE1hcmtldGluZy5iaW5kRGVwZW5kZW5jeUltbWVkaWF0ZShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHZhciBCb290c3RyYXBwZXIgPSB3aW5kb3dbJ01hcmtldGluZyddOwogICAgICAgICAgICB2YXIgZW5zaWdodGVuT3B0aW9ucyA9IE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zOwogICAgICAgICAgICBNYXJrZXRpbmcuVURPLmZsX2xvYWRlZCA9IGZhbHNlOwogICAgICAgICAgICBpZiAoTWFya2V0aW5nLlVETy5wcmlvcmNvbnNlbnQpIHsKICAgICAgICAgICAgICAgIE1hcmtldGluZy5sb2FkU2NyaXB0Q2FsbGJhY2soJ2h0dHBzOi8vd3d3Lmdvb2dsZXRhZ21hbmFnZXIuY29tL2d0YWcvanM/aWQ9REMtOTYzMjY0NScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBkZWxsX21hcmtldGluZ191dGlsLmN1c3RvbV9tYXJrZXRpbmdfZXZlbnQoJ2ZsX2xvYWRlZCcpOwogICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8uZmxfbG9hZGVkID0gdHJ1ZTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgd2luZG93LmRhdGFMYXllciA9IHdpbmRvdy5kYXRhTGF5ZXIgfHwgW107CiAgICAgICAgICAgICAgICB3aW5kb3cuZ3RhZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBkYXRhTGF5ZXIucHVzaChhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGd0YWcoJ2pzJywgbmV3IERhdGUoKSk7CiAgICAgICAgICAgICAgICBndGFnKCdjb25maWcnLCAnREMtOTYzMjY0NScpOwogICAgICAgICAgICAgICAgZ3RhZygnY29uZmlnJywgJ0RDLTk2MzI5MjEnKTsKICAgICAgICAgICAgICAgIGd0YWcoJ2NvbmZpZycsICdEQy05NjMyNjQ4Jyk7CiAgICAgICAgICAgICAgICB2YXIgY2Zsdl9tYXN0ZXJfc2V0dXAgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dfY3VzdG9tX3NjcmlwdHM6IHRydWUsCiAgICAgICAgICAgICAgICAgICAgICAgIHUxOiBNYXJrZXRpbmcuVURPLmxhbmd1YWdlLAogICAgICAgICAgICAgICAgICAgICAgICB1MTA6IE1hcmtldGluZy5VRE8uY3NlZywKICAgICAgICAgICAgICAgICAgICAgICAgdTExOiBNYXJrZXRpbmcuVURPLmRlYWxzLAogICAgICAgICAgICAgICAgICAgICAgICB1MTI6IE1hcmtldGluZy5VRE8uZGV2aWNlLAogICAgICAgICAgICAgICAgICAgICAgICB1MTM6IE1hcmtldGluZy5VRE8uZGlzY291bnQsCiAgICAgICAgICAgICAgICAgICAgICAgIHUxNDogTWFya2V0aW5nLlVETy5mYW1pbHksCiAgICAgICAgICAgICAgICAgICAgICAgIHUxNTogTWFya2V0aW5nLlVETy5vZ2lkLAogICAgICAgICAgICAgICAgICAgICAgICB1MTY6IE1hcmtldGluZy5VRE8ub3JkZXJjb2RlLAogICAgICAgICAgICAgICAgICAgICAgICB1MTc6IE1hcmtldGluZy5VRE8ucGxhdGZvcm0sCiAgICAgICAgICAgICAgICAgICAgICAgIHUxODogTWFya2V0aW5nLlVETy5wcm9kY2F0LAogICAgICAgICAgICAgICAgICAgICAgICB1MTk6IE1hcmtldGluZy5VRE8ucHJvZHVjdCwKICAgICAgICAgICAgICAgICAgICAgICAgdTI6IE1hcmtldGluZy5VRE8uc2VnbWVudCwKICAgICAgICAgICAgICAgICAgICAgICAgdTIwOiBNYXJrZXRpbmcuVURPLnByb21vaWQsCiAgICAgICAgICAgICAgICAgICAgICAgIHUyMTogTWFya2V0aW5nLlVETy50eXBlLAogICAgICAgICAgICAgICAgICAgICAgICB1MjI6IGRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0UGFyYW1ldGVyQnlOYW1lKCdkZ2MnLCBsb2NhdGlvbi50b1N0cmluZygpLnRvTG93ZXJDYXNlKCkpLAogICAgICAgICAgICAgICAgICAgICAgICB1MjM6IE1hcmtldGluZy5VRE8uZ2FjZCwKICAgICAgICAgICAgICAgICAgICAgICAgdTI0OiBkZWxsX21hcmtldGluZ191dGlsLmdldFBhcmFtZXRlckJ5TmFtZSgnbGlkJywgbG9jYXRpb24udG9TdHJpbmcoKS50b0xvd2VyQ2FzZSgpKSwKICAgICAgICAgICAgICAgICAgICAgICAgdTI1OiBNYXJrZXRpbmcuVURPLnZlbjEsCiAgICAgICAgICAgICAgICAgICAgICAgIHUyNjogTWFya2V0aW5nLlVETy52ZW4yLAogICAgICAgICAgICAgICAgICAgICAgICB1Mjg6IGRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0UGFyYW1ldGVyQnlOYW1lKCd0ZmNpZCcsIGxvY2F0aW9uLnRvU3RyaW5nKCkudG9Mb3dlckNhc2UoKSksCiAgICAgICAgICAgICAgICAgICAgICAgIHUyOTogTWFya2V0aW5nLlVETy5yZXZlbnVlLAogICAgICAgICAgICAgICAgICAgICAgICB1MzogTWFya2V0aW5nLlVETy5jdXJyZW5jeSwKICAgICAgICAgICAgICAgICAgICAgICAgdTMwOiBNYXJrZXRpbmcuVURPLnVzZHJldiwKICAgICAgICAgICAgICAgICAgICAgICAgdTM1OiBNYXJrZXRpbmcuVURPLmRwaWQsCiAgICAgICAgICAgICAgICAgICAgICAgIHUzNjogTWFya2V0aW5nLlVETy5sYW5kLAogICAgICAgICAgICAgICAgICAgICAgICB1Mzc6IE1hcmtldGluZy5VRE8uc2VyaWFscHJvZGxpc3QsCiAgICAgICAgICAgICAgICAgICAgICAgIHUzODogTWFya2V0aW5nLlVETy5jamV2ZW50LAogICAgICAgICAgICAgICAgICAgICAgICB1NDogTWFya2V0aW5nLlVETy5jb3VudHJ5LAogICAgICAgICAgICAgICAgICAgICAgICB1NTogTWFya2V0aW5nLlVETy5hY2NvdW50aWQsCiAgICAgICAgICAgICAgICAgICAgICAgIHU2OiBNYXJrZXRpbmcuVURPLmNhdGVnb3J5LAogICAgICAgICAgICAgICAgICAgICAgICB1NzogTWFya2V0aW5nLlVETy5jYXRlZ29yeXBhdGgsCiAgICAgICAgICAgICAgICAgICAgICAgIHU4OiBNYXJrZXRpbmcuVURPLmNpZCwKICAgICAgICAgICAgICAgICAgICAgICAgdTk6IE1hcmtldGluZy5VRE8uY291cG9uCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnJlYWREYXRhKCk7CiAgICAgICAgICAgICAgICB2YXIgY2Zsdl9tYXN0ZXIgPSBjZmx2X21hc3Rlcl9zZXR1cCgpOwogICAgICAgICAgICAgICAgY2Zsdl9tYXN0ZXJbJ3UzMSddID0gJyc7CiAgICAgICAgICAgICAgICB2YXIgYWRvYmVfbWNtaWQgPSBkZWxsX21hcmtldGluZ191dGlsLmdldENvb2tpZSgnQU1DVl80REQ4MDg2MTUxNUNBQjk5MEE0OTBENDUlNDBBZG9iZU9yZycpOwogICAgICAgICAgICAgICAgaWYgKGFkb2JlX21jbWlkKQogICAgICAgICAgICAgICAgICAgIGNmbHZfbWFzdGVyWyd1MzEnXSA9IGFkb2JlX21jbWlkLnNwbGl0KCdNQ01JRHwnKVsxXS5zcGxpdCgnfCcpWzBdOwogICAgICAgICAgICAgICAgTWFya2V0aW5nLmdFdmVudCA9IE1hcmtldGluZy5nRXZlbnQgfHwgZnVuY3Rpb24gKGlkU3RyaW5nLCBldmVudFR5cGUpIHsKICAgICAgICAgICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignZmxfbG9hZGVkJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgY2ZsdiA9IGNmbHZfbWFzdGVyOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXZlbnRUeXBlID09PSAncHVyY2hhc2UnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjZmx2Wyd2YWx1ZSddID0gTWFya2V0aW5nLlVETy51c2RyZXYgfHwgTWFya2V0aW5nLlVETy5yZXZlbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2ZsdlsndHJhbnNhY3Rpb25faWQnXSA9IGRlbGxfbWFya2V0aW5nX3V0aWwuZ2V0RHBpZCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGNmbHZbJ3NlbmRfdG8nXSA9IGlkU3RyaW5nOwogICAgICAgICAgICAgICAgICAgICAgICBndGFnKCdldmVudCcsIGV2ZW50VHlwZSwgY2Zsdik7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE1hcmtldGluZy5VRE8uZmxfbG9hZGVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNmbHZfbWFzdGVyID0gY2Zsdl9tYXN0ZXJfc2V0dXAoKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGNmbHYgPSBjZmx2X21hc3RlcjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50VHlwZSA9PT0gJ3B1cmNoYXNlJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2ZsdlsndmFsdWUnXSA9IE1hcmtldGluZy5VRE8udXNkcmV2IHx8IE1hcmtldGluZy5VRE8ucmV2ZW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNmbHZbJ3RyYW5zYWN0aW9uX2lkJ10gPSBkZWxsX21hcmtldGluZ191dGlsLmdldERwaWQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBjZmx2WydzZW5kX3RvJ10gPSBpZFN0cmluZzsKICAgICAgICAgICAgICAgICAgICAgICAgZ3RhZygnZXZlbnQnLCBldmVudFR5cGUsIGNmbHYpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0KICAgICAgICB9LCAzNjE3NjgyLCBbMzYwNjMyOV0sIDYxOTQwNCwgWzYxMDMyM10pOwogICAgfSgpKQp9"},{"name":"sugarcoat-bc51028c5fccd8dec101b0f2fc0e2887b1e7ef5e","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfZDBjMmUyNzAzY2I1MjJkNyA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBsZXQgaXNTZWFsZWQgPSBmYWxzZTsKICAgICAgICBjbGFzcyBTdG9yYWdlIHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBpZiAoaXNTZWFsZWQpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IGxlbmd0aCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyh0aGlzKS5sZW5ndGg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAga2V5KGluZGV4KSB7CiAgICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXModGhpcyk7CiAgICAgICAgICAgICAgICBpZiAoaW5kZXggPCAwIHx8IGluZGV4ID49IGtleXMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4ga2V5c1tpbmRleF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0SXRlbShrZXkpIHsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwodGhpcywga2V5KSA/IHRoaXNba2V5XSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0SXRlbShrZXksIHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW2tleV0gPSBTdHJpbmcodmFsdWUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJlbW92ZUl0ZW0oa2V5KSB7CiAgICAgICAgICAgICAgICBkZWxldGUgdGhpc1trZXldOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGNsZWFyKCkgewogICAgICAgICAgICAgICAgY29uc3Qga2V5cyA9IE9iamVjdC5rZXlzKHRoaXMpOwogICAgICAgICAgICAgICAgZm9yIChjb25zdCBrZXkgb2Yga2V5cykgewogICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2tleV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5TdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBTdG9yYWdlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY29uc3QgbG9jYWxTdG9yYWdlID0gbmV3IFN0b3JhZ2UoKTsKICAgICAgICBleHBvcnRzLmxvY2FsU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbG9jYWxTdG9yYWdlOwogICAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBjb25zdCBzZXNzaW9uU3RvcmFnZSA9IG5ldyBTdG9yYWdlKCk7CiAgICAgICAgZXhwb3J0cy5zZXNzaW9uU3RvcmFnZSA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICBnZXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gc2Vzc2lvblN0b3JhZ2U7CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGlzU2VhbGVkID0gdHJ1ZTsKICAgIH0pKCRfX19tb2NrX2QwYzJlMjcwM2NiNTIyZDcpOwogICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICBNYXJrZXRpbmcuYmluZERlcGVuZGVuY3lET01QYXJzZWQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICBjb25zdCAkX19fb2xkX2E3ZDNiNjAwY2ViNzYxNDEgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnc2Vzc2lvblN0b3JhZ2UnKTsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2E3ZDNiNjAwY2ViNzYxNDEpCiAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ3Nlc3Npb25TdG9yYWdlJywgJF9fX21vY2tfZDBjMmUyNzAzY2I1MjJkNy5zZXNzaW9uU3RvcmFnZSkpOwogICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgQm9vdHN0cmFwcGVyID0gd2luZG93WydNYXJrZXRpbmcnXTsKICAgICAgICAgICAgICAgICAgICB2YXIgZW5zaWdodGVuT3B0aW9ucyA9IE1hcmtldGluZy5lbnNpZ2h0ZW5PcHRpb25zOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIE1hcmtldGluZy5VRE8ucGVyZlRpbWluZ1N0YXJ0KCdydWxlSWQtJyArIHRoaXMuaWQgKyAnLWRlcGxveW1lbnRJZC0nICsgdGhpcy5kZXBsb3ltZW50SWQpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbWFya2V0aW5nc2NEYXRhT2JqID0gTWFya2V0aW5nLnNjRGF0YU9iaiwgbWFya2V0aW5nVURPID0gTWFya2V0aW5nLlVETywgY2FjaGVidXN0ZXIgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKSwgcGl4ZWxJRCA9ICcnLCBodmVQaXhlbElEID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwaXhlbEZpcmUgPSBmdW5jdGlvbiAocGl4ZWxpZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLmltYWdlUmVxdWVzdCgnLy90Lm15dmlzdWFsaXEubmV0L2FjdGl2aXR5X3BpeGVsP3B0PWkmZXQ9YSZyPScgKyBjYWNoZWJ1c3RlciArICcmYWdvPTIxMiZhbz04NzEmcHg9JyArIHBpeGVsaWQgKyAnJm9yZD0nICsgbWFya2V0aW5nVURPLmRwaWQgKyAnJnJldmVudWU9JyArIG1hcmtldGluZ1VETy5yZXZlbnVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgTWFya2V0aW5nLm9uKCdjbGljaycsICcuT295YWxhVmlkZW8nLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaXhlbGlkID0gJzEwMDEnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxGaXJlKHBpeGVsaWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ3NjRGF0YU9iai5wYWdlLmluY2x1ZGVzKCdhbGllbndhcmUnKSB8fCBtYXJrZXRpbmdzY0RhdGFPYmouY2F0ZWdvcnlpZC5pbmNsdWRlcygnYWxpZW53YXJlJykgfHwgbWFya2V0aW5nVURPLmNhdGVnb3J5LmluY2x1ZGVzKCdhbGllbndhcmUnKSB8fCBtYXJrZXRpbmdVRE8uZmFtaWx5LnRvTG93ZXJDYXNlKCkuaW5jbHVkZXMoJ2FsaWVud2FyZScpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxpZCA9ICcxMDAyJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaXhlbEZpcmUocGl4ZWxpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnNlZ21lbnQgPT0gJ2JzZCcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaXhlbGlkID0gJzEwMDMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpeGVsRmlyZShwaXhlbGlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8uc2VnbWVudCA9PSAnZGhzJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpeGVsaWQgPSAnMTAwNCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxGaXJlKHBpeGVsaWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5zZWdtZW50ID09ICdlZXAnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxpZCA9ICcxMDA1JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaXhlbEZpcmUocGl4ZWxpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LmxvY2F0aW9uLnBhdGhuYW1lID09ICcvZW4vc21hbGwtYnVzaW5lc3MtY2VudHJhbCcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpeGVsaWQgPSAnMTAwNic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaXhlbEZpcmUocGl4ZWxpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZS5pbmNsdWRlcygnL2VuL3NtYWxsLWJ1c2luZXNzLWNlbnRyYWwvY29udGFjdC1kZWxsL3RoYW5rLXlvdScpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaXhlbGlkID0gJzEwMDcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGl4ZWxGaXJlKHBpeGVsaWQpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIG1hcmtldGluZ1VETy5odmVfbXB2KCcvL3QubXl2aXN1YWxpcS5uZXQvYWN0aXZpdHlfcGl4ZWw/cHQ9aSZldD1hJnI9JyArIGNhY2hlYnVzdGVyICsgJyZhZ289MjEyJmFvPTg3MSZweD04Nzgmb3JkPScgKyBtYXJrZXRpbmdVRE8uZHBpZCArICcmcmV2ZW51ZT0nICsgbWFya2V0aW5nVURPLnJldmVudWUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nVURPLnNlZ21lbnQgPT0gJ2JzZCcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBodmVQaXhlbElEID0gJzg4MCc7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXJrZXRpbmdVRE8uc2VnbWVudCA9PSAnZGhzJykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGh2ZVBpeGVsSUQgPSAnODgxJzsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmtldGluZ1VETy5zZWdtZW50ID09ICdlZXAnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaHZlUGl4ZWxJRCA9ICc4ODInOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobWFya2V0aW5nc2NEYXRhT2JqLnBhZ2UuaW5jbHVkZXMoJ2FsaWVud2FyZScpIHx8IG1hcmtldGluZ3NjRGF0YU9iai5jYXRlZ29yeWlkLmluY2x1ZGVzKCdhbGllbndhcmUnKSB8fCBtYXJrZXRpbmdVRE8uY2F0ZWdvcnkuaW5jbHVkZXMoJ2FsaWVud2FyZScpIHx8IG1hcmtldGluZ1VETy5mYW1pbHkudG9Mb3dlckNhc2UoKS5pbmNsdWRlcygnYWxpZW53YXJlJykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBodmVQaXhlbElEID0gJzg3OSc7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChodmVQaXhlbElEICE9PSAnJykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcmtldGluZ1VETy5odmVfbXB2KCcvL3QubXl2aXN1YWxpcS5uZXQvYWN0aXZpdHlfcGl4ZWw/cHQ9aSZldD1hJnI9JyArIGNhY2hlYnVzdGVyICsgJyZhZ289MjEyJmFvPTg3MSZweD0nICsgaHZlUGl4ZWxJRCArICcmb3JkPScgKyBtYXJrZXRpbmdVRE8uZHBpZCArICcmcmV2ZW51ZT0nICsgbWFya2V0aW5nVURPLnJldmVudWUpOwogICAgICAgICAgICAgICAgICAgICAgICBNYXJrZXRpbmcuVURPLnBlcmZUaW1pbmdFbmQoJ3J1bGVJZC0nICsgdGhpcy5pZCArICctZGVwbG95bWVudElkLScgKyB0aGlzLmRlcGxveW1lbnRJZCk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBkZWxsX21hcmtldGluZ191dGlsLmRlYnVnKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2E3ZDNiNjAwY2ViNzYxNDEpCiAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ3Nlc3Npb25TdG9yYWdlJywgJF9fX29sZF9hN2QzYjYwMGNlYjc2MTQxKSk7CiAgICAgICAgICAgIH0KICAgICAgICB9LCAzNTkzMzc0LCBbMzYwNjMyOV0sIDYzODAyMCwgWzYxMDMyM10pOwogICAgfSgpKQp9"},{"name":"sugarcoat-cce8c1365e310397573f250aac085a12a8319bb7","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfNWE4NGUxOWIyMTIyYmE5NiA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja181YTg0ZTE5YjIxMjJiYTk2KTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgIGZ1bmN0aW9uIG4ocikgewogICAgICAgICAgICAgICAgaWYgKHRbcl0pCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbcl0uZXhwb3J0czsKICAgICAgICAgICAgICAgIHZhciBvID0gdFtyXSA9IHsKICAgICAgICAgICAgICAgICAgICBpOiByLAogICAgICAgICAgICAgICAgICAgIGw6ICExLAogICAgICAgICAgICAgICAgICAgIGV4cG9ydHM6IHt9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIGVbcl0uY2FsbChvLmV4cG9ydHMsIG8sIG8uZXhwb3J0cywgbiksIG8ubCA9ICEwLCBvLmV4cG9ydHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbi5tID0gZSwgbi5jID0gdCwgbi5kID0gZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgIG4ubyhlLCB0KSB8fCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGdldDogcgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sIG4uciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIFN5bWJvbCAmJiBTeW1ib2wudG9TdHJpbmdUYWcgJiYgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIFN5bWJvbC50b1N0cmluZ1RhZywgeyB2YWx1ZTogJ01vZHVsZScgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICB9LCBuLnQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgaWYgKDEgJiB0ICYmIChlID0gbihlKSksIDggJiB0KQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgaWYgKDQgJiB0ICYmICdvYmplY3QnID09PSB0eXBlb2YgZSAmJiBlICYmIGUuX19lc01vZHVsZSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0LmNyZWF0ZShudWxsKTsKICAgICAgICAgICAgICAgIGlmIChuLnIociksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShyLCAnZGVmYXVsdCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlCiAgICAgICAgICAgICAgICAgICAgfSksIDIgJiB0ICYmICdzdHJpbmcnICE9IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgbi5kKHIsIG8sIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgfS5iaW5kKG51bGwsIG8pKTsKICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICB9LCBuLm4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgdmFyIHQgPSBlICYmIGUuX19lc01vZHVsZSA/IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5kZWZhdWx0OwogICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gbi5kKHQsICdhJywgdCksIHQ7CiAgICAgICAgICAgIH0sIG4ubyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsIHQpOwogICAgICAgICAgICB9LCBuLnAgPSAnLycsIG4obi5zID0gMTUyKTsKICAgICAgICB9KFsKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IG4oMjYwKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig3KSwgbyA9IG4oMzYpLmYsIGkgPSBuKDIyKSwgYSA9IG4oMjMpLCBzID0gbig1NyksIGMgPSBuKDg3KSwgdSA9IG4oNjQpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiwgbCwgZiwgcCwgZCwgaCA9IGUudGFyZ2V0LCBtID0gZS5nbG9iYWwsIGcgPSBlLnN0YXQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSBtID8gciA6IGcgPyByW2hdIHx8IHMoaCwge30pIDogKHJbaF0gfHwge30pLnByb3RvdHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsIGluIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwID0gdFtsXSwgZiA9IGUubm9UYXJnZXRHZXQgPyAoZCA9IG8obiwgbCkpICYmIGQudmFsdWUgOiBuW2xdLCAhdShtID8gbCA6IGggKyAoZyA/ICcuJyA6ICcjJykgKyBsLCBlLmZvcmNlZCkgJiYgdm9pZCAwICE9PSBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBwID09PSB0eXBlb2YgZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhwLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIChlLnNoYW0gfHwgZiAmJiBmLnNoYW0pICYmIGkocCwgJ3NoYW0nLCAhMCksIGEobiwgbCwgcCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBuLmQodCwgJ2EnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBldDsKICAgICAgICAgICAgICAgICAgICB9KSwgbi5kKHQsICdiJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYmU7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuKDgzKSwgbyA9IG4ubihyKSwgaSA9IG4oMTQ4KSwgYSA9IG4ubihpKSwgcyA9IG4oMCksIGMgPSBuLm4ocyksIHUgPSBuKDE0OSksIGwgPSBuKDM0KSwgZiA9IG4oODQpLCBwID0gKG4oMTE4KSwgbigxNTApKSwgZCA9IG4oMTUxKSwgaCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gW2VbMF1dLCByID0gMCwgbyA9IHQubGVuZ3RoOyByIDwgbzsgciArPSAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucHVzaCh0W3JdLCBlW3IgKyAxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgbSA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3IgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBnID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdDYW5ub3QgY2FsbCBhIGNsYXNzIGFzIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgdC5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuZW51bWVyYWJsZSA9IHIuZW51bWVyYWJsZSB8fCAhMSwgci5jb25maWd1cmFibGUgPSAhMCwgJ3ZhbHVlJyBpbiByICYmIChyLndyaXRhYmxlID0gITApLCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgci5rZXksIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICYmIGUodC5wcm90b3R5cGUsIG4pLCByICYmIGUodCwgciksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KCksIHkgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG4sIHIpICYmIChlW3JdID0gbltyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgYiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIHQgJiYgbnVsbCAhPT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdTdXBlciBleHByZXNzaW9uIG11c3QgZWl0aGVyIGJlIG51bGwgb3IgYSBmdW5jdGlvbiwgbm90ICcgKyB0eXBlb2YgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByb3RvdHlwZSA9IE9iamVjdC5jcmVhdGUodCAmJiB0LnByb3RvdHlwZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0cnVjdG9yOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQgJiYgKE9iamVjdC5zZXRQcm90b3R5cGVPZiA/IE9iamVjdC5zZXRQcm90b3R5cGVPZihlLCB0KSA6IGUuX19wcm90b19fID0gdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIEUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBSZWZlcmVuY2VFcnJvcigndGhpcyBoYXNuXCd0IGJlZW4gaW5pdGlhbGlzZWQgLSBzdXBlcigpIGhhc25cJ3QgYmVlbiBjYWxsZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhdCB8fCAnb2JqZWN0JyAhPT0gdHlwZW9mIHQgJiYgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIHQgPyBlIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT09ICgndW5kZWZpbmVkJyA9PT0gdHlwZW9mIGUgPyAndW5kZWZpbmVkJyA6IG0oZSkpICYmIGUuY29uc3RydWN0b3IgPT09IE9iamVjdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgeCA9IE9iamVjdC5mcmVlemUoW10pLCBTID0gT2JqZWN0LmZyZWV6ZSh7fSk7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gayhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmRpc3BsYXlOYW1lIHx8IGUubmFtZSB8fCAnQ29tcG9uZW50JzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gVChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdzdHJpbmcnID09PSB0eXBlb2YgZS5zdHlsZWRDb21wb25lbnRJZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIF8gPSAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGUgJiYgKE9iamVjdCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBOT0RFX0VOVjogJ3Byb2R1Y3Rpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUFVCTElDX1VSTDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfTE9HX0FQSTogJ2h0dHBzOi8vYXVkaXQtdGNmdjIucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0dFT0lQX0FQSV9VUkw6ICdodHRwczovL2FwaXMucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvZ2VvaXAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0NNUF9DT09LSUVfQVBJOiAnaHR0cHM6Ly9hcGlzLnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL0Nvb2tpZUFjY2Vzc1YyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9HT09HTEVfQVRQX1VSTDogJ2h0dHBzOi8vcXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvZ29vZ2xlLWF0cC1saXN0Lmpzb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0NPTlNFTlRFRF9JREVOVElUWV9XRUJTSVRFX0FQSTogJ2h0dHBzOi8vYXBwLnBlcm1pc2lvLmNvbS9hcGknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX1ZFUlNJT046ICcyMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfQ01QVUlfU1JDOiAnaHR0cHM6Ly9xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy90Y2Z2Mi8yMy9jbXAydWkuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0dWTF9CQVNFX1VSTDogJ2h0dHBzOi8vcXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvR1ZMLXYyLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfVFJBTlNMQVRJT05fQkFTRV9VUkw6ICdodHRwczovL3d3dy5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy90Y2Z2Mi90cmFuc2xhdGlvbnMvJwogICAgICAgICAgICAgICAgICAgICAgICB9KS5SRUFDVF9BUFBfU0NfQVRUUiB8fCBPYmplY3QoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgTk9ERV9FTlY6ICdwcm9kdWN0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBVQkxJQ19VUkw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0xPR19BUEk6ICdodHRwczovL2F1ZGl0LXRjZnYyLnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9HRU9JUF9BUElfVVJMOiAnaHR0cHM6Ly9hcGlzLnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL2dlb2lwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9DTVBfQ09PS0lFX0FQSTogJ2h0dHBzOi8vYXBpcy5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9Db29raWVBY2Nlc3NWMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfR09PR0xFX0FUUF9VUkw6ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL3RjZnYyL2dvb2dsZS1hdHAtbGlzdC5qc29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9DT05TRU5URURfSURFTlRJVFlfV0VCU0lURV9BUEk6ICdodHRwczovL2FwcC5wZXJtaXNpby5jb20vYXBpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9WRVJTSU9OOiAnMjMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0NNUFVJX1NSQzogJ2h0dHBzOi8vcXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvMjMvY21wMnVpLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9HVkxfQkFTRV9VUkw6ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL0dWTC12Mi8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX1RSQU5TTEFUSU9OX0JBU0VfVVJMOiAnaHR0cHM6Ly93d3cucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvdHJhbnNsYXRpb25zLycKICAgICAgICAgICAgICAgICAgICAgICAgfSkuU0NfQVRUUikgfHwgJ2RhdGEtc3R5bGVkJywgUCA9ICd1bmRlZmluZWQnICE9PSB0eXBlb2Ygd2luZG93ICYmICdIVE1MRWxlbWVudCcgaW4gd2luZG93LCBPID0gJ2Jvb2xlYW4nID09PSB0eXBlb2YgU0NfRElTQUJMRV9TUEVFRFkgJiYgU0NfRElTQUJMRV9TUEVFRFkgfHwgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBlICYmIChPYmplY3QoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgTk9ERV9FTlY6ICdwcm9kdWN0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBVQkxJQ19VUkw6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0xPR19BUEk6ICdodHRwczovL2F1ZGl0LXRjZnYyLnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9HRU9JUF9BUElfVVJMOiAnaHR0cHM6Ly9hcGlzLnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL2dlb2lwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9DTVBfQ09PS0lFX0FQSTogJ2h0dHBzOi8vYXBpcy5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9Db29raWVBY2Nlc3NWMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfR09PR0xFX0FUUF9VUkw6ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL3RjZnYyL2dvb2dsZS1hdHAtbGlzdC5qc29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9DT05TRU5URURfSURFTlRJVFlfV0VCU0lURV9BUEk6ICdodHRwczovL2FwcC5wZXJtaXNpby5jb20vYXBpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9WRVJTSU9OOiAnMjMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0NNUFVJX1NSQzogJ2h0dHBzOi8vcXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvMjMvY21wMnVpLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9HVkxfQkFTRV9VUkw6ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL0dWTC12Mi8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX1RSQU5TTEFUSU9OX0JBU0VfVVJMOiAnaHR0cHM6Ly93d3cucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvdHJhbnNsYXRpb25zLycKICAgICAgICAgICAgICAgICAgICAgICAgfSkuUkVBQ1RfQVBQX1NDX0RJU0FCTEVfU1BFRURZIHx8IE9iamVjdCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBOT0RFX0VOVjogJ3Byb2R1Y3Rpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUFVCTElDX1VSTDogJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfTE9HX0FQSTogJ2h0dHBzOi8vYXVkaXQtdGNmdjIucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0dFT0lQX0FQSV9VUkw6ICdodHRwczovL2FwaXMucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvZ2VvaXAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0NNUF9DT09LSUVfQVBJOiAnaHR0cHM6Ly9hcGlzLnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL0Nvb2tpZUFjY2Vzc1YyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9HT09HTEVfQVRQX1VSTDogJ2h0dHBzOi8vcXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvdGNmdjIvZ29vZ2xlLWF0cC1saXN0Lmpzb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0NPTlNFTlRFRF9JREVOVElUWV9XRUJTSVRFX0FQSTogJ2h0dHBzOi8vYXBwLnBlcm1pc2lvLmNvbS9hcGknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX1ZFUlNJT046ICcyMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfQ01QVUlfU1JDOiAnaHR0cHM6Ly9xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy90Y2Z2Mi8yMy9jbXAydWkuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0dWTF9CQVNFX1VSTDogJ2h0dHBzOi8vcXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvR1ZMLXYyLycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfVFJBTlNMQVRJT05fQkFTRV9VUkw6ICdodHRwczovL3d3dy5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy90Y2Z2Mi90cmFuc2xhdGlvbnMvJwogICAgICAgICAgICAgICAgICAgICAgICB9KS5TQ19ESVNBQkxFX1NQRUVEWSkgfHwgITEsIEkgPSB7fTsKICAgICAgICAgICAgICAgICAgICB2YXIgTCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnKHRoaXMsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSBhcmd1bWVudHMubGVuZ3RoLCBvID0gQXJyYXkociA+IDEgPyByIC0gMSA6IDApLCBpID0gMTsgaSA8IHI7IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb1tpIC0gMV0gPSBhcmd1bWVudHNbaV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBFKHRoaXMsIGUuY2FsbCh0aGlzLCAnQW4gZXJyb3Igb2NjdXJyZWQuIFNlZSBodHRwczovL2dpdGh1Yi5jb20vc3R5bGVkLWNvbXBvbmVudHMvc3R5bGVkLWNvbXBvbmVudHMvYmxvYi9tYXN0ZXIvcGFja2FnZXMvc3R5bGVkLWNvbXBvbmVudHMvc3JjL3V0aWxzL2Vycm9ycy5tZCMnICsgbiArICcgZm9yIG1vcmUgaW5mb3JtYXRpb24uJyArIChvLmxlbmd0aCA+IDAgPyAnIEFkZGl0aW9uYWwgYXJndW1lbnRzOiAnICsgby5qb2luKCcsICcpIDogJycpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEUoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYih0LCBlKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfShFcnJvciksIEEgPSAvXlteXFNcbl0qP1wvXCogc2MtY29tcG9uZW50LWlkOlxzKihcUyspXHMrXCpcLy9nbSwgUiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICcnICsgKGUgfHwgJycpLCBuID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5yZXBsYWNlKEEsIGZ1bmN0aW9uIChlLCB0LCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBvbmVudElkOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXRjaEluZGV4OiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbi5tYXAoZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGUuY29tcG9uZW50SWQsIGkgPSBlLm1hdGNoSW5kZXgsIGEgPSBuW3IgKyAxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRJZDogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3NzRnJvbURPTTogYSA/IHQuc2xpY2UoaSwgYS5tYXRjaEluZGV4KSA6IHQuc2xpY2UoaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE4gPSAvXlxzKlwvXC8uKiQvZ20sIGogPSBuZXcgby5hKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdsb2JhbDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNjYWRlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleWZyYW1lOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWZpeDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wcmVzczogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW1pY29sb246ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBxID0gbmV3IG8uYSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnbG9iYWw6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzY2FkZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXlmcmFtZTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVmaXg6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcHJlc3M6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VtaWNvbG9uOiAhMQogICAgICAgICAgICAgICAgICAgICAgICB9KSwgRiA9IFtdLCBEID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtMiA9PT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gRjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRiA9IFtdLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LCBNID0gYSgpKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBGLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBVID0gdm9pZCAwLCBWID0gdm9pZCAwLCBCID0gdm9pZCAwLCB6ID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID4gMCAmJiAtMSAhPT0gbi5zbGljZSgwLCB0KS5pbmRleE9mKFYpICYmIG4uc2xpY2UodCAtIFYubGVuZ3RoLCB0KSAhPT0gViA/ICcuJyArIFUgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHEudXNlKFsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIgPT09IGUgJiYgbi5sZW5ndGggJiYgblswXS5sYXN0SW5kZXhPZihWKSA+IDAgJiYgKG5bMF0gPSBuWzBdLnJlcGxhY2UoQiwgeikpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBNLAogICAgICAgICAgICAgICAgICAgICAgICBECiAgICAgICAgICAgICAgICAgICAgXSksIGoudXNlKFsKICAgICAgICAgICAgICAgICAgICAgICAgTSwKICAgICAgICAgICAgICAgICAgICAgICAgRAogICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgIHZhciBHID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGooJycsIGUpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gSChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gYXJndW1lbnRzLmxlbmd0aCA+IDMgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbM10gPyBhcmd1bWVudHNbM10gOiAnJicsIG8gPSBlLmpvaW4oJycpLnJlcGxhY2UoTiwgJycpLCBpID0gdCAmJiBuID8gbiArICcgJyArIHQgKyAnIHsgJyArIG8gKyAnIH0nIDogbzsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFUgPSByLCBWID0gdCwgQiA9IG5ldyBSZWdFeHAoJ1xcJyArIFYgKyAnXFxiJywgJ2cnKSwgcShuIHx8ICF0ID8gJycgOiB0LCBpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIFcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5uYzsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgJCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmICgoZVt0XSB8fCAoZVt0XSA9IE9iamVjdC5jcmVhdGUobnVsbCkpKVtuXSA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgWSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3RdID0gT2JqZWN0LmNyZWF0ZShudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgUSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBlW3RdICYmIGVbdF1bbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9LCBLID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSBPYmplY3Qua2V5cyhlW25dKS5qb2luKCcgJykgKyAnICc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50cmltKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIEogPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuc2hlZXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc2hlZXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gZS5vd25lckRvY3VtZW50LnN0eWxlU2hlZXRzLmxlbmd0aCwgbiA9IDA7IG4gPCB0OyBuICs9IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUub3duZXJEb2N1bWVudC5zdHlsZVNoZWV0c1tuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5vd25lck5vZGUgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEwoMTApOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBYID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuY3NzUnVsZXMubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmluc2VydFJ1bGUodCwgbiA8PSByID8gbiA6IHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgWiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1xuLyogc2MtY29tcG9uZW50LWlkOiAnICsgZSArICcgKi9cbic7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGVlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0gMDsgciA8PSB0OyByICs9IDEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiArPSBlW3JdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gVygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnPHN0eWxlICcgKyBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgJ25vbmNlPSInICsgciArICciJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXyArICc9IicgKyBLKHQpICsgJyInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGF0YS1zdHlsZWQtdmVyc2lvbj0iNC40LjEiJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uZmlsdGVyKEJvb2xlYW4pLmpvaW4oJyAnKSArICc+JyArIGUoKSArICc8L3N0eWxlPic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9LCBuZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByID0gKChuID0ge30pW19dID0gSyh0KSwgblsnZGF0YS1zdHlsZWQtdmVyc2lvbiddID0gJzQuNC4xJywgbiksIG8gPSBXKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gJiYgKHIubm9uY2UgPSBvKSwgYy5hLmNyZWF0ZUVsZW1lbnQoJ3N0eWxlJywgeSh7fSwgciwgeyBkYW5nZXJvdXNseVNldElubmVySFRNTDogeyBfX2h0bWw6IGUoKSB9IH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHJlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgb2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY3JlYXRlVGV4dE5vZGUoWih0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGllID0gZnVuY3Rpb24gZSh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHZvaWQgMCA9PT0gdCA/IE9iamVjdC5jcmVhdGUobnVsbCkgOiB0LCBvID0gdm9pZCAwID09PSBuID8gT2JqZWN0LmNyZWF0ZShudWxsKSA6IG4sIGkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG9bZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IHQgPyB0IDogb1tlXSA9IFsnJ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCBpbiBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG9bdF1bMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIChlICs9IFoodCkgKyBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbG9uZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3QuY3JlYXRlKG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtuXSA9IHkoe30sIGVbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShyKSwgbiA9IE9iamVjdC5jcmVhdGUobnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgaW4gbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5baV0gPSBbb1tpXVswXV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3NzOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldElkczogcmUobyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzTmFtZUZvcklkOiBRKHIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluc2VydE1hcmtlcjogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnNlcnRSdWxlczogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShlKVswXSArPSB0LmpvaW4oJyAnKSwgJChyLCBlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZVJ1bGVzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG9bZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gdCAmJiAodFswXSA9ICcnLCBZKHIsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlYWxlZDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3R5bGVUYWc6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9FbGVtZW50OiBuZShhLCByKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b0hUTUw6IHRlKGEsIHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9LCBhZSA9IGZ1bmN0aW9uIChlLCB0LCBuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoUCAmJiAhbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBkb2N1bWVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA/IHIgPSBlLm93bmVyRG9jdW1lbnQgOiB0ICYmIChyID0gdC5vd25lckRvY3VtZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByLmNyZWF0ZUVsZW1lbnQoJ3N0eWxlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uc2V0QXR0cmlidXRlKF8sICcnKSwgby5zZXRBdHRyaWJ1dGUoJ2RhdGEtc3R5bGVkLXZlcnNpb24nLCAnNC40LjEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBXKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpICYmIG8uc2V0QXR0cmlidXRlKCdub25jZScsIGkpLCBvLmFwcGVuZENoaWxkKHIuY3JlYXRlVGV4dE5vZGUoJycpKSwgZSAmJiAhdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuYXBwZW5kQ2hpbGQobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0IHx8ICFlIHx8ICF0LnBhcmVudE5vZGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEwoNik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKG8sIG4gPyB0IDogdC5uZXh0U2libGluZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlLCB0LCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTyA/IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gT2JqZWN0LmNyZWF0ZShudWxsKSwgciA9IE9iamVjdC5jcmVhdGUobnVsbCksIG8gPSB2b2lkIDAgIT09IHQsIGkgPSAhMSwgYSA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IG8gPyBvIDogKHJbdF0gPSBvZShlLm93bmVyRG9jdW1lbnQsIHQpLCBlLmFwcGVuZENoaWxkKHJbdF0pLCBuW3RdID0gT2JqZWN0LmNyZWF0ZShudWxsKSwgclt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCBpbiByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICs9IHJbdF0uZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbG9uZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBMKDUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNzczogcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldElkczogcmUociksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNOYW1lRm9ySWQ6IFEobiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnNlcnRNYXJrZXI6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnNlcnRSdWxlczogZnVuY3Rpb24gKGUsIHIsIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gYShlKSwgdSA9IFtdLCBsID0gci5sZW5ndGgsIGYgPSAwOyBmIDwgbDsgZiArPSAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gcltmXSwgZCA9IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkICYmIC0xICE9PSBwLmluZGV4T2YoJ0BpbXBvcnQnKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUucHVzaChwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGYgPT09IGwgLSAxID8gJycgOiAnICc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmFwcGVuZERhdGEoJycgKyBwICsgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJChuLCBlLCBzKSwgbyAmJiB1Lmxlbmd0aCA+IDAgJiYgKGkgPSAhMCwgdCgpLmluc2VydFJ1bGVzKGUgKyAnLWltcG9ydCcsIHUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVSdWxlczogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHJbYV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG9lKGUub3duZXJEb2N1bWVudCwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucmVwbGFjZUNoaWxkKGMsIHMpLCByW2FdID0gYywgWShuLCBhKSwgbyAmJiBpICYmIHQoKS5yZW1vdmVSdWxlcyhhICsgJy1pbXBvcnQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VhbGVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0eWxlVGFnOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9FbGVtZW50OiBuZShzLCBuKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvSFRNTDogdGUocywgbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGksIG8pIDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QuY3JlYXRlKG51bGwpLCByID0gT2JqZWN0LmNyZWF0ZShudWxsKSwgbyA9IFtdLCBpID0gdm9pZCAwICE9PSB0LCBhID0gITEsIHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcltlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSB0ID8gdCA6IChyW2VdID0gby5sZW5ndGgsIG8ucHVzaCgwKSwgWShuLCBlKSwgcltlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gSihlKS5jc3NSdWxlcywgbiA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgaW4gcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICs9IFooaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSByW2ldLCBzID0gZWUobywgYSksIGMgPSBzIC0gb1thXTsgYyA8IHM7IGMgKz0gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSB0W2NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSB1ICYmIChuICs9IHUuY3NzVGV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xvbmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTCg1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjc3M6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRJZHM6IHJlKHIpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzTmFtZUZvcklkOiBRKG4pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5zZXJ0TWFya2VyOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5zZXJ0UnVsZXM6IGZ1bmN0aW9uIChyLCBjLCB1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbCA9IHMociksIGYgPSBKKGUpLCBwID0gZWUobywgbCksIGQgPSAwLCBoID0gW10sIG0gPSBjLmxlbmd0aCwgZyA9IDA7IGcgPCBtOyBnICs9IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSBjW2ddLCB5ID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeSAmJiAtMSAhPT0gdi5pbmRleE9mKCdAaW1wb3J0JykgPyBoLnB1c2godikgOiBYKGYsIHYsIHAgKyBkKSAmJiAoeSA9ICExLCBkICs9IDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpICYmIGgubGVuZ3RoID4gMCAmJiAoYSA9ICEwLCB0KCkuaW5zZXJ0UnVsZXMociArICctaW1wb3J0JywgaCkpLCBvW2xdICs9IGQsICQobiwgciwgdSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlUnVsZXM6IGZ1bmN0aW9uIChzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSByW3NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IGMgJiYgITEgIT09IGUuaXNDb25uZWN0ZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBvW2NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSB0IC0gbiwgbyA9IHQ7IG8gPiByOyBvIC09IDEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5kZWxldGVSdWxlKG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KEooZSksIGVlKG8sIGMpIC0gMSwgdSksIG9bY10gPSAwLCBZKG4sIHMpLCBpICYmIGEgJiYgdCgpLnJlbW92ZVJ1bGVzKHMgKyAnLWltcG9ydCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWFsZWQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3R5bGVUYWc6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b0VsZW1lbnQ6IG5lKGMsIG4pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9IVE1MOiB0ZShjLCBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oaSwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgc2UgPSAvXHMrLywgY2UgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgY2UgPSBQID8gTyA/IDQwIDogMTAwMCA6IC0xOwogICAgICAgICAgICAgICAgICAgIHZhciB1ZSA9IDAsIGxlID0gdm9pZCAwLCBmZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLCBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiBQID8gZG9jdW1lbnQuaGVhZCA6IG51bGwsIHIgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSAmJiBhcmd1bWVudHNbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyh0aGlzLCBlKSwgdGhpcy5nZXRJbXBvcnRSdWxlVGFnID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHQuaW1wb3J0UnVsZVRhZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQudGFnc1swXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuaW1wb3J0UnVsZVRhZyA9IGFlKHQudGFyZ2V0LCBuID8gbi5zdHlsZVRhZyA6IG51bGwsIHQuZm9yY2VTZXJ2ZXIsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB1ZSArPSAxLCB0aGlzLmlkID0gdWUsIHRoaXMuZm9yY2VTZXJ2ZXIgPSByLCB0aGlzLnRhcmdldCA9IHIgPyBudWxsIDogbiwgdGhpcy50YWdNYXAgPSB7fSwgdGhpcy5kZWZlcnJlZCA9IHt9LCB0aGlzLnJlaHlkcmF0ZWROYW1lcyA9IHt9LCB0aGlzLmlnbm9yZVJlaHlkcmF0ZWROYW1lcyA9IHt9LCB0aGlzLnRhZ3MgPSBbXSwgdGhpcy5jYXBhY2l0eSA9IDEsIHRoaXMuY2xvbmVzID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUucmVoeWRyYXRlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghUCB8fCB0aGlzLmZvcmNlU2VydmVyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFtdLCB0ID0gW10sIG4gPSAhMSwgciA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoJ3N0eWxlWycgKyBfICsgJ11bZGF0YS1zdHlsZWQtdmVyc2lvbj0iNC40LjEiXScpLCBvID0gci5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IG87IGkgKz0gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHJbaV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gfHwgKG4gPSAhIWEuZ2V0QXR0cmlidXRlKCdkYXRhLXN0eWxlZC1zdHJlYW1lZCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgcywgYyA9IChhLmdldEF0dHJpYnV0ZShfKSB8fCAnJykudHJpbSgpLnNwbGl0KHNlKSwgdSA9IGMubGVuZ3RoLCBsID0gMDsgbCA8IHU7IGwgKz0gMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSBjW2xdLCB0aGlzLnJlaHlkcmF0ZWROYW1lc1tzXSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2guYXBwbHkodCwgUihhLnRleHRDb250ZW50KSksIGUucHVzaChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSB0Lmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gdGhpcy5tYWtlVGFnKG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMCwgbyA9IG4ubGVuZ3RoOyByIDwgbzsgciArPSAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG5bcl0sIGEgPSBpLmNvbXBvbmVudElkLCBzID0gaS5jc3NGcm9tRE9NLCBjID0gRyhzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaW5zZXJ0UnVsZXMoYSwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdSA9IDAsIGwgPSB0Lmxlbmd0aDsgdSA8IGw7IHUgKz0gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSB0W3VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5wYXJlbnROb2RlICYmIGYucGFyZW50Tm9kZS5yZW1vdmVDaGlsZChmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0ocCwgZSwgdCksIHRoaXMuY2FwYWNpdHkgPSBNYXRoLm1heCgxLCBjZSAtIGYpLCB0aGlzLnRhZ3MucHVzaChwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gMDsgZCA8IGY7IGQgKz0gMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy50YWdNYXBbdFtkXS5jb21wb25lbnRJZF0gPSBwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5yZXNldCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdICYmIGFyZ3VtZW50c1swXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZSA9IG5ldyBlKHZvaWQgMCwgdCkucmVoeWRyYXRlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5jbG9uZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG5ldyBlKHRoaXMudGFyZ2V0LCB0aGlzLmZvcmNlU2VydmVyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jbG9uZXMucHVzaCh0KSwgdC50YWdzID0gdGhpcy50YWdzLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gZS5nZXRJZHMoKSwgciA9IGUuY2xvbmUoKSwgbyA9IDA7IG8gPCBuLmxlbmd0aDsgbyArPSAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC50YWdNYXBbbltvXV0gPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5yZWh5ZHJhdGVkTmFtZXMgPSB5KHt9LCB0aGlzLnJlaHlkcmF0ZWROYW1lcyksIHQuZGVmZXJyZWQgPSB5KHt9LCB0aGlzLmRlZmVycmVkKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnNlYWxBbGxUYWdzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2FwYWNpdHkgPSAxLCB0aGlzLnRhZ3MuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNlYWxlZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUubWFrZVRhZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlID8gZS5zdHlsZVRhZyA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFlKHRoaXMudGFyZ2V0LCB0LCB0aGlzLmZvcmNlU2VydmVyLCAhMSwgdGhpcy5nZXRJbXBvcnRSdWxlVGFnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLmdldFRhZ0ZvcklkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMudGFnTWFwW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IHQgJiYgIXQuc2VhbGVkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMudGFnc1t0aGlzLnRhZ3MubGVuZ3RoIC0gMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY2FwYWNpdHkgLT0gMSwgMCA9PT0gdGhpcy5jYXBhY2l0eSAmJiAodGhpcy5jYXBhY2l0eSA9IGNlLCBuID0gdGhpcy5tYWtlVGFnKG4pLCB0aGlzLnRhZ3MucHVzaChuKSksIHRoaXMudGFnTWFwW2VdID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLmhhc0lkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSB0aGlzLnRhZ01hcFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLmhhc05hbWVGb3JJZCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gdGhpcy5pZ25vcmVSZWh5ZHJhdGVkTmFtZXNbZV0gJiYgdGhpcy5yZWh5ZHJhdGVkTmFtZXNbdF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMudGFnTWFwW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IG4gJiYgbi5oYXNOYW1lRm9ySWQoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5kZWZlcnJlZEluamVjdCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gdGhpcy50YWdNYXBbZV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IHRoaXMuY2xvbmVzLCByID0gMDsgciA8IG4ubGVuZ3RoOyByICs9IDEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3JdLmRlZmVycmVkSW5qZWN0KGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmdldFRhZ0ZvcklkKGUpLmluc2VydE1hcmtlcihlKSwgdGhpcy5kZWZlcnJlZFtlXSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuaW5qZWN0ID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gdGhpcy5jbG9uZXMsIG8gPSAwOyBvIDwgci5sZW5ndGg7IG8gKz0gMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcltvXS5pbmplY3QoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0aGlzLmdldFRhZ0ZvcklkKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IHRoaXMuZGVmZXJyZWRbZV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLmRlZmVycmVkW2VdLmNvbmNhdCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5pbnNlcnRSdWxlcyhlLCBhLCBuKSwgdGhpcy5kZWZlcnJlZFtlXSA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5pbnNlcnRSdWxlcyhlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnJlbW92ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLnRhZ01hcFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSB0aGlzLmNsb25lcywgciA9IDA7IHIgPCBuLmxlbmd0aDsgciArPSAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbltyXS5yZW1vdmUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucmVtb3ZlUnVsZXMoZSksIHRoaXMuaWdub3JlUmVoeWRyYXRlZE5hbWVzW2VdID0gITAsIHRoaXMuZGVmZXJyZWRbZV0gPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUudG9IVE1MID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRhZ3MubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRvSFRNTCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUudG9SZWFjdEVsZW1lbnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5pZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy50YWdzLm1hcChmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICdzYy0nICsgZSArICctJyArIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qocy5jbG9uZUVsZW1lbnQpKHQudG9FbGVtZW50KCksIHsga2V5OiByIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdihlLCBudWxsLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdtYXN0ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsZSB8fCAobGUgPSBuZXcgZSgpLnJlaHlkcmF0ZSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdpbnN0YW5jZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubWFzdGVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgcGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyh0aGlzLCBlKSwgdGhpcy5pbmplY3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmhhc05hbWVGb3JJZChyLmlkLCByLm5hbWUpIHx8IGUuaW5qZWN0KHIuaWQsIHIucnVsZXMsIHIubmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEwoMTIsIFN0cmluZyhyLm5hbWUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLm5hbWUgPSB0LCB0aGlzLnJ1bGVzID0gbiwgdGhpcy5pZCA9ICdzYy1rZXlmcmFtZXMtJyArIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuZ2V0TmFtZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5uYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCBkZSA9IC8oW0EtWl0pL2csIGhlID0gL15tcy0vOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG1lKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVwbGFjZShkZSwgJy0kMScpLnRvTG93ZXJDYXNlKCkucmVwbGFjZShoZSwgJy1tcy0nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGdlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGUgfHwgbnVsbCA9PT0gZSB8fCAhMSA9PT0gZSB8fCAnJyA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdmUgPSBmdW5jdGlvbiBlKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXModCkuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZ2UodFtuXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHcodFtuXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5wdXNoLmFwcGx5KHIsIGUodFtuXSwgbikpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQyh0W25dKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLnB1c2gobWUobikgKyAnOicsIHRbbl0sICc7JyksIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaChtZShuKSArICc6ICcgKyAobyA9IG4sIChudWxsID09IChpID0gdFtuXSkgfHwgJ2Jvb2xlYW4nID09PSB0eXBlb2YgaSB8fCAnJyA9PT0gaSA/ICcnIDogJ251bWJlcicgIT09IHR5cGVvZiBpIHx8IDAgPT09IGkgfHwgbyBpbiB1LmEgPyBTdHJpbmcoaSkudHJpbSgpIDogaSArICdweCcpICsgJzsnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG4gPyBbbiArICcgeyddLmNvbmNhdChyLCBbJ30nXSkgOiByOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHllKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIsIG8gPSBbXSwgaSA9IDAsIGEgPSBlLmxlbmd0aDsgaSA8IGE7IGkgKz0gMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9PSAociA9IHllKGVbaV0sIHQsIG4pKSAmJiAoQXJyYXkuaXNBcnJheShyKSA/IG8ucHVzaC5hcHBseShvLCByKSA6IG8ucHVzaChyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2UoZSkgPyBudWxsIDogVChlKSA/ICcuJyArIGUuc3R5bGVkQ29tcG9uZW50SWQgOiBDKGUpID8gJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIChzID0gZSkgfHwgcy5wcm90b3R5cGUgJiYgcy5wcm90b3R5cGUuaXNSZWFjdENvbXBvbmVudCB8fCAhdCA/IGUgOiB5ZShlKHQpLCB0LCBuKSA6IGUgaW5zdGFuY2VvZiBwZSA/IG4gPyAoZS5pbmplY3QobiksIGUuZ2V0TmFtZSgpKSA6IGUgOiB3KGUpID8gdmUoZSkgOiBlLnRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBiZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoLCBuID0gQXJyYXkodCA+IDEgPyB0IC0gMSA6IDApLCByID0gMTsgciA8IHQ7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bciAtIDFdID0gYXJndW1lbnRzW3JdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQyhlKSB8fCB3KGUpID8geWUoaCh4LCBbZV0uY29uY2F0KG4pKSkgOiB5ZShoKGUsIG4pKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRWUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0LCBuID0gMCB8IGUubGVuZ3RoLCByID0gMCB8IG4sIG8gPSAwOyBuID49IDQ7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IDE1NDA0ODM0NzcgKiAoNjU1MzUgJiAodCA9IDI1NSAmIGUuY2hhckNvZGVBdChvKSB8ICgyNTUgJiBlLmNoYXJDb2RlQXQoKytvKSkgPDwgOCB8ICgyNTUgJiBlLmNoYXJDb2RlQXQoKytvKSkgPDwgMTYgfCAoMjU1ICYgZS5jaGFyQ29kZUF0KCsrbykpIDw8IDI0KSkgKyAoKDE1NDA0ODM0NzcgKiAodCA+Pj4gMTYpICYgNjU1MzUpIDw8IDE2KSwgciA9IDE1NDA0ODM0NzcgKiAoNjU1MzUgJiByKSArICgoMTU0MDQ4MzQ3NyAqIChyID4+PiAxNikgJiA2NTUzNSkgPDwgMTYpIF4gKHQgPSAxNTQwNDgzNDc3ICogKDY1NTM1ICYgKHQgXj0gdCA+Pj4gMjQpKSArICgoMTU0MDQ4MzQ3NyAqICh0ID4+PiAxNikgJiA2NTUzNSkgPDwgMTYpKSwgbiAtPSA0LCArK287CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByIF49ICgyNTUgJiBlLmNoYXJDb2RlQXQobyArIDIpKSA8PCAxNjsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgciBePSAoMjU1ICYgZS5jaGFyQ29kZUF0KG8gKyAxKSkgPDwgODsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IDE1NDA0ODM0NzcgKiAoNjU1MzUgJiAociBePSAyNTUgJiBlLmNoYXJDb2RlQXQobykpKSArICgoMTU0MDQ4MzQ3NyAqIChyID4+PiAxNikgJiA2NTUzNSkgPDwgMTYpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoKHIgPSAxNTQwNDgzNDc3ICogKDY1NTM1ICYgKHIgXj0gciA+Pj4gMTMpKSArICgoMTU0MDQ4MzQ3NyAqIChyID4+PiAxNikgJiA2NTUzNSkgPDwgMTYpKSBeIHIgPj4+IDE1KSA+Pj4gMDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIHdlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFN0cmluZy5mcm9tQ2hhckNvZGUoZSArIChlID4gMjUgPyAzOSA6IDk3KSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB4ZShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJycsIG4gPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IGU7IG4gPiA1MjsgbiA9IE1hdGguZmxvb3IobiAvIDUyKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB3ZShuICUgNTIpICsgdDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdlKG4gJSA1MikgKyB0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBTZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgZS5sZW5ndGg7IG4gKz0gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkocikgJiYgIVNlKHIsIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDKHIpICYmICFUKHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXQuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMoZSkgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0IGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChDKGVbdF0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgQ2UsIGtlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4ZShFZShlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFRlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSh0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyh0aGlzLCBlKSwgdGhpcy5ydWxlcyA9IHQsIHRoaXMuaXNTdGF0aWMgPSBTZSh0LCBuKSwgdGhpcy5jb21wb25lbnRJZCA9IHIsIGZlLm1hc3Rlci5oYXNJZChyKSB8fCBmZS5tYXN0ZXIuZGVmZXJyZWRJbmplY3QociwgW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJvdG90eXBlLmdlbmVyYXRlQW5kSW5qZWN0U3R5bGVzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuaXNTdGF0aWMsIHIgPSB0aGlzLmNvbXBvbmVudElkLCBvID0gdGhpcy5sYXN0Q2xhc3NOYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChQICYmIG4gJiYgJ3N0cmluZycgPT09IHR5cGVvZiBvICYmIHQuaGFzTmFtZUZvcklkKHIsIG8pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHllKHRoaXMucnVsZXMsIGUsIHQpLCBhID0ga2UodGhpcy5jb21wb25lbnRJZCArIGkuam9pbignJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lmhhc05hbWVGb3JJZChyLCBhKSB8fCB0LmluamVjdCh0aGlzLmNvbXBvbmVudElkLCBIKGksICcuJyArIGEsIHZvaWQgMCwgciksIGEpLCB0aGlzLmxhc3RDbGFzc05hbWUgPSBhLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5nZW5lcmF0ZU5hbWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBrZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgX2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHMubGVuZ3RoID4gMiAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1syXSA/IGFyZ3VtZW50c1syXSA6IFMsIHIgPSAhIW4gJiYgZS50aGVtZSA9PT0gbi50aGVtZSwgbyA9IGUudGhlbWUgJiYgIXIgPyBlLnRoZW1lIDogdCB8fCBuLnRoZW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFBlID0gL1tbXF0uIyokPjwrfj18XjooKSwiJ2AtXSsvZywgT2UgPSAvKF4tfC0kKS9nOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEllKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVwbGFjZShQZSwgJy0nKS5yZXBsYWNlKE9lLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIExlKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09PSB0eXBlb2YgZSAmJiAhMDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIEFlID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGRDb250ZXh0VHlwZXM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dFR5cGVzOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRQcm9wczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXREZXJpdmVkU3RhdGVGcm9tUHJvcHM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcFR5cGVzOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFJlID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW5ndGg6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvdG90eXBlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxlcjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsZWU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJndW1lbnRzOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyaXR5OiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9LCBOZSA9ICgoQ2UgPSB7fSlbbC5Gb3J3YXJkUmVmXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICQkdHlwZW9mOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbmRlcjogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSwgQ2UpLCBqZSA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0eSwgcWUgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcywgRmUgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzLCBEZSA9IHZvaWQgMCA9PT0gRmUgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBGZSwgTWUgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yLCBVZSA9IE9iamVjdC5nZXRQcm90b3R5cGVPZiwgVmUgPSBPYmplY3QucHJvdG90eXBlLCBCZSA9IEFycmF5LnByb3RvdHlwZTsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB6ZShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPT0gdHlwZW9mIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gVWUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYmIHIgIT09IFZlICYmIHplKGUsIHIsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbyA9IEJlLmNvbmNhdChxZSh0KSwgRGUodCkpLCBpID0gTmVbZS4kJHR5cGVvZl0gfHwgQWUsIGEgPSBOZVt0LiQkdHlwZW9mXSB8fCBBZSwgcyA9IG8ubGVuZ3RoLCBjID0gdm9pZCAwLCB1ID0gdm9pZCAwOyBzLS07KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1ID0gb1tzXSwgIVJlW3VdICYmICghbiB8fCAhblt1XSkgJiYgKCFhIHx8ICFhW3VdKSAmJiAoIWkgfHwgIWlbdV0pICYmIChjID0gTWUodCwgdSkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamUoZSwgdSwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciBHZSA9IE9iamVjdChzLmNyZWF0ZUNvbnRleHQpKCksIEhlID0gR2UuQ29uc3VtZXIsIFdlID0gKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnKHRoaXMsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gRSh0aGlzLCBlLmNhbGwodGhpcywgbikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmdldENvbnRleHQgPSBPYmplY3QoZi5hKShyLmdldENvbnRleHQuYmluZChyKSksIHIucmVuZGVySW5uZXIgPSByLnJlbmRlcklubmVyLmJpbmQociksIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKHQsIGUpLCB0LnByb3RvdHlwZS5yZW5kZXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucHJvcHMuY2hpbGRyZW4gPyBjLmEuY3JlYXRlRWxlbWVudChHZS5Db25zdW1lciwgbnVsbCwgdGhpcy5yZW5kZXJJbm5lcikgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUucmVuZGVySW5uZXIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcy5nZXRDb250ZXh0KHRoaXMucHJvcHMudGhlbWUsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmEuY3JlYXRlRWxlbWVudChHZS5Qcm92aWRlciwgeyB2YWx1ZTogdCB9LCB0aGlzLnByb3BzLmNoaWxkcmVuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFRoZW1lID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQyhlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGUgfHwgQXJyYXkuaXNBcnJheShlKSB8fCAnb2JqZWN0JyAhPT0gKCd1bmRlZmluZWQnID09PSB0eXBlb2YgZSA/ICd1bmRlZmluZWQnIDogbShlKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBMKDgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5KHt9LCB0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldENvbnRleHQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldFRoZW1lKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfShzLkNvbXBvbmVudCksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyh0aGlzLCBlKSwgdGhpcy5tYXN0ZXJTaGVldCA9IGZlLm1hc3RlciwgdGhpcy5pbnN0YW5jZSA9IHRoaXMubWFzdGVyU2hlZXQuY2xvbmUoKSwgdGhpcy5zZWFsZWQgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHJvdG90eXBlLnNlYWwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLnNlYWxlZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMubWFzdGVyU2hlZXQuY2xvbmVzLmluZGV4T2YodGhpcy5pbnN0YW5jZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubWFzdGVyU2hlZXQuY2xvbmVzLnNwbGljZShlLCAxKSwgdGhpcy5zZWFsZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5jb2xsZWN0U3R5bGVzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zZWFsZWQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBMKDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmEuY3JlYXRlRWxlbWVudChZZSwgeyBzaGVldDogdGhpcy5pbnN0YW5jZSB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLmdldFN0eWxlVGFncyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zZWFsKCksIHRoaXMuaW5zdGFuY2UudG9IVE1MKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5nZXRTdHlsZUVsZW1lbnQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2VhbCgpLCB0aGlzLmluc3RhbmNlLnRvUmVhY3RFbGVtZW50cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuaW50ZXJsZWF2ZVdpdGhOb2RlU3RyZWFtID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTCgzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgT2JqZWN0KHMuY3JlYXRlQ29udGV4dCkoKSksICRlID0gV2UuQ29uc3VtZXIsIFllID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcodGhpcywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBFKHRoaXMsIGUuY2FsbCh0aGlzLCBuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuZ2V0Q29udGV4dCA9IE9iamVjdChmLmEpKHIuZ2V0Q29udGV4dCksIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYih0LCBlKSwgdC5wcm90b3R5cGUuZ2V0Q29udGV4dCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGZlKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBMKDQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUucmVuZGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5wcm9wcywgdCA9IGUuY2hpbGRyZW4sIG4gPSBlLnNoZWV0LCByID0gZS50YXJnZXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuYS5jcmVhdGVFbGVtZW50KFdlLlByb3ZpZGVyLCB7IHZhbHVlOiB0aGlzLmdldENvbnRleHQobiwgcikgfSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9KHMuQ29tcG9uZW50KSwgUWUgPSB7fTsKICAgICAgICAgICAgICAgICAgICB2YXIgS2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZyh0aGlzLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gRSh0aGlzLCBlLmNhbGwodGhpcykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uYXR0cnMgPSB7fSwgbi5yZW5kZXJPdXRlciA9IG4ucmVuZGVyT3V0ZXIuYmluZChuKSwgbi5yZW5kZXJJbm5lciA9IG4ucmVuZGVySW5uZXIuYmluZChuKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYih0LCBlKSwgdC5wcm90b3R5cGUucmVuZGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuYS5jcmVhdGVFbGVtZW50KCRlLCBudWxsLCB0aGlzLnJlbmRlck91dGVyKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUucmVuZGVyT3V0ZXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDogZmUubWFzdGVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3R5bGVTaGVldCA9IGUsIHRoaXMucHJvcHMuZm9yd2FyZGVkQ29tcG9uZW50LmNvbXBvbmVudFN0eWxlLmlzU3RhdGljID8gdGhpcy5yZW5kZXJJbm5lcigpIDogYy5hLmNyZWF0ZUVsZW1lbnQoSGUsIG51bGwsIHRoaXMucmVuZGVySW5uZXIpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5yZW5kZXJJbm5lciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMucHJvcHMuZm9yd2FyZGVkQ29tcG9uZW50LCBuID0gdC5jb21wb25lbnRTdHlsZSwgciA9IHQuZGVmYXVsdFByb3BzLCBvID0gKHQuZGlzcGxheU5hbWUsIHQuZm9sZGVkQ29tcG9uZW50SWRzKSwgaSA9IHQuc3R5bGVkQ29tcG9uZW50SWQsIGEgPSB0LnRhcmdldCwgYyA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBuLmlzU3RhdGljID8gdGhpcy5nZW5lcmF0ZUFuZEluamVjdFN0eWxlcyhTLCB0aGlzLnByb3BzKSA6IHRoaXMuZ2VuZXJhdGVBbmRJbmplY3RTdHlsZXMoX2UodGhpcy5wcm9wcywgZSwgcikgfHwgUywgdGhpcy5wcm9wcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHRoaXMucHJvcHMuYXMgfHwgdGhpcy5hdHRycy5hcyB8fCBhLCBsID0gTGUodSksIGYgPSB7fSwgZCA9IHkoe30sIHRoaXMucHJvcHMsIHRoaXMuYXR0cnMpLCBoID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChoIGluIGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2ZvcndhcmRlZENvbXBvbmVudCcgIT09IGggJiYgJ2FzJyAhPT0gaCAmJiAoJ2ZvcndhcmRlZFJlZicgPT09IGggPyBmLnJlZiA9IGRbaF0gOiAnZm9yd2FyZGVkQXMnID09PSBoID8gZi5hcyA9IGRbaF0gOiBsICYmICFPYmplY3QocC5hKShoKSB8fCAoZltoXSA9IGRbaF0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnByb3BzLnN0eWxlICYmIHRoaXMuYXR0cnMuc3R5bGUgJiYgKGYuc3R5bGUgPSB5KHt9LCB0aGlzLmF0dHJzLnN0eWxlLCB0aGlzLnByb3BzLnN0eWxlKSksIGYuY2xhc3NOYW1lID0gQXJyYXkucHJvdG90eXBlLmNvbmNhdChvLCBpLCBjICE9PSBpID8gYyA6IG51bGwsIHRoaXMucHJvcHMuY2xhc3NOYW1lLCB0aGlzLmF0dHJzLmNsYXNzTmFtZSkuZmlsdGVyKEJvb2xlYW4pLmpvaW4oJyAnKSwgT2JqZWN0KHMuY3JlYXRlRWxlbWVudCkodSwgZik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmJ1aWxkRXhlY3V0aW9uQ29udGV4dCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMsIG8gPSB5KHt9LCB0LCB7IHRoZW1lOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ubGVuZ3RoID8gKHRoaXMuYXR0cnMgPSB7fSwgbi5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSBlLCBpID0gITEsIGEgPSB2b2lkIDAsIHMgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChzIGluIChDKG4pICYmIChuID0gbihvKSwgaSA9ICEwKSwgbikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBuW3NdLCBpIHx8ICFDKGEpIHx8ICh0ID0gYSkgJiYgdC5wcm90b3R5cGUgJiYgdC5wcm90b3R5cGUuaXNSZWFjdENvbXBvbmVudCB8fCBUKGEpIHx8IChhID0gYShvKSksIHIuYXR0cnNbc10gPSBhLCBvW3NdID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvKSA6IG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdlbmVyYXRlQW5kSW5qZWN0U3R5bGVzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5mb3J3YXJkZWRDb21wb25lbnQsIHIgPSBuLmF0dHJzLCBvID0gbi5jb21wb25lbnRTdHlsZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ud2FyblRvb01hbnlDbGFzc2VzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8uaXNTdGF0aWMgJiYgIXIubGVuZ3RoID8gby5nZW5lcmF0ZUFuZEluamVjdFN0eWxlcyhTLCB0aGlzLnN0eWxlU2hlZXQpIDogby5nZW5lcmF0ZUFuZEluamVjdFN0eWxlcyh0aGlzLmJ1aWxkRXhlY3V0aW9uQ29udGV4dChlLCB0LCByKSwgdGhpcy5zdHlsZVNoZWV0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdDsKICAgICAgICAgICAgICAgICAgICB9KHMuQ29tcG9uZW50KTsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBKZShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gVChlKSwgbyA9ICFMZShlKSwgaSA9IHQuZGlzcGxheU5hbWUsIGEgPSB2b2lkIDAgPT09IGkgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBMZShlKSA/ICdzdHlsZWQuJyArIGUgOiAnU3R5bGVkKCcgKyBrKGUpICsgJyknOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlKSA6IGksIHMgPSB0LmNvbXBvbmVudElkLCB1ID0gdm9pZCAwID09PSBzID8gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICdzdHJpbmcnICE9PSB0eXBlb2YgdCA/ICdzYycgOiBJZSh0KSwgbyA9IChRZVtyXSB8fCAwKSArIDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUWVbcl0gPSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gciArICctJyArIGUuZ2VuZXJhdGVOYW1lKHIgKyBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA/IG4gKyAnLScgKyBpIDogaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oVGUsIHQuZGlzcGxheU5hbWUsIHQucGFyZW50Q29tcG9uZW50SWQpIDogcywgbCA9IHQuUGFyZW50Q29tcG9uZW50LCBmID0gdm9pZCAwID09PSBsID8gS2UgOiBsLCBwID0gdC5hdHRycywgaCA9IHZvaWQgMCA9PT0gcCA/IHggOiBwLCBtID0gdC5kaXNwbGF5TmFtZSAmJiB0LmNvbXBvbmVudElkID8gSWUodC5kaXNwbGF5TmFtZSkgKyAnLScgKyB0LmNvbXBvbmVudElkIDogdC5jb21wb25lbnRJZCB8fCB1LCBnID0gciAmJiBlLmF0dHJzID8gQXJyYXkucHJvdG90eXBlLmNvbmNhdChlLmF0dHJzLCBoKS5maWx0ZXIoQm9vbGVhbikgOiBoLCB2ID0gbmV3IFRlKHIgPyBlLmNvbXBvbmVudFN0eWxlLnJ1bGVzLmNvbmNhdChuKSA6IG4sIGcsIG0pLCBiID0gdm9pZCAwLCBFID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5hLmNyZWF0ZUVsZW1lbnQoZiwgeSh7fSwgZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3J3YXJkZWRDb21wb25lbnQ6IGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcndhcmRlZFJlZjogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBFLmRpc3BsYXlOYW1lID0gYSwgKGIgPSBjLmEuZm9yd2FyZFJlZihFKSkuZGlzcGxheU5hbWUgPSBhLCBiLmF0dHJzID0gZywgYi5jb21wb25lbnRTdHlsZSA9IHYsIGIuZm9sZGVkQ29tcG9uZW50SWRzID0gciA/IEFycmF5LnByb3RvdHlwZS5jb25jYXQoZS5mb2xkZWRDb21wb25lbnRJZHMsIGUuc3R5bGVkQ29tcG9uZW50SWQpIDogeCwgYi5zdHlsZWRDb21wb25lbnRJZCA9IG0sIGIudGFyZ2V0ID0gciA/IGUudGFyZ2V0IDogZSwgYi53aXRoQ29tcG9uZW50ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC5jb21wb25lbnRJZCwgbyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaW5kZXhPZihyKSA+PSAwIHx8IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLCByKSAmJiAobltyXSA9IGVbcl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHQsIFsnY29tcG9uZW50SWQnXSksIGkgPSByICYmIHIgKyAnLScgKyAoTGUoZSkgPyBlIDogSWUoayhlKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEplKGUsIHkoe30sIG8sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHRyczogZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRJZDogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYXJlbnRDb21wb25lbnQ6IGYKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGIsICdkZWZhdWx0UHJvcHMnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZm9sZGVkRGVmYXVsdFByb3BzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9mb2xkZWREZWZhdWx0UHJvcHMgPSByID8gT2JqZWN0KGQuYSkoZS5kZWZhdWx0UHJvcHMsIHQpIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIGIudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJy4nICsgYi5zdHlsZWRDb21wb25lbnRJZDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgbyAmJiB6ZShiLCBlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHRyczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wb25lbnRTdHlsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb2xkZWRDb21wb25lbnRJZHM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3R5bGVkQ29tcG9uZW50SWQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpdGhDb21wb25lbnQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBiOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgWGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gZSh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzJdID8gYXJndW1lbnRzWzJdIDogUzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghT2JqZWN0KGwuaXNWYWxpZEVsZW1lbnRUeXBlKShuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTCgxLCBTdHJpbmcobikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQobiwgciwgYmUuYXBwbHkodm9pZCAwLCBhcmd1bWVudHMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby53aXRoQ29uZmlnID0gZnVuY3Rpb24gKG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0LCBuLCB5KHt9LCByLCBvKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvLmF0dHJzID0gZnVuY3Rpb24gKG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0LCBuLCB5KHt9LCByLCB7IGF0dHJzOiBBcnJheS5wcm90b3R5cGUuY29uY2F0KHIuYXR0cnMsIG8pLmZpbHRlcihCb29sZWFuKSB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvOwogICAgICAgICAgICAgICAgICAgICAgICB9KEplLCBlKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgJ2EnLAogICAgICAgICAgICAgICAgICAgICAgICAnYWJicicsCiAgICAgICAgICAgICAgICAgICAgICAgICdhZGRyZXNzJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2FyZWEnLAogICAgICAgICAgICAgICAgICAgICAgICAnYXJ0aWNsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdhc2lkZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdhdWRpbycsCiAgICAgICAgICAgICAgICAgICAgICAgICdiJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2Jhc2UnLAogICAgICAgICAgICAgICAgICAgICAgICAnYmRpJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2JkbycsCiAgICAgICAgICAgICAgICAgICAgICAgICdiaWcnLAogICAgICAgICAgICAgICAgICAgICAgICAnYmxvY2txdW90ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdib2R5JywKICAgICAgICAgICAgICAgICAgICAgICAgJ2JyJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2J1dHRvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICdjYW52YXMnLAogICAgICAgICAgICAgICAgICAgICAgICAnY2FwdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICdjaXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnY29sJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbGdyb3VwJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2RhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGF0YWxpc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGQnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGVsJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2RldGFpbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGZuJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2RpYWxvZycsCiAgICAgICAgICAgICAgICAgICAgICAgICdkaXYnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGwnLAogICAgICAgICAgICAgICAgICAgICAgICAnZHQnLAogICAgICAgICAgICAgICAgICAgICAgICAnZW0nLAogICAgICAgICAgICAgICAgICAgICAgICAnZW1iZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnZmllbGRzZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAnZmlnY2FwdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICdmaWd1cmUnLAogICAgICAgICAgICAgICAgICAgICAgICAnZm9vdGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2Zvcm0nLAogICAgICAgICAgICAgICAgICAgICAgICAnaDEnLAogICAgICAgICAgICAgICAgICAgICAgICAnaDInLAogICAgICAgICAgICAgICAgICAgICAgICAnaDMnLAogICAgICAgICAgICAgICAgICAgICAgICAnaDQnLAogICAgICAgICAgICAgICAgICAgICAgICAnaDUnLAogICAgICAgICAgICAgICAgICAgICAgICAnaDYnLAogICAgICAgICAgICAgICAgICAgICAgICAnaGVhZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdoZWFkZXInLAogICAgICAgICAgICAgICAgICAgICAgICAnaGdyb3VwJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2hyJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2h0bWwnLAogICAgICAgICAgICAgICAgICAgICAgICAnaScsCiAgICAgICAgICAgICAgICAgICAgICAgICdpZnJhbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAnaW1nJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2lucHV0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ2lucycsCiAgICAgICAgICAgICAgICAgICAgICAgICdrYmQnLAogICAgICAgICAgICAgICAgICAgICAgICAna2V5Z2VuJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xhYmVsJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xlZ2VuZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdsaScsCiAgICAgICAgICAgICAgICAgICAgICAgICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgJ21haW4nLAogICAgICAgICAgICAgICAgICAgICAgICAnbWFwJywKICAgICAgICAgICAgICAgICAgICAgICAgJ21hcmsnLAogICAgICAgICAgICAgICAgICAgICAgICAnbWFycXVlZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdtZW51JywKICAgICAgICAgICAgICAgICAgICAgICAgJ21lbnVpdGVtJywKICAgICAgICAgICAgICAgICAgICAgICAgJ21ldGEnLAogICAgICAgICAgICAgICAgICAgICAgICAnbWV0ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAnbmF2JywKICAgICAgICAgICAgICAgICAgICAgICAgJ25vc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdvbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdvcHRncm91cCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdvcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAnb3V0cHV0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ3AnLAogICAgICAgICAgICAgICAgICAgICAgICAncGFyYW0nLAogICAgICAgICAgICAgICAgICAgICAgICAncGljdHVyZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdwcmUnLAogICAgICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnLAogICAgICAgICAgICAgICAgICAgICAgICAncScsCiAgICAgICAgICAgICAgICAgICAgICAgICdycCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdydCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdydWJ5JywKICAgICAgICAgICAgICAgICAgICAgICAgJ3MnLAogICAgICAgICAgICAgICAgICAgICAgICAnc2FtcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdzY3JpcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAnc2VjdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICdzZWxlY3QnLAogICAgICAgICAgICAgICAgICAgICAgICAnc21hbGwnLAogICAgICAgICAgICAgICAgICAgICAgICAnc291cmNlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3NwYW4nLAogICAgICAgICAgICAgICAgICAgICAgICAnc3Ryb25nJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3N0eWxlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3N1YicsCiAgICAgICAgICAgICAgICAgICAgICAgICdzdW1tYXJ5JywKICAgICAgICAgICAgICAgICAgICAgICAgJ3N1cCcsCiAgICAgICAgICAgICAgICAgICAgICAgICd0YWJsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICd0Ym9keScsCiAgICAgICAgICAgICAgICAgICAgICAgICd0ZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICd0ZXh0YXJlYScsCiAgICAgICAgICAgICAgICAgICAgICAgICd0Zm9vdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICd0aCcsCiAgICAgICAgICAgICAgICAgICAgICAgICd0aGVhZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICd0aW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3RpdGxlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3RyJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3RyYWNrJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3UnLAogICAgICAgICAgICAgICAgICAgICAgICAndWwnLAogICAgICAgICAgICAgICAgICAgICAgICAndmFyJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3ZpZGVvJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3dicicsCiAgICAgICAgICAgICAgICAgICAgICAgICdjaXJjbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnY2xpcFBhdGgnLAogICAgICAgICAgICAgICAgICAgICAgICAnZGVmcycsCiAgICAgICAgICAgICAgICAgICAgICAgICdlbGxpcHNlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2ZvcmVpZ25PYmplY3QnLAogICAgICAgICAgICAgICAgICAgICAgICAnZycsCiAgICAgICAgICAgICAgICAgICAgICAgICdpbWFnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdsaW5lJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xpbmVhckdyYWRpZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgJ21hcmtlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICdtYXNrJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3BhdGgnLAogICAgICAgICAgICAgICAgICAgICAgICAncGF0dGVybicsCiAgICAgICAgICAgICAgICAgICAgICAgICdwb2x5Z29uJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3BvbHlsaW5lJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3JhZGlhbEdyYWRpZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgJ3JlY3QnLAogICAgICAgICAgICAgICAgICAgICAgICAnc3RvcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdzdmcnLAogICAgICAgICAgICAgICAgICAgICAgICAndGV4dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICd0c3BhbicKICAgICAgICAgICAgICAgICAgICBdLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgWGVbZV0gPSBYZShlKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgWmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZyh0aGlzLCBlKSwgdGhpcy5ydWxlcyA9IHQsIHRoaXMuY29tcG9uZW50SWQgPSBuLCB0aGlzLmlzU3RhdGljID0gU2UodCwgeCksIGZlLm1hc3Rlci5oYXNJZChuKSB8fCBmZS5tYXN0ZXIuZGVmZXJyZWRJbmplY3QobiwgW10pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS5jcmVhdGVTdHlsZXMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBIKHllKHRoaXMucnVsZXMsIGUsIHQpLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmluamVjdCh0aGlzLmNvbXBvbmVudElkLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUucmVtb3ZlU3R5bGVzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcy5jb21wb25lbnRJZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaGFzSWQodCkgJiYgZS5yZW1vdmUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnJlbmRlclN0eWxlcyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJlbW92ZVN0eWxlcyh0KSwgdGhpcy5jcmVhdGVTdHlsZXMoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGV0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IGFyZ3VtZW50cy5sZW5ndGgsIG4gPSBBcnJheSh0ID4gMSA/IHQgLSAxIDogMCksIHIgPSAxOyByIDwgdDsgcisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbltyIC0gMV0gPSBhcmd1bWVudHNbcl07CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gYmUuYXBwbHkodm9pZCAwLCBbZV0uY29uY2F0KG4pKSwgaSA9ICdzYy1nbG9iYWwtJyArIEVlKEpTT04uc3RyaW5naWZ5KG8pKSwgYSA9IG5ldyBaZShvLCBpKSwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcodGhpcywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gRSh0aGlzLCBlLmNhbGwodGhpcywgbikpLCBvID0gci5jb25zdHJ1Y3RvciwgaSA9IG8uZ2xvYmFsU3R5bGUsIGEgPSBvLnN0eWxlZENvbXBvbmVudElkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUCAmJiAod2luZG93LnNjQ0dTSE1SQ2FjaGVbYV0gPSAod2luZG93LnNjQ0dTSE1SQ2FjaGVbYV0gfHwgMCkgKyAxKSwgci5zdGF0ZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdsb2JhbFN0eWxlOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3R5bGVkQ29tcG9uZW50SWQ6IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIodCwgZSksIHQucHJvdG90eXBlLmNvbXBvbmVudFdpbGxVbm1vdW50ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuc2NDR1NITVJDYWNoZVt0aGlzLnN0YXRlLnN0eWxlZENvbXBvbmVudElkXSAmJiAod2luZG93LnNjQ0dTSE1SQ2FjaGVbdGhpcy5zdGF0ZS5zdHlsZWRDb21wb25lbnRJZF0gLT0gMSksIDAgPT09IHdpbmRvdy5zY0NHU0hNUkNhY2hlW3RoaXMuc3RhdGUuc3R5bGVkQ29tcG9uZW50SWRdICYmIHRoaXMuc3RhdGUuZ2xvYmFsU3R5bGUucmVtb3ZlU3R5bGVzKHRoaXMuc3R5bGVTaGVldCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUucmVuZGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmEuY3JlYXRlRWxlbWVudCgkZSwgbnVsbCwgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc3R5bGVTaGVldCA9IHQgfHwgZmUubWFzdGVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLnN0YXRlLmdsb2JhbFN0eWxlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uaXNTdGF0aWMgPyAobi5yZW5kZXJTdHlsZXMoSSwgZS5zdHlsZVNoZWV0KSwgbnVsbCkgOiBjLmEuY3JlYXRlRWxlbWVudChIZSwgbnVsbCwgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuY29uc3RydWN0b3IuZGVmYXVsdFByb3BzLCBvID0geSh7fSwgZS5wcm9wcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnICE9PSB0eXBlb2YgdCAmJiAoby50aGVtZSA9IF9lKGUucHJvcHMsIHQsIHIpKSwgbi5yZW5kZXJTdHlsZXMobywgZS5zdHlsZVNoZWV0KSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShjLmEuQ29tcG9uZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMuZ2xvYmFsU3R5bGUgPSBhLCBzLnN0eWxlZENvbXBvbmVudElkID0gaSwgczsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgUCAmJiAod2luZG93LnNjQ0dTSE1SQ2FjaGUgPSB7fSk7CiAgICAgICAgICAgICAgICAgICAgdC5jID0gWGU7CiAgICAgICAgICAgICAgICB9LmNhbGwodGhpcywgbigxMTkpKSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTMpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIXIoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihTdHJpbmcoZSkgKyAnIGlzIG5vdCBhbiBvYmplY3QnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhMTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzKSwgbyA9IG4oOTkpLCBpID0gbigyNCksIGEgPSBuKDkpLCBzID0gbig2OCksIGMgPSBuKDk4KSwgdSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RvcHBlZCA9IGUsIHRoaXMucmVzdWx0ID0gdDsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbCwgZiwgcCwgZCwgaCwgbSwgZywgdiA9IG4gJiYgbi50aGF0LCB5ID0gISghbiB8fCAhbi5BU19FTlRSSUVTKSwgYiA9ICEoIW4gfHwgIW4uSVNfSVRFUkFUT1IpLCBFID0gISghbiB8fCAhbi5JTlRFUlJVUFRFRCksIHcgPSBhKHQsIHYsIDEgKyB5ICsgRSksIHggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwgJiYgYyhsKSwgbmV3IHUoITAsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBTID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5ID8gKHIoZSksIEUgPyB3KGVbMF0sIGVbMV0sIHgpIDogdyhlWzBdLCBlWzFdKSkgOiBFID8gdyhlLCB4KSA6IHcoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgaWYgKGIpCiAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBlOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgKGYgPSBzKGUpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignVGFyZ2V0IGlzIG5vdCBpdGVyYWJsZScpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobyhmKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChwID0gMCwgZCA9IGkoZS5sZW5ndGgpOyBkID4gcDsgcCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoaCA9IFMoZVtwXSkpICYmIGggaW5zdGFuY2VvZiB1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgdSghMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGYuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZm9yIChtID0gbC5uZXh0OyAhKGcgPSBtLmNhbGwobCkpLmRvbmU7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gUyhnLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoQykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgYyhsKSwgQzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT0gdHlwZW9mIGggJiYgaCAmJiBoIGluc3RhbmNlb2YgdSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHUoITEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihTdHJpbmcoZSkgKyAnIGlzIG5vdCBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLk1hdGggPT0gTWF0aCAmJiBlOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gbignb2JqZWN0JyA9PSB0eXBlb2YgZ2xvYmFsVGhpcyAmJiBnbG9iYWxUaGlzKSB8fCBuKCdvYmplY3QnID09IHR5cGVvZiB3aW5kb3cgJiYgd2luZG93KSB8fCBuKCdvYmplY3QnID09IHR5cGVvZiBzZWxmICYmIHNlbGYpIHx8IG4oJ29iamVjdCcgPT0gdHlwZW9mIHQgJiYgdCkgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9KCkgfHwgRnVuY3Rpb24oJ3JldHVybiB0aGlzJykoKTsKICAgICAgICAgICAgICAgIH0uY2FsbCh0aGlzLCBuKDg1KSkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDcpLCBvID0gbig2MCksIGkgPSBuKDE0KSwgYSA9IG4oNDcpLCBzID0gbig2NSksIGMgPSBuKDkxKSwgdSA9IG8oJ3drcycpLCBsID0gci5TeW1ib2wsIGYgPSBjID8gbCA6IGwgJiYgbC53aXRob3V0U2V0dGVyIHx8IGE7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBpKHUsIGUpIHx8IChzICYmIGkobCwgZSkgPyB1W2VdID0gbFtlXSA6IHVbZV0gPSBmKCdTeW1ib2wuJyArIGUpKSwgdVtlXTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIGlmIChyKGUpLCB2b2lkIDAgPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobikgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNhbGwodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNhbGwodCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNhbGwodCwgbiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIHIsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNhbGwodCwgbiwgciwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHQsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oODgpLCBvID0gbig3KSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09IHR5cGVvZiBlID8gZSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXJndW1lbnRzLmxlbmd0aCA8IDIgPyBpKHJbZV0pIHx8IGkob1tlXSkgOiByW2VdICYmIHJbZV1bdF0gfHwgb1tlXSAmJiBvW2VdW3RdOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig4OCksIG8gPSBuKDE0KSwgaSA9IG4oOTMpLCBhID0gbigxOSkuZjsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSByLlN5bWJvbCB8fCAoci5TeW1ib2wgPSB7fSk7CiAgICAgICAgICAgICAgICAgICAgbyh0LCBlKSB8fCBhKHQsIGUsIHsgdmFsdWU6IGkuZihlKSB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWUoKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT09IHR5cGVvZiBlID8gbnVsbCAhPT0gZSA6ICdmdW5jdGlvbicgPT09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIHZhciBuID0ge30uaGFzT3duUHJvcGVydHk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmNhbGwoZSwgdCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pIHx8ICh0W25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgcihuKDI4NCkpLCByKG4oMjg1KSksIHIobigyODYpKSwgcihuKDI4NykpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEyMCksIG8gPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0IEFycmF5XScgPT09IG8uY2FsbChlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyA9PT0gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gZSAmJiAnb2JqZWN0JyA9PT0gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tvYmplY3QgRnVuY3Rpb25dJyA9PT0gby5jYWxsKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGUgJiYgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgIT09IHR5cGVvZiBlICYmIChlID0gW2VdKSwgaShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0gZS5sZW5ndGg7IG4gPCByOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5jYWxsKG51bGwsIGVbbl0sIG4sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsIG8pICYmIHQuY2FsbChudWxsLCBlW29dLCBvLCBlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBpc0FycmF5OiBpLAogICAgICAgICAgICAgICAgICAgIGlzQXJyYXlCdWZmZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnW29iamVjdCBBcnJheUJ1ZmZlcl0nID09PSBvLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc0J1ZmZlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGUgJiYgIWEoZSkgJiYgbnVsbCAhPT0gZS5jb25zdHJ1Y3RvciAmJiAhYShlLmNvbnN0cnVjdG9yKSAmJiAnZnVuY3Rpb24nID09PSB0eXBlb2YgZS5jb25zdHJ1Y3Rvci5pc0J1ZmZlciAmJiBlLmNvbnN0cnVjdG9yLmlzQnVmZmVyKGUpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNGb3JtRGF0YTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnICE9PSB0eXBlb2YgRm9ybURhdGEgJiYgZSBpbnN0YW5jZW9mIEZvcm1EYXRhOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNBcnJheUJ1ZmZlclZpZXc6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIEFycmF5QnVmZmVyICYmIEFycmF5QnVmZmVyLmlzVmlldyA/IEFycmF5QnVmZmVyLmlzVmlldyhlKSA6IGUgJiYgZS5idWZmZXIgJiYgZS5idWZmZXIgaW5zdGFuY2VvZiBBcnJheUJ1ZmZlcjsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzU3RyaW5nOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNOdW1iZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnbnVtYmVyJyA9PT0gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc09iamVjdDogcywKICAgICAgICAgICAgICAgICAgICBpc1VuZGVmaW5lZDogYSwKICAgICAgICAgICAgICAgICAgICBpc0RhdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnW29iamVjdCBEYXRlXScgPT09IG8uY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGlzRmlsZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0IEZpbGVdJyA9PT0gby5jYWxsKGUpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNCbG9iOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tvYmplY3QgQmxvYl0nID09PSBvLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc0Z1bmN0aW9uOiBjLAogICAgICAgICAgICAgICAgICAgIGlzU3RyZWFtOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyhlKSAmJiBjKGUucGlwZSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc1VSTFNlYXJjaFBhcmFtczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnICE9PSB0eXBlb2YgVVJMU2VhcmNoUGFyYW1zICYmIGUgaW5zdGFuY2VvZiBVUkxTZWFyY2hQYXJhbXM7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBpc1N0YW5kYXJkQnJvd3NlckVudjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKCd1bmRlZmluZWQnID09PSB0eXBlb2YgbmF2aWdhdG9yIHx8ICdSZWFjdE5hdGl2ZScgIT09IG5hdmlnYXRvci5wcm9kdWN0ICYmICdOYXRpdmVTY3JpcHQnICE9PSBuYXZpZ2F0b3IucHJvZHVjdCAmJiAnTlMnICE9PSBuYXZpZ2F0b3IucHJvZHVjdCkgJiYgKCd1bmRlZmluZWQnICE9PSB0eXBlb2Ygd2luZG93ICYmICd1bmRlZmluZWQnICE9PSB0eXBlb2YgZG9jdW1lbnQpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZm9yRWFjaDogdSwKICAgICAgICAgICAgICAgICAgICBtZXJnZTogZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb2JqZWN0JyA9PT0gdHlwZW9mIHRbcl0gJiYgJ29iamVjdCcgPT09IHR5cGVvZiBuID8gdFtyXSA9IGUodFtyXSwgbikgOiB0W3JdID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMCwgbyA9IGFyZ3VtZW50cy5sZW5ndGg7IHIgPCBvOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1KGFyZ3VtZW50c1tyXSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZGVlcE1lcmdlOiBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09PSB0eXBlb2YgdFtyXSAmJiAnb2JqZWN0JyA9PT0gdHlwZW9mIG4gPyB0W3JdID0gZSh0W3JdLCBuKSA6IHRbcl0gPSAnb2JqZWN0JyA9PT0gdHlwZW9mIG4gPyBlKHt9LCBuKSA6IG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IDAsIG8gPSBhcmd1bWVudHMubGVuZ3RoOyByIDwgbzsgcisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdShhcmd1bWVudHNbcl0sIG4pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGV4dGVuZDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUodCwgZnVuY3Rpb24gKHQsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbb10gPSBuICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiB0ID8gcih0LCBuKSA6IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgdHJpbTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVwbGFjZSgvXlxzKi8sICcnKS5yZXBsYWNlKC9ccyokLywgJycpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgfHwgKHRbbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCByKG4oMTMzKSksIHIobigyODgpKSwgcihuKDEzNCkpLCByKG4oMTM1KSksIHIobigyODkpKSwgcihuKDc5KSksIHIobigxMzYpKSwgcihuKDI5MCkpLCByKG4oMjkxKSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTIpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gIXIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiA3ICE9IE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh7fSwgMSwgewogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiA3OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSlbMV07CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxOCksIG8gPSBuKDg2KSwgaSA9IG4oMyksIGEgPSBuKDQ1KSwgcyA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0eTsKICAgICAgICAgICAgICAgIHQuZiA9IHIgPyBzIDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaShlKSwgdCA9IGEodCwgITApLCBpKG4pLCBvKQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICgnZ2V0JyBpbiBuIHx8ICdzZXQnIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignQWNjZXNzb3JzIG5vdCBzdXBwb3J0ZWQnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3ZhbHVlJyBpbiBuICYmIChlW3RdID0gbi52YWx1ZSksIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDMpLCBvID0gbig2KSwgaSA9IG4oOCkoJ3NwZWNpZXMnKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGEgPSByKGUpLmNvbnN0cnVjdG9yOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGEgfHwgdm9pZCAwID09IChuID0gcihhKVtpXSkgPyB0IDogbyhuKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNCksIG8gPSBuKDc2KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIgPyBvIDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWFwLnByb3RvdHlwZS5lbnRyaWVzLmNhbGwoZSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE4KSwgbyA9IG4oMTkpLCBpID0gbigzMSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByID8gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5mKGUsIHQsIGkoMSwgbikpOwogICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbdF0gPSBuLCBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig3KSwgbyA9IG4oMjIpLCBpID0gbigxNCksIGEgPSBuKDU3KSwgcyA9IG4oNTgpLCBjID0gbigzMyksIHUgPSBjLmdldCwgbCA9IGMuZW5mb3JjZSwgZiA9IFN0cmluZyhTdHJpbmcpLnNwbGl0KCdTdHJpbmcnKTsKICAgICAgICAgICAgICAgIChlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbiwgcykgewogICAgICAgICAgICAgICAgICAgIHZhciBjLCB1ID0gISFzICYmICEhcy51bnNhZmUsIHAgPSAhIXMgJiYgISFzLmVudW1lcmFibGUsIGQgPSAhIXMgJiYgISFzLm5vVGFyZ2V0R2V0OwogICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT0gdHlwZW9mIG4gJiYgKCdzdHJpbmcnICE9IHR5cGVvZiB0IHx8IGkobiwgJ25hbWUnKSB8fCBvKG4sICduYW1lJywgdCksIChjID0gbChuKSkuc291cmNlIHx8IChjLnNvdXJjZSA9IGYuam9pbignc3RyaW5nJyA9PSB0eXBlb2YgdCA/IHQgOiAnJykpKSwgZSAhPT0gciA/ICh1ID8gIWQgJiYgZVt0XSAmJiAocCA9ICEwKSA6IGRlbGV0ZSBlW3RdLCBwID8gZVt0XSA9IG4gOiBvKGUsIHQsIG4pKSA6IHAgPyBlW3RdID0gbiA6IGEodCwgbik7CiAgICAgICAgICAgICAgICB9KShGdW5jdGlvbi5wcm90b3R5cGUsICd0b1N0cmluZycsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdGhpcyAmJiB1KHRoaXMpLnNvdXJjZSB8fCBzKHRoaXMpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMzkpLCBvID0gTWF0aC5taW47CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID4gMCA/IG8ocihlKSwgOTAwNzE5OTI1NDc0MDk5MSkgOiAwOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig1NSksIG8gPSBuKDMyKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIobyhlKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDMyKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChyKGUpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTkpLmYsIG8gPSBuKDE0KSwgaSA9IG4oOCkoJ3RvU3RyaW5nVGFnJyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIGUgJiYgIW8oZSA9IG4gPyBlIDogZS5wcm90b3R5cGUsIGkpICYmIHIoZSwgaSwgewogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig0KSwgbyA9IG4oNzYpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gciA/IG8gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBTZXQucHJvdG90eXBlLnZhbHVlcy5jYWxsKGUpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fdmFsdWVzIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgU3ltYm9sLml0ZXJhdG9yLCBuID0gdCAmJiBlW3RdLCByID0gMDsKICAgICAgICAgICAgICAgICAgICBpZiAobikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiAnbnVtYmVyJyA9PSB0eXBlb2YgZS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgciA+PSBlLmxlbmd0aCAmJiAoZSA9IHZvaWQgMCksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGUgJiYgZVtyKytdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcih0ID8gJ09iamVjdCBpcyBub3QgaXRlcmFibGUuJyA6ICdTeW1ib2wuaXRlcmF0b3IgaXMgbm90IGRlZmluZWQuJyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUuY2xvbmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcywgdCA9IG5ldyB0aGlzLmNvbnN0cnVjdG9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyh0aGlzKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuZGVlcENsb25lKGVbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSByICYmICh0W25dID0gcik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLmRlZXBDbG9uZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBvID0gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnbnVtYmVyJyA9PT0gbyB8fCAnc3RyaW5nJyA9PT0gbyB8fCAnYm9vbGVhbicgPT09IG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGUgJiYgJ29iamVjdCcgPT09IG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09IHR5cGVvZiBlLmNsb25lKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNsb25lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSBpbnN0YW5jZW9mIERhdGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBEYXRlKGUuZ2V0VGltZSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IGVbU3ltYm9sLml0ZXJhdG9yXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IHIoZSksIHMgPSBhLm5leHQoKTsgIXMuZG9uZTsgcyA9IGEubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHMudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnB1c2godGhpcy5kZWVwQ2xvbmUoYykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0geyBlcnJvcjogZSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzICYmICFzLmRvbmUgJiYgKG4gPSBhLnJldHVybikgJiYgbi5jYWxsKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgdC5lcnJvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSBpbnN0YW5jZW9mIEFycmF5ID8gaSA6IG5ldyBlLmNvbnN0cnVjdG9yKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGwgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmhhc093blByb3BlcnR5KGwpICYmICh1W2xdID0gdGhpcy5kZWVwQ2xvbmUoZVtsXSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5DbG9uZWFibGUgPSBvOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTUpLCBvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSAmJiAoZSA9IHBhcnNlSW50KGUsIDEwKSksIChuID0gZS50b1N0cmluZygyKSkubGVuZ3RoID4gdCB8fCBlIDwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgci5FbmNvZGluZ0Vycm9yKGUgKyAnIHRvbyBsYXJnZSB0byBlbmNvZGUgaW50byAnICsgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5sZW5ndGggPCB0ICYmIChuID0gJzAnLnJlcGVhdCh0IC0gbi5sZW5ndGgpICsgbiksIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZGVjb2RlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICE9PSBlLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgci5EZWNvZGluZ0Vycm9yKCdpbnZhbGlkIGJpdCBsZW5ndGgnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUludChlLCAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkludEVuY29kZXIgPSBvOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhKDEgJiBlKSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhKDIgJiBlKSwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEoNCAmIGUpLAogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdAogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignQ2FuXCd0IGNhbGwgbWV0aG9kIG9uICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciwgbywgaSwgYSA9IG4oMTU1KSwgcyA9IG4oNyksIGMgPSBuKDEzKSwgdSA9IG4oMjIpLCBsID0gbigxNCksIGYgPSBuKDU5KSwgcCA9IG4oNDYpLCBkID0gbigzOCksIGggPSBzLldlYWtNYXA7CiAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBtID0gZi5zdGF0ZSB8fCAoZi5zdGF0ZSA9IG5ldyBoKCkpLCBnID0gbS5nZXQsIHYgPSBtLmhhcywgeSA9IG0uc2V0OwogICAgICAgICAgICAgICAgICAgIHIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5mYWNhZGUgPSBlLCB5LmNhbGwobSwgZSwgdCksIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnLmNhbGwobSwgZSkgfHwge307CiAgICAgICAgICAgICAgICAgICAgfSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2LmNhbGwobSwgZSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBwKCdzdGF0ZScpOwogICAgICAgICAgICAgICAgICAgIGRbYl0gPSAhMCwgciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmZhY2FkZSA9IGUsIHUoZSwgYiwgdCksIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKGUsIGIpID8gZVtiXSA6IHt9OwogICAgICAgICAgICAgICAgICAgIH0sIGkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbChlLCBiKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgIHNldDogciwKICAgICAgICAgICAgICAgICAgICBnZXQ6IG8sCiAgICAgICAgICAgICAgICAgICAgaGFzOiBpLAogICAgICAgICAgICAgICAgICAgIGVuZm9yY2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGUpID8gbyhlKSA6IHIoZSwge30pOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZ2V0dGVyRm9yOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjKHQpIHx8IChuID0gbyh0KSkudHlwZSAhPT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ0luY29tcGF0aWJsZSByZWNlaXZlciwgJyArIGUgKyAnIHJlcXVpcmVkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gbigyNjYpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gbigyNTkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE4KSwgbyA9IG4oNDQpLCBpID0gbigzMSksIGEgPSBuKDI1KSwgcyA9IG4oNDUpLCBjID0gbigxNCksIHUgPSBuKDg2KSwgbCA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3I7CiAgICAgICAgICAgICAgICB0LmYgPSByID8gbCA6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUgPSBhKGUpLCB0ID0gcyh0LCAhMCksIHUpCiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbChlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKGMoZSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKCFvLmYuY2FsbChlLCB0KSwgZVt0XSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgdmFyIG4gPSB7fS50b1N0cmluZzsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2FsbChlKS5zbGljZSg4LCAtMSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0ge307CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICB2YXIgbiA9IE1hdGguY2VpbCwgciA9IE1hdGguZmxvb3I7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBpc05hTihlID0gK2UpID8gMCA6IChlID4gMCA/IHIgOiBuKShlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciwgbyA9IG4oMyksIGkgPSBuKDE1OCksIGEgPSBuKDYyKSwgcyA9IG4oMzgpLCBjID0gbig5MiksIHUgPSBuKDU2KSwgbCA9IG4oNDYpLCBmID0gbCgnSUVfUFJPVE8nKSwgcCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9LCBkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICc8c2NyaXB0PicgKyBlICsgJzwvc2NyaXB0Pic7CiAgICAgICAgICAgICAgICAgICAgfSwgaCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBkb2N1bWVudC5kb21haW4gJiYgbmV3IEFjdGl2ZVhPYmplY3QoJ2h0bWxmaWxlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBoID0gciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLndyaXRlKGQoJycpKSwgZS5jbG9zZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnBhcmVudFdpbmRvdy5PYmplY3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IG51bGwsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0ocikgOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSwgdCA9IHUoJ2lmcmFtZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuc3R5bGUuZGlzcGxheSA9ICdub25lJywgYy5hcHBlbmRDaGlsZCh0KSwgdC5zcmMgPSBTdHJpbmcoJ2phdmFzY3JpcHQ6JyksIChlID0gdC5jb250ZW50V2luZG93LmRvY3VtZW50KS5vcGVuKCksIGUud3JpdGUoZCgnZG9jdW1lbnQuRj1PYmplY3QnKSksIGUuY2xvc2UoKSwgZS5GOwogICAgICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBhLmxlbmd0aDsgZS0tOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBoLnByb3RvdHlwZVthW2VdXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGgoKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgc1tmXSA9ICEwLCBlLmV4cG9ydHMgPSBPYmplY3QuY3JlYXRlIHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGUgPyAocC5wcm90b3R5cGUgPSBvKGUpLCBuID0gbmV3IHAoKSwgcC5wcm90b3R5cGUgPSBudWxsLCBuW2ZdID0gZSkgOiBuID0gaCgpLCB2b2lkIDAgPT09IHQgPyBuIDogaShuLCB0KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7fTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbig2KSwgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnByb21pc2UgPSBuZXcgZShmdW5jdGlvbiAoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gdCB8fCB2b2lkIDAgIT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKCdCYWQgUHJvbWlzZSBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IGUsIG4gPSByOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5yZXNvbHZlID0gcih0KSwgdGhpcy5yZWplY3QgPSByKG4pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMuZiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBvKGUpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZW5jb2RlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICtlICsgJyc7CiAgICAgICAgICAgICAgICAgICAgfSwgZS5kZWNvZGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJzEnID09PSBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkJvb2xlYW5FbmNvZGVyID0gcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0ge30ucHJvcGVydHlJc0VudW1lcmFibGUsIG8gPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yLCBpID0gbyAmJiAhci5jYWxsKHsgMTogMiB9LCAxKTsKICAgICAgICAgICAgICAgIHQuZiA9IGkgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbyh0aGlzLCBlKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF0ICYmIHQuZW51bWVyYWJsZTsKICAgICAgICAgICAgICAgIH0gOiByOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEzKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFyKGUpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB2YXIgbiwgbzsKICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiAobiA9IGUudG9TdHJpbmcpICYmICFyKG8gPSBuLmNhbGwoZSkpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgKG4gPSBlLnZhbHVlT2YpICYmICFyKG8gPSBuLmNhbGwoZSkpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICBpZiAoIXQgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgKG4gPSBlLnRvU3RyaW5nKSAmJiAhcihvID0gbi5jYWxsKGUpKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKCdDYW5cJ3QgY29udmVydCBvYmplY3QgdG8gcHJpbWl0aXZlIHZhbHVlJyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDYwKSwgbyA9IG4oNDcpLCBpID0gcigna2V5cycpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaVtlXSB8fCAoaVtlXSA9IG8oZSkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIHZhciBuID0gMCwgciA9IE1hdGgucmFuZG9tKCk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnU3ltYm9sKCcgKyBTdHJpbmcodm9pZCAwID09PSBlID8gJycgOiBlKSArICcpXycgKyAoKytuICsgcikudG9TdHJpbmcoMzYpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzNyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBBcnJheS5pc0FycmF5IHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdBcnJheScgPT0gcihlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oODkpLCBvID0gbig2Mik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBPYmplY3Qua2V5cyB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiByKGUsIG8pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig4KSwgbyA9IG4oNDApLCBpID0gbigxOSksIGEgPSByKCd1bnNjb3BhYmxlcycpLCBzID0gQXJyYXkucHJvdG90eXBlOwogICAgICAgICAgICAgICAgdm9pZCAwID09IHNbYV0gJiYgaS5mKHMsIGEsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBvKG51bGwpCiAgICAgICAgICAgICAgICB9KSwgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBzW2FdW2VdID0gITA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGUoKQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB0CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICFmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyAhPT0gdHlwZW9mIF9fUkVBQ1RfREVWVE9PTFNfR0xPQkFMX0hPT0tfXyAmJiAnZnVuY3Rpb24nID09PSB0eXBlb2YgX19SRUFDVF9ERVZUT09MU19HTE9CQUxfSE9PS19fLmNoZWNrRENFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX1JFQUNUX0RFVlRPT0xTX0dMT0JBTF9IT09LX18uY2hlY2tEQ0UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KCksIGUuZXhwb3J0cyA9IG4oMjYxKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IG4oMjY4KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSB8fCAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIHIobig3NykpLCByKG4oMTUpKSwgcihuKDE3KSksIHIobigyOSkpLCByKG4oMTQ0KSksIHIobigxNDUpKSwgcihuKDE0NikpLCByKG4oMjk3KSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTIpLCBvID0gbigzNyksIGkgPSAnJy5zcGxpdDsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhT2JqZWN0KCd6JykucHJvcGVydHlJc0VudW1lcmFibGUoMCk7CiAgICAgICAgICAgICAgICB9KSA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdTdHJpbmcnID09IG8oZSkgPyBpLmNhbGwoZSwgJycpIDogT2JqZWN0KGUpOwogICAgICAgICAgICAgICAgfSA6IE9iamVjdDsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig3KSwgbyA9IG4oMTMpLCBpID0gci5kb2N1bWVudCwgYSA9IG8oaSkgJiYgbyhpLmNyZWF0ZUVsZW1lbnQpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGkuY3JlYXRlRWxlbWVudChlKSA6IHt9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig3KSwgbyA9IG4oMjIpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBvKHIsIGUsIHQpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcltlXSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig1OSksIG8gPSBGdW5jdGlvbi50b1N0cmluZzsKICAgICAgICAgICAgICAgICdmdW5jdGlvbicgIT0gdHlwZW9mIHIuaW5zcGVjdFNvdXJjZSAmJiAoci5pbnNwZWN0U291cmNlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5jYWxsKGUpOwogICAgICAgICAgICAgICAgfSksIGUuZXhwb3J0cyA9IHIuaW5zcGVjdFNvdXJjZTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig3KSwgbyA9IG4oNTcpLCBpID0gclsnX19jb3JlLWpzX3NoYXJlZF9fJ10gfHwgbygnX19jb3JlLWpzX3NoYXJlZF9fJywge30pOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig0KSwgbyA9IG4oNTkpOwogICAgICAgICAgICAgICAgKGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9bZV0gfHwgKG9bZV0gPSB2b2lkIDAgIT09IHQgPyB0IDoge30pOwogICAgICAgICAgICAgICAgfSkoJ3ZlcnNpb25zJywgW10pLnB1c2goewogICAgICAgICAgICAgICAgICAgIHZlcnNpb246ICczLjcuMCcsCiAgICAgICAgICAgICAgICAgICAgbW9kZTogciA/ICdwdXJlJyA6ICdnbG9iYWwnLAogICAgICAgICAgICAgICAgICAgIGNvcHlyaWdodDogJ1x4QTkgMjAyMCBEZW5pcyBQdXNoa2FyZXYgKHpsb2lyb2NrLnJ1KScKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDg5KSwgbyA9IG4oNjIpLmNvbmNhdCgnbGVuZ3RoJywgJ3Byb3RvdHlwZScpOwogICAgICAgICAgICAgICAgdC5mID0gT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXMgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihlLCBvKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBbCiAgICAgICAgICAgICAgICAgICAgJ2NvbnN0cnVjdG9yJywKICAgICAgICAgICAgICAgICAgICAnaGFzT3duUHJvcGVydHknLAogICAgICAgICAgICAgICAgICAgICdpc1Byb3RvdHlwZU9mJywKICAgICAgICAgICAgICAgICAgICAncHJvcGVydHlJc0VudW1lcmFibGUnLAogICAgICAgICAgICAgICAgICAgICd0b0xvY2FsZVN0cmluZycsCiAgICAgICAgICAgICAgICAgICAgJ3RvU3RyaW5nJywKICAgICAgICAgICAgICAgICAgICAndmFsdWVPZicKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICB0LmYgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEyKSwgbyA9IC8jfFwucHJvdG90eXBlXC4vLCBpID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBzW2EoZSldOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9PSB1IHx8IG4gIT0gYyAmJiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCA/IHIodCkgOiAhIXQpOwogICAgICAgICAgICAgICAgICAgIH0sIGEgPSBpLm5vcm1hbGl6ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTdHJpbmcoZSkucmVwbGFjZShvLCAnLicpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgfSwgcyA9IGkuZGF0YSA9IHt9LCBjID0gaS5OQVRJVkUgPSAnTicsIHUgPSBpLlBPTFlGSUxMID0gJ1AnOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhIU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMgJiYgIXIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhU3RyaW5nKFN5bWJvbCgpKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEzKSwgbyA9IG4oNDgpLCBpID0gbig4KSgnc3BlY2llcycpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhlKSAmJiAoJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgKG4gPSBlLmNvbnN0cnVjdG9yKSB8fCBuICE9PSBBcnJheSAmJiAhbyhuLnByb3RvdHlwZSkgPyByKG4pICYmIG51bGwgPT09IChuID0gbltpXSkgJiYgKG4gPSB2b2lkIDApIDogbiA9IHZvaWQgMCksIG5ldyAodm9pZCAwID09PSBuID8gQXJyYXkgOiBuKSgwID09PSB0ID8gMCA6IHQpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByLCBvLCBpID0gbig3KSwgYSA9IG4oOTYpLCBzID0gaS5wcm9jZXNzLCBjID0gcyAmJiBzLnZlcnNpb25zLCB1ID0gYyAmJiBjLnY4OwogICAgICAgICAgICAgICAgdSA/IG8gPSAociA9IHUuc3BsaXQoJy4nKSlbMF0gKyByWzFdIDogYSAmJiAoIShyID0gYS5tYXRjaCgvRWRnZVwvKFxkKykvKSkgfHwgclsxXSA+PSA3NCkgJiYgKHIgPSBhLm1hdGNoKC9DaHJvbWVcLyhcZCspLykpICYmIChvID0gclsxXSksIGUuZXhwb3J0cyA9IG8gJiYgK287CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTAwKSwgbyA9IG4oNDEpLCBpID0gbig4KSgnaXRlcmF0b3InKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPSBlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtpXSB8fCBlWydAQGl0ZXJhdG9yJ10gfHwgb1tyKGUpXTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IHt9OwogICAgICAgICAgICAgICAgcltuKDgpKCd0b1N0cmluZ1RhZycpXSA9ICd6JywgZS5leHBvcnRzID0gJ1tvYmplY3Qgel0nID09PSBTdHJpbmcocik7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oOCkoJ2l0ZXJhdG9yJyksIG8gPSAhMTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAwLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7IGRvbmU6ICEhaSsrIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGFbcl0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgIH0sIEFycmF5LmZyb20oYSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAyOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSBjYXRjaCAocykgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIXQgJiYgIW8pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICExOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIGlbcl0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsgZG9uZTogbiA9ICEwIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZShpKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChzKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCEoZSBpbnN0YW5jZW9mIHQpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ0luY29ycmVjdCAnICsgKG4gPyBuICsgJyAnIDogJycpICsgJ2ludm9jYXRpb24nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMyksIG8gPSBuKDE4Nyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgKCdfX3Byb3RvX18nIGluIHt9ID8gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlLCB0ID0gITEsIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAoZSA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoT2JqZWN0LnByb3RvdHlwZSwgJ19fcHJvdG9fXycpLnNldCkuY2FsbChuLCBbXSksIHQgPSBuIGluc3RhbmNlb2YgQXJyYXk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaSkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIobiksIG8oaSksIHQgPyBlLmNhbGwobiwgaSkgOiBuLl9fcHJvdG9fXyA9IGksIG47CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKSA6IHZvaWQgMCk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDE4OCksIGkgPSBuKDc0KSwgYSA9IG4oNzIpLCBzID0gbigyNyksIGMgPSBuKDIyKSwgdSA9IG4oMjMpLCBsID0gbig4KSwgZiA9IG4oNCksIHAgPSBuKDQxKSwgZCA9IG4oMTA1KSwgaCA9IGQuSXRlcmF0b3JQcm90b3R5cGUsIG0gPSBkLkJVR0dZX1NBRkFSSV9JVEVSQVRPUlMsIGcgPSBsKCdpdGVyYXRvcicpLCB2ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4sIGwsIGQsIHksIGIpIHsKICAgICAgICAgICAgICAgICAgICBvKG4sIHQsIGwpOwogICAgICAgICAgICAgICAgICAgIHZhciBFLCB3LCB4LCBTID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSBkICYmIFApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW0gJiYgZSBpbiBUKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdrZXlzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3ZhbHVlcyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbnRyaWVzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IG4odGhpcywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBuKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgQyA9IHQgKyAnIEl0ZXJhdG9yJywgayA9ICExLCBUID0gZS5wcm90b3R5cGUsIF8gPSBUW2ddIHx8IFRbJ0BAaXRlcmF0b3InXSB8fCBkICYmIFRbZF0sIFAgPSAhbSAmJiBfIHx8IFMoZCksIE8gPSAnQXJyYXknID09IHQgJiYgVC5lbnRyaWVzIHx8IF87CiAgICAgICAgICAgICAgICAgICAgaWYgKE8gJiYgKEUgPSBpKE8uY2FsbChuZXcgZSgpKSksIGggIT09IE9iamVjdC5wcm90b3R5cGUgJiYgRS5uZXh0ICYmIChmIHx8IGkoRSkgPT09IGggfHwgKGEgPyBhKEUsIGgpIDogJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgRVtnXSAmJiBjKEUsIGcsIHYpKSwgcyhFLCBDLCAhMCwgITApLCBmICYmIChwW0NdID0gdikpKSwgJ3ZhbHVlcycgPT0gZCAmJiBfICYmICd2YWx1ZXMnICE9PSBfLm5hbWUgJiYgKGsgPSAhMCwgUCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBmICYmICFiIHx8IFRbZ10gPT09IFAgfHwgYyhULCBnLCBQKSwgcFt0XSA9IFAsIGQpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlczogUygndmFsdWVzJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5czogeSA/IFAgOiBTKCdrZXlzJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW50cmllczogUygnZW50cmllcycpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh4IGluIHcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG0gfHwgayB8fCAhKHggaW4gVCkpICYmIHUoVCwgeCwgd1t4XSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldDogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBtIHx8IGsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHcpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB3OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNCksIG8gPSBuKDI2KSwgaSA9IG4oNDYpLCBhID0gbigxODkpLCBzID0gaSgnSUVfUFJPVE8nKSwgYyA9IE9iamVjdC5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBhID8gT2JqZWN0LmdldFByb3RvdHlwZU9mIDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IG8oZSksIHIoZSwgcykgPyBlW3NdIDogJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZS5jb25zdHJ1Y3RvciAmJiBlIGluc3RhbmNlb2YgZS5jb25zdHJ1Y3RvciA/IGUuY29uc3RydWN0b3IucHJvdG90eXBlIDogZSBpbnN0YW5jZW9mIE9iamVjdCA/IGMgOiBudWxsOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzNyksIG8gPSBuKDcpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gJ3Byb2Nlc3MnID09IHIoby5wcm9jZXNzKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzKSwgbyA9IG4oNjgpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG8oZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT0gdHlwZW9mIHQpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcihTdHJpbmcoZSkgKyAnIGlzIG5vdCBpdGVyYWJsZScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQuY2FsbChlKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pIHx8ICh0W25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgcihuKDEzMikpLCByKG4oNzgpKSwgcihuKDI5MikpLCByKG4oMjk2KSksIHIobigxMzcpKSwgcihuKDE0MykpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTcpLCBvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBvLCBpLCBhLCBzLCBjLCB1LCBsLCBmLCBwLCBkLCBoLCBtLCBnLCB2LCB5LCBiOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9IHIuRmllbGRzLmNtcElkLCBuID0gci5GaWVsZHMuY21wVmVyc2lvbiwgbyA9IHIuRmllbGRzLmNvbnNlbnRMYW5ndWFnZSwgaSA9IHIuRmllbGRzLmNvbnNlbnRTY3JlZW4sIGEgPSByLkZpZWxkcy5jcmVhdGVkLCBzID0gci5GaWVsZHMuaXNTZXJ2aWNlU3BlY2lmaWMsIGMgPSByLkZpZWxkcy5sYXN0VXBkYXRlZCwgdSA9IHIuRmllbGRzLnBvbGljeVZlcnNpb24sIGwgPSByLkZpZWxkcy5wdWJsaXNoZXJDb3VudHJ5Q29kZSwgZiA9IHIuRmllbGRzLnB1Ymxpc2hlckxlZ2l0aW1hdGVJbnRlcmVzdHMsIHAgPSByLkZpZWxkcy5wdWJsaXNoZXJDb25zZW50cywgZCA9IHIuRmllbGRzLnB1cnBvc2VDb25zZW50cywgaCA9IHIuRmllbGRzLnB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzLCBtID0gci5GaWVsZHMucHVycG9zZU9uZVRyZWF0bWVudCwgZyA9IHIuRmllbGRzLnNwZWNpYWxGZWF0dXJlT3B0aW5zLCB2ID0gci5GaWVsZHMudXNlTm9uU3RhbmRhcmRTdGFja3MsIHkgPSByLkZpZWxkcy52ZW5kb3JMaXN0VmVyc2lvbiwgYiA9IHIuRmllbGRzLnZlcnNpb24sIGVbdF0gPSAxMiwgZVtuXSA9IDEyLCBlW29dID0gMTIsIGVbaV0gPSA2LCBlW2FdID0gMzYsIGVbc10gPSAxLCBlW2NdID0gMzYsIGVbdV0gPSA2LCBlW2xdID0gMTIsIGVbZl0gPSAyNCwgZVtwXSA9IDI0LCBlW2RdID0gMjQsIGVbaF0gPSAyNCwgZVttXSA9IDEsIGVbZ10gPSAxMiwgZVt2XSA9IDEsIGVbeV0gPSAxMiwgZVtiXSA9IDYsIGUuYW55Qm9vbGVhbiA9IDEsIGUuZW5jb2RpbmdUeXBlID0gMSwgZS5tYXhJZCA9IDE2LCBlLm51bUN1c3RvbVB1cnBvc2VzID0gNiwgZS5udW1FbnRyaWVzID0gMTIsIGUubnVtUmVzdHJpY3Rpb25zID0gMTIsIGUucHVycG9zZUlkID0gNiwgZS5yZXN0cmljdGlvblR5cGUgPSAyLCBlLnNlZ21lbnRUeXBlID0gMywgZS5zaW5nbGVPclJhbmdlID0gMSwgZS52ZW5kb3JJZCA9IDE2LCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuQml0TGVuZ3RoID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIChyID0gdC5SZXN0cmljdGlvblR5cGUgfHwgKHQuUmVzdHJpY3Rpb25UeXBlID0ge30pKVtyLk5PVF9BTExPV0VEID0gMF0gPSAnTk9UX0FMTE9XRUQnLCByW3IuUkVRVUlSRV9DT05TRU5UID0gMV0gPSAnUkVRVUlSRV9DT05TRU5UJywgcltyLlJFUVVJUkVfTEkgPSAyXSA9ICdSRVFVSVJFX0xJJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDQzKSwgbyA9IG4oMTUpLCBpID0gbigxNyksIGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZW5jb2RlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAnJywgbyA9IDE7IG8gPD0gdDsgbysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gKz0gci5Cb29sZWFuRW5jb2Rlci5lbmNvZGUoZS5oYXMobykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZGVjb2RlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmxlbmd0aCAhPT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgby5EZWNvZGluZ0Vycm9yKCdiaXRmaWVsZCBlbmNvZGluZyBsZW5ndGggbWlzbWF0Y2gnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBuZXcgaS5WZWN0b3IoKSwgYSA9IDE7IGEgPD0gdDsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuQm9vbGVhbkVuY29kZXIuZGVjb2RlKGVbYSAtIDFdKSAmJiBuLnNldChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmJpdExlbmd0aCA9IGUubGVuZ3RoLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuRml4ZWRWZWN0b3JFbmNvZGVyID0gYTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigzNCksIG8gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkQ29udGV4dFR5cGVzOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dFR5cGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0VHlwZXM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0UHJvcHM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGdldERlZmF1bHRQcm9wczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGdldERlcml2ZWRTdGF0ZUZyb21FcnJvcjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGdldERlcml2ZWRTdGF0ZUZyb21Qcm9wczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIG1peGluczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHByb3BUeXBlczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSwgaSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGxlbmd0aDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHByb3RvdHlwZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxlcjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxlZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3VtZW50czogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGFyaXR5OiAhMAogICAgICAgICAgICAgICAgICAgIH0sIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICQkdHlwZW9mOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29tcGFyZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRQcm9wczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgcHJvcFR5cGVzOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogITAKICAgICAgICAgICAgICAgICAgICB9LCBzID0ge307CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5pc01lbW8oZSkgPyBhIDogc1tlLiQkdHlwZW9mXSB8fCBvOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc1tyLkZvcndhcmRSZWZdID0gewogICAgICAgICAgICAgICAgICAgICQkdHlwZW9mOiAhMCwKICAgICAgICAgICAgICAgICAgICByZW5kZXI6ICEwLAogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRQcm9wczogITAsCiAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICEwLAogICAgICAgICAgICAgICAgICAgIHByb3BUeXBlczogITAKICAgICAgICAgICAgICAgIH0sIHNbci5NZW1vXSA9IGE7CiAgICAgICAgICAgICAgICB2YXIgdSA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0eSwgbCA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzLCBmID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scywgcCA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IsIGQgPSBPYmplY3QuZ2V0UHJvdG90eXBlT2YsIGggPSBPYmplY3QucHJvdG90eXBlOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gZSh0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9PSB0eXBlb2YgbikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBkKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbyAmJiBvICE9PSBoICYmIGUodCwgbywgcik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBsKG4pOwogICAgICAgICAgICAgICAgICAgICAgICBmICYmIChhID0gYS5jb25jYXQoZihuKSkpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBzID0gYyh0KSwgbSA9IGMobiksIGcgPSAwOyBnIDwgYS5sZW5ndGg7ICsrZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSBhW2ddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpW3ZdICYmICghciB8fCAhclt2XSkgJiYgKCFtIHx8ICFtW3ZdKSAmJiAoIXMgfHwgIXNbdl0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHkgPSBwKG4sIHYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUodCwgdiwgeSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAoZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbywgaSA9IG4oMTQ3KTsKICAgICAgICAgICAgICAgICAgICBvID0gJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBzZWxmID8gc2VsZiA6ICd1bmRlZmluZWQnICE9PSB0eXBlb2Ygd2luZG93ID8gd2luZG93IDogJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBlID8gZSA6IHI7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBPYmplY3QoaS5hKShvKTsKICAgICAgICAgICAgICAgICAgICB0LmEgPSBhOwogICAgICAgICAgICAgICAgfS5jYWxsKHRoaXMsIG4oODUpLCBuKDI2NykoZSkpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IC9eXDArL2csIHIgPSAvW1wwXHJcZl0vZywgbyA9IC86ICovZywgaSA9IC96b298Z3JhLywgYSA9IC8oWyw6IF0pKHRyYW5zZm9ybSkvZywgcyA9IC8sK1xzKig/IVteKF0qWyldKS9nLCBjID0gLyArXHMqKD8hW14oXSpbKV0pL2csIHUgPSAvICpbXDBdICovZywgbCA9IC8sXHIrPy9nLCBmID0gLyhbXHRcclxuIF0pKlxmPyYvZywgcCA9IC86Z2xvYmFsXCgoKD86W15cKFwpXFtcXV0qfFxbLipcXXxcKFteXChcKV0qXCkpKilcKS9nLCBkID0gL1xXKy9nLCBoID0gL0Aoa1x3KylccyooXFMqKVxzKi8sIG0gPSAvOjoocGxhY2UpL2csIGcgPSAvOihyZWFkLW9ubHkpL2csIHYgPSAvXHMrKD89W3tcXTs9Oj5dKS9nLCB5ID0gLyhbW309Oj5dKVxzKy9nLCBiID0gLyhce1tee10rPyk7KD89XH0pL2csIEUgPSAvXHN7Mix9L2csIHcgPSAvKFteXChdKSg6KykgKi9nLCB4ID0gL1tzdmhdXHcrLVt0YmxyXXsyfS8sIFMgPSAvXChccyooLiopXHMqXCkvZywgQyA9IC8oW1xzXFNdKj8pOy9nLCBrID0gLy1zZWxmfGZsZXgtL2csIFQgPSAvW15dKj8oOltycF1bZWxdYVtcdy1dKylbXl0qLywgXyA9IC9zdHJldGNofDpccypcdytcLSg/OmNvbnRlfGF2YWlsKS8sIFAgPSAvKFteLV0pKGltYWdlLXNldFwoKS8sIE8gPSAnLXdlYmtpdC0nLCBJID0gJy1tb3otJywgTCA9ICctbXMtJywgQSA9IDU5LCBSID0gMTI1LCBOID0gMTIzLCBqID0gNDAsIHEgPSA0MSwgRiA9IDEwLCBEID0gMTMsIE0gPSAzMiwgVSA9IDQ1LCBWID0gNDIsIEIgPSA0NCwgeiA9IDU4LCBHID0gNDcsIEggPSAxLCBXID0gMSwgJCA9IDAsIFkgPSAxLCBRID0gMSwgSyA9IDEsIEogPSAwLCBYID0gMCwgWiA9IDAsIGVlID0gW10sIHRlID0gW10sIG5lID0gMCwgcmUgPSBudWxsLCBvZSA9IDAsIGllID0gMSwgYWUgPSAnJywgc2UgPSAnJywgY2UgPSAnJzsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1ZShlLCB0LCBvLCBpLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMsIGMsIGwgPSAwLCBmID0gMCwgcCA9IDAsIGQgPSAwLCB2ID0gMCwgeSA9IDAsIGIgPSAwLCBFID0gMCwgeCA9IDAsIEMgPSAwLCBrID0gMCwgVCA9IDAsIF8gPSAwLCBQID0gMCwgSSA9IDAsIEwgPSAwLCBKID0gMCwgdGUgPSAwLCByZSA9IDAsIGZlID0gby5sZW5ndGgsIHZlID0gZmUgLSAxLCB5ZSA9ICcnLCBiZSA9ICcnLCBFZSA9ICcnLCB3ZSA9ICcnLCB4ZSA9ICcnLCBTZSA9ICcnOyBJIDwgZmU7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IG8uY2hhckNvZGVBdChJKSwgSSA9PT0gdmUgJiYgZiArIGQgKyBwICsgbCAhPT0gMCAmJiAoMCAhPT0gZiAmJiAoYiA9IGYgPT09IEcgPyBGIDogRyksIGQgPSBwID0gbCA9IDAsIGZlKyssIHZlKyspLCBmICsgZCArIHAgKyBsID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEkgPT09IHZlICYmIChMID4gMCAmJiAoYmUgPSBiZS5yZXBsYWNlKHIsICcnKSksIGJlLnRyaW0oKS5sZW5ndGggPiAwKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBEOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlICs9IG8uY2hhckF0KEkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBBOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PT0gSikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBSOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgajoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKEogPSAwLCByZSA9IEksIHYgPSBiLCBJLS0sIGIgPSBBOyByZSA8IGZlOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKG8uY2hhckNvZGVBdChyZSsrKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBBOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArK0ksIGIgPSB2LCByZSA9IGZlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHo6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEwgPiAwICYmICgrK0ksIGIgPSB2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE46CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlID0gZmU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBOOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHYgPSAoYmUgPSBiZS50cmltKCkpLmNoYXJDb2RlQXQoMCksIGsgPSAxLCByZSA9ICsrSTsgSSA8IGZlOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChiID0gby5jaGFyQ29kZUF0KEkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE46CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaysrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBSOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGstLTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHkgPSBvLmNoYXJDb2RlQXQoSSArIDEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBWOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSSA9IGdlKHksIEksIHZlLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDkxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgajoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgSSsrIDwgdmUgJiYgby5jaGFyQ29kZUF0KEkpICE9PSBiOyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gaykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEkrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKEVlID0gby5zdWJzdHJpbmcocmUsIEkpLCAwID09PSB2ICYmICh2ID0gKGJlID0gYmUucmVwbGFjZShuLCAnJykudHJpbSgpKS5jaGFyQ29kZUF0KDApKSwgdikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChMID4gMCAmJiAoYmUgPSBiZS5yZXBsYWNlKHIsICcnKSksIHkgPSBiZS5jaGFyQ29kZUF0KDEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTA5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMTU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSBlZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZSA9IChFZSA9IHVlKHQsIHMsIEVlLCB5LCBhICsgMSkpLmxlbmd0aCwgWiA+IDAgJiYgMCA9PT0gcmUgJiYgKHJlID0gYmUubGVuZ3RoKSwgbmUgPiAwICYmIChjID0gbWUoMywgRWUsIHMgPSBsZShlZSwgYmUsIHRlKSwgdCwgVywgSCwgcmUsIHksIGEsIGkpLCBiZSA9IHMuam9pbignJyksIHZvaWQgMCAhPT0gYyAmJiAwID09PSAocmUgPSAoRWUgPSBjLnRyaW0oKSkubGVuZ3RoKSAmJiAoeSA9IDAsIEVlID0gJycpKSwgcmUgPiAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoeSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTE1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiZSA9IGJlLnJlcGxhY2UoUywgaGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTAwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTA5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWUgPSBiZSArICd7JyArIEVlICsgJ30nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWUgPSAoYmUgPSBiZS5yZXBsYWNlKGgsICckMSAkMicgKyAoaWUgPiAwID8gYWUgOiAnJykpKSArICd7JyArIEVlICsgJ30nLCBFZSA9IDEgPT09IFEgfHwgMiA9PT0gUSAmJiBkZSgnQCcgKyBFZSwgMykgPyAnQCcgKyBPICsgRWUgKyAnQCcgKyBFZSA6ICdAJyArIEVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFZSA9IGJlICsgRWUsIDExMiA9PT0gaSAmJiAod2UgKz0gRWUsIEVlID0gJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFZSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFZSA9IHVlKHQsIGxlKHQsIGJlLCB0ZSksIEVlLCBpLCBhICsgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeGUgKz0gRWUsIFQgPSAwLCBKID0gMCwgUCA9IDAsIEwgPSAwLCB0ZSA9IDAsIF8gPSAwLCBiZSA9ICcnLCBFZSA9ICcnLCBiID0gby5jaGFyQ29kZUF0KCsrSSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgUjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgocmUgPSAoYmUgPSAoTCA+IDAgPyBiZS5yZXBsYWNlKHIsICcnKSA6IGJlKS50cmltKCkpLmxlbmd0aCkgPiAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICgwID09PSBQICYmICgodiA9IGJlLmNoYXJDb2RlQXQoMCkpID09PSBVIHx8IHYgPiA5NiAmJiB2IDwgMTIzKSAmJiAocmUgPSAoYmUgPSBiZS5yZXBsYWNlKCcgJywgJzonKSkubGVuZ3RoKSwgbmUgPiAwICYmIHZvaWQgMCAhPT0gKGMgPSBtZSgxLCBiZSwgdCwgZSwgVywgSCwgd2UubGVuZ3RoLCBpLCBhLCBpKSkgJiYgMCA9PT0gKHJlID0gKGJlID0gYy50cmltKCkpLmxlbmd0aCkgJiYgKGJlID0gJ1wwXDAnKSwgdiA9IGJlLmNoYXJDb2RlQXQoMCksIHkgPSBiZS5jaGFyQ29kZUF0KDEpLCB2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxMDUgPT09IHkgfHwgOTkgPT09IHkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2UgKz0gYmUgKyBvLmNoYXJBdChJKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYmUuY2hhckNvZGVBdChyZSAtIDEpID09PSB6KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ZSArPSBwZShiZSwgdiwgeSwgYmUuY2hhckNvZGVBdCgyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQgPSAwLCBKID0gMCwgUCA9IDAsIEwgPSAwLCB0ZSA9IDAsIGJlID0gJycsIGIgPSBvLmNoYXJDb2RlQXQoKytJKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZiArIGQgKyBwICsgbCArIFggPT09IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoQykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNjQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTI2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDYyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBVOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHo6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBBOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE46CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgUjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUCA+IDAgJiYgKEogPSAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPT09IEcgPyBmID0gMCA6IFkgKyBUID09PSAwICYmIDEwNyAhPT0gaSAmJiBiZS5sZW5ndGggPiAwICYmIChMID0gMSwgYmUgKz0gJ1wwJyksIG5lICogb2UgPiAwICYmIG1lKDAsIGJlLCB0LCBlLCBXLCBILCB3ZS5sZW5ndGgsIGksIGEsIGkpLCBIID0gMSwgVysrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBBOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBSOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmICsgZCArIHAgKyBsID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEgrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKEgrKywgeWUgPSBvLmNoYXJBdChJKSwgYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE06CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkICsgbCArIGYgPT09IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKEUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgejoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5ZSA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiICE9PSBNICYmICh5ZSA9ICcgJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWUgPSAnXFwwJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWUgPSAnXFxmJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWUgPSAnXFx2JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCArIGYgKyBsID09PSAwICYmIFkgPiAwICYmICh0ZSA9IDEsIEwgPSAxLCB5ZSA9ICdcZicgKyB5ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTA4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCArIGYgKyBsICsgJCA9PT0gMCAmJiBQID4gMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoSSAtIFApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMTIgPT09IEUgJiYgby5jaGFyQ29kZUF0KEkgLSAzKSA9PT0geiAmJiAoJCA9IEUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDExMSA9PT0geCAmJiAoJCA9IHgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHo6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgKyBmICsgbCA9PT0gMCAmJiAoUCA9IEkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgKyBwICsgZCArIGwgPT09IDAgJiYgKEwgPSAxLCB5ZSArPSAnXHInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwID09PSBmICYmIChkID0gZCA9PT0gYiA/IDAgOiAwID09PSBkID8gYiA6IGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDkxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkICsgZiArIHAgPT09IDAgJiYgbCsrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDkzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkICsgZiArIHAgPT09IDAgJiYgbC0tOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgKyBmICsgbCA9PT0gMCAmJiBwLS07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgajoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgKyBmICsgbCA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IFQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICgyICogRSArIDMgKiB4KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA1MzM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsgPSAwLCBUID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2NDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiArIHAgKyBkICsgbCArIFAgKyBfID09PSAwICYmIChfID0gMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkICsgbCArIHAgPiAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKDIgKiBiICsgMyAqIG8uY2hhckNvZGVBdChJICsgMSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjM1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBHOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMjA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmUgPSBJLCBmID0gVjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID09PSBHICYmIEUgPT09IFYgJiYgcmUgKyAyICE9PSBJICYmICgzMyA9PT0gby5jaGFyQ29kZUF0KHJlICsgMikgJiYgKHdlICs9IG8uc3Vic3RyaW5nKHJlLCBJICsgMSkpLCB5ZSA9ICcnLCBmID0gMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFkgKyBkICsgbCArIF8gPT09IDAgJiYgMTA3ICE9PSBpICYmIGIgIT09IEEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTI2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2MjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGo6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IFQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHllICs9ICdcMCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHllID0gJ1wwJyArIHllICsgKGIgPT09IEIgPyAnJyA6ICdcMCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEwgPSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBqOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUCArIDcgPT09IEkgJiYgMTA4ID09PSBFICYmIChQID0gMCksIFQgPSArK2s7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCA9PSAoVCA9IC0taykgJiYgKEwgPSAxLCB5ZSArPSAnXDAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoRSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE46CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBSOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPT09IFQgJiYgKEwgPSAxLCB5ZSArPSAnXDAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlICs9IHllLCBiICE9PSBNICYmIDkgIT09IGIgJiYgKEMgPSBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ID0gRSwgRSA9IGIsIEkrKzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAocmUgPSB3ZS5sZW5ndGgsIFogPiAwICYmIDAgPT09IHJlICYmIDAgPT09IHhlLmxlbmd0aCAmJiAwID09PSB0WzBdLmxlbmd0aCA9PSAwICYmICgxMDkgIT09IGkgfHwgMSA9PT0gdC5sZW5ndGggJiYgKFkgPiAwID8gc2UgOiBjZSkgPT09IHRbMF0pICYmIChyZSA9IHQuam9pbignLCcpLmxlbmd0aCArIDIpLCByZSA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzID0gMCA9PT0gWSAmJiAxMDcgIT09IGkgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0LCBuLCBvID0gMCwgaSA9IGUubGVuZ3RoLCBhID0gQXJyYXkoaSk7IG8gPCBpOyArK28pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSBlW29dLnNwbGl0KHUpLCBjID0gJycsIGwgPSAwLCBmID0gMCwgcCA9IDAsIGQgPSAwLCBoID0gcy5sZW5ndGg7IGwgPCBoOyArK2wpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoMCA9PT0gKGYgPSAobiA9IHNbbF0pLmxlbmd0aCkgJiYgaCA+IDEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwID0gYy5jaGFyQ29kZUF0KGMubGVuZ3RoIC0gMSksIGQgPSBuLmNoYXJDb2RlQXQoMCksIHQgPSAnJywgMCAhPT0gbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAocCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBWOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDYyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0MzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgajoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9ICcgJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gdCArIHNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEyNjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2MjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0MzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgajoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDkxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHQgKyBuICsgc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB6OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICgyICogbi5jaGFyQ29kZUF0KDEpICsgMyAqIG4uY2hhckNvZGVBdCgyKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA1MzA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEsgPiAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB0ICsgbi5zdWJzdHJpbmcoOCwgZiAtIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChsIDwgMSB8fCBzW2wgLSAxXS5sZW5ndGggPCAxKSAmJiAobiA9IHQgKyBzZSArIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBmID4gMSAmJiBuLmluZGV4T2YoJzonKSA+IDAgPyB0ICsgbi5yZXBsYWNlKHcsICckMScgKyBzZSArICckMicpIDogdCArIG4gKyBzZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjICs9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtvXSA9IGMucmVwbGFjZShyLCAnJykudHJpbSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0odCkgOiB0LCBuZSA+IDAgJiYgdm9pZCAwICE9PSAoYyA9IG1lKDIsIHdlLCBzLCBlLCBXLCBILCByZSwgaSwgYSwgaSkpICYmIDAgPT09ICh3ZSA9IGMpLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gU2UgKyB3ZSArIHhlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdlID0gcy5qb2luKCcsJykgKyAneycgKyB3ZSArICd9JywgUSAqICQgIT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoMiAhPT0gUSB8fCBkZSh3ZSwgMikgfHwgKCQgPSAwKSwgJCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTExOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ZSA9IHdlLnJlcGxhY2UoZywgJzotbW96LSQxJykgKyB3ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMTI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlID0gd2UucmVwbGFjZShtLCAnOjonICsgTyArICdpbnB1dC0kMScpICsgd2UucmVwbGFjZShtLCAnOjotbW96LSQxJykgKyB3ZS5yZXBsYWNlKG0sICc6LW1zLWlucHV0LSQxJykgKyB3ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJCA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNlICsgd2UgKyB4ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbGUoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQudHJpbSgpLnNwbGl0KGwpLCBvID0gciwgaSA9IHIubGVuZ3RoLCBhID0gZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSAwLCBjID0gMCA9PT0gYSA/ICcnIDogZVswXSArICcgJzsgcyA8IGk7ICsrcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvW3NdID0gZmUoYywgb1tzXSwgbiwgYSkudHJpbSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobyA9IFtdOyBzIDwgaTsgKytzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSAwOyBmIDwgYTsgKytmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvW3UrK10gPSBmZShlW2ZdICsgJyAnLCByW3NdLCBuLCBhKS50cmltKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZlKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0LCBpID0gby5jaGFyQ29kZUF0KDApOwogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGkgPCAzMyAmJiAoaSA9IChvID0gby50cmltKCkpLmNoYXJDb2RlQXQoMCkpLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKFkgKyByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IGUudHJpbSgpLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLnJlcGxhY2UoZiwgJyQxJyArIGUudHJpbSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHo6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKG8uY2hhckNvZGVBdCgxKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEsgPiAwICYmIFkgPiAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5yZXBsYWNlKHAsICckMScpLnJlcGxhY2UoZiwgJyQxJyArIGNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudHJpbSgpICsgby5yZXBsYWNlKGYsICckMScgKyBlLnRyaW0oKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiAqIFkgPiAwICYmIG8uaW5kZXhPZignXGYnKSA+IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8ucmVwbGFjZShmLCAoZS5jaGFyQ29kZUF0KDApID09PSB6ID8gJycgOiAnJDEnKSArIGUudHJpbSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSArIG87CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHBlKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUsIGwgPSAwLCBmID0gZSArICc7JywgcCA9IDIgKiB0ICsgMyAqIG4gKyA0ICogcjsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDk0NCA9PT0gcCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5sZW5ndGgsIG4gPSBlLmluZGV4T2YoJzonLCA5KSArIDEsIHIgPSBlLnN1YnN0cmluZygwLCBuKS50cmltKCksIG8gPSBlLnN1YnN0cmluZyhuLCB0IC0gMSkudHJpbSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5jaGFyQ29kZUF0KDkpICogaWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDExMCAhPT0gZS5jaGFyQ29kZUF0KDEwKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gby5zcGxpdCgobyA9ICcnLCBzKSksIGEgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSAwLCB0ID0gaS5sZW5ndGg7IGEgPCB0OyBuID0gMCwgKythKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB1ID0gaVthXSwgbCA9IHUuc3BsaXQoYyk7IHUgPSBsW25dOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gdS5jaGFyQ29kZUF0KDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxID09PSBpZSAmJiAoZiA+IDY0ICYmIGYgPCA5MCB8fCBmID4gOTYgJiYgZiA8IDEyMyB8fCA5NSA9PT0gZiB8fCBmID09PSBVICYmIHUuY2hhckNvZGVBdCgxKSAhPT0gVSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoaXNOYU4ocGFyc2VGbG9hdCh1KSkgKyAoLTEgIT09IHUuaW5kZXhPZignKCcpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2luZmluaXRlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2FsdGVybmF0ZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdiYWNrd2FyZHMnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncnVubmluZyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdub3JtYWwnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZm9yd2FyZHMnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYm90aCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdub25lJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2xpbmVhcic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlYXNlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Vhc2UtaW4nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZWFzZS1vdXQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZWFzZS1pbi1vdXQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncGF1c2VkJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3JldmVyc2UnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYWx0ZXJuYXRlLXJldmVyc2UnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaW5oZXJpdCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdpbml0aWFsJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3Vuc2V0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3N0ZXAtc3RhcnQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc3RlcC1lbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ICs9IGFlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbFtuKytdID0gdTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gKz0gKDAgPT09IGEgPyAnJyA6ICcsJykgKyBsLmpvaW4oJyAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyA9IHIgKyBvICsgJzsnLCAxID09PSBRIHx8IDIgPT09IFEgJiYgZGUobywgMSkgPyBPICsgbyArIG8gOiBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShmKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IFEgfHwgMiA9PT0gUSAmJiAhZGUoZiwgMSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTAxNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiA5NyA9PT0gZi5jaGFyQ29kZUF0KDEwKSA/IE8gKyBmICsgZiA6IGY7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOTUxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDExNiA9PT0gZi5jaGFyQ29kZUF0KDMpID8gTyArIGYgKyBmIDogZjsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5NjM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTEwID09PSBmLmNoYXJDb2RlQXQoNSkgPyBPICsgZiArIGYgOiBmOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwMDk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMTAwICE9PSBmLmNoYXJDb2RlQXQoNCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOTY5OgogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk0MjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPICsgZiArIGY7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOTc4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE8gKyBmICsgSSArIGYgKyBmOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwMTk6CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOTgzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE8gKyBmICsgSSArIGYgKyBMICsgZiArIGY7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgODgzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYuY2hhckNvZGVBdCg4KSA9PT0gVSA/IE8gKyBmICsgZiA6IGYuaW5kZXhPZignaW1hZ2Utc2V0KCcsIDExKSA+IDAgPyBmLnJlcGxhY2UoUCwgJyQxJyArIE8gKyAnJDInKSArIGYgOiBmOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDkzMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmLmNoYXJDb2RlQXQoNCkgPT09IFUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChmLmNoYXJDb2RlQXQoNSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE8gKyAnYm94LScgKyBmLnJlcGxhY2UoJy1ncm93JywgJycpICsgTyArIGYgKyBMICsgZi5yZXBsYWNlKCdncm93JywgJ3Bvc2l0aXZlJykgKyBmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTE1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTyArIGYgKyBMICsgZi5yZXBsYWNlKCdzaHJpbmsnLCAnbmVnYXRpdmUnKSArIGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5ODoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE8gKyBmICsgTCArIGYucmVwbGFjZSgnYmFzaXMnLCAncHJlZmVycmVkLXNpemUnKSArIGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE8gKyBmICsgTCArIGYgKyBmOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk2NDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPICsgZiArIEwgKyAnZmxleC0nICsgZiArIGY7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTAyMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg5OSAhPT0gZi5jaGFyQ29kZUF0KDgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUgPSBmLnN1YnN0cmluZyhmLmluZGV4T2YoJzonLCAxNSkpLnJlcGxhY2UoJ2ZsZXgtJywgJycpLnJlcGxhY2UoJ3NwYWNlLWJldHdlZW4nLCAnanVzdGlmeScpLCBPICsgJ2JveC1wYWNrJyArIHUgKyBPICsgZiArIEwgKyAnZmxleC1wYWNrJyArIHUgKyBmOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwMDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS50ZXN0KGYpID8gZi5yZXBsYWNlKG8sICc6JyArIE8pICsgZi5yZXBsYWNlKG8sICc6JyArIEkpICsgZiA6IGY7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTAwMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobCA9ICh1ID0gZi5zdWJzdHJpbmcoMTMpLnRyaW0oKSkuaW5kZXhPZignLScpICsgMSwgdS5jaGFyQ29kZUF0KDApICsgdS5jaGFyQ29kZUF0KGwpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDIyNjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gZi5yZXBsYWNlKHgsICd0YicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMzI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSA9IGYucmVwbGFjZSh4LCAndGItcmwnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjIwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBmLnJlcGxhY2UoeCwgJ2xyJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE8gKyBmICsgTCArIHUgKyBmOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwMTc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoLTEgPT09IGYuaW5kZXhPZignc3RpY2t5JywgOSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOTc1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChsID0gKGYgPSBlKS5sZW5ndGggLSAxMCwgcCA9ICh1ID0gKDMzID09PSBmLmNoYXJDb2RlQXQobCkgPyBmLnN1YnN0cmluZygwLCBsKSA6IGYpLnN1YnN0cmluZyhlLmluZGV4T2YoJzonLCA3KSArIDEpLnRyaW0oKSkuY2hhckNvZGVBdCgwKSArICgwIHwgdS5jaGFyQ29kZUF0KDcpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyMDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUuY2hhckNvZGVBdCg4KSA8IDExMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDExNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gZi5yZXBsYWNlKHUsIE8gKyB1KSArICc7JyArIGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDIwNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBmLnJlcGxhY2UodSwgTyArIChwID4gMTAyID8gJ2lubGluZS0nIDogJycpICsgJ2JveCcpICsgJzsnICsgZi5yZXBsYWNlKHUsIE8gKyB1KSArICc7JyArIGYucmVwbGFjZSh1LCBMICsgdSArICdib3gnKSArICc7JyArIGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZiArICc7JzsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5Mzg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZi5jaGFyQ29kZUF0KDUpID09PSBVKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZi5jaGFyQ29kZUF0KDYpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1ID0gZi5yZXBsYWNlKCctaXRlbXMnLCAnJyksIE8gKyBmICsgTyArICdib3gtJyArIHUgKyBMICsgJ2ZsZXgtJyArIHUgKyBmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTE1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTyArIGYgKyBMICsgJ2ZsZXgtaXRlbS0nICsgZi5yZXBsYWNlKGssICcnKSArIGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE8gKyBmICsgTCArICdmbGV4LWxpbmUtcGFjaycgKyBmLnJlcGxhY2UoJ2FsaWduLWNvbnRlbnQnLCAnJykucmVwbGFjZShrLCAnJykgKyBmOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk3MzoKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5ODk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZi5jaGFyQ29kZUF0KDMpICE9PSBVIHx8IDEyMiA9PT0gZi5jaGFyQ29kZUF0KDQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDkzMToKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5NTM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoITAgPT09IF8udGVzdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTE1ID09PSAodSA9IGUuc3Vic3RyaW5nKGUuaW5kZXhPZignOicpICsgMSkpLmNoYXJDb2RlQXQoMCkgPyBwZShlLnJlcGxhY2UoJ3N0cmV0Y2gnLCAnZmlsbC1hdmFpbGFibGUnKSwgdCwgbiwgcikucmVwbGFjZSgnOmZpbGwtYXZhaWxhYmxlJywgJzpzdHJldGNoJykgOiBmLnJlcGxhY2UodSwgTyArIHUpICsgZi5yZXBsYWNlKHUsIEkgKyB1LnJlcGxhY2UoJ2ZpbGwtJywgJycpKSArIGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5NjI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZiA9IE8gKyBmICsgKDEwMiA9PT0gZi5jaGFyQ29kZUF0KDUpID8gTCArIGYgOiAnJykgKyBmLCBuICsgciA9PT0gMjExICYmIDEwNSA9PT0gZi5jaGFyQ29kZUF0KDEzKSAmJiBmLmluZGV4T2YoJ3RyYW5zZm9ybScsIDEwKSA+IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYuc3Vic3RyaW5nKDAsIGYuaW5kZXhPZignOycsIDI3KSArIDEpLnJlcGxhY2UoYSwgJyQxJyArIE8gKyAnJDInKSArIGY7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmluZGV4T2YoMSA9PT0gdCA/ICc6JyA6ICd7JyksIHIgPSBlLnN1YnN0cmluZygwLCAzICE9PSB0ID8gbiA6IDEwKSwgbyA9IGUuc3Vic3RyaW5nKG4gKyAxLCBlLmxlbmd0aCAtIDEpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmUoMiAhPT0gdCA/IHIgOiByLnJlcGxhY2UoVCwgJyQxJyksIG8sIHQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBoZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gcGUodCwgdC5jaGFyQ29kZUF0KDApLCB0LmNoYXJDb2RlQXQoMSksIHQuY2hhckNvZGVBdCgyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICE9PSB0ICsgJzsnID8gbi5yZXBsYWNlKEMsICcgb3IgKCQxKScpLnN1YnN0cmluZyg0KSA6ICcoJyArIHQgKyAnKSc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG1lKGUsIHQsIG4sIHIsIG8sIGksIGEsIHMsIGMsIHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbCwgZiA9IDAsIHAgPSB0OyBmIDwgbmU7ICsrZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobCA9IHRlW2ZdLmNhbGwoeWUsIGUsIHAsIG4sIHIsIG8sIGksIGEsIHMsIGMsIHUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHZvaWQgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgITE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICEwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBudWxsOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwID0gbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHAgIT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZ2UoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gdCArIDE7IG8gPCBuOyArK28pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHIuY2hhckNvZGVBdChvKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBHOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSBWICYmIHIuY2hhckNvZGVBdChvIC0gMSkgPT09IFYgJiYgdCArIDIgIT09IG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvICsgMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9PT0gRykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gKyAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdmUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0IGluIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAna2V5ZnJhbWUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGllID0gMCB8IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdnbG9iYWwnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEsgPSAwIHwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Nhc2NhZGUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFkgPSAwIHwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2NvbXByZXNzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKID0gMCB8IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdzZW1pY29sb24nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFggPSAwIHwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3ByZXNlcnZlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBaID0gMCB8IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdwcmVmaXgnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlID0gbnVsbCwgbiA/ICdmdW5jdGlvbicgIT0gdHlwZW9mIG4gPyBRID0gMSA6IChRID0gMiwgcmUgPSBuKSA6IFEgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geWUodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSB0aGlzICYmIHRoaXMuY29uc3RydWN0b3IgPT09IHllKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdCwgaSA9IG8uY2hhckNvZGVBdCgwKTsKICAgICAgICAgICAgICAgICAgICAgICAgaSA8IDMzICYmIChpID0gKG8gPSBvLnRyaW0oKSkuY2hhckNvZGVBdCgwKSksIGllID4gMCAmJiAoYWUgPSBvLnJlcGxhY2UoZCwgOTEgPT09IGkgPyAnJyA6ICctJykpLCBpID0gMSwgMSA9PT0gWSA/IGNlID0gbyA6IHNlID0gbzsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEsIHMgPSBbY2VdOwogICAgICAgICAgICAgICAgICAgICAgICBuZSA+IDAgJiYgdm9pZCAwICE9PSAoYSA9IG1lKC0xLCBuLCBzLCBzLCBXLCBILCAwLCAwLCAwLCAwKSkgJiYgJ3N0cmluZycgPT0gdHlwZW9mIGEgJiYgKG4gPSBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB1ZShlZSwgcywgbiwgMCwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZSA+IDAgJiYgdm9pZCAwICE9PSAoYSA9IG1lKC0yLCBjLCBzLCBzLCBXLCBILCBjLmxlbmd0aCwgMCwgMCwgMCkpICYmICdzdHJpbmcnICE9IHR5cGVvZiAoYyA9IGEpICYmIChpID0gMCksIGFlID0gJycsIGNlID0gJycsIHNlID0gJycsICQgPSAwLCBXID0gMSwgSCA9IDEsIEogKiBpID09IDAgPyBjIDogYy5yZXBsYWNlKHIsICcnKS5yZXBsYWNlKHYsICcnKS5yZXBsYWNlKHksICckMScpLnJlcGxhY2UoYiwgJyQxJykucmVwbGFjZShFLCAnICcpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4geWUudXNlID0gZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHZvaWQgMDoKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBudWxsOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmUgPSB0ZS5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZVtuZSsrXSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgnb2JqZWN0JyA9PSB0eXBlb2YgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMCwgciA9IHQubGVuZ3RoOyBuIDwgcjsgKytuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9lID0gMCB8ICEhdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCB5ZS5zZXQgPSB2ZSwgdm9pZCAwICE9PSB0ICYmIHZlKHQpLCB5ZTsKICAgICAgICAgICAgICAgIH0obnVsbCk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZS5sZW5ndGggIT09IHQubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCBlLmxlbmd0aDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVtuXSAhPT0gdFtuXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0LmEgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gdCAmJiAodCA9IHIpOwogICAgICAgICAgICAgICAgICAgIHZhciBvLCBpID0gW10sIGEgPSAhMTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gW10sIHMgPSAwOyBzIDwgYXJndW1lbnRzLmxlbmd0aDsgcysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcltzXSA9IGFyZ3VtZW50c1tzXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgJiYgbiA9PT0gdGhpcyAmJiB0KHIsIGkpIHx8IChvID0gZS5hcHBseSh0aGlzLCByKSwgYSA9ICEwLCBuID0gdGhpcywgaSA9IHIpLCBvOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICBuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBuID0gbiB8fCBuZXcgRnVuY3Rpb24oJ3JldHVybiB0aGlzJykoKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHIpIHsKICAgICAgICAgICAgICAgICAgICAnb2JqZWN0JyA9PT0gdHlwZW9mIHdpbmRvdyAmJiAobiA9IHdpbmRvdyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBuOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE4KSwgbyA9IG4oMTIpLCBpID0gbig1Nik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhciAmJiAhbyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDcgIT0gT2JqZWN0LmRlZmluZVByb3BlcnR5KGkoJ2RpdicpLCAnYScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gNzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pLmE7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNCksIG8gPSBuKDE1NiksIGkgPSBuKDM2KSwgYSA9IG4oMTkpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gbyh0KSwgcyA9IGEuZiwgYyA9IGkuZiwgdSA9IDA7IHUgPCBuLmxlbmd0aDsgdSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gblt1XTsKICAgICAgICAgICAgICAgICAgICAgICAgcihlLCBsKSB8fCBzKGUsIGwsIGModCwgbCkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE0KSwgbyA9IG4oMjUpLCBpID0gbig5MCkuaW5kZXhPZiwgYSA9IG4oMzgpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiwgcyA9IG8oZSksIGMgPSAwLCB1ID0gW107CiAgICAgICAgICAgICAgICAgICAgZm9yIChuIGluIHMpCiAgICAgICAgICAgICAgICAgICAgICAgICFyKGEsIG4pICYmIHIocywgbikgJiYgdS5wdXNoKG4pOwogICAgICAgICAgICAgICAgICAgIGZvciAoOyB0Lmxlbmd0aCA+IGM7KQogICAgICAgICAgICAgICAgICAgICAgICByKHMsIG4gPSB0W2MrK10pICYmICh+aSh1LCBuKSB8fCB1LnB1c2gobikpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB1OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNSksIG8gPSBuKDI0KSwgaSA9IG4oMTU3KSwgYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMsIGMgPSByKHQpLCB1ID0gbyhjLmxlbmd0aCksIGwgPSBpKGEsIHUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgbiAhPSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHUgPiBsOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChzID0gY1tsKytdKSAhPSBzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHUgPiBsOyBsKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoZSB8fCBsIGluIGMpICYmIGNbbF0gPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSB8fCBsIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWUgJiYgLTE7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBpbmNsdWRlczogYSghMCksCiAgICAgICAgICAgICAgICAgICAgaW5kZXhPZjogYSghMSkKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNjUpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gciAmJiAhU3ltYm9sLnNoYW0gJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvcjsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMCk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByKCdkb2N1bWVudCcsICdkb2N1bWVudEVsZW1lbnQnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig4KTsKICAgICAgICAgICAgICAgIHQuZiA9IHI7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oOSksIG8gPSBuKDU1KSwgaSA9IG4oMjYpLCBhID0gbigyNCksIHMgPSBuKDY2KSwgYyA9IFtdLnB1c2gsIHUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IDEgPT0gZSwgbiA9IDIgPT0gZSwgdSA9IDMgPT0gZSwgbCA9IDQgPT0gZSwgZiA9IDYgPT0gZSwgcCA9IDUgPT0gZSB8fCBmOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGQsIGgsIG0sIGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHYsIHksIGIgPSBpKGQpLCBFID0gbyhiKSwgdyA9IHIoaCwgbSwgMyksIHggPSBhKEUubGVuZ3RoKSwgUyA9IDAsIEMgPSBnIHx8IHMsIGsgPSB0ID8gQyhkLCB4KSA6IG4gPyBDKGQsIDApIDogdm9pZCAwOyB4ID4gUzsgUysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgocCB8fCBTIGluIEUpICYmICh5ID0gdyh2ID0gRVtTXSwgUywgYiksIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtbU10gPSB5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICh5KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMuY2FsbChrLCB2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAobCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmID8gLTEgOiB1IHx8IGwgPyBsIDogazsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgIGZvckVhY2g6IHUoMCksCiAgICAgICAgICAgICAgICAgICAgbWFwOiB1KDEpLAogICAgICAgICAgICAgICAgICAgIGZpbHRlcjogdSgyKSwKICAgICAgICAgICAgICAgICAgICBzb21lOiB1KDMpLAogICAgICAgICAgICAgICAgICAgIGV2ZXJ5OiB1KDQpLAogICAgICAgICAgICAgICAgICAgIGZpbmQ6IHUoNSksCiAgICAgICAgICAgICAgICAgICAgZmluZEluZGV4OiB1KDYpCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDQ1KSwgbyA9IG4oMTkpLCBpID0gbigzMSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gcih0KTsKICAgICAgICAgICAgICAgICAgICBhIGluIGUgPyBvLmYoZSwgYSwgaSgwLCBuKSkgOiBlW2FdID0gbjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTApOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gcignbmF2aWdhdG9yJywgJ3VzZXJBZ2VudCcpIHx8ICcnOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE4KSwgbyA9IG4oMTIpLCBpID0gbigxNCksIGEgPSBPYmplY3QuZGVmaW5lUHJvcGVydHksIHMgPSB7fSwgYyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGkocywgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzW2VdOwogICAgICAgICAgICAgICAgICAgIHQgfHwgKHQgPSB7fSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBbXVtlXSwgdSA9ICEhaSh0LCAnQUNDRVNTT1JTJykgJiYgdC5BQ0NFU1NPUlMsIGwgPSBpKHQsIDApID8gdFswXSA6IGMsIGYgPSBpKHQsIDEpID8gdFsxXSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gc1tlXSA9ICEhbiAmJiAhbyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1ICYmICFyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHsgbGVuZ3RoOiAtMSB9OwogICAgICAgICAgICAgICAgICAgICAgICB1ID8gYShlLCAxLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogYwogICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGVbMV0gPSAxLCBuLmNhbGwoZSwgbCwgZik7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDMpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmV0dXJuOwogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQuY2FsbChlKSkudmFsdWU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDgpLCBvID0gbig0MSksIGkgPSByKCdpdGVyYXRvcicpLCBhID0gQXJyYXkucHJvdG90eXBlOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBlICYmIChvLkFycmF5ID09PSBlIHx8IGFbaV0gPT09IGUpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig2OSksIG8gPSBuKDM3KSwgaSA9IG4oOCkoJ3RvU3RyaW5nVGFnJyksIGEgPSAnQXJndW1lbnRzJyA9PSBvKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFyZ3VtZW50czsKICAgICAgICAgICAgICAgICAgICB9KCkpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gciA/IG8gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGUgPyAnVW5kZWZpbmVkJyA6IG51bGwgPT09IGUgPyAnTnVsbCcgOiAnc3RyaW5nJyA9PSB0eXBlb2YgKG4gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0odCA9IE9iamVjdChlKSwgaSkpID8gbiA6IGEgPyBvKHQpIDogJ09iamVjdCcgPT0gKHIgPSBvKHQpKSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiB0LmNhbGxlZSA/ICdBcmd1bWVudHMnIDogcjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDcpLCBpID0gbig2NCksIGEgPSBuKDIzKSwgcyA9IG4oMTAyKSwgYyA9IG4oNSksIHUgPSBuKDcxKSwgbCA9IG4oMTMpLCBmID0gbigxMiksIHAgPSBuKDcwKSwgZCA9IG4oMjcpLCBoID0gbigxODYpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IC0xICE9PSBlLmluZGV4T2YoJ01hcCcpLCBnID0gLTEgIT09IGUuaW5kZXhPZignV2VhaycpLCB2ID0gbSA/ICdzZXQnIDogJ2FkZCcsIHkgPSBvW2VdLCBiID0geSAmJiB5LnByb3RvdHlwZSwgRSA9IHksIHcgPSB7fSwgeCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGJbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKGIsIGUsICdhZGQnID09IGUgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmNhbGwodGhpcywgMCA9PT0gZSA/IDAgOiBlKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiAnZGVsZXRlJyA9PSBlID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIShnICYmICFsKGUpKSAmJiB0LmNhbGwodGhpcywgMCA9PT0gZSA/IDAgOiBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiAnZ2V0JyA9PSBlID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyAmJiAhbChlKSA/IHZvaWQgMCA6IHQuY2FsbCh0aGlzLCAwID09PSBlID8gMCA6IGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6ICdoYXMnID09IGUgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKGcgJiYgIWwoZSkpICYmIHQuY2FsbCh0aGlzLCAwID09PSBlID8gMCA6IGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuY2FsbCh0aGlzLCAwID09PSBlID8gMCA6IGUsIG4pLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgaWYgKGkoZSwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgeSB8fCAhKGcgfHwgYi5mb3JFYWNoICYmICFmKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyB5KCkuZW50cmllcygpLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpKSkKICAgICAgICAgICAgICAgICAgICAgICAgRSA9IG4uZ2V0Q29uc3RydWN0b3IodCwgZSwgbSwgdiksIHMuUkVRVUlSRUQgPSAhMDsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChpKGUsICEwKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgUyA9IG5ldyBFKCksIEMgPSBTW3ZdKGcgPyB7fSA6IC0wLCAxKSAhPSBTLCBrID0gZihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUy5oYXMoMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgVCA9IHAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgeShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBfID0gIWcgJiYgZihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IG5ldyB5KCksIHQgPSA1OyB0LS07KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3ZdKHQsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZS5oYXMoLTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIFQgfHwgKChFID0gdChmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdSh0LCBFLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gaChuZXcgeSgpLCB0LCBFKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT0gbiAmJiBjKG4sIHJbdl0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGF0OiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6IG0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByOwogICAgICAgICAgICAgICAgICAgICAgICB9KSkucHJvdG90eXBlID0gYiwgYi5jb25zdHJ1Y3RvciA9IEUpLCAoayB8fCBfKSAmJiAoeCgnZGVsZXRlJyksIHgoJ2hhcycpLCBtICYmIHgoJ2dldCcpKSwgKF8gfHwgQykgJiYgeCh2KSwgZyAmJiBiLmNsZWFyICYmIGRlbGV0ZSBiLmNsZWFyOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd1tlXSA9IEUsIHIoewogICAgICAgICAgICAgICAgICAgICAgICBnbG9iYWw6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IEUgIT0geQogICAgICAgICAgICAgICAgICAgIH0sIHcpLCBkKEUsIGUpLCBnIHx8IG4uc2V0U3Ryb25nKEUsIGUsIG0pLCBFOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzOCksIG8gPSBuKDEzKSwgaSA9IG4oMTQpLCBhID0gbigxOSkuZiwgcyA9IG4oNDcpLCBjID0gbigxODUpLCB1ID0gcygnbWV0YScpLCBsID0gMCwgZiA9IE9iamVjdC5pc0V4dGVuc2libGUgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfSwgcCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEoZSwgdSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3RJRDogJ08nICsgKytsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlYWtEYXRhOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBkID0gZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgICAgICBSRVFVSVJFRDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgIGZhc3RLZXk6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzeW1ib2wnID09IHR5cGVvZiBlID8gZSA6ICgnc3RyaW5nJyA9PSB0eXBlb2YgZSA/ICdTJyA6ICdQJykgKyBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpKGUsIHUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0YnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdFJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbdV0ub2JqZWN0SUQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldFdlYWtEYXRhOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpKGUsIHUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3VdLndlYWtEYXRhOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBvbkZyZWV6ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjICYmIGQuUkVRVUlSRUQgJiYgZihlKSAmJiAhaShlLCB1KSAmJiBwKGUpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHJbdV0gPSAhMDsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxOSkuZiwgbyA9IG4oNDApLCBpID0gbigxMDQpLCBhID0gbig5KSwgcyA9IG4oNzEpLCBjID0gbig1KSwgdSA9IG4oNzMpLCBsID0gbigxMDYpLCBmID0gbigxOCksIHAgPSBuKDEwMikuZmFzdEtleSwgZCA9IG4oMzMpLCBoID0gZC5zZXQsIG0gPSBkLmdldHRlckZvcjsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBnZXRDb25zdHJ1Y3RvcjogZnVuY3Rpb24gKGUsIHQsIG4sIHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBlKGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyhlLCBsLCB0KSwgaChlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiBvKG51bGwpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdDogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0OiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6IDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZiB8fCAoZS5zaXplID0gMCksIHZvaWQgMCAhPSByICYmIGMociwgZVt1XSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGF0OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBU19FTlRSSUVTOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZCA9IG0odCksIGcgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBvLCBpID0gZChlKSwgYSA9IHYoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhLnZhbHVlID0gbiA6IChpLmxhc3QgPSBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleDogbyA9IHAodCwgITApLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmV2aW91czogciA9IGkubGFzdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVkOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkuZmlyc3QgfHwgKGkuZmlyc3QgPSBhKSwgciAmJiAoci5uZXh0ID0gYSksIGYgPyBpLnNpemUrKyA6IGUuc2l6ZSsrLCAnRicgIT09IG8gJiYgKGkuaW5kZXhbb10gPSBhKSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciA9IGQoZSksIG8gPSBwKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnRicgIT09IG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmluZGV4W29dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IHIuZmlyc3Q7IG47IG4gPSBuLm5leHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmtleSA9PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShsLnByb3RvdHlwZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gZCh0aGlzKSwgdCA9IGUuaW5kZXgsIG4gPSBlLmZpcnN0OyBuOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5yZW1vdmVkID0gITAsIG4ucHJldmlvdXMgJiYgKG4ucHJldmlvdXMgPSBuLnByZXZpb3VzLm5leHQgPSB2b2lkIDApLCBkZWxldGUgdFtuLmluZGV4XSwgbiA9IG4ubmV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZpcnN0ID0gZS5sYXN0ID0gdm9pZCAwLCBmID8gZS5zaXplID0gMCA6IHRoaXMuc2l6ZSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZCh0aGlzKSwgbiA9IHYodGhpcywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLm5leHQsIG8gPSBuLnByZXZpb3VzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgdC5pbmRleFtuLmluZGV4XSwgbi5yZW1vdmVkID0gITAsIG8gJiYgKG8ubmV4dCA9IHIpLCByICYmIChyLnByZXZpb3VzID0gbyksIHQuZmlyc3QgPT0gbiAmJiAodC5maXJzdCA9IHIpLCB0Lmxhc3QgPT0gbiAmJiAodC5sYXN0ID0gbyksIGYgPyB0LnNpemUtLSA6IHRoaXMuc2l6ZS0tOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvckVhY2g6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCwgbiA9IGQodGhpcyksIHIgPSBhKGUsIGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwLCAzKTsgdCA9IHQgPyB0Lm5leHQgOiBuLmZpcnN0OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyKHQudmFsdWUsIHQua2V5LCB0aGlzKTsgdCAmJiB0LnJlbW92ZWQ7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQucHJldmlvdXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXYodGhpcywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpKGwucHJvdG90eXBlLCBuID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdih0aGlzLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiB0LnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyh0aGlzLCAwID09PSBlID8gMCA6IGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnKHRoaXMsIGUgPSAwID09PSBlID8gMCA6IGUsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KSwgZiAmJiByKGwucHJvdG90eXBlLCAnc2l6ZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkKHRoaXMpLnNpemU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBsOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgc2V0U3Ryb25nOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQgKyAnIEl0ZXJhdG9yJywgbyA9IG0odCksIGkgPSBtKHIpOwogICAgICAgICAgICAgICAgICAgICAgICB1KGUsIHQsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoKHRoaXMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogbyhlKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBraW5kOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3Q6IHZvaWQgMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBpKHRoaXMpLCB0ID0gZS5raW5kLCBuID0gZS5sYXN0OyBuICYmIG4ucmVtb3ZlZDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG4ucHJldmlvdXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS50YXJnZXQgJiYgKGUubGFzdCA9IG4gPSBuID8gbi5uZXh0IDogZS5zdGF0ZS5maXJzdCkgPyAna2V5cycgPT0gdCA/IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbi5rZXksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiAndmFsdWVzJyA9PSB0ID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBuLnZhbHVlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ua2V5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnZhbHVlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IChlLnRhcmdldCA9IHZvaWQgMCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBuID8gJ2VudHJpZXMnIDogJ3ZhbHVlcycsICFuLCAhMCksIGwodCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigyMyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgcihlLCBvLCB0W29dLCBuKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciwgbywgaSwgYSA9IG4oNzQpLCBzID0gbigyMiksIGMgPSBuKDE0KSwgdSA9IG4oOCksIGwgPSBuKDQpLCBmID0gdSgnaXRlcmF0b3InKSwgcCA9ICExOwogICAgICAgICAgICAgICAgW10ua2V5cyAmJiAoJ25leHQnIGluIChpID0gW10ua2V5cygpKSA/IChvID0gYShhKGkpKSkgIT09IE9iamVjdC5wcm90b3R5cGUgJiYgKHIgPSBvKSA6IHAgPSAhMCksIHZvaWQgMCA9PSByICYmIChyID0ge30pLCBsIHx8IGMociwgZikgfHwgcyhyLCBmLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICB9KSwgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgIEl0ZXJhdG9yUHJvdG90eXBlOiByLAogICAgICAgICAgICAgICAgICAgIEJVR0dZX1NBRkFSSV9JVEVSQVRPUlM6IHAKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTApLCBvID0gbigxOSksIGkgPSBuKDgpLCBhID0gbigxOCksIHMgPSBpKCdzcGVjaWVzJyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcihlKSwgbiA9IG8uZjsKICAgICAgICAgICAgICAgICAgICBhICYmIHQgJiYgIXRbc10gJiYgbih0LCBzLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTgpLCBvID0gbig0OSksIGkgPSBuKDI1KSwgYSA9IG4oNDQpLmYsIHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4sIHMgPSBpKHQpLCBjID0gbyhzKSwgdSA9IGMubGVuZ3RoLCBsID0gMCwgZiA9IFtdOyB1ID4gbDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGNbbCsrXSwgciAmJiAhYS5jYWxsKHMsIG4pIHx8IGYucHVzaChlID8gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzW25dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSA6IHNbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBlbnRyaWVzOiBzKCEwKSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZXM6IHMoITEpCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDcpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gci5Qcm9taXNlOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIsIG8sIGksIGEgPSBuKDcpLCBzID0gbigxMiksIGMgPSBuKDkpLCB1ID0gbig5MiksIGwgPSBuKDU2KSwgZiA9IG4oMTEwKSwgcCA9IG4oNzUpLCBkID0gYS5sb2NhdGlvbiwgaCA9IGEuc2V0SW1tZWRpYXRlLCBtID0gYS5jbGVhckltbWVkaWF0ZSwgZyA9IGEucHJvY2VzcywgdiA9IGEuTWVzc2FnZUNoYW5uZWwsIHkgPSBhLkRpc3BhdGNoLCBiID0gMCwgRSA9IHt9LCB3ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEUuaGFzT3duUHJvcGVydHkoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gRVtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBFW2VdLCB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCB4ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgUyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHcoZS5kYXRhKTsKICAgICAgICAgICAgICAgICAgICB9LCBDID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYS5wb3N0TWVzc2FnZShlICsgJycsIGQucHJvdG9jb2wgKyAnLy8nICsgZC5ob3N0KTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgaCAmJiBtIHx8IChoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gW10sIG4gPSAxOyBhcmd1bWVudHMubGVuZ3RoID4gbjspCiAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChhcmd1bWVudHNbbisrXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVbKytiXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgKCdmdW5jdGlvbicgPT0gdHlwZW9mIGUgPyBlIDogRnVuY3Rpb24oZSkpLmFwcGx5KHZvaWQgMCwgdCk7CiAgICAgICAgICAgICAgICAgICAgfSwgcihiKSwgYjsKICAgICAgICAgICAgICAgIH0sIG0gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBFW2VdOwogICAgICAgICAgICAgICAgfSwgcCA/IHIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGcubmV4dFRpY2soeChlKSk7CiAgICAgICAgICAgICAgICB9IDogeSAmJiB5Lm5vdyA/IHIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHkubm93KHgoZSkpOwogICAgICAgICAgICAgICAgfSA6IHYgJiYgIWYgPyAoaSA9IChvID0gbmV3IHYoKSkucG9ydDIsIG8ucG9ydDEub25tZXNzYWdlID0gUywgciA9IGMoaS5wb3N0TWVzc2FnZSwgaSwgMSkpIDogYS5hZGRFdmVudExpc3RlbmVyICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIHBvc3RNZXNzYWdlICYmICFhLmltcG9ydFNjcmlwdHMgJiYgZCAmJiAnZmlsZTonICE9PSBkLnByb3RvY29sICYmICFzKEMpID8gKHIgPSBDLCBhLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBTLCAhMSkpIDogciA9ICdvbnJlYWR5c3RhdGVjaGFuZ2UnIGluIGwoJ3NjcmlwdCcpID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB1LmFwcGVuZENoaWxkKGwoJ3NjcmlwdCcpKS5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHUucmVtb3ZlQ2hpbGQodGhpcyksIHcoZSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoeChlKSwgMCk7CiAgICAgICAgICAgICAgICB9KSwgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgIHNldDogaCwKICAgICAgICAgICAgICAgICAgICBjbGVhcjogbQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig5Nik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAvKGlwaG9uZXxpcG9kfGlwYWQpLiphcHBsZXdlYmtpdC9pLnRlc3Qocik7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMyksIG8gPSBuKDEzKSwgaSA9IG4oNDIpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAocihlKSwgbyh0KSAmJiB0LmNvbnN0cnVjdG9yID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGkuZihlKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKDAsIG4ucmVzb2x2ZSkodCksIG4ucHJvbWlzZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMjAzKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHIoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignVGhlIG1ldGhvZCBkb2VzblwndCBhY2NlcHQgcmVndWxhciBleHByZXNzaW9ucycpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig4KSgnbWF0Y2gnKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAvLi87CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgJy8uLydbZV0odCk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbcl0gPSAhMSwgJy8uLydbZV0odCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDMpLCBvID0gbig2KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlLCB0ID0gcih0aGlzKSwgbiA9IG8odC5kZWxldGUpLCBpID0gITAsIGEgPSAwLCBzID0gYXJndW1lbnRzLmxlbmd0aDsgYSA8IHM7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IG4uY2FsbCh0LCBhcmd1bWVudHNbYV0pLCBpID0gaSAmJiBlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDYpLCBvID0gbig5KSwgaSA9IG4oNSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBhLCBzLCBjID0gYXJndW1lbnRzLmxlbmd0aCwgdSA9IGMgPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByKHRoaXMpLCAodCA9IHZvaWQgMCAhPT0gdSkgJiYgcih1KSwgdm9pZCAwID09IGUgPyBuZXcgdGhpcygpIDogKG4gPSBbXSwgdCA/IChhID0gMCwgcyA9IG8odSwgYyA+IDIgPyBhcmd1bWVudHNbMl0gOiB2b2lkIDAsIDIpLCBpKGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG4ucHVzaChzKGUsIGErKykpOwogICAgICAgICAgICAgICAgICAgIH0pKSA6IGkoZSwgbi5wdXNoLCB7IHRoYXQ6IG4gfSksIG5ldyB0aGlzKG4pKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGgsIHQgPSBuZXcgQXJyYXkoZSk7IGUtLTspCiAgICAgICAgICAgICAgICAgICAgICAgIHRbZV0gPSBhcmd1bWVudHNbZV07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB0aGlzKHQpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scywgbyA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHksIGkgPSBPYmplY3QucHJvdG90eXBlLnByb3BlcnR5SXNFbnVtZXJhYmxlOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGUgfHwgdm9pZCAwID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdPYmplY3QuYXNzaWduIGNhbm5vdCBiZSBjYWxsZWQgd2l0aCBudWxsIG9yIHVuZGVmaW5lZCcpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFPYmplY3QuYXNzaWduKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyBTdHJpbmcoJ2FiYycpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVs1XSA9ICdkZScsICc1JyA9PT0gT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXMoZSlbMF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSB7fSwgbiA9IDA7IG4gPCAxMDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdFsnXycgKyBTdHJpbmcuZnJvbUNoYXJDb2RlKG4pXSA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnMDEyMzQ1Njc4OScgIT09IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKHQpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignJykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYWJjZGVmZ2hpamtsbW5vcHFyc3QnLnNwbGl0KCcnKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByW2VdID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksICdhYmNkZWZnaGlqa2xtbm9wcXJzdCcgPT09IE9iamVjdC5rZXlzKE9iamVjdC5hc3NpZ24oe30sIHIpKS5qb2luKCcnKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KCkgPyBPYmplY3QuYXNzaWduIDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuLCBzLCBjID0gYShlKSwgdSA9IDE7IHUgPCBhcmd1bWVudHMubGVuZ3RoOyB1KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbCBpbiBuID0gT2JqZWN0KGFyZ3VtZW50c1t1XSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLmNhbGwobiwgbCkgJiYgKGNbbF0gPSBuW2xdKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSByKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiA9IDA7IGYgPCBzLmxlbmd0aDsgZisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuY2FsbChuLCBzW2ZdKSAmJiAoY1tzW2ZdXSA9IG5bc1tmXV0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IG4oMjY0KSgpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8gPSBlLmV4cG9ydHMgPSB7fTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdzZXRUaW1lb3V0IGhhcyBub3QgYmVlbiBkZWZpbmVkJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignY2xlYXJUaW1lb3V0IGhhcyBub3QgYmVlbiBkZWZpbmVkJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobiA9PT0gc2V0VGltZW91dCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNldFRpbWVvdXQoZSwgMCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKChuID09PSBpIHx8ICFuKSAmJiBzZXRUaW1lb3V0KQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9IHNldFRpbWVvdXQsIHNldFRpbWVvdXQoZSwgMCk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oZSwgMCk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2FsbChudWxsLCBlLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2FsbCh0aGlzLCBlLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBzZXRUaW1lb3V0ID8gc2V0VGltZW91dCA6IGk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBuID0gaTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgciA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBjbGVhclRpbWVvdXQgPyBjbGVhclRpbWVvdXQgOiBhOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgciA9IGE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdmFyIGMsIHUgPSBbXSwgbCA9ICExLCBmID0gLTE7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKCkgewogICAgICAgICAgICAgICAgICAgIGwgJiYgYyAmJiAobCA9ICExLCBjLmxlbmd0aCA/IHUgPSBjLmNvbmNhdCh1KSA6IGYgPSAtMSwgdS5sZW5ndGggJiYgZCgpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gcyhwKTsKICAgICAgICAgICAgICAgICAgICAgICAgbCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gdS5sZW5ndGg7IHQ7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSB1LCB1ID0gW107ICsrZiA8IHQ7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgJiYgY1tmXS5ydW4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSAtMSwgdCA9IHUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBudWxsLCBsID0gITEsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociA9PT0gY2xlYXJUaW1lb3V0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjbGVhclRpbWVvdXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHIgPT09IGEgfHwgIXIpICYmIGNsZWFyVGltZW91dCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciA9IGNsZWFyVGltZW91dCwgY2xlYXJUaW1lb3V0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmNhbGwobnVsbCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5jYWxsKHRoaXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfShlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBoKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmZ1biA9IGUsIHRoaXMuYXJyYXkgPSB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbSgpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG8ubmV4dFRpY2sgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbmV3IEFycmF5KGFyZ3VtZW50cy5sZW5ndGggLSAxKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA+IDEpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAxOyBuIDwgYXJndW1lbnRzLmxlbmd0aDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtuIC0gMV0gPSBhcmd1bWVudHNbbl07CiAgICAgICAgICAgICAgICAgICAgdS5wdXNoKG5ldyBoKGUsIHQpKSwgMSAhPT0gdS5sZW5ndGggfHwgbCB8fCBzKGQpOwogICAgICAgICAgICAgICAgfSwgaC5wcm90b3R5cGUucnVuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZnVuLmFwcGx5KG51bGwsIHRoaXMuYXJyYXkpOwogICAgICAgICAgICAgICAgfSwgby50aXRsZSA9ICdicm93c2VyJywgby5icm93c2VyID0gITAsIG8uZW52ID0ge30sIG8uYXJndiA9IFtdLCBvLnZlcnNpb24gPSAnJywgby52ZXJzaW9ucyA9IHt9LCBvLm9uID0gbSwgby5hZGRMaXN0ZW5lciA9IG0sIG8ub25jZSA9IG0sIG8ub2ZmID0gbSwgby5yZW1vdmVMaXN0ZW5lciA9IG0sIG8ucmVtb3ZlQWxsTGlzdGVuZXJzID0gbSwgby5lbWl0ID0gbSwgby5wcmVwZW5kTGlzdGVuZXIgPSBtLCBvLnByZXBlbmRPbmNlTGlzdGVuZXIgPSBtLCBvLmxpc3RlbmVycyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtdOwogICAgICAgICAgICAgICAgfSwgby5iaW5kaW5nID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ3Byb2Nlc3MuYmluZGluZyBpcyBub3Qgc3VwcG9ydGVkJyk7CiAgICAgICAgICAgICAgICB9LCBvLmN3ZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJy8nOwogICAgICAgICAgICAgICAgfSwgby5jaGRpciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdwcm9jZXNzLmNoZGlyIGlzIG5vdCBzdXBwb3J0ZWQnKTsKICAgICAgICAgICAgICAgIH0sIG8udW1hc2sgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gbmV3IEFycmF5KGFyZ3VtZW50cy5sZW5ndGgpLCByID0gMDsgciA8IG4ubGVuZ3RoOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3JdID0gYXJndW1lbnRzW3JdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNik7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW5jb2RlVVJJQ29tcG9uZW50KGUpLnJlcGxhY2UoLyU0MC9naSwgJ0AnKS5yZXBsYWNlKC8lM0EvZ2ksICc6JykucmVwbGFjZSgvJTI0L2csICckJykucmVwbGFjZSgvJTJDL2dpLCAnLCcpLnJlcGxhY2UoLyUyMC9nLCAnKycpLnJlcGxhY2UoLyU1Qi9naSwgJ1snKS5yZXBsYWNlKC8lNUQvZ2ksICddJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIGlmICghdCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBuKHQpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHIuaXNVUkxTZWFyY2hQYXJhbXModCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSB0LnRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIHIuZm9yRWFjaCh0LCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gZSAmJiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGUgJiYgKHIuaXNBcnJheShlKSA/IHQgKz0gJ1tdJyA6IGUgPSBbZV0sIHIuZm9yRWFjaChlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaXNEYXRlKGUpID8gZSA9IGUudG9JU09TdHJpbmcoKSA6IHIuaXNPYmplY3QoZSkgJiYgKGUgPSBKU09OLnN0cmluZ2lmeShlKSksIGEucHVzaChvKHQpICsgJz0nICsgbyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpID0gYS5qb2luKCcmJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gZS5pbmRleE9mKCcjJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIC0xICE9PSBzICYmIChlID0gZS5zbGljZSgwLCBzKSksIGUgKz0gKC0xID09PSBlLmluZGV4T2YoJz8nKSA/ICc/JyA6ICcmJykgKyBpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFlIHx8ICFlLl9fQ0FOQ0VMX18pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIG8gPSBuKDI3MyksIGkgPSB7ICdDb250ZW50LVR5cGUnOiAnYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkJyB9OwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAhci5pc1VuZGVmaW5lZChlKSAmJiByLmlzVW5kZWZpbmVkKGVbJ0NvbnRlbnQtVHlwZSddKSAmJiAoZVsnQ29udGVudC1UeXBlJ10gPSB0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGFkYXB0ZXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfMTNlYzU0MjljMDljMTAyYyA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8xM2VjNTQyOWMwOWMxMDJjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja181YTg0ZTE5YjIxMjJiYTk2LlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBYTUxIdHRwUmVxdWVzdCB8fCAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIHQgJiYgJ1tvYmplY3QgcHJvY2Vzc10nID09PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwodCkpICYmIChlID0gbigxMjQpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzEzZWM1NDI5YzA5YzEwMmMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfMTNlYzU0MjljMDljMTAyYykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KCksCiAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybVJlcXVlc3Q6IFtmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKHQsICdBY2NlcHQnKSwgbyh0LCAnQ29udGVudC1UeXBlJyksIHIuaXNGb3JtRGF0YShlKSB8fCByLmlzQXJyYXlCdWZmZXIoZSkgfHwgci5pc0J1ZmZlcihlKSB8fCByLmlzU3RyZWFtKGUpIHx8IHIuaXNGaWxlKGUpIHx8IHIuaXNCbG9iKGUpID8gZSA6IHIuaXNBcnJheUJ1ZmZlclZpZXcoZSkgPyBlLmJ1ZmZlciA6IHIuaXNVUkxTZWFyY2hQYXJhbXMoZSkgPyAoYSh0LCAnYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkO2NoYXJzZXQ9dXRmLTgnKSwgZS50b1N0cmluZygpKSA6IHIuaXNPYmplY3QoZSkgPyAoYSh0LCAnYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PXV0Zi04JyksIEpTT04uc3RyaW5naWZ5KGUpKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtUmVzcG9uc2U6IFtmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gSlNPTi5wYXJzZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgeHNyZkNvb2tpZU5hbWU6ICdYU1JGLVRPS0VOJywKICAgICAgICAgICAgICAgICAgICAgICAgeHNyZkhlYWRlck5hbWU6ICdYLVhTUkYtVE9LRU4nLAogICAgICAgICAgICAgICAgICAgICAgICBtYXhDb250ZW50TGVuZ3RoOiAtMSwKICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRhdGVTdGF0dXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA+PSAyMDAgJiYgZSA8IDMwMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogeyBjb21tb246IHsgQWNjZXB0OiAnYXBwbGljYXRpb24vanNvbiwgdGV4dC9wbGFpbiwgKi8qJyB9IH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHIuZm9yRWFjaChbCiAgICAgICAgICAgICAgICAgICAgICAgICdkZWxldGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnZ2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ2hlYWQnCiAgICAgICAgICAgICAgICAgICAgXSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcy5oZWFkZXJzW2VdID0ge307CiAgICAgICAgICAgICAgICAgICAgfSksIHIuZm9yRWFjaChbCiAgICAgICAgICAgICAgICAgICAgICAgICdwb3N0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ3B1dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdwYXRjaCcKICAgICAgICAgICAgICAgICAgICBdLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBzLmhlYWRlcnNbZV0gPSByLm1lcmdlKGkpOwogICAgICAgICAgICAgICAgICAgIH0pLCBlLmV4cG9ydHMgPSBzOwogICAgICAgICAgICAgICAgfS5jYWxsKHRoaXMsIG4oMTE5KSkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgbyA9IG4oMjc0KSwgaSA9IG4oMTIxKSwgYSA9IG4oMjc2KSwgcyA9IG4oMjc5KSwgYyA9IG4oMjgwKSwgdSA9IG4oMTI1KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKGZ1bmN0aW9uICh0LCBsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfYjgyMTE2MzEzM2E2YWJlNyA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpLCAkX19fb2xkX2ZhYWJjYzEyMTg0ZTMxZmYgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2I4MjExNjMxMzNhNmFiZTcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfNWE4NGUxOWIyMTIyYmE5Ni5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfZmFhYmNjMTIxODRlMzFmZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja181YTg0ZTE5YjIxMjJiYTk2LlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gZS5kYXRhLCBwID0gZS5oZWFkZXJzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaXNGb3JtRGF0YShmKSAmJiBkZWxldGUgcFsnQ29udGVudC1UeXBlJ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5hdXRoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZS5hdXRoLnVzZXJuYW1lIHx8ICcnLCBtID0gZS5hdXRoLnBhc3N3b3JkIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLkF1dGhvcml6YXRpb24gPSAnQmFzaWMgJyArIGJ0b2EoaCArICc6JyArIG0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGEoZS5iYXNlVVJMLCBlLnVybCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQub3BlbihlLm1ldGhvZC50b1VwcGVyQ2FzZSgpLCBpKGcsIGUucGFyYW1zLCBlLnBhcmFtc1NlcmlhbGl6ZXIpLCAhMCksIGQudGltZW91dCA9IGUudGltZW91dCwgZC5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiA0ID09PSBkLnJlYWR5U3RhdGUgJiYgKDAgIT09IGQuc3RhdHVzIHx8IGQucmVzcG9uc2VVUkwgJiYgMCA9PT0gZC5yZXNwb25zZVVSTC5pbmRleE9mKCdmaWxlOicpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJ2dldEFsbFJlc3BvbnNlSGVhZGVycycgaW4gZCA/IHMoZC5nZXRBbGxSZXNwb25zZUhlYWRlcnMoKSkgOiBudWxsLCByID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogZS5yZXNwb25zZVR5cGUgJiYgJ3RleHQnICE9PSBlLnJlc3BvbnNlVHlwZSA/IGQucmVzcG9uc2UgOiBkLnJlc3BvbnNlVGV4dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogZC5zdGF0dXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXNUZXh0OiBkLnN0YXR1c1RleHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8odCwgbCwgciksIGQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkLm9uYWJvcnQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkICYmIChsKHUoJ1JlcXVlc3QgYWJvcnRlZCcsIGUsICdFQ09OTkFCT1JURUQnLCBkKSksIGQgPSBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZC5vbmVycm9yID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCh1KCdOZXR3b3JrIEVycm9yJywgZSwgbnVsbCwgZCkpLCBkID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZC5vbnRpbWVvdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICd0aW1lb3V0IG9mICcgKyBlLnRpbWVvdXQgKyAnbXMgZXhjZWVkZWQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS50aW1lb3V0RXJyb3JNZXNzYWdlICYmICh0ID0gZS50aW1lb3V0RXJyb3JNZXNzYWdlKSwgbCh1KHQsIGUsICdFQ09OTkFCT1JURUQnLCBkKSksIGQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByLmlzU3RhbmRhcmRCcm93c2VyRW52KCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSBuKDI4MSksIHkgPSAoZS53aXRoQ3JlZGVudGlhbHMgfHwgYyhnKSkgJiYgZS54c3JmQ29va2llTmFtZSA/IHYucmVhZChlLnhzcmZDb29raWVOYW1lKSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeSAmJiAocFtlLnhzcmZIZWFkZXJOYW1lXSA9IHkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3NldFJlcXVlc3RIZWFkZXInIGluIGQgJiYgci5mb3JFYWNoKHAsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyA9PT0gdHlwZW9mIGYgJiYgJ2NvbnRlbnQtdHlwZScgPT09IHQudG9Mb3dlckNhc2UoKSA/IGRlbGV0ZSBwW3RdIDogZC5zZXRSZXF1ZXN0SGVhZGVyKHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgci5pc1VuZGVmaW5lZChlLndpdGhDcmVkZW50aWFscykgfHwgKGQud2l0aENyZWRlbnRpYWxzID0gISFlLndpdGhDcmVkZW50aWFscyksIGUucmVzcG9uc2VUeXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5yZXNwb25zZVR5cGUgPSBlLnJlc3BvbnNlVHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdqc29uJyAhPT0gZS5yZXNwb25zZVR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT09IHR5cGVvZiBlLm9uRG93bmxvYWRQcm9ncmVzcyAmJiBkLmFkZEV2ZW50TGlzdGVuZXIoJ3Byb2dyZXNzJywgZS5vbkRvd25sb2FkUHJvZ3Jlc3MpLCAnZnVuY3Rpb24nID09PSB0eXBlb2YgZS5vblVwbG9hZFByb2dyZXNzICYmIGQudXBsb2FkICYmIGQudXBsb2FkLmFkZEV2ZW50TGlzdGVuZXIoJ3Byb2dyZXNzJywgZS5vblVwbG9hZFByb2dyZXNzKSwgZS5jYW5jZWxUb2tlbiAmJiBlLmNhbmNlbFRva2VuLnByb21pc2UudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkICYmIChkLmFib3J0KCksIGwoZSksIGQgPSBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdm9pZCAwID09PSBmICYmIChmID0gbnVsbCksIGQuc2VuZChmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2I4MjExNjMxMzNhNmFiZTcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX29sZF9iODIxMTYzMTMzYTZhYmU3KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9mYWFiY2MxMjE4NGUzMWZmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfZmFhYmNjMTIxODRlMzFmZikpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI3NSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbiwgbywgaSkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IEVycm9yKGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByKGEsIHQsIG4sIG8sIGkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHQgPSB0IHx8IHt9OwogICAgICAgICAgICAgICAgICAgIHZhciBuID0ge30sIG8gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXJsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtZXRob2QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BhcmFtcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGF0YScKICAgICAgICAgICAgICAgICAgICAgICAgXSwgaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdoZWFkZXJzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhdXRoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcm94eScKICAgICAgICAgICAgICAgICAgICAgICAgXSwgYSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdiYXNlVVJMJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1cmwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RyYW5zZm9ybVJlcXVlc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RyYW5zZm9ybVJlc3BvbnNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwYXJhbXNTZXJpYWxpemVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0aW1lb3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICd3aXRoQ3JlZGVudGlhbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FkYXB0ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Jlc3BvbnNlVHlwZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAneHNyZkNvb2tpZU5hbWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3hzcmZIZWFkZXJOYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvblVwbG9hZFByb2dyZXNzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdvbkRvd25sb2FkUHJvZ3Jlc3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ21heENvbnRlbnRMZW5ndGgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZhbGlkYXRlU3RhdHVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtYXhSZWRpcmVjdHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2h0dHBBZ2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaHR0cHNBZ2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2FuY2VsVG9rZW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NvY2tldFBhdGgnCiAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgci5mb3JFYWNoKG8sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICd1bmRlZmluZWQnICE9PSB0eXBlb2YgdFtlXSAmJiAobltlXSA9IHRbZV0pOwogICAgICAgICAgICAgICAgICAgIH0pLCByLmZvckVhY2goaSwgZnVuY3Rpb24gKG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgci5pc09iamVjdCh0W29dKSA/IG5bb10gPSByLmRlZXBNZXJnZShlW29dLCB0W29dKSA6ICd1bmRlZmluZWQnICE9PSB0eXBlb2YgdFtvXSA/IG5bb10gPSB0W29dIDogci5pc09iamVjdChlW29dKSA/IG5bb10gPSByLmRlZXBNZXJnZShlW29dKSA6ICd1bmRlZmluZWQnICE9PSB0eXBlb2YgZVtvXSAmJiAobltvXSA9IGVbb10pOwogICAgICAgICAgICAgICAgICAgIH0pLCByLmZvckVhY2goYSwgZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiB0W3JdID8gbltyXSA9IHRbcl0gOiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGVbcl0gJiYgKG5bcl0gPSBlW3JdKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG8uY29uY2F0KGkpLmNvbmNhdChhKSwgYyA9IE9iamVjdC5rZXlzKHQpLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xID09PSBzLmluZGV4T2YoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByLmZvckVhY2goYywgZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiB0W3JdID8gbltyXSA9IHRbcl0gOiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIGVbcl0gJiYgKG5bcl0gPSBlW3JdKTsKICAgICAgICAgICAgICAgICAgICB9KSwgbjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLm1lc3NhZ2UgPSBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgci5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdDYW5jZWwnICsgKHRoaXMubWVzc2FnZSA/ICc6ICcgKyB0aGlzLm1lc3NhZ2UgOiAnJyk7CiAgICAgICAgICAgICAgICB9LCByLnByb3RvdHlwZS5fX0NBTkNFTF9fID0gITAsIGUuZXhwb3J0cyA9IHI7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNSksIG8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZW5jb2RlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghL15bMC0xXSskLy50ZXN0KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyByLkVuY29kaW5nRXJyb3IoJ0ludmFsaWQgYml0RmllbGQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5sZW5ndGggJSB0aGlzLkxDTTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgKz0gdCA/ICcwJy5yZXBlYXQodGhpcy5MQ00gLSB0KSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9ICcnLCBvID0gMDsgbyA8IGUubGVuZ3RoOyBvICs9IHRoaXMuQkFTSVMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiArPSB0aGlzLkRJQ1RbcGFyc2VJbnQoZS5zdWJzdHIobywgdGhpcy5CQVNJUyksIDIpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRlY29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIS9eW0EtWmEtejAtOVwtX10rJC8udGVzdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgci5EZWNvZGluZ0Vycm9yKCdJbnZhbGlkbHkgZW5jb2RlZCBCYXNlNjRVUkwgc3RyaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gJycsIG4gPSAwOyBuIDwgZS5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdGhpcy5SRVZFUlNFX0RJQ1QuZ2V0KGVbbl0pLnRvU3RyaW5nKDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gJzAnLnJlcGVhdCh0aGlzLkJBU0lTIC0gby5sZW5ndGgpICsgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLkRJQ1QgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODktXycsIGUuUkVWRVJTRV9ESUNUID0gbmV3IE1hcChbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0EnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0onLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0snLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdMJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ04nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdPJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1EnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnUycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdVJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdYJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnWScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1onLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI4CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyOQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2YnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2knLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdqJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzYKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2wnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM3CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ28nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDgKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAneicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICc0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1NgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU4CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICc3JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1OQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnOCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICctJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2MgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnXycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGUuQkFTSVMgPSA2LCBlLkxDTSA9IDI0LCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuQmFzZTY0VXJsID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5yb290ID0gbnVsbCwgdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIHQucHJvdG90eXBlLmlzRW1wdHkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhdGhpcy5yb290OwogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlnaHQ6IG51bGwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmlzRW1wdHkoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucm9vdCA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCA9IHRoaXMucm9vdDs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIDwgdC52YWx1ZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gdC5sZWZ0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxlZnQgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQubGVmdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlID4gdC52YWx1ZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IHQucmlnaHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucmlnaHQgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQucmlnaHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IFtdLCB0ID0gdGhpcy5yb290OyB0OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmxlZnQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gdC5sZWZ0OyBuLnJpZ2h0ICYmIG4ucmlnaHQgIT0gdDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBuLnJpZ2h0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucmlnaHQgPT0gdCA/IChuLnJpZ2h0ID0gbnVsbCwgZS5wdXNoKHQudmFsdWUpLCB0ID0gdC5yaWdodCkgOiAobi5yaWdodCA9IHQsIHQgPSB0LmxlZnQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wdXNoKHQudmFsdWUpLCB0ID0gdC5yaWdodDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuY29udGFpbnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gITEsIG4gPSB0aGlzLnJvb3Q7IG47KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi52YWx1ZSA9PT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPiBuLnZhbHVlID8gbiA9IG4ucmlnaHQgOiBlIDwgbi52YWx1ZSAmJiAobiA9IG4ubGVmdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUubWluID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodm9pZCAwID09PSBlICYmIChlID0gdGhpcy5yb290KTsgZTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmxlZnQgPyBlID0gZS5sZWZ0IDogKHQgPSBlLnZhbHVlLCBlID0gbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLm1heCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZvaWQgMCA9PT0gZSAmJiAoZSA9IHRoaXMucm9vdCk7IGU7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5yaWdodCA/IGUgPSBlLnJpZ2h0IDogKHQgPSBlLnZhbHVlLCBlID0gbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnJlbW92ZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gdCAmJiAodCA9IHRoaXMucm9vdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBudWxsLCByID0gJ2xlZnQnOyB0OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIDwgdC52YWx1ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gdCwgdCA9IHQubGVmdCwgciA9ICdsZWZ0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGUgPiB0LnZhbHVlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB0LCB0ID0gdC5yaWdodCwgciA9ICdyaWdodCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5sZWZ0IHx8IHQucmlnaHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmxlZnQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5yaWdodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdGhpcy5taW4odC5yaWdodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yZW1vdmUobywgdC5yaWdodCksIHQudmFsdWUgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA/IG5bcl0gPSB0LmxlZnQgOiB0aGlzLnJvb3QgPSB0LmxlZnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPyBuW3JdID0gdC5yaWdodCA6IHRoaXMucm9vdCA9IHQucmlnaHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID8gbltyXSA9IG51bGwgOiB0aGlzLnJvb3QgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIHQ7CiAgICAgICAgICAgICAgICB9KG4oMjkpLkNsb25lYWJsZSk7CiAgICAgICAgICAgICAgICB0LkJpbmFyeVNlYXJjaFRyZWUgPSBvOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5jbXBJZCA9ICdjbXBJZCcsIGUuY21wVmVyc2lvbiA9ICdjbXBWZXJzaW9uJywgZS5jb25zZW50TGFuZ3VhZ2UgPSAnY29uc2VudExhbmd1YWdlJywgZS5jb25zZW50U2NyZWVuID0gJ2NvbnNlbnRTY3JlZW4nLCBlLmNyZWF0ZWQgPSAnY3JlYXRlZCcsIGUuc3VwcG9ydE9PQiA9ICdzdXBwb3J0T09CJywgZS5pc1NlcnZpY2VTcGVjaWZpYyA9ICdpc1NlcnZpY2VTcGVjaWZpYycsIGUubGFzdFVwZGF0ZWQgPSAnbGFzdFVwZGF0ZWQnLCBlLm51bUN1c3RvbVB1cnBvc2VzID0gJ251bUN1c3RvbVB1cnBvc2VzJywgZS5wb2xpY3lWZXJzaW9uID0gJ3BvbGljeVZlcnNpb24nLCBlLnB1Ymxpc2hlckNvdW50cnlDb2RlID0gJ3B1Ymxpc2hlckNvdW50cnlDb2RlJywgZS5wdWJsaXNoZXJDdXN0b21Db25zZW50cyA9ICdwdWJsaXNoZXJDdXN0b21Db25zZW50cycsIGUucHVibGlzaGVyQ3VzdG9tTGVnaXRpbWF0ZUludGVyZXN0cyA9ICdwdWJsaXNoZXJDdXN0b21MZWdpdGltYXRlSW50ZXJlc3RzJywgZS5wdWJsaXNoZXJMZWdpdGltYXRlSW50ZXJlc3RzID0gJ3B1Ymxpc2hlckxlZ2l0aW1hdGVJbnRlcmVzdHMnLCBlLnB1Ymxpc2hlckNvbnNlbnRzID0gJ3B1Ymxpc2hlckNvbnNlbnRzJywgZS5wdWJsaXNoZXJSZXN0cmljdGlvbnMgPSAncHVibGlzaGVyUmVzdHJpY3Rpb25zJywgZS5wdXJwb3NlQ29uc2VudHMgPSAncHVycG9zZUNvbnNlbnRzJywgZS5wdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cyA9ICdwdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cycsIGUucHVycG9zZU9uZVRyZWF0bWVudCA9ICdwdXJwb3NlT25lVHJlYXRtZW50JywgZS5zcGVjaWFsRmVhdHVyZU9wdGlucyA9ICdzcGVjaWFsRmVhdHVyZU9wdGlucycsIGUudXNlTm9uU3RhbmRhcmRTdGFja3MgPSAndXNlTm9uU3RhbmRhcmRTdGFja3MnLCBlLnZlbmRvckNvbnNlbnRzID0gJ3ZlbmRvckNvbnNlbnRzJywgZS52ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzID0gJ3ZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMnLCBlLnZlbmRvckxpc3RWZXJzaW9uID0gJ3ZlbmRvckxpc3RWZXJzaW9uJywgZS52ZW5kb3JzQWxsb3dlZCA9ICd2ZW5kb3JzQWxsb3dlZCcsIGUudmVuZG9yc0Rpc2Nsb3NlZCA9ICd2ZW5kb3JzRGlzY2xvc2VkJywgZS52ZXJzaW9uID0gJ3ZlcnNpb24nLCBlOwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5GaWVsZHMgPSByOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzICYmIHRoaXMuX19leHRlbmRzIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCB7IF9fcHJvdG9fXzogW10gfSBpbnN0YW5jZW9mIEFycmF5ICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9fcHJvdG9fXyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pICYmIChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnN0cnVjdG9yID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBvID0gbigyOSksIGkgPSBuKDE1KSwgYSA9IG4oNzkpLCBzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuY2FsbCh0aGlzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gdCAmJiAoci5wdXJwb3NlSWQgPSB0KSwgdm9pZCAwICE9PSBuICYmIChyLnJlc3RyaWN0aW9uVHlwZSA9IG4pLCByOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0LnVuSGFzaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuc3BsaXQodGhpcy5oYXNoU2VwYXJhdG9yKSwgciA9IG5ldyB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMiAhPT0gbi5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuVENNb2RlbEVycm9yKCdoYXNoJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5wdXJwb3NlSWQgPSBwYXJzZUludChuWzBdLCAxMCksIHIucmVzdHJpY3Rpb25UeXBlID0gcGFyc2VJbnQoblsxXSwgMTApLCByOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdoYXNoJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLmlzVmFsaWQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdjYW5ub3QgaGFzaCBpbnZhbGlkIFB1cnBvc2VSZXN0cmljdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJyArIHRoaXMucHVycG9zZUlkICsgdC5oYXNoU2VwYXJhdG9yICsgdGhpcy5yZXN0cmljdGlvblR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdwdXJwb3NlSWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wdXJwb3NlSWRfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnB1cnBvc2VJZF8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5wcm90b3R5cGUuaXNWYWxpZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIuaXNJbnRlZ2VyKHRoaXMucHVycG9zZUlkKSAmJiB0aGlzLnB1cnBvc2VJZCA+IDAgJiYgKHRoaXMucmVzdHJpY3Rpb25UeXBlID09PSBhLlJlc3RyaWN0aW9uVHlwZS5OT1RfQUxMT1dFRCB8fCB0aGlzLnJlc3RyaWN0aW9uVHlwZSA9PT0gYS5SZXN0cmljdGlvblR5cGUuUkVRVUlSRV9DT05TRU5UIHx8IHRoaXMucmVzdHJpY3Rpb25UeXBlID09PSBhLlJlc3RyaWN0aW9uVHlwZS5SRVFVSVJFX0xJKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuaXNTYW1lQXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucHVycG9zZUlkID09PSBlLnB1cnBvc2VJZCAmJiB0aGlzLnJlc3RyaWN0aW9uVHlwZSA9PT0gZS5yZXN0cmljdGlvblR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuaGFzaFNlcGFyYXRvciA9ICctJywgdDsKICAgICAgICAgICAgICAgICAgICB9KG8uQ2xvbmVhYmxlKTsKICAgICAgICAgICAgICAgIHQuUHVycG9zZVJlc3RyaWN0aW9uID0gczsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSksIChyID0gdC5TZWdtZW50IHx8ICh0LlNlZ21lbnQgPSB7fSkpLkNPUkUgPSAnY29yZScsIHIuVkVORE9SU19ESVNDTE9TRUQgPSAndmVuZG9yc0Rpc2Nsb3NlZCcsIHIuVkVORE9SU19BTExPV0VEID0gJ3ZlbmRvcnNBbGxvd2VkJywgci5QVUJMSVNIRVJfVEMgPSAncHVibGlzaGVyVEMnOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pIHx8ICh0W25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgcihuKDQzKSksIHIobigxMzgpKSwgcihuKDI5MykpLCByKG4oODApKSwgcihuKDMwKSksIHIobigxMzkpKSwgcihuKDE0MCkpLCByKG4oMTQyKSksIHIobigxNDEpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDMwKSwgbyA9IG4oMTUpLCBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5JbnRFbmNvZGVyLmVuY29kZShNYXRoLnJvdW5kKGUuZ2V0VGltZSgpIC8gMTAwKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZGVjb2RlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICE9PSBlLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgby5EZWNvZGluZ0Vycm9yKCdpbnZhbGlkIGJpdCBsZW5ndGgnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IERhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnNldFRpbWUoMTAwICogci5JbnRFbmNvZGVyLmRlY29kZShlLCB0KSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5EYXRlRW5jb2RlciA9IGk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigzMCksIG8gPSBuKDE1KSwgaSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5lbmNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAoZSA9IGUudG9VcHBlckNhc2UoKSkuY2hhckNvZGVBdCgwKSAtIDY1LCBpID0gZS5jaGFyQ29kZUF0KDEpIC0gNjU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA8IDAgfHwgbiA+IDI1IHx8IGkgPCAwIHx8IGkgPiAyNSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgby5FbmNvZGluZ0Vycm9yKCdpbnZhbGlkIGxhbmd1YWdlIGNvZGU6ICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICUgMiA9PSAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBvLkVuY29kaW5nRXJyb3IoJ251bUJpdHMgbXVzdCBiZSBldmVuLCAnICsgdCArICcgaXMgbm90IHZhbGlkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAvPSAyLCByLkludEVuY29kZXIuZW5jb2RlKG4sIHQpICsgci5JbnRFbmNvZGVyLmVuY29kZShpLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5kZWNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgIT09IGUubGVuZ3RoIHx8IGUubGVuZ3RoICUgMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgby5EZWNvZGluZ0Vycm9yKCdpbnZhbGlkIGJpdCBsZW5ndGggZm9yIGxhbmd1YWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUubGVuZ3RoIC8gMiwgaSA9IHIuSW50RW5jb2Rlci5kZWNvZGUoZS5zbGljZSgwLCBuKSwgbikgKyA2NSwgYSA9IHIuSW50RW5jb2Rlci5kZWNvZGUoZS5zbGljZShuKSwgbikgKyA2NTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlKGkpICsgU3RyaW5nLmZyb21DaGFyQ29kZShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkxhbmdFbmNvZGVyID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDc4KSwgbyA9IG4oNDMpLCBpID0gbigxNSksIGEgPSBuKDMwKSwgcyA9IG4oMTcpLCBjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEuSW50RW5jb2Rlci5lbmNvZGUoZS5udW1SZXN0cmljdGlvbnMsIHIuQml0TGVuZ3RoLm51bVJlc3RyaWN0aW9ucyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5pc0VtcHR5KCkgfHwgZS5nZXRSZXN0cmljdGlvbnMoKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSBhLkludEVuY29kZXIuZW5jb2RlKG4ucHVycG9zZUlkLCByLkJpdExlbmd0aC5wdXJwb3NlSWQpLCB0ICs9IGEuSW50RW5jb2Rlci5lbmNvZGUobi5yZXN0cmljdGlvblR5cGUsIHIuQml0TGVuZ3RoLnJlc3RyaWN0aW9uVHlwZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IGUuZ2V0VmVuZG9ycyhuKSwgcyA9IGkubGVuZ3RoLCBjID0gMCwgdSA9IDAsIGwgPSAnJywgZiA9IDA7IGYgPCBzOyBmKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBpW2ZdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gdSAmJiAoYysrLCB1ID0gcCksIGYgPT09IHMgLSAxIHx8IGlbZiArIDFdID4gcCArIDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gIShwID09PSB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgKz0gby5Cb29sZWFuRW5jb2Rlci5lbmNvZGUoZCksIGwgKz0gYS5JbnRFbmNvZGVyLmVuY29kZSh1LCByLkJpdExlbmd0aC52ZW5kb3JJZCksIGQgJiYgKGwgKz0gYS5JbnRFbmNvZGVyLmVuY29kZShwLCByLkJpdExlbmd0aC52ZW5kb3JJZCkpLCB1ID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9IGEuSW50RW5jb2Rlci5lbmNvZGUoYywgci5CaXRMZW5ndGgubnVtRW50cmllcyksIHQgKz0gbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmRlY29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IDAsIG4gPSBuZXcgcy5QdXJwb3NlUmVzdHJpY3Rpb25WZWN0b3IoKSwgYyA9IGEuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgubnVtUmVzdHJpY3Rpb25zKSwgci5CaXRMZW5ndGgubnVtUmVzdHJpY3Rpb25zKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gci5CaXRMZW5ndGgubnVtUmVzdHJpY3Rpb25zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdSA9IDA7IHUgPCBjOyB1KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGEuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgucHVycG9zZUlkKSwgci5CaXRMZW5ndGgucHVycG9zZUlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9IHIuQml0TGVuZ3RoLnB1cnBvc2VJZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGEuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgucmVzdHJpY3Rpb25UeXBlKSwgci5CaXRMZW5ndGgucmVzdHJpY3Rpb25UeXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9IHIuQml0TGVuZ3RoLnJlc3RyaWN0aW9uVHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IG5ldyBzLlB1cnBvc2VSZXN0cmljdGlvbihsLCBmKSwgZCA9IGEuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgubnVtRW50cmllcyksIHIuQml0TGVuZ3RoLm51bUVudHJpZXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gci5CaXRMZW5ndGgubnVtRW50cmllczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBoID0gMDsgaCA8IGQ7IGgrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IG8uQm9vbGVhbkVuY29kZXIuZGVjb2RlKGUuc3Vic3RyKHQsIHIuQml0TGVuZ3RoLmFueUJvb2xlYW4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSByLkJpdExlbmd0aC5hbnlCb29sZWFuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGEuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgudmVuZG9ySWQpLCByLkJpdExlbmd0aC52ZW5kb3JJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ICs9IHIuQml0TGVuZ3RoLnZlbmRvcklkLCBtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdiA9IGEuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIodCwgci5CaXRMZW5ndGgudmVuZG9ySWQpLCByLkJpdExlbmd0aC52ZW5kb3JJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCArPSByLkJpdExlbmd0aC52ZW5kb3JJZCwgdiA8IGcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuRGVjb2RpbmdFcnJvcignSW52YWxpZCBSYW5nZUVudHJ5OiBlbmRWZW5kb3JJZCAnICsgdiArICcgaXMgbGVzcyB0aGFuICcgKyBnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHkgPSBnOyB5IDw9IHY7IHkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmFkZCh5LCBwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmFkZChnLCBwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5iaXRMZW5ndGggPSB0LCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuUHVycG9zZVJlc3RyaWN0aW9uVmVjdG9yRW5jb2RlciA9IGM7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNyksIG8gPSBuKDc3KSwgaSA9IG4oMzApLCBhID0gbig0MyksIHMgPSBuKDgwKSwgYyA9IG4oMTQyKSwgdSA9IG4oMTUpLCBsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IFtdLCByID0gW10sIHMgPSBpLkludEVuY29kZXIuZW5jb2RlKGUubWF4SWQsIG8uQml0TGVuZ3RoLm1heElkKSwgdSA9ICcnLCBsID0gby5CaXRMZW5ndGgubWF4SWQgKyBvLkJpdExlbmd0aC5lbmNvZGluZ1R5cGUsIGYgPSBsICsgZS5tYXhJZCwgcCA9IDIgKiBvLkJpdExlbmd0aC52ZW5kb3JJZCArIG8uQml0TGVuZ3RoLnNpbmdsZU9yUmFuZ2UgKyBvLkJpdExlbmd0aC5udW1FbnRyaWVzLCBkID0gbCArIG8uQml0TGVuZ3RoLm51bUVudHJpZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5mb3JFYWNoKGZ1bmN0aW9uIChpLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSArPSBhLkJvb2xlYW5FbmNvZGVyLmVuY29kZShpKSwgKHQgPSBlLm1heElkID4gcCAmJiBkIDwgZikgJiYgaSAmJiAoZS5oYXMocyArIDEpID8gMCA9PT0gci5sZW5ndGggJiYgKHIucHVzaChzKSwgZCArPSBvLkJpdExlbmd0aC5zaW5nbGVPclJhbmdlLCBkICs9IG8uQml0TGVuZ3RoLnZlbmRvcklkKSA6IChyLnB1c2gocyksIGQgKz0gby5CaXRMZW5ndGgudmVuZG9ySWQsIG4ucHVzaChyKSwgciA9IFtdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdCA/IChzICs9IGMuVmVjdG9yRW5jb2RpbmdUeXBlLlJBTkdFICsgJycsIHMgKz0gdGhpcy5idWlsZFJhbmdlRW5jb2RpbmcobikpIDogKHMgKz0gYy5WZWN0b3JFbmNvZGluZ1R5cGUuRklFTEQgKyAnJywgcyArPSB1KSwgczsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5kZWNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIGwgPSAwLCBmID0gaS5JbnRFbmNvZGVyLmRlY29kZShlLnN1YnN0cihsLCBvLkJpdExlbmd0aC5tYXhJZCksIG8uQml0TGVuZ3RoLm1heElkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgKz0gby5CaXRMZW5ndGgubWF4SWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IGkuSW50RW5jb2Rlci5kZWNvZGUoZS5jaGFyQXQobCksIG8uQml0TGVuZ3RoLmVuY29kaW5nVHlwZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobCArPSBvLkJpdExlbmd0aC5lbmNvZGluZ1R5cGUsIHAgPT09IGMuVmVjdG9yRW5jb2RpbmdUeXBlLlJBTkdFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSBuZXcgci5WZWN0b3IoKSwgMSA9PT0gdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJzEnID09PSBlLnN1YnN0cihsLCAxKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyB1LkRlY29kaW5nRXJyb3IoJ1VuYWJsZSB0byBkZWNvZGUgZGVmYXVsdCBjb25zZW50PTEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCsrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGkuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIobCwgby5CaXRMZW5ndGgubnVtRW50cmllcyksIG8uQml0TGVuZ3RoLm51bUVudHJpZXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgKz0gby5CaXRMZW5ndGgubnVtRW50cmllczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBoID0gMDsgaCA8IGQ7IGgrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IGEuQm9vbGVhbkVuY29kZXIuZGVjb2RlKGUuY2hhckF0KGwpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCArPSBvLkJpdExlbmd0aC5zaW5nbGVPclJhbmdlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGkuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIobCwgby5CaXRMZW5ndGgudmVuZG9ySWQpLCBvLkJpdExlbmd0aC52ZW5kb3JJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsICs9IG8uQml0TGVuZ3RoLnZlbmRvcklkLCBtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdiA9IGkuSW50RW5jb2Rlci5kZWNvZGUoZS5zdWJzdHIobCwgby5CaXRMZW5ndGgudmVuZG9ySWQpLCBvLkJpdExlbmd0aC52ZW5kb3JJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsICs9IG8uQml0TGVuZ3RoLnZlbmRvcklkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgeSA9IGc7IHkgPD0gdjsgeSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uc2V0KHkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uc2V0KGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBlLnN1YnN0cihsLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsICs9IGYsIG4gPSBzLkZpeGVkVmVjdG9yRW5jb2Rlci5kZWNvZGUoYiwgZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5iaXRMZW5ndGggPSBsLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmJ1aWxkUmFuZ2VFbmNvZGluZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubGVuZ3RoLCBuID0gaS5JbnRFbmNvZGVyLmVuY29kZSh0LCBvLkJpdExlbmd0aC5udW1FbnRyaWVzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IDEgPT09IGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gKz0gYS5Cb29sZWFuRW5jb2Rlci5lbmNvZGUoIXQpLCBuICs9IGkuSW50RW5jb2Rlci5lbmNvZGUoZVswXSwgby5CaXRMZW5ndGgudmVuZG9ySWQpLCB0IHx8IChuICs9IGkuSW50RW5jb2Rlci5lbmNvZGUoZVsxXSwgby5CaXRMZW5ndGgudmVuZG9ySWQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuVmVuZG9yVmVjdG9yRW5jb2RlciA9IGw7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pLCAociA9IHQuVmVjdG9yRW5jb2RpbmdUeXBlIHx8ICh0LlZlY3RvckVuY29kaW5nVHlwZSA9IHt9KSlbci5GSUVMRCA9IDBdID0gJ0ZJRUxEJywgcltyLlJBTkdFID0gMV0gPSAnUkFOR0UnOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pIHx8ICh0W25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KSwgcihuKDI5NCkpLCByKG4oMjk1KSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0oKSwgbyA9IHRoaXMgJiYgdGhpcy5fX2F3YWl0ZXIgfHwgZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyAobiB8fCAobiA9IFByb21pc2UpKShmdW5jdGlvbiAobywgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhyLm5leHQoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjKHIudGhyb3coZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmRvbmUgPyBvKGUudmFsdWUpIDogKHQgPSBlLnZhbHVlLCB0IGluc3RhbmNlb2YgbiA/IHQgOiBuZXcgbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS50aGVuKGEsIHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYygociA9IHIuYXBwbHkoZSwgdCB8fCBbXSkpLm5leHQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIGkgPSB0aGlzICYmIHRoaXMuX19nZW5lcmF0b3IgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8sIGksIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWw6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VudDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSAmIG9bMF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBvWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gb1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeXM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wczogW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogcygwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93OiBzKDEpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOiBzKDIpCiAgICAgICAgICAgICAgICAgICAgICAgIH0sICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAoaVtTeW1ib2wuaXRlcmF0b3JdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpOwogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAocykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0dlbmVyYXRvciBpcyBhbHJlYWR5IGV4ZWN1dGluZy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGE7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9IDEsIHIgJiYgKG8gPSAyICYgaVswXSA/IHIucmV0dXJuIDogaVswXSA/IHIudGhyb3cgfHwgKChvID0gci5yZXR1cm4pICYmIG8uY2FsbChyKSwgMCkgOiByLm5leHQpICYmICEobyA9IG8uY2FsbChyLCBpWzFdKSkuZG9uZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChyID0gMCwgbyAmJiAoaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIgJiBpWzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby52YWx1ZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgaVswXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmxhYmVsKyssIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBpWzFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubGFiZWwrKywgciA9IGlbMV0sIGkgPSBbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGEub3BzLnBvcCgpLCBhLnRyeXMucG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG8gPSAobyA9IGEudHJ5cykubGVuZ3RoID4gMCAmJiBvW28ubGVuZ3RoIC0gMV0pICYmICg2ID09PSBpWzBdIHx8IDIgPT09IGlbMF0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgzID09PSBpWzBdICYmICghbyB8fCBpWzFdID4gb1swXSAmJiBpWzFdIDwgb1szXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubGFiZWwgPSBpWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDYgPT09IGlbMF0gJiYgYS5sYWJlbCA8IG9bMV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubGFiZWwgPSBvWzFdLCBvID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvICYmIGEubGFiZWwgPCBvWzJdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmxhYmVsID0gb1syXSwgYS5vcHMucHVzaChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9bMl0gJiYgYS5vcHMucG9wKCksIGEudHJ5cy5wb3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSB0LmNhbGwoZSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHIgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbyA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg1ICYgaVswXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGlbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogaVswXSA/IGlbMV0gOiB2b2lkIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIGEgPSBuKDI5KSwgcyA9IG4oMTUpLCBjID0gbigxNDUpLCB1ID0gbigxNyksIGwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5jYWxsKHRoaXMpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmlzUmVhZHlfID0gITEsIHIuaXNMYXRlc3QgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdC5iYXNlVXJsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIubGFuZ18gPSB0LkRFRkFVTFRfTEFOR1VBR0UsIHIuaXNWZW5kb3JMaXN0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIucG9wdWxhdGUobiksIHIucmVhZHlQcm9taXNlID0gUHJvbWlzZS5yZXNvbHZlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBzLkdWTEVycm9yKCdtdXN0IHNwZWNpZnkgR1ZMLmJhc2VVcmwgYmVmb3JlIGxvYWRpbmcgR1ZMIGpzb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA+IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LkNBQ0hFLmhhcyhpKSA/IChyLnBvcHVsYXRlKHQuQ0FDSEUuZ2V0KGkpKSwgci5yZWFkeVByb21pc2UgPSBQcm9taXNlLnJlc29sdmUoKSkgOiAobyArPSB0LnZlcnNpb25lZEZpbGVuYW1lLnJlcGxhY2UoJ1tWRVJTSU9OXScsIGkgKyAnJyksIHIucmVhZHlQcm9taXNlID0gci5mZXRjaEpzb24obykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LkNBQ0hFLmhhcyh0LkxBVEVTVF9DQUNIRV9LRVkpID8gKHIucG9wdWxhdGUodC5DQUNIRS5nZXQodC5MQVRFU1RfQ0FDSEVfS0VZKSksIHIucmVhZHlQcm9taXNlID0gUHJvbWlzZS5yZXNvbHZlKCkpIDogKHIuaXNMYXRlc3QgPSAhMCwgci5yZWFkeVByb21pc2UgPSByLmZldGNoSnNvbihvICsgdC5sYXRlc3RGaWxlbmFtZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnYmFzZVVybCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmJhc2VVcmxfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoL15odHRwcz86XC9cL3ZlbmRvcmxpc3RcLmNvbnNlbnN1XC5vcmdcLy8udGVzdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHMuR1ZMRXJyb3IoJ0ludmFsaWQgYmFzZVVybCEgIFlvdSBtYXkgbm90IHB1bGwgZGlyZWN0bHkgZnJvbSB2ZW5kb3JsaXN0LmNvbnNlbnN1Lm9yZyBhbmQgbXVzdCBwcm92aWRlIHlvdXIgb3duIGNhY2hlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5sZW5ndGggPiAwICYmICcvJyAhPT0gZVtlLmxlbmd0aCAtIDFdICYmIChlICs9ICcvJyksIHRoaXMuYmFzZVVybF8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5lbXB0eUxhbmd1YWdlQ2FjaGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGUgJiYgdC5MQU5HVUFHRV9DQUNIRS5zaXplID4gMCA/ICh0LkxBTkdVQUdFX0NBQ0hFID0gbmV3IE1hcCgpLCBuID0gITApIDogJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgdGhpcy5jb25zZW50TGFuZ3VhZ2VzLmhhcyhlLnRvVXBwZXJDYXNlKCkpICYmICh0LkxBTkdVQUdFX0NBQ0hFLmRlbGV0ZShlLnRvVXBwZXJDYXNlKCkpLCBuID0gITApLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmVtcHR5Q2FjaGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIuaXNJbnRlZ2VyKGUpICYmIGUgPj0gMCA/ICh0LkNBQ0hFLmRlbGV0ZShlKSwgbiA9ICEwKSA6IHZvaWQgMCA9PT0gZSAmJiAodC5DQUNIRSA9IG5ldyBNYXAoKSwgbiA9ICEwKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuY2FjaGVMYW5ndWFnZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuTEFOR1VBR0VfQ0FDSEUuaGFzKHRoaXMubGFuZ18pIHx8IHQuTEFOR1VBR0VfQ0FDSEUuc2V0KHRoaXMubGFuZ18sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXJwb3NlczogdGhpcy5wdXJwb3NlcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsUHVycG9zZXM6IHRoaXMuc3BlY2lhbFB1cnBvc2VzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlYXR1cmVzOiB0aGlzLmZlYXR1cmVzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxGZWF0dXJlczogdGhpcy5zcGVjaWFsRmVhdHVyZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2tzOiB0aGlzLnN0YWNrcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmZldGNoSnNvbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyh0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKHRoaXMsIGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoci5sYWJlbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci50cnlzLnB1c2goWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIHQgPSB0aGlzLnBvcHVsYXRlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLkpzb24uZmV0Y2goZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFwcGx5KHRoaXMsIFtyLnNlbnQoKV0pLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuID0gci5zZW50KCksIG5ldyBzLkdWTEVycm9yKG4ubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbMl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRKc29uID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04ucGFyc2UoSlNPTi5zdHJpbmdpZnkoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd2bFNwZWNpZmljYXRpb25WZXJzaW9uOiB0aGlzLmd2bFNwZWNpZmljYXRpb25WZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckxpc3RWZXJzaW9uOiB0aGlzLnZlbmRvckxpc3RWZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRjZlBvbGljeVZlcnNpb246IHRoaXMudGNmUG9saWN5VmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0VXBkYXRlZDogdGhpcy5sYXN0VXBkYXRlZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXJwb3NlczogdGhpcy5wdXJwb3NlcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsUHVycG9zZXM6IHRoaXMuc3BlY2lhbFB1cnBvc2VzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlYXR1cmVzOiB0aGlzLmZlYXR1cmVzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxGZWF0dXJlczogdGhpcy5zcGVjaWFsRmVhdHVyZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2tzOiB0aGlzLnN0YWNrcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JzOiB0aGlzLmZ1bGxWZW5kb3JMaXN0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmNoYW5nZUxhbmd1YWdlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8sIGEsIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkodGhpcywgZnVuY3Rpb24gKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChpLmxhYmVsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID0gZS50b1VwcGVyQ2FzZSgpLCAhdC5jb25zZW50TGFuZ3VhZ2VzLmhhcyhuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID09PSB0aGlzLmxhbmdfKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMubGFuZ18gPSBuLCAhdC5MQU5HVUFHRV9DQUNIRS5oYXMobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG8gaW4gciA9IHQuTEFOR1VBR0VfQ0FDSEUuZ2V0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaGFzT3duUHJvcGVydHkobykgJiYgKHRoaXNbb10gPSByW29dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gdC5iYXNlVXJsICsgdC5sYW5ndWFnZUZpbGVuYW1lLnJlcGxhY2UoJ1tMQU5HXScsIGUpLCBpLmxhYmVsID0gMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkudHJ5cy5wdXNoKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZldGNoSnNvbihhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuc2VudCgpLCB0aGlzLmNhY2hlTGFuZ3VhZ2UoKSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgYyA9IGkuc2VudCgpLCBuZXcgcy5HVkxFcnJvcigndW5hYmxlIHRvIGxvYWQgbGFuZ3VhZ2U6ICcgKyBjLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHMuR1ZMRXJyb3IoJ3Vuc3VwcG9ydGVkIGxhbmd1YWdlICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2xhbmd1YWdlJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubGFuZ187CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0LnByb3RvdHlwZS5pc1ZlbmRvckxpc3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gZSAmJiB2b2lkIDAgIT09IGUudmVuZG9yczsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUucG9wdWxhdGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdXJwb3NlcyA9IGUucHVycG9zZXMsIHRoaXMuc3BlY2lhbFB1cnBvc2VzID0gZS5zcGVjaWFsUHVycG9zZXMsIHRoaXMuZmVhdHVyZXMgPSBlLmZlYXR1cmVzLCB0aGlzLnNwZWNpYWxGZWF0dXJlcyA9IGUuc3BlY2lhbEZlYXR1cmVzLCB0aGlzLnN0YWNrcyA9IGUuc3RhY2tzLCB0aGlzLmlzVmVuZG9yTGlzdChlKSAmJiAodGhpcy5ndmxTcGVjaWZpY2F0aW9uVmVyc2lvbiA9IGUuZ3ZsU3BlY2lmaWNhdGlvblZlcnNpb24sIHRoaXMudGNmUG9saWN5VmVyc2lvbiA9IGUudGNmUG9saWN5VmVyc2lvbiwgdGhpcy52ZW5kb3JMaXN0VmVyc2lvbiA9IGUudmVuZG9yTGlzdFZlcnNpb24sIHRoaXMubGFzdFVwZGF0ZWQgPSBlLmxhc3RVcGRhdGVkLCAnc3RyaW5nJyA9PSB0eXBlb2YgdGhpcy5sYXN0VXBkYXRlZCAmJiAodGhpcy5sYXN0VXBkYXRlZCA9IG5ldyBEYXRlKHRoaXMubGFzdFVwZGF0ZWQpKSwgdGhpcy52ZW5kb3JzXyA9IGUudmVuZG9ycywgdGhpcy5mdWxsVmVuZG9yTGlzdCA9IGUudmVuZG9ycywgdGhpcy5tYXBWZW5kb3JzKCksIHRoaXMuaXNSZWFkeV8gPSAhMCwgdGhpcy5pc0xhdGVzdCAmJiB0LkNBQ0hFLnNldCh0LkxBVEVTVF9DQUNIRV9LRVksIHRoaXMuZ2V0SnNvbigpKSwgdC5DQUNIRS5oYXModGhpcy52ZW5kb3JMaXN0VmVyc2lvbikgfHwgdC5DQUNIRS5zZXQodGhpcy52ZW5kb3JMaXN0VmVyc2lvbiwgdGhpcy5nZXRKc29uKCkpKSwgdGhpcy5jYWNoZUxhbmd1YWdlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLm1hcFZlbmRvcnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ieVB1cnBvc2VWZW5kb3JNYXAgPSB7fSwgdGhpcy5ieVNwZWNpYWxQdXJwb3NlVmVuZG9yTWFwID0ge30sIHRoaXMuYnlGZWF0dXJlVmVuZG9yTWFwID0ge30sIHRoaXMuYnlTcGVjaWFsRmVhdHVyZVZlbmRvck1hcCA9IHt9LCBPYmplY3Qua2V5cyh0aGlzLnB1cnBvc2VzKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVB1cnBvc2VWZW5kb3JNYXBbZV0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZ0ludDogbmV3IFNldCgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50OiBuZXcgU2V0KCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsZXhpYmxlOiBuZXcgU2V0KCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5rZXlzKHRoaXMuc3BlY2lhbFB1cnBvc2VzKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVNwZWNpYWxQdXJwb3NlVmVuZG9yTWFwW2VdID0gbmV3IFNldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5rZXlzKHRoaXMuZmVhdHVyZXMpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmJ5RmVhdHVyZVZlbmRvck1hcFtlXSA9IG5ldyBTZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3Qua2V5cyh0aGlzLnNwZWNpYWxGZWF0dXJlcykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuYnlTcGVjaWFsRmVhdHVyZVZlbmRvck1hcFtlXSA9IG5ldyBTZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBBcnJheS5pc0FycmF5KGUpIHx8IChlID0gT2JqZWN0LmtleXModGhpcy5mdWxsVmVuZG9yTGlzdCkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICtlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCB0aGlzLnZlbmRvcklkcyA9IG5ldyBTZXQoZSksIHRoaXMudmVuZG9yc18gPSBlLnJlZHVjZShmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC52ZW5kb3JzX1snJyArIG5dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByICYmIHZvaWQgMCA9PT0gci5kZWxldGVkRGF0ZSAmJiAoci5wdXJwb3Nlcy5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuYnlQdXJwb3NlVmVuZG9yTWFwW2UgKyAnJ10uY29uc2VudC5hZGQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIuc3BlY2lhbFB1cnBvc2VzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVNwZWNpYWxQdXJwb3NlVmVuZG9yTWFwW2UgKyAnJ10uYWRkKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLmxlZ0ludFB1cnBvc2VzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVB1cnBvc2VWZW5kb3JNYXBbZSArICcnXS5sZWdJbnQuYWRkKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLmZsZXhpYmxlUHVycG9zZXMgJiYgci5mbGV4aWJsZVB1cnBvc2VzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5ieVB1cnBvc2VWZW5kb3JNYXBbZSArICcnXS5mbGV4aWJsZS5hZGQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIuZmVhdHVyZXMuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmJ5RmVhdHVyZVZlbmRvck1hcFtlICsgJyddLmFkZChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgci5zcGVjaWFsRmVhdHVyZXMuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmJ5U3BlY2lhbEZlYXR1cmVWZW5kb3JNYXBbZSArICcnXS5hZGQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGVbbl0gPSByKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZ2V0RmlsdGVyZWRWZW5kb3JzID0gZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdGhpcywgaSA9IGUuY2hhckF0KDApLnRvVXBwZXJDYXNlKCkgKyBlLnNsaWNlKDEpLCBhID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKCdwdXJwb3NlJyA9PT0gZSAmJiBuID8gdGhpc1snYnknICsgaSArICdWZW5kb3JNYXAnXVt0ICsgJyddW25dIDogdGhpc1snYnknICsgKHIgPyAnU3BlY2lhbCcgOiAnJykgKyBpICsgJ1ZlbmRvck1hcCddW3QgKyAnJ10pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhW2UgKyAnJ10gPSBvLnZlbmRvcnNbZSArICcnXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRWZW5kb3JzV2l0aENvbnNlbnRQdXJwb3NlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldEZpbHRlcmVkVmVuZG9ycygncHVycG9zZScsIGUsICdjb25zZW50Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFZlbmRvcnNXaXRoTGVnSW50UHVycG9zZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5nZXRGaWx0ZXJlZFZlbmRvcnMoJ3B1cnBvc2UnLCBlLCAnbGVnSW50Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFZlbmRvcnNXaXRoRmxleGlibGVQdXJwb3NlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldEZpbHRlcmVkVmVuZG9ycygncHVycG9zZScsIGUsICdmbGV4aWJsZScpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRWZW5kb3JzV2l0aFNwZWNpYWxQdXJwb3NlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldEZpbHRlcmVkVmVuZG9ycygncHVycG9zZScsIGUsIHZvaWQgMCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRWZW5kb3JzV2l0aEZlYXR1cmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RmlsdGVyZWRWZW5kb3JzKCdmZWF0dXJlJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFZlbmRvcnNXaXRoU3BlY2lhbEZlYXR1cmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0RmlsdGVyZWRWZW5kb3JzKCdmZWF0dXJlJywgZSwgdm9pZCAwLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ3ZlbmRvcnMnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy52ZW5kb3JzXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQucHJvdG90eXBlLm5hcnJvd1ZlbmRvcnNUbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm1hcFZlbmRvcnMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2lzUmVhZHknLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5pc1JlYWR5XzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQucHJvdG90eXBlLmNsb25lID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB0KHRoaXMuZ2V0SnNvbigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5pc0luc3RhbmNlT2YgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnID09IHR5cGVvZiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGUubmFycm93VmVuZG9yc1RvOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LkxBTkdVQUdFX0NBQ0hFID0gbmV3IE1hcCgpLCB0LkNBQ0hFID0gbmV3IE1hcCgpLCB0LkxBVEVTVF9DQUNIRV9LRVkgPSAwLCB0LkRFRkFVTFRfTEFOR1VBR0UgPSAnRU4nLCB0LmNvbnNlbnRMYW5ndWFnZXMgPSBuZXcgdS5Db25zZW50TGFuZ3VhZ2VzKCksIHQubGF0ZXN0RmlsZW5hbWUgPSAndmVuZG9yLWxpc3QuanNvbicsIHQudmVyc2lvbmVkRmlsZW5hbWUgPSAnYXJjaGl2ZXMvdmVuZG9yLWxpc3QtdltWRVJTSU9OXS5qc29uJywgdC5sYW5ndWFnZUZpbGVuYW1lID0gJ3B1cnBvc2VzLVtMQU5HXS5qc29uJywgdDsKICAgICAgICAgICAgICAgICAgICB9KGEuQ2xvbmVhYmxlKTsKICAgICAgICAgICAgICAgIHQuR1ZMID0gbDsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWJzQ2FsbCA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiAobywgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEud2l0aENyZWRlbnRpYWxzID0gbiwgYS5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLnJlYWR5U3RhdGUgPT0gWE1MSHR0cFJlcXVlc3QuRE9ORSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEuc3RhdHVzID49IDIwMCAmJiBhLnN0YXR1cyA8IDMwMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhLnJlc3BvbnNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBKU09OLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkobmV3IEVycm9yKCdIVFRQIFN0YXR1czogJyArIGEuc3RhdHVzICsgJyByZXNwb25zZSB0eXBlOiAnICsgYS5yZXNwb25zZVR5cGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhLmFkZEV2ZW50TGlzdGVuZXIoJ2Vycm9yJywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkobmV3IEVycm9yKCdlcnJvcicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhLmFkZEV2ZW50TGlzdGVuZXIoJ2Fib3J0JywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkobmV3IEVycm9yKCdhYm9ydGVkJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG51bGwgPT09IHQgPyBhLm9wZW4oJ0dFVCcsIGUsICEwKSA6IGEub3BlbignUE9TVCcsIGUsICEwKSwgYS5yZXNwb25zZVR5cGUgPSAnanNvbicsIGEudGltZW91dCA9IHIsIGEub250aW1lb3V0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkobmV3IEVycm9yKCdUaW1lb3V0ICcgKyByICsgJ21zICcgKyBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhLnNlbmQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIGUucG9zdCA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IG4gJiYgKG4gPSAhMSksIHZvaWQgMCA9PT0gciAmJiAociA9IDApLCB0aGlzLmFic0NhbGwoZSwgSlNPTi5zdHJpbmdpZnkodCksIG4sIHIpOwogICAgICAgICAgICAgICAgICAgIH0sIGUuZmV0Y2ggPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSB0ICYmICh0ID0gITEpLCB2b2lkIDAgPT09IG4gJiYgKG4gPSAwKSwgdGhpcy5hYnNDYWxsKGUsIG51bGwsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0Lkpzb24gPSByOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzICYmIHRoaXMuX19leHRlbmRzIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCB7IF9fcHJvdG9fXzogW10gfSBpbnN0YW5jZW9mIEFycmF5ICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9fcHJvdG9fXyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pICYmIChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnN0cnVjdG9yID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBvID0gbigyOSksIGkgPSBuKDE1KSwgYSA9IG4oMTQ0KSwgcyA9IG4oMTcpLCBjID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuY2FsbCh0aGlzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uaXNTZXJ2aWNlU3BlY2lmaWNfID0gITEsIG4uc3VwcG9ydE9PQl8gPSAhMCwgbi51c2VOb25TdGFuZGFyZFN0YWNrc18gPSAhMSwgbi5wdXJwb3NlT25lVHJlYXRtZW50XyA9ICExLCBuLnB1Ymxpc2hlckNvdW50cnlDb2RlXyA9ICdBQScsIG4udmVyc2lvbl8gPSAyLCBuLmNvbnNlbnRTY3JlZW5fID0gMCwgbi5wb2xpY3lWZXJzaW9uXyA9IDIsIG4uY29uc2VudExhbmd1YWdlXyA9ICdFTicsIG4uY21wSWRfID0gMCwgbi5jbXBWZXJzaW9uXyA9IDAsIG4udmVuZG9yTGlzdFZlcnNpb25fID0gMCwgbi5udW1DdXN0b21QdXJwb3Nlc18gPSAwLCBuLnNwZWNpYWxGZWF0dXJlT3B0aW5zID0gbmV3IHMuVmVjdG9yKCksIG4ucHVycG9zZUNvbnNlbnRzID0gbmV3IHMuVmVjdG9yKCksIG4ucHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMgPSBuZXcgcy5WZWN0b3IoKSwgbi5wdWJsaXNoZXJDb25zZW50cyA9IG5ldyBzLlZlY3RvcigpLCBuLnB1Ymxpc2hlckxlZ2l0aW1hdGVJbnRlcmVzdHMgPSBuZXcgcy5WZWN0b3IoKSwgbi5wdWJsaXNoZXJDdXN0b21Db25zZW50cyA9IG5ldyBzLlZlY3RvcigpLCBuLnB1Ymxpc2hlckN1c3RvbUxlZ2l0aW1hdGVJbnRlcmVzdHMgPSBuZXcgcy5WZWN0b3IoKSwgbi52ZW5kb3JDb25zZW50cyA9IG5ldyBzLlZlY3RvcigpLCBuLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMgPSBuZXcgcy5WZWN0b3IoKSwgbi52ZW5kb3JzRGlzY2xvc2VkID0gbmV3IHMuVmVjdG9yKCksIG4udmVuZG9yc0FsbG93ZWQgPSBuZXcgcy5WZWN0b3IoKSwgbi5wdWJsaXNoZXJSZXN0cmljdGlvbnMgPSBuZXcgcy5QdXJwb3NlUmVzdHJpY3Rpb25WZWN0b3IoKSwgdCAmJiAobi5ndmwgPSB0KSwgbi5jcmVhdGVkID0gbmV3IERhdGUoKSwgbi51cGRhdGVkKCksIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2d2bCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmd2bF87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuR1ZMLmlzSW5zdGFuY2VPZihlKSB8fCAoZSA9IG5ldyBhLkdWTChlKSksIHRoaXMuZ3ZsXyA9IGUsIHRoaXMucHVibGlzaGVyUmVzdHJpY3Rpb25zLmd2bCA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdjbXBJZCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNtcElkXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoTnVtYmVyLmlzSW50ZWdlcigrZSkgJiYgZSA+IDEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgaS5UQ01vZGVsRXJyb3IoJ2NtcElkJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jbXBJZF8gPSArZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2NtcFZlcnNpb24nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jbXBWZXJzaW9uXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoTnVtYmVyLmlzSW50ZWdlcigrZSkgJiYgZSA+IC0xKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuVENNb2RlbEVycm9yKCdjbXBWZXJzaW9uJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jbXBWZXJzaW9uXyA9ICtlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAnY29uc2VudFNjcmVlbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNvbnNlbnRTY3JlZW5fOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShOdW1iZXIuaXNJbnRlZ2VyKCtlKSAmJiBlID4gLTEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgaS5UQ01vZGVsRXJyb3IoJ2NvbnNlbnRTY3JlZW4nLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnNlbnRTY3JlZW5fID0gK2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdjb25zZW50TGFuZ3VhZ2UnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb25zZW50TGFuZ3VhZ2VfOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnNlbnRMYW5ndWFnZV8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAncHVibGlzaGVyQ291bnRyeUNvZGUnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wdWJsaXNoZXJDb3VudHJ5Q29kZV87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghL14oW0Etel0pezJ9JC8udGVzdChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuVENNb2RlbEVycm9yKCdwdWJsaXNoZXJDb3VudHJ5Q29kZScsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucHVibGlzaGVyQ291bnRyeUNvZGVfID0gZS50b1VwcGVyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAndmVuZG9yTGlzdFZlcnNpb24nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5ndmwgPyB0aGlzLmd2bC52ZW5kb3JMaXN0VmVyc2lvbiA6IHRoaXMudmVuZG9yTGlzdFZlcnNpb25fOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGUgPSArZSA+PiAwKSA8IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBpLlRDTW9kZWxFcnJvcigndmVuZG9yTGlzdFZlcnNpb24nLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZlbmRvckxpc3RWZXJzaW9uXyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdwb2xpY3lWZXJzaW9uJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ3ZsID8gdGhpcy5ndmwudGNmUG9saWN5VmVyc2lvbiA6IHRoaXMucG9saWN5VmVyc2lvbl87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnBvbGljeVZlcnNpb25fID0gcGFyc2VJbnQoZSwgMTApLCB0aGlzLnBvbGljeVZlcnNpb25fIDwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IGkuVENNb2RlbEVycm9yKCdwb2xpY3lWZXJzaW9uJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICd2ZXJzaW9uJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudmVyc2lvbl87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmVyc2lvbl8gPSBwYXJzZUludChlLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdpc1NlcnZpY2VTcGVjaWZpYycsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmlzU2VydmljZVNwZWNpZmljXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pc1NlcnZpY2VTcGVjaWZpY18gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAndXNlTm9uU3RhbmRhcmRTdGFja3MnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy51c2VOb25TdGFuZGFyZFN0YWNrc187CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudXNlTm9uU3RhbmRhcmRTdGFja3NfID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ3N1cHBvcnRPT0InLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdXBwb3J0T09CXzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdXBwb3J0T09CXyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdwdXJwb3NlT25lVHJlYXRtZW50JywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucHVycG9zZU9uZVRyZWF0bWVudF87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucHVycG9zZU9uZVRyZWF0bWVudF8gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5wcm90b3R5cGUuc2V0QWxsVmVuZG9yQ29uc2VudHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnZlbmRvckNvbnNlbnRzLnNldCh0aGlzLmd2bC52ZW5kb3JzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUudW5zZXRBbGxWZW5kb3JDb25zZW50cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmVuZG9yQ29uc2VudHMuZW1wdHkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuc2V0QWxsVmVuZG9yc0Rpc2Nsb3NlZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmVuZG9yc0Rpc2Nsb3NlZC5zZXQodGhpcy5ndmwudmVuZG9ycyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnVuc2V0QWxsVmVuZG9yc0Rpc2Nsb3NlZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmVuZG9yc0Rpc2Nsb3NlZC5lbXB0eSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5zZXRBbGxWZW5kb3JzQWxsb3dlZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudmVuZG9yc0FsbG93ZWQuc2V0KHRoaXMuZ3ZsLnZlbmRvcnMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS51bnNldEFsbFZlbmRvcnNBbGxvd2VkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52ZW5kb3JzQWxsb3dlZC5lbXB0eSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5zZXRBbGxWZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzLnNldCh0aGlzLmd2bC52ZW5kb3JzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUudW5zZXRBbGxWZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy52ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzLmVtcHR5KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnNldEFsbFB1cnBvc2VDb25zZW50cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucHVycG9zZUNvbnNlbnRzLnNldCh0aGlzLmd2bC5wdXJwb3Nlcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnVuc2V0QWxsUHVycG9zZUNvbnNlbnRzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wdXJwb3NlQ29uc2VudHMuZW1wdHkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuc2V0QWxsUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzLnNldCh0aGlzLmd2bC5wdXJwb3Nlcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnVuc2V0QWxsUHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzLmVtcHR5KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnNldEFsbFNwZWNpYWxGZWF0dXJlT3B0aW5zID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zcGVjaWFsRmVhdHVyZU9wdGlucy5zZXQodGhpcy5ndmwuc3BlY2lhbEZlYXR1cmVzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUudW5zZXRBbGxTcGVjaWFsRmVhdHVyZU9wdGlucyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3BlY2lhbEZlYXR1cmVPcHRpbnMuZW1wdHkoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuc2V0QWxsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRBbGxWZW5kb3JDb25zZW50cygpLCB0aGlzLnNldEFsbFB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzKCksIHRoaXMuc2V0QWxsU3BlY2lhbEZlYXR1cmVPcHRpbnMoKSwgdGhpcy5zZXRBbGxQdXJwb3NlQ29uc2VudHMoKSwgdGhpcy5zZXRBbGxWZW5kb3JMZWdpdGltYXRlSW50ZXJlc3RzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnVuc2V0QWxsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy51bnNldEFsbFZlbmRvckNvbnNlbnRzKCksIHRoaXMudW5zZXRBbGxQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0cygpLCB0aGlzLnVuc2V0QWxsU3BlY2lhbEZlYXR1cmVPcHRpbnMoKSwgdGhpcy51bnNldEFsbFB1cnBvc2VDb25zZW50cygpLCB0aGlzLnVuc2V0QWxsVmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cygpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QuZGVmaW5lUHJvcGVydHkodC5wcm90b3R5cGUsICdudW1DdXN0b21QdXJwb3NlcycsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5udW1DdXN0b21QdXJwb3Nlc187CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09IHR5cGVvZiB0aGlzLmN1c3RvbVB1cnBvc2VzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0LmtleXModGhpcy5jdXN0b21QdXJwb3Nlcykuc29ydChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICtlIC0gK3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gcGFyc2VJbnQodC5wb3AoKSwgMTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMubnVtQ3VzdG9tUHVycG9zZXNfID0gcGFyc2VJbnQoZSwgMTApLCB0aGlzLm51bUN1c3RvbVB1cnBvc2VzXyA8IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBpLlRDTW9kZWxFcnJvcignbnVtQ3VzdG9tUHVycG9zZXMnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQucHJvdG90eXBlLnVwZGF0ZWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxhc3RVcGRhdGVkID0gbmV3IERhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5jb25zZW50TGFuZ3VhZ2VzID0gYS5HVkwuY29uc2VudExhbmd1YWdlcywgdDsKICAgICAgICAgICAgICAgICAgICB9KG8uQ2xvbmVhYmxlKTsKICAgICAgICAgICAgICAgIHQuVENNb2RlbCA9IGM7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IGUuU3ltYm9sOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09PSB0eXBlb2YgbiA/IG4ub2JzZXJ2YWJsZSA/IHQgPSBuLm9ic2VydmFibGUgOiAodCA9IG4oJ29ic2VydmFibGUnKSwgbi5vYnNlcnZhYmxlID0gdCkgOiB0ID0gJ0BAb2JzZXJ2YWJsZScsIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBuLmQodCwgJ2EnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh0ICsgJ30nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobiwgciwgbywgaSwgYSwgcywgYywgdSwgbCwgZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IGwgJiYgNjQgPT09IHIuY2hhckNvZGVBdCgwKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUociArICc7JyksICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSB1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciArICcvKnwqLyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMTI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKG9bMF0gKyByKSwgJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgKyAoMCA9PT0gZiA/ICcvKnwqLycgOiAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAtMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnNwbGl0KCcvKnwqL30nKS5mb3JFYWNoKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB0LmEgPSB7CiAgICAgICAgICAgICAgICAgICAgYW5pbWF0aW9uSXRlcmF0aW9uQ291bnQ6IDEsCiAgICAgICAgICAgICAgICAgICAgYm9yZGVySW1hZ2VPdXRzZXQ6IDEsCiAgICAgICAgICAgICAgICAgICAgYm9yZGVySW1hZ2VTbGljZTogMSwKICAgICAgICAgICAgICAgICAgICBib3JkZXJJbWFnZVdpZHRoOiAxLAogICAgICAgICAgICAgICAgICAgIGJveEZsZXg6IDEsCiAgICAgICAgICAgICAgICAgICAgYm94RmxleEdyb3VwOiAxLAogICAgICAgICAgICAgICAgICAgIGJveE9yZGluYWxHcm91cDogMSwKICAgICAgICAgICAgICAgICAgICBjb2x1bW5Db3VudDogMSwKICAgICAgICAgICAgICAgICAgICBjb2x1bW5zOiAxLAogICAgICAgICAgICAgICAgICAgIGZsZXg6IDEsCiAgICAgICAgICAgICAgICAgICAgZmxleEdyb3c6IDEsCiAgICAgICAgICAgICAgICAgICAgZmxleFBvc2l0aXZlOiAxLAogICAgICAgICAgICAgICAgICAgIGZsZXhTaHJpbms6IDEsCiAgICAgICAgICAgICAgICAgICAgZmxleE5lZ2F0aXZlOiAxLAogICAgICAgICAgICAgICAgICAgIGZsZXhPcmRlcjogMSwKICAgICAgICAgICAgICAgICAgICBncmlkUm93OiAxLAogICAgICAgICAgICAgICAgICAgIGdyaWRSb3dFbmQ6IDEsCiAgICAgICAgICAgICAgICAgICAgZ3JpZFJvd1NwYW46IDEsCiAgICAgICAgICAgICAgICAgICAgZ3JpZFJvd1N0YXJ0OiAxLAogICAgICAgICAgICAgICAgICAgIGdyaWRDb2x1bW46IDEsCiAgICAgICAgICAgICAgICAgICAgZ3JpZENvbHVtbkVuZDogMSwKICAgICAgICAgICAgICAgICAgICBncmlkQ29sdW1uU3BhbjogMSwKICAgICAgICAgICAgICAgICAgICBncmlkQ29sdW1uU3RhcnQ6IDEsCiAgICAgICAgICAgICAgICAgICAgbXNHcmlkUm93OiAxLAogICAgICAgICAgICAgICAgICAgIG1zR3JpZFJvd1NwYW46IDEsCiAgICAgICAgICAgICAgICAgICAgbXNHcmlkQ29sdW1uOiAxLAogICAgICAgICAgICAgICAgICAgIG1zR3JpZENvbHVtblNwYW46IDEsCiAgICAgICAgICAgICAgICAgICAgZm9udFdlaWdodDogMSwKICAgICAgICAgICAgICAgICAgICBsaW5lSGVpZ2h0OiAxLAogICAgICAgICAgICAgICAgICAgIG9wYWNpdHk6IDEsCiAgICAgICAgICAgICAgICAgICAgb3JkZXI6IDEsCiAgICAgICAgICAgICAgICAgICAgb3JwaGFuczogMSwKICAgICAgICAgICAgICAgICAgICB0YWJTaXplOiAxLAogICAgICAgICAgICAgICAgICAgIHdpZG93czogMSwKICAgICAgICAgICAgICAgICAgICB6SW5kZXg6IDEsCiAgICAgICAgICAgICAgICAgICAgem9vbTogMSwKICAgICAgICAgICAgICAgICAgICBXZWJraXRMaW5lQ2xhbXA6IDEsCiAgICAgICAgICAgICAgICAgICAgZmlsbE9wYWNpdHk6IDEsCiAgICAgICAgICAgICAgICAgICAgZmxvb2RPcGFjaXR5OiAxLAogICAgICAgICAgICAgICAgICAgIHN0b3BPcGFjaXR5OiAxLAogICAgICAgICAgICAgICAgICAgIHN0cm9rZURhc2hhcnJheTogMSwKICAgICAgICAgICAgICAgICAgICBzdHJva2VEYXNob2Zmc2V0OiAxLAogICAgICAgICAgICAgICAgICAgIHN0cm9rZU1pdGVybGltaXQ6IDEsCiAgICAgICAgICAgICAgICAgICAgc3Ryb2tlT3BhY2l0eTogMSwKICAgICAgICAgICAgICAgICAgICBzdHJva2VXaWR0aDogMQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gL14oKGNoaWxkcmVufGRhbmdlcm91c2x5U2V0SW5uZXJIVE1MfGtleXxyZWZ8YXV0b0ZvY3VzfGRlZmF1bHRWYWx1ZXxkZWZhdWx0Q2hlY2tlZHxpbm5lckhUTUx8c3VwcHJlc3NDb250ZW50RWRpdGFibGVXYXJuaW5nfHN1cHByZXNzSHlkcmF0aW9uV2FybmluZ3x2YWx1ZUxpbmt8YWNjZXB0fGFjY2VwdENoYXJzZXR8YWNjZXNzS2V5fGFjdGlvbnxhbGxvd3xhbGxvd1VzZXJNZWRpYXxhbGxvd1BheW1lbnRSZXF1ZXN0fGFsbG93RnVsbFNjcmVlbnxhbGxvd1RyYW5zcGFyZW5jeXxhbHR8YXN5bmN8YXV0b0NvbXBsZXRlfGF1dG9QbGF5fGNhcHR1cmV8Y2VsbFBhZGRpbmd8Y2VsbFNwYWNpbmd8Y2hhbGxlbmdlfGNoYXJTZXR8Y2hlY2tlZHxjaXRlfGNsYXNzSUR8Y2xhc3NOYW1lfGNvbHN8Y29sU3Bhbnxjb250ZW50fGNvbnRlbnRFZGl0YWJsZXxjb250ZXh0TWVudXxjb250cm9sc3xjb250cm9sc0xpc3R8Y29vcmRzfGNyb3NzT3JpZ2lufGRhdGF8ZGF0ZVRpbWV8ZGVjb2Rpbmd8ZGVmYXVsdHxkZWZlcnxkaXJ8ZGlzYWJsZWR8ZGlzYWJsZVBpY3R1cmVJblBpY3R1cmV8ZG93bmxvYWR8ZHJhZ2dhYmxlfGVuY1R5cGV8Zm9ybXxmb3JtQWN0aW9ufGZvcm1FbmNUeXBlfGZvcm1NZXRob2R8Zm9ybU5vVmFsaWRhdGV8Zm9ybVRhcmdldHxmcmFtZUJvcmRlcnxoZWFkZXJzfGhlaWdodHxoaWRkZW58aGlnaHxocmVmfGhyZWZMYW5nfGh0bWxGb3J8aHR0cEVxdWl2fGlkfGlucHV0TW9kZXxpbnRlZ3JpdHl8aXN8a2V5UGFyYW1zfGtleVR5cGV8a2luZHxsYWJlbHxsYW5nfGxpc3R8bG9hZGluZ3xsb29wfGxvd3xtYXJnaW5IZWlnaHR8bWFyZ2luV2lkdGh8bWF4fG1heExlbmd0aHxtZWRpYXxtZWRpYUdyb3VwfG1ldGhvZHxtaW58bWluTGVuZ3RofG11bHRpcGxlfG11dGVkfG5hbWV8bm9uY2V8bm9WYWxpZGF0ZXxvcGVufG9wdGltdW18cGF0dGVybnxwbGFjZWhvbGRlcnxwbGF5c0lubGluZXxwb3N0ZXJ8cHJlbG9hZHxwcm9maWxlfHJhZGlvR3JvdXB8cmVhZE9ubHl8cmVmZXJyZXJQb2xpY3l8cmVsfHJlcXVpcmVkfHJldmVyc2VkfHJvbGV8cm93c3xyb3dTcGFufHNhbmRib3h8c2NvcGV8c2NvcGVkfHNjcm9sbGluZ3xzZWFtbGVzc3xzZWxlY3RlZHxzaGFwZXxzaXplfHNpemVzfHNsb3R8c3BhbnxzcGVsbENoZWNrfHNyY3xzcmNEb2N8c3JjTGFuZ3xzcmNTZXR8c3RhcnR8c3RlcHxzdHlsZXxzdW1tYXJ5fHRhYkluZGV4fHRhcmdldHx0aXRsZXx0eXBlfHVzZU1hcHx2YWx1ZXx3aWR0aHx3bW9kZXx3cmFwfGFib3V0fGRhdGF0eXBlfGlubGlzdHxwcmVmaXh8cHJvcGVydHl8cmVzb3VyY2V8dHlwZW9mfHZvY2FifGF1dG9DYXBpdGFsaXplfGF1dG9Db3JyZWN0fGF1dG9TYXZlfGNvbG9yfGluZXJ0fGl0ZW1Qcm9wfGl0ZW1TY29wZXxpdGVtVHlwZXxpdGVtSUR8aXRlbVJlZnxvbnxyZXN1bHRzfHNlY3VyaXR5fHVuc2VsZWN0YWJsZXxhY2NlbnRIZWlnaHR8YWNjdW11bGF0ZXxhZGRpdGl2ZXxhbGlnbm1lbnRCYXNlbGluZXxhbGxvd1Jlb3JkZXJ8YWxwaGFiZXRpY3xhbXBsaXR1ZGV8YXJhYmljRm9ybXxhc2NlbnR8YXR0cmlidXRlTmFtZXxhdHRyaWJ1dGVUeXBlfGF1dG9SZXZlcnNlfGF6aW11dGh8YmFzZUZyZXF1ZW5jeXxiYXNlbGluZVNoaWZ0fGJhc2VQcm9maWxlfGJib3h8YmVnaW58Ymlhc3xieXxjYWxjTW9kZXxjYXBIZWlnaHR8Y2xpcHxjbGlwUGF0aFVuaXRzfGNsaXBQYXRofGNsaXBSdWxlfGNvbG9ySW50ZXJwb2xhdGlvbnxjb2xvckludGVycG9sYXRpb25GaWx0ZXJzfGNvbG9yUHJvZmlsZXxjb2xvclJlbmRlcmluZ3xjb250ZW50U2NyaXB0VHlwZXxjb250ZW50U3R5bGVUeXBlfGN1cnNvcnxjeHxjeXxkfGRlY2VsZXJhdGV8ZGVzY2VudHxkaWZmdXNlQ29uc3RhbnR8ZGlyZWN0aW9ufGRpc3BsYXl8ZGl2aXNvcnxkb21pbmFudEJhc2VsaW5lfGR1cnxkeHxkeXxlZGdlTW9kZXxlbGV2YXRpb258ZW5hYmxlQmFja2dyb3VuZHxlbmR8ZXhwb25lbnR8ZXh0ZXJuYWxSZXNvdXJjZXNSZXF1aXJlZHxmaWxsfGZpbGxPcGFjaXR5fGZpbGxSdWxlfGZpbHRlcnxmaWx0ZXJSZXN8ZmlsdGVyVW5pdHN8Zmxvb2RDb2xvcnxmbG9vZE9wYWNpdHl8Zm9jdXNhYmxlfGZvbnRGYW1pbHl8Zm9udFNpemV8Zm9udFNpemVBZGp1c3R8Zm9udFN0cmV0Y2h8Zm9udFN0eWxlfGZvbnRWYXJpYW50fGZvbnRXZWlnaHR8Zm9ybWF0fGZyb218ZnJ8Znh8Znl8ZzF8ZzJ8Z2x5cGhOYW1lfGdseXBoT3JpZW50YXRpb25Ib3Jpem9udGFsfGdseXBoT3JpZW50YXRpb25WZXJ0aWNhbHxnbHlwaFJlZnxncmFkaWVudFRyYW5zZm9ybXxncmFkaWVudFVuaXRzfGhhbmdpbmd8aG9yaXpBZHZYfGhvcml6T3JpZ2luWHxpZGVvZ3JhcGhpY3xpbWFnZVJlbmRlcmluZ3xpbnxpbjJ8aW50ZXJjZXB0fGt8azF8azJ8azN8azR8a2VybmVsTWF0cml4fGtlcm5lbFVuaXRMZW5ndGh8a2VybmluZ3xrZXlQb2ludHN8a2V5U3BsaW5lc3xrZXlUaW1lc3xsZW5ndGhBZGp1c3R8bGV0dGVyU3BhY2luZ3xsaWdodGluZ0NvbG9yfGxpbWl0aW5nQ29uZUFuZ2xlfGxvY2FsfG1hcmtlckVuZHxtYXJrZXJNaWR8bWFya2VyU3RhcnR8bWFya2VySGVpZ2h0fG1hcmtlclVuaXRzfG1hcmtlcldpZHRofG1hc2t8bWFza0NvbnRlbnRVbml0c3xtYXNrVW5pdHN8bWF0aGVtYXRpY2FsfG1vZGV8bnVtT2N0YXZlc3xvZmZzZXR8b3BhY2l0eXxvcGVyYXRvcnxvcmRlcnxvcmllbnR8b3JpZW50YXRpb258b3JpZ2lufG92ZXJmbG93fG92ZXJsaW5lUG9zaXRpb258b3ZlcmxpbmVUaGlja25lc3N8cGFub3NlMXxwYWludE9yZGVyfHBhdGhMZW5ndGh8cGF0dGVybkNvbnRlbnRVbml0c3xwYXR0ZXJuVHJhbnNmb3JtfHBhdHRlcm5Vbml0c3xwb2ludGVyRXZlbnRzfHBvaW50c3xwb2ludHNBdFh8cG9pbnRzQXRZfHBvaW50c0F0WnxwcmVzZXJ2ZUFscGhhfHByZXNlcnZlQXNwZWN0UmF0aW98cHJpbWl0aXZlVW5pdHN8cnxyYWRpdXN8cmVmWHxyZWZZfHJlbmRlcmluZ0ludGVudHxyZXBlYXRDb3VudHxyZXBlYXREdXJ8cmVxdWlyZWRFeHRlbnNpb25zfHJlcXVpcmVkRmVhdHVyZXN8cmVzdGFydHxyZXN1bHR8cm90YXRlfHJ4fHJ5fHNjYWxlfHNlZWR8c2hhcGVSZW5kZXJpbmd8c2xvcGV8c3BhY2luZ3xzcGVjdWxhckNvbnN0YW50fHNwZWN1bGFyRXhwb25lbnR8c3BlZWR8c3ByZWFkTWV0aG9kfHN0YXJ0T2Zmc2V0fHN0ZERldmlhdGlvbnxzdGVtaHxzdGVtdnxzdGl0Y2hUaWxlc3xzdG9wQ29sb3J8c3RvcE9wYWNpdHl8c3RyaWtldGhyb3VnaFBvc2l0aW9ufHN0cmlrZXRocm91Z2hUaGlja25lc3N8c3RyaW5nfHN0cm9rZXxzdHJva2VEYXNoYXJyYXl8c3Ryb2tlRGFzaG9mZnNldHxzdHJva2VMaW5lY2FwfHN0cm9rZUxpbmVqb2lufHN0cm9rZU1pdGVybGltaXR8c3Ryb2tlT3BhY2l0eXxzdHJva2VXaWR0aHxzdXJmYWNlU2NhbGV8c3lzdGVtTGFuZ3VhZ2V8dGFibGVWYWx1ZXN8dGFyZ2V0WHx0YXJnZXRZfHRleHRBbmNob3J8dGV4dERlY29yYXRpb258dGV4dFJlbmRlcmluZ3x0ZXh0TGVuZ3RofHRvfHRyYW5zZm9ybXx1MXx1Mnx1bmRlcmxpbmVQb3NpdGlvbnx1bmRlcmxpbmVUaGlja25lc3N8dW5pY29kZXx1bmljb2RlQmlkaXx1bmljb2RlUmFuZ2V8dW5pdHNQZXJFbXx2QWxwaGFiZXRpY3x2SGFuZ2luZ3x2SWRlb2dyYXBoaWN8dk1hdGhlbWF0aWNhbHx2YWx1ZXN8dmVjdG9yRWZmZWN0fHZlcnNpb258dmVydEFkdll8dmVydE9yaWdpblh8dmVydE9yaWdpbll8dmlld0JveHx2aWV3VGFyZ2V0fHZpc2liaWxpdHl8d2lkdGhzfHdvcmRTcGFjaW5nfHdyaXRpbmdNb2RlfHh8eEhlaWdodHx4MXx4Mnx4Q2hhbm5lbFNlbGVjdG9yfHhsaW5rQWN0dWF0ZXx4bGlua0FyY3JvbGV8eGxpbmtIcmVmfHhsaW5rUm9sZXx4bGlua1Nob3d8eGxpbmtUaXRsZXx4bGlua1R5cGV8eG1sQmFzZXx4bWxuc3x4bWxuc1hsaW5rfHhtbExhbmd8eG1sU3BhY2V8eXx5MXx5Mnx5Q2hhbm5lbFNlbGVjdG9yfHp8em9vbUFuZFBhbnxmb3J8Y2xhc3N8YXV0b2ZvY3VzKXwoKFtEZF1bQWFdW1R0XVtBYV18W0FhXVtScl1bSWldW0FhXXx4KS0uKikpJC8sIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IHRbbl0gJiYgKHRbbl0gPSBlKG4pKSwgdFtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLnRlc3QoZSkgfHwgMTExID09PSBlLmNoYXJDb2RlQXQoMCkgJiYgMTEwID09PSBlLmNoYXJDb2RlQXQoMSkgJiYgZS5jaGFyQ29kZUF0KDIpIDwgOTE7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB0LmEgPSBvOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChlKS5zbGljZSg4LCAtMSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ09iamVjdCcgPT09IHIoZSkgJiYgKGUuY29uc3RydWN0b3IgPT09IE9iamVjdCAmJiBPYmplY3QuZ2V0UHJvdG90eXBlT2YoZSkgPT09IE9iamVjdC5wcm90b3R5cGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdBcnJheScgPT09IHIoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1N5bWJvbCcgPT09IHIoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSAwLCB0ID0gMCwgbiA9IGFyZ3VtZW50cy5sZW5ndGg7IHQgPCBuOyB0KyspCiAgICAgICAgICAgICAgICAgICAgICAgIGUgKz0gYXJndW1lbnRzW3RdLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IEFycmF5KGUpLCBvID0gMDsKICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSAwOyB0IDwgbjsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gYXJndW1lbnRzW3RdLCBhID0gMCwgcyA9IGkubGVuZ3RoOyBhIDwgczsgYSsrLCBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByW29dID0gaVthXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHZhciBvID0gci5wcm9wZXJ0eUlzRW51bWVyYWJsZSh0KSA/ICdlbnVtZXJhYmxlJyA6ICdub25lbnVtZXJhYmxlJzsKICAgICAgICAgICAgICAgICAgICAnZW51bWVyYWJsZScgPT09IG8gJiYgKGVbdF0gPSBuKSwgJ25vbmVudW1lcmFibGUnID09PSBvICYmIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIW8odCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICYmIGkobikgJiYgbi5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gbihlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7fTsKICAgICAgICAgICAgICAgICAgICBvKGUpICYmIChyID0gcyhPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyhlKSwgT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyhlKSkucmVkdWNlKGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZVtyXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICghYShyKSAmJiAhT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXModCkuaW5jbHVkZXMocikgfHwgYShyKSAmJiAhT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyh0KS5pbmNsdWRlcyhyKSkgJiYgYyhuLCByLCBvLCBlKSwgbjsKICAgICAgICAgICAgICAgICAgICB9LCB7fSkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBzKE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKHQpLCBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKHQpKS5yZWR1Y2UoZnVuY3Rpb24gKHIsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB0W2FdLCBsID0gbyhlKSA/IGVbYV0gOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICYmIGkobikgJiYgbi5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gZShsLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHZvaWQgMCAhPT0gbCAmJiBvKHMpICYmIChzID0gdShsLCBzLCBuKSksIGMociwgYSwgcywgdCksIHI7CiAgICAgICAgICAgICAgICAgICAgfSwgcik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0LmEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBbXSwgbiA9IDE7IG4gPCBhcmd1bWVudHMubGVuZ3RoOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHRbbiAtIDFdID0gYXJndW1lbnRzW25dOwogICAgICAgICAgICAgICAgICAgIHZhciByID0gbnVsbCwgaSA9IGU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSkgJiYgZS5leHRlbnNpb25zICYmIDEgPT09IE9iamVjdC5rZXlzKGUpLmxlbmd0aCAmJiAoaSA9IHt9LCByID0gZS5leHRlbnNpb25zKSwgdC5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoZSwgdCwgcik7CiAgICAgICAgICAgICAgICAgICAgfSwgaSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxNTMpLCBlLmV4cG9ydHMgPSBuKDI5OSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBuLnIodCk7CiAgICAgICAgICAgICAgICBuKDE1NCksIG4oMTYwKSwgbigxNjEpLCBuKDE2MiksIG4oMTYzKSwgbigxNjQpLCBuKDE2NSksIG4oMTY2KSwgbigxNjcpLCBuKDE2OCksIG4oMTY5KSwgbigxNzApLCBuKDE3MSksIG4oMTcyKSwgbigxNzMpLCBuKDE3NSksIG4oMTc2KSwgbigxNzgpLCBuKDE4MSksIG4oMTgyKSwgbigxODMpLCBuKDE4NCksIG4oMTkwKSwgbigxOTEpLCBuKDE5MyksIG4oMTk0KSwgbigxOTYpLCBuKDE5NyksIG4oMjAwKSwgbigyMDEpLCBuKDIwMiksIG4oMjA0KSwgbigyMDYpLCBuKDIwOCksIG4oMjA5KSwgbigyMTEpLCBuKDIxMiksIG4oMjEzKSwgbigyMTQpLCBuKDIxNSksIG4oMjE2KSwgbigyMTcpLCBuKDIxOCksIG4oMjIwKSwgbigyMjEpLCBuKDIyMiksIG4oMjIzKSwgbigyMjQpLCBuKDIyNSksIG4oMjI2KSwgbigyMjcpLCBuKDIyOCksIG4oMjI5KSwgbigyMzEpLCBuKDIzMyksIG4oMjM0KSwgbigyMzYpLCBuKDIzNyksIG4oMjM4KSwgbigyMzkpLCBuKDI0MCksIG4oMjQxKSwgbigyNDIpLCBuKDI0MyksIG4oMjQ0KSwgbigyNDUpLCBuKDI0NiksIG4oMjQ3KSwgbigyNDgpLCBuKDI0OSksIG4oMjUwKSwgbigyNTEpLCBuKDI1MiksIG4oMjUzKSwgbigyNTQpLCBuKDI1NSksIG4oMjU2KTsKICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhcmd1bWVudHNbU3ltYm9sLml0ZXJhdG9yXTsKICAgICAgICAgICAgICAgIH0oKSAmJiBPYmplY3QuZGVmaW5lUHJvcGVydHkgJiYgT2JqZWN0LmRlZmluZVByb3BlcnR5KE9iamVjdC5wcm90b3R5cGUsIFN5bWJvbC5pdGVyYXRvciwgewogICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tvYmplY3QgQXJndW1lbnRzXScgPT09IFtdLnRvU3RyaW5nLmNhbGwodGhpcykgPyBbXVtTeW1ib2wuaXRlcmF0b3JdIDogdGhpcy5fX1N5bWJvbF9pdGVyYXRvcjsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICdfX1N5bWJvbF9pdGVyYXRvcicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgTnVtYmVyLmlzSW50ZWdlciA9IE51bWJlci5pc0ludGVnZXIgfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ251bWJlcicgPT09IHR5cGVvZiBlICYmIGlzRmluaXRlKGUpICYmIE1hdGguZmxvb3IoZSkgPT09IGU7CiAgICAgICAgICAgICAgICB9LCBOdW1iZXIuaXNOYU4gPSBOdW1iZXIuaXNOYU4gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ251bWJlcicgPT09IHR5cGVvZiBlICYmIGUgIT09IGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig3KSwgaSA9IG4oMTApLCBhID0gbig0KSwgcyA9IG4oMTgpLCBjID0gbig2NSksIHUgPSBuKDkxKSwgbCA9IG4oMTIpLCBmID0gbigxNCksIHAgPSBuKDQ4KSwgZCA9IG4oMTMpLCBoID0gbigzKSwgbSA9IG4oMjYpLCBnID0gbigyNSksIHYgPSBuKDQ1KSwgeSA9IG4oMzEpLCBiID0gbig0MCksIEUgPSBuKDQ5KSwgdyA9IG4oNjEpLCB4ID0gbigxNTkpLCBTID0gbig2MyksIEMgPSBuKDM2KSwgayA9IG4oMTkpLCBUID0gbig0NCksIF8gPSBuKDIyKSwgUCA9IG4oMjMpLCBPID0gbig2MCksIEkgPSBuKDQ2KSwgTCA9IG4oMzgpLCBBID0gbig0NyksIFIgPSBuKDgpLCBOID0gbig5MyksIGogPSBuKDExKSwgcSA9IG4oMjcpLCBGID0gbigzMyksIEQgPSBuKDk0KS5mb3JFYWNoLCBNID0gSSgnaGlkZGVuJyksIFUgPSBSKCd0b1ByaW1pdGl2ZScpLCBWID0gRi5zZXQsIEIgPSBGLmdldHRlckZvcignU3ltYm9sJyksIHogPSBPYmplY3QucHJvdG90eXBlLCBHID0gby5TeW1ib2wsIEggPSBpKCdKU09OJywgJ3N0cmluZ2lmeScpLCBXID0gQy5mLCAkID0gay5mLCBZID0geC5mLCBRID0gVC5mLCBLID0gTygnc3ltYm9scycpLCBKID0gTygnb3Atc3ltYm9scycpLCBYID0gTygnc3RyaW5nLXRvLXN5bWJvbC1yZWdpc3RyeScpLCBaID0gTygnc3ltYm9sLXRvLXN0cmluZy1yZWdpc3RyeScpLCBlZSA9IE8oJ3drcycpLCB0ZSA9IG8uUU9iamVjdCwgbmUgPSAhdGUgfHwgIXRlLnByb3RvdHlwZSB8fCAhdGUucHJvdG90eXBlLmZpbmRDaGlsZCwgcmUgPSBzICYmIGwoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gNyAhPSBiKCQoe30sICdhJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodGhpcywgJ2EnLCB7IHZhbHVlOiA3IH0pLmE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5hOwogICAgICAgICAgICAgICAgICAgIH0pID8gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBXKHosIHQpOwogICAgICAgICAgICAgICAgICAgICAgICByICYmIGRlbGV0ZSB6W3RdLCAkKGUsIHQsIG4pLCByICYmIGUgIT09IHogJiYgJCh6LCB0LCByKTsKICAgICAgICAgICAgICAgICAgICB9IDogJCwgb2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IEtbZV0gPSBiKEcucHJvdG90eXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFYobiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ1N5bWJvbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWc6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogdAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgcyB8fCAobi5kZXNjcmlwdGlvbiA9IHQpLCBuOwogICAgICAgICAgICAgICAgICAgIH0sIGllID0gdSA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3ltYm9sJyA9PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChlKSBpbnN0YW5jZW9mIEc7CiAgICAgICAgICAgICAgICAgICAgfSwgYWUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBlID09PSB6ICYmIGFlKEosIHQsIG4pLCBoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHYodCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaChuKSwgZihLLCByKSA/IChuLmVudW1lcmFibGUgPyAoZihlLCBNKSAmJiBlW01dW3JdICYmIChlW01dW3JdID0gITEpLCBuID0gYihuLCB7IGVudW1lcmFibGU6IHkoMCwgITEpIH0pKSA6IChmKGUsIE0pIHx8ICQoZSwgTSwgeSgxLCB7fSkpLCBlW01dW3JdID0gITApLCByZShlLCByLCBuKSkgOiAkKGUsIHIsIG4pOwogICAgICAgICAgICAgICAgICAgIH0sIHNlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBnKHQpLCByID0gRShuKS5jb25jYXQoZmUobikpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRChyLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcyAmJiAhY2UuY2FsbChuLCB0KSB8fCBhZShlLCB0LCBuW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgY2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHYoZSwgITApLCBuID0gUS5jYWxsKHRoaXMsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISh0aGlzID09PSB6ICYmIGYoSywgdCkgJiYgIWYoSiwgdCkpICYmICghKG4gfHwgIWYodGhpcywgdCkgfHwgIWYoSywgdCkgfHwgZih0aGlzLCBNKSAmJiB0aGlzW01dW3RdKSB8fCBuKTsKICAgICAgICAgICAgICAgICAgICB9LCB1ZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZyhlKSwgciA9IHYodCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobiAhPT0geiB8fCAhZihLLCByKSB8fCBmKEosIHIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IFcobiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIW8gfHwgIWYoSywgcikgfHwgZihuLCBNKSAmJiBuW01dW3JdIHx8IChvLmVudW1lcmFibGUgPSAhMCksIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBsZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gWShnKGUpKSwgbiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRCh0LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZihLLCBlKSB8fCBmKEwsIGUpIHx8IG4ucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgfSwgZmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUgPT09IHosIG4gPSBZKHQgPyBKIDogZyhlKSksIHIgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEQobiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICFmKEssIGUpIHx8IHQgJiYgIWYoeiwgZSkgfHwgci5wdXNoKEtbZV0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgcjsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgKGMgfHwgKFAoKEcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMgaW5zdGFuY2VvZiBHKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ1N5bWJvbCBpcyBub3QgYSBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IFN0cmluZyhhcmd1bWVudHNbMF0pIDogdm9pZCAwLCB0ID0gQShlKSwgbiA9IGZ1bmN0aW9uIGUobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcyA9PT0geiAmJiBlLmNhbGwoSiwgbiksIGYodGhpcywgTSkgJiYgZih0aGlzW01dLCB0KSAmJiAodGhpc1tNXVt0XSA9ICExKSwgcmUodGhpcywgdCwgeSgxLCBuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMgJiYgbmUgJiYgcmUoeiwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IG4KICAgICAgICAgICAgICAgICAgICB9KSwgb2UodCwgZSk7CiAgICAgICAgICAgICAgICB9KS5wcm90b3R5cGUsICd0b1N0cmluZycsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQih0aGlzKS50YWc7CiAgICAgICAgICAgICAgICB9KSwgUChHLCAnd2l0aG91dFNldHRlcicsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9lKEEoZSksIGUpOwogICAgICAgICAgICAgICAgfSksIFQuZiA9IGNlLCBrLmYgPSBhZSwgQy5mID0gdWUsIHcuZiA9IHguZiA9IGxlLCBTLmYgPSBmZSwgTi5mID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2UoUihlKSwgZSk7CiAgICAgICAgICAgICAgICB9LCBzICYmICgkKEcucHJvdG90eXBlLCAnZGVzY3JpcHRpb24nLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEIodGhpcykuZGVzY3JpcHRpb247CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSksIGEgfHwgUCh6LCAncHJvcGVydHlJc0VudW1lcmFibGUnLCBjZSwgeyB1bnNhZmU6ICEwIH0pKSksIHIoewogICAgICAgICAgICAgICAgICAgIGdsb2JhbDogITAsCiAgICAgICAgICAgICAgICAgICAgd3JhcDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhYywKICAgICAgICAgICAgICAgICAgICBzaGFtOiAhYwogICAgICAgICAgICAgICAgfSwgeyBTeW1ib2w6IEcgfSksIEQoRShlZSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaihlKTsKICAgICAgICAgICAgICAgIH0pLCByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTeW1ib2wnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogIWMKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBmb3I6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gU3RyaW5nKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZihYLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBYW3RdOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IEcodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBYW3RdID0gbiwgWltuXSA9IHQsIG47CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBrZXlGb3I6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaWUoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoZSArICcgaXMgbm90IGEgc3ltYm9sJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmKFosIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFpbZV07CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB1c2VTZXR0ZXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbmUgPSAhMDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHVzZVNpbXBsZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBuZSA9ICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pLCByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdPYmplY3QnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogIWMsCiAgICAgICAgICAgICAgICAgICAgc2hhbTogIXMKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBjcmVhdGU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IHQgPyBiKGUpIDogc2UoYihlKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBkZWZpbmVQcm9wZXJ0eTogYWUsCiAgICAgICAgICAgICAgICAgICAgZGVmaW5lUHJvcGVydGllczogc2UsCiAgICAgICAgICAgICAgICAgICAgZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOiB1ZQogICAgICAgICAgICAgICAgfSksIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ09iamVjdCcsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhYwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGdldE93blByb3BlcnR5TmFtZXM6IGxlLAogICAgICAgICAgICAgICAgICAgIGdldE93blByb3BlcnR5U3ltYm9sczogZmUKICAgICAgICAgICAgICAgIH0pLCByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdPYmplY3QnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFMuZigxKTsKICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGdldE93blByb3BlcnR5U3ltYm9sczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFMuZihtKGUpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgSCkgJiYgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnSlNPTicsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhYyB8fCBsKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBHKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnW251bGxdJyAhPSBIKFtlXSkgfHwgJ3t9JyAhPSBIKHsgYTogZSB9KSB8fCAne30nICE9IEgoT2JqZWN0KGUpKTsKICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHN0cmluZ2lmeTogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciwgbyA9IFtlXSwgaSA9IDE7IGFyZ3VtZW50cy5sZW5ndGggPiBpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8ucHVzaChhcmd1bWVudHNbaSsrXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyID0gdCwgKGQodCkgfHwgdm9pZCAwICE9PSBlKSAmJiAhaWUoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcCh0KSB8fCAodCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIHIgJiYgKHQgPSByLmNhbGwodGhpcywgZSwgdCkpLCAhaWUodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG9bMV0gPSB0LCBILmFwcGx5KG51bGwsIG8pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgRy5wcm90b3R5cGVbVV0gfHwgXyhHLnByb3RvdHlwZSwgVSwgRy5wcm90b3R5cGUudmFsdWVPZiksIHEoRywgJ1N5bWJvbCcpLCBMW01dID0gITA7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNyksIG8gPSBuKDU4KSwgaSA9IHIuV2Vha01hcDsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBpICYmIC9uYXRpdmUgY29kZS8udGVzdChvKGkpKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMCksIG8gPSBuKDYxKSwgaSA9IG4oNjMpLCBhID0gbigzKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIoJ1JlZmxlY3QnLCAnb3duS2V5cycpIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBvLmYoYShlKSksIG4gPSBpLmY7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPyB0LmNvbmNhdChuKGUpKSA6IHQ7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDM5KSwgbyA9IE1hdGgubWF4LCBpID0gTWF0aC5taW47CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gcihlKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA8IDAgPyBvKG4gKyB0LCAwKSA6IGkobiwgdCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE4KSwgbyA9IG4oMTkpLCBpID0gbigzKSwgYSA9IG4oNDkpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gciA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzIDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpKGUpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4sIHIgPSBhKHQpLCBzID0gci5sZW5ndGgsIGMgPSAwOyBzID4gYzspCiAgICAgICAgICAgICAgICAgICAgICAgIG8uZihlLCBuID0gcltjKytdLCB0W25dKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMjUpLCBvID0gbig2MSkuZiwgaSA9IHt9LnRvU3RyaW5nLCBhID0gJ29iamVjdCcgPT0gdHlwZW9mIHdpbmRvdyAmJiB3aW5kb3cgJiYgT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXMgPyBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyh3aW5kb3cpIDogW107CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMuZiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgJiYgJ1tvYmplY3QgV2luZG93XScgPT0gaS5jYWxsKGUpID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5zbGljZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfShlKSA6IG8ocihlKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigxOCksIGkgPSBuKDcpLCBhID0gbigxNCksIHMgPSBuKDEzKSwgYyA9IG4oMTkpLmYsIHUgPSBuKDg3KSwgbCA9IGkuU3ltYm9sOwogICAgICAgICAgICAgICAgaWYgKG8gJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgbCAmJiAoISgnZGVzY3JpcHRpb24nIGluIGwucHJvdG90eXBlKSB8fCB2b2lkIDAgIT09IGwoKS5kZXNjcmlwdGlvbikpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHt9LCBwID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoIDwgMSB8fCB2b2lkIDAgPT09IGFyZ3VtZW50c1swXSA/IHZvaWQgMCA6IFN0cmluZyhhcmd1bWVudHNbMF0pLCB0ID0gdGhpcyBpbnN0YW5jZW9mIHAgPyBuZXcgbChlKSA6IHZvaWQgMCA9PT0gZSA/IGwoKSA6IGwoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJycgPT09IGUgJiYgKGZbdF0gPSAhMCksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdShwLCBsKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHAucHJvdG90eXBlID0gbC5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICAgICAgZC5jb25zdHJ1Y3RvciA9IHA7CiAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBkLnRvU3RyaW5nLCBtID0gJ1N5bWJvbCh0ZXN0KScgPT0gU3RyaW5nKGwoJ3Rlc3QnKSksIGcgPSAvXlN5bWJvbFwoKC4qKVwpW14pXSskLzsKICAgICAgICAgICAgICAgICAgICBjKGQsICdkZXNjcmlwdGlvbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHModGhpcykgPyB0aGlzLnZhbHVlT2YoKSA6IHRoaXMsIHQgPSBoLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYShmLCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG0gPyB0LnNsaWNlKDcsIC0xKSA6IHQucmVwbGFjZShnLCAnJDEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJyA9PT0gbiA/IHZvaWQgMCA6IG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KSwgcih7CiAgICAgICAgICAgICAgICAgICAgICAgIGdsb2JhbDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGZvcmNlZDogITAKICAgICAgICAgICAgICAgICAgICB9LCB7IFN5bWJvbDogcCB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTEpKCdhc3luY0l0ZXJhdG9yJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDExKSgnaGFzSW5zdGFuY2UnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTEpKCdpc0NvbmNhdFNwcmVhZGFibGUnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTEpKCdpdGVyYXRvcicpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxMSkoJ21hdGNoJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDExKSgncmVwbGFjZScpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxMSkoJ3NlYXJjaCcpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxMSkoJ3NwZWNpZXMnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTEpKCdzcGxpdCcpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxMSkoJ3RvUHJpbWl0aXZlJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDExKSgndG9TdHJpbmdUYWcnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTEpKCd1bnNjb3BhYmxlcycpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigxMiksIGkgPSBuKDQ4KSwgYSA9IG4oMTMpLCBzID0gbigyNiksIGMgPSBuKDI0KSwgdSA9IG4oOTUpLCBsID0gbig2NiksIGYgPSBuKDE3NCksIHAgPSBuKDgpLCBkID0gbig2NyksIGggPSBwKCdpc0NvbmNhdFNwcmVhZGFibGUnKSwgbSA9IGQgPj0gNTEgfHwgIW8oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtoXSA9ICExLCBlLmNvbmNhdCgpWzBdICE9PSBlOwogICAgICAgICAgICAgICAgICAgIH0pLCBnID0gZignY29uY2F0JyksIHYgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWEoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVtoXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gdCA/ICEhdCA6IGkoZSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ0FycmF5JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhbSB8fCAhZwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGNvbmNhdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIsIG8sIGksIGEgPSBzKHRoaXMpLCBmID0gbChhLCAwKSwgcCA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCA9IC0xLCByID0gYXJndW1lbnRzLmxlbmd0aDsgdCA8IHI7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2KGkgPSAtMSA9PT0gdCA/IGEgOiBhcmd1bWVudHNbdF0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHAgKyAobyA9IGMoaS5sZW5ndGgpKSA+IDkwMDcxOTkyNTQ3NDA5OTEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignTWF4aW11bSBhbGxvd2VkIGluZGV4IGV4Y2VlZGVkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gMDsgbiA8IG87IG4rKywgcCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuIGluIGkgJiYgdShmLCBwLCBpW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHAgPj0gOTAwNzE5OTI1NDc0MDk5MSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKCdNYXhpbXVtIGFsbG93ZWQgaW5kZXggZXhjZWVkZWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1KGYsIHArKywgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmLmxlbmd0aCA9IHAsIGY7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTIpLCBvID0gbig4KSwgaSA9IG4oNjcpLCBhID0gbygnc3BlY2llcycpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSA+PSA1MSB8fCAhcihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAodC5jb25zdHJ1Y3RvciA9IHt9KVthXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7IGZvbzogMSB9OwogICAgICAgICAgICAgICAgICAgICAgICB9LCAxICE9PSB0W2VdKEJvb2xlYW4pLmZvbzsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDk0KS5maW5kLCBpID0gbig1MCksIGEgPSBuKDk3KSwgcyA9ICEwLCBjID0gYSgnZmluZCcpOwogICAgICAgICAgICAgICAgJ2ZpbmQnIGluIFtdICYmIEFycmF5KDEpLmZpbmQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHMgPSAhMTsKICAgICAgICAgICAgICAgIH0pLCByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdBcnJheScsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogcyB8fCAhYwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGZpbmQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKHRoaXMsIGUsIGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgaSgnZmluZCcpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigxNzcpLCBpID0gbigyNiksIGEgPSBuKDI0KSwgcyA9IG4oMzkpLCBjID0gbig2Nik7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdBcnJheScsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZmxhdDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGFyZ3VtZW50cy5sZW5ndGggPyBhcmd1bWVudHNbMF0gOiB2b2lkIDAsIHQgPSBpKHRoaXMpLCBuID0gYSh0Lmxlbmd0aCksIHIgPSBjKHQsIDApOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5sZW5ndGggPSBvKHIsIHQsIHQsIG4sIDAsIHZvaWQgMCA9PT0gZSA/IDEgOiBzKGUpKSwgcjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbig0OCksIG8gPSBuKDI0KSwgaSA9IG4oOSk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiBlKHQsIG4sIGEsIHMsIGMsIHUsIGwsIGYpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBwLCBkID0gYywgaCA9IDAsIG0gPSAhIWwgJiYgaShsLCBmLCAzKTsgaCA8IHM7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoIGluIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwID0gbSA/IG0oYVtoXSwgaCwgbikgOiBhW2hdLCB1ID4gMCAmJiByKHApKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBlKHQsIG4sIHAsIG8ocC5sZW5ndGgpLCBkLCB1IC0gMSkgLSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgPj0gOTAwNzE5OTI1NDc0MDk5MSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgVHlwZUVycm9yKCdFeGNlZWQgdGhlIGFjY2VwdGFibGUgYXJyYXkgbGVuZ3RoJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtkXSA9IHA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkKys7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaCsrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDE3OSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdBcnJheScsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhbig3MCkoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgfSwgeyBmcm9tOiBvIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDkpLCBvID0gbigyNiksIGkgPSBuKDE4MCksIGEgPSBuKDk5KSwgcyA9IG4oMjQpLCBjID0gbig5NSksIHUgPSBuKDY4KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIGwsIGYsIHAsIGQsIGggPSBvKGUpLCBtID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdGhpcyA/IHRoaXMgOiBBcnJheSwgZyA9IGFyZ3VtZW50cy5sZW5ndGgsIHYgPSBnID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgeSA9IHZvaWQgMCAhPT0gdiwgYiA9IHUoaCksIEUgPSAwOwogICAgICAgICAgICAgICAgICAgIGlmICh5ICYmICh2ID0gcih2LCBnID4gMiA/IGFyZ3VtZW50c1syXSA6IHZvaWQgMCwgMikpLCB2b2lkIDAgPT0gYiB8fCBtID09IEFycmF5ICYmIGEoYikpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IG5ldyBtKHQgPSBzKGgubGVuZ3RoKSk7IHQgPiBFOyBFKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0geSA/IHYoaFtFXSwgRSkgOiBoW0VdLCBjKG4sIEUsIGQpOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChwID0gKGYgPSBiLmNhbGwoaCkpLm5leHQsIG4gPSBuZXcgbSgpOyAhKGwgPSBwLmNhbGwoZikpLmRvbmU7IEUrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSB5ID8gaShmLCB2LCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbC52YWx1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCAhMCkgOiBsLnZhbHVlLCBjKG4sIEUsIGQpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmxlbmd0aCA9IEUsIG47CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDMpLCBvID0gbig5OCk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbiwgaSkgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID8gdChyKG4pWzBdLCBuWzFdKSA6IHQobik7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBvKGUpLCBhOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDkwKS5pbmNsdWRlcywgaSA9IG4oNTApOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnQXJyYXknLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6ICFuKDk3KSgnaW5kZXhPZicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgQUNDRVNTT1JTOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgMTogMAogICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgaW5jbHVkZXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKHRoaXMsIGUsIGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgaSgnaW5jbHVkZXMnKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oNTApKCdmbGF0Jyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNyk7CiAgICAgICAgICAgICAgICBuKDI3KShyLkpTT04sICdKU09OJywgITApOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEwMSksIG8gPSBuKDEwMyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByKCdNYXAnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHRoaXMsIGFyZ3VtZW50cy5sZW5ndGggPyBhcmd1bWVudHNbMF0gOiB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBvKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhcihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5pc0V4dGVuc2libGUoT2JqZWN0LnByZXZlbnRFeHRlbnNpb25zKHt9KSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMyksIG8gPSBuKDcyKTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGksIGE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgKGkgPSB0LmNvbnN0cnVjdG9yKSAmJiBpICE9PSBuICYmIHIoYSA9IGkucHJvdG90eXBlKSAmJiBhICE9PSBuLnByb3RvdHlwZSAmJiBvKGUsIGEpLCBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghcihlKSAmJiBudWxsICE9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ0NhblwndCBzZXQgJyArIFN0cmluZyhlKSArICcgYXMgYSBwcm90b3R5cGUnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTA1KS5JdGVyYXRvclByb3RvdHlwZSwgbyA9IG4oNDApLCBpID0gbigzMSksIGEgPSBuKDI3KSwgcyA9IG4oNDEpLCBjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHQgKyAnIEl0ZXJhdG9yJzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUgPSBvKHIsIHsgbmV4dDogaSgxLCBuKSB9KSwgYShlLCB1LCAhMSwgITApLCBzW3VdID0gYywgZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTIpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gIXIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS5jb25zdHJ1Y3RvciA9IG51bGwsIE9iamVjdC5nZXRQcm90b3R5cGVPZihuZXcgZSgpKSAhPT0gZS5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMjcpKE1hdGgsICdNYXRoJywgITApOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigxOTIpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnT2JqZWN0JywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IE9iamVjdC5hc3NpZ24gIT09IG8KICAgICAgICAgICAgICAgIH0sIHsgYXNzaWduOiBvIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE4KSwgbyA9IG4oMTIpLCBpID0gbig0OSksIGEgPSBuKDYzKSwgcyA9IG4oNDQpLCBjID0gbigyNiksIHUgPSBuKDU1KSwgbCA9IE9iamVjdC5hc3NpZ24sIGYgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSAhbCB8fCBvKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAociAmJiAxICE9PSBsKHsgYjogMSB9LCBsKGYoe30sICdhJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmKHRoaXMsICdiJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIHsgYjogMiB9KSkuYikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0ge30sIHQgPSB7fSwgbiA9IFN5bWJvbCgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlW25dID0gNywgJ2FiY2RlZmdoaWprbG1ub3BxcnN0Jy5zcGxpdCgnJykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0W2VdID0gZTsKICAgICAgICAgICAgICAgICAgICB9KSwgNyAhPSBsKHt9LCBlKVtuXSB8fCAnYWJjZGVmZ2hpamtsbW5vcHFyc3QnICE9IGkobCh7fSwgdCkpLmpvaW4oJycpOwogICAgICAgICAgICAgICAgfSkgPyBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBjKGUpLCBvID0gYXJndW1lbnRzLmxlbmd0aCwgbCA9IDEsIGYgPSBhLmYsIHAgPSBzLmY7IG8gPiBsOykKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCwgaCA9IHUoYXJndW1lbnRzW2wrK10pLCBtID0gZiA/IGkoaCkuY29uY2F0KGYoaCkpIDogaShoKSwgZyA9IG0ubGVuZ3RoLCB2ID0gMDsgZyA+IHY7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IG1bdisrXSwgciAmJiAhcC5jYWxsKGgsIGQpIHx8IChuW2RdID0gaFtkXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICB9IDogbDsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMTA3KS5lbnRyaWVzOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnT2JqZWN0JywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMAogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGVudHJpZXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDY5KSwgbyA9IG4oMjMpLCBpID0gbigxOTUpOwogICAgICAgICAgICAgICAgciB8fCBvKE9iamVjdC5wcm90b3R5cGUsICd0b1N0cmluZycsIGksIHsgdW5zYWZlOiAhMCB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbig2OSksIG8gPSBuKDEwMCk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByID8ge30udG9TdHJpbmcgOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdbb2JqZWN0ICcgKyBvKHRoaXMpICsgJ10nOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMTA3KS52YWx1ZXM7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdPYmplY3QnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgdmFsdWVzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByLCBvLCBpLCBhLCBzID0gbigxKSwgYyA9IG4oNCksIHUgPSBuKDcpLCBsID0gbigxMCksIGYgPSBuKDEwOCksIHAgPSBuKDIzKSwgZCA9IG4oMTA0KSwgaCA9IG4oMjcpLCBtID0gbigxMDYpLCBnID0gbigxMyksIHYgPSBuKDYpLCB5ID0gbig3MSksIGIgPSBuKDU4KSwgRSA9IG4oNSksIHcgPSBuKDcwKSwgeCA9IG4oMjApLCBTID0gbigxMDkpLnNldCwgQyA9IG4oMTk4KSwgayA9IG4oMTExKSwgVCA9IG4oMTk5KSwgXyA9IG4oNDIpLCBQID0gbig1MSksIE8gPSBuKDMzKSwgSSA9IG4oNjQpLCBMID0gbig4KSwgQSA9IG4oNzUpLCBSID0gbig2NyksIE4gPSBMKCdzcGVjaWVzJyksIGogPSAnUHJvbWlzZScsIHEgPSBPLmdldCwgRiA9IE8uc2V0LCBEID0gTy5nZXR0ZXJGb3IoaiksIE0gPSBmLCBVID0gdS5UeXBlRXJyb3IsIFYgPSB1LmRvY3VtZW50LCBCID0gdS5wcm9jZXNzLCB6ID0gbCgnZmV0Y2gnKSwgRyA9IF8uZiwgSCA9IEcsIFcgPSAhIShWICYmIFYuY3JlYXRlRXZlbnQgJiYgdS5kaXNwYXRjaEV2ZW50KSwgJCA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFByb21pc2VSZWplY3Rpb25FdmVudCwgWSA9IEkoaiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShiKE0pICE9PSBTdHJpbmcoTSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoNjYgPT09IFIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFBICYmICEkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyAmJiAhTS5wcm90b3R5cGUuZmluYWxseSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFIgPj0gNTEgJiYgL25hdGl2ZSBjb2RlLy50ZXN0KE0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IE0ucmVzb2x2ZSgxKSwgdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlLmNvbnN0cnVjdG9yID0ge30pW05dID0gdCwgIShlLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9KSBpbnN0YW5jZW9mIHQpOwogICAgICAgICAgICAgICAgICAgIH0pLCBRID0gWSB8fCAhdyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBNLmFsbChlKS5jYXRjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0pLCBLID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFnKGUpIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mICh0ID0gZS50aGVuKSkgJiYgdDsKICAgICAgICAgICAgICAgICAgICB9LCBKID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlLm5vdGlmaWVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5vdGlmaWVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUucmVhY3Rpb25zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgQyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IGUudmFsdWUsIG8gPSAxID09IGUuc3RhdGUsIGkgPSAwOyBuLmxlbmd0aCA+IGk7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCBzLCBjLCB1ID0gbltpKytdLCBsID0gbyA/IHUub2sgOiB1LmZhaWwsIGYgPSB1LnJlc29sdmUsIHAgPSB1LnJlamVjdCwgZCA9IHUuZG9tYWluOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA/IChvIHx8ICgyID09PSBlLnJlamVjdGlvbiAmJiB0ZShlKSwgZS5yZWplY3Rpb24gPSAxKSwgITAgPT09IGwgPyBhID0gciA6IChkICYmIGQuZW50ZXIoKSwgYSA9IGwociksIGQgJiYgKGQuZXhpdCgpLCBjID0gITApKSwgYSA9PT0gdS5wcm9taXNlID8gcChVKCdQcm9taXNlLWNoYWluIGN5Y2xlJykpIDogKHMgPSBLKGEpKSA/IHMuY2FsbChhLCBmLCBwKSA6IGYoYSkpIDogcChyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCAmJiAhYyAmJiBkLmV4aXQoKSwgcChoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnJlYWN0aW9ucyA9IFtdLCBlLm5vdGlmaWVkID0gITEsIHQgJiYgIWUucmVqZWN0aW9uICYmIFooZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIFggPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgVyA/ICgociA9IFYuY3JlYXRlRXZlbnQoJ0V2ZW50JykpLnByb21pc2UgPSB0LCByLnJlYXNvbiA9IG4sIHIuaW5pdEV2ZW50KGUsICExLCAhMCksIHUuZGlzcGF0Y2hFdmVudChyKSkgOiByID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvbWlzZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYXNvbjogbgogICAgICAgICAgICAgICAgICAgICAgICB9LCAhJCAmJiAobyA9IHVbJ29uJyArIGVdKSA/IG8ocikgOiAndW5oYW5kbGVkcmVqZWN0aW9uJyA9PT0gZSAmJiBUKCdVbmhhbmRsZWQgcHJvbWlzZSByZWplY3Rpb24nLCBuKTsKICAgICAgICAgICAgICAgICAgICB9LCBaID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgUy5jYWxsKHUsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gZS5mYWNhZGUsIHIgPSBlLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVlKGUpICYmICh0ID0gUChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEgPyBCLmVtaXQoJ3VuaGFuZGxlZFJlamVjdGlvbicsIHIsIG4pIDogWCgndW5oYW5kbGVkcmVqZWN0aW9uJywgbiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGUucmVqZWN0aW9uID0gQSB8fCBlZShlKSA/IDIgOiAxLCB0LmVycm9yKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyB0LnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBlZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxICE9PSBlLnJlamVjdGlvbiAmJiAhZS5wYXJlbnQ7CiAgICAgICAgICAgICAgICAgICAgfSwgdGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBTLmNhbGwodSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmZhY2FkZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEgPyBCLmVtaXQoJ3JlamVjdGlvbkhhbmRsZWQnLCB0KSA6IFgoJ3JlamVjdGlvbmhhbmRsZWQnLCB0LCBlLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgbmUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgciwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgcmUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBlLmRvbmUgfHwgKGUuZG9uZSA9ICEwLCBuICYmIChlID0gbiksIGUudmFsdWUgPSB0LCBlLnN0YXRlID0gMiwgSihlLCAhMCkpOwogICAgICAgICAgICAgICAgICAgIH0sIG9lID0gZnVuY3Rpb24gZSh0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdC5kb25lKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmRvbmUgPSAhMCwgciAmJiAodCA9IHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5mYWNhZGUgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFUoJ1Byb21pc2UgY2FuXCd0IGJlIHJlc29sdmVkIGl0c2VsZicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gSyhuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID8gQyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0geyBkb25lOiAhMSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby5jYWxsKG4sIG5lKGUsIHIsIHQpLCBuZShyZSwgciwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZShyLCBpLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogKHQudmFsdWUgPSBuLCB0LnN0YXRlID0gMSwgSih0LCAhMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlKHsgZG9uZTogITEgfSwgaSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgWSAmJiAoTSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgeSh0aGlzLCBNLCBqKSwgdihlKSwgci5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gcSh0aGlzKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBlKG5lKG9lLCB0KSwgbmUocmUsIHQpKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIChyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBGKHRoaXMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogaiwKICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmaWVkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgcGFyZW50OiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVhY3Rpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVqZWN0aW9uOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB2b2lkIDAKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pLnByb3RvdHlwZSA9IGQoTS5wcm90b3R5cGUsIHsKICAgICAgICAgICAgICAgICAgICB0aGVuOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IEQodGhpcyksIHIgPSBHKHgodGhpcywgTSkpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5vayA9ICdmdW5jdGlvbicgIT0gdHlwZW9mIGUgfHwgZSwgci5mYWlsID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCAmJiB0LCByLmRvbWFpbiA9IEEgPyBCLmRvbWFpbiA6IHZvaWQgMCwgbi5wYXJlbnQgPSAhMCwgbi5yZWFjdGlvbnMucHVzaChyKSwgMCAhPSBuLnN0YXRlICYmIEoobiwgITEpLCByLnByb21pc2U7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBjYXRjaDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudGhlbih2b2lkIDAsIGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pLCBvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IHIoKSwgdCA9IHEoZSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9taXNlID0gZSwgdGhpcy5yZXNvbHZlID0gbmUob2UsIHQpLCB0aGlzLnJlamVjdCA9IG5lKHJlLCB0KTsKICAgICAgICAgICAgICAgIH0sIF8uZiA9IEcgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBNIHx8IGUgPT09IGkgPyBuZXcgbyhlKSA6IEgoZSk7CiAgICAgICAgICAgICAgICB9LCBjIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIGYgfHwgKGEgPSBmLnByb3RvdHlwZS50aGVuLCBwKGYucHJvdG90eXBlLCAndGhlbicsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICBhLmNhbGwobiwgZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgfSkudGhlbihlLCB0KTsKICAgICAgICAgICAgICAgIH0sIHsgdW5zYWZlOiAhMCB9KSwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgeiAmJiBzKHsKICAgICAgICAgICAgICAgICAgICBnbG9iYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogITAKICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBmZXRjaDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGsoTSwgei5hcHBseSh1LCBhcmd1bWVudHMpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSkpLCBzKHsKICAgICAgICAgICAgICAgICAgICBnbG9iYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIHdyYXA6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogWQogICAgICAgICAgICAgICAgfSwgeyBQcm9taXNlOiBNIH0pLCBoKE0sIGosICExLCAhMCksIG0oaiksIGkgPSBsKGopLCBzKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IGosCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBZCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgcmVqZWN0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEcodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnJlamVjdC5jYWxsKHZvaWQgMCwgZSksIHQucHJvbWlzZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgcyh7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBqLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogYyB8fCBZCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGsoYyAmJiB0aGlzID09PSBpID8gTSA6IHRoaXMsIGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pLCBzKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IGosCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBRCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgYWxsOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMsIG4gPSBHKHQpLCByID0gbi5yZXNvbHZlLCBvID0gbi5yZWplY3QsIGkgPSBQKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHYodC5yZXNvbHZlKSwgaSA9IFtdLCBhID0gMCwgcyA9IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRShlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGErKywgdSA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnB1c2godm9pZCAwKSwgcysrLCBuLmNhbGwodCwgZSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSB8fCAodSA9ICEwLCBpW2NdID0gZSwgLS1zIHx8IHIoaSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgLS1zIHx8IHIoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuZXJyb3IgJiYgbyhpLnZhbHVlKSwgbi5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcmFjZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLCBuID0gRyh0KSwgciA9IG4ucmVqZWN0LCBvID0gUChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB2KHQucmVzb2x2ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRShlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLmNhbGwodCwgZSkudGhlbihuLnJlc29sdmUsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLmVycm9yICYmIHIoby52YWx1ZSksIG4ucHJvbWlzZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByLCBvLCBpLCBhLCBzLCBjLCB1LCBsLCBmID0gbig3KSwgcCA9IG4oMzYpLmYsIGQgPSBuKDEwOSkuc2V0LCBoID0gbigxMTApLCBtID0gbig3NSksIGcgPSBmLk11dGF0aW9uT2JzZXJ2ZXIgfHwgZi5XZWJLaXRNdXRhdGlvbk9ic2VydmVyLCB2ID0gZi5kb2N1bWVudCwgeSA9IGYucHJvY2VzcywgYiA9IGYuUHJvbWlzZSwgRSA9IHAoZiwgJ3F1ZXVlTWljcm90YXNrJyksIHcgPSBFICYmIEUudmFsdWU7CiAgICAgICAgICAgICAgICB3IHx8IChyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlLCB0OwogICAgICAgICAgICAgICAgICAgIGZvciAobSAmJiAoZSA9IHkuZG9tYWluKSAmJiBlLmV4aXQoKTsgbzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IG8uZm4sIG8gPSBvLm5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG8gPyBhKCkgOiBpID0gdm9pZCAwLCBuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGkgPSB2b2lkIDAsIGUgJiYgZS5lbnRlcigpOwogICAgICAgICAgICAgICAgfSwgIWggJiYgIW0gJiYgZyAmJiB2ID8gKHMgPSAhMCwgYyA9IHYuY3JlYXRlVGV4dE5vZGUoJycpLCBuZXcgZyhyKS5vYnNlcnZlKGMsIHsgY2hhcmFjdGVyRGF0YTogITAgfSksIGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYy5kYXRhID0gcyA9ICFzOwogICAgICAgICAgICAgICAgfSkgOiBiICYmIGIucmVzb2x2ZSA/ICh1ID0gYi5yZXNvbHZlKHZvaWQgMCksIGwgPSB1LnRoZW4sIGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgbC5jYWxsKHUsIHIpOwogICAgICAgICAgICAgICAgfSkgOiBhID0gbSA/IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB5Lm5leHRUaWNrKHIpOwogICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBkLmNhbGwoZiwgcik7CiAgICAgICAgICAgICAgICB9KSwgZS5leHBvcnRzID0gdyB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gewogICAgICAgICAgICAgICAgICAgICAgICBmbjogZSwKICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBpICYmIChpLm5leHQgPSB0KSwgbyB8fCAobyA9IHQsIGEoKSksIGkgPSB0OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbig3KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSByLmNvbnNvbGU7CiAgICAgICAgICAgICAgICAgICAgbiAmJiBuLmVycm9yICYmICgxID09PSBhcmd1bWVudHMubGVuZ3RoID8gbi5lcnJvcihlKSA6IG4uZXJyb3IoZSwgdCkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNCksIGkgPSBuKDEwOCksIGEgPSBuKDEyKSwgcyA9IG4oMTApLCBjID0gbigyMCksIHUgPSBuKDExMSksIGwgPSBuKDIzKTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1Byb21pc2UnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6ICEhaSAmJiBhKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaS5wcm90b3R5cGUuZmluYWxseS5jYWxsKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZW46IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGZpbmFsbHk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYyh0aGlzLCBzKCdQcm9taXNlJykpLCBuID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudGhlbihuID8gZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1KHQsIGUoKSkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGUsIG4gPyBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUodCwgZSgpKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgbyB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBpIHx8IGkucHJvdG90eXBlLmZpbmFsbHkgfHwgbChpLnByb3RvdHlwZSwgJ2ZpbmFsbHknLCBzKCdQcm9taXNlJykucHJvdG90eXBlLmZpbmFsbHkpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEwMSksIG8gPSBuKDEwMyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSByKCdTZXQnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHRoaXMsIGFyZ3VtZW50cy5sZW5ndGggPyBhcmd1bWVudHNbMF0gOiB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBvKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oMTEyKSwgaSA9IG4oMzIpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU3RyaW5nJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhbigxMTMpKCdpbmNsdWRlcycpCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgaW5jbHVkZXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIX5TdHJpbmcoaSh0aGlzKSkuaW5kZXhPZihvKGUpLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTMpLCBvID0gbigzNyksIGkgPSBuKDgpKCdtYXRjaCcpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihlKSAmJiAodm9pZCAwICE9PSAodCA9IGVbaV0pID8gISF0IDogJ1JlZ0V4cCcgPT0gbyhlKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDIwNSkuY2hhckF0LCBvID0gbigzMyksIGkgPSBuKDczKSwgYSA9IG8uc2V0LCBzID0gby5nZXR0ZXJGb3IoJ1N0cmluZyBJdGVyYXRvcicpOwogICAgICAgICAgICAgICAgaShTdHJpbmcsICdTdHJpbmcnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGEodGhpcywgewogICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnU3RyaW5nIEl0ZXJhdG9yJywKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nOiBTdHJpbmcoZSksCiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiAwCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQgPSBzKHRoaXMpLCBuID0gdC5zdHJpbmcsIG8gPSB0LmluZGV4OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBvID49IG4ubGVuZ3RoID8gewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMAogICAgICAgICAgICAgICAgICAgIH0gOiAoZSA9IHIobiwgbyksIHQuaW5kZXggKz0gZS5sZW5ndGgsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICExCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHZhciByID0gbigzOSksIG8gPSBuKDMyKSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGksIGEsIHMgPSBTdHJpbmcobyh0KSksIGMgPSByKG4pLCB1ID0gcy5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyA8IDAgfHwgYyA+PSB1ID8gZSA/ICcnIDogdm9pZCAwIDogKGkgPSBzLmNoYXJDb2RlQXQoYykpIDwgNTUyOTYgfHwgaSA+IDU2MzE5IHx8IGMgKyAxID09PSB1IHx8IChhID0gcy5jaGFyQ29kZUF0KGMgKyAxKSkgPCA1NjMyMCB8fCBhID4gNTczNDMgPyBlID8gcy5jaGFyQXQoYykgOiBpIDogZSA/IHMuc2xpY2UoYywgYyArIDIpIDogYSAtIDU2MzIwICsgKGkgLSA1NTI5NiA8PCAxMCkgKyA2NTUzNjsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gewogICAgICAgICAgICAgICAgICAgIGNvZGVBdDogaSghMSksCiAgICAgICAgICAgICAgICAgICAgY2hhckF0OiBpKCEwKQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMSkoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1N0cmluZycsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwCiAgICAgICAgICAgICAgICB9LCB7IHJlcGVhdDogbigyMDcpIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDM5KSwgbyA9IG4oMzIpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gJycucmVwZWF0IHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBTdHJpbmcobyh0aGlzKSksIG4gPSAnJywgaSA9IHIoZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGkgPCAwIHx8IGkgPT0gMSAvIDApCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoJ1dyb25nIG51bWJlciBvZiByZXBldGl0aW9ucycpOwogICAgICAgICAgICAgICAgICAgIGZvciAoOyBpID4gMDsgKGkgPj4+PSAxKSAmJiAodCArPSB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgMSAmIGkgJiYgKG4gKz0gdCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbigzNikuZiwgaSA9IG4oMjQpLCBhID0gbigxMTIpLCBzID0gbigzMiksIGMgPSBuKDExMyksIHUgPSBuKDQpLCBsID0gJycuc3RhcnRzV2l0aCwgZiA9IE1hdGgubWluLCBwID0gYygnc3RhcnRzV2l0aCcpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU3RyaW5nJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiAhKCF1ICYmICFwICYmICEhZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG8oU3RyaW5nLnByb3RvdHlwZSwgJ3N0YXJ0c1dpdGgnKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgIWUud3JpdGFibGU7CiAgICAgICAgICAgICAgICAgICAgfSgpKSAmJiAhcAogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHN0YXJ0c1dpdGg6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gU3RyaW5nKHModGhpcykpOwogICAgICAgICAgICAgICAgICAgICAgICBhKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGkoZihhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgdC5sZW5ndGgpKSwgciA9IFN0cmluZyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwgPyBsLmNhbGwodCwgciwgbikgOiB0LnNsaWNlKG4sIG4gKyByLmxlbmd0aCkgPT09IHI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDIxMCk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDc0KSwgaSA9IG4oNzIpLCBhID0gbig0MCksIHMgPSBuKDIyKSwgYyA9IG4oMzEpLCB1ID0gbig1KSwgbCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEobiBpbnN0YW5jZW9mIGwpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBsKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICBpICYmIChuID0gaShuZXcgRXJyb3Iodm9pZCAwKSwgbyhuKSkpLCB2b2lkIDAgIT09IHQgJiYgcyhuLCAnbWVzc2FnZScsIFN0cmluZyh0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1KGUsIHIucHVzaCwgeyB0aGF0OiByIH0pLCBzKG4sICdlcnJvcnMnLCByKSwgbjsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgbC5wcm90b3R5cGUgPSBhKEVycm9yLnByb3RvdHlwZSwgewogICAgICAgICAgICAgICAgICAgIGNvbnN0cnVjdG9yOiBjKDUsIGwpLAogICAgICAgICAgICAgICAgICAgIG1lc3NhZ2U6IGMoNSwgJycpLAogICAgICAgICAgICAgICAgICAgIG5hbWU6IGMoNSwgJ0FnZ3JlZ2F0ZUVycm9yJykKICAgICAgICAgICAgICAgIH0pLCByKHsgZ2xvYmFsOiAhMCB9LCB7IEFnZ3JlZ2F0ZUVycm9yOiBsIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oMTE0KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ01hcCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGRlbGV0ZUFsbDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oMyksIGEgPSBuKDkpLCBzID0gbigyMSksIGMgPSBuKDUpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnTWFwJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZXZlcnk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaSh0aGlzKSwgbiA9IHModCksIHIgPSBhKGUsIGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwLCAzKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFjKG4sIGZ1bmN0aW9uIChlLCBuLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIobiwgZSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgQVNfRU5UUklFUzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTlRFUlJVUFRFRDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSkuc3RvcHBlZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNCksIGkgPSBuKDEwKSwgYSA9IG4oMyksIHMgPSBuKDYpLCBjID0gbig5KSwgdSA9IG4oMjApLCBsID0gbigyMSksIGYgPSBuKDUpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnTWFwJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZmlsdGVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEodGhpcyksIG4gPSBsKHQpLCByID0gYyhlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyksIG8gPSBuZXcgKHUodCwgaSgnTWFwJykpKSgpLCBwID0gcyhvLnNldCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmKG4sIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByKG4sIGUsIHQpICYmIHAuY2FsbChvLCBlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgQVNfRU5UUklFUzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG87CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDQpLCBpID0gbigzKSwgYSA9IG4oOSksIHMgPSBuKDIxKSwgYyA9IG4oNSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBmaW5kOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkodGhpcyksIG4gPSBzKHQpLCByID0gYShlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjKG4sIGZ1bmN0aW9uIChlLCBuLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocihuLCBlLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgQVNfRU5UUklFUzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTlRFUlJVUFRFRDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSkucmVzdWx0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oMyksIGEgPSBuKDkpLCBzID0gbigyMSksIGMgPSBuKDUpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnTWFwJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZmluZEtleTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpKHRoaXMpLCBuID0gcyh0KSwgciA9IGEoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyhuLCBmdW5jdGlvbiAoZSwgbiwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIobiwgZSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSU5URVJSVVBURUQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlc3VsdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMSkoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ01hcCcsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAKICAgICAgICAgICAgICAgIH0sIHsgZnJvbTogbigxMTUpIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig1KSwgaSA9IG4oNik7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZ3JvdXBCeTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBuZXcgdGhpcygpOwogICAgICAgICAgICAgICAgICAgICAgICBpKHQpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGkobi5oYXMpLCBhID0gaShuLmdldCksIHMgPSBpKG4uc2V0KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbChuLCBvKSA/IGEuY2FsbChuLCBvKS5wdXNoKGUpIDogcy5jYWxsKG4sIG8sIFtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oMyksIGEgPSBuKDIxKSwgcyA9IG4oMjE5KSwgYyA9IG4oNSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBpbmNsdWRlczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoYShpKHRoaXMpKSwgZnVuY3Rpb24gKHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzKG4sIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSU5URVJSVVBURUQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnN0b3BwZWQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSB0IHx8IGUgIT0gZSAmJiB0ICE9IHQ7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig1KSwgaSA9IG4oNik7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAga2V5Qnk6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gbmV3IHRoaXMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBpKG4uc2V0KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbChuLCB0KGUpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDQpLCBpID0gbigzKSwgYSA9IG4oMjEpLCBzID0gbig1KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ01hcCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGtleU9mOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyhhKGkodGhpcykpLCBmdW5jdGlvbiAodCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSU5URVJSVVBURUQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlc3VsdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNCksIGkgPSBuKDEwKSwgYSA9IG4oMyksIHMgPSBuKDYpLCBjID0gbig5KSwgdSA9IG4oMjApLCBsID0gbigyMSksIGYgPSBuKDUpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnTWFwJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgbWFwS2V5czogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhKHRoaXMpLCBuID0gbCh0KSwgciA9IGMoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpLCBvID0gbmV3ICh1KHQsIGkoJ01hcCcpKSkoKSwgcCA9IHMoby5zZXQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZihuLCBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcC5jYWxsKG8sIHIobiwgZSwgdCksIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBBU19FTlRSSUVTOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElTX0lURVJBVE9SOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgbzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNCksIGkgPSBuKDEwKSwgYSA9IG4oMyksIHMgPSBuKDYpLCBjID0gbig5KSwgdSA9IG4oMjApLCBsID0gbigyMSksIGYgPSBuKDUpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnTWFwJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgbWFwVmFsdWVzOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEodGhpcyksIG4gPSBsKHQpLCByID0gYyhlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyksIG8gPSBuZXcgKHUodCwgaSgnTWFwJykpKSgpLCBwID0gcyhvLnNldCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmKG4sIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwLmNhbGwobywgZSwgcihuLCBlLCB0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTX0VOVFJJRVM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oMyksIGEgPSBuKDYpLCBzID0gbig1KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ01hcCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIG1lcmdlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gaSh0aGlzKSwgbiA9IGEodC5zZXQpLCByID0gMDsgciA8IGFyZ3VtZW50cy5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcyhhcmd1bWVudHNbcisrXSwgbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoYXQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVNfRU5UUklFUzogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMSkoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ01hcCcsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAKICAgICAgICAgICAgICAgIH0sIHsgb2Y6IG4oMTE2KSB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNCksIGkgPSBuKDMpLCBhID0gbig2KSwgcyA9IG4oMjEpLCBjID0gbig1KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ01hcCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHJlZHVjZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpKHRoaXMpLCBuID0gcyh0KSwgciA9IGFyZ3VtZW50cy5sZW5ndGggPCAyLCBvID0gciA/IHZvaWQgMCA6IGFyZ3VtZW50c1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEoZSksIGMobiwgZnVuY3Rpb24gKG4sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID8gKHIgPSAhMSwgbyA9IGkpIDogbyA9IGUobywgaSwgbiwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVNfRU5UUklFUzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignUmVkdWNlIG9mIGVtcHR5IG1hcCB3aXRoIG5vIGluaXRpYWwgdmFsdWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDQpLCBpID0gbigzKSwgYSA9IG4oOSksIHMgPSBuKDIxKSwgYyA9IG4oNSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdNYXAnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBzb21lOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkodGhpcyksIG4gPSBzKHQpLCByID0gYShlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjKG4sIGZ1bmN0aW9uIChlLCBuLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocihuLCBlLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbygpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBBU19FTlRSSUVTOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElTX0lURVJBVE9SOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElOVEVSUlVQVEVEOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KS5zdG9wcGVkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oMyksIGEgPSBuKDYpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnTWFwJywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgdXBkYXRlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGkodGhpcyksIHIgPSBhcmd1bWVudHMubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICBhKHQpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG4uaGFzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8gJiYgciA8IDMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBUeXBlRXJyb3IoJ1VwZGF0aW5nIGFic2VudCB2YWx1ZScpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG8gPyBuLmdldChlKSA6IGEociA+IDIgPyBhcmd1bWVudHNbMl0gOiB2b2lkIDApKGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5zZXQoZSwgdChzLCBlLCBuKSksIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDIzMCk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDYpLCBpID0gbig0MiksIGEgPSBuKDUxKSwgcyA9IG4oNSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdQcm9taXNlJywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMAogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGFsbFNldHRsZWQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcywgbiA9IGkuZih0KSwgciA9IG4ucmVzb2x2ZSwgYyA9IG4ucmVqZWN0LCB1ID0gYShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBvKHQucmVzb2x2ZSksIGkgPSBbXSwgYSA9IDAsIGMgPSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBhKyssIHMgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5wdXNoKHZvaWQgMCksIGMrKywgbi5jYWxsKHQsIGUpLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgfHwgKHMgPSAhMCwgaVtvXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXM6ICdmdWxmaWxsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAtLWMgfHwgcihpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzIHx8IChzID0gITAsIGlbb10gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiAncmVqZWN0ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYXNvbjogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgLS1jIHx8IHIoaSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgLS1jIHx8IHIoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUuZXJyb3IgJiYgYyh1LnZhbHVlKSwgbi5wcm9taXNlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigyMzIpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig2KSwgaSA9IG4oMTApLCBhID0gbig0MiksIHMgPSBuKDUxKSwgYyA9IG4oNSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdQcm9taXNlJywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMAogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGFueTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLCBuID0gYS5mKHQpLCByID0gbi5yZXNvbHZlLCB1ID0gbi5yZWplY3QsIGwgPSBzKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG8odC5yZXNvbHZlKSwgYSA9IFtdLCBzID0gMCwgbCA9IDEsIGYgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjKGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gcysrLCBjID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucHVzaCh2b2lkIDApLCBsKyssIG4uY2FsbCh0LCBlKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjIHx8IGYgfHwgKGYgPSAhMCwgcihlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjIHx8IGYgfHwgKGMgPSAhMCwgYVtvXSA9IGUsIC0tbCB8fCB1KG5ldyAoaSgnQWdncmVnYXRlRXJyb3InKSkoYSwgJ05vIG9uZSBwcm9taXNlIHJlc29sdmVkJykpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIC0tbCB8fCB1KG5ldyAoaSgnQWdncmVnYXRlRXJyb3InKSkoYSwgJ05vIG9uZSBwcm9taXNlIHJlc29sdmVkJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsLmVycm9yICYmIHUobC52YWx1ZSksIG4ucHJvbWlzZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNDIpLCBpID0gbig1MSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdQcm9taXNlJywKICAgICAgICAgICAgICAgICAgICBzdGF0OiAhMAogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHRyeTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBvLmYodGhpcyksIG4gPSBpKGUpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG4uZXJyb3IgPyB0LnJlamVjdCA6IHQucmVzb2x2ZSkobi52YWx1ZSksIHQucHJvbWlzZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNCksIGkgPSBuKDIzNSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBhZGRBbGw6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigzKSwgbyA9IG4oNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHIodGhpcyksIHQgPSBvKGUuYWRkKSwgbiA9IDAsIGkgPSBhcmd1bWVudHMubGVuZ3RoOyBuIDwgaTsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICB0LmNhbGwoZSwgYXJndW1lbnRzW25dKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDQpLCBpID0gbigxMTQpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlQWxsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDQpLCBpID0gbigxMCksIGEgPSBuKDMpLCBzID0gbig2KSwgYyA9IG4oMjApLCB1ID0gbig1KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGRpZmZlcmVuY2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYSh0aGlzKSwgbiA9IG5ldyAoYyh0LCBpKCdTZXQnKSkpKHQpLCByID0gcyhuLmRlbGV0ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1KGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmNhbGwobiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oMyksIGEgPSBuKDkpLCBzID0gbigyOCksIGMgPSBuKDUpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZXZlcnk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaSh0aGlzKSwgbiA9IHModCksIHIgPSBhKGUsIGFyZ3VtZW50cy5sZW5ndGggPiAxID8gYXJndW1lbnRzWzFdIDogdm9pZCAwLCAzKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFjKG4sIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIoZSwgZSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSU5URVJSVVBURUQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnN0b3BwZWQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDQpLCBpID0gbigxMCksIGEgPSBuKDMpLCBzID0gbig2KSwgYyA9IG4oOSksIHUgPSBuKDIwKSwgbCA9IG4oMjgpLCBmID0gbig1KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGZpbHRlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhKHRoaXMpLCBuID0gbCh0KSwgciA9IGMoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpLCBvID0gbmV3ICh1KHQsIGkoJ1NldCcpKSkoKSwgcCA9IHMoby5hZGQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZihuLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcihlLCBlLCB0KSAmJiBwLmNhbGwobywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsgSVNfSVRFUkFUT1I6ICEwIH0pLCBvOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oMyksIGEgPSBuKDkpLCBzID0gbigyOCksIGMgPSBuKDUpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgZmluZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpKHRoaXMpLCBuID0gcyh0KSwgciA9IGEoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyhuLCBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIoZSwgZSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElTX0lURVJBVE9SOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIElOVEVSUlVQVEVEOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KS5yZXN1bHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDEpKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHN0YXQ6ICEwCiAgICAgICAgICAgICAgICB9LCB7IGZyb206IG4oMTE1KSB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNCksIGkgPSBuKDEwKSwgYSA9IG4oMyksIHMgPSBuKDYpLCBjID0gbigyMCksIHUgPSBuKDUpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgaW50ZXJzZWN0aW9uOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEodGhpcyksIG4gPSBuZXcgKGModCwgaSgnU2V0JykpKSgpLCByID0gcyh0LmhhcyksIG8gPSBzKG4uYWRkKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbCh0LCBlKSAmJiBvLmNhbGwobiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oMyksIGEgPSBuKDYpLCBzID0gbig1KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGlzRGlzam9pbnRGcm9tOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkodGhpcyksIG4gPSBhKHQuaGFzKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFzKGUsIGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoITAgPT09IG4uY2FsbCh0LCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcigpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7IElOVEVSUlVQVEVEOiAhMCB9KS5zdG9wcGVkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEpLCBvID0gbig0KSwgaSA9IG4oMTApLCBhID0gbigzKSwgcyA9IG4oNiksIGMgPSBuKDc2KSwgdSA9IG4oNSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBpc1N1YnNldE9mOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGModGhpcyksIG4gPSBhKGUpLCByID0gbi5oYXM7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nICE9IHR5cGVvZiByICYmIChuID0gbmV3IChpKCdTZXQnKSkoZSksIHIgPSBzKG4uaGFzKSksICF1KHQsIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoITEgPT09IHIuY2FsbChuLCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTlRFUlJVUFRFRDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSkuc3RvcHBlZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNCksIGkgPSBuKDMpLCBhID0gbig2KSwgcyA9IG4oNSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBpc1N1cGVyc2V0T2Y6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaSh0aGlzKSwgbiA9IGEodC5oYXMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXMoZSwgZnVuY3Rpb24gKGUsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghMSA9PT0gbi5jYWxsKHQsIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHsgSU5URVJSVVBURUQ6ICEwIH0pLnN0b3BwZWQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDQpLCBpID0gbigzKSwgYSA9IG4oMjgpLCBzID0gbig1KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIGpvaW46IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaSh0aGlzKSwgbiA9IGEodCksIHIgPSB2b2lkIDAgPT09IGUgPyAnLCcgOiBTdHJpbmcoZSksIG8gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMobiwgby5wdXNoLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGF0OiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgSVNfSVRFUkFUT1I6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvLmpvaW4ocik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDQpLCBpID0gbigxMCksIGEgPSBuKDMpLCBzID0gbig2KSwgYyA9IG4oOSksIHUgPSBuKDIwKSwgbCA9IG4oMjgpLCBmID0gbig1KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIG1hcDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhKHRoaXMpLCBuID0gbCh0KSwgciA9IGMoZSwgYXJndW1lbnRzLmxlbmd0aCA+IDEgPyBhcmd1bWVudHNbMV0gOiB2b2lkIDAsIDMpLCBvID0gbmV3ICh1KHQsIGkoJ1NldCcpKSkoKSwgcCA9IHMoby5hZGQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZihuLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcC5jYWxsKG8sIHIoZSwgZSwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7IElTX0lURVJBVE9SOiAhMCB9KSwgbzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMSkoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgc3RhdDogITAKICAgICAgICAgICAgICAgIH0sIHsgb2Y6IG4oMTE2KSB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNCksIGkgPSBuKDMpLCBhID0gbig2KSwgcyA9IG4oMjgpLCBjID0gbig1KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHJlZHVjZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpKHRoaXMpLCBuID0gcyh0KSwgciA9IGFyZ3VtZW50cy5sZW5ndGggPCAyLCBvID0gciA/IHZvaWQgMCA6IGFyZ3VtZW50c1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEoZSksIGMobiwgZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID8gKHIgPSAhMSwgbyA9IG4pIDogbyA9IGUobywgbiwgbiwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7IElTX0lURVJBVE9SOiAhMCB9KSwgcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IFR5cGVFcnJvcignUmVkdWNlIG9mIGVtcHR5IHNldCB3aXRoIG5vIGluaXRpYWwgdmFsdWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDQpLCBpID0gbigzKSwgYSA9IG4oOSksIHMgPSBuKDI4KSwgYyA9IG4oNSk7CiAgICAgICAgICAgICAgICByKHsKICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdTZXQnLAogICAgICAgICAgICAgICAgICAgIHByb3RvOiAhMCwKICAgICAgICAgICAgICAgICAgICByZWFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb3JjZWQ6IG8KICAgICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgICAgICBzb21lOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGkodGhpcyksIG4gPSBzKHQpLCByID0gYShlLCBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGFyZ3VtZW50c1sxXSA6IHZvaWQgMCwgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjKG4sIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocihlLCBlLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbigpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJU19JVEVSQVRPUjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTlRFUlJVUFRFRDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSkuc3RvcHBlZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxKSwgbyA9IG4oNCksIGkgPSBuKDEwKSwgYSA9IG4oMyksIHMgPSBuKDYpLCBjID0gbigyMCksIHUgPSBuKDUpOwogICAgICAgICAgICAgICAgcih7CiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnU2V0JywKICAgICAgICAgICAgICAgICAgICBwcm90bzogITAsCiAgICAgICAgICAgICAgICAgICAgcmVhbDogITAsCiAgICAgICAgICAgICAgICAgICAgZm9yY2VkOiBvCiAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgc3ltbWV0cmljRGlmZmVyZW5jZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhKHRoaXMpLCBuID0gbmV3IChjKHQsIGkoJ1NldCcpKSkodCksIHIgPSBzKG4uZGVsZXRlKSwgbyA9IHMobi5hZGQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdShlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgci5jYWxsKG4sIGUpIHx8IG8uY2FsbChuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMSksIG8gPSBuKDQpLCBpID0gbigxMCksIGEgPSBuKDMpLCBzID0gbig2KSwgYyA9IG4oMjApLCB1ID0gbig1KTsKICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ1NldCcsCiAgICAgICAgICAgICAgICAgICAgcHJvdG86ICEwLAogICAgICAgICAgICAgICAgICAgIHJlYWw6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcmNlZDogbwogICAgICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgICAgIHVuaW9uOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEodGhpcyksIG4gPSBuZXcgKGModCwgaSgnU2V0JykpKSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUoZSwgcyhuLmFkZCksIHsgdGhhdDogbiB9KSwgbjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIG4oMTEpKCdkaXNwb3NlJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICBuKDExKSgnb2JzZXJ2YWJsZScpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgbigxMSkoJ3BhdHRlcm5NYXRjaCcpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDcpLCBvID0gbigyNTcpLCBpID0gbigyNTgpLCBhID0gbigyMiksIHMgPSBuKDgpLCBjID0gcygnaXRlcmF0b3InKSwgdSA9IHMoJ3RvU3RyaW5nVGFnJyksIGwgPSBpLnZhbHVlczsKICAgICAgICAgICAgICAgIGZvciAodmFyIGYgaW4gbykgewogICAgICAgICAgICAgICAgICAgIHZhciBwID0gcltmXSwgZCA9IHAgJiYgcC5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICAgICAgaWYgKGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRbY10gIT09IGwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoZCwgYywgbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFtjXSA9IGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkW3VdIHx8IGEoZCwgdSwgZiksIG9bZl0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBoIGluIGkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRbaF0gIT09IGlbaF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKGQsIGgsIGlbaF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW2hdID0gaVtoXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHsKICAgICAgICAgICAgICAgICAgICBDU1NSdWxlTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBDU1NTdHlsZURlY2xhcmF0aW9uOiAwLAogICAgICAgICAgICAgICAgICAgIENTU1ZhbHVlTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBDbGllbnRSZWN0TGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBET01SZWN0TGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBET01TdHJpbmdMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIERPTVRva2VuTGlzdDogMSwKICAgICAgICAgICAgICAgICAgICBEYXRhVHJhbnNmZXJJdGVtTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBGaWxlTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBIVE1MQWxsQ29sbGVjdGlvbjogMCwKICAgICAgICAgICAgICAgICAgICBIVE1MQ29sbGVjdGlvbjogMCwKICAgICAgICAgICAgICAgICAgICBIVE1MRm9ybUVsZW1lbnQ6IDAsCiAgICAgICAgICAgICAgICAgICAgSFRNTFNlbGVjdEVsZW1lbnQ6IDAsCiAgICAgICAgICAgICAgICAgICAgTWVkaWFMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIE1pbWVUeXBlQXJyYXk6IDAsCiAgICAgICAgICAgICAgICAgICAgTmFtZWROb2RlTWFwOiAwLAogICAgICAgICAgICAgICAgICAgIE5vZGVMaXN0OiAxLAogICAgICAgICAgICAgICAgICAgIFBhaW50UmVxdWVzdExpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgUGx1Z2luOiAwLAogICAgICAgICAgICAgICAgICAgIFBsdWdpbkFycmF5OiAwLAogICAgICAgICAgICAgICAgICAgIFNWR0xlbmd0aExpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgU1ZHTnVtYmVyTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBTVkdQYXRoU2VnTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBTVkdQb2ludExpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgU1ZHU3RyaW5nTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBTVkdUcmFuc2Zvcm1MaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIFNvdXJjZUJ1ZmZlckxpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgU3R5bGVTaGVldExpc3Q6IDAsCiAgICAgICAgICAgICAgICAgICAgVGV4dFRyYWNrQ3VlTGlzdDogMCwKICAgICAgICAgICAgICAgICAgICBUZXh0VHJhY2tMaXN0OiAwLAogICAgICAgICAgICAgICAgICAgIFRvdWNoTGlzdDogMAogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNSksIG8gPSBuKDUwKSwgaSA9IG4oNDEpLCBhID0gbigzMyksIHMgPSBuKDczKSwgYyA9IGEuc2V0LCB1ID0gYS5nZXR0ZXJGb3IoJ0FycmF5IEl0ZXJhdG9yJyk7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBzKEFycmF5LCAnQXJyYXknLCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGModGhpcywgewogICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnQXJyYXkgSXRlcmF0b3InLAogICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6IHIoZSksCiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiAwLAogICAgICAgICAgICAgICAgICAgICAgICBraW5kOiB0CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB1KHRoaXMpLCB0ID0gZS50YXJnZXQsIG4gPSBlLmtpbmQsIHIgPSBlLmluZGV4Kys7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF0IHx8IHIgPj0gdC5sZW5ndGggPyAoZS50YXJnZXQgPSB2b2lkIDAsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITAKICAgICAgICAgICAgICAgICAgICB9KSA6ICdrZXlzJyA9PSBuID8gewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICB9IDogJ3ZhbHVlcycgPT0gbiA/IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHRbcl0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICExCiAgICAgICAgICAgICAgICAgICAgfSA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W3JdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICExCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sICd2YWx1ZXMnKSwgaS5Bcmd1bWVudHMgPSBpLkFycmF5LCBvKCdrZXlzJyksIG8oJ3ZhbHVlcycpLCBvKCdlbnRyaWVzJyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICB2YXIgciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0LnByb3RvdHlwZSwgbiA9IHQuaGFzT3duUHJvcGVydHksIHIgPSAnZnVuY3Rpb24nID09PSB0eXBlb2YgU3ltYm9sID8gU3ltYm9sIDoge30sIG8gPSByLml0ZXJhdG9yIHx8ICdAQGl0ZXJhdG9yJywgaSA9IHIuYXN5bmNJdGVyYXRvciB8fCAnQEBhc3luY0l0ZXJhdG9yJywgYSA9IHIudG9TdHJpbmdUYWcgfHwgJ0BAdG9TdHJpbmdUYWcnOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlW3RdOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBzKHt9LCAnJyk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVCkgewogICAgICAgICAgICAgICAgICAgICAgICBzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3RdID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdCAmJiB0LnByb3RvdHlwZSBpbnN0YW5jZW9mIGYgPyB0IDogZiwgaSA9IE9iamVjdC5jcmVhdGUoby5wcm90b3R5cGUpLCBhID0gbmV3IFMociB8fCBbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLl9pbnZva2UgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAnc3VzcGVuZGVkU3RhcnQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChvLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdleGVjdXRpbmcnID09PSByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0dlbmVyYXRvciBpcyBhbHJlYWR5IHJ1bm5pbmcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2NvbXBsZXRlZCcgPT09IHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd0aHJvdycgPT09IG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4ubWV0aG9kID0gbywgbi5hcmcgPSBpOzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuLmRlbGVnYXRlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBFKGEsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocyA9PT0gbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCduZXh0JyA9PT0gbi5tZXRob2QpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnNlbnQgPSBuLl9zZW50ID0gbi5hcmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCd0aHJvdycgPT09IG4ubWV0aG9kKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N1c3BlbmRlZFN0YXJ0JyA9PT0gcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyByID0gJ2NvbXBsZXRlZCcsIG4uYXJnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5kaXNwYXRjaEV4Y2VwdGlvbihuLmFyZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3JldHVybicgPT09IG4ubWV0aG9kICYmIG4uYWJydXB0KCdyZXR1cm4nLCBuLmFyZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSAnZXhlY3V0aW5nJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB1KGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ25vcm1hbCcgPT09IGMudHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPSBuLmRvbmUgPyAnY29tcGxldGVkJyA6ICdzdXNwZW5kZWRZaWVsZCcsIGMuYXJnID09PSBsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogYy5hcmcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogbi5kb25lCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0aHJvdycgPT09IGMudHlwZSAmJiAociA9ICdjb21wbGV0ZWQnLCBuLm1ldGhvZCA9ICd0aHJvdycsIG4uYXJnID0gYy5hcmcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZSwgbiwgYSksIGk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbm9ybWFsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmc6IGUuY2FsbCh0LCBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndGhyb3cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZzogVAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBlLndyYXAgPSBjOwogICAgICAgICAgICAgICAgICAgIHZhciBsID0ge307CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZigpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcCgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZCgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGggPSB7fTsKICAgICAgICAgICAgICAgICAgICBoW29dID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHZhciBtID0gT2JqZWN0LmdldFByb3RvdHlwZU9mLCBnID0gbSAmJiBtKG0oQyhbXSkpKTsKICAgICAgICAgICAgICAgICAgICBnICYmIGcgIT09IHQgJiYgbi5jYWxsKGcsIG8pICYmIChoID0gZyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSBkLnByb3RvdHlwZSA9IGYucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShoKTsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ25leHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Rocm93JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdyZXR1cm4nCiAgICAgICAgICAgICAgICAgICAgICAgIF0uZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcyhlLCB0LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9pbnZva2UodCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5faW52b2tlID0gZnVuY3Rpb24gKG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB0KGZ1bmN0aW9uIChyLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiByKG8sIGksIGEsIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gdShlW29dLCBlLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndGhyb3cnICE9PSBjLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGMuYXJnLCBmID0gbC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZiAmJiAnb2JqZWN0JyA9PT0gdHlwZW9mIGYgJiYgbi5jYWxsKGYsICdfX2F3YWl0JykgPyB0LnJlc29sdmUoZi5fX2F3YWl0KS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoJ25leHQnLCBlLCBhLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKCd0aHJvdycsIGUsIGEsIHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogdC5yZXNvbHZlKGYpLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbC52YWx1ZSA9IGUsIGEobCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoJ3Rocm93JywgZSwgYSwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzKGMuYXJnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShvLCBpLCByLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByID0gciA/IHIudGhlbihhLCBhKSA6IGEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gRShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5pdGVyYXRvclt0Lm1ldGhvZF07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmRlbGVnYXRlID0gbnVsbCwgJ3Rocm93JyA9PT0gdC5tZXRob2QpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5pdGVyYXRvci5yZXR1cm4gJiYgKHQubWV0aG9kID0gJ3JldHVybicsIHQuYXJnID0gdm9pZCAwLCBFKGUsIHQpLCAndGhyb3cnID09PSB0Lm1ldGhvZCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubWV0aG9kID0gJ3Rocm93JywgdC5hcmcgPSBuZXcgVHlwZUVycm9yKCdUaGUgaXRlcmF0b3IgZG9lcyBub3QgcHJvdmlkZSBhIFwndGhyb3dcJyBtZXRob2QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdShuLCBlLml0ZXJhdG9yLCB0LmFyZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndGhyb3cnID09PSByLnR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5tZXRob2QgPSAndGhyb3cnLCB0LmFyZyA9IHIuYXJnLCB0LmRlbGVnYXRlID0gbnVsbCwgbDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByLmFyZzsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gPyBvLmRvbmUgPyAodFtlLnJlc3VsdE5hbWVdID0gby52YWx1ZSwgdC5uZXh0ID0gZS5uZXh0TG9jLCAncmV0dXJuJyAhPT0gdC5tZXRob2QgJiYgKHQubWV0aG9kID0gJ25leHQnLCB0LmFyZyA9IHZvaWQgMCksIHQuZGVsZWdhdGUgPSBudWxsLCBsKSA6IG8gOiAodC5tZXRob2QgPSAndGhyb3cnLCB0LmFyZyA9IG5ldyBUeXBlRXJyb3IoJ2l0ZXJhdG9yIHJlc3VsdCBpcyBub3QgYW4gb2JqZWN0JyksIHQuZGVsZWdhdGUgPSBudWxsLCBsKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0geyB0cnlMb2M6IGVbMF0gfTsKICAgICAgICAgICAgICAgICAgICAgICAgMSBpbiBlICYmICh0LmNhdGNoTG9jID0gZVsxXSksIDIgaW4gZSAmJiAodC5maW5hbGx5TG9jID0gZVsyXSwgdC5hZnRlckxvYyA9IGVbM10pLCB0aGlzLnRyeUVudHJpZXMucHVzaCh0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24geChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jb21wbGV0aW9uIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB0LnR5cGUgPSAnbm9ybWFsJywgZGVsZXRlIHQuYXJnLCBlLmNvbXBsZXRpb24gPSB0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBTKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy50cnlFbnRyaWVzID0gW3sgdHJ5TG9jOiAncm9vdCcgfV0sIGUuZm9yRWFjaCh3LCB0aGlzKSwgdGhpcy5yZXNldCghMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW29dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09PSB0eXBlb2YgZS5uZXh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpc05hTihlLmxlbmd0aCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IC0xLCBpID0gZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyArK3IgPCBlLmxlbmd0aDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4uY2FsbChlLCByKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudmFsdWUgPSBlW3JdLCB0LmRvbmUgPSAhMSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnZhbHVlID0gdm9pZCAwLCB0LmRvbmUgPSAhMCwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5uZXh0ID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geyBuZXh0OiBrIH07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGsoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAucHJvdG90eXBlID0gdi5jb25zdHJ1Y3RvciA9IGQsIGQuY29uc3RydWN0b3IgPSBwLCBwLmRpc3BsYXlOYW1lID0gcyhkLCBhLCAnR2VuZXJhdG9yRnVuY3Rpb24nKSwgZS5pc0dlbmVyYXRvckZ1bmN0aW9uID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAnZnVuY3Rpb24nID09PSB0eXBlb2YgZSAmJiBlLmNvbnN0cnVjdG9yOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF0ICYmICh0ID09PSBwIHx8ICdHZW5lcmF0b3JGdW5jdGlvbicgPT09ICh0LmRpc3BsYXlOYW1lIHx8IHQubmFtZSkpOwogICAgICAgICAgICAgICAgICAgIH0sIGUubWFyayA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Quc2V0UHJvdG90eXBlT2YgPyBPYmplY3Quc2V0UHJvdG90eXBlT2YoZSwgZCkgOiAoZS5fX3Byb3RvX18gPSBkLCBzKGUsIGEsICdHZW5lcmF0b3JGdW5jdGlvbicpKSwgZS5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKHYpLCBlOwogICAgICAgICAgICAgICAgICAgIH0sIGUuYXdyYXAgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geyBfX2F3YWl0OiBlIH07CiAgICAgICAgICAgICAgICAgICAgfSwgeShiLnByb3RvdHlwZSksIGIucHJvdG90eXBlW2ldID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9LCBlLkFzeW5jSXRlcmF0b3IgPSBiLCBlLmFzeW5jID0gZnVuY3Rpb24gKHQsIG4sIHIsIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBpICYmIChpID0gUHJvbWlzZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IGIoYyh0LCBuLCByLCBvKSwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmlzR2VuZXJhdG9yRnVuY3Rpb24obikgPyBhIDogYS5uZXh0KCkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZG9uZSA/IGUudmFsdWUgOiBhLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgeSh2KSwgcyh2LCBhLCAnR2VuZXJhdG9yJyksIHZbb10gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgIH0sIHYudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnW29iamVjdCBHZW5lcmF0b3JdJzsKICAgICAgICAgICAgICAgICAgICB9LCBlLmtleXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2gobik7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnJldmVyc2UoKSwgZnVuY3Rpb24gbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyB0Lmxlbmd0aDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQucG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4udmFsdWUgPSByLCBuLmRvbmUgPSAhMSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmRvbmUgPSAhMCwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBlLnZhbHVlcyA9IEMsIFMucHJvdG90eXBlID0gewogICAgICAgICAgICAgICAgICAgICAgICBjb25zdHJ1Y3RvcjogUywKICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5wcmV2ID0gMCwgdGhpcy5uZXh0ID0gMCwgdGhpcy5zZW50ID0gdGhpcy5fc2VudCA9IHZvaWQgMCwgdGhpcy5kb25lID0gITEsIHRoaXMuZGVsZWdhdGUgPSBudWxsLCB0aGlzLm1ldGhvZCA9ICduZXh0JywgdGhpcy5hcmcgPSB2b2lkIDAsIHRoaXMudHJ5RW50cmllcy5mb3JFYWNoKHgpLCAhZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0IGluIHRoaXMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0JyA9PT0gdC5jaGFyQXQoMCkgJiYgbi5jYWxsKHRoaXMsIHQpICYmICFpc05hTigrdC5zbGljZSgxKSkgJiYgKHRoaXNbdF0gPSB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzdG9wOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRvbmUgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy50cnlFbnRyaWVzWzBdLmNvbXBsZXRpb247CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3Rocm93JyA9PT0gZS50eXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGUuYXJnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucnZhbDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2hFeGNlcHRpb246IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5kb25lKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS50eXBlID0gJ3Rocm93JywgYS5hcmcgPSBlLCB0Lm5leHQgPSBuLCByICYmICh0Lm1ldGhvZCA9ICduZXh0JywgdC5hcmcgPSB2b2lkIDApLCAhIXI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gdGhpcy50cnlFbnRyaWVzLmxlbmd0aCAtIDE7IG8gPj0gMDsgLS1vKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0aGlzLnRyeUVudHJpZXNbb10sIGEgPSBpLmNvbXBsZXRpb247CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdyb290JyA9PT0gaS50cnlMb2MpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKCdlbmQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaS50cnlMb2MgPD0gdGhpcy5wcmV2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gbi5jYWxsKGksICdjYXRjaExvYycpLCBjID0gbi5jYWxsKGksICdmaW5hbGx5TG9jJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzICYmIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBpLmNhdGNoTG9jKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGkuY2F0Y2hMb2MsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBpLmZpbmFsbHlMb2MpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoaS5maW5hbGx5TG9jKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgaS5jYXRjaExvYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihpLmNhdGNoTG9jLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd0cnkgc3RhdGVtZW50IHdpdGhvdXQgY2F0Y2ggb3IgZmluYWxseScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGkuZmluYWxseUxvYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihpLmZpbmFsbHlMb2MpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBhYnJ1cHQ6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gdGhpcy50cnlFbnRyaWVzLmxlbmd0aCAtIDE7IHIgPj0gMDsgLS1yKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0aGlzLnRyeUVudHJpZXNbcl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8udHJ5TG9jIDw9IHRoaXMucHJldiAmJiBuLmNhbGwobywgJ2ZpbmFsbHlMb2MnKSAmJiB0aGlzLnByZXYgPCBvLmZpbmFsbHlMb2MpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpICYmICgnYnJlYWsnID09PSBlIHx8ICdjb250aW51ZScgPT09IGUpICYmIGkudHJ5TG9jIDw9IHQgJiYgdCA8PSBpLmZpbmFsbHlMb2MgJiYgKGkgPSBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gaSA/IGkuY29tcGxldGlvbiA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEudHlwZSA9IGUsIGEuYXJnID0gdCwgaSA/ICh0aGlzLm1ldGhvZCA9ICduZXh0JywgdGhpcy5uZXh0ID0gaS5maW5hbGx5TG9jLCBsKSA6IHRoaXMuY29tcGxldGUoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBsZXRlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd0aHJvdycgPT09IGUudHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBlLmFyZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnYnJlYWsnID09PSBlLnR5cGUgfHwgJ2NvbnRpbnVlJyA9PT0gZS50eXBlID8gdGhpcy5uZXh0ID0gZS5hcmcgOiAncmV0dXJuJyA9PT0gZS50eXBlID8gKHRoaXMucnZhbCA9IHRoaXMuYXJnID0gZS5hcmcsIHRoaXMubWV0aG9kID0gJ3JldHVybicsIHRoaXMubmV4dCA9ICdlbmQnKSA6ICdub3JtYWwnID09PSBlLnR5cGUgJiYgdCAmJiAodGhpcy5uZXh0ID0gdCksIGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGZpbmlzaDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSB0aGlzLnRyeUVudHJpZXMubGVuZ3RoIC0gMTsgdCA+PSAwOyAtLXQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMudHJ5RW50cmllc1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5maW5hbGx5TG9jID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wbGV0ZShuLmNvbXBsZXRpb24sIG4uYWZ0ZXJMb2MpLCB4KG4pLCBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBjYXRjaDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSB0aGlzLnRyeUVudHJpZXMubGVuZ3RoIC0gMTsgdCA+PSAwOyAtLXQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMudHJ5RW50cmllc1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi50cnlMb2MgPT09IGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLmNvbXBsZXRpb247CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndGhyb3cnID09PSByLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gci5hcmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignaWxsZWdhbCBjYXRjaCBhdHRlbXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGVnYXRlWWllbGQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5kZWxlZ2F0ZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVyYXRvcjogQyhlKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHROYW1lOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHRMb2M6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICduZXh0JyA9PT0gdGhpcy5tZXRob2QgJiYgKHRoaXMuYXJnID0gdm9pZCAwKSwgbDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9KGUuZXhwb3J0cyk7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIHJlZ2VuZXJhdG9yUnVudGltZSA9IHI7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChvKSB7CiAgICAgICAgICAgICAgICAgICAgRnVuY3Rpb24oJ3InLCAncmVnZW5lcmF0b3JSdW50aW1lID0gcicpKHIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDExNyksIG8gPSAnZnVuY3Rpb24nID09PSB0eXBlb2YgU3ltYm9sICYmIFN5bWJvbC5mb3IsIGkgPSBvID8gU3ltYm9sLmZvcigncmVhY3QuZWxlbWVudCcpIDogNjAxMDMsIGEgPSBvID8gU3ltYm9sLmZvcigncmVhY3QucG9ydGFsJykgOiA2MDEwNiwgcyA9IG8gPyBTeW1ib2wuZm9yKCdyZWFjdC5mcmFnbWVudCcpIDogNjAxMDcsIGMgPSBvID8gU3ltYm9sLmZvcigncmVhY3Quc3RyaWN0X21vZGUnKSA6IDYwMTA4LCB1ID0gbyA/IFN5bWJvbC5mb3IoJ3JlYWN0LnByb2ZpbGVyJykgOiA2MDExNCwgbCA9IG8gPyBTeW1ib2wuZm9yKCdyZWFjdC5wcm92aWRlcicpIDogNjAxMDksIGYgPSBvID8gU3ltYm9sLmZvcigncmVhY3QuY29udGV4dCcpIDogNjAxMTAsIHAgPSBvID8gU3ltYm9sLmZvcigncmVhY3QuZm9yd2FyZF9yZWYnKSA6IDYwMTEyLCBkID0gbyA/IFN5bWJvbC5mb3IoJ3JlYWN0LnN1c3BlbnNlJykgOiA2MDExMywgaCA9IG8gPyBTeW1ib2wuZm9yKCdyZWFjdC5tZW1vJykgOiA2MDExNSwgbSA9IG8gPyBTeW1ib2wuZm9yKCdyZWFjdC5sYXp5JykgOiA2MDExNiwgZyA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBTeW1ib2wgJiYgU3ltYm9sLml0ZXJhdG9yOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gdihlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9ICdodHRwczovL3JlYWN0anMub3JnL2RvY3MvZXJyb3ItZGVjb2Rlci5odG1sP2ludmFyaWFudD0nICsgZSwgbiA9IDE7IG4gPCBhcmd1bWVudHMubGVuZ3RoOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gJyZhcmdzW109JyArIGVuY29kZVVSSUNvbXBvbmVudChhcmd1bWVudHNbbl0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAnTWluaWZpZWQgUmVhY3QgZXJyb3IgIycgKyBlICsgJzsgdmlzaXQgJyArIHQgKyAnIGZvciB0aGUgZnVsbCBtZXNzYWdlIG9yIHVzZSB0aGUgbm9uLW1pbmlmaWVkIGRldiBlbnZpcm9ubWVudCBmb3IgZnVsbCBlcnJvcnMgYW5kIGFkZGl0aW9uYWwgaGVscGZ1bCB3YXJuaW5ncy4nOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlzTW91bnRlZDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBlbnF1ZXVlRm9yY2VVcGRhdGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZW5xdWV1ZVJlcGxhY2VTdGF0ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBlbnF1ZXVlU2V0U3RhdGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGIgPSB7fTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEUoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHRoaXMucHJvcHMgPSBlLCB0aGlzLmNvbnRleHQgPSB0LCB0aGlzLnJlZnMgPSBiLCB0aGlzLnVwZGF0ZXIgPSBuIHx8IHk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB3KCkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24geChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9wcyA9IGUsIHRoaXMuY29udGV4dCA9IHQsIHRoaXMucmVmcyA9IGIsIHRoaXMudXBkYXRlciA9IG4gfHwgeTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIEUucHJvdG90eXBlLmlzUmVhY3RDb21wb25lbnQgPSB7fSwgRS5wcm90b3R5cGUuc2V0U3RhdGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyAhPT0gdHlwZW9mIGUgJiYgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIGUgJiYgbnVsbCAhPSBlKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcih2KDg1KSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy51cGRhdGVyLmVucXVldWVTZXRTdGF0ZSh0aGlzLCBlLCB0LCAnc2V0U3RhdGUnKTsKICAgICAgICAgICAgICAgIH0sIEUucHJvdG90eXBlLmZvcmNlVXBkYXRlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLnVwZGF0ZXIuZW5xdWV1ZUZvcmNlVXBkYXRlKHRoaXMsIGUsICdmb3JjZVVwZGF0ZScpOwogICAgICAgICAgICAgICAgfSwgdy5wcm90b3R5cGUgPSBFLnByb3RvdHlwZTsKICAgICAgICAgICAgICAgIHZhciBTID0geC5wcm90b3R5cGUgPSBuZXcgdygpOwogICAgICAgICAgICAgICAgUy5jb25zdHJ1Y3RvciA9IHgsIHIoUywgRS5wcm90b3R5cGUpLCBTLmlzUHVyZVJlYWN0Q29tcG9uZW50ID0gITA7CiAgICAgICAgICAgICAgICB2YXIgQyA9IHsgY3VycmVudDogbnVsbCB9LCBrID0gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eSwgVCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgcmVmOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgX19zZWxmOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgX19zb3VyY2U6ICEwCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF8oZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByLCBvID0ge30sIGEgPSBudWxsLCBzID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSB0KQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgaW4gKHZvaWQgMCAhPT0gdC5yZWYgJiYgKHMgPSB0LnJlZiksIHZvaWQgMCAhPT0gdC5rZXkgJiYgKGEgPSAnJyArIHQua2V5KSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrLmNhbGwodCwgcikgJiYgIVQuaGFzT3duUHJvcGVydHkocikgJiYgKG9bcl0gPSB0W3JdKTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGFyZ3VtZW50cy5sZW5ndGggLSAyOwogICAgICAgICAgICAgICAgICAgIGlmICgxID09PSBjKQogICAgICAgICAgICAgICAgICAgICAgICBvLmNoaWxkcmVuID0gbjsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgxIDwgYykgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB1ID0gQXJyYXkoYyksIGwgPSAwOyBsIDwgYzsgbCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdVtsXSA9IGFyZ3VtZW50c1tsICsgMl07CiAgICAgICAgICAgICAgICAgICAgICAgIG8uY2hpbGRyZW4gPSB1OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiBlLmRlZmF1bHRQcm9wcykKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChyIGluIGMgPSBlLmRlZmF1bHRQcm9wcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gb1tyXSAmJiAob1tyXSA9IGNbcl0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICQkdHlwZW9mOiBpLAogICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlZjogcywKICAgICAgICAgICAgICAgICAgICAgICAgcHJvcHM6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgIF9vd25lcjogQy5jdXJyZW50CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnb2JqZWN0JyA9PT0gdHlwZW9mIGUgJiYgbnVsbCAhPT0gZSAmJiBlLiQkdHlwZW9mID09PSBpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIE8gPSAvXC8rL2csIEkgPSBbXTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEwoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIGlmIChJLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IEkucG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLnJlc3VsdCA9IGUsIG8ua2V5UHJlZml4ID0gdCwgby5mdW5jID0gbiwgby5jb250ZXh0ID0gciwgby5jb3VudCA9IDAsIG87CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdDogZSwKICAgICAgICAgICAgICAgICAgICAgICAga2V5UHJlZml4OiB0LAogICAgICAgICAgICAgICAgICAgICAgICBmdW5jOiBuLAogICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiByLAogICAgICAgICAgICAgICAgICAgICAgICBjb3VudDogMAogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBBKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLnJlc3VsdCA9IG51bGwsIGUua2V5UHJlZml4ID0gbnVsbCwgZS5mdW5jID0gbnVsbCwgZS5jb250ZXh0ID0gbnVsbCwgZS5jb3VudCA9IDAsIDEwID4gSS5sZW5ndGggJiYgSS5wdXNoKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gZSA/IDAgOiBmdW5jdGlvbiBlKHQsIG4sIHIsIG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB0eXBlb2YgdDsKICAgICAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT09IHMgJiYgJ2Jvb2xlYW4nICE9PSBzIHx8ICh0ID0gbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3N0cmluZyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdudW1iZXInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ29iamVjdCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0LiQkdHlwZW9mKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBpOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgYToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihvLCB0LCAnJyA9PT0gbiA/ICcuJyArIE4odCwgMCkgOiBuKSwgMTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgPSAwLCBuID0gJycgPT09IG4gPyAnLicgOiBuICsgJzonLCBBcnJheS5pc0FycmF5KHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdSA9IDA7IHUgPCB0Lmxlbmd0aDsgdSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBuICsgTihzID0gdFt1XSwgdSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyArPSBlKHMsIGwsIHIsIG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChudWxsID09PSB0IHx8ICdvYmplY3QnICE9PSB0eXBlb2YgdCA/IGwgPSBudWxsIDogbCA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiAobCA9IGcgJiYgdFtnXSB8fCB0WydAQGl0ZXJhdG9yJ10pID8gbCA6IG51bGwsICdmdW5jdGlvbicgPT09IHR5cGVvZiBsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0ID0gbC5jYWxsKHQpLCB1ID0gMDsgIShzID0gdC5uZXh0KCkpLmRvbmU7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgKz0gZShzID0gcy52YWx1ZSwgbCA9IG4gKyBOKHMsIHUrKyksIHIsIG8pOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgnb2JqZWN0JyA9PT0gcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IHIgPSAnJyArIHQsIEVycm9yKHYoMzEsICdbb2JqZWN0IE9iamVjdF0nID09PSByID8gJ29iamVjdCB3aXRoIGtleXMgeycgKyBPYmplY3Qua2V5cyh0KS5qb2luKCcsICcpICsgJ30nIDogciwgJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICAgICAgfShlLCAnJywgdCwgbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBOKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT09IHR5cGVvZiBlICYmIG51bGwgIT09IGUgJiYgbnVsbCAhPSBlLmtleSA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJz0nOiAnPTAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJzonOiAnPTInCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJCcgKyAoJycgKyBlKS5yZXBsYWNlKC9bPTpdL2csIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfShlLmtleSkgOiB0LnRvU3RyaW5nKDM2KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGooZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGUuZnVuYy5jYWxsKGUuY29udGV4dCwgdCwgZS5jb3VudCsrKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHEoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5yZXN1bHQsIG8gPSBlLmtleVByZWZpeDsKICAgICAgICAgICAgICAgICAgICBlID0gZS5mdW5jLmNhbGwoZS5jb250ZXh0LCB0LCBlLmNvdW50KyspLCBBcnJheS5pc0FycmF5KGUpID8gRihlLCByLCBuLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9KSA6IG51bGwgIT0gZSAmJiAoUChlKSAmJiAoZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkJHR5cGVvZjogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGUudHlwZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZjogZS5yZWYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogZS5wcm9wcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9vd25lcjogZS5fb3duZXIKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KGUsIG8gKyAoIWUua2V5IHx8IHQgJiYgdC5rZXkgPT09IGUua2V5ID8gJycgOiAoJycgKyBlLmtleSkucmVwbGFjZShPLCAnJCYvJykgKyAnLycpICsgbikpLCByLnB1c2goZSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRihlLCB0LCBuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAnJzsKICAgICAgICAgICAgICAgICAgICBudWxsICE9IG4gJiYgKGkgPSAoJycgKyBuKS5yZXBsYWNlKE8sICckJi8nKSArICcvJyksIFIoZSwgcSwgdCA9IEwodCwgaSwgciwgbykpLCBBKHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIEQgPSB7IGN1cnJlbnQ6IG51bGwgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE0oKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBELmN1cnJlbnQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKHYoMzIxKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgVSA9IHsKICAgICAgICAgICAgICAgICAgICBSZWFjdEN1cnJlbnREaXNwYXRjaGVyOiBELAogICAgICAgICAgICAgICAgICAgIFJlYWN0Q3VycmVudEJhdGNoQ29uZmlnOiB7IHN1c3BlbnNlOiBudWxsIH0sCiAgICAgICAgICAgICAgICAgICAgUmVhY3RDdXJyZW50T3duZXI6IEMsCiAgICAgICAgICAgICAgICAgICAgSXNTb21lUmVuZGVyZXJBY3Rpbmc6IHsgY3VycmVudDogITEgfSwKICAgICAgICAgICAgICAgICAgICBhc3NpZ246IHIKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB0LkNoaWxkcmVuID0gewogICAgICAgICAgICAgICAgICAgIG1hcDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRihlLCByLCBudWxsLCB0LCBuKSwgcjsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGZvckVhY2g6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgUihlLCBqLCB0ID0gTChudWxsLCBudWxsLCB0LCBuKSksIEEodCk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBjb3VudDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFIoZSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIG51bGwpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgdG9BcnJheTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEYoZSwgdCwgbnVsbCwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG9ubHk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghUChlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKHYoMTQzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHQuQ29tcG9uZW50ID0gRSwgdC5GcmFnbWVudCA9IHMsIHQuUHJvZmlsZXIgPSB1LCB0LlB1cmVDb21wb25lbnQgPSB4LCB0LlN0cmljdE1vZGUgPSBjLCB0LlN1c3BlbnNlID0gZCwgdC5fX1NFQ1JFVF9JTlRFUk5BTFNfRE9fTk9UX1VTRV9PUl9ZT1VfV0lMTF9CRV9GSVJFRCA9IFUsIHQuY2xvbmVFbGVtZW50ID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gZSB8fCB2b2lkIDAgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKHYoMjY3LCBlKSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByKHt9LCBlLnByb3BzKSwgYSA9IGUua2V5LCBzID0gZS5yZWYsIGMgPSBlLl9vd25lcjsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IHQucmVmICYmIChzID0gdC5yZWYsIGMgPSBDLmN1cnJlbnQpLCB2b2lkIDAgIT09IHQua2V5ICYmIChhID0gJycgKyB0LmtleSksIGUudHlwZSAmJiBlLnR5cGUuZGVmYXVsdFByb3BzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBlLnR5cGUuZGVmYXVsdFByb3BzOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGwgaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsuY2FsbCh0LCBsKSAmJiAhVC5oYXNPd25Qcm9wZXJ0eShsKSAmJiAob1tsXSA9IHZvaWQgMCA9PT0gdFtsXSAmJiB2b2lkIDAgIT09IHUgPyB1W2xdIDogdFtsXSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciBsID0gYXJndW1lbnRzLmxlbmd0aCAtIDI7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT09IGwpCiAgICAgICAgICAgICAgICAgICAgICAgIG8uY2hpbGRyZW4gPSBuOwogICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKDEgPCBsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBBcnJheShsKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiA9IDA7IGYgPCBsOyBmKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1W2ZdID0gYXJndW1lbnRzW2YgKyAyXTsKICAgICAgICAgICAgICAgICAgICAgICAgby5jaGlsZHJlbiA9IHU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICQkdHlwZW9mOiBpLAogICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBlLnR5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGtleTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVmOiBzLAogICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogbywKICAgICAgICAgICAgICAgICAgICAgICAgX293bmVyOiBjCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIHQuY3JlYXRlQ29udGV4dCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PT0gdCAmJiAodCA9IG51bGwpLCAoZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgJCR0eXBlb2Y6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgIF9jYWxjdWxhdGVDaGFuZ2VkQml0czogdCwKICAgICAgICAgICAgICAgICAgICAgICAgX2N1cnJlbnRWYWx1ZTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgX2N1cnJlbnRWYWx1ZTI6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIF90aHJlYWRDb3VudDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgUHJvdmlkZXI6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIENvbnN1bWVyOiBudWxsCiAgICAgICAgICAgICAgICAgICAgfSkuUHJvdmlkZXIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICQkdHlwZW9mOiBsLAogICAgICAgICAgICAgICAgICAgICAgICBfY29udGV4dDogZQogICAgICAgICAgICAgICAgICAgIH0sIGUuQ29uc3VtZXIgPSBlOwogICAgICAgICAgICAgICAgfSwgdC5jcmVhdGVFbGVtZW50ID0gXywgdC5jcmVhdGVGYWN0b3J5ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IF8uYmluZChudWxsLCBlKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID0gZSwgdDsKICAgICAgICAgICAgICAgIH0sIHQuY3JlYXRlUmVmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB7IGN1cnJlbnQ6IG51bGwgfTsKICAgICAgICAgICAgICAgIH0sIHQuZm9yd2FyZFJlZiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgJCR0eXBlb2Y6IHAsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlbmRlcjogZQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCB0LmlzVmFsaWRFbGVtZW50ID0gUCwgdC5sYXp5ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAkJHR5cGVvZjogbSwKICAgICAgICAgICAgICAgICAgICAgICAgX2N0b3I6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIF9zdGF0dXM6IC0xLAogICAgICAgICAgICAgICAgICAgICAgICBfcmVzdWx0OiBudWxsCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIHQubWVtbyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgJCR0eXBlb2Y6IGgsCiAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbXBhcmU6IHZvaWQgMCA9PT0gdCA/IG51bGwgOiB0CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIHQudXNlQ2FsbGJhY2sgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBNKCkudXNlQ2FsbGJhY2soZSwgdCk7CiAgICAgICAgICAgICAgICB9LCB0LnVzZUNvbnRleHQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBNKCkudXNlQ29udGV4dChlLCB0KTsKICAgICAgICAgICAgICAgIH0sIHQudXNlRGVidWdWYWx1ZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH0sIHQudXNlRWZmZWN0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gTSgpLnVzZUVmZmVjdChlLCB0KTsKICAgICAgICAgICAgICAgIH0sIHQudXNlSW1wZXJhdGl2ZUhhbmRsZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE0oKS51c2VJbXBlcmF0aXZlSGFuZGxlKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgfSwgdC51c2VMYXlvdXRFZmZlY3QgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBNKCkudXNlTGF5b3V0RWZmZWN0KGUsIHQpOwogICAgICAgICAgICAgICAgfSwgdC51c2VNZW1vID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gTSgpLnVzZU1lbW8oZSwgdCk7CiAgICAgICAgICAgICAgICB9LCB0LnVzZVJlZHVjZXIgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBNKCkudXNlUmVkdWNlcihlLCB0LCBuKTsKICAgICAgICAgICAgICAgIH0sIHQudXNlUmVmID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gTSgpLnVzZVJlZihlKTsKICAgICAgICAgICAgICAgIH0sIHQudXNlU3RhdGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBNKCkudXNlU3RhdGUoZSk7CiAgICAgICAgICAgICAgICB9LCB0LnZlcnNpb24gPSAnMTYuMTQuMCc7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMCksIG8gPSBuKDExNyksIGkgPSBuKDI2Mik7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gJ2h0dHBzOi8vcmVhY3Rqcy5vcmcvZG9jcy9lcnJvci1kZWNvZGVyLmh0bWw/aW52YXJpYW50PScgKyBlLCBuID0gMTsgbiA8IGFyZ3VtZW50cy5sZW5ndGg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgdCArPSAnJmFyZ3NbXT0nICsgZW5jb2RlVVJJQ29tcG9uZW50KGFyZ3VtZW50c1tuXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdNaW5pZmllZCBSZWFjdCBlcnJvciAjJyArIGUgKyAnOyB2aXNpdCAnICsgdCArICcgZm9yIHRoZSBmdWxsIG1lc3NhZ2Ugb3IgdXNlIHRoZSBub24tbWluaWZpZWQgZGV2IGVudmlyb25tZW50IGZvciBmdWxsIGVycm9ycyBhbmQgYWRkaXRpb25hbCBoZWxwZnVsIHdhcm5pbmdzLic7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoIXIpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgyMjcpKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgdCwgbiwgciwgbywgaSwgYSwgcywgYykgewogICAgICAgICAgICAgICAgICAgIHZhciB1ID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAzKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB0LmFwcGx5KG4sIHUpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5vbkVycm9yKGwpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBjID0gITEsIHUgPSBudWxsLCBsID0gITEsIGYgPSBudWxsLCBwID0gewogICAgICAgICAgICAgICAgICAgICAgICBvbkVycm9yOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9ICEwLCB1ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUsIHQsIG4sIHIsIG8sIGksIGEsIGwsIGYpIHsKICAgICAgICAgICAgICAgICAgICBjID0gITEsIHUgPSBudWxsLCBzLmFwcGx5KHAsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgaCA9IG51bGwsIG0gPSBudWxsLCBnID0gbnVsbDsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHYoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gZS50eXBlIHx8ICd1bmtub3duLWV2ZW50JzsKICAgICAgICAgICAgICAgICAgICBlLmN1cnJlbnRUYXJnZXQgPSBnKG4pLCBmdW5jdGlvbiAoZSwgdCwgbiwgciwgbywgaSwgcywgcCwgaCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZC5hcHBseSh0aGlzLCBhcmd1bWVudHMpLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgxOTgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gdTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAhMSwgdSA9IG51bGwsIGwgfHwgKGwgPSAhMCwgZiA9IG0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfShyLCB0LCB2b2lkIDAsIGUpLCBlLmN1cnJlbnRUYXJnZXQgPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHkgPSBudWxsLCBiID0ge307CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBFKCkgewogICAgICAgICAgICAgICAgICAgIGlmICh5KQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlIGluIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYltlXSwgbiA9IHkuaW5kZXhPZihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKC0xIDwgbikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSg5NiwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF4W25dKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0LmV4dHJhY3RFdmVudHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoOTcsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByIGluICh4W25dID0gdCwgbiA9IHQuZXZlbnRUeXBlcykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB2b2lkIDAsIGkgPSBuW3JdLCBzID0gdCwgYyA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChTLmhhc093blByb3BlcnR5KGMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSg5OSwgYykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTW2NdID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBpLnBoYXNlZFJlZ2lzdHJhdGlvbk5hbWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChvIGluIHUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5oYXNPd25Qcm9wZXJ0eShvKSAmJiB3KHVbb10sIHMsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkucmVnaXN0cmF0aW9uTmFtZSA/ICh3KGkucmVnaXN0cmF0aW9uTmFtZSwgcywgYyksIG8gPSAhMCkgOiBvID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoOTgsIHIsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHcoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIGlmIChDW2VdKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDEwMCwgZSkpOwogICAgICAgICAgICAgICAgICAgIENbZV0gPSB0LCBrW2VdID0gdC5ldmVudFR5cGVzW25dLmRlcGVuZGVuY2llczsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciB4ID0gW10sIFMgPSB7fSwgQyA9IHt9LCBrID0ge307CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBUKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9ICExOwogICAgICAgICAgICAgICAgICAgIGZvciAodCBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5oYXNPd25Qcm9wZXJ0eSh0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFiLmhhc093blByb3BlcnR5KHQpIHx8IGJbdF0gIT09IHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYlt0XSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgxMDIsIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiW3RdID0gciwgbiA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbiAmJiBFKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgXyA9ICEoJ3VuZGVmaW5lZCcgPT09IHR5cGVvZiB3aW5kb3cgfHwgJ3VuZGVmaW5lZCcgPT09IHR5cGVvZiB3aW5kb3cuZG9jdW1lbnQgfHwgJ3VuZGVmaW5lZCcgPT09IHR5cGVvZiB3aW5kb3cuZG9jdW1lbnQuY3JlYXRlRWxlbWVudCksIFAgPSBudWxsLCBPID0gbnVsbCwgSSA9IG51bGw7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSA9IG0oZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT09IHR5cGVvZiBQKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgyODApKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnN0YXRlTm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAodCA9IGgodCksIFAoZS5zdGF0ZU5vZGUsIGUudHlwZSwgdCkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEEoZSkgewogICAgICAgICAgICAgICAgICAgIE8gPyBJID8gSS5wdXNoKGUpIDogSSA9IFtlXSA6IE8gPSBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUigpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoTykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IE8sIHQgPSBJOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoSSA9IE8gPSBudWxsLCBMKGUpLCB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IHQubGVuZ3RoOyBlKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTCh0W2VdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBOKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGooZSwgdCwgbiwgciwgbykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHQsIG4sIHIsIG8pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcSgpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBGID0gTiwgRCA9ICExLCBNID0gITE7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBVKCkgewogICAgICAgICAgICAgICAgICAgIG51bGwgPT09IE8gJiYgbnVsbCA9PT0gSSB8fCAocSgpLCBSKCkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gVihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE0pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIE0gPSAhMDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRihlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICBNID0gITEsIFUoKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgQiA9IC9eWzpBLVpfYS16XHUwMEMwLVx1MDBENlx1MDBEOC1cdTAwRjZcdTAwRjgtXHUwMkZGXHUwMzcwLVx1MDM3RFx1MDM3Ri1cdTFGRkZcdTIwMEMtXHUyMDBEXHUyMDcwLVx1MjE4Rlx1MkMwMC1cdTJGRUZcdTMwMDEtXHVEN0ZGXHVGOTAwLVx1RkRDRlx1RkRGMC1cdUZGRkRdWzpBLVpfYS16XHUwMEMwLVx1MDBENlx1MDBEOC1cdTAwRjZcdTAwRjgtXHUwMkZGXHUwMzcwLVx1MDM3RFx1MDM3Ri1cdTFGRkZcdTIwMEMtXHUyMDBEXHUyMDcwLVx1MjE4Rlx1MkMwMC1cdTJGRUZcdTMwMDEtXHVEN0ZGXHVGOTAwLVx1RkRDRlx1RkRGMC1cdUZGRkRcLS4wLTlcdTAwQjdcdTAzMDAtXHUwMzZGXHUyMDNGLVx1MjA0MF0qJC8sIHogPSBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LCBHID0ge30sIEggPSB7fTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFcoZSwgdCwgbiwgciwgbywgaSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuYWNjZXB0c0Jvb2xlYW5zID0gMiA9PT0gdCB8fCAzID09PSB0IHx8IDQgPT09IHQsIHRoaXMuYXR0cmlidXRlTmFtZSA9IHIsIHRoaXMuYXR0cmlidXRlTmFtZXNwYWNlID0gbywgdGhpcy5tdXN0VXNlUHJvcGVydHkgPSBuLCB0aGlzLnByb3BlcnR5TmFtZSA9IGUsIHRoaXMudHlwZSA9IHQsIHRoaXMuc2FuaXRpemVVUkwgPSBpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyICQgPSB7fTsKICAgICAgICAgICAgICAgICdjaGlsZHJlbiBkYW5nZXJvdXNseVNldElubmVySFRNTCBkZWZhdWx0VmFsdWUgZGVmYXVsdENoZWNrZWQgaW5uZXJIVE1MIHN1cHByZXNzQ29udGVudEVkaXRhYmxlV2FybmluZyBzdXBwcmVzc0h5ZHJhdGlvbldhcm5pbmcgc3R5bGUnLnNwbGl0KCcgJykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICRbZV0gPSBuZXcgVyhlLCAwLCAhMSwgZSwgbnVsbCwgITEpOwogICAgICAgICAgICAgICAgfSksIFsKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdhY2NlcHRDaGFyc2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ2FjY2VwdC1jaGFyc2V0JwogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnY2xhc3NOYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NsYXNzJwogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAnaHRtbEZvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICdmb3InCiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICdodHRwRXF1aXYnLAogICAgICAgICAgICAgICAgICAgICAgICAnaHR0cC1lcXVpdicKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbMF07CiAgICAgICAgICAgICAgICAgICAgJFt0XSA9IG5ldyBXKHQsIDEsICExLCBlWzFdLCBudWxsLCAhMSk7CiAgICAgICAgICAgICAgICB9KSwgWwogICAgICAgICAgICAgICAgICAgICdjb250ZW50RWRpdGFibGUnLAogICAgICAgICAgICAgICAgICAgICdkcmFnZ2FibGUnLAogICAgICAgICAgICAgICAgICAgICdzcGVsbENoZWNrJywKICAgICAgICAgICAgICAgICAgICAndmFsdWUnCiAgICAgICAgICAgICAgICBdLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAkW2VdID0gbmV3IFcoZSwgMiwgITEsIGUudG9Mb3dlckNhc2UoKSwgbnVsbCwgITEpOwogICAgICAgICAgICAgICAgfSksIFsKICAgICAgICAgICAgICAgICAgICAnYXV0b1JldmVyc2UnLAogICAgICAgICAgICAgICAgICAgICdleHRlcm5hbFJlc291cmNlc1JlcXVpcmVkJywKICAgICAgICAgICAgICAgICAgICAnZm9jdXNhYmxlJywKICAgICAgICAgICAgICAgICAgICAncHJlc2VydmVBbHBoYScKICAgICAgICAgICAgICAgIF0uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICRbZV0gPSBuZXcgVyhlLCAyLCAhMSwgZSwgbnVsbCwgITEpOwogICAgICAgICAgICAgICAgfSksICdhbGxvd0Z1bGxTY3JlZW4gYXN5bmMgYXV0b0ZvY3VzIGF1dG9QbGF5IGNvbnRyb2xzIGRlZmF1bHQgZGVmZXIgZGlzYWJsZWQgZGlzYWJsZVBpY3R1cmVJblBpY3R1cmUgZm9ybU5vVmFsaWRhdGUgaGlkZGVuIGxvb3Agbm9Nb2R1bGUgbm9WYWxpZGF0ZSBvcGVuIHBsYXlzSW5saW5lIHJlYWRPbmx5IHJlcXVpcmVkIHJldmVyc2VkIHNjb3BlZCBzZWFtbGVzcyBpdGVtU2NvcGUnLnNwbGl0KCcgJykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICRbZV0gPSBuZXcgVyhlLCAzLCAhMSwgZS50b0xvd2VyQ2FzZSgpLCBudWxsLCAhMSk7CiAgICAgICAgICAgICAgICB9KSwgWwogICAgICAgICAgICAgICAgICAgICdjaGVja2VkJywKICAgICAgICAgICAgICAgICAgICAnbXVsdGlwbGUnLAogICAgICAgICAgICAgICAgICAgICdtdXRlZCcsCiAgICAgICAgICAgICAgICAgICAgJ3NlbGVjdGVkJwogICAgICAgICAgICAgICAgXS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgJFtlXSA9IG5ldyBXKGUsIDMsICEwLCBlLCBudWxsLCAhMSk7CiAgICAgICAgICAgICAgICB9KSwgWwogICAgICAgICAgICAgICAgICAgICdjYXB0dXJlJywKICAgICAgICAgICAgICAgICAgICAnZG93bmxvYWQnCiAgICAgICAgICAgICAgICBdLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAkW2VdID0gbmV3IFcoZSwgNCwgITEsIGUsIG51bGwsICExKTsKICAgICAgICAgICAgICAgIH0pLCBbCiAgICAgICAgICAgICAgICAgICAgJ2NvbHMnLAogICAgICAgICAgICAgICAgICAgICdyb3dzJywKICAgICAgICAgICAgICAgICAgICAnc2l6ZScsCiAgICAgICAgICAgICAgICAgICAgJ3NwYW4nCiAgICAgICAgICAgICAgICBdLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAkW2VdID0gbmV3IFcoZSwgNiwgITEsIGUsIG51bGwsICExKTsKICAgICAgICAgICAgICAgIH0pLCBbCiAgICAgICAgICAgICAgICAgICAgJ3Jvd1NwYW4nLAogICAgICAgICAgICAgICAgICAgICdzdGFydCcKICAgICAgICAgICAgICAgIF0uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICRbZV0gPSBuZXcgVyhlLCA1LCAhMSwgZS50b0xvd2VyQ2FzZSgpLCBudWxsLCAhMSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciBZID0gL1tcLTpdKFthLXpdKS9nOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gUShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbMV0udG9VcHBlckNhc2UoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICdhY2NlbnQtaGVpZ2h0IGFsaWdubWVudC1iYXNlbGluZSBhcmFiaWMtZm9ybSBiYXNlbGluZS1zaGlmdCBjYXAtaGVpZ2h0IGNsaXAtcGF0aCBjbGlwLXJ1bGUgY29sb3ItaW50ZXJwb2xhdGlvbiBjb2xvci1pbnRlcnBvbGF0aW9uLWZpbHRlcnMgY29sb3ItcHJvZmlsZSBjb2xvci1yZW5kZXJpbmcgZG9taW5hbnQtYmFzZWxpbmUgZW5hYmxlLWJhY2tncm91bmQgZmlsbC1vcGFjaXR5IGZpbGwtcnVsZSBmbG9vZC1jb2xvciBmbG9vZC1vcGFjaXR5IGZvbnQtZmFtaWx5IGZvbnQtc2l6ZSBmb250LXNpemUtYWRqdXN0IGZvbnQtc3RyZXRjaCBmb250LXN0eWxlIGZvbnQtdmFyaWFudCBmb250LXdlaWdodCBnbHlwaC1uYW1lIGdseXBoLW9yaWVudGF0aW9uLWhvcml6b250YWwgZ2x5cGgtb3JpZW50YXRpb24tdmVydGljYWwgaG9yaXotYWR2LXggaG9yaXotb3JpZ2luLXggaW1hZ2UtcmVuZGVyaW5nIGxldHRlci1zcGFjaW5nIGxpZ2h0aW5nLWNvbG9yIG1hcmtlci1lbmQgbWFya2VyLW1pZCBtYXJrZXItc3RhcnQgb3ZlcmxpbmUtcG9zaXRpb24gb3ZlcmxpbmUtdGhpY2tuZXNzIHBhaW50LW9yZGVyIHBhbm9zZS0xIHBvaW50ZXItZXZlbnRzIHJlbmRlcmluZy1pbnRlbnQgc2hhcGUtcmVuZGVyaW5nIHN0b3AtY29sb3Igc3RvcC1vcGFjaXR5IHN0cmlrZXRocm91Z2gtcG9zaXRpb24gc3RyaWtldGhyb3VnaC10aGlja25lc3Mgc3Ryb2tlLWRhc2hhcnJheSBzdHJva2UtZGFzaG9mZnNldCBzdHJva2UtbGluZWNhcCBzdHJva2UtbGluZWpvaW4gc3Ryb2tlLW1pdGVybGltaXQgc3Ryb2tlLW9wYWNpdHkgc3Ryb2tlLXdpZHRoIHRleHQtYW5jaG9yIHRleHQtZGVjb3JhdGlvbiB0ZXh0LXJlbmRlcmluZyB1bmRlcmxpbmUtcG9zaXRpb24gdW5kZXJsaW5lLXRoaWNrbmVzcyB1bmljb2RlLWJpZGkgdW5pY29kZS1yYW5nZSB1bml0cy1wZXItZW0gdi1hbHBoYWJldGljIHYtaGFuZ2luZyB2LWlkZW9ncmFwaGljIHYtbWF0aGVtYXRpY2FsIHZlY3Rvci1lZmZlY3QgdmVydC1hZHYteSB2ZXJ0LW9yaWdpbi14IHZlcnQtb3JpZ2luLXkgd29yZC1zcGFjaW5nIHdyaXRpbmctbW9kZSB4bWxuczp4bGluayB4LWhlaWdodCcuc3BsaXQoJyAnKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJlcGxhY2UoWSwgUSk7CiAgICAgICAgICAgICAgICAgICAgJFt0XSA9IG5ldyBXKHQsIDEsICExLCBlLCBudWxsLCAhMSk7CiAgICAgICAgICAgICAgICB9KSwgJ3hsaW5rOmFjdHVhdGUgeGxpbms6YXJjcm9sZSB4bGluazpyb2xlIHhsaW5rOnNob3cgeGxpbms6dGl0bGUgeGxpbms6dHlwZScuc3BsaXQoJyAnKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJlcGxhY2UoWSwgUSk7CiAgICAgICAgICAgICAgICAgICAgJFt0XSA9IG5ldyBXKHQsIDEsICExLCBlLCAnaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluaycsICExKTsKICAgICAgICAgICAgICAgIH0pLCBbCiAgICAgICAgICAgICAgICAgICAgJ3htbDpiYXNlJywKICAgICAgICAgICAgICAgICAgICAneG1sOmxhbmcnLAogICAgICAgICAgICAgICAgICAgICd4bWw6c3BhY2UnCiAgICAgICAgICAgICAgICBdLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVwbGFjZShZLCBRKTsKICAgICAgICAgICAgICAgICAgICAkW3RdID0gbmV3IFcodCwgMSwgITEsIGUsICdodHRwOi8vd3d3LnczLm9yZy9YTUwvMTk5OC9uYW1lc3BhY2UnLCAhMSk7CiAgICAgICAgICAgICAgICB9KSwgWwogICAgICAgICAgICAgICAgICAgICd0YWJJbmRleCcsCiAgICAgICAgICAgICAgICAgICAgJ2Nyb3NzT3JpZ2luJwogICAgICAgICAgICAgICAgXS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgJFtlXSA9IG5ldyBXKGUsIDEsICExLCBlLnRvTG93ZXJDYXNlKCksIG51bGwsICExKTsKICAgICAgICAgICAgICAgIH0pLCAkLnhsaW5rSHJlZiA9IG5ldyBXKCd4bGlua0hyZWYnLCAxLCAhMSwgJ3hsaW5rOmhyZWYnLCAnaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluaycsICEwKSwgWwogICAgICAgICAgICAgICAgICAgICdzcmMnLAogICAgICAgICAgICAgICAgICAgICdocmVmJywKICAgICAgICAgICAgICAgICAgICAnYWN0aW9uJywKICAgICAgICAgICAgICAgICAgICAnZm9ybUFjdGlvbicKICAgICAgICAgICAgICAgIF0uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICRbZV0gPSBuZXcgVyhlLCAxLCAhMSwgZS50b0xvd2VyQ2FzZSgpLCBudWxsLCAhMCk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciBLID0gci5fX1NFQ1JFVF9JTlRFUk5BTFNfRE9fTk9UX1VTRV9PUl9ZT1VfV0lMTF9CRV9GSVJFRDsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEooZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHZhciBvID0gJC5oYXNPd25Qcm9wZXJ0eSh0KSA/ICRbdF0gOiBudWxsOwogICAgICAgICAgICAgICAgICAgIChudWxsICE9PSBvID8gMCA9PT0gby50eXBlIDogIXIgJiYgKDIgPCB0Lmxlbmd0aCAmJiAoJ28nID09PSB0WzBdIHx8ICdPJyA9PT0gdFswXSkgJiYgKCduJyA9PT0gdFsxXSB8fCAnTicgPT09IHRbMV0pKSkgfHwgKGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSB0IHx8ICd1bmRlZmluZWQnID09PSB0eXBlb2YgdCB8fCBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBuICYmIDAgPT09IG4udHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodHlwZW9mIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdmdW5jdGlvbic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc3ltYm9sJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Jvb2xlYW4nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXIgJiYgKG51bGwgIT09IG4gPyAhbi5hY2NlcHRzQm9vbGVhbnMgOiAnZGF0YS0nICE9PSAoZSA9IGUudG9Mb3dlckNhc2UoKS5zbGljZSgwLCA1KSkgJiYgJ2FyaWEtJyAhPT0gZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSwgdCwgbiwgcikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobi50eXBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMSA9PT0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNOYU4odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlzTmFOKHQpIHx8IDEgPiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgfSh0LCBuLCBvLCByKSAmJiAobiA9IG51bGwpLCByIHx8IG51bGwgPT09IG8gPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF6LmNhbGwoSCwgZSkgfHwgIXouY2FsbChHLCBlKSAmJiAoQi50ZXN0KGUpID8gSFtlXSA9ICEwIDogKEdbZV0gPSAhMCwgITEpKTsKICAgICAgICAgICAgICAgICAgICB9KHQpICYmIChudWxsID09PSBuID8gZS5yZW1vdmVBdHRyaWJ1dGUodCkgOiBlLnNldEF0dHJpYnV0ZSh0LCAnJyArIG4pKSA6IG8ubXVzdFVzZVByb3BlcnR5ID8gZVtvLnByb3BlcnR5TmFtZV0gPSBudWxsID09PSBuID8gMyAhPT0gby50eXBlICYmICcnIDogbiA6ICh0ID0gby5hdHRyaWJ1dGVOYW1lLCByID0gby5hdHRyaWJ1dGVOYW1lc3BhY2UsIG51bGwgPT09IG4gPyBlLnJlbW92ZUF0dHJpYnV0ZSh0KSA6IChuID0gMyA9PT0gKG8gPSBvLnR5cGUpIHx8IDQgPT09IG8gJiYgITAgPT09IG4gPyAnJyA6ICcnICsgbiwgciA/IGUuc2V0QXR0cmlidXRlTlMociwgdCwgbikgOiBlLnNldEF0dHJpYnV0ZSh0LCBuKSkpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIEsuaGFzT3duUHJvcGVydHkoJ1JlYWN0Q3VycmVudERpc3BhdGNoZXInKSB8fCAoSy5SZWFjdEN1cnJlbnREaXNwYXRjaGVyID0geyBjdXJyZW50OiBudWxsIH0pLCBLLmhhc093blByb3BlcnR5KCdSZWFjdEN1cnJlbnRCYXRjaENvbmZpZycpIHx8IChLLlJlYWN0Q3VycmVudEJhdGNoQ29uZmlnID0geyBzdXNwZW5zZTogbnVsbCB9KTsKICAgICAgICAgICAgICAgIHZhciBYID0gL14oLiopW1xcXC9dLywgWiA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBTeW1ib2wgJiYgU3ltYm9sLmZvciwgZWUgPSBaID8gU3ltYm9sLmZvcigncmVhY3QuZWxlbWVudCcpIDogNjAxMDMsIHRlID0gWiA/IFN5bWJvbC5mb3IoJ3JlYWN0LnBvcnRhbCcpIDogNjAxMDYsIG5lID0gWiA/IFN5bWJvbC5mb3IoJ3JlYWN0LmZyYWdtZW50JykgOiA2MDEwNywgcmUgPSBaID8gU3ltYm9sLmZvcigncmVhY3Quc3RyaWN0X21vZGUnKSA6IDYwMTA4LCBvZSA9IFogPyBTeW1ib2wuZm9yKCdyZWFjdC5wcm9maWxlcicpIDogNjAxMTQsIGllID0gWiA/IFN5bWJvbC5mb3IoJ3JlYWN0LnByb3ZpZGVyJykgOiA2MDEwOSwgYWUgPSBaID8gU3ltYm9sLmZvcigncmVhY3QuY29udGV4dCcpIDogNjAxMTAsIHNlID0gWiA/IFN5bWJvbC5mb3IoJ3JlYWN0LmNvbmN1cnJlbnRfbW9kZScpIDogNjAxMTEsIGNlID0gWiA/IFN5bWJvbC5mb3IoJ3JlYWN0LmZvcndhcmRfcmVmJykgOiA2MDExMiwgdWUgPSBaID8gU3ltYm9sLmZvcigncmVhY3Quc3VzcGVuc2UnKSA6IDYwMTEzLCBsZSA9IFogPyBTeW1ib2wuZm9yKCdyZWFjdC5zdXNwZW5zZV9saXN0JykgOiA2MDEyMCwgZmUgPSBaID8gU3ltYm9sLmZvcigncmVhY3QubWVtbycpIDogNjAxMTUsIHBlID0gWiA/IFN5bWJvbC5mb3IoJ3JlYWN0LmxhenknKSA6IDYwMTE2LCBkZSA9IFogPyBTeW1ib2wuZm9yKCdyZWFjdC5ibG9jaycpIDogNjAxMjEsIGhlID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIFN5bWJvbCAmJiBTeW1ib2wuaXRlcmF0b3I7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBtZShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT09IGUgfHwgJ29iamVjdCcgIT09IHR5cGVvZiBlID8gbnVsbCA6ICdmdW5jdGlvbicgPT09IHR5cGVvZiAoZSA9IGhlICYmIGVbaGVdIHx8IGVbJ0BAaXRlcmF0b3InXSkgPyBlIDogbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGdlKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmRpc3BsYXlOYW1lIHx8IGUubmFtZSB8fCBudWxsOwogICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgbmU6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnRnJhZ21lbnQnOwogICAgICAgICAgICAgICAgICAgIGNhc2UgdGU6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnUG9ydGFsJzsKICAgICAgICAgICAgICAgICAgICBjYXNlIG9lOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1Byb2ZpbGVyJzsKICAgICAgICAgICAgICAgICAgICBjYXNlIHJlOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1N0cmljdE1vZGUnOwogICAgICAgICAgICAgICAgICAgIGNhc2UgdWU6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnU3VzcGVuc2UnOwogICAgICAgICAgICAgICAgICAgIGNhc2UgbGU6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnU3VzcGVuc2VMaXN0JzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLiQkdHlwZW9mKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgYWU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0NvbnRleHQuQ29uc3VtZXInOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGllOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdDb250ZXh0LlByb3ZpZGVyJzsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBjZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5yZW5kZXI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9IHQuZGlzcGxheU5hbWUgfHwgdC5uYW1lIHx8ICcnLCBlLmRpc3BsYXlOYW1lIHx8ICgnJyAhPT0gdCA/ICdGb3J3YXJkUmVmKCcgKyB0ICsgJyknIDogJ0ZvcndhcmRSZWYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBmZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZShlLnR5cGUpOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGRlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdlKGUucmVuZGVyKTsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBwZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID0gMSA9PT0gZS5fc3RhdHVzID8gZS5fcmVzdWx0IDogbnVsbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHZlKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICcnOwogICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS50YWcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuX2RlYnVnT3duZXIsIG8gPSBlLl9kZWJ1Z1NvdXJjZSwgaSA9IGdlKGUudHlwZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG51bGwsIHIgJiYgKG4gPSBnZShyLnR5cGUpKSwgciA9IGksIGkgPSAnJywgbyA/IGkgPSAnIChhdCAnICsgby5maWxlTmFtZS5yZXBsYWNlKFgsICcnKSArICc6JyArIG8ubGluZU51bWJlciArICcpJyA6IG4gJiYgKGkgPSAnIChjcmVhdGVkIGJ5ICcgKyBuICsgJyknKSwgbiA9ICdcbiAgICBpbiAnICsgKHIgfHwgJ1Vua25vd24nKSArIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gbiwgZSA9IGUucmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24geWUoZSkgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodHlwZW9mIGUpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlICdib29sZWFuJzoKICAgICAgICAgICAgICAgICAgICBjYXNlICdudW1iZXInOgogICAgICAgICAgICAgICAgICAgIGNhc2UgJ29iamVjdCc6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnc3RyaW5nJzoKICAgICAgICAgICAgICAgICAgICBjYXNlICd1bmRlZmluZWQnOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYmUoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS50eXBlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IGUubm9kZU5hbWUpICYmICdpbnB1dCcgPT09IGUudG9Mb3dlckNhc2UoKSAmJiAoJ2NoZWNrYm94JyA9PT0gdCB8fCAncmFkaW8nID09PSB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVlKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLl92YWx1ZVRyYWNrZXIgfHwgKGUuX3ZhbHVlVHJhY2tlciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYmUoZSkgPyAnY2hlY2tlZCcgOiAndmFsdWUnLCBuID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLmNvbnN0cnVjdG9yLnByb3RvdHlwZSwgdCksIHIgPSAnJyArIGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZS5oYXNPd25Qcm9wZXJ0eSh0KSAmJiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIG4gJiYgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIG4uZ2V0ICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiBuLnNldCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBuLmdldCwgaSA9IG4uc2V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8uY2FsbCh0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9ICcnICsgZSwgaS5jYWxsKHRoaXMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgeyBlbnVtZXJhYmxlOiBuLmVudW1lcmFibGUgfSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRWYWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gJycgKyBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcFRyYWNraW5nOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX3ZhbHVlVHJhY2tlciA9IG51bGwsIGRlbGV0ZSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KGUpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHdlKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuX3ZhbHVlVHJhY2tlcjsKICAgICAgICAgICAgICAgICAgICBpZiAoIXQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuZ2V0VmFsdWUoKSwgciA9ICcnOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIChyID0gYmUoZSkgPyBlLmNoZWNrZWQgPyAndHJ1ZScgOiAnZmFsc2UnIDogZS52YWx1ZSksIChlID0gcikgIT09IG4gJiYgKHQuc2V0VmFsdWUoZSksICEwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHhlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQuY2hlY2tlZDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyh7fSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0Q2hlY2tlZDogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgY2hlY2tlZDogbnVsbCAhPSBuID8gbiA6IGUuX3dyYXBwZXJTdGF0ZS5pbml0aWFsQ2hlY2tlZAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gU2UoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gbnVsbCA9PSB0LmRlZmF1bHRWYWx1ZSA/ICcnIDogdC5kZWZhdWx0VmFsdWUsIHIgPSBudWxsICE9IHQuY2hlY2tlZCA/IHQuY2hlY2tlZCA6IHQuZGVmYXVsdENoZWNrZWQ7CiAgICAgICAgICAgICAgICAgICAgbiA9IHllKG51bGwgIT0gdC52YWx1ZSA/IHQudmFsdWUgOiBuKSwgZS5fd3JhcHBlclN0YXRlID0gewogICAgICAgICAgICAgICAgICAgICAgICBpbml0aWFsQ2hlY2tlZDogciwKICAgICAgICAgICAgICAgICAgICAgICAgaW5pdGlhbFZhbHVlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICBjb250cm9sbGVkOiAnY2hlY2tib3gnID09PSB0LnR5cGUgfHwgJ3JhZGlvJyA9PT0gdC50eXBlID8gbnVsbCAhPSB0LmNoZWNrZWQgOiBudWxsICE9IHQudmFsdWUKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQ2UoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIG51bGwgIT0gKHQgPSB0LmNoZWNrZWQpICYmIEooZSwgJ2NoZWNrZWQnLCB0LCAhMSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBrZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgQ2UoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB5ZSh0LnZhbHVlKSwgciA9IHQudHlwZTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBuKQogICAgICAgICAgICAgICAgICAgICAgICAnbnVtYmVyJyA9PT0gciA/ICgwID09PSBuICYmICcnID09PSBlLnZhbHVlIHx8IGUudmFsdWUgIT0gbikgJiYgKGUudmFsdWUgPSAnJyArIG4pIDogZS52YWx1ZSAhPT0gJycgKyBuICYmIChlLnZhbHVlID0gJycgKyBuKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgnc3VibWl0JyA9PT0gciB8fCAncmVzZXQnID09PSByKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBlLnJlbW92ZUF0dHJpYnV0ZSgndmFsdWUnKTsKICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KCd2YWx1ZScpID8gX2UoZSwgdC50eXBlLCBuKSA6IHQuaGFzT3duUHJvcGVydHkoJ2RlZmF1bHRWYWx1ZScpICYmIF9lKGUsIHQudHlwZSwgeWUodC5kZWZhdWx0VmFsdWUpKSwgbnVsbCA9PSB0LmNoZWNrZWQgJiYgbnVsbCAhPSB0LmRlZmF1bHRDaGVja2VkICYmIChlLmRlZmF1bHRDaGVja2VkID0gISF0LmRlZmF1bHRDaGVja2VkKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFRlKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAodC5oYXNPd25Qcm9wZXJ0eSgndmFsdWUnKSB8fCB0Lmhhc093blByb3BlcnR5KCdkZWZhdWx0VmFsdWUnKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQudHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoJ3N1Ym1pdCcgIT09IHIgJiYgJ3Jlc2V0JyAhPT0gciB8fCB2b2lkIDAgIT09IHQudmFsdWUgJiYgbnVsbCAhPT0gdC52YWx1ZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAnJyArIGUuX3dyYXBwZXJTdGF0ZS5pbml0aWFsVmFsdWUsIG4gfHwgdCA9PT0gZS52YWx1ZSB8fCAoZS52YWx1ZSA9IHQpLCBlLmRlZmF1bHRWYWx1ZSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICcnICE9PSAobiA9IGUubmFtZSkgJiYgKGUubmFtZSA9ICcnKSwgZS5kZWZhdWx0Q2hlY2tlZCA9ICEhZS5fd3JhcHBlclN0YXRlLmluaXRpYWxDaGVja2VkLCAnJyAhPT0gbiAmJiAoZS5uYW1lID0gbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBfZShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgJ251bWJlcicgPT09IHQgJiYgZS5vd25lckRvY3VtZW50LmFjdGl2ZUVsZW1lbnQgPT09IGUgfHwgKG51bGwgPT0gbiA/IGUuZGVmYXVsdFZhbHVlID0gJycgKyBlLl93cmFwcGVyU3RhdGUuaW5pdGlhbFZhbHVlIDogZS5kZWZhdWx0VmFsdWUgIT09ICcnICsgbiAmJiAoZS5kZWZhdWx0VmFsdWUgPSAnJyArIG4pKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFBlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IG8oeyBjaGlsZHJlbjogdm9pZCAwIH0sIHQpLCAodCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLkNoaWxkcmVuLmZvckVhY2goZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT0gZSAmJiAodCArPSBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgfSh0LmNoaWxkcmVuKSkgJiYgKGUuY2hpbGRyZW4gPSB0KSwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE9lKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSA9IGUub3B0aW9ucywgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gPSAwOyBvIDwgbi5sZW5ndGg7IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbJyQnICsgbltvXV0gPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gMDsgbiA8IGUubGVuZ3RoOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gdC5oYXNPd25Qcm9wZXJ0eSgnJCcgKyBlW25dLnZhbHVlKSwgZVtuXS5zZWxlY3RlZCAhPT0gbyAmJiAoZVtuXS5zZWxlY3RlZCA9IG8pLCBvICYmIHIgJiYgKGVbbl0uZGVmYXVsdFNlbGVjdGVkID0gITApOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9ICcnICsgeWUobiksIHQgPSBudWxsLCBvID0gMDsgbyA8IGUubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlW29dLnZhbHVlID09PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW29dLnNlbGVjdGVkID0gITAsIHZvaWQgKHIgJiYgKGVbb10uZGVmYXVsdFNlbGVjdGVkID0gITApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IHQgfHwgZVtvXS5kaXNhYmxlZCB8fCAodCA9IGVbb10pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IHQgJiYgKHQuc2VsZWN0ZWQgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSWUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IHQuZGFuZ2Vyb3VzbHlTZXRJbm5lckhUTUwpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoOTEpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyh7fSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGRyZW46ICcnICsgZS5fd3JhcHBlclN0YXRlLmluaXRpYWxWYWx1ZQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTGUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID0gdC5jaGlsZHJlbiwgdCA9IHQuZGVmYXVsdFZhbHVlLCBudWxsICE9IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSg5MikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkobikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISgxID49IG4ubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSg5MykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBuWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSB0ICYmICh0ID0gJycpLCBuID0gdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZS5fd3JhcHBlclN0YXRlID0geyBpbml0aWFsVmFsdWU6IHllKG4pIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBBZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB5ZSh0LnZhbHVlKSwgciA9IHllKHQuZGVmYXVsdFZhbHVlKTsKICAgICAgICAgICAgICAgICAgICBudWxsICE9IG4gJiYgKChuID0gJycgKyBuKSAhPT0gZS52YWx1ZSAmJiAoZS52YWx1ZSA9IG4pLCBudWxsID09IHQuZGVmYXVsdFZhbHVlICYmIGUuZGVmYXVsdFZhbHVlICE9PSBuICYmIChlLmRlZmF1bHRWYWx1ZSA9IG4pKSwgbnVsbCAhPSByICYmIChlLmRlZmF1bHRWYWx1ZSA9ICcnICsgcik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBSZShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnRleHRDb250ZW50OwogICAgICAgICAgICAgICAgICAgIHQgPT09IGUuX3dyYXBwZXJTdGF0ZS5pbml0aWFsVmFsdWUgJiYgJycgIT09IHQgJiYgbnVsbCAhPT0gdCAmJiAoZS52YWx1ZSA9IHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIE5lID0gJ2h0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwnLCBqZSA9ICdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBxZShlKSB7CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnc3ZnJzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWF0aCc6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaHR0cDovL3d3dy53My5vcmcvMTk5OC9NYXRoL01hdGhNTCc7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1sJzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBGZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gZSB8fCAnaHR0cDovL3d3dy53My5vcmcvMTk5OS94aHRtbCcgPT09IGUgPyBxZSh0KSA6ICdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZycgPT09IGUgJiYgJ2ZvcmVpZ25PYmplY3QnID09PSB0ID8gJ2h0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwnIDogZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBEZSwgTWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBNU0FwcCAmJiBNU0FwcC5leGVjVW5zYWZlTG9jYWxGdW5jdGlvbiA/IGZ1bmN0aW9uICh0LCBuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBNU0FwcC5leGVjVW5zYWZlTG9jYWxGdW5jdGlvbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGU7CiAgICAgICAgICAgICAgICAgICAgfShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5uYW1lc3BhY2VVUkkgIT09IGplIHx8ICdpbm5lckhUTUwnIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmlubmVySFRNTCA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICgoRGUgPSBEZSB8fCBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKSkuaW5uZXJIVE1MID0gJzxzdmc+JyArIHQudmFsdWVPZigpLnRvU3RyaW5nKCkgKyAnPC9zdmc+JywgdCA9IERlLmZpcnN0Q2hpbGQ7IGUuZmlyc3RDaGlsZDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5yZW1vdmVDaGlsZChlLmZpcnN0Q2hpbGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHQuZmlyc3RDaGlsZDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5hcHBlbmRDaGlsZCh0LmZpcnN0Q2hpbGQpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBVZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmZpcnN0Q2hpbGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuICYmIG4gPT09IGUubGFzdENoaWxkICYmIDMgPT09IG4ubm9kZVR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAobi5ub2RlVmFsdWUgPSB0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZS50ZXh0Q29udGVudCA9IHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBWZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbltlLnRvTG93ZXJDYXNlKCldID0gdC50b0xvd2VyQ2FzZSgpLCBuWydXZWJraXQnICsgZV0gPSAnd2Via2l0JyArIHQsIG5bJ01veicgKyBlXSA9ICdtb3onICsgdCwgbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBCZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYW5pbWF0aW9uZW5kOiBWZSgnQW5pbWF0aW9uJywgJ0FuaW1hdGlvbkVuZCcpLAogICAgICAgICAgICAgICAgICAgICAgICBhbmltYXRpb25pdGVyYXRpb246IFZlKCdBbmltYXRpb24nLCAnQW5pbWF0aW9uSXRlcmF0aW9uJyksCiAgICAgICAgICAgICAgICAgICAgICAgIGFuaW1hdGlvbnN0YXJ0OiBWZSgnQW5pbWF0aW9uJywgJ0FuaW1hdGlvblN0YXJ0JyksCiAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25lbmQ6IFZlKCdUcmFuc2l0aW9uJywgJ1RyYW5zaXRpb25FbmQnKQogICAgICAgICAgICAgICAgICAgIH0sIHplID0ge30sIEdlID0ge307CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBIZShlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHplW2VdKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gemVbZV07CiAgICAgICAgICAgICAgICAgICAgaWYgKCFCZVtlXSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSBCZVtlXTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHQgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4uaGFzT3duUHJvcGVydHkodCkgJiYgdCBpbiBHZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6ZVtlXSA9IG5bdF07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBfICYmIChHZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpLnN0eWxlLCAnQW5pbWF0aW9uRXZlbnQnIGluIHdpbmRvdyB8fCAoZGVsZXRlIEJlLmFuaW1hdGlvbmVuZC5hbmltYXRpb24sIGRlbGV0ZSBCZS5hbmltYXRpb25pdGVyYXRpb24uYW5pbWF0aW9uLCBkZWxldGUgQmUuYW5pbWF0aW9uc3RhcnQuYW5pbWF0aW9uKSwgJ1RyYW5zaXRpb25FdmVudCcgaW4gd2luZG93IHx8IGRlbGV0ZSBCZS50cmFuc2l0aW9uZW5kLnRyYW5zaXRpb24pOwogICAgICAgICAgICAgICAgdmFyIFdlID0gSGUoJ2FuaW1hdGlvbmVuZCcpLCAkZSA9IEhlKCdhbmltYXRpb25pdGVyYXRpb24nKSwgWWUgPSBIZSgnYW5pbWF0aW9uc3RhcnQnKSwgUWUgPSBIZSgndHJhbnNpdGlvbmVuZCcpLCBLZSA9ICdhYm9ydCBjYW5wbGF5IGNhbnBsYXl0aHJvdWdoIGR1cmF0aW9uY2hhbmdlIGVtcHRpZWQgZW5jcnlwdGVkIGVuZGVkIGVycm9yIGxvYWRlZGRhdGEgbG9hZGVkbWV0YWRhdGEgbG9hZHN0YXJ0IHBhdXNlIHBsYXkgcGxheWluZyBwcm9ncmVzcyByYXRlY2hhbmdlIHNlZWtlZCBzZWVraW5nIHN0YWxsZWQgc3VzcGVuZCB0aW1ldXBkYXRlIHZvbHVtZWNoYW5nZSB3YWl0aW5nJy5zcGxpdCgnICcpLCBKZSA9IG5ldyAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIFdlYWtNYXAgPyBXZWFrTWFwIDogTWFwKSgpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gWGUoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gSmUuZ2V0KGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IHQgJiYgKHQgPSBuZXcgTWFwKCksIEplLnNldChlLCB0KSksIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBaZShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLCBuID0gZTsKICAgICAgICAgICAgICAgICAgICBpZiAoZS5hbHRlcm5hdGUpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyB0LnJldHVybjspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gdC5yZXR1cm47CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAwICE9PSAoMTAyNiAmICh0ID0gZSkuZWZmZWN0VGFnKSAmJiAobiA9IHQucmV0dXJuKSwgZSA9IHQucmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlIChlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDMgPT09IHQudGFnID8gbiA6IG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBldChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEzID09PSBlLnRhZykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubWVtb2l6ZWRTdGF0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IHQgJiYgKG51bGwgIT09IChlID0gZS5hbHRlcm5hdGUpICYmICh0ID0gZS5tZW1vaXplZFN0YXRlKSksIG51bGwgIT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5kZWh5ZHJhdGVkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHR0KGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoWmUoZSkgIT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMTg4KSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBudChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCEoZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuYWx0ZXJuYXRlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09ICh0ID0gWmUoZSkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE4OCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICE9PSBlID8gbnVsbCA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gZSwgciA9IHQ7OykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gbi5yZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gby5hbHRlcm5hdGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IChyID0gby5yZXR1cm4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoby5jaGlsZCA9PT0gaS5jaGlsZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSBvLmNoaWxkOyBpOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR0KG8pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT09IHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR0KG8pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGkuc2libGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE4OCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5yZXR1cm4gIT09IHIucmV0dXJuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbywgciA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSAhMSwgYyA9IG8uY2hpbGQ7IGM7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9PT0gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSAhMCwgbiA9IG8sIHIgPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgPT09IHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gITAsIHIgPSBvLCBuID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBjLnNpYmxpbmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSBpLmNoaWxkOyBjOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID09PSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSAhMCwgbiA9IGksIHIgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgPT09IHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9ICEwLCByID0gaSwgbiA9IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gYy5zaWJsaW5nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMTg5KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4uYWx0ZXJuYXRlICE9PSByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE5MCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDMgIT09IG4udGFnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMTg4KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5zdGF0ZU5vZGUuY3VycmVudCA9PT0gbiA/IGUgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICB9KGUpKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IGU7OykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoNSA9PT0gdC50YWcgfHwgNiA9PT0gdC50YWcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuY2hpbGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmNoaWxkLnJldHVybiA9IHQsIHQgPSB0LmNoaWxkOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7ICF0LnNpYmxpbmc7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0LnJldHVybiB8fCB0LnJldHVybiA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQucmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zaWJsaW5nLnJldHVybiA9IHQucmV0dXJuLCB0ID0gdC5zaWJsaW5nOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcnQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzApKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBlID8gdCA6IEFycmF5LmlzQXJyYXkoZSkgPyBBcnJheS5pc0FycmF5KHQpID8gKGUucHVzaC5hcHBseShlLCB0KSwgZSkgOiAoZS5wdXNoKHQpLCBlKSA6IEFycmF5LmlzQXJyYXkodCkgPyBbZV0uY29uY2F0KHQpIDogWwogICAgICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgICAgICB0CiAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG90KGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBBcnJheS5pc0FycmF5KGUpID8gZS5mb3JFYWNoKHQsIG4pIDogZSAmJiB0LmNhbGwobiwgZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgaXQgPSBudWxsOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gYXQoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5fZGlzcGF0Y2hMaXN0ZW5lcnMsIG4gPSBlLl9kaXNwYXRjaEluc3RhbmNlczsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMDsgciA8IHQubGVuZ3RoICYmICFlLmlzUHJvcGFnYXRpb25TdG9wcGVkKCk7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2KGUsIHRbcl0sIG5bcl0pOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIHYoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIGUuX2Rpc3BhdGNoTGlzdGVuZXJzID0gbnVsbCwgZS5fZGlzcGF0Y2hJbnN0YW5jZXMgPSBudWxsLCBlLmlzUGVyc2lzdGVudCgpIHx8IGUuY29uc3RydWN0b3IucmVsZWFzZShlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzdChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGUgJiYgKGl0ID0gcnQoaXQsIGUpKSwgZSA9IGl0LCBpdCA9IG51bGwsIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG90KGUsIGF0KSwgaXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDk1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgZSA9IGYsIGwgPSAhMSwgZiA9IG51bGwsIGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gY3QoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IGUudGFyZ2V0IHx8IGUuc3JjRWxlbWVudCB8fCB3aW5kb3cpLmNvcnJlc3BvbmRpbmdVc2VFbGVtZW50ICYmIChlID0gZS5jb3JyZXNwb25kaW5nVXNlRWxlbWVudCksIDMgPT09IGUubm9kZVR5cGUgPyBlLnBhcmVudE5vZGUgOiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdXQoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghXykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gKGUgPSAnb24nICsgZSkgaW4gZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgfHwgKCh0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2JykpLnNldEF0dHJpYnV0ZShlLCAncmV0dXJuOycpLCB0ID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHRbZV0pLCB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGx0ID0gW107CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBmdChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS50b3BMZXZlbFR5cGUgPSBudWxsLCBlLm5hdGl2ZUV2ZW50ID0gbnVsbCwgZS50YXJnZXRJbnN0ID0gbnVsbCwgZS5hbmNlc3RvcnMubGVuZ3RoID0gMCwgMTAgPiBsdC5sZW5ndGggJiYgbHQucHVzaChlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHB0KGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobHQubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gbHQucG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLnRvcExldmVsVHlwZSA9IGUsIG8uZXZlbnRTeXN0ZW1GbGFncyA9IHIsIG8ubmF0aXZlRXZlbnQgPSB0LCBvLnRhcmdldEluc3QgPSBuLCBvOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICB0b3BMZXZlbFR5cGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50U3lzdGVtRmxhZ3M6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgIG5hdGl2ZUV2ZW50OiB0LAogICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXRJbnN0OiBuLAogICAgICAgICAgICAgICAgICAgICAgICBhbmNlc3RvcnM6IFtdCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGR0KGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudGFyZ2V0SW5zdCwgbiA9IHQ7CiAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuYW5jZXN0b3JzLnB1c2gobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgzID09PSByLnRhZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSByLnN0YXRlTm9kZS5jb250YWluZXJJbmZvOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyByLnJldHVybjspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHIucmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IDMgIT09IHIudGFnID8gbnVsbCA6IHIuc3RhdGVOb2RlLmNvbnRhaW5lckluZm87CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIDUgIT09ICh0ID0gbi50YWcpICYmIDYgIT09IHQgfHwgZS5hbmNlc3RvcnMucHVzaChuKSwgbiA9IF9uKHIpOwogICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKG4pOwogICAgICAgICAgICAgICAgICAgIGZvciAobiA9IDA7IG4gPCBlLmFuY2VzdG9ycy5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICB0ID0gZS5hbmNlc3RvcnNbbl07CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gY3QoZS5uYXRpdmVFdmVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBlLnRvcExldmVsVHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLm5hdGl2ZUV2ZW50LCBhID0gZS5ldmVudFN5c3RlbUZsYWdzOwogICAgICAgICAgICAgICAgICAgICAgICAwID09PSBuICYmIChhIHw9IDY0KTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgcyA9IG51bGwsIGMgPSAwOyBjIDwgeC5sZW5ndGg7IGMrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSB4W2NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdSAmJiAodSA9IHUuZXh0cmFjdEV2ZW50cyhyLCB0LCBpLCBvLCBhKSkgJiYgKHMgPSBydChzLCB1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgc3Qocyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaHQoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIGlmICghbi5oYXMoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3Njcm9sbCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBZdCh0LCAnc2Nyb2xsJywgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2ZvY3VzJzoKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYmx1cic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBZdCh0LCAnZm9jdXMnLCAhMCksIFl0KHQsICdibHVyJywgITApLCBuLnNldCgnYmx1cicsIG51bGwpLCBuLnNldCgnZm9jdXMnLCBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdjYW5jZWwnOgogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdjbG9zZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1dChlKSAmJiBZdCh0LCBlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaW52YWxpZCc6CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3N1Ym1pdCc6CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3Jlc2V0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEgPT09IEtlLmluZGV4T2YoZSkgJiYgJHQoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgbi5zZXQoZSwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIG10LCBndCwgdnQsIHl0ID0gITEsIGJ0ID0gW10sIEV0ID0gbnVsbCwgd3QgPSBudWxsLCB4dCA9IG51bGwsIFN0ID0gbmV3IE1hcCgpLCBDdCA9IG5ldyBNYXAoKSwga3QgPSBbXSwgVHQgPSAnbW91c2Vkb3duIG1vdXNldXAgdG91Y2hjYW5jZWwgdG91Y2hlbmQgdG91Y2hzdGFydCBhdXhjbGljayBkYmxjbGljayBwb2ludGVyY2FuY2VsIHBvaW50ZXJkb3duIHBvaW50ZXJ1cCBkcmFnZW5kIGRyYWdzdGFydCBkcm9wIGNvbXBvc2l0aW9uZW5kIGNvbXBvc2l0aW9uc3RhcnQga2V5ZG93biBrZXlwcmVzcyBrZXl1cCBpbnB1dCB0ZXh0SW5wdXQgY2xvc2UgY2FuY2VsIGNvcHkgY3V0IHBhc3RlIGNsaWNrIGNoYW5nZSBjb250ZXh0bWVudSByZXNldCBzdWJtaXQnLnNwbGl0KCcgJyksIF90ID0gJ2ZvY3VzIGJsdXIgZHJhZ2VudGVyIGRyYWdsZWF2ZSBtb3VzZW92ZXIgbW91c2VvdXQgcG9pbnRlcm92ZXIgcG9pbnRlcm91dCBnb3Rwb2ludGVyY2FwdHVyZSBsb3N0cG9pbnRlcmNhcHR1cmUnLnNwbGl0KCcgJyk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBQdChlLCB0LCBuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgYmxvY2tlZE9uOiBlLAogICAgICAgICAgICAgICAgICAgICAgICB0b3BMZXZlbFR5cGU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50U3lzdGVtRmxhZ3M6IDMyIHwgbiwKICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlRXZlbnQ6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRhaW5lcjogcgogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBPdChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnZm9jdXMnOgogICAgICAgICAgICAgICAgICAgIGNhc2UgJ2JsdXInOgogICAgICAgICAgICAgICAgICAgICAgICBFdCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgJ2RyYWdlbnRlcic6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnZHJhZ2xlYXZlJzoKICAgICAgICAgICAgICAgICAgICAgICAgd3QgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlICdtb3VzZW92ZXInOgogICAgICAgICAgICAgICAgICAgIGNhc2UgJ21vdXNlb3V0JzoKICAgICAgICAgICAgICAgICAgICAgICAgeHQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlICdwb2ludGVyb3Zlcic6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAncG9pbnRlcm91dCc6CiAgICAgICAgICAgICAgICAgICAgICAgIFN0LmRlbGV0ZSh0LnBvaW50ZXJJZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgJ2dvdHBvaW50ZXJjYXB0dXJlJzoKICAgICAgICAgICAgICAgICAgICBjYXNlICdsb3N0cG9pbnRlcmNhcHR1cmUnOgogICAgICAgICAgICAgICAgICAgICAgICBDdC5kZWxldGUodC5wb2ludGVySWQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEl0KGUsIHQsIG4sIHIsIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gZSB8fCBlLm5hdGl2ZUV2ZW50ICE9PSBpID8gKGUgPSBQdCh0LCBuLCByLCBvLCBpKSwgbnVsbCAhPT0gdCAmJiAobnVsbCAhPT0gKHQgPSBQbih0KSkgJiYgZ3QodCkpLCBlKSA6IChlLmV2ZW50U3lzdGVtRmxhZ3MgfD0gciwgZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMdChlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBfbihlLnRhcmdldCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBaZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMTMgPT09ICh0ID0gbi50YWcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09ICh0ID0gZXQobikpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5ibG9ja2VkT24gPSB0LCB2b2lkIGkudW5zdGFibGVfcnVuV2l0aFByaW9yaXR5KGUucHJpb3JpdHksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZ0KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoMyA9PT0gdCAmJiBuLnN0YXRlTm9kZS5oeWRyYXRlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIChlLmJsb2NrZWRPbiA9IDMgPT09IG4udGFnID8gbi5zdGF0ZU5vZGUuY29udGFpbmVySW5mbyA6IG51bGwpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBlLmJsb2NrZWRPbiA9IG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBBdChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGUuYmxvY2tlZE9uKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBYdChlLnRvcExldmVsVHlwZSwgZS5ldmVudFN5c3RlbUZsYWdzLCBlLmNvbnRhaW5lciwgZS5uYXRpdmVFdmVudCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBQbih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IG4gJiYgZ3QobiksIGUuYmxvY2tlZE9uID0gdCwgITE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFJ0KGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBBdChlKSAmJiBuLmRlbGV0ZSh0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE50KCkgewogICAgICAgICAgICAgICAgICAgIGZvciAoeXQgPSAhMTsgMCA8IGJ0Lmxlbmd0aDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBidFswXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGUuYmxvY2tlZE9uKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9PSAoZSA9IFBuKGUuYmxvY2tlZE9uKSkgJiYgbXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFh0KGUudG9wTGV2ZWxUeXBlLCBlLmV2ZW50U3lzdGVtRmxhZ3MsIGUuY29udGFpbmVyLCBlLm5hdGl2ZUV2ZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gdCA/IGUuYmxvY2tlZE9uID0gdCA6IGJ0LnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG51bGwgIT09IEV0ICYmIEF0KEV0KSAmJiAoRXQgPSBudWxsKSwgbnVsbCAhPT0gd3QgJiYgQXQod3QpICYmICh3dCA9IG51bGwpLCBudWxsICE9PSB4dCAmJiBBdCh4dCkgJiYgKHh0ID0gbnVsbCksIFN0LmZvckVhY2goUnQpLCBDdC5mb3JFYWNoKFJ0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGp0KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBlLmJsb2NrZWRPbiA9PT0gdCAmJiAoZS5ibG9ja2VkT24gPSBudWxsLCB5dCB8fCAoeXQgPSAhMCwgaS51bnN0YWJsZV9zY2hlZHVsZUNhbGxiYWNrKGkudW5zdGFibGVfTm9ybWFsUHJpb3JpdHksIE50KSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcXQoZSkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ganQodCwgZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICgwIDwgYnQubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGp0KGJ0WzBdLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDE7IG4gPCBidC5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBidFtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuYmxvY2tlZE9uID09PSBlICYmIChyLmJsb2NrZWRPbiA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZvciAobnVsbCAhPT0gRXQgJiYganQoRXQsIGUpLCBudWxsICE9PSB3dCAmJiBqdCh3dCwgZSksIG51bGwgIT09IHh0ICYmIGp0KHh0LCBlKSwgU3QuZm9yRWFjaCh0KSwgQ3QuZm9yRWFjaCh0KSwgbiA9IDA7IG4gPCBrdC5sZW5ndGg7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgKHIgPSBrdFtuXSkuYmxvY2tlZE9uID09PSBlICYmIChyLmJsb2NrZWRPbiA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgIGZvciAoOyAwIDwga3QubGVuZ3RoICYmIG51bGwgPT09IChuID0ga3RbMF0pLmJsb2NrZWRPbjspCiAgICAgICAgICAgICAgICAgICAgICAgIEx0KG4pLCBudWxsID09PSBuLmJsb2NrZWRPbiAmJiBrdC5zaGlmdCgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIEZ0ID0ge30sIER0ID0gbmV3IE1hcCgpLCBNdCA9IG5ldyBNYXAoKSwgVXQgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICdhYm9ydCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdhYm9ydCcsCiAgICAgICAgICAgICAgICAgICAgICAgIFdlLAogICAgICAgICAgICAgICAgICAgICAgICAnYW5pbWF0aW9uRW5kJywKICAgICAgICAgICAgICAgICAgICAgICAgJGUsCiAgICAgICAgICAgICAgICAgICAgICAgICdhbmltYXRpb25JdGVyYXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICBZZSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2FuaW1hdGlvblN0YXJ0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ2NhbnBsYXknLAogICAgICAgICAgICAgICAgICAgICAgICAnY2FuUGxheScsCiAgICAgICAgICAgICAgICAgICAgICAgICdjYW5wbGF5dGhyb3VnaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdjYW5QbGF5VGhyb3VnaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdkdXJhdGlvbmNoYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdkdXJhdGlvbkNoYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdlbXB0aWVkJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2VtcHRpZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnZW5jcnlwdGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2VuY3J5cHRlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdlbmRlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdlbmRlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdlcnJvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICdlcnJvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICdnb3Rwb2ludGVyY2FwdHVyZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdnb3RQb2ludGVyQ2FwdHVyZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdsb2FkJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xvYWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnbG9hZGVkZGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICdsb2FkZWREYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xvYWRlZG1ldGFkYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xvYWRlZE1ldGFkYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xvYWRzdGFydCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdsb2FkU3RhcnQnLAogICAgICAgICAgICAgICAgICAgICAgICAnbG9zdHBvaW50ZXJjYXB0dXJlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xvc3RQb2ludGVyQ2FwdHVyZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdwbGF5aW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3BsYXlpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnLAogICAgICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnLAogICAgICAgICAgICAgICAgICAgICAgICAnc2Vla2luZycsCiAgICAgICAgICAgICAgICAgICAgICAgICdzZWVraW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3N0YWxsZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnc3RhbGxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdzdXNwZW5kJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3N1c3BlbmQnLAogICAgICAgICAgICAgICAgICAgICAgICAndGltZXVwZGF0ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICd0aW1lVXBkYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgUWUsCiAgICAgICAgICAgICAgICAgICAgICAgICd0cmFuc2l0aW9uRW5kJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3dhaXRpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAnd2FpdGluZycKICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gVnQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgZS5sZW5ndGg7IG4gKz0gMikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGVbbl0sIG8gPSBlW24gKyAxXSwgaSA9ICdvbicgKyAob1swXS50b1VwcGVyQ2FzZSgpICsgby5zbGljZSgxKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaGFzZWRSZWdpc3RyYXRpb25OYW1lczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZWQ6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FwdHVyZWQ6IGkgKyAnQ2FwdHVyZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXBlbmRlbmNpZXM6IFtyXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50UHJpb3JpdHk6IHQKICAgICAgICAgICAgICAgICAgICAgICAgfSwgTXQuc2V0KHIsIHQpLCBEdC5zZXQociwgaSksIEZ0W29dID0gaTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBWdCgnYmx1ciBibHVyIGNhbmNlbCBjYW5jZWwgY2xpY2sgY2xpY2sgY2xvc2UgY2xvc2UgY29udGV4dG1lbnUgY29udGV4dE1lbnUgY29weSBjb3B5IGN1dCBjdXQgYXV4Y2xpY2sgYXV4Q2xpY2sgZGJsY2xpY2sgZG91YmxlQ2xpY2sgZHJhZ2VuZCBkcmFnRW5kIGRyYWdzdGFydCBkcmFnU3RhcnQgZHJvcCBkcm9wIGZvY3VzIGZvY3VzIGlucHV0IGlucHV0IGludmFsaWQgaW52YWxpZCBrZXlkb3duIGtleURvd24ga2V5cHJlc3Mga2V5UHJlc3Mga2V5dXAga2V5VXAgbW91c2Vkb3duIG1vdXNlRG93biBtb3VzZXVwIG1vdXNlVXAgcGFzdGUgcGFzdGUgcGF1c2UgcGF1c2UgcGxheSBwbGF5IHBvaW50ZXJjYW5jZWwgcG9pbnRlckNhbmNlbCBwb2ludGVyZG93biBwb2ludGVyRG93biBwb2ludGVydXAgcG9pbnRlclVwIHJhdGVjaGFuZ2UgcmF0ZUNoYW5nZSByZXNldCByZXNldCBzZWVrZWQgc2Vla2VkIHN1Ym1pdCBzdWJtaXQgdG91Y2hjYW5jZWwgdG91Y2hDYW5jZWwgdG91Y2hlbmQgdG91Y2hFbmQgdG91Y2hzdGFydCB0b3VjaFN0YXJ0IHZvbHVtZWNoYW5nZSB2b2x1bWVDaGFuZ2UnLnNwbGl0KCcgJyksIDApLCBWdCgnZHJhZyBkcmFnIGRyYWdlbnRlciBkcmFnRW50ZXIgZHJhZ2V4aXQgZHJhZ0V4aXQgZHJhZ2xlYXZlIGRyYWdMZWF2ZSBkcmFnb3ZlciBkcmFnT3ZlciBtb3VzZW1vdmUgbW91c2VNb3ZlIG1vdXNlb3V0IG1vdXNlT3V0IG1vdXNlb3ZlciBtb3VzZU92ZXIgcG9pbnRlcm1vdmUgcG9pbnRlck1vdmUgcG9pbnRlcm91dCBwb2ludGVyT3V0IHBvaW50ZXJvdmVyIHBvaW50ZXJPdmVyIHNjcm9sbCBzY3JvbGwgdG9nZ2xlIHRvZ2dsZSB0b3VjaG1vdmUgdG91Y2hNb3ZlIHdoZWVsIHdoZWVsJy5zcGxpdCgnICcpLCAxKSwgVnQoVXQsIDIpOwogICAgICAgICAgICAgICAgZm9yICh2YXIgQnQgPSAnY2hhbmdlIHNlbGVjdGlvbmNoYW5nZSB0ZXh0SW5wdXQgY29tcG9zaXRpb25zdGFydCBjb21wb3NpdGlvbmVuZCBjb21wb3NpdGlvbnVwZGF0ZScuc3BsaXQoJyAnKSwgenQgPSAwOyB6dCA8IEJ0Lmxlbmd0aDsgenQrKykKICAgICAgICAgICAgICAgICAgICBNdC5zZXQoQnRbenRdLCAwKTsKICAgICAgICAgICAgICAgIHZhciBHdCA9IGkudW5zdGFibGVfVXNlckJsb2NraW5nUHJpb3JpdHksIEh0ID0gaS51bnN0YWJsZV9ydW5XaXRoUHJpb3JpdHksIFd0ID0gITA7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiAkdChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgWXQodCwgZSwgITEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gWXQoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gTXQuZ2V0KHQpOwogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodm9pZCAwID09PSByID8gMiA6IHIpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBRdC5iaW5kKG51bGwsIHQsIDEsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBLdC5iaW5kKG51bGwsIHQsIDEsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICByID0gSnQuYmluZChudWxsLCB0LCAxLCBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbiA/IGUuYWRkRXZlbnRMaXN0ZW5lcih0LCByLCAhMCkgOiBlLmFkZEV2ZW50TGlzdGVuZXIodCwgciwgITEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUXQoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIEQgfHwgcSgpOwogICAgICAgICAgICAgICAgICAgIHZhciBvID0gSnQsIGkgPSBEOwogICAgICAgICAgICAgICAgICAgIEQgPSAhMDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBqKG8sIGUsIHQsIG4sIHIpOwogICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgIChEID0gaSkgfHwgVSgpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEt0KGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICBIdChHdCwgSnQuYmluZChudWxsLCBlLCB0LCBuLCByKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBKdChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKFd0KQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA8IGJ0Lmxlbmd0aCAmJiAtMSA8IFR0LmluZGV4T2YoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gUHQobnVsbCwgZSwgdCwgbiwgciksIGJ0LnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBYdChlLCB0LCBuLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE90KGUsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoLTEgPCBUdC5pbmRleE9mKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBQdChvLCBlLCB0LCBuLCByKSwgYnQucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCFmdW5jdGlvbiAoZSwgdCwgbiwgciwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZm9jdXMnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEV0ID0gSXQoRXQsIGUsIHQsIG4sIHIsIG8pLCAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZHJhZ2VudGVyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3dCA9IEl0KHd0LCBlLCB0LCBuLCByLCBvKSwgITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ21vdXNlb3Zlcic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geHQgPSBJdCh4dCwgZSwgdCwgbiwgciwgbyksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdwb2ludGVyb3Zlcic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG8ucG9pbnRlcklkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFN0LnNldChpLCBJdChTdC5nZXQoaSkgfHwgbnVsbCwgZSwgdCwgbiwgciwgbykpLCAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZ290cG9pbnRlcmNhcHR1cmUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgPSBvLnBvaW50ZXJJZCwgQ3Quc2V0KGksIEl0KEN0LmdldChpKSB8fCBudWxsLCBlLCB0LCBuLCByLCBvKSksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG8sIGUsIHQsIG4sIHIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT3QoZSwgciksIGUgPSBwdChlLCByLCBudWxsLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWKGR0LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFh0KGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gKG4gPSBfbihuID0gY3QocikpKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IFplKG4pOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gby50YWc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMTMgPT09IGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gKG4gPSBldChvKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgzID09PSBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8uc3RhdGVOb2RlLmh5ZHJhdGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAzID09PSBvLnRhZyA/IG8uc3RhdGVOb2RlLmNvbnRhaW5lckluZm8gOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyAhPT0gbiAmJiAobiA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGUgPSBwdChlLCByLCBuLCB0KTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBWKGR0LCBlKTsKICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICBmdChlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgWnQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGFuaW1hdGlvbkl0ZXJhdGlvbkNvdW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVySW1hZ2VPdXRzZXQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJJbWFnZVNsaWNlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVySW1hZ2VXaWR0aDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGJveEZsZXg6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBib3hGbGV4R3JvdXA6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBib3hPcmRpbmFsR3JvdXA6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjb2x1bW5Db3VudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbnM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBmbGV4OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZmxleEdyb3c6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBmbGV4UG9zaXRpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBmbGV4U2hyaW5rOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZmxleE5lZ2F0aXZlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZmxleE9yZGVyOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZ3JpZEFyZWE6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBncmlkUm93OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZ3JpZFJvd0VuZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGdyaWRSb3dTcGFuOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZ3JpZFJvd1N0YXJ0OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZ3JpZENvbHVtbjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGdyaWRDb2x1bW5FbmQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBncmlkQ29sdW1uU3BhbjogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGdyaWRDb2x1bW5TdGFydDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGZvbnRXZWlnaHQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBsaW5lQ2xhbXA6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBsaW5lSGVpZ2h0OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgb3BhY2l0eTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIG9yZGVyOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgb3JwaGFuczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHRhYlNpemU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB3aWRvd3M6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB6SW5kZXg6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB6b29tOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZmlsbE9wYWNpdHk6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBmbG9vZE9wYWNpdHk6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBzdG9wT3BhY2l0eTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm9rZURhc2hhcnJheTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm9rZURhc2hvZmZzZXQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBzdHJva2VNaXRlcmxpbWl0OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgc3Ryb2tlT3BhY2l0eTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm9rZVdpZHRoOiAhMAogICAgICAgICAgICAgICAgICAgIH0sIGVuID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnV2Via2l0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ21zJywKICAgICAgICAgICAgICAgICAgICAgICAgJ01veicsCiAgICAgICAgICAgICAgICAgICAgICAgICdPJwogICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB0bihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gdCB8fCAnYm9vbGVhbicgPT09IHR5cGVvZiB0IHx8ICcnID09PSB0ID8gJycgOiBuIHx8ICdudW1iZXInICE9PSB0eXBlb2YgdCB8fCAwID09PSB0IHx8IFp0Lmhhc093blByb3BlcnR5KGUpICYmIFp0W2VdID8gKCcnICsgdCkudHJpbSgpIDogdCArICdweCc7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBubihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiAoZSA9IGUuc3R5bGUsIHQpKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5oYXNPd25Qcm9wZXJ0eShuKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAwID09PSBuLmluZGV4T2YoJy0tJyksIG8gPSB0bihuLCB0W25dLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmbG9hdCcgPT09IG4gJiYgKG4gPSAnY3NzRmxvYXQnKSwgciA/IGUuc2V0UHJvcGVydHkobiwgbykgOiBlW25dID0gbzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoWnQpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlbi5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0ICsgZS5jaGFyQXQoMCkudG9VcHBlckNhc2UoKSArIGUuc3Vic3RyaW5nKDEpLCBadFt0XSA9IFp0W2VdOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgcm4gPSBvKHsgbWVudWl0ZW06ICEwIH0sIHsKICAgICAgICAgICAgICAgICAgICBhcmVhOiAhMCwKICAgICAgICAgICAgICAgICAgICBiYXNlOiAhMCwKICAgICAgICAgICAgICAgICAgICBicjogITAsCiAgICAgICAgICAgICAgICAgICAgY29sOiAhMCwKICAgICAgICAgICAgICAgICAgICBlbWJlZDogITAsCiAgICAgICAgICAgICAgICAgICAgaHI6ICEwLAogICAgICAgICAgICAgICAgICAgIGltZzogITAsCiAgICAgICAgICAgICAgICAgICAgaW5wdXQ6ICEwLAogICAgICAgICAgICAgICAgICAgIGtleWdlbjogITAsCiAgICAgICAgICAgICAgICAgICAgbGluazogITAsCiAgICAgICAgICAgICAgICAgICAgbWV0YTogITAsCiAgICAgICAgICAgICAgICAgICAgcGFyYW06ICEwLAogICAgICAgICAgICAgICAgICAgIHNvdXJjZTogITAsCiAgICAgICAgICAgICAgICAgICAgdHJhY2s6ICEwLAogICAgICAgICAgICAgICAgICAgIHdicjogITAKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gb24oZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChybltlXSAmJiAobnVsbCAhPSB0LmNoaWxkcmVuIHx8IG51bGwgIT0gdC5kYW5nZXJvdXNseVNldElubmVySFRNTCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDEzNywgZSwgJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gdC5kYW5nZXJvdXNseVNldElubmVySFRNTCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gdC5jaGlsZHJlbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDYwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgIT09IHR5cGVvZiB0LmRhbmdlcm91c2x5U2V0SW5uZXJIVE1MIHx8ICEoJ19faHRtbCcgaW4gdC5kYW5nZXJvdXNseVNldElubmVySFRNTCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSg2MSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IHQuc3R5bGUgJiYgJ29iamVjdCcgIT09IHR5cGVvZiB0LnN0eWxlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSg2MiwgJycpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhbihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKC0xID09PSBlLmluZGV4T2YoJy0nKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09PSB0eXBlb2YgdC5pczsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlICdhbm5vdGF0aW9uLXhtbCc6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnY29sb3ItcHJvZmlsZSc6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnZm9udC1mYWNlJzoKICAgICAgICAgICAgICAgICAgICBjYXNlICdmb250LWZhY2Utc3JjJzoKICAgICAgICAgICAgICAgICAgICBjYXNlICdmb250LWZhY2UtdXJpJzoKICAgICAgICAgICAgICAgICAgICBjYXNlICdmb250LWZhY2UtZm9ybWF0JzoKICAgICAgICAgICAgICAgICAgICBjYXNlICdmb250LWZhY2UtbmFtZSc6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnbWlzc2luZy1nbHlwaCc6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHNuID0gTmU7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBjbihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBYZShlID0gOSA9PT0gZS5ub2RlVHlwZSB8fCAxMSA9PT0gZS5ub2RlVHlwZSA/IGUgOiBlLm93bmVyRG9jdW1lbnQpOwogICAgICAgICAgICAgICAgICAgIHQgPSBrW3RdOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSAwOyByIDwgdC5sZW5ndGg7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgaHQodFtyXSwgZSwgbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB1bigpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGxuKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgPT09IHR5cGVvZiAoZSA9IGUgfHwgKCd1bmRlZmluZWQnICE9PSB0eXBlb2YgZG9jdW1lbnQgPyBkb2N1bWVudCA6IHZvaWQgMCkpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hY3RpdmVFbGVtZW50IHx8IGUuYm9keTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmJvZHk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZm4oZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAoOyBlICYmIGUuZmlyc3RDaGlsZDspCiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLmZpcnN0Q2hpbGQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBwbihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIgPSBmbihlKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSAwOyByOykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMyA9PT0gci5ub2RlVHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSBlICsgci50ZXh0Q29udGVudC5sZW5ndGgsIGUgPD0gdCAmJiBuID49IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9kZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2Zmc2V0OiB0IC0gZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgcjspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5uZXh0U2libGluZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gci5uZXh0U2libGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHIucGFyZW50Tm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgciA9IGZuKHIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRuKCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSB3aW5kb3csIHQgPSBsbigpOyB0IGluc3RhbmNlb2YgZS5IVE1MSUZyYW1lRWxlbWVudDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJ3N0cmluZycgPT09IHR5cGVvZiB0LmNvbnRlbnRXaW5kb3cubG9jYXRpb24uaHJlZjsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICB0ID0gbG4oKGUgPSB0LmNvbnRlbnRXaW5kb3cpLmRvY3VtZW50KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBobihlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlICYmIGUubm9kZU5hbWUgJiYgZS5ub2RlTmFtZS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmICgnaW5wdXQnID09PSB0ICYmICgndGV4dCcgPT09IGUudHlwZSB8fCAnc2VhcmNoJyA9PT0gZS50eXBlIHx8ICd0ZWwnID09PSBlLnR5cGUgfHwgJ3VybCcgPT09IGUudHlwZSB8fCAncGFzc3dvcmQnID09PSBlLnR5cGUpIHx8ICd0ZXh0YXJlYScgPT09IHQgfHwgJ3RydWUnID09PSBlLmNvbnRlbnRFZGl0YWJsZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgbW4gPSBudWxsLCBnbiA9IG51bGw7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2bihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnYnV0dG9uJzoKICAgICAgICAgICAgICAgICAgICBjYXNlICdpbnB1dCc6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnc2VsZWN0JzoKICAgICAgICAgICAgICAgICAgICBjYXNlICd0ZXh0YXJlYSc6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXQuYXV0b0ZvY3VzOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5bihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0ZXh0YXJlYScgPT09IGUgfHwgJ29wdGlvbicgPT09IGUgfHwgJ25vc2NyaXB0JyA9PT0gZSB8fCAnc3RyaW5nJyA9PT0gdHlwZW9mIHQuY2hpbGRyZW4gfHwgJ251bWJlcicgPT09IHR5cGVvZiB0LmNoaWxkcmVuIHx8ICdvYmplY3QnID09PSB0eXBlb2YgdC5kYW5nZXJvdXNseVNldElubmVySFRNTCAmJiBudWxsICE9PSB0LmRhbmdlcm91c2x5U2V0SW5uZXJIVE1MICYmIG51bGwgIT0gdC5kYW5nZXJvdXNseVNldElubmVySFRNTC5fX2h0bWw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgYm4gPSAnZnVuY3Rpb24nID09PSB0eXBlb2Ygc2V0VGltZW91dCA/IHNldFRpbWVvdXQgOiB2b2lkIDAsIEVuID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGNsZWFyVGltZW91dCA/IGNsZWFyVGltZW91dCA6IHZvaWQgMDsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHduKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbnVsbCAhPSBlOyBlID0gZS5uZXh0U2libGluZykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubm9kZVR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxID09PSB0IHx8IDMgPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB4bihlKSB7CiAgICAgICAgICAgICAgICAgICAgZSA9IGUucHJldmlvdXNTaWJsaW5nOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAwOyBlOykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoOCA9PT0gZS5ub2RlVHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmRhdGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJyQnID09PSBuIHx8ICckIScgPT09IG4gfHwgJyQ/JyA9PT0gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LS07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLyQnID09PSBuICYmIHQrKzsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5wcmV2aW91c1NpYmxpbmc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIFNuID0gTWF0aC5yYW5kb20oKS50b1N0cmluZygzNikuc2xpY2UoMiksIENuID0gJ19fcmVhY3RJbnRlcm5hbEluc3RhbmNlJCcgKyBTbiwga24gPSAnX19yZWFjdEV2ZW50SGFuZGxlcnMkJyArIFNuLCBUbiA9ICdfX3JlYWN0Q29udGFpbmVyZSQnICsgU247CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBfbihlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW0NuXTsKICAgICAgICAgICAgICAgICAgICBpZiAodCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IGUucGFyZW50Tm9kZTsgbjspIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPSBuW1RuXSB8fCBuW0NuXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSB0LmFsdGVybmF0ZSwgbnVsbCAhPT0gdC5jaGlsZCB8fCBudWxsICE9PSBuICYmIG51bGwgIT09IG4uY2hpbGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlID0geG4oZSk7IG51bGwgIT09IGU7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID0gZVtDbl0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHhuKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAoZSA9IG4pLnBhcmVudE5vZGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUG4oZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhKGUgPSBlW0NuXSB8fCBlW1RuXSkgfHwgNSAhPT0gZS50YWcgJiYgNiAhPT0gZS50YWcgJiYgMTMgIT09IGUudGFnICYmIDMgIT09IGUudGFnID8gbnVsbCA6IGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBPbihlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDUgPT09IGUudGFnIHx8IDYgPT09IGUudGFnKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgzMykpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSW4oZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlW2tuXSB8fCBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTG4oZSkgewogICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUucmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGUgJiYgNSAhPT0gZS50YWcpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlIHx8IG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBBbihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLnN0YXRlTm9kZTsKICAgICAgICAgICAgICAgICAgICBpZiAoIW4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIHZhciByID0gaChuKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIXIpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIG4gPSByW3RdOwogICAgICAgICAgICAgICAgICAgIGU6CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdvbkNsaWNrJzoKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnb25DbGlja0NhcHR1cmUnOgogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdvbkRvdWJsZUNsaWNrJzoKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnb25Eb3VibGVDbGlja0NhcHR1cmUnOgogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdvbk1vdXNlRG93bic6CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ29uTW91c2VEb3duQ2FwdHVyZSc6CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ29uTW91c2VNb3ZlJzoKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnb25Nb3VzZU1vdmVDYXB0dXJlJzoKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnb25Nb3VzZVVwJzoKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnb25Nb3VzZVVwQ2FwdHVyZSc6CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ29uTW91c2VFbnRlcic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAociA9ICFyLmRpc2FibGVkKSB8fCAociA9ICEoJ2J1dHRvbicgPT09IChlID0gZS50eXBlKSB8fCAnaW5wdXQnID09PSBlIHx8ICdzZWxlY3QnID09PSBlIHx8ICd0ZXh0YXJlYScgPT09IGUpKSwgZSA9ICFyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZiAobiAmJiAnZnVuY3Rpb24nICE9PSB0eXBlb2YgbikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgyMzEsIHQsIHR5cGVvZiBuKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBSbihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgKHQgPSBBbihlLCBuLmRpc3BhdGNoQ29uZmlnLnBoYXNlZFJlZ2lzdHJhdGlvbk5hbWVzW3RdKSkgJiYgKG4uX2Rpc3BhdGNoTGlzdGVuZXJzID0gcnQobi5fZGlzcGF0Y2hMaXN0ZW5lcnMsIHQpLCBuLl9kaXNwYXRjaEluc3RhbmNlcyA9IHJ0KG4uX2Rpc3BhdGNoSW5zdGFuY2VzLCBlKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBObihlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZS5kaXNwYXRjaENvbmZpZy5waGFzZWRSZWdpc3RyYXRpb25OYW1lcykgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gZS5fdGFyZ2V0SW5zdCwgbiA9IFtdOyB0OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucHVzaCh0KSwgdCA9IExuKHQpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSBuLmxlbmd0aDsgMCA8IHQtLTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSbihuW3RdLCAnY2FwdHVyZWQnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0ID0gMDsgdCA8IG4ubGVuZ3RoOyB0KyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSbihuW3RdLCAnYnViYmxlZCcsIGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGpuKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBlICYmIG4gJiYgbi5kaXNwYXRjaENvbmZpZy5yZWdpc3RyYXRpb25OYW1lICYmICh0ID0gQW4oZSwgbi5kaXNwYXRjaENvbmZpZy5yZWdpc3RyYXRpb25OYW1lKSkgJiYgKG4uX2Rpc3BhdGNoTGlzdGVuZXJzID0gcnQobi5fZGlzcGF0Y2hMaXN0ZW5lcnMsIHQpLCBuLl9kaXNwYXRjaEluc3RhbmNlcyA9IHJ0KG4uX2Rpc3BhdGNoSW5zdGFuY2VzLCBlKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBxbihlKSB7CiAgICAgICAgICAgICAgICAgICAgZSAmJiBlLmRpc3BhdGNoQ29uZmlnLnJlZ2lzdHJhdGlvbk5hbWUgJiYgam4oZS5fdGFyZ2V0SW5zdCwgbnVsbCwgZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBGbihlKSB7CiAgICAgICAgICAgICAgICAgICAgb3QoZSwgTm4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIERuID0gbnVsbCwgTW4gPSBudWxsLCBVbiA9IG51bGw7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBWbigpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoVW4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBVbjsKICAgICAgICAgICAgICAgICAgICB2YXIgZSwgdCwgbiA9IE1uLCByID0gbi5sZW5ndGgsIG8gPSAndmFsdWUnIGluIERuID8gRG4udmFsdWUgOiBEbi50ZXh0Q29udGVudCwgaSA9IG8ubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IDA7IGUgPCByICYmIG5bZV0gPT09IG9bZV07IGUrKyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSByIC0gZTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSAxOyB0IDw9IGEgJiYgbltyIC0gdF0gPT09IG9baSAtIHRdOyB0KyspOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBVbiA9IG8uc2xpY2UoZSwgMSA8IHQgPyAxIC0gdCA6IHZvaWQgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBCbigpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB6bigpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBHbihlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbyBpbiAodGhpcy5kaXNwYXRjaENvbmZpZyA9IGUsIHRoaXMuX3RhcmdldEluc3QgPSB0LCB0aGlzLm5hdGl2ZUV2ZW50ID0gbiwgZSA9IHRoaXMuY29uc3RydWN0b3IuSW50ZXJmYWNlKSkKICAgICAgICAgICAgICAgICAgICAgICAgZS5oYXNPd25Qcm9wZXJ0eShvKSAmJiAoKHQgPSBlW29dKSA/IHRoaXNbb10gPSB0KG4pIDogJ3RhcmdldCcgPT09IG8gPyB0aGlzLnRhcmdldCA9IHIgOiB0aGlzW29dID0gbltvXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaXNEZWZhdWx0UHJldmVudGVkID0gKG51bGwgIT0gbi5kZWZhdWx0UHJldmVudGVkID8gbi5kZWZhdWx0UHJldmVudGVkIDogITEgPT09IG4ucmV0dXJuVmFsdWUpID8gQm4gOiB6biwgdGhpcy5pc1Byb3BhZ2F0aW9uU3RvcHBlZCA9IHpuLCB0aGlzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSG4oZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmV2ZW50UG9vbC5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0aGlzLmV2ZW50UG9vbC5wb3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuY2FsbChvLCBlLCB0LCBuLCByKSwgbzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyB0aGlzKGUsIHQsIG4sIHIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gV24oZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiB0aGlzKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgyNzkpKTsKICAgICAgICAgICAgICAgICAgICBlLmRlc3RydWN0b3IoKSwgMTAgPiB0aGlzLmV2ZW50UG9vbC5sZW5ndGggJiYgdGhpcy5ldmVudFBvb2wucHVzaChlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uICRuKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLmV2ZW50UG9vbCA9IFtdLCBlLmdldFBvb2xlZCA9IEhuLCBlLnJlbGVhc2UgPSBXbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG8oR24ucHJvdG90eXBlLCB7CiAgICAgICAgICAgICAgICAgICAgcHJldmVudERlZmF1bHQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWZhdWx0UHJldmVudGVkID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5uYXRpdmVFdmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiAoZS5wcmV2ZW50RGVmYXVsdCA/IGUucHJldmVudERlZmF1bHQoKSA6ICd1bmtub3duJyAhPT0gdHlwZW9mIGUucmV0dXJuVmFsdWUgJiYgKGUucmV0dXJuVmFsdWUgPSAhMSksIHRoaXMuaXNEZWZhdWx0UHJldmVudGVkID0gQm4pOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgc3RvcFByb3BhZ2F0aW9uOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5uYXRpdmVFdmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiAoZS5zdG9wUHJvcGFnYXRpb24gPyBlLnN0b3BQcm9wYWdhdGlvbigpIDogJ3Vua25vd24nICE9PSB0eXBlb2YgZS5jYW5jZWxCdWJibGUgJiYgKGUuY2FuY2VsQnViYmxlID0gITApLCB0aGlzLmlzUHJvcGFnYXRpb25TdG9wcGVkID0gQm4pOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcGVyc2lzdDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmlzUGVyc2lzdGVudCA9IEJuOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaXNQZXJzaXN0ZW50OiB6biwKICAgICAgICAgICAgICAgICAgICBkZXN0cnVjdG9yOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0ID0gdGhpcy5jb25zdHJ1Y3Rvci5JbnRlcmZhY2U7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1tlXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubmF0aXZlRXZlbnQgPSB0aGlzLl90YXJnZXRJbnN0ID0gdGhpcy5kaXNwYXRjaENvbmZpZyA9IG51bGwsIHRoaXMuaXNQcm9wYWdhdGlvblN0b3BwZWQgPSB0aGlzLmlzRGVmYXVsdFByZXZlbnRlZCA9IHpuLCB0aGlzLl9kaXNwYXRjaEluc3RhbmNlcyA9IHRoaXMuX2Rpc3BhdGNoTGlzdGVuZXJzID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KSwgR24uSW50ZXJmYWNlID0gewogICAgICAgICAgICAgICAgICAgIHR5cGU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBudWxsLAogICAgICAgICAgICAgICAgICAgIGN1cnJlbnRUYXJnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBldmVudFBoYXNlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIGJ1YmJsZXM6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogbnVsbCwKICAgICAgICAgICAgICAgICAgICB0aW1lU3RhbXA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRpbWVTdGFtcCB8fCBEYXRlLm5vdygpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFByZXZlbnRlZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICBpc1RydXN0ZWQ6IG51bGwKICAgICAgICAgICAgICAgIH0sIEduLmV4dGVuZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgIHQucHJvdG90eXBlID0gci5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuZXcgdCgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBvKGksIG4ucHJvdG90eXBlKSwgbi5wcm90b3R5cGUgPSBpLCBuLnByb3RvdHlwZS5jb25zdHJ1Y3RvciA9IG4sIG4uSW50ZXJmYWNlID0gbyh7fSwgci5JbnRlcmZhY2UsIGUpLCBuLmV4dGVuZCA9IHIuZXh0ZW5kLCAkbihuKSwgbjsKICAgICAgICAgICAgICAgIH0sICRuKEduKTsKICAgICAgICAgICAgICAgIHZhciBZbiA9IEduLmV4dGVuZCh7IGRhdGE6IG51bGwgfSksIFFuID0gR24uZXh0ZW5kKHsgZGF0YTogbnVsbCB9KSwgS24gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIDksCiAgICAgICAgICAgICAgICAgICAgICAgIDEzLAogICAgICAgICAgICAgICAgICAgICAgICAyNywKICAgICAgICAgICAgICAgICAgICAgICAgMzIKICAgICAgICAgICAgICAgICAgICBdLCBKbiA9IF8gJiYgJ0NvbXBvc2l0aW9uRXZlbnQnIGluIHdpbmRvdywgWG4gPSBudWxsOwogICAgICAgICAgICAgICAgXyAmJiAnZG9jdW1lbnRNb2RlJyBpbiBkb2N1bWVudCAmJiAoWG4gPSBkb2N1bWVudC5kb2N1bWVudE1vZGUpOwogICAgICAgICAgICAgICAgdmFyIFpuID0gXyAmJiAnVGV4dEV2ZW50JyBpbiB3aW5kb3cgJiYgIVhuLCBlciA9IF8gJiYgKCFKbiB8fCBYbiAmJiA4IDwgWG4gJiYgMTEgPj0gWG4pLCB0ciA9IFN0cmluZy5mcm9tQ2hhckNvZGUoMzIpLCBuciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYmVmb3JlSW5wdXQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBoYXNlZFJlZ2lzdHJhdGlvbk5hbWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlZDogJ29uQmVmb3JlSW5wdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhcHR1cmVkOiAnb25CZWZvcmVJbnB1dENhcHR1cmUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVwZW5kZW5jaWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbXBvc2l0aW9uZW5kJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAna2V5cHJlc3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0ZXh0SW5wdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwYXN0ZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9zaXRpb25FbmQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBoYXNlZFJlZ2lzdHJhdGlvbk5hbWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlZDogJ29uQ29tcG9zaXRpb25FbmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhcHR1cmVkOiAnb25Db21wb3NpdGlvbkVuZENhcHR1cmUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVwZW5kZW5jaWVzOiAnYmx1ciBjb21wb3NpdGlvbmVuZCBrZXlkb3duIGtleXByZXNzIGtleXVwIG1vdXNlZG93bicuc3BsaXQoJyAnKQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBjb21wb3NpdGlvblN0YXJ0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaGFzZWRSZWdpc3RyYXRpb25OYW1lczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZWQ6ICdvbkNvbXBvc2l0aW9uU3RhcnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhcHR1cmVkOiAnb25Db21wb3NpdGlvblN0YXJ0Q2FwdHVyZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXBlbmRlbmNpZXM6ICdibHVyIGNvbXBvc2l0aW9uc3RhcnQga2V5ZG93biBrZXlwcmVzcyBrZXl1cCBtb3VzZWRvd24nLnNwbGl0KCcgJykKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY29tcG9zaXRpb25VcGRhdGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBoYXNlZFJlZ2lzdHJhdGlvbk5hbWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlZDogJ29uQ29tcG9zaXRpb25VcGRhdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhcHR1cmVkOiAnb25Db21wb3NpdGlvblVwZGF0ZUNhcHR1cmUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVwZW5kZW5jaWVzOiAnYmx1ciBjb21wb3NpdGlvbnVwZGF0ZSBrZXlkb3duIGtleXByZXNzIGtleXVwIG1vdXNlZG93bicuc3BsaXQoJyAnKQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgcnIgPSAhMTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG9yKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlICdrZXl1cCc6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSAhPT0gS24uaW5kZXhPZih0LmtleUNvZGUpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgJ2tleWRvd24nOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMjI5ICE9PSB0LmtleUNvZGU7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAna2V5cHJlc3MnOgogICAgICAgICAgICAgICAgICAgIGNhc2UgJ21vdXNlZG93bic6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnYmx1cic6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaXIoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnb2JqZWN0JyA9PT0gdHlwZW9mIChlID0gZS5kZXRhaWwpICYmICdkYXRhJyBpbiBlID8gZS5kYXRhIDogbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBhciA9ICExOwogICAgICAgICAgICAgICAgdmFyIHNyID0gewogICAgICAgICAgICAgICAgICAgICAgICBldmVudFR5cGVzOiBuciwKICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmFjdEV2ZW50czogZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEpuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2NvbXBvc2l0aW9uc3RhcnQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuci5jb21wb3NpdGlvblN0YXJ0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnY29tcG9zaXRpb25lbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IG5yLmNvbXBvc2l0aW9uRW5kOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnY29tcG9zaXRpb251cGRhdGUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IG5yLmNvbXBvc2l0aW9uVXBkYXRlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhciA/IG9yKGUsIG4pICYmIChpID0gbnIuY29tcG9zaXRpb25FbmQpIDogJ2tleWRvd24nID09PSBlICYmIDIyOSA9PT0gbi5rZXlDb2RlICYmIChpID0gbnIuY29tcG9zaXRpb25TdGFydCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSA/IChlciAmJiAna28nICE9PSBuLmxvY2FsZSAmJiAoYXIgfHwgaSAhPT0gbnIuY29tcG9zaXRpb25TdGFydCA/IGkgPT09IG5yLmNvbXBvc2l0aW9uRW5kICYmIGFyICYmIChvID0gVm4oKSkgOiAoTW4gPSAndmFsdWUnIGluIChEbiA9IHIpID8gRG4udmFsdWUgOiBEbi50ZXh0Q29udGVudCwgYXIgPSAhMCkpLCBpID0gWW4uZ2V0UG9vbGVkKGksIHQsIG4sIHIpLCBvID8gaS5kYXRhID0gbyA6IG51bGwgIT09IChvID0gaXIobikpICYmIChpLmRhdGEgPSBvKSwgRm4oaSksIG8gPSBpKSA6IG8gPSBudWxsLCAoZSA9IFpuID8gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdjb21wb3NpdGlvbmVuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpcih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdrZXlwcmVzcyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAzMiAhPT0gdC53aGljaCA/IG51bGwgOiAocnIgPSAhMCwgdHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3RleHRJbnB1dCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IHQuZGF0YSkgPT09IHRyICYmIHJyID8gbnVsbCA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlLCBuKSA6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2NvbXBvc2l0aW9uZW5kJyA9PT0gZSB8fCAhSm4gJiYgb3IoZSwgdCkgPyAoZSA9IFZuKCksIFVuID0gTW4gPSBEbiA9IG51bGwsIGFyID0gITEsIGUpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdwYXN0ZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2tleXByZXNzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodC5jdHJsS2V5IHx8IHQuYWx0S2V5IHx8IHQubWV0YUtleSkgfHwgdC5jdHJsS2V5ICYmIHQuYWx0S2V5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5jaGFyICYmIDEgPCB0LmNoYXIubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmNoYXI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC53aGljaCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gU3RyaW5nLmZyb21DaGFyQ29kZSh0LndoaWNoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdjb21wb3NpdGlvbmVuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlciAmJiAna28nICE9PSB0LmxvY2FsZSA/IG51bGwgOiB0LmRhdGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlLCBuKSkgPyAoKHQgPSBRbi5nZXRQb29sZWQobnIuYmVmb3JlSW5wdXQsIHQsIG4sIHIpKS5kYXRhID0gZSwgRm4odCkpIDogdCA9IG51bGwsIG51bGwgPT09IG8gPyB0IDogbnVsbCA9PT0gdCA/IG8gOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgY3IgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbG9yOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgZGF0ZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGV0aW1lOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgJ2RhdGV0aW1lLWxvY2FsJzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGVtYWlsOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgbW9udGg6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBudW1iZXI6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBwYXNzd29yZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHJhbmdlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgc2VhcmNoOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgdGVsOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgdGV4dDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHRpbWU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB3ZWVrOiAhMAogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB1cihlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlICYmIGUubm9kZU5hbWUgJiYgZS5ub2RlTmFtZS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW5wdXQnID09PSB0ID8gISFjcltlLnR5cGVdIDogJ3RleHRhcmVhJyA9PT0gdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBsciA9IHsKICAgICAgICAgICAgICAgICAgICBjaGFuZ2U6IHsKICAgICAgICAgICAgICAgICAgICAgICAgcGhhc2VkUmVnaXN0cmF0aW9uTmFtZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZWQ6ICdvbkNoYW5nZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXB0dXJlZDogJ29uQ2hhbmdlQ2FwdHVyZScKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZGVwZW5kZW5jaWVzOiAnYmx1ciBjaGFuZ2UgY2xpY2sgZm9jdXMgaW5wdXQga2V5ZG93biBrZXl1cCBzZWxlY3Rpb25jaGFuZ2UnLnNwbGl0KCcgJykKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZnIoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IEduLmdldFBvb2xlZChsci5jaGFuZ2UsIGUsIHQsIG4pKS50eXBlID0gJ2NoYW5nZScsIEEobiksIEZuKGUpLCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHByID0gbnVsbCwgZHIgPSBudWxsOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gaHIoZSkgewogICAgICAgICAgICAgICAgICAgIHN0KGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbXIoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICh3ZShPbihlKSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZ3IoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmICgnY2hhbmdlJyA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgdnIgPSAhMTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHlyKCkgewogICAgICAgICAgICAgICAgICAgIHByICYmIChwci5kZXRhY2hFdmVudCgnb25wcm9wZXJ0eWNoYW5nZScsIGJyKSwgZHIgPSBwciA9IG51bGwpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYnIoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICgndmFsdWUnID09PSBlLnByb3BlcnR5TmFtZSAmJiBtcihkcikpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID0gZnIoZHIsIGUsIGN0KGUpKSwgRCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTihociwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEQgPSAhMSwgVSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBFcihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgJ2ZvY3VzJyA9PT0gZSA/ICh5cigpLCBkciA9IG4sIChwciA9IHQpLmF0dGFjaEV2ZW50KCdvbnByb3BlcnR5Y2hhbmdlJywgYnIpKSA6ICdibHVyJyA9PT0gZSAmJiB5cigpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gd3IoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICgnc2VsZWN0aW9uY2hhbmdlJyA9PT0gZSB8fCAna2V5dXAnID09PSBlIHx8ICdrZXlkb3duJyA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1yKGRyKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHhyKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2NsaWNrJyA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1yKHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gU3IoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmICgnaW5wdXQnID09PSBlIHx8ICdjaGFuZ2UnID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbXIodCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBfICYmICh2ciA9IHV0KCdpbnB1dCcpICYmICghZG9jdW1lbnQuZG9jdW1lbnRNb2RlIHx8IDkgPCBkb2N1bWVudC5kb2N1bWVudE1vZGUpKTsKICAgICAgICAgICAgICAgIHZhciBDciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRUeXBlczogbHIsCiAgICAgICAgICAgICAgICAgICAgICAgIF9pc0lucHV0RXZlbnRTdXBwb3J0ZWQ6IHZyLAogICAgICAgICAgICAgICAgICAgICAgICBleHRyYWN0RXZlbnRzOiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0ID8gT24odCkgOiB3aW5kb3csIGkgPSBvLm5vZGVOYW1lICYmIG8ubm9kZU5hbWUudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc2VsZWN0JyA9PT0gaSB8fCAnaW5wdXQnID09PSBpICYmICdmaWxlJyA9PT0gby50eXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZ3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICh1cihvKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodnIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBTcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IHdyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IEVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaSA9IG8ubm9kZU5hbWUpICYmICdpbnB1dCcgPT09IGkudG9Mb3dlckNhc2UoKSAmJiAoJ2NoZWNrYm94JyA9PT0gby50eXBlIHx8ICdyYWRpbycgPT09IG8udHlwZSkgJiYgKGEgPSB4cik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSAmJiAoYSA9IGEoZSwgdCkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmcihhLCBuLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgJiYgcyhlLCBvLCB0KSwgJ2JsdXInID09PSBlICYmIChlID0gby5fd3JhcHBlclN0YXRlKSAmJiBlLmNvbnRyb2xsZWQgJiYgJ251bWJlcicgPT09IG8udHlwZSAmJiBfZShvLCAnbnVtYmVyJywgby52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBrciA9IEduLmV4dGVuZCh7CiAgICAgICAgICAgICAgICAgICAgICAgIHZpZXc6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGRldGFpbDogbnVsbAogICAgICAgICAgICAgICAgICAgIH0pLCBUciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgQWx0OiAnYWx0S2V5JywKICAgICAgICAgICAgICAgICAgICAgICAgQ29udHJvbDogJ2N0cmxLZXknLAogICAgICAgICAgICAgICAgICAgICAgICBNZXRhOiAnbWV0YUtleScsCiAgICAgICAgICAgICAgICAgICAgICAgIFNoaWZ0OiAnc2hpZnRLZXknCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9yKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMubmF0aXZlRXZlbnQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZ2V0TW9kaWZpZXJTdGF0ZSA/IHQuZ2V0TW9kaWZpZXJTdGF0ZShlKSA6ICEhKGUgPSBUcltlXSkgJiYgISF0W2VdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUHIoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9yOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIE9yID0gMCwgSXIgPSAwLCBMciA9ICExLCBBciA9ICExLCBSciA9IGtyLmV4dGVuZCh7CiAgICAgICAgICAgICAgICAgICAgICAgIHNjcmVlblg6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHNjcmVlblk6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFg6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudFk6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VYOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBwYWdlWTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgY3RybEtleTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgc2hpZnRLZXk6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGFsdEtleTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgbWV0YUtleTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TW9kaWZpZXJTdGF0ZTogUHIsCiAgICAgICAgICAgICAgICAgICAgICAgIGJ1dHRvbjogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgYnV0dG9uczogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRlZFRhcmdldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlbGF0ZWRUYXJnZXQgfHwgKGUuZnJvbUVsZW1lbnQgPT09IGUuc3JjRWxlbWVudCA/IGUudG9FbGVtZW50IDogZS5mcm9tRWxlbWVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG1vdmVtZW50WDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnbW92ZW1lbnRYJyBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm1vdmVtZW50WDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT3IgPSBlLnNjcmVlblgsIExyID8gJ21vdXNlbW92ZScgPT09IGUudHlwZSA/IGUuc2NyZWVuWCAtIHQgOiAwIDogKExyID0gITAsIDApOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBtb3ZlbWVudFk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ21vdmVtZW50WScgaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5tb3ZlbWVudFk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IElyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElyID0gZS5zY3JlZW5ZLCBBciA/ICdtb3VzZW1vdmUnID09PSBlLnR5cGUgPyBlLnNjcmVlblkgLSB0IDogMCA6IChBciA9ICEwLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pLCBOciA9IFJyLmV4dGVuZCh7CiAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50ZXJJZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgcHJlc3N1cmU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHRhbmdlbnRpYWxQcmVzc3VyZTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgdGlsdFg6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHRpbHRZOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICB0d2lzdDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGlzUHJpbWFyeTogbnVsbAogICAgICAgICAgICAgICAgICAgIH0pLCBqciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbW91c2VFbnRlcjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVnaXN0cmF0aW9uTmFtZTogJ29uTW91c2VFbnRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXBlbmRlbmNpZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbW91c2VvdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtb3VzZW92ZXInCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG1vdXNlTGVhdmU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lzdHJhdGlvbk5hbWU6ICdvbk1vdXNlTGVhdmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVwZW5kZW5jaWVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ21vdXNlb3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbW91c2VvdmVyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVyRW50ZXI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lzdHJhdGlvbk5hbWU6ICdvblBvaW50ZXJFbnRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXBlbmRlbmNpZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncG9pbnRlcm91dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BvaW50ZXJvdmVyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVyTGVhdmU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lzdHJhdGlvbk5hbWU6ICdvblBvaW50ZXJMZWF2ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXBlbmRlbmNpZXM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncG9pbnRlcm91dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3BvaW50ZXJvdmVyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgcXIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50VHlwZXM6IGpyLAogICAgICAgICAgICAgICAgICAgICAgICBleHRyYWN0RXZlbnRzOiBmdW5jdGlvbiAoZSwgdCwgbiwgciwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAnbW91c2VvdmVyJyA9PT0gZSB8fCAncG9pbnRlcm92ZXInID09PSBlLCBhID0gJ21vdXNlb3V0JyA9PT0gZSB8fCAncG9pbnRlcm91dCcgPT09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSAmJiAwID09PSAoMzIgJiBvKSAmJiAobi5yZWxhdGVkVGFyZ2V0IHx8IG4uZnJvbUVsZW1lbnQpIHx8ICFhICYmICFpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGkgPSByLndpbmRvdyA9PT0gciA/IHIgOiAoaSA9IHIub3duZXJEb2N1bWVudCkgPyBpLmRlZmF1bHRWaWV3IHx8IGkucGFyZW50V2luZG93IDogd2luZG93LCBhKSA/IChhID0gdCwgbnVsbCAhPT0gKHQgPSAodCA9IG4ucmVsYXRlZFRhcmdldCB8fCBuLnRvRWxlbWVudCkgPyBfbih0KSA6IG51bGwpICYmICh0ICE9PSBaZSh0KSB8fCA1ICE9PSB0LnRhZyAmJiA2ICE9PSB0LnRhZykgJiYgKHQgPSBudWxsKSkgOiBhID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdtb3VzZW91dCcgPT09IGUgfHwgJ21vdXNlb3ZlcicgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBSciwgYyA9IGpyLm1vdXNlTGVhdmUsIHUgPSBqci5tb3VzZUVudGVyLCBsID0gJ21vdXNlJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncG9pbnRlcm91dCcgIT09IGUgJiYgJ3BvaW50ZXJvdmVyJyAhPT0gZSB8fCAocyA9IE5yLCBjID0ganIucG9pbnRlckxlYXZlLCB1ID0ganIucG9pbnRlckVudGVyLCBsID0gJ3BvaW50ZXInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID0gbnVsbCA9PSBhID8gaSA6IE9uKGEpLCBpID0gbnVsbCA9PSB0ID8gaSA6IE9uKHQpLCAoYyA9IHMuZ2V0UG9vbGVkKGMsIGEsIG4sIHIpKS50eXBlID0gbCArICdsZWF2ZScsIGMudGFyZ2V0ID0gZSwgYy5yZWxhdGVkVGFyZ2V0ID0gaSwgKG4gPSBzLmdldFBvb2xlZCh1LCB0LCBuLCByKSkudHlwZSA9IGwgKyAnZW50ZXInLCBuLnRhcmdldCA9IGksIG4ucmVsYXRlZFRhcmdldCA9IGUsIGwgPSB0LCAociA9IGEpICYmIGwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHUgPSBsLCBhID0gMCwgZSA9IHMgPSByOyBlOyBlID0gTG4oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IDAsIHQgPSB1OyB0OyB0ID0gTG4odCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyAwIDwgYSAtIGU7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IExuKHMpLCBhLS07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyAwIDwgZSAtIGE7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSA9IExuKHUpLCBlLS07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBhLS07KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocyA9PT0gdSB8fCBzID09PSB1LmFsdGVybmF0ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IExuKHMpLCB1ID0gTG4odSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh1ID0gcywgcyA9IFtdOyByICYmIHIgIT09IHUgJiYgKG51bGwgPT09IChhID0gci5hbHRlcm5hdGUpIHx8IGEgIT09IHUpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnB1c2gociksIHIgPSBMbihyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociA9IFtdOyBsICYmIGwgIT09IHUgJiYgKG51bGwgPT09IChhID0gbC5hbHRlcm5hdGUpIHx8IGEgIT09IHUpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnB1c2gobCksIGwgPSBMbihsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobCA9IDA7IGwgPCBzLmxlbmd0aDsgbCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpuKHNbbF0sICdidWJibGVkJywgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGwgPSByLmxlbmd0aDsgMCA8IGwtLTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgam4ocltsXSwgJ2NhcHR1cmVkJywgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA9PT0gKDY0ICYgbykgPyBbY10gOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHZhciBGciA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBPYmplY3QuaXMgPyBPYmplY3QuaXMgOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gdCAmJiAoMCAhPT0gZSB8fCAxIC8gZSA9PT0gMSAvIHQpIHx8IGUgIT09IGUgJiYgdCAhPT0gdDsKICAgICAgICAgICAgICAgICAgICB9LCBEciA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBNcihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKEZyKGUsIHQpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnICE9PSB0eXBlb2YgZSB8fCBudWxsID09PSBlIHx8ICdvYmplY3QnICE9PSB0eXBlb2YgdCB8fCBudWxsID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3Qua2V5cyhlKSwgciA9IE9iamVjdC5rZXlzKHQpOwogICAgICAgICAgICAgICAgICAgIGlmIChuLmxlbmd0aCAhPT0gci5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgbi5sZW5ndGg7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFEci5jYWxsKHQsIG5bcl0pIHx8ICFGcihlW25bcl1dLCB0W25bcl1dKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgVXIgPSBfICYmICdkb2N1bWVudE1vZGUnIGluIGRvY3VtZW50ICYmIDExID49IGRvY3VtZW50LmRvY3VtZW50TW9kZSwgVnIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGhhc2VkUmVnaXN0cmF0aW9uTmFtZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVkOiAnb25TZWxlY3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhcHR1cmVkOiAnb25TZWxlY3RDYXB0dXJlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlcGVuZGVuY2llczogJ2JsdXIgY29udGV4dG1lbnUgZHJhZ2VuZCBmb2N1cyBrZXlkb3duIGtleXVwIG1vdXNlZG93biBtb3VzZXVwIHNlbGVjdGlvbmNoYW5nZScuc3BsaXQoJyAnKQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgQnIgPSBudWxsLCB6ciA9IG51bGwsIEdyID0gbnVsbCwgSHIgPSAhMTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFdyKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQud2luZG93ID09PSB0ID8gdC5kb2N1bWVudCA6IDkgPT09IHQubm9kZVR5cGUgPyB0IDogdC5vd25lckRvY3VtZW50OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBIciB8fCBudWxsID09IEJyIHx8IEJyICE9PSBsbihuKSA/IG51bGwgOiAoJ3NlbGVjdGlvblN0YXJ0JyBpbiAobiA9IEJyKSAmJiBobihuKSA/IG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0OiBuLnNlbGVjdGlvblN0YXJ0LAogICAgICAgICAgICAgICAgICAgICAgICBlbmQ6IG4uc2VsZWN0aW9uRW5kCiAgICAgICAgICAgICAgICAgICAgfSA6IG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGFuY2hvck5vZGU6IChuID0gKG4ub3duZXJEb2N1bWVudCAmJiBuLm93bmVyRG9jdW1lbnQuZGVmYXVsdFZpZXcgfHwgd2luZG93KS5nZXRTZWxlY3Rpb24oKSkuYW5jaG9yTm9kZSwKICAgICAgICAgICAgICAgICAgICAgICAgYW5jaG9yT2Zmc2V0OiBuLmFuY2hvck9mZnNldCwKICAgICAgICAgICAgICAgICAgICAgICAgZm9jdXNOb2RlOiBuLmZvY3VzTm9kZSwKICAgICAgICAgICAgICAgICAgICAgICAgZm9jdXNPZmZzZXQ6IG4uZm9jdXNPZmZzZXQKICAgICAgICAgICAgICAgICAgICB9LCBHciAmJiBNcihHciwgbikgPyBudWxsIDogKEdyID0gbiwgKGUgPSBHbi5nZXRQb29sZWQoVnIuc2VsZWN0LCB6ciwgZSwgdCkpLnR5cGUgPSAnc2VsZWN0JywgZS50YXJnZXQgPSBCciwgRm4oZSksIGUpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciAkciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRUeXBlczogVnIsCiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhY3RFdmVudHM6IGZ1bmN0aW9uIChlLCB0LCBuLCByLCBvLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShpID0gIShvID0gaSB8fCAoci53aW5kb3cgPT09IHIgPyByLmRvY3VtZW50IDogOSA9PT0gci5ub2RlVHlwZSA/IHIgOiByLm93bmVyRG9jdW1lbnQpKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBYZShvKSwgaSA9IGsub25TZWxlY3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSAwOyBhIDwgaS5sZW5ndGg7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghby5oYXMoaVthXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gIW87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobyA9IHQgPyBPbih0KSA6IHdpbmRvdywgZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZm9jdXMnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh1cihvKSB8fCAndHJ1ZScgPT09IG8uY29udGVudEVkaXRhYmxlKSAmJiAoQnIgPSBvLCB6ciA9IHQsIEdyID0gbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdibHVyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHciA9IHpyID0gQnIgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbW91c2Vkb3duJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIciA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnY29udGV4dG1lbnUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbW91c2V1cCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdkcmFnZW5kJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSHIgPSAhMSwgV3Iobiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdzZWxlY3Rpb25jaGFuZ2UnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChVcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdrZXlkb3duJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2tleXVwJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gV3Iobiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIFlyID0gR24uZXh0ZW5kKHsKICAgICAgICAgICAgICAgICAgICAgICAgYW5pbWF0aW9uTmFtZTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgZWxhcHNlZFRpbWU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHBzZXVkb0VsZW1lbnQ6IG51bGwKICAgICAgICAgICAgICAgICAgICB9KSwgUXIgPSBHbi5leHRlbmQoewogICAgICAgICAgICAgICAgICAgICAgICBjbGlwYm9hcmREYXRhOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdjbGlwYm9hcmREYXRhJyBpbiBlID8gZS5jbGlwYm9hcmREYXRhIDogd2luZG93LmNsaXBib2FyZERhdGE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KSwgS3IgPSBrci5leHRlbmQoeyByZWxhdGVkVGFyZ2V0OiBudWxsIH0pOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gSnIoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5rZXlDb2RlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAnY2hhckNvZGUnIGluIGUgPyAwID09PSAoZSA9IGUuY2hhckNvZGUpICYmIDEzID09PSB0ICYmIChlID0gMTMpIDogZSA9IHQsIDEwID09PSBlICYmIChlID0gMTMpLCAzMiA8PSBlIHx8IDEzID09PSBlID8gZSA6IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgWHIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEVzYzogJ0VzY2FwZScsCiAgICAgICAgICAgICAgICAgICAgICAgIFNwYWNlYmFyOiAnICcsCiAgICAgICAgICAgICAgICAgICAgICAgIExlZnQ6ICdBcnJvd0xlZnQnLAogICAgICAgICAgICAgICAgICAgICAgICBVcDogJ0Fycm93VXAnLAogICAgICAgICAgICAgICAgICAgICAgICBSaWdodDogJ0Fycm93UmlnaHQnLAogICAgICAgICAgICAgICAgICAgICAgICBEb3duOiAnQXJyb3dEb3duJywKICAgICAgICAgICAgICAgICAgICAgICAgRGVsOiAnRGVsZXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgV2luOiAnT1MnLAogICAgICAgICAgICAgICAgICAgICAgICBNZW51OiAnQ29udGV4dE1lbnUnLAogICAgICAgICAgICAgICAgICAgICAgICBBcHBzOiAnQ29udGV4dE1lbnUnLAogICAgICAgICAgICAgICAgICAgICAgICBTY3JvbGw6ICdTY3JvbGxMb2NrJywKICAgICAgICAgICAgICAgICAgICAgICAgTW96UHJpbnRhYmxlS2V5OiAnVW5pZGVudGlmaWVkJwogICAgICAgICAgICAgICAgICAgIH0sIFpyID0gewogICAgICAgICAgICAgICAgICAgICAgICA4OiAnQmFja3NwYWNlJywKICAgICAgICAgICAgICAgICAgICAgICAgOTogJ1RhYicsCiAgICAgICAgICAgICAgICAgICAgICAgIDEyOiAnQ2xlYXInLAogICAgICAgICAgICAgICAgICAgICAgICAxMzogJ0VudGVyJywKICAgICAgICAgICAgICAgICAgICAgICAgMTY6ICdTaGlmdCcsCiAgICAgICAgICAgICAgICAgICAgICAgIDE3OiAnQ29udHJvbCcsCiAgICAgICAgICAgICAgICAgICAgICAgIDE4OiAnQWx0JywKICAgICAgICAgICAgICAgICAgICAgICAgMTk6ICdQYXVzZScsCiAgICAgICAgICAgICAgICAgICAgICAgIDIwOiAnQ2Fwc0xvY2snLAogICAgICAgICAgICAgICAgICAgICAgICAyNzogJ0VzY2FwZScsCiAgICAgICAgICAgICAgICAgICAgICAgIDMyOiAnICcsCiAgICAgICAgICAgICAgICAgICAgICAgIDMzOiAnUGFnZVVwJywKICAgICAgICAgICAgICAgICAgICAgICAgMzQ6ICdQYWdlRG93bicsCiAgICAgICAgICAgICAgICAgICAgICAgIDM1OiAnRW5kJywKICAgICAgICAgICAgICAgICAgICAgICAgMzY6ICdIb21lJywKICAgICAgICAgICAgICAgICAgICAgICAgMzc6ICdBcnJvd0xlZnQnLAogICAgICAgICAgICAgICAgICAgICAgICAzODogJ0Fycm93VXAnLAogICAgICAgICAgICAgICAgICAgICAgICAzOTogJ0Fycm93UmlnaHQnLAogICAgICAgICAgICAgICAgICAgICAgICA0MDogJ0Fycm93RG93bicsCiAgICAgICAgICAgICAgICAgICAgICAgIDQ1OiAnSW5zZXJ0JywKICAgICAgICAgICAgICAgICAgICAgICAgNDY6ICdEZWxldGUnLAogICAgICAgICAgICAgICAgICAgICAgICAxMTI6ICdGMScsCiAgICAgICAgICAgICAgICAgICAgICAgIDExMzogJ0YyJywKICAgICAgICAgICAgICAgICAgICAgICAgMTE0OiAnRjMnLAogICAgICAgICAgICAgICAgICAgICAgICAxMTU6ICdGNCcsCiAgICAgICAgICAgICAgICAgICAgICAgIDExNjogJ0Y1JywKICAgICAgICAgICAgICAgICAgICAgICAgMTE3OiAnRjYnLAogICAgICAgICAgICAgICAgICAgICAgICAxMTg6ICdGNycsCiAgICAgICAgICAgICAgICAgICAgICAgIDExOTogJ0Y4JywKICAgICAgICAgICAgICAgICAgICAgICAgMTIwOiAnRjknLAogICAgICAgICAgICAgICAgICAgICAgICAxMjE6ICdGMTAnLAogICAgICAgICAgICAgICAgICAgICAgICAxMjI6ICdGMTEnLAogICAgICAgICAgICAgICAgICAgICAgICAxMjM6ICdGMTInLAogICAgICAgICAgICAgICAgICAgICAgICAxNDQ6ICdOdW1Mb2NrJywKICAgICAgICAgICAgICAgICAgICAgICAgMTQ1OiAnU2Nyb2xsTG9jaycsCiAgICAgICAgICAgICAgICAgICAgICAgIDIyNDogJ01ldGEnCiAgICAgICAgICAgICAgICAgICAgfSwgZW8gPSBrci5leHRlbmQoewogICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5rZXkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFhyW2Uua2V5XSB8fCBlLmtleTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ1VuaWRlbnRpZmllZCcgIT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdrZXlwcmVzcycgPT09IGUudHlwZSA/IDEzID09PSAoZSA9IEpyKGUpKSA/ICdFbnRlcicgOiBTdHJpbmcuZnJvbUNoYXJDb2RlKGUpIDogJ2tleWRvd24nID09PSBlLnR5cGUgfHwgJ2tleXVwJyA9PT0gZS50eXBlID8gWnJbZS5rZXlDb2RlXSB8fCAnVW5pZGVudGlmaWVkJyA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBsb2NhdGlvbjogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgY3RybEtleTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgc2hpZnRLZXk6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGFsdEtleTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgbWV0YUtleTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgcmVwZWF0OiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBsb2NhbGU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGdldE1vZGlmaWVyU3RhdGU6IFByLAogICAgICAgICAgICAgICAgICAgICAgICBjaGFyQ29kZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAna2V5cHJlc3MnID09PSBlLnR5cGUgPyBKcihlKSA6IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGtleUNvZGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2tleWRvd24nID09PSBlLnR5cGUgfHwgJ2tleXVwJyA9PT0gZS50eXBlID8gZS5rZXlDb2RlIDogMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgd2hpY2g6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2tleXByZXNzJyA9PT0gZS50eXBlID8gSnIoZSkgOiAna2V5ZG93bicgPT09IGUudHlwZSB8fCAna2V5dXAnID09PSBlLnR5cGUgPyBlLmtleUNvZGUgOiAwOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSksIHRvID0gUnIuZXh0ZW5kKHsgZGF0YVRyYW5zZmVyOiBudWxsIH0pLCBubyA9IGtyLmV4dGVuZCh7CiAgICAgICAgICAgICAgICAgICAgICAgIHRvdWNoZXM6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldFRvdWNoZXM6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWRUb3VjaGVzOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBhbHRLZXk6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIG1ldGFLZXk6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGN0cmxLZXk6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHNoaWZ0S2V5OiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBnZXRNb2RpZmllclN0YXRlOiBQcgogICAgICAgICAgICAgICAgICAgIH0pLCBybyA9IEduLmV4dGVuZCh7CiAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5TmFtZTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgZWxhcHNlZFRpbWU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHBzZXVkb0VsZW1lbnQ6IG51bGwKICAgICAgICAgICAgICAgICAgICB9KSwgb28gPSBSci5leHRlbmQoewogICAgICAgICAgICAgICAgICAgICAgICBkZWx0YVg6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2RlbHRhWCcgaW4gZSA/IGUuZGVsdGFYIDogJ3doZWVsRGVsdGFYJyBpbiBlID8gLWUud2hlZWxEZWx0YVggOiAwOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBkZWx0YVk6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2RlbHRhWScgaW4gZSA/IGUuZGVsdGFZIDogJ3doZWVsRGVsdGFZJyBpbiBlID8gLWUud2hlZWxEZWx0YVkgOiAnd2hlZWxEZWx0YScgaW4gZSA/IC1lLndoZWVsRGVsdGEgOiAwOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBkZWx0YVo6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGRlbHRhTW9kZTogbnVsbAogICAgICAgICAgICAgICAgICAgIH0pLCBpbyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRUeXBlczogRnQsCiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhY3RFdmVudHM6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IER0LmdldChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAna2V5cHJlc3MnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBKcihuKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdrZXlkb3duJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2tleXVwJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZW87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdibHVyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2ZvY3VzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gS3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdjbGljayc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDIgPT09IG4uYnV0dG9uKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2F1eGNsaWNrJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2RibGNsaWNrJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ21vdXNlZG93bic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdtb3VzZW1vdmUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbW91c2V1cCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdtb3VzZW91dCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdtb3VzZW92ZXInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnY29udGV4dG1lbnUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBScjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2RyYWcnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZHJhZ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdkcmFnZW50ZXInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZHJhZ2V4aXQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZHJhZ2xlYXZlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2RyYWdvdmVyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2RyYWdzdGFydCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdkcm9wJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gdG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd0b3VjaGNhbmNlbCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd0b3VjaGVuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd0b3VjaG1vdmUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndG91Y2hzdGFydCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IG5vOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBXZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJGU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFllOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBZcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgUWU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHJvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc2Nyb2xsJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0ga3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd3aGVlbCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IG9vOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnY29weSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdjdXQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncGFzdGUnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBRcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2dvdHBvaW50ZXJjYXB0dXJlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2xvc3Rwb2ludGVyY2FwdHVyZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdwb2ludGVyY2FuY2VsJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3BvaW50ZXJkb3duJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3BvaW50ZXJtb3ZlJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3BvaW50ZXJvdXQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncG9pbnRlcm92ZXInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncG9pbnRlcnVwJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gTnI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBHbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBGbih0ID0gZS5nZXRQb29sZWQobywgdCwgbiwgcikpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGlmICh5KQogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMTAxKSk7CiAgICAgICAgICAgICAgICB5ID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoJ1Jlc3BvbmRlckV2ZW50UGx1Z2luIFNpbXBsZUV2ZW50UGx1Z2luIEVudGVyTGVhdmVFdmVudFBsdWdpbiBDaGFuZ2VFdmVudFBsdWdpbiBTZWxlY3RFdmVudFBsdWdpbiBCZWZvcmVJbnB1dEV2ZW50UGx1Z2luJy5zcGxpdCgnICcpKSwgRSgpLCBoID0gSW4sIG0gPSBQbiwgZyA9IE9uLCBUKHsKICAgICAgICAgICAgICAgICAgICBTaW1wbGVFdmVudFBsdWdpbjogaW8sCiAgICAgICAgICAgICAgICAgICAgRW50ZXJMZWF2ZUV2ZW50UGx1Z2luOiBxciwKICAgICAgICAgICAgICAgICAgICBDaGFuZ2VFdmVudFBsdWdpbjogQ3IsCiAgICAgICAgICAgICAgICAgICAgU2VsZWN0RXZlbnRQbHVnaW46ICRyLAogICAgICAgICAgICAgICAgICAgIEJlZm9yZUlucHV0RXZlbnRQbHVnaW46IHNyCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHZhciBhbyA9IFtdLCBzbyA9IC0xOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gY28oZSkgewogICAgICAgICAgICAgICAgICAgIDAgPiBzbyB8fCAoZS5jdXJyZW50ID0gYW9bc29dLCBhb1tzb10gPSBudWxsLCBzby0tKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHVvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBzbysrLCBhb1tzb10gPSBlLmN1cnJlbnQsIGUuY3VycmVudCA9IHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgbG8gPSB7fSwgZm8gPSB7IGN1cnJlbnQ6IGxvIH0sIHBvID0geyBjdXJyZW50OiAhMSB9LCBobyA9IGxvOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gbW8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS50eXBlLmNvbnRleHRUeXBlczsKICAgICAgICAgICAgICAgICAgICBpZiAoIW4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsbzsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuc3RhdGVOb2RlOwogICAgICAgICAgICAgICAgICAgIGlmIChyICYmIHIuX19yZWFjdEludGVybmFsTWVtb2l6ZWRVbm1hc2tlZENoaWxkQ29udGV4dCA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuX19yZWFjdEludGVybmFsTWVtb2l6ZWRNYXNrZWRDaGlsZENvbnRleHQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIG8sIGkgPSB7fTsKICAgICAgICAgICAgICAgICAgICBmb3IgKG8gaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgaVtvXSA9IHRbb107CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgJiYgKChlID0gZS5zdGF0ZU5vZGUpLl9fcmVhY3RJbnRlcm5hbE1lbW9pemVkVW5tYXNrZWRDaGlsZENvbnRleHQgPSB0LCBlLl9fcmVhY3RJbnRlcm5hbE1lbW9pemVkTWFza2VkQ2hpbGRDb250ZXh0ID0gaSksIGk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBnbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChlID0gZS5jaGlsZENvbnRleHRUeXBlcykgJiYgdm9pZCAwICE9PSBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdm8oKSB7CiAgICAgICAgICAgICAgICAgICAgY28ocG8pLCBjbyhmbyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5byhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGZvLmN1cnJlbnQgIT09IGxvKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE2OCkpOwogICAgICAgICAgICAgICAgICAgIHVvKGZvLCB0KSwgdW8ocG8sIG4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYm8oZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUgPSB0LmNoaWxkQ29udGV4dFR5cGVzLCAnZnVuY3Rpb24nICE9PSB0eXBlb2Ygci5nZXRDaGlsZENvbnRleHQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgaW4gciA9IHIuZ2V0Q2hpbGRDb250ZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGkgaW4gZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDEwOCwgZ2UodCkgfHwgJ1Vua25vd24nLCBpKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oe30sIG4sIHt9LCByKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVvKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IChlID0gZS5zdGF0ZU5vZGUpICYmIGUuX19yZWFjdEludGVybmFsTWVtb2l6ZWRNZXJnZWRDaGlsZENvbnRleHQgfHwgbG8sIGhvID0gZm8uY3VycmVudCwgdW8oZm8sIGUpLCB1byhwbywgcG8uY3VycmVudCksICEwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gd28oZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFyKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE2OSkpOwogICAgICAgICAgICAgICAgICAgIG4gPyAoZSA9IGJvKGUsIHQsIGhvKSwgci5fX3JlYWN0SW50ZXJuYWxNZW1vaXplZE1lcmdlZENoaWxkQ29udGV4dCA9IGUsIGNvKHBvKSwgY28oZm8pLCB1byhmbywgZSkpIDogY28ocG8pLCB1byhwbywgbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgeG8gPSBpLnVuc3RhYmxlX3J1bldpdGhQcmlvcml0eSwgU28gPSBpLnVuc3RhYmxlX3NjaGVkdWxlQ2FsbGJhY2ssIENvID0gaS51bnN0YWJsZV9jYW5jZWxDYWxsYmFjaywga28gPSBpLnVuc3RhYmxlX3JlcXVlc3RQYWludCwgVG8gPSBpLnVuc3RhYmxlX25vdywgX28gPSBpLnVuc3RhYmxlX2dldEN1cnJlbnRQcmlvcml0eUxldmVsLCBQbyA9IGkudW5zdGFibGVfSW1tZWRpYXRlUHJpb3JpdHksIE9vID0gaS51bnN0YWJsZV9Vc2VyQmxvY2tpbmdQcmlvcml0eSwgSW8gPSBpLnVuc3RhYmxlX05vcm1hbFByaW9yaXR5LCBMbyA9IGkudW5zdGFibGVfTG93UHJpb3JpdHksIEFvID0gaS51bnN0YWJsZV9JZGxlUHJpb3JpdHksIFJvID0ge30sIE5vID0gaS51bnN0YWJsZV9zaG91bGRZaWVsZCwgam8gPSB2b2lkIDAgIT09IGtvID8ga28gOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfSwgcW8gPSBudWxsLCBGbyA9IG51bGwsIERvID0gITEsIE1vID0gVG8oKSwgVW8gPSAxMDAwMCA+IE1vID8gVG8gOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUbygpIC0gTW87CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFZvKCkgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoX28oKSkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgUG86CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiA5OTsKICAgICAgICAgICAgICAgICAgICBjYXNlIE9vOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gOTg7CiAgICAgICAgICAgICAgICAgICAgY2FzZSBJbzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDk3OwogICAgICAgICAgICAgICAgICAgIGNhc2UgTG86CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiA5NjsKICAgICAgICAgICAgICAgICAgICBjYXNlIEFvOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gOTU7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgzMzIpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBCbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA5OToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBvOwogICAgICAgICAgICAgICAgICAgIGNhc2UgOTg6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPbzsKICAgICAgICAgICAgICAgICAgICBjYXNlIDk3OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSW87CiAgICAgICAgICAgICAgICAgICAgY2FzZSA5NjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIExvOwogICAgICAgICAgICAgICAgICAgIGNhc2UgOTU6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBbzsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDMzMikpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHpvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IEJvKGUpLCB4byhlLCB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEdvKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IEJvKGUpLCBTbyhlLCB0LCBuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEhvKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gcW8gPyAocW8gPSBbZV0sIEZvID0gU28oUG8sICRvKSkgOiBxby5wdXNoKGUpLCBSbzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFdvKCkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBGbykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IEZvOwogICAgICAgICAgICAgICAgICAgICAgICBGbyA9IG51bGwsIENvKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAkbygpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gJG8oKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFEbyAmJiBudWxsICE9PSBxbykgewogICAgICAgICAgICAgICAgICAgICAgICBEbyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHFvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgem8oOTksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZSA8IHQubGVuZ3RoOyBlKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbighMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKG51bGwgIT09IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBxbyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG51bGwgIT09IHFvICYmIChxbyA9IHFvLnNsaWNlKGUgKyAxKSksIFNvKFBvLCBXbyksIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBEbyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gWW8oZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAxMDczNzQxODIxIC0gKDEgKyAoKDEwNzM3NDE4MjEgLSBlICsgdCAvIDEwKSAvIChuIC89IDEwKSB8IDApKSAqIG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBRbyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZS5kZWZhdWx0UHJvcHMpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gKHQgPSBvKHt9LCB0KSwgZSA9IGUuZGVmYXVsdFByb3BzKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gdFtuXSAmJiAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIEtvID0geyBjdXJyZW50OiBudWxsIH0sIEpvID0gbnVsbCwgWG8gPSBudWxsLCBabyA9IG51bGw7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBlaSgpIHsKICAgICAgICAgICAgICAgICAgICBabyA9IFhvID0gSm8gPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdGkoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gS28uY3VycmVudDsKICAgICAgICAgICAgICAgICAgICBjbyhLbyksIGUudHlwZS5fY29udGV4dC5fY3VycmVudFZhbHVlID0gdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG5pKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbnVsbCAhPT0gZTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmFsdGVybmF0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuY2hpbGRFeHBpcmF0aW9uVGltZSA8IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmNoaWxkRXhwaXJhdGlvblRpbWUgPSB0LCBudWxsICE9PSBuICYmIG4uY2hpbGRFeHBpcmF0aW9uVGltZSA8IHQgJiYgKG4uY2hpbGRFeHBpcmF0aW9uVGltZSA9IHQpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG51bGwgIT09IG4gJiYgbi5jaGlsZEV4cGlyYXRpb25UaW1lIDwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmNoaWxkRXhwaXJhdGlvblRpbWUgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLnJldHVybjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgSm8gPSBlLCBabyA9IFhvID0gbnVsbCwgbnVsbCAhPT0gKGUgPSBlLmRlcGVuZGVuY2llcykgJiYgbnVsbCAhPT0gZS5maXJzdENvbnRleHQgJiYgKGUuZXhwaXJhdGlvblRpbWUgPj0gdCAmJiAoSWEgPSAhMCksIGUuZmlyc3RDb250ZXh0ID0gbnVsbCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKFpvICE9PSBlICYmICExICE9PSB0ICYmIDAgIT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnbnVtYmVyJyA9PT0gdHlwZW9mIHQgJiYgMTA3Mzc0MTgyMyAhPT0gdCB8fCAoWm8gPSBlLCB0ID0gMTA3Mzc0MTgyMyksIHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYnNlcnZlZEJpdHM6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogbnVsbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbnVsbCA9PT0gWG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBKbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDMwOCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgWG8gPSB0LCBKby5kZXBlbmRlbmNpZXMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJhdGlvblRpbWU6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3RDb250ZXh0OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbmRlcnM6IG51bGwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgWG8gPSBYby5uZXh0ID0gdDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5fY3VycmVudFZhbHVlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGlpID0gITE7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBhaShlKSB7CiAgICAgICAgICAgICAgICAgICAgZS51cGRhdGVRdWV1ZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYmFzZVN0YXRlOiBlLm1lbW9pemVkU3RhdGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGJhc2VRdWV1ZTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVkOiB7IHBlbmRpbmc6IG51bGwgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZWZmZWN0czogbnVsbAogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZSA9IGUudXBkYXRlUXVldWUsIHQudXBkYXRlUXVldWUgPT09IGUgJiYgKHQudXBkYXRlUXVldWUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJhc2VTdGF0ZTogZS5iYXNlU3RhdGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGJhc2VRdWV1ZTogZS5iYXNlUXVldWUsCiAgICAgICAgICAgICAgICAgICAgICAgIHNoYXJlZDogZS5zaGFyZWQsCiAgICAgICAgICAgICAgICAgICAgICAgIGVmZmVjdHM6IGUuZWZmZWN0cwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gY2koZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJhdGlvblRpbWU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIHN1c3BlbnNlQ29uZmlnOiB0LAogICAgICAgICAgICAgICAgICAgICAgICB0YWc6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIHBheWxvYWQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBudWxsCiAgICAgICAgICAgICAgICAgICAgfSkubmV4dCA9IGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB1aShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IChlID0gZS51cGRhdGVRdWV1ZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAoZSA9IGUuc2hhcmVkKS5wZW5kaW5nOwogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09PSBuID8gdC5uZXh0ID0gdCA6ICh0Lm5leHQgPSBuLm5leHQsIG4ubmV4dCA9IHQpLCBlLnBlbmRpbmcgPSB0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGxpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuYWx0ZXJuYXRlOwogICAgICAgICAgICAgICAgICAgIG51bGwgIT09IG4gJiYgc2kobiwgZSksIG51bGwgPT09IChuID0gKGUgPSBlLnVwZGF0ZVF1ZXVlKS5iYXNlUXVldWUpID8gKGUuYmFzZVF1ZXVlID0gdC5uZXh0ID0gdCwgdC5uZXh0ID0gdCkgOiAodC5uZXh0ID0gbi5uZXh0LCBuLm5leHQgPSB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZpKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUudXBkYXRlUXVldWU7CiAgICAgICAgICAgICAgICAgICAgaWkgPSAhMTsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGkuYmFzZVF1ZXVlLCBzID0gaS5zaGFyZWQucGVuZGluZzsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gcykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLm5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLm5leHQgPSBzLm5leHQsIHMubmV4dCA9IGM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYSA9IHMsIGkuc2hhcmVkLnBlbmRpbmcgPSBudWxsLCBudWxsICE9PSAoYyA9IGUuYWx0ZXJuYXRlKSAmJiAobnVsbCAhPT0gKGMgPSBjLnVwZGF0ZVF1ZXVlKSAmJiAoYy5iYXNlUXVldWUgPSBzKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBhLm5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gaS5iYXNlU3RhdGUsIGwgPSAwLCBmID0gbnVsbCwgcCA9IG51bGwsIGQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGggPSBjOzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHMgPSBoLmV4cGlyYXRpb25UaW1lKSA8IHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBpcmF0aW9uVGltZTogaC5leHBpcmF0aW9uVGltZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1c3BlbnNlQ29uZmlnOiBoLnN1c3BlbnNlQ29uZmlnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFnOiBoLnRhZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBheWxvYWQ6IGgucGF5bG9hZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBoLmNhbGxiYWNrLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogbnVsbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsID09PSBkID8gKHAgPSBkID0gbSwgZiA9IHUpIDogZCA9IGQubmV4dCA9IG0sIHMgPiBsICYmIChsID0gcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gZCAmJiAoZCA9IGQubmV4dCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyYXRpb25UaW1lOiAxMDczNzQxODIzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VzcGVuc2VDb25maWc6IGguc3VzcGVuc2VDb25maWcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWc6IGgudGFnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF5bG9hZDogaC5wYXlsb2FkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IGguY2FsbGJhY2ssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBudWxsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpYyhzLCBoLnN1c3BlbnNlQ29uZmlnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBlLCB2ID0gaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAocyA9IHQsIG0gPSBuLCB2LnRhZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09PSB0eXBlb2YgKGcgPSB2LnBheWxvYWQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBnLmNhbGwobSwgdSwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5lZmZlY3RUYWcgPSAtNDA5NyAmIGcuZWZmZWN0VGFnIHwgNjQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IChzID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIChnID0gdi5wYXlsb2FkKSA/IGcuY2FsbChtLCB1LCBzKSA6IGcpIHx8IHZvaWQgMCA9PT0gcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gbyh7fSwgdSwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpaSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IGguY2FsbGJhY2sgJiYgKGUuZWZmZWN0VGFnIHw9IDMyLCBudWxsID09PSAocyA9IGkuZWZmZWN0cykgPyBpLmVmZmVjdHMgPSBbaF0gOiBzLnB1c2goaCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gKGggPSBoLm5leHQpIHx8IGggPT09IGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IChzID0gaS5zaGFyZWQucGVuZGluZykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IGEubmV4dCA9IHMubmV4dCwgcy5uZXh0ID0gYywgaS5iYXNlUXVldWUgPSBhID0gcywgaS5zaGFyZWQucGVuZGluZyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09PSBkID8gZiA9IHUgOiBkLm5leHQgPSBwLCBpLmJhc2VTdGF0ZSA9IGYsIGkuYmFzZVF1ZXVlID0gZCwgYWMobCksIGUuZXhwaXJhdGlvblRpbWUgPSBsLCBlLm1lbW9pemVkU3RhdGUgPSB1OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHBpKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZSA9IHQuZWZmZWN0cywgdC5lZmZlY3RzID0gbnVsbCwgbnVsbCAhPT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0ID0gMDsgdCA8IGUubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZVt0XSwgbyA9IHIuY2FsbGJhY2s7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLmNhbGxiYWNrID0gbnVsbCwgciA9IG8sIG8gPSBuLCAnZnVuY3Rpb24nICE9PSB0eXBlb2YgcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgxOTEsIHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmNhbGwobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBkaSA9IEsuUmVhY3RDdXJyZW50QmF0Y2hDb25maWcsIGhpID0gbmV3IHIuQ29tcG9uZW50KCkucmVmczsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG1pKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICBuID0gbnVsbCA9PT0gKG4gPSBuKHIsIHQgPSBlLm1lbW9pemVkU3RhdGUpKSB8fCB2b2lkIDAgPT09IG4gPyB0IDogbyh7fSwgdCwgbiksIGUubWVtb2l6ZWRTdGF0ZSA9IG4sIDAgPT09IGUuZXhwaXJhdGlvblRpbWUgJiYgKGUudXBkYXRlUXVldWUuYmFzZVN0YXRlID0gbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgZ2kgPSB7CiAgICAgICAgICAgICAgICAgICAgaXNNb3VudGVkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISEoZSA9IGUuX3JlYWN0SW50ZXJuYWxGaWJlcikgJiYgWmUoZSkgPT09IGU7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBlbnF1ZXVlU2V0U3RhdGU6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLl9yZWFjdEludGVybmFsRmliZXI7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gV3MoKSwgbyA9IGRpLnN1c3BlbnNlOwogICAgICAgICAgICAgICAgICAgICAgICAobyA9IGNpKHIgPSAkcyhyLCBlLCBvKSwgbykpLnBheWxvYWQgPSB0LCB2b2lkIDAgIT09IG4gJiYgbnVsbCAhPT0gbiAmJiAoby5jYWxsYmFjayA9IG4pLCB1aShlLCBvKSwgWXMoZSwgcik7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBlbnF1ZXVlUmVwbGFjZVN0YXRlOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5fcmVhY3RJbnRlcm5hbEZpYmVyOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFdzKCksIG8gPSBkaS5zdXNwZW5zZTsKICAgICAgICAgICAgICAgICAgICAgICAgKG8gPSBjaShyID0gJHMociwgZSwgbyksIG8pKS50YWcgPSAxLCBvLnBheWxvYWQgPSB0LCB2b2lkIDAgIT09IG4gJiYgbnVsbCAhPT0gbiAmJiAoby5jYWxsYmFjayA9IG4pLCB1aShlLCBvKSwgWXMoZSwgcik7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBlbnF1ZXVlRm9yY2VVcGRhdGU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLl9yZWFjdEludGVybmFsRmliZXI7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gV3MoKSwgciA9IGRpLnN1c3BlbnNlOwogICAgICAgICAgICAgICAgICAgICAgICAociA9IGNpKG4gPSAkcyhuLCBlLCByKSwgcikpLnRhZyA9IDIsIHZvaWQgMCAhPT0gdCAmJiBudWxsICE9PSB0ICYmIChyLmNhbGxiYWNrID0gdCksIHVpKGUsIHIpLCBZcyhlLCBuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gdmkoZSwgdCwgbiwgciwgbywgaSwgYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09PSB0eXBlb2YgKGUgPSBlLnN0YXRlTm9kZSkuc2hvdWxkQ29tcG9uZW50VXBkYXRlID8gZS5zaG91bGRDb21wb25lbnRVcGRhdGUociwgaSwgYSkgOiAhdC5wcm90b3R5cGUgfHwgIXQucHJvdG90eXBlLmlzUHVyZVJlYWN0Q29tcG9uZW50IHx8ICghTXIobiwgcikgfHwgIU1yKG8sIGkpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHlpKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICExLCBvID0gbG8sIGkgPSB0LmNvbnRleHRUeXBlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAnb2JqZWN0JyA9PT0gdHlwZW9mIGkgJiYgbnVsbCAhPT0gaSA/IGkgPSBvaShpKSA6IChvID0gZ28odCkgPyBobyA6IGZvLmN1cnJlbnQsIGkgPSAociA9IG51bGwgIT09IChyID0gdC5jb250ZXh0VHlwZXMpICYmIHZvaWQgMCAhPT0gcikgPyBtbyhlLCBvKSA6IGxvKSwgdCA9IG5ldyB0KG4sIGkpLCBlLm1lbW9pemVkU3RhdGUgPSBudWxsICE9PSB0LnN0YXRlICYmIHZvaWQgMCAhPT0gdC5zdGF0ZSA/IHQuc3RhdGUgOiBudWxsLCB0LnVwZGF0ZXIgPSBnaSwgZS5zdGF0ZU5vZGUgPSB0LCB0Ll9yZWFjdEludGVybmFsRmliZXIgPSBlLCByICYmICgoZSA9IGUuc3RhdGVOb2RlKS5fX3JlYWN0SW50ZXJuYWxNZW1vaXplZFVubWFza2VkQ2hpbGRDb250ZXh0ID0gbywgZS5fX3JlYWN0SW50ZXJuYWxNZW1vaXplZE1hc2tlZENoaWxkQ29udGV4dCA9IGkpLCB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYmkoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIGUgPSB0LnN0YXRlLCAnZnVuY3Rpb24nID09PSB0eXBlb2YgdC5jb21wb25lbnRXaWxsUmVjZWl2ZVByb3BzICYmIHQuY29tcG9uZW50V2lsbFJlY2VpdmVQcm9wcyhuLCByKSwgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHQuVU5TQUZFX2NvbXBvbmVudFdpbGxSZWNlaXZlUHJvcHMgJiYgdC5VTlNBRkVfY29tcG9uZW50V2lsbFJlY2VpdmVQcm9wcyhuLCByKSwgdC5zdGF0ZSAhPT0gZSAmJiBnaS5lbnF1ZXVlUmVwbGFjZVN0YXRlKHQsIHQuc3RhdGUsIG51bGwpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRWkoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHZhciBvID0gZS5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICAgICAgby5wcm9wcyA9IG4sIG8uc3RhdGUgPSBlLm1lbW9pemVkU3RhdGUsIG8ucmVmcyA9IGhpLCBhaShlKTsKICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHQuY29udGV4dFR5cGU7CiAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT09IHR5cGVvZiBpICYmIG51bGwgIT09IGkgPyBvLmNvbnRleHQgPSBvaShpKSA6IChpID0gZ28odCkgPyBobyA6IGZvLmN1cnJlbnQsIG8uY29udGV4dCA9IG1vKGUsIGkpKSwgZmkoZSwgbiwgbywgciksIG8uc3RhdGUgPSBlLm1lbW9pemVkU3RhdGUsICdmdW5jdGlvbicgPT09IHR5cGVvZiAoaSA9IHQuZ2V0RGVyaXZlZFN0YXRlRnJvbVByb3BzKSAmJiAobWkoZSwgdCwgaSwgbiksIG8uc3RhdGUgPSBlLm1lbW9pemVkU3RhdGUpLCAnZnVuY3Rpb24nID09PSB0eXBlb2YgdC5nZXREZXJpdmVkU3RhdGVGcm9tUHJvcHMgfHwgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIG8uZ2V0U25hcHNob3RCZWZvcmVVcGRhdGUgfHwgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIG8uVU5TQUZFX2NvbXBvbmVudFdpbGxNb3VudCAmJiAnZnVuY3Rpb24nICE9PSB0eXBlb2Ygby5jb21wb25lbnRXaWxsTW91bnQgfHwgKHQgPSBvLnN0YXRlLCAnZnVuY3Rpb24nID09PSB0eXBlb2Ygby5jb21wb25lbnRXaWxsTW91bnQgJiYgby5jb21wb25lbnRXaWxsTW91bnQoKSwgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIG8uVU5TQUZFX2NvbXBvbmVudFdpbGxNb3VudCAmJiBvLlVOU0FGRV9jb21wb25lbnRXaWxsTW91bnQoKSwgdCAhPT0gby5zdGF0ZSAmJiBnaS5lbnF1ZXVlUmVwbGFjZVN0YXRlKG8sIG8uc3RhdGUsIG51bGwpLCBmaShlLCBuLCBvLCByKSwgby5zdGF0ZSA9IGUubWVtb2l6ZWRTdGF0ZSksICdmdW5jdGlvbicgPT09IHR5cGVvZiBvLmNvbXBvbmVudERpZE1vdW50ICYmIChlLmVmZmVjdFRhZyB8PSA0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciB3aSA9IEFycmF5LmlzQXJyYXk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB4aShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IChlID0gbi5yZWYpICYmICdmdW5jdGlvbicgIT09IHR5cGVvZiBlICYmICdvYmplY3QnICE9PSB0eXBlb2YgZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5fb3duZXIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID0gbi5fb3duZXIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSAhPT0gbi50YWcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzA5KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLnN0YXRlTm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE0NywgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSAnJyArIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gdCAmJiBudWxsICE9PSB0LnJlZiAmJiAnZnVuY3Rpb24nID09PSB0eXBlb2YgdC5yZWYgJiYgdC5yZWYuX3N0cmluZ1JlZiA9PT0gbyA/IHQucmVmIDogKCh0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHIucmVmczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID09PSBoaSAmJiAodCA9IHIucmVmcyA9IHt9KSwgbnVsbCA9PT0gZSA/IGRlbGV0ZSB0W29dIDogdFtvXSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5fc3RyaW5nUmVmID0gbywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMjg0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbi5fb3duZXIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDI5MCwgZSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNpKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3RleHRhcmVhJyAhPT0gZS50eXBlKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDMxLCAnW29iamVjdCBPYmplY3RdJyA9PT0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKHQpID8gJ29iamVjdCB3aXRoIGtleXMgeycgKyBPYmplY3Qua2V5cyh0KS5qb2luKCcsICcpICsgJ30nIDogdCwgJycpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIENpKGUpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC5sYXN0RWZmZWN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gciA/IChyLm5leHRFZmZlY3QgPSBuLCB0Lmxhc3RFZmZlY3QgPSBuKSA6IHQuZmlyc3RFZmZlY3QgPSB0Lmxhc3RFZmZlY3QgPSBuLCBuLm5leHRFZmZlY3QgPSBudWxsLCBuLmVmZmVjdFRhZyA9IDg7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbnVsbCAhPT0gcjspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KG4sIHIpLCByID0gci5zaWJsaW5nOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IG5ldyBNYXAoKTsgbnVsbCAhPT0gdDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9PSB0LmtleSA/IGUuc2V0KHQua2V5LCB0KSA6IGUuc2V0KHQuaW5kZXgsIHQpLCB0ID0gdC5zaWJsaW5nOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IFRjKGUsIHQpKS5pbmRleCA9IDAsIGUuc2libGluZyA9IG51bGwsIGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkodCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5pbmRleCA9IHIsIGUgPyBudWxsICE9PSAociA9IHQuYWx0ZXJuYXRlKSA/IChyID0gci5pbmRleCkgPCBuID8gKHQuZWZmZWN0VGFnID0gMiwgbikgOiByIDogKHQuZWZmZWN0VGFnID0gMiwgbikgOiBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgbnVsbCA9PT0gdC5hbHRlcm5hdGUgJiYgKHQuZWZmZWN0VGFnID0gMiksIHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gdCB8fCA2ICE9PSB0LnRhZyA/ICgodCA9IE9jKG4sIGUubW9kZSwgcikpLnJldHVybiA9IGUsIHQpIDogKCh0ID0gbyh0LCBuKSkucmV0dXJuID0gZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gdCAmJiB0LmVsZW1lbnRUeXBlID09PSBuLnR5cGUgPyAoKHIgPSBvKHQsIG4ucHJvcHMpKS5yZWYgPSB4aShlLCB0LCBuKSwgci5yZXR1cm4gPSBlLCByKSA6ICgociA9IF9jKG4udHlwZSwgbi5rZXksIG4ucHJvcHMsIG51bGwsIGUubW9kZSwgcikpLnJlZiA9IHhpKGUsIHQsIG4pLCByLnJldHVybiA9IGUsIHIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT09IHQgfHwgNCAhPT0gdC50YWcgfHwgdC5zdGF0ZU5vZGUuY29udGFpbmVySW5mbyAhPT0gbi5jb250YWluZXJJbmZvIHx8IHQuc3RhdGVOb2RlLmltcGxlbWVudGF0aW9uICE9PSBuLmltcGxlbWVudGF0aW9uID8gKCh0ID0gSWMobiwgZS5tb2RlLCByKSkucmV0dXJuID0gZSwgdCkgOiAoKHQgPSBvKHQsIG4uY2hpbGRyZW4gfHwgW10pKS5yZXR1cm4gPSBlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZihlLCB0LCBuLCByLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09PSB0IHx8IDcgIT09IHQudGFnID8gKCh0ID0gUGMobiwgZS5tb2RlLCByLCBpKSkucmV0dXJuID0gZSwgdCkgOiAoKHQgPSBvKHQsIG4pKS5yZXR1cm4gPSBlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PT0gdHlwZW9mIHQgfHwgJ251bWJlcicgPT09IHR5cGVvZiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICh0ID0gT2MoJycgKyB0LCBlLm1vZGUsIG4pKS5yZXR1cm4gPSBlLCB0OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT09IHR5cGVvZiB0ICYmIG51bGwgIT09IHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodC4kJHR5cGVvZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBlZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG4gPSBfYyh0LnR5cGUsIHQua2V5LCB0LnByb3BzLCBudWxsLCBlLm1vZGUsIG4pKS5yZWYgPSB4aShlLCBudWxsLCB0KSwgbi5yZXR1cm4gPSBlLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB0ZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHQgPSBJYyh0LCBlLm1vZGUsIG4pKS5yZXR1cm4gPSBlLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpKHQpIHx8IG1lKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAodCA9IFBjKHQsIGUubW9kZSwgbiwgbnVsbCkpLnJldHVybiA9IGUsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBTaShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gbnVsbCAhPT0gdCA/IHQua2V5IDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09PSB0eXBlb2YgbiB8fCAnbnVtYmVyJyA9PT0gdHlwZW9mIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gbyA/IG51bGwgOiBjKGUsIHQsICcnICsgbiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gdHlwZW9mIG4gJiYgbnVsbCAhPT0gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChuLiQkdHlwZW9mKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGVlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmtleSA9PT0gbyA/IG4udHlwZSA9PT0gbmUgPyBmKGUsIHQsIG4ucHJvcHMuY2hpbGRyZW4sIHIsIG8pIDogdShlLCB0LCBuLCByKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHRlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmtleSA9PT0gbyA/IGwoZSwgdCwgbiwgcikgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpKG4pIHx8IG1lKG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBvID8gbnVsbCA6IGYoZSwgdCwgbiwgciwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBTaShlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaChlLCB0LCBuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PT0gdHlwZW9mIHIgfHwgJ251bWJlcicgPT09IHR5cGVvZiByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGModCwgZSA9IGUuZ2V0KG4pIHx8IG51bGwsICcnICsgciwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gdHlwZW9mIHIgJiYgbnVsbCAhPT0gcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChyLiQkdHlwZW9mKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGVlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gZS5nZXQobnVsbCA9PT0gci5rZXkgPyBuIDogci5rZXkpIHx8IG51bGwsIHIudHlwZSA9PT0gbmUgPyBmKHQsIGUsIHIucHJvcHMuY2hpbGRyZW4sIG8sIHIua2V5KSA6IHUodCwgZSwgciwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHRlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKHQsIGUgPSBlLmdldChudWxsID09PSByLmtleSA/IG4gOiByLmtleSkgfHwgbnVsbCwgciwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod2kocikgfHwgbWUocikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYodCwgZSA9IGUuZ2V0KG4pIHx8IG51bGwsIHIsIG8sIG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgU2kodCwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG0obywgYSwgcywgYykgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB1ID0gbnVsbCwgbCA9IG51bGwsIGYgPSBhLCBtID0gYSA9IDAsIGcgPSBudWxsOyBudWxsICE9PSBmICYmIG0gPCBzLmxlbmd0aDsgbSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLmluZGV4ID4gbSA/IChnID0gZiwgZiA9IG51bGwpIDogZyA9IGYuc2libGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB2ID0gZChvLCBmLCBzW21dLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSB2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCA9PT0gZiAmJiAoZiA9IGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiBmICYmIG51bGwgPT09IHYuYWx0ZXJuYXRlICYmIHQobywgZiksIGEgPSBpKHYsIGEsIG0pLCBudWxsID09PSBsID8gdSA9IHYgOiBsLnNpYmxpbmcgPSB2LCBsID0gdiwgZiA9IGc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG0gPT09IHMubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4obywgZiksIHU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbSA8IHMubGVuZ3RoOyBtKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gKGYgPSBwKG8sIHNbbV0sIGMpKSAmJiAoYSA9IGkoZiwgYSwgbSksIG51bGwgPT09IGwgPyB1ID0gZiA6IGwuc2libGluZyA9IGYsIGwgPSBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZiA9IHIobywgZik7IG0gPCBzLmxlbmd0aDsgbSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gKGcgPSBoKGYsIG8sIG0sIHNbbV0sIGMpKSAmJiAoZSAmJiBudWxsICE9PSBnLmFsdGVybmF0ZSAmJiBmLmRlbGV0ZShudWxsID09PSBnLmtleSA/IG0gOiBnLmtleSksIGEgPSBpKGcsIGEsIG0pLCBudWxsID09PSBsID8gdSA9IGcgOiBsLnNpYmxpbmcgPSBnLCBsID0gZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGYuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQobywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB1OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnKG8sIHMsIGMsIHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBtZShjKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT09IHR5cGVvZiBsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgxNTApKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gKGMgPSBsLmNhbGwoYykpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgxNTEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiA9IGwgPSBudWxsLCBtID0gcywgZyA9IHMgPSAwLCB2ID0gbnVsbCwgeSA9IGMubmV4dCgpOyBudWxsICE9PSBtICYmICF5LmRvbmU7IGcrKywgeSA9IGMubmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtLmluZGV4ID4gZyA/ICh2ID0gbSwgbSA9IG51bGwpIDogdiA9IG0uc2libGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gZChvLCBtLCB5LnZhbHVlLCB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCA9PT0gbSAmJiAobSA9IHYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiBtICYmIG51bGwgPT09IGIuYWx0ZXJuYXRlICYmIHQobywgbSksIHMgPSBpKGIsIHMsIGcpLCBudWxsID09PSBmID8gbCA9IGIgOiBmLnNpYmxpbmcgPSBiLCBmID0gYiwgbSA9IHY7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkuZG9uZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKG8sIG0pLCBsOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gbSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7ICF5LmRvbmU7IGcrKywgeSA9IGMubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09ICh5ID0gcChvLCB5LnZhbHVlLCB1KSkgJiYgKHMgPSBpKHksIHMsIGcpLCBudWxsID09PSBmID8gbCA9IHkgOiBmLnNpYmxpbmcgPSB5LCBmID0geSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG0gPSByKG8sIG0pOyAheS5kb25lOyBnKyssIHkgPSBjLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09ICh5ID0gaChtLCBvLCBnLCB5LnZhbHVlLCB1KSkgJiYgKGUgJiYgbnVsbCAhPT0geS5hbHRlcm5hdGUgJiYgbS5kZWxldGUobnVsbCA9PT0geS5rZXkgPyBnIDogeS5rZXkpLCBzID0gaSh5LCBzLCBnKSwgbnVsbCA9PT0gZiA/IGwgPSB5IDogZi5zaWJsaW5nID0geSwgZiA9IHkpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBtLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KG8sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlLCByLCBpLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gJ29iamVjdCcgPT09IHR5cGVvZiBpICYmIG51bGwgIT09IGkgJiYgaS50eXBlID09PSBuZSAmJiBudWxsID09PSBpLmtleTsKICAgICAgICAgICAgICAgICAgICAgICAgdSAmJiAoaSA9IGkucHJvcHMuY2hpbGRyZW4pOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9ICdvYmplY3QnID09PSB0eXBlb2YgaSAmJiBudWxsICE9PSBpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoaS4kJHR5cGVvZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBlZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobCA9IGkua2V5LCB1ID0gcjsgbnVsbCAhPT0gdTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1LmtleSA9PT0gbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodS50YWcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpLnR5cGUgPT09IG5lKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGUsIHUuc2libGluZyksIChyID0gbyh1LCBpLnByb3BzLmNoaWxkcmVuKSkucmV0dXJuID0gZSwgZSA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1LmVsZW1lbnRUeXBlID09PSBpLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4oZSwgdS5zaWJsaW5nKSwgKHIgPSBvKHUsIGkucHJvcHMpKS5yZWYgPSB4aShlLCB1LCBpKSwgci5yZXR1cm4gPSBlLCBlID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihlLCB1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoZSwgdSksIHUgPSB1LnNpYmxpbmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS50eXBlID09PSBuZSA/ICgociA9IFBjKGkucHJvcHMuY2hpbGRyZW4sIGUubW9kZSwgYywgaS5rZXkpKS5yZXR1cm4gPSBlLCBlID0gcikgOiAoKGMgPSBfYyhpLnR5cGUsIGkua2V5LCBpLnByb3BzLCBudWxsLCBlLm1vZGUsIGMpKS5yZWYgPSB4aShlLCByLCBpKSwgYy5yZXR1cm4gPSBlLCBlID0gYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB0ZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodSA9IGkua2V5OyBudWxsICE9PSByOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIua2V5ID09PSB1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDQgPT09IHIudGFnICYmIHIuc3RhdGVOb2RlLmNvbnRhaW5lckluZm8gPT09IGkuY29udGFpbmVySW5mbyAmJiByLnN0YXRlTm9kZS5pbXBsZW1lbnRhdGlvbiA9PT0gaS5pbXBsZW1lbnRhdGlvbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGUsIHIuc2libGluZyksIChyID0gbyhyLCBpLmNoaWxkcmVuIHx8IFtdKSkucmV0dXJuID0gZSwgZSA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4oZSwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGUsIHIpLCByID0gci5zaWJsaW5nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChyID0gSWMoaSwgZS5tb2RlLCBjKSkucmV0dXJuID0gZSwgZSA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT09IHR5cGVvZiBpIHx8ICdudW1iZXInID09PSB0eXBlb2YgaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID0gJycgKyBpLCBudWxsICE9PSByICYmIDYgPT09IHIudGFnID8gKG4oZSwgci5zaWJsaW5nKSwgKHIgPSBvKHIsIGkpKS5yZXR1cm4gPSBlLCBlID0gcikgOiAobihlLCByKSwgKHIgPSBPYyhpLCBlLm1vZGUsIGMpKS5yZXR1cm4gPSBlLCBlID0gciksIHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3aShpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKGUsIHIsIGksIGMpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobWUoaSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyhlLCByLCBpLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGwgJiYgU2koZSwgaSksICd1bmRlZmluZWQnID09PSB0eXBlb2YgaSAmJiAhdSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS50YWcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBlID0gZS50eXBlLCBFcnJvcihhKDE1MiwgZS5kaXNwbGF5TmFtZSB8fCBlLm5hbWUgfHwgJ0NvbXBvbmVudCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oZSwgcik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBraSA9IENpKCEwKSwgVGkgPSBDaSghMSksIF9pID0ge30sIFBpID0geyBjdXJyZW50OiBfaSB9LCBPaSA9IHsgY3VycmVudDogX2kgfSwgSWkgPSB7IGN1cnJlbnQ6IF9pIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMaShlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IF9pKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE3NCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQWkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodW8oSWksIHQpLCB1byhPaSwgZSksIHVvKFBpLCBfaSksIGUgPSB0Lm5vZGVUeXBlKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA5OgogICAgICAgICAgICAgICAgICAgIGNhc2UgMTE6CiAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAodCA9IHQuZG9jdW1lbnRFbGVtZW50KSA/IHQubmFtZXNwYWNlVVJJIDogRmUobnVsbCwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICB0ID0gRmUodCA9IChlID0gOCA9PT0gZSA/IHQucGFyZW50Tm9kZSA6IHQpLm5hbWVzcGFjZVVSSSB8fCBudWxsLCBlID0gZS50YWdOYW1lKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgY28oUGkpLCB1byhQaSwgdCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBSaSgpIHsKICAgICAgICAgICAgICAgICAgICBjbyhQaSksIGNvKE9pKSwgY28oSWkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTmkoZSkgewogICAgICAgICAgICAgICAgICAgIExpKElpLmN1cnJlbnQpOwogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gTGkoUGkuY3VycmVudCksIG4gPSBGZSh0LCBlLnR5cGUpOwogICAgICAgICAgICAgICAgICAgIHQgIT09IG4gJiYgKHVvKE9pLCBlKSwgdW8oUGksIG4pKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGppKGUpIHsKICAgICAgICAgICAgICAgICAgICBPaS5jdXJyZW50ID09PSBlICYmIChjbyhQaSksIGNvKE9pKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgcWkgPSB7IGN1cnJlbnQ6IDAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEZpKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gZTsgbnVsbCAhPT0gdDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEzID09PSB0LnRhZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0Lm1lbW9pemVkU3RhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gbiAmJiAobnVsbCA9PT0gKG4gPSBuLmRlaHlkcmF0ZWQpIHx8ICckPycgPT09IG4uZGF0YSB8fCAnJCEnID09PSBuLmRhdGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKDE5ID09PSB0LnRhZyAmJiB2b2lkIDAgIT09IHQubWVtb2l6ZWRQcm9wcy5yZXZlYWxPcmRlcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09ICg2NCAmIHQuZWZmZWN0VGFnKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChudWxsICE9PSB0LmNoaWxkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmNoaWxkLnJldHVybiA9IHQsIHQgPSB0LmNoaWxkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IG51bGwgPT09IHQuc2libGluZzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSB0LnJldHVybiB8fCB0LnJldHVybiA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0LnJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB0LnNpYmxpbmcucmV0dXJuID0gdC5yZXR1cm4sIHQgPSB0LnNpYmxpbmc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRGkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbmRlcjogZSwKICAgICAgICAgICAgICAgICAgICAgICAgcHJvcHM6IHQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIE1pID0gSy5SZWFjdEN1cnJlbnREaXNwYXRjaGVyLCBVaSA9IEsuUmVhY3RDdXJyZW50QmF0Y2hDb25maWcsIFZpID0gMCwgQmkgPSBudWxsLCB6aSA9IG51bGwsIEdpID0gbnVsbCwgSGkgPSAhMTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFdpKCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzIxKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiAkaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMDsgbiA8IHQubGVuZ3RoICYmIG4gPCBlLmxlbmd0aDsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIUZyKGVbbl0sIHRbbl0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFlpKGUsIHQsIG4sIHIsIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoVmkgPSBpLCBCaSA9IHQsIHQubWVtb2l6ZWRTdGF0ZSA9IG51bGwsIHQudXBkYXRlUXVldWUgPSBudWxsLCB0LmV4cGlyYXRpb25UaW1lID0gMCwgTWkuY3VycmVudCA9IG51bGwgPT09IGUgfHwgbnVsbCA9PT0gZS5tZW1vaXplZFN0YXRlID8gdmEgOiB5YSwgZSA9IG4ociwgbyksIHQuZXhwaXJhdGlvblRpbWUgPT09IFZpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5leHBpcmF0aW9uVGltZSA9IDAsICEoMjUgPiBpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDMwMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaSArPSAxLCBHaSA9IHppID0gbnVsbCwgdC51cGRhdGVRdWV1ZSA9IG51bGwsIE1pLmN1cnJlbnQgPSBiYSwgZSA9IG4ociwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKHQuZXhwaXJhdGlvblRpbWUgPT09IFZpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKE1pLmN1cnJlbnQgPSBnYSwgdCA9IG51bGwgIT09IHppICYmIG51bGwgIT09IHppLm5leHQsIFZpID0gMCwgR2kgPSB6aSA9IEJpID0gbnVsbCwgSGkgPSAhMSwgdCkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgzMDApKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFFpKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gewogICAgICAgICAgICAgICAgICAgICAgICBtZW1vaXplZFN0YXRlOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBiYXNlU3RhdGU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGJhc2VRdWV1ZTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgcXVldWU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IG51bGwKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09PSBHaSA/IEJpLm1lbW9pemVkU3RhdGUgPSBHaSA9IGUgOiBHaSA9IEdpLm5leHQgPSBlLCBHaTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEtpKCkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSB6aSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IEJpLmFsdGVybmF0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IG51bGwgIT09IGUgPyBlLm1lbW9pemVkU3RhdGUgOiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBlID0gemkubmV4dDsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG51bGwgPT09IEdpID8gQmkubWVtb2l6ZWRTdGF0ZSA6IEdpLm5leHQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgIEdpID0gdCwgemkgPSBlOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzEwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZW1vaXplZFN0YXRlOiAoemkgPSBlKS5tZW1vaXplZFN0YXRlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFzZVN0YXRlOiB6aS5iYXNlU3RhdGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYXNlUXVldWU6IHppLmJhc2VRdWV1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1ZXVlOiB6aS5xdWV1ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IG51bGwKICAgICAgICAgICAgICAgICAgICAgICAgfSwgbnVsbCA9PT0gR2kgPyBCaS5tZW1vaXplZFN0YXRlID0gR2kgPSBlIDogR2kgPSBHaS5uZXh0ID0gZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEdpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSmkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09PSB0eXBlb2YgdCA/IHQoZSkgOiB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gWGkoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gS2koKSwgbiA9IHQucXVldWU7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzExKSk7CiAgICAgICAgICAgICAgICAgICAgbi5sYXN0UmVuZGVyZWRSZWR1Y2VyID0gZTsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHppLCBvID0gci5iYXNlUXVldWUsIGkgPSBuLnBlbmRpbmc7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gby5uZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgby5uZXh0ID0gaS5uZXh0LCBpLm5leHQgPSBzOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHIuYmFzZVF1ZXVlID0gbyA9IGksIG4ucGVuZGluZyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBvLm5leHQsIHIgPSByLmJhc2VTdGF0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBzID0gaSA9IG51bGwsIHUgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IHUuZXhwaXJhdGlvblRpbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobCA8IFZpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyYXRpb25UaW1lOiB1LmV4cGlyYXRpb25UaW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdXNwZW5zZUNvbmZpZzogdS5zdXNwZW5zZUNvbmZpZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiB1LmFjdGlvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWFnZXJSZWR1Y2VyOiB1LmVhZ2VyUmVkdWNlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWFnZXJTdGF0ZTogdS5lYWdlclN0YXRlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBudWxsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsID09PSBjID8gKHMgPSBjID0gZiwgaSA9IHIpIDogYyA9IGMubmV4dCA9IGYsIGwgPiBCaS5leHBpcmF0aW9uVGltZSAmJiAoQmkuZXhwaXJhdGlvblRpbWUgPSBsLCBhYyhsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9PSBjICYmIChjID0gYy5uZXh0ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBpcmF0aW9uVGltZTogMTA3Mzc0MTgyMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VzcGVuc2VDb25maWc6IHUuc3VzcGVuc2VDb25maWcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbjogdS5hY3Rpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVhZ2VyUmVkdWNlcjogdS5lYWdlclJlZHVjZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVhZ2VyU3RhdGU6IHUuZWFnZXJTdGF0ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogbnVsbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpYyhsLCB1LnN1c3BlbnNlQ29uZmlnKSwgciA9IHUuZWFnZXJSZWR1Y2VyID09PSBlID8gdS5lYWdlclN0YXRlIDogZShyLCB1LmFjdGlvbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gdS5uZXh0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlIChudWxsICE9PSB1ICYmIHUgIT09IG8pOwogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09PSBjID8gaSA9IHIgOiBjLm5leHQgPSBzLCBGcihyLCB0Lm1lbW9pemVkU3RhdGUpIHx8IChJYSA9ICEwKSwgdC5tZW1vaXplZFN0YXRlID0gciwgdC5iYXNlU3RhdGUgPSBpLCB0LmJhc2VRdWV1ZSA9IGMsIG4ubGFzdFJlbmRlcmVkU3RhdGUgPSByOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICB0Lm1lbW9pemVkU3RhdGUsCiAgICAgICAgICAgICAgICAgICAgICAgIG4uZGlzcGF0Y2gKICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gWmkoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gS2koKSwgbiA9IHQucXVldWU7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzExKSk7CiAgICAgICAgICAgICAgICAgICAgbi5sYXN0UmVuZGVyZWRSZWR1Y2VyID0gZTsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4uZGlzcGF0Y2gsIG8gPSBuLnBlbmRpbmcsIGkgPSB0Lm1lbW9pemVkU3RhdGU7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgbi5wZW5kaW5nID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBvID0gby5uZXh0OwogICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gZShpLCBzLmFjdGlvbiksIHMgPSBzLm5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKHMgIT09IG8pOwogICAgICAgICAgICAgICAgICAgICAgICBGcihpLCB0Lm1lbW9pemVkU3RhdGUpIHx8IChJYSA9ICEwKSwgdC5tZW1vaXplZFN0YXRlID0gaSwgbnVsbCA9PT0gdC5iYXNlUXVldWUgJiYgKHQuYmFzZVN0YXRlID0gaSksIG4ubGFzdFJlbmRlcmVkU3RhdGUgPSBpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICBpLAogICAgICAgICAgICAgICAgICAgICAgICByCiAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGVhKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFFpKCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgPT09IHR5cGVvZiBlICYmIChlID0gZSgpKSwgdC5tZW1vaXplZFN0YXRlID0gdC5iYXNlU3RhdGUgPSBlLCBlID0gKGUgPSB0LnF1ZXVlID0gewogICAgICAgICAgICAgICAgICAgICAgICBwZW5kaW5nOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBkaXNwYXRjaDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFJlbmRlcmVkUmVkdWNlcjogSmksCiAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RSZW5kZXJlZFN0YXRlOiBlCiAgICAgICAgICAgICAgICAgICAgfSkuZGlzcGF0Y2ggPSBtYS5iaW5kKG51bGwsIEJpLCBlKSwgWwogICAgICAgICAgICAgICAgICAgICAgICB0Lm1lbW9pemVkU3RhdGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGUKICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdGEoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gewogICAgICAgICAgICAgICAgICAgICAgICB0YWc6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGNyZWF0ZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgZGVzdHJveTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgZGVwczogciwKICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogbnVsbAogICAgICAgICAgICAgICAgICAgIH0sIG51bGwgPT09ICh0ID0gQmkudXBkYXRlUXVldWUpID8gKHQgPSB7IGxhc3RFZmZlY3Q6IG51bGwgfSwgQmkudXBkYXRlUXVldWUgPSB0LCB0Lmxhc3RFZmZlY3QgPSBlLm5leHQgPSBlKSA6IG51bGwgPT09IChuID0gdC5sYXN0RWZmZWN0KSA/IHQubGFzdEVmZmVjdCA9IGUubmV4dCA9IGUgOiAociA9IG4ubmV4dCwgbi5uZXh0ID0gZSwgZS5uZXh0ID0gciwgdC5sYXN0RWZmZWN0ID0gZSksIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBuYSgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gS2koKS5tZW1vaXplZFN0YXRlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcmEoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHZhciBvID0gUWkoKTsKICAgICAgICAgICAgICAgICAgICBCaS5lZmZlY3RUYWcgfD0gZSwgby5tZW1vaXplZFN0YXRlID0gdGEoMSB8IHQsIG4sIHZvaWQgMCwgdm9pZCAwID09PSByID8gbnVsbCA6IHIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gb2EoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHZhciBvID0gS2koKTsKICAgICAgICAgICAgICAgICAgICByID0gdm9pZCAwID09PSByID8gbnVsbCA6IHI7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHppKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gemkubWVtb2l6ZWRTdGF0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPSBhLmRlc3Ryb3ksIG51bGwgIT09IHIgJiYgJGkociwgYS5kZXBzKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIHRhKHQsIG4sIGksIHIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBCaS5lZmZlY3RUYWcgfD0gZSwgby5tZW1vaXplZFN0YXRlID0gdGEoMSB8IHQsIG4sIGksIHIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaWEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiByYSg1MTYsIDQsIGUsIHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYWEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBvYSg1MTYsIDQsIGUsIHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gc2EoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBvYSg0LCAyLCBlLCB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGNhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHQgPyAoZSA9IGUoKSwgdChlKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0KG51bGwpOwogICAgICAgICAgICAgICAgICAgIH0pIDogbnVsbCAhPT0gdCAmJiB2b2lkIDAgIT09IHQgPyAoZSA9IGUoKSwgdC5jdXJyZW50ID0gZSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0LmN1cnJlbnQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIH0pIDogdm9pZCAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdWEoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gbnVsbCAhPT0gbiAmJiB2b2lkIDAgIT09IG4gPyBuLmNvbmNhdChbZV0pIDogbnVsbCwgb2EoNCwgMiwgY2EuYmluZChudWxsLCB0LCBlKSwgbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBsYSgpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGZhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWkoKS5tZW1vaXplZFN0YXRlID0gWwogICAgICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IHQgPyBudWxsIDogdAogICAgICAgICAgICAgICAgICAgIF0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBwYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBLaSgpOwogICAgICAgICAgICAgICAgICAgIHQgPSB2b2lkIDAgPT09IHQgPyBudWxsIDogdDsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4ubWVtb2l6ZWRTdGF0ZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gciAmJiBudWxsICE9PSB0ICYmICRpKHQsIHJbMV0pID8gclswXSA6IChuLm1lbW9pemVkU3RhdGUgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgICAgIHQKICAgICAgICAgICAgICAgICAgICBdLCBlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGRhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IEtpKCk7CiAgICAgICAgICAgICAgICAgICAgdCA9IHZvaWQgMCA9PT0gdCA/IG51bGwgOiB0OwogICAgICAgICAgICAgICAgICAgIHZhciByID0gbi5tZW1vaXplZFN0YXRlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSByICYmIG51bGwgIT09IHQgJiYgJGkodCwgclsxXSkgPyByWzBdIDogKGUgPSBlKCksIG4ubWVtb2l6ZWRTdGF0ZSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgdAogICAgICAgICAgICAgICAgICAgIF0sIGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaGEoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gVm8oKTsKICAgICAgICAgICAgICAgICAgICB6byg5OCA+IHIgPyA5OCA6IHIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSghMCk7CiAgICAgICAgICAgICAgICAgICAgfSksIHpvKDk3IDwgciA/IDk3IDogciwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IFVpLnN1c3BlbnNlOwogICAgICAgICAgICAgICAgICAgICAgICBVaS5zdXNwZW5zZSA9IHZvaWQgMCA9PT0gdCA/IG51bGwgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSghMSksIG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVpLnN1c3BlbnNlID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbWEoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gV3MoKSwgbyA9IGRpLnN1c3BlbnNlOwogICAgICAgICAgICAgICAgICAgIG8gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyYXRpb25UaW1lOiByID0gJHMociwgZSwgbyksCiAgICAgICAgICAgICAgICAgICAgICAgIHN1c3BlbnNlQ29uZmlnOiBvLAogICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb246IG4sCiAgICAgICAgICAgICAgICAgICAgICAgIGVhZ2VyUmVkdWNlcjogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgZWFnZXJTdGF0ZTogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogbnVsbAogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0LnBlbmRpbmc7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGkgPyBvLm5leHQgPSBvIDogKG8ubmV4dCA9IGkubmV4dCwgaS5uZXh0ID0gbyksIHQucGVuZGluZyA9IG8sIGkgPSBlLmFsdGVybmF0ZSwgZSA9PT0gQmkgfHwgbnVsbCAhPT0gaSAmJiBpID09PSBCaSkKICAgICAgICAgICAgICAgICAgICAgICAgSGkgPSAhMCwgby5leHBpcmF0aW9uVGltZSA9IFZpLCBCaS5leHBpcmF0aW9uVGltZSA9IFZpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gZS5leHBpcmF0aW9uVGltZSAmJiAobnVsbCA9PT0gaSB8fCAwID09PSBpLmV4cGlyYXRpb25UaW1lKSAmJiBudWxsICE9PSAoaSA9IHQubGFzdFJlbmRlcmVkUmVkdWNlcikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdC5sYXN0UmVuZGVyZWRTdGF0ZSwgcyA9IGkoYSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8uZWFnZXJSZWR1Y2VyID0gaSwgby5lYWdlclN0YXRlID0gcywgRnIocywgYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgWXMoZSwgcik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGdhID0gewogICAgICAgICAgICAgICAgICAgICAgICByZWFkQ29udGV4dDogb2ksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZUNhbGxiYWNrOiBXaSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlQ29udGV4dDogV2ksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZUVmZmVjdDogV2ksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZUltcGVyYXRpdmVIYW5kbGU6IFdpLAogICAgICAgICAgICAgICAgICAgICAgICB1c2VMYXlvdXRFZmZlY3Q6IFdpLAogICAgICAgICAgICAgICAgICAgICAgICB1c2VNZW1vOiBXaSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlUmVkdWNlcjogV2ksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZVJlZjogV2ksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZVN0YXRlOiBXaSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlRGVidWdWYWx1ZTogV2ksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZVJlc3BvbmRlcjogV2ksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZURlZmVycmVkVmFsdWU6IFdpLAogICAgICAgICAgICAgICAgICAgICAgICB1c2VUcmFuc2l0aW9uOiBXaQogICAgICAgICAgICAgICAgICAgIH0sIHZhID0gewogICAgICAgICAgICAgICAgICAgICAgICByZWFkQ29udGV4dDogb2ksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZUNhbGxiYWNrOiBmYSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlQ29udGV4dDogb2ksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZUVmZmVjdDogaWEsCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZUltcGVyYXRpdmVIYW5kbGU6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9IG51bGwgIT09IG4gJiYgdm9pZCAwICE9PSBuID8gbi5jb25jYXQoW2VdKSA6IG51bGwsIHJhKDQsIDIsIGNhLmJpbmQobnVsbCwgdCwgZSksIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c2VMYXlvdXRFZmZlY3Q6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmEoNCwgMiwgZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZU1lbW86IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFFpKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9IHZvaWQgMCA9PT0gdCA/IG51bGwgOiB0LCBlID0gZSgpLCBuLm1lbW9pemVkU3RhdGUgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c2VSZWR1Y2VyOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBRaSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSB2b2lkIDAgIT09IG4gPyBuKHQpIDogdCwgci5tZW1vaXplZFN0YXRlID0gci5iYXNlU3RhdGUgPSB0LCBlID0gKGUgPSByLnF1ZXVlID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlbmRpbmc6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2g6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFzdFJlbmRlcmVkUmVkdWNlcjogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0UmVuZGVyZWRTdGF0ZTogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuZGlzcGF0Y2ggPSBtYS5iaW5kKG51bGwsIEJpLCBlKSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIubWVtb2l6ZWRTdGF0ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c2VSZWY6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IHsgY3VycmVudDogZSB9LCBRaSgpLm1lbW9pemVkU3RhdGUgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c2VTdGF0ZTogZWEsCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZURlYnVnVmFsdWU6IGxhLAogICAgICAgICAgICAgICAgICAgICAgICB1c2VSZXNwb25kZXI6IERpLAogICAgICAgICAgICAgICAgICAgICAgICB1c2VEZWZlcnJlZFZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlYShlKSwgciA9IG5bMF0sIG8gPSBuWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlhKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFVpLnN1c3BlbnNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVpLnN1c3BlbnNlID0gdm9pZCAwID09PSB0ID8gbnVsbCA6IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVaS5zdXNwZW5zZSA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIHI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZVRyYW5zaXRpb246IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVhKCExKSwgbiA9IHRbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9IHRbMV0sIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYShoYS5iaW5kKG51bGwsIHQsIGUpLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgeWEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlYWRDb250ZXh0OiBvaSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlQ2FsbGJhY2s6IHBhLAogICAgICAgICAgICAgICAgICAgICAgICB1c2VDb250ZXh0OiBvaSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlRWZmZWN0OiBhYSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlSW1wZXJhdGl2ZUhhbmRsZTogdWEsCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZUxheW91dEVmZmVjdDogc2EsCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZU1lbW86IGRhLAogICAgICAgICAgICAgICAgICAgICAgICB1c2VSZWR1Y2VyOiBYaSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlUmVmOiBuYSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlU3RhdGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBYaShKaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZURlYnVnVmFsdWU6IGxhLAogICAgICAgICAgICAgICAgICAgICAgICB1c2VSZXNwb25kZXI6IERpLAogICAgICAgICAgICAgICAgICAgICAgICB1c2VEZWZlcnJlZFZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBYaShKaSksIHIgPSBuWzBdLCBvID0gblsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhYShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBVaS5zdXNwZW5zZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBVaS5zdXNwZW5zZSA9IHZvaWQgMCA9PT0gdCA/IG51bGwgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVWkuc3VzcGVuc2UgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCByOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c2VUcmFuc2l0aW9uOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBYaShKaSksIG4gPSB0WzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSB0WzFdLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGEoaGEuYmluZChudWxsLCB0LCBlKSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGJhID0gewogICAgICAgICAgICAgICAgICAgICAgICByZWFkQ29udGV4dDogb2ksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZUNhbGxiYWNrOiBwYSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlQ29udGV4dDogb2ksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZUVmZmVjdDogYWEsCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZUltcGVyYXRpdmVIYW5kbGU6IHVhLAogICAgICAgICAgICAgICAgICAgICAgICB1c2VMYXlvdXRFZmZlY3Q6IHNhLAogICAgICAgICAgICAgICAgICAgICAgICB1c2VNZW1vOiBkYSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlUmVkdWNlcjogWmksCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZVJlZjogbmEsCiAgICAgICAgICAgICAgICAgICAgICAgIHVzZVN0YXRlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWmkoSmkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB1c2VEZWJ1Z1ZhbHVlOiBsYSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlUmVzcG9uZGVyOiBEaSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlRGVmZXJyZWRWYWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gWmkoSmkpLCByID0gblswXSwgbyA9IG5bMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYWEoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gVWkuc3VzcGVuc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVWkuc3VzcGVuc2UgPSB2b2lkIDAgPT09IHQgPyBudWxsIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVpLnN1c3BlbnNlID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdXNlVHJhbnNpdGlvbjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gWmkoSmkpLCBuID0gdFswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gdFsxXSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhKGhhLmJpbmQobnVsbCwgdCwgZSksIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBFYSA9IG51bGwsIHdhID0gbnVsbCwgeGEgPSAhMTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IENjKDUsIG51bGwsIG51bGwsIDApOwogICAgICAgICAgICAgICAgICAgIG4uZWxlbWVudFR5cGUgPSAnREVMRVRFRCcsIG4udHlwZSA9ICdERUxFVEVEJywgbi5zdGF0ZU5vZGUgPSB0LCBuLnJldHVybiA9IGUsIG4uZWZmZWN0VGFnID0gOCwgbnVsbCAhPT0gZS5sYXN0RWZmZWN0ID8gKGUubGFzdEVmZmVjdC5uZXh0RWZmZWN0ID0gbiwgZS5sYXN0RWZmZWN0ID0gbikgOiBlLmZpcnN0RWZmZWN0ID0gZS5sYXN0RWZmZWN0ID0gbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIENhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUudGFnKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA1OgogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUudHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09ICh0ID0gMSAhPT0gdC5ub2RlVHlwZSB8fCBuLnRvTG93ZXJDYXNlKCkgIT09IHQubm9kZU5hbWUudG9Mb3dlckNhc2UoKSA/IG51bGwgOiB0KSAmJiAoZS5zdGF0ZU5vZGUgPSB0LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gKHQgPSAnJyA9PT0gZS5wZW5kaW5nUHJvcHMgfHwgMyAhPT0gdC5ub2RlVHlwZSA/IG51bGwgOiB0KSAmJiAoZS5zdGF0ZU5vZGUgPSB0LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzoKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24ga2EoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICh4YSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHdhOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFDYShlLCB0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKHQgPSB3bihuLm5leHRTaWJsaW5nKSkgfHwgIUNhKGUsIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5lZmZlY3RUYWcgPSAtMTAyNSAmIGUuZWZmZWN0VGFnIHwgMiwgeGEgPSAhMSwgdm9pZCAoRWEgPSBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTYShFYSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBFYSA9IGUsIHdhID0gd24odC5maXJzdENoaWxkKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmVmZmVjdFRhZyA9IC0xMDI1ICYgZS5lZmZlY3RUYWcgfCAyLCB4YSA9ICExLCBFYSA9IGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gVGEoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IGUucmV0dXJuOyBudWxsICE9PSBlICYmIDUgIT09IGUudGFnICYmIDMgIT09IGUudGFnICYmIDEzICE9PSBlLnRhZzspCiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLnJldHVybjsKICAgICAgICAgICAgICAgICAgICBFYSA9IGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBfYShlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUgIT09IEVhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgaWYgKCF4YSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRhKGUpLCB4YSA9ICEwLCAhMTsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudHlwZTsKICAgICAgICAgICAgICAgICAgICBpZiAoNSAhPT0gZS50YWcgfHwgJ2hlYWQnICE9PSB0ICYmICdib2R5JyAhPT0gdCAmJiAheW4odCwgZS5tZW1vaXplZFByb3BzKSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0ID0gd2E7IHQ7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgU2EoZSwgdCksIHQgPSB3bih0Lm5leHRTaWJsaW5nKTsKICAgICAgICAgICAgICAgICAgICBpZiAoVGEoZSksIDEzID09PSBlLnRhZykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlID0gbnVsbCAhPT0gKGUgPSBlLm1lbW9pemVkU3RhdGUpID8gZS5kZWh5ZHJhdGVkIDogbnVsbCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDMxNykpOwogICAgICAgICAgICAgICAgICAgICAgICBlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSBlLm5leHRTaWJsaW5nLCB0ID0gMDsgZTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoOCA9PT0gZS5ub2RlVHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCcvJCcgPT09IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2EgPSB3bihlLm5leHRTaWJsaW5nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC0tOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICckJyAhPT0gbiAmJiAnJCEnICE9PSBuICYmICckPycgIT09IG4gfHwgdCsrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5uZXh0U2libGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdhID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICB3YSA9IEVhID8gd24oZS5zdGF0ZU5vZGUubmV4dFNpYmxpbmcpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBQYSgpIHsKICAgICAgICAgICAgICAgICAgICB3YSA9IEVhID0gbnVsbCwgeGEgPSAhMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBPYSA9IEsuUmVhY3RDdXJyZW50T3duZXIsIElhID0gITE7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMYShlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgdC5jaGlsZCA9IG51bGwgPT09IGUgPyBUaSh0LCBudWxsLCBuLCByKSA6IGtpKHQsIGUuY2hpbGQsIG4sIHIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQWEoZSwgdCwgbiwgciwgbykgewogICAgICAgICAgICAgICAgICAgIG4gPSBuLnJlbmRlcjsKICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHQucmVmOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByaSh0LCBvKSwgciA9IFlpKGUsIHQsIG4sIHIsIGksIG8pLCBudWxsID09PSBlIHx8IElhID8gKHQuZWZmZWN0VGFnIHw9IDEsIExhKGUsIHQsIHIsIG8pLCB0LmNoaWxkKSA6ICh0LnVwZGF0ZVF1ZXVlID0gZS51cGRhdGVRdWV1ZSwgdC5lZmZlY3RUYWcgJj0gLTUxNywgZS5leHBpcmF0aW9uVGltZSA8PSBvICYmIChlLmV4cGlyYXRpb25UaW1lID0gMCksIFlhKGUsIHQsIG8pKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFJhKGUsIHQsIG4sIHIsIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4udHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgIT09IHR5cGVvZiBhIHx8IGtjKGEpIHx8IHZvaWQgMCAhPT0gYS5kZWZhdWx0UHJvcHMgfHwgbnVsbCAhPT0gbi5jb21wYXJlIHx8IHZvaWQgMCAhPT0gbi5kZWZhdWx0UHJvcHMgPyAoKGUgPSBfYyhuLnR5cGUsIG51bGwsIHIsIG51bGwsIHQubW9kZSwgaSkpLnJlZiA9IHQucmVmLCBlLnJldHVybiA9IHQsIHQuY2hpbGQgPSBlKSA6ICh0LnRhZyA9IDE1LCB0LnR5cGUgPSBhLCBOYShlLCB0LCBhLCByLCBvLCBpKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhID0gZS5jaGlsZCwgbyA8IGkgJiYgKG8gPSBhLm1lbW9pemVkUHJvcHMsIChuID0gbnVsbCAhPT0gKG4gPSBuLmNvbXBhcmUpID8gbiA6IE1yKShvLCByKSAmJiBlLnJlZiA9PT0gdC5yZWYpID8gWWEoZSwgdCwgaSkgOiAodC5lZmZlY3RUYWcgfD0gMSwgKGUgPSBUYyhhLCByKSkucmVmID0gdC5yZWYsIGUucmV0dXJuID0gdCwgdC5jaGlsZCA9IGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTmEoZSwgdCwgbiwgciwgbywgaSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBlICYmIE1yKGUubWVtb2l6ZWRQcm9wcywgcikgJiYgZS5yZWYgPT09IHQucmVmICYmIChJYSA9ICExLCBvIDwgaSkgPyAodC5leHBpcmF0aW9uVGltZSA9IGUuZXhwaXJhdGlvblRpbWUsIFlhKGUsIHQsIGkpKSA6IHFhKGUsIHQsIG4sIHIsIGkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gamEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5yZWY7CiAgICAgICAgICAgICAgICAgICAgKG51bGwgPT09IGUgJiYgbnVsbCAhPT0gbiB8fCBudWxsICE9PSBlICYmIGUucmVmICE9PSBuKSAmJiAodC5lZmZlY3RUYWcgfD0gMTI4KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHFhKGUsIHQsIG4sIHIsIG8pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGdvKG4pID8gaG8gOiBmby5jdXJyZW50OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBpID0gbW8odCwgaSksIHJpKHQsIG8pLCBuID0gWWkoZSwgdCwgbiwgciwgaSwgbyksIG51bGwgPT09IGUgfHwgSWEgPyAodC5lZmZlY3RUYWcgfD0gMSwgTGEoZSwgdCwgbiwgbyksIHQuY2hpbGQpIDogKHQudXBkYXRlUXVldWUgPSBlLnVwZGF0ZVF1ZXVlLCB0LmVmZmVjdFRhZyAmPSAtNTE3LCBlLmV4cGlyYXRpb25UaW1lIDw9IG8gJiYgKGUuZXhwaXJhdGlvblRpbWUgPSAwKSwgWWEoZSwgdCwgbykpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRmEoZSwgdCwgbiwgciwgbykgewogICAgICAgICAgICAgICAgICAgIGlmIChnbyhuKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICBFbyh0KTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgaSA9ICExOwogICAgICAgICAgICAgICAgICAgIGlmIChyaSh0LCBvKSwgbnVsbCA9PT0gdC5zdGF0ZU5vZGUpCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IGUgJiYgKGUuYWx0ZXJuYXRlID0gbnVsbCwgdC5hbHRlcm5hdGUgPSBudWxsLCB0LmVmZmVjdFRhZyB8PSAyKSwgeWkodCwgbiwgciksIEVpKHQsIG4sIHIsIG8pLCByID0gITA7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAobnVsbCA9PT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQuc3RhdGVOb2RlLCBzID0gdC5tZW1vaXplZFByb3BzOwogICAgICAgICAgICAgICAgICAgICAgICBhLnByb3BzID0gczsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmNvbnRleHQsIHUgPSBuLmNvbnRleHRUeXBlOwogICAgICAgICAgICAgICAgICAgICAgICAnb2JqZWN0JyA9PT0gdHlwZW9mIHUgJiYgbnVsbCAhPT0gdSA/IHUgPSBvaSh1KSA6IHUgPSBtbyh0LCB1ID0gZ28obikgPyBobyA6IGZvLmN1cnJlbnQpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IG4uZ2V0RGVyaXZlZFN0YXRlRnJvbVByb3BzLCBmID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGwgfHwgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGEuZ2V0U25hcHNob3RCZWZvcmVVcGRhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGYgfHwgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIGEuVU5TQUZFX2NvbXBvbmVudFdpbGxSZWNlaXZlUHJvcHMgJiYgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIGEuY29tcG9uZW50V2lsbFJlY2VpdmVQcm9wcyB8fCAocyAhPT0gciB8fCBjICE9PSB1KSAmJiBiaSh0LCBhLCByLCB1KSwgaWkgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSB0Lm1lbW9pemVkU3RhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuc3RhdGUgPSBwLCBmaSh0LCByLCBhLCBvKSwgYyA9IHQubWVtb2l6ZWRTdGF0ZSwgcyAhPT0gciB8fCBwICE9PSBjIHx8IHBvLmN1cnJlbnQgfHwgaWkgPyAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGwgJiYgKG1pKHQsIG4sIGwsIHIpLCBjID0gdC5tZW1vaXplZFN0YXRlKSwgKHMgPSBpaSB8fCB2aSh0LCBuLCBzLCByLCBwLCBjLCB1KSkgPyAoZiB8fCAnZnVuY3Rpb24nICE9PSB0eXBlb2YgYS5VTlNBRkVfY29tcG9uZW50V2lsbE1vdW50ICYmICdmdW5jdGlvbicgIT09IHR5cGVvZiBhLmNvbXBvbmVudFdpbGxNb3VudCB8fCAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGEuY29tcG9uZW50V2lsbE1vdW50ICYmIGEuY29tcG9uZW50V2lsbE1vdW50KCksICdmdW5jdGlvbicgPT09IHR5cGVvZiBhLlVOU0FGRV9jb21wb25lbnRXaWxsTW91bnQgJiYgYS5VTlNBRkVfY29tcG9uZW50V2lsbE1vdW50KCkpLCAnZnVuY3Rpb24nID09PSB0eXBlb2YgYS5jb21wb25lbnREaWRNb3VudCAmJiAodC5lZmZlY3RUYWcgfD0gNCkpIDogKCdmdW5jdGlvbicgPT09IHR5cGVvZiBhLmNvbXBvbmVudERpZE1vdW50ICYmICh0LmVmZmVjdFRhZyB8PSA0KSwgdC5tZW1vaXplZFByb3BzID0gciwgdC5tZW1vaXplZFN0YXRlID0gYyksIGEucHJvcHMgPSByLCBhLnN0YXRlID0gYywgYS5jb250ZXh0ID0gdSwgciA9IHMpIDogKCdmdW5jdGlvbicgPT09IHR5cGVvZiBhLmNvbXBvbmVudERpZE1vdW50ICYmICh0LmVmZmVjdFRhZyB8PSA0KSwgciA9ICExKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IHQuc3RhdGVOb2RlLCBzaShlLCB0KSwgcyA9IHQubWVtb2l6ZWRQcm9wcywgYS5wcm9wcyA9IHQudHlwZSA9PT0gdC5lbGVtZW50VHlwZSA/IHMgOiBRbyh0LnR5cGUsIHMpLCBjID0gYS5jb250ZXh0LCAnb2JqZWN0JyA9PT0gdHlwZW9mICh1ID0gbi5jb250ZXh0VHlwZSkgJiYgbnVsbCAhPT0gdSA/IHUgPSBvaSh1KSA6IHUgPSBtbyh0LCB1ID0gZ28obikgPyBobyA6IGZvLmN1cnJlbnQpLCAoZiA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiAobCA9IG4uZ2V0RGVyaXZlZFN0YXRlRnJvbVByb3BzKSB8fCAnZnVuY3Rpb24nID09PSB0eXBlb2YgYS5nZXRTbmFwc2hvdEJlZm9yZVVwZGF0ZSkgfHwgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIGEuVU5TQUZFX2NvbXBvbmVudFdpbGxSZWNlaXZlUHJvcHMgJiYgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIGEuY29tcG9uZW50V2lsbFJlY2VpdmVQcm9wcyB8fCAocyAhPT0gciB8fCBjICE9PSB1KSAmJiBiaSh0LCBhLCByLCB1KSwgaWkgPSAhMSwgYyA9IHQubWVtb2l6ZWRTdGF0ZSwgYS5zdGF0ZSA9IGMsIGZpKHQsIHIsIGEsIG8pLCBwID0gdC5tZW1vaXplZFN0YXRlLCBzICE9PSByIHx8IGMgIT09IHAgfHwgcG8uY3VycmVudCB8fCBpaSA/ICgnZnVuY3Rpb24nID09PSB0eXBlb2YgbCAmJiAobWkodCwgbiwgbCwgciksIHAgPSB0Lm1lbW9pemVkU3RhdGUpLCAobCA9IGlpIHx8IHZpKHQsIG4sIHMsIHIsIGMsIHAsIHUpKSA/IChmIHx8ICdmdW5jdGlvbicgIT09IHR5cGVvZiBhLlVOU0FGRV9jb21wb25lbnRXaWxsVXBkYXRlICYmICdmdW5jdGlvbicgIT09IHR5cGVvZiBhLmNvbXBvbmVudFdpbGxVcGRhdGUgfHwgKCdmdW5jdGlvbicgPT09IHR5cGVvZiBhLmNvbXBvbmVudFdpbGxVcGRhdGUgJiYgYS5jb21wb25lbnRXaWxsVXBkYXRlKHIsIHAsIHUpLCAnZnVuY3Rpb24nID09PSB0eXBlb2YgYS5VTlNBRkVfY29tcG9uZW50V2lsbFVwZGF0ZSAmJiBhLlVOU0FGRV9jb21wb25lbnRXaWxsVXBkYXRlKHIsIHAsIHUpKSwgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGEuY29tcG9uZW50RGlkVXBkYXRlICYmICh0LmVmZmVjdFRhZyB8PSA0KSwgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGEuZ2V0U25hcHNob3RCZWZvcmVVcGRhdGUgJiYgKHQuZWZmZWN0VGFnIHw9IDI1NikpIDogKCdmdW5jdGlvbicgIT09IHR5cGVvZiBhLmNvbXBvbmVudERpZFVwZGF0ZSB8fCBzID09PSBlLm1lbW9pemVkUHJvcHMgJiYgYyA9PT0gZS5tZW1vaXplZFN0YXRlIHx8ICh0LmVmZmVjdFRhZyB8PSA0KSwgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIGEuZ2V0U25hcHNob3RCZWZvcmVVcGRhdGUgfHwgcyA9PT0gZS5tZW1vaXplZFByb3BzICYmIGMgPT09IGUubWVtb2l6ZWRTdGF0ZSB8fCAodC5lZmZlY3RUYWcgfD0gMjU2KSwgdC5tZW1vaXplZFByb3BzID0gciwgdC5tZW1vaXplZFN0YXRlID0gcCksIGEucHJvcHMgPSByLCBhLnN0YXRlID0gcCwgYS5jb250ZXh0ID0gdSwgciA9IGwpIDogKCdmdW5jdGlvbicgIT09IHR5cGVvZiBhLmNvbXBvbmVudERpZFVwZGF0ZSB8fCBzID09PSBlLm1lbW9pemVkUHJvcHMgJiYgYyA9PT0gZS5tZW1vaXplZFN0YXRlIHx8ICh0LmVmZmVjdFRhZyB8PSA0KSwgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIGEuZ2V0U25hcHNob3RCZWZvcmVVcGRhdGUgfHwgcyA9PT0gZS5tZW1vaXplZFByb3BzICYmIGMgPT09IGUubWVtb2l6ZWRTdGF0ZSB8fCAodC5lZmZlY3RUYWcgfD0gMjU2KSwgciA9ICExKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGEoZSwgdCwgbiwgciwgaSwgbyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBEYShlLCB0LCBuLCByLCBvLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgamEoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAwICE9PSAoNjQgJiB0LmVmZmVjdFRhZyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFyICYmICFhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyAmJiB3byh0LCBuLCAhMSksIFlhKGUsIHQsIGkpOwogICAgICAgICAgICAgICAgICAgIHIgPSB0LnN0YXRlTm9kZSwgT2EuY3VycmVudCA9IHQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBhICYmICdmdW5jdGlvbicgIT09IHR5cGVvZiBuLmdldERlcml2ZWRTdGF0ZUZyb21FcnJvciA/IG51bGwgOiByLnJlbmRlcigpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmVmZmVjdFRhZyB8PSAxLCBudWxsICE9PSBlICYmIGEgPyAodC5jaGlsZCA9IGtpKHQsIGUuY2hpbGQsIG51bGwsIGkpLCB0LmNoaWxkID0ga2kodCwgbnVsbCwgcywgaSkpIDogTGEoZSwgdCwgcywgaSksIHQubWVtb2l6ZWRTdGF0ZSA9IHIuc3RhdGUsIG8gJiYgd28odCwgbiwgITApLCB0LmNoaWxkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTWEoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICAgICAgdC5wZW5kaW5nQ29udGV4dCA/IHlvKDAsIHQucGVuZGluZ0NvbnRleHQsIHQucGVuZGluZ0NvbnRleHQgIT09IHQuY29udGV4dCkgOiB0LmNvbnRleHQgJiYgeW8oMCwgdC5jb250ZXh0LCAhMSksIEFpKGUsIHQuY29udGFpbmVySW5mbyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgVWEsIFZhLCBCYSwgemEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlaHlkcmF0ZWQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHJ5VGltZTogMAogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBHYShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8gPSB0Lm1vZGUsIGkgPSB0LnBlbmRpbmdQcm9wcywgYSA9IHFpLmN1cnJlbnQsIHMgPSAhMTsKICAgICAgICAgICAgICAgICAgICBpZiAoKHIgPSAwICE9PSAoNjQgJiB0LmVmZmVjdFRhZykpIHx8IChyID0gMCAhPT0gKDIgJiBhKSAmJiAobnVsbCA9PT0gZSB8fCBudWxsICE9PSBlLm1lbW9pemVkU3RhdGUpKSwgciA/IChzID0gITAsIHQuZWZmZWN0VGFnICY9IC02NSkgOiBudWxsICE9PSBlICYmIG51bGwgPT09IGUubWVtb2l6ZWRTdGF0ZSB8fCB2b2lkIDAgPT09IGkuZmFsbGJhY2sgfHwgITAgPT09IGkudW5zdGFibGVfYXZvaWRUaGlzRmFsbGJhY2sgfHwgKGEgfD0gMSksIHVvKHFpLCAxICYgYSksIG51bGwgPT09IGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gaS5mYWxsYmFjayAmJiBrYSh0KSwgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMgPSBpLmZhbGxiYWNrLCAoaSA9IFBjKG51bGwsIG8sIDAsIG51bGwpKS5yZXR1cm4gPSB0LCAwID09PSAoMiAmIHQubW9kZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlID0gbnVsbCAhPT0gdC5tZW1vaXplZFN0YXRlID8gdC5jaGlsZC5jaGlsZCA6IHQuY2hpbGQsIGkuY2hpbGQgPSBlOyBudWxsICE9PSBlOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5yZXR1cm4gPSBpLCBlID0gZS5zaWJsaW5nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChuID0gUGMocywgbywgbiwgbnVsbCkpLnJldHVybiA9IHQsIGkuc2libGluZyA9IG4sIHQubWVtb2l6ZWRTdGF0ZSA9IHphLCB0LmNoaWxkID0gaSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyA9IGkuY2hpbGRyZW4sIHQubWVtb2l6ZWRTdGF0ZSA9IG51bGwsIHQuY2hpbGQgPSBUaSh0LCBudWxsLCBvLCBuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGUubWVtb2l6ZWRTdGF0ZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAobyA9IChlID0gZS5jaGlsZCkuc2libGluZywgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPSBpLmZhbGxiYWNrLCAobiA9IFRjKGUsIGUucGVuZGluZ1Byb3BzKSkucmV0dXJuID0gdCwgMCA9PT0gKDIgJiB0Lm1vZGUpICYmIChzID0gbnVsbCAhPT0gdC5tZW1vaXplZFN0YXRlID8gdC5jaGlsZC5jaGlsZCA6IHQuY2hpbGQpICE9PSBlLmNoaWxkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobi5jaGlsZCA9IHM7IG51bGwgIT09IHM7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnJldHVybiA9IG4sIHMgPSBzLnNpYmxpbmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG8gPSBUYyhvLCBpKSkucmV0dXJuID0gdCwgbi5zaWJsaW5nID0gbywgbi5jaGlsZEV4cGlyYXRpb25UaW1lID0gMCwgdC5tZW1vaXplZFN0YXRlID0gemEsIHQuY2hpbGQgPSBuLCBvOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0ga2kodCwgZS5jaGlsZCwgaS5jaGlsZHJlbiwgbiksIHQubWVtb2l6ZWRTdGF0ZSA9IG51bGwsIHQuY2hpbGQgPSBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoZSA9IGUuY2hpbGQsIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMgPSBpLmZhbGxiYWNrLCAoaSA9IFBjKG51bGwsIG8sIDAsIG51bGwpKS5yZXR1cm4gPSB0LCBpLmNoaWxkID0gZSwgbnVsbCAhPT0gZSAmJiAoZS5yZXR1cm4gPSBpKSwgMCA9PT0gKDIgJiB0Lm1vZGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlID0gbnVsbCAhPT0gdC5tZW1vaXplZFN0YXRlID8gdC5jaGlsZC5jaGlsZCA6IHQuY2hpbGQsIGkuY2hpbGQgPSBlOyBudWxsICE9PSBlOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnJldHVybiA9IGksIGUgPSBlLnNpYmxpbmc7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAobiA9IFBjKHMsIG8sIG4sIG51bGwpKS5yZXR1cm4gPSB0LCBpLnNpYmxpbmcgPSBuLCBuLmVmZmVjdFRhZyB8PSAyLCBpLmNoaWxkRXhwaXJhdGlvblRpbWUgPSAwLCB0Lm1lbW9pemVkU3RhdGUgPSB6YSwgdC5jaGlsZCA9IGksIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lm1lbW9pemVkU3RhdGUgPSBudWxsLCB0LmNoaWxkID0ga2kodCwgZSwgaS5jaGlsZHJlbiwgbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBIYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZS5leHBpcmF0aW9uVGltZSA8IHQgJiYgKGUuZXhwaXJhdGlvblRpbWUgPSB0KTsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuYWx0ZXJuYXRlOwogICAgICAgICAgICAgICAgICAgIG51bGwgIT09IG4gJiYgbi5leHBpcmF0aW9uVGltZSA8IHQgJiYgKG4uZXhwaXJhdGlvblRpbWUgPSB0KSwgbmkoZS5yZXR1cm4sIHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gV2EoZSwgdCwgbiwgciwgbywgaSkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5tZW1vaXplZFN0YXRlOwogICAgICAgICAgICAgICAgICAgIG51bGwgPT09IGEgPyBlLm1lbW9pemVkU3RhdGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlzQmFja3dhcmRzOiB0LAogICAgICAgICAgICAgICAgICAgICAgICByZW5kZXJpbmc6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlbmRlcmluZ1N0YXJ0VGltZTogMCwKICAgICAgICAgICAgICAgICAgICAgICAgbGFzdDogciwKICAgICAgICAgICAgICAgICAgICAgICAgdGFpbDogbiwKICAgICAgICAgICAgICAgICAgICAgICAgdGFpbEV4cGlyYXRpb246IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIHRhaWxNb2RlOiBvLAogICAgICAgICAgICAgICAgICAgICAgICBsYXN0RWZmZWN0OiBpCiAgICAgICAgICAgICAgICAgICAgfSA6IChhLmlzQmFja3dhcmRzID0gdCwgYS5yZW5kZXJpbmcgPSBudWxsLCBhLnJlbmRlcmluZ1N0YXJ0VGltZSA9IDAsIGEubGFzdCA9IHIsIGEudGFpbCA9IG4sIGEudGFpbEV4cGlyYXRpb24gPSAwLCBhLnRhaWxNb2RlID0gbywgYS5sYXN0RWZmZWN0ID0gaSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiAkYShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0LnBlbmRpbmdQcm9wcywgbyA9IHIucmV2ZWFsT3JkZXIsIGkgPSByLnRhaWw7CiAgICAgICAgICAgICAgICAgICAgaWYgKExhKGUsIHQsIHIuY2hpbGRyZW4sIG4pLCAwICE9PSAoMiAmIChyID0gcWkuY3VycmVudCkpKQogICAgICAgICAgICAgICAgICAgICAgICByID0gMSAmIHIgfCAyLCB0LmVmZmVjdFRhZyB8PSA2NDsKICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGUgJiYgMCAhPT0gKDY0ICYgZS5lZmZlY3RUYWcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSB0LmNoaWxkOyBudWxsICE9PSBlOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMTMgPT09IGUudGFnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gZS5tZW1vaXplZFN0YXRlICYmIEhhKGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgxOSA9PT0gZS50YWcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIYShlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAobnVsbCAhPT0gZS5jaGlsZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jaGlsZC5yZXR1cm4gPSBlLCBlID0gZS5jaGlsZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IG51bGwgPT09IGUuc2libGluZzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBlLnJldHVybiB8fCBlLnJldHVybiA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUucmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc2libGluZy5yZXR1cm4gPSBlLnJldHVybiwgZSA9IGUuc2libGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHIgJj0gMTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKHVvKHFpLCByKSwgMCA9PT0gKDIgJiB0Lm1vZGUpKQogICAgICAgICAgICAgICAgICAgICAgICB0Lm1lbW9pemVkU3RhdGUgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2ZvcndhcmRzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IHQuY2hpbGQsIG8gPSBudWxsOyBudWxsICE9PSBuOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9PSAoZSA9IG4uYWx0ZXJuYXRlKSAmJiBudWxsID09PSBGaShlKSAmJiAobyA9IG4pLCBuID0gbi5zaWJsaW5nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCA9PT0gKG4gPSBvKSA/IChvID0gdC5jaGlsZCwgdC5jaGlsZCA9IG51bGwpIDogKG8gPSBuLnNpYmxpbmcsIG4uc2libGluZyA9IG51bGwpLCBXYSh0LCAhMSwgbywgbiwgaSwgdC5sYXN0RWZmZWN0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdiYWNrd2FyZHMnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gbnVsbCwgbyA9IHQuY2hpbGQsIHQuY2hpbGQgPSBudWxsOyBudWxsICE9PSBvOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSAoZSA9IG8uYWx0ZXJuYXRlKSAmJiBudWxsID09PSBGaShlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmNoaWxkID0gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBvLnNpYmxpbmcsIG8uc2libGluZyA9IG4sIG4gPSBvLCBvID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdhKHQsICEwLCBuLCBudWxsLCBpLCB0Lmxhc3RFZmZlY3QpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3RvZ2V0aGVyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdhKHQsICExLCBudWxsLCBudWxsLCB2b2lkIDAsIHQubGFzdEVmZmVjdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubWVtb2l6ZWRTdGF0ZSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5jaGlsZDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFlhKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBudWxsICE9PSBlICYmICh0LmRlcGVuZGVuY2llcyA9IGUuZGVwZW5kZW5jaWVzKTsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQuZXhwaXJhdGlvblRpbWU7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09IHIgJiYgYWMociksIHQuY2hpbGRFeHBpcmF0aW9uVGltZSA8IG4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBlICYmIHQuY2hpbGQgIT09IGUuY2hpbGQpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMTUzKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHQuY2hpbGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gVGMoZSA9IHQuY2hpbGQsIGUucGVuZGluZ1Byb3BzKSwgdC5jaGlsZCA9IG4sIG4ucmV0dXJuID0gdDsgbnVsbCAhPT0gZS5zaWJsaW5nOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLnNpYmxpbmcsIChuID0gbi5zaWJsaW5nID0gVGMoZSwgZS5wZW5kaW5nUHJvcHMpKS5yZXR1cm4gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICBuLnNpYmxpbmcgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5jaGlsZDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFFhKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUudGFpbE1vZGUpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlICdoaWRkZW4nOgogICAgICAgICAgICAgICAgICAgICAgICB0ID0gZS50YWlsOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gbnVsbDsgbnVsbCAhPT0gdDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9PSB0LmFsdGVybmF0ZSAmJiAobiA9IHQpLCB0ID0gdC5zaWJsaW5nOwogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09PSBuID8gZS50YWlsID0gbnVsbCA6IG4uc2libGluZyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgJ2NvbGxhcHNlZCc6CiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBlLnRhaWw7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSBudWxsOyBudWxsICE9PSBuOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IG4uYWx0ZXJuYXRlICYmIChyID0gbiksIG4gPSBuLnNpYmxpbmc7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT09IHIgPyB0IHx8IG51bGwgPT09IGUudGFpbCA/IGUudGFpbCA9IG51bGwgOiBlLnRhaWwuc2libGluZyA9IG51bGwgOiByLnNpYmxpbmcgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEthKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQucGVuZGluZ1Byb3BzOwogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodC50YWcpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxNjoKICAgICAgICAgICAgICAgICAgICBjYXNlIDE1OgogICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICBjYXNlIDExOgogICAgICAgICAgICAgICAgICAgIGNhc2UgNzoKICAgICAgICAgICAgICAgICAgICBjYXNlIDg6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjoKICAgICAgICAgICAgICAgICAgICBjYXNlIDk6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxNDoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ28odC50eXBlKSAmJiB2bygpLCBudWxsOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFJpKCksIGNvKHBvKSwgY28oZm8pLCAobiA9IHQuc3RhdGVOb2RlKS5wZW5kaW5nQ29udGV4dCAmJiAobi5jb250ZXh0ID0gbi5wZW5kaW5nQ29udGV4dCwgbi5wZW5kaW5nQ29udGV4dCA9IG51bGwpLCBudWxsICE9PSBlICYmIG51bGwgIT09IGUuY2hpbGQgfHwgIV9hKHQpIHx8ICh0LmVmZmVjdFRhZyB8PSA0KSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgIGppKHQpLCBuID0gTGkoSWkuY3VycmVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdC50eXBlOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gZSAmJiBudWxsICE9IHQuc3RhdGVOb2RlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgVmEoZSwgdCwgaSwgciwgbiksIGUucmVmICE9PSB0LnJlZiAmJiAodC5lZmZlY3RUYWcgfD0gMTI4KTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gdC5zdGF0ZU5vZGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMTY2KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9IExpKFBpLmN1cnJlbnQpLCBfYSh0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSB0LnN0YXRlTm9kZSwgaSA9IHQudHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHQubWVtb2l6ZWRQcm9wczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHJbQ25dID0gdCwgcltrbl0gPSBzLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaWZyYW1lJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdvYmplY3QnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VtYmVkJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHQoJ2xvYWQnLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndmlkZW8nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2F1ZGlvJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IEtlLmxlbmd0aDsgZSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHQoS2VbZV0sIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdzb3VyY2UnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdCgnZXJyb3InLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaW1nJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdpbWFnZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbGluayc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0KCdlcnJvcicsIHIpLCAkdCgnbG9hZCcsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdmb3JtJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHQoJ3Jlc2V0JywgciksICR0KCdzdWJtaXQnLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZGV0YWlscyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0KCd0b2dnbGUnLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaW5wdXQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTZShyLCBzKSwgJHQoJ2ludmFsaWQnLCByKSwgY24obiwgJ29uQ2hhbmdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3NlbGVjdCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuX3dyYXBwZXJTdGF0ZSA9IHsgd2FzTXVsdGlwbGU6ICEhcy5tdWx0aXBsZSB9LCAkdCgnaW52YWxpZCcsIHIpLCBjbihuLCAnb25DaGFuZ2UnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndGV4dGFyZWEnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMZShyLCBzKSwgJHQoJ2ludmFsaWQnLCByKSwgY24obiwgJ29uQ2hhbmdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgaW4gKG9uKGksIHMpLCBlID0gbnVsbCwgcykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzLmhhc093blByb3BlcnR5KGMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHNbY107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2hpbGRyZW4nID09PSBjID8gJ3N0cmluZycgPT09IHR5cGVvZiB1ID8gci50ZXh0Q29udGVudCAhPT0gdSAmJiAoZSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2hpbGRyZW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pIDogJ251bWJlcicgPT09IHR5cGVvZiB1ICYmIHIudGV4dENvbnRlbnQgIT09ICcnICsgdSAmJiAoZSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2hpbGRyZW4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnICsgdQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkgOiBDLmhhc093blByb3BlcnR5KGMpICYmIG51bGwgIT0gdSAmJiBjbihuLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2lucHV0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWUociksIFRlKHIsIHMsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAndGV4dGFyZWEnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFZShyKSwgUmUocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3NlbGVjdCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnb3B0aW9uJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHMub25DbGljayAmJiAoci5vbmNsaWNrID0gdW4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gZSwgdC51cGRhdGVRdWV1ZSA9IG4sIG51bGwgIT09IG4gJiYgKHQuZWZmZWN0VGFnIHw9IDQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGMgPSA5ID09PSBuLm5vZGVUeXBlID8gbiA6IG4ub3duZXJEb2N1bWVudCwgZSA9PT0gc24gJiYgKGUgPSBxZShpKSksIGUgPT09IHNuID8gJ3NjcmlwdCcgPT09IGkgPyAoKGUgPSBjLmNyZWF0ZUVsZW1lbnQoJ2RpdicpKS5pbm5lckhUTUwgPSAnPHNjcmlwdD48L3NjcmlwdD4nLCBlID0gZS5yZW1vdmVDaGlsZChlLmZpcnN0Q2hpbGQpKSA6ICdzdHJpbmcnID09PSB0eXBlb2Ygci5pcyA/IGUgPSBjLmNyZWF0ZUVsZW1lbnQoaSwgeyBpczogci5pcyB9KSA6IChlID0gYy5jcmVhdGVFbGVtZW50KGkpLCAnc2VsZWN0JyA9PT0gaSAmJiAoYyA9IGUsIHIubXVsdGlwbGUgPyBjLm11bHRpcGxlID0gITAgOiByLnNpemUgJiYgKGMuc2l6ZSA9IHIuc2l6ZSkpKSA6IGUgPSBjLmNyZWF0ZUVsZW1lbnROUyhlLCBpKSwgZVtDbl0gPSB0LCBlW2tuXSA9IHIsIFVhKGUsIHQpLCB0LnN0YXRlTm9kZSA9IGUsIGMgPSBhbihpLCByKSwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2lmcmFtZSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnb2JqZWN0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbWJlZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0KCdsb2FkJywgZSksIHUgPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd2aWRlbyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYXVkaW8nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHUgPSAwOyB1IDwgS2UubGVuZ3RoOyB1KyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdChLZVt1XSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdzb3VyY2UnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdCgnZXJyb3InLCBlKSwgdSA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2ltZyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaW1hZ2UnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2xpbmsnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdCgnZXJyb3InLCBlKSwgJHQoJ2xvYWQnLCBlKSwgdSA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Zvcm0nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdCgncmVzZXQnLCBlKSwgJHQoJ3N1Ym1pdCcsIGUpLCB1ID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZGV0YWlscyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR0KCd0b2dnbGUnLCBlKSwgdSA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2lucHV0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2UoZSwgciksIHUgPSB4ZShlLCByKSwgJHQoJ2ludmFsaWQnLCBlKSwgY24obiwgJ29uQ2hhbmdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ29wdGlvbic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBQZShlLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc2VsZWN0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fd3JhcHBlclN0YXRlID0geyB3YXNNdWx0aXBsZTogISFyLm11bHRpcGxlIH0sIHUgPSBvKHt9LCByLCB7IHZhbHVlOiB2b2lkIDAgfSksICR0KCdpbnZhbGlkJywgZSksIGNuKG4sICdvbkNoYW5nZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd0ZXh0YXJlYSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExlKGUsIHIpLCB1ID0gSWUoZSwgciksICR0KCdpbnZhbGlkJywgZSksIGNuKG4sICdvbkNoYW5nZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb24oaSwgdSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocyBpbiBsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobC5oYXNPd25Qcm9wZXJ0eShzKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBsW3NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0eWxlJyA9PT0gcyA/IG5uKGUsIGYpIDogJ2Rhbmdlcm91c2x5U2V0SW5uZXJIVE1MJyA9PT0gcyA/IG51bGwgIT0gKGYgPSBmID8gZi5fX2h0bWwgOiB2b2lkIDApICYmIE1lKGUsIGYpIDogJ2NoaWxkcmVuJyA9PT0gcyA/ICdzdHJpbmcnID09PSB0eXBlb2YgZiA/ICgndGV4dGFyZWEnICE9PSBpIHx8ICcnICE9PSBmKSAmJiBVZShlLCBmKSA6ICdudW1iZXInID09PSB0eXBlb2YgZiAmJiBVZShlLCAnJyArIGYpIDogJ3N1cHByZXNzQ29udGVudEVkaXRhYmxlV2FybmluZycgIT09IHMgJiYgJ3N1cHByZXNzSHlkcmF0aW9uV2FybmluZycgIT09IHMgJiYgJ2F1dG9Gb2N1cycgIT09IHMgJiYgKEMuaGFzT3duUHJvcGVydHkocykgPyBudWxsICE9IGYgJiYgY24obiwgcykgOiBudWxsICE9IGYgJiYgSihlLCBzLCBmLCBjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdpbnB1dCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVlKGUpLCBUZShlLCByLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3RleHRhcmVhJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWUoZSksIFJlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdvcHRpb24nOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IHIudmFsdWUgJiYgZS5zZXRBdHRyaWJ1dGUoJ3ZhbHVlJywgJycgKyB5ZShyLnZhbHVlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3NlbGVjdCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubXVsdGlwbGUgPSAhIXIubXVsdGlwbGUsIG51bGwgIT0gKG4gPSByLnZhbHVlKSA/IE9lKGUsICEhci5tdWx0aXBsZSwgbiwgITEpIDogbnVsbCAhPSByLmRlZmF1bHRWYWx1ZSAmJiBPZShlLCAhIXIubXVsdGlwbGUsIHIuZGVmYXVsdFZhbHVlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT09IHR5cGVvZiB1Lm9uQ2xpY2sgJiYgKGUub25jbGljayA9IHVuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm4oaSwgcikgJiYgKHQuZWZmZWN0VGFnIHw9IDQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gdC5yZWYgJiYgKHQuZWZmZWN0VGFnIHw9IDEyOCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiBudWxsICE9IHQuc3RhdGVOb2RlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgQmEoMCwgdCwgZS5tZW1vaXplZFByb3BzLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT09IHR5cGVvZiByICYmIG51bGwgPT09IHQuc3RhdGVOb2RlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMTY2KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gTGkoSWkuY3VycmVudCksIExpKFBpLmN1cnJlbnQpLCBfYSh0KSA/IChuID0gdC5zdGF0ZU5vZGUsIHIgPSB0Lm1lbW9pemVkUHJvcHMsIG5bQ25dID0gdCwgbi5ub2RlVmFsdWUgIT09IHIgJiYgKHQuZWZmZWN0VGFnIHw9IDQpKSA6ICgobiA9ICg5ID09PSBuLm5vZGVUeXBlID8gbiA6IG4ub3duZXJEb2N1bWVudCkuY3JlYXRlVGV4dE5vZGUocikpW0NuXSA9IHQsIHQuc3RhdGVOb2RlID0gbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvKHFpKSwgciA9IHQubWVtb2l6ZWRTdGF0ZSwgMCAhPT0gKDY0ICYgdC5lZmZlY3RUYWcpID8gKHQuZXhwaXJhdGlvblRpbWUgPSBuLCB0KSA6IChuID0gbnVsbCAhPT0gciwgciA9ICExLCBudWxsID09PSBlID8gdm9pZCAwICE9PSB0Lm1lbW9pemVkUHJvcHMuZmFsbGJhY2sgJiYgX2EodCkgOiAociA9IG51bGwgIT09IChpID0gZS5tZW1vaXplZFN0YXRlKSwgbiB8fCBudWxsID09PSBpIHx8IG51bGwgIT09IChpID0gZS5jaGlsZC5zaWJsaW5nKSAmJiAobnVsbCAhPT0gKHMgPSB0LmZpcnN0RWZmZWN0KSA/ICh0LmZpcnN0RWZmZWN0ID0gaSwgaS5uZXh0RWZmZWN0ID0gcykgOiAodC5maXJzdEVmZmVjdCA9IHQubGFzdEVmZmVjdCA9IGksIGkubmV4dEVmZmVjdCA9IG51bGwpLCBpLmVmZmVjdFRhZyA9IDgpKSwgbiAmJiAhciAmJiAwICE9PSAoMiAmIHQubW9kZSkgJiYgKG51bGwgPT09IGUgJiYgITAgIT09IHQubWVtb2l6ZWRQcm9wcy51bnN0YWJsZV9hdm9pZFRoaXNGYWxsYmFjayB8fCAwICE9PSAoMSAmIHFpLmN1cnJlbnQpID8gX3MgPT09IEVzICYmIChfcyA9IHdzKSA6IChfcyAhPT0gRXMgJiYgX3MgIT09IHdzIHx8IChfcyA9IHhzKSwgMCAhPT0gQXMgJiYgbnVsbCAhPT0gQ3MgJiYgKFJjKENzLCBUcyksIE5jKENzLCBBcykpKSksIChuIHx8IHIpICYmICh0LmVmZmVjdFRhZyB8PSA0KSwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUmkoKSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICBjYXNlIDEwOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGkodCksIG51bGw7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxNzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdvKHQudHlwZSkgJiYgdm8oKSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE5OgogICAgICAgICAgICAgICAgICAgICAgICBpZiAoY28ocWkpLCBudWxsID09PSAociA9IHQubWVtb2l6ZWRTdGF0ZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPSAwICE9PSAoNjQgJiB0LmVmZmVjdFRhZyksIG51bGwgPT09IChzID0gci5yZW5kZXJpbmcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBRYShyLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChfcyAhPT0gRXMgfHwgbnVsbCAhPT0gZSAmJiAwICE9PSAoNjQgJiBlLmVmZmVjdFRhZykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChzID0gdC5jaGlsZDsgbnVsbCAhPT0gczspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IChlID0gRmkocykpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQuZWZmZWN0VGFnIHw9IDY0LCBRYShyLCAhMSksIG51bGwgIT09IChpID0gZS51cGRhdGVRdWV1ZSkgJiYgKHQudXBkYXRlUXVldWUgPSBpLCB0LmVmZmVjdFRhZyB8PSA0KSwgbnVsbCA9PT0gci5sYXN0RWZmZWN0ICYmICh0LmZpcnN0RWZmZWN0ID0gbnVsbCksIHQubGFzdEVmZmVjdCA9IHIubGFzdEVmZmVjdCwgciA9IHQuY2hpbGQ7IG51bGwgIT09IHI7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSBuLCAoaSA9IHIpLmVmZmVjdFRhZyAmPSAyLCBpLm5leHRFZmZlY3QgPSBudWxsLCBpLmZpcnN0RWZmZWN0ID0gbnVsbCwgaS5sYXN0RWZmZWN0ID0gbnVsbCwgbnVsbCA9PT0gKGUgPSBpLmFsdGVybmF0ZSkgPyAoaS5jaGlsZEV4cGlyYXRpb25UaW1lID0gMCwgaS5leHBpcmF0aW9uVGltZSA9IHMsIGkuY2hpbGQgPSBudWxsLCBpLm1lbW9pemVkUHJvcHMgPSBudWxsLCBpLm1lbW9pemVkU3RhdGUgPSBudWxsLCBpLnVwZGF0ZVF1ZXVlID0gbnVsbCwgaS5kZXBlbmRlbmNpZXMgPSBudWxsKSA6IChpLmNoaWxkRXhwaXJhdGlvblRpbWUgPSBlLmNoaWxkRXhwaXJhdGlvblRpbWUsIGkuZXhwaXJhdGlvblRpbWUgPSBlLmV4cGlyYXRpb25UaW1lLCBpLmNoaWxkID0gZS5jaGlsZCwgaS5tZW1vaXplZFByb3BzID0gZS5tZW1vaXplZFByb3BzLCBpLm1lbW9pemVkU3RhdGUgPSBlLm1lbW9pemVkU3RhdGUsIGkudXBkYXRlUXVldWUgPSBlLnVwZGF0ZVF1ZXVlLCBzID0gZS5kZXBlbmRlbmNpZXMsIGkuZGVwZW5kZW5jaWVzID0gbnVsbCA9PT0gcyA/IG51bGwgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyYXRpb25UaW1lOiBzLmV4cGlyYXRpb25UaW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdENvbnRleHQ6IHMuZmlyc3RDb250ZXh0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNwb25kZXJzOiBzLnJlc3BvbmRlcnMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgciA9IHIuc2libGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1byhxaSwgMSAmIHFpLmN1cnJlbnQgfCAyKSwgdC5jaGlsZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gcy5zaWJsaW5nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gKGUgPSBGaShzKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuZWZmZWN0VGFnIHw9IDY0LCBpID0gITAsIG51bGwgIT09IChuID0gZS51cGRhdGVRdWV1ZSkgJiYgKHQudXBkYXRlUXVldWUgPSBuLCB0LmVmZmVjdFRhZyB8PSA0KSwgUWEociwgITApLCBudWxsID09PSByLnRhaWwgJiYgJ2hpZGRlbicgPT09IHIudGFpbE1vZGUgJiYgIXMuYWx0ZXJuYXRlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09ICh0ID0gdC5sYXN0RWZmZWN0ID0gci5sYXN0RWZmZWN0KSAmJiAodC5uZXh0RWZmZWN0ID0gbnVsbCksIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIgKiBVbygpIC0gci5yZW5kZXJpbmdTdGFydFRpbWUgPiByLnRhaWxFeHBpcmF0aW9uICYmIDEgPCBuICYmICh0LmVmZmVjdFRhZyB8PSA2NCwgaSA9ICEwLCBRYShyLCAhMSksIHQuZXhwaXJhdGlvblRpbWUgPSB0LmNoaWxkRXhwaXJhdGlvblRpbWUgPSBuIC0gMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmlzQmFja3dhcmRzID8gKHMuc2libGluZyA9IHQuY2hpbGQsIHQuY2hpbGQgPSBzKSA6IChudWxsICE9PSAobiA9IHIubGFzdCkgPyBuLnNpYmxpbmcgPSBzIDogdC5jaGlsZCA9IHMsIHIubGFzdCA9IHMpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSByLnRhaWwgPyAoMCA9PT0gci50YWlsRXhwaXJhdGlvbiAmJiAoci50YWlsRXhwaXJhdGlvbiA9IFVvKCkgKyA1MDApLCBuID0gci50YWlsLCByLnJlbmRlcmluZyA9IG4sIHIudGFpbCA9IG4uc2libGluZywgci5sYXN0RWZmZWN0ID0gdC5sYXN0RWZmZWN0LCByLnJlbmRlcmluZ1N0YXJ0VGltZSA9IFVvKCksIG4uc2libGluZyA9IG51bGwsIHQgPSBxaS5jdXJyZW50LCB1byhxaSwgaSA/IDEgJiB0IHwgMiA6IDEgJiB0KSwgbikgOiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE1NiwgdC50YWcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEphKGUpIHsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUudGFnKSB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICBnbyhlLnR5cGUpICYmIHZvKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5lZmZlY3RUYWc7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiA0MDk2ICYgdCA/IChlLmVmZmVjdFRhZyA9IC00MDk3ICYgdCB8IDY0LCBlKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICBpZiAoUmkoKSwgY28ocG8pLCBjbyhmbyksIDAgIT09ICg2NCAmICh0ID0gZS5lZmZlY3RUYWcpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMjg1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVmZmVjdFRhZyA9IC00MDk3ICYgdCB8IDY0LCBlOwogICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGppKGUpLCBudWxsOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTM6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjbyhxaSksIDQwOTYgJiAodCA9IGUuZWZmZWN0VGFnKSA/IChlLmVmZmVjdFRhZyA9IC00MDk3ICYgdCB8IDY0LCBlKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxOToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvKHFpKSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBSaSgpLCBudWxsOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTA6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aShlKSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBYYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhY2s6IHZlKHQpCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIFVhID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gdC5jaGlsZDsgbnVsbCAhPT0gbjspIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDUgPT09IG4udGFnIHx8IDYgPT09IG4udGFnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5hcHBlbmRDaGlsZChuLnN0YXRlTm9kZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKDQgIT09IG4udGFnICYmIG51bGwgIT09IG4uY2hpbGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uY2hpbGQucmV0dXJuID0gbiwgbiA9IG4uY2hpbGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbnVsbCA9PT0gbi5zaWJsaW5nOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IG4ucmV0dXJuIHx8IG4ucmV0dXJuID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBuLnJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBuLnNpYmxpbmcucmV0dXJuID0gbi5yZXR1cm4sIG4gPSBuLnNpYmxpbmc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgVmEgPSBmdW5jdGlvbiAoZSwgdCwgbiwgciwgaSkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5tZW1vaXplZFByb3BzOwogICAgICAgICAgICAgICAgICAgIGlmIChhICE9PSByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzLCBjLCB1ID0gdC5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoTGkoUGkuY3VycmVudCksIGUgPSBudWxsLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2lucHV0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB4ZSh1LCBhKSwgciA9IHhlKHUsIHIpLCBlID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnb3B0aW9uJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBQZSh1LCBhKSwgciA9IFBlKHUsIHIpLCBlID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnc2VsZWN0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBvKHt9LCBhLCB7IHZhbHVlOiB2b2lkIDAgfSksIHIgPSBvKHt9LCByLCB7IHZhbHVlOiB2b2lkIDAgfSksIGUgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICd0ZXh0YXJlYSc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gSWUodSwgYSksIHIgPSBJZSh1LCByKSwgZSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nICE9PSB0eXBlb2YgYS5vbkNsaWNrICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiByLm9uQ2xpY2sgJiYgKHUub25jbGljayA9IHVuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHMgaW4gKG9uKG4sIHIpLCBuID0gbnVsbCwgYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIuaGFzT3duUHJvcGVydHkocykgJiYgYS5oYXNPd25Qcm9wZXJ0eShzKSAmJiBudWxsICE9IGFbc10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHlsZScgPT09IHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYyBpbiB1ID0gYVtzXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUuaGFzT3duUHJvcGVydHkoYykgJiYgKG4gfHwgKG4gPSB7fSksIG5bY10gPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGFuZ2Vyb3VzbHlTZXRJbm5lckhUTUwnICE9PSBzICYmICdjaGlsZHJlbicgIT09IHMgJiYgJ3N1cHByZXNzQ29udGVudEVkaXRhYmxlV2FybmluZycgIT09IHMgJiYgJ3N1cHByZXNzSHlkcmF0aW9uV2FybmluZycgIT09IHMgJiYgJ2F1dG9Gb2N1cycgIT09IHMgJiYgKEMuaGFzT3duUHJvcGVydHkocykgPyBlIHx8IChlID0gW10pIDogKGUgPSBlIHx8IFtdKS5wdXNoKHMsIG51bGwpKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChzIGluIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gcltzXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1ID0gbnVsbCAhPSBhID8gYVtzXSA6IHZvaWQgMCwgci5oYXNPd25Qcm9wZXJ0eShzKSAmJiBsICE9PSB1ICYmIChudWxsICE9IGwgfHwgbnVsbCAhPSB1KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0eWxlJyA9PT0gcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYyBpbiB1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICF1Lmhhc093blByb3BlcnR5KGMpIHx8IGwgJiYgbC5oYXNPd25Qcm9wZXJ0eShjKSB8fCAobiB8fCAobiA9IHt9KSwgbltjXSA9ICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYyBpbiBsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwuaGFzT3duUHJvcGVydHkoYykgJiYgdVtjXSAhPT0gbFtjXSAmJiAobiB8fCAobiA9IHt9KSwgbltjXSA9IGxbY10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gfHwgKGUgfHwgKGUgPSBbXSksIGUucHVzaChzLCBuKSksIG4gPSBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Rhbmdlcm91c2x5U2V0SW5uZXJIVE1MJyA9PT0gcyA/IChsID0gbCA/IGwuX19odG1sIDogdm9pZCAwLCB1ID0gdSA/IHUuX19odG1sIDogdm9pZCAwLCBudWxsICE9IGwgJiYgdSAhPT0gbCAmJiAoZSA9IGUgfHwgW10pLnB1c2gocywgbCkpIDogJ2NoaWxkcmVuJyA9PT0gcyA/IHUgPT09IGwgfHwgJ3N0cmluZycgIT09IHR5cGVvZiBsICYmICdudW1iZXInICE9PSB0eXBlb2YgbCB8fCAoZSA9IGUgfHwgW10pLnB1c2gocywgJycgKyBsKSA6ICdzdXBwcmVzc0NvbnRlbnRFZGl0YWJsZVdhcm5pbmcnICE9PSBzICYmICdzdXBwcmVzc0h5ZHJhdGlvbldhcm5pbmcnICE9PSBzICYmIChDLmhhc093blByb3BlcnR5KHMpID8gKG51bGwgIT0gbCAmJiBjbihpLCBzKSwgZSB8fCB1ID09PSBsIHx8IChlID0gW10pKSA6IChlID0gZSB8fCBbXSkucHVzaChzLCBsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiAoZSA9IGUgfHwgW10pLnB1c2goJ3N0eWxlJywgbiksIGkgPSBlLCAodC51cGRhdGVRdWV1ZSA9IGkpICYmICh0LmVmZmVjdFRhZyB8PSA0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBCYSA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgbiAhPT0gciAmJiAodC5lZmZlY3RUYWcgfD0gNCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIFphID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIFdlYWtTZXQgPyBXZWFrU2V0IDogU2V0OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZXMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5zb3VyY2UsIHIgPSB0LnN0YWNrOwogICAgICAgICAgICAgICAgICAgIG51bGwgPT09IHIgJiYgbnVsbCAhPT0gbiAmJiAociA9IHZlKG4pKSwgbnVsbCAhPT0gbiAmJiBnZShuLnR5cGUpLCB0ID0gdC52YWx1ZSwgbnVsbCAhPT0gZSAmJiAxID09PSBlLnRhZyAmJiBnZShlLnR5cGUpOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IodCk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobykgewogICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHRzKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucmVmOwogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSB0KQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQobnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWMoZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuY3VycmVudCA9IG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBucyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0LnRhZykgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICBjYXNlIDExOgogICAgICAgICAgICAgICAgICAgIGNhc2UgMTU6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAyMjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDI1NiAmIHQuZWZmZWN0VGFnICYmIG51bGwgIT09IGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5tZW1vaXplZFByb3BzLCByID0gZS5tZW1vaXplZFN0YXRlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IChlID0gdC5zdGF0ZU5vZGUpLmdldFNuYXBzaG90QmVmb3JlVXBkYXRlKHQuZWxlbWVudFR5cGUgPT09IHQudHlwZSA/IG4gOiBRbyh0LnR5cGUsIG4pLCByKSwgZS5fX3JlYWN0SW50ZXJuYWxTbmFwc2hvdEJlZm9yZVVwZGF0ZSA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICBjYXNlIDE3OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMTYzKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBycyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09ICh0ID0gbnVsbCAhPT0gKHQgPSB0LnVwZGF0ZVF1ZXVlKSA/IHQubGFzdEVmZmVjdCA6IG51bGwpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdCA9IHQubmV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChuLnRhZyAmIGUpID09PSBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLmRlc3Ryb3k7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5kZXN0cm95ID0gdm9pZCAwLCB2b2lkIDAgIT09IHIgJiYgcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG4ubmV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobiAhPT0gdCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gb3MoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSAodCA9IG51bGwgIT09ICh0ID0gdC51cGRhdGVRdWV1ZSkgPyB0Lmxhc3RFZmZlY3QgOiBudWxsKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQgPSB0Lm5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgobi50YWcgJiBlKSA9PT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbi5jcmVhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5kZXN0cm95ID0gcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG4ubmV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobiAhPT0gdCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaXMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobi50YWcpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICBjYXNlIDE1OgogICAgICAgICAgICAgICAgICAgIGNhc2UgMjI6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIG9zKDMsIG4pOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPSBuLnN0YXRlTm9kZSwgNCAmIG4uZWZmZWN0VGFnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jb21wb25lbnREaWRNb3VudCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuLmVsZW1lbnRUeXBlID09PSBuLnR5cGUgPyB0Lm1lbW9pemVkUHJvcHMgOiBRbyhuLnR5cGUsIHQubWVtb2l6ZWRQcm9wcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jb21wb25lbnREaWRVcGRhdGUociwgdC5tZW1vaXplZFN0YXRlLCBlLl9fcmVhY3RJbnRlcm5hbFNuYXBzaG90QmVmb3JlVXBkYXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgKG51bGwgIT09ICh0ID0gbi51cGRhdGVRdWV1ZSkgJiYgcGkobiwgdCwgZSkpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09ICh0ID0gbi51cGRhdGVRdWV1ZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID0gbnVsbCwgbnVsbCAhPT0gbi5jaGlsZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKG4uY2hpbGQudGFnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gbi5jaGlsZC5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IG4uY2hpbGQuc3RhdGVOb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpKG4sIHQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gbi5zdGF0ZU5vZGUsIHZvaWQgKG51bGwgPT09IHQgJiYgNCAmIG4uZWZmZWN0VGFnICYmIHZuKG4udHlwZSwgbi5tZW1vaXplZFByb3BzKSAmJiBlLmZvY3VzKCkpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgNjoKICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTM6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIChudWxsID09PSBuLm1lbW9pemVkU3RhdGUgJiYgKG4gPSBuLmFsdGVybmF0ZSwgbnVsbCAhPT0gbiAmJiAobiA9IG4ubWVtb2l6ZWRTdGF0ZSwgbnVsbCAhPT0gbiAmJiAobiA9IG4uZGVoeWRyYXRlZCwgbnVsbCAhPT0gbiAmJiBxdChuKSkpKSk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxOToKICAgICAgICAgICAgICAgICAgICBjYXNlIDE3OgogICAgICAgICAgICAgICAgICAgIGNhc2UgMjA6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAyMToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE2MykpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYXMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIHhjICYmIHhjKHQpLCB0LnRhZykgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICBjYXNlIDExOgogICAgICAgICAgICAgICAgICAgIGNhc2UgMTQ6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxNToKICAgICAgICAgICAgICAgICAgICBjYXNlIDIyOgogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gKGUgPSB0LnVwZGF0ZVF1ZXVlKSAmJiBudWxsICE9PSAoZSA9IGUubGFzdEVmZmVjdCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5uZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgem8oOTcgPCBuID8gOTcgOiBuLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmRlc3Ryb3k7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHljKG8sIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLm5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoZSAhPT0gcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIHRzKHQpLCAnZnVuY3Rpb24nID09PSB0eXBlb2YgKG4gPSB0LnN0YXRlTm9kZSkuY29tcG9uZW50V2lsbFVubW91bnQgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wcm9wcyA9IGUubWVtb2l6ZWRQcm9wcywgdC5zdGF0ZSA9IGUubWVtb2l6ZWRTdGF0ZSwgdC5jb21wb25lbnRXaWxsVW5tb3VudCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHljKGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgIHRzKHQpOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgIGxzKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNzKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuYWx0ZXJuYXRlOwogICAgICAgICAgICAgICAgICAgIGUucmV0dXJuID0gbnVsbCwgZS5jaGlsZCA9IG51bGwsIGUubWVtb2l6ZWRTdGF0ZSA9IG51bGwsIGUudXBkYXRlUXVldWUgPSBudWxsLCBlLmRlcGVuZGVuY2llcyA9IG51bGwsIGUuYWx0ZXJuYXRlID0gbnVsbCwgZS5maXJzdEVmZmVjdCA9IG51bGwsIGUubGFzdEVmZmVjdCA9IG51bGwsIGUucGVuZGluZ1Byb3BzID0gbnVsbCwgZS5tZW1vaXplZFByb3BzID0gbnVsbCwgZS5zdGF0ZU5vZGUgPSBudWxsLCBudWxsICE9PSB0ICYmIHNzKHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gY3MoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiA1ID09PSBlLnRhZyB8fCAzID09PSBlLnRhZyB8fCA0ID09PSBlLnRhZzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHVzKGUpIHsKICAgICAgICAgICAgICAgICAgICBlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBlLnJldHVybjsgbnVsbCAhPT0gdDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjcyh0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQucmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMTYwKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCA9IG4uc3RhdGVOb2RlLCBuLnRhZykgewogICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQuY29udGFpbmVySW5mbywgciA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE2MSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAxNiAmIG4uZWZmZWN0VGFnICYmIChVZSh0LCAnJyksIG4uZWZmZWN0VGFnICY9IC0xNyk7CiAgICAgICAgICAgICAgICAgICAgZToKICAgICAgICAgICAgICAgICAgICAgICAgdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IGU7OykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBudWxsID09PSBuLnNpYmxpbmc7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBuLnJldHVybiB8fCBjcyhuLnJldHVybikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbi5yZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobi5zaWJsaW5nLnJldHVybiA9IG4ucmV0dXJuLCBuID0gbi5zaWJsaW5nOyA1ICE9PSBuLnRhZyAmJiA2ICE9PSBuLnRhZyAmJiAxOCAhPT0gbi50YWc7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgyICYgbi5lZmZlY3RUYWcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gbi5jaGlsZCB8fCA0ID09PSBuLnRhZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uY2hpbGQucmV0dXJuID0gbiwgbiA9IG4uY2hpbGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKDIgJiBuLmVmZmVjdFRhZykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG4uc3RhdGVOb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByID8gZnVuY3Rpb24gZSh0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdC50YWcsIGkgPSA1ID09PSBvIHx8IDYgPT09IG87CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IGkgPyB0LnN0YXRlTm9kZSA6IHQuc3RhdGVOb2RlLmluc3RhbmNlLCBuID8gOCA9PT0gci5ub2RlVHlwZSA/IHIucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUodCwgbikgOiByLmluc2VydEJlZm9yZSh0LCBuKSA6ICg4ID09PSByLm5vZGVUeXBlID8gKG4gPSByLnBhcmVudE5vZGUpLmluc2VydEJlZm9yZSh0LCByKSA6IChuID0gcikuYXBwZW5kQ2hpbGQodCksIG51bGwgIT09IChyID0gci5fcmVhY3RSb290Q29udGFpbmVyKSAmJiB2b2lkIDAgIT09IHIgfHwgbnVsbCAhPT0gbi5vbmNsaWNrIHx8IChuLm9uY2xpY2sgPSB1bikpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICg0ICE9PSBvICYmIG51bGwgIT09ICh0ID0gdC5jaGlsZCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUodCwgbiwgciksIHQgPSB0LnNpYmxpbmc7IG51bGwgIT09IHQ7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiwgciksIHQgPSB0LnNpYmxpbmc7CiAgICAgICAgICAgICAgICAgICAgfShlLCBuLCB0KSA6IGZ1bmN0aW9uIGUodCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHQudGFnLCBpID0gNSA9PT0gbyB8fCA2ID09PSBvOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBpID8gdC5zdGF0ZU5vZGUgOiB0LnN0YXRlTm9kZS5pbnN0YW5jZSwgbiA/IHIuaW5zZXJ0QmVmb3JlKHQsIG4pIDogci5hcHBlbmRDaGlsZCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoNCAhPT0gbyAmJiBudWxsICE9PSAodCA9IHQuY2hpbGQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlKHQsIG4sIHIpLCB0ID0gdC5zaWJsaW5nOyBudWxsICE9PSB0OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4sIHIpLCB0ID0gdC5zaWJsaW5nOwogICAgICAgICAgICAgICAgICAgIH0oZSwgbiwgdCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBscyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciwgbywgaSA9IHQsIHMgPSAhMTs7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IGkucmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgxNjApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChyID0gcy5zdGF0ZU5vZGUsIHMudGFnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IHIuY29udGFpbmVySW5mbywgbyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gcy5yZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICg1ID09PSBpLnRhZyB8fCA2ID09PSBpLnRhZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gZSwgdSA9IGksIGwgPSBuLCBmID0gdTs7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYXMoYywgZiwgbCksIG51bGwgIT09IGYuY2hpbGQgJiYgNCAhPT0gZi50YWcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLmNoaWxkLnJldHVybiA9IGYsIGYgPSBmLmNoaWxkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmID09PSB1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbnVsbCA9PT0gZi5zaWJsaW5nOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBmLnJldHVybiB8fCBmLnJldHVybiA9PT0gdSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gZi5yZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnNpYmxpbmcucmV0dXJuID0gZi5yZXR1cm4sIGYgPSBmLnNpYmxpbmc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPyAoYyA9IHIsIHUgPSBpLnN0YXRlTm9kZSwgOCA9PT0gYy5ub2RlVHlwZSA/IGMucGFyZW50Tm9kZS5yZW1vdmVDaGlsZCh1KSA6IGMucmVtb3ZlQ2hpbGQodSkpIDogci5yZW1vdmVDaGlsZChpLnN0YXRlTm9kZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoNCA9PT0gaS50YWcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBpLmNoaWxkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IGkuc3RhdGVOb2RlLmNvbnRhaW5lckluZm8sIG8gPSAhMCwgaS5jaGlsZC5yZXR1cm4gPSBpLCBpID0gaS5jaGlsZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChhcyhlLCBpLCBuKSwgbnVsbCAhPT0gaS5jaGlsZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5jaGlsZC5yZXR1cm4gPSBpLCBpID0gaS5jaGlsZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBudWxsID09PSBpLnNpYmxpbmc7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gaS5yZXR1cm4gfHwgaS5yZXR1cm4gPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgNCA9PT0gKGkgPSBpLnJldHVybikudGFnICYmIChzID0gITEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGkuc2libGluZy5yZXR1cm4gPSBpLnJldHVybiwgaSA9IGkuc2libGluZzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBmcyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0LnRhZykgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICBjYXNlIDExOgogICAgICAgICAgICAgICAgICAgIGNhc2UgMTQ6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxNToKICAgICAgICAgICAgICAgICAgICBjYXNlIDIyOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBycygzLCB0KTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdC5tZW1vaXplZFByb3BzLCBvID0gbnVsbCAhPT0gZSA/IGUubWVtb2l6ZWRQcm9wcyA6IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gdC50eXBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0LnVwZGF0ZVF1ZXVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQudXBkYXRlUXVldWUgPSBudWxsLCBudWxsICE9PSBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuW2tuXSA9IHIsICdpbnB1dCcgPT09IGUgJiYgJ3JhZGlvJyA9PT0gci50eXBlICYmIG51bGwgIT0gci5uYW1lICYmIENlKG4sIHIpLCBhbihlLCBvKSwgdCA9IGFuKGUsIHIpLCBvID0gMDsgbyA8IGkubGVuZ3RoOyBvICs9IDIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBpW29dLCBjID0gaVtvICsgMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHlsZScgPT09IHMgPyBubihuLCBjKSA6ICdkYW5nZXJvdXNseVNldElubmVySFRNTCcgPT09IHMgPyBNZShuLCBjKSA6ICdjaGlsZHJlbicgPT09IHMgPyBVZShuLCBjKSA6IEoobiwgcywgYywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2lucHV0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2Uobiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3RleHRhcmVhJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQWUobiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3NlbGVjdCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBuLl93cmFwcGVyU3RhdGUud2FzTXVsdGlwbGUsIG4uX3dyYXBwZXJTdGF0ZS53YXNNdWx0aXBsZSA9ICEhci5tdWx0aXBsZSwgbnVsbCAhPSAoZSA9IHIudmFsdWUpID8gT2UobiwgISFyLm11bHRpcGxlLCBlLCAhMSkgOiB0ICE9PSAhIXIubXVsdGlwbGUgJiYgKG51bGwgIT0gci5kZWZhdWx0VmFsdWUgPyBPZShuLCAhIXIubXVsdGlwbGUsIHIuZGVmYXVsdFZhbHVlLCAhMCkgOiBPZShuLCAhIXIubXVsdGlwbGUsIHIubXVsdGlwbGUgPyBbXSA6ICcnLCAhMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgY2FzZSA2OgogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gdC5zdGF0ZU5vZGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE2MikpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAodC5zdGF0ZU5vZGUubm9kZVZhbHVlID0gdC5tZW1vaXplZFByb3BzKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkICgodCA9IHQuc3RhdGVOb2RlKS5oeWRyYXRlICYmICh0Lmh5ZHJhdGUgPSAhMSwgcXQodC5jb250YWluZXJJbmZvKSkpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTI6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICBjYXNlIDEzOgogICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9IHQsIG51bGwgPT09IHQubWVtb2l6ZWRTdGF0ZSA/IHIgPSAhMSA6IChyID0gITAsIG4gPSB0LmNoaWxkLCBOcyA9IFVvKCkpLCBudWxsICE9PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSBuOzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDUgPT09IGUudGFnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGUuc3RhdGVOb2RlLCByID8gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIChpID0gaS5zdHlsZSkuc2V0UHJvcGVydHkgPyBpLnNldFByb3BlcnR5KCdkaXNwbGF5JywgJ25vbmUnLCAnaW1wb3J0YW50JykgOiBpLmRpc3BsYXkgPSAnbm9uZScgOiAoaSA9IGUuc3RhdGVOb2RlLCBvID0gdm9pZCAwICE9PSAobyA9IGUubWVtb2l6ZWRQcm9wcy5zdHlsZSkgJiYgbnVsbCAhPT0gbyAmJiBvLmhhc093blByb3BlcnR5KCdkaXNwbGF5JykgPyBvLmRpc3BsYXkgOiBudWxsLCBpLnN0eWxlLmRpc3BsYXkgPSB0bignZGlzcGxheScsIG8pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoNiA9PT0gZS50YWcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnN0YXRlTm9kZS5ub2RlVmFsdWUgPSByID8gJycgOiBlLm1lbW9pemVkUHJvcHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEzID09PSBlLnRhZyAmJiBudWxsICE9PSBlLm1lbW9pemVkU3RhdGUgJiYgbnVsbCA9PT0gZS5tZW1vaXplZFN0YXRlLmRlaHlkcmF0ZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaSA9IGUuY2hpbGQuc2libGluZykucmV0dXJuID0gZSwgZSA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gZS5jaGlsZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuY2hpbGQucmV0dXJuID0gZSwgZSA9IGUuY2hpbGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IG51bGwgPT09IGUuc2libGluZzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBlLnJldHVybiB8fCBlLnJldHVybiA9PT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUucmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc2libGluZy5yZXR1cm4gPSBlLnJldHVybiwgZSA9IGUuc2libGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIHBzKHQpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTk6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIHBzKHQpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTc6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgxNjMpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHBzKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudXBkYXRlUXVldWU7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZS51cGRhdGVRdWV1ZSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT09IG4gJiYgKG4gPSBlLnN0YXRlTm9kZSA9IG5ldyBaYSgpKSwgdC5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IEVjLmJpbmQobnVsbCwgZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmhhcyh0KSB8fCAobi5hZGQodCksIHQudGhlbihyLCByKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBkcyA9ICdmdW5jdGlvbicgPT09IHR5cGVvZiBXZWFrTWFwID8gV2Vha01hcCA6IE1hcDsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGhzKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAobiA9IGNpKG4sIG51bGwpKS50YWcgPSAzLCBuLnBheWxvYWQgPSB7IGVsZW1lbnQ6IG51bGwgfTsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uY2FsbGJhY2sgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHFzIHx8IChxcyA9ICEwLCBGcyA9IHIpLCBlcyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9LCBuOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbXMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIChuID0gY2kobiwgbnVsbCkpLnRhZyA9IDM7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLnR5cGUuZ2V0RGVyaXZlZFN0YXRlRnJvbUVycm9yOwogICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09PSB0eXBlb2YgcikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHQudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIG4ucGF5bG9hZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlcyhlLCB0KSwgcihvKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLnN0YXRlTm9kZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gaSAmJiAnZnVuY3Rpb24nID09PSB0eXBlb2YgaS5jb21wb25lbnREaWRDYXRjaCAmJiAobi5jYWxsYmFjayA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIHIgJiYgKG51bGwgPT09IERzID8gRHMgPSBuZXcgU2V0KFt0aGlzXSkgOiBEcy5hZGQodGhpcyksIGVzKGUsIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LnN0YWNrOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbXBvbmVudERpZENhdGNoKHQudmFsdWUsIHsgY29tcG9uZW50U3RhY2s6IG51bGwgIT09IG4gPyBuIDogJycgfSk7CiAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgZ3MsIHZzID0gTWF0aC5jZWlsLCB5cyA9IEsuUmVhY3RDdXJyZW50RGlzcGF0Y2hlciwgYnMgPSBLLlJlYWN0Q3VycmVudE93bmVyLCBFcyA9IDAsIHdzID0gMywgeHMgPSA0LCBTcyA9IDAsIENzID0gbnVsbCwga3MgPSBudWxsLCBUcyA9IDAsIF9zID0gRXMsIFBzID0gbnVsbCwgT3MgPSAxMDczNzQxODIzLCBJcyA9IDEwNzM3NDE4MjMsIExzID0gbnVsbCwgQXMgPSAwLCBScyA9ICExLCBOcyA9IDAsIGpzID0gbnVsbCwgcXMgPSAhMSwgRnMgPSBudWxsLCBEcyA9IG51bGwsIE1zID0gITEsIFVzID0gbnVsbCwgVnMgPSA5MCwgQnMgPSBudWxsLCB6cyA9IDAsIEdzID0gbnVsbCwgSHMgPSAwOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gV3MoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgIT09ICg0OCAmIFNzKSA/IDEwNzM3NDE4MjEgLSAoVW8oKSAvIDEwIHwgMCkgOiAwICE9PSBIcyA/IEhzIDogSHMgPSAxMDczNzQxODIxIC0gKFVvKCkgLyAxMCB8IDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gJHMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIGlmICgwID09PSAoMiAmICh0ID0gdC5tb2RlKSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxMDczNzQxODIzOwogICAgICAgICAgICAgICAgICAgIHZhciByID0gVm8oKTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gKDQgJiB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDk5ID09PSByID8gMTA3Mzc0MTgyMyA6IDEwNzM3NDE4MjI7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09ICgxNiAmIFNzKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRzOwogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBuKQogICAgICAgICAgICAgICAgICAgICAgICBlID0gWW8oZSwgMCB8IG4udGltZW91dE1zIHx8IDUwMDAsIDI1MCk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA5OToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSAxMDczNzQxODIzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOTg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gWW8oZSwgMTUwLCAxMDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOTc6CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgOTY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gWW8oZSwgNTAwMCwgMjUwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDk1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IDI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzI2KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gQ3MgJiYgZSA9PT0gVHMgJiYgLS1lLCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gWXMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmICg1MCA8IHpzKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyB6cyA9IDAsIEdzID0gbnVsbCwgRXJyb3IoYSgxODUpKTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gKGUgPSBRcyhlLCB0KSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBWbygpOwogICAgICAgICAgICAgICAgICAgICAgICAxMDczNzQxODIzID09PSB0ID8gMCAhPT0gKDggJiBTcykgJiYgMCA9PT0gKDQ4ICYgU3MpID8gWnMoZSkgOiAoSnMoZSksIDAgPT09IFNzICYmIFdvKCkpIDogSnMoZSksIDAgPT09ICg0ICYgU3MpIHx8IDk4ICE9PSBuICYmIDk5ICE9PSBuIHx8IChudWxsID09PSBCcyA/IEJzID0gbmV3IE1hcChbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0pIDogKHZvaWQgMCA9PT0gKG4gPSBCcy5nZXQoZSkpIHx8IG4gPiB0KSAmJiBCcy5zZXQoZSwgdCkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFFzKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBlLmV4cGlyYXRpb25UaW1lIDwgdCAmJiAoZS5leHBpcmF0aW9uVGltZSA9IHQpOwogICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5hbHRlcm5hdGU7CiAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gbiAmJiBuLmV4cGlyYXRpb25UaW1lIDwgdCAmJiAobi5leHBpcmF0aW9uVGltZSA9IHQpOwogICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5yZXR1cm4sIG8gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSByICYmIDMgPT09IGUudGFnKQogICAgICAgICAgICAgICAgICAgICAgICBvID0gZS5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbnVsbCAhPT0gcjspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID0gci5hbHRlcm5hdGUsIHIuY2hpbGRFeHBpcmF0aW9uVGltZSA8IHQgJiYgKHIuY2hpbGRFeHBpcmF0aW9uVGltZSA9IHQpLCBudWxsICE9PSBuICYmIG4uY2hpbGRFeHBpcmF0aW9uVGltZSA8IHQgJiYgKG4uY2hpbGRFeHBpcmF0aW9uVGltZSA9IHQpLCBudWxsID09PSByLnJldHVybiAmJiAzID09PSByLnRhZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSByLnN0YXRlTm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSByLnJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSBvICYmIChDcyA9PT0gbyAmJiAoYWModCksIF9zID09PSB4cyAmJiBSYyhvLCBUcykpLCBOYyhvLCB0KSksIG87CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBLcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmxhc3RFeHBpcmVkVGltZTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCAhPT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFBYyhlLCB0ID0gZS5maXJzdFBlbmRpbmdUaW1lKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmxhc3RQaW5nZWRUaW1lOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAyID49IChlID0gbiA+IChlID0gZS5uZXh0S25vd25QZW5kaW5nTGV2ZWwpID8gbiA6IGUpICYmIHQgIT09IGUgPyAwIDogZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEpzKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMCAhPT0gZS5sYXN0RXhwaXJlZFRpbWUpCiAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbGJhY2tFeHBpcmF0aW9uVGltZSA9IDEwNzM3NDE4MjMsIGUuY2FsbGJhY2tQcmlvcml0eSA9IDk5LCBlLmNhbGxiYWNrTm9kZSA9IEhvKFpzLmJpbmQobnVsbCwgZSkpOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEtzKGUpLCBuID0gZS5jYWxsYmFja05vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gbiAmJiAoZS5jYWxsYmFja05vZGUgPSBudWxsLCBlLmNhbGxiYWNrRXhwaXJhdGlvblRpbWUgPSAwLCBlLmNhbGxiYWNrUHJpb3JpdHkgPSA5MCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBXcygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEwNzM3NDE4MjMgPT09IHQgPyByID0gOTkgOiAxID09PSB0IHx8IDIgPT09IHQgPyByID0gOTUgOiByID0gMCA+PSAociA9IDEwICogKDEwNzM3NDE4MjEgLSB0KSAtIDEwICogKDEwNzM3NDE4MjEgLSByKSkgPyA5OSA6IDI1MCA+PSByID8gOTggOiA1MjUwID49IHIgPyA5NyA6IDk1LCBudWxsICE9PSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlLmNhbGxiYWNrUHJpb3JpdHk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuY2FsbGJhY2tFeHBpcmF0aW9uVGltZSA9PT0gdCAmJiBvID49IHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICE9PSBSbyAmJiBDbyhuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbGJhY2tFeHBpcmF0aW9uVGltZSA9IHQsIGUuY2FsbGJhY2tQcmlvcml0eSA9IHIsIHQgPSAxMDczNzQxODIzID09PSB0ID8gSG8oWnMuYmluZChudWxsLCBlKSkgOiBHbyhyLCBYcy5iaW5kKG51bGwsIGUpLCB7IHRpbWVvdXQ6IDEwICogKDEwNzM3NDE4MjEgLSB0KSAtIFVvKCkgfSksIGUuY2FsbGJhY2tOb2RlID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFhzKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoSHMgPSAwLCB0KQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamMoZSwgdCA9IFdzKCkpLCBKcyhlKSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IEtzKGUpOwogICAgICAgICAgICAgICAgICAgIGlmICgwICE9PSBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID0gZS5jYWxsYmFja05vZGUsIDAgIT09ICg0OCAmIFNzKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzI3KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYygpLCBlID09PSBDcyAmJiBuID09PSBUcyB8fCBuYyhlLCBuKSwgbnVsbCAhPT0ga3MpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gU3M7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBTcyB8PSAxNjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gPSBvYygpOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2MoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByYyhlLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZWkoKSwgU3MgPSByLCB5cy5jdXJyZW50ID0gbywgMSA9PT0gX3MpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgdCA9IFBzLCBuYyhlLCBuKSwgUmMoZSwgbiksIEpzKGUpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGtzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobyA9IGUuZmluaXNoZWRXb3JrID0gZS5jdXJyZW50LmFsdGVybmF0ZSwgZS5maW5pc2hlZEV4cGlyYXRpb25UaW1lID0gbiwgciA9IF9zLCBDcyA9IG51bGwsIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEVzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgzNDUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpjKGUsIDIgPCBuID8gMiA6IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHdzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoUmMoZSwgbiksIG4gPT09IChyID0gZS5sYXN0U3VzcGVuZGVkVGltZSkgJiYgKGUubmV4dEtub3duUGVuZGluZ0xldmVsID0gZmMobykpLCAxMDczNzQxODIzID09PSBPcyAmJiAxMCA8IChvID0gTnMgKyA1MDAgLSBVbygpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFJzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLmxhc3RQaW5nZWRUaW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBpIHx8IGkgPj0gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmxhc3RQaW5nZWRUaW1lID0gbiwgbmMoZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwICE9PSAoaSA9IEtzKGUpKSAmJiBpICE9PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09IHIgJiYgciAhPT0gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUubGFzdFBpbmdlZFRpbWUgPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS50aW1lb3V0SGFuZGxlID0gYm4ocGMuYmluZChudWxsLCBlKSwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB4czoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFJjKGUsIG4pLCBuID09PSAociA9IGUubGFzdFN1c3BlbmRlZFRpbWUpICYmIChlLm5leHRLbm93blBlbmRpbmdMZXZlbCA9IGZjKG8pKSwgUnMgJiYgKDAgPT09IChvID0gZS5sYXN0UGluZ2VkVGltZSkgfHwgbyA+PSBuKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5sYXN0UGluZ2VkVGltZSA9IG4sIG5jKGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09IChvID0gS3MoZSkpICYmIG8gIT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09IHIgJiYgciAhPT0gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5sYXN0UGluZ2VkVGltZSA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMTA3Mzc0MTgyMyAhPT0gSXMgPyByID0gMTAgKiAoMTA3Mzc0MTgyMSAtIElzKSAtIFVvKCkgOiAxMDczNzQxODIzID09PSBPcyA/IHIgPSAwIDogKHIgPSAxMCAqICgxMDczNzQxODIxIC0gT3MpIC0gNTAwMCwgMCA+IChyID0gKG8gPSBVbygpKSAtIHIpICYmIChyID0gMCksIChuID0gMTAgKiAoMTA3Mzc0MTgyMSAtIG4pIC0gbykgPCAociA9ICgxMjAgPiByID8gMTIwIDogNDgwID4gciA/IDQ4MCA6IDEwODAgPiByID8gMTA4MCA6IDE5MjAgPiByID8gMTkyMCA6IDMwMDAgPiByID8gMzAwMCA6IDQzMjAgPiByID8gNDMyMCA6IDE5NjAgKiB2cyhyIC8gMTk2MCkpIC0gcikgJiYgKHIgPSBuKSksIDEwIDwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS50aW1lb3V0SGFuZGxlID0gYm4ocGMuYmluZChudWxsLCBlKSwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMTA3Mzc0MTgyMyAhPT0gT3MgJiYgbnVsbCAhPT0gTHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBPczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gTHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA+PSAociA9IDAgfCBzLmJ1c3lNaW5EdXJhdGlvbk1zKSA/IHIgPSAwIDogKG8gPSAwIHwgcy5idXN5RGVsYXlNcywgciA9IChpID0gVW8oKSAtICgxMCAqICgxMDczNzQxODIxIC0gaSkgLSAoMCB8IHMudGltZW91dE1zIHx8IDUwMDApKSkgPD0gbyA/IDAgOiBvICsgciAtIGkpLCAxMCA8IHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSYyhlLCBuKSwgZS50aW1lb3V0SGFuZGxlID0gYm4ocGMuYmluZChudWxsLCBlKSwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzI5KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEpzKGUpLCBlLmNhbGxiYWNrTm9kZSA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWHMuYmluZChudWxsLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFpzKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubGFzdEV4cGlyZWRUaW1lOwogICAgICAgICAgICAgICAgICAgIGlmICh0ID0gMCAhPT0gdCA/IHQgOiAxMDczNzQxODIzLCAwICE9PSAoNDggJiBTcykpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzI3KSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG1jKCksIGUgPT09IENzICYmIHQgPT09IFRzIHx8IG5jKGUsIHQpLCBudWxsICE9PSBrcykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFNzOwogICAgICAgICAgICAgICAgICAgICAgICBTcyB8PSAxNjsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IG9jKCk7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2MoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByYyhlLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVpKCksIFNzID0gbiwgeXMuY3VycmVudCA9IHIsIDEgPT09IF9zKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbiA9IFBzLCBuYyhlLCB0KSwgUmMoZSwgdCksIEpzKGUpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0ga3MpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDI2MSkpOwogICAgICAgICAgICAgICAgICAgICAgICBlLmZpbmlzaGVkV29yayA9IGUuY3VycmVudC5hbHRlcm5hdGUsIGUuZmluaXNoZWRFeHBpcmF0aW9uVGltZSA9IHQsIENzID0gbnVsbCwgcGMoZSksIEpzKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGVjKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFNzOwogICAgICAgICAgICAgICAgICAgIFNzIHw9IDE7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodCk7CiAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgMCA9PT0gKFNzID0gbikgJiYgV28oKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB0YyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBTczsKICAgICAgICAgICAgICAgICAgICBTcyAmPSAtMiwgU3MgfD0gODsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0KTsKICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAwID09PSAoU3MgPSBuKSAmJiBXbygpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG5jKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBlLmZpbmlzaGVkV29yayA9IG51bGwsIGUuZmluaXNoZWRFeHBpcmF0aW9uVGltZSA9IDA7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLnRpbWVvdXRIYW5kbGU7CiAgICAgICAgICAgICAgICAgICAgaWYgKC0xICE9PSBuICYmIChlLnRpbWVvdXRIYW5kbGUgPSAtMSwgRW4obikpLCBudWxsICE9PSBrcykKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0ga3MucmV0dXJuOyBudWxsICE9PSBuOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChyLnRhZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IChyID0gci50eXBlLmNoaWxkQ29udGV4dFR5cGVzKSAmJiB2b2lkIDAgIT09IHIgJiYgdm8oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSaSgpLCBjbyhwbyksIGNvKGZvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaShyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSaSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY28ocWkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aShyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBuLnJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIENzID0gZSwga3MgPSBUYyhlLmN1cnJlbnQsIG51bGwpLCBUcyA9IHQsIF9zID0gRXMsIFBzID0gbnVsbCwgSXMgPSBPcyA9IDEwNzM3NDE4MjMsIExzID0gbnVsbCwgQXMgPSAwLCBScyA9ICExOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcmMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGZvciAoOzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlaSgpLCBNaS5jdXJyZW50ID0gZ2EsIEhpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBCaS5tZW1vaXplZFN0YXRlOyBudWxsICE9PSBuOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4ucXVldWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IHIgJiYgKHIucGVuZGluZyA9IG51bGwpLCBuID0gbi5uZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChWaSA9IDAsIEdpID0gemkgPSBCaSA9IG51bGwsIEhpID0gITEsIG51bGwgPT09IGtzIHx8IG51bGwgPT09IGtzLnJldHVybikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3MgPSAxLCBQcyA9IHQsIGtzID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGUsIGkgPSBrcy5yZXR1cm4sIGEgPSBrcywgcyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPSBUcywgYS5lZmZlY3RUYWcgfD0gMjA0OCwgYS5maXJzdEVmZmVjdCA9IGEubGFzdEVmZmVjdCA9IG51bGwsIG51bGwgIT09IHMgJiYgJ29iamVjdCcgPT09IHR5cGVvZiBzICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiBzLnRoZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gKDIgJiBhLm1vZGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IGEuYWx0ZXJuYXRlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSA/IChhLnVwZGF0ZVF1ZXVlID0gdS51cGRhdGVRdWV1ZSwgYS5tZW1vaXplZFN0YXRlID0gdS5tZW1vaXplZFN0YXRlLCBhLmV4cGlyYXRpb25UaW1lID0gdS5leHBpcmF0aW9uVGltZSkgOiAoYS51cGRhdGVRdWV1ZSA9IG51bGwsIGEubWVtb2l6ZWRTdGF0ZSA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gMCAhPT0gKDEgJiBxaS5jdXJyZW50KSwgZiA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHAgPSAxMyA9PT0gZi50YWcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGYubWVtb2l6ZWRTdGF0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcCA9IG51bGwgIT09IGQuZGVoeWRyYXRlZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBmLm1lbW9pemVkUHJvcHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAgPSB2b2lkIDAgIT09IGguZmFsbGJhY2sgJiYgKCEwICE9PSBoLnVuc3RhYmxlX2F2b2lkVGhpc0ZhbGxiYWNrIHx8ICFsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBtID0gZi51cGRhdGVRdWV1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gbSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IG5ldyBTZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5hZGQoYyksIGYudXBkYXRlUXVldWUgPSBnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtLmFkZChjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gKDIgJiBmLm1vZGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmLmVmZmVjdFRhZyB8PSA2NCwgYS5lZmZlY3RUYWcgJj0gLTI5ODEsIDEgPT09IGEudGFnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGEuYWx0ZXJuYXRlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEudGFnID0gMTc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdiA9IGNpKDEwNzM3NDE4MjMsIG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYudGFnID0gMiwgdWkoYSwgdik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuZXhwaXJhdGlvblRpbWUgPSAxMDczNzQxODIzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gdm9pZCAwLCBhID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IG8ucGluZ0NhY2hlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSB5ID8gKHkgPSBvLnBpbmdDYWNoZSA9IG5ldyBkcygpLCBzID0gbmV3IFNldCgpLCB5LnNldChjLCBzKSkgOiB2b2lkIDAgPT09IChzID0geS5nZXQoYykpICYmIChzID0gbmV3IFNldCgpLCB5LnNldChjLCBzKSksICFzLmhhcyhhKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLmFkZChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBiYy5iaW5kKG51bGwsIG8sIGMsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLnRoZW4oYiwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuZWZmZWN0VGFnIHw9IDQwOTYsIGYuZXhwaXJhdGlvblRpbWUgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gZi5yZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKG51bGwgIT09IGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gRXJyb3IoKGdlKGEudHlwZSkgfHwgJ0EgUmVhY3QgY29tcG9uZW50JykgKyAnIHN1c3BlbmRlZCB3aGlsZSByZW5kZXJpbmcsIGJ1dCBubyBmYWxsYmFjayBVSSB3YXMgc3BlY2lmaWVkLlxuXG5BZGQgYSA8U3VzcGVuc2UgZmFsbGJhY2s9Li4uPiBjb21wb25lbnQgaGlnaGVyIGluIHRoZSB0cmVlIHRvIHByb3ZpZGUgYSBsb2FkaW5nIGluZGljYXRvciBvciBwbGFjZWhvbGRlciB0byBkaXNwbGF5LicgKyB2ZShhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUgIT09IF9zICYmIChfcyA9IDIpLCBzID0gWGEocywgYSksIGYgPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChmLnRhZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gcywgZi5lZmZlY3RUYWcgfD0gNDA5NiwgZi5leHBpcmF0aW9uVGltZSA9IHQsIGxpKGYsIGhzKGYsIGMsIHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEUgPSBmLnR5cGUsIHcgPSBmLnN0YXRlTm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSAoNjQgJiBmLmVmZmVjdFRhZykgJiYgKCdmdW5jdGlvbicgPT09IHR5cGVvZiBFLmdldERlcml2ZWRTdGF0ZUZyb21FcnJvciB8fCBudWxsICE9PSB3ICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiB3LmNvbXBvbmVudERpZENhdGNoICYmIChudWxsID09PSBEcyB8fCAhRHMuaGFzKHcpKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLmVmZmVjdFRhZyB8PSA0MDk2LCBmLmV4cGlyYXRpb25UaW1lID0gdCwgbGkoZiwgbXMoZiwgYywgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGYucmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKG51bGwgIT09IGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAga3MgPSBsYyhrcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gb2MoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB5cy5jdXJyZW50OwogICAgICAgICAgICAgICAgICAgIHJldHVybiB5cy5jdXJyZW50ID0gZ2EsIG51bGwgPT09IGUgPyBnYSA6IGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBpYyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZSA8IE9zICYmIDIgPCBlICYmIChPcyA9IGUpLCBudWxsICE9PSB0ICYmIGUgPCBJcyAmJiAyIDwgZSAmJiAoSXMgPSBlLCBMcyA9IHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYWMoZSkgewogICAgICAgICAgICAgICAgICAgIGUgPiBBcyAmJiAoQXMgPSBlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNjKCkgewogICAgICAgICAgICAgICAgICAgIGZvciAoOyBudWxsICE9PSBrczspCiAgICAgICAgICAgICAgICAgICAgICAgIGtzID0gdWMoa3MpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gY2MoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICg7IG51bGwgIT09IGtzICYmICFObygpOykKICAgICAgICAgICAgICAgICAgICAgICAga3MgPSB1Yyhrcyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB1YyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBncyhlLmFsdGVybmF0ZSwgZSwgVHMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm1lbW9pemVkUHJvcHMgPSBlLnBlbmRpbmdQcm9wcywgbnVsbCA9PT0gdCAmJiAodCA9IGxjKGUpKSwgYnMuY3VycmVudCA9IG51bGwsIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBsYyhlKSB7CiAgICAgICAgICAgICAgICAgICAga3MgPSBlOwogICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBrcy5hbHRlcm5hdGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID0ga3MucmV0dXJuLCAwID09PSAoMjA0OCAmIGtzLmVmZmVjdFRhZykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID0gS2EodCwga3MsIFRzKSwgMSA9PT0gVHMgfHwgMSAhPT0ga3MuY2hpbGRFeHBpcmF0aW9uVGltZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwLCByID0ga3MuY2hpbGQ7IG51bGwgIT09IHI7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gci5leHBpcmF0aW9uVGltZSwgaSA9IHIuY2hpbGRFeHBpcmF0aW9uVGltZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA+IG4gJiYgKG4gPSBvKSwgaSA+IG4gJiYgKG4gPSBpKSwgciA9IHIuc2libGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga3MuY2hpbGRFeHBpcmF0aW9uVGltZSA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IGUgJiYgMCA9PT0gKDIwNDggJiBlLmVmZmVjdFRhZykgJiYgKG51bGwgPT09IGUuZmlyc3RFZmZlY3QgJiYgKGUuZmlyc3RFZmZlY3QgPSBrcy5maXJzdEVmZmVjdCksIG51bGwgIT09IGtzLmxhc3RFZmZlY3QgJiYgKG51bGwgIT09IGUubGFzdEVmZmVjdCAmJiAoZS5sYXN0RWZmZWN0Lm5leHRFZmZlY3QgPSBrcy5maXJzdEVmZmVjdCksIGUubGFzdEVmZmVjdCA9IGtzLmxhc3RFZmZlY3QpLCAxIDwga3MuZWZmZWN0VGFnICYmIChudWxsICE9PSBlLmxhc3RFZmZlY3QgPyBlLmxhc3RFZmZlY3QubmV4dEVmZmVjdCA9IGtzIDogZS5maXJzdEVmZmVjdCA9IGtzLCBlLmxhc3RFZmZlY3QgPSBrcykpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09ICh0ID0gSmEoa3MpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5lZmZlY3RUYWcgJj0gMjA0NywgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT09IGUgJiYgKGUuZmlyc3RFZmZlY3QgPSBlLmxhc3RFZmZlY3QgPSBudWxsLCBlLmVmZmVjdFRhZyB8PSAyMDQ4KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gKHQgPSBrcy5zaWJsaW5nKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICBrcyA9IGU7CiAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobnVsbCAhPT0ga3MpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBfcyA9PT0gRXMgJiYgKF9zID0gNSksIG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBmYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmV4cGlyYXRpb25UaW1lOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID4gKGUgPSBlLmNoaWxkRXhwaXJhdGlvblRpbWUpID8gdCA6IGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBwYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBWbygpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB6byg5OSwgZGMuYmluZChudWxsLCBlLCB0KSksIG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkYyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICBtYygpOwogICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKG51bGwgIT09IFVzKTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCAhPT0gKDQ4ICYgU3MpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDMyNykpOwogICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5maW5pc2hlZFdvcmssIHIgPSBlLmZpbmlzaGVkRXhwaXJhdGlvblRpbWU7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIGlmIChlLmZpbmlzaGVkV29yayA9IG51bGwsIGUuZmluaXNoZWRFeHBpcmF0aW9uVGltZSA9IDAsIG4gPT09IGUuY3VycmVudCkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgxNzcpKTsKICAgICAgICAgICAgICAgICAgICBlLmNhbGxiYWNrTm9kZSA9IG51bGwsIGUuY2FsbGJhY2tFeHBpcmF0aW9uVGltZSA9IDAsIGUuY2FsbGJhY2tQcmlvcml0eSA9IDkwLCBlLm5leHRLbm93blBlbmRpbmdMZXZlbCA9IDA7CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBmYyhuKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZS5maXJzdFBlbmRpbmdUaW1lID0gbywgciA8PSBlLmxhc3RTdXNwZW5kZWRUaW1lID8gZS5maXJzdFN1c3BlbmRlZFRpbWUgPSBlLmxhc3RTdXNwZW5kZWRUaW1lID0gZS5uZXh0S25vd25QZW5kaW5nTGV2ZWwgPSAwIDogciA8PSBlLmZpcnN0U3VzcGVuZGVkVGltZSAmJiAoZS5maXJzdFN1c3BlbmRlZFRpbWUgPSByIC0gMSksIHIgPD0gZS5sYXN0UGluZ2VkVGltZSAmJiAoZS5sYXN0UGluZ2VkVGltZSA9IDApLCByIDw9IGUubGFzdEV4cGlyZWRUaW1lICYmIChlLmxhc3RFeHBpcmVkVGltZSA9IDApLCBlID09PSBDcyAmJiAoa3MgPSBDcyA9IG51bGwsIFRzID0gMCksIDEgPCBuLmVmZmVjdFRhZyA/IG51bGwgIT09IG4ubGFzdEVmZmVjdCA/IChuLmxhc3RFZmZlY3QubmV4dEVmZmVjdCA9IG4sIG8gPSBuLmZpcnN0RWZmZWN0KSA6IG8gPSBuIDogbyA9IG4uZmlyc3RFZmZlY3QsIG51bGwgIT09IG8pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBTczsKICAgICAgICAgICAgICAgICAgICAgICAgU3MgfD0gMzIsIGJzLmN1cnJlbnQgPSBudWxsLCBtbiA9IFd0OwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGRuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChobihzKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzZWxlY3Rpb25TdGFydCcgaW4gcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IHMuc2VsZWN0aW9uU3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZDogcy5zZWxlY3Rpb25FbmQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSAoYyA9IChjID0gcy5vd25lckRvY3VtZW50KSAmJiBjLmRlZmF1bHRWaWV3IHx8IHdpbmRvdykuZ2V0U2VsZWN0aW9uICYmIGMuZ2V0U2VsZWN0aW9uKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1ICYmIDAgIT09IHUucmFuZ2VDb3VudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IHUuYW5jaG9yTm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gdS5hbmNob3JPZmZzZXQsIGYgPSB1LmZvY3VzTm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSB1LmZvY3VzT2Zmc2V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLm5vZGVUeXBlLCBmLm5vZGVUeXBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IDAsIGQgPSAtMSwgaCA9IC0xLCBtID0gMCwgZyA9IDAsIHYgPSBzLCB5ID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiOyB2ICE9PSBjIHx8IDAgIT09IGwgJiYgMyAhPT0gdi5ub2RlVHlwZSB8fCAoZCA9IHAgKyBsKSwgdiAhPT0gZiB8fCAwICE9PSB1ICYmIDMgIT09IHYubm9kZVR5cGUgfHwgKGggPSBwICsgdSksIDMgPT09IHYubm9kZVR5cGUgJiYgKHAgKz0gdi5ub2RlVmFsdWUubGVuZ3RoKSwgbnVsbCAhPT0gKGIgPSB2LmZpcnN0Q2hpbGQpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkgPSB2LCB2ID0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHYgPT09IHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh5ID09PSBjICYmICsrbSA9PT0gbCAmJiAoZCA9IHApLCB5ID09PSBmICYmICsrZyA9PT0gdSAmJiAoaCA9IHApLCBudWxsICE9PSAoYiA9IHYubmV4dFNpYmxpbmcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeSA9ICh2ID0geSkucGFyZW50Tm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ID0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gLTEgPT09IGQgfHwgLTEgPT09IGggPyBudWxsIDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0OiBkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZDogaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gYyB8fCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kOiAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBnbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGl2ZUVsZW1lbnREZXRhY2hlZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvY3VzZWRFbGVtOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0aW9uUmFuZ2U6IGMKICAgICAgICAgICAgICAgICAgICAgICAgfSwgV3QgPSAhMSwganMgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhjKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChUKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGpzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDMzMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHljKGpzLCBUKSwganMgPSBqcy5uZXh0RWZmZWN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlIChudWxsICE9PSBqcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGpzID0gbzsKICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHMgPSBlLCBjID0gdDsgbnVsbCAhPT0ganM7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBFID0ganMuZWZmZWN0VGFnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMTYgJiBFICYmIFVlKGpzLnN0YXRlTm9kZSwgJycpLCAxMjggJiBFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdyA9IGpzLmFsdGVybmF0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSB3KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHggPSB3LnJlZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9PSB4ICYmICgnZnVuY3Rpb24nID09PSB0eXBlb2YgeCA/IHgobnVsbCkgOiB4LmN1cnJlbnQgPSBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKDEwMzggJiBFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzKGpzKSwganMuZWZmZWN0VGFnICY9IC0zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzKGpzKSwganMuZWZmZWN0VGFnICY9IC0zLCBmcyhqcy5hbHRlcm5hdGUsIGpzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwMjQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqcy5lZmZlY3RUYWcgJj0gLTEwMjU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMDI4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganMuZWZmZWN0VGFnICY9IC0xMDI1LCBmcyhqcy5hbHRlcm5hdGUsIGpzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcyhqcy5hbHRlcm5hdGUsIGpzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDg6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBscyhzLCBsID0ganMsIGMpLCBzcyhsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqcyA9IGpzLm5leHRFZmZlY3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBqcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgzMzApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5YyhqcywgVCksIGpzID0ganMubmV4dEVmZmVjdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobnVsbCAhPT0ganMpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoeCA9IGduLCB3ID0gZG4oKSwgRSA9IHguZm9jdXNlZEVsZW0sIGMgPSB4LnNlbGVjdGlvblJhbmdlLCB3ICE9PSBFICYmIEUgJiYgRS5vd25lckRvY3VtZW50ICYmIGZ1bmN0aW9uIGUodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCF0IHx8ICFuKSAmJiAodCA9PT0gbiB8fCAoIXQgfHwgMyAhPT0gdC5ub2RlVHlwZSkgJiYgKG4gJiYgMyA9PT0gbi5ub2RlVHlwZSA/IGUodCwgbi5wYXJlbnROb2RlKSA6ICdjb250YWlucycgaW4gdCA/IHQuY29udGFpbnMobikgOiAhIXQuY29tcGFyZURvY3VtZW50UG9zaXRpb24gJiYgISEoMTYgJiB0LmNvbXBhcmVEb2N1bWVudFBvc2l0aW9uKG4pKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShFLm93bmVyRG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LCBFKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gYyAmJiBobihFKSAmJiAodyA9IGMuc3RhcnQsIHZvaWQgMCA9PT0gKHggPSBjLmVuZCkgJiYgKHggPSB3KSwgJ3NlbGVjdGlvblN0YXJ0JyBpbiBFID8gKEUuc2VsZWN0aW9uU3RhcnQgPSB3LCBFLnNlbGVjdGlvbkVuZCA9IE1hdGgubWluKHgsIEUudmFsdWUubGVuZ3RoKSkgOiAoeCA9ICh3ID0gRS5vd25lckRvY3VtZW50IHx8IGRvY3VtZW50KSAmJiB3LmRlZmF1bHRWaWV3IHx8IHdpbmRvdykuZ2V0U2VsZWN0aW9uICYmICh4ID0geC5nZXRTZWxlY3Rpb24oKSwgbCA9IEUudGV4dENvbnRlbnQubGVuZ3RoLCBzID0gTWF0aC5taW4oYy5zdGFydCwgbCksIGMgPSB2b2lkIDAgPT09IGMuZW5kID8gcyA6IE1hdGgubWluKGMuZW5kLCBsKSwgIXguZXh0ZW5kICYmIHMgPiBjICYmIChsID0gYywgYyA9IHMsIHMgPSBsKSwgbCA9IHBuKEUsIHMpLCBmID0gcG4oRSwgYyksIGwgJiYgZiAmJiAoMSAhPT0geC5yYW5nZUNvdW50IHx8IHguYW5jaG9yTm9kZSAhPT0gbC5ub2RlIHx8IHguYW5jaG9yT2Zmc2V0ICE9PSBsLm9mZnNldCB8fCB4LmZvY3VzTm9kZSAhPT0gZi5ub2RlIHx8IHguZm9jdXNPZmZzZXQgIT09IGYub2Zmc2V0KSAmJiAoKHcgPSB3LmNyZWF0ZVJhbmdlKCkpLnNldFN0YXJ0KGwubm9kZSwgbC5vZmZzZXQpLCB4LnJlbW92ZUFsbFJhbmdlcygpLCBzID4gYyA/ICh4LmFkZFJhbmdlKHcpLCB4LmV4dGVuZChmLm5vZGUsIGYub2Zmc2V0KSkgOiAody5zZXRFbmQoZi5ub2RlLCBmLm9mZnNldCksIHguYWRkUmFuZ2UodykpKSkpLCB3ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHggPSBFOyB4ID0geC5wYXJlbnROb2RlOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxID09PSB4Lm5vZGVUeXBlICYmIHcucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQ6IHgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IHguc2Nyb2xsTGVmdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9wOiB4LnNjcm9sbFRvcAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICgnZnVuY3Rpb24nID09PSB0eXBlb2YgRS5mb2N1cyAmJiBFLmZvY3VzKCksIEUgPSAwOyBFIDwgdy5sZW5ndGg7IEUrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoeCA9IHdbRV0pLmVsZW1lbnQuc2Nyb2xsTGVmdCA9IHgubGVmdCwgeC5lbGVtZW50LnNjcm9sbFRvcCA9IHgudG9wOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIFd0ID0gISFtbiwgZ24gPSBtbiA9IG51bGwsIGUuY3VycmVudCA9IG4sIGpzID0gbzsKICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKEUgPSBlOyBudWxsICE9PSBqczspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFMgPSBqcy5lZmZlY3RUYWc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgzNiAmIFMgJiYgaXMoRSwganMuYWx0ZXJuYXRlLCBqcyksIDEyOCAmIFMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgQyA9IGpzLnJlZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBDKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSBqcy5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChqcy50YWcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcgPSBrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ID0gazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIEMgPyBDKHcpIDogQy5jdXJyZW50ID0gdzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqcyA9IGpzLm5leHRFZmZlY3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBqcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgzMzApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5YyhqcywgVCksIGpzID0ganMubmV4dEVmZmVjdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobnVsbCAhPT0ganMpOwogICAgICAgICAgICAgICAgICAgICAgICBqcyA9IG51bGwsIGpvKCksIFNzID0gaTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZS5jdXJyZW50ID0gbjsKICAgICAgICAgICAgICAgICAgICBpZiAoTXMpCiAgICAgICAgICAgICAgICAgICAgICAgIE1zID0gITEsIFVzID0gZSwgVnMgPSB0OwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChqcyA9IG87IG51bGwgIT09IGpzOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBqcy5uZXh0RWZmZWN0LCBqcy5uZXh0RWZmZWN0ID0gbnVsbCwganMgPSB0OwogICAgICAgICAgICAgICAgICAgIGlmICgwID09PSAodCA9IGUuZmlyc3RQZW5kaW5nVGltZSkgJiYgKERzID0gbnVsbCksIDEwNzM3NDE4MjMgPT09IHQgPyBlID09PSBHcyA/IHpzKysgOiAoenMgPSAwLCBHcyA9IGUpIDogenMgPSAwLCAnZnVuY3Rpb24nID09PSB0eXBlb2Ygd2MgJiYgd2Mobi5zdGF0ZU5vZGUsIHIpLCBKcyhlKSwgcXMpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IHFzID0gITEsIGUgPSBGcywgRnMgPSBudWxsLCBlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAwICE9PSAoOCAmIFNzKSB8fCBXbygpLCBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaGMoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICg7IG51bGwgIT09IGpzOykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGpzLmVmZmVjdFRhZzsKICAgICAgICAgICAgICAgICAgICAgICAgMCAhPT0gKDI1NiAmIGUpICYmIG5zKGpzLmFsdGVybmF0ZSwganMpLCAwID09PSAoNTEyICYgZSkgfHwgTXMgfHwgKE1zID0gITAsIEdvKDk3LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWMoKSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBqcyA9IGpzLm5leHRFZmZlY3Q7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbWMoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDkwICE9PSBWcykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IDk3IDwgVnMgPyA5NyA6IFZzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVnMgPSA5MCwgem8oZSwgZ2MpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGdjKCkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBVcykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gVXM7CiAgICAgICAgICAgICAgICAgICAgaWYgKFVzID0gbnVsbCwgMCAhPT0gKDQ4ICYgU3MpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDMzMSkpOwogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gU3M7CiAgICAgICAgICAgICAgICAgICAgZm9yIChTcyB8PSAzMiwgZSA9IGUuY3VycmVudC5maXJzdEVmZmVjdDsgbnVsbCAhPT0gZTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwICE9PSAoNTEyICYgbi5lZmZlY3RUYWcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobi50YWcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJzKDUsIG4pLCBvcyg1LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzMwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5YyhlLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBuID0gZS5uZXh0RWZmZWN0LCBlLm5leHRFZmZlY3QgPSBudWxsLCBlID0gbjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNzID0gdCwgV28oKSwgITA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2YyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdWkoZSwgdCA9IGhzKGUsIHQgPSBYYShuLCB0KSwgMTA3Mzc0MTgyMykpLCBudWxsICE9PSAoZSA9IFFzKGUsIDEwNzM3NDE4MjMpKSAmJiBKcyhlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHljKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMyA9PT0gZS50YWcpCiAgICAgICAgICAgICAgICAgICAgICAgIHZjKGUsIGUsIHQpOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IGUucmV0dXJuOyBudWxsICE9PSBuOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDMgPT09IG4udGFnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmMobiwgZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PT0gbi50YWcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4uc3RhdGVOb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09PSB0eXBlb2Ygbi50eXBlLmdldERlcml2ZWRTdGF0ZUZyb21FcnJvciB8fCAnZnVuY3Rpb24nID09PSB0eXBlb2Ygci5jb21wb25lbnREaWRDYXRjaCAmJiAobnVsbCA9PT0gRHMgfHwgIURzLmhhcyhyKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWkobiwgZSA9IG1zKG4sIGUgPSBYYSh0LCBlKSwgMTA3Mzc0MTgyMykpLCBudWxsICE9PSAobiA9IFFzKG4sIDEwNzM3NDE4MjMpKSAmJiBKcyhuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG4ucmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBiYyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLnBpbmdDYWNoZTsKICAgICAgICAgICAgICAgICAgICBudWxsICE9PSByICYmIHIuZGVsZXRlKHQpLCBDcyA9PT0gZSAmJiBUcyA9PT0gbiA/IF9zID09PSB4cyB8fCBfcyA9PT0gd3MgJiYgMTA3Mzc0MTgyMyA9PT0gT3MgJiYgVW8oKSAtIE5zIDwgNTAwID8gbmMoZSwgVHMpIDogUnMgPSAhMCA6IEFjKGUsIG4pICYmICgwICE9PSAodCA9IGUubGFzdFBpbmdlZFRpbWUpICYmIHQgPCBuIHx8IChlLmxhc3RQaW5nZWRUaW1lID0gbiwgSnMoZSkpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVjKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuc3RhdGVOb2RlOwogICAgICAgICAgICAgICAgICAgIG51bGwgIT09IG4gJiYgbi5kZWxldGUodCksIDAgPT09ICh0ID0gMCkgJiYgKHQgPSAkcyh0ID0gV3MoKSwgZSwgbnVsbCkpLCBudWxsICE9PSAoZSA9IFFzKGUsIHQpKSAmJiBKcyhlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGdzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQuZXhwaXJhdGlvblRpbWU7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0LnBlbmRpbmdQcm9wczsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUubWVtb2l6ZWRQcm9wcyAhPT0gbyB8fCBwby5jdXJyZW50KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgSWEgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociA8IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKElhID0gITEsIHQudGFnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYSh0KSwgUGEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoTmkodCksIDQgJiB0Lm1vZGUgJiYgMSAhPT0gbiAmJiBvLmhpZGRlbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmV4cGlyYXRpb25UaW1lID0gdC5jaGlsZEV4cGlyYXRpb25UaW1lID0gMSwgbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnbyh0LnR5cGUpICYmIEVvKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFpKHQsIHQuc3RhdGVOb2RlLmNvbnRhaW5lckluZm8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDEwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gdC5tZW1vaXplZFByb3BzLnZhbHVlLCBvID0gdC50eXBlLl9jb250ZXh0LCB1byhLbywgby5fY3VycmVudFZhbHVlKSwgby5fY3VycmVudFZhbHVlID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHQubWVtb2l6ZWRTdGF0ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwICE9PSAociA9IHQuY2hpbGQuY2hpbGRFeHBpcmF0aW9uVGltZSkgJiYgciA+PSBuID8gR2EoZSwgdCwgbikgOiAodW8ocWksIDEgJiBxaS5jdXJyZW50KSwgbnVsbCAhPT0gKHQgPSBZYShlLCB0LCBuKSkgPyB0LnNpYmxpbmcgOiBudWxsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW8ocWksIDEgJiBxaS5jdXJyZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPSB0LmNoaWxkRXhwaXJhdGlvblRpbWUgPj0gbiwgMCAhPT0gKDY0ICYgZS5lZmZlY3RUYWcpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGEoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmVmZmVjdFRhZyB8PSA2NDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gKG8gPSB0Lm1lbW9pemVkU3RhdGUpICYmIChvLnJlbmRlcmluZyA9IG51bGwsIG8udGFpbCA9IG51bGwpLCB1byhxaSwgcWkuY3VycmVudCksICFyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBZYShlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIElhID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgSWEgPSAhMTsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHQuZXhwaXJhdGlvblRpbWUgPSAwLCB0LnRhZykgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPSB0LnR5cGUsIG51bGwgIT09IGUgJiYgKGUuYWx0ZXJuYXRlID0gbnVsbCwgdC5hbHRlcm5hdGUgPSBudWxsLCB0LmVmZmVjdFRhZyB8PSAyKSwgZSA9IHQucGVuZGluZ1Byb3BzLCBvID0gbW8odCwgZm8uY3VycmVudCksIHJpKHQsIG4pLCBvID0gWWkobnVsbCwgdCwgciwgZSwgbywgbiksIHQuZWZmZWN0VGFnIHw9IDEsICdvYmplY3QnID09PSB0eXBlb2YgbyAmJiBudWxsICE9PSBvICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiBvLnJlbmRlciAmJiB2b2lkIDAgPT09IG8uJCR0eXBlb2YpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LnRhZyA9IDEsIHQubWVtb2l6ZWRTdGF0ZSA9IG51bGwsIHQudXBkYXRlUXVldWUgPSBudWxsLCBnbyhyKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRW8odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1lbW9pemVkU3RhdGUgPSBudWxsICE9PSBvLnN0YXRlICYmIHZvaWQgMCAhPT0gby5zdGF0ZSA/IG8uc3RhdGUgOiBudWxsLCBhaSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gci5nZXREZXJpdmVkU3RhdGVGcm9tUHJvcHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09PSB0eXBlb2YgcyAmJiBtaSh0LCByLCBzLCBlKSwgby51cGRhdGVyID0gZ2ksIHQuc3RhdGVOb2RlID0gbywgby5fcmVhY3RJbnRlcm5hbEZpYmVyID0gdCwgRWkodCwgciwgZSwgbiksIHQgPSBEYShudWxsLCB0LCByLCAhMCwgaSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC50YWcgPSAwLCBMYShudWxsLCB0LCBvLCBuKSwgdCA9IHQuY2hpbGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTY6CiAgICAgICAgICAgICAgICAgICAgICAgIGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvID0gdC5lbGVtZW50VHlwZSwgbnVsbCAhPT0gZSAmJiAoZS5hbHRlcm5hdGUgPSBudWxsLCB0LmFsdGVybmF0ZSA9IG51bGwsIHQuZWZmZWN0VGFnIHw9IDIpLCBlID0gdC5wZW5kaW5nUHJvcHMsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtMSA9PT0gZS5fc3RhdHVzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9zdGF0dXMgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLl9jdG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQoKSwgZS5fcmVzdWx0ID0gdCwgdC50aGVuKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCA9PT0gZS5fc3RhdHVzICYmICh0ID0gdC5kZWZhdWx0LCBlLl9zdGF0dXMgPSAxLCBlLl9yZXN1bHQgPSB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCA9PT0gZS5fc3RhdHVzICYmIChlLl9zdGF0dXMgPSAyLCBlLl9yZXN1bHQgPSB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShvKSwgMSAhPT0gby5fc3RhdHVzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG8uX3Jlc3VsdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobyA9IG8uX3Jlc3VsdCwgdC50eXBlID0gbywgaSA9IHQudGFnID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGtjKGUpID8gMSA6IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IGUgJiYgbnVsbCAhPT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChlID0gZS4kJHR5cGVvZikgPT09IGNlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSBmZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShvKSwgZSA9IFFvKG8sIGUpLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHFhKG51bGwsIHQsIG8sIGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IEZhKG51bGwsIHQsIG8sIGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDExOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBBYShudWxsLCB0LCBvLCBlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gUmEobnVsbCwgdCwgbywgUW8oby50eXBlLCBlKSwgciwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMzA2LCBvLCAnJykpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSB0LnR5cGUsIG8gPSB0LnBlbmRpbmdQcm9wcywgcWEoZSwgdCwgciwgbyA9IHQuZWxlbWVudFR5cGUgPT09IHIgPyBvIDogUW8ociwgbyksIG4pOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSB0LnR5cGUsIG8gPSB0LnBlbmRpbmdQcm9wcywgRmEoZSwgdCwgciwgbyA9IHQuZWxlbWVudFR5cGUgPT09IHIgPyBvIDogUW8ociwgbyksIG4pOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE1hKHQpLCByID0gdC51cGRhdGVRdWV1ZSwgbnVsbCA9PT0gZSB8fCBudWxsID09PSByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgyODIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPSB0LnBlbmRpbmdQcm9wcywgbyA9IG51bGwgIT09IChvID0gdC5tZW1vaXplZFN0YXRlKSA/IG8uZWxlbWVudCA6IG51bGwsIHNpKGUsIHQpLCBmaSh0LCByLCBudWxsLCBuKSwgKHIgPSB0Lm1lbW9pemVkU3RhdGUuZWxlbWVudCkgPT09IG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYSgpLCB0ID0gWWEoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChvID0gdC5zdGF0ZU5vZGUuaHlkcmF0ZSkgJiYgKHdhID0gd24odC5zdGF0ZU5vZGUuY29udGFpbmVySW5mby5maXJzdENoaWxkKSwgRWEgPSB0LCBvID0geGEgPSAhMCksIG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gVGkodCwgbnVsbCwgciwgbiksIHQuY2hpbGQgPSBuOyBuOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5lZmZlY3RUYWcgPSAtMyAmIG4uZWZmZWN0VGFnIHwgMTAyNCwgbiA9IG4uc2libGluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMYShlLCB0LCByLCBuKSwgUGEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0LmNoaWxkOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5pKHQpLCBudWxsID09PSBlICYmIGthKHQpLCByID0gdC50eXBlLCBvID0gdC5wZW5kaW5nUHJvcHMsIGkgPSBudWxsICE9PSBlID8gZS5tZW1vaXplZFByb3BzIDogbnVsbCwgcyA9IG8uY2hpbGRyZW4sIHluKHIsIG8pID8gcyA9IG51bGwgOiBudWxsICE9PSBpICYmIHluKHIsIGkpICYmICh0LmVmZmVjdFRhZyB8PSAxNiksIGphKGUsIHQpLCA0ICYgdC5tb2RlICYmIDEgIT09IG4gJiYgby5oaWRkZW4gPyAodC5leHBpcmF0aW9uVGltZSA9IHQuY2hpbGRFeHBpcmF0aW9uVGltZSA9IDEsIHQgPSBudWxsKSA6IChMYShlLCB0LCBzLCBuKSwgdCA9IHQuY2hpbGQpLCB0OwogICAgICAgICAgICAgICAgICAgIGNhc2UgNjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT09IGUgJiYga2EodCksIG51bGw7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxMzoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEdhKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFpKHQsIHQuc3RhdGVOb2RlLmNvbnRhaW5lckluZm8pLCByID0gdC5wZW5kaW5nUHJvcHMsIG51bGwgPT09IGUgPyB0LmNoaWxkID0ga2kodCwgbnVsbCwgciwgbikgOiBMYShlLCB0LCByLCBuKSwgdC5jaGlsZDsKICAgICAgICAgICAgICAgICAgICBjYXNlIDExOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciA9IHQudHlwZSwgbyA9IHQucGVuZGluZ1Byb3BzLCBBYShlLCB0LCByLCBvID0gdC5lbGVtZW50VHlwZSA9PT0gciA/IG8gOiBRbyhyLCBvKSwgbik7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTGEoZSwgdCwgdC5wZW5kaW5nUHJvcHMsIG4pLCB0LmNoaWxkOwogICAgICAgICAgICAgICAgICAgIGNhc2UgODoKICAgICAgICAgICAgICAgICAgICBjYXNlIDEyOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTGEoZSwgdCwgdC5wZW5kaW5nUHJvcHMuY2hpbGRyZW4sIG4pLCB0LmNoaWxkOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTA6CiAgICAgICAgICAgICAgICAgICAgICAgIGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSB0LnR5cGUuX2NvbnRleHQsIG8gPSB0LnBlbmRpbmdQcm9wcywgcyA9IHQubWVtb2l6ZWRQcm9wcywgaSA9IG8udmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHQudHlwZS5fY29udGV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1byhLbywgYy5fY3VycmVudFZhbHVlKSwgYy5fY3VycmVudFZhbHVlID0gaSwgbnVsbCAhPT0gcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IHMudmFsdWUsIDAgPT09IChpID0gRnIoYywgaSkgPyAwIDogMCB8ICgnZnVuY3Rpb24nID09PSB0eXBlb2Ygci5fY2FsY3VsYXRlQ2hhbmdlZEJpdHMgPyByLl9jYWxjdWxhdGVDaGFuZ2VkQml0cyhjLCBpKSA6IDEwNzM3NDE4MjMpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocy5jaGlsZHJlbiA9PT0gby5jaGlsZHJlbiAmJiAhcG8uY3VycmVudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IFlhKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG51bGwgIT09IChjID0gdC5jaGlsZCkgJiYgKGMucmV0dXJuID0gdCk7IG51bGwgIT09IGM7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IGMuZGVwZW5kZW5jaWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gYy5jaGlsZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBsID0gdS5maXJzdENvbnRleHQ7IG51bGwgIT09IGw7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsLmNvbnRleHQgPT09IHIgJiYgMCAhPT0gKGwub2JzZXJ2ZWRCaXRzICYgaSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEgPT09IGMudGFnICYmICgobCA9IGNpKG4sIG51bGwpKS50YWcgPSAyLCB1aShjLCBsKSksIGMuZXhwaXJhdGlvblRpbWUgPCBuICYmIChjLmV4cGlyYXRpb25UaW1lID0gbiksIG51bGwgIT09IChsID0gYy5hbHRlcm5hdGUpICYmIGwuZXhwaXJhdGlvblRpbWUgPCBuICYmIChsLmV4cGlyYXRpb25UaW1lID0gbiksIG5pKGMucmV0dXJuLCBuKSwgdS5leHBpcmF0aW9uVGltZSA8IG4gJiYgKHUuZXhwaXJhdGlvblRpbWUgPSBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBsLm5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IDEwID09PSBjLnRhZyAmJiBjLnR5cGUgPT09IHQudHlwZSA/IG51bGwgOiBjLmNoaWxkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5yZXR1cm4gPSBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocyA9IGM7IG51bGwgIT09IHM7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzID09PSB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSAoYyA9IHMuc2libGluZykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMucmV0dXJuID0gcy5yZXR1cm4sIHMgPSBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IHMucmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBMYShlLCB0LCBvLmNoaWxkcmVuLCBuKSwgdCA9IHQuY2hpbGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgY2FzZSA5OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyA9IHQudHlwZSwgciA9IChpID0gdC5wZW5kaW5nUHJvcHMpLmNoaWxkcmVuLCByaSh0LCBuKSwgciA9IHIobyA9IG9pKG8sIGkudW5zdGFibGVfb2JzZXJ2ZWRCaXRzKSksIHQuZWZmZWN0VGFnIHw9IDEsIExhKGUsIHQsIHIsIG4pLCB0LmNoaWxkOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTQ6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID0gUW8obyA9IHQudHlwZSwgdC5wZW5kaW5nUHJvcHMpLCBSYShlLCB0LCBvLCBpID0gUW8oby50eXBlLCBpKSwgciwgbik7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAxNToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5hKGUsIHQsIHQudHlwZSwgdC5wZW5kaW5nUHJvcHMsIHIsIG4pOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMTc6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByID0gdC50eXBlLCBvID0gdC5wZW5kaW5nUHJvcHMsIG8gPSB0LmVsZW1lbnRUeXBlID09PSByID8gbyA6IFFvKHIsIG8pLCBudWxsICE9PSBlICYmIChlLmFsdGVybmF0ZSA9IG51bGwsIHQuYWx0ZXJuYXRlID0gbnVsbCwgdC5lZmZlY3RUYWcgfD0gMiksIHQudGFnID0gMSwgZ28ocikgPyAoZSA9ICEwLCBFbyh0KSkgOiBlID0gITEsIHJpKHQsIG4pLCB5aSh0LCByLCBvKSwgRWkodCwgciwgbywgbiksIERhKG51bGwsIHQsIHIsICEwLCBlLCBuKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE5OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGEoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMTU2LCB0LnRhZykpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHZhciB3YyA9IG51bGwsIHhjID0gbnVsbDsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNjKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLnRhZyA9IGUsIHRoaXMua2V5ID0gbiwgdGhpcy5zaWJsaW5nID0gdGhpcy5jaGlsZCA9IHRoaXMucmV0dXJuID0gdGhpcy5zdGF0ZU5vZGUgPSB0aGlzLnR5cGUgPSB0aGlzLmVsZW1lbnRUeXBlID0gbnVsbCwgdGhpcy5pbmRleCA9IDAsIHRoaXMucmVmID0gbnVsbCwgdGhpcy5wZW5kaW5nUHJvcHMgPSB0LCB0aGlzLmRlcGVuZGVuY2llcyA9IHRoaXMubWVtb2l6ZWRTdGF0ZSA9IHRoaXMudXBkYXRlUXVldWUgPSB0aGlzLm1lbW9pemVkUHJvcHMgPSBudWxsLCB0aGlzLm1vZGUgPSByLCB0aGlzLmVmZmVjdFRhZyA9IDAsIHRoaXMubGFzdEVmZmVjdCA9IHRoaXMuZmlyc3RFZmZlY3QgPSB0aGlzLm5leHRFZmZlY3QgPSBudWxsLCB0aGlzLmNoaWxkRXhwaXJhdGlvblRpbWUgPSB0aGlzLmV4cGlyYXRpb25UaW1lID0gMCwgdGhpcy5hbHRlcm5hdGUgPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQ2MoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgU2MoZSwgdCwgbiwgcik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBrYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIShlID0gZS5wcm90b3R5cGUpIHx8ICFlLmlzUmVhY3RDb21wb25lbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gVGMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5hbHRlcm5hdGU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT09IG4gPyAoKG4gPSBDYyhlLnRhZywgdCwgZS5rZXksIGUubW9kZSkpLmVsZW1lbnRUeXBlID0gZS5lbGVtZW50VHlwZSwgbi50eXBlID0gZS50eXBlLCBuLnN0YXRlTm9kZSA9IGUuc3RhdGVOb2RlLCBuLmFsdGVybmF0ZSA9IGUsIGUuYWx0ZXJuYXRlID0gbikgOiAobi5wZW5kaW5nUHJvcHMgPSB0LCBuLmVmZmVjdFRhZyA9IDAsIG4ubmV4dEVmZmVjdCA9IG51bGwsIG4uZmlyc3RFZmZlY3QgPSBudWxsLCBuLmxhc3RFZmZlY3QgPSBudWxsKSwgbi5jaGlsZEV4cGlyYXRpb25UaW1lID0gZS5jaGlsZEV4cGlyYXRpb25UaW1lLCBuLmV4cGlyYXRpb25UaW1lID0gZS5leHBpcmF0aW9uVGltZSwgbi5jaGlsZCA9IGUuY2hpbGQsIG4ubWVtb2l6ZWRQcm9wcyA9IGUubWVtb2l6ZWRQcm9wcywgbi5tZW1vaXplZFN0YXRlID0gZS5tZW1vaXplZFN0YXRlLCBuLnVwZGF0ZVF1ZXVlID0gZS51cGRhdGVRdWV1ZSwgdCA9IGUuZGVwZW5kZW5jaWVzLCBuLmRlcGVuZGVuY2llcyA9IG51bGwgPT09IHQgPyBudWxsIDogewogICAgICAgICAgICAgICAgICAgICAgICBleHBpcmF0aW9uVGltZTogdC5leHBpcmF0aW9uVGltZSwKICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3RDb250ZXh0OiB0LmZpcnN0Q29udGV4dCwKICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uZGVyczogdC5yZXNwb25kZXJzCiAgICAgICAgICAgICAgICAgICAgfSwgbi5zaWJsaW5nID0gZS5zaWJsaW5nLCBuLmluZGV4ID0gZS5pbmRleCwgbi5yZWYgPSBlLnJlZiwgbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9jKGUsIHQsIG4sIHIsIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IDI7CiAgICAgICAgICAgICAgICAgICAgaWYgKHIgPSBlLCAnZnVuY3Rpb24nID09PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAga2MoZSkgJiYgKHMgPSAxKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgnc3RyaW5nJyA9PT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHMgPSA1OwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBuZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUGMobi5jaGlsZHJlbiwgbywgaSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHNlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSA4LCBvIHw9IDc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHJlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSA4LCBvIHw9IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG9lOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IENjKDEyLCBuLCB0LCA4IHwgbykpLmVsZW1lbnRUeXBlID0gb2UsIGUudHlwZSA9IG9lLCBlLmV4cGlyYXRpb25UaW1lID0gaSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgdWU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gQ2MoMTMsIG4sIHQsIG8pKS50eXBlID0gdWUsIGUuZWxlbWVudFR5cGUgPSB1ZSwgZS5leHBpcmF0aW9uVGltZSA9IGksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGxlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IENjKDE5LCBuLCB0LCBvKSkuZWxlbWVudFR5cGUgPSBsZSwgZS5leHBpcmF0aW9uVGltZSA9IGksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gdHlwZW9mIGUgJiYgbnVsbCAhPT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLiQkdHlwZW9mKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgaWU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gMTA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGFlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IDk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGNlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IDExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBmZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSAxNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgcGU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gMTYsIHIgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBkZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSAyMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDEzMCwgbnVsbCA9PSBlID8gZSA6IHR5cGVvZiBlLCAnJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAodCA9IENjKHMsIG4sIHQsIG8pKS5lbGVtZW50VHlwZSA9IGUsIHQudHlwZSA9IHIsIHQuZXhwaXJhdGlvblRpbWUgPSBpLCB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUGMoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IENjKDcsIGUsIHIsIHQpKS5leHBpcmF0aW9uVGltZSA9IG4sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBPYyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gQ2MoNiwgZSwgbnVsbCwgdCkpLmV4cGlyYXRpb25UaW1lID0gbiwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEljKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHQgPSBDYyg0LCBudWxsICE9PSBlLmNoaWxkcmVuID8gZS5jaGlsZHJlbiA6IFtdLCBlLmtleSwgdCkpLmV4cGlyYXRpb25UaW1lID0gbiwgdC5zdGF0ZU5vZGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRhaW5lckluZm86IGUuY29udGFpbmVySW5mbywKICAgICAgICAgICAgICAgICAgICAgICAgcGVuZGluZ0NoaWxkcmVuOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBpbXBsZW1lbnRhdGlvbjogZS5pbXBsZW1lbnRhdGlvbgogICAgICAgICAgICAgICAgICAgIH0sIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMYyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy50YWcgPSB0LCB0aGlzLmN1cnJlbnQgPSBudWxsLCB0aGlzLmNvbnRhaW5lckluZm8gPSBlLCB0aGlzLnBpbmdDYWNoZSA9IHRoaXMucGVuZGluZ0NoaWxkcmVuID0gbnVsbCwgdGhpcy5maW5pc2hlZEV4cGlyYXRpb25UaW1lID0gMCwgdGhpcy5maW5pc2hlZFdvcmsgPSBudWxsLCB0aGlzLnRpbWVvdXRIYW5kbGUgPSAtMSwgdGhpcy5wZW5kaW5nQ29udGV4dCA9IHRoaXMuY29udGV4dCA9IG51bGwsIHRoaXMuaHlkcmF0ZSA9IG4sIHRoaXMuY2FsbGJhY2tOb2RlID0gbnVsbCwgdGhpcy5jYWxsYmFja1ByaW9yaXR5ID0gOTAsIHRoaXMubGFzdEV4cGlyZWRUaW1lID0gdGhpcy5sYXN0UGluZ2VkVGltZSA9IHRoaXMubmV4dEtub3duUGVuZGluZ0xldmVsID0gdGhpcy5sYXN0U3VzcGVuZGVkVGltZSA9IHRoaXMuZmlyc3RTdXNwZW5kZWRUaW1lID0gdGhpcy5maXJzdFBlbmRpbmdUaW1lID0gMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEFjKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuZmlyc3RTdXNwZW5kZWRUaW1lOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gZS5sYXN0U3VzcGVuZGVkVGltZSwgMCAhPT0gbiAmJiBuID49IHQgJiYgZSA8PSB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUmMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5maXJzdFN1c3BlbmRlZFRpbWUsIHIgPSBlLmxhc3RTdXNwZW5kZWRUaW1lOwogICAgICAgICAgICAgICAgICAgIG4gPCB0ICYmIChlLmZpcnN0U3VzcGVuZGVkVGltZSA9IHQpLCAociA+IHQgfHwgMCA9PT0gbikgJiYgKGUubGFzdFN1c3BlbmRlZFRpbWUgPSB0KSwgdCA8PSBlLmxhc3RQaW5nZWRUaW1lICYmIChlLmxhc3RQaW5nZWRUaW1lID0gMCksIHQgPD0gZS5sYXN0RXhwaXJlZFRpbWUgJiYgKGUubGFzdEV4cGlyZWRUaW1lID0gMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBOYyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdCA+IGUuZmlyc3RQZW5kaW5nVGltZSAmJiAoZS5maXJzdFBlbmRpbmdUaW1lID0gdCk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmZpcnN0U3VzcGVuZGVkVGltZTsKICAgICAgICAgICAgICAgICAgICAwICE9PSBuICYmICh0ID49IG4gPyBlLmZpcnN0U3VzcGVuZGVkVGltZSA9IGUubGFzdFN1c3BlbmRlZFRpbWUgPSBlLm5leHRLbm93blBlbmRpbmdMZXZlbCA9IDAgOiB0ID49IGUubGFzdFN1c3BlbmRlZFRpbWUgJiYgKGUubGFzdFN1c3BlbmRlZFRpbWUgPSB0ICsgMSksIHQgPiBlLm5leHRLbm93blBlbmRpbmdMZXZlbCAmJiAoZS5uZXh0S25vd25QZW5kaW5nTGV2ZWwgPSB0KSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBqYyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmxhc3RFeHBpcmVkVGltZTsKICAgICAgICAgICAgICAgICAgICAoMCA9PT0gbiB8fCBuID4gdCkgJiYgKGUubGFzdEV4cGlyZWRUaW1lID0gdCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBxYyhlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0LmN1cnJlbnQsIGkgPSBXcygpLCBzID0gZGkuc3VzcGVuc2U7CiAgICAgICAgICAgICAgICAgICAgaSA9ICRzKGksIG8sIHMpOwogICAgICAgICAgICAgICAgICAgIGU6CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFplKG4gPSBuLl9yZWFjdEludGVybmFsRmliZXIpICE9PSBuIHx8IDEgIT09IG4udGFnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE3MCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYy50YWcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMuc3RhdGVOb2RlLmNvbnRleHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZ28oYy50eXBlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBjLnN0YXRlTm9kZS5fX3JlYWN0SW50ZXJuYWxNZW1vaXplZE1lcmdlZENoaWxkQ29udGV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBjLnJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlIChudWxsICE9PSBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDE3MSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT09IG4udGFnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBuLnR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGdvKHUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBibyhuLCB1LCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbG87CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT09IHQuY29udGV4dCA/IHQuY29udGV4dCA9IG4gOiB0LnBlbmRpbmdDb250ZXh0ID0gbiwgKHQgPSBjaShpLCBzKSkucGF5bG9hZCA9IHsgZWxlbWVudDogZSB9LCBudWxsICE9PSAociA9IHZvaWQgMCA9PT0gciA/IG51bGwgOiByKSAmJiAodC5jYWxsYmFjayA9IHIpLCB1aShvLCB0KSwgWXMobywgaSksIGk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBGYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCEoZSA9IGUuY3VycmVudCkuY2hpbGQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5jaGlsZC50YWcpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY2hpbGQuc3RhdGVOb2RlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIERjKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBudWxsICE9PSAoZSA9IGUubWVtb2l6ZWRTdGF0ZSkgJiYgbnVsbCAhPT0gZS5kZWh5ZHJhdGVkICYmIGUucmV0cnlUaW1lIDwgdCAmJiAoZS5yZXRyeVRpbWUgPSB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE1jKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBEYyhlLCB0KSwgKGUgPSBlLmFsdGVybmF0ZSkgJiYgRGMoZSwgdCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBVYyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuZXcgTGMoZSwgdCwgbiA9IG51bGwgIT0gbiAmJiAhMCA9PT0gbi5oeWRyYXRlKSwgbyA9IENjKDMsIG51bGwsIG51bGwsIDIgPT09IHQgPyA3IDogMSA9PT0gdCA/IDMgOiAwKTsKICAgICAgICAgICAgICAgICAgICByLmN1cnJlbnQgPSBvLCBvLnN0YXRlTm9kZSA9IHIsIGFpKG8pLCBlW1RuXSA9IHIuY3VycmVudCwgbiAmJiAwICE9PSB0ICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gWGUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIFR0LmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGh0KGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgX3QuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaHQoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0oMCwgOSA9PT0gZS5ub2RlVHlwZSA/IGUgOiBlLm93bmVyRG9jdW1lbnQpLCB0aGlzLl9pbnRlcm5hbFJvb3QgPSByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gVmMoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFlIHx8IDEgIT09IGUubm9kZVR5cGUgJiYgOSAhPT0gZS5ub2RlVHlwZSAmJiAxMSAhPT0gZS5ub2RlVHlwZSAmJiAoOCAhPT0gZS5ub2RlVHlwZSB8fCAnIHJlYWN0LW1vdW50LXBvaW50LXVuc3RhYmxlICcgIT09IGUubm9kZVZhbHVlKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBCYyhlLCB0LCBuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuLl9yZWFjdFJvb3RDb250YWluZXI7CiAgICAgICAgICAgICAgICAgICAgaWYgKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBpLl9pbnRlcm5hbFJvb3Q7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09PSB0eXBlb2YgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IEZjKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcWModCwgYSwgZSwgbyk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPSBuLl9yZWFjdFJvb3RDb250YWluZXIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0IHx8ICh0ID0gISghKHQgPSBlID8gOSA9PT0gZS5ub2RlVHlwZSA/IGUuZG9jdW1lbnRFbGVtZW50IDogZS5maXJzdENoaWxkIDogbnVsbCkgfHwgMSAhPT0gdC5ub2RlVHlwZSB8fCAhdC5oYXNBdHRyaWJ1dGUoJ2RhdGEtcmVhY3Ryb290JykpKSwgIXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG47IG4gPSBlLmxhc3RDaGlsZDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnJlbW92ZUNoaWxkKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgVWMoZSwgMCwgdCA/IHsgaHlkcmF0ZTogITAgfSA6IHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG4sIHIpLCBhID0gaS5faW50ZXJuYWxSb290LCAnZnVuY3Rpb24nID09PSB0eXBlb2YgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IEZjKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMuY2FsbChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdGMoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcWModCwgYSwgZSwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gRmMoYSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB6YyhlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAzIDwgYXJndW1lbnRzLmxlbmd0aCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1szXSA/IGFyZ3VtZW50c1szXSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgJCR0eXBlb2Y6IHRlLAogICAgICAgICAgICAgICAgICAgICAgICBrZXk6IG51bGwgPT0gciA/IG51bGwgOiAnJyArIHIsCiAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBjb250YWluZXJJbmZvOiB0LAogICAgICAgICAgICAgICAgICAgICAgICBpbXBsZW1lbnRhdGlvbjogbgogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBHYyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAyIDwgYXJndW1lbnRzLmxlbmd0aCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1syXSA/IGFyZ3VtZW50c1syXSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFWYyh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgyMDApKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gemMoZSwgdCwgbnVsbCwgbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBVYy5wcm90b3R5cGUucmVuZGVyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBxYyhlLCB0aGlzLl9pbnRlcm5hbFJvb3QsIG51bGwsIG51bGwpOwogICAgICAgICAgICAgICAgfSwgVWMucHJvdG90eXBlLnVubW91bnQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLl9pbnRlcm5hbFJvb3QsIHQgPSBlLmNvbnRhaW5lckluZm87CiAgICAgICAgICAgICAgICAgICAgcWMobnVsbCwgZSwgbnVsbCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0W1RuXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBtdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEzID09PSBlLnRhZykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFlvKFdzKCksIDE1MCwgMTAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgWXMoZSwgdCksIE1jKGUsIHQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGd0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAxMyA9PT0gZS50YWcgJiYgKFlzKGUsIDMpLCBNYyhlLCAzKSk7CiAgICAgICAgICAgICAgICB9LCB2dCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEzID09PSBlLnRhZykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFdzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIFlzKGUsIHQgPSAkcyh0LCBlLCBudWxsKSksIE1jKGUsIHQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIFAgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgJ2lucHV0JzoKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGtlKGUsIG4pLCB0ID0gbi5uYW1lLCAncmFkaW8nID09PSBuLnR5cGUgJiYgbnVsbCAhPSB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSBlOyBuLnBhcmVudE5vZGU7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBuLnBhcmVudE5vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSBuLnF1ZXJ5U2VsZWN0b3JBbGwoJ2lucHV0W25hbWU9JyArIEpTT04uc3RyaW5naWZ5KCcnICsgdCkgKyAnXVt0eXBlPSJyYWRpbyJdJyksIHQgPSAwOyB0IDwgbi5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gblt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociAhPT0gZSAmJiByLmZvcm0gPT09IGUuZm9ybSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IEluKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDkwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlKHIpLCBrZShyLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAndGV4dGFyZWEnOgogICAgICAgICAgICAgICAgICAgICAgICBBZShlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnc2VsZWN0JzoKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSAodCA9IG4udmFsdWUpICYmIE9lKGUsICEhbi5tdWx0aXBsZSwgdCwgITEpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIE4gPSBlYywgaiA9IGZ1bmN0aW9uIChlLCB0LCBuLCByLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBTczsKICAgICAgICAgICAgICAgICAgICBTcyB8PSA0OwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6byg5OCwgZS5iaW5kKG51bGwsIHQsIG4sIHIsIG8pKTsKICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAwID09PSAoU3MgPSBpKSAmJiBXbygpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgMCA9PT0gKDQ5ICYgU3MpICYmIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBCcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBCczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJzID0gbnVsbCwgZS5mb3JFYWNoKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamModCwgZSksIEpzKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIFdvKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KCksIG1jKCkpOwogICAgICAgICAgICAgICAgfSwgRiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBTczsKICAgICAgICAgICAgICAgICAgICBTcyB8PSAyOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHQpOwogICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgIDAgPT09IChTcyA9IG4pICYmIFdvKCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHZhciBIYyA9IHsKICAgICAgICAgICAgICAgICAgICBFdmVudHM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgUG4sCiAgICAgICAgICAgICAgICAgICAgICAgIE9uLAogICAgICAgICAgICAgICAgICAgICAgICBJbiwKICAgICAgICAgICAgICAgICAgICAgICAgVCwKICAgICAgICAgICAgICAgICAgICAgICAgUywKICAgICAgICAgICAgICAgICAgICAgICAgRm4sCiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdChlLCBxbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIEEsCiAgICAgICAgICAgICAgICAgICAgICAgIFIsCiAgICAgICAgICAgICAgICAgICAgICAgIEp0LAogICAgICAgICAgICAgICAgICAgICAgICBzdCwKICAgICAgICAgICAgICAgICAgICAgICAgbWMsCiAgICAgICAgICAgICAgICAgICAgICAgIHsgY3VycmVudDogITEgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuZmluZEZpYmVyQnlIb3N0SW5zdGFuY2U7CiAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyA9PT0gdHlwZW9mIF9fUkVBQ1RfREVWVE9PTFNfR0xPQkFMX0hPT0tfXykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBfX1JFQUNUX0RFVlRPT0xTX0dMT0JBTF9IT09LX187CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmlzRGlzYWJsZWQgfHwgIXQuc3VwcG9ydHNGaWJlcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5pbmplY3QoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3YyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5vbkNvbW1pdEZpYmVyUm9vdChuLCBlLCB2b2lkIDAsIDY0ID09PSAoNjQgJiBlLmN1cnJlbnQuZWZmZWN0VGFnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHhjID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm9uQ29tbWl0RmliZXJVbm1vdW50KG4sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KG8oe30sIGUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcnJpZGVIb29rU3RhdGU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJyaWRlUHJvcHM6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldFN1c3BlbnNlSGFuZGxlcjogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgc2NoZWR1bGVVcGRhdGU6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnREaXNwYXRjaGVyUmVmOiBLLlJlYWN0Q3VycmVudERpc3BhdGNoZXIsCiAgICAgICAgICAgICAgICAgICAgICAgIGZpbmRIb3N0SW5zdGFuY2VCeUZpYmVyOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT09IChlID0gbnQoZSkpID8gbnVsbCA6IGUuc3RhdGVOb2RlOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBmaW5kRmliZXJCeUhvc3RJbnN0YW5jZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID8gdChlKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGZpbmRIb3N0SW5zdGFuY2VzRm9yUmVmcmVzaDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgc2NoZWR1bGVSZWZyZXNoOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBzY2hlZHVsZVJvb3Q6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHNldFJlZnJlc2hIYW5kbGVyOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICBnZXRDdXJyZW50RmliZXI6IG51bGwKICAgICAgICAgICAgICAgICAgICB9KSkpOwogICAgICAgICAgICAgICAgfSh7CiAgICAgICAgICAgICAgICAgICAgZmluZEZpYmVyQnlIb3N0SW5zdGFuY2U6IF9uLAogICAgICAgICAgICAgICAgICAgIGJ1bmRsZVR5cGU6IDAsCiAgICAgICAgICAgICAgICAgICAgdmVyc2lvbjogJzE2LjE0LjAnLAogICAgICAgICAgICAgICAgICAgIHJlbmRlcmVyUGFja2FnZU5hbWU6ICdyZWFjdC1kb20nCiAgICAgICAgICAgICAgICB9KSwgdC5fX1NFQ1JFVF9JTlRFUk5BTFNfRE9fTk9UX1VTRV9PUl9ZT1VfV0lMTF9CRV9GSVJFRCA9IEhjLCB0LmNyZWF0ZVBvcnRhbCA9IEdjLCB0LmZpbmRET01Ob2RlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PT0gZS5ub2RlVHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLl9yZWFjdEludGVybmFsRmliZXI7CiAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gdCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGUucmVuZGVyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgxODgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgyNjgsIE9iamVjdC5rZXlzKGUpKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gbnVsbCA9PT0gKGUgPSBudCh0KSkgPyBudWxsIDogZS5zdGF0ZU5vZGU7CiAgICAgICAgICAgICAgICB9LCB0LmZsdXNoU3luYyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgIT09ICg0OCAmIFNzKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgxODcpKTsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFNzOwogICAgICAgICAgICAgICAgICAgIFNzIHw9IDE7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHpvKDk5LCBlLmJpbmQobnVsbCwgdCkpOwogICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFNzID0gbiwgV28oKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCB0Lmh5ZHJhdGUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIGlmICghVmModCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoMjAwKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJjKG51bGwsIGUsIHQsICEwLCBuKTsKICAgICAgICAgICAgICAgIH0sIHQucmVuZGVyID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIVZjKHQpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDIwMCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBCYyhudWxsLCBlLCB0LCAhMSwgbik7CiAgICAgICAgICAgICAgICB9LCB0LnVubW91bnRDb21wb25lbnRBdE5vZGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghVmMoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGEoNDApKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlLl9yZWFjdFJvb3RDb250YWluZXIgJiYgKHRjKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgQmMobnVsbCwgbnVsbCwgZSwgITEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX3JlYWN0Um9vdENvbnRhaW5lciA9IG51bGwsIGVbVG5dID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSksICEwKTsKICAgICAgICAgICAgICAgIH0sIHQudW5zdGFibGVfYmF0Y2hlZFVwZGF0ZXMgPSBlYywgdC51bnN0YWJsZV9jcmVhdGVQb3J0YWwgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBHYyhlLCB0LCAyIDwgYXJndW1lbnRzLmxlbmd0aCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1syXSA/IGFyZ3VtZW50c1syXSA6IG51bGwpOwogICAgICAgICAgICAgICAgfSwgdC51bnN0YWJsZV9yZW5kZXJTdWJ0cmVlSW50b0NvbnRhaW5lciA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFWYyhuKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYSgyMDApKTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlIHx8IHZvaWQgMCA9PT0gZS5fcmVhY3RJbnRlcm5hbEZpYmVyKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihhKDM4KSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJjKGUsIHQsIG4sICExLCByKTsKICAgICAgICAgICAgICAgIH0sIHQudmVyc2lvbiA9ICcxNi4xNC4wJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IG4oMjYzKTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByLCBvLCBpLCBhLCBzOwogICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnID09PSB0eXBlb2Ygd2luZG93IHx8ICdmdW5jdGlvbicgIT09IHR5cGVvZiBNZXNzYWdlQ2hhbm5lbCkgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gbnVsbCwgdSA9IG51bGwsIGwgPSBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LnVuc3RhYmxlX25vdygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjKCEwLCBuKSwgYyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBzZXRUaW1lb3V0KGUsIDApLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgZiA9IERhdGUubm93KCk7CiAgICAgICAgICAgICAgICAgICAgdC51bnN0YWJsZV9ub3cgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBEYXRlLm5vdygpIC0gZjsKICAgICAgICAgICAgICAgICAgICB9LCByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gYyA/IHNldFRpbWVvdXQociwgMCwgZSkgOiAoYyA9IGUsIHNldFRpbWVvdXQobCwgMCkpOwogICAgICAgICAgICAgICAgICAgIH0sIG8gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB1ID0gc2V0VGltZW91dChlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9LCBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQodSk7CiAgICAgICAgICAgICAgICAgICAgfSwgYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIH0sIHMgPSB0LnVuc3RhYmxlX2ZvcmNlRnJhbWVSYXRlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHZhciBwID0gd2luZG93LnBlcmZvcm1hbmNlLCBkID0gd2luZG93LkRhdGUsIGggPSB3aW5kb3cuc2V0VGltZW91dCwgbSA9IHdpbmRvdy5jbGVhclRpbWVvdXQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9PSB0eXBlb2YgY29uc29sZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IHdpbmRvdy5jYW5jZWxBbmltYXRpb25GcmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIHdpbmRvdy5yZXF1ZXN0QW5pbWF0aW9uRnJhbWUgJiYgY29uc29sZS5lcnJvcignVGhpcyBicm93c2VyIGRvZXNuXCd0IHN1cHBvcnQgcmVxdWVzdEFuaW1hdGlvbkZyYW1lLiBNYWtlIHN1cmUgdGhhdCB5b3UgbG9hZCBhIHBvbHlmaWxsIGluIG9sZGVyIGJyb3dzZXJzLiBodHRwczovL2ZiLm1lL3JlYWN0LXBvbHlmaWxscycpLCAnZnVuY3Rpb24nICE9PSB0eXBlb2YgZyAmJiBjb25zb2xlLmVycm9yKCdUaGlzIGJyb3dzZXIgZG9lc25cJ3Qgc3VwcG9ydCBjYW5jZWxBbmltYXRpb25GcmFtZS4gTWFrZSBzdXJlIHRoYXQgeW91IGxvYWQgYSBwb2x5ZmlsbCBpbiBvbGRlciBicm93c2Vycy4gaHR0cHM6Ly9mYi5tZS9yZWFjdC1wb2x5ZmlsbHMnKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09PSB0eXBlb2YgcCAmJiAnZnVuY3Rpb24nID09PSB0eXBlb2YgcC5ub3cpCiAgICAgICAgICAgICAgICAgICAgICAgIHQudW5zdGFibGVfbm93ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAubm93KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB2ID0gZC5ub3coKTsKICAgICAgICAgICAgICAgICAgICAgICAgdC51bnN0YWJsZV9ub3cgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZC5ub3coKSAtIHY7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciB5ID0gITEsIGIgPSBudWxsLCBFID0gLTEsIHcgPSA1LCB4ID0gMDsKICAgICAgICAgICAgICAgICAgICBhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC51bnN0YWJsZV9ub3coKSA+PSB4OwogICAgICAgICAgICAgICAgICAgIH0sIHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfSwgdC51bnN0YWJsZV9mb3JjZUZyYW1lUmF0ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIDAgPiBlIHx8IDEyNSA8IGUgPyBjb25zb2xlLmVycm9yKCdmb3JjZUZyYW1lUmF0ZSB0YWtlcyBhIHBvc2l0aXZlIGludCBiZXR3ZWVuIDAgYW5kIDEyNSwgZm9yY2luZyBmcmFtZXJhdGVzIGhpZ2hlciB0aGFuIDEyNSBmcHMgaXMgbm90IHVuc3VwcG9ydGVkJykgOiB3ID0gMCA8IGUgPyBNYXRoLmZsb29yKDEwMDAgLyBlKSA6IDU7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB2YXIgUyA9IG5ldyBNZXNzYWdlQ2hhbm5lbCgpLCBDID0gUy5wb3J0MjsKICAgICAgICAgICAgICAgICAgICBTLnBvcnQxLm9ubWVzc2FnZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdC51bnN0YWJsZV9ub3coKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggPSBlICsgdzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYighMCwgZSkgPyBDLnBvc3RNZXNzYWdlKG51bGwpIDogKHkgPSAhMSwgYiA9IG51bGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEMucG9zdE1lc3NhZ2UobnVsbCksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgeSA9ICExOwogICAgICAgICAgICAgICAgICAgIH0sIHIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBiID0gZSwgeSB8fCAoeSA9ICEwLCBDLnBvc3RNZXNzYWdlKG51bGwpKTsKICAgICAgICAgICAgICAgICAgICB9LCBvID0gZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgRSA9IGgoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh0LnVuc3RhYmxlX25vdygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgbik7CiAgICAgICAgICAgICAgICAgICAgfSwgaSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbShFKSwgRSA9IC0xOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBrKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIGUucHVzaCh0KTsKICAgICAgICAgICAgICAgICAgICBlOgogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDs7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4gLSAxID4+PiAxLCBvID0gZVtyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKHZvaWQgMCAhPT0gbyAmJiAwIDwgUChvLCB0KSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbcl0gPSB0LCBlW25dID0gbywgbiA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFQoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IChlID0gZVswXSkgPyBudWxsIDogZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF8oZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVswXTsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5wb3AoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gIT09IHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbMF0gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gMCwgbyA9IGUubGVuZ3RoOyByIDwgbzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAyICogKHIgKyAxKSAtIDEsIGEgPSBlW2ldLCBzID0gaSArIDEsIGMgPSBlW3NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBhICYmIDAgPiBQKGEsIG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBjICYmIDAgPiBQKGMsIGEpID8gKGVbcl0gPSBjLCBlW3NdID0gbiwgciA9IHMpIDogKGVbcl0gPSBhLCBlW2ldID0gbiwgciA9IGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKHZvaWQgMCAhPT0gYyAmJiAwID4gUChjLCBuKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbcl0gPSBjLCBlW3NdID0gbiwgciA9IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLnNvcnRJbmRleCAtIHQuc29ydEluZGV4OwogICAgICAgICAgICAgICAgICAgIHJldHVybiAwICE9PSBuID8gbiA6IGUuaWQgLSB0LmlkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIE8gPSBbXSwgSSA9IFtdLCBMID0gMSwgQSA9IG51bGwsIFIgPSAzLCBOID0gITEsIGogPSAhMSwgcSA9ICExOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gRihlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IFQoSSk7IG51bGwgIT09IHQ7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09PSB0LmNhbGxiYWNrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXyhJKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoISh0LnN0YXJ0VGltZSA8PSBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8oSSksIHQuc29ydEluZGV4ID0gdC5leHBpcmF0aW9uVGltZSwgayhPLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB0ID0gVChJKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBEKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAocSA9ICExLCBGKGUpLCAhaikKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IFQoTykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqID0gITAsIHIoTSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBUKEkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gdCAmJiBvKEQsIHQuc3RhcnRUaW1lIC0gZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE0oZSwgbikgewogICAgICAgICAgICAgICAgICAgIGogPSAhMSwgcSAmJiAocSA9ICExLCBpKCkpLCBOID0gITA7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBSOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoRihuKSwgQSA9IFQoTyk7IG51bGwgIT09IEEgJiYgKCEoQS5leHBpcmF0aW9uVGltZSA+IG4pIHx8IGUgJiYgIWEoKSk7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IEEuY2FsbGJhY2s7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPT0gcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEuY2FsbGJhY2sgPSBudWxsLCBSID0gQS5wcmlvcml0eUxldmVsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gcyhBLmV4cGlyYXRpb25UaW1lIDw9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB0LnVuc3RhYmxlX25vdygpLCAnZnVuY3Rpb24nID09PSB0eXBlb2YgYyA/IEEuY2FsbGJhY2sgPSBjIDogQSA9PT0gVChPKSAmJiBfKE8pLCBGKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXyhPKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEEgPSBUKE8pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9PSBBKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IFQoSSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9PSBsICYmIG8oRCwgbC5zdGFydFRpbWUgLSBuKSwgdSA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1OwogICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEEgPSBudWxsLCBSID0gciwgTiA9ICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFUoZSkgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDI1MDsKICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxMDczNzQxODIzOwogICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDEwMDAwOwogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiA1MDAwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBWID0gczsKICAgICAgICAgICAgICAgIHQudW5zdGFibGVfSWRsZVByaW9yaXR5ID0gNSwgdC51bnN0YWJsZV9JbW1lZGlhdGVQcmlvcml0eSA9IDEsIHQudW5zdGFibGVfTG93UHJpb3JpdHkgPSA0LCB0LnVuc3RhYmxlX05vcm1hbFByaW9yaXR5ID0gMywgdC51bnN0YWJsZV9Qcm9maWxpbmcgPSBudWxsLCB0LnVuc3RhYmxlX1VzZXJCbG9ja2luZ1ByaW9yaXR5ID0gMiwgdC51bnN0YWJsZV9jYW5jZWxDYWxsYmFjayA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5jYWxsYmFjayA9IG51bGw7CiAgICAgICAgICAgICAgICB9LCB0LnVuc3RhYmxlX2NvbnRpbnVlRXhlY3V0aW9uID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGogfHwgTiB8fCAoaiA9ICEwLCByKE0pKTsKICAgICAgICAgICAgICAgIH0sIHQudW5zdGFibGVfZ2V0Q3VycmVudFByaW9yaXR5TGV2ZWwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFI7CiAgICAgICAgICAgICAgICB9LCB0LnVuc3RhYmxlX2dldEZpcnN0Q2FsbGJhY2tOb2RlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBUKE8pOwogICAgICAgICAgICAgICAgfSwgdC51bnN0YWJsZV9uZXh0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKFIpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAzOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICB0ID0gUjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBSOwogICAgICAgICAgICAgICAgICAgIFIgPSB0OwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKCk7CiAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgUiA9IG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdC51bnN0YWJsZV9wYXVzZUV4ZWN1dGlvbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH0sIHQudW5zdGFibGVfcmVxdWVzdFBhaW50ID0gViwgdC51bnN0YWJsZV9ydW5XaXRoUHJpb3JpdHkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSAzOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFI7CiAgICAgICAgICAgICAgICAgICAgUiA9IGU7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQoKTsKICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICBSID0gbjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCB0LnVuc3RhYmxlX3NjaGVkdWxlQ2FsbGJhY2sgPSBmdW5jdGlvbiAoZSwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBzID0gdC51bnN0YWJsZV9ub3coKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT09IHR5cGVvZiBhICYmIG51bGwgIT09IGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmRlbGF5OwogICAgICAgICAgICAgICAgICAgICAgICBjID0gJ251bWJlcicgPT09IHR5cGVvZiBjICYmIDAgPCBjID8gcyArIGMgOiBzLCBhID0gJ251bWJlcicgPT09IHR5cGVvZiBhLnRpbWVvdXQgPyBhLnRpbWVvdXQgOiBVKGUpOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBhID0gVShlKSwgYyA9IHM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBMKyssCiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBuLAogICAgICAgICAgICAgICAgICAgICAgICBwcmlvcml0eUxldmVsOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBzdGFydFRpbWU6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyYXRpb25UaW1lOiBhID0gYyArIGEsCiAgICAgICAgICAgICAgICAgICAgICAgIHNvcnRJbmRleDogLTEKICAgICAgICAgICAgICAgICAgICB9LCBjID4gcyA/IChlLnNvcnRJbmRleCA9IGMsIGsoSSwgZSksIG51bGwgPT09IFQoTykgJiYgZSA9PT0gVChJKSAmJiAocSA/IGkoKSA6IHEgPSAhMCwgbyhELCBjIC0gcykpKSA6IChlLnNvcnRJbmRleCA9IGEsIGsoTywgZSksIGogfHwgTiB8fCAoaiA9ICEwLCByKE0pKSksIGU7CiAgICAgICAgICAgICAgICB9LCB0LnVuc3RhYmxlX3Nob3VsZFlpZWxkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gdC51bnN0YWJsZV9ub3coKTsKICAgICAgICAgICAgICAgICAgICBGKGUpOwogICAgICAgICAgICAgICAgICAgIHZhciBuID0gVChPKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAhPT0gQSAmJiBudWxsICE9PSBBICYmIG51bGwgIT09IG4gJiYgbnVsbCAhPT0gbi5jYWxsYmFjayAmJiBuLnN0YXJ0VGltZSA8PSBlICYmIG4uZXhwaXJhdGlvblRpbWUgPCBBLmV4cGlyYXRpb25UaW1lIHx8IGEoKTsKICAgICAgICAgICAgICAgIH0sIHQudW5zdGFibGVfd3JhcENhbGxiYWNrID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBSOwogICAgICAgICAgICAgICAgICAgICAgICBSID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDI2NSk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKCkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaSgpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGkucmVzZXRXYXJuaW5nQ2FjaGUgPSBvLCBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZShlLCB0LCBuLCBvLCBpLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhICE9PSByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG5ldyBFcnJvcignQ2FsbGluZyBQcm9wVHlwZXMgdmFsaWRhdG9ycyBkaXJlY3RseSBpcyBub3Qgc3VwcG9ydGVkIGJ5IHRoZSBgcHJvcC10eXBlc2AgcGFja2FnZS4gVXNlIFByb3BUeXBlcy5jaGVja1Byb3BUeXBlcygpIHRvIGNhbGwgdGhlbS4gUmVhZCBtb3JlIGF0IGh0dHA6Ly9mYi5tZS91c2UtY2hlY2stcHJvcC10eXBlcycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgcy5uYW1lID0gJ0ludmFyaWFudCBWaW9sYXRpb24nLCBzOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBlLmlzUmVxdWlyZWQgPSBlOwogICAgICAgICAgICAgICAgICAgIHZhciBuID0gewogICAgICAgICAgICAgICAgICAgICAgICBhcnJheTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgYm9vbDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgZnVuYzogZSwKICAgICAgICAgICAgICAgICAgICAgICAgbnVtYmVyOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBvYmplY3Q6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZzogZSwKICAgICAgICAgICAgICAgICAgICAgICAgc3ltYm9sOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBhbnk6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGFycmF5T2Y6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnQ6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRUeXBlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBpbnN0YW5jZU9mOiB0LAogICAgICAgICAgICAgICAgICAgICAgICBub2RlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBvYmplY3RPZjogdCwKICAgICAgICAgICAgICAgICAgICAgICAgb25lT2Y6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgIG9uZU9mVHlwZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgc2hhcGU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgIGV4YWN0OiB0LAogICAgICAgICAgICAgICAgICAgICAgICBjaGVja1Byb3BUeXBlczogaSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXRXYXJuaW5nQ2FjaGU6IG8KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuLlByb3BUeXBlcyA9IG4sIG47CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gJ1NFQ1JFVF9ET19OT1RfUEFTU19USElTX09SX1lPVV9XSUxMX0JFX0ZJUkVEJzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIFN5bWJvbCAmJiBTeW1ib2wuZm9yLCBvID0gciA/IFN5bWJvbC5mb3IoJ3JlYWN0LmVsZW1lbnQnKSA6IDYwMTAzLCBpID0gciA/IFN5bWJvbC5mb3IoJ3JlYWN0LnBvcnRhbCcpIDogNjAxMDYsIGEgPSByID8gU3ltYm9sLmZvcigncmVhY3QuZnJhZ21lbnQnKSA6IDYwMTA3LCBzID0gciA/IFN5bWJvbC5mb3IoJ3JlYWN0LnN0cmljdF9tb2RlJykgOiA2MDEwOCwgYyA9IHIgPyBTeW1ib2wuZm9yKCdyZWFjdC5wcm9maWxlcicpIDogNjAxMTQsIHUgPSByID8gU3ltYm9sLmZvcigncmVhY3QucHJvdmlkZXInKSA6IDYwMTA5LCBsID0gciA/IFN5bWJvbC5mb3IoJ3JlYWN0LmNvbnRleHQnKSA6IDYwMTEwLCBmID0gciA/IFN5bWJvbC5mb3IoJ3JlYWN0LmFzeW5jX21vZGUnKSA6IDYwMTExLCBwID0gciA/IFN5bWJvbC5mb3IoJ3JlYWN0LmNvbmN1cnJlbnRfbW9kZScpIDogNjAxMTEsIGQgPSByID8gU3ltYm9sLmZvcigncmVhY3QuZm9yd2FyZF9yZWYnKSA6IDYwMTEyLCBoID0gciA/IFN5bWJvbC5mb3IoJ3JlYWN0LnN1c3BlbnNlJykgOiA2MDExMywgbSA9IHIgPyBTeW1ib2wuZm9yKCdyZWFjdC5zdXNwZW5zZV9saXN0JykgOiA2MDEyMCwgZyA9IHIgPyBTeW1ib2wuZm9yKCdyZWFjdC5tZW1vJykgOiA2MDExNSwgdiA9IHIgPyBTeW1ib2wuZm9yKCdyZWFjdC5sYXp5JykgOiA2MDExNiwgeSA9IHIgPyBTeW1ib2wuZm9yKCdyZWFjdC5ibG9jaycpIDogNjAxMjEsIGIgPSByID8gU3ltYm9sLmZvcigncmVhY3QuZnVuZGFtZW50YWwnKSA6IDYwMTE3LCBFID0gciA/IFN5bWJvbC5mb3IoJ3JlYWN0LnJlc3BvbmRlcicpIDogNjAxMTgsIHcgPSByID8gU3ltYm9sLmZvcigncmVhY3Quc2NvcGUnKSA6IDYwMTE5OwogICAgICAgICAgICAgICAgZnVuY3Rpb24geChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09PSB0eXBlb2YgZSAmJiBudWxsICE9PSBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS4kJHR5cGVvZjsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSA9IGUudHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBmOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBhOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBjOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBoOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUgPSBlICYmIGUuJCR0eXBlb2YpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGw6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBkOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgdjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgaToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gUyhlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHgoZSkgPT09IHA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0LkFzeW5jTW9kZSA9IGYsIHQuQ29uY3VycmVudE1vZGUgPSBwLCB0LkNvbnRleHRDb25zdW1lciA9IGwsIHQuQ29udGV4dFByb3ZpZGVyID0gdSwgdC5FbGVtZW50ID0gbywgdC5Gb3J3YXJkUmVmID0gZCwgdC5GcmFnbWVudCA9IGEsIHQuTGF6eSA9IHYsIHQuTWVtbyA9IGcsIHQuUG9ydGFsID0gaSwgdC5Qcm9maWxlciA9IGMsIHQuU3RyaWN0TW9kZSA9IHMsIHQuU3VzcGVuc2UgPSBoLCB0LmlzQXN5bmNNb2RlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUyhlKSB8fCB4KGUpID09PSBmOwogICAgICAgICAgICAgICAgfSwgdC5pc0NvbmN1cnJlbnRNb2RlID0gUywgdC5pc0NvbnRleHRDb25zdW1lciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHgoZSkgPT09IGw7CiAgICAgICAgICAgICAgICB9LCB0LmlzQ29udGV4dFByb3ZpZGVyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geChlKSA9PT0gdTsKICAgICAgICAgICAgICAgIH0sIHQuaXNFbGVtZW50ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT09IHR5cGVvZiBlICYmIG51bGwgIT09IGUgJiYgZS4kJHR5cGVvZiA9PT0gbzsKICAgICAgICAgICAgICAgIH0sIHQuaXNGb3J3YXJkUmVmID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geChlKSA9PT0gZDsKICAgICAgICAgICAgICAgIH0sIHQuaXNGcmFnbWVudCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHgoZSkgPT09IGE7CiAgICAgICAgICAgICAgICB9LCB0LmlzTGF6eSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHgoZSkgPT09IHY7CiAgICAgICAgICAgICAgICB9LCB0LmlzTWVtbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHgoZSkgPT09IGc7CiAgICAgICAgICAgICAgICB9LCB0LmlzUG9ydGFsID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geChlKSA9PT0gaTsKICAgICAgICAgICAgICAgIH0sIHQuaXNQcm9maWxlciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHgoZSkgPT09IGM7CiAgICAgICAgICAgICAgICB9LCB0LmlzU3RyaWN0TW9kZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHgoZSkgPT09IHM7CiAgICAgICAgICAgICAgICB9LCB0LmlzU3VzcGVuc2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB4KGUpID09PSBoOwogICAgICAgICAgICAgICAgfSwgdC5pc1ZhbGlkRWxlbWVudFR5cGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PT0gdHlwZW9mIGUgfHwgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGUgfHwgZSA9PT0gYSB8fCBlID09PSBwIHx8IGUgPT09IGMgfHwgZSA9PT0gcyB8fCBlID09PSBoIHx8IGUgPT09IG0gfHwgJ29iamVjdCcgPT09IHR5cGVvZiBlICYmIG51bGwgIT09IGUgJiYgKGUuJCR0eXBlb2YgPT09IHYgfHwgZS4kJHR5cGVvZiA9PT0gZyB8fCBlLiQkdHlwZW9mID09PSB1IHx8IGUuJCR0eXBlb2YgPT09IGwgfHwgZS4kJHR5cGVvZiA9PT0gZCB8fCBlLiQkdHlwZW9mID09PSBiIHx8IGUuJCR0eXBlb2YgPT09IEUgfHwgZS4kJHR5cGVvZiA9PT0gdyB8fCBlLiQkdHlwZW9mID09PSB5KTsKICAgICAgICAgICAgICAgIH0sIHQudHlwZU9mID0geDsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFlLndlYnBhY2tQb2x5ZmlsbCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdC5jcmVhdGUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHQuY2hpbGRyZW4gfHwgKHQuY2hpbGRyZW4gPSBbXSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnbG9hZGVkJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5sOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdpZCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnZXhwb3J0cycsIHsgZW51bWVyYWJsZTogITAgfSksIHQud2VicGFja1BvbHlmaWxsID0gMTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgbyA9IG4oMTIwKSwgaSA9IG4oMjY5KSwgYSA9IG4oMTI2KTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbmV3IGkoZSksIG4gPSBvKGkucHJvdG90eXBlLnJlcXVlc3QsIHQpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByLmV4dGVuZChuLCBpLnByb3RvdHlwZSwgdCksIHIuZXh0ZW5kKG4sIHQpLCBuOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGMgPSBzKG4oMTIzKSk7CiAgICAgICAgICAgICAgICBjLkF4aW9zID0gaSwgYy5jcmVhdGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBzKGEoYy5kZWZhdWx0cywgZSkpOwogICAgICAgICAgICAgICAgfSwgYy5DYW5jZWwgPSBuKDEyNyksIGMuQ2FuY2VsVG9rZW4gPSBuKDI4MiksIGMuaXNDYW5jZWwgPSBuKDEyMiksIGMuYWxsID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5hbGwoZSk7CiAgICAgICAgICAgICAgICB9LCBjLnNwcmVhZCA9IG4oMjgzKSwgZS5leHBvcnRzID0gYywgZS5leHBvcnRzLmRlZmF1bHQgPSBjOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KSwgbyA9IG4oMTIxKSwgaSA9IG4oMjcwKSwgYSA9IG4oMjcxKSwgcyA9IG4oMTI2KTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZGVmYXVsdHMgPSBlLCB0aGlzLmludGVyY2VwdG9ycyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogbmV3IGkoKSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2U6IG5ldyBpKCkKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUucmVxdWVzdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgPT09IHR5cGVvZiBlID8gKGUgPSBhcmd1bWVudHNbMV0gfHwge30pLnVybCA9IGFyZ3VtZW50c1swXSA6IGUgPSBlIHx8IHt9LCAoZSA9IHModGhpcy5kZWZhdWx0cywgZSkpLm1ldGhvZCA/IGUubWV0aG9kID0gZS5tZXRob2QudG9Mb3dlckNhc2UoKSA6IHRoaXMuZGVmYXVsdHMubWV0aG9kID8gZS5tZXRob2QgPSB0aGlzLmRlZmF1bHRzLm1ldGhvZC50b0xvd2VyQ2FzZSgpIDogZS5tZXRob2QgPSAnZ2V0JzsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAKICAgICAgICAgICAgICAgICAgICAgICAgXSwgbiA9IFByb21pc2UucmVzb2x2ZShlKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHRoaXMuaW50ZXJjZXB0b3JzLnJlcXVlc3QuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC51bnNoaWZ0KGUuZnVsZmlsbGVkLCBlLnJlamVjdGVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHRoaXMuaW50ZXJjZXB0b3JzLnJlc3BvbnNlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChlLmZ1bGZpbGxlZCwgZS5yZWplY3RlZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOyB0Lmxlbmd0aDspCiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBuLnRoZW4odC5zaGlmdCgpLCB0LnNoaWZ0KCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgfSwgYy5wcm90b3R5cGUuZ2V0VXJpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IHModGhpcy5kZWZhdWx0cywgZSksIG8oZS51cmwsIGUucGFyYW1zLCBlLnBhcmFtc1NlcmlhbGl6ZXIpLnJlcGxhY2UoL15cPy8sICcnKTsKICAgICAgICAgICAgICAgIH0sIHIuZm9yRWFjaChbCiAgICAgICAgICAgICAgICAgICAgJ2RlbGV0ZScsCiAgICAgICAgICAgICAgICAgICAgJ2dldCcsCiAgICAgICAgICAgICAgICAgICAgJ2hlYWQnLAogICAgICAgICAgICAgICAgICAgICdvcHRpb25zJwogICAgICAgICAgICAgICAgXSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBjLnByb3RvdHlwZVtlXSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJlcXVlc3Qoci5tZXJnZShuIHx8IHt9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHQKICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KSwgci5mb3JFYWNoKFsKICAgICAgICAgICAgICAgICAgICAncG9zdCcsCiAgICAgICAgICAgICAgICAgICAgJ3B1dCcsCiAgICAgICAgICAgICAgICAgICAgJ3BhdGNoJwogICAgICAgICAgICAgICAgXSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBjLnByb3RvdHlwZVtlXSA9IGZ1bmN0aW9uICh0LCBuLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJlcXVlc3Qoci5tZXJnZShvIHx8IHt9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBuCiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSksIGUuZXhwb3J0cyA9IGM7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gbygpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhhbmRsZXJzID0gW107CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBvLnByb3RvdHlwZS51c2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmhhbmRsZXJzLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICBmdWxmaWxsZWQ6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdGVkOiB0CiAgICAgICAgICAgICAgICAgICAgfSksIHRoaXMuaGFuZGxlcnMubGVuZ3RoIC0gMTsKICAgICAgICAgICAgICAgIH0sIG8ucHJvdG90eXBlLmVqZWN0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmhhbmRsZXJzW2VdICYmICh0aGlzLmhhbmRsZXJzW2VdID0gbnVsbCk7CiAgICAgICAgICAgICAgICB9LCBvLnByb3RvdHlwZS5mb3JFYWNoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByLmZvckVhY2godGhpcy5oYW5kbGVycywgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPT0gdCAmJiBlKHQpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgZS5leHBvcnRzID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNiksIG8gPSBuKDI3MiksIGkgPSBuKDEyMiksIGEgPSBuKDEyMyk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLmNhbmNlbFRva2VuICYmIGUuY2FuY2VsVG9rZW4udGhyb3dJZlJlcXVlc3RlZCgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcyhlKSwgZS5oZWFkZXJzID0gZS5oZWFkZXJzIHx8IHt9LCBlLmRhdGEgPSBvKGUuZGF0YSwgZS5oZWFkZXJzLCBlLnRyYW5zZm9ybVJlcXVlc3QpLCBlLmhlYWRlcnMgPSByLm1lcmdlKGUuaGVhZGVycy5jb21tb24gfHwge30sIGUuaGVhZGVyc1tlLm1ldGhvZF0gfHwge30sIGUuaGVhZGVycyksIHIuZm9yRWFjaChbCiAgICAgICAgICAgICAgICAgICAgICAgICdkZWxldGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnZ2V0JywKICAgICAgICAgICAgICAgICAgICAgICAgJ2hlYWQnLAogICAgICAgICAgICAgICAgICAgICAgICAncG9zdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICdwdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAncGF0Y2gnLAogICAgICAgICAgICAgICAgICAgICAgICAnY29tbW9uJwogICAgICAgICAgICAgICAgICAgIF0sIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBlLmhlYWRlcnNbdF07CiAgICAgICAgICAgICAgICAgICAgfSksIChlLmFkYXB0ZXIgfHwgYS5hZGFwdGVyKShlKS50aGVuKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzKGUpLCB0LmRhdGEgPSBvKHQuZGF0YSwgdC5oZWFkZXJzLCBlLnRyYW5zZm9ybVJlc3BvbnNlKSwgdDsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSh0KSB8fCAocyhlKSwgdCAmJiB0LnJlc3BvbnNlICYmICh0LnJlc3BvbnNlLmRhdGEgPSBvKHQucmVzcG9uc2UuZGF0YSwgdC5yZXNwb25zZS5oZWFkZXJzLCBlLnRyYW5zZm9ybVJlc3BvbnNlKSkpLCBQcm9taXNlLnJlamVjdCh0KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5mb3JFYWNoKG4sIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBuKGUsIHQpOwogICAgICAgICAgICAgICAgICAgIH0pLCBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNik7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHIuZm9yRWFjaChlLCBmdW5jdGlvbiAobiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICByICE9PSB0ICYmIHIudG9VcHBlckNhc2UoKSA9PT0gdC50b1VwcGVyQ2FzZSgpICYmIChlW3RdID0gbiwgZGVsZXRlIGVbcl0pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMjUpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG4uY29uZmlnLnZhbGlkYXRlU3RhdHVzOwogICAgICAgICAgICAgICAgICAgICFvIHx8IG8obi5zdGF0dXMpID8gZShuKSA6IHQocignUmVxdWVzdCBmYWlsZWQgd2l0aCBzdGF0dXMgY29kZSAnICsgbi5zdGF0dXMsIG4uY29uZmlnLCBudWxsLCBuLnJlcXVlc3QsIG4pKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCwgbiwgciwgbykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNvbmZpZyA9IHQsIG4gJiYgKGUuY29kZSA9IG4pLCBlLnJlcXVlc3QgPSByLCBlLnJlc3BvbnNlID0gbywgZS5pc0F4aW9zRXJyb3IgPSAhMCwgZS50b0pTT04gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiB0aGlzLm1lc3NhZ2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiB0aGlzLm5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogdGhpcy5kZXNjcmlwdGlvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bWJlcjogdGhpcy5udW1iZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxlTmFtZTogdGhpcy5maWxlTmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVOdW1iZXI6IHRoaXMubGluZU51bWJlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbHVtbk51bWJlcjogdGhpcy5jb2x1bW5OdW1iZXIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFjazogdGhpcy5zdGFjaywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZzogdGhpcy5jb25maWcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiB0aGlzLmNvZGUKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gbigyNzcpLCBvID0gbigyNzgpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAhcih0KSA/IG8oZSwgdCkgOiB0OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC9eKFthLXpdW2EtelxkXCtcLVwuXSo6KT9cL1wvL2kudGVzdChlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID8gZS5yZXBsYWNlKC9cLyskLywgJycpICsgJy8nICsgdC5yZXBsYWNlKC9eXC8rLywgJycpIDogZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpLCBvID0gWwogICAgICAgICAgICAgICAgICAgICAgICAnYWdlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2F1dGhvcml6YXRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAnY29udGVudC1sZW5ndGgnLAogICAgICAgICAgICAgICAgICAgICAgICAnY29udGVudC10eXBlJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2V0YWcnLAogICAgICAgICAgICAgICAgICAgICAgICAnZXhwaXJlcycsCiAgICAgICAgICAgICAgICAgICAgICAgICdmcm9tJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2hvc3QnLAogICAgICAgICAgICAgICAgICAgICAgICAnaWYtbW9kaWZpZWQtc2luY2UnLAogICAgICAgICAgICAgICAgICAgICAgICAnaWYtdW5tb2RpZmllZC1zaW5jZScsCiAgICAgICAgICAgICAgICAgICAgICAgICdsYXN0LW1vZGlmaWVkJywKICAgICAgICAgICAgICAgICAgICAgICAgJ2xvY2F0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgJ21heC1mb3J3YXJkcycsCiAgICAgICAgICAgICAgICAgICAgICAgICdwcm94eS1hdXRob3JpemF0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3JlZmVyZXInLAogICAgICAgICAgICAgICAgICAgICAgICAncmV0cnktYWZ0ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAndXNlci1hZ2VudCcKICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgaSwgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID8gKHIuZm9yRWFjaChlLnNwbGl0KCdcbicpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA9IGUuaW5kZXhPZignOicpLCB0ID0gci50cmltKGUuc3Vic3RyKDAsIGkpKS50b0xvd2VyQ2FzZSgpLCBuID0gci50cmltKGUuc3Vic3RyKGkgKyAxKSksIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhW3RdICYmIG8uaW5kZXhPZih0KSA+PSAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbdF0gPSAnc2V0LWNvb2tpZScgPT09IHQgPyAoYVt0XSA/IGFbdF0gOiBbXSkuY29uY2F0KFtuXSkgOiBhW3RdID8gYVt0XSArICcsICcgKyBuIDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pLCBhKSA6IGE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDE2KTsKICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHIuaXNTdGFuZGFyZEJyb3dzZXJFbnYoKSA/IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSwgdCA9IC8obXNpZXx0cmlkZW50KS9pLnRlc3QobmF2aWdhdG9yLnVzZXJBZ2VudCksIG4gPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdhJyk7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgKG4uc2V0QXR0cmlidXRlKCdocmVmJywgciksIHIgPSBuLmhyZWYpLCBuLnNldEF0dHJpYnV0ZSgnaHJlZicsIHIpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBocmVmOiBuLmhyZWYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm90b2NvbDogbi5wcm90b2NvbCA/IG4ucHJvdG9jb2wucmVwbGFjZSgvOiQvLCAnJykgOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhvc3Q6IG4uaG9zdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlYXJjaDogbi5zZWFyY2ggPyBuLnNlYXJjaC5yZXBsYWNlKC9eXD8vLCAnJykgOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc2g6IG4uaGFzaCA/IG4uaGFzaC5yZXBsYWNlKC9eIy8sICcnKSA6ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaG9zdG5hbWU6IG4uaG9zdG5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb3J0OiBuLnBvcnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRobmFtZTogJy8nID09PSBuLnBhdGhuYW1lLmNoYXJBdCgwKSA/IG4ucGF0aG5hbWUgOiAnLycgKyBuLnBhdGhuYW1lCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gbyh3aW5kb3cubG9jYXRpb24uaHJlZiksIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gci5pc1N0cmluZyh0KSA/IG8odCkgOiB0OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5wcm90b2NvbCA9PT0gZS5wcm90b2NvbCAmJiBuLmhvc3QgPT09IGUuaG9zdDsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpIDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTYpOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gci5pc1N0YW5kYXJkQnJvd3NlckVudigpID8gewogICAgICAgICAgICAgICAgICAgIHdyaXRlOiBmdW5jdGlvbiAoZSwgdCwgbiwgbywgaSwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICBzLnB1c2goZSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh0KSksIHIuaXNOdW1iZXIobikgJiYgcy5wdXNoKCdleHBpcmVzPScgKyBuZXcgRGF0ZShuKS50b0dNVFN0cmluZygpKSwgci5pc1N0cmluZyhvKSAmJiBzLnB1c2goJ3BhdGg9JyArIG8pLCByLmlzU3RyaW5nKGkpICYmIHMucHVzaCgnZG9tYWluPScgKyBpKSwgITAgPT09IGEgJiYgcy5wdXNoKCdzZWN1cmUnKSwgZG9jdW1lbnQuY29va2llID0gcy5qb2luKCc7ICcpOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcmVhZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBkb2N1bWVudC5jb29raWUubWF0Y2gobmV3IFJlZ0V4cCgnKF58O1xccyopKCcgKyBlICsgJyk9KFteO10qKScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPyBkZWNvZGVVUklDb21wb25lbnQodFszXSkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcmVtb3ZlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLndyaXRlKGUsICcnLCBEYXRlLm5vdygpIC0gODY0MDAwMDApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gOiB7CiAgICAgICAgICAgICAgICAgICAgd3JpdGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHJlYWQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICByZW1vdmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSBuKDEyNyk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ2V4ZWN1dG9yIG11c3QgYmUgYSBmdW5jdGlvbi4nKTsKICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICB0aGlzLnByb21pc2UgPSBuZXcgUHJvbWlzZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0ID0gZTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBuLnJlYXNvbiB8fCAobi5yZWFzb24gPSBuZXcgcihlKSwgdChuLnJlYXNvbikpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgby5wcm90b3R5cGUudGhyb3dJZlJlcXVlc3RlZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5yZWFzb24pCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IHRoaXMucmVhc29uOwogICAgICAgICAgICAgICAgfSwgby5zb3VyY2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgdG9rZW46IG5ldyBvKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbDogZQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBlLmV4cG9ydHMgPSBvOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkobnVsbCwgdCk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICB2YXIgciA9IHRoaXMgJiYgdGhpcy5fX2V4dGVuZHMgfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8IHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX19wcm90b19fID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaGFzT3duUHJvcGVydHkobikgJiYgKGVbbl0gPSB0W25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29uc3RydWN0b3IgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAnX19lc01vZHVsZScsIHsgdmFsdWU6ICEwIH0pOwogICAgICAgICAgICAgICAgdmFyIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQodCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuY2FsbCh0aGlzLCB0KSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5uYW1lID0gJ0RlY29kaW5nRXJyb3InLCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdDsKICAgICAgICAgICAgICAgIH0oRXJyb3IpOwogICAgICAgICAgICAgICAgdC5EZWNvZGluZ0Vycm9yID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5jYWxsKHRoaXMsIHQpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLm5hbWUgPSAnRW5jb2RpbmdFcnJvcicsIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0OwogICAgICAgICAgICAgICAgfShFcnJvcik7CiAgICAgICAgICAgICAgICB0LkVuY29kaW5nRXJyb3IgPSBvOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzICYmIHRoaXMuX19leHRlbmRzIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCB7IF9fcHJvdG9fXzogW10gfSBpbnN0YW5jZW9mIEFycmF5ICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9fcHJvdG9fXyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pICYmIChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnN0cnVjdG9yID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmNhbGwodGhpcywgdCkgfHwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ubmFtZSA9ICdHVkxFcnJvcicsIG47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0OwogICAgICAgICAgICAgICAgfShFcnJvcik7CiAgICAgICAgICAgICAgICB0LkdWTEVycm9yID0gbzsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgfHwgeyBfX3Byb3RvX186IFtdIH0gaW5zdGFuY2VvZiBBcnJheSAmJiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jb25zdHJ1Y3RvciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZSh0LCBuKSwgdC5wcm90b3R5cGUgPSBudWxsID09PSBuID8gT2JqZWN0LmNyZWF0ZShuKSA6IChyLnByb3RvdHlwZSA9IG4ucHJvdG90eXBlLCBuZXcgcigpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCh0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gciAmJiAociA9ICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlLmNhbGwodGhpcywgJ2ludmFsaWQgdmFsdWUgJyArIG4gKyAnIHBhc3NlZCBmb3IgJyArIHQgKyAnICcgKyByKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5uYW1lID0gJ1RDTW9kZWxFcnJvcicsIG87CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiByKHQsIGUpLCB0OwogICAgICAgICAgICAgICAgfShFcnJvcik7CiAgICAgICAgICAgICAgICB0LlRDTW9kZWxFcnJvciA9IG87CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS5oYXMgPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5sYW5nU2V0Lmhhcyh0KTsKICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5mb3JFYWNoID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZS5sYW5nU2V0LmZvckVhY2godCk7CiAgICAgICAgICAgICAgICAgICAgfSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUucHJvdG90eXBlLCAnc2l6ZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5sYW5nU2V0LnNpemU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSksIGUubGFuZ1NldCA9IG5ldyBTZXQoWwogICAgICAgICAgICAgICAgICAgICAgICAnQkcnLAogICAgICAgICAgICAgICAgICAgICAgICAnQ0EnLAogICAgICAgICAgICAgICAgICAgICAgICAnQ1MnLAogICAgICAgICAgICAgICAgICAgICAgICAnREEnLAogICAgICAgICAgICAgICAgICAgICAgICAnREUnLAogICAgICAgICAgICAgICAgICAgICAgICAnRUwnLAogICAgICAgICAgICAgICAgICAgICAgICAnRU4nLAogICAgICAgICAgICAgICAgICAgICAgICAnRVMnLAogICAgICAgICAgICAgICAgICAgICAgICAnRVQnLAogICAgICAgICAgICAgICAgICAgICAgICAnRkknLAogICAgICAgICAgICAgICAgICAgICAgICAnRlInLAogICAgICAgICAgICAgICAgICAgICAgICAnSFInLAogICAgICAgICAgICAgICAgICAgICAgICAnSFUnLAogICAgICAgICAgICAgICAgICAgICAgICAnSVQnLAogICAgICAgICAgICAgICAgICAgICAgICAnSkEnLAogICAgICAgICAgICAgICAgICAgICAgICAnTFQnLAogICAgICAgICAgICAgICAgICAgICAgICAnTFYnLAogICAgICAgICAgICAgICAgICAgICAgICAnTVQnLAogICAgICAgICAgICAgICAgICAgICAgICAnTkwnLAogICAgICAgICAgICAgICAgICAgICAgICAnTk8nLAogICAgICAgICAgICAgICAgICAgICAgICAnUEwnLAogICAgICAgICAgICAgICAgICAgICAgICAnUFQnLAogICAgICAgICAgICAgICAgICAgICAgICAnUk8nLAogICAgICAgICAgICAgICAgICAgICAgICAnUlUnLAogICAgICAgICAgICAgICAgICAgICAgICAnU0snLAogICAgICAgICAgICAgICAgICAgICAgICAnU0wnLAogICAgICAgICAgICAgICAgICAgICAgICAnU1YnLAogICAgICAgICAgICAgICAgICAgICAgICAnVFInLAogICAgICAgICAgICAgICAgICAgICAgICAnWkgnCiAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkNvbnNlbnRMYW5ndWFnZXMgPSByOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgdmFyIHIgPSB0aGlzICYmIHRoaXMuX19leHRlbmRzIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCB7IF9fcHJvdG9fXzogW10gfSBpbnN0YW5jZW9mIEFycmF5ICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLl9fcHJvdG9fXyA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KG4pICYmIChlW25dID0gdFtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnN0cnVjdG9yID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBlKHQsIG4pLCB0LnByb3RvdHlwZSA9IG51bGwgPT09IG4gPyBPYmplY3QuY3JlYXRlKG4pIDogKHIucHJvdG90eXBlID0gbi5wcm90b3R5cGUsIG5ldyByKCkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBvID0gbigxMzUpLCBpID0gbigxMzMpLCBhID0gbig3OSksIHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9PSBlICYmIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKSB8fCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYml0TGVuZ3RoID0gMCwgdC5tYXAgPSBuZXcgTWFwKCksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIodCwgZSksIHQucHJvdG90eXBlLmhhcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5tYXAuaGFzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5pc09rVG9IYXZlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBvID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gKHIgPSB0aGlzLmd2bCkgfHwgdm9pZCAwID09PSByID8gdm9pZCAwIDogci52ZW5kb3JzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0aGlzLmd2bC52ZW5kb3JzW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9PT0gYS5SZXN0cmljdGlvblR5cGUuTk9UX0FMTE9XRUQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gaS5sZWdJbnRQdXJwb3Nlcy5pbmNsdWRlcyh0KSB8fCBpLnB1cnBvc2VzLmluY2x1ZGVzKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChpLmZsZXhpYmxlUHVycG9zZXMubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGEuUmVzdHJpY3Rpb25UeXBlLlJFUVVJUkVfQ09OU0VOVDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gaS5mbGV4aWJsZVB1cnBvc2VzLmluY2x1ZGVzKHQpICYmIGkubGVnSW50UHVycG9zZXMuaW5jbHVkZXModCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGEuUmVzdHJpY3Rpb25UeXBlLlJFUVVJUkVfTEk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IGkuZmxleGlibGVQdXJwb3Nlcy5pbmNsdWRlcyh0KSAmJiBpLnB1cnBvc2VzLmluY2x1ZGVzKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmlzT2tUb0hhdmUodC5yZXN0cmljdGlvblR5cGUsIHQucHVycG9zZUlkLCBlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5oYXNoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaGFzKG4pIHx8ICh0aGlzLm1hcC5zZXQobiwgbmV3IGkuQmluYXJ5U2VhcmNoVHJlZSgpKSwgdGhpcy5iaXRMZW5ndGggPSAwKSwgdGhpcy5tYXAuZ2V0KG4pLmFkZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZ2V0VmVuZG9ycyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuaGFzaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmhhcyhuKSAmJiAodCA9IHRoaXMubWFwLmdldChuKS5nZXQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbmV3IFNldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubWFwLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5nZXQoKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmFkZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQgPSBBcnJheS5mcm9tKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLmdldFJlc3RyaWN0aW9uVHlwZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldFJlc3RyaWN0aW9ucyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wdXJwb3NlSWQgPT09IHQgJiYgKHZvaWQgMCA9PT0gbiB8fCBuID4gZS5yZXN0cmljdGlvblR5cGUpICYmIChuID0gZS5yZXN0cmljdGlvblR5cGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnZlbmRvckhhc1Jlc3RyaWN0aW9uID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAhMSwgciA9IHRoaXMuZ2V0UmVzdHJpY3Rpb25zKGUpLCBvID0gMDsgbyA8IHIubGVuZ3RoICYmICFuOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHQuaXNTYW1lQXMocltvXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZ2V0TWF4VmVuZG9ySWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5tYXAuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBNYXRoLm1heCh0Lm1heCgpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRSZXN0cmljdGlvbnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm1hcC5mb3JFYWNoKGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA/IG4uY29udGFpbnMoZSkgJiYgdC5wdXNoKG8uUHVycG9zZVJlc3RyaWN0aW9uLnVuSGFzaChyKSkgOiB0LnB1c2goby5QdXJwb3NlUmVzdHJpY3Rpb24udW5IYXNoKHIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5nZXRQdXJwb3NlcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IFNldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWFwLmZvckVhY2goZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmFkZChvLlB1cnBvc2VSZXN0cmljdGlvbi51bkhhc2gobikucHVycG9zZUlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBBcnJheS5mcm9tKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5yZW1vdmUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0Lmhhc2gsIHIgPSB0aGlzLm1hcC5nZXQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYmIChyLnJlbW92ZShlKSwgci5pc0VtcHR5KCkgJiYgKHRoaXMubWFwLmRlbGV0ZShuKSwgdGhpcy5iaXRMZW5ndGggPSAwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ2d2bCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmd2bF87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmd2bF8gfHwgKHRoaXMuZ3ZsXyA9IGUsIHRoaXMubWFwLmZvckVhY2goZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBvLlB1cnBvc2VSZXN0cmljdGlvbi51bkhhc2gobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2V0KCkuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5pc09rVG9IYXZlKHIucmVzdHJpY3Rpb25UeXBlLCByLnB1cnBvc2VJZCwgbikgfHwgZS5yZW1vdmUobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQucHJvdG90eXBlLmlzRW1wdHkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA9PT0gdGhpcy5tYXAuc2l6ZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAnbnVtUmVzdHJpY3Rpb25zJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWFwLnNpemU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgIH0obigyOSkuQ2xvbmVhYmxlKTsKICAgICAgICAgICAgICAgIHQuUHVycG9zZVJlc3RyaWN0aW9uVmVjdG9yID0gczsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgbyA9IG4oMTM2KSwgaSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5JRF9UT19LRVkgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLlNlZ21lbnQuQ09SRSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uU2VnbWVudC5WRU5ET1JTX0RJU0NMT1NFRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uU2VnbWVudC5WRU5ET1JTX0FMTE9XRUQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLlNlZ21lbnQuUFVCTElTSEVSX1RDCiAgICAgICAgICAgICAgICAgICAgICAgIF0sIGUuS0VZX1RPX0lEID0gKChyID0ge30pW28uU2VnbWVudC5DT1JFXSA9IDAsIHJbby5TZWdtZW50LlZFTkRPUlNfRElTQ0xPU0VEXSA9IDEsIHJbby5TZWdtZW50LlZFTkRPUlNfQUxMT1dFRF0gPSAyLCByW28uU2VnbWVudC5QVUJMSVNIRVJfVENdID0gMywgciksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5TZWdtZW50SURzID0gaTsKICAgICAgICAgICAgfSwKICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgIHZhciByID0gdGhpcyAmJiB0aGlzLl9fZXh0ZW5kcyB8fCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCB7IF9fcHJvdG9fXzogW10gfSBpbnN0YW5jZW9mIEFycmF5ICYmIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fX3Byb3RvX18gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoZVtuXSA9IHRbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkodCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNvbnN0cnVjdG9yID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUodCwgbiksIHQucHJvdG90eXBlID0gbnVsbCA9PT0gbiA/IE9iamVjdC5jcmVhdGUobikgOiAoci5wcm90b3R5cGUgPSBuLnByb3RvdHlwZSwgbmV3IHIoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSgpLCBvID0gdGhpcyAmJiB0aGlzLl9fZ2VuZXJhdG9yIHx8IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByLCBvLCBpLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbnQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgJiBvWzBdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgb1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9bMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnlzOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHM6IFtdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5leHQ6IHMoMCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdzogcygxKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjogcygyKQogICAgICAgICAgICAgICAgICAgICAgICB9LCAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgKGlbU3ltYm9sLml0ZXJhdG9yXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdHZW5lcmF0b3IgaXMgYWxyZWFkeSBleGVjdXRpbmcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBhOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSAxLCByICYmIChvID0gMiAmIGlbMF0gPyByLnJldHVybiA6IGlbMF0gPyByLnRocm93IHx8ICgobyA9IHIucmV0dXJuKSAmJiBvLmNhbGwociksIDApIDogci5uZXh0KSAmJiAhKG8gPSBvLmNhbGwociwgaVsxXSkpLmRvbmUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAociA9IDAsIG8gJiYgKGkgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyICYgaVswXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8udmFsdWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIGlbMF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5sYWJlbCsrLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogaVsxXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA1OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmxhYmVsKyssIHIgPSBpWzFdLCBpID0gWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBhLm9wcy5wb3AoKSwgYS50cnlzLnBvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShvID0gKG8gPSBhLnRyeXMpLmxlbmd0aCA+IDAgJiYgb1tvLmxlbmd0aCAtIDFdKSAmJiAoNiA9PT0gaVswXSB8fCAyID09PSBpWzBdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMyA9PT0gaVswXSAmJiAoIW8gfHwgaVsxXSA+IG9bMF0gJiYgaVsxXSA8IG9bM10pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmxhYmVsID0gaVsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg2ID09PSBpWzBdICYmIGEubGFiZWwgPCBvWzFdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmxhYmVsID0gb1sxXSwgbyA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobyAmJiBhLmxhYmVsIDwgb1syXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5sYWJlbCA9IG9bMl0sIGEub3BzLnB1c2goaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvWzJdICYmIGEub3BzLnBvcCgpLCBhLnRyeXMucG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gdC5jYWxsKGUsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCByID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG8gPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoNSAmIGlbMF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBpWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGlbMF0gPyBpWzFdIDogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciBpID0gbigyOSksIGEgPSBuKDE1KSwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG51bGwgIT09IGUgJiYgZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5iaXRMZW5ndGggPSAwLCB0Lm1heElkXyA9IDAsIHQuc2V0XyA9IG5ldyBTZXQoKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcih0LCBlKSwgdC5wcm90b3R5cGVbU3ltYm9sLml0ZXJhdG9yXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8odGhpcywgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHQubGFiZWwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSAxLCB0LmxhYmVsID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIDw9IHRoaXMubWF4SWQgPyBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5oYXMoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSA6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNlbnQoKSwgdC5sYWJlbCA9IDM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSsrLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUudmFsdWVzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2V0Xy52YWx1ZXMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQucHJvdG90eXBlLCAnbWF4SWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5tYXhJZF87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0LnByb3RvdHlwZS5oYXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc2V0Xy5oYXMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQucHJvdG90eXBlLnVuc2V0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkoZSkgPyBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC51bnNldChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogJ29iamVjdCcgPT0gdHlwZW9mIGUgPyB0aGlzLnVuc2V0KE9iamVjdC5rZXlzKGUpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiArZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSA6ICh0aGlzLnNldF8uZGVsZXRlKGUpLCB0aGlzLmJpdExlbmd0aCA9IDAsIGUgPT09IHRoaXMubWF4SWQgJiYgKHRoaXMubWF4SWRfID0gMCwgdGhpcy5zZXRfLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lm1heElkXyA9IE1hdGgubWF4KHQubWF4SWQsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuaXNJbnRNYXAgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLCBuID0gJ29iamVjdCcgPT0gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiBPYmplY3Qua2V5cyhlKS5ldmVyeShmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gTnVtYmVyLmlzSW50ZWdlcihwYXJzZUludChuLCAxMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAociA9IHIgJiYgdC5pc1ZhbGlkTnVtYmVyKGVbbl0uaWQpKSAmJiB2b2lkIDAgIT09IGVbbl0ubmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5pc1ZhbGlkTnVtYmVyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUludChlLCAxMCkgPiAwOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5pc1NldCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgaW5zdGFuY2VvZiBTZXQgJiYgKHQgPSBBcnJheS5mcm9tKGUpLmV2ZXJ5KHRoaXMuaXNWYWxpZE51bWJlcikpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5zZXQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnNldChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHRoaXMuaXNTZXQoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXQoQXJyYXkuZnJvbShlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICh0aGlzLmlzSW50TWFwKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0KE9iamVjdC5rZXlzKGUpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gK2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLmlzVmFsaWROdW1iZXIoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBhLlRDTW9kZWxFcnJvcignc2V0KCknLCBlLCAnbXVzdCBiZSBwb3NpdGl2ZSBpbnRlZ2VyIGFycmF5LCBwb3NpdGl2ZSBpbnRlZ2VyLCBTZXQ8bnVtYmVyPiwgb3IgSW50TWFwJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRfLmFkZChlKSwgdGhpcy5tYXhJZF8gPSBNYXRoLm1heCh0aGlzLm1heElkLCBlKSwgdGhpcy5iaXRMZW5ndGggPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnByb3RvdHlwZS5lbXB0eSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0XyA9IG5ldyBTZXQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm90b3R5cGUuZm9yRWFjaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8PSB0aGlzLm1heElkOyB0KyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSh0aGlzLmhhcyh0KSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LnByb3RvdHlwZSwgJ3NpemUnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zZXRfLnNpemU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0LnByb3RvdHlwZS5zZXRBbGwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQ7CiAgICAgICAgICAgICAgICAgICAgfShpLkNsb25lYWJsZSk7CiAgICAgICAgICAgICAgICB0LlZlY3RvciA9IHM7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxMzIpLCBvID0gbig3OCksIGkgPSBuKDEzNyksIGEgPSBuKDE0MyksIHMgPSBuKDE1KSwgYyA9IG4oMTM0KSwgdSA9IG4oMTcpLCBsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmVuY29kZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB0aGlzLmZpZWxkU2VxdWVuY2VbJycgKyBlLnZlcnNpb25dW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBzLkVuY29kaW5nRXJyb3IoJ1VuYWJsZSB0byBlbmNvZGUgdmVyc2lvbjogJyArIGUudmVyc2lvbiArICcsIHNlZ21lbnQ6ICcgKyB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAhPT0gdS5TZWdtZW50LkNPUkUgJiYgKGwgPSBpLkludEVuY29kZXIuZW5jb2RlKHUuU2VnbWVudElEcy5LRVlfVE9fSURbdF0sIG8uQml0TGVuZ3RoLnNlZ21lbnRUeXBlKSksIG4uZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZVtuXSwgdSA9IGkuRmllbGRFbmNvZGVyTWFwW25dLCBmID0gby5CaXRMZW5ndGhbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBmICYmIGEuaXNQdWJsaXNoZXJDdXN0b20obikgJiYgKGYgPSArZVtjLkZpZWxkcy5udW1DdXN0b21QdXJwb3Nlc10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgKz0gdS5lbmNvZGUociwgZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgcy5FbmNvZGluZ0Vycm9yKCdFcnJvciBlbmNvZGluZyAnICsgdCArICctPicgKyBuICsgJzogJyArIGUubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHIuQmFzZTY0VXJsLmVuY29kZShsKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5kZWNvZGUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBsID0gci5CYXNlNjRVcmwuZGVjb2RlKGUpLCBmID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID09PSB1LlNlZ21lbnQuQ09SRSAmJiAodC52ZXJzaW9uID0gaS5JbnRFbmNvZGVyLmRlY29kZShsLnN1YnN0cihmLCBvLkJpdExlbmd0aFtjLkZpZWxkcy52ZXJzaW9uXSksIG8uQml0TGVuZ3RoW2MuRmllbGRzLnZlcnNpb25dKSksIG4gIT09IHUuU2VnbWVudC5DT1JFICYmIChmICs9IG8uQml0TGVuZ3RoLnNlZ21lbnRUeXBlKSwgdGhpcy5maWVsZFNlcXVlbmNlWycnICsgdC52ZXJzaW9uXVtuXS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpLkZpZWxkRW5jb2Rlck1hcFtlXSwgciA9IG8uQml0TGVuZ3RoW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IHIgJiYgYS5pc1B1Ymxpc2hlckN1c3RvbShlKSAmJiAociA9ICt0W2MuRmllbGRzLm51bUN1c3RvbVB1cnBvc2VzXSksIDAgIT09IHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBsLnN1YnN0cihmLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPT09IGkuVmVuZG9yVmVjdG9yRW5jb2RlciA/IHRbZV0gPSBuLmRlY29kZSh1LCB0LnZlcnNpb24pIDogdFtlXSA9IG4uZGVjb2RlKHUsIHIpLCBOdW1iZXIuaXNJbnRlZ2VyKHIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiArPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghTnVtYmVyLmlzSW50ZWdlcih0W2VdLmJpdExlbmd0aCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IHMuRGVjb2RpbmdFcnJvcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgKz0gdFtlXS5iaXRMZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5pc1B1Ymxpc2hlckN1c3RvbSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA9PT0gZS5pbmRleE9mKCdwdWJsaXNoZXJDdXN0b20nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5maWVsZFNlcXVlbmNlID0gbmV3IGEuRmllbGRTZXF1ZW5jZSgpLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuU2VnbWVudEVuY29kZXIgPSBsOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTcpLCBvID0gbig0MyksIGkgPSBuKDEzOCksIGEgPSBuKDgwKSwgcyA9IG4oMzApLCBjID0gbigxMzkpLCB1ID0gbigxNDApLCBsID0gbigxNDEpLCBmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBmLCBwLCBkLCBoLCBtLCBnLCB2LCB5LCBiLCBFLCB3LCB4LCBTLCBDLCBrLCBULCBfLCBQLCBPLCBJLCBMLCBBLCBSLCBOOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9IHIuRmllbGRzLnZlcnNpb24sIG4gPSByLkZpZWxkcy5jcmVhdGVkLCBmID0gci5GaWVsZHMubGFzdFVwZGF0ZWQsIHAgPSByLkZpZWxkcy5jbXBJZCwgZCA9IHIuRmllbGRzLmNtcFZlcnNpb24sIGggPSByLkZpZWxkcy5jb25zZW50U2NyZWVuLCBtID0gci5GaWVsZHMuY29uc2VudExhbmd1YWdlLCBnID0gci5GaWVsZHMudmVuZG9yTGlzdFZlcnNpb24sIHYgPSByLkZpZWxkcy5wb2xpY3lWZXJzaW9uLCB5ID0gci5GaWVsZHMuaXNTZXJ2aWNlU3BlY2lmaWMsIGIgPSByLkZpZWxkcy51c2VOb25TdGFuZGFyZFN0YWNrcywgRSA9IHIuRmllbGRzLnNwZWNpYWxGZWF0dXJlT3B0aW5zLCB3ID0gci5GaWVsZHMucHVycG9zZUNvbnNlbnRzLCB4ID0gci5GaWVsZHMucHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMsIFMgPSByLkZpZWxkcy5wdXJwb3NlT25lVHJlYXRtZW50LCBDID0gci5GaWVsZHMucHVibGlzaGVyQ291bnRyeUNvZGUsIGsgPSByLkZpZWxkcy52ZW5kb3JDb25zZW50cywgVCA9IHIuRmllbGRzLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMsIF8gPSByLkZpZWxkcy5wdWJsaXNoZXJSZXN0cmljdGlvbnMsIFAgPSByLkZpZWxkcy52ZW5kb3JzRGlzY2xvc2VkLCBPID0gci5GaWVsZHMudmVuZG9yc0FsbG93ZWQsIEkgPSByLkZpZWxkcy5wdWJsaXNoZXJDb25zZW50cywgTCA9IHIuRmllbGRzLnB1Ymxpc2hlckxlZ2l0aW1hdGVJbnRlcmVzdHMsIEEgPSByLkZpZWxkcy5udW1DdXN0b21QdXJwb3NlcywgUiA9IHIuRmllbGRzLnB1Ymxpc2hlckN1c3RvbUNvbnNlbnRzLCBOID0gci5GaWVsZHMucHVibGlzaGVyQ3VzdG9tTGVnaXRpbWF0ZUludGVyZXN0cywgZVt0XSA9IHMuSW50RW5jb2RlciwgZVtuXSA9IGkuRGF0ZUVuY29kZXIsIGVbZl0gPSBpLkRhdGVFbmNvZGVyLCBlW3BdID0gcy5JbnRFbmNvZGVyLCBlW2RdID0gcy5JbnRFbmNvZGVyLCBlW2hdID0gcy5JbnRFbmNvZGVyLCBlW21dID0gYy5MYW5nRW5jb2RlciwgZVtnXSA9IHMuSW50RW5jb2RlciwgZVt2XSA9IHMuSW50RW5jb2RlciwgZVt5XSA9IG8uQm9vbGVhbkVuY29kZXIsIGVbYl0gPSBvLkJvb2xlYW5FbmNvZGVyLCBlW0VdID0gYS5GaXhlZFZlY3RvckVuY29kZXIsIGVbd10gPSBhLkZpeGVkVmVjdG9yRW5jb2RlciwgZVt4XSA9IGEuRml4ZWRWZWN0b3JFbmNvZGVyLCBlW1NdID0gby5Cb29sZWFuRW5jb2RlciwgZVtDXSA9IGMuTGFuZ0VuY29kZXIsIGVba10gPSBsLlZlbmRvclZlY3RvckVuY29kZXIsIGVbVF0gPSBsLlZlbmRvclZlY3RvckVuY29kZXIsIGVbX10gPSB1LlB1cnBvc2VSZXN0cmljdGlvblZlY3RvckVuY29kZXIsIGUuc2VnbWVudFR5cGUgPSBzLkludEVuY29kZXIsIGVbUF0gPSBsLlZlbmRvclZlY3RvckVuY29kZXIsIGVbT10gPSBsLlZlbmRvclZlY3RvckVuY29kZXIsIGVbSV0gPSBhLkZpeGVkVmVjdG9yRW5jb2RlciwgZVtMXSA9IGEuRml4ZWRWZWN0b3JFbmNvZGVyLCBlW0FdID0gcy5JbnRFbmNvZGVyLCBlW1JdID0gYS5GaXhlZFZlY3RvckVuY29kZXIsIGVbTl0gPSBhLkZpeGVkVmVjdG9yRW5jb2RlciwgZTsKICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB0LkZpZWxkRW5jb2Rlck1hcCA9IGY7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNyk7CiAgICAgICAgICAgICAgICB0LkZpZWxkU2VxdWVuY2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQ7CiAgICAgICAgICAgICAgICAgICAgdGhpc1sxXSA9ICgoZSA9IHt9KVtyLlNlZ21lbnQuQ09SRV0gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnZlcnNpb24sCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmNyZWF0ZWQsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmxhc3RVcGRhdGVkLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5jbXBJZCwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY21wVmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY29uc2VudFNjcmVlbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY29uc2VudExhbmd1YWdlLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy52ZW5kb3JMaXN0VmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucHVycG9zZUNvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy52ZW5kb3JDb25zZW50cwogICAgICAgICAgICAgICAgICAgIF0sIGUpLCB0aGlzWzJdID0gKCh0ID0ge30pW3IuU2VnbWVudC5DT1JFXSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMudmVyc2lvbiwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMuY3JlYXRlZCwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMubGFzdFVwZGF0ZWQsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLmNtcElkLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5jbXBWZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5jb25zZW50U2NyZWVuLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5jb25zZW50TGFuZ3VhZ2UsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnZlbmRvckxpc3RWZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wb2xpY3lWZXJzaW9uLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5pc1NlcnZpY2VTcGVjaWZpYywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMudXNlTm9uU3RhbmRhcmRTdGFja3MsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnNwZWNpYWxGZWF0dXJlT3B0aW5zLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdXJwb3NlQ29uc2VudHMsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdXJwb3NlT25lVHJlYXRtZW50LAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdWJsaXNoZXJDb3VudHJ5Q29kZSwKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMudmVuZG9yQ29uc2VudHMsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdHMsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnB1Ymxpc2hlclJlc3RyaWN0aW9ucwogICAgICAgICAgICAgICAgICAgIF0sIHRbci5TZWdtZW50LlBVQkxJU0hFUl9UQ10gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnB1Ymxpc2hlckNvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5wdWJsaXNoZXJMZWdpdGltYXRlSW50ZXJlc3RzLAogICAgICAgICAgICAgICAgICAgICAgICByLkZpZWxkcy5udW1DdXN0b21QdXJwb3NlcywKICAgICAgICAgICAgICAgICAgICAgICAgci5GaWVsZHMucHVibGlzaGVyQ3VzdG9tQ29uc2VudHMsCiAgICAgICAgICAgICAgICAgICAgICAgIHIuRmllbGRzLnB1Ymxpc2hlckN1c3RvbUxlZ2l0aW1hdGVJbnRlcmVzdHMKICAgICAgICAgICAgICAgICAgICBdLCB0W3IuU2VnbWVudC5WRU5ET1JTX0FMTE9XRURdID0gW3IuRmllbGRzLnZlbmRvcnNBbGxvd2VkXSwgdFtyLlNlZ21lbnQuVkVORE9SU19ESVNDTE9TRURdID0gW3IuRmllbGRzLnZlbmRvcnNEaXNjbG9zZWRdLCB0KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHZhciByID0gbigxNyk7CiAgICAgICAgICAgICAgICB0LlNlZ21lbnRTZXF1ZW5jZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXNbMV0gPSBbci5TZWdtZW50LkNPUkVdLCB0aGlzWzJdID0gW3IuU2VnbWVudC5DT1JFXSwgMiA9PT0gZS52ZXJzaW9uKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5pc1NlcnZpY2VTcGVjaWZpYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbMl0ucHVzaChyLlNlZ21lbnQuUFVCTElTSEVSX1RDKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICEoIXQgfHwgIXQuaXNGb3JWZW5kb3JzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgITAgIT09IGVbci5GaWVsZHMuc3VwcG9ydE9PQl0gfHwgdGhpc1syXS5wdXNoKHIuU2VnbWVudC5WRU5ET1JTX0RJU0NMT1NFRCksIG4gJiYgKGVbci5GaWVsZHMuc3VwcG9ydE9PQl0gJiYgZVtyLkZpZWxkcy52ZW5kb3JzQWxsb3dlZF0uc2l6ZSA+IDAgJiYgdGhpc1syXS5wdXNoKHIuU2VnbWVudC5WRU5ET1JTX0FMTE9XRUQpLCB0aGlzWzJdLnB1c2goci5TZWdtZW50LlBVQkxJU0hFUl9UQykpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oMTUpLCBvID0gbigxNyksIGkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJvY2VzcyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgbywgaSA9IGUuZ3ZsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyByLkVuY29kaW5nRXJyb3IoJ1VuYWJsZSB0byBlbmNvZGUgVENNb2RlbCB3aXRob3V0IGEgR1ZMJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWkuaXNSZWFkeSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgci5FbmNvZGluZ0Vycm9yKCdVbmFibGUgdG8gZW5jb2RlIFRDTW9kZWwgdGNNb2RlbC5ndmwucmVhZHlQcm9taXNlIGlzIG5vdCByZXNvbHZlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGUgPSBlLmNsb25lKCkpLmNvbnNlbnRMYW5ndWFnZSA9IGkubGFuZ3VhZ2UudG9VcHBlckNhc2UoKSwgKG51bGwgPT09IChuID0gdCkgfHwgdm9pZCAwID09PSBuID8gdm9pZCAwIDogbi52ZXJzaW9uKSA+IDAgJiYgKG51bGwgPT09IChvID0gdCkgfHwgdm9pZCAwID09PSBvID8gdm9pZCAwIDogby52ZXJzaW9uKSA8PSB0aGlzLnByb2Nlc3Nvci5sZW5ndGggPyBlLnZlcnNpb24gPSB0LnZlcnNpb24gOiBlLnZlcnNpb24gPSB0aGlzLnByb2Nlc3Nvci5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUudmVyc2lvbiAtIDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXRoaXMucHJvY2Vzc29yW2FdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyByLkVuY29kaW5nRXJyb3IoJ0ludmFsaWQgdmVyc2lvbjogJyArIGUudmVyc2lvbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wcm9jZXNzb3JbYV0oZSwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvY2Vzc29yID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHVibGlzaGVyUmVzdHJpY3Rpb25zLmd2bCA9IHQsIGUucHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdHMudW5zZXQoMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBuZXcgTWFwKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uc2V0KCdsZWdJbnRQdXJwb3NlcycsIGUudmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0cyksIG4uc2V0KCdwdXJwb3NlcycsIGUudmVuZG9yQ29uc2VudHMpLCBuLmZvckVhY2goZnVuY3Rpb24gKG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5mb3JFYWNoKGZ1bmN0aW9uIChpLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gdC52ZW5kb3JzW2FdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcyB8fCBzLmRlbGV0ZWREYXRlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnVuc2V0KGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKDAgPT09IHNbcl0ubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5pc1NlcnZpY2VTcGVjaWZpYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBzLmZsZXhpYmxlUHVycG9zZXMubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4udW5zZXQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gZS5wdWJsaXNoZXJSZXN0cmljdGlvbnMuZ2V0UmVzdHJpY3Rpb25zKGEpLCB1ID0gITEsIGwgPSAwLCBmID0gYy5sZW5ndGg7IGwgPCBmICYmICF1OyBsKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgPSBjW2xdLnJlc3RyaWN0aW9uVHlwZSA9PT0gby5SZXN0cmljdGlvblR5cGUuUkVRVUlSRV9DT05TRU5UICYmICdwdXJwb3NlcycgPT09IHIgfHwgY1tsXS5yZXN0cmljdGlvblR5cGUgPT09IG8uUmVzdHJpY3Rpb25UeXBlLlJFUVVJUkVfTEkgJiYgJ2xlZ0ludFB1cnBvc2VzJyA9PT0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1IHx8IG4udW5zZXQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4udW5zZXQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlLnZlbmRvcnNEaXNjbG9zZWQuc2V0KHQudmVuZG9ycyksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0sIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdC5TZW1hbnRpY1ByZUVuY29kZXIgPSBpOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgICAgICB2YXIgciA9IG4oNzcpLCBvID0gbigxNyksIGkgPSBuKDMwKSwgYSA9IG4oMTQ2KSwgcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5lbmNvZGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIG8sIGkgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gci5TZW1hbnRpY1ByZUVuY29kZXIucHJvY2VzcyhlLCB0KSwgKG8gPSBBcnJheS5pc0FycmF5KG51bGwgPT09IChuID0gdCkgfHwgdm9pZCAwID09PSBuID8gdm9pZCAwIDogbi5zZWdtZW50cykgPyB0LnNlZ21lbnRzIDogbmV3IHIuU2VnbWVudFNlcXVlbmNlKGUsIHQpWycnICsgZS52ZXJzaW9uXSkuZm9yRWFjaChmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA8IG8ubGVuZ3RoIC0gMSAmJiAoYSA9ICcuJyksIGkgKz0gci5TZWdtZW50RW5jb2Rlci5lbmNvZGUoZSwgdCkgKyBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZGVjb2RlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5zcGxpdCgnLicpLCBzID0gbi5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0IHx8ICh0ID0gbmV3IGEuVENNb2RlbCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwOyBjIDwgczsgYysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBuW2NdLCBsID0gci5CYXNlNjRVcmwuZGVjb2RlKHUuY2hhckF0KDApKS5zdWJzdHIoMCwgci5CaXRMZW5ndGguc2VnbWVudFR5cGUpLCBmID0gby5TZWdtZW50SURzLklEX1RPX0tFWVtpLkludEVuY29kZXIuZGVjb2RlKGwsIHIuQml0TGVuZ3RoLnNlZ21lbnRUeXBlKS50b1N0cmluZygpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLlNlZ21lbnRFbmNvZGVyLmRlY29kZSh1LCB0LCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgIHQuVENTdHJpbmcgPSBzOwogICAgICAgICAgICB9LAogICAgICAgICAgICBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgZS5leHBvcnRzID0gSlNPTi5wYXJzZSgneyJQYXJlbnQiOnsiQ2hpbGQiOiJFbmdsaXNoIn0sImNvcmVVaUxhYmVscyI6eyJpbml0U2NyZWVuVGl0bGUiOiJXZSB2YWx1ZSB5b3VyIHByaXZhY3kiLCJhZ3JlZUJ1dHRvbiI6IkFHUkVFIiwiYWdyZWVBbGxCdXR0b24iOiJBR1JFRSBUTyBBTEwiLCJpbml0U2NyZWVuUmVqZWN0QnV0dG9uIjoiRElTQUdSRUUiLCJpbml0U2NyZWVuU2V0dGluZ3NCdXR0b24iOiJNT1JFIE9QVElPTlMiLCJzdW1tYXJ5U2NyZWVuQm9keU5vUmVqZWN0U2VydmljZSI6WyJXZSBhbmQgb3VyIHBhcnRuZXJzIHN0b3JlIGFuZC9vciBhY2Nlc3MgaW5mb3JtYXRpb24gb24gYSBkZXZpY2UsIHN1Y2ggYXMgY29va2llcyBhbmQgcHJvY2VzcyBwZXJzb25hbCBkYXRhLCBzdWNoIGFzIHVuaXF1ZSBpZGVudGlmaWVycyBhbmQgc3RhbmRhcmQgaW5mb3JtYXRpb24gc2VudCBieSBhIGRldmljZSBmb3IgcGVyc29uYWxpc2VkIGFkcyBhbmQgY29udGVudCwgYWQgYW5kIGNvbnRlbnQgbWVhc3VyZW1lbnQsIGFuZCBhdWRpZW5jZSBpbnNpZ2h0cywgYXMgd2VsbCBhcyB0byBkZXZlbG9wIGFuZCBpbXByb3ZlIHByb2R1Y3RzLiIsIldpdGggeW91ciBwZXJtaXNzaW9uIHdlIGFuZCBvdXIgcGFydG5lcnMgbWF5IHVzZSBwcmVjaXNlIGdlb2xvY2F0aW9uIGRhdGEgYW5kIGlkZW50aWZpY2F0aW9uIHRocm91Z2ggZGV2aWNlIHNjYW5uaW5nLiBZb3UgbWF5IGNsaWNrIHRvIGNvbnNlbnQgdG8gb3VyIGFuZCBvdXIgcGFydG5lcnNcdTIwMTkgcHJvY2Vzc2luZyBhcyBkZXNjcmliZWQgYWJvdmUuIEFsdGVybmF0aXZlbHkgeW91IG1heSBhY2Nlc3MgbW9yZSBkZXRhaWxlZCBpbmZvcm1hdGlvbiBhbmQgY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYmVmb3JlIGNvbnNlbnRpbmcgb3IgdG8gcmVmdXNlIGNvbnNlbnRpbmcuIFBsZWFzZSBub3RlIHRoYXQgc29tZSBwcm9jZXNzaW5nIG9mIHlvdXIgcGVyc29uYWwgZGF0YSBtYXkgbm90IHJlcXVpcmUgeW91ciBjb25zZW50LCBidXQgeW91IGhhdmUgYSByaWdodCB0byBvYmplY3QgdG8gc3VjaCBwcm9jZXNzaW5nLiBZb3VyIHByZWZlcmVuY2VzIHdpbGwgYXBwbHkgdG8gdGhpcyB3ZWJzaXRlIG9ubHkuIFlvdSBjYW4gY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYXQgYW55IHRpbWUgYnkgcmV0dXJuaW5nIHRvIHRoaXMgc2l0ZSBvciB2aXNpdCBvdXIgcHJpdmFjeSBwb2xpY3kuXFxuIl0sInN1bW1hcnlTY3JlZW5Cb2R5Tm9SZWplY3RHbG9iYWwiOlsiV2UgYW5kIG91ciBwYXJ0bmVycyBzdG9yZSBhbmQvb3IgYWNjZXNzIGluZm9ybWF0aW9uIG9uIGEgZGV2aWNlLCBzdWNoIGFzIGNvb2tpZXMgYW5kIHByb2Nlc3MgcGVyc29uYWwgZGF0YSwgc3VjaCBhcyB1bmlxdWUgaWRlbnRpZmllcnMgYW5kIHN0YW5kYXJkIGluZm9ybWF0aW9uIHNlbnQgYnkgYSBkZXZpY2UgZm9yIHBlcnNvbmFsaXNlZCBhZHMgYW5kIGNvbnRlbnQsIGFkIGFuZCBjb250ZW50IG1lYXN1cmVtZW50LCBhbmQgYXVkaWVuY2UgaW5zaWdodHMsIGFzIHdlbGwgYXMgdG8gZGV2ZWxvcCBhbmQgaW1wcm92ZSBwcm9kdWN0cy4iLCJXaXRoIHlvdXIgcGVybWlzc2lvbiB3ZSBhbmQgb3VyIHBhcnRuZXJzIG1heSB1c2UgcHJlY2lzZSBnZW9sb2NhdGlvbiBkYXRhIGFuZCBpZGVudGlmaWNhdGlvbiB0aHJvdWdoIGRldmljZSBzY2FubmluZy4gWW91IG1heSBjbGljayB0byBjb25zZW50IHRvIG91ciBhbmQgb3VyIHBhcnRuZXJzXHUyMDE5IHByb2Nlc3NpbmcgYXMgZGVzY3JpYmVkIGFib3ZlLiBBbHRlcm5hdGl2ZWx5IHlvdSBtYXkgYWNjZXNzIG1vcmUgZGV0YWlsZWQgaW5mb3JtYXRpb24gYW5kIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGJlZm9yZSBjb25zZW50aW5nIG9yIHRvIHJlZnVzZSBjb25zZW50aW5nLiBQbGVhc2Ugbm90ZSB0aGF0IHNvbWUgcHJvY2Vzc2luZyBvZiB5b3VyIHBlcnNvbmFsIGRhdGEgbWF5IG5vdCByZXF1aXJlIHlvdXIgY29uc2VudCwgYnV0IHlvdSBoYXZlIGEgcmlnaHQgdG8gb2JqZWN0IHRvIHN1Y2ggcHJvY2Vzc2luZy4gWW91ciBwcmVmZXJlbmNlcyB3aWxsIGFwcGx5IGFjcm9zcyB0aGUgd2ViLiBZb3UgY2FuIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGF0IGFueSB0aW1lIGJ5IHJldHVybmluZyB0byB0aGlzIHNpdGUgb3IgdmlzaXQgb3VyIHByaXZhY3kgcG9saWN5LiJdLCJzdW1tYXJ5U2NyZWVuQm9keU5vUmVqZWN0R3JvdXAiOlsiV2UgYW5kIG91ciBwYXJ0bmVycyBzdG9yZSBhbmQvb3IgYWNjZXNzIGluZm9ybWF0aW9uIG9uIGEgZGV2aWNlLCBzdWNoIGFzIGNvb2tpZXMgYW5kIHByb2Nlc3MgcGVyc29uYWwgZGF0YSwgc3VjaCBhcyB1bmlxdWUgaWRlbnRpZmllcnMgYW5kIHN0YW5kYXJkIGluZm9ybWF0aW9uIHNlbnQgYnkgYSBkZXZpY2UgZm9yIHBlcnNvbmFsaXNlZCBhZHMgYW5kIGNvbnRlbnQsIGFkIGFuZCBjb250ZW50IG1lYXN1cmVtZW50LCBhbmQgYXVkaWVuY2UgaW5zaWdodHMsIGFzIHdlbGwgYXMgdG8gZGV2ZWxvcCBhbmQgaW1wcm92ZSBwcm9kdWN0cy4iLCJXaXRoIHlvdXIgcGVybWlzc2lvbiB3ZSBhbmQgb3VyIHBhcnRuZXJzIG1heSB1c2UgcHJlY2lzZSBnZW9sb2NhdGlvbiBkYXRhIGFuZCBpZGVudGlmaWNhdGlvbiB0aHJvdWdoIGRldmljZSBzY2FubmluZy4gWW91IG1heSBjbGljayB0byBjb25zZW50IHRvIG91ciBhbmQgb3VyIHBhcnRuZXJzXHUyMDE5IHByb2Nlc3NpbmcgYXMgZGVzY3JpYmVkIGFib3ZlLiBBbHRlcm5hdGl2ZWx5IHlvdSBtYXkgYWNjZXNzIG1vcmUgZGV0YWlsZWQgaW5mb3JtYXRpb24gYW5kIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGJlZm9yZSBjb25zZW50aW5nIG9yIHRvIHJlZnVzZSBjb25zZW50aW5nLiBQbGVhc2Ugbm90ZSB0aGF0IHNvbWUgcHJvY2Vzc2luZyBvZiB5b3VyIHBlcnNvbmFsIGRhdGEgbWF5IG5vdCByZXF1aXJlIHlvdXIgY29uc2VudCwgYnV0IHlvdSBoYXZlIGEgcmlnaHQgdG8gb2JqZWN0IHRvIHN1Y2ggcHJvY2Vzc2luZy4gWW91ciBwcmVmZXJlbmNlcyB3aWxsIGFwcGx5IHRvIGEgZ3JvdXAgb2Ygd2Vic2l0ZXMuIFlvdSBjYW4gY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYXQgYW55IHRpbWUgYnkgcmV0dXJuaW5nIHRvIHRoaXMgc2l0ZSBvciB2aXNpdCBvdXIgcHJpdmFjeSBwb2xpY3kuIl0sInN1bW1hcnlTY3JlZW5Cb2R5UmVqZWN0U2VydmljZSI6WyJXZSBhbmQgb3VyIHBhcnRuZXJzIHN0b3JlIGFuZC9vciBhY2Nlc3MgaW5mb3JtYXRpb24gb24gYSBkZXZpY2UsIHN1Y2ggYXMgY29va2llcyBhbmQgcHJvY2VzcyBwZXJzb25hbCBkYXRhLCBzdWNoIGFzIHVuaXF1ZSBpZGVudGlmaWVycyBhbmQgc3RhbmRhcmQgaW5mb3JtYXRpb24gc2VudCBieSBhIGRldmljZSBmb3IgcGVyc29uYWxpc2VkIGFkcyBhbmQgY29udGVudCwgYWQgYW5kIGNvbnRlbnQgbWVhc3VyZW1lbnQsIGFuZCBhdWRpZW5jZSBpbnNpZ2h0cywgYXMgd2VsbCBhcyB0byBkZXZlbG9wIGFuZCBpbXByb3ZlIHByb2R1Y3RzLiIsIldpdGggeW91ciBwZXJtaXNzaW9uIHdlIGFuZCBvdXIgcGFydG5lcnMgbWF5IHVzZSBwcmVjaXNlIGdlb2xvY2F0aW9uIGRhdGEgYW5kIGlkZW50aWZpY2F0aW9uIHRocm91Z2ggZGV2aWNlIHNjYW5uaW5nLiBZb3UgbWF5IGNsaWNrIHRvIGNvbnNlbnQgdG8gb3VyIGFuZCBvdXIgcGFydG5lcnNcdTIwMTkgcHJvY2Vzc2luZyBhcyBkZXNjcmliZWQgYWJvdmUuIEFsdGVybmF0aXZlbHkgeW91IG1heSBjbGljayB0byByZWZ1c2UgdG8gY29uc2VudCBvciBhY2Nlc3MgbW9yZSBkZXRhaWxlZCBpbmZvcm1hdGlvbiBhbmQgY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYmVmb3JlIGNvbnNlbnRpbmcuIFBsZWFzZSBub3RlIHRoYXQgc29tZSBwcm9jZXNzaW5nIG9mIHlvdXIgcGVyc29uYWwgZGF0YSBtYXkgbm90IHJlcXVpcmUgeW91ciBjb25zZW50LCBidXQgeW91IGhhdmUgYSByaWdodCB0byBvYmplY3QgdG8gc3VjaCBwcm9jZXNzaW5nLiBZb3VyIHByZWZlcmVuY2VzIHdpbGwgYXBwbHkgdG8gdGhpcyB3ZWJzaXRlIG9ubHkuIFlvdSBjYW4gY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYXQgYW55IHRpbWUgYnkgcmV0dXJuaW5nIHRvIHRoaXMgc2l0ZSBvciB2aXNpdCBvdXIgcHJpdmFjeSBwb2xpY3kuIl0sInN1bW1hcnlTY3JlZW5Cb2R5UmVqZWN0R2xvYmFsIjpbIldlIGFuZCBvdXIgcGFydG5lcnMgc3RvcmUgYW5kL29yIGFjY2VzcyBpbmZvcm1hdGlvbiBvbiBhIGRldmljZSwgc3VjaCBhcyBjb29raWVzIGFuZCBwcm9jZXNzIHBlcnNvbmFsIGRhdGEsIHN1Y2ggYXMgdW5pcXVlIGlkZW50aWZpZXJzIGFuZCBzdGFuZGFyZCBpbmZvcm1hdGlvbiBzZW50IGJ5IGEgZGV2aWNlIGZvciBwZXJzb25hbGlzZWQgYWRzIGFuZCBjb250ZW50LCBhZCBhbmQgY29udGVudCBtZWFzdXJlbWVudCwgYW5kIGF1ZGllbmNlIGluc2lnaHRzLCBhcyB3ZWxsIGFzIHRvIGRldmVsb3AgYW5kIGltcHJvdmUgcHJvZHVjdHMuIiwiV2l0aCB5b3VyIHBlcm1pc3Npb24gd2UgYW5kIG91ciBwYXJ0bmVycyBtYXkgdXNlIHByZWNpc2UgZ2VvbG9jYXRpb24gZGF0YSBhbmQgaWRlbnRpZmljYXRpb24gdGhyb3VnaCBkZXZpY2Ugc2Nhbm5pbmcuWW91IG1heSBjbGljayB0byBjb25zZW50IHRvIG91ciBhbmQgb3VyIHBhcnRuZXJzXHUyMDE5IHByb2Nlc3NpbmcgYXMgZGVzY3JpYmVkIGFib3ZlLiBBbHRlcm5hdGl2ZWx5IHlvdSBtYXkgY2xpY2sgdG8gcmVmdXNlIHRvIGNvbnNlbnQgb3IgYWNjZXNzIG1vcmUgZGV0YWlsZWQgaW5mb3JtYXRpb24gYW5kIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGJlZm9yZSBjb25zZW50aW5nLiBQbGVhc2Ugbm90ZSB0aGF0IHNvbWUgcHJvY2Vzc2luZyBvZiB5b3VyIHBlcnNvbmFsIGRhdGEgbWF5IG5vdCByZXF1aXJlIHlvdXIgY29uc2VudCwgYnV0IHlvdSBoYXZlIGEgcmlnaHQgdG8gb2JqZWN0IHRvIHN1Y2ggcHJvY2Vzc2luZy4gWW91ciBwcmVmZXJlbmNlcyB3aWxsIGFwcGx5IGFjcm9zcyB0aGUgd2ViLllvdSBjYW4gY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYXQgYW55IHRpbWUgYnkgcmV0dXJuaW5nIHRvIHRoaXMgc2l0ZSBvciB2aXNpdCBvdXIgcHJpdmFjeSBwb2xpY3kuIl0sInN1bW1hcnlTY3JlZW5Cb2R5UmVqZWN0R3JvdXAiOlsiV2UgYW5kIG91ciBwYXJ0bmVycyBzdG9yZSBhbmQvb3IgYWNjZXNzIGluZm9ybWF0aW9uIG9uIGEgZGV2aWNlLCBzdWNoIGFzIGNvb2tpZXMgYW5kIHByb2Nlc3MgcGVyc29uYWwgZGF0YSwgc3VjaCBhcyB1bmlxdWUgaWRlbnRpZmllcnMgYW5kIHN0YW5kYXJkIGluZm9ybWF0aW9uIHNlbnQgYnkgYSBkZXZpY2UgZm9yIHBlcnNvbmFsaXNlZCBhZHMgYW5kIGNvbnRlbnQsIGFkIGFuZCBjb250ZW50IG1lYXN1cmVtZW50LCBhbmQgYXVkaWVuY2UgaW5zaWdodHMsIGFzIHdlbGwgYXMgdG8gZGV2ZWxvcCBhbmQgaW1wcm92ZSBwcm9kdWN0cy4iLCJXaXRoIHlvdXIgcGVybWlzc2lvbiB3ZSBhbmQgb3VyIHBhcnRuZXJzIG1heSB1c2UgcHJlY2lzZSBnZW9sb2NhdGlvbiBkYXRhIGFuZCBpZGVudGlmaWNhdGlvbiB0aHJvdWdoIGRldmljZSBzY2FubmluZy4gWW91IG1heSBjbGljayB0byBjb25zZW50IHRvIG91ciBhbmQgb3VyIHBhcnRuZXJzXHUyMDE5IHByb2Nlc3NpbmcgYXMgZGVzY3JpYmVkIGFib3ZlLiBBbHRlcm5hdGl2ZWx5IHlvdSBtYXkgY2xpY2sgdG8gcmVmdXNlIHRvIGNvbnNlbnQgb3IgYWNjZXNzIG1vcmUgZGV0YWlsZWQgaW5mb3JtYXRpb24gYW5kIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGJlZm9yZSBjb25zZW50aW5nLiBQbGVhc2Ugbm90ZSB0aGF0IHNvbWUgcHJvY2Vzc2luZyBvZiB5b3VyIHBlcnNvbmFsIGRhdGEgbWF5IG5vdCByZXF1aXJlIHlvdXIgY29uc2VudCwgYnV0IHlvdSBoYXZlIGEgcmlnaHQgdG8gb2JqZWN0IHRvIHN1Y2ggcHJvY2Vzc2luZy4gWW91ciBwcmVmZXJlbmNlcyB3aWxsIGFwcGx5IHRvIGEgZ3JvdXAgb2Ygd2Vic2l0ZXMuIFlvdSBjYW4gY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYXQgYW55IHRpbWUgYnkgcmV0dXJuaW5nIHRvIHRoaXMgc2l0ZSBvciB2aXNpdCBvdXIgcHJpdmFjeSBwb2xpY3kuIl0sImluaXRTY3JlZW5Cb2R5R2xvYmFsIjoiV2UgYW5kIG91ciBwYXJ0bmVycyBzdG9yZSBvciBhY2Nlc3MgaW5mb3JtYXRpb24gb24gZGV2aWNlcywgc3VjaCBhcyBjb29raWVzIGFuZCBwcm9jZXNzIHBlcnNvbmFsIGRhdGEsIHN1Y2ggYXMgdW5pcXVlIGlkZW50aWZpZXJzIGFuZCBzdGFuZGFyZCBpbmZvcm1hdGlvbiBzZW50IGJ5IGEgZGV2aWNlIGZvciB0aGUgcHVycG9zZXMgZGVzY3JpYmVkIGJlbG93LiBZb3UgbWF5IGNsaWNrIHRvIGNvbnNlbnQgdG8gb3VyIGFuZCBvdXIgcGFydG5lcnNcdTIwMTkgcHJvY2Vzc2luZyBmb3Igc3VjaCBwdXJwb3Nlcy4gQWx0ZXJuYXRpdmVseSwgeW91IG1heSBjbGljayB0byByZWZ1c2UgdG8gY29uc2VudCwgb3IgYWNjZXNzIG1vcmUgZGV0YWlsZWQgaW5mb3JtYXRpb24gdG8gY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYmVmb3JlIGNvbnNlbnRpbmcuIFlvdXIgcHJlZmVyZW5jZXMgd2lsbCBhcHBseSBhY3Jvc3MgdGhlIHdlYi4gUGxlYXNlIG5vdGUgdGhhdCBzb21lIHByb2Nlc3Npbmcgb2YgeW91ciBwZXJzb25hbCBkYXRhIG1heSBub3QgcmVxdWlyZSB5b3VyIGNvbnNlbnQsIGJ1dCB5b3UgaGF2ZSBhIHJpZ2h0IHRvIG9iamVjdCB0byBzdWNoIHByb2Nlc3NpbmcuIFlvdSBjYW4gY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYXQgYW55IHRpbWUgYnkgcmV0dXJuaW5nIHRvIHRoaXMgc2l0ZSBvciB2aXNpdCBvdXIgcHJpdmFjeSBwb2xpY3kuIiwiaW5pdFNjcmVlbkJvZHlTZXJ2aWNlIjoiV2UgYW5kIG91ciBwYXJ0bmVycyBzdG9yZSBvciBhY2Nlc3MgaW5mb3JtYXRpb24gb24gZGV2aWNlcywgc3VjaCBhcyBjb29raWVzIGFuZCBwcm9jZXNzIHBlcnNvbmFsIGRhdGEsIHN1Y2ggYXMgdW5pcXVlIGlkZW50aWZpZXJzIGFuZCBzdGFuZGFyZCBpbmZvcm1hdGlvbiBzZW50IGJ5IGEgZGV2aWNlIGZvciB0aGUgcHVycG9zZXMgZGVzY3JpYmVkIGJlbG93LiBZb3UgbWF5IGNsaWNrIHRvIGNvbnNlbnQgdG8gb3VyIGFuZCBvdXIgcGFydG5lcnNcdTIwMTkgcHJvY2Vzc2luZyBmb3Igc3VjaCBwdXJwb3Nlcy4gQWx0ZXJuYXRpdmVseSwgeW91IG1heSBjbGljayB0byByZWZ1c2UgdG8gY29uc2VudCwgb3IgYWNjZXNzIG1vcmUgZGV0YWlsZWQgaW5mb3JtYXRpb24gYW5kIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGJlZm9yZSBjb25zZW50aW5nLiBZb3VyIHByZWZlcmVuY2VzIHdpbGwgYXBwbHkgdG8gdGhpcyB3ZWJzaXRlIG9ubHkuIFBsZWFzZSBub3RlIHRoYXQgc29tZSBwcm9jZXNzaW5nIG9mIHlvdXIgcGVyc29uYWwgZGF0YSBtYXkgbm90IHJlcXVpcmUgeW91ciBjb25zZW50LCBidXQgeW91IGhhdmUgYSByaWdodCB0byBvYmplY3QgdG8gc3VjaCBwcm9jZXNzaW5nLiBZb3UgY2FuIGNoYW5nZSB5b3VyIHByZWZlcmVuY2VzIGF0IGFueSB0aW1lIGJ5IHJldHVybmluZyB0byB0aGlzIHNpdGUgb3IgdmlzaXQgb3VyIHByaXZhY3kgcG9saWN5LiIsImluaXRTY3JlZW5Cb2R5R3JvdXAiOiJXZSBhbmQgb3VyIHBhcnRuZXJzIHN0b3JlIG9yIGFjY2VzcyBpbmZvcm1hdGlvbiBvbiBkZXZpY2VzLCBzdWNoIGFzIGNvb2tpZXMgYW5kIHByb2Nlc3MgcGVyc29uYWwgZGF0YSwgc3VjaCBhcyB1bmlxdWUgaWRlbnRpZmllcnMgYW5kIHN0YW5kYXJkIGluZm9ybWF0aW9uIHNlbnQgYnkgYSBkZXZpY2UgZm9yIHRoZSBwdXJwb3NlcyBkZXNjcmliZWQgYmVsb3cuIFlvdSBtYXkgY2xpY2sgdG8gY29uc2VudCB0byBvdXIgYW5kIG91ciBwYXJ0bmVyc1x1MjAxOSBwcm9jZXNzaW5nIGZvciBzdWNoIHB1cnBvc2VzLiBBbHRlcm5hdGl2ZWx5LCB5b3UgbWF5IGNsaWNrIHRvIHJlZnVzZSB0byBjb25zZW50LCBvciBhY2Nlc3MgbW9yZSBkZXRhaWxlZCBpbmZvcm1hdGlvbiBhbmQgY2hhbmdlIHlvdXIgcHJlZmVyZW5jZXMgYmVmb3JlIGNvbnNlbnRpbmcuIFlvdXIgcHJlZmVyZW5jZXMgd2lsbCBhcHBseSB0byBhIGdyb3VwIG9mIHdlYnNpdGVzLiBQbGVhc2Ugbm90ZSB0aGF0IHNvbWUgcHJvY2Vzc2luZyBvZiB5b3VyIHBlcnNvbmFsIGRhdGEgbWF5IG5vdCByZXF1aXJlIHlvdXIgY29uc2VudCwgYnV0IHlvdSBoYXZlIGEgcmlnaHQgdG8gb2JqZWN0IHRvIHN1Y2ggcHJvY2Vzc2luZy4gWW91IGNhbiBjaGFuZ2UgeW91ciBwcmVmZXJlbmNlcyBhdCBhbnkgdGltZSBieSByZXR1cm5pbmcgdG8gdGhpcyBzaXRlIG9yIHZpc2l0IG91ciBwcml2YWN5IHBvbGljeS4iLCJzcGVjaWFsUHVycG9zZXNBbmRGZWF0dXJlcyI6IlNwZWNpYWwgUHVycG9zZXMgYW5kIEZlYXR1cmVzIiwic2F2ZUFuZEV4aXRCdXR0b24iOiJTQVZFICYgRVhJVCIsImFncmVlVG9TZWxlY3RlZEJ1dHRvbiI6IkFHUkVFIFRPIFNFTEVDVEVEIiwicHVycG9zZVNjcmVlblZlbmRvckxpbmsiOiJQQVJUTkVSUyIsImxlZ2l0aW1hdGVJbnRlcmVzdExpbmsiOiJMRUdJVElNQVRFIElOVEVSRVNUICIsInNwZWNpYWxQdXJwb3Nlc0xhYmVsIjoiU3BlY2lhbCBQdXJwb3NlcyIsInNwZWNpYWxGZWF0dXJlc0xhYmVsIjoiU3BlY2lhbCBGZWF0dXJlcyIsImZlYXR1cmVzTGFiZWwiOiJGZWF0dXJlcyIsImJhY2siOiJCYWNrIiwib25MYWJlbCI6Ik9OIiwib2ZmTGFiZWwiOiJPRkYiLCJtdWx0aUxhYmVsIjoiTVVMVEkiLCJsZWdhbERlc2NyaXB0aW9uIjoiTGVnYWwgRGVzY3JpcHRpb24iLCJzaG93UGFydG5lcnMiOiJTaG93IFBhcnRuZXJzIiwiaGlkZVBhcnRuZXJzIjoiSGlkZSBQYXJ0bmVycyIsInZlbmRvclNjcmVlbkJvZHkiOiJSZXZpZXcgYW5kIHNldCB5b3VyIGNvbnNlbnQgcHJlZmVyZW5jZXMgZm9yIGVhY2ggcGFydG5lciBiZWxvdy4gRXhwYW5kIGVhY2ggcGFydG5lciBsaXN0IGl0ZW0gZm9yIG1vcmUgaW5mb3JtYXRpb24gdG8gaGVscCBtYWtlIHlvdXIgY2hvaWNlLiBTb21lIHBlcnNvbmFsIGRhdGEgaXMgcHJvY2Vzc2VkIHdpdGhvdXQgeW91ciBjb25zZW50LCBidXQgeW91IGhhdmUgdGhlIHJpZ2h0IHRvIG9iamVjdC4iLCJwcml2YWN5UG9saWN5TGFiZWwiOiJQcml2YWN5IFBvbGljeSIsImRlc2NyaXB0aW9uTGFiZWwiOiJWZW5kb3IgRGVzY3JpcHRpb24iLCJsZWdpdGltYXRlU2NyZWVuQm9keSI6IlJldmlldyBhbmQgb2JqZWN0IHRvIHByb2Nlc3Npbmcgb2YgcGVyc29uYWwgZGF0YSB3aXRob3V0IHlvdXIgY29uc2VudCBvbiB0aGUgYmFzaXMgb2YgYSBsZWdpdGltYXRlIGludGVyZXN0IGZvciBlYWNoIHB1cnBvc2UgYW5kIGJ5IGVhY2ggcGFydG5lciBiZWxvdy4gRXhwYW5kIGVhY2ggcHVycG9zZSBvciBwYXJ0bmVyIGxpc3QgaXRlbSBmb3IgbW9yZSBpbmZvcm1hdGlvbiB0byBoZWxwIG1ha2UgeW91ciBjaG9pY2UuIFRvIG9iamVjdCB0byB0aGUgc3BlY2lhbCBwdXJwb3NlcyBvZiBlbnN1cmluZyBzZWN1cml0eSwgcHJldmVudGluZyBmcmF1ZCwgYW5kIGRlYnVnZ2luZywgYW5kIHRlY2huaWNhbGx5IGRlbGl2ZXJpbmcgYWRzIG9yIGNvbnRlbnQgY2xpY2sgb24gYSBwYXJ0bmVyXCdzIHByaXZhY3kgcG9saWN5IGxpbmsuIiwibGVnaXRpbWF0ZUludGVyZXN0UHVycG9zZXNMYWJlbCI6IkxlZ2l0aW1hdGUgSW50ZXJlc3QgUHVycG9zZShzKSIsImxlZ2l0aW1hdGVJbnRlcmVzdFZlbmRvckxhYmVsIjoiTGVnaXRpbWF0ZSBJbnRlcmVzdCBWZW5kb3JzIiwibGVnaXRpbWF0ZVNjcmVlbk9iamVjdCI6Ik9CSkVDVCIsImxlZ2l0aW1hdGVTY3JlZW5PYmplY3RlZCI6Ik9CSkVDVEVEIiwibGVnaXRpbWF0ZVNjcmVlbkFjY2VwdCI6IlJFTU9WRSBPQkpFQ1RJT04iLCJvYmplY3RBbGxCdXR0b24iOiJPQkpFQ1QgQUxMIiwicGVyc2lzdGVudENvbnNlbnRMaW5rTGFiZWwiOiJQcml2YWN5Iiwibm9uSWFiVmVuZG9yc05vdGljZSI6IlZlbmRvcnMgd2hvIGRvIG5vdCBwYXJ0aWNpcGF0ZSBpbiB0aGUgSUFCIEV1cm9wZSBUcmFuc3BhcmVuY3kgYW5kIENvbnNlbnQgRnJhbWV3b3JrIGFuZCBkbyBub3QgYWRoZXJlIHRvIGl0cyBwb2xpY2llcyBvciB0ZWNobmljYWwgc3BlY2lmaWNhdGlvbnMiLCJnb29nbGVQYXJ0bmVycyI6Ikdvb2dsZSBQYXJ0bmVycyIsInB1cnBvc2VzTGFiZWwiOiJQdXJwb3NlcyIsImNvb2tpZU1heEFnZUxhYmVsIjoiQ29va2llIG1heCBhZ2UiLCJzZWNvbmRzTGFiZWwiOiJTZWNvbmRzIiwic3RvcmFnZURpc2Nsb3N1cmVMYWJlbCI6IlN0b3JhZ2UgZGlzY2xvc3VyZSIsImRheXNMYWJlbCI6IkRheXMifSwicHJlbWl1bVVpTGFiZWxzIjp7ImxpbmtzVGl0bGUiOiJBZGRpdGlvbmFsIExpbmtzIiwibm9uSWFiVmVuZG9yc0xhYmVsIjoiTm9uLUlBQiBWZW5kb3JzIiwidXNwQWNjZXB0QnV0dG9uIjoiQ09ORklSTSIsInVzcEFjY2Vzc0RhdGFMaW5rVGV4dCI6IkRhdGEgQWNjZXNzIiwidXNwRGVsZXRlRGF0YUxpbmtUZXh0IjoiRGF0YSBEZWxldGlvbiIsInVzcERuc1RpdGxlIjoiRG8gTm90IFNlbGwgTXkgUGVyc29uYWwgSW5mb3JtYXRpb24iLCJ1c3BEb05vdFNlbGxUb2dnbGVUZXh0IjoiSSB3YW50IHRvIG1ha2UgYSBcJ0RvIE5vdCBTZWxsIE15IFBlcnNvbmFsIEluZm9ybWF0aW9uXCcgcmVxdWVzdC4gTm90ZTogdGhpcyBhY3Rpb24gd2lsbCBtYWtlIGl0IGhhcmRlciB0byB1cyB0byB0YWlsb3IgY29udGVudCBmb3IgeW91LiIsInVzcFByaXZhY3lQb2xpY3lMaW5rVGV4dCI6IlByaXZhY3kgUG9saWN5IiwidXNwRG5zVGV4dCI6WyJXZSwgYW5kIG91ciBwYXJ0bmVycywgdXNlIHRlY2hub2xvZ2llcyB0byBwcm9jZXNzIHBlcnNvbmFsIGluZm9ybWF0aW9uLCBpbmNsdWRpbmcgSVAgYWRkcmVzc2VzLCBwc2V1ZG9ueW1vdXMgaWRlbnRpZmllcnMgYXNzb2NpYXRlZCB3aXRoIGNvb2tpZXMsIGFuZCBpbiBzb21lIGNhc2VzIG1vYmlsZSBhZCBJRHMuIFRoaXMgaW5mb3JtYXRpb24gaXMgcHJvY2Vzc2VkIHRvIHBlcnNvbmFsaXplIGNvbnRlbnQgYmFzZWQgb24geW91ciBpbnRlcmVzdHMsIHJ1biBhbmQgb3B0aW1pemUgbWFya2V0aW5nIGNhbXBhaWducywgbWVhc3VyZSB0aGUgcGVyZm9ybWFuY2Ugb2YgYWRzIGFuZCBjb250ZW50LCBhbmQgZGVyaXZlIGluc2lnaHRzIGFib3V0IHRoZSBhdWRpZW5jZXMgd2hvIGVuZ2FnZSB3aXRoIGFkcyBhbmQgY29udGVudC4gVGhpcyBkYXRhIGlzIGFuIGludGVncmFsIHBhcnQgb2YgaG93IHdlIG9wZXJhdGUgb3VyIHNpdGUsIG1ha2UgcmV2ZW51ZSB0byBzdXBwb3J0IG91ciBzdGFmZiwgYW5kIGdlbmVyYXRlIHJlbGV2YW50IGNvbnRlbnQgZm9yIG91ciBhdWRpZW5jZS4gWW91IGNhbiBsZWFybiBtb3JlIGFib3V0IG91ciBkYXRhIGNvbGxlY3Rpb24gYW5kIHVzZSBwcmFjdGljZXMgaW4gb3VyIFByaXZhY3kgUG9saWN5Li0iLCJJZiB5b3Ugd2lzaCB0byByZXF1ZXN0IHRoYXQgeW91ciBwZXJzb25hbCBpbmZvcm1hdGlvbiBpcyBub3Qgc2hhcmVkIHdpdGggdGhpcmQgcGFydGllcywgcGxlYXNlIGNsaWNrIG9uIHRoZSBiZWxvdyBjaGVja2JveCBhbmQgY29uZmlybSB5b3VyIHNlbGVjdGlvbi4gUGxlYXNlIG5vdGUgdGhhdCBhZnRlciB5b3VyIG9wdCBvdXQgcmVxdWVzdCBpcyBwcm9jZXNzZWQsIHdlIG1heSBzdGlsbCBjb2xsZWN0IHlvdXIgaW5mb3JtYXRpb24gaW4gb3JkZXIgdG8gb3BlcmF0ZSBvdXIgc2l0ZS5cXG4iXX19Jyk7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAobnVsbCA9PSB0IHx8IHQgPiBlLmxlbmd0aCkgJiYgKHQgPSBlLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDAsIHIgPSBuZXcgQXJyYXkodCk7IG4gPCB0OyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHJbbl0gPSBlW25dOwogICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9PSB0eXBlb2YgU3ltYm9sICYmIFN5bWJvbC5pdGVyYXRvciBpbiBPYmplY3QoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5mcm9tKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChlKS5zbGljZSg4LCAtMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnT2JqZWN0JyA9PT0gbiAmJiBlLmNvbnN0cnVjdG9yICYmIChuID0gZS5jb25zdHJ1Y3Rvci5uYW1lKSwgJ01hcCcgPT09IG4gfHwgJ1NldCcgPT09IG4gPyBBcnJheS5mcm9tKG4pIDogJ0FyZ3VtZW50cycgPT09IG4gfHwgL14oPzpVaXxJKW50KD86OHwxNnwzMikoPzpDbGFtcGVkKT9BcnJheSQvLnRlc3QobikgPyByKGUsIHQpIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByKGUpOwogICAgICAgICAgICAgICAgICAgIH0oZSkgfHwgbyhlKSB8fCBpKGUpIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSW52YWxpZCBhdHRlbXB0IHRvIHNwcmVhZCBub24taXRlcmFibGUgaW5zdGFuY2UuXG5JbiBvcmRlciB0byBiZSBpdGVyYWJsZSwgbm9uLWFycmF5IG9iamVjdHMgbXVzdCBoYXZlIGEgW1N5bWJvbC5pdGVyYXRvcl0oKSBtZXRob2QuJyk7CiAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYygpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbnZhbGlkIGF0dGVtcHQgdG8gZGVzdHJ1Y3R1cmUgbm9uLWl0ZXJhYmxlIGluc3RhbmNlLlxuSW4gb3JkZXIgdG8gYmUgaXRlcmFibGUsIG5vbi1hcnJheSBvYmplY3RzIG11c3QgaGF2ZSBhIFtTeW1ib2wuaXRlcmF0b3JdKCkgbWV0aG9kLicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnID09PSB0eXBlb2YgU3ltYm9sIHx8IG51bGwgPT0gZVtTeW1ib2wuaXRlcmF0b3JdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGUpIHx8IChlID0gaShlKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gMCwgbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG46IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPj0gZS5sZW5ndGggPyB7IGRvbmU6ICEwIH0gOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlW3QrK10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ludmFsaWQgYXR0ZW1wdCB0byBpdGVyYXRlIG5vbi1pdGVyYWJsZSBpbnN0YW5jZS5cbkluIG9yZGVyIHRvIGJlIGl0ZXJhYmxlLCBub24tYXJyYXkgb2JqZWN0cyBtdXN0IGhhdmUgYSBbU3ltYm9sLml0ZXJhdG9yXSgpIG1ldGhvZC4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIHIsIG8sIGEgPSAhMCwgcyA9ICExOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBlW1N5bWJvbC5pdGVyYXRvcl0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgbjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSByLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhID0gZS5kb25lLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9ICEwLCBvID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhIHx8IG51bGwgPT0gci5yZXR1cm4gfHwgci5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCEoZSBpbnN0YW5jZW9mIHQpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdDYW5ub3QgY2FsbCBhIGNsYXNzIGFzIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGYoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgdC5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRbbl07CiAgICAgICAgICAgICAgICAgICAgICAgIHIuZW51bWVyYWJsZSA9IHIuZW51bWVyYWJsZSB8fCAhMSwgci5jb25maWd1cmFibGUgPSAhMCwgJ3ZhbHVlJyBpbiByICYmIChyLndyaXRhYmxlID0gITApLCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgci5rZXksIHIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIGYoZS5wcm90b3R5cGUsIHQpLCBuICYmIGYoZSwgbiksIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCBpbiBlID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICB9KSA6IGVbdF0gPSBuLCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gaChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgKHIgPSByLmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoZSwgdCkuZW51bWVyYWJsZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBuLnB1c2guYXBwbHkobiwgcik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbShlKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBudWxsICE9IGFyZ3VtZW50c1t0XSA/IGFyZ3VtZW50c1t0XSA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB0ICUgMiA/IGgoT2JqZWN0KG4pLCAhMCkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZChlLCB0LCBuW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGUsIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKG4pKSA6IGgoT2JqZWN0KG4pKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihuLCB0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGcoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoLCBuID0gQXJyYXkodCA+IDEgPyB0IC0gMSA6IDApLCByID0gMTsgciA8IHQ7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgbltyIC0gMV0gPSBhcmd1bWVudHNbcl07CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1tJbW1lcl0gbWluaWZpZWQgZXJyb3IgbnI6ICcgKyBlICsgKG4ubGVuZ3RoID8gJyAnICsgbi5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdcJycgKyBlICsgJ1wnJzsKICAgICAgICAgICAgICAgICAgICB9KS5qb2luKCcsJykgOiAnJykgKyAnLiBGaW5kIHRoZSBmdWxsIGVycm9yIGF0OiBodHRwczovL2JpdC5seS8zY1hFS1dmJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlICYmICEhZVtpZV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5KGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlICYmIChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUgfHwgJ29iamVjdCcgIT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gT2JqZWN0LmdldFByb3RvdHlwZU9mKGUpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXQgfHwgdCA9PT0gT2JqZWN0LnByb3RvdHlwZTsKICAgICAgICAgICAgICAgICAgICB9KGUpIHx8IEFycmF5LmlzQXJyYXkoZSkgfHwgISFlW29lXSB8fCAhIWUuY29uc3RydWN0b3Jbb2VdIHx8IGsoZSkgfHwgVChlKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IG4gJiYgKG4gPSAhMSksIDAgPT09IEUoZSkgPyAobiA/IE9iamVjdC5rZXlzIDogYWUpKGUpLmZvckVhY2goZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgciB8fCB0KHIsIGVbcl0sIGUpOwogICAgICAgICAgICAgICAgICAgIH0pIDogZS5mb3JFYWNoKGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KHIsIG4sIGUpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW2llXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA/IHQuaSA+IDMgPyB0LmkgLSA0IDogdC5pIDogQXJyYXkuaXNBcnJheShlKSA/IDEgOiBrKGUpID8gMiA6IFQoZSkgPyAzIDogMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHcoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAyID09PSBFKGUpID8gZS5oYXModCkgOiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSwgdCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB4KGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMiA9PT0gRShlKSA/IGUuZ2V0KHQpIDogZVt0XTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gRShlKTsKICAgICAgICAgICAgICAgICAgICAyID09PSByID8gZS5zZXQodCwgbikgOiAzID09PSByID8gKGUuZGVsZXRlKHQpLCBlLmFkZChuKSkgOiBlW3RdID0gbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSB0ID8gMCAhPT0gZSB8fCAxIC8gZSA9PSAxIC8gdCA6IGUgIT0gZSAmJiB0ICE9IHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBrKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWUgJiYgZSBpbnN0YW5jZW9mIE1hcDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFQoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ZSAmJiBlIGluc3RhbmNlb2YgU2V0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gXyhlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubyB8fCBlLnQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBQKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGUpOwogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gc2UoZSk7CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHRbaWVdOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBhZSh0KSwgciA9IDA7IHIgPCBuLmxlbmd0aDsgcisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gbltyXSwgaSA9IHRbb107CiAgICAgICAgICAgICAgICAgICAgICAgICExID09PSBpLndyaXRhYmxlICYmIChpLndyaXRhYmxlID0gITAsIGkuY29uZmlndXJhYmxlID0gITApLCAoaS5nZXQgfHwgaS5zZXQpICYmICh0W29dID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGkuZW51bWVyYWJsZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlW29dCiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmNyZWF0ZShPYmplY3QuZ2V0UHJvdG90eXBlT2YoZSksIHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgTChlKSB8fCB2KGUpIHx8ICF5KGUpIHx8IChFKGUpID4gMSAmJiAoZS5zZXQgPSBlLmFkZCA9IGUuY2xlYXIgPSBlLmRlbGV0ZSA9IEkpLCBPYmplY3QuZnJlZXplKGUpLCB0ICYmIGIoZSwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE8odCwgITApOwogICAgICAgICAgICAgICAgICAgIH0sICEwKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBJKCkgewogICAgICAgICAgICAgICAgICAgIGcoMik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBlIHx8ICdvYmplY3QnICE9IHR5cGVvZiBlIHx8IE9iamVjdC5pc0Zyb3plbihlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEEoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gY2VbZV07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgfHwgZygxOCwgZSksIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBSKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBjZVtlXSB8fCAoY2VbZV0gPSB0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE4oKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBqKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB0ICYmIChBKCdQYXRjaGVzJyksIGUudSA9IFtdLCBlLnMgPSBbXSwgZS52ID0gdCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBxKGUpIHsKICAgICAgICAgICAgICAgICAgICBGKGUpLCBlLnAuZm9yRWFjaChNKSwgZS5wID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEYoZSkgewogICAgICAgICAgICAgICAgICAgIGUgPT09IFggJiYgKFggPSBlLmwpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFggPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHA6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBsOiBYLAogICAgICAgICAgICAgICAgICAgICAgICBoOiBlLAogICAgICAgICAgICAgICAgICAgICAgICBtOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgXzogMAogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBNKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGVbaWVdOwogICAgICAgICAgICAgICAgICAgIDAgPT09IHQuaSB8fCAxID09PSB0LmkgPyB0LmooKSA6IHQuZyA9ICEwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gVShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdC5fID0gdC5wLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQucFswXSwgciA9IHZvaWQgMCAhPT0gZSAmJiBlICE9PSBuOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmguTyB8fCBBKCdFUzUnKS5TKHQsIGUsIHIpLCByID8gKG5baWVdLlAgJiYgKHEodCksIGcoNCkpLCB5KGUpICYmIChlID0gVih0LCBlKSwgdC5sIHx8IHoodCwgZSkpLCB0LnUgJiYgQSgnUGF0Y2hlcycpLk0obltpZV0sIGUsIHQudSwgdC5zKSkgOiBlID0gVih0LCBuLCBbXSksIHEodCksIHQudSAmJiB0LnYodC51LCB0LnMpLCBlICE9PSByZSA/IGUgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBWKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoTCh0KSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0W2llXTsKICAgICAgICAgICAgICAgICAgICBpZiAoIXIpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKHQsIGZ1bmN0aW9uIChvLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQihlLCByLCB0LCBvLCBpLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApLCB0OwogICAgICAgICAgICAgICAgICAgIGlmIChyLkEgIT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIGlmICghci5QKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geihlLCByLnQsICEwKSwgci50OwogICAgICAgICAgICAgICAgICAgIGlmICghci5JKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHIuSSA9ICEwLCByLkEuXy0tOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IDQgPT09IHIuaSB8fCA1ID09PSByLmkgPyByLm8gPSBQKHIuaykgOiByLm87CiAgICAgICAgICAgICAgICAgICAgICAgIGIoMyA9PT0gci5pID8gbmV3IFNldChvKSA6IG8sIGZ1bmN0aW9uICh0LCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQihlLCByLCBvLCB0LCBpLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHooZSwgbywgITEpLCBuICYmIGUudSAmJiBBKCdQYXRjaGVzJykuUihyLCBuLCBlLnUsIGUucyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiByLm87CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBCKGUsIHQsIG4sIHIsIG8sIGkpIHsKICAgICAgICAgICAgICAgICAgICBpZiAodihvKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFYoZSwgbywgaSAmJiB0ICYmIDMgIT09IHQuaSAmJiAhdyh0LkQsIHIpID8gaS5jb25jYXQocikgOiB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoUyhuLCByLCBhKSwgIXYoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIGUubSA9ICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoeShvKSAmJiAhTChvKSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUuaC5OICYmIGUuXyA8IDEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIFYoZSwgbyksIHQgJiYgdC5BLmwgfHwgeihlLCBvKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB6KGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IG4gJiYgKG4gPSAhMSksIGUuaC5OICYmIGUubSAmJiBPKHQsIG4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlW2llXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG4gPyBfKG4pIDogZSlbdF07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBIKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAodCBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gT2JqZWN0LmdldFByb3RvdHlwZU9mKGUpOyBuOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gT2JqZWN0LmdldFByb3RvdHlwZU9mKG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBXKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLlAgfHwgKGUuUCA9ICEwLCBlLmwgJiYgVyhlLmwpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uICQoZSkgewogICAgICAgICAgICAgICAgICAgIGUubyB8fCAoZS5vID0gUChlLnQpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFkoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByID0gayh0KSA/IEEoJ01hcFNldCcpLlQodCwgbikgOiBUKHQpID8gQSgnTWFwU2V0JykuRih0LCBuKSA6IGUuTyA/IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gQXJyYXkuaXNBcnJheShlKSwgciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpOiBuID8gMSA6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQTogdCA/IHQuQSA6IE4oKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQ6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgazogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGo6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8gPSByLCBpID0gdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgKG8gPSBbcl0sIGkgPSBsZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gUHJveHkucmV2b2NhYmxlKG8sIGkpLCBzID0gYS5yZXZva2UsIGMgPSBhLnByb3h5OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5rID0gYywgci5qID0gcywgYzsKICAgICAgICAgICAgICAgICAgICB9KHQsIG4pIDogQSgnRVM1JykuSih0LCBuKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG4gPyBuLkEgOiBOKCkpLnAucHVzaChyKSwgcjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBNYXAoZSk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuZnJvbShlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFAoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBLKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG9bZV07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID8gbi5lbnVtZXJhYmxlID0gdCA6IG9bZV0gPSBuID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXNbaWVdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1ZS5nZXQodCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpc1tpZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWUuc2V0KG4sIGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LCBuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IGUubGVuZ3RoIC0gMTsgdCA+PSAwOyB0LS0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZVt0XVtpZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8uUCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKG8uaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihvKSAmJiBXKG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4obykgJiYgVyhvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBlLnQsIG4gPSBlLmssIHIgPSBhZShuKSwgbyA9IHIubGVuZ3RoIC0gMTsgbyA+PSAwOyBvLS0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gcltvXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpICE9PSBpZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdFtpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBhICYmICF3KHQsIGkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBuW2ldLCBjID0gcyAmJiBzW2llXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA/IGMudCAhPT0gYSA6ICFDKHMsIGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSAhIXRbaWVdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5sZW5ndGggIT09IGFlKHQpLmxlbmd0aCArICh1ID8gMCA6IDEpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLms7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0Lmxlbmd0aCAhPT0gZS50Lmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHQsIHQubGVuZ3RoIC0gMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFuIHx8IG4uZ2V0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB7fTsKICAgICAgICAgICAgICAgICAgICBSKCdFUzUnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIEo6IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IEFycmF5LmlzQXJyYXkodCksIG8gPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IEFycmF5KG4ubGVuZ3RoKSwgbyA9IDA7IG8gPCBuLmxlbmd0aDsgbysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShyLCAnJyArIG8sIGUobywgITApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gc2Uobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBpW2llXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IGFlKGkpLCBzID0gMDsgcyA8IGEubGVuZ3RoOyBzKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYVtzXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlbY10gPSBlKGMsIHQgfHwgISFpW2NdLmVudW1lcmFibGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QuY3JlYXRlKE9iamVjdC5nZXRQcm90b3R5cGVPZihuKSwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShyLCB0KSwgaSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaTogciA/IDUgOiA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBOiBuID8gbi5BIDogTigpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEQ6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQzogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvLCBpZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIFM6IGZ1bmN0aW9uIChlLCBuLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID8gdihuKSAmJiBuW2llXS5BID09PSBlICYmIHQoZS5wKSA6IChlLnUgJiYgZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgJ29iamVjdCcgPT0gdHlwZW9mIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0W2llXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gbi50LCBpID0gbi5rLCBhID0gbi5ELCBzID0gbi5pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDQgPT09IHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYihpLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICE9PSBpZSAmJiAodm9pZCAwICE9PSBvW3RdIHx8IHcobywgdCkgPyBhW3RdIHx8IGUoaVt0XSkgOiAoYVt0XSA9ICEwLCBXKG4pKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGIobywgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBpW2VdIHx8IHcoaSwgZSkgfHwgKGFbZV0gPSAhMSwgVyhuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICg1ID09PSBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIobikgJiYgKFcobiksIGEubGVuZ3RoID0gITApLCBpLmxlbmd0aCA8IG8ubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gaS5sZW5ndGg7IGMgPCBvLmxlbmd0aDsgYysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtjXSA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdSA9IG8ubGVuZ3RoOyB1IDwgaS5sZW5ndGg7IHUrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbdV0gPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBsID0gTWF0aC5taW4oaS5sZW5ndGgsIG8ubGVuZ3RoKSwgZiA9IDA7IGYgPCBsOyBmKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gYVtmXSAmJiBlKGlbZl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlLnBbMF0pLCB0KGUucCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBLOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDQgPT09IGUuaSA/IG4oZSkgOiByKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBuLnIodCksIG4uZCh0LCAnY21wQXBpVWknLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEtvOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB2YXIgSiwgWCwgWiA9ICd1bmRlZmluZWQnICE9IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbCgneCcpLCBlZSA9ICd1bmRlZmluZWQnICE9IHR5cGVvZiBNYXAsIHRlID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIFNldCwgbmUgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2YgUHJveHkgJiYgdm9pZCAwICE9PSBQcm94eS5yZXZvY2FibGUgJiYgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIFJlZmxlY3QsIHJlID0gWiA/IFN5bWJvbC5mb3IoJ2ltbWVyLW5vdGhpbmcnKSA6ICgoSiA9IHt9KVsnaW1tZXItbm90aGluZyddID0gITAsIEopLCBvZSA9IFogPyBTeW1ib2wuZm9yKCdpbW1lci1kcmFmdGFibGUnKSA6ICdfXyRpbW1lcl9kcmFmdGFibGUnLCBpZSA9IFogPyBTeW1ib2wuZm9yKCdpbW1lci1zdGF0ZScpIDogJ19fJGltbWVyX3N0YXRlJywgYWUgPSAoJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIFN5bWJvbCAmJiBTeW1ib2wuaXRlcmF0b3IsICd1bmRlZmluZWQnICE9IHR5cGVvZiBSZWZsZWN0ICYmIFJlZmxlY3Qub3duS2V5cyA/IFJlZmxlY3Qub3duS2V5cyA6IHZvaWQgMCAhPT0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyhlKS5jb25jYXQoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyhlKSk7CiAgICAgICAgICAgICAgICAgICAgfSA6IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKSwgc2UgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyB8fCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYWUoZSkuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtuXSA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgIH0sIGNlID0ge30sIHVlID0gewogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9PT0gaWUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF8oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXcobiwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByLCBvID0gSCh0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gPyAndmFsdWUnIGluIG8gPyBvLnZhbHVlIDogbnVsbCA9PT0gKHIgPSBvLmdldCkgfHwgdm9pZCAwID09PSByID8gdm9pZCAwIDogci5jYWxsKGUuaykgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlLCBuLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gblt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLkkgfHwgIXkocikgPyByIDogciA9PT0gRyhlLnQsIHQpID8gKCQoZSksIGUub1t0XSA9IFkoZS5BLmgsIHIsIGUpKSA6IHI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGhhczogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0IGluIF8oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG93bktleXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUmVmbGVjdC5vd25LZXlzKF8oZSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IEgoXyhlKSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSByID8gdm9pZCAwIDogci5zZXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuc2V0LmNhbGwoZS5rLCBuKSwgITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUuUCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gRyhfKGUpLCB0KSwgaSA9IG51bGwgPT0gbyA/IHZvaWQgMCA6IG9baWVdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpICYmIGkudCA9PT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUub1t0XSA9IG4sIGUuRFt0XSA9ICExLCAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoQyhuLCBvKSAmJiAodm9pZCAwICE9PSBuIHx8IHcoZS50LCB0KSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkKGUpLCBXKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUub1t0XSA9IG4sIGUuRFt0XSA9ICEwLCAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlUHJvcGVydHk6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBHKGUudCwgdCkgfHwgdCBpbiBlLnQgPyAoZS5EW3RdID0gITEsICQoZSksIFcoZSkpIDogZGVsZXRlIGUuRFt0XSwgZS5vICYmIGRlbGV0ZSBlLm9bdF0sICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBnZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3I6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IF8oZSksIHIgPSBSZWZsZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihuLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IDEgIT09IGUuaSB8fCAnbGVuZ3RoJyAhPT0gdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiByLmVudW1lcmFibGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG5bdF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiByOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBkZWZpbmVQcm9wZXJ0eTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZygxMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGdldFByb3RvdHlwZU9mOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5nZXRQcm90b3R5cGVPZihlLnQpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzZXRQcm90b3R5cGVPZjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZygxMik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBsZSA9IHt9OwogICAgICAgICAgICAgICAgYih1ZSwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBsZVtlXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFyZ3VtZW50c1swXSA9IGFyZ3VtZW50c1swXVswXSwgdC5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KSwgbGUuZGVsZXRlUHJvcGVydHkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB1ZS5kZWxldGVQcm9wZXJ0eS5jYWxsKHRoaXMsIGVbMF0sIHQpOwogICAgICAgICAgICAgICAgfSwgbGUuc2V0ID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdWUuc2V0LmNhbGwodGhpcywgZVswXSwgdCwgbiwgZVswXSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIGZlID0gbmV3IChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5PID0gbmUsIHRoaXMuTiA9ICExLCAnYm9vbGVhbicgPT0gdHlwZW9mIChudWxsID09IGUgPyB2b2lkIDAgOiBlLnVzZVByb3hpZXMpICYmIHRoaXMuc2V0VXNlUHJveGllcyhlLnVzZVByb3hpZXMpLCAnYm9vbGVhbicgPT0gdHlwZW9mIChudWxsID09IGUgPyB2b2lkIDAgOiBlLmF1dG9GcmVlemUpICYmIHRoaXMuc2V0QXV0b0ZyZWV6ZShlLmF1dG9GcmVlemUpLCB0aGlzLnByb2R1Y2UgPSB0aGlzLnByb2R1Y2UuYmluZCh0aGlzKSwgdGhpcy5wcm9kdWNlV2l0aFBhdGNoZXMgPSB0aGlzLnByb2R1Y2VXaXRoUGF0Y2hlcy5iaW5kKHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5wcm90b3R5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnByb2R1Y2UgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgPT0gdHlwZW9mIGUgJiYgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBlICYmIChlID0gcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSBhcmd1bWVudHMubGVuZ3RoLCBhID0gQXJyYXkoaSA+IDEgPyBpIC0gMSA6IDApLCBzID0gMTsgcyA8IGk7IHMrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbcyAtIDFdID0gYXJndW1lbnRzW3NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5wcm9kdWNlKGUsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAociA9IHQpLmNhbGwuYXBwbHkociwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5jb25jYXQoYSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgdCAmJiBnKDYpLCB2b2lkIDAgIT09IG4gJiYgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgbiAmJiBnKDcpLCB5KGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBEKHRoaXMpLCBzID0gWSh0aGlzLCBlLCB2b2lkIDApLCBjID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IHQocyksIGMgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID8gcShhKSA6IEYoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgUHJvbWlzZSAmJiBpIGluc3RhbmNlb2YgUHJvbWlzZSA/IGkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaihhLCBuKSwgVShlLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBxKGEpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogKGooYSwgbiksIFUoaSwgYSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlIHx8ICdvYmplY3QnICE9IHR5cGVvZiBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChpID0gdChlKSkgPT09IHJlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PT0gaSAmJiAoaSA9IGUpLCB0aGlzLk4gJiYgTyhpLCAhMCksIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnKDIxLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5wcm9kdWNlV2l0aFBhdGNoZXMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIsIG8gPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgPT0gdHlwZW9mIGUgPyBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBhcmd1bWVudHMubGVuZ3RoLCByID0gQXJyYXkobiA+IDEgPyBuIC0gMSA6IDApLCBpID0gMTsgaSA8IG47IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcltpIC0gMV0gPSBhcmd1bWVudHNbaV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8ucHJvZHVjZVdpdGhQYXRjaGVzKHQsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcGx5KHZvaWQgMCwgW3RdLmNvbmNhdChyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucHJvZHVjZShlLCB0LCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gZSwgciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LmNyZWF0ZURyYWZ0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkoZSkgfHwgZyg4KSwgdihlKSAmJiAoZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHYoZSkgfHwgZygyMiwgZSksIGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXkodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4sIHIgPSB0W2llXSwgbyA9IEUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIuUCAmJiAoci5pIDwgNCB8fCAhQSgnRVM1JykuSyhyKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuSSA9ICEwLCBuID0gUSh0LCBvKSwgci5JID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IFEodCwgbyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKG4sIGZ1bmN0aW9uICh0LCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYmIHgoci50LCB0KSA9PT0gbyB8fCBTKG4sIHQsIGUobykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgMyA9PT0gbyA/IG5ldyBTZXQobikgOiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gRCh0aGlzKSwgbiA9IFkodGhpcywgZSwgdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuW2llXS5DID0gITAsIEYodCksIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuZmluaXNoRHJhZnQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAoZSAmJiBlW2llXSkuQTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqKG4sIHQpLCBVKHZvaWQgMCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuc2V0QXV0b0ZyZWV6ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLk4gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnNldFVzZVByb3hpZXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiAhbmUgJiYgZygyMCksIHRoaXMuTyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuYXBwbHlQYXRjaGVzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gdC5sZW5ndGggLSAxOyBuID49IDA7IG4tLSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdFtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gci5wYXRoLmxlbmd0aCAmJiAncmVwbGFjZScgPT09IHIub3ApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHIudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gQSgnUGF0Y2hlcycpLiQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdihlKSA/IG8oZSwgdCkgOiB0aGlzLnByb2R1Y2UoZSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbyhlLCB0LnNsaWNlKG4gKyAxKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCkpKCksIHBlID0gZmUucHJvZHVjZSwgZGUgPSAoZmUucHJvZHVjZVdpdGhQYXRjaGVzLmJpbmQoZmUpLCBmZS5zZXRBdXRvRnJlZXplLmJpbmQoZmUpLCBmZS5zZXRVc2VQcm94aWVzLmJpbmQoZmUpLCBmZS5hcHBseVBhdGNoZXMuYmluZChmZSksIGZlLmNyZWF0ZURyYWZ0LmJpbmQoZmUpLCBmZS5maW5pc2hEcmFmdC5iaW5kKGZlKSwgcGUpLCBoZSA9IG4oODIpLCBtZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgucmFuZG9tKCkudG9TdHJpbmcoMzYpLnN1YnN0cmluZyg3KS5zcGxpdCgnJykuam9pbignLicpOwogICAgICAgICAgICAgICAgICAgIH0sIGdlID0gewogICAgICAgICAgICAgICAgICAgICAgICBJTklUOiAnQEByZWR1eC9JTklUJyArIG1lKCksCiAgICAgICAgICAgICAgICAgICAgICAgIFJFUExBQ0U6ICdAQHJlZHV4L1JFUExBQ0UnICsgbWUoKSwKICAgICAgICAgICAgICAgICAgICAgICAgUFJPQkVfVU5LTk9XTl9BQ1RJT046IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnQEByZWR1eC9QUk9CRV9VTktOT1dOX0FDVElPTicgKyBtZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHZlKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgIT09IHR5cGVvZiBlIHx8IG51bGwgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gZTsgbnVsbCAhPT0gT2JqZWN0LmdldFByb3RvdHlwZU9mKHQpOykKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IE9iamVjdC5nZXRQcm90b3R5cGVPZih0KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldFByb3RvdHlwZU9mKGUpID09PSB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24geWUoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHZhciByOwogICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09PSB0eXBlb2YgdCAmJiAnZnVuY3Rpb24nID09PSB0eXBlb2YgbiB8fCAnZnVuY3Rpb24nID09PSB0eXBlb2YgbiAmJiAnZnVuY3Rpb24nID09PSB0eXBlb2YgYXJndW1lbnRzWzNdKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0l0IGxvb2tzIGxpa2UgeW91IGFyZSBwYXNzaW5nIHNldmVyYWwgc3RvcmUgZW5oYW5jZXJzIHRvIGNyZWF0ZVN0b3JlKCkuIFRoaXMgaXMgbm90IHN1cHBvcnRlZC4gSW5zdGVhZCwgY29tcG9zZSB0aGVtIHRvZ2V0aGVyIHRvIGEgc2luZ2xlIGZ1bmN0aW9uLicpOwogICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09PSB0eXBlb2YgdCAmJiAndW5kZWZpbmVkJyA9PT0gdHlwZW9mIG4gJiYgKG4gPSB0LCB0ID0gdm9pZCAwKSwgJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nICE9PSB0eXBlb2YgbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignRXhwZWN0ZWQgdGhlIGVuaGFuY2VyIHRvIGJlIGEgZnVuY3Rpb24uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKHllKShlLCB0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0V4cGVjdGVkIHRoZSByZWR1Y2VyIHRvIGJlIGEgZnVuY3Rpb24uJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlLCBpID0gdCwgYSA9IFtdLCBzID0gYSwgYyA9ICExOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHMgPT09IGEgJiYgKHMgPSBhLnNsaWNlKCkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignWW91IG1heSBub3QgY2FsbCBzdG9yZS5nZXRTdGF0ZSgpIHdoaWxlIHRoZSByZWR1Y2VyIGlzIGV4ZWN1dGluZy4gVGhlIHJlZHVjZXIgaGFzIGFscmVhZHkgcmVjZWl2ZWQgdGhlIHN0YXRlIGFzIGFuIGFyZ3VtZW50LiBQYXNzIGl0IGRvd24gZnJvbSB0aGUgdG9wIHJlZHVjZXIgaW5zdGVhZCBvZiByZWFkaW5nIGl0IGZyb20gdGhlIHN0b3JlLicpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nICE9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignRXhwZWN0ZWQgdGhlIGxpc3RlbmVyIHRvIGJlIGEgZnVuY3Rpb24uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdZb3UgbWF5IG5vdCBjYWxsIHN0b3JlLnN1YnNjcmliZSgpIHdoaWxlIHRoZSByZWR1Y2VyIGlzIGV4ZWN1dGluZy4gSWYgeW91IHdvdWxkIGxpa2UgdG8gYmUgbm90aWZpZWQgYWZ0ZXIgdGhlIHN0b3JlIGhhcyBiZWVuIHVwZGF0ZWQsIHN1YnNjcmliZSBmcm9tIGEgY29tcG9uZW50IGFuZCBpbnZva2Ugc3RvcmUuZ2V0U3RhdGUoKSBpbiB0aGUgY2FsbGJhY2sgdG8gYWNjZXNzIHRoZSBsYXRlc3Qgc3RhdGUuIFNlZSBodHRwczovL3JlZHV4LmpzLm9yZy9hcGktcmVmZXJlbmNlL3N0b3JlI3N1YnNjcmliZWxpc3RlbmVyIGZvciBtb3JlIGRldGFpbHMuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1KCksIHMucHVzaChlKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdZb3UgbWF5IG5vdCB1bnN1YnNjcmliZSBmcm9tIGEgc3RvcmUgbGlzdGVuZXIgd2hpbGUgdGhlIHJlZHVjZXIgaXMgZXhlY3V0aW5nLiBTZWUgaHR0cHM6Ly9yZWR1eC5qcy5vcmcvYXBpLXJlZmVyZW5jZS9zdG9yZSNzdWJzY3JpYmVsaXN0ZW5lciBmb3IgbW9yZSBkZXRhaWxzLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAhMSwgdSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gcy5pbmRleE9mKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMuc3BsaWNlKG4sIDEpLCBhID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdmUoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0FjdGlvbnMgbXVzdCBiZSBwbGFpbiBvYmplY3RzLiBVc2UgY3VzdG9tIG1pZGRsZXdhcmUgZm9yIGFzeW5jIGFjdGlvbnMuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyA9PT0gdHlwZW9mIGUudHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQWN0aW9ucyBtYXkgbm90IGhhdmUgYW4gdW5kZWZpbmVkICJ0eXBlIiBwcm9wZXJ0eS4gSGF2ZSB5b3UgbWlzc3BlbGxlZCBhIGNvbnN0YW50PycpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignUmVkdWNlcnMgbWF5IG5vdCBkaXNwYXRjaCBhY3Rpb25zLicpOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9ICEwLCBpID0gbyhpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gYSA9IHMsIG4gPSAwOyBuIDwgdC5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgKDAsIHRbbl0pKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0V4cGVjdGVkIHRoZSBuZXh0UmVkdWNlciB0byBiZSBhIGZ1bmN0aW9uLicpOwogICAgICAgICAgICAgICAgICAgICAgICBvID0gZSwgcCh7IHR5cGU6IGdlLlJFUExBQ0UgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGgoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0ID0gZjsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Vic2NyaWJlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyAhPT0gdHlwZW9mIGUgfHwgbnVsbCA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignRXhwZWN0ZWQgdGhlIG9ic2VydmVyIHRvIGJlIGFuIG9iamVjdC4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5leHQgJiYgZS5uZXh0KGwoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKCksIHsgdW5zdWJzY3JpYmU6IHQobikgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSlbaGUuYV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAoeyB0eXBlOiBnZS5JTklUIH0pLCAociA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2g6IHAsCiAgICAgICAgICAgICAgICAgICAgICAgIHN1YnNjcmliZTogZiwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0U3RhdGU6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlcGxhY2VSZWR1Y2VyOiBkCiAgICAgICAgICAgICAgICAgICAgfSlbaGUuYV0gPSBoLCByOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYmUoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHZhciBuID0gdCAmJiB0LnR5cGU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdHaXZlbiAnICsgKG4gJiYgJ2FjdGlvbiAiJyArIFN0cmluZyhuKSArICciJyB8fCAnYW4gYWN0aW9uJykgKyAnLCByZWR1Y2VyICInICsgZSArICciIHJldHVybmVkIHVuZGVmaW5lZC4gVG8gaWdub3JlIGFuIGFjdGlvbiwgeW91IG11c3QgZXhwbGljaXRseSByZXR1cm4gdGhlIHByZXZpb3VzIHN0YXRlLiBJZiB5b3Ugd2FudCB0aGlzIHJlZHVjZXIgdG8gaG9sZCBubyB2YWx1ZSwgeW91IGNhbiByZXR1cm4gbnVsbCBpbnN0ZWFkIG9mIHVuZGVmaW5lZC4nOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRWUoZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBPYmplY3Qua2V5cyhlKSwgbiA9IHt9LCByID0gMDsgciA8IHQubGVuZ3RoOyByKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0W3JdOwogICAgICAgICAgICAgICAgICAgICAgICAwLCAnZnVuY3Rpb24nID09PSB0eXBlb2YgZVtvXSAmJiAobltvXSA9IGVbb10pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgaSwgYSA9IE9iamVjdC5rZXlzKG4pOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoZSkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgPT09IHR5cGVvZiBuKHZvaWQgMCwgeyB0eXBlOiBnZS5JTklUIH0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1JlZHVjZXIgIicgKyB0ICsgJyIgcmV0dXJuZWQgdW5kZWZpbmVkIGR1cmluZyBpbml0aWFsaXphdGlvbi4gSWYgdGhlIHN0YXRlIHBhc3NlZCB0byB0aGUgcmVkdWNlciBpcyB1bmRlZmluZWQsIHlvdSBtdXN0IGV4cGxpY2l0bHkgcmV0dXJuIHRoZSBpbml0aWFsIHN0YXRlLiBUaGUgaW5pdGlhbCBzdGF0ZSBtYXkgbm90IGJlIHVuZGVmaW5lZC4gSWYgeW91IGRvblwndCB3YW50IHRvIHNldCBhIHZhbHVlIGZvciB0aGlzIHJlZHVjZXIsIHlvdSBjYW4gdXNlIG51bGwgaW5zdGVhZCBvZiB1bmRlZmluZWQuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnID09PSB0eXBlb2Ygbih2b2lkIDAsIHsgdHlwZTogZ2UuUFJPQkVfVU5LTk9XTl9BQ1RJT04oKSB9KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdSZWR1Y2VyICInICsgdCArICciIHJldHVybmVkIHVuZGVmaW5lZCB3aGVuIHByb2JlZCB3aXRoIGEgcmFuZG9tIHR5cGUuIERvblwndCB0cnkgdG8gaGFuZGxlICcgKyBnZS5JTklUICsgJyBvciBvdGhlciBhY3Rpb25zIGluICJyZWR1eC8qIiBuYW1lc3BhY2UuIFRoZXkgYXJlIGNvbnNpZGVyZWQgcHJpdmF0ZS4gSW5zdGVhZCwgeW91IG11c3QgcmV0dXJuIHRoZSBjdXJyZW50IHN0YXRlIGZvciBhbnkgdW5rbm93biBhY3Rpb25zLCB1bmxlc3MgaXQgaXMgdW5kZWZpbmVkLCBpbiB3aGljaCBjYXNlIHlvdSBtdXN0IHJldHVybiB0aGUgaW5pdGlhbCBzdGF0ZSwgcmVnYXJkbGVzcyBvZiB0aGUgYWN0aW9uIHR5cGUuIFRoZSBpbml0aWFsIHN0YXRlIG1heSBub3QgYmUgdW5kZWZpbmVkLCBidXQgY2FuIGJlIG51bGwuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfShuKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBzOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gZSAmJiAoZSA9IHt9KSwgaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSAhMSwgbyA9IHt9LCBzID0gMDsgcyA8IGEubGVuZ3RoOyBzKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYVtzXSwgdSA9IG5bY10sIGwgPSBlW2NdLCBmID0gdShsLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyA9PT0gdHlwZW9mIGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IGJlKGMsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9bY10gPSBmLCByID0gciB8fCBmICE9PSBsOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAociA9IHIgfHwgYS5sZW5ndGggIT09IE9iamVjdC5rZXlzKGUpLmxlbmd0aCkgPyBvIDogZTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gd2UoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0IGluIGUgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pIDogZVt0XSA9IG4sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB4ZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyAmJiBuLnB1c2guYXBwbHkobiwgT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyhlKSksIHQgJiYgKG4gPSBuLmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLCB0KS5lbnVtZXJhYmxlOwogICAgICAgICAgICAgICAgICAgIH0pKSwgbjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNlKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMTsgdCA8IGFyZ3VtZW50cy5sZW5ndGg7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG51bGwgIT0gYXJndW1lbnRzW3RdID8gYXJndW1lbnRzW3RdIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgIHQgJSAyID8geGUobiwgITApLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdlKGUsIHQsIG5bdF0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSA6IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzID8gT2JqZWN0LmRlZmluZVByb3BlcnRpZXMoZSwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMobikpIDogeGUobikuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHQsIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IobiwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBDZSgpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCwgdCA9IG5ldyBBcnJheShlKSwgbiA9IDA7IG4gPCBlOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHRbbl0gPSBhcmd1bWVudHNbbl07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPT09IHQubGVuZ3RoID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSA6IDEgPT09IHQubGVuZ3RoID8gdFswXSA6IHQucmVkdWNlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0LmFwcGx5KHZvaWQgMCwgYXJndW1lbnRzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBrZSgpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCwgdCA9IG5ldyBBcnJheShlKSwgbiA9IDA7IG4gPCBlOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHRbbl0gPSBhcmd1bWVudHNbbl07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuYXBwbHkodm9pZCAwLCBhcmd1bWVudHMpLCByID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0Rpc3BhdGNoaW5nIHdoaWxlIGNvbnN0cnVjdGluZyB5b3VyIG1pZGRsZXdhcmUgaXMgbm90IGFsbG93ZWQuIE90aGVyIG1pZGRsZXdhcmUgd291bGQgbm90IGJlIGFwcGxpZWQgdG8gdGhpcyBkaXNwYXRjaC4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRTdGF0ZTogbi5nZXRTdGF0ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGF0Y2g6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmFwcGx5KHZvaWQgMCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkgPSB0Lm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZShvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTZSh7fSwgbiwgeyBkaXNwYXRjaDogciA9IENlLmFwcGx5KHZvaWQgMCwgaSkobi5kaXNwYXRjaCkgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFRlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9lKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gdCB8fCBudWxsID09PSBuIHx8IHQubGVuZ3RoICE9PSBuLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHIgPSB0Lmxlbmd0aCwgbyA9IDA7IG8gPCByOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSh0W29dLCBuW29dKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBQZShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBBcnJheS5pc0FycmF5KGVbMF0pID8gZVswXSA6IGU7CiAgICAgICAgICAgICAgICAgICAgaWYgKCF0LmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignLCAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdTZWxlY3RvciBjcmVhdG9ycyBleHBlY3QgYWxsIGlucHV0LXNlbGVjdG9ycyB0byBiZSBmdW5jdGlvbnMsIGluc3RlYWQgcmVjZWl2ZWQgdGhlIGZvbGxvd2luZyB0eXBlczogWycgKyBuICsgJ10nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCwgbiA9IEFycmF5KHQgPiAxID8gdCAtIDEgOiAwKSwgciA9IDE7IHIgPCB0OyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgIG5bciAtIDFdID0gYXJndW1lbnRzW3JdOwogICAgICAgICAgICAgICAgfShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiBUZSwgbiA9IG51bGwsIHIgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfZSh0LCBuLCBhcmd1bWVudHMpIHx8IChyID0gZS5hcHBseShudWxsLCBhcmd1bWVudHMpKSwgbiA9IGFyZ3VtZW50cywgcjsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBPZShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5kaXNwYXRjaCwgciA9IHQuZ2V0U3RhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgPT09IHR5cGVvZiBvID8gbyhuLCByLCBlKSA6IHQobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgSWUgPSBPZSgpOwogICAgICAgICAgICAgICAgSWUud2l0aEV4dHJhQXJndW1lbnQgPSBPZTsKICAgICAgICAgICAgICAgIHZhciBMZSA9IEllOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gQWUoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChBZSA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChuLCByKSAmJiAoZVtyXSA9IG5bcl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0pLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBSZShlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChSZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiA/IE9iamVjdC5nZXRQcm90b3R5cGVPZiA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLl9fcHJvdG9fXyB8fCBPYmplY3QuZ2V0UHJvdG90eXBlT2YoZSk7CiAgICAgICAgICAgICAgICAgICAgfSkoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBOZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChOZSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5fX3Byb3RvX18gPSB0LCBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUsIHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gamUoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnID09PSB0eXBlb2YgUmVmbGVjdCB8fCAhUmVmbGVjdC5jb25zdHJ1Y3QpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBpZiAoUmVmbGVjdC5jb25zdHJ1Y3Quc2hhbSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09PSB0eXBlb2YgUHJveHkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGF0ZS5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChSZWZsZWN0LmNvbnN0cnVjdChEYXRlLCBbXSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9KSksICEwOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHFlKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHFlID0gamUoKSA/IFJlZmxlY3QuY29uc3RydWN0IDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBbbnVsbF07CiAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaC5hcHBseShyLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBuZXcgKEZ1bmN0aW9uLmJpbmQuYXBwbHkoZSwgcikpKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICYmIE5lKG8sIG4ucHJvdG90eXBlKSwgbzsKICAgICAgICAgICAgICAgICAgICB9KS5hcHBseShudWxsLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRmUoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIE1hcCA/IG5ldyBNYXAoKSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKEZlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGUgfHwgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xICE9PSBGdW5jdGlvbi50b1N0cmluZy5jYWxsKGUpLmluZGV4T2YoJ1tuYXRpdmUgY29kZV0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignU3VwZXIgZXhwcmVzc2lvbiBtdXN0IGVpdGhlciBiZSBudWxsIG9yIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9PSB0eXBlb2YgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuaGFzKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmdldChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2V0KGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcWUoZSwgYXJndW1lbnRzLCBSZSh0aGlzKS5jb25zdHJ1Y3Rvcik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShlLnByb3RvdHlwZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3RydWN0b3I6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KSwgTmUobiwgZSk7CiAgICAgICAgICAgICAgICAgICAgfSkoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgRGUgPSAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIHdpbmRvdyAmJiB3aW5kb3cuX19SRURVWF9ERVZUT09MU19FWFRFTlNJT05fQ09NUE9TRV9fID8gd2luZG93Ll9fUkVEVVhfREVWVE9PTFNfRVhURU5TSU9OX0NPTVBPU0VfXyA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoMCAhPT0gYXJndW1lbnRzLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnID09PSB0eXBlb2YgYXJndW1lbnRzWzBdID8gQ2UgOiBDZS5hcHBseShudWxsLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE1lKGUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgIT09IHR5cGVvZiBlIHx8IG51bGwgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gZTsgbnVsbCAhPT0gT2JqZWN0LmdldFByb3RvdHlwZU9mKHQpOykKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IE9iamVjdC5nZXRQcm90b3R5cGVPZih0KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldFByb3RvdHlwZU9mKGUpID09PSB0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIFVlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbjsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpIHx8IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG4gPSBlLCAodCA9IHIpLnByb3RvdHlwZSA9IE9iamVjdC5jcmVhdGUobi5wcm90b3R5cGUpLCB0LnByb3RvdHlwZS5jb25zdHJ1Y3RvciA9IHQsIHQuX19wcm90b19fID0gbjsKICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHIucHJvdG90eXBlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBvLmNvbmNhdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCwgbiA9IGFyZ3VtZW50cy5sZW5ndGgsIG8gPSBuZXcgQXJyYXkobiksIGkgPSAwOyBpIDwgbjsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgb1tpXSA9IGFyZ3VtZW50c1tpXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHFlKHIsICh0ID0gZS5wcm90b3R5cGUuY29uY2F0KS5jYWxsLmFwcGx5KHQsIFt0aGlzXS5jb25jYXQobykpKTsKICAgICAgICAgICAgICAgICAgICB9LCBvLnByZXBlbmQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoLCB0ID0gbmV3IEFycmF5KGUpLCBuID0gMDsgbiA8IGU7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbbl0gPSBhcmd1bWVudHNbbl07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxID09PSB0Lmxlbmd0aCAmJiBBcnJheS5pc0FycmF5KHRbMF0pID8gcWUociwgdFswXS5jb25jYXQodGhpcykpIDogcWUociwgdC5jb25jYXQodGhpcykpOwogICAgICAgICAgICAgICAgICAgIH0sIHI7CiAgICAgICAgICAgICAgICB9KEZlKEFycmF5KSk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBWZSgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGUgJiYgKGUgPSB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUsIG4gPSB0LnRodW5rLCByID0gdm9pZCAwID09PSBuIHx8IG4sIG8gPSAodC5pbW11dGFibGVDaGVjaywgdC5zZXJpYWxpemFibGVDaGVjaywgbmV3IFVlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgciAmJiAoJ2Jvb2xlYW4nID09PSB0eXBlb2YgciA/IG8ucHVzaChMZSkgOiBvLnB1c2goTGUud2l0aEV4dHJhQXJndW1lbnQoci5leHRyYUFyZ3VtZW50KSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvOwogICAgICAgICAgICAgICAgICAgICAgICB9KGUpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBCZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5hcHBseSh2b2lkIDAsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdwcmVwYXJlQWN0aW9uIGRpZCBub3QgcmV0dXJuIGFuIG9iamVjdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBheWxvYWQ6IG4ucGF5bG9hZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgJ21ldGEnIGluIG4gJiYgeyBtZXRhOiBuLm1ldGEgfSwge30sICdlcnJvcicgaW4gbiAmJiB7IGVycm9yOiBuLmVycm9yIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF5bG9hZDogYXJndW1lbnRzLmxlbmd0aCA8PSAwID8gdm9pZCAwIDogYXJndW1lbnRzWzBdCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBuLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJycgKyBlOwogICAgICAgICAgICAgICAgICAgIH0sIG4udHlwZSA9IGUsIG4ubWF0Y2ggPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50eXBlID09PSBlOwogICAgICAgICAgICAgICAgICAgIH0sIG47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB6ZShlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSB7fSwgciA9IFtdLCBvID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkQ2FzZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9ICdzdHJpbmcnID09PSB0eXBlb2YgZSA/IGUgOiBlLnR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdhZGRDYXNlIGNhbm5vdCBiZSBjYWxsZWQgd2l0aCB0d28gcmVkdWNlcnMgZm9yIHRoZSBzYW1lIGFjdGlvbiB0eXBlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5bcl0gPSB0LCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZE1hdGNoZXI6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hdGNoZXI6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZHVjZXI6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGREZWZhdWx0Q2FzZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9IGUsIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUobyksIFsKICAgICAgICAgICAgICAgICAgICAgICAgbiwKICAgICAgICAgICAgICAgICAgICAgICAgciwKICAgICAgICAgICAgICAgICAgICAgICAgdAogICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIFN5bWJvbCAmJiAoU3ltYm9sLml0ZXJhdG9yIHx8IChTeW1ib2wuaXRlcmF0b3IgPSBTeW1ib2woJ1N5bWJvbC5pdGVyYXRvcicpKSksICd1bmRlZmluZWQnICE9PSB0eXBlb2YgU3ltYm9sICYmIChTeW1ib2wuYXN5bmNJdGVyYXRvciB8fCAoU3ltYm9sLmFzeW5jSXRlcmF0b3IgPSBTeW1ib2woJ1N5bWJvbC5hc3luY0l0ZXJhdG9yJykpKTsKICAgICAgICAgICAgICAgIEsoKTsKICAgICAgICAgICAgICAgIHZhciBHZSA9IG4oMzUpLCBIZSA9IG4ubihHZSk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBXZShlLCB0LCBuLCByLCBvLCBpLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBlW2ldKGEpLCBjID0gcy52YWx1ZTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIG4odSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHMuZG9uZSA/IHQoYykgOiBQcm9taXNlLnJlc29sdmUoYykudGhlbihyLCBvKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uICRlKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMsIG4gPSBhcmd1bWVudHM7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbiAociwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLmFwcGx5KHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2UoaSwgciwgbywgYSwgcywgJ25leHQnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlKGksIHIsIG8sIGEsIHMsICd0aHJvdycsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSh2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIFllID0gbigwKSwgUWUgPSBuLm4oWWUpLCBLZSA9IG4oNTIpLCBKZSA9IG4ubihLZSksIFhlID0gKG4oMTE4KSwgUWUuYS5jcmVhdGVDb250ZXh0KG51bGwpKTsKICAgICAgICAgICAgICAgIHZhciBaZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUoKTsKICAgICAgICAgICAgICAgICAgICB9LCBldCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZ5OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gdHQoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBaZSwgdCA9IG51bGwsIG4gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gbnVsbCwgbiA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmeTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IHQ7IGU7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmNhbGxiYWNrKCksIGUgPSBlLm5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gW10sIG4gPSB0OyBuOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnB1c2gobiksIG4gPSBuLm5leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc3Vic2NyaWJlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAhMCwgbyA9IG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmV2OiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvLnByZXYgPyBvLnByZXYubmV4dCA9IG8gOiB0ID0gbywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgbnVsbCAhPT0gdCAmJiAociA9ICExLCBvLm5leHQgPyBvLm5leHQucHJldiA9IG8ucHJldiA6IG4gPSBvLnByZXYsIG8ucHJldiA/IG8ucHJldi5uZXh0ID0gby5uZXh0IDogdCA9IG8ubmV4dCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBudCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdG9yZSA9IGUsIHRoaXMucGFyZW50U3ViID0gdCwgdGhpcy51bnN1YnNjcmliZSA9IG51bGwsIHRoaXMubGlzdGVuZXJzID0gZXQsIHRoaXMuaGFuZGxlQ2hhbmdlV3JhcHBlciA9IHRoaXMuaGFuZGxlQ2hhbmdlV3JhcHBlci5iaW5kKHRoaXMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucHJvdG90eXBlOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmFkZE5lc3RlZFN1YiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRyeVN1YnNjcmliZSgpLCB0aGlzLmxpc3RlbmVycy5zdWJzY3JpYmUoZSk7CiAgICAgICAgICAgICAgICAgICAgfSwgdC5ub3RpZnlOZXN0ZWRTdWJzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxpc3RlbmVycy5ub3RpZnkoKTsKICAgICAgICAgICAgICAgICAgICB9LCB0LmhhbmRsZUNoYW5nZVdyYXBwZXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMub25TdGF0ZUNoYW5nZSAmJiB0aGlzLm9uU3RhdGVDaGFuZ2UoKTsKICAgICAgICAgICAgICAgICAgICB9LCB0LmlzU3Vic2NyaWJlZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJvb2xlYW4odGhpcy51bnN1YnNjcmliZSk7CiAgICAgICAgICAgICAgICAgICAgfSwgdC50cnlTdWJzY3JpYmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudW5zdWJzY3JpYmUgfHwgKHRoaXMudW5zdWJzY3JpYmUgPSB0aGlzLnBhcmVudFN1YiA/IHRoaXMucGFyZW50U3ViLmFkZE5lc3RlZFN1Yih0aGlzLmhhbmRsZUNoYW5nZVdyYXBwZXIpIDogdGhpcy5zdG9yZS5zdWJzY3JpYmUodGhpcy5oYW5kbGVDaGFuZ2VXcmFwcGVyKSwgdGhpcy5saXN0ZW5lcnMgPSB0dCgpKTsKICAgICAgICAgICAgICAgICAgICB9LCB0LnRyeVVuc3Vic2NyaWJlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnVuc3Vic2NyaWJlICYmICh0aGlzLnVuc3Vic2NyaWJlKCksIHRoaXMudW5zdWJzY3JpYmUgPSBudWxsLCB0aGlzLmxpc3RlbmVycy5jbGVhcigpLCB0aGlzLmxpc3RlbmVycyA9IGV0KTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgdmFyIHJ0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuc3RvcmUsIG4gPSBlLmNvbnRleHQsIHIgPSBlLmNoaWxkcmVuLCBvID0gT2JqZWN0KFllLnVzZU1lbW8pKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IG50KHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUub25TdGF0ZUNoYW5nZSA9IGUubm90aWZ5TmVzdGVkU3VicywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JlOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YnNjcmlwdGlvbjogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgW3RdKSwgaSA9IE9iamVjdChZZS51c2VNZW1vKShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5nZXRTdGF0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBbdF0pOwogICAgICAgICAgICAgICAgICAgIE9iamVjdChZZS51c2VFZmZlY3QpKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBvLnN1YnNjcmlwdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudHJ5U3Vic2NyaWJlKCksIGkgIT09IHQuZ2V0U3RhdGUoKSAmJiBlLm5vdGlmeU5lc3RlZFN1YnMoKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS50cnlVbnN1YnNjcmliZSgpLCBlLm9uU3RhdGVDaGFuZ2UgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIFsKICAgICAgICAgICAgICAgICAgICAgICAgbywKICAgICAgICAgICAgICAgICAgICAgICAgaQogICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgIHZhciBhID0gbiB8fCBYZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KGEuUHJvdmlkZXIsIHsgdmFsdWU6IG8gfSwgcik7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gb3QoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChvdCA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDE7IHQgPCBhcmd1bWVudHMubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChuLCByKSAmJiAoZVtyXSA9IG5bcl0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0pLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBuKDgxKSwgbigzNCk7CiAgICAgICAgICAgICAgICB2YXIgaXQgPSAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIHdpbmRvdyAmJiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIHdpbmRvdy5kb2N1bWVudCAmJiAndW5kZWZpbmVkJyAhPT0gdHlwZW9mIHdpbmRvdy5kb2N1bWVudC5jcmVhdGVFbGVtZW50ID8gWWUudXNlTGF5b3V0RWZmZWN0IDogWWUudXNlRWZmZWN0OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gYXQoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChZZS51c2VDb250ZXh0KShYZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzdChlKSB7CiAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBlICYmIChlID0gWGUpOwogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZSA9PT0gWGUgPyBhdCA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChZZS51c2VDb250ZXh0KShlKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KCkuc3RvcmU7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBjdCA9IHN0KCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB1dChlKSB7CiAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBlICYmIChlID0gWGUpOwogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZSA9PT0gWGUgPyBjdCA6IHN0KGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KCkuZGlzcGF0Y2g7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBsdCA9IHV0KCksIGZ0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IHQ7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHB0KGUpIHsKICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGUgJiYgKGUgPSBYZSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlID09PSBYZSA/IGF0IDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KFllLnVzZUNvbnRleHQpKGUpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gbiAmJiAobiA9IGZ0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0KCksIG8gPSBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvLCBpID0gT2JqZWN0KFllLnVzZVJlZHVjZXIpKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSArIDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDApWzFdLCBhID0gT2JqZWN0KFllLnVzZU1lbW8pKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgbnQobiwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBzID0gT2JqZWN0KFllLnVzZVJlZikoKSwgYyA9IE9iamVjdChZZS51c2VSZWYpKCksIHUgPSBPYmplY3QoWWUudXNlUmVmKSgpLCBsID0gT2JqZWN0KFllLnVzZVJlZikoKSwgZiA9IG4uZ2V0U3RhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gZSAhPT0gYy5jdXJyZW50IHx8IGYgIT09IHUuY3VycmVudCB8fCBzLmN1cnJlbnQgPyBlKGYpIDogbC5jdXJyZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgcy5jdXJyZW50ICYmIChwLm1lc3NhZ2UgKz0gJ1xuVGhlIGVycm9yIG1heSBiZSBjb3JyZWxhdGVkIHdpdGggdGhpcyBwcmV2aW91cyBlcnJvcjpcbicgKyBzLmN1cnJlbnQuc3RhY2sgKyAnXG5cbicpLCBwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmN1cnJlbnQgPSBlLCB1LmN1cnJlbnQgPSBmLCBsLmN1cnJlbnQgPSBvLCBzLmN1cnJlbnQgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGl0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjLmN1cnJlbnQobi5nZXRTdGF0ZSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodChlLCBsLmN1cnJlbnQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5jdXJyZW50ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLmN1cnJlbnQgPSBwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLm9uU3RhdGVDaGFuZ2UgPSBlLCBhLnRyeVN1YnNjcmliZSgpLCBlKCksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLnRyeVVuc3Vic2NyaWJlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUsIG4sIHIuc3RvcmUsIHIuc3Vic2NyaXB0aW9uKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChZZS51c2VEZWJ1Z1ZhbHVlKShvKSwgbzsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGR0LCBodCA9IHB0KCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBtdChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMoZSkgfHwgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9PSB0eXBlb2YgU3ltYm9sICYmIFN5bWJvbC5pdGVyYXRvciBpbiBPYmplY3QoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gW10sIHIgPSAhMCwgbyA9ICExLCBpID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhLCBzID0gZVtTeW1ib2wuaXRlcmF0b3JdKCk7ICEociA9IChhID0gcy5uZXh0KCkpLmRvbmUpICYmIChuLnB1c2goYS52YWx1ZSksICF0IHx8IG4ubGVuZ3RoICE9PSB0KTsgciA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gITAsIGkgPSBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByIHx8IG51bGwgPT0gcy5yZXR1cm4gfHwgcy5yZXR1cm4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KGUsIHQpIHx8IGkoZSwgdCkgfHwgYygpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gZ3QoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0IHx8ICh0ID0gZS5zbGljZSgwKSksIE9iamVjdC5mcmVlemUoT2JqZWN0LmRlZmluZVByb3BlcnRpZXMoZSwgeyByYXc6IHsgdmFsdWU6IE9iamVjdC5mcmVlemUodCkgfSB9KSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkdCA9IEtlLnVuc3RhYmxlX2JhdGNoZWRVcGRhdGVzLCBaZSA9IGR0OwogICAgICAgICAgICAgICAgdmFyIHZ0ID0gbigyKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHl0KCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZ3QoWwogICAgICAgICAgICAgICAgICAgICAgICAnXG4gICAgICAgICYmIHtcbiAgICAgICAgICBtYXgtd2lkdGg6IDE2MDBweDtcbiAgICAgICAgICB3aWR0aDogMTAwJTtcbiAgICAgICAgICBtYXJnaW4tdG9wOiBhdXRvO1xuICAgICAgICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgICAgICAgZmxleC1kaXJlY3Rpb246IHJvdztcbiAgICAgICAgICBqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47XG4gICAgICAgICAgaGVpZ2h0OiBhdXRvO1xuICAgICAgICAgIHBhZGRpbmc6IDIwcHggMTVweCAxMHB4O1xuICAgICAgICAgIGZsZXgtd3JhcDogd3JhcDtcbiAgICAgICAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgICAgICAgYmFja2dyb3VuZDogbm9uZTtcblxuICAgICAgICAgICY6OmJlZm9yZSB7XG4gICAgICAgICAgICBjb250ZW50OiAiIjtcbiAgICAgICAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICAgICAgICAgIGhlaWdodDogMTAwJTtcbiAgICAgICAgICAgIHdpZHRoOiAxMDB2dztcbiAgICAgICAgICAgIGJhY2tncm91bmQ6ICAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICAgICAgdG9wOiAtMXB4O1xuICAgICAgICAgICAgbGVmdDogMDtcbiAgICAgICAgICAgIHotaW5kZXg6IC0xO1xuICAgICAgICAgIH1cbiAgICAgICAgICAmOjphZnRlciB7XG4gICAgICAgICAgICBjb250ZW50OiAiIjtcbiAgICAgICAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICAgICAgICAgIGhlaWdodDogMTAwJTtcbiAgICAgICAgICAgIHdpZHRoOiAxMDB2dztcbiAgICAgICAgICAgIGJhY2tncm91bmQ6ICAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICAgICAgdG9wOiAtMXB4O1xuICAgICAgICAgICAgcmlnaHQ6IDA7XG4gICAgICAgICAgICB6LWluZGV4OiAtMTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICAucWMtY21wMi1zdW1tYXJ5LXNlY3Rpb24ge1xuICAgICAgICAgICAgd2lkdGg6IDcyJTtcbiAgICAgICAgICAgIGFsaWduLWl0ZW1zOiBmbGV4LXN0YXJ0O1xuICAgICAgICAgIH1cblxuICAgICAgICAgIC5xYy1jbXAyLWZvb3RlciB7XG4gICAgICAgICAgICB3aWR0aDogMjglO1xuICAgICAgICAgICAgcGFkZGluZzogMDtcbiAgICAgICAgICAgIG1heC1oZWlnaHQ6IDE1MHB4O1xuICAgICAgICAgICAgYm94LXNoYWRvdzogbm9uZTtcbiAgICAgICAgICAgIGJvcmRlci10b3A6IG5vbmU7XG5cbiAgICAgICAgICAgIC5xYy1jbXAyLXN1bW1hcnktYnV0dG9ucyB7XG4gICAgICAgICAgICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG4gICAgICAgICAgICAgIGp1c3RpZnktY29udGVudDogZW5kO1xuXG4gICAgICAgICAgICAgIGJ1dHRvbntcbiAgICAgICAgICAgICAgICBvcmRlcjogMTtcbiAgICAgICAgICAgICAgICBtYXJnaW4tYm90dG9tOiAxMHB4XG5cbiAgICAgICAgICAgICAgICAmOmxhc3QtY2hpbGQge1xuICAgICAgICAgICAgICAgICAgb3JkZXIgMDtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAmOmZpcnN0LWNoaWxkIHtcbiAgICAgICAgICAgICAgICAgIG9yZGVyIDI7XG4gICAgICAgICAgICAgICAgICBtYXJnaW4tYm90dG9tOiAwO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cblxuICAgICAgICAgIHAsXG4gICAgICAgICAgaDIge1xuICAgICAgICAgICAganVzdGlmeS1zZWxmOiBmbGV4LXN0YXJ0O1xuICAgICAgICAgICAgdGV4dC1hbGlnbjogbGVmdDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgJwogICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB5dCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGJ0KCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZ3QoWydcbiAgICAgICAgICAgICAgaGVpZ2h0OiAxOXB4O1xuICAgICAgICAgICAgICBzdmcge1xuICAgICAgICAgICAgICAgIHdpZHRoOiAxMnB4O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAnXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJ0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRXQoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBndChbCiAgICAgICAgICAgICAgICAgICAgICAgICdcbiAgICAgICAgLnFjLWNtcDItc2Nyb2xsYWJsZS1zZWN0aW9uIHtcbiAgICAgICAgICBoZWlnaHQ6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICAgIH1cbiAgICAgICcKICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB3dCgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuICAmJiB7XG4gICAgYmFja2dyb3VuZDogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICBoZWlnaHQ6IDk1JTtcbiAgICB3aWR0aDogMTAwJTtcbiAgICBkaXNwbGF5OiBncmlkO1xuICAgIGdyaWQtdGVtcGxhdGUtcm93czogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICBqdXN0aWZ5LWl0ZW1zOiBjZW50ZXI7XG4gICAgcG9zaXRpb246IHJlbGF0aXZlO1xuXG4gICAgJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuXG4gICAgaDIge1xuICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICBmb250LXNpemU6IDE4cHg7XG4gICAgICBmb250LXdlaWdodDogNjAwO1xuICAgIH1cblxuICAgIHAge1xuICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICBmb250LXNpemU6IDE0cHg7XG4gICAgICBsaW5lLWhlaWdodDogMjFweDtcblxuICAgICAgYSB7XG4gICAgICAgIGNvbG9yOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICB0ZXh0LWRlY29yYXRpb246IG5vbmU7XG4gICAgICB9XG4gICAgfVxuXG4gICAgLnFjLWNtcDItY2xvc2UtaWNvbiB7XG4gICAgICBiYWNrZ3JvdW5kOiB1cmwoImRhdGE6aW1hZ2Uvc3ZnK3htbDtjaGFyc2V0PXV0Zi04LCUzQ3N2ZyB4bWxucz1cJ2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnXCcgd2lkdGg9XCcyNFwnIGhlaWdodD1cJzI0XCclM0UlM0NwYXRoIGQ9XCdNLjUuNWwyMyAyM20wLTIzbC0yMyAyM1wnIGZpbGw9XCdub25lXCcgc3Ryb2tlPVwnJTIzMDAwXCcgc3Ryb2tlLWxpbmVjYXA9XCdyb3VuZFwnIHN0cm9rZS1saW5lam9pbj1cJ3JvdW5kXCcgc3Ryb2tlLW1pdGVybGltaXQ9XCcxMFwnLyUzRSUzQ3BhdGggZmlsbD1cJ25vbmVcJyBkPVwnTTAgMGgyNHYyNEgwelwnLyUzRSUzQy9zdmclM0UiKVxuICAgICAgICBuby1yZXBlYXQ7XG4gICAgICBiYWNrZ3JvdW5kLXNpemU6IDY2JTtcbiAgICAgIGJvcmRlcjogbm9uZTtcbiAgICAgIGJveC1zaGFkb3c6IG5vbmU7XG4gICAgICBvdXRsaW5lOiBub25lO1xuICAgICAgcG9zaXRpb246IGFic29sdXRlO1xuICAgICAgaGVpZ2h0OiAzOHB4O1xuICAgICAgd2lkdGg6IDM4cHg7XG4gICAgICByaWdodDogMjBweDtcbiAgICAgIHRvcDogMjBweDtcbiAgICAgIHotaW5kZXg6IDE7XG4gICAgICBjdXJzb3I6IHBvaW50ZXI7XG4gICAgfVxuXG4gICAgLnFjLWNtcDItaW5mby1pY29uIHtcbiAgICAgIGJhY2tncm91bmQtaW1hZ2U6IHVybCgiZGF0YTppbWFnZS9zdmcreG1sLCUzQ3N2ZyBhcmlhLWhpZGRlbj1cJ3RydWVcJyBmb2N1c2FibGU9XCdmYWxzZVwnIHhtbG5zPVwnaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmdcJyB2aWV3Qm94PVwnMCAwIDUxMiA1MTJcJyUzRSUzQ3BhdGggZmlsbD1cJyUyM0ZBQUQxNFwnIGQ9XCdNMjU2IDhDMTE5LjA0MyA4IDggMTE5LjA4MyA4IDI1NmMwIDEzNi45OTcgMTExLjA0MyAyNDggMjQ4IDI0OHMyNDgtMTExLjAwMyAyNDgtMjQ4QzUwNCAxMTkuMDgzIDM5Mi45NTcgOCAyNTYgOHptMCAxMTBjMjMuMTk2IDAgNDIgMTguODA0IDQyIDQycy0xOC44MDQgNDItNDIgNDItNDItMTguODA0LTQyLTQyIDE4LjgwNC00MiA0Mi00MnptNTYgMjU0YzAgNi42MjctNS4zNzMgMTItMTIgMTJoLTg4Yy02LjYyNyAwLTEyLTUuMzczLTEyLTEydi0yNGMwLTYuNjI3IDUuMzczLTEyIDEyLTEyaDEydi02NGgtMTJjLTYuNjI3IDAtMTItNS4zNzMtMTItMTJ2LTI0YzAtNi42MjcgNS4zNzMtMTIgMTItMTJoNjRjNi42MjcgMCAxMiA1LjM3MyAxMiAxMnYxMDBoMTJjNi42MjcgMCAxMiA1LjM3MyAxMiAxMnYyNHpcJyUzRSUzQy9wYXRoJTNFJTNDL3N2ZyUzRSUwQSIpO1xuICAgICAgYmFja2dyb3VuZC1yZXBlYXQ6IG5vLXJlcGVhdDtcbiAgICAgIGZsZXgtc2hyaW5rOiAwO1xuICAgICAgbWFyZ2luLXJpZ2h0OiA1cHg7XG4gICAgICBoZWlnaHQ6IDE1cHg7XG4gICAgICB3aWR0aDogMjFweDtcbiAgICB9XG5cbiAgICAucWMtY21wMi1jb25zZW50LWluZm8ge1xuICAgICAgcGFkZGluZzogNSUgMjBweCAyJTtcbiAgICAgIHRleHQtYWxpZ246IGNlbnRlcjtcblxuICAgICAgLnFjLWNtcDItcHVibGlzaGVyLWxvZ28tY29udGFpbmVyIHtcbiAgICAgICAgcG9zaXRpb246IHJlbGF0aXZlO1xuICAgICAgICB0ZXh0LWFsaWduOiBjZW50ZXI7XG5cbiAgICAgICAgLnFjLWNtcDItaG9tZS1idXR0b24ge1xuICAgICAgICAgIGJhY2tncm91bmQ6IG5vbmU7XG4gICAgICAgICAgYm9yZGVyOiBub25lO1xuICAgICAgICAgIGJveC1zaGFkb3c6IG5vbmU7XG4gICAgICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICAgICAgY3Vyc29yOiBwb2ludGVyO1xuICAgICAgICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgICAgICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgICAgICAgICBmb250LXNpemU6IDE0cHg7XG4gICAgICAgICAgZm9udC13ZWlnaHQ6IGJvbGQ7XG4gICAgICAgICAgdGV4dC10cmFuc2Zvcm06IHVwcGVyY2FzZTtcbiAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICAgICAgdG9wOiAwJTtcbiAgICAgICAgICBsZWZ0OiAwJTtcbiAgICAgICAgICB6LWluZGV4OiAxO1xuICAgICAgICAgIHN2ZyB7XG4gICAgICAgICAgICB1c2Uge1xuICAgICAgICAgICAgICBmaWxsOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICAnLAogICAgICAgICAgICAgICAgICAgICAgICAnXG5cbiAgICAgICAgICAmOmZvY3VzIHtcbiAgICAgICAgICAgIG91dGxpbmU6IG5vbmU7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaW1nIHtcbiAgICAgICAgICAgIG1hcmdpbjogMCA1cHggMCAwO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZpZ3VyZSAubG9nby1jb250YWluZXIge1xuICAgICAgICAgIG1hcmdpbjogMCBhdXRvO1xuICAgICAgICB9XG5cbiAgICAgICAgaW1nIHtcbiAgICAgICAgICBtYXJnaW4tYm90dG9tOiAyJTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBoMiB7XG4gICAgICAgIG1hcmdpbi1ib3R0b206IDMlO1xuICAgICAgfVxuXG4gICAgICBwIHtcbiAgICAgICAgdGV4dC1hbGlnbjogbGVmdDtcbiAgICAgICAgbWFyZ2luLWJvdHRvbTogMyU7XG4gICAgICAgIG1heC1oZWlnaHQ6IDIwdmg7XG4gICAgICAgIGZvbnQtc2l6ZTogMTNweDtcbiAgICAgICAgb3ZlcmZsb3c6IGF1dG87XG4gICAgICB9XG4gICAgfVxuXG4gICAgLnFjLWNtcDItc3VtbWFyeS1zZWN0aW9uIHtcbiAgICAgIGRpc3BsYXk6IGdyaWQ7XG4gICAgICBqdXN0aWZ5LWl0ZW1zOiBjZW50ZXI7XG4gICAgICBvdmVyZmxvdzogaGlkZGVuO1xuXG4gICAgICBoMiB7XG4gICAgICAgIG1hcmdpbi10b3A6IDA7XG4gICAgICAgIG1hcmdpbi1ib3R0b206IDEwcHg7XG4gICAgICB9XG5cbiAgICAgIC5sb2dvLWNvbnRhaW5lciB7XG4gICAgICAgIG1hcmdpbi1ib3R0b206IDEzcHg7XG4gICAgICB9XG4gICAgICAucWMtY21wMi1wdWJsaXNoZXItbG9nby1jb250YWluZXIge1xuICAgICAgICBoZWlnaHQ6IDEwMCU7XG4gICAgICB9XG5cbiAgICAgIC5xYy1jbXAyLXN1bW1hcnktaW5mbyB7XG4gICAgICAgIHBhZGRpbmctYm90dG9tOiAzMHB4O1xuICAgICAgICBoZWlnaHQ6IDEwMCU7XG4gICAgICAgIG92ZXJmbG93LXk6IGF1dG87XG5cbiAgICAgICAgcCB7XG4gICAgICAgICAgbGluZS1oZWlnaHQ6IDEuNWVtO1xuICAgICAgICAgIG1hcmdpbi1ib3R0b206IDE1cHg7XG4gICAgICAgICAgbWF4LWhlaWdodDogbm9uZTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIC5xYy1jbXAyLXNjcm9sbGFibGUtc2VjdGlvbiB7XG4gICAgICBvdmVyZmxvdy15OiBhdXRvO1xuICAgICAgZmxleDogMTtcbiAgICAgIHdpZHRoOiAxMDAlO1xuICAgICAgbWF4LXdpZHRoOiA3NzBweDtcbiAgICAgIG1heC1oZWlnaHQ6IDEwMCU7XG5cbiAgICAgICY6Oi13ZWJraXQtc2Nyb2xsYmFyIHtcbiAgICAgICAgd2lkdGg6IDAuN3JlbTtcbiAgICAgICAgdmlzaWJpbGl0eTogaGlkZGVuO1xuICAgICAgfVxuICAgICAgJjo6LXdlYmtpdC1zY3JvbGxiYXItdGh1bWIge1xuICAgICAgICBiYWNrZ3JvdW5kOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgfVxuICAgICAgJi5sb2FkaW5nIHtcbiAgICAgICAgJjo6LXdlYmtpdC1zY3JvbGxiYXItdGh1bWIge1xuICAgICAgICAgIGJhY2tncm91bmQ6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHNwYW4ucWMtY21wMi1sb2FkaW5nLW1lc3NhZ2Uge1xuICAgICAgICBkaXNwbGF5OiBub25lO1xuICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICAgIG1hcmdpbjogYXV0bztcbiAgICAgICAgbGVmdDogMDtcbiAgICAgICAgcmlnaHQ6IDA7XG4gICAgICAgIHRleHQtYWxpZ246IGNlbnRlcjtcbiAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgIH1cbiAgICB9XG5cbiAgICAucWMtY21wMi1wcml2YWN5LXBvbGljeSB7XG4gICAgICBib3JkZXItdG9wOiBzb2xpZCAxcHggJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgIHBhZGRpbmc6IDIuNSUgNjBweDtcblxuICAgICAgYSB7XG4gICAgICAgIHRleHQtZGVjb3JhdGlvbjogbm9uZTtcbiAgICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICB9XG4gICAgfVxuXG4gICAgLnFjLWNtcDItZm9vdGVyIHtcbiAgICAgIGJhY2tncm91bmQtY29sb3I6IHRyYW5zcGFyZW50O1xuICAgICAgYm9yZGVyLXRvcDogc29saWQgMXB4ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICBwYWRkaW5nOiAzJSAxNXB4O1xuICAgICAgZGlzcGxheTogZmxleDtcbiAgICAgIGZsZXgtd3JhcDogd3JhcDtcbiAgICAgIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuICAgICAgcG9zaXRpb246IHJlbGF0aXZlO1xuICAgICAgd2lkdGg6IDEwMCU7XG5cbiAgICAgICYucWMtY21wMi1mb290ZXItb3ZlcmxheSB7XG4gICAgICAgICY6OmJlZm9yZSB7XG4gICAgICAgICAgY29udGVudDogXCdcJztcbiAgICAgICAgICBkaXNwbGF5OiBibG9jaztcbiAgICAgICAgICB3aWR0aDogMTAwJTtcbiAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICAgICAgaGVpZ2h0OiA1MHB4O1xuICAgICAgICAgIGJhY2tncm91bmQ6IGxpbmVhci1ncmFkaWVudCgwZGVnLCAjZmZmZmZmLCByZ2JhKDI1NSwgMjU1LCAyNTUsIDApKTtcbiAgICAgICAgICBsZWZ0OiAwO1xuICAgICAgICAgIHRvcDogLTUxcHg7XG4gICAgICAgICAgcG9pbnRlci1ldmVudHM6IG5vbmU7XG4gICAgICAgICAgdHJhbnNpdGlvbjogYWxsIDAuMnMgZWFzZTtcbiAgICAgICAgICBvcGFjaXR5OiAxO1xuICAgICAgICB9XG5cbiAgICAgICAgJi5xYy1jbXAyLWZvb3Rlci1zY3JvbGxlZCB7XG4gICAgICAgICAgJjo6YmVmb3JlIHtcbiAgICAgICAgICAgIGhlaWdodDogMDtcbiAgICAgICAgICAgIG9wYWNpdHk6IDA7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgICoge1xuICAgICAgICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICAgICAgfVxuXG4gICAgICBbbW9kZT1cJ2xpbmtcJ10ge1xuICAgICAgICAmOm5vdCgucWMtY21wMi1saW5rLWFjdGl2ZSkge1xuICAgICAgICAgIGNvbG9yOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgICYgPiBidXR0b24ge1xuICAgICAgICB3aWR0aDogMTAwJTtcbiAgICAgICAgJjpmaXJzdC1jaGlsZCB7XG4gICAgICAgICAgbWFyZ2luLWJvdHRvbTogMi44JTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICAucWMtY21wMi1mb290ZXItbGlua3Mge1xuICAgICAgICBkaXNwbGF5OiBmbGV4O1xuICAgICAgICBqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47XG4gICAgICAgIHBhZGRpbmctdG9wOiAxMHB4O1xuICAgICAgICB3aWR0aDogMTAwJTtcbiAgICAgIH1cblxuICAgICAgLnFjLWNtcDItZm9vdGVyLXBlcm1pc2lvIHtcbiAgICAgICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgICAgICAgYmFja2dyb3VuZDogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgYm9yZGVyLXJhZGl1czogNHB4O1xuICAgICAgICBjb2xvcjogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgZGlzcGxheTogZmxleDtcbiAgICAgICAgbWFyZ2luLWJvdHRvbTogMTJweDtcbiAgICAgICAgcGFkZGluZzogMCAxMHB4O1xuICAgICAgICB3aWR0aDogMTAwJTtcbiAgICAgICAgPiBhIHtcbiAgICAgICAgICBsZXR0ZXItc3BhY2luZzogMC4xZW07XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgLnFjLWNtcDItZm9vdGVyLXBlcm1pc2lvLWxpbmsge1xuICAgICAgICBjb2xvcjogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgZm9udC13ZWlnaHQ6IGJvbGQ7XG4gICAgICB9XG5cbiAgICAgIC5xYy1jbXAyLWZvb3Rlci1wZXJtaXNpby13YXJuaW5nIHtcbiAgICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICB9XG5cbiAgICAgIC5xYy1jbXAyLWJ1dHRvbnMtZGVza3RvcCB7XG4gICAgICAgIGRpc3BsYXk6IG5vbmU7XG4gICAgICB9XG5cbiAgICAgIC5xYy1jbXAyLXN1bW1hcnktYnV0dG9ucyB7XG4gICAgICAgIHdpZHRoOiAxMDAlO1xuICAgICAgICBkaXNwbGF5OiBmbGV4O1xuICAgICAgICBmbGV4LWRpcmVjdGlvbjogY29sdW1uO1xuXG4gICAgICAgIGJ1dHRvbiB7XG4gICAgICAgICAgd2lkdGg6IDEwMCU7XG4gICAgICAgICAgbWFyZ2luLWJvdHRvbTogMTBweDtcbiAgICAgICAgICBvcmRlcjogMTtcblxuICAgICAgICAgICY6Zmlyc3QtY2hpbGQge1xuICAgICAgICAgICAgb3JkZXI6IDI7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgJjpsYXN0LWNoaWxkIHtcbiAgICAgICAgICAgIG9yZGVyOiAwO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIEBtZWRpYSAobWF4LXdpZHRoOiAzNjBweCkge1xuICAgICAgLyogc3VwcG9ydCBmb3IgaVBob25lIDUvU0UgYW5kIEdhbGF4eSBTNSAqL1xuICAgICAgZGlzcGxheTogYmxvY2s7XG4gICAgICBoZWlnaHQ6IDEwMCU7XG5cbiAgICAgIHAge1xuICAgICAgICBmb250LXNpemU6IDEzcHg7XG4gICAgICB9XG5cbiAgICAgIC5xYy1jbXAyLXN1bW1hcnktc2VjdGlvbiB7XG4gICAgICAgIG1heC1oZWlnaHQ6IDcwJTtcbiAgICAgICAgb3ZlcmZsb3cteTogYXV0bztcbiAgICAgIH1cblxuICAgICAgLnFjLWNtcDItY29uc2VudC1pbmZvIHtcbiAgICAgICAgcGFkZGluZy10b3A6IDEwcHg7XG5cbiAgICAgICAgaW1nIHtcbiAgICAgICAgICBtYXJnaW4tYm90dG9tOiAwO1xuICAgICAgICB9XG5cbiAgICAgICAgaDIge1xuICAgICAgICAgIG1hcmdpbi1ib3R0b206IDNweDtcbiAgICAgICAgfVxuXG4gICAgICAgIHAge1xuICAgICAgICAgIG1hcmdpbi1ib3R0b206IDVweDtcbiAgICAgICAgICBtYXgtaGVpZ2h0OiAxNXZoO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC5xYy1jbXAyLXNjcm9sbGFibGUtc2VjdGlvbiB7XG4gICAgICAgIG1heC1oZWlnaHQ6IDQyJTtcbiAgICAgIH1cblxuICAgICAgLnFjLWNtcDItcHJpdmFjeS1wb2xpY3kge1xuICAgICAgICBwYWRkaW5nOiA4cHggMjVweDtcblxuICAgICAgICBwIHtcbiAgICAgICAgICB0ZXh0LWFsaWduOiBjZW50ZXI7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG5cbiAgICBAbWVkaWEgKG1pbi13aWR0aDogNzY4cHgpIHtcbiAgICAgIGhlaWdodDogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgIG1heC1oZWlnaHQ6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICB3aWR0aDogNzcwcHg7XG4gICAgICBncmlkLXRlbXBsYXRlLXJvd3M6IGF1dG8gMWZyO1xuXG4gICAgICBoMiB7XG4gICAgICAgIGZvbnQtc2l6ZTogMjBweDtcbiAgICAgICAgbWFyZ2luLXRvcDogMTBweDtcbiAgICAgIH1cblxuICAgICAgcCB7XG4gICAgICAgIGZvbnQtc2l6ZTogMTVweDtcbiAgICAgIH1cblxuICAgICAgLnFjLWNtcDItaGlkZS1kZXNrdG9wIHtcbiAgICAgICAgZGlzcGxheTogbm9uZTtcbiAgICAgIH1cblxuICAgICAgLnFjLWNtcDItY29uc2VudC1pbmZvIHtcbiAgICAgICAgcGFkZGluZzogMTVweCAzMHB4O1xuICAgICAgICB3aWR0aDogMTAwJTtcblxuICAgICAgICBwIHtcbiAgICAgICAgICBtYXJnaW4tYm90dG9tOiAwO1xuICAgICAgICAgIG1heC1oZWlnaHQ6IG5vbmU7XG4gICAgICAgICAgZm9udC1zaXplOiAxNHB4O1xuICAgICAgICB9XG5cbiAgICAgICAgLnFjLWNtcDItcHVibGlzaGVyLWxvZ28tY29udGFpbmVyIHtcbiAgICAgICAgICBpbWcge1xuICAgICAgICAgICAgbWFyZ2luLWJvdHRvbTogMDtcbiAgICAgICAgICB9XG4gICAgICAgICAgaDIge1xuICAgICAgICAgICAgbWFyZ2luLWJvdHRvbTogMTBweDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgLnFjLWNtcDItc2Nyb2xsYWJsZS1zZWN0aW9uIHtcbiAgICAgICAgcGFkZGluZzogMCAzMHB4O1xuICAgICAgfVxuXG4gICAgICAucWMtY21wMi1mb290ZXIge1xuICAgICAgICBwYWRkaW5nOiAxM3B4IDMwcHg7XG4gICAgICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgICAgIGZsZXgtd3JhcDogd3JhcDtcbiAgICAgICAganVzdGlmeS1jb250ZW50OiBzcGFjZS1iZXR3ZWVuO1xuICAgICAgICBib3gtc2hhZG93OiAwIC0ycHggNHB4IDAgcmdiYSgwLCAwLCAwLCAwLjEpO1xuXG4gICAgICAgIC5xYy1jbXAyLWZvb3Rlci1saW5rcyB7XG4gICAgICAgICAgcGFkZGluZy10b3A6IDA7XG4gICAgICAgICAgd2lkdGg6IGF1dG87XG4gICAgICAgICAgYnV0dG9uIHtcbiAgICAgICAgICAgICY6bm90KC5xYy1jbXAyLWxpbmstYWN0aXZlKSB7XG4gICAgICAgICAgICAgIGNvbG9yOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbWFyZ2luLWxlZnQ6IDE1cHg7XG4gICAgICAgICAgICAmOmZpcnN0LWNoaWxkIHtcbiAgICAgICAgICAgICAgbWFyZ2luLWxlZnQ6IDA7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLnFjLWNtcDItZm9vdGVyLXBlcm1pc2lvIHtcbiAgICAgICAgICBtYXJnaW4tYm90dG9tOiA3cHg7XG4gICAgICAgICAgcGFkZGluZzogN3B4IDEwcHg7XG4gICAgICAgIH1cblxuICAgICAgICAucWMtY21wMi1idXR0b25zLWRlc2t0b3Age1xuICAgICAgICAgIGRpc3BsYXk6IGlubGluZS1mbGV4O1xuICAgICAgICAgIGZsZXg6IDE7XG4gICAgICAgICAgbWFyZ2luLWxlZnQ6IDUwcHg7XG4gICAgICAgICAgYnV0dG9uIHtcbiAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgIGZsZXg6IDE7XG4gICAgICAgICAgICBmb250LXNpemU6IDExcHg7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgYnV0dG9uIHtcbiAgICAgICAgICAgICY6Zmlyc3Qtb2YtdHlwZSB7XG4gICAgICAgICAgICAgIG1hcmdpbi1yaWdodDogMWVtO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIC5xYy1jbXAyLXN1bW1hcnktYnV0dG9ucyB7XG4gICAgICAgICAgZmxleC1kaXJlY3Rpb246IHJvdztcbiAgICAgICAgICBqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47XG4gICAgICAgICAgcGFkZGluZzogNXB4IDA7XG5cbiAgICAgICAgICBidXR0b24ge1xuICAgICAgICAgICAgbWFyZ2luLWJvdHRvbTogMDtcbiAgICAgICAgICAgIG1hcmdpbi1yaWdodDogMTVweDtcbiAgICAgICAgICAgIG9yZGVyOiAwO1xuXG4gICAgICAgICAgICAmOmZpcnN0LWNoaWxkIHtcbiAgICAgICAgICAgICAgb3JkZXI6IDA7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICY6bGFzdC1jaGlsZCB7XG4gICAgICAgICAgICAgIG1hcmdpbi1yaWdodDogMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICAmLnFjLWNtcDItZm9vdGVyLW92ZXJsYXkge1xuICAgICAgICAgICY6OmJlZm9yZSB7XG4gICAgICAgICAgICBkaXNwbGF5OiBub25lO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICAnLAogICAgICAgICAgICAgICAgICAgICAgICAnXG4gICAgfVxuICB9XG4nCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHd0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHh0LCBTdCwgQ3QsIGt0LCBUdCwgX3QsIFB0LCBPdCwgSXQsIEx0LCBBdCA9IHZ0LmMuZGl2KHd0KCksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnV4QmFja2dyb3VuZENvbG9yOwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwICE9PSBlLnBhZ2UgPyAnYXV0byAzZnIgYXV0bycgOiAnbm9uZSc7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuaXNJRSAmJiBPYmplY3QodnQuYikoRXQoKSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDEgPT09IGUucGFnZSA/IGUudXNlc0xvZ28gPyAnMTkycHgnIDogJzI2MnB4JyA6IDIgPT09IGUucGFnZSA/IGUudXNlc0xvZ28gPyAnMjgycHgnIDogJzM0MnB4JyA6IGUudXNlc0xvZ28gPyAnMjYycHgnIDogJzMzMnB4JzsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhGb250Q29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhGb250Q29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhQcmltYXJ5QnV0dG9uQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhQcmltYXJ5QnV0dG9uQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhQcmltYXJ5QnV0dG9uQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuaXNJRSAmJiBPYmplY3QodnQuYikoYnQoKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhQcmltYXJ5QnV0dG9uQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhCYWNrZ3JvdW5kQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhCYWNrZ3JvdW5kQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYm9yZGVyQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhQcmltYXJ5QnV0dG9uQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYm9yZGVyQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhMaW5rQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUud2FybmluZ0JhY2tncm91bmRDb2xvcjsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS53YXJuaW5nVGV4dENvbG9yOwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLndhcm5pbmdUZXh0Q29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUud2FybmluZ1RleHRDb2xvcjsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA9PT0gZS5wYWdlID8gJ2F1dG8nIDogJ2luaGVyaXQnOwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwID09PSBlLnBhZ2UgPyAnbm9uZScgOiAnNTUwcHgnOwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnV4TGlua0NvbG9yOwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5pc1BvcHVwLCBuID0gZS5wYWdlLCByID0gZS51eEJhY2tncm91bmRDb2xvcjsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICF0ICYmIDAgPT09IG4gJiYgT2JqZWN0KHZ0LmIpKHl0KCksIHIsIHIpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gUnQoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBndChbJ1xuICAgICAgICAgICAgICAgICAgaGVpZ2h0OiAzNHB4O1xuXG4gICAgICAgICAgICAgICAgICBzdmcge1xuICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IDIycHg7XG4gICAgICAgICAgICAgICAgICAgIHdpZHRoOiAxNHB4O1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICddKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUnQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBOdCgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuICAmJiB7XG4gICAgbGlzdC1zdHlsZTogbm9uZTtcbiAgICBtYXJnaW46IDA7XG4gICAgb3ZlcmZsb3c6IGhpZGRlbjtcbiAgICBwYWRkaW5nOiAwO1xuICAgIHdpZHRoOiAxMDAlO1xuXG4gICAgJjpmaXJzdC1vZi10eXBlIHtcbiAgICAgIC5xYy1jbXAyLWxpc3QtaGVhZGVyIHtcbiAgICAgICAgbWFyZ2luOiAwO1xuICAgICAgfVxuICAgIH1cblxuICAgICY6bGFzdC1vZi10eXBlIHtcbiAgICAgIG1hcmdpbi1ib3R0b206IDA7XG4gICAgfVxuXG4gICAgLnFjLWNtcDItbGlzdC1oZWFkZXIge1xuICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICBmb250LXNpemU6IDEycHg7XG4gICAgICBmb250LXdlaWdodDogOTAwO1xuICAgICAgdGV4dC10cmFuc2Zvcm06IHVwcGVyY2FzZTtcbiAgICAgIG1hcmdpbi10b3A6IDIwcHg7XG4gICAgICBwYWRkaW5nLWxlZnQ6IDIwcHg7XG4gICAgfVxuXG4gICAgLnFjLWNtcDItbGlzdC1pdGVtIHtcbiAgICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgICBmbGV4LXdyYXA6IHdyYXA7XG4gICAgICBhbGlnbi1pdGVtczogY2VudGVyO1xuICAgICAganVzdGlmeS1jb250ZW50OiBzcGFjZS1iZXR3ZWVuO1xuICAgICAgcGFkZGluZzogMTBweCAyMHB4O1xuICAgICAgZm9udC1zaXplOiAxNHB4O1xuICAgICAgZm9udC13ZWlnaHQ6IDQwMDtcblxuICAgICAgJi5xYy1jbXAyLWV4cGFuZGVkIHtcbiAgICAgICAgYmFja2dyb3VuZDogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgei1pbmRleDogMTA7XG4gICAgICB9XG5cbiAgICAgICY6b25seS1vZi10eXBlIHtcbiAgICAgICAgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICB9XG5cbiAgICAgICY6bnRoLW9mLXR5cGUoZXZlbikge1xuICAgICAgICBib3JkZXItdG9wOiAxcHggc29saWQgJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICB9XG5cbiAgICAgIC5xYy1jbXAyLWxpc3QtaXRlbS1oZWFkZXIge1xuICAgICAgICB3aWR0aDogMTAwJTtcbiAgICAgICAgZGlzcGxheTogZmxleDtcbiAgICAgICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgICAgICAganVzdGlmeS1jb250ZW50OiBzcGFjZS1iZXR3ZWVuO1xuICAgICAgICBiYWNrZ3JvdW5kOiBub25lO1xuICAgICAgICBib3JkZXI6IG5vbmU7XG4gICAgICAgIG91dGxpbmU6IG5vbmU7XG4gICAgICAgIGJveC1zaGFkb3c6IG5vbmU7XG4gICAgICAgIHRleHQtYWxpZ246IGxlZnQ7XG4gICAgICAgIHBhZGRpbmc6IDA7XG4gICAgICAgIG1pbi1oZWlnaHQ6IDIxcHg7XG4gICAgICAgIGN1cnNvcjogcG9pbnRlcjtcbiAgICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG5cbiAgICAgICAgJjpmb2N1cyB7XG4gICAgICAgICAgb3V0bGluZTogbm9uZTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICAmLnFjLWNtcDItbGlzdC1pdGVtLWxlZ2l0aW1hdGUge1xuICAgICAgICAucWMtY21wMi1saXN0LWl0ZW0tdGl0bGUge1xuICAgICAgICAgIHdpZHRoOiA3NSU7XG4gICAgICAgIH1cbiAgICAgICAgLnFjLWNtcDItdG9nZ2xlLXN3aXRjaCB7XG4gICAgICAgICAgb3JkZXI6IDI7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgLnFjLWNtcDItbGlzdC1pdGVtLXRpdGxlIHtcbiAgICAgICAgbWFyZ2luOiAwO1xuICAgICAgICBwYWRkaW5nOiAwO1xuICAgICAgICB3aWR0aDogODAlO1xuICAgICAgICBmb250LXNpemU6IDE0cHg7XG4gICAgICAgIGN1cnNvcjogcG9pbnRlcjtcbiAgICAgICAgc3Ryb25nIHtcbiAgICAgICAgICBjb2xvcjogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICAucWMtY21wMi1saXN0LWl0ZW0tc3RhdHVzIHtcbiAgICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICAgIG1hcmdpbjogMCAxMHB4IDAgMDtcbiAgICAgICAgcGFkZGluZzogMDtcbiAgICAgICAgY3Vyc29yOiBwb2ludGVyO1xuXG4gICAgICAgICYucWMtY21wLWxvbmctbGFiZWwge1xuICAgICAgICAgIGZvbnQtc2l6ZTogOXB4O1xuICAgICAgICAgIGxpbmUtaGVpZ2h0OiAxZW07XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgaW1nIHtcbiAgICAgICAgdHJhbnNpdGlvbjogdHJhbnNmb3JtIDAuMnMgZWFzZTtcbiAgICAgICAgbWF4LXdpZHRoOiAxMnB4O1xuICAgICAgfVxuXG4gICAgICAmLnFjLWNtcDItdG9nZ2xlLXN3aXRjaCB7XG4gICAgICAgIHBvaW50ZXItZXZlbnRzOiBmaWxsO1xuICAgICAgICBwYWRkaW5nOiAwIDIwcHg7XG4gICAgICB9XG5cbiAgICAgIC5xYy1jbXAyLXRvZ2dsZSB7XG4gICAgICAgICY6bm90KDpsYXN0LWNoaWxkKSB7XG4gICAgICAgICAgbWFyZ2luLXJpZ2h0OiAxNXB4O1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC5xYy1jbXAyLWV4cGFuZGFibGUtbGlzdCB7XG4gICAgICAgIGxpc3Qtc3R5bGU6IG5vbmU7XG4gICAgICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgICAgIGp1c3RpZnktY29udGVudDogc3BhY2UtYmV0d2VlbjtcbiAgICAgICAgd2lkdGg6IDEwMCU7XG4gICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgcGFkZGluZzogMDtcbiAgICAgICAgbWF4LWhlaWdodDogMDtcbiAgICAgICAgb3BhY2l0eTogMDtcbiAgICAgICAgdHJhbnNpdGlvbjogb3BhY2l0eSAwLjJzIGVhc2UsIG1heC1oZWlnaHQgMC4zcyBlYXNlLCBwYWRkaW5nIDAuM3MgZWFzZSxcbiAgICAgICAgICBtYXJnaW4gMC4zcyBlYXNlO1xuICAgICAgICBwb2ludGVyLWV2ZW50czogbm9uZTtcblxuICAgICAgICAmLnFjLXdyYXAge1xuICAgICAgICAgIGZsZXgtd3JhcDogd3JhcDtcblxuICAgICAgICAgIC5xYy1jbXAyLWV4cGFuZGFibGUtaW5mbyB7XG4gICAgICAgICAgICBvcmRlcjogMTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBwLFxuICAgICAgICBsaSB7XG4gICAgICAgICAgZm9udC1zaXplOiAxNHB4O1xuICAgICAgICAgIGxpbmUtaGVpZ2h0OiAxOHB4O1xuICAgICAgICAgIGZvbnQtd2VpZ2h0OiA0MDA7XG4gICAgICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICAgICAgbWFyZ2luOiAwO1xuICAgICAgICAgIHBhZGRpbmc6IDA7XG4gICAgICAgICAgdGV4dC10cmFuc2Zvcm06IG5vbmU7XG5cbiAgICAgICAgICBhIHtcbiAgICAgICAgICAgIGNvbG9yOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICAgICAgZm9udC13ZWlnaHQ6IDUwMDtcbiAgICAgICAgICAgIHRleHQtZGVjb3JhdGlvbjogbm9uZTtcbiAgICAgICAgICAgIHdvcmQtYnJlYWs6IGJyZWFrLWFsbDtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICAmOm5vdCg6Zmlyc3QtY2hpbGQpIHtcbiAgICAgICAgICAgIHN0cm9uZyB7XG4gICAgICAgICAgICAgIG1hcmdpbi10b3A6IDhweDtcbiAgICAgICAgICAgICAgZGlzcGxheTogYmxvY2s7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIC5xYy1jbXAyLWV4cGFuZGFibGUtaW5mbyB7XG4gICAgICAgICAgd2lkdGg6IDg1JTtcblxuICAgICAgICAgIC5xYy1jbXAyLWV4cGFuZGFibGUtbGVnYWwge1xuICAgICAgICAgICAgLnFjLWNtcDItdG9nZ2xlLWxlZ2FsLWJ1dHRvbiB7XG4gICAgICAgICAgICAgIHRleHQtdHJhbnNmb3JtOiBjYXBpdGFsaXplO1xuICAgICAgICAgICAgICBtYXJnaW4tdG9wOiAxMHB4O1xuICAgICAgICAgICAgICBhbGlnbi1pdGVtczogY2VudGVyO1xuICAgICAgICAgICAgICAnLAogICAgICAgICAgICAgICAgICAgICAgICAnXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC5xYy1jbXAyLWxlZ2FsLWRlc2NyaXB0aW9uIHtcbiAgICAgICAgICAgICAgZGlzcGxheTogbm9uZTtcbiAgICAgICAgICAgICAgcGFkZGluZy1sZWZ0OiAxNXB4O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAmLnFjLWNtcDItZXhwYW5kZWQge1xuICAgICAgICAgICAgICAucWMtY21wMi1sZWdhbC1kZXNjcmlwdGlvbiB7XG4gICAgICAgICAgICAgICAgbWFyZ2luLXRvcDogMTBweDtcbiAgICAgICAgICAgICAgICBkaXNwbGF5OiBibG9jaztcblxuICAgICAgICAgICAgICAgICYucWMtY21wMi1ub24taWFiIHtcbiAgICAgICAgICAgICAgICAgIG9wYWNpdHk6IDAuNjU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgICYucWMtY21wMi1leHBhbmRlZCB7XG4gICAgICAgIC5xYy1jbXAyLWV4cGFuZGFibGUtbGlzdCB7XG4gICAgICAgICAgbWF4LWhlaWdodDogMTUwMDAwcHg7XG4gICAgICAgICAgb3BhY2l0eTogMTtcbiAgICAgICAgICBwb2ludGVyLWV2ZW50czogZmlsbDtcbiAgICAgICAgICBtYXJnaW46IDE1cHggMDtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIEBtZWRpYSAobWluLXdpZHRoOiA3NjhweCkge1xuICAgICAgLnFjLWNtcDItbGlzdC1pdGVtIHtcbiAgICAgICAgcGFkZGluZzogMTVweDtcbiAgICAgICAgZm9udC1zaXplOiAxNHB4O1xuXG4gICAgICAgICYucWMtY21wMi1saXN0LWl0ZW0tbGVnaXRpbWF0ZSB7XG4gICAgICAgICAgLnFjLWNtcDItbGlzdC1pdGVtLXRpdGxlIHtcbiAgICAgICAgICAgIHdpZHRoOiA4MiU7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLnFjLWNtcDItbGlzdC1pdGVtLXRpdGxlIHtcbiAgICAgICAgICB3aWR0aDogOTAlO1xuICAgICAgICB9XG5cbiAgICAgICAgLnFjLWNtcDItZXhwYW5kYWJsZS1saXN0IHtcbiAgICAgICAgICAmLnFjLXdyYXAge1xuICAgICAgICAgICAgLnFjLWNtcDItZXhwYW5kYWJsZS1pbmZvIHtcbiAgICAgICAgICAgICAgb3JkZXI6IDA7XG5cbiAgICAgICAgICAgICAgJi5xYy13NzUge1xuICAgICAgICAgICAgICAgIHdpZHRoOiA3NSU7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICAucWMtY21wMi1saXN0LWl0ZW0tc3RhdHVzIHtcbiAgICAgICAgICAmLnFjLWNtcC1sb25nLWxhYmVsIHtcbiAgICAgICAgICAgIGZvbnQtc2l6ZTogMTBweDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgLnFjLWNtcDItbGlzdC1oZWFkZXIge1xuICAgICAgICBwYWRkaW5nLWxlZnQ6IDA7XG4gICAgICB9XG4gICAgfVxuICAgIEBtZWRpYSAobWF4LXdpZHRoOiA3NjhweCkge1xuICAgICAgLnFjLWNtcDItbGlzdC1pdGVtIHtcbiAgICAgICAgJi5xYy1jbXAyLWxpc3QtaXRlbS1sZWdpdGltYXRlIHtcbiAgICAgICAgICAucWMtY21wMi1leHBhbmRhYmxlLWxpc3Qge1xuICAgICAgICAgICAgZmxleC13cmFwOiBuby13cmFwO1xuICAgICAgICAgICAgLnFjLWNtcDItdG9nZ2xlLXN3aXRjaCB7XG4gICAgICAgICAgICAgIG9yZGVyOiAxO1xuICAgICAgICAgICAgICB3aWR0aDogMTAwJTtcbiAgICAgICAgICAgICAgYnV0dG9ue1xuICAgICAgICAgICAgICAgIGZsb2F0OnJpZ2h0O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAucWMtY21wMi1leHBhbmRhYmxlLWluZm8ge1xuICAgICAgICAgICAgICB3aWR0aDoxMDAlXG4gICAgICAgICAgICAgIG9yZGVyOiAyO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiAgfVxuJwogICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBOdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuR09fVE9fUEFHRSA9ICdnb1RvUGFnZScsIGUuUFVSUE9TRSA9ICdwdXJwb3NlJywgZS5MRUdJVElNQVRFX1BVUlBPU0UgPSAnbGVnaXRpbWF0ZVB1cnBvc2UnLCBlLkxFR0lUSU1BVEVfVkVORE9SID0gJ2xlZ2l0aW1hdGVWZW5kb3InLCBlLlNQRUNJQUxfRkVBVFVSRSA9ICdzcGVjaWFsRmVhdHVyZScsIGUuU1RBQ0sgPSAnc3RhY2snLCBlLlBBUlRJQUxfQ09OU0VOVCA9ICdwYXJ0aWFsJywgZS5TQVZFX0FORF9FWElUID0gJ3NhdmVBbmRFeGl0JywgZS5BQ0NFUFRfQUxMID0gJ2FjY2VwdEFsbCcsIGUuUkVKRUNUX0FMTCA9ICdyZWplY3RBbGwnLCBlLkFDQ0VQVF9BTExfTEVHSVRJTUFURSA9ICdhY2NlcHRBbGxMZWdpdGltYXRlJywgZS5PQkpFQ1RfQUxMX0xFR0lUSU1BVEUgPSAnb2JqZWN0QWxsTGVnaXRpbWF0ZScsIGUuVkVORE9SID0gJ3ZlbmRvcicsIGUuTk9OX0lBQl9WRU5ET1IgPSAnbm9uSWFiVmVuZG9yJywgZS5ESVNNSVNTX1VJID0gJ2Rpc21pc3NVaScsIGUuU1RBUlRfT05fUEFHRSA9ICdzdGFydE9uUGFnZScsIGUuT1BUX09VVF9UT0dHTEUgPSAnb3B0T3V0VG9nZ2xlJywgZS5PUFRfT1VUX0NPTkZJUk0gPSAnb3B0T3V0Q29uZmlybScsIGUuRVhQQU5EX0VMRU1FTlQgPSAnZXhwYW5kRWxlbWVudCcsIGUuQ09MTEFQU0VfRUxFTUVOVCA9ICdjb2xsYXBzZUVsZW1lbnQnLCBlLkdPT0dMRSA9ICdnb29nbGVQYXJ0bmVyJzsKICAgICAgICAgICAgICAgIH0oeHQgfHwgKHh0ID0ge30pKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLk1BTkRBVE9SWSA9ICd0Y2Z1aTptYW5kYXRvcnknLCBlLkNIQU5HRV9PRl9DT05TRU5UID0gJ3RjZnVpOmNoYW5nZW9mY29uc2VudCcsIGUuQ0NQQSA9ICd1c3B1aTpkb25vdHNlbGwnOwogICAgICAgICAgICAgICAgfShTdCB8fCAoU3QgPSB7fSkpLCAoa3QgPSBDdCB8fCAoQ3QgPSB7fSkpLkZFQVRVUkVTID0gJ0ZlYXR1cmVzJywga3QuTk9OX0lBQiA9ICdOb24gSUFCJywga3QuUFVSUE9TRVMgPSAnUHVycG9zZXMnLCBrdC5MRUdJVElNQVRFX1BVUlBPU0VTID0gJ0xlZ2l0aW1hdGUgUHVycG9zZXMnLCBrdC5MRUdJVElNQVRFX1ZFTkRPUlMgPSAnTGVnaXRpbWF0ZSBWZW5kb3JzJywga3QuU1BFQ0lBTF9QVVJQT1NFUyA9ICdTcGVjaWFsIFB1cnBvc2VzJywga3QuU1BFQ0lBTF9GRUFUVVJFUyA9ICdTcGVjaWFsIEZlYXR1cmVzJywga3QuVkVORE9SUyA9ICdWZW5kb3JzJywga3QuU1RBQ0tTID0gJ1N0YWNrcycsIGt0LkdPT0dMRSA9ICdHb29nbGUnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuSU5JVCA9ICdpbml0JywgZS5OQVZJR0FUSU9OID0gJ25hdmlnYXRpb24nLCBlLkRPTkUgPSAnZG9uZSc7CiAgICAgICAgICAgICAgICB9KFR0IHx8IChUdCA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5BQ0NFUFRfQUxMID0gJ0FsbCcsIGUuQUNDRVBUX1BBUlRJQUwgPSAnUGFydGlhbCcsIGUuUkVKRUNUID0gJ1JlamVjdCc7CiAgICAgICAgICAgICAgICB9KF90IHx8IChfdCA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5OT05FX09CSkVDVEVEID0gJ05vbmUnLCBlLkFMTF9PQkpFQ1RFRCA9ICdBbGwnOwogICAgICAgICAgICAgICAgfShQdCB8fCAoUHQgPSB7fSkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuU1RBQ0tTID0gJ3N0YWNrcycsIGUuVkVORE9SUyA9ICd2ZW5kb3JzJywgZS5GRUFUVVJFUyA9ICdmZWF0dXJlcycsIGUuUFVSUE9TRVMgPSAncHVycG9zZXMnLCBlLlNQRUNJQUxfRkVBVFVSRVMgPSAnc3BlY2lhbEZlYXR1cmVzJywgZS5TUEVDSUFMX1BVUlBPU0VTID0gJ3NwZWNpYWxQdXJwb3NlcycsIGUuRkxFWElCTEVfUFVSUE9TRVMgPSAnZmxleGlibGVQdXJwb3NlcycsIGUuTEVHSVRJTUFURV9WRU5ET1JTID0gJ2xlZ2l0aW1hdGVWZW5kb3JzJywgZS5MRUdJVElNQVRFX1BVUlBPU0VTID0gJ2xlZ2l0aW1hdGVQdXJwb3NlcycsIGUuVU5GSUxURVJFRF9GRUFUVVJFUyA9ICd1bmZpbHRlcmVkRmVhdHVyZXMnLCBlLlVORklMVEVSRURfUFVSUE9TRVMgPSAndW5maWx0ZXJlZFB1cnBvc2VzJywgZS5VTkZJTFRFUkVEX1NQRUNJQUxfRkVBVFVSRVMgPSAndW5maWx0ZXJlZFNwZWNpYWxGZWF0dXJlcycsIGUuVU5GSUxURVJFRF9TUEVDSUFMX1BVUlBPU0VTID0gJ3VuZmlsdGVyZWRTcGVjaWFsUHVycG9zZXMnOwogICAgICAgICAgICAgICAgfShPdCB8fCAoT3QgPSB7fSkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuQ09OU0VOVF9SRVNQT05TRSA9ICdjb25zZW50LXJlc3BvbnNlJywgZS5DT05TRU5UX1VJID0gJ2NvbnNlbnQtdWknOwogICAgICAgICAgICAgICAgfShJdCB8fCAoSXQgPSB7fSkpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuQUNDRVBUID0gJ2FjY2VwdCcsIGUuUkVKRUNUID0gJ3JlamVjdCcsIGUuRElTTUlTUyA9ICdkaXNtaXNzJywgZS5FTlRFUl9GVUxMU0NSRUVOID0gJ2VudGVyLWZ1bGxzY3JlZW4nOwogICAgICAgICAgICAgICAgfShMdCB8fCAoTHQgPSB7fSkpOwogICAgICAgICAgICAgICAgdmFyIGp0ID0gdnQuYy51bChOdCgpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN1YkhlYWRlckNvbG9yOwogICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS51eEJhY2tncm91bmRDb2xvcjsKICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYm9yZGVyQ29sb3I7CiAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmJvcmRlckNvbG9yOwogICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5ib3JkZXJDb2xvcjsKICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubGlnaHRUZXh0Q29sb3I7CiAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnNlY29uZGFyeVRleHRDb2xvcjsKICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubGlnaHRUZXh0Q29sb3I7CiAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnNlY29uZGFyeVRleHRDb2xvcjsKICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhQcmltYXJ5QnV0dG9uQ29sb3I7CiAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmlzSUUgJiYgT2JqZWN0KHZ0LmIpKFJ0KCkpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBxdCgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsnXG4gICAgICAgIG1hcmdpbi10b3A6IDEwcHg7XG4gICAgICAgIG1hcmdpbi1yaWdodDogM3B4O1xuICAgICAgICB0cmFuc2Zvcm0tb3JpZ2luOiAxNSUgMzAlO1xuXG4gICAgICAgIC5xYy1jbXAyLWV4cGFuZGFibGUtbGVnYWwucWMtY21wMi1leHBhbmRlZCAmIHtcbiAgICAgICAgICB0cmFuc2Zvcm06IHJvdGF0ZSg5MGRlZyk7XG4gICAgICAgIH1cbiAgICAgICddKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBGdCgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsnXG4gICAgICAgIGhlaWdodDogMTJweDtcbiAgICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMTgwZGVnKTtcbiAgICAgICAgd2lkdGg6IDEycHg7XG5cbiAgICAgICAgLmV4cGFuZGVkICYge1xuICAgICAgICAgIHRyYW5zZm9ybTogcm90YXRlKDI3MGRlZyk7XG4gICAgICAgIH1cbiAgICAgICddKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRnQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBEdCgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsnXG4gICAgICAgIGhlaWdodDogMTlweDtcbiAgICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMTgwZGVnKTtcbiAgICAgICAgd2lkdGg6IDEycHg7XG5cbiAgICAgICAgLnFjLWNtcDItZXhwYW5kZWQgJiB7XG4gICAgICAgICAgdHJhbnNmb3JtOiByb3RhdGUoMjcwZGVnKTtcbiAgICAgICAgfVxuICAgICAgJ10pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBEdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE10KCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZ3QoWydcbiAgICAgICAgbWFyZ2luLXJpZ2h0OiA1cHg7XG4gICAgICAnXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE10ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gVXQoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBndChbCiAgICAgICAgICAgICAgICAgICAgICAgICdcbiAgJiYmIHtcbiAgICB0cmFuc2l0aW9uOiB0cmFuc2Zvcm0gMC4zcyBlYXNlO1xuXG4gICAgJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuXG4gICAgJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuXG4gICAgJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuXG4gICAgJywKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuICB9XG4nCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFV0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIFZ0ID0gdnQuYy5zdmcoVXQoKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdiYWNrJyA9PT0gZS50eXBlICYmIE9iamVjdCh2dC5iKShNdCgpKTsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2V4cGFuZCcgPT09IGUudHlwZSAmJiBPYmplY3QodnQuYikoRHQoKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdpbm5lcicgPT09IGUudHlwZSAmJiBPYmplY3QodnQuYikoRnQoKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmaWxsJyA9PT0gZS50eXBlICYmIE9iamVjdCh2dC5iKShxdCgpKTsKICAgICAgICAgICAgICAgICAgICB9KSwgQnQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IGUudHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2ZpbGwnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IFFlLmEuY3JlYXRlRWxlbWVudCgncGF0aCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkOiAnTTUgNC41TDAuNSAwTDAuNSA5TDUgNC41WicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsbDogJ2N1cnJlbnRDb2xvcicKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2V4cGFuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2lubmVyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBRZS5hLmNyZWF0ZUVsZW1lbnQoUWUuYS5GcmFnbWVudCwgbnVsbCwgUWUuYS5jcmVhdGVFbGVtZW50KCdkZWZzJywgbnVsbCwgUWUuYS5jcmVhdGVFbGVtZW50KCdwYXRoJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQ6ICdNMy44ODcxNjg4Niw4LjQ3MDQ4MzcxIEwxMi4xNDMxNDcyLDAuMzE1ODI2NDE5IEMxMi40NzI1NDUzLC0wLjAxNDU3Nzc5ODcgMTMuMDA1MTg5LC0wLjAxNDU3Nzc5ODcgMTMuMzM0NTg3MiwwLjMxNTgyNjQxOSBMMTMuODMyMTg4NiwwLjgxNDk0NzY4NSBDMTQuMTYxNTg2NywxLjE0NTM1MTkgMTQuMTYxNTg2NywxLjY3OTYyMjU1IDEzLjgzMjE4ODYsMi4wMTAwMjY3NyBMNi42NjI1MjMyLDkuMDY4MDIzMjYgTDEzLjgyNTE4MDEsMTYuMTI2MDE5NyBDMTQuMTU0NTc4MiwxNi40NTY0MjQgMTQuMTU0NTc4MiwxNi45OTA2OTQ2IDEzLjgyNTE4MDEsMTcuMzIxMDk4OCBMMTMuMzI3NTc4NywxNy44MjAyMjAxIEMxMi45OTgxODA2LDE4LjE1MDYyNDMgMTIuNDY1NTM2OCwxOC4xNTA2MjQzIDEyLjEzNjEzODcsMTcuODIwMjIwMSBMMy44ODAxNjAzOSw5LjY2NTU2MjggQzMuNTU3NzcwNzUsOS4zMzUxNTg1OCAzLjU1Nzc3MDc1LDguODAwODg3OTMgMy44ODcxNjg4Niw4LjQ3MDQ4MzcxIFonLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAncGF0aC0xJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIFFlLmEuY3JlYXRlRWxlbWVudCgncmVjdCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ3BhdGgtMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeDogJzAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHk6ICcwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDogJzE4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6ICcxOCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgUWUuYS5jcmVhdGVFbGVtZW50KCdnJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnTmV3LS0tTW9iaWxlLTInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cm9rZTogJ25vbmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cm9rZVdpZHRoOiAnMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsbDogJ25vbmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGxSdWxlOiAnZXZlbm9kZCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFFlLmEuY3JlYXRlRWxlbWVudCgnZycsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ2lQaG9uZS0xMS02LUNvcHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybTogJ3RyYW5zbGF0ZSgtMjMuMDAwMDAwLCAtMTM4LjAwMDAwMCknCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2cnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICd2MScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtOiAndHJhbnNsYXRlKDIwLjAwMDAwMCwgMTM4LjAwMDAwMCknCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2cnLCB7IGlkOiAnSWNvbnMvYW5nbGUtbGVmdCcgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdtYXNrJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnbWFzay0yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxsOiAnd2hpdGUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3VzZScsIHsgaHJlZjogJyNwYXRoLTEnIH0pKSwgUWUuYS5jcmVhdGVFbGVtZW50KCd1c2UnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdNYXNrJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxsOiAnY3VycmVudENvbG9yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxsUnVsZTogJ25vbnplcm8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhyZWY6ICcjcGF0aC0xJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpKSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IFFlLmEuY3JlYXRlRWxlbWVudChRZS5hLkZyYWdtZW50LCBudWxsLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RlZnMnLCBudWxsLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3BhdGgnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZDogJ00zLjg4NzE2ODg2LDguNDcwNDgzNzEgTDEyLjE0MzE0NzIsMC4zMTU4MjY0MTkgQzEyLjQ3MjU0NTMsLTAuMDE0NTc3Nzk4NyAxMy4wMDUxODksLTAuMDE0NTc3Nzk4NyAxMy4zMzQ1ODcyLDAuMzE1ODI2NDE5IEwxMy44MzIxODg2LDAuODE0OTQ3Njg1IEMxNC4xNjE1ODY3LDEuMTQ1MzUxOSAxNC4xNjE1ODY3LDEuNjc5NjIyNTUgMTMuODMyMTg4NiwyLjAxMDAyNjc3IEw2LjY2MjUyMzIsOS4wNjgwMjMyNiBMMTMuODI1MTgwMSwxNi4xMjYwMTk3IEMxNC4xNTQ1NzgyLDE2LjQ1NjQyNCAxNC4xNTQ1NzgyLDE2Ljk5MDY5NDYgMTMuODI1MTgwMSwxNy4zMjEwOTg4IEwxMy4zMjc1Nzg3LDE3LjgyMDIyMDEgQzEyLjk5ODE4MDYsMTguMTUwNjI0MyAxMi40NjU1MzY4LDE4LjE1MDYyNDMgMTIuMTM2MTM4NywxNy44MjAyMjAxIEwzLjg4MDE2MDM5LDkuNjY1NTYyOCBDMy41NTc3NzA3NSw5LjMzNTE1ODU4IDMuNTU3NzcwNzUsOC44MDA4ODc5MyAzLjg4NzE2ODg2LDguNDcwNDgzNzEgWicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdwYXRoLTEnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgUWUuYS5jcmVhdGVFbGVtZW50KCdyZWN0JywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAncGF0aC0zJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4OiAnMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeTogJzAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMTgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzE4JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2cnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdOZXctLS1Nb2JpbGUtMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Ryb2tlOiAnbm9uZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Ryb2tlV2lkdGg6ICcxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxsOiAnbm9uZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsbFJ1bGU6ICdldmVub2RkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdnJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnaVBob25lLTExLTYtQ29weScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtOiAndHJhbnNsYXRlKC0yMy4wMDAwMDAsIC0xMzguMDAwMDAwKScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFFlLmEuY3JlYXRlRWxlbWVudCgnZycsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ3YxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2Zvcm06ICd0cmFuc2xhdGUoMjAuMDAwMDAwLCAxMzguMDAwMDAwKScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFFlLmEuY3JlYXRlRWxlbWVudCgnZycsIHsgaWQ6ICdJY29ucy9hbmdsZS1sZWZ0JyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ21hc2snLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdtYXNrLTInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGw6ICd3aGl0ZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFFlLmEuY3JlYXRlRWxlbWVudCgndXNlJywgeyBocmVmOiAnI3BhdGgtMScgfSkpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3VzZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ01hc2snLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbGw6ICcjMDAwMDAwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxsUnVsZTogJ25vbnplcm8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhyZWY6ICcjcGF0aC0xJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpKSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KFZ0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6ICcxMnB4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzE5cHgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlld0JveDogJzAgMCAxMiAxOScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiAnMS4xJwogICAgICAgICAgICAgICAgICAgICAgICB9LCB0KTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24genQoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciwgbyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCByLCBvID0ge30sIGkgPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAociA9IDA7IHIgPCBpLmxlbmd0aDsgcisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBpW3JdLCB0LmluZGV4T2YobikgPj0gMCB8fCAob1tuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgaS5sZW5ndGg7IHIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBpW3JdLCB0LmluZGV4T2YobikgPj0gMCB8fCBPYmplY3QucHJvdG90eXBlLnByb3BlcnR5SXNFbnVtZXJhYmxlLmNhbGwoZSwgbikgJiYgKG9bbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBHdCgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuICAgICAgICBiYWNrZ3JvdW5kOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICBib3JkZXItY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICAgIG1pbi1oZWlnaHQ6IDE4cHg7XG4gICAgICAgIGJvcmRlci1yYWRpdXM6IDE4cHg7XG4gICAgICAgIC50b2dnbGUge1xuICAgICAgICAgIHJpZ2h0OiAwO1xuICAgICAgICB9XG4gICAgICAgIHAudGV4dCB7XG4gICAgICAgICAgJi5vbiB7XG4gICAgICAgICAgICBkaXNwbGF5OiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICAgIH1cbiAgICAgICAgICAmLm9mZiB7XG4gICAgICAgICAgICBkaXNwbGF5OiBub25lO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIEBtZWRpYSAobWluLXdpZHRoOiA3NjhweCkge1xuICAgICAgICAgIG1pbi1oZWlnaHQ6IDI1cHg7XG4gICAgICAgICAgYm9yZGVyLXJhZGl1czogMjVweDtcbiAgICAgICAgfVxuICAgICAgJwogICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBHdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEh0KCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZ3QoWwogICAgICAgICAgICAgICAgICAgICAgICAnXG4gICYmJiYge1xuICAgIHdpZHRoOiAzMHB4O1xuICAgIGhlaWdodDogMThweDtcbiAgICBib3JkZXItcmFkaXVzOiAxOHB4O1xuICAgIHBhZGRpbmc6IDA7XG4gICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgICBtYXJnaW46IDAgMCAwIGF1dG87XG4gICAgYmFja2dyb3VuZDogI2E2YTlhZTtcbiAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgYm9yZGVyOiAxcHggc29saWQgI2E2YTlhZTtcbiAgICBib3gtc2l6aW5nOiBjb250ZW50LWJveDtcbiAgICBib3JkZXItcmFkaXVzOiAxOHB4O1xuICAgIG1pbi1oZWlnaHQ6IDE4cHg7XG5cbiAgICAudG9nZ2xlIHtcbiAgICAgIHdpZHRoOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgaGVpZ2h0OiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgYm9yZGVyLXJhZGl1czogNTAlO1xuICAgICAgYmFja2dyb3VuZDogd2hpdGU7XG4gICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICB0b3A6IDA7XG4gICAgICByaWdodDogMTJweDtcbiAgICB9XG5cbiAgICBwLnRleHQge1xuICAgICAgZm9udC1zaXplOiA5cHg7XG4gICAgICBmb250LXdlaWdodDogNzAwO1xuICAgICAgdGV4dC10cmFuc2Zvcm06IGNhcGl0YWxpemU7XG4gICAgICBtYXJnaW4tdG9wOiAyMHB4O1xuICAgICAgdGV4dC1hbGlnbjogY2VudGVyO1xuICAgICAgZGlzcGxheTogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICYub24ge1xuICAgICAgICBjb2xvcjogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgZGlzcGxheTogbm9uZTtcbiAgICAgIH1cbiAgICAgICYub2ZmIHtcbiAgICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICB9XG4gICAgfVxuICAgIEBtZWRpYSAobWluLXdpZHRoOiA3NjhweCkge1xuICAgICAgd2lkdGg6IDUwcHg7XG4gICAgICBoZWlnaHQ6IDI1cHg7XG4gICAgICBtaW4taGVpZ2h0OiAyNXB4O1xuICAgICAgYm9yZGVyLXJhZGl1czogMjVweDtcbiAgICAgIHAudGV4dCB7XG4gICAgICAgIG1hcmdpbi10b3A6IDMwcHg7XG4gICAgICAgIHRleHQtdHJhbnNmb3JtOiB1cHBlcmNhc2U7XG4gICAgICB9XG5cbiAgICAgIC50b2dnbGUge1xuICAgICAgICB3aWR0aDogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgaGVpZ2h0OiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICByaWdodDogMjVweDtcbiAgICAgIH1cbiAgICB9XG5cbiAgICAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICB9XG4nCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEh0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIFd0ID0gdnQuYy5idXR0b24oSHQoKSwgJzE4cHgnLCAnMThweCcsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnNob3dMYWJlbCA/ICdibG9jaycgOiAnbm9uZSc7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhQcmltYXJ5QnV0dG9uQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc2Vjb25kYXJ5VGV4dENvbG9yOwogICAgICAgICAgICAgICAgICAgIH0sICcyNXB4JywgJzI1cHgnLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuc3dpdGNoU3RhdGUsIG4gPSBlLnV4VG9vZ2xlQWN0aXZlQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIE9iamVjdCh2dC5iKShHdCgpLCBuLCBuLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc2hvd0xhYmVsID8gJ2Jsb2NrJyA6ICdub25lJzsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSksICR0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLm9uLCBuID0gdm9pZCAwICE9PSB0ICYmIHQsIHIgPSBlLmNsYXNzTmFtZSwgbyA9IGUub25DbGljaywgaSA9IGUuc2hvd0xhYmVsLCBhID0gdm9pZCAwICE9PSBpICYmIGksIHMgPSBlLmRpc2FibGVkLCBjID0gdm9pZCAwICE9PSBzICYmIHMsIHUgPSB6dChlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY2xhc3NOYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnb25DbGljaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Nob3dMYWJlbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Rpc2FibGVkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoV3QsIE9iamVjdC5hc3NpZ24oewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFiSW5kZXg6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByb2xlOiAnc3dpdGNoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcmlhLWxhYmVsJzogJ0NvbnNlbnQgdG9nZ2xlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcmlhLWNoZWNrZWQnOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoU3RhdGU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkNsaWNrOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiByICYmIHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG93TGFiZWw6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNhYmxlZDogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV4UHJpbWFyeUJ1dHRvbkNvbG9yOiBfby51eFByaW1hcnlCdXR0b25Db2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY29uZGFyeVRleHRDb2xvcjogX28uc2Vjb25kYXJ5VGV4dENvbG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXhUb29nbGVBY3RpdmVDb2xvcjogX28udXhUb29nbGVBY3RpdmVDb2xvcgogICAgICAgICAgICAgICAgICAgICAgICB9LCB1KSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ3RvZ2dsZScgfSksIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3RleHQgb2ZmJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcmlhLWxhYmVsJzogJ1RvZ2dsZSBvZmYnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFBvLmNvcmVVaUxhYmVscy5vZmZMYWJlbCksIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3RleHQgb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FyaWEtbGFiZWwnOiAnVG9nZ2xlIG9uJwogICAgICAgICAgICAgICAgICAgICAgICB9LCBQby5jb3JlVWlMYWJlbHMub25MYWJlbCkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBZdChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChZdCA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiA/IE9iamVjdC5nZXRQcm90b3R5cGVPZiA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLl9fcHJvdG9fXyB8fCBPYmplY3QuZ2V0UHJvdG90eXBlT2YoZSk7CiAgICAgICAgICAgICAgICAgICAgfSkoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBRdChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChRdCA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5fX3Byb3RvX18gPSB0LCBlOwogICAgICAgICAgICAgICAgICAgIH0pKGUsIHQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gS3QoKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnID09PSB0eXBlb2YgUmVmbGVjdCB8fCAhUmVmbGVjdC5jb25zdHJ1Y3QpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBpZiAoUmVmbGVjdC5jb25zdHJ1Y3Quc2hhbSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09PSB0eXBlb2YgUHJveHkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGF0ZS5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChSZWZsZWN0LmNvbnN0cnVjdChEYXRlLCBbXSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9KSksICEwOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEp0KGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKEp0ID0gS3QoKSA/IFJlZmxlY3QuY29uc3RydWN0IDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBbbnVsbF07CiAgICAgICAgICAgICAgICAgICAgICAgIHIucHVzaC5hcHBseShyLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBuZXcgKEZ1bmN0aW9uLmJpbmQuYXBwbHkoZSwgcikpKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICYmIFF0KG8sIG4ucHJvdG90eXBlKSwgbzsKICAgICAgICAgICAgICAgICAgICB9KS5hcHBseShudWxsLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gWHQoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIE1hcCA/IG5ldyBNYXAoKSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKFh0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT09IGUgfHwgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xICE9PSBGdW5jdGlvbi50b1N0cmluZy5jYWxsKGUpLmluZGV4T2YoJ1tuYXRpdmUgY29kZV0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmdW5jdGlvbicgIT09IHR5cGVvZiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignU3VwZXIgZXhwcmVzc2lvbiBtdXN0IGVpdGhlciBiZSBudWxsIG9yIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9PSB0eXBlb2YgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQuaGFzKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmdldChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2V0KGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSnQoZSwgYXJndW1lbnRzLCBZdCh0aGlzKS5jb25zdHJ1Y3Rvcik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShlLnByb3RvdHlwZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3RydWN0b3I6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KSwgUXQobiwgZSk7CiAgICAgICAgICAgICAgICAgICAgfSkoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgWnQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0LCBuOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIodCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJlZmVyZW5jZUVycm9yKCd0aGlzIGhhc25cJ3QgYmVlbiBpbml0aWFsaXNlZCAtIHN1cGVyKCkgaGFzblwndCBiZWVuIGNhbGxlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZS5jYWxsKHRoaXMsICdBbiBlcnJvciBvY2N1cnJlZC4gU2VlIGh0dHBzOi8vZ2l0aHViLmNvbS9zdHlsZWQtY29tcG9uZW50cy9wb2xpc2hlZC9ibG9iL21haW4vc3JjL2ludGVybmFsSGVscGVycy9lcnJvcnMubWQjJyArIHQgKyAnIGZvciBtb3JlIGluZm9ybWF0aW9uLicpIHx8IHRoaXMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9IGUsICh0ID0gcikucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShuLnByb3RvdHlwZSksIHQucHJvdG90eXBlLmNvbnN0cnVjdG9yID0gdCwgdC5fX3Byb3RvX18gPSBuLCByOwogICAgICAgICAgICAgICAgfShYdChFcnJvcikpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZW4oZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLnJvdW5kKDI1NSAqIGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdG4oZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlbihlKSArICcsJyArIGVuKHQpICsgJywnICsgZW4obik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBubihlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gciAmJiAociA9IHRuKSwgMCA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIobiwgbiwgbik7CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSAoZSAlIDM2MCArIDM2MCkgJSAzNjAgLyA2MCwgaSA9ICgxIC0gTWF0aC5hYnMoMiAqIG4gLSAxKSkgKiB0LCBhID0gaSAqICgxIC0gTWF0aC5hYnMobyAlIDIgLSAxKSksIHMgPSAwLCBjID0gMCwgdSA9IDA7CiAgICAgICAgICAgICAgICAgICAgbyA+PSAwICYmIG8gPCAxID8gKHMgPSBpLCBjID0gYSkgOiBvID49IDEgJiYgbyA8IDIgPyAocyA9IGEsIGMgPSBpKSA6IG8gPj0gMiAmJiBvIDwgMyA/IChjID0gaSwgdSA9IGEpIDogbyA+PSAzICYmIG8gPCA0ID8gKGMgPSBhLCB1ID0gaSkgOiBvID49IDQgJiYgbyA8IDUgPyAocyA9IGEsIHUgPSBpKSA6IG8gPj0gNSAmJiBvIDwgNiAmJiAocyA9IGksIHUgPSBhKTsKICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IG4gLSBpIC8gMjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihzICsgbCwgYyArIGwsIHUgKyBsKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBybiA9IHsKICAgICAgICAgICAgICAgICAgICBhbGljZWJsdWU6ICdmMGY4ZmYnLAogICAgICAgICAgICAgICAgICAgIGFudGlxdWV3aGl0ZTogJ2ZhZWJkNycsCiAgICAgICAgICAgICAgICAgICAgYXF1YTogJzAwZmZmZicsCiAgICAgICAgICAgICAgICAgICAgYXF1YW1hcmluZTogJzdmZmZkNCcsCiAgICAgICAgICAgICAgICAgICAgYXp1cmU6ICdmMGZmZmYnLAogICAgICAgICAgICAgICAgICAgIGJlaWdlOiAnZjVmNWRjJywKICAgICAgICAgICAgICAgICAgICBiaXNxdWU6ICdmZmU0YzQnLAogICAgICAgICAgICAgICAgICAgIGJsYWNrOiAnMDAwJywKICAgICAgICAgICAgICAgICAgICBibGFuY2hlZGFsbW9uZDogJ2ZmZWJjZCcsCiAgICAgICAgICAgICAgICAgICAgYmx1ZTogJzAwMDBmZicsCiAgICAgICAgICAgICAgICAgICAgYmx1ZXZpb2xldDogJzhhMmJlMicsCiAgICAgICAgICAgICAgICAgICAgYnJvd246ICdhNTJhMmEnLAogICAgICAgICAgICAgICAgICAgIGJ1cmx5d29vZDogJ2RlYjg4NycsCiAgICAgICAgICAgICAgICAgICAgY2FkZXRibHVlOiAnNWY5ZWEwJywKICAgICAgICAgICAgICAgICAgICBjaGFydHJldXNlOiAnN2ZmZjAwJywKICAgICAgICAgICAgICAgICAgICBjaG9jb2xhdGU6ICdkMjY5MWUnLAogICAgICAgICAgICAgICAgICAgIGNvcmFsOiAnZmY3ZjUwJywKICAgICAgICAgICAgICAgICAgICBjb3JuZmxvd2VyYmx1ZTogJzY0OTVlZCcsCiAgICAgICAgICAgICAgICAgICAgY29ybnNpbGs6ICdmZmY4ZGMnLAogICAgICAgICAgICAgICAgICAgIGNyaW1zb246ICdkYzE0M2MnLAogICAgICAgICAgICAgICAgICAgIGN5YW46ICcwMGZmZmYnLAogICAgICAgICAgICAgICAgICAgIGRhcmtibHVlOiAnMDAwMDhiJywKICAgICAgICAgICAgICAgICAgICBkYXJrY3lhbjogJzAwOGI4YicsCiAgICAgICAgICAgICAgICAgICAgZGFya2dvbGRlbnJvZDogJ2I4ODYwYicsCiAgICAgICAgICAgICAgICAgICAgZGFya2dyYXk6ICdhOWE5YTknLAogICAgICAgICAgICAgICAgICAgIGRhcmtncmVlbjogJzAwNjQwMCcsCiAgICAgICAgICAgICAgICAgICAgZGFya2dyZXk6ICdhOWE5YTknLAogICAgICAgICAgICAgICAgICAgIGRhcmtraGFraTogJ2JkYjc2YicsCiAgICAgICAgICAgICAgICAgICAgZGFya21hZ2VudGE6ICc4YjAwOGInLAogICAgICAgICAgICAgICAgICAgIGRhcmtvbGl2ZWdyZWVuOiAnNTU2YjJmJywKICAgICAgICAgICAgICAgICAgICBkYXJrb3JhbmdlOiAnZmY4YzAwJywKICAgICAgICAgICAgICAgICAgICBkYXJrb3JjaGlkOiAnOTkzMmNjJywKICAgICAgICAgICAgICAgICAgICBkYXJrcmVkOiAnOGIwMDAwJywKICAgICAgICAgICAgICAgICAgICBkYXJrc2FsbW9uOiAnZTk5NjdhJywKICAgICAgICAgICAgICAgICAgICBkYXJrc2VhZ3JlZW46ICc4ZmJjOGYnLAogICAgICAgICAgICAgICAgICAgIGRhcmtzbGF0ZWJsdWU6ICc0ODNkOGInLAogICAgICAgICAgICAgICAgICAgIGRhcmtzbGF0ZWdyYXk6ICcyZjRmNGYnLAogICAgICAgICAgICAgICAgICAgIGRhcmtzbGF0ZWdyZXk6ICcyZjRmNGYnLAogICAgICAgICAgICAgICAgICAgIGRhcmt0dXJxdW9pc2U6ICcwMGNlZDEnLAogICAgICAgICAgICAgICAgICAgIGRhcmt2aW9sZXQ6ICc5NDAwZDMnLAogICAgICAgICAgICAgICAgICAgIGRlZXBwaW5rOiAnZmYxNDkzJywKICAgICAgICAgICAgICAgICAgICBkZWVwc2t5Ymx1ZTogJzAwYmZmZicsCiAgICAgICAgICAgICAgICAgICAgZGltZ3JheTogJzY5Njk2OScsCiAgICAgICAgICAgICAgICAgICAgZGltZ3JleTogJzY5Njk2OScsCiAgICAgICAgICAgICAgICAgICAgZG9kZ2VyYmx1ZTogJzFlOTBmZicsCiAgICAgICAgICAgICAgICAgICAgZmlyZWJyaWNrOiAnYjIyMjIyJywKICAgICAgICAgICAgICAgICAgICBmbG9yYWx3aGl0ZTogJ2ZmZmFmMCcsCiAgICAgICAgICAgICAgICAgICAgZm9yZXN0Z3JlZW46ICcyMjhiMjInLAogICAgICAgICAgICAgICAgICAgIGZ1Y2hzaWE6ICdmZjAwZmYnLAogICAgICAgICAgICAgICAgICAgIGdhaW5zYm9ybzogJ2RjZGNkYycsCiAgICAgICAgICAgICAgICAgICAgZ2hvc3R3aGl0ZTogJ2Y4ZjhmZicsCiAgICAgICAgICAgICAgICAgICAgZ29sZDogJ2ZmZDcwMCcsCiAgICAgICAgICAgICAgICAgICAgZ29sZGVucm9kOiAnZGFhNTIwJywKICAgICAgICAgICAgICAgICAgICBncmF5OiAnODA4MDgwJywKICAgICAgICAgICAgICAgICAgICBncmVlbjogJzAwODAwMCcsCiAgICAgICAgICAgICAgICAgICAgZ3JlZW55ZWxsb3c6ICdhZGZmMmYnLAogICAgICAgICAgICAgICAgICAgIGdyZXk6ICc4MDgwODAnLAogICAgICAgICAgICAgICAgICAgIGhvbmV5ZGV3OiAnZjBmZmYwJywKICAgICAgICAgICAgICAgICAgICBob3RwaW5rOiAnZmY2OWI0JywKICAgICAgICAgICAgICAgICAgICBpbmRpYW5yZWQ6ICdjZDVjNWMnLAogICAgICAgICAgICAgICAgICAgIGluZGlnbzogJzRiMDA4MicsCiAgICAgICAgICAgICAgICAgICAgaXZvcnk6ICdmZmZmZjAnLAogICAgICAgICAgICAgICAgICAgIGtoYWtpOiAnZjBlNjhjJywKICAgICAgICAgICAgICAgICAgICBsYXZlbmRlcjogJ2U2ZTZmYScsCiAgICAgICAgICAgICAgICAgICAgbGF2ZW5kZXJibHVzaDogJ2ZmZjBmNScsCiAgICAgICAgICAgICAgICAgICAgbGF3bmdyZWVuOiAnN2NmYzAwJywKICAgICAgICAgICAgICAgICAgICBsZW1vbmNoaWZmb246ICdmZmZhY2QnLAogICAgICAgICAgICAgICAgICAgIGxpZ2h0Ymx1ZTogJ2FkZDhlNicsCiAgICAgICAgICAgICAgICAgICAgbGlnaHRjb3JhbDogJ2YwODA4MCcsCiAgICAgICAgICAgICAgICAgICAgbGlnaHRjeWFuOiAnZTBmZmZmJywKICAgICAgICAgICAgICAgICAgICBsaWdodGdvbGRlbnJvZHllbGxvdzogJ2ZhZmFkMicsCiAgICAgICAgICAgICAgICAgICAgbGlnaHRncmF5OiAnZDNkM2QzJywKICAgICAgICAgICAgICAgICAgICBsaWdodGdyZWVuOiAnOTBlZTkwJywKICAgICAgICAgICAgICAgICAgICBsaWdodGdyZXk6ICdkM2QzZDMnLAogICAgICAgICAgICAgICAgICAgIGxpZ2h0cGluazogJ2ZmYjZjMScsCiAgICAgICAgICAgICAgICAgICAgbGlnaHRzYWxtb246ICdmZmEwN2EnLAogICAgICAgICAgICAgICAgICAgIGxpZ2h0c2VhZ3JlZW46ICcyMGIyYWEnLAogICAgICAgICAgICAgICAgICAgIGxpZ2h0c2t5Ymx1ZTogJzg3Y2VmYScsCiAgICAgICAgICAgICAgICAgICAgbGlnaHRzbGF0ZWdyYXk6ICc3ODknLAogICAgICAgICAgICAgICAgICAgIGxpZ2h0c2xhdGVncmV5OiAnNzg5JywKICAgICAgICAgICAgICAgICAgICBsaWdodHN0ZWVsYmx1ZTogJ2IwYzRkZScsCiAgICAgICAgICAgICAgICAgICAgbGlnaHR5ZWxsb3c6ICdmZmZmZTAnLAogICAgICAgICAgICAgICAgICAgIGxpbWU6ICcwZjAnLAogICAgICAgICAgICAgICAgICAgIGxpbWVncmVlbjogJzMyY2QzMicsCiAgICAgICAgICAgICAgICAgICAgbGluZW46ICdmYWYwZTYnLAogICAgICAgICAgICAgICAgICAgIG1hZ2VudGE6ICdmMGYnLAogICAgICAgICAgICAgICAgICAgIG1hcm9vbjogJzgwMDAwMCcsCiAgICAgICAgICAgICAgICAgICAgbWVkaXVtYXF1YW1hcmluZTogJzY2Y2RhYScsCiAgICAgICAgICAgICAgICAgICAgbWVkaXVtYmx1ZTogJzAwMDBjZCcsCiAgICAgICAgICAgICAgICAgICAgbWVkaXVtb3JjaGlkOiAnYmE1NWQzJywKICAgICAgICAgICAgICAgICAgICBtZWRpdW1wdXJwbGU6ICc5MzcwZGInLAogICAgICAgICAgICAgICAgICAgIG1lZGl1bXNlYWdyZWVuOiAnM2NiMzcxJywKICAgICAgICAgICAgICAgICAgICBtZWRpdW1zbGF0ZWJsdWU6ICc3YjY4ZWUnLAogICAgICAgICAgICAgICAgICAgIG1lZGl1bXNwcmluZ2dyZWVuOiAnMDBmYTlhJywKICAgICAgICAgICAgICAgICAgICBtZWRpdW10dXJxdW9pc2U6ICc0OGQxY2MnLAogICAgICAgICAgICAgICAgICAgIG1lZGl1bXZpb2xldHJlZDogJ2M3MTU4NScsCiAgICAgICAgICAgICAgICAgICAgbWlkbmlnaHRibHVlOiAnMTkxOTcwJywKICAgICAgICAgICAgICAgICAgICBtaW50Y3JlYW06ICdmNWZmZmEnLAogICAgICAgICAgICAgICAgICAgIG1pc3R5cm9zZTogJ2ZmZTRlMScsCiAgICAgICAgICAgICAgICAgICAgbW9jY2FzaW46ICdmZmU0YjUnLAogICAgICAgICAgICAgICAgICAgIG5hdmFqb3doaXRlOiAnZmZkZWFkJywKICAgICAgICAgICAgICAgICAgICBuYXZ5OiAnMDAwMDgwJywKICAgICAgICAgICAgICAgICAgICBvbGRsYWNlOiAnZmRmNWU2JywKICAgICAgICAgICAgICAgICAgICBvbGl2ZTogJzgwODAwMCcsCiAgICAgICAgICAgICAgICAgICAgb2xpdmVkcmFiOiAnNmI4ZTIzJywKICAgICAgICAgICAgICAgICAgICBvcmFuZ2U6ICdmZmE1MDAnLAogICAgICAgICAgICAgICAgICAgIG9yYW5nZXJlZDogJ2ZmNDUwMCcsCiAgICAgICAgICAgICAgICAgICAgb3JjaGlkOiAnZGE3MGQ2JywKICAgICAgICAgICAgICAgICAgICBwYWxlZ29sZGVucm9kOiAnZWVlOGFhJywKICAgICAgICAgICAgICAgICAgICBwYWxlZ3JlZW46ICc5OGZiOTgnLAogICAgICAgICAgICAgICAgICAgIHBhbGV0dXJxdW9pc2U6ICdhZmVlZWUnLAogICAgICAgICAgICAgICAgICAgIHBhbGV2aW9sZXRyZWQ6ICdkYjcwOTMnLAogICAgICAgICAgICAgICAgICAgIHBhcGF5YXdoaXA6ICdmZmVmZDUnLAogICAgICAgICAgICAgICAgICAgIHBlYWNocHVmZjogJ2ZmZGFiOScsCiAgICAgICAgICAgICAgICAgICAgcGVydTogJ2NkODUzZicsCiAgICAgICAgICAgICAgICAgICAgcGluazogJ2ZmYzBjYicsCiAgICAgICAgICAgICAgICAgICAgcGx1bTogJ2RkYTBkZCcsCiAgICAgICAgICAgICAgICAgICAgcG93ZGVyYmx1ZTogJ2IwZTBlNicsCiAgICAgICAgICAgICAgICAgICAgcHVycGxlOiAnODAwMDgwJywKICAgICAgICAgICAgICAgICAgICByZWJlY2NhcHVycGxlOiAnNjM5JywKICAgICAgICAgICAgICAgICAgICByZWQ6ICdmMDAnLAogICAgICAgICAgICAgICAgICAgIHJvc3licm93bjogJ2JjOGY4ZicsCiAgICAgICAgICAgICAgICAgICAgcm95YWxibHVlOiAnNDE2OWUxJywKICAgICAgICAgICAgICAgICAgICBzYWRkbGVicm93bjogJzhiNDUxMycsCiAgICAgICAgICAgICAgICAgICAgc2FsbW9uOiAnZmE4MDcyJywKICAgICAgICAgICAgICAgICAgICBzYW5keWJyb3duOiAnZjRhNDYwJywKICAgICAgICAgICAgICAgICAgICBzZWFncmVlbjogJzJlOGI1NycsCiAgICAgICAgICAgICAgICAgICAgc2Vhc2hlbGw6ICdmZmY1ZWUnLAogICAgICAgICAgICAgICAgICAgIHNpZW5uYTogJ2EwNTIyZCcsCiAgICAgICAgICAgICAgICAgICAgc2lsdmVyOiAnYzBjMGMwJywKICAgICAgICAgICAgICAgICAgICBza3libHVlOiAnODdjZWViJywKICAgICAgICAgICAgICAgICAgICBzbGF0ZWJsdWU6ICc2YTVhY2QnLAogICAgICAgICAgICAgICAgICAgIHNsYXRlZ3JheTogJzcwODA5MCcsCiAgICAgICAgICAgICAgICAgICAgc2xhdGVncmV5OiAnNzA4MDkwJywKICAgICAgICAgICAgICAgICAgICBzbm93OiAnZmZmYWZhJywKICAgICAgICAgICAgICAgICAgICBzcHJpbmdncmVlbjogJzAwZmY3ZicsCiAgICAgICAgICAgICAgICAgICAgc3RlZWxibHVlOiAnNDY4MmI0JywKICAgICAgICAgICAgICAgICAgICB0YW46ICdkMmI0OGMnLAogICAgICAgICAgICAgICAgICAgIHRlYWw6ICcwMDgwODAnLAogICAgICAgICAgICAgICAgICAgIHRoaXN0bGU6ICdkOGJmZDgnLAogICAgICAgICAgICAgICAgICAgIHRvbWF0bzogJ2ZmNjM0NycsCiAgICAgICAgICAgICAgICAgICAgdHVycXVvaXNlOiAnNDBlMGQwJywKICAgICAgICAgICAgICAgICAgICB2aW9sZXQ6ICdlZTgyZWUnLAogICAgICAgICAgICAgICAgICAgIHdoZWF0OiAnZjVkZWIzJywKICAgICAgICAgICAgICAgICAgICB3aGl0ZTogJ2ZmZicsCiAgICAgICAgICAgICAgICAgICAgd2hpdGVzbW9rZTogJ2Y1ZjVmNScsCiAgICAgICAgICAgICAgICAgICAgeWVsbG93OiAnZmYwJywKICAgICAgICAgICAgICAgICAgICB5ZWxsb3dncmVlbjogJzlhY2QzMicKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgb24gPSAvXiNbYS1mQS1GMC05XXs2fSQvLCBhbiA9IC9eI1thLWZBLUYwLTldezh9JC8sIHNuID0gL14jW2EtZkEtRjAtOV17M30kLywgY24gPSAvXiNbYS1mQS1GMC05XXs0fSQvLCB1biA9IC9ecmdiXChccyooXGR7MSwzfSlccyosXHMqKFxkezEsM30pXHMqLFxzKihcZHsxLDN9KVxzKlwpJC9pLCBsbiA9IC9ecmdiYVwoXHMqKFxkezEsM30pXHMqLFxzKihcZHsxLDN9KVxzKixccyooXGR7MSwzfSlccyosXHMqKFstK10/WzAtOV0qWy5dP1swLTldKylccypcKSQvaSwgZm4gPSAvXmhzbFwoXHMqKFxkezAsM31bLl0/WzAtOV0rKVxzKixccyooXGR7MSwzfVsuXT9bMC05XT8pJVxzKixccyooXGR7MSwzfVsuXT9bMC05XT8pJVxzKlwpJC9pLCBwbiA9IC9eaHNsYVwoXHMqKFxkezAsM31bLl0/WzAtOV0rKVxzKixccyooXGR7MSwzfVsuXT9bMC05XT8pJVxzKixccyooXGR7MSwzfVsuXT9bMC05XT8pJVxzKixccyooWy0rXT9bMC05XSpbLl0/WzAtOV0rKVxzKlwpJC9pOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gZG4oZSkgewogICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBadCgzKTsKICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByblt0XSA/ICcjJyArIHJuW3RdIDogZTsKICAgICAgICAgICAgICAgICAgICB9KGUpOwogICAgICAgICAgICAgICAgICAgIGlmICh0Lm1hdGNoKG9uKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZDogcGFyc2VJbnQoJycgKyB0WzFdICsgdFsyXSwgMTYpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3JlZW46IHBhcnNlSW50KCcnICsgdFszXSArIHRbNF0sIDE2KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsdWU6IHBhcnNlSW50KCcnICsgdFs1XSArIHRbNl0sIDE2KQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGlmICh0Lm1hdGNoKGFuKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHBhcnNlRmxvYXQoKHBhcnNlSW50KCcnICsgdFs3XSArIHRbOF0sIDE2KSAvIDI1NSkudG9GaXhlZCgyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWQ6IHBhcnNlSW50KCcnICsgdFsxXSArIHRbMl0sIDE2KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdyZWVuOiBwYXJzZUludCgnJyArIHRbM10gKyB0WzRdLCAxNiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibHVlOiBwYXJzZUludCgnJyArIHRbNV0gKyB0WzZdLCAxNiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbHBoYTogbgogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAodC5tYXRjaChzbikpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWQ6IHBhcnNlSW50KCcnICsgdFsxXSArIHRbMV0sIDE2KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdyZWVuOiBwYXJzZUludCgnJyArIHRbMl0gKyB0WzJdLCAxNiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBibHVlOiBwYXJzZUludCgnJyArIHRbM10gKyB0WzNdLCAxNikKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBpZiAodC5tYXRjaChjbikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBwYXJzZUZsb2F0KChwYXJzZUludCgnJyArIHRbNF0gKyB0WzRdLCAxNikgLyAyNTUpLnRvRml4ZWQoMikpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVkOiBwYXJzZUludCgnJyArIHRbMV0gKyB0WzFdLCAxNiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBncmVlbjogcGFyc2VJbnQoJycgKyB0WzJdICsgdFsyXSwgMTYpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmx1ZTogcGFyc2VJbnQoJycgKyB0WzNdICsgdFszXSwgMTYpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxwaGE6IHIKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB1bi5leGVjKHQpOwogICAgICAgICAgICAgICAgICAgIGlmIChvKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVkOiBwYXJzZUludCgnJyArIG9bMV0sIDEwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdyZWVuOiBwYXJzZUludCgnJyArIG9bMl0sIDEwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsdWU6IHBhcnNlSW50KCcnICsgb1szXSwgMTApCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBsbi5leGVjKHQpOwogICAgICAgICAgICAgICAgICAgIGlmIChpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVkOiBwYXJzZUludCgnJyArIGlbMV0sIDEwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdyZWVuOiBwYXJzZUludCgnJyArIGlbMl0sIDEwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsdWU6IHBhcnNlSW50KCcnICsgaVszXSwgMTApLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxwaGE6IHBhcnNlRmxvYXQoJycgKyBpWzRdKQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHZhciBhID0gZm4uZXhlYyh0KTsKICAgICAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9ICdyZ2IoJyArIG5uKHBhcnNlSW50KCcnICsgYVsxXSwgMTApLCBwYXJzZUludCgnJyArIGFbMl0sIDEwKSAvIDEwMCwgcGFyc2VJbnQoJycgKyBhWzNdLCAxMCkgLyAxMDApICsgJyknLCBjID0gdW4uZXhlYyhzKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFp0KDQsIHQsIHMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVkOiBwYXJzZUludCgnJyArIGNbMV0sIDEwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdyZWVuOiBwYXJzZUludCgnJyArIGNbMl0sIDEwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsdWU6IHBhcnNlSW50KCcnICsgY1szXSwgMTApCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciB1ID0gcG4uZXhlYyh0KTsKICAgICAgICAgICAgICAgICAgICBpZiAodSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9ICdyZ2IoJyArIG5uKHBhcnNlSW50KCcnICsgdVsxXSwgMTApLCBwYXJzZUludCgnJyArIHVbMl0sIDEwKSAvIDEwMCwgcGFyc2VJbnQoJycgKyB1WzNdLCAxMCkgLyAxMDApICsgJyknLCBmID0gdW4uZXhlYyhsKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFp0KDQsIHQsIGwpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVkOiBwYXJzZUludCgnJyArIGZbMV0sIDEwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdyZWVuOiBwYXJzZUludCgnJyArIGZbMl0sIDEwKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJsdWU6IHBhcnNlSW50KCcnICsgZlszXSwgMTApLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxwaGE6IHBhcnNlRmxvYXQoJycgKyB1WzRdKQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgWnQoNSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBobihlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gZS5yZWQgLyAyNTUsIHIgPSBlLmdyZWVuIC8gMjU1LCBvID0gZS5ibHVlIC8gMjU1LCBpID0gTWF0aC5tYXgobiwgciwgbyksIGEgPSBNYXRoLm1pbihuLCByLCBvKSwgcyA9IChpICsgYSkgLyAyOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA9PT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IGUuYWxwaGEgPyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHVlOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdHVyYXRpb246IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlnaHRuZXNzOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFscGhhOiBlLmFscGhhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGh1ZTogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYXR1cmF0aW9uOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpZ2h0bmVzczogcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBpIC0gYSwgdSA9IHMgPiAwLjUgPyBjIC8gKDIgLSBpIC0gYSkgOiBjIC8gKGkgKyBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSAociAtIG8pIC8gYyArIChyIDwgbyA/IDYgOiAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gKG8gLSBuKSAvIGMgKyAyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gKG4gLSByKSAvIGMgKyA0OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICo9IDYwLCB2b2lkIDAgIT09IGUuYWxwaGEgPyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBodWU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYXR1cmF0aW9uOiB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlnaHRuZXNzOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxwaGE6IGUuYWxwaGEKICAgICAgICAgICAgICAgICAgICAgICAgfSA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGh1ZTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdHVyYXRpb246IHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaWdodG5lc3M6IHMKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KGRuKGUpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBtbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDcgPT09IGUubGVuZ3RoICYmIGVbMV0gPT09IGVbMl0gJiYgZVszXSA9PT0gZVs0XSAmJiBlWzVdID09PSBlWzZdID8gJyMnICsgZVsxXSArIGVbM10gKyBlWzVdIDogZTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBnbihlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnRvU3RyaW5nKDE2KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMSA9PT0gdC5sZW5ndGggPyAnMCcgKyB0IDogdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHZuKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ24oTWF0aC5yb3VuZCgyNTUgKiBlKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB5bihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1uKCcjJyArIHZuKGUpICsgdm4odCkgKyB2bihuKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBibihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5uKGUsIHQsIG4sIHluKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEVuKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ251bWJlcicgPT09IHR5cGVvZiBlICYmICdudW1iZXInID09PSB0eXBlb2YgdCAmJiAnbnVtYmVyJyA9PT0gdHlwZW9mIG4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBibihlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT09IHR5cGVvZiBlICYmIHZvaWQgMCA9PT0gdCAmJiB2b2lkIDAgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBibihlLmh1ZSwgZS5zYXR1cmF0aW9uLCBlLmxpZ2h0bmVzcyk7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFp0KDEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gd24oZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIGlmICgnbnVtYmVyJyA9PT0gdHlwZW9mIGUgJiYgJ251bWJlcicgPT09IHR5cGVvZiB0ICYmICdudW1iZXInID09PSB0eXBlb2YgbiAmJiAnbnVtYmVyJyA9PT0gdHlwZW9mIHIpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByID49IDEgPyBibihlLCB0LCBuKSA6ICdyZ2JhKCcgKyBubihlLCB0LCBuKSArICcsJyArIHIgKyAnKSc7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09PSB0eXBlb2YgZSAmJiB2b2lkIDAgPT09IHQgJiYgdm9pZCAwID09PSBuICYmIHZvaWQgMCA9PT0gcikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWxwaGEgPj0gMSA/IGJuKGUuaHVlLCBlLnNhdHVyYXRpb24sIGUubGlnaHRuZXNzKSA6ICdyZ2JhKCcgKyBubihlLmh1ZSwgZS5zYXR1cmF0aW9uLCBlLmxpZ2h0bmVzcykgKyAnLCcgKyBlLmFscGhhICsgJyknOwogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBadCgyKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHhuKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ251bWJlcicgPT09IHR5cGVvZiBlICYmICdudW1iZXInID09PSB0eXBlb2YgdCAmJiAnbnVtYmVyJyA9PT0gdHlwZW9mIG4pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtbignIycgKyBnbihlKSArIGduKHQpICsgZ24obikpOwogICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gdHlwZW9mIGUgJiYgdm9pZCAwID09PSB0ICYmIHZvaWQgMCA9PT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1uKCcjJyArIGduKGUucmVkKSArIGduKGUuZ3JlZW4pICsgZ24oZS5ibHVlKSk7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFp0KDYpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gU24oZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PT0gdHlwZW9mIGUgJiYgJ251bWJlcicgPT09IHR5cGVvZiB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZG4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAncmdiYSgnICsgby5yZWQgKyAnLCcgKyBvLmdyZWVuICsgJywnICsgby5ibHVlICsgJywnICsgdCArICcpJzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKCdudW1iZXInID09PSB0eXBlb2YgZSAmJiAnbnVtYmVyJyA9PT0gdHlwZW9mIHQgJiYgJ251bWJlcicgPT09IHR5cGVvZiBuICYmICdudW1iZXInID09PSB0eXBlb2YgcikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPj0gMSA/IHhuKGUsIHQsIG4pIDogJ3JnYmEoJyArIGUgKyAnLCcgKyB0ICsgJywnICsgbiArICcsJyArIHIgKyAnKSc7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09PSB0eXBlb2YgZSAmJiB2b2lkIDAgPT09IHQgJiYgdm9pZCAwID09PSBuICYmIHZvaWQgMCA9PT0gcikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYWxwaGEgPj0gMSA/IHhuKGUucmVkLCBlLmdyZWVuLCBlLmJsdWUpIDogJ3JnYmEoJyArIGUucmVkICsgJywnICsgZS5ncmVlbiArICcsJyArIGUuYmx1ZSArICcsJyArIGUuYWxwaGEgKyAnKSc7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFp0KDcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQ24oZSkgewogICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyAhPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBadCg4KTsKICAgICAgICAgICAgICAgICAgICBpZiAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnbnVtYmVyJyA9PT0gdHlwZW9mIGUucmVkICYmICdudW1iZXInID09PSB0eXBlb2YgZS5ncmVlbiAmJiAnbnVtYmVyJyA9PT0gdHlwZW9mIGUuYmx1ZSAmJiAnbnVtYmVyJyA9PT0gdHlwZW9mIGUuYWxwaGE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTbihlKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnbnVtYmVyJyA9PT0gdHlwZW9mIGUucmVkICYmICdudW1iZXInID09PSB0eXBlb2YgZS5ncmVlbiAmJiAnbnVtYmVyJyA9PT0gdHlwZW9mIGUuYmx1ZSAmJiAoJ251bWJlcicgIT09IHR5cGVvZiBlLmFscGhhIHx8ICd1bmRlZmluZWQnID09PSB0eXBlb2YgZS5hbHBoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0oZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4bihlKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnbnVtYmVyJyA9PT0gdHlwZW9mIGUuaHVlICYmICdudW1iZXInID09PSB0eXBlb2YgZS5zYXR1cmF0aW9uICYmICdudW1iZXInID09PSB0eXBlb2YgZS5saWdodG5lc3MgJiYgJ251bWJlcicgPT09IHR5cGVvZiBlLmFscGhhOwogICAgICAgICAgICAgICAgICAgICAgICB9KGUpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd24oZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ251bWJlcicgPT09IHR5cGVvZiBlLmh1ZSAmJiAnbnVtYmVyJyA9PT0gdHlwZW9mIGUuc2F0dXJhdGlvbiAmJiAnbnVtYmVyJyA9PT0gdHlwZW9mIGUubGlnaHRuZXNzICYmICgnbnVtYmVyJyAhPT0gdHlwZW9mIGUuYWxwaGEgfHwgJ3VuZGVmaW5lZCcgPT09IHR5cGVvZiBlLmFscGhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfShlKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEVuKGUpOwogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBadCg4KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGtuKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gZSh0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHIuY29uY2F0KEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8ubGVuZ3RoID49IG4gPyB0LmFwcGx5KHRoaXMsIG8pIDogZSh0LCBuLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KGUsIGUubGVuZ3RoLCBbXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBUbihlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgubWF4KGUsIE1hdGgubWluKHQsIG4pKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIF9uKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3RyYW5zcGFyZW50JyA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBobih0KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQ24ob3Qoe30sIG4sIHsgbGlnaHRuZXNzOiBUbigwLCAxLCBuLmxpZ2h0bmVzcyAtIHBhcnNlRmxvYXQoZSkpIH0pKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBQbiA9IGtuKF9uKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIE9uKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RyYW5zcGFyZW50JyA9PT0gZSA/IGUgOiBDbihvdCh7fSwgaG4oZSksIHsgc2F0dXJhdGlvbjogMCB9KSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBJbigpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuICAgICAgQG1lZGlhIChtaW4td2lkdGg6IDc2OHB4KSB7XG4gICAgICAgIG1pbi13aWR0aDogMTkwcHg7XG4gICAgICAgIG1pbi1oZWlnaHQ6IDQwcHg7XG4gICAgICAgIGZvbnQtc2l6ZTogJywKICAgICAgICAgICAgICAgICAgICAgICAgJ3B4O1xuICAgICAgICBwYWRkaW5nOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgfVxuICAgICcKICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gSW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMbigpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuICAgICAgICAgIGJvcmRlcjogbm9uZTtcbiAgICAgICAgICBmb250LXNpemU6IDE0cHg7XG4gICAgICAgICAgcGFkZGluZzogNXB4IDA7XG4gICAgICAgICAgd2lkdGg6IGF1dG87XG4gICAgICAgICAgaGVpZ2h0OiBhdXRvO1xuICAgICAgICAgIGZvbnQtd2VpZ2h0OiA1MDA7XG4gICAgICAgICAgbGV0dGVyLXNwYWNpbmc6IDA7XG4gICAgICAgICAgYmFja2dyb3VuZDogbm9uZTtcbiAgICAgICAgICBjb2xvcjogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgICBib3gtc2hhZG93OiBub25lO1xuICAgICAgICAgIG1hcmdpbi10b3A6IDA7XG5cbiAgICAgICAgICAmLnFjLWNtcDItbGluay1hY3RpdmUge1xuICAgICAgICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgICAgICAgICBjdXJzb3I6IGRlZmF1bHQ7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgJjpob3ZlciB7XG4gICAgICAgICAgICBiYWNrZ3JvdW5kOiBub25lO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIEBtZWRpYSAobWluLXdpZHRoOiA3NjhweCkge1xuICAgICAgICAgICAgZm9udC1zaXplOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAncHg7XG4gICAgICAgICAgfVxuICAgICAgICAnCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIExuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQW4oKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBndChbCiAgICAgICAgICAgICAgICAgICAgICAgICdcbiAgICAgICAgYmFja2dyb3VuZDogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgYm9yZGVyOiBzb2xpZCAxcHggJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG5cbiAgICAgICAgQG1lZGlhIChtaW4td2lkdGg6IDc2OHB4KSB7XG4gICAgICAgICAgJjpob3ZlciB7XG4gICAgICAgICAgICBiYWNrZ3JvdW5kOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnXG4gICAgICAgICAgICBib3JkZXItY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICdcbiAgICAgICAgICAgIGNvbG9yOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgJwogICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBBbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFJuKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZ3QoWwogICAgICAgICAgICAgICAgICAgICAgICAnXG4gICAgICAmJixcbiAgICAgICYmICY6aG92ZXIge1xuICAgICAgICBiYWNrZ3JvdW5kOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICBib3JkZXI6IHNvbGlkIDFweCAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICBjb2xvcjogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgIH1cbiAgICAnCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFJuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gTm4oKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBndChbCiAgICAgICAgICAgICAgICAgICAgICAgICdcbiYmIHtcbiAgYWxpZ24tY29udGVudDogY2VudGVyO1xuICBiYWNrZmFjZS12aXNpYmlsaXR5OiBoaWRkZW47XG4gIGJvcmRlcjogbm9uZTtcbiAgYmFja2dyb3VuZDogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgYm9yZGVyLXJhZGl1czogMnB4O1xuICBjb2xvcjogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgY3Vyc29yOiBwb2ludGVyO1xuICBkaXNwbGF5OiBmbGV4O1xuICBhbGlnbi1pdGVtczogY2VudGVyO1xuICBmb250LXNpemU6IDEzcHg7XG4gIGxpbmUtaGVpZ2h0OiAwO1xuICBtaW4taGVpZ2h0OiAzNHB4O1xuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgbGV0dGVyLXNwYWNpbmc6IDJweDtcbiAgbWFyZ2luOiAwLjVlbTtcbiAgcGFkZGluZzogMTJweDtcbiAgdGV4dC1hbGlnbjogY2VudGVyO1xuICB0ZXh0LXRyYW5zZm9ybTogdXBwZXJjYXNlO1xuICB0cmFuc2l0aW9uOiBhbGwgMC4zNXMgZWFzZTtcbiAgd2hpdGUtc3BhY2U6IG5vd3JhcDtcbiAgd2lkdGg6IDk1JTtcbiAgYm94LXNoYWRvdzogMCAxcHggMXB4IDFweCByZ2JhKDAsMCwwLC4xKTtcblxuICBAbWVkaWEobWluLXdpZHRoOiA3NjhweCkge1xuICAgICY6aG92ZXIge1xuICAgICAgYmFja2dyb3VuZDogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICB9XG4gIH1cblxuICAnLAogICAgICAgICAgICAgICAgICAgICAgICAnXG5cbiAgICAnLAogICAgICAgICAgICAgICAgICAgICAgICAnXG5cbiAgICAgICcsCiAgICAgICAgICAgICAgICAgICAgICAgICdcblxuICAnLAogICAgICAgICAgICAgICAgICAgICAgICAnXG5cbiAgQG1lZGlhKG1heC13aWR0aDogMzYwcHgpIHtcbiAgICAvKiBzdXBwb3J0IGZvciBpUGhvbmUgNS9TRSBHYWxheHkgUzUgKi9cbiAgICBtYXJnaW46IDAuM2VtO1xuICB9XG59XG4nCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5uID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGpuID0gdnQuYy5idXR0b24oTm4oKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhQcmltYXJ5QnV0dG9uQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhQcmltYXJ5QnV0dG9uVGV4dENvbG9yOwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByaW1hcnlCdXR0b25Ib3ZlckJhY2tncm91bmQ7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmRpc2FibGVkLCBuID0gZS51eFNlY29uZGFyeUJ1dHRvbkNvbG9yLCByID0gZS51eFNlY29uZGFyeUJ1dHRvblRleHRDb2xvcjsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgT2JqZWN0KHZ0LmIpKFJuKCksIE9uKG4pLCBPbihyKSwgT24ocikpOwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS51eFNlY29uZGFyeUJ1dHRvbkNvbG9yLCBuID0gZS51eFNlY29uZGFyeUJ1dHRvblRleHRDb2xvciwgciA9IGUubW9kZSwgbyA9IGUuc2Vjb25kYXJ5QnV0dG9uSG92ZXJCYWNrZ3JvdW5kLCBpID0gZS51eFByaW1hcnlCdXR0b25UZXh0Q29sb3I7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc2Vjb25kYXJ5JyA9PT0gciAmJiBPYmplY3QodnQuYikoQW4oKSwgdCwgbiwgbiwgbywgbywgaSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLm1vZGUsIG4gPSBlLnV4UHJpbWFyeUJ1dHRvbkNvbG9yLCByID0gZS5zZWNvbmRhcnlUZXh0Q29sb3IsIG8gPSBlLmlzTG9uZzsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdsaW5rJyA9PT0gdCAmJiBPYmplY3QodnQuYikoTG4oKSwgbiwgciwgbyA/IDExIDogMTQpOwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnbGFyZ2UnID09PSBlLnNpemUgJiYgT2JqZWN0KHZ0LmIpKEluKCksIGUuaXNMb25nID8gMTEgOiAxNCwgZS5pc0xvbmcgPyAnMCAxNXB4ICFpbXBvcnRhbnQnIDogMCk7CiAgICAgICAgICAgICAgICAgICAgfSksIHFuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmNoaWxkcmVuLCBuID0genQoZSwgWydjaGlsZHJlbiddKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudChqbiwgT2JqZWN0LmFzc2lnbih7fSwgbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXhQcmltYXJ5QnV0dG9uQ29sb3I6IF9vLnV4UHJpbWFyeUJ1dHRvbkNvbG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXhQcmltYXJ5QnV0dG9uVGV4dENvbG9yOiBfby51eFByaW1hcnlCdXR0b25UZXh0Q29sb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmltYXJ5QnV0dG9uSG92ZXJCYWNrZ3JvdW5kOiBfby5wcmltYXJ5QnV0dG9uSG92ZXJCYWNrZ3JvdW5kLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXhTZWNvbmRhcnlCdXR0b25Db2xvcjogX28udXhTZWNvbmRhcnlCdXR0b25Db2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV4U2Vjb25kYXJ5QnV0dG9uVGV4dENvbG9yOiBfby51eFNlY29uZGFyeUJ1dHRvblRleHRDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY29uZGFyeUJ1dHRvbkhvdmVyQmFja2dyb3VuZDogX28uc2Vjb25kYXJ5QnV0dG9uSG92ZXJCYWNrZ3JvdW5kLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vjb25kYXJ5VGV4dENvbG9yOiBfby5zZWNvbmRhcnlUZXh0Q29sb3IKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBxbi5kZWZhdWx0UHJvcHMgPSB7CiAgICAgICAgICAgICAgICAgICAgdGFiSW5kZXg6ICcwJywKICAgICAgICAgICAgICAgICAgICB0eXBlOiAnYnV0dG9uJywKICAgICAgICAgICAgICAgICAgICBtb2RlOiAncHJpbWFyeScsCiAgICAgICAgICAgICAgICAgICAgc2l6ZTogJ2xhcmdlJywKICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6ICcnCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIEZuID0gcW4sIERuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnVybCwgbiA9IGUubGFiZWwsIHIgPSBlLmJvbGRlZDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudCgnbGknLCBudWxsLCByID8gUWUuYS5jcmVhdGVFbGVtZW50KCdzdHJvbmcnLCBudWxsLCAnJy5jb25jYXQobiwgJzogJykpIDogJycuY29uY2F0KG4sICc6ICcpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2EnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBocmVmOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiAnX2JsYW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbDogJ25vb3BlbmVyIG5vcmVmZXJyZXInCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgRG4uZGVmYXVsdFByb3BzID0geyBib2xkZWQ6ICExIH07CiAgICAgICAgICAgICAgICB2YXIgTW4gPSBEbiwgVW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubmF2aWdhdG9yLnVzZXJBZ2VudC5pbmRleE9mKCdUcmlkZW50LycpID4gLTE7CiAgICAgICAgICAgICAgICAgICAgfSwgVm4gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShlKSAmJiBlLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBbXSwgciA9IFtdLCBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc29ydChmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgaXNOYU4oZVt0XSkgPyAtMSA6IGUubmFtZS50b0xvd2VyQ2FzZSgpLmxvY2FsZUNvbXBhcmUobi5uYW1lLnRvTG93ZXJDYXNlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5hdmlnYXRvci51c2VyQWdlbnQudG9Mb3dlckNhc2UoKS5pbmRleE9mKCdmaXJlZm94JykgPiAtMSAmJiB0ID8gKGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzTmFOKGVbdF0pID8gbi5wdXNoKGUpIDogci5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIFtdLmNvbmNhdChuLCBhKG8ocikpKSkgOiBvKGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIEJuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnNlY29uZHMsIG4gPSBlLmxhYmVsOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KCdsaScsIG51bGwsICcnLmNvbmNhdChuLCAnOiAnKS5jb25jYXQoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIDwgMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJzAgJy5jb25jYXQoUG8uY29yZVVpTGFiZWxzLnNlY29uZHNMYWJlbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUgLyA4NjQwMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID49IDEgPyAnJy5jb25jYXQoTWF0aC5yb3VuZCh0KSwgJyAnKS5jb25jYXQoUG8uY29yZVVpTGFiZWxzLmRheXNMYWJlbCkgOiAnJy5jb25jYXQoZSwgJyAnKS5jb25jYXQoUG8uY29yZVVpTGFiZWxzLnNlY29uZHNMYWJlbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0odCkpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gem4oKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBndChbJ1xuICAmJiYge1xuICAgIHVsLml0ZW1zIHtcbiAgICAgIGxpc3Qtc3R5bGU6IG5vbmU7XG4gICAgICBwYWRkaW5nLWxlZnQ6IDE1cHg7XG5cbiAgICAgIGxpIHtcbiAgICAgICAgcGFkZGluZy1ib3R0b206IDE1cHg7XG4gICAgICB9XG4gICAgfVxuICB9XG4nXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHpuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gR24oKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBndChbJ1xuICAmJiYge1xuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAganVzdGlmeS1jb250ZW50OiBzcGFjZS1iZXR3ZWVuO1xuICAgIHBhZGRpbmc6IDVweCAwO1xuICAgIHdpZHRoOiA1MCU7XG4gIH1cbiddKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gR24gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgSG4gPSB2dC5jLmRpdihHbigpKSwgV24gPSB2dC5jLmRpdih6bigpKSwgJG4gPSBuKDUzKSwgWW4gPSBuLm4oJG4pLCBRbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5sYWJlbCwgbiA9IGUudXJsLCByID0gbXQoT2JqZWN0KFllLnVzZVN0YXRlKSghMSksIDIpLCBvID0gclswXSwgaSA9IHJbMV0sIGEgPSBtdChPYmplY3QoWWUudXNlU3RhdGUpKFtdKSwgMiksIHMgPSBhWzBdLCBjID0gYVsxXSwgdSA9IG10KE9iamVjdChZZS51c2VTdGF0ZSkoITEpLCAyKSwgbCA9IHVbMF0sIGYgPSB1WzFdLCBwID0gbXQoT2JqZWN0KFllLnVzZVN0YXRlKSgnJyksIDIpLCBkID0gcFswXSwgaCA9IHBbMV07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QoWWUudXNlRWZmZWN0KShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvICYmICFsICYmIFluLmEuZ2V0KG4pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5kYXRhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZGlzY2xvc3VyZXMgJiYgYyhlLmRpc2Nsb3N1cmVzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyhbXSksIGgoJ0Vycm9yOiBjYW5ub3QgbG9hZCB2ZW5kb3IgZmlsZS4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZpbmFsbHkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmKCEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgICAgICAgICBdKSwgUWUuYS5jcmVhdGVFbGVtZW50KCdsaScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJycuY29uY2F0KG8gPyAnZXhwYW5kZWQnIDogJycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKCFvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgUWUuYS5jcmVhdGVFbGVtZW50KEhuLCBudWxsLCB0LCAnICcsIFFlLmEuY3JlYXRlRWxlbWVudChCdCwgeyB0eXBlOiAnaW5uZXInIH0pKSwgbyAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoV24sIG51bGwsIHMubGVuZ3RoID4gMCAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3VsJywgeyBjbGFzc05hbWU6ICdpdGVtcycgfSwgcy5tYXAoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2xpJywgeyBrZXk6IHQgfSwgT2JqZWN0LmtleXMoZSkubWFwKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsga2V5OiBuIH0sIHQsICc6ICcsIGVbdF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSksIGQgJiYgUWUuYS5jcmVhdGVFbGVtZW50KCdzcGFuJywgbnVsbCwgJ1x4QTBceEEwJywgZCkpKTsKICAgICAgICAgICAgICAgICAgICB9LCBLbiA9IE90LkxFR0lUSU1BVEVfVkVORE9SUywgSm4gPSBPdC5MRUdJVElNQVRFX1BVUlBPU0VTLCBYbiA9IE90LlBVUlBPU0VTLCBabiA9IE90LkZFQVRVUkVTLCBlciA9IE90LlNQRUNJQUxfUFVSUE9TRVMsIHRyID0gT3QuU1BFQ0lBTF9GRUFUVVJFUywgbnIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IHQubGVnaXRpbWF0ZVNjcmVlbk9iamVjdCA6IHQubGVnaXRpbWF0ZVNjcmVlbkFjY2VwdDsKICAgICAgICAgICAgICAgICAgICB9LCByciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jbXBVSSwgbiA9IGUuZWxlbWVudCwgciA9IGUuY29yZVVpTGFiZWxzLCBvID0gZS50b2dnbGVzSGlkZGVuLCBpID0gZS5kYXRhVHlwZSwgYSA9IGUucG9wdWxhdGVWZW5kb3JJbmZvLCBzID0gZS5zZXRTdGF0dXMsIGMgPSBlLnN0YXR1czsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudCgndWwnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItZXhwYW5kYWJsZS1saXN0JyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1leHBhbmRhYmxlLWluZm8nIH0sIG4ucG9saWN5VXJsICYmIFFlLmEuY3JlYXRlRWxlbWVudChNbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBuLnBvbGljeVVybCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsOiByLnByaXZhY3lQb2xpY3lMYWJlbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvbGRlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG4uZGVzY3JpcHRpb24gJiYgUWUuYS5jcmVhdGVFbGVtZW50KCdsaScsIG51bGwsIFFlLmEuY3JlYXRlRWxlbWVudCgnc3Ryb25nJywgbnVsbCwgci5kZXNjcmlwdGlvbkxhYmVsKSwgUWUuYS5jcmVhdGVFbGVtZW50KCdwJywgbnVsbCwgbi5kZXNjcmlwdGlvbikpLCBuLnB1cnBvc2VzICYmIG4ucHVycG9zZXMubGVuZ3RoID4gMCAmJiBhKG4ucHVycG9zZXMsIFhuLCByKSwgbi5sZWdJbnRQdXJwb3NlcyAmJiBuLmxlZ0ludFB1cnBvc2VzLmxlbmd0aCA+IDAgJiYgYShuLmxlZ0ludFB1cnBvc2VzLCBKbiwgcikpLCAhbyAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi10b2dnbGUtc3dpdGNoJyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJHQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uOiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi10b2dnbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmIGUucHJldmVudERlZmF1bHQoKSwgcyghYyksIHQuaGFuZGxlQ29uc2VudChuLmlkLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSkpKTsKICAgICAgICAgICAgICAgICAgICB9LCBvciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jbXBVSSwgbiA9IGUuZWxlbWVudCwgciA9IGUuY29yZVVpTGFiZWxzLCBvID0gZS50b2dnbGVzSGlkZGVuLCBpID0gZS5kYXRhVHlwZSwgYSA9IGUucG9wdWxhdGVWZW5kb3JJbmZvLCBzID0gZS5zZXRTdGF0dXMsIGMgPSBlLnN0YXR1czsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudCgndWwnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItZXhwYW5kYWJsZS1saXN0JyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1leHBhbmRhYmxlLWluZm8nIH0sIG4ucG9saWN5VXJsICYmIFFlLmEuY3JlYXRlRWxlbWVudChNbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBuLnBvbGljeVVybCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsOiByLnByaXZhY3lQb2xpY3lMYWJlbAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdm9pZCAwICE9PSBuLmNvb2tpZU1heEFnZVNlY29uZHMgJiYgUWUuYS5jcmVhdGVFbGVtZW50KEJuLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWNvbmRzOiBuLmNvb2tpZU1heEFnZVNlY29uZHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbDogci5jb29raWVNYXhBZ2VMYWJlbAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgdm9pZCAwICE9PSBuLmRldmljZVN0b3JhZ2VEaXNjbG9zdXJlVXJsICYmIFFlLmEuY3JlYXRlRWxlbWVudChRbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBuLmRldmljZVN0b3JhZ2VEaXNjbG9zdXJlVXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWw6IHIuc3RvcmFnZURpc2Nsb3N1cmVMYWJlbAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgbi5wdXJwb3NlcyAmJiBuLnB1cnBvc2VzLmxlbmd0aCA+IDAgJiYgYShuLnB1cnBvc2VzLCBYbiwgciksIG4uc3BlY2lhbFB1cnBvc2VzICYmIG4uc3BlY2lhbFB1cnBvc2VzLmxlbmd0aCA+IDAgJiYgYShuLnNwZWNpYWxQdXJwb3NlcywgZXIsIHIpLCBuLmZlYXR1cmVzICYmIG4uZmVhdHVyZXMubGVuZ3RoID4gMCAmJiBhKG4uZmVhdHVyZXMsIFpuLCByKSwgbi5zcGVjaWFsRmVhdHVyZXMgJiYgbi5zcGVjaWFsRmVhdHVyZXMubGVuZ3RoID4gMCAmJiBhKG4uc3BlY2lhbEZlYXR1cmVzLCB0ciwgcikpLCAhbyAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi10b2dnbGUtc3dpdGNoJyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJHQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uOiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi10b2dnbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCksIHMoIWMpLCB0LmhhbmRsZUNvbnNlbnQobi5pZCwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgaXIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuY21wVUksIG4gPSBlLmVsZW1lbnQsIHIgPSBlLmNvcmVVaUxhYmVscywgbyA9IGUuZGF0YVR5cGUsIGkgPSBlLnBvcHVsYXRlVmVuZG9ySW5mbywgYSA9IGUuc2V0U3RhdHVzLCBzID0gZS5zdGF0dXM7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3VsJywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLWV4cGFuZGFibGUtbGlzdCBxYy13cmFwJyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1leHBhbmRhYmxlLWluZm8gcWMtdzc1JyB9LCBuLnBvbGljeVVybCAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoTW4sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbi5wb2xpY3lVcmwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbDogci5wcml2YWN5UG9saWN5TGFiZWwKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHZvaWQgMCAhPT0gbi5jb29raWVNYXhBZ2VTZWNvbmRzICYmIFFlLmEuY3JlYXRlRWxlbWVudChCbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vjb25kczogbi5jb29raWVNYXhBZ2VTZWNvbmRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWw6IHIuY29va2llTWF4QWdlTGFiZWwKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHZvaWQgMCAhPT0gbi5kZXZpY2VTdG9yYWdlRGlzY2xvc3VyZVVybCAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoUW4sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbi5kZXZpY2VTdG9yYWdlRGlzY2xvc3VyZVVybCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsOiByLnN0b3JhZ2VEaXNjbG9zdXJlTGFiZWwKICAgICAgICAgICAgICAgICAgICAgICAgfSksIG4ubGVnSW50UHVycG9zZXMgJiYgbi5sZWdJbnRQdXJwb3Nlcy5sZW5ndGggPiAwICYmIGkobi5sZWdJbnRQdXJwb3NlcywgS24sIHIpLCBuLnNwZWNpYWxQdXJwb3NlcyAmJiBuLnNwZWNpYWxQdXJwb3Nlcy5sZW5ndGggPiAwICYmIGkobi5zcGVjaWFsUHVycG9zZXMsIGVyLCByKSwgbi5mZWF0dXJlcyAmJiBuLmZlYXR1cmVzLmxlbmd0aCA+IDAgJiYgaShuLmZlYXR1cmVzLCBabiwgciksIG4uc3BlY2lhbEZlYXR1cmVzICYmIG4uc3BlY2lhbEZlYXR1cmVzLmxlbmd0aCA+IDAgJiYgaShuLnNwZWNpYWxGZWF0dXJlcywgdHIsIHIpKSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItdG9nZ2xlLXN3aXRjaCBxYy1jbXAyLW5vLW1hcmdpbicgfSwgUWUuYS5jcmVhdGVFbGVtZW50KEZuLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkNsaWNrOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQoKSwgYSghcyksIHQuaGFuZGxlQ29uc2VudChuLmlkLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOiAnc21hbGwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNMb25nOiByLmxlZ2l0aW1hdGVTY3JlZW5BY2NlcHQubGVuZ3RoID4gMTkKICAgICAgICAgICAgICAgICAgICAgICAgfSwgbnIocywgcikpKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgYXIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuY21wVUksIG4gPSBlLmVsZW1lbnQsIHIgPSBlLmNvcmVVaUxhYmVscywgbyA9IGUudG9nZ2xlc0hpZGRlbiwgaSA9IGUuZGF0YVR5cGUsIGEgPSBlLnNldFN0YXR1cywgcyA9IGUuc3RhdHVzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KCd1bCcsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1leHBhbmRhYmxlLWxpc3QnIH0sIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLWV4cGFuZGFibGUtaW5mbycgfSwgbi5wb2xpY3lVcmwgJiYgUWUuYS5jcmVhdGVFbGVtZW50KE1uLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IG4ucG9saWN5VXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWw6IHIucHJpdmFjeVBvbGljeUxhYmVsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9sZGVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgbi5kZXNjcmlwdGlvbiAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2xpJywgbnVsbCwgUWUuYS5jcmVhdGVFbGVtZW50KCdzdHJvbmcnLCBudWxsLCByLmRlc2NyaXB0aW9uTGFiZWwpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3AnLCBudWxsLCBuLmRlc2NyaXB0aW9uKSkpLCAhbyAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi10b2dnbGUtc3dpdGNoJyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJHQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi10b2dnbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCksIGEoIXMpLCB0LmhhbmRsZUNvbnNlbnQobi5pZCwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgc3IgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuY21wVUksIG4gPSBlLmVsZW1lbnQsIHIgPSBlLmNvcmVVaUxhYmVscywgbyA9IGUudG9nZ2xlc0hpZGRlbiwgaSA9IGUuZGF0YVR5cGUsIGEgPSBlLmxlZ2l0aW1hdGUsIHMgPSBlLmhhbmRsZUNsaWNrLCBjID0gZS50b2dnbGVFeHBhbmRlZExlZ2FsLCB1ID0gZS5wcmVtaXVtVWlMYWJlbHMsIGwgPSBlLnNldFN0YXR1cywgZiA9IGUuc3RhdHVzOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KCd1bCcsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1leHBhbmRhYmxlLWxpc3QgJy5jb25jYXQoYSA/ICdxYy13cmFwJyA6ICcnKSB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2xpJywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLWV4cGFuZGFibGUtaW5mbyAnLmNvbmNhdChhID8gJ3FjLXc3NScgOiAnJykgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdwJywgbnVsbCwgbi5kZXNjcmlwdGlvbiksIG4uZGVzY3JpcHRpb25MZWdhbCAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1leHBhbmRhYmxlLWxlZ2FsJyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoRm4sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6ICdzbWFsbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6ICdxYy1jbXAyLXRvZ2dsZS1sZWdhbC1idXR0b24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCksIHMoZSwgJ2xlZ2FsRGVzY3JpcHRpb24tJy5jb25jYXQoaSwgJy0nKS5jb25jYXQobi5pZCkpLCBjKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFFlLmEuY3JlYXRlRWxlbWVudChCdCwgeyB0eXBlOiAnZmlsbCcgfSksIHIubGVnYWxEZXNjcmlwdGlvbiksIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1sZWdhbC1kZXNjcmlwdGlvbicgfSwgbi5kZXNjcmlwdGlvbkxlZ2FsKSksIG4udmVuZG9ycyAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1leHBhbmRhYmxlLWxlZ2FsJyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoRm4sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6ICdzbWFsbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6ICdxYy1jbXAyLXRvZ2dsZS1sZWdhbC1idXR0b24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCksIHMoZSwgJ3ZlbmRvcnMtJy5jb25jYXQoaSwgJy0nKS5jb25jYXQobi5pZCkpLCBjKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFFlLmEuY3JlYXRlRWxlbWVudChCdCwgeyB0eXBlOiAnZmlsbCcgfSksIHIuc2hvd1BhcnRuZXJzKSwgbi52ZW5kb3JzLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGUuaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi1sZWdhbC1kZXNjcmlwdGlvbicKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICctICcuY29uY2F0KGUubmFtZSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgISghbi5ub25JYWJWZW5kb3JzIHx8ICFuLm5vbklhYlZlbmRvcnMubGVuZ3RoKSAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoUWUuYS5GcmFnbWVudCwgbnVsbCwgbi5ub25JYWJWZW5kb3JzLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGUubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6ICdxYy1jbXAyLWxlZ2FsLWRlc2NyaXB0aW9uJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgJy0gJy5jb25jYXQoZS5uYW1lKSwgJyonKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1sZWdhbC1kZXNjcmlwdGlvbiBxYy1jbXAyLW5vbi1pYWInIH0sICcqICcsIHUubm9uSWFiVmVuZG9yc0xhYmVsKSkpKSwgYSA/IFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLXRvZ2dsZS1zd2l0Y2gnIH0sIFFlLmEuY3JlYXRlRWxlbWVudChGbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCksIGwoIWYpLCB0LmhhbmRsZUNvbnNlbnQobi5pZCwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTogJ3NtYWxsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzTG9uZzogci5sZWdpdGltYXRlU2NyZWVuQWNjZXB0Lmxlbmd0aCA+IDE5CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIG5yKGYsIHIpKSkgOiAhbyAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi10b2dnbGUtc3dpdGNoJyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJHQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uOiBmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi10b2dnbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnByZXZlbnREZWZhdWx0KCksIGwoIWYpLCB0LmhhbmRsZUNvbnNlbnQobi5pZCwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgY3IgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuY29yZVVpTGFiZWxzLCBuID0gZS5wcmVtaXVtVWlMYWJlbHMsIHIgPSBlLmRhdGFUeXBlLCBvID0gZS5sZWdpdGltYXRlLCBpID0gZS50b2dnbGVzSGlkZGVuLCBhID0gZS5leHBhbmRhYmxlLCBzID0gZS5oYW5kbGVDbGljaywgYyA9IGUuY21wVUksIHUgPSBlLml0ZW0sIGwgPSBlLnBvcHVsYXRlVmVuZG9ySW5mbywgZiA9IG10KE9iamVjdChZZS51c2VTdGF0ZSkoITEpLCAyKSwgcCA9IGZbMF0sIGQgPSBmWzFdLCBoID0gbXQoT2JqZWN0KFllLnVzZVN0YXRlKSghMSksIDIpLCBtID0gaFswXSwgZyA9IGhbMV0sIHYgPSBtdChPYmplY3QoWWUudXNlU3RhdGUpKHUuc3RhdHVzKSwgMiksIHkgPSB2WzBdLCBiID0gdlsxXSwgRSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnKCFtKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHcgPSAnJy5jb25jYXQociwgJy1pZDonKS5jb25jYXQodS5pZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLnVzZUVmZmVjdChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKHUuc3RhdHVzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgW3Uuc3RhdHVzXSksIFFlLmEuY3JlYXRlRWxlbWVudCgnbGknLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogdywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItbGlzdC1pdGVtICcuY29uY2F0KHAgPyAncWMtY21wMi1leHBhbmRlZCcgOiAnJywgJyAnKS5jb25jYXQobyA/ICdxYy1jbXAyLWxpc3QtaXRlbS1sZWdpdGltYXRlJyA6ICcnKQogICAgICAgICAgICAgICAgICAgICAgICB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2J1dHRvbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItbGlzdC1pdGVtLWhlYWRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkNsaWNrOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkKCFwKSwgcyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGUsIHcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3AnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItbGlzdC1pdGVtLXRpdGxlJyB9LCB1Lm5hbWUpLCBvID8gUWUuYS5jcmVhdGVFbGVtZW50KCdwJywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLWxpc3QtaXRlbS1zdGF0dXMgJy5jb25jYXQodC5sZWdpdGltYXRlU2NyZWVuT2JqZWN0ZWQubGVuZ3RoID4gMTIgPyAncWMtY21wLWxvbmctbGFiZWwnIDogJycpIH0sIHkgPyAnJyA6IHQubGVnaXRpbWF0ZVNjcmVlbk9iamVjdGVkKSA6ICFpICYmIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1saXN0LWl0ZW0tc3RhdHVzJyB9LCB5ID8gdC5vbkxhYmVsIDogdC5vZmZMYWJlbCksIGEgJiYgUWUuYS5jcmVhdGVFbGVtZW50KEJ0LCB7IHR5cGU6ICdleHBhbmQnIH0pKSwgYSAmJiBwICYmIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXBVSTogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcmVVaUxhYmVsczogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2dnbGVzSGlkZGVuOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFUeXBlOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcHVsYXRlVmVuZG9ySW5mbzogbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRTdGF0dXM6IGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiB5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN0Lk5PTl9JQUI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudChyciwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN0LlZFTkRPUlM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudChvciwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN0LkxFR0lUSU1BVEVfVkVORE9SUzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KGlyLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3QuR09PR0xFOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoYXIsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KHNyLCBPYmplY3QuYXNzaWduKHt9LCBhLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2l0aW1hdGU6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZUNsaWNrOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2dnbGVFeHBhbmRlZExlZ2FsOiBFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVtaXVtVWlMYWJlbHM6IG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0odSkpOwogICAgICAgICAgICAgICAgICAgIH0sIHVyID0gT3QuTEVHSVRJTUFURV9WRU5ET1JTLCBsciA9IE90LkxFR0lUSU1BVEVfUFVSUE9TRVMsIGZyID0gT3QuUFVSUE9TRVMsIHByID0gT3QuRkVBVFVSRVMsIGRyID0gT3QuU1BFQ0lBTF9QVVJQT1NFUywgaHIgPSBPdC5TUEVDSUFMX0ZFQVRVUkVTLCBtciA9IE90LkZMRVhJQkxFX1BVUlBPU0VTLCBnciA9IE90LlVORklMVEVSRURfRkVBVFVSRVMsIHZyID0gT3QuVU5GSUxURVJFRF9QVVJQT1NFUywgeXIgPSBPdC5VTkZJTFRFUkVEX1NQRUNJQUxfRkVBVFVSRVMsIGJyID0gT3QuVU5GSUxURVJFRF9TUEVDSUFMX1BVUlBPU0VTLCBFciA9IFFlLmEubWVtbyhmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IGUuY2xhc3NOYW1lLCByID0gZS5jb3JlVWlMYWJlbHMsIG8gPSBlLmRhdGEsIGkgPSBlLmRhdGFUeXBlLCBhID0gZS50b2dnbGVzSGlkZGVuLCBzID0gZS5leHBhbmRhYmxlLCBjID0gZS5sZWdpdGltYXRlLCB1ID0gZS5wcmVtaXVtVWlMYWJlbHMsIGwgPSBlLm5vbklhYkRhdGEsIGYgPSBlLmhhbmRsZUNsaWNrLCBwID0gZS5vbkZ1bGx5UmVuZGVyZWQsIGQgPSBlLnRyaWdnZXJSZVJlbmRlciwgaCA9IGUuc2V0U2hvd0xvYWRlciwgbSA9IE9iamVjdC5rZXlzKG8pLmxlbmd0aCwgZyA9IG0gPyBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB0Lk5PTl9JQUI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyICYmIHIudmVuZG9ycy5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci52ZW5kb3JzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHQuVkVORE9SUzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFZuKE9iamVjdC52YWx1ZXMoZS52ZW5kb3JzKSwgJ2lkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB0LkxFR0lUSU1BVEVfVkVORE9SUzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFZuKE9iamVjdC52YWx1ZXMoZS5sZWdpdGltYXRlVmVuZG9ycyksICdpZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgdC5HT09HTEU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBWbihlLCAnaWQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhlKS5sZW5ndGggJiYgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSByICYmIHIudmVuZG9ycywgYSA9ICdub25JYWJQdXJwb3NlQ29uc2VudElkcyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID09PSB0LkxFR0lUSU1BVEVfVkVORE9SUyAmJiAoYSA9ICdub25JYWJQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0SWRzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlW3RdLCByID0gKG4uZGVzY3JpcHRpb25MZWdhbCB8fCAnJykucmVwbGFjZSgvKDpcc1wqKXwoOlwqKS9naSwgJzonKS5yZXBsYWNlKC8oXC5cc1wqKXwoXC5cKil8KFxzXCopL2dpLCAnLicpLCBzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogbi5uYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdHVzOiBuLnN0YXR1cyB8fCAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBuLmlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb246IG4uZGVzY3JpcHRpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbkxlZ2FsOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yczogVm4obi52ZW5kb3JzLCAnaWQnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYlZlbmRvcnM6IGkgJiYgaS5sZW5ndGggJiYgaS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVthXSAmJiBlW2FdLmluY2x1ZGVzKG4uaWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLnB1c2gocyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG87CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KG8sIEN0LCBpLCBsKSA6IFtdLCB2ID0gbXQoUWUuYS51c2VTdGF0ZSghMSksIDIpLCB5ID0gdlswXSwgYiA9IHZbMV0sIEUgPSBtdChRZS5hLnVzZVN0YXRlKGcuc2xpY2UoMCwgMTAwKSksIDIpLCB3ID0gRVswXSwgeCA9IEVbMV0sIFMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9ICcnLCBpID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGZyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IG4ucHVycG9zZXNMYWJlbCwgaSA9IHZyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbHI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gbi5sZWdpdGltYXRlSW50ZXJlc3RQdXJwb3Nlc0xhYmVsLCBpID0gdnI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBkcjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBuLnNwZWNpYWxQdXJwb3Nlc0xhYmVsLCBpID0gYnI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBtcjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBuLmZsZXhpYmxlUHVycG9zZXNMYWJlbCwgaSA9IHZyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgcHI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gbi5mZWF0dXJlc0xhYmVsLCBpID0gZ3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBocjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBuLnNwZWNpYWxGZWF0dXJlc0xhYmVsLCBpID0geXI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB1cjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBuLmxlZ2l0aW1hdGVJbnRlcmVzdFB1cnBvc2VzTGFiZWwsIGkgPSB2cjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KCdwJywgeyBrZXk6ICcnLmNvbmNhdChpKS5jb25jYXQoZSkgfSwgJy0gJywgcltpXVtlXS5uYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2xpJywgbnVsbCwgUWUuYS5jcmVhdGVFbGVtZW50KCdzdHJvbmcnLCBudWxsLCBvKSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlLCB0LCBuLCBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLnVzZUVmZmVjdChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdy5sZW5ndGggPCBnLmxlbmd0aCAmJiAodCA9IHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4KGcuc2xpY2UoMCwgdy5sZW5ndGggKyAxMDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAxMDAwKSksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtkXSksIFFlLmEudXNlRWZmZWN0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggJiYgKGgoITEpLCBwICYmIHcubGVuZ3RoID09PSBnLmxlbmd0aCAmJiBwKCEwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFt3XSksIFFlLmEudXNlRWZmZWN0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIoITApOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBbXSksIG0gPyBRZS5hLmNyZWF0ZUVsZW1lbnQoUWUuYS5GcmFnbWVudCwgbnVsbCwgUWUuYS5jcmVhdGVFbGVtZW50KGp0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6ICcnLmNvbmNhdChuIHx8ICcnLCAnIHFjLWNtcDItY29uc2VudC1saXN0JyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJIZWFkZXJDb2xvcjogX28uc3ViSGVhZGVyQ29sb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJDb2xvcjogX28uYm9yZGVyQ29sb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaWdodFRleHRDb2xvcjogX28ubGlnaHRUZXh0Q29sb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWNvbmRhcnlUZXh0Q29sb3I6IF9vLnNlY29uZGFyeVRleHRDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV4UHJpbWFyeUJ1dHRvbkNvbG9yOiBfby51eFByaW1hcnlCdXR0b25Db2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV4QmFja2dyb3VuZENvbG9yOiBfby51eEJhY2tncm91bmRDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzSUU6IFVuKCkKICAgICAgICAgICAgICAgICAgICAgICAgfSwgKGkgPT09IEN0Lk5PTl9JQUIgfHwgaSA9PT0gQ3QuTEVHSVRJTUFURV9QVVJQT1NFUyB8fCBpID09PSBDdC5MRUdJVElNQVRFX1ZFTkRPUlMgfHwgaSA9PT0gQ3QuR09PR0xFKSAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3AnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItbGlzdC1oZWFkZXInIH0sIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdC5OT05fSUFCOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1Lm5vbklhYlZlbmRvcnNMYWJlbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3QuTEVHSVRJTUFURV9QVVJQT1NFUzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5sZWdpdGltYXRlSW50ZXJlc3RQdXJwb3Nlc0xhYmVsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdC5MRUdJVElNQVRFX1ZFTkRPUlM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIubGVnaXRpbWF0ZUludGVyZXN0VmVuZG9yTGFiZWw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN0LkdPT0dMRToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5nb29nbGVQYXJ0bmVyczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgfSgpKSwgdy5tYXAoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoY3IsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZVVpTGFiZWxzOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZW1pdW1VaUxhYmVsczogdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhVHlwZTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlOiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvZ2dsZXNIaWRkZW46IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwYW5kYWJsZTogcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVDbGljazogZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXBVSToga28sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXRlbTogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb3B1bGF0ZVZlbmRvckluZm86IFMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSkpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHdyKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZ3QoWwogICAgICAgICAgICAgICAgICAgICAgICAnXG4gICYmIHtcbiAgICB0ZXh0LWFsaWduOiBjZW50ZXI7XG4gICAgbWFyZ2luOiAxMHB4IGF1dG8gIWltcG9ydGFudDtcbiAgICB6LWluZGV4OiAxMDA7XG4gICAgYmFja2dyb3VuZC1jb2xvcjogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgfVxuXG4gIC5sb2FkZXIge1xuICAgIGRpc3BsYXk6IGlubGluZS1ibG9jaztcbiAgICBAa2V5ZnJhbWVzIGxpbmUtc2NhbGUge1xuICAgICAgMCUge1xuICAgICAgICAtd2Via2l0LXRyYW5zZm9ybTogc2NhbGV5KDEpO1xuICAgICAgICB0cmFuc2Zvcm06IHNjYWxleSgxKTtcbiAgICAgIH1cbiAgICAgIDUwJSB7XG4gICAgICAgIC13ZWJraXQtdHJhbnNmb3JtOiBzY2FsZXkoMC40KTtcbiAgICAgICAgdHJhbnNmb3JtOiBzY2FsZXkoMC40KTtcbiAgICAgIH1cbiAgICAgIDEwMCUge1xuICAgICAgICAtd2Via2l0LXRyYW5zZm9ybTogc2NhbGV5KDEpO1xuICAgICAgICB0cmFuc2Zvcm06IHNjYWxleSgxKTtcbiAgICAgIH1cbiAgICB9XG4gICAgLmxpbmUtc2NhbGUge1xuICAgICAgJiA+IGRpdjpudGgtY2hpbGQoMSkge1xuICAgICAgICAtd2Via2l0LWFuaW1hdGlvbjogbGluZS1zY2FsZSAxcyAtMC40cyBpbmZpbml0ZSBjdWJpYy1iZXppZXIoMC4yLCAwLjY4LCAwLjE4LCAxLjA4KTtcbiAgICAgICAgYW5pbWF0aW9uOiBsaW5lLXNjYWxlIDFzIC0wLjRzIGluZmluaXRlIGN1YmljLWJlemllcigwLjIsIDAuNjgsIDAuMTgsIDEuMDgpO1xuICAgICAgfVxuICAgICAgJiA+IGRpdjpudGgtY2hpbGQoMikge1xuICAgICAgICAtd2Via2l0LWFuaW1hdGlvbjogbGluZS1zY2FsZSAxcyAtMC4zcyBpbmZpbml0ZSBjdWJpYy1iZXppZXIoMC4yLCAwLjY4LCAwLjE4LCAxLjA4KTtcbiAgICAgICAgYW5pbWF0aW9uOiBsaW5lLXNjYWxlIDFzIC0wLjNzIGluZmluaXRlIGN1YmljLWJlemllcigwLjIsIDAuNjgsIDAuMTgsIDEuMDgpO1xuICAgICAgfVxuICAgICAgJiA+IGRpdjpudGgtY2hpbGQoMykge1xuICAgICAgICAtd2Via2l0LWFuaW1hdGlvbjogbGluZS1zY2FsZSAxcyAtMC4ycyBpbmZpbml0ZSBjdWJpYy1iZXppZXIoMC4yLCAwLjY4LCAwLjE4LCAxLjA4KTtcbiAgICAgICAgYW5pbWF0aW9uOiBsaW5lLXNjYWxlIDFzIC0wLjJzIGluZmluaXRlIGN1YmljLWJlemllcigwLjIsIDAuNjgsIDAuMTgsIDEuMDgpO1xuICAgICAgfVxuICAgICAgJiA+IGRpdjpudGgtY2hpbGQoNCkge1xuICAgICAgICAtd2Via2l0LWFuaW1hdGlvbjogbGluZS1zY2FsZSAxcyAtMC4xcyBpbmZpbml0ZSBjdWJpYy1iZXppZXIoMC4yLCAwLjY4LCAwLjE4LCAxLjA4KTtcbiAgICAgICAgYW5pbWF0aW9uOiBsaW5lLXNjYWxlIDFzIC0wLjFzIGluZmluaXRlIGN1YmljLWJlemllcigwLjIsIDAuNjgsIDAuMTgsIDEuMDgpO1xuICAgICAgfVxuICAgICAgJiA+IGRpdjpudGgtY2hpbGQoNSkge1xuICAgICAgICAtd2Via2l0LWFuaW1hdGlvbjogbGluZS1zY2FsZSAxcyAwcyBpbmZpbml0ZVxuICAgICAgICAgIGN1YmljLWJlemllcigwLjIsIDAuNjgsIDAuMTgsIDEuMDgpO1xuICAgICAgICBhbmltYXRpb246IGxpbmUtc2NhbGUgMXMgMHMgaW5maW5pdGUgY3ViaWMtYmV6aWVyKDAuMiwgMC42OCwgMC4xOCwgMS4wOCk7XG4gICAgICB9XG4gICAgICAmID4gZGl2IHtcbiAgICAgICAgYmFja2dyb3VuZDogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgd2lkdGg6IDRweDtcbiAgICAgICAgaGVpZ2h0OiAzNXB4O1xuICAgICAgICBib3JkZXItcmFkaXVzOiAycHg7XG4gICAgICAgIG1hcmdpbjogMnB4O1xuICAgICAgICAtd2Via2l0LWFuaW1hdGlvbi1maWxsLW1vZGU6IGJvdGg7XG4gICAgICAgIGFuaW1hdGlvbi1maWxsLW1vZGU6IGJvdGg7XG4gICAgICAgIGRpc3BsYXk6IGlubGluZS1ibG9jaztcbiAgICAgIH1cbiAgICB9XG4nCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHhyID0gdnQuYy5kaXYod3IoKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhCYWNrZ3JvdW5kQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudXhQcmltYXJ5QnV0dG9uQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgfSksIFNyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KHhyLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1eFByaW1hcnlCdXR0b25Db2xvcjogX28udXhQcmltYXJ5QnV0dG9uQ29sb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1eEJhY2tncm91bmRDb2xvcjogX28udXhCYWNrZ3JvdW5kQ29sb3IKICAgICAgICAgICAgICAgICAgICAgICAgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ2xvYWRlcicgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ2xpbmUtc2NhbGUnIH0sIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgbnVsbCksIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgbnVsbCksIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgbnVsbCksIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgbnVsbCksIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgbnVsbCkpKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgQ3IgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBlLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0LmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAodFtuXSB8fCBbXSkuaW5jbHVkZXMoZS5pZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnZlbmRvcnMgPSByLCBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBrciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gZS5jb3JlVWlMYWJlbHMsIHIgPSBlLnByZW1pdW1VaUxhYmVscywgbyA9IGUudmVuZG9yc0RhdGEsIGkgPSBlLmhhbmRsZUNsaWNrLCBhID0gZS5ub25JYWJEYXRhLCBzID0gZS5jaGlsZHJlbiwgYyA9IFFlLmEudXNlUmVmKG51bGwpLCB1ID0gIU9iamVjdC52YWx1ZXMoby5sZWdpdGltYXRlUHVycG9zZXMpLmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3RhdHVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgJiYgIU9iamVjdC52YWx1ZXMoby5sZWdpdGltYXRlVmVuZG9ycykuZXZlcnkoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdGF0dXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbCA9IG0oe30sIG8ubGVnaXRpbWF0ZVB1cnBvc2VzKSwgZiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0VuYWJsZWQ6IGEuaXNFbmFibGVkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvcnM6IGEudmVuZG9ycy5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubGVnSW50UHVycG9zZXMubGVuZ3RoID4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcCA9IGEuaXNFbmFibGVkICYmIGEudmVuZG9ycy5sZW5ndGggJiYgZi52ZW5kb3JzLmxlbmd0aCA+IDAsIGQgPSBtdChRZS5hLnVzZVN0YXRlKCExKSwgMiksIGggPSBkWzBdLCBnID0gZFsxXSwgdiA9IG10KFFlLmEudXNlU3RhdGUoMCksIDIpLCB5ID0gdlswXSwgYiA9IHZbMV0sIEUgPSBtdChRZS5hLnVzZVN0YXRlKCExKSwgMiksIHcgPSBFWzBdLCB4ID0gRVsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5rZXlzKGwpLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFMgPSBPYmplY3QudmFsdWVzKG0oe30sIG8udmVuZG9ycykpLCBDID0gT2JqZWN0LnZhbHVlcyhsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIENyKEMsIFMsICdsZWdJbnRQdXJwb3NlcycpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLnVzZUVmZmVjdChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMuY3VycmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkgJiYgZSAmJiB4KCEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgW3ldKSwgUWUuYS51c2VFZmZlY3QoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjLmN1cnJlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ICYmIGUgJiYgKGUuc2Nyb2xsVG9wID0gZS5zY3JvbGxIZWlnaHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBbd10pLCBRZS5hLnVzZUVmZmVjdChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFt0XSksIFFlLmEuY3JlYXRlRWxlbWVudChRZS5hLkZyYWdtZW50LCBudWxsLCBzWzBdLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItc2Nyb2xsYWJsZS1zZWN0aW9uICcuY29uY2F0KHcgPyAnbG9hZGluZycgOiAnJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWY6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvblNjcm9sbDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYy5jdXJyZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0KSwgZSAmJiAhaCAmJiBlLnNjcm9sbFRvcCArIGUub2Zmc2V0SGVpZ2h0ID4gZS5zY3JvbGxIZWlnaHQgLSA1MCAmJiAodCA9IHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKG5ldyBEYXRlKCkuZ2V0VGltZSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAzMDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgUWUuYS5jcmVhdGVFbGVtZW50KEVyLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlVWlMYWJlbHM6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVtaXVtVWlMYWJlbHM6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBvLmxlZ2l0aW1hdGVQdXJwb3NlcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFUeXBlOiBDdC5MRUdJVElNQVRFX1BVUlBPU0VTLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiRGF0YTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZUNsaWNrOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiB1ID8gMSA6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBhbmRhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2l0aW1hdGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBRZS5hLmNyZWF0ZUVsZW1lbnQoRXIsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcmVVaUxhYmVsczogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZW1pdW1VaUxhYmVsczogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhVHlwZTogQ3QuTEVHSVRJTUFURV9WRU5ET1JTLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlQ2xpY2s6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkZ1bGx5UmVuZGVyZWQ6IGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmlnZ2VyUmVSZW5kZXI6IHksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRTaG93TG9hZGVyOiB4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwYW5kYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgISFwICYmIFFlLmEuY3JlYXRlRWxlbWVudChFciwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZVVpTGFiZWxzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYkRhdGE6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhVHlwZTogQ3QuTk9OX0lBQiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZUNsaWNrOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlbWl1bVVpTGFiZWxzOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwYW5kYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHcgJiYgUWUuYS5jcmVhdGVFbGVtZW50KFNyLCBudWxsKSksIFFlLmEuY2xvbmVFbGVtZW50KHNbMV0sIHsgaXNPYmplY3Rpbmc6IHUgfSkpOwogICAgICAgICAgICAgICAgICAgIH0sIFRyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLml0ZW0sIG4gPSBlLmlkLCByID0gZS5zZWN0aW9uTmFtZSwgbyA9IGUuY29yZVVpTGFiZWxzLCBpID0gZS5wcmVtaXVtVWlMYWJlbHMsIGEgPSBlLmhhbmRsZUNsaWNrLCBzID0gZS5oYW5kbGVDb25zZW50LCBjID0gZS5EQVRBX1RZUEU7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoUWUuYS5GcmFnbWVudCwgeyBrZXk6ICcnLmNvbmNhdCh0Lm5hbWUpLmNvbmNhdChuKSB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2xpJywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLWV4cGFuZGFibGUtaW5mbycgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdzdHJvbmcnLCBudWxsLCB0Lm5hbWUpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3AnLCBudWxsLCB0LmRlc2NyaXB0aW9uKSwgdC5kZXNjcmlwdGlvbkxlZ2FsICYmIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLWV4cGFuZGFibGUtbGVnYWwnIH0sIFFlLmEuY3JlYXRlRWxlbWVudChGbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTogJ3NtYWxsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItdG9nZ2xlLWxlZ2FsLWJ1dHRvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkNsaWNrOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhKGUsICdsZWdhbERlc2NyaXB0aW9uLXN0YWNrcy0nLmNvbmNhdChyLCAnLScpLmNvbmNhdChuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFFlLmEuY3JlYXRlRWxlbWVudChCdCwgeyB0eXBlOiAnZmlsbCcgfSksIG8ubGVnYWxEZXNjcmlwdGlvbiksIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1sZWdhbC1kZXNjcmlwdGlvbicgfSwgdC5kZXNjcmlwdGlvbkxlZ2FsLnJlcGxhY2UoLyg6XHNcKil8KDpcKikvZ2ksICc6JykucmVwbGFjZSgvKFwuXHNcKil8KFwuXCopfChcc1wqKS9naSwgJy4nKSkpLCB0LnZlbmRvcnMgJiYgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItZXhwYW5kYWJsZS1sZWdhbCcgfSwgUWUuYS5jcmVhdGVFbGVtZW50KEZuLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplOiAnc21hbGwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi10b2dnbGUtbGVnYWwtYnV0dG9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2s6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoZSwgJ3ZlbmRvcnMtc3RhY2tzLScuY29uY2F0KHQuaWQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgUWUuYS5jcmVhdGVFbGVtZW50KEJ0LCB7IHR5cGU6ICdmaWxsJyB9KSwgby5zaG93UGFydG5lcnMpLCBWbih0LnZlbmRvcnMsICdpZCcpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGUuaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi1sZWdhbC1kZXNjcmlwdGlvbicKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICctICcuY29uY2F0KGUubmFtZSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgISghdC5ub25JYWJWZW5kb3JzIHx8ICF0Lm5vbklhYlZlbmRvcnMubGVuZ3RoKSAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoUWUuYS5GcmFnbWVudCwgbnVsbCwgdC5ub25JYWJWZW5kb3JzLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGUubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6ICdxYy1jbXAyLWxlZ2FsLWRlc2NyaXB0aW9uJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgJy0gJy5jb25jYXQoZS5uYW1lKSwgJyonKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1sZWdhbC1kZXNjcmlwdGlvbiBxYy1jbXAyLW5vbi1pYWInIH0sICcqICcsIGkubm9uSWFiVmVuZG9yc0xhYmVsKSkpKSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItdG9nZ2xlLXN3aXRjaCcgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCR0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG93TGFiZWw6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb246IHQuc3RhdHVzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMobiwgJ3B1cnBvc2VzJyA9PT0gciA/IGMuUFVSUE9TRVMgOiBjLlNQRUNJQUxfRkVBVFVSRVMsICF0LnN0YXR1cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi10b2dnbGUnCiAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgX3IgPSB4dC5FWFBBTkRfRUxFTUVOVCwgUHIgPSB4dC5DT0xMQVBTRV9FTEVNRU5ULCBPciA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3RdLmxlbmd0aCA/IGVbdF0ubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG4uZmluZChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmlkID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gJ3B1cnBvc2VzJyA9PT0gdCAmJiByICYmIHIudmVuZG9yczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLm5vbklhYlZlbmRvcnMgPSBpICYmIGkubGVuZ3RoICYmIGkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5vbklhYlB1cnBvc2VDb25zZW50SWRzICYmIGUubm9uSWFiUHVycG9zZUNvbnNlbnRJZHMuaW5jbHVkZXMoby5pZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBlOwogICAgICAgICAgICAgICAgICAgICAgICB9KSA6IFtdOwogICAgICAgICAgICAgICAgICAgIH0sIElyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmlkLCBuID0gZS5zdGFjaywgciA9IGUub25Ub2dnbGUsIG8gPSBlLnB1cnBvc2VzLCBpID0gZS5zcGVjaWFsRmVhdHVyZXMsIGEgPSBlLm5vbklhYkRhdGEsIHMgPSBlLmNvcmVVaUxhYmVscywgYyA9IGUucHJlbWl1bVVpTGFiZWxzLCB1ID0gZS5oYW5kbGVDbGljaywgbCA9IGUuaGFuZGxlQ29uc2VudCwgZiA9IGUuY2xhc3NOYW1lLCBwID0gZS5EQVRBX1RZUEUsIGQgPSAnJy5jb25jYXQodCwgJy1leHBhbmRhYmxlJyksIGggPSBtdChRZS5hLnVzZVN0YXRlKE9yKG4sICdwdXJwb3NlcycsIG8sIGEpKSwgMiksIGcgPSBoWzBdLCB2ID0gaFsxXSwgeSA9IG10KFFlLmEudXNlU3RhdGUoT3IobiwgJ3NwZWNpYWxGZWF0dXJlcycsIGksIGEpKSwgMiksIGIgPSB5WzBdLCBFID0geVsxXSwgdyA9IG10KFFlLmEudXNlU3RhdGUoZy5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGUuc3RhdHVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkubGVuZ3RoICsgYi5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITAgPT09IGUuc3RhdHVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkubGVuZ3RoKSwgMiksIHggPSB3WzBdLCBTID0gd1sxXSwgQyA9IG10KFFlLmEudXNlU3RhdGUoITEpLCAyKSwgayA9IENbMF0sIFQgPSBDWzFdLCBfID0gbXQoUWUuYS51c2VTdGF0ZShuLnN0YXR1cyksIDIpLCBQID0gX1swXSwgTyA9IF9bMV0sIEkgPSBtdChRZS5hLnVzZVN0YXRlKG4uc3RhdGVMYWJlbCksIDIpLCBMID0gSVswXSwgQSA9IElbMV0sIFIgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwoZSwgdCksIHQgPT09IHAuUFVSUE9TRVMgPyB2KGcubWFwKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmlkID09PSBlICYmICh0LnN0YXR1cyA9IG4pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSA6IEUoYi5tYXAoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuaWQgPT09IGUgJiYgKHQuc3RhdHVzID0gbiksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBTKHggKyAobiA/IDEgOiAtMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEudXNlRWZmZWN0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gcy5vbkxhYmVsLCB0ID0gcy5vZmZMYWJlbCwgbiA9IHMubXVsdGlMYWJlbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPT09IHggPyAoQSh0KSwgTyghMSkpIDogeCA9PT0gZy5sZW5ndGggKyBiLmxlbmd0aCA/IChBKGUpLCBPKCEwKSkgOiAoQShuKSwgTyghMSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBbeF0pLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2xpJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RhdGEtdGVzdGlkJzogJ3N0YWNrLWl0ZW0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAnJy5jb25jYXQoZiwgJyAnKS5jb25jYXQoayA/ICdxYy1jbXAyLWV4cGFuZGVkJyA6ICcnKQogICAgICAgICAgICAgICAgICAgICAgICB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2J1dHRvbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItbGlzdC1pdGVtLWhlYWRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYXJpYS1leHBhbmRlZCc6IGssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYXJpYS1jb250cm9scyc6IGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZGF0YS10ZXN0aWQnOiAnc3RhY2staXRlbS1oZWFkZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsgPyBrby5ldmVudFRyYWNrZXIoUHIsIHQpIDoga28uZXZlbnRUcmFja2VyKF9yLCB0KSwgVCghayk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1saXN0LWl0ZW0tdGl0bGUnIH0sIG4ubmFtZSksIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1saXN0LWl0ZW0tc3RhdHVzJyB9LCBMKSwgUWUuYS5jcmVhdGVFbGVtZW50KEJ0LCB7IHR5cGU6ICdleHBhbmQnIH0pKSwgUWUuYS5jcmVhdGVFbGVtZW50KCd1bCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi1leHBhbmRhYmxlLWxpc3QnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFFlLmEuY3JlYXRlRWxlbWVudCgnbGknLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItZXhwYW5kYWJsZS1pbmZvJyB9LCBuLmRlc2NyaXB0aW9uKSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItdG9nZ2xlLXN3aXRjaCcgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCR0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG93TGFiZWw6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi10b2dnbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb246IFAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkNsaWNrOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcigpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2KGcubWFwKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbShtKHt9LCB0KSwge30sIHsgc3RhdHVzOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSksIEUoYi5tYXAoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtKG0oe30sIHQpLCB7fSwgeyBzdGF0dXM6IGUgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgUyhlID8gZy5sZW5ndGggKyBiLmxlbmd0aCA6IDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oIVApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc2FibGVkOiAhawogICAgICAgICAgICAgICAgICAgICAgICB9KSksIGcubWFwKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KFRyLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGUuaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW06IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdGlvbk5hbWU6ICdwdXJwb3NlcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZVVpTGFiZWxzOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZW1pdW1VaUxhYmVsczogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVDbGljazogdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVDb25zZW50OiBSLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERBVEFfVFlQRTogcAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBiLm1hcChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudChUciwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBlLmlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVtOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY3Rpb25OYW1lOiAnc3BlY2lhbEZlYXR1cmVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlVWlMYWJlbHM6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlbWl1bVVpTGFiZWxzOiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZUNsaWNrOiB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZUNvbnNlbnQ6IFIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREFUQV9UWVBFOiBwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gTHIoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBndChbJ1xuICAgICAgICAucWMtY21wMi10b2dnbGUtbGVnYWwtYnV0dG9uIHtcbiAgICAgICAgICBoZWlnaHQ6IDM0cHg7XG4gICAgICAgIH1cblxuICAgICAgICAucWMtY21wMi10b2dnbGUtbGVnYWwtYnV0dG9uIHN2ZyB7XG4gICAgICAgICAgaGVpZ2h0OiAyMnB4O1xuICAgICAgICAgIHdpZHRoOiAxNHB4O1xuICAgICAgICB9XG4gICAgICAnXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIExyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gQXIoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBndChbCiAgICAgICAgICAgICAgICAgICAgICAgICdcbiAgJiYge1xuICAgICcsCiAgICAgICAgICAgICAgICAgICAgICAgICdcblxuICAgIC5xYy1jbXAyLWxpc3QtaXRlbSB7XG4gICAgICAmOm9ubHktY2hpbGQge1xuICAgICAgICBib3JkZXItYm90dG9tOiBzb2xpZCAxcHggJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgIH1cblxuICAgICAgLnFjLWNtcDItZXhwYW5kYWJsZS1saXN0IHtcbiAgICAgICAgZmxleC13cmFwOiB3cmFwO1xuICAgICAgICBqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47XG5cbiAgICAgICAgLnFjLWNtcDItZXhwYW5kYWJsZS1pbmZvIHtcbiAgICAgICAgICBtYXJnaW4tYm90dG9tOiAyMHB4O1xuICAgICAgICAgIHdpZHRoOiA4NSU7XG4gICAgICAgICAgJjpmaXJzdC1vZi10eXBlIHtcbiAgICAgICAgICAgIG1hcmdpbjogMjBweCAwcHg7XG4gICAgICAgICAgfVxuICAgICAgICAgIGxpIHtcbiAgICAgICAgICAgIG1hcmdpbjogMDtcbiAgICAgICAgICAgIHBhZGRpbmc6IDA7XG5cbiAgICAgICAgICAgIHAge1xuICAgICAgICAgICAgICBtYXJnaW46IDA7XG4gICAgICAgICAgICAgIHBhZGRpbmc6IDA7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgc3Ryb25nIHtcbiAgICAgICAgICAgIG1hcmdpbi10b3A6IDA7XG4gICAgICAgICAgICBtYXJnaW4tYm90dG9tOiA1cHg7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgJjpsYXN0LW9mLXR5cGUge1xuICAgICAgICAgICAgbWFyZ2luLWJvdHRvbTogMCU7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLnFjLWNtcDItdG9nZ2xlLXN3aXRjaCB7XG4gICAgICAgICAgbWFyZ2luLWJvdHRvbTogMTBweDtcbiAgICAgICAgICAmOmZpcnN0LW9mLXR5cGUge1xuICAgICAgICAgICAgbWFyZ2luLXRvcDogMjBweDtcbiAgICAgICAgICAgIG1hcmdpbi1ib3R0b206IDMwcHg7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuICB9XG4nCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIFJyID0gT2JqZWN0KHZ0LmMpKGp0KShBcigpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5pc0lFICYmIE9iamVjdCh2dC5iKShMcigpKTsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5ib3JkZXJDb2xvcjsKICAgICAgICAgICAgICAgICAgICB9KSwgTnIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudmVuZG9yc0RhdGEsIG4gPSBlLmhhbmRsZUNsaWNrLCByID0gZS5jb3JlVWlMYWJlbHMsIG8gPSBlLnB1cnBvc2VzLCBpID0gZS5zcGVjaWFsRmVhdHVyZXMsIGEgPSBlLnByZW1pdW1VaUxhYmVscywgcyA9IGUubm9uSWFiRGF0YSwgYyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga28uaGFuZGxlQ29uc2VudChlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoUnIsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlckNvbG9yOiBfby5ib3JkZXJDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpZ2h0VGV4dENvbG9yOiBfby5saWdodFRleHRDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY29uZGFyeVRleHRDb2xvcjogX28uc2Vjb25kYXJ5VGV4dENvbG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXhQcmltYXJ5QnV0dG9uQ29sb3I6IF9vLnV4UHJpbWFyeUJ1dHRvbkNvbG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNJRTogVW4oKQogICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QuZW50cmllcyh0LnN0YWNrcykubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG10KGUsIDIpLCB1ID0gdFswXSwgbCA9IHRbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KElyLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdzdGFjay1pdGVtLWlkOicuY29uY2F0KHUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrOiBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uVG9nZ2xlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga28uaGFuZGxlQ29uc2VudChlLCBDdC5TVEFDS1MpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVycG9zZXM6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lhbEZlYXR1cmVzOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYkRhdGE6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZVVpTGFiZWxzOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZW1pdW1VaUxhYmVsczogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVDbGljazogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVDb25zZW50OiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3N0YWNrLWl0ZW0tJy5jb25jYXQodSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RhdGEtdGVzdGlkJzogJ3N0YWNrLWl0ZW0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItbGlzdC1pdGVtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQVRBX1RZUEU6IEN0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBqcigpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsnXG4gICAgICAmJiYmIHtcbiAgICAgICAgLnFjLWNtcDItdG9nZ2xlLWxlZ2FsLWJ1dHRvbiB7XG4gICAgICAgICAgaGVpZ2h0OiAzNHB4O1xuICAgICAgICB9XG5cbiAgICAgICAgLnFjLWNtcDItdG9nZ2xlLWxlZ2FsLWJ1dHRvbiBzdmcge1xuICAgICAgICAgIGhlaWdodDogMjJweDtcbiAgICAgICAgICB3aWR0aDogMTRweDtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICddKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4ganIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBxcigpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuICAnLAogICAgICAgICAgICAgICAgICAgICAgICAnXG4nCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHFyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gRnIoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBndChbJ1xuICAmJiYmIHtcbiAgICBsaXN0LXN0eWxlOiBub25lO1xuXG4gICAgbGkge1xuICAgICAgbWFyZ2luLWJvdHRvbTogMTBweDtcblxuICAgICAgJjpsYXN0LW9mLXR5cGUge1xuICAgICAgICBtYXJnaW4tYm90dG9tOiAwO1xuICAgICAgfVxuXG4gICAgICBzdHJvbmcge1xuICAgICAgICBkaXNwbGF5OiBibG9jaztcbiAgICAgIH1cbiAgICB9XG4gIH1cbiddKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRnIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgRHIgPSB2dC5jLnVsKEZyKCkpLCBNciA9IHZ0LmMuZGl2KHFyKCksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmlzSUUgJiYgT2JqZWN0KHZ0LmIpKGpyKCkpOwogICAgICAgICAgICAgICAgICAgIH0pLCBVciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gZS5oYW5kbGVDbGljaywgciA9IGUuY29yZVVpTGFiZWxzLCBvID0gZS5wcmVtaXVtVWlMYWJlbHMsIGkgPSBlLmRhdGEsIGEgPSBlLmlkLCBzID0gZS50aXRsZTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMgPT09IG8ubGlua3NUaXRsZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBpLm1hcChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2xpJywgeyBrZXk6IGUubGFiZWwgKyB0IH0sIFFlLmEuY3JlYXRlRWxlbWVudCgnYScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHJlZjogZS5saW5rLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdfYmxhbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWw6ICdub29wZW5lciBub3JlZmVycmVyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUubGFiZWwpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB1IGluIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGlbdV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiBpbiBsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gbFtmXSwgZCA9IChwLmRlc2NyaXB0aW9uTGVnYWwgfHwgJycpLnJlcGxhY2UoLyg6XHNcKil8KDpcKikvZ2ksICc6JykucmVwbGFjZSgvKFwuXHNcKil8KFwuXCopfChcc1wqKS9naSwgJy4nKSwgaCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJycuY29uY2F0KHUsICcgJykuY29uY2F0KHAuaWQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwLm5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb246IHAuZGVzY3JpcHRpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3JpcHRpb25MZWdhbDogZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5wdXNoKGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBjLm1hcChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2xpJywgeyBrZXk6IHQgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdzdHJvbmcnLCBudWxsLCBlLnRpdGxlKSwgZS5kZXNjcmlwdGlvbiwgZS5kZXNjcmlwdGlvbkxlZ2FsICYmIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLWV4cGFuZGFibGUtbGVnYWwnIH0sIFFlLmEuY3JlYXRlRWxlbWVudChGbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6ICdzbWFsbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItdG9nZ2xlLWxlZ2FsLWJ1dHRvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2s6IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbih0LCAnbGVnYWxEZXNjcmlwdGlvbi0nLmNvbmNhdChlLmlkKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoQnQsIHsgdHlwZTogJ2ZpbGwnIH0pLCByLmxlZ2FsRGVzY3JpcHRpb24pLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3AnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItbGVnYWwtZGVzY3JpcHRpb24nIH0sIGUuZGVzY3JpcHRpb25MZWdhbCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoanQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItY29uc2VudC1saXN0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YkhlYWRlckNvbG9yOiBfby5zdWJIZWFkZXJDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlckNvbG9yOiBfby5ib3JkZXJDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpZ2h0VGV4dENvbG9yOiBfby5saWdodFRleHRDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlY29uZGFyeVRleHRDb2xvcjogX28uc2Vjb25kYXJ5VGV4dENvbG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXhQcmltYXJ5QnV0dG9uQ29sb3I6IF9vLnV4UHJpbWFyeUJ1dHRvbkNvbG9yCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFFlLmEuY3JlYXRlRWxlbWVudCgnbGknLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItbGlzdC1pdGVtJwogICAgICAgICAgICAgICAgICAgICAgICB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2J1dHRvbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItbGlzdC1pdGVtLWhlYWRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkNsaWNrOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKGUsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3AnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItbGlzdC1pdGVtLXRpdGxlJyB9LCBzID09PSBvLmxpbmtzVGl0bGUgPyBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3N0cm9uZycsIG51bGwsIHMpIDogcyksIFFlLmEuY3JlYXRlRWxlbWVudChCdCwgeyB0eXBlOiAnZXhwYW5kJyB9KSksIFFlLmEuY3JlYXRlRWxlbWVudCgndWwnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItZXhwYW5kYWJsZS1saXN0JyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoTXIsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzSUU6IFVuKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6ICdxYy1jbXAyLWV4cGFuZGFibGUtaW5mbycKICAgICAgICAgICAgICAgICAgICAgICAgfSwgUWUuYS5jcmVhdGVFbGVtZW50KERyLCBudWxsLCB0KSkpKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgVnIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuY29yZVVpTGFiZWxzLCBuID0gZS5wcmVtaXVtVWlMYWJlbHMsIHIgPSBlLnZlbmRvcnNEYXRhLCBvID0gZS5oYW5kbGVDbGljaywgaSA9IGUubm9uSWFiRGF0YSwgYSA9IGUuY2hpbGRyZW4sIHMgPSBodChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmRpc2FibGVBY2NlcHRCdXR0b24sIGMgPSBtdChPYmplY3QoWWUudXNlU3RhdGUpKHMpLCAyKSwgdSA9IGNbMF0sIGwgPSBjWzFdLCBmID0gci5zdGFja3MsIHAgPSBtKHt9LCByLnNwZWNpYWxGZWF0dXJlcyksIGQgPSBtKHt9LCByLnB1cnBvc2VzKSwgaCA9IEpTT04ucGFyc2UoSlNPTi5zdHJpbmdpZnkoZCkpLCBnID0gSlNPTi5wYXJzZShKU09OLnN0cmluZ2lmeShwKSksIHYgPSBPYmplY3QudmFsdWVzKGgpLCB5ID0gT2JqZWN0LnZhbHVlcyhnKSwgYiA9IE9iamVjdChZZS51c2VSZWYpKG51bGwpLCBFID0gT2JqZWN0KFllLnVzZUNhbGxiYWNrKShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBiLmN1cnJlbnQsIHQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnU3BlY2lhbCBQdXJwb3NlcyBhbmQgRmVhdHVyZXMgR3JvdXAnKSwgbiA9IG51bGwgPT09IGUgfHwgdm9pZCAwID09PSBlID8gdm9pZCAwIDogZS5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKSwgciA9IG51bGwgPT09IHQgfHwgdm9pZCAwID09PSB0ID8gdm9pZCAwIDogdC5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmIHUgJiYgciAmJiBuICYmIChuLmJvdHRvbSAtIHIudG9wID49IDAgJiYgKGwoITEpLCBlLnJlbW92ZUV2ZW50TGlzdGVuZXIoJ3Njcm9sbCcsIEUpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBbdV0pOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0KFllLnVzZUVmZmVjdCkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYi5jdXJyZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUgJiYgZSAmJiAoRSgpLCBlLmFkZEV2ZW50TGlzdGVuZXIoJ3Njcm9sbCcsIEUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIE9iamVjdC5rZXlzKGYpLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHcgaW4gZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB4ID0gZlt3XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeC5zcGVjaWFsRmVhdHVyZXMubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBTIGluIHApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4LnNwZWNpYWxGZWF0dXJlcy5pbmNsdWRlcyhwYXJzZUludChTLCAxMCkpICYmIGRlbGV0ZSBwW1NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh4LnB1cnBvc2VzLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgQyBpbiBkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeC5wdXJwb3Nlcy5pbmNsdWRlcyhwYXJzZUludChDLCAxMCkpICYmIGRlbGV0ZSBkW0NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LmtleXMoZCkubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IE9iamVjdC52YWx1ZXMobSh7fSwgci52ZW5kb3JzKSksIFQgPSBPYmplY3QudmFsdWVzKGQpLCBfID0gT2JqZWN0LnZhbHVlcyhwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIENyKFQsIGssICdwdXJwb3NlcycpLCBDcihfLCBrLCAnc3BlY2lhbEZlYXR1cmVzJyksIENyKHYsIGssICdwdXJwb3NlcycpLCBDcih5LCBrLCAnc3BlY2lhbEZlYXR1cmVzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudChRZS5hLkZyYWdtZW50LCBudWxsLCBhICYmIGFbMF0sIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi1zY3JvbGxhYmxlLXNlY3Rpb24nCiAgICAgICAgICAgICAgICAgICAgICAgIH0sICEhT2JqZWN0LmtleXMoZikubGVuZ3RoICYmIFFlLmEuY3JlYXRlRWxlbWVudChOciwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yc0RhdGE6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlVWlMYWJlbHM6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVDbGljazogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VzOiB2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lhbEZlYXR1cmVzOiB5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiRGF0YTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZW1pdW1VaUxhYmVsczogbgogICAgICAgICAgICAgICAgICAgICAgICB9KSwgISFPYmplY3Qua2V5cyhkKS5sZW5ndGggJiYgUWUuYS5jcmVhdGVFbGVtZW50KEVyLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlVWlMYWJlbHM6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YVR5cGU6IEN0LlBVUlBPU0VTLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiRGF0YTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZUNsaWNrOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlbWl1bVVpTGFiZWxzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwYW5kYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksICEhT2JqZWN0LmtleXMocCkubGVuZ3RoICYmIFFlLmEuY3JlYXRlRWxlbWVudChFciwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZVVpTGFiZWxzOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFUeXBlOiBDdC5TUEVDSUFMX0ZFQVRVUkVTLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlQ2xpY2s6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVtaXVtVWlMYWJlbHM6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBhbmRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9KSwgKCEhT2JqZWN0LmtleXMoci5zcGVjaWFsUHVycG9zZXMpLmxlbmd0aCB8fCAhIU9iamVjdC5rZXlzKHIuZmVhdHVyZXMpKSAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoVXIsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAnU3BlY2lhbCBQdXJwb3NlcyBhbmQgRmVhdHVyZXMgR3JvdXAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHQuc3BlY2lhbFB1cnBvc2VzQW5kRmVhdHVyZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlVWlMYWJlbHM6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVDbGljazogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU3BlY2lhbCBGZWF0dXJlcyc6IHIuc3BlY2lhbFB1cnBvc2VzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZlYXR1cmVzOiByLmZlYXR1cmVzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlbWl1bVVpTGFiZWxzOiBuCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAhIShuICYmIG4uaW5pdFNjcmVlbkN1c3RvbUxpbmtzICYmIG4uaW5pdFNjcmVlbkN1c3RvbUxpbmtzLmxlbmd0aCkgJiYgUWUuYS5jcmVhdGVFbGVtZW50KFVyLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogbi5saW5rc1RpdGxlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG4ubGlua3NUaXRsZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcmVVaUxhYmVsczogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZUNsaWNrOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogbi5pbml0U2NyZWVuQ3VzdG9tTGlua3MsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVtaXVtVWlMYWJlbHM6IG4KICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBhICYmIFFlLmEuY2xvbmVFbGVtZW50KGFbMV0sIHsgZGlzYWJsZWRBY2NlcHRBbGxCdXR0b246IHUgfSkpOwogICAgICAgICAgICAgICAgICAgIH0sIEJyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSBlLmNvcmVVaUxhYmVscywgciA9IGUubm9uSWFiRGF0YSwgbyA9IGUudmVuZG9yc0RhdGEsIGkgPSBlLmhhbmRsZUNsaWNrLCBhID0gZS5wcmVtaXVtVWlMYWJlbHMsIHMgPSBlLmdvb2dsZVZlbmRvcnMsIGMgPSBlLmNoaWxkcmVuLCB1ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRW5hYmxlZDogci5pc0VuYWJsZWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yczogci52ZW5kb3JzLmZpbHRlcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWUubGVnSW50UHVycG9zZXMgfHwgMCA9PT0gZS5sZWdJbnRQdXJwb3Nlcy5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGwgPSByLmlzRW5hYmxlZCAmJiByLnZlbmRvcnMubGVuZ3RoID4gMCAmJiB1LnZlbmRvcnMubGVuZ3RoID4gMCwgZiA9IFFlLmEudXNlUmVmKG51bGwpLCBwID0gbXQoUWUuYS51c2VTdGF0ZSghMSksIDIpLCBkID0gcFswXSwgaCA9IHBbMV0sIG0gPSBtdChRZS5hLnVzZVN0YXRlKCExKSwgMiksIGcgPSBtWzBdLCB2ID0gbVsxXSwgeSA9IG10KFFlLmEudXNlU3RhdGUoITEpLCAyKSwgYiA9IHlbMF0sIEUgPSB5WzFdLCB3ID0gbXQoUWUuYS51c2VTdGF0ZSgwKSwgMiksIHggPSB3WzBdLCBTID0gd1sxXSwgQyA9IG10KFFlLmEudXNlU3RhdGUoITEpLCAyKSwgayA9IENbMF0sIFQgPSBDWzFdLCBfID0gbXQoUWUuYS51c2VTdGF0ZSghMSksIDIpLCBQID0gX1swXSwgTyA9IF9bMV0sIEkgPSBtdChRZS5hLnVzZVN0YXRlKCExKSwgMiksIEwgPSBJWzBdLCBBID0gSVsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEudXNlRWZmZWN0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZi5jdXJyZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeCAmJiBlICYmIEEoITApOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBbeF0pLCBRZS5hLnVzZUVmZmVjdChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGYuY3VycmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEwgJiYgZSAmJiAoZS5zY3JvbGxUb3AgPSBlLnNjcm9sbEhlaWdodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtMXSksIFFlLmEudXNlRWZmZWN0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQoISFsICYmIGQpLCBPKGwgJiYgZyB8fCAhbCAmJiBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcKICAgICAgICAgICAgICAgICAgICAgICAgXSksIFFlLmEudXNlRWZmZWN0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgW10pLCBRZS5hLmNyZWF0ZUVsZW1lbnQoUWUuYS5GcmFnbWVudCwgbnVsbCwgY1swXSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6ICdxYy1jbXAyLXNjcm9sbGFibGUtc2VjdGlvbiAnLmNvbmNhdChMID8gJ2xvYWRpbmcnIDogJycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmOiBmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25TY3JvbGw6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGYuY3VycmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQodCksIGUgJiYgKCFkIHx8IGwgJiYgIWcgfHwgcy5pc0VuYWJsZWQgJiYgIWIpICYmIGUuc2Nyb2xsVG9wICsgZS5vZmZzZXRIZWlnaHQgPiBlLnNjcm9sbEhlaWdodCAtIDUwICYmICh0ID0gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFMobmV3IERhdGUoKS5nZXRUaW1lKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDMwMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoRXIsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcmVVaUxhYmVsczogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhVHlwZTogQ3QuVkVORE9SUywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZUNsaWNrOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlbWl1bVVpTGFiZWxzOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25GdWxseVJlbmRlcmVkOiBoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJpZ2dlclJlUmVuZGVyOiB4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0xvYWRlcjogQSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGFuZGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBsICYmIGsgJiYgUWUuYS5jcmVhdGVFbGVtZW50KEVyLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlVWlMYWJlbHM6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiRGF0YTogdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFUeXBlOiBDdC5OT05fSUFCLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlQ2xpY2s6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVtaXVtVWlMYWJlbHM6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkZ1bGx5UmVuZGVyZWQ6IHYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmlnZ2VyUmVSZW5kZXI6IHgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRTaG93TG9hZGVyOiBBLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwYW5kYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHMuaXNFbmFibGVkICYmIFAgJiYgIShQby5jb3JlQ29uZmlnLmNvbnNlbnRTY29wZSB8fCAnJykuaW5jbHVkZXMoJ2dsb2JhbCcpICYmIFFlLmEuY3JlYXRlRWxlbWVudChFciwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZVVpTGFiZWxzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogQW8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhVHlwZTogQ3QuR09PR0xFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlQ2xpY2s6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVtaXVtVWlMYWJlbHM6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkZ1bGx5UmVuZGVyZWQ6IEUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmlnZ2VyUmVSZW5kZXI6IHgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRTaG93TG9hZGVyOiBBLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwYW5kYWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSksIEwgJiYgUWUuYS5jcmVhdGVFbGVtZW50KFNyLCBudWxsKSksIGNbMV0pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB6cigpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsnXG4gICAgICAgICAgICB3aWR0aDogMTMwcHg7XG5cbiAgICAgICAgICAgIGltZyB7XG4gICAgICAgICAgICAgIG1heC13aWR0aDogMTAwJTtcbiAgICAgICAgICAgICAgaGVpZ2h0OiBhdXRvO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBAbWVkaWEgKG1pbi13aWR0aDogNzY4cHgpIHtcbiAgICAgICAgICAgICAgd2lkdGg6IDE3MHB4O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICddKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4genIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBHcigpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsnXG4gICAgICAgICAgICBoZWlnaHQ6IDQ1cHg7XG4gICAgICAgICAgICB0ZXh0LWFsaWduOiBjZW50ZXI7XG5cbiAgICAgICAgICAgIGltZyB7XG4gICAgICAgICAgICAgIG1heC1oZWlnaHQ6IDEwMCU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIEBtZWRpYSAobWluLXdpZHRoOiA3NjhweCkge1xuICAgICAgICAgICAgICBoZWlnaHQ6IDYwcHg7XG4gICAgICAgICAgICAgIHRleHQtYWxpZ246IGNlbnRlcjtcbiAgICAgICAgICAgICAgbWF4LXdpZHRoOiA3NzBweDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAnXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEdyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gSHIoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBndChbCiAgICAgICAgICAgICAgICAgICAgICAgICdcbiAgJiYge1xuICAgICcsCiAgICAgICAgICAgICAgICAgICAgICAgICdcbiAgfVxuJwogICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBIciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBXciwgJHIgPSB2dC5jLmRpdihIcigpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5pc1NxdWFyZSA/IE9iamVjdCh2dC5iKShHcigpKSA6IE9iamVjdCh2dC5iKSh6cigpKTsKICAgICAgICAgICAgICAgICAgICB9KSwgWXIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubG9nb1VybCwgbiA9IG10KE9iamVjdChZZS51c2VTdGF0ZSkoITEpLCAyKSwgciA9IG5bMF0sIG8gPSBuWzFdOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KCRyLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc1NxdWFyZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ2xvZ28tY29udGFpbmVyJwogICAgICAgICAgICAgICAgICAgICAgICB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2ltZycsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsdDogJ1B1Ymxpc2hlciBMb2dvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNyYzogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uTG9hZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudGFyZ2V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQub2Zmc2V0SGVpZ2h0ID49IHQub2Zmc2V0V2lkdGggJiYgbyghMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICB9LCBRciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jb3JlVWlMYWJlbHMsIG4gPSBlLnBhZ2UsIHIgPSBlLmhhbmRsZVNjcm9sbCwgbyA9IGUuYm9keUNvbnRlbnQsIGkgPSBlLmlzQW1wLCBhID0gZS5pc0Rlc2t0b3AsIHMgPSBQby5jb3JlQ29uZmlnLnB1Ymxpc2hlckxvZ28sIGMgPSBvLmJvZHlUZXh0LCB1ID0gby5pc0N1c3RvbWl6ZWQsIGwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwID09PSBuID8gUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItc3VtbWFyeS1pbmZvICcuY29uY2F0KHMgPyAncWMtY21wMi1sb2dvLWRpc3BsYXllZCcgOiAnJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uU2Nyb2xsOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciAmJiByKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmNoaWxkcmVuKSA6IFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgbnVsbCwgZS5jaGlsZHJlbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1ID8gUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCBudWxsLCBjKSA6IEFycmF5LmlzQXJyYXkoYykgPyBRZS5hLmNyZWF0ZUVsZW1lbnQoUWUuYS5GcmFnbWVudCwgbnVsbCwgYy5tYXAoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIHsga2V5OiB0IH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSA6IFFlLmEuY3JlYXRlRWxlbWVudCgncCcsIG51bGwsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLWNvbnNlbnQtaW5mbycgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItcHVibGlzaGVyLWxvZ28tY29udGFpbmVyJyB9LCBuID4gMSAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2J1dHRvbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItaG9tZS1idXR0b24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5fX3RjZmFwaXVpKCdnb1RvUGFnZScsIG4gLSAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgUWUuYS5jcmVhdGVFbGVtZW50KEJ0LCB7IHR5cGU6ICdiYWNrJyB9KSwgJyAnLCAoIWkgfHwgYSkgJiYgdC5iYWNrKSwgUWUuYS5jcmVhdGVFbGVtZW50KCdmaWd1cmUnLCBudWxsLCBzICYmIFFlLmEuY3JlYXRlRWxlbWVudChZciwgeyBsb2dvVXJsOiBzIH0pLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2gyJywgbnVsbCwgdC5pbml0U2NyZWVuVGl0bGUpKSwgUWUuYS5jcmVhdGVFbGVtZW50KGwsIG51bGwsIFFlLmEuY3JlYXRlRWxlbWVudChmLCBudWxsKSkpKTsKICAgICAgICAgICAgICAgICAgICB9LCBLciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByID0gZS5jb3JlVWlMYWJlbHMsIG8gPSBlLmFjY2VwdEFsbEZ1bmN0aW9uLCBpID0gZS5yZWplY3RBbGxGdW5jdGlvbiwgYSA9IGUuYWNjZXB0U2VsZWN0ZWQsIHMgPSBlLnBhZ2UsIGMgPSBlLnNldEFsbExlZ2l0aW1hdGVzVG8sIHUgPSBlLmlzT2JqZWN0aW5nLCBsID0gZS5kaXNhYmxlZEFjY2VwdEFsbEJ1dHRvbiwgZiA9IGUuc2hvd1JlamVjdEJ1dHRvbiwgcCA9IGUuc2hvd092ZXJsYXksIGQgPSBlLmlzU2Nyb2xsZWQsIGggPSBlLmlzQW1wLCBtID0gUG8uY29yZUNvbmZpZywgZyA9IG0ubGFuZ18sIHYgPSBtLmNvbnNlbnRJZGVudGl0eUVuYWJsZWQsIHkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyAmJiBjKHUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHUgPyByICYmIHIubGVnaXRpbWF0ZVNjcmVlbkFjY2VwdCA6IHIgJiYgci5vYmplY3RBbGxCdXR0b247CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gciA/IHIuc2F2ZUFuZEV4aXRCdXR0b24ubGVuZ3RoID4gMTggfHwgci5hZ3JlZUJ1dHRvbi5sZW5ndGggPiAxOCB8fCB0Lmxlbmd0aCA+IDE4IHx8IHIuaW5pdFNjcmVlblNldHRpbmdzQnV0dG9uLmxlbmd0aCA+IDE4IHx8IHIuaW5pdFNjcmVlblJlamVjdEJ1dHRvbi5sZW5ndGggPiAxOCA6IG51bGwsIEUgPSByID8gJ2VuJyAhPT0gZyAmJiByLmxlZ2l0aW1hdGVJbnRlcmVzdExpbmsubGVuZ3RoID4gMTggfHwgci5wdXJwb3NlU2NyZWVuVmVuZG9yTGluay5sZW5ndGggPiAxOCA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gMCA9PT0gcyA/IFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLXN1bW1hcnktYnV0dG9ucycgfSwgZiAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoRm4sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzTG9uZzogYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2s6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiAnc2Vjb25kYXJ5JwogICAgICAgICAgICAgICAgICAgICAgICB9LCByLmluaXRTY3JlZW5SZWplY3RCdXR0b24pLCBRZS5hLmNyZWF0ZUVsZW1lbnQoRm4sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzTG9uZzogYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2s6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuX190Y2ZhcGl1aSgnZ29Ub1BhZ2UnLCAxKSwgaCAmJiB3aW5kb3cucGFyZW50LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogSXQuQ09OU0VOVF9VSSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiBMdC5FTlRFUl9GVUxMU0NSRUVOCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgJyonKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiAnc2Vjb25kYXJ5JwogICAgICAgICAgICAgICAgICAgICAgICB9LCByLmluaXRTY3JlZW5TZXR0aW5nc0J1dHRvbiksIFFlLmEuY3JlYXRlRWxlbWVudChGbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNMb25nOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogbwogICAgICAgICAgICAgICAgICAgICAgICB9LCByLmFncmVlQnV0dG9uKSkgOiBRZS5hLmNyZWF0ZUVsZW1lbnQoUWUuYS5GcmFnbWVudCwgbnVsbCwgUWUuYS5jcmVhdGVFbGVtZW50KEZuLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0xvbmc6IGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNhYmxlZDogbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2s6IDMgPT09IHMgPyBhIDogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcDItaGlkZS1kZXNrdG9wJwogICAgICAgICAgICAgICAgICAgICAgICB9LCAzID09PSBzID8gci5zYXZlQW5kRXhpdEJ1dHRvbiA6IHIuYWdyZWVBbGxCdXR0b24pLCBRZS5hLmNyZWF0ZUVsZW1lbnQoRm4sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzTG9uZzogYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2s6IDMgPT09IHMgPyB5IDogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZGU6ICdzZWNvbmRhcnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi1oaWRlLWRlc2t0b3AnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIDMgPT09IHMgPyB0IDogci5hZ3JlZVRvU2VsZWN0ZWRCdXR0b24pLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1mb290ZXItbGlua3MnIH0sIFFlLmEuY3JlYXRlRWxlbWVudChGbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNMb25nOiBFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5fX3RjZmFwaXVpKCdnb1RvUGFnZScsIDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6ICdzbWFsbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IDIgPT09IHMgPyAncWMtY21wMi1saW5rLWFjdGl2ZScgOiAnJwogICAgICAgICAgICAgICAgICAgICAgICB9LCByLnB1cnBvc2VTY3JlZW5WZW5kb3JMaW5rKSwgUWUuYS5jcmVhdGVFbGVtZW50KEZuLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0xvbmc6IEUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkNsaWNrOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93Ll9fdGNmYXBpdWkoJ2dvVG9QYWdlJywgMyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTogJ3NtYWxsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogMyA9PT0gcyA/ICdxYy1jbXAyLWxpbmstYWN0aXZlJyA6ICcnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIubGVnaXRpbWF0ZUludGVyZXN0TGluaykpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1idXR0b25zLWRlc2t0b3AnIH0sIFFlLmEuY3JlYXRlRWxlbWVudChGbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNMb25nOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogMyA9PT0gcyA/IHkgOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kZTogJ3NlY29uZGFyeScKICAgICAgICAgICAgICAgICAgICAgICAgfSwgMyA9PT0gcyA/IHQgOiByLmFncmVlVG9TZWxlY3RlZEJ1dHRvbiksIFFlLmEuY3JlYXRlRWxlbWVudChGbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNMb25nOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzYWJsZWQ6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkNsaWNrOiAzID09PSBzID8gYSA6IG8KICAgICAgICAgICAgICAgICAgICAgICAgfSwgMyA9PT0gcyA/IHIuc2F2ZUFuZEV4aXRCdXR0b24gOiByLmFncmVlQWxsQnV0dG9uKSkpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtY21wMi1mb290ZXIgJy5jb25jYXQocCA/ICdxYy1jbXAyLWZvb3Rlci1vdmVybGF5JyA6ICcnLCAnICcpLmNvbmNhdChkID8gJ3FjLWNtcDItZm9vdGVyLXNjcm9sbGVkJyA6ICcnKSB9LCB2ICYmIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLWZvb3Rlci1wZXJtaXNpbycgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItaW5mby1pY29uJyB9KSwgUWUuYS5jcmVhdGVFbGVtZW50KCdwJywgeyBjbGFzc05hbWU6ICdxYy1jbXAyLWZvb3Rlci1wZXJtaXNpby13YXJuaW5nJyB9LCAnVG8gcmVjb3JkIHlvdXIgY2hvaWNlLCBwbGVhc2Ugbm90ZSB0aGF0IHlvdSB3aWxsIGJlIHRlbXBvcmFyaWx5IHJlZGlyZWN0ZWQgdG8nLCAnICcsIFFlLmEuY3JlYXRlRWxlbWVudCgnYScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhyZWY6ICdodHRwczovL3Blcm1pc2lvLmNvbS8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi1mb290ZXItcGVybWlzaW8tbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWw6ICdub29wZW5lciBub3JlZmVycmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldDogJ19ibGFuaycKICAgICAgICAgICAgICAgICAgICAgICAgfSwgJ3Blcm1pc2lvLmNvbScpKSksIG4pOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBKcigpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsnXG4gICYmIHtcbiAgICBkaXNwbGF5OiBpbmxpbmUtZmxleDtcbiAgICBtaW4td2lkdGg6IDA7XG4gICAgbWluLWhlaWdodDogMDtcbiAgICB0ZXh0LXRyYW5zZm9ybTogbm9uZTtcbiAgfVxuJ10pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBKciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUuR0xPQkFMID0gJ2dsb2JhbCcsIGUuU0VSVklDRSA9ICdzZXJ2aWNlJywgZS5HTE9CQUxfR1JPVVAgPSAnZ2xvYmFsIGdyb3VwJywgZS5TRVJWSUNFX0dST1VQID0gJ3NlcnZpY2UgZ3JvdXAnOwogICAgICAgICAgICAgICAgfShXciB8fCAoV3IgPSB7fSkpOwogICAgICAgICAgICAgICAgdmFyIFhyID0gT2JqZWN0KHZ0LmMpKEZuKShKcigpKSwgWnIgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA/IFFlLmEuY3JlYXRlRWxlbWVudChRZS5hLkZyYWdtZW50LCBudWxsLCBlLnNwbGl0KHQpLnJlZHVjZShmdW5jdGlvbiAoZSwgciwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gPyBlLmNvbmNhdChRZS5hLmNyZWF0ZUVsZW1lbnQoJ2EnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHJlZjogbi5jb25zZW50U2NvcGVHcm91cFVSTCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YXJnZXQ6ICdfYmxhbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbDogJ25vb3BlbmVyIG5vcmVmZXJyZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogdCArIHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQpLCByKSA6IFtyXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgW10pKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgfSwgZW8gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBvLmNvcmVDb25maWcuaXNBTVAgJiYgd2luZG93LnBhcmVudC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogSXQuQ09OU0VOVF9VSSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb246IEx0LkVOVEVSX0ZVTExTQ1JFRU4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICcqJyksIHdpbmRvdy5fX3RjZmFwaXVpKCdnb1RvUGFnZScsIDIpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA/IFFlLmEuY3JlYXRlRWxlbWVudChRZS5hLkZyYWdtZW50LCBudWxsLCBlLnNwbGl0KHQpLnJlZHVjZShmdW5jdGlvbiAoZSwgciwgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gPyBlLmNvbmNhdChRZS5hLmNyZWF0ZUVsZW1lbnQoWHIsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkNsaWNrOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IHQgKyByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KSwgcikgOiBbcl07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtdKSkgOiBlOwogICAgICAgICAgICAgICAgICAgIH0sIHRvID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgbnVsbCwgZS5zcGxpdCgnW1svXV0nKS5yZWR1Y2UoZnVuY3Rpb24gKGUsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNvbmNhdChubyhuLCB0LCByKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtdKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgbm8gPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gbmV3IFJlZ0V4cCgvXFtcWyguKj8pXF1cXS8pLCBvID0gbmV3IFJlZ0V4cCgvKCguKj8pKFs9QF0pP1x8KC4qPykpfCgoLio/KVwqKXwoXC8pLyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3AnLCB7IGtleTogJ3AtJyArIG4gfSwgZS5zcGxpdChyKS5yZWR1Y2UoZnVuY3Rpb24gKGUsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghciAmJiAhbi5tYXRjaChvKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuLnNwbGl0KCd8JyksIGEgPSBpWzBdLCBzID0gYS5zbGljZSgtMSksIGMgPSBhLnNsaWNlKDAsIGEubGVuZ3RoIC0gMSksIHUgPSBpWzFdLCBsID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnKicgPT09IHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IFFlLmEuY3JlYXRlRWxlbWVudCgnc3Ryb25nJywgeyBrZXk6IHIgfSwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgnPScgPT09IHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHUubWF0Y2gobmV3IFJlZ0V4cCgveyguKj8pfS8pKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHUuc2xpY2UoMSwgdS5sZW5ndGggLSAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZiAmJiB0W2ZdICYmIChsID0gUWUuYS5jcmVhdGVFbGVtZW50KCdhJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHJlZjogdFtmXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2EnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBocmVmOiB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdAJyA9PT0gcyAmJiAobCA9IFFlLmEuY3JlYXRlRWxlbWVudCgnYScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25DbGljazogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5fX3RjZmFwaXVpKCdnb1RvUGFnZScsIE51bWJlcih1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhyZWY6ICcjJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY29uY2F0KGwpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBbXSkpOwogICAgICAgICAgICAgICAgICAgIH0sIHJvID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuaW5jbHVkZXMoJ1ticmVha10nKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBlLnNwbGl0KCdbYnJlYWtdJyksIG8gPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmxlbmd0aCA+IDEgJiYgclsxXS5zcGxpdCgnPGJyPicpLmZvckVhY2goZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLnB1c2goUWUuYS5jcmVhdGVFbGVtZW50KCdwJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhbmdlcm91c2x5U2V0SW5uZXJIVE1MOiB7IF9faHRtbDogZSB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIFtRZS5hLmNyZWF0ZUVsZW1lbnQoJ3AnLCB7IGtleTogLTEgfSwgZW8oclswXSwgdCkpXS5jb25jYXQobyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsga2V5OiAtMSB9LCB0byhlLCBuKSldOwogICAgICAgICAgICAgICAgICAgIH0sIG9vID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5PREVfRU5WOiAncHJvZHVjdGlvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBQVUJMSUNfVVJMOiAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9MT0dfQVBJOiAnaHR0cHM6Ly9hdWRpdC10Y2Z2Mi5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfR0VPSVBfQVBJX1VSTDogJ2h0dHBzOi8vYXBpcy5xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9nZW9pcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfQ01QX0NPT0tJRV9BUEk6ICdodHRwczovL2FwaXMucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcvQ29va2llQWNjZXNzVjInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgUkVBQ1RfQVBQX0dPT0dMRV9BVFBfVVJMOiAnaHR0cHM6Ly9xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy90Y2Z2Mi9nb29nbGUtYXRwLWxpc3QuanNvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfQ09OU0VOVEVEX0lERU5USVRZX1dFQlNJVEVfQVBJOiAnaHR0cHM6Ly9hcHAucGVybWlzaW8uY29tL2FwaScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfVkVSU0lPTjogJzIzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9DTVBVSV9TUkM6ICdodHRwczovL3F1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL3RjZnYyLzIzL2NtcDJ1aS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUFDVF9BUFBfR1ZMX0JBU0VfVVJMOiAnaHR0cHM6Ly9xdWFudGNhc3QubWdyLmNvbnNlbnN1Lm9yZy9HVkwtdjIvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJFQUNUX0FQUF9UUkFOU0xBVElPTl9CQVNFX1VSTDogJ2h0dHBzOi8vd3d3LnF1YW50Y2FzdC5tZ3IuY29uc2Vuc3Uub3JnL3RjZnYyL3RyYW5zbGF0aW9ucy8nCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLlJFQUNUX0FQUF9ERUJVRyAmJiBjb25zb2xlLmxvZygnRGVidWc6ICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICB9LCBpbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5hY2NlcHRBbGxGdW5jdGlvbiwgbiA9IGUucmVqZWN0QWxsRnVuY3Rpb24sIHIgPSBlLmNvcmVVaUxhYmVscywgbyA9IGUucHJlbWl1bVVpTGFiZWxzLCBpID0gZS5pc1BvcHVwLCBzID0gZS5ub25JYWJEYXRhLCBjID0gZS5wYWdlLCB1ID0gZS5hY2NlcHRTZWxlY3RlZCwgbCA9IGUudmVuZG9yc0RhdGEsIGYgPSBlLnNldEFsbExlZ2l0aW1hdGVzVG8sIHAgPSBlLnNob3dSZWplY3RCdXR0b24sIGQgPSBlLmdvb2dsZVZlbmRvcnMsIGggPSBlLmlzQW1wLCBtID0gbHQoKSwgZyA9IG10KE9iamVjdChZZS51c2VTdGF0ZSkoITEpLCAyKSwgdiA9IGdbMF0sIHkgPSBnWzFdLCBiID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuY3VycmVudFRhcmdldC5wYXJlbnROb2RlLCBvID0geHQuRVhQQU5EX0VMRU1FTlQsIGkgPSB4dC5DT0xMQVBTRV9FTEVNRU5UOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uY2xhc3NMaXN0LmNvbnRhaW5zKCdxYy1jbXAyLWV4cGFuZGVkJykgPyBrby5ldmVudFRyYWNrZXIoaSwgdCkgOiBrby5ldmVudFRyYWNrZXIobywgdCksIG4uY2xhc3NMaXN0LnRvZ2dsZSgncWMtY21wMi1leHBhbmRlZCcpLCBlLmN1cnJlbnRUYXJnZXQuaW5uZXJIVE1MID09PSByLnNob3dQYXJ0bmVycyA/IGUuY3VycmVudFRhcmdldC5pbm5lckhUTUwgPSByLmhpZGVQYXJ0bmVycyA6IGUuY3VycmVudFRhcmdldC5pbm5lckhUTUwgPT09IHIuaGlkZVBhcnRuZXJzICYmIChlLmN1cnJlbnRUYXJnZXQuaW5uZXJIVE1MID0gci5zaG93UGFydG5lcnMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRSA9IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlLmluaXRTY3JlZW5Cb2R5VGV4dE9wdGlvbiwgaSA9IHQuY3VzdG9tSW5pdFNjcmVlbkJvZHlUZXh0LCBzID0gdC5jdXN0b21TZWNvbmRTY3JlZW5Cb2R5VGV4dCwgYyA9IHQuY3VzdG9tVmVuZG9yU2NyZWVuQm9keVRleHQsIHUgPSB0LmN1c3RvbUxlZ2l0aW1hdGVTY3JlZW5Cb2R5VGV4dCwgbCA9ICcnLCBmID0gITEsIHAgPSBlLmNvbnNlbnRTY29wZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkLCBoID0gNCA9PT0gbyAmJiBpLCBtID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IHJvKGksIHQucHVycG9zZVNjcmVlblZlbmRvckxpbmsudG9Mb3dlckNhc2UoKSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgV3IuU0VSVklDRToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gdC5zdW1tYXJ5U2NyZWVuQm9keVJlamVjdFNlcnZpY2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdyLkdMT0JBTDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gdC5zdW1tYXJ5U2NyZWVuQm9keVJlamVjdEdsb2JhbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbSA9ICEwLCBkID0gdC5zdW1tYXJ5U2NyZWVuQm9keVJlamVjdEdyb3VwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgV3IuU0VSVklDRToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gdC5zdW1tYXJ5U2NyZWVuQm9keU5vUmVqZWN0U2VydmljZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgV3IuR0xPQkFMOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSB0LnN1bW1hcnlTY3JlZW5Cb2R5Tm9SZWplY3RHbG9iYWw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gPSAhMCwgZCA9IHQuc3VtbWFyeVNjcmVlbkJvZHlOb1JlamVjdEdyb3VwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbSAmJiAoZCA9IFtdLmNvbmNhdChhKGQpLCBbWnIoZFsxXSwgdC5ncm91cE9mU2l0ZXNMYWJlbCwgZSldKSksIGggfHwgKGQgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbyhkWzBdLCB0LnB1cnBvc2VTY3JlZW5WZW5kb3JMaW5rLnRvTG93ZXJDYXNlKCkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keVRleHQ6IGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0N1c3RvbWl6ZWQ6ICEhaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDQgPT09IG8gJiYgcyA/IChsID0gcm8ocywgdC5wdXJwb3NlU2NyZWVuVmVuZG9yTGluay50b0xvd2VyQ2FzZSgpLCBlKSwgZiA9ICEwKSA6IGwgPSBwID09PSBXci5TRVJWSUNFID8gdC5pbml0U2NyZWVuQm9keVNlcnZpY2UgfHwgJycgOiBwID09PSBXci5HTE9CQUwgPyB0LmluaXRTY3JlZW5Cb2R5R2xvYmFsIHx8ICcnIDogdC5pbml0U2NyZWVuQm9keUdyb3VwIHx8ICcnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5VGV4dDogbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQ3VzdG9taXplZDogZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDQgPT09IG8gJiYgYyA/IChsID0gcm8oYywgdC5wdXJwb3NlU2NyZWVuVmVuZG9yTGluay50b0xvd2VyQ2FzZSgpLCBlKSwgZiA9ICEwKSA6IGwgPSB0LnZlbmRvclNjcmVlbkJvZHkgfHwgJycsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHlUZXh0OiBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNDdXN0b21pemVkOiBmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gNCA9PT0gbyAmJiB1ID8gKGwgPSBybyh1LCB0LnB1cnBvc2VTY3JlZW5WZW5kb3JMaW5rLnRvTG93ZXJDYXNlKCksIGUpLCBmID0gITApIDogbCA9IHQubGVnaXRpbWF0ZVNjcmVlbkJvZHkgfHwgJycsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHlUZXh0OiBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNDdXN0b21pemVkOiBmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHlUZXh0OiBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNDdXN0b21pemVkOiBmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfShQby5jb3JlQ29uZmlnLCByLCBwLCBjKSwgdyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZS50YXJnZXQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnRhcmdldDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zY3JvbGxIZWlnaHQgLSB0LnNjcm9sbFRvcCA9PT0gdC5jbGllbnRIZWlnaHQgPyB5KCEwKSA6IHYgJiYgeSghMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChZZS51c2VFZmZlY3QpKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCcucWMtY21wMi1zdW1tYXJ5LWluZm8nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNjcm9sbEhlaWdodCAtIGUuc2Nyb2xsVG9wID09PSBlLmNsaWVudEhlaWdodCA/IHkoITApIDogdiAmJiB5KCExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgW10pLCBRZS5hLmNyZWF0ZUVsZW1lbnQoQXQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzUG9wdXA6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ3FjLWNtcDItdWknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlckNvbG9yOiBfby5ib3JkZXJDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpZ2h0ZXN0VGV4dENvbG9yOiBfby5saWdodGVzdFRleHRDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV4QmFja2dyb3VuZENvbG9yOiBfby51eEJhY2tncm91bmRDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV4UHJpbWFyeUJ1dHRvbkNvbG9yOiBfby51eFByaW1hcnlCdXR0b25Db2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV4Rm9udENvbG9yOiBfby51eEZvbnRDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV4TGlua0NvbG9yOiBfby51eExpbmtDb2xvciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdhcm5pbmdUZXh0Q29sb3I6IF9vLndhcm5pbmdUZXh0Q29sb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3YXJuaW5nQmFja2dyb3VuZENvbG9yOiBfby53YXJuaW5nQmFja2dyb3VuZENvbG9yLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNJRTogVW4oKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXNMb2dvOiAnJyAhPT0gUG8uY29yZUNvbmZpZy5wdWJsaXNoZXJMb2dvCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGtvLmdldERpc3BsYXlUeXBlKCkgIT09IFN0Lk1BTkRBVE9SWSAmJiAwICE9PSBjICYmIFFlLmEuY3JlYXRlRWxlbWVudCgnYnV0dG9uJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtY21wMi1jbG9zZS1pY29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2s6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtKFdvKHsgcmVndWxhdGlvbjogJ0dEUFInIH0pKSwga28uZXZlbnRUcmFja2VyKHh0LkRJU01JU1NfVUksICdjbGljaycpLCBUby5zZW5kRG9uZUxvZyh2b2lkIDAsICcnLCAnJyksIGtvLm5vdGlmeVVpQ2xvc2VkKCdHRFBSJyksIGggJiYgd2luZG93LnBhcmVudC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IEl0LkNPTlNFTlRfUkVTUE9OU0UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbjogTHQuRElTTUlTUwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICcqJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IFFlLmEuY3JlYXRlRWxlbWVudChRciwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlVWlMYWJlbHM6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2U6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHlDb250ZW50OiBFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVTY3JvbGw6IDAgPT09IGMgPyB3IDogdm9pZCAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0Rlc2t0b3A6IHdpbmRvdy5zY3JlZW4ud2lkdGggPiA3NjcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQW1wOiBoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KEtyLCBPYmplY3QuYXNzaWduKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjY2VwdEFsbEZ1bmN0aW9uOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWNjZXB0U2VsZWN0ZWQ6IHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlVWlMYWJlbHM6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiBjCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFFlLmEuY3JlYXRlRWxlbWVudChWciwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlVWlMYWJlbHM6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZW1pdW1VaUxhYmVsczogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yc0RhdGE6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYkRhdGE6IHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjY2VwdEFsbEZ1bmN0aW9uOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY2NlcHRTZWxlY3RlZDogdSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlQ2xpY2s6IGIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2U6IGMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLCBRZS5hLmNyZWF0ZUVsZW1lbnQoaSwgbnVsbCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvbygnVmVuZG9ycyByZW5kZXJlZDogJy5jb25jYXQoT2JqZWN0LmtleXMobC52ZW5kb3JzKS5sZW5ndGgpKSwgUWUuYS5jcmVhdGVFbGVtZW50KEJyLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcmVVaUxhYmVsczogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlbWl1bVVpTGFiZWxzOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JzRGF0YTogbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiRGF0YTogcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWNjZXB0QWxsRnVuY3Rpb246IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjY2VwdFNlbGVjdGVkOiB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVDbGljazogYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ29vZ2xlVmVuZG9yczogZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUsIFFlLmEuY3JlYXRlRWxlbWVudChpLCBudWxsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9vKCdWZW5kb3JzIHJlbmRlcmVkOiAnLmNvbmNhdChPYmplY3Qua2V5cyhsLnZlbmRvcnMpLmxlbmd0aCkpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoa3IsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZVVpTGFiZWxzOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVtaXVtVWlMYWJlbHM6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvcnNEYXRhOiBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY2NlcHRBbGxGdW5jdGlvbjogdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWNjZXB0U2VsZWN0ZWQ6IHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZUNsaWNrOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRBbGxMZWdpdGltYXRlc1RvOiBmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25JYWJEYXRhOiBzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSwgUWUuYS5jcmVhdGVFbGVtZW50KGksIHsgc2V0QWxsTGVnaXRpbWF0ZXNUbzogZiB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoUWUuYS5GcmFnbWVudCwgbnVsbCwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ3FjLWNtcDItc3VtbWFyeS1zZWN0aW9uJyB9LCBlKSwgUWUuYS5jcmVhdGVFbGVtZW50KGksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVqZWN0QWxsRnVuY3Rpb246IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNob3dSZWplY3RCdXR0b246IHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNob3dPdmVybGF5OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNTY3JvbGxlZDogdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNBbXA6IGgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0oKSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGFvKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZ3QoWydcbiAgICAgICAgICBhbGlnbi1pdGVtczogZmxleC1lbmQ7XG4gICAgICAgICddKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYW8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBzbygpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuICAmJiB7XG4gICAgYmFja2dyb3VuZC1jb2xvcjogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gICAgaGVpZ2h0OiAnLAogICAgICAgICAgICAgICAgICAgICAgICAncHg7XG4gICAgd2lkdGg6IDEwMHZ3O1xuICAgIG92ZXJmbG93OiBoaWRkZW47XG4gICAgY29sb3I6ICcsCiAgICAgICAgICAgICAgICAgICAgICAgICc7XG4gICAgcG9zaXRpb246IGZpeGVkO1xuICAgIHRvcDogMDtcbiAgICBsZWZ0OiAwO1xuICAgIHotaW5kZXg6IDk5OTk5OTk5OTk5OTk5O1xuXG4gICAgKiB7XG4gICAgICBmb250LWZhbWlseTogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgIG1hcmdpbjogMDtcbiAgICAgIHBhZGRpbmc6IDA7XG4gICAgICBib3gtc2l6aW5nOiBib3JkZXItYm94O1xuICAgICAgbGluZS1oZWlnaHQ6IDE7XG4gICAgfVxuXG4gICAgQG1lZGlhIChtaW4td2lkdGg6IDc2OHB4KSB7XG4gICAgICAnLAogICAgICAgICAgICAgICAgICAgICAgICAnXG4gICAgfVxuICB9XG4nCiAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGNvID0gdnQuYy5kaXYoc28oKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLm92ZXJsYXlDb2xvciwgbiA9IGUuaXNBTVAsIHIgPSBlLnBhZ2U7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICYmIDAgPT09IHIgPyAnbm9uZScgOiB0OwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmhlaWdodDsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS51eEZvbnRDb2xvcjsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5mb250OwogICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5pc1BvcHVwLCBuID0gZS5wYWdlOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXQgJiYgMCA9PT0gbiAmJiBPYmplY3QodnQuYikoYW8oKSk7CiAgICAgICAgICAgICAgICAgICAgfSksIHVvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmlzUG9wdXAsIG4gPSBlLmNsYXNzTmFtZSwgciA9IGUuaXNPcGVuLCBvID0gZS5wYWdlLCBpID0gZS5jaGlsZHJlbiwgYSA9IGUuaXNBTVAsIHMgPSBtdChPYmplY3QoWWUudXNlU3RhdGUpKHdpbmRvdy5pbm5lckhlaWdodCksIDIpLCBjID0gc1swXSwgdSA9IHNbMV07CiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdChZZS51c2VFZmZlY3QpKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigncmVzaXplJywgbCksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cucmVtb3ZlRXZlbnRMaXN0ZW5lcigncmVzaXplJywgbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1KHdpbmRvdy5pbm5lckhlaWdodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQoUWUuYS5GcmFnbWVudCwgbnVsbCwgciAmJiBRZS5hLmNyZWF0ZUVsZW1lbnQoY28sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzUG9wdXA6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcmxheUNvbG9yOiBfby5vdmVybGF5Q29sb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1eEZvbnRDb2xvcjogX28udXhGb250Q29sb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb250OiBfby5mb250LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNBTVA6IGEKICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSkpOwogICAgICAgICAgICAgICAgICAgIH0sIGxvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmNvcmVDb25maWcsIG4gPSBlLmNvcmVVaUxhYmVscywgciA9IGUucHJlbWl1bVVpTGFiZWxzLCBvID0gZS5ub25JYWJEYXRhLCBpID0gZS52ZW5kb3JzRGF0YSwgYSA9IGUuY29uc2VudEdyb3VwSGFuZGxlciwgcyA9IGUuZXZlbnRUcmFja2VyLCBjID0gZS5zZXRBbGxMZWdpdGltYXRlc1RvLCB1ID0gZS5nb29nbGVWZW5kb3JzLCBsID0gd2luZG93LmlubmVyV2lkdGggPD0gNzY4IHx8IGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5jbGllbnRXaWR0aCA8PSA3NjggfHwgZG9jdW1lbnQuYm9keS5jbGllbnRXaWR0aCA8IDc2OCwgZiA9IGh0KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwLnBhZ2VHRFBSOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHAgPSBodChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmFwcC5kaXNwbGF5R0RQUjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBkID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09PSB0eXBlb2YgZiAmJiAoZCA9IGYpLCBRZS5hLmNyZWF0ZUVsZW1lbnQodW8sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzUG9wdXA6ICdwb3B1cCcgPT09IHQudWlMYXlvdXQgfHwgbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzT3BlbjogcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcC1jbGVhbnNsYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2U6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0FNUDogdC5pc0FNUAogICAgICAgICAgICAgICAgICAgICAgICB9LCBwICYmIFFlLmEuY3JlYXRlRWxlbWVudChpbywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yZVVpTGFiZWxzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNQb3B1cDogJ3BvcHVwJyA9PT0gdC51aUxheW91dCB8fCBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uSWFiRGF0YTogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvcnNEYXRhOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRUcmFja2VyOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWNjZXB0QWxsRnVuY3Rpb246IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKGQsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY2NlcHRTZWxlY3RlZDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVqZWN0QWxsRnVuY3Rpb246IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKGQsICExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiBmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0QWxsTGVnaXRpbWF0ZXNUbzogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNob3dSZWplY3RCdXR0b246IHQuaW5pdFNjcmVlblJlamVjdEJ1dHRvblNob3dpbmcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVtaXVtVWlMYWJlbHM6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnb29nbGVWZW5kb3JzOiB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNBbXA6IHQuaXNBTVAKICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBmbygpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGd0KFsKICAgICAgICAgICAgICAgICAgICAgICAgJ1xuICAmJiB7XG4gICAgbWF4LXdpZHRoOiA3NzBweDtcbiAgICB3aWR0aDogMTAwJTtcbiAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgYmFja2dyb3VuZDogI2ZmZjtcblxuICAgIC5xYy11c3AtdWktY29udGVudCB7XG4gICAgICBkaXNwbGF5OiBmbGV4O1xuICAgICAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjtcbiAgICAgIG1hcmdpbjogYXV0bztcbiAgICAgIG1heC13aWR0aDogNjYwcHg7XG4gICAgICBwYWRkaW5nOiA2MHB4IDMwcHggMzBweDtcblxuICAgICAgLnFjLXVzcC11aS1mb3JtLWNvbnRlbnQge1xuICAgICAgICBtYXJnaW46IGF1dG87XG4gICAgICAgIG1heC13aWR0aDogNjAwcHg7XG4gICAgICAgIHBhZGRpbmc6IDEwcHggMTBweCAxNXB4O1xuICAgICAgICBib3JkZXI6IDFweCBzb2xpZCAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuXG4gICAgICAgID4gYnV0dG9uIHtcbiAgICAgICAgICBtYXJnaW4tdG9wOiAxNXB4O1xuICAgICAgICAgIGZvbnQtc2l6ZTogMTRweDtcbiAgICAgICAgICB3aWR0aDogMTQwcHg7XG4gICAgICAgICAgaGVpZ2h0OiAzMHB4O1xuICAgICAgICB9XG5cbiAgICAgICAgLnFjLXVzcC1jb250YWluZXIge1xuICAgICAgICAgIGJvcmRlcjogbm9uZTtcbiAgICAgICAgICBtYXJnaW46IDA7XG5cbiAgICAgICAgICAucWMtdXNwLWNvbnRhaW5lci1yb3cge1xuICAgICAgICAgICAgYm9yZGVyOiBub25lO1xuICAgICAgICAgICAgcGFkZGluZzogMDtcbiAgICAgICAgICAgIGZvbnQtc2l6ZTogMTRweDtcbiAgICAgICAgICAgIHdpZHRoOiAxMDAlO1xuICAgICAgICAgICAgZm9udC13ZWlnaHQ6IDEwMDtcbiAgICAgICAgICAgIGxpbmUtaGVpZ2h0OiAyMHB4O1xuXG4gICAgICAgICAgICAucWMtdXNwLXB1cnBvc2UtaW5mbyB7XG4gICAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgICAgICAgICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5cbiAgICAgICAgICAgICAgLnFjLXVzcC10b29nbGUge1xuICAgICAgICAgICAgICAgIG1hcmdpbi1sZWZ0OiAwcHg7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAucWMtdXNwLWFjdGlvbi1kZXNjcmlwdGlvbiB7XG4gICAgICAgICAgICAgICAgbWFyZ2luLWxlZnQ6IDE1cHg7XG4gICAgICAgICAgICAgICAgd2lkdGg6IGNhbGMoMTAwJSAtIDUwcHgpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC5xYy11c3AtdGl0bGUge1xuICAgICAgICBjb2xvcjogJywKICAgICAgICAgICAgICAgICAgICAgICAgJztcbiAgICAgICAgZm9udC13ZWlnaHQ6IDYwMDtcbiAgICAgIH1cblxuICAgICAgLnFjLXVzcC1tYWluLW1lc3NhZ2luZyB7XG4gICAgICAgIGNvbG9yOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICBmb250LXNpemU6IDE0cHg7XG4gICAgICAgIGxpbmUtaGVpZ2h0OiAyMHB4O1xuICAgICAgICBtYXgtaGVpZ2h0OiAyMDBweDtcbiAgICAgICAgcGFkZGluZzogMTVweCAwO1xuICAgICAgICBtYXJnaW46IDE1cHggMDtcbiAgICAgICAgb3ZlcmZsb3c6IGF1dG87XG5cbiAgICAgICAgcDpmaXJzdC1vZi10eXBlIHtcbiAgICAgICAgICBtYXJnaW4tYm90dG9tOiAxNXB4O1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgLnFjLXVzcC1hbHQtYnV0dG9ucyB7XG4gICAgICBtYXJnaW46IDAgYXV0bztcbiAgICAgIHBhZGRpbmctYm90dG9tOiA2MHB4O1xuICAgICAgdGV4dC1hbGlnbjogY2VudGVyO1xuXG4gICAgICAucWMtdXNwLWFsdC1hY3Rpb24ge1xuICAgICAgICBjdXJzb3I6IHBvaW50ZXI7XG4gICAgICAgIGNvbG9yOiAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICBmb250LXNpemU6IDE0cHg7XG4gICAgICAgIHRleHQtYWxpZ246IGNlbnRlcjtcblxuICAgICAgICAmLnFjLXVzcC1jZW50ZXItYm90dG9tIHtcbiAgICAgICAgICBkaXNwbGF5OiBpbmxpbmU7XG4gICAgICAgICAgcGFkZGluZzogMCAxNXB4O1xuICAgICAgICAgIHRleHQtZGVjb3JhdGlvbjogbm9uZTtcblxuICAgICAgICAgICYgKyAucWMtdXNwLWNlbnRlci1ib3R0b20ge1xuICAgICAgICAgICAgYm9yZGVyLWxlZnQ6IDFweCBzb2xpZCAnLAogICAgICAgICAgICAgICAgICAgICAgICAnO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIC5xYy11c3AtY2xvc2UtaWNvbiB7XG4gICAgICBiYWNrZ3JvdW5kOiB1cmwoImRhdGE6aW1hZ2Uvc3ZnK3htbDtjaGFyc2V0PXV0Zi04LCUzQ3N2ZyB4bWxucz1cJ2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnXCcgd2lkdGg9XCcyNFwnIGhlaWdodD1cJzI0XCclM0UlM0NwYXRoIGQ9XCdNLjUuNWwyMyAyM20wLTIzbC0yMyAyM1wnIGZpbGw9XCdub25lXCcgc3Ryb2tlPVwnJTIzMDAwXCcgc3Ryb2tlLWxpbmVjYXA9XCdyb3VuZFwnIHN0cm9rZS1saW5lam9pbj1cJ3JvdW5kXCcgc3Ryb2tlLW1pdGVybGltaXQ9XCcxMFwnLyUzRSUzQ3BhdGggZmlsbD1cJ25vbmVcJyBkPVwnTTAgMGgyNHYyNEgwelwnLyUzRSUzQy9zdmclM0UiKVxuICAgICAgICBuby1yZXBlYXQ7XG4gICAgICBiYWNrZ3JvdW5kLXNpemU6IDY1JTtcbiAgICAgIGJvcmRlcjogbm9uZTtcbiAgICAgIGhlaWdodDogMzhweDtcbiAgICAgIG1hcmdpbjogYXV0byAwO1xuICAgICAgd2lkdGg6IDM4cHg7XG4gICAgICByaWdodDogMjBweDtcbiAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICAgIHRvcDogMjBweDtcbiAgICB9XG5cbiAgICBAbWVkaWEgKG1pbi13aWR0aDogNzY4cHgpIHtcbiAgICAgIC5xYy11c3AtdWktY29udGVudCB7XG4gICAgICAgIC5xYy11c3AtdWktZm9ybS1jb250ZW50IHtcbiAgICAgICAgICAucWMtdXNwLWNvbnRhaW5lciB7XG4gICAgICAgICAgICAucWMtdXNwLWNvbnRhaW5lci1yb3cge1xuICAgICAgICAgICAgICAucWMtdXNwLXB1cnBvc2UtaW5mbyB7XG4gICAgICAgICAgICAgICAgLnFjLXVzcC10b29nbGUge1xuICAgICAgICAgICAgICAgICAgbWFyZ2luLWxlZnQ6IDNweDtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAucWMtdXNwLWFjdGlvbi1kZXNjcmlwdGlvbiB7XG4gICAgICAgICAgICAgICAgICBtYXJnaW4tbGVmdDogMTVweDtcbiAgICAgICAgICAgICAgICAgIHdpZHRoOiBjYWxjKDEwMCUgLSA3NXB4KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG4gIH1cbicKICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZm8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgcG8gPSB2dC5jLmRpdihmbygpLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5ib3JkZXJDb2xvcjsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdWJIZWFkZXJDb2xvcjsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS51eEZvbnRDb2xvcjsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS51eFByaW1hcnlCdXR0b25Db2xvcjsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5ib3JkZXJDb2xvcjsKICAgICAgICAgICAgICAgICAgICB9KSwgaG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucHJlbWl1bVVpTGFiZWxzLCBuID0gZS5jb3JlQ29uZmlnLCByID0gZS5jbG9zZSwgbyA9IGUuZXZlbnRUcmFja2VyLCBpID0gbXQoT2JqZWN0KFllLnVzZVN0YXRlKSghMSksIDIpLCBhID0gaVswXSwgcyA9IGlbMV0sIGMgPSBtdChPYmplY3QoWWUudXNlU3RhdGUpKHsgdXNwU3RyaW5nOiAnJyB9KSwgMiksIHUgPSBjWzBdLCBsID0gY1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0KFllLnVzZUxheW91dEVmZmVjdCkoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93Ll9fdXNwYXBpKCdnZXRVU1BEYXRhJywgMSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzKGUgJiYgJ1knID09PSBlLnVzcFN0cmluZ1syXSksIGwoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgW10pOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KHBvLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByb2xlOiAnZGlhbG9nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcmlhLWxhYmVsbGVkYnknOiAncWMtdXNwLXRpdGxlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcmlhLW1vZGFsJzogJ3RydWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFiSW5kZXg6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJDb2xvcjogX28uYm9yZGVyQ29sb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJIZWFkZXJDb2xvcjogX28uc3ViSGVhZGVyQ29sb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1eEZvbnRDb2xvcjogX28udXhGb250Q29sb3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1eFByaW1hcnlCdXR0b25Db2xvcjogX28udXhQcmltYXJ5QnV0dG9uQ29sb3IKICAgICAgICAgICAgICAgICAgICAgICAgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdidXR0b24nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWJJbmRleDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcmlhLWxhYmVsJzogJ0Nsb3NlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcmlhLXByZXNzZWQnOiAnZmFsc2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lOiAncWMtdXNwLWNsb3NlLWljb24gJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2s6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIoKSwgbyh4dC5ESVNNSVNTX1VJLCAnY2xpY2snKSwgdm9pZCBUby5zZW5kRG9uZUxvZ1VzcChfdC5BQ0NFUFRfUEFSVElBTCwgdS51c3BTdHJpbmcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ3FjLXVzcC11aS1jb250ZW50JyB9LCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3AnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ3FjLXVzcC10aXRsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6ICdxYy11c3AtdGl0bGUnCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4ucHVibGlzaGVyTmFtZSAmJiAnJy5jb25jYXQobi5wdWJsaXNoZXJOYW1lLCAnIC0gJyksIHQudXNwRG5zVGl0bGUpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLXVzcC1tYWluLW1lc3NhZ2luZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWJJbmRleDogMAogICAgICAgICAgICAgICAgICAgICAgICB9LCB0LnVzcERuc1RleHQubWFwKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhbmdlcm91c2x5U2V0SW5uZXJIVE1MOiB7IF9faHRtbDogZSB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2RpdicsIHsgY2xhc3NOYW1lOiAncWMtdXNwLXVpLWZvcm0tY29udGVudCcgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ3FjLXVzcC1jb250YWluZXInIH0sIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgeyBjbGFzc05hbWU6ICdxYy11c3AtY29udGFpbmVyLXJvdycgfSwgUWUuYS5jcmVhdGVFbGVtZW50KCdkaXYnLCB7IGNsYXNzTmFtZTogJ3FjLXVzcC1wdXJwb3NlLWluZm8nIH0sIFFlLmEuY3JlYXRlRWxlbWVudCgkdCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb246IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6ICdxYy11c3AtdG9vZ2xlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2s6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKHh0Lk9QVF9PVVRfVE9HR0xFLCBTdHJpbmcoIWEpKSwgcyghYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ3AnLCB7IGNsYXNzTmFtZTogJ3FjLXVzcC1hY3Rpb24tZGVzY3JpcHRpb24nIH0sIHQudXNwRG9Ob3RTZWxsVG9nZ2xlVGV4dCkpKSksIFFlLmEuY3JlYXRlRWxlbWVudChGbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FyaWEtbGFiZWwnOiAnQWNjZXB0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhcmlhLXByZXNzZWQnOiAnZmFsc2UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZTogJ2xhcmdlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2s6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oeHQuT1BUX09VVF9DT05GSVJNLCBTdHJpbmcoYSkpLCB3aW5kb3cuX191c3BhcGkoJ3NldFVzcERhdGEnLCAxLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUby5zZW5kRG9uZUxvZ1VzcChhID8gX3QuUkVKRUNUIDogX3QuQUNDRVBUX0FMTCwgZS51c3BTdHJpbmcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEpLCB2b2lkIHIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC51c3BBY2NlcHRCdXR0b24pKSksIFFlLmEuY3JlYXRlRWxlbWVudCgnZGl2JywgeyBjbGFzc05hbWU6ICdxYy11c3AtYWx0LWJ1dHRvbnMnIH0sICFuLnN1cHByZXNzQ2NwYUxpbmtzICYmIFFlLmEuY3JlYXRlRWxlbWVudChRZS5hLkZyYWdtZW50LCBudWxsLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2EnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWJJbmRleDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAncWMtdXNwLWRlbGV0ZS1saW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLXVzcC1hbHQtYWN0aW9uIHFjLXVzcC1jZW50ZXItYm90dG9tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhyZWY6IG4udXNwRGVsZXRlRGF0YUxpbmssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ1JlYWQgTW9yZSBhYm91dCB0aGUgRGF0YSBEZWxldGlvbiBQb2xpY3knCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQudXNwRGVsZXRlRGF0YUxpbmtUZXh0KSwgUWUuYS5jcmVhdGVFbGVtZW50KCdhJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFiSW5kZXg6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ3FjLXVzcC1hY2Nlc3MtbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGFzc05hbWU6ICdxYy11c3AtYWx0LWFjdGlvbiBxYy11c3AtY2VudGVyLWJvdHRvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBocmVmOiBuLnVzcEFjY2Vzc0RhdGFMaW5rLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICdSZWFkIE1vcmUgYWJvdXQgdGhlIERhdGEgQWNjZXNzIFBvbGljeScKICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC51c3BBY2Nlc3NEYXRhTGlua1RleHQpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoJ2EnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWJJbmRleDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAncWMtdXNwLXBvbGljeS1saW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLXVzcC1hbHQtYWN0aW9uIHFjLXVzcC1jZW50ZXItYm90dG9tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhyZWY6IG4udXNwUHJpdmFjeVBvbGljeUxpbmssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ1JlYWQgTW9yZSBhYm91dCB0aGUgUHJpdmFjeSBQb2xpY3knCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQudXNwUHJpdmFjeVBvbGljeUxpbmtUZXh0KSkpKTsKICAgICAgICAgICAgICAgICAgICB9LCBtbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jb3JlQ29uZmlnLCBuID0gZS5wcmVtaXVtVWlMYWJlbHMsIHIgPSBlLmV2ZW50VHJhY2tlciwgbyA9IGh0KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwLmRpc3BsYXlVU1A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaSA9IGx0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBRZS5hLmNyZWF0ZUVsZW1lbnQodW8sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzTmFtZTogJ3FjLWNtcC1jbGVhbnNsYXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzUG9wdXA6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNPcGVuOiBvCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8gJiYgUWUuYS5jcmVhdGVFbGVtZW50KGhvLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlQ29uZmlnOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlbWl1bVVpTGFiZWxzOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRUcmFja2VyOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xvc2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKFdvKHsgcmVndWxhdGlvbjogJ1VTUCcgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGdvKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gZ3QoWydcbi8qIFRoaXMgaXMgYSBjdXN0b21pemVkIHZlcnNpb24gb2YgY2xlYXNsYXRlLiBGb3IgbW9yZSBpbmZvIGdvIGhlcmU6IGh0dHA6Ly9jbGVhbnNsYXRlY3NzLmNvbS8gKi9cbiAgLnFjLWNtcC1jbGVhbnNsYXRlLCAucWMtY21wLWNsZWFuc2xhdGUgaDEsIC5xYy1jbXAtY2xlYW5zbGF0ZSBoMiwgLnFjLWNtcC1jbGVhbnNsYXRlIGgzLCAucWMtY21wLWNsZWFuc2xhdGUgaDQsIC5xYy1jbXAtY2xlYW5zbGF0ZSBoNSwgLnFjLWNtcC1jbGVhbnNsYXRlIGg2LCAucWMtY21wLWNsZWFuc2xhdGUgcCwgLnFjLWNtcC1jbGVhbnNsYXRlIHRkLCAucWMtY21wLWNsZWFuc2xhdGUgZGwsIC5xYy1jbXAtY2xlYW5zbGF0ZSB0ciwgLnFjLWNtcC1jbGVhbnNsYXRlIGR0LCAucWMtY21wLWNsZWFuc2xhdGUgb2wsIC5xYy1jbXAtY2xlYW5zbGF0ZSBmb3JtLCAucWMtY21wLWNsZWFuc2xhdGUgc2VsZWN0LCAucWMtY21wLWNsZWFuc2xhdGUgb3B0aW9uLCAucWMtY21wLWNsZWFuc2xhdGUgcHJlLCAucWMtY21wLWNsZWFuc2xhdGUgZGl2LCAucWMtY21wLWNsZWFuc2xhdGUgdGFibGUsICAucWMtY21wLWNsZWFuc2xhdGUgdGgsIC5xYy1jbXAtY2xlYW5zbGF0ZSB0Ym9keSwgLnFjLWNtcC1jbGVhbnNsYXRlIHRmb290LCAucWMtY21wLWNsZWFuc2xhdGUgY2FwdGlvbiwgLnFjLWNtcC1jbGVhbnNsYXRlIHRoZWFkLCAucWMtY21wLWNsZWFuc2xhdGUgdWwsIC5xYy1jbXAtY2xlYW5zbGF0ZSBsaSwgLnFjLWNtcC1jbGVhbnNsYXRlIGFkZHJlc3MsIC5xYy1jbXAtY2xlYW5zbGF0ZSBibG9ja3F1b3RlLCAucWMtY21wLWNsZWFuc2xhdGUgZGQsIC5xYy1jbXAtY2xlYW5zbGF0ZSBmaWVsZHNldCwgLnFjLWNtcC1jbGVhbnNsYXRlIGxpLCAucWMtY21wLWNsZWFuc2xhdGUgaWZyYW1lLCAucWMtY21wLWNsZWFuc2xhdGUgc3Ryb25nLCAucWMtY21wLWNsZWFuc2xhdGUgbGVnZW5kLCAucWMtY21wLWNsZWFuc2xhdGUgZW0sIC5xYy1jbXAtY2xlYW5zbGF0ZSBzdW1tYXJ5LCAucWMtY21wLWNsZWFuc2xhdGUgY2l0ZSwgLnFjLWNtcC1jbGVhbnNsYXRlIHNwYW4sIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbnB1dCwgLnFjLWNtcC1jbGVhbnNsYXRlIHN1cCwgLnFjLWNtcC1jbGVhbnNsYXRlIGxhYmVsLCAucWMtY21wLWNsZWFuc2xhdGUgZGZuLCAucWMtY21wLWNsZWFuc2xhdGUgb2JqZWN0LCAucWMtY21wLWNsZWFuc2xhdGUgYmlnLCAucWMtY21wLWNsZWFuc2xhdGUgcSwgLnFjLWNtcC1jbGVhbnNsYXRlIHNhbXAsIC5xYy1jbXAtY2xlYW5zbGF0ZSBhY3JvbnltLCAucWMtY21wLWNsZWFuc2xhdGUgc21hbGwsIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbWcsIC5xYy1jbXAtY2xlYW5zbGF0ZSBzdHJpa2UsIC5xYy1jbXAtY2xlYW5zbGF0ZSBjb2RlLCAucWMtY21wLWNsZWFuc2xhdGUgc3ViLCAucWMtY21wLWNsZWFuc2xhdGUgaW5zLCAucWMtY21wLWNsZWFuc2xhdGUgdGV4dGFyZWEsIC5xYy1jbXAtY2xlYW5zbGF0ZSBidXR0b24sIC5xYy1jbXAtY2xlYW5zbGF0ZSB2YXIsIC5xYy1jbXAtY2xlYW5zbGF0ZSBhLCAucWMtY21wLWNsZWFuc2xhdGUgYWJiciwgLnFjLWNtcC1jbGVhbnNsYXRlIGFwcGxldCwgLnFjLWNtcC1jbGVhbnNsYXRlIGRlbCwgLnFjLWNtcC1jbGVhbnNsYXRlIGtiZCwgLnFjLWNtcC1jbGVhbnNsYXRlIHR0LCAucWMtY21wLWNsZWFuc2xhdGUgYiwgLnFjLWNtcC1jbGVhbnNsYXRlIGksIC5xYy1jbXAtY2xlYW5zbGF0ZSBocixcblxuICAucWMtY21wLWNsZWFuc2xhdGUgYXJ0aWNsZSwgLnFjLWNtcC1jbGVhbnNsYXRlIGFzaWRlLCAucWMtY21wLWNsZWFuc2xhdGUgZmlndXJlLCAucWMtY21wLWNsZWFuc2xhdGUgZmlnY2FwdGlvbiwgLnFjLWNtcC1jbGVhbnNsYXRlIGZvb3RlciwgLnFjLWNtcC1jbGVhbnNsYXRlIGhlYWRlciwgLnFjLWNtcC1jbGVhbnNsYXRlIG1lbnUsIC5xYy1jbXAtY2xlYW5zbGF0ZSBuYXYsIC5xYy1jbXAtY2xlYW5zbGF0ZSBzZWN0aW9uLCAucWMtY21wLWNsZWFuc2xhdGUgdGltZSwgLnFjLWNtcC1jbGVhbnNsYXRlIG1hcmssIC5xYy1jbXAtY2xlYW5zbGF0ZSBhdWRpbywgLnFjLWNtcC1jbGVhbnNsYXRlIHZpZGVvLCAucWMtY21wLWNsZWFuc2xhdGUgYWJiciwgLnFjLWNtcC1jbGVhbnNsYXRlIGFkZHJlc3MsIC5xYy1jbXAtY2xlYW5zbGF0ZSBhcmVhLCAucWMtY21wLWNsZWFuc2xhdGUgYmxvY2txdW90ZSwgLnFjLWNtcC1jbGVhbnNsYXRlIGNhbnZhcywgLnFjLWNtcC1jbGVhbnNsYXRlIGNhcHRpb24sIC5xYy1jbXAtY2xlYW5zbGF0ZSBjaXRlLCAucWMtY21wLWNsZWFuc2xhdGUgY29kZSwgLnFjLWNtcC1jbGVhbnNsYXRlIGNvbGdyb3VwLCAucWMtY21wLWNsZWFuc2xhdGUgY29sLCAucWMtY21wLWNsZWFuc2xhdGUgZGF0YWxpc3QsIC5xYy1jbXAtY2xlYW5zbGF0ZSBmaWVsZHNldCwgLnFjLWNtcC1jbGVhbnNsYXRlIG1haW4sIC5xYy1jbXAtY2xlYW5zbGF0ZSBtYXAsIC5xYy1jbXAtY2xlYW5zbGF0ZSBtZXRhLCAucWMtY21wLWNsZWFuc2xhdGUgb3B0Z3JvdXAsIC5xYy1jbXAtY2xlYW5zbGF0ZSBvdXRwdXQsIC5xYy1jbXAtY2xlYW5zbGF0ZSBwcm9ncmVzcywgLnFjLWNtcC1jbGVhbnNsYXRlIHN2ZyB7XG4gICAgYmFja2dyb3VuZC1hdHRhY2htZW50OiBzY3JvbGw7XG4gICAgYmFja2dyb3VuZC1jb2xvcjogdHJhbnNwYXJlbnQ7XG4gICAgYmFja2dyb3VuZC1pbWFnZTogbm9uZTsgXG4gICAgYmFja2dyb3VuZC1wb3NpdGlvbjogMCAwO1xuICAgIGJhY2tncm91bmQtcmVwZWF0OiByZXBlYXQ7XG4gICAgYm9yZGVyLWNvbG9yOiBibGFjaztcbiAgICBib3JkZXItY29sb3I6IGN1cnJlbnRDb2xvcjsgXG4gICAgYm9yZGVyLXJhZGl1czogMDtcbiAgICBib3JkZXItc3R5bGU6IG5vbmU7XG4gICAgYm9yZGVyLXdpZHRoOiBtZWRpdW07XG4gICAgYm90dG9tOiBhdXRvO1xuICAgIGNsZWFyOiBub25lO1xuICAgIGNsaXA6IGF1dG87XG4gICAgY29sb3I6IGluaGVyaXQ7XG4gICAgY291bnRlci1pbmNyZW1lbnQ6IG5vbmU7XG4gICAgY291bnRlci1yZXNldDogbm9uZTtcbiAgICBjdXJzb3I6IGF1dG87XG4gICAgZGlyZWN0aW9uOiBpbmhlcml0O1xuICAgIGRpc3BsYXk6IGlubGluZTtcbiAgICBmbG9hdDogbm9uZTtcbiAgICBmb250LWZhbWlseTogaW5oZXJpdDtcbiAgICBmb250LXNpemU6IGluaGVyaXQ7XG4gICAgZm9udC1zdHlsZTogaW5oZXJpdDtcbiAgICBmb250LXZhcmlhbnQ6IG5vcm1hbDtcbiAgICBmb250LXdlaWdodDogaW5oZXJpdDtcbiAgICBoZWlnaHQ6IGF1dG87XG4gICAgbGVmdDogYXV0bztcbiAgICBsZXR0ZXItc3BhY2luZzogbm9ybWFsO1xuICAgIGxpbmUtaGVpZ2h0OiBpbmhlcml0O1xuICAgIGxpc3Qtc3R5bGUtdHlwZTogaW5oZXJpdDtcbiAgICBsaXN0LXN0eWxlLXBvc2l0aW9uOiBvdXRzaWRlO1xuICAgIGxpc3Qtc3R5bGUtaW1hZ2U6IG5vbmU7XG4gICAgbWFyZ2luOiAwO1xuICAgIG1heC1oZWlnaHQ6IG5vbmU7XG4gICAgbWF4LXdpZHRoOiBub25lO1xuICAgIG1pbi1oZWlnaHQ6IDA7XG4gICAgbWluLXdpZHRoOiAwO1xuICAgIG9wYWNpdHk6IDE7XG4gICAgb3V0bGluZTogaW52ZXJ0IG5vbmUgbWVkaXVtO1xuICAgIG92ZXJmbG93OiB2aXNpYmxlO1xuICAgIHBhZGRpbmc6IDA7XG4gICAgcG9zaXRpb246IHN0YXRpYztcbiAgICBxdW90ZXM6IFwnXCcgXCdcJztcbiAgICByaWdodDogYXV0bztcbiAgICB0YWJsZS1sYXlvdXQ6IGF1dG87XG4gICAgdGV4dC1hbGlnbjogaW5oZXJpdDtcbiAgICB0ZXh0LWRlY29yYXRpb246IGluaGVyaXQ7XG4gICAgdGV4dC1pbmRlbnQ6IDA7XG4gICAgdGV4dC10cmFuc2Zvcm06IG5vbmU7XG4gICAgdG9wOiBhdXRvO1xuICAgIHVuaWNvZGUtYmlkaTogbm9ybWFsO1xuICAgIHZlcnRpY2FsLWFsaWduOiBiYXNlbGluZTtcbiAgICB2aXNpYmlsaXR5OiBpbmhlcml0O1xuICAgIHdoaXRlLXNwYWNlOiBub3JtYWw7XG4gICAgd2lkdGg6IGF1dG87XG4gICAgd29yZC1zcGFjaW5nOiBub3JtYWw7XG4gICAgei1pbmRleDogYXV0bztcblxuICAgIC13ZWJraXQtYmFja2dyb3VuZC1vcmlnaW46IHBhZGRpbmctYm94O1xuICAgIGJhY2tncm91bmQtb3JpZ2luOiBwYWRkaW5nLWJveDtcbiAgICAtd2Via2l0LWJhY2tncm91bmQtY2xpcDogYm9yZGVyLWJveDtcbiAgICBiYWNrZ3JvdW5kLWNsaXA6IGJvcmRlci1ib3g7XG4gICAgLXdlYmtpdC1iYWNrZ3JvdW5kLXNpemU6IGF1dG87XG4gICAgLW1vei1iYWNrZ3JvdW5kLXNpemU6IGF1dG87XG4gICAgYmFja2dyb3VuZC1zaXplOiBhdXRvO1xuICAgIC13ZWJraXQtYm9yZGVyLWltYWdlOiBub25lO1xuICAgIC1tb3otYm9yZGVyLWltYWdlOiBub25lO1xuICAgIC1vLWJvcmRlci1pbWFnZTogbm9uZTtcbiAgICBib3JkZXItaW1hZ2U6IG5vbmU7XG4gICAgLXdlYmtpdC1ib3JkZXItcmFkaXVzOiAwO1xuICAgIC1tb3otYm9yZGVyLXJhZGl1czogMDtcbiAgICBib3JkZXItcmFkaXVzOiAwO1xuICAgIC13ZWJraXQtYm94LXNoYWRvdzogbm9uZTtcbiAgICBib3gtc2hhZG93OiBub25lO1xuICAgIC13ZWJraXQtYm94LXNpemluZzogY29udGVudC1ib3g7XG4gICAgLW1vei1ib3gtc2l6aW5nOiBjb250ZW50LWJveDtcbiAgICBib3gtc2l6aW5nOiBjb250ZW50LWJveDtcbiAgICAtd2Via2l0LWNvbHVtbi1jb3VudDogYXV0bztcbiAgICAtbW96LWNvbHVtbi1jb3VudDogYXV0bztcbiAgICBjb2x1bW4tY291bnQ6IGF1dG87XG4gICAgLXdlYmtpdC1jb2x1bW4tZ2FwOiBub3JtYWw7XG4gICAgLW1vei1jb2x1bW4tZ2FwOiBub3JtYWw7XG4gICAgY29sdW1uLWdhcDogbm9ybWFsO1xuICAgIC13ZWJraXQtY29sdW1uLXJ1bGU6IG1lZGl1bSBub25lIGJsYWNrO1xuICAgIC1tb3otY29sdW1uLXJ1bGU6IG1lZGl1bSBub25lIGJsYWNrO1xuICAgIGNvbHVtbi1ydWxlOiBtZWRpdW0gbm9uZSBibGFjaztcbiAgICAtd2Via2l0LWNvbHVtbi1zcGFuOiAxO1xuICAgIC1tb3otY29sdW1uLXNwYW46IDE7XG4gICAgY29sdW1uLXNwYW46IDE7XG4gICAgLXdlYmtpdC1jb2x1bW4td2lkdGg6IGF1dG87XG4gICAgLW1vei1jb2x1bW4td2lkdGg6IGF1dG87XG4gICAgY29sdW1uLXdpZHRoOiBhdXRvO1xuICAgIGZvbnQtZmVhdHVyZS1zZXR0aW5nczogbm9ybWFsO1xuICAgIG92ZXJmbG93LXg6IHZpc2libGU7XG4gICAgb3ZlcmZsb3cteTogdmlzaWJsZTtcbiAgICAtd2Via2l0LWh5cGhlbnM6IG1hbnVhbDtcbiAgICAtbW96LWh5cGhlbnM6IG1hbnVhbDtcbiAgICBoeXBoZW5zOiBtYW51YWw7XG4gICAgLXdlYmtpdC1wZXJzcGVjdGl2ZTogbm9uZTtcbiAgICAtbW96LXBlcnNwZWN0aXZlOiBub25lO1xuICAgIC1tcy1wZXJzcGVjdGl2ZTogbm9uZTtcbiAgICAtby1wZXJzcGVjdGl2ZTogbm9uZTtcbiAgICBwZXJzcGVjdGl2ZTogbm9uZTtcbiAgICAtd2Via2l0LXBlcnNwZWN0aXZlLW9yaWdpbjogNTAlIDUwJTtcbiAgICAtbW96LXBlcnNwZWN0aXZlLW9yaWdpbjogNTAlIDUwJTtcbiAgICAtbXMtcGVyc3BlY3RpdmUtb3JpZ2luOiA1MCUgNTAlO1xuICAgIC1vLXBlcnNwZWN0aXZlLW9yaWdpbjogNTAlIDUwJTtcbiAgICBwZXJzcGVjdGl2ZS1vcmlnaW46IDUwJSA1MCU7XG4gICAgLXdlYmtpdC1iYWNrZmFjZS12aXNpYmlsaXR5OiB2aXNpYmxlO1xuICAgIC1tb3otYmFja2ZhY2UtdmlzaWJpbGl0eTogdmlzaWJsZTtcbiAgICAtbXMtYmFja2ZhY2UtdmlzaWJpbGl0eTogdmlzaWJsZTtcbiAgICAtby1iYWNrZmFjZS12aXNpYmlsaXR5OiB2aXNpYmxlO1xuICAgIGJhY2tmYWNlLXZpc2liaWxpdHk6IHZpc2libGU7XG4gICAgdGV4dC1zaGFkb3c6IG5vbmU7XG4gICAgLXdlYmtpdC10cmFuc2l0aW9uOiBhbGwgMHMgZWFzZSAwcztcbiAgICB0cmFuc2l0aW9uOiBhbGwgMHMgZWFzZSAwcztcbiAgICAtd2Via2l0LXRyYW5zZm9ybTogbm9uZTtcbiAgICAtbW96LXRyYW5zZm9ybTogbm9uZTtcbiAgICAtbXMtdHJhbnNmb3JtOiBub25lO1xuICAgIC1vLXRyYW5zZm9ybTogbm9uZTtcbiAgICB0cmFuc2Zvcm06IG5vbmU7XG4gICAgLXdlYmtpdC10cmFuc2Zvcm0tb3JpZ2luOiA1MCUgNTAlO1xuICAgIC1tb3otdHJhbnNmb3JtLW9yaWdpbjogNTAlIDUwJTtcbiAgICAtbXMtdHJhbnNmb3JtLW9yaWdpbjogNTAlIDUwJTtcbiAgICAtby10cmFuc2Zvcm0tb3JpZ2luOiA1MCUgNTAlO1xuICAgIHRyYW5zZm9ybS1vcmlnaW46IDUwJSA1MCU7XG4gICAgLXdlYmtpdC10cmFuc2Zvcm0tc3R5bGU6IGZsYXQ7XG4gICAgLW1vei10cmFuc2Zvcm0tc3R5bGU6IGZsYXQ7XG4gICAgLW1zLXRyYW5zZm9ybS1zdHlsZTogZmxhdDtcbiAgICAtby10cmFuc2Zvcm0tc3R5bGU6IGZsYXQ7XG4gICAgdHJhbnNmb3JtLXN0eWxlOiBmbGF0O1xuICAgIHdvcmQtYnJlYWs6IG5vcm1hbDtcbiAgfVxuXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSwgLnFjLWNtcC1jbGVhbnNsYXRlIGgzLCAucWMtY21wLWNsZWFuc2xhdGUgaDUsIC5xYy1jbXAtY2xlYW5zbGF0ZSBwLCAucWMtY21wLWNsZWFuc2xhdGUgaDEsIC5xYy1jbXAtY2xlYW5zbGF0ZSBkbCwgLnFjLWNtcC1jbGVhbnNsYXRlIGR0LCAucWMtY21wLWNsZWFuc2xhdGUgaDYsIC5xYy1jbXAtY2xlYW5zbGF0ZSBvbCwgLnFjLWNtcC1jbGVhbnNsYXRlIGZvcm0sIC5xYy1jbXAtY2xlYW5zbGF0ZSBvcHRpb24sIC5xYy1jbXAtY2xlYW5zbGF0ZSBwcmUsIC5xYy1jbXAtY2xlYW5zbGF0ZSBkaXYsIC5xYy1jbXAtY2xlYW5zbGF0ZSBoMiwgLnFjLWNtcC1jbGVhbnNsYXRlIGNhcHRpb24sIC5xYy1jbXAtY2xlYW5zbGF0ZSBoNCwgLnFjLWNtcC1jbGVhbnNsYXRlIHVsLCAucWMtY21wLWNsZWFuc2xhdGUgYWRkcmVzcywgLnFjLWNtcC1jbGVhbnNsYXRlIGJsb2NrcXVvdGUsIC5xYy1jbXAtY2xlYW5zbGF0ZSBkZCwgLnFjLWNtcC1jbGVhbnNsYXRlIGZpZWxkc2V0LCAucWMtY21wLWNsZWFuc2xhdGUgaHIsXG5cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGFydGljbGUsIC5xYy1jbXAtY2xlYW5zbGF0ZSBkaWFsb2csIC5xYy1jbXAtY2xlYW5zbGF0ZSBmaWd1cmUsIC5xYy1jbXAtY2xlYW5zbGF0ZSBmb290ZXIsIC5xYy1jbXAtY2xlYW5zbGF0ZSBoZWFkZXIsIC5xYy1jbXAtY2xlYW5zbGF0ZSBoZ3JvdXAsIC5xYy1jbXAtY2xlYW5zbGF0ZSBtZW51LCAucWMtY21wLWNsZWFuc2xhdGUgbmF2LCAucWMtY21wLWNsZWFuc2xhdGUgc2VjdGlvbiwgLnFjLWNtcC1jbGVhbnNsYXRlIGF1ZGlvLCAucWMtY21wLWNsZWFuc2xhdGUgdmlkZW8sIC5xYy1jbXAtY2xlYW5zbGF0ZSBhZGRyZXNzLCAucWMtY21wLWNsZWFuc2xhdGUgYmxvY2txdW90ZSwgLnFjLWNtcC1jbGVhbnNsYXRlIGNvbGdyb3VwLCAucWMtY21wLWNsZWFuc2xhdGUgbWFpbiwgLnFjLWNtcC1jbGVhbnNsYXRlIHByb2dyZXNzLCAucWMtY21wLWNsZWFuc2xhdGUgc3VtbWFyeSB7XG4gICAgZGlzcGxheTogYmxvY2s7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGgxLFxuICAucWMtY21wLWNsZWFuc2xhdGUgaDIsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBoMyxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGg0LFxuICAucWMtY21wLWNsZWFuc2xhdGUgaDUsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBoNiB7XG4gICAgZm9udC13ZWlnaHQ6IGJvbGQ7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGgxIHtcbiAgICBmb250LXNpemU6IDJlbTtcbiAgICBwYWRkaW5nOiAwLjY3ZW0gMDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgaDIge1xuICAgIGZvbnQtc2l6ZTogMS41ZW07XG4gICAgcGFkZGluZzogMC44M2VtIDA7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGgzIHtcbiAgICBmb250LXNpemU6IDEuMTdlbTtcbiAgICBwYWRkaW5nOiAwLjgzZW0gMDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgaDQge1xuICAgIGZvbnQtc2l6ZTogMWVtO1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBoNSB7XG4gICAgZm9udC1zaXplOiAwLjgzZW07XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHAge1xuICAgIG1hcmdpbjogMWVtIDA7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHRhYmxlIHtcbiAgICBkaXNwbGF5OiB0YWJsZTtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgdGhlYWQge1xuICAgIGRpc3BsYXk6IHRhYmxlLWhlYWRlci1ncm91cDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgdGJvZHkge1xuICAgIGRpc3BsYXk6IHRhYmxlLXJvdy1ncm91cDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgdGZvb3Qge1xuICAgIGRpc3BsYXk6IHRhYmxlLWZvb3Rlci1ncm91cDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgdHIge1xuICAgIGRpc3BsYXk6IHRhYmxlLXJvdztcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgdGgsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB0ZCB7XG4gICAgZGlzcGxheTogdGFibGUtY2VsbDtcbiAgICBwYWRkaW5nOiAycHg7XG4gIH1cblxuICAucWMtY21wLWNsZWFuc2xhdGUgb2wsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB1bCB7XG4gICAgbWFyZ2luOiAxZW0gMDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgdWwgbGksXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB1bCB1bCBsaSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHVsIHVsIHVsIGxpLFxuICAucWMtY21wLWNsZWFuc2xhdGUgb2wgbGksXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBvbCBvbCBsaSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG9sIG9sIG9sIGxpLFxuICAucWMtY21wLWNsZWFuc2xhdGUgdWwgb2wgb2wgbGksXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB1bCB1bCBvbCBsaSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG9sIHVsIHVsIGxpLFxuICAucWMtY21wLWNsZWFuc2xhdGUgb2wgb2wgdWwgbGkge1xuICAgIGxpc3Qtc3R5bGUtcG9zaXRpb246IGluc2lkZTtcbiAgICBtYXJnaW4tdG9wOiAwLjA4ZW07XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG9sIG9sLFxuICAucWMtY21wLWNsZWFuc2xhdGUgb2wgb2wgb2wsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB1bCB1bCxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHVsIHVsIHVsLFxuICAucWMtY21wLWNsZWFuc2xhdGUgb2wgdWwsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBvbCB1bCB1bCxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG9sIG9sIHVsLFxuICAucWMtY21wLWNsZWFuc2xhdGUgdWwgb2wsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB1bCBvbCBvbCxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHVsIHVsIG9sIHtcbiAgICBwYWRkaW5nLWxlZnQ6IDQwcHg7XG4gICAgbWFyZ2luOiAwO1xuICB9XG5cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG5hdiB1bCxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG5hdiBvbCB7XG4gICAgbGlzdC1zdHlsZS10eXBlOiBub25lO1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB1bCxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG1lbnUge1xuICAgIGxpc3Qtc3R5bGUtdHlwZTogZGlzYztcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgb2wge1xuICAgIGxpc3Qtc3R5bGUtdHlwZTogZGVjaW1hbDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgb2wgdWwsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB1bCB1bCxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG1lbnUgdWwsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBvbCBtZW51LFxuICAucWMtY21wLWNsZWFuc2xhdGUgdWwgbWVudSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG1lbnUgbWVudSB7XG4gICAgbGlzdC1zdHlsZS10eXBlOiBjaXJjbGU7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG9sIG9sIHVsLFxuICAucWMtY21wLWNsZWFuc2xhdGUgb2wgdWwgdWwsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBvbCBtZW51IHVsLFxuICAucWMtY21wLWNsZWFuc2xhdGUgb2wgb2wgbWVudSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG9sIHVsIG1lbnUsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBvbCBtZW51IG1lbnUsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB1bCBvbCB1bCxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHVsIHVsIHVsLFxuICAucWMtY21wLWNsZWFuc2xhdGUgdWwgbWVudSB1bCxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHVsIG9sIG1lbnUsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB1bCB1bCBtZW51LFxuICAucWMtY21wLWNsZWFuc2xhdGUgdWwgbWVudSBtZW51LFxuICAucWMtY21wLWNsZWFuc2xhdGUgbWVudSBvbCB1bCxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG1lbnUgdWwgdWwsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBtZW51IG1lbnUgdWwsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBtZW51IG9sIG1lbnUsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBtZW51IHVsIG1lbnUsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBtZW51IG1lbnUgbWVudSB7XG4gICAgbGlzdC1zdHlsZS10eXBlOiBzcXVhcmU7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGxpIHtcbiAgICBkaXNwbGF5OiBsaXN0LWl0ZW07XG4gICAgbWluLWhlaWdodDogYXV0bztcbiAgICBtaW4td2lkdGg6IGF1dG87XG4gICAgcGFkZGluZy1sZWZ0OiAyMHB4O1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBzdHJvbmcge1xuICAgIGZvbnQtd2VpZ2h0OiBib2xkO1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBlbSB7XG4gICAgZm9udC1zdHlsZTogaXRhbGljO1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBrYmQsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBzYW1wLFxuICAucWMtY21wLWNsZWFuc2xhdGUgY29kZSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHByZSB7XG4gICAgZm9udC1mYW1pbHk6IG1vbm9zcGFjZTtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgYSB7XG4gICAgY29sb3I6IGJsdWU7XG4gICAgdGV4dC1kZWNvcmF0aW9uOiB1bmRlcmxpbmU7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGE6dmlzaXRlZCB7XG4gICAgY29sb3I6ICM1Mjk7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGEsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBhICosXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbnB1dFt0eXBlPVwnc3VibWl0XCddLFxuICAucWMtY21wLWNsZWFuc2xhdGUgaW5wdXRbdHlwZT1cJ2J1dHRvblwnXSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGlucHV0W3R5cGU9XCdyYWRpb1wnXSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGlucHV0W3R5cGU9XCdjaGVja2JveFwnXSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHNlbGVjdCxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGJ1dHRvbiB7XG4gICAgY3Vyc29yOiBwb2ludGVyO1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBidXR0b24sXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbnB1dFt0eXBlPVwnc3VibWl0XCddIHtcbiAgICB0ZXh0LWFsaWduOiBjZW50ZXI7XG4gICAgcGFkZGluZzogMnB4IDZweCAzcHg7XG4gICAgYm9yZGVyLXJhZGl1czogMDtcbiAgICB0ZXh0LWRlY29yYXRpb246IG5vbmU7XG4gICAgZm9udC1mYW1pbHk6IGFyaWFsLCBoZWx2ZXRpY2EsIHNhbnMtc2VyaWY7XG4gICAgZm9udC1zaXplOiBzbWFsbDtcbiAgICBiYWNrZ3JvdW5kOiB3aGl0ZTtcbiAgICBjb2xvcjogYnV0dG9udGV4dDtcbiAgICBib3JkZXI6IDFweCAjYTZhNmE2IHNvbGlkO1xuICAgIGJhY2tncm91bmQ6IG5vbmU7XG4gICAgZmlsdGVyOiBub25lO1xuICAgIGJveC1zaGFkb3c6IG5vbmU7XG4gICAgb3V0bGluZTogaW5pdGlhbDtcblxuICAgICY6Zm9jdXMge1xuICAgICAgYm94LXNoYWRvdzogMCAwIDAgMnB4ICNmZmZmZmYsIDAgMCAzcHggNXB4ICMyMDZEQzU7XG4gICAgICBvdXRsaW5lOiAycHggZG90dGVkIHRyYW5zcGFyZW50O1xuICAgICAgb3V0bGluZS1vZmZzZXQ6IDJweDtcbiAgICB9XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGJ1dHRvbjphY3RpdmUsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbnB1dFt0eXBlPVwnc3VibWl0XCddOmFjdGl2ZSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGlucHV0W3R5cGU9XCdidXR0b25cJ106YWN0aXZlLFxuICAucWMtY21wLWNsZWFuc2xhdGUgYnV0dG9uOmFjdGl2ZSB7XG4gICAgYmFja2dyb3VuZDogbm9uZTtcbiAgICBib3JkZXI6IG5vbmU7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGJ1dHRvbiB7XG4gICAgcGFkZGluZzogMXB4IDZweCAycHggNnB4O1xuICAgIG1hcmdpbi1yaWdodDogNXB4O1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbnB1dFt0eXBlPVwnaGlkZGVuXCddIHtcbiAgICBkaXNwbGF5OiBub25lO1xuICB9XG5cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHRleHRhcmVhIHtcbiAgICAtd2Via2l0LWFwcGVhcmFuY2U6IHRleHRhcmVhO1xuICAgIGJhY2tncm91bmQ6IHdoaXRlO1xuICAgIHBhZGRpbmc6IDJweDtcbiAgICBtYXJnaW4tbGVmdDogNHB4O1xuICAgIHdvcmQtd3JhcDogYnJlYWstd29yZDtcbiAgICB3aGl0ZS1zcGFjZTogcHJlLXdyYXA7XG4gICAgZm9udC1zaXplOiAxMXB4O1xuICAgIGZvbnQtZmFtaWx5OiBhcmlhbCwgaGVsdmV0aWNhLCBzYW5zLXNlcmlmO1xuICAgIGxpbmUtaGVpZ2h0OiAxM3B4O1xuICAgIHJlc2l6ZTogYm90aDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgc2VsZWN0LFxuICAucWMtY21wLWNsZWFuc2xhdGUgdGV4dGFyZWEsXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbnB1dCB7XG4gICAgYm9yZGVyOiAxcHggc29saWQgI2NjYztcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgc2VsZWN0IHtcbiAgICBmb250LXNpemU6IDExcHg7XG4gICAgZm9udC1mYW1pbHk6IGhlbHZldGljYSwgYXJpYWwsIHNhbnMtc2VyaWY7XG4gICAgZGlzcGxheTogaW5saW5lLWJsb2NrO1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB0ZXh0YXJlYTpmb2N1cyxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGlucHV0OmZvY3VzIHtcbiAgICBvdXRsaW5lOiBhdXRvIDVweCAtd2Via2l0LWZvY3VzLXJpbmctY29sb3I7XG4gICAgb3V0bGluZTogaW5pdGlhbDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgaW5wdXRbdHlwZT1cJ3RleHRcJ10ge1xuICAgIGJhY2tncm91bmQ6IHdoaXRlO1xuICAgIHBhZGRpbmc6IDFweDtcbiAgICBmb250LWZhbWlseTogaW5pdGlhbDtcbiAgICBmb250LXNpemU6IHNtYWxsO1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbnB1dFt0eXBlPVwnY2hlY2tib3hcJ10sXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbnB1dFt0eXBlPVwncmFkaW9cJ10ge1xuICAgIGJvcmRlcjogMXB4ICMyYjJiMmIgc29saWQ7XG4gICAgYm9yZGVyLXJhZGl1czogNHB4O1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbnB1dFt0eXBlPVwnY2hlY2tib3hcJ10sXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbnB1dFt0eXBlPVwncmFkaW9cJ10ge1xuICAgIG91dGxpbmU6IGluaXRpYWw7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGlucHV0W3R5cGU9XCdyYWRpb1wnXSB7XG4gICAgbWFyZ2luOiAycHggMnB4IDNweCAycHg7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGFiYnJbdGl0bGVdLFxuICAucWMtY21wLWNsZWFuc2xhdGUgYWNyb255bVt0aXRsZV0sXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBkZm5bdGl0bGVdIHtcbiAgICBjdXJzb3I6IGhlbHA7XG4gICAgYm9yZGVyLWJvdHRvbS13aWR0aDogMXB4O1xuICAgIGJvcmRlci1ib3R0b20tc3R5bGU6IGRvdHRlZDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgaW5zIHtcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjZmY5O1xuICAgIGNvbG9yOiBibGFjaztcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgZGVsIHtcbiAgICB0ZXh0LWRlY29yYXRpb246IGxpbmUtdGhyb3VnaDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgYmxvY2txdW90ZSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHEge1xuICAgIHF1b3Rlczogbm9uZTsgXG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGJsb2NrcXVvdGU6YmVmb3JlLFxuICAucWMtY21wLWNsZWFuc2xhdGUgYmxvY2txdW90ZTphZnRlcixcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHE6YmVmb3JlLFxuICAucWMtY21wLWNsZWFuc2xhdGUgcTphZnRlcixcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGxpOmJlZm9yZSxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGxpOmFmdGVyIHtcbiAgICBjb250ZW50OiBcJ1wnO1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBpbnB1dCxcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHNlbGVjdCB7XG4gICAgdmVydGljYWwtYWxpZ246IG1pZGRsZTtcbiAgfVxuXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB0YWJsZSB7XG4gICAgYm9yZGVyLWNvbGxhcHNlOiBjb2xsYXBzZTtcbiAgICBib3JkZXItc3BhY2luZzogMDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgaHIge1xuICAgIGRpc3BsYXk6IGJsb2NrO1xuICAgIGhlaWdodDogMXB4O1xuICAgIGJvcmRlcjogMDtcbiAgICBib3JkZXItdG9wOiAxcHggc29saWQgI2NjYztcbiAgICBtYXJnaW46IDFlbSAwO1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSAqW2Rpcj1cJ3J0bFwnXSB7XG4gICAgZGlyZWN0aW9uOiBydGw7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIG1hcmsge1xuICAgIGJhY2tncm91bmQtY29sb3I6ICNmZjk7XG4gICAgY29sb3I6IGJsYWNrO1xuICAgIGZvbnQtc3R5bGU6IGl0YWxpYztcbiAgICBmb250LXdlaWdodDogYm9sZDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgbWVudSB7XG4gICAgcGFkZGluZy1sZWZ0OiA0MHB4O1xuICAgIHBhZGRpbmctdG9wOiA4cHg7XG4gIH1cblxuICAucWMtY21wLWNsZWFuc2xhdGUgW2hpZGRlbl0sXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSB0ZW1wbGF0ZSB7XG4gICAgZGlzcGxheTogbm9uZTtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgYWJiclt0aXRsZV0ge1xuICAgIGJvcmRlci1ib3R0b206IDFweCBkb3R0ZWQ7XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHN1YixcbiAgLnFjLWNtcC1jbGVhbnNsYXRlIHN1cCB7XG4gICAgZm9udC1zaXplOiA3NSU7XG4gICAgbGluZS1oZWlnaHQ6IDA7XG4gICAgcG9zaXRpb246IHJlbGF0aXZlO1xuICAgIHZlcnRpY2FsLWFsaWduOiBiYXNlbGluZTtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgc3VwIHtcbiAgICB0b3A6IC0wLjVlbTtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgc3ViIHtcbiAgICBib3R0b206IC0wLjI1ZW07XG4gIH1cbiAgLnFjLWNtcC1jbGVhbnNsYXRlIGltZyB7XG4gICAgYm9yZGVyOiAwO1xuICB9XG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBmaWd1cmUge1xuICAgIG1hcmdpbjogMDtcbiAgfVxuICAucWMtY21wLWNsZWFuc2xhdGUgdGV4dGFyZWEge1xuICAgIG92ZXJmbG93OiBhdXRvO1xuICAgIHZlcnRpY2FsLWFsaWduOiB0b3A7XG4gIH1cblxuICAucWMtY21wLWNsZWFuc2xhdGUge1xuICAgIGZvbnQtc2l6ZTogbWVkaXVtO1xuICAgIGxpbmUtaGVpZ2h0OiAxO1xuICAgIGRpcmVjdGlvbjogbHRyO1xuICAgIHRleHQtYWxpZ246IGxlZnQ7XG4gICAgdGV4dC1hbGlnbjogc3RhcnQ7XG4gICAgZm9udC1mYW1pbHk6IFwnVGltZXMgTmV3IFJvbWFuXCcsIFRpbWVzLCBzZXJpZjtcbiAgICBjb2xvcjogYmxhY2s7XG4gICAgZm9udC1zdHlsZTogbm9ybWFsO1xuICAgIGZvbnQtd2VpZ2h0OiBub3JtYWw7XG4gICAgdGV4dC1kZWNvcmF0aW9uOiBub25lO1xuICAgIGxpc3Qtc3R5bGUtdHlwZTogZGlzYztcbiAgfVxuXG4gIC5xYy1jbXAtY2xlYW5zbGF0ZSBwcmUge1xuICAgIHdoaXRlLXNwYWNlOiBwcmU7XG4gIH1cbiddKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ28gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgdm8sIHlvLCBibywgRW8gPSBPYmplY3QodnQuYSkoZ28oKSk7CiAgICAgICAgICAgICAgICBuKDEyOCksIG4oMTI5KSwgbigxMzApOwogICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZVtlLlRPUF9MRUZUID0gMV0gPSAnVE9QX0xFRlQnLCBlW2UuVE9QX1JJR0hUID0gMl0gPSAnVE9QX1JJR0hUJywgZVtlLkJPVFRPTV9SSUdIVCA9IDNdID0gJ0JPVFRPTV9SSUdIVCcsIGVbZS5CT1RUT01fTEVGVCA9IDRdID0gJ0JPVFRPTV9MRUZUJzsKICAgICAgICAgICAgICAgIH0odm8gfHwgKHZvID0ge30pKSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBlLllFUyA9ICdZJywgZS5OT1QgPSAnTic7CiAgICAgICAgICAgICAgICB9KHlvIHx8ICh5byA9IHt9KSksIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgZS5HRFBSID0gJ0dEUFInLCBlLlVTUCA9ICdVU1AnOwogICAgICAgICAgICAgICAgfShibyB8fCAoYm8gPSB7fSkpOwogICAgICAgICAgICAgICAgbigxMzEpOwogICAgICAgICAgICAgICAgdmFyIHdvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4gPSBlLnVpLCByID0gZS5tb2RlLCBvID0gaHQoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHAuY2hhbmdlZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpID0gaHQoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHAuZGlzcGxheUdEUFI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYSA9IGh0KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwLmRpc3BsYXlVU1A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgcyA9IG4uY29uc2VudEdyb3VwSGFuZGxlciwgYyA9IG4uc2V0QWxsTGVnaXRpbWF0ZXNUbywgdSA9IG4uZ2V0Q29yZUNvbmZpZygpLCBsID0gbi5nZXRDb3JlVWlMYWJlbHMoKSwgZiA9IG4uZ2V0UHJlbWl1bVVpTGFiZWxzKCksIHAgPSBuLmV2ZW50VHJhY2tlciwgZCA9IG10KE9iamVjdChZZS51c2VTdGF0ZSkoKSwgMiksIGggPSBkWzBdLCBtID0gZFsxXSwgZyA9IG10KE9iamVjdChZZS51c2VTdGF0ZSkoKSwgMiksIHYgPSBnWzBdLCB5ID0gZ1sxXSwgYiA9IG10KE9iamVjdChZZS51c2VTdGF0ZSkoKSwgMiksIEUgPSBiWzBdLCB3ID0gYlsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdChZZS51c2VFZmZlY3QpKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpICYmICF2IHx8ICFuLkdWTFZlbmRvcnNEYXRhSW5pdGlhbGl6ZWQgJiYgaSkgJiYgKG0obi5nZXROb25JYWJEYXRhKCkpLCB3KG4uZ2V0R29vZ2xlVmVuZG9ycygpKSwgT28ucmVhZHlQcm9taXNlLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkobi5nZXRHVkxWZW5kb3JzRGF0YSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgbyAmJiBvbygnTGFzdCBjaGFuZ2VkICcuY29uY2F0KG8pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYKICAgICAgICAgICAgICAgICAgICAgICAgXSksIHQgPSAnJywgciA9PT0gYm8uR0RQUiAmJiB2ICYmIGggJiYgRSA/IHQgPSBRZS5hLmNyZWF0ZUVsZW1lbnQobG8sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcmVDb25maWc6IHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JlVWlMYWJlbHM6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBub25JYWJEYXRhOiBoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yc0RhdGE6IHYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50R3JvdXBIYW5kbGVyOiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0QWxsTGVnaXRpbWF0ZXNUbzogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZW1pdW1VaUxhYmVsczogZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50VHJhY2tlcjogcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvb2dsZVZlbmRvcnM6IEUKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiByID09PSBiby5VU1AgJiYgKHQgPSBRZS5hLmNyZWF0ZUVsZW1lbnQobW8sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcmVDb25maWc6IHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVtaXVtVWlMYWJlbHM6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudFRyYWNrZXI6IHAKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBRZS5hLmNyZWF0ZUVsZW1lbnQoUWUuYS5GcmFnbWVudCwgbnVsbCwgdCwgUWUuYS5jcmVhdGVFbGVtZW50KEVvLCBudWxsKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgeG8gPSBuKDU0KTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFNvKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IG4gJiYgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQobik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8gfHwgKG8gPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KGUpLCB0ICYmIChvLmNsYXNzTmFtZSA9IHQpLCBuICYmIChvLmlkID0gbiksIHIgJiYgci5pbnNlcnRCZWZvcmUobywgci5maXJzdENoaWxkKSksIG87CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgQ28gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5jb3JlQ29uZmlnLCBuID0gdC5wdWJsaXNoZXJGZWF0dXJlc0lkcywgciA9IHQucHVibGlzaGVyU3BlY2lhbEZlYXR1cmVzSWRzLCBvID0gdC5wdWJsaXNoZXJTcGVjaWFsUHVycG9zZXNJZHMsIGkgPSB0LnB1Ymxpc2hlclB1cnBvc2VJZHMsIGEgPSB0LnB1Ymxpc2hlclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMsIHMgPSB0LnZlbmRvclB1cnBvc2VJZHMsIGMgPSB0LnZlbmRvclB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMsIHUgPSB0LnZlbmRvclNwZWNpYWxGZWF0dXJlc0lkcywgbCA9IHQudmVuZG9yU3BlY2lhbFB1cnBvc2VzSWRzLCBmID0gdC52ZW5kb3JGZWF0dXJlc0lkcywgcCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYKICAgICAgICAgICAgICAgICAgICAgICAgXSwgZCA9IChzIHx8IFtdKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgKHQgPSBlKSAmJiB0LnNvcnQoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIC0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgcHVycG9zZUlkczogKGQgPyBzIDogaSkgfHwgW10sCiAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHM6IChkID8gYyA6IGEpIHx8IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsRmVhdHVyZXNJZHM6IChkID8gdSA6IHIpIHx8IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsUHVycG9zZXNJZHM6IChkID8gbCA6IG8pIHx8IFtdLAogICAgICAgICAgICAgICAgICAgICAgICBmZWF0dXJlc0lkczogKGQgPyBmIDogbikgfHwgW10KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHZhciBrbywgVG8sIF9vLCBQbywgT28sIElvLCBMbywgQW8sIFJvID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsKHRoaXMsIGUpLCB0aGlzLl9kYXRhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZWF0dXJlczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2l0aW1hdGVQdXJwb3Nlczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2l0aW1hdGVWZW5kb3JzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVycG9zZXM6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsUHVycG9zZXM6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFja3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsRmVhdHVyZXM6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bmZpbHRlcmVkU3BlY2lhbFB1cnBvc2VzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5maWx0ZXJlZFNwZWNpYWxGZWF0dXJlczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuZmlsdGVyZWRQdXJwb3Nlczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuZmlsdGVyZWRGZWF0dXJlczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvcnM6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gT3QuU1RBQ0tTLCBvID0gT3QuU1BFQ0lBTF9GRUFUVVJFUywgaSA9IE90LlNQRUNJQUxfUFVSUE9TRVMsIGEgPSBPdC5GRUFUVVJFUywgcyA9IHQuc3RhY2tzLCBjID0gdC5mZWF0dXJlcywgdSA9IHQucHVycG9zZXMsIGYgPSB0LnZlbmRvcnMsIHAgPSB0LnNwZWNpYWxQdXJwb3NlcywgaCA9IHQuc3BlY2lhbEZlYXR1cmVzLCBnID0gQ28obiksIHYgPSBnLnNwZWNpYWxGZWF0dXJlc0lkcywgeSA9IGcuc3BlY2lhbFB1cnBvc2VzSWRzLCBiID0gZy5mZWF0dXJlc0lkcywgRSA9IG4uY29yZUNvbmZpZywgdyA9IEUuc3RhY2tzLCB4ID0gRS5wdWJsaXNoZXJQdXJwb3NlSWRzLCBTID0gRS5wdWJsaXNoZXJQdXJwb3NlTGVnaXRpbWF0ZUludGVyZXN0SWRzLCBDID0gRS5wdWJsaXNoZXJGZWF0dXJlc0lkcywgayA9IEUucHVibGlzaGVyU3BlY2lhbEZlYXR1cmVzSWRzLCBUID0gRS5wdWJsaXNoZXJTcGVjaWFsUHVycG9zZXNJZHMsIF8gPSBFLmNvbnNlbnRTY29wZSwgUCA9IG4uY29yZUNvbmZpZy5wdWJsaXNoZXJOYW1lIHx8IG4uY29yZUNvbmZpZy5jb29raWVEb21haW4gfHwgJycsIE8gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogUCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IFAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsUHVycG9zZXM6IFQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZWF0dXJlczogQywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsZXhpYmxlUHVycG9zZXM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVnSW50UHVycG9zZXM6IFMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsRmVhdHVyZXM6IGssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXJwb3NlczogeAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBJID0gZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTy5wdXJwb3NlcyB8fCBPLmxlZ0ludFB1cnBvc2VzKSAmJiAoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2VydmljZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzZXJ2aWNlIGdyb3VwJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uaW5jbHVkZXMoXyB8fCAnJykgPyBJID0gbShkKHt9LCBQLCBPKSwgZikgOiBjb25zb2xlLndhcm4oJ1lvdSBjYW5cJ3QgdXNlIHB1Ymxpc2hlciBsZWdhbCBiYXNpcyBvbiAnLmNvbmNhdChfLCAnIGNvbnNlbnQgc2NvcGUuJykpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgTCA9IHRoaXMuZmlsdGVyVmVuZG9ycyhJLCBuKSwgQSA9IEwudmVuZG9ycywgUiA9IEwubGVnaXRpbWF0ZVZlbmRvcnMsIE4gPSB0aGlzLmZpbHRlclN0YWNrc0FuZFNwZWNpYWwodyB8fCBbXSwgciwgcykuc3RhY2tzLCBqID0gdGhpcy5maWx0ZXJQdXJwb3Nlcyh1LCBuKSwgcSA9IGoucHVycG9zZXMsIEYgPSBqLmxlZ2l0aW1hdGVQdXJwb3NlcywgRCA9IHRoaXMuZmlsdGVyU3RhY2tzQW5kU3BlY2lhbChiLCBhLCBjKS5mZWF0dXJlcywgTSA9IHRoaXMuZmlsdGVyU3RhY2tzQW5kU3BlY2lhbCh2LCBvLCBoKS5zcGVjaWFsRmVhdHVyZXMsIFUgPSB0aGlzLmZpbHRlclN0YWNrc0FuZFNwZWNpYWwoeSwgaSwgcCkuc3BlY2lhbFB1cnBvc2VzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2RhdGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YWNrczogTiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yczogQSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmVhdHVyZXM6IEQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VzOiBxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGVjaWFsRmVhdHVyZXM6IE0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxQdXJwb3NlczogVSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVnaXRpbWF0ZVZlbmRvcnM6IFIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZ2l0aW1hdGVQdXJwb3NlczogRiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5maWx0ZXJlZEZlYXR1cmVzOiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bmZpbHRlcmVkUHVycG9zZXM6IHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuZmlsdGVyZWRTcGVjaWFsRmVhdHVyZXM6IGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuZmlsdGVyZWRTcGVjaWFsUHVycG9zZXM6IHAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdmaWx0ZXJWZW5kb3JzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBDbyh0KSwgciA9IG4ucHVycG9zZUlkcywgbyA9IG4ucHVycG9zZUxlZ2l0aW1hdGVJbnRlcmVzdElkcywgaSA9IE90LlZFTkRPUlMsIGEgPSBPdC5MRUdJVElNQVRFX1ZFTkRPUlMsIHMgPSB7fSwgYyA9IHQuY29yZUNvbmZpZy5wdWJsaXNoZXJDb25zZW50UmVzdHJpY3Rpb25JZHMgfHwgW10sIHUgPSB0LmNvcmVDb25maWcucHVibGlzaGVyTElSZXN0cmljdGlvbklkcyB8fCBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc1tpXSA9IHt9LCBzW2FdID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZVt0XSwgbCA9IG4ubGVnSW50UHVycG9zZXMsIGYgPSBuLnB1cnBvc2VzLCBwID0gbi5mbGV4aWJsZVB1cnBvc2VzLCBkID0gbi5pZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwubGVuZ3RoID4gMCAmJiAobC5zb21lKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuaW5jbHVkZXMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSB8fCBsLnNvbWUoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5pbmNsdWRlcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSAmJiAoc1thXVt0XSA9IG4pLCBmLmxlbmd0aCA+IDAgJiYgKGYuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmluY2x1ZGVzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgfHwgZi5zb21lKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8uaW5jbHVkZXMoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkgJiYgKHNbaV1bdF0gPSBuKSwgcC5sZW5ndGggPiAwICYmIChwLnNvbWUoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5pbmNsdWRlcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIHx8IHAuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1LmluY2x1ZGVzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpICYmIHAuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjLmluY2x1ZGVzKGUpIHx8IHUuaW5jbHVkZXMoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuZXcgeG8uUHVycG9zZVJlc3RyaWN0aW9uKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVycG9zZUlkID0gZSwgdC5yZXN0cmljdGlvblR5cGUgPSBjLmluY2x1ZGVzKGUpID8geG8uUmVzdHJpY3Rpb25UeXBlLlJFUVVJUkVfTEkgOiB4by5SZXN0cmljdGlvblR5cGUuUkVRVUlSRV9DT05TRU5ULCB3aW5kb3cuX190Y2ZhcGkoJ3NldFB1Ymxpc2hlclJlc3RyaWN0aW9uJywgMiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9vKCdTZXR0aW5nIHB1Ymxpc2hlciByZXN0cmljdGlvbiAtIFZlbmRvcjogJy5jb25jYXQoZCwgJyBQdXJwb3NlOiAnKS5jb25jYXQoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VSZXN0cmljdGlvbjogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbChmKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9vKCdSZWd1bGFyIHZlbmRvcnMgbG9hZGVkOiAnLmNvbmNhdChPYmplY3Qua2V5cyhzW2ldKS5sZW5ndGgpKSwgb28oJ0xlZ2l0aW1hdGUgdmVuZG9ycyBsb2FkZWQ6ICcuY29uY2F0KE9iamVjdC5rZXlzKHNbYV0pLmxlbmd0aCkpLCBzW2ldID0gSlNPTi5wYXJzZShKU09OLnN0cmluZ2lmeShzW2ldKSksIHNbYV0gPSBKU09OLnBhcnNlKEpTT04uc3RyaW5naWZ5KHNbYV0pKSwgczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2ZpbHRlclB1cnBvc2VzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LmNvcmVDb25maWcuY29uc2VudFNjb3BlLCByID0gQ28odCksIG8gPSByLnB1cnBvc2VJZHMsIGkgPSByLnB1cnBvc2VMZWdpdGltYXRlSW50ZXJlc3RJZHMsIGEgPSBPdC5QVVJQT1NFUywgcyA9IE90LkxFR0lUSU1BVEVfUFVSUE9TRVMsIGMgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNbYV0gPSB7fSwgY1tzXSA9IHt9LCBvLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuaW5jbHVkZXModCkgJiYgMSAhPT0gdCAmJiAoY1tzXVt0XSA9IG0oe30sIGVbdF0pKSwgY1thXVt0XSA9IG0oe30sIGVbdF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgIWNbYV1bMV0gJiYgKG4gfHwgJycpLmluY2x1ZGVzKCdnbG9iYWwnKSAmJiAoY1thXVsxXSA9IG0oe30sIGVbMV0pKSwgYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2ZpbHRlclN0YWNrc0FuZFNwZWNpYWwnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gclt0XSA9IHt9LCBlLmxlbmd0aCAmJiBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbdF1bZV0gPSBuW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3VwZGF0ZVN0YXR1cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2RhdGFbdF1bZV0uc3RhdHVzID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2RhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fZGF0YSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBdKSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCksIE5vID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbCh0aGlzLCBlKSwgdGhpcy5fY21wSW5mbyA9IHZvaWQgMCwgdGhpcy5fbm9uSWFiQ29uc2VudHMgPSB2b2lkIDAsIHRoaXMuX3ZlbmRvckNvbnNlbnRzID0gdm9pZCAwLCB0aGlzLl92ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3QgPSB2b2lkIDAsIHRoaXMuX3B1cnBvc2VzQ29uc2VudHMgPSB2b2lkIDAsIHRoaXMuX2xlZ2l0aW1hdGVQdXJwb3Nlc0NvbnNlbnRzID0gdm9pZCAwLCB0aGlzLl9zdGFja3NDb25zZW50cyA9IHZvaWQgMCwgdGhpcy5fc3BlY2lhbFB1cnBvc2VzQ29uc2VudHMgPSB2b2lkIDAsIHRoaXMuX3NwZWNpYWxGZWF0dXJlc0NvbnNlbnRzID0gdm9pZCAwLCB0aGlzLl9nb29nbGVDb25zZW50cyA9IHZvaWQgMCwgdGhpcy5zZXNzaW9uSWQgPSB2b2lkIDAsIHRoaXMuYWxsQ29uc2VudHMgPSB2b2lkIDAsIHRoaXMuZGlzcGxheVR5cGUgPSB2b2lkIDAsIHRoaXMuX25vbklhYlZlbmRvcnNJbml0aWFsaXplZCA9ICExLCB0aGlzLl9nb29nbGVWZW5kb3JzSW5pdGlhbGl6ZWQgPSAhMSwgdGhpcy5fR1ZMVmVuZG9yc0RhdGFJbml0aWFsaXplZCA9ICExLCB0aGlzLl9ub25JYWJDb25zZW50cyA9IHt9LCB0aGlzLl92ZW5kb3JDb25zZW50cyA9IHt9LCB0aGlzLl9wdXJwb3Nlc0NvbnNlbnRzID0ge30sIHRoaXMuX2xlZ2l0aW1hdGVQdXJwb3Nlc0NvbnNlbnRzID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDY6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDc6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDg6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDk6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5fc3RhY2tzQ29uc2VudHMgPSB7fSwgdGhpcy5fc3BlY2lhbFB1cnBvc2VzQ29uc2VudHMgPSB7fSwgdGhpcy5fdmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0ID0ge30sIHRoaXMuX3NwZWNpYWxGZWF0dXJlc0NvbnNlbnRzID0ge30sIHRoaXMuX2dvb2dsZUNvbnNlbnRzID0ge30sIHRoaXMuY29uc2VudEdyb3VwSGFuZGxlciA9IHRoaXMuY29uc2VudEdyb3VwSGFuZGxlci5iaW5kKHRoaXMpLCB0aGlzLnNldEFsbExlZ2l0aW1hdGVzVG8gPSB0aGlzLnNldEFsbExlZ2l0aW1hdGVzVG8uYmluZCh0aGlzKSwgdGhpcy5hbGxDb25zZW50cyA9ICEwLCB0aGlzLnNlc3Npb25JZCA9ICcnLCB0aGlzLmRpc3BsYXlUeXBlID0gU3QuQ0hBTkdFX09GX0NPTlNFTlQsIHRoaXMuX2NtcEluZm8gPSBuZXcgUm8oT28sIFBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcChlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0Q29yZUNvbmZpZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBvLmNvcmVDb25maWc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXRQcmVtaXVtVWlMYWJlbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQby5wcmVtaXVtVWlMYWJlbHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXRDb3JlVWlMYWJlbHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBQby5jb3JlVWlMYWJlbHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXREaXNwbGF5VHlwZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZGlzcGxheVR5cGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXROb25JYWJEYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IEN0Lk5PTl9JQUI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnBvcHVsYXRlQ29uc2VudHMoIXRoaXMuX25vbklhYlZlbmRvcnNJbml0aWFsaXplZCwgZSwgTG8sIElvKSwgdGhpcy5fbm9uSWFiVmVuZG9yc0luaXRpYWxpemVkIHx8ICh0aGlzLl9ub25JYWJWZW5kb3JzSW5pdGlhbGl6ZWQgPSAhMCksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRW5hYmxlZDogISFQby5wcmVtaXVtUHJvcGVydGllcy5ub25JYWJWZW5kb3JMaXN0VXJsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVuZG9yczogTG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldEdvb2dsZVZlbmRvcnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gQ3QuR09PR0xFOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wb3B1bGF0ZUNvbnNlbnRzKCF0aGlzLl9nb29nbGVWZW5kb3JzSW5pdGlhbGl6ZWQsIGUsIEFvLCBJbyksIHRoaXMuX2dvb2dsZVZlbmRvcnNJbml0aWFsaXplZCB8fCAodGhpcy5fZ29vZ2xlVmVuZG9yc0luaXRpYWxpemVkID0gITApLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0VuYWJsZWQ6IFBvLmNvcmVDb25maWcuZ29vZ2xlRW5hYmxlZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IEFvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXRHVkxWZW5kb3JzRGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBDdC5WRU5ET1JTLCB0ID0gQ3QuTEVHSVRJTUFURV9WRU5ET1JTLCBuID0gQ3QuTEVHSVRJTUFURV9QVVJQT1NFUywgciA9IEN0LlBVUlBPU0VTLCBvID0gQ3QuU1BFQ0lBTF9GRUFUVVJFUywgaSA9IEN0LlNUQUNLUywgYSA9ICF0aGlzLl9HVkxWZW5kb3JzRGF0YUluaXRpYWxpemVkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wb3B1bGF0ZUNvbnNlbnRzKGEsIGUsIHRoaXMuX2NtcEluZm8uZGF0YS52ZW5kb3JzLCBJbyksIHRoaXMucG9wdWxhdGVDb25zZW50cyhhLCByLCB0aGlzLl9jbXBJbmZvLmRhdGEucHVycG9zZXMsIElvKSwgdGhpcy5wb3B1bGF0ZUNvbnNlbnRzKGEsIG8sIHRoaXMuX2NtcEluZm8uZGF0YS5zcGVjaWFsRmVhdHVyZXMsIElvKSwgdGhpcy5wb3B1bGF0ZUNvbnNlbnRzKGEsIHQsIHRoaXMuX2NtcEluZm8uZGF0YS5sZWdpdGltYXRlVmVuZG9ycywgSW8pLCB0aGlzLnBvcHVsYXRlQ29uc2VudHMoYSwgbiwgdGhpcy5fY21wSW5mby5kYXRhLmxlZ2l0aW1hdGVQdXJwb3NlcywgSW8pLCB0aGlzLnBvcHVsYXRlQ29uc2VudHMoITAsIGksIHRoaXMuX2NtcEluZm8uZGF0YS5zdGFja3MsIElvKSwgdGhpcy5wb3B1bGF0ZVN0YWNrc0xhYmVscyh0aGlzLl9jbXBJbmZvLmRhdGEuc3RhY2tzKSwgdGhpcy5fR1ZMVmVuZG9yc0RhdGFJbml0aWFsaXplZCA9ICEwLCB0aGlzLl9jbXBJbmZvLmRhdGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdwb3B1bGF0ZVN0YWNrc0xhYmVscycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcywgbiA9IFBvLmNvcmVVaUxhYmVscywgciA9IG4ub25MYWJlbCwgbyA9IG4ub2ZmTGFiZWwsIGkgPSBuLm11bHRpTGFiZWw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgaW4gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBlW2FdLCBjID0gcy5wdXJwb3Nlcy5yZWR1Y2UoZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgfHwgdC5fcHVycG9zZXNDb25zZW50c1tuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMSksIHUgPSAhIXMuc3BlY2lhbEZlYXR1cmVzICYmIHMuc3BlY2lhbEZlYXR1cmVzLnJlZHVjZShmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSB8fCB0Ll9zcGVjaWFsRmVhdHVyZXNDb25zZW50c1tuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMSksIGwgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsID0gdGhpcy5fc3RhY2tzQ29uc2VudHNbYV0gPyByIDogYyB8fCB1ID8gaSA6IG8sIHMuc3RhdGVMYWJlbCA9IGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldEFsbENvbnNlbnRzVG8nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl92ZW5kb3JDb25zZW50cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9wdXJwb3Nlc0NvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3N0YWNrc0NvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3NwZWNpYWxGZWF0dXJlc0NvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX25vbklhYkNvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2dvb2dsZUNvbnNlbnRzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBuID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2NtcEluZm8uZGF0YS5wdXJwb3NlcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9jbXBJbmZvLmRhdGEudmVuZG9ycywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9jbXBJbmZvLmRhdGEuc3BlY2lhbEZlYXR1cmVzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9ub25JYWJWZW5kb3JzSW5pdGlhbGl6ZWQgJiYgTG8ubGVuZ3RoICYmIG4ucHVzaChMbyksIHRoaXMuX2dvb2dsZVZlbmRvcnNJbml0aWFsaXplZCAmJiBBby5sZW5ndGggJiYgbi5wdXNoKEFvKSwgZSAmJiB0LmNvbmNhdCh0aGlzLl9sZWdpdGltYXRlUHVycG9zZXNDb25zZW50cywgdGhpcy5fdmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgciA9IDAsIG8gPSB0OyByIDwgby5sZW5ndGg7IHIrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBvW3JdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSBpbiBpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlbYV0gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbbl0uc3RhdHVzID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIE9iamVjdC5rZXlzKHRoaXMuX2NtcEluZm8uZGF0YS5zdGFja3MpLmxlbmd0aCAmJiAodGhpcy51cGRhdGVTdGFja3NDb25zZW50KCksIHRoaXMucG9wdWxhdGVTdGFja3NMYWJlbHModGhpcy5fY21wSW5mby5kYXRhLnN0YWNrcykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0QWxsTGVnaXRpbWF0ZXNUbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0geHQuQUNDRVBUX0FMTF9MRUdJVElNQVRFLCBuID0geHQuT0JKRUNUX0FMTF9MRUdJVElNQVRFLCByID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX2xlZ2l0aW1hdGVQdXJwb3Nlc0NvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3ZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgbyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9jbXBJbmZvLmRhdGEubGVnaXRpbWF0ZVZlbmRvcnMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fY21wSW5mby5kYXRhLmxlZ2l0aW1hdGVQdXJwb3NlcwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5ldmVudFRyYWNrZXIoZSA/IHQgOiBuLCAnY2xpY2snKSwgci5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtuXSA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W25dLnN0YXR1cyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBRby5kaXNwYXRjaChZbygnYWxsTGVnaXRpbWF0ZXMtJy5jb25jYXQoZSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2NvbnNlbnRHcm91cEhhbmRsZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFsbENvbnNlbnRzID0gdCwgdm9pZCAwICE9PSB0ICYmIHRoaXMuc2V0QWxsQ29uc2VudHNUbyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZW5kb3JDb25zZW50czogdGhpcy52ZW5kb3JDb25zZW50cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1cnBvc2VzQ29uc2VudHM6IHRoaXMucHVycG9zZXNDb25zZW50cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwZWNpYWxGZWF0dXJlczogdGhpcy5zcGVjaWFsRmVhdHVyZXNDb25zZW50cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdDogdGhpcy52ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3QsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlUHVycG9zZXNDb25zZW50czogdGhpcy5sZWdpdGltYXRlUHVycG9zZXNDb25zZW50cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYkNvbnNlbnRzOiB0aGlzLm5vbklhYkNvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ29vZ2xlQ29uc2VudHM6IHRoaXMuX2dvb2dsZUNvbnNlbnRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2VudFNjcmVlbjogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbENvbnNlbnRzOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFFvLmRpc3BhdGNoKFdvKHsgcmVndWxhdGlvbjogJ0dEUFInIH0pKSwgd2luZG93Ll9fdGNmYXBpKCdzZXRDb25zZW50SW5mbycsIDIsIHRoaXMuaGFuZGxlU2V0Q29uc2VudEluZm9DYWxsYmFjay5iaW5kKHRoaXMpLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ25vdGlmeVVpQ2xvc2VkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93Ll9fdGNmYXBpKCdub3RpZnlVaVN0YXRlJywgMiwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWd1bGF0aW9uOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlzaWJsZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdoYW5kbGVTZXRDb25zZW50SW5mb0NhbGxiYWNrJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB4dC5BQ0NFUFRfQUxMLCBuID0geHQuU0FWRV9BTkRfRVhJVCwgciA9IHh0LlJFSkVDVF9BTEw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZXZlbnRUcmFja2VyKHZvaWQgMCAhPT0gdGhpcy5hbGxDb25zZW50cyA/IHRoaXMuYWxsQ29uc2VudHMgPyB0IDogciA6IG4sICdjbGljaycpLCBUby5zZW5kRG9uZUxvZyh0aGlzLmFsbENvbnNlbnRzLCBlLmV1Y29uc2VudCwgZS5ub25JYWJDb29raWVWYWx1ZSksIFBvLmNvcmVDb25maWcuaXNBTVAgJiYgd2luZG93LnBhcmVudC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBJdC5DT05TRU5UX1JFU1BPTlNFLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiB2b2lkIDAgIT09IHRoaXMuYWxsQ29uc2VudHMgPyB0aGlzLmFsbENvbnNlbnRzID8gTHQuQUNDRVBUIDogTHQuUkVKRUNUIDogTHQuQUNDRVBULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5mbzogZS5ldWNvbnNlbnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50TWV0YWRhdGE6IHsgYWRkaXRpb25hbENvbnNlbnQ6IGUuZ29vZ2xlQ29va2llVmFsdWUgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAnKicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAncG9wdWxhdGVDb25zZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0LCBuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvLCBpID0gQ3QuTk9OX0lBQiwgYSA9IEN0LlBVUlBPU0VTLCBzID0gQ3QuTEVHSVRJTUFURV9QVVJQT1NFUywgYyA9IEN0LkxFR0lUSU1BVEVfVkVORE9SUywgbCA9IEN0LlZFTkRPUlMsIGYgPSBDdC5TUEVDSUFMX0ZFQVRVUkVTLCBwID0gQ3QuU1RBQ0tTLCBkID0gQ3QuR09PR0xFLCBoID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGk6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gJ19ub25JYWJDb25zZW50cycsIGggPSAnbm9uSWFiQ29uc2VudHMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgbDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSAnX3ZlbmRvckNvbnNlbnRzJywgaCA9ICd2ZW5kb3JDb25zZW50cyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBhOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICdfcHVycG9zZXNDb25zZW50cycsIGggPSAncHVycG9zZXNDb25zZW50cyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICdfbGVnaXRpbWF0ZVB1cnBvc2VzQ29uc2VudHMnLCBoID0gJ2xlZ2l0aW1hdGVQdXJwb3Nlc0NvbnNlbnRzJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gJ192ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3QnLCBoID0gJ3ZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBmOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICdfc3BlY2lhbEZlYXR1cmVzQ29uc2VudHMnLCBoID0gJ3NwZWNpYWxGZWF0dXJlcyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBwOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9ICdfc3RhY2tzQ29uc2VudHMnLCBoID0gJ3B1cnBvc2VzQ29uc2VudHMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSAnX2dvb2dsZUNvbnNlbnRzJywgaCA9ICdnb29nbGVDb25zZW50cyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IHJbaF0uaGFzQ29va2llLCBnID0gdCA9PT0gcyB8fCB0ID09PSBjIHx8ICdvbicgPT09IFBvLmNvcmVDb25maWcuZGVmYXVsdFRvZ2dsZVZhbHVlLCB2ID0gIW0gfHwgdCA9PT0gcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPT09IGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHksIGIgPSB1KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYi5zKCk7ICEoeSA9IGIubigpKS5kb25lOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEUgPSB5LnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdyA9IHYgPyBnIDogcltoXVtFLmlkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzW29dW0UuaWRdID0gQm9vbGVhbih3KSwgRS5zdGF0dXMgPSBCb29sZWFuKHcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRS5zdGF0dXMgPSB0aGlzW29dW0UuaWRdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoTykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLmUoTyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5mKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHQgPT09IGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHgsIFMgPSB1KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoUy5zKCk7ICEoeCA9IFMubigpKS5kb25lOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEMgPSB4LnZhbHVlLCBrID0gcGFyc2VJbnQoQy5pZCwgMTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgVCA9IHYgPyBnIDogcltoXVtrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzW29dW2tdID0gVCwgQy5zdGF0dXMgPSBUOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQy5zdGF0dXMgPSB0aGlzW29dW2tdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoTykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTLmUoTyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUy5mKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgXyBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBQID0gdiA/IGcgOiByW2hdW19dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzW29dW19dID0gUCwgbltfXS5zdGF0dXMgPSBQOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW19dLnN0YXR1cyA9IHRoaXNbb11bX107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID09PSBwICYmIG0gJiYgdGhpcy51cGRhdGVTdGFja3NDb25zZW50KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2hhbmRsZUNvbnNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciwgbywgaSwgYSA9IHh0LlZFTkRPUiwgcyA9IHh0LlBVUlBPU0UsIGMgPSB4dC5MRUdJVElNQVRFX1BVUlBPU0UsIHUgPSB4dC5OT05fSUFCX1ZFTkRPUiwgbCA9IHh0LlNQRUNJQUxfRkVBVFVSRSwgZiA9IHh0LlNUQUNLLCBwID0geHQuTEVHSVRJTUFURV9WRU5ET1IsIGQgPSB4dC5HT09HTEUsIGggPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3QuTk9OX0lBQjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAnX25vbklhYkNvbnNlbnRzJywgaSA9IExvLCByID0gJycuY29uY2F0KHUsICdfJykuY29uY2F0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3QuVkVORE9SUzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAnX3ZlbmRvckNvbnNlbnRzJywgbyA9ICd2ZW5kb3JzJywgciA9ICcnLmNvbmNhdChhLCAnXycpLmNvbmNhdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN0LlBVUlBPU0VTOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICdfcHVycG9zZXNDb25zZW50cycsIG8gPSAncHVycG9zZXMnLCByID0gJycuY29uY2F0KHMsICdfJykuY29uY2F0KGUpLCBoID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdC5MRUdJVElNQVRFX1BVUlBPU0VTOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICdfbGVnaXRpbWF0ZVB1cnBvc2VzQ29uc2VudHMnLCBvID0gJ2xlZ2l0aW1hdGVQdXJwb3NlcycsIHIgPSAnJy5jb25jYXQoYywgJ18nKS5jb25jYXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdC5MRUdJVElNQVRFX1ZFTkRPUlM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gJ192ZW5kb3JMZWdpdGltYXRlSW50ZXJlc3QnLCBvID0gJ2xlZ2l0aW1hdGVWZW5kb3JzJywgciA9ICcnLmNvbmNhdChwLCAnXycpLmNvbmNhdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN0LlNQRUNJQUxfRkVBVFVSRVM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gJ19zcGVjaWFsRmVhdHVyZXNDb25zZW50cycsIG8gPSAnc3BlY2lhbEZlYXR1cmVzJywgciA9ICcnLmNvbmNhdChsLCAnXycpLmNvbmNhdChlKSwgaCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3QuU1BFQ0lBTF9QVVJQT1NFUzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAnX3NwZWNpYWxQdXJwb3Nlc0NvbnNlbnRzJywgbyA9ICdzcGVjaWFsUHVycG9zZXMnLCByID0gJycuY29uY2F0KGwsICdfJykuY29uY2F0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3QuU1RBQ0tTOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICdfc3RhY2tzQ29uc2VudHMnLCBvID0gJ3N0YWNrcycsIHIgPSAnJy5jb25jYXQoZiwgJ18nKS5jb25jYXQoZSksIGggPSAhMCwgdGhpcy5oYW5kbGVTdGFja0NvbnNlbnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdC5HT09HTEU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gJ19nb29nbGVDb25zZW50cycsIGkgPSBBbywgciA9ICcnLmNvbmNhdChkLCAnXycpLmNvbmNhdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzW25dKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9ICF0aGlzW25dW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbXQoaS5maWx0ZXIoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuaWQgPT09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIDEpWzBdLnN0YXR1cyA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fY21wSW5mby51cGRhdGVTdGF0dXMoZSwgbywgbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzW25dW2VdID0gbSwgdGhpcy5ldmVudFRyYWNrZXIociwgdGhpc1tuXVtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXModGhpcy5fY21wSW5mby5kYXRhLnN0YWNrcykubGVuZ3RoICYmIGggJiYgdGhpcy5wb3B1bGF0ZVN0YWNrc0xhYmVscyh0aGlzLl9jbXBJbmZvLmRhdGEuc3RhY2tzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2xpbmtWZW5kb3JzVG9QdXJwb3NlcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLCB0ID0gT28udmVuZG9ycywgbiA9IE9iamVjdC5rZXlzKHRoaXMuX3B1cnBvc2VzQ29uc2VudHMpLmZpbHRlcihmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gZS5fcHVycG9zZXNDb25zZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByID0gZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtyXS5wdXJwb3Nlcy5pbmNsdWRlcyhwYXJzZUludChuLCAxMCkpICYmIChlLl92ZW5kb3JDb25zZW50c1tyXSA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3ZlbmRvckNvbnNlbnRzW29dID0gITEsIG4ubGVuZ3RoICYmIHIobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdsaW5rUHVycG9zZXNUb1ZlbmRvcnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcywgdCA9IE9vLnZlbmRvcnMsIG4gPSBPYmplY3Qua2V5cyh0aGlzLl92ZW5kb3JDb25zZW50cykuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBlLl92ZW5kb3JDb25zZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByID0gT2JqZWN0LmtleXModGhpcy5fcHVycG9zZXNDb25zZW50cykuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBlLl9wdXJwb3Nlc0NvbnNlbnRzW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ubGVuZ3RoID8gci5sZW5ndGggfHwgbi5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W25dLnB1cnBvc2VzLmZvckVhY2goZnVuY3Rpb24gKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W25dLnB1cnBvc2VzLmluY2x1ZGVzKHIpICYmIChlLl9wdXJwb3Nlc0NvbnNlbnRzW3JdID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCBpbiBlLl9wdXJwb3Nlc0NvbnNlbnRzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX3B1cnBvc2VzQ29uc2VudHNbdF0gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnbGlua0NvbnNlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ19wdXJwb3Nlc0NvbnNlbnRzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnX3N0YWNrc0NvbnNlbnRzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubGlua1ZlbmRvcnNUb1B1cnBvc2VzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnX3ZlbmRvckNvbnNlbnRzJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubGlua1B1cnBvc2VzVG9WZW5kb3JzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2hhbmRsZVN0YWNrQ29uc2VudCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gT28uc3RhY2tzW2VdLCByID0gIXRoaXMuX3N0YWNrc0NvbnNlbnRzW2VdLCBvID0gdShuLnB1cnBvc2VzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoby5zKCk7ICEodCA9IG8ubigpKS5kb25lOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9wdXJwb3Nlc0NvbnNlbnRzW2ldID0gciwgdGhpcy5fY21wSW5mby51cGRhdGVTdGF0dXMoaSwgJ3B1cnBvc2VzJywgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uZShsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8uZigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLnNwZWNpYWxGZWF0dXJlcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEsIHMgPSB1KG4uc3BlY2lhbEZlYXR1cmVzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChzLnMoKTsgIShhID0gcy5uKCkpLmRvbmU7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fc3BlY2lhbEZlYXR1cmVzQ29uc2VudHNbY10gPSByLCB0aGlzLl9jbXBJbmZvLnVwZGF0ZVN0YXR1cyhjLCAnc3BlY2lhbEZlYXR1cmVzJywgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMuZShsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5mKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3VwZGF0ZVN0YWNrc0NvbnNlbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCBpbiB0aGlzLl9jbXBJbmZvLmRhdGEuc3RhY2tzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuX2NtcEluZm8uZGF0YS5zdGFja3NbdF0sIHIgPSBuLnB1cnBvc2VzLnJlZHVjZShmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiBlLl9wdXJwb3Nlc0NvbnNlbnRzW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKSwgbyA9ICFuLnNwZWNpYWxGZWF0dXJlc0NvbnNlbnRzIHx8IG4uc3BlY2lhbEZlYXR1cmVzLnJlZHVjZShmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiBlLl9zcGVjaWFsRmVhdHVyZXNDb25zZW50c1tuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLnN0YXR1cyA9IHIgJiYgbywgdGhpcy5fc3RhY2tzQ29uc2VudHNbdF0gPSBuLnN0YXR1czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZm9ybWF0Q29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW50QXJyYXk6IE9iamVjdC5rZXlzKGUpLm1hcChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gcGFyc2VJbnQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSByLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnQ6IGVbcl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiArbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1heFZlbmRvcklkOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdkaXNwbGF5Q29uc2VudFVpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IDEsIG4gPSBhcmd1bWVudHMubGVuZ3RoID4gMiAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1syXSAmJiBhcmd1bWVudHNbMl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdHRFBSJyA9PT0gZSA/ICh0aGlzLmRpc3BsYXlUeXBlID0gbiA/IFN0Lk1BTkRBVE9SWSA6IFN0LkNIQU5HRV9PRl9DT05TRU5ULCBRby5kaXNwYXRjaCgkbyh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25Jbml0OiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkpIDogJ1VTUCcgPT09IGUgJiYgKHRoaXMuZGlzcGxheVR5cGUgPSBTdC5DQ1BBLCB0ID0gMSksIFFvLmRpc3BhdGNoKFdvKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ3VsYXRpb246IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc01hbmRhdG9yeTogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSksIHRoaXMuZ2VuZXJhdGVTZXNzaW9uSWQoZSksIHRoaXMuZXZlbnRUcmFja2VyKHh0LlNUQVJUX09OX1BBR0UsICcnLmNvbmNhdChlLCAnXycpLmNvbmNhdCh0KSksIFRvLnNlbmRJbml0TG9nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZW5lcmF0ZVNlc3Npb25JZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gd2luZG93Lm5hdmlnYXRvci51c2VyQWdlbnQuaW5kZXhPZignVHJpZGVudC8nKSwgbiA9IG5ldyBJbnQzMkFycmF5KDQpLCByID0gJycuY29uY2F0KGUsICctJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gKC0xICE9PSB0ID8gbXNDcnlwdG8gOiBjcnlwdG8pLmdldFJhbmRvbVZhbHVlcyhuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gPSAwOyBvIDwgNDsgbysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgKz0gbltvXS50b1N0cmluZygzNikuc3Vic3RyaW5nKDEsIDYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXNzaW9uSWQgPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0U2Vzc2lvbklkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zZXNzaW9uSWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdldmVudFRyYWNrZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUby5wdXNoRXZlbnQoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdub25JYWJDb25zZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9ub25JYWJDb25zZW50czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fbm9uSWFiQ29uc2VudHMgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAndmVuZG9yQ29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fdmVuZG9yQ29uc2VudHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3ZlbmRvckNvbnNlbnRzID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3B1cnBvc2VzQ29uc2VudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fcHVycG9zZXNDb25zZW50czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fcHVycG9zZXNDb25zZW50cyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdsZWdpdGltYXRlUHVycG9zZXNDb25zZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9sZWdpdGltYXRlUHVycG9zZXNDb25zZW50czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fbGVnaXRpbWF0ZVB1cnBvc2VzQ29uc2VudHMgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAndmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3ZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fdmVuZG9yTGVnaXRpbWF0ZUludGVyZXN0ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3N0YWNrc0NvbnNlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3N0YWNrc0NvbnNlbnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9zdGFja3NDb25zZW50cyA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzcGVjaWFsRmVhdHVyZXNDb25zZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9zcGVjaWFsRmVhdHVyZXNDb25zZW50czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fc3BlY2lhbEZlYXR1cmVzQ29uc2VudHMgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnR1ZMVmVuZG9yc0RhdGFJbml0aWFsaXplZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9HVkxWZW5kb3JzRGF0YUluaXRpYWxpemVkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnY21wSW5mbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9jbXBJbmZvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9jbXBJbmZvID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0sIFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnaW5pdExhYmVscycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAkZShIZS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCByLCBvLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhlLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5wcmV2ID0gZS5uZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBQby5nZXRDdXN0b21Db3JlVWlMYWJlbHMoKSwgciA9IFBvLmdldEN1c3RvbVByZW1pdW1VaUxhYmVscygpLCBvID0gbigyOTgpLCAoaSA9IFBvLmNvcmVDb25maWcucHJpdmFjeU1vZGUpICYmIGkuaW5jbHVkZXMoJ0dEUFInKSAmJiAoUG8uY29yZVVpTGFiZWxzID0gbShtKHt9LCBvLmNvcmVVaUxhYmVscyksIHQpKSwgUG8ucHJlbWl1bVVpTGFiZWxzID0gbShtKHt9LCBvLnByZW1pdW1VaUxhYmVscyksIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2VuZCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKSwgam8gPSBZbi5hLmNyZWF0ZSh7IHhzcmZDb29raWVOYW1lOiBudWxsIH0pLCBxbyA9IHBhcnNlSW50KCcnLmNvbmNhdCgnMjMnKSksIEZvID0gWwogICAgICAgICAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgXSwgRG8gPSBOdW1iZXIuaXNOYU4ocW8pID8gMSA6IHFvLCBNbyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgVkVORE9SX0NPTlNFTlQ6ICdjbXBjb25zZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgTk9OSUFCVkVORE9SX0NPTlNFTlQ6ICdjbXBub25pYWInLAogICAgICAgICAgICAgICAgICAgICAgICBSRVBST01QVF9IQVNIOiAnY21wcmVwcm9tcHRoYXNoJwogICAgICAgICAgICAgICAgICAgIH0sIFVvID0gKG0obSh7fSwgTW8pLCB7fSwgewogICAgICAgICAgICAgICAgICAgICAgICBRVUFOVENBU1RfQUNDT1VOVF9JRDogJ2NtcGFjY291bnRpZCcsCiAgICAgICAgICAgICAgICAgICAgICAgIFJFRkVSUkVSOiAncmVmJwogICAgICAgICAgICAgICAgICAgIH0pLCBtKG0oe30sIE1vKSwge30sIHsKICAgICAgICAgICAgICAgICAgICAgICAgRElTUExBWV9VSTogJ2Rpc3BsYXljb25zZW50dWknLAogICAgICAgICAgICAgICAgICAgICAgICBMT0dHRURfSU46ICdjbXBsb2dnZWRpbicKICAgICAgICAgICAgICAgICAgICB9KSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbCh0aGlzLCBlKSwgdGhpcy51c2VyRXZlbnRzID0gdm9pZCAwLCB0aGlzLnVzZXJFdmVudHMgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcChlLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAncHVzaEV2ZW50JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb28oSlNPTi5zdHJpbmdpZnkoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWRlbnRpZmllcjogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSwgdGhpcy51c2VyRXZlbnRzLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50VGltZXN0YW1wOiBuZXcgRGF0ZSgpLmdldFRpbWUoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50OiAnJy5jb25jYXQoZSwgJzonKS5jb25jYXQodCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdyZXNvbHZlQWNjZXB0YW5jZVN0YXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBfdC5BQ0NFUFRfQUxMLCBuID0gX3QuQUNDRVBUX1BBUlRJQUwsIHIgPSBfdC5SRUpFQ1QsIG8gPSBQdC5BTExfT0JKRUNURUQsIGkgPSBQdC5OT05FX09CSkVDVEVELCBhID0gJ2xlZ2l0aW1hdGUnID09PSBlLCBzID0gYSA/IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QudmFsdWVzKGtvLmxlZ2l0aW1hdGVQdXJwb3Nlc0NvbnNlbnRzKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QudmFsdWVzKGtvLnZlbmRvckxlZ2l0aW1hdGVJbnRlcmVzdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uZmxhdCgpIDogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC52YWx1ZXMoa28ucHVycG9zZXNDb25zZW50cyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnZhbHVlcyhrby5zcGVjaWFsRmVhdHVyZXNDb25zZW50cyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnZhbHVlcyhrby52ZW5kb3JDb25zZW50cyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnZhbHVlcyhrby5ub25JYWJDb25zZW50cykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uZmxhdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5ldmVyeShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA/IGEgPyBpIDogdCA6IHMuZXZlcnkoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMSA9PT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgPyBhID8gbyA6IHIgOiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2VuZEluaXRMb2cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gUG8uY29yZUNvbmZpZywgdCA9IGUucXVhbnRjYXN0QWNjb3VudElkLCBuID0gZS5wdWJsaXNoZXJOYW1lLCByID0gZS5oYXNoQ29kZSwgbyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY2NvdW50SWQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluOiB3aW5kb3cubG9jYXRpb24uaG9zdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdWJsaXNoZXI6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wSWQ6IDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcFZlcnNpb246ICcyLicuY29uY2F0KERvKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5VHlwZToga28uZ2V0RGlzcGxheVR5cGUoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmF0aW9uSGFzaENvZGU6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nKFR0LklOSVQsIG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2VuZE5hdmlnYXRpb25Mb2cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0geyB1c2VyRXZlbnRzOiB0aGlzLnVzZXJFdmVudHMgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy51c2VyRXZlbnRzID0gW10sIHRoaXMubG9nKFR0Lk5BVklHQVRJT04sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2VuZERvbmVMb2cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGUgPyBfdC5BQ0NFUFRfQUxMIDogdGhpcy5yZXNvbHZlQWNjZXB0YW5jZVN0YXRlKCksIGkgPSBlID8gUHQuTk9ORV9PQkpFQ1RFRCA6IHRoaXMucmVzb2x2ZUFjY2VwdGFuY2VTdGF0ZSgnbGVnaXRpbWF0ZScpLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZXJFdmVudHM6IHRoaXMudXNlckV2ZW50cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY2NlcHRhbmNlU3RhdGU6IG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2JqZWN0aW9uU3RhdGU6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGNEYXRhOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbklhYkNvbnNlbnREYXRhOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzcERhdGE6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudXNlckV2ZW50cyA9IFtdLCB0aGlzLmxvZyhUdC5ET05FLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NlbmREb25lTG9nVXNwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VyRXZlbnRzOiB0aGlzLnVzZXJFdmVudHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY2NlcHRhbmNlU3RhdGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c3BEYXRhOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudXNlckV2ZW50cyA9IFtdLCB0aGlzLmxvZyhUdC5ET05FLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2xvZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBtKG0oe30sIHQpLCB7fSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50VGltZXN0YW1wOiBuZXcgRGF0ZSgpLmdldFRpbWUoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wZXJhdGlvblR5cGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uSWQ6IGtvLmdldFNlc3Npb25JZCgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGVuY29kZVVSSUNvbXBvbmVudChKU09OLnN0cmluZ2lmeSh0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpvLmdldCgnJy5jb25jYXQoJ2h0dHBzOi8vYXVkaXQtdGNmdjIucXVhbnRjYXN0Lm1nci5jb25zZW5zdS5vcmcnLCAnLz9sb2c9JykuY29uY2F0KG4pKS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNvbnNvbGUuZXJyb3IoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvbygnJy5jb25jYXQoZSwgJyBzZW50JykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpKSwgVm8gPSAvXiMoW1xkQS1GXXs2fXxbXGRBLUZdezN9KSQvaSwgQm8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsKHRoaXMsIGUpLCB0aGlzLl91eFByaW1hcnlCdXR0b25UZXh0Q29sb3IgPSB2b2lkIDAsIHRoaXMuX3V4UHJpbWFyeUJ1dHRvbkNvbG9yID0gdm9pZCAwLCB0aGlzLl91eFNlY29uZGFyeUJ1dHRvblRleHRDb2xvciA9IHZvaWQgMCwgdGhpcy5fdXhTZWNvbmRhcnlCdXR0b25Db2xvciA9IHZvaWQgMCwgdGhpcy5fdXhGb250Q29sb3IgPSB2b2lkIDAsIHRoaXMuX3V4QmFja2dyb3VuZENvbG9yID0gdm9pZCAwLCB0aGlzLl91eFRvb2dsZUFjdGl2ZUNvbG9yID0gdm9pZCAwLCB0aGlzLl91eExpbmtDb2xvciA9IHZvaWQgMCwgdGhpcy5fcHJpbWFyeUJ1dHRvbkhvdmVyQmFja2dyb3VuZCA9IHZvaWQgMCwgdGhpcy5fc2Vjb25kYXJ5QnV0dG9uSG92ZXJCYWNrZ3JvdW5kID0gdm9pZCAwLCB0aGlzLl9zZWNvbmRhcnlUZXh0Q29sb3IgPSB2b2lkIDAsIHRoaXMuX2xpZ2h0VGV4dENvbG9yID0gdm9pZCAwLCB0aGlzLl9saWdodGVzdFRleHRDb2xvciA9IHZvaWQgMCwgdGhpcy5fb3ZlcmxheUNvbG9yID0gdm9pZCAwLCB0aGlzLl9ib3JkZXJDb2xvciA9IHZvaWQgMCwgdGhpcy5fc3ViSGVhZGVyQ29sb3IgPSB2b2lkIDAsIHRoaXMuX3BlcnNpc3RlbnRDb25zZW50TGlua0NvbG9yID0gdm9pZCAwLCB0aGlzLl9wZXJzaXN0ZW50Q29uc2VudExpbmtUZXh0Q29sb3IgPSB2b2lkIDAsIHRoaXMuX3dhcm5pbmdCYWNrZ3JvdW5kQ29sb3IgPSB2b2lkIDAsIHRoaXMuX3dhcm5pbmdUZXh0Q29sb3IgPSB2b2lkIDAsIHRoaXMuX2ZvbnQgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFBvLnRoZW1lLCBuID0gdC51eFByaW1hcnlCdXR0b25Db2xvciwgciA9IHQudXhCYWNrZ3JvdW5kQ29sb3IsIG8gPSB0LnV4Rm9udENvbG9yLCBpID0gdC51eFByaW1hcnlCdXR0b25UZXh0Q29sb3IsIGEgPSB0LnV4U2Vjb25kYXJ5QnV0dG9uQ29sb3IsIHMgPSB0LnV4U2Vjb25kYXJ5QnV0dG9uVGV4dENvbG9yLCBjID0gdC51eFRvb2dsZUFjdGl2ZUNvbG9yLCB1ID0gdC51eExpbmtDb2xvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3V4UHJpbWFyeUJ1dHRvblRleHRDb2xvciA9IGksIHRoaXMuX3V4UHJpbWFyeUJ1dHRvbkNvbG9yID0gbiwgdGhpcy5fdXhTZWNvbmRhcnlCdXR0b25UZXh0Q29sb3IgPSBzLCB0aGlzLl91eFNlY29uZGFyeUJ1dHRvbkNvbG9yID0gYSwgdGhpcy5fdXhGb250Q29sb3IgPSBvLCB0aGlzLl91eEJhY2tncm91bmRDb2xvciA9IHIsIHRoaXMuX3V4VG9vZ2xlQWN0aXZlQ29sb3IgPSBjLCB0aGlzLl91eExpbmtDb2xvciA9IHUsIHRoaXMuX3ByaW1hcnlCdXR0b25Ib3ZlckJhY2tncm91bmQgPSBQbigwLjMsIHRoaXMuX3V4UHJpbWFyeUJ1dHRvbkNvbG9yKSwgdGhpcy5fc2Vjb25kYXJ5QnV0dG9uSG92ZXJCYWNrZ3JvdW5kID0gbiwgdGhpcy5fc3ViSGVhZGVyQ29sb3IgPSAnIzIxMjkzNCcsIHRoaXMuX3NlY29uZGFyeVRleHRDb2xvciA9ICcjNEQ1NDVEJywgdGhpcy5fbGlnaHRUZXh0Q29sb3IgPSAnIzdBN0Y4NScsIHRoaXMuX2xpZ2h0ZXN0VGV4dENvbG9yID0gJyNCN0I3QjcnLCB0aGlzLl9vdmVybGF5Q29sb3IgPSAncmdiYSgzMywgNDEsIDUyLCAwLjc1KScsIHRoaXMuX2JvcmRlckNvbG9yID0gJyNEOEQ4RDgnLCB0aGlzLl9wZXJzaXN0ZW50Q29uc2VudExpbmtDb2xvciA9ICcjMzY4QkQ2JywgdGhpcy5fcGVyc2lzdGVudENvbnNlbnRMaW5rVGV4dENvbG9yID0gJyNGRkYnLCB0aGlzLl93YXJuaW5nQmFja2dyb3VuZENvbG9yID0gJ3JnYmEoMjU1LCAyMjksIDE0MywgMC4zNSknLCB0aGlzLl93YXJuaW5nVGV4dENvbG9yID0gJyNGQUFEMTQnLCB0aGlzLl9mb250ID0gJ0hlbHZldGljYSwgQXJpYWwsIHNhbnMtc2VyaWYnOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwKGUsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdjaGVja1ZhbGlkSGV4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVm8udGVzdChlKSA/IHRoaXNbdF0gPSBlIDogY29uc29sZS53YXJuKCcnLmNvbmNhdChlLCAnIGlzIG5vdCBhIHZhbGlkIGhleCB2YWx1ZScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3V4TGlua0NvbG9yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3V4TGlua0NvbG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNoZWNrVmFsaWRIZXgoZSwgJ191eExpbmtDb2xvcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAndXhUb29nbGVBY3RpdmVDb2xvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl91eFRvb2dsZUFjdGl2ZUNvbG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNoZWNrVmFsaWRIZXgoZSwgJ191eFRvb2dsZUFjdGl2ZUNvbG9yJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICd1eFByaW1hcnlCdXR0b25UZXh0Q29sb3InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fdXhQcmltYXJ5QnV0dG9uVGV4dENvbG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNoZWNrVmFsaWRIZXgoZSwgJ191eFByaW1hcnlCdXR0b25UZXh0Q29sb3InKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3V4UHJpbWFyeUJ1dHRvbkNvbG9yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3V4UHJpbWFyeUJ1dHRvbkNvbG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNoZWNrVmFsaWRIZXgoZSwgJ191eFByaW1hcnlCdXR0b25Db2xvcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAncHJpbWFyeUJ1dHRvbkhvdmVyQmFja2dyb3VuZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9wcmltYXJ5QnV0dG9uSG92ZXJCYWNrZ3JvdW5kOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNoZWNrVmFsaWRIZXgoZSwgJ19wcmltYXJ5QnV0dG9uSG92ZXJCYWNrZ3JvdW5kJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICd1eFNlY29uZGFyeUJ1dHRvblRleHRDb2xvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl91eFNlY29uZGFyeUJ1dHRvblRleHRDb2xvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jaGVja1ZhbGlkSGV4KGUsICdfdXhTZWNvbmRhcnlCdXR0b25UZXh0Q29sb3InKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3V4U2Vjb25kYXJ5QnV0dG9uQ29sb3InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fdXhTZWNvbmRhcnlCdXR0b25Db2xvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jaGVja1ZhbGlkSGV4KGUsICdfdXhTZWNvbmRhcnlCdXR0b25Db2xvcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2Vjb25kYXJ5QnV0dG9uSG92ZXJCYWNrZ3JvdW5kJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3NlY29uZGFyeUJ1dHRvbkhvdmVyQmFja2dyb3VuZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jaGVja1ZhbGlkSGV4KGUsICdfc2Vjb25kYXJ5QnV0dG9uSG92ZXJCYWNrZ3JvdW5kJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICd1eEZvbnRDb2xvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl91eEZvbnRDb2xvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jaGVja1ZhbGlkSGV4KGUsICdfdXhGb250Q29sb3InKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NlY29uZGFyeVRleHRDb2xvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9zZWNvbmRhcnlUZXh0Q29sb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2hlY2tWYWxpZEhleChlLCAnX3NlY29uZGFyeVRleHRDb2xvcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnbGlnaHRUZXh0Q29sb3InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fbGlnaHRUZXh0Q29sb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2hlY2tWYWxpZEhleChlLCAnX2xpZ2h0VGV4dENvbG9yJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdsaWdodGVzdFRleHRDb2xvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9saWdodGVzdFRleHRDb2xvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jaGVja1ZhbGlkSGV4KGUsICdfbGlnaHRlc3RUZXh0Q29sb3InKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3V4QmFja2dyb3VuZENvbG9yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3V4QmFja2dyb3VuZENvbG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNoZWNrVmFsaWRIZXgoZSwgJ191eEJhY2tncm91bmRDb2xvcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnb3ZlcmxheUNvbG9yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX292ZXJsYXlDb2xvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5fb3ZlcmxheUNvbG9yID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2JvcmRlckNvbG9yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2JvcmRlckNvbG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNoZWNrVmFsaWRIZXgoZSwgJ19ib3JkZXJDb2xvcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc3ViSGVhZGVyQ29sb3InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5fc3ViSGVhZGVyQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2hlY2tWYWxpZEhleChlLCAnX3N1YkhlYWRlckNvbG9yJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICd3YXJuaW5nQmFja2dyb3VuZENvbG9yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3dhcm5pbmdCYWNrZ3JvdW5kQ29sb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX3dhcm5pbmdCYWNrZ3JvdW5kQ29sb3IgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnd2FybmluZ1RleHRDb2xvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl93YXJuaW5nVGV4dENvbG9yOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmNoZWNrVmFsaWRIZXgoZSwgJ193YXJuaW5nVGV4dENvbG9yJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdwZXJzaXN0ZW50Q29uc2VudExpbmtDb2xvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9wZXJzaXN0ZW50Q29uc2VudExpbmtDb2xvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jaGVja1ZhbGlkSGV4KGUsICdfcGVyc2lzdGVudENvbnNlbnRMaW5rQ29sb3InKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3BlcnNpc3RlbnRDb25zZW50TGlua1RleHRDb2xvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9wZXJzaXN0ZW50Q29uc2VudExpbmtUZXh0Q29sb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2hlY2tWYWxpZEhleChlLCAnX3BlcnNpc3RlbnRDb25zZW50TGlua1RleHRDb2xvcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZm9udCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9mb250OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9mb250ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBlOwogICAgICAgICAgICAgICAgICAgIH0oKSwgem8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBQbyA9IGUuY29uZmlnLCBPbyA9IGUuZ3ZsLCBJbyA9IGUuY29uc2VudEluZm8sIExvID0gZS5ub25JYWJWZW5kb3JMaXN0LCBBbyA9IGUuZ29vZ2xlRGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLnJlZ3VsYXRpb24sIG4gPSBlLnBhZ2UsIHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAkZShIZS5hLm1hcmsoZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEhlLmEud3JhcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7OykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGUucHJldiA9IGUubmV4dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmV4dCA9IDIsIE5vLmluaXRMYWJlbHMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm5leHQgPSA0LCBuZXcgTm8oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtvID0gZS5zZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdlbmQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICBUbyA9IG5ldyBVbygpLCBfbyA9IG5ldyBCbygpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9ICdxYy1jbXAyLWNvbnRhaW5lcic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFNvKCdkaXYnLCBlLCBlLCBkb2N1bWVudC5ib2R5KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgaSA9ICdxYy1jbXAyLW1haW4nLCBhID0gU28oJ2RpdicsIGksIGksIG8pOwogICAgICAgICAgICAgICAgICAgICAgICByKCkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrby5kaXNwbGF5Q29uc2VudFVpKHQsIG4sIGUuaXNNYW5kYXRvcnkpLCBKZS5hLnJlbmRlcihRZS5hLmNyZWF0ZUVsZW1lbnQocnQsIHsgc3RvcmU6IFFvIH0sIFFlLmEuY3JlYXRlRWxlbWVudCh3bywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpOiBrbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBHbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5uYW1lLCBuID0gZS5pbml0aWFsU3RhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignYG5hbWVgIGlzIGEgcmVxdWlyZWQgb3B0aW9uIGZvciBjcmVhdGVTbGljZScpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUucmVkdWNlcnMgfHwge30sIG8gPSAndW5kZWZpbmVkJyA9PT0gdHlwZW9mIGUuZXh0cmFSZWR1Y2VycyA/IFtdIDogJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGUuZXh0cmFSZWR1Y2VycyA/IHplKGUuZXh0cmFSZWR1Y2VycykgOiBbZS5leHRyYVJlZHVjZXJzXSwgaSA9IG9bMF0sIGEgPSB2b2lkIDAgPT09IGkgPyB7fSA6IGksIHMgPSBvWzFdLCBjID0gdm9pZCAwID09PSBzID8gW10gOiBzLCB1ID0gb1syXSwgbCA9IHZvaWQgMCA9PT0gdSA/IHZvaWQgMCA6IHUsIGYgPSBPYmplY3Qua2V5cyhyKSwgcCA9IHt9LCBkID0ge30sIGggPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgZi5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgbywgaSA9IHJbZV0sIGEgPSB0ICsgJy8nICsgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdyZWR1Y2VyJyBpbiBpID8gKG4gPSBpLnJlZHVjZXIsIG8gPSBpLnByZXBhcmUpIDogbiA9IGksIHBbZV0gPSBuLCBkW2FdID0gbiwgaFtlXSA9IG8gPyBCZShhLCBvKSA6IEJlKGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSBmdW5jdGlvbiAoZSwgdCwgbiwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBuICYmIChuID0gW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSAnZnVuY3Rpb24nID09PSB0eXBlb2YgdCA/IHplKHQpIDogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgaSA9IG9bMF0sIGEgPSBvWzFdLCBzID0gb1syXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gdCAmJiAodCA9IGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gW2lbbi50eXBlXV0uY29uY2F0KGEuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoMCwgZS5tYXRjaGVyKShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVkdWNlcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPT09IHIuZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkubGVuZ3RoICYmIChyID0gW3NdKSwgci5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2KGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0KGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyA9PT0gdHlwZW9mIHIgPyBlIDogcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh5KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkZShlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdChlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gdChlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndW5kZWZpbmVkJyA9PT0gdHlwZW9mIG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0EgY2FzZSByZWR1Y2VyIG9uIGEgbm9uLWRyYWZ0YWJsZSB2YWx1ZSBtdXN0IG5vdCByZXR1cm4gdW5kZWZpbmVkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0obiwgQWUoe30sIGEsIHt9LCBkKSwgYywgbCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVkdWNlcjogbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlUmVkdWNlcnM6IHAKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KHsKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2FwcCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRpYWxTdGF0ZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheUdEUFI6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheVVTUDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlQ2hhbmdlZDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlR0RQUjogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc2FibGVBY2NlcHRCdXR0b246ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlZDogJycKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVkdWNlcnM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvZ2dsZURpc3BsYXk6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LnBheWxvYWQsIHIgPSBuLnJlZ3VsYXRpb24sIG8gPSBuLmlzTWFuZGF0b3J5LCBpID0gITEsIGEgPSAhMSwgcyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1VTUCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgJiYgKGEgPSAhMSksIGkgPSAhZS5kaXNwbGF5VVNQOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdHRFBSJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSAmJiAoaSA9ICExKSwgcyA9ICEhbyAmJiAhZS5wYWdlQ2hhbmdlZCwgYSA9ICFlLmRpc3BsYXlHRFBSOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0obSh7fSwgZSksIHt9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlHRFBSOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5VVNQOiBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNhYmxlQWNjZXB0QnV0dG9uOiBzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlUGFnZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQucGF5bG9hZC5wYWdlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucGF5bG9hZC5vbkluaXQgfHwgKGtvLmV2ZW50VHJhY2tlcih4dC5HT19UT19QQUdFLCBuKSwgVG8uc2VuZE5hdmlnYXRpb25Mb2coKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAxICE9PSBuIHx8IG4gIT09IGUucGFnZUdEUFI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0obSh7fSwgZSksIHt9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VHRFBSOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlQ2hhbmdlZDogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzYWJsZUFjY2VwdEJ1dHRvbjogIXIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2dnbGVDaGFuZ2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LnBheWxvYWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0obSh7fSwgZSksIHt9LCB7IGNoYW5nZWQ6IG4gfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KSwgSG8gPSBHby5hY3Rpb25zLCBXbyA9IEhvLnRvZ2dsZURpc3BsYXksICRvID0gSG8uY2hhbmdlUGFnZSwgWW8gPSBIby50b2dnbGVDaGFuZ2UsIFFvID0gKEdvLnJlZHVjZXIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gVmUoKSwgciA9IGUgfHwge30sIG8gPSByLnJlZHVjZXIsIGkgPSB2b2lkIDAgPT09IG8gPyB2b2lkIDAgOiBvLCBhID0gci5taWRkbGV3YXJlLCBzID0gdm9pZCAwID09PSBhID8gbigpIDogYSwgYyA9IHIuZGV2VG9vbHMsIHUgPSB2b2lkIDAgPT09IGMgfHwgYywgbCA9IHIucHJlbG9hZGVkU3RhdGUsIGYgPSB2b2lkIDAgPT09IGwgPyB2b2lkIDAgOiBsLCBwID0gci5lbmhhbmNlcnMsIGQgPSB2b2lkIDAgPT09IHAgPyB2b2lkIDAgOiBwOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIU1lKGkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignInJlZHVjZXIiIGlzIGEgcmVxdWlyZWQgYXJndW1lbnQsIGFuZCBtdXN0IGJlIGEgZnVuY3Rpb24gb3IgYW4gb2JqZWN0IG9mIGZ1bmN0aW9ucyB0aGF0IGNhbiBiZSBwYXNzZWQgdG8gY29tYmluZVJlZHVjZXJzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gRWUoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBrZS5hcHBseSh2b2lkIDAsICdmdW5jdGlvbicgPT09IHR5cGVvZiBzID8gcyhuKSA6IHMpLCBtID0gQ2U7CiAgICAgICAgICAgICAgICAgICAgICAgIHUgJiYgKG0gPSBEZShBZSh7IHRyYWNlOiAhMSB9LCAnb2JqZWN0JyA9PT0gdHlwZW9mIHUgJiYgdSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBbaF07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5pc0FycmF5KGQpID8gZyA9IFtoXS5jb25jYXQoZCkgOiAnZnVuY3Rpb24nID09PSB0eXBlb2YgZCAmJiAoZyA9IGQoZykpLCB5ZSh0LCBmLCBtLmFwcGx5KHZvaWQgMCwgZykpOwogICAgICAgICAgICAgICAgICAgIH0oeyByZWR1Y2VyOiBFZSh7IGFwcDogR28ucmVkdWNlciB9KSB9KSksIEtvID0gbmV3IChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsKHRoaXMsIGUpLCB0aGlzLl9fdGNmYXBpdWkgPSB2b2lkIDAsIHRoaXMuZ29Ub1BhZ2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZvLmluY2x1ZGVzKGUpID8gUW8uZGlzcGF0Y2goJG8oewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkluaXQ6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIDogY29uc29sZS53YXJuKCcnLmNvbmNhdChlLCAnIGlzIG5vdCBhIHN1cHBvcnRlZCBwYWdlJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5pbml0QXBpVWkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0Ll9fdGNmYXBpdWksIG4gPSBbXSwgciA9IHdpbmRvdzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLl9fdGNmYXBpdWkgJiYgci5fX3RjZmFwaXVpLmEgJiYgKG4gPSByLl9fdGNmYXBpdWkuYSksIE9iamVjdC5hc3NpZ24od2luZG93LCB7IF9fdGNmYXBpdWk6IGUgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwsIGYsIHAgPSB1KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocC5zKCk7ICEobCA9IHAubigpKS5kb25lOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBsLnZhbHVlLCBoID0gcyhmID0gZCkgfHwgbyhmKSB8fCBpKGYpIHx8IGMoKSwgbSA9IGhbMF0sIGcgPSBoLnNsaWNlKDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFttXS5hcHBseSh0LCBhKGcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcC5lKHYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAuZigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuX190Y2ZhcGl1aSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IGFyZ3VtZW50cy5sZW5ndGgsIHIgPSBuZXcgQXJyYXkobiA+IDEgPyBuIC0gMSA6IDApLCBvID0gMTsgbyA8IG47IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJbbyAtIDFdID0gYXJndW1lbnRzW29dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W2VdLmFwcGx5KHQsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcignVGhlIGZ1bmN0aW9uICcuY29uY2F0KGUsICcgaXMgbm90IGRlZmluZWQnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcChlLCBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2Rpc3BsYXlVaScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHpvKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dKSwgZTsKICAgICAgICAgICAgICAgICAgICB9KCkpKCk7CiAgICAgICAgICAgICAgICBLby5pbml0QXBpVWkoKTsKICAgICAgICAgICAgfQogICAgICAgIF0pOwogICAgfSgpKQp9"},{"name":"sugarcoat-d46a0542506f49cf865d98cb5ffd6c7a7854adb7","aliases":[],"kind":{"mime":"application/javascript"},"content":"dmFyIF9zYXRlbGxpdGU7CnsKICAgIGNvbnN0ICRfX19tb2NrXzAwYTJlYmVmNzEzYmI1ZWEgPSB7fTsKICAgIChleHBvcnRzID0+IHsKICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgY29uc3QgeGhyVW5zZW50ID0gMDsKICAgICAgICBjb25zdCB4aHJPcGVuZWQgPSAxOwogICAgICAgIGNvbnN0IHhockhlYWRlcnNSZWNlaXZlZCA9IDI7CiAgICAgICAgY29uc3QgeGhyTG9hZGluZyA9IDM7CiAgICAgICAgY29uc3QgeGhyRG9uZSA9IDQ7CiAgICAgICAgY29uc3QgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wgPSBTeW1ib2woJ2RlZmVycmVkSGFuZGxlJyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkU3RhcnRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZHN0YXJ0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Qcm9ncmVzc1N5bWJvbCA9IFN5bWJvbCgnb25wcm9ncmVzcycpOwogICAgICAgIGNvbnN0IHhock9uQWJvcnRTeW1ib2wgPSBTeW1ib2woJ29uYWJvcnQnKTsKICAgICAgICBjb25zdCB4aHJPbkVycm9yU3ltYm9sID0gU3ltYm9sKCdvbmVycm9yJyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkU3ltYm9sID0gU3ltYm9sKCdvbmxvYWQnKTsKICAgICAgICBjb25zdCB4aHJPblRpbWVvdXRTeW1ib2wgPSBTeW1ib2woJ29udGltZW91dCcpOwogICAgICAgIGNvbnN0IHhock9uTG9hZEVuZFN5bWJvbCA9IFN5bWJvbCgnb25sb2FkZW5kJyk7CiAgICAgICAgY29uc3QgeGhyT25SZWFkeVN0YXRlQ2hhbmdlU3ltYm9sID0gU3ltYm9sKCdvbnJlYWR5c3RhdGVjaGFuZ2UnKTsKICAgICAgICBjb25zdCB4aHJSZWFkeVN0YXRlU3ltYm9sID0gU3ltYm9sKCdyZWFkeVN0YXRlJyk7CiAgICAgICAgY29uc3QgeGhyVGltZW91dFN5bWJvbCA9IFN5bWJvbCgndGltZW91dCcpOwogICAgICAgIGNvbnN0IHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCA9IFN5bWJvbCgnd2l0aENyZWRlbnRpYWxzJyk7CiAgICAgICAgY29uc3QgeGhyVXBsb2FkU3ltYm9sID0gU3ltYm9sKCd1cGxvYWQnKTsKICAgICAgICBjb25zdCB4aHJSZXNwb25zZVR5cGVTeW1ib2wgPSBTeW1ib2woJ3Jlc3BvbnNlVHlwZScpOwogICAgICAgIGNvbnN0IGRlZmluZUV2ZW50ID0gKG9iaiwgc3ltYm9sKSA9PiB7CiAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBzeW1ib2wuZGVzY3JpcHRpb24uc3Vic3RyaW5nKDIpOwogICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkob2JqLCBzeW1ib2wsIHsKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIG9iai5hZGRFdmVudExpc3RlbmVyKHR5cGUsIGZ1bmN0aW9uIChldmVudCkgewogICAgICAgICAgICAgICAgY29uc3QgaGFuZGxlciA9IHRoaXNbc3ltYm9sXTsKICAgICAgICAgICAgICAgIGlmIChoYW5kbGVyKSB7CiAgICAgICAgICAgICAgICAgICAgaGFuZGxlci5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICBjb25zdCBjaGFuZ2VSZWFkeVN0YXRlID0gKHhociwgcmVhZHlTdGF0ZSkgPT4gewogICAgICAgICAgICB4aHJbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPSByZWFkeVN0YXRlOwogICAgICAgICAgICB4aHIuZGlzcGF0Y2hFdmVudChuZXcgRXZlbnQoJ3JlYWR5c3RhdGVjaGFuZ2UnKSk7CiAgICAgICAgfTsKICAgICAgICBsZXQgaXNTZWFsZWQgPSB0cnVlOwogICAgICAgIGNsYXNzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgZXh0ZW5kcyBFdmVudFRhcmdldCB7CiAgICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICAgICAgc3VwZXIoKTsKICAgICAgICAgICAgICAgIGlmICghKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdCkgJiYgISh0aGlzIGluc3RhbmNlb2YgWE1MSHR0cFJlcXVlc3RVcGxvYWQpKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignSWxsZWdhbCBjb25zdHJ1Y3RvcicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Mb2FkU3RhcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Qcm9ncmVzc1N5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkFib3J0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uRXJyb3JTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25Mb2FkU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uVGltZW91dFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRFbmRTeW1ib2wpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmxvYWRzdGFydCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uTG9hZFN0YXJ0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2Fkc3RhcnQodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucHJvZ3Jlc3MoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPblByb2dyZXNzU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25wcm9ncmVzcyh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblByb2dyZXNzU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmFib3J0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25BYm9ydFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uYWJvcnQodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25BYm9ydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25lcnJvcigpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uRXJyb3JTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmVycm9yKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uRXJyb3JTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9udGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uVGltZW91dFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9udGltZW91dCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZGVuZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ubG9hZGVuZCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRFbmRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0ID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RVcGxvYWQgZXh0ZW5kcyBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBpZiAoaXNTZWFsZWQpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3RVcGxvYWQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0VXBsb2FkLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3QgZXh0ZW5kcyBYTUxIdHRwUmVxdWVzdEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaXNTZWFsZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgIGNvbnN0IHhoclVwbG9hZCA9IG5ldyBYTUxIdHRwUmVxdWVzdFVwbG9hZCgpOwogICAgICAgICAgICAgICAgaXNTZWFsZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhockRlZmVycmVkSGFuZGxlU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbnVsbCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wpOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhoclJlYWR5U3RhdGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhoclRpbWVvdXRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAwLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJXaXRoQ3JlZGVudGlhbHNTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVXBsb2FkU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogeGhyVXBsb2FkLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVzcG9uc2VUeXBlU3ltYm9sLCB7CiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbnJlYWR5c3RhdGVjaGFuZ2UoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnJlYWR5c3RhdGVjaGFuZ2UodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25SZWFkeVN0YXRlQ2hhbmdlU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZWFkeVN0YXRlKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgb3BlbihtZXRob2QsIHVybCkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyRG9uZTogewogICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhock9wZW5lZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRSZXF1ZXN0SGVhZGVyKG5hbWUsIHZhbHVlKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0VHJ1c3RUb2tlbih0cnVzdFRva2VuKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHRpbWVvdXQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJUaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgdGltZW91dCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJUaW1lb3V0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCB3aXRoQ3JlZGVudGlhbHMoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJXaXRoQ3JlZGVudGlhbHNTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB3aXRoQ3JlZGVudGlhbHModmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJVbnNlbnQ6CiAgICAgICAgICAgICAgICBjYXNlIHhock9wZW5lZDogewogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZhdWx0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwnd2l0aENyZWRlbnRpYWxzXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgbWF5IG9ubHkgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgVU5TRU5UIG9yIE9QRU5FRC4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF0gPSAhIXZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCB1cGxvYWQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJVcGxvYWRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNlbmQoKSB7CiAgICAgICAgICAgICAgICBpZiAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSA9PT0geGhyT3BlbmVkICYmIHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdID09PSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBzZXRUaW1lb3V0KCgpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhockRvbmUpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Vycm9yJykpOwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2xvYWRlbmQnKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgMCk7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBleGVjdXRlIFwnc2VuZFwnIG9uIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIG9iamVjdFwncyBzdGF0ZSBtdXN0IGJlIE9QRU5FRC4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBhYm9ydCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gIT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQodGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0pOwogICAgICAgICAgICAgICAgICAgIHRoaXNbeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2xdID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBjaGFuZ2VSZWFkeVN0YXRlKHRoaXMsIHhoclVuc2VudCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kaXNwYXRjaEV2ZW50KG5ldyBQcm9ncmVzc0V2ZW50KCdhYm9ydCcpKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2xvYWRlbmQnKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlVVJMKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXMoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgc3RhdHVzVGV4dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXRSZXNwb25zZUhlYWRlcihuYW1lKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBvdmVycmlkZU1pbWVUeXBlKG1pbWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUeXBlKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgcmVzcG9uc2VUeXBlKHZhbHVlKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyRG9uZTogewogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCdGYWlsZWQgdG8gc2V0IHRoZSBcJ3Jlc3BvbnNlVHlwZVwnIHByb3BlcnR5IG9uIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIHJlc3BvbnNlIHR5cGUgY2Fubm90IGJlIHNldCBpZiB0aGUgb2JqZWN0XCdzIHN0YXRlIGlzIExPQURJTkcgb3IgRE9ORS4nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHZhbHVlKSB7CiAgICAgICAgICAgICAgICBjYXNlICcnOgogICAgICAgICAgICAgICAgY2FzZSAnYXJyYXlidWZmZXInOgogICAgICAgICAgICAgICAgY2FzZSAnYmxvYic6CiAgICAgICAgICAgICAgICBjYXNlICdkb2N1bWVudCc6CiAgICAgICAgICAgICAgICBjYXNlICdqc29uJzoKICAgICAgICAgICAgICAgIGNhc2UgJ3RleHQnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlKCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgcmV0dXJuIHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcgPyAnJyA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlVGV4dCgpIHsKICAgICAgICAgICAgICAgIGNvbnN0IHJlc3BvbnNlVHlwZSA9IHRoaXNbeGhyUmVzcG9uc2VUeXBlU3ltYm9sXTsKICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZVR5cGUgPT09ICcnIHx8IHJlc3BvbnNlVHlwZSA9PT0gJ3RleHQnKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCdGYWlsZWQgdG8gcmVhZCB0aGUgXCdyZXNwb25zZVRleHRcJyBwcm9wZXJ0eSBmcm9tIFwnWE1MSHR0cFJlcXVlc3RcJzogVGhlIHZhbHVlIGlzIG9ubHkgYWNjZXNzaWJsZSBpZiB0aGUgb2JqZWN0XCdzIFwncmVzcG9uc2VUeXBlXCcgaXMgXCdcJyBvciBcJ3RleHRcJyAod2FzIFwnYXJyYXlidWZmZXJcJykuJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlc3BvbnNlWE1MKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnVU5TRU5UJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyVW5zZW50CiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnT1BFTkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyT3BlbmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnSEVBREVSU19SRUNFSVZFRCcsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockhlYWRlcnNSZWNlaXZlZAogICAgICAgIH0pOwogICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShYTUxIdHRwUmVxdWVzdCwgJ0xPQURJTkcnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJMb2FkaW5nCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnRE9ORScsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockRvbmUKICAgICAgICB9KTsKICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0ID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiBYTUxIdHRwUmVxdWVzdCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9OwogICAgfSkoJF9fX21vY2tfMDBhMmViZWY3MTNiYjVlYSk7CiAgICBjb25zdCAkX19fbW9ja181M2FlNmViZmRlY2U3NjkwID0ge307CiAgICAoZXhwb3J0cyA9PiB7CiAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgIGxldCBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgIGNsYXNzIFN0b3JhZ2UgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgbGVuZ3RoKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKHRoaXMpLmxlbmd0aDsKICAgICAgICAgICAgfQogICAgICAgICAgICBrZXkoaW5kZXgpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGtleXMgPSBPYmplY3Qua2V5cyh0aGlzKTsKICAgICAgICAgICAgICAgIGlmIChpbmRleCA8IDAgfHwgaW5kZXggPj0ga2V5cy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBrZXlzW2luZGV4XTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXRJdGVtKGtleSkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbCh0aGlzLCBrZXkpID8gdGhpc1trZXldIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRJdGVtKGtleSwgdmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNba2V5XSA9IFN0cmluZyh2YWx1ZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmVtb3ZlSXRlbShrZXkpIHsKICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzW2tleV07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2xlYXIoKSB7CiAgICAgICAgICAgICAgICBjb25zdCBrZXlzID0gT2JqZWN0LmtleXModGhpcyk7CiAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGtleSBvZiBrZXlzKSB7CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHRoaXNba2V5XTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlN0b3JhZ2UgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFN0b3JhZ2UsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjb25zdCBsb2NhbFN0b3JhZ2UgPSBuZXcgU3RvcmFnZSgpOwogICAgICAgIGV4cG9ydHMubG9jYWxTdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIGdldCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBsb2NhbFN0b3JhZ2U7CiAgICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGNvbnN0IHNlc3Npb25TdG9yYWdlID0gbmV3IFN0b3JhZ2UoKTsKICAgICAgICBleHBvcnRzLnNlc3Npb25TdG9yYWdlID0gewogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIGdldCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBzZXNzaW9uU3RvcmFnZTsKICAgICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgaXNTZWFsZWQgPSB0cnVlOwogICAgfSkoJF9fX21vY2tfNTNhZTZlYmZkZWNlNzY5MCk7CiAgICAoZnVuY3Rpb24gKCkgewogICAgICAgIHdpbmRvdy5fc2F0ZWxsaXRlID0gd2luZG93Ll9zYXRlbGxpdGUgfHwge30sIHdpbmRvdy5fc2F0ZWxsaXRlLmNvbnRhaW5lciA9IHsKICAgICAgICAgICAgYnVpbGRJbmZvOiB7CiAgICAgICAgICAgICAgICBtaW5pZmllZDogITAsCiAgICAgICAgICAgICAgICBidWlsZERhdGU6ICcyMDIxLTEyLTIwVDIwOjMxOjEyWicsCiAgICAgICAgICAgICAgICB0dXJiaW5lQnVpbGREYXRlOiAnMjAyMS0wOC0xMVQyMDoyNTo0OVonLAogICAgICAgICAgICAgICAgdHVyYmluZVZlcnNpb246ICcyNy4yLjAnCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGVudmlyb25tZW50OiB7CiAgICAgICAgICAgICAgICBpZDogJ0VOYjk3ZDdmOWQyZDRiNDcyMGFjOTc4MmE3MTE5OTQ5OTUnLAogICAgICAgICAgICAgICAgc3RhZ2U6ICdwcm9kdWN0aW9uJwogICAgICAgICAgICB9LAogICAgICAgICAgICBkYXRhRWxlbWVudHM6IHsKICAgICAgICAgICAgICAgICdldmVudDpqb2JDYXRlZ29yeSc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmV2ZW50RGF0YS5qb2JDYXRlZ29yeScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdPcHQgT3V0OiBCZWFtZXJ5IENvbnZlcnNhdGlvbiBJRCc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3Nlc3Npb24nLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL3F1ZXJ5U3RyaW5nUGFyYW1ldGVyLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY24nLAogICAgICAgICAgICAgICAgICAgICAgICBjYXNlSW5zZW5zaXRpdmU6ICEwCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdjb250ZW50OkxpbmtOYW1lJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGlnaXRhbERhdGEuZXZlbnREYXRhLmxpbmtUeXBlICsgJ3wnICsgZGlnaXRhbERhdGEuZXZlbnREYXRhLmxpbmtOYW1lOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIENNUElEOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBmb3JjZUxvd2VyQ2FzZTogITAsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvcXVlcnlTdHJpbmdQYXJhbWV0ZXIuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdDTVBJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZTogITAKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2pvYkFwcGxpY2F0aW9uOmFwcGxpY2F0aW9uSWQnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5ldmVudERhdGEuYXBwbGljYXRpb25faWQnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnU01TOlNpdGVFcnJvciAnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5ldmVudERhdGEuZXJyb3JNZXNzYWdlJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ1NNUyBhc3Nlc3NtZW50UmVxdWlyZWQnOiB7CiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEucGFnZS5wYWdlSW5mby5hc3Nlc3NtZW50UmVxdWlyZWQnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnY29udGVudDogU3ViU2VjdGlvbkxldmVsMSc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLnBhZ2UucGFnZUluZm8ucGFnZUxldmVsMScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdqb2JEZXNjcmlwdGlvbjogcmVsYXRlZEpvYkltcHJlc3Npb25zJzogewogICAgICAgICAgICAgICAgICAgIGNsZWFuVGV4dDogITAsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuam9iLnJlbGF0ZWRKb2JJbXByZXNzaW9ucycgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdGb3JtOiBGb3JtRXJyb3JzJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuZXZlbnREYXRhLmZvcm1FcnJvcnMnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnam9iRGVzY3JpcHRpb246aGlyaW5nWWVhcic6IHsKICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmpvYi5oaXJpbmdfeWVhcicgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdjb250ZW50OnBlb3BsZVNvZnRJZCc6IHsKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5wYWdlLnBhZ2VJbmZvLnBlb3BsZVNvZnRJZCcgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdKb2JTZWFyY2g6U29ydEJ5JzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuZXZlbnREYXRhLnNvcnRCeScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdKb2JTZWFyY2g6RmlsdGVyQnknOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkaWdpdGFsRGF0YS5ldmVudERhdGEuZmlsdGVyVHlwZSArICd8JyArIGRpZ2l0YWxEYXRhLmV2ZW50RGF0YS5maWx0ZXJOYW1lOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdqb2JEZXNjcmlwdGlvbjpzdWJDYXRlZ29yeSc6IHsKICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmpvYi5zdWJDYXRlZ29yeScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdqb2JEZXNjcmlwdGlvbjpqb2JDb3VudHJ5JzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJ05vIEpvYiBDb3VudHJ5IEZvdW5kJywKICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmpvYi5jb3VudHJ5JyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2pvYkFwcGxpY2F0aW9uOnJlc3VtZVR5cGUnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5ldmVudERhdGEucmVzdW1lU291cmNlJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2pvYkRlc2NyaXB0aW9uOmpvYk5hbWUnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnTm8gSm9iIE5hbWUgRm91bmQnLAogICAgICAgICAgICAgICAgICAgIGNsZWFuVGV4dDogITAsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpZ2l0YWxEYXRhICYmIGRpZ2l0YWxEYXRhLmpvYiAmJiBkaWdpdGFsRGF0YS5qb2IudGl0bGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRpZ2l0YWxEYXRhLmpvYi50aXRsZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICByZWxhdGVkSm9iSWQ6IHsKICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmpvYi5yZWxhdGVkSm9iSWQnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnRm9ybSA6IGZvcm1JbmRleCc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIGNsZWFuVGV4dDogITAsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmV2ZW50RGF0YS5mb3JtX2luZGV4JyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2pvYkRlc2NyaXB0aW9uOmpvYkZpbmRpbmdNZXRob2QnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5qb2Iuam9iRmluZGluZ01ldGhvZCcgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGNhbXBhaWduOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBmb3JjZUxvd2VyQ2FzZTogITAsCiAgICAgICAgICAgICAgICAgICAgY2xlYW5UZXh0OiAhMCwKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdzZXNzaW9uJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9xdWVyeVN0cmluZ1BhcmFtZXRlci5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3V0bV9jYW1wYWlnbicsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZTogITAKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6dXNlcklEJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEucGFnZS5wYWdlSW5mby51c2VySUQnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnUGhvbmVOdW1iZXIgTWF0Y2gnOiB7CiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEucGFnZS5wYWdlSW5mby5waG9uZU51bWJlck1hdGNoJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ01hcmtldGluZzogU29jaWFsUGxhdGZvcm0nOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5ldmVudERhdGEuc29jaWFsUGxhdGZvcm0nIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnVVRNIFVzZXInOiB7CiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvcXVlcnlTdHJpbmdQYXJhbWV0ZXIuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICd1dG1fdXNlcicsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZTogITAKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6dXNlckFjdGlvblN0b3JlJzogewogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLnBhZ2UucGFnZUluZm8udXNlckFjdGlvblN0b3JlSWQnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnZXZlbnREYXRhOmpvYklkJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAncGFnZXZpZXcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmV2ZW50RGF0YS5qb2JJZCcgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdQaG9uZSBOdW1iZXIgQWRkZWQnOiB7CiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEucGFnZS5wYWdlSW5mby5waG9uZU51bWJlckFkZGVkJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2Jhbm5lcjpkZXN0aW5VUkwnOiB7CiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYmFubmVyQUEgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCdkaXZbZGF0YS1yZWFjdC1jbGFzcz0iSG9tZXBhZ2VDYW1wYWlnbkJhbm5lciJdJyksICEhYmFubmVyQUEgJiYgKGJhbm5lckFBcHJvcHMgPSBKU09OLnBhcnNlKGJhbm5lckFBLmdldEF0dHJpYnV0ZSgnZGF0YS1yZWFjdC1wcm9wcycpKSwgYmFubmVyQUFsaW5rID0gYmFubmVyQUFwcm9wcy5idXR0b25fbGluaywgISFnZXRRdWVyeVBhcmFtZXRlcnMoYmFubmVyQUFsaW5rKSAmJiBiYW5uZXJBQWxpbmspOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdKb2JTZWFyY2g6U2VhcmNoVGVybSc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLnBhZ2Uuc2VhcmNoLmtleXdvcmRRdWVyeScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdldmVudERhdGE6cGVvcGxlU29mdElkJzogewogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmV2ZW50RGF0YS5wZW9wbGVzb2Z0SWQnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBzdWNjZXNzQ29uZmlybWF0aW9uOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQubG9jYXRpb24uaHJlZi5pbmRleE9mKCdzdW1tYXJ5P3Jlc3VsdD1zdWNjZXNzJykgPiAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnU01TIC0gT3B0aW9uIFNlbGVjdGVkJzogewogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmV2ZW50RGF0YS5vcHRpb24nIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnSm9iU2VhcmNoOiBTZWFyY2hTZWxlY3Rpb24nOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5ldmVudERhdGEuc2VhcmNoU2VsZWN0aW9uJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgQ0NVSUQ6IHsKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9xdWVyeVN0cmluZ1BhcmFtZXRlci5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2NjdWlkJywKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZUluc2Vuc2l0aXZlOiAhMAogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnY29udGVudDpTaXRlU2VjdGlvbic6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLnBhZ2UucGFnZUluZm8uc2l0ZVNlY3Rpb24nIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnY29udGVudDpTaXRlRXJyb3InOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5ldmVudERhdGEuc2l0ZUVycm9yJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2pvYkRlc2NyaXB0aW9uOmpvYkJ1c2luZXNzUHVycG9zZSc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmpvYi5idXNpbmVzc1B1cnBvc2UnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnY29udGVudDp1c2VyVHlwZSc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLnBhZ2UucGFnZUluZm8udXNlclR5cGUnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnZXZlbnQ6am9iQ291bnRyeSc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmV2ZW50RGF0YS5qb2JDb3VudHJ5JyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgcGFzc3BvcnRFdmVudFBhcmFtczogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuZXZlbnRQYXJhbXMnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnVXNlciBTdGF0dXMnOiB7CiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuZXZlbnREYXRhLnVzZXJTdGF0dXMnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnT3B0IE91dDogU3lzdGVtJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAnc2Vzc2lvbicsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvcXVlcnlTdHJpbmdQYXJhbWV0ZXIuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdzeScsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZTogITAKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6Q291bnRyeUxhbmd1YWdlJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZGlnaXRhbERhdGEucGFnZS5wYWdlSW5mby5jb3VudHJ5TGFuZ3VhZ2U7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgaW50Y21waWQ6IHsKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9xdWVyeVN0cmluZ1BhcmFtZXRlci5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2ludGNtcGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZUluc2Vuc2l0aXZlOiAhMAogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnUGhvbmUgTnVtYmVyIFZlcmlmaWVkJzogewogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLnBhZ2UucGFnZUluZm8ucGhvbmVOdW1iZXJWZXJpZmllZCcgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdPcHQgT3V0OiBTb3VyY2UnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdzZXNzaW9uJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9xdWVyeVN0cmluZ1BhcmFtZXRlci5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3NvJywKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZUluc2Vuc2l0aXZlOiAhMAogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnSm9iU2VhcmNoOlNlYXJjaFBvc2l0aW9uJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuZXZlbnREYXRhLnNlYXJjaFBvc2l0aW9uJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgRENMSUQ6IHsKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9xdWVyeVN0cmluZ1BhcmFtZXRlci5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2RjbGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZUluc2Vuc2l0aXZlOiAhMAogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnam9iRGVzY3JpcHRpb246am9iSUQnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnTm8gSm9iIElEIEZvdW5kJywKICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VEdXJhdGlvbjogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaWdpdGFsRGF0YSAmJiBkaWdpdGFsRGF0YS5qb2IgJiYgZGlnaXRhbERhdGEuam9iLmlkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkaWdpdGFsRGF0YS5qb2IuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2pvYkRlc2NyaXB0aW9uOmpvYkNhdGVnb3J5JzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuam9iLmNhdGVnb3J5JyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2V2ZW50OmpvYkRpdmlzaW9uJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuZXZlbnREYXRhLmpvYkRpdmlzaW9uJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6UGFnZU5hbWUnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5wYWdlLnBhZ2VJbmZvLnBhZ2VOYW1lJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ1Bob25lTnVtYmVyIENvdW50cnlDb2RlJzogewogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLnBhZ2UucGFnZUluZm8ucGhvbmVOdW1iZXJDb3VudHJ5Q29kZScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdGb3JtOkZvcm1FcnJvcnMnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5ldmVudERhdGEuZm9ybUVycm9ycycgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdVc2VyIEF1dGggTW9kZSc6IHsKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5wYWdlLnBhZ2VJbmZvLnVzZXJBdXRoTW9kZScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdKb2IgUm9sZSc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICdObyBKb2IgUm9sZSBGb3VuZCcsCiAgICAgICAgICAgICAgICAgICAgY2xlYW5UZXh0OiAhMCwKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuam9iLmpvYl9yb2xlJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6IFN1YlNlY3Rpb25MZXZlbDInOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5wYWdlLnBhZ2VJbmZvLnBhZ2VMZXZlbDInIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnY29udGVudDpQYWdlVHlwZSc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLnBhZ2UucGFnZUluZm8ucGFnZVR5cGUnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnam9iRGVzY3JpcHRpb246am9iU2hhcmVTb2NpYWxNZWRpYSc6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmV2ZW50RGF0YS5zb2NpYWxNZWRpYScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdQYWdlIFVSTCc6IHsKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICd3aW5kb3cubG9jYXRpb24uaHJlZicgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdKb2JTZWFyY2g6Tm9PZlJlc3VsdHMnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5wYWdlLnNlYXJjaC5ub09mUmVzdWx0cycgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdTTVM6U3RlcG5hbWUnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5ldmVudERhdGEuc3RlcE5hbWUnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnam9iRGVzY3JpcHRpb246am9iVHlwZSc6IHsKICAgICAgICAgICAgICAgICAgICBjbGVhblRleHQ6ICEwLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmpvYi50eXBlJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2NvbnRlbnQ6cGVyc29uSUQnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5wYWdlLnBhZ2VJbmZvLnBlcnNvbklkJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ1NNUyBPcHRlZEluJzogewogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLnBhZ2UucGFnZUluZm8uc21zT3B0ZWRJbicgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdGb3JtIDogZm9ybVRpdGxlJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgY2xlYW5UZXh0OiAhMCwKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuZXZlbnREYXRhLmZvcm1fdGl0bGUnIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnZXZlbnQ6am9iSUQnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBzdG9yYWdlRHVyYXRpb246ICdwYWdldmlldycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuZXZlbnREYXRhLmpvYklEJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2pvYkRlc2NyaXB0aW9uOmpvYkxvY2F0aW9uJzogewogICAgICAgICAgICAgICAgICAgIGNsZWFuVGV4dDogITAsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuam9iLmxvY2F0aW9uJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ0Zvcm06IEZvcm1OYW1lJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEuZXZlbnREYXRhLmZvcm1OYW1lJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ1NtcyBWaXNpYmxlJzogewogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLnBhZ2UucGFnZUluZm8uc21zVmlzaWJsZScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdPcHQgT3V0OiBCZWFtZXJ5IENhbXBhaWduIElEJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUR1cmF0aW9uOiAnc2Vzc2lvbicsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvcXVlcnlTdHJpbmdQYXJhbWV0ZXIuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjYScsCiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZTogITAKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ1NNUyAtIEV2ZW50IC0gc21zT3B0ZWRJbic6IHsKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5ldmVudERhdGEuc21zT3B0ZWRJbicgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdjb250ZW50OiBTdWJTZWN0aW9uTGV2ZWwzJzogewogICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogJycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvamF2YXNjcmlwdFZhcmlhYmxlLmpzJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBwYXRoOiAnZGlnaXRhbERhdGEucGFnZS5wYWdlSW5mby5wYWdlTGV2ZWwzJyB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2V2ZW50OmpvYk5hbWUnOiB7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnLAogICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHBhdGg6ICdkaWdpdGFsRGF0YS5ldmVudERhdGEuam9iTmFtZScgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdqb2JEZXNjcmlwdGlvbjpqb2JEaXZpc2lvbic6IHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6ICcnLAogICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZGF0YUVsZW1lbnRzL2phdmFzY3JpcHRWYXJpYWJsZS5qcycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgcGF0aDogJ2RpZ2l0YWxEYXRhLmpvYi5kaXZpc2lvbicgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LAogICAgICAgICAgICBleHRlbnNpb25zOiB7CiAgICAgICAgICAgICAgICBjb3JlOiB7CiAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdDb3JlJywKICAgICAgICAgICAgICAgICAgICBob3N0ZWRMaWJGaWxlc0Jhc2VVcmw6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vZXh0ZW5zaW9ucy9FUGRmOTU0MzlhYzI3NzQ1ZWVhNTBkM2M3NWZkNmVkMjM1LycsCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlczogewogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9qYXZhc2NyaXB0VmFyaWFibGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnamF2YXNjcmlwdC12YXJpYWJsZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0phdmFTY3JpcHQgVmFyaWFibGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4oJy4uL2hlbHBlcnMvZ2V0T2JqZWN0UHJvcGVydHkuanMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSh3aW5kb3csIGUucGF0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9kYXRhRWxlbWVudHMvcXVlcnlTdHJpbmdQYXJhbWV0ZXIuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncXVlcnktc3RyaW5nLXBhcmFtZXRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ1F1ZXJ5IFN0cmluZyBQYXJhbWV0ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4oJ0BhZG9iZS9yZWFjdG9yLXdpbmRvdycpLCBpID0gbignQGFkb2JlL3JlYWN0b3ItcXVlcnktc3RyaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBpLnBhcnNlKGEubG9jYXRpb24uc2VhcmNoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlLmNhc2VJbnNlbnNpdGl2ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W2UubmFtZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSBlLm5hbWUudG9Mb3dlckNhc2UoKSwgciA9IE9iamVjdC5rZXlzKHQpLCBzID0gMDsgcyA8IHIubGVuZ3RoOyBzKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gcltzXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvLnRvTG93ZXJDYXNlKCkgPT09IG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbb107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2RhdGFFbGVtZW50cy9jdXN0b21Db2RlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2N1c3RvbS1jb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQ3VzdG9tIENvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zb3VyY2UodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdkaXJlY3QtY2FsbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0RpcmVjdCBDYWxsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuX3NhdGVsbGl0ZSA9IHdpbmRvdy5fc2F0ZWxsaXRlIHx8IHt9LCB3aW5kb3cuX3NhdGVsbGl0ZS50cmFjayA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlLnRyaW0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWRlbnRpZmllcjogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXRhaWw6IHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IFsnUnVsZXMgdXNpbmcgdGhlIGRpcmVjdCBjYWxsIGV2ZW50IHR5cGUgd2l0aCBpZGVudGlmaWVyICInICsgZSArICciIGhhdmUgYmVlbiB0cmlnZ2VyZWQnICsgKHQgPyAnIHdpdGggYWRkaXRpb25hbCBkZXRhaWw6JyA6ICcuJyldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiBzLnB1c2godCksIGEubG9nZ2VyLmxvZy5hcHBseShhLmxvZ2dlciwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5sb2dnZXIubG9nKCciJyArIGUgKyAnIiBkb2VzIG5vdCBtYXRjaCBhbnkgZGlyZWN0IGNhbGwgaWRlbnRpZmllcnMuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpW2UuaWRlbnRpZmllcl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gfHwgKG4gPSBpW2UuaWRlbnRpZmllcl0gPSBbXSksIG4ucHVzaCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjdXN0b20tY29kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0N1c3RvbSBDb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc291cmNlLmNhbGwodC5lbGVtZW50LCB0LCB0LnRhcmdldCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvcGFnZUJvdHRvbS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwYWdlLWJvdHRvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ1BhZ2UgQm90dG9tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuKCcuL2hlbHBlcnMvcGFnZUxpZmVjeWNsZUV2ZW50cycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucmVnaXN0ZXJQYWdlQm90dG9tVHJpZ2dlcih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjdXN0b20tY29kZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0N1c3RvbSBDb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGksIHIsIHMsIG8sIGMgPSBuKCdAYWRvYmUvcmVhY3Rvci1kb2N1bWVudCcpLCBsID0gbignQGFkb2JlL3JlYWN0b3ItcHJvbWlzZScpLCB1ID0gbignLi9oZWxwZXJzL2RlY29yYXRlQ29kZScpLCBkID0gbignLi9oZWxwZXJzL2xvYWRDb2RlU2VxdWVudGlhbGx5JyksIHAgPSBuKCcuLi8uLi8uLi9ub2RlX21vZHVsZXMvcG9zdHNjcmliZS9kaXN0L3Bvc3RzY3JpYmUnKSwgZiA9IG4oJy4vaGVscGVycy91bmVzY2FwZUh0bWxDb2RlJyksIG0gPSAociA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwKGMuYm9keSwgZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlZm9yZVdyaXRlVG9rZW46IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS50YWdOYW1lICYmIGUudGFnTmFtZS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSAmJiAnc2NyaXB0JyA9PT0gdCAmJiAoZS5hdHRycy5ub25jZSA9IGkpLCAnc2NyaXB0JyAhPT0gdCAmJiAnc3R5bGUnICE9PSB0IHx8IChPYmplY3Qua2V5cyhlLmF0dHJzIHx8IHt9KS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmF0dHJzW3RdID0gZihlLmF0dHJzW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGUuc3JjICYmIChlLnNyYyA9IGYoZS5zcmMpKSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5sb2dnZXIuZXJyb3IoZS5tc2cpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBzID0gW10sIG8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYy5ib2R5KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBzLmxlbmd0aDspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIocy5zaGlmdCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KG8sIDIwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMucHVzaChlKSwgbygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjLmN1cnJlbnRTY3JpcHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuY3VycmVudFNjcmlwdC5hc3luYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBjLnF1ZXJ5U2VsZWN0b3JBbGwoJ3NjcmlwdCcpLCB0ID0gMDsgdCA8IGUubGVuZ3RoOyB0KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC8obGF1bmNofHNhdGVsbGl0ZUxpYiktW15cL10rLmpzKFw/LiopPyQvLnRlc3Qobi5zcmMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5hc3luYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gYS5nZXRFeHRlbnNpb25TZXR0aW5ncygpLmNzcE5vbmNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcyA9IHIuc2V0dGluZ3Muc291cmNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLnNldHRpbmdzLmlzRXh0ZXJuYWwgPyBkKHMpLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IChuID0gdShyLCBlKSwgbShuLmNvZGUpLCBuLnByb21pc2UpIDogbC5yZXNvbHZlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IChuID0gdShyLCBzKSwgZyB8fCAnbG9hZGluZycgIT09IGMucmVhZHlTdGF0ZSA/IG0obi5jb2RlKSA6IGMud3JpdGUgJiYgITEgPT09IGEucHJvcGVydHlTZXR0aW5ncy5ydWxlQ29tcG9uZW50U2VxdWVuY2luZ0VuYWJsZWQgPyBjLndyaXRlKG4uY29kZSkgOiBtKG4uY29kZSksIG4ucHJvbWlzZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY2xpY2snLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdDbGljaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbignQGFkb2JlL3JlYWN0b3Itd2luZG93JyksIGkgPSBuKCcuL2hlbHBlcnMvY3JlYXRlQnViYmx5JykoKSwgciA9IG5ldyAobignLi9oZWxwZXJzL3dlYWtNYXAnKSkoKSwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUudGFnTmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiAnYScgPT09IHQudG9Mb3dlckNhc2UoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuZ2V0QXR0cmlidXRlKCdocmVmJyksIGkgPSBlLmdldEF0dHJpYnV0ZSgndGFyZ2V0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICYmICghaSB8fCAnX3NlbGYnID09PSBpIHx8ICdfdG9wJyA9PT0gaSAmJiBhLnRvcCA9PT0gYSB8fCBpID09PSBhLm5hbWUpID8gZSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUucGFyZW50Tm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIGkuZXZhbHVhdGVFdmVudCwgITApLCBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmFkZExpc3RlbmVyKGUsIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4ubmF0aXZlRXZlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWkuc19mZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmFuY2hvckRlbGF5ICYmICFyLmhhcyhpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHMoaS50YXJnZXQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvICYmIChpLnByZXZlbnREZWZhdWx0KCksIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5sb2NhdGlvbiA9IG8uaHJlZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5hbmNob3JEZWxheSkpLCByLnNldChpLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZXhwb3J0cy5fX3Jlc2V0ID0gaS5fX3Jlc2V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvdmFsdWVDb21wYXJpc29uLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3ZhbHVlLWNvbXBhcmlzb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdWYWx1ZSBDb21wYXJpc29uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09IHR5cGVvZiBlICYmIGlzRmluaXRlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PSB0eXBlb2YgZSB8fCBlIGluc3RhbmNlb2YgU3RyaW5nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIG4oZSkgPyBlLnRvTG93ZXJDYXNlKCkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KGUpID8gU3RyaW5nKGUpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbihlKSA/IE51bWJlcihlKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBhLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSBpKHQpLCBhID0gaShhKSwgbih0KSAmJiBuKGEpICYmIGUodCwgYSwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAobiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID0gcihuKSwgYSA9IHIoYSksIHQobikgJiYgdChhKSAmJiBlKG4sIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZShhKHQsIGkpLCBhKG4sIGkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGwgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcXVhbHM6IGMoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2VzTm90RXF1YWw6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWwuZXF1YWxzLmFwcGx5KG51bGwsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGFpbnM6IHMoYyhmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMSAhPT0gZS5pbmRleE9mKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9lc05vdENvbnRhaW46IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWwuY29udGFpbnMuYXBwbHkobnVsbCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydHNXaXRoOiBzKGMoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA9PT0gZS5pbmRleE9mKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9lc05vdFN0YXJ0V2l0aDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhbC5zdGFydHNXaXRoLmFwcGx5KG51bGwsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5kc1dpdGg6IHMoYyhmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN1YnN0cmluZyhlLmxlbmd0aCAtIHQubGVuZ3RoLCBlLmxlbmd0aCkgPT09IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2VzTm90RW5kV2l0aDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhbC5lbmRzV2l0aC5hcHBseShudWxsLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hdGNoZXNSZWdleDogcyhmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUmVnRXhwKHQsIG4gPyAnaScgOiAnJykudGVzdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9lc05vdE1hdGNoUmVnZXg6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWwubWF0Y2hlc1JlZ2V4LmFwcGx5KG51bGwsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVzc1RoYW46IG8oZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA8IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlc3NUaGFuT3JFcXVhbDogbyhmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIDw9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdyZWF0ZXJUaGFuOiBvKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBncmVhdGVyVGhhbk9yRXF1YWw6IG8oZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA+PSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc1RydWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzVHJ1dGh5OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCb29sZWFuKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRmFsc2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRmFsc3k6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsW2UuY29tcGFyaXNvbi5vcGVyYXRvcl0oZS5sZWZ0T3BlcmFuZCwgZS5yaWdodE9wZXJhbmQsIEJvb2xlYW4oZS5jb21wYXJpc29uLmNhc2VJbnNlbnNpdGl2ZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9zdWJkb21haW4uanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnc3ViZG9tYWluJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnU3ViZG9tYWluJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuKCdAYWRvYmUvcmVhY3Rvci1kb2N1bWVudCcpLCBpID0gbignLi4vaGVscGVycy90ZXh0TWF0Y2gnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEubG9jYXRpb24uaG9zdG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN1YmRvbWFpbnMuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLnZhbHVlSXNSZWdleCA/IG5ldyBSZWdFeHAoZS52YWx1ZSwgJ2knKSA6IGUudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL3BhdGguanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncGF0aCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ1BhdGggV2l0aG91dCBRdWVyeSBTdHJpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4oJ0BhZG9iZS9yZWFjdG9yLWRvY3VtZW50JyksIGkgPSBuKCcuLi9oZWxwZXJzL3RleHRNYXRjaCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYS5sb2NhdGlvbi5wYXRobmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucGF0aHMuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLnZhbHVlSXNSZWdleCA/IG5ldyBSZWdFeHAoZS52YWx1ZSwgJ2knKSA6IGUudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSh0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvbGlicmFyeUxvYWRlZC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdsaWJyYXJ5LWxvYWRlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0xpYnJhcnkgTG9hZGVkIChQYWdlIFRvcCknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4oJy4vaGVscGVycy9wYWdlTGlmZWN5Y2xlRXZlbnRzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5yZWdpc3RlckxpYnJhcnlMb2FkZWRUcmlnZ2VyKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZG9tYWluJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnRG9tYWluJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuKCdAYWRvYmUvcmVhY3Rvci1kb2N1bWVudCcpLCBpID0gL1t8XFx7fSgpW1xdXiQrKj8uLV0vZywgciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignRXhwZWN0ZWQgYSBzdHJpbmcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlcGxhY2UoaSwgJ1xcJCYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEubG9jYXRpb24uaG9zdG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmRvbWFpbnMuc29tZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQubWF0Y2gobmV3IFJlZ0V4cCgnKF58XFwuKScgKyByKGUpICsgJyQnLCAnaScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9oZWxwZXJzL2dldE9iamVjdFByb3BlcnR5LmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gdC5zcGxpdCgnLicpLCBhID0gZSwgaSA9IDAsIHIgPSBuLmxlbmd0aDsgaSA8IHI7IGkrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gYVtuW2ldXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9oZWxwZXJzL3BhZ2VMaWZlY3ljbGVFdmVudHMuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbignQGFkb2JlL3JlYWN0b3Itd2luZG93JyksIGkgPSBuKCdAYWRvYmUvcmVhY3Rvci1kb2N1bWVudCcpLCByID0gLTEgIT09IGEubmF2aWdhdG9yLmFwcFZlcnNpb24uaW5kZXhPZignTVNJRSAxMCcpLCBzID0gJ1dJTkRPV19MT0FERUQnLCBvID0gJ0RPTV9SRUFEWScsIGMgPSAnUEFHRV9CT1RUT00nLCBsID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50OiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVFdmVudDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW2VdID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5zbGljZSgwLCBtKGUpICsgMSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcodCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnY29tcGxldGUnID09PSBpLnJlYWR5U3RhdGUgPyBzIDogJ2ludGVyYWN0aXZlJyA9PT0gaS5yZWFkeVN0YXRlID8gciA/IG51bGwgOiBvIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBtID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsLmluZGV4T2YoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGcgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFt0XS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYihlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBkW3RdID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGIgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LnRyaWdnZXIsIGEgPSB0LnN5bnRoZXRpY0V2ZW50Rm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGEgPyBhKGUpIDogbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5fc2F0ZWxsaXRlID0gYS5fc2F0ZWxsaXRlIHx8IHt9LCBhLl9zYXRlbGxpdGUucGFnZUJvdHRvbSA9IHAuYmluZChudWxsLCBjKSwgaS5hZGRFdmVudExpc3RlbmVyKCdET01Db250ZW50TG9hZGVkJywgcC5iaW5kKG51bGwsIG8pLCAhMCksIGEuYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsIHAuYmluZChudWxsLCBzKSwgITApLCBhLnNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGYoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiBwKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDApLCBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lzdGVyTGlicmFyeUxvYWRlZFRyaWdnZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZ2lzdGVyUGFnZUJvdHRvbVRyaWdnZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW2NdLnB1c2goeyB0cmlnZ2VyOiBlIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpc3RlckRvbVJlYWR5VHJpZ2dlcjogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRbb10ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJpZ2dlcjogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzeW50aGV0aWNFdmVudEZuOiB1LmJpbmQobnVsbCwgaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpc3RlcldpbmRvd0xvYWRlZFRyaWdnZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW3NdLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyaWdnZXI6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3ludGhldGljRXZlbnRGbjogdS5iaW5kKG51bGwsIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvYWN0aW9ucy9oZWxwZXJzL2RlY29yYXRlQ29kZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuKCcuL2RlY29yYXRvcnMvZGVjb3JhdGVHbG9iYWxKYXZhU2NyaXB0Q29kZScpLCBpID0gbignLi9kZWNvcmF0b3JzL2RlY29yYXRlTm9uR2xvYmFsSmF2YVNjcmlwdENvZGUnKSwgciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGphdmFzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc2V0dGluZ3MuZ2xvYmFsID8gYShlLCB0KSA6IGkoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaHRtbDogbignLi9kZWNvcmF0b3JzL2RlY29yYXRlSHRtbENvZGUnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByW2Uuc2V0dGluZ3MubGFuZ3VhZ2VdKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvYWN0aW9ucy9oZWxwZXJzL2xvYWRDb2RlU2VxdWVudGlhbGx5LmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4oJ0BhZG9iZS9yZWFjdG9yLXByb21pc2UnKSwgaSA9IG4oJy4vZ2V0U291cmNlQnlVcmwnKSwgciA9IGEucmVzb2x2ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbmV3IGEoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuYWxsKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGVbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSB0LCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL25vZGVfbW9kdWxlcy9wb3N0c2NyaWJlL2Rpc3QvcG9zdHNjcmliZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gdGhpcywgYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoblthXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5bYV0uZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG5bYV0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cG9ydHM6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9hZGVkOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbYV0uY2FsbChpLmV4cG9ydHMsIGksIGkuZXhwb3J0cywgdCksIGkubG9hZGVkID0gITAsIGkuZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5tID0gZSwgdC5jID0gbiwgdC5wID0gJycsIHQoMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGUuX19lc01vZHVsZSA/IGUgOiB7IGRlZmF1bHQ6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBhKG4oMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGkuZGVmYXVsdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZS5fX2VzTW9kdWxlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGUsIG4pICYmICh0W25dID0gZVtuXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LmRlZmF1bHQgPSBlLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5fX2VzTW9kdWxlID8gZSA6IHsgZGVmYXVsdDogZSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG0uc2hpZnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZC5sYXN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5hZnRlckRlcXVldWUoKSwgZS5zdHJlYW0gPSBvLmFwcGx5KHZvaWQgMCwgZSksIHQuYWZ0ZXJTdHJlYW1TdGFydCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBuLmJlZm9yZVdyaXRlKGUpLCBnLndyaXRlKGUpLCBuLmFmdGVyV3JpdGUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGcgPSBuZXcgdS5kZWZhdWx0KGUsIG4pKS5pZCA9IGYrKywgZy5uYW1lID0gbi5uYW1lIHx8IGcuaWQsIGMuc3RyZWFtc1tnLm5hbWVdID0gZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLm93bmVyRG9jdW1lbnQsIG8gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xvc2U6IGkuY2xvc2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3BlbjogaS5vcGVuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlOiBpLndyaXRlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlbG46IGkud3JpdGVsbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbChpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbG9zZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wZW46IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoLCB0ID0gQXJyYXkoZSksIG4gPSAwOyBuIDwgZTsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W25dID0gYXJndW1lbnRzW25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhKHQuam9pbignJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlbG46IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYXJndW1lbnRzLmxlbmd0aCwgdCA9IEFycmF5KGUpLCBuID0gMDsgbiA8IGU7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtuXSA9IGFyZ3VtZW50c1tuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSh0LmpvaW4oJycpICsgJ1xuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGcud2luLm9uZXJyb3IgfHwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcud2luLm9uZXJyb3IgPSBmdW5jdGlvbiAoZSwgdCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5lcnJvcih7IG1zZzogZSArICcgLSAnICsgdCArICc6ICcgKyBhIH0pLCBkLmFwcGx5KGcud2luLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBnLndyaXRlKHQsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwoaSwgbyksIGcud2luLm9uZXJyb3IgPSBkLCBuLmRvbmUoKSwgZyA9IG51bGwsIHMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZC5pc0Z1bmN0aW9uKG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHsgZG9uZTogbiB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgnY2xlYXInID09PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG0gPSBbXSwgZyA9IG51bGwsIHZvaWQgKGYgPSAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGQuZGVmYXVsdHMobiwgcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IC9eIy8udGVzdChlKSA/IHdpbmRvdy5kb2N1bWVudC5nZXRFbGVtZW50QnlJZChlLnN1YnN0cigxKSkgOiBlLmpxdWVyeSA/IGVbMF0gOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucG9zdHNjcmliZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuc3RyZWFtID8gYS5zdHJlYW0uYWJvcnQoKSA6IGFbMV0gPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuLmJlZm9yZUVucXVldWUoYSksIG0ucHVzaChhKSwgZyB8fCBzKCksIGUucG9zdHNjcmliZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5fX2VzTW9kdWxlID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBPYmplY3QuYXNzaWduIHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50c1t0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgYSkgJiYgKGVbYV0gPSBuW2FdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZGVmYXVsdCA9IGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBpKG4oMikpLCBkID0gYShuKDQpKSwgcCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFmdGVyQXN5bmM6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZnRlckRlcXVldWU6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZnRlclN0cmVhbVN0YXJ0OiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWZ0ZXJXcml0ZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF1dG9GaXg6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmVmb3JlRW5xdWV1ZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlZm9yZVdyaXRlVG9rZW46IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmVmb3JlV3JpdGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihlLm1zZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsZWFzZUFzeW5jOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmID0gMCwgbSA9IFtdLCBnID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsKGMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyZWFtczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1ZXVlOiBtLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXcml0ZVN0cmVhbTogdS5kZWZhdWx0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICYmIGUuX19lc01vZHVsZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLCBuKSAmJiAodFtuXSA9IGVbbl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5kZWZhdWx0ID0gZSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGUuX19lc01vZHVsZSA/IGUgOiB7IGRlZmF1bHQ6IGUgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0Nhbm5vdCBjYWxsIGEgY2xhc3MgYXMgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBwICsgdCwgYSA9IGUuZ2V0QXR0cmlidXRlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdS5leGlzdHkoYSkgPyBTdHJpbmcoYSkgOiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHMubGVuZ3RoID4gMiAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1syXSA/IGFyZ3VtZW50c1syXSA6IG51bGwsIGEgPSBwICsgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdS5leGlzdHkobikgJiYgJycgIT09IG4gPyBlLnNldEF0dHJpYnV0ZShhLCBuKSA6IGUucmVtb3ZlQXR0cmlidXRlKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ll9fZXNNb2R1bGUgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAxOyB0IDwgYXJndW1lbnRzLmxlbmd0aDsgdCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhcmd1bWVudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgYSkgJiYgKGVbYV0gPSBuW2FdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBsID0gaShuKDMpKSwgdSA9IGEobig0KSksIGQgPSAhMSwgcCA9ICdkYXRhLXBzLScsIGYgPSAncHMtc3R5bGUnLCBtID0gJ3BzLXNjcmlwdCcsIGcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50cy5sZW5ndGggPiAxICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzFdID8gYXJndW1lbnRzWzFdIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcih0aGlzLCBlKSwgdGhpcy5yb290ID0gdCwgdGhpcy5vcHRpb25zID0gbiwgdGhpcy5kb2MgPSB0Lm93bmVyRG9jdW1lbnQsIHRoaXMud2luID0gdGhpcy5kb2MuZGVmYXVsdFZpZXcgfHwgdGhpcy5kb2MucGFyZW50V2luZG93LCB0aGlzLnBhcnNlciA9IG5ldyBsLmRlZmF1bHQoJycsIHsgYXV0b0ZpeDogbi5hdXRvRml4IH0pLCB0aGlzLmFjdHVhbHMgPSBbdF0sIHRoaXMucHJveHlIaXN0b3J5ID0gJycsIHRoaXMucHJveHlSb290ID0gdGhpcy5kb2MuY3JlYXRlRWxlbWVudCh0Lm5vZGVOYW1lKSwgdGhpcy5zY3JpcHRTdGFjayA9IFtdLCB0aGlzLndyaXRlUXVldWUgPSBbXSwgbyh0aGlzLnByb3h5Um9vdCwgJ3Byb3h5b2YnLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS53cml0ZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKChlID0gdGhpcy53cml0ZVF1ZXVlKS5wdXNoLmFwcGx5KGUsIGFyZ3VtZW50cyk7ICF0aGlzLmRlZmVycmVkUmVtb3RlICYmIHRoaXMud3JpdGVRdWV1ZS5sZW5ndGg7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcy53cml0ZVF1ZXVlLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUuaXNGdW5jdGlvbih0KSA/IHRoaXMuX2NhbGxGdW5jdGlvbih0KSA6IHRoaXMuX3dyaXRlSW1wbCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fY2FsbEZ1bmN0aW9uID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2Z1bmN0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGUubmFtZSB8fCBlLnRvU3RyaW5nKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX29uU2NyaXB0U3RhcnQodCksIGUuY2FsbCh0aGlzLndpbiwgdGhpcy5kb2MpLCB0aGlzLl9vblNjcmlwdERvbmUodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fd3JpdGVJbXBsID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnBhcnNlci5hcHBlbmQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHZvaWQgMCwgbiA9IHZvaWQgMCwgYSA9IHZvaWQgMCwgaSA9IFtdOyAodCA9IHRoaXMucGFyc2VyLnJlYWRUb2tlbigpKSAmJiAhKG4gPSB1LmlzU2NyaXB0KHQpKSAmJiAhKGEgPSB1LmlzU3R5bGUodCkpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHQgPSB0aGlzLm9wdGlvbnMuYmVmb3JlV3JpdGVUb2tlbih0KSkgJiYgaS5wdXNoKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkubGVuZ3RoID4gMCAmJiB0aGlzLl93cml0ZVN0YXRpY1Rva2VucyhpKSwgbiAmJiB0aGlzLl9oYW5kbGVTY3JpcHRUb2tlbih0KSwgYSAmJiB0aGlzLl9oYW5kbGVTdHlsZVRva2VuKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX3dyaXRlU3RhdGljVG9rZW5zID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMuX2J1aWxkQ2h1bmsoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuYWN0dWFsID8gKHQuaHRtbCA9IHRoaXMucHJveHlIaXN0b3J5ICsgdC5hY3R1YWwsIHRoaXMucHJveHlIaXN0b3J5ICs9IHQucHJveHksIHRoaXMucHJveHlSb290LmlubmVySFRNTCA9IHQuaHRtbCwgZCAmJiAodC5wcm94eUlubmVySFRNTCA9IHRoaXMucHJveHlSb290LmlubmVySFRNTCksIHRoaXMuX3dhbGtDaHVuaygpLCBkICYmICh0LmFjdHVhbElubmVySFRNTCA9IHRoaXMucm9vdC5pbm5lckhUTUwpLCB0KSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fYnVpbGRDaHVuayA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHRoaXMuYWN0dWFscy5sZW5ndGgsIG4gPSBbXSwgYSA9IFtdLCBpID0gW10sIHIgPSBlLmxlbmd0aCwgcyA9IDA7IHMgPCByOyBzKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlW3NdLCBjID0gby50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobi5wdXNoKGMpLCBvLmF0dHJzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIS9ebm9zY3JpcHQkL2kudGVzdChvLnRhZ05hbWUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSB0Kys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5wdXNoKGMucmVwbGFjZSgvKFwvPz4pLywgJyAnICsgcCArICdpZD0nICsgbCArICcgJDEnKSksIG8uYXR0cnMuaWQgIT09IG0gJiYgby5hdHRycy5pZCAhPT0gZiAmJiBpLnB1c2goJ2F0b21pY1RhZycgPT09IG8udHlwZSA/ICcnIDogJzwnICsgby50YWdOYW1lICsgJyAnICsgcCArICdwcm94eW9mPScgKyBsICsgKG8udW5hcnkgPyAnIC8+JyA6ICc+JykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucHVzaChjKSwgaS5wdXNoKCdlbmRUYWcnID09PSBvLnR5cGUgPyBjIDogJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2tlbnM6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJhdzogbi5qb2luKCcnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWN0dWFsOiBhLmpvaW4oJycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm94eTogaS5qb2luKCcnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fd2Fsa0NodW5rID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSB2b2lkIDAsIHQgPSBbdGhpcy5wcm94eVJvb3RdOyB1LmV4aXN0eShlID0gdC5zaGlmdCgpKTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAxID09PSBlLm5vZGVUeXBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4gfHwgIXMoZSwgJ3Byb3h5b2YnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiAodGhpcy5hY3R1YWxzW3MoZSwgJ2lkJyldID0gZSwgbyhlLCAnaWQnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUucGFyZW50Tm9kZSAmJiBzKGUucGFyZW50Tm9kZSwgJ3Byb3h5b2YnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgJiYgdGhpcy5hY3R1YWxzW2FdLmFwcGVuZENoaWxkKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudW5zaGlmdC5hcHBseSh0LCB1LnRvQXJyYXkoZS5jaGlsZE5vZGVzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX2hhbmRsZVNjcmlwdFRva2VuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMsIG4gPSB0aGlzLnBhcnNlci5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgdGhpcy53cml0ZVF1ZXVlLnVuc2hpZnQobiksIGUuc3JjID0gZS5hdHRycy5zcmMgfHwgZS5hdHRycy5TUkMsIChlID0gdGhpcy5vcHRpb25zLmJlZm9yZVdyaXRlVG9rZW4oZSkpICYmIChlLnNyYyAmJiB0aGlzLnNjcmlwdFN0YWNrLmxlbmd0aCA/IHRoaXMuZGVmZXJyZWRSZW1vdGUgPSBlIDogdGhpcy5fb25TY3JpcHRTdGFydChlKSwgdGhpcy5fd3JpdGVTY3JpcHRUb2tlbihlLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuX29uU2NyaXB0RG9uZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5faGFuZGxlU3R5bGVUb2tlbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLnBhcnNlci5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgdGhpcy53cml0ZVF1ZXVlLnVuc2hpZnQodCksIGUudHlwZSA9IGUuYXR0cnMudHlwZSB8fCBlLmF0dHJzLlRZUEUgfHwgJ3RleHQvY3NzJywgKGUgPSB0aGlzLm9wdGlvbnMuYmVmb3JlV3JpdGVUb2tlbihlKSkgJiYgdGhpcy5fd3JpdGVTdHlsZVRva2VuKGUpLCB0ICYmIHRoaXMud3JpdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl93cml0ZVN0eWxlVG9rZW4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcy5fYnVpbGRTdHlsZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9pbnNlcnRDdXJzb3IodCwgZiksIGUuY29udGVudCAmJiAodC5zdHlsZVNoZWV0ICYmICF0LnNoZWV0ID8gdC5zdHlsZVNoZWV0LmNzc1RleHQgPSBlLmNvbnRlbnQgOiB0LmFwcGVuZENoaWxkKHRoaXMuZG9jLmNyZWF0ZVRleHROb2RlKGUuY29udGVudCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9idWlsZFN0eWxlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMuZG9jLmNyZWF0ZUVsZW1lbnQoZS50YWdOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5zZXRBdHRyaWJ1dGUoJ3R5cGUnLCBlLnR5cGUpLCB1LmVhY2hLZXkoZS5hdHRycywgZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zZXRBdHRyaWJ1dGUoZSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5faW5zZXJ0Q3Vyc29yID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl93cml0ZUltcGwoJzxzcGFuIGlkPSInICsgdCArICciLz4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuZG9jLmdldEVsZW1lbnRCeUlkKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgbi5wYXJlbnROb2RlLnJlcGxhY2VDaGlsZChlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9vblNjcmlwdFN0YXJ0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm91dGVyV3JpdGVzID0gdGhpcy53cml0ZVF1ZXVlLCB0aGlzLndyaXRlUXVldWUgPSBbXSwgdGhpcy5zY3JpcHRTdGFjay51bnNoaWZ0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX29uU2NyaXB0RG9uZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9PT0gdGhpcy5zY3JpcHRTdGFja1swXSA/ICh0aGlzLnNjcmlwdFN0YWNrLnNoaWZ0KCksIHRoaXMud3JpdGUuYXBwbHkodGhpcywgZS5vdXRlcldyaXRlcyksICF0aGlzLnNjcmlwdFN0YWNrLmxlbmd0aCAmJiB0aGlzLmRlZmVycmVkUmVtb3RlICYmICh0aGlzLl9vblNjcmlwdFN0YXJ0KHRoaXMuZGVmZXJyZWRSZW1vdGUpLCB0aGlzLmRlZmVycmVkUmVtb3RlID0gbnVsbCkpIDogdGhpcy5vcHRpb25zLmVycm9yKHsgbXNnOiAnQmFkIHNjcmlwdCBuZXN0aW5nIG9yIHNjcmlwdCBmaW5pc2hlZCB0d2ljZScgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fd3JpdGVTY3JpcHRUb2tlbiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzLl9idWlsZFNjcmlwdChlKSwgYSA9IHRoaXMuX3Nob3VsZFJlbGVhc2UobiksIGkgPSB0aGlzLm9wdGlvbnMuYWZ0ZXJBc3luYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNyYyAmJiAobi5zcmMgPSBlLnNyYywgdGhpcy5fc2NyaXB0TG9hZEhhbmRsZXIobiwgYSA/IGkgOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQoKSwgaSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9pbnNlcnRDdXJzb3IobiwgbSksIG4uc3JjICYmICFhIHx8IHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMub3B0aW9ucy5lcnJvcihlKSwgdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9idWlsZFNjcmlwdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLmRvYy5jcmVhdGVFbGVtZW50KGUudGFnTmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHUuZWFjaEtleShlLmF0dHJzLCBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNldEF0dHJpYnV0ZShlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZS5jb250ZW50ICYmICh0LnRleHQgPSBlLmNvbnRlbnQpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuX3NjcmlwdExvYWRIYW5kbGVyID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5vbmxvYWQgPSBlLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGUub25lcnJvciA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4oKSwgbnVsbCAhPSB0ICYmIHQoKSwgdCA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKCksIHMoZSksIG51bGwgIT0gdCAmJiB0KCksIHQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlWydvbicgKyB0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSBuICYmIChlWydfb24nICsgdF0gPSBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSB0aGlzLm9wdGlvbnMuZXJyb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihlLCAnbG9hZCcpLCByKGUsICdlcnJvcicpLCBjKGUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25sb2FkOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5fb25sb2FkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX29ubG9hZC5hcHBseSh0aGlzLCBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkoeyBtc2c6ICdvbmxvYWQgaGFuZGxlciBmYWlsZWQgJyArIHQgKyAnIEAgJyArIGUuc3JjIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25lcnJvcjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuX29uZXJyb3IpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5fb25lcnJvci5hcHBseSh0aGlzLCBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGkoeyBtc2c6ICdvbmVycm9yIGhhbmRsZXIgZmFpbGVkICcgKyB0ICsgJyBAICcgKyBlLnNyYyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKHsgbXNnOiAncmVtb3RlIHNjcmlwdCBmYWlsZWQgJyArIGUuc3JjIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbnJlYWR5c3RhdGVjaGFuZ2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9eKGxvYWRlZHxjb21wbGV0ZSkkLy50ZXN0KGUucmVhZHlTdGF0ZSkgJiYgYSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fc2hvdWxkUmVsZWFzZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEvXnNjcmlwdCQvaS50ZXN0KGUubm9kZU5hbWUpIHx8ICEhKHRoaXMub3B0aW9ucy5yZWxlYXNlQXN5bmMgJiYgZS5zcmMgJiYgZS5oYXNBdHRyaWJ1dGUoJ2FzeW5jJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZGVmYXVsdCA9IGc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuW2FdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gblthXS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gblthXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwb3J0czoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2FkZWQ6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVthXS5jYWxsKGkuZXhwb3J0cywgaSwgaS5leHBvcnRzLCB0KSwgaS5sb2FkZWQgPSAhMCwgaS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Lm0gPSBlLCB0LmMgPSBuLCB0LnAgPSAnJywgdCgwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5fX2VzTW9kdWxlID8gZSA6IHsgZGVmYXVsdDogZSB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGEobigxKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gaS5kZWZhdWx0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLl9fZXNNb2R1bGUgPyBlIDogeyBkZWZhdWx0OiBlIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiBlLl9fZXNNb2R1bGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSwgbikgJiYgKHRbbl0gPSBlW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZGVmYXVsdCA9IGUsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdDYW5ub3QgY2FsbCBhIGNsYXNzIGFzIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5fX2VzTW9kdWxlID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBpKG4oMikpLCBvID0gaShuKDMpKSwgYyA9IGEobig2KSksIGwgPSBuKDUpLCB1ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tbWVudDogL148IS0tLywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRhZzogL148XC8vLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXRvbWljVGFnOiAvXjxccyooc2NyaXB0fHN0eWxlfG5vc2NyaXB0fGlmcmFtZXx0ZXh0YXJlYSlbXHNcLz5dL2ksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydFRhZzogL148LywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJzOiAvXltePF0vCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpcywgbiA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDogJycsIGEgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIodGhpcywgZSksIHRoaXMuc3RyZWFtID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9ICExLCBvID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbCBpbiBzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLmhhc093blByb3BlcnR5KGwpICYmIChhLmF1dG9GaXggJiYgKG9bbCArICdGaXgnXSA9ICEwKSwgaSA9IGkgfHwgb1tsICsgJ0ZpeCddKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID8gKHRoaXMuX3JlYWRUb2tlbiA9ICgwLCBjLmRlZmF1bHQpKHRoaXMsIG8sIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuX3JlYWRUb2tlbkltcGwoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5fcGVla1Rva2VuID0gKDAsIGMuZGVmYXVsdCkodGhpcywgbywgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5fcGVla1Rva2VuSW1wbCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSA6ICh0aGlzLl9yZWFkVG9rZW4gPSB0aGlzLl9yZWFkVG9rZW5JbXBsLCB0aGlzLl9wZWVrVG9rZW4gPSB0aGlzLl9wZWVrVG9rZW5JbXBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS5hcHBlbmQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RyZWFtICs9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5wcmVwZW5kID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0cmVhbSA9IGUgKyB0aGlzLnN0cmVhbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLl9yZWFkVG9rZW5JbXBsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcy5fcGVla1Rva2VuSW1wbCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdHJlYW0gPSB0aGlzLnN0cmVhbS5zbGljZShlLmxlbmd0aCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5fcGVla1Rva2VuSW1wbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlIGluIHUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh1Lmhhc093blByb3BlcnR5KGUpICYmIHVbZV0udGVzdCh0aGlzLnN0cmVhbSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gb1tlXSh0aGlzLnN0cmVhbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0YXJ0VGFnJyA9PT0gdC50eXBlICYmIC9zY3JpcHR8c3R5bGUvaS50ZXN0KHQudGFnTmFtZSkgPyBudWxsIDogKHQudGV4dCA9IHRoaXMuc3RyZWFtLnN1YnN0cigwLCB0Lmxlbmd0aCksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnByb3RvdHlwZS5wZWVrVG9rZW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuX3BlZWtUb2tlbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUucmVhZFRva2VuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9yZWFkVG9rZW4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnJlYWRUb2tlbnMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSB2b2lkIDA7IHQgPSB0aGlzLnJlYWRUb2tlbigpOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVbdC50eXBlXSAmJiAhMSA9PT0gZVt0LnR5cGVdKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm90b3R5cGUuY2xlYXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLnN0cmVhbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdHJlYW0gPSAnJywgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHJvdG90eXBlLnJlc3QgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3RyZWFtOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHAgaW4gKHQuZGVmYXVsdCA9IGQsIGQudG9rZW5Ub1N0cmluZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkLmVzY2FwZUF0dHJpYnV0ZXMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmhhc093blByb3BlcnR5KG4pICYmICh0W25dID0gKDAsIGwuZXNjYXBlUXVvdGVzKShlW25dLCBudWxsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZC5zdXBwb3J0cyA9IHMsIHMpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLmhhc093blByb3BlcnR5KHApICYmIChkLmJyb3dzZXJIYXNGbGF3ID0gZC5icm93c2VySGFzRmxhdyB8fCAhc1twXSAmJiBwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ll9fZXNNb2R1bGUgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICExLCBhID0gITEsIGkgPSB3aW5kb3cuZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnZGl2Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAnPFA+PEk+PC9QPjwvST4nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmlubmVySFRNTCA9IHIsIHQudGFnU291cCA9IG4gPSBpLmlubmVySFRNTCAhPT0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQudGFnU291cCA9IG4gPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5pbm5lckhUTUwgPSAnPFA+PGk+PFA+PC9QPjwvaT48L1A+JywgdC5zZWxmQ2xvc2UgPSBhID0gMiA9PT0gaS5jaGlsZE5vZGVzLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2VsZkNsb3NlID0gYSA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gbnVsbCwgdC50YWdTb3VwID0gbiwgdC5zZWxmQ2xvc2UgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuaW5kZXhPZignLS0+Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID49IDApCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGwuQ29tbWVudFRva2VuKGUuc3Vic3RyKDQsIHQgLSAxKSwgdCArIDMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmluZGV4T2YoJzwnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBsLkNoYXJzVG9rZW4odCA+PSAwID8gdCA6IGUubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoLTEgIT09IGUuaW5kZXhPZignPicpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUubWF0Y2godS5zdGFydFRhZyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gKHQgPSB7fSwgbiA9IHt9LCBhID0gaVsyXSwgaVsyXS5yZXBsYWNlKHUuYXR0ciwgZnVuY3Rpb24gKGUsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJndW1lbnRzWzJdIHx8IGFyZ3VtZW50c1szXSB8fCBhcmd1bWVudHNbNF0gfHwgYXJndW1lbnRzWzVdID8gYXJndW1lbnRzWzVdID8gKHRbYXJndW1lbnRzWzVdXSA9ICcnLCBuW2FyZ3VtZW50c1s1XV0gPSAhMCkgOiB0W2ldID0gYXJndW1lbnRzWzJdIHx8IGFyZ3VtZW50c1szXSB8fCBhcmd1bWVudHNbNF0gfHwgdS5maWxsQXR0ci50ZXN0KGkpICYmIGkgfHwgJycgOiB0W2ldID0gJycsIGEgPSBhLnJlcGxhY2UoZSwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB7IHY6IG5ldyBsLlN0YXJ0VGFnVG9rZW4oaVsxXSwgaVswXS5sZW5ndGgsIHQsIG4sICEhaVszXSwgYS5yZXBsYWNlKC9eW1xzXHVGRUZGXHhBMF0rfFtcc1x1RkVGRlx4QTBdKyQvZywgJycpKSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT09ICh2b2lkIDAgPT09IHIgPyAndW5kZWZpbmVkJyA6IGMocikpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci52OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHIoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuc2xpY2UodC5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4ubWF0Y2gobmV3IFJlZ0V4cCgnPC9cXHMqJyArIHQudGFnTmFtZSArICdcXHMqPicsICdpJykpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuLm1hdGNoKG5ldyBSZWdFeHAoJyhbXFxzXFxTXSo/KTwvXFxzKicgKyB0LnRhZ05hbWUgKyAnXFxzKj4nLCAnaScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBsLkF0b21pY1RhZ1Rva2VuKHQudGFnTmFtZSwgYVswXS5sZW5ndGggKyB0Lmxlbmd0aCwgdC5hdHRycywgdC5ib29sZWFuQXR0cnMsIGFbMV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUubWF0Y2godS5lbmRUYWcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgbC5FbmRUYWdUb2tlbih0WzFdLCB0WzBdLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuX19lc01vZHVsZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3IgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiBlLmNvbnN0cnVjdG9yID09PSBTeW1ib2wgJiYgZSAhPT0gU3ltYm9sLnByb3RvdHlwZSA/ICdzeW1ib2wnIDogdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmNvbW1lbnQgPSBhLCB0LmNoYXJzID0gaSwgdC5zdGFydFRhZyA9IHIsIHQuYXRvbWljVGFnID0gcywgdC5lbmRUYWcgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gbig0KSwgdSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0VGFnOiAvXjwoW1wtQS1aYS16MC05X10rKSgoPzpccytbXHdcLV0rKD86XHMqPT9ccyooPzooPzoiW14iXSoiKXwoPzonW14nXSonKXxbXj5cc10rKSk/KSopXHMqKFwvPyk+LywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRhZzogL148XC8oW1wtQS1aYS16MC05X10rKVtePl0qPi8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdHRyOiAvKD86KFtcLUEtWmEtejAtOV9dKylccyo9XHMqKD86KD86IigoPzpcXC58W14iXSkqKSIpfCg/OicoKD86XFwufFteJ10pKiknKXwoW14+XHNdKykpKXwoPzooW1wtQS1aYS16MC05X10rKShcc3wkKSspL2csCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxsQXR0cjogL14oY2hlY2tlZHxjb21wYWN0fGRlY2xhcmV8ZGVmZXJ8ZGlzYWJsZWR8aXNtYXB8bXVsdGlwbGV8bm9ocmVmfG5vcmVzaXplfG5vc2hhZGV8bm93cmFwfHJlYWRvbmx5fHNlbGVjdGVkKSQvaQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdDYW5ub3QgY2FsbCBhIGNsYXNzIGFzIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5fX2VzTW9kdWxlID0gITAsIHQuRW5kVGFnVG9rZW4gPSB0LkF0b21pY1RhZ1Rva2VuID0gdC5TdGFydFRhZ1Rva2VuID0gdC5UYWdUb2tlbiA9IHQuQ2hhcnNUb2tlbiA9IHQuQ29tbWVudFRva2VuID0gdC5Ub2tlbiA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4oNSksIHIgPSAodC5Ub2tlbiA9IGZ1bmN0aW9uIGUodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSh0aGlzLCBlKSwgdGhpcy50eXBlID0gdCwgdGhpcy5sZW5ndGggPSBuLCB0aGlzLnRleHQgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5Db21tZW50VG9rZW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKHRoaXMsIGUpLCB0aGlzLnR5cGUgPSAnY29tbWVudCcsIHRoaXMubGVuZ3RoID0gbiB8fCAodCA/IHQubGVuZ3RoIDogMCksIHRoaXMudGV4dCA9ICcnLCB0aGlzLmNvbnRlbnQgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnPCEtLScgKyB0aGlzLmNvbnRlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIHQuQ2hhcnNUb2tlbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEodGhpcywgZSksIHRoaXMudHlwZSA9ICdjaGFycycsIHRoaXMubGVuZ3RoID0gdCwgdGhpcy50ZXh0ID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudGV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgdC5UYWdUb2tlbiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCwgbiwgaSwgciwgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEodGhpcywgZSksIHRoaXMudHlwZSA9IHQsIHRoaXMubGVuZ3RoID0gaSwgdGhpcy50ZXh0ID0gJycsIHRoaXMudGFnTmFtZSA9IG4sIHRoaXMuYXR0cnMgPSByLCB0aGlzLmJvb2xlYW5BdHRycyA9IHMsIHRoaXMudW5hcnkgPSAhMSwgdGhpcy5odG1sNVVuYXJ5ID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5mb3JtYXRUYWcgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiBudWxsLCBuID0gJzwnICsgZS50YWdOYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgaW4gZS5hdHRycykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuYXR0cnMuaGFzT3duUHJvcGVydHkoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gKz0gJyAnICsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5hdHRyc1thXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gZS5ib29sZWFuQXR0cnMgJiYgdm9pZCAwICE9PSBlLmJvb2xlYW5BdHRyc1thXSB8fCAobiArPSAnPSInICsgKDAsIGkuZXNjYXBlUXVvdGVzKShyKSArICciJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZXN0ICYmIChuICs9ICcgJyArIGUucmVzdCksIGUudW5hcnkgJiYgIWUuaHRtbDVVbmFyeSA/IG4gKz0gJy8+JyA6IG4gKz0gJz4nLCBudWxsICE9IHQgJiYgKG4gKz0gdCArICc8LycgKyBlLnRhZ05hbWUgKyAnPicpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LlN0YXJ0VGFnVG9rZW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCwgbiwgaSwgciwgcywgbykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSh0aGlzLCBlKSwgdGhpcy50eXBlID0gJ3N0YXJ0VGFnJywgdGhpcy5sZW5ndGggPSBuLCB0aGlzLnRleHQgPSAnJywgdGhpcy50YWdOYW1lID0gdCwgdGhpcy5hdHRycyA9IGksIHRoaXMuYm9vbGVhbkF0dHJzID0gciwgdGhpcy5odG1sNVVuYXJ5ID0gITEsIHRoaXMudW5hcnkgPSBzLCB0aGlzLnJlc3QgPSBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmZvcm1hdFRhZyh0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIHQuQXRvbWljVGFnVG9rZW4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUodCwgbiwgaSwgciwgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSh0aGlzLCBlKSwgdGhpcy50eXBlID0gJ2F0b21pY1RhZycsIHRoaXMubGVuZ3RoID0gbiwgdGhpcy50ZXh0ID0gJycsIHRoaXMudGFnTmFtZSA9IHQsIHRoaXMuYXR0cnMgPSBpLCB0aGlzLmJvb2xlYW5BdHRycyA9IHIsIHRoaXMudW5hcnkgPSAhMSwgdGhpcy5odG1sNVVuYXJ5ID0gITEsIHRoaXMuY29udGVudCA9IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuZm9ybWF0VGFnKHRoaXMsIHRoaXMuY29udGVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCB0LkVuZFRhZ1Rva2VuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEodGhpcywgZSksIHRoaXMudHlwZSA9ICdlbmRUYWcnLCB0aGlzLmxlbmd0aCA9IG4sIHRoaXMudGV4dCA9ICcnLCB0aGlzLnRhZ05hbWUgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnPC8nICsgdGhpcy50YWdOYW1lICsgJz4nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IGUucmVwbGFjZSgvKFteIl0qKSIvZywgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAvXFwvLnRlc3QodCkgPyB0ICsgJyInIDogdCArICdcXCInOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuX19lc01vZHVsZSA9ICEwLCB0LmVzY2FwZVF1b3RlcyA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdzdGFydFRhZycgPT09IGUudHlwZSAmJiAoZS51bmFyeSA9IG8udGVzdChlLnRhZ05hbWUpIHx8IGUudW5hcnksIGUuaHRtbDVVbmFyeSA9ICEvXC8+JC8udGVzdChlLnRleHQpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5zdHJlYW0sIGkgPSBuKHQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnN0cmVhbSA9IGEsIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQucG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHJlcGVuZCgnPC8nICsgbi50YWdOYW1lICsgJz4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubGFzdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3RoaXMubGVuZ3RoIC0gMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUubGFzdFRhZ05hbWVFcSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMubGFzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgdC50YWdOYW1lICYmIHQudGFnTmFtZS50b1VwcGVyQ2FzZSgpID09PSBlLnRvVXBwZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuY29udGFpbnNUYWdOYW1lID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQsIG4gPSAwOyB0ID0gdGhpc1tuXTsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LnRhZ05hbWUgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlLCB0LCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGEoZSwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIHVbdC50eXBlXSAmJiB1W3QudHlwZV0odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSByKCksIHUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUYWc6IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbi50YWdOYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVFInID09PSBhLnRvVXBwZXJDYXNlKCkgJiYgbC5sYXN0VGFnTmFtZUVxKCdUQUJMRScpID8gKGUucHJlcGVuZCgnPFRCT0RZPicpLCBvKCkpIDogdC5zZWxmQ2xvc2VGaXggJiYgYy50ZXN0KGEpICYmIGwuY29udGFpbnNUYWdOYW1lKGEpID8gbC5sYXN0VGFnTmFtZUVxKGEpID8gaShlLCBsKSA6IChlLnByZXBlbmQoJzwvJyArIG4udGFnTmFtZSArICc+JyksIG8oKSkgOiBuLnVuYXJ5IHx8IGwucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuZFRhZzogZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbC5sYXN0KCkgPyB0LnRhZ1NvdXBGaXggJiYgIWwubGFzdFRhZ05hbWVFcShuLnRhZ05hbWUpID8gaShlLCBsKSA6IGwucG9wKCkgOiB0LnRhZ1NvdXBGaXggJiYgKHMoKSwgbygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8oKSwgbihzKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ll9fZXNNb2R1bGUgPSAhMCwgdC5kZWZhdWx0ID0gczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IC9eKEFSRUF8QkFTRXxCQVNFRk9OVHxCUnxDT0x8RlJBTUV8SFJ8SU1HfElOUFVUfElTSU5ERVh8TElOS3xNRVRBfFBBUkFNfEVNQkVEKSQvaSwgYyA9IC9eKENPTEdST1VQfEREfERUfExJfE9QVElPTlN8UHxURHxURk9PVHxUSHxUSEVBRHxUUikkL2k7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZXhwb3J0cyA9IHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB2b2lkIDAsIGkgPSBlICYmIGUubGVuZ3RoIHx8IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IDA7IGEgPCBpOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmNhbGwobiwgZVthXSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmhhc093blByb3BlcnR5KGEpICYmIHQuY2FsbChuLCBhLCBlW2FdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gZSB8fCB7fSwgcih0LCBmdW5jdGlvbiAodCwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihlW3RdKSB8fCAoZVt0XSA9IGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gKG4gPSBbXSwgaShlLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB7IHY6IG4gfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT09ICh2b2lkIDAgPT09IHQgPyAndW5kZWZpbmVkJyA6IHAodCkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtlLmxlbmd0aCAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIWUgfHwgJ3N0YXJ0VGFnJyAhPT0gZS50eXBlICYmICdhdG9taWNUYWcnICE9PSBlLnR5cGUgfHwgISgndGFnTmFtZScgaW4gZSkgfHwgIX5lLnRhZ05hbWUudG9Mb3dlckNhc2UoKS5pbmRleE9mKHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKGUsICdzY3JpcHQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsKGUsICdzdHlsZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Ll9fZXNNb2R1bGUgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAnc3ltYm9sJyA9PSB0eXBlb2YgU3ltYm9sLml0ZXJhdG9yID8gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgZS5jb25zdHJ1Y3RvciA9PT0gU3ltYm9sICYmIGUgIT09IFN5bWJvbC5wcm90b3R5cGUgPyAnc3ltYm9sJyA6IHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5leGlzdHkgPSBuLCB0LmlzRnVuY3Rpb24gPSBhLCB0LmVhY2ggPSBpLCB0LmVhY2hLZXkgPSByLCB0LmRlZmF1bHRzID0gcywgdC50b0FycmF5ID0gbywgdC5sYXN0ID0gYywgdC5pc1RhZyA9IGwsIHQuaXNTY3JpcHQgPSB1LCB0LmlzU3R5bGUgPSBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAnb2JqZWN0JyA9PSB0eXBlb2YgdCAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgZSA/IGUuZXhwb3J0cyA9IGEoKSA6ICdmdW5jdGlvbicgPT0gdHlwZW9mIGRlZmluZSAmJiBkZWZpbmUuYW1kID8gZGVmaW5lKFtdLCBhKSA6ICdvYmplY3QnID09IHR5cGVvZiB0ID8gdC5wb3N0c2NyaWJlID0gYSgpIDogbi5wb3N0c2NyaWJlID0gYSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2FjdGlvbnMvaGVscGVycy91bmVzY2FwZUh0bWxDb2RlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4oJ0BhZG9iZS9yZWFjdG9yLWRvY3VtZW50JykuY3JlYXRlRWxlbWVudCgnZGl2Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuaW5uZXJIVE1MID0gZSwgYS50ZXh0Q29udGVudCB8fCBhLmlubmVyVGV4dCB8fCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvYWN0aW9ucy9oZWxwZXJzL2RlY29yYXRvcnMvZGVjb3JhdGVHbG9iYWxKYXZhU2NyaXB0Q29kZS5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuKCdAYWRvYmUvcmVhY3Rvci1wcm9taXNlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6ICc8c2NyaXB0PlxuJyArIHQgKyAnXG48L3NjcmlwdD4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvbWlzZTogYS5yZXNvbHZlKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2FjdGlvbnMvaGVscGVycy9kZWNvcmF0b3JzL2RlY29yYXRlTm9uR2xvYmFsSmF2YVNjcmlwdENvZGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbignQGFkb2JlL3JlYWN0b3ItcHJvbWlzZScpLCBpID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICdfcnVuU2NyaXB0JyArICsraSwgciA9IG5ldyBhKGZ1bmN0aW9uICh0LCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3NhdGVsbGl0ZVtuXSA9IGZ1bmN0aW9uIChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBfc2F0ZWxsaXRlW25dLCBuZXcgYShmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChyLmNhbGwoZS5ldmVudC5lbGVtZW50LCBlLmV2ZW50LCBlLmV2ZW50LnRhcmdldCwgYSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS50aGVuKHQsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6ICc8c2NyaXB0Pl9zYXRlbGxpdGVbIicgKyBuICsgJyJdKGZ1bmN0aW9uKGV2ZW50LCB0YXJnZXQsIFByb21pc2UpIHtcbicgKyB0ICsgJ1xufSk7PC9zY3JpcHQ+JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb21pc2U6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2FjdGlvbnMvaGVscGVycy9kZWNvcmF0b3JzL2RlY29yYXRlSHRtbENvZGUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbignQGFkb2JlL3JlYWN0b3ItcHJvbWlzZScpLCByID0gMCwgcyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5fc2F0ZWxsaXRlID0gd2luZG93Ll9zYXRlbGxpdGUgfHwge30sIHdpbmRvdy5fc2F0ZWxsaXRlLl9vbkN1c3RvbUNvZGVTdWNjZXNzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBzW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIChkZWxldGUgc1tlXSwgdC5yZXNvbHZlKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHdpbmRvdy5fc2F0ZWxsaXRlLl9vbkN1c3RvbUNvZGVGYWlsdXJlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBzW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIChkZWxldGUgc1tlXSwgdC5yZWplY3QoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgIT09IGUuaW5kZXhPZignJHtyZWFjdG9yQ2FsbGJhY2tJZH0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5yZXBsYWNlKC9cJHtyZWFjdG9yQ2FsbGJhY2tJZH0vZywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGwgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc2V0dGluZ3MuaXNFeHRlcm5hbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGwoZSkgJiYgKHQgPSBhLnJlcGxhY2VUb2tlbnModCwgZS5ldmVudCkpLCBvKHQpID8gKG4gPSBuZXcgaShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc1tTdHJpbmcocildID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVqZWN0OiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdCA9IGModCwgciksIHIgKz0gMSkgOiBuID0gaS5yZXNvbHZlKCksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvZGU6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9taXNlOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2hlbHBlcnMvZ2V0U291cmNlQnlVcmwuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbignQGFkb2JlL3JlYWN0b3ItbG9hZC1zY3JpcHQnKSwgaSA9IG4oJ0BhZG9iZS9yZWFjdG9yLXByb21pc2UnKSwgciA9IHt9LCBzID0ge30sIG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNbZV0gfHwgKHNbZV0gPSBhKGUpKSwgc1tlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfc2F0ZWxsaXRlLl9fcmVnaXN0ZXJTY3JpcHQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByW2VdID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcltlXSA/IGkucmVzb2x2ZShyW2VdKSA6IG5ldyBpKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvKGUpLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQocltlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL2hlbHBlcnMvY3JlYXRlQnViYmx5LmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4oJy4vd2Vha01hcCcpLCBpID0gbignLi9tYXRjaGVzUHJvcGVydGllcycpLCByID0gbignLi9tYXRjaGVzU2VsZWN0b3InKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gW10sIHQgPSBuZXcgYSgpLCBuID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZExpc3RlbmVyOiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWx1YXRlRXZlbnQ6IGZ1bmN0aW9uIChuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmxlbmd0aCAmJiAhdC5oYXMobikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSBuLnRhcmdldCwgbyA9ICExOyBzOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAhMSwgbCA9ICExLCB1ID0gMDsgdSA8IGUubGVuZ3RoOyB1KyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBlW3VdLCBwID0gZC5zZXR0aW5ncy5lbGVtZW50U2VsZWN0b3IsIGYgPSBkLnNldHRpbmdzLmVsZW1lbnRQcm9wZXJ0aWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKCExICE9PSBkLnNldHRpbmdzLmJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQgfHwgIW8pICYmIChzID09PSBuLnRhcmdldCB8fCAhMSAhPT0gZC5zZXR0aW5ncy5idWJibGVGaXJlSWZQYXJlbnQpICYmIChzID09PSBuLnRhcmdldCB8fCBwIHx8IGYgJiYgT2JqZWN0LmtleXMoZikubGVuZ3RoKSAmJiAoIXAgfHwgcihzLCBwKSkgJiYgKCFmIHx8IGkocywgZikpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA/IE9iamVjdC5rZXlzKG4pLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtW2VdID0gbltlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogbS5uYXRpdmVFdmVudCA9IG4sIG0uZWxlbWVudCA9IHMsIG0udGFyZ2V0ID0gbi50YXJnZXQsICExICE9PSBkLmNhbGxiYWNrKG0pICYmIChsID0gITAsIGQuc2V0dGluZ3MuYnViYmxlU3RvcCAmJiAoYyA9ICEwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgJiYgKG8gPSAhMCksIHMgPSBzLnBhcmVudE5vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNldChuLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fcmVzZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvZXZlbnRzL2hlbHBlcnMvd2Vha01hcC5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKS5XZWFrTWFwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBPYmplY3QuZGVmaW5lUHJvcGVydHksIHIgPSBEYXRlLm5vdygpICUgMTAwMDAwMDAwMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm5hbWUgPSAnX19zdCcgKyAoMTAwMDAwMDAwMCAqIE1hdGgucmFuZG9tKCkgPj4+IDApICsgcisrICsgJ19fJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkucHJvdG90eXBlID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZVt0aGlzLm5hbWVdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICYmIG5bMF0gPT09IGUgPyBuWzFdID0gdCA6IGkoZSwgdGhpcy5uYW1lLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICh0ID0gZVt0aGlzLm5hbWVdKSAmJiB0WzBdID09PSBlID8gdFsxXSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW3RoaXMubmFtZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEoIXQgfHwgdFswXSAhPT0gZSB8fCAodFswXSA9IHRbMV0gPSB2b2lkIDAsIDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXM6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlW3RoaXMubmFtZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhdCAmJiB0WzBdID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnY29yZS9zcmMvbGliL2V2ZW50cy9oZWxwZXJzL21hdGNoZXNQcm9wZXJ0aWVzLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4oJy4vLi4vLi4vaGVscGVycy90ZXh0TWF0Y2gnKSwgaSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0B0ZXh0JyA9PT0gdCB8fCAnaW5uZXJUZXh0JyA9PT0gdCA/IGUudGV4dENvbnRlbnQgfHwgZS5pbm5lclRleHQgOiB0IGluIGUgPyBlW3RdIDogZS5nZXRBdHRyaWJ1dGUgPyBlLmdldEF0dHJpYnV0ZSh0KSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXQgfHwgdC5ldmVyeShmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpKGUsIHQubmFtZSksIHIgPSB0LnZhbHVlSXNSZWdleCA/IG5ldyBSZWdFeHAodC52YWx1ZSwgJ2knKSA6IHQudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShuLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2NvcmUvc3JjL2xpYi9ldmVudHMvaGVscGVycy9tYXRjaGVzU2VsZWN0b3IuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5tYXRjaGVzIHx8IGUubXNNYXRjaGVzU2VsZWN0b3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jYWxsKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmxvZ2dlci53YXJuKCdNYXRjaGluZyBlbGVtZW50IGZhaWxlZC4gJyArIHQgKyAnIGlzIG5vdCBhIHZhbGlkIHNlbGVjdG9yLicpLCAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdjb3JlL3NyYy9saWIvaGVscGVycy90ZXh0TWF0Y2guanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsID09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0lsbGVnYWwgQXJndW1lbnQ6IFBhdHRlcm4gaXMgbm90IHByZXNlbnQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiAoJ3N0cmluZycgPT0gdHlwZW9mIHQgPyBlID09PSB0IDogdCBpbnN0YW5jZW9mIFJlZ0V4cCAmJiB0LnRlc3QoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgJ2Fkb2JlLW1jaWQnOiB7CiAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdFeHBlcmllbmNlIENsb3VkIElEIFNlcnZpY2UnLAogICAgICAgICAgICAgICAgICAgIGhvc3RlZExpYkZpbGVzQmFzZVVybDogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS9leHRlbnNpb25zL0VQZjA0MTJhNWM2NWU1NDI5YWIwZTVlZDhiYTIyNTY1MTAvJywKICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICBvcmdJZDogJ0NDQkM4NzlENTU3MjA3MEU3RjAwMDEwMUBBZG9iZU9yZycsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhcmlhYmxlczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICd0cmFja2luZ1NlcnZlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdhbWF6b25oci5zYy5vbXRyZGMubmV0JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAndHJhY2tpbmdTZXJ2ZXJTZWN1cmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnYW1hem9uaHIuc2Mub210cmRjLm5ldCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgbW9kdWxlczogewogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtbWNpZC9zcmMvbGliL3NoYXJlZE1vZHVsZXMvbWNpZEluc3RhbmNlLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4oJ0BhZG9iZS9yZWFjdG9yLWRvY3VtZW50JyksIHIgPSBuKCcuLi9jb2RlTGlicmFyeS9WaXNpdG9yQVBJJyksIHMgPSBuKCcuLi8uLi92aWV3L3V0aWxzL3RpbWVVbml0cycpLCBvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlZHVjZShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gL14odHJ1ZXxmYWxzZSkkL2kudGVzdCh0LnZhbHVlKSA/IEpTT04ucGFyc2UodC52YWx1ZSkgOiB0LnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3QubmFtZV0gPSBuLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBjID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYS5nZXRFeHRlbnNpb25TZXR0aW5ncygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9IHR5cGVvZiB0Lm9yZ0lkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ09yZyBJRCBpcyBub3QgYSBzdHJpbmcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG8odC52YXJpYWJsZXMgfHwgW10pLCBpID0gdC5kb2VzT3B0SW5BcHBseTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJiYgKCdib29sZWFuJyA9PSB0eXBlb2YgaSA/IG4uZG9lc09wdEluQXBwbHkgPSBpIDogdC5vcHRJbkNhbGxiYWNrICYmIChuLmRvZXNPcHRJbkFwcGx5ID0gdC5vcHRJbkNhbGxiYWNrKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQuaXNPcHRJblN0b3JhZ2VFbmFibGVkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciAmJiAobi5pc09wdEluU3RvcmFnZUVuYWJsZWQgPSByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gdC5vcHRJbkNvb2tpZURvbWFpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgJiYgKG4ub3B0SW5Db29raWVEb21haW4gPSBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gdC5vcHRJblN0b3JhZ2VFeHBpcnk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1ID0gdC50aW1lVW5pdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodSAmJiBzW3VdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gbCAqIHNbdV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ub3B0SW5TdG9yYWdlRXhwaXJ5ID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhMCA9PT0gciAmJiAobi5vcHRJblN0b3JhZ2VFeHBpcnkgPSAzMzY5NjAwMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcCA9IHQucHJldmlvdXNQZXJtaXNzaW9uczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAgJiYgKG4ucHJldmlvdXNQZXJtaXNzaW9ucyA9IHApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSB0LnByZU9wdEluQXBwcm92YWxzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wcmVPcHRJbkFwcHJvdmFscyA9IGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IHQucHJlT3B0SW5BcHByb3ZhbElucHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gJiYgKG4ucHJlT3B0SW5BcHByb3ZhbHMgPSBtKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gdC5pc0lhYkNvbnRleHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnICYmIChuLmlzSWFiQ29udGV4dCA9IGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBlLmdldEluc3RhbmNlKHQub3JnSWQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubG9nZ2VyLmluZm8oJ0NyZWF0ZWQgaW5zdGFuY2UgdXNpbmcgb3JnSWQ6ICInICsgdC5vcmdJZCArICciJyksIGEubG9nZ2VyLmluZm8oJ1NldCB2YXJpYWJsZXM6ICcgKyBKU09OLnN0cmluZ2lmeShuKSksIGIuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmxvZ2dlci5pbmZvKCdPYnRhaW5lZCBNYXJrZXRpbmcgQ2xvdWQgVmlzaXRvciBJZDogJyArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApLCBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBsID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoYS5nZXRFeHRlbnNpb25TZXR0aW5ncygpLnBhdGhFeGNsdXNpb25zIHx8IFtdKS5zb21lKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudmFsdWVJc1JlZ2V4ID8gbmV3IFJlZ0V4cCh0LnZhbHVlLCAnaScpLnRlc3QoZSkgOiB0LnZhbHVlID09PSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHUgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9zYXRlbGxpdGUuZ2V0VmlzaXRvcklkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBsKGkubG9jYXRpb24ucGF0aG5hbWUpID8gYS5sb2dnZXIud2FybignTUNJRCBsaWJyYXJ5IG5vdCBsb2FkZWQuIE9uZSBvZiB0aGUgcGF0aCBleGNsdXNpb25zIG1hdGNoZXMgdGhlIGN1cnJlbnQgcGF0aC4nKSA6IHUgPSBjKHIpLCBlLmV4cG9ydHMgPSB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdtY2lkLWluc3RhbmNlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNoYXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLW1jaWQvc3JjL2xpYi9jb2RlTGlicmFyeS9WaXNpdG9yQVBJLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVvZiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGUuY29uc3RydWN0b3IgPT09IFN5bWJvbCAmJiBlICE9PSBTeW1ib2wucHJvdG90eXBlID8gJ3N5bWJvbCcgOiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgaW4gZSA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogZVt0XSA9IG4sIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2tzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGQ6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbGJhY2tzW2VdID0gdGhpcy5jYWxsYmFja3NbZV0gfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpcy5jYWxsYmFja3NbZV0ucHVzaCh0KSAtIDEsIGEgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5jYWxsYmFja3NbZV0uc3BsaWNlKG4sIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuY2FsbGJhY2tzW2VdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gKHQgPSB2b2lkIDAgPT09IHQgPyBbXSA6IHQpIGluc3RhbmNlb2YgQXJyYXkgPyB0IDogW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgdGhpcy5jYWxsYmFja3NbZV0ubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHRoaXMuY2FsbGJhY2tzW2VdLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT0gdHlwZW9mIG4gPyBuLmFwcGx5KG51bGwsIHQpIDogbiBpbnN0YW5jZW9mIEFycmF5ICYmIG5bMV0uYXBwbHkoblswXSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB0aGlzLmNhbGxiYWNrc1tlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0ZUFsbDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHQgfHwgZSAmJiAhVC5pc09iamVjdEVtcHR5KGUpKSAmJiBPYmplY3Qua2V5cyh0aGlzLmNhbGxiYWNrcykuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB2b2lkIDAgIT09IGVbdF0gPyBlW3RdIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmV4ZWN1dGUodCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzQ2FsbGJhY2tzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCb29sZWFuKE9iamVjdC5rZXlzKHRoaXMuY2FsbGJhY2tzKS5sZW5ndGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG51bGwgPT0gZSA/IHZvaWQgMCA6IGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSBhID8gbiA6IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gL15cZCskLywgbiA9IDAsIGEgPSBlLmxlbmd0aDsgbiA8IGE7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXQudGVzdChlW25dKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGUubGVuZ3RoIDwgdC5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHVzaCgnMCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IHQubGVuZ3RoIDwgZS5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaCgnMCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCBlLmxlbmd0aDsgbisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBwYXJzZUludChlW25dLCAxMCksIGkgPSBwYXJzZUludCh0W25dLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEgPiBpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA+IGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG8oZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUudG9TdHJpbmcoKS5zcGxpdCgnLicpLCBhID0gdC50b1N0cmluZygpLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaShuLmNvbmNhdChhKSkgPyAocihuLCBhKSwgcyhuLCBhKSkgOiBOYU47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gT2JqZWN0KGUpICYmIDAgPT09IE9iamVjdC5rZXlzKGUpLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09IHR5cGVvZiBlIHx8IGUgaW5zdGFuY2VvZiBBcnJheSAmJiBlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6ICcnLCB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2cgPSB1ZSgnbG9nJywgZSwgdCksIHRoaXMud2FybiA9IHVlKCd3YXJuJywgZSwgdCksIHRoaXMuZXJyb3IgPSB1ZSgnZXJyb3InLCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAoYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMF0gPyBhcmd1bWVudHNbMF0gOiB7fSkuY29va2llTmFtZSwgdCA9IChhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSA/IGFyZ3VtZW50c1sxXSA6IHt9KS5jb29raWVzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlIHx8ICF0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogamUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogamUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZTogamUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucmVtb3ZlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5nZXQoZSksIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBKU09OLnBhcnNlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChhLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBpIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IG4uZ2V0KCksIHMgPSBPYmplY3QuYXNzaWduKHIsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNldChlLCBKU09OLnN0cmluZ2lmeShzKSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluOiBpLm9wdEluQ29va2llRG9tYWluIHx8ICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llTGlmZXRpbWU6IGkub3B0SW5TdG9yYWdlRXhwaXJ5IHx8IDM0MTkwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwaXJlczogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5uYW1lID0gdGhpcy5jb25zdHJ1Y3Rvci5uYW1lLCB0aGlzLm1lc3NhZ2UgPSBlLCAnZnVuY3Rpb24nID09IHR5cGVvZiBFcnJvci5jYXB0dXJlU3RhY2tUcmFjZSA/IEVycm9yLmNhcHR1cmVTdGFja1RyYWNlKHRoaXMsIHRoaXMuY29uc3RydWN0b3IpIDogdGhpcy5zdGFjayA9IG5ldyBFcnJvcihlKS5zdGFjazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBnZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5sZW5ndGggPyBuLmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBiZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdyhrKSwgaih0ZS5DT01QTEVURSksIGIoZy5zdGF0dXMsIGcucGVybWlzc2lvbnMpLCBvICYmIG0uc2V0KGcucGVybWlzc2lvbnMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0SW5Db29raWVEb21haW46IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdEluU3RvcmFnZUV4cGlyeTogbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB2LmV4ZWN1dGUoRWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdmUobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1tPcHRJbl0gSW52YWxpZCBjYXRlZ29yeSgtaWVzKS4gUGxlYXNlIHVzZSB0aGUgYE9wdEluLkNhdGVnb3JpZXNgIGVudW0uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqKHRlLkNIQU5HRUQpLCBPYmplY3QuYXNzaWduKGssIGhlKGdlKG4pLCBlKSksIGEgfHwgdCgpLCBnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIHZvaWQgMCAhPT0gYXJndW1lbnRzWzBdID8gYXJndW1lbnRzWzBdIDoge30sIGkgPSBhLmRvZXNPcHRJbkFwcGx5LCByID0gYS5wcmV2aW91c1Blcm1pc3Npb25zLCBzID0gYS5wcmVPcHRJbkFwcHJvdmFscywgbyA9IGEuaXNPcHRJblN0b3JhZ2VFbmFibGVkLCBjID0gYS5vcHRJbkNvb2tpZURvbWFpbiwgbCA9IGEub3B0SW5TdG9yYWdlRXhwaXJ5LCB1ID0gYS5pc0lhYkNvbnRleHQsIHAgPSAoYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiB7fSkuY29va2llcywgZiA9IHdlKHIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGUoZiwgJ0ludmFsaWQgYHByZXZpb3VzUGVybWlzc2lvbnNgIScpLCBEZShzLCAnSW52YWxpZCBgcHJlT3B0SW5BcHByb3ZhbHNgIScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG0gPSBkKHsgY29va2llTmFtZTogJ2Fkb2JldWpzLW9wdGluJyB9LCB7IGNvb2tpZXM6IHAgfSksIGcgPSB0aGlzLCBiID0gZWUoZyksIHYgPSBvZSgpLCBoID0gUGUoZiksIHkgPSBQZShzKSwgXyA9IG8gPyBtLmdldCgpIDoge30sIFAgPSB7fSwgUyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTZShlKSB8fCB0ICYmIFNlKHQpID8gdGUuQ09NUExFVEUgOiB0ZS5QRU5ESU5HOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oaCwgXyksIEMgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGhlKHNlLCAhaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpID8gT2JqZWN0LmFzc2lnbih7fSwgYSwgZSwgdCwgbikgOiBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oeSwgaCwgXyksIGsgPSB5ZShDKSwgaiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLmRlbnkgPSBuKCExKSwgZy5hcHByb3ZlID0gbighMCksIGcuZGVueUFsbCA9IGcuZGVueS5iaW5kKGcsIHNlKSwgZy5hcHByb3ZlQWxsID0gZy5hcHByb3ZlLmJpbmQoZywgc2UpLCBnLmlzQXBwcm92ZWQgPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHQsIGcucGVybWlzc2lvbnMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZy5pc1ByZUFwcHJvdmVkID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0LCB5KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGcuZmV0Y2hQZXJtaXNzaW9ucyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMSAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1sxXSAmJiBhcmd1bWVudHNbMV0sIG4gPSB0ID8gZy5vbih0ZS5DT01QTEVURSwgZSkgOiBqZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWkgfHwgaSAmJiBnLmlzQ29tcGxldGUgfHwgcyA/IGUoZy5wZXJtaXNzaW9ucykgOiB0IHx8IHYuYWRkKEVlLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKGcucGVybWlzc2lvbnMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZy5jb21wbGV0ZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLnN0YXR1cyA9PT0gdGUuQ0hBTkdFRCAmJiB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBnLnJlZ2lzdGVyUGx1Z2luID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUgfHwgIWUubmFtZSB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBlLm9uUmVnaXN0ZXIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihPZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFtlLm5hbWVdIHx8IChQW2UubmFtZV0gPSBlLCBlLm9uUmVnaXN0ZXIuY2FsbChlLCBnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBnLmV4ZWN1dGUgPSBUZShQKSwgZy5tZW1vaXplQ29udGVudCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2UoZSkgJiYgbS5zZXQoZSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcHRJbkNvb2tpZURvbWFpbjogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0SW5TdG9yYWdlRXhwaXJ5OiBsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBnLmdldE1lbW9pemVkQ29udGVudCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBtLmdldCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZXJtaXNzaW9uczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBDOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2F0ZWdvcmllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9lc09wdEluQXBwbHk6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc1BlbmRpbmc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5zdGF0dXMgPT09IHRlLlBFTkRJTkc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQ29tcGxldGU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5zdGF0dXMgPT09IHRlLkNPTVBMRVRFOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfX3BsdWdpbnM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoUCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzSWFiQ29udGV4dDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBudWxsLCBlLmNhbGwoZSwgbmV3IHAoJ1RoZSBjYWxsIHRvb2sgbG9uZ2VyIHRoYW4geW91IHdhbnRlZCEnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJiYgKGNsZWFyVGltZW91dChpKSwgZS5hcHBseShlLCBhcmd1bWVudHMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHNldFRpbWVvdXQobiwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBnKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5fX3RjZmFwaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93Ll9fdGNmYXBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB3aW5kb3c7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSAhPT0gd2luZG93LnRvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQ7ICF0OykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5wYXJlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZyYW1lcy5fX3RjZmFwaUxvY2F0b3IgJiYgKHQgPSBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSB3aW5kb3cudG9wKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuX190Y2ZhcGkgPSBmdW5jdGlvbiAoZSwgYSwgaSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBNYXRoLnJhbmRvbSgpICsgJycsIG8gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF9fdGNmYXBpQ2FsbDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tbWFuZDogZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtZXRlcjogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsSWQ6IHMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3NdID0gaSwgdC5wb3N0TWVzc2FnZShvLCAnKicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignbWVzc2FnZScsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUuZGF0YTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gSlNPTi5wYXJzZShlLmRhdGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5fX3RjZmFwaVJldHVybikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdC5fX3RjZmFwaVJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiBuW2EuY2FsbElkXSAmJiAoblthLmNhbGxJZF0oYS5yZXR1cm5WYWx1ZSwgYS5zdWNjZXNzKSwgZGVsZXRlIG5bYS5jYWxsSWRdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITEpLCB3aW5kb3cuX190Y2ZhcGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlLmVycm9yKCdfX3RjZmFwaSBub3QgZm91bmQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlLmVycm9yKCdfX3RjZmFwaSBub3QgZm91bmQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMl0gPyBhcmd1bWVudHNbMl0gOiBbXSwgYSA9ICEwID09PSBlLnZlbmRvci5jb25zZW50c1t0XSwgaSA9IG4uZXZlcnkoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBlLnB1cnBvc2UuY29uc2VudHNbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSAmJiBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHYoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm5hbWUgPSAnaWFiUGx1Z2luJywgZS52ZXJzaW9uID0gJzAuMC4yJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gb2UoKSwgYSA9IHsgdHJhbnNwYXJlbmN5QW5kQ29uc2VudERhdGE6IG51bGwgfSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gPyBhcmd1bWVudHNbMV0gOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbZV0gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZldGNoQ29uc2VudERhdGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbShlLmNhbGxiYWNrLCBlLnRpbWVvdXQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoeyBjYWxsYmFjazogdCB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuaXNBcHByb3ZlZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmNhbGxiYWNrLCBuID0gZS5jYXRlZ29yeSwgaSA9IGUudGltZW91dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS50cmFuc3BhcmVuY3lBbmRDb25zZW50RGF0YSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQobnVsbCwgYihhLnRyYW5zcGFyZW5jeUFuZENvbnNlbnREYXRhLCBhZVtuXSwgaWVbbl0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IG0oZnVuY3Rpb24gKGUsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChlLCBiKGEsIGFlW25dLCBpZVtuXSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRlZ29yeTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IHMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUub25SZWdpc3RlciA9IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBPYmplY3Qua2V5cyhhZSksIGkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWUgJiYgdCAmJiAoYS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBiKHQsIGFlW2VdLCBpZVtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgblthID8gJ2FwcHJvdmUnIDogJ2RlbnknXShlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbi5jb21wbGV0ZSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmZldGNoQ29uc2VudERhdGEoeyBjYWxsYmFjazogaSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5jYWxsYmFjazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEudHJhbnNwYXJlbmN5QW5kQ29uc2VudERhdGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihudWxsLCBhLnRyYW5zcGFyZW5jeUFuZENvbnNlbnREYXRhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5hZGQoJ0ZFVENIX0NPTlNFTlRfREFUQScsIHIpLCBzKGZ1bmN0aW9uIChlLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0geWUoZSksIG8gPSB0LmdldE1lbW9pemVkQ29udGVudCgnaWFiQ29uc2VudEhhc2gnKSwgYyA9IHBlKHMudGNTdHJpbmcpLnRvU3RyaW5nKDMyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLmNvbnNlbnRTdHJpbmcgPSBlLnRjU3RyaW5nLCBzLmhhc0NvbnNlbnRDaGFuZ2VkU2luY2VMYXN0Q21wUHVsbCA9IG8gIT09IGMsIGkoJ3RyYW5zcGFyZW5jeUFuZENvbnNlbnREYXRhJywgcyksIHQubWVtb2l6ZUNvbnRlbnQoeyBpYWJDb25zZW50SGFzaDogYyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4uZXhlY3V0ZSgnRkVUQ0hfQ09OU0VOVF9EQVRBJywgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS50cmFuc3BhcmVuY3lBbmRDb25zZW50RGF0YQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEllKGFlKSwgbiA9IGcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgbiAmJiBuKCdnZXRUQ0RhdGEnLCAyLCBlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGdsb2JhbFRoaXMgPyBnbG9iYWxUaGlzIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHdpbmRvdyA/IHdpbmRvdyA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiBnbG9iYWwgPyBnbG9iYWwgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2Ygc2VsZiA/IHNlbGYgOiB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmFzc2lnbiA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQsIG4sIGEgPSAxOyBhIDwgYXJndW1lbnRzLmxlbmd0aDsgKythKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCBpbiBuID0gYXJndW1lbnRzW2FdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwobiwgdCkgJiYgKGVbdF0gPSBuW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSwgXywgUCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNRVNTQUdFUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIQU5EU0hBS0U6ICdIQU5EU0hBS0UnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRVRTVEFURTogJ0dFVFNUQVRFJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUEFSRU5UU1RBVEU6ICdQQVJFTlRTVEFURScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNUQVRFX0tFWVNfTUFQOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DTUlEOiAnTUNNSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FJRDogJ01DQUlEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBQU1COiAnTUNBQU1CJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBQU1MSDogJ01DQUFNTEgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ09QVE9VVDogJ01DT1BUT1VUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ1VTVE9NRVJJRFM6ICdDVVNUT01FUklEUycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFTWU5DX0FQSV9NQVA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNNSUQ6ICdnZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUlEOiAnZ2V0QW5hbHl0aWNzVmlzaXRvcklEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBQU1COiAnZ2V0QXVkaWVuY2VNYW5hZ2VyQmxvYicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNTEg6ICdnZXRBdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ09QVE9VVDogJ2lzT3B0ZWRPdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBTExGSUVMRFM6ICdnZXRWaXNpdG9yVmFsdWVzJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU1lOQ19BUElfTUFQOiB7IENVU1RPTUVSSURTOiAnZ2V0Q3VzdG9tZXJJRHMnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxMX0FQSVM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNNSUQ6ICdnZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNQjogJ2dldEF1ZGllbmNlTWFuYWdlckJsb2InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUxIOiAnZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNPUFRPVVQ6ICdpc09wdGVkT3V0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNBSUQ6ICdnZXRBbmFseXRpY3NWaXNpdG9ySUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDVVNUT01FUklEUzogJ2dldEN1c3RvbWVySURzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUxMRklFTERTOiAnZ2V0VmlzaXRvclZhbHVlcycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZJRUxER1JPVVBfVE9fRklFTEQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUM6ICdNQ01JRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEE6ICdNQ0FJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFBTTogJ01DQUFNQicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZJRUxEUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ01JRDogJ01DTUlEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUNPUFRPVVQ6ICdNQ09QVE9VVCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUlEOiAnTUNBSUQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUxIOiAnTUNBQU1MSCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNQjogJ01DQUFNQicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVVEhfU1RBVEU6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVU5LTk9XTjogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQVVUSEVOVElDQVRFRDogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTE9HR0VEX09VVDogMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT1BUX09VVDogeyBHTE9CQUw6ICdnbG9iYWwnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU0FNRV9TSVRFX1ZBTFVFUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMQVg6ICdMYXgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTVFJJQ1Q6ICdTdHJpY3QnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOT05FOiAnTm9uZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBTID0gUC5TVEFURV9LRVlTX01BUCwgQyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbih0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZSgwLCB0KSwgciA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJbdF0gPSBpLCBhLnNldFN0YXRlQW5kUHVibGlzaChyKSwgbihpKSwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlIHx8IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5maW5kRmllbGQoUy5NQ01JRCwgZSksIGkgPSBuLmNhbGwodGhpcywgUy5NQ01JRCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IGEgPyBhIDogaSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuZ2V0VmlzaXRvclZhbHVlcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUoeyBNQ01JRDogdCB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGsgPSBQLk1FU1NBR0VTLCBqID0gUC5BU1lOQ19BUElfTUFQLCB3ID0gUC5TWU5DX0FQSV9NQVAsIEQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmNhbGxiYWNrUmVnaXN0cnkuYWRkKGUsIHQpLCBuLm1lc3NhZ2VQYXJlbnQoay5HRVRTVEFURSksICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1tqW25dXSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gYSB8fCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0aGlzLmZpbmRGaWVsZChuLCBhKSwgciA9IHQuY2FsbCh0aGlzLCBuLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IGkgPyBpIDogcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t3W3RdXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmZpbmRGaWVsZCh0LCBlKSB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoaikuZm9yRWFjaChuLCB0aGlzKSwgT2JqZWN0LmtleXModykuZm9yRWFjaChhLCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFYgPSBQLkFTWU5DX0FQSV9NQVAsIEkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoVikuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzW1ZbZV1dID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2FsbGJhY2tSZWdpc3RyeS5hZGQoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBUID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0ID0geyBleHBvcnRzOiB7fSB9LCB0LmV4cG9ydHMpLCB0LmV4cG9ydHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5pc09iamVjdEVtcHR5ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IE9iamVjdChlKSAmJiAwID09PSBPYmplY3Qua2V5cyhlKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbi5pc1ZhbHVlRW1wdHkgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJycgPT09IGUgfHwgbi5pc09iamVjdEVtcHR5KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmF2aWdhdG9yLmFwcE5hbWUsIHQgPSBuYXZpZ2F0b3IudXNlckFnZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ01pY3Jvc29mdCBJbnRlcm5ldCBFeHBsb3JlcicgPT09IGUgfHwgdC5pbmRleE9mKCdNU0lFICcpID49IDAgfHwgdC5pbmRleE9mKCdUcmlkZW50LycpID49IDAgJiYgdC5pbmRleE9mKCdXaW5kb3dzIE5UIDYnKSA+PSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5nZXRJZVZlcnNpb24gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkb2N1bWVudC5kb2N1bWVudE1vZGUgPyBkb2N1bWVudC5kb2N1bWVudE1vZGUgOiBhKCkgPyA3IDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuLmVuY29kZUFuZEJ1aWxkUmVxdWVzdCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLm1hcChlbmNvZGVVUklDb21wb25lbnQpLmpvaW4odCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbi5pc09iamVjdCA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9PSB0ICYmICdvYmplY3QnID09PSBlKHQpICYmICExID09PSBBcnJheS5pc0FycmF5KHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4uZGVmaW5lR2xvYmFsTmFtZXNwYWNlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LmFkb2JlID0gbi5pc09iamVjdCh3aW5kb3cuYWRvYmUpID8gd2luZG93LmFkb2JlIDoge30sIHdpbmRvdy5hZG9iZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuLnBsdWNrID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucmVkdWNlKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtuXSAmJiAodFtuXSA9IGVbbl0pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBPYmplY3QuY3JlYXRlKG51bGwpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBuLnBhcnNlT3B0T3V0ID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCB8fCAodCA9IG4sIGUuZF9vcHRvdXQgJiYgZS5kX29wdG91dCBpbnN0YW5jZW9mIEFycmF5ICYmICh0ID0gZS5kX29wdG91dC5qb2luKCcsJykpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBwYXJzZUludChlLmRfb3R0bCwgMTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNOYU4oYSkgJiYgKGEgPSA3MjAwKSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0T3V0OiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZF9vdHRsOiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbi5ub3JtYWxpemVCb29sZWFuID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RydWUnID09PSBlID8gdCA9ICEwIDogJ2ZhbHNlJyA9PT0gZSAmJiAodCA9ICExKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIEUgPSAoVC5pc09iamVjdEVtcHR5LCBULmlzVmFsdWVFbXB0eSwgVC5nZXRJZVZlcnNpb24sIFQuZW5jb2RlQW5kQnVpbGRSZXF1ZXN0LCBULmlzT2JqZWN0LCBULmRlZmluZUdsb2JhbE5hbWVzcGFjZSwgVC5wbHVjaywgVC5wYXJzZU9wdE91dCwgVC5ub3JtYWxpemVCb29sZWFuLCBuKSwgTyA9IFAuTUVTU0FHRVMsIEEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMDogJ3ByZWZpeCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTogJ29yZ0lEJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyOiAnc3RhdGUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBNID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnBhcnNlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5kYXRhLnNwbGl0KCd8JykuZm9yRWFjaChmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gZSAmJiAodFtBW25dXSA9IDIgIT09IG4gPyBlIDogSlNPTi5wYXJzZShlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5pc0ludmFsaWQgPSBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMucGFyc2Uobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYSB8fCBPYmplY3Qua2V5cyhhKS5sZW5ndGggPCAyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGUgIT09IGEub3JnSUQsIHIgPSAhdCB8fCBuLm9yaWdpbiAhPT0gdCwgcyA9IC0xID09PSBPYmplY3Qua2V5cyhPKS5pbmRleE9mKGEucHJlZml4KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgfHwgciB8fCBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRoaXMuc2VuZCA9IGZ1bmN0aW9uIChuLCBhLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gYSArICd8JyArIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJiYgaSA9PT0gT2JqZWN0KGkpICYmIChyICs9ICd8JyArIEpTT04uc3RyaW5naWZ5KGkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4ucG9zdE1lc3NhZ2UociwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBMID0gUC5NRVNTQUdFUywgTiA9IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gaShlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5hc3NpZ24oZiwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuYXNzaWduKGYuc3RhdGUsIGUpLCBPYmplY3QuYXNzaWduKGYuc3RhdGUuQUxMRklFTERTLCBlKSwgZi5jYWxsYmFja1JlZ2lzdHJ5LmV4ZWN1dGVBbGwoZi5zdGF0ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWIuaXNJbnZhbGlkKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGIucGFyc2UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnNldFN0YXRlQW5kUHVibGlzaCh0LnN0YXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWcgJiYgbSAmJiAoZyA9ICEwLCBiLnNlbmQoYSwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKG5ldyBDKG4uX2dlbmVyYXRlSUQpKSwgZi5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCgpLCBmLmNhbGxiYWNrUmVnaXN0cnkuZXhlY3V0ZUFsbChmLnN0YXRlLCAhMCksIGgucmVtb3ZlRXZlbnRMaXN0ZW5lcignbWVzc2FnZScsIGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBsKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFiLmlzSW52YWxpZChlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBiLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9ICExLCBoLmNsZWFyVGltZW91dChmLl9oYW5kc2hha2VUaW1lb3V0KSwgaC5yZW1vdmVFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgbCksIGkobmV3IEQoZikpLCBoLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBzKSwgZi5zZXRTdGF0ZUFuZFB1Ymxpc2godC5zdGF0ZSksIGYuY2FsbGJhY2tSZWdpc3RyeS5oYXNDYWxsYmFja3MoKSAmJiBvKEwuR0VUU1RBVEUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gJiYgcG9zdE1lc3NhZ2UgPyAoaC5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgbCksIG8oTC5IQU5EU0hBS0UpLCBmLl9oYW5kc2hha2VUaW1lb3V0ID0gc2V0VGltZW91dChjLCAyNTApKSA6IGMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5zX2NfaW4gfHwgKGguc19jX2lsID0gW10sIGguc19jX2luID0gMCksIGYuX2MgPSAnVmlzaXRvcicsIGYuX2lsID0gaC5zX2NfaWwsIGYuX2luID0gaC5zX2NfaW4sIGYuX2lsW2YuX2luXSA9IGYsIGguc19jX2luKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCAhPT0gZS5pbmRleE9mKCdfJykgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgbltlXSAmJiAoZltlXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKG4pLmZvckVhY2goZSksIGYuZ2V0U3VwcGxlbWVudGFsRGF0YUlEID0gbi5nZXRTdXBwbGVtZW50YWxEYXRhSUQsIGYuaXNBbGxvd2VkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHRoaXMsIG0gPSB0LndoaXRlbGlzdFBhcmVudERvbWFpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnN0YXRlID0geyBBTExGSUVMRFM6IHt9IH0sIGYudmVyc2lvbiA9IG4udmVyc2lvbiwgZi5tYXJrZXRpbmdDbG91ZE9yZ0lEID0gZSwgZi5jb29raWVEb21haW4gPSBuLmNvb2tpZURvbWFpbiB8fCAnJywgZi5faW5zdGFuY2VUeXBlID0gJ2NoaWxkJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9ICExLCBiID0gbmV3IE0oZSwgbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5jYWxsYmFja1JlZ2lzdHJ5ID0gRSgpLCBmLmluaXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQoKSwgcCgpLCBpKG5ldyBJKGYpKSwgdSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGYuZmluZEZpZWxkID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gZi5zdGF0ZVtlXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KGYuc3RhdGVbZV0pLCBmLnN0YXRlW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGYubWVzc2FnZVBhcmVudCA9IG8sIGYuc2V0U3RhdGVBbmRQdWJsaXNoID0gcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHggPSBQLk1FU1NBR0VTLCBSID0gUC5BTExfQVBJUywgRiA9IFAuQVNZTkNfQVBJX01BUCwgQiA9IFAuRklFTERHUk9VUF9UT19GSUVMRCwgVSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKFIpLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gUltuXSwgaSA9IGVbYV0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFQuaXNWYWx1ZUVtcHR5KGkpIHx8ICh0W25dID0gaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5fbG9hZGluZyAmJiBPYmplY3Qua2V5cyhlLl9sb2FkaW5nKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5fbG9hZGluZ1tuXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gQltuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0Lmxlbmd0aCA/IHQgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIG4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBGW2lbMF1dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbcl0obiwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKGUsIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2VuZChlLCBhLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMoZSksIHIoZSwgeC5IQU5EU0hBS0UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBvKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKGUsIHguUEFSRU5UU1RBVEUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYShhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmNhbGwoZSwgYSksIHQuc2VuZChuLCB4LlBBUkVOVFNUQVRFLCB7IENVU1RPTUVSSURTOiBlLmdldEN1c3RvbWVySURzKCkgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLnNldEN1c3RvbWVySURzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNldEN1c3RvbWVySURzID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuaXNJbnZhbGlkKGUpIHx8ICh0LnBhcnNlKGUpLnByZWZpeCA9PT0geC5IQU5EU0hBS0UgPyBzIDogbykoZS5zb3VyY2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBIID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhW2VdID0gbiwgKytpID09PSByICYmIHQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0ge30sIGkgPSAwLCByID0gT2JqZWN0LmtleXMoZSkubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKGUpLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5mbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBhLmFyZ3MgfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnVuc2hpZnQobih0KSksIGEuZm4uYXBwbHkoYS5jb250ZXh0IHx8IG51bGwsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB6ID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGVuY29kZVVSSUNvbXBvbmVudChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAoJzsnICsgZG9jdW1lbnQuY29va2llKS5zcGxpdCgnICcpLmpvaW4oJzsnKSwgbiA9IHQuaW5kZXhPZignOycgKyBlICsgJz0nKSwgYSA9IG4gPCAwID8gbiA6IHQuaW5kZXhPZignOycsIG4gKyAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4gPCAwID8gJycgOiBkZWNvZGVVUklDb21wb25lbnQodC5zdWJzdHJpbmcobiArIDIgKyBlLmxlbmd0aCwgYSA8IDAgPyB0Lmxlbmd0aCA6IGEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBhKG4sICdjb29raWVMaWZldGltZScpLCByID0gYShuLCAnZXhwaXJlcycpLCBzID0gYShuLCAnZG9tYWluJyksIG8gPSBhKG4sICdzZWN1cmUnKSwgYyA9IGEobiwgJ3NhbWVTaXRlJyksIGwgPSBvID8gJ1NlY3VyZScgOiAnJywgdSA9IGMgPyAnU2FtZVNpdGU9JyArIGMgKyAnOycgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgJiYgJ1NFU1NJT04nICE9PSBpICYmICdOT05FJyAhPT0gaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSAnJyAhPT0gdCA/IHBhcnNlSW50KGkgfHwgMCwgMTApIDogLTYwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHIgPSBuZXcgRGF0ZSgpKS5zZXRUaW1lKHIuZ2V0VGltZSgpICsgMTAwMCAqIGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoMSA9PT0gcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gKHIgPSBuZXcgRGF0ZSgpKS5nZXRZZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5zZXRZZWFyKHAgKyAyICsgKHAgPCAxOTAwID8gMTkwMCA6IDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ05PTkUnICE9PSBpID8gKGRvY3VtZW50LmNvb2tpZSA9IGVuY29kZVVSSUNvbXBvbmVudChlKSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh0KSArICc7IHBhdGg9LzsnICsgKHIgPyAnIGV4cGlyZXM9JyArIHIudG9HTVRTdHJpbmcoKSArICc7JyA6ICcnKSArIChzID8gJyBkb21haW49JyArIHMgKyAnOycgOiAnJykgKyB1ICsgbCwgdGhpcy5nZXQoZSkgPT09IHQpIDogMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBhKHQsICdkb21haW4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG4gPyAnIGRvbWFpbj0nICsgbiArICc7JyA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGEodCwgJ3NlY3VyZScpLCByID0gYSh0LCAnc2FtZVNpdGUnKSwgcyA9IGkgPyAnU2VjdXJlJyA6ICcnLCBvID0gciA/ICdTYW1lU2l0ZT0nICsgciArICc7JyA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5jb29raWUgPSBlbmNvZGVVUklDb21wb25lbnQoZSkgKyAnPTsgUGF0aD0vOyBFeHBpcmVzPVRodSwgMDEgSmFuIDE5NzAgMDA6MDA6MDEgR01UOycgKyBuICsgbyArIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgVyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWUgJiYgaC5sb2NhdGlvbiAmJiAoZSA9IGgubG9jYXRpb24uaG9zdG5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCBhID0gZS5zcGxpdCgnLicpLCBpID0gdCB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSBhLmxlbmd0aCAtIDI7IG4gPj0gMDsgbi0tKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaS5kb21haW4gPSBhLnNsaWNlKG4pLmpvaW4oJy4nKSwgei5zZXQoJ3Rlc3QnLCAnY29va2llJywgaSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gei5yZW1vdmUoJ3Rlc3QnLCBpKSwgaS5kb21haW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgSiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wYXJlOiBvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzTGVzc1RoYW46IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKGUsIHQpIDwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZVZlcnNpb25zRGlmZmVyZW50OiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCAhPT0gbyhlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzR3JlYXRlclRoYW46IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvKGUsIHQpID4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRXF1YWw6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwID09PSBvKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHEgPSAhIWgucG9zdE1lc3NhZ2UsIEcgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zdE1lc3NhZ2U6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAocSA/IG4ucG9zdE1lc3NhZ2UoZSwgdC5yZXBsYWNlKC8oW146XSs6XC9cL1teXC9dKykuKi8sICckMScpKSA6IHQgJiYgKG4ubG9jYXRpb24gPSB0LnJlcGxhY2UoLyMuKiQvLCAnJykgKyAnIycgKyArbmV3IERhdGUoKSArIGErKyArICcmJyArIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlY2VpdmVNZXNzYWdlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHEgJiYgKGUgJiYgKG4gPSBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgdCAmJiBuLm9yaWdpbiAhPT0gdCB8fCAnW29iamVjdCBGdW5jdGlvbl0nID09PSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwodCkgJiYgITEgPT09IHQobi5vcmlnaW4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBoLmFkZEV2ZW50TGlzdGVuZXIgPyBoW2UgPyAnYWRkRXZlbnRMaXN0ZW5lcicgOiAncmVtb3ZlRXZlbnRMaXN0ZW5lciddKCdtZXNzYWdlJywgbikgOiBoW2UgPyAnYXR0YWNoRXZlbnQnIDogJ2RldGFjaEV2ZW50J10oJ29ubWVzc2FnZScsIG4pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgWSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIGEgPSAnMDEyMzQ1Njc4OScsIGkgPSAnJywgciA9ICcnLCBzID0gOCwgbyA9IDEwLCBjID0gMTA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgKz0gJ0FCQ0RFRicsIHQgPSAwOyAxNiA+IHQ7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBzKSwgaSArPSBhLnN1YnN0cmluZyhuLCBuICsgMSksIG4gPSBNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBzKSwgciArPSBhLnN1YnN0cmluZyhuLCBuICsgMSksIHMgPSAxNjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgKyAnLScgKyByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSAwOyAxOSA+IHQ7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIG8pLCBpICs9IGEuc3Vic3RyaW5nKG4sIG4gKyAxKSwgMCA9PT0gdCAmJiA5ID09IG4gPyBvID0gMyA6ICgoMSA9PSB0IHx8IDIgPT0gdCkgJiYgMTAgIT0gbyAmJiAyID4gbiB8fCAyIDwgdCkgJiYgKG8gPSAxMCksIG4gPSBNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBjKSwgciArPSBhLnN1YnN0cmluZyhuLCBuICsgMSksIDAgPT09IHQgJiYgOSA9PSBuID8gYyA9IDMgOiAoKDEgPT0gdCB8fCAyID09IHQpICYmIDEwICE9IGMgJiYgMiA+IG4gfHwgMiA8IHQpICYmIChjID0gMTApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpICsgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnNNZXRhZGF0YTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF9mYTM2NWZhZDg5MWMxNzMyID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JyksICRfX19vbGRfMDllYWMzMWFhZGY3YTlmNSA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9mYTM2NWZhZDg5MWMxNzMyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja18wMGEyZWJlZjcxM2JiNWVhLlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMDllYWMzMWFhZGY3YTlmNSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfMDBhMmViZWY3MTNiYjVlYS5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gJ25vbmUnLCB0ID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgWE1MSHR0cFJlcXVlc3QgJiYgWE1MSHR0cFJlcXVlc3QgPT09IE9iamVjdChYTUxIdHRwUmVxdWVzdCkgJiYgKCd3aXRoQ3JlZGVudGlhbHMnIGluIG5ldyBYTUxIdHRwUmVxdWVzdCgpID8gZSA9ICdYTUxIdHRwUmVxdWVzdCcgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgWERvbWFpblJlcXVlc3QgJiYgWERvbWFpblJlcXVlc3QgPT09IE9iamVjdChYRG9tYWluUmVxdWVzdCkgJiYgKHQgPSAhMSksIE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChoLkhUTUxFbGVtZW50KS5pbmRleE9mKCdDb25zdHJ1Y3RvcicpID4gMCAmJiAodCA9ICExKSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnNUeXBlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29yc0Nvb2tpZXNFbmFibGVkOiB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9mYTM2NWZhZDg5MWMxNzMyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkX2ZhMzY1ZmFkODkxYzE3MzIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8wOWVhYzMxYWFkZjdhOWY1KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzA5ZWFjMzFhYWRmN2E5ZjUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDT1JTSW5zdGFuY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfM2RiMzNjNDZhNzUxNWRiNCA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpLCAkX19fb2xkXzU1NTRjOGM2NzFhMDFhMGIgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfM2RiMzNjNDZhNzUxNWRiNCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfMDBhMmViZWY3MTNiYjVlYS5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzU1NTRjOGM2NzFhMDFhMGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzAwYTJlYmVmNzEzYmI1ZWEuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ25vbmUnID09PSB0aGlzLmNvcnNNZXRhZGF0YS5jb3JzVHlwZSA/IG51bGwgOiBuZXcgaFt0aGlzLmNvcnNNZXRhZGF0YS5jb3JzVHlwZV0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzNkYjMzYzQ2YTc1MTVkYjQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfM2RiMzNjNDZhNzUxNWRiNCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzU1NTRjOGM2NzFhMDFhMGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfNTU1NGM4YzY3MWEwMWEwYikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJlQ09SUzogZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgobiA9IEpTT04ucGFyc2UoZSkpICE9PSBPYmplY3QobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBpLmhhbmRsZUNPUlNFcnJvcih0LCBudWxsLCAnUmVzcG9uc2UgaXMgbm90IEpTT04nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGkuaGFuZGxlQ09SU0Vycm9yKHQsIGUsICdFcnJvciBwYXJzaW5nIHJlc3BvbnNlIGFzIEpTT04nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IHQuY2FsbGJhY2ssIHIgPSBoLCBzID0gMDsgcyA8IGEubGVuZ3RoOyBzKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gclthW3NdXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcihuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuaGFuZGxlQ09SU0Vycm9yKHQsIGUsICdFcnJvciBmb3JtaW5nIGNhbGxiYWNrIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiAodC5sb2FkRXJyb3JIYW5kbGVyID0gbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdGhpcy5nZXRDT1JTSW5zdGFuY2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLm9wZW4oJ2dldCcsIHQuY29yc1VybCArICcmdHM9JyArIG5ldyBEYXRlKCkuZ2V0VGltZSgpLCAhMCksICdYTUxIdHRwUmVxdWVzdCcgPT09IHRoaXMuY29yc01ldGFkYXRhLmNvcnNUeXBlICYmIChyLndpdGhDcmVkZW50aWFscyA9ICEwLCByLnRpbWVvdXQgPSBlLmxvYWRUaW1lb3V0LCByLnNldFJlcXVlc3RIZWFkZXIoJ0NvbnRlbnQtVHlwZScsICdhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQnKSwgci5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQgPT09IHRoaXMucmVhZHlTdGF0ZSAmJiAyMDAgPT09IHRoaXMuc3RhdHVzICYmIGEodGhpcy5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCByLm9uZXJyb3IgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLmhhbmRsZUNPUlNFcnJvcih0LCBlLCAnb25lcnJvcicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIub250aW1lb3V0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5oYW5kbGVDT1JTRXJyb3IodCwgZSwgJ29udGltZW91dCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHIuc2VuZCgpLCBlLl9sb2cucmVxdWVzdHMucHVzaCh0LmNvcnNVcmwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaGFuZGxlQ09SU0Vycm9yKHQsIGUsICd0cnktY2F0Y2gnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlQ09SU0Vycm9yOiBmdW5jdGlvbiAodCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5DT1JTRXJyb3JzLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnNEYXRhOiB0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uOiBhCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdC5sb2FkRXJyb3JIYW5kbGVyICYmICgnb250aW1lb3V0JyA9PT0gYSA/IHQubG9hZEVycm9ySGFuZGxlcighMCkgOiB0LmxvYWRFcnJvckhhbmRsZXIoITEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAkID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBPU1RfTUVTU0FHRV9FTkFCTEVEOiAhIWgucG9zdE1lc3NhZ2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREFZU19CRVRXRUVOX1NZTkNfSURfQ0FMTFM6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTUlMTElTX1BFUl9EQVk6IDg2NDAwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFET0JFX01DOiAnYWRvYmVfbWMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFET0JFX01DX1NESUQ6ICdhZG9iZV9tY19zZGlkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWQUxJRF9WSVNJVE9SX0lEX1JFR0VYOiAvXlswLTlhLWZBLUZcLV0rJC8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQURPQkVfTUNfVFRMX0lOX01JTjogNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWRVJTSU9OX1JFR0VYOiAvdlZlcnNpb25cfCgoXGQrXC4pPyhcZCtcLik/KFwqfFxkKykpKD89JHxcfCkvLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZJUlNUX1BBUlRZX1NFUlZFUl9DT09LSUU6ICdzX2VjaWQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBLID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGguZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVEhST1RUTEVfU1RBUlQ6IDMwMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQVhfU1lOQ1NfTEVOR1RIOiA2NDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm90dGxlVGltZXJTZXQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb25QYWdlUGl4ZWxzOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZyYW1lSG9zdDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SWZyYW1lSG9zdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5zcGxpdCgnLycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0WzBdICsgJy8vJyArIHRbMl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YmRvbWFpbjogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRVcmw6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBhID0gJ2h0dHA6Ly9mYXN0LicsIGkgPSAnP2RfbnNpZD0nICsgZS5pZFN5bmNDb250YWluZXJJRCArICcjJyArIGVuY29kZVVSSUNvbXBvbmVudChuLmxvY2F0aW9uLm9yaWdpbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdWJkb21haW4gfHwgKHRoaXMuc3ViZG9tYWluID0gJ25vc3ViZG9tYWlucmV0dXJuZWQnKSwgZS5sb2FkU1NMICYmIChhID0gZS5pZFN5bmNTU0xVc2VBa2FtYWkgPyAnaHR0cHM6Ly9mYXN0LicgOiAnaHR0cHM6Ly8nKSwgdCA9IGEgKyB0aGlzLnN1YmRvbWFpbiArICcuZGVtZGV4Lm5ldC9kZXN0NS5odG1sJyArIGksIHRoaXMuaWZyYW1lSG9zdCA9IHRoaXMuZ2V0SWZyYW1lSG9zdCh0KSwgdGhpcy5pZCA9ICdkZXN0aW5hdGlvbl9wdWJsaXNoaW5nX2lmcmFtZV8nICsgdGhpcy5zdWJkb21haW4gKyAnXycgKyBlLmlkU3luY0NvbnRhaW5lcklELCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGVja0RQSWZyYW1lU3JjOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICc/ZF9uc2lkPScgKyBlLmlkU3luY0NvbnRhaW5lcklEICsgJyMnICsgZW5jb2RlVVJJQ29tcG9uZW50KG4ubG9jYXRpb24uaHJlZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PSB0eXBlb2YgZS5kcElmcmFtZVNyYyAmJiBlLmRwSWZyYW1lU3JjLmxlbmd0aCAmJiAodGhpcy5pZCA9ICdkZXN0aW5hdGlvbl9wdWJsaXNoaW5nX2lmcmFtZV8nICsgKGUuX3N1YmRvbWFpbiB8fCB0aGlzLnN1YmRvbWFpbiB8fCBuZXcgRGF0ZSgpLmdldFRpbWUoKSkgKyAnXycgKyBlLmlkU3luY0NvbnRhaW5lcklELCB0aGlzLmlmcmFtZUhvc3QgPSB0aGlzLmdldElmcmFtZUhvc3QoZS5kcElmcmFtZVNyYyksIHRoaXMudXJsID0gZS5kcElmcmFtZVNyYyArIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZENhbGxOb3RQcm9jZXNzc2VkOiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb0F0dGFjaElmcmFtZTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ZWRBdHRhY2hpbmdJZnJhbWU6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZnJhbWVIYXNMb2FkZWQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmcmFtZUlkQ2hhbmdlZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3SWZyYW1lQ3JlYXRlZDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3JpZ2luYWxJZnJhbWVIYXNMb2FkZWRBbHJlYWR5OiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZnJhbWVMb2FkZWRDYWxsYmFja3M6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpb25DaGFuZ2VkOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZXNSZWdpb25DaGFuZ2VkOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kaW5nTWVzc2FnZXM6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlczogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2VzUG9zdGVkOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWVzc2FnZXNSZWNlaXZlZDogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2VTZW5kaW5nSW50ZXJ2YWw6ICQuUE9TVF9NRVNTQUdFX0VOQUJMRUQgPyBudWxsIDogMTAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvblBhZ2VEZXN0aW5hdGlvbnNGaXJlZDogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb25Gb3JDb21wYXJpc29uOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbkR1cGxpY2F0ZXM6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uV2FpdGluZzogW10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb25Qcm9jZXNzZWQ6IFtdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW5TZXRUaGlyZFBhcnR5Q29va2llczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlY2VpdmVkVGhpcmRQYXJ0eUNvb2tpZXNOb3RpZmljYXRpb246ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkeVRvQXR0YWNoSWZyYW1lUHJlbGltaW5hcnk6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKGUuaWRTeW5jRGlzYWJsZVN5bmNzIHx8IGUuZGlzYWJsZUlkU3luY3MgfHwgZS5pZFN5bmNEaXNhYmxlM3JkUGFydHlTeW5jaW5nIHx8IGUuZGlzYWJsZVRoaXJkUGFydHlDb29raWVzIHx8IGUuZGlzYWJsZVRoaXJkUGFydHlDYWxscyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYWR5VG9BdHRhY2hJZnJhbWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJlYWR5VG9BdHRhY2hJZnJhbWVQcmVsaW1pbmFyeSgpICYmICh0aGlzLmRvQXR0YWNoSWZyYW1lIHx8IGUuX2RvQXR0YWNoSWZyYW1lKSAmJiAodGhpcy5zdWJkb21haW4gJiYgJ25vc3ViZG9tYWlucmV0dXJuZWQnICE9PSB0aGlzLnN1YmRvbWFpbiB8fCBlLl9zdWJkb21haW4pICYmIHRoaXMudXJsICYmICF0aGlzLnN0YXJ0ZWRBdHRhY2hpbmdJZnJhbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0dGFjaElmcmFtZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaSA9IG4uY3JlYXRlRWxlbWVudCgnaWZyYW1lJykpLnNhbmRib3ggPSAnYWxsb3ctc2NyaXB0cyBhbGxvdy1zYW1lLW9yaWdpbicsIGkudGl0bGUgPSAnQWRvYmUgSUQgU3luY2luZyBpRnJhbWUnLCBpLmlkID0gYS5pZCwgaS5uYW1lID0gYS5pZCArICdfbmFtZScsIGkuc3R5bGUuY3NzVGV4dCA9ICdkaXNwbGF5OiBub25lOyB3aWR0aDogMDsgaGVpZ2h0OiAwOycsIGkuc3JjID0gYS51cmwsIGEubmV3SWZyYW1lQ3JlYXRlZCA9ICEwLCB0KCksIG4uYm9keS5hcHBlbmRDaGlsZChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5jbGFzc05hbWUgPSAnYWFtSWZyYW1lTG9hZGVkJywgYS5pZnJhbWVIYXNMb2FkZWQgPSAhMCwgYS5maXJlSWZyYW1lTG9hZGVkQ2FsbGJhY2tzKGUpLCBhLnJlcXVlc3RUb1Byb2Nlc3MoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RhcnRlZEF0dGFjaGluZ0lmcmFtZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBpID0gbi5nZXRFbGVtZW50QnlJZCh0aGlzLmlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPyAnSUZSQU1FJyAhPT0gaS5ub2RlTmFtZSA/ICh0aGlzLmlkICs9ICdfMicsIHRoaXMuaWZyYW1lSWRDaGFuZ2VkID0gITAsIGUoKSkgOiAodGhpcy5uZXdJZnJhbWVDcmVhdGVkID0gITEsICdhYW1JZnJhbWVMb2FkZWQnICE9PSBpLmNsYXNzTmFtZSA/ICh0aGlzLm9yaWdpbmFsSWZyYW1lSGFzTG9hZGVkQWxyZWFkeSA9ICExLCB0KCdUaGUgZGVzdGluYXRpb24gcHVibGlzaGluZyBpZnJhbWUgYWxyZWFkeSBleGlzdHMgZnJvbSBhIGRpZmZlcmVudCBsaWJyYXJ5LCBidXQgaGFkblwndCBsb2FkZWQgeWV0LicpKSA6ICh0aGlzLm9yaWdpbmFsSWZyYW1lSGFzTG9hZGVkQWxyZWFkeSA9ICEwLCB0aGlzLmlmcmFtZUhhc0xvYWRlZCA9ICEwLCB0aGlzLmlmcmFtZSA9IGksIHRoaXMuZmlyZUlmcmFtZUxvYWRlZENhbGxiYWNrcygnVGhlIGRlc3RpbmF0aW9uIHB1Ymxpc2hpbmcgaWZyYW1lIGFscmVhZHkgZXhpc3RzIGZyb20gYSBkaWZmZXJlbnQgbGlicmFyeSwgYW5kIGhhZCBsb2FkZWQgYWxyZXNhZHkuJyksIHRoaXMucmVxdWVzdFRvUHJvY2VzcygpKSkgOiBlKCksIHRoaXMuaWZyYW1lID0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyZUlmcmFtZUxvYWRlZENhbGxiYWNrczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaWZyYW1lTG9hZGVkQ2FsbGJhY2tzLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiB0ICYmIHQoeyBtZXNzYWdlOiBlIHx8ICdUaGUgZGVzdGluYXRpb24gcHVibGlzaGluZyBpZnJhbWUgd2FzIGF0dGFjaGVkIGFuZCBsb2FkZWQgc3VjY2Vzc2Z1bGx5LicgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgdGhpcy5pZnJhbWVMb2FkZWRDYWxsYmFja3MgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdFRvUHJvY2VzczogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5qc29uRm9yQ29tcGFyaXNvbi5wdXNoKHQpLCBpLmpzb25XYWl0aW5nLnB1c2godCksIGkucHJvY2Vzc1N5bmNPblBhZ2UodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgaSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9PT0gT2JqZWN0KHQpICYmIHQuaWJzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhID0gSlNPTi5zdHJpbmdpZnkodC5pYnMgfHwgW10pLCB0aGlzLmpzb25Gb3JDb21wYXJpc29uLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciwgcywgbywgYyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHIgPSAwLCBzID0gdGhpcy5qc29uRm9yQ29tcGFyaXNvbi5sZW5ndGg7IHIgPCBzOyByKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobyA9IHRoaXMuanNvbkZvckNvbXBhcmlzb25bcl0sIGEgPT09IEpTT04uc3RyaW5naWZ5KG8uaWJzIHx8IFtdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA/IHRoaXMuanNvbkR1cGxpY2F0ZXMucHVzaCh0KSA6IG4oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0aGlzLnJlY2VpdmVkVGhpcmRQYXJ0eUNvb2tpZXNOb3RpZmljYXRpb24gfHwgISQuUE9TVF9NRVNTQUdFX0VOQUJMRUQgfHwgdGhpcy5pZnJhbWVIYXNMb2FkZWQpICYmIHRoaXMuanNvbldhaXRpbmcubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSB0aGlzLmpzb25XYWl0aW5nLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9jZXNzKGwpLCB0aGlzLnJlcXVlc3RUb1Byb2Nlc3MoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaWRTeW5jRGlzYWJsZVN5bmNzIHx8IGUuZGlzYWJsZUlkU3luY3MgfHwgIXRoaXMuaWZyYW1lSGFzTG9hZGVkIHx8ICF0aGlzLm1lc3NhZ2VzLmxlbmd0aCB8fCB0aGlzLnNlbmRpbmdNZXNzYWdlcyB8fCAodGhpcy50aHJvdHRsZVRpbWVyU2V0IHx8ICh0aGlzLnRocm90dGxlVGltZXJTZXQgPSAhMCwgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5tZXNzYWdlU2VuZGluZ0ludGVydmFsID0gJC5QT1NUX01FU1NBR0VfRU5BQkxFRCA/IG51bGwgOiAxNTA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLlRIUk9UVExFX1NUQVJUKSksIHRoaXMuc2VuZGluZ01lc3NhZ2VzID0gITAsIHRoaXMuc2VuZE1lc3NhZ2VzKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRSZWdpb25BbmRDaGVja0lmQ2hhbmdlZDogZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5fZ2V0RmllbGQoJ01DQUFNTEgnKSwgaSA9IHQuZF9yZWdpb24gfHwgdC5kY3NfcmVnaW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBpICYmIChlLl9zZXRGaWVsZEV4cGlyZSgnTUNBQU1MSCcsIG4pLCBlLl9zZXRGaWVsZCgnTUNBQU1MSCcsIGkpLCBwYXJzZUludChhLCAxMCkgIT09IGkgJiYgKHRoaXMucmVnaW9uQ2hhbmdlZCA9ICEwLCB0aGlzLnRpbWVzUmVnaW9uQ2hhbmdlZCsrLCBlLl9zZXRGaWVsZCgnTUNTWU5DU09QJywgJycpLCBlLl9zZXRGaWVsZCgnTUNTWU5DUycsICcnKSwgYSA9IGkpKSA6IChhID0gaSkgJiYgKGUuX3NldEZpZWxkRXhwaXJlKCdNQ0FBTUxIJywgbiksIGUuX3NldEZpZWxkKCdNQ0FBTUxIJywgYSkpLCBhIHx8IChhID0gJycpLCBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzU3luY09uUGFnZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBhLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0ID0gZS5pYnMpICYmIHQgaW5zdGFuY2VvZiBBcnJheSAmJiAobiA9IHQubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgPSAwOyBhIDwgbjsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaSA9IHRbYV0pLnN5bmNPblBhZ2UgJiYgdGhpcy5jaGVja0ZpcnN0UGFydHlDb29raWUoaSwgJycsICdzeW5jT25QYWdlJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2Nlc3M6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgYSwgaSwgciwgcyA9IGVuY29kZVVSSUNvbXBvbmVudCwgbyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0ID0gZS5pYnMpICYmIHQgaW5zdGFuY2VvZiBBcnJheSAmJiAobiA9IHQubGVuZ3RoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG8gPSAhMCwgYSA9IDA7IGEgPCBuOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSB0W2FdLCByID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcygnaWJzJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzKGkuaWQgfHwgJycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyhpLnRhZyB8fCAnJyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBULmVuY29kZUFuZEJ1aWxkUmVxdWVzdChpLnVybCB8fCBbXSwgJywnKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMoaS50dGwgfHwgJycpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuZmlyZVVSTFN5bmMgPyAndHJ1ZScgOiAnZmFsc2UnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIGkuc3luY09uUGFnZSB8fCAodGhpcy5jYW5TZXRUaGlyZFBhcnR5Q29va2llcyA/IHRoaXMuYWRkTWVzc2FnZShyLmpvaW4oJ3wnKSkgOiBpLmZpcmVVUkxTeW5jICYmIHRoaXMuY2hlY2tGaXJzdFBhcnR5Q29va2llKGksIHIuam9pbignfCcpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvICYmIHRoaXMuanNvblByb2Nlc3NlZC5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGVja0ZpcnN0UGFydHlDb29raWU6IGZ1bmN0aW9uICh0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9ICdzeW5jT25QYWdlJyA9PT0gYSwgciA9IGkgPyAnTUNTWU5DU09QJyA6ICdNQ1NZTkNTJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuX3JlYWRWaXNpdG9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcywgbywgYyA9IGUuX2dldEZpZWxkKHIpLCBsID0gITEsIHUgPSAhMSwgZCA9IE1hdGguY2VpbChuZXcgRGF0ZSgpLmdldFRpbWUoKSAvICQuTUlMTElTX1BFUl9EQVkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA/IChzID0gYy5zcGxpdCgnKicpLCBsID0gKG8gPSB0aGlzLnBydW5lU3luY0RhdGEocywgdC5pZCwgZCkpLmRhdGFQcmVzZW50LCB1ID0gby5kYXRhVmFsaWQsIGwgJiYgdSB8fCB0aGlzLmZpcmVTeW5jKGksIHQsIG4sIHMsIHIsIGQpKSA6IChzID0gW10sIHRoaXMuZmlyZVN5bmMoaSwgdCwgbiwgcywgciwgZCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcnVuZVN5bmNEYXRhOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEsIGksIHIsIHMgPSAhMSwgbyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGUubGVuZ3RoOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGVbaV0sIHIgPSBwYXJzZUludChhLnNwbGl0KCctJylbMV0sIDEwKSwgYS5tYXRjaCgnXicgKyB0ICsgJy0nKSA/IChzID0gITAsIG4gPCByID8gbyA9ICEwIDogKGUuc3BsaWNlKGksIDEpLCBpLS0pKSA6IG4gPj0gciAmJiAoZS5zcGxpY2UoaSwgMSksIGktLSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFQcmVzZW50OiBzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFWYWxpZDogbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFuYWdlU3luY3NTaXplOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuam9pbignKicpLmxlbmd0aCA+IHRoaXMuTUFYX1NZTkNTX0xFTkdUSCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUuc29ydChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlSW50KGUuc3BsaXQoJy0nKVsxXSwgMTApIC0gcGFyc2VJbnQodC5zcGxpdCgnLScpWzFdLCAxMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOyBlLmpvaW4oJyonKS5sZW5ndGggPiB0aGlzLk1BWF9TWU5DU19MRU5HVEg7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpcmVTeW5jOiBmdW5jdGlvbiAodCwgbiwgYSwgaSwgciwgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2ltZycgPT09IG4udGFnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjLCBsLCB1LCBkLCBwID0gbi51cmwsIGYgPSBlLmxvYWRTU0wgPyAnaHR0cHM6JyA6ICdodHRwOic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYyA9IDAsIGwgPSBwLmxlbmd0aDsgYyA8IGw7IGMrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSA9IHBbY10sIGQgPSAvXlwvXC8vLnRlc3QodSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbSA9IG5ldyBJbWFnZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbS5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgZnVuY3Rpb24gKHQsIG4sIGEsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvLm9uUGFnZVBpeGVsc1t0XSA9IG51bGwsIGUuX3JlYWRWaXNpdG9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzLCBjLCBsLCB1LCBkID0gZS5fZ2V0RmllbGQociksIHAgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSAwLCBsID0gKHMgPSBkLnNwbGl0KCcqJykpLmxlbmd0aDsgYyA8IGw7IGMrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodSA9IHNbY10pLm1hdGNoKCdeJyArIG4uaWQgKyAnLScpIHx8IHAucHVzaCh1KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby5zZXRTeW5jVHJhY2tpbmdEYXRhKHAsIG4sIGEsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHRoaXMub25QYWdlUGl4ZWxzLmxlbmd0aCwgbiwgciwgcykpLCBtLnNyYyA9IChkID8gZiA6ICcnKSArIHUsIHRoaXMub25QYWdlUGl4ZWxzLnB1c2gobSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZE1lc3NhZ2UoYSksIHRoaXMuc2V0U3luY1RyYWNraW5nRGF0YShpLCBuLCByLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkTWVzc2FnZTogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZW5jb2RlVVJJQ29tcG9uZW50KGUuX2VuYWJsZUVycm9yUmVwb3J0aW5nID8gJy0tLWRlc3RwdWItZGVidWctLS0nIDogJy0tLWRlc3RwdWItLS0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubWVzc2FnZXMucHVzaCgoJC5QT1NUX01FU1NBR0VfRU5BQkxFRCA/ICcnIDogbikgKyB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U3luY1RyYWNraW5nRGF0YTogZnVuY3Rpb24gKHQsIG4sIGEsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChuLmlkICsgJy0nICsgKGkgKyBNYXRoLmNlaWwobi50dGwgLyA2MCAvIDI0KSkpLCB0aGlzLm1hbmFnZVN5bmNzU2l6ZSh0KSwgZS5fc2V0RmllbGQoYSwgdC5qb2luKCcqJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZXM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0ID0gdGhpcywgbiA9ICcnLCBhID0gZW5jb2RlVVJJQ29tcG9uZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWdpb25DaGFuZ2VkICYmIChuID0gYSgnLS0tZGVzdHB1Yi1jbGVhci1kZXh0cC0tLScpLCB0aGlzLnJlZ2lvbkNoYW5nZWQgPSAhMSksIHRoaXMubWVzc2FnZXMubGVuZ3RoID8gJC5QT1NUX01FU1NBR0VfRU5BQkxFRCA/IChlID0gbiArIGEoJy0tLWRlc3RwdWItY29tYmluZWQtLS0nKSArIHRoaXMubWVzc2FnZXMuam9pbignJTAxJyksIHRoaXMucG9zdE1lc3NhZ2UoZSksIHRoaXMubWVzc2FnZXMgPSBbXSwgdGhpcy5zZW5kaW5nTWVzc2FnZXMgPSAhMSkgOiAoZSA9IHRoaXMubWVzc2FnZXMuc2hpZnQoKSwgdGhpcy5wb3N0TWVzc2FnZShuICsgZSksIHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2VuZE1lc3NhZ2VzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0aGlzLm1lc3NhZ2VTZW5kaW5nSW50ZXJ2YWwpKSA6IHRoaXMuc2VuZGluZ01lc3NhZ2VzID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvc3RNZXNzYWdlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRy5wb3N0TWVzc2FnZShlLCB0aGlzLnVybCwgdGhpcy5pZnJhbWUuY29udGVudFdpbmRvdyksIHRoaXMubWVzc2FnZXNQb3N0ZWQucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjZWl2ZU1lc3NhZ2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiA9IC9eLS0tZGVzdHB1Yi10by1wYXJlbnQtLS0vOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgbi50ZXN0KGUpICYmICgnY2FuU2V0VGhpcmRQYXJ0eUNvb2tpZXMnID09PSAodCA9IGUucmVwbGFjZShuLCAnJykuc3BsaXQoJ3wnKSlbMF0gJiYgKHRoaXMuY2FuU2V0VGhpcmRQYXJ0eUNvb2tpZXMgPSAndHJ1ZScgPT09IHRbMV0sIHRoaXMucmVjZWl2ZWRUaGlyZFBhcnR5Q29va2llc05vdGlmaWNhdGlvbiA9ICEwLCB0aGlzLnJlcXVlc3RUb1Byb2Nlc3MoKSksIHRoaXMubWVzc2FnZXNSZWNlaXZlZC5wdXNoKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc0lEQ2FsbERhdGE6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobnVsbCA9PSB0aGlzLnVybCB8fCBhLnN1YmRvbWFpbiAmJiAnbm9zdWJkb21haW5yZXR1cm5lZCcgPT09IHRoaXMuc3ViZG9tYWluKSAmJiAoJ3N0cmluZycgPT0gdHlwZW9mIGUuX3N1YmRvbWFpbiAmJiBlLl9zdWJkb21haW4ubGVuZ3RoID8gdGhpcy5zdWJkb21haW4gPSBlLl9zdWJkb21haW4gOiB0aGlzLnN1YmRvbWFpbiA9IGEuc3ViZG9tYWluIHx8ICcnLCB0aGlzLnVybCA9IHRoaXMuZ2V0VXJsKCkpLCBhLmlicyBpbnN0YW5jZW9mIEFycmF5ICYmIGEuaWJzLmxlbmd0aCAmJiAodGhpcy5kb0F0dGFjaElmcmFtZSA9ICEwKSwgdGhpcy5yZWFkeVRvQXR0YWNoSWZyYW1lKCkgJiYgKGUuaWRTeW5jQXR0YWNoSWZyYW1lT25XaW5kb3dMb2FkID8gKHQud2luZG93TG9hZGVkIHx8ICdjb21wbGV0ZScgPT09IG4ucmVhZHlTdGF0ZSB8fCAnbG9hZGVkJyA9PT0gbi5yZWFkeVN0YXRlKSAmJiB0aGlzLmF0dGFjaElmcmFtZSgpIDogdGhpcy5hdHRhY2hJZnJhbWVBU0FQKCkpLCAnZnVuY3Rpb24nID09IHR5cGVvZiBlLmlkU3luY0lEQ2FsbFJlc3VsdCA/IGUuaWRTeW5jSURDYWxsUmVzdWx0KGEpIDogdGhpcy5yZXF1ZXN0VG9Qcm9jZXNzKGEpLCAnZnVuY3Rpb24nID09IHR5cGVvZiBlLmlkU3luY0FmdGVySURDYWxsUmVzdWx0ICYmIGUuaWRTeW5jQWZ0ZXJJRENhbGxSZXN1bHQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbk1ha2VTeW5jSURDYWxsOiBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuX2ZvcmNlU3luY0lEQ2FsbCB8fCAhdCB8fCBuIC0gdCA+ICQuREFZU19CRVRXRUVOX1NZTkNfSURfQ0FMTFM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF0dGFjaElmcmFtZUFTQVA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5zdGFydGVkQXR0YWNoaW5nSWZyYW1lIHx8IChuLmJvZHkgPyB0LmF0dGFjaElmcmFtZSgpIDogc2V0VGltZW91dChlLCAzMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFggPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXVkaWVuY2VNYW5hZ2VyU2VydmVyOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdWRpZW5jZU1hbmFnZXJTZXJ2ZXJTZWN1cmU6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZURvbWFpbjoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llTGlmZXRpbWU6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZU5hbWU6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvZXNPcHRJbkFwcGx5OiB7IHR5cGU6ICdib29sZWFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc2FibGVUaGlyZFBhcnR5Q2FsbHM6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzY2FyZFRyYWNraW5nU2VydmVyRUNJRDogeyB0eXBlOiAnYm9vbGVhbicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNBZnRlcklEQ2FsbFJlc3VsdDoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWRTeW5jQXR0YWNoSWZyYW1lT25XaW5kb3dMb2FkOiB7IHR5cGU6ICdib29sZWFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkU3luY0NvbnRhaW5lcklEOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNEaXNhYmxlM3JkUGFydHlTeW5jaW5nOiB7IHR5cGU6ICdib29sZWFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc2FibGVUaGlyZFBhcnR5Q29va2llczogeyB0eXBlOiAnYm9vbGVhbicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNEaXNhYmxlU3luY3M6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzYWJsZUlkU3luY3M6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWRTeW5jSURDYWxsUmVzdWx0OiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZFN5bmNTU0xVc2VBa2FtYWk6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNDb29wU2FmZTogeyB0eXBlOiAnYm9vbGVhbicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc0lhYkNvbnRleHQ6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNPcHRJblN0b3JhZ2VFbmFibGVkOiB7IHR5cGU6ICdib29sZWFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvYWRTU0w6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9hZFRpbWVvdXQ6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcmtldGluZ0Nsb3VkU2VydmVyOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJrZXRpbmdDbG91ZFNlcnZlclNlY3VyZToge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0SW5Db29raWVEb21haW46IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wdEluU3RvcmFnZUV4cGlyeToge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcndyaXRlQ3Jvc3NEb21haW5NQ0lEQW5kQUlEOiB7IHR5cGU6ICdib29sZWFuJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZU9wdEluQXBwcm92YWxzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmV2aW91c1Blcm1pc3Npb25zOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNldEJlZm9yZVZlcnNpb246IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNkaWRQYXJhbUV4cGlyeToge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmVyU3RhdGU6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlc3Npb25Db29raWVOYW1lOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWN1cmVDb29raWU6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtZVNpdGVDb29raWU6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRha2VUaW1lb3V0TWV0cmljczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tpbmdTZXJ2ZXI6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNraW5nU2VydmVyU2VjdXJlOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VMb2NhbFN0b3JhZ2U6IHsgdHlwZTogJ2Jvb2xlYW4nIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpdGVsaXN0SWZyYW1lRG9tYWluczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpdGVsaXN0UGFyZW50RG9tYWluOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgWiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDb25maWdOYW1lczogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoWCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDb25maWdzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBYOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9ybWFsaXplQ29uZmlnOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWFtlXSAmJiAnYm9vbGVhbicgPT09IFhbZV0udHlwZSA/ICdmdW5jdGlvbicgIT0gdHlwZW9mIHQgPyB0IDogdCgpIDogdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5vbiA9IGZ1bmN0aW9uIChlLCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbiB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdbT05dIENhbGxiYWNrIHNob3VsZCBiZSBhIGZ1bmN0aW9uLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0Lmhhc093blByb3BlcnR5KGUpIHx8ICh0W2VdID0gW10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHRbZV0ucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgLSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFtlXS5zcGxpY2UoaSwgMSksIHRbZV0ubGVuZ3RoIHx8IGRlbGV0ZSB0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUub2ZmID0gZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShlKSAmJiAodFtlXSA9IHRbZV0uZmlsdGVyKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5jYWxsYmFjayAhPT0gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucHVibGlzaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0Lmhhc093blByb3BlcnR5KGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFtdLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbZV0uc2xpY2UoMCkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuY2FsbGJhY2suYXBwbHkoZS5jb250ZXh0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wdWJsaXNoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUEVORElORzogJ3BlbmRpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENIQU5HRUQ6ICdjaGFuZ2VkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDT01QTEVURTogJ2NvbXBsZXRlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbmUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQUFNOiAnYWFtJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBRENMT1VEOiAnYWRjbG91ZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQU5BTFlUSUNTOiAnYWEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENBTVBBSUdOOiAnY2FtcGFpZ24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVDSUQ6ICdlY2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMSVZFRllSRTogJ2xpdmVmeXJlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUQVJHRVQ6ICd0YXJnZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1FRElBX0FOQUxZVElDUzogJ21lZGlhYWEnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhZSA9ICh0KHkgPSB7fSwgbmUuQUFNLCA1NjUpLCB0KHksIG5lLkVDSUQsIDU2NSksIHkpLCBpZSA9ICh0KF8gPSB7fSwgbmUuQUFNLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIHQoXywgbmUuRUNJRCwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBfKSwgcmUgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZpZGVvYWEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdpYWJDb25zZW50SGFzaCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIHNlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSkubWFwKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShuZSksIG9lID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY2FsbGJhY2tzID0gT2JqZWN0LmNyZWF0ZShudWxsKSwgZS5hZGQgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWwobikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1tjYWxsYmFja1JlZ2lzdHJ5RmFjdG9yeV0gTWFrZSBzdXJlIGNhbGxiYWNrIGlzIGEgZnVuY3Rpb24gb3IgYW4gYXJyYXkgb2YgZnVuY3Rpb25zLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmNhbGxiYWNrc1t0XSA9IGUuY2FsbGJhY2tzW3RdIHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUuY2FsbGJhY2tzW3RdLnB1c2gobikgLSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jYWxsYmFja3NbdF0uc3BsaWNlKGEsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZXhlY3V0ZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlLmNhbGxiYWNrc1t0XSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IChuID0gdm9pZCAwID09PSBuID8gW10gOiBuKSBpbnN0YW5jZW9mIEFycmF5ID8gbiA6IFtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGUuY2FsbGJhY2tzW3RdLmxlbmd0aDspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBlLmNhbGxiYWNrc1t0XS5zaGlmdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZnVuY3Rpb24nID09IHR5cGVvZiBhID8gYS5hcHBseShudWxsLCBuKSA6IGEgaW5zdGFuY2VvZiBBcnJheSAmJiBhWzFdLmFwcGx5KGFbMF0sIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgZS5jYWxsYmFja3NbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmV4ZWN1dGVBbGwgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobiB8fCB0ICYmICFjKHQpKSAmJiBPYmplY3Qua2V5cyhlLmNhbGxiYWNrcykuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB2b2lkIDAgIT09IHRbbl0gPyB0W25dIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4ZWN1dGUobiwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuaGFzQ2FsbGJhY2tzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQm9vbGVhbihPYmplY3Qua2V5cyhlLmNhbGxiYWNrcykubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgY2UgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBsZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSB3aW5kb3cuY29uc29sZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF0ICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIHRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB1ZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oKSA/IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gYXJndW1lbnRzLmxlbmd0aCwgYSA9IG5ldyBBcnJheShuKSwgaSA9IDA7IGkgPCBuOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtpXSA9IGFyZ3VtZW50c1tpXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGVbZV0uYXBwbHkoY29uc29sZSwgW3RdLmNvbmNhdChhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogY2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkZSA9IHUsIHBlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSBbXSwgdCA9IDA7IHQgPCAyNTY7IHQrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gdCwgYSA9IDA7IGEgPCA4OyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gMSAmIG4gPyAzOTg4MjkyMzg0IF4gbiA+Pj4gMSA6IG4gPj4+IDE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUucHVzaChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB1bmVzY2FwZShlbmNvZGVVUklDb21wb25lbnQodCkpLCBuIHx8IChuID0gMCksIG4gXj0gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGEgPSAwOyBhIDwgdC5sZW5ndGg7IGErKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAyNTUgJiAobiBeIHQuY2hhckNvZGVBdChhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbiA+Pj4gOCBeIGVbaV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChuIF49IC0xKSA+Pj4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCBmZSA9IG5ldyBkZSgnW0FET0JFIE9QVC1JTl0nKSwgbWUgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHQpID09PSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZ2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlIGluc3RhbmNlb2YgQXJyYXkgPyBlIDogbWUoZSwgJ3N0cmluZycpID8gW2VdIDogdCB8fCBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGJlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdC5rZXlzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIXQubGVuZ3RoICYmIHQuZXZlcnkoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdmUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzLmxlbmd0aCA+IDEgJiYgdm9pZCAwICE9PSBhcmd1bWVudHNbMV0gJiYgYXJndW1lbnRzWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCFlIHx8IF9lKGUpKSAmJiBnZShlKS5ldmVyeShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2UuaW5kZXhPZihlKSA+IC0xIHx8IHQgJiYgcmUuaW5kZXhPZihlKSA+IC0xOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnJlZHVjZShmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtuXSA9IHQsIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnBhcnNlKEpTT04uc3RyaW5naWZ5KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIF9lID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1tvYmplY3QgQXJyYXldJyA9PT0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpICYmICFlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFBlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoa2UoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFNlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSBlIHx8IChrZShlKSA/IHZlKE9iamVjdC5rZXlzKGUpLCAhMCkgOiBDZShlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBDZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBKU09OLnBhcnNlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlICYmIG1lKGUsICdzdHJpbmcnKSAmJiB2ZShPYmplY3Qua2V5cyh0KSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGtlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPT0gZSAmJiBtZShlLCAnb2JqZWN0JykgJiYgITEgPT09IEFycmF5LmlzQXJyYXkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBqZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHdlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbWUoZSwgJ2Z1bmN0aW9uJykgPyBlKCkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgRGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNlKGUpIHx8IGZlLmVycm9yKCcnLmNvbmNhdCh0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBWZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGUpLm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIEllID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVmUoZSkuZmlsdGVyKGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmluZGV4T2YoZSkgPT09IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBUZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcmd1bWVudHMubGVuZ3RoID4gMCAmJiB2b2lkIDAgIT09IGFyZ3VtZW50c1swXSA/IGFyZ3VtZW50c1swXSA6IHt9LCBuID0gdC5jb21tYW5kLCBhID0gdC5wYXJhbXMsIGkgPSB2b2lkIDAgPT09IGEgPyB7fSA6IGEsIHIgPSB0LmNhbGxiYWNrLCBzID0gdm9pZCAwID09PSByID8gamUgOiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4gfHwgLTEgPT09IG4uaW5kZXhPZignLicpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdbT3B0SW4uZXhlY3V0ZV0gUGxlYXNlIHByb3ZpZGUgYSB2YWxpZCBjb21tYW5kLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBuLnNwbGl0KCcuJyksIGMgPSBlW29bMF1dLCBsID0gb1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYyB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBjW2xdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignTWFrZSBzdXJlIHRoZSBwbHVnaW4gYW5kIEFQSSBuYW1lIGV4aXN0LicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBPYmplY3QuYXNzaWduKGksIHsgY2FsbGJhY2s6IHMgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjW2xdLmNhbGwoYywgdSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlLmVycm9yKCdbZXhlY3V0ZV0gU29tZXRoaW5nIHdlbnQgd3Jvbmc6ICcgKyBlLm1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHAucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShFcnJvci5wcm90b3R5cGUpLCBwLnByb3RvdHlwZS5jb25zdHJ1Y3RvciA9IHA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBFZSA9ICdmZXRjaFBlcm1pc3Npb25zJywgT2UgPSAnW09wdEluI3JlZ2lzdGVyUGx1Z2luXSBQbHVnaW4gaXMgaW52YWxpZC4nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLkNhdGVnb3JpZXMgPSBuZSwgZi5UaW1lb3V0RXJyb3IgPSBwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgQWUgPSBPYmplY3QuZnJlZXplKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPcHRJbjogZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJYWJQbHVnaW46IHYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBNZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wdWJsaXNoRGVzdGluYXRpb25zID0gZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBhcmd1bWVudHNbMV0sIGkgPSBhcmd1bWVudHNbMl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgaSA/IGkgOiBuLmNhbGxiYWNrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLnJlYWR5VG9BdHRhY2hJZnJhbWVQcmVsaW1pbmFyeSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW4ubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBpKHsgZXJyb3I6ICdzdWJkb21haW4gaXMgbm90IGEgcG9wdWxhdGVkIHN0cmluZy4nIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGEgaW5zdGFuY2VvZiBBcnJheSAmJiBhLmxlbmd0aCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGkoeyBlcnJvcjogJ21lc3NhZ2VzIGlzIG5vdCBhIHBvcHVsYXRlZCBhcnJheS4nIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgZS5sZW5ndGggJiYgKHIuYWRkTWVzc2FnZShlKSwgcyA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksICFzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBpKHsgZXJyb3I6ICdOb25lIG9mIHRoZSBtZXNzYWdlcyBhcmUgcG9wdWxhdGVkIHN0cmluZ3MuJyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFULmlzT2JqZWN0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBpKHsgZXJyb3I6ICdJbnZhbGlkIHBhcmFtZXRlcnMgcGFzc2VkLicgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPSB0eXBlb2YgKG4gPSBvLnN1YmRvbWFpbikgfHwgIW4ubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBpKHsgZXJyb3I6ICdjb25maWcuc3ViZG9tYWluIGlzIG5vdCBhIHBvcHVsYXRlZCBzdHJpbmcuJyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG8udXJsRGVzdGluYXRpb25zOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGMgaW5zdGFuY2VvZiBBcnJheSAmJiBjLmxlbmd0aCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGkoeyBlcnJvcjogJ2NvbmZpZy51cmxEZXN0aW5hdGlvbnMgaXMgbm90IGEgcG9wdWxhdGVkIGFycmF5LicgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVC5pc09iamVjdChlKSAmJiAoZS5oaWRlUmVmZXJyZXIgPyBlLm1lc3NhZ2UgJiYgci5hZGRNZXNzYWdlKGUubWVzc2FnZSkgOiBsLnB1c2goZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLmxlbmd0aCAmJiBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gbmV3IEltYWdlKCksIG4gPSBsLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnNyYyA9IG4udXJsLCByLm9uUGFnZURlc3RpbmF0aW9uc0ZpcmVkLnB1c2gobiksIGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmlmcmFtZSA/IChpKHsgbWVzc2FnZTogJ1RoZSBkZXN0aW5hdGlvbiBwdWJsaXNoaW5nIGlmcmFtZSBpcyBhbHJlYWR5IGF0dGFjaGVkIGFuZCBsb2FkZWQuJyB9KSwgci5yZXF1ZXN0VG9Qcm9jZXNzKCkpIDogIWUuc3ViZG9tYWluICYmIGUuX2dldEZpZWxkKCdNQ01JRCcpID8gKHIuc3ViZG9tYWluID0gbiwgci5kb0F0dGFjaElmcmFtZSA9ICEwLCByLnVybCA9IHIuZ2V0VXJsKCksIHIucmVhZHlUb0F0dGFjaElmcmFtZSgpID8gKHIuaWZyYW1lTG9hZGVkQ2FsbGJhY2tzLnB1c2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKHsgbWVzc2FnZTogJ0F0dGVtcHRlZCB0byBhdHRhY2ggYW5kIGxvYWQgdGhlIGRlc3RpbmF0aW9uIHB1Ymxpc2hpbmcgaWZyYW1lIHRocm91Z2ggdGhpcyBBUEkgY2FsbC4gUmVzdWx0OiAnICsgKGUubWVzc2FnZSB8fCAnbm8gcmVzdWx0JykgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgci5hdHRhY2hJZnJhbWUoKSkgOiBpKHsgZXJyb3I6ICdFbmNvdW50ZXJlZCBhIHByb2JsZW0gaW4gYXR0ZW1wdGluZyB0byBhdHRhY2ggYW5kIGxvYWQgdGhlIGRlc3RpbmF0aW9uIHB1Ymxpc2hpbmcgaWZyYW1lIHRocm91Z2ggdGhpcyBBUEkgY2FsbC4nIH0pKSA6IHIuaWZyYW1lTG9hZGVkQ2FsbGJhY2tzLnB1c2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKHsgbWVzc2FnZTogJ0F0dGVtcHRlZCB0byBhdHRhY2ggYW5kIGxvYWQgdGhlIGRlc3RpbmF0aW9uIHB1Ymxpc2hpbmcgaWZyYW1lIHRocm91Z2ggbm9ybWFsIFZpc2l0b3IgQVBJIHByb2Nlc3NpbmcuIFJlc3VsdDogJyArIChlLm1lc3NhZ2UgfHwgJ25vIHJlc3VsdCcpIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSh7IGVycm9yOiAnVGhlIGRlc3RpbmF0aW9uIHB1Ymxpc2hpbmcgaWZyYW1lIGlzIGRpc2FibGVkIGluIHRoZSBWaXNpdG9yIGxpYnJhcnkuJyB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgTGUgPSBmdW5jdGlvbiBlKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPj4+IHQgfCBlIDw8IDMyIC0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSwgaSwgciA9IE1hdGgucG93LCBzID0gcigyLCAzMiksIG8gPSAnJywgYyA9IFtdLCBsID0gOCAqIHQubGVuZ3RoLCB1ID0gZS5oID0gZS5oIHx8IFtdLCBkID0gZS5rID0gZS5rIHx8IFtdLCBwID0gZC5sZW5ndGgsIGYgPSB7fSwgbSA9IDI7IHAgPCA2NDsgbSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWZbbV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IDA7IGEgPCAzMTM7IGEgKz0gbSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmW2FdID0gbTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVbcF0gPSByKG0sIDAuNSkgKiBzIHwgMCwgZFtwKytdID0gcihtLCAxIC8gMykgKiBzIHwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCArPSAnXHg4MCc7IHQubGVuZ3RoICUgNjQgLSA1NjspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gJ1wwJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgPSAwOyBhIDwgdC5sZW5ndGg7IGErKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGkgPSB0LmNoYXJDb2RlQXQoYSkpID4+IDgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNbYSA+PiAyXSB8PSBpIDw8ICgzIC0gYSkgJSA0ICogODsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjW2MubGVuZ3RoXSA9IGwgLyBzIHwgMCwgY1tjLmxlbmd0aF0gPSBsLCBpID0gMDsgaSA8IGMubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGMuc2xpY2UoaSwgaSArPSAxNiksIGIgPSB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHUgPSB1LnNsaWNlKDAsIDgpLCBhID0gMDsgYSA8IDY0OyBhKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB2ID0gZ1thIC0gMTVdLCBoID0gZ1thIC0gMl0sIHkgPSB1WzBdLCBfID0gdVs0XSwgUCA9IHVbN10gKyAobihfLCA2KSBeIG4oXywgMTEpIF4gbihfLCAyNSkpICsgKF8gJiB1WzVdIF4gfl8gJiB1WzZdKSArIGRbYV0gKyAoZ1thXSA9IGEgPCAxNiA/IGdbYV0gOiBnW2EgLSAxNl0gKyAobih2LCA3KSBeIG4odiwgMTgpIF4gdiA+Pj4gMykgKyBnW2EgLSA3XSArIChuKGgsIDE3KSBeIG4oaCwgMTkpIF4gaCA+Pj4gMTApIHwgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodSA9IFtQICsgKChuKHksIDIpIF4gbih5LCAxMykgXiBuKHksIDIyKSkgKyAoeSAmIHVbMV0gXiB5ICYgdVsyXSBeIHVbMV0gJiB1WzJdKSkgfCAwXS5jb25jYXQodSkpWzRdID0gdVs0XSArIFAgfCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IDA7IGEgPCA4OyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1W2FdID0gdVthXSArIGJbYV0gfCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgPSAwOyBhIDwgODsgYSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGkgPSAzOyBpICsgMTsgaS0tKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgUyA9IHVbYV0gPj4gOCAqIGkgJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvICs9IChTIDwgMTYgPyAwIDogJycpICsgUy50b1N0cmluZygxNik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE5lID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ1NIQS0yNTYnICE9PSB0ICYmICdTSEEyNTYnICE9PSB0ICYmICdzaGEyNTYnICE9PSB0ICYmICdzaGEtMjU2JyAhPT0gdCB8fCAoZSA9IExlKGUpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHhlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gU3RyaW5nKGUpLnRyaW0oKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgUmUgPSBBZS5PcHRJbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVC5kZWZpbmVHbG9iYWxOYW1lc3BhY2UoKSwgd2luZG93LmFkb2JlLk9wdEluQ2F0ZWdvcmllcyA9IFJlLkNhdGVnb3JpZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBGZSA9IGZ1bmN0aW9uICh0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX2N1c3RvbWVySURzSGFzaENoYW5nZWQgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHIoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlIHx8IHcubG9jYXRpb24uaHJlZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0geS5fZXh0cmFjdFBhcmFtRnJvbVVyaShuLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ZS5wYXJzZVBpcGVEZWxpbWV0ZWRLZXlWYWx1ZXMoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBzKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB0KGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiBlLm1hdGNoKCQuVkFMSURfVklTSVRPUl9JRF9SRUdFWCkgJiYgKG4gPT09IE8gJiYgKGogPSAhMCksIHQoZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGVbT10sIHkuc2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQsIE8pLCB5Ll9zZXRGaWVsZEV4cGlyZShSLCAtMSksIHQoZVtOXSwgeS5zZXRBbmFseXRpY3NWaXNpdG9ySUQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbyhlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUgfHwge30sIHkuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQgPSBlLnN1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQgfHwgJycsIHkuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnRDb25zdW1lZCA9IGUuc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkIHx8IHt9LCB5Ll9zdXBwbGVtZW50YWxEYXRhSURMYXN0ID0gZS5zdXBwbGVtZW50YWxEYXRhSURMYXN0IHx8ICcnLCB5Ll9zdXBwbGVtZW50YWxEYXRhSURMYXN0Q29uc3VtZWQgPSBlLnN1cHBsZW1lbnRhbERhdGFJRExhc3RDb25zdW1lZCB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHQoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKG4gPSBuID8gbiArPSAnfCcgOiBuKSArIChlICsgJz0nKSArIGVuY29kZVVSSUNvbXBvbmVudCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbihlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gblswXSwgaSA9IG5bMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGkgJiYgaSAhPT0gRiAmJiAoZSA9IHQoYSwgaSwgZSkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChlID0gZSA/IGUgKz0gJ3wnIDogZSkgKyAnVFM9JyArIHRlLmdldFRpbWVzdGFtcEluU2Vjb25kcygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oZS5yZWR1Y2UobiwgJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGwoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5taW51dGVzVG9MaXZlLCBuID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICh5LmlkU3luY0Rpc2FibGVTeW5jcyB8fCB5LmRpc2FibGVJZFN5bmNzKSAmJiAobiA9IG4gfHwgJ0Vycm9yOiBpZCBzeW5jcyBoYXZlIGJlZW4gZGlzYWJsZWQnKSwgJ3N0cmluZycgPT0gdHlwZW9mIGUuZHBpZCAmJiBlLmRwaWQubGVuZ3RoIHx8IChuID0gbiB8fCAnRXJyb3I6IGNvbmZpZy5kcGlkIGlzIGVtcHR5JyksICdzdHJpbmcnID09IHR5cGVvZiBlLnVybCAmJiBlLnVybC5sZW5ndGggfHwgKG4gPSBuIHx8ICdFcnJvcjogY29uZmlnLnVybCBpcyBlbXB0eScpLCB2b2lkIDAgPT09IHQgPyB0ID0gMjAxNjAgOiAodCA9IHBhcnNlSW50KHQsIDEwKSwgKGlzTmFOKHQpIHx8IHQgPD0gMCkgJiYgKG4gPSBuIHx8ICdFcnJvcjogY29uZmlnLm1pbnV0ZXNUb0xpdmUgbmVlZHMgdG8gYmUgYSBwb3NpdGl2ZSBudW1iZXInKSksIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR0bDogdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB1KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCF5LmNvbmZpZ3MuZG9lc09wdEluQXBwbHkgfHwgXy5vcHRJbi5pc0NvbXBsZXRlICYmIGQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5LmNvbmZpZ3MuZG9lc09wdEluQXBwbHkgJiYgeS5jb25maWdzLmlzSWFiQ29udGV4dCA/IF8ub3B0SW4uaXNBcHByb3ZlZChfLm9wdEluLkNhdGVnb3JpZXMuRUNJRCkgJiYgayA6IF8ub3B0SW4uaXNBcHByb3ZlZChfLm9wdEluLkNhdGVnb3JpZXMuRUNJRCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBwKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydnZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCddLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc2V0Q3VzdG9tZXJJRHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzeW5jSWRlbnRpdHknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ2V0QW5hbHl0aWNzVmlzaXRvcklEJ10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50J10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ2V0TG9jYXRpb25IaW50J10sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ2V0QXVkaWVuY2VNYW5hZ2VyQmxvYiddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVswXSwgbiA9IDIgPT09IGUubGVuZ3RoID8gZVsxXSA6ICcnLCBhID0geVt0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeVt0XSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCgpICYmIHkuaXNBbGxvd2VkKCkgPyBhLmFwcGx5KHksIGFyZ3VtZW50cykgOiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZSAmJiB5Ll9jYWxsQ2FsbGJhY2soZSwgW25dKSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBmKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0geS5fZ2V0QXVkaWVuY2VNYW5hZ2VyVVJMRGF0YSgpLCB0ID0gZS51cmw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkuX2xvYWREYXRhKEUsIHQsIG51bGwsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gbShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGsgPSAhMCwgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdbSUFCIHBsdWdpbl0gOiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiB0LmdkcHJBcHBsaWVzICYmIChTID0gdC5jb25zZW50U3RyaW5nLCBDID0gdC5oYXNDb25zZW50Q2hhbmdlZFNpbmNlTGFzdENtcFB1bGwgPyAxIDogMCksIGYoKSwgdigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGsgPSAhMCwgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdbSUFCIHBsdWdpbl0gOiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5nZHByQXBwbGllcyAmJiAoUyA9IHQuY29uc2VudFN0cmluZywgQyA9IHQuaGFzQ29uc2VudENoYW5nZWRTaW5jZUxhc3RDbXBQdWxsID8gMSA6IDApLCB5LmluaXQoKSwgdigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfLm9wdEluLmlzQ29tcGxldGUgJiYgKF8ub3B0SW4uaXNBcHByb3ZlZChfLm9wdEluLkNhdGVnb3JpZXMuRUNJRCkgPyB5LmNvbmZpZ3MuaXNJYWJDb250ZXh0ID8gXy5vcHRJbi5leGVjdXRlKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tbWFuZDogJ2lhYlBsdWdpbi5mZXRjaENvbnNlbnREYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2s6IGcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6ICh5LmluaXQoKSwgdigpKSA6IHkuY29uZmlncy5pc0lhYkNvbnRleHQgPyBfLm9wdEluLmV4ZWN1dGUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21tYW5kOiAnaWFiUGx1Z2luLmZldGNoQ29uc2VudERhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogbQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogKHAoKSwgdigpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF8ub3B0SW4ub2ZmKCdjb21wbGV0ZScsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8IGEuc3BsaXQoJycpLnJldmVyc2UoKS5qb2luKCcnKSAhPT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1BsZWFzZSB1c2UgYFZpc2l0b3IuZ2V0SW5zdGFuY2VgIHRvIGluc3RhbnRpYXRlIFZpc2l0b3IuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgeSA9IHRoaXMsIF8gPSB3aW5kb3cuYWRvYmUsIFMgPSAnJywgQyA9IDAsIGsgPSAhMSwgaiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS52ZXJzaW9uID0gJzUuMi4wJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB3ID0gaCwgRCA9IHcuVmlzaXRvcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEQudmVyc2lvbiA9IHkudmVyc2lvbiwgRC5BdXRoU3RhdGUgPSBQLkFVVEhfU1RBVEUsIEQuT3B0T3V0ID0gUC5PUFRfT1VULCB3LnNfY19pbiB8fCAody5zX2NfaWwgPSBbXSwgdy5zX2NfaW4gPSAwKSwgeS5fYyA9ICdWaXNpdG9yJywgeS5faWwgPSB3LnNfY19pbCwgeS5faW4gPSB3LnNfY19pbiwgeS5faWxbeS5faW5dID0geSwgdy5zX2NfaW4rKywgeS5faW5zdGFuY2VUeXBlID0gJ3JlZ3VsYXInLCB5Ll9sb2cgPSB7IHJlcXVlc3RzOiBbXSB9LCB5Lm1hcmtldGluZ0Nsb3VkT3JnSUQgPSB0LCB5LmNvb2tpZU5hbWUgPSAnQU1DVl8nICsgdCwgeS5zZXNzaW9uQ29va2llTmFtZSA9ICdBTUNWU18nICsgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBWID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIG4uc2VjdXJlQ29va2llICYmIG4uc2FtZVNpdGVDb29raWUgJiYgKFYgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtZVNpdGU6IG4uc2FtZVNpdGVDb29raWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VjdXJlOiBuLnNlY3VyZUNvb2tpZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHkuY29va2llRG9tYWluID0geS51c2VMb2NhbFN0b3JhZ2UgPyAnJyA6IFcobnVsbCwgViksIHkubG9hZFNTTCA9ICEwLCB5LmxvYWRUaW1lb3V0ID0gMzAwMDAsIHkuQ09SU0Vycm9ycyA9IFtdLCB5Lm1hcmtldGluZ0Nsb3VkU2VydmVyID0geS5hdWRpZW5jZU1hbmFnZXJTZXJ2ZXIgPSAnZHBtLmRlbWRleC5uZXQnLCB5LnNkaWRQYXJhbUV4cGlyeSA9IDMwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEkgPSBudWxsLCBFID0gJ01DJywgTyA9ICdNQ01JRCcsIEEgPSAnTUNJRFRTJywgTCA9ICdBJywgTiA9ICdNQ0FJRCcsIHggPSAnQUFNJywgUiA9ICdNQ0FBTUInLCBGID0gJ05PTkUnLCBCID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFPYmplY3QucHJvdG90eXBlW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHEgPSBRKHkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5GSUVMRFMgPSBQLkZJRUxEUywgeS5jb29raWVSZWFkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS51c2VMb2NhbFN0b3JhZ2UgPyBlID09PSB5LnNlc3Npb25Db29raWVOYW1lID8gc2Vzc2lvblN0b3JhZ2UuZ2V0SXRlbShlKSA6IGxvY2FsU3RvcmFnZS5nZXRJdGVtKGUpIDogei5nZXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5LmNvb2tpZVdyaXRlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9ICcnICsgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeS51c2VMb2NhbFN0b3JhZ2UpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSB5LnNlc3Npb25Db29raWVOYW1lID8gc2Vzc2lvblN0b3JhZ2Uuc2V0SXRlbShlLCBhKSA6IGxvY2FsU3RvcmFnZS5zZXRJdGVtKGUsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0geS5jb29raWVMaWZldGltZSA/ICgnJyArIHkuY29va2llTGlmZXRpbWUpLnRvVXBwZXJDYXNlKCkgOiAnJywgciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGlyZXM6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb21haW46IHkuY29va2llRG9tYWluLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29va2llTGlmZXRpbWU6IGkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5jb25maWdzICYmIHkuY29uZmlncy5zZWN1cmVDb29raWUgJiYgJ2h0dHBzOicgPT09IGxvY2F0aW9uLnByb3RvY29sICYmIChyLnNlY3VyZSA9ICEwKSwgeS5jb25maWdzICYmIHkuY29uZmlncy5zYW1lU2l0ZUNvb2tpZSAmJiAnaHR0cHM6JyA9PT0gbG9jYXRpb24ucHJvdG9jb2wgJiYgKHIuc2FtZVNpdGUgPSBQLlNBTUVfU0lURV9WQUxVRVNbeS5jb25maWdzLnNhbWVTaXRlQ29va2llLnRvVXBwZXJDYXNlKCldIHx8ICdMYXgnKSwgei5zZXQoZSwgYSwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5LnJlbW92ZUNvb2tpZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkudXNlTG9jYWxTdG9yYWdlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0geS5zZXNzaW9uQ29va2llTmFtZSA/IHNlc3Npb25TdG9yYWdlLnJlbW92ZUl0ZW0oZSkgOiBsb2NhbFN0b3JhZ2UucmVtb3ZlSXRlbShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHsgZG9tYWluOiB5LmNvb2tpZURvbWFpbiB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5LmNvbmZpZ3MgJiYgeS5jb25maWdzLnNlY3VyZUNvb2tpZSAmJiAnaHR0cHM6JyA9PT0gbG9jYXRpb24ucHJvdG9jb2wgJiYgKHQuc2VjdXJlID0gITApLCB5LmNvbmZpZ3MgJiYgeS5jb25maWdzLnNhbWVTaXRlQ29va2llICYmICdodHRwczonID09PSBsb2NhdGlvbi5wcm90b2NvbCAmJiAodC5zYW1lU2l0ZSA9IFAuU0FNRV9TSVRFX1ZBTFVFU1t5LmNvbmZpZ3Muc2FtZVNpdGVDb29raWUudG9VcHBlckNhc2UoKV0gfHwgJ0xheCcpLCB6LnJlbW92ZShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkucmVzZXRTdGF0ZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA/IHkuX21lcmdlU2VydmVyU3RhdGUoZSkgOiBvKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9pc0FsbG93ZWREb25lID0gITEsIHkuX2lzQWxsb3dlZEZsYWcgPSAhMSwgeS5pc0FsbG93ZWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkuX2lzQWxsb3dlZERvbmUgfHwgKHkuX2lzQWxsb3dlZERvbmUgPSAhMCwgKHkuY29va2llUmVhZCh5LmNvb2tpZU5hbWUpIHx8IHkuY29va2llV3JpdGUoeS5jb29raWVOYW1lLCAnVCcsIDEpKSAmJiAoeS5faXNBbGxvd2VkRmxhZyA9ICEwKSksICdUJyA9PT0geS5jb29raWVSZWFkKHkuY29va2llTmFtZSkgJiYgeS5yZW1vdmVDb29raWUoeS5jb29raWVOYW1lKSwgeS5faXNBbGxvd2VkRmxhZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuc2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX3NldE1hcmtldGluZ0Nsb3VkRmllbGRzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fdXNlMXN0UGFydHlNYXJrZXRpbmdDbG91ZFNlcnZlciA9ICExLCB5LmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Lm1hcmtldGluZ0Nsb3VkU2VydmVyICYmIHkubWFya2V0aW5nQ2xvdWRTZXJ2ZXIuaW5kZXhPZignLmRlbWRleC5uZXQnKSA8IDAgJiYgKHkuX3VzZTFzdFBhcnR5TWFya2V0aW5nQ2xvdWRTZXJ2ZXIgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB5Ll9nZXRBdWRpZW5jZU1hbmFnZXJVUkxEYXRhKCdfc2V0TWFya2V0aW5nQ2xvdWRGaWVsZHMnKSwgYSA9IG4udXJsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5Ll9nZXRSZW1vdGVGaWVsZChPLCBhLCBlLCB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgWCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW2VdID0geS5fZ2V0RmllbGQoZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgLTEgIT09IHQuaW5kZXhPZignTUNPUFRPVVQnKSA/IHkuaXNPcHRlZE91dChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5NQ09QVE9VVCA9IHQsIGUobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG51bGwsICEwKSA6IGUobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuZ2V0VmlzaXRvclZhbHVlcyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ01JRDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuOiB5LmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklELAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3M6IFshMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogeQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DT1BUT1VUOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm46IHkuaXNPcHRlZE91dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IHkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FJRDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuOiB5LmdldEFuYWx5dGljc1Zpc2l0b3JJRCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcmdzOiBbITBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQ6IHkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUxIOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm46IHkuZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyZ3M6IFshMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dDogeQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNQjogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZuOiB5LmdldEF1ZGllbmNlTWFuYWdlckJsb2IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJnczogWyEwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiB5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEgPSB0ICYmIHQubGVuZ3RoID8gVC5wbHVjayhuLCB0KSA6IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAtMSA9PT0gdC5pbmRleE9mKCdNQ0FJRCcpID8gWChlLCB0KSA6IEgoYSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9jdXJyZW50Q3VzdG9tZXJJRHMgPSB7fSwgeS5fY3VzdG9tZXJJRHNIYXNoQ2hhbmdlZCA9ICExLCB5Ll9uZXdDdXN0b21lcklEc0hhc2ggPSAnJywgeS5zZXRDdXN0b21lcklEcyA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5LmlzT3B0ZWRPdXQoKSAmJiB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVC5pc09iamVjdCh0KSB8fCBULmlzT2JqZWN0RW1wdHkodCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCByLCBzLCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgaW4gKHkuX3JlYWRWaXNpdG9yKCksIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEIoYSkgJiYgKHkuX2N1cnJlbnRDdXN0b21lcklEcy5kYXRhU291cmNlcyA9IHkuX2N1cnJlbnRDdXN0b21lcklEcy5kYXRhU291cmNlcyB8fCB7fSwgbiA9IChyID0gdFthXSkuaGFzT3duUHJvcGVydHkoJ2hhc2hUeXBlJykgPyByLmhhc2hUeXBlIDogbiwgcikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09PSBlKHIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyLmlkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG8gPSBOZSh4ZShyLmlkKSwgbikpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5pZCA9IG8sIGMuaGFzaFR5cGUgPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5pZCA9IHIuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSByLmF1dGhTdGF0ZSAmJiAoYy5hdXRoU3RhdGUgPSByLmF1dGhTdGF0ZSksIHkuX2N1cnJlbnRDdXN0b21lcklEcy5kYXRhU291cmNlc1thXSA9IGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG8gPSBOZSh4ZShyKSwgbikpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9jdXJyZW50Q3VzdG9tZXJJRHMuZGF0YVNvdXJjZXNbYV0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc2hUeXBlOiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX2N1cnJlbnRDdXN0b21lcklEcy5kYXRhU291cmNlc1thXSA9IHsgaWQ6IHIgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSB5LmdldEN1c3RvbWVySURzKCEwKSwgdSA9IHkuX2dldEZpZWxkKCdNQ0NJREgnKSwgZCA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHMgaW4gKHUgfHwgKHUgPSAwKSwgbCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gbFtzXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVC5pc09iamVjdEVtcHR5KHApKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSBpbiBwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCKGEpICYmIChkICs9IChkID8gJ3wnIDogJycpICsgYSArICd8JyArICgociA9IHBbYV0pLmlkID8gci5pZCA6ICcnKSArIChyLmF1dGhTdGF0ZSA/IHIuYXV0aFN0YXRlIDogJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9uZXdDdXN0b21lcklEc0hhc2ggPSBTdHJpbmcoeS5faGFzaChkKSksIHkuX25ld0N1c3RvbWVySURzSGFzaCAhPT0gdSAmJiAoeS5fY3VzdG9tZXJJRHNIYXNoQ2hhbmdlZCA9ICEwLCB5Ll9tYXBDdXN0b21lcklEcyhpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5zeW5jSWRlbnRpdHkgPSBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgheS5pc09wdGVkT3V0KCkgJiYgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVQuaXNPYmplY3QodCkgfHwgVC5pc09iamVjdEVtcHR5KHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgciwgcywgbywgYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChhIGluICh5Ll9yZWFkVmlzaXRvcigpLCB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChCKGEpICYmICh5Ll9jdXJyZW50Q3VzdG9tZXJJRHMubmFtZVNwYWNlcyA9IHkuX2N1cnJlbnRDdXN0b21lcklEcy5uYW1lU3BhY2VzIHx8IHt9LCBuID0gKHIgPSB0W2FdKS5oYXNPd25Qcm9wZXJ0eSgnaGFzaFR5cGUnKSA/IHIuaGFzaFR5cGUgOiBuLCByICYmICdvYmplY3QnID09PSBlKHIpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIuaWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKHMgPSBOZSh4ZShyLmlkKSwgbikpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaWQgPSBzLCBsLmhhc2hUeXBlID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLmlkID0gci5pZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSByLmF1dGhTdGF0ZSAmJiAobC5hdXRoU3RhdGUgPSByLmF1dGhTdGF0ZSksIHIuZGF0YVNvdXJjZSAmJiAoeS5fY3VycmVudEN1c3RvbWVySURzLmRhdGFTb3VyY2VzID0geS5fY3VycmVudEN1c3RvbWVySURzLmRhdGFTb3VyY2VzIHx8IHt9LCBvID0gci5kYXRhU291cmNlLCB5Ll9jdXJyZW50Q3VzdG9tZXJJRHMuZGF0YVNvdXJjZXNbb10gPSBsKSwgeS5fY3VycmVudEN1c3RvbWVySURzLm5hbWVTcGFjZXNbYV0gPSBsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9IHkuZ2V0Q3VzdG9tZXJJRHMoITApLCBkID0geS5fZ2V0RmllbGQoJ01DQ0lESCcpLCBwID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYyBpbiAoZCB8fCAoZCA9ICcwJyksIHUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHVbY107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVQuaXNPYmplY3RFbXB0eShmKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgaW4gZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQihhKSAmJiAocCArPSAocCA/ICd8JyA6ICcnKSArIGEgKyAnfCcgKyAoKHIgPSBmW2FdKS5pZCA/IHIuaWQgOiAnJykgKyAoci5hdXRoU3RhdGUgPyByLmF1dGhTdGF0ZSA6ICcnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fbmV3Q3VzdG9tZXJJRHNIYXNoID0gU3RyaW5nKHkuX2hhc2gocCkpLCB5Ll9uZXdDdXN0b21lcklEc0hhc2ggIT09IGQgJiYgKHkuX2N1c3RvbWVySURzSGFzaENoYW5nZWQgPSAhMCwgeS5fbWFwQ3VzdG9tZXJJRHMoaSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuZ2V0Q3VzdG9tZXJJRHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX3JlYWRWaXNpdG9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhU291cmNlczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lU3BhY2VzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpID0geS5fY3VycmVudEN1c3RvbWVySURzLmRhdGFTb3VyY2VzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCBpbiBpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCKHQpICYmIChuID0gaVt0XSkuaWQgJiYgKGEuZGF0YVNvdXJjZXNbdF0gfHwgKGEuZGF0YVNvdXJjZXNbdF0gPSB7fSksIGEuZGF0YVNvdXJjZXNbdF0uaWQgPSBuLmlkLCBudWxsICE9IG4uYXV0aFN0YXRlID8gYS5kYXRhU291cmNlc1t0XS5hdXRoU3RhdGUgPSBuLmF1dGhTdGF0ZSA6IGEuZGF0YVNvdXJjZXNbdF0uYXV0aFN0YXRlID0gRC5BdXRoU3RhdGUuVU5LTk9XTiwgbi5oYXNoVHlwZSAmJiAoYS5kYXRhU291cmNlc1t0XS5oYXNoVHlwZSA9IG4uaGFzaFR5cGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHkuX2N1cnJlbnRDdXN0b21lcklEcy5uYW1lU3BhY2VzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodCBpbiByKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCKHQpICYmIChuID0gclt0XSkuaWQgJiYgKGEubmFtZVNwYWNlc1t0XSB8fCAoYS5uYW1lU3BhY2VzW3RdID0ge30pLCBhLm5hbWVTcGFjZXNbdF0uaWQgPSBuLmlkLCBudWxsICE9IG4uYXV0aFN0YXRlID8gYS5uYW1lU3BhY2VzW3RdLmF1dGhTdGF0ZSA9IG4uYXV0aFN0YXRlIDogYS5uYW1lU3BhY2VzW3RdLmF1dGhTdGF0ZSA9IEQuQXV0aFN0YXRlLlVOS05PV04sIG4uaGFzaFR5cGUgJiYgKGEubmFtZVNwYWNlc1t0XS5oYXNoVHlwZSA9IG4uaGFzaFR5cGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IGEgOiBhLmRhdGFTb3VyY2VzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5zZXRBbmFseXRpY3NWaXNpdG9ySUQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX3NldEFuYWx5dGljc0ZpZWxkcyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuZ2V0QW5hbHl0aWNzVmlzaXRvcklEID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXRlLmlzVHJhY2tpbmdTZXJ2ZXJQb3B1bGF0ZWQoKSAmJiAhbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkuX2NhbGxDYWxsYmFjayhlLCBbJyddKSwgJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiB8fCAoYSA9IHkuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5nZXRBbmFseXRpY3NWaXNpdG9ySUQoZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSksIGEgfHwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4gPyB5Lm1hcmtldGluZ0Nsb3VkU2VydmVyIDogeS50cmFja2luZ1NlcnZlciwgciA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmxvYWRTU0wgJiYgKG4gPyB5Lm1hcmtldGluZ0Nsb3VkU2VydmVyU2VjdXJlICYmIChpID0geS5tYXJrZXRpbmdDbG91ZFNlcnZlclNlY3VyZSkgOiB5LnRyYWNraW5nU2VydmVyU2VjdXJlICYmIChpID0geS50cmFja2luZ1NlcnZlclNlY3VyZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSAnaHR0cCcgKyAoeS5sb2FkU1NMID8gJ3MnIDogJycpICsgJzovLycgKyBpICsgJy9pZCcsIGMgPSAnZF92aXNpZF92ZXI9JyArIHkudmVyc2lvbiArICcmbWNvcmdpZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KHkubWFya2V0aW5nQ2xvdWRPcmdJRCkgKyAoYSA/ICcmbWlkPScgKyBlbmNvZGVVUklDb21wb25lbnQoYSkgOiAnJykgKyAoeS5pZFN5bmNEaXNhYmxlM3JkUGFydHlTeW5jaW5nIHx8IHkuZGlzYWJsZVRoaXJkUGFydHlDb29raWVzID8gJyZkX2NvcHBhPXRydWUnIDogJycpLCBsID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnc19jX2lsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5faW4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdfc2V0JyArIChuID8gJ01hcmtldGluZ0Nsb3VkJyA6ICdBbmFseXRpY3MnKSArICdGaWVsZHMnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBvICsgJz8nICsgYyArICcmY2FsbGJhY2s9c19jX2lsJTVCJyArIHkuX2luICsgJyU1RC5fc2V0JyArIChuID8gJ01hcmtldGluZ0Nsb3VkJyA6ICdBbmFseXRpY3MnKSArICdGaWVsZHMnLCBzLmNvcnNVcmwgPSBvICsgJz8nICsgYywgcy5jYWxsYmFjayA9IGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMudXJsID0gciwgeS5fZ2V0UmVtb3RlRmllbGQobiA/IE8gOiBOLCByLCBlLCB0LCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5nZXRBdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh5LmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuZ2V0QXVkaWVuY2VNYW5hZ2VyTG9jYXRpb25IaW50KGUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB5Ll9nZXRGaWVsZChOKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFuICYmIHRlLmlzVHJhY2tpbmdTZXJ2ZXJQb3B1bGF0ZWQoKSAmJiAobiA9IHkuZ2V0QW5hbHl0aWNzVmlzaXRvcklEKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmdldEF1ZGllbmNlTWFuYWdlckxvY2F0aW9uSGludChlLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSksIG4gfHwgIXRlLmlzVHJhY2tpbmdTZXJ2ZXJQb3B1bGF0ZWQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB5Ll9nZXRBdWRpZW5jZU1hbmFnZXJVUkxEYXRhKCksIGkgPSBhLnVybDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5Ll9nZXRSZW1vdGVGaWVsZCgnTUNBQU1MSCcsIGksIGUsIHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuZ2V0TG9jYXRpb25IaW50ID0geS5nZXRBdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQsIHkuZ2V0QXVkaWVuY2VNYW5hZ2VyQmxvYiA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5nZXRBdWRpZW5jZU1hbmFnZXJCbG9iKGUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB5Ll9nZXRGaWVsZChOKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFuICYmIHRlLmlzVHJhY2tpbmdTZXJ2ZXJQb3B1bGF0ZWQoKSAmJiAobiA9IHkuZ2V0QW5hbHl0aWNzVmlzaXRvcklEKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmdldEF1ZGllbmNlTWFuYWdlckJsb2IoZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBuIHx8ICF0ZS5pc1RyYWNraW5nU2VydmVyUG9wdWxhdGVkKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0geS5fZ2V0QXVkaWVuY2VNYW5hZ2VyVVJMRGF0YSgpLCBpID0gYS51cmw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5fY3VzdG9tZXJJRHNIYXNoQ2hhbmdlZCAmJiB5Ll9zZXRGaWVsZEV4cGlyZShSLCAtMSksIHkuX2dldFJlbW90ZUZpZWxkKFIsIGksIGUsIHQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQgPSAnJywgeS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkID0ge30sIHkuX3N1cHBsZW1lbnRhbERhdGFJRExhc3QgPSAnJywgeS5fc3VwcGxlbWVudGFsRGF0YUlETGFzdENvbnN1bWVkID0ge30sIHkuZ2V0U3VwcGxlbWVudGFsRGF0YUlEID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9zdXBwbGVtZW50YWxEYXRhSURDdXJyZW50IHx8IHQgfHwgKHkuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQgPSB5Ll9nZW5lcmF0ZUlEKDEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHkuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkuX3N1cHBsZW1lbnRhbERhdGFJRExhc3QgJiYgIXkuX3N1cHBsZW1lbnRhbERhdGFJRExhc3RDb25zdW1lZFtlXSA/IChuID0geS5fc3VwcGxlbWVudGFsRGF0YUlETGFzdCwgeS5fc3VwcGxlbWVudGFsRGF0YUlETGFzdENvbnN1bWVkW2VdID0gITApIDogbiAmJiAoeS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkW2VdICYmICh5Ll9zdXBwbGVtZW50YWxEYXRhSURMYXN0ID0geS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudCwgeS5fc3VwcGxlbWVudGFsRGF0YUlETGFzdENvbnN1bWVkID0geS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkLCB5Ll9zdXBwbGVtZW50YWxEYXRhSURDdXJyZW50ID0gbiA9IHQgPyAnJyA6IHkuX2dlbmVyYXRlSUQoMSksIHkuX3N1cHBsZW1lbnRhbERhdGFJREN1cnJlbnRDb25zdW1lZCA9IHt9KSwgbiAmJiAoeS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkW2VdID0gITApKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgWiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fbGliZXJhdGVkT3B0T3V0ID0gbnVsbCwgeS5nZXRPcHRPdXQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0geS5fZ2V0QXVkaWVuY2VNYW5hZ2VyVVJMRGF0YSgnX3NldE1hcmtldGluZ0Nsb3VkRmllbGRzJyksIGEgPSBuLnVybDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5fZ2V0UmVtb3RlRmllbGQoJ01DT1BUT1VUJywgYSwgZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkuX3JlZ2lzdGVyQ2FsbGJhY2soJ2xpYmVyYXRlZE9wdE91dCcsIGUpLCBudWxsICE9PSB5Ll9saWJlcmF0ZWRPcHRPdXQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5Ll9jYWxsQWxsQ2FsbGJhY2tzKCdsaWJlcmF0ZWRPcHRPdXQnLCBbeS5fbGliZXJhdGVkT3B0T3V0XSksIFogPSAhMSwgeS5fbGliZXJhdGVkT3B0T3V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChaKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBaID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAnbGliZXJhdGVkR2V0T3B0T3V0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5jb3JzVXJsID0gbi5jb3JzVXJsLnJlcGxhY2UoL1wuZGVtZGV4XC5uZXRcL2lkXD8vLCAnLmRlbWRleC5uZXQvb3B0T3V0U3RhdHVzPycpLCBuLmNhbGxiYWNrID0gW2ldLCBoW2ldID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPT09IE9iamVjdChlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIGEgPSBULnBhcnNlT3B0T3V0KGUsIHQsIEYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IGEub3B0T3V0LCBuID0gMTAwMCAqIGEuZF9vdHRsLCB5Ll9saWJlcmF0ZWRPcHRPdXQgPSB0LCBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9saWJlcmF0ZWRPcHRPdXQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fY2FsbEFsbENhbGxiYWNrcygnbGliZXJhdGVkT3B0T3V0JywgW3RdKSwgWiA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHEuZmlyZUNPUlMobiksIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5LmlzT3B0ZWRPdXQgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgfHwgKHQgPSBELk9wdE91dC5HTE9CQUwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0geS5nZXRPcHRPdXQoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuID09PSBELk9wdE91dC5HTE9CQUwgfHwgbi5pbmRleE9mKHQpID49IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX2NhbGxDYWxsYmFjayhlLCBbYV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA9PT0gRC5PcHRPdXQuR0xPQkFMIHx8IGEuaW5kZXhPZih0KSA+PSAwIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZWUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Vic2NyaWJlZDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2tzOiBbXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkub25SZWNlaXZlRWNpZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVlLnN1YnNjcmliZWQgPSAhMCwgZSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBlICYmIGVlLmNhbGxiYWNrcy5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fZmllbGRzID0gbnVsbCwgeS5fZmllbGRzRXhwaXJlZCA9IG51bGwsIHkuX2hhc2ggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0ID0gMDsgdCA8IGUubGVuZ3RoOyB0KyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gKG4gPDwgNSkgLSBuICsgZS5jaGFyQ29kZUF0KHQpLCBuICY9IG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9nZW5lcmF0ZUlEID0gWSwgeS5fZ2VuZXJhdGVMb2NhbE1JRCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHkuX2dlbmVyYXRlSUQoMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGllLmlzQ2xpZW50U2lkZU1hcmtldGluZ0Nsb3VkVmlzaXRvcklEID0gITAsIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9jYWxsYmFja0xpc3QgPSBudWxsLCB5Ll9jYWxsQ2FsbGJhY2sgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT0gdHlwZW9mIGUgPyBlLmFwcGx5KHcsIHQpIDogZVsxXS5hcHBseShlWzBdLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fcmVnaXN0ZXJDYWxsYmFjayA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCAmJiAobnVsbCA9PSB5Ll9jYWxsYmFja0xpc3QgJiYgKHkuX2NhbGxiYWNrTGlzdCA9IHt9KSwgbnVsbCA9PSB5Ll9jYWxsYmFja0xpc3RbZV0gJiYgKHkuX2NhbGxiYWNrTGlzdFtlXSA9IFtdKSwgeS5fY2FsbGJhY2tMaXN0W2VdLnB1c2godCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fY2FsbEFsbENhbGxiYWNrcyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0geS5fY2FsbGJhY2tMaXN0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0geS5fY2FsbGJhY2tMaXN0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBuLmxlbmd0aCA+IDA7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX2NhbGxDYWxsYmFjayhuLnNoaWZ0KCksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2FkZFF1ZXJ5c3RyaW5nUGFyYW0gPSBmdW5jdGlvbiAoZSwgdCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZW5jb2RlVVJJQ29tcG9uZW50KHQpICsgJz0nICsgZW5jb2RlVVJJQ29tcG9uZW50KG4pLCByID0gdGUucGFyc2VIYXNoKGUpLCBzID0gdGUuaGFzaGxlc3NVcmwoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC0xID09PSBzLmluZGV4T2YoJz8nKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMgKyAnPycgKyBpICsgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHMuc3BsaXQoJz8nKSwgYyA9IG9bMF0gKyAnPycsIGwgPSBvWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjICsgdGUuYWRkUXVlcnlQYXJhbUF0TG9jYXRpb24obCwgaSwgYSkgKyByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fZXh0cmFjdFBhcmFtRnJvbVVyaSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBuZXcgUmVnRXhwKCdbXFw/JiNdJyArIHQgKyAnPShbXiYjXSopJykuZXhlYyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiAmJiBuLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRlY29kZVVSSUNvbXBvbmVudChuWzFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX3BhcnNlQWRvYmVNY0Zyb21VcmwgPSByKCQuQURPQkVfTUMpLCB5Ll9wYXJzZUFkb2JlTWNTZGlkRnJvbVVybCA9IHIoJC5BRE9CRV9NQ19TRElEKSwgeS5fYXR0ZW1wdFRvUG9wdWxhdGVTZGlkRnJvbVVybCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB5Ll9wYXJzZUFkb2JlTWNTZGlkRnJvbVVybChlKSwgYSA9IDEwMDAwMDAwMDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiBuLlRTICYmIChhID0gdGUuZ2V0VGltZXN0YW1wSW5TZWNvbmRzKCkgLSBuLlRTKSwgbiAmJiBuLlNESUQgJiYgbi5NQ09SR0lEID09PSB0ICYmIGEgPCB5LnNkaWRQYXJhbUV4cGlyeSAmJiAoeS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudCA9IG4uU0RJRCwgeS5fc3VwcGxlbWVudGFsRGF0YUlEQ3VycmVudENvbnN1bWVkLlNESURfVVJMX1BBUkFNID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fYXR0ZW1wdFRvUG9wdWxhdGVJZHNGcm9tVXJsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0geS5fcGFyc2VBZG9iZU1jRnJvbVVybCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICYmIGUuVFMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0ZS5nZXRUaW1lc3RhbXBJblNlY29uZHMoKSAtIGUuVFM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNYXRoLmZsb29yKG4gLyA2MCkgPiAkLkFET0JFX01DX1RUTF9JTl9NSU4gfHwgZS5NQ09SR0lEICE9PSB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX21lcmdlU2VydmVyU3RhdGUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRlLmlzT2JqZWN0KGUpID8gZSA6IEpTT04ucGFyc2UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfShlKSlbeS5tYXJrZXRpbmdDbG91ZE9yZ0lEXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZVt5Lm1hcmtldGluZ0Nsb3VkT3JnSURdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZS5pc09iamVjdChlKSAmJiB5LnNldEN1c3RvbWVySURzKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0odC5jdXN0b21lcklEcyksIG8odC5zZGlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdgc2VydmVyU3RhdGVgIGhhcyBhbiBpbnZhbGlkIGZvcm1hdC4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fdGltZW91dCA9IG51bGwsIHkuX2xvYWREYXRhID0gZnVuY3Rpb24gKGUsIHQsIG4sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0geS5fYWRkUXVlcnlzdHJpbmdQYXJhbSh0LCAnZF9maWVsZGdyb3VwJywgZSwgMSksIGEudXJsID0geS5fYWRkUXVlcnlzdHJpbmdQYXJhbShhLnVybCwgJ2RfZmllbGRncm91cCcsIGUsIDEpLCBhLmNvcnNVcmwgPSB5Ll9hZGRRdWVyeXN0cmluZ1BhcmFtKGEuY29yc1VybCwgJ2RfZmllbGRncm91cCcsIGUsIDEpLCBpZS5maWVsZEdyb3VwT2JqW2VdID0gITAsIGEgPT09IE9iamVjdChhKSAmJiBhLmNvcnNVcmwgJiYgJ1hNTEh0dHBSZXF1ZXN0JyA9PT0gcS5jb3JzTWV0YWRhdGEuY29yc1R5cGUgJiYgcS5maXJlQ09SUyhhLCBuLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2NsZWFyVGltZW91dCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSB5Ll90aW1lb3V0ICYmIHkuX3RpbWVvdXRbZV0gJiYgKGNsZWFyVGltZW91dCh5Ll90aW1lb3V0W2VdKSwgeS5fdGltZW91dFtlXSA9IDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fc2V0dGluZ3NEaWdlc3QgPSAwLCB5Ll9nZXRTZXR0aW5nc0RpZ2VzdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXkuX3NldHRpbmdzRGlnZXN0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0geS52ZXJzaW9uOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmF1ZGllbmNlTWFuYWdlclNlcnZlciAmJiAoZSArPSAnfCcgKyB5LmF1ZGllbmNlTWFuYWdlclNlcnZlciksIHkuYXVkaWVuY2VNYW5hZ2VyU2VydmVyU2VjdXJlICYmIChlICs9ICd8JyArIHkuYXVkaWVuY2VNYW5hZ2VyU2VydmVyU2VjdXJlKSwgeS5fc2V0dGluZ3NEaWdlc3QgPSB5Ll9oYXNoKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5fc2V0dGluZ3NEaWdlc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9yZWFkVmlzaXRvckRvbmUgPSAhMSwgeS5fcmVhZFZpc2l0b3IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5Ll9yZWFkVmlzaXRvckRvbmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fcmVhZFZpc2l0b3JEb25lID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0LCBuLCBhLCBpLCByLCBzID0geS5fZ2V0U2V0dGluZ3NEaWdlc3QoKSwgbyA9ICExLCBjID0geS5jb29raWVSZWFkKHkuY29va2llTmFtZSksIGwgPSBuZXcgRGF0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyB8fCBqIHx8IHkuZGlzY2FyZFRyYWNraW5nU2VydmVyRUNJRCB8fCAoYyA9IHkuY29va2llUmVhZCgkLkZJUlNUX1BBUlRZX1NFUlZFUl9DT09LSUUpKSwgbnVsbCA9PSB5Ll9maWVsZHMgJiYgKHkuX2ZpZWxkcyA9IHt9KSwgYyAmJiAnVCcgIT09IGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKChjID0gYy5zcGxpdCgnfCcpKVswXS5tYXRjaCgvXltcLTAtOV0rJC8pICYmIChwYXJzZUludChjWzBdLCAxMCkgIT09IHMgJiYgKG8gPSAhMCksIGMuc2hpZnQoKSksIGMubGVuZ3RoICUgMiA9PSAxICYmIGMucG9wKCksIGUgPSAwOyBlIDwgYy5sZW5ndGg7IGUgKz0gMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gKHQgPSBjW2VdLnNwbGl0KCctJykpWzBdLCBhID0gY1tlICsgMV0sIHQubGVuZ3RoID4gMSA/IChpID0gcGFyc2VJbnQodFsxXSwgMTApLCByID0gdFsxXS5pbmRleE9mKCdzJykgPiAwKSA6IChpID0gMCwgciA9ICExKSwgbyAmJiAoJ01DQ0lESCcgPT09IG4gJiYgKGEgPSAnJyksIGkgPiAwICYmIChpID0gbC5nZXRUaW1lKCkgLyAxMDAwIC0gNjApKSwgbiAmJiBhICYmICh5Ll9zZXRGaWVsZChuLCBhLCAxKSwgaSA+IDAgJiYgKHkuX2ZpZWxkc1snZXhwaXJlJyArIG5dID0gaSArIChyID8gJ3MnIDogJycpLCAobC5nZXRUaW1lKCkgPj0gMTAwMCAqIGkgfHwgciAmJiAheS5jb29raWVSZWFkKHkuc2Vzc2lvbkNvb2tpZU5hbWUpKSAmJiAoeS5fZmllbGRzRXhwaXJlZCB8fCAoeS5fZmllbGRzRXhwaXJlZCA9IHt9KSwgeS5fZmllbGRzRXhwaXJlZFtuXSA9ICEwKSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAheS5fZ2V0RmllbGQoTikgJiYgdGUuaXNUcmFja2luZ1NlcnZlclBvcHVsYXRlZCgpICYmIChjID0geS5jb29raWVSZWFkKCdzX3ZpJykpICYmIChjID0gYy5zcGxpdCgnfCcpKS5sZW5ndGggPiAxICYmIGNbMF0uaW5kZXhPZigndjEnKSA+PSAwICYmICgoZSA9IChhID0gY1sxXSkuaW5kZXhPZignWycpKSA+PSAwICYmIChhID0gYS5zdWJzdHJpbmcoMCwgZSkpLCBhICYmIGEubWF0Y2goJC5WQUxJRF9WSVNJVE9SX0lEX1JFR0VYKSAmJiB5Ll9zZXRGaWVsZChOLCBhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fYXBwZW5kVmVyc2lvblRvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICd2VmVyc2lvbnwnICsgeS52ZXJzaW9uLCBuID0gZSA/IHkuX2dldENvb2tpZVZlcnNpb24oZSkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID8gSi5hcmVWZXJzaW9uc0RpZmZlcmVudChuLCB5LnZlcnNpb24pICYmIChlID0gZS5yZXBsYWNlKCQuVkVSU0lPTl9SRUdFWCwgdCkpIDogZSArPSAoZSA/ICd8JyA6ICcnKSArIHQsIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll93cml0ZVZpc2l0b3IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQsIG4gPSB5Ll9nZXRTZXR0aW5nc0RpZ2VzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSBpbiB5Ll9maWVsZHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEIoZSkgJiYgeS5fZmllbGRzW2VdICYmICdleHBpcmUnICE9PSBlLnN1YnN0cmluZygwLCA2KSAmJiAodCA9IHkuX2ZpZWxkc1tlXSwgbiArPSAobiA/ICd8JyA6ICcnKSArIGUgKyAoeS5fZmllbGRzWydleHBpcmUnICsgZV0gPyAnLScgKyB5Ll9maWVsZHNbJ2V4cGlyZScgKyBlXSA6ICcnKSArICd8JyArIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB5Ll9hcHBlbmRWZXJzaW9uVG8obiksIHkuY29va2llV3JpdGUoeS5jb29raWVOYW1lLCBuLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2dldEZpZWxkID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSB5Ll9maWVsZHMgfHwgIXQgJiYgeS5fZmllbGRzRXhwaXJlZCAmJiB5Ll9maWVsZHNFeHBpcmVkW2VdID8gbnVsbCA6IHkuX2ZpZWxkc1tlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX3NldEZpZWxkID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsID09IHkuX2ZpZWxkcyAmJiAoeS5fZmllbGRzID0ge30pLCB5Ll9maWVsZHNbZV0gPSB0LCBuIHx8IHkuX3dyaXRlVmlzaXRvcigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fZ2V0RmllbGRMaXN0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHkuX2dldEZpZWxkKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID8gbi5zcGxpdCgnKicpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX3NldEZpZWxkTGlzdCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fc2V0RmllbGQoZSwgdCA/IHQuam9pbignKicpIDogJycsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fZ2V0RmllbGRNYXAgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0geS5fZ2V0RmllbGRMaXN0KGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCBpID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IDA7IGEgPCBuLmxlbmd0aDsgYSArPSAyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaVtuW2FdXSA9IG5bYSArIDFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9zZXRGaWVsZE1hcCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEsIGkgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgaW4gKGkgPSBbXSwgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCKGEpICYmIChpLnB1c2goYSksIGkucHVzaCh0W2FdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fc2V0RmllbGRMaXN0KGUsIGksIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fc2V0RmllbGRFeHBpcmUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IERhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnNldFRpbWUoYS5nZXRUaW1lKCkgKyAxMDAwICogdCksIG51bGwgPT0geS5fZmllbGRzICYmICh5Ll9maWVsZHMgPSB7fSksIHkuX2ZpZWxkc1snZXhwaXJlJyArIGVdID0gTWF0aC5mbG9vcihhLmdldFRpbWUoKSAvIDEwMDApICsgKG4gPyAncycgOiAnJyksIHQgPCAwID8gKHkuX2ZpZWxkc0V4cGlyZWQgfHwgKHkuX2ZpZWxkc0V4cGlyZWQgPSB7fSksIHkuX2ZpZWxkc0V4cGlyZWRbZV0gPSAhMCkgOiB5Ll9maWVsZHNFeHBpcmVkICYmICh5Ll9maWVsZHNFeHBpcmVkW2VdID0gITEpLCBuICYmICh5LmNvb2tpZVJlYWQoeS5zZXNzaW9uQ29va2llTmFtZSkgfHwgeS5jb29raWVXcml0ZSh5LnNlc3Npb25Db29raWVOYW1lLCAnMScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2ZpbmRWaXNpdG9ySUQgPSBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmICgnb2JqZWN0JyA9PT0gZSh0KSAmJiAodCA9IHQuZF9taWQgPyB0LmRfbWlkIDogdC52aXNpdG9ySUQgPyB0LnZpc2l0b3JJRCA6IHQuaWQgPyB0LmlkIDogdC51dWlkID8gdC51dWlkIDogJycgKyB0KSwgdCAmJiAnTk9UQVJHRVQnID09PSAodCA9IHQudG9VcHBlckNhc2UoKSkgJiYgKHQgPSBGKSwgdCAmJiAodCA9PT0gRiB8fCB0Lm1hdGNoKCQuVkFMSURfVklTSVRPUl9JRF9SRUdFWCkpIHx8ICh0ID0gJycpKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX3NldEZpZWxkcyA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkuX2NsZWFyVGltZW91dCh0KSwgbnVsbCAhPSB5Ll9sb2FkaW5nICYmICh5Ll9sb2FkaW5nW3RdID0gITEpLCBpZS5maWVsZEdyb3VwT2JqW3RdICYmIGllLnNldFN0YXRlKHQsICExKSwgdCA9PT0gRSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhMCAhPT0gaWUuaXNDbGllbnRTaWRlTWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQgJiYgKGllLmlzQ2xpZW50U2lkZU1hcmtldGluZ0Nsb3VkVmlzaXRvcklEID0gITEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHkuX2dldEZpZWxkKE8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWEgfHwgeS5vdmVyd3JpdGVDcm9zc0RvbWFpbk1DSURBbmRBSUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGEgPSAnb2JqZWN0JyA9PT0gZShuKSAmJiBuLm1pZCA/IG4ubWlkIDogeS5fZmluZFZpc2l0b3JJRChuKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeS5fdXNlMXN0UGFydHlNYXJrZXRpbmdDbG91ZFNlcnZlciAmJiAheS50cmllZDFzdFBhcnR5TWFya2V0aW5nQ2xvdWRTZXJ2ZXIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5LnRyaWVkMXN0UGFydHlNYXJrZXRpbmdDbG91ZFNlcnZlciA9ICEwLCB2b2lkIHkuZ2V0QW5hbHl0aWNzVmlzaXRvcklEKG51bGwsICExLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IHkuX2dlbmVyYXRlTG9jYWxNSUQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX3NldEZpZWxkKE8sIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgJiYgYSAhPT0gRiB8fCAoYSA9ICcnKSwgJ29iamVjdCcgPT09IGUobikgJiYgKChuLmRfcmVnaW9uIHx8IG4uZGNzX3JlZ2lvbiB8fCBuLmRfYmxvYiB8fCBuLmJsb2IpICYmIHkuX3NldEZpZWxkcyh4LCBuKSwgeS5fdXNlMXN0UGFydHlNYXJrZXRpbmdDbG91ZFNlcnZlciAmJiBuLm1pZCAmJiB5Ll9zZXRGaWVsZHMoTCwgeyBpZDogbi5pZCB9KSksIHkuX2NhbGxBbGxDYWxsYmFja3MoTywgW2FdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPT09IHggJiYgJ29iamVjdCcgPT09IGUobikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSA2MDQ4MDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT0gbi5pZF9zeW5jX3R0bCAmJiBuLmlkX3N5bmNfdHRsICYmIChpID0gcGFyc2VJbnQobi5pZF9zeW5jX3R0bCwgMTApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBuZS5nZXRSZWdpb25BbmRDaGVja0lmQ2hhbmdlZChuLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fY2FsbEFsbENhbGxiYWNrcygnTUNBQU1MSCcsIFtyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0geS5fZ2V0RmllbGQoUik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChuLmRfYmxvYiB8fCBuLmJsb2IpICYmICgocyA9IG4uZF9ibG9iKSB8fCAocyA9IG4uYmxvYiksIHkuX3NldEZpZWxkRXhwaXJlKFIsIGkpLCB5Ll9zZXRGaWVsZChSLCBzKSksIHMgfHwgKHMgPSAnJyksIHkuX2NhbGxBbGxDYWxsYmFja3MoUiwgW3NdKSwgIW4uZXJyb3JfbXNnICYmIHkuX25ld0N1c3RvbWVySURzSGFzaCAmJiB5Ll9zZXRGaWVsZCgnTUNDSURIJywgeS5fbmV3Q3VzdG9tZXJJRHNIYXNoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPT09IEwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB5Ll9nZXRGaWVsZChOKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyAmJiAheS5vdmVyd3JpdGVDcm9zc0RvbWFpbk1DSURBbmRBSUQgfHwgKChvID0geS5fZmluZFZpc2l0b3JJRChuKSkgPyBvICE9PSBGICYmIHkuX3NldEZpZWxkRXhwaXJlKFIsIC0xKSA6IG8gPSBGLCB5Ll9zZXRGaWVsZChOLCBvKSksIG8gJiYgbyAhPT0gRiB8fCAobyA9ICcnKSwgeS5fY2FsbEFsbENhbGxiYWNrcyhOLCBbb10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoeS5pZFN5bmNEaXNhYmxlU3luY3MgfHwgeS5kaXNhYmxlSWRTeW5jcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmUuaWRDYWxsTm90UHJvY2Vzc3NlZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZS5pZENhbGxOb3RQcm9jZXNzc2VkID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMuaWJzID0gbi5pYnMsIGMuc3ViZG9tYWluID0gbi5zdWJkb21haW4sIG5lLnByb2Nlc3NJRENhbGxEYXRhKGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiA9PT0gT2JqZWN0KG4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsLCB1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkKCkgJiYgeS5pc0FsbG93ZWQoKSAmJiAobCA9IHkuX2dldEZpZWxkKCdNQ09QVE9VVCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBULnBhcnNlT3B0T3V0KG4sIGwsIEYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsID0gcC5vcHRPdXQsIHUgPSBwLmRfb3R0bCwgeS5fc2V0RmllbGRFeHBpcmUoJ01DT1BUT1VUJywgdSwgITApLCB5Ll9zZXRGaWVsZCgnTUNPUFRPVVQnLCBsKSwgeS5fY2FsbEFsbENhbGxiYWNrcygnTUNPUFRPVVQnLCBbbF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2xvYWRpbmcgPSBudWxsLCB5Ll9nZXRSZW1vdGVGaWVsZCA9IGZ1bmN0aW9uIChlLCB0LCBuLCBhLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIsIHMgPSAnJywgbyA9IHRlLmlzRmlyc3RQYXJ0eUFuYWx5dGljc1Zpc2l0b3JJRENhbGwoZSksIGMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQ0FBTUxIOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DQUFNQjogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCgpICYmIHkuaXNBbGxvd2VkKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh5Ll9yZWFkVmlzaXRvcigpLCAhKCEocyA9IHkuX2dldEZpZWxkKGUsICEwID09PSBjW2VdKSkgfHwgeS5fZmllbGRzRXhwaXJlZCAmJiB5Ll9maWVsZHNFeHBpcmVkW2VdKSB8fCB5LmRpc2FibGVUaGlyZFBhcnR5Q2FsbHMgJiYgIW8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzIHx8IChlID09PSBPID8gKHkuX3JlZ2lzdGVyQ2FsbGJhY2soZSwgbiksIHMgPSB5Ll9nZW5lcmF0ZUxvY2FsTUlEKCksIHkuc2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQocykpIDogZSA9PT0gTiA/ICh5Ll9yZWdpc3RlckNhbGxiYWNrKGUsIG4pLCBzID0gJycsIHkuc2V0QW5hbHl0aWNzVmlzaXRvcklEKHMpKSA6IChzID0gJycsIGEgPSAhMCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChlID09PSBPIHx8ICdNQ09QVE9VVCcgPT09IGUgPyByID0gRSA6ICdNQ0FBTUxIJyA9PT0gZSB8fCBlID09PSBSID8gciA9IHggOiBlID09PSBOICYmIChyID0gTCksIHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIXQgfHwgbnVsbCAhPSB5Ll9sb2FkaW5nICYmIHkuX2xvYWRpbmdbcl0gfHwgKG51bGwgPT0geS5fbG9hZGluZyAmJiAoeS5fbG9hZGluZyA9IHt9KSwgeS5fbG9hZGluZ1tyXSA9ICEwLCByID09PSB4ICYmIChDID0gMCksIHkuX2xvYWREYXRhKHIsIHQsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5Ll9nZXRGaWVsZChlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmIGllLnNldFN0YXRlKHIsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9PT0gTyA/IG4gPSB5Ll9nZW5lcmF0ZUxvY2FsTUlEKCkgOiByID09PSB4ICYmIChuID0geyBlcnJvcl9tc2c6ICd0aW1lb3V0JyB9KSwgeS5fc2V0RmllbGRzKHIsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkpKSwgeS5fcmVnaXN0ZXJDYWxsYmFjayhlLCBuKSwgcyB8fCAodCB8fCB5Ll9zZXRGaWVsZHMociwgeyBpZDogRiB9KSwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICE9PSBPICYmIGUgIT09IE4gfHwgcyAhPT0gRiB8fCAocyA9ICcnLCBhID0gITApLCBuICYmIGEgJiYgeS5fY2FsbENhbGxiYWNrKG4sIFtzXSksIGUgPT09IE8gJiYgZWUuc3Vic2NyaWJlZCAmJiAoZWUuY2FsbGJhY2tzICYmIGVlLmNhbGxiYWNrcy5sZW5ndGggJiYgZWUuY2FsbGJhY2tzLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fY2FsbENhbGxiYWNrKGUsIFtzXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGVlLnN1YnNjcmliZWQgPSAhMSwgZWUuY2FsbGJhY2tzLmxlbmd0aCA9IDApLCBzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fc2V0TWFya2V0aW5nQ2xvdWRGaWVsZHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX3JlYWRWaXNpdG9yKCksIHkuX3NldEZpZWxkcyhFLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX21hcEN1c3RvbWVySURzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmdldEF1ZGllbmNlTWFuYWdlckJsb2IoZSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fc2V0QW5hbHl0aWNzRmllbGRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9yZWFkVmlzaXRvcigpLCB5Ll9zZXRGaWVsZHMoTCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Ll9zZXRBdWRpZW5jZU1hbmFnZXJGaWVsZHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX3JlYWRWaXNpdG9yKCksIHkuX3NldEZpZWxkcyh4LCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuX2dldEF1ZGllbmNlTWFuYWdlclVSTERhdGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0geS5hdWRpZW5jZU1hbmFnZXJTZXJ2ZXIsIG4gPSAnJywgYSA9IHkuX2dldEZpZWxkKE8pLCBpID0geS5fZ2V0RmllbGQoUiwgITApLCByID0geS5fZ2V0RmllbGQoTiksIHMgPSByICYmIHIgIT09IEYgPyAnJmRfY2lkX2ljPUFWSUQlMDEnICsgZW5jb2RlVVJJQ29tcG9uZW50KHIpIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkubG9hZFNTTCAmJiB5LmF1ZGllbmNlTWFuYWdlclNlcnZlclNlY3VyZSAmJiAodCA9IHkuYXVkaWVuY2VNYW5hZ2VyU2VydmVyU2VjdXJlKSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbywgYywgbCwgdSA9IHkuZ2V0Q3VzdG9tZXJJRHMoITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYyBpbiB1KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB1W2NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVC5pc09iamVjdEVtcHR5KGQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwID0gJ25hbWVTcGFjZXMnID09PSBjID8gJyZkX2NpZF9ucz0nIDogJyZkX2NpZF9pYz0nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG8gaW4gZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEIobykgJiYgKGwgPSBkW29dLCBzICs9IHAgKyBlbmNvZGVVUklDb21wb25lbnQobykgKyAnJTAxJyArIGVuY29kZVVSSUNvbXBvbmVudChsLmlkID8gbC5pZCA6ICcnKSArIChsLmF1dGhTdGF0ZSA/ICclMDEnICsgbC5hdXRoU3RhdGUgOiAnJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSB8fCAoZSA9ICdfc2V0QXVkaWVuY2VNYW5hZ2VyRmllbGRzJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gJ2h0dHAnICsgKHkubG9hZFNTTCA/ICdzJyA6ICcnKSArICc6Ly8nICsgdCArICcvaWQnLCBtID0gJ2RfdmlzaWRfdmVyPScgKyB5LnZlcnNpb24gKyAoUyAmJiAtMSAhPT0gZi5pbmRleE9mKCdkZW1kZXgubmV0JykgPyAnJmdkcHI9MSZnZHByX2NvbnNlbnQ9JyArIFMgOiAnJykgKyAoQyAmJiAtMSAhPT0gZi5pbmRleE9mKCdkZW1kZXgubmV0JykgPyAnJmRfY2Y9JyArIEMgOiAnJykgKyAnJmRfcnRiZD1qc29uJmRfdmVyPTInICsgKCFhICYmIHkuX3VzZTFzdFBhcnR5TWFya2V0aW5nQ2xvdWRTZXJ2ZXIgPyAnJmRfdmVyaWZ5PTEnIDogJycpICsgJyZkX29yZ2lkPScgKyBlbmNvZGVVUklDb21wb25lbnQoeS5tYXJrZXRpbmdDbG91ZE9yZ0lEKSArICcmZF9uc2lkPScgKyAoeS5pZFN5bmNDb250YWluZXJJRCB8fCAwKSArIChhID8gJyZkX21pZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KGEpIDogJycpICsgKHkuaWRTeW5jRGlzYWJsZTNyZFBhcnR5U3luY2luZyB8fCB5LmRpc2FibGVUaGlyZFBhcnR5Q29va2llcyA/ICcmZF9jb3BwYT10cnVlJyA6ICcnKSArICghMCA9PT0gSSA/ICcmZF9jb29wX3NhZmU9MScgOiAhMSA9PT0gSSA/ICcmZF9jb29wX3Vuc2FmZT0xJyA6ICcnKSArIChpID8gJyZkX2Jsb2I9JyArIGVuY29kZVVSSUNvbXBvbmVudChpKSA6ICcnKSArIHMsIGcgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3NfY19pbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5faW4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbiA9IGYgKyAnPycgKyBtICsgJyZkX2NiPXNfY19pbCU1QicgKyB5Ll9pbiArICclNUQuJyArIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JzVXJsOiBmICsgJz8nICsgbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7IHVybDogbiB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5hcHBlbmRWaXNpdG9ySURzVG8gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE8sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fZ2V0RmllbGQoTykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9nZXRGaWVsZChOKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTUNPUkdJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5tYXJrZXRpbmdDbG91ZE9yZ0lECiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5Ll9hZGRRdWVyeXN0cmluZ1BhcmFtKGUsICQuQURPQkVfTUMsIGModCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5hcHBlbmRTdXBwbGVtZW50YWxEYXRhSURUbyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodCA9IHQgfHwgeS5nZXRTdXBwbGVtZW50YWxEYXRhSUQodGUuZ2VuZXJhdGVSYW5kb21TdHJpbmcoKSwgITApKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBjKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnU0RJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnTUNPUkdJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5tYXJrZXRpbmdDbG91ZE9yZ0lECiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5fYWRkUXVlcnlzdHJpbmdQYXJhbShlLCAkLkFET0JFX01DX1NESUQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZUhhc2g6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5pbmRleE9mKCcjJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID4gMCA/IGUuc3Vic3RyKHQpIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNobGVzc1VybDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmluZGV4T2YoJyMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPiAwID8gZS5zdWJzdHIoMCwgdCkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkUXVlcnlQYXJhbUF0TG9jYXRpb246IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5zcGxpdCgnJicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiA9IG51bGwgIT0gbiA/IG4gOiBhLmxlbmd0aCwgYS5zcGxpY2UobiwgMCwgdCksIGEuam9pbignJicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNGaXJzdFBhcnR5QW5hbHl0aWNzVmlzaXRvcklEQ2FsbDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPT09IE4gJiYgKHQgfHwgKHQgPSB5LnRyYWNraW5nU2VydmVyKSwgbiB8fCAobiA9IHkudHJhY2tpbmdTZXJ2ZXJTZWN1cmUpLCAhKCdzdHJpbmcnICE9IHR5cGVvZiAoYSA9IHkubG9hZFNTTCA/IG4gOiB0KSB8fCAhYS5sZW5ndGgpICYmIGEuaW5kZXhPZignMm83Lm5ldCcpIDwgMCAmJiBhLmluZGV4T2YoJ29tdHJkYy5uZXQnKSA8IDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzT2JqZWN0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gQm9vbGVhbihlICYmIGUgPT09IE9iamVjdChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVDb29raWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHoucmVtb3ZlKGUsIHsgZG9tYWluOiB5LmNvb2tpZURvbWFpbiB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzVHJhY2tpbmdTZXJ2ZXJQb3B1bGF0ZWQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEheS50cmFja2luZ1NlcnZlciB8fCAhIXkudHJhY2tpbmdTZXJ2ZXJTZWN1cmU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRUaW1lc3RhbXBJblNlY29uZHM6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgucm91bmQobmV3IERhdGUoKS5nZXRUaW1lKCkgLyAxMDAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlUGlwZURlbGltZXRlZEtleVZhbHVlczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3BsaXQoJ3wnKS5yZWR1Y2UoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5zcGxpdCgnPScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbblswXV0gPSBkZWNvZGVVUklDb21wb25lbnQoblsxXSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdlbmVyYXRlUmFuZG9tU3RyaW5nOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZSB8fCA1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gJycsIG4gPSAnYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5JzsgZS0tOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gbltNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBuLmxlbmd0aCldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vcm1hbGl6ZUJvb2xlYW46IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndHJ1ZScgPT09IGUgfHwgJ2ZhbHNlJyAhPT0gZSAmJiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VCb29sZWFuOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RydWUnID09PSBlIHx8ICdmYWxzZScgIT09IGUgJiYgbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcGxhY2VNZXRob2RzV2l0aEZ1bmN0aW9uOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmhhc093blByb3BlcnR5KG4pICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGVbbl0gJiYgKGVbbl0gPSB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHkuX2hlbHBlcnMgPSB0ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuZSA9IEsoeSwgRCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5Ll9kZXN0aW5hdGlvblB1Ymxpc2hpbmcgPSBuZSwgeS50aW1lb3V0TWV0cmljc0xvZyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGFlLCBpZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNDbGllbnRTaWRlTWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1DSURDYWxsVGltZWRPdXQ6IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFuYWx5dGljc0lEQ2FsbFRpbWVkT3V0OiBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBQU1JRENhbGxUaW1lZE91dDogbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmllbGRHcm91cE9iajoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFN0YXRlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgITEgPT09IHQgPyAhMCAhPT0gdGhpcy5NQ0lEQ2FsbFRpbWVkT3V0ICYmICh0aGlzLk1DSURDYWxsVGltZWRPdXQgPSAhMSkgOiB0aGlzLk1DSURDYWxsVGltZWRPdXQgPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBMOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICExID09PSB0ID8gITAgIT09IHRoaXMuQW5hbHl0aWNzSURDYWxsVGltZWRPdXQgJiYgKHRoaXMuQW5hbHl0aWNzSURDYWxsVGltZWRPdXQgPSAhMSkgOiB0aGlzLkFuYWx5dGljc0lEQ2FsbFRpbWVkT3V0ID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgeDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhMSA9PT0gdCA/ICEwICE9PSB0aGlzLkFBTUlEQ2FsbFRpbWVkT3V0ICYmICh0aGlzLkFBTUlEQ2FsbFRpbWVkT3V0ID0gITEpIDogdGhpcy5BQU1JRENhbGxUaW1lZE91dCA9IHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5pc0NsaWVudFNpZGVNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaWUuaXNDbGllbnRTaWRlTWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5Lk1DSURDYWxsVGltZWRPdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGllLk1DSURDYWxsVGltZWRPdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5LkFuYWx5dGljc0lEQ2FsbFRpbWVkT3V0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpZS5BbmFseXRpY3NJRENhbGxUaW1lZE91dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuQUFNSURDYWxsVGltZWRPdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGllLkFBTUlEQ2FsbFRpbWVkT3V0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5pZFN5bmNHZXRPblBhZ2VTeW5jSW5mbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5fcmVhZFZpc2l0b3IoKSwgeS5fZ2V0RmllbGQoJ01DU1lOQ1NPUCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5pZFN5bmNCeVVSTCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5LmlzT3B0ZWRPdXQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGwoZSB8fCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmVycm9yKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZXJyb3I7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuLCBhLCBpID0gZS51cmwsIHIgPSBlbmNvZGVVUklDb21wb25lbnQsIHMgPSBuZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkgPSBpLnJlcGxhY2UoL15odHRwczovLCAnJykucmVwbGFjZSgvXmh0dHA6LywgJycpLCBuID0gVC5lbmNvZGVBbmRCdWlsZFJlcXVlc3QoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmRwaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmRwdXVpZCB8fCAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCAnLCcpLCBhID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2licycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByKGUuZHBpZCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnaW1nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIoaSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnR0bCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBzLmFkZE1lc3NhZ2UoYS5qb2luKCd8JykpLCBzLnJlcXVlc3RUb1Byb2Nlc3MoKSwgJ1N1Y2Nlc3NmdWxseSBxdWV1ZWQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuaWRTeW5jQnlEYXRhU291cmNlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXkuaXNPcHRlZE91dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9PT0gT2JqZWN0KGUpICYmICdzdHJpbmcnID09IHR5cGVvZiBlLmRwdXVpZCAmJiBlLmRwdXVpZC5sZW5ndGggPyAoZS51cmwgPSAnLy9kcG0uZGVtZGV4Lm5ldC9pYnM6ZHBpZD0nICsgZS5kcGlkICsgJyZkcHV1aWQ9JyArIGUuZHB1dWlkLCB5LmlkU3luY0J5VVJMKGUpKSA6ICdFcnJvcjogY29uZmlnIG9yIGNvbmZpZy5kcHV1aWQgaXMgZW1wdHknOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgTWUoeSwgbmUpLCB5Ll9nZXRDb29raWVWZXJzaW9uID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZSB8fCB5LmNvb2tpZVJlYWQoeS5jb29raWVOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICQuVkVSU0lPTl9SRUdFWC5leGVjKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIHQubGVuZ3RoID4gMSA/IHRbMV0gOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgeS5fcmVzZXRBbWN2Q29va2llID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHkuX2dldENvb2tpZVZlcnNpb24oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICYmICFKLmlzTGVzc1RoYW4odCwgZSkgfHwgeS5yZW1vdmVDb29raWUoeS5jb29raWVOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkuc2V0QXNDb29wU2FmZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB5LnNldEFzQ29vcFVuc2FmZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkuY29uZmlncyA9IE9iamVjdC5jcmVhdGUobnVsbCksIHRlLmlzT2JqZWN0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCKGUpICYmICh5W2VdID0gbltlXSwgeS5jb25maWdzW2VdID0gbltlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIHAoKSwgeS5pbml0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHUoKSAmJiAoXy5vcHRJbi5mZXRjaFBlcm1pc3Npb25zKGIsICEwKSwgIV8ub3B0SW4uaXNBcHByb3ZlZChfLm9wdEluLkNhdGVnb3JpZXMuRUNJRCkpIHx8IGFlIHx8IChhZSA9ICEwLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ZS5pc09iamVjdChuKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5pZFN5bmNDb250YWluZXJJRCA9IHkuaWRTeW5jQ29udGFpbmVySUQgfHwgMCwgSSA9ICdib29sZWFuJyA9PSB0eXBlb2YgeS5pc0Nvb3BTYWZlID8geS5pc0Nvb3BTYWZlIDogdGUucGFyc2VCb29sZWFuKHkuaXNDb29wU2FmZSksIHkucmVzZXRCZWZvcmVWZXJzaW9uICYmIHkuX3Jlc2V0QW1jdkNvb2tpZSh5LnJlc2V0QmVmb3JlVmVyc2lvbiksIHkuX2F0dGVtcHRUb1BvcHVsYXRlSWRzRnJvbVVybCgpLCB5Ll9hdHRlbXB0VG9Qb3B1bGF0ZVNkaWRGcm9tVXJsKCksIHkuX3JlYWRWaXNpdG9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHkuX2dldEZpZWxkKEEpLCB0ID0gTWF0aC5jZWlsKG5ldyBEYXRlKCkuZ2V0VGltZSgpIC8gJC5NSUxMSVNfUEVSX0RBWSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmlkU3luY0Rpc2FibGVTeW5jcyB8fCB5LmRpc2FibGVJZFN5bmNzIHx8ICFuZS5jYW5NYWtlU3luY0lEQ2FsbChlLCB0KSB8fCAoeS5fc2V0RmllbGRFeHBpcmUoUiwgLTEpLCB5Ll9zZXRGaWVsZChBLCB0KSksIHkuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoKSwgeS5nZXRBdWRpZW5jZU1hbmFnZXJMb2NhdGlvbkhpbnQoKSwgeS5nZXRBdWRpZW5jZU1hbmFnZXJCbG9iKCksIHkuX21lcmdlU2VydmVyU3RhdGUoeS5zZXJ2ZXJTdGF0ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5fYXR0ZW1wdFRvUG9wdWxhdGVJZHNGcm9tVXJsKCksIHkuX2F0dGVtcHRUb1BvcHVsYXRlU2RpZEZyb21VcmwoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCksIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF5LmlkU3luY0Rpc2FibGVTeW5jcyAmJiAheS5kaXNhYmxlSWRTeW5jcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmUuY2hlY2tEUElmcmFtZVNyYygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnJlYWR5VG9BdHRhY2hJZnJhbWUoKSAmJiBlLmF0dGFjaElmcmFtZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcuYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBELndpbmRvd0xvYWRlZCA9ICEwLCBlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRy5yZWNlaXZlTWVzc2FnZShmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZS5yZWNlaXZlTWVzc2FnZShlLmRhdGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG5lLmlmcmFtZUhvc3QpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpLCB5LndoaXRlbGlzdElmcmFtZURvbWFpbnMgJiYgJC5QT1NUX01FU1NBR0VfRU5BQkxFRCAmJiAoeS53aGl0ZWxpc3RJZnJhbWVEb21haW5zID0geS53aGl0ZWxpc3RJZnJhbWVEb21haW5zIGluc3RhbmNlb2YgQXJyYXkgPyB5LndoaXRlbGlzdElmcmFtZURvbWFpbnMgOiBbeS53aGl0ZWxpc3RJZnJhbWVEb21haW5zXSwgeS53aGl0ZWxpc3RJZnJhbWVEb21haW5zLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBuZXcgTSh0LCBlKSwgYSA9IFUoeSwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEcucmVjZWl2ZU1lc3NhZ2UoYSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZlLmNvbmZpZyA9IFosIGguVmlzaXRvciA9IEZlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgQmUgPSBGZSwgVWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChULmlzT2JqZWN0KGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmtleXMoZSkuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJycgIT09IGVbdF0gJiYgWi5nZXRDb25maWdzKClbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnJlZHVjZShmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBaLm5vcm1hbGl6ZUNvbmZpZyhuLCBlW25dKSwgaSA9IFQubm9ybWFsaXplQm9vbGVhbihhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0W25dID0gaSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgT2JqZWN0LmNyZWF0ZShudWxsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBIZSA9IEFlLk9wdEluLCB6ZSA9IEFlLklhYlBsdWdpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQmUuZ2V0SW5zdGFuY2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignVmlzaXRvciByZXF1aXJlcyBBZG9iZSBNYXJrZXRpbmcgQ2xvdWQgT3JnIElELicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5pbmRleE9mKCdAJykgPCAwICYmIChlICs9ICdAQWRvYmVPcmcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gaC5zX2NfaWw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgdC5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0W25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEgJiYgJ1Zpc2l0b3InID09PSBhLl9jICYmIGEubWFya2V0aW5nQ2xvdWRPcmdJRCA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFVlKHQpIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5hZG9iZS5vcHRJbiA9IGguYWRvYmUub3B0SW4gfHwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFQucGx1Y2soZSwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdkb2VzT3B0SW5BcHBseScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ByZXZpb3VzUGVybWlzc2lvbnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcmVPcHRJbkFwcHJvdmFscycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2lzT3B0SW5TdG9yYWdlRW5hYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ29wdEluU3RvcmFnZUV4cGlyeScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2lzSWFiQ29udGV4dCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBuID0gZS5vcHRJbkNvb2tpZURvbWFpbiB8fCBlLmNvb2tpZURvbWFpbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IChuID0gbiB8fCBXKCkpID09PSB3aW5kb3cubG9jYXRpb24uaG9zdG5hbWUgPyAnJyA6IG4sIHQub3B0SW5Db29raWVEb21haW4gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG5ldyBIZSh0LCB7IGNvb2tpZXM6IHogfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LmlzSWFiQ29udGV4dCAmJiB0LmRvZXNPcHRJbkFwcGx5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG5ldyB6ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5yZWdpc3RlclBsdWdpbihpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGEgfHwge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLnNwbGl0KCcnKS5yZXZlcnNlKCkuam9pbignJyksIHIgPSBuZXcgQmUoZSwgbnVsbCwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmNvb2tpZURvbWFpbiAmJiAoci5jb29raWVEb21haW4gPSBhLmNvb2tpZURvbWFpbiksIGEuc2FtZVNpdGVDb29raWUgJiYgYS5zZWN1cmVDb29raWUgJiYgKHIuY29uZmlncyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYW1lU2l0ZUNvb2tpZTogYS5zYW1lU2l0ZUNvb2tpZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWN1cmVDb29raWU6IGEuc2VjdXJlQ29va2llCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaC5zX2NfaWwuc3BsaWNlKC0taC5zX2NfaW4sIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBULmdldEllVmVyc2lvbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdudW1iZXInID09IHR5cGVvZiBzICYmIHMgPCAxMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5faGVscGVycy5yZXBsYWNlTWV0aG9kc1dpdGhGdW5jdGlvbihyLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaC5zZWxmICE9PSBoLnBhcmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KCkgJiYgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY29va2llV3JpdGUoJ1RFU1RfQU1DVl9DT09LSUUnLCAnVCcsIDEpLCAnVCcgPT09IGUuY29va2llUmVhZCgnVEVTVF9BTUNWX0NPT0tJRScpICYmIChlLnJlbW92ZUNvb2tpZSgnVEVTVF9BTUNWX0NPT0tJRScpLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHIpICYmIGgucGFyZW50ID8gbmV3IE4oZSwgYSwgciwgaC5wYXJlbnQpIDogbmV3IEJlKGUsIGEsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIgPSBudWxsLCBvLmluaXQoKSwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCZS53aW5kb3dMb2FkZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGguYWRkRXZlbnRMaXN0ZW5lciA/IGguYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsIGUpIDogaC5hdHRhY2hFdmVudCAmJiBoLmF0dGFjaEV2ZW50KCdvbmxvYWQnLCBlKSwgQmUuY29kZUxvYWRFbmQgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKSwgVmlzaXRvcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1tY2lkL3NyYy92aWV3L3V0aWxzL3RpbWVVbml0cy5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSG91cnM6IDM2MDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERheXM6IDg2NDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXZWVrczogNjA0ODAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNb250aHM6IDI1OTIwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFllYXJzOiAzMTUzNjAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzJzogewogICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQWRvYmUgQW5hbHl0aWNzJywKICAgICAgICAgICAgICAgICAgICBob3N0ZWRMaWJGaWxlc0Jhc2VVcmw6ICdodHRwczovL2Fzc2V0cy5hZG9iZWR0bS5jb20vZXh0ZW5zaW9ucy9FUGJkZTJmN2NhMTRlNTQwMzk5ZGNjMWY4MjA4ODYwYjdiLycsCiAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgb3JnSWQ6ICdDQ0JDODc5RDU1NzIwNzBFN0YwMDAxMDFAQWRvYmVPcmcnLAogICAgICAgICAgICAgICAgICAgICAgICBsaWJyYXJ5Q29kZTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ21hbmFnZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYWNjb3VudHM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFnaW5nOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhbWF6b25ocmpvYnNnYW1tYScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhbWF6b25ocmFtYXpvbmh1Yi1pbnRlZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhbWF6b25ocmFtYXpvbmh1YicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2R1Y3Rpb246IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FtYXpvbmhycHJvZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhbWF6b25ocmFtYXpvbmh1Yi1pbnRlZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhbWF6b25ocmFtYXpvbmh1YicKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRldmVsb3BtZW50OiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdhbWF6b25ocmpvYnNiZXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FtYXpvbmhyYW1hem9uaHViLWludGVnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FtYXpvbmhyYW1hem9uaHViJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FtYXpvbmhyZGV2JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZVRyYWNrZXJHbG9iYWxseTogITEKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VOYW1lOiAnJWNvbnRlbnQ6UGFnZU5hbWUlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbmN5Q29kZTogJ1VTRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2luZ1NlcnZlcjogJ2FtYXpvbmhyLnNjLm9tdHJkYy5uZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tJbmxpbmVTdGF0czogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja0Rvd25sb2FkTGlua3M6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tFeHRlcm5hbExpbmtzOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtJbnRlcm5hbEZpbHRlcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZmFjZWJvb2suY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbGlua2VkaW4uY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndHdpdHRlci5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdqb2JzLWJldGEuaW50ZWcuYW1hem9uLmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FtYXpvbi5qb2JzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYWNjb3VudC5hbWF6b24uam9icycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2luZ1NlcnZlclNlY3VyZTogJ2FtYXpvbmhyLnNjLm9tdHJkYy5uZXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua0Rvd25sb2FkRmlsZVR5cGVzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RvYycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RvY3gnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdlcHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdqcGcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd4bHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcHQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdwcHR4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGRmJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAneGxzeCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RhYicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NzdicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ppcCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3R4dCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3ZzZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Z4ZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3htbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2pzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnY3NzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmFyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZXhlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd21hJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbW92JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYXZpJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd212JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbXAzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnd2F2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbTR2JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBtb2R1bGVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnc2VuZC1iZWFjb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdTZW5kIEJlYWNvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbignLi4vc2hhcmVkTW9kdWxlcy9nZXRUcmFja2VyJyksIHIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5ub2RlTmFtZSAmJiAnYScgPT09IGUubm9kZU5hbWUudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcihlKSA/IGUuaW5uZXJIVE1MIDogJ2xpbmsgY2xpY2tlZCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8gPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdwYWdlJyA9PT0gdC50eXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubG9nZ2VyLmluZm8oJ0ZpcmluZyBwYWdlIHZpZXcgYmVhY29uLicpLCBlLnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogdC5saW5rVHlwZSB8fCAnbycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiB0LmxpbmtOYW1lIHx8IHMobikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubG9nZ2VyLmluZm8oJ0ZpcmluZyBsaW5rIHRyYWNrIGJlYWNvbiB1c2luZyB0aGUgdmFsdWVzOiAnICsgSlNPTi5zdHJpbmdpZnkoaSkgKyAnLicpLCBlLnRsKHIobikgPyBuIDogJ3RydWUnLCBpLmxpbmtUeXBlLCBpLmxpbmtOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSgpLnRoZW4oZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8obiwgZSwgdC5lbGVtZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubG9nZ2VyLmVycm9yKCdDYW5ub3Qgc2VuZCBiZWFjb246ICcgKyBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY2xlYXItdmFyaWFibGVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lOiAnQ2xlYXIgVmFyaWFibGVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBuKCcuLi9zaGFyZWRNb2R1bGVzL2dldFRyYWNrZXInKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpKCkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jbGVhclZhcnMgJiYgKGEubG9nZ2VyLmluZm8oJ0NsZWFyIHZhcmlhYmxlcy4nKSwgZS5jbGVhclZhcnMoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmxvZ2dlci5lcnJvcignQ2Fubm90IGNsZWFyIHZhcmlhYmxlczogJyArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnc2V0LXZhcmlhYmxlcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ1NldCBWYXJpYWJsZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4oJy4uL3NoYXJlZE1vZHVsZXMvZ2V0VHJhY2tlcicpLCByID0gbignLi4vaGVscGVycy9hcHBseVRyYWNrZXJWYXJpYWJsZXMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSgpLnRoZW4oZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubG9nZ2VyLmluZm8oJ1NldCB2YXJpYWJsZXMgb24gdGhlIHRyYWNrZXIuJyksIHIobiwgZS50cmFja2VyUHJvcGVydGllcyksIGUuY3VzdG9tU2V0dXAgJiYgZS5jdXN0b21TZXR1cC5zb3VyY2UgJiYgZS5jdXN0b21TZXR1cC5zb3VyY2UuY2FsbCh0LmVsZW1lbnQsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5sb2dnZXIuZXJyb3IoJ0Nhbm5vdCBzZXQgdmFyaWFibGVzOiAnICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9zaGFyZWRNb2R1bGVzL2dldFRyYWNrZXIuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpLCByID0gbignQGFkb2JlL3JlYWN0b3ItY29va2llJyksIHMgPSBuKCdAYWRvYmUvcmVhY3Rvci1wcm9taXNlJyksIG8gPSBuKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgYyA9IG4oJy4uL2hlbHBlcnMvc2V0dGluZ3NIZWxwZXInKSwgbCA9IG4oJy4uL2hlbHBlcnMvYXVnbWVudGVycycpLCB1ID0gbignLi4vaGVscGVycy9hcHBseVRyYWNrZXJWYXJpYWJsZXMnKSwgZCA9IG4oJy4uL2hlbHBlcnMvbG9hZExpYnJhcnknKSwgcCA9IG4oJy4uL2hlbHBlcnMvZ2VuZXJhdGVWZXJzaW9uJykoYS5idWlsZEluZm8udHVyYmluZUJ1aWxkRGF0ZSksIGYgPSAnYmVmb3JlU2V0dGluZ3MnLCBtID0gYS5nZXRTaGFyZWRNb2R1bGUoJ2Fkb2JlLW1jaWQnLCAnbWNpZC1pbnN0YW5jZScpLCBnID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhZSB8fCAndHJ1ZScgPT09IHIuZ2V0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBiID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzLmFsbChsLm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMucmVzb2x2ZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB2ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtICYmIChhLmxvZ2dlci5pbmZvKCdTZXR0aW5nIE1DSUQgaW5zdGFuY2Ugb24gdGhlIHRyYWNrZXIuJyksIGUudmlzaXRvciA9IG0pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBoID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmxvZ2dlci5pbmZvKCdTZXR0aW5nIHZlcnNpb24gb24gdHJhY2tlcjogIicgKyBwICsgJyIuJyksIHZvaWQgMCAhPT0gZS50YWdDb250YWluZXJNYXJrZXIgPyBlLnRhZ0NvbnRhaW5lck1hcmtlciA9IHAgOiAnc3RyaW5nJyA9PSB0eXBlb2YgZS52ZXJzaW9uICYmIGUudmVyc2lvbi5zdWJzdHJpbmcoZS52ZXJzaW9uLmxlbmd0aCAtIDUpICE9PSAnLScgKyBwICYmIChlLnZlcnNpb24gKz0gJy0nICsgcCksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHkgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQubG9hZFBoYXNlID09PSBmICYmIHQuc291cmNlICYmIChhLmxvZ2dlci5pbmZvKCdDYWxsaW5nIGN1c3RvbSBzY3JpcHQgYmVmb3JlIHNldHRpbmdzLicpLCB0LnNvdXJjZS5jYWxsKG8sIG4pKSwgdShuLCBlIHx8IHt9KSwgdC5sb2FkUGhhc2UgIT09IGYgJiYgdC5zb3VyY2UgJiYgKGEubG9nZ2VyLmluZm8oJ0NhbGxpbmcgY3VzdG9tIHNjcmlwdCBhZnRlciBzZXR0aW5ncy4nKSwgdC5zb3VyY2UuY2FsbChvLCBuKSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIF8gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuaXNBdWRpZW5jZU1hbmFnZW1lbnRFbmFibGVkKGUpICYmICh0LmxvYWRNb2R1bGUoJ0F1ZGllbmNlTWFuYWdlbWVudCcpLCBhLmxvZ2dlci5pbmZvKCdJbml0aWFsaXppbmcgQXVkaWVuY2VNYW5hZ2VtZW50IG1vZHVsZScpLCB0LkF1ZGllbmNlTWFuYWdlbWVudC5zZXR1cChlLm1vZHVsZVByb3BlcnRpZXMuYXVkaWVuY2VNYW5hZ2VyLmNvbmZpZykpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBQID0gKGkgPSBhLmdldEV4dGVuc2lvblNldHRpbmdzKCksIGcoaS50cmFja2luZ0Nvb2tpZU5hbWUpID8gZChpKS50aGVuKGIpLnRoZW4odikudGhlbihoKS50aGVuKHkuYmluZChudWxsLCBpLnRyYWNrZXJQcm9wZXJ0aWVzLCBpLmN1c3RvbVNldHVwIHx8IHt9KSkudGhlbihfLmJpbmQobnVsbCwgaSkpIDogcy5yZWplY3QoJ0VVIGNvbXBsaWFuY2Ugd2FzIG5vdCBhY2tub3dsZWRnZWQgYnkgdGhlIHVzZXIuJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZ2V0LXRyYWNrZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvc2hhcmVkTW9kdWxlcy9hdWdtZW50VHJhY2tlci5qcyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdhdWdtZW50LXRyYWNrZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVkOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjcmlwdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuKCcuLi9oZWxwZXJzL2F1Z21lbnRlcnMnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2hlbHBlcnMvc2V0dGluZ3NIZWxwZXIuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbignQGFkb2JlL3JlYWN0b3Itd2luZG93JyksIHIgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMSUJfVFlQRVM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQU5BR0VEOiAnbWFuYWdlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUFJFSU5TVEFMTEVEOiAncHJlaW5zdGFsbGVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRU1PVEU6ICdyZW1vdGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENVU1RPTTogJ2N1c3RvbScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQU5BR0VEX0xJQl9QQVRIUzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFQUF9NRUFTVVJFTUVOVDogJ0FwcE1lYXN1cmVtZW50LmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBQ1RJVklUWV9NQVA6ICdBcHBNZWFzdXJlbWVudF9Nb2R1bGVfQWN0aXZpdHlNYXAuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFVRElFTkNFX01BTkFHRU1FTlQ6ICdBcHBNZWFzdXJlbWVudF9Nb2R1bGVfQXVkaWVuY2VNYW5hZ2VtZW50LmpzJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFJlcG9ydFN1aXRlczogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGUucHJvZHVjdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVthLmJ1aWxkSW5mby5lbnZpcm9ubWVudF0gJiYgKHQgPSBlW2EuYnVpbGRJbmZvLmVudmlyb25tZW50XSksIHQuam9pbignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQWN0aXZpdHlNYXBFbmFibGVkOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKGUubGlicmFyeUNvZGUgJiYgIWUubGlicmFyeUNvZGUudXNlQWN0aXZpdHlNYXAgJiYgITEgPT09IGUubGlicmFyeUNvZGUudXNlQWN0aXZpdHlNYXApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQXVkaWVuY2VNYW5hZ2VtZW50RW5hYmxlZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIGUubW9kdWxlUHJvcGVydGllcyAmJiBlLm1vZHVsZVByb3BlcnRpZXMuYXVkaWVuY2VNYW5hZ2VyICYmIGUubW9kdWxlUHJvcGVydGllcy5hdWRpZW5jZU1hbmFnZXIuY29uZmlnICYmIGkgJiYgaS5fc2F0ZWxsaXRlICYmIGkuX3NhdGVsbGl0ZS5jb21wYW55ICYmIGkuX3NhdGVsbGl0ZS5jb21wYW55Lm9yZ0lkICYmICh0ID0gITApLCB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IHI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9oZWxwZXJzL2F1Z21lbnRlcnMuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZXhwb3J0cyA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvaGVscGVycy9hcHBseVRyYWNrZXJWYXJpYWJsZXMuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHQ6IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbignQGFkb2JlL3JlYWN0b3ItcXVlcnktc3RyaW5nJyksIHIgPSBuKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgcyA9IC9lVmFyKFswLTldKykvLCBvID0gL3Byb3AoWzAtOV0rKS8sIGMgPSBuZXcgUmVnRXhwKCdeKGVWYXJbMC05XSspfChwcm9wWzAtOV0rKXwoaGllclswLTldKyl8Y2FtcGFpZ258cHVyY2hhc2VJRHxjaGFubmVsfHNlcnZlcnxzdGF0ZXx6aXB8cGFnZVR5cGUkJyksIGwgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uaW5kZXhPZihlKSA9PT0gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IE9iamVjdC5rZXlzKHQpLmZpbHRlcihjLnRlc3QuYmluZChjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbiAmJiBhLnB1c2goJ2V2ZW50cycpLCAoYSA9IGEuY29uY2F0KChlLmxpbmtUcmFja1ZhcnMgfHwgJycpLnNwbGl0KCcsJykpKS5maWx0ZXIoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ05vbmUnICE9PSBlICYmIGUgJiYgbChlLCB0LCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJywnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUubmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChuID0gbi5jb25jYXQoKGUubGlua1RyYWNrRXZlbnRzIHx8ICcnKS5zcGxpdCgnLCcpKSkuZmlsdGVyKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdOb25lJyAhPT0gZSAmJiBsKGUsIHQsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBwID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0gPSBuW3RdLmpvaW4oJywnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZiA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4uZHluYW1pY1ZhcmlhYmxlUHJlZml4IHx8ICdEPSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuW3RdLmZvckVhY2goZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3ZhbHVlJyA9PT0gdC50eXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gdC52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBzLmV4ZWModC52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGEgKyAndicgKyBpWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gby5leGVjKHQudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciAmJiAobiA9IGEgKyAnYycgKyByWzFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3QubmFtZV0gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG0gPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rRG93bmxvYWRGaWxlVHlwZXM6IHAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rRXh0ZXJuYWxGaWx0ZXJzOiBwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua0ludGVybmFsRmlsdGVyczogcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhpZXJhcmNoaWVzOiBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5bdF0uZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3QubmFtZV0gPSB0LnNlY3Rpb25zLmpvaW4odC5kZWxpbWl0ZXIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW1wYWlnbjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3F1ZXJ5UGFyYW0nID09PSBuW3RdLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBpLnBhcnNlKHIubG9jYXRpb24uc2VhcmNoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0XSA9IGFbblt0XS52YWx1ZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0gPSBuW3RdLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG5bdF0ubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZS5uYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5pZCAmJiAodCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmlkCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uam9pbignOicpKSwgZS52YWx1ZSAmJiAodCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnZhbHVlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uam9pbignPScpKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3RdID0gYS5qb2luKCcsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQgfHwge30sIE9iamVjdC5rZXlzKHQpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbVtlXSwgaSA9IHRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID8gYShuLCBlLCB0KSA6IG5bZV0gPSBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgbi5ldmVudHMgJiYgZS5ldmVudHMgJiYgZS5ldmVudHMubGVuZ3RoID4gMCAmJiAobi5ldmVudHMgPSBlLmV2ZW50cyArICcsJyArIG4uZXZlbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSB0ICYmIHQuZXZlbnRzICYmIHQuZXZlbnRzLmxlbmd0aCA+IDAsIHIgPSB1KGUsIG4sIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByICYmIChuLmxpbmtUcmFja1ZhcnMgPSByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBkKGUsIHQuZXZlbnRzIHx8IFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyAmJiAobi5saW5rVHJhY2tFdmVudHMgPSBzKSwgYS5sb2dnZXIuaW5mbygnQXBwbHlpbmcgdGhlIGZvbGxvd2luZyBwcm9wZXJ0aWVzIG9uIHRyYWNrZXI6ICInICsgSlNPTi5zdHJpbmdpZnkobikgKyAnIi4nKSwgT2JqZWN0LmtleXMobikuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0XSA9IG5bdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9oZWxwZXJzL2xvYWRMaWJyYXJ5LmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4oJ0BhZG9iZS9yZWFjdG9yLWxvYWQtc2NyaXB0JyksIHIgPSBuKCdAYWRvYmUvcmVhY3Rvci13aW5kb3cnKSwgcyA9IG4oJ0BhZG9iZS9yZWFjdG9yLXByb21pc2UnKSwgbyA9IG4oJy4vc2V0dGluZ3NIZWxwZXInKSwgYyA9IG4oJy4vcG9sbEhlbHBlcicpLCBsID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghci5zX2dpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignVW5hYmxlIHRvIGNyZWF0ZSBBcHBNZWFzdXJlbWVudCB0cmFja2VyLCBgc19naWAgZnVuY3Rpb24gbm90IGZvdW5kLicgKyByLkFwcE1lYXN1cmVtZW50KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubG9nZ2VyLmluZm8oJ0NyZWF0aW5nIEFwcE1lYXN1cmVtZW50IHRyYWNrZXIgd2l0aCB0aGVzZSByZXBvcnQgc3VpdGVzOiAiJyArIHQgKyAnIicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSByLnNfZ2kodCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5saWJyYXJ5Q29kZS5zY29wZVRyYWNrZXJHbG9iYWxseSAmJiAoYS5sb2dnZXIuaW5mbygnU2V0dGluZyB0aGUgdHJhY2tlciBhcyB3aW5kb3cucycpLCByLnMgPSBuKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChlLmxpYnJhcnlDb2RlLnR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugby5MSUJfVFlQRVMuTUFOQUdFRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnB1c2goYS5nZXRIb3N0ZWRMaWJGaWxlVXJsKG8uTUFOQUdFRF9MSUJfUEFUSFMuQVBQX01FQVNVUkVNRU5UKSksIG8uaXNBY3Rpdml0eU1hcEVuYWJsZWQoZSkgJiYgdC5wdXNoKGEuZ2V0SG9zdGVkTGliRmlsZVVybChvLk1BTkFHRURfTElCX1BBVEhTLkFDVElWSVRZX01BUCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBvLkxJQl9UWVBFUy5DVVNUT006CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5wdXNoKGUubGlicmFyeUNvZGUuc291cmNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugby5MSUJfVFlQRVMuUkVNT1RFOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaCgnaHR0cHM6JyA9PT0gci5sb2NhdGlvbi5wcm90b2NvbCA/IGUubGlicmFyeUNvZGUuaHR0cHNVcmwgOiBlLmxpYnJhcnlDb2RlLmh0dHBVcmwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG8uaXNBdWRpZW5jZU1hbmFnZW1lbnRFbmFibGVkKGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB7IG5hbWVzcGFjZTogci5fc2F0ZWxsaXRlLmNvbXBhbnkub3JnSWQgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLm1vZHVsZVByb3BlcnRpZXMuYXVkaWVuY2VNYW5hZ2VyLmNvbmZpZy52aXNpdG9yU2VydmljZSA9IG4sIHQucHVzaChhLmdldEhvc3RlZExpYkZpbGVVcmwoby5NQU5BR0VEX0xJQl9QQVRIUy5BVURJRU5DRV9NQU5BR0VNRU5UKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5hbGwodShlKS5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5sb2dnZXIuaW5mbygnTG9hZGluZyBzY3JpcHQ6ICcgKyBlKSwgaShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS5saWJyYXJ5Q29kZS5hY2NvdW50cykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodC5zYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG8uZ2V0UmVwb3J0U3VpdGVzKGUubGlicmFyeUNvZGUuYWNjb3VudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmxvZ2dlci5pbmZvKCdTZXR0aW5nIHRoZSBmb2xsb3dpbmcgcmVwb3J0IHN1aXRlcyBvbiB0aGUgdHJhY2tlcjogIicgKyBuICsgJyInKSwgdC5zYShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5sb2dnZXIud2FybignQ2Fubm90IHNldCByZXBvcnQgc3VpdGVzIG9uIHRyYWNrZXIuIGBzYWAgbWV0aG9kIG5vdCBhdmFpbGFibGUuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocltlXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5sb2dnZXIuaW5mbygnRm91bmQgdHJhY2tlciBsb2NhdGVkIGF0OiAiJyArIGUgKyAnIi4nKSwgcltlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQ2Fubm90IGZpbmQgdGhlIGdsb2JhbCB2YXJpYWJsZSBuYW1lOiAiJyArIGUgKyAnIi4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZS5saWJyYXJ5Q29kZS50eXBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugby5MSUJfVFlQRVMuTUFOQUdFRDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gby5nZXRSZXBvcnRTdWl0ZXMoZS5saWJyYXJ5Q29kZS5hY2NvdW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC50aGVuKGwuYmluZChudWxsLCBlLCBuKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugby5MSUJfVFlQRVMuUFJFSU5TVEFMTEVEOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQudGhlbihjLnBvbGwuYmluZChudWxsLCByLCBlLmxpYnJhcnlDb2RlLnRyYWNrZXJWYXJpYWJsZU5hbWUpKS50aGVuKHAuYmluZChudWxsLCBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ugby5MSUJfVFlQRVMuQ1VTVE9NOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIG8uTElCX1RZUEVTLlJFTU9URToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnRoZW4oZi5iaW5kKG51bGwsIGUubGlicmFyeUNvZGUudHJhY2tlclZhcmlhYmxlTmFtZSkpLnRoZW4ocC5iaW5kKG51bGwsIGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQ2Fubm90IGxvYWQgbGlicmFyeS4gVHlwZSBub3Qgc3VwcG9ydGVkLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2hlbHBlcnMvZ2VuZXJhdGVWZXJzaW9uLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IDgsIG4gPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZ2V0VVRDRGF0ZSgpLnRvU3RyaW5nKDM2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdWJzdHIoZS5sZW5ndGggLSAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWF0aC5mbG9vcihlLmdldFVUQ0hvdXJzKCkgLyB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IChlLmdldFVUQ01vbnRoKCkgKyAxICsgMTIgKiBpKGUpKS50b1N0cmluZygzNik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUuZ2V0VVRDRnVsbFllYXIoKSAtIDIwMTApLnRvU3RyaW5nKDM2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IG5ldyBEYXRlKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNOYU4odCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ludmFsaWQgZGF0ZSBwcm92aWRlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKCdMJyArIHModCkgKyByKHQpICsgbih0KSkudG9VcHBlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvaGVscGVycy9wb2xsSGVscGVyLmpzJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG4oJ0BhZG9iZS9yZWFjdG9yLXByb21pc2UnKSwgciA9IDQwLCBzID0gMjUwLCBvID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubG9nZ2VyLmluZm8oJ0ZvdW5kIHByb3BlcnR5IGxvY2F0ZWQgYXQ6ICInICsgdCArICciXS4nKSwgZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYyA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGkoZnVuY3Rpb24gKG4sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVt0XSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8obiwgdCwgZVt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAxLCBjID0gc2V0SW50ZXJ2YWwoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVt0XSAmJiAobyhuLCB0LCBlW3RdKSwgY2xlYXJJbnRlcnZhbChjKSksIGkgPj0gciAmJiAoY2xlYXJJbnRlcnZhbChjKSwgYShuZXcgRXJyb3IoJ0JhaWxpbmcgb3V0LiBDYW5ub3QgZmluZCB0aGUgdmFyaWFibGUgbmFtZTogIicgKyB0ICsgJyJdLicpKSksIGkrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmV4cG9ydHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvbGw6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5sb2dnZXIuaW5mbygnV2FpdGluZyBmb3IgdGhlIHByb3BlcnR5IHRvIGJlY29tZSBhY2Nlc3NpYmxlIGF0OiAiJyArIHQgKyAnIl0uJyksIGMoZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICdjb21tb24tYW5hbHl0aWNzLXBsdWdpbnMnOiB7CiAgICAgICAgICAgICAgICAgICAgZGlzcGxheU5hbWU6ICdDb21tb24gQW5hbHl0aWNzIFBsdWdpbnMnLAogICAgICAgICAgICAgICAgICAgIGhvc3RlZExpYkZpbGVzQmFzZVVybDogJ2h0dHBzOi8vYXNzZXRzLmFkb2JlZHRtLmNvbS9leHRlbnNpb25zL0VQNjI3YTI1YzUxOTY3NDA1NTkwY2NjNTFiYmExMDFkMDcvJywKICAgICAgICAgICAgICAgICAgICBtb2R1bGVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICdjb21tb24tYW5hbHl0aWNzLXBsdWdpbnMvc3JjL2xpYi9hY3Rpb25zL2luaXRpYWxpemUuanMnOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnaW5pdGlhbGl6ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogJ0luaXRpYWxpemUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NyaXB0OiBmdW5jdGlvbiAoZSwgdCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSwgciA9IGEuZ2V0U2hhcmVkTW9kdWxlKCdhZG9iZS1hbmFseXRpY3MnLCAnYXVnbWVudC10cmFja2VyJyksIG8gPSBhLmdldFNoYXJlZE1vZHVsZSgnYWRvYmUtYW5hbHl0aWNzJywgJ2dldC10cmFja2VyJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5leHBvcnRzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiAoaSA9IGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHZvaWQgMCA9PT0gbyA/IGEubG9nZ2VyLmVycm9yKCdUaGUgIkNvbW1vbiBBbmFseXRpY3MgUGx1Z2lucyIgZXh0ZW5zaW9uIHJlcXVpcmVzIHRoYXQgdGhlICJBZG9iZSBBbmFseXRpY3MiIGV4dGVuc2lvbiBiZSBpbnN0YWxsZWQgaW4gdGhlIHNhbWUgTGF1bmNoIHdlYiBwcm9wZXJ0eSBhbmQgaXQgaXMgbm90LicpIDogcihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaS5ncXAgfHwgaS5tdiB8fCBpLnB0KSAmJiAoZS5wdCA9IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgciA9IChlID0gZS5zcGxpdCh0IHx8ICcsJykpLmxlbmd0aDsgaSA8IHI7IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9IHRoaXNbbl0oZVtpXSwgYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgKGkuZnQgfHwgaS5hcGwgfHwgaS5pbCB8fCBpLmd0YmUgfHwgaS5ndHRjKSAmJiAoZS5pbkxpc3QgPSBmdW5jdGlvbiAoZSwgdCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9IHR5cGVvZiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5zcGxpdChuIHx8ICcsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgnb2JqZWN0JyAhPSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSBlLmxlbmd0aDsgbiA8IGk7IG4rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSBhICYmIHQgPT09IGVbbl0gfHwgdC50b0xvd2VyQ2FzZSgpID09PSBlW25dLnRvTG93ZXJDYXNlKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIChpLmZwbyB8fCBpLmdwbHQgfHwgaS5ncHB2KSAmJiAoZS5wX2ZvID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0Ll9fZm8gfHwgKHQuX19mbyA9IHt9KSwgIXQuX19mb1tlXSAmJiAodC5fX2ZvW2VdID0ge30sICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkuZ2djICYmIChlLmdldEdlb0Nvb3JkaW5hdGVzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLCB0ID0gJycsIG4gPSBlLmNfcignc19nZ2MnKS5zcGxpdCgnfCcpLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lb3V0OiA1MDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXhpbXVtQWdlOiAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSA9IGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBuLmNvb3JkczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuZXcgRGF0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnNldFRpbWUoYS5nZXRUaW1lKCkgKyAxODAwMDAwKSwgZS5jX3coJ3NfZ2djJywgcGFyc2VGbG9hdChuLmxhdGl0dWRlLnRvRml4ZWQoNCkpICsgJ3wnICsgcGFyc2VGbG9hdChuLmxvbmdpdHVkZS50b0ZpeGVkKDQpKSwgYSksIHQgPSAnbGF0aXR1ZGU9JyArIHBhcnNlRmxvYXQobi5sYXRpdHVkZS50b0ZpeGVkKDQpKSArICcgfCBsb25naXR1ZGU9JyArIHBhcnNlRmxvYXQobi5sb25naXR1ZGUudG9GaXhlZCg0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9ICdlcnJvciByZXRyaWV2aW5nIGdlbyBjb29yZGluYXRlcyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxIDwgbi5sZW5ndGggJiYgKHQgPSAnbGF0aXR1ZGU9JyArIG5bMF0gKyAnIHwgbG9uZ2l0dWRlPScgKyBuWzFdKSwgbmF2aWdhdG9yLmdlb2xvY2F0aW9uICYmIG5hdmlnYXRvci5nZW9sb2NhdGlvbi5nZXRDdXJyZW50UG9zaXRpb24oaSwgciwgYSksICcnID09PSB0ICYmICh0ID0gJ2dlbyBjb29yZGluYXRlcyBub3Qgc3VwcG9ydGVkJyksIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpLm5zICYmICh3aW5kb3cuemVyb1BhZCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9IHBhcnNlSW50KGUpLCB0ID0gcGFyc2VJbnQodCksIGlzTmFOKGUpIHx8IGlzTmFOKHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdCAtIGUudG9TdHJpbmcoKS5sZW5ndGggKyAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5KCsoMCA8IG4gJiYgbikpLmpvaW4oJzAnKSArIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHdpbmRvdy5yYW5kb21OdW1iZXIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9ICdudW1iZXInID09IHR5cGVvZiBlID8gMTcgPiBNYXRoLmFicyhlKSA/IE1hdGgucm91bmQoTWF0aC5hYnMoZSkpIDogMTcgOiAxMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAnMScsIG4gPSAwOyBuIDwgZTsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgKz0gJzAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSBOdW1iZXIodCksICh0ID0gTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpLnRvRml4ZWQoZSkgKiB0KSArICcnKS5sZW5ndGggIT09IGUgJiYgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHplcm9QYWQgJiYgKHQgPSB6ZXJvUGFkKHQsIGUpKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgd2luZG93LnR3b0RlY2ltYWxzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGUgfHwgdm9pZCAwID09PSBlIHx8IGlzTmFOKGUpID8gMCA6IE51bWJlcihOdW1iZXIoZSkudG9GaXhlZCgyKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpLmFwdiAmJiAoZS5hZGRQcm9kdWN0RXZhciA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGUgJiYgJ3N0cmluZycgPT0gdHlwZW9mIHQgJiYgJycgIT09IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG4gPSBuIHx8ICExLCB0aGlzLnByb2R1Y3RzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCBpID0gdGhpcy5wcm9kdWN0cy5zcGxpdCgnLCcpLCByID0gaS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiA9IG4gPyAwIDogciAtIDE7IG4gPCByOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoYSA9IGlbbl0uc3BsaXQoJzsnKSlbNV0gJiYgLTEgPCBhWzVdLnRvTG93ZXJDYXNlKCkuaW5kZXhPZignZXZhcicpID8gYVs1XSA9IGFbNV0gKyAnfCcgKyBlICsgJz0nICsgdCA6IGFbNV0gPyBhWzVdID0gZSArICc9JyArIHQgOiBhWzVdIHx8IChhWzRdIHx8IChhWzRdID0gJycpLCBhWzNdIHx8IChhWzNdID0gJycpLCBhWzJdIHx8IChhWzJdID0gJycpLCBhWzFdIHx8IChhWzFdID0gJycpLCBhWzVdID0gZSArICc9JyArIHQpLCBpW25dID0gYS5qb2luKCc7Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucHJvZHVjdHMgPSBpLmpvaW4oJywnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5wcm9kdWN0cyA9ICc7Ozs7OycgKyBlICsgJz0nICsgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkuYXBlICYmIChlLmFkZFByb2R1Y3RFdmVudCA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPSBpc05hTih0KSA/ICcxJyA6IFN0cmluZyh0KSwgbiA9IG4gfHwgITEsIGEuZXZlbnRzID0gYS5hcGwoYS5ldmVudHMsIGUpLCBhLnByb2R1Y3RzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpLCByID0gYS5wcm9kdWN0cy5zcGxpdCgnLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gPSBuID8gMCA6IHIubGVuZ3RoIC0gMTsgbiA8IHIubGVuZ3RoOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaSA9IHJbbl0uc3BsaXQoJzsnKSlbNF0gJiYgaVs0XS5pbmNsdWRlcygnZXZlbnQnKSA/IGlbNF0gPSBpWzRdICsgJ3wnICsgZSArICc9JyArIHQgOiBpWzVdID8gaVs0XSA9IGUgKyAnPScgKyB0IDogaVs0XSB8fCAoaVszXSB8fCAoaVszXSA9ICcnKSwgaVsyXSB8fCAoaVsyXSA9ICcnKSwgaVsxXSB8fCAoaVsxXSA9ICcnKSwgaVs0XSA9IGUgKyAnPScgKyB0KSwgcltuXSA9IGkuam9pbignOycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnByb2R1Y3RzID0gci5qb2luKCcsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucHJvZHVjdHMgPSAnOzs7OycgKyBlICsgJz0nICsgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkuYXBsICYmIChlLmFwbCA9IGZ1bmN0aW9uIChlLCB0LCBuLCBhLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUgfHwgJ3N0cmluZycgPT0gdHlwZW9mIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSB0aGlzLmluTGlzdCB8fCAnc3RyaW5nJyAhPSB0eXBlb2YgdCB8fCAnJyA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG4gfHwgJywnLCAxID09IChhID0gYSB8fCBuKSAmJiAoYSA9IG4sIGkgfHwgKGkgPSAxKSksIDIgPT0gYSAmJiAxICE9IGkgJiYgKGEgPSBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciByID0gKHQgPSB0LnNwbGl0KCcsJykpLmxlbmd0aCwgcyA9IDA7IHMgPCByOyBzKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW5MaXN0KGUsIHRbc10sIG4sIGkpIHx8IChlID0gZSA/IGUgKyBhICsgdFtzXSA6IHRbc10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAoaS5jcyB8fCBpLm12KSAmJiAod2luZG93LmNsZWFuU3RyID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IChlID0gKGUgPSAoZSA9IChlID0gZS5yZXBsYWNlKC88XC8/W14+XSsoPnwkKS9nLCAnJykpLnJlcGxhY2UoL15ccyt8XHMrJC9nLCAnJykpLnJlcGxhY2UoL1tcdTIwMThcdTIwMTlcdTIwMUFdL2csICdcJycpKS5yZXBsYWNlKC9cdCsvZywgJycpKS5yZXBsYWNlKC9bXG5ccl0vZywgJyAnKTsgLTEgPCBlLmluZGV4T2YoJyAgJyk7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZS5yZXBsYWNlKC9cc1xzL2csICcgJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpLnJmbCAmJiAoZS5yZmwgPSBmdW5jdGlvbiAoZSwgdCwgbiwgYSwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlIHx8ICF0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gW10sIHMgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhIHx8IG4sIGkgPSAhIWksIG4gPSAoZSA9IGUuc3BsaXQobiB8fCAnLCcpKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gMDsgbyA8IG47IG8rKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMSA8IGVbb10uaW5kZXhPZignOicpICYmICgocyA9IGVbb10uc3BsaXQoJzonKSlbMV0gPSBzWzBdICsgJzonICsgc1sxXSwgZVtvXSA9IHNbMF0pLCAtMSA8IGVbb10uaW5kZXhPZignPScpICYmICgocyA9IGVbb10uc3BsaXQoJz0nKSlbMV0gPSBzWzBdICsgJz0nICsgc1sxXSwgZVtvXSA9IHNbMF0pLCBlW29dICE9PSB0ICYmIHMgPyByLnB1c2goc1sxXSkgOiBlW29dICE9PSB0ID8gci5wdXNoKGVbb10pIDogZVtvXSA9PT0gdCAmJiBpICYmIChzID8gci5wdXNoKHNbMV0pIDogci5wdXNoKGVbb10pLCBpID0gITEpLCBzID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5qb2luKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaS5ndm8gJiYgKGUuZ2V0VmFsT25jZSA9IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCA9IHQgfHwgJ3NfZ3ZvJywgbiA9IG4gfHwgMCwgYSA9ICdtJyA9PT0gYSA/IDYwMDAwIDogODY0MDAwMDAsIGUgJiYgZSAhPT0gdGhpcy5jX3IodCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG5ldyBEYXRlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuc2V0VGltZShpLmdldFRpbWUoKSArIG4gKiBhKSwgdGhpcy5jX3codCwgZSwgMCA9PT0gbiA/IDAgOiBpKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkuZ3B2ICYmIChlLmdldFByZXZpb3VzVmFsdWUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLCBpID0gJycsIHIgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID0gdCB8fCAnc19ncHYnLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9ICExLCBuID0gbi5zcGxpdCgnLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSBhLmV2ZW50cyA/IGEuZXZlbnRzLnNwbGl0KCcsJykgOiAnJywgbyA9IDAsIGMgPSBuLmxlbmd0aDsgbyA8IGM7IG8rKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBsID0gMCwgdSA9IHMubGVuZ3RoOyBsIDwgdTsgbCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5bb10gPT09IHNbbF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghMCA9PT0gcikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gciAmJiAoKHIgPSBuZXcgRGF0ZSgpKS5zZXRUaW1lKHIuZ2V0VGltZSgpICsgMTgwMDAwMCksIGEuY19yKHQpICYmIChpID0gYS5jX3IodCkpLCBlID8gYS5jX3codCwgZSwgcikgOiBhLmNfdyh0LCAnbm8gcHJldmlvdXMgdmFsdWUnLCByKSksIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpLmdhcHYgJiYgKGUuZ2V0QW5kUGVyc2lzdFZhbHVlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IERhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gdCB8fCAnc19nYXB2JywgKG4gPSBuIHx8IDApID8gYS5zZXRUaW1lKGEuZ2V0VGltZSgpICsgODY0MDAwMDAgKiBuKSA6IGEuc2V0VGltZShhLmdldFRpbWUoKSArIDE4MDAwMDApLCBlIHx8IChlID0gdGhpcy5jX3IodCkpLCB0aGlzLmNfdyh0LCBlLCBhKSwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIChpLmZ0IHx8IGkuZ3RiZSB8fCBpLmd0dGMpICYmIChlLmZvcm1hdFRpbWUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEodm9pZCAwID09PSBlIHx8IGlzTmFOKGUpIHx8IDAgPiBOdW1iZXIoZSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiB0ICYmICdkJyA9PT0gdCB8fCAoJ3N0cmluZycgIT0gdHlwZW9mIHQgfHwgIWEuaW5MaXN0KCdoLG0scycsIHQpKSAmJiA4NjQwMCA8PSBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSA4NjQwMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSAnZGF5cyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBpc05hTihuKSA/IDQgOiB0IC8gKG4gKiB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgPT0gdHlwZW9mIHQgJiYgJ2gnID09PSB0IHx8ICgnc3RyaW5nJyAhPSB0eXBlb2YgdCB8fCAhYS5pbkxpc3QoJ20scycsIHQpKSAmJiAzNjAwIDw9IGUgPyAodCA9IDM2MDAsIGkgPSAnaG91cnMnLCBuID0gaXNOYU4obikgPyA0IDogdCAvIChuICogdCkpIDogJ3N0cmluZycgPT0gdHlwZW9mIHQgJiYgJ20nID09PSB0IHx8ICgnc3RyaW5nJyAhPSB0eXBlb2YgdCB8fCAhYS5pbkxpc3QoJ3MnLCB0KSkgJiYgNjAgPD0gZSA/ICh0ID0gNjAsIGkgPSAnbWludXRlcycsIG4gPSBpc05hTihuKSA/IDIgOiB0IC8gKG4gKiB0KSkgOiAodCA9IDEsIGkgPSAnc2Vjb25kcycsIG4gPSBpc05hTihuKSA/IDAuMiA6IHQgLyBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA9PT0gKGUgPSBNYXRoLnJvdW5kKGUgKiBuIC8gdCkgLyBuICsgJyAnICsgaSkuaW5kZXhPZignMSAnKSAmJiAoZSA9IGUuc3Vic3RyaW5nKDAsIGUubGVuZ3RoIC0gMSkpLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaS5ndHNsdiAmJiAoZS5nZXRUaW1lU2luY2VMYXN0VmlzaXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXMsIHQgPSBuZXcgRGF0ZSgpLCBuID0gdC5nZXRUaW1lKCksIGEgPSBlLmNfcignc190c2x2JykgfHwgMCwgaSA9IE1hdGgucm91bmQoKG4gLSBhKSAvIDEwMDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuc2V0VGltZShuICsgNjMwNzIwMDAwMDApLCBlLmNfdygnc190c2x2JywgbiwgdCksIGEgPyAxODAwIDwgaSAmJiBlLmZvcm1hdFRpbWUgPyBlLmZvcm1hdFRpbWUoaSkgOiAnJyA6ICdOZXcgVmlzaXRvcic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpLmdkc2x2ICYmIChlLmdldERheXNTaW5jZUxhc3RWaXNpdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IERhdGUoKSwgdCA9IGUuZ2V0VGltZSgpLCBuID0gdGhpcy5jX3IoJ3NfZHNsdicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuc2V0VGltZSh0ICsgOTQ2MDgwMDAwMDApLCB0aGlzLmNfdygnc19kc2x2JywgdCwgZSksIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMTgwMDAwMCA8IChlID0gdCAtIG4pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgzMTUzNjAwMDAwMCA8IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ01vcmUgdGhhbiBhIHllYXInOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMjU5MjAwMDAwMCA8IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ01vcmUgdGhhbiAzMCBkYXlzJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPCAyNTkyMDAwMDAxICYmIDYwNDgwMDAwMCA8IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ01vcmUgdGhhbiA3IGRheXMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA8IDYwNDgwMDAwMSAmJiA4NjQwMDAwMCA8IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ0xlc3MgdGhhbiA3IGRheXMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA8IDg2NDAwMDAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdMZXNzIHRoYW4gMSBkYXknOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ05ldyBWaXNpdG9yJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkuZ25yICYmIChlLmdldE5ld1JlcGVhdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXMsIG4gPSAnc19ucicgKyAoZSA9IGUgfHwgMzApLCBhID0gbmV3IERhdGUoKSwgaSA9IHQuY19yKG4pLCByID0gaS5zcGxpdCgnLScpLCBzID0gYS5nZXRUaW1lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5zZXRUaW1lKHMgKyA4NjQwMDAwMCAqIGUpLCAnJyA9PT0gaSB8fCAxODAwMDAgPiBzIC0gclswXSAmJiAnTmV3JyA9PT0gclsxXSA/ICh0LmNfdyhuLCBzICsgJy1OZXcnLCBhKSwgJ05ldycpIDogKHQuY193KG4sIHMgKyAnLVJlcGVhdCcsIGEpLCAnUmVwZWF0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpLmdwbHQgJiYgKGUuZ2V0UGFnZUxvYWRUaW1lID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBwZXJmb3JtYW5jZSAmJiBlLnBfZm8oJ3BlcmZvcm1hbmNlJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHBlcmZvcm1hbmNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuY2xlYXJSZXNvdXJjZVRpbWluZ3MoKSwgJycgIT09IGUuY19yKCdzX3BsdCcpICYmICgwIDwgdC50aW1pbmcubG9hZEV2ZW50RW5kICYmIGNsZWFySW50ZXJ2YWwoZS5waSksIGUuX3BsdExvYWRUaW1lID0gZS5jX3IoJ3NfcGx0JyksIGUuX3BsdFByZXZpb3VzUGFnZSA9IGUuY19yKCdzX3BsdHAnKSwgZS5jX3coJ3NfcGx0JywgJycpLCBlLmNfdygnc19wbHRwJywgJycpKSwgMCA9PT0gdC50aW1pbmcubG9hZEV2ZW50RW5kID8gZS5waSA9IHNldEludGVydmFsKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wZXJmb3JtYW5jZVdyaXRlRnVsbCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDI1MCkgOiAwIDwgdC50aW1pbmcubG9hZEV2ZW50RW5kICYmIChlLnB0YyA/IGUucHRjID09PSB0LnRpbWluZy5sb2FkRXZlbnRFbmQgJiYgMSA9PT0gdC5nZXRFbnRyaWVzKCkubGVuZ3RoICYmIChlLnB3cCA9IHNldEludGVydmFsKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wZXJmb3JtYW5jZVdyaXRlUGFydCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIDUwMCkpIDogZS5wZXJmb3JtYW5jZVdyaXRlRnVsbCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wZXJmb3JtYW5jZVdyaXRlRnVsbCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpcywgdCA9IHBlcmZvcm1hbmNlLnRpbWluZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgPCB0LmxvYWRFdmVudEVuZCAmJiAoY2xlYXJJbnRlcnZhbChlLnBpKSwgJycgPT09IGUuY19yKCdzX3BsdCcpICYmIChlLmNfdygnc19wbHQnLCBlLnBlcmZvcm1hbmNlQ2hlY2sodC5sb2FkRXZlbnRFbmQsIHQubmF2aWdhdGlvblN0YXJ0KSksIGUuY193KCdzX3BsdHAnLCBlLnBhZ2VOYW1lKSkpLCBlLnB0YyA9IHQubG9hZEV2ZW50RW5kOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnBlcmZvcm1hbmNlV3JpdGVQYXJ0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzLCB0ID0gcGVyZm9ybWFuY2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwIDwgdC5nZXRFbnRyaWVzKCkubGVuZ3RoICYmIChlLnBwZmUgPT09IHQuZ2V0RW50cmllcygpLmxlbmd0aCA/IGNsZWFySW50ZXJ2YWwoZS5wd3ApIDogZS5wcGZlID0gdC5nZXRFbnRyaWVzKCkubGVuZ3RoKSwgJycgPT09IGUuY19yKCdzX3BsdCcpICYmIChlLmNfdygnc19wbHQnLCAoKHQuZ2V0RW50cmllcygpW3QuZ2V0RW50cmllcygpLmxlbmd0aCAtIDFdLnJlc3BvbnNlRW5kIC0gdC5nZXRFbnRyaWVzKClbMF0uc3RhcnRUaW1lKSAvIDEwMDApLnRvRml4ZWQoMikpLCBlLmNfdygnc19wbHRwJywgZS5wYWdlTmFtZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnBlcmZvcm1hbmNlQ2hlY2sgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPD0gZSAmJiAwIDw9IHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDYwMDAwID4gZSAtIHQgJiYgMCA8PSBlIC0gdCA/IHBhcnNlRmxvYXQoKGUgLSB0KSAvIDEwMDApLnRvRml4ZWQoMikgOiA2MDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkuZ3BuICYmICh3aW5kb3cuZ2V0UGFnZU5hbWUgPSBmdW5jdGlvbiAoZSwgdCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBsb2NhdGlvbi5ob3N0bmFtZSwgciA9IGxvY2F0aW9uLnBhdGhuYW1lLnN1YnN0cmluZygxKS5zcGxpdCgnLycpLCBzID0gci5sZW5ndGgsIG8gPSBsb2NhdGlvbi5zZWFyY2guc3Vic3RyaW5nKDEpLnNwbGl0KCcmJyksIGMgPSBvLmxlbmd0aCwgbCA9IGxvY2F0aW9uLmhhc2guc3Vic3RyaW5nKDEpLnNwbGl0KCcmJyksIHUgPSBsLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhID0gYSB8fCAnfCcsIGUgPSBlIHx8IGksIHQgPSB0IHx8ICcnLCBuID0gbiB8fCAnJywgMSA9PT0gcyAmJiAnJyA9PT0gclswXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZSArIGEgKyAnaG9tZSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHM7IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUgKyBhICsgZGVjb2RlVVJJQ29tcG9uZW50KHJbaV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgJiYgKDEgIT09IGMgfHwgJycgIT09IG9bMF0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocyA9IChyID0gdC5zcGxpdCgnLCcpKS5sZW5ndGgsIGkgPSAwOyBpIDwgczsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSAwOyB0IDwgYzsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJbaV0gPT09IG9bdF0uc3BsaXQoJz0nKVswXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlICsgYSArIGRlY29kZVVSSUNvbXBvbmVudChvW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuICYmICgxICE9PSB1IHx8ICcnICE9PSBsWzBdKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG8gPSAobiA9IG4uc3BsaXQoJywnKSkubGVuZ3RoLCBpID0gMDsgaSA8IG87IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0ID0gMDsgdCA8IHU7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuW2ldID09PSBsW3RdLnNwbGl0KCc9JylbMF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gZSArIGEgKyBkZWNvZGVVUklDb21wb25lbnQobFt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zdWJzdHJpbmcoZS5sZW5ndGggLSBhLmxlbmd0aCkgPT09IGEgPyBlLnN1YnN0cmluZygwLCBlLmxlbmd0aCAtIGEubGVuZ3RoKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpLmdybCAmJiAod2luZG93LmdldFJlc3BvbnNpdmVMYXlvdXQgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoaXNOYU4oZSkgfHwgaXNOYU4odCkgfHwgaXNOYU4obikgfHwgdCA8IGUgfHwgbiA8IHQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB3aW5kb3cuaW5uZXJXaWR0aCB8fCBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuY2xpZW50V2lkdGggfHwgZG9jdW1lbnQuYm9keS5jbGllbnRXaWR0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGUgPCB0ICYmIGEgPD0gdCA/IGEgPD0gZSA/ICdwaG9uZSBwb3J0cmFpdCBsYXlvdXQnIDogJ3Bob25lIGxhbmRzY2FwZSBsYXlvdXQnIDogYSA8PSB0ID8gJ3Bob25lIGxheW91dCcgOiBhIDw9IG4gPyAndGFibGV0IGxheW91dCcgOiAnZGVza3RvcCBsYXlvdXQnKSArICc6JyArIGEgKyAneCcgKyAod2luZG93LmlubmVySGVpZ2h0IHx8IGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5jbGllbnRIZWlnaHQgfHwgZG9jdW1lbnQuYm9keS5jbGllbnRIZWlnaHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaS5ncXAgJiYgKGUuZ2V0UXVlcnlQYXJhbSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMsIGkgPSAnJywgciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gKHQgPSAodCA9IHQuc3BsaXQoJz8nKS5qb2luKCcmJykpLnNwbGl0KCcjJykuam9pbignJicpKS5pbmRleE9mKCcmJyksIGkgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgKC0xIDwgbiB8fCB0LmluZGV4T2YoJz0nKSA+IG4pICYmIChuID0gdC5zdWJzdHJpbmcobiArIDEpLCBpID0gYS5wdChuLCAnJicsICdncHZhbCcsIGUpKSwgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBzID0gKGUgPSBlLnNwbGl0KCcsJykpLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmdwdmFsID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZS5zcGxpdCgnPScpLCBhID0gblswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID0gIW5bMV0gfHwgblsxXSwgdC50b0xvd2VyQ2FzZSgpID09IGEudG9Mb3dlckNhc2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Jvb2xlYW4nID09IHR5cGVvZiBuID8gbiA6IHRoaXMudW5lc2NhcGUobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQgPSB0IHx8ICcnLCBuID0gKG4gfHwgKGEucGFnZVVSTCA/IGEucGFnZVVSTCA6IGxvY2F0aW9uLmhyZWYpKSArICcnLCAoNCA8IHQubGVuZ3RoIHx8IC0xIDwgdC5pbmRleE9mKCc9JykpICYmIG4gJiYgNCA+IG4ubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSBuLCBuID0gbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwOyBjIDwgczsgYysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzdHJpbmcnID09IHR5cGVvZiAobyA9IHIoZVtjXSwgbikpID8gKG8gPSAtMSA8IG8uaW5kZXhPZignIycpID8gby5zdWJzdHJpbmcoMCwgby5pbmRleE9mKCcjJykpIDogbywgaSArPSBpID8gdCArIG8gOiBvKSA6IGkgPSAnJyA9PT0gaSA/IG8gOiBpICsgKHQgKyBvKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaS5ndHAgJiYgKHdpbmRvdy5nZXRUaW1lUGFydGluZyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IGRvY3VtZW50LmRvY3VtZW50TW9kZSA/IHZvaWQgMCA6IGUgfHwgJ0V0Yy9HTVQnLCBlID0gbmV3IERhdGUoKS50b0xvY2FsZURhdGVTdHJpbmcoJ2VuLVVTJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVab25lOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbnV0ZTogJ251bWVyaWMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhvdXI6ICdudW1lcmljJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ZWVrZGF5OiAnbG9uZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF5OiAnbnVtZXJpYycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeWVhcjogJ251bWVyaWMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vbnRoOiAnbG9uZycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCAneWVhcj0nICsgKGUgPSAvKFthLXpBLVpdKykuKj8oW2EtekEtWl0rKS4qPyhbMC05XSspLio/KFswLTldKykoLio/KShbMC05XSkoLiopLy5leGVjKGUpKVs0XSArICcgfCBtb250aD0nICsgZVsyXSArICcgfCBkYXRlPScgKyBlWzNdICsgJyB8IGRheT0nICsgZVsxXSArICcgfCB0aW1lPScgKyAoZVs2XSArIGVbN10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaS5ndGJlICYmIChlLmdldFRpbWVCZXR3ZWVuRXZlbnRzID0gZnVuY3Rpb24gKGUsIHQsIG4sIGEsIGksIHIsIHMsIG8sIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgZSAmJiB2b2lkIDAgIT09IHQgJiYgJ3N0cmluZycgPT0gdHlwZW9mIG4gJiYgdm9pZCAwICE9PSBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGkgfHwgJ3NfdGJlJywgciA9IGlzTmFOKHIpID8gMSA6IE51bWJlcihyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdSA9ICExLCBkID0gITEsIHAgPSBlLnNwbGl0KCcsJyksIGYgPSBuLnNwbGl0KCcsJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMgPyBjLnNwbGl0KCcsJykgOiBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBtLCBnID0gbC5jX3IoaSksIGIgPSBuZXcgRGF0ZSgpLCB2ID0gYi5nZXRUaW1lKCksIGggPSBuZXcgRGF0ZSgpLCB5ID0gMDsgeSA8IGMubGVuZ3RoOyArK3kpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsLmluTGlzdChsLmV2ZW50cywgY1t5XSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaC5zZXREYXRlKGguZ2V0RGF0ZSgpIC0gMSksIHZvaWQgbC5jX3coaSwgJycsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaC5zZXRUaW1lKGguZ2V0VGltZSgpICsgODY0MDAwMDAgKiByKSwgeSA9IDA7IHkgPCBwLmxlbmd0aCAmJiAhdSAmJiAhMCAhPT0gKHUgPSBsLmluTGlzdChsLmV2ZW50cywgcFt5XSkpOyArK3kpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoeSA9IDA7IHkgPCBmLmxlbmd0aCAmJiAhZCAmJiAhMCAhPT0gKGQgPSBsLmluTGlzdChsLmV2ZW50cywgZlt5XSkpOyArK3kpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxID09PSBwLmxlbmd0aCAmJiAxID09PSBmLmxlbmd0aCAmJiBlID09PSBuICYmIHUgJiYgZCA/IChnICYmIChtID0gKHYgLSBnKSAvIDEwMDApLCBsLmNfdyhpLCB2LCByID8gaCA6IDApKSA6ICghdSB8fCAxICE9IHQgJiYgZyB8fCBsLmNfdyhpLCB2LCByID8gaCA6IDApLCBkICYmIGcgJiYgKG0gPSAoYi5nZXRUaW1lKCkgLSBnKSAvIDEwMDAsICEwID09PSBhICYmIChoLnNldERhdGUoaC5nZXREYXRlKCkgLSAxKSwgbC5jX3coaSwgJycsIGgpKSkpLCBtID8gbC5mb3JtYXRUaW1lKG0sIHMsIG8pIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBpLmd0dGMgJiYgKGUuZ2V0VGltZVRvQ29tcGxldGUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzdG9wJyA9PT0gKGUgPSBlID8gZS50b0xvd2VyQ2FzZSgpIDogJ3N0YXJ0JykgfHwgJ3N0YXJ0JyA9PT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0IHx8ICdzX2d0dGMnLCBuID0gbiB8fCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcywgaSA9IGEuY19yKHQpLCByID0gbmV3IERhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0YXJ0JyAhPT0gZSB8fCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RvcCcgPT09IGUgJiYgaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gTWF0aC5yb3VuZCgoci5nZXRUaW1lKCkgLSBpKSAvIDEwMDApLCBhLmNfdyh0LCAnJywgMCksIGEuZm9ybWF0VGltZShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5jX3codCwgci5nZXRUaW1lKCksIG4gPyBuZXcgRGF0ZShyLmdldFRpbWUoKSArIDg2NDAwMDAwICogbikgOiAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkuZ3ZkICYmIChlLmdldFZpc2l0RHVyYXRpb24gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyBEYXRlKCksIHQgPSBlLmdldFRpbWUoKSwgbiA9IHRoaXMuY19yKCdzX2R1cicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGlzTmFOKG4pIHx8IDE4MDAwMDAgPCB0IC0gbikgJiYgKG4gPSB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gdCAtIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5zZXRUaW1lKHQgKyAxODAwMDAwKSwgdGhpcy5jX3coJ3NfZHVyJywgbiArICcnLCBlKSwgMCA9PT0gYSA/ICdmaXJzdCBoaXQgb2YgdmlzaXQnIDogMCA9PT0gKGEgPSBNYXRoLmZsb29yKGEgLyA2MDAwMCkpID8gJ2xlc3MgdGhhbiBhIG1pbnV0ZScgOiAxID09PSBhID8gJzEgbWludXRlJyA6IGEgKyAnIG1pbnV0ZXMnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaS5ndm4gJiYgKGUuZ2V0VmlzaXROdW0gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzLCBhID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFpc05hTihlKSAmJiAoMCB8IHBhcnNlRmxvYXQoZSkpID09PSBwYXJzZUZsb2F0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9IGUgfHwgMzY1LCAnYm9vbGVhbicgPT0gdHlwZW9mICh0ID0gdCA/ICEhdCA6ICEhYShlKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IG5ldyBEYXRlKCkuZ2V0VGltZSgpLCByID0gZW5kT2ZEYXRlUGVyaW9kKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmNfcignc192bmMnICsgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gbi5jX3IoJ3Nfdm5jJyArIGUpLnNwbGl0KCcmdm49JyksIG8gPSBzWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmNfcignc19pdmMnKSA/IG8gPyAoci5zZXRUaW1lKGkgKyAxODAwMDAwKSwgbi5jX3coJ3NfaXZjJywgITAsIHIpLCBvKSA6ICd1bmtub3duIHZpc2l0IG51bWJlcicgOiB2b2lkIDAgIT09IG8gPyAobysrLCBhID0gdCAmJiBhKGUpID8gaSArIDg2NDAwMDAwICogZSA6IHNbMF0sIHIuc2V0VGltZShhKSwgbi5jX3coJ3Nfdm5jJyArIGUsIGEgKyAnJnZuPScgKyBvLCByKSwgci5zZXRUaW1lKGkgKyAxODAwMDAwKSwgbi5jX3coJ3NfaXZjJywgITAsIHIpLCBvKSA6IChhID0gYShlKSA/IGkgKyA4NjQwMDAwMCAqIGUgOiBlbmRPZkRhdGVQZXJpb2QoZSkuZ2V0VGltZSgpLCBuLmNfdygnc192bmMnICsgZSwgYSArICcmdm49MScsIHIpLCByLnNldFRpbWUoaSArIDE4MDAwMDApLCBuLmNfdygnc19pdmMnLCAhMCwgciksICcxJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHdpbmRvdy5lbmRPZkRhdGVQZXJpb2QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBuZXcgRGF0ZSgpLCBuID0gaXNOYU4oZSkgPyAwIDogTWF0aC5mbG9vcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0LnNldEhvdXJzKDIzKSwgdC5zZXRNaW51dGVzKDU5KSwgdC5zZXRTZWNvbmRzKDU5KSwgJ3cnID09PSBlICYmIChuID0gNiAtIHQuZ2V0RGF5KCkpLCAnbScgPT09IGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gdC5nZXRNb250aCgpICsgMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQuZ2V0RnVsbFllYXIoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbmV3IERhdGUoYSB8fCAxOTcwLCBuIHx8IDEsIDApLmdldERhdGUoKSAtIHQuZ2V0RGF0ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuc2V0RGF0ZSh0LmdldERhdGUoKSArIG4pLCAneScgPT09IGUgJiYgKHQuc2V0TW9udGgoMTEpLCB0LnNldERhdGUoMzEpKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGkubXYgJiYgKGUubWFuYWdlVmFycyA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWFbZV0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQgfHwgJycsIG4gPSBuIHx8ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGksIHIgPSAncGFnZU5hbWUscHVyY2hhc2VJRCxjaGFubmVsLHNlcnZlcixwYWdlVHlwZSxjYW1wYWlnbixzdGF0ZSx6aXAsZXZlbnRzLHByb2R1Y3RzLHRyYW5zYWN0aW9uSUQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMTsgNzYgPiBpOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciArPSAnLHByb3AnICsgaTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDE7IDI1MSA+IGk7IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByICs9ICcsZVZhcicgKyBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMTsgNiA+IGk7IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByICs9ICcsaGllcicgKyBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMTsgNCA+IGk7IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByICs9ICcsbGlzdCcgKyBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpIGluIGEuY29udGV4dERhdGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciArPSAnLGNvbnRleHREYXRhLicgKyBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gdC5yZXBsYWNlKCdbXCcnLCAnLicpLnJlcGxhY2UoJ1wnXScsICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmICgwID09IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh4IGluICh0ID0gdC5zcGxpdCgnLCcpLCBuID0gci5zcGxpdCgnLCcpLCByID0gJycsIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh5IGluICgnc3RyaW5nJyA9PSB0eXBlb2YgdFt4XSAmJiAtMSA8IHRbeF0uaW5kZXhPZignY29udGV4dERhdGEnKSAmJiAodFt4XSA9ICdjb250ZXh0RGF0YS4nICsgdFt4XS5zcGxpdCgnXCcnKVsxXSksIG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbeF0gPT09IG5beV0gJiYgKG5beV0gPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoeSBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciArPSBuW3ldID8gJywnICsgblt5XSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5wdChyLCAnLCcsIGUsIDApLCAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhKCcnICE9PSB0IHx8ICFuIHx8IChhLnB0KHIsICcsJywgZSwgMCksIDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5sb3dlckNhc2VWYXJzID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbZV0gJiYgKCdldmVudHMnICE9PSBlICYmIC0xID09PSBlLmluZGV4T2YoJ2NvbnRleHREYXRhJykgPyAodFtlXSA9IHRbZV0udG9TdHJpbmcoKSwgMCAhPT0gdFtlXS5pbmRleE9mKCdEPScpICYmICh0W2VdID0gdFtlXS50b0xvd2VyQ2FzZSgpKSkgOiAtMSA8IGUuaW5kZXhPZignY29udGV4dERhdGEnKSAmJiAoZSA9IGUuc3Vic3RyaW5nKGUuaW5kZXhPZignLicpICsgMSksIHQuY29udGV4dERhdGFbZV0gJiYgKHQuY29udGV4dERhdGFbZV0gPSB0LmNvbnRleHREYXRhW2VdLnRvU3RyaW5nKCkudG9Mb3dlckNhc2UoKSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcy5jbGVhblN0ciA9IHdpbmRvdy5jbGVhblN0cik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGNvbXBhbnk6IHsgb3JnSWQ6ICdDQ0JDODc5RDU1NzIwNzBFN0YwMDAxMDFAQWRvYmVPcmcnIH0sCiAgICAgICAgICAgIHByb3BlcnR5OiB7CiAgICAgICAgICAgICAgICBuYW1lOiAnQW1hem9uIEhSJywKICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAnYW1hem9uLmpvYnMnLAogICAgICAgICAgICAgICAgICAgICAgICAnYml6emFiby5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAnYW1hem9uY2FyZWVyZGF5LmNvbScsCiAgICAgICAgICAgICAgICAgICAgICAgICdldmVudHMuYml6emFiby5jb20nLAogICAgICAgICAgICAgICAgICAgICAgICAncGFzc3BvcnQuYW1hem9uLndvcmsnCiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICB1bmRlZmluZWRWYXJzUmV0dXJuRW1wdHk6ICExLAogICAgICAgICAgICAgICAgICAgIHJ1bGVDb21wb25lbnRTZXF1ZW5jaW5nRW5hYmxlZDogITEKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBpZDogJ1BSZTUyMDljOWM3MzkxNDhkYWI5ODI0ODU0M2QxMDVjNWUnCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIHJ1bGVzOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDllOGViNzE0YTQ5NzQ0ZjA5YzYyYmE5NDNjN2U0ZGExJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY29udGVudDpTaXRlRXJyb3InLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3NpdGVFcnJvcicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIxMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OlNpdGVFcnJvciUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQzOCcgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdFcnJvciBPY2N1cmVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwyZjVjYjZmOWM0ZDA0MTk1YTcwMDdkMGQwMDVlOGE5YicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ0NaIExhbmRpbmcgUGFnZSAtIEZCIFBpeGVsJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuYW1hem9uLmpvYnMvY3MvbGFuZGluZ19wYWdlcy9wcmFjZScgPT0gZG9jdW1lbnQubG9jYXRpb24uaHJlZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ1xuPCEtLSBGYWNlYm9vayBQaXhlbCBDb2RlIC0tPlxuPHNjcmlwdD5cbiFmdW5jdGlvbihmLGIsZSx2LG4sdCxzKVxue2lmKGYuZmJxKXJldHVybjtuPWYuZmJxPWZ1bmN0aW9uKCl7bi5jYWxsTWV0aG9kP1xubi5jYWxsTWV0aG9kLmFwcGx5KG4sYXJndW1lbnRzKTpuLnF1ZXVlLnB1c2goYXJndW1lbnRzKX07XG5pZighZi5fZmJxKWYuX2ZicT1uO24ucHVzaD1uO24ubG9hZGVkPSEwO24udmVyc2lvbj1cJzIuMFwnO1xubi5xdWV1ZT1bXTt0PWIuY3JlYXRlRWxlbWVudChlKTt0LmFzeW5jPSEwO1xudC5zcmM9djtzPWIuZ2V0RWxlbWVudHNCeVRhZ05hbWUoZSlbMF07XG5zLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKHQscyl9KHdpbmRvdywgZG9jdW1lbnQsXCdzY3JpcHRcJyxcblwnaHR0cHM6Ly9jb25uZWN0LmZhY2Vib29rLm5ldC9lbl9VUy9mYmV2ZW50cy5qc1wnKTtcbmZicShcJ2luaXRcJywgXCc4NDI1Njk5NDI2MDUwMThcJyk7XG5mYnEoXCd0cmFja1wnLCBcJ1BhZ2VWaWV3XCcpO1xuPC9zY3JpcHQ+XG48bm9zY3JpcHQ+PGltZyBoZWlnaHQ9IjEiIHdpZHRoPSIxIiBzdHlsZT0iZGlzcGxheTpub25lIlxuc3JjPSJodHRwczovL3d3dy5mYWNlYm9vay5jb20vdHI/aWQ9ODQyNTY5OTQyNjA1MDE4JmV2PVBhZ2VWaWV3Jm5vc2NyaXB0PTEiXG4vPjwvbm9zY3JpcHQ+XG48IS0tIEVuZCBGYWNlYm9vayBQaXhlbCBDb2RlIC0tPlxuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2h0bWwnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmYTM3ZmY0YjZmNTA0NThiOTMxY2UzNTQ2ODNiOGZiOScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ0pvYkFwcGxpY2F0aW9uOlJlbGF0ZWRKb2JDbGlja3MnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ1JlbGF0ZWRKb2JDbGlja3MnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYklEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYk5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjIwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYkNhdGVnb3J5JScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JEaXZpc2lvbiUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMzcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iQ291bnRyeSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNTgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246YXBwbGljYXRpb25UeXBlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI2MCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVKb2IgUm9sZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyODAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246aGlyaW5nWWVhciUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MTI2JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1JlbGF0ZWRKb2JDbGlja3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGMyNjJjYjk1M2ZmMjQ0NzdiY2YyMTE2MmIxMmE4YTUyJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAncGFzc3BvcnQ6U29jaWFsTG9naW5FeGlzdGluZ0FjY291bnRMaW5rZWQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3Bhc3Nwb3J0U29jaWFsTG9naW5FeGlzdGluZ0FjY291bnRMaW5rZWQnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6UGFnZU5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDp1c2VyVHlwZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMzAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDp1c2VySUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjE0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNhbXBhaWduJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3A0MCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVwYXNzcG9ydEV2ZW50UGFyYW1zJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDczJyB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbDogJyVjb250ZW50OlNpdGVTZWN0aW9uJScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VOYW1lOiAnJWNvbnRlbnQ6UGFnZU5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1Bhc3Nwb3J0IEV2ZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMOGFlMTlhMmRkMzEyNDFkNWE3YTY2YTc2ZjMzNjVkMzUnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdqb2JBcGxpY2F0aW9uRmxvdycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnYXBwX2Zvcm1fc2F2ZScgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5saW5rVHJhY2tWYXJzID0gJ2VWYXIxLGVWYXIyLGVWYXIzNCxlVmFyMzUsZVZhcjM2LGVWYXIxMCxldmVudHMnLCB0LmxpbmtUcmFja0V2ZW50cyA9ICdldmVudDEzJywgdC5lVmFyMzQgPSBfc2F0ZWxsaXRlLmdldFZhcignRm9ybSA6IGZvcm1JbmRleCcpICsgMSwgdC5lVmFyMzUgPSBfc2F0ZWxsaXRlLmdldFZhcignRm9ybSA6IGZvcm1UaXRsZScpLCB0LmVWYXIzNiA9IHQuZVZhcjM0ICsgJ3wnICsgdC5lVmFyMzUsICdSRVNVTUUnID09IF9zYXRlbGxpdGUuZ2V0VmFyKCdGb3JtIDogZm9ybVRpdGxlJykgJiYgKHQuZVZhcjEwID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ2pvYkFwcGxpY2F0aW9uOnJlc3VtZVR5cGUnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYklEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYk5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjI4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6cGVyc29uSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjM3JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWV2ZW50OmpvYkNvdW50cnklJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDEzJyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0pvYiBBcHBsaWNhdGlvbiBGbG93JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw2MWVmODhhOWViNDM0ZjBjYmZlNjE3OGYxYmVkZTgyOCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2pvYkFwcGxpY2F0aW9uOmZvcm1FcnJvcicsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnZm9ybUVycm9yc0pvYkFwcGxpY2F0aW9uJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjI4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6cGVyc29uSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50NDAnIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnSm9iIEFwcGxpY2F0aW9uIC0gRm9ybSBFcnJvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMjMxNjkzNjVkMTVlNDE3OGE1YzMyMjY5OGNjNmMwNTEnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdKb2JTZWFyY2g6U29ydGluZycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnc2VhcmNoU29ydEJ5JyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjE5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJUpvYlNlYXJjaDpTb3J0QnklJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MzYnIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnSm9iIFNlYXJjaCBTb3J0aW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw5MTBjMWQ5YjVjYzc0YjM1ODcyNjBkNjRmMGFlMjNhZicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ0pvYkFwcGxpY2F0aW9uOkpvYkFwcGx5TW9kYWxDbGlja1Rocm91Z2gnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2pvYkFwcGx5Q2xpY2tUaHJvdWdoJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JDYXRlZ29yeSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iRGl2aXNpb24lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDk1JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0pvYiBBcHBseSBNb2RhbCBDbGljayBUaHJvdWdoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmNDJmY2FiYTE1NGM0ZDE0OWE4NDY5NzczOGU4MTI0OScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1NLIExhbmRpbmcgUGFnZSAtIFNLTElLJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuYW1hem9uLmpvYnMvZW4vbGFuZGluZ19wYWdlcy9wcmFjYS12LWxvZ2lzdGlrZScgPT0gZG9jdW1lbnQubG9jYXRpb24uaHJlZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJzxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij5cblx0LyogPCFbQ0RBVEFbICovXG5cdHZhciBzZXpuYW1fcmV0YXJnZXRpbmdfaWQgPSA1NjMwNjtcblx0LyogXV0+ICovXG48L3NjcmlwdD5cbjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0IiBzcmM9Ii8vYy5pbWVkaWEuY3ovanMvcmV0YXJnZXRpbmcuanMiPjwvc2NyaXB0PlxuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2h0bWwnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwyYTMyMzFlODMzODE0NGViYmM2Njc4ZTVkOWZlYjRmZicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1NNUyAtU2F2ZSBOdW1iZXIgYW5kIFZlcmlmeSBMYXRlcicsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnU01TIFNhdmUgTnVtYmVyIGFuZCBWZXJpZnkgTGF0ZXInIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0cmFja2VyUHJvcGVydGllczogeyBldmVudHM6IFt7IG5hbWU6ICdldmVudDEzNycgfV0gfSB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdTTVMgU2F2ZSBOdW1iZXIgYW5kIFZlcmlmeSBMYXRlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYjliYWVhOGJlOWViNDY3MjhmZTVmOTdhZTUyN2YzNDMnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICd1bnN1YnNjcmliZTphbHJlYWR5VW5zdWJzY3JpYmVkJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdhbHJlYWR5VW5zdWJzY3JpYmVkJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIzOScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVPcHQgT3V0OiBTeXN0ZW0lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjQwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJU9wdCBPdXQ6IFNvdXJjZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNDEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclT3B0IE91dDogQmVhbWVyeSBDYW1wYWlnbiBJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNDInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclT3B0IE91dDogQmVhbWVyeSBDb252ZXJzYXRpb24gSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDU0JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0FscmVhZHkgVW5zdWJzY3JpYmVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxiNjk5Njc0NmY4MDg0MDM4YjVmZGVlMzBhMDU1NjMxNycsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1VzZXI6IFJlZ2lzdHJhdGlvbiBTdGFydCcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAncmVnaXN0cmF0aW9uU3RhcnQnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0cmFja2VyUHJvcGVydGllczogeyBldmVudHM6IFt7IG5hbWU6ICdldmVudDE3JyB9XSB9IH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1JlZ2lzdHJhdGlvbiBTdGFydCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMWMxZjU5YjNkMWEyNDlhMjk4ZTczZGMwNjZhNzkzMjgnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdTTVMgU3VjY2Vzc2Z1bCBWZXJpZmljYXRpb25zJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdWZXJpZmljYXRpb24tU3VjY2VzcycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjg5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVVzZXIgU3RhdHVzJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI5OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVTTVM6U3RlcG5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDEyMCcgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdTTVMgLSBWZXJpZmljYXRpb24tU3VjY2VzcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMY2U3NzViNmUzNmRmNDAzOTlhYzQ3ZmYyMDBjYWNlMzYnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdDb25zZW50IC0gQ3VzdG9taXplIENvb2tpZSBDbGljaycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcjYnRuLWN1c3RvbWl6ZS1jb29raWVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZQYXJlbnQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZkNoaWxkRmlyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IFZpc2l0b3IuZ2V0SW5zdGFuY2UoJ0NDQkM4NzlENTU3MjA3MEU3RjAwMDEwMUBBZG9iZU9yZycpLmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmICh0LmVWYXI2ID0gbiksIHQubGlua1RyYWNrVmFycyA9ICdldmVudHMsZVZhcjYsZVZhcjUscHJvcDEzJywgdC5saW5rVHJhY2tFdmVudHMgPSAnZXZlbnQ5MSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6UGFnZU5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjI4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6cGVyc29uSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDEzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVBhZ2UgVVJMJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDkxJyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0NvbnNlbnQgRm9ybS1DdXN0b21pemUgQ29va2llIEJ1dHRvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNmQ1ZGJkMzc2OGY2NDhiNWE5YTg2NGM5MTYyMDlmM2UnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdTTVMgLSBDb25zaWRlckZvck90aGVySm9iT3Bwb3J0dW5pdGllc09wdGlvblNlbGVjdGVkJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdDb25zaWRlckZvck90aGVySm9iT3Bwb3J0dW5pdGllc09wdGlvblNlbGVjdGVkJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjk4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVNNUyAtIE9wdGlvbiBTZWxlY3RlZCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQxMTknIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnQ29uc2lkZXJGb3JPdGhlckpvYk9wcG9ydHVuaXRpZXNPcHRpb25TZWxlY3RlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNzYwODQxNTM4MjkzNDE5YTlhZWFiMGYxOWY2NzlmODcnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdcdTIwMjJcdExvZ2luIHdpdGggQW1hem9uIGluaXRpYWxpemF0aW9uJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9jbGljay5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW1lbnRTZWxlY3RvcjogJyNidG4tbHdhLWluaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gVmlzaXRvci5nZXRJbnN0YW5jZSgnNEVFMUJCNjU1NUY5MzY5QTdGMDAwMTAxQEFkb2JlT3JnJykuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgKHQuZVZhcjYgPSBuKSwgdC5saW5rVHJhY2tWYXJzID0gJ2V2ZW50cyxlVmFyNixlVmFyNSxwcm9wMTMnLCB0LmxpbmtUcmFja0V2ZW50cyA9ICdldmVudDkyJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6UGFnZU5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMTMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclUGFnZSBVUkwlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50OTInIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnQ29uc2VudCBGb3JtLUN1c3RvbWl6ZSBDb29raWUgQnV0dG9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw3MDJjNDljMjVkNTA0MzgzYWMwZjdhMmJhOWE1NzQ0NicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1NNUyBGbG93IENhbmNlbGxlZCcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnU01TIEZsb3cgQ2FuY2VsbGVkJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyODknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclVXNlciBTdGF0dXMlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjk5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVNNUzpTdGVwbmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MTE0JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1NNUyBGbG93IENhbmNlbGxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZTIxZDg4MjczY2U0NGI1YjhiOTZjNDQ1YmJjMmY2ZjYnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwYXNzcG9ydDpGb3Jnb3RQYXNzd29yZEVycm9yJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdwYXNzcG9ydEZvcmdvdFBhc3N3b3JkRXJyb3InIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0cmFja2VyUHJvcGVydGllczogeyBldmVudHM6IFt7IG5hbWU6ICdldmVudDUwJyB9XSB9IH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1Bhc3Nwb3J0IEV2ZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYzg5NmYyY2UxZTBjNDgwOTgwNzhkM2M4MTM3MDMxNWUnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdqb2JEZXNjcmlwdGlvbjpqb2JWaWV3JywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy92YWx1ZUNvbXBhcmlzb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wYXJpc29uOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wZXJhdG9yOiAnZXF1YWxzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZUluc2Vuc2l0aXZlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVmdE9wZXJhbmQ6ICclY29udGVudDpQYWdlTmFtZSUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpZ2h0T3BlcmFuZDogJ0FtYXpvbi5qb2JzIHwgSm9iIERldGFpbHMgUGFnZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQubGlzdDEgPSBfc2F0ZWxsaXRlLmdldFZhcigncmVsYXRlZEpvYklkJyksIDEgPT0gZGlnaXRhbERhdGEuam9iLnJlbGF0ZWRKb2JJZC5sZW5ndGggJiYgKHQuZXZlbnRzID0gdC5hcGwodC5ldmVudHMsICdldmVudDEyNCcpKSwgdC5saW5rVHJhY2tWYXJzID0gJ2xpc3QxJywgdC5saW5rVHJhY2tFdmVudHMgPSAnZXZlbnQxMjQnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYkZpbmRpbmdNZXRob2QlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjIwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYkNhdGVnb3J5JScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JEaXZpc2lvbiUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpwZXJzb25JRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50NScgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmY2YyZWMzNDI0OTg0ODljODdiZTg5MjFlMGFmMTMwZCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ0NvbnNlbnQgLSBDb29raWUgQWNjZXB0IEZvcm0nLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnI2J0bi1hY2NlcHQtY29va2llcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmUGFyZW50OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBidWJibGVGaXJlSWZDaGlsZEZpcmVkOiAhMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBWaXNpdG9yLmdldEluc3RhbmNlKCdDQ0JDODc5RDU1NzIwNzBFN0YwMDAxMDFAQWRvYmVPcmcnKS5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiAmJiAodC5lVmFyNiA9IG4pLCB0LmxpbmtUcmFja1ZhcnMgPSAnZXZlbnRzLGVWYXI2LGVWYXI1LHByb3AxMycsIHQubGlua1RyYWNrRXZlbnRzID0gJ2V2ZW50OTAnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpQYWdlTmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3AxMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVQYWdlIFVSTCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ5MCcgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdDb25zZW50IEZvcm0gLSBDb29raWUgQWNjZXB0IEFsbCBCdXR0b24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDY4NTI0YzcyZmUzNTRiMDBhN2VmNDE2NGMyYjZjOTA5JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnU0sgTGFuZGluZyBQYWdlIC0gR2xvYmFsIFJNSycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvcGFnZUJvdHRvbS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2h0dHBzOi8vd3d3LmFtYXpvbi5qb2JzL2VuL2xhbmRpbmdfcGFnZXMvcHJhY2Etdi1sb2dpc3Rpa2UnID09IGRvY3VtZW50LmxvY2F0aW9uLmhyZWYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICc8IS0tIEdsb2JhbCBzaXRlIHRhZyAoZ3RhZy5qcykgLSBHb29nbGUgQWRzOiA3OTU2NzQ1NjAgLS0+XG48c2NyaXB0IGFzeW5jIHNyYz0iaHR0cHM6Ly93d3cuZ29vZ2xldGFnbWFuYWdlci5jb20vZ3RhZy9qcz9pZD1BVy03OTU2NzQ1NjAiPjwvc2NyaXB0PlxuPHNjcmlwdD5cbiAgd2luZG93LmRhdGFMYXllciA9IHdpbmRvdy5kYXRhTGF5ZXIgfHwgW107XG4gIGZ1bmN0aW9uIGd0YWcoKXtkYXRhTGF5ZXIucHVzaChhcmd1bWVudHMpO31cbiAgZ3RhZyhcJ2pzXCcsIG5ldyBEYXRlKCkpO1xuXG4gIGd0YWcoXCdjb25maWdcJywgXCdBVy03OTU2NzQ1NjBcJyk7XG48L3NjcmlwdD5cbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdodG1sJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMjZkYmZmMGVmNzFmNGU2ZjliNzgyNzMyOGRjZjg0MTcnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdDWiBMYW5kaW5nIFBhZ2UgLSBHVGFnJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuYW1hem9uLmpvYnMvY3MvbGFuZGluZ19wYWdlcy9wcmFjZScgPT0gZG9jdW1lbnQubG9jYXRpb24uaHJlZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ1xuPHNjcmlwdD5cbiAgZ3RhZyhcJ2V2ZW50XCcsIFwncGFnZV92aWV3XCcsIHtcbiAgICBcJ3NlbmRfdG9cJzogXCdBVy03OTU2NzQ1NjBcJyxcbiAgICBcJ3ZhbHVlXCc6IFwncmVwbGFjZSB3aXRoIHZhbHVlXCcsXG4gICAgXCdpdGVtc1wnOiBbe1xuICAgICAgXCdpZFwnOiBcJ3JlcGxhY2Ugd2l0aCB2YWx1ZVwnLFxuICAgICAgXCdsb2NhdGlvbl9pZFwnOiBcJ3JlcGxhY2Ugd2l0aCB2YWx1ZVwnLFxuICAgICAgXCdnb29nbGVfYnVzaW5lc3NfdmVydGljYWxcJzogXCdqb2JzXCdcbiAgICB9XVxuICB9KTtcbjwvc2NyaXB0PicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdodG1sJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYzlmNDFhOTNkZjNhNGI3MDg1Y2U2ZjUxZjEyMzVkNzgnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwYXNzcG9ydDpGb3Jnb3RQYXNzd29yZFN1Y2Nlc3MnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3Bhc3Nwb3J0Rm9yZ290UGFzc3dvcmRTdWNjZXNzJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHJhY2tlclByb3BlcnRpZXM6IHsgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ0OScgfV0gfSB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdQYXNzcG9ydCBFdmVudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGZkMDUxMDFkMWQzOTRjOTBhZjA1NDEzY2E3YWE5NTA2JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAncGFzc3BvcnQ6TG9naW5GYWlsdXJlJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdwYXNzcG9ydExvZ2luRmFpbHVyZScgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3AyNicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVldmVudC5kZXRhaWwuZXZlbnREZXRhaWwlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50NDMnIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnUGFzc3BvcnQgRXZlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwxNTQ0ZGE5NDdkMmY0ODJiODRjNGExZjg3NzJkY2U2MCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Bhc3Nwb3J0OlVwZGF0ZVBhc3N3b3JkU3VjY2VlZGVkJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdwYXNzcG9ydFVwZGF0ZVBhc3N3b3JkU3VjY2VlZGVkJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHJhY2tlclByb3BlcnRpZXM6IHsgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ0NycgfV0gfSB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdQYXNzcG9ydCBFdmVudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDkzOWQ4ZjJkZTU2ZDQ5YjJhODgyZDU0YWJlYTFiMjQ1JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnRW1haWwgVmVyaWZ5IGJ1dHRvbicsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvY2xpY2suanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtZW50U2VsZWN0b3I6ICcuYnRuLmJ0bi1tYWluLmJ0bi5idG4tZGVmYXVsdC5idG4tYmxvY2snLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gVmlzaXRvci5nZXRJbnN0YW5jZSgnNEVFMUJCNjU1NUY5MzY5QTdGMDAwMTAxQEFkb2JlT3JnJykuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgKHQuZVZhcjYgPSBuKSwgdC5saW5rVHJhY2tWYXJzID0gJ2V2ZW50cyxlVmFyNixlVmFyNSxwcm9wMTMnLCB0LmxpbmtUcmFja0V2ZW50cyA9ICdldmVudDExMSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OlBhZ2VOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDEzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVBhZ2UgVVJMJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDExMScgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdFbWFpbCBWZXJpZnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGQwNDA3YWFkMGU0ODRlNTZhMmIxNDZjOTQzMDk5MDQyJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAncGFzc3BvcnQ6Rm9yZ290UGFzc3dvcmRSZXF1ZXN0JywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdwYXNzcG9ydEZvcmdvdFBhc3N3b3JkUmVxdWVzdCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHRyYWNrZXJQcm9wZXJ0aWVzOiB7IGV2ZW50czogW3sgbmFtZTogJ2V2ZW50NDgnIH1dIH0gfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnUGFzc3BvcnQgRXZlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwzZjQ3YWJiMTUzNWI0ZjQ3OTQzN2FmY2Y0OWNkMGJlYicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Bhc3Nwb3J0OkxvZ2luU3VjY2VzcycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAncGFzc3BvcnRMb2dpblN1Y2Nlc3MnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpwZXJzb25JRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ0NCcgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdQYXNzcG9ydCBFdmVudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGZiZmJmY2YwNTAwNTQwM2VhN2E0YTY3NzRjNDlmYmVmJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnam9iRGVzY3JpcHRpb246am9iU2hhcmUnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2pvYlNoYXJlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iU2hhcmVTb2NpYWxNZWRpYSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ2JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0pvYiBTaGFyZSBvbiBTb2NpYWwgTWVkaWEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGJmYTM5M2RiZDVlZjQ3NDhiMmUzN2Q1MjQ3NTQ1MTNmJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY29tbXVuaWNhdGlvblByZWZlcmVuY2VzOnN1YnNjcmliZScsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnY29tbXVuaWNhdGlvblByZWZlcmVuY2VzU3Vic2NyaWJlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMzknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclT3B0IE91dDogU3lzdGVtJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI0MCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVPcHQgT3V0OiBTb3VyY2UlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjQxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJU9wdCBPdXQ6IEJlYW1lcnkgQ2FtcGFpZ24gSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjQyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJU9wdCBPdXQ6IEJlYW1lcnkgQ29udmVyc2F0aW9uIElEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ1MicgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdDb21tdW5pY2F0aW9uIFByZWZlcmVuY2VzIFN1YnNjcmliZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMDc3ZGU4ZjQxYzU2NDc4MGEyNTc3NmZjYjFkNDAxNjknLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdGb3JtOkZvcm1TdGFydCcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnZm9ybVN0YXJ0JyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjE4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJUZvcm06IEZvcm1OYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDEwJyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0Zvcm0gU3RhcnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGE5MmU1Mzg1NzJmYTRmY2E5YjVkZjg0NjYxOWI5ZWRmJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnU01TIEVuYWJsZSBTTVMgVXBkYXRlcycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnRW5hYmxlIFNNUyBVcGRhdGVzJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjk5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVNNUzpTdGVwbmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQxMzAnIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnU01TIEVuYWJsZSBTTVMgVXBkYXRlcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMOTkyMTIyY2UyZjg5NDE2MTkxMjVjYWJjMDA0ZDQxZTInLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdqb2JBcHBsaWNhdGlvbjpqb2IgcmVzdW1lJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdkYXNoX3Jlc3VtZV9hcHAnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYklEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYk5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjIwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYkNhdGVnb3J5JScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JEaXZpc2lvbiUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpwZXJzb25JRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMzcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclZXZlbnQ6am9iQ291bnRyeSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNDMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iQnVzaW5lc3NQdXJwb3NlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQyNycgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdKb2IgQXBwbGljYXRpb24gLSBSZXN1bWUgdGhlIGZsb3cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGY1NTAxMDYxNzMyZDRlOTg5M2IxOTEzMmRjOTY3ZDBlJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnam9iQXBwbGljYXRpb246am9iQXBwbGljYXRpb25Db21wbGV0ZS0gU3VjY2VzcyBQYWdlJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdqb2JBcHBsaWNhdGlvbkNvbXBsZXRlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyOCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnBlcnNvbklEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIzMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JBcHBsaWNhdGlvbjphcHBsaWNhdGlvbklkJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIzNycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVldmVudDpqb2JDb3VudHJ5JScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI0MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JCdXNpbmVzc1B1cnBvc2UlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDknIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnSm9iIEFwcGxpY2F0aW9uIENvbXBsZXRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxkNzFlNzY1ZjM0Zjg0NTI2ODE1YTk3MzkzMmE5NGU3ZCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1NNUyAtIERpdmVyZ2VudE51bWJlckFjdGlvbkNsaWNrZWQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ0RpdmVyZ2VudE51bWJlckFjdGlvbkNsaWNrZWQnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZGlnaXRhbERhdGEuZXZlbnREYXRhLmFjdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuZVZhcjg4ID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQxMzEnIH1dIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0RpdmVyZ2VudE51bWJlckFjdGlvbkNsaWNrZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGJmNzA3ZDhhYTAwNTQ3NWI4ZjIxNzE1ZGE5YmRiODA0JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnU01TIC0gU01TT3B0ZWQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ1NNU09wdGVkJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjU2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVNNUyAtIEV2ZW50IC0gc21zT3B0ZWRJbiUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQxMTcnIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnU01TT3B0ZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDBkZGQzOTEyN2FkNDRiZjdhNGRjY2RlNmUzZTNhMWMyJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnSm9iIHBhZ2UgLSBOb3QgZm9yIG1lIGJ1dHRvbicsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnSm9iTm90Rm9yTWUnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ5MycgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdKb2IgTm90IEZvciBNZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMTFiZGY2M2FmNmY2NDlkOWI5YWU3ODkzN2Y3YThjNTInLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdKb2JBcHBsaWNhdGlvbjpjZW50cmFsaXplZEhpcmluZ0FwcGx5JywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdjZW50cmFsaXplZEhpcmluZ0FwcGx5JyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JDYXRlZ29yeSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iRGl2aXNpb24lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjM3JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYkNvdW50cnklJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjU4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnQ2VudHJhbGl6ZWQgSGlyaW5nIFByb2Nlc3MnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNjAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclSm9iIFJvbGUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjgwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmhpcmluZ1llYXIlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDEyOScgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdDZW50cmFsaXplZCBIaXJpbmcgQXBwbHkgTm93IENsaWNrJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw0YzZlZDQ3YTkyMzA0NWUyOGZhNWZkZTk5NWQ2YmRhZScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Bhc3Nwb3J0OmFzeW5jUGFnZUxvYWQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2FzeW5jUGFnZUxvYWQnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDQwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvc3ViZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3ViZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJ3Bhc3Nwb3J0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICdha2FcXC5jb3JwXFwuYW1hem9uXFwuY29tJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlSXNSZWdleDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghd2luZG93LnNfbG9hZFQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKSwgdCA9IHdpbmRvdy5wZXJmb3JtYW5jZSA/IHBlcmZvcm1hbmNlLnRpbWluZyA6IDAsIG4gPSB0ID8gdC5yZXF1ZXN0U3RhcnQgOiB3aW5kb3cuaW5IZWFkVFMgfHwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc19sb2FkVCA9IG4gPyBNYXRoLnJvdW5kKChlIC0gbikgLyAxMDApIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzX2xvYWRUOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBWaXNpdG9yLmdldEluc3RhbmNlKCc0RUUxQkI2NTU1RjkzNjlBN0YwMDAxMDFAQWRvYmVPcmcnKS5nZXRNYXJrZXRpbmdDbG91ZFZpc2l0b3JJRCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiAodC5lVmFyNiA9IGEpLCB0LnByb3A1ID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIFZpc2l0b3IgPyAnVmlzaXRvckFQSSBQcmVzZW50JyA6ICdWaXNpdG9yQVBJIE1pc3NpbmcnLCB0LnByb3AyID0gJ0Q9dCcsIHdpbmRvdy5sb2NhdGlvbi5ocmVmLmluZGV4T2YoJzQwNCcpID4gMCAmJiAodC5wYWdlVHlwZSA9ICdlcnJvclBhZ2UnKSwgdC5lVmFyMTUgPSB3aW5kb3cubG9jYXRpb24uaG9zdG5hbWUsIHQuZVZhcjE2ID0gd2luZG93LmxvY2F0aW9uLnBhdGhuYW1lLCB0LnByb3AxMyA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLCB0LnByb3AxNCA9IG4oKSwgdC5wcm9wMTcgPSAnRD1qJywgdC5wcm9wMTggPSBkb2N1bWVudC50aXRsZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbG9jYXRpb24uc2VhcmNoLnNwbGl0KCc9JyksIHIgPSBpWzBdLnN1YnN0cigxLCBpWzBdLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnByb3AxOSA9IHIsIHQudXNlUGx1Z2lucyA9ICEwLCB0LmRvUGx1Z2lucyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5VdGlsLmdldFF1ZXJ5UGFyYW0oJ3V0bV9tZWRpdW0nKSAmJiAoZS5lVmFyMTcgPSBlLlV0aWwuZ2V0UXVlcnlQYXJhbSgndXRtX21lZGl1bScpICsgJzonICsgZS5VdGlsLmdldFF1ZXJ5UGFyYW0oJ3V0bV9zb3VyY2UnKSArICc6JyArIGUuVXRpbC5nZXRRdWVyeVBhcmFtKCd1dG1fdGVybScpICsgJzonICsgZS5VdGlsLmdldFF1ZXJ5UGFyYW0oJ3V0bV9jb250ZW50JykpLCBlLmVWYXIxNyA9IGUuZ2V0VmFsT25jZShlLmVWYXIxNywgJ3NfZVZhcjE3JyksIGRpZ2l0YWxEYXRhLnBhZ2Uuc2VhcmNoICYmICdaZXJvJyA9PSBkaWdpdGFsRGF0YS5wYWdlLnNlYXJjaC5ub09mUmVzdWx0cyAmJiAoZS5ldmVudHMgPSBlLmFwbChlLmV2ZW50cywgJ2V2ZW50MzQnLCAnLCcsIDIpKSwgZS5wcm9wMjUgPSBlLmdldERheXNTaW5jZUxhc3RWaXNpdCgnc19sdicpLCBlLnByb3AyMiA9IGUuZ2V0TmV3UmVwZWF0KDMwLCAnc19nZXROZXdSZXBlYXQnKSwgZS5wcm9wMTAgPSBlLmdldFByZXZpb3VzVmFsdWUoZS5wYWdlTmFtZSwgJ2dwdicsICcnKSwgZS5wcm9wMTAgJiYgKGUuZVZhcjI1ID0gJ0Q9YzEwJywgZS5wcm9wMTEgPSBlLmdldFBlcmNlbnRQYWdlVmlld2VkKCksIGUucHJvcDEwICYmICdubyB2YWx1ZScgIT0gZS5wcm9wMTAgfHwgKGUucHJvcDExID0gJycpKSwgZS5lVmFyMzIgPSBlLnByb3AzID0gZS5nZXRUaW1lUGFydGluZygnbicsICctOCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5fdHBEU1QgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxMjogJzQvMSwxMC83JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDEzOiAnNC83LDEwLzYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTQ6ICc0LzYsMTAvNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxNTogJzQvNSwxMC80JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDE2OiAnNC8zLDEwLzInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTc6ICc0LzIsMTAvMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxODogJzQvMSwxMC83JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDE5OiAnNC83LDEwLzYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMjA6ICc0LzUsMTAvNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAyMTogJzQvNCwxMC8zJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5fdHBEU1QgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxMjogJzMvMTEsMTEvNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxMzogJzMvMTAsMTEvMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxNDogJzMvOSwxMS8yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDE1OiAnMy84LDExLzEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTY6ICczLzEzLDExLzYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTc6ICczLzEyLDExLzUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTg6ICczLzExLDExLzQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTk6ICczLzEwLDExLzMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMjA6ICczLzgsMTEvMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAyMTogJzMvMTQsMTEvNycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuX3RwRFNUID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTI6ICczLzI1LDEwLzI4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDEzOiAnMy8zMSwxMC8yNycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxNDogJzMvMzAsMTAvMjYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTU6ICczLzI5LDEwLzI1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDE2OiAnMy8yNywxMC8zMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxNzogJzMvMjYsMTAvMjknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTg6ICczLzI1LDEwLzI4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDE5OiAnMy8zMSwxMC8yNycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAyMDogJzMvMjksMTAvMjUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMjE6ICczLzI4LDEwLzMxJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5nZXRQcmV2aW91c1ZhbHVlID0gbmV3IEZ1bmN0aW9uKCd2JywgJ2MnLCAnZWwnLCAndmFyIHM9dGhpcyx0PW5ldyBEYXRlLGksaixyPVwnXCc7dC5zZXRUaW1lKHQuZ2V0VGltZSgpKzE4MDAwMDApO2lmKGVsKXtpZihzLmV2ZW50cyl7aT1zLnNwbGl0KGVsLFwnLFwnKTtqPXMuc3BsaXQocy5ldmVudHMsXCcsXCcpO2Zvcih4IGluIGkpe2Zvcih5IGluIGope2lmKGlbeF09PWpbeV0pe2lmKHMuY19yKGMpKSByPXMuY19yKGMpO3Y/cy5jX3coYyx2LHQpOnMuY193KGMsXCdubyB2YWx1ZVwnLHQpO3JldHVybiByfX19fX1lbHNle2lmKHMuY19yKGMpKSByPXMuY19yKGMpO3Y/cy5jX3coYyx2LHQpOnMuY193KGMsXCdubyB2YWx1ZVwnLHQpO3JldHVybiByfScpLCB0LnNwbGl0ID0gbmV3IEZ1bmN0aW9uKCdsJywgJ2QnLCAndmFyIGkseD0wLGE9bmV3IEFycmF5O3doaWxlKGwpe2k9bC5pbmRleE9mKGQpO2k9aT4tMT9pOmwubGVuZ3RoO2FbeCsrXT1sLnN1YnN0cmluZygwLGkpO2w9bC5zdWJzdHJpbmcoaStkLmxlbmd0aCk7fXJldHVybiBhJyksIHQuZ2V0UGVyY2VudFBhZ2VWaWV3ZWQgPSBuZXcgRnVuY3Rpb24oJ24nLCAndmFyIHM9dGhpcyxXPXdpbmRvdyxFTD1XLmFkZEV2ZW50TGlzdGVuZXIsQUU9Vy5hdHRhY2hFdmVudCxFPVtcJ2xvYWRcJyxcJ3VubG9hZFwnLFwnc2Nyb2xsXCcsXCdyZXNpemVcJyxcJ3pvb21cJyxcJ2tleXVwXCcsXCdtb3VzZXVwXCcsXCd0b3VjaGVuZFwnLFwnb3JpZW50YXRpb25jaGFuZ2VcJyxcJ3BhblwnXTtXLnNfT2JqPXM7c19QUFZpZD0obj09XCctXCc/cy5wYWdlTmFtZTpuKXx8cy5wYWdlTmFtZXx8bG9jYXRpb24uaHJlZjtpZighVy5zX1BQVmV2ZW50KXtzLnNfUFBWZz1mdW5jdGlvbihuLHIpe3ZhciBrPVwnc19wcHZcJyxwPWsrXCdsXCcsYz1zLmNfcihufHxyP2s6cCksYT1jLmluZGV4T2YoXCcsXCcpPi0xP2Muc3BsaXQoXCcsXCcsMTApOltcJ1wnXSxsPWEubGVuZ3RoLGk7YVswXT11bmVzY2FwZShhWzBdKTtyPXJ8fChuJiZuIT1hWzBdKXx8MDthLmxlbmd0aD0xMDtpZih0eXBlb2YgYVswXSE9XCdzdHJpbmdcJylhWzBdPVwnXCc7Zm9yKGk9MTtpPDEwO2krKylhW2ldPSFyJiZpPGw/cGFyc2VJbnQoYVtpXSl8fDA6MDtpZihsPDEwfHx0eXBlb2YgYVs5XSE9XCdzdHJpbmdcJylhWzldPVwnXCc7aWYocil7cy5jX3cocCxjKTtzLmNfdyhrLFwnP1wnKX1yZXR1cm4gYX07Vy5zX1BQVmV2ZW50PWZ1bmN0aW9uKGUpe3ZhciBXPXdpbmRvdyxEPWRvY3VtZW50LEI9RC5ib2R5LEU9RC5kb2N1bWVudEVsZW1lbnQsUz13aW5kb3cuc2NyZWVufHwwLEhvPVwnb2Zmc2V0SGVpZ2h0XCcsSHM9XCdzY3JvbGxIZWlnaHRcJyxUcz1cJ3Njcm9sbFRvcFwnLFdjPVwnY2xpZW50V2lkdGhcJyxIYz1cJ2NsaWVudEhlaWdodFwnLEM9MTAwLE09TWF0aCxKPVwnb2JqZWN0XCcsTj1cJ251bWJlclwnLHM9Vy5zX09ianx8Vy5zfHwwO2U9ZSYmdHlwZW9mIGU9PUo/ZS50eXBlfHxcJ1wnOlwnXCc7aWYoIWUuaW5kZXhPZihcJ29uXCcpKWU9ZS5zdWJzdHJpbmcoMik7c19QUFZpPVcuc19QUFZpfHwwO2lmKFcuc19QUFZ0JiYhZSl7Y2xlYXJUaW1lb3V0KHNfUFBWdCk7c19QUFZ0PTA7aWYoc19QUFZpPDIpc19QUFZpKyt9aWYodHlwZW9mIHM9PUope3ZhciBoPU0ubWF4KEJbSHNdfHxFW0hzXSxCW0hvXXx8RVtIb10sQltIY118fEVbSGNdKSxYPVcuaW5uZXJXaWR0aHx8RVtXY118fEJbV2NdfHwwLFk9Vy5pbm5lckhlaWdodHx8RVtIY118fEJbSGNdfHwwLHg9Uz9TLndpZHRoOjAseT1TP1MuaGVpZ2h0OjAscj1NLnJvdW5kKEMqKFcuZGV2aWNlUGl4ZWxSYXRpb3x8MSkpL0MsYj0oRC5wYWdlWU9mZnNldHx8RVtUc118fEJbVHNdfHwwKStZLHA9aD4wJiZiPjA/TS5yb3VuZChDKmIvaCk6MCxPPVcub3JpZW50YXRpb24sbz0haXNOYU4oTyk/TS5hYnMobyklMTgwOlk+WD8wOjkwLEw9ZT09XCdsb2FkXCd8fHNfUFBWaTwxLGE9cy5zX1BQVmcoc19QUFZpZCxMKSxWPWZ1bmN0aW9uKGksdixmLG4pe2k9cGFyc2VJbnQodHlwZW9mIGE9PUomJmEubGVuZ3RoPmk/YVtpXTpcJzBcJyl8fDA7dj10eXBlb2YgdiE9Tj9pOnY7dj1mfHx2Pmk/djppO3JldHVybiBuP3Y6dj5DP0M6djwwPzA6dn07aWYobmV3IFJlZ0V4cChcJyhpUG9kfGlQYWR8aVBob25lKVwnKS5leGVjKG5hdmlnYXRvci51c2VyQWdlbnR8fFwnXCcpJiZvKXtvPXg7eD15O3k9b31vPW8/XCdQXCc6XCdMXCc7YVs5XT1MP1wnXCc6YVs5XS5zdWJzdHJpbmcoMCwxKTtzLmNfdyhcJ3NfcHB2XCcsZXNjYXBlKFcuc19QUFZpZCkrXCcsXCcrVigxLHAsTCkrXCcsXCcrKEx8fCFWKDIpP3A6VigyKSkrXCcsXCcrVigzLGIsTCwxKStcJyxcJytYK1wnLFwnK1krXCcsXCcreCtcJyxcJyt5K1wnLFwnK3IrXCcsXCcrYVs5XSsoYVs5XT09bz9cJ1wnOm8pKX1pZighVy5zX1BQVnQmJmUhPVwndW5sb2FkXCcpVy5zX1BQVnQ9c2V0VGltZW91dChXLnNfUFBWZXZlbnQsMzMzKX07Zm9yKHZhciBmPVcuc19QUFZldmVudCxpPTA7aTxFLmxlbmd0aDtpKyspaWYoRUwpRUwoRVtpXSxmLGZhbHNlKTtlbHNlIGlmKEFFKUFFKFwnb25cJytFW2ldLGYpO2YoKX07dmFyIGE9cy5zX1BQVmcoKTtyZXR1cm4hbnx8bj09XCctXCc/YVsxXTphJyksIHQuZ2V0VGltZVBhcnRpbmcgPSBuZXcgRnVuY3Rpb24oJ2gnLCAneicsICd2YXIgcz10aGlzLG9kO29kPW5ldyBEYXRlKFwnMS8xLzIwMDBcJyk7aWYob2QuZ2V0RGF5KCkhPTZ8fG9kLmdldE1vbnRoKCkhPTApe3JldHVyblwnRGF0YSBOb3QgQXZhaWxhYmxlXCc7fWVsc2V7dmFyIEgsTSxELFUsZHMsZGUsdG0sZGE9W1wnU3VuZGF5XCcsXCdNb25kYXlcJyxcJ1R1ZXNkYXlcJyxcJ1dlZG5lc2RheVwnLFwnVGh1cnNkYXlcJyxcJ0ZyaWRheVwnLFwnU2F0dXJkYXlcJ10sZD1uZXcgRGF0ZSgpO3o9ej96OjA7ej1wYXJzZUZsb2F0KHopO2lmKHMuX3RwRFNUKXt2YXIgZHNvPXMuX3RwRFNUW2QuZ2V0RnVsbFllYXIoKV0uc3BsaXQoLywvKTtkcz1uZXcgRGF0ZShkc29bMF0rXCcvXCcrZC5nZXRGdWxsWWVhcigpKTtkZT1uZXcgRGF0ZShkc29bMV0rXCcvXCcrZC5nZXRGdWxsWWVhcigpKTtpZihoPT1cJ25cJyYmZD5kcyYmZDxkZSl7ej16KzE7fWVsc2UgaWYoaD09XCdzXCcmJihkPmRlfHxkPGRzKSl7ej16KzE7fX1kPWQuZ2V0VGltZSgpKyhkLmdldFRpbWV6b25lT2Zmc2V0KCkqNjAwMDApO2Q9bmV3IERhdGUoZCsoMzYwMDAwMCp6KSk7SD1kLmdldEhvdXJzKCk7TT1kLmdldE1pbnV0ZXMoKTtNPShNPDEwKT9cJzBcJytNOk07RD1kLmdldERheSgpO1U9XCcgQU1cJztpZihIPj0xMil7VT1cJyBQTVwnO0g9SC0xMjt9aWYoSD09MCl7SD0xMjt9RD1kYVtEXTt0bT1IK1wnOlwnK00rVTtyZXR1cm4odG0rXCd8XCcrRCk7fScpLCB0LmdldE5ld1JlcGVhdCA9IG5ldyBGdW5jdGlvbignZCcsICdjbicsICd2YXIgcz10aGlzLGU9bmV3IERhdGUoKSxjdmFsLHN2YWwsY3Q9ZS5nZXRUaW1lKCk7ZD1kP2Q6MzA7Y249Y24/Y246XCdzX25yXCc7ZS5zZXRUaW1lKGN0K2QqMjQqNjAqNjAqMTAwMCk7Y3ZhbD1zLmNfcihjbik7aWYoY3ZhbC5sZW5ndGg9PTApe3MuY193KGNuLGN0K1wnLU5ld1wnLGUpO3JldHVyblwnTmV3XCc7fXN2YWw9cy5zcGxpdChjdmFsLFwnLVwnKTtpZihjdC1zdmFsWzBdPDMwKjYwKjEwMDAmJnN2YWxbMV09PVwnTmV3XCcpe3MuY193KGNuLGN0K1wnLU5ld1wnLGUpO3JldHVyblwnTmV3XCc7fWVsc2V7cy5jX3coY24sY3QrXCctUmVwZWF0XCcsZSk7cmV0dXJuXCdSZXBlYXRcJzt9JyksIHQuc3BsaXQgPSBuZXcgRnVuY3Rpb24oJ2wnLCAnZCcsICd2YXIgaSx4PTAsYT1uZXcgQXJyYXk7d2hpbGUobCl7aT1sLmluZGV4T2YoZCk7aT1pPi0xP2k6bC5sZW5ndGg7YVt4KytdPWwuc3Vic3RyaW5nKDAsaSk7bD1sLnN1YnN0cmluZyhpK2QubGVuZ3RoKTt9cmV0dXJuIGEnKSwgdC5nZXRWYWxPbmNlID0gbmV3IEZ1bmN0aW9uKCd2JywgJ2MnLCAnZScsICd0JywgJ3ZhciBzPXRoaXMsYT1uZXcgRGF0ZSx2PXY/djpcJ1wnLGM9Yz9jOlwnc19ndm9cJyxlPWU/ZTowLGk9dD09XCdtXCc/NjAwMDA6ODY0MDAwMDAsaz1zLmNfcihjKTtpZih2KXthLnNldFRpbWUoYS5nZXRUaW1lKCkrZSppKTtzLmNfdyhjLHYsZT09MD8wOmEpO31yZXR1cm4gdj09az9cJ1wnOnYnKSwgdC5hcGwgPSBuZXcgRnVuY3Rpb24oJ2wnLCAndicsICdkJywgJ3UnLCAndmFyIHM9dGhpcyxtPTA7aWYoIWwpbD1cJ1wnO2lmKHUpe3ZhciBpLG4sYT1zLnNwbGl0KGwsZCk7Zm9yKGk9MDtpPGEubGVuZ3RoO2krKyl7bj1hW2ldO209bXx8KHU9PTE/KG49PXYpOihuLnRvTG93ZXJDYXNlKCk9PXYudG9Mb3dlckNhc2UoKSkpO319aWYoIW0pbD1sP2wrZCt2OnY7cmV0dXJuIGwnKSwgdC5zcGxpdCwgdC5nZXRRdWVyeVBhcmFtID0gbmV3IEZ1bmN0aW9uKCdwJywgJ2QnLCAndScsICd2YXIgcz10aGlzLHY9XCdcJyxpLHQ7ZD1kP2Q6XCdcJzt1PXU/dToocy5wYWdlVVJMP3MucGFnZVVSTDpzLndkLmxvY2F0aW9uKTtpZih1PT1cJ2ZcJyl1PXMuZ3RmcygpLmxvY2F0aW9uO3doaWxlKHApe2k9cC5pbmRleE9mKFwnLFwnKTtpPWk8MD9wLmxlbmd0aDppO3Q9cy5wX2dwdihwLnN1YnN0cmluZygwLGkpLHUrXCdcJyk7aWYodCl7dD10LmluZGV4T2YoXCcjXCcpPi0xP3Quc3Vic3RyaW5nKDAsdC5pbmRleE9mKFwnI1wnKSk6dDt9aWYodCl2Kz12P2QrdDp0O3A9cC5zdWJzdHJpbmcoaT09cC5sZW5ndGg/aTppKzEpfXJldHVybiB2JyksIHQucF9ncHYgPSBuZXcgRnVuY3Rpb24oJ2snLCAndScsICd2YXIgcz10aGlzLHY9XCdcJyxpPXUuaW5kZXhPZihcJz9cJykscTtpZihrJiZpPi0xKXtxPXUuc3Vic3RyaW5nKGkrMSk7dj1zLnB0KHEsXCcmXCcsXCdwX2d2ZlwnLGspfXJldHVybiB2JyksIHQucF9ndmYgPSBuZXcgRnVuY3Rpb24oJ3QnLCAnaycsICdpZih0KXt2YXIgcz10aGlzLGk9dC5pbmRleE9mKFwnPVwnKSxwPWk8MD90OnQuc3Vic3RyaW5nKDAsaSksdj1pPDA/XCdUcnVlXCc6dC5zdWJzdHJpbmcoaSsxKTtpZihwLnRvTG93ZXJDYXNlKCk9PWsudG9Mb3dlckNhc2UoKSlyZXR1cm4gcy5lcGEodil9cmV0dXJuIFwnXCcnKSwgdC5nZXREYXlzU2luY2VMYXN0VmlzaXQgPSBuZXcgRnVuY3Rpb24oJ2MnLCAndmFyIHM9dGhpcyxlPW5ldyBEYXRlKCksZXM9bmV3IERhdGUoKSxjdmFsLGN2YWxfcyxjdmFsX3NzLGN0PWUuZ2V0VGltZSgpLGRheT0yNCo2MCo2MCoxMDAwLGYxLGYyLGYzLGY0LGY1O2Uuc2V0VGltZShjdCszKjM2NSpkYXkpO2VzLnNldFRpbWUoY3QrMzAqNjAqMTAwMCk7ZjA9XCdDb29raWVzIE5vdCBTdXBwb3J0ZWRcJztmMT1cJ0ZpcnN0IFZpc2l0XCc7ZjI9XCdNb3JlIHRoYW4gMzAgZGF5c1wnO2YzPVwnTW9yZSB0aGFuIDcgZGF5c1wnO2Y0PVwnTGVzcyB0aGFuIDcgZGF5c1wnO2Y1PVwnTGVzcyB0aGFuIDEgZGF5XCc7Y3ZhbD1zLmNfcihjKTtpZihjdmFsLmxlbmd0aD09MCl7cy5jX3coYyxjdCxlKTtzLmNfdyhjK1wnX3NcJyxmMSxlcyk7fWVsc2V7dmFyIGQ9Y3QtY3ZhbDtpZihkPjMwKjYwKjEwMDApe2lmKGQ+MzAqZGF5KXtzLmNfdyhjLGN0LGUpO3MuY193KGMrXCdfc1wnLGYyLGVzKTt9ZWxzZSBpZihkPDMwKmRheSsxICYmIGQ+NypkYXkpe3MuY193KGMsY3QsZSk7cy5jX3coYytcJ19zXCcsZjMsZXMpO31lbHNlIGlmKGQ8NypkYXkrMSAmJiBkPmRheSl7cy5jX3coYyxjdCxlKTtzLmNfdyhjK1wnX3NcJyxmNCxlcyk7fWVsc2UgaWYoZDxkYXkrMSl7cy5jX3coYyxjdCxlKTtzLmNfdyhjK1wnX3NcJyxmNSxlcyk7fX1lbHNle3MuY193KGMsY3QsZSk7Y3ZhbF9zcz1zLmNfcihjK1wnX3NcJyk7cy5jX3coYytcJ19zXCcsY3ZhbF9zcyxlcyk7fX1jdmFsX3M9cy5jX3IoYytcJ19zXCcpO2lmKGN2YWxfcy5sZW5ndGg9PTApIHJldHVybiBmMDtlbHNlIGlmKGN2YWxfcyE9ZjEmJmN2YWxfcyE9ZjImJmN2YWxfcyE9ZjMmJmN2YWxfcyE9ZjQmJmN2YWxfcyE9ZjUpIHJldHVybiBcJ1wnO2Vsc2UgcmV0dXJuIGN2YWxfczsnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpQYWdlTmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnVzZXJUeXBlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIzMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnVzZXJJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMTQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY2FtcGFpZ24lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wNycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OiBTdWJTZWN0aW9uTGV2ZWwxJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3A4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6IFN1YlNlY3Rpb25MZXZlbDIlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDogU3ViU2VjdGlvbkxldmVsMyUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMjQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpDb3VudHJ5TGFuZ3VhZ2UlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDp1c2VyVHlwZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnVzZXJJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wNicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OlBhZ2VUeXBlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQzJyB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbDogJyVjb250ZW50OlNpdGVTZWN0aW9uJScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbXBhaWduOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclQ01QSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlTmFtZTogJyVjb250ZW50OlBhZ2VOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGU1ZWZmNzZjZWIyOTRlZTI4ZmRiMzgyNDBkOWFiMGM3JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnUGFnZSBCb3R0b20gLSBTZW5kIEJlYWNvbicsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvcGFnZUJvdHRvbS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDIwMAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL3BhdGguanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnL3NlYXJjaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZUlzUmVnZXg6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbmVnYXRlOiAhMAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHlwZTogJ3BhZ2UnIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwzM2Q0YTg5MDI1NGM0M2QxOTg2MDU2NGJlNDNkZmNkMScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1NLIExhbmRpbmcgUGFnZSAtIEZCIFBpeGVsJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy92YWx1ZUNvbXBhcmlzb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wYXJpc29uOiB7IG9wZXJhdG9yOiAnZXF1YWxzJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnRPcGVyYW5kOiAnJVBhZ2UgVVJMJScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlnaHRPcGVyYW5kOiAnaHR0cHM6Ly93d3cuYW1hem9uLmpvYnMvZW4vbGFuZGluZ19wYWdlcy9wcmFjYS12LWxvZ2lzdGlrZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnPCEtLSBGYWNlYm9vayBQaXhlbCBDb2RlIC0tPlxuPHNjcmlwdD5cbiFmdW5jdGlvbihmLGIsZSx2LG4sdCxzKVxue2lmKGYuZmJxKXJldHVybjtuPWYuZmJxPWZ1bmN0aW9uKCl7bi5jYWxsTWV0aG9kP1xubi5jYWxsTWV0aG9kLmFwcGx5KG4sYXJndW1lbnRzKTpuLnF1ZXVlLnB1c2goYXJndW1lbnRzKX07XG5pZighZi5fZmJxKWYuX2ZicT1uO24ucHVzaD1uO24ubG9hZGVkPSEwO24udmVyc2lvbj1cJzIuMFwnO1xubi5xdWV1ZT1bXTt0PWIuY3JlYXRlRWxlbWVudChlKTt0LmFzeW5jPSEwO1xudC5zcmM9djtzPWIuZ2V0RWxlbWVudHNCeVRhZ05hbWUoZSlbMF07XG5zLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKHQscyl9KHdpbmRvdywgZG9jdW1lbnQsXCdzY3JpcHRcJyxcblwnaHR0cHM6Ly9jb25uZWN0LmZhY2Vib29rLm5ldC9lbl9VUy9mYmV2ZW50cy5qc1wnKTtcbmZicShcJ2luaXRcJywgXCc4NDI1Njk5NDI2MDUwMThcJyk7XG5mYnEoXCd0cmFja1wnLCBcJ1BhZ2VWaWV3XCcpO1xuPC9zY3JpcHQ+XG48bm9zY3JpcHQ+PGltZyBoZWlnaHQ9IjEiIHdpZHRoPSIxIiBzdHlsZT0iZGlzcGxheTpub25lIlxuc3JjPSJodHRwczovL3d3dy5mYWNlYm9vay5jb20vdHI/aWQ9ODQyNTY5OTQyNjA1MDE4JmV2PVBhZ2VWaWV3Jm5vc2NyaXB0PTEiXG4vPjwvbm9zY3JpcHQ+XG48IS0tIEVuZCBGYWNlYm9vayBQaXhlbCBDb2RlIC0tPicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdodG1sJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZTU1Y2MwZjE3ZWQzNDliZjhlNGQ0NjIwZDQ4ODc1NjQnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdDWiBMYW5kaW5nIFBhZ2UgLSBSTUsgU0tMSUsgdGFnJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuYW1hem9uLmpvYnMvY3MvbGFuZGluZ19wYWdlcy9wcmFjZScgPT0gZG9jdW1lbnQubG9jYXRpb24uaHJlZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJ1xuPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPlxuXHQvKiA8IVtDREFUQVsgKi9cblx0dmFyIHNlem5hbV9yZXRhcmdldGluZ19pZCA9IDU2MzA2O1xuXHQvKiBdXT4gKi9cbjwvc2NyaXB0PlxuPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiIHNyYz0iLy9jLmltZWRpYS5jei9qcy9yZXRhcmdldGluZy5qcyI+PC9zY3JpcHQ+XG4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGNiZGJjNTU5NzA2NzQ3MGVhODZmYTQ0ZTQ3OGEyYjNmJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnSm9iIEFwcGxpY2F0aW9uIDogQXBwbHkgTm93IChQYWdlIExvYWQpJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdqb2JTdGFydCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNDAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iTmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpwZXJzb25JRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMzcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclZXZlbnQ6am9iQ291bnRyeSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNDMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iQnVzaW5lc3NQdXJwb3NlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQyJyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0pvYiBBcHBsaWNhdGlvbiBTdGFydCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYmZkNjc1ZTNlMjU1NDI0MmE3YzcyNDJmZTBmZGM3N2InLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdKb2JBcHBsaWNhdGlvbjpKb2JBcHBseScsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnYXBwbGljYXRpb25TdGFydCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iTmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iQ2F0ZWdvcnklJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjIyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYkRpdmlzaW9uJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyOCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnBlcnNvbklEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ4JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0pvYiBBcHBseScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZDZlYjhlMGI2ODVlNGE1MGI1MWIyNWE3NmE0MzkyYzEnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdsYXVuY2hfYXNzZXNzbWVudCcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAndHlfYXBwX2xhdW5jaF9hc3Nlc3NtZW50JyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHJhY2tlclByb3BlcnRpZXM6IHsgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQxMzMnIH1dIH0gfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnbGF1bmNoX2Fzc2Vzc21lbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDRmZDczNWQyNDFlMzQwNTViZDFlODk2MDE5YzkxYWQ1JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY29tbXVuaWNhdGlvblByZWZlcmVuY2VzOnVuc3Vic2NyaWJlJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdjb21tdW5pY2F0aW9uUHJlZmVyZW5jZXNVbnN1YnNjcmliZScgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjM5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJU9wdCBPdXQ6IFN5c3RlbSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNDAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclT3B0IE91dDogU291cmNlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI0MScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVPcHQgT3V0OiBCZWFtZXJ5IENhbXBhaWduIElEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI0MicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVPcHQgT3V0OiBCZWFtZXJ5IENvbnZlcnNhdGlvbiBJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50NTEnIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnQ29tbXVuaWNhdGlvbiBQcmVmZXJlbmNlcyBVbnN1YnNjcmliZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMN2Q5NTI5MGFlYzQ5NGU2ZmEwYTUxNzg1NjNjMDU5YTcnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdGb3JtOkZvcm1TdWJtaXQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2Zvcm1TdWJtaXQnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMTgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclRm9ybTogRm9ybU5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MzknIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnRm9ybSBTdWJtaXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDA0ZTg1Yzc3ZDRjMTQ0ZWU5Y2M0NzM3NmEyMDA5OGY2JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnSm9iQXBwbGljYXRpb246Sm9iUmVmZXInLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2pvYlJlZmVyJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JDYXRlZ29yeSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iRGl2aXNpb24lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDk0JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0pvYiBSZWZlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMOWI2NzZkOGE1OTdjNDgwNTgyZjE2ZDhiNmEwNjE1NzEnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdTZW5kIE1lIE5ldyBDb2RlIGJ1dHRvbiAnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2NsaWNrLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxlbWVudFNlbGVjdG9yOiAnLmJ0bi5idG4tc2Vjb25kYXJ5LmJ0bi5idG4tZGVmYXVsdC5idG4tYmxvY2snLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1YmJsZUZpcmVJZlBhcmVudDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnViYmxlRmlyZUlmQ2hpbGRGaXJlZDogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gVmlzaXRvci5nZXRJbnN0YW5jZSgnNEVFMUJCNjU1NUY5MzY5QTdGMDAwMTAxQEFkb2JlT3JnJykuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgKHQuZVZhcjYgPSBuKSwgdC5saW5rVHJhY2tWYXJzID0gJ2V2ZW50cyxlVmFyNixlVmFyNSxwcm9wMTMnLCB0LmxpbmtUcmFja0V2ZW50cyA9ICdldmVudDExMic7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OlBhZ2VOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDEzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVBhZ2UgVVJMJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDExMicgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdTZW5kIE1lIE5ldyBDb2RlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmMTdmODUwYTRkZmQ0NjhhYWFiNDNlZTYyNmY0NWU2MScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Bhc3Nwb3J0OlNvY2lhbExvZ2luQWNjb3VudENyZWF0ZWQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3Bhc3Nwb3J0U29jaWFsTG9naW5BY2NvdW50Q3JlYXRlZCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpQYWdlTmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnVzZXJUeXBlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIzMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnVzZXJJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMTQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY2FtcGFpZ24lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDQwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJXBhc3Nwb3J0RXZlbnRQYXJhbXMlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50NzInIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsOiAnJWNvbnRlbnQ6U2l0ZVNlY3Rpb24lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZU5hbWU6ICclY29udGVudDpQYWdlTmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnUGFzc3BvcnQgRXZlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw5YzQ0OGJiNDE4ZWY0ZWI1OGFlZGMzODMxM2UyNDc2ZicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1NLIExhbmRpbmcgUGFnZSAtIEFkRm9ybSAnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdodHRwczovL3d3dy5hbWF6b24uam9icy9lbi9sYW5kaW5nX3BhZ2VzL3ByYWNhLXYtbG9naXN0aWtlJyA9PSBkb2N1bWVudC5sb2NhdGlvbi5ocmVmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuVHJhY2tpbmcgQ29kZTogU3RhbmRhcmQgKEFzeW5jaHJvbm91cykgImFtYXpvbl9yZW1hcmtldGluZ19taWNyb3NpdGVfdmlzaXRzX3NrIlxuLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuXG48IS0tIEFkZm9ybSBUcmFja2luZyBDb2RlIEJFR0lOIC0tPlxuPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPlxuICAgIHdpbmRvdy5fYWRmdHJhY2sgPSBBcnJheS5pc0FycmF5KHdpbmRvdy5fYWRmdHJhY2spID8gd2luZG93Ll9hZGZ0cmFjayA6ICh3aW5kb3cuX2FkZnRyYWNrID8gW3dpbmRvdy5fYWRmdHJhY2tdIDogW10pO1xuICAgIHdpbmRvdy5fYWRmdHJhY2sucHVzaCh7XG4gICAgICAgIEh0dHBIb3N0OiBcJ3RyYWNrLmFkZm9ybS5uZXRcJyxcbiAgICAgICAgcG06IDE0MDU3MzQsXG4gICAgICAgIGRpdmlkZXI6IGVuY29kZVVSSUNvbXBvbmVudChcJ3xcJyksXG4gICAgICAgIHBhZ2VuYW1lOiBlbmNvZGVVUklDb21wb25lbnQoXCdhbWF6b25fcmVtYXJrZXRpbmdfbWljcm9zaXRlX3Zpc2l0c19za1wnKVxuICAgIH0pO1xuICAgIChmdW5jdGlvbiAoKSB7IHZhciBzID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudChcJ3NjcmlwdFwnKTsgcy50eXBlID0gXCd0ZXh0L2phdmFzY3JpcHRcJzsgcy5hc3luYyA9IHRydWU7IHMuc3JjID0gXCdodHRwczovL3MyLmFkZm9ybS5uZXQvYmFubmVycy9zY3JpcHRzL3N0L3RyYWNrcG9pbnQtYXN5bmMuanNcJzsgdmFyIHggPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZShcJ3NjcmlwdFwnKVswXTsgeC5wYXJlbnROb2RlLmluc2VydEJlZm9yZShzLCB4KTsgfSkoKTtcblxuPC9zY3JpcHQ+XG48bm9zY3JpcHQ+XG4gICAgPHAgc3R5bGU9Im1hcmdpbjowO3BhZGRpbmc6MDtib3JkZXI6MDsiPlxuICAgICAgICA8aW1nIHNyYz0iaHR0cHM6Ly90cmFjay5hZGZvcm0ubmV0L1NlcnZpbmcvVHJhY2tQb2ludC8/cG09MTQwNTczNCZBREZQYWdlTmFtZT1hbWF6b25fcmVtYXJrZXRpbmdfbWljcm9zaXRlX3Zpc2l0c19zayZBREZkaXZpZGVyPXwiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGFsdD0iIiAvPlxuICAgIDwvcD5cbjwvbm9zY3JpcHQ+XG48IS0tIEFkZm9ybSBUcmFja2luZyBDb2RlIEVORCAtLT4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDFmYzJiZTEzYmJjNzRiYjg4MzljMzUxMGFhOTk2OTQwJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnU01TIFNlbmQgTmV3IENvZGUnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ1NNUyBTZW5kIE5ldyBDb2RlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyODknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclVXNlciBTdGF0dXMlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjk5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVNNUzpTdGVwbmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MTM1JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1NNUyAtIFNlbmQgbmV3IENvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGE3Mjg5MzA1YmFlMTQwYThiMDZhNTc4NDQ0ZWIzNjM1JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAncGFzc3BvcnQ6U29jaWFsTG9naW5TdWNjZXNzJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdwYXNzcG9ydFNvY2lhbExvZ2luU3VjY2VzcycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDp1c2VyVHlwZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OlBhZ2VOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIxNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjYW1wYWlnbiUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpwZXJzb25JRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMzAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDp1c2VySUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDQwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJXBhc3Nwb3J0RXZlbnRQYXJhbXMlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50NzEnIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsOiAnJWNvbnRlbnQ6U2l0ZVNlY3Rpb24lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZU5hbWU6ICclY29udGVudDpQYWdlTmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnUGFzc3BvcnQgRXZlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw0OTdmM2E2MGVkOGU0YTRiOGVjMjA4MTA3ODBlZDJiNicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2pvYkFwcGxpY2F0aW9uOmpvYldpdGhkcmF3JywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdkYXNoX3dpdGhkcmF3X3dpdGhkcmF3JyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVqb2JEZXNjcmlwdGlvbjpqb2JDYXRlZ29yeSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iRGl2aXNpb24lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjI4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6cGVyc29uSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjM3JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWV2ZW50OmpvYkNvdW50cnklJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDExJyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0pvYiBBcHBsaWNhdGlvbiBXaXRoZHJhdycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYTE3YmRkMmYwMDg0NDI0YTk1NzhlYzVmNDkyZWJhZjMnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdTTVMgQWxsb3cnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ1NNUyBBbGxvdycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI5OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVTTVM6U3RlcG5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MTM2JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1NNUyBBbGxvdycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNzk3ZWY1ODQ2NWUxNGUwZmJkMmNkODE2ZmVmZTFiMTknLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwYXNzcG9ydDpVcGRhdGVQYXNzd29yZFN0YXJ0ZWQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3Bhc3Nwb3J0VXBkYXRlUGFzc3dvcmRTdGFydGVkJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHJhY2tlclByb3BlcnRpZXM6IHsgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ0NScgfV0gfSB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdQYXNzcG9ydCBFdmVudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDE2NzFlODI0Njk3MDQyZjJhYTE3YmRmOWNlNWExNTNlJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnSm9iU2VhcmNoOkZpbHRlcicsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnc2VhcmNoRmlsdGVyQnknIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclSm9iU2VhcmNoOkZpbHRlckJ5JScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDMzJyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0pvYiBTZWFyY2ggRmlsdGVyaW5nJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwwYjM4NjFiM2U5Mzg0ZjA0YTkwYzZiNDljYjU0ODM2OCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2pvYkFwcGxpY2F0aW9uOmV4aXRBcHBsaWNhdGlvbicsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnZXhpdEFwcGxpY2F0aW9uJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxpbmtUcmFja1ZhcnMgPSAnZVZhcjEsZVZhcjIsZVZhcjM0LGVWYXIzNSxlVmFyMzYsZXZlbnRzJywgdC5saW5rVHJhY2tFdmVudHMgPSAnZXZlbnQxMicsIHQuZVZhcjEgPSBfc2F0ZWxsaXRlLmdldFZhcignam9iRGVzY3JpcHRpb246am9iSUQnKSwgdC5lVmFyMiA9IF9zYXRlbGxpdGUuZ2V0VmFyKCdqb2JEZXNjcmlwdGlvbjpqb2JOYW1lJyksIHQuZVZhcjM0ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ0Zvcm0gOiBmb3JtSW5kZXgnKSArIDEsIHQuZVZhcjM1ID0gX3NhdGVsbGl0ZS5nZXRWYXIoJ0Zvcm0gOiBmb3JtVGl0bGUnKSwgdC5lVmFyMzYgPSB0LmVWYXIzNCArICd8JyArIHQuZVZhcjM1OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpwZXJzb25JRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMzcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclZXZlbnQ6am9iQ291bnRyeSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MTInIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnSm9iIEFwcGxpY2F0aW9uIC0gRXhpdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMjA4YmFhMzQ2MGY0NDQ2ZGE3MjhjYTlmOWIzYTBjNTcnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdTTVMgR2V0IHZlcmlmaWNhdGlvbiBjb2RlJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdTTVMgR2V0IHZlcmlmaWNhdGlvbiBjb2RlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyODknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclVXNlciBTdGF0dXMlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjk5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVNNUzpTdGVwbmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MTA5JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1NNUyBHZXQgdmVyaWZpY2F0aW9uIGNvZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGJkMWM1OTQ4NDhjNDQ2MzBhNzFlYjEyYzY5YTM4MmVlJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAncGFzc3BvcnQ6UGFzc3dvcmRJbnB1dEVycm9yJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdwYXNzcG9ydFBhc3N3b3JkSW5wdXRFcnJvcicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3AyOScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVwYXNzcG9ydEV2ZW50UGFyYW1zJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDU1JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1Bhc3Nwb3J0IEV2ZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMZDEzN2NlYjdhMWUyNGQ1MTlkZmE0M2QyYzZhZThlYmUnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdTSyBMYW5kaW5nIFBhZ2UgLSBSTUsnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdodHRwczovL3d3dy5hbWF6b24uam9icy9lbi9sYW5kaW5nX3BhZ2VzL3ByYWNhLXYtbG9naXN0aWtlJyA9PSBkb2N1bWVudC5sb2NhdGlvbi5ocmVmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvYWN0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiAnPHNjcmlwdD5cbiAgZ3RhZyhcJ2V2ZW50XCcsIFwncGFnZV92aWV3XCcsIHtcbiAgICBcJ3NlbmRfdG9cJzogXCdBVy03OTU2NzQ1NjBcJyxcbiAgICBcJ3ZhbHVlXCc6IFwncmVwbGFjZSB3aXRoIHZhbHVlXCcsXG4gICAgXCdpdGVtc1wnOiBbe1xuICAgICAgXCdpZFwnOiBcJ3JlcGxhY2Ugd2l0aCB2YWx1ZVwnLFxuICAgICAgXCdsb2NhdGlvbl9pZFwnOiBcJ3JlcGxhY2Ugd2l0aCB2YWx1ZVwnLFxuICAgICAgXCdnb29nbGVfYnVzaW5lc3NfdmVydGljYWxcJzogXCdqb2JzXCdcbiAgICB9XVxuICB9KTtcbjwvc2NyaXB0PlxuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2h0bWwnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwyNmI1YTBhMDM3MjA0Mzk2YmU5YjQ3Mzg1ZTA4NjZlOScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1NNUyBEZWNsaW5lJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdTTVMgRGVjbGluZScgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI5OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVTTVM6U3RlcG5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MTE2JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1NNUyBEZWNsaW5lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw4ODJmOTEyNmQ3N2E0MTA4YWQ0NTI3YjZhOGMzNzBmZicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ0Zvcm06Rm9ybUVycm9ycycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnZm9ybUVycm9ycycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVGb3JtOkZvcm1FcnJvcnMlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MTYnIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnRm9ybSBFcnJvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNTIxOTQ3YjRhOGIxNGFlN2I1NGNlY2RmMmVhNmJlZWYnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdDVEEgQ2xpY2snLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2N0YUNsaWNrJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclQ1RBIE5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MzcnIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnJUNUQSBOYW1lJScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNjA4NmFhZGFkYTExNDRhNmIwNTg3NDA1MGYzNWQ4ZjMnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdSZXN1bWVQYXJzaW5nU2VydmljZTpQcm9maWxlRGlmZmVyZW50RnJvbVBvcHVsYXRlZCcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnZXh0ZXJuYWxfcGFyc2VkX3Jlc3VtZV9kaWZmZXJlbnRfZnJvbV9wcm9maWxlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHJhY2tlclByb3BlcnRpZXM6IHt9IH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYTMwMDliZWNiYjFkNGE4Njg3MGExMmIxYTM1ZWU2ZDUnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwYXNzcG9ydExvZ2luRmFpbHVyZScsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbXSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMOWRlM2RhNzYyY2UxNDllYzgwNDQwYzE1ODdiMTdlYjAnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdKb2JBcHBsaWNhdGlvbjpKb2JSZWZlck1vZGFsQ2xpY2tUaHJvdWdoJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdqb2JSZWZlckNsaWNrVGhyb3VnaCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iTmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclam9iRGVzY3JpcHRpb246am9iQ2F0ZWdvcnklJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjIyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWpvYkRlc2NyaXB0aW9uOmpvYkRpdmlzaW9uJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ5NicgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdKb2IgUmVmZXIgTW9kYWwgQ2xpY2sgVGhyb3VnaCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMmJjNzdiMDU2ZTUxNGQ0NGFmY2ZiZGNkZjA2ZGE1MTcnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdTTVMgRWRpdCBOdW1iZXInLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ0VkaXQgTnVtYmVyJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjk5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVNNUzpTdGVwbmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQxMTAnIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnU01TIEVkaXQgTnVtYmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmZTU2ZDI4ZjA0N2Y0YTk3ODM0OTk4ZGFiMzVmNWU3YicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ0pvYlNlYXJjaDpDbGlja1Rocm91Z2gnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3NlYXJjaENsaWNrVGhyb3VnaCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjI2JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJUpvYlNlYXJjaDpTZWFyY2hQb3NpdGlvbiUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclSm9iU2VhcmNoOiBTZWFyY2hTZWxlY3Rpb24lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDM1JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0pvYiBTZWFyY2ggQ2xpY2t0aHJvdWdoJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw3Y2I0NTUzYjlmNTE0MWY1OWY2ZjE4MTFiODcxNjhlOCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Bhc3Nwb3J0OkFjY291bnRDcmVhdGVkJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9kaXJlY3RDYWxsLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IGlkZW50aWZpZXI6ICdwYXNzcG9ydEFjY291bnRDcmVhdGVkJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHJhY2tlclByb3BlcnRpZXM6IHsgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ0MScgfV0gfSB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdQYXNzcG9ydCBFdmVudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGRmMzc1OGI0MDNkYzQ1MTE4MjkyZmI3MjY1NGFjNjExJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnUmVzdW1lUGFyc2luZ1NlcnZpY2U6UG9wdWxhdGVkVmFsdWVDaGFuZ2UnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2V4dGVybmFsX3BhcnNlZF9yZXN1bWVfdmFsdWVfdXBkYXRlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgdHJhY2tlclByb3BlcnRpZXM6IHt9IH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0eXBlOiAncGFnZScgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNDM5ZjE5MzE2ODAwNGQwN2E2MWJmMGY1MTk4ZmJjY2InLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdJbml0aWFsaXplIFBsdWdpbnMnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2xpYnJhcnlMb2FkZWQuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiAzMAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvbW1vbi1hbmFseXRpY3MtcGx1Z2lucy9zcmMvbGliL2FjdGlvbnMvaW5pdGlhbGl6ZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNzOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWw6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG12OiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuczogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwZTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBsOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcHY6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZwbzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2djOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnbnI6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdwbjogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3B2OiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBncXA6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdybDogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3RwOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndmQ6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd2bjogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ3ZvOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZmw6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdhcHY6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdwbHQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd0YmU6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGd0dGM6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdkc2x2OiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndHNsdjogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGFmOTJkZjkyMDViNDQ2NTNhMTc3YjU0ODQ1Y2EzNGUyJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnY29udGVudDphbGxQYWdlcycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvcGFnZUJvdHRvbS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDQwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvZG9tYWluLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnYW1hem9uLmpvYnMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncGFzc3BvcnQuYW1hem9uLndvcmsnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXN0b21TZXR1cDogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGUsIHQsIG4sIGksIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IGUsIG8gPSB0LCBjID0gbiwgbCA9IGksIHUgPSByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnLXYnID09PSBzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGx1Z2luOiAnYXBsJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZlcnNpb246ICc0LjAnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IHdpbmRvdy5zX2NfaWwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlLCB0ID0gMDsgdCA8IHdpbmRvdy5zX2NfaWwubGVuZ3RoOyB0KyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChlID0gd2luZG93LnNfY19pbFt0XSkuX2MgJiYgJ3NfYycgPT09IGUuX2MpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBkICYmIChkLmNvbnRleHREYXRhLmFwbCA9ICc0LjAnKSwgd2luZG93LmluTGlzdCA9IHdpbmRvdy5pbkxpc3QgfHwgZnVuY3Rpb24gKGUsIHQsIG4sIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyAhPSB0eXBlb2YgdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUuc3BsaXQobiB8fCAnLCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoJ29iamVjdCcgIT0gdHlwZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChuID0gMCwgYSA9IGUubGVuZ3RoOyBuIDwgYTsgbisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxID09IGkgJiYgdCA9PT0gZVtuXSB8fCB0LnRvTG93ZXJDYXNlKCkgPT09IGVbbl0udG9Mb3dlckNhc2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAhcyB8fCAnc3RyaW5nJyA9PSB0eXBlb2YgcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT0gdHlwZW9mIG8gfHwgJycgPT09IG8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMgfHwgJywnLCAxID09IChsID0gbCB8fCBjKSAmJiAobCA9IGMsIHUgfHwgKHUgPSAxKSksIDIgPT0gbCAmJiAxICE9IHUgJiYgKGwgPSBjKSwgZCA9IChvID0gby5zcGxpdCgnLCcpKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHAgPSAwOyBwIDwgZDsgcCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LmluTGlzdChzLCBvW3BdLCBjLCB1KSB8fCAocyA9IHMgPyBzICsgbCArIG9bcF0gOiBvW3BdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghd2luZG93LnNfbG9hZFQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKSwgdCA9IHdpbmRvdy5wZXJmb3JtYW5jZSA/IHBlcmZvcm1hbmNlLnRpbWluZyA6IDAsIG4gPSB0ID8gdC5yZXF1ZXN0U3RhcnQgOiB3aW5kb3cuaW5IZWFkVFMgfHwgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc19sb2FkVCA9IG4gPyBNYXRoLnJvdW5kKChlIC0gbikgLyAxMDApIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzX2xvYWRUOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coSlNPTi5zdHJpbmdpZnkoZGlnaXRhbERhdGEsIG51bGwsICdcdCcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gVmlzaXRvci5nZXRJbnN0YW5jZSgnQ0NCQzg3OUQ1NTcyMDcwRTdGMDAwMTAxQEFkb2JlT3JnJykuZ2V0TWFya2V0aW5nQ2xvdWRWaXNpdG9ySUQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgJiYgKHQuZVZhcjYgPSByKSwgdC5wcm9wNSA9ICd1bmRlZmluZWQnICE9IHR5cGVvZiBWaXNpdG9yID8gJ1Zpc2l0b3JBUEkgUHJlc2VudCcgOiAnVmlzaXRvckFQSSBNaXNzaW5nJywgdC5wcm9wMiA9ICdEPXQnLCB3aW5kb3cubG9jYXRpb24uaHJlZi5pbmRleE9mKCc0MDQnKSA+IDAgJiYgKHQucGFnZVR5cGUgPSAnZXJyb3JQYWdlJyksIHQuZVZhcjE1ID0gd2luZG93LmxvY2F0aW9uLmhvc3RuYW1lLCB0LmVWYXIxNiA9IHdpbmRvdy5sb2NhdGlvbi5wYXRobmFtZSwgdC5wcm9wMTMgPSB3aW5kb3cubG9jYXRpb24uaHJlZiwgdC5wcm9wMTcgPSAnRD1qJywgdC5wcm9wMTggPSBkb2N1bWVudC50aXRsZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gbG9jYXRpb24uc2VhcmNoLnNwbGl0KCc9JyksIG8gPSBzWzBdLnN1YnN0cigxLCBzWzBdLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnByb3AxOSA9IG8sIHQudXNlUGx1Z2lucyA9ICEwLCB0LmRvUGx1Z2lucyA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wcm9wMTQgPSBpKCksIGUuVXRpbC5nZXRRdWVyeVBhcmFtKCd1dG1fbWVkaXVtJykgJiYgKGUuZVZhcjE3ID0gZS5VdGlsLmdldFF1ZXJ5UGFyYW0oJ3V0bV9tZWRpdW0nKSArICc6JyArIGUuVXRpbC5nZXRRdWVyeVBhcmFtKCd1dG1fc291cmNlJykgKyAnOicgKyBlLlV0aWwuZ2V0UXVlcnlQYXJhbSgndXRtX3Rlcm0nKSArICc6JyArIGUuVXRpbC5nZXRRdWVyeVBhcmFtKCd1dG1fY29udGVudCcpKSwgZS5lVmFyMTcgPSBlLmdldFZhbE9uY2UoZS5lVmFyMTcsICdzX2VWYXIxNycpLCBkaWdpdGFsRGF0YS5wYWdlLnNlYXJjaCAmJiAnWmVybycgPT0gZGlnaXRhbERhdGEucGFnZS5zZWFyY2gubm9PZlJlc3VsdHMgJiYgKGUuZXZlbnRzID0gZS5hcGwoZS5ldmVudHMsICdldmVudDM0JywgJywnLCAyKSksIGUucHJvcDI1ID0gZS5nZXREYXlzU2luY2VMYXN0VmlzaXQoJ3NfbHYnKSwgZS5wcm9wMjIgPSBlLmdldE5ld1JlcGVhdCgzMCwgJ3NfZ2V0TmV3UmVwZWF0JyksIGUucHJvcDEwID0gZS5nZXRQcmV2aW91c1ZhbHVlKGUucGFnZU5hbWUsICdncHYnLCAnJyksIGUucHJvcDEwICYmIChlLmVWYXIyNSA9ICdEPWMxMCcsIGUucHJvcDExID0gZS5nZXRQZXJjZW50UGFnZVZpZXdlZCgpLCBlLnByb3AxMCAmJiAnbm8gdmFsdWUnICE9IGUucHJvcDEwIHx8IChlLnByb3AxMSA9ICcnKSksIGUuZVZhcjMyID0gZS5wcm9wMyA9IGdldFRpbWVQYXJ0aW5nKCdBbWVyaWNhL0xvc19BbmdlbGVzJyksIGUuZVZhcjUgPSBlLnBhZ2VOYW1lLCBlLnByb3AxMyA9IHdpbmRvdy5sb2NhdGlvbi5ocmVmLCBlLmxpbmtUcmFja1ZhcnMgPSBuKGUubGlua1RyYWNrVmFycywgJ2VWYXI1JyksIGUubGlua1RyYWNrVmFycyA9IG4oZS5saW5rVHJhY2tWYXJzLCAncHJvcDEzJyksIGNvbnNvbGUubG9nKCcqKiogQm90aCcgKyBlLmVWYXI1ICsgZS5wcm9wMTMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5zcGxpdCA9IG5ldyBGdW5jdGlvbignbCcsICdkJywgJ3ZhciBpLHg9MCxhPW5ldyBBcnJheTt3aGlsZShsKXtpPWwuaW5kZXhPZihkKTtpPWk+LTE/aTpsLmxlbmd0aDthW3grK109bC5zdWJzdHJpbmcoMCxpKTtsPWwuc3Vic3RyaW5nKGkrZC5sZW5ndGgpO31yZXR1cm4gYScpLCB0LmdldFBlcmNlbnRQYWdlVmlld2VkID0gbmV3IEZ1bmN0aW9uKCduJywgJ3ZhciBzPXRoaXMsVz13aW5kb3csRUw9Vy5hZGRFdmVudExpc3RlbmVyLEFFPVcuYXR0YWNoRXZlbnQsRT1bXCdsb2FkXCcsXCd1bmxvYWRcJyxcJ3Njcm9sbFwnLFwncmVzaXplXCcsXCd6b29tXCcsXCdrZXl1cFwnLFwnbW91c2V1cFwnLFwndG91Y2hlbmRcJyxcJ29yaWVudGF0aW9uY2hhbmdlXCcsXCdwYW5cJ107Vy5zX09iaj1zO3NfUFBWaWQ9KG49PVwnLVwnP3MucGFnZU5hbWU6bil8fHMucGFnZU5hbWV8fGxvY2F0aW9uLmhyZWY7aWYoIVcuc19QUFZldmVudCl7cy5zX1BQVmc9ZnVuY3Rpb24obixyKXt2YXIgaz1cJ3NfcHB2XCcscD1rK1wnbFwnLGM9cy5jX3Iobnx8cj9rOnApLGE9Yy5pbmRleE9mKFwnLFwnKT4tMT9jLnNwbGl0KFwnLFwnLDEwKTpbXCdcJ10sbD1hLmxlbmd0aCxpO2FbMF09dW5lc2NhcGUoYVswXSk7cj1yfHwobiYmbiE9YVswXSl8fDA7YS5sZW5ndGg9MTA7aWYodHlwZW9mIGFbMF0hPVwnc3RyaW5nXCcpYVswXT1cJ1wnO2ZvcihpPTE7aTwxMDtpKyspYVtpXT0hciYmaTxsP3BhcnNlSW50KGFbaV0pfHwwOjA7aWYobDwxMHx8dHlwZW9mIGFbOV0hPVwnc3RyaW5nXCcpYVs5XT1cJ1wnO2lmKHIpe3MuY193KHAsYyk7cy5jX3coayxcJz9cJyl9cmV0dXJuIGF9O1cuc19QUFZldmVudD1mdW5jdGlvbihlKXt2YXIgVz13aW5kb3csRD1kb2N1bWVudCxCPUQuYm9keSxFPUQuZG9jdW1lbnRFbGVtZW50LFM9d2luZG93LnNjcmVlbnx8MCxIbz1cJ29mZnNldEhlaWdodFwnLEhzPVwnc2Nyb2xsSGVpZ2h0XCcsVHM9XCdzY3JvbGxUb3BcJyxXYz1cJ2NsaWVudFdpZHRoXCcsSGM9XCdjbGllbnRIZWlnaHRcJyxDPTEwMCxNPU1hdGgsSj1cJ29iamVjdFwnLE49XCdudW1iZXJcJyxzPVcuc19PYmp8fFcuc3x8MDtlPWUmJnR5cGVvZiBlPT1KP2UudHlwZXx8XCdcJzpcJ1wnO2lmKCFlLmluZGV4T2YoXCdvblwnKSllPWUuc3Vic3RyaW5nKDIpO3NfUFBWaT1XLnNfUFBWaXx8MDtpZihXLnNfUFBWdCYmIWUpe2NsZWFyVGltZW91dChzX1BQVnQpO3NfUFBWdD0wO2lmKHNfUFBWaTwyKXNfUFBWaSsrfWlmKHR5cGVvZiBzPT1KKXt2YXIgaD1NLm1heChCW0hzXXx8RVtIc10sQltIb118fEVbSG9dLEJbSGNdfHxFW0hjXSksWD1XLmlubmVyV2lkdGh8fEVbV2NdfHxCW1djXXx8MCxZPVcuaW5uZXJIZWlnaHR8fEVbSGNdfHxCW0hjXXx8MCx4PVM/Uy53aWR0aDowLHk9Uz9TLmhlaWdodDowLHI9TS5yb3VuZChDKihXLmRldmljZVBpeGVsUmF0aW98fDEpKS9DLGI9KEQucGFnZVlPZmZzZXR8fEVbVHNdfHxCW1RzXXx8MCkrWSxwPWg+MCYmYj4wP00ucm91bmQoQypiL2gpOjAsTz1XLm9yaWVudGF0aW9uLG89IWlzTmFOKE8pP00uYWJzKG8pJTE4MDpZPlg/MDo5MCxMPWU9PVwnbG9hZFwnfHxzX1BQVmk8MSxhPXMuc19QUFZnKHNfUFBWaWQsTCksVj1mdW5jdGlvbihpLHYsZixuKXtpPXBhcnNlSW50KHR5cGVvZiBhPT1KJiZhLmxlbmd0aD5pP2FbaV06XCcwXCcpfHwwO3Y9dHlwZW9mIHYhPU4/aTp2O3Y9Znx8dj5pP3Y6aTtyZXR1cm4gbj92OnY+Qz9DOnY8MD8wOnZ9O2lmKG5ldyBSZWdFeHAoXCcoaVBvZHxpUGFkfGlQaG9uZSlcJykuZXhlYyhuYXZpZ2F0b3IudXNlckFnZW50fHxcJ1wnKSYmbyl7bz14O3g9eTt5PW99bz1vP1wnUFwnOlwnTFwnO2FbOV09TD9cJ1wnOmFbOV0uc3Vic3RyaW5nKDAsMSk7cy5jX3coXCdzX3BwdlwnLGVzY2FwZShXLnNfUFBWaWQpK1wnLFwnK1YoMSxwLEwpK1wnLFwnKyhMfHwhVigyKT9wOlYoMikpK1wnLFwnK1YoMyxiLEwsMSkrXCcsXCcrWCtcJyxcJytZK1wnLFwnK3grXCcsXCcreStcJyxcJytyK1wnLFwnK2FbOV0rKGFbOV09PW8/XCdcJzpvKSl9aWYoIVcuc19QUFZ0JiZlIT1cJ3VubG9hZFwnKVcuc19QUFZ0PXNldFRpbWVvdXQoVy5zX1BQVmV2ZW50LDMzMyl9O2Zvcih2YXIgZj1XLnNfUFBWZXZlbnQsaT0wO2k8RS5sZW5ndGg7aSsrKWlmKEVMKUVMKEVbaV0sZixmYWxzZSk7ZWxzZSBpZihBRSlBRShcJ29uXCcrRVtpXSxmKTtmKCl9O3ZhciBhPXMuc19QUFZnKCk7cmV0dXJuIW58fG49PVwnLVwnP2FbMV06YScpLCB0LmdldFF1ZXJ5UGFyYW0gPSBuZXcgRnVuY3Rpb24oJ3AnLCAnZCcsICd1JywgJ3ZhciBzPXRoaXMsdj1cJ1wnLGksdDtkPWQ/ZDpcJ1wnO3U9dT91OihzLnBhZ2VVUkw/cy5wYWdlVVJMOnMud2QubG9jYXRpb24pO2lmKHU9PVwnZlwnKXU9cy5ndGZzKCkubG9jYXRpb247d2hpbGUocCl7aT1wLmluZGV4T2YoXCcsXCcpO2k9aTwwP3AubGVuZ3RoOmk7dD1zLnBfZ3B2KHAuc3Vic3RyaW5nKDAsaSksdStcJ1wnKTtpZih0KXt0PXQuaW5kZXhPZihcJyNcJyk+LTE/dC5zdWJzdHJpbmcoMCx0LmluZGV4T2YoXCcjXCcpKTp0O31pZih0KXYrPXY/ZCt0OnQ7cD1wLnN1YnN0cmluZyhpPT1wLmxlbmd0aD9pOmkrMSl9cmV0dXJuIHYnKSwgdC5wX2dwdiA9IG5ldyBGdW5jdGlvbignaycsICd1JywgJ3ZhciBzPXRoaXMsdj1cJ1wnLGk9dS5pbmRleE9mKFwnP1wnKSxxO2lmKGsmJmk+LTEpe3E9dS5zdWJzdHJpbmcoaSsxKTt2PXMucHQocSxcJyZcJyxcJ3BfZ3ZmXCcsayl9cmV0dXJuIHYnKSwgdC5wX2d2ZiA9IG5ldyBGdW5jdGlvbigndCcsICdrJywgJ2lmKHQpe3ZhciBzPXRoaXMsaT10LmluZGV4T2YoXCc9XCcpLHA9aTwwP3Q6dC5zdWJzdHJpbmcoMCxpKSx2PWk8MD9cJ1RydWVcJzp0LnN1YnN0cmluZyhpKzEpO2lmKHAudG9Mb3dlckNhc2UoKT09ay50b0xvd2VyQ2FzZSgpKXJldHVybiBzLmVwYSh2KX1yZXR1cm4gXCdcJycpLCB0LmdldERheXNTaW5jZUxhc3RWaXNpdCA9IG5ldyBGdW5jdGlvbignYycsICd2YXIgcz10aGlzLGU9bmV3IERhdGUoKSxlcz1uZXcgRGF0ZSgpLGN2YWwsY3ZhbF9zLGN2YWxfc3MsY3Q9ZS5nZXRUaW1lKCksZGF5PTI0KjYwKjYwKjEwMDAsZjEsZjIsZjMsZjQsZjU7ZS5zZXRUaW1lKGN0KzMqMzY1KmRheSk7ZXMuc2V0VGltZShjdCszMCo2MCoxMDAwKTtmMD1cJ0Nvb2tpZXMgTm90IFN1cHBvcnRlZFwnO2YxPVwnRmlyc3QgVmlzaXRcJztmMj1cJ01vcmUgdGhhbiAzMCBkYXlzXCc7ZjM9XCdNb3JlIHRoYW4gNyBkYXlzXCc7ZjQ9XCdMZXNzIHRoYW4gNyBkYXlzXCc7ZjU9XCdMZXNzIHRoYW4gMSBkYXlcJztjdmFsPXMuY19yKGMpO2lmKGN2YWwubGVuZ3RoPT0wKXtzLmNfdyhjLGN0LGUpO3MuY193KGMrXCdfc1wnLGYxLGVzKTt9ZWxzZXt2YXIgZD1jdC1jdmFsO2lmKGQ+MzAqNjAqMTAwMCl7aWYoZD4zMCpkYXkpe3MuY193KGMsY3QsZSk7cy5jX3coYytcJ19zXCcsZjIsZXMpO31lbHNlIGlmKGQ8MzAqZGF5KzEgJiYgZD43KmRheSl7cy5jX3coYyxjdCxlKTtzLmNfdyhjK1wnX3NcJyxmMyxlcyk7fWVsc2UgaWYoZDw3KmRheSsxICYmIGQ+ZGF5KXtzLmNfdyhjLGN0LGUpO3MuY193KGMrXCdfc1wnLGY0LGVzKTt9ZWxzZSBpZihkPGRheSsxKXtzLmNfdyhjLGN0LGUpO3MuY193KGMrXCdfc1wnLGY1LGVzKTt9fWVsc2V7cy5jX3coYyxjdCxlKTtjdmFsX3NzPXMuY19yKGMrXCdfc1wnKTtzLmNfdyhjK1wnX3NcJyxjdmFsX3NzLGVzKTt9fWN2YWxfcz1zLmNfcihjK1wnX3NcJyk7aWYoY3ZhbF9zLmxlbmd0aD09MCkgcmV0dXJuIGYwO2Vsc2UgaWYoY3ZhbF9zIT1mMSYmY3ZhbF9zIT1mMiYmY3ZhbF9zIT1mMyYmY3ZhbF9zIT1mNCYmY3ZhbF9zIT1mNSkgcmV0dXJuIFwnXCc7ZWxzZSByZXR1cm4gY3ZhbF9zOycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnVzZXJUeXBlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6UGFnZU5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjExJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWludGNtcGlkJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIxNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjYW1wYWlnbiUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMjgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpwZXJzb25JRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMzAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDp1c2VySUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjQ0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJUNDVUlEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI0NicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVVc2VyIEF1dGggTW9kZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNTAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclRENMSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjYxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6dXNlckFjdGlvblN0b3JlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI2MicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnBlb3BsZVNvZnRJZCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNjMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclVVRNIFVzZXIlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjkxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVNtcyBWaXNpYmxlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI5MicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVQaG9uZSBOdW1iZXIgQWRkZWQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjkzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVBob25lIE51bWJlciBWZXJpZmllZCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyOTQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclU01TIE9wdGVkSW4lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjk1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVBob25lTnVtYmVyIENvdW50cnlDb2RlJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI5NicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVQaG9uZU51bWJlciBNYXRjaCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyOTcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclU01TIGFzc2Vzc21lbnRSZXF1aXJlZCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3AxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6dXNlcklEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3A0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6dXNlclR5cGUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpQYWdlVHlwZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wNycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OiBTdWJTZWN0aW9uTGV2ZWwxJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3A4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6IFN1YlNlY3Rpb25MZXZlbDIlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDogU3ViU2VjdGlvbkxldmVsMyUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMjQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpDb3VudHJ5TGFuZ3VhZ2UlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDMnIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFubmVsOiAnJWNvbnRlbnQ6U2l0ZVNlY3Rpb24lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FtcGFpZ246IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVDTVBJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VOYW1lOiAnJWNvbnRlbnQ6UGFnZU5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTGVhMTllYmIwZDdiMjQ2YTQ4OWRmMDc3MzA4OTVjMjhkJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnQ1ogTGFuZGluZyBQYWdlIC0gQWRGb3JtJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuYW1hem9uLmpvYnMvY3MvbGFuZGluZ19wYWdlcy9wcmFjZScgPT0gZG9jdW1lbnQubG9jYXRpb24uaHJlZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2FjdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogJzwhLS0gQWRmb3JtIFRyYWNraW5nIENvZGUgQkVHSU4gLS0+XG48c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+XG4gICAgd2luZG93Ll9hZGZ0cmFjayA9IEFycmF5LmlzQXJyYXkod2luZG93Ll9hZGZ0cmFjaykgPyB3aW5kb3cuX2FkZnRyYWNrIDogKHdpbmRvdy5fYWRmdHJhY2sgPyBbd2luZG93Ll9hZGZ0cmFja10gOiBbXSk7XG4gICAgd2luZG93Ll9hZGZ0cmFjay5wdXNoKHtcbiAgICAgICAgSHR0cEhvc3Q6IFwndHJhY2suYWRmb3JtLm5ldFwnLFxuICAgICAgICBwbTogMTQwNTczNCxcbiAgICAgICAgZGl2aWRlcjogZW5jb2RlVVJJQ29tcG9uZW50KFwnfFwnKSxcbiAgICAgICAgcGFnZW5hbWU6IGVuY29kZVVSSUNvbXBvbmVudChcJ2FtYXpvbl9yZW1hcmtldGluZ19taWNyb3NpdGVfdmlzaXRzX2N6XCcpXG4gICAgfSk7XG4gICAgKGZ1bmN0aW9uICgpIHsgdmFyIHMgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KFwnc2NyaXB0XCcpOyBzLnR5cGUgPSBcJ3RleHQvamF2YXNjcmlwdFwnOyBzLmFzeW5jID0gdHJ1ZTsgcy5zcmMgPSBcJ2h0dHBzOi8vczIuYWRmb3JtLm5ldC9iYW5uZXJzL3NjcmlwdHMvc3QvdHJhY2twb2ludC1hc3luYy5qc1wnOyB2YXIgeCA9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKFwnc2NyaXB0XCcpWzBdOyB4LnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKHMsIHgpOyB9KSgpO1xuXG48L3NjcmlwdD5cbjxub3NjcmlwdD5cbiAgICA8cCBzdHlsZT0ibWFyZ2luOjA7cGFkZGluZzowO2JvcmRlcjowOyI+XG4gICAgICAgIDxpbWcgc3JjPSJodHRwczovL3RyYWNrLmFkZm9ybS5uZXQvU2VydmluZy9UcmFja1BvaW50Lz9wbT0xNDA1NzM0JkFERlBhZ2VOYW1lPWFtYXpvbl9yZW1hcmtldGluZ19taWNyb3NpdGVfdmlzaXRzX2N6JkFERmRpdmlkZXI9fCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgYWx0PSIiIC8+XG4gICAgPC9wPlxuPC9ub3NjcmlwdD5cbjwhLS0gQWRmb3JtIFRyYWNraW5nIENvZGUgRU5EIC0tPicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6ICdodG1sJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMYzUyMmY2NTNmNTgzNGM5OGI3MGJiZDk3YTFmYWVmY2InLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdKb2JBcHBsaWNhdGlvbjpSZXF1ZXN0SW5mbycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAncmVxdWVzdEluZm9ybWF0aW9uYWxCdXR0b25DbGljaycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclZXZlbnREYXRhOmpvYklkJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI2MicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVldmVudERhdGE6cGVvcGxlU29mdElkJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ5NycgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdSZXF1ZXN0IEluZm9ybWF0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxhNWEwNjk1ZTAwN2Y0NGVkYWMyZjQ3ODdlYmIzNmI1YScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Bhc3Nwb3J0OlVwZGF0ZVBhc3N3b3JkRXhpdCcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAncGFzc3BvcnRVcGRhdGVQYXNzd29yZEV4aXQnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0cmFja2VyUHJvcGVydGllczogeyBldmVudHM6IFt7IG5hbWU6ICdldmVudDQ2JyB9XSB9IH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1Bhc3Nwb3J0IEV2ZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMMTk3MTUzOGQzYjlhNDE1M2E5M2NhMThiMDQzOTA2Y2EnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdjb250ZW50OkxpbmtDbGljaycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnbGlua0NsaWNrJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjIxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6TGlua05hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wMjMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDpMaW5rTmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQzNycgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdMaW5rIENsaWNrJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw2MzRkZjZiZTc0ODI0OWUzYTViZjZhNjA4ZjI2ZDg3NicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2pvYkFwcGxpY2F0aW9uOkRhc2hib2FyZCBWaWV3cycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnam9iQXBwbGljYXRpb25WaWV3cycgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhY2tlclByb3BlcnRpZXM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVZhcnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIyOCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OnBlcnNvbklEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDIwJyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ0pvYiBBcHBsaWNhdGlvbiBEYXNoYm9hcmQgVmlld3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDc3MmQwMTBlYjI2OTQyM2ZhZTdiNmNiYzBhNzY0NTBlJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnQ1ogTGFuZGluZyBQYWdlIC0gUk1LIHRhZycsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvcGFnZUJvdHRvbS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2NvbmRpdGlvbnMvY3VzdG9tQ29kZS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2h0dHBzOi8vd3d3LmFtYXpvbi5qb2JzL2NzL2xhbmRpbmdfcGFnZXMvcHJhY2UnID09IGRvY3VtZW50LmxvY2F0aW9uLmhyZWYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICdcbjwhLS0gR2xvYmFsIHNpdGUgdGFnIChndGFnLmpzKSAtIEdvb2dsZSBBZHM6IDc5NTY3NDU2MCAtLT5cbjxzY3JpcHQgYXN5bmMgc3JjPSJodHRwczovL3d3dy5nb29nbGV0YWdtYW5hZ2VyLmNvbS9ndGFnL2pzP2lkPUFXLTc5NTY3NDU2MCI+PC9zY3JpcHQ+XG48c2NyaXB0PlxuICB3aW5kb3cuZGF0YUxheWVyID0gd2luZG93LmRhdGFMYXllciB8fCBbXTtcbiAgZnVuY3Rpb24gZ3RhZygpe2RhdGFMYXllci5wdXNoKGFyZ3VtZW50cyk7fVxuICBndGFnKFwnanNcJywgbmV3IERhdGUoKSk7XG5cbiAgZ3RhZyhcJ2NvbmZpZ1wnLCBcJ0FXLTc5NTY3NDU2MFwnKTtcbjwvc2NyaXB0PlxuJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZTogJ2h0bWwnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw0YTk5ODExMzA2ZDg0MjgzODY2M2E3ZGQxNmFkM2JiZicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1NNUyBFcnJvcicsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAnU01TIEVycm9yJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNTQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclU01TOlNpdGVFcnJvciAlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjg5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVVzZXIgU3RhdHVzJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI5OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVTTVM6U3RlcG5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDExOCcgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdTTVMgRXJyb3InLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDg2ZDgyNTRmNGNmMDRhN2NhZWI3ZTRhNDcxNDk1NWY2JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnSm9iU2VhcmNoOkpvYlNlYXJjaFJlc3VsdHMnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3NlYXJjaCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb25zb2xlLmxvZyhKU09OLnN0cmluZ2lmeShkaWdpdGFsRGF0YSwgbnVsbCwgJ1x0JykpLCAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tU2V0dXA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coSlNPTi5zdHJpbmdpZnkoZGlnaXRhbERhdGEsIG51bGwsICdcdCcpKSwgdC5saW5rVHJhY2tWYXJzID0gJ2V2ZW50cyxlVmFyNyxlVmFyOCxwcm9wMjEnLCB0LmxpbmtUcmFja0V2ZW50cyA9ICdldmVudDMsZXZlbnQ3LGV2ZW50MzQnLCBjb25zb2xlLmxvZyhfc2F0ZWxsaXRlLmdldFZhcignSm9iU2VhcmNoOk5vT2ZSZXN1bHRzJykgKyAnZmlyZWQnKSwgJ3plcm8nID09IF9zYXRlbGxpdGUuZ2V0VmFyKCdKb2JTZWFyY2g6Tm9PZlJlc3VsdHMnKSA/IHQuZXZlbnRzID0gdC5hcGwodC5ldmVudHMsICdldmVudDM0JywgJywnLCAxKSA6IHQuZXZlbnRzID0gdC5hcGwodC5ldmVudHMsICdldmVudDcnLCAnLCcsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVKb2JTZWFyY2g6U2VhcmNoVGVybSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyOCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVKb2JTZWFyY2g6Tm9PZlJlc3VsdHMlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjI4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6cGVyc29uSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAncHJvcDIxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJUpvYlNlYXJjaDpTZWFyY2hUZXJtJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxiMmJhNTRlNTFkYjM0Zjc1OGUzMmRmMDI3Y2VlNzI0MycsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Bhc3Nwb3J0OkFjY291bnRDb25maXJtZWQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3Bhc3Nwb3J0QWNjb3VudENvbmZpcm1lZCcgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHRyYWNrZXJQcm9wZXJ0aWVzOiB7IGV2ZW50czogW3sgbmFtZTogJ2V2ZW50NDInIH1dIH0gfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnUGFzc3BvcnQgRXZlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkw1NWNiYjhlZDg4NjY0YmNmYjY2M2VjMzEyZWQ5YTAxOCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1VzZXI6TG9naW4gU3RhcnQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2xvZ2luU3RhcnQnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0cmFja2VyUHJvcGVydGllczogeyBldmVudHM6IFt7IG5hbWU6ICdldmVudDEnIH1dIH0gfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnTG9naW4gU3RhcnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDg1ZTZlNzJhMjY4NDRjZjNhZWFjMmEwMTlkNmNmMjk1JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAncGFzc3BvcnQ6U29jaWFsTG9naW5TdWNjZXNzQWxyZWFkeUxpbmtlZCcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAncGFzc3BvcnRTb2NpYWxMb2dpblN1Y2Nlc3NBbHJlYWR5TGlua2VkJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjb250ZW50OlBhZ2VOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6dXNlclR5cGUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjMwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6dXNlcklEJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIxNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVjYW1wYWlnbiUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdwcm9wNDAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclcGFzc3BvcnRFdmVudFBhcmFtcyUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ3NCcgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5uZWw6ICclY29udGVudDpTaXRlU2VjdGlvbiUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlTmFtZTogJyVjb250ZW50OlBhZ2VOYW1lJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NlbmRCZWFjb24uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAnbGluaycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua05hbWU6ICdQYXNzcG9ydCBFdmVudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDVlOGQxOTVjODMwYjQyOTFhNjJhMDQ5Nzc5NTI2MjZhJywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAnU01TIFZlcmlmeSBOdW1iZXInLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ1NNUyBWZXJpZnkgTnVtYmVyJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyODknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclVXNlciBTdGF0dXMlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjk5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJVNNUzpTdGVwbmFtZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MTM0JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1NNUyBWZXJpZnkgTnVtYmVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxjZTNjZDVjZmY4ZTQ0MTBlYjZmZWQwY2ViYTI2NzEwNicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Bhc3Nwb3J0OkNvbmZpcm1QYXNzd29yZElucHV0RXJyb3InLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3Bhc3Nwb3J0Q29uZmlybVBhc3N3b3JkSW5wdXRFcnJvcicgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW10sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogWwogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9jbGVhclZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2V0VmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHRyYWNrZXJQcm9wZXJ0aWVzOiB7IGV2ZW50czogW3sgbmFtZTogJ2V2ZW50NTYnIH1dIH0gfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ2xpbmsnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtOYW1lOiAnUGFzc3BvcnQgRXZlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxjODNiMzNlODBiNmQ0NDNmODQ0N2EzZmM2YTY3N2JjNScsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1BMIExhbmRpbmcgUGFnZSAtIFBpeGVsJywKICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnY29yZS9zcmMvbGliL2V2ZW50cy9wYWdlQm90dG9tLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVPcmRlcjogNTAKICAgICAgICAgICAgICAgICAgICAgICAgfV0sCiAgICAgICAgICAgICAgICAgICAgY29uZGl0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9jdXN0b21Db2RlLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6Ly93d3cuYW1hem9uLmpvYnMvcGwvbGFuZGluZ19wYWdlcy9wcmFjYScgPT0gZG9jdW1lbnQubG9jYXRpb24uaHJlZiB8fCAnaHR0cHM6Ly93d3cuYW1hem9uLmpvYnMvcGwvbGFuZGluZ19wYWdlcy9wcmFjYS1rYXRvd2ljZScgPT0gZG9jdW1lbnQubG9jYXRpb24uaHJlZiB8fCAnaHR0cHM6Ly93d3cuYW1hem9uLmpvYnMvcGwvbGFuZGluZ19wYWdlcy9wcmFjYS13cm9jbGF3JyA9PSBkb2N1bWVudC5sb2NhdGlvbi5ocmVmIHx8ICdodHRwczovL3d3dy5hbWF6b24uam9icy9wbC9sYW5kaW5nX3BhZ2VzL3ByYWNhLWxvZHonID09IGRvY3VtZW50LmxvY2F0aW9uLmhyZWYgfHwgJ2h0dHBzOi8vd3d3LmFtYXpvbi5qb2JzL3BsL2xhbmRpbmdfcGFnZXMvcHJhY2EtU3pjemVjaW4nID09IGRvY3VtZW50LmxvY2F0aW9uLmhyZWYgfHwgJ2h0dHBzOi8vd3d3LmFtYXpvbi5qb2JzL3BsL2xhbmRpbmdfcGFnZXMvcHJhY2EtcG96bmFuJyA9PSBkb2N1bWVudC5sb2NhdGlvbi5ocmVmIHx8ICdodHRwczovL3d3dy5hbWF6b24uam9icy9wbC9sYW5kaW5nX3BhZ2VzL3ByYWNhLXN3aWVib2R6aW4nID09IGRvY3VtZW50LmxvY2F0aW9uLmhyZWYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9hY3Rpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6ICc8IS0tXG5TdGFydCBvZiBGbG9vZGxpZ2h0IFRhZzogUGxlYXNlIGRvIG5vdCByZW1vdmVcbkFjdGl2aXR5IG5hbWUgb2YgdGhpcyB0YWc6IEFtYXpvbi5Kb2JzX0hQXG5VUkwgb2YgdGhlIHdlYnBhZ2Ugd2hlcmUgdGhlIHRhZyBpcyBleHBlY3RlZCB0byBiZSBwbGFjZWQ6IGh0dHBzOi8vd3d3LmFtYXpvbi5qb2JzL3BsL2xhbmRpbmdfcGFnZXMvXG5UaGlzIHRhZyBtdXN0IGJlIHBsYWNlZCBiZXR3ZWVuIHRoZSA8Ym9keT4gYW5kIDwvYm9keT4gdGFncywgYXMgY2xvc2UgYXMgcG9zc2libGUgdG8gdGhlIG9wZW5pbmcgdGFnLlxuQ3JlYXRpb24gRGF0ZTogMDMvMDQvMjAyMVxuLS0+XG48c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+XG52YXIgYXhlbCA9IE1hdGgucmFuZG9tKCkgKyAiIjtcbnZhciBhID0gYXhlbCAqIDEwMDAwMDAwMDAwMDAwO1xuZG9jdW1lbnQud3JpdGUoXCc8aWZyYW1lIHNyYz0iaHR0cHM6Ly84NzYwNjYwLmZscy5kb3VibGVjbGljay5uZXQvYWN0aXZpdHlpO3NyYz04NzYwNjYwO3R5cGU9bGFuZGkwO2NhdD1hbWF6bzA7ZGNfbGF0PTtkY19yZGlkPTt0YWdfZm9yX2NoaWxkX2RpcmVjdGVkX3RyZWF0bWVudD07dGZ1YT07bnBhPTtnZHByPSR7R0RQUn07Z2Rwcl9jb25zZW50PSR7R0RQUl9DT05TRU5UXzc1NX07b3JkPVwnICsgYSArIFwnPyIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZnJhbWVib3JkZXI9IjAiIHN0eWxlPSJkaXNwbGF5Om5vbmUiPjwvaWZyYW1lPlwnKTtcbjwvc2NyaXB0PlxuPG5vc2NyaXB0PlxuPGlmcmFtZSBzcmM9Imh0dHBzOi8vODc2MDY2MC5mbHMuZG91YmxlY2xpY2submV0L2FjdGl2aXR5aTtzcmM9ODc2MDY2MDt0eXBlPWxhbmRpMDtjYXQ9YW1hem8wO2RjX2xhdD07ZGNfcmRpZD07dGFnX2Zvcl9jaGlsZF9kaXJlY3RlZF90cmVhdG1lbnQ9O3RmdWE9O25wYT07Z2Rwcj0ke0dEUFJ9O2dkcHJfY29uc2VudD0ke0dEUFJfQ09OU0VOVF83NTV9O29yZD0xPyIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZnJhbWVib3JkZXI9IjAiIHN0eWxlPSJkaXNwbGF5Om5vbmUiPjwvaWZyYW1lPlxuPC9ub3NjcmlwdD5cbjwhLS0gRW5kIG9mIEZsb29kbGlnaHQgVGFnOiBQbGVhc2UgZG8gbm90IHJlbW92ZSAtLT4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAnaHRtbCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfV0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDIyYzgzMTEwNjg3YjQxM2ZiZGU1MGZhM2JmODRkOGI2JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAndW5zdWJzY3JpYmU6dW5zdWJzY3JpYmUnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3Vuc3Vic2NyaWJlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXIzOScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVPcHQgT3V0OiBTeXN0ZW0lJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjQwJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJU9wdCBPdXQ6IFNvdXJjZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNDEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclT3B0IE91dDogQmVhbWVyeSBDYW1wYWlnbiBJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNDInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclT3B0IE91dDogQmVhbWVyeSBDb252ZXJzYXRpb24gSUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDUzJyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1Vuc3Vic2NyaWJlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxmZmUxMDZjZTYyYTc0YzgwYmU3OTM5NzljNDllZWFkMCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ01hcmtldGluZzpTb2NpYWxDbGlja3MnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3NvY2lhbFNoYXJlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclTWFya2V0aW5nOiBTb2NpYWxQbGF0Zm9ybSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQ0JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1NvY2lhbCBDbGlja3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtUeXBlOiAnbycKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWQ6ICdSTDk4YjhjYWI4ODMwZDRjMTc5ZDdkNWU0ZDY1NDZhNDY4JywKICAgICAgICAgICAgICAgICAgICBuYW1lOiAncGFzc3BvcnQ6U29jaWFsTG9naW5Jbml0aWF0ZWQnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ3Bhc3Nwb3J0U29jaWFsTG9naW5Jbml0aWF0ZWQnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNvbnRlbnQ6UGFnZU5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDp1c2VyVHlwZSUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMzAnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclY29udGVudDp1c2VySUQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjE0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNhbXBhaWduJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcHM6IFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ3Byb3A0MCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVwYXNzcG9ydEV2ZW50UGFyYW1zJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDcwJyB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbm5lbDogJyVjb250ZW50OlNpdGVTZWN0aW9uJScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VOYW1lOiAnJWNvbnRlbnQ6UGFnZU5hbWUlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1Bhc3Nwb3J0IEV2ZW50cycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlua1R5cGU6ICdvJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZDogJ1JMNGExODY1YWJkNjNhNGQ2NzlmZWYwMjQwOTM5M2Q5NTYnLAogICAgICAgICAgICAgICAgICAgIG5hbWU6ICdDYXJlZXIgZGF5IHJ1bGUnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL3BhZ2VCb3R0b20uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2RvbWFpbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbWFpbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2FtYXpvbi5qb2JzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Bhc3Nwb3J0LmFtYXpvbi53b3JrJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZWdhdGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1c3RvbVNldHVwOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG4oKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF3aW5kb3cuc19sb2FkVCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyBEYXRlKCkuZ2V0VGltZSgpLCB0ID0gd2luZG93LnBlcmZvcm1hbmNlID8gcGVyZm9ybWFuY2UudGltaW5nIDogMCwgbiA9IHQgPyB0LnJlcXVlc3RTdGFydCA6IHdpbmRvdy5pbkhlYWRUUyB8fCAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzX2xvYWRUID0gbiA/IE1hdGgucm91bmQoKGUgLSBuKSAvIDEwMCkgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNfbG9hZFQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFZpc2l0b3IuZ2V0SW5zdGFuY2UoJzRFRTFCQjY1NTVGOTM2OUE3RjAwMDEwMUBBZG9iZU9yZycpLmdldE1hcmtldGluZ0Nsb3VkVmlzaXRvcklEKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhICYmICh0LmVWYXI2ID0gYSksIHQucHJvcDUgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2YgVmlzaXRvciA/ICdWaXNpdG9yQVBJIFByZXNlbnQnIDogJ1Zpc2l0b3JBUEkgTWlzc2luZycsIHQucHJvcDIgPSAnRD10Jywgd2luZG93LmxvY2F0aW9uLmhyZWYuaW5kZXhPZignNDA0JykgPiAwICYmICh0LnBhZ2VUeXBlID0gJ2Vycm9yUGFnZScpLCB0LmVWYXIxNSA9IHdpbmRvdy5sb2NhdGlvbi5ob3N0bmFtZSwgdC5lVmFyMTYgPSB3aW5kb3cubG9jYXRpb24ucGF0aG5hbWUsIHQucHJvcDEzID0gd2luZG93LmxvY2F0aW9uLmhyZWYsIHQucHJvcDE0ID0gbigpLCB0LnByb3AxNyA9ICdEPWonLCB0LnByb3AxOCA9IGRvY3VtZW50LnRpdGxlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBsb2NhdGlvbi5zZWFyY2guc3BsaXQoJz0nKSwgciA9IGlbMF0uc3Vic3RyKDEsIGlbMF0ubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHJvcDE5ID0gciwgdC51c2VQbHVnaW5zID0gITAsIHQuZG9QbHVnaW5zID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnBhZ2VOYW1lID0gcygpLCBlLlV0aWwuZ2V0UXVlcnlQYXJhbSgndXRtX21lZGl1bScpICYmIChlLmVWYXIxNyA9IGUuVXRpbC5nZXRRdWVyeVBhcmFtKCd1dG1fbWVkaXVtJykgKyAnOicgKyBlLlV0aWwuZ2V0UXVlcnlQYXJhbSgndXRtX3NvdXJjZScpICsgJzonICsgZS5VdGlsLmdldFF1ZXJ5UGFyYW0oJ3V0bV90ZXJtJykgKyAnOicgKyBlLlV0aWwuZ2V0UXVlcnlQYXJhbSgndXRtX2NvbnRlbnQnKSksIGUuZVZhcjE3ID0gZS5nZXRWYWxPbmNlKGUuZVZhcjE3LCAnc19lVmFyMTcnKSwgZS5wcm9wMjUgPSBlLmdldERheXNTaW5jZUxhc3RWaXNpdCgnc19sdicpLCBlLnByb3AyMiA9IGUuZ2V0TmV3UmVwZWF0KDMwLCAnc19nZXROZXdSZXBlYXQnKSwgZS5wcm9wMTAgPSBlLmdldFByZXZpb3VzVmFsdWUoZS5wYWdlTmFtZSwgJ2dwdicsICcnKSwgZS5wcm9wMTAgJiYgKGUuZVZhcjI1ID0gJ0Q9YzEwJywgZS5wcm9wMTEgPSBlLmdldFBlcmNlbnRQYWdlVmlld2VkKCksIGUucHJvcDEwICYmICdubyB2YWx1ZScgIT0gZS5wcm9wMTAgfHwgKGUucHJvcDExID0gJycpKSwgZS5lVmFyMzIgPSBlLnByb3AzID0gZS5nZXRUaW1lUGFydGluZygnbicsICctOCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5fdHBEU1QgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxMjogJzQvMSwxMC83JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDEzOiAnNC83LDEwLzYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTQ6ICc0LzYsMTAvNScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxNTogJzQvNSwxMC80JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDE2OiAnNC8zLDEwLzInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTc6ICc0LzIsMTAvMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxODogJzQvMSwxMC83JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDE5OiAnNC83LDEwLzYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMjA6ICc0LzUsMTAvNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAyMTogJzQvNCwxMC8zJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5fdHBEU1QgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxMjogJzMvMTEsMTEvNCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxMzogJzMvMTAsMTEvMycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxNDogJzMvOSwxMS8yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDE1OiAnMy84LDExLzEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTY6ICczLzEzLDExLzYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTc6ICczLzEyLDExLzUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTg6ICczLzExLDExLzQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTk6ICczLzEwLDExLzMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMjA6ICczLzgsMTEvMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAyMTogJzMvMTQsMTEvNycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQuX3RwRFNUID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTI6ICczLzI1LDEwLzI4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDEzOiAnMy8zMSwxMC8yNycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxNDogJzMvMzAsMTAvMjYnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTU6ICczLzI5LDEwLzI1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDE2OiAnMy8yNywxMC8zMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAxNzogJzMvMjYsMTAvMjknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMTg6ICczLzI1LDEwLzI4JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDE5OiAnMy8zMSwxMC8yNycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAyMDogJzMvMjksMTAvMjUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMjE6ICczLzI4LDEwLzMxJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdC5nZXRQcmV2aW91c1ZhbHVlID0gbmV3IEZ1bmN0aW9uKCd2JywgJ2MnLCAnZWwnLCAndmFyIHM9dGhpcyx0PW5ldyBEYXRlLGksaixyPVwnXCc7dC5zZXRUaW1lKHQuZ2V0VGltZSgpKzE4MDAwMDApO2lmKGVsKXtpZihzLmV2ZW50cyl7aT1zLnNwbGl0KGVsLFwnLFwnKTtqPXMuc3BsaXQocy5ldmVudHMsXCcsXCcpO2Zvcih4IGluIGkpe2Zvcih5IGluIGope2lmKGlbeF09PWpbeV0pe2lmKHMuY19yKGMpKSByPXMuY19yKGMpO3Y/cy5jX3coYyx2LHQpOnMuY193KGMsXCdubyB2YWx1ZVwnLHQpO3JldHVybiByfX19fX1lbHNle2lmKHMuY19yKGMpKSByPXMuY19yKGMpO3Y/cy5jX3coYyx2LHQpOnMuY193KGMsXCdubyB2YWx1ZVwnLHQpO3JldHVybiByfScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBmdW5jdGlvbiAoZSwgdCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gbG9jYXRpb24uaG9zdG5hbWUsIHIgPSBsb2NhdGlvbi5wYXRobmFtZS5zdWJzdHJpbmcoMSkuc3BsaXQoJy8nKSwgcyA9IHIubGVuZ3RoLCBvID0gbG9jYXRpb24uc2VhcmNoLnN1YnN0cmluZygxKS5zcGxpdCgnJicpLCBjID0gby5sZW5ndGgsIGwgPSBsb2NhdGlvbi5oYXNoLnN1YnN0cmluZygxKS5zcGxpdCgnJicpLCB1ID0gbC5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEgPSBhIHx8ICc6ICcsIGUgPSBlIHx8IGksIHQgPSB0IHx8ICcnLCBuID0gbiB8fCAnJywgMSA9PT0gcyAmJiAnJyA9PT0gclswXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUgKyBhICsgJ2hvbWUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHM7IGkrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlICsgYSArIGRlY29kZVVSSUNvbXBvbmVudChyW2ldKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiAoMSAhPT0gYyB8fCAnJyAhPT0gb1swXSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAocyA9IChyID0gdC5zcGxpdCgnLCcpKS5sZW5ndGgsIGkgPSAwOyBpIDwgczsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh0ID0gMDsgdCA8IGM7IHQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocltpXSA9PT0gb1t0XS5zcGxpdCgnPScpWzBdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBlICsgYSArIGRlY29kZVVSSUNvbXBvbmVudChvW3RdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuICYmICgxICE9PSB1IHx8ICcnICE9PSBsWzBdKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChvID0gKG4gPSBuLnNwbGl0KCcsJykpLmxlbmd0aCwgaSA9IDA7IGkgPCBvOyBpKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHQgPSAwOyB0IDwgdTsgdCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuW2ldID09PSBsW3RdLnNwbGl0KCc9JylbMF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUgKyBhICsgZGVjb2RlVVJJQ29tcG9uZW50KGxbdF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3Vic3RyaW5nKGUubGVuZ3RoIC0gYS5sZW5ndGgpID09PSBhID8gZS5zdWJzdHJpbmcoMCwgZS5sZW5ndGggLSBhLmxlbmd0aCkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc3BsaXQgPSBuZXcgRnVuY3Rpb24oJ2wnLCAnZCcsICd2YXIgaSx4PTAsYT1uZXcgQXJyYXk7d2hpbGUobCl7aT1sLmluZGV4T2YoZCk7aT1pPi0xP2k6bC5sZW5ndGg7YVt4KytdPWwuc3Vic3RyaW5nKDAsaSk7bD1sLnN1YnN0cmluZyhpK2QubGVuZ3RoKTt9cmV0dXJuIGEnKSwgdC5nZXRQZXJjZW50UGFnZVZpZXdlZCA9IG5ldyBGdW5jdGlvbignbicsICd2YXIgcz10aGlzLFc9d2luZG93LEVMPVcuYWRkRXZlbnRMaXN0ZW5lcixBRT1XLmF0dGFjaEV2ZW50LEU9W1wnbG9hZFwnLFwndW5sb2FkXCcsXCdzY3JvbGxcJyxcJ3Jlc2l6ZVwnLFwnem9vbVwnLFwna2V5dXBcJyxcJ21vdXNldXBcJyxcJ3RvdWNoZW5kXCcsXCdvcmllbnRhdGlvbmNoYW5nZVwnLFwncGFuXCddO1cuc19PYmo9cztzX1BQVmlkPShuPT1cJy1cJz9zLnBhZ2VOYW1lOm4pfHxzLnBhZ2VOYW1lfHxsb2NhdGlvbi5ocmVmO2lmKCFXLnNfUFBWZXZlbnQpe3Muc19QUFZnPWZ1bmN0aW9uKG4scil7dmFyIGs9XCdzX3BwdlwnLHA9aytcJ2xcJyxjPXMuY19yKG58fHI/azpwKSxhPWMuaW5kZXhPZihcJyxcJyk+LTE/Yy5zcGxpdChcJyxcJywxMCk6W1wnXCddLGw9YS5sZW5ndGgsaTthWzBdPXVuZXNjYXBlKGFbMF0pO3I9cnx8KG4mJm4hPWFbMF0pfHwwO2EubGVuZ3RoPTEwO2lmKHR5cGVvZiBhWzBdIT1cJ3N0cmluZ1wnKWFbMF09XCdcJztmb3IoaT0xO2k8MTA7aSsrKWFbaV09IXImJmk8bD9wYXJzZUludChhW2ldKXx8MDowO2lmKGw8MTB8fHR5cGVvZiBhWzldIT1cJ3N0cmluZ1wnKWFbOV09XCdcJztpZihyKXtzLmNfdyhwLGMpO3MuY193KGssXCc/XCcpfXJldHVybiBhfTtXLnNfUFBWZXZlbnQ9ZnVuY3Rpb24oZSl7dmFyIFc9d2luZG93LEQ9ZG9jdW1lbnQsQj1ELmJvZHksRT1ELmRvY3VtZW50RWxlbWVudCxTPXdpbmRvdy5zY3JlZW58fDAsSG89XCdvZmZzZXRIZWlnaHRcJyxIcz1cJ3Njcm9sbEhlaWdodFwnLFRzPVwnc2Nyb2xsVG9wXCcsV2M9XCdjbGllbnRXaWR0aFwnLEhjPVwnY2xpZW50SGVpZ2h0XCcsQz0xMDAsTT1NYXRoLEo9XCdvYmplY3RcJyxOPVwnbnVtYmVyXCcscz1XLnNfT2JqfHxXLnN8fDA7ZT1lJiZ0eXBlb2YgZT09Sj9lLnR5cGV8fFwnXCc6XCdcJztpZighZS5pbmRleE9mKFwnb25cJykpZT1lLnN1YnN0cmluZygyKTtzX1BQVmk9Vy5zX1BQVml8fDA7aWYoVy5zX1BQVnQmJiFlKXtjbGVhclRpbWVvdXQoc19QUFZ0KTtzX1BQVnQ9MDtpZihzX1BQVmk8MilzX1BQVmkrK31pZih0eXBlb2Ygcz09Sil7dmFyIGg9TS5tYXgoQltIc118fEVbSHNdLEJbSG9dfHxFW0hvXSxCW0hjXXx8RVtIY10pLFg9Vy5pbm5lcldpZHRofHxFW1djXXx8QltXY118fDAsWT1XLmlubmVySGVpZ2h0fHxFW0hjXXx8QltIY118fDAseD1TP1Mud2lkdGg6MCx5PVM/Uy5oZWlnaHQ6MCxyPU0ucm91bmQoQyooVy5kZXZpY2VQaXhlbFJhdGlvfHwxKSkvQyxiPShELnBhZ2VZT2Zmc2V0fHxFW1RzXXx8QltUc118fDApK1kscD1oPjAmJmI+MD9NLnJvdW5kKEMqYi9oKTowLE89Vy5vcmllbnRhdGlvbixvPSFpc05hTihPKT9NLmFicyhvKSUxODA6WT5YPzA6OTAsTD1lPT1cJ2xvYWRcJ3x8c19QUFZpPDEsYT1zLnNfUFBWZyhzX1BQVmlkLEwpLFY9ZnVuY3Rpb24oaSx2LGYsbil7aT1wYXJzZUludCh0eXBlb2YgYT09SiYmYS5sZW5ndGg+aT9hW2ldOlwnMFwnKXx8MDt2PXR5cGVvZiB2IT1OP2k6djt2PWZ8fHY+aT92Omk7cmV0dXJuIG4/djp2PkM/Qzp2PDA/MDp2fTtpZihuZXcgUmVnRXhwKFwnKGlQb2R8aVBhZHxpUGhvbmUpXCcpLmV4ZWMobmF2aWdhdG9yLnVzZXJBZ2VudHx8XCdcJykmJm8pe289eDt4PXk7eT1vfW89bz9cJ1BcJzpcJ0xcJzthWzldPUw/XCdcJzphWzldLnN1YnN0cmluZygwLDEpO3MuY193KFwnc19wcHZcJyxlc2NhcGUoVy5zX1BQVmlkKStcJyxcJytWKDEscCxMKStcJyxcJysoTHx8IVYoMik/cDpWKDIpKStcJyxcJytWKDMsYixMLDEpK1wnLFwnK1grXCcsXCcrWStcJyxcJyt4K1wnLFwnK3krXCcsXCcrcitcJyxcJythWzldKyhhWzldPT1vP1wnXCc6bykpfWlmKCFXLnNfUFBWdCYmZSE9XCd1bmxvYWRcJylXLnNfUFBWdD1zZXRUaW1lb3V0KFcuc19QUFZldmVudCwzMzMpfTtmb3IodmFyIGY9Vy5zX1BQVmV2ZW50LGk9MDtpPEUubGVuZ3RoO2krKylpZihFTClFTChFW2ldLGYsZmFsc2UpO2Vsc2UgaWYoQUUpQUUoXCdvblwnK0VbaV0sZik7ZigpfTt2YXIgYT1zLnNfUFBWZygpO3JldHVybiFufHxuPT1cJy1cJz9hWzFdOmEnKSwgdC5nZXRUaW1lUGFydGluZyA9IG5ldyBGdW5jdGlvbignaCcsICd6JywgJ3ZhciBzPXRoaXMsb2Q7b2Q9bmV3IERhdGUoXCcxLzEvMjAwMFwnKTtpZihvZC5nZXREYXkoKSE9Nnx8b2QuZ2V0TW9udGgoKSE9MCl7cmV0dXJuXCdEYXRhIE5vdCBBdmFpbGFibGVcJzt9ZWxzZXt2YXIgSCxNLEQsVSxkcyxkZSx0bSxkYT1bXCdTdW5kYXlcJyxcJ01vbmRheVwnLFwnVHVlc2RheVwnLFwnV2VkbmVzZGF5XCcsXCdUaHVyc2RheVwnLFwnRnJpZGF5XCcsXCdTYXR1cmRheVwnXSxkPW5ldyBEYXRlKCk7ej16P3o6MDt6PXBhcnNlRmxvYXQoeik7aWYocy5fdHBEU1Qpe3ZhciBkc289cy5fdHBEU1RbZC5nZXRGdWxsWWVhcigpXS5zcGxpdCgvLC8pO2RzPW5ldyBEYXRlKGRzb1swXStcJy9cJytkLmdldEZ1bGxZZWFyKCkpO2RlPW5ldyBEYXRlKGRzb1sxXStcJy9cJytkLmdldEZ1bGxZZWFyKCkpO2lmKGg9PVwnblwnJiZkPmRzJiZkPGRlKXt6PXorMTt9ZWxzZSBpZihoPT1cJ3NcJyYmKGQ+ZGV8fGQ8ZHMpKXt6PXorMTt9fWQ9ZC5nZXRUaW1lKCkrKGQuZ2V0VGltZXpvbmVPZmZzZXQoKSo2MDAwMCk7ZD1uZXcgRGF0ZShkKygzNjAwMDAwKnopKTtIPWQuZ2V0SG91cnMoKTtNPWQuZ2V0TWludXRlcygpO009KE08MTApP1wnMFwnK006TTtEPWQuZ2V0RGF5KCk7VT1cJyBBTVwnO2lmKEg+PTEyKXtVPVwnIFBNXCc7SD1ILTEyO31pZihIPT0wKXtIPTEyO31EPWRhW0RdO3RtPUgrXCc6XCcrTStVO3JldHVybih0bStcJ3xcJytEKTt9JyksIHQuZ2V0TmV3UmVwZWF0ID0gbmV3IEZ1bmN0aW9uKCdkJywgJ2NuJywgJ3ZhciBzPXRoaXMsZT1uZXcgRGF0ZSgpLGN2YWwsc3ZhbCxjdD1lLmdldFRpbWUoKTtkPWQ/ZDozMDtjbj1jbj9jbjpcJ3NfbnJcJztlLnNldFRpbWUoY3QrZCoyNCo2MCo2MCoxMDAwKTtjdmFsPXMuY19yKGNuKTtpZihjdmFsLmxlbmd0aD09MCl7cy5jX3coY24sY3QrXCctTmV3XCcsZSk7cmV0dXJuXCdOZXdcJzt9c3ZhbD1zLnNwbGl0KGN2YWwsXCctXCcpO2lmKGN0LXN2YWxbMF08MzAqNjAqMTAwMCYmc3ZhbFsxXT09XCdOZXdcJyl7cy5jX3coY24sY3QrXCctTmV3XCcsZSk7cmV0dXJuXCdOZXdcJzt9ZWxzZXtzLmNfdyhjbixjdCtcJy1SZXBlYXRcJyxlKTtyZXR1cm5cJ1JlcGVhdFwnO30nKSwgdC5zcGxpdCA9IG5ldyBGdW5jdGlvbignbCcsICdkJywgJ3ZhciBpLHg9MCxhPW5ldyBBcnJheTt3aGlsZShsKXtpPWwuaW5kZXhPZihkKTtpPWk+LTE/aTpsLmxlbmd0aDthW3grK109bC5zdWJzdHJpbmcoMCxpKTtsPWwuc3Vic3RyaW5nKGkrZC5sZW5ndGgpO31yZXR1cm4gYScpLCB0LmdldFZhbE9uY2UgPSBuZXcgRnVuY3Rpb24oJ3YnLCAnYycsICdlJywgJ3QnLCAndmFyIHM9dGhpcyxhPW5ldyBEYXRlLHY9dj92OlwnXCcsYz1jP2M6XCdzX2d2b1wnLGU9ZT9lOjAsaT10PT1cJ21cJz82MDAwMDo4NjQwMDAwMCxrPXMuY19yKGMpO2lmKHYpe2Euc2V0VGltZShhLmdldFRpbWUoKStlKmkpO3MuY193KGMsdixlPT0wPzA6YSk7fXJldHVybiB2PT1rP1wnXCc6dicpLCB0LmFwbCA9IG5ldyBGdW5jdGlvbignbCcsICd2JywgJ2QnLCAndScsICd2YXIgcz10aGlzLG09MDtpZighbClsPVwnXCc7aWYodSl7dmFyIGksbixhPXMuc3BsaXQobCxkKTtmb3IoaT0wO2k8YS5sZW5ndGg7aSsrKXtuPWFbaV07bT1tfHwodT09MT8obj09dik6KG4udG9Mb3dlckNhc2UoKT09di50b0xvd2VyQ2FzZSgpKSk7fX1pZighbSlsPWw/bCtkK3Y6djtyZXR1cm4gbCcpLCB0LnNwbGl0LCB0LmdldFF1ZXJ5UGFyYW0gPSBuZXcgRnVuY3Rpb24oJ3AnLCAnZCcsICd1JywgJ3ZhciBzPXRoaXMsdj1cJ1wnLGksdDtkPWQ/ZDpcJ1wnO3U9dT91OihzLnBhZ2VVUkw/cy5wYWdlVVJMOnMud2QubG9jYXRpb24pO2lmKHU9PVwnZlwnKXU9cy5ndGZzKCkubG9jYXRpb247d2hpbGUocCl7aT1wLmluZGV4T2YoXCcsXCcpO2k9aTwwP3AubGVuZ3RoOmk7dD1zLnBfZ3B2KHAuc3Vic3RyaW5nKDAsaSksdStcJ1wnKTtpZih0KXt0PXQuaW5kZXhPZihcJyNcJyk+LTE/dC5zdWJzdHJpbmcoMCx0LmluZGV4T2YoXCcjXCcpKTp0O31pZih0KXYrPXY/ZCt0OnQ7cD1wLnN1YnN0cmluZyhpPT1wLmxlbmd0aD9pOmkrMSl9cmV0dXJuIHYnKSwgdC5wX2dwdiA9IG5ldyBGdW5jdGlvbignaycsICd1JywgJ3ZhciBzPXRoaXMsdj1cJ1wnLGk9dS5pbmRleE9mKFwnP1wnKSxxO2lmKGsmJmk+LTEpe3E9dS5zdWJzdHJpbmcoaSsxKTt2PXMucHQocSxcJyZcJyxcJ3BfZ3ZmXCcsayl9cmV0dXJuIHYnKSwgdC5wX2d2ZiA9IG5ldyBGdW5jdGlvbigndCcsICdrJywgJ2lmKHQpe3ZhciBzPXRoaXMsaT10LmluZGV4T2YoXCc9XCcpLHA9aTwwP3Q6dC5zdWJzdHJpbmcoMCxpKSx2PWk8MD9cJ1RydWVcJzp0LnN1YnN0cmluZyhpKzEpO2lmKHAudG9Mb3dlckNhc2UoKT09ay50b0xvd2VyQ2FzZSgpKXJldHVybiBzLmVwYSh2KX1yZXR1cm4gXCdcJycpLCB0LmdldERheXNTaW5jZUxhc3RWaXNpdCA9IG5ldyBGdW5jdGlvbignYycsICd2YXIgcz10aGlzLGU9bmV3IERhdGUoKSxlcz1uZXcgRGF0ZSgpLGN2YWwsY3ZhbF9zLGN2YWxfc3MsY3Q9ZS5nZXRUaW1lKCksZGF5PTI0KjYwKjYwKjEwMDAsZjEsZjIsZjMsZjQsZjU7ZS5zZXRUaW1lKGN0KzMqMzY1KmRheSk7ZXMuc2V0VGltZShjdCszMCo2MCoxMDAwKTtmMD1cJ0Nvb2tpZXMgTm90IFN1cHBvcnRlZFwnO2YxPVwnRmlyc3QgVmlzaXRcJztmMj1cJ01vcmUgdGhhbiAzMCBkYXlzXCc7ZjM9XCdNb3JlIHRoYW4gNyBkYXlzXCc7ZjQ9XCdMZXNzIHRoYW4gNyBkYXlzXCc7ZjU9XCdMZXNzIHRoYW4gMSBkYXlcJztjdmFsPXMuY19yKGMpO2lmKGN2YWwubGVuZ3RoPT0wKXtzLmNfdyhjLGN0LGUpO3MuY193KGMrXCdfc1wnLGYxLGVzKTt9ZWxzZXt2YXIgZD1jdC1jdmFsO2lmKGQ+MzAqNjAqMTAwMCl7aWYoZD4zMCpkYXkpe3MuY193KGMsY3QsZSk7cy5jX3coYytcJ19zXCcsZjIsZXMpO31lbHNlIGlmKGQ8MzAqZGF5KzEgJiYgZD43KmRheSl7cy5jX3coYyxjdCxlKTtzLmNfdyhjK1wnX3NcJyxmMyxlcyk7fWVsc2UgaWYoZDw3KmRheSsxICYmIGQ+ZGF5KXtzLmNfdyhjLGN0LGUpO3MuY193KGMrXCdfc1wnLGY0LGVzKTt9ZWxzZSBpZihkPGRheSsxKXtzLmNfdyhjLGN0LGUpO3MuY193KGMrXCdfc1wnLGY1LGVzKTt9fWVsc2V7cy5jX3coYyxjdCxlKTtjdmFsX3NzPXMuY19yKGMrXCdfc1wnKTtzLmNfdyhjK1wnX3NcJyxjdmFsX3NzLGVzKTt9fWN2YWxfcz1zLmNfcihjK1wnX3NcJyk7aWYoY3ZhbF9zLmxlbmd0aD09MCkgcmV0dXJuIGYwO2Vsc2UgaWYoY3ZhbF9zIT1mMSYmY3ZhbF9zIT1mMiYmY3ZhbF9zIT1mMyYmY3ZhbF9zIT1mNCYmY3ZhbF9zIT1mNSkgcmV0dXJuIFwnXCc7ZWxzZSByZXR1cm4gY3ZhbF9zOycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMTEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclaW50Y21waWQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjE0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWNhbXBhaWduJScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2VWYXI2MycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVVVE0gVXNlciUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sgbmFtZTogJ2V2ZW50MycgfV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VVUkw6ICclUGFnZSBVUkwlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FtcGFpZ246IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVDTVBJRCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxhMjdlNGI5MTc5NjY0ZGM4YTZiOWIzN2UyODExMjMyMicsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ1Jlc3VtZVBhcnNpbmdTZXJ2aWNlOkNhbGwnLAogICAgICAgICAgICAgICAgICAgIGV2ZW50czogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvZXZlbnRzL2RpcmVjdENhbGwuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgaWRlbnRpZmllcjogJ2V4dGVybmFsX3BhcnNlZF9yZXN1bWVfY2FsbF9mcm9tX0EyRDEnIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDUwCiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFtdLAogICAgICAgICAgICAgICAgICAgIGFjdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvY2xlYXJWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHt9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyB0cmFja2VyUHJvcGVydGllczoge30gfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZW5kQmVhY29uLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7IHR5cGU6ICdwYWdlJyB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkwzMDBiMjE1NzRlMmQ0MzVlYmQyMDUzMDBmNjU1Mjg5NCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ2Jhbm5lcjpob21lcGFnZScsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvcGFnZUJvdHRvbS5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlT3JkZXI6IDQ1CiAgICAgICAgICAgICAgICAgICAgICAgIH1dLAogICAgICAgICAgICAgICAgICAgIGNvbmRpdGlvbnM6IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9jb25kaXRpb25zL2N1c3RvbUNvZGUuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzb3VyY2U6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKF9zYXRlbGxpdGUuZ2V0VmFyKCdiYW5uZXI6ZGVzdGluVVJMJykubGVuZ3RoID4gMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdjb3JlL3NyYy9saWIvY29uZGl0aW9ucy9kb21haW4uanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsgZG9tYWluczogWydhbWF6b24uam9icyddIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgYWN0aW9uczogW3sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL3NldFZhcmlhYmxlcy5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrZXJQcm9wZXJ0aWVzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVWYXJzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyNTEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd2YWx1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6ICclYmFubmVyOmRlc3RpblVSTCUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbeyBuYW1lOiAnZXZlbnQzMicgfV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH1dCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlkOiAnUkxiMzQ1OTBlZWQ5M2U0YzBjYjIwNmRlMzk4YmI1NmJjOCcsCiAgICAgICAgICAgICAgICAgICAgbmFtZTogJ0pvYkFwcGxpY2F0aW9uOlJlcXVlc3RJbmZvUHJvY2VlZCcsCiAgICAgICAgICAgICAgICAgICAgZXZlbnRzOiBbewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2NvcmUvc3JjL2xpYi9ldmVudHMvZGlyZWN0Q2FsbC5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogeyBpZGVudGlmaWVyOiAncHJvY2VlZEJ1dHRvbkNsaWNrJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZU9yZGVyOiA1MAogICAgICAgICAgICAgICAgICAgICAgICB9XSwKICAgICAgICAgICAgICAgICAgICBjb25kaXRpb25zOiBbXSwKICAgICAgICAgICAgICAgICAgICBhY3Rpb25zOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZVBhdGg6ICdhZG9iZS1hbmFseXRpY3Mvc3JjL2xpYi9hY3Rpb25zL2NsZWFyVmFyaWFibGVzLmpzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldHRpbmdzOiB7fQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGVQYXRoOiAnYWRvYmUtYW5hbHl0aWNzL3NyYy9saWIvYWN0aW9ucy9zZXRWYXJpYWJsZXMuanMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja2VyUHJvcGVydGllczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlVmFyczogWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICdlVmFyMScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3ZhbHVlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogJyVldmVudERhdGE6am9iSWQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiAnZVZhcjYyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiAndmFsdWUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJWV2ZW50RGF0YTpwZW9wbGVTb2Z0SWQlJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudHM6IFt7IG5hbWU6ICdldmVudDk4JyB9XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlUGF0aDogJ2Fkb2JlLWFuYWx5dGljcy9zcmMvbGliL2FjdGlvbnMvc2VuZEJlYWNvbi5qcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5nczogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdsaW5rJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rTmFtZTogJ1JlcXVlc3QgSW5mb3JtYXRpb24gfCBQcm9jZWVkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rVHlwZTogJ28nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9OwogICAgICAgIHZhciAkX19fdmFyX2FiMGU4YjE3YmNhNTYwOTAgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgZnVuY3Rpb24gZShlKSB7CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ09iamVjdC5hc3NpZ24gY2Fubm90IGJlIGNhbGxlZCB3aXRoIG51bGwgb3IgdW5kZWZpbmVkJyk7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0KGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHQoKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGlmICghT2JqZWN0LmFzc2lnbikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IFN0cmluZygnYWJjJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGVbNV0gPSAnZGUnLCAnNScgPT09IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKGUpWzBdKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IHt9LCBuID0gMDsgbiA8IDEwOyBuKyspCiAgICAgICAgICAgICAgICAgICAgICAgIHRbJ18nICsgU3RyaW5nLmZyb21DaGFyQ29kZShuKV0gPSBuOwogICAgICAgICAgICAgICAgICAgIGlmICgnMDEyMzQ1Njc4OScgIT09IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKHQpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbZV07CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJycpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2FiY2RlZmdoaWprbG1ub3BxcnN0Jy5zcGxpdCgnJykuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBhW2VdID0gZTsKICAgICAgICAgICAgICAgICAgICB9KSwgJ2FiY2RlZmdoaWprbG1ub3BxcnN0JyA9PT0gT2JqZWN0LmtleXMoT2JqZWN0LmFzc2lnbih7fSwgYSkpLmpvaW4oJycpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBuKGUpIHsKICAgICAgICAgICAgICAgIGlmIChlLl9fZXNNb2R1bGUpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB2YXIgdCA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh7fSwgJ19fZXNNb2R1bGUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGUsIG4pOwogICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCBuLCBhLmdldCA/IGEgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW25dOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KSwgdDsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBhKGUpIHsKICAgICAgICAgICAgICAgIHZhciB0ID0geyBleHBvcnRzOiB7fSB9OwogICAgICAgICAgICAgICAgcmV0dXJuIGUodCwgdC5leHBvcnRzKSwgdC5leHBvcnRzOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGkoZSkgewogICAgICAgICAgICAgICAgdmFyIHQgPSB0aGlzLmNvbnN0cnVjdG9yOwogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMudGhlbihmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnJlc29sdmUoZSgpKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0LnJlc29sdmUoZSgpKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQucmVqZWN0KG4pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcihlKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQm9vbGVhbihlICYmIHZvaWQgMCAhPT0gZS5sZW5ndGgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHMoKSB7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gbyhlLCB0KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGUuYXBwbHkodCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gYyhlKSB7CiAgICAgICAgICAgICAgICBpZiAoISh0aGlzIGluc3RhbmNlb2YgYykpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignUHJvbWlzZXMgbXVzdCBiZSBjb25zdHJ1Y3RlZCB2aWEgbmV3Jyk7CiAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdub3QgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgdGhpcy5fc3RhdGUgPSAwLCB0aGlzLl9oYW5kbGVkID0gITEsIHRoaXMuX3ZhbHVlID0gdm9pZCAwLCB0aGlzLl9kZWZlcnJlZHMgPSBbXSwgbShlLCB0aGlzKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBsKGUsIHQpIHsKICAgICAgICAgICAgICAgIGZvciAoOyAzID09PSBlLl9zdGF0ZTspCiAgICAgICAgICAgICAgICAgICAgZSA9IGUuX3ZhbHVlOwogICAgICAgICAgICAgICAgMCAhPT0gZS5fc3RhdGUgPyAoZS5faGFuZGxlZCA9ICEwLCBjLl9pbW1lZGlhdGVGbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSAxID09PSBlLl9zdGF0ZSA/IHQub25GdWxmaWxsZWQgOiB0Lm9uUmVqZWN0ZWQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT09IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGE7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gbihlLl92YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIGQodC5wcm9taXNlLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB1KHQucHJvbWlzZSwgYSk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICgxID09PSBlLl9zdGF0ZSA/IHUgOiBkKSh0LnByb21pc2UsIGUuX3ZhbHVlKTsKICAgICAgICAgICAgICAgIH0pKSA6IGUuX2RlZmVycmVkcy5wdXNoKHQpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHUoZSwgdCkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAodCA9PT0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQSBwcm9taXNlIGNhbm5vdCBiZSByZXNvbHZlZCB3aXRoIGl0c2VsZi4nKTsKICAgICAgICAgICAgICAgICAgICBpZiAodCAmJiAoJ29iamVjdCcgPT0gdHlwZW9mIHQgfHwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0LnRoZW47CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0IGluc3RhbmNlb2YgYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLl9zdGF0ZSA9IDMsIGUuX3ZhbHVlID0gdCwgdm9pZCBwKGUpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIG0obyhuLCB0KSwgZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGUuX3N0YXRlID0gMSwgZS5fdmFsdWUgPSB0LCBwKGUpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgIGQoZSwgdCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gZChlLCB0KSB7CiAgICAgICAgICAgICAgICBlLl9zdGF0ZSA9IDIsIGUuX3ZhbHVlID0gdCwgcChlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBwKGUpIHsKICAgICAgICAgICAgICAgIDIgPT09IGUuX3N0YXRlICYmIDAgPT09IGUuX2RlZmVycmVkcy5sZW5ndGggJiYgYy5faW1tZWRpYXRlRm4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGUuX2hhbmRsZWQgfHwgYy5fdW5oYW5kbGVkUmVqZWN0aW9uRm4oZS5fdmFsdWUpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gMCwgbiA9IGUuX2RlZmVycmVkcy5sZW5ndGg7IHQgPCBuOyB0KyspCiAgICAgICAgICAgICAgICAgICAgbChlLCBlLl9kZWZlcnJlZHNbdF0pOwogICAgICAgICAgICAgICAgZS5fZGVmZXJyZWRzID0gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBmKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIHRoaXMub25GdWxmaWxsZWQgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBlID8gZSA6IG51bGwsIHRoaXMub25SZWplY3RlZCA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIHQgPyB0IDogbnVsbCwgdGhpcy5wcm9taXNlID0gbjsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBtKGUsIHQpIHsKICAgICAgICAgICAgICAgIHZhciBuID0gITE7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGUoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbiB8fCAobiA9ICEwLCB1KHQsIGUpKTsKICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBuIHx8IChuID0gITAsIGQodCwgZSkpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChuKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgbiA9ICEwLCBkKHQsIGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGcoZSkgewogICAgICAgICAgICAgICAgcmV0dXJuICEwID09PSBZZShlKSAmJiAnW29iamVjdCBPYmplY3RdJyA9PT0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGIoZSwgdCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLCB0KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB2KGUpIHsKICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyA9PSB0eXBlb2YgZSAmJiAtMSAhPT0gZS5pbmRleE9mKCdbJykgJiYgLTEgIT09IGUuaW5kZXhPZignXScpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGgoZSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGUuc3Vic3RyKDAsIGUuaW5kZXhPZignWycpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB5KGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgIGlmIChlLmxlbmd0aCAmJiBRZSh0KSkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gZVswXTsKICAgICAgICAgICAgICAgICAgICBpZiAoMSAhPT0gZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlLnNsaWNlKDEpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXYoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geShpLCB0W2FdLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0W2EgPSBoKGEpXTsKICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShyKSAmJiByLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5KGksIGUsIG4pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgdC5oYXNPd25Qcm9wZXJ0eShhKSAmJiAnc3RyaW5nJyA9PSB0eXBlb2YgdFthXSAmJiAodFthXSA9IG4odFthXSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh3aW5kb3cuYXRvYikgewogICAgICAgICAgICAgICAgdmFyIF8gPSBkb2N1bWVudCwgUCA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMsIFMgPSBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LCBDID0gT2JqZWN0LnByb3RvdHlwZS5wcm9wZXJ0eUlzRW51bWVyYWJsZSwgayA9IHQoKSA/IE9iamVjdC5hc3NpZ24gOiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuLCBhLCBpID0gZSh0KSwgciA9IDE7IHIgPCBhcmd1bWVudHMubGVuZ3RoOyByKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgaW4gbiA9IE9iamVjdChhcmd1bWVudHNbcl0pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFMuY2FsbChuLCBzKSAmJiAoaVtzXSA9IG5bc10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gUChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBvID0gMDsgbyA8IGEubGVuZ3RoOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEMuY2FsbChuLCBhW29dKSAmJiAoaVthW29dXSA9IG5bYVtvXV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgIH0sIGogPSBrLCB3ID0gd2luZG93LCBEID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEsIGkgPSBBcnJheS5pc0FycmF5KHQpLCByID0gQm9vbGVhbihpICYmIGUpLCBzID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnYScpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAocy5ocmVmID0gZSwgKCEvXmh0dHBzPzpcL1wvLiovLnRlc3QoZSkgfHwgIXMuaG9zdCkgJiYgaSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBuZXcgRXJyb3IoJ1VuYWJsZSB0byBmaW5kIHRoZSBMaWJyYXJ5IEVtYmVkIENvZGUgZm9yIER5bmFtaWMgSG9zdCBSZXNvbHV0aW9uLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgby5jb2RlID0gJ2R5bmFtaWNfaG9zdF9yZXNvbHZlcl9jb25zdHJ1Y3Rvcl9lcnJvcicsIG87CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgJiYgLTEgPT09IHQuaW5kZXhPZihzLmhvc3RuYW1lKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgRXJyb3IoJ1RoaXMgbGlicmFyeSBpcyBub3QgYXV0aG9yaXplZCBmb3IgdGhpcyBkb21haW4uIFBsZWFzZSBjb250YWN0IHlvdXIgQ1NNIGZvciBtb3JlIGluZm9ybWF0aW9uLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgYy5jb2RlID0gJ2R5bmFtaWNfaG9zdF9ub3RfYWxsb3dlZCcsIGM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBzLmhvc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC86ODAkLy50ZXN0KGUpID8gZSA9IGUucmVwbGFjZSgnOjgwJywgJycpIDogLzo4MFwvJC8udGVzdChlKSA/IGUgPSBlLnJlcGxhY2UoJzo4MC8nLCAnJykgOiAvOjQ0MyQvLnRlc3QoZSkgPyBlID0gZS5yZXBsYWNlKCc6NDQzJywgJycpIDogLzo0NDNcLyQvLnRlc3QoZSkgJiYgKGUgPSBlLnJlcGxhY2UoJzo0NDMvJywgJycpKSwgYSA9ICdodHRwczovLycgKyBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB1ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gciAmJiAnc3RyaW5nJyA9PSB0eXBlb2YgZSA/IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCgpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLycgPT09IGUuY2hhckF0KDApID8gZS5zbGljZSgxKSA6IGUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLmpvaW4oJy8nKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldFR1cmJpbmVIb3N0OiBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlY29yYXRlV2l0aER5bmFtaWNIb3N0OiB1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldCBpc0R5bmFtaWNFbmZvcmNlZCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHcgJiYgbi5vbkRlYnVnQ2hhbmdlZChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA/IHcuZHluYW1pY0hvc3RSZXNvbHZlciA9IGQgOiBkZWxldGUgdy5keW5hbWljSG9zdFJlc29sdmVyOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgZDsKICAgICAgICAgICAgICAgICAgICB9LCBWID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5ldmVudHMgJiYgZS5ldmVudHMuZm9yRWFjaChmdW5jdGlvbiAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50OiBuCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQuc29ydChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZXZlbnQucnVsZU9yZGVyIC0gdC5ldmVudC5ydWxlT3JkZXI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0sIEkgPSAnZGVidWcnLCBUID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0cnVlJyA9PT0gZS5nZXRJdGVtKEkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zZXRJdGVtKEksIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaSA9IFtdLCByID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5vdXRwdXRFbmFibGVkID0gbigpLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkRlYnVnQ2hhbmdlZDogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldERlYnVnRW5hYmxlZDogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldERlYnVnRW5hYmxlZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKCkgIT09IGUgJiYgKGEoZSksIHQub3V0cHV0RW5hYmxlZCA9IGUsIGkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBFID0gJ01vZHVsZSBkaWQgbm90IGV4cG9ydCBhIGZ1bmN0aW9uLicsIE8gPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGEsIGksIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSByIHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBlLmdldE1vZHVsZUV4cG9ydHMoYS5tb2R1bGVQYXRoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nICE9IHR5cGVvZiBzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihFKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gZS5nZXRNb2R1bGVEZWZpbml0aW9uKGEubW9kdWxlUGF0aCksIGMgPSBhLnNldHRpbmdzIHx8IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIWEuaGFzVHJhbnNmb3JtZWRGaWxlUGF0aHMgJiYgby5maWxlUGF0aHMgJiYgKG4oYywgby5maWxlUGF0aHMsIGEubW9kdWxlUGF0aCksIGEuaGFzVHJhbnNmb3JtZWRGaWxlUGF0aHMgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IHQoYywgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy5iaW5kKG51bGwsIGwpLmFwcGx5KG51bGwsIHIpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIEEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3N0cmluZycgPT0gdHlwZW9mIGUgPyBlLnJlcGxhY2UoL1xzKy9nLCAnICcpLnRyaW0oKSA6IGU7CiAgICAgICAgICAgICAgICAgICAgfSwgTSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgTE9HOiAnbG9nJywKICAgICAgICAgICAgICAgICAgICAgICAgSU5GTzogJ2luZm8nLAogICAgICAgICAgICAgICAgICAgICAgICBERUJVRzogJ2RlYnVnJywKICAgICAgICAgICAgICAgICAgICAgICAgV0FSTjogJ3dhcm4nLAogICAgICAgICAgICAgICAgICAgICAgICBFUlJPUjogJ2Vycm9yJwogICAgICAgICAgICAgICAgICAgIH0sIEwgPSAnXHVEODNEXHVERTgwJywgTiA9IDEwID09PSBwYXJzZUludCgoL21zaWUgKFxkKykvLmV4ZWMobmF2aWdhdG9yLnVzZXJBZ2VudC50b0xvd2VyQ2FzZSgpKSB8fCBbXSlbMV0pID8gJ1tMYXVuY2hdJyA6IEwsIHggPSAhMSwgUiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh4ICYmIHdpbmRvdy5jb25zb2xlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LnVuc2hpZnQoTiksIGUgIT09IE0uREVCVUcgfHwgd2luZG93LmNvbnNvbGVbZV0gfHwgKGUgPSBNLklORk8pLCB3aW5kb3cuY29uc29sZVtlXS5hcHBseSh3aW5kb3cuY29uc29sZSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBGID0gUi5iaW5kKG51bGwsIE0uTE9HKSwgQiA9IFIuYmluZChudWxsLCBNLklORk8pLCBVID0gUi5iaW5kKG51bGwsIE0uREVCVUcpLCBIID0gUi5iaW5kKG51bGwsIE0uV0FSTiksIHogPSBSLmJpbmQobnVsbCwgTS5FUlJPUiksIFcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0geDsKICAgICAgICAgICAgICAgICAgICAgICAgeCA9ICEwLCBSLmFwcGx5KG51bGwsIEFycmF5LnByb3RvdHlwZS5jb25jYXQoTS5XQVJOLCBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMpKSksIGUgfHwgKHggPSAhMSk7CiAgICAgICAgICAgICAgICAgICAgfSwgSiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbG9nOiBGLAogICAgICAgICAgICAgICAgICAgICAgICBpbmZvOiBCLAogICAgICAgICAgICAgICAgICAgICAgICBkZWJ1ZzogVSwKICAgICAgICAgICAgICAgICAgICAgICAgd2FybjogSCwKICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IHosCiAgICAgICAgICAgICAgICAgICAgICAgIGRlcHJlY2F0aW9uOiBXLAogICAgICAgICAgICAgICAgICAgICAgICBnZXQgb3V0cHV0RW5hYmxlZCgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4OwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzZXQgb3V0cHV0RW5hYmxlZChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlUHJlZml4ZWRMb2dnZXI6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9ICdbJyArIGUgKyAnXSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZzogRi5iaW5kKG51bGwsIHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZm86IEIuYmluZChudWxsLCB0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWJ1ZzogVS5iaW5kKG51bGwsIHQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdhcm46IEguYmluZChudWxsLCB0KSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogei5iaW5kKG51bGwsIHQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgcSA9ICd1bmRlZmluZWQnICE9IHR5cGVvZiBnbG9iYWxUaGlzID8gZ2xvYmFsVGhpcyA6ICd1bmRlZmluZWQnICE9IHR5cGVvZiB3aW5kb3cgPyB3aW5kb3cgOiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgZ2xvYmFsID8gZ2xvYmFsIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHNlbGYgPyBzZWxmIDoge30sIEcgPSBhKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUuZXhwb3J0cyA9IHQoKSwgISEwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB3aW5kb3cuQ29va2llcywgYSA9IHdpbmRvdy5Db29raWVzID0gdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEubm9Db25mbGljdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5Db29raWVzID0gbiwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IDAsIHQgPSB7fTsgZSA8IGFyZ3VtZW50cy5sZW5ndGg7IGUrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGFyZ3VtZW50c1tlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSBpbiBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdFthXSA9IG5bYV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gdChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUucmVwbGFjZSgvKCVbMC05QS1aXXsyfSkrL2csIGRlY29kZVVSSUNvbXBvbmVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBuKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBpKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiByKHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBkb2N1bWVudCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ251bWJlcicgPT0gdHlwZW9mIChyID0gZSh7IHBhdGg6ICcvJyB9LCBpLmRlZmF1bHRzLCByKSkuZXhwaXJlcyAmJiAoci5leHBpcmVzID0gbmV3IERhdGUoMSAqIG5ldyBEYXRlKCkgKyA4NjQwMDAwMCAqIHIuZXhwaXJlcykpLCByLmV4cGlyZXMgPSByLmV4cGlyZXMgPyByLmV4cGlyZXMudG9VVENTdHJpbmcoKSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IEpTT04uc3RyaW5naWZ5KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9eW1x7XFtdLy50ZXN0KHMpICYmIChuID0gcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gYS53cml0ZSA/IGEud3JpdGUobiwgdCkgOiBlbmNvZGVVUklDb21wb25lbnQoU3RyaW5nKG4pKS5yZXBsYWNlKC8lKDIzfDI0fDI2fDJCfDNBfDNDfDNFfDNEfDJGfDNGfDQwfDVCfDVEfDVFfDYwfDdCfDdEfDdDKS9nLCBkZWNvZGVVUklDb21wb25lbnQpLCB0ID0gZW5jb2RlVVJJQ29tcG9uZW50KFN0cmluZyh0KSkucmVwbGFjZSgvJSgyM3wyNHwyNnwyQnw1RXw2MHw3QykvZywgZGVjb2RlVVJJQ29tcG9uZW50KS5yZXBsYWNlKC9bXChcKV0vZywgZXNjYXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjIGluIHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcltjXSAmJiAobyArPSAnOyAnICsgYywgITAgIT09IHJbY10gJiYgKG8gKz0gJz0nICsgcltjXS5zcGxpdCgnOycpWzBdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuY29va2llID0gdCArICc9JyArIG4gKyBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHMoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGRvY3VtZW50KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0ge30sIHIgPSBkb2N1bWVudC5jb29raWUgPyBkb2N1bWVudC5jb29raWUuc3BsaXQoJzsgJykgOiBbXSwgcyA9IDA7IHMgPCByLmxlbmd0aDsgcysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByW3NdLnNwbGl0KCc9JyksIGMgPSBvLnNsaWNlKDEpLmpvaW4oJz0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuIHx8ICciJyAhPT0gYy5jaGFyQXQoMCkgfHwgKGMgPSBjLnNsaWNlKDEsIC0xKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSB0KG9bMF0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IChhLnJlYWQgfHwgYSkoYywgbCkgfHwgdChjKSwgbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IEpTT04ucGFyc2UoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpW2xdID0gYywgZSA9PT0gbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IGlbZV0gOiBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLnNldCA9IHIsIGkuZ2V0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMoZSwgITEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkuZ2V0SlNPTiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzKGUsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpLnJlbW92ZSA9IGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIodCwgJycsIGUobiwgeyBleHBpcmVzOiAtMSB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaS5kZWZhdWx0cyA9IHt9LCBpLndpdGhDb252ZXJ0ZXIgPSBuLCBpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0pLCBZID0gewogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IEcuZ2V0LAogICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IEcuc2V0LAogICAgICAgICAgICAgICAgICAgICAgICByZW1vdmU6IEcucmVtb3ZlCiAgICAgICAgICAgICAgICAgICAgfSwgUSA9ICdjb20uYWRvYmUucmVhY3Rvci4nLCAkID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBRICsgKHQgfHwgJycpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SXRlbTogZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkXzQwNmI4NGZmOTNkZDJiN2IgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnbG9jYWxTdG9yYWdlJyksICRfX19vbGRfMWUzMzliMzRjY2FhZjQ1ZSA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdzZXNzaW9uU3RvcmFnZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzQwNmI4NGZmOTNkZDJiN2IpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX21vY2tfNTNhZTZlYmZkZWNlNzY5MC5sb2NhbFN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfMWUzMzliMzRjY2FhZjQ1ZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdzZXNzaW9uU3RvcmFnZScsICRfX19tb2NrXzUzYWU2ZWJmZGVjZTc2OTAuc2Vzc2lvblN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdbZV0uZ2V0SXRlbShuICsgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF80MDZiODRmZjkzZGQyYjdiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2xvY2FsU3RvcmFnZScsICRfX19vbGRfNDA2Yjg0ZmY5M2RkMmI3YikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8xZTMzOWIzNGNjYWFmNDVlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ3Nlc3Npb25TdG9yYWdlJywgJF9fX29sZF8xZTMzOWIzNGNjYWFmNDVlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEl0ZW06IGZ1bmN0aW9uICh0LCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF9lNTdjODEzMzQzZGE5YjBkID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ2xvY2FsU3RvcmFnZScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2U1N2M4MTMzNDNkYTliMGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX21vY2tfNTNhZTZlYmZkZWNlNzY5MC5sb2NhbFN0b3JhZ2UpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdbZV0uc2V0SXRlbShuICsgdCwgYSksICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2U1N2M4MTMzNDNkYTliMGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnbG9jYWxTdG9yYWdlJywgJF9fX29sZF9lNTdjODEzMzQzZGE5YjBkKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIEsgPSAnX3Nkc2F0XycsIFggPSAnZGF0YUVsZW1lbnRzLicsIFogPSAnZGF0YUVsZW1lbnRDb29raWVzTWlncmF0ZWQnLCBlZSA9ICQoJ2xvY2FsU3RvcmFnZScpLCB0ZSA9ICQoJ3Nlc3Npb25TdG9yYWdlJywgWCksIG5lID0gJCgnbG9jYWxTdG9yYWdlJywgWCksIGFlID0gewogICAgICAgICAgICAgICAgICAgICAgICBQQUdFVklFVzogJ3BhZ2V2aWV3JywKICAgICAgICAgICAgICAgICAgICAgICAgU0VTU0lPTjogJ3Nlc3Npb24nLAogICAgICAgICAgICAgICAgICAgICAgICBWSVNJVE9SOiAndmlzaXRvcicKICAgICAgICAgICAgICAgICAgICB9LCBpZSA9IHt9LCByZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0OwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IEpTT04uc3RyaW5naWZ5KGUpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgc2UgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYTsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgYWUuUEFHRVZJRVc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAoaWVbZV0gPSBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBhZS5TRVNTSU9OOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgKChhID0gcmUobikpICYmIHRlLnNldEl0ZW0oZSwgYSkpOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGFlLlZJU0lUT1I6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAoKGEgPSByZShuKSkgJiYgbmUuc2V0SXRlbShlLCBhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBvZSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gWS5nZXQoSyArIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IG4gJiYgc2UoZSwgdCwgbik7CiAgICAgICAgICAgICAgICAgICAgfSwgY2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBlZS5nZXRJdGVtKFopIHx8IChPYmplY3Qua2V5cyhlKS5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvZSh0LCBlW3RdLnN0b3JhZ2VEdXJhdGlvbik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlZS5zZXRJdGVtKFosICEwKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgbGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNldFZhbHVlOiBzZSwKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBhZS5QQUdFVklFVzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaWUuaGFzT3duUHJvcGVydHkoZSkgPyBpZVtlXSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGFlLlNFU1NJT046CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT09IChuID0gdGUuZ2V0SXRlbShlKSkgPyBuIDogSlNPTi5wYXJzZShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgYWUuVklTSVRPUjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gKG4gPSBuZS5nZXRJdGVtKGUpKSA/IG4gOiBKU09OLnBhcnNlKG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBtaWdyYXRlQ29va2llRGF0YTogY2UKICAgICAgICAgICAgICAgICAgICB9LCB1ZSA9IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnRmFpbGVkIHRvIGV4ZWN1dGUgZGF0YSBlbGVtZW50IG1vZHVsZSAnICsgZS5tb2R1bGVQYXRoICsgJyBmb3IgZGF0YSBlbGVtZW50ICcgKyB0ICsgJy4gJyArIG4gKyAoYSA/ICdcbicgKyBhIDogJycpOwogICAgICAgICAgICAgICAgICAgIH0sIGRlID0gZnVuY3Rpb24gKGUsIHQsIG4sIGEsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChyLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHQocik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPyAnJyA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjLCBsLCB1ID0gby5zdG9yYWdlRHVyYXRpb247CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBlLmdldE1vZHVsZUV4cG9ydHMoby5tb2R1bGVQYXRoKSwgbCA9IGUuZ2V0TW9kdWxlRGVmaW5pdGlvbihvLm1vZHVsZVBhdGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIEouZXJyb3IodWUobywgciwgZS5tZXNzYWdlLCBlLnN0YWNrKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkLCBwID0gby5zZXR0aW5ncyB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhby5oYXNUcmFuc2Zvcm1lZEZpbGVQYXRocyAmJiBsLmZpbGVQYXRocyAmJiAoaShwLCBsLmZpbGVQYXRocywgby5tb2R1bGVQYXRoKSwgby5oYXNUcmFuc2Zvcm1lZEZpbGVQYXRocyA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gYyhuKHAsIHMpLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIEouZXJyb3IodWUobywgciwgZS5tZXNzYWdlLCBlLnN0YWNrKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1ICYmIChudWxsICE9IGQgPyBsZS5zZXRWYWx1ZShyLCB1LCBkKSA6IGQgPSBsZS5nZXRWYWx1ZShyLCB1KSksIG51bGwgPT0gZCAmJiBudWxsICE9IG8uZGVmYXVsdFZhbHVlICYmIChkID0gby5kZWZhdWx0VmFsdWUpLCAnc3RyaW5nJyA9PSB0eXBlb2YgZCAmJiAoby5jbGVhblRleHQgJiYgKGQgPSBBKGQpKSwgby5mb3JjZUxvd2VyQ2FzZSAmJiAoZCA9IGQudG9Mb3dlckNhc2UoKSkpLCBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgSi5lcnJvcih1ZShvLCByLCAnTW9kdWxlIGRpZCBub3QgZXhwb3J0IGEgZnVuY3Rpb24uJykpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIHBlID0gewogICAgICAgICAgICAgICAgICAgICAgICB0ZXh0OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUudGV4dENvbnRlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFuVGV4dDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBKGUudGV4dENvbnRlbnQpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgZmUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhLCBpID0gZSwgciA9IDAsIHMgPSB0Lmxlbmd0aDsgciA8IHM7IHIrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gaSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHRbcl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobiAmJiAnQCcgPT09IG8uY2hhckF0KDApKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBvLnNsaWNlKDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBwZVtjXShpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaS5nZXRBdHRyaWJ1dGUgJiYgKGEgPSBvLm1hdGNoKC9eZ2V0QXR0cmlidXRlXCgoLispXCkkLykpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBhWzFdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBpLmdldEF0dHJpYnV0ZShsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBpW29dOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgICAgICAgICAgIH0sIG1lID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChhLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0KGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBuKGEsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSBhLnNwbGl0KCcuJyksIG8gPSBzLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RoaXMnID09PSBvID8gaSAmJiAociA9IGZlKGkuZWxlbWVudCwgcywgITApKSA6ICdldmVudCcgPT09IG8gPyBpICYmIChyID0gZmUoaSwgcykpIDogJ3RhcmdldCcgPT09IG8gPyBpICYmIChyID0gZmUoaS50YXJnZXQsIHMpKSA6IHIgPSBmZShlW29dLCBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGdlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4uc3BsaXQoJy4nKVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCb29sZWFuKHQobikgfHwgJ3RoaXMnID09PSBhIHx8ICdldmVudCcgPT09IGEgfHwgJ3RhcmdldCcgPT09IGEgfHwgZS5oYXNPd25Qcm9wZXJ0eShhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgYmUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHsgZXhwb3J0czoge30gfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuY2FsbChhLmV4cG9ydHMsIGEsIGEuZXhwb3J0cywgdCwgbiksIGEuZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICB9LCB2ZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB7fSwgdCA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlW3RdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdNb2R1bGUgJyArIHQgKyAnIG5vdCBmb3VuZC4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoZSkuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSAnRXJyb3IgaW5pdGlhbGl6aW5nIG1vZHVsZSAnICsgZSArICcuICcgKyBuLm1lc3NhZ2UgKyAobi5zdGFjayA/ICdcbicgKyBuLnN0YWNrIDogJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSi5lcnJvcih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgYSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmhhc093blByb3BlcnR5KCdleHBvcnRzJykgfHwgKG4uZXhwb3J0cyA9IGJlKG4uZGVmaW5pdGlvbi5zY3JpcHQsIG4ucmVxdWlyZSwgbi50dXJiaW5lKSksIG4uZXhwb3J0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWdpc3Rlck1vZHVsZTogZnVuY3Rpb24gKHQsIG4sIGEsIGksIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmaW5pdGlvbjogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0ZW5zaW9uTmFtZTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHVyYmluZTogcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcy5yZXF1aXJlID0gaSwgZVt0XSA9IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaHlkcmF0ZUNhY2hlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TW9kdWxlRXhwb3J0czogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldE1vZHVsZURlZmluaXRpb246IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQoZSkuZGVmaW5pdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRNb2R1bGVFeHRlbnNpb25OYW1lOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KGUpLmV4dGVuc2lvbk5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgaGUgPSAhMSwgeWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gZS5fbW9uaXRvcnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhICYmIChoZSB8fCAoSi53YXJuKCdUaGUgX3NhdGVsbGl0ZS5fbW9uaXRvcnMgQVBJIG1heSBjaGFuZ2UgYXQgYW55IHRpbWUgYW5kIHNob3VsZCBvbmx5IGJlIHVzZWQgZm9yIGRlYnVnZ2luZy4nKSwgaGUgPSAhMCksIGEuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbdF0gJiYgZVt0XShuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBfZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCBpLCByLCBzLCBvID0gW10sIGMgPSBmdW5jdGlvbiAoYSwgaSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZShpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby5wdXNoKGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gdChpLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5wb3AoKSwgbnVsbCA9PSBzICYmIG4gPyAnJyA6IHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IC9eJShbXiVdKyklJC8uZXhlYyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuID8gYyhlLCBuWzFdLCB0KSA6IGUucmVwbGFjZSgvJSguKz8pJS9nLCBmdW5jdGlvbiAoZSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjKGUsIG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IHt9LCBhID0gT2JqZWN0LmtleXMoZSksIGkgPSAwOyBpIDwgYS5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gYVtpXSwgbyA9IGVbcl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbltyXSA9IHMobywgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgciA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gW10sIGEgPSAwLCBpID0gZS5sZW5ndGg7IGEgPCBpOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5wdXNoKHMoZVthXSwgdCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG47CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHMgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09IHR5cGVvZiBlID8gYShlLCB0KSA6IEFycmF5LmlzQXJyYXkoZSkgPyByKGUsIHQpIDogJ29iamVjdCcgPT0gdHlwZW9mIGUgJiYgbnVsbCAhPT0gZSA/IGkoZSwgdCkgOiBlOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8ubGVuZ3RoID4gMTAgPyAoSi5lcnJvcignRGF0YSBlbGVtZW50IGNpcmN1bGFyIHJlZmVyZW5jZSBkZXRlY3RlZDogJyArIG8uam9pbignIC0+ICcpKSwgZSkgOiBzKGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIFBlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgYXJndW1lbnRzWzBdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbYXJndW1lbnRzWzBdXSA9IGFyZ3VtZW50c1sxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGFyZ3VtZW50c1swXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gYXJndW1lbnRzWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gaW4gdCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZVtuXSA9IHRbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgU2UgPSBzZXRUaW1lb3V0OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuY2F0Y2ggPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRoZW4obnVsbCwgZSk7CiAgICAgICAgICAgICAgICB9LCBjLnByb3RvdHlwZS50aGVuID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IG5ldyB0aGlzLmNvbnN0cnVjdG9yKHMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBsKHRoaXMsIG5ldyBmKGUsIHQsIG4pKSwgbjsKICAgICAgICAgICAgICAgIH0sIGMucHJvdG90eXBlLmZpbmFsbHkgPSBpLCBjLmFsbCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBjKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGEoZSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAociAmJiAoJ29iamVjdCcgPT0gdHlwZW9mIHIgfHwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgcikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSByLnRoZW47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnZnVuY3Rpb24nID09IHR5cGVvZiBvKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgby5jYWxsKHIsIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYShlLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpW2VdID0gciwgMCA9PSAtLXMgJiYgdChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcihlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuKG5ldyBUeXBlRXJyb3IoJ1Byb21pc2UuYWxsIGFjY2VwdHMgYW4gYXJyYXknKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSBpLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgcyA9IGkubGVuZ3RoLCBvID0gMDsgbyA8IGkubGVuZ3RoOyBvKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKG8sIGlbb10pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgYy5yZXNvbHZlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgZSAmJiBlLmNvbnN0cnVjdG9yID09PSBjID8gZSA6IG5ldyBjKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQoZSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBjLnJlamVjdCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBjKGZ1bmN0aW9uICh0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG4oZSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBjLnJhY2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgYyhmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXIoZSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbihuZXcgVHlwZUVycm9yKCdQcm9taXNlLnJhY2UgYWNjZXB0cyBhbiBhcnJheScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IDAsIGkgPSBlLmxlbmd0aDsgYSA8IGk7IGErKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMucmVzb2x2ZShlW2FdKS50aGVuKHQsIG4pOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgYy5faW1tZWRpYXRlRm4gPSAnZnVuY3Rpb24nID09IHR5cGVvZiBzZXRJbW1lZGlhdGUgJiYgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICBzZXRJbW1lZGlhdGUoZSk7CiAgICAgICAgICAgICAgICB9IHx8IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgU2UoZSwgMCk7CiAgICAgICAgICAgICAgICB9LCBjLl91bmhhbmRsZWRSZWplY3Rpb25GbiA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGNvbnNvbGUgJiYgY29uc29sZSAmJiBjb25zb2xlLndhcm4oJ1Bvc3NpYmxlIFVuaGFuZGxlZCBQcm9taXNlIFJlamVjdGlvbjonLCBlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB2YXIgQ2UgPSBuKE9iamVjdC5mcmVlemUoewogICAgICAgICAgICAgICAgICAgICAgICBfX3Byb3RvX186IG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6IGMKICAgICAgICAgICAgICAgICAgICB9KSksIGtlID0gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIHdpbmRvdyAmJiB3aW5kb3cuUHJvbWlzZSB8fCB2b2lkIDAgIT09IHEgJiYgcS5Qcm9taXNlIHx8IENlLmRlZmF1bHQgfHwgQ2UsIGplID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChhLCBpLCByLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcy50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcywgbyA9IGEuZGVsYXlOZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcga2UoZnVuY3Rpb24gKHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBlKGEsIHIsIFtyXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYS50aW1lb3V0LCBsID0gbmV3IGtlKGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IHNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KG5ldyBFcnJvcignQSB0aW1lb3V0IG9jY3VycmVkIGJlY2F1c2UgdGhlIGFjdGlvbiB0b29rIGxvbmdlciB0aGFuICcgKyBjIC8gMTAwMCArICcgc2Vjb25kcyB0byBjb21wbGV0ZS4gJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtlLnJhY2UoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSkudGhlbih0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2xlYXJUaW1lb3V0KHMpLCBlID0gdChlKSwgbihhLCBpLCBlKSwga2UucmVqZWN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXQocyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCB3ZSA9IGZ1bmN0aW9uIChlLCB0LCBuLCBhLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAociwgcywgbywgYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBrZShmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUociwgbywgW29dKSwgaSA9IHIudGltZW91dCwgcyA9IG5ldyBrZShmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdChuZXcgRXJyb3IoJ0EgdGltZW91dCBvY2N1cnJlZCBiZWNhdXNlIHRoZSBjb25kaXRpb24gdG9vayBsb25nZXIgdGhhbiAnICsgaSAvIDEwMDAgKyAnIHNlY29uZHMgdG8gY29tcGxldGUuICcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZS5yYWNlKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLnRoZW4odCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNsZWFyVGltZW91dChjKSwgZSA9IHQoZSksIGEociwgcywgZSksIGtlLnJlamVjdChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjbGVhclRpbWVvdXQoYyksICFuKHIsIGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkociwgcyksIGtlLnJlamVjdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgRGUgPSBrZS5yZXNvbHZlKCksIFZlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChhLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5jb25kaXRpb25zICYmIGEuY29uZGl0aW9ucy5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGUgPSBlKHQsIGEsIGksIERlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhLmFjdGlvbnMgJiYgYS5hY3Rpb25zLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEZSA9IHQoZSwgYSwgaSwgRGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIERlID0gKERlID0gRGUudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbihhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5jYXRjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBJZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCb29sZWFuKGUgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZS50aGVuKTsKICAgICAgICAgICAgICAgICAgICB9LCBUZSA9IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoaSwgcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaS5jb25kaXRpb25zKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG8gPSAwOyBvIDwgaS5jb25kaXRpb25zLmxlbmd0aDsgbysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgPSBpLmNvbmRpdGlvbnNbb107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGUocywgciwgW3JdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChJZShjKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1J1bGUgY29tcG9uZW50IHNlcXVlbmNpbmcgbXVzdCBiZSBlbmFibGVkIG9uIHRoZSBwcm9wZXJ0eSBmb3IgdGhpcyBjb25kaXRpb24gdG8gZnVuY3Rpb24gcHJvcGVybHkuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXQocywgYykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4ocywgaSksICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYShzLCBpLCBlKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgRWUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUobiwgYSkgJiYgdChuLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBPZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBlLmdldE1vZHVsZURlZmluaXRpb24odC5tb2R1bGVQYXRoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuICYmIG4uZGlzcGxheU5hbWUgfHwgdC5tb2R1bGVQYXRoOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIEFlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHQucnVsZSwgYSA9IHQuZXZlbnQsIGkgPSBlLmdldE1vZHVsZURlZmluaXRpb24oYS5tb2R1bGVQYXRoKS5uYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdHlwZTogZS5nZXRNb2R1bGVFeHRlbnNpb25OYW1lKGEubW9kdWxlUGF0aCkgKyAnLicgKyBpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRydWxlOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBuLmlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBuLm5hbWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIE1lID0gZnVuY3Rpb24gKGUsIHQsIG4sIGEsIGksIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChzLCBvKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IG8ucnVsZSwgbCA9IG8uZXZlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsLnNldHRpbmdzID0gbC5zZXR0aW5ncyB8fCB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHUgPSBpKG8pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQobCwgbnVsbCwgW2Z1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG4odSwgdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKGEsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmVycm9yKGEobCwgYywgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIExlID0gZnVuY3Rpb24gKGUsIHQsIG4sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChpLCByLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHQoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmVycm9yKGUobywgci5uYW1lLCBzKSksIGEoJ3J1bGVBY3Rpb25GYWlsZWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb246IGkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIE5lID0gZnVuY3Rpb24gKGUsIHQsIG4sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChpLCByLCBzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IHQoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmVycm9yKGUobywgci5uYW1lLCBzKSksIGEoJ3J1bGVDb25kaXRpb25GYWlsZWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZTogciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb246IGkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIHhlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChhLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0LmxvZygnQ29uZGl0aW9uICInICsgciArICciIGZvciBydWxlICInICsgaS5uYW1lICsgJyIgd2FzIG5vdCBtZXQuJyksIG4oJ3J1bGVDb25kaXRpb25GYWlsZWQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcnVsZTogaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25kaXRpb246IGEKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIFJlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLmxvZygnUnVsZSAiJyArIG4ubmFtZSArICciIGZpcmVkLicpLCB0KCdydWxlQ29tcGxldGVkJywgeyBydWxlOiBuIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIEZlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChhLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmFjdGlvbnMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgcyA9IDA7IHMgPCBhLmFjdGlvbnMubGVuZ3RoOyBzKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IGEuYWN0aW9uc1tzXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUociwgaSwgW2ldKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgdChyLCBhLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4oYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgQmUgPSBmdW5jdGlvbiAoZSwgdCwgbiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGksIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoJ3J1bGVUcmlnZ2VyZWQnLCB7IHJ1bGU6IHIgfSksIGUgPyBuKHIsIGkpIDogdChyLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBVZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnRmFpbGVkIHRvIGV4ZWN1dGUgIicgKyBlICsgJyIgZm9yICInICsgdCArICciIHJ1bGUuICcgKyBuLm1lc3NhZ2UgKyAobi5zdGFjayA/ICdcbicgKyBuLnN0YWNrIDogJycpOwogICAgICAgICAgICAgICAgICAgIH0sIEhlID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgJiYgIWUubmVnYXRlIHx8ICF0ICYmIGUubmVnYXRlOwogICAgICAgICAgICAgICAgICAgIH0sIHplID0gW10sIFdlID0gITEsIEplID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgV2UgPyBlKCkgOiB6ZS5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgIH0sIHFlID0gZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSh0KS5mb3JFYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuKEplLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIFdlID0gITAsIHplLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIHplID0gW107CiAgICAgICAgICAgICAgICAgICAgfSwgR2UgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSB8fCAoZSA9IG5ldyBFcnJvcignVGhlIGV4dGVuc2lvbiB0cmlnZ2VyZWQgYW4gZXJyb3IsIGJ1dCBubyBlcnJvciBpbmZvcm1hdGlvbiB3YXMgcHJvdmlkZWQuJykpLCAhKGUgaW5zdGFuY2VvZiBFcnJvcikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gJ29iamVjdCcgPT0gdHlwZW9mIGUgPyBKU09OLnN0cmluZ2lmeShlKSA6IFN0cmluZyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBuZXcgRXJyb3IodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfSwgWWUgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBlICYmICdvYmplY3QnID09IHR5cGVvZiBlICYmICExID09PSBBcnJheS5pc0FycmF5KGUpOwogICAgICAgICAgICAgICAgICAgIH0sIFFlID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG47CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMSAhPT0gZyhlKSAmJiAoJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgKHQgPSBlLmNvbnN0cnVjdG9yKSAmJiAoITEgIT09IGcobiA9IHQucHJvdG90eXBlKSAmJiAhMSAhPT0gbi5oYXNPd25Qcm9wZXJ0eSgnaXNQcm90b3R5cGVPZicpKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgJGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWUodCA9IHQgfHwge30pID8gdCA9IGooe30sIHQsIGUpIDogaih0LCBlKSwgdC5oYXNPd25Qcm9wZXJ0eSgndHlwZScpIHx8IE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0LCAndHlwZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKLmRlcHJlY2F0aW9uKCdBY2Nlc3NpbmcgZXZlbnQudHlwZSBpbiBBZG9iZSBMYXVuY2ggaGFzIGJlZW4gZGVwcmVjYXRlZCBhbmQgd2lsbCBiZSByZW1vdmVkIHNvb24uIFBsZWFzZSB1c2UgZXZlbnQuJHR5cGUgaW5zdGVhZC4nKSwgdC4kdHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSksIHQ7CiAgICAgICAgICAgICAgICAgICAgfSwgS2UgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKG4sIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gZVtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBpLm1vZHVsZXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHMgPSBPYmplY3Qua2V5cyhyKSwgbyA9IDA7IG8gPCBzLmxlbmd0aDsgbysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHNbb10sIGwgPSByW2NdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGwuc2hhcmVkICYmIGwubmFtZSA9PT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdC5nZXRNb2R1bGVFeHBvcnRzKGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgWGUgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPyBlKHQpIDoge307CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgWmUgPSBmdW5jdGlvbiAoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBhLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5zcGxpY2UoaS5sZW5ndGggLSAxIHx8IDEsIDAsICdtaW4nKSwgYSA9IGkuam9pbignLicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUodCkgKyBhOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGV0ID0gJy5qcycsIHR0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc3Vic3RyKDAsIGUubGFzdEluZGV4T2YoJy8nKSk7CiAgICAgICAgICAgICAgICAgICAgfSwgbnQgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgIT09IGUuaW5kZXhPZih0LCBlLmxlbmd0aCAtIHQubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICB9LCBhdCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG50KHQsIGV0KSB8fCAodCArPSBldCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5zcGxpdCgnLycpLCBhID0gdHQoZSkuc3BsaXQoJy8nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG4uZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiAnLicgIT09IGUgJiYgKCcuLicgPT09IGUgPyBhLmxlbmd0aCAmJiBhLnBvcCgpIDogYS5wdXNoKGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksIGEuam9pbignLycpOwogICAgICAgICAgICAgICAgICAgIH0sIGl0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBrZShmdW5jdGlvbiAobiwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdC5vbmxvYWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbih0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHQub25lcnJvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKG5ldyBFcnJvcignRmFpbGVkIHRvIGxvYWQgc2NyaXB0ICcgKyBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBydCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHQuc3JjID0gZSwgdC5hc3luYyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGl0KGUsIHQpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ2hlYWQnKVswXS5hcHBlbmRDaGlsZCh0KSwgbjsKICAgICAgICAgICAgICAgICAgICB9LCBzdCA9IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0IHx8ICcmJywgbiA9IG4gfHwgJz0nOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgIT0gdHlwZW9mIGUgfHwgMCA9PT0gZS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAvXCsvZzsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUuc3BsaXQodCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzID0gMTAwMDsKICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiAnbnVtYmVyJyA9PSB0eXBlb2YgYS5tYXhLZXlzICYmIChzID0gYS5tYXhLZXlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgcyA+IDAgJiYgbyA+IHMgJiYgKG8gPSBzKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IDA7IGMgPCBvOyArK2MpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsLCB1LCBkLCBwLCBmID0gZVtjXS5yZXBsYWNlKHIsICclMjAnKSwgbSA9IGYuaW5kZXhPZihuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gPj0gMCA/IChsID0gZi5zdWJzdHIoMCwgbSksIHUgPSBmLnN1YnN0cihtICsgMSkpIDogKGwgPSBmLCB1ID0gJycpLCBkID0gZGVjb2RlVVJJQ29tcG9uZW50KGwpLCBwID0gZGVjb2RlVVJJQ29tcG9uZW50KHUpLCBiKGksIGQpID8gQXJyYXkuaXNBcnJheShpW2RdKSA/IGlbZF0ucHVzaChwKSA6IGlbZF0gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaVtkXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdIDogaVtkXSA9IHA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICAgICAgICAgICAgfSwgb3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHR5cGVvZiBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3N0cmluZyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnYm9vbGVhbic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/ICd0cnVlJyA6ICdmYWxzZSc7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ251bWJlcic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXNGaW5pdGUoZSkgPyBlIDogJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LCBjdCA9IGZ1bmN0aW9uIChlLCB0LCBuLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gdCB8fCAnJicsIG4gPSBuIHx8ICc9JywgbnVsbCA9PT0gZSAmJiAoZSA9IHZvaWQgMCksICdvYmplY3QnID09IHR5cGVvZiBlID8gT2JqZWN0LmtleXMoZSkubWFwKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGVuY29kZVVSSUNvbXBvbmVudChvdChhKSkgKyBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEFycmF5LmlzQXJyYXkoZVthXSkgPyBlW2FdLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpICsgZW5jb2RlVVJJQ29tcG9uZW50KG90KGUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4odCkgOiBpICsgZW5jb2RlVVJJQ29tcG9uZW50KG90KGVbYV0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbih0KSA6IGEgPyBlbmNvZGVVUklDb21wb25lbnQob3QoYSkpICsgbiArIGVuY29kZVVSSUNvbXBvbmVudChvdChlKSkgOiAnJzsKICAgICAgICAgICAgICAgICAgICB9LCBsdCA9IGEoZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdC5kZWNvZGUgPSB0LnBhcnNlID0gc3QsIHQuZW5jb2RlID0gdC5zdHJpbmdpZnkgPSBjdDsKICAgICAgICAgICAgICAgICAgICB9KSwgdXQgPSAnQGFkb2JlL3JlYWN0b3ItJywgZHQgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvb2tpZTogWSwKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQ6IF8sCiAgICAgICAgICAgICAgICAgICAgICAgICdsb2FkLXNjcmlwdCc6IHJ0LAogICAgICAgICAgICAgICAgICAgICAgICAnb2JqZWN0LWFzc2lnbic6IGosCiAgICAgICAgICAgICAgICAgICAgICAgIHByb21pc2U6IGtlLAogICAgICAgICAgICAgICAgICAgICAgICAncXVlcnktc3RyaW5nJzogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2U6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09IHR5cGVvZiBlICYmIChlID0gZS50cmltKCkucmVwbGFjZSgvXls/IyZdLywgJycpKSwgbHQucGFyc2UoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5naWZ5OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsdC5zdHJpbmdpZnkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdzogdwogICAgICAgICAgICAgICAgICAgIH0sIHB0ID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PT0gdC5pbmRleE9mKHV0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gdC5zdWJzdHIodXQubGVuZ3RoKSwgYSA9IGR0W25dOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09PSB0LmluZGV4T2YoJy4vJykgfHwgMCA9PT0gdC5pbmRleE9mKCcuLi8nKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignQ2Fubm90IHJlc29sdmUgbW9kdWxlICInICsgdCArICciLicpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGZ0ID0gZnVuY3Rpb24gKGUsIHQsIG4sIGEsIGksIHIsIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG8gPSBlLmV4dGVuc2lvbnMsIGMgPSBlLmJ1aWxkSW5mbywgbCA9IGUuZW52aXJvbm1lbnQsIHUgPSBlLnByb3BlcnR5LnNldHRpbmdzOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBLZShvLCB0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKG8pLmZvckVhY2goZnVuY3Rpb24gKHApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IG9bcF0sIG0gPSBmLnNldHRpbmdzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5LmlzQXJyYXkoZi5maWxlUGF0aHMpICYmIChtID0gcihtLCBmLmZpbGVQYXRocykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gWGUoYSwgbSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYubW9kdWxlcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IEouY3JlYXRlUHJlZml4ZWRMb2dnZXIoZi5kaXNwbGF5TmFtZSksIHYgPSBaZShzLCBmLmhvc3RlZExpYkZpbGVzQmFzZVVybCwgYy5taW5pZmllZCksIGggPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRJbmZvOiBjLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudmlyb25tZW50OiBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5OiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGUucHJvcGVydHkubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGUucHJvcGVydHkuaWQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldERhdGFFbGVtZW50VmFsdWU6IGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0RXh0ZW5zaW9uU2V0dGluZ3M6IGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SG9zdGVkTGliRmlsZVVybDogdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRTaGFyZWRNb2R1bGU6IGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nZ2VyOiBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5U2V0dGluZ3M6IHUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVwbGFjZVRva2VuczogYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbkRlYnVnQ2hhbmdlZDogbi5vbkRlYnVnQ2hhbmdlZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXQgZGVidWdFbmFibGVkKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5nZXREZWJ1Z0VuYWJsZWQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhmLm1vZHVsZXMpLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gZi5tb2R1bGVzW2VdLCBhID0gcHQoZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBhdChlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQuZ2V0TW9kdWxlRXhwb3J0cyhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucmVnaXN0ZXJNb2R1bGUoZSwgbiwgcCwgYSwgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB0Lmh5ZHJhdGVDYWNoZSgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0OwogICAgICAgICAgICAgICAgICAgIH0sIG10ID0gZnVuY3Rpb24gKGUsIHQsIG4sIGEsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBKLmNyZWF0ZVByZWZpeGVkTG9nZ2VyKCdDdXN0b20gU2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUudHJhY2sgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSi5sb2coJyInICsgZSArICciIGRvZXMgbm90IG1hdGNoIGFueSBkaXJlY3QgY2FsbCBpZGVudGlmaWVycy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5nZXRWaXNpdG9ySWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wcm9wZXJ0eSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IHQucHJvcGVydHkubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiB0LnByb3BlcnR5LmlkCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuY29tcGFueSA9IHQuY29tcGFueSwgZS5idWlsZEluZm8gPSB0LmJ1aWxkSW5mbywgZS5lbnZpcm9ubWVudCA9IHQuZW52aXJvbm1lbnQsIGUubG9nZ2VyID0gciwgZS5ub3RpZnkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChKLmRlcHJlY2F0aW9uKCdfc2F0ZWxsaXRlLm5vdGlmeSBpcyBkZXByZWNhdGVkLiBQbGVhc2UgdXNlIHRoZSBgX3NhdGVsbGl0ZS5sb2dnZXJgIEFQSS4nKSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaW5mbyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLndhcm4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5lcnJvcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5sb2coZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZ2V0VmFyID0gYSwgZS5zZXRWYXIgPSBpLCBlLnNldENvb2tpZSA9IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9ICcnLCBpID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIChhID0gJywgeyBleHBpcmVzOiAnICsgbiArICcgfScsIGkuZXhwaXJlcyA9IG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAnX3NhdGVsbGl0ZS5zZXRDb29raWUgaXMgZGVwcmVjYXRlZC4gUGxlYXNlIHVzZSBfc2F0ZWxsaXRlLmNvb2tpZS5zZXQoIicgKyBlICsgJyIsICInICsgdCArICciJyArIGEgKyAnKS4nOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgSi5kZXByZWNhdGlvbihyKSwgWS5zZXQoZSwgdCwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucmVhZENvb2tpZSA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSi5kZXByZWNhdGlvbignX3NhdGVsbGl0ZS5yZWFkQ29va2llIGlzIGRlcHJlY2F0ZWQuIFBsZWFzZSB1c2UgX3NhdGVsbGl0ZS5jb29raWUuZ2V0KCInICsgZSArICciKS4nKSwgWS5nZXQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUucmVtb3ZlQ29va2llID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEouZGVwcmVjYXRpb24oJ19zYXRlbGxpdGUucmVtb3ZlQ29va2llIGlzIGRlcHJlY2F0ZWQuIFBsZWFzZSB1c2UgX3NhdGVsbGl0ZS5jb29raWUucmVtb3ZlKCInICsgZSArICciKS4nKSwgWS5yZW1vdmUoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuY29va2llID0gWSwgZS5wYWdlQm90dG9tID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLnNldERlYnVnID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHMgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsICdfY29udGFpbmVyJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMgfHwgKEoud2FybignX3NhdGVsbGl0ZS5fY29udGFpbmVyIG1heSBjaGFuZ2UgYXQgYW55IHRpbWUgYW5kIHNob3VsZCBvbmx5IGJlIHVzZWQgZm9yIGRlYnVnZ2luZy4nKSwgcyA9ICEwKSwgdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgZ3QgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB0ID0gXy5xdWVyeVNlbGVjdG9yQWxsKCdzY3JpcHQnKSwgbiA9IDA7IG4gPCB0Lmxlbmd0aDsgbisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZS50ZXN0KGEuc3JjKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGJ0ID0gZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChuLCBhLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBRZShuKSAmJiBPYmplY3Qua2V5cyhuKS5sZW5ndGggJiYgQXJyYXkuaXNBcnJheShhKSAmJiBhLmxlbmd0aCA/IChhLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCb29sZWFuKG51bGwgIT0gaSAmJiAvXmNvcmVcLy4qYWN0aW9ucy4qXC9jdXN0b21Db2RlXC5qcyQvLnRlc3QoaSkpICYmICdzb3VyY2UnID09PSBlICYmICFuLmlzRXh0ZXJuYWwgfHwgeShlLnNwbGl0KCcuJyksIG4sIHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG4pIDogbjsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCB2dCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VHVyYmluZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGd0KG5ldyBSZWdFeHAoLyhsYXVuY2h8c2F0ZWxsaXRlTGliKS1bXlwvXSsuanMoXD8uKik/JC8pKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgYnlSZWdleFBhdHRlcm46IGd0CiAgICAgICAgICAgICAgICAgICAgfS5nZXRUdXJiaW5lLCBodCA9IHdpbmRvdy5fc2F0ZWxsaXRlOwogICAgICAgICAgICAgICAgaWYgKGh0ICYmICF3aW5kb3cuX19zYXRlbGxpdGVMb2FkZWQpIHsKICAgICAgICAgICAgICAgICAgICB3aW5kb3cuX19zYXRlbGxpdGVMb2FkZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICB2YXIgeXQgPSBodC5jb250YWluZXI7CiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGh0LmNvbnRhaW5lcjsKICAgICAgICAgICAgICAgICAgICB2YXIgX3QgPSBqKHt9LCB5dC5idWlsZEluZm8pOwogICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfdCwgJ2Vudmlyb25tZW50JywgewogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKLmRlcHJlY2F0aW9uKCdjb250YWluZXIuYnVpbGRJbmZvLmVudmlyb25tZW50IGlzIGRlcHJlY2F0ZWQuUGxlYXNlIHVzZSBgY29udGFpbmVyLmVudmlyb25tZW50LnN0YWdlYCBpbnN0ZWFkJyksIHl0LmVudmlyb25tZW50LnN0YWdlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSksIHl0LmJ1aWxkSW5mbyA9IF90OwogICAgICAgICAgICAgICAgICAgIHZhciBQdCwgU3QgPSBUKCQoJ2xvY2FsU3RvcmFnZScpLCBKKSwgQ3QgPSAnJzsKICAgICAgICAgICAgICAgICAgICBfLmN1cnJlbnRTY3JpcHQgJiYgXy5jdXJyZW50U2NyaXB0LmdldEF0dHJpYnV0ZSgnc3JjJykgPyBDdCA9IF8uY3VycmVudFNjcmlwdC5nZXRBdHRyaWJ1dGUoJ3NyYycpIDogdnQoKSAmJiAoQ3QgPSB2dCgpLmdldEF0dHJpYnV0ZSgnc3JjJykpOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFB0ID0gRChDdCwgeXQuY29tcGFueS5jZG5BbGxvd0xpc3QsIFN0KTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEoud2FybignUGxlYXNlIHJldmlldyB0aGUgZm9sbG93aW5nIGVycm9yOicpLCBlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIga3QsIGp0ID0gYnQoUHQuaXNEeW5hbWljRW5mb3JjZWQsIFB0LmRlY29yYXRlV2l0aER5bmFtaWNIb3N0KSwgd3QgPSB2ZSgpLCBEdCA9IHl0LnByb3BlcnR5LnNldHRpbmdzLnVuZGVmaW5lZFZhcnNSZXR1cm5FbXB0eSwgVnQgPSB5dC5wcm9wZXJ0eS5zZXR0aW5ncy5ydWxlQ29tcG9uZW50U2VxdWVuY2luZ0VuYWJsZWQsIEl0ID0geXQuZGF0YUVsZW1lbnRzIHx8IHt9OwogICAgICAgICAgICAgICAgICAgIGxlLm1pZ3JhdGVDb29raWVEYXRhKEl0KTsKICAgICAgICAgICAgICAgICAgICB2YXIgVHQgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEl0W2VdOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBFdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBrdC5hcHBseShudWxsLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBPdCA9IGRlKHd0LCBUdCwgRXQsIER0LCBqdCksIEF0ID0ge30sIE10ID0gUGUoQXQpLCBMdCA9IGdlKEF0LCBUdCksIE50ID0gbWUoQXQsIFR0LCBPdCk7CiAgICAgICAgICAgICAgICAgICAga3QgPSBfZShMdCwgTnQsIER0KSwgbXQoaHQsIHl0LCBTdC5zZXREZWJ1Z0VuYWJsZWQsIE50LCBNdCksIGZ0KHl0LCB3dCwgU3QsIGt0LCBPdCwganQsIFB0LmRlY29yYXRlV2l0aER5bmFtaWNIb3N0KTsKICAgICAgICAgICAgICAgICAgICB2YXIgeHQgPSB5ZShodCksIFJ0ID0gTyh3dCwga3QsIGp0KSwgRnQgPSBPZSh3dCksIEJ0ID0geGUoRnQsIEosIHh0KSwgVXQgPSBOZShVZSwgRnQsIEosIHh0KSwgSHQgPSBMZShVZSwgRnQsIEosIHh0KSwgenQgPSBSZShKLCB4dCksIFd0ID0gTWUoQmUoVnQsIEVlKFRlKFJ0LCBIZSwgQnQsIFV0KSwgRmUoUnQsIEh0LCB6dCkpLCBWZSh3ZShSdCwgR2UsIEhlLCBVdCwgQnQpLCBqZShSdCwgR2UsIEh0KSwgenQpLCB4dCksIFJ0LCAkZSwgVWUsIEFlKHd0KSwgSik7CiAgICAgICAgICAgICAgICAgICAgcWUoViwgeXQucnVsZXMgfHwgW10sIFd0KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBodDsKICAgICAgICAgICAgfQogICAgICAgICAgICBjb25zb2xlLndhcm4oJ0Fkb2JlIExhdW5jaCBpcyB1bnN1cHBvcnRlZCBpbiBJRSA5IGFuZCBiZWxvdy4nKTsKICAgICAgICB9KCk7CiAgICAgICAgX3NhdGVsbGl0ZSA9ICRfX192YXJfYWIwZThiMTdiY2E1NjA5MDsKICAgIH0oKSkKfQ=="},{"name":"sugarcoat-dfc7510b217a08b434f81d37728e218b563e02e5","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfNzMwNmVhNTU2ZGE1NzJhZSA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja183MzA2ZWE1NTZkYTU3MmFlKTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgIWZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHZhciB0ID0ge307CiAgICAgICAgICAgIGZ1bmN0aW9uIG4ocikgewogICAgICAgICAgICAgICAgaWYgKHRbcl0pCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRbcl0uZXhwb3J0czsKICAgICAgICAgICAgICAgIHZhciBhID0gdFtyXSA9IHsKICAgICAgICAgICAgICAgICAgICBpOiByLAogICAgICAgICAgICAgICAgICAgIGw6ICExLAogICAgICAgICAgICAgICAgICAgIGV4cG9ydHM6IHt9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIGVbcl0uY2FsbChhLmV4cG9ydHMsIGEsIGEuZXhwb3J0cywgbiksIGEubCA9ICEwLCBhLmV4cG9ydHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbi5tID0gZSwgbi5jID0gdCwgbi5kID0gZnVuY3Rpb24gKGUsIHQsIHIpIHsKICAgICAgICAgICAgICAgIG4ubyhlLCB0KSB8fCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGdldDogcgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0sIG4uciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAndW5kZWZpbmVkJyAhPSB0eXBlb2YgU3ltYm9sICYmIFN5bWJvbC50b1N0cmluZ1RhZyAmJiBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgU3ltYm9sLnRvU3RyaW5nVGFnLCB7IHZhbHVlOiAnTW9kdWxlJyB9KSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsICdfX2VzTW9kdWxlJywgeyB2YWx1ZTogITAgfSk7CiAgICAgICAgICAgIH0sIG4udCA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICBpZiAoMSAmIHQgJiYgKGUgPSBuKGUpKSwgOCAmIHQpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICBpZiAoNCAmIHQgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGUgJiYgZSAmJiBlLl9fZXNNb2R1bGUpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB2YXIgciA9IE9iamVjdC5jcmVhdGUobnVsbCk7CiAgICAgICAgICAgICAgICBpZiAobi5yKHIpLCBPYmplY3QuZGVmaW5lUHJvcGVydHkociwgJ2RlZmF1bHQnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZQogICAgICAgICAgICAgICAgICAgIH0pLCAyICYgdCAmJiAnc3RyaW5nJyAhPSB0eXBlb2YgZSkKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhIGluIGUpCiAgICAgICAgICAgICAgICAgICAgICAgIG4uZChyLCBhLCBmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVbdF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0uYmluZChudWxsLCBhKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gcjsKICAgICAgICAgICAgfSwgbi5uID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgIHZhciB0ID0gZSAmJiBlLl9fZXNNb2R1bGUgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZGVmYXVsdDsKICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIG4uZCh0LCAnYScsIHQpLCB0OwogICAgICAgICAgICB9LCBuLm8gPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLCB0KTsKICAgICAgICAgICAgfSwgbi5wID0gJycsIG4obi5zID0gMSk7CiAgICAgICAgfShbCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAndXNlIHN0cmljdCc7CiAgICAgICAgICAgICAgICBuLnIodCk7CiAgICAgICAgICAgICAgICBuKDApOwogICAgICAgICAgICAgICAgdmFyIHIgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IGUuaW5uZXJXaWR0aCB8fCAtMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogZS5pbm5lckhlaWdodCB8fCAtMQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0sIGEgPSBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IGUuc2NyZWVuICYmIGUuc2NyZWVuLndpZHRoIHx8IC0xLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBlLnNjcmVlbiAmJiBlLnNjcmVlbi5oZWlnaHQgfHwgLTEKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBpID0gd2luZG93LCBvID0gdG9wOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcyhlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCB0Lmxlbmd0aDsgbisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdFtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgci5lbnVtZXJhYmxlID0gci5lbnVtZXJhYmxlIHx8ICExLCByLmNvbmZpZ3VyYWJsZSA9ICEwLCAndmFsdWUnIGluIHIgJiYgKHIud3JpdGFibGUgPSAhMCksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCByLmtleSwgcik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdShlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgaW4gZSA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCB0LCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSkgOiBlW3RdID0gbiwgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0Nhbm5vdCBjYWxsIGEgY2xhc3MgYXMgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0aGlzLCBlKSwgdSh0aGlzLCAnbG9nJywgbnVsbCksIHUodGhpcywgJ3dhcm4nLCBudWxsKSwgdSh0aGlzLCAnZXJyb3InLCBudWxsKSwgaS5kaWFnUGl4U2VudENvZGVzID0gaS5kaWFnUGl4U2VudENvZGVzIHx8IHt9LCB0aGlzLmxvZyA9IHRoaXMubG9nZ2VyLmJpbmQodGhpcywgJ2xvZycpLCB0aGlzLndhcm4gPSB0aGlzLmxvZ2dlci5iaW5kKHRoaXMsICd3YXJuJyksIHRoaXMuZXJyb3IgPSB0aGlzLmxvZ2dlci5iaW5kKHRoaXMsICdlcnJvcicpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCA9IGUsIChuID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldEFuaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpLl9faWFzUEVULnB1YklkIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0U2Vzc2lvbklkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5fX2lhc1BFVC5zZXNzaW9uSWQgfHwgJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdyZXNldERpYWdQaXhTZW50Q29kZXMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuZGlhZ1BpeFNlbnRDb2RlcyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnYnVpbGRRdWVyeVN0cmluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmIChuID0gT2JqZWN0LmtleXMoZSkucmVkdWNlKGZ1bmN0aW9uIChuLCByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbi5wdXNoKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbcl0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0uam9pbih0KSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIFtdKS5qb2luKCcmJykpLCBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0UXVlcnlQYXJhbUJ5TmFtZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByLCBhLCBvID0gaS5sb2NhdGlvbi5zZWFyY2ggJiYgaS5sb2NhdGlvbi5zZWFyY2gudG9Mb3dlckNhc2UoKSwgcyA9IG8gJiYgby5pbmRleE9mKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgIT09IHMgJiYgKHQgPSBvLmluZGV4T2YoJz0nLCBzKSArIDEsIG4gPSAtMSA9PT0gKHIgPSBvLmluZGV4T2YoJyYnLCB0KSkgPyB2b2lkIDAgOiByLCBhID0gZGVjb2RlVVJJQ29tcG9uZW50KG8uc2xpY2UodCwgbikpKSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2RpYWdQaXgnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciwgYSwgbzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpLmRpYWdQaXhTZW50Q29kZXNbZV0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB0aGlzLmdldEFuaWQoKSwgciA9IHRoaXMuZ2V0U2Vzc2lvbklkKCksIGkuZGlhZ1BpeFNlbnRDb2Rlc1tlXSA9ICEwLCBhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlOiAncGV0XycgKyBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbmlkOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXNzaW9uSWQ6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCB0ICYmIChhLmVyciA9IGVuY29kZVVSSUNvbXBvbmVudCh0Lm1lc3NhZ2UpKSwgbyA9IHRoaXMuYnVpbGRRdWVyeVN0cmluZyhhLCAnOicpLCBuZXcgaS5JbWFnZSgpLnNyYyA9ICcvL3BpeGVsLmFkc2FmZXByb3RlY3RlZC5jb20vanNkaWFnbm9zdGljPycgKyBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMuZXJyb3IoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdsb2dnZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9ICdiYWNrZ3JvdW5kLWNvbG9yOiAnLCByID0gaS5jb25zb2xlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGkuY29uc29sZS5lcnJvciwgYSA9IHRoaXMuZ2V0UXVlcnlQYXJhbUJ5TmFtZSgnaWFzZGVidWcnKSwgbyA9IGEgJiYgJ1RSVUUnID09PSBhLnRvVXBwZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsb2cnID09PSBlID8gbiArPSAnbGlnaHRncmVlbicgOiAnZXJyb3InID09PSBlID8gbiArPSAncGluaycgOiAnd2FybicgPT09IGUgJiYgKG4gKz0gJ2xpZ2h0eWVsbG93JyksIHIgJiYgbyAmJiBjb25zb2xlLmxvZygnJWNJQVNfREVCVUc6ICcgKyB0LCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pICYmIHModC5wcm90b3R5cGUsIG4pLCByICYmIHModCwgciksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpKSgpLCBsID0gJ2dwdCcsIGYgPSAnbG9uZ3JlcScsIGQgPSAnbScsIGcgPSAnbmEnLCBoID0gJ3Byb2ZpbGUnLCBwID0gJ3gnLCB5ID0gJ3hlJywgbSA9ICd4dCc7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB2KGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKHYgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBTeW1ib2wgJiYgJ3N5bWJvbCcgPT0gdHlwZW9mIFN5bWJvbC5pdGVyYXRvciA/IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmIGUuY29uc3RydWN0b3IgPT09IFN5bWJvbCAmJiBlICE9PSBTeW1ib2wucHJvdG90eXBlID8gJ3N5bWJvbCcgOiB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICB9KShlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIFMoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgdC5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRbbl07CiAgICAgICAgICAgICAgICAgICAgICAgIHIuZW51bWVyYWJsZSA9IHIuZW51bWVyYWJsZSB8fCAhMSwgci5jb25maWd1cmFibGUgPSAhMCwgJ3ZhbHVlJyBpbiByICYmIChyLndyaXRhYmxlID0gITApLCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgci5rZXksIHIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0Nhbm5vdCBjYWxsIGEgY2xhc3MgYXMgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSh0aGlzLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSBlLCAobiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZW5kWEhSJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQsIG4sIHIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF9hNGQ5ZGViODc2MDM2YzE1ID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JyksICRfX19vbGRfYmY0NThjZjU4NDMwMTIzMSA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYTRkOWRlYjg3NjAzNmMxNSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja183MzA2ZWE1NTZkYTU3MmFlLlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9iZjQ1OGNmNTg0MzAxMjMxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzczMDZlYTU1NmRhNTcyYWUuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEsIGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGEgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKSkgJiYgKGkgPSBlbmNvZGVVUkkoZSArICc/JyArIHQpLCBhLm9wZW4oJ0dFVCcsIGkpLCBhLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDQgPT09IGEucmVhZHlTdGF0ZSAmJiAyMDAgPT09IGEuc3RhdHVzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoZSA9IGEucmVzcG9uc2VUZXh0KS5jb2RlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmVycm9yKCdYTUxIdHRwUmVxdWVzdCBmYWlsdXJlIGNvZGU6ICcgKyBlLmNvZGUgKyAnLCBtZXNzYWdlOiAnICsgZS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbi5jYWxsKHt9LCBlIHx8IHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5lcnJvcignRXJyb3IgZmlyaW5nIHRoZSBYTUxIdHRwUmVxdWVzdCBjYWxsYmFjazogJyArIGUubWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgciAmJiAoYS50aW1lb3V0ID0gciksIGEub250aW1lb3V0ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5lcnJvcignWE1MSHR0cFJlcXVlc3QgdGltZW91dCBldmVudCBpcyBmaXJlZC4nKSwgYy5kaWFnUGl4KG0sIHsgbWVzc2FnZTogJ3RpbWVvdXQ6JyArIHIgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGEub25lcnJvciA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmVycm9yKCdYTUxIdHRwUmVxdWVzdCBlcnJvciBldmVudCBpcyBmaXJlZC4nKSwgYy5kaWFnUGl4KHksIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBhLnNlbmQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmVycm9yKCdFcnJvciBzZW5kaW5nIFhNTEh0dHBSZXF1ZXN0OiAnICsgZS5tZXNzYWdlKSwgYy5kaWFnUGl4KHAsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2E0ZDlkZWI4NzYwMzZjMTUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX29sZF9hNGQ5ZGViODc2MDM2YzE1KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9iZjQ1OGNmNTg0MzAxMjMxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfYmY0NThjZjU4NDMwMTIzMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdmb3JJbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKG4gaW4gZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaGFzT3duUHJvcGVydHkobikgJiYgdChuLCBlW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldFVJRCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTWF0aC5mbG9vcig2NTUzNiAqICgxICsgTWF0aC5yYW5kb20oKSkpLnRvU3RyaW5nKDE2KS5zdWJzdHJpbmcoMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlKCkgKyBlKCkgKyAnLScgKyBlKCkgKyAnLScgKyBlKCkgKyAnLScgKyBlKCkgKyAnLScgKyBlKCkgKyBlKCkgKyBlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdleHRlbmQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCAmJiBPYmplY3Qua2V5cyh0KS5mb3JFYWNoKGZ1bmN0aW9uIChuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW25dID0gdFtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdpc0FycmF5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgaW5zdGFuY2VvZiBBcnJheTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2lzRGVmJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2lzRm4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2lzT2JqJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdvYmplY3QnID09PSB2KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnaXNFbXB0eU9iaicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwID09PSBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyhlKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdub3cnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgRGF0ZSgpLmdldFRpbWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2NoYW5jZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAxMDAgKiBNYXRoLnJhbmRvbSgpIDwgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIF0pICYmIFModC5wcm90b3R5cGUsIG4pLCByICYmIFModCwgciksIGU7CiAgICAgICAgICAgICAgICAgICAgfSgpKSgpLCBfID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHIsIGEsIGksIG8sIHMsIHUsIGMgPSB7fSwgbCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgJiYgZS5yZXBsYWNlKC9bXlx3LV8uPlwvXS9nLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB0ID0gbCgoaSA9IGUuYWRTbG90SWQpICYmIGkucmVwbGFjZSgvXC8vZywgJycpKSwgbiA9IGUuc2l6ZSAmJiBlLnNpemUgaW5zdGFuY2VvZiBBcnJheSAmJiBlLnNpemUuam9pbignLicpLCByID0gbChlLmFkVW5pdFBhdGgpLCBhID0gZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJ2Rpc3BsYXknOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gZS50eXBlICYmIG51bGwgIT0gdCAmJiAndmlkZW8nID09IGwodCkgJiYgKG4gPSAndmlkZW8nKSwgbjsKICAgICAgICAgICAgICAgICAgICAgICAgfShlLnR5cGUpLCBjLmlkID0gdCwgKGMgPSBiLmV4dGVuZChjLCAobyA9IGUuc2l6ZSwgdSA9IHt9LCBiLmlzQXJyYXkobykgJiYgKG8uZXZlcnkoYi5pc0FycmF5KSA/IChzID0gby5tYXAoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmpvaW4oJy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignLCcpLCB1LnNzID0gJ1snICsgcyArICddJykgOiB1LnMgPSBvLmpvaW4oJy4nKSksIHUpKSkucCA9IHIsIGMudCA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b1N0cmluZzogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCB0ID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlIGluIGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucHVzaChlICsgJzonICsgY1tlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzbG90PXsnICsgdC5qb2luKCcsJykgKyAnfSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNWYWxpZDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0ICYmIG4gJiYgcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgZnVuY3Rpb24gRShlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCB0Lmxlbmd0aDsgbisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gdFtuXTsKICAgICAgICAgICAgICAgICAgICAgICAgci5lbnVtZXJhYmxlID0gci5lbnVtZXJhYmxlIHx8ICExLCByLmNvbmZpZ3VyYWJsZSA9ICEwLCAndmFsdWUnIGluIHIgJiYgKHIud3JpdGFibGUgPSAhMCksIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLCByLmtleSwgcik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIEEgPSBuZXcgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQ2Fubm90IGNhbGwgYSBjbGFzcyBhcyBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0odGhpcywgZSksIHIgPSBbXSwgKG4gPSAnbGlzdCcpIGluICh0ID0gdGhpcykgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkodCwgbiwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiB0W25dID0gcjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSBlLCAobiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnYWRkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBfKGUpLmlzVmFsaWQoKSA/IHRoaXMubGlzdC5wdXNoKG5ldyBfKGUpKSA6IGMuZXJyb3IoJ01pc3NpbmcgYWQgc2xvdCBpZCwgc2xvdCBzaXplIGFuZC9vciBhZCB1bml0IHBhdGguJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldEFkU2xvdHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBlLmFkU2xvdHMsIG4gPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgJiYgKHQgaW5zdGFuY2VvZiBBcnJheSA/IHQuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLmFkZChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGIuaXNPYmoodCkgJiYgdGhpcy5hZGQodCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdjbGVhcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubGlzdCA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzdHJpbmdpZnknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5saXN0LmpvaW4oJyYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnaXNFbXB0eScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwID09PSB0aGlzLmxpc3QubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgXSkgJiYgRSh0LnByb3RvdHlwZSwgbiksIHIgJiYgRSh0LCByKSwgZTsKICAgICAgICAgICAgICAgIH0oKSkoKTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIEkoZSwgdCkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwgdC5sZW5ndGg7IG4rKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IHRbbl07CiAgICAgICAgICAgICAgICAgICAgICAgIHIuZW51bWVyYWJsZSA9IHIuZW51bWVyYWJsZSB8fCAhMSwgci5jb25maWd1cmFibGUgPSAhMCwgJ3ZhbHVlJyBpbiByICYmIChyLndyaXRhYmxlID0gITApLCBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgci5rZXksIHIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHcoZSwgdCwgbikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0IGluIGUgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgdCwgewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogbiwKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pIDogZVt0XSA9IG4sIGU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgRCA9IG5ldyAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICFmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoZSBpbnN0YW5jZW9mIHQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0Nhbm5vdCBjYWxsIGEgY2xhc3MgYXMgYSBmdW5jdGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICB9KHRoaXMsIGUpLCB3KHRoaXMsICdjYWNoZWRQYWdlRGF0YScsIHt9KSwgdyh0aGlzLCAnY2FjaGVkU2xvdHNEYXRhJywge30pLCB3KHRoaXMsICdjYWNoZWRDdXN0b21EYXRhJywge30pLCB3KHRoaXMsICdCUkFORF9TQUZFVFlfT0JKRUNUX0ZJRUxEX05BTUUnLCAnYnJhbmRTYWZldHknKSwgdyh0aGlzLCAnRlJBVURfRklFTERfTkFNRScsICdmcicpLCB3KHRoaXMsICdTTE9UU19PQkpFQ1RfRklFTERfTkFNRScsICdzbG90cycpLCB3KHRoaXMsICdDVVNUT01fRklFTERfTkFNRScsICdjdXN0b20nKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSBlLCAobiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAndXBkYXRlRGF0YScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IEpTT04ucGFyc2UoZSksIG4gPSB0W3RoaXMuQlJBTkRfU0FGRVRZX09CSkVDVF9GSUVMRF9OQU1FXSwgciA9IHRbdGhpcy5TTE9UU19PQkpFQ1RfRklFTERfTkFNRV0sIGEgPSB0W3RoaXMuQ1VTVE9NX0ZJRUxEX05BTUVdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbdGhpcy5GUkFVRF9GSUVMRF9OQU1FXSAmJiAodGhpcy5jYWNoZWRQYWdlRGF0YVt0aGlzLkZSQVVEX0ZJRUxEX05BTUVdID0gdFt0aGlzLkZSQVVEX0ZJRUxEX05BTUVdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuZm9ySW4oZSwgZnVuY3Rpb24gKGUsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRbZV0gPSBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkobiwgdGhpcy5jYWNoZWRQYWdlRGF0YSksIGkociwgdGhpcy5jYWNoZWRTbG90c0RhdGEpLCBpKGEsIHRoaXMuY2FjaGVkQ3VzdG9tRGF0YSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2NsZWFyQ2FjaGVzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5jYWNoZWRQYWdlRGF0YSA9IHt9LCB0aGlzLmNhY2hlZFNsb3RzRGF0YSA9IHt9LCB0aGlzLmNhY2hlZEN1c3RvbURhdGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0VGFyZ2V0aW5nV3JhcHBlcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmIGIuaXNGbihlLnNldFRhcmdldGluZykgJiYgYi5mb3JJbih0LCBmdW5jdGlvbiAodCwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmxvZygnc2V0dGluZyB0YXJnZXRpbmc6IHsnICsgdCArICc6ICcgKyBuICsgJ30nKSwgZS5zZXRUYXJnZXRpbmcodCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldFNsb3RMZXZlbERhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSwgdCA9IHRoaXMsIG4gPSBpLmdvb2dsZXRhZy5wdWJhZHMoKS5nZXRTbG90cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPyBuLmZvckVhY2goZnVuY3Rpb24gKG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGUgPSBiLmlzRm4obi5nZXRTbG90RWxlbWVudElkKSAmJiBuLmdldFNsb3RFbGVtZW50SWQoKSkgJiYgdC5zZXRUYXJnZXRpbmdXcmFwcGVyKG4sIHQuY2FjaGVkU2xvdHNEYXRhW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGMuZXJyb3IoJ0dQVCBzbG90cyBoYXZlIHRvIGJlIGRlZmluZWQgYmVmb3JlIHNldHRpbmcgc2xvdCBsZXZlbCBrZXl3b3JkIHRhcmdldGluZycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXRQYWdlTGV2ZWxEYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYXJnZXRpbmdXcmFwcGVyKGkuZ29vZ2xldGFnLnB1YmFkcygpLCB0aGlzLmNhY2hlZFBhZ2VEYXRhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0Q3VzdG9tTGV2ZWxEYXRhJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYXJnZXRpbmdXcmFwcGVyKGkuZ29vZ2xldGFnLnB1YmFkcygpLCB0aGlzLmNhY2hlZEN1c3RvbURhdGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdzZXRUYXJnZXRpbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaS5nb29nbGV0YWcgPyBpLmdvb2dsZXRhZy5jbWQucHVzaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnNldFBhZ2VMZXZlbERhdGEoKSwgZS5zZXRTbG90TGV2ZWxEYXRhKCksIGUuc2V0Q3VzdG9tTGV2ZWxEYXRhKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogKGMuZXJyb3IoJ2dvb2dsZXRhZyBpcyBub3QgYXZhaWxhYmxlLiBDYW5ub3Qgc2V0IGtleXdvcmQgdGFyZ2V0aW5nIGZvciBHUFQuJyksIGMuZGlhZ1BpeChsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0pICYmIEkodC5wcm90b3R5cGUsIG4pLCByICYmIEkodCwgciksIGU7CiAgICAgICAgICAgICAgICB9KCkpKCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBUKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMDsgbiA8IHQubGVuZ3RoOyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0W25dOwogICAgICAgICAgICAgICAgICAgICAgICByLmVudW1lcmFibGUgPSByLmVudW1lcmFibGUgfHwgITEsIHIuY29uZmlndXJhYmxlID0gITAsICd2YWx1ZScgaW4gciAmJiAoci53cml0YWJsZSA9ICEwKSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHIua2V5LCByKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBQKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCBpbiBlID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICB9KSA6IGVbdF0gPSBuLCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIHggPSBuZXcgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICAhZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiB0KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdDYW5ub3QgY2FsbCBhIGNsYXNzIGFzIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSh0aGlzLCBlKSwgUCh0aGlzLCAnY2FjaGVkUGFnZURhdGEnLCB7fSksIFAodGhpcywgJ2NhY2hlZFNsb3RzRGF0YScsIHt9KSwgUCh0aGlzLCAnY2FjaGVkQ3VzdG9tRGF0YScsIHt9KSwgUCh0aGlzLCAnQlJBTkRfU0FGRVRZX09CSkVDVF9GSUVMRF9OQU1FJywgJ2JyYW5kU2FmZXR5JyksIFAodGhpcywgJ0ZSQVVEX0ZJRUxEX05BTUUnLCAnZnInKSwgUCh0aGlzLCAnU0xPVFNfT0JKRUNUX0ZJRUxEX05BTUUnLCAnc2xvdHMnKSwgUCh0aGlzLCAnQ1VTVE9NX0ZJRUxEX05BTUUnLCAnY3VzdG9tJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gZSwgKG4gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3VwZGF0ZURhdGEnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBKU09OLnBhcnNlKGUpLCBuID0gdFt0aGlzLkJSQU5EX1NBRkVUWV9PQkpFQ1RfRklFTERfTkFNRV0sIHIgPSB0W3RoaXMuU0xPVFNfT0JKRUNUX0ZJRUxEX05BTUVdLCBhID0gdFt0aGlzLkNVU1RPTV9GSUVMRF9OQU1FXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W3RoaXMuRlJBVURfRklFTERfTkFNRV0gJiYgKHRoaXMuY2FjaGVkUGFnZURhdGFbdGhpcy5GUkFVRF9GSUVMRF9OQU1FXSA9IHRbdGhpcy5GUkFVRF9GSUVMRF9OQU1FXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGkgPSBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLmZvckluKGUsIGZ1bmN0aW9uIChlLCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W2VdID0gbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpKG4sIHRoaXMuY2FjaGVkUGFnZURhdGEpLCBpKHIsIHRoaXMuY2FjaGVkU2xvdHNEYXRhKSwgaShhLCB0aGlzLmNhY2hlZEN1c3RvbURhdGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdjbGVhckNhY2hlcycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY2FjaGVkUGFnZURhdGEgPSB7fSwgdGhpcy5jYWNoZWRTbG90c0RhdGEgPSB7fSwgdGhpcy5jYWNoZWRDdXN0b21EYXRhID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldFRhcmdldGluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaS5hcG50YWcgJiYgaS5hcG50YWcucmVxdWVzdHMgJiYgaS5hcG50YWcucmVxdWVzdHMudGFncykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBhcG50YWcucmVxdWVzdHMudGFnczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKHQpLm1hcChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwbnRhZy5zZXRLZXl3b3Jkcyh0LCBlLmNhY2hlZFBhZ2VEYXRhKSwgYXBudGFnLnNldEtleXdvcmRzKHQsIGUuY2FjaGVkU2xvdHNEYXRhW3RdKSwgYXBudGFnLnNldEtleXdvcmRzKHQsIGUuY2FjaGVkQ3VzdG9tRGF0YSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmVycm9yKCdhcG50YWcgaXMgbm90IGF2YWlsYWJsZS4gQ2Fubm90IHNldCBrZXl3b3JkIHRhcmdldGluZyBmb3IgQXBwTmV4dXMuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0pICYmIFQodC5wcm90b3R5cGUsIG4pLCByICYmIFQodCwgciksIGU7CiAgICAgICAgICAgICAgICB9KCkpKCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBrKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMDsgbiA8IHQubGVuZ3RoOyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0W25dOwogICAgICAgICAgICAgICAgICAgICAgICByLmVudW1lcmFibGUgPSByLmVudW1lcmFibGUgfHwgITEsIHIuY29uZmlndXJhYmxlID0gITAsICd2YWx1ZScgaW4gciAmJiAoci53cml0YWJsZSA9ICEwKSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHIua2V5LCByKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgQyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCwgbiwgcjsKICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQ2Fubm90IGNhbGwgYSBjbGFzcyBhcyBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0odGhpcywgZSksIHIgPSB7fSwgKG4gPSAncmVxdWVzdFN0YXR1c0RpY3QnKSBpbiAodCA9IHRoaXMpID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KHQsIG4sIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiByLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogdFtuXSA9IHI7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCBvOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0ID0gZSwgKG4gPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3JlcG9ydExvbmdSZXF1ZXN0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0ID0gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQucmVxdWVzdFN0YXR1c0RpY3RbZV0gfHwgKGMuZGlhZ1BpeChmLCB7IG1lc3NhZ2U6ICd0aHJlc2hvbGQ6MjAwMCcgfSksIGMud2FybignTG9uZyBQRVQgcmVxdWVzdCB0aGF0IGV4Y2VlZHMgMjAwMG1zLicpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAyMDAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAncmVwb3J0UmVzcG9uc2VUaW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuLCByID0gdGhpcywgYSA9IGMuZ2V0UXVlcnlQYXJhbUJ5TmFtZSgnaWFzcHJvZmlsZXByb2JhYmlsaXR5JykgfHwgMTAsIGkgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLmNoYW5jZShhKSAmJiBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHIucmVxdWVzdFN0YXR1c0RpY3RbZV0sIG4gPSB0ICYmIHQgLSBlLCBpLnJlc3BvbnNldGltZSA9IG4sIGkucHJvYmFiaWxpdHkgPSBhLCBjLmRpYWdQaXgoaCwgeyBtZXNzYWdlOiBjLmJ1aWxkUXVlcnlTdHJpbmcoaSwgJzonKSB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCAyMDAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2VuZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciwgYSwgaSA9IHRoaXMsIG8gPSAhMSwgcyA9IGMuZ2V0UXVlcnlQYXJhbUJ5TmFtZSgnaWFzZW5kcG9pbnQnKSB8fCAnLy9waXhlbC5hZHNhZmVwcm90ZWN0ZWQuY29tL3NlcnZpY2VzL3B1YicsIHUgPSB0aGlzLmJ1aWxkUXVlcnlTdHJpbmdzKCksIGwgPSBiLmlzRm4oZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdSAmJiAobiA9IGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gPSBiLm5vdygpLCBjLmxvZygnUEVUIHJlc3BvbnNlICcgKyB0KSwgaS5yZXF1ZXN0U3RhdHVzRGljdFtyXSA9IG8sIEQudXBkYXRlRGF0YSh0KSwgeC51cGRhdGVEYXRhKHQpLCBsICYmIGUodCksIGNsZWFyVGltZW91dChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCByID0gYi5ub3coKSwgdGhpcy5yZXF1ZXN0U3RhdHVzRGljdFtyXSA9ICExLCBiLnNlbmRYSFIocywgdSwgbiwgdCksIGEgPSB0aGlzLnJlcG9ydExvbmdSZXF1ZXN0KHIpLCB0aGlzLnJlcG9ydFJlc3BvbnNlVGltZShyKSwgQS5jbGVhcigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc3RyaW5naWZ5U2l6ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS53aWR0aCArICcuJyArIGUuaGVpZ2h0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdidWlsZFF1ZXJ5U3RyaW5ncycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gW10sIHQgPSBpLl9faWFzUEVULnB1YklkLCBuID0gdGhpcy5zdHJpbmdpZnlTaXplKHIoaSkpLCBvID0gdGhpcy5zdHJpbmdpZnlTaXplKGEoaSkpLCBzID0gaS5fX2lhc1BFVC5zZXNzaW9uSWQsIHUgPSB3aW5kb3cubG9jYXRpb24uaHJlZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LmNvbnRleHQgJiYgd2luZG93LmNvbnRleHQuZG9tRmluZ2VycHJpbnQubWF0Y2goL2FtcC9nKSAmJiAodSA9IHUgfHwgaS5kb2N1bWVudC5yZWZlcnJlciksICFBLmlzRW1wdHkoKSAmJiB0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS5wdXNoKCdhbklkPScgKyB0KSwgZS5wdXNoKEEuc3RyaW5naWZ5KCkpLCBlLnB1c2goJ3dyPScgKyBuKSwgZS5wdXNoKCdzcj0nICsgbyksIGUucHVzaCgnc2Vzc2lvbklkPScgKyBzKSwgZS5wdXNoKCd1cmw9JyArIGVuY29kZVVSSUNvbXBvbmVudCh1KSksIGMubG9nKCdhZCBzbG90cyBzZXQ6ICcgKyBKU09OLnN0cmluZ2lmeShBKSksIGMubG9nKCdhbmlkIHNldDogJyArIHQpLCBlLmpvaW4oJyYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBLmlzRW1wdHkoKSAmJiBjLmVycm9yKCdFeHBlY3RlZCB2YWxpZCBhZCBzbG90IGNvbmZpZ3VyYXRpb24uJyksIHQgfHwgYy5lcnJvcignRXhwZWN0aW5nIHZhbGlkIElBUyBwdWJsaXNoZXIgaWQuJyksIGMuZGlhZ1BpeChkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0pICYmIGsodC5wcm90b3R5cGUsIG4pLCBvICYmIGsodCwgbyksIGU7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBPKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMDsgbiA8IHQubGVuZ3RoOyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0W25dOwogICAgICAgICAgICAgICAgICAgICAgICByLmVudW1lcmFibGUgPSByLmVudW1lcmFibGUgfHwgITEsIHIuY29uZmlndXJhYmxlID0gITAsICd2YWx1ZScgaW4gciAmJiAoci53cml0YWJsZSA9ICEwKSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHIua2V5LCByKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBSKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCBpbiBlID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICB9KSA6IGVbdF0gPSBuLCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIE4gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gZSgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQ2Fubm90IGNhbGwgYSBjbGFzcyBhcyBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0odGhpcywgZSksIFIodGhpcywgJ3RpbWVvdXQnLCBudWxsKSwgUih0aGlzLCAnZGF0YUhhbmRsZXInLCBudWxsKSwgUih0aGlzLCAnb3V0cHV0TWFuYWdlcicsIG51bGwpLCBSKHRoaXMsICdjb21tYW5kcycsIG51bGwpLCB0aGlzLm91dHB1dE1hbmFnZXIgPSBuZXcgQygpLCB0aGlzLmNvbW1hbmRzID0gdGhpcy5jb21tYW5kcyB8fCBpLl9faWFzUEVULnF1ZXVlOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuY29tbWFuZHMucHVzaCA9IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIuaXNGbihlKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFiLmlzT2JqKGUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0l0ZW1zIHB1c2hlZCBpbnRvIHRoZSBxdWV1ZSBtdXN0IGJlIGEgZnVuY3Rpb24gb3Igb2JqZWN0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmVycm9yKCdFcnJvciBwcm9jZXNzaW5nIHF1ZXVlZCBjb21tYW5kOiAnICsgZS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc2V0RnJvbUNvbmZpZyhuKSwgdC5vdXRwdXRNYW5hZ2VyLnNlbmQodC5kYXRhSGFuZGxlciwgdC50aW1lb3V0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIHQsIG4sIHI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgPSBlLCAobiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZXhlY3V0ZUNvbW1hbmRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuY29tbWFuZHMgPSB0aGlzLmNvbW1hbmRzIHx8IGkuX19pYXNQRVQucXVldWUsIHRoaXMuY29tbWFuZHMgJiYgdGhpcy5jb21tYW5kcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlID0gMDsgZSA8IHRoaXMuY29tbWFuZHMubGVuZ3RoOyArK2UpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5pc0ZuKHRoaXMuY29tbWFuZHNbZV0pID8gdCA9IHRoaXMuY29tbWFuZHNbZV0oKSA6IGIuaXNPYmoodGhpcy5jb21tYW5kc1tlXSkgJiYgKHQgPSB0aGlzLmNvbW1hbmRzW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmVycm9yKCdFcnJvciBwcm9jZXNzaW5nIHF1ZXVlZCBjb21tYW5kOiAnICsgZS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0RnJvbUNvbmZpZyh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm91dHB1dE1hbmFnZXIuc2VuZCh0aGlzLmRhdGFIYW5kbGVyLCB0aGlzLnRpbWVvdXQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0RnJvbUNvbmZpZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlICYmICh0aGlzLmRhdGFIYW5kbGVyID0gYi5pc0ZuKGUuZGF0YUhhbmRsZXIpID8gZS5kYXRhSGFuZGxlciA6IHRoaXMuZGF0YUhhbmRsZXIsIHRoaXMudGltZW91dCA9IGUudGltZW91dCB8fCB0aGlzLnRpbWVvdXQsIEEuc2V0QWRTbG90cyhlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBdKSAmJiBPKHQucHJvdG90eXBlLCBuKSwgciAmJiBPKHQsIHIpLCBlOwogICAgICAgICAgICAgICAgfSgpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gaihlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChqID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09IHR5cGVvZiBTeW1ib2wuaXRlcmF0b3IgPyBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiBlLmNvbnN0cnVjdG9yID09PSBTeW1ib2wgJiYgZSAhPT0gU3ltYm9sLnByb3RvdHlwZSA/ICdzeW1ib2wnIDogdHlwZW9mIGU7CiAgICAgICAgICAgICAgICAgICAgfSkoZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBMKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBuID0gMDsgbiA8IHQubGVuZ3RoOyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSB0W25dOwogICAgICAgICAgICAgICAgICAgICAgICByLmVudW1lcmFibGUgPSByLmVudW1lcmFibGUgfHwgITEsIHIuY29uZmlndXJhYmxlID0gITAsICd2YWx1ZScgaW4gciAmJiAoci53cml0YWJsZSA9ICEwKSwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHIua2V5LCByKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBGKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdCBpbiBlID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHQsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IG4sCiAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICB9KSA6IGVbdF0gPSBuLCBlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIE0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIHQsIG47CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIWZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignQ2Fubm90IGNhbGwgYSBjbGFzcyBhcyBhIGZ1bmN0aW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0odGhpcywgciksIEYodGhpcywgJ2FkU2VydmVyJywgdm9pZCAwKSwgRih0aGlzLCAnaWZyYW1lc0h0bWxDb250ZW50cycsIHt9KSwgRih0aGlzLCAndG9wUmVxdWVzdHMnLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdpc1JlZnJlc2hhYmxlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVyOiBmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGUuaWRlbnRpZnlBZFNlcnZlcihlLmFkU2VydmVyTGlzdCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQuc291cmNlLnBvc3RNZXNzYWdlKEpTT04uc3RyaW5naWZ5KG4pLCB0Lm9yaWdpbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ3JlY29yZEFkU2xvdEltcHJlc3Npb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZXI6IGZ1bmN0aW9uIChlLCB0LCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgciA9IGUuZ2V0QWRTZXJ2ZXIoKSwgYSA9IHIuZ2V0QWxsQWRTbG90cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5maW5kQWRTbG90QnlBZFVuaXRJZChhLCBuLmFkVW5pdElkLCBmdW5jdGlvbiAociwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFyICYmIGEgPyBlLnJlY29yZEFkU2xvdEltcHJlc3Npb24odCwgbi5hc2lkLCBuLmFkVW5pdElkLCBhLCBuLmNhY2hlSWQpIDogYy53YXJuKCdVbmFibGUgdG8gZmluZCBhZFNsb3QgYnkgYWRVbml0SWQnLCByKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUuZ2V0SWZyYW1lc0h0bWxDb250ZW50cygpLCBuLmNhY2hlSWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmVycm9yKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ3JlZnJlc2hBZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlcjogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByID0gZS5nZXRBZFNlcnZlcigpLCBhID0gbiAmJiBuLmFkVW5pdElkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5yZWZyZXNoKHIuZmluZEFkU2xvdEJ5Q2FjaGVJZChuLmNhY2hlSWQpLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5lcnJvcihlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgXSksIEYodGhpcywgJ2FkU2VydmVyTGlzdCcsIFt7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRTZXJ2ZXJOYW1lOiAnR1BUJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmFpbGFibGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhKGkuZ29vZ2xldGFnICYmIGkuZ29vZ2xldGFnLmFwaVJlYWR5ICYmIGkuZ29vZ2xldGFnLnB1YmFkcyAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBpLmdvb2dsZXRhZy5wdWJhZHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluZEFkU2xvdEJ5Q2FjaGVJZDogZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBPYmplY3Qua2V5cyhvLl9fSW50ZWdyYWxBU0V4ZWMuYWRTbG90RGF0YSkuZmlsdGVyKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5fX0ludGVncmFsQVNFeGVjLmFkU2xvdERhdGFbdF0uYWRTbG90LmNhY2hlSWQgPT09IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pWzBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5fX0ludGVncmFsQVNFeGVjICYmIG8uX19JbnRlZ3JhbEFTRXhlYy5hZFNsb3REYXRhICYmIG8uX19JbnRlZ3JhbEFTRXhlYy5hZFNsb3REYXRhW3RdICYmIG8uX19JbnRlZ3JhbEFTRXhlYy5hZFNsb3REYXRhW3RdLmFkU2xvdCB8fCBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QWRTbG90OiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gby5fX0ludGVncmFsQVNFeGVjICYmIG8uX19JbnRlZ3JhbEFTRXhlYy5hZFNsb3REYXRhICYmIG8uX19JbnRlZ3JhbEFTRXhlYy5hZFNsb3REYXRhW2VdICYmIG8uX19JbnRlZ3JhbEFTRXhlYy5hZFNsb3REYXRhW2VdLmFkU2xvdCB8fCBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QWxsQWRTbG90czogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGkuZ29vZ2xldGFnLnB1YmFkcyAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBpLmdvb2dsZXRhZy5wdWJhZHMgJiYgaS5nb29nbGV0YWcucHViYWRzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlICYmICdmdW5jdGlvbicgPT0gdHlwZW9mIGUuZ2V0U2xvdHMgJiYgZS5nZXRTbG90cygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNBZFVuaXRJZEluU2xvdDogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBudWxsLCBhID0gbmV3IFJlZ0V4cCgnJmNoYW5JZD0nLmNvbmNhdCh0LCAnJicpLCAnZycpLCBpID0gbmV3IFJlZ0V4cCgnJy5jb25jYXQobiksICdnaW0nKSwgbyA9IGUgJiYgZS5pYXNIdG1sICYmICdzdHJpbmcnID09IHR5cGVvZiBlLmlhc0h0bWwgJiYgZS5pYXNIdG1sIHx8IG51bGwsIHMgPSBhLnRlc3QobyksIHUgPSBpLnRlc3Qobyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBvICYmIHMgJiYgdSAmJiAociA9IGUpLCByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlVW5zYWZlQWRTbG90czogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBKU09OLnBhcnNlKEpTT04uc3RyaW5naWZ5KHQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuZm9yRWFjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdnb29nbGVfYWRzX2lmcmFtZV8nLmNvbmNhdChlLmdldFNsb3RJZCgpLnRvU3RyaW5nKCkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZ29vZ2xlX2Fkc19pZnJhbWUnLmNvbmNhdChlLmdldFNsb3RJZCgpLnRvU3RyaW5nKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXS5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJvb2xlYW4oaS5kb2N1bWVudC5nZXRFbGVtZW50QnlJZChlKSkgJiYgIXQuaGFzT3duUHJvcGVydHkoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlbMF0sIGEgPSBpLmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKHIpIHx8IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbyA9IGEuY29udGVudERvY3VtZW50IHx8IGEuY29udGVudFdpbmRvdyAmJiBhLmNvbnRlbnRXaW5kb3cuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8gJiYgT2JqZWN0LmRlZmluZVByb3BlcnR5KG4sIHIsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBvLmJvZHkuaW5uZXJIVE1MLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLndhcm4oJ1VuYWJsZSB0byBhY2Nlc3MgdGhlIHVuc2FmZSBpZnJhbWUgaHRtbCBjb250ZW50cycsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIG47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXRjaEFkU2xvdEh0bWw6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiwgciwgYSwgaSA9IHRoaXMudXBkYXRlVW5zYWZlQWRTbG90cyhlLCB0KSwgbyA9IE9iamVjdC5rZXlzKGkpLm1hcChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmZvckVhY2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBlLmdldEVzY2FwZWRRZW1RdWVyeUlkKCksIGEgPSBuZXcgUmVnRXhwKCcnLmNvbmNhdChuKSwgJ2cnKSwgZS5pYXNIdG1sID0gby5maWx0ZXIoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS50ZXN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlbMF0gfHwgbnVsbCwgZS5pYXNIdG1sIHx8IChyID0gbmV3IFJlZ0V4cCgnJy5jb25jYXQoZS5nZXRTbG90SWQoKS50b1N0cmluZygpKSwgJ2cnKSwgT2JqZWN0LmtleXMoaSkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIudGVzdCh0KSAmJiAoZS5pYXNIdG1sID0gaVt0XSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluZEFkU2xvdEJ5QWRVbml0SWQ6IGZ1bmN0aW9uIChlLCB0LCBuLCByLCBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdGhpcy5tYXRjaEFkU2xvdEh0bWwoZSwgcik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpICYmIEFycmF5LmlzQXJyYXkoaSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBvLCBzID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobyA9IDA7IG8gPCBpLmxlbmd0aDsgbyArPSAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzID0gdGhpcy5pc0FkVW5pdElkSW5TbG90KGlbb10sIHQsIGEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4obnVsbCwgcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMgfHwgbihuZXcgRXJyb3IoJ0FkIFNsb3QgTm90IEZvdW5kJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4obmV3IEVycm9yKCdzbG90cyBvciBhZCB1bml0IGlkIG1pc3NpbmcgZnJvbSByZXF1ZXN0JykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBpLmdvb2dsZXRhZyAmJiBpLmdvb2dsZXRhZy5jbWQsIHIgPSBpLmdvb2dsZXRhZyAmJiBpLmdvb2dsZXRhZy5wdWJhZHMgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgaS5nb29nbGV0YWcucHViYWRzICYmIGkuZ29vZ2xldGFnLnB1YmFkcygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuICYmIHIgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2Ygci5yZWZyZXNoICYmIGUgJiYgIXRoaXMuaXNBZFNsb3RFeGNsdWRlZChlLCB0KSAmJiAodGhpcy5zZXRSZWZyZXNoVGFyZ2V0aW5nKGUsIHQpLCBuLnB1c2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5yZWZyZXNoKFtlXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFJlZnJlc2hUYXJnZXRpbmc6IGZ1bmN0aW9uIChlLCB0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBuID0gJ0FEX1VOSVRfJy5jb25jYXQodCwgJ19fJykuY29uY2F0KGUuZ2V0U2xvdElkKCkudG9TdHJpbmcoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkuX19pYXNBZFJlZnJlc2hDb25maWcucmVmcmVzaFRhcmdldGluZyAmJiBpLl9faWFzQWRSZWZyZXNoQ29uZmlnLnJlZnJlc2hUYXJnZXRpbmcuZW5hYmxlZCAmJiBpLl9fSW50ZWdyYWxBU0V4ZWMuYWRTbG90RGF0YS5oYXNPd25Qcm9wZXJ0eShuKSAmJiAoJ3N0cmluZycgPT0gdHlwZW9mIGkuX19pYXNBZFJlZnJlc2hDb25maWcucmVmcmVzaFRhcmdldGluZy50YXJnZXRpbmdLZXkgJiYgaS5fX2lhc0FkUmVmcmVzaENvbmZpZy5yZWZyZXNoVGFyZ2V0aW5nLnRhcmdldGluZ0tleS50cmltKCkgPyBlLnNldFRhcmdldGluZyhpLl9faWFzQWRSZWZyZXNoQ29uZmlnLnJlZnJlc2hUYXJnZXRpbmcudGFyZ2V0aW5nS2V5LnRyaW0oKSwgaS5fX0ludGVncmFsQVNFeGVjLmFkU2xvdERhdGFbbl0ucmVmcmVzaENvdW50ICsgMSkgOiBjLndhcm4oJ0ludmFsaWQgcmVmcmVzaCB0YXJnZXRpbmcga2V5IHNwZWNmaWNpZWQgaW4gY29uZmlnJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRBbmRWYWxpZGF0ZUV4dHJhczogZnVuY3Rpb24gKGUsIHQsIG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHIgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdhZFNpemUnID09PSBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHQubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcmY2FtcElkPScuY29uY2F0KGUsICcmJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSBuZXcgUmVnRXhwKCcoJy5jb25jYXQoYS5qb2luKCd8JyksICcpJyksICdnJykudGVzdChuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoL15jdXN0b20vLnRlc3QoZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gdC5tYXAoZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyYnLmNvbmNhdChlLCAnPScpLmNvbmNhdCh0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IG5ldyBSZWdFeHAoJygnLmNvbmNhdChpLmpvaW4oJ3wnKSwgJyknKSwgJ2cnKS50ZXN0KG4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNBZFNsb3RFeGNsdWRlZDogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSB0aGlzLCByID0gZS5nZXRSZXNwb25zZUluZm9ybWF0aW9uKCksIGEgPSBpLl9faWFzQWRSZWZyZXNoQ29uZmlnLmV4Y2x1ZGVMaXN0ID8gSlNPTi5wYXJzZShKU09OLnN0cmluZ2lmeShpLl9faWFzQWRSZWZyZXNoQ29uZmlnLmV4Y2x1ZGVMaXN0KSkgOiBudWxsLCBvID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmFkVW5pdElkID0gTmFOICE9PSBOdW1iZXIodCkgPyBOdW1iZXIodCkgOiB0LCByLmNoYW5JZCA9IHIuYWRVbml0SWQsIGEgJiYgT2JqZWN0LmtleXMoYSkuZm9yRWFjaChmdW5jdGlvbiAodCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShhW3RdKSB8fCAnb2JqZWN0JyA9PT0gaihhW3RdKSB8fCAoYVt0XSA9IFthW3RdXSksIHIuaGFzT3duUHJvcGVydHkodCkgJiYgYVt0XS5pbmRleE9mKHJbdF0pID4gLTEgJiYgKG8gPSAhMCksICgnYWRTaXplJyA9PT0gdCB8fCAvXmN1c3RvbS8udGVzdCh0KSkgJiYgKG8gPSBuLmJ1aWxkQW5kVmFsaWRhdGVFeHRyYXModCwgYVt0XSwgZS5pYXNIdG1sKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBvOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICBpLl9faWFzQWRSZWZyZXNoQ29uZmlnID0gaS5fX2lhc0FkUmVmcmVzaENvbmZpZyB8fCB7fSwgby5hZGRFdmVudExpc3RlbmVyKCdtZXNzYWdlJywgZnVuY3Rpb24gKHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc2V0SWZyYW1lc0h0bWxDb250ZW50cygpLCAvcmVxdWVzdFRvcC9nLnRlc3QodC5kYXRhKSAmJiBlLmhhbmRsZVRvcFJlcXVlc3RzKHQpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSByLCAodCA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0QWRTZXJ2ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5hZFNlcnZlcjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnc2V0QWRTZXJ2ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5hZFNlcnZlciA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2lkZW50aWZ5QWRTZXJ2ZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgdCA9IDA7IHQgPCBlLmxlbmd0aDsgdCArPSAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZVt0XS5hZFNlcnZlck5hbWUgJiYgZVt0XS5hdmFpbGFibGUgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgZVt0XS5hdmFpbGFibGUgJiYgZVt0XS5hdmFpbGFibGUoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnNldEFkU2VydmVyKGVbdF0pLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNSZWZyZXNoYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRTZXJ2ZXJOYW1lOiBlW3RdLmFkU2VydmVyTmFtZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpc1JlZnJlc2hhYmxlOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRTZXJ2ZXJOYW1lOiBudWxsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZmluZEFkU2VydmVyQnlOYW1lJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSAwOyB0IDwgdGhpcy5hZFNlcnZlckxpc3QubGVuZ3RoOyB0ICs9IDEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLmFkU2VydmVyTGlzdFt0XS5hZFNlcnZlck5hbWUgPT09IGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5hZFNlcnZlckxpc3RbdF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2dldFRvcFJlcXVlc3RCeUlkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHQgPSBudWxsLCBuID0gMDsgbiA8IHRoaXMudG9wUmVxdWVzdHMubGVuZ3RoOyBuICs9IDEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID09PSB0aGlzLnRvcFJlcXVlc3RzW25dLmlkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gdGhpcy50b3BSZXF1ZXN0c1tuXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ2hhbmRsZVRvcFJlcXVlc3RzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0LCBuID0gSlNPTi5wYXJzZShlLmRhdGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gJiYgbi5yZXF1ZXN0VG9wICYmICh0ID0gdGhpcy5nZXRUb3BSZXF1ZXN0QnlJZChuLnJlcXVlc3RUb3ApKSAmJiB0LmhhbmRsZXIgJiYgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgdC5oYW5kbGVyICYmIHQuaGFuZGxlcih0aGlzLCBlLCBuKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiAnZ2V0QWRTbG90RGF0YUlkRm9yQWRVbml0SWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdBRF9VTklUXycgKyBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdyZWNvcmRBZFNsb3RJbXByZXNzaW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoZSwgdCwgbiwgciwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBpID0gJycuY29uY2F0KHRoaXMuZ2V0QWRTbG90RGF0YUlkRm9yQWRVbml0SWQobiksICdfXycpLmNvbmNhdChyLmdldFNsb3RJZCgpLnRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmNhY2hlSWQgPSBhLCBvLl9fSW50ZWdyYWxBU0V4ZWMgPSBvLl9fSW50ZWdyYWxBU0V4ZWMgfHwge30sIG8uX19JbnRlZ3JhbEFTRXhlYy5hZFNsb3REYXRhID0gby5fX0ludGVncmFsQVNFeGVjLmFkU2xvdERhdGEgfHwge30sIG8uX19JbnRlZ3JhbEFTRXhlYy5hZFNsb3REYXRhLmhhc093blByb3BlcnR5KGkpID8gby5fX0ludGVncmFsQVNFeGVjLmFkU2xvdERhdGFbaV0ucmVmcmVzaENvdW50ICs9IDEgOiBvLl9fSW50ZWdyYWxBU0V4ZWMuYWRTbG90RGF0YVtpXSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hDb3VudDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hTZXNzaW9uSWQ6IHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZFNsb3Q6IHIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5zZW5kUmVmcmVzaFNlc3Npb24oZSwgby5fX0ludGVncmFsQVNFeGVjLmFkU2xvdERhdGFbaV0sIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5lcnJvcignVW5hYmxlIHRvIHJlY29yZCBhZCBzbG90IGltcHJlc3Npb24nLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NlbmRSZWZyZXNoU2Vzc2lvbicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gKGUsIHQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdElkOiAncmVmcmVzaFNlc3Npb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoQ291bnQ6IHQucmVmcmVzaENvdW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoU2Vzc2lvbklkOiB0LnJlZnJlc2hTZXNzaW9uSWQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc291cmNlLnBvc3RNZXNzYWdlKEpTT04uc3RyaW5naWZ5KG4pLCBlLm9yaWdpbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogJ3NldElmcmFtZXNIdG1sQ29udGVudHMnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgby5hbXBJbmFib3hJZnJhbWVzICYmIG8uYW1wSW5hYm94SWZyYW1lcy5mb3JFYWNoKGZ1bmN0aW9uICh0KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoQm9vbGVhbih0LmdldEF0dHJpYnV0ZSgnZGF0YS1pcy1zYWZlZnJhbWUnKSkgfHwgQm9vbGVhbih0LmdldEF0dHJpYnV0ZSgnc2FuZGJveCcpKSkgJiYgdC5uYW1lICYmIChlLmlmcmFtZXNIdG1sQ29udGVudHNbdC5pZF0gPSB0Lm5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLndhcm4oJ1VuYWJsZSB0byBhY2Nlc3MgdGhlIHNhZmUgaWZyYW1lIGh0bWwgY29udGVudHMnLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6ICdnZXRJZnJhbWVzSHRtbENvbnRlbnRzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaWZyYW1lc0h0bWxDb250ZW50czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIF0pICYmIEwoZS5wcm90b3R5cGUsIHQpLCBuICYmIEwoZSwgbiksIHI7CiAgICAgICAgICAgICAgICB9KCk7CiAgICAgICAgICAgICAgICB2YXIgVSA9IGZ1bmN0aW9uIGUoKSB7CiAgICAgICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF9iNWZiYzE5N2VjZWFlOTFhID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0Jyk7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYjVmYmMxOTdlY2VhZTkxYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzczMDZlYTU1NmRhNTcyYWUuWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmdW5jdGlvbiAoZSwgdCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShlIGluc3RhbmNlb2YgdCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdDYW5ub3QgY2FsbCBhIGNsYXNzIGFzIGEgZnVuY3Rpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KHRoaXMsIGUpLCBpLl9faWFzUEVULnF1ZXVlID0gaS5fX2lhc1BFVC5xdWV1ZSB8fCBbXSwgaS5fX2lhc1BFVC5WRVJTSU9OID0gJzEuMTYuMzQnLCBpLl9faWFzUEVULnNldFRhcmdldGluZ0ZvckdQVCA9IEQuc2V0VGFyZ2V0aW5nKCksIGkuX19pYXNQRVQuc2V0VGFyZ2V0aW5nRm9yQXBwTmV4dXMgPSB4LnNldFRhcmdldGluZygpLCAndW5kZWZpbmVkJyAhPSB0eXBlb2YgWE1MSHR0cFJlcXVlc3QpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLl9faWFzUEVULnNlc3Npb25JZCA9IGIuZ2V0VUlEKCksIG5ldyBOKCkuZXhlY3V0ZUNvbW1hbmRzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IE0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMuZGlhZ1BpeChnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2I1ZmJjMTk3ZWNlYWU5MWEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkX2I1ZmJjMTk3ZWNlYWU5MWEpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgbi5kKHQsICdzdGFydCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdmFyIHEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFUoKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuZXJyb3IoZS5tZXNzYWdlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgaS5fX2lhc1BFVCA9IHdpbmRvdy5fX2lhc1BFVCB8fCB7fSwgaS5fX2lhc1BFVC5zdGFydCA9IHdpbmRvdy5fX2lhc1BFVC5zdGFydCB8fCBxLCBpLl9faWFzUEVULnN0YXJ0KCk7CiAgICAgICAgICAgIH0KICAgICAgICBdKTsKICAgIH0oKSkKfQ=="},{"name":"sugarcoat-e40cf8b1b251a846b2adda42a1521d0b92745c79","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfMDA0NjUyODQwMDRkNGFhOCA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja18wMDQ2NTI4NDAwNGQ0YWE4KTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgIWZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICAgICAgJ29iamVjdCcgPT0gdHlwZW9mIG1vZHVsZSAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgbW9kdWxlLmV4cG9ydHMgPyBtb2R1bGUuZXhwb3J0cyA9IGEuZG9jdW1lbnQgPyBiKGEsICEwKSA6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBpZiAoIWEuZG9jdW1lbnQpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdqUXVlcnkgcmVxdWlyZXMgYSB3aW5kb3cgd2l0aCBhIGRvY3VtZW50Jyk7CiAgICAgICAgICAgICAgICByZXR1cm4gYihhKTsKICAgICAgICAgICAgfSA6IGIoYSk7CiAgICAgICAgfSgndW5kZWZpbmVkJyAhPSB0eXBlb2Ygd2luZG93ID8gd2luZG93IDogdGhpcywgZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgJ3VzZSBzdHJpY3QnOwogICAgICAgICAgICB2YXIgYyA9IFtdLCBkID0gYS5kb2N1bWVudCwgZSA9IE9iamVjdC5nZXRQcm90b3R5cGVPZiwgZiA9IGMuc2xpY2UsIGcgPSBjLmNvbmNhdCwgaCA9IGMucHVzaCwgaSA9IGMuaW5kZXhPZiwgaiA9IHt9LCBrID0gai50b1N0cmluZywgbCA9IGouaGFzT3duUHJvcGVydHksIG0gPSBsLnRvU3RyaW5nLCBuID0gbS5jYWxsKE9iamVjdCksIG8gPSB7fTsKICAgICAgICAgICAgZnVuY3Rpb24gcChhLCBiKSB7CiAgICAgICAgICAgICAgICBiID0gYiB8fCBkOwogICAgICAgICAgICAgICAgdmFyIGMgPSBiLmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgYy50ZXh0ID0gYSwgYi5oZWFkLmFwcGVuZENoaWxkKGMpLnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQoYyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHEgPSAnMy4xLjEnLCByID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IHIuZm4uaW5pdChhLCBiKTsKICAgICAgICAgICAgICAgIH0sIHMgPSAvXltcc1x1RkVGRlx4QTBdK3xbXHNcdUZFRkZceEEwXSskL2csIHQgPSAvXi1tcy0vLCB1ID0gLy0oW2Etel0pL2csIHYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiLnRvVXBwZXJDYXNlKCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICByLmZuID0gci5wcm90b3R5cGUgPSB7CiAgICAgICAgICAgICAgICBqcXVlcnk6IHEsCiAgICAgICAgICAgICAgICBjb25zdHJ1Y3RvcjogciwKICAgICAgICAgICAgICAgIGxlbmd0aDogMCwKICAgICAgICAgICAgICAgIHRvQXJyYXk6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZi5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBhID8gZi5jYWxsKHRoaXMpIDogYSA8IDAgPyB0aGlzW2EgKyB0aGlzLmxlbmd0aF0gOiB0aGlzW2FdOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHB1c2hTdGFjazogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHIubWVyZ2UodGhpcy5jb25zdHJ1Y3RvcigpLCBhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYi5wcmV2T2JqZWN0ID0gdGhpcywgYjsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBlYWNoOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiByLmVhY2godGhpcywgYSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgbWFwOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnB1c2hTdGFjayhyLm1hcCh0aGlzLCBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5jYWxsKGIsIGMsIGIpOwogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBzbGljZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnB1c2hTdGFjayhmLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGZpcnN0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZXEoMCk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgbGFzdDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVxKC0xKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBlcTogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHRoaXMubGVuZ3RoLCBjID0gK2EgKyAoYSA8IDAgPyBiIDogMCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucHVzaFN0YWNrKGMgPj0gMCAmJiBjIDwgYiA/IFt0aGlzW2NdXSA6IFtdKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBlbmQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wcmV2T2JqZWN0IHx8IHRoaXMuY29uc3RydWN0b3IoKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBwdXNoOiBoLAogICAgICAgICAgICAgICAgc29ydDogYy5zb3J0LAogICAgICAgICAgICAgICAgc3BsaWNlOiBjLnNwbGljZQogICAgICAgICAgICB9LCByLmV4dGVuZCA9IHIuZm4uZXh0ZW5kID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEsIGIsIGMsIGQsIGUsIGYsIGcgPSBhcmd1bWVudHNbMF0gfHwge30sIGggPSAxLCBpID0gYXJndW1lbnRzLmxlbmd0aCwgaiA9ICExOwogICAgICAgICAgICAgICAgZm9yICgnYm9vbGVhbicgPT0gdHlwZW9mIGcgJiYgKGogPSBnLCBnID0gYXJndW1lbnRzW2hdIHx8IHt9LCBoKyspLCAnb2JqZWN0JyA9PSB0eXBlb2YgZyB8fCByLmlzRnVuY3Rpb24oZykgfHwgKGcgPSB7fSksIGggPT09IGkgJiYgKGcgPSB0aGlzLCBoLS0pOyBoIDwgaTsgaCsrKQogICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IChhID0gYXJndW1lbnRzW2hdKSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChiIGluIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gZ1tiXSwgZCA9IGFbYl0sIGcgIT09IGQgJiYgKGogJiYgZCAmJiAoci5pc1BsYWluT2JqZWN0KGQpIHx8IChlID0gci5pc0FycmF5KGQpKSkgPyAoZSA/IChlID0gITEsIGYgPSBjICYmIHIuaXNBcnJheShjKSA/IGMgOiBbXSkgOiBmID0gYyAmJiByLmlzUGxhaW5PYmplY3QoYykgPyBjIDoge30sIGdbYl0gPSByLmV4dGVuZChqLCBmLCBkKSkgOiB2b2lkIDAgIT09IGQgJiYgKGdbYl0gPSBkKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZzsKICAgICAgICAgICAgfSwgci5leHRlbmQoewogICAgICAgICAgICAgICAgZXhwYW5kbzogJ2pRdWVyeScgKyAocSArIE1hdGgucmFuZG9tKCkpLnJlcGxhY2UoL1xEL2csICcnKSwKICAgICAgICAgICAgICAgIGlzUmVhZHk6ICEwLAogICAgICAgICAgICAgICAgZXJyb3I6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGEpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIG5vb3A6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBpc0Z1bmN0aW9uOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09PSByLnR5cGUoYSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgaXNBcnJheTogQXJyYXkuaXNBcnJheSwKICAgICAgICAgICAgICAgIGlzV2luZG93OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGEgJiYgYSA9PT0gYS53aW5kb3c7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgaXNOdW1lcmljOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gci50eXBlKGEpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAoJ251bWJlcicgPT09IGIgfHwgJ3N0cmluZycgPT09IGIpICYmICFpc05hTihhIC0gcGFyc2VGbG9hdChhKSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgaXNQbGFpbk9iamVjdDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiwgYzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISghYSB8fCAnW29iamVjdCBPYmplY3RdJyAhPT0gay5jYWxsKGEpKSAmJiAoIShiID0gZShhKSkgfHwgKGMgPSBsLmNhbGwoYiwgJ2NvbnN0cnVjdG9yJykgJiYgYi5jb25zdHJ1Y3RvciwgJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgYyAmJiBtLmNhbGwoYykgPT09IG4pKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBpc0VtcHR5T2JqZWN0OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgICAgIGZvciAoYiBpbiBhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHR5cGU6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gYSA/IGEgKyAnJyA6ICdvYmplY3QnID09IHR5cGVvZiBhIHx8ICdmdW5jdGlvbicgPT0gdHlwZW9mIGEgPyBqW2suY2FsbChhKV0gfHwgJ29iamVjdCcgOiB0eXBlb2YgYTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBnbG9iYWxFdmFsOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHAoYSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgY2FtZWxDYXNlOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLnJlcGxhY2UodCwgJ21zLScpLnJlcGxhY2UodSwgdik7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgbm9kZU5hbWU6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubm9kZU5hbWUgJiYgYS5ub2RlTmFtZS50b0xvd2VyQ2FzZSgpID09PSBiLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgZWFjaDogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYywgZCA9IDA7CiAgICAgICAgICAgICAgICAgICAgaWYgKHcoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjID0gYS5sZW5ndGg7IGQgPCBjOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYi5jYWxsKGFbZF0sIGQsIGFbZF0pID09PSAhMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChkIGluIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYi5jYWxsKGFbZF0sIGQsIGFbZF0pID09PSAhMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB0cmltOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGEgPyAnJyA6IChhICsgJycpLnJlcGxhY2UocywgJycpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIG1ha2VBcnJheTogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGIgfHwgW107CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gYSAmJiAodyhPYmplY3QoYSkpID8gci5tZXJnZShjLCAnc3RyaW5nJyA9PSB0eXBlb2YgYSA/IFthXSA6IGEpIDogaC5jYWxsKGMsIGEpKSwgYzsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBpbkFycmF5OiBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGIgPyAtMSA6IGkuY2FsbChiLCBhLCBjKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBtZXJnZTogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gK2IubGVuZ3RoLCBkID0gMCwgZSA9IGEubGVuZ3RoOyBkIDwgYzsgZCsrKQogICAgICAgICAgICAgICAgICAgICAgICBhW2UrK10gPSBiW2RdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmxlbmd0aCA9IGUsIGE7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgZ3JlcDogZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkLCBlID0gW10sIGYgPSAwLCBnID0gYS5sZW5ndGgsIGggPSAhYzsgZiA8IGc7IGYrKykKICAgICAgICAgICAgICAgICAgICAgICAgZCA9ICFiKGFbZl0sIGYpLCBkICE9PSBoICYmIGUucHVzaChhW2ZdKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBtYXA6IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQsIGUsIGYgPSAwLCBoID0gW107CiAgICAgICAgICAgICAgICAgICAgaWYgKHcoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZCA9IGEubGVuZ3RoOyBmIDwgZDsgZisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGIoYVtmXSwgZiwgYyksIG51bGwgIT0gZSAmJiBoLnB1c2goZSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGYgaW4gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBiKGFbZl0sIGYsIGMpLCBudWxsICE9IGUgJiYgaC5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBnLmFwcGx5KFtdLCBoKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBndWlkOiAxLAogICAgICAgICAgICAgICAgcHJveHk6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMsIGQsIGU7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBiICYmIChjID0gYVtiXSwgYiA9IGEsIGEgPSBjKSwgci5pc0Z1bmN0aW9uKGEpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCA9IGYuY2FsbChhcmd1bWVudHMsIDIpLCBlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYXBwbHkoYiB8fCB0aGlzLCBkLmNvbmNhdChmLmNhbGwoYXJndW1lbnRzKSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBlLmd1aWQgPSBhLmd1aWQgPSBhLmd1aWQgfHwgci5ndWlkKyssIGU7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgbm93OiBEYXRlLm5vdywKICAgICAgICAgICAgICAgIHN1cHBvcnQ6IG8KICAgICAgICAgICAgfSksICdmdW5jdGlvbicgPT0gdHlwZW9mIFN5bWJvbCAmJiAoci5mbltTeW1ib2wuaXRlcmF0b3JdID0gY1tTeW1ib2wuaXRlcmF0b3JdKSwgci5lYWNoKCdCb29sZWFuIE51bWJlciBTdHJpbmcgRnVuY3Rpb24gQXJyYXkgRGF0ZSBSZWdFeHAgT2JqZWN0IEVycm9yIFN5bWJvbCcuc3BsaXQoJyAnKSwgZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGpbJ1tvYmplY3QgJyArIGIgKyAnXSddID0gYi50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgZnVuY3Rpb24gdyhhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9ICEhYSAmJiAnbGVuZ3RoJyBpbiBhICYmIGEubGVuZ3RoLCBjID0gci50eXBlKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuICdmdW5jdGlvbicgIT09IGMgJiYgIXIuaXNXaW5kb3coYSkgJiYgKCdhcnJheScgPT09IGMgfHwgMCA9PT0gYiB8fCAnbnVtYmVyJyA9PSB0eXBlb2YgYiAmJiBiID4gMCAmJiBiIC0gMSBpbiBhKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgeCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiwgYywgZCwgZSwgZiwgZywgaCwgaSwgaiwgaywgbCwgbSwgbiwgbywgcCwgcSwgciwgcywgdCwgdSA9ICdzaXp6bGUnICsgMSAqIG5ldyBEYXRlKCksIHYgPSBhLmRvY3VtZW50LCB3ID0gMCwgeCA9IDAsIHkgPSBoYSgpLCB6ID0gaGEoKSwgQSA9IGhhKCksIEIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA9PT0gYiAmJiAobCA9ICEwKSwgMDsKICAgICAgICAgICAgICAgICAgICB9LCBDID0ge30uaGFzT3duUHJvcGVydHksIEQgPSBbXSwgRSA9IEQucG9wLCBGID0gRC5wdXNoLCBHID0gRC5wdXNoLCBIID0gRC5zbGljZSwgSSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwLCBkID0gYS5sZW5ndGg7IGMgPCBkOyBjKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYVtjXSA9PT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgICAgICAgICAgIH0sIEogPSAnY2hlY2tlZHxzZWxlY3RlZHxhc3luY3xhdXRvZm9jdXN8YXV0b3BsYXl8Y29udHJvbHN8ZGVmZXJ8ZGlzYWJsZWR8aGlkZGVufGlzbWFwfGxvb3B8bXVsdGlwbGV8b3BlbnxyZWFkb25seXxyZXF1aXJlZHxzY29wZWQnLCBLID0gJ1tcXHgyMFxcdFxcclxcblxcZl0nLCBMID0gJyg/OlxcXFwufFtcXHctXXxbXlwwLVxceGEwXSkrJywgTSA9ICdcXFsnICsgSyArICcqKCcgKyBMICsgJykoPzonICsgSyArICcqKFsqXiR8IX5dPz0pJyArIEsgKyAnKig/OlwnKCg/OlxcXFwufFteXFxcXFwnXSkqKVwnfCIoKD86XFxcXC58W15cXFxcIl0pKikifCgnICsgTCArICcpKXwpJyArIEsgKyAnKlxcXScsIE4gPSAnOignICsgTCArICcpKD86XFwoKChcJygoPzpcXFxcLnxbXlxcXFxcJ10pKilcJ3wiKCg/OlxcXFwufFteXFxcXCJdKSopIil8KCg/OlxcXFwufFteXFxcXCgpW1xcXV18JyArIE0gKyAnKSopfC4qKVxcKXwpJywgTyA9IG5ldyBSZWdFeHAoSyArICcrJywgJ2cnKSwgUCA9IG5ldyBSZWdFeHAoJ14nICsgSyArICcrfCgoPzpefFteXFxcXF0pKD86XFxcXC4pKiknICsgSyArICcrJCcsICdnJyksIFEgPSBuZXcgUmVnRXhwKCdeJyArIEsgKyAnKiwnICsgSyArICcqJyksIFIgPSBuZXcgUmVnRXhwKCdeJyArIEsgKyAnKihbPit+XXwnICsgSyArICcpJyArIEsgKyAnKicpLCBTID0gbmV3IFJlZ0V4cCgnPScgKyBLICsgJyooW15cXF1cJyJdKj8pJyArIEsgKyAnKlxcXScsICdnJyksIFQgPSBuZXcgUmVnRXhwKE4pLCBVID0gbmV3IFJlZ0V4cCgnXicgKyBMICsgJyQnKSwgViA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgSUQ6IG5ldyBSZWdFeHAoJ14jKCcgKyBMICsgJyknKSwKICAgICAgICAgICAgICAgICAgICAgICAgQ0xBU1M6IG5ldyBSZWdFeHAoJ15cXC4oJyArIEwgKyAnKScpLAogICAgICAgICAgICAgICAgICAgICAgICBUQUc6IG5ldyBSZWdFeHAoJ14oJyArIEwgKyAnfFsqXSknKSwKICAgICAgICAgICAgICAgICAgICAgICAgQVRUUjogbmV3IFJlZ0V4cCgnXicgKyBNKSwKICAgICAgICAgICAgICAgICAgICAgICAgUFNFVURPOiBuZXcgUmVnRXhwKCdeJyArIE4pLAogICAgICAgICAgICAgICAgICAgICAgICBDSElMRDogbmV3IFJlZ0V4cCgnXjoob25seXxmaXJzdHxsYXN0fG50aHxudGgtbGFzdCktKGNoaWxkfG9mLXR5cGUpKD86XFwoJyArIEsgKyAnKihldmVufG9kZHwoKFsrLV18KShcXGQqKW58KScgKyBLICsgJyooPzooWystXXwpJyArIEsgKyAnKihcXGQrKXwpKScgKyBLICsgJypcXCl8KScsICdpJyksCiAgICAgICAgICAgICAgICAgICAgICAgIGJvb2w6IG5ldyBSZWdFeHAoJ14oPzonICsgSiArICcpJCcsICdpJyksCiAgICAgICAgICAgICAgICAgICAgICAgIG5lZWRzQ29udGV4dDogbmV3IFJlZ0V4cCgnXicgKyBLICsgJypbPit+XXw6KGV2ZW58b2RkfGVxfGd0fGx0fG50aHxmaXJzdHxsYXN0KSg/OlxcKCcgKyBLICsgJyooKD86LVxcZCk/XFxkKiknICsgSyArICcqXFwpfCkoPz1bXi1dfCQpJywgJ2knKQogICAgICAgICAgICAgICAgICAgIH0sIFcgPSAvXig/OmlucHV0fHNlbGVjdHx0ZXh0YXJlYXxidXR0b24pJC9pLCBYID0gL15oXGQkL2ksIFkgPSAvXltee10rXHtccypcW25hdGl2ZSBcdy8sIFogPSAvXig/OiMoW1x3LV0rKXwoXHcrKXxcLihbXHctXSspKSQvLCAkID0gL1srfl0vLCBfID0gbmV3IFJlZ0V4cCgnXFxcXChbXFxkYS1mXXsxLDZ9JyArIEsgKyAnP3woJyArIEsgKyAnKXwuKScsICdpZycpLCBhYSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gJzB4JyArIGIgLSA2NTUzNjsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQgIT09IGQgfHwgYyA/IGIgOiBkIDwgMCA/IFN0cmluZy5mcm9tQ2hhckNvZGUoZCArIDY1NTM2KSA6IFN0cmluZy5mcm9tQ2hhckNvZGUoZCA+PiAxMCB8IDU1Mjk2LCAxMDIzICYgZCB8IDU2MzIwKTsKICAgICAgICAgICAgICAgICAgICB9LCBiYSA9IC8oW1wwLVx4MWZceDdmXXxeLT9cZCl8Xi0kfFteXDAtXHgxZlx4N2YtXHVGRkZGXHctXS9nLCBjYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiID8gJ1wwJyA9PT0gYSA/ICdcdUZGRkQnIDogYS5zbGljZSgwLCAtMSkgKyAnXFwnICsgYS5jaGFyQ29kZUF0KGEubGVuZ3RoIC0gMSkudG9TdHJpbmcoMTYpICsgJyAnIDogJ1xcJyArIGE7CiAgICAgICAgICAgICAgICAgICAgfSwgZGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG0oKTsKICAgICAgICAgICAgICAgICAgICB9LCBlYSA9IHRhKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmRpc2FibGVkID09PSAhMCAmJiAoJ2Zvcm0nIGluIGEgfHwgJ2xhYmVsJyBpbiBhKTsKICAgICAgICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRpcjogJ3BhcmVudE5vZGUnLAogICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiAnbGVnZW5kJwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBHLmFwcGx5KEQgPSBILmNhbGwodi5jaGlsZE5vZGVzKSwgdi5jaGlsZE5vZGVzKSwgRFt2LmNoaWxkTm9kZXMubGVuZ3RoXS5ub2RlVHlwZTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGZhKSB7CiAgICAgICAgICAgICAgICAgICAgRyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYXBwbHk6IEQubGVuZ3RoID8gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEYuYXBwbHkoYSwgSC5jYWxsKGIpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEubGVuZ3RoLCBkID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChhW2MrK10gPSBiW2QrK10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5sZW5ndGggPSBjIC0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBnYShhLCBiLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYsIGgsIGosIGssIGwsIG8sIHIsIHMgPSBiICYmIGIub3duZXJEb2N1bWVudCwgdyA9IGIgPyBiLm5vZGVUeXBlIDogOTsKICAgICAgICAgICAgICAgICAgICBpZiAoZCA9IGQgfHwgW10sICdzdHJpbmcnICE9IHR5cGVvZiBhIHx8ICFhIHx8IDEgIT09IHcgJiYgOSAhPT0gdyAmJiAxMSAhPT0gdykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFlICYmICgoYiA/IGIub3duZXJEb2N1bWVudCB8fCBiIDogdikgIT09IG4gJiYgbShiKSwgYiA9IGIgfHwgbiwgcCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDExICE9PSB3ICYmIChsID0gWi5leGVjKGEpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmID0gbFsxXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg5ID09PSB3KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGogPSBiLmdldEVsZW1lbnRCeUlkKGYpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoai5pZCA9PT0gZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkLnB1c2goaiksIGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzICYmIChqID0gcy5nZXRFbGVtZW50QnlJZChmKSkgJiYgdChiLCBqKSAmJiBqLmlkID09PSBmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZC5wdXNoKGopLCBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobFsyXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEcuYXBwbHkoZCwgYi5nZXRFbGVtZW50c0J5VGFnTmFtZShhKSksIGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChmID0gbFszXSkgJiYgYy5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lICYmIGIuZ2V0RWxlbWVudHNCeUNsYXNzTmFtZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEcuYXBwbHkoZCwgYi5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lKGYpKSwgZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMucXNhICYmICFBW2EgKyAnICddICYmICghcSB8fCAhcS50ZXN0KGEpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgIT09IHcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcyA9IGIsIHIgPSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoJ29iamVjdCcgIT09IGIubm9kZU5hbWUudG9Mb3dlckNhc2UoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChrID0gYi5nZXRBdHRyaWJ1dGUoJ2lkJykpID8gayA9IGsucmVwbGFjZShiYSwgY2EpIDogYi5zZXRBdHRyaWJ1dGUoJ2lkJywgayA9IHUpLCBvID0gZyhhKSwgaCA9IG8ubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChoLS0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9baF0gPSAnIycgKyBrICsgJyAnICsgc2Eob1toXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgciA9IG8uam9pbignLCcpLCBzID0gJC50ZXN0KGEpICYmIHFhKGIucGFyZW50Tm9kZSkgfHwgYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBHLmFwcGx5KGQsIHMucXVlcnlTZWxlY3RvckFsbChyKSksIGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoeCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsgPT09IHUgJiYgYi5yZW1vdmVBdHRyaWJ1dGUoJ2lkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBpKGEucmVwbGFjZShQLCAnJDEnKSwgYiwgZCwgZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBoYSgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFtdOwogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIoYywgZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5wdXNoKGMgKyAnICcpID4gZC5jYWNoZUxlbmd0aCAmJiBkZWxldGUgYlthLnNoaWZ0KCldLCBiW2MgKyAnICddID0gZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBpYShhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbdV0gPSAhMCwgYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGphKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IG4uY3JlYXRlRWxlbWVudCgnZmllbGRzZXQnKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFhKGIpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIucGFyZW50Tm9kZSAmJiBiLnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQoYiksIGIgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGthKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEuc3BsaXQoJ3wnKSwgZSA9IGMubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIHdoaWxlIChlLS0pCiAgICAgICAgICAgICAgICAgICAgICAgIGQuYXR0ckhhbmRsZVtjW2VdXSA9IGI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBsYShhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBiICYmIGEsIGQgPSBjICYmIDEgPT09IGEubm9kZVR5cGUgJiYgMSA9PT0gYi5ub2RlVHlwZSAmJiBhLnNvdXJjZUluZGV4IC0gYi5zb3VyY2VJbmRleDsKICAgICAgICAgICAgICAgICAgICBpZiAoZCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChjID0gYy5uZXh0U2libGluZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID09PSBiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA/IDEgOiAtMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG1hKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBiLm5vZGVOYW1lLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW5wdXQnID09PSBjICYmIGIudHlwZSA9PT0gYTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gbmEoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGIubm9kZU5hbWUudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICgnaW5wdXQnID09PSBjIHx8ICdidXR0b24nID09PSBjKSAmJiBiLnR5cGUgPT09IGE7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIG9hKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmb3JtJyBpbiBiID8gYi5wYXJlbnROb2RlICYmIGIuZGlzYWJsZWQgPT09ICExID8gJ2xhYmVsJyBpbiBiID8gJ2xhYmVsJyBpbiBiLnBhcmVudE5vZGUgPyBiLnBhcmVudE5vZGUuZGlzYWJsZWQgPT09IGEgOiBiLmRpc2FibGVkID09PSBhIDogYi5pc0Rpc2FibGVkID09PSBhIHx8IGIuaXNEaXNhYmxlZCAhPT0gIWEgJiYgZWEoYikgPT09IGEgOiBiLmRpc2FibGVkID09PSBhIDogJ2xhYmVsJyBpbiBiICYmIGIuZGlzYWJsZWQgPT09IGE7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHBhKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaWEoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgPSArYiwgaWEoZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCBmID0gYShbXSwgYy5sZW5ndGgsIGIpLCBnID0gZi5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZy0tKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNbZSA9IGZbZ11dICYmIChjW2VdID0gIShkW2VdID0gY1tlXSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHFhKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSAmJiAndW5kZWZpbmVkJyAhPSB0eXBlb2YgYS5nZXRFbGVtZW50c0J5VGFnTmFtZSAmJiBhOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYyA9IGdhLnN1cHBvcnQgPSB7fSwgZiA9IGdhLmlzWE1MID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEgJiYgKGEub3duZXJEb2N1bWVudCB8fCBhKS5kb2N1bWVudEVsZW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhYiAmJiAnSFRNTCcgIT09IGIubm9kZU5hbWU7CiAgICAgICAgICAgICAgICB9LCBtID0gZ2Euc2V0RG9jdW1lbnQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiLCBlLCBnID0gYSA/IGEub3duZXJEb2N1bWVudCB8fCBhIDogdjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyAhPT0gbiAmJiA5ID09PSBnLm5vZGVUeXBlICYmIGcuZG9jdW1lbnRFbGVtZW50ID8gKG4gPSBnLCBvID0gbi5kb2N1bWVudEVsZW1lbnQsIHAgPSAhZihuKSwgdiAhPT0gbiAmJiAoZSA9IG4uZGVmYXVsdFZpZXcpICYmIGUudG9wICE9PSBlICYmIChlLmFkZEV2ZW50TGlzdGVuZXIgPyBlLmFkZEV2ZW50TGlzdGVuZXIoJ3VubG9hZCcsIGRhLCAhMSkgOiBlLmF0dGFjaEV2ZW50ICYmIGUuYXR0YWNoRXZlbnQoJ29udW5sb2FkJywgZGEpKSwgYy5hdHRyaWJ1dGVzID0gamEoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuY2xhc3NOYW1lID0gJ2knLCAhYS5nZXRBdHRyaWJ1dGUoJ2NsYXNzTmFtZScpOwogICAgICAgICAgICAgICAgICAgIH0pLCBjLmdldEVsZW1lbnRzQnlUYWdOYW1lID0gamEoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuYXBwZW5kQ2hpbGQobi5jcmVhdGVDb21tZW50KCcnKSksICFhLmdldEVsZW1lbnRzQnlUYWdOYW1lKCcqJykubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIH0pLCBjLmdldEVsZW1lbnRzQnlDbGFzc05hbWUgPSBZLnRlc3Qobi5nZXRFbGVtZW50c0J5Q2xhc3NOYW1lKSwgYy5nZXRCeUlkID0gamEoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG8uYXBwZW5kQ2hpbGQoYSkuaWQgPSB1LCAhbi5nZXRFbGVtZW50c0J5TmFtZSB8fCAhbi5nZXRFbGVtZW50c0J5TmFtZSh1KS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgfSksIGMuZ2V0QnlJZCA/IChkLmZpbHRlci5JRCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gYS5yZXBsYWNlKF8sIGFhKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5nZXRBdHRyaWJ1dGUoJ2lkJykgPT09IGI7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgZC5maW5kLklEID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBiLmdldEVsZW1lbnRCeUlkICYmIHApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYi5nZXRFbGVtZW50QnlJZChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjID8gW2NdIDogW107CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KSA6IChkLmZpbHRlci5JRCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gYS5yZXBsYWNlKF8sIGFhKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9ICd1bmRlZmluZWQnICE9IHR5cGVvZiBhLmdldEF0dHJpYnV0ZU5vZGUgJiYgYS5nZXRBdHRyaWJ1dGVOb2RlKCdpZCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgJiYgYy52YWx1ZSA9PT0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9LCBkLmZpbmQuSUQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGIuZ2V0RWxlbWVudEJ5SWQgJiYgcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMsIGQsIGUsIGYgPSBiLmdldEVsZW1lbnRCeUlkKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IGYuZ2V0QXR0cmlidXRlTm9kZSgnaWQnKSwgYyAmJiBjLnZhbHVlID09PSBhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW2ZdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBiLmdldEVsZW1lbnRzQnlOYW1lKGEpLCBkID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZiA9IGVbZCsrXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgPSBmLmdldEF0dHJpYnV0ZU5vZGUoJ2lkJyksIGMgJiYgYy52YWx1ZSA9PT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbZl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KSwgZC5maW5kLlRBRyA9IGMuZ2V0RWxlbWVudHNCeVRhZ05hbWUgPyBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGIuZ2V0RWxlbWVudHNCeVRhZ05hbWUgPyBiLmdldEVsZW1lbnRzQnlUYWdOYW1lKGEpIDogYy5xc2EgPyBiLnF1ZXJ5U2VsZWN0b3JBbGwoYSkgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjLCBkID0gW10sIGUgPSAwLCBmID0gYi5nZXRFbGVtZW50c0J5VGFnTmFtZShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCcqJyA9PT0gYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGMgPSBmW2UrK10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSA9PT0gYy5ub2RlVHlwZSAmJiBkLnB1c2goYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgICAgICB9LCBkLmZpbmQuQ0xBU1MgPSBjLmdldEVsZW1lbnRzQnlDbGFzc05hbWUgJiYgZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCd1bmRlZmluZWQnICE9IHR5cGVvZiBiLmdldEVsZW1lbnRzQnlDbGFzc05hbWUgJiYgcCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiLmdldEVsZW1lbnRzQnlDbGFzc05hbWUoYSk7CiAgICAgICAgICAgICAgICAgICAgfSwgciA9IFtdLCBxID0gW10sIChjLnFzYSA9IFkudGVzdChuLnF1ZXJ5U2VsZWN0b3JBbGwpKSAmJiAoamEoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgby5hcHBlbmRDaGlsZChhKS5pbm5lckhUTUwgPSAnPGEgaWQ9XCcnICsgdSArICdcJz48L2E+PHNlbGVjdCBpZD1cJycgKyB1ICsgJy1cclxcXCcgbXNhbGxvd2NhcHR1cmU9XCdcJz48b3B0aW9uIHNlbGVjdGVkPVwnXCc+PC9vcHRpb24+PC9zZWxlY3Q+JywgYS5xdWVyeVNlbGVjdG9yQWxsKCdbbXNhbGxvd2NhcHR1cmVePVwnXCddJykubGVuZ3RoICYmIHEucHVzaCgnWypeJF09JyArIEsgKyAnKig/OlwnXCd8IiIpJyksIGEucXVlcnlTZWxlY3RvckFsbCgnW3NlbGVjdGVkXScpLmxlbmd0aCB8fCBxLnB1c2goJ1xcWycgKyBLICsgJyooPzp2YWx1ZXwnICsgSiArICcpJyksIGEucXVlcnlTZWxlY3RvckFsbCgnW2lkfj0nICsgdSArICctXScpLmxlbmd0aCB8fCBxLnB1c2goJ349JyksIGEucXVlcnlTZWxlY3RvckFsbCgnOmNoZWNrZWQnKS5sZW5ndGggfHwgcS5wdXNoKCc6Y2hlY2tlZCcpLCBhLnF1ZXJ5U2VsZWN0b3JBbGwoJ2EjJyArIHUgKyAnKyonKS5sZW5ndGggfHwgcS5wdXNoKCcuIy4rWyt+XScpOwogICAgICAgICAgICAgICAgICAgIH0pLCBqYShmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICBhLmlubmVySFRNTCA9ICc8YSBocmVmPVwnXCcgZGlzYWJsZWQ9XCdkaXNhYmxlZFwnPjwvYT48c2VsZWN0IGRpc2FibGVkPVwnZGlzYWJsZWRcJz48b3B0aW9uLz48L3NlbGVjdD4nOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IG4uY3JlYXRlRWxlbWVudCgnaW5wdXQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5zZXRBdHRyaWJ1dGUoJ3R5cGUnLCAnaGlkZGVuJyksIGEuYXBwZW5kQ2hpbGQoYikuc2V0QXR0cmlidXRlKCduYW1lJywgJ0QnKSwgYS5xdWVyeVNlbGVjdG9yQWxsKCdbbmFtZT1kXScpLmxlbmd0aCAmJiBxLnB1c2goJ25hbWUnICsgSyArICcqWypeJHwhfl0/PScpLCAyICE9PSBhLnF1ZXJ5U2VsZWN0b3JBbGwoJzplbmFibGVkJykubGVuZ3RoICYmIHEucHVzaCgnOmVuYWJsZWQnLCAnOmRpc2FibGVkJyksIG8uYXBwZW5kQ2hpbGQoYSkuZGlzYWJsZWQgPSAhMCwgMiAhPT0gYS5xdWVyeVNlbGVjdG9yQWxsKCc6ZGlzYWJsZWQnKS5sZW5ndGggJiYgcS5wdXNoKCc6ZW5hYmxlZCcsICc6ZGlzYWJsZWQnKSwgYS5xdWVyeVNlbGVjdG9yQWxsKCcqLDp4JyksIHEucHVzaCgnLC4qOicpOwogICAgICAgICAgICAgICAgICAgIH0pKSwgKGMubWF0Y2hlc1NlbGVjdG9yID0gWS50ZXN0KHMgPSBvLm1hdGNoZXMgfHwgby53ZWJraXRNYXRjaGVzU2VsZWN0b3IgfHwgby5tb3pNYXRjaGVzU2VsZWN0b3IgfHwgby5vTWF0Y2hlc1NlbGVjdG9yIHx8IG8ubXNNYXRjaGVzU2VsZWN0b3IpKSAmJiBqYShmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICBjLmRpc2Nvbm5lY3RlZE1hdGNoID0gcy5jYWxsKGEsICcqJyksIHMuY2FsbChhLCAnW3MhPVwnXCddOngnKSwgci5wdXNoKCchPScsIE4pOwogICAgICAgICAgICAgICAgICAgIH0pLCBxID0gcS5sZW5ndGggJiYgbmV3IFJlZ0V4cChxLmpvaW4oJ3wnKSksIHIgPSByLmxlbmd0aCAmJiBuZXcgUmVnRXhwKHIuam9pbignfCcpKSwgYiA9IFkudGVzdChvLmNvbXBhcmVEb2N1bWVudFBvc2l0aW9uKSwgdCA9IGIgfHwgWS50ZXN0KG8uY29udGFpbnMpID8gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSA5ID09PSBhLm5vZGVUeXBlID8gYS5kb2N1bWVudEVsZW1lbnQgOiBhLCBkID0gYiAmJiBiLnBhcmVudE5vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhID09PSBkIHx8ICEoIWQgfHwgMSAhPT0gZC5ub2RlVHlwZSB8fCAhKGMuY29udGFpbnMgPyBjLmNvbnRhaW5zKGQpIDogYS5jb21wYXJlRG9jdW1lbnRQb3NpdGlvbiAmJiAxNiAmIGEuY29tcGFyZURvY3VtZW50UG9zaXRpb24oZCkpKTsKICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYiA9IGIucGFyZW50Tm9kZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiA9PT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgfSwgQiA9IGIgPyBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA9PT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsID0gITAsIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gIWEuY29tcGFyZURvY3VtZW50UG9zaXRpb24gLSAhYi5jb21wYXJlRG9jdW1lbnRQb3NpdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQgPyBkIDogKGQgPSAoYS5vd25lckRvY3VtZW50IHx8IGEpID09PSAoYi5vd25lckRvY3VtZW50IHx8IGIpID8gYS5jb21wYXJlRG9jdW1lbnRQb3NpdGlvbihiKSA6IDEsIDEgJiBkIHx8ICFjLnNvcnREZXRhY2hlZCAmJiBiLmNvbXBhcmVEb2N1bWVudFBvc2l0aW9uKGEpID09PSBkID8gYSA9PT0gbiB8fCBhLm93bmVyRG9jdW1lbnQgPT09IHYgJiYgdCh2LCBhKSA/IC0xIDogYiA9PT0gbiB8fCBiLm93bmVyRG9jdW1lbnQgPT09IHYgJiYgdCh2LCBiKSA/IDEgOiBrID8gSShrLCBhKSAtIEkoaywgYikgOiAwIDogNCAmIGQgPyAtMSA6IDEpOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA9PT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsID0gITAsIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjLCBkID0gMCwgZSA9IGEucGFyZW50Tm9kZSwgZiA9IGIucGFyZW50Tm9kZSwgZyA9IFthXSwgaCA9IFtiXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlIHx8ICFmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPT09IG4gPyAtMSA6IGIgPT09IG4gPyAxIDogZSA/IC0xIDogZiA/IDEgOiBrID8gSShrLCBhKSAtIEkoaywgYikgOiAwOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9PT0gZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsYShhLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChjID0gYy5wYXJlbnROb2RlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZy51bnNoaWZ0KGMpOwogICAgICAgICAgICAgICAgICAgICAgICBjID0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGMgPSBjLnBhcmVudE5vZGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLnVuc2hpZnQoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChnW2RdID09PSBoW2RdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCsrOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCA/IGxhKGdbZF0sIGhbZF0pIDogZ1tkXSA9PT0gdiA/IC0xIDogaFtkXSA9PT0gdiA/IDEgOiAwOwogICAgICAgICAgICAgICAgICAgIH0sIG4pIDogbjsKICAgICAgICAgICAgICAgIH0sIGdhLm1hdGNoZXMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBnYShhLCBudWxsLCBudWxsLCBiKTsKICAgICAgICAgICAgICAgIH0sIGdhLm1hdGNoZXNTZWxlY3RvciA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKChhLm93bmVyRG9jdW1lbnQgfHwgYSkgIT09IG4gJiYgbShhKSwgYiA9IGIucmVwbGFjZShTLCAnPVwnJDFcJ10nKSwgYy5tYXRjaGVzU2VsZWN0b3IgJiYgcCAmJiAhQVtiICsgJyAnXSAmJiAoIXIgfHwgIXIudGVzdChiKSkgJiYgKCFxIHx8ICFxLnRlc3QoYikpKQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBzLmNhbGwoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCB8fCBjLmRpc2Nvbm5lY3RlZE1hdGNoIHx8IGEuZG9jdW1lbnQgJiYgMTEgIT09IGEuZG9jdW1lbnQubm9kZVR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBnYShiLCBuLCBudWxsLCBbYV0pLmxlbmd0aCA+IDA7CiAgICAgICAgICAgICAgICB9LCBnYS5jb250YWlucyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChhLm93bmVyRG9jdW1lbnQgfHwgYSkgIT09IG4gJiYgbShhKSwgdChhLCBiKTsKICAgICAgICAgICAgICAgIH0sIGdhLmF0dHIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIChhLm93bmVyRG9jdW1lbnQgfHwgYSkgIT09IG4gJiYgbShhKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGQuYXR0ckhhbmRsZVtiLnRvTG93ZXJDYXNlKCldLCBmID0gZSAmJiBDLmNhbGwoZC5hdHRySGFuZGxlLCBiLnRvTG93ZXJDYXNlKCkpID8gZShhLCBiLCAhcCkgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gZiA/IGYgOiBjLmF0dHJpYnV0ZXMgfHwgIXAgPyBhLmdldEF0dHJpYnV0ZShiKSA6IChmID0gYS5nZXRBdHRyaWJ1dGVOb2RlKGIpKSAmJiBmLnNwZWNpZmllZCA/IGYudmFsdWUgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgZ2EuZXNjYXBlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGEgKyAnJykucmVwbGFjZShiYSwgY2EpOwogICAgICAgICAgICAgICAgfSwgZ2EuZXJyb3IgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignU3ludGF4IGVycm9yLCB1bnJlY29nbml6ZWQgZXhwcmVzc2lvbjogJyArIGEpOwogICAgICAgICAgICAgICAgfSwgZ2EudW5pcXVlU29ydCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIsIGQgPSBbXSwgZSA9IDAsIGYgPSAwOwogICAgICAgICAgICAgICAgICAgIGlmIChsID0gIWMuZGV0ZWN0RHVwbGljYXRlcywgayA9ICFjLnNvcnRTdGFibGUgJiYgYS5zbGljZSgwKSwgYS5zb3J0KEIpLCBsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChiID0gYVtmKytdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9PT0gYVtmXSAmJiAoZSA9IGQucHVzaChmKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChlLS0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnNwbGljZShkW2VdLCAxKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGsgPSBudWxsLCBhOwogICAgICAgICAgICAgICAgfSwgZSA9IGdhLmdldFRleHQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiLCBjID0gJycsIGQgPSAwLCBmID0gYS5ub2RlVHlwZTsKICAgICAgICAgICAgICAgICAgICBpZiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PT0gZiB8fCA5ID09PSBmIHx8IDExID09PSBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGEudGV4dENvbnRlbnQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEudGV4dENvbnRlbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgPSBhLmZpcnN0Q2hpbGQ7IGE7IGEgPSBhLm5leHRTaWJsaW5nKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgKz0gZShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgzID09PSBmIHx8IDQgPT09IGYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5ub2RlVmFsdWU7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChiID0gYVtkKytdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyArPSBlKGIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSwgZCA9IGdhLnNlbGVjdG9ycyA9IHsKICAgICAgICAgICAgICAgICAgICBjYWNoZUxlbmd0aDogNTAsCiAgICAgICAgICAgICAgICAgICAgY3JlYXRlUHNldWRvOiBpYSwKICAgICAgICAgICAgICAgICAgICBtYXRjaDogViwKICAgICAgICAgICAgICAgICAgICBhdHRySGFuZGxlOiB7fSwKICAgICAgICAgICAgICAgICAgICBmaW5kOiB7fSwKICAgICAgICAgICAgICAgICAgICByZWxhdGl2ZTogewogICAgICAgICAgICAgICAgICAgICAgICAnPic6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpcjogJ3BhcmVudE5vZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3Q6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICcgJzogeyBkaXI6ICdwYXJlbnROb2RlJyB9LAogICAgICAgICAgICAgICAgICAgICAgICAnKyc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpcjogJ3ByZXZpb3VzU2libGluZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdDogITAKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgJ34nOiB7IGRpcjogJ3ByZXZpb3VzU2libGluZycgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcHJlRmlsdGVyOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIEFUVFI6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYVsxXSA9IGFbMV0ucmVwbGFjZShfLCBhYSksIGFbM10gPSAoYVszXSB8fCBhWzRdIHx8IGFbNV0gfHwgJycpLnJlcGxhY2UoXywgYWEpLCAnfj0nID09PSBhWzJdICYmIChhWzNdID0gJyAnICsgYVszXSArICcgJyksIGEuc2xpY2UoMCwgNCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIENISUxEOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbMV0gPSBhWzFdLnRvTG93ZXJDYXNlKCksICdudGgnID09PSBhWzFdLnNsaWNlKDAsIDMpID8gKGFbM10gfHwgZ2EuZXJyb3IoYVswXSksIGFbNF0gPSArKGFbNF0gPyBhWzVdICsgKGFbNl0gfHwgMSkgOiAyICogKCdldmVuJyA9PT0gYVszXSB8fCAnb2RkJyA9PT0gYVszXSkpLCBhWzVdID0gKyhhWzddICsgYVs4XSB8fCAnb2RkJyA9PT0gYVszXSkpIDogYVszXSAmJiBnYS5lcnJvcihhWzBdKSwgYTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgUFNFVURPOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIsIGMgPSAhYVs2XSAmJiBhWzJdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFYuQ0hJTEQudGVzdChhWzBdKSA/IG51bGwgOiAoYVszXSA/IGFbMl0gPSBhWzRdIHx8IGFbNV0gfHwgJycgOiBjICYmIFQudGVzdChjKSAmJiAoYiA9IGcoYywgITApKSAmJiAoYiA9IGMuaW5kZXhPZignKScsIGMubGVuZ3RoIC0gYikgLSBjLmxlbmd0aCkgJiYgKGFbMF0gPSBhWzBdLnNsaWNlKDAsIGIpLCBhWzJdID0gYy5zbGljZSgwLCBiKSksIGEuc2xpY2UoMCwgMykpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBmaWx0ZXI6IHsKICAgICAgICAgICAgICAgICAgICAgICAgVEFHOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLnJlcGxhY2UoXywgYWEpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyonID09PSBhID8gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLm5vZGVOYW1lICYmIGEubm9kZU5hbWUudG9Mb3dlckNhc2UoKSA9PT0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIENMQVNTOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSB5W2EgKyAnICddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgfHwgKGIgPSBuZXcgUmVnRXhwKCcoXnwnICsgSyArICcpJyArIGEgKyAnKCcgKyBLICsgJ3wkKScpKSAmJiB5KGEsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIudGVzdCgnc3RyaW5nJyA9PSB0eXBlb2YgYS5jbGFzc05hbWUgJiYgYS5jbGFzc05hbWUgfHwgJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEuZ2V0QXR0cmlidXRlICYmIGEuZ2V0QXR0cmlidXRlKCdjbGFzcycpIHx8ICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBBVFRSOiBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBnYS5hdHRyKGQsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGUgPyAnIT0nID09PSBiIDogIWIgfHwgKGUgKz0gJycsICc9JyA9PT0gYiA/IGUgPT09IGMgOiAnIT0nID09PSBiID8gZSAhPT0gYyA6ICdePScgPT09IGIgPyBjICYmIDAgPT09IGUuaW5kZXhPZihjKSA6ICcqPScgPT09IGIgPyBjICYmIGUuaW5kZXhPZihjKSA+IC0xIDogJyQ9JyA9PT0gYiA/IGMgJiYgZS5zbGljZSgtYy5sZW5ndGgpID09PSBjIDogJ349JyA9PT0gYiA/ICgnICcgKyBlLnJlcGxhY2UoTywgJyAnKSArICcgJykuaW5kZXhPZihjKSA+IC0xIDogJ3w9JyA9PT0gYiAmJiAoZSA9PT0gYyB8fCBlLnNsaWNlKDAsIGMubGVuZ3RoICsgMSkgPT09IGMgKyAnLScpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIENISUxEOiBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSAnbnRoJyAhPT0gYS5zbGljZSgwLCAzKSwgZyA9ICdsYXN0JyAhPT0gYS5zbGljZSgtNCksIGggPSAnb2YtdHlwZScgPT09IGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMSA9PT0gZCAmJiAwID09PSBlID8gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFhLnBhcmVudE5vZGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKGIsIGMsIGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaiwgaywgbCwgbSwgbiwgbywgcCA9IGYgIT09IGcgPyAnbmV4dFNpYmxpbmcnIDogJ3ByZXZpb3VzU2libGluZycsIHEgPSBiLnBhcmVudE5vZGUsIHIgPSBoICYmIGIubm9kZU5hbWUudG9Mb3dlckNhc2UoKSwgcyA9ICFpICYmICFoLCB0ID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbSA9IGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKG0gPSBtW3BdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCA/IG0ubm9kZU5hbWUudG9Mb3dlckNhc2UoKSA9PT0gciA6IDEgPT09IG0ubm9kZVR5cGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IHAgPSAnb25seScgPT09IGEgJiYgIW8gJiYgJ25leHRTaWJsaW5nJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobyA9IFtnID8gcS5maXJzdENoaWxkIDogcS5sYXN0Q2hpbGRdLCBnICYmIHMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gPSBxLCBsID0gbVt1XSB8fCAobVt1XSA9IHt9KSwgayA9IGxbbS51bmlxdWVJRF0gfHwgKGxbbS51bmlxdWVJRF0gPSB7fSksIGogPSBrW2FdIHx8IFtdLCBuID0galswXSA9PT0gdyAmJiBqWzFdLCB0ID0gbiAmJiBqWzJdLCBtID0gbiAmJiBxLmNoaWxkTm9kZXNbbl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAobSA9ICsrbiAmJiBtICYmIG1bcF0gfHwgKHQgPSBuID0gMCkgfHwgby5wb3AoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PT0gbS5ub2RlVHlwZSAmJiArK3QgJiYgbSA9PT0gYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrW2FdID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzICYmIChtID0gYiwgbCA9IG1bdV0gfHwgKG1bdV0gPSB7fSksIGsgPSBsW20udW5pcXVlSURdIHx8IChsW20udW5pcXVlSURdID0ge30pLCBqID0ga1thXSB8fCBbXSwgbiA9IGpbMF0gPT09IHcgJiYgalsxXSwgdCA9IG4pLCB0ID09PSAhMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChtID0gKytuICYmIG0gJiYgbVtwXSB8fCAodCA9IG4gPSAwKSB8fCBvLnBvcCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoaCA/IG0ubm9kZU5hbWUudG9Mb3dlckNhc2UoKSA9PT0gciA6IDEgPT09IG0ubm9kZVR5cGUpICYmICsrdCAmJiAocyAmJiAobCA9IG1bdV0gfHwgKG1bdV0gPSB7fSksIGsgPSBsW20udW5pcXVlSURdIHx8IChsW20udW5pcXVlSURdID0ge30pLCBrW2FdID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIG0gPT09IGIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHQgLT0gZSwgdCA9PT0gZCB8fCB0ICUgZCA9PT0gMCAmJiB0IC8gZCA+PSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIFBTRVVETzogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjLCBlID0gZC5wc2V1ZG9zW2FdIHx8IGQuc2V0RmlsdGVyc1thLnRvTG93ZXJDYXNlKCldIHx8IGdhLmVycm9yKCd1bnN1cHBvcnRlZCBwc2V1ZG86ICcgKyBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlW3VdID8gZShiKSA6IGUubGVuZ3RoID4gMSA/IChjID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLCBkLnNldEZpbHRlcnMuaGFzT3duUHJvcGVydHkoYS50b0xvd2VyQ2FzZSgpKSA/IGlhKGZ1bmN0aW9uIChhLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQsIGYgPSBlKGEsIGIpLCBnID0gZi5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGctLSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IEkoYSwgZltnXSksIGFbZF0gPSAhKGNbZF0gPSBmW2ddKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZShhLCAwLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcHNldWRvczogewogICAgICAgICAgICAgICAgICAgICAgICBub3Q6IGlhKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IFtdLCBjID0gW10sIGQgPSBoKGEucmVwbGFjZShQLCAnJDEnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZFt1XSA/IGlhKGZ1bmN0aW9uIChhLCBiLCBjLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYsIGcgPSBkKGEsIG51bGwsIGUsIFtdKSwgaCA9IGEubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChoLS0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChmID0gZ1toXSkgJiYgKGFbaF0gPSAhKGJbaF0gPSBmKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGZ1bmN0aW9uIChhLCBlLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJbMF0gPSBhLCBkKGIsIG51bGwsIGYsIGMpLCBiWzBdID0gbnVsbCwgIWMucG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgaGFzOiBpYShmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdhKGEsIGIpLmxlbmd0aCA+IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgY29udGFpbnM6IGlhKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA9IGEucmVwbGFjZShfLCBhYSksIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChiLnRleHRDb250ZW50IHx8IGIuaW5uZXJUZXh0IHx8IGUoYikpLmluZGV4T2YoYSkgPiAtMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLAogICAgICAgICAgICAgICAgICAgICAgICBsYW5nOiBpYShmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFUudGVzdChhIHx8ICcnKSB8fCBnYS5lcnJvcigndW5zdXBwb3J0ZWQgbGFuZzogJyArIGEpLCBhID0gYS5yZXBsYWNlKF8sIGFhKS50b0xvd2VyQ2FzZSgpLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID0gcCA/IGIubGFuZyA6IGIuZ2V0QXR0cmlidXRlKCd4bWw6bGFuZycpIHx8IGIuZ2V0QXR0cmlidXRlKCdsYW5nJykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyA9IGMudG9Mb3dlckNhc2UoKSwgYyA9PT0gYSB8fCAwID09PSBjLmluZGV4T2YoYSArICctJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKChiID0gYi5wYXJlbnROb2RlKSAmJiAxID09PSBiLm5vZGVUeXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmxvY2F0aW9uICYmIGEubG9jYXRpb24uaGFzaDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjICYmIGMuc2xpY2UoMSkgPT09IGIuaWQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHJvb3Q6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA9PT0gbzsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZm9jdXM6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA9PT0gbi5hY3RpdmVFbGVtZW50ICYmICghbi5oYXNGb2N1cyB8fCBuLmhhc0ZvY3VzKCkpICYmICEhKGEudHlwZSB8fCBhLmhyZWYgfHwgfmEudGFiSW5kZXgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBlbmFibGVkOiBvYSghMSksCiAgICAgICAgICAgICAgICAgICAgICAgIGRpc2FibGVkOiBvYSghMCksCiAgICAgICAgICAgICAgICAgICAgICAgIGNoZWNrZWQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEubm9kZU5hbWUudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW5wdXQnID09PSBiICYmICEhYS5jaGVja2VkIHx8ICdvcHRpb24nID09PSBiICYmICEhYS5zZWxlY3RlZDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0ZWQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5wYXJlbnROb2RlICYmIGEucGFyZW50Tm9kZS5zZWxlY3RlZEluZGV4LCBhLnNlbGVjdGVkID09PSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZW1wdHk6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGEgPSBhLmZpcnN0Q2hpbGQ7IGE7IGEgPSBhLm5leHRTaWJsaW5nKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLm5vZGVUeXBlIDwgNikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBwYXJlbnQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWQucHNldWRvcy5lbXB0eShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFgudGVzdChhLm5vZGVOYW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVy50ZXN0KGEubm9kZU5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBidXR0b246IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEubm9kZU5hbWUudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW5wdXQnID09PSBiICYmICdidXR0b24nID09PSBhLnR5cGUgfHwgJ2J1dHRvbicgPT09IGI7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIHRleHQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaW5wdXQnID09PSBhLm5vZGVOYW1lLnRvTG93ZXJDYXNlKCkgJiYgJ3RleHQnID09PSBhLnR5cGUgJiYgKG51bGwgPT0gKGIgPSBhLmdldEF0dHJpYnV0ZSgndHlwZScpKSB8fCAndGV4dCcgPT09IGIudG9Mb3dlckNhc2UoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGZpcnN0OiBwYShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWzBdOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgbGFzdDogcGEoZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbYiAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgZXE6IHBhKGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW2MgPCAwID8gYyArIGIgOiBjXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW46IHBhKGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IGI7IGMgKz0gMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnB1c2goYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgIG9kZDogcGEoZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAxOyBjIDwgYjsgYyArPSAyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucHVzaChjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwKICAgICAgICAgICAgICAgICAgICAgICAgbHQ6IHBhKGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gYyA8IDAgPyBjICsgYiA6IGM7IC0tZCA+PSAwOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnB1c2goZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgfSksCiAgICAgICAgICAgICAgICAgICAgICAgIGd0OiBwYShmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IGMgPCAwID8gYyArIGIgOiBjOyArK2QgPCBiOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnB1c2goZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBkLnBzZXVkb3MubnRoID0gZC5wc2V1ZG9zLmVxOwogICAgICAgICAgICAgICAgZm9yIChiIGluIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmFkaW86ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjaGVja2JveDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGZpbGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBwYXNzd29yZDogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGltYWdlOiAhMAogICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAgICAgZC5wc2V1ZG9zW2JdID0gbWEoYik7CiAgICAgICAgICAgICAgICBmb3IgKGIgaW4gewogICAgICAgICAgICAgICAgICAgICAgICBzdWJtaXQ6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICByZXNldDogITAKICAgICAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgICAgIGQucHNldWRvc1tiXSA9IG5hKGIpOwogICAgICAgICAgICAgICAgZnVuY3Rpb24gcmEoKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByYS5wcm90b3R5cGUgPSBkLmZpbHRlcnMgPSBkLnBzZXVkb3MsIGQuc2V0RmlsdGVycyA9IG5ldyByYSgpLCBnID0gZ2EudG9rZW5pemUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjLCBlLCBmLCBnLCBoLCBpLCBqLCBrID0gelthICsgJyAnXTsKICAgICAgICAgICAgICAgICAgICBpZiAoaykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgPyAwIDogay5zbGljZSgwKTsKICAgICAgICAgICAgICAgICAgICBoID0gYSwgaSA9IFtdLCBqID0gZC5wcmVGaWx0ZXI7CiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYyAmJiAhKGUgPSBRLmV4ZWMoaCkpIHx8IChlICYmIChoID0gaC5zbGljZShlWzBdLmxlbmd0aCkgfHwgaCksIGkucHVzaChmID0gW10pKSwgYyA9ICExLCAoZSA9IFIuZXhlYyhoKSkgJiYgKGMgPSBlLnNoaWZ0KCksIGYucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGVbMF0ucmVwbGFjZShQLCAnICcpCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBoID0gaC5zbGljZShjLmxlbmd0aCkpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGcgaW4gZC5maWx0ZXIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAhKGUgPSBWW2ddLmV4ZWMoaCkpIHx8IGpbZ10gJiYgIShlID0galtnXShlKSkgfHwgKGMgPSBlLnNoaWZ0KCksIGYucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogZywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXRjaGVzOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgaCA9IGguc2xpY2UoYy5sZW5ndGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBiID8gaC5sZW5ndGggOiBoID8gZ2EuZXJyb3IoYSkgOiB6KGEsIGkpLnNsaWNlKDApOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNhKGEpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gMCwgYyA9IGEubGVuZ3RoLCBkID0gJyc7IGIgPCBjOyBiKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGQgKz0gYVtiXS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHRhKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGIuZGlyLCBlID0gYi5uZXh0LCBmID0gZSB8fCBkLCBnID0gYyAmJiAncGFyZW50Tm9kZScgPT09IGYsIGggPSB4Kys7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIuZmlyc3QgPyBmdW5jdGlvbiAoYiwgYywgZSkgewogICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYiA9IGJbZF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PT0gYi5ub2RlVHlwZSB8fCBnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhKGIsIGMsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgfSA6IGZ1bmN0aW9uIChiLCBjLCBpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBqLCBrLCBsLCBtID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChiID0gYltkXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKDEgPT09IGIubm9kZVR5cGUgfHwgZykgJiYgYShiLCBjLCBpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChiID0gYltkXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PT0gYi5ub2RlVHlwZSB8fCBnKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobCA9IGJbdV0gfHwgKGJbdV0gPSB7fSksIGsgPSBsW2IudW5pcXVlSURdIHx8IChsW2IudW5pcXVlSURdID0ge30pLCBlICYmIGUgPT09IGIubm9kZU5hbWUudG9Mb3dlckNhc2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBiW2RdIHx8IGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChqID0ga1tmXSkgJiYgalswXSA9PT0gdyAmJiBqWzFdID09PSBoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtWzJdID0galsyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChrW2ZdID0gbSwgbVsyXSA9IGEoYiwgYywgaSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdWEoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmxlbmd0aCA+IDEgPyBmdW5jdGlvbiAoYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGEubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZS0tKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhW2VdKGIsIGMsIGQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIH0gOiBhWzBdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gdmEoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSAwLCBlID0gYi5sZW5ndGg7IGQgPCBlOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGdhKGEsIGJbZF0sIGMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gd2EoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYsIGcgPSBbXSwgaCA9IDAsIGkgPSBhLmxlbmd0aCwgaiA9IG51bGwgIT0gYjsgaCA8IGk7IGgrKykKICAgICAgICAgICAgICAgICAgICAgICAgKGYgPSBhW2hdKSAmJiAoYyAmJiAhYyhmLCBkLCBlKSB8fCAoZy5wdXNoKGYpLCBqICYmIGIucHVzaChoKSkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBnOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24geGEoYSwgYiwgYywgZCwgZSwgZikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBkICYmICFkW3VdICYmIChkID0geGEoZCkpLCBlICYmICFlW3VdICYmIChlID0geGEoZSwgZikpLCBpYShmdW5jdGlvbiAoZiwgZywgaCwgaSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaiwgaywgbCwgbSA9IFtdLCBuID0gW10sIG8gPSBnLmxlbmd0aCwgcCA9IGYgfHwgdmEoYiB8fCAnKicsIGgubm9kZVR5cGUgPyBbaF0gOiBoLCBbXSksIHEgPSAhYSB8fCAhZiAmJiBiID8gcCA6IHdhKHAsIG0sIGEsIGgsIGkpLCByID0gYyA/IGUgfHwgKGYgPyBhIDogbyB8fCBkKSA/IFtdIDogZyA6IHE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjICYmIGMocSwgciwgaCwgaSksIGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogPSB3YShyLCBuKSwgZChqLCBbXSwgaCwgaSksIGsgPSBqLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChrLS0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGwgPSBqW2tdKSAmJiAocltuW2tdXSA9ICEocVtuW2tdXSA9IGwpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgfHwgYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogPSBbXSwgayA9IHIubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoay0tKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGwgPSByW2tdKSAmJiBqLnB1c2gocVtrXSA9IGwpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlKG51bGwsIHIgPSBbXSwgaiwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsgPSByLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoay0tKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobCA9IHJba10pICYmIChqID0gZSA/IEkoZiwgbCkgOiBtW2tdKSA+IC0xICYmIChmW2pdID0gIShnW2pdID0gbCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIgPSB3YShyID09PSBnID8gci5zcGxpY2Uobywgci5sZW5ndGgpIDogciksIGUgPyBlKG51bGwsIGcsIHIsIGkpIDogRy5hcHBseShnLCByKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHlhKGEpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiLCBjLCBlLCBmID0gYS5sZW5ndGgsIGcgPSBkLnJlbGF0aXZlW2FbMF0udHlwZV0sIGggPSBnIHx8IGQucmVsYXRpdmVbJyAnXSwgaSA9IGcgPyAxIDogMCwgayA9IHRhKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPT09IGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBoLCAhMCksIGwgPSB0YShmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJKGIsIGEpID4gLTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBoLCAhMCksIG0gPSBbZnVuY3Rpb24gKGEsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSAhZyAmJiAoZCB8fCBjICE9PSBqKSB8fCAoKGIgPSBjKS5ub2RlVHlwZSA/IGsoYSwgYywgZCkgOiBsKGEsIGMsIGQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgPSBudWxsLCBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1dOyBpIDwgZjsgaSsrKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IGQucmVsYXRpdmVbYVtpXS50eXBlXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG0gPSBbdGEodWEobSksIGMpXTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IGQuZmlsdGVyW2FbaV0udHlwZV0uYXBwbHkobnVsbCwgYVtpXS5tYXRjaGVzKSwgY1t1XSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSA9ICsraTsgZSA8IGY7IGUrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQucmVsYXRpdmVbYVtlXS50eXBlXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4YShpID4gMSAmJiB1YShtKSwgaSA+IDEgJiYgc2EoYS5zbGljZSgwLCBpIC0gMSkuY29uY2F0KHsgdmFsdWU6ICcgJyA9PT0gYVtpIC0gMl0udHlwZSA/ICcqJyA6ICcnIH0pKS5yZXBsYWNlKFAsICckMScpLCBjLCBpIDwgZSAmJiB5YShhLnNsaWNlKGksIGUpKSwgZSA8IGYgJiYgeWEoYSA9IGEuc2xpY2UoZSkpLCBlIDwgZiAmJiBzYShhKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtLnB1c2goYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdWEobSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmdW5jdGlvbiB6YShhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBiLmxlbmd0aCA+IDAsIGUgPSBhLmxlbmd0aCA+IDAsIGYgPSBmdW5jdGlvbiAoZiwgZywgaCwgaSwgaykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwsIG8sIHEsIHIgPSAwLCBzID0gJzAnLCB0ID0gZiAmJiBbXSwgdSA9IFtdLCB2ID0gaiwgeCA9IGYgfHwgZSAmJiBkLmZpbmQuVEFHKCcqJywgayksIHkgPSB3ICs9IG51bGwgPT0gdiA/IDEgOiBNYXRoLnJhbmRvbSgpIHx8IDAuMSwgeiA9IHgubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChrICYmIChqID0gZyA9PT0gbiB8fCBnIHx8IGspOyBzICE9PSB6ICYmIG51bGwgIT0gKGwgPSB4W3NdKTsgcysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvID0gMCwgZyB8fCBsLm93bmVyRG9jdW1lbnQgPT09IG4gfHwgKG0obCksIGggPSAhcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChxID0gYVtvKytdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHEobCwgZyB8fCBuLCBoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkucHVzaChsKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgayAmJiAodyA9IHkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjICYmICgobCA9ICFxICYmIGwpICYmIHItLSwgZiAmJiB0LnB1c2gobCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgKz0gcywgYyAmJiBzICE9PSByKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbyA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHEgPSBiW28rK10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHEodCwgdSwgZywgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPiAwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHMtLSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0W3NdIHx8IHVbc10gfHwgKHVbc10gPSBFLmNhbGwoaSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ID0gd2EodSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEcuYXBwbHkoaSwgdSksIGsgJiYgIWYgJiYgdS5sZW5ndGggPiAwICYmIHIgKyBiLmxlbmd0aCA+IDEgJiYgZ2EudW5pcXVlU29ydChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBrICYmICh3ID0geSwgaiA9IHYpLCB0OwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjID8gaWEoZikgOiBmOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGggPSBnYS5jb21waWxlID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYywgZCA9IFtdLCBlID0gW10sIGYgPSBBW2EgKyAnICddOwogICAgICAgICAgICAgICAgICAgIGlmICghZikgewogICAgICAgICAgICAgICAgICAgICAgICBiIHx8IChiID0gZyhhKSksIGMgPSBiLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGMtLSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSB5YShiW2NdKSwgZlt1XSA/IGQucHVzaChmKSA6IGUucHVzaChmKTsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IEEoYSwgemEoZSwgZCkpLCBmLnNlbGVjdG9yID0gYTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgICAgICB9LCBpID0gZ2Euc2VsZWN0ID0gZnVuY3Rpb24gKGEsIGIsIGMsIGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZiwgaSwgaiwgaywgbCwgbSA9ICdmdW5jdGlvbicgPT0gdHlwZW9mIGEgJiYgYSwgbiA9ICFlICYmIGcoYSA9IG0uc2VsZWN0b3IgfHwgYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMgPSBjIHx8IFtdLCAxID09PSBuLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA9IG5bMF0gPSBuWzBdLnNsaWNlKDApLCBpLmxlbmd0aCA+IDIgJiYgJ0lEJyA9PT0gKGogPSBpWzBdKS50eXBlICYmIDkgPT09IGIubm9kZVR5cGUgJiYgcCAmJiBkLnJlbGF0aXZlW2lbMV0udHlwZV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiID0gKGQuZmluZC5JRChqLm1hdGNoZXNbMF0ucmVwbGFjZShfLCBhYSksIGIpIHx8IFtdKVswXSwgIWIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtICYmIChiID0gYi5wYXJlbnROb2RlKSwgYSA9IGEuc2xpY2UoaS5zaGlmdCgpLnZhbHVlLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZiA9IFYubmVlZHNDb250ZXh0LnRlc3QoYSkgPyAwIDogaS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChmLS0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChqID0gaVtmXSwgZC5yZWxhdGl2ZVtrID0gai50eXBlXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgobCA9IGQuZmluZFtrXSkgJiYgKGUgPSBsKGoubWF0Y2hlc1swXS5yZXBsYWNlKF8sIGFhKSwgJC50ZXN0KGlbMF0udHlwZSkgJiYgcWEoYi5wYXJlbnROb2RlKSB8fCBiKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaS5zcGxpY2UoZiwgMSksIGEgPSBlLmxlbmd0aCAmJiBzYShpKSwgIWEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBHLmFwcGx5KGMsIGUpLCBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAobSB8fCBoKGEsIG4pKShlLCBiLCAhcCwgYywgIWIgfHwgJC50ZXN0KGEpICYmIHFhKGIucGFyZW50Tm9kZSkgfHwgYiksIGM7CiAgICAgICAgICAgICAgICB9LCBjLnNvcnRTdGFibGUgPSB1LnNwbGl0KCcnKS5zb3J0KEIpLmpvaW4oJycpID09PSB1LCBjLmRldGVjdER1cGxpY2F0ZXMgPSAhIWwsIG0oKSwgYy5zb3J0RGV0YWNoZWQgPSBqYShmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAxICYgYS5jb21wYXJlRG9jdW1lbnRQb3NpdGlvbihuLmNyZWF0ZUVsZW1lbnQoJ2ZpZWxkc2V0JykpOwogICAgICAgICAgICAgICAgfSksIGphKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuaW5uZXJIVE1MID0gJzxhIGhyZWY9XCcjXCc+PC9hPicsICcjJyA9PT0gYS5maXJzdENoaWxkLmdldEF0dHJpYnV0ZSgnaHJlZicpOwogICAgICAgICAgICAgICAgfSkgfHwga2EoJ3R5cGV8aHJlZnxoZWlnaHR8d2lkdGgnLCBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIGlmICghYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuZ2V0QXR0cmlidXRlKGIsICd0eXBlJyA9PT0gYi50b0xvd2VyQ2FzZSgpID8gMSA6IDIpOwogICAgICAgICAgICAgICAgfSksIGMuYXR0cmlidXRlcyAmJiBqYShmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmlubmVySFRNTCA9ICc8aW5wdXQvPicsIGEuZmlyc3RDaGlsZC5zZXRBdHRyaWJ1dGUoJ3ZhbHVlJywgJycpLCAnJyA9PT0gYS5maXJzdENoaWxkLmdldEF0dHJpYnV0ZSgndmFsdWUnKTsKICAgICAgICAgICAgICAgIH0pIHx8IGthKCd2YWx1ZScsIGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFjICYmICdpbnB1dCcgPT09IGEubm9kZU5hbWUudG9Mb3dlckNhc2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuZGVmYXVsdFZhbHVlOwogICAgICAgICAgICAgICAgfSksIGphKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gYS5nZXRBdHRyaWJ1dGUoJ2Rpc2FibGVkJyk7CiAgICAgICAgICAgICAgICB9KSB8fCBrYShKLCBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkOwogICAgICAgICAgICAgICAgICAgIGlmICghYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbYl0gPT09ICEwID8gYi50b0xvd2VyQ2FzZSgpIDogKGQgPSBhLmdldEF0dHJpYnV0ZU5vZGUoYikpICYmIGQuc3BlY2lmaWVkID8gZC52YWx1ZSA6IG51bGw7CiAgICAgICAgICAgICAgICB9KSwgZ2E7CiAgICAgICAgICAgIH0oYSk7CiAgICAgICAgICAgIHIuZmluZCA9IHgsIHIuZXhwciA9IHguc2VsZWN0b3JzLCByLmV4cHJbJzonXSA9IHIuZXhwci5wc2V1ZG9zLCByLnVuaXF1ZVNvcnQgPSByLnVuaXF1ZSA9IHgudW5pcXVlU29ydCwgci50ZXh0ID0geC5nZXRUZXh0LCByLmlzWE1MRG9jID0geC5pc1hNTCwgci5jb250YWlucyA9IHguY29udGFpbnMsIHIuZXNjYXBlU2VsZWN0b3IgPSB4LmVzY2FwZTsKICAgICAgICAgICAgdmFyIHkgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gW10sIGUgPSB2b2lkIDAgIT09IGM7CiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKChhID0gYVtiXSkgJiYgOSAhPT0gYS5ub2RlVHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT09IGEubm9kZVR5cGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICYmIHIoYSkuaXMoYykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLnB1c2goYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgIH0sIHogPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBbXTsgYTsgYSA9IGEubmV4dFNpYmxpbmcpCiAgICAgICAgICAgICAgICAgICAgICAgIDEgPT09IGEubm9kZVR5cGUgJiYgYSAhPT0gYiAmJiBjLnB1c2goYSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9LCBBID0gci5leHByLm1hdGNoLm5lZWRzQ29udGV4dCwgQiA9IC9ePChbYS16XVteXC9cMD46XHgyMFx0XHJcblxmXSopW1x4MjBcdFxyXG5cZl0qXC8/Pig/OjxcL1wxPnwpJC9pLCBDID0gL14uW146I1xbXC4sXSokLzsKICAgICAgICAgICAgZnVuY3Rpb24gRChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gci5pc0Z1bmN0aW9uKGIpID8gci5ncmVwKGEsIGZ1bmN0aW9uIChhLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhYi5jYWxsKGEsIGQsIGEpICE9PSBjOwogICAgICAgICAgICAgICAgfSkgOiBiLm5vZGVUeXBlID8gci5ncmVwKGEsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPT09IGIgIT09IGM7CiAgICAgICAgICAgICAgICB9KSA6ICdzdHJpbmcnICE9IHR5cGVvZiBiID8gci5ncmVwKGEsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkuY2FsbChiLCBhKSA+IC0xICE9PSBjOwogICAgICAgICAgICAgICAgfSkgOiBDLnRlc3QoYikgPyByLmZpbHRlcihiLCBhLCBjKSA6IChiID0gci5maWx0ZXIoYiwgYSksIHIuZ3JlcChhLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBpLmNhbGwoYiwgYSkgPiAtMSAhPT0gYyAmJiAxID09PSBhLm5vZGVUeXBlOwogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHIuZmlsdGVyID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHZhciBkID0gYlswXTsKICAgICAgICAgICAgICAgIHJldHVybiBjICYmIChhID0gJzpub3QoJyArIGEgKyAnKScpLCAxID09PSBiLmxlbmd0aCAmJiAxID09PSBkLm5vZGVUeXBlID8gci5maW5kLm1hdGNoZXNTZWxlY3RvcihkLCBhKSA/IFtkXSA6IFtdIDogci5maW5kLm1hdGNoZXMoYSwgci5ncmVwKGIsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDEgPT09IGEubm9kZVR5cGU7CiAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgIH0sIHIuZm4uZXh0ZW5kKHsKICAgICAgICAgICAgICAgIGZpbmQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIsIGMsIGQgPSB0aGlzLmxlbmd0aCwgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9IHR5cGVvZiBhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wdXNoU3RhY2socihhKS5maWx0ZXIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChiID0gMDsgYiA8IGQ7IGIrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5jb250YWlucyhlW2JdLCB0aGlzKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICAgICAgZm9yIChjID0gdGhpcy5wdXNoU3RhY2soW10pLCBiID0gMDsgYiA8IGQ7IGIrKykKICAgICAgICAgICAgICAgICAgICAgICAgci5maW5kKGEsIGVbYl0sIGMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkID4gMSA/IHIudW5pcXVlU29ydChjKSA6IGM7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgZmlsdGVyOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnB1c2hTdGFjayhEKHRoaXMsIGEgfHwgW10sICExKSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgbm90OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnB1c2hTdGFjayhEKHRoaXMsIGEgfHwgW10sICEwKSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgaXM6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhRCh0aGlzLCAnc3RyaW5nJyA9PSB0eXBlb2YgYSAmJiBBLnRlc3QoYSkgPyByKGEpIDogYSB8fCBbXSwgITEpLmxlbmd0aDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBFLCBGID0gL14oPzpccyooPFtcd1xXXSs+KVtePl0qfCMoW1x3LV0rKSkkLywgRyA9IHIuZm4uaW5pdCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIGY7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IGMgfHwgRSwgJ3N0cmluZycgPT0gdHlwZW9mIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPSAnPCcgPT09IGFbMF0gJiYgJz4nID09PSBhW2EubGVuZ3RoIC0gMV0gJiYgYS5sZW5ndGggPj0gMyA/IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSA6IEYuZXhlYyhhKSwgIWUgfHwgIWVbMV0gJiYgYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhYiB8fCBiLmpxdWVyeSA/IChiIHx8IGMpLmZpbmQoYSkgOiB0aGlzLmNvbnN0cnVjdG9yKGIpLmZpbmQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlWzFdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IGIgaW5zdGFuY2VvZiByID8gYlswXSA6IGIsIHIubWVyZ2UodGhpcywgci5wYXJzZUhUTUwoZVsxXSwgYiAmJiBiLm5vZGVUeXBlID8gYi5vd25lckRvY3VtZW50IHx8IGIgOiBkLCAhMCkpLCBCLnRlc3QoZVsxXSkgJiYgci5pc1BsYWluT2JqZWN0KGIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSBpbiBiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmlzRnVuY3Rpb24odGhpc1tlXSkgPyB0aGlzW2VdKGJbZV0pIDogdGhpcy5hdHRyKGUsIGJbZV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYgPSBkLmdldEVsZW1lbnRCeUlkKGVbMl0pLCBmICYmICh0aGlzWzBdID0gZiwgdGhpcy5sZW5ndGggPSAxKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubm9kZVR5cGUgPyAodGhpc1swXSA9IGEsIHRoaXMubGVuZ3RoID0gMSwgdGhpcykgOiByLmlzRnVuY3Rpb24oYSkgPyB2b2lkIDAgIT09IGMucmVhZHkgPyBjLnJlYWR5KGEpIDogYShyKSA6IHIubWFrZUFycmF5KGEsIHRoaXMpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgRy5wcm90b3R5cGUgPSByLmZuLCBFID0gcihkKTsKICAgICAgICAgICAgdmFyIEggPSAvXig/OnBhcmVudHN8cHJldig/OlVudGlsfEFsbCkpLywgSSA9IHsKICAgICAgICAgICAgICAgICAgICBjaGlsZHJlbjogITAsCiAgICAgICAgICAgICAgICAgICAgY29udGVudHM6ICEwLAogICAgICAgICAgICAgICAgICAgIG5leHQ6ICEwLAogICAgICAgICAgICAgICAgICAgIHByZXY6ICEwCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICByLmZuLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBoYXM6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSByKGEsIHRoaXMpLCBjID0gYi5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IDA7IGEgPCBjOyBhKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoci5jb250YWlucyh0aGlzLCBiW2FdKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgY2xvc2VzdDogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYywgZCA9IDAsIGUgPSB0aGlzLmxlbmd0aCwgZiA9IFtdLCBnID0gJ3N0cmluZycgIT0gdHlwZW9mIGEgJiYgcihhKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIUEudGVzdChhKSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGQgPCBlOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSB0aGlzW2RdOyBjICYmIGMgIT09IGI7IGMgPSBjLnBhcmVudE5vZGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMubm9kZVR5cGUgPCAxMSAmJiAoZyA/IGcuaW5kZXgoYykgPiAtMSA6IDEgPT09IGMubm9kZVR5cGUgJiYgci5maW5kLm1hdGNoZXNTZWxlY3RvcihjLCBhKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5wdXNoKGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucHVzaFN0YWNrKGYubGVuZ3RoID4gMSA/IHIudW5pcXVlU29ydChmKSA6IGYpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGluZGV4OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhID8gJ3N0cmluZycgPT0gdHlwZW9mIGEgPyBpLmNhbGwocihhKSwgdGhpc1swXSkgOiBpLmNhbGwodGhpcywgYS5qcXVlcnkgPyBhWzBdIDogYSkgOiB0aGlzWzBdICYmIHRoaXNbMF0ucGFyZW50Tm9kZSA/IHRoaXMuZmlyc3QoKS5wcmV2QWxsKCkubGVuZ3RoIDogLTE7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgYWRkOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnB1c2hTdGFjayhyLnVuaXF1ZVNvcnQoci5tZXJnZSh0aGlzLmdldCgpLCByKGEsIGIpKSkpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGFkZEJhY2s6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYWRkKG51bGwgPT0gYSA/IHRoaXMucHJldk9iamVjdCA6IHRoaXMucHJldk9iamVjdC5maWx0ZXIoYSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgZnVuY3Rpb24gSihhLCBiKSB7CiAgICAgICAgICAgICAgICB3aGlsZSAoKGEgPSBhW2JdKSAmJiAxICE9PSBhLm5vZGVUeXBlKTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHIuZWFjaCh7CiAgICAgICAgICAgICAgICBwYXJlbnQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLnBhcmVudE5vZGU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgJiYgMTEgIT09IGIubm9kZVR5cGUgPyBiIDogbnVsbDsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBwYXJlbnRzOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB5KGEsICdwYXJlbnROb2RlJyk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgcGFyZW50c1VudGlsOiBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB5KGEsICdwYXJlbnROb2RlJywgYyk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgbmV4dDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gSihhLCAnbmV4dFNpYmxpbmcnKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBwcmV2OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBKKGEsICdwcmV2aW91c1NpYmxpbmcnKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBuZXh0QWxsOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB5KGEsICduZXh0U2libGluZycpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHByZXZBbGw6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkoYSwgJ3ByZXZpb3VzU2libGluZycpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIG5leHRVbnRpbDogZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geShhLCAnbmV4dFNpYmxpbmcnLCBjKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBwcmV2VW50aWw6IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHkoYSwgJ3ByZXZpb3VzU2libGluZycsIGMpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHNpYmxpbmdzOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB6KChhLnBhcmVudE5vZGUgfHwge30pLmZpcnN0Q2hpbGQsIGEpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGNoaWxkcmVuOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB6KGEuZmlyc3RDaGlsZCk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgY29udGVudHM6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuY29udGVudERvY3VtZW50IHx8IHIubWVyZ2UoW10sIGEuY2hpbGROb2Rlcyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByLmZuW2FdID0gZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHIubWFwKHRoaXMsIGIsIGMpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAnVW50aWwnICE9PSBhLnNsaWNlKC01KSAmJiAoZCA9IGMpLCBkICYmICdzdHJpbmcnID09IHR5cGVvZiBkICYmIChlID0gci5maWx0ZXIoZCwgZSkpLCB0aGlzLmxlbmd0aCA+IDEgJiYgKElbYV0gfHwgci51bmlxdWVTb3J0KGUpLCBILnRlc3QoYSkgJiYgZS5yZXZlcnNlKCkpLCB0aGlzLnB1c2hTdGFjayhlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgSyA9IC9bXlx4MjBcdFxyXG5cZl0rL2c7CiAgICAgICAgICAgIGZ1bmN0aW9uIEwoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSB7fTsKICAgICAgICAgICAgICAgIHJldHVybiByLmVhY2goYS5tYXRjaChLKSB8fCBbXSwgZnVuY3Rpb24gKGEsIGMpIHsKICAgICAgICAgICAgICAgICAgICBiW2NdID0gITA7CiAgICAgICAgICAgICAgICB9KSwgYjsKICAgICAgICAgICAgfQogICAgICAgICAgICByLkNhbGxiYWNrcyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gJ3N0cmluZycgPT0gdHlwZW9mIGEgPyBMKGEpIDogci5leHRlbmQoe30sIGEpOwogICAgICAgICAgICAgICAgdmFyIGIsIGMsIGQsIGUsIGYgPSBbXSwgZyA9IFtdLCBoID0gLTEsIGkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IGEub25jZSwgZCA9IGIgPSAhMDsgZy5sZW5ndGg7IGggPSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGcuc2hpZnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlICgrK2ggPCBmLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmW2hdLmFwcGx5KGNbMF0sIGNbMV0pID09PSAhMSAmJiBhLnN0b3BPbkZhbHNlICYmIChoID0gZi5sZW5ndGgsIGMgPSAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYS5tZW1vcnkgfHwgKGMgPSAhMSksIGIgPSAhMSwgZSAmJiAoZiA9IGMgPyBbXSA6ICcnKTsKICAgICAgICAgICAgICAgICAgICB9LCBqID0gewogICAgICAgICAgICAgICAgICAgICAgICBhZGQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmICYmIChjICYmICFiICYmIChoID0gZi5sZW5ndGggLSAxLCBnLnB1c2goYykpLCBmdW5jdGlvbiBkKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmVhY2goYiwgZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5pc0Z1bmN0aW9uKGMpID8gYS51bmlxdWUgJiYgai5oYXMoYykgfHwgZi5wdXNoKGMpIDogYyAmJiBjLmxlbmd0aCAmJiAnc3RyaW5nJyAhPT0gci50eXBlKGMpICYmIGQoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KGFyZ3VtZW50cyksIGMgJiYgIWIgJiYgaSgpKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5lYWNoKGFyZ3VtZW50cywgZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoKGMgPSByLmluQXJyYXkoYiwgZiwgYykpID4gLTEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuc3BsaWNlKGMsIDEpLCBjIDw9IGggJiYgaC0tOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGhhczogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhID8gci5pbkFycmF5KGEsIGYpID4gLTEgOiBmLmxlbmd0aCA+IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGVtcHR5OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZiAmJiAoZiA9IFtdKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgZGlzYWJsZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPSBnID0gW10sIGYgPSBjID0gJycsIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRpc2FibGVkOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWY7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGxvY2s6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID0gZyA9IFtdLCBjIHx8IGIgfHwgKGYgPSBjID0gJycpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBsb2NrZWQ6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGZpcmVXaXRoOiBmdW5jdGlvbiAoYSwgYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgfHwgKGMgPSBjIHx8IFtdLCBjID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5zbGljZSA/IGMuc2xpY2UoKSA6IGMKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sIGcucHVzaChjKSwgYiB8fCBpKCkpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBmaXJlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gai5maXJlV2l0aCh0aGlzLCBhcmd1bWVudHMpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBmaXJlZDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhZDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gajsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gTShhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBOKGEpIHsKICAgICAgICAgICAgICAgIHRocm93IGE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gTyhhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZDsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgYSAmJiByLmlzRnVuY3Rpb24oZCA9IGEucHJvbWlzZSkgPyBkLmNhbGwoYSkuZG9uZShiKS5mYWlsKGMpIDogYSAmJiByLmlzRnVuY3Rpb24oZCA9IGEudGhlbikgPyBkLmNhbGwoYSwgYiwgYykgOiBiLmNhbGwodm9pZCAwLCBhKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGEpIHsKICAgICAgICAgICAgICAgICAgICBjLmNhbGwodm9pZCAwLCBhKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBEZWZlcnJlZDogZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbm90aWZ5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncHJvZ3Jlc3MnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuQ2FsbGJhY2tzKCdtZW1vcnknKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLkNhbGxiYWNrcygnbWVtb3J5JyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmVzb2x2ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RvbmUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuQ2FsbGJhY2tzKCdvbmNlIG1lbW9yeScpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuQ2FsbGJhY2tzKCdvbmNlIG1lbW9yeScpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Jlc29sdmVkJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmVqZWN0JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZmFpbCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5DYWxsYmFja3MoJ29uY2UgbWVtb3J5JyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5DYWxsYmFja3MoJ29uY2UgbWVtb3J5JyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmVqZWN0ZWQnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sIGQgPSAncGVuZGluZycsIGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsd2F5czogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmLmRvbmUoYXJndW1lbnRzKS5mYWlsKGFyZ3VtZW50cyksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NhdGNoJzogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZS50aGVuKG51bGwsIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpcGU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGFyZ3VtZW50czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5EZWZlcnJlZChmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmVhY2goYywgZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gci5pc0Z1bmN0aW9uKGFbZFs0XV0pICYmIGFbZFs0XV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmW2RbMV1dKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IGUgJiYgZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgJiYgci5pc0Z1bmN0aW9uKGEucHJvbWlzZSkgPyBhLnByb21pc2UoKS5wcm9ncmVzcyhiLm5vdGlmeSkuZG9uZShiLnJlc29sdmUpLmZhaWwoYi5yZWplY3QpIDogYltkWzBdICsgJ1dpdGgnXSh0aGlzLCBlID8gW2FdIDogYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkucHJvbWlzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZW46IGZ1bmN0aW9uIChiLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGcoYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSB0aGlzLCBpID0gYXJndW1lbnRzLCBqID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSwgajsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoYiA8IGYpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IGQuYXBwbHkoaCwgaSksIGEgPT09IGMucHJvbWlzZSgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1RoZW5hYmxlIHNlbGYtcmVzb2x1dGlvbicpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaiA9IGEgJiYgKCdvYmplY3QnID09IHR5cGVvZiBhIHx8ICdmdW5jdGlvbicgPT0gdHlwZW9mIGEpICYmIGEudGhlbiwgci5pc0Z1bmN0aW9uKGopID8gZSA/IGouY2FsbChhLCBnKGYsIGMsIE0sIGUpLCBnKGYsIGMsIE4sIGUpKSA6IChmKyssIGouY2FsbChhLCBnKGYsIGMsIE0sIGUpLCBnKGYsIGMsIE4sIGUpLCBnKGYsIGMsIE0sIGMubm90aWZ5V2l0aCkpKSA6IChkICE9PSBNICYmIChoID0gdm9pZCAwLCBpID0gW2FdKSwgKGUgfHwgYy5yZXNvbHZlV2l0aCkoaCwgaSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgayA9IGUgPyBqIDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLkRlZmVycmVkLmV4Y2VwdGlvbkhvb2sgJiYgci5EZWZlcnJlZC5leGNlcHRpb25Ib29rKGEsIGsuc3RhY2tUcmFjZSksIGIgKyAxID49IGYgJiYgKGQgIT09IE4gJiYgKGggPSB2b2lkIDAsIGkgPSBbYV0pLCBjLnJlamVjdFdpdGgoaCwgaSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPyBrKCkgOiAoci5EZWZlcnJlZC5nZXRTdGFja0hvb2sgJiYgKGsuc3RhY2tUcmFjZSA9IHIuRGVmZXJyZWQuZ2V0U3RhY2tIb29rKCkpLCBhLnNldFRpbWVvdXQoaykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5EZWZlcnJlZChmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjWzBdWzNdLmFkZChnKDAsIGEsIHIuaXNGdW5jdGlvbihlKSA/IGUgOiBNLCBhLm5vdGlmeVdpdGgpKSwgY1sxXVszXS5hZGQoZygwLCBhLCByLmlzRnVuY3Rpb24oYikgPyBiIDogTSkpLCBjWzJdWzNdLmFkZChnKDAsIGEsIHIuaXNGdW5jdGlvbihkKSA/IGQgOiBOKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkucHJvbWlzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb21pc2U6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gYSA/IHIuZXh0ZW5kKGEsIGUpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSwgZiA9IHt9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiByLmVhY2goYywgZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBiWzJdLCBoID0gYls1XTsKICAgICAgICAgICAgICAgICAgICAgICAgZVtiWzFdXSA9IGcuYWRkLCBoICYmIGcuYWRkKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBoOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBjWzMgLSBhXVsyXS5kaXNhYmxlLCBjWzBdWzJdLmxvY2spLCBnLmFkZChiWzNdLmZpcmUpLCBmW2JbMF1dID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZbYlswXSArICdXaXRoJ10odGhpcyA9PT0gZiA/IHZvaWQgMCA6IHRoaXMsIGFyZ3VtZW50cyksIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGZbYlswXSArICdXaXRoJ10gPSBnLmZpcmVXaXRoOwogICAgICAgICAgICAgICAgICAgIH0pLCBlLnByb21pc2UoZiksIGIgJiYgYi5jYWxsKGYsIGYpLCBmOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHdoZW46IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhcmd1bWVudHMubGVuZ3RoLCBjID0gYiwgZCA9IEFycmF5KGMpLCBlID0gZi5jYWxsKGFyZ3VtZW50cyksIGcgPSByLkRlZmVycmVkKCksIGggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZFthXSA9IHRoaXMsIGVbYV0gPSBhcmd1bWVudHMubGVuZ3RoID4gMSA/IGYuY2FsbChhcmd1bWVudHMpIDogYywgLS1iIHx8IGcucmVzb2x2ZVdpdGgoZCwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGlmIChiIDw9IDEgJiYgKE8oYSwgZy5kb25lKGgoYykpLnJlc29sdmUsIGcucmVqZWN0KSwgJ3BlbmRpbmcnID09PSBnLnN0YXRlKCkgfHwgci5pc0Z1bmN0aW9uKGVbY10gJiYgZVtjXS50aGVuKSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnLnRoZW4oKTsKICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYy0tKQogICAgICAgICAgICAgICAgICAgICAgICBPKGVbY10sIGgoYyksIGcucmVqZWN0KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5wcm9taXNlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgUCA9IC9eKEV2YWx8SW50ZXJuYWx8UmFuZ2V8UmVmZXJlbmNlfFN5bnRheHxUeXBlfFVSSSlFcnJvciQvOwogICAgICAgICAgICByLkRlZmVycmVkLmV4Y2VwdGlvbkhvb2sgPSBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgYS5jb25zb2xlICYmIGEuY29uc29sZS53YXJuICYmIGIgJiYgUC50ZXN0KGIubmFtZSkgJiYgYS5jb25zb2xlLndhcm4oJ2pRdWVyeS5EZWZlcnJlZCBleGNlcHRpb246ICcgKyBiLm1lc3NhZ2UsIGIuc3RhY2ssIGMpOwogICAgICAgICAgICB9LCByLnJlYWR5RXhjZXB0aW9uID0gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgIGEuc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgYjsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUSA9IHIuRGVmZXJyZWQoKTsKICAgICAgICAgICAgci5mbi5yZWFkeSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gUS50aGVuKGEpWydjYXRjaCddKGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgci5yZWFkeUV4Y2VwdGlvbihhKTsKICAgICAgICAgICAgICAgIH0pLCB0aGlzOwogICAgICAgICAgICB9LCByLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBpc1JlYWR5OiAhMSwKICAgICAgICAgICAgICAgIHJlYWR5V2FpdDogMSwKICAgICAgICAgICAgICAgIGhvbGRSZWFkeTogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBhID8gci5yZWFkeVdhaXQrKyA6IHIucmVhZHkoITApOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHJlYWR5OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIChhID09PSAhMCA/IC0tci5yZWFkeVdhaXQgOiByLmlzUmVhZHkpIHx8IChyLmlzUmVhZHkgPSAhMCwgYSAhPT0gITAgJiYgLS1yLnJlYWR5V2FpdCA+IDAgfHwgUS5yZXNvbHZlV2l0aChkLCBbcl0pKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSksIHIucmVhZHkudGhlbiA9IFEudGhlbjsKICAgICAgICAgICAgZnVuY3Rpb24gUigpIHsKICAgICAgICAgICAgICAgIGQucmVtb3ZlRXZlbnRMaXN0ZW5lcignRE9NQ29udGVudExvYWRlZCcsIFIpLCBhLnJlbW92ZUV2ZW50TGlzdGVuZXIoJ2xvYWQnLCBSKSwgci5yZWFkeSgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgICdjb21wbGV0ZScgPT09IGQucmVhZHlTdGF0ZSB8fCAnbG9hZGluZycgIT09IGQucmVhZHlTdGF0ZSAmJiAhZC5kb2N1bWVudEVsZW1lbnQuZG9TY3JvbGwgPyBhLnNldFRpbWVvdXQoci5yZWFkeSkgOiAoZC5hZGRFdmVudExpc3RlbmVyKCdET01Db250ZW50TG9hZGVkJywgUiksIGEuYWRkRXZlbnRMaXN0ZW5lcignbG9hZCcsIFIpKTsKICAgICAgICAgICAgdmFyIFMgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZiwgZykgewogICAgICAgICAgICAgICAgICAgIHZhciBoID0gMCwgaSA9IGEubGVuZ3RoLCBqID0gbnVsbCA9PSBjOwogICAgICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gci50eXBlKGMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChoIGluIGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBTKGEsIGIsIGgsIGNbaF0sICEwLCBmLCBnKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHZvaWQgMCAhPT0gZCAmJiAoZSA9ICEwLCByLmlzRnVuY3Rpb24oZCkgfHwgKGcgPSAhMCksIGogJiYgKGcgPyAoYi5jYWxsKGEsIGQpLCBiID0gbnVsbCkgOiAoaiA9IGIsIGIgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGouY2FsbChyKGEpLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBiKSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGggPCBpOyBoKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKGFbaF0sIGMsIGcgPyBkIDogZC5jYWxsKGFbaF0sIGgsIGIoYVtoXSwgYykpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA/IGEgOiBqID8gYi5jYWxsKGEpIDogaSA/IGIoYVswXSwgYykgOiBmOwogICAgICAgICAgICAgICAgfSwgVCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDEgPT09IGEubm9kZVR5cGUgfHwgOSA9PT0gYS5ub2RlVHlwZSB8fCAhK2Eubm9kZVR5cGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBVKCkgewogICAgICAgICAgICAgICAgdGhpcy5leHBhbmRvID0gci5leHBhbmRvICsgVS51aWQrKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBVLnVpZCA9IDEsIFUucHJvdG90eXBlID0gewogICAgICAgICAgICAgICAgY2FjaGU6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhW3RoaXMuZXhwYW5kb107CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgfHwgKGIgPSB7fSwgVChhKSAmJiAoYS5ub2RlVHlwZSA/IGFbdGhpcy5leHBhbmRvXSA9IGIgOiBPYmplY3QuZGVmaW5lUHJvcGVydHkoYSwgdGhpcy5leHBhbmRvLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBiLAogICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICEwCiAgICAgICAgICAgICAgICAgICAgfSkpKSwgYjsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQsIGUgPSB0aGlzLmNhY2hlKGEpOwogICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgYikKICAgICAgICAgICAgICAgICAgICAgICAgZVtyLmNhbWVsQ2FzZShiKV0gPSBjOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChkIGluIGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlW3IuY2FtZWxDYXNlKGQpXSA9IGJbZF07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGIgPyB0aGlzLmNhY2hlKGEpIDogYVt0aGlzLmV4cGFuZG9dICYmIGFbdGhpcy5leHBhbmRvXVtyLmNhbWVsQ2FzZShiKV07CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgYWNjZXNzOiBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGIgfHwgYiAmJiAnc3RyaW5nJyA9PSB0eXBlb2YgYiAmJiB2b2lkIDAgPT09IGMgPyB0aGlzLmdldChhLCBiKSA6ICh0aGlzLnNldChhLCBiLCBjKSwgdm9pZCAwICE9PSBjID8gYyA6IGIpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHJlbW92ZTogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYywgZCA9IGFbdGhpcy5leHBhbmRvXTsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIuaXNBcnJheShiKSA/IGIgPSBiLm1hcChyLmNhbWVsQ2FzZSkgOiAoYiA9IHIuY2FtZWxDYXNlKGIpLCBiID0gYiBpbiBkID8gW2JdIDogYi5tYXRjaChLKSB8fCBbXSksIGMgPSBiLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChjLS0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGRbYltjXV07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQgMCA9PT0gYiB8fCByLmlzRW1wdHlPYmplY3QoZCkpICYmIChhLm5vZGVUeXBlID8gYVt0aGlzLmV4cGFuZG9dID0gdm9pZCAwIDogZGVsZXRlIGFbdGhpcy5leHBhbmRvXSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGhhc0RhdGE6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhW3RoaXMuZXhwYW5kb107CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gYiAmJiAhci5pc0VtcHR5T2JqZWN0KGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgViA9IG5ldyBVKCksIFcgPSBuZXcgVSgpLCBYID0gL14oPzpce1tcd1xXXSpcfXxcW1tcd1xXXSpcXSkkLywgWSA9IC9bQS1aXS9nOwogICAgICAgICAgICBmdW5jdGlvbiBaKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAndHJ1ZScgPT09IGEgfHwgJ2ZhbHNlJyAhPT0gYSAmJiAoJ251bGwnID09PSBhID8gbnVsbCA6IGEgPT09ICthICsgJycgPyArYSA6IFgudGVzdChhKSA/IEpTT04ucGFyc2UoYSkgOiBhKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiAkKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHZhciBkOwogICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gYyAmJiAxID09PSBhLm5vZGVUeXBlKQogICAgICAgICAgICAgICAgICAgIGlmIChkID0gJ2RhdGEtJyArIGIucmVwbGFjZShZLCAnLSQmJykudG9Mb3dlckNhc2UoKSwgYyA9IGEuZ2V0QXR0cmlidXRlKGQpLCAnc3RyaW5nJyA9PSB0eXBlb2YgYykgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IFooYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBXLnNldChhLCBiLCBjKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IHZvaWQgMDsKICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHIuZXh0ZW5kKHsKICAgICAgICAgICAgICAgIGhhc0RhdGE6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFcuaGFzRGF0YShhKSB8fCBWLmhhc0RhdGEoYSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgZGF0YTogZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gVy5hY2Nlc3MoYSwgYiwgYyk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgcmVtb3ZlRGF0YTogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBXLnJlbW92ZShhLCBiKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBfZGF0YTogZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gVi5hY2Nlc3MoYSwgYiwgYyk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgX3JlbW92ZURhdGE6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgVi5yZW1vdmUoYSwgYik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pLCByLmZuLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBkYXRhOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjLCBkLCBlLCBmID0gdGhpc1swXSwgZyA9IGYgJiYgZi5hdHRyaWJ1dGVzOwogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT09IGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMubGVuZ3RoICYmIChlID0gVy5nZXQoZiksIDEgPT09IGYubm9kZVR5cGUgJiYgIVYuZ2V0KGYsICdoYXNEYXRhQXR0cnMnKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBnLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChjLS0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ1tjXSAmJiAoZCA9IGdbY10ubmFtZSwgMCA9PT0gZC5pbmRleE9mKCdkYXRhLScpICYmIChkID0gci5jYW1lbENhc2UoZC5zbGljZSg1KSksICQoZiwgZCwgZVtkXSkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFYuc2V0KGYsICdoYXNEYXRhQXR0cnMnLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAnb2JqZWN0JyA9PSB0eXBlb2YgYSA/IHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFcuc2V0KHRoaXMsIGEpOwogICAgICAgICAgICAgICAgICAgIH0pIDogUyh0aGlzLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYgJiYgdm9pZCAwID09PSBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9IFcuZ2V0KGYsIGEpLCB2b2lkIDAgIT09IGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA9ICQoZiwgYSksIHZvaWQgMCAhPT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFcuc2V0KHRoaXMsIGEsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgbnVsbCwgYiwgYXJndW1lbnRzLmxlbmd0aCA+IDEsIG51bGwsICEwKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICByZW1vdmVEYXRhOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBXLnJlbW92ZSh0aGlzLCBhKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSksIHIuZXh0ZW5kKHsKICAgICAgICAgICAgICAgIHF1ZXVlOiBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkOwogICAgICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiA9IChiIHx8ICdmeCcpICsgJ3F1ZXVlJywgZCA9IFYuZ2V0KGEsIGIpLCBjICYmICghZCB8fCByLmlzQXJyYXkoYykgPyBkID0gVi5hY2Nlc3MoYSwgYiwgci5tYWtlQXJyYXkoYykpIDogZC5wdXNoKGMpKSwgZCB8fCBbXTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBkZXF1ZXVlOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPSBiIHx8ICdmeCc7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSByLnF1ZXVlKGEsIGIpLCBkID0gYy5sZW5ndGgsIGUgPSBjLnNoaWZ0KCksIGYgPSByLl9xdWV1ZUhvb2tzKGEsIGIpLCBnID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgci5kZXF1ZXVlKGEsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICdpbnByb2dyZXNzJyA9PT0gZSAmJiAoZSA9IGMuc2hpZnQoKSwgZC0tKSwgZSAmJiAoJ2Z4JyA9PT0gYiAmJiBjLnVuc2hpZnQoJ2lucHJvZ3Jlc3MnKSwgZGVsZXRlIGYuc3RvcCwgZS5jYWxsKGEsIGcsIGYpKSwgIWQgJiYgZiAmJiBmLmVtcHR5LmZpcmUoKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBfcXVldWVIb29rczogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGIgKyAncXVldWVIb29rcyc7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFYuZ2V0KGEsIGMpIHx8IFYuYWNjZXNzKGEsIGMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgZW1wdHk6IHIuQ2FsbGJhY2tzKCdvbmNlIG1lbW9yeScpLmFkZChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBWLnJlbW92ZShhLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiArICdxdWV1ZScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pLCByLmZuLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBxdWV1ZTogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IDI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnICE9IHR5cGVvZiBhICYmIChiID0gYSwgYSA9ICdmeCcsIGMtLSksIGFyZ3VtZW50cy5sZW5ndGggPCBjID8gci5xdWV1ZSh0aGlzWzBdLCBhKSA6IHZvaWQgMCA9PT0gYiA/IHRoaXMgOiB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHIucXVldWUodGhpcywgYSwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgIHIuX3F1ZXVlSG9va3ModGhpcywgYSksICdmeCcgPT09IGEgJiYgJ2lucHJvZ3Jlc3MnICE9PSBjWzBdICYmIHIuZGVxdWV1ZSh0aGlzLCBhKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBkZXF1ZXVlOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByLmRlcXVldWUodGhpcywgYSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgY2xlYXJRdWV1ZTogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5xdWV1ZShhIHx8ICdmeCcsIFtdKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBwcm9taXNlOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjLCBkID0gMSwgZSA9IHIuRGVmZXJyZWQoKSwgZiA9IHRoaXMsIGcgPSB0aGlzLmxlbmd0aCwgaCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0tZCB8fCBlLnJlc29sdmVXaXRoKGYsIFtmXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgIT0gdHlwZW9mIGEgJiYgKGIgPSBhLCBhID0gdm9pZCAwKSwgYSA9IGEgfHwgJ2Z4JzsKICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZy0tKQogICAgICAgICAgICAgICAgICAgICAgICBjID0gVi5nZXQoZltnXSwgYSArICdxdWV1ZUhvb2tzJyksIGMgJiYgYy5lbXB0eSAmJiAoZCsrLCBjLmVtcHR5LmFkZChoKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGgoKSwgZS5wcm9taXNlKGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIF8gPSAvWystXT8oPzpcZCpcLnwpXGQrKD86W2VFXVsrLV0/XGQrfCkvLnNvdXJjZSwgYWEgPSBuZXcgUmVnRXhwKCdeKD86KFsrLV0pPXwpKCcgKyBfICsgJykoW2EteiVdKikkJywgJ2knKSwgYmEgPSBbCiAgICAgICAgICAgICAgICAgICAgJ1RvcCcsCiAgICAgICAgICAgICAgICAgICAgJ1JpZ2h0JywKICAgICAgICAgICAgICAgICAgICAnQm90dG9tJywKICAgICAgICAgICAgICAgICAgICAnTGVmdCcKICAgICAgICAgICAgICAgIF0sIGNhID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA9IGIgfHwgYSwgJ25vbmUnID09PSBhLnN0eWxlLmRpc3BsYXkgfHwgJycgPT09IGEuc3R5bGUuZGlzcGxheSAmJiByLmNvbnRhaW5zKGEub3duZXJEb2N1bWVudCwgYSkgJiYgJ25vbmUnID09PSByLmNzcyhhLCAnZGlzcGxheScpOwogICAgICAgICAgICAgICAgfSwgZGEgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlLCBmLCBnID0ge307CiAgICAgICAgICAgICAgICAgICAgZm9yIChmIGluIGIpCiAgICAgICAgICAgICAgICAgICAgICAgIGdbZl0gPSBhLnN0eWxlW2ZdLCBhLnN0eWxlW2ZdID0gYltmXTsKICAgICAgICAgICAgICAgICAgICBlID0gYy5hcHBseShhLCBkIHx8IFtdKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGYgaW4gYikKICAgICAgICAgICAgICAgICAgICAgICAgYS5zdHlsZVtmXSA9IGdbZl07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBlYShhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICB2YXIgZSwgZiA9IDEsIGcgPSAyMCwgaCA9IGQgPyBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkLmN1cigpOwogICAgICAgICAgICAgICAgICAgIH0gOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmNzcyhhLCBiLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgfSwgaSA9IGgoKSwgaiA9IGMgJiYgY1szXSB8fCAoci5jc3NOdW1iZXJbYl0gPyAnJyA6ICdweCcpLCBrID0gKHIuY3NzTnVtYmVyW2JdIHx8ICdweCcgIT09IGogJiYgK2kpICYmIGFhLmV4ZWMoci5jc3MoYSwgYikpOwogICAgICAgICAgICAgICAgaWYgKGsgJiYga1szXSAhPT0gaikgewogICAgICAgICAgICAgICAgICAgIGogPSBqIHx8IGtbM10sIGMgPSBjIHx8IFtdLCBrID0gK2kgfHwgMTsKICAgICAgICAgICAgICAgICAgICBkbwogICAgICAgICAgICAgICAgICAgICAgICBmID0gZiB8fCAnLjUnLCBrIC89IGYsIHIuc3R5bGUoYSwgYiwgayArIGopOwogICAgICAgICAgICAgICAgICAgIHdoaWxlIChmICE9PSAoZiA9IGgoKSAvIGkpICYmIDEgIT09IGYgJiYgLS1nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBjICYmIChrID0gK2sgfHwgK2kgfHwgMCwgZSA9IGNbMV0gPyBrICsgKGNbMV0gKyAxKSAqIGNbMl0gOiArY1syXSwgZCAmJiAoZC51bml0ID0gaiwgZC5zdGFydCA9IGssIGQuZW5kID0gZSkpLCBlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBmYSA9IHt9OwogICAgICAgICAgICBmdW5jdGlvbiBnYShhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiwgYyA9IGEub3duZXJEb2N1bWVudCwgZCA9IGEubm9kZU5hbWUsIGUgPSBmYVtkXTsKICAgICAgICAgICAgICAgIHJldHVybiBlID8gZSA6IChiID0gYy5ib2R5LmFwcGVuZENoaWxkKGMuY3JlYXRlRWxlbWVudChkKSksIGUgPSByLmNzcyhiLCAnZGlzcGxheScpLCBiLnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQoYiksICdub25lJyA9PT0gZSAmJiAoZSA9ICdibG9jaycpLCBmYVtkXSA9IGUsIGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGhhKGEsIGIpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMsIGQsIGUgPSBbXSwgZiA9IDAsIGcgPSBhLmxlbmd0aDsgZiA8IGc7IGYrKykKICAgICAgICAgICAgICAgICAgICBkID0gYVtmXSwgZC5zdHlsZSAmJiAoYyA9IGQuc3R5bGUuZGlzcGxheSwgYiA/ICgnbm9uZScgPT09IGMgJiYgKGVbZl0gPSBWLmdldChkLCAnZGlzcGxheScpIHx8IG51bGwsIGVbZl0gfHwgKGQuc3R5bGUuZGlzcGxheSA9ICcnKSksICcnID09PSBkLnN0eWxlLmRpc3BsYXkgJiYgY2EoZCkgJiYgKGVbZl0gPSBnYShkKSkpIDogJ25vbmUnICE9PSBjICYmIChlW2ZdID0gJ25vbmUnLCBWLnNldChkLCAnZGlzcGxheScsIGMpKSk7CiAgICAgICAgICAgICAgICBmb3IgKGYgPSAwOyBmIDwgZzsgZisrKQogICAgICAgICAgICAgICAgICAgIG51bGwgIT0gZVtmXSAmJiAoYVtmXS5zdHlsZS5kaXNwbGF5ID0gZVtmXSk7CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfQogICAgICAgICAgICByLmZuLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBzaG93OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGhhKHRoaXMsICEwKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoaWRlOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGhhKHRoaXMpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHRvZ2dsZTogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2Jvb2xlYW4nID09IHR5cGVvZiBhID8gYSA/IHRoaXMuc2hvdygpIDogdGhpcy5oaWRlKCkgOiB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBjYSh0aGlzKSA/IHIodGhpcykuc2hvdygpIDogcih0aGlzKS5oaWRlKCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgaWEgPSAvXig/OmNoZWNrYm94fHJhZGlvKSQvaSwgamEgPSAvPChbYS16XVteXC9cMD5ceDIwXHRcclxuXGZdKykvaSwga2EgPSAvXiR8XC8oPzpqYXZhfGVjbWEpc2NyaXB0L2ksIGxhID0gewogICAgICAgICAgICAgICAgICAgIG9wdGlvbjogWwogICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAnPHNlbGVjdCBtdWx0aXBsZT1cJ211bHRpcGxlXCc+JywKICAgICAgICAgICAgICAgICAgICAgICAgJzwvc2VsZWN0PicKICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIHRoZWFkOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICc8dGFibGU+JywKICAgICAgICAgICAgICAgICAgICAgICAgJzwvdGFibGU+JwogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgY29sOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICc8dGFibGU+PGNvbGdyb3VwPicsCiAgICAgICAgICAgICAgICAgICAgICAgICc8L2NvbGdyb3VwPjwvdGFibGU+JwogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgdHI6IFsKICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgJzx0YWJsZT48dGJvZHk+JywKICAgICAgICAgICAgICAgICAgICAgICAgJzwvdGJvZHk+PC90YWJsZT4nCiAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICB0ZDogWwogICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAnPHRhYmxlPjx0Ym9keT48dHI+JywKICAgICAgICAgICAgICAgICAgICAgICAgJzwvdHI+PC90Ym9keT48L3RhYmxlPicKICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIF9kZWZhdWx0OiBbCiAgICAgICAgICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICcnLAogICAgICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIGxhLm9wdGdyb3VwID0gbGEub3B0aW9uLCBsYS50Ym9keSA9IGxhLnRmb290ID0gbGEuY29sZ3JvdXAgPSBsYS5jYXB0aW9uID0gbGEudGhlYWQsIGxhLnRoID0gbGEudGQ7CiAgICAgICAgICAgIGZ1bmN0aW9uIG1hKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjOwogICAgICAgICAgICAgICAgcmV0dXJuIGMgPSAndW5kZWZpbmVkJyAhPSB0eXBlb2YgYS5nZXRFbGVtZW50c0J5VGFnTmFtZSA/IGEuZ2V0RWxlbWVudHNCeVRhZ05hbWUoYiB8fCAnKicpIDogJ3VuZGVmaW5lZCcgIT0gdHlwZW9mIGEucXVlcnlTZWxlY3RvckFsbCA/IGEucXVlcnlTZWxlY3RvckFsbChiIHx8ICcqJykgOiBbXSwgdm9pZCAwID09PSBiIHx8IGIgJiYgci5ub2RlTmFtZShhLCBiKSA/IHIubWVyZ2UoW2FdLCBjKSA6IGM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gbmEoYSwgYikgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IDAsIGQgPSBhLmxlbmd0aDsgYyA8IGQ7IGMrKykKICAgICAgICAgICAgICAgICAgICBWLnNldChhW2NdLCAnZ2xvYmFsRXZhbCcsICFiIHx8IFYuZ2V0KGJbY10sICdnbG9iYWxFdmFsJykpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBvYSA9IC88fCYjP1x3KzsvOwogICAgICAgICAgICBmdW5jdGlvbiBwYShhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBmLCBnLCBoLCBpLCBqLCBrLCBsID0gYi5jcmVhdGVEb2N1bWVudEZyYWdtZW50KCksIG0gPSBbXSwgbiA9IDAsIG8gPSBhLmxlbmd0aDsgbiA8IG87IG4rKykKICAgICAgICAgICAgICAgICAgICBpZiAoZiA9IGFbbl0sIGYgfHwgMCA9PT0gZikKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09PSByLnR5cGUoZikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLm1lcmdlKG0sIGYubm9kZVR5cGUgPyBbZl0gOiBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAob2EudGVzdChmKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGcgfHwgbC5hcHBlbmRDaGlsZChiLmNyZWF0ZUVsZW1lbnQoJ2RpdicpKSwgaCA9IChqYS5leGVjKGYpIHx8IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSlbMV0udG9Mb3dlckNhc2UoKSwgaSA9IGxhW2hdIHx8IGxhLl9kZWZhdWx0LCBnLmlubmVySFRNTCA9IGlbMV0gKyByLmh0bWxQcmVmaWx0ZXIoZikgKyBpWzJdLCBrID0gaVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChrLS0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGcubGFzdENoaWxkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgci5tZXJnZShtLCBnLmNoaWxkTm9kZXMpLCBnID0gbC5maXJzdENoaWxkLCBnLnRleHRDb250ZW50ID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgbS5wdXNoKGIuY3JlYXRlVGV4dE5vZGUoZikpOwogICAgICAgICAgICAgICAgbC50ZXh0Q29udGVudCA9ICcnLCBuID0gMDsKICAgICAgICAgICAgICAgIHdoaWxlIChmID0gbVtuKytdKQogICAgICAgICAgICAgICAgICAgIGlmIChkICYmIHIuaW5BcnJheShmLCBkKSA+IC0xKQogICAgICAgICAgICAgICAgICAgICAgICBlICYmIGUucHVzaChmKTsKICAgICAgICAgICAgICAgICAgICBlbHNlIGlmIChqID0gci5jb250YWlucyhmLm93bmVyRG9jdW1lbnQsIGYpLCBnID0gbWEobC5hcHBlbmRDaGlsZChmKSwgJ3NjcmlwdCcpLCBqICYmIG5hKGcpLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGsgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZiA9IGdbaysrXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGthLnRlc3QoZi50eXBlIHx8ICcnKSAmJiBjLnB1c2goZik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgIWZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gZC5jcmVhdGVEb2N1bWVudEZyYWdtZW50KCksIGIgPSBhLmFwcGVuZENoaWxkKGQuY3JlYXRlRWxlbWVudCgnZGl2JykpLCBjID0gZC5jcmVhdGVFbGVtZW50KCdpbnB1dCcpOwogICAgICAgICAgICAgICAgYy5zZXRBdHRyaWJ1dGUoJ3R5cGUnLCAncmFkaW8nKSwgYy5zZXRBdHRyaWJ1dGUoJ2NoZWNrZWQnLCAnY2hlY2tlZCcpLCBjLnNldEF0dHJpYnV0ZSgnbmFtZScsICd0JyksIGIuYXBwZW5kQ2hpbGQoYyksIG8uY2hlY2tDbG9uZSA9IGIuY2xvbmVOb2RlKCEwKS5jbG9uZU5vZGUoITApLmxhc3RDaGlsZC5jaGVja2VkLCBiLmlubmVySFRNTCA9ICc8dGV4dGFyZWE+eDwvdGV4dGFyZWE+Jywgby5ub0Nsb25lQ2hlY2tlZCA9ICEhYi5jbG9uZU5vZGUoITApLmxhc3RDaGlsZC5kZWZhdWx0VmFsdWU7CiAgICAgICAgICAgIH0oKTsKICAgICAgICAgICAgdmFyIHFhID0gZC5kb2N1bWVudEVsZW1lbnQsIHJhID0gL15rZXkvLCBzYSA9IC9eKD86bW91c2V8cG9pbnRlcnxjb250ZXh0bWVudXxkcmFnfGRyb3ApfGNsaWNrLywgdGEgPSAvXihbXi5dKikoPzpcLiguKyl8KS87CiAgICAgICAgICAgIGZ1bmN0aW9uIHVhKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHZhKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHdhKCkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZC5hY3RpdmVFbGVtZW50OwogICAgICAgICAgICAgICAgfSBjYXRjaCAoYSkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHhhKGEsIGIsIGMsIGQsIGUsIGYpIHsKICAgICAgICAgICAgICAgIHZhciBnLCBoOwogICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09IHR5cGVvZiBiKSB7CiAgICAgICAgICAgICAgICAgICAgJ3N0cmluZycgIT0gdHlwZW9mIGMgJiYgKGQgPSBkIHx8IGMsIGMgPSB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIGZvciAoaCBpbiBiKQogICAgICAgICAgICAgICAgICAgICAgICB4YShhLCBoLCBjLCBkLCBiW2hdLCBmKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChudWxsID09IGQgJiYgbnVsbCA9PSBlID8gKGUgPSBjLCBkID0gYyA9IHZvaWQgMCkgOiBudWxsID09IGUgJiYgKCdzdHJpbmcnID09IHR5cGVvZiBjID8gKGUgPSBkLCBkID0gdm9pZCAwKSA6IChlID0gZCwgZCA9IGMsIGMgPSB2b2lkIDApKSwgZSA9PT0gITEpCiAgICAgICAgICAgICAgICAgICAgZSA9IHZhOwogICAgICAgICAgICAgICAgZWxzZSBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICByZXR1cm4gMSA9PT0gZiAmJiAoZyA9IGUsIGUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiByKCkub2ZmKGEpLCBnLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9LCBlLmd1aWQgPSBnLmd1aWQgfHwgKGcuZ3VpZCA9IHIuZ3VpZCsrKSksIGEuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgci5ldmVudC5hZGQodGhpcywgYiwgZSwgZCwgYyk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfQogICAgICAgICAgICByLmV2ZW50ID0gewogICAgICAgICAgICAgICAgZ2xvYmFsOiB7fSwKICAgICAgICAgICAgICAgIGFkZDogZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZiwgZywgaCwgaSwgaiwgaywgbCwgbSwgbiwgbywgcCwgcSA9IFYuZ2V0KGEpOwogICAgICAgICAgICAgICAgICAgIGlmIChxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuaGFuZGxlciAmJiAoZiA9IGMsIGMgPSBmLmhhbmRsZXIsIGUgPSBmLnNlbGVjdG9yKSwgZSAmJiByLmZpbmQubWF0Y2hlc1NlbGVjdG9yKHFhLCBlKSwgYy5ndWlkIHx8IChjLmd1aWQgPSByLmd1aWQrKyksIChpID0gcS5ldmVudHMpIHx8IChpID0gcS5ldmVudHMgPSB7fSksIChnID0gcS5oYW5kbGUpIHx8IChnID0gcS5oYW5kbGUgPSBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd1bmRlZmluZWQnICE9IHR5cGVvZiByICYmIHIuZXZlbnQudHJpZ2dlcmVkICE9PSBiLnR5cGUgPyByLmV2ZW50LmRpc3BhdGNoLmFwcGx5KGEsIGFyZ3VtZW50cykgOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBiID0gKGIgfHwgJycpLm1hdGNoKEspIHx8IFsnJ10sIGogPSBiLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGotLSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSB0YS5leGVjKGJbal0pIHx8IFtdLCBuID0gcCA9IGhbMV0sIG8gPSAoaFsyXSB8fCAnJykuc3BsaXQoJy4nKS5zb3J0KCksIG4gJiYgKGwgPSByLmV2ZW50LnNwZWNpYWxbbl0gfHwge30sIG4gPSAoZSA/IGwuZGVsZWdhdGVUeXBlIDogbC5iaW5kVHlwZSkgfHwgbiwgbCA9IHIuZXZlbnQuc3BlY2lhbFtuXSB8fCB7fSwgayA9IHIuZXh0ZW5kKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yaWdUeXBlOiBwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IGQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlcjogYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBndWlkOiBjLmd1aWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0b3I6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmVlZHNDb250ZXh0OiBlICYmIHIuZXhwci5tYXRjaC5uZWVkc0NvbnRleHQudGVzdChlKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lc3BhY2U6IG8uam9pbignLicpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBmKSwgKG0gPSBpW25dKSB8fCAobSA9IGlbbl0gPSBbXSwgbS5kZWxlZ2F0ZUNvdW50ID0gMCwgbC5zZXR1cCAmJiBsLnNldHVwLmNhbGwoYSwgZCwgbywgZykgIT09ICExIHx8IGEuYWRkRXZlbnRMaXN0ZW5lciAmJiBhLmFkZEV2ZW50TGlzdGVuZXIobiwgZykpLCBsLmFkZCAmJiAobC5hZGQuY2FsbChhLCBrKSwgay5oYW5kbGVyLmd1aWQgfHwgKGsuaGFuZGxlci5ndWlkID0gYy5ndWlkKSksIGUgPyBtLnNwbGljZShtLmRlbGVnYXRlQ291bnQrKywgMCwgaykgOiBtLnB1c2goayksIHIuZXZlbnQuZ2xvYmFsW25dID0gITApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICByZW1vdmU6IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYsIGcsIGgsIGksIGosIGssIGwsIG0sIG4sIG8sIHAsIHEgPSBWLmhhc0RhdGEoYSkgJiYgVi5nZXQoYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHEgJiYgKGkgPSBxLmV2ZW50cykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IChiIHx8ICcnKS5tYXRjaChLKSB8fCBbJyddLCBqID0gYi5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChqLS0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCA9IHRhLmV4ZWMoYltqXSkgfHwgW10sIG4gPSBwID0gaFsxXSwgbyA9IChoWzJdIHx8ICcnKS5zcGxpdCgnLicpLnNvcnQoKSwgbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSByLmV2ZW50LnNwZWNpYWxbbl0gfHwge30sIG4gPSAoZCA/IGwuZGVsZWdhdGVUeXBlIDogbC5iaW5kVHlwZSkgfHwgbiwgbSA9IGlbbl0gfHwgW10sIGggPSBoWzJdICYmIG5ldyBSZWdFeHAoJyhefFxcLiknICsgby5qb2luKCdcXC4oPzouKlxcLnwpJykgKyAnKFxcLnwkKScpLCBnID0gZiA9IG0ubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChmLS0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsgPSBtW2ZdLCAhZSAmJiBwICE9PSBrLm9yaWdUeXBlIHx8IGMgJiYgYy5ndWlkICE9PSBrLmd1aWQgfHwgaCAmJiAhaC50ZXN0KGsubmFtZXNwYWNlKSB8fCBkICYmIGQgIT09IGsuc2VsZWN0b3IgJiYgKCcqKicgIT09IGQgfHwgIWsuc2VsZWN0b3IpIHx8IChtLnNwbGljZShmLCAxKSwgay5zZWxlY3RvciAmJiBtLmRlbGVnYXRlQ291bnQtLSwgbC5yZW1vdmUgJiYgbC5yZW1vdmUuY2FsbChhLCBrKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyAmJiAhbS5sZW5ndGggJiYgKGwudGVhcmRvd24gJiYgbC50ZWFyZG93bi5jYWxsKGEsIG8sIHEuaGFuZGxlKSAhPT0gITEgfHwgci5yZW1vdmVFdmVudChhLCBuLCBxLmhhbmRsZSksIGRlbGV0ZSBpW25dKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobiBpbiBpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmV2ZW50LnJlbW92ZShhLCBuICsgYltqXSwgYywgZCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICByLmlzRW1wdHlPYmplY3QoaSkgJiYgVi5yZW1vdmUoYSwgJ2hhbmRsZSBldmVudHMnKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgZGlzcGF0Y2g6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSByLmV2ZW50LmZpeChhKSwgYywgZCwgZSwgZiwgZywgaCwgaSA9IG5ldyBBcnJheShhcmd1bWVudHMubGVuZ3RoKSwgaiA9IChWLmdldCh0aGlzLCAnZXZlbnRzJykgfHwge30pW2IudHlwZV0gfHwgW10sIGsgPSByLmV2ZW50LnNwZWNpYWxbYi50eXBlXSB8fCB7fTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGlbMF0gPSBiLCBjID0gMTsgYyA8IGFyZ3VtZW50cy5sZW5ndGg7IGMrKykKICAgICAgICAgICAgICAgICAgICAgICAgaVtjXSA9IGFyZ3VtZW50c1tjXTsKICAgICAgICAgICAgICAgICAgICBpZiAoYi5kZWxlZ2F0ZVRhcmdldCA9IHRoaXMsICFrLnByZURpc3BhdGNoIHx8IGsucHJlRGlzcGF0Y2guY2FsbCh0aGlzLCBiKSAhPT0gITEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaCA9IHIuZXZlbnQuaGFuZGxlcnMuY2FsbCh0aGlzLCBiLCBqKSwgYyA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlICgoZiA9IGhbYysrXSkgJiYgIWIuaXNQcm9wYWdhdGlvblN0b3BwZWQoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5jdXJyZW50VGFyZ2V0ID0gZi5lbGVtLCBkID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlICgoZyA9IGYuaGFuZGxlcnNbZCsrXSkgJiYgIWIuaXNJbW1lZGlhdGVQcm9wYWdhdGlvblN0b3BwZWQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLnJuYW1lc3BhY2UgJiYgIWIucm5hbWVzcGFjZS50ZXN0KGcubmFtZXNwYWNlKSB8fCAoYi5oYW5kbGVPYmogPSBnLCBiLmRhdGEgPSBnLmRhdGEsIGUgPSAoKHIuZXZlbnQuc3BlY2lhbFtnLm9yaWdUeXBlXSB8fCB7fSkuaGFuZGxlIHx8IGcuaGFuZGxlcikuYXBwbHkoZi5lbGVtLCBpKSwgdm9pZCAwICE9PSBlICYmIChiLnJlc3VsdCA9IGUpID09PSAhMSAmJiAoYi5wcmV2ZW50RGVmYXVsdCgpLCBiLnN0b3BQcm9wYWdhdGlvbigpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGsucG9zdERpc3BhdGNoICYmIGsucG9zdERpc3BhdGNoLmNhbGwodGhpcywgYiksIGIucmVzdWx0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoYW5kbGVyczogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYywgZCwgZSwgZiwgZywgaCA9IFtdLCBpID0gYi5kZWxlZ2F0ZUNvdW50LCBqID0gYS50YXJnZXQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKGkgJiYgai5ub2RlVHlwZSAmJiAhKCdjbGljaycgPT09IGEudHlwZSAmJiBhLmJ1dHRvbiA+PSAxKSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGogIT09IHRoaXM7IGogPSBqLnBhcmVudE5vZGUgfHwgdGhpcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxID09PSBqLm5vZGVUeXBlICYmICgnY2xpY2snICE9PSBhLnR5cGUgfHwgai5kaXNhYmxlZCAhPT0gITApKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChmID0gW10sIGcgPSB7fSwgYyA9IDA7IGMgPCBpOyBjKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBiW2NdLCBlID0gZC5zZWxlY3RvciArICcgJywgdm9pZCAwID09PSBnW2VdICYmIChnW2VdID0gZC5uZWVkc0NvbnRleHQgPyByKGUsIHRoaXMpLmluZGV4KGopID4gLTEgOiByLmZpbmQoZSwgdGhpcywgbnVsbCwgW2pdKS5sZW5ndGgpLCBnW2VdICYmIGYucHVzaChkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLmxlbmd0aCAmJiBoLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtOiBqLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVyczogZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBqID0gdGhpcywgaSA8IGIubGVuZ3RoICYmIGgucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW06IGosCiAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZXJzOiBiLnNsaWNlKGkpCiAgICAgICAgICAgICAgICAgICAgfSksIGg7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgYWRkUHJvcDogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoci5FdmVudC5wcm90b3R5cGUsIGEsIHsKICAgICAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogci5pc0Z1bmN0aW9uKGIpID8gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMub3JpZ2luYWxFdmVudCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYih0aGlzLm9yaWdpbmFsRXZlbnQpOwogICAgICAgICAgICAgICAgICAgICAgICB9IDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMub3JpZ2luYWxFdmVudCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5vcmlnaW5hbEV2ZW50W2FdOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgYSwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGZpeDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYVtyLmV4cGFuZG9dID8gYSA6IG5ldyByLkV2ZW50KGEpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHNwZWNpYWw6IHsKICAgICAgICAgICAgICAgICAgICBsb2FkOiB7IG5vQnViYmxlOiAhMCB9LAogICAgICAgICAgICAgICAgICAgIGZvY3VzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyaWdnZXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzICE9PSB3YSgpICYmIHRoaXMuZm9jdXMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZm9jdXMoKSwgITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGVnYXRlVHlwZTogJ2ZvY3VzaW4nCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBibHVyOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyaWdnZXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzID09PSB3YSgpICYmIHRoaXMuYmx1cikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5ibHVyKCksICExOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBkZWxlZ2F0ZVR5cGU6ICdmb2N1c291dCcKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGNsaWNrOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyaWdnZXI6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnY2hlY2tib3gnID09PSB0aGlzLnR5cGUgJiYgdGhpcy5jbGljayAmJiByLm5vZGVOYW1lKHRoaXMsICdpbnB1dCcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsaWNrKCksICExOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBfZGVmYXVsdDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLm5vZGVOYW1lKGEudGFyZ2V0LCAnYScpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBiZWZvcmV1bmxvYWQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgcG9zdERpc3BhdGNoOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBhLnJlc3VsdCAmJiBhLm9yaWdpbmFsRXZlbnQgJiYgKGEub3JpZ2luYWxFdmVudC5yZXR1cm5WYWx1ZSA9IGEucmVzdWx0KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwgci5yZW1vdmVFdmVudCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBhLnJlbW92ZUV2ZW50TGlzdGVuZXIgJiYgYS5yZW1vdmVFdmVudExpc3RlbmVyKGIsIGMpOwogICAgICAgICAgICB9LCByLkV2ZW50ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzIGluc3RhbmNlb2Ygci5FdmVudCA/IChhICYmIGEudHlwZSA/ICh0aGlzLm9yaWdpbmFsRXZlbnQgPSBhLCB0aGlzLnR5cGUgPSBhLnR5cGUsIHRoaXMuaXNEZWZhdWx0UHJldmVudGVkID0gYS5kZWZhdWx0UHJldmVudGVkIHx8IHZvaWQgMCA9PT0gYS5kZWZhdWx0UHJldmVudGVkICYmIGEucmV0dXJuVmFsdWUgPT09ICExID8gdWEgOiB2YSwgdGhpcy50YXJnZXQgPSBhLnRhcmdldCAmJiAzID09PSBhLnRhcmdldC5ub2RlVHlwZSA/IGEudGFyZ2V0LnBhcmVudE5vZGUgOiBhLnRhcmdldCwgdGhpcy5jdXJyZW50VGFyZ2V0ID0gYS5jdXJyZW50VGFyZ2V0LCB0aGlzLnJlbGF0ZWRUYXJnZXQgPSBhLnJlbGF0ZWRUYXJnZXQpIDogdGhpcy50eXBlID0gYSwgYiAmJiByLmV4dGVuZCh0aGlzLCBiKSwgdGhpcy50aW1lU3RhbXAgPSBhICYmIGEudGltZVN0YW1wIHx8IHIubm93KCksIHZvaWQgKHRoaXNbci5leHBhbmRvXSA9ICEwKSkgOiBuZXcgci5FdmVudChhLCBiKTsKICAgICAgICAgICAgfSwgci5FdmVudC5wcm90b3R5cGUgPSB7CiAgICAgICAgICAgICAgICBjb25zdHJ1Y3Rvcjogci5FdmVudCwKICAgICAgICAgICAgICAgIGlzRGVmYXVsdFByZXZlbnRlZDogdmEsCiAgICAgICAgICAgICAgICBpc1Byb3BhZ2F0aW9uU3RvcHBlZDogdmEsCiAgICAgICAgICAgICAgICBpc0ltbWVkaWF0ZVByb3BhZ2F0aW9uU3RvcHBlZDogdmEsCiAgICAgICAgICAgICAgICBpc1NpbXVsYXRlZDogITEsCiAgICAgICAgICAgICAgICBwcmV2ZW50RGVmYXVsdDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5vcmlnaW5hbEV2ZW50OwogICAgICAgICAgICAgICAgICAgIHRoaXMuaXNEZWZhdWx0UHJldmVudGVkID0gdWEsIGEgJiYgIXRoaXMuaXNTaW11bGF0ZWQgJiYgYS5wcmV2ZW50RGVmYXVsdCgpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHN0b3BQcm9wYWdhdGlvbjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5vcmlnaW5hbEV2ZW50OwogICAgICAgICAgICAgICAgICAgIHRoaXMuaXNQcm9wYWdhdGlvblN0b3BwZWQgPSB1YSwgYSAmJiAhdGhpcy5pc1NpbXVsYXRlZCAmJiBhLnN0b3BQcm9wYWdhdGlvbigpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHN0b3BJbW1lZGlhdGVQcm9wYWdhdGlvbjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5vcmlnaW5hbEV2ZW50OwogICAgICAgICAgICAgICAgICAgIHRoaXMuaXNJbW1lZGlhdGVQcm9wYWdhdGlvblN0b3BwZWQgPSB1YSwgYSAmJiAhdGhpcy5pc1NpbXVsYXRlZCAmJiBhLnN0b3BJbW1lZGlhdGVQcm9wYWdhdGlvbigpLCB0aGlzLnN0b3BQcm9wYWdhdGlvbigpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LCByLmVhY2goewogICAgICAgICAgICAgICAgYWx0S2V5OiAhMCwKICAgICAgICAgICAgICAgIGJ1YmJsZXM6ICEwLAogICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogITAsCiAgICAgICAgICAgICAgICBjaGFuZ2VkVG91Y2hlczogITAsCiAgICAgICAgICAgICAgICBjdHJsS2V5OiAhMCwKICAgICAgICAgICAgICAgIGRldGFpbDogITAsCiAgICAgICAgICAgICAgICBldmVudFBoYXNlOiAhMCwKICAgICAgICAgICAgICAgIG1ldGFLZXk6ICEwLAogICAgICAgICAgICAgICAgcGFnZVg6ICEwLAogICAgICAgICAgICAgICAgcGFnZVk6ICEwLAogICAgICAgICAgICAgICAgc2hpZnRLZXk6ICEwLAogICAgICAgICAgICAgICAgdmlldzogITAsCiAgICAgICAgICAgICAgICAnY2hhcic6ICEwLAogICAgICAgICAgICAgICAgY2hhckNvZGU6ICEwLAogICAgICAgICAgICAgICAga2V5OiAhMCwKICAgICAgICAgICAgICAgIGtleUNvZGU6ICEwLAogICAgICAgICAgICAgICAgYnV0dG9uOiAhMCwKICAgICAgICAgICAgICAgIGJ1dHRvbnM6ICEwLAogICAgICAgICAgICAgICAgY2xpZW50WDogITAsCiAgICAgICAgICAgICAgICBjbGllbnRZOiAhMCwKICAgICAgICAgICAgICAgIG9mZnNldFg6ICEwLAogICAgICAgICAgICAgICAgb2Zmc2V0WTogITAsCiAgICAgICAgICAgICAgICBwb2ludGVySWQ6ICEwLAogICAgICAgICAgICAgICAgcG9pbnRlclR5cGU6ICEwLAogICAgICAgICAgICAgICAgc2NyZWVuWDogITAsCiAgICAgICAgICAgICAgICBzY3JlZW5ZOiAhMCwKICAgICAgICAgICAgICAgIHRhcmdldFRvdWNoZXM6ICEwLAogICAgICAgICAgICAgICAgdG9FbGVtZW50OiAhMCwKICAgICAgICAgICAgICAgIHRvdWNoZXM6ICEwLAogICAgICAgICAgICAgICAgd2hpY2g6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLmJ1dHRvbjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBhLndoaWNoICYmIHJhLnRlc3QoYS50eXBlKSA/IG51bGwgIT0gYS5jaGFyQ29kZSA/IGEuY2hhckNvZGUgOiBhLmtleUNvZGUgOiAhYS53aGljaCAmJiB2b2lkIDAgIT09IGIgJiYgc2EudGVzdChhLnR5cGUpID8gMSAmIGIgPyAxIDogMiAmIGIgPyAzIDogNCAmIGIgPyAyIDogMCA6IGEud2hpY2g7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sIHIuZXZlbnQuYWRkUHJvcCksIHIuZWFjaCh7CiAgICAgICAgICAgICAgICBtb3VzZWVudGVyOiAnbW91c2VvdmVyJywKICAgICAgICAgICAgICAgIG1vdXNlbGVhdmU6ICdtb3VzZW91dCcsCiAgICAgICAgICAgICAgICBwb2ludGVyZW50ZXI6ICdwb2ludGVyb3ZlcicsCiAgICAgICAgICAgICAgICBwb2ludGVybGVhdmU6ICdwb2ludGVyb3V0JwogICAgICAgICAgICB9LCBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgci5ldmVudC5zcGVjaWFsW2FdID0gewogICAgICAgICAgICAgICAgICAgIGRlbGVnYXRlVHlwZTogYiwKICAgICAgICAgICAgICAgICAgICBiaW5kVHlwZTogYiwKICAgICAgICAgICAgICAgICAgICBoYW5kbGU6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjLCBkID0gdGhpcywgZSA9IGEucmVsYXRlZFRhcmdldCwgZiA9IGEuaGFuZGxlT2JqOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiAoZSA9PT0gZCB8fCByLmNvbnRhaW5zKGQsIGUpKSB8fCAoYS50eXBlID0gZi5vcmlnVHlwZSwgYyA9IGYuaGFuZGxlci5hcHBseSh0aGlzLCBhcmd1bWVudHMpLCBhLnR5cGUgPSBiKSwgYzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9KSwgci5mbi5leHRlbmQoewogICAgICAgICAgICAgICAgb246IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHhhKHRoaXMsIGEsIGIsIGMsIGQpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIG9uZTogZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geGEodGhpcywgYSwgYiwgYywgZCwgMSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgb2ZmOiBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkLCBlOwogICAgICAgICAgICAgICAgICAgIGlmIChhICYmIGEucHJldmVudERlZmF1bHQgJiYgYS5oYW5kbGVPYmopCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkID0gYS5oYW5kbGVPYmosIHIoYS5kZWxlZ2F0ZVRhcmdldCkub2ZmKGQubmFtZXNwYWNlID8gZC5vcmlnVHlwZSArICcuJyArIGQubmFtZXNwYWNlIDogZC5vcmlnVHlwZSwgZC5zZWxlY3RvciwgZC5oYW5kbGVyKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT0gdHlwZW9mIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlIGluIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm9mZihlLCBiLCBhW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBiICE9PSAhMSAmJiAnZnVuY3Rpb24nICE9IHR5cGVvZiBiIHx8IChjID0gYiwgYiA9IHZvaWQgMCksIGMgPT09ICExICYmIChjID0gdmEpLCB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByLmV2ZW50LnJlbW92ZSh0aGlzLCBhLCBjLCBiKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciB5YSA9IC88KD8hYXJlYXxicnxjb2x8ZW1iZWR8aHJ8aW1nfGlucHV0fGxpbmt8bWV0YXxwYXJhbSkoKFthLXpdW15cL1wwPlx4MjBcdFxyXG5cZl0qKVtePl0qKVwvPi9naSwgemEgPSAvPHNjcmlwdHw8c3R5bGV8PGxpbmsvaSwgQWEgPSAvY2hlY2tlZFxzKig/OltePV18PVxzKi5jaGVja2VkLikvaSwgQmEgPSAvXnRydWVcLyguKikvLCBDYSA9IC9eXHMqPCEoPzpcW0NEQVRBXFt8LS0pfCg/OlxdXF18LS0pPlxzKiQvZzsKICAgICAgICAgICAgZnVuY3Rpb24gRGEoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIHIubm9kZU5hbWUoYSwgJ3RhYmxlJykgJiYgci5ub2RlTmFtZSgxMSAhPT0gYi5ub2RlVHlwZSA/IGIgOiBiLmZpcnN0Q2hpbGQsICd0cicpID8gYS5nZXRFbGVtZW50c0J5VGFnTmFtZSgndGJvZHknKVswXSB8fCBhIDogYTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBFYShhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYS50eXBlID0gKG51bGwgIT09IGEuZ2V0QXR0cmlidXRlKCd0eXBlJykpICsgJy8nICsgYS50eXBlLCBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEZhKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gQmEuZXhlYyhhLnR5cGUpOwogICAgICAgICAgICAgICAgcmV0dXJuIGIgPyBhLnR5cGUgPSBiWzFdIDogYS5yZW1vdmVBdHRyaWJ1dGUoJ3R5cGUnKSwgYTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBHYShhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYywgZCwgZSwgZiwgZywgaCwgaSwgajsKICAgICAgICAgICAgICAgIGlmICgxID09PSBiLm5vZGVUeXBlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKFYuaGFzRGF0YShhKSAmJiAoZiA9IFYuYWNjZXNzKGEpLCBnID0gVi5zZXQoYiwgZiksIGogPSBmLmV2ZW50cykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGcuaGFuZGxlLCBnLmV2ZW50cyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgaW4gaikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYyA9IDAsIGQgPSBqW2VdLmxlbmd0aDsgYyA8IGQ7IGMrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLmV2ZW50LmFkZChiLCBlLCBqW2VdW2NdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgVy5oYXNEYXRhKGEpICYmIChoID0gVy5hY2Nlc3MoYSksIGkgPSByLmV4dGVuZCh7fSwgaCksIFcuc2V0KGIsIGkpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBIYShhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IGIubm9kZU5hbWUudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICdpbnB1dCcgPT09IGMgJiYgaWEudGVzdChhLnR5cGUpID8gYi5jaGVja2VkID0gYS5jaGVja2VkIDogJ2lucHV0JyAhPT0gYyAmJiAndGV4dGFyZWEnICE9PSBjIHx8IChiLmRlZmF1bHRWYWx1ZSA9IGEuZGVmYXVsdFZhbHVlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBJYShhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBiID0gZy5hcHBseShbXSwgYik7CiAgICAgICAgICAgICAgICB2YXIgZSwgZiwgaCwgaSwgaiwgaywgbCA9IDAsIG0gPSBhLmxlbmd0aCwgbiA9IG0gLSAxLCBxID0gYlswXSwgcyA9IHIuaXNGdW5jdGlvbihxKTsKICAgICAgICAgICAgICAgIGlmIChzIHx8IG0gPiAxICYmICdzdHJpbmcnID09IHR5cGVvZiBxICYmICFvLmNoZWNrQ2xvbmUgJiYgQWEudGVzdChxKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5lYWNoKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gYS5lcShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgcyAmJiAoYlswXSA9IHEuY2FsbCh0aGlzLCBlLCBmLmh0bWwoKSkpLCBJYShmLCBiLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGlmIChtICYmIChlID0gcGEoYiwgYVswXS5vd25lckRvY3VtZW50LCAhMSwgYSwgZCksIGYgPSBlLmZpcnN0Q2hpbGQsIDEgPT09IGUuY2hpbGROb2Rlcy5sZW5ndGggJiYgKGUgPSBmKSwgZiB8fCBkKSkgewogICAgICAgICAgICAgICAgICAgIGZvciAoaCA9IHIubWFwKG1hKGUsICdzY3JpcHQnKSwgRWEpLCBpID0gaC5sZW5ndGg7IGwgPCBtOyBsKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGogPSBlLCBsICE9PSBuICYmIChqID0gci5jbG9uZShqLCAhMCwgITApLCBpICYmIHIubWVyZ2UoaCwgbWEoaiwgJ3NjcmlwdCcpKSksIGMuY2FsbChhW2xdLCBqLCBsKTsKICAgICAgICAgICAgICAgICAgICBpZiAoaSkKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChrID0gaFtoLmxlbmd0aCAtIDFdLm93bmVyRG9jdW1lbnQsIHIubWFwKGgsIEZhKSwgbCA9IDA7IGwgPCBpOyBsKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqID0gaFtsXSwga2EudGVzdChqLnR5cGUgfHwgJycpICYmICFWLmFjY2VzcyhqLCAnZ2xvYmFsRXZhbCcpICYmIHIuY29udGFpbnMoaywgaikgJiYgKGouc3JjID8gci5fZXZhbFVybCAmJiByLl9ldmFsVXJsKGouc3JjKSA6IHAoai50ZXh0Q29udGVudC5yZXBsYWNlKENhLCAnJyksIGspKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEphKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGQsIGUgPSBiID8gci5maWx0ZXIoYiwgYSkgOiBhLCBmID0gMDsgbnVsbCAhPSAoZCA9IGVbZl0pOyBmKyspCiAgICAgICAgICAgICAgICAgICAgYyB8fCAxICE9PSBkLm5vZGVUeXBlIHx8IHIuY2xlYW5EYXRhKG1hKGQpKSwgZC5wYXJlbnROb2RlICYmIChjICYmIHIuY29udGFpbnMoZC5vd25lckRvY3VtZW50LCBkKSAmJiBuYShtYShkLCAnc2NyaXB0JykpLCBkLnBhcmVudE5vZGUucmVtb3ZlQ2hpbGQoZCkpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgci5leHRlbmQoewogICAgICAgICAgICAgICAgaHRtbFByZWZpbHRlcjogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5yZXBsYWNlKHlhLCAnPCQxPjwvJDI+Jyk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgY2xvbmU6IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQsIGUsIGYsIGcsIGggPSBhLmNsb25lTm9kZSghMCksIGkgPSByLmNvbnRhaW5zKGEub3duZXJEb2N1bWVudCwgYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCEoby5ub0Nsb25lQ2hlY2tlZCB8fCAxICE9PSBhLm5vZGVUeXBlICYmIDExICE9PSBhLm5vZGVUeXBlIHx8IHIuaXNYTUxEb2MoYSkpKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGcgPSBtYShoKSwgZiA9IG1hKGEpLCBkID0gMCwgZSA9IGYubGVuZ3RoOyBkIDwgZTsgZCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgSGEoZltkXSwgZ1tkXSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGIpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChmID0gZiB8fCBtYShhKSwgZyA9IGcgfHwgbWEoaCksIGQgPSAwLCBlID0gZi5sZW5ndGg7IGQgPCBlOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgR2EoZltkXSwgZ1tkXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdhKGEsIGgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBnID0gbWEoaCwgJ3NjcmlwdCcpLCBnLmxlbmd0aCA+IDAgJiYgbmEoZywgIWkgJiYgbWEoYSwgJ3NjcmlwdCcpKSwgaDsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBjbGVhbkRhdGE6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiwgYywgZCwgZSA9IHIuZXZlbnQuc3BlY2lhbCwgZiA9IDA7IHZvaWQgMCAhPT0gKGMgPSBhW2ZdKTsgZisrKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoVChjKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIgPSBjW1YuZXhwYW5kb10pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYi5ldmVudHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZCBpbiBiLmV2ZW50cykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbZF0gPyByLmV2ZW50LnJlbW92ZShjLCBkKSA6IHIucmVtb3ZlRXZlbnQoYywgZCwgYi5oYW5kbGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNbVi5leHBhbmRvXSA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNbVy5leHBhbmRvXSAmJiAoY1tXLmV4cGFuZG9dID0gdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSwgci5mbi5leHRlbmQoewogICAgICAgICAgICAgICAgZGV0YWNoOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBKYSh0aGlzLCBhLCAhMCk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgcmVtb3ZlOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBKYSh0aGlzLCBhKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB0ZXh0OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBTKHRoaXMsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgPT09IGEgPyByLnRleHQodGhpcykgOiB0aGlzLmVtcHR5KCkuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxICE9PSB0aGlzLm5vZGVUeXBlICYmIDExICE9PSB0aGlzLm5vZGVUeXBlICYmIDkgIT09IHRoaXMubm9kZVR5cGUgfHwgKHRoaXMudGV4dENvbnRlbnQgPSBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwgbnVsbCwgYSwgYXJndW1lbnRzLmxlbmd0aCk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgYXBwZW5kOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElhKHRoaXMsIGFyZ3VtZW50cywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT09IHRoaXMubm9kZVR5cGUgfHwgMTEgPT09IHRoaXMubm9kZVR5cGUgfHwgOSA9PT0gdGhpcy5ub2RlVHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBEYSh0aGlzLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuYXBwZW5kQ2hpbGQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBwcmVwZW5kOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElhKHRoaXMsIGFyZ3VtZW50cywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT09IHRoaXMubm9kZVR5cGUgfHwgMTEgPT09IHRoaXMubm9kZVR5cGUgfHwgOSA9PT0gdGhpcy5ub2RlVHlwZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBEYSh0aGlzLCBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuaW5zZXJ0QmVmb3JlKGEsIGIuZmlyc3RDaGlsZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBiZWZvcmU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gSWEodGhpcywgYXJndW1lbnRzLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnBhcmVudE5vZGUgJiYgdGhpcy5wYXJlbnROb2RlLmluc2VydEJlZm9yZShhLCB0aGlzKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBhZnRlcjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBJYSh0aGlzLCBhcmd1bWVudHMsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucGFyZW50Tm9kZSAmJiB0aGlzLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKGEsIHRoaXMubmV4dFNpYmxpbmcpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGVtcHR5OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSwgYiA9IDA7IG51bGwgIT0gKGEgPSB0aGlzW2JdKTsgYisrKQogICAgICAgICAgICAgICAgICAgICAgICAxID09PSBhLm5vZGVUeXBlICYmIChyLmNsZWFuRGF0YShtYShhLCAhMSkpLCBhLnRleHRDb250ZW50ID0gJycpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGNsb25lOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhID0gbnVsbCAhPSBhICYmIGEsIGIgPSBudWxsID09IGIgPyBhIDogYiwgdGhpcy5tYXAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5jbG9uZSh0aGlzLCBhLCBiKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBodG1sOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBTKHRoaXMsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gdGhpc1swXSB8fCB7fSwgYyA9IDAsIGQgPSB0aGlzLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gYSAmJiAxID09PSBiLm5vZGVUeXBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIuaW5uZXJIVE1MOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT0gdHlwZW9mIGEgJiYgIXphLnRlc3QoYSkgJiYgIWxhWyhqYS5leGVjKGEpIHx8IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSlbMV0udG9Mb3dlckNhc2UoKV0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSByLmh0bWxQcmVmaWx0ZXIoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoOyBjIDwgZDsgYysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gdGhpc1tjXSB8fCB7fSwgMSA9PT0gYi5ub2RlVHlwZSAmJiAoci5jbGVhbkRhdGEobWEoYiwgITEpKSwgYi5pbm5lckhUTUwgPSBhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBiICYmIHRoaXMuZW1wdHkoKS5hcHBlbmQoYSk7CiAgICAgICAgICAgICAgICAgICAgfSwgbnVsbCwgYSwgYXJndW1lbnRzLmxlbmd0aCk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgcmVwbGFjZVdpdGg6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFtdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBJYSh0aGlzLCBhcmd1bWVudHMsIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gdGhpcy5wYXJlbnROb2RlOwogICAgICAgICAgICAgICAgICAgICAgICByLmluQXJyYXkodGhpcywgYSkgPCAwICYmIChyLmNsZWFuRGF0YShtYSh0aGlzKSksIGMgJiYgYy5yZXBsYWNlQ2hpbGQoYiwgdGhpcykpOwogICAgICAgICAgICAgICAgICAgIH0sIGEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSwgci5lYWNoKHsKICAgICAgICAgICAgICAgIGFwcGVuZFRvOiAnYXBwZW5kJywKICAgICAgICAgICAgICAgIHByZXBlbmRUbzogJ3ByZXBlbmQnLAogICAgICAgICAgICAgICAgaW5zZXJ0QmVmb3JlOiAnYmVmb3JlJywKICAgICAgICAgICAgICAgIGluc2VydEFmdGVyOiAnYWZ0ZXInLAogICAgICAgICAgICAgICAgcmVwbGFjZUFsbDogJ3JlcGxhY2VXaXRoJwogICAgICAgICAgICB9LCBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgci5mblthXSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYywgZCA9IFtdLCBlID0gcihhKSwgZiA9IGUubGVuZ3RoIC0gMSwgZyA9IDA7IGcgPD0gZjsgZysrKQogICAgICAgICAgICAgICAgICAgICAgICBjID0gZyA9PT0gZiA/IHRoaXMgOiB0aGlzLmNsb25lKCEwKSwgcihlW2ddKVtiXShjKSwgaC5hcHBseShkLCBjLmdldCgpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5wdXNoU3RhY2soZCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIEthID0gL15tYXJnaW4vLCBMYSA9IG5ldyBSZWdFeHAoJ14oJyArIF8gKyAnKSg/IXB4KVthLXolXSskJywgJ2knKSwgTWEgPSBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYi5vd25lckRvY3VtZW50LmRlZmF1bHRWaWV3OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjICYmIGMub3BlbmVyIHx8IChjID0gYSksIGMuZ2V0Q29tcHV0ZWRTdHlsZShiKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICFmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKCkgewogICAgICAgICAgICAgICAgICAgIGlmIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGkuc3R5bGUuY3NzVGV4dCA9ICdib3gtc2l6aW5nOmJvcmRlci1ib3g7cG9zaXRpb246cmVsYXRpdmU7ZGlzcGxheTpibG9jazttYXJnaW46YXV0bztib3JkZXI6MXB4O3BhZGRpbmc6MXB4O3RvcDoxJTt3aWR0aDo1MCUnLCBpLmlubmVySFRNTCA9ICcnLCBxYS5hcHBlbmRDaGlsZChoKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLmdldENvbXB1dGVkU3R5bGUoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAnMSUnICE9PSBiLnRvcCwgZyA9ICcycHgnID09PSBiLm1hcmdpbkxlZnQsIGUgPSAnNHB4JyA9PT0gYi53aWR0aCwgaS5zdHlsZS5tYXJnaW5SaWdodCA9ICc1MCUnLCBmID0gJzRweCcgPT09IGIubWFyZ2luUmlnaHQsIHFhLnJlbW92ZUNoaWxkKGgpLCBpID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgYywgZSwgZiwgZywgaCA9IGQuY3JlYXRlRWxlbWVudCgnZGl2JyksIGkgPSBkLmNyZWF0ZUVsZW1lbnQoJ2RpdicpOwogICAgICAgICAgICAgICAgaS5zdHlsZSAmJiAoaS5zdHlsZS5iYWNrZ3JvdW5kQ2xpcCA9ICdjb250ZW50LWJveCcsIGkuY2xvbmVOb2RlKCEwKS5zdHlsZS5iYWNrZ3JvdW5kQ2xpcCA9ICcnLCBvLmNsZWFyQ2xvbmVTdHlsZSA9ICdjb250ZW50LWJveCcgPT09IGkuc3R5bGUuYmFja2dyb3VuZENsaXAsIGguc3R5bGUuY3NzVGV4dCA9ICdib3JkZXI6MDt3aWR0aDo4cHg7aGVpZ2h0OjA7dG9wOjA7bGVmdDotOTk5OXB4O3BhZGRpbmc6MDttYXJnaW4tdG9wOjFweDtwb3NpdGlvbjphYnNvbHV0ZScsIGguYXBwZW5kQ2hpbGQoaSksIHIuZXh0ZW5kKG8sIHsKICAgICAgICAgICAgICAgICAgICBwaXhlbFBvc2l0aW9uOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKCksIGM7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBib3hTaXppbmdSZWxpYWJsZTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYigpLCBlOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcGl4ZWxNYXJnaW5SaWdodDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYigpLCBmOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgcmVsaWFibGVNYXJnaW5MZWZ0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKCksIGc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICB9KCk7CiAgICAgICAgICAgIGZ1bmN0aW9uIE5hKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHZhciBkLCBlLCBmLCBnLCBoID0gYS5zdHlsZTsKICAgICAgICAgICAgICAgIHJldHVybiBjID0gYyB8fCBNYShhKSwgYyAmJiAoZyA9IGMuZ2V0UHJvcGVydHlWYWx1ZShiKSB8fCBjW2JdLCAnJyAhPT0gZyB8fCByLmNvbnRhaW5zKGEub3duZXJEb2N1bWVudCwgYSkgfHwgKGcgPSByLnN0eWxlKGEsIGIpKSwgIW8ucGl4ZWxNYXJnaW5SaWdodCgpICYmIExhLnRlc3QoZykgJiYgS2EudGVzdChiKSAmJiAoZCA9IGgud2lkdGgsIGUgPSBoLm1pbldpZHRoLCBmID0gaC5tYXhXaWR0aCwgaC5taW5XaWR0aCA9IGgubWF4V2lkdGggPSBoLndpZHRoID0gZywgZyA9IGMud2lkdGgsIGgud2lkdGggPSBkLCBoLm1pbldpZHRoID0gZSwgaC5tYXhXaWR0aCA9IGYpKSwgdm9pZCAwICE9PSBnID8gZyArICcnIDogZzsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBPYShhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSgpID8gdm9pZCBkZWxldGUgdGhpcy5nZXQgOiAodGhpcy5nZXQgPSBiKS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIFBhID0gL14obm9uZXx0YWJsZSg/IS1jW2VhXSkuKykvLCBRYSA9IHsKICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbjogJ2Fic29sdXRlJywKICAgICAgICAgICAgICAgICAgICB2aXNpYmlsaXR5OiAnaGlkZGVuJywKICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnYmxvY2snCiAgICAgICAgICAgICAgICB9LCBSYSA9IHsKICAgICAgICAgICAgICAgICAgICBsZXR0ZXJTcGFjaW5nOiAnMCcsCiAgICAgICAgICAgICAgICAgICAgZm9udFdlaWdodDogJzQwMCcKICAgICAgICAgICAgICAgIH0sIFNhID0gWwogICAgICAgICAgICAgICAgICAgICdXZWJraXQnLAogICAgICAgICAgICAgICAgICAgICdNb3onLAogICAgICAgICAgICAgICAgICAgICdtcycKICAgICAgICAgICAgICAgIF0sIFRhID0gZC5jcmVhdGVFbGVtZW50KCdkaXYnKS5zdHlsZTsKICAgICAgICAgICAgZnVuY3Rpb24gVWEoYSkgewogICAgICAgICAgICAgICAgaWYgKGEgaW4gVGEpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGFbMF0udG9VcHBlckNhc2UoKSArIGEuc2xpY2UoMSksIGMgPSBTYS5sZW5ndGg7CiAgICAgICAgICAgICAgICB3aGlsZSAoYy0tKQogICAgICAgICAgICAgICAgICAgIGlmIChhID0gU2FbY10gKyBiLCBhIGluIFRhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBWYShhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZCA9IGFhLmV4ZWMoYik7CiAgICAgICAgICAgICAgICByZXR1cm4gZCA/IE1hdGgubWF4KDAsIGRbMl0gLSAoYyB8fCAwKSkgKyAoZFszXSB8fCAncHgnKSA6IGI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gV2EoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgdmFyIGYsIGcgPSAwOwogICAgICAgICAgICAgICAgZm9yIChmID0gYyA9PT0gKGQgPyAnYm9yZGVyJyA6ICdjb250ZW50JykgPyA0IDogJ3dpZHRoJyA9PT0gYiA/IDEgOiAwOyBmIDwgNDsgZiArPSAyKQogICAgICAgICAgICAgICAgICAgICdtYXJnaW4nID09PSBjICYmIChnICs9IHIuY3NzKGEsIGMgKyBiYVtmXSwgITAsIGUpKSwgZCA/ICgnY29udGVudCcgPT09IGMgJiYgKGcgLT0gci5jc3MoYSwgJ3BhZGRpbmcnICsgYmFbZl0sICEwLCBlKSksICdtYXJnaW4nICE9PSBjICYmIChnIC09IHIuY3NzKGEsICdib3JkZXInICsgYmFbZl0gKyAnV2lkdGgnLCAhMCwgZSkpKSA6IChnICs9IHIuY3NzKGEsICdwYWRkaW5nJyArIGJhW2ZdLCAhMCwgZSksICdwYWRkaW5nJyAhPT0gYyAmJiAoZyArPSByLmNzcyhhLCAnYm9yZGVyJyArIGJhW2ZdICsgJ1dpZHRoJywgITAsIGUpKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZzsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBYYShhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZCwgZSA9ICEwLCBmID0gTWEoYSksIGcgPSAnYm9yZGVyLWJveCcgPT09IHIuY3NzKGEsICdib3hTaXppbmcnLCAhMSwgZik7CiAgICAgICAgICAgICAgICBpZiAoYS5nZXRDbGllbnRSZWN0cygpLmxlbmd0aCAmJiAoZCA9IGEuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KClbYl0pLCBkIDw9IDAgfHwgbnVsbCA9PSBkKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGQgPSBOYShhLCBiLCBmKSwgKGQgPCAwIHx8IG51bGwgPT0gZCkgJiYgKGQgPSBhLnN0eWxlW2JdKSwgTGEudGVzdChkKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgZSA9IGcgJiYgKG8uYm94U2l6aW5nUmVsaWFibGUoKSB8fCBkID09PSBhLnN0eWxlW2JdKSwgZCA9IHBhcnNlRmxvYXQoZCkgfHwgMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBkICsgV2EoYSwgYiwgYyB8fCAoZyA/ICdib3JkZXInIDogJ2NvbnRlbnQnKSwgZSwgZikgKyAncHgnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHIuZXh0ZW5kKHsKICAgICAgICAgICAgICAgIGNzc0hvb2tzOiB7CiAgICAgICAgICAgICAgICAgICAgb3BhY2l0eTogewogICAgICAgICAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gTmEoYSwgJ29wYWNpdHknKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJycgPT09IGMgPyAnMScgOiBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGNzc051bWJlcjogewogICAgICAgICAgICAgICAgICAgIGFuaW1hdGlvbkl0ZXJhdGlvbkNvdW50OiAhMCwKICAgICAgICAgICAgICAgICAgICBjb2x1bW5Db3VudDogITAsCiAgICAgICAgICAgICAgICAgICAgZmlsbE9wYWNpdHk6ICEwLAogICAgICAgICAgICAgICAgICAgIGZsZXhHcm93OiAhMCwKICAgICAgICAgICAgICAgICAgICBmbGV4U2hyaW5rOiAhMCwKICAgICAgICAgICAgICAgICAgICBmb250V2VpZ2h0OiAhMCwKICAgICAgICAgICAgICAgICAgICBsaW5lSGVpZ2h0OiAhMCwKICAgICAgICAgICAgICAgICAgICBvcGFjaXR5OiAhMCwKICAgICAgICAgICAgICAgICAgICBvcmRlcjogITAsCiAgICAgICAgICAgICAgICAgICAgb3JwaGFuczogITAsCiAgICAgICAgICAgICAgICAgICAgd2lkb3dzOiAhMCwKICAgICAgICAgICAgICAgICAgICB6SW5kZXg6ICEwLAogICAgICAgICAgICAgICAgICAgIHpvb206ICEwCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgY3NzUHJvcHM6IHsgJ2Zsb2F0JzogJ2Nzc0Zsb2F0JyB9LAogICAgICAgICAgICAgICAgc3R5bGU6IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEgJiYgMyAhPT0gYS5ub2RlVHlwZSAmJiA4ICE9PSBhLm5vZGVUeXBlICYmIGEuc3R5bGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUsIGYsIGcsIGggPSByLmNhbWVsQ2FzZShiKSwgaSA9IGEuc3R5bGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiID0gci5jc3NQcm9wc1toXSB8fCAoci5jc3NQcm9wc1toXSA9IFVhKGgpIHx8IGgpLCBnID0gci5jc3NIb29rc1tiXSB8fCByLmNzc0hvb2tzW2hdLCB2b2lkIDAgPT09IGMgPyBnICYmICdnZXQnIGluIGcgJiYgdm9pZCAwICE9PSAoZSA9IGcuZ2V0KGEsICExLCBkKSkgPyBlIDogaVtiXSA6IChmID0gdHlwZW9mIGMsICdzdHJpbmcnID09PSBmICYmIChlID0gYWEuZXhlYyhjKSkgJiYgZVsxXSAmJiAoYyA9IGVhKGEsIGIsIGUpLCBmID0gJ251bWJlcicpLCBudWxsICE9IGMgJiYgYyA9PT0gYyAmJiAoJ251bWJlcicgPT09IGYgJiYgKGMgKz0gZSAmJiBlWzNdIHx8IChyLmNzc051bWJlcltoXSA/ICcnIDogJ3B4JykpLCBvLmNsZWFyQ2xvbmVTdHlsZSB8fCAnJyAhPT0gYyB8fCAwICE9PSBiLmluZGV4T2YoJ2JhY2tncm91bmQnKSB8fCAoaVtiXSA9ICdpbmhlcml0JyksIGcgJiYgJ3NldCcgaW4gZyAmJiB2b2lkIDAgPT09IChjID0gZy5zZXQoYSwgYywgZCkpIHx8IChpW2JdID0gYykpLCB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBjc3M6IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIGYsIGcsIGggPSByLmNhbWVsQ2FzZShiKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiA9IHIuY3NzUHJvcHNbaF0gfHwgKHIuY3NzUHJvcHNbaF0gPSBVYShoKSB8fCBoKSwgZyA9IHIuY3NzSG9va3NbYl0gfHwgci5jc3NIb29rc1toXSwgZyAmJiAnZ2V0JyBpbiBnICYmIChlID0gZy5nZXQoYSwgITAsIGMpKSwgdm9pZCAwID09PSBlICYmIChlID0gTmEoYSwgYiwgZCkpLCAnbm9ybWFsJyA9PT0gZSAmJiBiIGluIFJhICYmIChlID0gUmFbYl0pLCAnJyA9PT0gYyB8fCBjID8gKGYgPSBwYXJzZUZsb2F0KGUpLCBjID09PSAhMCB8fCBpc0Zpbml0ZShmKSA/IGYgfHwgMCA6IGUpIDogZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSksIHIuZWFjaChbCiAgICAgICAgICAgICAgICAnaGVpZ2h0JywKICAgICAgICAgICAgICAgICd3aWR0aCcKICAgICAgICAgICAgXSwgZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHIuY3NzSG9va3NbYl0gPSB7CiAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoYSwgYywgZCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhUGEudGVzdChyLmNzcyhhLCAnZGlzcGxheScpKSB8fCBhLmdldENsaWVudFJlY3RzKCkubGVuZ3RoICYmIGEuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCkud2lkdGggPyBYYShhLCBiLCBkKSA6IGRhKGEsIFFhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFhhKGEsIGIsIGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChhLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlLCBmID0gZCAmJiBNYShhKSwgZyA9IGQgJiYgV2EoYSwgYiwgZCwgJ2JvcmRlci1ib3gnID09PSByLmNzcyhhLCAnYm94U2l6aW5nJywgITEsIGYpLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcgJiYgKGUgPSBhYS5leGVjKGMpKSAmJiAncHgnICE9PSAoZVszXSB8fCAncHgnKSAmJiAoYS5zdHlsZVtiXSA9IGMsIGMgPSByLmNzcyhhLCBiKSksIFZhKGEsIGMsIGcpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0pLCByLmNzc0hvb2tzLm1hcmdpbkxlZnQgPSBPYShvLnJlbGlhYmxlTWFyZ2luTGVmdCwgZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGlmIChiKQogICAgICAgICAgICAgICAgICAgIHJldHVybiAocGFyc2VGbG9hdChOYShhLCAnbWFyZ2luTGVmdCcpKSB8fCBhLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLmxlZnQgLSBkYShhLCB7IG1hcmdpbkxlZnQ6IDAgfSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKS5sZWZ0OwogICAgICAgICAgICAgICAgICAgIH0pKSArICdweCc7CiAgICAgICAgICAgIH0pLCByLmVhY2goewogICAgICAgICAgICAgICAgbWFyZ2luOiAnJywKICAgICAgICAgICAgICAgIHBhZGRpbmc6ICcnLAogICAgICAgICAgICAgICAgYm9yZGVyOiAnV2lkdGgnCiAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByLmNzc0hvb2tzW2EgKyBiXSA9IHsKICAgICAgICAgICAgICAgICAgICBleHBhbmQ6IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSAwLCBlID0ge30sIGYgPSAnc3RyaW5nJyA9PSB0eXBlb2YgYyA/IGMuc3BsaXQoJyAnKSA6IFtjXTsgZCA8IDQ7IGQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbYSArIGJhW2RdICsgYl0gPSBmW2RdIHx8IGZbZCAtIDJdIHx8IGZbMF07CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIEthLnRlc3QoYSkgfHwgKHIuY3NzSG9va3NbYSArIGJdLnNldCA9IFZhKTsKICAgICAgICAgICAgfSksIHIuZm4uZXh0ZW5kKHsKICAgICAgICAgICAgICAgIGNzczogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUyh0aGlzLCBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCwgZSwgZiA9IHt9LCBnID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIuaXNBcnJheShiKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChkID0gTWEoYSksIGUgPSBiLmxlbmd0aDsgZyA8IGU7IGcrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmW2JbZ11dID0gci5jc3MoYSwgYltnXSwgITEsIGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCAhPT0gYyA/IHIuc3R5bGUoYSwgYiwgYykgOiByLmNzcyhhLCBiKTsKICAgICAgICAgICAgICAgICAgICB9LCBhLCBiLCBhcmd1bWVudHMubGVuZ3RoID4gMSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBmdW5jdGlvbiBZYShhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFlhLnByb3RvdHlwZS5pbml0KGEsIGIsIGMsIGQsIGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHIuVHdlZW4gPSBZYSwgWWEucHJvdG90eXBlID0gewogICAgICAgICAgICAgICAgY29uc3RydWN0b3I6IFlhLAogICAgICAgICAgICAgICAgaW5pdDogZnVuY3Rpb24gKGEsIGIsIGMsIGQsIGUsIGYpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmVsZW0gPSBhLCB0aGlzLnByb3AgPSBjLCB0aGlzLmVhc2luZyA9IGUgfHwgci5lYXNpbmcuX2RlZmF1bHQsIHRoaXMub3B0aW9ucyA9IGIsIHRoaXMuc3RhcnQgPSB0aGlzLm5vdyA9IHRoaXMuY3VyKCksIHRoaXMuZW5kID0gZCwgdGhpcy51bml0ID0gZiB8fCAoci5jc3NOdW1iZXJbY10gPyAnJyA6ICdweCcpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGN1cjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gWWEucHJvcEhvb2tzW3RoaXMucHJvcF07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgJiYgYS5nZXQgPyBhLmdldCh0aGlzKSA6IFlhLnByb3BIb29rcy5fZGVmYXVsdC5nZXQodGhpcyk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgcnVuOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiLCBjID0gWWEucHJvcEhvb2tzW3RoaXMucHJvcF07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMub3B0aW9ucy5kdXJhdGlvbiA/IHRoaXMucG9zID0gYiA9IHIuZWFzaW5nW3RoaXMuZWFzaW5nXShhLCB0aGlzLm9wdGlvbnMuZHVyYXRpb24gKiBhLCAwLCAxLCB0aGlzLm9wdGlvbnMuZHVyYXRpb24pIDogdGhpcy5wb3MgPSBiID0gYSwgdGhpcy5ub3cgPSAodGhpcy5lbmQgLSB0aGlzLnN0YXJ0KSAqIGIgKyB0aGlzLnN0YXJ0LCB0aGlzLm9wdGlvbnMuc3RlcCAmJiB0aGlzLm9wdGlvbnMuc3RlcC5jYWxsKHRoaXMuZWxlbSwgdGhpcy5ub3csIHRoaXMpLCBjICYmIGMuc2V0ID8gYy5zZXQodGhpcykgOiBZYS5wcm9wSG9va3MuX2RlZmF1bHQuc2V0KHRoaXMpLCB0aGlzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LCBZYS5wcm90b3R5cGUuaW5pdC5wcm90b3R5cGUgPSBZYS5wcm90b3R5cGUsIFlhLnByb3BIb29rcyA9IHsKICAgICAgICAgICAgICAgIF9kZWZhdWx0OiB7CiAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYjsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDEgIT09IGEuZWxlbS5ub2RlVHlwZSB8fCBudWxsICE9IGEuZWxlbVthLnByb3BdICYmIG51bGwgPT0gYS5lbGVtLnN0eWxlW2EucHJvcF0gPyBhLmVsZW1bYS5wcm9wXSA6IChiID0gci5jc3MoYS5lbGVtLCBhLnByb3AsICcnKSwgYiAmJiAnYXV0bycgIT09IGIgPyBiIDogMCk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHIuZnguc3RlcFthLnByb3BdID8gci5meC5zdGVwW2EucHJvcF0oYSkgOiAxICE9PSBhLmVsZW0ubm9kZVR5cGUgfHwgbnVsbCA9PSBhLmVsZW0uc3R5bGVbci5jc3NQcm9wc1thLnByb3BdXSAmJiAhci5jc3NIb29rc1thLnByb3BdID8gYS5lbGVtW2EucHJvcF0gPSBhLm5vdyA6IHIuc3R5bGUoYS5lbGVtLCBhLnByb3AsIGEubm93ICsgYS51bml0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sIFlhLnByb3BIb29rcy5zY3JvbGxUb3AgPSBZYS5wcm9wSG9va3Muc2Nyb2xsTGVmdCA9IHsKICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBhLmVsZW0ubm9kZVR5cGUgJiYgYS5lbGVtLnBhcmVudE5vZGUgJiYgKGEuZWxlbVthLnByb3BdID0gYS5ub3cpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LCByLmVhc2luZyA9IHsKICAgICAgICAgICAgICAgIGxpbmVhcjogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBzd2luZzogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMC41IC0gTWF0aC5jb3MoYSAqIE1hdGguUEkpIC8gMjsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBfZGVmYXVsdDogJ3N3aW5nJwogICAgICAgICAgICB9LCByLmZ4ID0gWWEucHJvdG90eXBlLmluaXQsIHIuZnguc3RlcCA9IHt9OwogICAgICAgICAgICB2YXIgWmEsICRhLCBfYSA9IC9eKD86dG9nZ2xlfHNob3d8aGlkZSkkLywgYWIgPSAvcXVldWVIb29rcyQvOwogICAgICAgICAgICBmdW5jdGlvbiBiYigpIHsKICAgICAgICAgICAgICAgICRhICYmIChhLnJlcXVlc3RBbmltYXRpb25GcmFtZShiYiksIHIuZngudGljaygpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBjYigpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhLnNldFRpbWVvdXQoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIFphID0gdm9pZCAwOwogICAgICAgICAgICAgICAgfSksIFphID0gci5ub3coKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBkYihhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYywgZCA9IDAsIGUgPSB7IGhlaWdodDogYSB9OwogICAgICAgICAgICAgICAgZm9yIChiID0gYiA/IDEgOiAwOyBkIDwgNDsgZCArPSAyIC0gYikKICAgICAgICAgICAgICAgICAgICBjID0gYmFbZF0sIGVbJ21hcmdpbicgKyBjXSA9IGVbJ3BhZGRpbmcnICsgY10gPSBhOwogICAgICAgICAgICAgICAgcmV0dXJuIGIgJiYgKGUub3BhY2l0eSA9IGUud2lkdGggPSBhKSwgZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBlYihhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBkLCBlID0gKGhiLnR3ZWVuZXJzW2JdIHx8IFtdKS5jb25jYXQoaGIudHdlZW5lcnNbJyonXSksIGYgPSAwLCBnID0gZS5sZW5ndGg7IGYgPCBnOyBmKyspCiAgICAgICAgICAgICAgICAgICAgaWYgKGQgPSBlW2ZdLmNhbGwoYywgYiwgYSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGZiKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHZhciBkLCBlLCBmLCBnLCBoLCBpLCBqLCBrLCBsID0gJ3dpZHRoJyBpbiBiIHx8ICdoZWlnaHQnIGluIGIsIG0gPSB0aGlzLCBuID0ge30sIG8gPSBhLnN0eWxlLCBwID0gYS5ub2RlVHlwZSAmJiBjYShhKSwgcSA9IFYuZ2V0KGEsICdmeHNob3cnKTsKICAgICAgICAgICAgICAgIGMucXVldWUgfHwgKGcgPSByLl9xdWV1ZUhvb2tzKGEsICdmeCcpLCBudWxsID09IGcudW5xdWV1ZWQgJiYgKGcudW5xdWV1ZWQgPSAwLCBoID0gZy5lbXB0eS5maXJlLCBnLmVtcHR5LmZpcmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZy51bnF1ZXVlZCB8fCBoKCk7CiAgICAgICAgICAgICAgICB9KSwgZy51bnF1ZXVlZCsrLCBtLmFsd2F5cyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgbS5hbHdheXMoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBnLnVucXVldWVkLS0sIHIucXVldWUoYSwgJ2Z4JykubGVuZ3RoIHx8IGcuZW1wdHkuZmlyZSgpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgZm9yIChkIGluIGIpCiAgICAgICAgICAgICAgICAgICAgaWYgKGUgPSBiW2RdLCBfYS50ZXN0KGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkZWxldGUgYltkXSwgZiA9IGYgfHwgJ3RvZ2dsZScgPT09IGUsIGUgPT09IChwID8gJ2hpZGUnIDogJ3Nob3cnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdzaG93JyAhPT0gZSB8fCAhcSB8fCB2b2lkIDAgPT09IHFbZF0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgbltkXSA9IHEgJiYgcVtkXSB8fCByLnN0eWxlKGEsIGQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChpID0gIXIuaXNFbXB0eU9iamVjdChiKSwgaSB8fCAhci5pc0VtcHR5T2JqZWN0KG4pKSB7CiAgICAgICAgICAgICAgICAgICAgbCAmJiAxID09PSBhLm5vZGVUeXBlICYmIChjLm92ZXJmbG93ID0gWwogICAgICAgICAgICAgICAgICAgICAgICBvLm92ZXJmbG93LAogICAgICAgICAgICAgICAgICAgICAgICBvLm92ZXJmbG93WCwKICAgICAgICAgICAgICAgICAgICAgICAgby5vdmVyZmxvd1kKICAgICAgICAgICAgICAgICAgICBdLCBqID0gcSAmJiBxLmRpc3BsYXksIG51bGwgPT0gaiAmJiAoaiA9IFYuZ2V0KGEsICdkaXNwbGF5JykpLCBrID0gci5jc3MoYSwgJ2Rpc3BsYXknKSwgJ25vbmUnID09PSBrICYmIChqID8gayA9IGogOiAoaGEoW2FdLCAhMCksIGogPSBhLnN0eWxlLmRpc3BsYXkgfHwgaiwgayA9IHIuY3NzKGEsICdkaXNwbGF5JyksIGhhKFthXSkpKSwgKCdpbmxpbmUnID09PSBrIHx8ICdpbmxpbmUtYmxvY2snID09PSBrICYmIG51bGwgIT0gaikgJiYgJ25vbmUnID09PSByLmNzcyhhLCAnZmxvYXQnKSAmJiAoaSB8fCAobS5kb25lKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgby5kaXNwbGF5ID0gajsKICAgICAgICAgICAgICAgICAgICB9KSwgbnVsbCA9PSBqICYmIChrID0gby5kaXNwbGF5LCBqID0gJ25vbmUnID09PSBrID8gJycgOiBrKSksIG8uZGlzcGxheSA9ICdpbmxpbmUtYmxvY2snKSksIGMub3ZlcmZsb3cgJiYgKG8ub3ZlcmZsb3cgPSAnaGlkZGVuJywgbS5hbHdheXMoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBvLm92ZXJmbG93ID0gYy5vdmVyZmxvd1swXSwgby5vdmVyZmxvd1ggPSBjLm92ZXJmbG93WzFdLCBvLm92ZXJmbG93WSA9IGMub3ZlcmZsb3dbMl07CiAgICAgICAgICAgICAgICAgICAgfSkpLCBpID0gITE7CiAgICAgICAgICAgICAgICAgICAgZm9yIChkIGluIG4pCiAgICAgICAgICAgICAgICAgICAgICAgIGkgfHwgKHEgPyAnaGlkZGVuJyBpbiBxICYmIChwID0gcS5oaWRkZW4pIDogcSA9IFYuYWNjZXNzKGEsICdmeHNob3cnLCB7IGRpc3BsYXk6IGogfSksIGYgJiYgKHEuaGlkZGVuID0gIXApLCBwICYmIGhhKFthXSwgITApLCBtLmRvbmUoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcCB8fCBoYShbYV0pLCBWLnJlbW92ZShhLCAnZnhzaG93Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGQgaW4gbikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnN0eWxlKGEsIGQsIG5bZF0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KSksIGkgPSBlYihwID8gcVtkXSA6IDAsIGQsIG0pLCBkIGluIHEgfHwgKHFbZF0gPSBpLnN0YXJ0LCBwICYmIChpLmVuZCA9IGkuc3RhcnQsIGkuc3RhcnQgPSAwKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gZ2IoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMsIGQsIGUsIGYsIGc7CiAgICAgICAgICAgICAgICBmb3IgKGMgaW4gYSkKICAgICAgICAgICAgICAgICAgICBpZiAoZCA9IHIuY2FtZWxDYXNlKGMpLCBlID0gYltkXSwgZiA9IGFbY10sIHIuaXNBcnJheShmKSAmJiAoZSA9IGZbMV0sIGYgPSBhW2NdID0gZlswXSksIGMgIT09IGQgJiYgKGFbZF0gPSBmLCBkZWxldGUgYVtjXSksIGcgPSByLmNzc0hvb2tzW2RdLCBnICYmICdleHBhbmQnIGluIGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGcuZXhwYW5kKGYpLCBkZWxldGUgYVtkXTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjIGluIGYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjIGluIGEgfHwgKGFbY10gPSBmW2NdLCBiW2NdID0gZSk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIGJbZF0gPSBlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGhiKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIHZhciBkLCBlLCBmID0gMCwgZyA9IGhiLnByZWZpbHRlcnMubGVuZ3RoLCBoID0gci5EZWZlcnJlZCgpLmFsd2F5cyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBpLmVsZW07CiAgICAgICAgICAgICAgICAgICAgfSksIGkgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gWmEgfHwgY2IoKSwgYyA9IE1hdGgubWF4KDAsIGouc3RhcnRUaW1lICsgai5kdXJhdGlvbiAtIGIpLCBkID0gYyAvIGouZHVyYXRpb24gfHwgMCwgZiA9IDEgLSBkLCBnID0gMCwgaSA9IGoudHdlZW5zLmxlbmd0aDsgZyA8IGk7IGcrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGoudHdlZW5zW2ddLnJ1bihmKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGgubm90aWZ5V2l0aChhLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMKICAgICAgICAgICAgICAgICAgICAgICAgXSksIGYgPCAxICYmIGkgPyBjIDogKGgucmVzb2x2ZVdpdGgoYSwgW2pdKSwgITEpOwogICAgICAgICAgICAgICAgICAgIH0sIGogPSBoLnByb21pc2UoewogICAgICAgICAgICAgICAgICAgICAgICBlbGVtOiBhLAogICAgICAgICAgICAgICAgICAgICAgICBwcm9wczogci5leHRlbmQoe30sIGIpLAogICAgICAgICAgICAgICAgICAgICAgICBvcHRzOiByLmV4dGVuZCghMCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3BlY2lhbEVhc2luZzoge30sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlYXNpbmc6IHIuZWFzaW5nLl9kZWZhdWx0CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGMpLAogICAgICAgICAgICAgICAgICAgICAgICBvcmlnaW5hbFByb3BlcnRpZXM6IGIsCiAgICAgICAgICAgICAgICAgICAgICAgIG9yaWdpbmFsT3B0aW9uczogYywKICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lOiBaYSB8fCBjYigpLAogICAgICAgICAgICAgICAgICAgICAgICBkdXJhdGlvbjogYy5kdXJhdGlvbiwKICAgICAgICAgICAgICAgICAgICAgICAgdHdlZW5zOiBbXSwKICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlVHdlZW46IGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHIuVHdlZW4oYSwgai5vcHRzLCBiLCBjLCBqLm9wdHMuc3BlY2lhbEVhc2luZ1tiXSB8fCBqLm9wdHMuZWFzaW5nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqLnR3ZWVucy5wdXNoKGQpLCBkOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzdG9wOiBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAwLCBkID0gYiA/IGoudHdlZW5zLmxlbmd0aCA6IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSA9ICEwOyBjIDwgZDsgYysrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGoudHdlZW5zW2NdLnJ1bigxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiID8gKGgubm90aWZ5V2l0aChhLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBoLnJlc29sdmVXaXRoKGEsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pKSA6IGgucmVqZWN0V2l0aChhLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKSwgdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pLCBrID0gai5wcm9wczsKICAgICAgICAgICAgICAgIGZvciAoZ2Ioaywgai5vcHRzLnNwZWNpYWxFYXNpbmcpOyBmIDwgZzsgZisrKQogICAgICAgICAgICAgICAgICAgIGlmIChkID0gaGIucHJlZmlsdGVyc1tmXS5jYWxsKGosIGEsIGssIGoub3B0cykpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmlzRnVuY3Rpb24oZC5zdG9wKSAmJiAoci5fcXVldWVIb29rcyhqLmVsZW0sIGoub3B0cy5xdWV1ZSkuc3RvcCA9IHIucHJveHkoZC5zdG9wLCBkKSksIGQ7CiAgICAgICAgICAgICAgICByZXR1cm4gci5tYXAoaywgZWIsIGopLCByLmlzRnVuY3Rpb24oai5vcHRzLnN0YXJ0KSAmJiBqLm9wdHMuc3RhcnQuY2FsbChhLCBqKSwgci5meC50aW1lcihyLmV4dGVuZChpLCB7CiAgICAgICAgICAgICAgICAgICAgZWxlbTogYSwKICAgICAgICAgICAgICAgICAgICBhbmltOiBqLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlOiBqLm9wdHMucXVldWUKICAgICAgICAgICAgICAgIH0pKSwgai5wcm9ncmVzcyhqLm9wdHMucHJvZ3Jlc3MpLmRvbmUoai5vcHRzLmRvbmUsIGoub3B0cy5jb21wbGV0ZSkuZmFpbChqLm9wdHMuZmFpbCkuYWx3YXlzKGoub3B0cy5hbHdheXMpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHIuQW5pbWF0aW9uID0gci5leHRlbmQoaGIsIHsKICAgICAgICAgICAgICAgIHR3ZWVuZXJzOiB7CiAgICAgICAgICAgICAgICAgICAgJyonOiBbZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gdGhpcy5jcmVhdGVUd2VlbihhLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlYShjLmVsZW0sIGEsIGFhLmV4ZWMoYiksIGMpLCBjOwogICAgICAgICAgICAgICAgICAgICAgICB9XQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHR3ZWVuZXI6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgci5pc0Z1bmN0aW9uKGEpID8gKGIgPSBhLCBhID0gWycqJ10pIDogYSA9IGEubWF0Y2goSyk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYywgZCA9IDAsIGUgPSBhLmxlbmd0aDsgZCA8IGU7IGQrKykKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGFbZF0sIGhiLnR3ZWVuZXJzW2NdID0gaGIudHdlZW5lcnNbY10gfHwgW10sIGhiLnR3ZWVuZXJzW2NdLnVuc2hpZnQoYik7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgcHJlZmlsdGVyczogW2ZiXSwKICAgICAgICAgICAgICAgIHByZWZpbHRlcjogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBiID8gaGIucHJlZmlsdGVycy51bnNoaWZ0KGEpIDogaGIucHJlZmlsdGVycy5wdXNoKGEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSwgci5zcGVlZCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZSA9IGEgJiYgJ29iamVjdCcgPT0gdHlwZW9mIGEgPyByLmV4dGVuZCh7fSwgYSkgOiB7CiAgICAgICAgICAgICAgICAgICAgY29tcGxldGU6IGMgfHwgIWMgJiYgYiB8fCByLmlzRnVuY3Rpb24oYSkgJiYgYSwKICAgICAgICAgICAgICAgICAgICBkdXJhdGlvbjogYSwKICAgICAgICAgICAgICAgICAgICBlYXNpbmc6IGMgJiYgYiB8fCBiICYmICFyLmlzRnVuY3Rpb24oYikgJiYgYgogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIHJldHVybiByLmZ4Lm9mZiB8fCBkLmhpZGRlbiA/IGUuZHVyYXRpb24gPSAwIDogJ251bWJlcicgIT0gdHlwZW9mIGUuZHVyYXRpb24gJiYgKGUuZHVyYXRpb24gaW4gci5meC5zcGVlZHMgPyBlLmR1cmF0aW9uID0gci5meC5zcGVlZHNbZS5kdXJhdGlvbl0gOiBlLmR1cmF0aW9uID0gci5meC5zcGVlZHMuX2RlZmF1bHQpLCBudWxsICE9IGUucXVldWUgJiYgZS5xdWV1ZSAhPT0gITAgfHwgKGUucXVldWUgPSAnZngnKSwgZS5vbGQgPSBlLmNvbXBsZXRlLCBlLmNvbXBsZXRlID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHIuaXNGdW5jdGlvbihlLm9sZCkgJiYgZS5vbGQuY2FsbCh0aGlzKSwgZS5xdWV1ZSAmJiByLmRlcXVldWUodGhpcywgZS5xdWV1ZSk7CiAgICAgICAgICAgICAgICB9LCBlOwogICAgICAgICAgICB9LCByLmZuLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBmYWRlVG86IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZmlsdGVyKGNhKS5jc3MoJ29wYWNpdHknLCAwKS5zaG93KCkuZW5kKCkuYW5pbWF0ZSh7IG9wYWNpdHk6IGIgfSwgYSwgYywgZCk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgYW5pbWF0ZTogZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHIuaXNFbXB0eU9iamVjdChhKSwgZiA9IHIuc3BlZWQoYiwgYywgZCksIGcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGhiKHRoaXMsIHIuZXh0ZW5kKHt9LCBhKSwgZik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZSB8fCBWLmdldCh0aGlzLCAnZmluaXNoJykpICYmIGIuc3RvcCghMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcuZmluaXNoID0gZywgZSB8fCBmLnF1ZXVlID09PSAhMSA/IHRoaXMuZWFjaChnKSA6IHRoaXMucXVldWUoZi5xdWV1ZSwgZyk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgc3RvcDogZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gYS5zdG9wOwogICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgYS5zdG9wLCBiKGMpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnICE9IHR5cGVvZiBhICYmIChjID0gYiwgYiA9IGEsIGEgPSB2b2lkIDApLCBiICYmIGEgIT09ICExICYmIHRoaXMucXVldWUoYSB8fCAnZngnLCBbXSksIHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gITAsIGUgPSBudWxsICE9IGEgJiYgYSArICdxdWV1ZUhvb2tzJywgZiA9IHIudGltZXJzLCBnID0gVi5nZXQodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ1tlXSAmJiBnW2VdLnN0b3AgJiYgZChnW2VdKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChlIGluIGcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ1tlXSAmJiBnW2VdLnN0b3AgJiYgYWIudGVzdChlKSAmJiBkKGdbZV0pOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSBmLmxlbmd0aDsgZS0tOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZbZV0uZWxlbSAhPT0gdGhpcyB8fCBudWxsICE9IGEgJiYgZltlXS5xdWV1ZSAhPT0gYSB8fCAoZltlXS5hbmltLnN0b3AoYyksIGIgPSAhMSwgZi5zcGxpY2UoZSwgMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAhYiAmJiBjIHx8IHIuZGVxdWV1ZSh0aGlzLCBhKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBmaW5pc2g6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgIT09ICExICYmIChhID0gYSB8fCAnZngnKSwgdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIsIGMgPSBWLmdldCh0aGlzKSwgZCA9IGNbYSArICdxdWV1ZSddLCBlID0gY1thICsgJ3F1ZXVlSG9va3MnXSwgZiA9IHIudGltZXJzLCBnID0gZCA/IGQubGVuZ3RoIDogMDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjLmZpbmlzaCA9ICEwLCByLnF1ZXVlKHRoaXMsIGEsIFtdKSwgZSAmJiBlLnN0b3AgJiYgZS5zdG9wLmNhbGwodGhpcywgITApLCBiID0gZi5sZW5ndGg7IGItLTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmW2JdLmVsZW0gPT09IHRoaXMgJiYgZltiXS5xdWV1ZSA9PT0gYSAmJiAoZltiXS5hbmltLnN0b3AoITApLCBmLnNwbGljZShiLCAxKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYiA9IDA7IGIgPCBnOyBiKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkW2JdICYmIGRbYl0uZmluaXNoICYmIGRbYl0uZmluaXNoLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBjLmZpbmlzaDsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSksIHIuZWFjaChbCiAgICAgICAgICAgICAgICAndG9nZ2xlJywKICAgICAgICAgICAgICAgICdzaG93JywKICAgICAgICAgICAgICAgICdoaWRlJwogICAgICAgICAgICBdLCBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSByLmZuW2JdOwogICAgICAgICAgICAgICAgci5mbltiXSA9IGZ1bmN0aW9uIChhLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gYSB8fCAnYm9vbGVhbicgPT0gdHlwZW9mIGEgPyBjLmFwcGx5KHRoaXMsIGFyZ3VtZW50cykgOiB0aGlzLmFuaW1hdGUoZGIoYiwgITApLCBhLCBkLCBlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0pLCByLmVhY2goewogICAgICAgICAgICAgICAgc2xpZGVEb3duOiBkYignc2hvdycpLAogICAgICAgICAgICAgICAgc2xpZGVVcDogZGIoJ2hpZGUnKSwKICAgICAgICAgICAgICAgIHNsaWRlVG9nZ2xlOiBkYigndG9nZ2xlJyksCiAgICAgICAgICAgICAgICBmYWRlSW46IHsgb3BhY2l0eTogJ3Nob3cnIH0sCiAgICAgICAgICAgICAgICBmYWRlT3V0OiB7IG9wYWNpdHk6ICdoaWRlJyB9LAogICAgICAgICAgICAgICAgZmFkZVRvZ2dsZTogeyBvcGFjaXR5OiAndG9nZ2xlJyB9CiAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByLmZuW2FdID0gZnVuY3Rpb24gKGEsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5hbmltYXRlKGIsIGEsIGMsIGQpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSksIHIudGltZXJzID0gW10sIHIuZngudGljayA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhLCBiID0gMCwgYyA9IHIudGltZXJzOwogICAgICAgICAgICAgICAgZm9yIChaYSA9IHIubm93KCk7IGIgPCBjLmxlbmd0aDsgYisrKQogICAgICAgICAgICAgICAgICAgIGEgPSBjW2JdLCBhKCkgfHwgY1tiXSAhPT0gYSB8fCBjLnNwbGljZShiLS0sIDEpOwogICAgICAgICAgICAgICAgYy5sZW5ndGggfHwgci5meC5zdG9wKCksIFphID0gdm9pZCAwOwogICAgICAgICAgICB9LCByLmZ4LnRpbWVyID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHIudGltZXJzLnB1c2goYSksIGEoKSA/IHIuZnguc3RhcnQoKSA6IHIudGltZXJzLnBvcCgpOwogICAgICAgICAgICB9LCByLmZ4LmludGVydmFsID0gMTMsIHIuZnguc3RhcnQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAkYSB8fCAoJGEgPSBhLnJlcXVlc3RBbmltYXRpb25GcmFtZSA/IGEucmVxdWVzdEFuaW1hdGlvbkZyYW1lKGJiKSA6IGEuc2V0SW50ZXJ2YWwoci5meC50aWNrLCByLmZ4LmludGVydmFsKSk7CiAgICAgICAgICAgIH0sIHIuZnguc3RvcCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIGEuY2FuY2VsQW5pbWF0aW9uRnJhbWUgPyBhLmNhbmNlbEFuaW1hdGlvbkZyYW1lKCRhKSA6IGEuY2xlYXJJbnRlcnZhbCgkYSksICRhID0gbnVsbDsKICAgICAgICAgICAgfSwgci5meC5zcGVlZHMgPSB7CiAgICAgICAgICAgICAgICBzbG93OiA2MDAsCiAgICAgICAgICAgICAgICBmYXN0OiAyMDAsCiAgICAgICAgICAgICAgICBfZGVmYXVsdDogNDAwCiAgICAgICAgICAgIH0sIHIuZm4uZGVsYXkgPSBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgcmV0dXJuIGIgPSByLmZ4ID8gci5meC5zcGVlZHNbYl0gfHwgYiA6IGIsIGMgPSBjIHx8ICdmeCcsIHRoaXMucXVldWUoYywgZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGEuc2V0VGltZW91dChjLCBiKTsKICAgICAgICAgICAgICAgICAgICBkLnN0b3AgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuY2xlYXJUaW1lb3V0KGUpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSBkLmNyZWF0ZUVsZW1lbnQoJ2lucHV0JyksIGIgPSBkLmNyZWF0ZUVsZW1lbnQoJ3NlbGVjdCcpLCBjID0gYi5hcHBlbmRDaGlsZChkLmNyZWF0ZUVsZW1lbnQoJ29wdGlvbicpKTsKICAgICAgICAgICAgICAgIGEudHlwZSA9ICdjaGVja2JveCcsIG8uY2hlY2tPbiA9ICcnICE9PSBhLnZhbHVlLCBvLm9wdFNlbGVjdGVkID0gYy5zZWxlY3RlZCwgYSA9IGQuY3JlYXRlRWxlbWVudCgnaW5wdXQnKSwgYS52YWx1ZSA9ICd0JywgYS50eXBlID0gJ3JhZGlvJywgby5yYWRpb1ZhbHVlID0gJ3QnID09PSBhLnZhbHVlOwogICAgICAgICAgICB9KCk7CiAgICAgICAgICAgIHZhciBpYiwgamIgPSByLmV4cHIuYXR0ckhhbmRsZTsKICAgICAgICAgICAgci5mbi5leHRlbmQoewogICAgICAgICAgICAgICAgYXR0cjogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUyh0aGlzLCByLmF0dHIsIGEsIGIsIGFyZ3VtZW50cy5sZW5ndGggPiAxKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICByZW1vdmVBdHRyOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByLnJlbW92ZUF0dHIodGhpcywgYSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pLCByLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBhdHRyOiBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkLCBlLCBmID0gYS5ub2RlVHlwZTsKICAgICAgICAgICAgICAgICAgICBpZiAoMyAhPT0gZiAmJiA4ICE9PSBmICYmIDIgIT09IGYpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAndW5kZWZpbmVkJyA9PSB0eXBlb2YgYS5nZXRBdHRyaWJ1dGUgPyByLnByb3AoYSwgYiwgYykgOiAoMSA9PT0gZiAmJiByLmlzWE1MRG9jKGEpIHx8IChlID0gci5hdHRySG9va3NbYi50b0xvd2VyQ2FzZSgpXSB8fCAoci5leHByLm1hdGNoLmJvb2wudGVzdChiKSA/IGliIDogdm9pZCAwKSksIHZvaWQgMCAhPT0gYyA/IG51bGwgPT09IGMgPyB2b2lkIHIucmVtb3ZlQXR0cihhLCBiKSA6IGUgJiYgJ3NldCcgaW4gZSAmJiB2b2lkIDAgIT09IChkID0gZS5zZXQoYSwgYywgYikpID8gZCA6IChhLnNldEF0dHJpYnV0ZShiLCBjICsgJycpLCBjKSA6IGUgJiYgJ2dldCcgaW4gZSAmJiBudWxsICE9PSAoZCA9IGUuZ2V0KGEsIGIpKSA/IGQgOiAoZCA9IHIuZmluZC5hdHRyKGEsIGIpLCBudWxsID09IGQgPyB2b2lkIDAgOiBkKSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgYXR0ckhvb2tzOiB7CiAgICAgICAgICAgICAgICAgICAgdHlwZTogewogICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW8ucmFkaW9WYWx1ZSAmJiAncmFkaW8nID09PSBiICYmIHIubm9kZU5hbWUoYSwgJ2lucHV0JykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuc2V0QXR0cmlidXRlKCd0eXBlJywgYiksIGMgJiYgKGEudmFsdWUgPSBjKSwgYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICByZW1vdmVBdHRyOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjLCBkID0gMCwgZSA9IGIgJiYgYi5tYXRjaChLKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiAxID09PSBhLm5vZGVUeXBlKQogICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYyA9IGVbZCsrXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucmVtb3ZlQXR0cmlidXRlKGMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSwgaWIgPSB7CiAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgPT09ICExID8gci5yZW1vdmVBdHRyKGEsIGMpIDogYS5zZXRBdHRyaWJ1dGUoYywgYyksIGM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sIHIuZWFjaChyLmV4cHIubWF0Y2guYm9vbC5zb3VyY2UubWF0Y2goL1x3Ky9nKSwgZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gamJbYl0gfHwgci5maW5kLmF0dHI7CiAgICAgICAgICAgICAgICBqYltiXSA9IGZ1bmN0aW9uIChhLCBiLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIGYsIGcgPSBiLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQgfHwgKGYgPSBqYltnXSwgamJbZ10gPSBlLCBlID0gbnVsbCAhPSBjKGEsIGIsIGQpID8gZyA6IG51bGwsIGpiW2ddID0gZiksIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIGtiID0gL14oPzppbnB1dHxzZWxlY3R8dGV4dGFyZWF8YnV0dG9uKSQvaSwgbGIgPSAvXig/OmF8YXJlYSkkL2k7CiAgICAgICAgICAgIHIuZm4uZXh0ZW5kKHsKICAgICAgICAgICAgICAgIHByb3A6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFModGhpcywgci5wcm9wLCBhLCBiLCBhcmd1bWVudHMubGVuZ3RoID4gMSk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgcmVtb3ZlUHJvcDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHRoaXNbci5wcm9wRml4W2FdIHx8IGFdOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSwgci5leHRlbmQoewogICAgICAgICAgICAgICAgcHJvcDogZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCwgZSwgZiA9IGEubm9kZVR5cGU7CiAgICAgICAgICAgICAgICAgICAgaWYgKDMgIT09IGYgJiYgOCAhPT0gZiAmJiAyICE9PSBmKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMSA9PT0gZiAmJiByLmlzWE1MRG9jKGEpIHx8IChiID0gci5wcm9wRml4W2JdIHx8IGIsIGUgPSByLnByb3BIb29rc1tiXSksIHZvaWQgMCAhPT0gYyA/IGUgJiYgJ3NldCcgaW4gZSAmJiB2b2lkIDAgIT09IChkID0gZS5zZXQoYSwgYywgYikpID8gZCA6IGFbYl0gPSBjIDogZSAmJiAnZ2V0JyBpbiBlICYmIG51bGwgIT09IChkID0gZS5nZXQoYSwgYikpID8gZCA6IGFbYl07CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgcHJvcEhvb2tzOiB7CiAgICAgICAgICAgICAgICAgICAgdGFiSW5kZXg6IHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSByLmZpbmQuYXR0cihhLCAndGFiaW5kZXgnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiID8gcGFyc2VJbnQoYiwgMTApIDoga2IudGVzdChhLm5vZGVOYW1lKSB8fCBsYi50ZXN0KGEubm9kZU5hbWUpICYmIGEuaHJlZiA/IDAgOiAtMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBwcm9wRml4OiB7CiAgICAgICAgICAgICAgICAgICAgJ2Zvcic6ICdodG1sRm9yJywKICAgICAgICAgICAgICAgICAgICAnY2xhc3MnOiAnY2xhc3NOYW1lJwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSwgby5vcHRTZWxlY3RlZCB8fCAoci5wcm9wSG9va3Muc2VsZWN0ZWQgPSB7CiAgICAgICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLnBhcmVudE5vZGU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgJiYgYi5wYXJlbnROb2RlICYmIGIucGFyZW50Tm9kZS5zZWxlY3RlZEluZGV4LCBudWxsOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEucGFyZW50Tm9kZTsKICAgICAgICAgICAgICAgICAgICBiICYmIChiLnNlbGVjdGVkSW5kZXgsIGIucGFyZW50Tm9kZSAmJiBiLnBhcmVudE5vZGUuc2VsZWN0ZWRJbmRleCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pLCByLmVhY2goWwogICAgICAgICAgICAgICAgJ3RhYkluZGV4JywKICAgICAgICAgICAgICAgICdyZWFkT25seScsCiAgICAgICAgICAgICAgICAnbWF4TGVuZ3RoJywKICAgICAgICAgICAgICAgICdjZWxsU3BhY2luZycsCiAgICAgICAgICAgICAgICAnY2VsbFBhZGRpbmcnLAogICAgICAgICAgICAgICAgJ3Jvd1NwYW4nLAogICAgICAgICAgICAgICAgJ2NvbFNwYW4nLAogICAgICAgICAgICAgICAgJ3VzZU1hcCcsCiAgICAgICAgICAgICAgICAnZnJhbWVCb3JkZXInLAogICAgICAgICAgICAgICAgJ2NvbnRlbnRFZGl0YWJsZScKICAgICAgICAgICAgXSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgci5wcm9wRml4W3RoaXMudG9Mb3dlckNhc2UoKV0gPSB0aGlzOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgZnVuY3Rpb24gbWIoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBhLm1hdGNoKEspIHx8IFtdOwogICAgICAgICAgICAgICAgcmV0dXJuIGIuam9pbignICcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIG5iKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhLmdldEF0dHJpYnV0ZSAmJiBhLmdldEF0dHJpYnV0ZSgnY2xhc3MnKSB8fCAnJzsKICAgICAgICAgICAgfQogICAgICAgICAgICByLmZuLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBhZGRDbGFzczogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiwgYywgZCwgZSwgZiwgZywgaCwgaSA9IDA7CiAgICAgICAgICAgICAgICAgICAgaWYgKHIuaXNGdW5jdGlvbihhKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZWFjaChmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcih0aGlzKS5hZGRDbGFzcyhhLmNhbGwodGhpcywgYiwgbmIodGhpcykpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBhICYmIGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGEubWF0Y2goSykgfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChjID0gdGhpc1tpKytdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgPSBuYihjKSwgZCA9IDEgPT09IGMubm9kZVR5cGUgJiYgJyAnICsgbWIoZSkgKyAnICcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZiA9IGJbZysrXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5pbmRleE9mKCcgJyArIGYgKyAnICcpIDwgMCAmJiAoZCArPSBmICsgJyAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gbWIoZCksIGUgIT09IGggJiYgYy5zZXRBdHRyaWJ1dGUoJ2NsYXNzJywgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHJlbW92ZUNsYXNzOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiLCBjLCBkLCBlLCBmLCBnLCBoLCBpID0gMDsKICAgICAgICAgICAgICAgICAgICBpZiAoci5pc0Z1bmN0aW9uKGEpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByKHRoaXMpLnJlbW92ZUNsYXNzKGEuY2FsbCh0aGlzLCBiLCBuYih0aGlzKSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBpZiAoIWFyZ3VtZW50cy5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmF0dHIoJ2NsYXNzJywgJycpOwogICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PSB0eXBlb2YgYSAmJiBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBhLm1hdGNoKEspIHx8IFtdOwogICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYyA9IHRoaXNbaSsrXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlID0gbmIoYyksIGQgPSAxID09PSBjLm5vZGVUeXBlICYmICcgJyArIG1iKGUpICsgJyAnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGYgPSBiW2crK10pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChkLmluZGV4T2YoJyAnICsgZiArICcgJykgPiAtMSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBkLnJlcGxhY2UoJyAnICsgZiArICcgJywgJyAnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gbWIoZCksIGUgIT09IGggJiYgYy5zZXRBdHRyaWJ1dGUoJ2NsYXNzJywgaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHRvZ2dsZUNsYXNzOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gdHlwZW9mIGE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdib29sZWFuJyA9PSB0eXBlb2YgYiAmJiAnc3RyaW5nJyA9PT0gYyA/IGIgPyB0aGlzLmFkZENsYXNzKGEpIDogdGhpcy5yZW1vdmVDbGFzcyhhKSA6IHIuaXNGdW5jdGlvbihhKSA/IHRoaXMuZWFjaChmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByKHRoaXMpLnRvZ2dsZUNsYXNzKGEuY2FsbCh0aGlzLCBjLCBuYih0aGlzKSwgYiksIGIpOwogICAgICAgICAgICAgICAgICAgIH0pIDogdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIsIGQsIGUsIGY7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PT0gYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IDAsIGUgPSByKHRoaXMpLCBmID0gYS5tYXRjaChLKSB8fCBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChiID0gZltkKytdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaGFzQ2xhc3MoYikgPyBlLnJlbW92ZUNsYXNzKGIpIDogZS5hZGRDbGFzcyhiKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IGEgJiYgJ2Jvb2xlYW4nICE9PSBjIHx8IChiID0gbmIodGhpcyksIGIgJiYgVi5zZXQodGhpcywgJ19fY2xhc3NOYW1lX18nLCBiKSwgdGhpcy5zZXRBdHRyaWJ1dGUgJiYgdGhpcy5zZXRBdHRyaWJ1dGUoJ2NsYXNzJywgYiB8fCBhID09PSAhMSA/ICcnIDogVi5nZXQodGhpcywgJ19fY2xhc3NOYW1lX18nKSB8fCAnJykpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGhhc0NsYXNzOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiLCBjLCBkID0gMDsKICAgICAgICAgICAgICAgICAgICBiID0gJyAnICsgYSArICcgJzsKICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYyA9IHRoaXNbZCsrXSkKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT09IGMubm9kZVR5cGUgJiYgKCcgJyArIG1iKG5iKGMpKSArICcgJykuaW5kZXhPZihiKSA+IC0xKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBvYiA9IC9cci9nOwogICAgICAgICAgICByLmZuLmV4dGVuZCh7CiAgICAgICAgICAgICAgICB2YWw6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIsIGMsIGQsIGUgPSB0aGlzWzBdOwogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFyZ3VtZW50cy5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZCA9IHIuaXNGdW5jdGlvbihhKSwgdGhpcy5lYWNoKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSA9PT0gdGhpcy5ub2RlVHlwZSAmJiAoZSA9IGQgPyBhLmNhbGwodGhpcywgYywgcih0aGlzKS52YWwoKSkgOiBhLCBudWxsID09IGUgPyBlID0gJycgOiAnbnVtYmVyJyA9PSB0eXBlb2YgZSA/IGUgKz0gJycgOiByLmlzQXJyYXkoZSkgJiYgKGUgPSByLm1hcChlLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBhID8gJycgOiBhICsgJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLCBiID0gci52YWxIb29rc1t0aGlzLnR5cGVdIHx8IHIudmFsSG9va3NbdGhpcy5ub2RlTmFtZS50b0xvd2VyQ2FzZSgpXSwgYiAmJiAnc2V0JyBpbiBiICYmIHZvaWQgMCAhPT0gYi5zZXQodGhpcywgZSwgJ3ZhbHVlJykgfHwgKHRoaXMudmFsdWUgPSBlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiA9IHIudmFsSG9va3NbZS50eXBlXSB8fCByLnZhbEhvb2tzW2Uubm9kZU5hbWUudG9Mb3dlckNhc2UoKV0sIGIgJiYgJ2dldCcgaW4gYiAmJiB2b2lkIDAgIT09IChjID0gYi5nZXQoZSwgJ3ZhbHVlJykpID8gYyA6IChjID0gZS52YWx1ZSwgJ3N0cmluZycgPT0gdHlwZW9mIGMgPyBjLnJlcGxhY2Uob2IsICcnKSA6IG51bGwgPT0gYyA/ICcnIDogYyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSwgci5leHRlbmQoewogICAgICAgICAgICAgICAgdmFsSG9va3M6IHsKICAgICAgICAgICAgICAgICAgICBvcHRpb246IHsKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSByLmZpbmQuYXR0cihhLCAndmFsdWUnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGIgPyBiIDogbWIoci50ZXh0KGEpKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgc2VsZWN0OiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdldDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiLCBjLCBkLCBlID0gYS5vcHRpb25zLCBmID0gYS5zZWxlY3RlZEluZGV4LCBnID0gJ3NlbGVjdC1vbmUnID09PSBhLnR5cGUsIGggPSBnID8gbnVsbCA6IFtdLCBpID0gZyA/IGYgKyAxIDogZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGQgPSBmIDwgMCA/IGkgOiBnID8gZiA6IDA7IGQgPCBpOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgPSBlW2RdLCAoYy5zZWxlY3RlZCB8fCBkID09PSBmKSAmJiAhYy5kaXNhYmxlZCAmJiAoIWMucGFyZW50Tm9kZS5kaXNhYmxlZCB8fCAhci5ub2RlTmFtZShjLnBhcmVudE5vZGUsICdvcHRncm91cCcpKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IHIoYykudmFsKCksIGcpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5wdXNoKGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoOwogICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYywgZCwgZSA9IGEub3B0aW9ucywgZiA9IHIubWFrZUFycmF5KGIpLCBnID0gZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZy0tKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBlW2ddLCAoZC5zZWxlY3RlZCA9IHIuaW5BcnJheShyLnZhbEhvb2tzLm9wdGlvbi5nZXQoZCksIGYpID4gLTEpICYmIChjID0gITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgfHwgKGEuc2VsZWN0ZWRJbmRleCA9IC0xKSwgZjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSksIHIuZWFjaChbCiAgICAgICAgICAgICAgICAncmFkaW8nLAogICAgICAgICAgICAgICAgJ2NoZWNrYm94JwogICAgICAgICAgICBdLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByLnZhbEhvb2tzW3RoaXNdID0gewogICAgICAgICAgICAgICAgICAgIHNldDogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIuaXNBcnJheShiKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmNoZWNrZWQgPSByLmluQXJyYXkocihhKS52YWwoKSwgYikgPiAtMTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBvLmNoZWNrT24gfHwgKHIudmFsSG9va3NbdGhpc10uZ2V0ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PT0gYS5nZXRBdHRyaWJ1dGUoJ3ZhbHVlJykgPyAnb24nIDogYS52YWx1ZTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIHBiID0gL14oPzpmb2N1c2luZm9jdXN8Zm9jdXNvdXRibHVyKSQvOwogICAgICAgICAgICByLmV4dGVuZChyLmV2ZW50LCB7CiAgICAgICAgICAgICAgICB0cmlnZ2VyOiBmdW5jdGlvbiAoYiwgYywgZSwgZikgewogICAgICAgICAgICAgICAgICAgIHZhciBnLCBoLCBpLCBqLCBrLCBtLCBuLCBvID0gW2UgfHwgZF0sIHAgPSBsLmNhbGwoYiwgJ3R5cGUnKSA/IGIudHlwZSA6IGIsIHEgPSBsLmNhbGwoYiwgJ25hbWVzcGFjZScpID8gYi5uYW1lc3BhY2Uuc3BsaXQoJy4nKSA6IFtdOwogICAgICAgICAgICAgICAgICAgIGlmIChoID0gaSA9IGUgPSBlIHx8IGQsIDMgIT09IGUubm9kZVR5cGUgJiYgOCAhPT0gZS5ub2RlVHlwZSAmJiAhcGIudGVzdChwICsgci5ldmVudC50cmlnZ2VyZWQpICYmIChwLmluZGV4T2YoJy4nKSA+IC0xICYmIChxID0gcC5zcGxpdCgnLicpLCBwID0gcS5zaGlmdCgpLCBxLnNvcnQoKSksIGsgPSBwLmluZGV4T2YoJzonKSA8IDAgJiYgJ29uJyArIHAsIGIgPSBiW3IuZXhwYW5kb10gPyBiIDogbmV3IHIuRXZlbnQocCwgJ29iamVjdCcgPT0gdHlwZW9mIGIgJiYgYiksIGIuaXNUcmlnZ2VyID0gZiA/IDIgOiAzLCBiLm5hbWVzcGFjZSA9IHEuam9pbignLicpLCBiLnJuYW1lc3BhY2UgPSBiLm5hbWVzcGFjZSA/IG5ldyBSZWdFeHAoJyhefFxcLiknICsgcS5qb2luKCdcXC4oPzouKlxcLnwpJykgKyAnKFxcLnwkKScpIDogbnVsbCwgYi5yZXN1bHQgPSB2b2lkIDAsIGIudGFyZ2V0IHx8IChiLnRhcmdldCA9IGUpLCBjID0gbnVsbCA9PSBjID8gW2JdIDogci5tYWtlQXJyYXkoYywgW2JdKSwgbiA9IHIuZXZlbnQuc3BlY2lhbFtwXSB8fCB7fSwgZiB8fCAhbi50cmlnZ2VyIHx8IG4udHJpZ2dlci5hcHBseShlLCBjKSAhPT0gITEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZiAmJiAhbi5ub0J1YmJsZSAmJiAhci5pc1dpbmRvdyhlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChqID0gbi5kZWxlZ2F0ZVR5cGUgfHwgcCwgcGIudGVzdChqICsgcCkgfHwgKGggPSBoLnBhcmVudE5vZGUpOyBoOyBoID0gaC5wYXJlbnROb2RlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8ucHVzaChoKSwgaSA9IGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID09PSAoZS5vd25lckRvY3VtZW50IHx8IGQpICYmIG8ucHVzaChpLmRlZmF1bHRWaWV3IHx8IGkucGFyZW50V2luZG93IHx8IGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoKGggPSBvW2crK10pICYmICFiLmlzUHJvcGFnYXRpb25TdG9wcGVkKCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLnR5cGUgPSBnID4gMSA/IGogOiBuLmJpbmRUeXBlIHx8IHAsIG0gPSAoVi5nZXQoaCwgJ2V2ZW50cycpIHx8IHt9KVtiLnR5cGVdICYmIFYuZ2V0KGgsICdoYW5kbGUnKSwgbSAmJiBtLmFwcGx5KGgsIGMpLCBtID0gayAmJiBoW2tdLCBtICYmIG0uYXBwbHkgJiYgVChoKSAmJiAoYi5yZXN1bHQgPSBtLmFwcGx5KGgsIGMpLCBiLnJlc3VsdCA9PT0gITEgJiYgYi5wcmV2ZW50RGVmYXVsdCgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIudHlwZSA9IHAsIGYgfHwgYi5pc0RlZmF1bHRQcmV2ZW50ZWQoKSB8fCBuLl9kZWZhdWx0ICYmIG4uX2RlZmF1bHQuYXBwbHkoby5wb3AoKSwgYykgIT09ICExIHx8ICFUKGUpIHx8IGsgJiYgci5pc0Z1bmN0aW9uKGVbcF0pICYmICFyLmlzV2luZG93KGUpICYmIChpID0gZVtrXSwgaSAmJiAoZVtrXSA9IG51bGwpLCByLmV2ZW50LnRyaWdnZXJlZCA9IHAsIGVbcF0oKSwgci5ldmVudC50cmlnZ2VyZWQgPSB2b2lkIDAsIGkgJiYgKGVba10gPSBpKSksIGIucmVzdWx0OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBzaW11bGF0ZTogZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHIuZXh0ZW5kKG5ldyByLkV2ZW50KCksIGMsIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgaXNTaW11bGF0ZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgci5ldmVudC50cmlnZ2VyKGQsIG51bGwsIGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSwgci5mbi5leHRlbmQoewogICAgICAgICAgICAgICAgdHJpZ2dlcjogZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgci5ldmVudC50cmlnZ2VyKGEsIGIsIHRoaXMpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHRyaWdnZXJIYW5kbGVyOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gdGhpc1swXTsKICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuZXZlbnQudHJpZ2dlcihhLCBiLCBjLCAhMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pLCByLmVhY2goJ2JsdXIgZm9jdXMgZm9jdXNpbiBmb2N1c291dCByZXNpemUgc2Nyb2xsIGNsaWNrIGRibGNsaWNrIG1vdXNlZG93biBtb3VzZXVwIG1vdXNlbW92ZSBtb3VzZW92ZXIgbW91c2VvdXQgbW91c2VlbnRlciBtb3VzZWxlYXZlIGNoYW5nZSBzZWxlY3Qgc3VibWl0IGtleWRvd24ga2V5cHJlc3Mga2V5dXAgY29udGV4dG1lbnUnLnNwbGl0KCcgJyksIGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByLmZuW2JdID0gZnVuY3Rpb24gKGEsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXJndW1lbnRzLmxlbmd0aCA+IDAgPyB0aGlzLm9uKGIsIG51bGwsIGEsIGMpIDogdGhpcy50cmlnZ2VyKGIpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSksIHIuZm4uZXh0ZW5kKHsKICAgICAgICAgICAgICAgIGhvdmVyOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm1vdXNlZW50ZXIoYSkubW91c2VsZWF2ZShiIHx8IGEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSwgby5mb2N1c2luID0gJ29uZm9jdXNpbicgaW4gYSwgby5mb2N1c2luIHx8IHIuZWFjaCh7CiAgICAgICAgICAgICAgICBmb2N1czogJ2ZvY3VzaW4nLAogICAgICAgICAgICAgICAgYmx1cjogJ2ZvY3Vzb3V0JwogICAgICAgICAgICB9LCBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHIuZXZlbnQuc2ltdWxhdGUoYiwgYS50YXJnZXQsIHIuZXZlbnQuZml4KGEpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByLmV2ZW50LnNwZWNpYWxbYl0gPSB7CiAgICAgICAgICAgICAgICAgICAgc2V0dXA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB0aGlzLm93bmVyRG9jdW1lbnQgfHwgdGhpcywgZSA9IFYuYWNjZXNzKGQsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICBlIHx8IGQuYWRkRXZlbnRMaXN0ZW5lcihhLCBjLCAhMCksIFYuYWNjZXNzKGQsIGIsIChlIHx8IDApICsgMSk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICB0ZWFyZG93bjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHRoaXMub3duZXJEb2N1bWVudCB8fCB0aGlzLCBlID0gVi5hY2Nlc3MoZCwgYikgLSAxOwogICAgICAgICAgICAgICAgICAgICAgICBlID8gVi5hY2Nlc3MoZCwgYiwgZSkgOiAoZC5yZW1vdmVFdmVudExpc3RlbmVyKGEsIGMsICEwKSwgVi5yZW1vdmUoZCwgYikpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgcWIgPSBhLmxvY2F0aW9uLCByYiA9IHIubm93KCksIHNiID0gL1w/LzsKICAgICAgICAgICAgci5wYXJzZVhNTCA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgIGlmICghYiB8fCAnc3RyaW5nJyAhPSB0eXBlb2YgYikKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgYyA9IG5ldyBhLkRPTVBhcnNlcigpLnBhcnNlRnJvbVN0cmluZyhiLCAndGV4dC94bWwnKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgICAgICBjID0gdm9pZCAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGMgJiYgIWMuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ3BhcnNlcmVycm9yJykubGVuZ3RoIHx8IHIuZXJyb3IoJ0ludmFsaWQgWE1MOiAnICsgYiksIGM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB0YiA9IC9cW1xdJC8sIHViID0gL1xyP1xuL2csIHZiID0gL14oPzpzdWJtaXR8YnV0dG9ufGltYWdlfHJlc2V0fGZpbGUpJC9pLCB3YiA9IC9eKD86aW5wdXR8c2VsZWN0fHRleHRhcmVhfGtleWdlbikvaTsKICAgICAgICAgICAgZnVuY3Rpb24geGIoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgdmFyIGU7CiAgICAgICAgICAgICAgICBpZiAoci5pc0FycmF5KGIpKQogICAgICAgICAgICAgICAgICAgIHIuZWFjaChiLCBmdW5jdGlvbiAoYiwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICBjIHx8IHRiLnRlc3QoYSkgPyBkKGEsIGUpIDogeGIoYSArICdbJyArICgnb2JqZWN0JyA9PSB0eXBlb2YgZSAmJiBudWxsICE9IGUgPyBiIDogJycpICsgJ10nLCBlLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGVsc2UgaWYgKGMgfHwgJ29iamVjdCcgIT09IHIudHlwZShiKSkKICAgICAgICAgICAgICAgICAgICBkKGEsIGIpOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIGZvciAoZSBpbiBiKQogICAgICAgICAgICAgICAgICAgICAgICB4YihhICsgJ1snICsgZSArICddJywgYltlXSwgYywgZCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgci5wYXJhbSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYywgZCA9IFtdLCBlID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSByLmlzRnVuY3Rpb24oYikgPyBiKCkgOiBiOwogICAgICAgICAgICAgICAgICAgICAgICBkW2QubGVuZ3RoXSA9IGVuY29kZVVSSUNvbXBvbmVudChhKSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudChudWxsID09IGMgPyAnJyA6IGMpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBpZiAoci5pc0FycmF5KGEpIHx8IGEuanF1ZXJ5ICYmICFyLmlzUGxhaW5PYmplY3QoYSkpCiAgICAgICAgICAgICAgICAgICAgci5lYWNoKGEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSh0aGlzLm5hbWUsIHRoaXMudmFsdWUpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIGZvciAoYyBpbiBhKQogICAgICAgICAgICAgICAgICAgICAgICB4YihjLCBhW2NdLCBiLCBlKTsKICAgICAgICAgICAgICAgIHJldHVybiBkLmpvaW4oJyYnKTsKICAgICAgICAgICAgfSwgci5mbi5leHRlbmQoewogICAgICAgICAgICAgICAgc2VyaWFsaXplOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIucGFyYW0odGhpcy5zZXJpYWxpemVBcnJheSgpKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBzZXJpYWxpemVBcnJheTogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm1hcChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gci5wcm9wKHRoaXMsICdlbGVtZW50cycpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA/IHIubWFrZUFycmF5KGEpIDogdGhpczsKICAgICAgICAgICAgICAgICAgICB9KS5maWx0ZXIoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXMudHlwZTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubmFtZSAmJiAhcih0aGlzKS5pcygnOmRpc2FibGVkJykgJiYgd2IudGVzdCh0aGlzLm5vZGVOYW1lKSAmJiAhdmIudGVzdChhKSAmJiAodGhpcy5jaGVja2VkIHx8ICFpYS50ZXN0KGEpKTsKICAgICAgICAgICAgICAgICAgICB9KS5tYXAoZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSByKHRoaXMpLnZhbCgpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBjID8gbnVsbCA6IHIuaXNBcnJheShjKSA/IHIubWFwKGMsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGIubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogYS5yZXBsYWNlKHViLCAnXHJcbicpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KSA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGIubmFtZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBjLnJlcGxhY2UodWIsICdcclxuJykKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KS5nZXQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciB5YiA9IC8lMjAvZywgemIgPSAvIy4qJC8sIEFiID0gLyhbPyZdKV89W14mXSovLCBCYiA9IC9eKC4qPyk6WyBcdF0qKFteXHJcbl0qKSQvZ20sIENiID0gL14oPzphYm91dHxhcHB8YXBwLXN0b3JhZ2V8ListZXh0ZW5zaW9ufGZpbGV8cmVzfHdpZGdldCk6JC8sIERiID0gL14oPzpHRVR8SEVBRCkkLywgRWIgPSAvXlwvXC8vLCBGYiA9IHt9LCBHYiA9IHt9LCBIYiA9ICcqLycuY29uY2F0KCcqJyksIEliID0gZC5jcmVhdGVFbGVtZW50KCdhJyk7CiAgICAgICAgICAgIEliLmhyZWYgPSBxYi5ocmVmOwogICAgICAgICAgICBmdW5jdGlvbiBKYihhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAnc3RyaW5nJyAhPSB0eXBlb2YgYiAmJiAoYyA9IGIsIGIgPSAnKicpOwogICAgICAgICAgICAgICAgICAgIHZhciBkLCBlID0gMCwgZiA9IGIudG9Mb3dlckNhc2UoKS5tYXRjaChLKSB8fCBbXTsKICAgICAgICAgICAgICAgICAgICBpZiAoci5pc0Z1bmN0aW9uKGMpKQogICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZCA9IGZbZSsrXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcrJyA9PT0gZFswXSA/IChkID0gZC5zbGljZSgxKSB8fCAnKicsIChhW2RdID0gYVtkXSB8fCBbXSkudW5zaGlmdChjKSkgOiAoYVtkXSA9IGFbZF0gfHwgW10pLnB1c2goYyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEtiKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIHZhciBlID0ge30sIGYgPSBhID09PSBHYjsKICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGcoaCkgewogICAgICAgICAgICAgICAgICAgIHZhciBpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlW2hdID0gITAsIHIuZWFjaChhW2hdIHx8IFtdLCBmdW5jdGlvbiAoYSwgaCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgaiA9IGgoYiwgYywgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnc3RyaW5nJyAhPSB0eXBlb2YgaiB8fCBmIHx8IGVbal0gPyBmID8gIShpID0gaikgOiB2b2lkIDAgOiAoYi5kYXRhVHlwZXMudW5zaGlmdChqKSwgZyhqKSwgITEpOwogICAgICAgICAgICAgICAgICAgIH0pLCBpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGcoYi5kYXRhVHlwZXNbMF0pIHx8ICFlWycqJ10gJiYgZygnKicpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIExiKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjLCBkLCBlID0gci5hamF4U2V0dGluZ3MuZmxhdE9wdGlvbnMgfHwge307CiAgICAgICAgICAgICAgICBmb3IgKGMgaW4gYikKICAgICAgICAgICAgICAgICAgICB2b2lkIDAgIT09IGJbY10gJiYgKChlW2NdID8gYSA6IGQgfHwgKGQgPSB7fSkpW2NdID0gYltjXSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZCAmJiByLmV4dGVuZCghMCwgYSwgZCksIGE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gTWIoYSwgYiwgYykgewogICAgICAgICAgICAgICAgdmFyIGQsIGUsIGYsIGcsIGggPSBhLmNvbnRlbnRzLCBpID0gYS5kYXRhVHlwZXM7CiAgICAgICAgICAgICAgICB3aGlsZSAoJyonID09PSBpWzBdKQogICAgICAgICAgICAgICAgICAgIGkuc2hpZnQoKSwgdm9pZCAwID09PSBkICYmIChkID0gYS5taW1lVHlwZSB8fCBiLmdldFJlc3BvbnNlSGVhZGVyKCdDb250ZW50LVR5cGUnKSk7CiAgICAgICAgICAgICAgICBpZiAoZCkKICAgICAgICAgICAgICAgICAgICBmb3IgKGUgaW4gaCkKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhbZV0gJiYgaFtlXS50ZXN0KGQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpLnVuc2hpZnQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGlbMF0gaW4gYykKICAgICAgICAgICAgICAgICAgICBmID0gaVswXTsKICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgIGZvciAoZSBpbiBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaVswXSB8fCBhLmNvbnZlcnRlcnNbZSArICcgJyArIGlbMF1dKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGcgfHwgKGcgPSBlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZiA9IGYgfHwgZzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChmKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBmICE9PSBpWzBdICYmIGkudW5zaGlmdChmKSwgY1tmXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBOYihhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICB2YXIgZSwgZiwgZywgaCwgaSwgaiA9IHt9LCBrID0gYS5kYXRhVHlwZXMuc2xpY2UoKTsKICAgICAgICAgICAgICAgIGlmIChrWzFdKQogICAgICAgICAgICAgICAgICAgIGZvciAoZyBpbiBhLmNvbnZlcnRlcnMpCiAgICAgICAgICAgICAgICAgICAgICAgIGpbZy50b0xvd2VyQ2FzZSgpXSA9IGEuY29udmVydGVyc1tnXTsKICAgICAgICAgICAgICAgIGYgPSBrLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICB3aGlsZSAoZikKICAgICAgICAgICAgICAgICAgICBpZiAoYS5yZXNwb25zZUZpZWxkc1tmXSAmJiAoY1thLnJlc3BvbnNlRmllbGRzW2ZdXSA9IGIpLCAhaSAmJiBkICYmIGEuZGF0YUZpbHRlciAmJiAoYiA9IGEuZGF0YUZpbHRlcihiLCBhLmRhdGFUeXBlKSksIGkgPSBmLCBmID0gay5zaGlmdCgpKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJyonID09PSBmKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCcqJyAhPT0gaSAmJiBpICE9PSBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZyA9IGpbaSArICcgJyArIGZdIHx8IGpbJyogJyArIGZdLCAhZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgaW4gaikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGggPSBlLnNwbGl0KCcgJyksIGhbMV0gPT09IGYgJiYgKGcgPSBqW2kgKyAnICcgKyBoWzBdXSB8fCBqWycqICcgKyBoWzBdXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcgPT09ICEwID8gZyA9IGpbZV0gOiBqW2VdICE9PSAhMCAmJiAoZiA9IGhbMF0sIGsudW5zaGlmdChoWzFdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGcgIT09ICEwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChnICYmIGFbJ3Rocm93cyddKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gZyhiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gZyhiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAobCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogJ3BhcnNlcmVycm9yJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZyA/IGwgOiAnTm8gY29udmVyc2lvbiBmcm9tICcgKyBpICsgJyB0byAnICsgZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgIHN0YXRlOiAnc3VjY2VzcycsCiAgICAgICAgICAgICAgICAgICAgZGF0YTogYgogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICByLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBhY3RpdmU6IDAsCiAgICAgICAgICAgICAgICBsYXN0TW9kaWZpZWQ6IHt9LAogICAgICAgICAgICAgICAgZXRhZzoge30sCiAgICAgICAgICAgICAgICBhamF4U2V0dGluZ3M6IHsKICAgICAgICAgICAgICAgICAgICB1cmw6IHFiLmhyZWYsCiAgICAgICAgICAgICAgICAgICAgdHlwZTogJ0dFVCcsCiAgICAgICAgICAgICAgICAgICAgaXNMb2NhbDogQ2IudGVzdChxYi5wcm90b2NvbCksCiAgICAgICAgICAgICAgICAgICAgZ2xvYmFsOiAhMCwKICAgICAgICAgICAgICAgICAgICBwcm9jZXNzRGF0YTogITAsCiAgICAgICAgICAgICAgICAgICAgYXN5bmM6ICEwLAogICAgICAgICAgICAgICAgICAgIGNvbnRlbnRUeXBlOiAnYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkOyBjaGFyc2V0PVVURi04JywKICAgICAgICAgICAgICAgICAgICBhY2NlcHRzOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICcqJzogSGIsCiAgICAgICAgICAgICAgICAgICAgICAgIHRleHQ6ICd0ZXh0L3BsYWluJywKICAgICAgICAgICAgICAgICAgICAgICAgaHRtbDogJ3RleHQvaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHhtbDogJ2FwcGxpY2F0aW9uL3htbCwgdGV4dC94bWwnLAogICAgICAgICAgICAgICAgICAgICAgICBqc29uOiAnYXBwbGljYXRpb24vanNvbiwgdGV4dC9qYXZhc2NyaXB0JwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgY29udGVudHM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgeG1sOiAvXGJ4bWxcYi8sCiAgICAgICAgICAgICAgICAgICAgICAgIGh0bWw6IC9cYmh0bWwvLAogICAgICAgICAgICAgICAgICAgICAgICBqc29uOiAvXGJqc29uXGIvCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICByZXNwb25zZUZpZWxkczogewogICAgICAgICAgICAgICAgICAgICAgICB4bWw6ICdyZXNwb25zZVhNTCcsCiAgICAgICAgICAgICAgICAgICAgICAgIHRleHQ6ICdyZXNwb25zZVRleHQnLAogICAgICAgICAgICAgICAgICAgICAgICBqc29uOiAncmVzcG9uc2VKU09OJwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgY29udmVydGVyczogewogICAgICAgICAgICAgICAgICAgICAgICAnKiB0ZXh0JzogU3RyaW5nLAogICAgICAgICAgICAgICAgICAgICAgICAndGV4dCBodG1sJzogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICd0ZXh0IGpzb24nOiBKU09OLnBhcnNlLAogICAgICAgICAgICAgICAgICAgICAgICAndGV4dCB4bWwnOiByLnBhcnNlWE1MCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBmbGF0T3B0aW9uczogewogICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiAhMAogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBhamF4U2V0dXA6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgPyBMYihMYihhLCByLmFqYXhTZXR0aW5ncyksIGIpIDogTGIoci5hamF4U2V0dGluZ3MsIGEpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGFqYXhQcmVmaWx0ZXI6IEpiKEZiKSwKICAgICAgICAgICAgICAgIGFqYXhUcmFuc3BvcnQ6IEpiKEdiKSwKICAgICAgICAgICAgICAgIGFqYXg6IGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT0gdHlwZW9mIGIgJiYgKGMgPSBiLCBiID0gdm9pZCAwKSwgYyA9IGMgfHwge307CiAgICAgICAgICAgICAgICAgICAgdmFyIGUsIGYsIGcsIGgsIGksIGosIGssIGwsIG0sIG4sIG8gPSByLmFqYXhTZXR1cCh7fSwgYyksIHAgPSBvLmNvbnRleHQgfHwgbywgcSA9IG8uY29udGV4dCAmJiAocC5ub2RlVHlwZSB8fCBwLmpxdWVyeSkgPyByKHApIDogci5ldmVudCwgcyA9IHIuRGVmZXJyZWQoKSwgdCA9IHIuQ2FsbGJhY2tzKCdvbmNlIG1lbW9yeScpLCB1ID0gby5zdGF0dXNDb2RlIHx8IHt9LCB2ID0ge30sIHcgPSB7fSwgeCA9ICdjYW5jZWxlZCcsIHkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkeVN0YXRlOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0UmVzcG9uc2VIZWFkZXI6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYiA9IEJiLmV4ZWMoZykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaFtiWzFdLnRvTG93ZXJDYXNlKCldID0gYlsyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gaFthLnRvTG93ZXJDYXNlKCldOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBiID8gbnVsbCA6IGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QWxsUmVzcG9uc2VIZWFkZXJzOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGsgPyBnIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRSZXF1ZXN0SGVhZGVyOiBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGsgJiYgKGEgPSB3W2EudG9Mb3dlckNhc2UoKV0gPSB3W2EudG9Mb3dlckNhc2UoKV0gfHwgYSwgdlthXSA9IGIpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGU6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gayAmJiAoby5taW1lVHlwZSA9IGEpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1c0NvZGU6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeS5hbHdheXMoYVt5LnN0YXR1c10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGIgaW4gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1W2JdID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1W2JdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhW2JdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhYm9ydDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEgfHwgeDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLmFib3J0KGIpLCBBKDAsIGIpLCB0aGlzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGlmIChzLnByb21pc2UoeSksIG8udXJsID0gKChiIHx8IG8udXJsIHx8IHFiLmhyZWYpICsgJycpLnJlcGxhY2UoRWIsIHFiLnByb3RvY29sICsgJy8vJyksIG8udHlwZSA9IGMubWV0aG9kIHx8IGMudHlwZSB8fCBvLm1ldGhvZCB8fCBvLnR5cGUsIG8uZGF0YVR5cGVzID0gKG8uZGF0YVR5cGUgfHwgJyonKS50b0xvd2VyQ2FzZSgpLm1hdGNoKEspIHx8IFsnJ10sIG51bGwgPT0gby5jcm9zc0RvbWFpbikgewogICAgICAgICAgICAgICAgICAgICAgICBqID0gZC5jcmVhdGVFbGVtZW50KCdhJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqLmhyZWYgPSBvLnVybCwgai5ocmVmID0gai5ocmVmLCBvLmNyb3NzRG9tYWluID0gSWIucHJvdG9jb2wgKyAnLy8nICsgSWIuaG9zdCAhPSBqLnByb3RvY29sICsgJy8vJyArIGouaG9zdDsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoeikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgby5jcm9zc0RvbWFpbiA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChvLmRhdGEgJiYgby5wcm9jZXNzRGF0YSAmJiAnc3RyaW5nJyAhPSB0eXBlb2Ygby5kYXRhICYmIChvLmRhdGEgPSByLnBhcmFtKG8uZGF0YSwgby50cmFkaXRpb25hbCkpLCBLYihGYiwgbywgYywgeSksIGspCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB5OwogICAgICAgICAgICAgICAgICAgIGwgPSByLmV2ZW50ICYmIG8uZ2xvYmFsLCBsICYmIDAgPT09IHIuYWN0aXZlKysgJiYgci5ldmVudC50cmlnZ2VyKCdhamF4U3RhcnQnKSwgby50eXBlID0gby50eXBlLnRvVXBwZXJDYXNlKCksIG8uaGFzQ29udGVudCA9ICFEYi50ZXN0KG8udHlwZSksIGYgPSBvLnVybC5yZXBsYWNlKHpiLCAnJyksIG8uaGFzQ29udGVudCA/IG8uZGF0YSAmJiBvLnByb2Nlc3NEYXRhICYmIDAgPT09IChvLmNvbnRlbnRUeXBlIHx8ICcnKS5pbmRleE9mKCdhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQnKSAmJiAoby5kYXRhID0gby5kYXRhLnJlcGxhY2UoeWIsICcrJykpIDogKG4gPSBvLnVybC5zbGljZShmLmxlbmd0aCksIG8uZGF0YSAmJiAoZiArPSAoc2IudGVzdChmKSA/ICcmJyA6ICc/JykgKyBvLmRhdGEsIGRlbGV0ZSBvLmRhdGEpLCBvLmNhY2hlID09PSAhMSAmJiAoZiA9IGYucmVwbGFjZShBYiwgJyQxJyksIG4gPSAoc2IudGVzdChmKSA/ICcmJyA6ICc/JykgKyAnXz0nICsgcmIrKyArIG4pLCBvLnVybCA9IGYgKyBuKSwgby5pZk1vZGlmaWVkICYmIChyLmxhc3RNb2RpZmllZFtmXSAmJiB5LnNldFJlcXVlc3RIZWFkZXIoJ0lmLU1vZGlmaWVkLVNpbmNlJywgci5sYXN0TW9kaWZpZWRbZl0pLCByLmV0YWdbZl0gJiYgeS5zZXRSZXF1ZXN0SGVhZGVyKCdJZi1Ob25lLU1hdGNoJywgci5ldGFnW2ZdKSksIChvLmRhdGEgJiYgby5oYXNDb250ZW50ICYmIG8uY29udGVudFR5cGUgIT09ICExIHx8IGMuY29udGVudFR5cGUpICYmIHkuc2V0UmVxdWVzdEhlYWRlcignQ29udGVudC1UeXBlJywgby5jb250ZW50VHlwZSksIHkuc2V0UmVxdWVzdEhlYWRlcignQWNjZXB0Jywgby5kYXRhVHlwZXNbMF0gJiYgby5hY2NlcHRzW28uZGF0YVR5cGVzWzBdXSA/IG8uYWNjZXB0c1tvLmRhdGFUeXBlc1swXV0gKyAoJyonICE9PSBvLmRhdGFUeXBlc1swXSA/ICcsICcgKyBIYiArICc7IHE9MC4wMScgOiAnJykgOiBvLmFjY2VwdHNbJyonXSk7CiAgICAgICAgICAgICAgICAgICAgZm9yIChtIGluIG8uaGVhZGVycykKICAgICAgICAgICAgICAgICAgICAgICAgeS5zZXRSZXF1ZXN0SGVhZGVyKG0sIG8uaGVhZGVyc1ttXSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKG8uYmVmb3JlU2VuZCAmJiAoby5iZWZvcmVTZW5kLmNhbGwocCwgeSwgbykgPT09ICExIHx8IGspKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geS5hYm9ydCgpOwogICAgICAgICAgICAgICAgICAgIGlmICh4ID0gJ2Fib3J0JywgdC5hZGQoby5jb21wbGV0ZSksIHkuZG9uZShvLnN1Y2Nlc3MpLCB5LmZhaWwoby5lcnJvciksIGUgPSBLYihHYiwgbywgYywgeSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHkucmVhZHlTdGF0ZSA9IDEsIGwgJiYgcS50cmlnZ2VyKCdhamF4U2VuZCcsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG8KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0pLCBrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHk7CiAgICAgICAgICAgICAgICAgICAgICAgIG8uYXN5bmMgJiYgby50aW1lb3V0ID4gMCAmJiAoaSA9IGEuc2V0VGltZW91dChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LmFib3J0KCd0aW1lb3V0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIG8udGltZW91dCkpOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgayA9ICExLCBlLnNlbmQodiwgQSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKHopIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IHo7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBBKC0xLCB6KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBBKC0xLCAnTm8gVHJhbnNwb3J0Jyk7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gQShiLCBjLCBkLCBoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBqLCBtLCBuLCB2LCB3LCB4ID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgayB8fCAoayA9ICEwLCBpICYmIGEuY2xlYXJUaW1lb3V0KGkpLCBlID0gdm9pZCAwLCBnID0gaCB8fCAnJywgeS5yZWFkeVN0YXRlID0gYiA+IDAgPyA0IDogMCwgaiA9IGIgPj0gMjAwICYmIGIgPCAzMDAgfHwgMzA0ID09PSBiLCBkICYmICh2ID0gTWIobywgeSwgZCkpLCB2ID0gTmIobywgdiwgeSwgaiksIGogPyAoby5pZk1vZGlmaWVkICYmICh3ID0geS5nZXRSZXNwb25zZUhlYWRlcignTGFzdC1Nb2RpZmllZCcpLCB3ICYmIChyLmxhc3RNb2RpZmllZFtmXSA9IHcpLCB3ID0geS5nZXRSZXNwb25zZUhlYWRlcignZXRhZycpLCB3ICYmIChyLmV0YWdbZl0gPSB3KSksIDIwNCA9PT0gYiB8fCAnSEVBRCcgPT09IG8udHlwZSA/IHggPSAnbm9jb250ZW50JyA6IDMwNCA9PT0gYiA/IHggPSAnbm90bW9kaWZpZWQnIDogKHggPSB2LnN0YXRlLCBtID0gdi5kYXRhLCBuID0gdi5lcnJvciwgaiA9ICFuKSkgOiAobiA9IHgsICFiICYmIHggfHwgKHggPSAnZXJyb3InLCBiIDwgMCAmJiAoYiA9IDApKSksIHkuc3RhdHVzID0gYiwgeS5zdGF0dXNUZXh0ID0gKGMgfHwgeCkgKyAnJywgaiA/IHMucmVzb2x2ZVdpdGgocCwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5CiAgICAgICAgICAgICAgICAgICAgICAgIF0pIDogcy5yZWplY3RXaXRoKHAsIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbgogICAgICAgICAgICAgICAgICAgICAgICBdKSwgeS5zdGF0dXNDb2RlKHUpLCB1ID0gdm9pZCAwLCBsICYmIHEudHJpZ2dlcihqID8gJ2FqYXhTdWNjZXNzJyA6ICdhamF4RXJyb3InLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogPyBtIDogbgogICAgICAgICAgICAgICAgICAgICAgICBdKSwgdC5maXJlV2l0aChwLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgeAogICAgICAgICAgICAgICAgICAgICAgICBdKSwgbCAmJiAocS50cmlnZ2VyKCdhamF4Q29tcGxldGUnLCBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbwogICAgICAgICAgICAgICAgICAgICAgICBdKSwgLS1yLmFjdGl2ZSB8fCByLmV2ZW50LnRyaWdnZXIoJ2FqYXhTdG9wJykpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHk7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgZ2V0SlNPTjogZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5nZXQoYSwgYiwgYywgJ2pzb24nKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBnZXRTY3JpcHQ6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIuZ2V0KGEsIHZvaWQgMCwgYiwgJ3NjcmlwdCcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSwgci5lYWNoKFsKICAgICAgICAgICAgICAgICdnZXQnLAogICAgICAgICAgICAgICAgJ3Bvc3QnCiAgICAgICAgICAgIF0sIGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByW2JdID0gZnVuY3Rpb24gKGEsIGMsIGQsIGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gci5pc0Z1bmN0aW9uKGMpICYmIChlID0gZSB8fCBkLCBkID0gYywgYyA9IHZvaWQgMCksIHIuYWpheChyLmV4dGVuZCh7CiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogYSwKICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogYiwKICAgICAgICAgICAgICAgICAgICAgICAgZGF0YVR5cGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IGQKICAgICAgICAgICAgICAgICAgICB9LCByLmlzUGxhaW5PYmplY3QoYSkgJiYgYSkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSksIHIuX2V2YWxVcmwgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIHIuYWpheCh7CiAgICAgICAgICAgICAgICAgICAgdXJsOiBhLAogICAgICAgICAgICAgICAgICAgIHR5cGU6ICdHRVQnLAogICAgICAgICAgICAgICAgICAgIGRhdGFUeXBlOiAnc2NyaXB0JywKICAgICAgICAgICAgICAgICAgICBjYWNoZTogITAsCiAgICAgICAgICAgICAgICAgICAgYXN5bmM6ICExLAogICAgICAgICAgICAgICAgICAgIGdsb2JhbDogITEsCiAgICAgICAgICAgICAgICAgICAgJ3Rocm93cyc6ICEwCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSwgci5mbi5leHRlbmQoewogICAgICAgICAgICAgICAgd3JhcEFsbDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1swXSAmJiAoci5pc0Z1bmN0aW9uKGEpICYmIChhID0gYS5jYWxsKHRoaXNbMF0pKSwgYiA9IHIoYSwgdGhpc1swXS5vd25lckRvY3VtZW50KS5lcSgwKS5jbG9uZSghMCksIHRoaXNbMF0ucGFyZW50Tm9kZSAmJiBiLmluc2VydEJlZm9yZSh0aGlzWzBdKSwgYi5tYXAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChhLmZpcnN0RWxlbWVudENoaWxkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEuZmlyc3RFbGVtZW50Q2hpbGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgIH0pLmFwcGVuZCh0aGlzKSksIHRoaXM7CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgd3JhcElubmVyOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiByLmlzRnVuY3Rpb24oYSkgPyB0aGlzLmVhY2goZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcih0aGlzKS53cmFwSW5uZXIoYS5jYWxsKHRoaXMsIGIpKTsKICAgICAgICAgICAgICAgICAgICB9KSA6IHRoaXMuZWFjaChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gcih0aGlzKSwgYyA9IGIuY29udGVudHMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYy5sZW5ndGggPyBjLndyYXBBbGwoYSkgOiBiLmFwcGVuZChhKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB3cmFwOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gci5pc0Z1bmN0aW9uKGEpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVhY2goZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcih0aGlzKS53cmFwQWxsKGIgPyBhLmNhbGwodGhpcywgYykgOiBhKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB1bndyYXA6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucGFyZW50KGEpLm5vdCgnYm9keScpLmVhY2goZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByKHRoaXMpLnJlcGxhY2VXaXRoKHRoaXMuY2hpbGROb2Rlcyk7CiAgICAgICAgICAgICAgICAgICAgfSksIHRoaXM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pLCByLmV4cHIucHNldWRvcy5oaWRkZW4gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuICFyLmV4cHIucHNldWRvcy52aXNpYmxlKGEpOwogICAgICAgICAgICB9LCByLmV4cHIucHNldWRvcy52aXNpYmxlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAhIShhLm9mZnNldFdpZHRoIHx8IGEub2Zmc2V0SGVpZ2h0IHx8IGEuZ2V0Q2xpZW50UmVjdHMoKS5sZW5ndGgpOwogICAgICAgICAgICB9LCByLmFqYXhTZXR0aW5ncy54aHIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkXzhjYzlmOWU0ZmJhNWI1NDMgPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKSwgJF9fX29sZF81OTNjYzhlYTVmMDU5MTVmID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0Jyk7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzhjYzlmOWU0ZmJhNWI1NDMpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19tb2NrXzAwNDY1Mjg0MDA0ZDRhYTguWE1MSHR0cFJlcXVlc3QpKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF81OTNjYzhlYTVmMDU5MTVmKQogICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja18wMDQ2NTI4NDAwNGQ0YWE4LlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgYS5YTUxIdHRwUmVxdWVzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzhjYzlmOWU0ZmJhNWI1NDMpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfOGNjOWY5ZTRmYmE1YjU0MykpOwogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzU5M2NjOGVhNWYwNTkxNWYpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfNTkzY2M4ZWE1ZjA1OTE1ZikpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgT2IgPSB7CiAgICAgICAgICAgICAgICAgICAgMDogMjAwLAogICAgICAgICAgICAgICAgICAgIDEyMjM6IDIwNAogICAgICAgICAgICAgICAgfSwgUGIgPSByLmFqYXhTZXR0aW5ncy54aHIoKTsKICAgICAgICAgICAgby5jb3JzID0gISFQYiAmJiAnd2l0aENyZWRlbnRpYWxzJyBpbiBQYiwgby5hamF4ID0gUGIgPSAhIVBiLCByLmFqYXhUcmFuc3BvcnQoZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgIHZhciBjLCBkOwogICAgICAgICAgICAgICAgaWYgKG8uY29ycyB8fCBQYiAmJiAhYi5jcm9zc0RvbWFpbikKICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICBzZW5kOiBmdW5jdGlvbiAoZSwgZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcsIGggPSBiLnhocigpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGgub3BlbihiLnR5cGUsIGIudXJsLCBiLmFzeW5jLCBiLnVzZXJuYW1lLCBiLnBhc3N3b3JkKSwgYi54aHJGaWVsZHMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChnIGluIGIueGhyRmllbGRzKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoW2ddID0gYi54aHJGaWVsZHNbZ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLm1pbWVUeXBlICYmIGgub3ZlcnJpZGVNaW1lVHlwZSAmJiBoLm92ZXJyaWRlTWltZVR5cGUoYi5taW1lVHlwZSksIGIuY3Jvc3NEb21haW4gfHwgZVsnWC1SZXF1ZXN0ZWQtV2l0aCddIHx8IChlWydYLVJlcXVlc3RlZC1XaXRoJ10gPSAnWE1MSHR0cFJlcXVlc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZyBpbiBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGguc2V0UmVxdWVzdEhlYWRlcihnLCBlW2ddKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgJiYgKGMgPSBkID0gaC5vbmxvYWQgPSBoLm9uZXJyb3IgPSBoLm9uYWJvcnQgPSBoLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IG51bGwsICdhYm9ydCcgPT09IGEgPyBoLmFib3J0KCkgOiAnZXJyb3InID09PSBhID8gJ251bWJlcicgIT0gdHlwZW9mIGguc3RhdHVzID8gZigwLCAnZXJyb3InKSA6IGYoaC5zdGF0dXMsIGguc3RhdHVzVGV4dCkgOiBmKE9iW2guc3RhdHVzXSB8fCBoLnN0YXR1cywgaC5zdGF0dXNUZXh0LCAndGV4dCcgIT09IChoLnJlc3BvbnNlVHlwZSB8fCAndGV4dCcpIHx8ICdzdHJpbmcnICE9IHR5cGVvZiBoLnJlc3BvbnNlVGV4dCA/IHsgYmluYXJ5OiBoLnJlc3BvbnNlIH0gOiB7IHRleHQ6IGgucmVzcG9uc2VUZXh0IH0sIGguZ2V0QWxsUmVzcG9uc2VIZWFkZXJzKCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaC5vbmxvYWQgPSBjKCksIGQgPSBoLm9uZXJyb3IgPSBjKCdlcnJvcicpLCB2b2lkIDAgIT09IGgub25hYm9ydCA/IGgub25hYm9ydCA9IGQgOiBoLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0ID09PSBoLnJlYWR5U3RhdGUgJiYgYS5zZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyAmJiBkKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBjID0gYygnYWJvcnQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaC5zZW5kKGIuaGFzQ29udGVudCAmJiBiLmRhdGEgfHwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFib3J0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjICYmIGMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0pLCByLmFqYXhQcmVmaWx0ZXIoZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGEuY3Jvc3NEb21haW4gJiYgKGEuY29udGVudHMuc2NyaXB0ID0gITEpOwogICAgICAgICAgICB9KSwgci5hamF4U2V0dXAoewogICAgICAgICAgICAgICAgYWNjZXB0czogeyBzY3JpcHQ6ICd0ZXh0L2phdmFzY3JpcHQsIGFwcGxpY2F0aW9uL2phdmFzY3JpcHQsIGFwcGxpY2F0aW9uL2VjbWFzY3JpcHQsIGFwcGxpY2F0aW9uL3gtZWNtYXNjcmlwdCcgfSwKICAgICAgICAgICAgICAgIGNvbnRlbnRzOiB7IHNjcmlwdDogL1xiKD86amF2YXxlY21hKXNjcmlwdFxiLyB9LAogICAgICAgICAgICAgICAgY29udmVydGVyczogewogICAgICAgICAgICAgICAgICAgICd0ZXh0IHNjcmlwdCc6IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmdsb2JhbEV2YWwoYSksIGE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KSwgci5hamF4UHJlZmlsdGVyKCdzY3JpcHQnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdm9pZCAwID09PSBhLmNhY2hlICYmIChhLmNhY2hlID0gITEpLCBhLmNyb3NzRG9tYWluICYmIChhLnR5cGUgPSAnR0VUJyk7CiAgICAgICAgICAgIH0pLCByLmFqYXhUcmFuc3BvcnQoJ3NjcmlwdCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBpZiAoYS5jcm9zc0RvbWFpbikgewogICAgICAgICAgICAgICAgICAgIHZhciBiLCBjOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHNlbmQ6IGZ1bmN0aW9uIChlLCBmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gcignPHNjcmlwdD4nKS5wcm9wKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyc2V0OiBhLnNjcmlwdENoYXJzZXQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3JjOiBhLnVybAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkub24oJ2xvYWQgZXJyb3InLCBjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLnJlbW92ZSgpLCBjID0gbnVsbCwgYSAmJiBmKCdlcnJvcicgPT09IGEudHlwZSA/IDQwNCA6IDIwMCwgYS50eXBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBkLmhlYWQuYXBwZW5kQ2hpbGQoYlswXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgIGFib3J0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjICYmIGMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgUWIgPSBbXSwgUmIgPSAvKD0pXD8oPz0mfCQpfFw/XD8vOwogICAgICAgICAgICByLmFqYXhTZXR1cCh7CiAgICAgICAgICAgICAgICBqc29ucDogJ2NhbGxiYWNrJywKICAgICAgICAgICAgICAgIGpzb25wQ2FsbGJhY2s6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFFiLnBvcCgpIHx8IHIuZXhwYW5kbyArICdfJyArIHJiKys7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbYV0gPSAhMCwgYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSksIHIuYWpheFByZWZpbHRlcignanNvbiBqc29ucCcsIGZ1bmN0aW9uIChiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICB2YXIgZSwgZiwgZywgaCA9IGIuanNvbnAgIT09ICExICYmIChSYi50ZXN0KGIudXJsKSA/ICd1cmwnIDogJ3N0cmluZycgPT0gdHlwZW9mIGIuZGF0YSAmJiAwID09PSAoYi5jb250ZW50VHlwZSB8fCAnJykuaW5kZXhPZignYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZGVkJykgJiYgUmIudGVzdChiLmRhdGEpICYmICdkYXRhJyk7CiAgICAgICAgICAgICAgICBpZiAoaCB8fCAnanNvbnAnID09PSBiLmRhdGFUeXBlc1swXSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA9IGIuanNvbnBDYWxsYmFjayA9IHIuaXNGdW5jdGlvbihiLmpzb25wQ2FsbGJhY2spID8gYi5qc29ucENhbGxiYWNrKCkgOiBiLmpzb25wQ2FsbGJhY2ssIGggPyBiW2hdID0gYltoXS5yZXBsYWNlKFJiLCAnJDEnICsgZSkgOiBiLmpzb25wICE9PSAhMSAmJiAoYi51cmwgKz0gKHNiLnRlc3QoYi51cmwpID8gJyYnIDogJz8nKSArIGIuanNvbnAgKyAnPScgKyBlKSwgYi5jb252ZXJ0ZXJzWydzY3JpcHQganNvbiddID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZyB8fCByLmVycm9yKGUgKyAnIHdhcyBub3QgY2FsbGVkJyksIGdbMF07CiAgICAgICAgICAgICAgICAgICAgfSwgYi5kYXRhVHlwZXNbMF0gPSAnanNvbicsIGYgPSBhW2VdLCBhW2VdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBnID0gYXJndW1lbnRzOwogICAgICAgICAgICAgICAgICAgIH0sIGQuYWx3YXlzKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwID09PSBmID8gcihhKS5yZW1vdmVQcm9wKGUpIDogYVtlXSA9IGYsIGJbZV0gJiYgKGIuanNvbnBDYWxsYmFjayA9IGMuanNvbnBDYWxsYmFjaywgUWIucHVzaChlKSksIGcgJiYgci5pc0Z1bmN0aW9uKGYpICYmIGYoZ1swXSksIGcgPSBmID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIH0pLCAnc2NyaXB0JzsKICAgICAgICAgICAgfSksIG8uY3JlYXRlSFRNTERvY3VtZW50ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSBkLmltcGxlbWVudGF0aW9uLmNyZWF0ZUhUTUxEb2N1bWVudCgnJykuYm9keTsKICAgICAgICAgICAgICAgIHJldHVybiBhLmlubmVySFRNTCA9ICc8Zm9ybT48L2Zvcm0+PGZvcm0+PC9mb3JtPicsIDIgPT09IGEuY2hpbGROb2Rlcy5sZW5ndGg7CiAgICAgICAgICAgIH0oKSwgci5wYXJzZUhUTUwgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnICE9IHR5cGVvZiBhKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICdib29sZWFuJyA9PSB0eXBlb2YgYiAmJiAoYyA9IGIsIGIgPSAhMSk7CiAgICAgICAgICAgICAgICB2YXIgZSwgZiwgZzsKICAgICAgICAgICAgICAgIHJldHVybiBiIHx8IChvLmNyZWF0ZUhUTUxEb2N1bWVudCA/IChiID0gZC5pbXBsZW1lbnRhdGlvbi5jcmVhdGVIVE1MRG9jdW1lbnQoJycpLCBlID0gYi5jcmVhdGVFbGVtZW50KCdiYXNlJyksIGUuaHJlZiA9IGQubG9jYXRpb24uaHJlZiwgYi5oZWFkLmFwcGVuZENoaWxkKGUpKSA6IGIgPSBkKSwgZiA9IEIuZXhlYyhhKSwgZyA9ICFjICYmIFtdLCBmID8gW2IuY3JlYXRlRWxlbWVudChmWzFdKV0gOiAoZiA9IHBhKFthXSwgYiwgZyksIGcgJiYgZy5sZW5ndGggJiYgcihnKS5yZW1vdmUoKSwgci5tZXJnZShbXSwgZi5jaGlsZE5vZGVzKSk7CiAgICAgICAgICAgIH0sIHIuZm4ubG9hZCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB2YXIgZCwgZSwgZiwgZyA9IHRoaXMsIGggPSBhLmluZGV4T2YoJyAnKTsKICAgICAgICAgICAgICAgIHJldHVybiBoID4gLTEgJiYgKGQgPSBtYihhLnNsaWNlKGgpKSwgYSA9IGEuc2xpY2UoMCwgaCkpLCByLmlzRnVuY3Rpb24oYikgPyAoYyA9IGIsIGIgPSB2b2lkIDApIDogYiAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgYiAmJiAoZSA9ICdQT1NUJyksIGcubGVuZ3RoID4gMCAmJiByLmFqYXgoewogICAgICAgICAgICAgICAgICAgIHVybDogYSwKICAgICAgICAgICAgICAgICAgICB0eXBlOiBlIHx8ICdHRVQnLAogICAgICAgICAgICAgICAgICAgIGRhdGFUeXBlOiAnaHRtbCcsCiAgICAgICAgICAgICAgICAgICAgZGF0YTogYgogICAgICAgICAgICAgICAgfSkuZG9uZShmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGYgPSBhcmd1bWVudHMsIGcuaHRtbChkID8gcignPGRpdj4nKS5hcHBlbmQoci5wYXJzZUhUTUwoYSkpLmZpbmQoZCkgOiBhKTsKICAgICAgICAgICAgICAgIH0pLmFsd2F5cyhjICYmIGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgZy5lYWNoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYy5hcHBseSh0aGlzLCBmIHx8IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEucmVzcG9uc2VUZXh0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEKICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KSwgdGhpczsKICAgICAgICAgICAgfSwgci5lYWNoKFsKICAgICAgICAgICAgICAgICdhamF4U3RhcnQnLAogICAgICAgICAgICAgICAgJ2FqYXhTdG9wJywKICAgICAgICAgICAgICAgICdhamF4Q29tcGxldGUnLAogICAgICAgICAgICAgICAgJ2FqYXhFcnJvcicsCiAgICAgICAgICAgICAgICAnYWpheFN1Y2Nlc3MnLAogICAgICAgICAgICAgICAgJ2FqYXhTZW5kJwogICAgICAgICAgICBdLCBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgci5mbltiXSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMub24oYiwgYSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9KSwgci5leHByLnBzZXVkb3MuYW5pbWF0ZWQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIHIuZ3JlcChyLnRpbWVycywgZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA9PT0gYi5lbGVtOwogICAgICAgICAgICAgICAgfSkubGVuZ3RoOwogICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBTYihhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gci5pc1dpbmRvdyhhKSA/IGEgOiA5ID09PSBhLm5vZGVUeXBlICYmIGEuZGVmYXVsdFZpZXc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgci5vZmZzZXQgPSB7CiAgICAgICAgICAgICAgICBzZXRPZmZzZXQ6IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQsIGUsIGYsIGcsIGgsIGksIGosIGsgPSByLmNzcyhhLCAncG9zaXRpb24nKSwgbCA9IHIoYSksIG0gPSB7fTsKICAgICAgICAgICAgICAgICAgICAnc3RhdGljJyA9PT0gayAmJiAoYS5zdHlsZS5wb3NpdGlvbiA9ICdyZWxhdGl2ZScpLCBoID0gbC5vZmZzZXQoKSwgZiA9IHIuY3NzKGEsICd0b3AnKSwgaSA9IHIuY3NzKGEsICdsZWZ0JyksIGogPSAoJ2Fic29sdXRlJyA9PT0gayB8fCAnZml4ZWQnID09PSBrKSAmJiAoZiArIGkpLmluZGV4T2YoJ2F1dG8nKSA+IC0xLCBqID8gKGQgPSBsLnBvc2l0aW9uKCksIGcgPSBkLnRvcCwgZSA9IGQubGVmdCkgOiAoZyA9IHBhcnNlRmxvYXQoZikgfHwgMCwgZSA9IHBhcnNlRmxvYXQoaSkgfHwgMCksIHIuaXNGdW5jdGlvbihiKSAmJiAoYiA9IGIuY2FsbChhLCBjLCByLmV4dGVuZCh7fSwgaCkpKSwgbnVsbCAhPSBiLnRvcCAmJiAobS50b3AgPSBiLnRvcCAtIGgudG9wICsgZyksIG51bGwgIT0gYi5sZWZ0ICYmIChtLmxlZnQgPSBiLmxlZnQgLSBoLmxlZnQgKyBlKSwgJ3VzaW5nJyBpbiBiID8gYi51c2luZy5jYWxsKGEsIG0pIDogbC5jc3MobSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sIHIuZm4uZXh0ZW5kKHsKICAgICAgICAgICAgICAgIG9mZnNldDogZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PT0gYSA/IHRoaXMgOiB0aGlzLmVhY2goZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHIub2Zmc2V0LnNldE9mZnNldCh0aGlzLCBhLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIsIGMsIGQsIGUsIGYgPSB0aGlzWzBdOwogICAgICAgICAgICAgICAgICAgIGlmIChmKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZi5nZXRDbGllbnRSZWN0cygpLmxlbmd0aCA/IChkID0gZi5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKSwgZC53aWR0aCB8fCBkLmhlaWdodCA/IChlID0gZi5vd25lckRvY3VtZW50LCBjID0gU2IoZSksIGIgPSBlLmRvY3VtZW50RWxlbWVudCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9wOiBkLnRvcCArIGMucGFnZVlPZmZzZXQgLSBiLmNsaWVudFRvcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IGQubGVmdCArIGMucGFnZVhPZmZzZXQgLSBiLmNsaWVudExlZnQKICAgICAgICAgICAgICAgICAgICAgICAgfSkgOiBkKSA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvcDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IDAKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBwb3NpdGlvbjogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzWzBdKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhLCBiLCBjID0gdGhpc1swXSwgZCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3A6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVmdDogMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdmaXhlZCcgPT09IHIuY3NzKGMsICdwb3NpdGlvbicpID8gYiA9IGMuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCkgOiAoYSA9IHRoaXMub2Zmc2V0UGFyZW50KCksIGIgPSB0aGlzLm9mZnNldCgpLCByLm5vZGVOYW1lKGFbMF0sICdodG1sJykgfHwgKGQgPSBhLm9mZnNldCgpKSwgZCA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvcDogZC50b3AgKyByLmNzcyhhWzBdLCAnYm9yZGVyVG9wV2lkdGgnLCAhMCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWZ0OiBkLmxlZnQgKyByLmNzcyhhWzBdLCAnYm9yZGVyTGVmdFdpZHRoJywgITApCiAgICAgICAgICAgICAgICAgICAgICAgIH0pLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3A6IGIudG9wIC0gZC50b3AgLSByLmNzcyhjLCAnbWFyZ2luVG9wJywgITApLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVmdDogYi5sZWZ0IC0gZC5sZWZ0IC0gci5jc3MoYywgJ21hcmdpbkxlZnQnLCAhMCkKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgb2Zmc2V0UGFyZW50OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubWFwKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB0aGlzLm9mZnNldFBhcmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGEgJiYgJ3N0YXRpYycgPT09IHIuY3NzKGEsICdwb3NpdGlvbicpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEub2Zmc2V0UGFyZW50OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSB8fCBxYTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSksIHIuZWFjaCh7CiAgICAgICAgICAgICAgICBzY3JvbGxMZWZ0OiAncGFnZVhPZmZzZXQnLAogICAgICAgICAgICAgICAgc2Nyb2xsVG9wOiAncGFnZVlPZmZzZXQnCiAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9ICdwYWdlWU9mZnNldCcgPT09IGI7CiAgICAgICAgICAgICAgICByLmZuW2FdID0gZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUyh0aGlzLCBmdW5jdGlvbiAoYSwgZCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IFNiKGEpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09PSBlID8gZiA/IGZbYl0gOiBhW2RdIDogdm9pZCAoZiA/IGYuc2Nyb2xsVG8oYyA/IGYucGFnZVhPZmZzZXQgOiBlLCBjID8gZSA6IGYucGFnZVlPZmZzZXQpIDogYVtkXSA9IGUpOwogICAgICAgICAgICAgICAgICAgIH0sIGEsIGQsIGFyZ3VtZW50cy5sZW5ndGgpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSksIHIuZWFjaChbCiAgICAgICAgICAgICAgICAndG9wJywKICAgICAgICAgICAgICAgICdsZWZ0JwogICAgICAgICAgICBdLCBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgci5jc3NIb29rc1tiXSA9IE9hKG8ucGl4ZWxQb3NpdGlvbiwgZnVuY3Rpb24gKGEsIGMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMgPSBOYShhLCBiKSwgTGEudGVzdChjKSA/IHIoYSkucG9zaXRpb24oKVtiXSArICdweCcgOiBjOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0pLCByLmVhY2goewogICAgICAgICAgICAgICAgSGVpZ2h0OiAnaGVpZ2h0JywKICAgICAgICAgICAgICAgIFdpZHRoOiAnd2lkdGgnCiAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICByLmVhY2goewogICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6ICdpbm5lcicgKyBhLAogICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGIsCiAgICAgICAgICAgICAgICAgICAgJyc6ICdvdXRlcicgKyBhCiAgICAgICAgICAgICAgICB9LCBmdW5jdGlvbiAoYywgZCkgewogICAgICAgICAgICAgICAgICAgIHIuZm5bZF0gPSBmdW5jdGlvbiAoZSwgZikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGFyZ3VtZW50cy5sZW5ndGggJiYgKGMgfHwgJ2Jvb2xlYW4nICE9IHR5cGVvZiBlKSwgaCA9IGMgfHwgKGUgPT09ICEwIHx8IGYgPT09ICEwID8gJ21hcmdpbicgOiAnYm9yZGVyJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBTKHRoaXMsIGZ1bmN0aW9uIChiLCBjLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLmlzV2luZG93KGIpID8gMCA9PT0gZC5pbmRleE9mKCdvdXRlcicpID8gYlsnaW5uZXInICsgYV0gOiBiLmRvY3VtZW50LmRvY3VtZW50RWxlbWVudFsnY2xpZW50JyArIGFdIDogOSA9PT0gYi5ub2RlVHlwZSA/IChmID0gYi5kb2N1bWVudEVsZW1lbnQsIE1hdGgubWF4KGIuYm9keVsnc2Nyb2xsJyArIGFdLCBmWydzY3JvbGwnICsgYV0sIGIuYm9keVsnb2Zmc2V0JyArIGFdLCBmWydvZmZzZXQnICsgYV0sIGZbJ2NsaWVudCcgKyBhXSkpIDogdm9pZCAwID09PSBlID8gci5jc3MoYiwgYywgaCkgOiByLnN0eWxlKGIsIGMsIGUsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICB9LCBiLCBnID8gZSA6IHZvaWQgMCwgZyk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9KSwgci5mbi5leHRlbmQoewogICAgICAgICAgICAgICAgYmluZDogZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5vbihhLCBudWxsLCBiLCBjKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICB1bmJpbmQ6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMub2ZmKGEsIG51bGwsIGIpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIGRlbGVnYXRlOiBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm9uKGIsIGEsIGMsIGQpOwogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIHVuZGVsZWdhdGU6IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDEgPT09IGFyZ3VtZW50cy5sZW5ndGggPyB0aGlzLm9mZihhLCAnKionKSA6IHRoaXMub2ZmKGIsIGEgfHwgJyoqJywgYyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pLCByLnBhcnNlSlNPTiA9IEpTT04ucGFyc2UsICdmdW5jdGlvbicgPT0gdHlwZW9mIGRlZmluZSAmJiBkZWZpbmUuYW1kICYmIGRlZmluZSgnanF1ZXJ5JywgW10sIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiByOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdmFyIFRiID0gYS5qUXVlcnksIFViID0gYS4kOwogICAgICAgICAgICByZXR1cm4gci5ub0NvbmZsaWN0ID0gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhLiQgPT09IHIgJiYgKGEuJCA9IFViKSwgYiAmJiBhLmpRdWVyeSA9PT0gciAmJiAoYS5qUXVlcnkgPSBUYiksIHI7CiAgICAgICAgICAgIH0sIGIgfHwgKGEualF1ZXJ5ID0gYS4kID0gciksIHI7CiAgICAgICAgfSk7CiAgICB9KCkpCn0="},{"name":"sugarcoat-ef97e7e3be5379b2e3627791e936581f734402bd","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfMjc3YzYyYzZkNDc5NTk3NiA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja18yNzdjNjJjNmQ0Nzk1OTc2KTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgdmFyIGFhID0gdGhpcyB8fCBzZWxmLCBsID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBhID0gYS5zcGxpdCgnLicpOwogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYWE7CiAgICAgICAgICAgICAgICAgICAgYVswXSBpbiBjIHx8ICd1bmRlZmluZWQnID09IHR5cGVvZiBjLmV4ZWNTY3JpcHQgfHwgYy5leGVjU2NyaXB0KCd2YXIgJyArIGFbMF0pOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQ7IGEubGVuZ3RoICYmIChkID0gYS5zaGlmdCgpKTspCiAgICAgICAgICAgICAgICAgICAgICAgIGEubGVuZ3RoIHx8IHZvaWQgMCA9PT0gYiA/IGMgPSBjW2RdICYmIGNbZF0gIT09IE9iamVjdC5wcm90b3R5cGVbZF0gPyBjW2RdIDogY1tkXSA9IHt9IDogY1tkXSA9IGI7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyBpbiBiKQogICAgICAgICAgICAgICAgICAgICAgICBiLmhhc093blByb3BlcnR5KGMpICYmIChhW2NdID0gYltjXSk7CiAgICAgICAgICAgICAgICB9LCBxID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiIGluIGEpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmhhc093blByb3BlcnR5KGIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciByID0gL14oPzooPzpodHRwcz98bWFpbHRvfGZ0cCk6fFteOi8/I10qKD86Wy8/I118JCkpL2k7CiAgICAgICAgICAgIHZhciB0ID0gd2luZG93LCB1ID0gd2luZG93Lmhpc3RvcnksIHYgPSBkb2N1bWVudCwgdyA9IG5hdmlnYXRvciwgeCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdi5hZGRFdmVudExpc3RlbmVyID8gdi5hZGRFdmVudExpc3RlbmVyKGEsIGIsICExKSA6IHYuYXR0YWNoRXZlbnQgJiYgdi5hdHRhY2hFdmVudCgnb24nICsgYSwgYik7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgeSA9IHt9LCB6ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHkuVEFHR0lORyA9IHkuVEFHR0lORyB8fCBbXTsKICAgICAgICAgICAgICAgICAgICB5LlRBR0dJTkdbMV0gPSAhMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBBID0gLzpbMC05XSskLywgQiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IGEuc3BsaXQoJyYnKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gMDsgZCA8IGEubGVuZ3RoOyBkKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhW2RdLnNwbGl0KCc9Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkZWNvZGVVUklDb21wb25lbnQoZVswXSkucmVwbGFjZSgvXCsvZywgJyAnKSA9PT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiID0gZS5zbGljZSgxKS5qb2luKCc9JyksIGMgPyBiIDogZGVjb2RlVVJJQ29tcG9uZW50KGIpLnJlcGxhY2UoL1wrL2csICcgJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgRSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYiAmJiAoYiA9IFN0cmluZyhiKS50b0xvd2VyQ2FzZSgpKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3Byb3RvY29sJyA9PT0gYiB8fCAncG9ydCcgPT09IGIpCiAgICAgICAgICAgICAgICAgICAgICAgIGEucHJvdG9jb2wgPSBDKGEucHJvdG9jb2wpIHx8IEModC5sb2NhdGlvbi5wcm90b2NvbCk7CiAgICAgICAgICAgICAgICAgICAgJ3BvcnQnID09PSBiID8gYS5wb3J0ID0gU3RyaW5nKE51bWJlcihhLmhvc3RuYW1lID8gYS5wb3J0IDogdC5sb2NhdGlvbi5wb3J0KSB8fCAoJ2h0dHAnID09IGEucHJvdG9jb2wgPyA4MCA6ICdodHRwcycgPT0gYS5wcm90b2NvbCA/IDQ0MyA6ICcnKSkgOiAnaG9zdCcgPT09IGIgJiYgKGEuaG9zdG5hbWUgPSAoYS5ob3N0bmFtZSB8fCB0LmxvY2F0aW9uLmhvc3RuYW1lKS5yZXBsYWNlKEEsICcnKS50b0xvd2VyQ2FzZSgpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRChhLCBiLCB2b2lkIDAsIHZvaWQgMCwgdm9pZCAwKTsKICAgICAgICAgICAgICAgIH0sIEQgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBmID0gQyhhLnByb3RvY29sKTsKICAgICAgICAgICAgICAgICAgICBiICYmIChiID0gU3RyaW5nKGIpLnRvTG93ZXJDYXNlKCkpOwogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgIGNhc2UgJ3VybF9ub19mcmFnbWVudCc6CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgYSAmJiBhLmhyZWYgJiYgKGQgPSBhLmhyZWYuaW5kZXhPZignIycpLCBkID0gMCA+IGQgPyBhLmhyZWYgOiBhLmhyZWYuc3Vic3RyKDAsIGQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgJ3Byb3RvY29sJzoKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGY7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgJ2hvc3QnOgogICAgICAgICAgICAgICAgICAgICAgICBhID0gYS5ob3N0bmFtZS5yZXBsYWNlKEEsICcnKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICBjICYmIChkID0gL153d3dcZCpcLi8uZXhlYyhhKSkgJiYgZFswXSAmJiAoYSA9IGEuc3Vic3RyKGRbMF0ubGVuZ3RoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgJ3BvcnQnOgogICAgICAgICAgICAgICAgICAgICAgICBhID0gU3RyaW5nKE51bWJlcihhLnBvcnQpIHx8ICgnaHR0cCcgPT0gZiA/IDgwIDogJ2h0dHBzJyA9PSBmID8gNDQzIDogJycpKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAncGF0aCc6CiAgICAgICAgICAgICAgICAgICAgICAgIGEucGF0aG5hbWUgfHwgYS5ob3N0bmFtZSB8fCB6KCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAnLycgPT0gYS5wYXRobmFtZS5zdWJzdHIoMCwgMSkgPyBhLnBhdGhuYW1lIDogJy8nICsgYS5wYXRobmFtZTsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEuc3BsaXQoJy8nKTsKICAgICAgICAgICAgICAgICAgICAgICAgMCA8PSAoZCB8fCBbXSkuaW5kZXhPZihhW2EubGVuZ3RoIC0gMV0pICYmIChhW2EubGVuZ3RoIC0gMV0gPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLmpvaW4oJy8nKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAncXVlcnknOgogICAgICAgICAgICAgICAgICAgICAgICBhID0gYS5zZWFyY2gucmVwbGFjZSgnPycsICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiAoYSA9IEIoYSwgZSwgdm9pZCAwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGNhc2UgJ2V4dGVuc2lvbic6CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLnBhdGhuYW1lLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSAxIDwgYS5sZW5ndGggPyBhW2EubGVuZ3RoIC0gMV0gOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEuc3BsaXQoJy8nKVswXTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAnZnJhZ21lbnQnOgogICAgICAgICAgICAgICAgICAgICAgICBhID0gYS5oYXNoLnJlcGxhY2UoJyMnLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhICYmIGEuaHJlZjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9LCBDID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEucmVwbGFjZSgnOicsICcnKS50b0xvd2VyQ2FzZSgpIDogJyc7CiAgICAgICAgICAgICAgICB9LCBGID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHYuY3JlYXRlRWxlbWVudCgnYScpOwogICAgICAgICAgICAgICAgICAgIGEgJiYgKGIuaHJlZiA9IGEpOwogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYi5wYXRobmFtZTsKICAgICAgICAgICAgICAgICAgICAnLycgIT09IGNbMF0gJiYgKGEgfHwgeigpLCBjID0gJy8nICsgYyk7CiAgICAgICAgICAgICAgICAgICAgYSA9IGIuaG9zdG5hbWUucmVwbGFjZShBLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgaHJlZjogYi5ocmVmLAogICAgICAgICAgICAgICAgICAgICAgICBwcm90b2NvbDogYi5wcm90b2NvbCwKICAgICAgICAgICAgICAgICAgICAgICAgaG9zdDogYi5ob3N0LAogICAgICAgICAgICAgICAgICAgICAgICBob3N0bmFtZTogYSwKICAgICAgICAgICAgICAgICAgICAgICAgcGF0aG5hbWU6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgIHNlYXJjaDogYi5zZWFyY2gsCiAgICAgICAgICAgICAgICAgICAgICAgIGhhc2g6IGIuaGFzaCwKICAgICAgICAgICAgICAgICAgICAgICAgcG9ydDogYi5wb3J0CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIGZ1bmN0aW9uIEcoKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gSCwgYiA9IHt9LCBjID0gMDsgYyA8IGEubGVuZ3RoOyArK2MpCiAgICAgICAgICAgICAgICAgICAgYlthW2NdXSA9IGM7CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBJKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVonOwogICAgICAgICAgICAgICAgYSArPSBhLnRvTG93ZXJDYXNlKCkgKyAnMDEyMzQ1Njc4OS1fJzsKICAgICAgICAgICAgICAgIHJldHVybiBhICsgJy4nOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBILCBKOwogICAgICAgICAgICBmdW5jdGlvbiBLKGEpIHsKICAgICAgICAgICAgICAgIEggPSBIIHx8IEkoKTsKICAgICAgICAgICAgICAgIEogPSBKIHx8IEcoKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSBbXSwgYyA9IDA7IGMgPCBhLmxlbmd0aDsgYyArPSAzKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBjICsgMSA8IGEubGVuZ3RoLCBlID0gYyArIDIgPCBhLmxlbmd0aCwgZiA9IGEuY2hhckNvZGVBdChjKSwgZyA9IGQgPyBhLmNoYXJDb2RlQXQoYyArIDEpIDogMCwgaCA9IGUgPyBhLmNoYXJDb2RlQXQoYyArIDIpIDogMCwgayA9IGYgPj4gMjsKICAgICAgICAgICAgICAgICAgICBmID0gKGYgJiAzKSA8PCA0IHwgZyA+PiA0OwogICAgICAgICAgICAgICAgICAgIGcgPSAoZyAmIDE1KSA8PCAyIHwgaCA+PiA2OwogICAgICAgICAgICAgICAgICAgIGggJj0gNjM7CiAgICAgICAgICAgICAgICAgICAgZSB8fCAoaCA9IDY0LCBkIHx8IChnID0gNjQpKTsKICAgICAgICAgICAgICAgICAgICBiLnB1c2goSFtrXSwgSFtmXSwgSFtnXSwgSFtoXSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYi5qb2luKCcnKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBiYShhKSB7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKGspIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZCA8IGEubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGEuY2hhckF0KGQrKyksIHAgPSBKW25dOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHA7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghL15bXHNceGEwXSokLy50ZXN0KG4pKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1Vua25vd24gYmFzZTY0IGVuY29kaW5nIGF0IGNoYXI6ICcgKyBuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBIID0gSCB8fCBJKCk7CiAgICAgICAgICAgICAgICBKID0gSiB8fCBHKCk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gJycsIGQgPSAwOzspIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGIoLTEpLCBmID0gYigwKSwgZyA9IGIoNjQpLCBoID0gYig2NCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDY0ID09PSBoICYmIC0xID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgICAgICBjICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoZSA8PCAyIHwgZiA+PiA0KTsKICAgICAgICAgICAgICAgICAgICA2NCAhPSBnICYmIChjICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoZiA8PCA0ICYgMjQwIHwgZyA+PiAyKSwgNjQgIT0gaCAmJiAoYyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGcgPDwgNiAmIDE5MiB8IGgpKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgTDsKICAgICAgICAgICAgdmFyIE0gPSB2b2lkIDAsIE8gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBjYSwgYiA9IGRhLCBjID0gTigpLCBkID0gZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEoZy50YXJnZXQgfHwgZy5zcmNFbGVtZW50IHx8IHt9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZSA9IGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiKGcudGFyZ2V0IHx8IGcuc3JjRWxlbWVudCB8fCB7fSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgaWYgKCFjLmluaXQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgeCgnbW91c2Vkb3duJywgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHgoJ2tleXVwJywgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHgoJ3N1Ym1pdCcsIGUpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IEhUTUxGb3JtRWxlbWVudC5wcm90b3R5cGUuc3VibWl0OwogICAgICAgICAgICAgICAgICAgICAgICBIVE1MRm9ybUVsZW1lbnQucHJvdG90eXBlLnN1Ym1pdCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLmNhbGwodGhpcyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIGMuaW5pdCA9ICEwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIFAgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiBhLAogICAgICAgICAgICAgICAgICAgICAgICBkb21haW5zOiBiLAogICAgICAgICAgICAgICAgICAgICAgICBmcmFnbWVudDogMiA9PT0gYywKICAgICAgICAgICAgICAgICAgICAgICAgcGxhY2VtZW50OiBjLAogICAgICAgICAgICAgICAgICAgICAgICBmb3JtczogZCwKICAgICAgICAgICAgICAgICAgICAgICAgc2FtZUhvc3Q6IGUKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIE4oKS5kZWNvcmF0b3JzLnB1c2goYSk7CiAgICAgICAgICAgICAgICB9LCBRID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gTigpLmRlY29yYXRvcnMsIGUgPSB7fSwgZiA9IDA7IGYgPCBkLmxlbmd0aDsgKytmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gZFtmXSwgaDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGggPSAhYyB8fCBnLmZvcm1zKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBnLmRvbWFpbnM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGsgPSBhLCBuID0gISFnLnNhbWVIb3N0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoICYmIChuIHx8IGsgIT09IHYubG9jYXRpb24uaG9zdG5hbWUpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBwID0gMDsgcCA8IGgubGVuZ3RoOyBwKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaFtwXSBpbnN0YW5jZW9mIFJlZ0V4cCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoW3BdLnRlc3QoaykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoMCA8PSBrLmluZGV4T2YoaFtwXSkgfHwgbiAmJiAwIDw9IGhbcF0uaW5kZXhPZihrKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaCAmJiAoaCA9IGcucGxhY2VtZW50LCB2b2lkIDAgPT0gaCAmJiAoaCA9IGcuZnJhZ21lbnQgPyAyIDogMSksIGggPT09IGIgJiYgbShlLCBnLmNhbGxiYWNrKCkpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBOKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB7fTsKICAgICAgICAgICAgICAgIHZhciBiID0gdC5nb29nbGVfdGFnX2RhdGE7CiAgICAgICAgICAgICAgICB0Lmdvb2dsZV90YWdfZGF0YSA9IHZvaWQgMCA9PT0gYiA/IGEgOiBiOwogICAgICAgICAgICAgICAgYSA9IHQuZ29vZ2xlX3RhZ19kYXRhOwogICAgICAgICAgICAgICAgYiA9IGEuZ2w7CiAgICAgICAgICAgICAgICBiICYmIGIuZGVjb3JhdG9ycyB8fCAoYiA9IHsgZGVjb3JhdG9yczogW10gfSwgYS5nbCA9IGIpOwogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgZWEgPSAvKC4qPylcKiguKj8pXCooLiopLywgZmEgPSAvKFtePyNdKykoXD9bXiNdKik/KCMuKik/LzsKICAgICAgICAgICAgZnVuY3Rpb24gUihhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFJlZ0V4cCgnKC4qPykoXnwmKScgKyBhICsgJz0oW14mXSopJj8oLiopJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIFQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBbXSwgZDsKICAgICAgICAgICAgICAgIGZvciAoZCBpbiBhKQogICAgICAgICAgICAgICAgICAgIGlmIChhLmhhc093blByb3BlcnR5KGQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYVtkXTsKICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBlICYmIGUgPT09IGUgJiYgbnVsbCAhPT0gZSAmJiAnW29iamVjdCBPYmplY3RdJyAhPT0gZS50b1N0cmluZygpICYmIChjLnB1c2goZCksIGMucHVzaChLKFN0cmluZyhlKSkpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBhID0gYy5qb2luKCcqJyk7CiAgICAgICAgICAgICAgICB2b2lkIDAgIT09IGIgJiYgKGMgPSAneHBfJyArIGIsIGIgPSBoYVtiXShhKSwgYSA9IGEgKyAnKicgKyBbCiAgICAgICAgICAgICAgICAgICAgYywKICAgICAgICAgICAgICAgICAgICBLKFN0cmluZyhiKSkKICAgICAgICAgICAgICAgIF0uam9pbignKicpKTsKICAgICAgICAgICAgICAgIHJldHVybiBbCiAgICAgICAgICAgICAgICAgICAgJzEnLAogICAgICAgICAgICAgICAgICAgIFMoYSksCiAgICAgICAgICAgICAgICAgICAgYQogICAgICAgICAgICAgICAgXS5qb2luKCcqJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGZ1bmN0aW9uIFMoYSwgYikgewogICAgICAgICAgICAgICAgYSA9IFsKICAgICAgICAgICAgICAgICAgICB0Lm5hdmlnYXRvci51c2VyQWdlbnQsCiAgICAgICAgICAgICAgICAgICAgbmV3IERhdGUoKS5nZXRUaW1lem9uZU9mZnNldCgpLAogICAgICAgICAgICAgICAgICAgIHcudXNlckxhbmd1YWdlIHx8IHcubGFuZ3VhZ2UsCiAgICAgICAgICAgICAgICAgICAgTWF0aC5mbG9vcihuZXcgRGF0ZShEYXRlLm5vdygpKS5nZXRUaW1lKCkgLyA2MCAvIDEwMDApIC0gKHZvaWQgMCA9PT0gYiA/IDAgOiBiKSwKICAgICAgICAgICAgICAgICAgICBhCiAgICAgICAgICAgICAgICBdLmpvaW4oJyonKTsKICAgICAgICAgICAgICAgIGlmICghKGIgPSBMKSkgewogICAgICAgICAgICAgICAgICAgIGIgPSBBcnJheSgyNTYpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwOyAyNTYgPiBjOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IGMsIGUgPSAwOyA4ID4gZTsgZSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGQgJiAxID8gZCA+Pj4gMSBeIDM5ODgyOTIzODQgOiBkID4+PiAxOwogICAgICAgICAgICAgICAgICAgICAgICBiW2NdID0gZDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBMID0gYjsKICAgICAgICAgICAgICAgIGIgPSA0Mjk0OTY3Mjk1OwogICAgICAgICAgICAgICAgZm9yIChjID0gMDsgYyA8IGEubGVuZ3RoOyBjKyspCiAgICAgICAgICAgICAgICAgICAgYiA9IGIgPj4+IDggXiBMWyhiIF4gYS5jaGFyQ29kZUF0KGMpKSAmIDI1NV07CiAgICAgICAgICAgICAgICByZXR1cm4gKChiIF4gLTEpID4+PiAwKS50b1N0cmluZygzNik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIFUgPSB7fSwgaGEgPSAoVVsxXSA9IGlhLCBVWzJdID0gamEsIFVbM10gPSBrYSwgVSk7CiAgICAgICAgICAgIGZ1bmN0aW9uIGlhKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICdDSEVDS1NVTV9FWFBfRElTQUJMRUQnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGphKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICdDSEVDS1NVTV9FWFBfRElTQUJMRUQnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGxhKCkgewogICAgICAgICAgICAgICAgdy51c2VyQWdlbnREYXRhICYmIHcudXNlckFnZW50RGF0YS5nZXRIaWdoRW50cm9weVZhbHVlcyhbCiAgICAgICAgICAgICAgICAgICAgJ2FyY2hpdGVjdHVyZScsCiAgICAgICAgICAgICAgICAgICAgJ21vZGVsJywKICAgICAgICAgICAgICAgICAgICAnYml0bmVzcycsCiAgICAgICAgICAgICAgICAgICAgJ3BsYXRmb3JtVmVyc2lvbicsCiAgICAgICAgICAgICAgICAgICAgJ3VhRnVsbFZlcnNpb24nCiAgICAgICAgICAgICAgICBdKS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGthKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICdDSEVDS1NVTV9FWFBfRElTQUJMRUQnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIG1hKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gRih0LmxvY2F0aW9uLmhyZWYpLCBkID0gYy5zZWFyY2gucmVwbGFjZSgnPycsICcnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IEIoZCwgJ19nbCcsICEwKTsKICAgICAgICAgICAgICAgICAgICBiLnF1ZXJ5ID0gVihlIHx8ICcnKSB8fCB7fTsKICAgICAgICAgICAgICAgICAgICBlID0gRShjLCAnZnJhZ21lbnQnKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGUubWF0Y2goUignX2dsJykpOwogICAgICAgICAgICAgICAgICAgIGIuZnJhZ21lbnQgPSBWKGYgJiYgZlszXSB8fCAnJykgfHwge307CiAgICAgICAgICAgICAgICAgICAgYSAmJiBuYShjLCBkLCBlKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gVyhhLCBiKSB7CiAgICAgICAgICAgICAgICBpZiAoYSA9IFIoYSkuZXhlYyhiKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYVsyXSwgZCA9IGFbNF07CiAgICAgICAgICAgICAgICAgICAgYiA9IGFbMV07CiAgICAgICAgICAgICAgICAgICAgZCAmJiAoYiA9IGIgKyBjICsgZCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBuYShhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBkKGYsIGcpIHsKICAgICAgICAgICAgICAgICAgICBmID0gVygnX2dsJywgZik7CiAgICAgICAgICAgICAgICAgICAgZi5sZW5ndGggJiYgKGYgPSBnICsgZik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAodSAmJiB1LnJlcGxhY2VTdGF0ZSkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gUignX2dsJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUudGVzdChiKSB8fCBlLnRlc3QoYykpCiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBFKGEsICdwYXRoJyksIGIgPSBkKGIsICc/JyksIGMgPSBkKGMsICcjJyksIHUucmVwbGFjZVN0YXRlKHt9LCB2b2lkIDAsICcnICsgYSArIGIgKyBjKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgViA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHZvaWQgMCA9PT0gYiA/IDMgOiBiOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgMyA+IGM7ICsrYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gZWEuZXhlYyhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBkZWNvZGVVUklDb21wb25lbnQoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlICYmICcxJyA9PT0gZVsxXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBlWzJdLCBnID0gZVszXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGUgPSAwOyBlIDwgYjsgKytlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZiA9PT0gUyhnLCBlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IGcgPyBnLnNwbGl0KCcqJykgOiBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGcgPSAwOyBnIDwgay5sZW5ndGg7IGcgKz0gMikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYltrW2ddXSA9IGJhKGtbZyArIDFdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gY2F0Y2ggKG4pIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gWChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBlKGspIHsKICAgICAgICAgICAgICAgICAgICBrID0gVyhhLCBrKTsKICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IGsuY2hhckF0KGsubGVuZ3RoIC0gMSk7CiAgICAgICAgICAgICAgICAgICAgayAmJiAnJicgIT09IG4gJiYgKGsgKz0gJyYnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gayArIGg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkID0gdm9pZCAwID09PSBkID8gITEgOiBkOwogICAgICAgICAgICAgICAgdmFyIGYgPSBmYS5leGVjKGMpOwogICAgICAgICAgICAgICAgaWYgKCFmKQogICAgICAgICAgICAgICAgICAgIHJldHVybiAnJzsKICAgICAgICAgICAgICAgIGMgPSBmWzFdOwogICAgICAgICAgICAgICAgdmFyIGcgPSBmWzJdIHx8ICcnOwogICAgICAgICAgICAgICAgZiA9IGZbM10gfHwgJyc7CiAgICAgICAgICAgICAgICB2YXIgaCA9IGEgKyAnPScgKyBiOwogICAgICAgICAgICAgICAgZCA/IGYgPSAnIycgKyBlKGYuc3Vic3RyaW5nKDEpKSA6IGcgPSAnPycgKyBlKGcuc3Vic3RyaW5nKDEpKTsKICAgICAgICAgICAgICAgIHJldHVybiAnJyArIGMgKyBnICsgZjsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBZKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gJ0ZPUk0nID09PSAoYS50YWdOYW1lIHx8ICcnKS50b1VwcGVyQ2FzZSgpLCBkID0gUShiLCAxLCBjKSwgZSA9IFEoYiwgMiwgYyk7CiAgICAgICAgICAgICAgICBiID0gUShiLCAzLCBjKTsKICAgICAgICAgICAgICAgIHZhciBmID0gTTsKICAgICAgICAgICAgICAgIHEoZCkgJiYgKGQgPSBUKGQsIGYpLCBjID8gb2EoJ19nbCcsIGQsIGEpIDogWignX2dsJywgZCwgYSwgITEpKTsKICAgICAgICAgICAgICAgICFjICYmIHEoZSkgJiYgKGMgPSBUKGUpLCBaKCdfZ2wnLCBjLCBhLCAhMCkpOwogICAgICAgICAgICAgICAgZm9yICh2YXIgZyBpbiBiKQogICAgICAgICAgICAgICAgICAgIGIuaGFzT3duUHJvcGVydHkoZykgJiYgcGEoZywgYltnXSwgYSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcGEoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgaWYgKGMudGFnTmFtZSkgewogICAgICAgICAgICAgICAgICAgIGlmICgnYScgPT09IGMudGFnTmFtZS50b0xvd2VyQ2FzZSgpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWihhLCBiLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Zvcm0nID09PSBjLnRhZ05hbWUudG9Mb3dlckNhc2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9hKGEsIGIsIGMpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBjKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBYKGEsIGIsIGMsIGQpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFooYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgYy5ocmVmICYmIChhID0gWChhLCBiLCBjLmhyZWYsIHZvaWQgMCA9PT0gZCA/ICExIDogZCksIHIudGVzdChhKSAmJiAoYy5ocmVmID0gYSkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIG9hKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGlmIChjICYmIGMuYWN0aW9uKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSAoYy5tZXRob2QgfHwgJycpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdnZXQnID09PSBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBjLmNoaWxkTm9kZXMgfHwgW107CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSAhMSwgZiA9IDA7IGYgPCBkLmxlbmd0aDsgZisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGRbZl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZy5uYW1lID09PSBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5zZXRBdHRyaWJ1dGUoJ3ZhbHVlJywgYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGUgfHwgKGQgPSB2LmNyZWF0ZUVsZW1lbnQoJ2lucHV0JyksIGQuc2V0QXR0cmlidXRlKCd0eXBlJywgJ2hpZGRlbicpLCBkLnNldEF0dHJpYnV0ZSgnbmFtZScsIGEpLCBkLnNldEF0dHJpYnV0ZSgndmFsdWUnLCBiKSwgYy5hcHBlbmRDaGlsZChkKSk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICdwb3N0JyA9PT0gZCAmJiAoYSA9IFgoYSwgYiwgYy5hY3Rpb24pLCByLnRlc3QoYSkgJiYgKGMuYWN0aW9uID0gYSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGNhKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gMTAwOyBhICYmIDAgPCBiOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEuaHJlZiAmJiBhLm5vZGVOYW1lLm1hdGNoKC9eYSg/OnJlYSk/JC9pKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGEucGFyZW50Tm9kZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGItLTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBjID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBjLnByb3RvY29sOwogICAgICAgICAgICAgICAgICAgICAgICAnaHR0cDonICE9PSBkICYmICdodHRwczonICE9PSBkIHx8IFkoYywgYy5ob3N0bmFtZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGRhKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEuYWN0aW9uKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gRShGKGEuYWN0aW9uKSwgJ2hvc3QnKTsKICAgICAgICAgICAgICAgICAgICAgICAgWShhLCBiKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICBsKCdnb29nbGVfdGFnX2RhdGEuZ2xCcmlkZ2UuYXV0bycsIGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICBPKCk7CiAgICAgICAgICAgICAgICB2b2lkIDAgIT09IGUgJiYgKE0gPSBlKTsKICAgICAgICAgICAgICAgIDMgPT09IGUgJiYgbGEoKTsKICAgICAgICAgICAgICAgIFAoYSwgYiwgJ2ZyYWdtZW50JyA9PT0gYyA/IDIgOiAxLCAhIWQsICExKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGwoJ2dvb2dsZV90YWdfZGF0YS5nbEJyaWRnZS5wYXNzdGhyb3VnaCcsIGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBPKCk7CiAgICAgICAgICAgICAgICB2b2lkIDAgIT09IGQgJiYgKE0gPSBkKTsKICAgICAgICAgICAgICAgIFAoYSwgW0QodC5sb2NhdGlvbiwgJ2hvc3QnLCAhMCldLCBiLCAhIWMsICEwKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGwoJ2dvb2dsZV90YWdfZGF0YS5nbEJyaWRnZS5kZWNvcmF0ZScsIGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBhID0gVChhKTsKICAgICAgICAgICAgICAgIHJldHVybiBwYSgnX2dsJywgYSwgYiwgISFjKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGwoJ2dvb2dsZV90YWdfZGF0YS5nbEJyaWRnZS5nZW5lcmF0ZScsIFQpOwogICAgICAgICAgICBsKCdnb29nbGVfdGFnX2RhdGEuZ2xCcmlkZ2UuZ2V0JywgZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gbWEoISFiKTsKICAgICAgICAgICAgICAgIGIgPSBOKCk7CiAgICAgICAgICAgICAgICBiLmRhdGEgfHwgKGIuZGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICBxdWVyeToge30sCiAgICAgICAgICAgICAgICAgICAgZnJhZ21lbnQ6IHt9CiAgICAgICAgICAgICAgICB9LCBjKGIuZGF0YSkpOwogICAgICAgICAgICAgICAgYyA9IHt9OwogICAgICAgICAgICAgICAgaWYgKGIgPSBiLmRhdGEpCiAgICAgICAgICAgICAgICAgICAgbShjLCBiLnF1ZXJ5KSwgYSAmJiBtKGMsIGIuZnJhZ21lbnQpOwogICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgIH0pOwogICAgICAgIH0od2luZG93KSk7CiAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgZnVuY3Rpb24gTGEoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSAxLCBjOwogICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgZm9yIChiID0gMCwgYyA9IGEubGVuZ3RoIC0gMTsgMCA8PSBjOyBjLS0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLmNoYXJDb2RlQXQoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSAoYiA8PCA2ICYgMjY4NDM1NDU1KSArIGQgKyAoZCA8PCAxNCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBiICYgMjY2MzM4MzA0OwogICAgICAgICAgICAgICAgICAgICAgICBiID0gMCAhPSBkID8gYiBeIGQgPj4gMjEgOiBiOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgdmFyICRjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuQyA9IGEgfHwgW107CiAgICAgICAgICAgIH07CiAgICAgICAgICAgICRjLnByb3RvdHlwZS5zZXQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdGhpcy5DW2FdID0gITA7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgICRjLnByb3RvdHlwZS5lbmNvZGUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gW10sIGIgPSAwOyBiIDwgdGhpcy5DLmxlbmd0aDsgYisrKQogICAgICAgICAgICAgICAgICAgIHRoaXMuQ1tiXSAmJiAoYVtNYXRoLmZsb29yKGIgLyA2KV0gXj0gMSA8PCBiICUgNik7CiAgICAgICAgICAgICAgICBmb3IgKGIgPSAwOyBiIDwgYS5sZW5ndGg7IGIrKykKICAgICAgICAgICAgICAgICAgICBhW2JdID0gJ0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5LV8nLmNoYXJBdChhW2JdIHx8IDApOwogICAgICAgICAgICAgICAgcmV0dXJuIGEuam9pbignJykgKyAnfic7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBoYSA9IHdpbmRvdy5Hb29nbGVBbmFseXRpY3NPYmplY3QsIHdhOwogICAgICAgICAgICBpZiAod2EgPSB2b2lkIDAgIT0gaGEpCiAgICAgICAgICAgICAgICB3YSA9IC0xIDwgKGhhLmNvbnN0cnVjdG9yICsgJycpLmluZGV4T2YoJ1N0cmluZycpOwogICAgICAgICAgICB2YXIgeWE7CiAgICAgICAgICAgIGlmICh5YSA9IHdhKSB7CiAgICAgICAgICAgICAgICB2YXIgZmMgPSB3aW5kb3cuR29vZ2xlQW5hbHl0aWNzT2JqZWN0OwogICAgICAgICAgICAgICAgeWEgPSBmYyA/IGZjLnJlcGxhY2UoL15bXHNceGEwXSt8W1xzXHhhMF0rJC9nLCAnJykgOiAnJzsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgZ2IgPSB5YSB8fCAnZ2EnLCBqZCA9IC9eKD86dXRtYVwuKT9cZCtcLlxkKyQvLCBrZCA9IC9eYW1wLVtcdy4tXXsyMiw2NH0kLywgQmEgPSAhMTsKICAgICAgICAgICAgdmFyIHZkID0gbmV3ICRjKCk7CiAgICAgICAgICAgIGZ1bmN0aW9uIEooYSkgewogICAgICAgICAgICAgICAgdmQuc2V0KGEpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBUZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IERkKGEpOwogICAgICAgICAgICAgICAgICAgIGEgPSBuZXcgJGMoYSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IHZkLkMuc2xpY2UoKSwgYyA9IDA7IGMgPCBhLkMubGVuZ3RoOyBjKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGJbY10gPSBiW2NdIHx8IGEuQ1tjXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3ICRjKGIpLmVuY29kZSgpOwogICAgICAgICAgICAgICAgfSwgRGQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEgPSBhLmdldChHZCk7CiAgICAgICAgICAgICAgICAgICAga2EoYSkgfHwgKGEgPSBbXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZWEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nID09IHR5cGVvZiBhOwogICAgICAgICAgICAgICAgfSwga2EgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAnW29iamVjdCBBcnJheV0nID09IE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChPYmplY3QoYSkpOwogICAgICAgICAgICAgICAgfSwgcWEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT0gYSAmJiAtMSA8IChhLmNvbnN0cnVjdG9yICsgJycpLmluZGV4T2YoJ1N0cmluZycpOwogICAgICAgICAgICAgICAgfSwgRCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPT0gYS5pbmRleE9mKGIpOwogICAgICAgICAgICAgICAgfSwgc2EgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhID8gYS5yZXBsYWNlKC9eW1xzXHhhMF0rfFtcc1x4YTBdKyQvZywgJycpIDogJyc7CiAgICAgICAgICAgICAgICB9LCByYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gTy5uYXZpZ2F0b3IudXNlckFnZW50ICsgKE0uY29va2llID8gTS5jb29raWUgOiAnJykgKyAoTS5yZWZlcnJlciA/IE0ucmVmZXJyZXIgOiAnJyksIGIgPSBhLmxlbmd0aCwgYyA9IE8uaGlzdG9yeS5sZW5ndGg7IDAgPCBjOykKICAgICAgICAgICAgICAgICAgICAgICAgYSArPSBjLS0gXiBiKys7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFsKICAgICAgICAgICAgICAgICAgICAgICAgaGQoKSBeIExhKGEpICYgMjE0NzQ4MzY0NywKICAgICAgICAgICAgICAgICAgICAgICAgTWF0aC5yb3VuZChuZXcgRGF0ZSgpLmdldFRpbWUoKSAvIDEwMDApCiAgICAgICAgICAgICAgICAgICAgXS5qb2luKCcuJyk7CiAgICAgICAgICAgICAgICB9LCB0YSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBNLmNyZWF0ZUVsZW1lbnQoJ2ltZycpOwogICAgICAgICAgICAgICAgICAgIGIud2lkdGggPSAxOwogICAgICAgICAgICAgICAgICAgIGIuaGVpZ2h0ID0gMTsKICAgICAgICAgICAgICAgICAgICBiLnNyYyA9IGE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9LCB1YSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH0sIEsgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGlmIChlbmNvZGVVUklDb21wb25lbnQgaW5zdGFuY2VvZiBGdW5jdGlvbikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVuY29kZVVSSUNvbXBvbmVudChhKTsKICAgICAgICAgICAgICAgICAgICBKKDI4KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0sIEwgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuYWRkRXZlbnRMaXN0ZW5lciA/IGEuYWRkRXZlbnRMaXN0ZW5lcihiLCBjLCAhIWQpIDogYS5hdHRhY2hFdmVudCAmJiBhLmF0dGFjaEV2ZW50KCdvbicgKyBiLCBjKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEooMjcpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGYgPSAvXltcd1wtOi8uPz0mJSFcW1xdXSskLywgTmQgPSAvXltcdysvXy1dK1s9XXswLDJ9JC8sIGZmID0gbnVsbCwgSWQgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghZmYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZmYgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVTY3JpcHRVUkw6IGZ1bmN0aW9uIChjYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVIVE1MOiBmdW5jdGlvbiAoY2EpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2E7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZiA9IHdpbmRvdy50cnVzdGVkVHlwZXMuY3JlYXRlUG9saWN5KCdnb29nbGUtYW5hbHl0aWNzJywgZmYpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChjYSkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gTS5xdWVyeVNlbGVjdG9yICYmIE0ucXVlcnlTZWxlY3Rvcignc2NyaXB0W25vbmNlXScpIHx8IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBnID8gZy5ub25jZSB8fCBnLmdldEF0dHJpYnV0ZSAmJiBnLmdldEF0dHJpYnV0ZSgnbm9uY2UnKSB8fCAnJyA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICBjID8gKGUgPSBkID0gJycsIGIgJiYgZi50ZXN0KGIpICYmIChkID0gJyBpZD0iJyArIGIgKyAnIicpLCBnICYmIE5kLnRlc3QoZykgJiYgKGUgPSAnIG5vbmNlPSInICsgZyArICciJyksIGYudGVzdChhKSAmJiBNLndyaXRlKGZmLmNyZWF0ZUhUTUwoJzxzY3JpcHQnICsgZCArIGUgKyAnIHNyYz0iJyArIGEgKyAnIj48L3NjcmlwdD4nKSkpIDogKGMgPSBNLmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpLCBjLnR5cGUgPSAndGV4dC9qYXZhc2NyaXB0JywgYy5hc3luYyA9ICEwLCBjLnNyYyA9IGZmLmNyZWF0ZVNjcmlwdFVSTChhKSwgZCAmJiAoYy5vbmxvYWQgPSBkKSwgZSAmJiAoYy5vbmVycm9yID0gZSksIGIgJiYgKGMuaWQgPSBiKSwgZyAmJiBjLnNldEF0dHJpYnV0ZSgnbm9uY2UnLCBnKSwgYSA9IE0uZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ3NjcmlwdCcpWzBdLCBhLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKGMsIGEpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBiZSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEUoTS5sb2NhdGlvbltiID8gJ2hyZWYnIDogJ3NlYXJjaCddLCBhKTsKICAgICAgICAgICAgICAgIH0sIEUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAoYSA9IGEubWF0Y2goJyg/OiZ8I3xcXD8pJyArIEsoYikucmVwbGFjZSgvKFsuKis/Xj0hOiR7fSgpfFxbXF1cL1xcXSkvZywgJ1xcJDEnKSArICc9KFteJiNdKiknKSkgJiYgMiA9PSBhLmxlbmd0aCA/IGFbMV0gOiAnJzsKICAgICAgICAgICAgICAgIH0sIHhhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gJycgKyBNLmxvY2F0aW9uLmhvc3RuYW1lOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAwID09IGEuaW5kZXhPZignd3d3LicpID8gYS5zdWJzdHJpbmcoNCkgOiBhOwogICAgICAgICAgICAgICAgfSwgZGUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gYS5pbmRleE9mKGIpOwogICAgICAgICAgICAgICAgICAgIGlmICg1ID09IGMgfHwgNiA9PSBjKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IGEuY2hhckF0KGMgKyBiLmxlbmd0aCksICcvJyA9PSBhIHx8ICc/JyA9PSBhIHx8ICcnID09IGEgfHwgJzonID09IGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfSwgemEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGlmICgxID09IGIubGVuZ3RoICYmIG51bGwgIT0gYlswXSAmJiAnb2JqZWN0JyA9PT0gdHlwZW9mIGJbMF0pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiWzBdOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSB7fSwgZCA9IE1hdGgubWluKGEubGVuZ3RoICsgMSwgYi5sZW5ndGgpLCBlID0gMDsgZSA8IGQ7IGUrKykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdvYmplY3QnID09PSB0eXBlb2YgYltlXSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZyBpbiBiW2VdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJbZV0uaGFzT3duUHJvcGVydHkoZykgJiYgKGNbZ10gPSBiW2VdW2ddKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPCBhLmxlbmd0aCAmJiAoY1thW2VdXSA9IGJbZV0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSwgRWUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwOyBjIDwgYS5sZW5ndGg7IGMrKykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIgPT0gYVtjXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZWUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLm9hID0gW107CiAgICAgICAgICAgICAgICB0aGlzLmVhID0ge307CiAgICAgICAgICAgICAgICB0aGlzLm0gPSB7fTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZWUucHJvdG90eXBlLnNldCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICB0aGlzLm9hLnB1c2goYSk7CiAgICAgICAgICAgICAgICBjID8gdGhpcy5tWyc6JyArIGFdID0gYiA6IHRoaXMuZWFbJzonICsgYV0gPSBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBlZS5wcm90b3R5cGUuZ2V0ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm0uaGFzT3duUHJvcGVydHkoJzonICsgYSkgPyB0aGlzLm1bJzonICsgYV0gOiB0aGlzLmVhWyc6JyArIGFdOwogICAgICAgICAgICB9OwogICAgICAgICAgICBlZS5wcm90b3R5cGUubWFwID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSAwOyBiIDwgdGhpcy5vYS5sZW5ndGg7IGIrKykgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gdGhpcy5vYVtiXSwgZCA9IHRoaXMuZ2V0KGMpOwogICAgICAgICAgICAgICAgICAgIGQgJiYgYShjLCBkKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE8gPSB3aW5kb3csIE0gPSBkb2N1bWVudCwgamYgPSBkb2N1bWVudC5jdXJyZW50U2NyaXB0ID8gZG9jdW1lbnQuY3VycmVudFNjcmlwdC5zcmMgOiAnJywgdmEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBzZXRUaW1lb3V0KGEsIGIpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFFhID0gd2luZG93LCBaYSA9IGRvY3VtZW50LCBHID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IFFhLl9nYVVzZXJQcmVmczsKICAgICAgICAgICAgICAgICAgICBpZiAoYiAmJiBiLmlvbyAmJiBiLmlvbygpIHx8IGEgJiYgITAgPT09IFFhWydnYS1kaXNhYmxlLScgKyBhXSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gUWEuZXh0ZXJuYWw7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjICYmIGMuX2dhVXNlclByZWZzICYmICdvbycgPT0gYy5fZ2FVc2VyUHJlZnMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZykgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBhID0gW107CiAgICAgICAgICAgICAgICAgICAgYiA9IFN0cmluZyhaYS5jb29raWUpLnNwbGl0KCc7Jyk7CiAgICAgICAgICAgICAgICAgICAgZm9yIChjID0gMDsgYyA8IGIubGVuZ3RoOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBiW2NdLnNwbGl0KCc9JyksIGUgPSBkWzBdLnJlcGxhY2UoL15ccyp8XHMqJC9nLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgJiYgJ0FNUF9UT0tFTicgPT0gZSAmJiAoKGQgPSBkLnNsaWNlKDEpLmpvaW4oJz0nKS5yZXBsYWNlKC9eXHMqfFxzKiQvZywgJycpKSAmJiAoZCA9IGRlY29kZVVSSUNvbXBvbmVudChkKSksIGEucHVzaChkKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZvciAoYiA9IDA7IGIgPCBhLmxlbmd0aDsgYisrKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJyRPUFRfT1VUJyA9PSBhW2JdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBaYS5nZXRFbGVtZW50QnlJZCgnX19nYU9wdE91dEV4dGVuc2lvbicpID8gITAgOiAhMTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBDYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBbXSwgYyA9IE0uY29va2llLnNwbGl0KCc7Jyk7CiAgICAgICAgICAgICAgICAgICAgYSA9IG5ldyBSZWdFeHAoJ15cXHMqJyArIGEgKyAnPVxccyooLio/KVxccyokJyk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IDA7IGQgPCBjLmxlbmd0aDsgZCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gY1tkXS5tYXRjaChhKTsKICAgICAgICAgICAgICAgICAgICAgICAgZSAmJiBiLnB1c2goZVsxXSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSwgemMgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZywgY2EpIHsKICAgICAgICAgICAgICAgICAgICBlID0gRyhlKSA/ICExIDogZWIudGVzdChNLmxvY2F0aW9uLmhvc3RuYW1lKSB8fCAnLycgPT0gYyAmJiB2Yy50ZXN0KGQpID8gITEgOiAhMDsKICAgICAgICAgICAgICAgICAgICBpZiAoIWUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICBiICYmIDEyMDAgPCBiLmxlbmd0aCAmJiAoYiA9IGIuc3Vic3RyaW5nKDAsIDEyMDApKTsKICAgICAgICAgICAgICAgICAgICBjID0gYSArICc9JyArIGIgKyAnOyBwYXRoPScgKyBjICsgJzsgJzsKICAgICAgICAgICAgICAgICAgICBnICYmIChjICs9ICdleHBpcmVzPScgKyBuZXcgRGF0ZShuZXcgRGF0ZSgpLmdldFRpbWUoKSArIGcpLnRvR01UU3RyaW5nKCkgKyAnOyAnKTsKICAgICAgICAgICAgICAgICAgICBkICYmICdub25lJyAhPT0gZCAmJiAoYyArPSAnZG9tYWluPScgKyBkICsgJzsnKTsKICAgICAgICAgICAgICAgICAgICBjYSAmJiAoYyArPSBjYSArICc7Jyk7CiAgICAgICAgICAgICAgICAgICAgZCA9IE0uY29va2llOwogICAgICAgICAgICAgICAgICAgIE0uY29va2llID0gYzsKICAgICAgICAgICAgICAgICAgICBpZiAoIShkID0gZCAhPSBNLmNvb2tpZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBDYShhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZCA9IDA7IGQgPCBhLmxlbmd0aDsgZCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiID09IGFbZF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgfSwgQ2MgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlbmNvZGVVUklDb21wb25lbnQgPyBlbmNvZGVVUklDb21wb25lbnQoYSkucmVwbGFjZSgvXCgvZywgJyUyOCcpLnJlcGxhY2UoL1wpL2csICclMjknKSA6IGE7CiAgICAgICAgICAgICAgICB9LCB2YyA9IC9eKHd3d1wuKT9nb29nbGUoXC5jb20/KT8oXC5bYS16XXsyfSk/JC8sIGViID0gLyhefFwuKWRvdWJsZWNsaWNrXC5uZXQkL2k7CiAgICAgICAgICAgIHZhciBPZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IFtdLCBjID0gTS5jb29raWUuc3BsaXQoJzsnKTsKICAgICAgICAgICAgICAgIGEgPSBuZXcgUmVnRXhwKCdeXFxzKicgKyAoYSB8fCAnX2dhYycpICsgJ18oVUEtXFxkKy1cXGQrKT1cXHMqKC4rPylcXHMqJCcpOwogICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IDA7IGQgPCBjLmxlbmd0aDsgZCsrKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBjW2RdLm1hdGNoKGEpOwogICAgICAgICAgICAgICAgICAgIGUgJiYgYi5wdXNoKHsKICAgICAgICAgICAgICAgICAgICAgICAgamE6IGVbMV0sCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlWzJdLAogICAgICAgICAgICAgICAgICAgICAgICB0aW1lc3RhbXA6IE51bWJlcihlWzJdLnNwbGl0KCcuJylbMV0pIHx8IDAKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGIuc29ydChmdW5jdGlvbiAoZywgY2EpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2EudGltZXN0YW1wIC0gZy50aW1lc3RhbXA7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBkZihhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBiID0gT2UoYik7CiAgICAgICAgICAgICAgICB2YXIgZCA9IHt9OwogICAgICAgICAgICAgICAgaWYgKCFiIHx8ICFiLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgIGZvciAodmFyIGUgPSAwOyBlIDwgYi5sZW5ndGg7IGUrKykgewogICAgICAgICAgICAgICAgICAgIHZhciBnID0gYltlXS52YWx1ZS5zcGxpdCgnLicpOwogICAgICAgICAgICAgICAgICAgIGlmICgnMScgIT09IGdbMF0gfHwgYyAmJiAzID4gZy5sZW5ndGggfHwgIWMgJiYgMyAhPT0gZy5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIGEgJiYgKGEubmEgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoTnVtYmVyKGdbMV0pKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRbYltlXS5qYV0gPyBhICYmIChhLnBhID0gITApIDogZFtiW2VdLmphXSA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgY2EgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiBnWzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZXN0YW1wOiAxMDAwICogTnVtYmVyKGdbMV0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcWE6IGdbMl0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgYyAmJiAzIDwgZy5sZW5ndGggJiYgKGNhLmxhYmVscyA9IGcuc2xpY2UoMykpOwogICAgICAgICAgICAgICAgICAgICAgICBkW2JbZV0uamFdLnB1c2goY2EpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgdmFyIEZhLCBHYSwgZmIsIEFiLCBqYSA9IC9eaHR0cHM/OlwvXC9bXi9dKmNkblwuYW1wcHJvamVjdFwub3JnXC8vLCBVZSA9IC9eKD86d3d3XC58bVwufGFtcFwuKSsvLCBVYiA9IFtdLCBkYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHllKGFbS2RdKSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBBYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IChiID0gRGUuZ2V0KCkpICYmIGIuX2dhIHx8IHZvaWQgMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBBYiA9IGIsIEooODEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT09IEFiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbUV0gfHwgKGFbUV0gPSBBYiksICExOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoYVtLZF0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgSig2Nyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhW2FjXSAmJiAnY29va2llJyAhPSBhW2FjXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gQWIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhW1FdIHx8IChhW1FdID0gQWIpOwogICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gU3RyaW5nKGFbV10gfHwgeGEoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBTdHJpbmcoYVtZYl0gfHwgJy8nKSwgZCA9IENhKFN0cmluZyhhW1VdIHx8ICdfZ2EnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IG5hKGQsIGIsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYiB8fCBqZC50ZXN0KGIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoYiA9IENhKCdBTVBfVE9LRU4nKSwgMCA9PSBiLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMSA9PSBiLmxlbmd0aCAmJiAoYiA9IGRlY29kZVVSSUNvbXBvbmVudChiWzBdKSwgJyRSRVRSSUVWSU5HJyA9PSBiIHx8ICckT1BUX09VVCcgPT0gYiB8fCAnJEVSUk9SJyA9PSBiIHx8ICckTk9UX0ZPVU5EJyA9PSBiKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIgJiYgdGMoaWMsIFN0cmluZyhhW05hXSkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICB9LCBpYyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBaLkQoW3VhXSk7CiAgICAgICAgICAgICAgICB9LCB0YyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBDYSgnQU1QX1RPS0VOJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPCBjLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEooNTUpLCAhMTsKICAgICAgICAgICAgICAgICAgICBjID0gZGVjb2RlVVJJQ29tcG9uZW50KGNbMF0gfHwgJycpOwogICAgICAgICAgICAgICAgICAgIGlmICgnJE9QVF9PVVQnID09IGMgfHwgJyRFUlJPUicgPT0gYyB8fCBHKGIpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSig2MiksICExOwogICAgICAgICAgICAgICAgICAgIGlmICghamEudGVzdChNLnJlZmVycmVyKSAmJiAnJE5PVF9GT1VORCcgPT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEooNjgpLCAhMTsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwICE9PSBBYikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEooNTYpLCB2YShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhKEFiKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgMCksICEwOwogICAgICAgICAgICAgICAgICAgIGlmIChGYSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFViLnB1c2goYSksICEwOwogICAgICAgICAgICAgICAgICAgIGlmICgnJFJFVFJJRVZJTkcnID09IGMpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBKKDU3KSwgdmEoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGMoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0sIDEwMDAwKSwgITA7CiAgICAgICAgICAgICAgICAgICAgRmEgPSAhMDsKICAgICAgICAgICAgICAgICAgICBjICYmICckJyAhPSBjWzBdIHx8ICh4YygnJFJFVFJJRVZJTkcnLCAzMDAwMCksIHNldFRpbWVvdXQoTWMsIDMwMDAwKSwgYyA9ICcnKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUGMoYywgYikgPyAoVWIucHVzaChhKSwgITApIDogITE7CiAgICAgICAgICAgICAgICB9LCBQYyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCF3aW5kb3cuSlNPTikKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEooNTgpLCAhMTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IE8uWE1MSHR0cFJlcXVlc3Q7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFkKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSig1OSksICExOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IGQoKTsKICAgICAgICAgICAgICAgICAgICBpZiAoISgnd2l0aENyZWRlbnRpYWxzJyBpbiBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEooNjApLCAhMTsKICAgICAgICAgICAgICAgICAgICBlLm9wZW4oJ1BPU1QnLCAoYyB8fCAnaHR0cHM6Ly9hbXBjaWQuZ29vZ2xlLmNvbS92MS9wdWJsaXNoZXI6Z2V0Q2xpZW50SWQnKSArICc/a2V5PUFJemFTeUE2NWxFSFVFaXpJc050bGJOby1sMksxOGRUNjgwbnNhTScsICEwKTsKICAgICAgICAgICAgICAgICAgICBlLndpdGhDcmVkZW50aWFscyA9ICEwOwogICAgICAgICAgICAgICAgICAgIGUuc2V0UmVxdWVzdEhlYWRlcignQ29udGVudC1UeXBlJywgJ3RleHQvcGxhaW4nKTsKICAgICAgICAgICAgICAgICAgICBlLm9ubG9hZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgRmEgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDQgPT0gZS5yZWFkeVN0YXRlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMCAhPSBlLnN0YXR1cyAmJiAoSig2MSksIFFjKCcnLCAnJEVSUk9SJywgMzAwMDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IEpTT04ucGFyc2UoZS5yZXNwb25zZVRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcub3B0T3V0ID8gKEooNjMpLCBRYygnJywgJyRPUFRfT1VUJywgMzE1MzYwMDAwMDApKSA6IGcuY2xpZW50SWQgPyBRYyhnLmNsaWVudElkLCBnLnNlY3VyaXR5VG9rZW4sIDMxNTM2MDAwMDAwKSA6ICFjICYmIGcuYWx0ZXJuYXRlVXJsID8gKEdhICYmIGNsZWFyVGltZW91dChHYSksIEZhID0gITAsIFBjKGEsIGIsIGcuYWx0ZXJuYXRlVXJsKSkgOiAoSig2NCksIFFjKCcnLCAnJE5PVF9GT1VORCcsIDM2MDAwMDApKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGNhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSig2NSksIFFjKCcnLCAnJEVSUk9SJywgMzAwMDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGQgPSB7IG9yaWdpblNjb3BlOiAnQU1QX0VDSURfR09PR0xFJyB9OwogICAgICAgICAgICAgICAgICAgIGEgJiYgKGQuc2VjdXJpdHlUb2tlbiA9IGEpOwogICAgICAgICAgICAgICAgICAgIGUuc2VuZChKU09OLnN0cmluZ2lmeShkKSk7CiAgICAgICAgICAgICAgICAgICAgR2EgPSB2YShmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIEooNjYpOwogICAgICAgICAgICAgICAgICAgICAgICBRYygnJywgJyRFUlJPUicsIDMwMDAwKTsKICAgICAgICAgICAgICAgICAgICB9LCAxMDAwMCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgfSwgTWMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgRmEgPSAhMTsKICAgICAgICAgICAgICAgIH0sIHhjID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBmYikgewogICAgICAgICAgICAgICAgICAgICAgICBmYiA9ICcnOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gaWQoKSwgZCA9IDA7IGQgPCBjLmxlbmd0aDsgZCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGNbZF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoemMoJ0FNUF9UT0tFTicsIGVuY29kZVVSSUNvbXBvbmVudChhKSwgJy8nLCBlLCAnJywgYikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYiA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHpjKCdBTVBfVE9LRU4nLCBlbmNvZGVVUklDb21wb25lbnQoYSksICcvJywgZmIsICcnLCBiKTsKICAgICAgICAgICAgICAgIH0sIFFjID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBHYSAmJiBjbGVhclRpbWVvdXQoR2EpOwogICAgICAgICAgICAgICAgICAgIGIgJiYgeGMoYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgQWIgPSBhOwogICAgICAgICAgICAgICAgICAgIGIgPSBVYjsKICAgICAgICAgICAgICAgICAgICBVYiA9IFtdOwogICAgICAgICAgICAgICAgICAgIGZvciAoYyA9IDA7IGMgPCBiLmxlbmd0aDsgYysrKQogICAgICAgICAgICAgICAgICAgICAgICBiW2NdKGEpOwogICAgICAgICAgICAgICAgfSwgeWUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGphLnRlc3QoTS5yZWZlcnJlcikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gTS5sb2NhdGlvbi5ob3N0bmFtZS5yZXBsYWNlKFVlLCAnJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBNLnJlZmVycmVyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBjLnJlcGxhY2UoL15odHRwcz86XC9cLy8sICcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGMucmVwbGFjZSgvXlteL10rLywgJycpLnNwbGl0KCcvJyksIGUgPSBkWzJdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSAoZCA9ICdzJyA9PSBlID8gZFszXSA6IGUpID8gZGVjb2RlVVJJQ29tcG9uZW50KGQpIDogZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT0gYy5pbmRleE9mKCd4bi0tJykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGMgPSBjLm1hdGNoKC8oLiopXC5jZG5cLmFtcHByb2plY3RcLm9yZ1wvPyQvKSkgJiYgMiA9PSBjLmxlbmd0aCAmJiAoZCA9IGNbMV0ucmVwbGFjZSgvLS9nLCAnLicpLnJlcGxhY2UoL1wuXC4vZywgJy0nKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBkID8gZC5yZXBsYWNlKFVlLCAnJykgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIChkID0gYiA9PT0gYykgfHwgKGMgPSAnLicgKyBjLCBkID0gYi5zdWJzdHJpbmcoYi5sZW5ndGggLSBjLmxlbmd0aCwgYi5sZW5ndGgpID09PSBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKKDc4KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBiID0gITE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBiICYmICExICE9PSBhOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGJkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGEgPyAnaHR0cHM6JyA6IEJhIHx8ICdodHRwczonID09IE0ubG9jYXRpb24ucHJvdG9jb2wgPyAnaHR0cHM6JyA6ICdodHRwOicpICsgJy8vd3d3Lmdvb2dsZS1hbmFseXRpY3MuY29tJzsKICAgICAgICAgICAgICAgIH0sIEdlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGEpIHsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdodHRwczovL3d3dy5nb29nbGUtYW5hbHl0aWNzLmNvbS9ndG0vanM/aWQ9JzsKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaHR0cHM6Ly93d3cuZ29vZ2xldGFnbWFuYWdlci5jb20vZ3RhZy9qcz9pZD0nOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIERhID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLm5hbWUgPSAnbGVuJzsKICAgICAgICAgICAgICAgICAgICB0aGlzLm1lc3NhZ2UgPSBhICsgJy04MTkyJzsKICAgICAgICAgICAgICAgIH0sIGJhID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gYyB8fCB1YTsKICAgICAgICAgICAgICAgICAgICBpZiAoMjAzNiA+PSBiLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgd2MoYSwgYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoODE5MiA+PSBiLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgeChhLCBiLCBjKSB8fCB3ZChhLCBiLCBjKSB8fCB3YyhhLCBiLCBjKTsKICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGdlKCdsZW4nLCBiLmxlbmd0aCksIG5ldyBEYShiLmxlbmd0aCk7CiAgICAgICAgICAgICAgICB9LCBwZSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgZCA9IGQgfHwgdWE7CiAgICAgICAgICAgICAgICAgICAgd2QoYSArICc/JyArIGIsICcnLCBkLCBjKTsKICAgICAgICAgICAgICAgIH0sIHdjID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHRhKGEgKyAnPycgKyBiKTsKICAgICAgICAgICAgICAgICAgICBkLm9ubG9hZCA9IGQub25lcnJvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZC5vbmxvYWQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBkLm9uZXJyb3IgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICBjKCk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIHdkID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICBjb25zdCAkX19fb2xkX2I3NzQ3NmUyNDk0NTAxYjggPSB7fS5jb25zdHJ1Y3Rvci5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9iNzc0NzZlMjQ5NDUwMWI4KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfMjc3YzYyYzZkNDc5NTk3Ni5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBPLlhNTEh0dHBSZXF1ZXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gbmV3IGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKCd3aXRoQ3JlZGVudGlhbHMnIGluIGcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLnJlcGxhY2UoL15odHRwOi8sICdodHRwczonKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcub3BlbignUE9TVCcsIGEsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcud2l0aENyZWRlbnRpYWxzID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLnNldFJlcXVlc3RIZWFkZXIoJ0NvbnRlbnQtVHlwZScsICd0ZXh0L3BsYWluJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoNCA9PSBnLnJlYWR5U3RhdGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgJiYgJ3RleHQvcGxhaW4nID09PSBnLmdldFJlc3BvbnNlSGVhZGVyKCdDb250ZW50LVR5cGUnKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWEoZCwgZy5yZXNwb25zZVRleHQsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoY2EpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZSgneGhyJywgJ3JzcCcpLCBjKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcuc2VuZChiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2I3NzQ3NmUyNDk0NTAxYjgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkX2I3NzQ3NmUyNDk0NTAxYjgpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBFYSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPiBiLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgZ2UoJ3hocicsICd2ZXInLCAnMCcpLCBjKCk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoMyA8IGEuY291bnQrKykKICAgICAgICAgICAgICAgICAgICAgICAgZ2UoJ3hocicsICd0bXInLCAnJyArIGEuY291bnQpLCBjKCk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gYi5jaGFyQXQoMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnMScgPT09IGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYyhhLCBiLnN1YnN0cmluZygxKSwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGEuViAmJiAnMicgPT09IGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYi5zdWJzdHJpbmcoMSkuc3BsaXQoJywnKSwgZyA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsrZyA9PT0gZS5sZW5ndGggJiYgYygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZCA9IDA7IGQgPCBlLmxlbmd0aDsgZCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9jKGEsIGVbZF0sIGIpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdlKCd4aHInLCAndmVyJywgU3RyaW5nKGIubGVuZ3RoKSksIGMoKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBvYyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT09IGIubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICBjKCk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gYi5jaGFyQXQoMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdkJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlKCdodHRwczovL3N0YXRzLmcuZG91YmxlY2xpY2submV0L2ovY29sbGVjdCcsIGEuVSwgYSwgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3YygnaHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS9hZHMvZ2EtYXVkaWVuY2VzJywgYS5nb29nbGUsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgKGIgPSBiLnN1YnN0cmluZygxKSkgJiYgKC9eW2Etei5dezEsNn0kLy50ZXN0KGIpID8gd2MoJ2h0dHBzOi8vd3d3Lmdvb2dsZS4lL2Fkcy9nYS1hdWRpZW5jZXMnLnJlcGxhY2UoJyUnLCBiKSwgYS5nb29nbGUsIHVhKSA6IGdlKCd0bGQnLCAnYmNjJywgYikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ0cnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEuVikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuVignRy0nICsgYi5zdWJzdHJpbmcoMSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAneCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5WKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5WKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2UoJ3hocicsICdicmMnLCBkKSwgYygpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgeCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE8ubmF2aWdhdG9yLnNlbmRCZWFjb24gPyBPLm5hdmlnYXRvci5zZW5kQmVhY29uKGEsIGIpID8gKGMoKSwgITApIDogITEgOiAhMTsKICAgICAgICAgICAgICAgIH0sIGdlID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAxIDw9IDEwMCAqIE1hdGgucmFuZG9tKCkgfHwgRygnPycpIHx8IChhID0gWwogICAgICAgICAgICAgICAgICAgICAgICAndD1lcnJvcicsCiAgICAgICAgICAgICAgICAgICAgICAgICdfZT0nICsgYSwKICAgICAgICAgICAgICAgICAgICAgICAgJ192PWo5NicsCiAgICAgICAgICAgICAgICAgICAgICAgICdzcj0xJwogICAgICAgICAgICAgICAgICAgIF0sIGIgJiYgYS5wdXNoKCdfZj0nICsgYiksIGMgJiYgYS5wdXNoKCdfbT0nICsgSyhjLnN1YnN0cmluZygwLCAxMDApKSksIGEucHVzaCgnYWlwPTEnKSwgYS5wdXNoKCd6PScgKyBoZCgpKSwgd2MoYmQoITApICsgJy91L2QnLCBhLmpvaW4oJyYnKSwgdWEpKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBxYyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gTy5nYURhdGEgPSBPLmdhRGF0YSB8fCB7fTsKICAgICAgICAgICAgICAgIH0sIGggPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gcWMoKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYlthXSA9IGJbYV0gfHwge307CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgSGEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB0aGlzLk0gPSBbXTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSGEucHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB0aGlzLk0ucHVzaChhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSGEucHJvdG90eXBlLkQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gMDsgYiA8IHRoaXMuTS5sZW5ndGg7IGIrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEuZ2V0KHRoaXMuTVtiXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgJiYgZWEoYykgJiYgYy5jYWxsKE8sIGEpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGIgPSBhLmdldChJYSk7CiAgICAgICAgICAgICAgICBiICE9IHVhICYmIGVhKGIpICYmIChhLnNldChJYSwgdWEsICEwKSwgc2V0VGltZW91dChiLCAxMCkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBKYShhKSB7CiAgICAgICAgICAgICAgICBpZiAoMTAwICE9IGEuZ2V0KEthKSAmJiBMYShQKGEsIFEpKSAlIDEwMDAwID49IDEwMCAqIFIoYSwgS2EpKQogICAgICAgICAgICAgICAgICAgIHRocm93ICdhYm9ydCc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gTWEoYSkgewogICAgICAgICAgICAgICAgaWYgKEcoUChhLCBOYSkpKQogICAgICAgICAgICAgICAgICAgIHRocm93ICdhYm9ydCc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gT2EoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IE0ubG9jYXRpb24ucHJvdG9jb2w7CiAgICAgICAgICAgICAgICBpZiAoJ2h0dHA6JyAhPSBhICYmICdodHRwczonICE9IGEpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ2Fib3J0JzsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBQYShhKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIE8ubmF2aWdhdG9yLnNlbmRCZWFjb24gPyBKKDQyKSA6IE8uWE1MSHR0cFJlcXVlc3QgJiYgJ3dpdGhDcmVkZW50aWFscycgaW4gbmV3IE8uWE1MSHR0cFJlcXVlc3QoKSAmJiBKKDQwKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGEuc2V0KGxkLCBUZChhKSwgITApOwogICAgICAgICAgICAgICAgYS5zZXQoQWMsIFIoYSwgQWMpICsgMSk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IFtdOwogICAgICAgICAgICAgICAgdWUubWFwKGZ1bmN0aW9uIChjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgZC5GICYmIChjID0gYS5nZXQoYyksIHZvaWQgMCAhPSBjICYmIGMgIT0gZC5kZWZhdWx0VmFsdWUgJiYgKCdib29sZWFuJyA9PSB0eXBlb2YgYyAmJiAoYyAqPSAxKSwgYi5wdXNoKGQuRiArICc9JyArIEsoJycgKyBjKSkpKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgITEgPT09IGEuZ2V0KHhlKSAmJiBiLnB1c2goJ25wYT0xJyk7CiAgICAgICAgICAgICAgICBiLnB1c2goJ3o9JyArIEJkKCkpOwogICAgICAgICAgICAgICAgYS5zZXQoUmEsIGIuam9pbignJicpLCAhMCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gU2EoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBQKGEsIGZhKTsKICAgICAgICAgICAgICAgICFiICYmIGEuZ2V0KFZkKSAmJiAoYiA9ICdiZWFjb24nKTsKICAgICAgICAgICAgICAgIHZhciBjID0gUChhLCBnZCksIGQgPSBQKGEsIG9lKSwgZSA9IGMgfHwgKGQgfHwgYmQoITEpICsgJycpICsgJy9jb2xsZWN0JzsKICAgICAgICAgICAgICAgIHN3aXRjaCAoUChhLCBhZCkpIHsKICAgICAgICAgICAgICAgIGNhc2UgJ2QnOgogICAgICAgICAgICAgICAgICAgIGUgPSBjIHx8IChkIHx8IGJkKCExKSArICcnKSArICcvai9jb2xsZWN0JzsKICAgICAgICAgICAgICAgICAgICBiID0gYS5nZXQocWUpIHx8IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICBwZShlLCBQKGEsIFJhKSwgYiwgYS5aKElhKSk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgIGIgPyAoYyA9IFAoYSwgUmEpLCBkID0gKGQgPSBhLlooSWEpKSB8fCB1YSwgJ2ltYWdlJyA9PSBiID8gd2MoZSwgYywgZCkgOiAneGhyJyA9PSBiICYmIHdkKGUsIGMsIGQpIHx8ICdiZWFjb24nID09IGIgJiYgeChlLCBjLCBkKSB8fCBiYShlLCBjLCBkKSkgOiBiYShlLCBQKGEsIFJhKSwgYS5aKElhKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlID0gUChhLCBOYSk7CiAgICAgICAgICAgICAgICBlID0gaChlKTsKICAgICAgICAgICAgICAgIGIgPSBlLmhpdGNvdW50OwogICAgICAgICAgICAgICAgZS5oaXRjb3VudCA9IGIgPyBiICsgMSA6IDE7CiAgICAgICAgICAgICAgICBlLmZpcnN0X2hpdCB8fCAoZS5maXJzdF9oaXQgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKSk7CiAgICAgICAgICAgICAgICBlID0gUChhLCBOYSk7CiAgICAgICAgICAgICAgICBkZWxldGUgaChlKS5wZW5kaW5nX2V4cGVyaW1lbnRzOwogICAgICAgICAgICAgICAgYS5zZXQoSWEsIHVhLCAhMCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gSGMoYSkgewogICAgICAgICAgICAgICAgcWMoKS5leHBJZCAmJiBhLnNldChOYywgcWMoKS5leHBJZCk7CiAgICAgICAgICAgICAgICBxYygpLmV4cFZhciAmJiBhLnNldChPYywgcWMoKS5leHBWYXIpOwogICAgICAgICAgICAgICAgdmFyIGIgPSBQKGEsIE5hKTsKICAgICAgICAgICAgICAgIGlmIChiID0gaChiKS5wZW5kaW5nX2V4cGVyaW1lbnRzKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBbXTsKICAgICAgICAgICAgICAgICAgICBmb3IgKGQgaW4gYikKICAgICAgICAgICAgICAgICAgICAgICAgYi5oYXNPd25Qcm9wZXJ0eShkKSAmJiBiW2RdICYmIGMucHVzaChlbmNvZGVVUklDb21wb25lbnQoZCkgKyAnLicgKyBlbmNvZGVVUklDb21wb25lbnQoYltkXSkpOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gYy5qb2luKCchJyk7CiAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICBkID0gdm9pZCAwOwogICAgICAgICAgICAgICAgZCAmJiAoKGIgPSBhLmdldChtKSkgJiYgKGQgPSBiICsgJyEnICsgZCksIGEuc2V0KG0sIGQsICEwKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gY2QoKSB7CiAgICAgICAgICAgICAgICBpZiAoTy5uYXZpZ2F0b3IgJiYgJ3ByZXZpZXcnID09IE8ubmF2aWdhdG9yLmxvYWRQdXJwb3NlKQogICAgICAgICAgICAgICAgICAgIHRocm93ICdhYm9ydCc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24geWQoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBPLmdhRGV2SWRzIHx8IFtdOwogICAgICAgICAgICAgICAgaWYgKGthKGIpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmdldCgnJmRpZCcpOwogICAgICAgICAgICAgICAgICAgIHFhKGMpICYmIDAgPCBjLmxlbmd0aCAmJiAoYiA9IGIuY29uY2F0KGMuc3BsaXQoJywnKSkpOwogICAgICAgICAgICAgICAgICAgIGMgPSBbXTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gMDsgZCA8IGIubGVuZ3RoOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgIEVlKGMsIGJbZF0pIHx8IGMucHVzaChiW2RdKTsKICAgICAgICAgICAgICAgICAgICAwICE9IGMubGVuZ3RoICYmIGEuc2V0KCcmZGlkJywgYy5qb2luKCcsJyksICEwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiB2YihhKSB7CiAgICAgICAgICAgICAgICBpZiAoIWEuZ2V0KE5hKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyAnYWJvcnQnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFBlKGEpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFhLmdldChRZSkgJiYgKGEuc2V0KFFlLCAhMCksICFhLmdldCgnJmd0bScpKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgbGYoYmUoJ2d0bV9kZWJ1ZycpKSAmJiAoYiA9IDIpOwogICAgICAgICAgICAgICAgICAgICAgICAhYiAmJiBEKE0ucmVmZXJyZXIsICdodHRwczovL3RhZ2Fzc2lzdGFudC5nb29nbGUuY29tLycpICYmIChiID0gMyk7CiAgICAgICAgICAgICAgICAgICAgICAgICFiICYmIEVlKE0uY29va2llLnNwbGl0KCc7ICcpLCAnX19UQUdfQVNTSVNUQU5UPXgnKSAmJiAoYiA9IDQpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gTS5kb2N1bWVudEVsZW1lbnQuZ2V0QXR0cmlidXRlKCdkYXRhLXRhZy1hc3Npc3RhbnQtcHJlc2VudCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGYoYykgJiYgKGIgPSA1KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgT1snZ29vZ2xlLnRhZ21hbmFnZXIuZGVidWd1aTIucXVldWUnXSB8fCAoT1snZ29vZ2xlLnRhZ21hbmFnZXIuZGVidWd1aTIucXVldWUnXSA9IFtdLCBJZCgnaHR0cHM6Ly93d3cuZ29vZ2xlLWFuYWx5dGljcy5jb20vZGVidWcvYm9vdHN0cmFwP2lkPScgKyBhLmdldChOYSkgKyAnJnNyYz1MRUdBQ1kmY29uZD0nICsgYikpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBNLmN1cnJlbnRTY3JpcHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPWydnb29nbGUudGFnbWFuYWdlci5kZWJ1Z3VpMi5xdWV1ZSddLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2VUeXBlOiAnTEVHQUNZX0NPTlRBSU5FUl9TVEFSVElORycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogYS5nZXQoTmEpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY3JpcHRTb3VyY2U6IGQgJiYgZC5zcmMgfHwgJycKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBsZihhKSB7CiAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBhIHx8IDAgPT09IGEubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIGEgPSBOdW1iZXIoYSk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IERhdGUubm93KCk7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA8IGIgKyAzMDAwMDAgJiYgYSA+IGIgLSA5MDAwMDA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgaGQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgucm91bmQoMjE0NzQ4MzY0NyAqIE1hdGgucmFuZG9tKCkpOwogICAgICAgICAgICAgICAgfSwgQmQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBuZXcgVWludDMyQXJyYXkoMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIE8uY3J5cHRvLmdldFJhbmRvbVZhbHVlcyhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbMF0gJiAyMTQ3NDgzNjQ3OwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGhkKCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gVGEoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBSKGEsIFVhKTsKICAgICAgICAgICAgICAgIDUwMCA8PSBiICYmIEooMTUpOwogICAgICAgICAgICAgICAgdmFyIGMgPSBQKGEsIFZhKTsKICAgICAgICAgICAgICAgIGlmICgndHJhbnNhY3Rpb24nICE9IGMgJiYgJ2l0ZW0nICE9IGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gUihhLCBXYSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKSwgZSA9IFIoYSwgWGEpOwogICAgICAgICAgICAgICAgICAgIDAgPT0gZSAmJiBhLnNldChYYSwgZCk7CiAgICAgICAgICAgICAgICAgICAgZSA9IE1hdGgucm91bmQoMiAqIChkIC0gZSkgLyAxMDAwKTsKICAgICAgICAgICAgICAgICAgICAwIDwgZSAmJiAoYyA9IE1hdGgubWluKGMgKyBlLCAyMCksIGEuc2V0KFhhLCBkKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPj0gYykKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ2Fib3J0JzsKICAgICAgICAgICAgICAgICAgICBhLnNldChXYSwgLS1jKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGEuc2V0KFVhLCArK2IpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgdmFyIFlhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdGhpcy5kYXRhID0gbmV3IGVlKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFlhLnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSAkYShhKSwgYyA9IHRoaXMuZGF0YS5nZXQoYSk7CiAgICAgICAgICAgICAgICBiICYmIHZvaWQgMCA9PSBjICYmIChjID0gZWEoYi5kZWZhdWx0VmFsdWUpID8gYi5kZWZhdWx0VmFsdWUoKSA6IGIuZGVmYXVsdFZhbHVlKTsKICAgICAgICAgICAgICAgIHJldHVybiBiICYmIGIuWiA/IGIuWih0aGlzLCBhLCBjKSA6IGM7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBQID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBhID0gYS5nZXQoYik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PSBhID8gJycgOiAnJyArIGE7CiAgICAgICAgICAgICAgICB9LCBSID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBhID0gYS5nZXQoYik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PSBhIHx8ICcnID09PSBhID8gMCA6IE51bWJlcihhKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIFlhLnByb3RvdHlwZS5aID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAoYSA9IHRoaXMuZ2V0KGEpKSAmJiBlYShhKSA/IGEgOiB1YTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWWEucHJvdG90eXBlLnNldCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBpZiAoYSkKICAgICAgICAgICAgICAgICAgICBpZiAoJ29iamVjdCcgPT0gdHlwZW9mIGEpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgaW4gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuaGFzT3duUHJvcGVydHkoZCkgJiYgYWIodGhpcywgZCwgYVtkXSwgYyk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBhYih0aGlzLCBhLCBiLCBjKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGFiID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgIT0gYykKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIE5hOgogICAgICAgICAgICAgICAgICAgICAgICB3Yi50ZXN0KGMpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHZhciBlID0gJGEoYik7CiAgICAgICAgICAgICAgICBlICYmIGUubyA/IGUubyhhLCBiLCBjLCBkKSA6IGEuZGF0YS5zZXQoYiwgYywgZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB1ZSA9IG5ldyBlZSgpLCB2ZSA9IFtdLCBiYiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5uYW1lID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLkYgPSBiOwogICAgICAgICAgICAgICAgICAgIHRoaXMuWiA9IGQ7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5vID0gZTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRlZmF1bHRWYWx1ZSA9IGM7CiAgICAgICAgICAgICAgICB9LCAkYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSB1ZS5nZXQoYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFiKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMDsgYyA8IHZlLmxlbmd0aDsgYysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHZlW2NdLCBlID0gZFswXS5leGVjKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gZFsxXShlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1ZS5zZXQoYi5uYW1lLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSwgeWMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgICAgIHVlLm1hcChmdW5jdGlvbiAoYywgZCkgewogICAgICAgICAgICAgICAgICAgICAgICBkLkYgPT0gYSAmJiAoYiA9IGQpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiICYmIGIubmFtZTsKICAgICAgICAgICAgICAgIH0sIFMgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIGEgPSBuZXcgYmIoYSwgYiwgYywgZCwgZSk7CiAgICAgICAgICAgICAgICAgICAgdWUuc2V0KGEubmFtZSwgYSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubmFtZTsKICAgICAgICAgICAgICAgIH0sIGNiID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2ZS5wdXNoKFsKICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFJlZ0V4cCgnXicgKyBhICsgJyQnKSwKICAgICAgICAgICAgICAgICAgICAgICAgYgogICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgfSwgVCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFMoYSwgYiwgYywgdm9pZCAwLCBkYik7CiAgICAgICAgICAgICAgICB9LCBkYiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBoYiA9IFQoJ2FwaVZlcnNpb24nLCAndicpLCBpYiA9IFQoJ2NsaWVudFZlcnNpb24nLCAnX3YnKTsKICAgICAgICAgICAgUygnYW5vbnltaXplSXAnLCAnYWlwJyk7CiAgICAgICAgICAgIHZhciBqYiA9IFMoJ2FkU2Vuc2VJZCcsICdhJyksIFZhID0gUygnaGl0VHlwZScsICd0JyksIElhID0gUygnaGl0Q2FsbGJhY2snKSwgUmEgPSBTKCdoaXRQYXlsb2FkJyk7CiAgICAgICAgICAgIFMoJ25vbkludGVyYWN0aW9uJywgJ25pJyk7CiAgICAgICAgICAgIFMoJ2N1cnJlbmN5Q29kZScsICdjdScpOwogICAgICAgICAgICBTKCdkYXRhU291cmNlJywgJ2RzJyk7CiAgICAgICAgICAgIHZhciBWZCA9IFMoJ3VzZUJlYWNvbicsIHZvaWQgMCwgITEpLCBmYSA9IFMoJ3RyYW5zcG9ydCcpOwogICAgICAgICAgICBTKCdzZXNzaW9uQ29udHJvbCcsICdzYycsICcnKTsKICAgICAgICAgICAgUygnc2Vzc2lvbkdyb3VwJywgJ3NnJyk7CiAgICAgICAgICAgIFMoJ3F1ZXVlVGltZScsICdxdCcpOwogICAgICAgICAgICB2YXIgQWMgPSBTKCdfcycsICdfcycpOwogICAgICAgICAgICBTKCdzY3JlZW5OYW1lJywgJ2NkJyk7CiAgICAgICAgICAgIHZhciBrYiA9IFMoJ2xvY2F0aW9uJywgJ2RsJywgJycpLCBsYiA9IFMoJ3JlZmVycmVyJywgJ2RyJyksIG1iID0gUygncGFnZScsICdkcCcsICcnKTsKICAgICAgICAgICAgUygnaG9zdG5hbWUnLCAnZGgnKTsKICAgICAgICAgICAgdmFyIG5iID0gUygnbGFuZ3VhZ2UnLCAndWwnKSwgb2IgPSBTKCdlbmNvZGluZycsICdkZScpOwogICAgICAgICAgICBTKCd0aXRsZScsICdkdCcsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBNLnRpdGxlIHx8IHZvaWQgMDsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGNiKCdjb250ZW50R3JvdXAoWzAtOV0rKScsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IGJiKGFbMF0sICdjZycgKyBhWzFdKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBwYiA9IFMoJ3NjcmVlbkNvbG9ycycsICdzZCcpLCBxYiA9IFMoJ3NjcmVlblJlc29sdXRpb24nLCAnc3InKSwgcmIgPSBTKCd2aWV3cG9ydFNpemUnLCAndnAnKSwgc2IgPSBTKCdqYXZhRW5hYmxlZCcsICdqZScpLCB0YiA9IFMoJ2ZsYXNoVmVyc2lvbicsICdmbCcpOwogICAgICAgICAgICBTKCdjYW1wYWlnbklkJywgJ2NpJyk7CiAgICAgICAgICAgIFMoJ2NhbXBhaWduTmFtZScsICdjbicpOwogICAgICAgICAgICBTKCdjYW1wYWlnblNvdXJjZScsICdjcycpOwogICAgICAgICAgICBTKCdjYW1wYWlnbk1lZGl1bScsICdjbScpOwogICAgICAgICAgICBTKCdjYW1wYWlnbktleXdvcmQnLCAnY2snKTsKICAgICAgICAgICAgUygnY2FtcGFpZ25Db250ZW50JywgJ2NjJyk7CiAgICAgICAgICAgIHZhciB1YiA9IFMoJ2V2ZW50Q2F0ZWdvcnknLCAnZWMnKSwgeGIgPSBTKCdldmVudEFjdGlvbicsICdlYScpLCB5YiA9IFMoJ2V2ZW50TGFiZWwnLCAnZWwnKSwgemIgPSBTKCdldmVudFZhbHVlJywgJ2V2JyksIEJiID0gUygnc29jaWFsTmV0d29yaycsICdzbicpLCBDYiA9IFMoJ3NvY2lhbEFjdGlvbicsICdzYScpLCBEYiA9IFMoJ3NvY2lhbFRhcmdldCcsICdzdCcpLCBFYiA9IFMoJ2wxJywgJ3BsdCcpLCBGYiA9IFMoJ2wyJywgJ3BkdCcpLCBHYiA9IFMoJ2wzJywgJ2RucycpLCBIYiA9IFMoJ2w0JywgJ3JydCcpLCBJYiA9IFMoJ2w1JywgJ3NydCcpLCBKYiA9IFMoJ2w2JywgJ3RjcCcpLCBLYiA9IFMoJ2w3JywgJ2RpdCcpLCBMYiA9IFMoJ2w4JywgJ2NsdCcpLCBWZSA9IFMoJ2w5JywgJ19nc3QnKSwgV2UgPSBTKCdsMTAnLCAnX2didCcpLCBYZSA9IFMoJ2wxMScsICdfY3N0JyksIFllID0gUygnbDEyJywgJ19jYnQnKSwgTWIgPSBTKCd0aW1pbmdDYXRlZ29yeScsICd1dGMnKSwgTmIgPSBTKCd0aW1pbmdWYXInLCAndXR2JyksIE9iID0gUygndGltaW5nTGFiZWwnLCAndXRsJyksIFBiID0gUygndGltaW5nVmFsdWUnLCAndXR0Jyk7CiAgICAgICAgICAgIFMoJ2FwcE5hbWUnLCAnYW4nKTsKICAgICAgICAgICAgUygnYXBwVmVyc2lvbicsICdhdicsICcnKTsKICAgICAgICAgICAgUygnYXBwSWQnLCAnYWlkJywgJycpOwogICAgICAgICAgICBTKCdhcHBJbnN0YWxsZXJJZCcsICdhaWlkJywgJycpOwogICAgICAgICAgICBTKCdleERlc2NyaXB0aW9uJywgJ2V4ZCcpOwogICAgICAgICAgICBTKCdleEZhdGFsJywgJ2V4ZicpOwogICAgICAgICAgICB2YXIgTmMgPSBTKCdleHBJZCcsICd4aWQnKSwgT2MgPSBTKCdleHBWYXInLCAneHZhcicpLCBtID0gUygnZXhwJywgJ2V4cCcpLCBSYyA9IFMoJ191dG1hJywgJ191dG1hJyksIFNjID0gUygnX3V0bXonLCAnX3V0bXonKSwgVGMgPSBTKCdfdXRtaHQnLCAnX3V0bWh0JyksIFVhID0gUygnX2hjJywgdm9pZCAwLCAwKSwgWGEgPSBTKCdfdGknLCB2b2lkIDAsIDApLCBXYSA9IFMoJ190bycsIHZvaWQgMCwgMjApOwogICAgICAgICAgICBjYignZGltZW5zaW9uKFswLTldKyknLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBiYihhWzBdLCAnY2QnICsgYVsxXSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBjYignbWV0cmljKFswLTldKyknLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBiYihhWzBdLCAnY20nICsgYVsxXSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBTKCdsaW5rZXJQYXJhbScsIHZvaWQgMCwgdm9pZCAwLCBCYywgZGIpOwogICAgICAgICAgICB2YXIgWmUgPSBUKCdfY2QybCcsIHZvaWQgMCwgITEpLCBsZCA9IFMoJ3VzYWdlJywgJ191JyksIEdkID0gUygnX3VtJyk7CiAgICAgICAgICAgIFMoJ2ZvcmNlU1NMJywgdm9pZCAwLCB2b2lkIDAsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBCYTsKICAgICAgICAgICAgfSwgZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIEooMzQpOwogICAgICAgICAgICAgICAgQmEgPSAhIWM7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgZWQgPSBTKCdfajEnLCAnamlkJyksIGlhID0gUygnX2oyJywgJ2dqaWQnKTsKICAgICAgICAgICAgY2IoJ1xcJiguKiknLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBuZXcgYmIoYVswXSwgYVsxXSksIGMgPSB5YyhhWzBdLnN1YnN0cmluZygxKSk7CiAgICAgICAgICAgICAgICBjICYmIChiLlogPSBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBkLmdldChjKTsKICAgICAgICAgICAgICAgIH0sIGIubyA9IGZ1bmN0aW9uIChkLCBlLCBnLCBjYSkgewogICAgICAgICAgICAgICAgICAgIGQuc2V0KGMsIGcsIGNhKTsKICAgICAgICAgICAgICAgIH0sIGIuRiA9IHZvaWQgMCk7CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBRYiA9IFQoJ19vb3QnKSwgZGQgPSBTKCdwcmV2aWV3VGFzaycpLCBSYiA9IFMoJ2NoZWNrUHJvdG9jb2xUYXNrJyksIG1kID0gUygndmFsaWRhdGlvblRhc2snKSwgU2IgPSBTKCdjaGVja1N0b3JhZ2VUYXNrJyksIFVjID0gUygnaGlzdG9yeUltcG9ydFRhc2snKSwgVGIgPSBTKCdzYW1wbGVyVGFzaycpLCBWYiA9IFMoJ19ybHQnKSwgV2IgPSBTKCdidWlsZEhpdFRhc2snKSwgWGIgPSBTKCdzZW5kSGl0VGFzaycpLCBWYyA9IFMoJ2NlVGFzaycpLCB6ZCA9IFMoJ2RldklkVGFzaycpLCBDZCA9IFMoJ3RpbWluZ1Rhc2snKSwgTGQgPSBTKCdkaXNwbGF5RmVhdHVyZXNUYXNrJyksIG9hID0gUygnY3VzdG9tVGFzaycpLCB6ZSA9IFMoJ2Zwc0Nyb3NzRG9tYWluVGFzaycpLCBSZSA9IFQoJ19jdGEnKSwgViA9IFQoJ25hbWUnKSwgUSA9IFQoJ2NsaWVudElkJywgJ2NpZCcpLCBuID0gVCgnY2xpZW50SWRUaW1lJyksIHhkID0gVCgnc3RvcmVkQ2xpZW50SWQnKSwgQWQgPSBTKCd1c2VySWQnLCAndWlkJyksIE5hID0gVCgndHJhY2tpbmdJZCcsICd0aWQnKSwgVSA9IFQoJ2Nvb2tpZU5hbWUnLCB2b2lkIDAsICdfZ2EnKSwgVyA9IFQoJ2Nvb2tpZURvbWFpbicpLCBZYiA9IFQoJ2Nvb2tpZVBhdGgnLCB2b2lkIDAsICcvJyksIFpiID0gVCgnY29va2llRXhwaXJlcycsIHZvaWQgMCwgNjMwNzIwMDApLCBIZCA9IFQoJ2Nvb2tpZVVwZGF0ZScsIHZvaWQgMCwgITApLCBCZSA9IFQoJ2Nvb2tpZUZsYWdzJywgdm9pZCAwLCAnJyksICRiID0gVCgnbGVnYWN5Q29va2llRG9tYWluJyksIFdjID0gVCgnbGVnYWN5SGlzdG9yeUltcG9ydCcsIHZvaWQgMCwgITApLCBhYyA9IFQoJ3N0b3JhZ2UnLCB2b2lkIDAsICdjb29raWUnKSwgYmMgPSBUKCdhbGxvd0xpbmtlcicsIHZvaWQgMCwgITEpLCBjYyA9IFQoJ2FsbG93QW5jaG9yJywgdm9pZCAwLCAhMCksIEthID0gVCgnc2FtcGxlUmF0ZScsICdzZicsIDEwMCksIGRjID0gVCgnc2l0ZVNwZWVkU2FtcGxlUmF0ZScsIHZvaWQgMCwgMSksIGVjID0gVCgnYWx3YXlzU2VuZFJlZmVycmVyJywgdm9pZCAwLCAhMSksIEkgPSBUKCdfZ2lkJywgJ19naWQnKSwgbGEgPSBUKCdfZ2NuJyksIEtkID0gVCgndXNlQW1wQ2xpZW50SWQnKSwgY2UgPSBUKCdfZ2NsaWQnKSwgZmUgPSBUKCdfZ3QnKSwgaGUgPSBUKCdfZ2UnLCB2b2lkIDAsIDc3NzYwMDAwMDApLCBpZSA9IFQoJ19nY2xzcmMnKSwgamUgPSBUKCdzdG9yZUdhYycsIHZvaWQgMCwgITApLCBvZSA9IFMoJ194XzE5JyksIEFlID0gUygnX2ZwbGMnLCAnX2ZwbGMnKSwgRiA9IFQoJ19jcycpLCBKZSA9IFQoJ191c2VVcCcsIHZvaWQgMCwgITEpLCBMZSA9IFMoJ3VwJywgJ3VwJyksIFFlID0gUygnX3RhYycsIHZvaWQgMCwgITEpLCBTZSA9IFQoJ19nYnJhaWQnKSwgVGUgPSBUKCdfZ2J0JyksIGJmID0gVCgnX2diZScsIHZvaWQgMCwgNzc3NjAwMDAwMCksIGdkID0gUygndHJhbnNwb3J0VXJsJyksIE1kID0gUygnX3InLCAnX3InKSwgT2QgPSBTKCdfc2xjJywgJ19zbGMnKSwgcWUgPSBTKCdfZHAnKSwgYWQgPSBTKCdfanQnLCB2b2lkIDAsICduJyksIFVkID0gUygnYWxsb3dBZEZlYXR1cmVzJywgdm9pZCAwLCAhMCksIHhlID0gUygnYWxsb3dBZFBlcnNvbmFsaXphdGlvblNpZ25hbHMnLCB2b2lkIDAsICEwKTsKICAgICAgICAgICAgZnVuY3Rpb24gWChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBiW2FdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkICYmIEooZCksIGMuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGdlKCdleGMnLCBhLCBlICYmIGUubmFtZSksIGU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBFZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdjb29raWUnID09IGEuZ2V0KGFjKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPSBDYSgnRlBMQycpLCAwIDwgYS5sZW5ndGggPyBhWzBdIDogdm9pZCAwOwogICAgICAgICAgICAgICAgfSwgRmUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgICAgIGlmIChiID0gUChhLCBvZSkgJiYgYS5nZXQoWmUpKQogICAgICAgICAgICAgICAgICAgICAgICBiID0gRGUuZ2V0KGEuZ2V0KGNjKSksIGIgPSAhKGIgJiYgYi5fZnBsYyk7CiAgICAgICAgICAgICAgICAgICAgYiAmJiAhRWQoYSkgJiYgYS5zZXQoQWUsICcwJyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgYWEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gTWF0aC5taW4oUihhLCBkYyksIDEwMCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIExhKFAoYSwgUSkpICUgMTAwID49IGIgPyAhMSA6ICEwOwogICAgICAgICAgICAgICAgfSwgZ2MgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0ge307CiAgICAgICAgICAgICAgICAgICAgaWYgKEVjKGIpIHx8IEZjKGIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYltFYl07CiAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PSBjIHx8IEluZmluaXR5ID09IGMgfHwgaXNOYU4oYykgfHwgKDAgPCBjID8gKFkoYiwgR2IpLCBZKGIsIEpiKSwgWShiLCBJYiksIFkoYiwgRmIpLCBZKGIsIEhiKSwgWShiLCBLYiksIFkoYiwgTGIpLCBZKGIsIFZlKSwgWShiLCBXZSksIFkoYiwgWGUpLCBZKGIsIFllKSwgdmEoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYShiKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgMTApKSA6IEwoTywgJ2xvYWQnLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnYyhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgITEpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBFYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBPLnBlcmZvcm1hbmNlIHx8IE8ud2Via2l0UGVyZm9ybWFuY2U7CiAgICAgICAgICAgICAgICAgICAgYiA9IGIgJiYgYi50aW1pbmc7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFiKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBiLm5hdmlnYXRpb25TdGFydDsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSBjKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgYVtFYl0gPSBiLmxvYWRFdmVudFN0YXJ0IC0gYzsKICAgICAgICAgICAgICAgICAgICBhW0diXSA9IGIuZG9tYWluTG9va3VwRW5kIC0gYi5kb21haW5Mb29rdXBTdGFydDsKICAgICAgICAgICAgICAgICAgICBhW0piXSA9IGIuY29ubmVjdEVuZCAtIGIuY29ubmVjdFN0YXJ0OwogICAgICAgICAgICAgICAgICAgIGFbSWJdID0gYi5yZXNwb25zZVN0YXJ0IC0gYi5yZXF1ZXN0U3RhcnQ7CiAgICAgICAgICAgICAgICAgICAgYVtGYl0gPSBiLnJlc3BvbnNlRW5kIC0gYi5yZXNwb25zZVN0YXJ0OwogICAgICAgICAgICAgICAgICAgIGFbSGJdID0gYi5mZXRjaFN0YXJ0IC0gYzsKICAgICAgICAgICAgICAgICAgICBhW0tiXSA9IGIuZG9tSW50ZXJhY3RpdmUgLSBjOwogICAgICAgICAgICAgICAgICAgIGFbTGJdID0gYi5kb21Db250ZW50TG9hZGVkRXZlbnRTdGFydCAtIGM7CiAgICAgICAgICAgICAgICAgICAgYVtWZV0gPSBOLkwgLSBjOwogICAgICAgICAgICAgICAgICAgIGFbV2VdID0gTi55YSAtIGM7CiAgICAgICAgICAgICAgICAgICAgTy5nb29nbGVfdGFnX21hbmFnZXIgJiYgTy5nb29nbGVfdGFnX21hbmFnZXIuX2xpICYmIChiID0gTy5nb29nbGVfdGFnX21hbmFnZXIuX2xpLCBhW1hlXSA9IGIuY3N0LCBhW1llXSA9IGIuY2J0KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9LCBGYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE8udG9wICE9IE8pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IE8uZXh0ZXJuYWwsIGMgPSBiICYmIGIub25sb2FkVDsKICAgICAgICAgICAgICAgICAgICBiICYmICFiLmlzVmFsaWRMb2FkVGltZSAmJiAoYyA9IHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgMjE0NzQ4MzY0OCA8IGMgJiYgKGMgPSB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIDAgPCBjICYmIGIuc2V0UGFnZVJlYWR5VGltZSgpOwogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIGFbRWJdID0gYzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICB9LCBZID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGFbYl07CiAgICAgICAgICAgICAgICAgICAgaWYgKGlzTmFOKGMpIHx8IEluZmluaXR5ID09IGMgfHwgMCA+IGMpCiAgICAgICAgICAgICAgICAgICAgICAgIGFbYl0gPSB2b2lkIDA7CiAgICAgICAgICAgICAgICB9LCBGZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgncGFnZXZpZXcnID09IGIuZ2V0KFZhKSAmJiAhYS5JKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLkkgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYWEoYiksIGQgPSAwIDwgRShQKGIsIGtiKSwgJ2djbGlkJykubGVuZ3RoLCBlID0gMCA8IEUoUChiLCBrYiksICd3YnJhaWQnKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoYyB8fCBkIHx8IGUpICYmIGdjKGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyAmJiBhLnNlbmQoJ3RpbWluZycsIGcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChkIHx8IGUpICYmIGEuc2VuZCgnYWR0aW1pbmcnLCBnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBoYyA9ICExLCBtYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdjb29raWUnID09IFAoYSwgYWMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmdldChIZCkgfHwgUChhLCB4ZCkgIT0gUChhLCBRKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSAxMDAwICogUihhLCBaYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYShhLCBRLCBVLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuZGF0YS5zZXQoeGQsIFAoYSwgUSkpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIChhLmdldChIZCkgfHwgdWMoYSkgIT0gUChhLCBJKSkgJiYgbWEoYSwgSSwgbGEsIDg2NDAwMDAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEuZ2V0KGplKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIgPSBQKGEsIGNlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gTWF0aC5taW4oUihhLCBoZSksIDEwMDAgKiBSKGEsIFpiKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IDAgPT09IGMgPyAwIDogTWF0aC5taW4oYywgMTAwMCAqIFIoYSwgZmUpICsgYyAtIG5ldyBEYXRlKCkuZ2V0VGltZSgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmRhdGEuc2V0KGhlLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHt9LCBlID0gUChhLCBmZSksIGcgPSBQKGEsIGllKSwgY2EgPSBrYyhQKGEsIFliKSksIGwgPSBsYyhQKGEsIFcpKSwgayA9IFAoYSwgTmEpLCB3ID0gUChhLCBCZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyAmJiAnYXcuZHMnICE9IGcgPyBkICYmIChkLnVhID0gITApIDogKGIgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2MoYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLmpvaW4oJy4nKSwgMCA8PSBjICYmIChkICYmIChkLnRhID0gITApLCB6YygnX2dhY18nICsgQ2MoayksIGIsIGNhLCBsLCBrLCBjLCB3KSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlKGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEooNzUpOwogICAgICAgICAgICAgICAgICAgICAgICBhLmdldChqZSkgJiYgKGIgPSBQKGEsIFNlKSkgJiYgKGMgPSBNYXRoLm1pbihSKGEsIGJmKSwgMTAwMCAqIFIoYSwgWmIpKSwgYyA9IDAgPT09IGMgPyAwIDogTWF0aC5taW4oYywgMTAwMCAqIFIoYSwgVGUpICsgYyAtIG5ldyBEYXRlKCkuZ2V0VGltZSgpKSwgYS5kYXRhLnNldChiZiwgYyksIGQgPSB7fSwgdyA9IFAoYSwgVGUpLCBjYSA9IGtjKFAoYSwgWWIpKSwgbCA9IGxjKFAoYSwgVykpLCBrID0gUChhLCBOYSksIGEgPSBQKGEsIEJlKSwgYiA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBDYyhiKQogICAgICAgICAgICAgICAgICAgICAgICBdLmpvaW4oJy4nKSwgMCA8PSBjICYmIChkICYmIChkLnRhID0gITApLCB6YygnX2dhY19nYl8nICsgQ2MoayksIGIsIGNhLCBsLCBrLCBjLCBhKSksIGVmKGQpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBtYSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBuZChhLCBiKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICBjID0gUChhLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBrYyhQKGEsIFliKSksIGNhID0gbGMoUChhLCBXKSksIGwgPSBQKGEsIEJlKSwgayA9IFAoYSwgTmEpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ2F1dG8nICE9IGNhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgemMoYywgZSwgZywgY2EsIGssIGQsIGwpICYmIChoYyA9ICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBKKDMyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHcgPSBpZCgpLCBDZSA9IDA7IENlIDwgdy5sZW5ndGg7IENlKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNhID0gd1tDZV0sIGEuZGF0YS5zZXQoVywgY2EpLCBlID0gbmQoYSwgYiksIHpjKGMsIGUsIGcsIGNhLCBrLCBkLCBsKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5kYXRhLnNldChXLCAnYXV0bycpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdWMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gQ2EoUChhLCBsYSkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBYZChhLCBiKTsKICAgICAgICAgICAgICAgIH0sIG5jID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoJ2Nvb2tpZScgPT0gUChhLCBhYykgJiYgIWhjICYmIChtYyhhKSwgIWhjKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ2Fib3J0JzsKICAgICAgICAgICAgICAgIH0sIFljID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5nZXQoV2MpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gUChhLCBXKSwgYyA9IFAoYSwgJGIpIHx8IHhhKCksIGQgPSBYYygnX191dG1hJywgYywgYik7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgJiYgKEooMTkpLCBhLnNldChUYywgbmV3IERhdGUoKS5nZXRUaW1lKCksICEwKSwgYS5zZXQoUmMsIGQuUiksIChiID0gWGMoJ19fdXRteicsIGMsIGIpKSAmJiBkLmhhc2ggPT0gYi5oYXNoICYmIGEuc2V0KFNjLCBiLlIpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBuZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IENjKFAoYSwgYikpOwogICAgICAgICAgICAgICAgICAgIHZhciBjID0gbGMoUChhLCBXKSkuc3BsaXQoJy4nKS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgYSA9IGpjKFAoYSwgWWIpKTsKICAgICAgICAgICAgICAgICAgICAxIDwgYSAmJiAoYyArPSAnLScgKyBhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiA/IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ0dBMScsCiAgICAgICAgICAgICAgICAgICAgICAgIGMsCiAgICAgICAgICAgICAgICAgICAgICAgIGIKICAgICAgICAgICAgICAgICAgICBdLmpvaW4oJy4nKSA6ICcnOwogICAgICAgICAgICAgICAgfSwgWGQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuYShiLCBQKGEsIFcpLCBQKGEsIFliKSk7CiAgICAgICAgICAgICAgICB9LCBuYSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8IDEgPiBhLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgSigxMik7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSBbXSwgZSA9IDA7IGUgPCBhLmxlbmd0aDsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGFbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgY2EgPSBnLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGNhLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAoJ0dBMScgPT0gbCB8fCAnMScgPT0gbCkgJiYgMSA8IGNhLmxlbmd0aCA/IChnID0gY2Euc2hpZnQoKS5zcGxpdCgnLScpLCAxID09IGcubGVuZ3RoICYmIChnWzFdID0gJzEnKSwgZ1swXSAqPSAxLCBnWzFdICo9IDEsIGNhID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEg6IGcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczogY2Euam9pbignLicpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSA6IGNhID0ga2QudGVzdChnKSA/IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIOiBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHM6IGcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gOiB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYSAmJiBkLnB1c2goY2EpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgxID09IGQubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEooMTMpLCBkWzBdLnM7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwID09IGQubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgSigxMik7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSigxNCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gR2MoZCwgbGMoYikuc3BsaXQoJy4nKS5sZW5ndGgsIDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT0gZC5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRbMF0uczsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBHYyhkLCBqYyhjKSwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxIDwgZC5sZW5ndGggJiYgSig0MSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZFswXSAmJiBkWzBdLnM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBHYyA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IFtdLCBlID0gW10sIGcsIGNhID0gMDsgY2EgPCBhLmxlbmd0aDsgY2ErKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IGFbY2FdOwogICAgICAgICAgICAgICAgICAgICAgICBsLkhbY10gPT0gYiA/IGQucHVzaChsKSA6IHZvaWQgMCA9PSBnIHx8IGwuSFtjXSA8IGcgPyAoZSA9IFtsXSwgZyA9IGwuSFtjXSkgOiBsLkhbY10gPT0gZyAmJiBlLnB1c2gobCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiAwIDwgZC5sZW5ndGggPyBkIDogZTsKICAgICAgICAgICAgICAgIH0sIGxjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA9PSBhLmluZGV4T2YoJy4nKSA/IGEuc3Vic3RyKDEpIDogYTsKICAgICAgICAgICAgICAgIH0sIGlkID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gW10sIGIgPSB4YSgpLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDQgPT0gYi5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBiW2IubGVuZ3RoIC0gMV07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYXJzZUludChjLCAxMCkgPT0gYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbJ25vbmUnXTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZm9yIChjID0gYi5sZW5ndGggLSAyOyAwIDw9IGM7IGMtLSkKICAgICAgICAgICAgICAgICAgICAgICAgYS5wdXNoKGIuc2xpY2UoYykuam9pbignLicpKTsKICAgICAgICAgICAgICAgICAgICBiID0gTS5sb2NhdGlvbi5ob3N0bmFtZTsKICAgICAgICAgICAgICAgICAgICBlYi50ZXN0KGIpIHx8IHZjLnRlc3QoYikgfHwgYS5wdXNoKCdub25lJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9LCBrYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJy8nOwogICAgICAgICAgICAgICAgICAgIDEgPCBhLmxlbmd0aCAmJiBhLmxhc3RJbmRleE9mKCcvJykgPT0gYS5sZW5ndGggLSAxICYmIChhID0gYS5zdWJzdHIoMCwgYS5sZW5ndGggLSAxKSk7CiAgICAgICAgICAgICAgICAgICAgMCAhPSBhLmluZGV4T2YoJy8nKSAmJiAoYSA9ICcvJyArIGEpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSwgamMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEgPSBrYyhhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJy8nID09IGEgPyAxIDogYS5zcGxpdCgnLycpLmxlbmd0aDsKICAgICAgICAgICAgICAgIH0sIGxlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBhLnRhICYmIEooNzcpOwogICAgICAgICAgICAgICAgICAgIGEubmEgJiYgSig3NCk7CiAgICAgICAgICAgICAgICAgICAgYS5wYSAmJiBKKDczKTsKICAgICAgICAgICAgICAgICAgICBhLnVhICYmIEooNjkpOwogICAgICAgICAgICAgICAgfSwgZWYgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEudGEgJiYgSig4NSk7CiAgICAgICAgICAgICAgICAgICAgYS5uYSAmJiBKKDg2KTsKICAgICAgICAgICAgICAgICAgICBhLnBhICYmIEooODcpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gWGMoYSwgYiwgYykgewogICAgICAgICAgICAgICAgJ25vbmUnID09IGIgJiYgKGIgPSAnJyk7CiAgICAgICAgICAgICAgICB2YXIgZCA9IFtdLCBlID0gQ2EoYSk7CiAgICAgICAgICAgICAgICBhID0gJ19fdXRtYScgPT0gYSA/IDYgOiAyOwogICAgICAgICAgICAgICAgZm9yICh2YXIgZyA9IDA7IGcgPCBlLmxlbmd0aDsgZysrKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGNhID0gKCcnICsgZVtnXSkuc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgICAgICBjYS5sZW5ndGggPj0gYSAmJiBkLnB1c2goewogICAgICAgICAgICAgICAgICAgICAgICBoYXNoOiBjYVswXSwKICAgICAgICAgICAgICAgICAgICAgICAgUjogZVtnXSwKICAgICAgICAgICAgICAgICAgICAgICAgTzogY2EKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgwICE9IGQubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgIHJldHVybiAxID09IGQubGVuZ3RoID8gZFswXSA6IFpjKGIsIGQpIHx8IFpjKGMsIGQpIHx8IFpjKG51bGwsIGQpIHx8IGRbMF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gWmMoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKG51bGwgPT0gYSkKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEgPSAxOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIGMgPSBMYShhKSwgYSA9IExhKEQoYSwgJy4nKSA/IGEuc3Vic3RyaW5nKDEpIDogJy4nICsgYSk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gMDsgZCA8IGIubGVuZ3RoOyBkKyspCiAgICAgICAgICAgICAgICAgICAgaWYgKGJbZF0uaGFzaCA9PSBjIHx8IGJbZF0uaGFzaCA9PSBhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYltkXTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBKYyA9IG5ldyBSZWdFeHAoL15odHRwcz86XC9cLyhbXlwvOl0rKS8pLCBEZSA9IE8uZ29vZ2xlX3RhZ19kYXRhLmdsQnJpZGdlLCBLYyA9IFJlZ0V4cCgnKC4qKShbPyYjXSkoPzpfZ2E9W14mI10qKSg/OiY/KSguKiknKSwgb2QgPSBSZWdFeHAoJyguKikoWz8mI10pKD86X2dhYz1bXiYjXSopKD86Jj8pKC4qKScpOwogICAgICAgICAgICBmdW5jdGlvbiBCYyhhKSB7CiAgICAgICAgICAgICAgICBpZiAoYS5nZXQoWmUpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBKKDM1KSwgRGUuZ2VuZXJhdGUoJGUoYSkpOwogICAgICAgICAgICAgICAgdmFyIGIgPSBQKGEsIFEpLCBjID0gUChhLCBJKSB8fCAnJzsKICAgICAgICAgICAgICAgIGIgPSAnX2dhPTIuJyArIEsocGEoYyArIGIsIDApICsgJy4nICsgYyArICctJyArIGIpOwogICAgICAgICAgICAgICAgKGEgPSBhZihhKSkgPyAoSig0NCksIGEgPSAnJl9nYWM9MS4nICsgSyhbCiAgICAgICAgICAgICAgICAgICAgcGEoYS5xYSwgMCksCiAgICAgICAgICAgICAgICAgICAgYS50aW1lc3RhbXAsCiAgICAgICAgICAgICAgICAgICAgYS5xYQogICAgICAgICAgICAgICAgXS5qb2luKCcuJykpKSA6IGEgPSAnJzsKICAgICAgICAgICAgICAgIHJldHVybiBiICsgYTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBJYyhhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IG5ldyBEYXRlKCksIGQgPSBPLm5hdmlnYXRvciwgZSA9IGQucGx1Z2lucyB8fCBbXTsKICAgICAgICAgICAgICAgIGEgPSBbCiAgICAgICAgICAgICAgICAgICAgYSwKICAgICAgICAgICAgICAgICAgICBkLnVzZXJBZ2VudCwKICAgICAgICAgICAgICAgICAgICBjLmdldFRpbWV6b25lT2Zmc2V0KCksCiAgICAgICAgICAgICAgICAgICAgYy5nZXRZZWFyKCksCiAgICAgICAgICAgICAgICAgICAgYy5nZXREYXRlKCksCiAgICAgICAgICAgICAgICAgICAgYy5nZXRIb3VycygpLAogICAgICAgICAgICAgICAgICAgIGMuZ2V0TWludXRlcygpICsgYgogICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgIGZvciAoYiA9IDA7IGIgPCBlLmxlbmd0aDsgKytiKQogICAgICAgICAgICAgICAgICAgIGEucHVzaChlW2JdLmRlc2NyaXB0aW9uKTsKICAgICAgICAgICAgICAgIHJldHVybiBMYShhLmpvaW4oJy4nKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcGEoYSwgYikgewogICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgRGF0ZSgpLCBkID0gTy5uYXZpZ2F0b3IsIGUgPSBjLmdldEhvdXJzKCkgKyBNYXRoLmZsb29yKChjLmdldE1pbnV0ZXMoKSArIGIpIC8gNjApOwogICAgICAgICAgICAgICAgcmV0dXJuIExhKFsKICAgICAgICAgICAgICAgICAgICBhLAogICAgICAgICAgICAgICAgICAgIGQudXNlckFnZW50LAogICAgICAgICAgICAgICAgICAgIGQubGFuZ3VhZ2UgfHwgJycsCiAgICAgICAgICAgICAgICAgICAgYy5nZXRUaW1lem9uZU9mZnNldCgpLAogICAgICAgICAgICAgICAgICAgIGMuZ2V0WWVhcigpLAogICAgICAgICAgICAgICAgICAgIGMuZ2V0RGF0ZSgpICsgTWF0aC5mbG9vcihlIC8gMjQpLAogICAgICAgICAgICAgICAgICAgICgyNCArIGUpICUgMjQsCiAgICAgICAgICAgICAgICAgICAgKDYwICsgYy5nZXRNaW51dGVzKCkgKyBiKSAlIDYwCiAgICAgICAgICAgICAgICBdLmpvaW4oJy4nKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIERjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEooNDgpOwogICAgICAgICAgICAgICAgdGhpcy50YXJnZXQgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5UID0gITE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIERjLnByb3RvdHlwZS5jYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnRhcmdldC5nZXQoWmUpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGUuZGVjb3JhdGUoJGUodGhpcy50YXJnZXQpLCBhLCBiKTsKICAgICAgICAgICAgICAgICAgICBpZiAoYS50YWdOYW1lKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnYScgPT0gYS50YWdOYW1lLnRvTG93ZXJDYXNlKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuaHJlZiAmJiAoYS5ocmVmID0gcWQodGhpcywgYS5ocmVmLCBiKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdmb3JtJyA9PSBhLnRhZ05hbWUudG9Mb3dlckNhc2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZCh0aGlzLCBhKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKCdzdHJpbmcnID09IHR5cGVvZiBhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcWQodGhpcywgYSwgYik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBxZCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBLYy5leGVjKGIpOwogICAgICAgICAgICAgICAgICAgIGQgJiYgMyA8PSBkLmxlbmd0aCAmJiAoYiA9IGRbMV0gKyAoZFszXSA/IGRbMl0gKyBkWzNdIDogJycpKTsKICAgICAgICAgICAgICAgICAgICAoZCA9IG9kLmV4ZWMoYikpICYmIDMgPD0gZC5sZW5ndGggJiYgKGIgPSBkWzFdICsgKGRbM10gPyBkWzJdICsgZFszXSA6ICcnKSk7CiAgICAgICAgICAgICAgICAgICAgYSA9IGEudGFyZ2V0LmdldCgnbGlua2VyUGFyYW0nKTsKICAgICAgICAgICAgICAgICAgICBkID0gYi5pbmRleE9mKCc/Jyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBiLmluZGV4T2YoJyMnKTsKICAgICAgICAgICAgICAgICAgICBiID0gYyA/IGIgKyAoKC0xID09IGUgPyAnIycgOiAnJicpICsgYSkgOiAtMSA9PSBlID8gYiArICgoLTEgPT09IGQgPyAnPycgOiAnJicpICsgYSkgOiBiLnN1YnN0cmluZygwLCBlKSArICgtMSA9PT0gZCB8fCBkID4gZSA/ICc/JyA6ICcmJykgKyBhICsgYi5zdWJzdHJpbmcoZSk7CiAgICAgICAgICAgICAgICAgICAgYiA9IGIucmVwbGFjZSgvJitfZ2E9LywgJyZfZ2E9Jyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIgPSBiLnJlcGxhY2UoUmVnRXhwKCcmK19nYWM9JyksICcmX2dhYz0nKTsKICAgICAgICAgICAgICAgIH0sIHJkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYiAmJiBiLmFjdGlvbikKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdnZXQnID09IGIubWV0aG9kLnRvTG93ZXJDYXNlKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLnRhcmdldC5nZXQoJ2xpbmtlclBhcmFtJykuc3BsaXQoJyYnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwOyBjIDwgYS5sZW5ndGg7IGMrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gYVtjXS5zcGxpdCgnPScpLCBlID0gZFsxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gZFswXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBnID0gYi5jaGlsZE5vZGVzIHx8IFtdLCBjYSA9ICExLCBsID0gMDsgbCA8IGcubGVuZ3RoOyBsKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChnW2xdLm5hbWUgPT0gZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ1tsXS5zZXRBdHRyaWJ1dGUoJ3ZhbHVlJywgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYSA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYSB8fCAoZyA9IE0uY3JlYXRlRWxlbWVudCgnaW5wdXQnKSwgZy5zZXRBdHRyaWJ1dGUoJ3R5cGUnLCAnaGlkZGVuJyksIGcuc2V0QXR0cmlidXRlKCduYW1lJywgZCksIGcuc2V0QXR0cmlidXRlKCd2YWx1ZScsIGUpLCBiLmFwcGVuZENoaWxkKGcpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncG9zdCcgPT0gYi5tZXRob2QudG9Mb3dlckNhc2UoKSAmJiAoYi5hY3Rpb24gPSBxZChhLCBiLmFjdGlvbikpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgRGMucHJvdG90eXBlLlMgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgZnVuY3Rpb24gZChnKSB7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGcgfHwgTy5ldmVudDsKICAgICAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGNhID0gZy50YXJnZXQgfHwgZy5zcmNFbGVtZW50OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChnID0gMTAwOyBjYSAmJiAwIDwgZzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2EuaHJlZiAmJiBjYS5ub2RlTmFtZS5tYXRjaCgvXmEoPzpyZWEpPyQvaSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBjYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2EgPSBjYS5wYXJlbnROb2RlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGctLTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAoJ2h0dHA6JyA9PSBsLnByb3RvY29sIHx8ICdodHRwczonID09IGwucHJvdG9jb2wpICYmIHNkKGEsIGwuaG9zdG5hbWUgfHwgJycpICYmIGwuaHJlZiAmJiAobC5ocmVmID0gcWQoZSwgbC5ocmVmLCBiKSk7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaykgewogICAgICAgICAgICAgICAgICAgICAgICBKKDI2KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICB0aGlzLnRhcmdldC5nZXQoWmUpID8gRGUuYXV0byhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRlKGUudGFyZ2V0KTsKICAgICAgICAgICAgICAgIH0sIGEsIGIgPyAnZnJhZ21lbnQnIDogJycsIGMpIDogKHRoaXMuVCB8fCAodGhpcy5UID0gITAsIEwoTSwgJ21vdXNlZG93bicsIGQsICExKSwgTChNLCAna2V5dXAnLCBkLCAhMSkpLCBjICYmIEwoTSwgJ3N1Ym1pdCcsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgZyA9IGcgfHwgTy5ldmVudDsKICAgICAgICAgICAgICAgICAgICBpZiAoKGcgPSBnLnRhcmdldCB8fCBnLnNyY0VsZW1lbnQpICYmIGcuYWN0aW9uKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjYSA9IGcuYWN0aW9uLm1hdGNoKEpjKTsKICAgICAgICAgICAgICAgICAgICAgICAgY2EgJiYgc2QoYSwgY2FbMV0pICYmIHJkKGUsIGcpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgRGMucHJvdG90eXBlLiQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHRoaXMsIGMgPSBiLnRhcmdldC5nZXQoRik7CiAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBjICYmIERlLnBhc3N0aHJvdWdoKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMoJ2FuYWx5dGljc19zdG9yYWdlJykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkLl9nYSA9IGIudGFyZ2V0LmdldChRKSwgZC5fdXAgPSAnMScsIGQ7CiAgICAgICAgICAgICAgICAgICAgfSwgMSwgITApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBzZChhLCBiKSB7CiAgICAgICAgICAgICAgICBpZiAoYiA9PSBNLmxvY2F0aW9uLmhvc3RuYW1lKQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwOyBjIDwgYS5sZW5ndGg7IGMrKykKICAgICAgICAgICAgICAgICAgICBpZiAoYVtjXSBpbnN0YW5jZW9mIFJlZ0V4cCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYVtjXS50ZXN0KGIpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoMCA8PSBiLmluZGV4T2YoYVtjXSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBrZShhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYiAhPSBJYyhhLCAwKSAmJiBiICE9IEljKGEsIC0xKSAmJiBiICE9IEljKGEsIC0yKSAmJiBiICE9IHBhKGEsIDApICYmIGIgIT0gcGEoYSwgLTEpICYmIGIgIT0gcGEoYSwgLTIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uICRlKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gYWYoYSksIGMgPSB7fTsKICAgICAgICAgICAgICAgIGMuX2dhID0gYS5nZXQoUSk7CiAgICAgICAgICAgICAgICBjLl9naWQgPSBhLmdldChJKSB8fCB2b2lkIDA7CiAgICAgICAgICAgICAgICBjLl9nYWMgPSBiID8gWwogICAgICAgICAgICAgICAgICAgIGIucWEsCiAgICAgICAgICAgICAgICAgICAgYi50aW1lc3RhbXAKICAgICAgICAgICAgICAgIF0uam9pbignLicpIDogdm9pZCAwOwogICAgICAgICAgICAgICAgYiA9IGEuZ2V0KEFlKTsKICAgICAgICAgICAgICAgIGEgPSBFZChhKTsKICAgICAgICAgICAgICAgIHJldHVybiBjLl9mcGxjID0gYiAmJiAnMCcgIT09IGIgPyBiIDogYSwgYzsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBhZihhKSB7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwID09IGUgfHwgJycgPT09IGUgPyAwIDogTnVtYmVyKGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdmFyIGMgPSBhLmdldChjZSk7CiAgICAgICAgICAgICAgICBpZiAoYyAmJiBhLmdldChqZSkpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGIoYS5nZXQoZmUpKTsKICAgICAgICAgICAgICAgICAgICBpZiAoMTAwMCAqIGQgKyBiKGEuZ2V0KGhlKSkgPD0gbmV3IERhdGUoKS5nZXRUaW1lKCkpCiAgICAgICAgICAgICAgICAgICAgICAgIEooNzYpOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVzdGFtcDogZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHFhOiBjCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgcCA9IC9eKEdUTXxPUFQpLVtBLVowLTldKyQvLCBJZSA9IC9eRy1bQS1aMC05XSskLywgcSA9IC87X2dhZXhwPVteO10qL2csIHIgPSAvOygoX191dG1hPSl8KFteOz1dKz1HQVg/XGQrXC4pKVteO10qL2csIEFhID0gL15odHRwcz86XC9cL1tcd1wtLl0rXC5nb29nbGUuY29tKDpcZCspP1wvb3B0aW1pemVcL29wdC1sYXVuY2hcLmh0bWxcPy4qJC8sIHQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGIoZCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICBlICYmIChjICs9ICcmJyArIGQgKyAnPScgKyBLKGUpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBHZShhLnR5cGUpICsgSyhhLmlkKTsKICAgICAgICAgICAgICAgICAgICAnZGF0YUxheWVyJyAhPSBhLkIgJiYgYignbCcsIGEuQik7CiAgICAgICAgICAgICAgICAgICAgYignY3gnLCBhLmNvbnRleHQpOwogICAgICAgICAgICAgICAgICAgIGIoJ3QnLCBhLnRhcmdldCk7CiAgICAgICAgICAgICAgICAgICAgYignY2lkJywgYS5jbGllbnRJZCk7CiAgICAgICAgICAgICAgICAgICAgYignY2lkdCcsIGEua2EpOwogICAgICAgICAgICAgICAgICAgIGIoJ2dhYycsIGEubGEpOwogICAgICAgICAgICAgICAgICAgIGIoJ2FpcCcsIGEuaWEpOwogICAgICAgICAgICAgICAgICAgIGEuc3luYyAmJiBiKCdtJywgJ3N5bmMnKTsKICAgICAgICAgICAgICAgICAgICBiKCdjeWNsZScsIGEuRyk7CiAgICAgICAgICAgICAgICAgICAgYS5xYSAmJiBiKCdnY2xpZCcsIGEucWEpOwogICAgICAgICAgICAgICAgICAgIEFhLnRlc3QoTS5yZWZlcnJlcikgJiYgYignY2InLCBTdHJpbmcoaGQoKSkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSwgSGUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IERhdGUoKS5nZXRUaW1lKCk7CiAgICAgICAgICAgICAgICAgICAgT1thLkJdID0gT1thLkJdIHx8IFtdOwogICAgICAgICAgICAgICAgICAgIGMgPSB7ICdndG0uc3RhcnQnOiBjIH07CiAgICAgICAgICAgICAgICAgICAgYS5zeW5jIHx8IChjLmV2ZW50ID0gJ2d0bS5qcycpOwogICAgICAgICAgICAgICAgICAgIE9bYS5CXS5wdXNoKGMpOwogICAgICAgICAgICAgICAgICAgIDIgPT09IGEudHlwZSAmJiBmdW5jdGlvbiAoZCwgZSwgZykgewogICAgICAgICAgICAgICAgICAgICAgICBPW2EuQl0ucHVzaChhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgICAgIH0oJ2NvbmZpZycsIGEuaWQsIGIpOwogICAgICAgICAgICAgICAgfSwgS2UgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIGMgPSBjIHx8IHt9OwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gMTsKICAgICAgICAgICAgICAgICAgICBJZS50ZXN0KGIpICYmIChlID0gMik7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogYiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBCOiBjLmRhdGFMYXllciB8fCAnZGF0YUxheWVyJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIEc6ICExCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGNhID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIGEuZ2V0KCcmZ3RtJykgPT0gYiAmJiAoZy5HID0gITApOwogICAgICAgICAgICAgICAgICAgIDEgPT09IGUgPyAoZy5pYSA9ICEhYS5nZXQoJ2Fub255bWl6ZUlwJyksIGcuc3luYyA9IGQsIGIgPSBTdHJpbmcoYS5nZXQoJ25hbWUnKSksICd0MCcgIT0gYiAmJiAoZy50YXJnZXQgPSBiKSwgRyhTdHJpbmcoYS5nZXQoJ3RyYWNraW5nSWQnKSkpIHx8IChnLmNsaWVudElkID0gU3RyaW5nKGEuZ2V0KFEpKSwgZy5rYSA9IE51bWJlcihhLmdldChuKSksIGMgPSBjLnBhbGluZHJvbWUgPyByIDogcSwgYyA9IChjID0gTS5jb29raWUucmVwbGFjZSgvXnwoOyArKS9nLCAnOycpLm1hdGNoKGMpKSA/IGMuc29ydCgpLmpvaW4oJycpLnN1YnN0cmluZygxKSA6IHZvaWQgMCwgZy5sYSA9IGMsIGcucWEgPSBFKFAoYSwga2IpLCAnZ2NsaWQnKSkpIDogMiA9PT0gZSAmJiAoZy5jb250ZXh0ID0gJ2MnLCBjYSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dfZ29vZ2xlX3NpZ25hbHM6IGEuZ2V0KFVkKSwKICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dfYWRfcGVyc29uYWxpemF0aW9uX3NpZ25hbHM6IGEuZ2V0KHhlKQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIEhlKGcsIGNhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdChnKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBIID0ge30sIEpkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBiIHx8IChiID0gKGIgPSBQKGEsIFYpKSAmJiAndDAnICE9IGIgPyBXZC50ZXN0KGIpID8gJ19nYXRfJyArIENjKFAoYSwgTmEpKSA6ICdfZ2F0XycgKyBDYyhiKSA6ICdfZ2F0Jyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5ZID0gYjsKICAgICAgICAgICAgICAgIH0sIFJkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGIuZ2V0KFdiKTsKICAgICAgICAgICAgICAgICAgICBiLnNldChXYiwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgUGQoYSwgZSwgZWQpOwogICAgICAgICAgICAgICAgICAgICAgICBQZChhLCBlLCBpYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gYyhlKTsKICAgICAgICAgICAgICAgICAgICAgICAgUWQoYSwgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gYi5nZXQoWGIpOwogICAgICAgICAgICAgICAgICAgIGIuc2V0KFhiLCBmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzZShlKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSig4MCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgY2EgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVTogcmUoZSwgMSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ29vZ2xlOiByZShlLCAyKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3VudDogMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlKCdodHRwczovL3N0YXRzLmcuZG91YmxlY2xpY2submV0L2ovY29sbGVjdCcsIGNhLlUsIGNhKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc2V0KGVkLCAnJywgITApOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgUGQgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgICExID09PSBiLmdldChVZCkgfHwgYi5nZXQoYykgfHwgKCcxJyA9PSBDYShhLlkpWzBdID8gYi5zZXQoYywgJycsICEwKSA6IGIuc2V0KGMsICcnICsgaGQoKSwgITApKTsKICAgICAgICAgICAgICAgIH0sIFFkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBzZShiKSAmJiB6YyhhLlksICcxJywgUChiLCBZYiksIFAoYiwgVyksIFAoYiwgTmEpLCA2MDAwMCwgUChiLCBCZSkpOwogICAgICAgICAgICAgICAgfSwgc2UgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWEuZ2V0KGVkKSAmJiAhMSAhPT0gYS5nZXQoVWQpOwogICAgICAgICAgICAgICAgfSwgTmUgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhSFtQKGEsIE5hKV0gJiYgdm9pZCAwID09PSBhLmdldCgnJmd0bScpICYmIHZvaWQgMCA9PT0gYS5nZXQoZmEpICYmIHZvaWQgMCA9PT0gYS5nZXQoZ2QpICYmIHZvaWQgMCA9PT0gYS5nZXQob2UpOwogICAgICAgICAgICAgICAgfSwgcmUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IGVlKCksIGQgPSBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJGEoZykuRiAmJiBjLnNldCgkYShnKS5GLCBhLmdldChnKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgZChoYik7CiAgICAgICAgICAgICAgICAgICAgZChpYik7CiAgICAgICAgICAgICAgICAgICAgZChOYSk7CiAgICAgICAgICAgICAgICAgICAgZChRKTsKICAgICAgICAgICAgICAgICAgICBkKGVkKTsKICAgICAgICAgICAgICAgICAgICAxID09IGIgJiYgKGQoQWQpLCBkKGlhKSwgZChJKSk7CiAgICAgICAgICAgICAgICAgICAgITEgPT09IGEuZ2V0KHhlKSAmJiBjLnNldCgnbnBhJywgJzEnKTsKICAgICAgICAgICAgICAgICAgICBjLnNldCgkYShsZCkuRiwgVGQoYSkpOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gJyc7CiAgICAgICAgICAgICAgICAgICAgYy5tYXAoZnVuY3Rpb24gKGcsIGNhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGUgKz0gSyhnKSArICc9JzsKICAgICAgICAgICAgICAgICAgICAgICAgZSArPSBLKCcnICsgY2EpICsgJyYnOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGUgKz0gJ3o9JyArIGhkKCk7CiAgICAgICAgICAgICAgICAgICAgMSA9PSBiID8gZSA9ICd0PWRjJmFpcD0xJl9yPTMmJyArIGUgOiAyID09IGIgJiYgKGUgPSAndD1zciZhaXA9MSZfcj00JnNsZl9yZD0xJicgKyBlKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0sIE1lID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoTmUoYSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBIW1AoYSwgTmEpXSA9ICEwLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIgJiYgIUhbYl0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IEtlKGEsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElkKGMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEhbYl0gPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIFdkID0gL15ndG1cZCskLzsKICAgICAgICAgICAgdmFyIGZkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGEgPSBhLm1vZGVsOwogICAgICAgICAgICAgICAgaWYgKCFhLmdldCgnZGNMb2FkZWQnKSkgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gbmV3ICRjKERkKGEpKTsKICAgICAgICAgICAgICAgICAgICBjLnNldCgyOSk7CiAgICAgICAgICAgICAgICAgICAgYS5zZXQoR2QsIGMuQyk7CiAgICAgICAgICAgICAgICAgICAgYiA9IGIgfHwge307CiAgICAgICAgICAgICAgICAgICAgdmFyIGQ7CiAgICAgICAgICAgICAgICAgICAgYltVXSAmJiAoZCA9IENjKGJbVV0pKTsKICAgICAgICAgICAgICAgICAgICBiID0gbmV3IEpkKGEsIGQpOwogICAgICAgICAgICAgICAgICAgIFJkKGIsIGEpOwogICAgICAgICAgICAgICAgICAgIGEuc2V0KCdkY0xvYWRlZCcsICEwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFNkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmICghYS5nZXQoJ2RjTG9hZGVkJykgJiYgJ2Nvb2tpZScgPT0gYS5nZXQoYWMpKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBuZXcgSmQoYSk7CiAgICAgICAgICAgICAgICAgICAgUGQoYiwgYSwgZWQpOwogICAgICAgICAgICAgICAgICAgIFBkKGIsIGEsIGlhKTsKICAgICAgICAgICAgICAgICAgICBRZChiLCBhKTsKICAgICAgICAgICAgICAgICAgICBiID0gc2UoYSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBOZShhKTsKICAgICAgICAgICAgICAgICAgICBiICYmIGEuc2V0KE1kLCAxLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgYyAmJiBhLnNldChPZCwgMSwgITApOwogICAgICAgICAgICAgICAgICAgIGlmIChiIHx8IGMpCiAgICAgICAgICAgICAgICAgICAgICAgIGEuc2V0KGFkLCAnZCcsICEwKSwgSig3OSksIGEuc2V0KHFlLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBVOiByZShhLCAxKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdvb2dsZTogcmUoYSwgMiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBWOiBNZShhKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvdW50OiAwCiAgICAgICAgICAgICAgICAgICAgICAgIH0sICEwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIExjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSBPLmdhR2xvYmFsID0gTy5nYUdsb2JhbCB8fCB7fTsKICAgICAgICAgICAgICAgIHJldHVybiBhLmhpZCA9IGEuaGlkIHx8IGhkKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB3YiA9IC9eKFVBfFlUfE1PfEdQKS0oXGQrKS0oXGQrKSQvLCBwYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gYihlLCBnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGQubW9kZWwuZGF0YS5zZXQoZSwgZyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoZSwgZykgewogICAgICAgICAgICAgICAgICAgICAgICBiKGUsIGcpOwogICAgICAgICAgICAgICAgICAgICAgICBkLmZpbHRlcnMuYWRkKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tb2RlbCA9IG5ldyBZYSgpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZmlsdGVycyA9IG5ldyBIYSgpOwogICAgICAgICAgICAgICAgICAgIGIoViwgYVtWXSk7CiAgICAgICAgICAgICAgICAgICAgYihOYSwgc2EoYVtOYV0pKTsKICAgICAgICAgICAgICAgICAgICBiKFUsIGFbVV0pOwogICAgICAgICAgICAgICAgICAgIGIoVywgYVtXXSB8fCB4YSgpKTsKICAgICAgICAgICAgICAgICAgICBiKFliLCBhW1liXSk7CiAgICAgICAgICAgICAgICAgICAgYihaYiwgYVtaYl0pOwogICAgICAgICAgICAgICAgICAgIGIoSGQsIGFbSGRdKTsKICAgICAgICAgICAgICAgICAgICBiKEJlLCBhW0JlXSk7CiAgICAgICAgICAgICAgICAgICAgYigkYiwgYVskYl0pOwogICAgICAgICAgICAgICAgICAgIGIoV2MsIGFbV2NdKTsKICAgICAgICAgICAgICAgICAgICBiKGJjLCBhW2JjXSk7CiAgICAgICAgICAgICAgICAgICAgYihjYywgYVtjY10pOwogICAgICAgICAgICAgICAgICAgIGIoS2EsIGFbS2FdKTsKICAgICAgICAgICAgICAgICAgICBiKGRjLCBhW2RjXSk7CiAgICAgICAgICAgICAgICAgICAgYihlYywgYVtlY10pOwogICAgICAgICAgICAgICAgICAgIGIoYWMsIGFbYWNdKTsKICAgICAgICAgICAgICAgICAgICBiKEFkLCBhW0FkXSk7CiAgICAgICAgICAgICAgICAgICAgYihuLCBhW25dKTsKICAgICAgICAgICAgICAgICAgICBiKEtkLCBhW0tkXSk7CiAgICAgICAgICAgICAgICAgICAgYihqZSwgYVtqZV0pOwogICAgICAgICAgICAgICAgICAgIGIoWmUsIGFbWmVdKTsKICAgICAgICAgICAgICAgICAgICBiKG9lLCBhW29lXSk7CiAgICAgICAgICAgICAgICAgICAgYihKZSwgYVtKZV0pOwogICAgICAgICAgICAgICAgICAgIGIoRiwgYVtGXSk7CiAgICAgICAgICAgICAgICAgICAgYihoYiwgMSk7CiAgICAgICAgICAgICAgICAgICAgYihpYiwgJ2o5NicpOwogICAgICAgICAgICAgICAgICAgIGMoUmUsIFBlKTsKICAgICAgICAgICAgICAgICAgICBjKFFiLCBNYSk7CiAgICAgICAgICAgICAgICAgICAgYyhvYSwgdWEpOwogICAgICAgICAgICAgICAgICAgIGMoZGQsIGNkKTsKICAgICAgICAgICAgICAgICAgICBjKFJiLCBPYSk7CiAgICAgICAgICAgICAgICAgICAgYyhtZCwgdmIpOwogICAgICAgICAgICAgICAgICAgIGMoU2IsIG5jKTsKICAgICAgICAgICAgICAgICAgICBjKFVjLCBZYyk7CiAgICAgICAgICAgICAgICAgICAgYyhUYiwgSmEpOwogICAgICAgICAgICAgICAgICAgIGMoVmIsIFRhKTsKICAgICAgICAgICAgICAgICAgICBjKFZjLCBIYyk7CiAgICAgICAgICAgICAgICAgICAgYyh6ZCwgeWQpOwogICAgICAgICAgICAgICAgICAgIGMoTGQsIFNkKTsKICAgICAgICAgICAgICAgICAgICBjKHplLCBGZSk7CiAgICAgICAgICAgICAgICAgICAgYyhXYiwgUGEpOwogICAgICAgICAgICAgICAgICAgIGMoWGIsIFNhKTsKICAgICAgICAgICAgICAgICAgICBjKENkLCBGZCh0aGlzKSk7CiAgICAgICAgICAgICAgICAgICAgcGQodGhpcy5tb2RlbCk7CiAgICAgICAgICAgICAgICAgICAgdGQodGhpcy5tb2RlbCwgYVtRXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tb2RlbC5zZXQoamIsIExjKCkpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgcGMucHJvdG90eXBlLmdldCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5tb2RlbC5nZXQoYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHBjLnByb3RvdHlwZS5zZXQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdGhpcy5tb2RlbC5zZXQoYSwgYik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHBjLnByb3RvdHlwZS5zZW5kID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmICghKDEgPiBhcmd1bWVudHMubGVuZ3RoKSkgewogICAgICAgICAgICAgICAgICAgIGlmICgnc3RyaW5nJyA9PT0gdHlwZW9mIGFyZ3VtZW50c1swXSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGFyZ3VtZW50c1swXTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBbXS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMSk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBhcmd1bWVudHNbMF0gJiYgYXJndW1lbnRzWzBdW1ZhXSwgYyA9IGFyZ3VtZW50czsKICAgICAgICAgICAgICAgICAgICBiICYmIChjID0gemEobWVbYl0gfHwgW10sIGMpLCBjW1ZhXSA9IGIsIHRoaXMubW9kZWwuc2V0KGMsIHZvaWQgMCwgITApLCB0aGlzLmZpbHRlcnMuRCh0aGlzLm1vZGVsKSwgdGhpcy5tb2RlbC5kYXRhLm0gPSB7fSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHBjLnByb3RvdHlwZS5tYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IHRoaXM7CiAgICAgICAgICAgICAgICB1KGEsIGMsIGIpIHx8ICh2KGEsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB1KGEsIGMsIGIpOwogICAgICAgICAgICAgICAgfSksIHkoU3RyaW5nKGMuZ2V0KFYpKSwgYSwgdm9pZCAwLCBiLCAhMCkpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgdGQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gUChhLCBVKTsKICAgICAgICAgICAgICAgICAgICBhLmRhdGEuc2V0KGxhLCAnX2dhJyA9PSBjID8gJ19naWQnIDogYyArICdfZ2lkJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdjb29raWUnID09IFAoYSwgYWMpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGhjID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBDYShQKGEsIFUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IFhkKGEsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBQKGEsIFcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBQKGEsICRiKSB8fCB4YSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IFhjKCdfX3V0bWEnLCBkLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPSBjID8gKEooMTApLCBjID0gYy5PWzFdICsgJy4nICsgYy5PWzJdKSA6IGMgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYyAmJiAoaGMgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkID0gYyAmJiAhYS5nZXQoSGQpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgPSBjLnNwbGl0KCcuJyksIDIgIT0gZC5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZCA9IE51bWJlcihkWzFdKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gUihhLCBaYik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGQgKyBlIDwgbmV3IERhdGUoKS5nZXRUaW1lKCkgLyAxMDAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICBkICYmIChjID0gdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgYyAmJiAoYS5kYXRhLnNldCh4ZCwgYyksIGEuZGF0YS5zZXQoUSwgYyksIChjID0gdWMoYSkpICYmIGEuZGF0YS5zZXQoSSwgYykpOwogICAgICAgICAgICAgICAgICAgICAgICBhLmdldChqZSkgJiYgKGMgPSBhLmdldChjZSksIGQgPSBhLmdldChpZSksICFjIHx8IGQgJiYgJ2F3LmRzJyAhPSBkKSAmJiAoYyA9IHt9LCBkID0gKE0gPyBkZihjKSA6IHt9KVtQKGEsIE5hKV0sIGxlKGMpLCBkICYmIDAgIT0gZC5sZW5ndGggJiYgKGMgPSBkWzBdLCBhLmRhdGEuc2V0KGZlLCBjLnRpbWVzdGFtcCAvIDEwMDApLCBhLmRhdGEuc2V0KGNlLCBjLnFhKSkpOwogICAgICAgICAgICAgICAgICAgICAgICBhLmdldChqZSkgJiYgKGMgPSBhLmdldChTZSksIGQgPSB7fSwgZSA9IChNID8gZGYoZCwgJ19nYWNfZ2InLCAhMCkgOiB7fSlbUChhLCBOYSldLCBlZihkKSwgZSAmJiAwICE9IGUubGVuZ3RoICYmIChkID0gZVswXSwgZSA9IGQucWEsIGMgJiYgYyAhPT0gZSB8fCAoZC5sYWJlbHMgJiYgZC5sYWJlbHMubGVuZ3RoICYmIChlICs9ICcuJyArIGQubGFiZWxzLmpvaW4oJy4nKSksIGEuZGF0YS5zZXQoVGUsIGQudGltZXN0YW1wIC8gMTAwMCksIGEuZGF0YS5zZXQoU2UsIGUpKSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoYS5nZXQoSGQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBiZSgnX2dhJywgISFhLmdldChjYykpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IGJlKCdfZ2wnLCAhIWEuZ2V0KGNjKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBEZS5nZXQoYS5nZXQoY2MpKTsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGQuX2dhOwogICAgICAgICAgICAgICAgICAgICAgICBnICYmIDAgPCBnLmluZGV4T2YoJ19nYSonKSAmJiAhZSAmJiBKKDMwKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIgfHwgIWEuZ2V0KEplKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoZyA9IGEuZ2V0KEYpLCB2b2lkIDAgPT09IGcgfHwgZygnYW5hbHl0aWNzX3N0b3JhZ2UnKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcgPSAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBKKDg0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEuZGF0YS5zZXQoTGUsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGcgPSBkLl91cCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZyA9IEpjLmV4ZWMoTS5yZWZlcnJlcikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGdbMV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjYSA9IE0ubG9jYXRpb24uaG9zdG5hbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBjYSA9PT0gZyB8fCAwIDw9IGNhLmluZGV4T2YoJy4nICsgZykgfHwgMCA8PSBnLmluZGV4T2YoJy4nICsgY2EpID8gITAgOiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9ICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGcgPyAhMCA6ICExOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGNhID0gZC5nY2xpZDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBkLl9nYWM7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjIHx8IGUgfHwgY2EgfHwgbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjICYmIGUgJiYgSigzNiksIGEuZ2V0KGJjKSB8fCB5ZShhLmdldChLZCkpIHx8IGcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSAmJiAoSigzOCksIGEuZGF0YS5zZXQoUSwgZSksIGQuX2dpZCAmJiAoSig1MSksIGEuZGF0YS5zZXQoSSwgZC5fZ2lkKSkpLCBjYSA/IChKKDgyKSwgYS5kYXRhLnNldChjZSwgY2EpLCBkLmdjbHNyYyAmJiBhLmRhdGEuc2V0KGllLCBkLmdjbHNyYykpIDogbCAmJiAoZSA9IGwuc3BsaXQoJy4nKSkgJiYgMiA9PT0gZS5sZW5ndGggJiYgKEooMzcpLCBhLmRhdGEuc2V0KGNlLCBlWzBdKSwgYS5kYXRhLnNldChmZSwgZVsxXSkpLCAoZCA9IGQuX2ZwbGMpICYmIFAoYSwgb2UpICYmIChKKDgzKSwgYS5kYXRhLnNldChBZSwgZCkpLCBjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgPSBjLmluZGV4T2YoJy4nKSwgLTEgPT0gZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKKDIyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBjLnN1YnN0cmluZygwLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gYy5zdWJzdHJpbmcoZCArIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBnLmluZGV4T2YoJy4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gZy5zdWJzdHJpbmcoMCwgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGcuc3Vic3RyaW5nKGQgKyAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJzEnID09IGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQgPSBnLCBrZShkLCBjKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSigyMyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgnMicgPT0gZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gZy5pbmRleE9mKCctJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCA8IGQgPyAoZSA9IGcuc3Vic3RyaW5nKDAsIGQpLCBkID0gZy5zdWJzdHJpbmcoZCArIDEpKSA6IGQgPSBnLnN1YnN0cmluZygxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGtlKGUgKyBkLCBjKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSig1Myk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgJiYgKEooMiksIGEuZGF0YS5zZXQoSSwgZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEooMjIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKKDExKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLmRhdGEuc2V0KFEsIGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID0gYmUoJ19nYWMnLCAhIWEuZ2V0KGNjKSkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBjLnNwbGl0KCcuJyksICcxJyAhPSBjWzBdIHx8IDQgIT0gYy5sZW5ndGggPyBKKDcyKSA6IGtlKGNbM10sIGNbMV0pID8gSig3MSkgOiAoYS5kYXRhLnNldChjZSwgY1szXSksIGEuZGF0YS5zZXQoZmUsIGNbMl0pLCBKKDcwKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKKDIxKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYiAmJiAoSig5KSwgYS5kYXRhLnNldChRLCBLKGIpKSk7CiAgICAgICAgICAgICAgICAgICAgYS5nZXQoUSkgfHwgKGIgPSAoYiA9IE8uZ2FHbG9iYWwpICYmIGIuZnJvbV9jb29raWUgJiYgJ2Nvb2tpZScgIT09IFAoYSwgYWMpID8gdm9pZCAwIDogKGIgPSBiICYmIGIudmlkKSAmJiAtMSAhPT0gYi5zZWFyY2goamQpID8gYiA6IHZvaWQgMCwgYiA/IChKKDE3KSwgYS5kYXRhLnNldChRLCBiKSkgOiAoSig4KSwgYS5kYXRhLnNldChRLCByYSgpKSkpOwogICAgICAgICAgICAgICAgICAgIGEuZ2V0KEkpIHx8IChKKDMpLCBhLmRhdGEuc2V0KEksIHJhKCkpKTsKICAgICAgICAgICAgICAgICAgICBtYyhhKTsKICAgICAgICAgICAgICAgICAgICBiID0gTy5nYUdsb2JhbCA9IE8uZ2FHbG9iYWwgfHwge307CiAgICAgICAgICAgICAgICAgICAgYyA9IFAoYSwgUSk7CiAgICAgICAgICAgICAgICAgICAgYSA9IGMgPT09IFAoYSwgeGQpOwogICAgICAgICAgICAgICAgICAgIGlmICh2b2lkIDAgPT0gYi52aWQgfHwgYSAmJiAhYi5mcm9tX2Nvb2tpZSkKICAgICAgICAgICAgICAgICAgICAgICAgYi52aWQgPSBjLCBiLmZyb21fY29va2llID0gYTsKICAgICAgICAgICAgICAgIH0sIHBkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IE8ubmF2aWdhdG9yLCBjID0gTy5zY3JlZW4sIGQgPSBNLmxvY2F0aW9uLCBlID0gYS5zZXQ7CiAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9ICEhYS5nZXQoZWMpLCBjYSA9ICEhYS5nZXQoS2QpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IE0ucmVmZXJyZXI7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgvXihodHRwcz98YW5kcm9pZC1hcHApOlwvXC8vaS50ZXN0KGwpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9ICcvLycgKyBNLmxvY2F0aW9uLmhvc3RuYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFkZShsLCBnKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjYSAmJiAoY2EgPSBnLnJlcGxhY2UoL1wuL2csICctJykgKyAnLmNkbi5hbXBwcm9qZWN0Lm9yZycsIGRlKGwsIGNhKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBsID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBlLmNhbGwoYSwgbGIsIGwpOwogICAgICAgICAgICAgICAgICAgIGQgJiYgKGUgPSBkLnBhdGhuYW1lIHx8ICcnLCAnLycgIT0gZS5jaGFyQXQoMCkgJiYgKEooMzEpLCBlID0gJy8nICsgZSksIGEuc2V0KGtiLCBkLnByb3RvY29sICsgJy8vJyArIGQuaG9zdG5hbWUgKyBlICsgZC5zZWFyY2gpKTsKICAgICAgICAgICAgICAgICAgICBjICYmIGEuc2V0KHFiLCBjLndpZHRoICsgJ3gnICsgYy5oZWlnaHQpOwogICAgICAgICAgICAgICAgICAgIGMgJiYgYS5zZXQocGIsIGMuY29sb3JEZXB0aCArICctYml0Jyk7CiAgICAgICAgICAgICAgICAgICAgYyA9IE0uZG9jdW1lbnRFbGVtZW50OwogICAgICAgICAgICAgICAgICAgIGwgPSAoZSA9IE0uYm9keSkgJiYgZS5jbGllbnRXaWR0aCAmJiBlLmNsaWVudEhlaWdodDsKICAgICAgICAgICAgICAgICAgICBjYSA9IFtdOwogICAgICAgICAgICAgICAgICAgIGMgJiYgYy5jbGllbnRXaWR0aCAmJiBjLmNsaWVudEhlaWdodCAmJiAoJ0NTUzFDb21wYXQnID09PSBNLmNvbXBhdE1vZGUgfHwgIWwpID8gY2EgPSBbCiAgICAgICAgICAgICAgICAgICAgICAgIGMuY2xpZW50V2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgIGMuY2xpZW50SGVpZ2h0CiAgICAgICAgICAgICAgICAgICAgXSA6IGwgJiYgKGNhID0gWwogICAgICAgICAgICAgICAgICAgICAgICBlLmNsaWVudFdpZHRoLAogICAgICAgICAgICAgICAgICAgICAgICBlLmNsaWVudEhlaWdodAogICAgICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICAgICAgICAgIGMgPSAwID49IGNhWzBdIHx8IDAgPj0gY2FbMV0gPyAnJyA6IGNhLmpvaW4oJ3gnKTsKICAgICAgICAgICAgICAgICAgICBhLnNldChyYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgYyA9IGEuc2V0OwogICAgICAgICAgICAgICAgICAgIHZhciBrOwogICAgICAgICAgICAgICAgICAgIGlmICgoZSA9IChlID0gTy5uYXZpZ2F0b3IpID8gZS5wbHVnaW5zIDogbnVsbCkgJiYgZS5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobCA9IDA7IGwgPCBlLmxlbmd0aCAmJiAhazsgbCsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2EgPSBlW2xdLCAtMSA8IGNhLm5hbWUuaW5kZXhPZignU2hvY2t3YXZlIEZsYXNoJykgJiYgKGsgPSBjYS5kZXNjcmlwdGlvbik7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFrKQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHcgPSBuZXcgQWN0aXZlWE9iamVjdCgnU2hvY2t3YXZlRmxhc2guU2hvY2t3YXZlRmxhc2guNycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgayA9IHcuR2V0VmFyaWFibGUoJyR2ZXJzaW9uJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKENlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoIWspCiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ID0gbmV3IEFjdGl2ZVhPYmplY3QoJ1Nob2Nrd2F2ZUZsYXNoLlNob2Nrd2F2ZUZsYXNoLjYnKSwgayA9ICdXSU4gNiwwLDIxLDAnLCB3LkFsbG93U2NyaXB0QWNjZXNzID0gJ2Fsd2F5cycsIGsgPSB3LkdldFZhcmlhYmxlKCckdmVyc2lvbicpOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChDZSkgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKCFrKQogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdyA9IG5ldyBBY3RpdmVYT2JqZWN0KCdTaG9ja3dhdmVGbGFzaC5TaG9ja3dhdmVGbGFzaCcpLCBrID0gdy5HZXRWYXJpYWJsZSgnJHZlcnNpb24nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoQ2UpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGsgJiYgKHcgPSBrLm1hdGNoKC9bXGRdKy9nKSkgJiYgMyA8PSB3Lmxlbmd0aCAmJiAoayA9IHdbMF0gKyAnLicgKyB3WzFdICsgJyByJyArIHdbMl0pOwogICAgICAgICAgICAgICAgICAgIGMuY2FsbChhLCB0YiwgayB8fCB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgIGEuc2V0KG9iLCBNLmNoYXJhY3RlclNldCB8fCBNLmNoYXJzZXQpOwogICAgICAgICAgICAgICAgICAgIGEuc2V0KHNiLCBiICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiBiLmphdmFFbmFibGVkICYmIGIuamF2YUVuYWJsZWQoKSB8fCAhMSk7CiAgICAgICAgICAgICAgICAgICAgYS5zZXQobmIsIChiICYmIChiLmxhbmd1YWdlIHx8IGIuYnJvd3Nlckxhbmd1YWdlKSB8fCAnJykudG9Mb3dlckNhc2UoKSk7CiAgICAgICAgICAgICAgICAgICAgYS5kYXRhLnNldChjZSwgYmUoJ2djbGlkJywgITApKTsKICAgICAgICAgICAgICAgICAgICBhLmRhdGEuc2V0KGllLCBiZSgnZ2Nsc3JjJywgITApKTsKICAgICAgICAgICAgICAgICAgICBhLmRhdGEuc2V0KGZlLCBNYXRoLnJvdW5kKG5ldyBEYXRlKCkuZ2V0VGltZSgpIC8gMTAwMCkpOwogICAgICAgICAgICAgICAgICAgIGEuZ2V0KGNlKSB8fCAoYS5kYXRhLnNldChTZSwgYmUoJ3dicmFpZCcsICEwKSksIGEuZGF0YS5zZXQoVGUsIE1hdGgucm91bmQobmV3IERhdGUoKS5nZXRUaW1lKCkgLyAxMDAwKSkpOwogICAgICAgICAgICAgICAgICAgIGlmIChkICYmIGEuZ2V0KGNjKSAmJiAoYiA9IE0ubG9jYXRpb24uaGFzaCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGIuc3BsaXQoL1s/JiNdKy8pOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoayA9IDA7IGsgPCBiLmxlbmd0aDsgKytrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgKEQoYltrXSwgJ3V0bV9pZCcpIHx8IEQoYltrXSwgJ3V0bV9jYW1wYWlnbicpIHx8IEQoYltrXSwgJ3V0bV9zb3VyY2UnKSB8fCBEKGJba10sICd1dG1fbWVkaXVtJykgfHwgRChiW2tdLCAndXRtX3Rlcm0nKSB8fCBEKGJba10sICd1dG1fY29udGVudCcpIHx8IEQoYltrXSwgJ2djbGlkJykgfHwgRChiW2tdLCAnZGNsaWQnKSB8fCBEKGJba10sICdnY2xzcmMnKSB8fCBEKGJba10sICd3YnJhaWQnKSkgJiYgZC5wdXNoKGJba10pOwogICAgICAgICAgICAgICAgICAgICAgICAwIDwgZC5sZW5ndGggJiYgKGIgPSAnIycgKyBkLmpvaW4oJyYnKSwgYS5zZXQoa2IsIGEuZ2V0KGtiKSArIGIpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBtZSA9IHsKICAgICAgICAgICAgICAgICAgICBwYWdldmlldzogW21iXSwKICAgICAgICAgICAgICAgICAgICBldmVudDogWwogICAgICAgICAgICAgICAgICAgICAgICB1YiwKICAgICAgICAgICAgICAgICAgICAgICAgeGIsCiAgICAgICAgICAgICAgICAgICAgICAgIHliLAogICAgICAgICAgICAgICAgICAgICAgICB6YgogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgc29jaWFsOiBbCiAgICAgICAgICAgICAgICAgICAgICAgIEJiLAogICAgICAgICAgICAgICAgICAgICAgICBDYiwKICAgICAgICAgICAgICAgICAgICAgICAgRGIKICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIHRpbWluZzogWwogICAgICAgICAgICAgICAgICAgICAgICBNYiwKICAgICAgICAgICAgICAgICAgICAgICAgTmIsCiAgICAgICAgICAgICAgICAgICAgICAgIFBiLAogICAgICAgICAgICAgICAgICAgICAgICBPYgogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciByYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCdwcmVyZW5kZXInID09IE0udmlzaWJpbGl0eVN0YXRlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgYSgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIH0sIHogPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGlmICghcmMoYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgSigxNik7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gITEsIGMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFiICYmIHJjKGEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBjLCBlID0gTTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5yZW1vdmVFdmVudExpc3RlbmVyID8gZS5yZW1vdmVFdmVudExpc3RlbmVyKCd2aXNpYmlsaXR5Y2hhbmdlJywgZCwgITEpIDogZS5kZXRhY2hFdmVudCAmJiBlLmRldGFjaEV2ZW50KCdvbnZpc2liaWxpdHljaGFuZ2UnLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBMKE0sICd2aXNpYmlsaXR5Y2hhbmdlJywgYyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHRlID0gL14oPzooXHcrKVwuKT8oPzooXHcrKTopPyhcdyspJC8sIHNjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZWEoYVswXSkpCiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMudSA9IGFbMF07CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gdGUuZXhlYyhhWzBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCAhPSBiICYmIDQgPT0gYi5sZW5ndGggJiYgKHRoaXMuZGEgPSBiWzFdIHx8ICd0MCcsIHRoaXMuSyA9IGJbMl0gfHwgJycsIHRoaXMubWV0aG9kTmFtZSA9IGJbM10sIHRoaXMuYWEgPSBbXS5zbGljZS5jYWxsKGEsIDEpLCB0aGlzLksgfHwgKHRoaXMuQSA9ICdjcmVhdGUnID09IHRoaXMubWV0aG9kTmFtZSwgdGhpcy5pID0gJ3JlcXVpcmUnID09IHRoaXMubWV0aG9kTmFtZSwgdGhpcy5nID0gJ3Byb3ZpZGUnID09IHRoaXMubWV0aG9kTmFtZSwgdGhpcy5iYSA9ICdyZW1vdmUnID09IHRoaXMubWV0aG9kTmFtZSksIHRoaXMuaSAmJiAoMyA8PSB0aGlzLmFhLmxlbmd0aCA/ICh0aGlzLlggPSB0aGlzLmFhWzFdLCB0aGlzLlcgPSB0aGlzLmFhWzJdKSA6IHRoaXMuYWFbMV0gJiYgKHFhKHRoaXMuYWFbMV0pID8gdGhpcy5YID0gdGhpcy5hYVsxXSA6IHRoaXMuVyA9IHRoaXMuYWFbMV0pKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBhWzFdOwogICAgICAgICAgICAgICAgICAgICAgICBhID0gYVsyXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0aGlzLm1ldGhvZE5hbWUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAnYWJvcnQnOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5pICYmICghcWEoYikgfHwgJycgPT0gYikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAnYWJvcnQnOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5nICYmICghcWEoYikgfHwgJycgPT0gYiB8fCAhZWEoYSkpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgJ2Fib3J0JzsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHVkKHRoaXMuZGEpIHx8IHVkKHRoaXMuSykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAnYWJvcnQnOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5nICYmICd0MCcgIT0gdGhpcy5kYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93ICdhYm9ydCc7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gdWQoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDAgPD0gYS5pbmRleE9mKCcuJykgfHwgMCA8PSBhLmluZGV4T2YoJzonKTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBZZCwgWmQsICRkLCBBOwogICAgICAgICAgICBZZCA9IG5ldyBlZSgpOwogICAgICAgICAgICAkZCA9IG5ldyBlZSgpOwogICAgICAgICAgICBBID0gbmV3IGVlKCk7CiAgICAgICAgICAgIFpkID0gewogICAgICAgICAgICAgICAgZWM6IDQ1LAogICAgICAgICAgICAgICAgZWNvbW1lcmNlOiA0NiwKICAgICAgICAgICAgICAgIGxpbmtpZDogNDcKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHUgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIGIgPT0gTiB8fCBiLmdldChWKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IFlkLmdldChhKTsKICAgICAgICAgICAgICAgICAgICBpZiAoIWVhKGQpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgYi5wbHVnaW5zXyA9IGIucGx1Z2luc18gfHwgbmV3IGVlKCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGIucGx1Z2luc18uZ2V0KGEpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgYi5wbHVnaW5zXy5zZXQoYSwgbmV3IGQoYiwgYyB8fCB7fSkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgIH0sIHkgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIGlmICghZWEoWWQuZ2V0KGIpKSAmJiAhJGQuZ2V0KGIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFpkLmhhc093blByb3BlcnR5KGIpICYmIEooWmRbYl0pOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHAudGVzdChiKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgSig1Mik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gTi5qKGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBLZShhLm1vZGVsLCBiLCBkLCBlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWi5EKFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3Byb3ZpZGUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbCA9IE9bZCAmJiBkLmRhdGFMYXllciB8fCAnZGF0YUxheWVyJ107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbCAmJiBsLmhpZGUgJiYgZWEobC5oaWRlLmVuZCkgJiYgbC5oaWRlW2JdICYmIChsLmhpZGUuZW5kKCksIGwuaGlkZS5lbmQgPSB2b2lkIDApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAhYyAmJiBaZC5oYXNPd25Qcm9wZXJ0eShiKSA/IChKKDM5KSwgYyA9IGIgKyAnLmpzJykgOiBKKDQzKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgJiYgKGNhID0gZFtvZV0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcWEoY2EpIHx8IChjYSA9IHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gYWUoY2YoYywgY2EpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICFjYSB8fCBuZShhLnByb3RvY29sKSAmJiBCKGEpIHx8IChhID0gYWUoY2YoYykpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5lKGEucHJvdG9jb2wpICYmIEIoYSkgJiYgKElkKGEudXJsLCB2b2lkIDAsIGUsIHZvaWQgMCwgZyksICRkLnNldChiLCAhMCkpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBBLmdldChhKSB8fCBbXTsKICAgICAgICAgICAgICAgICAgICBjLnB1c2goYik7CiAgICAgICAgICAgICAgICAgICAgQS5zZXQoYSwgYyk7CiAgICAgICAgICAgICAgICB9LCBDID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBZZC5zZXQoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgYiA9IEEuZ2V0KGEpIHx8IFtdOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwOyBjIDwgYi5sZW5ndGg7IGMrKykKICAgICAgICAgICAgICAgICAgICAgICAgYltjXSgpOwogICAgICAgICAgICAgICAgICAgIEEuc2V0KGEsIFtdKTsKICAgICAgICAgICAgICAgIH0sIEIgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gYWUoTS5sb2NhdGlvbi5ocmVmKTsKICAgICAgICAgICAgICAgICAgICBpZiAoRChhLnVybCwgR2UoMSkpIHx8IEQoYS51cmwsIEdlKDIpKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIGlmIChhLnF1ZXJ5IHx8IDAgPD0gYS51cmwuaW5kZXhPZignPycpIHx8IDAgPD0gYS5wYXRoLmluZGV4T2YoJzovLycpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEuaG9zdCA9PSBiLmhvc3QgJiYgYS5wb3J0ID09IGIucG9ydCB8fCBqZiAmJiAoYiA9IE0uY3JlYXRlRWxlbWVudCgnYScpLCBiLmhyZWYgPSBqZiwgYiA9IGtmKGIpLCBhLmhvc3QgPT09IGJbMF0gJiYgYS5wb3J0ID09PSBiWzFdKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgIGIgPSAnaHR0cDonID09IGEucHJvdG9jb2wgPyA4MCA6IDQ0MzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3d3dy5nb29nbGUtYW5hbHl0aWNzLmNvbScgPT0gYS5ob3N0ICYmIChhLnBvcnQgfHwgYikgPT0gYiAmJiBEKGEucGF0aCwgJy9wbHVnaW5zLycpID8gITAgOiAhMTsKICAgICAgICAgICAgICAgIH0sIG5lID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IE0ubG9jYXRpb24ucHJvdG9jb2w7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdodHRwczonID09IGEgfHwgYSA9PSBiID8gITAgOiAnaHR0cDonICE9IGEgPyAhMSA6ICdodHRwOicgPT0gYjsKICAgICAgICAgICAgICAgIH0sIGtmID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEuaG9zdG5hbWUgfHwgJycsIGMgPSAwIDw9IGIuaW5kZXhPZignXScpOwogICAgICAgICAgICAgICAgICAgIGIgPSBiLnNwbGl0KGMgPyAnXScgOiAnOicpWzBdLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgICAgICAgYyAmJiAoYiArPSAnXScpOwogICAgICAgICAgICAgICAgICAgIGMgPSAoYS5wcm90b2NvbCB8fCAnJykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICAgICAgICBjID0gMSAqIGEucG9ydCB8fCAoJ2h0dHA6JyA9PSBjID8gODAgOiAnaHR0cHM6JyA9PSBjID8gNDQzIDogJycpOwogICAgICAgICAgICAgICAgICAgIGEgPSBhLnBhdGhuYW1lIHx8ICcnOwogICAgICAgICAgICAgICAgICAgIEQoYSwgJy8nKSB8fCAoYSA9ICcvJyArIGEpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBbCiAgICAgICAgICAgICAgICAgICAgICAgIGIsCiAgICAgICAgICAgICAgICAgICAgICAgICcnICsgYywKICAgICAgICAgICAgICAgICAgICAgICAgYQogICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICB9LCBhZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBNLmNyZWF0ZUVsZW1lbnQoJ2EnKTsKICAgICAgICAgICAgICAgICAgICBiLmhyZWYgPSBNLmxvY2F0aW9uLmhyZWY7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAoYi5wcm90b2NvbCB8fCAnJykudG9Mb3dlckNhc2UoKSwgZCA9IGtmKGIpLCBlID0gYi5zZWFyY2ggfHwgJycsIGcgPSBjICsgJy8vJyArIGRbMF0gKyAoZFsxXSA/ICc6JyArIGRbMV0gOiAnJyk7CiAgICAgICAgICAgICAgICAgICAgRChhLCAnLy8nKSA/IGEgPSBjICsgYSA6IEQoYSwgJy8nKSA/IGEgPSBnICsgYSA6ICFhIHx8IEQoYSwgJz8nKSA/IGEgPSBnICsgZFsyXSArIChhIHx8IGUpIDogMCA+IGEuc3BsaXQoJy8nKVswXS5pbmRleE9mKCc6JykgJiYgKGEgPSBnICsgZFsyXS5zdWJzdHJpbmcoMCwgZFsyXS5sYXN0SW5kZXhPZignLycpKSArICcvJyArIGEpOwogICAgICAgICAgICAgICAgICAgIGIuaHJlZiA9IGE7CiAgICAgICAgICAgICAgICAgICAgYyA9IGtmKGIpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHByb3RvY29sOiAoYi5wcm90b2NvbCB8fCAnJykudG9Mb3dlckNhc2UoKSwKICAgICAgICAgICAgICAgICAgICAgICAgaG9zdDogY1swXSwKICAgICAgICAgICAgICAgICAgICAgICAgcG9ydDogY1sxXSwKICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogY1syXSwKICAgICAgICAgICAgICAgICAgICAgICAgcXVlcnk6IGIuc2VhcmNoIHx8ICcnLAogICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGEgfHwgJycKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgY2YgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhICYmIDAgPD0gYS5pbmRleE9mKCcvJykgPyBhIDogKGIgfHwgYmQoITEpKSArICcvcGx1Z2lucy91YS8nICsgYTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBaID0gewogICAgICAgICAgICAgICAgZ2E6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBaLmZhID0gW107CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFouZ2EoKTsKICAgICAgICAgICAgWi5EID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gWi5KLmFwcGx5KFosIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICBiID0gWi5mYS5jb25jYXQoYik7CiAgICAgICAgICAgICAgICBmb3IgKFouZmEgPSBbXTsgMCA8IGIubGVuZ3RoICYmICFaLnYoYlswXSkgJiYgIShiLnNoaWZ0KCksIDAgPCBaLmZhLmxlbmd0aCk7KTsKICAgICAgICAgICAgICAgIFouZmEgPSBaLmZhLmNvbmNhdChiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWi5yYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBOLnEgJiYgKDMwMCA9PT0gTi5xLmxlbmd0aCAmJiAoTi5xLnNoaWZ0KCksIE4ucWQrKyksIE4ucS5wdXNoKGEpKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgWi5KID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSBbXSwgYyA9IDA7IGMgPCBhcmd1bWVudHMubGVuZ3RoOyBjKyspCiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBuZXcgc2MoYXJndW1lbnRzW2NdKTsKICAgICAgICAgICAgICAgICAgICAgICAgZC5nID8gQyhkLmFhWzBdLCBkLmFhWzFdKSA6IChkLmkgJiYgKGQuaGEgPSB5KGQuZGEsIGQuYWFbMF0sIGQuWCwgZC5XKSksIGIucHVzaChkKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIFoucmEoYXJndW1lbnRzW2NdKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFoudiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGlmIChhLnUpCiAgICAgICAgICAgICAgICAgICAgICAgIGEudS5jYWxsKE8sIE4uaigndDAnKSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gYS5kYSA9PSBnYiA/IE4gOiBOLmooYS5kYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLkEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgndDAnID09IGEuZGEgJiYgKGIgPSBOLmNyZWF0ZS5hcHBseShOLCBhLmFhKSwgbnVsbCA9PT0gYikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGEuYmEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBOLnJlbW92ZShhLmRhKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLmkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYS5oYSAmJiAoYS5oYSA9IHkoYS5kYSwgYS5hYVswXSwgYS5YLCBhLlcpKSwgIXUoYS5hYVswXSwgYiwgYS5XKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChhLkspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEubWV0aG9kTmFtZSwgZCA9IGEuYWEsIGUgPSBiLnBsdWdpbnNfLmdldChhLkspOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbY10uYXBwbHkoZSwgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiW2EubWV0aG9kTmFtZV0uYXBwbHkoYiwgYS5hYSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBjYXRjaCAoZykgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgTiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBKKDEpOwogICAgICAgICAgICAgICAgWi5ELmFwcGx5KFosIFthcmd1bWVudHNdKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTi5oID0ge307CiAgICAgICAgICAgIE4uUCA9IFtdOwogICAgICAgICAgICBOLkwgPSAwOwogICAgICAgICAgICBOLnlhID0gMDsKICAgICAgICAgICAgTi5hbnN3ZXIgPSA0MjsKICAgICAgICAgICAgdmFyIHdlID0gWwogICAgICAgICAgICAgICAgTmEsCiAgICAgICAgICAgICAgICBXLAogICAgICAgICAgICAgICAgVgogICAgICAgICAgICBdOwogICAgICAgICAgICBOLmNyZWF0ZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHphKHdlLCBbXS5zbGljZS5jYWxsKGFyZ3VtZW50cykpOwogICAgICAgICAgICAgICAgYltWXSB8fCAoYltWXSA9ICd0MCcpOwogICAgICAgICAgICAgICAgdmFyIGMgPSAnJyArIGJbVl07CiAgICAgICAgICAgICAgICBpZiAoTi5oW2NdKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBOLmhbY107CiAgICAgICAgICAgICAgICBpZiAoZGEoYikpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICBiID0gbmV3IHBjKGIpOwogICAgICAgICAgICAgICAgTi5oW2NdID0gYjsKICAgICAgICAgICAgICAgIE4uUC5wdXNoKGIpOwogICAgICAgICAgICAgICAgYyA9IHFjKCkudHJhY2tlcl9jcmVhdGVkOwogICAgICAgICAgICAgICAgaWYgKGVhKGMpKQogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMoYik7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZCkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBOLnJlbW92ZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gMDsgYiA8IE4uUC5sZW5ndGg7IGIrKykKICAgICAgICAgICAgICAgICAgICBpZiAoTi5QW2JdLmdldChWKSA9PSBhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIE4uUC5zcGxpY2UoYiwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIE4uaFthXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgTi5qID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBOLmhbYV07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIE4uZ2V0QWxsID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIE4uUC5zbGljZSgwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgTi5OID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgJ2dhJyAhPSBnYiAmJiBKKDQ5KTsKICAgICAgICAgICAgICAgIHZhciBhID0gT1tnYl07CiAgICAgICAgICAgICAgICBpZiAoIWEgfHwgNDIgIT0gYS5hbnN3ZXIpIHsKICAgICAgICAgICAgICAgICAgICBOLkwgPSBhICYmIGEubDsKICAgICAgICAgICAgICAgICAgICBOLnlhID0gMSAqIG5ldyBEYXRlKCk7CiAgICAgICAgICAgICAgICAgICAgTi5sb2FkZWQgPSAhMDsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGEgJiYgYS5xLCBjID0ga2EoYik7CiAgICAgICAgICAgICAgICAgICAgYSA9IFtdOwogICAgICAgICAgICAgICAgICAgIGMgPyBhID0gYi5zbGljZSgwKSA6IEooNTApOwogICAgICAgICAgICAgICAgICAgIE4ucSA9IGMgPyBiIDogW107CiAgICAgICAgICAgICAgICAgICAgTi5xLnNwbGljZSgwKTsKICAgICAgICAgICAgICAgICAgICBOLnFkID0gMDsKICAgICAgICAgICAgICAgICAgICBiID0gT1tnYl0gPSBOOwogICAgICAgICAgICAgICAgICAgIFgoJ2NyZWF0ZScsIGIsIGIuY3JlYXRlKTsKICAgICAgICAgICAgICAgICAgICBYKCdyZW1vdmUnLCBiLCBiLnJlbW92ZSk7CiAgICAgICAgICAgICAgICAgICAgWCgnZ2V0QnlOYW1lJywgYiwgYi5qLCA1KTsKICAgICAgICAgICAgICAgICAgICBYKCdnZXRBbGwnLCBiLCBiLmdldEFsbCwgNik7CiAgICAgICAgICAgICAgICAgICAgYiA9IHBjLnByb3RvdHlwZTsKICAgICAgICAgICAgICAgICAgICBYKCdnZXQnLCBiLCBiLmdldCwgNyk7CiAgICAgICAgICAgICAgICAgICAgWCgnc2V0JywgYiwgYi5zZXQsIDQpOwogICAgICAgICAgICAgICAgICAgIFgoJ3NlbmQnLCBiLCBiLnNlbmQpOwogICAgICAgICAgICAgICAgICAgIFgoJ3JlcXVpcmVTeW5jJywgYiwgYi5tYSk7CiAgICAgICAgICAgICAgICAgICAgYiA9IFlhLnByb3RvdHlwZTsKICAgICAgICAgICAgICAgICAgICBYKCdnZXQnLCBiLCBiLmdldCk7CiAgICAgICAgICAgICAgICAgICAgWCgnc2V0JywgYiwgYi5zZXQpOwogICAgICAgICAgICAgICAgICAgIGlmICgnaHR0cHM6JyAhPSBNLmxvY2F0aW9uLnByb3RvY29sICYmICFCYSkgewogICAgICAgICAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gTS5nZXRFbGVtZW50c0J5VGFnTmFtZSgnc2NyaXB0Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGMgPSAwOyBjIDwgYi5sZW5ndGggJiYgMTAwID4gYzsgYysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBiW2NdLnNyYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiAwID09IGQuaW5kZXhPZihiZCghMCkgKyAnL2FuYWx5dGljcycpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgYiAmJiAoQmEgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIChPLmdhcGx1Z2lucyA9IE8uZ2FwbHVnaW5zIHx8IHt9KS5MaW5rZXIgPSBEYzsKICAgICAgICAgICAgICAgICAgICBiID0gRGMucHJvdG90eXBlOwogICAgICAgICAgICAgICAgICAgIEMoJ2xpbmtlcicsIERjKTsKICAgICAgICAgICAgICAgICAgICBYKCdkZWNvcmF0ZScsIGIsIGIuY2EsIDIwKTsKICAgICAgICAgICAgICAgICAgICBYKCdhdXRvTGluaycsIGIsIGIuUywgMjUpOwogICAgICAgICAgICAgICAgICAgIFgoJ3Bhc3N0aHJvdWdoJywgYiwgYi4kLCAyNSk7CiAgICAgICAgICAgICAgICAgICAgQygnZGlzcGxheWZlYXR1cmVzJywgZmQpOwogICAgICAgICAgICAgICAgICAgIEMoJ2FkZmVhdHVyZXMnLCBmZCk7CiAgICAgICAgICAgICAgICAgICAgWi5ELmFwcGx5KE4sIGEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZ2YgPSBOLk4sIGhmID0gT1tnYl07CiAgICAgICAgICAgIGhmICYmIGhmLnIgPyBnZigpIDogeihnZik7CiAgICAgICAgICAgIHooZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgWi5EKFsKICAgICAgICAgICAgICAgICAgICAncHJvdmlkZScsCiAgICAgICAgICAgICAgICAgICAgJ3JlbmRlcicsCiAgICAgICAgICAgICAgICAgICAgdWEKICAgICAgICAgICAgICAgIF0pOwogICAgICAgICAgICB9KTsKICAgICAgICB9KHdpbmRvdykpOwogICAgfSgpKQp9"},{"name":"sugarcoat-f542409ccbdc9bf05ab43353222723e26ac37628","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfNDQ4Yjk1YTQ3ZGQ0OWYwYSA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja180NDhiOTVhNDdkZDQ5ZjBhKTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgdmFyIGcgPSBlOwogICAgICAgICAgICBmdW5jdGlvbiBlKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjLCBkLCBmID0gaCh3aW5kb3cudG9wKTsKICAgICAgICAgICAgICAgIGZvciAoYyA9IGYubGVuZ3RoOyBjLS07KQogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICgoZCA9IGZbY10pICYmIChkID0gZFthXSkgJiYgKGQgPSBkLnNoYXJlZCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChsKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvd1thXS5zaGFyZWQgPSBiOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGgoYSwgYikgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEuZnJhbWVzOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZikgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGMpIHsKICAgICAgICAgICAgICAgICAgICAoYiA9IGIgfHwgW10pLnB1c2goYSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IDA7IGMgJiYgZCA8IGMubGVuZ3RoOyBkKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGgoYS5mcmFtZXNbZF0sIGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICBmdW5jdGlvbiBrKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGEuYWRkRXZlbnRMaXN0ZW5lciA/IGEuYWRkRXZlbnRMaXN0ZW5lcihiLCBjLCAhMSkgOiBhLmF0dGFjaEV2ZW50ICYmIGEuYXR0YWNoRXZlbnQoJ29uJyArIGIsIGMpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIG0oYSwgYiwgYykgewogICAgICAgICAgICAgICAgYS5yZW1vdmVFdmVudExpc3RlbmVyID8gYS5yZW1vdmVFdmVudExpc3RlbmVyKGIsIGMsICExKSA6IGEuZGV0YWNoRXZlbnQgJiYgYS5kZXRhY2hFdmVudCgnb24nICsgYiwgYyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgcCA9IG47CiAgICAgICAgICAgIGZ1bmN0aW9uIG4oYSkgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSgpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgdmFyIHIgPSBxLCB0ID0gd2luZG93LnRvcDsKICAgICAgICAgICAgZnVuY3Rpb24gcShhKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiLCBjLCBkID0gd2luZG93OyBkOykgewogICAgICAgICAgICAgICAgICAgIGlmIChwKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkLmZyYW1lc1thXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoZCA9PT0gdCkKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgZCA9IGQucGFyZW50OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYiAmJiAoYyA9ICFwKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFiLmRvY3VtZW50LmdldEVsZW1lbnRCeUlkOwogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBmcmFtZVJlZjogYiwKICAgICAgICAgICAgICAgICAgICBpc0Nyb3NzRG9tYWluOiBjCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgdmFyIHYgPSB1OwogICAgICAgICAgICB3aW5kb3cuQWRmb3JtID0gd2luZG93LkFkZm9ybSB8fCB7fTsKICAgICAgICAgICAgdmFyIHcgPSB3aW5kb3cuX191c3BhcGksIHggPSByKCdfX3VzcGFwaUxvY2F0b3InKSwgeSA9IHguZnJhbWVSZWYsIHogPSB4LmlzQ3Jvc3NEb21haW47CiAgICAgICAgICAgIHogJiYgeSAmJiB5LnBvc3RNZXNzYWdlID8gKGsod2luZG93LCAnbWVzc2FnZScsIEEpLCB5LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIF9fdXNwYXBpQ2FsbDogewogICAgICAgICAgICAgICAgICAgIGNvbW1hbmQ6ICdnZXRVU1BEYXRhJywKICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiAxLAogICAgICAgICAgICAgICAgICAgIGNhbGxJZDogMQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9LCAnKicpKSA6IHkgJiYgIXogJiYgeS5fX3VzcGFwaSAmJiAodyA9IHkuX191c3BhcGkpOwogICAgICAgICAgICB3ICYmIHAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHcoJ2dldFVTUERhdGEnLCAxLCBCKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZ1bmN0aW9uIHUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gZygnQWRmb3JtJywge30pLnVzX3ByaXZhY3k7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gQShhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IGEuZGF0YTsKICAgICAgICAgICAgICAgICdzdHJpbmcnID09PSB0eXBlb2YgYiAmJiAoYiA9IHAoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuSlNPTi5wYXJzZShiKTsKICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIGIgJiYgKGIgPSBiLl9fdXNwYXBpUmV0dXJuIHx8IHt9KTsKICAgICAgICAgICAgICAgIGIgJiYgYi5zdWNjZXNzICYmIChtKHdpbmRvdywgJ21lc3NhZ2UnLCBBKSwgQihiLnJldHVyblZhbHVlKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gQihhKSB7CiAgICAgICAgICAgICAgICBhID0gdm9pZCAwID09PSBhID8ge30gOiBhOwogICAgICAgICAgICAgICAgZygnQWRmb3JtJywge30pLnVzX3ByaXZhY3kgPSBhLnVzcFN0cmluZzsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBDID0gd2luZG93LnNldFRpbWVvdXQsIEQsIEUsIEYgPSAxLCBHID0gW10sIEggPSBbXSwgSSA9IHdpbmRvdy5BZGZvcm0gPSB3aW5kb3cuQWRmb3JtIHx8IHt9OwogICAgICAgICAgICBJLmdldENvbnNlbnQgPSBKOwogICAgICAgICAgICBJLndhaXRGb3JDb25zZW50ID0gTTsKICAgICAgICAgICAgSS5oYXNDb25zZW50ID0gYWE7CiAgICAgICAgICAgIEkuZ2V0VVNQU3RyaW5nID0gdjsKICAgICAgICAgICAgTigpOwogICAgICAgICAgICBnKCdBZGZvcm0nLCB7fSk7CiAgICAgICAgICAgIE8oKTsKICAgICAgICAgICAgZnVuY3Rpb24gYWEoYSkgewogICAgICAgICAgICAgICAgTShmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIGEobnVsbCA9PT0gYiA/ICEwIDogYi5hZGZvcm1fY29uc2VudCk7CiAgICAgICAgICAgICAgICB9LCAxMDAwMCwgITApOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIE0oYSwgYiwgYykgewogICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IDEwMDAwIDogYjsKICAgICAgICAgICAgICAgIGMgPSB2b2lkIDAgPT09IGMgPyAhMSA6IGM7CiAgICAgICAgICAgICAgICBOKCk7CiAgICAgICAgICAgICAgICBEIHx8IHdpbmRvdy5fX3RjZmFwaSA/IChjID8gSC5wdXNoKGEpIDogRy5wdXNoKGEpLCBPKCksIEMoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgUChHLCBhKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFAoSCwgYSkKICAgICAgICAgICAgICAgICAgICAgICAgXSwgYyA9IGcoJ0FkZm9ybScsIHt9KSwgbCA9IGMuZ2RwciwgSyA9IGMuZ2Rwcl9jb25zZW50LCBMID0gYy5hZGZvcm1fY29uc2VudDsKICAgICAgICAgICAgICAgICAgICBjID0gYy51c19wcml2YWN5OwogICAgICAgICAgICAgICAgICAgIGlmICgtMSA8IGJbMF0pCiAgICAgICAgICAgICAgICAgICAgICAgIEcuc3BsaWNlKGJbMF0sIDEpWzBdKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdkcHI6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByX2NvbnNlbnQ6IEssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGZvcm1fY29uc2VudDogTCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzX3ByaXZhY3k6IGMKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKC0xIDwgYlsxXSkKICAgICAgICAgICAgICAgICAgICAgICAgSC5zcGxpY2UoYlsxXSwgMSlbMF0oewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2RwcjogbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdkcHJfY29uc2VudDogSywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZm9ybV9jb25zZW50OiBMLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNfcHJpdmFjeTogYwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIGIpKSA6IGEobnVsbCwgJ0NNUCBub3QgZm91bmQuJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gTigpIHsKICAgICAgICAgICAgICAgIGlmICghRCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gcignX190Y2ZhcGlMb2NhdG9yJyk7CiAgICAgICAgICAgICAgICAgICAgYS5mcmFtZVJlZiAmJiAoRCA9IGEuZnJhbWVSZWYsIEUgPSBhLmlzQ3Jvc3NEb21haW4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICBjbXBGcmFtZTogRCwKICAgICAgICAgICAgICAgICAgICBpc0Nyb3NzRG9tYWluOiBFCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIEooKSB7CiAgICAgICAgICAgICAgICBPKCk7CiAgICAgICAgICAgICAgICB2YXIgYSA9IGcoJ0FkZm9ybScsIHt9KTsKICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgZ2RwcjogYS5nZHByLAogICAgICAgICAgICAgICAgICAgIGdkcHJfY29uc2VudDogYS5nZHByX2NvbnNlbnQsCiAgICAgICAgICAgICAgICAgICAgdXNfcHJpdmFjeTogYS51c19wcml2YWN5CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIE8oKSB7CiAgICAgICAgICAgICAgICBpZiAoRSAmJiBEICYmIEQucG9zdE1lc3NhZ2UpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHdpbmRvdy5fX3RjZmFwaTsKICAgICAgICAgICAgICAgICAgICBtKHdpbmRvdywgJ21lc3NhZ2UnLCBRKTsKICAgICAgICAgICAgICAgICAgICBrKHdpbmRvdywgJ21lc3NhZ2UnLCBRKTsKICAgICAgICAgICAgICAgICAgICBELnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgICAgICAgX190Y2ZhcGlDYWxsOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21tYW5kOiAnYWRkRXZlbnRMaXN0ZW5lcicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsSWQ6IEYrKwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgJyonKTsKICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgIGEgPSBEICYmICFFID8gRC5fX3RjZmFwaSA6IHdpbmRvdy5fX3RjZmFwaTsKICAgICAgICAgICAgICAgIGEgJiYgcChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEoJ2FkZEV2ZW50TGlzdGVuZXInLCBudWxsLCBSKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFEoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBhLmRhdGE7CiAgICAgICAgICAgICAgICAnc3RyaW5nJyA9PT0gdHlwZW9mIGIgJiYgKGIgPSBwKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LkpTT04ucGFyc2UoYik7CiAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICBiICYmIChiID0gKGIuX190Y2ZhcGlSZXR1cm4gfHwge30pLnJldHVyblZhbHVlKTsKICAgICAgICAgICAgICAgIGIgJiYgbnVsbCAhPSBiLmdkcHJBcHBsaWVzICYmIChhID0gYiwgUih7CiAgICAgICAgICAgICAgICAgICAgZ2RwckFwcGxpZXM6IGEuZ2RwckFwcGxpZXMsCiAgICAgICAgICAgICAgICAgICAgdGNTdHJpbmc6IGEudGNTdHJpbmcsCiAgICAgICAgICAgICAgICAgICAgcHVycG9zZTogYS5wdXJwb3NlLAogICAgICAgICAgICAgICAgICAgIHZlbmRvcjogYS52ZW5kb3IsCiAgICAgICAgICAgICAgICAgICAgcmVzdHJpY3Rpb25zOiBhLnJlc3RyaWN0aW9ucywKICAgICAgICAgICAgICAgICAgICBldmVudFN0YXR1czogYS5ldmVudFN0YXR1cwogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFIoYSkgewogICAgICAgICAgICAgICAgYSA9IHZvaWQgMCA9PT0gYSA/IHt9IDogYTsKICAgICAgICAgICAgICAgIGlmICgnY21wdWlzaG93bicgIT09IGEuZXZlbnRTdGF0dXMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IFMoYS5nZHByQXBwbGllcyksIGMgPSBnKCdBZGZvcm0nLCB7fSk7CiAgICAgICAgICAgICAgICAgICAgYy5nZHByID0gYjsKICAgICAgICAgICAgICAgICAgICBjLmdkcHJfY29uc2VudCA9IGEudGNTdHJpbmc7CiAgICAgICAgICAgICAgICAgICAgaWYgKGIgPSAhKCFhLnB1cnBvc2UgfHwgIWEudmVuZG9yKSB8fCAwID09PSBiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGQuZ2RwckFwcGxpZXM7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gVChkLCAncHVycG9zZS5jb25zZW50cy4xJywgITEpLCBsID0gVChkLCAndmVuZG9yLmNvbnNlbnRzLjUwJywgITEpOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gVChkLCAncmVzdHJpY3Rpb25zLjEuNTAnLCAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IDAgPT09IFMoYSkgPyAhMCA6IGYgJiYgbCAmJiAwICE9PSBkOwogICAgICAgICAgICAgICAgICAgICAgICBjLmFkZm9ybV9jb25zZW50ID0gYTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYSA9IGMuZ2RwcjsKICAgICAgICAgICAgICAgICAgICBmID0gYy5nZHByX2NvbnNlbnQ7CiAgICAgICAgICAgICAgICAgICAgYyA9IGMuYWRmb3JtX2NvbnNlbnQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKHZvaWQgMCAhPT0gYyAmJiBiKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgSC5sZW5ndGg7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgSC5zaGlmdCgpKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByOiBhLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdkcHJfY29uc2VudDogZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGZvcm1fY29uc2VudDogYwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgZm9yICg7IEcubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgRy5zaGlmdCgpKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdkcHI6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByX2NvbnNlbnQ6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGZvcm1fY29uc2VudDogYwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBTKGEpIHsKICAgICAgICAgICAgICAgIGlmICgnMScgPT0gYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgICAgICAgIGlmICgnMCcgPT0gYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBQKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gYS5sZW5ndGg7CiAgICAgICAgICAgICAgICBpZiAoYS5pbmRleE9mKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLmluZGV4T2YoYik7CiAgICAgICAgICAgICAgICBmb3IgKDsgYy0tICYmIGFbY10gIT09IGI7KTsKICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFQoYSwgYiwgYykgewogICAgICAgICAgICAgICAgYiA9IGIuc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSAwOyBkIDwgYi5sZW5ndGg7IGQrKykKICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IGFbYltkXV0sIHZvaWQgMCA9PT0gYSkgewogICAgICAgICAgICAgICAgICAgICAgICBhID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICBmb3IgKHZhciBiYSA9IEFycmF5LnByb3RvdHlwZS5zbGljZSwgVSA9IHt9LCBWID0gewogICAgICAgICAgICAgICAgICAgICAgICBpbml0OiBjYSwKICAgICAgICAgICAgICAgICAgICAgICAgY29va2llU2VnbWVudHM6IGRhCiAgICAgICAgICAgICAgICAgICAgfSwgVyA9IHdpbmRvdy5BZGZvcm1BVCAmJiB3aW5kb3cuQWRmb3JtQVQucSB8fCBbXTsgMCBpbiBXOykKICAgICAgICAgICAgICAgIFgoVy5zaGlmdCgpKTsKICAgICAgICAgICAgVy5wdXNoID0gWDsKICAgICAgICAgICAgd2luZG93LkFkZm9ybUFUID0gWTsKICAgICAgICAgICAgZnVuY3Rpb24gZGEoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBVLmJhc2VVcmwgKyAnL2Nvb2tpZXNlZ21lbnRzP3Rva2VuPScgKyBVLnRva2VuOwogICAgICAgICAgICAgICAgTShmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIGMgJiYgKGIgKz0gJyZnZHByPScgKyBaKGMuZ2RwcikgKyAnJmdkcHJfY29uc2VudD0nICsgWihjLmdkcHJfY29uc2VudCkpOwogICAgICAgICAgICAgICAgICAgIChjID0gdigpKSAmJiAoYiArPSAnJnVzX3ByaXZhY3k9JyArIGMpOwogICAgICAgICAgICAgICAgICAgIGVhKGIsIGEpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gZWEoYSwgYikgewogICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF9iMTc4MjNhNzBiMDdkZjRhID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JyksICRfX19vbGRfY2NlNWI1Y2U2Y2M5NGUzYSA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9iMTc4MjNhNzBiMDdkZjRhKQogICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja180NDhiOTVhNDdkZDQ5ZjBhLlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfY2NlNWI1Y2U2Y2M5NGUzYSkKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfNDQ4Yjk1YTQ3ZGQ0OWYwYS5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IHdpbmRvdy5YTUxIdHRwUmVxdWVzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICBjLm9wZW4oJ0dFVCcsIGEsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgYy5zZXRSZXF1ZXN0SGVhZGVyKCdBY2NlcHQnLCAnYXBwbGljYXRpb24vanNvbicpOwogICAgICAgICAgICAgICAgICAgICAgICBjLndpdGhDcmVkZW50aWFscyA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICBjLm9ucmVhZHlzdGF0ZWNoYW5nZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0ICRfX19vbGRfMWZiNzk4YjI4NTQyODA0OSA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8xZmI3OThiMjg1NDI4MDQ5KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja180NDhiOTVhNDdkZDQ5ZjBhLlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5yZWFkeVN0YXRlID09PSB3aW5kb3cuWE1MSHR0cFJlcXVlc3QuRE9ORSAmJiBiKGMuc3RhdHVzLCBjLnJlc3BvbnNlIHx8IGMucmVzcG9uc2VUZXh0LCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkXzFmYjc5OGIyODU0MjgwNDkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfMWZiNzk4YjI4NTQyODA0OSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBjLm9uZXJyb3IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYihudWxsLCAnRXJyb3InLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgYy5vbnRpbWVvdXQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYihudWxsLCAnVGltZW91dCcsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBjLnNlbmQoKTsKICAgICAgICAgICAgICAgICAgICB9LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2IxNzgyM2E3MGIwN2RmNGEpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfYjE3ODIzYTcwYjA3ZGY0YSkpOwogICAgICAgICAgICAgICAgICAgIGlmICgkX19fb2xkX2NjZTViNWNlNmNjOTRlM2EpCiAgICAgICAgICAgICAgICAgICAgICAgICh7fS5jb25zdHJ1Y3Rvci5kZWZpbmVQcm9wZXJ0eSh3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcsICRfX19vbGRfY2NlNWI1Y2U2Y2M5NGUzYSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGNhKGEsIGIpIHsKICAgICAgICAgICAgICAgIFUudG9rZW4gPSBhOwogICAgICAgICAgICAgICAgVS5iYXNlVXJsID0gYiB8fCAnaHR0cHM6Ly9kbXAuYWRmb3JtLm5ldC9hdWRpZW5jZXRhZyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gWShhKSB7CiAgICAgICAgICAgICAgICBWW2FdICYmIFZbYV0uYXBwbHkobnVsbCwgYmEuY2FsbChhcmd1bWVudHMsIDEpKTsKICAgICAgICAgICAgICAgIHJldHVybiBZOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFooYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMCA9PT0gYSA/ICcnIDogJycgKyBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFgoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIFkuYXBwbHkobnVsbCwgYSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgIH0oKSk7CiAgICB9KCkpCn0="},{"name":"sugarcoat-f7ada209562e58fd31703fb8f6187652f7e75ed2","aliases":[],"kind":{"mime":"application/javascript"},"content":"ewogICAgY29uc3QgJF9fX21vY2tfMDA0NjUyODQwMDRkNGFhOCA9IHt9OwogICAgKGV4cG9ydHMgPT4gewogICAgICAgICd1c2Ugc3RyaWN0JzsKICAgICAgICBjb25zdCB4aHJVbnNlbnQgPSAwOwogICAgICAgIGNvbnN0IHhock9wZW5lZCA9IDE7CiAgICAgICAgY29uc3QgeGhySGVhZGVyc1JlY2VpdmVkID0gMjsKICAgICAgICBjb25zdCB4aHJMb2FkaW5nID0gMzsKICAgICAgICBjb25zdCB4aHJEb25lID0gNDsKICAgICAgICBjb25zdCB4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbCA9IFN5bWJvbCgnZGVmZXJyZWRIYW5kbGUnKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTdGFydFN5bWJvbCA9IFN5bWJvbCgnb25sb2Fkc3RhcnQnKTsKICAgICAgICBjb25zdCB4aHJPblByb2dyZXNzU3ltYm9sID0gU3ltYm9sKCdvbnByb2dyZXNzJyk7CiAgICAgICAgY29uc3QgeGhyT25BYm9ydFN5bWJvbCA9IFN5bWJvbCgnb25hYm9ydCcpOwogICAgICAgIGNvbnN0IHhock9uRXJyb3JTeW1ib2wgPSBTeW1ib2woJ29uZXJyb3InKTsKICAgICAgICBjb25zdCB4aHJPbkxvYWRTeW1ib2wgPSBTeW1ib2woJ29ubG9hZCcpOwogICAgICAgIGNvbnN0IHhock9uVGltZW91dFN5bWJvbCA9IFN5bWJvbCgnb250aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyT25Mb2FkRW5kU3ltYm9sID0gU3ltYm9sKCdvbmxvYWRlbmQnKTsKICAgICAgICBjb25zdCB4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2wgPSBTeW1ib2woJ29ucmVhZHlzdGF0ZWNoYW5nZScpOwogICAgICAgIGNvbnN0IHhoclJlYWR5U3RhdGVTeW1ib2wgPSBTeW1ib2woJ3JlYWR5U3RhdGUnKTsKICAgICAgICBjb25zdCB4aHJUaW1lb3V0U3ltYm9sID0gU3ltYm9sKCd0aW1lb3V0Jyk7CiAgICAgICAgY29uc3QgeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sID0gU3ltYm9sKCd3aXRoQ3JlZGVudGlhbHMnKTsKICAgICAgICBjb25zdCB4aHJVcGxvYWRTeW1ib2wgPSBTeW1ib2woJ3VwbG9hZCcpOwogICAgICAgIGNvbnN0IHhoclJlc3BvbnNlVHlwZVN5bWJvbCA9IFN5bWJvbCgncmVzcG9uc2VUeXBlJyk7CiAgICAgICAgY29uc3QgZGVmaW5lRXZlbnQgPSAob2JqLCBzeW1ib2wpID0+IHsKICAgICAgICAgICAgY29uc3QgdHlwZSA9IHN5bWJvbC5kZXNjcmlwdGlvbi5zdWJzdHJpbmcoMik7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShvYmosIHN5bWJvbCwgewogICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgb2JqLmFkZEV2ZW50TGlzdGVuZXIodHlwZSwgZnVuY3Rpb24gKGV2ZW50KSB7CiAgICAgICAgICAgICAgICBjb25zdCBoYW5kbGVyID0gdGhpc1tzeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKGhhbmRsZXIpIHsKICAgICAgICAgICAgICAgICAgICBoYW5kbGVyLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgICAgIGNvbnN0IGNoYW5nZVJlYWR5U3RhdGUgPSAoeGhyLCByZWFkeVN0YXRlKSA9PiB7CiAgICAgICAgICAgIHhoclt4aHJSZWFkeVN0YXRlU3ltYm9sXSA9IHJlYWR5U3RhdGU7CiAgICAgICAgICAgIHhoci5kaXNwYXRjaEV2ZW50KG5ldyBFdmVudCgncmVhZHlzdGF0ZWNoYW5nZScpKTsKICAgICAgICB9OwogICAgICAgIGxldCBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgY2xhc3MgWE1MSHR0cFJlcXVlc3RFdmVudFRhcmdldCBleHRlbmRzIEV2ZW50VGFyZ2V0IHsKICAgICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFhNTEh0dHBSZXF1ZXN0KSAmJiAhKHRoaXMgaW5zdGFuY2VvZiBYTUxIdHRwUmVxdWVzdFVwbG9hZCkpIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdJbGxlZ2FsIGNvbnN0cnVjdG9yJyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTdGFydFN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPblByb2dyZXNzU3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uQWJvcnRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25FcnJvclN5bWJvbCk7CiAgICAgICAgICAgICAgICBkZWZpbmVFdmVudCh0aGlzLCB4aHJPbkxvYWRTeW1ib2wpOwogICAgICAgICAgICAgICAgZGVmaW5lRXZlbnQodGhpcywgeGhyT25UaW1lb3V0U3ltYm9sKTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uTG9hZEVuZFN5bWJvbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ubG9hZHN0YXJ0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkU3RhcnRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbmxvYWRzdGFydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkxvYWRTdGFydFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25wcm9ncmVzcygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCBvbnByb2dyZXNzKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uUHJvZ3Jlc3NTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9uYWJvcnQoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJPbkFib3J0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25hYm9ydCh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPbkFib3J0U3ltYm9sXSA9IHZhbHVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBvbmVycm9yKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25FcnJvclN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9uZXJyb3IodmFsdWUpIHsKICAgICAgICAgICAgICAgIHRoaXNbeGhyT25FcnJvclN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb250aW1lb3V0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25UaW1lb3V0U3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb250aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uVGltZW91dFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgb25sb2FkZW5kKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXNbeGhyT25Mb2FkRW5kU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXQgb25sb2FkZW5kKHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hock9uTG9hZEVuZFN5bWJvbF0gPSB2YWx1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBleHBvcnRzLlhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdFVwbG9hZCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIGlmIChpc1NlYWxlZCkgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0lsbGVnYWwgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZXhwb3J0cy5YTUxIdHRwUmVxdWVzdFVwbG9hZCA9IHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogWE1MSHR0cFJlcXVlc3RVcGxvYWQsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfTsKICAgICAgICBjbGFzcyBYTUxIdHRwUmVxdWVzdCBleHRlbmRzIFhNTEh0dHBSZXF1ZXN0RXZlbnRUYXJnZXQgewogICAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgY29uc3QgeGhyVXBsb2FkID0gbmV3IFhNTEh0dHBSZXF1ZXN0VXBsb2FkKCk7CiAgICAgICAgICAgICAgICBpc1NlYWxlZCA9IHRydWU7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyRGVmZXJyZWRIYW5kbGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGRlZmluZUV2ZW50KHRoaXMsIHhock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbCk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyUmVhZHlTdGF0ZVN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHhoclVuc2VudCwKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgeGhyVGltZW91dFN5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IDAsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsIHhocldpdGhDcmVkZW50aWFsc1N5bWJvbCwgewogICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJVcGxvYWRTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiB4aHJVcGxvYWQsCiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCB4aHJSZXNwb25zZVR5cGVTeW1ib2wsIHsKICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHZhbHVlOiAnJywKICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hock9uUmVhZHlTdGF0ZUNoYW5nZVN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IG9ucmVhZHlzdGF0ZWNoYW5nZSh2YWx1ZSkgewogICAgICAgICAgICAgICAgdGhpc1t4aHJPblJlYWR5U3RhdGVDaGFuZ2VTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHJlYWR5U3RhdGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBvcGVuKG1ldGhvZCwgdXJsKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0pIHsKICAgICAgICAgICAgICAgIGNhc2UgeGhyVW5zZW50OgogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyT3BlbmVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldFJlcXVlc3RIZWFkZXIobmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZXRUcnVzdFRva2VuKHRydXN0VG9rZW4pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgdGltZW91dCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclRpbWVvdXRTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCB0aW1lb3V0KHZhbHVlKSB7CiAgICAgICAgICAgICAgICB0aGlzW3hoclRpbWVvdXRTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHdpdGhDcmVkZW50aWFscygpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hocldpdGhDcmVkZW50aWFsc1N5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2V0IHdpdGhDcmVkZW50aWFscyh2YWx1ZSkgewogICAgICAgICAgICAgICAgc3dpdGNoICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdKSB7CiAgICAgICAgICAgICAgICBjYXNlIHhoclVuc2VudDoKICAgICAgICAgICAgICAgIGNhc2UgeGhyT3BlbmVkOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIHNldCB0aGUgXCd3aXRoQ3JlZGVudGlhbHNcJyBwcm9wZXJ0eSBvbiBcJ1hNTEh0dHBSZXF1ZXN0XCc6IFRoZSB2YWx1ZSBtYXkgb25seSBiZSBzZXQgaWYgdGhlIG9iamVjdFwncyBzdGF0ZSBpcyBVTlNFTlQgb3IgT1BFTkVELicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXNbeGhyV2l0aENyZWRlbnRpYWxzU3ltYm9sXSA9ICEhdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHVwbG9hZCgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzW3hoclVwbG9hZFN5bWJvbF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZCgpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzW3hoclJlYWR5U3RhdGVTeW1ib2xdID09PSB4aHJPcGVuZWQgJiYgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPT09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyRG9uZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnZXJyb3InKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgICAgICB9LCAwKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IERPTUV4Y2VwdGlvbignRmFpbGVkIHRvIGV4ZWN1dGUgXCdzZW5kXCcgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgb2JqZWN0XCdzIHN0YXRlIG11c3QgYmUgT1BFTkVELicpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGFib3J0KCkgewogICAgICAgICAgICAgICAgaWYgKHRoaXNbeGhyUmVhZHlTdGF0ZVN5bWJvbF0gPT09IHhock9wZW5lZCAmJiB0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSAhPT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aGlzW3hockRlZmVycmVkSGFuZGxlU3ltYm9sXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJEZWZlcnJlZEhhbmRsZVN5bWJvbF0gPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGNoYW5nZVJlYWR5U3RhdGUodGhpcywgeGhyVW5zZW50KTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRpc3BhdGNoRXZlbnQobmV3IFByb2dyZXNzRXZlbnQoJ2Fib3J0JykpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZGlzcGF0Y2hFdmVudChuZXcgUHJvZ3Jlc3NFdmVudCgnbG9hZGVuZCcpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VVUkwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZ2V0IHN0YXR1cygpIHsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCBzdGF0dXNUZXh0KCkgewogICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldFJlc3BvbnNlSGVhZGVyKG5hbWUpIHsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG92ZXJyaWRlTWltZVR5cGUobWltZSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIGdldCByZXNwb25zZVR5cGUoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNldCByZXNwb25zZVR5cGUodmFsdWUpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodGhpc1t4aHJSZWFkeVN0YXRlU3ltYm9sXSkgewogICAgICAgICAgICAgICAgY2FzZSB4aHJEb25lOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byBzZXQgdGhlIFwncmVzcG9uc2VUeXBlXCcgcHJvcGVydHkgb24gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgcmVzcG9uc2UgdHlwZSBjYW5ub3QgYmUgc2V0IGlmIHRoZSBvYmplY3RcJ3Mgc3RhdGUgaXMgTE9BRElORyBvciBET05FLicpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN3aXRjaCAodmFsdWUpIHsKICAgICAgICAgICAgICAgIGNhc2UgJyc6CiAgICAgICAgICAgICAgICBjYXNlICdhcnJheWJ1ZmZlcic6CiAgICAgICAgICAgICAgICBjYXNlICdibG9iJzoKICAgICAgICAgICAgICAgIGNhc2UgJ2RvY3VtZW50JzoKICAgICAgICAgICAgICAgIGNhc2UgJ2pzb24nOgogICAgICAgICAgICAgICAgY2FzZSAndGV4dCc6IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdID0gdmFsdWU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2UoKSB7CiAgICAgICAgICAgICAgICBjb25zdCByZXNwb25zZVR5cGUgPSB0aGlzW3hoclJlc3BvbnNlVHlwZVN5bWJvbF07CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzcG9uc2VUeXBlID09PSAnJyB8fCByZXNwb25zZVR5cGUgPT09ICd0ZXh0JyA/ICcnIDogbnVsbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VUZXh0KCkgewogICAgICAgICAgICAgICAgY29uc3QgcmVzcG9uc2VUeXBlID0gdGhpc1t4aHJSZXNwb25zZVR5cGVTeW1ib2xdOwogICAgICAgICAgICAgICAgaWYgKHJlc3BvbnNlVHlwZSA9PT0gJycgfHwgcmVzcG9uc2VUeXBlID09PSAndGV4dCcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJyc7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBET01FeGNlcHRpb24oJ0ZhaWxlZCB0byByZWFkIHRoZSBcJ3Jlc3BvbnNlVGV4dFwnIHByb3BlcnR5IGZyb20gXCdYTUxIdHRwUmVxdWVzdFwnOiBUaGUgdmFsdWUgaXMgb25seSBhY2Nlc3NpYmxlIGlmIHRoZSBvYmplY3RcJ3MgXCdyZXNwb25zZVR5cGVcJyBpcyBcJ1wnIG9yIFwndGV4dFwnICh3YXMgXCdhcnJheWJ1ZmZlclwnKS4nKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBnZXQgcmVzcG9uc2VYTUwoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdVTlNFTlQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJVbnNlbnQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdPUEVORUQnLCB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogZmFsc2UsCiAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgIHZhbHVlOiB4aHJPcGVuZWQKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdIRUFERVJTX1JFQ0VJVkVEJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhySGVhZGVyc1JlY2VpdmVkCiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFhNTEh0dHBSZXF1ZXN0LCAnTE9BRElORycsIHsKICAgICAgICAgICAgY29uZmlndXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IHhockxvYWRpbmcKICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoWE1MSHR0cFJlcXVlc3QsICdET05FJywgewogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlLAogICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICB2YWx1ZTogeGhyRG9uZQogICAgICAgIH0pOwogICAgICAgIGV4cG9ydHMuWE1MSHR0cFJlcXVlc3QgPSB7CiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgdmFsdWU6IFhNTEh0dHBSZXF1ZXN0LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH07CiAgICB9KSgkX19fbW9ja18wMDQ2NTI4NDAwNGQ0YWE4KTsKICAgIChmdW5jdGlvbiAoKSB7CiAgICAgICAgKGZ1bmN0aW9uIChFKSB7CiAgICAgICAgICAgIHZhciB3aW5kb3cgPSB0aGlzOwogICAgICAgICAgICBpZiAod2luZG93Lmdvb2dsZXRhZyAmJiBnb29nbGV0YWcuZXZhbFNjcmlwdHMpIHsKICAgICAgICAgICAgICAgIGdvb2dsZXRhZy5ldmFsU2NyaXB0cygpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh3aW5kb3cuZ29vZ2xldGFnICYmIGdvb2dsZXRhZy5fbG9hZGVkXykKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgdmFyIGFhLCBiYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSAwOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiIDwgYS5sZW5ndGggPyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBhW2IrK10KICAgICAgICAgICAgICAgICAgICAgICAgfSA6IHsgZG9uZTogITAgfTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgY2EgPSAnZnVuY3Rpb24nID09IHR5cGVvZiBPYmplY3QuZGVmaW5lUHJvcGVydGllcyA/IE9iamVjdC5kZWZpbmVQcm9wZXJ0eSA6IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEgPT0gQXJyYXkucHJvdG90eXBlIHx8IGEgPT0gT2JqZWN0LnByb3RvdHlwZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICAgICAgYVtiXSA9IGMudmFsdWU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9LCBkYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IFsKICAgICAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT0gdHlwZW9mIGdsb2JhbFRoaXMgJiYgZ2xvYmFsVGhpcywKICAgICAgICAgICAgICAgICAgICAgICAgYSwKICAgICAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT0gdHlwZW9mIHdpbmRvdyAmJiB3aW5kb3csCiAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09IHR5cGVvZiBzZWxmICYmIHNlbGYsCiAgICAgICAgICAgICAgICAgICAgICAgICdvYmplY3QnID09IHR5cGVvZiBnbG9iYWwgJiYgZ2xvYmFsCiAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gMDsgYiA8IGEubGVuZ3RoOyArK2IpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhW2JdOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyAmJiBjLk1hdGggPT0gTWF0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignQ2Fubm90IGZpbmQgZ2xvYmFsIG9iamVjdCcpOwogICAgICAgICAgICAgICAgfSwgZWEgPSBkYSh0aGlzKSwgaGEgPSAnZnVuY3Rpb24nID09PSB0eXBlb2YgU3ltYm9sICYmICdzeW1ib2wnID09PSB0eXBlb2YgU3ltYm9sKCd4JyksIG0gPSB7fSwgaWEgPSB7fSwgcCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBpYVtiXTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBjKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYVtiXTsKICAgICAgICAgICAgICAgICAgICBjID0gYVtjXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBjID8gYyA6IGFbYl07CiAgICAgICAgICAgICAgICB9LCByID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYikKICAgICAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gMSA9PT0gZC5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGRbMF0sIGY7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAhYSAmJiBlIGluIG0gPyBmID0gbSA6IGYgPSBlYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZSA9IDA7IGUgPCBkLmxlbmd0aCAtIDE7IGUrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShoIGluIGYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBmW2hdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IGRbZC5sZW5ndGggLSAxXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBoYSAmJiAnZXM2JyA9PT0gYyA/IGZbZF0gOiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGIoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IGIgJiYgKGEgPyBjYShtLCBkLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pIDogYiAhPT0gYyAmJiAodm9pZCAwID09PSBpYVtkXSAmJiAoYSA9IDEwMDAwMDAwMDAgKiBNYXRoLnJhbmRvbSgpID4+PiAwLCBpYVtkXSA9IGhhID8gZWEuU3ltYm9sKGQpIDogJyRqc2NwJCcgKyBhICsgJyQnICsgZCksIGNhKGYsIGlhW2RdLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3cml0YWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGIKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHIoJ1N5bWJvbCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBpZiAoYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIHZhciBiID0gZnVuY3Rpb24gKGYsIGgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBmOwogICAgICAgICAgICAgICAgICAgIGNhKHRoaXMsICdkZXNjcmlwdGlvbicsIHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogaAogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmc7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgdmFyIGMgPSAnanNjb21wX3N5bWJvbF8nICsgKDEwMDAwMDAwMDAgKiBNYXRoLnJhbmRvbSgpID4+PiAwKSArICdfJywgZCA9IDAsIGUgPSBmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcyBpbnN0YW5jZW9mIGUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdTeW1ib2wgaXMgbm90IGEgY29uc3RydWN0b3InKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBiKGMgKyAoZiB8fCAnJykgKyAnXycgKyBkKyssIGYpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICByKCdTeW1ib2wuaXRlcmF0b3InLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICBhID0gKDAsIG0uU3ltYm9sKSgnU3ltYm9sLml0ZXJhdG9yJyk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0gJ0FycmF5IEludDhBcnJheSBVaW50OEFycmF5IFVpbnQ4Q2xhbXBlZEFycmF5IEludDE2QXJyYXkgVWludDE2QXJyYXkgSW50MzJBcnJheSBVaW50MzJBcnJheSBGbG9hdDMyQXJyYXkgRmxvYXQ2NEFycmF5Jy5zcGxpdCgnICcpLCBjID0gMDsgYyA8IGIubGVuZ3RoOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGVhW2JbY11dOwogICAgICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT09IHR5cGVvZiBkICYmICdmdW5jdGlvbicgIT0gdHlwZW9mIGQucHJvdG90eXBlW2FdICYmIGNhKGQucHJvdG90eXBlLCBhLCB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBqYShiYSh0aGlzKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHZhciBqYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IHsgbmV4dDogYSB9OwogICAgICAgICAgICAgICAgICAgIGFbcChtLlN5bWJvbCwgJ2l0ZXJhdG9yJyldID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSwga2EgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLnJhdyA9IGE7CiAgICAgICAgICAgICAgICB9LCB0ID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9ICd1bmRlZmluZWQnICE9IHR5cGVvZiBtLlN5bWJvbCAmJiBwKG0uU3ltYm9sLCAnaXRlcmF0b3InKSAmJiBhW3AobS5TeW1ib2wsICdpdGVyYXRvcicpXTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiA/IGIuY2FsbChhKSA6IHsgbmV4dDogYmEoYSkgfTsKICAgICAgICAgICAgICAgIH0sIGxhID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiLCBjID0gW107ICEoYiA9IGEubmV4dCgpKS5kb25lOykKICAgICAgICAgICAgICAgICAgICAgICAgYy5wdXNoKGIudmFsdWUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSwgdSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgaW5zdGFuY2VvZiBBcnJheSA/IGEgOiBsYSh0KGEpKTsKICAgICAgICAgICAgICAgIH0sIG1hID0gJ2Z1bmN0aW9uJyA9PSB0eXBlb2YgT2JqZWN0LmNyZWF0ZSA/IE9iamVjdC5jcmVhdGUgOiBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYi5wcm90b3R5cGUgPSBhOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgYigpOwogICAgICAgICAgICAgICAgfSwgbmE7CiAgICAgICAgICAgIGlmIChoYSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBPYmplY3Quc2V0UHJvdG90eXBlT2YpCiAgICAgICAgICAgICAgICBuYSA9IE9iamVjdC5zZXRQcm90b3R5cGVPZjsKICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICB2YXIgb2E7CiAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgdmFyIHBhID0geyBhOiAhMCB9LCBxYSA9IHt9OwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHFhLl9fcHJvdG9fXyA9IHBhOwogICAgICAgICAgICAgICAgICAgICAgICBvYSA9IHFhLmE7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYSkgewogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBvYSA9ICExOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgbmEgPSBvYSA/IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYS5fX3Byb3RvX18gPSBiOwogICAgICAgICAgICAgICAgICAgIGlmIChhLl9fcHJvdG9fXyAhPT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihhICsgJyBpcyBub3QgZXh0ZW5zaWJsZScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHJhID0gbmEsIHYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEucHJvdG90eXBlID0gbWEoYi5wcm90b3R5cGUpOwogICAgICAgICAgICAgICAgICAgIGEucHJvdG90eXBlLmNvbnN0cnVjdG9yID0gYTsKICAgICAgICAgICAgICAgICAgICBpZiAocmEpCiAgICAgICAgICAgICAgICAgICAgICAgIHJhKGEsIGIpOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyBpbiBiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCdwcm90b3R5cGUnICE9IGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihiLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCAmJiBPYmplY3QuZGVmaW5lUHJvcGVydHkoYSwgYywgZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbY10gPSBiW2NdOwogICAgICAgICAgICAgICAgICAgIGEuQWEgPSBiLnByb3RvdHlwZTsKICAgICAgICAgICAgICAgIH0sIHcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9IE51bWJlcih0aGlzKSwgYiA9IFtdLCBjID0gYTsgYyA8IGFyZ3VtZW50cy5sZW5ndGg7IGMrKykKICAgICAgICAgICAgICAgICAgICAgICAgYltjIC0gYV0gPSBhcmd1bWVudHNbY107CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICB9LCB4ID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGEsIGIpOwogICAgICAgICAgICAgICAgfSwgc2EgPSBoYSAmJiAnZnVuY3Rpb24nID09IHR5cGVvZiBwKE9iamVjdCwgJ2Fzc2lnbicpID8gcChPYmplY3QsICdhc3NpZ24nKSA6IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IDE7IGMgPCBhcmd1bWVudHMubGVuZ3RoOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBhcmd1bWVudHNbY107CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSBpbiBkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHgoZCwgZSkgJiYgKGFbZV0gPSBkW2VdKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICByKCdPYmplY3QuYXNzaWduJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhIHx8IHNhOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHIoJ0FycmF5LnByb3RvdHlwZS5maW5kJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgaW5zdGFuY2VvZiBTdHJpbmcgJiYgKGQgPSBTdHJpbmcoZCkpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gZC5sZW5ndGgsIGYgPSAwOyBmIDwgZTsgZisrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGRbZl07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYi5jYWxsKGMsIGgsIGYsIGQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgcignV2Vha01hcCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBmdW5jdGlvbiBiKCkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZnVuY3Rpb24gYyhoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSB0eXBlb2YgaDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ29iamVjdCcgPT09IGcgJiYgbnVsbCAhPT0gaCB8fCAnZnVuY3Rpb24nID09PSBnOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8ICFPYmplY3Quc2VhbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gT2JqZWN0LnNlYWwoe30pLCBnID0gT2JqZWN0LnNlYWwoe30pLCBrID0gbmV3IGEoWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoMiAhPSBrLmdldChoKSB8fCAzICE9IGsuZ2V0KGcpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsuZGVsZXRlKGgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgay5zZXQoZywgNCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWsuaGFzKGgpICYmIDQgPT0gay5nZXQoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0oKSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIHZhciBkID0gJyRqc2NvbXBfaGlkZGVuXycgKyBNYXRoLnJhbmRvbSgpLCBlID0gMCwgZiA9IGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IChlICs9IE1hdGgucmFuZG9tKCkgKyAxKS50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaCA9IHQoaCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBnOyAhKGcgPSBoLm5leHQoKSkuZG9uZTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGcudmFsdWUsIHRoaXMuc2V0KGdbMF0sIGdbMV0pOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGYucHJvdG90eXBlLnNldCA9IGZ1bmN0aW9uIChoLCBnKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFjKGgpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignSW52YWxpZCBXZWFrTWFwIGtleScpOwogICAgICAgICAgICAgICAgICAgIGlmICgheChoLCBkKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgayA9IG5ldyBiKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhKGgsIGQsIHsgdmFsdWU6IGsgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICgheChoLCBkKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1dlYWtNYXAga2V5IGZhaWw6ICcgKyBoKTsKICAgICAgICAgICAgICAgICAgICBoW2RdW3RoaXMuZ10gPSBnOwogICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGYucHJvdG90eXBlLmdldCA9IGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoaCkgJiYgeChoLCBkKSA/IGhbZF1bdGhpcy5nXSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBmLnByb3RvdHlwZS5oYXMgPSBmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBjKGgpICYmIHgoaCwgZCkgJiYgeChoW2RdLCB0aGlzLmcpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGYucHJvdG90eXBlLmRlbGV0ZSA9IGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoaCkgJiYgeChoLCBkKSAmJiB4KGhbZF0sIHRoaXMuZykgPyBkZWxldGUgaFtkXVt0aGlzLmddIDogITE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgcmV0dXJuIGY7CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgcignTWFwJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIGlmIChmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYSB8fCAnZnVuY3Rpb24nICE9IHR5cGVvZiBhIHx8ICFhLnByb3RvdHlwZS5lbnRyaWVzIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIE9iamVjdC5zZWFsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGcgPSBPYmplY3Quc2VhbCh7IHg6IDQgfSksIGsgPSBuZXcgYSh0KFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3MnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ3MnICE9IGsuZ2V0KGcpIHx8IDEgIT0gay5zaXplIHx8IGsuZ2V0KHsgeDogNCB9KSB8fCBrLnNldCh7IHg6IDQgfSwgJ3QnKSAhPSBrIHx8IDIgIT0gay5zaXplKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gay5lbnRyaWVzKCksIG4gPSBsLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuLmRvbmUgfHwgbi52YWx1ZVswXSAhPSBnIHx8ICdzJyAhPSBuLnZhbHVlWzFdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBsLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuLmRvbmUgfHwgNCAhPSBuLnZhbHVlWzBdLnggfHwgJ3QnICE9IG4udmFsdWVbMV0gfHwgIWwubmV4dCgpLmRvbmUgPyAhMSA6ICEwOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KCkpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB2YXIgYiA9IG5ldyBtLldlYWtNYXAoKSwgYyA9IGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBmKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2l6ZSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gdChnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGs7ICEoayA9IGcubmV4dCgpKS5kb25lOykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrID0gay52YWx1ZSwgdGhpcy5zZXQoa1swXSwga1sxXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuc2V0ID0gZnVuY3Rpb24gKGcsIGspIHsKICAgICAgICAgICAgICAgICAgICBnID0gMCA9PT0gZyA/IDAgOiBnOwogICAgICAgICAgICAgICAgICAgIHZhciBsID0gZCh0aGlzLCBnKTsKICAgICAgICAgICAgICAgICAgICBsLmxpc3QgfHwgKGwubGlzdCA9IHRoaXMuaFtsLmlkXSA9IFtdKTsKICAgICAgICAgICAgICAgICAgICBsLm0gPyBsLm0udmFsdWUgPSBrIDogKGwubSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogdGhpcy5nLAogICAgICAgICAgICAgICAgICAgICAgICB1OiB0aGlzLmcudSwKICAgICAgICAgICAgICAgICAgICAgICAgaGVhZDogdGhpcy5nLAogICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGcsCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBrCiAgICAgICAgICAgICAgICAgICAgfSwgbC5saXN0LnB1c2gobC5tKSwgdGhpcy5nLnUubmV4dCA9IGwubSwgdGhpcy5nLnUgPSBsLm0sIHRoaXMuc2l6ZSsrKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBjLnByb3RvdHlwZS5kZWxldGUgPSBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgIGcgPSBkKHRoaXMsIGcpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBnLm0gJiYgZy5saXN0ID8gKGcubGlzdC5zcGxpY2UoZy5pbmRleCwgMSksIGcubGlzdC5sZW5ndGggfHwgZGVsZXRlIHRoaXMuaFtnLmlkXSwgZy5tLnUubmV4dCA9IGcubS5uZXh0LCBnLm0ubmV4dC51ID0gZy5tLnUsIGcubS5oZWFkID0gbnVsbCwgdGhpcy5zaXplLS0sICEwKSA6ICExOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLmNsZWFyID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IHt9OwogICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IHRoaXMuZy51ID0gZigpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuc2l6ZSA9IDA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuaGFzID0gZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFkKHRoaXMsIGcpLm07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuZ2V0ID0gZnVuY3Rpb24gKGcpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGcgPSBkKHRoaXMsIGcpLm0pICYmIGcudmFsdWU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUuZW50cmllcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0aGlzLCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5rZXksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnLnZhbHVlCiAgICAgICAgICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUua2V5cyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSh0aGlzLCBmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy5rZXk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYy5wcm90b3R5cGUudmFsdWVzID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBlKHRoaXMsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnLnZhbHVlOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlLmZvckVhY2ggPSBmdW5jdGlvbiAoZywgaykgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGwgPSB0aGlzLmVudHJpZXMoKSwgbjsgIShuID0gbC5uZXh0KCkpLmRvbmU7KQogICAgICAgICAgICAgICAgICAgICAgICBuID0gbi52YWx1ZSwgZy5jYWxsKGssIG5bMV0sIG5bMF0sIHRoaXMpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGMucHJvdG90eXBlW3AobS5TeW1ib2wsICdpdGVyYXRvcicpXSA9IGMucHJvdG90eXBlLmVudHJpZXM7CiAgICAgICAgICAgICAgICB2YXIgZCA9IGZ1bmN0aW9uIChnLCBrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gayAmJiB0eXBlb2YgazsKICAgICAgICAgICAgICAgICAgICAgICAgJ29iamVjdCcgPT0gbCB8fCAnZnVuY3Rpb24nID09IGwgPyBiLmhhcyhrKSA/IGwgPSBiLmdldChrKSA6IChsID0gJycgKyArK2gsIGIuc2V0KGssIGwpKSA6IGwgPSAncF8nICsgazsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG4gPSBnLmhbbF07CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuICYmIHgoZy5oLCBsKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoZyA9IDA7IGcgPCBuLmxlbmd0aDsgZysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHEgPSBuW2ddOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChrICE9PSBrICYmIHEua2V5ICE9PSBxLmtleSB8fCBrID09PSBxLmtleSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlzdDogbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiBnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbTogcQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0OiBuLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IC0xLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbTogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgfSwgZSA9IGZ1bmN0aW9uIChnLCBrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsID0gZy5nOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gamEoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgbC5oZWFkICE9IGcuZzspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBsLnU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICg7IGwubmV4dCAhPSBsLmhlYWQ7KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbCA9IGwubmV4dCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogayhsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGwgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb25lOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9LCBmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZy51ID0gZy5uZXh0ID0gZy5oZWFkID0gZzsKICAgICAgICAgICAgICAgICAgICB9LCBoID0gMDsKICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHZhciB0YSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYSBpbnN0YW5jZW9mIFN0cmluZyAmJiAoYSArPSAnJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAwLCBkID0gITEsIGUgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFkICYmIGMgPCBhLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGMrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBiKGYsIGFbZl0pLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZTogITEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9ICEwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogdm9pZCAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBlW3AobS5TeW1ib2wsICdpdGVyYXRvcicpXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgICAgIH0sIHVhID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBhKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdUaGUgXCd0aGlzXCcgdmFsdWUgZm9yIFN0cmluZy5wcm90b3R5cGUuJyArIGMgKyAnIG11c3Qgbm90IGJlIG51bGwgb3IgdW5kZWZpbmVkJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGIgaW5zdGFuY2VvZiBSZWdFeHApCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ0ZpcnN0IGFyZ3VtZW50IHRvIFN0cmluZy5wcm90b3R5cGUuJyArIGMgKyAnIG11c3Qgbm90IGJlIGEgcmVndWxhciBleHByZXNzaW9uJyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgKyAnJzsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHIoJ1N0cmluZy5wcm90b3R5cGUuc3RhcnRzV2l0aCcsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gdWEodGhpcywgYiwgJ3N0YXJ0c1dpdGgnKSwgZSA9IGQubGVuZ3RoLCBmID0gYi5sZW5ndGg7CiAgICAgICAgICAgICAgICAgICAgYyA9IE1hdGgubWF4KDAsIE1hdGgubWluKGMgfCAwLCBkLmxlbmd0aCkpOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGggPSAwOyBoIDwgZiAmJiBjIDwgZTspCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkW2MrK10gIT0gYltoKytdKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBoID49IGY7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHIoJ1N0cmluZy5wcm90b3R5cGUucmVwZWF0JywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB1YSh0aGlzLCBudWxsLCAncmVwZWF0Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPiBiIHx8IDEzNDIxNzcyNzkgPCBiKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcignSW52YWxpZCBjb3VudCB2YWx1ZScpOwogICAgICAgICAgICAgICAgICAgIGIgfD0gMDsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gJyc7IGI7KQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiAmIDEgJiYgKGQgKz0gYyksIGIgPj4+PSAxKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyArPSBjOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICByKCdnbG9iYWxUaGlzJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhIHx8IGVhOwogICAgICAgICAgICB9LCAnZXNfMjAyMCcpOwogICAgICAgICAgICByKCdTZXQnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgaWYgKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFhIHx8ICdmdW5jdGlvbicgIT0gdHlwZW9mIGEgfHwgIWEucHJvdG90eXBlLmVudHJpZXMgfHwgJ2Z1bmN0aW9uJyAhPSB0eXBlb2YgT2JqZWN0LnNlYWwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IE9iamVjdC5zZWFsKHsgeDogNCB9KSwgZCA9IG5ldyBhKHQoW2NdKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWQuaGFzKGMpIHx8IDEgIT0gZC5zaXplIHx8IGQuYWRkKGMpICE9IGQgfHwgMSAhPSBkLnNpemUgfHwgZC5hZGQoeyB4OiA0IH0pICE9IGQgfHwgMiAhPSBkLnNpemUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkLmVudHJpZXMoKSwgZiA9IGUubmV4dCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYuZG9uZSB8fCBmLnZhbHVlWzBdICE9IGMgfHwgZi52YWx1ZVsxXSAhPSBjKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBlLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmLmRvbmUgfHwgZi52YWx1ZVswXSA9PSBjIHx8IDQgIT0gZi52YWx1ZVswXS54IHx8IGYudmFsdWVbMV0gIT0gZi52YWx1ZVswXSA/ICExIDogZS5uZXh0KCkuZG9uZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSgpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgdmFyIGIgPSBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IG5ldyBtLk1hcCgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSB0KGMpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkOyAhKGQgPSBjLm5leHQoKSkuZG9uZTspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmFkZChkLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zaXplID0gdGhpcy5nLnNpemU7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gMCA9PT0gYyA/IDAgOiBjOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZy5zZXQoYywgYyk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zaXplID0gdGhpcy5nLnNpemU7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuZGVsZXRlID0gZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICBjID0gdGhpcy5nLmRlbGV0ZShjKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNpemUgPSB0aGlzLmcuc2l6ZTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS5jbGVhciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcuY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICB0aGlzLnNpemUgPSAwOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLmhhcyA9IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZy5oYXMoYyk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgYi5wcm90b3R5cGUuZW50cmllcyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5nLmVudHJpZXMoKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS52YWx1ZXMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHAodGhpcy5nLCAndmFsdWVzJykuY2FsbCh0aGlzLmcpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGIucHJvdG90eXBlLmtleXMgPSBwKGIucHJvdG90eXBlLCAndmFsdWVzJyk7CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZVtwKG0uU3ltYm9sLCAnaXRlcmF0b3InKV0gPSBwKGIucHJvdG90eXBlLCAndmFsdWVzJyk7CiAgICAgICAgICAgICAgICBiLnByb3RvdHlwZS5mb3JFYWNoID0gZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nLmZvckVhY2goZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMuY2FsbChkLCBmLCBmLCBlKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICByKCdTdHJpbmcucHJvdG90eXBlLnBhZFN0YXJ0JywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB1YSh0aGlzLCBudWxsLCAncGFkU3RhcnQnKTsKICAgICAgICAgICAgICAgICAgICBiIC09IGQubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgIGMgPSB2b2lkIDAgIT09IGMgPyBTdHJpbmcoYykgOiAnICc7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICgwIDwgYiAmJiBjID8gcChjLCAncmVwZWF0JykuY2FsbChjLCBNYXRoLmNlaWwoYiAvIGMubGVuZ3RoKSkuc3Vic3RyaW5nKDAsIGIpIDogJycpICsgZDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczgnKTsKICAgICAgICAgICAgcignQXJyYXkucHJvdG90eXBlLmtleXMnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhIDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB0YSh0aGlzLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0sICdlczYnKTsKICAgICAgICAgICAgcignQXJyYXkucHJvdG90eXBlLnZhbHVlcycsIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gYSA/IGEgOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRhKHRoaXMsIGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzOCcpOwogICAgICAgICAgICByKCdPYmplY3QuaXMnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhIDogZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYiA9PT0gYyA/IDAgIT09IGIgfHwgMSAvIGIgPT09IDEgLyBjIDogYiAhPT0gYiAmJiBjICE9PSBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzNicpOwogICAgICAgICAgICByKCdBcnJheS5wcm90b3R5cGUuaW5jbHVkZXMnLCBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBhIDogZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHRoaXM7CiAgICAgICAgICAgICAgICAgICAgZCBpbnN0YW5jZW9mIFN0cmluZyAmJiAoZCA9IFN0cmluZyhkKSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICBjID0gYyB8fCAwOwogICAgICAgICAgICAgICAgICAgIGZvciAoMCA+IGMgJiYgKGMgPSBNYXRoLm1heChjICsgZSwgMCkpOyBjIDwgZTsgYysrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gZFtjXTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYgPT09IGIgfHwgcChPYmplY3QsICdpcycpLmNhbGwoT2JqZWN0LCBmLCBiKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhMDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfSwgJ2VzNycpOwogICAgICAgICAgICByKCdTdHJpbmcucHJvdG90eXBlLmluY2x1ZGVzJywgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBhID8gYSA6IGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xICE9PSB1YSh0aGlzLCBiLCAnaW5jbHVkZXMnKS5pbmRleE9mKGIsIGMgfHwgMCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9LCAnZXM2Jyk7CiAgICAgICAgICAgIHZhciB6ID0gdGhpcyB8fCBzZWxmLCB2YSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IGEuc3BsaXQoJy4nKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBiID0geiwgYyA9IDA7IGMgPCBhLmxlbmd0aDsgYysrKQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYiA9IGJbYVtjXV0sIG51bGwgPT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSwgeWEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgd2EpICYmIGFbd2FdIHx8IChhW3dhXSA9ICsreGEpOwogICAgICAgICAgICAgICAgfSwgd2EgPSAnY2xvc3VyZV91aWRfJyArICgxMDAwMDAwMDAwICogTWF0aC5yYW5kb20oKSA+Pj4gMCksIHhhID0gMCwgemEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSBhLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB6OwogICAgICAgICAgICAgICAgICAgIGFbMF0gaW4gYyB8fCAndW5kZWZpbmVkJyA9PSB0eXBlb2YgYy5leGVjU2NyaXB0IHx8IGMuZXhlY1NjcmlwdCgndmFyICcgKyBhWzBdKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkOyBhLmxlbmd0aCAmJiAoZCA9IGEuc2hpZnQoKSk7KQogICAgICAgICAgICAgICAgICAgICAgICBhLmxlbmd0aCB8fCB2b2lkIDAgPT09IGIgPyBjW2RdICYmIGNbZF0gIT09IE9iamVjdC5wcm90b3R5cGVbZF0gPyBjID0gY1tkXSA6IGMgPSBjW2RdID0ge30gOiBjW2RdID0gYjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBBYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC9eW1xzXHhhMF0qKFtcc1xTXSo/KVtcc1x4YTBdKiQvLmV4ZWMoYSlbMV07CiAgICAgICAgICAgICAgICB9LCBJYSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFCYS50ZXN0KGEpKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICAtMSAhPSBhLmluZGV4T2YoJyYnKSAmJiAoYSA9IGEucmVwbGFjZShDYSwgJyZhbXA7JykpOwogICAgICAgICAgICAgICAgICAgIC0xICE9IGEuaW5kZXhPZignPCcpICYmIChhID0gYS5yZXBsYWNlKERhLCAnJmx0OycpKTsKICAgICAgICAgICAgICAgICAgICAtMSAhPSBhLmluZGV4T2YoJz4nKSAmJiAoYSA9IGEucmVwbGFjZShFYSwgJyZndDsnKSk7CiAgICAgICAgICAgICAgICAgICAgLTEgIT0gYS5pbmRleE9mKCciJykgJiYgKGEgPSBhLnJlcGxhY2UoRmEsICcmcXVvdDsnKSk7CiAgICAgICAgICAgICAgICAgICAgLTEgIT0gYS5pbmRleE9mKCdcJycpICYmIChhID0gYS5yZXBsYWNlKEdhLCAnJiMzOTsnKSk7CiAgICAgICAgICAgICAgICAgICAgLTEgIT0gYS5pbmRleE9mKCdcMCcpICYmIChhID0gYS5yZXBsYWNlKEhhLCAnJiMwOycpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0sIENhID0gLyYvZywgRGEgPSAvPC9nLCBFYSA9IC8+L2csIEZhID0gLyIvZywgR2EgPSAvJy9nLCBIYSA9IC9ceDAwL2csIEJhID0gL1tceDAwJjw+IiddLywgTGEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gMDsKICAgICAgICAgICAgICAgICAgICBhID0gQWEoU3RyaW5nKGEpKS5zcGxpdCgnLicpOwogICAgICAgICAgICAgICAgICAgIGIgPSBBYShTdHJpbmcoYikpLnNwbGl0KCcuJyk7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IE1hdGgubWF4KGEubGVuZ3RoLCBiLmxlbmd0aCksIGUgPSAwOyAwID09IGMgJiYgZSA8IGQ7IGUrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGFbZV0gfHwgJycsIGggPSBiW2VdIHx8ICcnOwogICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gLyhcZCopKFxEKikoLiopLy5leGVjKGYpIHx8IFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSAvKFxkKikoXEQqKSguKikvLmV4ZWMoaCkgfHwgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT0gZlswXS5sZW5ndGggJiYgMCA9PSBoWzBdLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBLYSgwID09IGZbMV0ubGVuZ3RoID8gMCA6IHBhcnNlSW50KGZbMV0sIDEwKSwgMCA9PSBoWzFdLmxlbmd0aCA/IDAgOiBwYXJzZUludChoWzFdLCAxMCkpIHx8IEthKDAgPT0gZlsyXS5sZW5ndGgsIDAgPT0gaFsyXS5sZW5ndGgpIHx8IEthKGZbMl0sIGhbMl0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGZbM107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoID0gaFszXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoMCA9PSBjKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9LCBLYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPCBiID8gLTEgOiBhID4gYiA/IDEgOiAwOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gTWEoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHoubmF2aWdhdG9yOwogICAgICAgICAgICAgICAgcmV0dXJuIGEgJiYgKGEgPSBhLnVzZXJBZ2VudCkgPyBhIDogJyc7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gTmEoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIC0xICE9IE1hKCkuaW5kZXhPZihhKTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBPYSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgQXJyYXkucHJvdG90eXBlLmZvckVhY2guY2FsbChhLCBiLCB2b2lkIDApOwogICAgICAgICAgICAgICAgfSwgUGEgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5wcm90b3R5cGUuZmlsdGVyLmNhbGwoYSwgYiwgdm9pZCAwKTsKICAgICAgICAgICAgICAgIH0sIFFhID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkucHJvdG90eXBlLm1hcC5jYWxsKGEsIGIsIHZvaWQgMCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBSYShhLCBiKSB7CiAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IGEubGVuZ3RoLCBkID0gJ3N0cmluZycgPT09IHR5cGVvZiBhID8gYS5zcGxpdCgnJykgOiBhLCBlID0gMDsgZSA8IGM7IGUrKykKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgaW4gZCAmJiBiLmNhbGwodm9pZCAwLCBkW2VdLCBlLCBhKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgYiA9IGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYiA9IC0xOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIDAgPiBiID8gbnVsbCA6ICdzdHJpbmcnID09PSB0eXBlb2YgYSA/IGEuY2hhckF0KGIpIDogYVtiXTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBTYShhLCBiKSB7CiAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9ICdzdHJpbmcnID09PSB0eXBlb2YgYSA/IGEuc3BsaXQoJycpIDogYSwgZCA9IGEubGVuZ3RoIC0gMTsgMCA8PSBkOyBkLS0pCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkIGluIGMgJiYgYi5jYWxsKHZvaWQgMCwgY1tkXSwgZCwgYSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGIgPSAtMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiAwID4gYiA/IG51bGwgOiAnc3RyaW5nJyA9PT0gdHlwZW9mIGEgPyBhLmNoYXJBdChiKSA6IGFbYl07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gVGEoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIDAgPD0gQXJyYXkucHJvdG90eXBlLmluZGV4T2YuY2FsbChhLCBiLCB2b2lkIDApOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgdmFyIFVhID0ge30sIFZhID0gbnVsbCwgWGEgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gW107CiAgICAgICAgICAgICAgICAgICAgV2EoYSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYi5wdXNoKGMpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfSwgV2EgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIGMoaykgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKDsgZCA8IGEubGVuZ3RoOykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGwgPSBhLmNoYXJBdChkKyspLCBuID0gVmFbbF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBuKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEvXltcc1x4YTBdKiQvLnRlc3QobCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ1Vua25vd24gYmFzZTY0IGVuY29kaW5nIGF0IGNoYXI6ICcgKyBsKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgWWEoKTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gMDs7KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYygtMSksIGYgPSBjKDApLCBoID0gYyg2NCksIGcgPSBjKDY0KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDY0ID09PSBnICYmIC0xID09PSBlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGIoZSA8PCAyIHwgZiA+PiA0KTsKICAgICAgICAgICAgICAgICAgICAgICAgNjQgIT0gaCAmJiAoYihmIDw8IDQgJiAyNDAgfCBoID4+IDIpLCA2NCAhPSBnICYmIGIoaCA8PCA2ICYgMTkyIHwgZykpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIFlhID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIGlmICghVmEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgVmEgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYSA9ICdBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OScuc3BsaXQoJycpLCBiID0gWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnKy89JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJysvJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy1fPScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICctXy4nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLV8nCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwgYyA9IDA7IDUgPiBjOyBjKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gYS5jb25jYXQoYltjXS5zcGxpdCgnJykpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgVWFbY10gPSBkOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IDA7IGUgPCBkLmxlbmd0aDsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBkW2VdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCA9PT0gVmFbZl0gJiYgKFZhW2ZdID0gZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWmEgPSAnZnVuY3Rpb24nID09PSB0eXBlb2YgVWludDhBcnJheTsKICAgICAgICAgICAgdmFyICRhID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIG0uU3ltYm9sICYmICdzeW1ib2wnID09PSB0eXBlb2YgKDAsIG0uU3ltYm9sKSgpID8gKDAsIG0uU3ltYm9sKSh2b2lkIDApIDogdm9pZCAwOwogICAgICAgICAgICBmdW5jdGlvbiBhYihhKSB7CiAgICAgICAgICAgICAgICBPYmplY3QuaXNGcm96ZW4oYSkgfHwgKCRhID8gYVskYV0gfD0gMSA6IHZvaWQgMCAhPT0gYS5nID8gYS5nIHw9IDEgOiBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhhLCB7CiAgICAgICAgICAgICAgICAgICAgZzogewogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiAhMQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgZnVuY3Rpb24gYmIoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGEgJiYgJ29iamVjdCcgPT09IHR5cGVvZiBhICYmICFBcnJheS5pc0FycmF5KGEpICYmIGEuY29uc3RydWN0b3IgPT09IE9iamVjdDsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgY2I7CiAgICAgICAgICAgIGZ1bmN0aW9uIGRiKGEpIHsKICAgICAgICAgICAgICAgIHN3aXRjaCAodHlwZW9mIGEpIHsKICAgICAgICAgICAgICAgIGNhc2UgJ251bWJlcic6CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlzRmluaXRlKGEpID8gYSA6IFN0cmluZyhhKTsKICAgICAgICAgICAgICAgIGNhc2UgJ29iamVjdCc6CiAgICAgICAgICAgICAgICAgICAgaWYgKGEgJiYgIUFycmF5LmlzQXJyYXkoYSkgJiYgWmEgJiYgbnVsbCAhPSBhICYmIGEgaW5zdGFuY2VvZiBVaW50OEFycmF5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiOwogICAgICAgICAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGIgJiYgKGIgPSAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgWWEoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IFVhW2JdOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gQXJyYXkoTWF0aC5mbG9vcihhLmxlbmd0aCAvIDMpKSwgZCA9IGJbNjRdIHx8ICcnLCBlID0gMCwgZiA9IDA7IGUgPCBhLmxlbmd0aCAtIDI7IGUgKz0gMykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBhW2VdLCBnID0gYVtlICsgMV0sIGsgPSBhW2UgKyAyXSwgbCA9IGJbaCA+PiAyXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggPSBiWyhoICYgMykgPDwgNCB8IGcgPj4gNF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gYlsoZyAmIDE1KSA8PCAyIHwgayA+PiA2XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGsgPSBiW2sgJiA2M107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjW2YrK10gPSBsICsgaCArIGcgKyBrOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGwgPSAwOwogICAgICAgICAgICAgICAgICAgICAgICBrID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChhLmxlbmd0aCAtIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgbCA9IGFbZSArIDFdLCBrID0gYlsobCAmIDE1KSA8PCAyXSB8fCBkOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gYVtlXSwgY1tmXSA9IGJbYSA+PiAyXSArIGJbKGEgJiAzKSA8PCA0IHwgbCA+PiA0XSArIGsgKyBkOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmpvaW4oJycpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgZnVuY3Rpb24gZWIoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKG51bGwgIT0gYSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkuaXNBcnJheShhKSB8fCBiYihhKSA/IGZiKGEsIGIpIDogYihhKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBmYihhLCBiKSB7CiAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShhKSkgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBBcnJheShhLmxlbmd0aCksIGQgPSAwOyBkIDwgYS5sZW5ndGg7IGQrKykKICAgICAgICAgICAgICAgICAgICAgICAgY1tkXSA9IGViKGFbZF0sIGIpOwogICAgICAgICAgICAgICAgICAgIGlmIChiID0gQXJyYXkuaXNBcnJheShhKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZTsKICAgICAgICAgICAgICAgICAgICAgICAgJGEgPyBlID0gYVskYV0gOiBlID0gYS5nOwogICAgICAgICAgICAgICAgICAgICAgICBiID0gKG51bGwgPT0gZSA/IDAgOiBlKSAmIDE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGIgJiYgYWIoYyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlID0ge307CiAgICAgICAgICAgICAgICBmb3IgKGMgaW4gYSkKICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgYykgJiYgKGVbY10gPSBlYihhW2NdLCBiKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBnYihhKSB7CiAgICAgICAgICAgICAgICBpZiAoYSAmJiAnb2JqZWN0JyA9PSB0eXBlb2YgYSAmJiBhLnRvSlNPTikKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS50b0pTT04oKTsKICAgICAgICAgICAgICAgIGEgPSBkYihhKTsKICAgICAgICAgICAgICAgIHJldHVybiBBcnJheS5pc0FycmF5KGEpID8gZmIoYSwgZ2IpIDogYTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBoYjsKICAgICAgICAgICAgdmFyIEEgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gaGI7CiAgICAgICAgICAgICAgICAgICAgaGIgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGEgfHwgKGEgPSBkKTsKICAgICAgICAgICAgICAgICAgICBkID0gdGhpcy5jb25zdHJ1Y3Rvci5tZXNzYWdlSWQ7CiAgICAgICAgICAgICAgICAgICAgYSB8fCAoYSA9IGQgPyBbZF0gOiBbXSk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pID0gKGQgPyAwIDogLTEpIC0gKHRoaXMuY29uc3RydWN0b3Iud2EgfHwgMCk7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IGE7CiAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICBkID0gdGhpcy5oLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9IGQgLSAxOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiAoZCA9IHRoaXMuaFthXSwgYmIoZCkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmwgPSBhIC0gdGhpcy5pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gZDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdm9pZCAwICE9PSBiICYmIC0xIDwgYiA/ICh0aGlzLmwgPSBNYXRoLm1heChiLCBhICsgMSAtIHRoaXMuaSksIHRoaXMuaiA9IHZvaWQgMCkgOiB0aGlzLmwgPSBOdW1iZXIuTUFYX1ZBTFVFOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoYykKICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChiID0gMDsgYiA8IGMubGVuZ3RoOyBiKyspCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA9IGNbYl0sIGEgPCB0aGlzLmwpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYSArPSB0aGlzLmksIChkID0gdGhpcy5oW2FdKSA/IEFycmF5LmlzQXJyYXkoZCkgJiYgYWIoZCkgOiB0aGlzLmhbYV0gPSBrYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSB0aGlzLmogfHwgKHRoaXMuaiA9IHRoaXMuaFt0aGlzLmwgKyB0aGlzLmldID0ge30pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gZFthXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID8gQXJyYXkuaXNBcnJheShlKSAmJiBhYihlKSA6IGRbYV0gPSBrYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGtiID0gT2JqZWN0LmZyZWV6ZShhYihbXSkpLCBCID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gLTEgPT09IGIgPyBudWxsIDogYiA+PSBhLmwgPyBhLmogPyBhLmpbYl0gOiB2b2lkIDAgOiAodm9pZCAwID09PSBjID8gMCA6IGMpICYmIGEuaiAmJiAoYyA9IGEualtiXSwgbnVsbCAhPSBjKSA/IGMgOiBhLmhbYiArIGEuaV07CiAgICAgICAgICAgICAgICB9LCBsYiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/ICExIDogYzsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IEIoYSwgYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSBkICYmIChkID0ga2IpOwogICAgICAgICAgICAgICAgICAgIGQgPT09IGtiICYmIChkID0gYWIoZC5zbGljZSgpKSwgQyhhLCBiLCBkLCBjKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICB9LCBEID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBhID0gQihhLCBiKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBhID8gYyA6IGE7CiAgICAgICAgICAgICAgICB9LCBtYiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYSA9IEIoYSwgYik7CiAgICAgICAgICAgICAgICAgICAgYSA9IG51bGwgPT0gYSA/IGEgOiAhIWE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gYSA/ICExIDogYTsKICAgICAgICAgICAgICAgIH0sIG5iID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBhID0gQihhLCBiKTsKICAgICAgICAgICAgICAgICAgICBhID0gbnVsbCA9PSBhID8gYSA6ICthOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsID09IGEgPyB2b2lkIDAgPT09IGMgPyAwIDogYyA6IGE7CiAgICAgICAgICAgICAgICB9LCBDID0gZnVuY3Rpb24gKGEsIGIsIGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICAodm9pZCAwID09PSBkID8gMCA6IGQpIHx8IGIgPj0gYS5sID8gKGEuaiB8fCAoYS5qID0gYS5oW2EubCArIGEuaV0gPSB7fSkpW2JdID0gYyA6IGEuaFtiICsgYS5pXSA9IGM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9LCBvYiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB2b2lkIDAgPT09IGQgPyAhMSA6IGQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMoYSwgYiwgbnVsbCA9PSBjID8gYWIoW10pIDogQXJyYXkuaXNBcnJheShjKSA/IGFiKGMpIDogYywgZCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBGKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIDAgIT09IGMgPyBDKGEsIGIsIGMpIDogQyhhLCBiLCB2b2lkIDAsICExKTsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBwYiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgKGMgPSBHKGEsIGMpKSAmJiBjICE9PSBiICYmIG51bGwgIT0gZCAmJiAoYS5nICYmIGMgaW4gYS5nICYmIChhLmdbY10gPSB2b2lkIDApLCBDKGEsIGMsIHZvaWQgMCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBDKGEsIGIsIGQpOwogICAgICAgICAgICAgICAgfSwgRyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IDAsIGQgPSAwOyBkIDwgYi5sZW5ndGg7IGQrKykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGJbZF07CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgIT0gQihhLCBlKSAmJiAoMCAhPT0gYyAmJiBDKGEsIGMsIHZvaWQgMCwgITEpLCBjID0gZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSwgSCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKC0xID09PSBjKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICBhLmcgfHwgKGEuZyA9IHt9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGEuZ1tjXTsKICAgICAgICAgICAgICAgICAgICBpZiAoZCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBCKGEsIGMsICExKTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgICAgICBiID0gbmV3IGIoZSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuZ1tjXSA9IGI7CiAgICAgICAgICAgICAgICB9LCBJID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBhLmcgfHwgKGEuZyA9IHt9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGEuZ1tjXTsKICAgICAgICAgICAgICAgICAgICBpZiAoIWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBsYihhLCBjLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZiA9IDA7IGYgPCBlLmxlbmd0aDsgZisrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZFtmXSA9IG5ldyBiKGVbZl0pOwogICAgICAgICAgICAgICAgICAgICAgICBhLmdbY10gPSBkOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgIH0sIHFiID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZDsKICAgICAgICAgICAgICAgICAgICBhLmcgfHwgKGEuZyA9IHt9KTsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMgPyBjLmggOiBjOwogICAgICAgICAgICAgICAgICAgIGEuZ1tiXSA9IGM7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEMoYSwgYiwgZSwgdm9pZCAwID09PSBkID8gITEgOiBkKTsKICAgICAgICAgICAgICAgIH0sIHNiID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHJiOwogICAgICAgICAgICAgICAgICAgIGEuZyB8fCAoYS5nID0ge30pOwogICAgICAgICAgICAgICAgICAgIHZhciBlID0gYyA/IGMuaCA6IGM7CiAgICAgICAgICAgICAgICAgICAgYS5nW2JdID0gYzsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGIoYSwgYiwgZCwgZSk7CiAgICAgICAgICAgICAgICB9LCB0YiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB2b2lkIDAgPT09IGQgPyAhMSA6IGQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBhYihbXSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSAwOyBmIDwgYy5sZW5ndGg7IGYrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVbZl0gPSBjW2ZdLmg7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuZyB8fCAoYS5nID0ge30pOwogICAgICAgICAgICAgICAgICAgICAgICBhLmdbYl0gPSBjOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBhLmcgJiYgKGEuZ1tiXSA9IHZvaWQgMCksIGUgPSBrYjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQyhhLCBiLCBlLCBkKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIEEucHJvdG90eXBlLnRvSlNPTiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdGhpcy5oOwogICAgICAgICAgICAgICAgcmV0dXJuIGNiID8gYSA6IGZiKGEsIGdiKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gdWIoYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIGRiKGIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciB2YiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgY2IgPSAhMDsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkoYS50b0pTT04oKSwgdWIpOwogICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNiID0gITE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgd2IgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBEKGEsIGIsIHZvaWQgMCA9PT0gYyA/ICcnIDogYyk7CiAgICAgICAgICAgICAgICB9LCB4YiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IEcoYSwgYykgPT09IGIgPyBiIDogLTE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEQoYSwgYiwgMCk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQWIgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdGhpcy5oID0gYSA9PT0geWIgJiYgYiB8fCAnJzsKICAgICAgICAgICAgICAgIHRoaXMuaSA9IHpiOwogICAgICAgICAgICB9OwogICAgICAgICAgICBBYi5wcm90b3R5cGUuQiA9ICEwOwogICAgICAgICAgICBBYi5wcm90b3R5cGUuZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmg7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBCYiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgaW5zdGFuY2VvZiBBYiAmJiBhLmNvbnN0cnVjdG9yID09PSBBYiAmJiBhLmkgPT09IHpiID8gYS5oIDogJ3R5cGVfZXJyb3I6Q29uc3QnOwogICAgICAgICAgICAgICAgfSwgQ2IgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQWIoeWIsIGEpOwogICAgICAgICAgICAgICAgfSwgemIgPSB7fSwgeWIgPSB7fTsKICAgICAgICAgICAgZnVuY3Rpb24gRGIoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBbXSwgYyA9IDAsIGQ7CiAgICAgICAgICAgICAgICBmb3IgKGQgaW4gYSkKICAgICAgICAgICAgICAgICAgICBiW2MrK10gPSBhW2RdOwogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgRWIgPSB7CiAgICAgICAgICAgICAgICBhcmVhOiAhMCwKICAgICAgICAgICAgICAgIGJhc2U6ICEwLAogICAgICAgICAgICAgICAgYnI6ICEwLAogICAgICAgICAgICAgICAgY29sOiAhMCwKICAgICAgICAgICAgICAgIGNvbW1hbmQ6ICEwLAogICAgICAgICAgICAgICAgZW1iZWQ6ICEwLAogICAgICAgICAgICAgICAgaHI6ICEwLAogICAgICAgICAgICAgICAgaW1nOiAhMCwKICAgICAgICAgICAgICAgIGlucHV0OiAhMCwKICAgICAgICAgICAgICAgIGtleWdlbjogITAsCiAgICAgICAgICAgICAgICBsaW5rOiAhMCwKICAgICAgICAgICAgICAgIG1ldGE6ICEwLAogICAgICAgICAgICAgICAgcGFyYW06ICEwLAogICAgICAgICAgICAgICAgc291cmNlOiAhMCwKICAgICAgICAgICAgICAgIHRyYWNrOiAhMCwKICAgICAgICAgICAgICAgIHdicjogITAKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEogPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdGhpcy5pID0gYiA9PT0gRmIgPyBhIDogJyc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEoucHJvdG90eXBlLkIgPSAhMDsKICAgICAgICAgICAgSi5wcm90b3R5cGUuZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmkudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSi5wcm90b3R5cGUuaiA9ICEwOwogICAgICAgICAgICBKLnByb3RvdHlwZS5oID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBKYiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBhID0gR2IuZXhlYyhIYihhKS50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgIHZhciBjID0gYVszXSB8fCAnJzsKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgSihhWzFdICsgSWIoJz8nLCBhWzJdIHx8ICcnLCBiKSArIEliKCcjJywgYywgdm9pZCAwKSwgRmIpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBKLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmkgKyAnJzsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEhiID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSBpbnN0YW5jZW9mIEogJiYgYS5jb25zdHJ1Y3RvciA9PT0gSiA/IGEuaSA6ICd0eXBlX2Vycm9yOlRydXN0ZWRSZXNvdXJjZVVybCc7CiAgICAgICAgICAgICAgICB9LCBHYiA9IC9eKFtePyNdKikoXD9bXiNdKik/KCNbXHNcU10qKT8vLCBLYiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9ICcnLCBjID0gMDsgYyA8IGEubGVuZ3RoOyBjKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGIgKz0gQmIoYVtjXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBKKGIsIEZiKTsKICAgICAgICAgICAgICAgIH0sIEZiID0ge30sIEliID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PSBjKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgICAgICAgICBpZiAoJ3N0cmluZycgPT09IHR5cGVvZiBjKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyA/IGEgKyBlbmNvZGVVUklDb21wb25lbnQoYykgOiAnJzsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkIGluIGMpCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYywgZCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gY1tkXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBBcnJheS5pc0FycmF5KGUpID8gZSA6IFtlXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgPSAwOyBmIDwgZS5sZW5ndGg7IGYrKykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBoID0gZVtmXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsICE9IGggJiYgKGIgfHwgKGIgPSBhKSwgYiArPSAoYi5sZW5ndGggPiBhLmxlbmd0aCA/ICcmJyA6ICcnKSArIGVuY29kZVVSSUNvbXBvbmVudChkKSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudChTdHJpbmcoaCkpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEsgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgdGhpcy5pID0gYiA9PT0gTGIgPyBhIDogJyc7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEsucHJvdG90eXBlLkIgPSAhMDsKICAgICAgICAgICAgSy5wcm90b3R5cGUuZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmkudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgSy5wcm90b3R5cGUuaiA9ICEwOwogICAgICAgICAgICBLLnByb3RvdHlwZS5oID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEsucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaS50b1N0cmluZygpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgTWIgPSBSZWdFeHAoJ14oPzphdWRpby8oPzozZ3BwMnwzZ3BwfGFhY3xMMTZ8bWlkaXxtcDN8bXA0fG1wZWd8b2dhfG9nZ3xvcHVzfHgtbTRhfHgtbWF0cm9za2F8eC13YXZ8d2F2fHdlYm0pfGZvbnQvXFx3K3xpbWFnZS8oPzpibXB8Z2lmfGpwZWd8anBnfHBuZ3x0aWZmfHdlYnB8eC1pY29uKXx2aWRlby8oPzptcGVnfG1wNHxvZ2d8d2VibXxxdWlja3RpbWV8eC1tYXRyb3NrYSkpKD86O1xcdys9KD86XFx3K3wiW1xcdzssPSBdKyIpKSokJywgJ2knKSwgTmIgPSAvXmRhdGE6KC4qKTtiYXNlNjQsW2EtejAtOStcL10rPSokL2ksIE9iID0gL14oPzooPzpodHRwcz98bWFpbHRvfGZ0cCk6fFteOi8/I10qKD86Wy8/I118JCkpL2ksIExiID0ge30sIFBiID0gbmV3IEsoJ2Fib3V0OmludmFsaWQjekNsb3N1cmV6JywgTGIpOwogICAgICAgICAgICB2YXIgUWIgPSB7fSwgTCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pID0gYyA9PT0gUWIgPyBhIDogJyc7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gYjsKICAgICAgICAgICAgICAgICAgICB0aGlzLkIgPSB0aGlzLmogPSAhMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIEwucHJvdG90eXBlLmggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5sOwogICAgICAgICAgICB9OwogICAgICAgICAgICBMLnByb3RvdHlwZS5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaS50b1N0cmluZygpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBMLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmkudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFJiID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSBpbnN0YW5jZW9mIEwgJiYgYS5jb25zdHJ1Y3RvciA9PT0gTCA/IGEuaSA6ICd0eXBlX2Vycm9yOlNhZmVIdG1sJzsKICAgICAgICAgICAgICAgIH0sIFNiID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYSBpbnN0YW5jZW9mIEwpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgICAgIHZhciBiID0gJ29iamVjdCcgPT0gdHlwZW9mIGEsIGMgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIGIgJiYgYS5qICYmIChjID0gYS5oKCkpOwogICAgICAgICAgICAgICAgICAgIGEgPSBJYShiICYmIGEuQiA/IGEuZygpIDogU3RyaW5nKGEpKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwoYSwgYywgUWIpOwogICAgICAgICAgICAgICAgfSwgV2IgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0geyBzcmM6IGEgfSwgZCA9IHt9OwogICAgICAgICAgICAgICAgICAgIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlIGluIGMpCiAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChjLCBlKSAmJiAoYVtlXSA9IGNbZV0pOwogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGYgaW4gZCkKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGQsIGYpICYmIChhW2ZdID0gZFtmXSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGIpCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGggaW4gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYiwgaCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gaC50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIGluIGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlIGluIGQgJiYgZGVsZXRlIGFbZV07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtoXSA9IGJbaF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgdmFyIGc7CiAgICAgICAgICAgICAgICAgICAgYiA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgaCA9ICcnOwogICAgICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGsgaW4gYSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgaykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVRiLnRlc3QoaykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCcnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gYVtrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCBpbnN0YW5jZW9mIEFiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IEJiKGQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgnc3R5bGUnID09IGMudG9Mb3dlckNhc2UoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoL15vbi9pLnRlc3QoYykpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMudG9Mb3dlckNhc2UoKSBpbiBVYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZCBpbnN0YW5jZW9mIEopCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBIYihkKS50b1N0cmluZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKGQgaW5zdGFuY2VvZiBLKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gZCBpbnN0YW5jZW9mIEsgJiYgZC5jb25zdHJ1Y3RvciA9PT0gSyA/IGQuaSA6ICd0eXBlX2Vycm9yOlNhZmVVcmwnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKCdzdHJpbmcnID09PSB0eXBlb2YgZCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCBpbnN0YW5jZW9mIEsgfHwgKGQgPSAnb2JqZWN0JyA9PSB0eXBlb2YgZCAmJiBkLkIgPyBkLmcoKSA6IFN0cmluZyhkKSwgT2IudGVzdChkKSA/IGQgPSBuZXcgSyhkLCBMYikgOiAoZCA9IFN0cmluZyhkKSwgZCA9IGQucmVwbGFjZSgvKCUwQXwlMEQpL2csICcnKSwgZCA9IChlID0gZC5tYXRjaChOYikpICYmIE1iLnRlc3QoZVsxXSkgPyBuZXcgSyhkLCBMYikgOiBudWxsKSksIGQgPSAoZCB8fCBQYikuZygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQuQiAmJiAoZCA9IGQuZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMgKyAnPSInICsgSWEoU3RyaW5nKGQpKSArICciJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCArPSAnICcgKyBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB2YXIgayA9ICc8c2NyaXB0JyArIGg7CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSBnID8gZyA9IFtdIDogQXJyYXkuaXNBcnJheShnKSB8fCAoZyA9IFtnXSk7CiAgICAgICAgICAgICAgICAgICAgITAgPT09IEViLnNjcmlwdCA/IGsgKz0gJz4nIDogKGcgPSBWYihnKSwgayArPSAnPicgKyBSYihnKS50b1N0cmluZygpICsgJzwvc2NyaXB0PicsIGIgPSBnLmgoKSk7CiAgICAgICAgICAgICAgICAgICAgKGEgPSBhICYmIGEuZGlyKSAmJiAoL14obHRyfHJ0bHxhdXRvKSQvaS50ZXN0KGEpID8gYiA9IDAgOiBiID0gbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBMKGssIGIsIFFiKTsKICAgICAgICAgICAgICAgIH0sIFliID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IFNiKFhiKSwgYyA9IGIuaCgpLCBkID0gW10sIGUgPSBmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShmKSA/IGYuZm9yRWFjaChlKSA6IChmID0gU2IoZiksIGQucHVzaChSYihmKS50b1N0cmluZygpKSwgZiA9IGYuaCgpLCAwID09IGMgPyBjID0gZiA6IDAgIT0gZiAmJiBjICE9IGYgJiYgKGMgPSBudWxsKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYS5mb3JFYWNoKGUpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTChkLmpvaW4oUmIoYikudG9TdHJpbmcoKSksIGMsIFFiKTsKICAgICAgICAgICAgICAgIH0sIFZiID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gWWIoQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzKSk7CiAgICAgICAgICAgICAgICB9LCBUYiA9IC9eW2EtekEtWjAtOS1dKyQvLCBVYiA9IHsKICAgICAgICAgICAgICAgICAgICBhY3Rpb246ICEwLAogICAgICAgICAgICAgICAgICAgIGNpdGU6ICEwLAogICAgICAgICAgICAgICAgICAgIGRhdGE6ICEwLAogICAgICAgICAgICAgICAgICAgIGZvcm1hY3Rpb246ICEwLAogICAgICAgICAgICAgICAgICAgIGhyZWY6ICEwLAogICAgICAgICAgICAgICAgICAgIG1hbmlmZXN0OiAhMCwKICAgICAgICAgICAgICAgICAgICBwb3N0ZXI6ICEwLAogICAgICAgICAgICAgICAgICAgIHNyYzogITAKICAgICAgICAgICAgICAgIH0sIFhiID0gbmV3IEwoei50cnVzdGVkVHlwZXMgJiYgei50cnVzdGVkVHlwZXMuZW1wdHlIVE1MIHx8ICcnLCAwLCBRYik7CiAgICAgICAgICAgIHZhciBaYiA9IHt9OwogICAgICAgICAgICBmdW5jdGlvbiAkYigpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gJ3VuZGVmaW5lZCcgIT09IHR5cGVvZiB3aW5kb3cgPyB3aW5kb3cudHJ1c3RlZFR5cGVzIDogdm9pZCAwOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGEgJiYgdm9pZCAwICE9PSBhID8gYSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIGFjOwogICAgICAgICAgICBmdW5jdGlvbiBiYygpIHsKICAgICAgICAgICAgICAgIHZhciBhLCBiOwogICAgICAgICAgICAgICAgaWYgKHZvaWQgMCA9PT0gYWMpCiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgYWMgPSBudWxsICE9PSAoYiA9IG51bGwgPT09IChhID0gJGIoKSkgfHwgdm9pZCAwID09PSBhID8gdm9pZCAwIDogYS5jcmVhdGVQb2xpY3koJ2dvb2dsZSNzYWZlJywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlSFRNTDogZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVTY3JpcHQ6IGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlYXRlU2NyaXB0VVJMOiBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KSkgJiYgdm9pZCAwICE9PSBiID8gYiA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBhYyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGFjOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgdmFyIGNjID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgfSwgZGMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IGE7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2KGRjLCBjYyk7CiAgICAgICAgICAgIGRjLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmcudG9TdHJpbmcoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gZWMoYSkgewogICAgICAgICAgICAgICAgdmFyIGIsIGMgPSBudWxsID09PSAoYiA9IGJjKCkpIHx8IHZvaWQgMCA9PT0gYiA/IHZvaWQgMCA6IGIuY3JlYXRlU2NyaXB0VVJMKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBkYyhudWxsICE9PSBjICYmIHZvaWQgMCAhPT0gYyA/IGMgOiBhLCBaYik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICBmdW5jdGlvbiBmYyhhKSB7CiAgICAgICAgICAgICAgICBpZiAoYSBpbnN0YW5jZW9mIGNjKQogICAgICAgICAgICAgICAgICAgIGlmIChhIGluc3RhbmNlb2YgZGMpCiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLmc7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignJyk7CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgYSA9IEhiKGEpOwogICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICBmdW5jdGlvbiBnYyhhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiwgYyA9IChhLm93bmVyRG9jdW1lbnQgJiYgYS5vd25lckRvY3VtZW50LmRlZmF1bHRWaWV3IHx8IHdpbmRvdykuZG9jdW1lbnQsIGQgPSBudWxsID09PSAoYiA9IGMucXVlcnlTZWxlY3RvcikgfHwgdm9pZCAwID09PSBiID8gdm9pZCAwIDogYi5jYWxsKGMsICdzY3JpcHRbbm9uY2VdJyk7CiAgICAgICAgICAgICAgICAoYiA9IGQgPyBkLm5vbmNlIHx8IGQuZ2V0QXR0cmlidXRlKCdub25jZScpIHx8ICcnIDogJycpICYmIGEuc2V0QXR0cmlidXRlKCdub25jZScsIGIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgZnVuY3Rpb24gaGMoYSwgYikgewogICAgICAgICAgICAgICAgYS53cml0ZShSYihiKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgaWMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSAhMSwgYzsKICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYiB8fCAoYyA9IGEoKSwgYiA9ICEwKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBqYyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICBhLmFkZEV2ZW50TGlzdGVuZXIgJiYgYS5hZGRFdmVudExpc3RlbmVyKCdsb2FkJywgYiwgITEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbGMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHouZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhLnF1ZXJ5U2VsZWN0b3IgJiYgKGEgPSBhLnF1ZXJ5U2VsZWN0b3IoJ3NjcmlwdFtub25jZV0nKSkgJiYgKGEgPSBhLm5vbmNlIHx8IGEuZ2V0QXR0cmlidXRlKCdub25jZScpKSAmJiBrYy50ZXN0KGEpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICcnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgIH0sIGtjID0gL15bXHcrL18tXStbPV17MCwyfSQvOwogICAgICAgICAgICB2YXIgbWMgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gTmEoJ2lQYWQnKSB8fCBOYSgnQW5kcm9pZCcpICYmICFOYSgnTW9iaWxlJykgfHwgTmEoJ1NpbGsnKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIG5jID0gUmVnRXhwKCdeKD86KFteOi8/Iy5dKyk6KT8oPzovLyg/OihbXlxcXFwvPyNdKilAKT8oW15cXFxcLz8jXSo/KSg/OjooWzAtOV0rKSk/KD89W1xcXFwvPyNdfCQpKT8oW14/I10rKT8oPzpcXD8oW14jXSopKT8oPzojKFtcXHNcXFNdKikpPyQnKSwgb2MgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBhID8gZGVjb2RlVVJJKGEpIDogYTsKICAgICAgICAgICAgICAgIH0sIHBjID0gLyN8JC8sIHFjID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGEuc2VhcmNoKHBjKTsKICAgICAgICAgICAgICAgICAgICBhOiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZSA9IGIubGVuZ3RoOyAwIDw9IChkID0gYS5pbmRleE9mKGIsIGQpKSAmJiBkIDwgYzspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gYS5jaGFyQ29kZUF0KGQgLSAxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICgzOCA9PSBmIHx8IDYzID09IGYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYgPSBhLmNoYXJDb2RlQXQoZCArIGUpLCAhZiB8fCA2MSA9PSBmIHx8IDM4ID09IGYgfHwgMzUgPT0gZikKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQgKz0gZSArIDE7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZCA9IC0xOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoMCA+IGQpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgIGUgPSBhLmluZGV4T2YoJyYnLCBkKTsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA+IGUgfHwgZSA+IGMpCiAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBjOwogICAgICAgICAgICAgICAgICAgIGQgKz0gYi5sZW5ndGggKyAxOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkZWNvZGVVUklDb21wb25lbnQoYS5zdWJzdHIoZCwgZSAtIGQpLnJlcGxhY2UoL1wrL2csICcgJykpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIHVjID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIXJjKCkgJiYgIXNjKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBNYXRoLnJhbmRvbSgpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyA8IGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyA9IHRjKCksIGFbTWF0aC5mbG9vcihjICogYS5sZW5ndGgpXTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICB9LCB0YyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIW0uZ2xvYmFsVGhpcy5jcnlwdG8pCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBNYXRoLnJhbmRvbSgpOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IFVpbnQzMkFycmF5KDEpOwogICAgICAgICAgICAgICAgICAgICAgICBtLmdsb2JhbFRoaXMuY3J5cHRvLmdldFJhbmRvbVZhbHVlcyhhKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFbMF0gLyA2NTUzNiAvIDY1NTM2OwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE1hdGgucmFuZG9tKCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdmMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGlmIChhKQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjIGluIGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYSwgYykgJiYgYi5jYWxsKHZvaWQgMCwgYVtjXSwgYywgYSk7CiAgICAgICAgICAgICAgICB9LCB3YyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICBpZiAoMCA9PSBiKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gMzA1NDE5ODk2LCBkID0gMDsgZCA8IGI7IGQrKykKICAgICAgICAgICAgICAgICAgICAgICAgYyBePSAoYyA8PCA1KSArIChjID4+IDIpICsgYS5jaGFyQ29kZUF0KGQpICYgNDI5NDk2NzI5NTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMCA8IGMgPyBjIDogNDI5NDk2NzI5NiArIGM7CiAgICAgICAgICAgICAgICB9LCBzYyA9IGljKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXJyYXkucHJvdG90eXBlLnNvbWUuY2FsbChbCiAgICAgICAgICAgICAgICAgICAgICAgICdHb29nbGUgV2ViIFByZXZpZXcnLAogICAgICAgICAgICAgICAgICAgICAgICAnTWVkaWFwYXJ0bmVycy1Hb29nbGUnLAogICAgICAgICAgICAgICAgICAgICAgICAnR29vZ2xlLVJlYWQtQWxvdWQnLAogICAgICAgICAgICAgICAgICAgICAgICAnR29vZ2xlLUFkd29yZHMnCiAgICAgICAgICAgICAgICAgICAgXSwgeGMsIHZvaWQgMCkgfHwgMC4wMDAxID4gTWF0aC5yYW5kb20oKTsKICAgICAgICAgICAgICAgIH0pLCByYyA9IGljKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geGMoJ01TSUUnKTsKICAgICAgICAgICAgICAgIH0pLCB4YyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC0xICE9IE1hKCkuaW5kZXhPZihhKTsKICAgICAgICAgICAgICAgIH0sIHljID0gL14oLT9bMC05Ll17MSwzMH0pJC8sIHpjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4geWMudGVzdChhKSAmJiAoYSA9IE51bWJlcihhKSwgIWlzTmFOKGEpKSA/IGEgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgQWMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAvXnRydWUkLy50ZXN0KGEpOwogICAgICAgICAgICAgICAgfSwgQmMgPSBpYyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFtYygpICYmIChOYSgnaVBvZCcpIHx8IE5hKCdpUGhvbmUnKSB8fCBOYSgnQW5kcm9pZCcpIHx8IE5hKCdJRU1vYmlsZScpKSA/IDIgOiBtYygpID8gMSA6IDA7CiAgICAgICAgICAgICAgICB9KSwgQ2MgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSB2b2lkIDAgPT09IGEgPyAnJyA6IGE7CiAgICAgICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IHdpbmRvdyA6IGI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChiID0gb2MoYi5sb2NhdGlvbi5ocmVmLm1hdGNoKG5jKVszXSB8fCBudWxsKSkgPyB3YyhiICsgYSkgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgRWMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyB3aW5kb3cuZG9jdW1lbnQgOiBiOwogICAgICAgICAgICAgICAgICAgIDAgIT0gYS5sZW5ndGggJiYgYi5oZWFkICYmIGEuZm9yRWFjaChmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IHZvaWQgMCA9PT0gZCA/IHdpbmRvdy5kb2N1bWVudCA6IGQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyAmJiBkLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IERjKCdNRVRBJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5oZWFkLmFwcGVuZENoaWxkKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuaHR0cEVxdWl2ID0gJ29yaWdpbi10cmlhbCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5jb250ZW50ID0gYzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgRmMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGlmICgnbnVtYmVyJyAhPT0gdHlwZW9mIGEuZ29vZ19wdnNpZCkKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShhLCAnZ29vZ19wdnNpZCcsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogTWF0aC5wb3coMiwgNTIpKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICExCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE51bWJlcihhLmdvb2dfcHZzaWQpIHx8IC0xOwogICAgICAgICAgICAgICAgfSwgRGMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBkb2N1bWVudCA6IGI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIuY3JlYXRlRWxlbWVudChTdHJpbmcoYSkudG9Mb3dlckNhc2UoKSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgSGMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gJ2h0dHBzOi8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20vcGFnZWFkL2dlbl8yMDQ/aWQ9JyArIGI7CiAgICAgICAgICAgICAgICAgICAgdmMoYSwgZnVuY3Rpb24gKGQsIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZCAmJiAoYyArPSAnJicgKyBlICsgJz0nICsgZW5jb2RlVVJJQ29tcG9uZW50KGQpKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICBHYyhjKTsKICAgICAgICAgICAgICAgIH0sIEdjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHdpbmRvdzsKICAgICAgICAgICAgICAgICAgICBpZiAoYi5mZXRjaCkKICAgICAgICAgICAgICAgICAgICAgICAgYi5mZXRjaChhLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwYWxpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlZGVudGlhbHM6ICdpbmNsdWRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZGlyZWN0OiAnZm9sbG93JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ2dldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiAnbm8tY29ycycKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIuZ29vZ2xlX2ltYWdlX3JlcXVlc3RzIHx8IChiLmdvb2dsZV9pbWFnZV9yZXF1ZXN0cyA9IFtdKTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBEYygnSU1HJywgYi5kb2N1bWVudCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuc3JjID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5nb29nbGVfaW1hZ2VfcmVxdWVzdHMucHVzaChjKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBJYyhhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHcuYXBwbHkoMSwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgIGlmICgwID09PSBiLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZWMoYVswXSk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gW2FbMF1dLCBkID0gMDsgZCA8IGIubGVuZ3RoOyBkKyspCiAgICAgICAgICAgICAgICAgICAgYy5wdXNoKGVuY29kZVVSSUNvbXBvbmVudChiW2RdKSksIGMucHVzaChhW2QgKyAxXSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZWMoYy5qb2luKCcnKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgSmMgPSAnYScuY2hhckNvZGVBdCgpLCBLYyA9IERiKHsKICAgICAgICAgICAgICAgICAgICByYTogMCwKICAgICAgICAgICAgICAgICAgICBxYTogMSwKICAgICAgICAgICAgICAgICAgICBuYTogMiwKICAgICAgICAgICAgICAgICAgICBpYTogMywKICAgICAgICAgICAgICAgICAgICBvYTogNCwKICAgICAgICAgICAgICAgICAgICBqYTogNSwKICAgICAgICAgICAgICAgICAgICBwYTogNiwKICAgICAgICAgICAgICAgICAgICBsYTogNywKICAgICAgICAgICAgICAgICAgICBtYTogOCwKICAgICAgICAgICAgICAgICAgICBoYTogOSwKICAgICAgICAgICAgICAgICAgICBrYTogMTAKICAgICAgICAgICAgICAgIH0pLCBMYyA9IERiKHsKICAgICAgICAgICAgICAgICAgICB0YTogMCwKICAgICAgICAgICAgICAgICAgICB1YTogMSwKICAgICAgICAgICAgICAgICAgICBzYTogMgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciBNYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKC9bXjAxXS8udGVzdChhKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0lucHV0IGJpdHN0cmluZyAnICsgYSArICcgaXMgbWFsZm9ybWVkIScpOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gMDsKICAgICAgICAgICAgICAgIH0sIFBjID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IE0oYSwgMTYpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMCA9PT0gISFNKGEsIDEpID8gKGEgPSBOYyhhKSwgYS5mb3JFYWNoKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID4gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdJRCAnICsgYyArICcgaXMgcGFzdCBNYXhWZW5kb3JJZCAnICsgYiArICchJyk7CiAgICAgICAgICAgICAgICAgICAgfSksIGEpIDogT2MoYSwgYik7CiAgICAgICAgICAgICAgICB9LCBOYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYiA9IE0oYSwgMTIpLCBjID0gW107IGItLTspIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSAhMCA9PT0gISFNKGEsIDEpLCBlID0gTShhLCAxNik7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChkID0gTShhLCAxNik7IGUgPD0gZDsgZSsrKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYy5wdXNoKGUpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBjLnNvcnQoZnVuY3Rpb24gKGYsIGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGYgLSBoOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfSwgT2MgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGQgPSBbXSwgZSA9IDA7IGUgPCBiOyBlKyspCiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNKGEsIDEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGUgKyAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgJiYgLTEgPT09IGMuaW5kZXhPZihmKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcignSUQ6ICcgKyBmICsgJyBpcyBvdXRzaWRlIG9mIGFsbG93ZWQgdmFsdWVzIScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKGYpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICB9LCBNID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5nICsgYiA+IGEuaC5sZW5ndGgpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdSZXF1ZXN0ZWQgbGVuZ3RoICcgKyBiICsgJyBpcyBwYXN0IGVuZCBvZiBzdHJpbmcuJyk7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmguc3Vic3RyaW5nKGEuZywgYS5nICsgYik7CiAgICAgICAgICAgICAgICAgICAgYS5nICs9IGI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBhcnNlSW50KGMsIDIpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFJjID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IFhhKGEuc3BsaXQoJy4nKVswXSkubWFwKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChhYSA9IGUudG9TdHJpbmcoMiksIHAoYWEsICdwYWRTdGFydCcpKS5jYWxsKGFhLCA4LCAnMCcpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignJyksIGQgPSBuZXcgTWMoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSB7fTsKICAgICAgICAgICAgICAgICAgICAgICAgYy50Y1N0cmluZyA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuZ2RwckFwcGxpZXMgPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgZC5nICs9IDc4OwogICAgICAgICAgICAgICAgICAgICAgICBjLmNtcElkID0gTShkLCAxMik7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuY21wVmVyc2lvbiA9IE0oZCwgMTIpOwogICAgICAgICAgICAgICAgICAgICAgICBkLmcgKz0gMzA7CiAgICAgICAgICAgICAgICAgICAgICAgIGMudGNmUG9saWN5VmVyc2lvbiA9IE0oZCwgNik7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuaXNTZXJ2aWNlU3BlY2lmaWMgPSAhIU0oZCwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMudXNlTm9uU3RhbmRhcmRTdGFja3MgPSAhIU0oZCwgMSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMuc3BlY2lhbEZlYXR1cmVPcHRpbnMgPSBRYyhPYyhkLCAxMiwgTGMpLCBMYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIGMucHVycG9zZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRzOiBRYyhPYyhkLCAyNCwgS2MpLCBLYyksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlSW50ZXJlc3RzOiBRYyhPYyhkLCAyNCwgS2MpLCBLYykKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgYy5wdXJwb3NlT25lVHJlYXRtZW50ID0gISFNKGQsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICBjLnB1Ymxpc2hlckNDID0gU3RyaW5nLmZyb21DaGFyQ29kZShKYyArIE0oZCwgNikpICsgU3RyaW5nLmZyb21DaGFyQ29kZShKYyArIE0oZCwgNikpOwogICAgICAgICAgICAgICAgICAgICAgICBjLnZlbmRvciA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnRzOiBRYyhQYyhkKSwgYiksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWdpdGltYXRlSW50ZXJlc3RzOiBRYyhQYyhkKSwgYikKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBRYyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB7fTsKICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShiKSAmJiAwICE9PSBiLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgICAgICBiID0gdChiKTsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IGIubmV4dCgpOyAhZC5kb25lOyBkID0gYi5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0gZC52YWx1ZSwgY1tkXSA9IC0xICE9PSBhLmluZGV4T2YoZCk7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoYSA9IHQoYSksIGQgPSBhLm5leHQoKTsgIWQuZG9uZTsgZCA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgY1tkLnZhbHVlXSA9ICEwOwogICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBjWzBdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gU2MoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IHcuYXBwbHkoMCwgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS5hcHBseSh0aGlzLCBiKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgVGMgPSBTYyhmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBbXSwgYyA9IHt9OwogICAgICAgICAgICAgICAgYSA9IHQoYSk7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gYS5uZXh0KCk7ICFkLmRvbmU7IGMgPSB7IEM6IGMuQyB9LCBkID0gYS5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgYy5DID0gZC52YWx1ZSwgU2MoZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIucHVzaCgnW3siJyArIGUuQy5nYSArICciOicgKyB2YihlLkMubWVzc2FnZSkgKyAnfV0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB9KGMpKSgpOwogICAgICAgICAgICAgICAgcmV0dXJuICdbWycgKyBiLmpvaW4oJywnKSArICddXSc7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB2YXIgVWMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgaWYgKG0uZ2xvYmFsVGhpcy5mZXRjaCkKICAgICAgICAgICAgICAgICAgICBtLmdsb2JhbFRoaXMuZmV0Y2goYSwgewogICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJywKICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogYiwKICAgICAgICAgICAgICAgICAgICAgICAga2VlcGFsaXZlOiA2NTUzNiA+IGIubGVuZ3RoLAogICAgICAgICAgICAgICAgICAgICAgICBjcmVkZW50aWFsczogJ29taXQnLAogICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiAnbm8tY29ycycsCiAgICAgICAgICAgICAgICAgICAgICAgIHJlZGlyZWN0OiAnZm9sbG93JwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICBjLm9wZW4oJ1BPU1QnLCBhLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgYy5zZW5kKGIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBWYyhhKSB7CiAgICAgICAgICAgICAgICBhLmZhLmFwcGx5KGEsIHUody5hcHBseSgxLCBhcmd1bWVudHMpLm1hcChmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgIGdhOiA0LAogICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlOiBiCiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICB2YXIgV2MgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSB2b2lkIDAgPT09IGIgPyBVYyA6IGI7CiAgICAgICAgICAgICAgICB0aGlzLmkgPSB2b2lkIDAgPT09IGEgPyAxMDAwIDogYTsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IGI7CiAgICAgICAgICAgICAgICB0aGlzLmggPSBbXTsKICAgICAgICAgICAgICAgIHRoaXMuZyA9IG51bGw7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIFdjLnByb3RvdHlwZS5mYSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gdy5hcHBseSgwLCBhcmd1bWVudHMpLCBiID0gdGhpczsKICAgICAgICAgICAgICAgIFNjKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBiLmgucHVzaC5hcHBseShiLmgsIHUoYSkpOwogICAgICAgICAgICAgICAgICAgIHZhciBjID0gU2MoZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IFRjKGIuaCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGIuaignaHR0cHM6Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9wYWdlYWQvcGluZz9lPTEnLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgYi5oID0gW107CiAgICAgICAgICAgICAgICAgICAgICAgIGIuZyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgMTAwIDw9IGIuaC5sZW5ndGggPyAobnVsbCAhPT0gYi5nICYmIGNsZWFyVGltZW91dChiLmcpLCBiLmcgPSBzZXRUaW1lb3V0KGMsIDApKSA6IG51bGwgPT09IGIuZyAmJiAoYi5nID0gc2V0VGltZW91dChjLCBiLmkpKTsKICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBYYyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRlZmF1bHRWYWx1ZSA9ICExOwogICAgICAgICAgICAgICAgfSwgWWMgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IGE7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWZhdWx0VmFsdWUgPSAwOwogICAgICAgICAgICAgICAgfSwgWmMgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBbXSA6IGI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmRlZmF1bHRWYWx1ZSA9IGI7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgJGMgPSBuZXcgWGMoMzk5NTQ0NTQ4KSwgYWQgPSBuZXcgWWMoMjQpLCBiZCA9IG5ldyBaYygxOTM5KSwgY2QgPSBuZXcgWmMoMTkzNCwgWwogICAgICAgICAgICAgICAgICAgICdBOEZIUzFObWRDd0dxRDlEd09pY25ISFkreTI3a2RXZnhLYTBZSFNHRGZ2MENTcERLUkhUUWRRbVpWUERVZGFGV1VzeGRnVnhsd0FkNm8rZGhKeWtQQTBBQUFDV2V5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwyUnZkV0pzWldOc2FXTnJMbTVsZERvME5ETWlMQ0ptWldGMGRYSmxJam9pUTI5dWRtVnljMmx2YmsxbFlYTjFjbVZ0Wlc1MElpd2laWGh3YVhKNUlqb3hOalF6TVRVMU1UazVMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsTENKMWMyRm5aU0k2SW5OMVluTmxkQ0o5JywKICAgICAgICAgICAgICAgICAgICAnQTh6ZFhpNmRyMWh3WEVValFyWWl5WVFHbFUzNTU3eTVRV0RuTjBMd2dqOWVQdDY2WE1Fdk5rVldPRU9XUGQ3VFA5c0JRMjVYMFExNUxyMU5uNG9HRlFrQUFBQ2NleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMmR2YjJkc1pYTjVibVJwWTJGMGFXOXVMbU52YlRvME5ETWlMQ0ptWldGMGRYSmxJam9pUTI5dWRtVnljMmx2YmsxbFlYTjFjbVZ0Wlc1MElpd2laWGh3YVhKNUlqb3hOalF6TVRVMU1UazVMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsTENKMWMyRm5aU0k2SW5OMVluTmxkQ0o5JywKICAgICAgICAgICAgICAgICAgICAnQTQvSHRlcm4ydWROOXczeUpLOVFnV1F4UUZydXhPWHNYTDdjVzYwRHlDbDBFWkZHQ1NtZS9KMzNRL1d6RjdiQmtWdmhFV0RsY0JpVXlaYWltNUNwRlF3QUFBQ2NleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMmR2YjJkc1pYUmhaM05sY25acFkyVnpMbU52YlRvME5ETWlMQ0ptWldGMGRYSmxJam9pUTI5dWRtVnljMmx2YmsxbFlYTjFjbVZ0Wlc1MElpd2laWGh3YVhKNUlqb3hOalF6TVRVMU1UazVMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsTENKMWMyRm5aU0k2SW5OMVluTmxkQ0o5JwogICAgICAgICAgICAgICAgXSksIGRkID0gbmV3IFhjKDE5NTkpLCBlZCA9IG5ldyBYYygyMDMpLCBmZCA9IG5ldyBYYygxOTI4KSwgZ2QgPSBuZXcgWGMoMTk0MSksIGhkID0gbmV3IFhjKDM3MDk0NjM0OSksIGlkID0gbmV3IFhjKDM5MjczNjQ3NiksIGpkID0gbmV3IFljKDQwNjE0OTgzNSksIGtkID0gbmV3IFpjKDE5MzIsIFsKICAgICAgICAgICAgICAgICAgICAnQXh1aktHOUlOanNaOC9nVXE4K2RUcnVOdms3UmpaUTFvRmhoZ1FiY1RKS0RuWmZielNURTgxd3ZDMkh6YWYzVFc0YXZBNzZMVFpFTWRpZWRGMXZJYkE0QUFBQnVleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMmx0WVhOa2F5NW5iMjluYkdWaGNHbHpMbU52YlRvME5ETWlMQ0ptWldGMGRYSmxJam9pVkhKMWMzUlViMnRsYm5NaUxDSmxlSEJwY25raU9qRTJOVEkzTnpRME1EQXNJbWx6VkdocGNtUlFZWEowZVNJNmRISjFaWDA9JywKICAgICAgICAgICAgICAgICAgICAnQXp1Y2U4NU9SdFNuV2UxTVpEVHY2OHFwYVczaUh5Zkw5WWJMUnkwY3djQ1p3Vm5lUG5PbWtVSmxHOEhHaWttT3doWlUyMmRFbENjZnJmWDJIaHJCUEFrQUFBQjdleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMlJ2ZFdKc1pXTnNhV05yTG01bGREbzBORE1pTENKbVpXRjBkWEpsSWpvaVZISjFjM1JVYjJ0bGJuTWlMQ0psZUhCcGNua2lPakUyTlRJM056UTBNREFzSW1selUzVmlaRzl0WVdsdUlqcDBjblZsTENKcGMxUm9hWEprVUdGeWRIa2lPblJ5ZFdWOScsCiAgICAgICAgICAgICAgICAgICAgJ0ExNm52Y2Rlb09BcXJKY21qTFJwbDFJNmYzTWNERDhFZm9mQVlUdC9QL0g0L0FXd0I5OW54aVBwNmtBMGZYb2laYXY5MDhaOGV0dUwxNmxhRlBVZGZRc0FBQUNCZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJkdmIyZHNaWFJoWjNObGNuWnBZMlZ6TG1OdmJUbzBORE1pTENKbVpXRjBkWEpsSWpvaVZISjFjM1JVYjJ0bGJuTWlMQ0psZUhCcGNua2lPakUyTlRJM056UTBNREFzSW1selUzVmlaRzl0WVdsdUlqcDBjblZsTENKcGMxUm9hWEprVUdGeWRIa2lPblJ5ZFdWOScsCiAgICAgICAgICAgICAgICAgICAgJ0F4QkhkcjBKNDR2RkJRdFpVcVg5c2ppcWY1eVdaL09jSFJjUk1OM0g5VEgrdDkwVi9qM0VOVzZDOCtpZ0JaRlhNSjdHM1ByOERkMTM2MzJhTG5nNDJ3Z0FBQUNCZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJkdmIyZHNaWE41Ym1ScFkyRjBhVzl1TG1OdmJUbzBORE1pTENKbVpXRjBkWEpsSWpvaVZISjFjM1JVYjJ0bGJuTWlMQ0psZUhCcGNua2lPakUyTlRJM056UTBNREFzSW1selUzVmlaRzl0WVdsdUlqcDBjblZsTENKcGMxUm9hWEprVUdGeWRIa2lPblJ5ZFdWOScsCiAgICAgICAgICAgICAgICAgICAgJ0E4OEJXSEZqY2F3VWZLVTNsSWVqTG9yeVhveWpvb0JYTGdXbUdoK2hOY3FNSzQ0Y3VndnNJNVlaYk5hcll2aTNyb2MxZlliSEExQVZiaEF0dUhaZmxnRUFBQUIyZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJkdmIyZHNaUzVqYjIwNk5EUXpJaXdpWm1WaGRIVnlaU0k2SWxSeWRYTjBWRzlyWlc1eklpd2laWGh3YVhKNUlqb3hOalV5TnpjME5EQXdMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsZlE9PScKICAgICAgICAgICAgICAgIF0pLCBsZCA9IG5ldyBZYygxOTM1KTsKICAgICAgICAgICAgdmFyIG5kID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhLCAtMSwgbWQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KG5kLCBBKTsKICAgICAgICAgICAgdmFyIG1kID0gWzZdOwogICAgICAgICAgICB2YXIgcGQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBvZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYocGQsIEEpOwogICAgICAgICAgICB2YXIgcWQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KHFkLCBBKTsKICAgICAgICAgICAgdmFyIHJkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihyZCwgQSk7CiAgICAgICAgICAgIHZhciBvZCA9IFs3XTsKICAgICAgICAgICAgdmFyIHNkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHRoaXMuZyA9IGEgfHwgeyBjb29raWU6ICcnIH07CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHNkLnByb3RvdHlwZS5zZXQgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgdmFyIGQgPSAhMTsKICAgICAgICAgICAgICAgIGlmICgnb2JqZWN0JyA9PT0gdHlwZW9mIGMpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IGMueWE7CiAgICAgICAgICAgICAgICAgICAgZCA9IGMuemEgfHwgITE7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBjLmRvbWFpbiB8fCB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBjLnBhdGggfHwgdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIHZhciBnID0gYy5kYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgvWzs9XHNdLy50ZXN0KGEpKQogICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKCdJbnZhbGlkIGNvb2tpZSBuYW1lICInICsgYSArICciJyk7CiAgICAgICAgICAgICAgICBpZiAoL1s7XHJcbl0vLnRlc3QoYikpCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoJ0ludmFsaWQgY29va2llIHZhbHVlICInICsgYiArICciJyk7CiAgICAgICAgICAgICAgICB2b2lkIDAgPT09IGcgJiYgKGcgPSAtMSk7CiAgICAgICAgICAgICAgICB0aGlzLmcuY29va2llID0gYSArICc9JyArIGIgKyAoZiA/ICc7ZG9tYWluPScgKyBmIDogJycpICsgKGggPyAnO3BhdGg9JyArIGggOiAnJykgKyAoMCA+IGcgPyAnJyA6IDAgPT0gZyA/ICc7ZXhwaXJlcz0nICsgbmV3IERhdGUoMTk3MCwgMSwgMSkudG9VVENTdHJpbmcoKSA6ICc7ZXhwaXJlcz0nICsgbmV3IERhdGUoRGF0ZS5ub3coKSArIDEwMDAgKiBnKS50b1VUQ1N0cmluZygpKSArIChkID8gJztzZWN1cmUnIDogJycpICsgKG51bGwgIT0gZSA/ICc7c2FtZXNpdGU9JyArIGUgOiAnJyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHNkLnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IGEgKyAnPScsIGQgPSAodGhpcy5nLmNvb2tpZSB8fCAnJykuc3BsaXQoJzsnKSwgZSA9IDAsIGY7IGUgPCBkLmxlbmd0aDsgZSsrKSB7CiAgICAgICAgICAgICAgICAgICAgZiA9IEFhKGRbZV0pOwogICAgICAgICAgICAgICAgICAgIGlmICgwID09IGYubGFzdEluZGV4T2YoYywgMCkpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmLnN1YnN0cihjLmxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGYgPT0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHNkLnByb3RvdHlwZS5pc0VtcHR5ID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuICF0aGlzLmcuY29va2llOwogICAgICAgICAgICB9OwogICAgICAgICAgICBzZC5wcm90b3R5cGUuY2xlYXIgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBmb3IgKHZhciBhID0gKHRoaXMuZy5jb29raWUgfHwgJycpLnNwbGl0KCc7JyksIGIgPSBbXSwgYyA9IFtdLCBkLCBlLCBmID0gMDsgZiA8IGEubGVuZ3RoOyBmKyspCiAgICAgICAgICAgICAgICAgICAgZSA9IEFhKGFbZl0pLCBkID0gZS5pbmRleE9mKCc9JyksIC0xID09IGQgPyAoYi5wdXNoKCcnKSwgYy5wdXNoKGUpKSA6IChiLnB1c2goZS5zdWJzdHJpbmcoMCwgZCkpLCBjLnB1c2goZS5zdWJzdHJpbmcoZCArIDEpKSk7CiAgICAgICAgICAgICAgICBmb3IgKGEgPSBiLmxlbmd0aCAtIDE7IDAgPD0gYTsgYS0tKQogICAgICAgICAgICAgICAgICAgIGMgPSBiW2FdLCB0aGlzLmdldChjKSwgdGhpcy5zZXQoYywgJycsIHsKICAgICAgICAgICAgICAgICAgICAgICAgZGE6IDAsCiAgICAgICAgICAgICAgICAgICAgICAgIHBhdGg6IHZvaWQgMCwKICAgICAgICAgICAgICAgICAgICAgICAgZG9tYWluOiB2b2lkIDAKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gdGQoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIChhID0gdmQoYSkpID8gSChhLCBxZCwgNCkgOiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHZkKGEpIHsKICAgICAgICAgICAgICAgIGEgPSAoYSA9IG5ldyBzZChhKS5nZXQoJ0ZDQ0RDRicsICcnKSkgPyBhIDogbnVsbDsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBhID8gSlNPTi5wYXJzZShhKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIGhiID0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBuZXcgcGQoYik7CiAgICAgICAgICAgICAgICAgICAgICAgIGhiID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBjOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBkID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gZDsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciB3ZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gYTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmggPSBudWxsOwogICAgICAgICAgICAgICAgfSwgeWQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEuX190Y2ZhcGlQb3N0TWVzc2FnZVJlYWR5IHx8IHhkKG5ldyB3ZChhKSk7CiAgICAgICAgICAgICAgICB9LCB4ZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYS5oID0gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSAnc3RyaW5nJyA9PSB0eXBlb2YgYi5kYXRhOwogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBjID8gSlNPTi5wYXJzZShiLmRhdGEpIDogYi5kYXRhOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkLl9fdGNmYXBpQ2FsbDsKICAgICAgICAgICAgICAgICAgICAgICAgIWUgfHwgJ3BpbmcnICE9PSBlLmNvbW1hbmQgJiYgJ2dldFRDRGF0YScgIT09IGUuY29tbWFuZCAmJiAnYWRkRXZlbnRMaXN0ZW5lcicgIT09IGUuY29tbWFuZCAmJiAncmVtb3ZlRXZlbnRMaXN0ZW5lcicgIT09IGUuY29tbWFuZCB8fCBhLmcuX190Y2ZhcGkoZS5jb21tYW5kLCBlLnZlcnNpb24sIGZ1bmN0aW9uIChmLCBoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IHt9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZy5fX3RjZmFwaVJldHVybiA9ICdyZW1vdmVFdmVudExpc3RlbmVyJyA9PT0gZS5jb21tYW5kID8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IGYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbElkOiBlLmNhbGxJZAogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSA6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm5WYWx1ZTogZiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWNjZXNzOiBoLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxJZDogZS5jYWxsSWQKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmID0gYyA/IEpTT04uc3RyaW5naWZ5KGcpIDogZzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIuc291cmNlICYmICdmdW5jdGlvbicgPT09IHR5cGVvZiBiLnNvdXJjZS5wb3N0TWVzc2FnZSAmJiBiLnNvdXJjZS5wb3N0TWVzc2FnZShmLCBiLm9yaWdpbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgICAgICAgICAgfSwgZS5wYXJhbWV0ZXIpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYS5nLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCBhLmgpOwogICAgICAgICAgICAgICAgICAgIGEuZy5fX3RjZmFwaVBvc3RNZXNzYWdlUmVhZHkgPSAhMDsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB6ZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IGEuZG9jdW1lbnQsIGQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYS5mcmFtZXNbYl0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYy5ib2R5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBEYygnSUZSQU1FJywgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc3R5bGUud2lkdGggPSAnMHB4JzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnN0eWxlLmhlaWdodCA9ICcwcHgnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc3R5bGUuYm9yZGVyID0gJ25vbmUnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuc3R5bGUuekluZGV4ID0gJy0xMDAwJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlLnN0eWxlLmxlZnQgPSAnLTEwMDBweCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5zdHlsZS50b3AgPSAnLTEwMDBweCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5uYW1lID0gYjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmJvZHkuYXBwZW5kQ2hpbGQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLnNldFRpbWVvdXQoZCwgNSk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIGQoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEFkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IGEuZG9jdW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gKGEgPSAoYSA9IHZkKHRoaXMuaCkpID8gSChhLCByZCwgNSkgfHwgbnVsbCA6IG51bGwpID8gQihhLCAyKSA6IG51bGw7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gKGEgPSB0ZCh0aGlzLmgpKSAmJiBudWxsICE9IEIoYSwgMSkgPyBCKGEsIDEpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmkgPSAoYSA9IHRkKHRoaXMuaCkpICYmIG51bGwgIT0gQihhLCAyKSA/IEIoYSwgMikgOiBudWxsOwogICAgICAgICAgICAgICAgfSwgRGQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEuX191c3BhcGkgfHwgYS5mcmFtZXMuX191c3BhcGlMb2NhdG9yIHx8IChhID0gbmV3IEFkKGEpLCBCZChhKSwgQ2QoYSkpOwogICAgICAgICAgICAgICAgfSwgQmQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgICFhLmwgfHwgYS5nLl9fdXNwYXBpIHx8IGEuZy5mcmFtZXMuX191c3BhcGlMb2NhdG9yIHx8IChhLmcuX191c3BhcGlNYW5hZ2VyID0gJ2ZjJywgemQoYS5nLCAnX191c3BhcGlMb2NhdG9yJyksIHphKCdfX3VzcGFwaScsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEucy5hcHBseShhLCB1KHcuYXBwbHkoMCwgYXJndW1lbnRzKSkpOwogICAgICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIEFkLnByb3RvdHlwZS5zID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICdmdW5jdGlvbicgPT09IHR5cGVvZiBjICYmICdnZXRVU1BEYXRhJyA9PT0gYSAmJiBjKHsKICAgICAgICAgICAgICAgICAgICB2ZXJzaW9uOiAxLAogICAgICAgICAgICAgICAgICAgIHVzcFN0cmluZzogdGhpcy5sCiAgICAgICAgICAgICAgICB9LCAhMCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBDZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAhYS5qIHx8IGEuZy5fX3RjZmFwaSB8fCBhLmcuZnJhbWVzLl9fdGNmYXBpTG9jYXRvciB8fCAoYS5nLl9fdGNmYXBpTWFuYWdlciA9ICdmYycsIHpkKGEuZywgJ19fdGNmYXBpTG9jYXRvcicpLCBhLmcuX190Y2ZhcGlFdmVudExpc3RlbmVycyA9IGEuZy5fX3RjZmFwaUV2ZW50TGlzdGVuZXJzIHx8IFtdLCB6YSgnX190Y2ZhcGknLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuby5hcHBseShhLCB1KHcuYXBwbHkoMCwgYXJndW1lbnRzKSkpOwogICAgICAgICAgICAgICAgfSksIHlkKGEuZykpOwogICAgICAgICAgICB9OwogICAgICAgICAgICBBZC5wcm90b3R5cGUubyA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBkID0gdm9pZCAwID09PSBkID8gbnVsbCA6IGQ7CiAgICAgICAgICAgICAgICBpZiAoJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGMpCiAgICAgICAgICAgICAgICAgICAgaWYgKGIgJiYgMiAhPT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgYyhudWxsLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGIgPSB0aGlzLmcuX190Y2ZhcGlFdmVudExpc3RlbmVycywgYSkgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdnZXRUQ0RhdGEnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIWQgfHwgQXJyYXkuaXNBcnJheShkKSAmJiBkLmV2ZXJ5KGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdudW1iZXInID09PSB0eXBlb2YgZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pID8gYyhFZCh0aGlzLCBkLCBudWxsKSwgITApIDogYyhudWxsLCAhMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAncGluZyc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjKHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZHByQXBwbGllczogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wTG9hZGVkOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXBTdGF0dXM6ICdsb2FkZWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlTdGF0dXM6ICdkaXNhYmxlZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYXBpVmVyc2lvbjogJzIuMCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY21wVmVyc2lvbjogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXBJZDogMzAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdhZGRFdmVudExpc3RlbmVyJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBiLnB1c2goYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjKEVkKHRoaXMsIG51bGwsIGEgLSAxKSwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3JlbW92ZUV2ZW50TGlzdGVuZXInOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgYltkXSA/IChiW2RdID0gbnVsbCwgYyghMCkpIDogYyghMSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnZ2V0SW5BcHBUQ0RhdGEnOgogICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdnZXRWZW5kb3JMaXN0JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMobnVsbCwgITEpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBFZCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBpZiAoIWEuaikKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgIGIgPSBSYyhhLmosIGIpOwogICAgICAgICAgICAgICAgYi5hZGR0bENvbnNlbnQgPSBudWxsICE9IGEuaSA/IGEuaSA6IHZvaWQgMDsKICAgICAgICAgICAgICAgIGIuY21wU3RhdHVzID0gJ2xvYWRlZCc7CiAgICAgICAgICAgICAgICBiLmV2ZW50U3RhdHVzID0gJ3RjbG9hZGVkJzsKICAgICAgICAgICAgICAgIG51bGwgIT0gYyAmJiAoYi5saXN0ZW5lcklkID0gYyk7CiAgICAgICAgICAgICAgICByZXR1cm4gYjsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEdkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhLCAtMSwgRmQpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KEdkLCBBKTsKICAgICAgICAgICAgdmFyIEhkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcWIoYSwgMSwgYik7CiAgICAgICAgICAgICAgICB9LCBJZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRiKGEsIDIsIGIpOwogICAgICAgICAgICAgICAgfSwgSmQgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBvYihhLCA0LCBiKTsKICAgICAgICAgICAgICAgIH0sIEtkID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGIoYSwgNSwgYik7CiAgICAgICAgICAgICAgICB9LCBMZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEYoYSwgNiwgYik7CiAgICAgICAgICAgICAgICB9LCBNZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihNZCwgQSk7CiAgICAgICAgICAgIE1kLnByb3RvdHlwZS5BID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEQodGhpcywgMSwgMCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBOZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEYoYSwgMSwgYik7CiAgICAgICAgICAgICAgICB9LCBPZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEYoYSwgMiwgYik7CiAgICAgICAgICAgICAgICB9LCBQZCA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihQZCwgQSk7CiAgICAgICAgICAgIHZhciBGZCA9IFsKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgNQogICAgICAgICAgICAgICAgXSwgUWQgPSBbCiAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAyCiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICB2YXIgU2QgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBSZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYoU2QsIEEpOwogICAgICAgICAgICB2YXIgVWQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBUZCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYoVWQsIEEpOwogICAgICAgICAgICB2YXIgUmQgPSBbCiAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICBdLCBUZCA9IFs1XSwgVmQgPSBbCiAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgNAogICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgdmFyIFdkID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihXZCwgQSk7CiAgICAgICAgICAgIFdkLnByb3RvdHlwZS5nZXRUYWdTZXNzaW9uQ29ycmVsYXRvciA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBEKHRoaXMsIDIsIDApOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWGQgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IFdkKCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNiKGIsIDQsIGEpOwogICAgICAgICAgICAgICAgfSwgcmIgPSBbCiAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICA1LAogICAgICAgICAgICAgICAgICAgIDcKICAgICAgICAgICAgICAgIF07CiAgICAgICAgICAgIHZhciBZZCA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYyA9IHZvaWQgMCA9PT0gYyA/IHt9IDogYzsKICAgICAgICAgICAgICAgIHRoaXMuZXJyb3IgPSBhOwogICAgICAgICAgICAgICAgdGhpcy5jb250ZXh0ID0gYi5jb250ZXh0OwogICAgICAgICAgICAgICAgdGhpcy5tc2cgPSBiLm1lc3NhZ2UgfHwgJyc7CiAgICAgICAgICAgICAgICB0aGlzLmlkID0gYi5pZCB8fCAnanNlcnJvcic7CiAgICAgICAgICAgICAgICB0aGlzLm1ldGEgPSBjOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWmQgPSBudWxsLCAkZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCA9PT0gWmQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgWmQgPSAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBhID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB6LnRvcC5sb2NhdGlvbi5oYXNoOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB6LmxvY2F0aW9uLmhhc2g7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gYS5tYXRjaCgvXGJkZWlkPShbXGQsXSspLyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWmQgPSBiID8gYlsxXSA6ICcnOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFpkOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGJlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhLCAtMSwgYWUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KGJlLCBBKTsKICAgICAgICAgICAgdmFyIGFlID0gWwogICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgOAogICAgICAgICAgICAgICAgXSwgY2UgPSBbCiAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgIF0sIGRlID0gWwogICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgNwogICAgICAgICAgICAgICAgXTsKICAgICAgICAgICAgdmFyIGVlOwogICAgICAgICAgICBlZSA9IHsKICAgICAgICAgICAgICAgIHZhOiAwLAogICAgICAgICAgICAgICAgYWE6IDMsCiAgICAgICAgICAgICAgICBiYTogNCwKICAgICAgICAgICAgICAgIGNhOiA1CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBmZSA9IGVlLmFhLCBOID0gZWUuYmEsIGdlID0gZWUuY2EsIGhlID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBhID8gIWEgOiBhOwogICAgICAgICAgICAgICAgfSwgaWUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAhMSwgZCA9IDA7IGQgPCBhLmxlbmd0aDsgZCsrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYVtkXSgpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSA9PT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICBudWxsID09IGUgJiYgKGMgPSAhMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICghYykKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFiOwogICAgICAgICAgICAgICAgfSwga2UgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gSShhLCBiZSwgMik7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFjLmxlbmd0aCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGplKGEsIGIpOwogICAgICAgICAgICAgICAgICAgIGEgPSBEKGEsIDEsIDApOwogICAgICAgICAgICAgICAgICAgIGlmICgxID09PSBhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaGUoa2UoY1swXSwgYikpOwogICAgICAgICAgICAgICAgICAgIGMgPSBRYShjLCBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGtlKGQsIGIpOwogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYSkgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGllKGMsICExKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpZShjLCAhMCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgamUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gRyhhLCBjZSk7CiAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBmZToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0geGIoYSwgMywgY2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBOOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IHhiKGEsIDQsIGNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZ2U6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkID0geGIoYSwgNSwgY2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBkID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoZCAmJiAoYiA9IChiID0gYltjXSkgJiYgYltkXSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYi5hcHBseShudWxsLCB1KGxiKGEsIDgpKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBiID0gRChhLCAxLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDQgPT09IGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISFlOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gbnVsbCAhPSBlOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoNSA9PT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoMTIgPT09IGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gd2IoYSwgNyA9PT0gRyhhLCBkZSkgPyA3IDogLTEsIHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE46CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBuYihhLCA2ID09PSBHKGEsIGRlKSA/IDYgOiAtMSwgdm9pZCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGdlOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhID0gd2IoYSwgNyA9PT0gRyhhLCBkZSkgPyA3IDogLTEsIHZvaWQgMCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChudWxsICE9IGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICg2ID09PSBiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlID09PSBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDkgPT09IGIpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiAwID09PSBMYShTdHJpbmcoZSksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGQpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA3OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA8IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSA4OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSA+IGE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdzdHJpbmcnID09PSB0eXBlb2YgYSAmJiAnc3RyaW5nJyA9PT0gdHlwZW9mIGUgJiYgbmV3IFJlZ0V4cChhKS50ZXN0KGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMTA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGUgJiYgLTEgPT09IExhKFN0cmluZyhlKSwgYSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAxMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gZSAmJiAxID09PSBMYShTdHJpbmcoZSksIGEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIGxlID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gIWEgfHwgISghYiB8fCAha2UoYSwgYikpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIG5lID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIEEuY2FsbCh0aGlzLCBhLCAtMSwgbWUpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KG5lLCBBKTsKICAgICAgICAgICAgdmFyIG1lID0gWzRdOwogICAgICAgICAgICB2YXIgb2UgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEpOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KG9lLCBBKTsKICAgICAgICAgICAgdmFyIE8gPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBwZSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYoTywgQSk7CiAgICAgICAgICAgIHZhciBwZSA9IFs1XSwgcWUgPSBbCiAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICA3CiAgICAgICAgICAgICAgICBdOwogICAgICAgICAgICB2YXIgcmUgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gdm9pZCAwID09PSBkID8gbmV3IFdjKGIpIDogZDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmggPSBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMubCA9IGM7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gZDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBbXTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmkgPSAwIDwgdGhpcy5oICYmIHRjKCkgPCAxIC8gdGhpcy5oOwogICAgICAgICAgICAgICAgfSwgdGUgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSwgZikgewogICAgICAgICAgICAgICAgICAgIHZhciBoID0gT2QoTmQobmV3IE1kKCksIGIpLCBjKTsKICAgICAgICAgICAgICAgICAgICBiID0gTGQoSWQoSGQoS2QoSmQobmV3IEdkKCksIGQpLCBlKSwgaCksIGEuZyksIGYpOwogICAgICAgICAgICAgICAgICAgIGIgPSBYZChiKTsKICAgICAgICAgICAgICAgICAgICBhLmkgJiYgVmMoYS5qLCBzZShhLCBiKSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKDEgPT09IGYgfHwgMyA9PT0gZiB8fCA0ID09PSBmICYmICFhLmcuc29tZShmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGcuQSgpID09PSBoLkEoKSAmJiBEKGcsIDIsIDApID09PSBjOwogICAgICAgICAgICAgICAgICAgICAgICB9KSkKICAgICAgICAgICAgICAgICAgICAgICAgYS5nLnB1c2goaCksIDEwMCA8IGEuZy5sZW5ndGggJiYgYS5nLnNoaWZ0KCk7CiAgICAgICAgICAgICAgICB9LCB1ZSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEubCkgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyBTZCgpOwogICAgICAgICAgICAgICAgICAgICAgICBiID0gdGIoZSwgMiwgYik7CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSB0YihiLCAzLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgZCAmJiBGKGMsIDEsIGQpOwogICAgICAgICAgICAgICAgICAgICAgICBkID0gbmV3IFdkKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQgPSBzYihkLCA3LCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgYS5pICYmIFZjKGEuaiwgc2UoYSwgZCkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIHNlID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBiID0gRihiLCAxLCBEYXRlLm5vdygpKTsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IEZjKHdpbmRvdyk7CiAgICAgICAgICAgICAgICAgICAgYiA9IEYoYiwgMiwgYyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEYoYiwgNiwgYS5oKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBQID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gJ0onOwogICAgICAgICAgICAgICAgaWYgKGEuSiAmJiBhLmhhc093blByb3BlcnR5KGIpKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBhLko7CiAgICAgICAgICAgICAgICBiID0gbmV3IGEoKTsKICAgICAgICAgICAgICAgIHJldHVybiBhLkogPSBiOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgdmUgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgdGhpcy5nID0gKGFbZmVdID0ge30sIGFbTl0gPSB7fSwgYVtnZV0gPSB7fSwgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB3ZSA9IEFjKCdmYWxzZScpOwogICAgICAgICAgICB2YXIgeGUgPSB3ZSwgeWUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHhiKGEsIDEsIHFlKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4YihhLCAyLCBxZSk7CiAgICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geGIoYSwgMywgcWUpOwogICAgICAgICAgICAgICAgICAgIGNhc2UgNjoKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHhiKGEsIDYsIHFlKTsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCB6ZSA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFhKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGIpIHsKICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtYihhLCAxKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDc6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3YihhLCAzKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuYihhLCAyKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3YihhLCAzKTsKICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBsYihhLCA0KTsKICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBBZSA9IGljKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIXhlKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge307CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB3aW5kb3cuc2Vzc2lvblN0b3JhZ2UgJiYgd2luZG93LnNlc3Npb25TdG9yYWdlLmdldEl0ZW0oJ0dHREZTU0snKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5wYXJzZShhKTsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChiKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiB7fTsKICAgICAgICAgICAgICAgIH0pLCBEZSA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBkID0gdm9pZCAwID09PSBkID8gMCA6IGQsIGYsIGg7CiAgICAgICAgICAgICAgICAgICAgUChRKS5qW2VdID0gbnVsbCAhPSAoaCA9IG51bGwgPT0gKGYgPSBQKFEpLmpbZV0pID8gdm9pZCAwIDogZi5hZGQoYikpID8gaCA6IG5ldyBtLlNldCgpLmFkZChiKTsKICAgICAgICAgICAgICAgICAgICBlID0gQWUoKTsKICAgICAgICAgICAgICAgICAgICBpZiAobnVsbCAhPSBlW2JdKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZVtiXTsKICAgICAgICAgICAgICAgICAgICBiID0gQmUoZClbYl07CiAgICAgICAgICAgICAgICAgICAgaWYgKCFiKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYzsKICAgICAgICAgICAgICAgICAgICBiID0gbmV3IE8oYik7CiAgICAgICAgICAgICAgICAgICAgYiA9IENlKGIpOwogICAgICAgICAgICAgICAgICAgIGEgPSB6ZShiLCBhKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCAhPSBhID8gYSA6IGM7CiAgICAgICAgICAgICAgICB9LCBDZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBQKHZlKS5nOwogICAgICAgICAgICAgICAgICAgIGlmIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gU2EoSShhLCBvZSwgNSksIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGUoSChkLCBiZSwgMSksIGIpOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSChjLCBuZSwgMik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHJldHVybiBIKGEsIG5lLCA0KTsKICAgICAgICAgICAgICAgIH0sIFEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oID0ge307CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pID0gW107CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0ge307CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gbmV3IG0uTWFwKCk7CiAgICAgICAgICAgICAgICB9LCBFZSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEhRGUoMSwgYSwgdm9pZCAwID09PSBiID8gITEgOiBiLCBjKTsKICAgICAgICAgICAgICAgIH0sIEZlID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gMCA6IGI7CiAgICAgICAgICAgICAgICAgICAgYSA9IE51bWJlcihEZSgyLCBhLCBiLCBjKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGlzTmFOKGEpID8gYiA6IGE7CiAgICAgICAgICAgICAgICB9LCBHZSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIERlKDMsIGEsIHZvaWQgMCA9PT0gYiA/ICcnIDogYiwgYyk7CiAgICAgICAgICAgICAgICB9LCBIZSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYiA9IHZvaWQgMCA9PT0gYiA/IFtdIDogYjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gRGUoNiwgYSwgYiwgYyk7CiAgICAgICAgICAgICAgICB9LCBCZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFAoUSkuaFthXSB8fCAoUChRKS5oW2FdID0ge30pOwogICAgICAgICAgICAgICAgfSwgSWUgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gQmUoYik7CiAgICAgICAgICAgICAgICAgICAgdmMoYSwgZnVuY3Rpb24gKGQsIGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGNbZV0gPSBkOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgSmUgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgICAgIGUgPSB2b2lkIDAgPT09IGUgPyAhMSA6IGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBbXSwgaCA9IFtdOwogICAgICAgICAgICAgICAgICAgIE9hKGIsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBrID0gQmUoZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIE9hKGEsIGZ1bmN0aW9uIChsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbiA9IEcobCwgcWUpLCBxID0geWUobCwgbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciB5LCBpYiwgdWQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGpiID0gbnVsbCAhPSAodWQgPSBudWxsID09ICh5ID0gUChRKS5nLmdldChnKSkgPyB2b2lkIDAgOiBudWxsID09IChpYiA9IHkuZ2V0KHEpKSA/IHZvaWQgMCA6IGliLnNsaWNlKDApKSA/IHVkIDogW107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5ID0gbmV3IFVkKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYih5LCAxLCBWZCwgcSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGIoeSwgMiwgVmQsIHEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBiKHksIDMsIFZkLCBxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDY6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYih5LCA0LCBWZCwgcSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB2b2lkIDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBhOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iKHksIDUsIGpiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChqYiA9IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEphOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqYiA9ICEobnVsbCA9PSAoSmEgPSBQKFEpLmpbZ10pIHx8ICFKYS5oYXMocSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqYiAmJiBmLnB1c2gobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEphID0gbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEphID0gIShudWxsID09IChmYSA9IFAoUSkuZy5nZXQoZykpIHx8ICFmYS5oYXMocSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBKYSAmJiBoLnB1c2gobik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSB8fCAoZmEgPSBQKFEpLCBmYS5nLmhhcyhnKSB8fCBmYS5nLnNldChnLCBuZXcgbS5NYXAoKSksIGZhLmcuZ2V0KGcpLmhhcyhxKSB8fCBmYS5nLmdldChnKS5zZXQocSwgW10pLCBkICYmIGZhLmcuZ2V0KGcpLmdldChxKS5wdXNoKGQpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrW3FdID0gbC50b0pTT04oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgKGYubGVuZ3RoIHx8IGgubGVuZ3RoKSAmJiB1ZShjLCBmLCBoLCBudWxsICE9IGQgPyBkIDogdm9pZCAwKTsKICAgICAgICAgICAgICAgIH0sIEtlID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IEJlKGIpOwogICAgICAgICAgICAgICAgICAgIE9hKGEsIGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gbmV3IE8oZCksIGYgPSBHKGUsIHFlKTsKICAgICAgICAgICAgICAgICAgICAgICAgKGUgPSB5ZShlLCBmKSkgJiYgKGNbZV0gfHwgKGNbZV0gPSBkKSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBMZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gUWEocChPYmplY3QsICdrZXlzJykuY2FsbChPYmplY3QsIFAoUSkuaCksIGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOdW1iZXIoYSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBNZSA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgVGEoUChRKS5pLCBhKSB8fCBJZShCZSg0KSwgYSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgUiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5tZXRob2ROYW1lID0gYTsKICAgICAgICAgICAgICAgIH0sIE5lID0gbmV3IFIoMSksIE9lID0gbmV3IFIoMTYpLCBQZSA9IG5ldyBSKDE1KSwgUWUgPSBuZXcgUigyKSwgUmUgPSBuZXcgUigzKSwgU2UgPSBuZXcgUig0KSwgVGUgPSBuZXcgUig1KSwgVWUgPSBuZXcgUig2KSwgVmUgPSBuZXcgUig3KSwgV2UgPSBuZXcgUig4KSwgWGUgPSBuZXcgUig5KSwgWWUgPSBuZXcgUigxMCksIFplID0gbmV3IFIoMTEpLCAkZSA9IG5ldyBSKDEyKSwgYWYgPSBuZXcgUigxMyksIGJmID0gbmV3IFIoMTQpLCBTID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBjLmhhc093blByb3BlcnR5KGEubWV0aG9kTmFtZSkgfHwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGMsIFN0cmluZyhhLm1ldGhvZE5hbWUpLCB7IHZhbHVlOiBiIH0pOwogICAgICAgICAgICAgICAgfSwgVCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJbYS5tZXRob2ROYW1lXSB8fCBjIHx8IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgY2YgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIFMoVGUsIEVlLCBhKTsKICAgICAgICAgICAgICAgICAgICBTKFVlLCBGZSwgYSk7CiAgICAgICAgICAgICAgICAgICAgUyhWZSwgR2UsIGEpOwogICAgICAgICAgICAgICAgICAgIFMoV2UsIEhlLCBhKTsKICAgICAgICAgICAgICAgICAgICBTKGFmLCBLZSwgYSk7CiAgICAgICAgICAgICAgICAgICAgUyhQZSwgTWUsIGEpOwogICAgICAgICAgICAgICAgfSwgZGYgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIFMoU2UsIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFAodmUpLmcgPSBiOwogICAgICAgICAgICAgICAgICAgIH0sIGEpOwogICAgICAgICAgICAgICAgICAgIFMoWGUsIGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gUCh2ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQuZ1tmZV1bYl0gfHwgKGQuZ1tmZV1bYl0gPSBjKTsKICAgICAgICAgICAgICAgICAgICB9LCBhKTsKICAgICAgICAgICAgICAgICAgICBTKFllLCBmdW5jdGlvbiAoYiwgYykgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IFAodmUpOwogICAgICAgICAgICAgICAgICAgICAgICBkLmdbTl1bYl0gfHwgKGQuZ1tOXVtiXSA9IGMpOwogICAgICAgICAgICAgICAgICAgIH0sIGEpOwogICAgICAgICAgICAgICAgICAgIFMoWmUsIGZ1bmN0aW9uIChiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gUCh2ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGQuZ1tnZV1bYl0gfHwgKGQuZ1tnZV1bYl0gPSBjKTsKICAgICAgICAgICAgICAgICAgICB9LCBhKTsKICAgICAgICAgICAgICAgICAgICBTKGJmLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gUCh2ZSksIGQgPSB0KFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIGUgPSBkLm5leHQoKTsgIWUuZG9uZTsgZSA9IGQubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUudmFsdWUsIHAoT2JqZWN0LCAnYXNzaWduJykuY2FsbChPYmplY3QsIGMuZ1tlXSwgYltlXSk7CiAgICAgICAgICAgICAgICAgICAgfSwgYSk7CiAgICAgICAgICAgICAgICB9LCBlZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgYS5oYXNPd25Qcm9wZXJ0eSgnaW5pdC1kb25lJykgfHwgT2JqZWN0LmRlZmluZVByb3BlcnR5KGEsICdpbml0LWRvbmUnLCB7IHZhbHVlOiAhMCB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBmZiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICB0aGlzLmggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfSwgZ2YgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIGEuZyA9IGZ1bmN0aW9uIChkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIFQoUWUsIGIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBbXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkoZCwgYyk7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBhLmggPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKFJlLCBiLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKGMpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgaGYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gYS5zcGxpdCgnLicpOwogICAgICAgICAgICAgICAgICAgICAgICBhID0gejsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgZCA9IDAsIGU7IG51bGwgIT0gYSAmJiBkIDwgYy5sZW5ndGg7IGQrKykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUgPSBhLCBhID0gYVtjW2RdXSwgJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGEgJiYgKGEgPSBlW2NbZF1dKCkpOwogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZiA9PT0gYikKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGgpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBqZiA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgIHRoaXNbZmVdID0gKGFbOF0gPSBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gdmEoYik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGFbOV0gPSBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSB2YShiKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiID0gJ2Z1bmN0aW9uJyA9PT0gdHlwZW9mIGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjID0gYyAmJiBjLnRvU3RyaW5nICYmIGMudG9TdHJpbmcoKSwgYiA9ICdzdHJpbmcnID09PSB0eXBlb2YgYyAmJiAtMSAhPSBjLmluZGV4T2YoJ1tuYXRpdmUgY29kZV0nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgfSwgYVsxMF0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cgPT0gd2luZG93LnRvcDsKICAgICAgICAgICAgICAgICAgICB9LCBhWzZdID0gZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFRhKFAoZmYpLmgoKSwgcGFyc2VJbnQoYiwgMTApKTsKICAgICAgICAgICAgICAgICAgICB9LCBhWzI3XSA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBoZihiLCAnYm9vbGVhbicpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBiID8gYiA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9LCBhWzYwXSA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gISF6LmRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoYik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0sIGEpOwogICAgICAgICAgICAgICAgICAgIGEgPSB7fTsKICAgICAgICAgICAgICAgICAgICB0aGlzW05dID0gKGFbM10gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBCYygpOwogICAgICAgICAgICAgICAgICAgIH0sIGFbNl0gPSBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICBiID0gaGYoYiwgJ251bWJlcicpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCAwICE9PSBiID8gYiA6IHZvaWQgMDsKICAgICAgICAgICAgICAgICAgICB9LCBhWzExXSA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBDYyh2b2lkIDAgPT09IGIgPyAnJyA6IGIsIHopOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBiID8gdm9pZCAwIDogYiAlIDEwMDA7CiAgICAgICAgICAgICAgICAgICAgfSwgYSk7CiAgICAgICAgICAgICAgICAgICAgYSA9IHt9OwogICAgICAgICAgICAgICAgICAgIHRoaXNbZ2VdID0gKGFbMl0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cubG9jYXRpb24uaHJlZjsKICAgICAgICAgICAgICAgICAgICB9LCBhWzNdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy50b3AubG9jYXRpb24uaGFzaDsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSwgYVs0XSA9IGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBoZihiLCAnc3RyaW5nJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB2b2lkIDAgIT09IGIgPyBiIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgIH0sIGEpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGtmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB2b2lkIDAgPT09IGEgPyB6IDogYTsKICAgICAgICAgICAgICAgIHJldHVybiBhLmdnZWFjIHx8IChhLmdnZWFjID0ge30pOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbWYgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBsZik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYobWYsIEEpOwogICAgICAgICAgICBtZi5wcm90b3R5cGUuZ2V0SWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gRCh0aGlzLCAxLCAwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgbWYucHJvdG90eXBlLkEgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gRCh0aGlzLCA3LCAwKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGxmID0gWzJdOwogICAgICAgICAgICB2YXIgb2YgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgQS5jYWxsKHRoaXMsIGEsIC0xLCBuZik7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYob2YsIEEpOwogICAgICAgICAgICBvZi5wcm90b3R5cGUuQSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHJldHVybiBEKHRoaXMsIDUsIDApOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgbmYgPSBbMl07CiAgICAgICAgICAgIHZhciBxZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBBLmNhbGwodGhpcywgYSwgLTEsIHBmKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihxZiwgQSk7CiAgICAgICAgICAgIHZhciBzZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBBLmNhbGwodGhpcywgYSwgLTEsIHJmKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihzZiwgQSk7CiAgICAgICAgICAgIHNmLnByb3RvdHlwZS5BID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEQodGhpcywgMSwgMCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciB0ZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBBLmNhbGwodGhpcywgYSk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHYodGYsIEEpOwogICAgICAgICAgICB2YXIgcGYgPSBbCiAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgXSwgcmYgPSBbMl07CiAgICAgICAgICAgIHZhciB1ZiA9IFsKICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAxMywKICAgICAgICAgICAgICAgICAgICAyMAogICAgICAgICAgICAgICAgXSwgdmYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB9LCB3ZiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgZSA9IHZvaWQgMCA9PT0gZSA/IHt9IDogZTsKICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IHZvaWQgMCA9PT0gZS5aID8gITEgOiBlLlosIGggPSB2b2lkIDAgPT09IGUuZWEgPyB7fSA6IGUuZWE7CiAgICAgICAgICAgICAgICAgICAgZSA9IHZvaWQgMCA9PT0gZS4kID8gW10gOiBlLiQ7CiAgICAgICAgICAgICAgICAgICAgYS5pID0gYjsKICAgICAgICAgICAgICAgICAgICBhLm8gPSB7fTsKICAgICAgICAgICAgICAgICAgICBhLnMgPSBmOwogICAgICAgICAgICAgICAgICAgIGEubCA9IGg7CiAgICAgICAgICAgICAgICAgICAgYiA9IHt9OwogICAgICAgICAgICAgICAgICAgIGEuaCA9IChiW2NdID0gW10sIGJbNF0gPSBbXSwgYik7CiAgICAgICAgICAgICAgICAgICAgYS5qID0ge307CiAgICAgICAgICAgICAgICAgICAgKGMgPSAkZCgpKSAmJiBPYShjLnNwbGl0KCcsJykgfHwgW10sIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIChnID0gcGFyc2VJbnQoZywgMTApKSAmJiAoYS5qW2ddID0gITApOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIE9hKGUsIGZ1bmN0aW9uIChnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEualtnXSA9ICEwOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGEuZyA9IGQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGE7CiAgICAgICAgICAgICAgICB9LCBBZiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBbXSwgZSA9IHhmKGEuaSwgYiksIGY7CiAgICAgICAgICAgICAgICAgICAgaWYgKGYgPSA5ICE9PSBiKQogICAgICAgICAgICAgICAgICAgICAgICBhLm9bYl0gPyBmID0gITAgOiAoYS5vW2JdID0gITAsIGYgPSAhMSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGg7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT0gKGggPSBhLmcpIHx8IHRlKGgsIGIsIGMsIGQsIFtdLCA0KTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmICghZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGc7CiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwgPT0gKGcgPSBhLmcpIHx8IHRlKGcsIGIsIGMsIGQsIFtdLCAzKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIHZhciBrID0gVGEodWYsIGIpLCBsID0gW107CiAgICAgICAgICAgICAgICAgICAgT2EoZSwgZnVuY3Rpb24gKHEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHkgPSBuZXcgUGQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHEgPSB5ZihhLCBxLCBjLCB5KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgIT09IEcoeSwgUWQpICYmIGwucHVzaCh5KSwgeSA9IHEuZ2V0SWQoKSwgZC5wdXNoKHkpLCB6ZihhLCB5LCBrID8gNCA6IGMpLCAocSA9IEkocSwgTywgMikpICYmIChrID8gSmUocSwgTGUoKSwgYS5nLCB5KSA6IEplKHEsIFtjXSwgYS5nLCB5KSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgdmFyIG47CiAgICAgICAgICAgICAgICAgICAgbnVsbCA9PSAobiA9IGEuZykgfHwgdGUobiwgYiwgYywgZCwgbCwgMSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGQ7CiAgICAgICAgICAgICAgICB9LCB6ZiA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYS5oW2NdIHx8IChhLmhbY10gPSBbXSk7CiAgICAgICAgICAgICAgICAgICAgYSA9IGEuaFtjXTsKICAgICAgICAgICAgICAgICAgICBUYShhLCBiKSB8fCBhLnB1c2goYik7CiAgICAgICAgICAgICAgICB9LCBCZiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgYS5pLnB1c2guYXBwbHkoYS5pLCB1KFBhKFFhKGIsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgc2YoYyk7CiAgICAgICAgICAgICAgICAgICAgfSksIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhVGEodWYsIGMuQSgpKTsKICAgICAgICAgICAgICAgICAgICB9KSkpOwogICAgICAgICAgICAgICAgfSwgeWYgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gUCh2ZSkuZzsKICAgICAgICAgICAgICAgICAgICBpZiAoIWxlKEgoYiwgYmUsIDMpLCBlKSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBJKGIsIG1mLCAyKSwgaCA9IEQoYiwgNiwgMCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGIoZCwgMSwgUWQsIGgpOwogICAgICAgICAgICAgICAgICAgICAgICBmID0gZVtOXTsKICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBnID0gZls4XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gZls3XTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBjID0gdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGcoaCksIEYoZCwgMywgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAoYiA9IENmKGIsIGMpKSA/IERmKGEsIFtiXSwgMSkgOiBudWxsOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoaCA9IEQoYiwgMTAsIDApKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBiKGQsIDIsIFFkLCBoKTsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYykgewogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gZVtOXVs5XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnID0gZVtOXVsxMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGMgPSBnID8gZyhTdHJpbmcoaCkpIDogdm9pZCAwOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodm9pZCAwID09PSBjICYmIDEgPT09IEQoYiwgMTEsIDApKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gYyAmJiBGKGQsIDMsIGMpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGIgPSBDZihiLCBjKSkgPyBEZihhLCBbYl0sIDEpIDogbnVsbDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZCA9IGUgPyBQYShmLCBmdW5jdGlvbiAoaykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGUoSChrLCBiZSwgMyksIGUpOwogICAgICAgICAgICAgICAgICAgIH0pIDogZjsKICAgICAgICAgICAgICAgICAgICBpZiAoIWQubGVuZ3RoKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICAgICAgICBjID0gZC5sZW5ndGggKiBEKGIsIDEsIDApOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAoYiA9IEQoYiwgNCwgMCkpID8gRWYoYSwgYiwgYywgZCkgOiBEZihhLCBkLCBjIC8gMTAwMCk7CiAgICAgICAgICAgICAgICB9LCBFZiA9IGZ1bmN0aW9uIChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGUgPSBudWxsICE9IGEubFtiXSA/IGEubFtiXSA6IDEwMDA7CiAgICAgICAgICAgICAgICAgICAgaWYgKDAgPj0gZSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgZCA9IERmKGEsIGQsIGMgLyBlKTsKICAgICAgICAgICAgICAgICAgICBhLmxbYl0gPSBkID8gMCA6IGUgLSBjOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwogICAgICAgICAgICAgICAgfSwgRGYgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gYS5qLCBlID0gUmEoYiwgZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhIWRbZi5nZXRJZCgpXTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUgPyBlIDogYS5zID8gbnVsbCA6IHVjKGIsIGMpOwogICAgICAgICAgICAgICAgfSwgRmYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIFMoTmUsIGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGEualtjXSA9ICEwOwogICAgICAgICAgICAgICAgICAgIH0sIGIpOwogICAgICAgICAgICAgICAgICAgIFMoUWUsIGZ1bmN0aW9uIChjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBBZihhLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICB9LCBiKTsKICAgICAgICAgICAgICAgICAgICBTKFJlLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGEuaFtjXSB8fCBbXSkuY29uY2F0KGEuaFs0XSk7CiAgICAgICAgICAgICAgICAgICAgfSwgYik7CiAgICAgICAgICAgICAgICAgICAgUygkZSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJmKGEsIGMpOwogICAgICAgICAgICAgICAgICAgIH0sIGIpOwogICAgICAgICAgICAgICAgICAgIFMoT2UsIGZ1bmN0aW9uIChjLCBkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB6ZihhLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICB9LCBiKTsKICAgICAgICAgICAgICAgIH0sIHhmID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gKGEgPSBSYShhLCBmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5BKCkgPT0gYjsKICAgICAgICAgICAgICAgICAgICB9KSkgJiYgSShhLCBvZiwgMikgfHwgW107CiAgICAgICAgICAgICAgICB9LCBDZiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBJKGEsIG1mLCAyKSwgZCA9IGMubGVuZ3RoLCBlID0gRChhLCA4LCAwKTsKICAgICAgICAgICAgICAgICAgICBhID0gZCAqIEQoYSwgMSwgMCkgLSAxOwogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgIT09IGIgPyBiIDogTWF0aC5mbG9vcigxMDAwICogdGMoKSk7CiAgICAgICAgICAgICAgICAgICAgZCA9IChiIC0gZSkgJSBkOwogICAgICAgICAgICAgICAgICAgIGlmIChiIDwgZSB8fCBiIC0gZSAtIGQgPj0gYSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgICAgICAgICAgYyA9IGNbZF07CiAgICAgICAgICAgICAgICAgICAgZSA9IFAodmUpLmc7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFjIHx8IGUgJiYgIWxlKEgoYywgYmUsIDMpLCBlKSA/IG51bGwgOiBjOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIEdmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0ge307CiAgICAgICAgICAgICAgICAgICAgdGhpcy5qID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gYVtiXSA/IGFbYl0gOiBjOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gYVtiXSA/IGFbYl0gOiBjOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhpcy5sID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gYVtiXSA/IGFbYl0gOiBjOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oID0gZnVuY3Rpb24gKGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT0gYVtiXSA/IGFbYl0gOiBjOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgdGhpcy5pID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBIZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFAoR2YpLmooYS5nLCBhLmRlZmF1bHRWYWx1ZSk7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgSWYgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5nID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICB9LCBKZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgUChJZikuZyhhKTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBLZiwgTGYsIE1mLCBOZiwgT2YsIFBmLCBTZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSBQKFFmKS5nLCBjID0gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgWjogVVsyMTFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJDogVVsyMjZdCiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGQgPSB2b2lkIDAsIGUgPSAyOwogICAgICAgICAgICAgICAgICAgIGQgPSB2b2lkIDAgPT09IGQgPyBrZigpIDogZDsKICAgICAgICAgICAgICAgICAgICBlID0gdm9pZCAwID09PSBlID8gMCA6IGU7CiAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSB2b2lkIDAgPT09IGYgPyBuZXcgcmUobnVsbCAhPSAoTmYgPSBudWxsID09IChLZiA9IEgoYSwgdGYsIDUpKSA/IHZvaWQgMCA6IEQoS2YsIDIsIDApKSA/IE5mIDogMCwgbnVsbCAhPSAoT2YgPSBudWxsID09IChMZiA9IEgoYSwgdGYsIDUpKSA/IHZvaWQgMCA6IEQoTGYsIDQsIDApKSA/IE9mIDogMCwgbnVsbCAhPSAoUGYgPSBudWxsID09IChNZiA9IEgoYSwgdGYsIDUpKSA/IHZvaWQgMCA6IG1iKE1mLCAzKSkgPyBQZiA6ICExKSA6IGY7CiAgICAgICAgICAgICAgICAgICAgZC5oYXNPd25Qcm9wZXJ0eSgnaW5pdC1kb25lJykgPyAoVCgkZSwgZCkoUWEoSShhLCBzZiwgMiksIGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoLnRvSlNPTigpOwogICAgICAgICAgICAgICAgICAgIH0pKSwgVChhZiwgZCkoUWEoSShhLCBPLCAxKSwgZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGgudG9KU09OKCk7CiAgICAgICAgICAgICAgICAgICAgfSksIGUpLCBiICYmIFQoYmYsIGQpKGIpLCBSZihkLCBlKSkgOiAoRmYod2YoUCh2ZiksIEkoYSwgc2YsIDIpLCBlLCBmLCBjKSwgZCksIGNmKGQpLCBkZihkKSwgZWYoZCksIFJmKGQsIGUpLCBKZShJKGEsIE8sIDEpLCBbZV0sIGYsIHZvaWQgMCwgITApLCB4ZSA9IHhlIHx8ICEoIWMgfHwgIWMueGEpLCBKZihQKGpmKSksIGIgJiYgSmYoYikpOwogICAgICAgICAgICAgICAgfSwgUmYgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSB2b2lkIDAgPT09IGEgPyBrZigpIDogYTsKICAgICAgICAgICAgICAgICAgICBiID0gdm9pZCAwID09PSBiID8gMCA6IGI7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLCBkID0gYjsKICAgICAgICAgICAgICAgICAgICBkID0gdm9pZCAwID09PSBkID8gMCA6IGQ7CiAgICAgICAgICAgICAgICAgICAgZ2YoUChmZiksIGMsIGQpOwogICAgICAgICAgICAgICAgICAgIFRmKGEsIGIpOwogICAgICAgICAgICAgICAgICAgIFAoSWYpLmcgPSBUKGJmLCBhKTsKICAgICAgICAgICAgICAgICAgICBQKEdmKS5pKCk7CiAgICAgICAgICAgICAgICB9LCBUZiA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBQKEdmKTsKICAgICAgICAgICAgICAgICAgICBjLmogPSBmdW5jdGlvbiAoZCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChUZSwgYSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICB9KShkLCBlLCBiKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGMuZyA9IGZ1bmN0aW9uIChkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKFVlLCBhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgICAgICAgICAgfSkoZCwgZSwgYik7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICBjLmwgPSBmdW5jdGlvbiAoZCwgZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gVChWZSwgYSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICcnOwogICAgICAgICAgICAgICAgICAgICAgICB9KShkLCBlLCBiKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIGMuaCA9IGZ1bmN0aW9uIChkLCBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBUKFdlLCBhLCBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICAgICAgICAgICAgICAgIH0pKGQsIGUsIGIpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgYy5pID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICBUKFBlLCBhKShiKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFVmID0gUChHZikuaChiZC5nLCBiZC5kZWZhdWx0VmFsdWUpOwogICAgICAgICAgICBmdW5jdGlvbiBWZihhKSB7CiAgICAgICAgICAgICAgICBhID0gdm9pZCAwID09PSBhID8gd2luZG93LmRvY3VtZW50IDogYTsKICAgICAgICAgICAgICAgIEVjKFVmLCBhKTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBXZiA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICBhID0gdm9pZCAwID09PSBhID8geiA6IGE7CiAgICAgICAgICAgICAgICByZXR1cm4gKGEgPSBhLnBlcmZvcm1hbmNlKSAmJiBhLm5vdyA/IGEubm93KCkgOiBudWxsOwogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgWGYgPSB6LnBlcmZvcm1hbmNlLCBZZiA9ICEhKFhmICYmIFhmLm1hcmsgJiYgWGYubWVhc3VyZSAmJiBYZi5jbGVhck1hcmtzKSwgWmYgPSBpYyhmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGE7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEgPSBZZikKICAgICAgICAgICAgICAgICAgICAgICAgYSA9ICRkKCksIGEgPSAhIWEuaW5kZXhPZiAmJiAwIDw9IGEuaW5kZXhPZignMTMzNycpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHZhciAkZiA9IGthKFsnaHR0cHM6Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9wYWdlYWQvanMvZXJyX3JlcC5qcyddKSwgYWcgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHRoaXMuZyA9IHZvaWQgMCA9PT0gYSA/IG51bGwgOiBhOwogICAgICAgICAgICAgICAgICAgIHRoaXMuaSA9IHZvaWQgMCA9PT0gYiA/ICdqc2Vycm9yJyA6IGI7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5oID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICB0aGlzLmogPSB2b2lkIDAgPT09IGMgPyAwLjAxIDogYzsKICAgICAgICAgICAgICAgICAgICB0aGlzLm8gPSB0aGlzLmw7CiAgICAgICAgICAgICAgICAgICAgdGhpcy5zID0gbnVsbDsKICAgICAgICAgICAgICAgIH0sIGJnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICBhLmggPSBiOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgYWcucHJvdG90eXBlLmwgPSBmdW5jdGlvbiAoYSwgYiwgYywgZCwgZSkgewogICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/IHRoaXMuaiA6IGM7CiAgICAgICAgICAgICAgICBlID0gdm9pZCAwID09PSBlID8gdGhpcy5pIDogZTsKICAgICAgICAgICAgICAgIGlmIChNYXRoLnJhbmRvbSgpID4gYykKICAgICAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgICAgICBiLmVycm9yICYmIGIubWV0YSAmJiBiLmlkIHx8IChiID0gbmV3IFlkKGIsIHsKICAgICAgICAgICAgICAgICAgICBjb250ZXh0OiBhLAogICAgICAgICAgICAgICAgICAgIGlkOiBlCiAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICBpZiAoZCB8fCB0aGlzLmgpCiAgICAgICAgICAgICAgICAgICAgYi5tZXRhID0ge30sIHRoaXMuaCAmJiB0aGlzLmgoYi5tZXRhKSwgZCAmJiBkKGIubWV0YSk7CiAgICAgICAgICAgICAgICB6Lmdvb2dsZV9qc19lcnJvcnMgPSB6Lmdvb2dsZV9qc19lcnJvcnMgfHwgW107CiAgICAgICAgICAgICAgICB6Lmdvb2dsZV9qc19lcnJvcnMucHVzaChiKTsKICAgICAgICAgICAgICAgIGlmICghei5lcnJvcl9yZXBfbG9hZGVkKSB7CiAgICAgICAgICAgICAgICAgICAgYyA9IEljKCRmKTsKICAgICAgICAgICAgICAgICAgICB2YXIgZjsKICAgICAgICAgICAgICAgICAgICBhID0gei5kb2N1bWVudDsKICAgICAgICAgICAgICAgICAgICBiID0gbnVsbCAhPSAoZiA9IHRoaXMucykgPyBmIDogbmV3IEooZmMoYykudG9TdHJpbmcoKSwgRmIpOwogICAgICAgICAgICAgICAgICAgIGYgPSBEYygnU0NSSVBUJywgYSk7CiAgICAgICAgICAgICAgICAgICAgZi5zcmMgPSBmYyhiKTsKICAgICAgICAgICAgICAgICAgICBnYyhmKTsKICAgICAgICAgICAgICAgICAgICAoYSA9IGEuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ3NjcmlwdCcpWzBdKSAmJiBhLnBhcmVudE5vZGUgJiYgYS5wYXJlbnROb2RlLmluc2VydEJlZm9yZShmLCBhKTsKICAgICAgICAgICAgICAgICAgICB6LmVycm9yX3JlcF9sb2FkZWQgPSAhMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIGNnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBhLmcgJiYgYS5nLnN0YXJ0KCc0MjAnLCAzKTsKICAgICAgICAgICAgICAgICAgICBiKCk7CiAgICAgICAgICAgICAgICAgICAgYS5nICYmIGMgJiYgYS5nLmVuZChjKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYS5nICYmIGMgJiYgKGIgPSBjKSAmJiBYZiAmJiBaZigpICYmIChYZi5jbGVhck1hcmtzKCdnb29nXycgKyBiLmxhYmVsICsgJ18nICsgYi51bmlxdWVJZCArICdfc3RhcnQnKSwgWGYuY2xlYXJNYXJrcygnZ29vZ18nICsgYi5sYWJlbCArICdfJyArIGIudW5pcXVlSWQgKyAnX2VuZCcpKSwgIWEubyg0MjAsIGQsIGEuaiwgdm9pZCAwLCBhLmkpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgZGcgPSBQKEdmKS5oKGNkLmcsIGNkLmRlZmF1bHRWYWx1ZSk7CiAgICAgICAgICAgIGZ1bmN0aW9uIGVnKGEpIHsKICAgICAgICAgICAgICAgIGEgPSB2b2lkIDAgPT09IGEgPyB3aW5kb3cuZG9jdW1lbnQgOiBhOwogICAgICAgICAgICAgICAgRWMoZGcsIGEpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIDsKICAgICAgICAgICAgdmFyIGZnID0gQ2IoJ2dwdC9wdWJhZHNfaW1wbF8nKTsKICAgICAgICAgICAgdmFyIGdnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IFdmKGIpOwogICAgICAgICAgICAgICAgICAgIGMgJiYgKGEgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsOiBhLAogICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiA5LAogICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogYwogICAgICAgICAgICAgICAgICAgIH0sIGIgPSBiLmdvb2dsZV9qc19yZXBvcnRpbmdfcXVldWUgPSBiLmdvb2dsZV9qc19yZXBvcnRpbmdfcXVldWUgfHwgW10sIDIwNDggPiBiLmxlbmd0aCAmJiBiLnB1c2goYSkpOwogICAgICAgICAgICAgICAgfSwgaGcgPSBmdW5jdGlvbiAoYSwgYiwgYykgewogICAgICAgICAgICAgICAgICAgIHZhciBkID0gd2luZG93OwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gV2YoKSwgZiA9IDM7CiAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaCA9IGIuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZiA9IDEzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGMoYSwgZyksIGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBnOwogICAgICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5nb29nbGVfbWVhc3VyZV9qc190aW1pbmcgJiYgZSAmJiAoZSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYWJlbDogYS50b1N0cmluZygpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGR1cmF0aW9uOiAoV2YoKSB8fCAwKSAtIGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZiA9IGQuZ29vZ2xlX2pzX3JlcG9ydGluZ19xdWV1ZSA9IGQuZ29vZ2xlX2pzX3JlcG9ydGluZ19xdWV1ZSB8fCBbXSwgMjA0OCA+IGYubGVuZ3RoICYmIGYucHVzaChlKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGg7CiAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgIH0sIGlnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gaGcoYSwgYiwgZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbmV3IGFnKCkubChjLCBkKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBqZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgIHRoaXMuaiA9IHRoaXMuajsKICAgICAgICAgICAgICAgIHRoaXMuaSA9IHRoaXMuaTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgamcucHJvdG90eXBlLmogPSAhMTsKICAgICAgICAgICAgamcucHJvdG90eXBlLkwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBpZiAodGhpcy5pKQogICAgICAgICAgICAgICAgICAgIGZvciAoOyB0aGlzLmkubGVuZ3RoOykKICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5pLnNoaWZ0KCkoKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgZnVuY3Rpb24gVihhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbCA9PSBiID8gJyYnICsgYSArICc9bnVsbCcgOiAnJicgKyBhICsgJz0nICsgTWF0aC5mbG9vcihiKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBrZyhhLCBiKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gJyYnICsgYSArICc9JyArIGIudG9GaXhlZCgzKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBsZygpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gbmV3IG0uU2V0KCk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IHZvaWQgMCA9PT0gYiA/IHdpbmRvdyA6IGI7CiAgICAgICAgICAgICAgICBiID0gYi5nb29nbGV0YWc7CiAgICAgICAgICAgICAgICBiID0gKG51bGwgPT09IGIgfHwgdm9pZCAwID09PSBiID8gMCA6IGIuYXBpUmVhZHkpID8gYiA6IHZvaWQgMDsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFiKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBjID0gYi5wdWJhZHMoKSwgZCA9IHQoYy5nZXRTbG90cygpKSwgZSA9IGQubmV4dCgpOyAhZS5kb25lOyBlID0gZC5uZXh0KCkpCiAgICAgICAgICAgICAgICAgICAgICAgIGEuYWRkKGUudmFsdWUuZ2V0U2xvdElkKCkuZ2V0RG9tSWQoKSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIChmKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gYTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBtZyhhKSB7CiAgICAgICAgICAgICAgICBhID0gYS5pZDsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsICE9IGEgJiYgKGxnKCkuaGFzKGEpIHx8IHAoYSwgJ3N0YXJ0c1dpdGgnKS5jYWxsKGEsICdnb29nbGVfYWRzX2lmcmFtZV8nKSB8fCBwKGEsICdzdGFydHNXaXRoJykuY2FsbChhLCAnYXN3aWZ0JykpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIG5nKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgIGlmICghYS5zb3VyY2VzKQogICAgICAgICAgICAgICAgICAgIHJldHVybiAhMTsKICAgICAgICAgICAgICAgIHN3aXRjaCAob2coYSkpIHsKICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IHBnKGEpOwogICAgICAgICAgICAgICAgICAgIGlmIChkKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5zb21lKGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcWcoZCwgZik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgIHZhciBlID0gcmcoYSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiLnNvbWUoZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBxZyhlLCBmKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gITE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gb2coYSkgewogICAgICAgICAgICAgICAgaWYgKCFhLnNvdXJjZXMpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICBhID0gYS5zb3VyY2VzLmZpbHRlcihmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiLnByZXZpb3VzUmVjdCAmJiBiLmN1cnJlbnRSZWN0OwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBpZiAoMSA8PSBhLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIGEgPSBhWzBdOwogICAgICAgICAgICAgICAgICAgIGlmIChhLnByZXZpb3VzUmVjdC50b3AgPCBhLmN1cnJlbnRSZWN0LnRvcCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgICAgICAgICAgaWYgKGEucHJldmlvdXNSZWN0LnRvcCA+IGEuY3VycmVudFJlY3QudG9wKQogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIHJnKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiBzZyhhLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBiLmN1cnJlbnRSZWN0OwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gcGcoYSkgewogICAgICAgICAgICAgICAgcmV0dXJuIHNnKGEsIGZ1bmN0aW9uIChiKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGIucHJldmlvdXNSZWN0OwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gc2coYSwgYikgewogICAgICAgICAgICAgICAgcmV0dXJuIGEuc291cmNlcy5yZWR1Y2UoZnVuY3Rpb24gKGMsIGQpIHsKICAgICAgICAgICAgICAgICAgICBkID0gYihkKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYyA/IGQgJiYgMCAhPT0gZC53aWR0aCAqIGQuaGVpZ2h0ID8gZC50b3AgPCBjLnRvcCA/IGQgOiBjIDogYyA6IGQ7CiAgICAgICAgICAgICAgICB9LCBudWxsKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgdGcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBqZy5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5oID0gdGhpcy5nID0gdGhpcy5HID0gdGhpcy5GID0gdGhpcy5LID0gMDsKICAgICAgICAgICAgICAgIHRoaXMuViA9IHRoaXMuUyA9IE51bWJlci5ORUdBVElWRV9JTkZJTklUWTsKICAgICAgICAgICAgICAgIHRoaXMuTiA9IHRoaXMuUCA9IHRoaXMuUiA9IHRoaXMuVCA9IHRoaXMuWSA9IHRoaXMubyA9IHRoaXMuWCA9IHRoaXMuSSA9IDA7CiAgICAgICAgICAgICAgICB0aGlzLk8gPSAhMTsKICAgICAgICAgICAgICAgIHRoaXMuSCA9IHRoaXMuRCA9IHRoaXMucyA9IDA7CiAgICAgICAgICAgICAgICB2YXIgYSA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJ1tkYXRhLWdvb2dsZS1xdWVyeS1pZF0nKTsKICAgICAgICAgICAgICAgIHRoaXMuVyA9IGEgPyBhLmdldEF0dHJpYnV0ZSgnZGF0YS1nb29nbGUtcXVlcnktaWQnKSA6IG51bGw7CiAgICAgICAgICAgICAgICB0aGlzLmwgPSBudWxsOwogICAgICAgICAgICAgICAgdGhpcy5VID0gITE7CiAgICAgICAgICAgICAgICB0aGlzLk0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9OwogICAgICAgICAgICB2KHRnLCBqZyk7CiAgICAgICAgICAgIHZhciB3ZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IG5ldyB0ZygpOwogICAgICAgICAgICAgICAgICAgIGlmIChIZihlZCkgJiYgIXdpbmRvdy5nb29nbGVfcGxtZXRyaWNzICYmIHdpbmRvdy5QZXJmb3JtYW5jZU9ic2VydmVyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5nb29nbGVfcGxtZXRyaWNzID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGIgPSB0KFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2xheW91dC1zaGlmdCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdsYXJnZXN0LWNvbnRlbnRmdWwtcGFpbnQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnZmlyc3QtaW5wdXQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnbG9uZ3Rhc2snCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSksIGMgPSBiLm5leHQoKTsgIWMuZG9uZTsgYyA9IGIubmV4dCgpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGMudmFsdWUsIHVnKGEpLm9ic2VydmUoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IGMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVmZmVyZWQ6ICEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmcoYSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwgdWcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIGEubCB8fCAoYS5sID0gbmV3IFBlcmZvcm1hbmNlT2JzZXJ2ZXIoaWcoNjQwLCBmdW5jdGlvbiAoYikgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IHhnICE9PSB3aW5kb3cuc2Nyb2xsWCB8fCB5ZyAhPT0gd2luZG93LnNjcm9sbFkgPyBbXSA6IHpnLCBkID0gQWcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiA9IHQoYi5nZXRFbnRyaWVzKCkpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBlID0gYi5uZXh0KCk7ICFlLmRvbmU7IGUgPSBiLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZSA9IGUudmFsdWUsIGUuZW50cnlUeXBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdsYXlvdXQtc2hpZnQnOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWUuaGFkUmVjZW50SW5wdXQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5LICs9IE51bWJlcihlLnZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTnVtYmVyKGUudmFsdWUpID4gZi5GICYmIChmLkYgPSBOdW1iZXIoZS52YWx1ZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLkcgKz0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGggPSBuZyhlLCBjLCBkKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaCAmJiAoZi5vICs9IGUudmFsdWUsIGYuVCsrKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDUwMDAgPCBlLnN0YXJ0VGltZSAtIGYuUyB8fCAxMDAwIDwgZS5zdGFydFRpbWUgLSBmLlYpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLlMgPSBlLnN0YXJ0VGltZSwgZi5nID0gMCwgZi5oID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5WID0gZS5zdGFydFRpbWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuZyArPSBlLnZhbHVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoICYmIChmLmggKz0gZS52YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYuZyA+IGYuSSAmJiAoZi5JID0gZi5nLCBmLlkgPSBmLmgsIGYuWCA9IGUuc3RhcnRUaW1lICsgZS5kdXJhdGlvbik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnbGFyZ2VzdC1jb250ZW50ZnVsLXBhaW50JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLlIgPSBNYXRoLmZsb29yKGUucmVuZGVyVGltZSB8fCBlLmxvYWRUaW1lKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLlAgPSBlLnNpemU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdmaXJzdC1pbnB1dCc6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYS5OID0gTnVtYmVyKChlLnByb2Nlc3NpbmdTdGFydCAtIGUuc3RhcnRUaW1lKS50b0ZpeGVkKDMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhLk8gPSAhMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ2xvbmd0YXNrJzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlID0gTWF0aC5tYXgoMCwgZS5kdXJhdGlvbiAtIDUwKSwgYS5zICs9IGUsIGEuRCA9IE1hdGgubWF4KGEuRCwgZSksIGEuSCArPSAxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0pKSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEubDsKICAgICAgICAgICAgICAgIH0sIHZnID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IGlnKDY0MSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBkb2N1bWVudDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIgPT0gKEhmKGRkKSAmJiBkLnByZXJlbmRlcmluZyA/IDMgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmlzaWJsZTogMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaWRkZW46IDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJlcmVuZGVyOiAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZXZpZXc6IDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdW5sb2FkZWQ6IDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1bZC52aXNpYmlsaXR5U3RhdGUgfHwgZC53ZWJraXRWaXNpYmlsaXR5U3RhdGUgfHwgZC5tb3pWaXNpYmlsaXR5U3RhdGUgfHwgJyddIHx8IDApICYmIEJnKGEpOwogICAgICAgICAgICAgICAgICAgICAgICB9KSwgYyA9IGlnKDY0MSwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgQmcoYSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ3Zpc2liaWxpdHljaGFuZ2UnLCBiKTsKICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5hZGRFdmVudExpc3RlbmVyKCd1bmxvYWQnLCBjKTsKICAgICAgICAgICAgICAgICAgICBhLk0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LnJlbW92ZUV2ZW50TGlzdGVuZXIoJ3Zpc2liaWxpdHljaGFuZ2UnLCBiKTsKICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQucmVtb3ZlRXZlbnRMaXN0ZW5lcigndW5sb2FkJywgYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHVnKGEpLmRpc2Nvbm5lY3QoKTsKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdGcucHJvdG90eXBlLkwgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICBqZy5wcm90b3R5cGUuTC5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgdGhpcy5NKCk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIHZhciBCZyA9IGZ1bmN0aW9uIChhKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFhLlUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYS5VID0gITA7CiAgICAgICAgICAgICAgICAgICAgICAgIHVnKGEpLnRha2VSZWNvcmRzKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBiID0gJ2h0dHBzOi8vcGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20vcGFnZWFkL2dlbl8yMDQ/aWQ9cGxtZXRyaWNzJzsKICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LkxheW91dFNoaWZ0ICYmIChiICs9IGtnKCdjbHMnLCBhLkspLCBiICs9IGtnKCdtbHMnLCBhLkYpLCBiICs9IFYoJ25scycsIGEuRyksIHdpbmRvdy5MYXlvdXRTaGlmdEF0dHJpYnV0aW9uICYmIChiICs9IGtnKCdjYXMnLCBhLm8pLCBiICs9IFYoJ25hcycsIGEuVCkpLCBiICs9IGtnKCd3bHMnLCBhLkkpLCBiICs9IGtnKCd0bHMnLCBhLlgpLCB3aW5kb3cuTGF5b3V0U2hpZnRBdHRyaWJ1dGlvbiAmJiAoYiArPSBrZygnd2FzJywgYS5ZKSkpOwogICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuTGFyZ2VzdENvbnRlbnRmdWxQYWludCAmJiAoYiArPSBWKCdsY3AnLCBhLlIpLCBiICs9IFYoJ2xjcHMnLCBhLlApKTsKICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LlBlcmZvcm1hbmNlRXZlbnRUaW1pbmcgJiYgYS5PICYmIChiICs9IFYoJ2ZpZCcsIGEuTikpOwogICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cuUGVyZm9ybWFuY2VMb25nVGFza1RpbWluZyAmJiAoYiArPSBWKCdjYnQnLCBhLnMpLCBiICs9IFYoJ21idCcsIGEuRCksIGIgKz0gVignbmx0JywgYS5IKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSAwLCBkID0gdChkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnaWZyYW1lJykpLCBlID0gZC5uZXh0KCk7ICFlLmRvbmU7IGUgPSBkLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1nKGUudmFsdWUpICYmIGMrKzsKICAgICAgICAgICAgICAgICAgICAgICAgYiArPSBWKCduaWYnLCBjKTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IHdpbmRvdy5nb29nbGVfdW5pcXVlX2lkOwogICAgICAgICAgICAgICAgICAgICAgICBiICs9IFYoJ2lmaScsICdudW1iZXInID09PSB0eXBlb2YgYyA/IGMgOiAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgYyA9IFAoZmYpLmgoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiArPSAnJmVpZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KGMuam9pbigpKTsKICAgICAgICAgICAgICAgICAgICAgICAgYiArPSAnJnRvcD0nICsgKHogPT09IHoudG9wID8gMSA6IDApOwogICAgICAgICAgICAgICAgICAgICAgICBiICs9IGEuVyA/ICcmcXFpZD0nICsgZW5jb2RlVVJJQ29tcG9uZW50KGEuVykgOiBWKCdwdnNpZCcsIEZjKHopKTsKICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93Lmdvb2dsZXRhZyAmJiAoYiArPSAnJmdwdD0xJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy5mZXRjaChiLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwYWxpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY3JlZGVudGlhbHM6ICdpbmNsdWRlJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZGlyZWN0OiAnZm9sbG93JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ2dldCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiAnbm8tY29ycycKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGEuaiB8fCAoYS5qID0gITAsIGEuTCgpKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9LCBxZyA9IGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGMgPSBNYXRoLm1pbihhLnJpZ2h0LCBiLnJpZ2h0KSAtIE1hdGgubWF4KGEubGVmdCwgYi5sZWZ0KTsKICAgICAgICAgICAgICAgICAgICBhID0gTWF0aC5taW4oYS5ib3R0b20sIGIuYm90dG9tKSAtIE1hdGgubWF4KGEudG9wLCBiLnRvcCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDAgPj0gYyB8fCAwID49IGEgPyAhMSA6IDUwIDw9IDEwMCAqIGMgKiBhIC8gKChiLnJpZ2h0IC0gYi5sZWZ0KSAqIChiLmJvdHRvbSAtIGIudG9wKSk7CiAgICAgICAgICAgICAgICB9LCBBZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFtdLmNvbmNhdCh1KGRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdpZnJhbWUnKSkpLmZpbHRlcihtZyksIGIgPSBbXS5jb25jYXQodShsZygpKSkubWFwKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoYyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLmZpbHRlcihmdW5jdGlvbiAoYykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IGM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHhnID0gd2luZG93LnNjcm9sbFg7CiAgICAgICAgICAgICAgICAgICAgeWcgPSB3aW5kb3cuc2Nyb2xsWTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gemcgPSBbXS5jb25jYXQodShhKSwgdShiKSkubWFwKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpOwogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgfSwgeGcgPSB2b2lkIDAsIHlnID0gdm9pZCAwLCB6ZyA9IFtdOwogICAgICAgICAgICB2YXIgVyA9IHsKICAgICAgICAgICAgICAgICAgICBpc3N1ZXJPcmlnaW46ICdodHRwczovL2F0dGVzdGF0aW9uLmFuZHJvaWQuY29tJywKICAgICAgICAgICAgICAgICAgICBpc3N1YW5jZVBhdGg6ICcvYXR0L2knLAogICAgICAgICAgICAgICAgICAgIHJlZGVtcHRpb25QYXRoOiAnL2F0dC9yJwogICAgICAgICAgICAgICAgfSwgWCA9IHsKICAgICAgICAgICAgICAgICAgICBpc3N1ZXJPcmlnaW46ICdodHRwczovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tJywKICAgICAgICAgICAgICAgICAgICBpc3N1YW5jZVBhdGg6ICcvZHR0L2knLAogICAgICAgICAgICAgICAgICAgIHJlZGVtcHRpb25QYXRoOiAnL2R0dC9yJywKICAgICAgICAgICAgICAgICAgICBnZXRTdGF0ZVBhdGg6ICcvZHR0L3MnCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICB2YXIgQ2cgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB2b2lkIDAgPT09IGEgPyB3aW5kb3cgOiBhOwogICAgICAgICAgICAgICAgICAgIGEgPSBhLm5hdmlnYXRvci51c2VyQWdlbnQ7CiAgICAgICAgICAgICAgICAgICAgdmFyIGIgPSAvQ2hyb21lLy50ZXN0KGEpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAvQW5kcm9pZC8udGVzdChhKSAmJiBiOwogICAgICAgICAgICAgICAgfSwgRGcgPSBQKEdmKS5oKGtkLmcsIGtkLmRlZmF1bHRWYWx1ZSksIEVnID0gZnVuY3Rpb24gKGEsIGIsIGMpIHsKICAgICAgICAgICAgICAgICAgICBhID0gdm9pZCAwID09PSBhID8gITEgOiBhOwogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyAhMSA6IGI7CiAgICAgICAgICAgICAgICAgICAgYyA9IHZvaWQgMCA9PT0gYyA/ICExIDogYzsKICAgICAgICAgICAgICAgICAgICBqZy5jYWxsKHRoaXMpOwogICAgICAgICAgICAgICAgICAgIHZhciBkID0gdGhpczsKICAgICAgICAgICAgICAgICAgICB0aGlzLmcgPSBhOwogICAgICAgICAgICAgICAgICAgIGEgPSBbXTsKICAgICAgICAgICAgICAgICAgICBiICYmIENnKCkgJiYgYS5wdXNoKFcpOwogICAgICAgICAgICAgICAgICAgIGMgJiYgYS5wdXNoKFgpOwogICAgICAgICAgICAgICAgICAgIGlmIChkb2N1bWVudC5oYXNUcnVzdFRva2VuICYmICFIZihoZCkgJiYgIUFycmF5LmlzQXJyYXkod2luZG93Lmdvb2dfdHRfc3RhdGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlID0gYS5tYXAoZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNzdWVyT3JpZ2luOiBmLmlzc3Vlck9yaWdpbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogZC5nID8gMSA6IDEyCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2dvb2dfdHRfc3RhdGUnLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6ICExLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGUuc2xpY2UoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdihFZywgamcpOwogICAgICAgICAgICB2YXIgRmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSB3aW5kb3c7CiAgICAgICAgICAgICAgICAgICAgYSA9IHZvaWQgMCA9PT0gYSA/IHdpbmRvdyA6IGE7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICFhLlBlcmlvZGljU3luY01hbmFnZXI7CiAgICAgICAgICAgICAgICB9LCBHZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHZvaWQgMCA9PT0gYSA/IHdpbmRvdy5kb2N1bWVudCA6IGE7CiAgICAgICAgICAgICAgICAgICAgRWMoRGcsIGEpOwogICAgICAgICAgICAgICAgfSwgSGcgPSBmdW5jdGlvbiAoYSkgewogICAgICAgICAgICAgICAgICAgIHZhciBiID0gVVsxNTBdOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBVWzIyMV0gfHwgJy5nb29nbGUuY2gnID09PSBiIHx8ICdmdW5jdGlvbicgPT09IHR5cGVvZiBhLl9fdGNmYXBpOwogICAgICAgICAgICAgICAgfSwgWSA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQsIGUgPSBudWxsID09IChkID0gd2luZG93Lmdvb2dfdHRfc3RhdGUpID8gdm9pZCAwIDogcChkLCAnZmluZCcpLmNhbGwoZCwgZnVuY3Rpb24gKGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmLmlzc3Vlck9yaWdpbiA9PT0gYTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgZSAmJiAoZS5zdGF0ZSA9IGIsIHZvaWQgMCAhPSBjICYmIChlLmhhc1JlZGVtcHRpb25SZWNvcmQgPSBjKSk7CiAgICAgICAgICAgICAgICB9LCBJZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IFcuaXNzdWVyT3JpZ2luICsgVy5yZWRlbXB0aW9uUGF0aCwgYiA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtlZXBhbGl2ZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVzdFRva2VuOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3Rva2VuLXJlZGVtcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzc3VlcjogVy5pc3N1ZXJPcmlnaW4sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBvbGljeTogJ25vbmUnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgWShXLmlzc3Vlck9yaWdpbiwgMik7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5mZXRjaChhLCBiKS50aGVuKGZ1bmN0aW9uIChjKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghYy5vaykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGMuc3RhdHVzICsgJzogTmV0d29yayByZXNwb25zZSB3YXMgbm90IG9rIScpOwogICAgICAgICAgICAgICAgICAgICAgICBZKFcuaXNzdWVyT3JpZ2luLCA2LCAhMCk7CiAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgYyAmJiAnTm9Nb2RpZmljYXRpb25BbGxvd2VkRXJyb3InID09PSBjLm5hbWUgPyBZKFcuaXNzdWVyT3JpZ2luLCA2LCAhMCkgOiBZKFcuaXNzdWVyT3JpZ2luLCA1KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIEpnID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBhID0gVy5pc3N1ZXJPcmlnaW4gKyBXLmlzc3VhbmNlUGF0aDsKICAgICAgICAgICAgICAgICAgICBZKFcuaXNzdWVyT3JpZ2luLCA4KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LmZldGNoKGEsIHsKICAgICAgICAgICAgICAgICAgICAgICAga2VlcGFsaXZlOiAhMCwKICAgICAgICAgICAgICAgICAgICAgICAgdHJ1c3RUb2tlbjogeyB0eXBlOiAndG9rZW4tcmVxdWVzdCcgfQogICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFiLm9rKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoYi5zdGF0dXMgKyAnOiBOZXR3b3JrIHJlc3BvbnNlIHdhcyBub3Qgb2shJyk7CiAgICAgICAgICAgICAgICAgICAgICAgIFkoVy5pc3N1ZXJPcmlnaW4sIDEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElnKCk7CiAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIgJiYgJ05vTW9kaWZpY2F0aW9uQWxsb3dlZEVycm9yJyA9PT0gYi5uYW1lKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFkoVy5pc3N1ZXJPcmlnaW4sIDEwKSwgSWcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgWShXLmlzc3Vlck9yaWdpbiwgOSk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9LCBLZyA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICBZKFcuaXNzdWVyT3JpZ2luLCAxMyk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRvY3VtZW50Lmhhc1RydXN0VG9rZW4oVy5pc3N1ZXJPcmlnaW4pLnRoZW4oZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEgPyBJZygpIDogSmcoKTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0sIExnID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIFkoWC5pc3N1ZXJPcmlnaW4sIDEzKTsKICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93LlByb21pc2UpIHsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBkb2N1bWVudC5oYXNUcnVzdFRva2VuKFguaXNzdWVyT3JpZ2luKS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuUHJvbWlzZS5yZWplY3QoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogMTksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSwgYiA9IFguaXNzdWVyT3JpZ2luICsgWC5yZWRlbXB0aW9uUGF0aCwgYyA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZWVwYWxpdmU6ICEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRydXN0VG9rZW46IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogJ3Rva2VuLXJlZGVtcHRpb24nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUG9saWN5OiAnbm9uZScKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBZKFguaXNzdWVyT3JpZ2luLCAxNik7CiAgICAgICAgICAgICAgICAgICAgICAgIGEgPSBhLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuZmV0Y2goYiwgYykudGhlbihmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZi5vaykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoZi5zdGF0dXMgKyAnOiBOZXR3b3JrIHJlc3BvbnNlIHdhcyBub3Qgb2shJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWShYLmlzc3Vlck9yaWdpbiwgMTgsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uIChmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYgJiYgJ05vTW9kaWZpY2F0aW9uQWxsb3dlZEVycm9yJyA9PT0gZi5uYW1lKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBZKFguaXNzdWVyT3JpZ2luLCAxOCwgITApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuUHJvbWlzZS5yZWplY3QoewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiAxNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFkoWC5pc3N1ZXJPcmlnaW4sIDE3KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQuaGFzVHJ1c3RUb2tlbihYLmlzc3Vlck9yaWdpbikudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LlByb21pc2UucmVqZWN0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IDE5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gWC5pc3N1ZXJPcmlnaW4gKyBYLmdldFN0YXRlUGF0aDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFkoWC5pc3N1ZXJPcmlnaW4sIDIwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuZmV0Y2goZiArICc/aHQ9JyArIGUsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVzdFRva2VuOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICdzZW5kLXJlZGVtcHRpb24tcmVjb3JkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXNzdWVyczogW1guaXNzdWVyT3JpZ2luXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLnRoZW4oZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWgub2spCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGguc3RhdHVzICsgJzogTmV0d29yayByZXNwb25zZSB3YXMgbm90IG9rIScpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFkoWC5pc3N1ZXJPcmlnaW4sIDIyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaC50ZXh0KCkudGhlbihmdW5jdGlvbiAoZykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5wYXJzZShnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLmNhdGNoKGZ1bmN0aW9uIChoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdpbmRvdy5Qcm9taXNlLnJlamVjdCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiAyMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSBGYyh3aW5kb3cpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYS50aGVuKGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IFguaXNzdWVyT3JpZ2luICsgWC5pc3N1YW5jZVBhdGg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZSAmJiBlLnNycXQgJiYgZS5jcyA/IChZKFguaXNzdWVyT3JpZ2luLCAyMyksIHdpbmRvdy5mZXRjaChmICsgJz9jcz0nICsgZS5jcyArICcmY29ycmVsYXRvcj0nICsgZCwgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtlZXBhbGl2ZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ1c3RUb2tlbjogeyB0eXBlOiAndG9rZW4tcmVxdWVzdCcgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaC5vaykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgRXJyb3IoaC5zdGF0dXMgKyAnOiBOZXR3b3JrIHJlc3BvbnNlIHdhcyBub3Qgb2shJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWShYLmlzc3Vlck9yaWdpbiwgMjUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LlByb21pc2UucmVqZWN0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IDI0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogaAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpIDogZTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUgJiYgZS5zcmR0ICYmIGUuY3MpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFkoWC5pc3N1ZXJPcmlnaW4sIDI2KSwgd2luZG93LmZldGNoKGIgKyAnP2NzPScgKyBlLmNzICsgJyZjb3JyZWxhdG9yPScgKyBkLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtlZXBhbGl2ZTogITAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRydXN0VG9rZW46IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6ICd0b2tlbi1yZWRlbXB0aW9uJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQb2xpY3k6ICdyZWZyZXNoJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYub2spCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBFcnJvcihmLnN0YXR1cyArICc6IE5ldHdvcmsgcmVzcG9uc2Ugd2FzIG5vdCBvayEnKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWShYLmlzc3Vlck9yaWdpbiwgMjgsICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoZikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gd2luZG93LlByb21pc2UucmVqZWN0KHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiAyNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFkoWC5pc3N1ZXJPcmlnaW4sIDI5KTsKICAgICAgICAgICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlIGluc3RhbmNlb2YgT2JqZWN0ICYmIGUuaGFzT3duUHJvcGVydHkoJ3N0YXRlJykgJiYgZS5oYXNPd25Qcm9wZXJ0eSgnZXJyb3InKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoJ251bWJlcicgPT09IHR5cGVvZiBlLnN0YXRlICYmIGUuZXJyb3IgaW5zdGFuY2VvZiBFcnJvcikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBZKFguaXNzdWVyT3JpZ2luLCBlLnN0YXRlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGYgPSBQKEdmKS5nKGpkLmcsIGpkLmRlZmF1bHRWYWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hdGgucmFuZG9tKCkgPD0gZiAmJiBIYyh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTogZS5zdGF0ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVycjogZS5lcnJvci50b1N0cmluZygpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sICdkdHRfZXJyJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IEVycm9yKGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0sIE1nID0gZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoZG9jdW1lbnQuaGFzVHJ1c3RUb2tlbiAmJiAhSGYoaGQpICYmIGEuZykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAod2luZG93Lmdvb2dfdHRfcHJvbWlzZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB3aW5kb3cuZ29vZ190dF9wcm9taXNlOwogICAgICAgICAgICAgICAgICAgICAgICBhID0gd2luZG93Lmdvb2dfdHRfc3RhdGU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGEpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYiA9IFtdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcChhLCAnZmluZCcpLmNhbGwoYSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5pc3N1ZXJPcmlnaW4gPT09IFcuaXNzdWVyT3JpZ2luOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgJiYgYi5wdXNoKEtnKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgcChhLCAnZmluZCcpLmNhbGwoYSwgZnVuY3Rpb24gKGMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYy5pc3N1ZXJPcmlnaW4gPT09IFguaXNzdWVyT3JpZ2luOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkgJiYgYi5wdXNoKExnKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHdpbmRvdy5Qcm9taXNlICYmIHdpbmRvdy5Qcm9taXNlLmFsbCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYSA9IHdpbmRvdy5Qcm9taXNlLmFsbChiKSwgJ29iamVjdCcgIT0gdHlwZW9mIHdpbmRvdy5nb29nX3R0X3Byb21pc2UgJiYgT2JqZWN0LmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ2dvb2dfdHRfcHJvbWlzZScsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiAhMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiAhMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLCBhOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIE5nID0gJ3BsYXRmb3JtIHBsYXRmb3JtVmVyc2lvbiBhcmNoaXRlY3R1cmUgbW9kZWwgdWFGdWxsVmVyc2lvbiBiaXRuZXNzJy5zcGxpdCgnICcpOwogICAgICAgICAgICBmdW5jdGlvbiBPZyhhKSB7CiAgICAgICAgICAgICAgICB2YXIgYiwgYzsKICAgICAgICAgICAgICAgIHJldHVybiAnZnVuY3Rpb24nICE9PSB0eXBlb2YgKG51bGwgPT09IChjID0gbnVsbCA9PT0gKGIgPSBudWxsID09PSBhIHx8IHZvaWQgMCA9PT0gYSA/IHZvaWQgMCA6IGEubmF2aWdhdG9yKSB8fCB2b2lkIDAgPT09IGIgPyB2b2lkIDAgOiBiLnVzZXJBZ2VudERhdGEpIHx8IHZvaWQgMCA9PT0gYyA/IHZvaWQgMCA6IGMuZ2V0SGlnaEVudHJvcHlWYWx1ZXMpID8gbnVsbCA6IGEubmF2aWdhdG9yLnVzZXJBZ2VudERhdGEuZ2V0SGlnaEVudHJvcHlWYWx1ZXMoTmcpLnRoZW4oZnVuY3Rpb24gKGQpIHsKICAgICAgICAgICAgICAgICAgICB2YXIgZSA9IG5ldyBuZCgpOwogICAgICAgICAgICAgICAgICAgIGUgPSBDKGUsIDEsIGQucGxhdGZvcm0pOwogICAgICAgICAgICAgICAgICAgIGUgPSBDKGUsIDIsIGQucGxhdGZvcm1WZXJzaW9uKTsKICAgICAgICAgICAgICAgICAgICBlID0gQyhlLCAzLCBkLmFyY2hpdGVjdHVyZSk7CiAgICAgICAgICAgICAgICAgICAgZSA9IEMoZSwgNCwgZC5tb2RlbCk7CiAgICAgICAgICAgICAgICAgICAgZSA9IEMoZSwgNSwgZC51YUZ1bGxWZXJzaW9uKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gQyhlLCA5LCBkLmJpdG5lc3MpOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICBmdW5jdGlvbiBQZygpIHsKICAgICAgICAgICAgICAgIHZhciBhOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChhID0gei5nb29nbGV0YWcpICYmIHZvaWQgMCAhPT0gYSA/IGEgOiB6Lmdvb2dsZXRhZyA9IHt9OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIFFnKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gUGcoKTsKICAgICAgICAgICAgICAgIGMuaGFzT3duUHJvcGVydHkoYSkgfHwgKGNbYV0gPSBiKTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBaID0ge30sIFUgPSAoWlsyM10gPSAwLjAwMSwgWlszOF0gPSAwLjAwMSwgWls1OF0gPSAxLCBaWzE1MF0gPSAnJywgWlsyMTFdID0gITEsIFpbMjUzXSA9ICExLCBaWzE3Ml0gPSBudWxsLCBaWzI0Nl0gPSBbXSwgWlsyMjZdID0gW10sIFpbMjUyXSA9IG51bGwsIFpbMjU4XSA9IG51bGwsIFpbMjUxXSA9IG51bGwsIFpbMjU5XSA9IG51bGwsIFpbNl0gPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyAhMCA6IGI7CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IG51bGw7IGMgIT0gYTsgYyA9IGEsIGEgPSBhLnBhcmVudCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoYS5sb2NhdGlvbi5wcm90b2NvbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnaHR0cHM6JzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gITA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdmaWxlOic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlICdodHRwOic6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICExOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGQpIHsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICEwOwogICAgICAgICAgICAgICAgfSh3aW5kb3cpLCBaWzM2XSA9IEFjKCdmYWxzZScpLCBaWzE0OF0gPSB3ZSwgWlsyMjFdID0gQWMoJycpLCBaWzI1N10gPSBBYygnZmFsc2UnKSwgWlsyNjBdID0gdm9pZCAwLCBaWzI2Ml0gPSBBYygnZmFsc2UnKSwgWik7CiAgICAgICAgICAgIGZ1bmN0aW9uIFJnKGEsIGIpIHsKICAgICAgICAgICAgICAgIFVbYV0gPSBiOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBTZyA9IFBnKCk7CiAgICAgICAgICAgIHAoT2JqZWN0LCAnYXNzaWduJykuY2FsbChPYmplY3QsIFUsIFNnLl92YXJzXyk7CiAgICAgICAgICAgIFNnLl92YXJzXyA9IFU7CiAgICAgICAgICAgIHZhciBUZyA9IG5ldyBtLldlYWtNYXAoKSwgVWcgPSBmdW5jdGlvbiAoYSwgYikgewogICAgICAgICAgICAgICAgICAgIGEgPSBbYV07CiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgYyA9IGIubGVuZ3RoIC0gMTsgMCA8PSBjOyAtLWMpCiAgICAgICAgICAgICAgICAgICAgICAgIGEucHVzaCh0eXBlb2YgYltjXSwgYltjXSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGEuam9pbignXHgwQicpOwogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgdmFyIFZnID0gZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIGIgPSB2b2lkIDAgPT09IGIgPyBVZyA6IGI7CiAgICAgICAgICAgICAgICB2YXIgYyA9IHlhKGEpLCBkID0gZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IHQoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGUubmV4dCgpOwogICAgICAgICAgICAgICAgICAgICAgICBlID0gbGEoZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiKGMsIGUpOwogICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHZhciBlID0gdy5hcHBseSgwLCBhcmd1bWVudHMpLCBmID0gdGhpcyB8fCB6LCBoID0gVGcuZ2V0KGYpOwogICAgICAgICAgICAgICAgICAgIGggfHwgKGggPSB7fSwgVGcuc2V0KGYsIGgpKTsKICAgICAgICAgICAgICAgICAgICBmID0gaDsKICAgICAgICAgICAgICAgICAgICBoID0gW3RoaXNdLmNvbmNhdCh1KGUpKTsKICAgICAgICAgICAgICAgICAgICBlID0gZCA/IGQoaCkgOiBoOwogICAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZiwgZSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGYgPSBmW2VdOwogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICB2YXIgZyA9IHQoaCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGggPSBnLm5leHQoKS52YWx1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgZyA9IGxhKGcpOwogICAgICAgICAgICAgICAgICAgICAgICBoID0gYS5hcHBseShoLCBnKTsKICAgICAgICAgICAgICAgICAgICAgICAgZiA9IGZbZV0gPSBoOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0oZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAobnVsbCA9PT0gYSB8fCB2b2lkIDAgPT09IGEgPyAwIDogYS5zcmMpID8gL14oPzpodHRwcz86KT9cL1wvKD86d3d3XC5nb29nbGV0YWdzZXJ2aWNlc1wuY29tfHNlY3VyZXB1YmFkc1wuZ1wuZG91YmxlY2xpY2tcLm5ldHxwYWdlYWQyXC5nb29nbGVzeW5kaWNhdGlvblwuY29tKVwvdGFnXC9qc1wvZ3B0KD86X1thLXpdKykqXC5qcy8udGVzdChhLnNyYykgPyAwIDogMSA6IDI7CiAgICAgICAgICAgIH0sIGZ1bmN0aW9uIChhLCBiKSB7CiAgICAgICAgICAgICAgICB2YXIgYzsKICAgICAgICAgICAgICAgIHJldHVybiBhICsgJ1x4MEInICsgKG51bGwgPT09IChjID0gYlswXSkgfHwgdm9pZCAwID09PSBjID8gdm9pZCAwIDogYy5zcmMpOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgZnVuY3Rpb24gV2coKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gMCA9PT0gVmcoVVsxNzJdKTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIGZ1bmN0aW9uIFhnKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHpjKCcxJykgfHwgMDsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBZZygpIHsKICAgICAgICAgICAgICAgIHZhciBhID0gWmc7CiAgICAgICAgICAgICAgICB2YXIgYiA9IE51bWJlcihhKTsKICAgICAgICAgICAgICAgIGlmICgxID4gYiB8fCBNYXRoLmZsb29yKGIpICE9PSBiKQogICAgICAgICAgICAgICAgICAgIEhjKHsgdjogYSB9LCAnZ3B0X2ludl92ZXInKSwgYSA9ICcxJzsKICAgICAgICAgICAgICAgIHJldHVybiBhOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBaZyA9ICcyMDIyMDExMDAyJzsKICAgICAgICAgICAgdmFyIFFmID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgdmFyIGEgPSB7fSwgYiA9IHt9LCBjID0ge307CiAgICAgICAgICAgICAgICB0aGlzLmcgPSAoY1tmZV0gPSAoYVszXSA9IFdnLCBhWzE3XSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gcCh3LmFwcGx5KDAsIGFyZ3VtZW50cyksICdpbmNsdWRlcycpLmNhbGwody5hcHBseSgwLCBhcmd1bWVudHMpLCBTdHJpbmcoQ2MoKSkpOwogICAgICAgICAgICAgICAgfSwgYVs1OV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQgPSB3LmFwcGx5KDAsIGFyZ3VtZW50cyksIGUgPSBwKGQsICdpbmNsdWRlcycpLCBmID0gU3RyaW5nLCBoOwogICAgICAgICAgICAgICAgICAgIHZhciBnID0gdm9pZCAwID09PSBnID8gd2luZG93IDogZzsKICAgICAgICAgICAgICAgICAgICB2YXIgazsKICAgICAgICAgICAgICAgICAgICBnID0gbnVsbCAhPSAoayA9IG51bGwgPT0gKGggPSBvYyhnLmxvY2F0aW9uLmhyZWYubWF0Y2gobmMpWzNdIHx8IG51bGwpKSA/IHZvaWQgMCA6IGguc3BsaXQoJy4nKSkgPyBrIDogW107CiAgICAgICAgICAgICAgICAgICAgaCA9IDIgPiBnLmxlbmd0aCA/IG51bGwgOiAndWsnID09PSBnW2cubGVuZ3RoIC0gMV0gPyAzID4gZy5sZW5ndGggPyBudWxsIDogd2MoZy5zcGxpY2UoZy5sZW5ndGggLSAzKS5qb2luKCcuJykpIDogd2MoZy5zcGxpY2UoZy5sZW5ndGggLSAyKS5qb2luKCcuJykpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlLmNhbGwoZCwgZihoKSk7CiAgICAgICAgICAgICAgICB9LCBhWzIxXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gVVsxNDhdOwogICAgICAgICAgICAgICAgfSwgYVs2MV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFVbMjIxXTsKICAgICAgICAgICAgICAgIH0sIGFbNjNdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiBVWzIyMV0gfHwgJy5nb29nbGUuY2gnID09PSBVWzE1MF07CiAgICAgICAgICAgICAgICB9LCBhWzUwXSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMSA9PT0gTWF0aC5mbG9vcihuZXcgRGF0ZSgpLmdldFRpbWUoKSAvIDI0IC8gNjAgLyA2MCAvIDEwMDApICUgMjsKICAgICAgICAgICAgICAgIH0sIGFbNTRdID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHJldHVybiAhIVVbMjU5XTsKICAgICAgICAgICAgICAgIH0sIGEpLCBjW05dID0gKGJbMV0gPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgdmFyIGQ7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGwgIT09IChkID0gemMoJ3t7TU9EfX0nKSkgJiYgdm9pZCAwICE9PSBkID8gZCA6IC0xOwogICAgICAgICAgICAgICAgfSwgYls0XSA9IFhnLCBiKSwgYyk7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGZ1bmN0aW9uICRnKGEpIHsKICAgICAgICAgICAgICAgIHZhciBiID0gbmV3IHFmKFVbMjQ2XSk7CiAgICAgICAgICAgICAgICBhID0gbmV3IHFmKGEpOwogICAgICAgICAgICAgICAgaWYgKCFJKGIsIE8sIDEpLmxlbmd0aCAmJiBJKGEsIE8sIDEpLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIHZhciBjID0gSShhLCBPLCAxKTsKICAgICAgICAgICAgICAgICAgICB0YihiLCAxLCBjKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICFJKGIsIHNmLCAyKS5sZW5ndGggJiYgSShhLCBzZiwgMikubGVuZ3RoICYmIChjID0gSShhLCBzZiwgMiksIHRiKGIsIDIsIGMpKTsKICAgICAgICAgICAgICAgIG51bGwgPT0gQihiLCA1KSAmJiBudWxsICE9IEIoYSwgNSkgJiYgKGEgPSBIKGEsIHRmLCA1KSwgcWIoYiwgNSwgYSkpOwogICAgICAgICAgICAgICAgU2YoYik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgOwogICAgICAgICAgICBmdW5jdGlvbiBhaChhKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gKGEgPSBhLmN1cnJlbnRTY3JpcHQpID8gYSA6IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gYmgoYSkgewogICAgICAgICAgICAgICAgdmFyIGI7CiAgICAgICAgICAgICAgICBhID0gdChudWxsICE9PSAoYiA9IGEuc2NyaXB0cykgJiYgdm9pZCAwICE9PSBiID8gYiA6IFtdKTsKICAgICAgICAgICAgICAgIGZvciAodmFyIGMgPSBhLm5leHQoKTsgIWMuZG9uZTsgYyA9IGEubmV4dCgpKQogICAgICAgICAgICAgICAgICAgIGlmIChjID0gYy52YWx1ZSwgcChjLnNyYywgJ2luY2x1ZGVzJykuY2FsbChjLnNyYywgJy90YWcvanMvZ3B0JykpCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOwogICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gY2goYSkgewogICAgICAgICAgICAgICAgcmV0dXJuICEobnVsbCA9PT0gYSB8fCB2b2lkIDAgPT09IGEgfHwgIWEuc3JjKSAmJiAncGFnZWFkMi5nb29nbGVzeW5kaWNhdGlvbi5jb20nID09PSBvYyhhLnNyYy5tYXRjaChuYylbM10gfHwgbnVsbCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gZGgoYSkgewogICAgICAgICAgICAgICAgdmFyIGIgPSBhaChhKTsKICAgICAgICAgICAgICAgIHJldHVybiAnY29tcGxldGUnID09PSBhLnJlYWR5U3RhdGUgfHwgJ2xvYWRlZCcgPT09IGEucmVhZHlTdGF0ZSB8fCAhKG51bGwgPT09IGIgfHwgdm9pZCAwID09PSBiIHx8ICFiLmFzeW5jKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBlaChhKSB7CiAgICAgICAgICAgICAgICBhID0gY2goYSkgPyBDYignaHR0cHM6Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS8nKSA6IENiKCdodHRwczovL3NlY3VyZXB1YmFkcy5nLmRvdWJsZWNsaWNrLm5ldC8nKTsKICAgICAgICAgICAgICAgIGEgPSBLYihbCiAgICAgICAgICAgICAgICAgICAgYSwKICAgICAgICAgICAgICAgICAgICBmZywKICAgICAgICAgICAgICAgICAgICBDYignMjAyMjAxMTAwMicpLAogICAgICAgICAgICAgICAgICAgIENiKCcuanMnKQogICAgICAgICAgICAgICAgXSk7CiAgICAgICAgICAgICAgICB2YXIgYiA9IFAoR2YpLmcoYWQuZywgYWQuZGVmYXVsdFZhbHVlKTsKICAgICAgICAgICAgICAgIHJldHVybiBiID8gSmIoYSwgU3RyaW5nKGIpKSA6IGE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIGZoID0gZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgIHRoaXMuaCA9IFtdOwogICAgICAgICAgICAgICAgICAgIHRoaXMuZXJyb3IgPSB0aGlzLmcgPSB2b2lkIDA7CiAgICAgICAgICAgICAgICB9LCBnaCA9IGZ1bmN0aW9uIChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICAgICAgYS5nID0gYjsKICAgICAgICAgICAgICAgICAgICBhLmVycm9yID0gYzsKICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBkID0gdChhLmgpLCBlID0gZC5uZXh0KCk7ICFlLmRvbmU7IGUgPSBkLm5leHQoKSkKICAgICAgICAgICAgICAgICAgICAgICAgZSA9IGUudmFsdWUsIGUoYiwgYyk7CiAgICAgICAgICAgICAgICAgICAgYS5oLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICBmdW5jdGlvbiBoaChhLCBiLCBjKSB7CiAgICAgICAgICAgICAgICBhID0gYS5sb2NhdGlvbi5ob3N0OwogICAgICAgICAgICAgICAgdmFyIGQgPSBiICYmIHFjKGIuc3JjLCAnZG9tYWluJyksIGUgPSBiICYmIHFjKGIuc3JjLCAnbmV0d29yay1jb2RlJyk7CiAgICAgICAgICAgICAgICBpZiAoIWEgJiYgIWQgJiYgIWUpCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdoKGMsIHZvaWQgMCwgbmV3IG0uZ2xvYmFsVGhpcy5FcnJvcignbm8gcHJvdmlkZWQgb3IgaW5mZXJyZWQgZGF0YScpKSwgbnVsbDsKICAgICAgICAgICAgICAgIGIgPSBjaChiKSA/IENiKCdodHRwczovL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tJykgOiBDYignaHR0cHM6Ly9zZWN1cmVwdWJhZHMuZy5kb3VibGVjbGljay5uZXQnKTsKICAgICAgICAgICAgICAgIHJldHVybiBKYihLYihbCiAgICAgICAgICAgICAgICAgICAgYiwKICAgICAgICAgICAgICAgICAgICBDYignL3BhZ2VhZC9wcHViX2NvbmZpZycpCiAgICAgICAgICAgICAgICBdKSwgewogICAgICAgICAgICAgICAgICAgIGlwcGQ6IGEsCiAgICAgICAgICAgICAgICAgICAgcHBwZDogZCwKICAgICAgICAgICAgICAgICAgICBwcHBuYzogZQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnVuY3Rpb24gaWgoYSwgYikgewogICAgICAgICAgICAgICAgY29uc3QgJF9fX29sZF8xODQzNzkwZDdjMWI1YjllID0ge30uY29uc3RydWN0b3IuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JyksICRfX19vbGRfYjIxOTE1OGQ2NmJjZGYzMyA9IHt9LmNvbnN0cnVjdG9yLmdldE93blByb3BlcnR5RGVzY3JpcHRvcih3aW5kb3csICdYTUxIdHRwUmVxdWVzdCcpOwogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8xODQzNzkwZDdjMWI1YjllKQogICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fbW9ja18wMDQ2NTI4NDAwNGQ0YWE4LlhNTEh0dHBSZXF1ZXN0KSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCRfX19vbGRfYjIxOTE1OGQ2NmJjZGYzMykKICAgICAgICAgICAgICAgICAgICAgICAgKHt9LmNvbnN0cnVjdG9yLmRlZmluZVByb3BlcnR5KHdpbmRvdywgJ1hNTEh0dHBSZXF1ZXN0JywgJF9fX21vY2tfMDA0NjUyODQwMDRkNGFhOC5YTUxIdHRwUmVxdWVzdCkpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IGZoKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIFJnKDI2MCwgZnVuY3Rpb24gKGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZvaWQgMCAhPT0gYy5nIHx8IGMuZXJyb3IgPyBlKGMuZywgYy5lcnJvcikgOiBjLmgucHVzaChlKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiID0gaGgoYSwgYiwgYykpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkID0gbmV3IG0uZ2xvYmFsVGhpcy5YTUxIdHRwUmVxdWVzdCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5vcGVuKCdHRVQnLCBiLnRvU3RyaW5nKCksICEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQud2l0aENyZWRlbnRpYWxzID0gITE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLm9ubG9hZCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMDAgPiBkLnN0YXR1cyA/IChnZygnMTMnLCBhKSwgZ2goYywgMjA0ID09PSBkLnN0YXR1cyA/ICcnIDogZC5yZXNwb25zZVRleHQpKSA6IGdoKGMsIHZvaWQgMCwgbmV3IG0uZ2xvYmFsVGhpcy5FcnJvcigncmVzcDonICsgZC5zdGF0dXMpKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkLm9uZXJyb3IgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgZ2goYywgdm9pZCAwLCBuZXcgbS5nbG9iYWxUaGlzLkVycm9yKCdzOicgKyBkLnN0YXR1cyArICcgcnM6JyArIGQucmVhZHlTdGF0ZSkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGQuc2VuZCgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfS5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF8xODQzNzkwZDdjMWI1YjllKQogICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkXzE4NDM3OTBkN2MxYjViOWUpKTsKICAgICAgICAgICAgICAgICAgICBpZiAoJF9fX29sZF9iMjE5MTU4ZDY2YmNkZjMzKQogICAgICAgICAgICAgICAgICAgICAgICAoe30uY29uc3RydWN0b3IuZGVmaW5lUHJvcGVydHkod2luZG93LCAnWE1MSHR0cFJlcXVlc3QnLCAkX19fb2xkX2IyMTkxNThkNjZiY2RmMzMpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmdW5jdGlvbiBqaChhLCBiLCBjLCBkKSB7CiAgICAgICAgICAgICAgICBVWzE3Ml0gPSBkOwogICAgICAgICAgICAgICAgVVsyNTldID0gZGgoYSk7CiAgICAgICAgICAgICAgICAkZyhiKTsKICAgICAgICAgICAgICAgIFAoZmYpLmcoMTIpOwogICAgICAgICAgICAgICAgUChmZikuZyg1KTsKICAgICAgICAgICAgICAgIEdnKCk7CiAgICAgICAgICAgICAgICBIZyhjKSB8fCAoYSA9ICFGZygpICYmIEhmKGZkKSB8fCBGZygpICYmIEhmKGdkKSwgYiA9IEhmKGlkKSwgYSA9IG5ldyBFZyghMCwgYSwgYiksIDAgPCBQKEdmKS5nKGxkLmcsIGxkLmRlZmF1bHRWYWx1ZSkgPyBSZygyNTgsIE1nKGEpKSA6IE1nKGEpKTsKICAgICAgICAgICAgICAgIChhID0gT2coYykpICYmIGEudGhlbihmdW5jdGlvbiAoZSkgewogICAgICAgICAgICAgICAgICAgIGUgPSB2YihlKTsKICAgICAgICAgICAgICAgICAgICBVWzI1MV0gPSBlOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBlZyhjLmRvY3VtZW50KTsKICAgICAgICAgICAgICAgIFZmKGMuZG9jdW1lbnQpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZ1bmN0aW9uIGtoKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjLCBkLCBlLCBmLCBoLCBnID0gUGcoKSwgayA9IG51bGwgIT09IChjID0gbnVsbCAhPT0gYSAmJiB2b2lkIDAgIT09IGEgPyBhIDogZy5maWZXaW4pICYmIHZvaWQgMCAhPT0gYyA/IGMgOiB3aW5kb3c7CiAgICAgICAgICAgICAgICBhID0gay5kb2N1bWVudDsKICAgICAgICAgICAgICAgIHZhciBsID0gZy5maWZXaW4gPyB3aW5kb3cgOiBrOwogICAgICAgICAgICAgICAgUWcoJ19sb2FkZWRfJywgITApOwogICAgICAgICAgICAgICAgUWcoJ2dldFZlcnNpb24nLCBZZyk7CiAgICAgICAgICAgICAgICBRZygnY21kJywgW10pOwogICAgICAgICAgICAgICAgdmFyIG4gPSBudWxsICE9PSAoZCA9IGFoKGEpKSAmJiB2b2lkIDAgIT09IGQgPyBkIDogYmgoYSk7CiAgICAgICAgICAgICAgICBqaChhLCBiLCBrLCBuKTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgd2coKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGliKSB7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBnZygnMScsIGspOwogICAgICAgICAgICAgICAgYiA9IGVoKG4pOwogICAgICAgICAgICAgICAgaWYgKCFVWzI1OV0pIHsKICAgICAgICAgICAgICAgICAgICBrID0gJ2dwdC1pbXBsLScgKyBNYXRoLnJhbmRvbSgpOwogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGhjKGEsIFdiKGIsIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBrLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9uY2U6IGxjKCkKICAgICAgICAgICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGliKSB7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGEuZ2V0RWxlbWVudEJ5SWQoaykgJiYgKGcuX2xvYWRTdGFydGVkXyA9ICEwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICghZy5fbG9hZFN0YXJ0ZWRfKSB7CiAgICAgICAgICAgICAgICAgICAgayA9IGcuZmlmV2luID8gbC5kb2N1bWVudCA6IGE7CiAgICAgICAgICAgICAgICAgICAgdmFyIHEgPSBEYygnU0NSSVBUJyk7CiAgICAgICAgICAgICAgICAgICAgcS5zcmMgPSBmYyhiKTsKICAgICAgICAgICAgICAgICAgICBnYyhxKTsKICAgICAgICAgICAgICAgICAgICBxLmFzeW5jID0gITA7CiAgICAgICAgICAgICAgICAgICAgdmFyIHkgPSBudWxsICE9PSAoZiA9IG51bGwgIT09IChlID0gay5oZWFkKSAmJiB2b2lkIDAgIT09IGUgPyBlIDogay5ib2R5KSAmJiB2b2lkIDAgIT09IGYgPyBmIDogay5kb2N1bWVudEVsZW1lbnQ7CiAgICAgICAgICAgICAgICAgICAgJ2NvbXBsZXRlJyAhPT0gbC5kb2N1bWVudC5yZWFkeVN0YXRlICYmIGcuZmlmV2luID8gamMobCwgZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCB5LmFwcGVuZENoaWxkKHEpOwogICAgICAgICAgICAgICAgICAgIH0pIDogeS5hcHBlbmRDaGlsZChxKTsKICAgICAgICAgICAgICAgICAgICBnLl9sb2FkU3RhcnRlZF8gPSAhMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGwgPT09IGwudG9wICYmIChIZigkYykgfHwgVVsyNTldIHx8ICFhaChhKSAmJiAobnVsbCA9PT0gKGggPSBiaChhKSkgfHwgdm9pZCAwID09PSBoID8gMCA6IGguYXN5bmMpKSAmJiAoRGQobCksIGloKGwsIG4pKTsKICAgICAgICAgICAgfQogICAgICAgICAgICA7CiAgICAgICAgICAgIHZhciBsaDsKICAgICAgICAgICAgYTogewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShFKSkgewogICAgICAgICAgICAgICAgICAgICAgICBsaCA9IEU7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGE7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBjYXRjaCAoYSkgewogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgbGggPSBbXTsKICAgICAgICAgICAgfQogICAgICAgICAgICAoZnVuY3Rpb24gKGEsIGIpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gbmV3IGFnKG51bGwsICdncHRfZXhjZXB0aW9uJywgMC4wMSk7CiAgICAgICAgICAgICAgICBiZyhjLCBmdW5jdGlvbiAoZCkgewogICAgICAgICAgICAgICAgICAgIGQubWV0aG9kSWQgPSA0MjA7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIGNnKGMsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gdm9pZCBraChhLCBiKTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9KHZvaWQgMCwgbGgpKTsKICAgICAgICB9LmNhbGwodGhpcy5nb29nbGV0YWcgJiYgZ29vZ2xldGFnLmZpZldpbiA/IGdvb2dsZXRhZy5maWZXaW4ucGFyZW50IDogdGhpcywgWwogICAgICAgICAgICBbCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAwLjEKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDQxMDgwMzY5MCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDM5ODc3Njg3OCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDQxMTE3MDE0NywKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgNDA4MzgwOTkyLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAwLjAxCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICA0MDA5NjM4MDUsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICA0MDA5OTI0NjgsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDM5NzMxNjkzOCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgMTAwMAogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAzODU0NDAxMzUsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDEwMDAKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMzc3Mjg5MDE5LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAxMDAwMAogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAzODU2MTAxNDksCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDMwMAogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICA1MjksCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDIwCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDQ5NCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgNTAwMAogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgNDEwNTY4MDQ2LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgNDExODQwOTQ5LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgNDEzNjgxNjg2LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgNDEzNDc3NzI5LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgNDEzNjY3NTE2LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgMjAsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAzODg1MjkxOTEsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc0Mjc2NzY3MjM4J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4NjQwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDQ5MiwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgMC4wMQogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAzODkzNTcyMzAsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDEwMDAKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMzk4Nzc2ODc3LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICA2MDAwMAogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgNDAzNDI2OTY2LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAzNzQyMDEyNjksCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDYwMDAwCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDM3MTM2NDIxMywKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgNjAwMDAKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMzczNDQwOTIzLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAwLjAwMDEKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMzc2MTQ5NzU3LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAwLjAwMjUKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMzk2NjY4OTE1LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICA1CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAzOTk5ODI3NTksCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDQ3LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICcxLTAtMzgnCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAzOTIwNjU5MDUsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzE4MTkwMTc2LDE1NTk1MzA0OCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc0OTk0NDUyOSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc1NDQxJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzYxNzcnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNjc4MiddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc2NTgxJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAzNjAyNDU1OTUsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDUwMAogICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgMzk2NDQyNTk4LAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICA2MSwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgMC4wMDEKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDE5MzYsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDE5MjEsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDcyCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDE5MjAsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDI0CiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDE5MjIsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMTkxNywKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgMzAwCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDE5MTYsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIDAuMDAxCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBOEZIUzFObWRDd0dxRDlEd09pY25ISFkreTI3a2RXZnhLYTBZSFNHRGZ2MENTcERLUkhUUWRRbVpWUERVZGFGV1VzeGRnVnhsd0FkNm8rZGhKeWtQQTBBQUFDV2V5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwyUnZkV0pzWldOc2FXTnJMbTVsZERvME5ETWlMQ0ptWldGMGRYSmxJam9pUTI5dWRtVnljMmx2YmsxbFlYTjFjbVZ0Wlc1MElpd2laWGh3YVhKNUlqb3hOalF6TVRVMU1UazVMQ0pwYzFOMVltUnZiV0ZwYmlJNmRISjFaU3dpYVhOVWFHbHlaRkJoY25SNUlqcDBjblZsTENKMWMyRm5aU0k2SW5OMVluTmxkQ0o5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBOHpkWGk2ZHIxaHdYRVVqUXJZaXlZUUdsVTM1NTd5NVFXRG5OMEx3Z2o5ZVB0NjZYTUV2TmtWV09FT1dQZDdUUDlzQlEyNVgwUTE1THIxTm40b0dGUWtBQUFDY2V5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwyZHZiMmRzWlhONWJtUnBZMkYwYVc5dUxtTnZiVG8wTkRNaUxDSm1aV0YwZFhKbElqb2lRMjl1ZG1WeWMybHZiazFsWVhOMWNtVnRaVzUwSWl3aVpYaHdhWEo1SWpveE5qUXpNVFUxTVRrNUxDSnBjMU4xWW1SdmJXRnBiaUk2ZEhKMVpTd2lhWE5VYUdseVpGQmhjblI1SWpwMGNuVmxMQ0oxYzJGblpTSTZJbk4xWW5ObGRDSjknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0E0L0h0ZXJuMnVkTjl3M3lKSzlRZ1dReFFGcnV4T1hzWEw3Y1c2MER5Q2wwRVpGR0NTbWUvSjMzUS9XekY3YkJrVnZoRVdEbGNCaVV5WmFpbTVDcEZRd0FBQUNjZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJkdmIyZHNaWFJoWjNObGNuWnBZMlZ6TG1OdmJUbzBORE1pTENKbVpXRjBkWEpsSWpvaVEyOXVkbVZ5YzJsdmJrMWxZWE4xY21WdFpXNTBJaXdpWlhod2FYSjVJam94TmpRek1UVTFNVGs1TENKcGMxTjFZbVJ2YldGcGJpSTZkSEoxWlN3aWFYTlVhR2x5WkZCaGNuUjVJanAwY25WbExDSjFjMkZuWlNJNkluTjFZbk5sZENKOScKICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAxOTM0CiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDE5MDMsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAxOTUzLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgMTkzOCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDE5NDgsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBeHVqS0c5SU5qc1o4L2dVcTgrZFRydU52azdSalpRMW9GaGhnUWJjVEpLRG5aZmJ6U1RFODF3dkMySHphZjNUVzRhdkE3NkxUWkVNZGllZEYxdkliQTRBQUFCdWV5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwybHRZWE5rYXk1bmIyOW5iR1ZoY0dsekxtTnZiVG8wTkRNaUxDSm1aV0YwZFhKbElqb2lWSEoxYzNSVWIydGxibk1pTENKbGVIQnBjbmtpT2pFMk5USTNOelEwTURBc0ltbHpWR2hwY21SUVlYSjBlU0k2ZEhKMVpYMD0nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0F6dWNlODVPUnRTbldlMU1aRFR2NjhxcGFXM2lIeWZMOVliTFJ5MGN3Y0Nad1ZuZVBuT21rVUpsRzhIR2lrbU93aFpVMjJkRWxDY2ZyZlgySGhyQlBBa0FBQUI3ZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJSdmRXSnNaV05zYVdOckxtNWxkRG8wTkRNaUxDSm1aV0YwZFhKbElqb2lWSEoxYzNSVWIydGxibk1pTENKbGVIQnBjbmtpT2pFMk5USTNOelEwTURBc0ltbHpVM1ZpWkc5dFlXbHVJanAwY25WbExDSnBjMVJvYVhKa1VHRnlkSGtpT25SeWRXVjknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0ExNm52Y2Rlb09BcXJKY21qTFJwbDFJNmYzTWNERDhFZm9mQVlUdC9QL0g0L0FXd0I5OW54aVBwNmtBMGZYb2laYXY5MDhaOGV0dUwxNmxhRlBVZGZRc0FBQUNCZXlKdmNtbG5hVzRpT2lKb2RIUndjem92TDJkdmIyZHNaWFJoWjNObGNuWnBZMlZ6TG1OdmJUbzBORE1pTENKbVpXRjBkWEpsSWpvaVZISjFjM1JVYjJ0bGJuTWlMQ0psZUhCcGNua2lPakUyTlRJM056UTBNREFzSW1selUzVmlaRzl0WVdsdUlqcDBjblZsTENKcGMxUm9hWEprVUdGeWRIa2lPblJ5ZFdWOScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQXhCSGRyMEo0NHZGQlF0WlVxWDlzamlxZjV5V1ovT2NIUmNSTU4zSDlUSCt0OTBWL2ozRU5XNkM4K2lnQlpGWE1KN0czUHI4RGQxMzYzMmFMbmc0MndnQUFBQ0JleUp2Y21sbmFXNGlPaUpvZEhSd2N6b3ZMMmR2YjJkc1pYTjVibVJwWTJGMGFXOXVMbU52YlRvME5ETWlMQ0ptWldGMGRYSmxJam9pVkhKMWMzUlViMnRsYm5NaUxDSmxlSEJwY25raU9qRTJOVEkzTnpRME1EQXNJbWx6VTNWaVpHOXRZV2x1SWpwMGNuVmxMQ0pwYzFSb2FYSmtVR0Z5ZEhraU9uUnlkV1Y5JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBODhCV0hGamNhd1VmS1UzbEllakxvcnlYb3lqb29CWExnV21HaCtoTmNxTUs0NGN1Z3ZzSTVZWmJOYXJZdmkzcm9jMWZZYkhBMUFWYmhBdHVIWmZsZ0VBQUFCMmV5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwyZHZiMmRzWlM1amIyMDZORFF6SWl3aVptVmhkSFZ5WlNJNklsUnlkWE4wVkc5clpXNXpJaXdpWlhod2FYSjVJam94TmpVeU56YzBOREF3TENKcGMxTjFZbVJ2YldGcGJpSTZkSEoxWlN3aWFYTlVhR2x5WkZCaGNuUjVJanAwY25WbGZRPT0nCiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgMTkzMgogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIDM5NzkwNzU1MiwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgNTAwCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICA0MDEyNDM3MjQsCiAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgXQogICAgICAgICAgICBdLAogICAgICAgICAgICBbCiAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgMjAsCiAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MjkzMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MjkzMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzODAwMjU5NDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAyCiAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDEzLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzQ0NzU2ODk0XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0NzU2ODk1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5NDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs0NDc1Njg5Nl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzQ0NzU2ODk3XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNDQ3NTY0MzFdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDQ3NTY0MzIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTk2MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYyNTU0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0Nocm9tZS8oOVsyMzQ1Njc4OV18XFxkezMsfSknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MjU1NSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOTU4NDIxMzksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ2hyb21lLyg5WzIzNDU2Nzg5XXxcXGR7Myx9KScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgW1syMTA2NzQ5Nl1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydkb2N1bWVudC5oYXNUcnVzdFRva2VuJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYwNDc1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnd2luZG93LlBlcmlvZGljU3luY01hbmFnZXInXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBbmRyb2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3IudXNlckFnZW50J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYxNjkyXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYxNjkzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNzcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3OCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDg1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgODAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyczMTA2MTY5MSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYyODkwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYyODkxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM5Nzg0MTgyOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbMzEwNjI5NDZdXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ2RvY3VtZW50LnByZXJlbmRlcmluZyddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWzMxMDYyOTQ3XV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ2RvY3VtZW50LnByZXJlbmRlcmluZyddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDQ3MTQ0NDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjc2OTgyOTYxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjQKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNjc2OTgyOTk2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjMxNjJdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjMxNjMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzU5MzUxMTQ1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzE4MTkwMTc2LDE1NTk1MzA0OCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc0OTk0NDUyOSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc1NDQxJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzYxNzcnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNjc4MiddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc2NTgxJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MAogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNDQ3MzI3MzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs0NDczMjczMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNjc2OTgyOTYwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNjc2OTgyOTk0XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNjc2OTgyOTk4XQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs2NzY5ODI5NzVdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs2NzY5ODI5ODBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMzM3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNzcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3OCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDg1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgODAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDg0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTg4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsyMTA2NDM2NV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMTA2NDM3MiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZmxhc2gnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0ODkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMjEwNjg3NjZdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjEwNjg3NjcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0ODgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAuMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MgogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjA1NDUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM2MzkzMTAyMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBMEJnMm5kZFVqNE53NkZ6c1h1ZEJYSFpzMWFBeklnTytVR3pmSkdrQzFmNEo1Nmdodko2VENpcmpkdDhCVXdzSzE0c0JCaldHbU9ZK1FDVHIySHJCUW9BQUFDQmV5SnZjbWxuYVc0aU9pSm9kSFJ3Y3pvdkwzTmxZM1Z5WlhCMVltRmtjeTVuTG1SdmRXSnNaV05zYVdOckxtNWxkRG8wTkRNaUxDSm1aV0YwZFhKbElqb2lVM1ZpY21WemIzVnlZMlZYWldKQ2RXNWtiR1Z6SWl3aVpYaHdhWEo1SWpveE5qVXlPRE14T1RrNUxDSnBjMVJvYVhKa1VHRnlkSGtpT25SeWRXVjknCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDaHJvbWUvKDlcXGR8XFxkezMsfSknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3IudXNlckFnZW50J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjI5MjNdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjI5MjQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTQ0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjMyNTZdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MzI1N10KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYzNzA2XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzNzA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzU5MzQ2OTU2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM3MDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNTkzNDY5NTYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM3MDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ3RvcC5mcmFtZXMuZ29vZ2xlX2Fkc190b3BfZnJhbWUnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzNzEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM2MDI0NTU5NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsndG9wLmZyYW1lcy5nb29nbGVfYWRzX3RvcF9mcmFtZSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzgzMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzODMyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYzODc0XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzODc1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzU3MDQ1MTI4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM4NzYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNTcwNDUxMjgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzODkwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDg4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2Mzg5MSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQwMjkwNTAzNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDg4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQyCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYzOTE2XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzOTE3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDEzNzI1MDQ2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQwCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2NDAyMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDAyMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzg1NDQwMTM1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzc4MjkwOTczLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDAyMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzg1NDQwMTM1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNzgyOTA5NzMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MDIzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzODU0NDAxMzUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM3ODI5MDk3MywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs0NDc1NTg0NV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDc1NTg0NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM4NzE2NTUzMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4wNQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1OSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzMzNzIwNDQxMTUnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcyOTAyNjIzNDkzJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMTkwMDk0ODYzOCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzM5MjIwNjU2OTQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcxMTYzMDM4OTA1JywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnMjI5OTExODU5OScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzUyODg3NjE0NicsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJzE0MTcxNjU5NzYnCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDUsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxMDYyNzg1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydfZ21wdG5sJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMTA2Mjc4NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnX2dtcHRubCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAndG9kYXlcXC5saW5lXFwubWUvLisvKG1haW58YXJ0aWNsZSknCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNDMKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgOTAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjEwNjI4MTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ19nbXB0bmwnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0b2RheVxcLmxpbmVcXC5tZS8uKy8obWFpbnxhcnRpY2xlKScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MwogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxMDYzOTE2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyd3ZWJraXQubWVzc2FnZUhhbmRsZXJzLl9nbXB0bmwnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxMDYzOTE3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyd3ZWJraXQubWVzc2FnZUhhbmRsZXJzLl9nbXB0bmwnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RvZGF5XFwubGluZVxcLm1lLy4rLyhtYWlufGFydGljbGUpJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDkwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxMDY0MTEzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyd3ZWJraXQubWVzc2FnZUhhbmRsZXJzLl9nbXB0bmwnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICd0b2RheVxcLmxpbmVcXC5tZS8uKy8obWFpbnxhcnRpY2xlKScKICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NAogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjA0MzddLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjA0MzgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYwNDM5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIyMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMjQKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYwODM3XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYwODM4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzY4Mjc5NTU2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzY2ODA5NDEzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MTQ4Ml0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MTQ4MywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM2MDI0NTU5NywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ1MzYwMjU0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0OTQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwMDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBbmRyb2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDU1MDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjMwMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNjAyNDU1OTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ5NCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FuZHJvaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTUwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUxNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDEyMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydzY2FyJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDg5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDA1ODgxMTA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNjAyNDU1OTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ5NCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FuZHJvaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTUwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUxNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDc1Mzc1MiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM2MDI0NTU5NywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDk0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MDAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQW5kcm9pZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3IudXNlckFnZW50J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1NTAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTE3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnZ21hU2RrLmdldFF1ZXJ5SW5mbyddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ3dlYmtpdC5tZXNzYWdlSGFuZGxlcnMuZ2V0R21hUXVlcnlJbmZvLnBvc3RNZXNzYWdlJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnd2Via2l0Lm1lc3NhZ2VIYW5kbGVycy5nZXRHbWFTaWcucG9zdE1lc3NhZ2UnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjE4MTRdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjE4MTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzODQ3MzQ2NDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUyOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjMwMTEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnc2NhciddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ4OQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNjAyNDU1OTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ5NCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FuZHJvaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTUwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUxNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2Mzg0MSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM2MDI0NTU5NywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDk0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MDAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQW5kcm9pZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3IudXNlckFnZW50J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1NTAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTE3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNDQ3NTM4MTNdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydnbWFTZGsuZ2V0UXVlcnlJbmZvJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnd2Via2l0Lm1lc3NhZ2VIYW5kbGVycy5nZXRHbWFRdWVyeUluZm8ucG9zdE1lc3NhZ2UnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyd3ZWJraXQubWVzc2FnZUhhbmRsZXJzLmdldEdtYVNpZy5wb3N0TWVzc2FnZSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYzMzc3XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzMzc4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5NTgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MzgyMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzgyMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MTA1NzM5NTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MzgyMl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzgyMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQwMjg0NzAxNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5NTksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjM4NzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjM4NzEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzg0NzAwMzYxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDY0MDI2XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MDI3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQxMzkyNTMwNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAwMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTM2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxMzYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTM2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDEzNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTM3CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDEzNwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxMzgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDEzOAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxMzgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTM5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxMzkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTM5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDE0MCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMjQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDY0MTQwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDE0MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxNDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2NDE0MQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjQxNDEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzQ0NzUyNTQwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0NzUyNTQxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM5OTU0NDU0OCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzQ0NzU3MTAwXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0NzU3MTAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM5ODc3Njg3OCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MAogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDAwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzEwNjMyMjMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYzMjI0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5NTQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ2CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbMzEwNjA4ODhdXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMzEwNjA4ODldLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MDg5MF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTA0CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MTE2NV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MTE2NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM2MzY1MDI1MSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYxMTY3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMzYzNjUwMjUxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMgogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNDQ3NDI3NjddLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs0NDc0Mjc2OF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzQ0NzUyNTg1XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0NzUyNTg2LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM5MjA2NTkwNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNDEKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzQ0NzUzNTA2XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ0NzUzNTA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM5MjA2NTkwNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzE4MTkwMTc2LDE1NTk1MzA0OCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc0OTk0NDUyOSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc1NDQxJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzYxNzcnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNjc4MiddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc2NTgxJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFs0NDc1NzA0NV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0NDc1NzA0NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOTg3NzY4NzgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWycxODE5MDE3NiwxNTU5NTMwNDgnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNDk5NDQ1MjknXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNTQ0MSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc2MTc3J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzY3ODInXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNjU4MSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgNDAKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbNDQ3NTczMDBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDQ3NTczMDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOTg3NzY4NzgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM5MTM4NTUwNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWycxODE5MDE3NiwxNTU5NTMwNDgnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc0OTk0NDUyOSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzU0NDEnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyc2MTc3J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnNjc4MiddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJzY1ODEnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MAogICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYxODI4XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYxODI5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMDMyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyMDAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdBbmRyb2lkJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzNjAyNDU1OTcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ5NCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FuZHJvaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNTUwMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUxNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTUKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMjAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzIxMDY1NzI0XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxMDY1NzI1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIwMywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ0xheW91dFNoaWZ0J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgNTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MDAwNiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQW5kcm9pZCcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ2hyb21lLyg4OXw5XFxkfFxcZHszLH0pJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3IudXNlckFnZW50J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyd3aW5kb3cuUGVyaW9kaWNTeW5jTWFuYWdlciddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYwMDA3LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5MjgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0FuZHJvaWQnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0Nocm9tZS8oODl8OVxcZHxcXGR7Myx9KScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnbmF2aWdhdG9yLnVzZXJBZ2VudCddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnd2luZG93LlBlcmlvZGljU3luY01hbmFnZXInXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgMjEKICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzMxMDYwMDMyXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMxMDYwMDMzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDE5MjgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIxCiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MTY5MF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MTY5MSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDgzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbMV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgODQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MzI0NF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzI0NSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzOTI3MzY0NzYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ1CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MzI0Nl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzI0NywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM5MjczNjQ3NiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWzFdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNDA2MTQ5ODM1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjAxCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdDaHJvbWUvKDlbMzQ1Njc4OV18XFxkezMsfSknLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3IudXNlckFnZW50J10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA5LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsnd2luZG93LlBlcmlvZGljU3luY01hbmFnZXInXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQ1CiAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFszMTA2MzkxMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2MzkxMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxOTQ4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDksCiAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbWzMxMDYzMDQ5XV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydjeGJiaGJ4bSddCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgIF1dCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgIDYsCiAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2Mzg3NywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLTEKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAzMTA2Mzg3OCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA1MDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsxXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDI5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDcsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0MAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUzCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDEyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ2hyb21lLyg5WzIzNDU2Nzg5XXxcXGR7Myx9KScsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbJ25hdmlnYXRvci51c2VyQWdlbnQnXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW1sKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWyduYXZpZ2F0b3Iuc2VydmljZVdvcmtlci5jb250cm9sbGVyJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBbCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgWydkb2N1bWVudC5oZWFkLmFwcGVuZENoaWxkJ10KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgICAgICAgICAgICAgXV0KICAgICAgICAgICAgICAgIF0KICAgICAgICAgICAgXSwKICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgbnVsbCwKICAgICAgICAgICAgWwogICAgICAgICAgICAgICAgMC4wMDEsCiAgICAgICAgICAgICAgICAxMDAwLAogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDEwMDAKICAgICAgICAgICAgXQogICAgICAgIF0pKTsKICAgIH0oKSkKfQ=="}] \ No newline at end of file diff --git a/metadata.json b/metadata.json index fe95c36e..343e96bc 100644 --- a/metadata.json +++ b/metadata.json @@ -17,10 +17,202 @@ }, { "name": "brave-fix", - "aliases": ["bf"], + "aliases": [], "kind": { "mime": "application/javascript" }, "resourcePath": "brave-fix.js" + }, + { + "name": "sugarcoat-0034123910e2a05f7a8ad0c58ef06f3bd4542217", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-0034123910e2a05f7a8ad0c58ef06f3bd4542217" + }, + { + "name": "sugarcoat-01f64c522910b028219e9cec1cc1847395faeead", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-01f64c522910b028219e9cec1cc1847395faeead" + }, + { + "name": "sugarcoat-076c7980e90e3f4c811295e17dcec5de21c8fd79", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-076c7980e90e3f4c811295e17dcec5de21c8fd79" + }, + { + "name": "sugarcoat-0df9436bcc867b94a71bac256f2dba3713a377a0", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-0df9436bcc867b94a71bac256f2dba3713a377a0" + }, + { + "name": "sugarcoat-20d16a205863d5a0eb56d0490a10be62d27324b9", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-20d16a205863d5a0eb56d0490a10be62d27324b9" + }, + { + "name": "sugarcoat-501fa30f9f8155b71c084d4272d83dbd84a50120", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-501fa30f9f8155b71c084d4272d83dbd84a50120" + }, + { + "name": "sugarcoat-646e5b5090e12bb4f057679af94c25920631ff46", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-646e5b5090e12bb4f057679af94c25920631ff46" + }, + { + "name": "sugarcoat-78a233d465e2385b4f1804ca5bfbacecc08cc23b", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-78a233d465e2385b4f1804ca5bfbacecc08cc23b" + }, + { + "name": "sugarcoat-7cf18f09d6a063650697adab76d51d51cddc3f58", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-7cf18f09d6a063650697adab76d51d51cddc3f58" + }, + { + "name": "sugarcoat-7ef6938db3b17aa422131955b7760870bc69ac0c", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-7ef6938db3b17aa422131955b7760870bc69ac0c" + }, + { + "name": "sugarcoat-821a7439b994eb58f64748b0553bf1d5b78a731d", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-821a7439b994eb58f64748b0553bf1d5b78a731d" + }, + { + "name": "sugarcoat-8a781a44c232f576b9148f440e69f1a64d74d543", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-8a781a44c232f576b9148f440e69f1a64d74d543" + }, + { + "name": "sugarcoat-8c173320401d8fc5291c1ea5e26e89a50fb17a42", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-8c173320401d8fc5291c1ea5e26e89a50fb17a42" + }, + { + "name": "sugarcoat-8db49593133758f7fe84678381f329915b2ccbe3", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-8db49593133758f7fe84678381f329915b2ccbe3" + }, + { + "name": "sugarcoat-972e8be011822bca0cb25ecca1f34fd347ca4875", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-972e8be011822bca0cb25ecca1f34fd347ca4875" + }, + { + "name": "sugarcoat-a8259f1424fe238ddadb822d18e5b54e9da87475", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-a8259f1424fe238ddadb822d18e5b54e9da87475" + }, + { + "name": "sugarcoat-bc51028c5fccd8dec101b0f2fc0e2887b1e7ef5e", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-bc51028c5fccd8dec101b0f2fc0e2887b1e7ef5e" + }, + { + "name": "sugarcoat-cce8c1365e310397573f250aac085a12a8319bb7", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-cce8c1365e310397573f250aac085a12a8319bb7" + }, + { + "name": "sugarcoat-d46a0542506f49cf865d98cb5ffd6c7a7854adb7", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-d46a0542506f49cf865d98cb5ffd6c7a7854adb7" + }, + { + "name": "sugarcoat-dfc7510b217a08b434f81d37728e218b563e02e5", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-dfc7510b217a08b434f81d37728e218b563e02e5" + }, + { + "name": "sugarcoat-e40cf8b1b251a846b2adda42a1521d0b92745c79", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-e40cf8b1b251a846b2adda42a1521d0b92745c79" + }, + { + "name": "sugarcoat-ef97e7e3be5379b2e3627791e936581f734402bd", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-ef97e7e3be5379b2e3627791e936581f734402bd" + }, + { + "name": "sugarcoat-f542409ccbdc9bf05ab43353222723e26ac37628", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-f542409ccbdc9bf05ab43353222723e26ac37628" + }, + { + "name": "sugarcoat-f7ada209562e58fd31703fb8f6187652f7e75ed2", + "aliases": [], + "kind": { + "mime": "application/javascript" + }, + "resourcePath": "sugarcoat-f7ada209562e58fd31703fb8f6187652f7e75ed2" } -] +] \ No newline at end of file diff --git a/resources/sugarcoat-0034123910e2a05f7a8ad0c58ef06f3bd4542217 b/resources/sugarcoat-0034123910e2a05f7a8ad0c58ef06f3bd4542217 new file mode 100644 index 00000000..4c431718 --- /dev/null +++ b/resources/sugarcoat-0034123910e2a05f7a8ad0c58ef06f3bd4542217 @@ -0,0 +1,1727 @@ +{ + const $___mock_b46b3bb46442fc90 = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_b46b3bb46442fc90); + (function () { + !function (e) { + if ('object' == typeof exports && 'undefined' != typeof module) + module.exports = e(); + else if ('function' == typeof define && define.amd) + define([], e); + else { + ('undefined' != typeof window ? window : 'undefined' != typeof global ? global : 'undefined' != typeof self ? self : this).bugsnag = e(); + } + }(function () { + function e(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + function t(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + function n() { + return J((Math.random() * re << 0).toString(ne), te); + } + function r() { + return ee = ee < re ? ee : 0, ++ee - 1; + } + function i() { + return 'c' + new Date().getTime().toString(ne) + J(r().toString(ne), te) + Q() + (n() + n()); + } + function o(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + function a(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + function s(e) { + var t = [e.tagName]; + if (e.id && t.push('#' + e.id), e.className && e.className.length && t.push('.' + e.className.split(' ').join('.')), !document.querySelectorAll || !Array.prototype.indexOf) + return t.join(''); + try { + if (1 === document.querySelectorAll(t.join('')).length) + return t.join(''); + } catch (r) { + return t.join(''); + } + if (e.parentNode.childNodes.length > 1) { + var n = Array.prototype.indexOf.call(e.parentNode.childNodes, e) + 1; + t.push(':nth-child(' + n + ')'); + } + return 1 === document.querySelectorAll(t.join('')).length ? t.join('') : e.parentNode ? s(e.parentNode) + ' > ' + t.join('') : t.join(''); + } + function u(e, t) { + return e && e.length <= t ? e : e.slice(0, t - '(...)'.length) + '(...)'; + } + function c() { + if (!tt(rt(), this[Qe])) { + var e = { + status: this.status, + request: this[et] + ' ' + this[Qe] + }; + this.status >= 400 ? nt.leaveBreadcrumb('XMLHttpRequest failed', e, Ze) : nt.leaveBreadcrumb('XMLHttpRequest succeeded', e, Ze); + } + } + function f() { + tt(rt(), this[Qe]) || nt.leaveBreadcrumb('XMLHttpRequest error', { request: this[et] + ' ' + this[Qe] }, Ze); + } + function d(e) { + return '[Throws: ' + (e ? e.message : '?') + ']'; + } + function l(e, t) { + for (var n = 0, r = e.length; n < r; n++) + if (e[n] === t) + return !0; + return !1; + } + function g(e) { + return '[object Array]' === Object.prototype.toString.call(e); + } + function p(e, t) { + try { + return e[t]; + } catch (n) { + return d(n); + } + } + function h(e) { + function t(e, i) { + function o() { + return i > xt && r > Dt; + } + if (r++, i === undefined && (i = 0), i > Bt) + return Lt; + if (o()) + return Lt; + if (null === e || 'object' != typeof e) + return e; + if (l(n, e)) + return '[Circular]'; + if (n.push(e), 'function' == typeof e.toJSON) + try { + r--; + var a = t(e.toJSON(), i); + return n.pop(), a; + } catch (m) { + return d(m); + } + if (g(e)) { + for (var s = [], u = 0, c = e.length; u < c; u++) { + if (o()) { + s.push(Lt); + break; + } + s.push(t(e[u], i + 1)); + } + return n.pop(), s; + } + var f = {}; + try { + for (var h in e) + if (Object.prototype.hasOwnProperty.call(e, h)) { + if (o()) { + f[h] = Lt; + break; + } + f[h] = t(p(e, h), i + 1); + } + } catch (v) { + } + return n.pop(), f; + } + var n = [], r = 0; + return t(e); + } + var m = function (e, t, n) { + for (var r = n, i = 0, o = e.length; i < o; i++) + r = t(r, e[i], i, e); + return r; + }, v = !{ toString: null }.propertyIsEnumerable('toString'), y = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ], b = function (e) { + return e < 10 ? '0' + e : e; + }, w = { + map: function (e, t) { + return m(e, function (e, n, r, i) { + return e.concat(t(n, r, i)); + }, []); + }, + reduce: m, + filter: function (e, t) { + return m(e, function (e, n, r, i) { + return t(n, r, i) ? e.concat(n) : e; + }, []); + }, + includes: function (e, t) { + return m(e, function (e, n, r, i) { + return !0 === e || n === t; + }, !1); + }, + keys: function (e) { + var t = [], n = void 0; + for (n in e) + Object.prototype.hasOwnProperty.call(e, n) && t.push(n); + if (!v) + return t; + for (var r = 0, i = y.length; r < i; r++) + Object.prototype.hasOwnProperty.call(e, y[r]) && t.push(y[r]); + return t; + }, + isArray: function (e) { + return '[object Array]' === Object.prototype.toString.call(e); + }, + isoDate: function () { + var e = new Date(); + return e.getUTCFullYear() + '-' + b(e.getUTCMonth() + 1) + '-' + b(e.getUTCDate()) + 'T' + b(e.getUTCHours()) + ':' + b(e.getUTCMinutes()) + ':' + b(e.getUTCSeconds()) + '.' + (e.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z'; + } + }, S = w.isoDate, O = function () { + function t() { + var n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '[anonymous]', r = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'manual', o = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : S(); + e(this, t), this.type = i, this.name = n, this.metaData = r, this.timestamp = o; + } + return t.prototype.toJSON = function () { + return { + type: this.type, + name: this.name, + timestamp: this.timestamp, + metaData: this.metaData + }; + }, t; + }(), j = {}, E = w.includes; + j.positiveIntIfDefined = function (e) { + return E([ + 'undefined', + 'number' + ], typeof e) && parseInt('' + e, 10) === e && e > 0; + }, j.stringWithLength = function (e) { + return 'string' == typeof e && !!e.length; + }; + var N = {}, R = w.filter, k = w.reduce, B = w.keys, D = w.isArray, x = w.includes, L = j.positiveIntIfDefined, _ = j.stringWithLength; + N.schema = { + apiKey: { + defaultValue: function () { + return null; + }, + message: 'is required', + validate: _ + }, + appVersion: { + defaultValue: function () { + return null; + }, + message: 'should be a string', + validate: function (e) { + return null === e || _(e); + } + }, + autoNotify: { + defaultValue: function () { + return !0; + }, + message: 'should be true|false', + validate: function (e) { + return !0 === e || !1 === e; + } + }, + beforeSend: { + defaultValue: function () { + return []; + }, + message: 'should be a function or array of functions', + validate: function (e) { + return 'function' == typeof e || D(e) && R(e, function (e) { + return 'function' == typeof e; + }).length === e.length; + } + }, + endpoints: { + defaultValue: function () { + return { + notify: 'https://notify.bugsnag.com', + sessions: 'https://sessions.bugsnag.com' + }; + }, + message: 'should be an object containing endpoint URLs { notify, sessions }. sessions is optional if autoCaptureSessions=false', + validate: function (e, t) { + return e && 'object' == typeof e && _(e.notify) && (!1 === t.autoCaptureSessions || _(e.sessions)) && 0 === R(B(e), function (e) { + return !x([ + 'notify', + 'sessions' + ], e); + }).length; + } + }, + autoCaptureSessions: { + defaultValue: function (e, t) { + return t.endpoints === undefined || !!t.endpoints && !!t.endpoints.sessions; + }, + message: 'should be true|false', + validate: function (e) { + return !0 === e || !1 === e; + } + }, + notifyReleaseStages: { + defaultValue: function () { + return null; + }, + message: 'should be an array of strings', + validate: function (e) { + return null === e || D(e) && R(e, function (e) { + return 'string' == typeof e; + }).length === e.length; + } + }, + releaseStage: { + defaultValue: function () { + return 'production'; + }, + message: 'should be a string', + validate: function (e) { + return 'string' == typeof e && e.length; + } + }, + maxBreadcrumbs: { + defaultValue: function () { + return 20; + }, + message: 'should be a number \u226440', + validate: function (e) { + return 0 === e || L(e) && (e === undefined || e <= 40); + } + }, + autoBreadcrumbs: { + defaultValue: function () { + return !0; + }, + message: 'should be true|false', + validate: function (e) { + return 'boolean' == typeof e; + } + }, + user: { + defaultValue: function () { + return null; + }, + message: '(object) user should be an object', + validate: function (e) { + return 'object' == typeof e; + } + }, + metaData: { + defaultValue: function () { + return null; + }, + message: 'should be an object', + validate: function (e) { + return 'object' == typeof e; + } + }, + logger: { + defaultValue: function () { + return undefined; + }, + message: 'should be null or an object with methods { debug, info, warn, error }', + validate: function (e) { + return !e || e && k([ + 'debug', + 'info', + 'warn', + 'error' + ], function (t, n) { + return t && 'function' == typeof e[n]; + }, !0); + } + } + }, N.mergeDefaults = function (e, t) { + if (!e || !t) + throw new Error('opts and schema objects are required'); + return k(B(t), function (n, r) { + return n[r] = e[r] !== undefined ? e[r] : t[r].defaultValue(e[r], e), n; + }, {}); + }, N.validate = function (e, t) { + if (!e || !t) + throw new Error('opts and schema objects are required'); + var n = k(B(t), function (n, r) { + return t[r].validate(e[r], e) ? n : n.concat({ + key: r, + message: t[r].message, + value: e[r] + }); + }, []); + return { + valid: !n.length, + errors: n + }; + }; + var C = function (e) { + return e.app && 'string' == typeof e.app.releaseStage ? e.app.releaseStage : e.config.releaseStage; + }, q = function (e) { + return !(!e || !e.stack && !e.stacktrace && !e['opera#sourceloc'] || 'string' != typeof (e.stack || e.stacktrace || e['opera#sourceloc']) || e.stack === e.name + ': ' + e.message); + }, T = {}; + !function (e, t) { + 'use strict'; + 'object' == typeof T ? T = t() : e.StackFrame = t(); + }(this, function () { + 'use strict'; + function e(e) { + return !isNaN(parseFloat(e)) && isFinite(e); + } + function t(e) { + return e.charAt(0).toUpperCase() + e.substring(1); + } + function n(e) { + return function () { + return this[e]; + }; + } + function r(e) { + if (e instanceof Object) + for (var n = 0; n < u.length; n++) + e.hasOwnProperty(u[n]) && e[u[n]] !== undefined && this['set' + t(u[n])](e[u[n]]); + } + var i = [ + 'isConstructor', + 'isEval', + 'isNative', + 'isToplevel' + ], o = [ + 'columnNumber', + 'lineNumber' + ], a = [ + 'fileName', + 'functionName', + 'source' + ], s = ['args'], u = i.concat(o, a, s); + r.prototype = { + getArgs: function () { + return this.args; + }, + setArgs: function (e) { + if ('[object Array]' !== Object.prototype.toString.call(e)) + throw new TypeError('Args must be an Array'); + this.args = e; + }, + getEvalOrigin: function () { + return this.evalOrigin; + }, + setEvalOrigin: function (e) { + if (e instanceof r) + this.evalOrigin = e; + else { + if (!(e instanceof Object)) + throw new TypeError('Eval Origin must be an Object or StackFrame'); + this.evalOrigin = new r(e); + } + }, + toString: function () { + return (this.getFunctionName() || '{anonymous}') + ('(' + (this.getArgs() || []).join(',') + ')') + (this.getFileName() ? '@' + this.getFileName() : '') + (e(this.getLineNumber()) ? ':' + this.getLineNumber() : '') + (e(this.getColumnNumber()) ? ':' + this.getColumnNumber() : ''); + } + }; + for (var c = 0; c < i.length; c++) + r.prototype['get' + t(i[c])] = n(i[c]), r.prototype['set' + t(i[c])] = function (e) { + return function (t) { + this[e] = Boolean(t); + }; + }(i[c]); + for (var f = 0; f < o.length; f++) + r.prototype['get' + t(o[f])] = n(o[f]), r.prototype['set' + t(o[f])] = function (t) { + return function (n) { + if (!e(n)) + throw new TypeError(t + ' must be a Number'); + this[t] = Number(n); + }; + }(o[f]); + for (var d = 0; d < a.length; d++) + r.prototype['get' + t(a[d])] = n(a[d]), r.prototype['set' + t(a[d])] = function (e) { + return function (t) { + this[e] = String(t); + }; + }(a[d]); + return r; + }); + var A = {}; + !function (e, t) { + 'use strict'; + 'object' == typeof A ? A = t(T) : e.ErrorStackParser = t(e.StackFrame); + }(this, function (e) { + 'use strict'; + var t = /(^|@)\S+\:\d+/, n = /^\s*at .*(\S+\:\d+|\(native\))/m, r = /^(eval@)?(\[native code\])?$/; + return { + parse: function (e) { + if ('undefined' != typeof e.stacktrace || 'undefined' != typeof e['opera#sourceloc']) + return this.parseOpera(e); + if (e.stack && e.stack.match(n)) + return this.parseV8OrIE(e); + if (e.stack) + return this.parseFFOrSafari(e); + throw new Error('Cannot parse given Error object'); + }, + extractLocation: function (e) { + if (-1 === e.indexOf(':')) + return [e]; + var t = /(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(e.replace(/[\(\)]/g, '')); + return [ + t[1], + t[2] || undefined, + t[3] || undefined + ]; + }, + parseV8OrIE: function (t) { + return t.stack.split('\n').filter(function (e) { + return !!e.match(n); + }, this).map(function (t) { + t.indexOf('(eval ') > -1 && (t = t.replace(/eval code/g, 'eval').replace(/(\(eval at [^\()]*)|(\)\,.*$)/g, '')); + var n = t.replace(/^\s+/, '').replace(/\(eval code/g, '(').split(/\s+/).slice(1), r = this.extractLocation(n.pop()), i = n.join(' ') || undefined, o = [ + 'eval', + '' + ].indexOf(r[0]) > -1 ? undefined : r[0]; + return new e({ + functionName: i, + fileName: o, + lineNumber: r[1], + columnNumber: r[2], + source: t + }); + }, this); + }, + parseFFOrSafari: function (t) { + return t.stack.split('\n').filter(function (e) { + return !e.match(r); + }, this).map(function (t) { + if (t.indexOf(' > eval') > -1 && (t = t.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g, ':$1')), -1 === t.indexOf('@') && -1 === t.indexOf(':')) + return new e({ functionName: t }); + var n = /((.*".+"[^@]*)?[^@]*)(?:@)/, r = t.match(n), i = r && r[1] ? r[1] : undefined, o = this.extractLocation(t.replace(n, '')); + return new e({ + functionName: i, + fileName: o[0], + lineNumber: o[1], + columnNumber: o[2], + source: t + }); + }, this); + }, + parseOpera: function (e) { + return !e.stacktrace || e.message.indexOf('\n') > -1 && e.message.split('\n').length > e.stacktrace.split('\n').length ? this.parseOpera9(e) : e.stack ? this.parseOpera11(e) : this.parseOpera10(e); + }, + parseOpera9: function (t) { + for (var n = /Line (\d+).*script (?:in )?(\S+)/i, r = t.message.split('\n'), i = [], o = 2, a = r.length; o < a; o += 2) { + var s = n.exec(r[o]); + s && i.push(new e({ + fileName: s[2], + lineNumber: s[1], + source: r[o] + })); + } + return i; + }, + parseOpera10: function (t) { + for (var n = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i, r = t.stacktrace.split('\n'), i = [], o = 0, a = r.length; o < a; o += 2) { + var s = n.exec(r[o]); + s && i.push(new e({ + functionName: s[3] || undefined, + fileName: s[2], + lineNumber: s[1], + source: r[o] + })); + } + return i; + }, + parseOpera11: function (n) { + return n.stack.split('\n').filter(function (e) { + return !!e.match(t) && !e.match(/^Error created at/); + }, this).map(function (t) { + var n, r = t.split('@'), i = this.extractLocation(r.pop()), o = r.shift() || '', a = o.replace(//, '$2').replace(/\([^\)]*\)/g, '') || undefined; + o.match(/\(([^\)]*)\)/) && (n = o.replace(/^[^\(]+\(([^\)]*)\)$/, '$1')); + var s = n === undefined || '[arguments not available]' === n ? undefined : n.split(','); + return new e({ + functionName: a, + args: s, + fileName: i[0], + lineNumber: i[1], + columnNumber: i[2], + source: t + }); + }, this); + } + }; + }); + var M = {}; + !function (e, t) { + 'use strict'; + 'object' == typeof M ? M = t(T) : e.StackGenerator = t(e.StackFrame); + }(this, function (e) { + return { + backtrace: function (t) { + var n = [], r = 10; + 'object' == typeof t && 'number' == typeof t.maxStackSize && (r = t.maxStackSize); + for (var i = arguments.callee; i && n.length < r && i.arguments;) { + for (var o = new Array(i.arguments.length), a = 0; a < o.length; ++a) + o[a] = i.arguments[a]; + /function(?:\s+([\w$]+))+\s*\(/.test(i.toString()) ? n.push(new e({ + functionName: RegExp.$1 || undefined, + args: o + })) : n.push(new e({ args: o })); + try { + i = i.caller; + } catch (s) { + break; + } + } + return n; + } + }; + }); + var P = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }, V = w.reduce, H = w.filter, U = function () { + function e(n, r) { + var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [], o = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : F(); + t(this, e), this.__isBugsnagReport = !0, this._ignored = !1, this._handledState = o, this.app = undefined, this.apiKey = undefined, this.breadcrumbs = [], this.context = undefined, this.device = undefined, this.errorClass = K(n, '[no error class]'), this.errorMessage = K(r, '[no error message]'), this.groupingHash = undefined, this.metaData = {}, this.request = undefined, this.severity = this._handledState.severity, this.stacktrace = V(i, function (e, t) { + var n = I(t); + try { + return '{}' === JSON.stringify(n) ? e : e.concat(n); + } catch (r) { + return e; + } + }, []), this.user = undefined, this.session = undefined; + } + return e.prototype.ignore = function () { + this._ignored = !0; + }, e.prototype.isIgnored = function () { + return this._ignored; + }, e.prototype.updateMetaData = function (e) { + var t; + if (!e) + return this; + var n = void 0; + return null === (arguments.length <= 1 ? undefined : arguments[1]) ? this.removeMetaData(e) : null === (arguments.length <= 2 ? undefined : arguments[2]) ? this.removeMetaData(e, arguments.length <= 1 ? undefined : arguments[1], arguments.length <= 2 ? undefined : arguments[2]) : ('object' == typeof (arguments.length <= 1 ? undefined : arguments[1]) && (n = arguments.length <= 1 ? undefined : arguments[1]), 'string' == typeof (arguments.length <= 1 ? undefined : arguments[1]) && (t = {}, t[arguments.length <= 1 ? undefined : arguments[1]] = arguments.length <= 2 ? undefined : arguments[2], n = t), n ? (this.metaData[e] || (this.metaData[e] = {}), this.metaData[e] = P({}, this.metaData[e], n), this) : this); + }, e.prototype.removeMetaData = function (e, t) { + return 'string' != typeof e ? this : t ? this.metaData[e] ? (delete this.metaData[e][t], this) : this : (delete this.metaData[e], this); + }, e.prototype.toJSON = function () { + return { + payloadVersion: '4', + exceptions: [{ + errorClass: this.errorClass, + message: this.errorMessage, + stacktrace: this.stacktrace, + type: 'browserjs' + }], + severity: this.severity, + unhandled: this._handledState.unhandled, + severityReason: this._handledState.severityReason, + app: this.app, + device: this.device, + breadcrumbs: this.breadcrumbs, + context: this.context, + user: this.user, + metaData: this.metaData, + groupingHash: this.groupingHash, + request: this.request, + session: this.session + }; + }, e; + }(), I = function (e) { + var t = { + file: e.fileName, + method: $(e.functionName), + lineNumber: e.lineNumber, + columnNumber: e.columnNumber, + code: undefined, + inProject: undefined + }; + return t.lineNumber > -1 && !t.file && !t.method && (t.file = 'global code'), t; + }, $ = function (e) { + return /^global code$/i.test(e) ? 'global code' : e; + }, F = function () { + return { + unhandled: !1, + severity: 'warning', + severityReason: { type: 'handledException' } + }; + }, K = function (e, t) { + return 'string' == typeof e && e ? e : t; + }; + U.getStacktrace = function (e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + return q(e) ? A.parse(e).slice(t) : H(M.backtrace(), function (e) { + return -1 === (e.functionName || '').indexOf('StackGenerator$$'); + }).slice(1 + n); + }, U.ensureReport = function (e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + if (e.__isBugsnagReport) + return e; + try { + var r = U.getStacktrace(e, t, 1 + n); + return new U(e.name, e.message, r); + } catch (i) { + return new U(e.name, e.message, []); + } + }; + var X = U, J = function (e, t) { + var n = '000000000' + e; + return n.substr(n.length - t); + }, z = 'object' == typeof window ? window : self, G = 0; + for (var W in z) + Object.hasOwnProperty.call(z, W) && G++; + var Y = navigator.mimeTypes ? navigator.mimeTypes.length : 0, Z = J((Y + navigator.userAgent.length).toString(36) + G.toString(36), 4), Q = function () { + return Z; + }, ee = 0, te = 4, ne = 36, re = Math.pow(ne, te); + i.fingerprint = Q; + var ie = i, oe = w.isoDate, ae = function () { + function e() { + o(this, e), this.id = ie(), this.startedAt = oe(), this._handled = 0, this._unhandled = 0; + } + return e.prototype.toJSON = function () { + return { + id: this.id, + startedAt: this.startedAt, + events: { + handled: this._handled, + unhandled: this._unhandled + } + }; + }, e.prototype.trackError = function (e) { + this[e._handledState.unhandled ? '_unhandled' : '_handled'] += 1; + }, e; + }(), se = function (e) { + switch (Object.prototype.toString.call(e)) { + case '[object Error]': + case '[object Exception]': + case '[object DOMException]': + return !0; + default: + return e instanceof Error; + } + }, ue = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }, ce = w.map, fe = w.reduce, de = w.includes, le = w.isArray, ge = function () { + }, pe = function () { + function e(t) { + var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : N.schema, r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + if (a(this, e), !(t && t.name && t.version && t.url)) + throw new Error('`notifier` argument is required'); + this.notifier = t, this.configSchema = n, this._configured = !1, this._transport = { + sendSession: ge, + sendReport: ge + }, this._logger = { + debug: ge, + info: ge, + warn: ge, + error: ge + }, this.plugins = [], this.session = r, this.beforeSession = [], this.breadcrumbs = [], this.app = {}, this.context = undefined, this.device = undefined, this.metaData = undefined, this.request = undefined, this.user = {}, this.BugsnagReport = X, this.BugsnagBreadcrumb = O, this.BugsnagSession = ae; + } + return e.prototype.configure = function () { + var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + this.config = N.mergeDefaults(ue({}, this.config, e), this.configSchema); + var t = N.validate(this.config, this.configSchema); + if (!0 == !t.valid) + throw new Error(ve(t.errors)); + return 'function' == typeof this.config.beforeSend && (this.config.beforeSend = [this.config.beforeSend]), null !== this.config.appVersion && (this.app.version = this.config.appVersion), this.config.metaData && (this.metaData = this.config.metaData), this.config.user && (this.user = this.config.user), this.config.logger && this.logger(this.config.logger), this._configured = !0, this._logger.debug('Loaded!'), this; + }, e.prototype.use = function (e) { + return this.plugins.push(e), e.init(this); + }, e.prototype.transport = function (e) { + return this._transport = e, this; + }, e.prototype.logger = function (e, t) { + return this._logger = e, this; + }, e.prototype.sessionDelegate = function (e) { + return this._sessionDelegate = e, this; + }, e.prototype.startSession = function () { + return this._sessionDelegate ? this._sessionDelegate.startSession(this) : (this._logger.warn('No session implementation is installed'), this); + }, e.prototype.leaveBreadcrumb = function (e, t, n, r) { + if (!this._configured) + throw new Error('client not configured'); + if (e = e || undefined, n = 'string' == typeof n ? n : undefined, r = 'string' == typeof r ? r : undefined, t = 'object' == typeof t && null !== t ? t : undefined, 'string' == typeof e || t) { + var i = new O(e, t, n, r); + return this.breadcrumbs.push(i), this.breadcrumbs.length > this.config.maxBreadcrumbs && (this.breadcrumbs = this.breadcrumbs.slice(this.breadcrumbs.length - this.config.maxBreadcrumbs)), this; + } + }, e.prototype.notify = function (e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + if (!this._configured) + throw new Error('client not configured'); + var n = C(this), r = he(e, t, this._logger), i = r.err, o = r.errorFramesToSkip, a = r._opts; + if (a && (t = a), !i) { + var s = ye('nothing'); + this._logger.warn('Usage error. ' + s), i = new Error('Bugsnag usage error. ' + s); + } + 'object' == typeof t && null !== t || (t = {}); + var u = X.ensureReport(i, o, 1); + if (u.app = ue({ releaseStage: n }, u.app, this.app), u.context = u.context || t.context || this.context || undefined, u.device = ue({}, u.device, this.device, t.device), u.request = ue({}, u.request, this.request, t.request), u.user = ue({}, u.user, this.user, t.user), u.metaData = ue({}, u.metaData, this.metaData, t.metaData), u.breadcrumbs = this.breadcrumbs.slice(0), this.session && (this.session.trackError(u), u.session = this.session), t.severity !== undefined && (u.severity = t.severity, u._handledState.severityReason = { type: 'userSpecifiedSeverity' }), le(this.config.notifyReleaseStages) && !de(this.config.notifyReleaseStages, n)) + return this._logger.warn('Report not sent due to releaseStage/notifyReleaseStages configuration'), !1; + var c = u.severity, f = [].concat(t.beforeSend).concat(this.config.beforeSend); + return fe(f, function (e, t) { + return !0 === e || ('function' == typeof t && !1 === t(u) || !!u.isIgnored()); + }, !1) ? (this._logger.debug('Report not sent due to beforeSend callback'), !1) : (this.config.autoBreadcrumbs && this.leaveBreadcrumb(u.errorClass, { + errorClass: u.errorClass, + errorMessage: u.errorMessage, + severity: u.severity + }, 'error'), c !== u.severity && (u._handledState.severityReason = { type: 'userCallbackSetSeverity' }), this._transport.sendReport(this._logger, this.config, { + apiKey: u.apiKey || this.config.apiKey, + notifier: this.notifier, + events: [u] + }), !0); + }, e; + }(), he = function (e, t, n) { + var r = void 0, i = 0, o = void 0; + switch (typeof e) { + case 'string': + if ('string' == typeof t) { + var a = ye('string/string'); + n.warn('Usage error. ' + a), r = new Error('Bugsnag usage error. ' + a), o = { + metaData: { + notifier: { + notifyArgs: [ + e, + t + ] + } + } + }; + } else + r = new Error(String(e)), i += 2; + break; + case 'number': + case 'boolean': + r = new Error(String(e)); + break; + case 'function': + var s = ye('function'); + n.warn('Usage error. ' + s), r = new Error('Bugsnag usage error. ' + s); + break; + case 'object': + if (null !== e && (se(e) || e.__isBugsnagReport)) + r = e; + else if (null !== e && me(e)) + (r = new Error(e.message || e.errorMessage)).name = e.name || e.errorClass, i += 2; + else { + var u = ye('unsupported object'); + n.warn('Usage error. ' + u), r = new Error('Bugsnag usage error. ' + u); + } + } + return { + err: r, + errorFramesToSkip: i, + _opts: o + }; + }, me = function (e) { + return !('string' != typeof e.name && 'string' != typeof e.errorClass || 'string' != typeof e.message && 'string' != typeof e.errorMessage); + }, ve = function (e) { + return 'Bugsnag configuration error\n' + ce(e, function (e) { + return '"' + e.key + '" ' + e.message + ' \n got ' + be(e.value); + }).join('\n\n'); + }, ye = function (e) { + return 'notify() expected error/opts parameters, got ' + e; + }, be = function (e) { + return 'object' == typeof e ? JSON.stringify(e) : String(e); + }, we = pe, Se = j.positiveIntIfDefined, Oe = { + init: function (e) { + var t = 0; + e.config.beforeSend.push(function (n) { + if (t >= e.config.maxEvents) + return n.ignore(); + t++; + }), e.refresh = function () { + t = 0; + }; + }, + configSchema: { + maxEvents: { + defaultValue: function () { + return 10; + }, + message: 'should be a positive integer \u2264100', + validate: function (e) { + return Se(e) && e < 100; + } + } + } + }, je = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }, Ee = N.schema, Ne = w.map, Re = { + releaseStage: { + defaultValue: function () { + return /^localhost(:\d+)?$/.test(window.location.host) ? 'development' : 'production'; + }, + message: 'should be set', + validate: j.stringWithLength + }, + collectUserIp: { + defaultValue: function () { + return !0; + }, + message: 'should be true|false', + validate: function (e) { + return !0 === e || !1 === e; + } + }, + logger: je({}, Ee.logger, { + defaultValue: function () { + return 'undefined' != typeof console && 'function' == typeof console.debug ? ke() : undefined; + } + }) + }, ke = function () { + var e = {}, t = console.log; + return Ne([ + 'debug', + 'info', + 'warn', + 'error' + ], function (n) { + var r = console[n]; + e[n] = 'function' == typeof r ? r.bind(console, '[bugsnag]') : t.bind(console, '[bugsnag]'); + }), e; + }, Be = {}, De = w.map, xe = w.reduce, Le = w.filter; + Be.init = function (e) { + De(_e, function (t) { + var n = console[t]; + console[t] = function () { + for (var r = arguments.length, i = Array(r), o = 0; o < r; o++) + i[o] = arguments[o]; + e.leaveBreadcrumb('Console output', xe(i, function (e, t, n) { + var r = String(t); + if ('[object Object]' === r) + try { + r = JSON.stringify(t); + } catch (i) { + } + return e['[' + n + ']'] = r, e; + }, { severity: 0 === t.indexOf('group') ? 'log' : t }), 'log'), n.apply(console, i); + }, console[t]._restore = function () { + console[t] = n; + }; + }); + }, Be.configSchema = { + consoleBreadcrumbsEnabled: { + defaultValue: function () { + return undefined; + }, + validate: function (e) { + return !0 === e || !1 === e || e === undefined; + }, + message: 'should be true|false' + } + }; + var _e = Le([ + 'log', + 'debug', + 'info', + 'warn', + 'error' + ], function (e) { + return 'undefined' != typeof console && 'function' == typeof console[e]; + }), Ce = { + init: function (e) { + e.config.beforeSend.unshift(function (e) { + e.context || (e.context = window.location.pathname); + }); + } + }, qe = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }, Te = w.isoDate, Ae = { + init: function (e) { + e.config.beforeSend.unshift(function (e) { + e.device = qe({ + time: Te(), + locale: navigator.browserLanguage || navigator.systemLanguage || navigator.userLanguage || navigator.language, + userAgent: navigator.userAgent + }, e.device); + }), e.beforeSession.push(function (e) { + e.device = { userAgent: navigator.userAgent }; + }); + } + }, Me = {}, Pe = w.reduce, Ve = /^.*/, He = /<\/script>.*$/, Ue = (Me = { + init: function (e) { + var t = '', n = !1, r = function () { + return document.documentElement.outerHTML; + }, i = window.location.href; + t = r(), document.onreadystatechange = function () { + 'interactive' === document.readyState && (t = r(), n = !0); + }, e.config.beforeSend.unshift(function (e) { + var o = e.stacktrace[0]; + if (!o || !o.file || !o.lineNumber) + return o; + if (o.file.replace(/#.*$/, '') !== i.replace(/#.*$/, '')) + return o; + n && t || (t = r()); + var a = [''].concat(t.split('\n')), s = Ue(a, o.lineNumber - 1), u = s.script, c = s.start, f = Pe(u, function (e, t, n) { + return Math.abs(c + n + 1 - o.lineNumber) > 10 ? e : (e['' + (c + n + 1)] = t, e); + }, {}); + o.code = f, e.updateMetaData('script', { content: u.join('\n') }); + }); + } + }).extractScriptContent = function (e, t) { + for (var n = t; n < e.length && !He.test(e[n]);) + n++; + for (var r = n; n > 0 && !Ve.test(e[n]);) + n--; + var i = n, o = e.slice(i, r + 1); + return o[0] = o[0].replace(Ve, ''), o[o.length - 1] = o[o.length - 1].replace(He, ''), { + script: o, + start: i + }; + }, Ie = { + init: function (e) { + 'addEventListener' in window && window.addEventListener('click', function (t) { + var n = void 0, r = void 0; + try { + n = $e(t.target), r = s(t.target); + } catch (i) { + n = '[hidden]', r = '[hidden]', e._logger.error('Cross domain error when tracking click event. See docs: https://tinyurl.com/y94fq5zm'); + } + e.leaveBreadcrumb('UI click', { + targetText: n, + targetSelector: r + }, 'user'); + }, !0); + }, + configSchema: { + interactionBreadcrumbsEnabled: { + defaultValue: function () { + return undefined; + }, + validate: function (e) { + return !0 === e || !1 === e || e === undefined; + }, + message: 'should be true|false' + } + } + }, $e = function (e) { + var t = e.textContent || e.innerText || ''; + return t || 'submit' !== e.type && 'button' !== e.type || (t = e.value), t = t.replace(/^\s+|\s+$/g, ''), u(t, 140); + }, Fe = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }, Ke = { + init: function (e) { + e.config.collectUserIp || e.config.beforeSend.push(function (e) { + e.user = Fe({ id: '[NOT COLLECTED]' }, e.user), e.request = Fe({ clientIp: '[NOT COLLECTED]' }, e.request); + }); + } + }, Xe = {}; + Xe.init = function (e) { + if ('addEventListener' in window) { + var t = function (t) { + return function () { + return e.leaveBreadcrumb(t, {}, 'navigation'); + }; + }; + window.addEventListener('pagehide', t('Page hidden'), !0), window.addEventListener('pageshow', t('Page shown'), !0), window.addEventListener('load', t('Page loaded'), !0), window.document.addEventListener('DOMContentLoaded', t('DOMContentLoaded'), !0), window.addEventListener('load', function () { + return window.addEventListener('popstate', t('Navigated back'), !0); + }), window.addEventListener('hashchange', function (t) { + var n = t.oldURL ? { + from: Je(t.oldURL), + to: Je(t.newURL), + state: We() + } : { to: Je(window.location.href) }; + e.leaveBreadcrumb('Hash changed', n, 'navigation'); + }, !0), window.history.replaceState && Ge(e, window.history, 'replaceState'), window.history.pushState && Ge(e, window.history, 'pushState'), e.leaveBreadcrumb('Bugsnag loaded', {}, 'navigation'); + } + }, Xe.configSchema = { + navigationBreadcrumbsEnabled: { + defaultValue: function () { + return undefined; + }, + validate: function (e) { + return !0 === e || !1 === e || e === undefined; + }, + message: 'should be true|false' + } + }; + var Je = function (e) { + var t = document.createElement('A'); + return t.href = e, '' + t.pathname + t.search + t.hash; + }, ze = function (e, t, n) { + var r = Je(window.location.href); + return { + title: t, + state: e, + prevState: We(), + to: n || r, + from: r + }; + }, Ge = function (e, t, n) { + var r = t[n]; + t[n] = function (i, o, a) { + e.leaveBreadcrumb('History ' + n, ze(i, o, a), 'navigation'), 'function' == typeof e.refresh && e.refresh(), e.session && e.startSession(), r.apply(t, [ + i, + o + ].concat(a !== undefined ? a : [])); + }, t[n]._restore = function () { + t[n] = r; + }; + }, We = function () { + try { + return window.history.state; + } catch (e) { + } + }, Ye = {}, Ze = 'request', Qe = 'BS~~U', et = 'BS~~M', tt = w.includes, nt = void 0, rt = function () { + return [ + nt.config.endpoints.notify, + nt.config.endpoints.sessions + ]; + }; + Ye.init = function (e) { + nt = e, it(), ot(); + }, Ye.configSchema = { + networkBreadcrumbsEnabled: { + defaultValue: function () { + return undefined; + }, + validate: function (e) { + return !0 === e || !1 === e || e === undefined; + }, + message: 'should be true|false' + } + }; + var it = function () { + const $___old_c48096f1cd87d9aa = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_c48096f1cd87d9aa) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_b46b3bb46442fc90.XMLHttpRequest)); + return function () { + if ('addEventListener' in window.XMLHttpRequest.prototype) { + var e = window.XMLHttpRequest.prototype.open; + window.XMLHttpRequest.prototype.open = function (t, n) { + this[Qe] = n, this[et] = t, this['BS~~S'] && (this.removeEventListener('load', c), this.removeEventListener('error', f)), this.addEventListener('load', c), this.addEventListener('error', f), this['BS~~S'] = !0, e.apply(this, arguments); + }; + } + }.apply(this, arguments); + } finally { + if ($___old_c48096f1cd87d9aa) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_c48096f1cd87d9aa)); + } + }, ot = function () { + if ('fetch' in window) { + var e = window.fetch; + window.fetch = function () { + for (var t = arguments.length, n = Array(t), r = 0; r < t; r++) + n[r] = arguments[r]; + var i = n[0], o = n[1], a = 'GET'; + return o && o.method && (a = o.method), new Promise(function (t, r) { + e.apply(undefined, n).then(function (e) { + at(e, a, i), t(e); + })['catch'](function (e) { + st(a, i), r(e); + }); + }); + }; + } + }, at = function (e, t, n) { + var r = { + status: e.status, + request: t + ' ' + n + }; + e.status >= 400 ? nt.leaveBreadcrumb('fetch() failed', r, Ze) : nt.leaveBreadcrumb('fetch() succeeded', r, Ze); + }, st = function (e, t) { + nt.leaveBreadcrumb('fetch() error', { request: e + ' ' + t }, Ze); + }, ut = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }, ct = { + init: function (e) { + e.config.beforeSend.unshift(function (e) { + e.request && e.request.url || (e.request = ut({}, e.request, { url: window.location.href })); + }); + } + }, ft = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }, dt = w.map, lt = w.isArray, gt = w.includes, pt = { + init: function (e) { + return e.sessionDelegate(ht); + } + }, ht = { + startSession: function (e) { + var t = e; + t.session = new e.BugsnagSession(), dt(t.beforeSession, function (e) { + return e(t); + }); + var n = C(t); + return lt(t.config.notifyReleaseStages) && !gt(t.config.notifyReleaseStages, n) ? (t._logger.warn('Session not sent due to releaseStage/notifyReleaseStages configuration'), t) : t.config.endpoints.sessions ? (t._transport.sendSession(t._logger, t.config, { + notifier: t.notifier, + device: t.device, + app: ft({ releaseStage: n }, t.app), + sessions: [{ + id: t.session.id, + startedAt: t.session.startedAt, + user: t.user + }] + }), t) : (t._logger.warn('Session not sent due to missing endpoints.sessions configuration'), t); + } + }, mt = {}, vt = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }, yt = w.map, bt = (mt = { + init: function (e) { + e.config.beforeSend.push(function (e) { + e.stacktrace = yt(e.stacktrace, function (e) { + return vt({}, e, { file: bt(e.file) }); + }); + }); + } + })._strip = function (e) { + return 'string' == typeof e ? e.replace(/\?.*$/, '').replace(/#.*$/, '') : e; + }, wt = {}, St = w.reduce, Ot = void 0; + wt.init = function (e) { + var t = function (t) { + var n = t.reason, r = !1; + t.detail && t.detail.reason && (n = t.detail.reason, r = !0); + var i = { + severity: 'error', + unhandled: !0, + severityReason: { type: 'unhandledPromiseRejection' } + }, o = void 0; + if (n && q(n)) + o = new e.BugsnagReport(n.name, n.message, A.parse(n), i), r && (o.stacktrace = St(o.stacktrace, Et(n), [])); + else { + (o = new e.BugsnagReport(n && n.name ? n.name : 'UnhandledRejection', n && n.message ? n.message : 'Rejection reason was not an Error. See "Promise" tab for more detail.', [], i)).updateMetaData('promise', 'rejection reason', jt(n)); + } + e.notify(o); + }; + 'addEventListener' in window ? window.addEventListener('unhandledrejection', t) : window.onunhandledrejection = function (e, n) { + t({ + detail: { + reason: e, + promise: n + } + }); + }, Ot = t; + }; + var jt = function (e) { + if (null === e || e === undefined) + return 'undefined (or null)'; + if (se(e)) { + var t; + return t = {}, t[Object.prototype.toString.call(e)] = { + name: e.name, + message: e.message, + code: e.code, + stack: e.stack + }, t; + } + return e; + }, Et = function (e) { + return function (t, n) { + return n.file === e.toString() ? t : (n.method && (n.method = n.method.replace(/^\s+/, '')), t.concat(n)); + }; + }, Nt = { + init: function (e) { + var t = window.onerror; + window.onerror = function (n, r, i, o, a) { + if (0 === i && /Script error\.?/.test(n)) + e._logger.warn('Ignoring cross-domain or eval script error. See docs: https://tinyurl.com/y94fq5zm'); + else { + var s = { + severity: 'error', + unhandled: !0, + severityReason: { type: 'unhandledException' } + }, u = void 0; + if (a) + a.name && a.message ? u = new e.BugsnagReport(a.name, a.message, Rt(e.BugsnagReport.getStacktrace(a), r, i, o), s) : (u = new e.BugsnagReport('window.onerror', String(a), Rt(e.BugsnagReport.getStacktrace(a, 1), r, i, o), s)).updateMetaData('window onerror', { error: a }); + else if ('object' != typeof n || null === n || r || i || o || a) + (u = new e.BugsnagReport('window.onerror', String(n), Rt(e.BugsnagReport.getStacktrace(a, 1), r, i, o), s)).updateMetaData('window onerror', { event: n }); + else { + var c = n.type ? 'Event: ' + n.type : 'window.onerror', f = n.message || n.detail || ''; + (u = new e.BugsnagReport(c, f, e.BugsnagReport.getStacktrace(new Error(), 1).slice(1), s)).updateMetaData('window onerror', { event: n }); + } + e.notify(u), 'function' == typeof t && t(n, r, i, o, a); + } + }; + } + }, Rt = function (e, t, n, r) { + var i = e[0]; + return i ? (i.fileName || i.setFileName(t), i.lineNumber || i.setLineNumber(n), i.columnNumber || (r !== undefined ? i.setColumnNumber(r) : window.event && window.event.errorCharacter && i.setColumnNumber(window.event && window.event.errorCharacter)), e) : e; + }, kt = function (e, t, n) { + return JSON.stringify(h(e), t, n); + }, Bt = 20, Dt = 25000, xt = 8, Lt = '...', _t = function (e) { + var t = kt(e); + if (t.length > 1000000 && (delete e.events[0].metaData, e.events[0].metaData = { notifier: 'WARNING!\nSerialized payload was ' + t.length / 1000000 + 'MB (limit = 1MB)\nmetaData was removed' }, (t = kt(e)).length > 1000000)) + throw new Error('payload exceeded 1MB limit'); + return t; + }, Ct = {}, qt = w.isoDate; + Ct = { + sendReport: function (e, t, n) { + var r = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () { + }, i = Tt(t, 'notify', '4.0'), o = new window.XDomainRequest(); + o.onload = function () { + r(null, o.responseText); + }, o.open('POST', i), setTimeout(function () { + try { + o.send(_t(n)); + } catch (t) { + e.error(t); + } + }, 0); + }, + sendSession: function (e, t, n) { + var r = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () { + }, i = Tt(t, 'sessions', '1.0'), o = new window.XDomainRequest(); + o.onload = function () { + r(null, o.responseText); + }, o.open('POST', i), setTimeout(function () { + try { + o.send(kt(n)); + } catch (t) { + e.error(t); + } + }, 0); + } + }; + var Tt = function (e, t, n) { + return At(e.endpoints[t], window.location.protocol) + '?apiKey=' + encodeURIComponent(e.apiKey) + '&payloadVersion=' + n + '&sentAt=' + encodeURIComponent(qt()); + }, At = Ct._matchPageProtocol = function (e, t) { + return 'http:' === t ? e.replace(/^https:/, 'http:') : e; + }, Mt = w.isoDate, Pt = { + sendReport: function (e, t, n) { + var r = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () { + }; + try { + var i = t.endpoints.notify, o = new window.XMLHttpRequest(); + o.onreadystatechange = function () { + o.readyState === window.XMLHttpRequest.DONE && r(null, o.responseText); + }, o.open('POST', i), o.setRequestHeader('Content-Type', 'application/json'), o.setRequestHeader('Bugsnag-Api-Key', n.apiKey || t.apiKey), o.setRequestHeader('Bugsnag-Payload-Version', '4.0'), o.setRequestHeader('Bugsnag-Sent-At', Mt()), o.send(_t(n)); + } catch (a) { + e.error(a); + } + }, + sendSession: function (e, t, n) { + const $___old_f74c694db82a2381 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_72bb1fe01284c5dc = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_f74c694db82a2381) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_b46b3bb46442fc90.XMLHttpRequest)); + if ($___old_72bb1fe01284c5dc) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_b46b3bb46442fc90.XMLHttpRequest)); + return function () { + var r = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () { + }; + try { + var i = t.endpoints.sessions, o = new window.XMLHttpRequest(); + o.onreadystatechange = function () { + const $___old_1a397af9e16dd935 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_1a397af9e16dd935) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_b46b3bb46442fc90.XMLHttpRequest)); + return function () { + o.readyState === window.XMLHttpRequest.DONE && r(null, o.responseText); + }.apply(this, arguments); + } finally { + if ($___old_1a397af9e16dd935) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_1a397af9e16dd935)); + } + }, o.open('POST', i), o.setRequestHeader('Content-Type', 'application/json'), o.setRequestHeader('Bugsnag-Api-Key', t.apiKey), o.setRequestHeader('Bugsnag-Payload-Version', '1.0'), o.setRequestHeader('Bugsnag-Sent-At', Mt()), o.send(kt(n)); + } catch (a) { + e.error(a); + } + }.apply(this, arguments); + } finally { + if ($___old_f74c694db82a2381) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_f74c694db82a2381)); + if ($___old_72bb1fe01284c5dc) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_72bb1fe01284c5dc)); + } + } + }, Vt = {}, Ht = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }, Ut = w.map, It = w.reduce, $t = Ht({}, N.schema, Re), Ft = [ + Nt, + wt, + Ae, + Ce, + ct, + Oe, + Be, + Ye, + Xe, + Ie, + Me, + pt, + Ke, + mt + ]; + Vt = function (e) { + var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + 'string' == typeof e && (e = { apiKey: e }); + var n = []; + e.sessionTrackingEnabled && (n.push('deprecated option sessionTrackingEnabled is now called autoCaptureSessions'), e.autoCaptureSessions = e.sessionTrackingEnabled), !e.endpoint && !e.sessionEndpoint || e.endpoints || (n.push('deprecated options endpoint/sessionEndpoint are now configured in the endpoints object'), e.endpoints = { + notify: e.endpoint, + sessions: e.sessionEndpoint + }), e.endpoints && e.endpoints.notify && !e.endpoints.sessions && n.push('notify endpoint is set but sessions endpoint is not. No sessions will be sent.'); + var r = It([].concat(Ft).concat(t), function (e, t) { + return t.configSchema ? Ht({}, e, t.configSchema) : e; + }, $t), i = new we({ + name: 'Bugsnag JavaScript', + version: '4.7.3', + url: 'https://github.com/bugsnag/bugsnag-js' + }, r); + return i.transport(window.XDomainRequest ? Ct : Pt), i.configure(e), Ut(n, function (e) { + return i._logger.warn(e); + }), i.use(Ae), i.use(Ce), i.use(ct), i.use(Me), i.use(Oe), i.use(pt), i.use(Ke), i.use(mt), !1 !== i.config.autoNotify && (i.use(Nt), i.use(wt)), Kt(i.config, 'navigationBreadcrumbsEnabled') && i.use(Xe), Kt(i.config, 'interactionBreadcrumbsEnabled') && i.use(Ie), Kt(i.config, 'networkBreadcrumbsEnabled') && i.use(Ye), Kt(i.config, 'consoleBreadcrumbsEnabled', !1) && i.use(Be), Ut(t, function (e) { + return i.use(e); + }), i.config.autoCaptureSessions ? i.startSession() : i; + }; + var Kt = function (e, t) { + var n = !(arguments.length > 2 && arguments[2] !== undefined) || arguments[2]; + return 'boolean' == typeof e[t] ? e[t] : e.autoBreadcrumbs && (n || !/^dev(elopment)?$/.test(e.releaseStage)); + }; + return Vt.Bugsnag = { + Client: we, + Report: X, + Session: ae, + Breadcrumb: O + }, Vt['default'] = Vt, Vt; + }); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-01f64c522910b028219e9cec1cc1847395faeead b/resources/sugarcoat-01f64c522910b028219e9cec1cc1847395faeead new file mode 100644 index 00000000..510aadc1 --- /dev/null +++ b/resources/sugarcoat-01f64c522910b028219e9cec1cc1847395faeead @@ -0,0 +1,3061 @@ +var fdx_initSCVars, fdx_debug, fdx_setCookie, fdx_getCookie, fdx_campaign, fdx_gup, fdx_fireSDotT, fdx_fireSDotTL, fdx_spSrch, logLinkView, fdx_logLinkView, setLinkView, fdx_setLinkView, fdx_getLinkView, fdx_linkFormat, fdx_trackMapping, fdx_logDownload, logPageView, fdx_logPageView, logPurchase, fdx_logPurchase, fdx_logPurchaseMAGS, isObject, fdx_logPurchase_PageLevel, fdx_logPurchaseMAGR, fdx_logPurchaseWREG, processData, fdx_convertToStr, fdx_logChat, s_doPlugins, fdx_initPlugins, AppMeasurement_Module_Integrate, AppMeasurement_Module_AudienceManagement, AppMeasurement_Module_ActivityMap, AppMeasurement, s_gi, s_pgicq, fdx_runSCode, fdx_initSCode, fdx_createCustomEvent, fdx_dispatchCustomEvent, fdx_fireCustomEvent, MAGSEvarMapping; +{ + const $___mock_213c2c698e570270 = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_213c2c698e570270); + const $___mock_3d049bcfecf95e89 = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_3d049bcfecf95e89); + (function () { + fdx_initSCVars = $___var_9e6948942a701c5e; + ({}.constructor.defineProperty(fdx_initSCVars, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_initSCVars', + writable: false + })); + fdx_debug = $___var_856ee3cf2c7d1fc3; + ({}.constructor.defineProperty(fdx_debug, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_debug', + writable: false + })); + fdx_setCookie = $___var_79c052c869352ada; + ({}.constructor.defineProperty(fdx_setCookie, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_setCookie', + writable: false + })); + fdx_getCookie = $___var_9e155f49982d6c81; + ({}.constructor.defineProperty(fdx_getCookie, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_getCookie', + writable: false + })); + fdx_campaign = $___var_724cdeb025d81543; + ({}.constructor.defineProperty(fdx_campaign, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_campaign', + writable: false + })); + fdx_gup = $___var_b7ecf502fcf1b632; + ({}.constructor.defineProperty(fdx_gup, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_gup', + writable: false + })); + fdx_fireSDotT = $___var_a07476688d4020ab; + ({}.constructor.defineProperty(fdx_fireSDotT, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_fireSDotT', + writable: false + })); + fdx_fireSDotTL = $___var_4910a35ff72470ca; + ({}.constructor.defineProperty(fdx_fireSDotTL, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_fireSDotTL', + writable: false + })); + fdx_spSrch = $___var_6329c98f97298cc2; + ({}.constructor.defineProperty(fdx_spSrch, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_spSrch', + writable: false + })); + logLinkView = $___var_00d1d076e08cf9a8; + ({}.constructor.defineProperty(logLinkView, 'name', { + configurable: true, + enumerable: false, + value: 'logLinkView', + writable: false + })); + fdx_logLinkView = $___var_8608c403671c6a2c; + ({}.constructor.defineProperty(fdx_logLinkView, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_logLinkView', + writable: false + })); + setLinkView = $___var_b871347d9b61c21e; + ({}.constructor.defineProperty(setLinkView, 'name', { + configurable: true, + enumerable: false, + value: 'setLinkView', + writable: false + })); + fdx_setLinkView = $___var_e91c9bfeedcc6d7c; + ({}.constructor.defineProperty(fdx_setLinkView, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_setLinkView', + writable: false + })); + fdx_getLinkView = $___var_66cab8c5d718c03a; + ({}.constructor.defineProperty(fdx_getLinkView, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_getLinkView', + writable: false + })); + fdx_linkFormat = $___var_830a7260e3454a7b; + ({}.constructor.defineProperty(fdx_linkFormat, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_linkFormat', + writable: false + })); + fdx_trackMapping = $___var_4c42d29e06957b0a; + ({}.constructor.defineProperty(fdx_trackMapping, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_trackMapping', + writable: false + })); + fdx_logDownload = $___var_b54c9b2ad5373a41; + ({}.constructor.defineProperty(fdx_logDownload, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_logDownload', + writable: false + })); + logPageView = $___var_fa4d4ce73c75e490; + ({}.constructor.defineProperty(logPageView, 'name', { + configurable: true, + enumerable: false, + value: 'logPageView', + writable: false + })); + fdx_logPageView = $___var_e838fe718e771bf9; + ({}.constructor.defineProperty(fdx_logPageView, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_logPageView', + writable: false + })); + logPurchase = $___var_3931862c48bfb139; + ({}.constructor.defineProperty(logPurchase, 'name', { + configurable: true, + enumerable: false, + value: 'logPurchase', + writable: false + })); + fdx_logPurchase = $___var_c1b09a018a81dab9; + ({}.constructor.defineProperty(fdx_logPurchase, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_logPurchase', + writable: false + })); + fdx_logPurchaseMAGS = $___var_8b44b00a830d9d11; + ({}.constructor.defineProperty(fdx_logPurchaseMAGS, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_logPurchaseMAGS', + writable: false + })); + isObject = $___var_94a7536fa469f5f0; + ({}.constructor.defineProperty(isObject, 'name', { + configurable: true, + enumerable: false, + value: 'isObject', + writable: false + })); + fdx_logPurchase_PageLevel = $___var_3a15f9e7046656ba; + ({}.constructor.defineProperty(fdx_logPurchase_PageLevel, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_logPurchase_PageLevel', + writable: false + })); + fdx_logPurchaseMAGR = $___var_dca3a06f0498ccf9; + ({}.constructor.defineProperty(fdx_logPurchaseMAGR, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_logPurchaseMAGR', + writable: false + })); + fdx_logPurchaseWREG = $___var_a323df82b0149bb0; + ({}.constructor.defineProperty(fdx_logPurchaseWREG, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_logPurchaseWREG', + writable: false + })); + processData = $___var_7e2eccc640b0b3e2; + ({}.constructor.defineProperty(processData, 'name', { + configurable: true, + enumerable: false, + value: 'processData', + writable: false + })); + fdx_convertToStr = $___var_a43d8468877de54d; + ({}.constructor.defineProperty(fdx_convertToStr, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_convertToStr', + writable: false + })); + fdx_logChat = $___var_d057ec0eb2bab407; + ({}.constructor.defineProperty(fdx_logChat, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_logChat', + writable: false + })); + s_doPlugins = $___var_584fe3b7a5bce8d1; + ({}.constructor.defineProperty(s_doPlugins, 'name', { + configurable: true, + enumerable: false, + value: 's_doPlugins', + writable: false + })); + fdx_initPlugins = $___var_80837d3ce826602d; + ({}.constructor.defineProperty(fdx_initPlugins, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_initPlugins', + writable: false + })); + AppMeasurement_Module_Integrate = $___var_b9d046ef37aff189; + ({}.constructor.defineProperty(AppMeasurement_Module_Integrate, 'name', { + configurable: true, + enumerable: false, + value: 'AppMeasurement_Module_Integrate', + writable: false + })); + AppMeasurement_Module_AudienceManagement = $___var_64e8746f5310894a; + ({}.constructor.defineProperty(AppMeasurement_Module_AudienceManagement, 'name', { + configurable: true, + enumerable: false, + value: 'AppMeasurement_Module_AudienceManagement', + writable: false + })); + AppMeasurement_Module_ActivityMap = $___var_9c59a185d4bd1fec; + ({}.constructor.defineProperty(AppMeasurement_Module_ActivityMap, 'name', { + configurable: true, + enumerable: false, + value: 'AppMeasurement_Module_ActivityMap', + writable: false + })); + AppMeasurement = $___var_ad7b5914bc3004cb; + ({}.constructor.defineProperty(AppMeasurement, 'name', { + configurable: true, + enumerable: false, + value: 'AppMeasurement', + writable: false + })); + s_gi = $___var_e79f32c98394e82a; + ({}.constructor.defineProperty(s_gi, 'name', { + configurable: true, + enumerable: false, + value: 's_gi', + writable: false + })); + s_pgicq = $___var_08c45f172bde38fd; + ({}.constructor.defineProperty(s_pgicq, 'name', { + configurable: true, + enumerable: false, + value: 's_pgicq', + writable: false + })); + fdx_runSCode = $___var_9206292cbfff7929; + ({}.constructor.defineProperty(fdx_runSCode, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_runSCode', + writable: false + })); + fdx_initSCode = $___var_8ac5c7b314b8c052; + ({}.constructor.defineProperty(fdx_initSCode, 'name', { + configurable: true, + enumerable: false, + value: 'fdx_initSCode', + writable: false + })); + function $___var_9e6948942a701c5e() { + window.sc_code_ver = '3.0.40', window.sc_code_ver_date = '06152021.01', window.s_version = 'AM.2.22.0', window.s_account = 'fedexglbldev', 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'), window.wwwHost = _fdx.pcfUtil(), 'www.fedex.com' == wwwHost && (s_account = _satellite.getVar('sAccount')), window.s = s_gi(s_account), s.pageLoadComplete = !1, s.trackDownloadLinks = !0, s.trackExternalLinks = !0, s.trackInlineStats = !0, s.linkDownloadFileTypes = 'exe,zip,wav,mp3,mp4,mov,mpg,avi,wmv,pdf,doc,docx,xls,xlsx,ppt,pptx,png', s.linkLeaveQueryString = !1, s.linkTrackVars = 'None', s.linkTrackEvents = 'None', s.usePlugins = !0, s.linkInternalFilters = 'javascript:,fedex.com,iamfedex.com,fedexads.designcdt.com,kinkosdev.com,kinkostest.com,senseaware.com,fedexsameday.com,fedex.p.delivery.net,fedex.co.jp,psg.kinkos.com,fedexcares.com,bongous.com', window.nltrk = ''; + } + function $___var_856ee3cf2c7d1fc3(e, t, n) { + t = void 0 !== t ? '[' + t + '] ' : '', n = void 0 !== n ? '[' + n + '] ' : '', window.console && console.log ? console.log(t + n + e) : window.opera && opera.postError && opera.postError(t + n + e); + try { + var i = void 0 !== fdx_getCookie('fdx_debug') ? fdx_getCookie('fdx_debug').split(',') : [], r = _fdx.getTestLevel(), a = new Date().getTime() + '|' + t + n + e + '|' + r + '|' + ('undefined' != typeof s && s.pageName ? s.pageName : document.location.href); + i.push(a.replace(/,/g, '##')); + } catch (e) { + } + } + function $___var_79c052c869352ada(e, t, n, i, r) { + try { + if (null !== t) { + var a = escape(t); + if ('' !== n) { + var s = new Date(); + s.setDate(s.getDate() + n), a += null === n ? '' : '; expires=' + s.toUTCString(); + } + a += null != i ? '; path=' + i : '', a += null != r ? '; domain=' + r : '', document.cookie = e + '=' + a; + } + } catch (e) { + fdx_debug(e, 'CIM', 'fdx_setCookie'); + } + } + function $___var_9e155f49982d6c81(e) { + try { + for (var t, n = {}, i = document.cookie.split('; '), r = 0; r < i.length; r++) + n[(t = i[r].split('='))[0]] = unescape(t[1]); + return n[e]; + } catch (e) { + fdx_debug(e, 'CIM', 'fdx_getCookie'); + } + } + function $___var_724cdeb025d81543() { + try { + return fdx_gup(window.location != window.parent.location ? document.referrer : document.location, 'cmp'); + } catch (e) { + return fdx_debug(e, 'SC', 'fdx_campaign'), ''; + } + } + function $___var_b7ecf502fcf1b632(e, t) { + t = t.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); + var n = new RegExp('[\\?&]' + t + '=([^&#]*)', 'i').exec(e); + return null == n ? '' : n[1]; + } + function $___var_a07476688d4020ab() { + try { + s.delayV = !1; + s.t(); + s.events = '', s.list1 = '', s.list2 = '', s.list3 = '', sEvntsOnce = '', s.c_w('SC_LINKS', ''), s.c_w('setLink', ''); + } catch (e) { + fdx_debug(e, 'SC', 'fdx_fireSDotT'); + } + } + function $___var_4910a35ff72470ca(e, t, n) { + try { + s.linkTrackVars = s.apl(s.linkTrackVars, 'prop50', ',', 2), s.tl(e, t, n), s.linkTrackVars = 'None', s.linkTrackEvents = 'None', s.events = '', s.list1 = '', s.list2 = '', s.list3 = '', s.c_w('SC_LINKS', ''), s.c_w('setLink', ''); + } catch (e) { + fdx_debug(e, 'SC', 'fdx_fireSDotTL'); + } + } + function $___var_6329c98f97298cc2(e) { + var t = s.Util.getQueryParam('q'), n = _satellite.getVar('content:locale'), r = (e.totalResultCount > 0 ? 'Success' : 'Failure') + ':' + e.totalResultCount + ':' + n; + if (t) { + s.prop49 = t, s.prop49 = s.prop49.toLowerCase(), 0 == s.prop49.indexOf('+') && (s.prop49 = s.prop49.replace('+', ' ')), s.prop49 = s.repl(s.prop49, '+', ' '), s.prop49 = s.repl(s.prop49, ' ', ' +').replace(/^\s+/, ''), e.totalResultCount > 0 ? (s.prop1 = s.eVar1 = s.prop49, s.events = s.apl(s.events, 'event118', ',', 2)) : (s.prop1 = s.eVar1 = '0:' + s.prop49, s.events = s.apl(s.events, 'event119', ',', 2)), void 0 !== r && '' !== r && (s.prop49 = r + ':' + s.prop49); + var a = ''; + if (void 0 !== FDX.DATALAYER.search.result.banner && '' != FDX.DATALAYER.search.result.banner && FDX.DATALAYER.search.result.banner) { + var o = document.getElementsByClassName('cq-searchpromote-banners')[0].getElementsByTagName('div'); + for (i = 0; i < o.length; i++) { + var c = o[i]; + if ('fxg-image-component__image' == c.className && (void 0 !== c.children[0].attributes['data-analytics'] && (a += '$' + c.children[0].attributes['data-analytics'].value), a.indexOf('SPB|Results Not Found Image') >= 0)) { + a = 'SPB|Results Not Found Image'; + break; + } + } + '' !== a && a && (a = a.replace('$', ''), s.prop49 = s.prop49 + ':' + a); + } + s.eVar49 = 'D=c49'; + } + } + function $___var_00d1d076e08cf9a8(e, t, n, i) { + fdx_logLinkView(e, t, n, i); + } + function $___var_8608c403671c6a2c(e, t) { + void 0 === t && (t = ''), s.events.indexOf('event904') > -1 && (s.linkTrackEvents = s.events = s.events = s.rfl(s.events, 'event904')); + var n = [ + 'trk-landingPage1TrackingNumbersPresent', + 'trk-landingPage-TrackBtn', + 'trk-trackByReference-TrackBtn', + 'trk-trackByTCN-TrackBtn', + 'trk-landingPage-track-helpLink', + 'trk-landingPage-mulitipleTrackingNumberLink', + 'trk-landingPage-singleTrackingNumberLink', + 'trk-trackByReference-DestinationCountry', + 'trk-landingPage-promptToLoginforBOL', + 'trk-OPOD-cancel', + 'trk-OPOD-PrintLetter-Submit', + 'trk-OPOD-EmailLetter-Submit', + 'trk-OPOD-Fax-Submit', + 'trk-landingpage-bolDownloadButton', + 'trk-landingPage-track-helpLink' + ]; + if (1 == !!(_satellite.getVar('click:blockFlag')(e, 'click:blockList') || e.indexOf('vaPopinAsk') > -1)) + return n.indexOf(e.trim()) > -1 && fdx_setLinkView(e), !0; + if (null != e) { + (e = fdx_linkFormat(e)).indexOf('trk-') > -1 && (e = fdx_trackMapping(e)); + var i = new Date(), r = (i.getMonth(), i.getDate(), i.getFullYear(), i.getHours(), i.getMinutes()); + r < 10 && (r = '0' + r); + var a = i.getSeconds(); + a < 10 && (a = '0' + a); + s.linkTrackVars = 'prop2,prop3,prop4,prop5,prop6,prop18,prop19,prop20,prop31,prop33,prop35,prop41,prop48,prop52,prop54,prop55,prop56,prop70,prop71,eVar4,eVar6,eVar11,eVar13,eVar43,eVar50,eVar52,eVar56,eVar53,events', 'hdr|Login' == e && (t += 'event3'), 'hdr|SIGN OUT' == e && (t += 'event10', s.eVar4 = 'Logged Out'), t && (s.linkTrackEvents = t, s.events = t), s.prop4 = 'D=v4', s.prop5 = _satellite.getVar('content:region'), s.prop6 = 'D=v6', s.prop18 = s.pageName, s.prop19 = e, s.prop20 = s.pageName + ':' + e, s.prop31 = '' !== s.visitor.getAnalyticsVisitorID() ? '[CS]v1|' + s.visitor.getAnalyticsVisitorID() + '[CE]' : s.visitor.getMarketingCloudVisitorID(), s.prop33 = _satellite.getVar('content:page type'), s.prop41 = 'D=v41', s.prop43 = 'D=v43'; + var o = new Date(), c = o.getMonth() + 1, l = o.getDate(), u = o.getFullYear(); + return s.prop52 = s.eVar52 = u + '-' + c + '-' + l, s.prop54 = 'D=v54', s.prop55 = 'D=v55', s.eVar6 = _satellite.getVar('login:user-id'), s.eVar43 = 'L:' + e, s.eVar56 = s.prop56 = e, s.eVar53 = '+1', nltrk = 'y', fdx_fireSDotTL(this, 'o', e), !0; + } + } + function $___var_b871347d9b61c21e(e) { + fdx_setLinkView(e); + } + function $___var_e91c9bfeedcc6d7c(e) { + (e = fdx_linkFormat(e)).indexOf('trk-') > -1 && (e = fdx_trackMapping(e)); + var t = s.pageName + '^^' + e + '^^' + s.pageName + ' | ' + e + '^^'; + return s.c_w('setLink', t, 0), !0; + } + function $___var_66cab8c5d718c03a() { + try { + var e = s.c_r('setLink'); + if (void 0 !== e && '' != e) { + var t = e.split('^^'); + s.prop18 = t[0], s.prop19 = t[1], s.prop20 = t[2], s.c_w('SC_LINKS', ''); + } + } catch (e) { + fdx_debug(e, 'SC', 'fdx_getLinkView'); + } + } + function $___var_830a7260e3454a7b(e) { + for (var t = e.split('|'), n = '', i = 0; i < t.length; i++) + '' != n && (n += '|'), n += t[i].trim(); + return n; + } + function $___var_4c42d29e06957b0a(e) { + var t = _satellite.getVar('track:btnMapping'); + return void 0 === t[e] ? e : t[e]; + } + function $___var_b54c9b2ad5373a41(e, t) { + s.linkTrackVars = 'eVar6,eVar110,eVar43,prop37,prop70,prop71,events'; + try { + if (void 0 !== e) { + if (s.prop37 = e.toString(), 'single' == t.toLowerCase()) + s.events = s.apl(s.events, 'event12', ',', 2), s.linkTrackEvents = 'event12'; + else if ('multiple' == t.toLowerCase()) { + var n = 0; + 'failed' != e.toString().toLowerCase() && (n = e.length), s.events = s.apl(s.events, 'event181=' + n, ',', 2), s.linkTrackEvents = 'event181'; + } + return fdx_fireSDotTL(this, 'd'), !0; + } + } catch (e) { + fdx_debug(e, 'SC', 'fdx_logDownload'); + } + } + function $___var_fa4d4ce73c75e490(e, t, n, i, r, a) { + fdx_logPageView(e, t, n, i, r, a); + } + function $___var_e838fe718e771bf9(e, t, n, i, r) { + try { + var a = ''; + wwwHost.match(/www(sbox.idev|base.idev|dev.idev|drt.idev|stress.dmz.idev|bit.idev|test|).fedex.com/gi) && (a = 'fedex/'), a != e.slice(0, a.length) && (e = a + e), s.pageName = e, fdx_getLinkView(), t ? (s.linkTrackEvents = t, s.events = t) : (s.linkTrackEvents = '', s.events = ''); + var o = _satellite.getVar('search:spData'); + void 0 !== o && '' != o && fdx_spSrch(o), n && (s.prop4 = n), i && (s.prop74 = i); + var c = new Date(), l = (c.getMonth(), c.getDate(), c.getFullYear(), c.getHours(), c.getMinutes()); + l < 10 && (l = '0' + l); + var u = c.getSeconds(); + u < 10 && (u = '0' + u); + s.eVar43 = 'V:' + s.pageName, s.prop43 = 'D=v43'; + var d = new Date(), p = d.getMonth() + 1, f = d.getDate(), g = d.getFullYear(); + s.prop52 = s.eVar52 = g + '-' + p + '-' + f, r ? (s.delayV = !0, setTimeout(function () { + try { + fdx_fireSDotT(); + } catch (e) { + console.log('error:' + e); + } + }, 2000)) : fdx_fireSDotT(); + } catch (e) { + console.log('error:' + e); + } + } + function $___var_3931862c48bfb139(e, t) { + void 0 !== e && fdx_logPurchase(e, t); + } + function $___var_c1b09a018a81dab9(e, t) { + try { + s.events = ''; + var n = ''; + return void 0 !== e.LogPurchaseRequest && null !== e.LogPurchaseRequest && (e.LogPurchaseRequest.clientId && (e.LogPurchaseRequest.clientId = e.LogPurchaseRequest.clientId.toUpperCase()), 'MAGS' == e.LogPurchaseRequest.clientId && (fdx_logPurchaseMAGS(e.LogPurchaseRequest, t), n = 'MAGSShipBtn'), 'MAGR' == e.LogPurchaseRequest.clientId && (fdx_logPurchaseMAGR(e.LogPurchaseRequest, t), n = 'MAGRRateBtn')), null != e && 'MAGS' == e.clientId && 'undefined' !== e.pageName && null !== e.pageName && '' !== e.pageName && (fdx_logPurchase_PageLevel(e, t), n = e.pageName), void 0 !== e.appId && null !== e.appId && 'WREG' == e.appId && (fdx_logPurchaseWREG(e, t), n = 'WREGRegisterBtn'), '' !== s.events && (nltrk = 'y', s.eVar40 = 'D=events', s.prop40 = 'D=events', s.prop43 = 'D=v43', s.prop18 = _satellite.getVar('content:page name'), s.prop19 = n, s.prop20 = s.pageName + ':' + n, s.linkTrackVars = s.apl(s.linkTrackVars, 'prop6,eVar6,prop18,prop19,prop20,prop31,eVar38,prop40,eVar40,prop43,eVar43,prop46,eVar46,eVar73,eVar75,prop74,eVar112,eVar113,eVar114,eVar115,eVar116,eVar117,eVar118,eVar119,eVar120,eVar121,eVar136,eVar138,eVar139,eVar142,eVar143,eVar145,products,purchaseID,events', ',', 2), s.linkTrackEvents = s.events, fdx_fireSDotTL(this, 'o', n), s.products = '', s.purchaseID = '', s.events = '', s.eVar73 = '', s.eVar75 = '', s.prop74 = '', s.eVar43 = '', !0); + } catch (e) { + return fdx_debug(e, 'SC', 'fdx_logPurchase'), !1; + } + } + function $___var_8b44b00a830d9d11(e, t) { + try { + var n = '', i = e.clientId + ':INT_' + e.INT; + if (void 0 !== e.clientId && '' !== e.clientId) { + if (void 0 !== e.shipData && null !== e.shipData) + for (var r in e.shipData) { + i += ':' + r + '_' + e.shipData[r]; + } + n = 'Y' == e.INT ? 'event68' : 'event67', s.events = 'purchase,' + n, s.linkTrackEvents = s.events, s.eVar143 = i, s.products = ';MAGS;;;' + n + ';eVar143=' + s.eVar143, s.eVar43 = 'S:MAGS'; + try { + null != t && 'function' == typeof t && t(e); + } catch (e) { + fdx_debug(e, 'SC', 'fdx_logPurchaseMAGS:callback'); + } + } + } catch (e) { + fdx_debug(e, 'SC', 'fdx_logPurchaseMAGS'); + } + } + function $___var_94a7536fa469f5f0(e) { + return null != e && e.constructor == Object; + } + function $___var_3a15f9e7046656ba(e, t) { + try { + var n = ''; + if (s.linkTrackVars = s.apl(s.linkTrackVars, MAGSEvarMapping[e.pageName][0], ',', 2), isObject(e)) + for (var i in (void 0 !== e.SRC && '' != e.SRC && (s.linkTrackVars = s.apl(s.linkTrackVars, 'eVar166', ',', 2), s.eVar166 = e.SRC), e)) { + var r = e[i]; + if (isObject(r)) { + for (var i in r) + n += i + '_' + r[i] + ':'; + n = n.substring(0, n.length - 1) + ':'; + } + } + var a = n.substring(0, n.length - 1); + s.events = 'ScAdd,' + [MAGSEvarMapping[e.pageName][1]], s.linkTrackEvents = s.events, s[[MAGSEvarMapping[e.pageName][0]]] = a, s.products = ';MAGS;;;;' + MAGSEvarMapping[e.pageName][0] + '=' + s[MAGSEvarMapping[e.pageName][0]], s.eVar43 = 'S:' + e.pageName; + try { + null != t && 'function' == typeof t && t(obj); + } catch (e) { + fdx_debug(e, 'SC', 'fdx_logPurchase_PageLevel:callback'); + } + } catch (e) { + fdx_debug(e, 'SC', 'fdx_logPurchase_PageLevel'); + } + } + function $___var_dca3a06f0498ccf9(e, t) { + try { + var n = e.clientId + ':INT_' + e.INT, i = e.clientId; + if (void 0 !== e && '' !== e) { + if (void 0 !== e.shipData && null !== e.shipData) + for (var r in e.shipData) { + n += ':' + r + '_' + e.shipData[r]; + } + if (void 0 !== e.comData && null !== e.comData) + for (var r in e.comData) { + i += ':' + r + '_' + e.comData[r]; + } + s.events = 'scAdd,event110', s.linkTrackEvents = s.events, s.eVar136 = n, s.eVar142 = i, s.products = ';MAGR;;;;eVar136=' + s.eVar136 + '|eVar142=' + s.eVar142, s.eVar43 = 'S:RateMAGR'; + try { + null != t && 'function' == typeof t && t(e); + } catch (e) { + fdx_debug(e, 'SC', 'fdx_logPurchaseMAGR:callback'); + } + } + } catch (e) { + fdx_debug(e, 'SC', 'fdx_logPurchaseMAGR'); + } + } + function $___var_a323df82b0149bb0(e, t) { + try { + var n = '', i = ''; + null != e && (void 0 !== e.profile && (n = processData(e.profile)), void 0 !== e.addtData && (i = processData(e.addtData)), s.eVar145 = n + '|' + i), s.events = 'scAdd', s.linkTrackEvents = s.events, s.products = ';' + e.appId + ';;;;eVar145=' + s.eVar145, s.eVar43 = 'S:' + e.appId; + try { + null != t && 'function' == typeof t && t(e); + } catch (e) { + fdx_debug(e, 'SC', 'fdx_logPurchaseWREG:callback'); + } + } catch (e) { + fdx_debug(e, 'SC', 'fdx_logPurchaseWREG'); + } + } + function $___var_7e2eccc640b0b3e2(e) { + var t = ''; + if (null != e) { + for (var n in e) + t += ':' + n + '_' + e[n]; + t = t.replace(':', ''); + } + return t; + } + function $___var_a43d8468877de54d(e) { + try { + var t = []; + if ('object' == typeof e && null == e.join) + for (prop in e) + prop && '' != prop && e[prop] && '' != e[prop] && t.push(prop, ':', fdx_convertToStr(e[prop]), ','); + else if ('object' == typeof e && null != e.join) + for (prop in e) + prop && '' != prop && e[prop] && '' != e[prop] && t.push(fdx_convertToStr(e[prop]), ','); + else + 'function' != typeof e && '' != e.toString() && t.push(e.toString()); + return t.join(''); + } catch (e) { + fdx_debug(e, 'SC', 'fdx_convertToStr'); + } + } + function $___var_d057ec0eb2bab407(e, t) { + try { + if (t) + if (s.linkTrackVars = 'prop6,eVar6,prop31,eVar43,prop52,eVar52,prop56,eVar56,eVar53,prop18,prop19,prop20,prop41,events', l = void 0 !== e.status && e.status ? e.status : '') { + var n = { + vaPopinAsk: 'event112', + transtoLA: 'event114' + }, i = ''; + for (var r in (a = n[l], s.prop18 = s.pageName, s.prop19 = l, s.prop20 = s.pageName + ':' + l, e)) + e[r] && (i += ':' + e[r]); + s.eVar14 = t + ':' + s.pageName + i, s.linkTrackVars = s.apl(s.linkTrackVars, 'eVar14', ',', 2), s.linkTrackEvents = s.events = a, nltrk = 'y', fdx_fireSDotTL(this, 'o', t); + } + if (void 0 !== e.chatRequest && null !== e.chatRequest) { + var a = '', o = (t = '', ''); + for (var r in (s.linkTrackVars = 'prop6,eVar6,prop31,eVar43,prop52,eVar52,prop56,eVar56,eVar53,prop18,prop19,prop20,prop41,events', e.chatRequest[0].chatData)) { + var c = '' + e.chatRequest[0].chatData[r]; + o += '|' + (r = r.replace('|', '-')) + '_' + (c = c.replace('|', '-')); + } + if ('CHAT' == e.chatRequest[0].clientId) + t = 'liveagent_CHAT', a = 'event45', s.prop59 = s.eVar59 = o.replace('|', ''), s.linkTrackVars = s.apl(s.linkTrackVars, 'eVar59,prop59', ',', 2); + else if ('NINA' == e.chatRequest[0].clientId) + try { + t = 'va_NINA'; + var l = e.chatRequest[0].chatData.status; + a = (n = { + vaPopinOpen: 'event112', + vaPopinClose: 'event113', + transtoLA: 'event114' + })[l], s.eVar14 = o.replace('|', '').replace('vaPopinOpen', 'vaPopin').replace('vaPopinClose', 'vaPopin'), s.linkTrackVars = s.apl(s.linkTrackVars, 'eVar14', ',', 2); + } catch (e) { + fdx_debug(e, 'SC', 'fdx_logChat:NINA'); + } + s.linkTrackEvents = s.events = a, nltrk = 'y', fdx_fireSDotTL(this, 'o', t); + } + } catch (e) { + fdx_debug(e, 'SC', 'fdx_logChat'); + } + } + function $___var_584fe3b7a5bce8d1(e) { + const $___old_9bdfa30c682dade9 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'), $___old_ea0b2c203722df4c = {}.constructor.getOwnPropertyDescriptor(window, 'sessionStorage'); + try { + if ($___old_9bdfa30c682dade9) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_213c2c698e570270.localStorage)); + if ($___old_ea0b2c203722df4c) + ({}.constructor.defineProperty(window, 'sessionStorage', $___mock_213c2c698e570270.sessionStorage)); + return function () { + e.eVar4 = _satellite.getVar('login:status'), window.fdx_controllerVersion, void 0 === e.pageName && '' == e.pageName && (_satellite.getVar('content:page name'), 1) && _satellite.getVar('content:page name') && (e.pageName = _satellite.getVar('content:page name')), e.pageName = e.pageName.toLowerCase(), e.eVar38 = 'D=pageName', e.eVar50 = [ + location.host, + location.pathname + ].join(''), e.prop46 = e.eVar46 = 'D=pageName'; + var t = new Date().getFullYear(), n = e.getTimeParting('h', '-6', t), i = e.getTimeParting('d', '-6', t); + e.eVar7 = e.prop7 = n + '|' + i; + var r = new Date(), a = r.getMonth() + 1, s = r.getDate(), o = r.getFullYear(); + e.prop52 = e.eVar52 = o + '-' + a + '-' + s; + var c = e.getPreviousValue(e.pageName, 'gpv_pageName'); + c && (e.prop12 = c, e.eVar2 = 'D=c12'), e.prop35 = 'D=Accept-Language', e.eVar53 = '+1', e.eVar40 = 'D=events'; + try { + var l = e.getPercentPageViewed(e.pageName); + void 0 !== l && 'object' == typeof l && 4 === l.length && void 0 !== l[2] && (e.prop60 = l[2] + ':' + l[1]); + } catch (e) { + fdx_debug(e, 'SC', 's_doPlugins:ppvArray'); + } + if ('d' == e.linkType && void 0 !== e.linkObject.dataset.alt && (e.linkType = ''), 'd' == e.linkType && void 0 !== e.linkObject && 0 !== e.linkObject && void 0 !== e.linkObject.getAttribute('href') && (e.url = e.linkObject.getAttribute('href'), e.prop37 = e.eVar37 = e.url.substring(e.url.lastIndexOf('/') + 1, e.url.length), e.eVar43 = 'D:' + e.prop37, e.events = e.apl(e.events, 'event12', ',', 2), e.linkTrackEvents = 'event12', e.linkTrackVars = 'prop18,prop19,prop20,eVar37,eVar43,events'), 'y' != nltrk && (e.eVar6 = _satellite.getVar('login:user-id'), e.prop6 = 'D=v6', e.linkTrackVars = e.apl(e.linkTrackVars, 'prop2,prop3,prop4,prop5,prop6,prop18,prop19,prop20,prop31,prop33,prop35,prop48,prop50,eVar4,eVar6,eVar13,eVar50', ',', 2), e.setupLinkTrack('prop18,prop19,prop20', 'SC_LINKS'), void 0 !== e.prop19 && '' !== e.prop19 && (e.prop19.indexOf('sprite-placeholder.png') > -1 && (e.prop19 = 'hdr|Search'), e.prop20 = e.prop18 + ' | ' + e.prop19)), e.eVar45 || (e.eVar45 = e.Util.getQueryParam('INTCMP'), e.eVar45 = e.getValOnce(e.eVar45, 's_intcampaign', 0), e.clickPast(e.eVar45, 'event82', 'event83', 's_cp-bag')), e.eVar45 && (e.list1 = e.eVar45, e.events = e.apl(e.events, 'event44', ',', 2)), !e.campaign) { + e.campaign = e.Util.getQueryParam('CMP'); + var u = e.Util.getQueryParam('LINK'); + e.campaign && u && (e.eVar58 = u), '' == e.campaign && (e.campaign = fdx_campaign()), e.campaign = e.getValOnce(e.campaign, 's_campaign', 0); + } + e.clickPast(e.campaign, 'event23', 'event24'); + var d = e.getAamSegments('aam_sc', 'aamsc').replace(/\|/g, ','); + e.list2 = e.apl(e.list2, d, ',', 2), e.prop48 = s_version + '_' + sc_code_ver + '_' + sc_code_ver_date, e.prop50 = s_account; + var p = _fdx.getTestLevel(); + p && (e.prop50 += '_Launch_' + p), e.eVar41 = e.getVisitNum('d'), e.prop31 = '' !== e.visitor.getAnalyticsVisitorID() ? '[CS]v1|' + e.visitor.getAnalyticsVisitorID() + '[CE]' : e.visitor.getMarketingCloudVisitorID(), nltrk = '', 'undefined' != typeof prp72 && '' != prp72 && (e.prop72 = prp72); + var f = ''; + null != (f = _satellite.cookie.get('Rbt')) && '' != f && 'f1' === f && (e.abort = !0); + }.apply(this, arguments); + } finally { + if ($___old_9bdfa30c682dade9) + ({}.constructor.defineProperty(window, 'localStorage', $___old_9bdfa30c682dade9)); + if ($___old_ea0b2c203722df4c) + ({}.constructor.defineProperty(window, 'sessionStorage', $___old_ea0b2c203722df4c)); + } + } + function $___var_80837d3ce826602d() { + if (s.doPlugins = s_doPlugins, s.p_checkInterval = new Array(), s.p_cbct = 0, s.t_cb = function (e, t) { + var n = this; + if (!e) + e = 4000; + t || (t = 's_p_callBackCode'), interval = 100, n.p_cbwait = 0; + var i = 1; + void 0 !== n.rc && (i = n.rc[n.visitorNamespace]), i > n.p_cbct && (n.p_cbct++, n.p_checkInterval[i] = setInterval('s.p_callBack(' + e + ', ' + i + ', \'' + t + '\')', interval)); + }, s.p_callBack = function (e, t) { + var n = this; + void 0 === n.visitorNamespace && (n.visitorNamespace = s_account); + var i = ''; + t > 1 && (i = '_' + (t - 1)); + var r = 's_i_' + n.visitorNamespace + i; + return void 0 !== window[r] && window[r].height > 0 ? (clearInterval(n.p_checkInterval[t]), !0) : (n.p_cbwait += interval, n.p_cbwait > e && (clearInterval(n.p_checkInterval[t]), void 0 !== window[r] && (window[r].src = 'https://www.fedex.com/images/ascend/shared/headers/corp_logo.gif?sc_response_failure')), !1); + }, s.lookuplookup = function (e) { + var t, n, r, a, s, o, c, l, u = this, d = 0, p = e ? e.length : 0, f = new Array(), g = new Array(); + for (i = 0; i < p; i++) + (t = e.indexOf('|', i)) > -1 && (f[d] = e.substring(i, t), d++, i = t); + for (i = 0; i < d; i++) { + for (n = 0, a = f[i] ? f[i].length : 0, j = 0; j < a; j++) + if ((r = f[i].indexOf('~', j)) > -1) + g[n] = f[i].substring(j, r), n++, j = r; + else { + if (-1 == r && n < 3 || n > 3) + break; + if (-1 == r && 3 == n) { + g[n] = f[i].substring(j); + break; + } + } + if (-1 == r && 3 == n) { + if (o = g[0], s = g[1], c = g[2], l = g[3], o && 'c' == c && u.pageName.indexOf(o) > -1) { + u.events = u.apl(u.events, l, ',', 2); + break; + } + if (o && 'e' == c && u.pageName == o) { + u.events = u.apl(u.events, l, ',', 2); + break; + } + if (s && 'c' == c && document.URL.indexOf(s) > -1) { + u.events = u.apl(u.events, l, ',', 2); + break; + } + if (s && 'e' == c && document.URL == s) { + u.events = u.apl(u.events, l, ',', 2); + break; + } + } + } + }, s.fae = function (e) { + try { + var t, n; + if (void 0 !== e) { + if (!e.activeElement || !e.activeElement.type) + return; + n = (t = e.activeElement).type; + } else { + if (!document.activeElement || !document.activeElement.type) + return; + n = (t = document.activeElement).type; + } + if ('text' == n || 'textarea' == n || 'checkbox' == n || 'radio' == n || 'select-one' == n || 'button' == n) { + var i = t.id; + if ('' == (i = '' === i ? t.name : i) && t.outerHTML && '' !== t.outerHTML && (i = t.outerHTML.substring(0, 85)), '' === i) { + var r = fdx_getCookie('s_lff'); + i = (i = void 0 !== r ? r : '[PN:' + s.pageName + ']').replace(s.formName + '|', ''); + } + fdx_setCookie('s_lff', s.formName + '|' + i, 30, '/', '.fedex.com'); + } + } catch (e) { + fdx_debug(e, 'SC', 's.fae'); + } + }, s.partnerDFACheck = new Function('cfg', 'var s=this,c=cfg.visitCookie,src=cfg.clickThroughParam,scp=cfg.searchCenterParam,p=cfg.newRsidsProp,tv=cfg.tEvar,dl=\',\',cr,nc,q,g,gs,i,j,k,fnd,v=1,t=new Date,cn=0,ca=new Array,aa=new Array,cs=new Array;t.setTime(t.getTime()+1800000);cr=s.c_r(c);if(cr){v=0;}ca=s.split(cr,dl);if(s.un)aa=s.split(s.un,dl);else aa=s.split(s.account,dl);for(i=0;i-1){s.vpr(p,cr);v=1;}else if(gs>-1){v=0;s.vpr(tv,\'SearchCenter Visitors\');}if(!s.c_w(c,cr,t)){s.c_w(c,cr,0);}if(!s.c_r(c)){v=0;}return v>=1;'), s.vpr = new Function('vs', 'v', 'if(typeof(v)!=\'undefined\' && vs){var s=this; eval(\'s.\'+vs+\'="\'+v+\'"\')}'), s.getActionDepth = new Function('c', 'var s=this,v=1,t=new Date;t.setTime(t.getTime()+1800000);if(!s.c_r(c)){v=1}if(s.c_r(c)){v=s.c_r(c);v++}if(!s.c_w(c,v,t)){s.c_w(c,v,0)}return v;'), s.getVisitNum = new Function('tp', 'c', 'c2', 'var s=this,e=new Date,cval,cvisit,ct=e.getTime(),d;if(!tp){tp=\'m\';}if(tp==\'m\'||tp==\'w\'||tp==\'d\'){eo=s.endof(tp),y=eo.getTime();e.setTime(y);}else {d=tp*86400000;e.setTime(ct+d);}if(!c){c=\'s_vnum\';}if(!c2){c2=\'s_invisit\';}cval=s.c_r(c);if(cval){var i=cval.indexOf(\'&vn=\'),str=cval.substring(i+4,cval.length),k;}cvisit=s.c_r(c2);if(cvisit){if(str){e.setTime(ct+1800000);s.c_w(c2,\'true\',e);return str;}else {return \'unknown visit number\';}}else {if(str){str++;k=cval.substring(0,i);e.setTime(k);s.c_w(c,k+\'&vn=\'+str,e);e.setTime(ct+1800000);s.c_w(c2,\'true\',e);return str;}else {s.c_w(c,e.getTime()+\'&vn=1\',e);e.setTime(ct+1800000);s.c_w(c2,\'true\',e);return 1;}}'), s.dimo = new Function('m', 'y', 'var d=new Date(y,m+1,0);return d.getDate();'), s.endof = new Function('x', 'var t=new Date;t.setHours(0);t.setMinutes(0);t.setSeconds(0);if(x==\'m\'){d=s.dimo(t.getMonth(),t.getFullYear())-t.getDate()+1;}else if(x==\'w\'){d=7-t.getDay();}else {d=1;}t.setDate(t.getDate()+d);return t;'), s.getVisitStart = new Function('c', 'var s=this,v=1,t=new Date;t.setTime(t.getTime()+1800000);if(s.c_r(c)){v=0}if(!s.c_w(c,1,t)){s.c_w(c,1,0)}if(!s.c_r(c)){v=0}return v;'), s.crossVisitParticipation = new Function('v', 'cn', 'ex', 'ct', 'dl', 'ev', 'dv', 'var s=this,ce;if(typeof(dv)===\'undefined\')dv=0;if(s.events&&ev){var ay=s.split(ev,\',\');var ea=s.split(s.events,\',\');for(var u=0;u0&&arry[arry.length-1][0]==v)arry[arry.length-1]=[v,new Date().getTime()];else arry[arry.length]=[v,new Date().getTime()];var start=arry.length-ct<0?0:arry.length-ct;var td=new Date();for(var x=start;x-1){q=u.substring(i+1);v=s.pt(q,\'&\',\'p_gvfne\',k)}return v'), s.p_gvfne = new Function('t', 'k', 'if(t){var s=this,i=t.indexOf(\'=\'),p=i<0?t:t.substring(0,i),v=i<0?\'True\':t.substring(i+1);if(p.toLowerCase()==k.toLowerCase())return v;}return \'\''), s.pt = new Function('x', 'd', 'f', 'a', 'var s=this,t=x,z=0,y,r;while(t){y=t.indexOf(d);y=y<0?t.length:y;t=t.substring(0,y);r=s[f](t,a);if(r)return r;z+=y+d.length;t=x.substring(z,x.length);t=zspr&&cd30){mint=\'30\'}if(thish>=12){ap=\'PM\';thish=thish-12};if (thish==0){thish=12};if(thisd==6||thisd==0){dt=\'Weekend\'};var timestring=thish+\':\'+mint+ap;var daystring=dow;var endstring=dt;if(t==\'h\'){return timestring}if(t==\'d\'){return daystring};if(t==\'w\'){return endstring}}};'), s.setupLinkTrack = new Function('vl', 'c', 'e', 'var s=this;var cv=s.c_r(c);if(vl){var vla=vl.split(\',\');}if(cv!=\'\'){var cva=s.split(cv,\'^^\');if(cva[1]!=\'\'){for(x in vla){s[vla[x]]=cva[x];if(e){s.events=s.apl(s.events,e,\',\',2);}}}}s.c_w(c,\'\',0);if(typeof s.linkObject!=\'undefined\'&&s.hbx_lt!=\'manual\'){s.lta=[];if(typeof s.linkObject!=null){slo=s.linkObject;if(s.linkObject!=0){if(s.linkObject.getAttribute(\'name\')!=null){var b=s.linkObject.getAttribute(\'name\');if(b.indexOf(\'&lpos=\')>-1){s.lta[3]=b.match(\'&lpos=([^&]*)\')[1];}if(b.indexOf(\'&lid=\')>-1){s.lta[1]=b.match(\'&lid=([^&]*)\')[1];}}}if(typeof s.lta[1]==\'undefined\'){if(s.linkName!=0){s.lta[1]=s.linkName;}else if(s.linkObject!=0){if(s.linkObject.innerHTML.indexOf(\'-1){s.lta[1]=s.linkObject.innerHTML.match(\'src="([^"]*)\')[1];}else{s.lta[1]=s.linkObject.innerHTML;}}else if(s.linkURL){s.lta[1]=s.linkURL;}else{s.lta[1]=null;}}if(s.lta[1]!=null){if(typeof s.pageName!=\'undefined\')s.lta[0]=s.pageName;s.lta[2]=s.pageName+\' | \'+s.lta[1];}}if(s.linkType!=0){for(var x=0;x]+(>|$)/g, '')).replace(/^\s+|\s+$/g, ''); + }, s.split = new Function('l', 'd', 'var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x++]=l.substring(0,i);l=l.substring(i+d.length);}return a'), s.apl = new Function('L', 'v', 'd', 'u', 'var s=this,m=0;if(!L)L=\'\';if(u){var i,n,a=s.split(L,d);for(i=0;i\');if(g.indexOf(D[0])!=-1){s.contextData[\'a.socialcontentprovider\']=D[1];}}'), s.socPlatList = 'facebook.com>Facebook|twitter.com>Twitter|t.co/>Twitter|youtube.com>Youtube|clipmarks.com>Clipmarks|dailymotion.com>Dailymotion|delicious.com>Delicious|digg.com>Digg|diigo.com>Diigo|flickr.com>Flickr|flixster.com>Flixster|fotolog.com>Fotolog|friendfeed.com>FriendFeed|google.com/buzz>Google Buzz|buzz.googleapis.com>Google Buzz|plus.google.com>Google+|hulu.com>Hulu|identi.ca>identi.ca|ilike.com>iLike|intensedebate.com>IntenseDebate|myspace.com>MySpace|newsgator.com>Newsgator|photobucket.com>Photobucket|plurk.com>Plurk|slideshare.net>SlideShare|smugmug.com>SmugMug|stumbleupon.com>StumbleUpon|tumblr.com>Tumblr|vimeo.com>Vimeo|wordpress.com>WordPress|xanga.com>Xanga|metacafe.com>Metacafe|pinterest.com>Pinterest', s.socialAuthors = new Function('', 'var s=this,g;g=s.referrer?s.referrer:document.referrer;if(g.indexOf(\'http://t.co/\')===0||g.indexOf(\'https://t.co/\')===0||g.indexOf(\'pinterest.com/pin\')!==-1||g.indexOf(\'tumblr.com\')!==-1||g.indexOf(\'youtube.com\')!==-1){s.Integrate.add(\'SocialAuthor\');s.Integrate.SocialAuthor.get(\'http://sa-services.social.omniture.com/author/name?var=[VAR]&callback=s.socialAuthorSearch&rs=\'+encodeURIComponent(s.account)+\'&q=\'+encodeURIComponent(g));s.Integrate.SocialAuthor.delay();s.Integrate.SocialAuthor.setVars=function(s,p){s.contextData[\'a.socialauthor\']=s.user;}}'), s.socialAuthorSearch = new Function('obj', 'var s=this;if(typeof obj===\'undefined\'||typeof obj.author===\'undefined\'){s.user=\'Not Found\';}else{s.user=obj.author;}s.Integrate.SocialAuthor.ready();'), !s.__ccucr) { + function e(e) { + var t, n, i, r = this, a = (new Date(), r.c_rr(e)), s = r.c_rspers(); + return a || (e = r.Util.urlDecode(e), t = s.indexOf(' ' + e + '='), n = (t = (s = t < 0 ? r.c_rr('s_sess') : s).indexOf(' ' + e + '=')) < 0 ? t : s.indexOf('|', t), i = t < 0 ? t : s.indexOf(';', t), n = n > 0 ? n : i, a = t < 0 ? '' : r.Util.urlDecode(s.substring(t + 2 + e.length, n < 0 ? s.length : n))); + } + function t() { + var e = s.c_rr('s_pers'), t = new Date().getTime(), n = null, i = [], r = ''; + if (!e) + return r; + for (var a = 0, o = (i = e.split(';')).length; a < o; a++) + (n = i[a].match(/\|([0-9]+)$/)) && parseInt(n[1]) >= t && (r += i[a] + ';'); + return r; + } + s.c_rr = s.c_r, s.__ccucr = !0, s.c_rspers = t, s.c_r = e; + } + if (!s.__ccucw) { + function n(e, t, n) { + var i, r, a, s, o = this, c = new Date(), l = 0, u = 's_pers', d = 's_sess', p = 0, f = 0; + if (c.setTime(c.getTime() - 60000), o.c_rr(e) && o.c_wr(e, '', c), e = o.Util.urlEncode(e), (a = (i = o.c_rspers()).indexOf(' ' + e + '=')) > -1 && (i = i.substring(0, a) + i.substring(i.indexOf(';', a) + 1), p = 1), (a = (r = o.c_rr(d)).indexOf(' ' + e + '=')) > -1 && (r = r.substring(0, a) + r.substring(r.indexOf(';', a) + 1), f = 1), c = new Date(), n ? n.getTime() > c.getTime() && (i += ' ' + e + '=' + o.Util.urlEncode(t) + '|' + n.getTime() + ';', p = 1) : (r += ' ' + e + '=' + o.Util.urlEncode(t) + ';', f = 1), r = r.replace(/%00/g, ''), i = i.replace(/%00/g, ''), f && o.c_wr(d, r, 0), p) { + for (s = i; s && -1 != s.indexOf(';');) { + var g = parseInt(s.substring(s.indexOf('|') + 1, s.indexOf(';'))); + s = s.substring(s.indexOf(';') + 1), l = l < g ? g : l; + } + c.setTime(l), o.c_wr(u, i, c); + } + return t == o.c_r(o.Util.urlEncode(e)); + } + s.c_wr = s.c_w, s.__ccucw = !0, s.c_w = n; + } + s.p_fo = new Function('n', 'var s=this;if(!s.__fo){s.__fo=new Object;}if(!s.__fo[n]){s.__fo[n]=new Object;return 1;}else {return 0;}'), s.repl = new Function('x', 'o', 'n', 'var i=x.indexOf(o),l=n.length;while(x&&i>=0){x=x.substring(0,i)+n+x.substring(i+o.length);i=x.indexOf(o,i+l)}return x'), s.clickPast = new Function('scp', 'ct_ev', 'cp_ev', 'cpc', 'var s=this,scp,ct_ev,cp_ev,cpc,ev,tct;if(s.p_fo(ct_ev)==1){if(!cpc){cpc=\'s_cpc\';}ev=s.events?s.events+\',\':\'\';if(scp){s.events=ev+ct_ev;s.c_w(cpc,1,0);}else{if(s.c_r(cpc)>=1){s.events=ev+cp_ev;s.c_w(cpc,0,0);}}}'), s.manageQueryParam = new Function('p', 'w', 'e', 'u', 'var s=this,x,y,i,qs,qp,qv,f,b;u=u?u:(s.pageURL?s.pageURL:\'\'+window.location);x=u.indexOf(\'?\');qs=x>-1?u.substring(x,u.length):\'\';u=x>-1?u.substring(0,x):u;x=qs.indexOf(\'?\'+p+\'=\');if(x>-1){y=qs.indexOf(\'&\');f=\'\';if(y>-1){qp=qs.substring(x+1,y);b=qs.substring(y+1,qs.length);}else{qp=qs.substring(1,qs.length);b=\'\';}}else{x=qs.indexOf(\'&\'+p+\'=\');if(x>-1){f=qs.substring(1,x);b=qs.substring(x+1,qs.length);y=b.indexOf(\'&\');if(y>-1){qp=b.substring(0,y);b=b.substring(y,b.length);}else{qp=b;b=\'\';}}}if(e&&qp){y=qp.indexOf(\'=\');qv=y>-1?qp.substring(y+1,qp.length):\'\';var eui=0;while(qv.indexOf(\'%25\')>-1){qv=unescape(qv);eui++;if(eui==10)break;}qv=s.replace(qv,\'+\',\' \');qv=escape(qv);qv=s.replace(qv,\'%25\',\'%\');qv=s.replace(qv,\'%7C\',\'|\');qv=s.replace(qv,\'%7c\',\'|\');qp=qp.substring(0,y+1)+qv;}if(w&&qp){if(f)qs=\'?\'+qp+\'&\'+f+b;else if(b)qs=\'?\'+qp+\'&\'+b;else qs=\'?\'+qp}else if(f)qs=\'?\'+f+\'&\'+qp+b;else if(b)qs=\'?\'+qp+\'&\'+b;else if(qp)qs=\'?\'+qp;return u+qs;'), s.handlePPVevents = new Function('', 'var W=window,s=W.s_name&&typeof W[s_name]==\'object\'?W[s_name]:0;if(!s||!s.getPPVid)return;var B=document.body,E=document.documentElement,D=window.document;d=Math.max(B.scrollHeight,E.scrollHeight,B.offsetHeight,E.offsetHeight,B.clientHeight,E.clientHeight),v=window.innerHeight||E.clientHeight||B.clientHeight,t=window.pageYOffset||D.documentElement.scrollTop||D.body.scrollTop,h=t+v,p=Math.min(Math.round(h/d*100),100),c=s.c_r(\'s_ppv\'),a=c.indexOf(\',\')>-1?c.split(\',\',4):[],l=a.length,n=l>0?a[0]:escape(s.getPPVid),P=l>1?parseInt(a[1]):0,f=l>2?parseInt(a[2]):p,H=l>3?parseInt(a[3]):0,cn=p>0?n+\',\'+(p>P?p:P)+\',\'+f+\',\'+(h>H?h:H):\'\';s.c_w(\'s_ppv\',cn)'), s.getPercentPageViewed = new Function('n', 'if(typeof this.linkType!=\'undefined\')return\'\';var s=this,w=window,F=false,e=window.addEventListener||window.attachEvent||\'\';i=3,v=s.c_r(\'s_ppv\'),a=v.indexOf(\',\')>-1?v.split(\',\',4):[];if(a.length<4){while(i>0)a[i--]=i= 0 && ((i = (t = n + t.substring(i + 1) + n).toString().toLowerCase().indexOf(n + e.toString().toLowerCase() + '=')) >= 0 && ((i = (t = t.substring(i + n.length + e.length + 1)).toString().toLowerCase().indexOf(n.toString().toLowerCase())) >= 0 && (t = t.substring(0, i)), t.length > 0))) ? s.unescape(t) : ''; + }), s.oncePerPage = function (e) { + if (e) { + for (var t = s.opp.split(','), n = 0; n < t.length; n++) + s.events && (v = new RegExp(',*?' + t[n] + '\\b'), null != s.events.match(v) && (s.events = s.events.replace(v, ''), ',' == s.events.substring(0, 1) && (s.events = s.events.substring(1, s.events.length)))); + for (var i = e.split(','), r = 0; r < i.length; r++) + s.opp = s.apl(s.opp, i[r], ',', 2); + } + }, s.loadModule('Media'), s.Media.autoTrack = !0, s.Media.trackWhilePlaying = !0, s.Media.trackVars = 'None', s.Media.trackEvents = 'None', 'us' == _satellite.getVar('content:region').toLowerCase() && window.location.href.indexOf('/fedextrack') > -1 && (s.contextData['cm.ssf'] = 1); + var r = '' !== _satellite.getVar('aam:regionFlag') && 0 != _satellite.getVar('aam:regionFlag'), a = '' !== _satellite.getVar('aam:countryFlag') && 0 != _satellite.getVar('aam:countryFlag'), o = 'false' !== _satellite.getVar('aam:IdSyncDisable'), c = _satellite.getVar('aam:RegionContainerNSID'); + (r || a) && (s.loadModule('AudienceManagement'), s.AudienceManagement.setup({ + partner: 'fedex', + containerNSID: c, + visitorService: { namespace: '1E22171B520E93BF0A490D44@AdobeOrg' }, + disableDefaultRequest: !0, + disableScriptAttachment: !0, + disableDestinationPublishingIframe: o + })); + } + function $___var_b9d046ef37aff189(e) { + var t = this; + t.s = e; + var n = window; + n.s_c_in || (n.s_c_il = [], n.s_c_in = 0), t._il = n.s_c_il, t._in = n.s_c_in, t._il[t._in] = t, n.s_c_in++, t._c = 's_m', t.list = [], t.add = function (i, r) { + var a; + r || (r = 's_Integrate_' + i), n[r] || (n[r] = {}), (a = t[i] = n[r]).a = i, a.e = t, a._c = 0, a._d = 0, null == a.disable && (a.disable = 0), a.get = function (e, i) { + var r, s = document, o = s.getElementsByTagName('HEAD'); + if (!a.disable && (i || (v = 's_' + t._in + '_Integrate_' + a.a + '_get_' + a._c), a._c++, a.VAR = v, a.CALLBACK = 's_c_il[' + t._in + '].' + a.a + '.callback', a.delay(), o = o && 0 < o.length ? o[0] : s.body)) + try { + (r = s.createElement('SCRIPT')).type = 'text/javascript', r.setAttribute('async', 'async'), r.src = t.c(a, e), 0 > e.indexOf('[CALLBACK]') && (r.onload = r.onreadystatechange = function () { + a.callback(n[v]); + }), o.firstChild ? o.insertBefore(r, o.firstChild) : o.appendChild(r); + } catch (e) { + } + }, a.callback = function (e) { + var t; + if (e) + for (t in e) + Object.prototype[t] || (a[t] = e[t]); + a.ready(); + }, a.beacon = function (e) { + var i = 's_i_' + t._in + '_Integrate_' + a.a + '_' + a._c; + a.disable || (a._c++, (i = n[i] = new Image()).src = t.c(a, e)); + }, a.script = function (e) { + a.get(e, 1); + }, a.delay = function () { + a._d++; + }, a.ready = function () { + a._d--, a.disable || e.delayReady(); + }, t.list.push(i); + }, t._g = function (n) { + var i, r = (n ? 'use' : 'set') + 'Vars'; + for (n = 0; n < t.list.length; n++) + if ((i = t[t.list[n]]) && !i.disable && i[r]) + try { + i[r](e, i); + } catch (e) { + } + }, t._t = function () { + t._g(1); + }, t._d = function () { + var e, n; + for (e = 0; e < t.list.length; e++) + if ((n = t[t.list[e]]) && !n.disable && 0 < n._d) + return 1; + return 0; + }, t.c = function (t, n) { + var i, r, a, s; + for ('http' != n.toLowerCase().substring(0, 4) && (n = 'http://' + n), e.ssl && (n = e.replace(n, 'http:', 'https:')), t.RAND = Math.floor(10000000000000 * Math.random()), i = 0; 0 <= i;) + 0 <= (i = n.indexOf('[', i)) && ((r = n.indexOf(']', i)) > i && (2 < (a = n.substring(i + 1, r)).length && 's.' == a.substring(0, 2) ? (s = e[a.substring(2)]) || (s = '') : (s = '' + t[a]) != t[a] && parseFloat(s) != t[a] && (a = 0), a && (n = n.substring(0, i) + encodeURIComponent(s) + n.substring(r + 1)), i = r)); + return n; + }; + } + function $___var_64e8746f5310894a(e) { + var t = this; + t.s = e; + var n = window; + n.s_c_in || (n.s_c_il = [], n.s_c_in = 0), t._il = n.s_c_il, t._in = n.s_c_in, t._il[t._in] = t, n.s_c_in++, t._c = 's_m', t.setup = function (e) { + n.DIL && e && (e.disableDefaultRequest = !0, e.disableCORS = !0, e.secureDataCollection = !1, t.instance = n.DIL.create(e), t.tools = n.DIL.tools); + }, t.isReady = function () { + return !!t.instance; + }, t.getEventCallConfigParams = function () { + return t.instance && t.instance.api && t.instance.api.getEventCallConfigParams ? t.instance.api.getEventCallConfigParams() : {}; + }, t.passData = function (e) { + t.instance && t.instance.api && t.instance.api.passData && t.instance.api.passData(e); + }; + } + function $___var_9c59a185d4bd1fec(e) { + function t() { + var e = l.pageYOffset + (l.innerHeight || 0); + e && e > +d && (d = e); + } + function n() { + if (c.scrollReachSelector) { + var t = e.d.querySelector && e.d.querySelector(c.scrollReachSelector); + t ? (d = t.scrollTop || 0, t.addEventListener('scroll', function () { + var e; + (e = t && t.scrollTop + t.clientHeight || 0) > d && (d = e); + })) : 0 < p-- && setTimeout(n, 1000); + } + } + function i(e, t) { + var n, i, r; + if (e && t && (n = c.c[t] || (c.c[t] = t.split(',')))) + for (r = 0; r < n.length && (i = n[r++]);) + if (-1 < e.indexOf(i)) + return null; + return e; + } + function r(t, n, i, r, a) { + var s, o; + if ((t.dataset && (o = t.dataset[n]) || t.getAttribute && ((o = t.getAttribute('data-' + i)) || (o = t.getAttribute(i)))) && (s = o), !s && e.useForcedLinkTracking && a) { + var c; + if (t = t.onclick ? '' + t.onclick : '', varValue = '', r && t && 0 <= (n = t.indexOf(r))) { + for (n += r.length; n < t.length;) + if (i = t.charAt(n++), 0 <= '\'"'.indexOf(i)) { + c = i; + break; + } + for (o = !1; n < t.length && c && (i = t.charAt(n), o || i !== c);) + '\\' === i ? o = !0 : (varValue += i, o = !1), n++; + } + (c = varValue) && (e.w[r] = c); + } + return s || a && e.w[r]; + } + function a(e, t, n) { + var r; + return (r = c[t](e, n)) && i(o(r), c[t + 'Exclusions']); + } + function s(e, t, n) { + var i; + if (e && !(1 === (i = e.nodeType) && (i = e.nodeName) && (i = i.toUpperCase()) && f[i]) && (1 === e.nodeType && (i = e.nodeValue) && (t[t.length] = i), n.a || n.t || n.s || !e.getAttribute || ((i = e.getAttribute('alt')) ? n.a = i : (i = e.getAttribute('title')) ? n.t = i : 'IMG' == ('' + e.nodeName).toUpperCase() && (i = e.getAttribute('src') || e.src) && (n.s = i)), (i = e.childNodes) && i.length)) + for (e = 0; e < i.length; e++) + s(i[e], t, n); + } + function o(e) { + if (null == e || null == e) + return e; + try { + return e.replace(RegExp('^[\\s\\n\\f\\r\\t\t-\r \xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u205F\u3000\uFEFF]+', 'mg'), '').replace(RegExp('[\\s\\n\\f\\r\\t\t-\r \xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u205F\u3000\uFEFF]+$', 'mg'), '').replace(RegExp('[\\s\\n\\f\\r\\t\t-\r \xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u205F\u3000\uFEFF]{1,}', 'mg'), ' ').substring(0, 254); + } catch (e) { + } + } + var c = this; + c.s = e; + var l = window; + l.s_c_in || (l.s_c_il = [], l.s_c_in = 0), c._il = l.s_c_il, c._in = l.s_c_in, c._il[c._in] = c, l.s_c_in++, c._c = 's_m'; + var u, d = 0, p = 60; + c.c = {}; + var f = { + SCRIPT: 1, + STYLE: 1, + LINK: 1, + CANVAS: 1 + }; + c._g = function () { + var t, n, i, r = e.contextData, s = e.linkObject; + (t = e.pageName || e.pageURL) && (n = a(s, 'link', e.linkName)) && (i = a(s, 'region')) && (r['a.activitymap.page'] = t.substring(0, 255), r['a.activitymap.link'] = 128 < n.length ? n.substring(0, 128) : n, r['a.activitymap.region'] = 127 < i.length ? i.substring(0, 127) : i, 0 < d && (r['a.activitymap.xy'] = 10 * Math.floor(d / 10)), r['a.activitymap.pageIDType'] = e.pageName ? 1 : 0); + }, c._d = function () { + c.trackScrollReach && !u && (c.scrollReachSelector ? n() : (t(), l.addEventListener && l.addEventListener('scroll', t, !1)), u = !0); + }, c.link = function (e, t) { + var n; + if (t) + n = i(o(t), c.linkExclusions); + else if ((n = e) && !(n = r(e, 'sObjectId', 's-object-id', 's_objectID', 1))) { + var a, l; + (l = i(o(e.innerText || e.textContent), c.linkExclusions)) || (s(e, a = [], n = { + a: void 0, + t: void 0, + s: void 0 + }), (l = i(o(a.join('')))) || (l = i(o(n.a ? n.a : n.t ? n.t : n.s ? n.s : void 0))) || !(a = (a = e.tagName) && a.toUpperCase ? a.toUpperCase() : '') || ('INPUT' == a || 'SUBMIT' == a && e.value ? l = i(o(e.value)) : 'IMAGE' == a && e.src && (l = i(o(e.src))))), n = l; + } + return n; + }, c.region = function (e) { + for (var t, n = c.regionIDAttribute || 'id'; e && (e = e.parentNode);) { + if (t = r(e, n, n, n)) + return t; + if ('BODY' == e.nodeName) + return 'BODY'; + } + }; + } + function $___var_ad7b5914bc3004cb(e) { + var t = this; + t.version = '2.22.0'; + var n = window; + n.s_c_in || (n.s_c_il = [], n.s_c_in = 0), t._il = n.s_c_il, t._in = n.s_c_in, t._il[t._in] = t, n.s_c_in++, t._c = 's_c'; + var i = n.AppMeasurement.ic; + i || (i = null); + var r, a, s, o = n; + try { + for (r = o.parent, a = o.location; r && r.location && a && '' + r.location != '' + a && o.location && '' + r.location != '' + o.location && r.location.host === a.host;) + r = (o = r).parent; + } catch (e) { + } + t.C = function (e) { + try { + console.log(e); + } catch (e) { + } + }, t.Ra = function (e) { + return '' + parseInt(e) == '' + e; + }, t.replace = function (e, t, n) { + return !e || 0 > e.indexOf(t) ? e : e.split(t).join(n); + }, t.escape = function (e) { + var n, i; + if (!e) + return e; + for (e = encodeURIComponent(e), n = 0; 7 > n; n++) + i = '+~!*()\''.substring(n, n + 1), 0 <= e.indexOf(i) && (e = t.replace(e, i, '%' + i.charCodeAt(0).toString(16).toUpperCase())); + return e; + }, t.unescape = function (e) { + if (!e) + return e; + e = 0 <= e.indexOf('+') ? t.replace(e, '+', ' ') : e; + try { + return decodeURIComponent(e); + } catch (e) { + } + return unescape(e); + }, t.Nb = function () { + var e, i = n.location.hostname, r = t.fpCookieDomainPeriods; + if (r || (r = t.cookieDomainPeriods), i && !t.Ka && !/^[0-9.]+$/.test(i) && (r = 2 < (r = r ? parseInt(r) : 2) ? r : 2, 0 <= (e = i.lastIndexOf('.')))) { + for (; 0 <= e && 1 < r;) + e = i.lastIndexOf('.', e - 1), r--; + t.Ka = 0 < e ? i.substring(e) : i; + } + return t.Ka; + }, t.c_r = t.cookieRead = function (e) { + e = t.escape(e); + var n = ' ' + t.d.cookie, i = n.indexOf(' ' + e + '='), r = 0 > i ? i : n.indexOf(';', i); + return '[[B]]' != (e = 0 > i ? '' : t.unescape(n.substring(i + 2 + e.length, 0 > r ? n.length : r))) ? e : ''; + }, t.c_w = t.cookieWrite = function (e, n, i) { + var r, a = t.Nb(), s = t.cookieLifetime; + return n = '' + n, s = s ? ('' + s).toUpperCase() : '', i && 'SESSION' != s && 'NONE' != s && ((r = '' != n ? parseInt(s || 0) : -60) ? (i = new Date()).setTime(i.getTime() + 1000 * r) : 1 === i && (r = (i = new Date()).getYear(), i.setYear(r + 2 + (1900 > r ? 1900 : 0)))), e && 'NONE' != s ? (t.d.cookie = t.escape(e) + '=' + t.escape('' != n ? n : '[[B]]') + '; path=/;' + (i && 'SESSION' != s ? ' expires=' + i.toUTCString() + ';' : '') + (a ? ' domain=' + a + ';' : '') + (t.writeSecureCookies ? ' secure;' : ''), t.cookieRead(e) == n) : 0; + }, t.Kb = function () { + var e = t.Util.getIeVersion(); + 'number' == typeof e && 10 > e && (t.unsupportedBrowser = !0, t.xb(t, function () { + })); + }, t.ya = function () { + var e = navigator.userAgent; + return 'Microsoft Internet Explorer' === navigator.appName || 0 <= e.indexOf('MSIE ') || 0 <= e.indexOf('Trident/') && 0 <= e.indexOf('Windows NT 6'); + }, t.xb = function (e, t) { + for (var n in e) + Object.prototype.hasOwnProperty.call(e, n) && 'function' == typeof e[n] && (e[n] = t); + }, t.K = [], t.fa = function (e, n, i) { + if (t.La) + return 0; + t.maxDelay || (t.maxDelay = 250); + var r = 0, a = new Date().getTime() + t.maxDelay, s = t.d.visibilityState, o = [ + 'webkitvisibilitychange', + 'visibilitychange' + ]; + if (s || (s = t.d.webkitVisibilityState), s && 'prerender' == s) { + if (!t.ga) + for (t.ga = 1, i = 0; i < o.length; i++) + t.d.addEventListener(o[i], function () { + var e = t.d.visibilityState; + e || (e = t.d.webkitVisibilityState), 'visible' == e && (t.ga = 0, t.delayReady()); + }); + r = 1, a = 0; + } else + i || t.u('_d') && (r = 1); + return r && (t.K.push({ + m: e, + a: n, + t: a + }), t.ga || setTimeout(t.delayReady, t.maxDelay)), r; + }, t.delayReady = function () { + var e, n = new Date().getTime(), i = 0; + for (t.u('_d') ? i = 1 : t.Aa(); 0 < t.K.length;) { + if (e = t.K.shift(), i && !e.t && e.t > n) { + t.K.unshift(e), setTimeout(t.delayReady, parseInt(t.maxDelay / 2)); + break; + } + t.La = 1, t[e.m].apply(t, e.a), t.La = 0; + } + }, t.setAccount = t.sa = function (e) { + var n, i; + if (!t.fa('setAccount', arguments)) + if (t.account = e, t.allAccounts) + for (n = t.allAccounts.concat(e.split(',')), t.allAccounts = [], n.sort(), i = 0; i < n.length; i++) + 0 != i && n[i - 1] == n[i] || t.allAccounts.push(n[i]); + else + t.allAccounts = e.split(','); + }, t.foreachVar = function (e, n) { + var i, r, a, s, o = ''; + for (a = r = '', t.lightProfileID ? (i = t.O, (o = t.lightTrackVars) && (o = ',' + o + ',' + t.la.join(',') + ',')) : (i = t.g, (t.pe || t.linkType) && (o = t.linkTrackVars, r = t.linkTrackEvents, t.pe && (a = t.pe.substring(0, 1).toUpperCase() + t.pe.substring(1), t[a] && (o = t[a].ec, r = t[a].cc))), o && (o = ',' + o + ',' + t.F.join(',') + ','), r && o && (o += ',events,')), n && (n = ',' + n + ','), r = 0; r < i.length; r++) + a = i[r], (s = t[a]) && (!o || 0 <= o.indexOf(',' + a + ',')) && (!n || 0 <= n.indexOf(',' + a + ',')) && e(a, s); + }, t.o = function (e, n, i, r, a) { + var s, o, c, l, u = '', d = 0; + if ('contextData' == e && (e = 'c'), n) { + for (s in n) + if (!(Object.prototype[s] || a && s.substring(0, a.length) != a) && n[s] && (!i || 0 <= i.indexOf(',' + (r ? r + '.' : '') + s + ','))) { + if (c = !1, d) + for (o = 0; o < d.length; o++) + if (s.substring(0, d[o].length) == d[o]) { + c = !0; + break; + } + if (!c && ('' == u && (u += '&' + e + '.'), o = n[s], a && (s = s.substring(a.length)), 0 < s.length)) + if (0 < (c = s.indexOf('.'))) + c = (a || '') + (o = s.substring(0, c)) + '.', d || (d = []), d.push(c), u += t.o(o, n, i, r, c); + else if ('boolean' == typeof o && (o = o ? 'true' : 'false'), o) { + if ('retrieveLightData' == r && 0 > a.indexOf('.contextData.')) + switch (c = s.substring(0, 4), l = s.substring(4), s) { + case 'transactionID': + s = 'xact'; + break; + case 'channel': + s = 'ch'; + break; + case 'campaign': + s = 'v0'; + break; + default: + t.Ra(l) && ('prop' == c ? s = 'c' + l : 'eVar' == c ? s = 'v' + l : 'list' == c ? s = 'l' + l : 'hier' == c && (s = 'h' + l, o = o.substring(0, 255))); + } + u += '&' + t.escape(s) + '=' + t.escape(o); + } + } + '' != u && (u += '&.' + e); + } + return u; + }, t.usePostbacks = 0, t.Qb = function () { + var e, n, r, a, s, o, c, l, u = '', d = '', p = '', f = a = '', g = t.T(); + if (t.lightProfileID ? (e = t.O, (d = t.lightTrackVars) && (d = ',' + d + ',' + t.la.join(',') + ',')) : (e = t.g, (t.pe || t.linkType) && (d = t.linkTrackVars, p = t.linkTrackEvents, t.pe && (a = t.pe.substring(0, 1).toUpperCase() + t.pe.substring(1), t[a] && (d = t[a].ec, p = t[a].cc))), d && (d = ',' + d + ',' + t.F.join(',') + ','), p && (p = ',' + p + ',', d && (d += ',events,')), t.events2 && (f += ('' != f ? ',' : '') + t.events2)), g && g.getCustomerIDs) { + if (a = i, s = g.getCustomerIDs()) + for (n in s) + Object.prototype[n] || 'object' == typeof (r = s[n]) && (a || (a = {}), r.id && (a[n + '.id'] = r.id), r.authState && (a[n + '.as'] = r.authState)); + a && (u += t.o('cid', a)); + } + for (t.AudienceManagement && t.AudienceManagement.isReady() && (u += t.o('d', t.AudienceManagement.getEventCallConfigParams())), n = 0; n < e.length; n++) { + if (a = e[n], s = t[a], r = a.substring(0, 4), o = a.substring(4), s || ('events' == a && f ? (s = f, f = '') : 'marketingCloudOrgID' == a && g && t.V('ECID') && (s = g.marketingCloudOrgID)), s && (!d || 0 <= d.indexOf(',' + a + ','))) { + switch (a) { + case 'customerPerspective': + a = 'cp'; + break; + case 'marketingCloudOrgID': + a = 'mcorgid'; + break; + case 'supplementalDataID': + a = 'sdid'; + break; + case 'timestamp': + a = 'ts'; + break; + case 'dynamicVariablePrefix': + a = 'D'; + break; + case 'visitorID': + a = 'vid'; + break; + case 'marketingCloudVisitorID': + a = 'mid'; + break; + case 'analyticsVisitorID': + a = 'aid'; + break; + case 'audienceManagerLocationHint': + a = 'aamlh'; + break; + case 'audienceManagerBlob': + a = 'aamb'; + break; + case 'authState': + a = 'as'; + break; + case 'pageURL': + a = 'g', 255 < s.length && (t.pageURLRest = s.substring(255), s = s.substring(0, 255)); + break; + case 'pageURLRest': + a = '-g'; + break; + case 'referrer': + a = 'r'; + break; + case 'vmk': + case 'visitorMigrationKey': + a = 'vmt'; + break; + case 'visitorMigrationServer': + a = 'vmf', t.ssl && t.visitorMigrationServerSecure && (s = ''); + break; + case 'visitorMigrationServerSecure': + a = 'vmf', !t.ssl && t.visitorMigrationServer && (s = ''); + break; + case 'charSet': + a = 'ce'; + break; + case 'visitorNamespace': + a = 'ns'; + break; + case 'cookieDomainPeriods': + a = 'cdp'; + break; + case 'cookieLifetime': + a = 'cl'; + break; + case 'variableProvider': + a = 'vvp'; + break; + case 'currencyCode': + a = 'cc'; + break; + case 'channel': + a = 'ch'; + break; + case 'transactionID': + a = 'xact'; + break; + case 'campaign': + a = 'v0'; + break; + case 'latitude': + a = 'lat'; + break; + case 'longitude': + a = 'lon'; + break; + case 'resolution': + a = 's'; + break; + case 'colorDepth': + a = 'c'; + break; + case 'javascriptVersion': + a = 'j'; + break; + case 'javaEnabled': + a = 'v'; + break; + case 'cookiesEnabled': + a = 'k'; + break; + case 'browserWidth': + a = 'bw'; + break; + case 'browserHeight': + a = 'bh'; + break; + case 'connectionType': + a = 'ct'; + break; + case 'homepage': + a = 'hp'; + break; + case 'events': + if (f && (s += ('' != s ? ',' : '') + f), p) + for (o = s.split(','), s = '', r = 0; r < o.length; r++) + 0 <= (l = (c = o[r]).indexOf('=')) && (c = c.substring(0, l)), 0 <= (l = c.indexOf(':')) && (c = c.substring(0, l)), 0 <= p.indexOf(',' + c + ',') && (s += (s ? ',' : '') + o[r]); + break; + case 'events2': + s = ''; + break; + case 'contextData': + u += t.o('c', t[a], d, a), s = ''; + break; + case 'lightProfileID': + a = 'mtp'; + break; + case 'lightStoreForSeconds': + a = 'mtss', t.lightProfileID || (s = ''); + break; + case 'lightIncrementBy': + a = 'mti', t.lightProfileID || (s = ''); + break; + case 'retrieveLightProfiles': + a = 'mtsr'; + break; + case 'deleteLightProfiles': + a = 'mtsd'; + break; + case 'retrieveLightData': + t.retrieveLightProfiles && (u += t.o('mts', t[a], d, a)), s = ''; + break; + default: + t.Ra(o) && ('prop' == r ? a = 'c' + o : 'eVar' == r ? a = 'v' + o : 'list' == r ? a = 'l' + o : 'hier' == r && (a = 'h' + o, s = s.substring(0, 255))); + } + s && (u += '&' + a + '=' + ('pev' != a.substring(0, 3) ? t.escape(s) : s)); + } + 'pev3' == a && t.e && (u += t.e); + } + return t.ka && (u += '&lrt=' + t.ka, t.ka = null), u; + }, t.B = function (e) { + var t = e.tagName; + return 'undefined' != '' + e.lc || 'undefined' != '' + e.Zb && 'HTML' != ('' + e.Zb).toUpperCase() ? '' : ('SHAPE' == (t = t && t.toUpperCase ? t.toUpperCase() : '') && (t = ''), t && (('INPUT' == t || 'BUTTON' == t) && e.type && e.type.toUpperCase ? t = e.type.toUpperCase() : !t && e.href && (t = 'A')), t); + }, t.Na = function (e) { + var t, i, r, a = n.location, s = e.href ? e.href : ''; + return t = s.indexOf(':'), i = s.indexOf('?'), r = s.indexOf('/'), s && (0 > t || 0 <= i && t > i || 0 <= r && t > r) && (i = e.protocol && 1 < e.protocol.length ? e.protocol : a.protocol ? a.protocol : '', t = a.pathname.lastIndexOf('/'), s = (i ? i + '//' : '') + (e.host ? e.host : a.host ? a.host : '') + ('/' != s.substring(0, 1) ? a.pathname.substring(0, 0 > t ? 0 : t) + '/' : '') + s), s; + }, t.L = function (e) { + var n, i, r = t.B(e), a = '', s = 0; + return r && (n = e.protocol, i = e.onclick, !e.href || 'A' != r && 'AREA' != r || i && n && !(0 > n.toLowerCase().indexOf('javascript')) ? i ? (a = t.replace(t.replace(t.replace(t.replace('' + i, '\r', ''), '\n', ''), '\t', ''), ' ', ''), s = 2) : 'INPUT' == r || 'SUBMIT' == r ? (e.value ? a = e.value : e.innerText ? a = e.innerText : e.textContent && (a = e.textContent), s = 3) : 'IMAGE' == r && e.src && (a = e.src) : a = t.Na(e), a) ? { + id: a.substring(0, 100), + type: s + } : 0; + }, t.jc = function (e) { + for (var n = t.B(e), i = t.L(e); e && !i && 'BODY' != n;) + (e = e.parentElement ? e.parentElement : e.parentNode) && (n = t.B(e), i = t.L(e)); + return i && 'BODY' != n || (e = 0), e && (0 <= (n = e.onclick ? '' + e.onclick : '').indexOf('.tl(') || 0 <= n.indexOf('.trackLink(')) && (e = 0), e; + }, t.Yb = function () { + var e, i, r, a, s = t.linkObject, o = t.linkType, c = t.linkURL; + if (t.ma = 1, s || (t.ma = 0, s = t.clickObject), s) { + for (e = t.B(s), i = t.L(s); s && !i && 'BODY' != e;) + (s = s.parentElement ? s.parentElement : s.parentNode) && (e = t.B(s), i = t.L(s)); + if (i && 'BODY' != e || (s = 0), s && !t.linkObject) { + var l = s.onclick ? '' + s.onclick : ''; + (0 <= l.indexOf('.tl(') || 0 <= l.indexOf('.trackLink(')) && (s = 0); + } + } else + t.ma = 1; + if (!c && s && (c = t.Na(s)), c && !t.linkLeaveQueryString && (0 <= (r = c.indexOf('?')) && (c = c.substring(0, r))), !o && c) { + var u, d = 0, p = 0; + if (t.trackDownloadLinks && t.linkDownloadFileTypes) + for (r = (l = c.toLowerCase()).indexOf('?'), a = l.indexOf('#'), 0 <= r ? 0 <= a && a < r && (r = a) : r = a, 0 <= r && (l = l.substring(0, r)), r = t.linkDownloadFileTypes.toLowerCase().split(','), a = 0; a < r.length; a++) + (u = r[a]) && l.substring(l.length - (u.length + 1)) == '.' + u && (o = 'd'); + if (t.trackExternalLinks && !o && (l = c.toLowerCase(), t.Qa(l) && (t.linkInternalFilters || (t.linkInternalFilters = n.location.hostname), r = 0, t.linkExternalFilters ? (r = t.linkExternalFilters.toLowerCase().split(','), d = 1) : t.linkInternalFilters && (r = t.linkInternalFilters.toLowerCase().split(',')), r))) { + for (a = 0; a < r.length; a++) + u = r[a], 0 <= l.indexOf(u) && (p = 1); + p ? d && (o = 'e') : d || (o = 'e'); + } + } + t.linkObject = s, t.linkURL = c, t.linkType = o, (t.trackClickMap || t.trackInlineStats) && (t.e = '', s && (o = t.pageName, c = 1, s = s.sourceIndex, o || (o = t.pageURL, c = 0), n.s_objectID && (i.id = n.s_objectID, s = i.type = 1), o && i && i.id && e && (t.e = '&pid=' + t.escape(o.substring(0, 255)) + (c ? '&pidt=' + c : '') + '&oid=' + t.escape(i.id.substring(0, 100)) + (i.type ? '&oidt=' + i.type : '') + '&ot=' + e + (s ? '&oi=' + s : '')))); + }, t.Rb = function () { + var e = t.ma, n = t.linkType, i = t.linkURL, r = t.linkName; + if (n && (i || r) && ('d' != (n = n.toLowerCase()) && 'e' != n && (n = 'o'), t.pe = 'lnk_' + n, t.pev1 = i ? t.escape(i) : '', t.pev2 = r ? t.escape(r) : '', e = 1), t.abort && (e = 0), t.trackClickMap || t.trackInlineStats || t.Ub()) { + n = {}, i = 0; + var a, s, o, c = (l = t.rb()) ? l.split('&') : 0, l = 0; + if (c) + for (a = 0; a < c.length; a++) + s = c[a].split('='), r = t.unescape(s[0]).split(','), n[s = t.unescape(s[1])] = r; + for (o in (r = t.account.split(','), a = {}, t.contextData)) + o && !Object.prototype[o] && 'a.activitymap.' == o.substring(0, 14) && (a[o] = t.contextData[o], t.contextData[o] = ''); + if (t.e = t.o('c', a) + (t.e ? t.e : ''), e || t.e) { + for (s in (e && !t.e && (l = 1), n)) + if (!Object.prototype[s]) + for (o = 0; o < r.length; o++) + for (l && ((c = n[s].join(',')) == t.account && (t.e += ('&' != s.charAt(0) ? '&' : '') + s, n[s] = [], i = 1)), a = 0; a < n[s].length; a++) + (c = n[s][a]) == r[o] && (l && (t.e += '&u=' + t.escape(c) + ('&' != s.charAt(0) ? '&' : '') + s + '&u=0'), n[s].splice(a, 1), i = 1); + if (e || (i = 1), i) { + for (s in (l = '', a = 2, !e && t.e && (l = t.escape(r.join(',')) + '=' + t.escape(t.e), a = 1), n)) + !Object.prototype[s] && 0 < a && 0 < n[s].length && (l += (l ? '&' : '') + t.escape(n[s].join(',')) + '=' + t.escape(s), a--); + t.zb(l); + } + } + } + return e; + }, t.rb = function () { + return t.useLinkTrackSessionStorage ? t.Ea() ? n.sessionStorage.getItem(t.P) : void 0 : t.cookieRead(t.P); + }, t.Ea = function () { + return !!n.sessionStorage; + }, t.zb = function (e) { + t.useLinkTrackSessionStorage ? t.Ea() && n.sessionStorage.setItem(t.P, e) : t.cookieWrite(t.P, e); + }, t.Sb = function () { + if (!t.bc) { + var e, n, i = new Date(), r = o.location, a = n = e = '', s = '', c = '', l = '1.2', u = t.cookieWrite('s_cc', 'true', 0) ? 'Y' : 'N', d = '', p = ''; + if (i.setUTCDate && (l = '1.3', 0 .toPrecision && (l = '1.5', (i = []).forEach))) { + l = '1.6', n = 0, e = {}; + try { + (n = new Iterator(e)).next && (l = '1.7', i.reduce && ((l = '1.8').trim && (l = '1.8.1', Date.parse && (l = '1.8.2', Object.create && (l = '1.8.5'))))); + } catch (e) { + } + } + e = screen.width + 'x' + screen.height, a = navigator.javaEnabled() ? 'Y' : 'N', n = screen.pixelDepth ? screen.pixelDepth : screen.colorDepth, s = t.w.innerWidth ? t.w.innerWidth : t.d.documentElement.offsetWidth, c = t.w.innerHeight ? t.w.innerHeight : t.d.documentElement.offsetHeight; + try { + t.b.addBehavior('#default#homePage'), d = t.b.kc(r) ? 'Y' : 'N'; + } catch (e) { + } + try { + t.b.addBehavior('#default#clientCaps'), p = t.b.connectionType; + } catch (e) { + } + t.resolution = e, t.colorDepth = n, t.javascriptVersion = l, t.javaEnabled = a, t.cookiesEnabled = u, t.browserWidth = s, t.browserHeight = c, t.connectionType = p, t.homepage = d, t.bc = 1; + } + }, t.Q = {}, t.loadModule = function (e, i) { + var r = t.Q[e]; + if (!r) { + r = n['AppMeasurement_Module_' + e] ? new n['AppMeasurement_Module_' + e](t) : {}, t.Q[e] = t[e] = r, r.kb = function () { + return r.ub; + }, r.Ab = function (n) { + (r.ub = n) && (t[e + '_onLoad'] = n, t.fa(e + '_onLoad', [ + t, + r + ], 1) || n(t, r)); + }; + try { + Object.defineProperty ? Object.defineProperty(r, 'onLoad', { + get: r.kb, + set: r.Ab + }) : r._olc = 1; + } catch (e) { + r._olc = 1; + } + } + i && (t[e + '_onLoad'] = i, t.fa(e + '_onLoad', [ + t, + r + ], 1) || i(t, r)); + }, t.u = function (e) { + var n, i; + for (n in t.Q) + if (!Object.prototype[n] && (i = t.Q[n]) && (i._olc && i.onLoad && (i._olc = 0, i.onLoad(t, i)), i[e] && i[e]())) + return 1; + return 0; + }, t.Ub = function () { + return !(!t.ActivityMap || !t.ActivityMap._c); + }, t.Vb = function () { + var e = Math.floor(10000000000000 * Math.random()), n = t.visitorSampling, i = t.visitorSamplingGroup, r = (i = 's_vsn_' + (t.visitorNamespace ? t.visitorNamespace : t.account) + (i ? '_' + i : ''), t.cookieRead(i)); + if (n) { + if (n *= 100, r && (r = parseInt(r)), !r) { + if (!t.cookieWrite(i, e)) + return 0; + r = e; + } + if (r % 10000 > n) + return 0; + } + return 1; + }, t.S = function (e, n) { + var i, r, a, s, o, c, l; + for (l = {}, i = 0; 2 > i; i++) + for (r = 0 < i ? t.Ga : t.g, a = 0; a < r.length; a++) + if ((o = e[s = r[a]]) || e['!' + s]) { + if (o && !n && ('contextData' == s || 'retrieveLightData' == s) && t[s]) + for (c in t[s]) + o[c] || (o[c] = t[s][c]); + t[s] || (l['!' + s] = 1), l[s] = t[s], t[s] = o; + } + return l; + }, t.hc = function (e) { + var n, i, r, a; + for (n = 0; 2 > n; n++) + for (i = 0 < n ? t.Ga : t.g, r = 0; r < i.length; r++) + e[a = i[r]] = t[a], e[a] || 'prop' !== a.substring(0, 4) && 'eVar' !== a.substring(0, 4) && 'hier' !== a.substring(0, 4) && 'list' !== a.substring(0, 4) && 'channel' !== a && 'events' !== a && 'eventList' !== a && 'products' !== a && 'productList' !== a && 'purchaseID' !== a && 'transactionID' !== a && 'state' !== a && 'zip' !== a && 'campaign' !== a && 'events2' !== a && 'latitude' !== a && 'longitude' !== a && 'ms_a' !== a && 'contextData' !== a && 'supplementalDataID' !== a && 'tnt' !== a && 'timestamp' !== a && 'abort' !== a && 'useBeacon' !== a && 'linkObject' !== a && 'clickObject' !== a && 'linkType' !== a && 'linkName' !== a && 'linkURL' !== a && 'bodyClickTarget' !== a && 'bodyClickFunction' !== a || (e['!' + a] = 1); + }, t.Mb = function (e) { + var t, n, i, r, a, s, o = 0, c = '', l = ''; + if (e && 255 < e.length && (0 < (n = (t = '' + e).indexOf('?')) && (s = t.substring(n + 1), i = 0, 'http://' == (r = (t = t.substring(0, n)).toLowerCase()).substring(0, 7) ? i += 7 : 'https://' == r.substring(0, 8) && (i += 8), 0 < (n = r.indexOf('/', i)) && (r = r.substring(i, n), a = t.substring(n), t = t.substring(0, n), 0 <= r.indexOf('google') ? o = ',q,ie,start,search_key,word,kw,cd,' : 0 <= r.indexOf('yahoo.co') ? o = ',p,ei,' : 0 <= r.indexOf('baidu.') && (o = ',wd,word,'), o && s)))) { + if ((e = s.split('&')) && 1 < e.length) { + for (i = 0; i < e.length; i++) + 0 < (n = (r = e[i]).indexOf('=')) && 0 <= o.indexOf(',' + r.substring(0, n) + ',') ? c += (c ? '&' : '') + r : l += (l ? '&' : '') + r; + c && l ? s = c + '&' + l : l = ''; + } + e = t + (0 < (n = 253 - (s.length - l.length) - t.length) ? a.substring(0, n) : '') + '?' + s; + } + return e; + }, t.eb = function (e) { + var n = t.d.visibilityState, i = [ + 'webkitvisibilitychange', + 'visibilitychange' + ]; + if (n || (n = t.d.webkitVisibilityState), n && 'prerender' == n) { + if (e) + for (n = 0; n < i.length; n++) + t.d.addEventListener(i[n], function () { + var n = t.d.visibilityState; + n || (n = t.d.webkitVisibilityState), 'visible' == n && e(); + }); + return !1; + } + return !0; + }, t.ca = !1, t.H = !1, t.Cb = function () { + t.H = !0, t.p(); + }, t.I = !1, t.Db = function (e) { + t.marketingCloudVisitorID = e.MCMID, t.visitorOptedOut = e.MCOPTOUT, t.analyticsVisitorID = e.MCAID, t.audienceManagerLocationHint = e.MCAAMLH, t.audienceManagerBlob = e.MCAAMB, t.I = !1, t.p(); + }, t.cb = function (e) { + return t.maxDelay || (t.maxDelay = 250), !t.u('_d') || (e && setTimeout(function () { + e(); + }, t.maxDelay), !1); + }, t.aa = !1, t.G = !1, t.Aa = function () { + t.G = !0, t.p(); + }, t.isReadyToTrack = function () { + var e = !0; + return !(!t.ob() || !t.mb()) && (t.qb() || (e = !1), t.tb() || (e = !1), e); + }, t.ob = function () { + return t.ca || t.H || (t.eb(t.Cb) ? t.H = !0 : t.ca = !0), !(t.ca && !t.H); + }, t.mb = function () { + var e = t.wa(); + if (e) { + if (!t.ta && !t.ba) + return e.fetchPermissions(t.vb, !0), t.ba = !0, !1; + if (!t.ta) + return !1; + if (!e.isApproved(e.Categories.ANALYTICS)) + return !1; + } + return !0; + }, t.V = function (e) { + var n = t.wa(); + return !(n && !n.isApproved(n.Categories[e])); + }, t.wa = function () { + return n.adobe && n.adobe.optIn ? n.adobe.optIn : null; + }, t.Y = !0, t.qb = function () { + var e = t.T(); + return !e || !e.getVisitorValues || (t.Y && (t.Y = !1, t.I || (t.I = !0, e.getVisitorValues(t.Db))), !t.I); + }, t.T = function () { + var e = t.visitor; + return e && !e.isAllowed() && (e = null), e; + }, t.tb = function () { + return t.aa || t.G || (t.cb(t.Aa) ? t.G = !0 : t.aa = !0), !(t.aa && !t.G); + }, t.ba = !1, t.vb = function () { + t.ba = !1, t.ta = !0; + }, t.j = i, t.q = 0, t.callbackWhenReadyToTrack = function (e, n, r) { + var a; + (a = {}).Hb = e, a.Gb = n, a.Eb = r, t.j == i && (t.j = []), t.j.push(a), 0 == t.q && (t.q = setInterval(t.p, 100)); + }, t.p = function () { + var e; + if (t.isReadyToTrack() && (t.Bb(), t.j != i)) + for (; 0 < t.j.length;) + (e = t.j.shift()).Gb.apply(e.Hb, e.Eb); + }, t.Bb = function () { + t.q && (clearInterval(t.q), t.q = 0); + }, t.ua = function (e) { + var n, r = {}; + if (t.hc(r), e != i) + for (n in e) + r[n] = e[n]; + t.callbackWhenReadyToTrack(t, t.Fa, [r]), t.Da(); + }, t.Ob = function () { + var e, n = t.cookieRead('s_fid'), i = '', r = ''; + e = 8; + var a = 4; + if (!n || 0 > n.indexOf('-')) { + for (n = 0; 16 > n; n++) + e = Math.floor(Math.random() * e), i += '0123456789ABCDEF'.substring(e, e + 1), e = Math.floor(Math.random() * a), r += '0123456789ABCDEF'.substring(e, e + 1), e = a = 16; + n = i + '-' + r; + } + return t.cookieWrite('s_fid', n, 1) || (n = 0), n; + }, t.Fa = function (e) { + var i, r = new Date(), a = 's' + Math.floor(r.getTime() / 10800000) % 10 + Math.floor(10000000000000 * Math.random()), s = r.getYear(), c = (s = 't=' + t.escape(r.getDate() + '/' + r.getMonth() + '/' + (1900 > s ? s + 1900 : s) + ' ' + r.getHours() + ':' + r.getMinutes() + ':' + r.getSeconds() + ' ' + r.getDay() + ' ' + r.getTimezoneOffset()), t.T()); + e && (i = t.S(e, 1)), t.Vb() && !t.visitorOptedOut && (t.xa() || (t.fid = t.Ob()), t.Yb(), t.usePlugins && t.doPlugins && t.doPlugins(t), t.account && (t.abort || (t.trackOffline && !t.timestamp && (t.timestamp = Math.floor(r.getTime() / 1000)), e = n.location, t.pageURL || (t.pageURL = e.href ? e.href : e), t.referrer || t.$a || (e = t.Util.getQueryParam('adobe_mc_ref', null, null, !0), t.referrer = e || void 0 === e ? void 0 === e ? '' : e : o.document.referrer), t.$a = 1, !t.referrer && t.Z && (t.referrer = t.Z), t.Z = 0, t.referrer = t.Mb(t.referrer), t.u('_g')), t.Rb() && !t.abort && (c && t.V('TARGET') && !t.supplementalDataID && c.getSupplementalDataID && (t.supplementalDataID = c.getSupplementalDataID('AppMeasurement:' + t._in, !t.expectSupplementalData)), t.V('AAM') || (t.contextData['cm.ssf'] = 1), t.Sb(), t.wb(), s += t.Qb(), t.sb(a, s), t.u('_t'), t.referrer = ''))), t.referrer && (t.Z = t.referrer), t.Da(), i && t.S(i, 1); + }, t.t = t.track = function (e, n) { + n && t.S(n), t.Y = !0, t.isReadyToTrack() ? null != t.j && 0 < t.j.length ? (t.ua(e), t.p()) : t.Fa(e) : t.ua(e); + }, t.wb = function () { + t.writeSecureCookies && !t.ssl && t.ab(); + }, t.ab = function () { + t.contextData.excCodes = t.contextData.excCodes ? t.contextData.excCodes : [], t.contextData.excCodes.push(1); + }, t.Da = function () { + t.abort = t.supplementalDataID = t.timestamp = t.pageURLRest = t.linkObject = t.clickObject = t.linkURL = t.linkName = t.linkType = n.s_objectID = t.pe = t.pev1 = t.pev2 = t.pev3 = t.e = t.lightProfileID = t.useBeacon = t.referrer = 0, t.contextData && t.contextData.excCodes && (t.contextData.excCodes = 0); + }, t.Ca = [], t.registerPreTrackCallback = function (e) { + for (var n = [], i = 1; i < arguments.length; i++) + n.push(arguments[i]); + 'function' == typeof e ? t.Ca.push([ + e, + n + ]) : t.debugTracking && t.C('DEBUG: Non function type passed to registerPreTrackCallback'); + }, t.hb = function (e) { + t.va(t.Ca, e); + }, t.Ba = [], t.registerPostTrackCallback = function (e) { + for (var n = [], i = 1; i < arguments.length; i++) + n.push(arguments[i]); + 'function' == typeof e ? t.Ba.push([ + e, + n + ]) : t.debugTracking && t.C('DEBUG: Non function type passed to registerPostTrackCallback'); + }, t.gb = function (e) { + t.va(t.Ba, e); + }, t.va = function (e, n) { + if ('object' == typeof e) + for (var i = 0; i < e.length; i++) { + var r = e[i][0], a = e[i][1].slice(); + if (a.unshift(n), 'function' == typeof r) + try { + r.apply(null, a); + } catch (e) { + t.debugTracking && t.C(e.message); + } + } + }, t.tl = t.trackLink = function (e, n, i, r, a) { + return t.linkObject = e, t.linkType = n, t.linkName = i, a && (t.bodyClickTarget = e, t.bodyClickFunction = a), t.track(r); + }, t.trackLight = function (e, n, i, r) { + return t.lightProfileID = e, t.lightStoreForSeconds = n, t.lightIncrementBy = i, t.track(r); + }, t.clearVars = function () { + var e, n; + for (e = 0; e < t.g.length; e++) + ('prop' == (n = t.g[e]).substring(0, 4) || 'eVar' == n.substring(0, 4) || 'hier' == n.substring(0, 4) || 'list' == n.substring(0, 4) || 'channel' == n || 'events' == n || 'eventList' == n || 'products' == n || 'productList' == n || 'purchaseID' == n || 'transactionID' == n || 'state' == n || 'zip' == n || 'campaign' == n) && (t[n] = void 0); + }, t.tagContainerMarker = '', t.sb = function (e, n) { + var i = t.ib() + '/' + e + '?AQB=1&ndh=1&pf=1&' + (t.za() ? 'callback=s_c_il[' + t._in + '].doPostbacks&et=1&' : '') + n + '&AQE=1'; + t.hb(i), t.fb(i), t.U(); + }, t.ib = function () { + var e = t.jb(); + return 'http' + (t.ssl ? 's' : '') + '://' + e + '/b/ss/' + t.account + '/' + (t.mobile ? '5.' : '') + (t.za() ? '10' : '1') + '/JS-' + t.version + (t.ac ? 'T' : '') + (t.tagContainerMarker ? '-' + t.tagContainerMarker : ''); + }, t.za = function () { + return t.AudienceManagement && t.AudienceManagement.isReady() || 0 != t.usePostbacks; + }, t.jb = function () { + var e = t.dc, n = t.trackingServer; + return n ? t.trackingServerSecure && t.ssl && (n = t.trackingServerSecure) : ('d1' == (e = e ? ('' + e).toLowerCase() : 'd1') ? e = '112' : 'd2' == e && (e = '122'), n = t.lb() + '.' + e + '.2o7.net'), n; + }, t.lb = function () { + var e = t.visitorNamespace; + return e || (e = (e = t.account.split(',')[0]).replace(/[^0-9a-z]/gi, '')), e; + }, t.Za = /{(%?)(.*?)(%?)}/, t.gc = RegExp(t.Za.source, 'g'), t.Lb = function (e) { + if ('object' == typeof e.dests) + for (var n = 0; n < e.dests.length; ++n) { + var i = e.dests[n]; + if ('string' == typeof i.c && 'aa.' == i.id.substr(0, 3)) + for (var r = i.c.match(t.gc), a = 0; a < r.length; ++a) { + var s = r[a], o = s.match(t.Za), c = ''; + '%' == o[1] && 'timezone_offset' == o[2] ? c = new Date().getTimezoneOffset() : '%' == o[1] && 'timestampz' == o[2] && (c = t.Pb()), i.c = i.c.replace(s, t.escape(c)); + } + } + }, t.Pb = function () { + var e = new Date(), n = new Date(60000 * Math.abs(e.getTimezoneOffset())); + return t.k(4, e.getFullYear()) + '-' + t.k(2, e.getMonth() + 1) + '-' + t.k(2, e.getDate()) + 'T' + t.k(2, e.getHours()) + ':' + t.k(2, e.getMinutes()) + ':' + t.k(2, e.getSeconds()) + (0 < e.getTimezoneOffset() ? '-' : '+') + t.k(2, n.getUTCHours()) + ':' + t.k(2, n.getUTCMinutes()); + }, t.k = function (e, t) { + return (Array(e + 1).join(0) + t).slice(-e); + }, t.qa = {}, t.doPostbacks = function (e) { + if ('object' == typeof e) + if (t.Lb(e), 'object' == typeof t.AudienceManagement && 'function' == typeof t.AudienceManagement.isReady && t.AudienceManagement.isReady() && 'function' == typeof t.AudienceManagement.passData) + t.AudienceManagement.passData(e); + else if ('object' == typeof e && 'object' == typeof e.dests) + for (var n = 0; n < e.dests.length; ++n) { + var i = e.dests[n]; + 'object' == typeof i && 'string' == typeof i.c && 'string' == typeof i.id && 'aa.' == i.id.substr(0, 3) && (t.qa[i.id] = new Image(), t.qa[i.id].alt = '', t.qa[i.id].src = i.c); + } + }, t.fb = function (e) { + t.i || t.Tb(), t.i.push(e), t.ja = t.A(), t.Ya(); + }, t.Tb = function () { + t.i = t.Wb(), t.i || (t.i = []); + }, t.Wb = function () { + var e, i; + if (t.pa()) { + try { + (i = n.localStorage.getItem(t.na())) && (e = n.JSON.parse(i)); + } catch (e) { + } + return e; + } + }, t.pa = function () { + var e = !0; + return t.trackOffline && t.offlineFilename && n.localStorage && n.JSON || (e = !1), e; + }, t.Oa = function () { + var e = 0; + return t.i && (e = t.i.length), t.l && e++, e; + }, t.U = function () { + if (!t.l || (t.v && t.v.complete && t.v.D && t.v.R(), !t.l)) + if (t.Pa = i, t.oa) + t.ja > t.N && t.Wa(t.i), t.ra(500); + else { + var e = t.Fb(); + 0 < e ? t.ra(e) : (e = t.Ma()) && (t.l = 1, t.Xb(e), t.$b(e)); + } + }, t.ra = function (e) { + t.Pa || (e || (e = 0), t.Pa = setTimeout(t.U, e)); + }, t.Fb = function () { + var e; + return !t.trackOffline || 0 >= t.offlineThrottleDelay ? 0 : (e = t.A() - t.Ua, t.offlineThrottleDelay < e ? 0 : t.offlineThrottleDelay - e); + }, t.Ma = function () { + if (0 < t.i.length) + return t.i.shift(); + }, t.Xb = function (e) { + if (t.debugTracking) { + var n, i = 'AppMeasurement Debug: ' + e; + for (e = e.split('&'), n = 0; n < e.length; n++) + i += '\n\t' + t.unescape(e[n]); + t.C(i); + } + }, t.xa = function () { + return t.marketingCloudVisitorID || t.analyticsVisitorID; + }, t.X = !1; + try { + s = JSON.parse('{"x":"y"}'); + } catch (e) { + s = null; + } + for (s && 'y' == s.x ? (t.X = !0, t.W = function (e) { + return JSON.parse(e); + }) : n.$ && n.$.parseJSON ? (t.W = function (e) { + return n.$.parseJSON(e); + }, t.X = !0) : t.W = function () { + return null; + }, t.$b = function (e) { + var r, a, s; + if (t.nb(e) && (a = 1, r = { + send: function (e) { + t.useBeacon = !1, navigator.sendBeacon(e) ? r.R() : r.ha(); + } + }), !r && t.xa() && 2047 < e.length && (t.bb() && (a = 2, r = new XMLHttpRequest()), r && (t.AudienceManagement && t.AudienceManagement.isReady() || 0 != t.usePostbacks) && (t.X ? r.Ha = !0 : r = 0)), !r && t.fc && (e = e.substring(0, 2047)), !r && t.d.createElement && (0 != t.usePostbacks || t.AudienceManagement && t.AudienceManagement.isReady()) && (r = t.d.createElement('SCRIPT')) && 'async' in r && ((s = (s = t.d.getElementsByTagName('HEAD')) && s[0] ? s[0] : t.d.body) ? (r.type = 'text/javascript', r.setAttribute('async', 'async'), a = 3) : r = 0), r || ((r = new Image()).alt = '', r.abort || void 0 === n.InstallTrigger || (r.abort = function () { + r.src = i; + })), r.Va = Date.now(), r.Ja = function () { + try { + r.D && (clearTimeout(r.D), r.D = 0); + } catch (e) { + } + }, r.onload = r.R = function () { + if (r.Va && (t.ka = Date.now() - r.Va), t.gb(e), r.Ja(), t.Jb(), t.da(), t.l = 0, t.U(), r.Ha) { + r.Ha = !1; + try { + t.doPostbacks(t.W(r.responseText)); + } catch (e) { + } + } + }, r.onabort = r.onerror = r.ha = function () { + r.Ja(), (t.trackOffline || t.oa) && t.l && t.i.unshift(t.Ib), t.l = 0, t.ja > t.N && t.Wa(t.i), t.da(), t.ra(500); + }, r.onreadystatechange = function () { + 4 == r.readyState && (200 == r.status ? r.R() : r.ha()); + }, t.Ua = t.A(), 1 === a) + r.send(e); + else if (2 === a) + s = e.indexOf('?'), a = e.substring(0, s), s = (s = e.substring(s + 1)).replace(/&callback=[a-zA-Z0-9_.\[\]]+/, ''), r.open('POST', a, !0), r.withCredentials = !0, r.send(s); + else if (r.src = e, 3 === a) { + if (t.Sa) + try { + s.removeChild(t.Sa); + } catch (e) { + } + s.firstChild ? s.insertBefore(r, s.firstChild) : s.appendChild(r), t.Sa = t.v; + } + r.D = setTimeout(function () { + r.D && (r.complete ? r.R() : (t.trackOffline && r.abort && r.abort(), r.ha())); + }, 5000), t.Ib = e, t.v = n['s_i_' + t.replace(t.account, ',', '_')] = r, (t.useForcedLinkTracking && t.J || t.bodyClickFunction) && (t.forcedLinkTrackingTimeout || (t.forcedLinkTrackingTimeout = 250), t.ea = setTimeout(t.da, t.forcedLinkTrackingTimeout)); + }, t.nb = function (e) { + var n = !1; + return navigator.sendBeacon && (t.pb(e) || t.useBeacon) && (n = !0), t.yb(e) && (n = !1), n; + }, t.pb = function (e) { + return !!(e && 0 < e.indexOf('pe=lnk_e')); + }, t.yb = function (e) { + return 64000 <= e.length; + }, t.bb = function () { + return 'undefined' != typeof XMLHttpRequest && 'withCredentials' in new XMLHttpRequest(); + }, t.Jb = function () { + if (t.pa() && !(t.Ta > t.N)) + try { + n.localStorage.removeItem(t.na()), t.Ta = t.A(); + } catch (e) { + } + }, t.Wa = function (e) { + if (t.pa()) { + t.Ya(); + try { + n.localStorage.setItem(t.na(), n.JSON.stringify(e)), t.N = t.A(); + } catch (e) { + } + } + }, t.Ya = function () { + if (t.trackOffline) + for ((!t.offlineLimit || 0 >= t.offlineLimit) && (t.offlineLimit = 10); t.i.length > t.offlineLimit;) + t.Ma(); + }, t.forceOffline = function () { + t.oa = !0; + }, t.forceOnline = function () { + t.oa = !1; + }, t.na = function () { + return t.offlineFilename + '-' + t.visitorNamespace + t.account; + }, t.A = function () { + return new Date().getTime(); + }, t.Qa = function (e) { + return 0 != (e = e.toLowerCase()).indexOf('#') && 0 != e.indexOf('about:') && 0 != e.indexOf('opera:') && 0 != e.indexOf('javascript:'); + }, t.setTagContainer = function (e) { + var n, i, r; + for (t.ac = e, n = 0; n < t._il.length; n++) + if ((i = t._il[n]) && 's_l' == i._c && i.tagContainerName == e) { + if (t.S(i), i.lmq) + for (n = 0; n < i.lmq.length; n++) + r = i.lmq[n], t.loadModule(r.n); + if (i.ml) + for (r in i.ml) + if (t[r]) + for (n in (e = t[r], r = i.ml[r])) + !Object.prototype[n] && ('function' != typeof r[n] || 0 > ('' + r[n]).indexOf('s_c_il')) && (e[n] = r[n]); + if (i.mmq) + for (n = 0; n < i.mmq.length; n++) + r = i.mmq[n], t[r.m] && ((e = t[r.m])[r.f] && 'function' == typeof e[r.f] && (r.a ? e[r.f].apply(e, r.a) : e[r.f].apply(e))); + if (i.tq) + for (n = 0; n < i.tq.length; n++) + t.track(i.tq[n]); + i.s = t; + break; + } + }, t.Util = { + urlEncode: t.escape, + urlDecode: t.unescape, + cookieRead: t.cookieRead, + cookieWrite: t.cookieWrite, + getQueryParam: function (e, i, r, a) { + var s, o = ''; + return i || (i = t.pageURL ? t.pageURL : n.location), r = r || '&', e && i ? 0 > (s = (i = '' + i).indexOf('?')) ? o : (i = r + i.substring(s + 1) + r, a && (0 <= i.indexOf(r + e + r) || 0 <= i.indexOf(r + e + '=' + r)) ? void 0 : (0 <= (s = i.indexOf('#')) && (i = i.substr(0, s) + r), 0 > (s = i.indexOf(r + e + '=')) || (0 <= (s = (i = i.substring(s + r.length + e.length + 1)).indexOf(r)) && (i = i.substring(0, s)), 0 < i.length && (o = t.unescape(i))), o)) : o; + }, + getIeVersion: function () { + return document.documentMode ? document.documentMode : t.ya() ? 7 : null; + } + }, t.F = 'supplementalDataID timestamp dynamicVariablePrefix visitorID marketingCloudVisitorID analyticsVisitorID audienceManagerLocationHint authState fid vmk visitorMigrationKey visitorMigrationServer visitorMigrationServerSecure charSet visitorNamespace cookieDomainPeriods fpCookieDomainPeriods cookieLifetime pageName pageURL customerPerspective referrer contextData currencyCode lightProfileID lightStoreForSeconds lightIncrementBy retrieveLightProfiles deleteLightProfiles retrieveLightData'.split(' '), t.g = t.F.concat('purchaseID variableProvider channel server pageType transactionID campaign state zip events events2 products audienceManagerBlob tnt'.split(' ')), t.la = 'timestamp charSet visitorNamespace cookieDomainPeriods cookieLifetime contextData lightProfileID lightStoreForSeconds lightIncrementBy'.split(' '), t.O = t.la.slice(0), t.Ga = 'account allAccounts debugTracking visitor visitorOptedOut trackOffline offlineLimit offlineThrottleDelay offlineFilename usePlugins doPlugins configURL visitorSampling visitorSamplingGroup linkObject clickObject linkURL linkName linkType trackDownloadLinks trackExternalLinks trackClickMap trackInlineStats linkLeaveQueryString linkTrackVars linkTrackEvents linkDownloadFileTypes linkExternalFilters linkInternalFilters useForcedLinkTracking forcedLinkTrackingTimeout writeSecureCookies useLinkTrackSessionStorage trackingServer trackingServerSecure ssl abort mobile dc lightTrackVars maxDelay expectSupplementalData useBeacon usePostbacks registerPreTrackCallback registerPostTrackCallback bodyClickTarget bodyClickFunction AudienceManagement'.split(' '), r = 0; 250 >= r; r++) + 76 > r && (t.g.push('prop' + r), t.O.push('prop' + r)), t.g.push('eVar' + r), t.O.push('eVar' + r), 6 > r && t.g.push('hier' + r), 4 > r && t.g.push('list' + r); + r = 'pe pev1 pev2 pev3 latitude longitude resolution colorDepth javascriptVersion javaEnabled cookiesEnabled browserWidth browserHeight connectionType homepage pageURLRest marketingCloudOrgID ms_a'.split(' '), t.g = t.g.concat(r), t.F = t.F.concat(r), t.ssl = 0 <= n.location.protocol.toLowerCase().indexOf('https'), t.charSet = 'UTF-8', t.contextData = {}, t.writeSecureCookies = !1, t.offlineThrottleDelay = 0, t.offlineFilename = 'AppMeasurement.offline', t.P = 's_sq', t.Ua = 0, t.ja = 0, t.N = 0, t.Ta = 0, t.linkDownloadFileTypes = 'exe,zip,wav,mp3,mov,mpg,avi,wmv,pdf,doc,docx,xls,xlsx,ppt,pptx', t.w = n, t.d = n.document, t.da = function () { + t.ea && (n.clearTimeout(t.ea), t.ea = i), t.bodyClickTarget && t.J && t.bodyClickTarget.dispatchEvent(t.J), t.bodyClickFunction && ('function' == typeof t.bodyClickFunction ? t.bodyClickFunction() : t.bodyClickTarget && t.bodyClickTarget.href && (t.d.location = t.bodyClickTarget.href)), t.bodyClickTarget = t.J = t.bodyClickFunction = 0; + }, t.Xa = function () { + t.b = t.d.body, t.b ? (t.r = function (e) { + var i, r, a, s, o; + if (!(t.d && t.d.getElementById('cppXYctnr') || e && e['s_fe_' + t._in])) { + if (t.Ia) { + if (!t.useForcedLinkTracking) + return t.b.removeEventListener('click', t.r, !0), void (t.Ia = t.useForcedLinkTracking = 0); + t.b.removeEventListener('click', t.r, !1); + } else + t.useForcedLinkTracking = 0; + t.clickObject = e.srcElement ? e.srcElement : e.target; + try { + if (!t.clickObject || t.M && t.M == t.clickObject || !(t.clickObject.tagName || t.clickObject.parentElement || t.clickObject.parentNode)) + t.clickObject = 0; + else { + var c = t.M = t.clickObject; + if (t.ia && (clearTimeout(t.ia), t.ia = 0), t.ia = setTimeout(function () { + t.M == c && (t.M = 0); + }, 10000), a = t.Oa(), t.track(), a < t.Oa() && t.useForcedLinkTracking && e.target) { + for (s = e.target; s && s != t.b && 'A' != s.tagName.toUpperCase() && 'AREA' != s.tagName.toUpperCase();) + s = s.parentNode; + if (s && (o = s.href, t.Qa(o) || (o = 0), r = s.target, e.target.dispatchEvent && o && (!r || '_self' == r || '_top' == r || '_parent' == r || n.name && r == n.name))) { + try { + i = t.d.createEvent('MouseEvents'); + } catch (e) { + i = new n.MouseEvent(); + } + if (i) { + try { + i.initMouseEvent('click', e.bubbles, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget); + } catch (e) { + i = 0; + } + i && (i['s_fe_' + t._in] = i.s_fe = 1, e.stopPropagation(), e.stopImmediatePropagation && e.stopImmediatePropagation(), e.preventDefault(), t.bodyClickTarget = e.target, t.J = i); + } + } + } + } + } catch (e) { + t.clickObject = 0; + } + } + }, t.b && t.b.attachEvent ? t.b.attachEvent('onclick', t.r) : t.b && t.b.addEventListener && (navigator && (0 <= navigator.userAgent.indexOf('WebKit') && t.d.createEvent || 0 <= navigator.userAgent.indexOf('Firefox/2') && n.MouseEvent) && (t.Ia = 1, t.useForcedLinkTracking = 1, t.b.addEventListener('click', t.r, !0)), t.b.addEventListener('click', t.r, !1))) : setTimeout(t.Xa, 30); + }, t.fc = t.ya(), t.Kb(), t.mc || (e ? t.setAccount(e) : t.C('Error, missing Report Suite ID in AppMeasurement initialization'), t.Xa(), t.loadModule('ActivityMap')); + } + function $___var_e79f32c98394e82a(e) { + var t, n, i, r, a, s = window.s_c_il, o = e.split(','), c = 0; + if (s) + for (n = 0; !c && n < s.length;) { + if ('s_c' == (t = s[n])._c && (t.account || t.oun)) + if (t.account && t.account == e) + c = 1; + else + for (i = t.account ? t.account : t.oun, i = t.allAccounts ? t.allAccounts : i.split(','), r = 0; r < o.length; r++) + for (a = 0; a < i.length; a++) + o[r] == i[a] && (c = 1); + n++; + } + return c ? t.setAccount && t.setAccount(e) : t = new AppMeasurement(e), t; + } + function $___var_08c45f172bde38fd() { + var e, t, n, i = window, r = i.s_giq; + if (r) + for (e = 0; e < r.length; e++) + (n = s_gi((t = r[e]).oun)).setAccount(t.un), n.setTagContainer(t.tagContainerName); + i.s_giq = 0; + } + function $___var_9206292cbfff7929() { + if ('undefined' == typeof pgLvl) { + fdx_getLinkView(), (void 0 === s.pageName || '' == s.pageName) && (_satellite.getVar('content:page name'), 1) && _satellite.getVar('content:page name') && (s.pageName = _satellite.getVar('content:page name')), s.pageName = s.pageName.toLowerCase(), void 0 !== s.eVar43 && '' != s.eVar43 || (s.eVar43 = 'P:' + s.pageName), s.prop43 = 'D=v43'; + var e = document.getElementsByClassName('brightcove-container'); + s.eVar31 = e.length; + for (var t = '', n = 0; n < e.length; n++) + s.eVar31 += '|' + e[n].getAttribute('data-video-id'), t = 'event202'; + s.linkTrackEvents = s.events = s.apl(s.events, t, ',', 2); + var i = fdx_getCookie('xacc').toLowerCase(), r = fdx_getCookie('fdx_locale').toLowerCase().split('_'), a = fdx_getCookie('fdx_geo_select'); + fdx_getCookie('fdx_geo_hide') !== r[1] && i !== r[1] && a !== r[1] && (s.linkTrackEvents = s.events = 'event904'); + try { + var o = fdx_getCookie('fdx_debug'); + if (void 0 !== o) { + for (n = 0; n < o.split(',').length; n++) { + var c = 'DBG_' + o.split(',')[n]; + c = (c = c.split('|').slice(1).join('|')).substring(0, Math.min(255, c.length)); + } + s.events = s.apl(s.events, 'event100', ',', 2), fdx_setCookie('fdx_debug', '', -1, '/', '.fedex.com'); + } + } catch (e) { + fdx_debug(e, 'SC', 'fdx_runSCode:log debug errors'); + } + s.eVar60 = s.Util.getQueryParam('et_rid'), s.eVar60 = s.getValOnce(s.eVar60, 's_etrid', 0); + var l = s.c_r('s_etrid'); + window.sc_s_etrid = '', null != l && '' !== l ? (s.getAndPersistValue(l, 'sc_s_etrid', 90), window.sc_s_etrid = l) : window.sc_s_etrid = s.c_r('sc_s_etrid'), s.eVar80 = s.Util.getQueryParam('et_cid'), s.eVar80 = s.getValOnce(s.eVar80, 's_etcid', 0); + var u = s.c_r('s_acxrid'); + window.sc_s_acxrid = '', null != u && '' !== u ? (s.getAndPersistValue(u, 'sc_s_acxrid', 90), window.sc_s_acxrid = u) : window.sc_s_acxrid = s.c_r('sc_s_acxrid'); + var d = fdx_getCookie('fcl_uuid'); + window.sc_fcl_uuid = ''; + var p = new Object(); + if (void 0 === d || null == d) { + if (window.sc_fcl_uuid = s.c_r('sc_fcl_uuid'), '' !== window.sc_fcl_uuid) + window.sc_fcl_uuid.indexOf('@') < 0 && (s.eVar6 = window.sc_fcl_uuid, s.prop6 = 'D=v6', p.fedexcustid = { + id: s.eVar6, + authState: Visitor.AuthState.LOGGED_OUT + }, p.F3eDx = { + id: s.eVar6, + authState: Visitor.AuthState.LOGGED_OUT + }); + window.sc_s_etrid && (p.et_rid = { + id: window.sc_s_etrid, + authState: Visitor.AuthState.LOGGED_OUT + }); + } else + d.indexOf('@') < 0 && (s.eVar6 = d, s.prop6 = 'D=v6', s.getAndPersistValue(d, 'sc_fcl_uuid', 90), window.sc_fcl_uuid = d, p.fedexcustid = { + id: s.eVar6, + authState: Visitor.AuthState.AUTHENTICATED + }, p.F3eDx = { + id: s.eVar6, + authState: Visitor.AuthState.AUTHENTICATED + }), window.sc_s_etrid && (p.et_rid = { + id: window.sc_s_etrid, + authState: Visitor.AuthState.AUTHENTICATED + }); + try { + void 0 !== s.visitor ? (s.visitor.setCustomerIDs(p), s.visitor._setFieldExpire('MCAAMB', -1), s.visitor.getAudienceManagerBlob()) : (s.visitor = Visitor.getInstance(_satellite.getVar('mcorgID')), s.visitor.setCustomerIDs(p), s.visitor._setFieldExpire('MCAAMB', -1), s.visitor.getAudienceManagerBlob()); + } catch (e) { + fdx_debug(e, 'SC', 'fdx_runSCode:ID sync for AAM '); + } + } + } + function $___var_8ac5c7b314b8c052() { + try { + fdx_initSCVars(), fdx_initPlugins(), fdx_runSCode(); + } catch (e) { + fdx_debug(e, 'SC', 'fdx_initSCode'); + } + } + var $___var_29583c08192e471d = fdx_createCustomEvent || function (e) { + try { + var t; + return document.createEvent ? (t = document.createEvent('Event')).initEvent(e, !1, !1) : t = e, t; + } catch (e) { + fdx_debug(e, 'CIM', 'fdx_createCustomEvent'); + } + }, $___var_7af65fc8c5b6d94a = fdx_dispatchCustomEvent || function (e) { + try { + document.createEvent ? document.dispatchEvent(e) : void 0 !== document.documentElement[e] ? document.documentElement[e]++ : document.documentElement[e] = 0; + } catch (e) { + fdx_debug(e, 'CIM', 'fdx_dispatchCustomEvent'); + } + }, $___var_0b6085048b5494f8 = fdx_fireCustomEvent || function (e) { + try { + var t = fdx_createCustomEvent(e); + fdx_dispatchCustomEvent(t); + } catch (e) { + fdx_debug(e, 'CIM', 'fdx_fireCustomEvent'); + } + }, $___var_66659f3399daed0b = { + 'mags-address': [ + 'eVar151', + 'event211' + ], + 'mags-package': [ + 'eVar152', + 'event212' + ], + 'mags-custom': [ + 'eVar155', + 'event214' + ], + 'mags-ratesdisplay': [ + 'eVar153', + 'event216' + ], + 'mags-payment': [ + 'eVar154', + 'event218' + ] + }; + fdx_createCustomEvent = $___var_29583c08192e471d; + fdx_dispatchCustomEvent = $___var_7af65fc8c5b6d94a; + fdx_fireCustomEvent = $___var_0b6085048b5494f8; + MAGSEvarMapping = $___var_66659f3399daed0b; + !function () { + 'use strict'; + var e, t, n; + 'function' != typeof window.DIL && (window.DIL = function (e) { + const $___old_c5cc0bf256fdc8a1 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_465ce794c2ab10af = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_c5cc0bf256fdc8a1) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_3d049bcfecf95e89.XMLHttpRequest)); + if ($___old_465ce794c2ab10af) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_3d049bcfecf95e89.XMLHttpRequest)); + return function () { + function t(e) { + return void 0 === e || !0 === e; + } + function n() { + z || (z = !0, A.registerRequest(), W()); + } + var i, r, a, s, o, c, l, u, d, p, f, g, v, h, m, b, _, k, y, w, x, D = [], C = {}; + e !== Object(e) && (e = {}), a = e.partner, s = e.containerNSID, o = e.mappings, c = e.uuidCookie, l = !0 === e.enableErrorReporting, u = e.visitorService, d = e.declaredId, p = !0 === e.delayAllUntilWindowLoad, f = t(e.secureDataCollection), g = 'boolean' == typeof e.isCoopSafe ? e.isCoopSafe : null, v = t(e.enableHrefererParam), h = t(e.enableLogging), m = t(e.enableUrlDestinations), b = t(e.enableCookieDestinations), _ = !0 === e.disableDefaultRequest, k = e.afterResultForDefaultRequest, y = e.visitorConstructor, w = !0 === e.disableCORS, x = !0 === e.ignoreHardDependencyOnVisitorAPI, l && DIL.errorModule.activate(), x && D.push('Warning: this instance is configured to ignore the hard dependency on the VisitorAPI service. This means that no URL destinations will be fired if the instance has no connection to VisitorAPI. If the VisitorAPI service is not instantiated, ID syncs will not be fired either.'); + var I = !0 === window._dil_unit_tests; + if ((i = arguments[1]) && D.push(i + ''), !a || 'string' != typeof a) { + var O = { + name: 'error', + message: i = 'DIL partner is invalid or not specified in initConfig', + filename: 'dil.js' + }; + return DIL.errorModule.handleError(O), new Error(i); + } + if (i = 'DIL containerNSID is invalid or not specified in initConfig, setting to default of 0', !s && 'number' != typeof s || (s = parseInt(s, 10), !isNaN(s) && 0 <= s && (i = '')), i && (s = 0, D.push(i), i = ''), (r = DIL.getDil(a, s)) instanceof DIL && r.api.getPartner() === a && r.api.getContainerNSID() === s) + return r; + if (!(this instanceof DIL)) + return new DIL(e, 'DIL was not instantiated with the \'new\' operator, returning a valid instance with partner = ' + a + ' and containerNSID = ' + s); + DIL.registerDil(this, a, s); + var T = { + doesConsoleLogExist: window.console === Object(window.console) && 'function' == typeof window.console.log, + logMemo: {}, + log: function (e) { + D.push(e), h && this.doesConsoleLogExist && Function.prototype.bind.call(window.console.log, window.console).apply(window.console, arguments); + }, + logOnce: function (e) { + this.logMemo[e] || (this.logMemo[e] = !0, T.log(e)); + } + }, S = { + IS_HTTPS: f || 'https:' === document.location.protocol, + SIX_MONTHS_IN_MINUTES: 259200, + IE_VERSION: function () { + if (document.documentMode) + return document.documentMode; + for (var e = 7; 4 < e; e--) { + var t = document.createElement('div'); + if (t.innerHTML = '', t.getElementsByTagName('span').length) + return t = null, e; + } + return null; + }() + }; + S.IS_IE_LESS_THAN_10 = 'number' == typeof S.IE_VERSION && S.IE_VERSION < 10; + var V = { stuffed: {} }, L = {}, A = { + firingQueue: [], + fired: [], + firing: !1, + sent: [], + errored: [], + reservedKeys: { + sids: !0, + pdata: !0, + logdata: !0, + callback: !0, + postCallbackFn: !0, + useImageRequest: !0 + }, + firstRequestHasFired: !1, + abortRequests: !1, + num_of_cors_responses: 0, + num_of_cors_errors: 0, + corsErrorSources: [], + num_of_img_responses: 0, + num_of_img_errors: 0, + platformParams: { + d_nsid: s + '', + d_rtbd: 'json', + d_jsonv: DIL.jsonVersion + '', + d_dst: '1' + }, + nonModStatsParams: { + d_rtbd: !0, + d_dst: !0, + d_cts: !0, + d_rs: !0 + }, + modStatsParams: null, + adms: { + TIME_TO_CATCH_ALL_REQUESTS_RELEASE: 30000, + calledBack: !1, + mid: null, + noVisitorAPI: null, + VisitorAPI: null, + instance: null, + releaseType: 'no VisitorAPI', + isOptedOut: !0, + isOptedOutCallbackCalled: !1, + admsProcessingStarted: !1, + process: function (e) { + try { + if (this.admsProcessingStarted) + return; + this.admsProcessingStarted = !0; + var t, n, i, r = u; + if ('function' != typeof e || 'function' != typeof e.getInstance) + throw this.noVisitorAPI = !0, new Error('Visitor does not exist.'); + if (r !== Object(r) || !(t = r.namespace) || 'string' != typeof t) + throw this.releaseType = 'no namespace', new Error('DIL.create() needs the initConfig property `visitorService`:{namespace:\'\'}'); + if ((n = e.getInstance(t, { idSyncContainerID: s })) !== Object(n) || 'function' != typeof n.isAllowed || 'function' != typeof n.getMarketingCloudVisitorID || 'function' != typeof n.getCustomerIDs || 'function' != typeof n.isOptedOut || 'function' != typeof n.publishDestinations) + throw this.releaseType = 'invalid instance', i = 'Invalid Visitor instance.', n === Object(n) && 'function' != typeof n.publishDestinations && (i += ' In particular, visitorInstance.publishDestinations is not a function. This is needed to fire URL destinations in DIL v8.0+ and should be present in Visitor v3.3.0+ .'), new Error(i); + if (this.VisitorAPI = e, !n.isAllowed()) + return this.releaseType = 'VisitorAPI is not allowed to write cookies', void this.releaseRequests(); + this.instance = n, this.waitForMidToReleaseRequests(); + } catch (e) { + if (!x) + throw new Error('Error in processing Visitor API, which is a hard dependency for DIL v8.0+: ' + e.message); + this.releaseRequests(); + } + }, + waitForMidToReleaseRequests: function () { + var e = this; + this.instance && (this.instance.getMarketingCloudVisitorID(function (t) { + e.mid = t, e.releaseType = 'VisitorAPI', e.releaseRequests(); + }, !0), (!F.exists || !F.isIabContext && F.isApproved() || F.isIabContext && Q.hasGoSignal()) && setTimeout(function () { + 'VisitorAPI' !== e.releaseType && (e.releaseType = 'timeout', e.releaseRequests()); + }, this.getLoadTimeout())); + }, + releaseRequests: function () { + this.calledBack = !0, A.registerRequest(); + }, + getMarketingCloudVisitorID: function () { + return this.instance ? this.instance.getMarketingCloudVisitorID() : null; + }, + getMIDQueryString: function () { + var e = q.isPopulatedString, t = this.getMarketingCloudVisitorID(); + return e(this.mid) && this.mid === t || (this.mid = t), e(this.mid) ? 'd_mid=' + this.mid + '&' : ''; + }, + getCustomerIDs: function () { + return this.instance ? this.instance.getCustomerIDs() : null; + }, + getCustomerIDsQueryString: function (e) { + if (e !== Object(e)) + return ''; + var t, n, i, r, a = '', s = [], o = []; + for (t in e) + e.hasOwnProperty(t) && (n = e[o[0] = t]) === Object(n) && (o[1] = n.id || '', o[2] = n.authState || 0, s.push(o), o = []); + if (r = s.length) + for (i = 0; i < r; i++) + a += '&d_cid_ic=' + N.encodeAndBuildRequest(s[i], '%01'); + return a; + }, + getIsOptedOut: function () { + this.instance ? this.instance.isOptedOut([ + this, + this.isOptedOutCallback + ], this.VisitorAPI.OptOut.GLOBAL, !0) : (this.isOptedOut = !1, this.isOptedOutCallbackCalled = !0); + }, + isOptedOutCallback: function (e) { + this.isOptedOut = e, this.isOptedOutCallbackCalled = !0, A.registerRequest(), F.isIabContext() && Q.checkQueryStringObject(); + }, + getLoadTimeout: function () { + var e = this.instance; + if (e) { + if ('function' == typeof e.getLoadTimeout) + return e.getLoadTimeout(); + if (void 0 !== e.loadTimeout) + return e.loadTimeout; + } + return this.TIME_TO_CATCH_ALL_REQUESTS_RELEASE; + } + }, + declaredId: { + declaredId: { + init: null, + request: null + }, + declaredIdCombos: {}, + setDeclaredId: function (e, t) { + var n = q.isPopulatedString, i = encodeURIComponent; + if (e === Object(e) && n(t)) { + var r = e.dpid, a = e.dpuuid, s = null; + if (n(r) && n(a)) + return s = i(r) + '$' + i(a), !0 === this.declaredIdCombos[s] ? 'setDeclaredId: combo exists for type \'' + t + '\'' : (this.declaredIdCombos[s] = !0, this.declaredId[t] = { + dpid: r, + dpuuid: a + }, 'setDeclaredId: succeeded for type \'' + t + '\''); + } + return 'setDeclaredId: failed for type \'' + t + '\''; + }, + getDeclaredIdQueryString: function () { + var e = this.declaredId.request, t = this.declaredId.init, n = encodeURIComponent, i = ''; + return null !== e ? i = '&d_dpid=' + n(e.dpid) + '&d_dpuuid=' + n(e.dpuuid) : null !== t && (i = '&d_dpid=' + n(t.dpid) + '&d_dpuuid=' + n(t.dpuuid)), i; + } + }, + registerRequest: function (e) { + var t, n = this.firingQueue; + e === Object(e) && (n.push(e), e.isDefaultRequest || (_ = !0)), this.firing || !n.length || p && !DIL.windowLoaded || (this.adms.isOptedOutCallbackCalled || this.adms.getIsOptedOut(), this.adms.calledBack && !this.adms.isOptedOut && this.adms.isOptedOutCallbackCalled && (F.isApproved() || Q.hasGoSignal()) && (this.adms.isOptedOutCallbackCalled = !1, (t = n.shift()).src = t.src.replace(/&d_nsid=/, '&' + this.adms.getMIDQueryString() + Q.getQueryString() + 'd_nsid='), q.isPopulatedString(t.corsPostData) && (t.corsPostData = t.corsPostData.replace(/^d_nsid=/, this.adms.getMIDQueryString() + Q.getQueryString() + 'd_nsid=')), j.fireRequest(t), this.firstRequestHasFired || 'script' !== t.tag && 'cors' !== t.tag || (this.firstRequestHasFired = !0))); + }, + processVisitorAPI: function () { + this.adms.process(y || window.Visitor); + }, + getCoopQueryString: function () { + var e = ''; + return !0 === g ? e = '&d_coop_safe=1' : !1 === g && (e = '&d_coop_unsafe=1'), e; + } + }; + C.requestController = A; + var P, E, M = { + sendingMessages: !1, + messages: [], + messagesPosted: [], + destinations: [], + destinationsPosted: [], + jsonForComparison: [], + jsonDuplicates: [], + jsonWaiting: [], + jsonProcessed: [], + publishDestinationsVersion: null, + requestToProcess: function (e, t) { + function n() { + r.jsonForComparison.push(e), r.jsonWaiting.push([ + e, + t + ]); + } + var i, r = this; + if (e && !q.isEmptyObject(e)) + if (i = JSON.stringify(e.dests || []), this.jsonForComparison.length) { + var a, s, o, c = !1; + for (a = 0, s = this.jsonForComparison.length; a < s; a++) + if (o = this.jsonForComparison[a], i === JSON.stringify(o.dests || [])) { + c = !0; + break; + } + c ? this.jsonDuplicates.push(e) : n(); + } else + n(); + if (this.jsonWaiting.length) { + var l = this.jsonWaiting.shift(); + this.process(l[0], l[1]), this.requestToProcess(); + } + this.messages.length && !this.sendingMessages && this.sendMessages(); + }, + process: function (e) { + if (m) { + var t, n, i, r, a, s, o = encodeURIComponent, c = this.getPublishDestinationsVersion(), l = !1; + if (-1 !== c) { + if ((t = e.dests) && t instanceof Array && (n = t.length)) { + for (i = 0; i < n; i++) + r = t[i], s = [ + o('dests'), + o(r.id || ''), + o(r.y || ''), + o(r.c || '') + ].join('|'), this.addMessage(s), a = { + url: r.c, + hideReferrer: void 0 === r.hr || !!r.hr, + message: s + }, this.addDestination(a), void 0 !== r.hr && (l = !0); + 1 === c && l && T.logOnce('Warning: visitorInstance.publishDestinations version is old (Visitor v3.3.0 to v4.0.0). URL destinations will not have the option of being fired on page, only in the iframe.'); + } + this.jsonProcessed.push(e); + } + } + }, + addMessage: function (e) { + this.messages.push(e); + }, + addDestination: function (e) { + this.destinations.push(e); + }, + sendMessages: function () { + this.sendingMessages || (this.sendingMessages = !0, m && this.messages.length && this.publishDestinations()); + }, + publishDestinations: function () { + function e(e) { + T.log('visitor.publishDestinations() result: ' + (e.error || e.message)), n.sendingMessages = !1, n.requestToProcess(); + } + function t() { + n.messages = [], n.destinations = []; + } + var n = this, i = A.adms.instance, r = [], s = []; + return 1 === this.publishDestinationsVersion ? (N.extendArray(r, this.messages), N.extendArray(this.messagesPosted, this.messages), t(), i.publishDestinations(a, r, e), 'Called visitor.publishDestinations() version 1') : 1 < this.publishDestinationsVersion ? (N.extendArray(s, this.destinations), N.extendArray(this.destinationsPosted, this.destinations), t(), i.publishDestinations({ + subdomain: a, + callback: e, + urlDestinations: s + }), 'Called visitor.publishDestinations() version > 1') : void 0; + }, + getPublishDestinationsVersion: function () { + if (null !== this.publishDestinationsVersion) + return this.publishDestinationsVersion; + var e = A.adms.instance, t = -1; + return e.publishDestinations(null, null, function (e) { + if (e === Object(e)) { + var n = e.error; + 'subdomain is not a populated string.' === n ? t = 1 : 'Invalid parameters passed.' === n && (t = 2); + } + }), this.publishDestinationsVersion = t; + } + }, R = { + traits: function (e) { + return q.isValidPdata(e) && (L.sids instanceof Array || (L.sids = []), N.extendArray(L.sids, e)), this; + }, + pixels: function (e) { + return q.isValidPdata(e) && (L.pdata instanceof Array || (L.pdata = []), N.extendArray(L.pdata, e)), this; + }, + logs: function (e) { + return q.isValidLogdata(e) && (L.logdata !== Object(L.logdata) && (L.logdata = {}), N.extendObject(L.logdata, e)), this; + }, + customQueryParams: function (e) { + return q.isEmptyObject(e) || N.extendObject(L, e, A.reservedKeys), this; + }, + signals: function (e, t) { + var n, i = e; + if (!q.isEmptyObject(i)) { + if (t && 'string' == typeof t) + for (n in (i = {}, e)) + e.hasOwnProperty(n) && (i[t + n] = e[n]); + N.extendObject(L, i, A.reservedKeys); + } + return this; + }, + declaredId: function (e) { + return A.declaredId.setDeclaredId(e, 'request'), this; + }, + result: function (e) { + return 'function' == typeof e && (L.callback = e), this; + }, + afterResult: function (e) { + return 'function' == typeof e && (L.postCallbackFn = e), this; + }, + useImageRequest: function () { + return L.useImageRequest = !0, this; + }, + clearData: function () { + return L = {}, this; + }, + submit: function (e) { + return L.isDefaultRequest = !!e, j.submitRequest(L), L = {}, this; + }, + getPartner: function () { + return a; + }, + getContainerNSID: function () { + return s; + }, + getEventLog: function () { + return D; + }, + getState: function () { + var t = {}, n = {}; + return N.extendObject(t, A, { registerRequest: !0 }), N.extendObject(n, M, { + requestToProcess: !0, + process: !0, + sendMessages: !0 + }), { + initConfig: e, + pendingRequest: L, + otherRequestInfo: t, + destinationPublishingInfo: n, + log: D + }; + }, + idSync: function () { + throw new Error('Please use the `idSyncByURL` method of the Experience Cloud ID Service (Visitor) instance'); + }, + aamIdSync: function () { + throw new Error('Please use the `idSyncByDataSource` method of the Experience Cloud ID Service (Visitor) instance'); + }, + passData: function (e) { + return q.isEmptyObject(e) ? 'Error: json is empty or not an object' : (j.defaultCallback(e), e); + }, + getPlatformParams: function () { + return A.platformParams; + }, + getEventCallConfigParams: function () { + var e, t = A, n = t.modStatsParams, i = t.platformParams; + if (!n) { + for (e in (n = {}, i)) + i.hasOwnProperty(e) && !t.nonModStatsParams[e] && (n[e.replace(/^d_/, '')] = i[e]); + !0 === g ? n.coop_safe = 1 : !1 === g && (n.coop_unsafe = 1), t.modStatsParams = n; + } + return n; + }, + setAsCoopSafe: function () { + return g = !0, this; + }, + setAsCoopUnsafe: function () { + return g = !1, this; + }, + getEventCallIabSignals: function (e) { + var t; + return e !== Object(e) ? 'Error: config is not an object' : 'function' != typeof e.callback ? 'Error: config.callback is not a function' : (t = parseInt(e.timeout, 10), isNaN(t) && (t = null), void Q.getQueryStringObject(e.callback, t)); + } + }, j = { + corsMetadata: (P = 'none', 'undefined' != typeof XMLHttpRequest && XMLHttpRequest === Object(XMLHttpRequest) && 'withCredentials' in new XMLHttpRequest() && (P = 'XMLHttpRequest'), { corsType: P }), + getCORSInstance: function () { + return 'none' === this.corsMetadata.corsType ? null : new window[this.corsMetadata.corsType](); + }, + submitRequest: function (e) { + return A.registerRequest(j.createQueuedRequest(e)), !0; + }, + createQueuedRequest: function (e) { + var t, n, i, r, a, s = e.callback, c = 'img', l = e.isDefaultRequest; + if (delete e.isDefaultRequest, !q.isEmptyObject(o)) + for (i in o) + if (o.hasOwnProperty(i)) { + if (null == (r = o[i]) || '' === r) + continue; + if (i in e && !(r in e) && !(r in A.reservedKeys)) { + if (null == (a = e[i]) || '' === a) + continue; + e[r] = a; + } + } + return q.isValidPdata(e.sids) || (e.sids = []), q.isValidPdata(e.pdata) || (e.pdata = []), q.isValidLogdata(e.logdata) || (e.logdata = {}), e.logdataArray = N.convertObjectToKeyValuePairs(e.logdata, '=', !0), e.logdataArray.push('_ts=' + new Date().getTime()), 'function' != typeof s && (s = this.defaultCallback), t = this.makeRequestSrcData(e), (n = this.getCORSInstance()) && !0 !== e.useImageRequest && (c = 'cors'), { + tag: c, + src: t.src, + corsSrc: t.corsSrc, + callbackFn: s, + postCallbackFn: e.postCallbackFn, + useImageRequest: !!e.useImageRequest, + requestData: e, + corsInstance: n, + corsPostData: t.corsPostData, + isDefaultRequest: l + }; + }, + defaultCallback: function (e, t) { + var n, i, r, a, s, o, l, u, d; + if (b && (n = e.stuff) && n instanceof Array && (i = n.length)) + for (r = 0; r < i; r++) + (a = n[r]) && a === Object(a) && (s = a.cn, o = a.cv, void 0 !== (l = a.ttl) && '' !== l || (l = Math.floor(N.getMaxCookieExpiresInMinutes() / 60 / 24)), u = a.dmn || '.' + document.domain.replace(/^www\./, ''), d = a.type, s && (o || 'number' == typeof o) && ('var' !== d && (l = parseInt(l, 10)) && !isNaN(l) && N.setCookie(s, o, 24 * l * 60, '/', u, !1), V.stuffed[s] = o)); + var p, f, g = e.uuid; + q.isPopulatedString(g) && (q.isEmptyObject(c) || ('string' == typeof (p = c.path) && p.length || (p = '/'), f = parseInt(c.days, 10), isNaN(f) && (f = 100), N.setCookie(c.name || 'aam_did', g, 24 * f * 60, p, c.domain || '.' + document.domain.replace(/^www\./, ''), !0 === c.secure))), A.abortRequests || M.requestToProcess(e, t); + }, + makeRequestSrcData: function (e) { + e.sids = q.removeEmptyArrayValues(e.sids || []), e.pdata = q.removeEmptyArrayValues(e.pdata || []); + var t = A, n = t.platformParams, i = N.encodeAndBuildRequest(e.sids, ','), r = N.encodeAndBuildRequest(e.pdata, ','), s = (e.logdataArray || []).join('&'); + delete e.logdataArray; + var o, c, l = encodeURIComponent, u = S.IS_HTTPS ? 'https://' : 'http://', d = t.declaredId.getDeclaredIdQueryString(), p = t.adms.instance ? t.adms.getCustomerIDsQueryString(t.adms.getCustomerIDs()) : '', f = function () { + var n, i, r, a, s = []; + for (n in e) + if (!(n in t.reservedKeys) && e.hasOwnProperty(n)) + if (i = e[n], n = l(n), i instanceof Array) + for (r = 0, a = i.length; r < a; r++) + s.push(n + '=' + l(i[r])); + else + s.push(n + '=' + l(i)); + return s.length ? '&' + s.join('&') : ''; + }(), g = 'd_dil_ver=' + l(DIL.version), h = 'd_nsid=' + n.d_nsid + t.getCoopQueryString() + d + p + (i.length ? '&d_sid=' + i : '') + (r.length ? '&d_px=' + r : '') + (s.length ? '&d_ld=' + l(s) : ''), m = '&d_rtbd=' + n.d_rtbd + '&d_jsonv=' + n.d_jsonv + '&d_dst=' + n.d_dst, b = v ? '&h_referer=' + l(location.href) : ''; + return c = (o = u + a + '.demdex.net/event') + '?' + g + '&' + h + m + f + b, { + corsSrc: o + '?' + g + '&_ts=' + new Date().getTime(), + src: c, + corsPostData: h + m + f + b, + isDeclaredIdCall: '' !== d + }; + }, + fireRequest: function (e) { + if ('img' === e.tag) + this.fireImage(e); + else { + var t = A.declaredId, n = t.declaredId.request || t.declaredId.init || {}, i = { + dpid: n.dpid || '', + dpuuid: n.dpuuid || '' + }; + this.fireCORS(e, i); + } + }, + fireImage: function (e) { + var t, n, r = A; + r.abortRequests || (r.firing = !0, t = new Image(0, 0), r.sent.push(e), t.onload = function () { + r.firing = !1, r.fired.push(e), r.num_of_img_responses++, r.registerRequest(); + }, n = function (t) { + i = 'imgAbortOrErrorHandler received the event of type ' + t.type, T.log(i), r.abortRequests = !0, r.firing = !1, r.errored.push(e), r.num_of_img_errors++, r.registerRequest(); + }, t.addEventListener('error', n), t.addEventListener('abort', n), t.src = e.src); + }, + fireCORS: function (e, t) { + var n = this, r = A, s = this.corsMetadata.corsType, o = e.corsSrc, c = e.corsInstance, l = e.corsPostData, u = e.postCallbackFn, d = 'function' == typeof u; + if (!r.abortRequests && !w) { + r.firing = !0; + try { + c.open('post', o, !0), 'XMLHttpRequest' === s && (c.withCredentials = !0, c.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'), c.onreadystatechange = function () { + 4 === this.readyState && 200 === this.status && function (s) { + var o; + try { + if ((o = JSON.parse(s)) !== Object(o)) + return n.handleCORSError(e, t, 'Response is not JSON'); + } catch (s) { + return n.handleCORSError(e, t, 'Error parsing response as JSON'); + } + try { + var c = e.callbackFn; + r.firing = !1, r.fired.push(e), r.num_of_cors_responses++, c(o, t), d && u(o, t); + } catch (s) { + s.message = 'DIL handleCORSResponse caught error with message ' + s.message, i = s.message, T.log(i), s.filename = s.filename || 'dil.js', s.partner = a, DIL.errorModule.handleError(s); + try { + c({ error: s.name + '|' + s.message }, t), d && u({ error: s.name + '|' + s.message }, t); + } catch (s) { + } + } finally { + r.registerRequest(); + } + }(this.responseText); + }), c.onerror = function () { + n.handleCORSError(e, t, 'onerror'); + }, c.ontimeout = function () { + n.handleCORSError(e, t, 'ontimeout'); + }, c.send(l); + } catch (s) { + this.handleCORSError(e, t, 'try-catch'); + } + r.sent.push(e), r.declaredId.declaredId.request = null; + } + }, + handleCORSError: function (e, t, n) { + A.num_of_cors_errors++, A.corsErrorSources.push(n); + } + }, q = { + isValidPdata: function (e) { + return !!(e instanceof Array && this.removeEmptyArrayValues(e).length); + }, + isValidLogdata: function (e) { + return !this.isEmptyObject(e); + }, + isEmptyObject: function (e) { + if (e !== Object(e)) + return !0; + var t; + for (t in e) + if (e.hasOwnProperty(t)) + return !1; + return !0; + }, + removeEmptyArrayValues: function (e) { + var t, n = 0, i = e.length, r = []; + for (n = 0; n < i; n++) + null != (t = e[n]) && '' !== t && r.push(t); + return r; + }, + isPopulatedString: function (e) { + return 'string' == typeof e && e.length; + } + }, N = { + convertObjectToKeyValuePairs: function (e, t, n) { + var i, r, a = []; + for (i in (t = t || '=', e)) + e.hasOwnProperty(i) && null != (r = e[i]) && '' !== r && a.push(i + t + (n ? encodeURIComponent(r) : r)); + return a; + }, + encodeAndBuildRequest: function (e, t) { + return e.map(function (e) { + return encodeURIComponent(e); + }).join(t); + }, + getCookie: function (e) { + var t, n, i, r = e + '=', a = document.cookie.split(';'); + for (t = 0, n = a.length; t < n; t++) { + for (i = a[t]; ' ' === i.charAt(0);) + i = i.substring(1, i.length); + if (0 === i.indexOf(r)) + return decodeURIComponent(i.substring(r.length, i.length)); + } + return null; + }, + setCookie: function (e, t, n, i, r, a) { + var s = new Date(); + n = n && 1000 * n * 60, document.cookie = e + '=' + encodeURIComponent(t) + (n ? ';expires=' + new Date(s.getTime() + n).toUTCString() : '') + (i ? ';path=' + i : '') + (r ? ';domain=' + r : '') + (a ? ';secure' : ''); + }, + extendArray: function (e, t) { + return e instanceof Array && t instanceof Array && (Array.prototype.push.apply(e, t), !0); + }, + extendObject: function (e, t, n) { + var i; + if (e !== Object(e) || t !== Object(t)) + return !1; + for (i in t) + if (t.hasOwnProperty(i)) { + if (!q.isEmptyObject(n) && i in n) + continue; + e[i] = t[i]; + } + return !0; + }, + getMaxCookieExpiresInMinutes: function () { + return S.SIX_MONTHS_IN_MINUTES; + }, + replaceMethodsWithFunction: function (e, t) { + var n; + if (e === Object(e) && 'function' == typeof t) + for (n in e) + e.hasOwnProperty(n) && 'function' == typeof e[n] && (e[n] = t); + } + }, F = (E = C.requestController, { + exists: null, + instance: null, + aamIsApproved: null, + init: function () { + var e = this; + this.checkIfExists() ? (this.exists = !0, this.instance = window.adobe.optIn, this.instance.fetchPermissions(function () { + e.callback(); + }, !0)) : this.exists = !1; + }, + checkIfExists: function () { + return window.adobe === Object(window.adobe) && window.adobe.optIn === Object(window.adobe.optIn); + }, + callback: function () { + this.aamIsApproved = this.instance.isApproved([this.instance.Categories.AAM]), E.adms.waitForMidToReleaseRequests(), E.adms.getIsOptedOut(); + }, + isApproved: function () { + return !this.isIabContext() && !E.adms.isOptedOut && (!this.exists || this.aamIsApproved); + }, + isIabContext: function () { + return this.instance && this.instance.isIabContext; + } + }); + C.optIn = F; + var U, B, H, G, Q = (B = (U = C).requestController, H = U.optIn, G = { + isVendorConsented: null, + doesGdprApply: null, + consentString: null, + queryStringObjectCallbacks: [], + init: function () { + this.fetchConsentData(); + }, + hasGoSignal: function () { + return !(!(H.isIabContext() && this.isVendorConsented && this.doesGdprApply && 'string' == typeof this.consentString && this.consentString.length) || B.adms.isOptedOut); + }, + fetchConsentData: function (e, t) { + var n = this, i = {}; + 'function' != typeof e && (e = function () { + }), H.instance && H.isIabContext() ? (t && (i.timeout = t), H.instance.execute({ + command: 'iabPlugin.fetchConsentData', + params: i, + callback: function (t, i) { + i === Object(i) ? (n.doesGdprApply = !!i.gdprApplies, n.consentString = i.consentString || '') : (n.doesGdprApply = !1, n.consentString = ''), n.isVendorConsented = H.instance.isApproved(H.instance.Categories.AAM), t ? e({}) : n.checkQueryStringObject(e), B.adms.waitForMidToReleaseRequests(); + } + })) : e({}); + }, + getQueryString: function () { + return H.isIabContext() ? 'gdpr=' + (this.doesGdprApply ? 1 : 0) + '&gdpr_consent=' + this.consentString + '&' : ''; + }, + getQueryStringObject: function (e, t) { + this.fetchConsentData(e, t); + }, + checkQueryStringObject: function (e) { + G.hasGoSignal() && 'function' == typeof e && e({ + gdpr: this.doesGdprApply ? 1 : 0, + gdpr_consent: this.consentString + }); + } + }); + C.iab = Q, 'error' === a && 0 === s && window.addEventListener('load', function () { + DIL.windowLoaded = !0; + }); + var z = !1, W = function () { + setTimeout(function () { + _ || A.firstRequestHasFired || ('function' == typeof k ? R.afterResult(k).submit(!0) : R.submit(!0)); + }, DIL.constants.TIME_TO_DEFAULT_REQUEST); + }, Y = document; + 'error' !== a && (DIL.windowLoaded ? n() : 'complete' !== Y.readyState && 'loaded' !== Y.readyState ? window.addEventListener('load', function () { + DIL.windowLoaded = !0, n(); + }) : (DIL.windowLoaded = !0, n())), A.declaredId.setDeclaredId(d, 'init'), F.init(), Q.init(), A.processVisitorAPI(), S.IS_IE_LESS_THAN_10 && N.replaceMethodsWithFunction(R, function () { + return this; + }), this.api = R, this.getStuffedVariable = function (e) { + var t = V.stuffed[e]; + return t || 'number' == typeof t || (t = N.getCookie(e)) || 'number' == typeof t || (t = ''), t; + }, this.validators = q, this.helpers = N, this.constants = S, this.log = D, this.pendingRequest = L, this.requestController = A, this.destinationPublishing = M, this.requestProcs = j, this.units = C, this.initConfig = e, this.logger = T, I && (this.variables = V, this.callWindowLoadFunctions = n); + }.apply(this, arguments); + } finally { + if ($___old_c5cc0bf256fdc8a1) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_c5cc0bf256fdc8a1)); + if ($___old_465ce794c2ab10af) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_465ce794c2ab10af)); + } + }, DIL.extendStaticPropertiesAndMethods = function (e) { + var t; + if (e === Object(e)) + for (t in e) + e.hasOwnProperty(t) && (this[t] = e[t]); + }, DIL.extendStaticPropertiesAndMethods({ + version: '9.4', + jsonVersion: 1, + constants: { TIME_TO_DEFAULT_REQUEST: 500 }, + variables: { scriptNodeList: document.getElementsByTagName('script') }, + windowLoaded: !1, + dils: {}, + isAddedPostWindowLoad: function () { + var e = arguments[0]; + this.windowLoaded = 'function' == typeof e ? !!e() : 'boolean' != typeof e || e; + }, + create: function (e) { + try { + return new DIL(e); + } catch (e) { + throw new Error('Error in attempt to create DIL instance with DIL.create(): ' + e.message); + } + }, + registerDil: function (e, t, n) { + var i = t + '$' + n; + i in this.dils || (this.dils[i] = e); + }, + getDil: function (e, t) { + var n; + return 'string' != typeof e && (e = ''), (n = e + '$' + (t = t || 0)) in this.dils ? this.dils[n] : new Error('The DIL instance with partner = ' + e + ' and containerNSID = ' + t + ' was not found'); + }, + dexGetQSVars: function (e, t, n) { + var i = this.getDil(t, n); + return i instanceof this ? i.getStuffedVariable(e) : ''; + } + }), DIL.errorModule = (e = DIL.create({ + partner: 'error', + containerNSID: 0, + ignoreHardDependencyOnVisitorAPI: !0 + }), n = !(t = { + harvestererror: 14138, + destpuberror: 14139, + dpmerror: 14140, + generalerror: 14137, + error: 14137, + noerrortypedefined: 15021, + evalerror: 15016, + rangeerror: 15017, + referenceerror: 15018, + typeerror: 15019, + urierror: 15020 + }), { + activate: function () { + n = !0; + }, + handleError: function (i) { + if (!n) + return 'DIL error module has not been activated'; + i !== Object(i) && (i = {}); + var r = i.name ? (i.name + '').toLowerCase() : '', a = r in t ? t[r] : t.noerrortypedefined, s = [], o = { + name: r, + filename: i.filename ? i.filename + '' : '', + partner: i.partner ? i.partner + '' : 'no_partner', + site: i.site ? i.site + '' : document.location.href, + message: i.message ? i.message + '' : '' + }; + return s.push(a), e.api.pixels(s).logs(o).useImageRequest().submit(), 'DIL error report sent'; + }, + pixelMap: t + }), DIL.tools = {}, DIL.modules = { helpers: {} }); + }(), AppMeasurement.getInstance = s_gi, window.s_objectID || (window.s_objectID = 0), s_pgicq(), fdx_initSCode(); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-076c7980e90e3f4c811295e17dcec5de21c8fd79 b/resources/sugarcoat-076c7980e90e3f4c811295e17dcec5de21c8fd79 new file mode 100644 index 00000000..ce842e61 --- /dev/null +++ b/resources/sugarcoat-076c7980e90e3f4c811295e17dcec5de21c8fd79 @@ -0,0 +1,15136 @@ +var _satellite; +{ + const $___mock_448b95a47dd49f0a = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_448b95a47dd49f0a); + const $___mock_ca918043c745117e = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_ca918043c745117e); + (function () { + (function () { + window._satellite = window._satellite || {}, window._satellite.container = { + buildInfo: { + minified: !0, + buildDate: '2021-12-30T15:50:22Z', + turbineBuildDate: '2021-08-11T20:25:49Z', + turbineVersion: '27.2.0' + }, + environment: { + id: 'ENe645c6465fd24d03b3803991bd0903c3', + stage: 'production' + }, + dataElements: { + '[DigitalData] Quarto Livello': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.category.subCategory3' } + }, + '[DigitalData] Terzo Livello': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.category.subCategory2' } + }, + '[DigitalData] Secondo Livello': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.category.subCategory1' } + }, + '[ALL] Internal filter': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return document.domain; + } + } + }, + '[ALL] TransactionId': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'leadId', + caseInsensitive: !0 + } + }, + '[DigitalData] Intcmp': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.category.intcmp' } + }, + '[ALL] Query String Parameter Cmp': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'cmp', + caseInsensitive: !0 + } + }, + '[DigitalData] Channel': { + defaultValue: '', + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.category.primaryCategory' } + }, + '[ALL] External Id': { + defaultValue: '', + forceLowerCase: !0, + storageDuration: 'visitor', + modulePath: 'core/src/lib/dataElements/cookie.js', + settings: { name: 'ext' } + }, + '[ALL] Server': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return document.location.hostname; + } + } + }, + '[ALL] Cookie Login Status': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + switch (_satellite.cookie.get('RESKYC')) { + case 'C': + return 'cliente'; + case 'P': + case 'R': + return 'non cliente'; + default: + return 'non loggato'; + } + } + } + }, + '[VIDEO] HbConfiguration': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return HbConfiguration = { + PLAYER: { + NAME: 'JW Player', + KEY: '', + VIDEO_ID: 'skyPlayer_jwplayer' + }, + VISITOR: { + MARKETING_CLOUD_ORG_ID: '1A124673527853290A490D45@AdobeOrg', + TRACKING_SERVER: 'sky.it.sc.omtrdc.net', + DPID: '', + DPUUID: '' + }, + APP_MEASUREMENT: { + RSID: 'skyitcoll', + TRACKING_SERVER: 'sky.it.sc.omtrdc.net', + PAGE_NAME: 'video-home' + }, + HEARTBEAT: { + TRACKING_SERVER: 'skyitalia.hb.omtrdc.net', + CHANNEL: 'video', + OVP: 'Video Platform', + SDK: '2.0.0' + } + }, HbConfiguration; + } + } + }, + '[ALL] Query String Parameter Intcmp': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'intcmp', + caseInsensitive: !0 + } + }, + '[AOL] EntryProduct': { + defaultValue: '', + forceLowerCase: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'window.entryproduct' } + }, + '[DigitalData] PageName': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.pageName' } + }, + '[AOL] Query String Parameter Codpromo': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'codPromo', + caseInsensitive: !0 + } + }, + '[ALL] Query String Parameter Social': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'social', + caseInsensitive: !0 + } + }, + '[AOL] Prodotti Intermediate': { + defaultValue: 'no_prod;no_prod', + forceLowerCase: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'window.DataLayerIntermediate' } + }, + '[AOL] Adform tracking': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + function e(e, t) { + var a = new RegExp(e); + return t.match(a) ? '1' : '0'; + } + var t = _satellite.getVar('aolrenew_promocode'), a = _satellite.getVar('[AOL] Query String Parameter Codpromo'), n = _satellite.getVar('aolrenew_offertype'); + return function (r) { + var i = { + sv60: t || a ? t || a : '', + sv61: n || '', + sv31: e('netflix', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal), + sv46: e('skyq', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal), + sv62: e('sky famiglia', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal), + sv64: e('sky cinema', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal), + sv65: e('sky sport', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal), + sv66: e('sky calcio', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal), + sv69: e('parabola', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal), + sv72: e('sky on demand', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal), + sv73: e('sky hd', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal), + sv75: e('sky multivision', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal), + sv83: 'seleziona' == r ? 'Pacchetti' : 'anagrafica' == r ? 'Anagrafica' : 'pagamento' == r ? 'Pagamento' : '' + }; + return DataLayer.match(/fastweb/) && (i.sv67 = e('internet illimitato fastweb', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal), i.sv68 = e('chiamate illimitate fastweb', 'seleziona' == r ? DataLayer : 'anagrafica' == r || 'pagamento' == r ? DataLayerIntermediate : DataLayerFinal)), 'typ' == r && (i.sv54 = s.purchaseID), i; + }; + } + } + }, + '[ALL] Remove replicatd scripts': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + function e() { + for (var e = document.getElementsByTagName('script'), t = [], a = 0; a < e.length; a++) + e[a].getAttribute('src') && e[a].getAttribute('src').match(/assets\.adobe/) && t.push(e[a].getAttribute('src')); + var n = []; + for (i = 0; i < t.length; i++) + i == t.indexOf(t[i]) && t.indexOf(t[i]) == t.lastIndexOf(t[i]) || n.push(t[i]); + n.splice(-1, 1); + for (var r = 0; r < n.length; r++) + for (a = 0; a < e.length; a++) + e[a].getAttribute('src') && e[a].getAttribute('src') == n[r] && e[a].parentNode.removeChild(e[a]); + } + return e(); + } + } + }, + 'Canale d\'acquisto': { + defaultValue: '', + forceLowerCase: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return window.mobileDTMcheck ? 'mobile site' : 'desktop site'; + } + } + }, + '[AOL] Prodotti': { + defaultValue: 'no_prod;no_prod', + forceLowerCase: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'window.DataLayer' } + }, + '[AOL] Prodotti Final': { + defaultValue: 'no_prod;no_prod', + forceLowerCase: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'window.DataLayerFinal' } + }, + '[AOL] ExitProduct': { + defaultValue: '', + forceLowerCase: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'window.exitproduct' } + }, + '[AOL] Adform tracking BB': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('aolrenew_promocode'), t = _satellite.getVar('[AOL] Query String Parameter Codpromo'), a = _satellite.getVar('aolrenew_offertype'); + return function (n) { + var r = { + sv1: _satellite.getVar('[ALL] External Id'), + sv3: e || t ? e || t : '', + sv4: a || '', + sv5: s.pageName, + sv6: location.href, + sv8: s.channel, + sv9: s.prop59, + sv10: s.prop60, + sv11: document.referrer, + sv12: 'seleziona' == n ? 'Pacchetti' : 'anagrafica' == n ? 'Anagrafica' : 'pagamento' == n ? 'Pagamento' : 'documenti' == n ? 'Documenti' : 'riepilogo' == n ? 'Riepilogo' : '', + sv13: _satellite.getVar('[ALL] External Id'), + sv14: a || '' + }; + return 'typ' == n && (r.orderid = s.purchaseID), r; + }; + } + } + } + }, + extensions: { + core: { + displayName: 'Core', + hostedLibFilesBaseUrl: 'https://assets.adobedtm.com/extensions/EPc18819a3ae8e447cae97937dd08e60e3/', + modules: { + 'core/src/lib/dataElements/javascriptVariable.js': { + name: 'javascript-variable', + displayName: 'JavaScript Variable', + script: function (e, t, a) { + 'use strict'; + var n = a('../helpers/getObjectProperty.js'); + e.exports = function (e) { + return n(window, e.path); + }; + } + }, + 'core/src/lib/dataElements/customCode.js': { + name: 'custom-code', + displayName: 'Custom Code', + script: function (e) { + 'use strict'; + e.exports = function (e, t) { + return e.source(t); + }; + } + }, + 'core/src/lib/dataElements/queryStringParameter.js': { + name: 'query-string-parameter', + displayName: 'Query String Parameter', + script: function (e, t, a) { + 'use strict'; + var n = a('@adobe/reactor-window'), r = a('@adobe/reactor-query-string'); + e.exports = function (e) { + var t = r.parse(n.location.search); + if (!e.caseInsensitive) + return t[e.name]; + for (var a = e.name.toLowerCase(), i = Object.keys(t), o = 0; o < i.length; o++) { + var s = i[o]; + if (s.toLowerCase() === a) + return t[s]; + } + }; + } + }, + 'core/src/lib/dataElements/cookie.js': { + name: 'cookie', + displayName: 'Cookie', + script: function (e, t, a) { + 'use strict'; + var n = a('@adobe/reactor-cookie'); + e.exports = function (e) { + return n.get(e.name); + }; + } + }, + 'core/src/lib/events/directCall.js': { + name: 'direct-call', + displayName: 'Direct Call', + script: function (e, t, a, n) { + 'use strict'; + var r = {}; + window._satellite = window._satellite || {}, window._satellite.track = function (e, t) { + e = e.trim(); + var a = r[e]; + if (a) { + var i = { + identifier: e, + detail: t + }; + a.forEach(function (e) { + e(i); + }); + var o = ['Rules using the direct call event type with identifier "' + e + '" have been triggered' + (t ? ' with additional detail:' : '.')]; + t && o.push(t), n.logger.log.apply(n.logger, o); + } else + n.logger.log('"' + e + '" does not match any direct call identifiers.'); + }, e.exports = function (e, t) { + var a = r[e.identifier]; + a || (a = r[e.identifier] = []), a.push(t); + }; + } + }, + 'core/src/lib/actions/customCode.js': { + name: 'custom-code', + displayName: 'Custom Code', + script: function (e, t, a, n) { + 'use strict'; + var r, i, o, s, c = a('@adobe/reactor-document'), l = a('@adobe/reactor-promise'), u = a('./helpers/decorateCode'), d = a('./helpers/loadCodeSequentially'), p = a('../../../node_modules/postscribe/dist/postscribe'), h = a('./helpers/unescapeHtmlCode'), f = a('../helpers/findPageScript').getTurbine, g = (i = function (e) { + p(c.body, e, { + beforeWriteToken: function (e) { + var t = e.tagName && e.tagName.toLowerCase(); + return r && 'script' === t && (e.attrs.nonce = r), 'script' !== t && 'style' !== t || (Object.keys(e.attrs || {}).forEach(function (t) { + e.attrs[t] = h(e.attrs[t]); + }), e.src && (e.src = h(e.src))), e; + }, + error: function (e) { + n.logger.error(e.msg); + } + }); + }, o = [], s = function () { + if (c.body) + for (; o.length;) + i(o.shift()); + else + setTimeout(s, 20); + }, function (e) { + o.push(e), s(); + }), m = function () { + if (c.currentScript) + return c.currentScript.async; + var e = f(); + return !e || e.async; + }(); + e.exports = function (e, t) { + var a; + r = n.getExtensionSettings().cspNonce; + var i = { + settings: e, + event: t + }, o = i.settings.source; + if (o) + return i.settings.isExternal ? d(o).then(function (e) { + return e ? (a = u(i, e), g(a.code), a.promise) : l.resolve(); + }) : (a = u(i, o), m || 'loading' !== c.readyState ? g(a.code) : c.write && !1 === n.propertySettings.ruleComponentSequencingEnabled ? c.write(a.code) : g(a.code), a.promise); + }; + } + }, + 'core/src/lib/conditions/domain.js': { + name: 'domain', + displayName: 'Domain', + script: function (e, t, a) { + 'use strict'; + var n = a('@adobe/reactor-document'), r = /[|\\{}()[\]^$+*?.-]/g, i = function (e) { + if ('string' != typeof e) + throw new TypeError('Expected a string'); + return e.replace(r, '\\$&'); + }; + e.exports = function (e) { + var t = n.location.hostname; + return e.domains.some(function (e) { + return t.match(new RegExp('(^|\\.)' + i(e) + '$', 'i')); + }); + }; + } + }, + 'core/src/lib/conditions/customCode.js': { + name: 'custom-code', + displayName: 'Custom Code', + script: function (e) { + 'use strict'; + e.exports = function (e, t) { + return e.source.call(t.element, t, t.target); + }; + } + }, + 'core/src/lib/events/click.js': { + name: 'click', + displayName: 'Click', + script: function (e, t, a) { + 'use strict'; + var n = a('@adobe/reactor-window'), r = a('./helpers/createBubbly')(), i = new (a('./helpers/weakMap'))(), o = 2, s = a('../helpers/stringAndNumberUtils').castToNumberIfString, c = function (e) { + if (!e.ctrlKey && !e.metaKey && e.button !== o) + for (var t = e.target; t;) { + var a = t.tagName; + if (a && 'a' === a.toLowerCase()) { + var r = t.getAttribute('href'), i = t.getAttribute('target'); + return r && (!i || '_self' === i || '_top' === i && n.top === n || i === n.name) ? t : void 0; + } + t = t.parentNode; + } + }; + document.addEventListener('click', r.evaluateEvent, !0), e.exports = function (e, t) { + r.addListener(e, function (a) { + var r = a.nativeEvent; + if (!r.s_fe) { + var o = s(e.anchorDelay); + if (o && !i.has(r)) { + var l = c(r); + l && (r.preventDefault(), setTimeout(function () { + n.location = l.href; + }, o)), i.set(r, !0); + } + t(a); + } + }); + }, e.exports.__reset = r.__reset; + } + }, + 'core/src/lib/events/domReady.js': { + name: 'dom-ready', + displayName: 'DOM Ready', + script: function (e, t, a) { + 'use strict'; + var n = a('./helpers/pageLifecycleEvents'); + e.exports = function (e, t) { + n.registerDomReadyTrigger(t); + }; + } + }, + 'core/src/lib/events/libraryLoaded.js': { + name: 'library-loaded', + displayName: 'Library Loaded (Page Top)', + script: function (e, t, a) { + 'use strict'; + var n = a('./helpers/pageLifecycleEvents'); + e.exports = function (e, t) { + n.registerLibraryLoadedTrigger(t); + }; + } + }, + 'core/src/lib/events/pageBottom.js': { + name: 'page-bottom', + displayName: 'Page Bottom', + script: function (e, t, a) { + 'use strict'; + var n = a('./helpers/pageLifecycleEvents'); + e.exports = function (e, t) { + n.registerPageBottomTrigger(t); + }; + } + }, + 'core/src/lib/conditions/path.js': { + name: 'path', + displayName: 'Path Without Query String', + script: function (e, t, a) { + 'use strict'; + var n = a('@adobe/reactor-document'), r = a('../helpers/textMatch'); + e.exports = function (e) { + var t = n.location.pathname; + return e.paths.some(function (e) { + var a = e.valueIsRegex ? new RegExp(e.value, 'i') : e.value; + return r(t, a); + }); + }; + } + }, + 'core/src/lib/helpers/getObjectProperty.js': { + script: function (e) { + 'use strict'; + e.exports = function (e, t) { + for (var a = t.split('.'), n = e, r = 0, i = a.length; r < i; r++) { + if (null == n) + return; + n = n[a[r]]; + } + return n; + }; + } + }, + 'core/src/lib/actions/helpers/decorateCode.js': { + script: function (e, t, a) { + 'use strict'; + var n = a('./decorators/decorateGlobalJavaScriptCode'), r = a('./decorators/decorateNonGlobalJavaScriptCode'), i = { + javascript: function (e, t) { + return e.settings.global ? n(e, t) : r(e, t); + }, + html: a('./decorators/decorateHtmlCode') + }; + e.exports = function (e, t) { + return i[e.settings.language](e, t); + }; + } + }, + 'core/src/lib/actions/helpers/loadCodeSequentially.js': { + script: function (e, t, a) { + 'use strict'; + var n = a('@adobe/reactor-promise'), r = a('./getSourceByUrl'), i = n.resolve(); + e.exports = function (e) { + var t = new n(function (t) { + var a = r(e); + n.all([ + a, + i + ]).then(function (e) { + var a = e[0]; + t(a); + }); + }); + return i = t, t; + }; + } + }, + 'core/node_modules/postscribe/dist/postscribe.js': { + script: function (e, t) { + var a, n; + a = this, n = function () { + return function (e) { + function t(n) { + if (a[n]) + return a[n].exports; + var r = a[n] = { + exports: {}, + id: n, + loaded: !1 + }; + return e[n].call(r.exports, r, r.exports, t), r.loaded = !0, r.exports; + } + var a = {}; + return t.m = e, t.c = a, t.p = '', t(0); + }([ + function (e, t, a) { + 'use strict'; + function n(e) { + return e && e.__esModule ? e : { default: e }; + } + var r = n(a(1)); + e.exports = r.default; + }, + function (e, t, a) { + 'use strict'; + function n(e) { + if (e && e.__esModule) + return e; + var t = {}; + if (null != e) + for (var a in e) + Object.prototype.hasOwnProperty.call(e, a) && (t[a] = e[a]); + return t.default = e, t; + } + function r(e) { + return e && e.__esModule ? e : { default: e }; + } + function i() { + } + function o() { + var e = f.shift(); + if (e) { + var t = d.last(e); + t.afterDequeue(), e.stream = s.apply(void 0, e), t.afterStreamStart(); + } + } + function s(e, t, a) { + function n(e) { + e = a.beforeWrite(e), g.write(e), a.afterWrite(e); + } + (g = new u.default(e, a)).id = h++, g.name = a.name || g.id, c.streams[g.name] = g; + var r = e.ownerDocument, s = { + close: r.close, + open: r.open, + write: r.write, + writeln: r.writeln + }; + l(r, { + close: i, + open: i, + write: function () { + for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) + t[a] = arguments[a]; + return n(t.join('')); + }, + writeln: function () { + for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) + t[a] = arguments[a]; + return n(t.join('') + '\n'); + } + }); + var d = g.win.onerror || i; + return g.win.onerror = function (e, t, n) { + a.error({ msg: e + ' - ' + t + ': ' + n }), d.apply(g.win, [ + e, + t, + n + ]); + }, g.write(t, function () { + l(r, s), g.win.onerror = d, a.done(), g = null, o(); + }), g; + } + function c(e, t, a) { + if (d.isFunction(a)) + a = { done: a }; + else if ('clear' === a) + return f = [], g = null, void (h = 0); + a = d.defaults(a, p); + var n = [ + e = /^#/.test(e) ? window.document.getElementById(e.substr(1)) : e.jquery ? e[0] : e, + t, + a + ]; + return e.postscribe = { + cancel: function () { + n.stream ? n.stream.abort() : n[1] = i; + } + }, a.beforeEnqueue(n), f.push(n), g || o(), e.postscribe; + } + t.__esModule = !0; + var l = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var a = arguments[t]; + for (var n in a) + Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n]); + } + return e; + }; + t.default = c; + var u = r(a(2)), d = n(a(4)), p = { + afterAsync: i, + afterDequeue: i, + afterStreamStart: i, + afterWrite: i, + autoFix: !0, + beforeEnqueue: i, + beforeWriteToken: function (e) { + return e; + }, + beforeWrite: function (e) { + return e; + }, + done: i, + error: function (e) { + throw new Error(e.msg); + }, + releaseAsync: !1 + }, h = 0, f = [], g = null; + l(c, { + streams: {}, + queue: f, + WriteStream: u.default + }); + }, + function (e, t, a) { + 'use strict'; + function n(e) { + if (e && e.__esModule) + return e; + var t = {}; + if (null != e) + for (var a in e) + Object.prototype.hasOwnProperty.call(e, a) && (t[a] = e[a]); + return t.default = e, t; + } + function r(e) { + return e && e.__esModule ? e : { default: e }; + } + function i(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + function o(e, t) { + var a = p + t, n = e.getAttribute(a); + return u.existy(n) ? String(n) : n; + } + function s(e, t) { + var a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, n = p + t; + u.existy(a) && '' !== a ? e.setAttribute(n, a) : e.removeAttribute(n); + } + t.__esModule = !0; + var c = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var a = arguments[t]; + for (var n in a) + Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n]); + } + return e; + }, l = r(a(3)), u = n(a(4)), d = !1, p = 'data-ps-', h = 'ps-style', f = 'ps-script', g = function () { + function e(t) { + var a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + i(this, e), this.root = t, this.options = a, this.doc = t.ownerDocument, this.win = this.doc.defaultView || this.doc.parentWindow, this.parser = new l.default('', { autoFix: a.autoFix }), this.actuals = [t], this.proxyHistory = '', this.proxyRoot = this.doc.createElement(t.nodeName), this.scriptStack = [], this.writeQueue = [], s(this.proxyRoot, 'proxyof', 0); + } + return e.prototype.write = function () { + var e; + for ((e = this.writeQueue).push.apply(e, arguments); !this.deferredRemote && this.writeQueue.length;) { + var t = this.writeQueue.shift(); + u.isFunction(t) ? this._callFunction(t) : this._writeImpl(t); + } + }, e.prototype._callFunction = function (e) { + var t = { + type: 'function', + value: e.name || e.toString() + }; + this._onScriptStart(t), e.call(this.win, this.doc), this._onScriptDone(t); + }, e.prototype._writeImpl = function (e) { + this.parser.append(e); + for (var t = void 0, a = void 0, n = void 0, r = []; (t = this.parser.readToken()) && !(a = u.isScript(t)) && !(n = u.isStyle(t));) + (t = this.options.beforeWriteToken(t)) && r.push(t); + r.length > 0 && this._writeStaticTokens(r), a && this._handleScriptToken(t), n && this._handleStyleToken(t); + }, e.prototype._writeStaticTokens = function (e) { + var t = this._buildChunk(e); + return t.actual ? (t.html = this.proxyHistory + t.actual, this.proxyHistory += t.proxy, this.proxyRoot.innerHTML = t.html, d && (t.proxyInnerHTML = this.proxyRoot.innerHTML), this._walkChunk(), d && (t.actualInnerHTML = this.root.innerHTML), t) : null; + }, e.prototype._buildChunk = function (e) { + for (var t = this.actuals.length, a = [], n = [], r = [], i = e.length, o = 0; o < i; o++) { + var s = e[o], c = s.toString(); + if (a.push(c), s.attrs) { + if (!/^noscript$/i.test(s.tagName)) { + var l = t++; + n.push(c.replace(/(\/?>)/, ' ' + p + 'id=' + l + ' $1')), s.attrs.id !== f && s.attrs.id !== h && r.push('atomicTag' === s.type ? '' : '<' + s.tagName + ' ' + p + 'proxyof=' + l + (s.unary ? ' />' : '>')); + } + } else + n.push(c), r.push('endTag' === s.type ? c : ''); + } + return { + tokens: e, + raw: a.join(''), + actual: n.join(''), + proxy: r.join('') + }; + }, e.prototype._walkChunk = function () { + for (var e = void 0, t = [this.proxyRoot]; u.existy(e = t.shift());) { + var a = 1 === e.nodeType; + if (!a || !o(e, 'proxyof')) { + a && (this.actuals[o(e, 'id')] = e, s(e, 'id')); + var n = e.parentNode && o(e.parentNode, 'proxyof'); + n && this.actuals[n].appendChild(e); + } + t.unshift.apply(t, u.toArray(e.childNodes)); + } + }, e.prototype._handleScriptToken = function (e) { + var t = this, a = this.parser.clear(); + a && this.writeQueue.unshift(a), e.src = e.attrs.src || e.attrs.SRC, (e = this.options.beforeWriteToken(e)) && (e.src && this.scriptStack.length ? this.deferredRemote = e : this._onScriptStart(e), this._writeScriptToken(e, function () { + t._onScriptDone(e); + })); + }, e.prototype._handleStyleToken = function (e) { + var t = this.parser.clear(); + t && this.writeQueue.unshift(t), e.type = e.attrs.type || e.attrs.TYPE || 'text/css', (e = this.options.beforeWriteToken(e)) && this._writeStyleToken(e), t && this.write(); + }, e.prototype._writeStyleToken = function (e) { + var t = this._buildStyle(e); + this._insertCursor(t, h), e.content && (t.styleSheet && !t.sheet ? t.styleSheet.cssText = e.content : t.appendChild(this.doc.createTextNode(e.content))); + }, e.prototype._buildStyle = function (e) { + var t = this.doc.createElement(e.tagName); + return t.setAttribute('type', e.type), u.eachKey(e.attrs, function (e, a) { + t.setAttribute(e, a); + }), t; + }, e.prototype._insertCursor = function (e, t) { + this._writeImpl(''); + var a = this.doc.getElementById(t); + a && a.parentNode.replaceChild(e, a); + }, e.prototype._onScriptStart = function (e) { + e.outerWrites = this.writeQueue, this.writeQueue = [], this.scriptStack.unshift(e); + }, e.prototype._onScriptDone = function (e) { + e === this.scriptStack[0] ? (this.scriptStack.shift(), this.write.apply(this, e.outerWrites), !this.scriptStack.length && this.deferredRemote && (this._onScriptStart(this.deferredRemote), this.deferredRemote = null)) : this.options.error({ msg: 'Bad script nesting or script finished twice' }); + }, e.prototype._writeScriptToken = function (e, t) { + var a = this._buildScript(e), n = this._shouldRelease(a), r = this.options.afterAsync; + e.src && (a.src = e.src, this._scriptLoadHandler(a, n ? r : function () { + t(), r(); + })); + try { + this._insertCursor(a, f), a.src && !n || t(); + } catch (e) { + this.options.error(e), t(); + } + }, e.prototype._buildScript = function (e) { + var t = this.doc.createElement(e.tagName); + return u.eachKey(e.attrs, function (e, a) { + t.setAttribute(e, a); + }), e.content && (t.text = e.content), t; + }, e.prototype._scriptLoadHandler = function (e, t) { + function a() { + e = e.onload = e.onreadystatechange = e.onerror = null; + } + function n() { + a(), null != t && t(), t = null; + } + function r(e) { + a(), o(e), null != t && t(), t = null; + } + function i(e, t) { + var a = e['on' + t]; + null != a && (e['_on' + t] = a); + } + var o = this.options.error; + i(e, 'load'), i(e, 'error'), c(e, { + onload: function () { + if (e._onload) + try { + e._onload.apply(this, Array.prototype.slice.call(arguments, 0)); + } catch (t) { + r({ msg: 'onload handler failed ' + t + ' @ ' + e.src }); + } + n(); + }, + onerror: function () { + if (e._onerror) + try { + e._onerror.apply(this, Array.prototype.slice.call(arguments, 0)); + } catch (t) { + return void r({ msg: 'onerror handler failed ' + t + ' @ ' + e.src }); + } + r({ msg: 'remote script failed ' + e.src }); + }, + onreadystatechange: function () { + /^(loaded|complete)$/.test(e.readyState) && n(); + } + }); + }, e.prototype._shouldRelease = function (e) { + return !/^script$/i.test(e.nodeName) || !!(this.options.releaseAsync && e.src && e.hasAttribute('async')); + }, e; + }(); + t.default = g; + }, + function (e) { + var t; + t = function () { + return function (e) { + function t(n) { + if (a[n]) + return a[n].exports; + var r = a[n] = { + exports: {}, + id: n, + loaded: !1 + }; + return e[n].call(r.exports, r, r.exports, t), r.loaded = !0, r.exports; + } + var a = {}; + return t.m = e, t.c = a, t.p = '', t(0); + }([ + function (e, t, a) { + 'use strict'; + function n(e) { + return e && e.__esModule ? e : { default: e }; + } + var r = n(a(1)); + e.exports = r.default; + }, + function (e, t, a) { + 'use strict'; + function n(e) { + return e && e.__esModule ? e : { default: e }; + } + function r(e) { + if (e && e.__esModule) + return e; + var t = {}; + if (null != e) + for (var a in e) + Object.prototype.hasOwnProperty.call(e, a) && (t[a] = e[a]); + return t.default = e, t; + } + function i(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + t.__esModule = !0; + var o = r(a(2)), s = r(a(3)), c = n(a(6)), l = a(5), u = { + comment: /^'); + if (t >= 0) + return new l.CommentToken(e.substr(4, t - 1), t + 3); + } + function r(e) { + var t = e.indexOf('<'); + return new l.CharsToken(t >= 0 ? t : e.length); + } + function i(e) { + var t, a, n; + if (-1 !== e.indexOf('>')) { + var r = e.match(u.startTag); + if (r) { + var i = (t = {}, a = {}, n = r[2], r[2].replace(u.attr, function (e, r) { + arguments[2] || arguments[3] || arguments[4] || arguments[5] ? arguments[5] ? (t[arguments[5]] = '', a[arguments[5]] = !0) : t[r] = arguments[2] || arguments[3] || arguments[4] || u.fillAttr.test(r) && r || '' : t[r] = '', n = n.replace(e, ''); + }), { v: new l.StartTagToken(r[1], r[0].length, t, a, !!r[3], n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '')) }); + if ('object' === (void 0 === i ? 'undefined' : c(i))) + return i.v; + } + } + } + function o(e) { + var t = i(e); + if (t) { + var a = e.slice(t.length); + if (a.match(new RegExp('', 'i'))) { + var n = a.match(new RegExp('([\\s\\S]*?)', 'i')); + if (n) + return new l.AtomicTagToken(t.tagName, n[0].length + t.length, t.attrs, t.booleanAttrs, n[1]); + } + } + } + function s(e) { + var t = e.match(u.endTag); + if (t) + return new l.EndTagToken(t[1], t[0].length); + } + t.__esModule = !0; + var c = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + }; + t.comment = n, t.chars = r, t.startTag = i, t.atomicTag = o, t.endTag = s; + var l = a(4), u = { + startTag: /^<([\-A-Za-z0-9_]+)((?:\s+[\w\-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, + endTag: /^<\/([\-A-Za-z0-9_]+)[^>]*>/, + attr: /(?:([\-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([\-A-Za-z0-9_]+)(\s|$)+)/g, + fillAttr: /^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i + }; + }, + function (e, t, a) { + 'use strict'; + function n(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + t.__esModule = !0, t.EndTagToken = t.AtomicTagToken = t.StartTagToken = t.TagToken = t.CharsToken = t.CommentToken = t.Token = void 0; + var r = a(5), i = (t.Token = function e(t, a) { + n(this, e), this.type = t, this.length = a, this.text = ''; + }, t.CommentToken = function () { + function e(t, a) { + n(this, e), this.type = 'comment', this.length = a || (t ? t.length : 0), this.text = '', this.content = t; + } + return e.prototype.toString = function () { + return '\n\n', + language: 'html' + } + }] + }, + { + id: 'RLf4c1fed6d9214fd9a9f26dfd89e5426d', + name: '#50 [DR] Speed Test Configuratore - esito positivo', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'configuratore-speed-test_positivo' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'www.sky.it', + 'caem.sky.it', + 'collcms.www.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.pageName = 'sky:offerte:configuratore-abbonamento-sky:esito-speed-test-positivo', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RL313948d62a504006b7df29d2e51757e0', + name: '#55 [ER] [CLICK CORPORATE] Sky Kids - Cta attiva kids ', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '#wrapper > section.help.spotify-help.scrollAnimation > div.bottom > div > div.row.row-eq-height > div > div.swiper-wrapper > div.spotify-slide.swiper-slide-next > div > p > a', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 55 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !!document.location.href.match(/tv\/sky-kids/); + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'eVar24,eVar55,prop55,events', t.linkTrackEvents = t.events = 'event16', t.eVar24 = 'cta_sky-kids_attiva', t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'click_corporate', + linkType: 'o' + } + } + ] + }, + { + id: 'RL548576e887de463994edf2787532867f', + name: '#55 [ER] [CLICK CORPORATE] SkyQ attivazione - Box Cta scopri', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '.two-boxes-hover .box .mask .hover .cta', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 55 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !!document.location.href.match(/tv\/skyq\/attivazione/); + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'eVar24,prop55,eVar55,events', t.linkTrackEvents = t.events = 'event16'; + var a = $(this).first().text().toLowerCase(); + t.eVar24 = a.trim(), t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'click_corporate', + linkType: 'o' + } + } + ] + }, + { + id: 'RL614fa4e1b0214e2ab8a5dda953a74f96', + name: '#50 [PL] [TAG TERZI] Google ADS (Libreria)', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !location.href.match(/file:\/\/\/C\:\//); + } + } + }, + { + modulePath: 'core/src/lib/conditions/domain.js', + settings: { domains: ['www.sky.it'] } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n\n', + language: 'html' + } + }] + }, + { + id: 'RL9253dd3dee394012a73ab708d57ca351', + name: '#55 [ER] [CLICK CORPORATE] SkyQ attivazione - Button switch', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '.switch-controller .switch-button button', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 55 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !!document.location.href.match(/tv\/skyq\/attivazione/); + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'eVar24,prop55,eVar55,events', t.linkTrackEvents = t.events = 'event16'; + var a = $(this).first().text().toLowerCase(); + t.eVar24 = a.trim(), t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'click_corporate', + linkType: 'o' + } + } + ] + }, + { + id: 'RL8202781c048a460288b8beae12f6b50b', + name: '#50 [DR] Tracking CTA Extra', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'track_trackingctaextra_action' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + document.location.href.match(/extra\/csr\/unmaredasalvare/) ? (t.events = '', t.linkTrackVars = 'events,eVar24,prop55,eVar55', t.linkTrackEvents = t.events = 'event16', t.eVar24 = 'quiz ocean typ', t.prop55 = t.eVar55 = window.location.href.split(/[?#]/)[0]) : (t.events = '', t.pageName = '', t.linkTrackVars = 'events,eVar39,prop54,eVar54,prop55,eVar55', t.eVar39 = _satellite.getVar('track_trackingctaextra_step'), t.eVar39 && (t.linkTrackEvents = t.events = 'event87'), t.prop54 = window.location.href, t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55')), console.info('ADOBE LAUNCH Trackingctaextra : ' + _satellite.getVar('track_trackingctaextra_step')); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'trackingctaextra', + linkType: 'o' + } + } + ] + }, + { + id: 'RL55890d871eac4407b612bb97cdeab4b4', + name: '#50 [ER] [ALL] Logout', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '.logout-balloon-logout-area, .logout-overlay-logout-area', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.pageName = '', t.linkTrackVars = 'server,prop54,prop55,eVar54,eVar55', t.linkTrackEvents = t.events = 'event120', t.prop54 = window.location.href, t.prop55 = window.location.href.split(/[?#]/)[0], t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'logout_sky', + linkType: 'o' + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + } + ] + }, + { + id: 'RL78f2d346d3164195b9722c326da20e7d', + name: '#50 [ER] [ALL] Zone Id', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a, img.sky-logo', + elementProperties: [{ + name: 'zoneid', + value: '.*', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !!this.getAttribute('zoneid'); + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.pageName = '', t.linkTrackVars = 'eVar79', t.eVar79 = this.getAttribute('zoneid'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'zoneid_menu', + linkType: 'o' + } + } + ] + }, + { + id: 'RLa8ac3c81596c4cf795144b049005a33d', + name: '#50 [DR] Tracking Click Corporate', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'track_trackingclickcorporate_arrow' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.pageName = '', t.events = '', t.linkTrackVars = 'events,eVar24,prop55,eVar55', t.linkTrackEvents = t.events = 'event16', t.eVar24 = _satellite.getVar('track_trackingclickcorporate_category').toLowerCase(), t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'trackingclickcorporate', + linkType: 'o' + } + } + ] + }, + { + id: 'RL6a89c251639a44f898ceee22adf94489', + name: '#02 [PL] [ALL] Library Loaded Heartbeats', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 2 + }], + conditions: [], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + global: !1, + source: '/*************************************************************************\n * ADOBE CONFIDENTIAL\n * ___________________\n *\n * Copyright 2019 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n **************************************************************************/\n/*\n * MediaSDK - 2.2.0 - 2019-02-12\n * Copyright (c) 2019 Adobe. All Rights Reserved.\n *\n * Copyright for external libraries used in Media SDK\n * JavaScript MD5 1.0.1\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * http://www.opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n *\n *\n * umdjs (commonjsStrict.js)\n * Copyright (c) the UMD contributors\n * Licensed under the MIT license:\n * https://github.com/umdjs/umd/blob/master/LICENSE.md\n */\n(function (root, factory) {\n if (typeof define === \'function\' && define.amd) {\n define([\'exports\'], factory);\n } else if (typeof exports === \'object\' && typeof exports.nodeName !== \'string\') {\n factory(exports);\n } else {\n factory(root.ADB = {});\n }\n}(typeof self !== \'undefined\' ? self : this, function (exports) {\n var lib = {};\n (function () {\n \n\n// Heartbeat core\n!function(a){if(void 0===b)var b={};if(void 0===c)var c={};if(void 0===d)var d={};if(d.radio||(d.radio={}),d.plugin||(d.plugin={}),void 0===e)var e={};e.clock||(e.clock={}),function(a){"use strict";function b(a,b){var c=(65535&a)+(65535&b);return(a>>16)+(b>>16)+(c>>16)<<16|65535&c}function c(a,b){return a<>>32-b}function d(a,d,e,f,g,h){return b(c(b(b(d,a),b(f,h)),g),e)}function e(a,b,c,e,f,g,h){return d(b&c|~b&e,a,b,f,g,h)}function f(a,b,c,e,f,g,h){return d(b&e|c&~e,a,b,f,g,h)}function g(a,b,c,e,f,g,h){return d(b^c^e,a,b,f,g,h)}function h(a,b,c,e,f,g,h){return d(c^(b|~e),a,b,f,g,h)}function i(a,c){a[c>>5]|=128<>>9<<4)]=c;var d,i,j,k,l,m=1732584193,n=-271733879,o=-1732584194,p=271733878;for(d=0;d>5]>>>b%32&255);return c}function k(a){var b,c=[];for(c[(a.length>>2)-1]=void 0,b=0;b>5]|=(255&a.charCodeAt(b/8))<16&&(e=i(e,8*a.length)),c=0;c<16;c+=1)f[c]=909522486^e[c],g[c]=1549556828^e[c];return d=i(f.concat(k(b)),512+8*b.length),j(i(g.concat(d),640))}function n(a){var b,c,d="0123456789abcdef",e="";for(c=0;c>>4&15)+d.charAt(15&b);return e}function o(a){return unescape(encodeURIComponent(a))}function p(a){return l(o(a))}function q(a){return n(p(a))}function r(a,b){return m(o(a),o(b))}function s(a,b){return n(r(a,b))}function t(a,b,c){return b?c?r(b,a):s(b,a):c?p(a):q(a)}a.md5=t}(b),function(a){"use strict";var b={};b.startsWith=function(a,b){return 0==a.indexOf(b)},a.StringUtils=b}(b),function(a){"use strict";var b={};b.clone=function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},b.merge=function(a,c){var d=b.clone(a);for(var e in c)c.hasOwnProperty(e)&&(d[e]=c[e]);return d},b.append=function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])},a.ObjectUtils=b}(b),function(a){"use strict";function b(a){if(null==a)return!0;for(var b=0;bi)return 1;if(h0},d.isGreaterThanEqual=function(a,b){return c(a,b)>=0},d.isLessThan=function(a,b){return c(a,b)<0},d.isLessThanEqual=function(a,b){return c(a,b)<=0},d.isSame=function(a,b){return 0===c(a,b)},d.isDifferent=function(a,b){return 0!==c(a,b)},a.VersionUtils=d}(b),function(a){"use strict";function b(a,b,c){this.fn=a,this.ctx=b,this.params=c}b.prototype.run=function(){this.params?this.fn.apply(this.ctx,this.params):this.fn.apply(this.ctx)},a.radio.Command=b}(d),function(a){"use strict";function b(a,b){this._queue=[],this._lastTs=0,this._isSuspended=void 0!==a&&a,this._delay=void 0!==b?b:0}b.prototype.addCommand=function(a){this._queue.push(a),this._drain()},b.prototype.cancelAllCommands=function(){this._queue=[]},b.prototype.isEmpty=function(){return 0===this._queue.length},b.prototype.suspend=function(){this._isSuspended=!0},b.prototype.resume=function(){this._isSuspended=!1,this._drain()},b.prototype.flush=function(){this._isSuspended=!1;for(var a=0;a"},b.prototype.shutdown=function(){this._isShutDown||(this._logger.debug(d,"#shutdown > Shutting down"),this.off(),this._requests={},this._commands={},this._isShutDown=!0)},b.prototype.on=function(a,b,c){this._isShutDown||(this._listeners[a]||(this._listeners[a]=[]),this._listeners[a].push({fn:b,ctx:c}))},b.prototype.off=function(a,b,c){if(!this._isShutDown){if(b="function"==typeof b?b:null,!a&&null==b&&!c)return void(this._listeners={});if(a)this._removeListener(a,b,c);else for(a in this._listeners)this._listeners.hasOwnProperty(a)&&this._removeListener(a,b,c)}},b.prototype.trigger=function(a){if(!this._isShutDown)for(var b in this._listeners)if(this._listeners.hasOwnProperty(b)&&c(b,a.name))for(var d=this._listeners[b].slice(0),e=0;e No command handler for: "+a);c.cmd.call(c.ctx,b)}},b.prototype.reply=function(a,b,c){this._isShutDown||(this._requests[a]={fn:b,ctx:c})},b.prototype.request=function(a){if(!this._isShutDown){var b=this._requests[a];return b?b.fn.call(b.ctx):(this._logger.warn(d,"#request > No request handler for: "+a),null)}},b.prototype._removeListener=function(a,b,c){b="function"==typeof b?b:null;var d=this._listeners[a];if(d){if(!d.length||null==b&&!c)return void delete this._listeners[a];for(var e=0;e=0;d--){var g=this._events[e][d];b===g.cb&&c===g.ctx&&this._events[e].splice(d,1)}this._events[e].length||delete this._events[e]}}},b.prototype.dispatchEvent=function(a){if(a.name){var b,c;for(b in this._events)if(this._events.hasOwnProperty(b)&&a.name===b){var d=this._events[b],e=d.slice(0),f=e.length;for(c=0;c=0;b--){var d=this._events[c][b];d.ctx===a&&this._events[c].splice(b,1)}this._events[c].length||delete this._events[c]}}else this._events={}},a.EventDispatcher=b}(d),function(a){"use strict";function b(){}function c(a,b){this.url=a||null,this.method=b,this._xmlhttp=null}function d(){d.__super__.constructor.call(this),this._connection=null}var e=a.Event,f=a.EventDispatcher;b.GET="GET",d.RESPONSE="response",d.INSTANCE="instance",a.extend(d,f),d.prototype.close=function(){this.removeAllListeners(null)},d.prototype.load=function(a){a&&a.method&&a.url&&(a._xmlhttp=this._createCORSRequest(a),a._xmlhttp?a._xmlhttp.send():this._loadImage(a))},d.prototype._createCORSRequest=function(a){var b=null;if(void 0!==window.XMLHttpRequest){var c=new window.XMLHttpRequest;"withCredentials"in c&&(b=c,b.open(a.method,a.url,!0))}if(null==b&&void 0!==window.XDomainRequest&&(b=new window.XDomainRequest,b.open(a.method,a.url)),b){var f={};f[d.INSTANCE]=this;var g=this;b.onload=function(){if(b.status&&parseInt(b.status,10)>=400)return this.onerror();f[d.RESPONSE]=b.responseText,g.dispatchEvent(new e(e.SUCCESS,f))},b.onerror=function(){g.dispatchEvent(new e(e.ERROR,f))}}return b},d.prototype._loadImage=function(a){this._connection||(this._connection=new Image,this._connection.alt=""),this._connection.src=a.url;var b={};b[d.RESPONSE]="",b[d.INSTANCE]=this,this.dispatchEvent(new e(e.SUCCESS,b))},a.URLRequestMethod=b,a.URLRequest=c,a.URLLoader=d}(d),function(a){"use strict";var b="2.2.0.223",c="05c3c4",d={};d.getVersion=function(){return"js-"+b+"-"+c},d.getMajor=function(){return d.getNumberAtPosition(0)},d.getMinor=function(){return d.getNumberAtPosition(1)},d.getMicro=function(){return d.getNumberAtPosition(2)},d.getPatch=function(){return d.getNumberAtPosition(3)},d.getBuild=function(){return c},d.getApiLevel=function(){return 4},d.getNumberAtPosition=function(a){return b.split(".")[a]},a.Version=d}(c),function(a){"use strict";function b(a,b){this._message=a,this._details=b}b.prototype.getMessage=function(){return this._message},b.prototype.getDetails=function(){return this._details},a.ErrorInfo=b}(c),function(a){"use strict";function b(){this.debugLogging=!1}a.HeartbeatConfig=b}(c),function(a){"use strict";function b(){}b.prototype.onError=function(a){},a.HeartbeatDelegate=b}(c),function(a){"use strict";function b(){}b.prototype.configure=function(a){throw new Error("Implementation error: Method must be overridden.")},b.prototype.bootstrap=function(a){throw new Error("Implementation error: Method must be overridden.")},b.prototype.setup=function(){throw new Error("Implementation error: Method must be overridden.")},b.prototype.destroy=function(){throw new Error("Implementation error: Method must be overridden.")},b.prototype.enable=function(){throw new Error("Implementation error: Method must be overridden.")},b.prototype.disable=function(){throw new Error("Implementation error: Method must be overridden.")},b.prototype.getName=function(){throw new Error("Implementation error: Method must be overridden.")},b.prototype.isInitialized=function(){throw new Error("Implementation error: Method must be overridden.")},b.prototype.resolveData=function(a){throw new Error("Implementation error: Method must be overridden.")},a.plugin.IPlugin=b}(d),function(a){"use strict";function b(a,b,c,d){this.trigger=a,this.action=c,this.plugin=b,this._paramMappings={},this.mergeParams(d)}var c=a.plugin.ParamMapping;b.prototype.mergeParams=function(a){if(a)for(var b=0;b Replacing plugin: "+b),this._plugins[b]=a,a.bootstrap(this)},b.prototype.setupPlugins=function(){for(var a in this._plugins)this._plugins.hasOwnProperty(a)&&this._plugins[a].setup()},b.prototype.pluginExists=function(a){return!!this._plugins[a]},b.prototype.isPluginInitialized=function(a){return this._plugins[a]&&this._plugins[a].isInitialized()},b.prototype.on=function(a,b,c,d){this._dataChannel.on(a+e.SEPARATOR+b,c,d)},b.prototype.off=function(a,b,c,d){var f=a&&b?a+e.SEPARATOR+b:null;this._dataChannel.off(f,c,d)},b.prototype.trigger=function(a){var b=a.name,c=this._behaviours[b];if(c){var d,e,f,g,h,i={},j={};for(d=0;d"},c.prototype._enabled=function(){},c.prototype._disabled=function(){},c.prototype._teardown=function(){},c.prototype._canProcess=function(){return this._isEnabled?!this._isDestroyed||(this._logger.error(this._logTag,"Plugin destroyed."),!1):(this._logger.error(this._logTag,"Plugin disabled."),!1)},c.prototype._trigger=function(a,b){var c=f.createFromTrigger(new e(this.getName(),a));c.data=b,this._pluginManager.trigger(c)},a.plugin.BasePlugin=c}(d,c),function(a){"use strict";function b(a,b,c){this.name=a,this.interval=b,this.isActive=!1,this.repeatCount=void 0!==c?c:e,this._nextTickTimestamp=0,this.reset()}function c(a,b){if(!a)throw new Error("Reference to the ClockService object cannot be NULL");if(this._service=a,!b)throw new Error("Reference to the logger object cannot be NULL");this._logger=b,this._isDestroyed=!1,this._timers={};var c=this;this._clock=window.setInterval(function(){c._onTick()},1e3*f)}b.prototype.reset=function(){this.tick=0,this._createdTimestamp=(new Date).getTime(),this._updateNextTickTimestamp()},b.prototype.shouldTick=function(){return(new Date).getTime()>this._nextTickTimestamp-g/2&&(this.tick++,this._updateNextTickTimestamp(),!0)},b.prototype._updateNextTickTimestamp=function(){var a=(new Date).getTime();this._nextTickTimestamp=a+1e3*this.interval-1},c.prototype.createTimer=function(a,c,d){this._timers[a]=new b(a,c,d)},c.prototype.destroyTimer=function(a){delete this._timers[a]},c.prototype.resumeTimer=function(a,b){b=void 0!==b&&b,this._logger.debug(d,"#resumeTimer(name="+a+", reset="+b+")");var c=this._timers[a];c&&(c.isActive=!0,b&&c.reset())},c.prototype.pauseTimer=function(a,b){b=void 0!==b&&b,this._logger.debug(d,"#pauseTimer(name="+a+", reset="+b+")");var c=this._timers[a];c&&(c.isActive=!1,b&&c.reset())},c.prototype.isTimerPaused=function(a){var b=this._timers[a];return!!b&&!b.isActive},c.prototype.destroy=function(){this._isDestroyed||(this._isDestroyed=!0,this._timers={},window.clearInterval(this._clock))},c.prototype._onTick=function(){for(var a in this._timers)if(this._timers.hasOwnProperty(a)){var b=this._timers[a];b.isActive&&b.shouldTick()&&(b.interval>1&&this._logger.debug(d,"#_onTick() > "+b.name+"("+b.tick+" | "+b.repeatCount+")"),0!=b.repeatCount?(this._service.onTick(b.name,b.interval,b.tick),b.repeatCount!=e&&b.repeatCount--):this.destroyTimer(b.name))}};var d="service.clock::TimerManager",e=-1,f=.25,g=1e3*f;a.clock.TimerDescriptor=b,a.clock.TimerManager=c}(e),function(a,b,c){"use strict";function d(a){if(d.__super__.constructor.call(this,h),!a)throw new Error("Reference to the logger object cannot be NULL");this._logger=a,this._timerManager=new e(this,this._logger),this._setupDataResolver()}var e=c.clock.TimerManager,f=b.StringUtils,g=a.plugin.BasePlugin;a.extend(d,g),d.prototype.bootstrap=function(a){d.__super__.bootstrap.call(this,a),this._pluginManager.comply(this,i,this._cmdCreate),this._pluginManager.comply(this,k,this._cmdResume),this._pluginManager.comply(this,j,this._cmdPause),this._pluginManager.comply(this,l,this._cmdDestroy)},d.prototype._teardown=function(){this._timerManager.destroy()},d.prototype._cmdCreate=function(a){var b=a[o]||s;this._timerManager.createTimer(a[m],a[n],b)},d.prototype._cmdPause=function(a){this._timerManager.pauseTimer(a[m],!!a[q])},d.prototype._cmdResume=function(a){this._timerManager.resumeTimer(a[m],!!a[q])},d.prototype._cmdDestroy=function(a){this._timerManager.destroyTimer(a[m])},d.prototype.onTick=function(a,b,c){a+=".tick";var d={};d[m]=a,d[n]=b,d[p]=c,this._trigger(a,d)},d.prototype._setupDataResolver=function(){var a={},b=this._timerManager;a[r]=function(a){return b.isTimerPaused(a)},this._dataResolver=function(b){if(!b||0==b.length)return null;for(var c=null,d=0;d0&&(c[e]=a[r].call(this,g[1]))}}return c}};var h="service.clock",i="create",j="pause",k="resume",l="destroy",m="name",n="interval",o="repeat_count",p="tick",q="reset",r="is_paused",s=-1;c.clock.ClockService=d}(d,b,e),function(a,b,c){"use strict";function d(a,b){if(this._logger=new e,this._pluginManager=new f(this._logger),this._pluginManager.addPlugin(new g(this._logger)),b)for(var c=0;c No active tracking session.");if(this._isTrackingSessionStarted)return void this._logger.info(this._logTag,"#trackSessionStart() > Tracking session already started.");this._trigger(p),this._isTrackingSessionStarted=!0;var a=this._dataResolver(["video.resumed"]);a.hasOwnProperty("video.resumed")&&a["video.resumed"]&&this._trigger(q)}},c.prototype.trackVideoLoad=function(){this._logger.info(this._logTag,"#trackVideoLoad()"),this._canProcess()&&(this._isTrackingAdBreak=!1,this._isTrackingAd=!1,this._contentStarted=!1,this._isPaused=!0,this._isBuffering=!1,this._isSeeking=!1,this._playheadTimer=null,this._previousPlayhead=-1,this._stalledPlayheadCount=0,this._playheadStalled=!1,this._videoIdle=!1,this._trigger(m),this._isTrackingSessionActive=!0,this._isTrackingSessionStarted=!1)},c.prototype.trackVideoUnload=function(){if(this._logger.info(this._logTag,"#trackVideoUnload()"),this._canProcess()){if(!this._isTrackingSessionActive)return void this._logger.warn(this._logTag,"#trackVideoUnload() > No active tracking session.");this._stopPlayheadTimer(),this._trigger(n),this._isTrackingSessionActive=!1,this._isTrackingSessionStarted=!1,this._contentStarted=!1}},c.prototype.trackPlay=function(){this._logger.info(this._logTag,"#trackPlay()"),this._canProcess()&&this._startSessionIfNeeded("trackPlay")&&this._allowPlayerStateChange()&&(this._isPaused=!1,this._trigger(u),this._startPlayheadTimer())},c.prototype.trackPause=function(){if(this._logger.info(this._logTag,"#trackPause()"),this._canProcess()&&this._startSessionIfNeeded("trackPause")&&this._allowPlayerStateChange()){this._stopPlayheadTimer();var a={};a[O]=!1,this._isPaused=!0,this._trigger(v,a)}},c.prototype.trackBufferStart=function(){this._logger.info(this._logTag,"#trackBufferStart()"),this._canProcess()&&this._startSessionIfNeeded("trackBufferStart")&&this._allowPlayerStateChange()&&(this._stopPlayheadTimer(),this._isBuffering=!0,this._trigger(C))},c.prototype.trackBufferComplete=function(){this._logger.info(this._logTag,"#trackBufferComplete()"),this._canProcess()&&this._startSessionIfNeeded("trackBufferComplete")&&this._allowPlayerStateChange()&&(this._isBuffering=!1,this._trigger(D),this._startPlayheadTimer())},c.prototype.trackSeekStart=function(){this._logger.info(this._logTag,"#trackSeekStart()"),this._canProcess()&&this._startSessionIfNeeded("trackSeekStart")&&this._allowPlayerStateChange()&&(this._stopPlayheadTimer(),this._isSeeking=!0,this._trigger(E))},c.prototype.trackSeekComplete=function(){this._logger.info(this._logTag,"#trackSeekComplete()"),this._canProcess()&&this._startSessionIfNeeded("trackSeekComplete")&&this._allowPlayerStateChange()&&(this._isSeeking=!1,this._trigger(F),this._startPlayheadTimer())},c.prototype.trackComplete=function(a,b){if(this._logger.info(this._logTag,"#trackComplete()"),this._canProcess()&&this._startSessionIfNeeded("trackComplete")){if(this._stopPlayheadTimer(),this._videoIdle)return this._logger.info(this._logTag,"#trackComplete() > Video session is already in Idle State."),void(a&&a());var c={};c[N]=a,b=void 0===b||!!b,b?this._trigger(r,c):(this._trigger(s),this._trigger(o,c))}},c.prototype.trackTimedMetadata=function(a){this._logger.info(this._logTag,"#trackComplete()"),this._canProcess()&&this._startSessionIfNeeded("trackTimedMetadata")&&this._trigger(t,a)},c.prototype.trackChapterStart=function(){this._logger.info(this._logTag,"#trackChapterStart()"),this._canProcess()&&this._startSessionIfNeeded("#trackChapterStart")&&this._trigger(G)},c.prototype.trackChapterComplete=function(){this._logger.info(this._logTag,"#trackChapterComplete()"),this._canProcess()&&this._startSessionIfNeeded("trackChapterComplete")&&this._trigger(H)},c.prototype.trackChapterSkip=function(){this._logger.info(this._logTag,"#trackChapterSkip()"),this._canProcess()&&this._startSessionIfNeeded("trackChapterSkip")&&this._trigger(I)},c.prototype.trackAdBreakStart=function(){this._logger.info(this._logTag,"#trackAdBreakStart()"),this._canProcess()&&this._startSessionIfNeeded("trackAdBreakStart")&&(this._trigger(x),this._isTrackingAdBreak=!0)},c.prototype.trackAdBreakComplete=function(){this._logger.info(this._logTag,"#trackAdBreakComplete()"),this._canProcess()&&this._startSessionIfNeeded("trackAdBreakComplete")&&(this._trigger(y),this._isTrackingAdBreak=!1)},c.prototype.trackAdStart=function(){this._logger.info(this._logTag,"#trackAdStart()"),this._canProcess()&&this._startSessionIfNeeded("trackAdStart")&&(this._trigger(z),this._isTrackingAd=!0)},c.prototype.trackAdComplete=function(){this._logger.info(this._logTag,"#trackAdComplete()"),this._canProcess()&&this._startSessionIfNeeded("trackAdComplete")&&(this._trigger(A),this._isTrackingAd=!1)},c.prototype.trackAdSkip=function(){this._logger.info(this._logTag,"#trackAdSkip()"),this._canProcess()&&this._startSessionIfNeeded("trackAdSkip")&&(this._trigger(B),this._isTrackingAd=!1)},c.prototype.trackBitrateChange=function(){this._logger.info(this._logTag,"#trackBitrateChange()"),this._canProcess()&&this._startSessionIfNeeded("trackBitrateChange")&&this._trigger(J)},c.prototype.trackVideoPlayerError=function(a){if(this._logger.info(this._logTag,"#trackVideoPlayerError(errorId="+a+")"),this._startSessionIfNeeded("trackVideoPlayerError")){var b={};b[P]=l,b[Q]=a,this._trigger(K,b)}},c.prototype.trackApplicationError=function(a){if(this._logger.info(this._logTag,"#trackApplicationError(errorId="+a+")"),this._startSessionIfNeeded("trackApplicationError")){var b={};b[P]=k,b[Q]=a,this._trigger(K,b)}},c.prototype._registerCommands=function(){this._pluginManager.comply(this,"handleVideoIdleStart",this._cmdVideoIdleStart),this._pluginManager.comply(this,"handleVideoIdleResume",this._cmdVideoIdleResume)},c.prototype._registerBehaviours=function(){this._pluginManager.registerBehaviour(new e(j,L),this,"handleVideoIdleStart"),this._pluginManager.registerBehaviour(new e(j,M),this,"handleVideoIdleResume",[new d(i,"ad.isInAdBreak","isInAdBreak"),new d(i,"ad.isInAd","isInAd"),new d(i,"chapter.isInChapter","isInChapter")])},c.prototype._setupDataResolver=function(){function a(){return g.video?g.video:(g.video=h._delegate.getVideoInfo(),h._logger.info(h._logTag,"Data from delegate > VideoInfo: "+g.video),g.video)}function b(){return g.ad?g.ad:(g.ad=h._delegate.getAdInfo(),h._logger.info(h._logTag,"Data from delegate > AdInfo: "+g.ad),g.ad)}function c(){return g.pod?g.pod:(g.pod=h._delegate.getAdBreakInfo(),h._logger.info(h._logTag,"Data from delegate > AdBreakInfo: "+g.pod),g.pod)}function d(){return g.chapter?g.chapter:(g.chapter=h._delegate.getChapterInfo(),h._logger.info(h._logTag,"Data from delegate > ChapterInfo: "+g.chapter),g.chapter)}function e(){return g.qos?g.qos:(g.qos=h._delegate.getQoSInfo(),h._logger.info(h._logTag,"Data from delegate > QoSInfo: "+g.qos),g.qos)}var f={},g={},h=this;f["video.id"]=function(){var b=a(),c=b?b.id:null;return h._logger.debug(h._logTag,"Resolving video.id: "+c),c},f["video.name"]=function(){var b=a(),c=b?b.name:null;return h._logger.debug(h._logTag,"Resolving video.name: "+c),c},f["video.length"]=function(){var b=a(),c=b?b.length:NaN;return h._logger.debug(h._logTag,"Resolving video.length: "+c),c},f["video.playerName"]=function(){var b=a(),c=b?b.playerName:null;return h._logger.debug(h._logTag,"Resolving video.playerName: "+c),c},f["video.mediaType"]=function(){var b=a(),c=b?b.mediaType:null;return h._logger.debug(h._logTag,"Resolving video.mediaType: "+c),c},f["video.streamType"]=function(){var b=a(),c=b?b.streamType:null;return h._logger.debug(h._logTag,"Resolving video.streamType: "+c),c},f["video.playhead"]=function(){var b=a(),c=b?b.playhead:NaN;return h._logger.debug(h._logTag,"Resolving video.playhead: "+c),c},f["video.resumed"]=function(){var b=a(),c=!!b&&b.resumed;return h._logger.debug(h._logTag,"Resolving video.resumed: "+c),c},f["video.playheadStalled"]=function(){return this._playheadStalled},f["pod.name"]=function(){var a=c(),b=a?a.name:null;return h._logger.debug(h._logTag,"Resolving pod.name: "+b),b},f["pod.playerName"]=function(){var a=c(),b=a?a.playerName:null;return h._logger.debug(h._logTag,"Resolving pod.playerName: "+b),b},f["pod.position"]=function(){var a=c(),b=a?a.position:NaN;return h._logger.debug(h._logTag,"Resolving pod.position: "+b),b},f["pod.startTime"]=function(){var a=c(),b=a?a.startTime:NaN;return h._logger.debug(h._logTag,"Resolving pod.startTime: "+b),b},f["ad.isInAd"]=function(){var a=b(),c=null!=a;return h._logger.debug(h._logTag,"Resolving ad.isInAd: "+c),c},f["ad.isInAdBreak"]=function(){var a=c(),b=null!=a;return h._logger.debug(h._logTag,"Resolving ad.isInAdBreak: "+b),b},f["ad.id"]=function(){var a=b(),c=a?a.id:null;return h._logger.debug(h._logTag,"Resolving ad.id: "+c),c},f["ad.name"]=function(){var a=b(),c=a?a.name:null;return h._logger.debug(h._logTag,"Resolving ad.name: "+c),c},f["ad.length"]=function(){var a=b(),c=a?a.length:NaN;return h._logger.debug(h._logTag,"Resolving ad.length: "+c),c},f["ad.position"]=function(){var a=b(),c=a?a.position:NaN;return h._logger.debug(h._logTag,"Resolving ad.position: "+c),c},f["ad.granularTracking"]=function(){var a=b(),c=!!a&&a.granularTracking;return h._logger.debug(h._logTag,"Resolving ad.granularTracking: "+c),c},f["ad.trackingInterval"]=function(){var a=S;return h._logger.debug(h._logTag,"Resolving ad.trackingInterval: "+a),a},f["chapter.isInChapter"]=function(){var a=d(),b=null!=a;return h._logger.debug(h._logTag,"Resolving chapter.isInChapter: "+b),b},f["chapter.name"]=function(){var a=d(),b=a?a.name:null;return h._logger.debug(h._logTag,"Resolving chapter.name: "+b),b},f["chapter.length"]=function(){var a=d(),b=a?a.length:NaN;return h._logger.debug(h._logTag,"Resolving chapter.length: "+b),b},f["chapter.position"]=function(){var a=d(),b=a?a.position:NaN;return h._logger.debug(h._logTag,"Resolving chapter.position: "+b),b},f["chapter.startTime"]=function(){var a=d(),b=a?a.startTime:NaN;return h._logger.debug(h._logTag,"Resolving chapter.startTime: "+b),b},f["qos.bitrate"]=function(){var a=e(),b=a?a.bitrate:NaN;return h._logger.debug(h._logTag,"Resolving qos.bitrate: "+b),b},f["qos.fps"]=function(){var a=e(),b=a?a.fps:NaN;return h._logger.debug(h._logTag,"Resolving qos.fps: "+b),b},f["qos.droppedFrames"]=function(){var a=e(),b=a?a.droppedFrames:NaN;return h._logger.debug(h._logTag,"Resolving qos.droppedFrames: "+b),b},f["qos.startupTime"]=function(){var a=e(),b=a?1e3*a.startupTime:NaN;return h._logger.debug(h._logTag,"Resolving qos.startupTime: "+b),b},this._dataResolver=function(a){if(!a||0==a.length)return null;g={};for(var b=null,c=0;c=0&&c==a._previousPlayhead&&++a._stalledPlayheadCount==T&&a._trackPlayheadStall(),c!=a._previousPlayhead&&c>0&&!a._contentStarted&&(a._isPaused||a._isBuffering||a._isSeeking||(a._logger.info(a._logTag,"#_playheadTimer playhead progress to: "+c),a._trigger(w),a._contentStarted=!0)),a._previousPlayhead=c}}},R))},c.prototype._stopPlayheadTimer=function(){this._playheadTimer&&(clearInterval(this._playheadTimer),this._playheadTimer=null),this._trackExitStall()},c.prototype._startSessionIfNeeded=function(a){return this._isTrackingSessionActive?(this._isTrackingSessionStarted||(this._logger.info(this._logTag,"#"+a+"() > Tracking session auto-start."),this.trackSessionStart()),!0):(this._logger.warn(this._logTag,"#"+a+"() > No active tracking session."),!1)},c.prototype._allowPlayerStateChange=function(){return!(this._isTrackingAdBreak&&!this._isTrackingAd)||(this._logger.info(this._logTag,"_allowPlayerStateChange Player plugin does not allow player state changes when in Adbreak and not in Ad."),!1)};var h="player",i=h,j="adobe-heartbeat",k="sourceErrorExternal",l="sourceErrorSDK",m="video_load",n="video_unload",o="video_session_end",p="video_start",q="video_resume",r="video_complete",s="video_skip",t="timed_metadata",u="play",v="pause",w="content_start",x="adbreak_start",y="adbreak_complete",z="ad_start",A="ad_complete",B="ad_skip",C="buffer_start",D="buffer_complete",E="seek_start",F="seek_complete",G="chapter_start",H="chapter_complete",I="chapter_skip",J="bitrate_change",K="track_error",L="video_idle_start",M="video_idle_resume",N="callback",O="filter_report",P="source",Q="error_id",R=1001,S=1,T=2;b.VideoPlayerPlugin=c}(a.ADB.core,b),a.ADB.va.plugins.videoplayer||(a.ADB.va.plugins.videoplayer=b)}(this);\n\n// AdobeHeartbeatPlugin\n!function(a){if(void 0===b)var b={};b.clock||(b.clock={}),b.context||(b.context={}),b.filter||(b.filter={}),b.model||(b.model={}),b.network||(b.network={}),function(a,b){"use strict";function c(a,b,c,d,e){if(!b)throw new Error("Reference to the channel object cannot be NULL");if(this._channel=b,!a)throw new Error("Reference to the pluginManager object cannot be NULL");if(this._pluginManager=a,!e)throw new Error("Reference to the logger object cannot be NULL");this._logTag="ah::Timer."+c,this._logger=e,this._isDestroyed=!1,this._createTimer(c,d),this._installHandlers()}var d=a.Event;c.KEY_NAME="name",c.KEY_INTERVAL="interval",c.KEY_RESET="reset",c.prototype.resume=function(a){this._logger.debug(this._logTag,"Starting timer: "+this._name);var b={};b[c.KEY_NAME]=e+"."+this._name,b[c.KEY_RESET]=a,this._pluginManager.command(f,i,b)},c.prototype.pause=function(a){this._logger.debug(this._logTag,"Stopping timer: "+this._name);var b={};b[c.KEY_NAME]=e+"."+this._name,b[c.KEY_RESET]=a,this._pluginManager.command(f,h,b)},c.prototype.destroy=function(){if(!this._isDestroyed){this._isDestroyed=!0,this._uninstallHandlers();var a={};a[c.KEY_NAME]=e+"."+this._name,this._pluginManager.command(f,j,a)}},c.prototype.setInterval=function(a){var b=k+"."+e+"."+this._name,c=this._pluginManager.request(f,[b])[b];this.pause(!0),this._createTimer(this._name,a),c||this.resume(!0)},c.prototype._cmdResume=function(a){var b=!1;null!=a&&a.hasOwnProperty(c.KEY_RESET)&&(b=a[c.KEY_RESET]),this.resume(b)},c.prototype._cmdPause=function(a){var b=!1;null!=a&&a.hasOwnProperty(c.KEY_RESET)&&(b=a[c.KEY_RESET]),this.pause(b)},c.prototype._onTick=function(a,b){this._channel.trigger(new d("clock:"+this._name+".tick",b))},c.prototype._installHandlers=function(){this._channel.comply("clock:"+this._name+".resume",this._cmdResume,this),this._channel.comply("clock:"+this._name+".pause",this._cmdPause,this),this._pluginManager.on(f,e+"."+this._name+".tick",this._onTick,this)},c.prototype._uninstallHandlers=function(){this._channel.off(null,null,this),this._pluginManager.off(null,null,null,this)},c.prototype._createTimer=function(a,b){this._name=a,this._interval=b;var d={};d[c.KEY_NAME]=e+"."+this._name,d[c.KEY_INTERVAL]=this._interval,this._pluginManager.command(f,g,d)};var e="heartbeat",f="service.clock",g="create",h="pause",i="resume",j="destroy",k="is_paused";b.clock.Timer=c}(a.ADB.core,b),function(a,b){"use strict";function c(a,b,d){c.__super__.constructor.call(this,a,b,f,h,d)}var d=a.Event,e=b.clock.Timer;a.extend(c,e),c.prototype._onCheckStatusComplete=function(a){var b=a.data[l];if(this._logger.debug(this._logTag,"#_onCheckStatusComplete(interval="+b+")"),b){if(b==this._interval)return void this._logger.debug(this._logTag,"#_onCheckStatusComplete() > Interval value not changed.");b>g?(this._logger.warn(this._logTag,"#_onCheckStatusComplete() > Interval value too large: "+b),this.setInterval(g)):(this._logger.debug(this._logTag,"#_onCheckStatusComplete() > Interval changed to: "+b),this.setInterval(b))}else this._logger.warn(this._logTag,"#_onCheckStatusComplete() > Invalid interval value."),this.setInterval(h)},c.prototype._getSettings=function(a){this._logger.debug(this._logTag,"#_getSettings()"),this._channel.trigger(new d(i))},c.prototype._installHandlers=function(){c.__super__._installHandlers.call(this),this._channel.on(j,this._getSettings,this),this._channel.on(k,this._onCheckStatusComplete,this),this._channel.reply(l,function(){return this._interval},this)};var f="check_status",g=600,h=180,i="clock:check_status.tick",j="clock:check_status.get_settings",k="net:check_status_complete",l="check_status_interval";b.clock.CheckStatusTimer=c}(a.ADB.core,b),function(a,b){"use strict";function c(a,b,d){c.__super__.constructor.call(this,a,b,e,f,d),this._doNotOverrideInterval=!1}var d=b.clock.Timer;a.extend(c,d),c.prototype._onCheckStatusComplete=function(a){var b=a.data[g];if(this._logger.debug(this._logTag,"#_onCheckStatusComplete(interval="+b+")"),this._doNotOverrideInterval)this._logger.debug(this._logTag,"#_onCheckStatusComplete() > Interval value not changed. (doNotOverrideInterval = true)");else if(b){if(b==this._interval)return void this._logger.debug(this._logTag,"#_onCheckStatusComplete() > Interval value not changed.");this._logger.debug(this._logTag,"#_onCheckStatusComplete() > Interval changed to: "+b),this.setInterval(b)}else this._logger.warn(this._logTag,"#_onCheckStatusComplete() > Invalid interval value."),this.setInterval(f)},c.prototype._onUpdateReportingInterval=function(a){var b=a.data[g];if(this._doNotOverrideInterval=!!a.data[h],this._logger.debug(this._logTag,"#_onUpdateReportingInterval(interval="+b+", doNotOverrideInterval="+this._doNotOverrideInterval+")"),b){if(b==this._interval)return void this._logger.debug(this._logTag,"#_onUpdateReportingInterval() > Interval value not changed.");this._logger.debug(this._logTag,"#_onUpdateReportingInterval() > Interval changed to: "+b),this.setInterval(b)}else this._logger.warn(this._logTag,"#_onUpdateReportingInterval() > Invalid interval value."),this.setInterval(f)},c.prototype._installHandlers=function(){c.__super__._installHandlers.call(this),this._channel.on(j,this._onCheckStatusComplete,this),this._channel.on(i,this._onUpdateReportingInterval,this),this._channel.reply(g,function(){return this._interval},this)};var e="reporting",f=10,g="reporting_interval",h="do_not_override_interval",i="reporting:update_interval",j="net:check_status_complete";b.clock.ReportingTimer=c}(a.ADB.core,b),function(a,b){"use strict";function c(a,b,d){c.__super__.constructor.call(this,a,b,e,f,d)}var d=b.clock.Timer;a.extend(c,d);var e="idle",f=1800;b.clock.IdleTimer=c}(a.ADB.core,b),function(a,b){"use strict";function c(a,b,d){c.__super__.constructor.call(this,a,b,e,f,d)}var d=b.clock.Timer;a.extend(c,d);var e="flush_filter",f=.25;b.clock.FlushFilterTimer=c}(a.ADB.core,b),function(a,b){"use strict";function c(a,b,c){if(!a)throw new Error("Reference to the pluginManager object cannot be NULL");if(!b)throw new Error("Reference to the channel object cannot be NULL");if(!c)throw new Error("Reference to the logger object cannot be NULL");this._isDestroyed=!1,this._reportingTimer=new f(a,b,c),this._checkStatusTimer=new d(a,b,c),this._flushFilterTimer=new e(a,b,c),this._idleTimer=new g(a,b,c)}var d=b.clock.CheckStatusTimer,e=b.clock.FlushFilterTimer,f=b.clock.ReportingTimer,g=b.clock.IdleTimer;c.prototype.destroy=function(){this._isDestroyed||(this._isDestroyed=!0,this._reportingTimer.destroy(),this._checkStatusTimer.destroy(),this._flushFilterTimer.destroy(),this._idleTimer.destroy())},b.clock.Clock=c}(a.ADB.core,b),function(a,b){"use strict";function c(a,b){this.value=a,this.hint=b}function d(a){this.realm=a,this.data={}}c.HINT_SHORT="short",d.prototype.setField=function(a,b,d){this.data[a]=new c(b,d)},d.prototype._createAccessor=function(a,b,c){var d=this;return function(){return arguments.length&&(d[a]=arguments[0],d.setField(b,arguments[0],c)),d[a]}},b.model.Dao=d,b.model.DaoField=c}(a.ADB.core,b),function(a,b){"use strict";function c(){if(c.__super__.constructor.call(this,"asset"),this.adId=this._createAccessor("_adId","ad_id",null),this.sid=this._createAccessor("_sid","ad_sid",null),this.resolver=this._createAccessor("_resolver","resolver",null),this.podId=this._createAccessor("_podId","pod_id",null),this.podPosition=this._createAccessor("_podPosition","pod_position",null),this.podOffset=this._createAccessor("_podOffset","pod_offset",null),this.podName=this._createAccessor("_podName","pod_name",null),this.adLength=this._createAccessor("_adLength","ad_length",null),this.adName=this._createAccessor("_adName","ad_name",null),arguments.length&&arguments[0]instanceof c){var a=arguments[0];this.adId(a.adId()),this.sid(a.sid()),this.resolver(a.resolver()),this.podId(a.podId()),this.podPosition(a.podPosition()),this.podOffset(a.podOffset()),this.podName(a.podName()),this.adLength(a.adLength()),this.adName(a.adName())}else this.adId(""),this.sid(""),this.resolver(""),this.podId(""),this.podPosition(""),this.podOffset(0),this.podName(""),this.adLength(0),this.adName("")}var d=b.model.Dao;a.extend(c,d),b.model.AdDao=c}(a.ADB.core,b),function(a,b){"use strict";function c(){if(c.__super__.constructor.call(this,"sc"),this.reportSuiteId=this._createAccessor("_reportSuiteId","rsid",null),this.trackingServer=this._createAccessor("_trackingServer","tracking_server",null),this.ssl=this._createAccessor("_ssl","ssl",e.HINT_SHORT),arguments.length&&arguments[0]instanceof c){var a=arguments[0];this.reportSuiteId(a.reportSuiteId()),this.trackingServer(a.trackingServer()),this.ssl(a.ssl())}else this.reportSuiteId(""),this.trackingServer(""),this.ssl(0)}var d=b.model.Dao,e=b.model.DaoField;a.extend(c,d),b.model.AdobeAnalyticsDao=c}(a.ADB.core,b),function(a,b){"use strict";function c(){if(c.__super__.constructor.call(this,"stream"),this.id=this._createAccessor("_id","chapter_id",null),this.sid=this._createAccessor("_sid","chapter_sid",null),this.name=this._createAccessor("_name","chapter_name",null),this.position=this._createAccessor("_position","chapter_pos",null),this.length=this._createAccessor("_length","chapter_length",null),this.offset=this._createAccessor("_offset","chapter_offset",null),arguments.length&&arguments[0]instanceof c){var a=arguments[0];this.id(a.id()),this.sid(a.sid()),this.name(a.name()),this.position(a.position()),this.length(a.length()),this.offset(a.offset())}else this.id(""),this.sid(""),this.name(""),this.position(0),this.length(0),this.offset(0)}var d=b.model.Dao;a.extend(c,d),b.model.ChapterDao=c}(a.ADB.core,b),function(a,b){"use strict";function c(){if(c.__super__.constructor.call(this,"asset"),this.type=this._createAccessor("_type","type",null),this.videoId=this._createAccessor("_videoId","video_id",null),this.publisher=this._createAccessor("_publisher","publisher",null),this.adData=this._createAccessor("_adData","ad_data",null),this.chapterData=this._createAccessor("_chapterData","chapter_data",null),this.length=this._createAccessor("_length","length",null),this.name=this._createAccessor("_name","name",null),arguments.length&&arguments[0]instanceof c){var a=arguments[0];this.type(a.type()),this.name(a.name()),this.videoId(a.videoId()),this.publisher(a.publisher()),this.length(a.length());var b=a.adData()?new e(a.adData()):null;this.adData(b);var d=a.chapterData()?new f(a.chapterData()):null;this.chapterData(d)}else this.type(""),this.name(""),this.videoId(""),this.publisher(""),this.length(0),this.adData(null),this.chapterData(null)}var d=b.model.Dao,e=b.model.AdDao,f=b.model.ChapterDao;a.extend(c,d),c.TYPE_AD="ad",c.TYPE_MAIN_CONTENT="main",b.model.AssetDao=c}(a.ADB.core,b),function(a,b){"use strict";function c(){if(c.__super__.constructor.call(this,"event"),this.type=this._createAccessor("_type","type",null),this.duration=this._createAccessor("_duration","duration",null),this.playhead=this._createAccessor("_playhead","playhead",null),this.id=this._createAccessor("_id","id",null),this.source=this._createAccessor("_source","source",null),this.ts=this._createAccessor("_ts","ts",null),this.prevTs=this._createAccessor("_prevTs","prev_ts",null),arguments.length&&arguments[0]instanceof c){var a=arguments[0];this.type(a.type()),this.duration(a.duration()),this.playhead(a.playhead()),this.id(a.id()),this.source(a.source()),this.ts(a.ts()),this.prevTs(a.prevTs())}else this.type(""),this.duration(0),this.playhead(0),this.id(""),this.source(""),this.ts(0),this.prevTs(-1)}var d=b.model.Dao;a.extend(c,d),c.EVENT_TYPE_AA_START="aa_start",c.EVENT_TYPE_AA_AD_START="aa_ad_start",c.EVENT_TYPE_START="start",c.EVENT_TYPE_RESUME="resume",c.EVENT_TYPE_CHAPTER_START="chapter_start",c.EVENT_TYPE_CHAPTER_COMPLETE="chapter_complete",c.EVENT_TYPE_CHAPTER_SKIP="chapter_skip",c.EVENT_TYPE_PLAY="play",c.EVENT_TYPE_PAUSE="pause",c.EVENT_TYPE_STALL="stall",c.EVENT_TYPE_BUFFER="buffer",c.EVENT_TYPE_BITRATE_CHANGE="bitrate_change",c.EVENT_TYPE_ERROR="error",c.EVENT_TYPE_COMPLETE="complete",c.EVENT_TYPE_SKIP="skip",c.EVENT_TYPE_END="end",b.model.EventDao=c}(a.ADB.core,b),function(a,b){"use strict";function c(){if(c.__super__.constructor.call(this,"stream"),this.bitrate=this._createAccessor("_bitrate","bitrate",null),this.fps=this._createAccessor("_fps","fps",null),this.droppedFrames=this._createAccessor("_droppedFrames","dropped_frames",null),this.startupTime=this._createAccessor("_startup_time","startup_time",null),arguments.length&&arguments[0]instanceof c){var a=arguments[0];this.bitrate(a.bitrate()),this.fps(a.fps()),this.droppedFrames(a.droppedFrames()),this.startupTime(a.startupTime()),this.isStartupTimeOverridden=a.isStartupTimeOverridden}else this.bitrate(0),this.fps(0),this.droppedFrames(0),this.startupTime(0),this.isStartupTimeOverridden=!1}var d=b.model.Dao;a.extend(c,d),b.model.QoSDao=c}(a.ADB.core,b),function(a,b){"use strict";function c(){if(c.__super__.constructor.call(this,"sp"),this.ovp=this._createAccessor("_ovp","ovp",null),this.sdk=this._createAccessor("_sdk","sdk",null),this.channel=this._createAccessor("_channel","channel",null),this.playerName=this._createAccessor("_playerName","player_name",null),this.libVersion=this._createAccessor("_libVersion","hb_version",null),this.apiLevel=this._createAccessor("_apiLevel","hb_api_lvl",null),arguments.length&&arguments[0]instanceof c){var a=arguments[0];this.ovp(a.ovp()),this.sdk(a.sdk()),this.channel(a.channel()),this.playerName(a.playerName()),this.libVersion(a.libVersion()),this.apiLevel(a.apiLevel())}else this.ovp(e),this.sdk(e),this.channel(e),this.playerName(""),this.libVersion(""),this.apiLevel(0)}var d=b.model.Dao;a.extend(c,d);var e="unknown";b.model.ServiceProviderDao=c}(a.ADB.core,b),function(a,b){"use strict";function c(){if(c.__super__.constructor.call(this,"event"),this.sessionId=this._createAccessor("_sessionId","sid",null),arguments.length&&arguments[0]instanceof c){var a=arguments[0];this.sessionId(a.sessionId())}else this.sessionId(null)}var d=b.model.Dao;a.extend(c,d),b.model.SessionDao=c}(a.ADB.core,b),function(a,b){"use strict";function c(){if(c.__super__.constructor.call(this,"stream"),this.type=this._createAccessor("_type","type",null),arguments.length&&arguments[0]instanceof c){var a=arguments[0];this.type(a.type())}else this.type(null)}var d=b.model.Dao;a.extend(c,d),b.model.StreamDao=c}(a.ADB.core,b),function(a,b){"use strict";function c(){if(c.__super__.constructor.call(this,"user"),this.analyticsVisitorId=this._createAccessor("_analyticsVisitorId","aid",null),this.marketingCloudVisitorId=this._createAccessor("_marketingCloudVisitorId","mid",null),this.visitorId=this._createAccessor("_visitorId","id",null),arguments.length&&arguments[0]instanceof c){var a=arguments[0];this.analyticsVisitorId(a.analyticsVisitorId()),this.marketingCloudVisitorId(a.marketingCloudVisitorId()),this.visitorId(a.visitorId())}else this.analyticsVisitorId(null),this.marketingCloudVisitorId(null),this.visitorId(null)}var d=b.model.Dao;a.extend(c,d),b.model.UserDao=c}(a.ADB.core,b),function(a,b){"use strict";function c(){if(c.__super__.constructor.call(this,"aam"),this.audienceManagerBlob=this._createAccessor("_audienceManagerBlob","blob",null),this.audienceManagerLocationHint=this._createAccessor("_audienceManagerLocationHint","loc_hint",null),arguments.length&&arguments[0]instanceof c){var a=arguments[0];this.audienceManagerBlob(a.audienceManagerBlob()),this.audienceManagerLocationHint(a.audienceManagerLocationHint())}else this.audienceManagerBlob(null),this.audienceManagerLocationHint(null)}var d=b.model.Dao;a.extend(c,d),b.model.AudienceManagerDao=c}(a.ADB.core,b),function(a,b){"use strict";function c(a,b,c,i,j){this.eventData=new e,this.eventData.type(b),this.eventData.duration(0),this.eventData.ts((new Date).getTime()),this.eventData.playhead(c),this.assetData=new f(a._assetData),this.streamData=new g(a._streamData),this.qosData=new h(a._qosData),this.cuserData=d.clone(a._cuserData),this.meta=i,this.callback=j,this.filterReport=!0}var d=a.ObjectUtils,e=b.model.EventDao,f=b.model.AssetDao,g=b.model.StreamDao,h=b.model.QoSDao;b.model.TrackItem=c}(a.ADB.va.utils,b),function(a,b){"use strict";function c(a,b,c,i,j,k){this.adobeAnalyticsData=a,this.userData=b,this.aamData=c,this.serviceProviderData=i,this.sessionData=j,this.eventData=new e(k.eventData),this.assetData=new f(k.assetData),this.streamData=new g(k.streamData),this.qosData=new h(k.qosData),this.cuserData=d.clone(k.cuserData),this.meta=d.clone(k.meta),this.callback=k.callback,this.filterReport=k.filterReport}var d=a.ObjectUtils,e=b.model.EventDao,f=b.model.AssetDao,g=b.model.StreamDao,h=b.model.QoSDao;b.model.CUserDao;b.model.Report=c}(a.ADB.va.utils,b),function(a){"use strict";function b(){}b.prototype.serializeReport=function(a){},b.prototype.serializeDao=function(a){},b.prototype.serializeMap=function(a){},b.prototype.serializeNumber=function(a,b,c,d){},b.prototype.serializeString=function(a,b,c,d){},a.model.ISerializer=b}(b),function(a,b){"use strict";function c(a){if(!a)throw new Error("Reference to the logger object cannot be NULL");this._logger=a}var d=b.model.Dao,e=b.model.DaoField,f=b.model.ISerializer;a.extend(c,f),c.prototype.serializeReport=function(a){var b=[];return b.push(this.serializeDao(a.adobeAnalyticsData)),b.push(this.serializeDao(a.userData)),b.push(this.serializeDao(a.aamData)),b.push(this.serializeMap(a.cuserData,"cuser")),b.push(this.serializeDao(a.serviceProviderData)),b.push(this.serializeDao(a.sessionData)),b.push(this.serializeDao(a.eventData)),b.push(this.serializeDao(a.assetData)),b.push(this.serializeDao(a.streamData)),b.push(this.serializeDao(a.qosData)),b.push(this.serializeMap(a.meta,"meta")),{serializedOutput:b.filter(function(a){return!!a}).join("&"),callback:a.callback}},c.prototype.serializeDao=function(a){return this._processDao(a).filter(function(a){return!!a}).join("&")},c.prototype.serializeMap=function(a,b){var c=[],d=b||"meta";for(var e in a)a.hasOwnProperty(e)&&a[e]&&c.push("s:"+d+":"+e+"="+window.encodeURIComponent(a[e]));return c.join("&")},c.prototype.serializeNumber=function(a,b,c,d){var f=h;return null==b||isNaN(b)?null:(d===e.HINT_SHORT&&(f=i),f+":"+c+":"+a+"="+Math.floor(b))},c.prototype.serializeString=function(a,b,c,d){return b?j+":"+c+":"+a+"="+window.encodeURIComponent(b):null},c.prototype._processDao=function(a){var b=[];for(var c in a.data)if(a.data.hasOwnProperty(c)){var e=a.data[c],f=e.value,h=e.hint,i=null,j=a.realm;if(null==f)continue;"number"==typeof f?i=this.serializeNumber(c,f,j,h):"string"==typeof f?i=this.serializeString(c,f,j,h):f instanceof d?i=this.serializeDao(f):this._logger.warn(g,"#_processDao() > Unable to serialize DAO. Field: "+c+". Value: "+f+"."),i&&b.push(i)}return b};var g="ah::QuerystringSerializer",h="l",i="h",j="s";b.model.QuerystringSerializer=c}(a.ADB.core,b),function(a,b){"use strict";function c(a,b){if(!a)throw new Error("Reference to the data object cannot be NULL");if(this._data=a,!b)throw new Error("Reference to the logger object cannot be NULL");this._logger=b}c.prototype.parse=function(){var a,b,c,j,k,l;if(window.DOMParser){l=(new window.DOMParser).parseFromString(this._data,"text/xml")}else l=new window.ActiveXObject("Microsoft.XMLDOM"),l.async=!1,l.loadXML(this._data);var m;m=parseInt(l.getElementsByTagName("trackingInterval")[0].childNodes[0].nodeValue,10),m&&(a=m),m=parseInt(l.getElementsByTagName("setupCheckInterval")[0].childNodes[0].nodeValue,10),m&&(b=m),m=parseInt(l.getElementsByTagName("trackExternalErrors")[0].childNodes[0].nodeValue,10),m&&(c=1==m),l.getElementsByTagName("trackingDisabled")[0]&&(m=parseInt(l.getElementsByTagName("trackingDisabled")[0].childNodes[0].nodeValue,10),j=1==m),l.getElementsByTagName("nielsenEnabled")[0]?(m=parseInt(l.getElementsByTagName("nielsenEnabled")[0].childNodes[0].nodeValue,10),k=1==m):k=!0;var n={};return n[e]=a,n[f]=b,n[g]=c,n[i]=j,n[h]=k,this._logger.debug(d,"#parse() > Obtained configuration settings."),n};var d="ah::SettingsParser",e="reporting_interval",f="check_status_interval",g="track_external_errors",h="nielsen_enabled",i="tracking_disabled";b.network.SettingsParser=c}(a.ADB.core,b),function(a,b){"use strict";function c(a,b){if(this._trackingServer=null,this._checkStatusServer=null,this._publisher=null,this._isConfigured=!1,this._isDestroyed=!1,this._quietMode=!1,this._visitorOptedOut=!1,this._prevReportSent=null,!a)throw new Error("Reference to the channel object cannot be NULL");if(this._channel=a,!b)throw new Error("Reference to the logger object cannot be NULL");this._logger=b,this._serializer=new i(b),this._installEventListeners()}var d=a.Event,e=a.URLRequestMethod,f=a.URLRequest,g=a.URLLoader,h=b.network.SettingsParser,i=b.model.QuerystringSerializer;c.prototype.destroy=function(){this._isDestroyed||(this._isDestroyed=!0,this._logger.debug(j,"#destroy()"),this._uninstallEventListeners())},c.prototype._onApiConfig=function(a){var b=a.data;this._logger.debug(j,"#_onApiConfig(sb_server="+b[k]+", check_status_server="+b[l]+", publisher="+b[m]+", quiet_mode="+b[n]+", ssl="+b[o]+")"),this._trackingServer=this._updateRequestProtocol(b[k],b[o]),this._checkStatusServer=this._updateRequestProtocol(b[l],b[o]),this._publisher=b[m],this._quietMode=b[n],this._isConfigured=!0},c.prototype._onUpdateVisitorOptOut=function(a){var b=a.data;this._logger.debug(j,"#_onUpdateVisitorOptOut(visitor_opt_out="+b[q]+")"),this._visitorOptedOut=b[q]},c.prototype._onFilterReportAvailable=function(a){var b=a.data;if(!this._isConfigured)return void this._logger.warn(j,"#_onFilterReportAvailable() > Unable to send request: not configured.");var c=b[p],h=this._serializer.serializeReport(c),i=this._trackingServer+"/?"+h.serializedOutput;if(this._prevReportSent&&this._prevReportSent.eventData&&c.eventData&&this._prevReportSent.eventData.playhead==c.eventData.playhead&&this._prevReportSent.eventData.ts==c.eventData.ts&&this._prevReportSent.eventData.prevTs==c.eventData.prevTs&&this._prevReportSent.eventData.type==c.eventData.type)return void this._logger.debug(j,"#_onFilterReportAvailable() > Duplicate heartbeat report not sent for URL:\\n"+i);this._prevReportSent=c;var k=new f(i,e.GET);this._logger.debug(j,"#_onFilterReportAvailable() > "+k.url);var l=this,m=function(a){o.close(),h.callback&&h.callback.call(null)},n=function(a){o.close(),l._logger.warn(j,"#_onFilterReportAvailable() > Failed to send heartbeat report."),h.callback&&h.callback.call(null)};if(!this._quietMode&&!this._visitorOptedOut){var o=new g;o.addEventListener(d.SUCCESS,m,this),o.addEventListener(d.ERROR,n,this),o.load(k)}},c.prototype._onClockCheckStatusTick=function(a){function b(a){if(a.data){var b=new h(a.data.response,i._logger),c=b.parse();c?i._channel.trigger(new d(v,c)):i._logger.warn(j,"#_onClockCheckStatusTick() > Failed to parse the config. settings.")}n.close()}function c(a){i._logger.warn(j,"#_onClockCheckStatusTick() > Failed to obtain the config. settings."),n.close()}if(!this._isConfigured)return void this._logger.warn(j,"#_onClockCheckStatusTick() > Unable to send request: not configured.");if(!this._publisher)return void this._logger.warn(j,"#_onClockCheckStatusTick() > Publisher is NULL.");var i=this,k=this._publisher.replace(/[^a-zA-Z0-9]+/,"-").toLocaleLowerCase(),l=this._checkStatusServer+k+".xml?r="+(new Date).getTime(),m=new f(l,e.GET),n=new g;n.addEventListener(d.SUCCESS,b,this),n.addEventListener(d.ERROR,c,this),this._logger.debug(j,"#_onClockCheckStatusTick() > Get new settings from: "+l),n.load(m)},c.prototype._updateRequestProtocol=function(a,b){var c=a;return 0===c.indexOf("http://")?c=c.slice(7):0===c.indexOf("https://")&&(c=c.slice(8)),b?"https://"+c:"http://"+c},c.prototype._installEventListeners=function(){this._channel.on(r,this._onApiConfig,this),this._channel.on(s,this._onUpdateVisitorOptOut,this),this._channel.on(t,this._onFilterReportAvailable,this),this._channel.on(u,this._onClockCheckStatusTick,this)},c.prototype._uninstallEventListeners=function(){this._channel.off(null,null,this)};var j="ah::Network",k="tracking_server",l="check_status_server",m="publisher",n="quiet_mode",o="ssl",p="report",q="visitor_opt_out",r="api:config",s="api:update_visitor_optout",t="filter:data_available",u="clock:check_status.tick",v="net:check_status_complete";b.network.Network=c}(a.ADB.core,b),function(a,b){"use strict";function c(a,b){if(!a)throw new Error("Reference to the channel object cannot be NULL");if(this._channel=a,!b)throw new Error("Reference to the logger object cannot be NULL");this._logger=b,this._isDestroyed=!1,this._isBufferingInProgress=!1,this._reportBuffer={},this._tsHistory={},this._workQueue=new i,this._installEventListeners()}function d(a){var b=[];return a&&a.forEach(function(a){a.eventData.type()==k.EVENT_TYPE_PAUSE||a.eventData.type()==k.EVENT_TYPE_STALL||a.eventData.type()==k.EVENT_TYPE_BUFFER?(!a.filterReport||a.eventData.duration()>u)&&b.push(a):b.push(a)}),b}function e(a){var b=-1,c=-1,d=[];return a.forEach(function(a){a.eventData.type()==k.EVENT_TYPE_START?a.assetData.type()==l.TYPE_MAIN_CONTENT?-1==b?b=d.push(a)-1:(a.eventData.prevTs(-1),d[b]=a):-1==c?c=d.push(a)-1:(a.eventData.prevTs(-1),d[c]=a):d.push(a)}),d}function f(a){var b=[];return a.forEach(function(c){if(c.eventData.type()==k.EVENT_TYPE_PLAY){if(c.eventData.duration()>t)b.push(c);else if(0==c.eventData.duration()&&c.assetData.type()==l.TYPE_MAIN_CONTENT){var d=g(a);d.indexOf(c)==d.length-1&&b.push(c)}}else b.push(c)}),b}function g(a){var b=[];return a.forEach(function(a){a.eventData.type()!=k.EVENT_TYPE_PLAY&&a.eventData.type()!=k.EVENT_TYPE_BUFFER&&a.eventData.type()!=k.EVENT_TYPE_START||b.push(a)}),b}var h=a.radio.Command,i=a.radio.CommandQueue,j=a.Event,k=b.model.EventDao,l=b.model.AssetDao;c.prototype.destroy=function(){this._isDestroyed||(this._isDestroyed=!0,this._logger.debug(w,"#destroy()"),this._uninstallEventListeners(),this.clear())},c.prototype.clear=function(){this._logger.debug(w,"#clear()"),this._workQueue.cancelAllCommands(),this._reportBuffer={},this._tsHistory={},this._isBufferingInProgress=!1},c.prototype.flush=function(){this._workQueue.addCommand(new h(this._flushBufferReport,this))},c.prototype._bufferReport=function(a){if(!this._isDestroyed){var b=a[q];if(b){var c=b.sessionData.sessionId();this._reportBuffer[c]=this._reportBuffer[c]||[],this._reportBuffer[c].push(b)}if(!this._isBufferingInProgress){this._isBufferingInProgress=!0;var d={};d[p]=!0,d[r]=1,this._channel.command(s,d)}}},c.prototype._flushBufferReport=function(){function a(a){if(a)for(var c=0;c No active tracking session.");this._isTrackingSessionActive=!1},e.prototype._onApiVideoStart=function(a){var b=a.data;if(this._logger.debug(w,"#_onApiVideoStart(id="+b.videoId+", name="+b.videoName+", length="+b.videoLength+", type="+b.streamType+", playerName="+b.playerName+")"),this._checkCall("_onApiVideoStart")&&this._inputDataValidator.validateFields(b,["videoId","streamType","videoLength","playhead","playerName"])){this._lastInBandItem=null,this._stashedLastInBandItem=null,this._adobeAnalyticsData.reportSuiteId(b.rsid),this._adobeAnalyticsData.trackingServer(b.trackingServer),this._adobeAnalyticsData.ssl(Number(b.useSsl)),this._serviceProviderData.ovp(b.ovp),this._serviceProviderData.sdk(b.sdk),this._serviceProviderData.channel(b.channel),this._serviceProviderData.libVersion(b.version),this._serviceProviderData.apiLevel(b.apiLvl),this._serviceProviderData.playerName(b.playerName),this._assetData.adData(null),this._assetData.chapterData(null),this._assetData.videoId(b.videoId),this._assetData.length(b.videoLength),this._assetData.type(o.TYPE_MAIN_CONTENT),this._assetData.publisher(b.publisher),this._assetData.name(b.videoName),this._streamData.type(b.streamType),this._updateQoSInfo(b);var c=b.metaNielsen?g.merge(b.metaVideo,b.metaNielsen):b.metaVideo,d=new t(this,n.EVENT_TYPE_START,b.playhead,c,b._eventData[E]);this._sendHit(d)}},e.prototype._onApiVideoResume=function(a){var b=a.data;if(this._logger.debug(w,"#_onApiVideoResume(id="+b.videoId+", name="+b.videoName+", length="+b.videoLength+", type="+b.streamType+", playerName="+b.playerName+")"),this._checkCall("_onApiVideoResume")&&this._inputDataValidator.validateFields(b,["videoId","streamType","videoLength","playhead","playerName"])){this._assetData.videoId(b.videoId),this._assetData.length(b.videoLength),this._assetData.type(o.TYPE_MAIN_CONTENT),this._assetData.name(b.videoName),this._streamData.type(b.streamType);var c=new t(this,n.EVENT_TYPE_RESUME,b.playhead,null,b._eventData[E]);this._sendHit(c)}},e.prototype._onApiVideoSessionEnd=function(a){this._logger.debug(w,"#_onApiVideoSessionEnd()");var b=a.data;if(this._checkCall("_onApiVideoSessionEnd")&&this._inputDataValidator.validateFields(b,["playhead"])){var c=new t(this,n.EVENT_TYPE_END,b.playhead,null,b._eventData[E]);c.assetData.adData(null),c.assetData.type(o.TYPE_MAIN_CONTENT),this._sendHit(c)}},e.prototype._onApiVideoComplete=function(a){this._logger.debug(w,"#_onApiVideoComplete()");var b=a.data;if(this._checkCall("_onApiVideoComplete")){var c=new t(this,n.EVENT_TYPE_COMPLETE,this._assetData.length(),null,b._eventData[E]);this._sendHit(c),this._isVideoComplete=!0}},e.prototype._onApiVideoSkip=function(a){this._logger.debug(w,"#_onApiVideoSkip()");var b=a.data;if(this._checkCall("_onApiVideoSkip")){var c=new t(this,n.EVENT_TYPE_SKIP,b.playhead,null,b._eventData[E]);this._sendHit(c),this._isVideoComplete=!0}},e.prototype._onApiPlay=function(a){this._logger.debug(w,"#_onApiPlay()");var b=a.data;if(this._checkCall("_onApiPlay")&&this._inputDataValidator.validateFields(b,["playhead"])){this._updateQoSInfo(b);var c=new t(this,n.EVENT_TYPE_PLAY,b.playhead,null,b._eventData[E]);this._sendHit(c)}},e.prototype._onApiPause=function(a){this._logger.debug(w,"#_onApiPause()");var b=a.data;if(this._checkCall("_onApiPause")&&this._inputDataValidator.validateFields(b,["playhead"])){this._updateQoSInfo(b);var c=b.playheadStalled?n.EVENT_TYPE_STALL:n.EVENT_TYPE_PAUSE,d=new t(this,c,b.playhead,null,b._eventData[E]);b._eventData.hasOwnProperty(F)&&(d.filterReport=b._eventData[F]),this._sendHit(d)}},e.prototype._onApiBufferStart=function(a){this._logger.debug(w,"#_onApiBufferStart()");var b=a.data;if(this._checkCall("_onApiBufferStart")&&this._inputDataValidator.validateFields(b,["playhead"])){this._updateQoSInfo(b);var c=new t(this,n.EVENT_TYPE_BUFFER,b.playhead,null,b._eventData[E]);this._sendHit(c)}},e.prototype._onApiAdBreakStart=function(a){this._logger.debug(w,"#_onApiAdBreakStart()");var b=a.data;this._checkCall("_onApiAdBreakStart")&&this._inputDataValidator.validateFields(b,["playhead"])&&(this._flushLastInbandItem(b),this._updateLastInbandItemToBuffering())},e.prototype._onApiAdBreakComplete=function(a){this._logger.debug(w,"#_onApiAdBreakComplete()");var b=a.data;this._checkCall("_onApiAdBreakComplete")&&this._inputDataValidator.validateFields(b,["playhead"])&&(this._flushLastInbandItem(b),this._restoreLastInbandItem())},e.prototype._onApiAdStart=function(a){var b=a.data;if(this._logger.debug(w,"#_onApiAdStart(id="+b.adId+", player_name="+b.podPlayerName+", parent_name="+this._assetData.videoId()+", pod_pos="+b.adPosition+")"),this._checkCall("_onApiAdStart")&&this._inputDataValidator.validateFields(b,["playhead","podPosition","podPlayerName","adId","adPosition"])){var c=new r;c.adId(b.adId),c.adName(b.adName),c.adLength(b.adLength),c.resolver(b.podPlayerName),c.podId(f(this._assetData.videoId())+"_"+b.podPosition),c.podPosition(b.adPosition+""),c.podName(b.podName),c.podOffset(b.podSecond),c.sid(this._generateSessionId()),this._assetData.adData(c),this._assetData.type(o.TYPE_AD),this._updateQoSInfo(b);var d=g.merge(b.metaVideo,b.metaAd);d=b.metaNielsen?g.merge(d,b.metaNielsen):d,d=b.metaAdNielsen?g.merge(d,b.metaAdNielsen):d;var e=new t(this,n.EVENT_TYPE_START,b.playhead,d,b._eventData[E]);this._sendHit(e),this._restoreLastInbandItem();if(!!b.adGranularTracking){var h=b.adTrackingInterval?b.adTrackingInterval:this._reportingInterval;this._updateReportingInterval(h,!0)}}},e.prototype._onApiAdComplete=function(a){this._logger.debug(w,"#_onApiAdComplete()");var b=a.data;if(this._checkCall("_onApiAdComplete")&&this._inputDataValidator.validateFields(b,["playhead"])){if(this._assetData.type()!=o.TYPE_AD)return void this._logger.warn(w,"#_onApiAdComplete() > Ignoring the ad complete event, because we are no longer in an ad.");this._updateQoSInfo(b);var c=new t(this,n.EVENT_TYPE_COMPLETE,b.playhead,null,b._eventData[E]);this._sendHit(c),this._updateLastInbandItemToBuffering(),this._assetData.adData(null),this._assetData.type(o.TYPE_MAIN_CONTENT),this._updateReportingInterval(this._reportingInterval,!1)}},e.prototype._onApiAdSkip=function(a){this._logger.debug(w,"#_onApiAdSkip()");var b=a.data;if(this._checkCall("_onApiAdSkip")&&this._inputDataValidator.validateFields(b,["playhead"])){if(this._assetData.type()!=o.TYPE_AD)return void this._logger.warn(w,"#_onApiAdSkip() > Ignoring the ad skip event, because we are no longer in an ad.");this._updateQoSInfo(b);var c=new t(this,n.EVENT_TYPE_SKIP,b.playhead,null,b._eventData[E]);this._sendHit(c),this._updateLastInbandItemToBuffering(),this._assetData.adData(null),this._assetData.type(o.TYPE_MAIN_CONTENT),this._updateReportingInterval(this._reportingInterval,!1)}},e.prototype._onApiChapterStart=function(a){var b=a.data;if(this._logger.debug(w,"#_onApiChapterStart(name="+b.chapterName+", length="+b.chapterLength+", position="+b.chapterPosition+", chapter_offset="+b.chapterOffset+")"),this._checkCall("_onApiChapterStart")&&this._inputDataValidator.validateFields(b,["playhead","chapterPosition","chapterOffset","chapterLength"])){var c=new s;c.id(f(this._assetData.videoId())+"_"+b.chapterPosition),c.name(b.chapterName),c.length(b.chapterLength),c.position(b.chapterPosition),c.offset(b.chapterOffset),c.sid(this._generateSessionId()),this._assetData.chapterData(c),this._updateQoSInfo(b);var d=g.merge(b.metaVideo,b.metaChapter),e=new t(this,n.EVENT_TYPE_CHAPTER_START,b.playhead,d,b._eventData[E]);e.assetData.adData(null),e.assetData.type(o.TYPE_MAIN_CONTENT),this._sendHit(e)}},e.prototype._onApiChapterComplete=function(a){this._logger.debug(w,"#_onApiChapterComplete()");var b=a.data;if(this._checkCall("_onApiChapterComplete")&&this._inputDataValidator.validateFields(b,["playhead"])){if(!this._assetData.chapterData())return void this._logger.warn(w,"#_onApiChapterComplete() > Ignoring the chapter complete event, because we are no longer in a chapter.");this._updateQoSInfo(b);var c=new t(this,n.EVENT_TYPE_CHAPTER_COMPLETE,b.playhead,null,b._eventData[E]);c.assetData.adData(null),c.assetData.type(o.TYPE_MAIN_CONTENT),this._sendHit(c),this._assetData.chapterData(null)}},e.prototype._onApiChapterSkip=function(a){this._logger.debug(w,"#_onApiChapterSkip()");var b=a.data;if(this._checkCall("_onApiChapterSkip")&&this._inputDataValidator.validateFields(b,["playhead"])){if(!this._assetData.chapterData())return void this._logger.warn(w,"#_onApiChapterSkip() > Ignoring the chapter skip event, because we are no longer in a chapter.");this._updateQoSInfo(b);var c=new t(this,n.EVENT_TYPE_CHAPTER_SKIP,b.playhead,null,b._eventData[E]);c.assetData.adData(null),c.assetData.type(o.TYPE_MAIN_CONTENT),this._sendHit(c),this._assetData.chapterData(null)}},e.prototype._onApiBitrateChange=function(a){this._logger.debug(w,"#_onApiBitrateChange()");var b=a.data;if(this._checkCall("_onApiBitrateChange")&&this._inputDataValidator.validateFields(b,["playhead"])){this._updateQoSInfo(b);var c=new t(this,n.EVENT_TYPE_BITRATE_CHANGE,b.playhead,null,b._eventData[E]);this._sendHit(c)}},e.prototype._onApiTrackError=function(a){var b=a.data;if(this._logger.debug(w,"#_onApiTrackError(source="+b._eventData.source+", err_id="+b._eventData.error_id+")"),!this._isTrackingSessionActive)return void this._logger.warn(w,"#_onApiTrackError() > No active tracking session.");if(this._trackExternalErrors||b._eventData.source===x){this._updateQoSInfo(b);var c=new t(this,n.EVENT_TYPE_ERROR,0,null,b._eventData[E]);c.eventData.id(b._eventData.error_id),c.eventData.source(b._eventData.source),this._sendHit(c)}},e.prototype._onApiTrackInternalError=function(a){var b=a.data;this._logger.debug(w,"#_onApiTrackInternalError(source="+b.source+", err_id="+b.error_id+")"),this._updateQoSInfo(b);var c=new t(this,n.EVENT_TYPE_ERROR,0);c.eventData.id(b.error_id),c.eventData.source(b.source),this._sendHit(c)},e.prototype._onApiQuantumEnd=function(a){this._logger.debug(w,"#_onApiQuantumEnd(interval="+this._channel.request(B)+")");var b=a.data;if(this._checkCall("_onApiQuantumEnd")&&this._inputDataValidator.validateFields(b,["playhead"])){var c=this._lastInBandItem;if(c){this._updateQoSInfo(b);var d=new t(this,c.eventData.type(),b.playhead,c.meta,c.callback);d.filterReport=c.filterReport,this._sendHit(d,!0)}}},e.prototype._onNetworkCheckStatusComplete=function(a){var b=a.data;this._trackExternalErrors=b[I],this._reportingInterval=b[J],this._reportingInterval||(this._reportingInterval=ma),this._logger.debug(w,"#_onNetworkCheckStatusComplete(track_ext_err="+this._trackExternalErrors+")")},e.prototype._onResetSessionId=function(a){var b=this._generateSessionId();this._sessionData=new i,this._sessionData.sessionId(b),this._logger.debug(w,"#_resetSessionId(new sessionId="+b+")")},e.prototype._installEventListeners=function(){this._channel.on(L,this._onApiAnalyticsStart,this),this._channel.on(M,this._onApiAnalyticsAdStart,this),this._channel.on(N,this._onApiVideoLoad,this),this._channel.on(O,this._onApiVideoUnload,this),this._channel.on(P,this._onApiVideoStart,this),this._channel.on(Q,this._onApiVideoComplete,this),this._channel.on(R,this._onApiVideoSkip,this),this._channel.on(S,this._onApiVideoResume,this),this._channel.on(T,this._onApiVideoSessionEnd,this),this._channel.on(U,this._onApiAdBreakStart,this),this._channel.on(V,this._onApiAdBreakComplete,this),this._channel.on(W,this._onApiAdStart,this),this._channel.on(X,this._onApiAdComplete,this),this._channel.on(Y,this._onApiAdSkip,this),this._channel.on(Z,this._onApiPlay,this),this._channel.on($,this._onApiPause,this),this._channel.on(_,this._onApiBufferStart,this),this._channel.on(aa,this._onApiChapterStart,this),this._channel.on(ba,this._onApiChapterComplete,this),this._channel.on(ca,this._onApiChapterSkip,this),this._channel.on(fa,this._onApiBitrateChange,this),this._channel.on(da,this._onApiTrackError,this),this._channel.on(ea,this._onApiTrackInternalError,this),this._channel.on(ga,this._onApiQuantumEnd,this),this._channel.on(ia,this._onNetworkCheckStatusComplete,this),this._channel.on(D,this._onResetSessionId,this),this._channel.reply(C,function(){return this._sessionData&&this._sessionData.sessionId()?this._sessionData.sessionId():null},this)},e.prototype._uninstallEventListeners=function(){this._channel.off(null,null,this)},e.prototype._resetInternalState=function(){this._logger.debug(w,"#_resetInternalState()"),this._isTrackingSessionActive=!1,this._isVideoComplete=!1,this._autoComputedStartupTime=0,this._lastInBandItem=null,this._stashedLastInBandItem=null,this._streamData=new p,this._qosData=new q,this._sessionData=new i,this._assetData=new o,this._cuserData=null},e.prototype._generateSessionId=function(){return""+(new Date).getTime()+Math.floor(1e9*Math.random())},e.prototype._updateQoSInfo=function(a){this._qosData.bitrate(a.bitrate||0),this._qosData.fps(a.fps||0),this._qosData.droppedFrames(a.droppedFrames||0),null==a.startupTime||isNaN(a.startupTime)?(this._qosData.startupTime(this._autoComputedStartupTime),this._qosData.isStartupTimeOverridden=!1):(this._qosData.startupTime(a.startupTime),this._qosData.isStartupTimeOverridden=!0)},e.prototype._checkCall=function(a){return this._isTrackingSessionActive?!this._isVideoComplete||"_onApiVideoSessionEnd"===a||(this._logger.warn(w,"#"+a+"() > The video content already completed."),!1):(this._logger.warn(w,"#"+a+"() > No active tracking session."),!1)},e.prototype._updateReportingInterval=function(a,b){var c={};c[K]=!!b,c[J]=a,this._channel.trigger(new h(ja,c))},e.prototype._updateLastInBandItem=function(a){var b=this._lastInBandItem,c=(new Date).getTime(),d=b.assetData.type()===o.TYPE_AD||a.assetData.type()===o.TYPE_AD,e=1e3*Math.abs(a.eventData.playhead()-b.eventData.playhead()),f=Math.abs(c-b.eventData.ts()),g=Math.abs(e-f),h=f;h>ka?(this._logger.warn(w," Resetting duration in lastInBandItem["+b.assetData.type()+":"+b.eventData.type()+"] call to 0 as calculated duration ("+h+")exceeds 10mins"),h=0):b.eventData.type()==n.EVENT_TYPE_PLAY&&!d&&!this._doNotOverrideEventDuration&&g>la&&(h=Math.min(e,f),this._logger.warn(w," Resetting duration in lastInBandItem["+b.assetData.type()+":"+b.eventData.type()+"] call to "+h+" as calculated error delta ("+g+")exceeds 2sec")),this._doNotOverrideEventDuration=!1,b.eventData.duration(h),b.eventData.ts(c),b.eventData.playhead(a.eventData.playhead()),b.qosData.startupTime(a.qosData.startupTime()),b.qosData.isStartupTimeOverridden=a.qosData.isStartupTimeOverridden},e.prototype._updateLastInbandItemToBuffering=function(){this._stashedLastInBandItem=this._lastInBandItem;var a=0;null!=this._lastInBandItem&&(this._lastInBandItem.assetData.type()==o.TYPE_MAIN_CONTENT&&this._lastInBandItem.eventData.type()==n.EVENT_TYPE_START&&(this._stashedMainMetadata=this._lastInBandItem.meta),a=this._lastInBandItem.eventData.playhead());var b=new t(this,n.EVENT_TYPE_BUFFER,a,null,null);b.assetData.adData(null),b.assetData.type(o.TYPE_MAIN_CONTENT),this._lastInBandItem=b},e.prototype._restoreLastInbandItem=function(){if(null!=this._stashedLastInBandItem){var a=null;this._stashedLastInBandItem.eventData.type()==n.EVENT_TYPE_START&&(this._lastInBandItem.assetData.type()==o.TYPE_AD?a=this._lastInBandItem.meta:(a=this._stashedMainMetadata,this._stashedMainMetadata=null));var b=new t(this,this._stashedLastInBandItem.eventData.type(),this._stashedLastInBandItem.eventData.playhead(),a,this._stashedLastInBandItem.callback);b.filterReport=this._stashedLastInBandItem.filterReport,this._lastInBandItem=b,this._stashedLastInBandItem=null}},e.prototype._flushLastInbandItem=function(a){if(this._lastInBandItem){this._updateQoSInfo(a);var b=new t(this,this._lastInBandItem.eventData.type(),a.playhead,this._lastInBandItem.meta,this._lastInBandItem.callback);this._sendHit(b,!0)}},e.prototype._createAndSendReport=function(a){var b=this._reportFactory.createReportForItem(a);b.qosData.isStartupTimeOverridden||b.qosData.startupTime(this._autoComputedStartupTime);var c={};if(c[G]=b,this._channel.trigger(new h(ha,c)),b.eventData.type()==n.EVENT_TYPE_START||b.eventData.type()==n.EVENT_TYPE_PLAY||b.eventData.type()==n.EVENT_TYPE_PAUSE||b.eventData.type()==n.EVENT_TYPE_STALL||b.eventData.type()==n.EVENT_TYPE_BUFFER){var d={};d[H]=!0,this._channel.command(z,d)}},e.prototype._sendHit=function(a,b){switch(a.eventData.type()){case n.EVENT_TYPE_START:case n.EVENT_TYPE_PLAY:case n.EVENT_TYPE_PAUSE:case n.EVENT_TYPE_STALL:case n.EVENT_TYPE_BUFFER:this._lastInBandItem?(this._updateLastInBandItem(a),this._lastInBandItem.eventData.type()==n.EVENT_TYPE_START&&this._lastInBandItem.assetData.type()==o.TYPE_MAIN_CONTENT&&(this._autoComputedStartupTime+=this._lastInBandItem.eventData.duration()),this._createAndSendReport(this._lastInBandItem),b&&this._lastInBandItem.eventData.type()==a.eventData.type()||this._createAndSendReport(a)):this._createAndSendReport(a),this._lastInBandItem=a;break;case n.EVENT_TYPE_COMPLETE:case n.EVENT_TYPE_SKIP:if(this._lastInBandItem&&(this._updateLastInBandItem(a),this._createAndSendReport(this._lastInBandItem)),a.eventData.type()!==n.EVENT_TYPE_SKIP&&this._createAndSendReport(a),a.assetData.type()==o.TYPE_MAIN_CONTENT){this._lastInBandItem=null,this._stashedLastInBandItem=null;var c={};c[H]=!0,this._channel.command(A,c)}else a.assetData.type()==o.TYPE_AD&&(this._lastInBandItem.assetData.adData(null),this._lastInBandItem.assetData.type(o.TYPE_MAIN_CONTENT),this._doNotOverrideEventDuration=!0);break;case n.EVENT_TYPE_CHAPTER_START:case n.EVENT_TYPE_CHAPTER_COMPLETE:case n.EVENT_TYPE_CHAPTER_SKIP:this._lastInBandItem&&(this._updateLastInBandItem(a),this._createAndSendReport(this._lastInBandItem)),a.eventData.type()!==n.EVENT_TYPE_CHAPTER_SKIP&&this._createAndSendReport(a),this._lastInBandItem&&(this._lastInBandItem.assetData.chapterData(a.eventData.type()==n.EVENT_TYPE_CHAPTER_START?new s(a.assetData.chapterData()):null),this._lastInBandItem.eventData.duration(0),this._createAndSendReport(this._lastInBandItem));break;default:this._createAndSendReport(a)}};var w="ah::Context",x="sourceErrorSDK",y="error",z="clock:reporting.resume",A="clock:reporting.pause",B="reporting_interval",C="session_id",D="reset_session_id",E="callback",F="filter_report",G="report",H="reset",I="track_external_errors",J="reporting_interval",K="do_not_override_interval",L="api:aa_start",M="api:aa_ad_start",N="api:video_load",O="api:video_unload",P="api:video_start",Q="api:video_complete",R="api:video_skip",S="api:video_resume",T="api:video_session_end",U="api:adbreak_start",V="api:adbreak_complete",W="api:ad_start",X="api:ad_complete",Y="api:ad_skip",Z="api:play",$="api:pause",_="api:buffer_start",aa="api:chapter_start",ba="api:chapter_complete",ca="api:chapter_skip",da="api:track_error",ea="api:track_internal_error",fa="api:bitrate_change",ga="api:quantum_end",ha="context:report_available",ia="net:check_status_complete",ja="reporting:update_interval",ka=6e5,la=2e3,ma=10;d.context.Context=e}(a.ADB.core,a.ADB.va,a.ADB.va.utils,b),function(a){"use strict";function b(a,b){this.trackingServer=a,this.publisher=b,this.ssl=!1,this.ovp=c,this.sdk=c,this.quietMode=!1,this.debugLogging=!1,this.__isPrimetime=!1,this.__psdkVersion=null}var c="unknown";a.AdobeHeartbeatPluginConfig=b}(b),function(a){"use strict";function b(){}b.prototype.onError=function(a){},b.prototype.onTrackingDisabled=function(){},a.AdobeHeartbeatPluginDelegate=b}(b),function(a,b,c){"use strict";function d(a){d.__super__.constructor.call(this,q),this._radio=new i(this._logger),this._channel=this._radio.channel(y),this._delegate=a,this._context=new l(this._channel,this._logger),this._filter=new m(this._channel,this._logger),this._network=new n(this._channel,this._logger),this._setupDataResolver()}var e=a.Event,f=a.Trigger,g=a.plugin.BasePlugin,h=a.plugin.ParamMapping,i=a.radio.Radio,j=b.ErrorInfo,k=b.Version,l=c.context.Context,m=c.filter.ReportFilter,n=c.network.Network,o=c.clock.Clock,p=c.AdobeHeartbeatPluginConfig;a.extend(d,g),d.prototype.configure=function(a){if(!a)throw new Error("Reference to the configuration data cannot be NULL.");if(!(a instanceof p))throw new Error("Expected config data to be instance of AdobeHeartbeatPluginConfig.");this._config=a,this._config.debugLogging?this._logger.enable():this._logger.disable(),this._logger.debug(this._logTag,"#configure({trackingServer="+this._config.trackingServer+", publisher="+this._config.publisher+", quietMode="+this._config.quietMode+", ssl="+this._config.ssl+"})");var b=this._config.trackingServer+"/settings/",c={};c[ia]=this._config.trackingServer,c[ja]=b,c[ka]=this._config.publisher,c[la]=this._config.quietMode,c[ma]=this._config.ssl,this._channel.trigger(new e(sa,c)),this._isConfigured=!0},d.prototype.bootstrap=function(a){d.__super__.bootstrap.call(this,a),this._channel.on(z,this._onError,this),this._clock=new o(this._pluginManager,this._channel,this._logger),this._channel.command(Ra),this._channel.trigger(new e(Ya)),this._channel.on(pa,this._onCheckStatusComplete,this),this._registerCommands(),this._registerBehaviours()},d.prototype._teardown=function(){this._logger.debug(this._logTag,"#_teardown()"),this._radio.shutdown(),this._context.destroy(),this._clock.destroy(),this._filter.destroy(),this._network.destroy()},d.prototype._canProcess=function(){return this._isConfigured?this._errorInfo?(this._logger.error(this._logTag,"_canProcess() > Plugin in ERROR state."),!1):d.__super__._canProcess.call(this):(this._logger.error(this._logTag,"_canProcess() > Plugin not configured."),!1)},d.prototype._cmdAnalyticsError=function(a){this._errorInfo||(this._errorInfo=new j("Internal error","AdobeAnalyticsPlugin is in ERROR state."),this._trigger(z,this._errorInfo),this._delegate&&this._delegate.onError(this._errorInfo))},d.prototype._cmdAnalyticsStart=function(a){if(this._canProcess()){var b={};b[na]=a.visitorOptedOut,this._channel.trigger(new e(ta,b)),this._channel.trigger(new e(qa,a))}},d.prototype._cmdAnalyticsAdStart=function(a){this._canProcess()&&this._channel.trigger(new e(ra,a))},d.prototype._cmdVideoLoad=function(a){this._errorInfo=null,this._canProcess()&&(this._isTrackingSessionActive&&this._channel.trigger(new e(va,a)),this._isTrackingSessionActive=!1,this._isPaused=!0,this._isSeeking=!1,this._isBuffering=!1,this._isVideoIdle=!1,this._filter.clear(),this._channel.trigger(new e(ua,a)),this._isTrackingSessionActive=!0)},d.prototype._cmdVideoUnload=function(a){this._errorInfo=null,this._canProcess()&&(this._channel.trigger(new e(va,a)),this._filter.flush(),this._runReportingTimer(!1),this._runFlushFilterTimer(!1),this._runIdleTimer(!1),this._isTrackingSessionActive=!1)},d.prototype._cmdVideoSessionEnd=function(a){this._canProcess()&&this._channel.trigger(new e(Aa,a))},d.prototype._cmdVideoStart=function(a){this._canProcess()&&(this._channel.trigger(new e(wa,a)),this._filter.flush())},d.prototype._cmdVideoComplete=function(a){this._canProcess()&&this._channel.trigger(new e(xa,a))},d.prototype._cmdVideoSkip=function(a){this._canProcess()&&this._channel.trigger(new e(ya,a))},d.prototype._cmdVideoResume=function(a){this._canProcess()&&this._channel.trigger(new e(za,a))},d.prototype._cmdPlay=function(a){this._canProcess()&&(this._isPaused=!1,this._resumePlaybackIfPossible(a))},d.prototype._cmdPause=function(a){this._canProcess()&&(this._channel.trigger(new e(Ha,a)),this._isPaused=!0,this._runIdleTimer(!0))},d.prototype._cmdAdBreakStart=function(a){this._canProcess()&&this._channel.trigger(new e(Ba,a))},d.prototype._cmdAdBreakComplete=function(a){this._canProcess()&&(this._channel.trigger(new e(Ca,a)),this._resumePlaybackIfPossible(a))},d.prototype._cmdAdStart=function(a){this._canProcess()&&(this._channel.trigger(new e(Da,a)),this._resumePlaybackIfPossible(a))},d.prototype._cmdAdComplete=function(a){this._canProcess()&&this._channel.trigger(new e(Ea,a))},d.prototype._cmdAdSkip=function(a){this._canProcess()&&this._channel.trigger(new e(Fa,a))},d.prototype._cmdBufferStart=function(a){this._canProcess()&&(this._channel.trigger(new e(Ia,a)),this._isBuffering=!0,this._runIdleTimer(!0))},d.prototype._cmdBufferComplete=function(a){this._canProcess()&&(this._isBuffering=!1,this._isPaused?this._channel.trigger(new e(Ha,a)):this._resumePlaybackIfPossible(a))},d.prototype._cmdSeekStart=function(a){this._canProcess()&&(this._channel.trigger(new e(Ha,a)),this._isSeeking=!0,this._runIdleTimer(!0))},d.prototype._cmdSeekComplete=function(a){this._canProcess()&&(this._isSeeking=!1,this._resumePlaybackIfPossible(a))},d.prototype._cmdChapterStart=function(a){this._canProcess()&&this._channel.trigger(new e(Ja,a))},d.prototype._cmdChapterComplete=function(a){this._canProcess()&&this._channel.trigger(new e(Ka,a))},d.prototype._cmdChapterSkip=function(a){this._canProcess()&&this._channel.trigger(new e(La,a))},d.prototype._cmdBitrateChange=function(a){this._canProcess()&&this._channel.trigger(new e(Oa,a))},d.prototype._cmdTrackError=function(a){this._canProcess()&&this._channel.trigger(new e(Ma,a))},d.prototype._cmdClockReportingTick=function(a){this._canProcess()&&this._channel.trigger(new e(Pa,a))},d.prototype._onCheckStatusComplete=function(a){if(this._canProcess()){var b=!1;a&&a.data&&a.data[oa]&&(b=a.data[oa]),this._logger.debug(this._logTag,"#_onCheckStatusComplete(trackingDisabled="+b+")"),b&&this._delegate&&this._delegate.onTrackingDisabled()}},d.prototype._cmdIdleTick=function(a){this._canProcess()&&(this._isVideoIdle=!0,this._trigger(aa),this._channel.trigger(new e(Aa,a)),this._filter.flush(),this._runReportingTimer(!1),this._runFlushFilterTimer(!1),this._runIdleTimer(!1),this._trigger($))},d.prototype._onError=function(a){this._errorInfo=a.data;var b={};b[ga]=Qa,b[ha]=this._errorInfo.getMessage()+"|"+this._errorInfo.getDetails(),this._channel.trigger(new e(Na,b)),this._runReportingTimer(!1),this._trigger(z,this._errorInfo),this._delegate&&this._delegate.onError(this._errorInfo)},d.prototype._runIdleTimer=function(a){var b={};b[fa]=!0,a?this._channel.command(Wa,b):this._channel.command(Xa,b)},d.prototype._runFlushFilterTimer=function(a){var b={};b[fa]=!0,a?this._channel.command(Ua,b):this._channel.command(Va,b)},d.prototype._runReportingTimer=function(a){var b={};b[fa]=!0,a?this._channel.command(Sa,b):this._channel.command(Ta,b)},d.prototype._registerCommands=function(){this._pluginManager.comply(this,"handleAnalyticsError",this._cmdAnalyticsError),this._pluginManager.comply(this,"handleAnalyticsStart",this._cmdAnalyticsStart),this._pluginManager.comply(this,"handleAnalyticsAdStart",this._cmdAnalyticsAdStart),this._pluginManager.comply(this,"handleVideoLoad",this._cmdVideoLoad),this._pluginManager.comply(this,"handleVideoUnload",this._cmdVideoUnload),this._pluginManager.comply(this,"handleVideoSessionEnd",this._cmdVideoSessionEnd),this._pluginManager.comply(this,"handleVideoStart",this._cmdVideoStart),this._pluginManager.comply(this,"handleVideoComplete",this._cmdVideoComplete),this._pluginManager.comply(this,"handleVideoSkip",this._cmdVideoSkip),this._pluginManager.comply(this,"handleVideoResume",this._cmdVideoResume),this._pluginManager.comply(this,"handlePlay",this._cmdPlay),this._pluginManager.comply(this,"handlePause",this._cmdPause),this._pluginManager.comply(this,"handleAdBreakStart",this._cmdAdBreakStart),this._pluginManager.comply(this,"handleAdBreakComplete",this._cmdAdBreakComplete),this._pluginManager.comply(this,"handleAdStart",this._cmdAdStart),this._pluginManager.comply(this,"handleAdComplete",this._cmdAdComplete),this._pluginManager.comply(this,"handleAdSkip",this._cmdAdSkip),this._pluginManager.comply(this,"handleBufferStart",this._cmdBufferStart),this._pluginManager.comply(this,"handleBufferComplete",this._cmdBufferComplete),this._pluginManager.comply(this,"handleSeekStart",this._cmdSeekStart),this._pluginManager.comply(this,"handleSeekComplete",this._cmdSeekComplete),this._pluginManager.comply(this,"handleChapterStart",this._cmdChapterStart),this._pluginManager.comply(this,"handleChapterComplete",this._cmdChapterComplete),this._pluginManager.comply(this,"handleChapterSkip",this._cmdChapterSkip),this._pluginManager.comply(this,"handleBitrateChange",this._cmdBitrateChange),this._pluginManager.comply(this,"handleTrackError",this._cmdTrackError),this._pluginManager.comply(this,"handleClockReportingTick",this._cmdClockReportingTick),this._pluginManager.comply(this,"handleIdleTick",this._cmdIdleTick)},d.prototype._registerBehaviours=function(){this._pluginManager.registerBehaviour(new f(t,C),this,"handleVideoLoad",[new h(s,"rsid","rsid"),new h(s,"tracking_server","trackingServer")]),this._pluginManager.registerBehaviour(new f(t,D),this,"handleVideoUnload"),this._pluginManager.registerBehaviour(new f(t,E),this,"handleVideoSessionEnd",[new h(t,"video.playhead","playhead")]),this._pluginManager.registerBehaviour(new f(t,F),this,"handleVideoStart",[new h(t,"video.id","videoId"),new h(t,"video.name","videoName"),new h(t,"video.length","videoLength"),new h(t,"video.playhead","playhead"),new h(t,"video.playerName","playerName"),new h(t,"video.streamType","streamType"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime"),new h(s,"rsid","rsid"),new h(s,"tracking_server","trackingServer"),new h(s,"channel","channel"),new h(s,"meta.video.*","metaVideo"),new h(s,"ssl","useSsl"),new h(u,"meta","metaNielsen"),new h(r,"publisher","publisher"),new h(r,"sdk","sdk"),new h(r,"ovp","ovp"),new h(r,"version","version"),new h(r,"api_level","apiLvl")]),this._pluginManager.registerBehaviour(new f(t,H),this,"handleVideoComplete",[new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,I),this,"handleVideoSkip",[new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,G),this,"handleVideoResume",[new h(t,"video.id","videoId"),new h(t,"video.name","videoName"),new h(t,"video.length","videoLength"),new h(t,"video.playhead","playhead"),new h(t,"video.playerName","playerName"),new h(t,"video.streamType","streamType")]),this._pluginManager.registerBehaviour(new f(t,J),this,"handlePlay",[new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,K),this,"handlePause",[new h(t,"video.playhead","playhead"),new h(t,"video.playheadStalled","playheadStalled"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,M),this,"handleAdBreakStart",[new h(t,"ad.isInAdBreak","isInAdBreak"),new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,N),this,"handleAdBreakComplete",[new h(t,"ad.isInAdBreak","isInAdBreak"),new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,O),this,"handleAdStart",[new h(t,"video.playhead","playhead"),new h(t,"ad.id","adId"),new h(t,"ad.name","adName"),new h(t,"ad.length","adLength"),new h(t,"ad.position","adPosition"),new h(t,"ad.granularTracking","adGranularTracking"),new h(t,"ad.trackingInterval","adTrackingInterval"),new h(t,"pod.name","podName"),new h(t,"pod.playerName","podPlayerName"),new h(t,"pod.position","podPosition"),new h(t,"pod.startTime","podSecond"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime"),new h(s,"meta.video.*","metaVideo"),new h(s,"meta.ad.*","metaAd"),new h(u,"meta","metaNielsen"),new h(u,"metaAd","metaAdNielsen")]),this._pluginManager.registerBehaviour(new f(t,P),this,"handleAdComplete",[new h(t,"video.playhead","playhead"),new h(t,"ad.isInAdBreak","isInAdBreak"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,Q),this,"handleAdSkip",[new h(t,"video.playhead","playhead"),new h(t,"ad.isInAdBreak","isInAdBreak"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,R),this,"handleBufferStart",[new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,S),this,"handleBufferComplete",[new h(t,"video.playhead","playhead"),new h(t,"video.playheadStalled","playheadStalled"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,T),this,"handleSeekStart",[new h(t,"video.playhead","playhead")]),this._pluginManager.registerBehaviour(new f(t,U),this,"handleSeekComplete",[new h(t,"video.playhead","playhead"),new h(t,"ad.isInAd","isInAd"),new h(t,"ad.id","adId"),new h(t,"ad.position","adPosition"),new h(t,"pod.playerName","podPlayerName"),new h(t,"pod.position","podPosition"),new h(t,"chapter.isInChapter","isInChapter"),new h(t,"chapter.position","chapterPosition"),new h(t,"chapter.name","chapterName"),new h(t,"chapter.length","chapterLength"),new h(t,"chapter.startTime","chapterOffset"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,V),this,"handleChapterStart",[new h(t,"video.playhead","playhead"),new h(t,"chapter.position","chapterPosition"),new h(t,"chapter.name","chapterName"),new h(t,"chapter.length","chapterLength"),new h(t,"chapter.startTime","chapterOffset"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime"),new h(s,"meta.video.*","metaVideo"),new h(s,"meta.chapter.*","metaChapter"),new h(u,"meta","metaNielsen")]),this._pluginManager.registerBehaviour(new f(t,W),this,"handleChapterComplete",[new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,X),this,"handleChapterSkip",[new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,Y),this,"handleBitrateChange",[new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,Z),this,"handleTrackError"),this._pluginManager.registerBehaviour(new f(v,ca),this,"handleClockReportingTick",[new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(t,L),this,"handleClockReportingTick",[new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(v,ea),this,"handleIdleTick",[new h(t,"video.playhead","playhead")]),this._pluginManager.registerBehaviour(new f(r,aa),this,"handleClockReportingTick",[new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(s,z),this,"handleAnalyticsError"),this._pluginManager.registerBehaviour(new f(s,A),this,"handleAnalyticsStart",[new h(s,"vid","vid"),new h(s,"aid","aid"),new h(s,"mid","mid"),new h(s,"customerIDs","customerIDs"),new h(s,"visitorOptedOut","visitorOptedOut"),new h(s,"blob","blob"),new h(s,"loc_hint","loc_hint"),new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")]),this._pluginManager.registerBehaviour(new f(s,B),this,"handleAnalyticsAdStart",[new h(t,"video.playhead","playhead"),new h(t,"qos.fps","fps"),new h(t,"qos.droppedFrames","droppedFrames"),new h(t,"qos.bitrate","bitrate"),new h(t,"qos.startupTime","startupTime")])},d.prototype._setupDataResolver=function(){var a={},b=this;a.version=function(){return k.getVersion()},a.api_level=function(){return k.getApiLevel()},a.tracking_server=function(){return b._config?b._config.trackingServer:null},a.publisher=function(){return b._config?b._config.publisher:null},a.quiet_mode=function(){return!!b._config&&b._config.quietMode},a.ovp=function(){return b._config?b._config.ovp:null},a.sdk=function(){return b._config?b._config.sdk:null},a.is_primetime=function(){return!!b._config&&b._config.__isPrimetime},a.psdk_version=function(){return b._config?b._config.__psdkVersion:null},a.session_id=function(){return b._channel.request(w)},this._dataResolver=function(b){if(!b||0==b.length)return null;for(var c=null,d=0;d In ERROR state."),!1):e.__super__._canProcess.call(this)},e.prototype._cmdVideoLoad=function(a){this._errorInfo=null},e.prototype._cmdVideoStart=function(a){this._logger.debug(this._logTag,"#_cmdVideoStart()"),this._canProcess()&&this._workQueue.addCommand(new j(this._executeOpen,this,[a]))},e.prototype._cmdAdStart=function(a){this._logger.debug(this._logTag,"#_cmdAdStart()"),this._canProcess()&&this._workQueue.addCommand(new j(this._executeOpenAd,this,[a]))},e.prototype._cmdHeartbeatPluginError=function(a){this._errorInfo||(this._errorInfo=new l("Internal error","HeartbeatPlugin is in ERROR state."),this._trigger(x,this._errorInfo),this._delegate&&this._delegate.onError(this._errorInfo))},e.prototype._track=function(a){try{if(!this._appMeasurement.visitorOptedOut){var b=this._appMeasurement.linkTrackVars;this._appMeasurement.linkTrackVars="",this._appMeasurement.track(a),this._appMeasurement.linkTrackVars=b}}catch(a){this._logger.warn(this._logTag,"appMeasurement.track() call threw an exception.")}},e.prototype._executeOpen=function(a){if(this._logger.debug(this._logTag,"#_executeOpen(id="+a.videoId+", videoName="+a.videoName+", mediaType="+a.mediaType+", streamType="+a.streamType+", length="+a.videoLength+", playerName="+a.playerName+", channel="+a.channel+", isPrimetime="+a.isPrimetime+", sessionId="+a.sessionId+")"),this._canProcess()&&this._inputDataValidator.validateFields(a,["videoId","mediaType","streamType","videoLength","playerName"])){var b={};for(var c in a.metaVideo)a.metaVideo.hasOwnProperty(c)&&(b[c]=a.metaVideo[c]);if(a.metaNielsen)for(var c in a.metaNielsen)a.metaNielsen.hasOwnProperty(c)&&(b[c]=a.metaNielsen[c]);b["a.contentType"]=a.streamType,b["a.media.name"]=a.videoId,b["a.media.friendlyName"]=a.videoName||"",b["a.media.length"]=Math.floor(a.videoLength)||"0",b["a.media.playerName"]=a.playerName,b["a.media.channel"]=a.channel||"",b["a.media.view"]=!0,b["a.media.vsid"]=a.sessionId;var d={};d.contextData=b,"audio"===a.mediaType?(d.pev3=A,d.ms_a="1"):d.pev3=y,d.pe=a.isPrimetime?D:C,this._track(d);var e=this;setTimeout(function(){e._trigger(G,a)},0)}},e.prototype._executeOpenAd=function(a){var b=m(a.videoId)+"_"+a.podPosition;if(this._logger.debug(this._logTag,"#_executeOpenAd(id="+a.adId+", mediaType="+a.mediaType+", streamType="+a.streamType+", length="+a.adLength+", podPlayerName="+a.podPlayerName+", parentId="+a.videoId+", podId="+b+", parentPodPosition="+a.adPosition+", podSecond="+a.podSecond+")"),this._canProcess()&&this._inputDataValidator.validateFields(a,["videoId","mediaType","streamType","playerName","adId","adLength","podPlayerName","adPosition"])){a.podSecond=null==a.podSecond||isNaN(a.podSecond)?a.playhead:a.podSecond;var c,d={};for(c in a.metaVideo)a.metaVideo.hasOwnProperty(c)&&(d[c]=a.metaVideo[c]);for(c in a.metaAd)a.metaAd.hasOwnProperty(c)&&(d[c]=a.metaAd[c]);if(a.metaNielsen)for(var c in a.metaNielsen)a.metaNielsen.hasOwnProperty(c)&&(d[c]=a.metaNielsen[c]);d["a.contentType"]=a.streamType,d["a.media.name"]=a.videoId,d["a.media.playerName"]=a.playerName,d["a.media.channel"]=a.channel||"",d["a.media.vsid"]=a.sessionId,d["a.media.friendlyName"]=a.videoName||"",d["a.media.length"]=Math.floor(a.videoLength)||"0",d["a.media.ad.name"]=a.adId,d["a.media.ad.friendlyName"]=a.adName||"",d["a.media.ad.podFriendlyName"]=a.podName||"",d["a.media.ad.length"]=Math.floor(a.adLength)||"0",d["a.media.ad.playerName"]=a.podPlayerName,d["a.media.ad.pod"]=b,d["a.media.ad.podPosition"]=Math.floor(a.adPosition)||"0",d["a.media.ad.podSecond"]=Math.floor(a.podSecond)||"0",d["a.media.ad.view"]=!0;var e={};e.contextData=d,"audio"===a.mediaType?(e.pev3=B,e.ms_a="1"):e.pev3=z,e.pe=a.isPrimetime?F:E,this._track(e);var f=this;setTimeout(function(){f._trigger(H,a)},0)}},e.prototype._setupDataResolver=function(){var a={},b=this;a.rsid=function(){return b._appMeasurement.account},a.tracking_server=function(){return b._appMeasurement.ssl&&b._appMeasurement.trackingServerSecure?b._appMeasurement.trackingServerSecure:b._appMeasurement.trackingServer},a.ssl=function(){return b._appMeasurement.ssl},a.vid=function(){return b._appMeasurement.visitorID},a.aid=function(){return b._appMeasurement.analyticsVisitorID},a.mid=function(){return b._appMeasurement.marketingCloudVisitorID},a.blob=function(){return b._appMeasurement.audienceManagerBlob},a.loc_hint=function(){return b._appMeasurement.audienceManagerLocationHint?parseInt(b._appMeasurement.audienceManagerLocationHint):""},a.customerIDs=function(){var a={},c=b._appMeasurement.visitor.getCustomerIDs();for(var d in c)if(c.hasOwnProperty(d)){var e=c[d];if("object"==typeof e){for(var f in e)e.hasOwnProperty(f)&&("authState"==f?a[d+".as"]=e[f]:a[d+"."+f]=e[f]);a[d+".as"]||(a[d+".as"]="0")}}return a},a.visitorOptedOut=function(){return!!b._appMeasurement.visitorOptedOut},a.channel=function(){return b._config?b._config.channel:null},a.meta=function(a){var c=a.split(".");if(c.length<2)return null;var d=c.shift();switch(a=c.join("."),d){case"video":return a==i.WILDCARD?b._videoMetadata:b._videoMetadata[a];case"ad":return a==i.WILDCARD?b._adMetadata:b._adMetadata[a];case"chapter":return a==i.WILDCARD?b._chapterMetadata:b._chapterMetadata[a];default:return null}},this._dataResolver=function(b){if(!b||0==b.length)return null;for(var c=null,d=0;d0&&this._startTimer()},d.prototype._checkStopTimer=function(){0===this._tasks.length&&this._stopTimer()},d.prototype._removeTask=function(a,b){for(var c=0;c0&&(b.__primetime=!0,b.__psdkVersion=d),this._ahPlugin.configure(b),this._plugins.push(this._ahPlugin)},e.prototype._configureVideoPlayerPlugin=function(){this._playerPlugin=new k(new m(this));var a=new l;a.debugLogging=c.MediaHeartbeat._debugLogging||this._config.debugLogging,this._playerPlugin.configure(a),this._plugins.push(this._playerPlugin)},e.prototype._configureOtherPlugins=function(){if(c.plugins.nielsen&&this._config.nielsenConfigKey&&this._config.nielsenAppInfo){this._nielsenPlugin=new c.plugins.nielsen.NielsenPlugin(new c._NielsenPluginDelegate(this,this._logger));var a=new c.plugins.nielsen.NielsenPluginConfig;a.debugLogging=c.MediaHeartbeat._debugLogging||this._config.debugLogging,a.appInfo=this._config.nielsenAppInfo,a.configKey=this._config.nielsenConfigKey,this._nielsenPlugin.configure(a),this._plugins.push(this._nielsenPlugin)}},e.prototype._configureHeartbeat=function(){var a=new i;a.debugLogging=c.MediaHeartbeat._debugLogging||this._config.debugLogging,this._heartbeat=new h(new j(this),this._plugins),this._heartbeat.configure(a)},e.prototype._resetState=function(){this._taskScheduler.clearTasks(),this._mediaState={},this._plugins=[],this._playerPlugin=null,this._aaPlugin=null,this._ahPlugin=null,this._nielsenPlugin=null,this._heartbeat=null,this._currentMediaObject=null,this._currentAdBreakObject=null,this._currentAdObject=null,this._currentChapterObject=null,this._videoInfo=null,this._adBreakInfo=null,this._adInfo=null,this._chapterInfo=null,this._prerollWaitEnabled=!0,this._prerollWaitTime=N,this._playReceived=!1,this._playTaskHandle=null,this._playAfterAdStart=!1},e.prototype._primetimeTVSDKVersion=function(){return this._currentMediaObject?this._currentMediaObject.getValue(L):null},e.prototype._cleanContextData=function(a){if(null==a||"object"!=typeof a)return null;var b={};for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];"number"!=typeof d&&"string"!=typeof d&&"boolean"!=typeof d||(b[c]=d)}return b},e.prototype._prepareMetadata=function(a,b){var c={};if(b&&v.append(c,b),a){var d=this._cleanContextData(a);v.append(c,d)}return delete c[K],c},e.prototype._onDelegateError=function(a){this._logger.error(C,a.getMessage()+" | "+a.getDetails())},e.prototype._disableHBTracking=function(){var a=t.createContext();this._processRule(A.DisableTracking,a),this._processRule(A.SessionEnd,a)};var z={Session:0,Media:1,AdBreak:2,Ad:3,Chapter:4,PlayPause:5,Buffer:6,Seek:7,FPlayPause:8},A={SessionStart:0,SessionEnd:1,VideoComplete:2,Play:3,Pause:4,Error:5,AdBreakStart:6,AdBreakComplete:7,AdStart:8,AdComplete:9,AdSkip:10,ChapterStart:11,ChapterComplete:12,ChapterSkip:13,SeekStart:14,SeekComplete:15,BufferStart:16,BufferComplete:17,BitrateChange:18,TimedMetadataUpdate:19,DisableTracking:20},B={ErrUnSupportedPlatform:"MediaHeartbeat does not support tracking due to AppMeasurement or VisitorAPI not supporting the browser.",ErrNotInSession:\'MediaHeartbeat is not in active tracking session, call "API:trackSessionStart" to begin a new tracking session.\',ErrInSession:\'MediaHeartbeat is in active tracking session, call "API:trackSessionEnd" to end current tracking session.\',ErrTrackingDisabled:"MediaHeartbeat tracking is disabled for this publisher. Please contact Adobe Representative to enable tracking.",ErrNotInMedia:\'MediaHeartbeat has completed tracking session, call "API:trackSessionEnd" first to end current session and then begin a new tracking session.\',ErrInBuffer:\'MediaHeartbeat is tracking buffer events, call "API:trackEvent(BufferComplete)" first to stop tracking buffer events.\',ErrNotInBuffer:\'MediaHeartbeat is not tracking buffer events, call "API:trackEvent(BufferStart)" before "API:trackEvent(BufferComplete)".\',ErrInSeek:\'MediaHeartbeat is tracking seek events, call "API:trackEvent(SeekComplete)" first to stop tracking seek events.\',ErrNotInSeek:\'MediaHeartbeat is not tracking seek events, call "API:trackEvent(SeekStart)" before "API:trackEvent(SeekComplete)".\',ErrNotInAdBreak:\'MediaHeartbeat is not tracking any AdBreak, call "API:trackEvent(AdBreakStart)" to begin tracking AdBreak\',ErrNotInAd:\'MediaHeartbeat is not tracking any Ad, call "API:trackEvent(AdStart)" to begin tracking Ad\',ErrNotInChapter:\'MediaHeartbeat is not tracking any Chapter, call "API:trackEvent(ChapterStart)" to begin tracking Chapter\',ErrInvalidMediaObject:\'MediaInfo passed into "API:trackSessionStart" is invalid.\',ErrInvalidAdBreakObject:\'AdBreakInfo passed into "API:trackEvent(AdBreakStart)" is invalid.\',ErrDuplicateAdBreakObject:\'MediaHeartbeat is currently tracking the AdBreak passed into "API:trackEvent(AdBreakStart)".\',ErrInvalidAdObject:\'AdInfo passed into "API:trackEvent(AdStart)" is invalid.\',ErrDuplicateAdObject:\'MediaHeartbeat is currently tracking the Ad passed into "API:trackEvent(AdStart)".\',ErrInvalidChapterObject:\'ChapterInfo passed into "API:trackEvent(ChapterStart)" is invalid.\',ErrDuplicateChapterObject:\'MediaHeartbeat is currently tracking the Chapter passed into "API:trackEvent(ChapterStart)".\',ErrInvalidTimedMetadataObject:\'TimedMetadata passed into "API:trackEvent(TimedMetadataUpdate)" is invalid.\',ErrInvalidPlayerState:"MediaHeartbeat is tracking an AdBreak but not tracking any Ad and will drop any calls to track player state (Play, Pause, Buffer or Seek) in this state.",ErrAudioTrackingNotSupported:"Upgrade your AppMeasurement library to version >= \'2.11.0\' to support tracking audio content."},C="MediaHeartbeat",D="key_media_object",E="key_adbreak_object",F="key_ad_object",G="key_chapter_object",H="key_timed_metadata_object",I="key_custom_metadata",J="key_error_id",K="a.media.streamType",L="a.__pttvsdkVersion",M="granular_ad_tracking",N=250;c._MediaHeartbeatErrorMessage=B,c.MediaHeartbeatDelegate=d,c.MediaHeartbeat=e,c.MediaHeartbeat._debugLogging=!1}(a.ADB.core,a.ADB.va),a.ADB||(a.ADB={}),a.ADB.core||(a.ADB.core=core),a.ADB.va||(a.ADB.va=va),a.ADB.va.plugins||(a.ADB.va.plugins={})}(this);\n\n }).call(lib);\n exports.va = lib.ADB.va;\n exports.core = lib.ADB.core;\n}));\n', + language: 'javascript' + } + }] + }, + { + id: 'RL26b1173569bd43018bbe4fde08d330f9', + name: '#04 [PL] ZZ HeartBeat Tracker', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 4 + }], + conditions: [], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + global: !1, + source: '/*! HeartBeatTracker - v1.2 - 2019-11-27 */\n\nwindow.HeartBeatTracker = function() {\n var MediaHeartbeat = ADB.va.MediaHeartbeat;\n var MediaHeartbeatConfig = ADB.va.MediaHeartbeatConfig;\n var MediaHeartbeatDelegate = ADB.va.MediaHeartbeatDelegate;\n\n // "this object override\n var _this = this;\n\n // Players list\n // Players are keyed on playerId\n this.players = {};\n\n\n // Static configuration parameters set at DTM level\n this.configuration = _satellite.getVar("[VIDEO] HbConfiguration");\n\n // AppMeasurement object - set at global level\n this.appMeasurement = window.s;\n\n // Create HeartBeat Media Object\n // Params:\n // - contextData\n // - video_data\n // - video_id\n // - video_name\n // - video_length\n // - video_ovp\n // - jwPlayerObject\n\n this.createHBPlayer = function(params) {\n\n // Get JWPlayer ID.\n var player_id = params.jwPlayerObject.getConfig().id;\n var player = false;\n //_satellite.notify("---- HEARTBEATTRACKER: ",\n // "PlayerID ", player_id); \n\n //_satellite.notify("---- HEARTBEATTRACKER: linkTrackVars: ", s.linkTrackVars);\n s.linkTrackVars = "";\n s.clearVars();\n\n // Workaround to convert videoID to String\n if (typeof params.video_data.video_id != "string")\n params.video_data.video_id = params.video_data.video_id.toString();\n\n // Verifico che non esista un player del video\n if (typeof _this.players[player_id] != "undefined") {\n // _satellite.notify("---- HEARTBEATTRACKER: ",\n // "HBPlayer for --> ",\n // player_id,\n // "",\n // " already exists.");\n player = _this.players[player_id]\n } else {\n // Create l\'istanza della classe VideoHeartBeat Player for the video_id\n player = new HeartBeatPlayer(\n params,\n this.configuration,\n this.appMeasurement\n );\n\n _this.players[player_id] = player;\n //_satellite.notify("---- HEARTBEATTRACKER:",\n // "HBPlayer for --> ",\n // player_id,\n // "",\n // " CREATED!");\n }\n\n // Controllare che la sessione non sia già iniziata\n // Inizio la session tracking (quando cambiano i video senza ADV)\n if (!player.isTrackingSessionActive) {\n _trackSessionStart(params, player);\n player.isTrackingSessionActive = true;\n }\n //_satellite.notify("---- HEARTBEATTRACKER: linkTrackVars: ", s.linkTrackVars);\n }\n\n // VIDEO CORE PLAYBACK\n // Method to track video play\n this.HBTrackPlay = function(params) {\n var player = _this.players[params.player_id];\n\n //_satellite.notify("---- HEARTBEATTRACKER: player state on track play: " , player.player.getState())\n\n // Workaround to convert videoID to String\n if (typeof params.video_data.video_id != "string")\n params.video_data.video_id = params.video_data.video_id.toString();\n\n\n // Check to avoid double playTracking\n if (player.isTracking)\n return false;\n\n // Controllare che la sessione non sia già iniziata\n // Inizio la session tracking (quando cambiano i video senza ADV)\n /*if (!player.isTrackingSessionActive) {\n _trackSessionStart(params, player);\n player.isTrackingSessionActive = true;\n }*/\n\n player.my_mediaHeartbeat.trackPlay();\n\n // Check to avoid double playTracking\n player.isTracking = true;\n //_satellite.notify("---- HEARTBEATTRACKER: ",\n // "HBPlayer -->", params.player_id, "--> PLAYSTART ")\n // _satellite.notify("---- HEARTBEATTRACKER: Video ",\n // params.video_data.video_name);\n }\n\n // Method to track video complete\n this.HBTrackPause = function(params) {\n var player = _this.players[params.player_id];\n\n player.my_mediaHeartbeat.trackPause();\n\n //_satellite.notify("---- HEARTBEATTRACKER:" +\n // " HBPlayer --> " +\n // params.player_id + " TRACK PAUSE called.");\n }\n\n // Method to track video complete\n this.HBTrackComplete = function(params) {\n var player = _this.players[params.player_id];\n\n player.my_mediaHeartbeat.trackComplete();\n\n player.isTracking = false;\n \n //_satellite.notify("---- HEARTBEATTRACKER:",\n // " HBPlayer --> ",\n // params.player_id, " TRACK COMPLETE and SESSION END called.");\n }\n\n // Method to stop the session when the video is unloaded, without completing\n this.destroyHBPlayer = function(params) {\n var player = _this.players[params.player_id];\n\n player.my_mediaHeartbeat.trackSessionEnd();\n\n player.isTracking = false;\n player.isTrackingSessionActive = false;\n\n delete _this.players[params.player_id];\n\n //_satellite.notify("---- HEARTBEATTRACKER:",\n // " HBPlayer --> ",\n // params.player_id, "SESSION END without TRACK COMPLETE called.");\n }\n\n // END VIDEO CORE PLAYBACK\n\n // AD TRACKING\n\n // Method to track AdBreakStart\n // params:\n // - player_id\n // - ad_break_params\n // - ad_break_name: "preroll",\n // - position: 0,\n // - start_time: 0\n\n this.HBTrackAdBreakStart = function(params) {\n // console.log("---- Track Ad Break Start 1")\n\n var player = _this.players[params.player_id];\n\n var _adBreakInfo = ADB.va.MediaHeartbeat.createAdBreakObject(\n params.ad_break_params.ad_break_name,\n params.ad_break_params.position,\n params.ad_break_params.start_time);\n\n // console.log("---- Track Ad Break Start 2")\n\n\n\n player.my_mediaHeartbeat.trackEvent(ADB.va.MediaHeartbeat.Event.AdBreakStart, _adBreakInfo, null);\n\n // console.log("---- Track Ad Break Start 3")\n\n //_satellite.notify("---- HEARTBEATTRACKER:" +\n // " HBPlayer --> " +\n // " --> TRACK AD BREAK START called.");\n }\n\n // Method to track AdStart\n // params:\n // - player_id\n // - ad_params\n // - ad_name\n // - ad_id\n // - position\n // - length\n\n this.HBTrackAdStart = function(params) {\n\n var player = _this.players[params.player_id];\n\n\n var _adObject = ADB.va.MediaHeartbeat.createAdObject(\n params.ad_params.ad_name,\n params.ad_params.ad_id,\n params.ad_params.position,\n params.ad_params.length);\n\n //AD name -> The name of the ad \n //AD id -> The unique id for the ad\n //AD position -> The start position of the ad (number)\n //AD length -> The length of the ad in second (number)\n\n player.my_mediaHeartbeat.trackEvent(ADB.va.MediaHeartbeat.Event.AdStart, _adObject, null);\n\n //_satellite.notify("---- HEARTBEATTRACKER:" +\n // " HBPlayer --> " +\n // params.player_id +\n // " --> AdTitle: " +\n // params.ad_params.ad_name +\n // " --> TRACK AD START called.");\n }\n\n this.HBTrackAdSkip = function(params) {\n var player = _this.players[params.player_id];\n\n //_satellite.notify("---- HEARTBEATTRACKER: player state before skip: " + player.player.getState())\n // [31.01.2019] Rimosso momentaneamente per il live. \n player.my_mediaHeartbeat.trackEvent(ADB.va.MediaHeartbeat.Event.AdSkip);\n\n // _satellite.notify("---- HEARTBEATTRACKER: player state after skip: " + player.player.getState())\n //_satellite.notify("---- HEARTBEATTRACKER:" +\n // " HBPlayer --> " +\n // params.player_id + " TRACK AD SKIP called.");\n }\n\n this.HBTrackAdComplete = function(params) {\n var player = _this.players[params.player_id];\n\n // [31.01.2019] Rimosso momentaneamente per il live.\n player.my_mediaHeartbeat.trackEvent(ADB.va.MediaHeartbeat.Event.AdComplete);\n //player.my_mediaHeartbeat.trackEvent(ADB.va.MediaHeartbeat.Event.AdBreakComplete);\n\n //_satellite.notify("---- HEARTBEATTRACKER:" +\n // " HBPlayer --> " +\n // params.player_id + " TRACK AD COMPLETE called.");\n }\n\n this.HBTrackAdBreakEnd = function(params) {\n var player = _this.players[params.player_id];\n\n player.my_mediaHeartbeat.trackEvent(ADB.va.MediaHeartbeat.Event.AdBreakComplete);\n\n //_satellite.notify("---- HEARTBEATTRACKER:" +\n // " HBPlayer --> " + " TRACK AD BREAK END called.");\n }\n\n // END AD TRACKING\n\n\n // INTERNAL METHOD\n var _trackSessionStart = function(params, player) {\n //_satellite.notify("---- HEARTBEATTRACKER --> _trackSessionStart");\n\n var mediaObject = undefined;\n var customVideoMetadata = params.contextData;\n\n mediaObject = MediaHeartbeat.createMediaObject(params.video_data.video_name,\n params.video_data.video_id,\n params.video_data.video_length,\n params.video_data.video_ovp);\n\n player.my_mediaHeartbeat.trackSessionStart(mediaObject, customVideoMetadata);\n }\n}\n\n\n// Class to manage MediaObjectInstances\nvar HeartBeatPlayer = function(params, Configuration, _appMeasurement) {\n\n var MediaHeartbeat = ADB.va.MediaHeartbeat;\n var MediaHeartbeatConfig = ADB.va.MediaHeartbeatConfig;\n var MediaHeartbeatDelegate = ADB.va.MediaHeartbeatDelegate;\n\n var _this = this;\n this.video_params = params;\n this.player = params.jwPlayerObject;\n\n // Config\n this.mediaConfig = new MediaHeartbeatConfig();\n this.mediaConfig.trackingServer = Configuration.HEARTBEAT.TRACKING_SERVER;\n this.mediaConfig.playerName = Configuration.PLAYER.NAME;\n this.mediaConfig.channel = Configuration.HEARTBEAT.CHANNEL;\n this.mediaConfig.debugLogging = false;\n this.mediaConfig.appVersion = Configuration.HEARTBEAT.SDK;\n this.mediaConfig.ssl = true;\n this.mediaConfig.ovp = Configuration.HEARTBEAT.OVP;\n\n // Delegate\n this.mediaDelegate = new MediaHeartbeatDelegate();\n\n // Replace with the video player current playback time\n this.mediaDelegate.getCurrentPlaybackTime = function() {\n return _this.player.getCurrentTime();\n };\n\n this.mediaDelegate.getQoSObject = function() {\n return MediaHeartbeat.createQoSObject(5000, 0, 24, 10);\n };\n\n this.my_mediaHeartbeat =\n new MediaHeartbeat(this.mediaDelegate, this.mediaConfig, _appMeasurement);\n}', + language: 'javascript' + } + }] + }, + { + id: 'RL60fc69c722dd4693a7df9d9fb0b2405f', + name: '#50 [DR] Tracking CTA AOL', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'track_trackingctaaol_action' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'collam.abbonamento.sky.it', + 'collam.abbonamento-o.sky.it', + 'collprj.abbonamento.sky.it', + 'collprj.abbonamento-o.sky.it', + 'abbonamento.sky.it', + 'abbonamento-o.sky.it', + 'preprod.abbonamento-o.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + console.info('ADOBE LAUNCH - trackingctaaol'), t.pageName = '', t.events = '', t.linkTrackVars = 'events,eVar24,prop54,eVar54,prop55,eVar55,eVar10', t.linkTrackEvents = t.events = 'event16', t.eVar24 = _satellite.getVar('track_trackingctaaol_step'), t.prop54 = window.location.href, t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'trackingctaaol', + linkType: 'o' + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + } + ] + }, + { + id: 'RL5153fa37aa004dc6abcf5d61074064f2', + name: '#50 [DR] Tracking CTA Recontracting', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'track_ctarecontracting' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.pageName = '', t.events = '', t.linkTrackVars = 'events,eVar24,prop54,eVar54,prop55,eVar55', t.linkTrackEvents = t.events = 'event16', t.eVar24 = e.detail.labelcta, t.prop54 = window.location.href, t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'trackingctarecontracting', + linkType: 'o' + } + } + ] + }, + { + id: 'RL41519cdb8ecb40eeb31777df7cf7ecf3', + name: '#55 [ER] [CLICK CORPORATE] SkyQ - Box controllo vocale', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '#da-controllo-vocale.daAccordionItem.closed', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 55 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !!document.location.href.match(/tv\/skyq/); + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'eVar24,eVar55,prop55,events', t.linkTrackEvents = t.events = 'event16', t.eVar24 = 'controllo vocale', t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'click_corporate', + linkType: 'o' + } + } + ] + }, + { + id: 'RL989690915b5847a8a0aaa655c9e8d8b6', + name: '#50 [DR] [ALL] Overlay recontracting-traffico', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'track_recontracting' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + var a = e.detail.page; + t.pageName = _satellite.getVar('[DigitalData] PageName') + a, console.info('Adobe track_recontracting ' + t.pageName), t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RLd70f1476462d476aa72af94ff9b4d5a5', + name: '#50 [DR] Speed Test Configuratore - esito negativo', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'configuratore-speed-test_negativo' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'www.sky.it', + 'collcms.www.sky.it', + 'caem.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.pageName = 'sky:offerte:configuratore-abbonamento-sky:esito-speed-test-negativo', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RL51a96428af8c44b9922e944dcccb4dd1', + name: '#05 [PL] [TARGET] Pagina offerte', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 5 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !(_satellite.cookie.get('ext') || null != _satellite.cookie.get('ext') || !location.href.match(/sky\.it\/offerte/) || location.href.match(/sky\.it\/offerte\?ver=b/)); + } + } + }], + actions: [ + { + modulePath: 'adobe-target-v2/lib/loadTarget.js', + settings: {} + }, + { + modulePath: 'adobe-target-v2/lib/addPageLoadParams.js', + settings: { + params: { + 'prospect-offerte': { + value: 'true', + checked: !0 + } + } + } + }, + { + modulePath: 'adobe-target-v2/lib/firePageLoad.js', + settings: { + bodyHiddenStyle: 'body {opacity: 0}', + bodyHidingEnabled: !0 + } + } + ] + }, + { + id: 'RLac2f2bd3646b47e785738889b2f584e1', + name: '#55 [ER] [CLICK CORPORATE] SkyQ - Box 4k hdr', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '#da-qualita-hdr.daAccordionItem.closed', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 55 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !!document.location.href.match(/tv\/skyq/); + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'eVar24,eVar55,prop55,events', t.linkTrackEvents = t.events = 'event16', t.eVar24 = 'qualità 4k hdr', t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'click_corporate', + linkType: 'o' + } + } + ] + }, + { + id: 'RLf45c5c162f7e417fa811eb3e5aed16be', + name: '#50 [PL] Siti minori Traffico', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'store.sky.it', + 'skygo.sky.it', + 'skygo-test.sky.it', + 'business.skytv.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName = location.href.split(/[?#]/)[0], '' !== _satellite.getVar('[ALL] Query String Parameter Cmp') && (t.campaign = _satellite.getVar('[ALL] Query String Parameter Cmp')), t.pageName && (t.eVar1 = 'D=pageName'), '' !== _satellite.getVar('[ALL] Query String Parameter Intcmp') ? t.eVar10 = _satellite.getVar('[ALL] Query String Parameter Intcmp') : t.eVar10 = '', t.prop50 && (t.eVar50 = 'D=c50'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RLb3eb0ca02b0048e29905e6d6fbc49f29', + name: '#50 [DR] Speed Test Aol Crosspage - esito positivo', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'fibratest_positivo' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'collprj.abbonamento.sky.it', + 'abbonamento.sky.it', + 'collprj.abbonamento-o.sky.it', + 'collam.abbonamento-o.sky.it', + 'collam.abbonamento.sky.it', + 'abbonamento-o.sky.it', + 'preprod.abbonamento-o.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.pageName = 'sky:acquista:crosspage:esito-positivo', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RLe0c0bd990200448eb8e102aab146b9b7', + name: '#50 [PL] [TAG TERZI] FACEBOOK AUDIENCE (Libreria e parametri)', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + const $___old_b1c52360ef818b61 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_b1c52360ef818b61) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_ca918043c745117e.localStorage)); + return function () { + return 'true' === localStorage.getItem('cmpConsentFacebook') && !location.href.match(/file:\/\/\/C\:\//); + }.apply(this, arguments); + } finally { + if ($___old_b1c52360ef818b61) + ({}.constructor.defineProperty(window, 'localStorage', $___old_b1c52360ef818b61)); + } + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '!function(f,b,e,v,n,t,s)\n{if(f.fbq)return;n=f.fbq=function(){n.callMethod?\nn.callMethod.apply(n,arguments):n.queue.push(arguments)};\nif(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version=\'2.0\';\nn.queue=[];t=b.createElement(e);t.async=!0;\nt.src=v;s=b.getElementsByTagName(e)[0];\ns.parentNode.insertBefore(t,s)}(window, document,\'script\',\n\'https://connect.facebook.net/en_US/fbevents.js\');\nfbq(\'init\', \'651818464989826\');\nfbq(\'track\', \'PageView\');\n', + language: 'javascript' + } + }] + }, + { + id: 'RL358fd5009f204d5196dd78c44749c50f', + name: '#50 [DR] Speed Test Aol Crosspage - esito in parte positivo', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'fibratest_inpartepositivo' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'abbonamento.sky.it', + 'collprj.abbonamento.sky.it', + 'collprj.abbonamento-o.sky.it', + 'collam.abbonamento-o.sky.it', + 'collam.abbonamento.sky.it', + 'abbonamento-o.sky.it', + 'preprod.abbonamento-o.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.pageName = 'sky:acquista:crosspage:esito-inpartepositivo', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RLb0d7d15675474d8eb28453d4f826e621', + name: '[DR] [AOL] aolrenewpopup_page (+ TARGET)', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'aolrenewpopup_page' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'collprj.abbonamento.sky.it', + 'abbonamento.sky.it', + 'collam.abbonamento.sky.it', + 'collam.abbonamento-o.sky.it', + 'collprj.abbonamento-o.sky.it', + 'abbonamento-o.sky.it', + 'preprod.abbonamento-o.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + console.info('ADOBE aolrenwepopup'), t.events = t.products = '', t.prop34 = _satellite.getVar('aolrenew_promocode'), t.prop37 = _satellite.getVar('aolrenew_offertype'), t.prop59 = 'aol', t.prop62 = '', t.pageName = _satellite.getVar('aolrenew_pagename'), 'sky:acquista:configura offerta' == _satellite.getVar('aolrenew_pagename') && (window.pagenameBaseAolRenew = 'sky:acquista:configura offerta'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop34 && (t.eVar34 = 'D=c34'), t.prop37 && (t.eVar37 = 'D=c37'), t.prop59 && (t.eVar59 = 'D=c59'), t.eVar98 = ''; + } + }, + trackerProperties: { channel: 'Acquista' } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + }, + { + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/27331c16692c/33a862a7054a/15a1e64eeebe/RC09b92537431446d3b9259ebeee335aa7-source.min.js', + language: 'html', + isExternal: !0 + } + } + ] + }, + { + id: 'RL2e6b34eee47c45229e7fb6ee5a7069f6', + name: '#50 [DR] Speed Test - esito positivo', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'fibratest_positivo' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'www.sky.it', + 'caem.sky.it', + 'collcms.www.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { pageName: 'sky:assistenza:skyviafibratest:esito-positivo' } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RL2f113ac63d2a46249cba052018b4ac6a', + name: '#55 [ER] [CLICK CORPORATE] Index Tv - Box Link Utili Parco ', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '.boxlink.IsParco a.box-link', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 55 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return 'sky:home' == s.pageName; + } + } + }, + { + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'collcms.www.sky.it', + 'preprod-www.sky.it', + 'www.sky.it' + ] + } + } + ], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'eVar24,prop55,eVar55,events', t.linkTrackEvents = t.events = 'event16', t.eVar24 = 'home_linkutili_parco_faidate', t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'click_corporate', + linkType: 'o' + } + } + ] + }, + { + id: 'RL664ff0289eec4fa494f986a80621c6cf', + name: '#55 [ER] [CLICK CORPORATE] Netflix account - Cta attiva subito', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'button.basicTransition#activateButton', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 55 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !!document.location.href.match(/it\/netflix-account/); + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'eVar24,prop55,eVar55,events', t.linkTrackEvents = t.events = 'event16', t.eVar24 = 'attivanetflix_cta_attivasubito_vai-al-faidate', t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'click_corporate', + linkType: 'o' + } + } + ] + }, + { + id: 'RL51fee68dcaa1497b99f5ae5520e0a6ba', + name: '#50 [DR] Landing Disdetta TYP (+ ADFORM)', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'disdetta_typ' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !!location.pathname.match(/\assistenza\/info-disdetta\/sky/); + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'prop54,eVar54,prop55,eVar55', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: { events: [{ name: 'event32' }] } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'disdetta_typ', + linkType: 'o' + } + }, + { + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/27331c16692c/33a862a7054a/15a1e64eeebe/RCac16aee3dccc446da6da4cf3263a5596-source.min.js', + language: 'javascript', + isExternal: !0 + } + } + ] + }, + { + id: 'RLb61910a279a141f98657b33fae2ef9d6', + name: '#55 [ER] [CLICK CORPORATE] Netflix errore - Cta riprova', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '#stepFailRecoverPwd > div > button', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 55 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !!document.location.href.match(/it\/(pagina-errore-netflix|pagina_errore_genericonetflix).*/); + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'eVar24,prop55,eVar55,events', t.linkTrackEvents = t.events = 'event16', t.eVar24 = 'riprova-attivazione-netflix', t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'click_corporate', + linkType: 'o' + } + } + ] + }, + { + id: 'RLa162fc947a9e467ab81f2f852678b1a1', + name: '#50 [DR] Tracking Esito Copertura', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'track_esitocopertura' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.pageName = '', t.events = '', t.linkTrackVars = 'events,eVar24,prop54,eVar54,prop55,eVar55', t.linkTrackEvents = t.events = 'event17', t.eVar24 = e.detail.label, t.prop54 = window.location.href, t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 = window.location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'trackingesitocopertura', + linkType: 'o' + } + } + ] + }, + { + id: 'RL961cfb94689743a29edda716d6bbafa7', + name: '#50 [DR] Workaround QMI cart', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'track_nppqmi' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + console.info('adobe workaround qmi cart'), t.server = location.hostname, t.channel = 'corporate', t.pageName = e.detail.pageName ? e.detail.pageName : '', t.eVar1 = e.detail.pageName ? e.detail.pageName : '', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop2 && (t.eVar2 = 'D=c2'), '' !== e.detail.intcmp && (t.eVar10 = _satellite.getVar('[ALL] Intcmp') ? _satellite.getVar('[ALL] Intcmp') : ''), t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 = location.href.split(/[?#]/)[0], t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 = 'fai da te', t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 = 'offerte per te', t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + } + ] + }, + { + id: 'RL1272ef2ba4a04e2b92472a42108cb5a5', + name: '#50 [ALL] [TAG TERZI] Medallia library', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'collcms.www.sky.it', + 'www.sky.it' + ] + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '(function() {\n var s_mdl = document.createElement(\'script\');\n s_mdl.type = \'text/javascript\';\n s_mdl.async = true;\n s_mdl.src = \'https://resources.digital-cloud.medallia.eu/wdceu/29831/onsite/embed.js\';\n var x_mdl = document.getElementsByTagName(\'script\')[0];\n x_mdl.parentNode.insertBefore(s_mdl, x_mdl);\n})();', + language: 'javascript' + } + }] + }, + { + id: 'RLc0a758fb01ff44c69cd6f01985b444e2', + name: '#50 [ALL] SP CMP opt in', + events: [{ + modulePath: 'core/src/lib/events/domReady.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + global: !0, + source: 'https://assets.adobedtm.com/27331c16692c/33a862a7054a/15a1e64eeebe/RC6b483b6943bf424cb987606c0d5c029d-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RL0049c4520e6e4d2781ab53004f34f174', + name: '#50 [ADOBE] SP CMP', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'collcms.www.sky.it', + 'test.extra.sky.it', + 'collcms.hotclub.sky.it', + 'skygo-test.sky.it', + 'trovahotel.skybusiness.clo.ud.it', + 'trovabar.skybusiness.clo.ud.it', + 'preprod-www.sky.it', + 'www.sky.it', + 'svilcms.www.sky.it', + 'caem.www.sky.it', + 'caem.sky.it', + 'extra.sky.it', + 'hotclub.sky.it', + 'eprocurement.sky.it', + 'preprod.abbonamento.sky.it', + 'collcms.skyacademy.it', + 'skyacademy.it', + 'trovabar.sky.it', + 'trovahotel.sky.it', + 'skygo.sky.it', + 'collcms.eprocurement.sky.it', + 'collcms.skyitalia.sky.it', + 'skyitalia.sky.it' + ] + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '// Il codice JavaScript a seguire verifica puntualmente l\'accettazione del\n// consenso Sky Data Service, scatenando opportuni eventi in gestione al\n// Datalake.\nif (typeof __tcfapi === \'function\') {\n var idSkyDataService = \'6109863b5c1e7805bd9e652f\';\n\n // Gestione registrazione funzione di callback della CMP per "catturare" live\n // o in pageview eventuali interazioni con la gestione dei consensi.\n __tcfapi(\'addEventListener\', 2, function(tcData) {\n if(tcData.eventStatus == \'useractioncomplete\') {\n // Verifica puntuale consensi Sky Data Service\n __tcfapi(\'getCustomVendorConsents\', 2, function(vendorConsents) {\n var skyDataServiceConsent = false;\n\n if (vendorConsents && vendorConsents.consentedVendors) {\n for(var i = 0, size = vendorConsents.consentedVendors.length; i < size; ++i) {\n if(vendorConsents.consentedVendors[i]._id == idSkyDataService) {\n skyDataServiceConsent = \'true\';\n break;\n }\n }\n }\n\n if(skyDataServiceConsent) {\n console.info(\'CMP - Sky Data Service accettato\');\n\n s.linkTrackVars = \'events\';\n s.linkTrackEvents = s.events = \'event200\';\n s.tl(this, \'o\', \'click_cmp_accetta\');\n }\n else {\n console.info(\'CMP - Sky Data Service NON accettato\');\n\n s.linkTrackVars = \'events\';\n s.linkTrackEvents = s.events = \'event199\';\n s.tl(this, \'o\', \'click_cmp_rifiuta\');\n }\n });\n }\n });\n}\nelse {\n console.error("CMP API not available");\n}', + language: 'javascript' + } + }] + }, + { + id: 'RLf2cb079b2c5e4a82aec28f3b3f36d626', + name: '#50 [ADOBE] SP CMP per SPA', + events: [{ + modulePath: 'core/src/lib/events/domReady.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'preprod.abbonamento.sky.it', + 'abbonamento.sky.it', + 'collam.abbonamento.sky.it', + 'collam.abbonamento-o.sky.it', + 'collprj.abbonamento.sky.it', + 'collprj.abbonamento-o.sky.it', + 'preprod.abbonamento-o.sky.it', + 'abbonamento-o.sky.it', + 'skylocator.nohup.it', + 'trova.sky.it' + ] + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/27331c16692c/33a862a7054a/15a1e64eeebe/RC98d917a239c4418999f341da669ce4fd-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RL4c094dd3d3484077950a7f6be017e5b5', + name: '#50 [DR] Page Speed Test Sky.it- esito positivo', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'page-speed-test_positivo' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'svilcms.www.sky.it', + 'caem.www.sky.it', + 'collcms.www.sky.it', + 'www.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + console.info('page-speed-test_positivo'), t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.pageName = 'sky:speed-test:esito-positivo', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RL9c8f99e4c4314710926fda5e6ca1a43e', + name: '#50 [DR] Page Speed Test Sky.it- esito in parte positivo ', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'page-speed-test_inpartepositivo' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'svilcms.www.sky.it', + 'caem.www.sky.it', + 'collcms.www.sky.it', + 'www.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + console.info('page-speed-test_inpartepositivo'), t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.pageName = 'sky:speed-test:esito-inpartepositivo', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RLf2ce974935f24bd8a9d804ddc35f553e', + name: '#50 [DR] Page Speed Test Sky.it- esito negativo', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'page-speed-test_negativo' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'www.sky.it', + 'svilcms.www.sky.it', + 'caem.www.sky.it', + 'collcms.www.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + console.info('page-speed-test_negativo'), t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.pageName = 'sky:speed-test:esito-negativo', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RL6ac2d1d038274844946509a755da1fed', + name: '[DR] Scegli Sky - Glass TYP', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'scegli_skyglass_typ' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'scegli.sky.it', + 'test.scegli.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.pageName = 'sky:scegli:skyglass:typ', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RL17cd5389362241fd8cad5c5d3f0ec95a', + name: '[AOL] TARGET ORDINE CAMPI', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/path.js', + settings: { + paths: [{ + value: '/newaol/abbonationline|/aol/abbonationline', + valueIsRegex: !0 + }] + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '
\n\n', + language: 'html' + } + }] + }, + { + id: 'RL622ead04e3c14a2db0ca6b9fe90f411e', + name: '[PL] SKYIT Login - Dynatrace', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + const $___old_d784cae9bda52535 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_d784cae9bda52535) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_ca918043c745117e.localStorage)); + return function () { + return !('true' !== localStorage.getItem('cmpConsentDynatrace') || !location.href.match(/sky.it\/login(|.*)$/) || location.href.match(/collcms.www.sky.it\/login(|.*)$/)); + }.apply(this, arguments); + } finally { + if ($___old_d784cae9bda52535) + ({}.constructor.defineProperty(window, 'localStorage', $___old_d784cae9bda52535)); + } + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '', + language: 'html' + } + }] + }, + { + id: 'RL2e20e71983e648ef987ddaa3972a4dd3', + name: '#50 [DR] Speed Test Configuratore 3P - esito positivo ', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'configuratore-speed-3p-test_positivo' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'www.sky.it', + 'caem.sky.it', + 'collcms.www.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.pageName = _satellite.getVar('track_trackingpvconfiguratore_step') + ':esito-speed-3p-test-positivo', console.info('3p' + _satellite.getVar('track_trackingpvconfiguratore_step')), t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RL2b4a2c09d82f450bbda262a67e7acf3e', + name: '#50 [DR] Speed Test Configuratore 3P - esito in parte positivo ', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'configuratore-speed-3p-test_inpartepositivo' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'www.sky.it', + 'caem.sky.it', + 'collcms.www.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.pageName = _satellite.getVar('track_trackingpvconfiguratore_step') + ':esito-speed-3p-test-inpartepositivo', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RL6650ce0253db4accbaf508962ee19064', + name: '#50 [DR] Speed Test Configuratore 3P - esito negativo ', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'configuratore-speed-3p-test_negativo' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'www.sky.it', + 'collcms.www.sky.it', + 'caem.sky.it' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.server = _satellite.getVar('[ALL] Server'), t.channel = _satellite.getVar('[DigitalData] Channel') ? _satellite.getVar('[DigitalData] Channel') : '', t.pageName = _satellite.getVar('track_trackingpvconfiguratore_step') + ':esito-speed-3p-test-negativo', t.prop2 = t.getPreviousValue(t.pageName, 'gpv_pn'), t.prop5 = _satellite.getVar('[DigitalData] Quarto Livello') ? _satellite.getVar('[DigitalData] Quarto Livello') : '', t.prop29 = _satellite.getVar('[ALL] Query String Parameter Social') ? _satellite.getVar('[ALL] Query String Parameter Social') : '', t.prop50 = _satellite.getVar('[ALL] External Id') ? _satellite.getVar('[ALL] External Id') : '', t.prop54 = location.href, t.prop55 = location.href.split(/[?#]/)[0], t.prop59 = _satellite.getVar('[DigitalData] Secondo Livello') ? _satellite.getVar('[DigitalData] Secondo Livello') : '', t.prop60 = _satellite.getVar('[DigitalData] Terzo Livello') ? _satellite.getVar('[DigitalData] Terzo Livello') : '', t.prop67 = _satellite.getVar('[ALL] Cookie Login Status'), t.pageName && (t.eVar1 = 'D=pageName'), t.prop2 && (t.eVar2 = 'D=c2'), t.prop5 && (t.eVar5 = 'D=c5'), t.prop54 && (t.eVar54 = 'D=c54'), t.prop55 && (t.eVar55 = 'D=c55'), t.prop59 && (t.eVar59 = 'D=c59'), t.prop60 && (t.eVar60 = 'D=c60'), t.prop67 && (t.eVar67 = 'D=c67'); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + } + ] + }; + }()); + var $___var_21891e6653cc6d36 = function () { + 'use strict'; + function e(e) { + if (null == e) + throw new TypeError('Object.assign cannot be called with null or undefined'); + return Object(e); + } + function t() { + try { + if (!Object.assign) + return !1; + var e = new String('abc'); + if (e[5] = 'de', '5' === Object.getOwnPropertyNames(e)[0]) + return !1; + for (var t = {}, a = 0; a < 10; a++) + t['_' + String.fromCharCode(a)] = a; + if ('0123456789' !== Object.getOwnPropertyNames(t).map(function (e) { + return t[e]; + }).join('')) + return !1; + var n = {}; + return 'abcdefghijklmnopqrst'.split('').forEach(function (e) { + n[e] = e; + }), 'abcdefghijklmnopqrst' === Object.keys(Object.assign({}, n)).join(''); + } catch (e) { + return !1; + } + } + function a(e) { + if (e.__esModule) + return e; + var t = Object.defineProperty({}, '__esModule', { value: !0 }); + return Object.keys(e).forEach(function (a) { + var n = Object.getOwnPropertyDescriptor(e, a); + Object.defineProperty(t, a, n.get ? n : { + enumerable: !0, + get: function () { + return e[a]; + } + }); + }), t; + } + function n(e) { + var t = { exports: {} }; + return e(t, t.exports), t.exports; + } + function r(e) { + var t = this.constructor; + return this.then(function (a) { + return t.resolve(e()).then(function () { + return a; + }); + }, function (a) { + return t.resolve(e()).then(function () { + return t.reject(a); + }); + }); + } + function i(e) { + return Boolean(e && void 0 !== e.length); + } + function o() { + } + function s(e, t) { + return function () { + e.apply(t, arguments); + }; + } + function c(e) { + if (!(this instanceof c)) + throw new TypeError('Promises must be constructed via new'); + if ('function' != typeof e) + throw new TypeError('not a function'); + this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], f(e, this); + } + function l(e, t) { + for (; 3 === e._state;) + e = e._value; + 0 !== e._state ? (e._handled = !0, c._immediateFn(function () { + var a = 1 === e._state ? t.onFulfilled : t.onRejected; + if (null !== a) { + var n; + try { + n = a(e._value); + } catch (e) { + return void d(t.promise, e); + } + u(t.promise, n); + } else + (1 === e._state ? u : d)(t.promise, e._value); + })) : e._deferreds.push(t); + } + function u(e, t) { + try { + if (t === e) + throw new TypeError('A promise cannot be resolved with itself.'); + if (t && ('object' == typeof t || 'function' == typeof t)) { + var a = t.then; + if (t instanceof c) + return e._state = 3, e._value = t, void p(e); + if ('function' == typeof a) + return void f(s(a, t), e); + } + e._state = 1, e._value = t, p(e); + } catch (t) { + d(e, t); + } + } + function d(e, t) { + e._state = 2, e._value = t, p(e); + } + function p(e) { + 2 === e._state && 0 === e._deferreds.length && c._immediateFn(function () { + e._handled || c._unhandledRejectionFn(e._value); + }); + for (var t = 0, a = e._deferreds.length; t < a; t++) + l(e, e._deferreds[t]); + e._deferreds = null; + } + function h(e, t, a) { + this.onFulfilled = 'function' == typeof e ? e : null, this.onRejected = 'function' == typeof t ? t : null, this.promise = a; + } + function f(e, t) { + var a = !1; + try { + e(function (e) { + a || (a = !0, u(t, e)); + }, function (e) { + a || (a = !0, d(t, e)); + }); + } catch (e) { + if (a) + return; + a = !0, d(t, e); + } + } + function g(e) { + return !0 === Ge(e) && '[object Object]' === Object.prototype.toString.call(e); + } + function m(e, t) { + return Object.prototype.hasOwnProperty.call(e, t); + } + function b(e) { + return 'string' == typeof e && -1 !== e.indexOf('[') && -1 !== e.indexOf(']'); + } + function _(e) { + return e.substr(0, e.indexOf('[')); + } + function v(e, t, a) { + if (e.length && We(t)) { + var n = e[0]; + if (1 !== e.length) { + var r = e.slice(1); + if (!b(n)) + return v(r, t[n], a); + var i = t[n = _(n)]; + Array.isArray(i) && i.forEach(function (e) { + return v(r, e, a); + }); + } else + t.hasOwnProperty(n) && 'string' == typeof t[n] && (t[n] = a(t[n])); + } + } + if (window.atob) { + var y = document, k = Object.getOwnPropertySymbols, A = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable, w = t() ? Object.assign : function (t) { + for (var a, n, r = e(t), i = 1; i < arguments.length; i++) { + for (var o in a = Object(arguments[i])) + A.call(a, o) && (r[o] = a[o]); + if (k) { + n = k(a); + for (var s = 0; s < n.length; s++) + S.call(a, n[s]) && (r[n[s]] = a[n[s]]); + } + } + return r; + }, E = w, D = window, I = function (e, t, a) { + var n, r = Array.isArray(t), i = Boolean(r && e), o = document.createElement('a'); + if (o.href = e, (!/^https?:\/\/.*/.test(e) || !o.host) && r) { + var s = new Error('Unable to find the Library Embed Code for Dynamic Host Resolution.'); + throw s.code = 'dynamic_host_resolver_constructor_error', s; + } + if (r && -1 === t.indexOf(o.hostname)) { + var c = new Error('This library is not authorized for this domain. Please contact your CSM for more information.'); + throw c.code = 'dynamic_host_not_allowed', c; + } + var l = function () { + if (null != n) + return n; + if (i) { + var e = o.host; + /:80$/.test(e) ? e = e.replace(':80', '') : /:80\/$/.test(e) ? e = e.replace(':80/', '') : /:443$/.test(e) ? e = e.replace(':443', '') : /:443\/$/.test(e) && (e = e.replace(':443/', '')), n = 'https://' + e; + } else + n = ''; + return n; + }, u = function (e) { + return i && 'string' == typeof e ? [ + l(), + '/' === e.charAt(0) ? e.slice(1) : e + ].join('/') : e; + }, d = { + getTurbineHost: l, + decorateWithDynamicHost: u, + get isDynamicEnforced() { + return r; + } + }; + return D && a.onDebugChanged(function (e) { + e ? D.dynamicHostResolver = d : delete D.dynamicHostResolver; + }), d; + }, T = function (e) { + var t = []; + return e.forEach(function (e) { + e.events && e.events.forEach(function (a) { + t.push({ + rule: e, + event: a + }); + }); + }), t.sort(function (e, t) { + return e.event.ruleOrder - t.event.ruleOrder; + }); + }, P = 'debug', C = function (e, t) { + var a = function () { + return 'true' === e.getItem(P); + }, n = function (t) { + e.setItem(P, t); + }, r = [], i = function (e) { + r.push(e); + }; + return t.outputEnabled = a(), { + onDebugChanged: i, + getDebugEnabled: a, + setDebugEnabled: function (e) { + a() !== e && (n(e), t.outputEnabled = e, r.forEach(function (t) { + t(e); + })); + } + }; + }, V = 'Module did not export a function.', L = function (e, t, a) { + return function (n, r, i) { + i = i || []; + var o = e.getModuleExports(n.modulePath); + if ('function' != typeof o) + throw new Error(V); + var s = e.getModuleDefinition(n.modulePath), c = n.settings || {}; + !n.hasTransformedFilePaths && s.filePaths && (a(c, s.filePaths, n.modulePath), n.hasTransformedFilePaths = !0); + var l = t(c, r); + return o.bind(null, l).apply(null, i); + }; + }, N = function (e) { + return 'string' == typeof e ? e.replace(/\s+/g, ' ').trim() : e; + }, O = { + LOG: 'log', + INFO: 'info', + DEBUG: 'debug', + WARN: 'warn', + ERROR: 'error' + }, M = '\uD83D\uDE80', R = 10 === parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1]) ? '[Launch]' : M, j = !1, x = function (e) { + if (j && window.console) { + var t = Array.prototype.slice.call(arguments, 1); + t.unshift(R), e !== O.DEBUG || window.console[e] || (e = O.INFO), window.console[e].apply(window.console, t); + } + }, B = x.bind(null, O.LOG), F = x.bind(null, O.INFO), H = x.bind(null, O.DEBUG), q = x.bind(null, O.WARN), U = x.bind(null, O.ERROR), z = function () { + var e = j; + j = !0, x.apply(null, Array.prototype.concat(O.WARN, Array.prototype.slice.call(arguments))), e || (j = !1); + }, Y = { + log: B, + info: F, + debug: H, + warn: q, + error: U, + deprecation: z, + get outputEnabled() { + return j; + }, + set outputEnabled(e) { + j = e; + }, + createPrefixedLogger: function (e) { + var t = '[' + e + ']'; + return { + log: B.bind(null, t), + info: F.bind(null, t), + debug: H.bind(null, t), + warn: q.bind(null, t), + error: U.bind(null, t) + }; + } + }, K = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof window ? window : 'undefined' != typeof global ? global : 'undefined' != typeof self ? self : {}, Q = n(function (e) { + !function (t) { + if (e.exports = t(), !!0) { + var a = window.Cookies, n = window.Cookies = t(); + n.noConflict = function () { + return window.Cookies = a, n; + }; + } + }(function () { + function e() { + for (var e = 0, t = {}; e < arguments.length; e++) { + var a = arguments[e]; + for (var n in a) + t[n] = a[n]; + } + return t; + } + function t(e) { + return e.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); + } + function a(n) { + function r() { + } + function i(t, a, i) { + if ('undefined' != typeof document) { + 'number' == typeof (i = e({ path: '/' }, r.defaults, i)).expires && (i.expires = new Date(1 * new Date() + 86400000 * i.expires)), i.expires = i.expires ? i.expires.toUTCString() : ''; + try { + var o = JSON.stringify(a); + /^[\{\[]/.test(o) && (a = o); + } catch (e) { + } + a = n.write ? n.write(a, t) : encodeURIComponent(String(a)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), t = encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape); + var s = ''; + for (var c in i) + i[c] && (s += '; ' + c, !0 !== i[c] && (s += '=' + i[c].split(';')[0])); + return document.cookie = t + '=' + a + s; + } + } + function o(e, a) { + if ('undefined' != typeof document) { + for (var r = {}, i = document.cookie ? document.cookie.split('; ') : [], o = 0; o < i.length; o++) { + var s = i[o].split('='), c = s.slice(1).join('='); + a || '"' !== c.charAt(0) || (c = c.slice(1, -1)); + try { + var l = t(s[0]); + if (c = (n.read || n)(c, l) || t(c), a) + try { + c = JSON.parse(c); + } catch (e) { + } + if (r[l] = c, e === l) + break; + } catch (e) { + } + } + return e ? r[e] : r; + } + } + return r.set = i, r.get = function (e) { + return o(e, !1); + }, r.getJSON = function (e) { + return o(e, !0); + }, r.remove = function (t, a) { + i(t, '', e(a, { expires: -1 })); + }, r.defaults = {}, r.withConverter = a, r; + } + return a(function () { + }); + }); + }), G = { + get: Q.get, + set: Q.set, + remove: Q.remove + }, W = 'com.adobe.reactor.', $ = function (e, t) { + var a = W + (t || ''); + return { + getItem: function (t) { + const $___old_03c8c542bd5c2446 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_03c8c542bd5c2446) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_ca918043c745117e.localStorage)); + return function () { + try { + return D[e].getItem(a + t); + } catch (e) { + return null; + } + }.apply(this, arguments); + } finally { + if ($___old_03c8c542bd5c2446) + ({}.constructor.defineProperty(window, 'localStorage', $___old_03c8c542bd5c2446)); + } + }, + setItem: function (t, n) { + const $___old_1f3579839312c6bc = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_1f3579839312c6bc) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_ca918043c745117e.localStorage)); + return function () { + try { + return D[e].setItem(a + t, n), !0; + } catch (e) { + return !1; + } + }.apply(this, arguments); + } finally { + if ($___old_1f3579839312c6bc) + ({}.constructor.defineProperty(window, 'localStorage', $___old_1f3579839312c6bc)); + } + } + }; + }, J = '_sdsat_', Z = 'dataElements.', X = 'dataElementCookiesMigrated', ee = $('localStorage'), te = $('sessionStorage', Z), ae = $('localStorage', Z), ne = { + PAGEVIEW: 'pageview', + SESSION: 'session', + VISITOR: 'visitor' + }, re = {}, ie = function (e) { + var t; + try { + t = JSON.stringify(e); + } catch (e) { + } + return t; + }, oe = function (e, t, a) { + var n; + switch (t) { + case ne.PAGEVIEW: + return void (re[e] = a); + case ne.SESSION: + return void ((n = ie(a)) && te.setItem(e, n)); + case ne.VISITOR: + return void ((n = ie(a)) && ae.setItem(e, n)); + } + }, se = function (e, t) { + var a = G.get(J + e); + void 0 !== a && oe(e, t, a); + }, ce = function (e) { + ee.getItem(X) || (Object.keys(e).forEach(function (t) { + se(t, e[t].storageDuration); + }), ee.setItem(X, !0)); + }, le = { + setValue: oe, + getValue: function (e, t) { + var a; + switch (t) { + case ne.PAGEVIEW: + return re.hasOwnProperty(e) ? re[e] : null; + case ne.SESSION: + return null === (a = te.getItem(e)) ? a : JSON.parse(a); + case ne.VISITOR: + return null === (a = ae.getItem(e)) ? a : JSON.parse(a); + } + }, + migrateCookieData: ce + }, ue = function (e, t, a, n) { + return 'Failed to execute data element module ' + e.modulePath + ' for data element ' + t + '. ' + a + (n ? '\n' + n : ''); + }, de = function (e, t, a, n, r) { + return function (i, o) { + var s = t(i); + if (!s) + return n ? '' : void 0; + var c, l, u = s.storageDuration; + try { + c = e.getModuleExports(s.modulePath), l = e.getModuleDefinition(s.modulePath); + } catch (e) { + return void Y.error(ue(s, i, e.message, e.stack)); + } + if ('function' == typeof c) { + var d, p = s.settings || {}; + !s.hasTransformedFilePaths && l.filePaths && (r(p, l.filePaths, s.modulePath), s.hasTransformedFilePaths = !0); + try { + d = c(a(p, o), o); + } catch (e) { + return void Y.error(ue(s, i, e.message, e.stack)); + } + return u && (null != d ? le.setValue(i, u, d) : d = le.getValue(i, u)), null == d && null != s.defaultValue && (d = s.defaultValue), 'string' == typeof d && (s.cleanText && (d = N(d)), s.forceLowerCase && (d = d.toLowerCase())), d; + } + Y.error(ue(s, i, 'Module did not export a function.')); + }; + }, pe = { + text: function (e) { + return e.textContent; + }, + cleanText: function (e) { + return N(e.textContent); + } + }, he = function (e, t, a) { + for (var n, r = e, i = 0, o = t.length; i < o; i++) { + if (null == r) + return; + var s = t[i]; + if (a && '@' === s.charAt(0)) { + var c = s.slice(1); + r = pe[c](r); + } else if (r.getAttribute && (n = s.match(/^getAttribute\((.+)\)$/))) { + var l = n[1]; + r = r.getAttribute(l); + } else + r = r[s]; + } + return r; + }, fe = function (e, t, a) { + return function (n, r) { + var i; + if (t(n)) + i = a(n, r); + else { + var o = n.split('.'), s = o.shift(); + 'this' === s ? r && (i = he(r.element, o, !0)) : 'event' === s ? r && (i = he(r, o)) : 'target' === s ? r && (i = he(r.target, o)) : i = he(e[s], o); + } + return i; + }; + }, ge = function (e, t) { + return function (a) { + var n = a.split('.')[0]; + return Boolean(t(a) || 'this' === n || 'event' === n || 'target' === n || e.hasOwnProperty(n)); + }; + }, me = function (e, t, a) { + var n = { exports: {} }; + return e.call(n.exports, n, n.exports, t, a), n.exports; + }, be = function () { + var e = {}, t = function (t) { + var a = e[t]; + if (!a) + throw new Error('Module ' + t + ' not found.'); + return a; + }, a = function () { + Object.keys(e).forEach(function (e) { + try { + n(e); + } catch (a) { + var t = 'Error initializing module ' + e + '. ' + a.message + (a.stack ? '\n' + a.stack : ''); + Y.error(t); + } + }); + }, n = function (e) { + var a = t(e); + return a.hasOwnProperty('exports') || (a.exports = me(a.definition.script, a.require, a.turbine)), a.exports; + }; + return { + registerModule: function (t, a, n, r, i) { + var o = { + definition: a, + extensionName: n, + require: r, + turbine: i + }; + o.require = r, e[t] = o; + }, + hydrateCache: a, + getModuleExports: n, + getModuleDefinition: function (e) { + return t(e).definition; + }, + getModuleExtensionName: function (e) { + return t(e).extensionName; + } + }; + }, _e = !1, ve = function (e) { + return function (t, a) { + var n = e._monitors; + n && (_e || (Y.warn('The _satellite._monitors API may change at any time and should only be used for debugging.'), _e = !0), n.forEach(function (e) { + e[t] && e[t](a); + })); + }; + }, ye = function (e, t, a) { + var n, r, i, o, s = [], c = function (n, r, i) { + if (!e(r)) + return n; + s.push(r); + var o = t(r, i); + return s.pop(), null == o && a ? '' : o; + }; + return n = function (e, t) { + var a = /^%([^%]+)%$/.exec(e); + return a ? c(e, a[1], t) : e.replace(/%(.+?)%/g, function (e, a) { + return c(e, a, t); + }); + }, r = function (e, t) { + for (var a = {}, n = Object.keys(e), r = 0; r < n.length; r++) { + var i = n[r], s = e[i]; + a[i] = o(s, t); + } + return a; + }, i = function (e, t) { + for (var a = [], n = 0, r = e.length; n < r; n++) + a.push(o(e[n], t)); + return a; + }, o = function (e, t) { + return 'string' == typeof e ? n(e, t) : Array.isArray(e) ? i(e, t) : 'object' == typeof e && null !== e ? r(e, t) : e; + }, function (e, t) { + return s.length > 10 ? (Y.error('Data element circular reference detected: ' + s.join(' -> ')), e) : o(e, t); + }; + }, ke = function (e) { + return function () { + if ('string' == typeof arguments[0]) + e[arguments[0]] = arguments[1]; + else if (arguments[0]) { + var t = arguments[0]; + for (var a in t) + e[a] = t[a]; + } + }; + }, Ae = setTimeout; + c.prototype.catch = function (e) { + return this.then(null, e); + }, c.prototype.then = function (e, t) { + var a = new this.constructor(o); + return l(this, new h(e, t, a)), a; + }, c.prototype.finally = r, c.all = function (e) { + return new c(function (t, a) { + function n(e, i) { + try { + if (i && ('object' == typeof i || 'function' == typeof i)) { + var s = i.then; + if ('function' == typeof s) + return void s.call(i, function (t) { + n(e, t); + }, a); + } + r[e] = i, 0 == --o && t(r); + } catch (e) { + a(e); + } + } + if (!i(e)) + return a(new TypeError('Promise.all accepts an array')); + var r = Array.prototype.slice.call(e); + if (0 === r.length) + return t([]); + for (var o = r.length, s = 0; s < r.length; s++) + n(s, r[s]); + }); + }, c.resolve = function (e) { + return e && 'object' == typeof e && e.constructor === c ? e : new c(function (t) { + t(e); + }); + }, c.reject = function (e) { + return new c(function (t, a) { + a(e); + }); + }, c.race = function (e) { + return new c(function (t, a) { + if (!i(e)) + return a(new TypeError('Promise.race accepts an array')); + for (var n = 0, r = e.length; n < r; n++) + c.resolve(e[n]).then(t, a); + }); + }, c._immediateFn = 'function' == typeof setImmediate && function (e) { + setImmediate(e); + } || function (e) { + Ae(e, 0); + }, c._unhandledRejectionFn = function (e) { + 'undefined' != typeof console && console && console.warn('Possible Unhandled Promise Rejection:', e); + }; + var Se = a(Object.freeze({ + __proto__: null, + default: c + })), we = 'undefined' != typeof window && window.Promise || void 0 !== K && K.Promise || Se.default || Se, Ee = function (e, t, a) { + return function (n, r, i, o) { + return o.then(function () { + var o, s = n.delayNext; + return new we(function (t, a) { + var r = e(n, i, [i]); + if (!s) + return t(); + var c = n.timeout, l = new we(function (e, t) { + o = setTimeout(function () { + t(new Error('A timeout occurred because the action took longer than ' + c / 1000 + ' seconds to complete. ')); + }, c); + }); + we.race([ + r, + l + ]).then(t, a); + }).catch(function (e) { + return clearTimeout(o), e = t(e), a(n, r, e), we.reject(e); + }).then(function () { + clearTimeout(o); + }); + }); + }; + }, De = function (e, t, a, n, r) { + return function (i, o, s, c) { + return c.then(function () { + var c; + return new we(function (t, a) { + var n = e(i, s, [s]), r = i.timeout, o = new we(function (e, t) { + c = setTimeout(function () { + t(new Error('A timeout occurred because the condition took longer than ' + r / 1000 + ' seconds to complete. ')); + }, r); + }); + we.race([ + n, + o + ]).then(t, a); + }).catch(function (e) { + return clearTimeout(c), e = t(e), n(i, o, e), we.reject(e); + }).then(function (e) { + if (clearTimeout(c), !a(i, e)) + return r(i, o), we.reject(); + }); + }); + }; + }, Ie = we.resolve(), Te = function (e, t, a) { + return function (n, r) { + return n.conditions && n.conditions.forEach(function (t) { + Ie = e(t, n, r, Ie); + }), n.actions && n.actions.forEach(function (e) { + Ie = t(e, n, r, Ie); + }), Ie = (Ie = Ie.then(function () { + a(n); + })).catch(function () { + }); + }; + }, Pe = function (e) { + return Boolean(e && 'object' == typeof e && 'function' == typeof e.then); + }, Ce = function (e, t, a, n) { + return function (r, i) { + var o; + if (r.conditions) + for (var s = 0; s < r.conditions.length; s++) { + o = r.conditions[s]; + try { + var c = e(o, i, [i]); + if (Pe(c)) + throw new Error('Rule component sequencing must be enabled on the property for this condition to function properly.'); + if (!t(o, c)) + return a(o, r), !1; + } catch (e) { + return n(o, r, e), !1; + } + } + return !0; + }; + }, Ve = function (e, t) { + return function (a, n) { + e(a, n) && t(a, n); + }; + }, Le = function (e) { + return function (t) { + var a = e.getModuleDefinition(t.modulePath); + return a && a.displayName || t.modulePath; + }; + }, Ne = function (e) { + return function (t) { + var a = t.rule, n = t.event, r = e.getModuleDefinition(n.modulePath).name; + return { + $type: e.getModuleExtensionName(n.modulePath) + '.' + r, + $rule: { + id: a.id, + name: a.name + } + }; + }; + }, Oe = function (e, t, a, n, r, i) { + return function (o, s) { + var c = s.rule, l = s.event; + l.settings = l.settings || {}; + try { + var u = r(s); + t(l, null, [function (t) { + var n = a(u, t); + o(function () { + e(n, c); + }); + }]); + } catch (e) { + i.error(n(l, c, e)); + } + }; + }, Me = function (e, t, a, n) { + return function (r, i, o) { + var s = t(r); + a.error(e(s, i.name, o)), n('ruleActionFailed', { + rule: i, + action: r + }); + }; + }, Re = function (e, t, a, n) { + return function (r, i, o) { + var s = t(r); + a.error(e(s, i.name, o)), n('ruleConditionFailed', { + rule: i, + condition: r + }); + }; + }, je = function (e, t, a) { + return function (n, r) { + var i = e(n); + t.log('Condition "' + i + '" for rule "' + r.name + '" was not met.'), a('ruleConditionFailed', { + rule: r, + condition: n + }); + }; + }, xe = function (e, t) { + return function (a) { + e.log('Rule "' + a.name + '" fired.'), t('ruleCompleted', { rule: a }); + }; + }, Be = function (e, t, a) { + return function (n, r) { + var i; + if (n.actions) + for (var o = 0; o < n.actions.length; o++) { + i = n.actions[o]; + try { + e(i, r, [r]); + } catch (e) { + return void t(i, n, e); + } + } + a(n); + }; + }, Fe = function (e, t, a, n) { + return function (r, i) { + n('ruleTriggered', { rule: i }), e ? a(i, r) : t(i, r); + }; + }, He = function (e, t, a) { + return 'Failed to execute "' + e + '" for "' + t + '" rule. ' + a.message + (a.stack ? '\n' + a.stack : ''); + }, qe = function (e, t) { + return t && !e.negate || !t && e.negate; + }, Ue = [], ze = !1, Ye = function (e) { + ze ? e() : Ue.push(e); + }, Ke = function (e, t, a) { + e(t).forEach(function (e) { + a(Ye, e); + }), ze = !0, Ue.forEach(function (e) { + e(); + }), Ue = []; + }, Qe = function (e) { + if (e || (e = new Error('The extension triggered an error, but no error information was provided.')), !(e instanceof Error)) { + var t = 'object' == typeof e ? JSON.stringify(e) : String(e); + e = new Error(t); + } + return e; + }, Ge = function (e) { + return null != e && 'object' == typeof e && !1 === Array.isArray(e); + }, We = function (e) { + var t, a; + return !1 !== g(e) && ('function' == typeof (t = e.constructor) && (!1 !== g(a = t.prototype) && !1 !== a.hasOwnProperty('isPrototypeOf'))); + }, $e = function (e, t) { + return We(t = t || {}) ? t = E({}, t, e) : E(t, e), t.hasOwnProperty('type') || Object.defineProperty(t, 'type', { + get: function () { + return Y.deprecation('Accessing event.type in Adobe Launch has been deprecated and will be removed soon. Please use event.$type instead.'), t.$type; + } + }), t; + }, Je = function (e, t) { + return function (a, n) { + var r = e[a]; + if (r) { + var i = r.modules; + if (i) + for (var o = Object.keys(i), s = 0; s < o.length; s++) { + var c = o[s], l = i[c]; + if (l.shared && l.name === n) + return t.getModuleExports(c); + } + } + }; + }, Ze = function (e, t) { + return function () { + return t ? e(t) : {}; + }; + }, Xe = function (e, t, a) { + return function (n) { + if (a) { + var r = n.split('.'); + r.splice(r.length - 1 || 1, 0, 'min'), n = r.join('.'); + } + return e(t) + n; + }; + }, et = '.js', tt = function (e) { + return e.substr(0, e.lastIndexOf('/')); + }, at = function (e, t) { + return -1 !== e.indexOf(t, e.length - t.length); + }, nt = function (e, t) { + at(t, et) || (t += et); + var a = t.split('/'), n = tt(e).split('/'); + return a.forEach(function (e) { + e && '.' !== e && ('..' === e ? n.length && n.pop() : n.push(e)); + }), n.join('/'); + }, rt = function (e, t) { + return new we(function (a, n) { + t.onload = function () { + a(t); + }, t.onerror = function () { + n(new Error('Failed to load script ' + e)); + }; + }); + }, it = function (e) { + var t = document.createElement('script'); + t.src = e, t.async = !0; + var a = rt(e, t); + return document.getElementsByTagName('head')[0].appendChild(t), a; + }, ot = function (e, t, a, n) { + t = t || '&', a = a || '='; + var r = {}; + if ('string' != typeof e || 0 === e.length) + return r; + var i = /\+/g; + e = e.split(t); + var o = 1000; + n && 'number' == typeof n.maxKeys && (o = n.maxKeys); + var s = e.length; + o > 0 && s > o && (s = o); + for (var c = 0; c < s; ++c) { + var l, u, d, p, h = e[c].replace(i, '%20'), f = h.indexOf(a); + f >= 0 ? (l = h.substr(0, f), u = h.substr(f + 1)) : (l = h, u = ''), d = decodeURIComponent(l), p = decodeURIComponent(u), m(r, d) ? Array.isArray(r[d]) ? r[d].push(p) : r[d] = [ + r[d], + p + ] : r[d] = p; + } + return r; + }, st = function (e) { + switch (typeof e) { + case 'string': + return e; + case 'boolean': + return e ? 'true' : 'false'; + case 'number': + return isFinite(e) ? e : ''; + default: + return ''; + } + }, ct = function (e, t, a, n) { + return t = t || '&', a = a || '=', null === e && (e = void 0), 'object' == typeof e ? Object.keys(e).map(function (n) { + var r = encodeURIComponent(st(n)) + a; + return Array.isArray(e[n]) ? e[n].map(function (e) { + return r + encodeURIComponent(st(e)); + }).join(t) : r + encodeURIComponent(st(e[n])); + }).join(t) : n ? encodeURIComponent(st(n)) + a + encodeURIComponent(st(e)) : ''; + }, lt = n(function (e, t) { + t.decode = t.parse = ot, t.encode = t.stringify = ct; + }), ut = '@adobe/reactor-', dt = { + cookie: G, + document: y, + 'load-script': it, + 'object-assign': E, + promise: we, + 'query-string': { + parse: function (e) { + return 'string' == typeof e && (e = e.trim().replace(/^[?#&]/, '')), lt.parse(e); + }, + stringify: function (e) { + return lt.stringify(e); + } + }, + window: D + }, pt = function (e) { + return function (t) { + if (0 === t.indexOf(ut)) { + var a = t.substr(ut.length), n = dt[a]; + if (n) + return n; + } + if (0 === t.indexOf('./') || 0 === t.indexOf('../')) + return e(t); + throw new Error('Cannot resolve module "' + t + '".'); + }; + }, ht = function (e, t, a, n, r, i, o) { + var s = e.extensions, c = e.buildInfo, l = e.environment, u = e.property.settings; + if (s) { + var d = Je(s, t); + Object.keys(s).forEach(function (p) { + var h = s[p], f = h.settings; + Array.isArray(h.filePaths) && (f = i(f, h.filePaths)); + var g = Ze(n, f); + if (h.modules) { + var m = Y.createPrefixedLogger(h.displayName), b = Xe(o, h.hostedLibFilesBaseUrl, c.minified), _ = { + buildInfo: c, + environment: l, + property: { + name: e.property.name, + id: e.property.id + }, + getDataElementValue: r, + getExtensionSettings: g, + getHostedLibFileUrl: b, + getSharedModule: d, + logger: m, + propertySettings: u, + replaceTokens: n, + onDebugChanged: a.onDebugChanged, + get debugEnabled() { + return a.getDebugEnabled(); + } + }; + Object.keys(h.modules).forEach(function (e) { + var a = h.modules[e], n = pt(function (a) { + var n = nt(e, a); + return t.getModuleExports(n); + }); + t.registerModule(e, a, p, n, _); + }); + } + }), t.hydrateCache(); + } + return t; + }, ft = function (e, t, a, n, r) { + var i = Y.createPrefixedLogger('Custom Script'); + e.track = function (e) { + Y.log('"' + e + '" does not match any direct call identifiers.'); + }, e.getVisitorId = function () { + return null; + }, e.property = { + name: t.property.name, + id: t.property.id + }, e.company = t.company, e.buildInfo = t.buildInfo, e.environment = t.environment, e.logger = i, e.notify = function (e, t) { + switch (Y.deprecation('_satellite.notify is deprecated. Please use the `_satellite.logger` API.'), t) { + case 3: + i.info(e); + break; + case 4: + i.warn(e); + break; + case 5: + i.error(e); + break; + default: + i.log(e); + } + }, e.getVar = n, e.setVar = r, e.setCookie = function (e, t, a) { + var n = '', r = {}; + a && (n = ', { expires: ' + a + ' }', r.expires = a); + var i = '_satellite.setCookie is deprecated. Please use _satellite.cookie.set("' + e + '", "' + t + '"' + n + ').'; + Y.deprecation(i), G.set(e, t, r); + }, e.readCookie = function (e) { + return Y.deprecation('_satellite.readCookie is deprecated. Please use _satellite.cookie.get("' + e + '").'), G.get(e); + }, e.removeCookie = function (e) { + Y.deprecation('_satellite.removeCookie is deprecated. Please use _satellite.cookie.remove("' + e + '").'), G.remove(e); + }, e.cookie = G, e.pageBottom = function () { + }, e.setDebug = a; + var o = !1; + Object.defineProperty(e, '_container', { + get: function () { + return o || (Y.warn('_satellite._container may change at any time and should only be used for debugging.'), o = !0), t; + } + }); + }, gt = function (e) { + for (var t = y.querySelectorAll('script'), a = 0; a < t.length; a++) { + var n = t[a]; + if (e.test(n.src)) + return n; + } + }, mt = function (e, t) { + return function (a, n, r) { + return e && We(a) && Object.keys(a).length && Array.isArray(n) && n.length ? (n.forEach(function (e) { + Boolean(null != r && /^core\/.*actions.*\/customCode\.js$/.test(r)) && 'source' === e && !a.isExternal || v(e.split('.'), a, t); + }), a) : a; + }; + }, bt = { + getTurbine: function () { + return gt(new RegExp(/(launch|satelliteLib)-[^\/]+.js(\?.*)?$/)); + }, + byRegexPattern: gt + }.getTurbine, _t = window._satellite; + if (_t && !window.__satelliteLoaded) { + window.__satelliteLoaded = !0; + var vt = _t.container; + delete _t.container; + var yt = E({}, vt.buildInfo); + Object.defineProperty(yt, 'environment', { + get: function () { + return Y.deprecation('container.buildInfo.environment is deprecated.Please use `container.environment.stage` instead'), vt.environment.stage; + } + }), vt.buildInfo = yt; + var kt, At = C($('localStorage'), Y), St = ''; + y.currentScript && y.currentScript.getAttribute('src') ? St = y.currentScript.getAttribute('src') : bt() && (St = bt().getAttribute('src')); + try { + kt = I(St, vt.company.cdnAllowList, At); + } catch (e) { + throw Y.warn('Please review the following error:'), e; + } + var wt, Et = mt(kt.isDynamicEnforced, kt.decorateWithDynamicHost), Dt = be(), It = vt.property.settings.undefinedVarsReturnEmpty, Tt = vt.property.settings.ruleComponentSequencingEnabled, Pt = vt.dataElements || {}; + le.migrateCookieData(Pt); + var Ct = function (e) { + return Pt[e]; + }, Vt = function () { + return wt.apply(null, arguments); + }, Lt = de(Dt, Ct, Vt, It, Et), Nt = {}, Ot = ke(Nt), Mt = ge(Nt, Ct), Rt = fe(Nt, Ct, Lt); + wt = ye(Mt, Rt, It), ft(_t, vt, At.setDebugEnabled, Rt, Ot), ht(vt, Dt, At, wt, Lt, Et, kt.decorateWithDynamicHost); + var jt = ve(_t), xt = L(Dt, wt, Et), Bt = Le(Dt), Ft = je(Bt, Y, jt), Ht = Re(He, Bt, Y, jt), qt = Me(He, Bt, Y, jt), Ut = xe(Y, jt), zt = Oe(Fe(Tt, Ve(Ce(xt, qe, Ft, Ht), Be(xt, qt, Ut)), Te(De(xt, Qe, qe, Ht, Ft), Ee(xt, Qe, qt), Ut), jt), xt, $e, He, Ne(Dt), Y); + Ke(T, vt.rules || [], zt); + } + return _t; + } + console.warn('Adobe Launch is unsupported in IE 9 and below.'); + }(); + _satellite = $___var_21891e6653cc6d36; + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-0df9436bcc867b94a71bac256f2dba3713a377a0 b/resources/sugarcoat-0df9436bcc867b94a71bac256f2dba3713a377a0 new file mode 100644 index 00000000..8e0764e9 --- /dev/null +++ b/resources/sugarcoat-0df9436bcc867b94a71bac256f2dba3713a377a0 @@ -0,0 +1,7146 @@ +{ + const $___mock_cb5c8f55a9bbea8b = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_cb5c8f55a9bbea8b); + (function () { + (function (E) { + var window = this; + if (window.googletag && googletag.evalScripts) { + googletag.evalScripts(); + } + if (window.googletag && googletag._loaded_) + return; + var aa, ba = function (a) { + var b = 0; + return function () { + return b < a.length ? { + done: !1, + value: a[b++] + } : { done: !0 }; + }; + }, ca = 'function' == typeof Object.defineProperties ? Object.defineProperty : function (a, b, c) { + if (a == Array.prototype || a == Object.prototype) + return a; + a[b] = c.value; + return a; + }, da = function (a) { + a = [ + 'object' == typeof globalThis && globalThis, + a, + 'object' == typeof window && window, + 'object' == typeof self && self, + 'object' == typeof global && global + ]; + for (var b = 0; b < a.length; ++b) { + var c = a[b]; + if (c && c.Math == Math) + return c; + } + throw Error('Cannot find global object'); + }, ea = da(this), ha = 'function' === typeof Symbol && 'symbol' === typeof Symbol('x'), m = {}, ia = {}, p = function (a, b) { + var c = ia[b]; + if (null == c) + return a[b]; + c = a[c]; + return void 0 !== c ? c : a[b]; + }, r = function (a, b, c) { + if (b) + a: { + var d = a.split('.'); + a = 1 === d.length; + var e = d[0], f; + !a && e in m ? f = m : f = ea; + for (e = 0; e < d.length - 1; e++) { + var h = d[e]; + if (!(h in f)) + break a; + f = f[h]; + } + d = d[d.length - 1]; + c = ha && 'es6' === c ? f[d] : null; + b = b(c); + null != b && (a ? ca(m, d, { + configurable: !0, + writable: !0, + value: b + }) : b !== c && (void 0 === ia[d] && (a = 1000000000 * Math.random() >>> 0, ia[d] = ha ? ea.Symbol(d) : '$jscp$' + a + '$' + d), ca(f, ia[d], { + configurable: !0, + writable: !0, + value: b + }))); + } + }; + r('Symbol', function (a) { + if (a) + return a; + var b = function (f, h) { + this.g = f; + ca(this, 'description', { + configurable: !0, + writable: !0, + value: h + }); + }; + b.prototype.toString = function () { + return this.g; + }; + var c = 'jscomp_symbol_' + (1000000000 * Math.random() >>> 0) + '_', d = 0, e = function (f) { + if (this instanceof e) + throw new TypeError('Symbol is not a constructor'); + return new b(c + (f || '') + '_' + d++, f); + }; + return e; + }, 'es6'); + r('Symbol.iterator', function (a) { + if (a) + return a; + a = (0, m.Symbol)('Symbol.iterator'); + for (var b = 'Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' '), c = 0; c < b.length; c++) { + var d = ea[b[c]]; + 'function' === typeof d && 'function' != typeof d.prototype[a] && ca(d.prototype, a, { + configurable: !0, + writable: !0, + value: function () { + return ja(ba(this)); + } + }); + } + return a; + }, 'es6'); + var ja = function (a) { + a = { next: a }; + a[p(m.Symbol, 'iterator')] = function () { + return this; + }; + return a; + }, ka = function (a) { + return a.raw = a; + }, t = function (a) { + var b = 'undefined' != typeof m.Symbol && p(m.Symbol, 'iterator') && a[p(m.Symbol, 'iterator')]; + return b ? b.call(a) : { next: ba(a) }; + }, la = function (a) { + for (var b, c = []; !(b = a.next()).done;) + c.push(b.value); + return c; + }, u = function (a) { + return a instanceof Array ? a : la(t(a)); + }, ma = 'function' == typeof Object.create ? Object.create : function (a) { + var b = function () { + }; + b.prototype = a; + return new b(); + }, na; + if (ha && 'function' == typeof Object.setPrototypeOf) + na = Object.setPrototypeOf; + else { + var oa; + a: { + var pa = { a: !0 }, qa = {}; + try { + qa.__proto__ = pa; + oa = qa.a; + break a; + } catch (a) { + } + oa = !1; + } + na = oa ? function (a, b) { + a.__proto__ = b; + if (a.__proto__ !== b) + throw new TypeError(a + ' is not extensible'); + return a; + } : null; + } + var ra = na, v = function (a, b) { + a.prototype = ma(b.prototype); + a.prototype.constructor = a; + if (ra) + ra(a, b); + else + for (var c in b) + if ('prototype' != c) + if (Object.defineProperties) { + var d = Object.getOwnPropertyDescriptor(b, c); + d && Object.defineProperty(a, c, d); + } else + a[c] = b[c]; + a.Aa = b.prototype; + }, w = function () { + for (var a = Number(this), b = [], c = a; c < arguments.length; c++) + b[c - a] = arguments[c]; + return b; + }, x = function (a, b) { + return Object.prototype.hasOwnProperty.call(a, b); + }, sa = ha && 'function' == typeof p(Object, 'assign') ? p(Object, 'assign') : function (a, b) { + for (var c = 1; c < arguments.length; c++) { + var d = arguments[c]; + if (d) + for (var e in d) + x(d, e) && (a[e] = d[e]); + } + return a; + }; + r('Object.assign', function (a) { + return a || sa; + }, 'es6'); + r('Array.prototype.find', function (a) { + return a ? a : function (b, c) { + a: { + var d = this; + d instanceof String && (d = String(d)); + for (var e = d.length, f = 0; f < e; f++) { + var h = d[f]; + if (b.call(c, h, f, d)) { + b = h; + break a; + } + } + b = void 0; + } + return b; + }; + }, 'es6'); + r('WeakMap', function (a) { + function b() { + } + function c(h) { + var g = typeof h; + return 'object' === g && null !== h || 'function' === g; + } + if (function () { + if (!a || !Object.seal) + return !1; + try { + var h = Object.seal({}), g = Object.seal({}), k = new a([ + [ + h, + 2 + ], + [ + g, + 3 + ] + ]); + if (2 != k.get(h) || 3 != k.get(g)) + return !1; + k.delete(h); + k.set(g, 4); + return !k.has(h) && 4 == k.get(g); + } catch (l) { + return !1; + } + }()) + return a; + var d = '$jscomp_hidden_' + Math.random(), e = 0, f = function (h) { + this.g = (e += Math.random() + 1).toString(); + if (h) { + h = t(h); + for (var g; !(g = h.next()).done;) + g = g.value, this.set(g[0], g[1]); + } + }; + f.prototype.set = function (h, g) { + if (!c(h)) + throw Error('Invalid WeakMap key'); + if (!x(h, d)) { + var k = new b(); + ca(h, d, { value: k }); + } + if (!x(h, d)) + throw Error('WeakMap key fail: ' + h); + h[d][this.g] = g; + return this; + }; + f.prototype.get = function (h) { + return c(h) && x(h, d) ? h[d][this.g] : void 0; + }; + f.prototype.has = function (h) { + return c(h) && x(h, d) && x(h[d], this.g); + }; + f.prototype.delete = function (h) { + return c(h) && x(h, d) && x(h[d], this.g) ? delete h[d][this.g] : !1; + }; + return f; + }, 'es6'); + r('Map', function (a) { + if (function () { + if (!a || 'function' != typeof a || !a.prototype.entries || 'function' != typeof Object.seal) + return !1; + try { + var g = Object.seal({ x: 4 }), k = new a(t([[ + g, + 's' + ]])); + if ('s' != k.get(g) || 1 != k.size || k.get({ x: 4 }) || k.set({ x: 4 }, 't') != k || 2 != k.size) + return !1; + var l = k.entries(), n = l.next(); + if (n.done || n.value[0] != g || 's' != n.value[1]) + return !1; + n = l.next(); + return n.done || 4 != n.value[0].x || 't' != n.value[1] || !l.next().done ? !1 : !0; + } catch (q) { + return !1; + } + }()) + return a; + var b = new m.WeakMap(), c = function (g) { + this.h = {}; + this.g = f(); + this.size = 0; + if (g) { + g = t(g); + for (var k; !(k = g.next()).done;) + k = k.value, this.set(k[0], k[1]); + } + }; + c.prototype.set = function (g, k) { + g = 0 === g ? 0 : g; + var l = d(this, g); + l.list || (l.list = this.h[l.id] = []); + l.m ? l.m.value = k : (l.m = { + next: this.g, + u: this.g.u, + head: this.g, + key: g, + value: k + }, l.list.push(l.m), this.g.u.next = l.m, this.g.u = l.m, this.size++); + return this; + }; + c.prototype.delete = function (g) { + g = d(this, g); + return g.m && g.list ? (g.list.splice(g.index, 1), g.list.length || delete this.h[g.id], g.m.u.next = g.m.next, g.m.next.u = g.m.u, g.m.head = null, this.size--, !0) : !1; + }; + c.prototype.clear = function () { + this.h = {}; + this.g = this.g.u = f(); + this.size = 0; + }; + c.prototype.has = function (g) { + return !!d(this, g).m; + }; + c.prototype.get = function (g) { + return (g = d(this, g).m) && g.value; + }; + c.prototype.entries = function () { + return e(this, function (g) { + return [ + g.key, + g.value + ]; + }); + }; + c.prototype.keys = function () { + return e(this, function (g) { + return g.key; + }); + }; + c.prototype.values = function () { + return e(this, function (g) { + return g.value; + }); + }; + c.prototype.forEach = function (g, k) { + for (var l = this.entries(), n; !(n = l.next()).done;) + n = n.value, g.call(k, n[1], n[0], this); + }; + c.prototype[p(m.Symbol, 'iterator')] = c.prototype.entries; + var d = function (g, k) { + var l = k && typeof k; + 'object' == l || 'function' == l ? b.has(k) ? l = b.get(k) : (l = '' + ++h, b.set(k, l)) : l = 'p_' + k; + var n = g.h[l]; + if (n && x(g.h, l)) + for (g = 0; g < n.length; g++) { + var q = n[g]; + if (k !== k && q.key !== q.key || k === q.key) + return { + id: l, + list: n, + index: g, + m: q + }; + } + return { + id: l, + list: n, + index: -1, + m: void 0 + }; + }, e = function (g, k) { + var l = g.g; + return ja(function () { + if (l) { + for (; l.head != g.g;) + l = l.u; + for (; l.next != l.head;) + return l = l.next, { + done: !1, + value: k(l) + }; + l = null; + } + return { + done: !0, + value: void 0 + }; + }); + }, f = function () { + var g = {}; + return g.u = g.next = g.head = g; + }, h = 0; + return c; + }, 'es6'); + var ta = function (a, b) { + a instanceof String && (a += ''); + var c = 0, d = !1, e = { + next: function () { + if (!d && c < a.length) { + var f = c++; + return { + value: b(f, a[f]), + done: !1 + }; + } + d = !0; + return { + done: !0, + value: void 0 + }; + } + }; + e[p(m.Symbol, 'iterator')] = function () { + return e; + }; + return e; + }, ua = function (a, b, c) { + if (null == a) + throw new TypeError('The \'this\' value for String.prototype.' + c + ' must not be null or undefined'); + if (b instanceof RegExp) + throw new TypeError('First argument to String.prototype.' + c + ' must not be a regular expression'); + return a + ''; + }; + r('String.prototype.startsWith', function (a) { + return a ? a : function (b, c) { + var d = ua(this, b, 'startsWith'), e = d.length, f = b.length; + c = Math.max(0, Math.min(c | 0, d.length)); + for (var h = 0; h < f && c < e;) + if (d[c++] != b[h++]) + return !1; + return h >= f; + }; + }, 'es6'); + r('String.prototype.repeat', function (a) { + return a ? a : function (b) { + var c = ua(this, null, 'repeat'); + if (0 > b || 1342177279 < b) + throw new RangeError('Invalid count value'); + b |= 0; + for (var d = ''; b;) + if (b & 1 && (d += c), b >>>= 1) + c += c; + return d; + }; + }, 'es6'); + r('globalThis', function (a) { + return a || ea; + }, 'es_2020'); + r('Set', function (a) { + if (function () { + if (!a || 'function' != typeof a || !a.prototype.entries || 'function' != typeof Object.seal) + return !1; + try { + var c = Object.seal({ x: 4 }), d = new a(t([c])); + if (!d.has(c) || 1 != d.size || d.add(c) != d || 1 != d.size || d.add({ x: 4 }) != d || 2 != d.size) + return !1; + var e = d.entries(), f = e.next(); + if (f.done || f.value[0] != c || f.value[1] != c) + return !1; + f = e.next(); + return f.done || f.value[0] == c || 4 != f.value[0].x || f.value[1] != f.value[0] ? !1 : e.next().done; + } catch (h) { + return !1; + } + }()) + return a; + var b = function (c) { + this.g = new m.Map(); + if (c) { + c = t(c); + for (var d; !(d = c.next()).done;) + this.add(d.value); + } + this.size = this.g.size; + }; + b.prototype.add = function (c) { + c = 0 === c ? 0 : c; + this.g.set(c, c); + this.size = this.g.size; + return this; + }; + b.prototype.delete = function (c) { + c = this.g.delete(c); + this.size = this.g.size; + return c; + }; + b.prototype.clear = function () { + this.g.clear(); + this.size = 0; + }; + b.prototype.has = function (c) { + return this.g.has(c); + }; + b.prototype.entries = function () { + return this.g.entries(); + }; + b.prototype.values = function () { + return p(this.g, 'values').call(this.g); + }; + b.prototype.keys = p(b.prototype, 'values'); + b.prototype[p(m.Symbol, 'iterator')] = p(b.prototype, 'values'); + b.prototype.forEach = function (c, d) { + var e = this; + this.g.forEach(function (f) { + return c.call(d, f, f, e); + }); + }; + return b; + }, 'es6'); + r('String.prototype.padStart', function (a) { + return a ? a : function (b, c) { + var d = ua(this, null, 'padStart'); + b -= d.length; + c = void 0 !== c ? String(c) : ' '; + return (0 < b && c ? p(c, 'repeat').call(c, Math.ceil(b / c.length)).substring(0, b) : '') + d; + }; + }, 'es8'); + r('Array.prototype.keys', function (a) { + return a ? a : function () { + return ta(this, function (b) { + return b; + }); + }; + }, 'es6'); + r('Array.prototype.values', function (a) { + return a ? a : function () { + return ta(this, function (b, c) { + return c; + }); + }; + }, 'es8'); + r('Object.is', function (a) { + return a ? a : function (b, c) { + return b === c ? 0 !== b || 1 / b === 1 / c : b !== b && c !== c; + }; + }, 'es6'); + r('Array.prototype.includes', function (a) { + return a ? a : function (b, c) { + var d = this; + d instanceof String && (d = String(d)); + var e = d.length; + c = c || 0; + for (0 > c && (c = Math.max(c + e, 0)); c < e; c++) { + var f = d[c]; + if (f === b || p(Object, 'is').call(Object, f, b)) + return !0; + } + return !1; + }; + }, 'es7'); + r('String.prototype.includes', function (a) { + return a ? a : function (b, c) { + return -1 !== ua(this, b, 'includes').indexOf(b, c || 0); + }; + }, 'es6'); + var z = this || self, va = function (a) { + a = a.split('.'); + for (var b = z, c = 0; c < a.length; c++) + if (b = b[a[c]], null == b) + return null; + return b; + }, ya = function (a) { + return Object.prototype.hasOwnProperty.call(a, wa) && a[wa] || (a[wa] = ++xa); + }, wa = 'closure_uid_' + (1000000000 * Math.random() >>> 0), xa = 0, za = function (a, b) { + a = a.split('.'); + var c = z; + a[0] in c || 'undefined' == typeof c.execScript || c.execScript('var ' + a[0]); + for (var d; a.length && (d = a.shift());) + a.length || void 0 === b ? c[d] && c[d] !== Object.prototype[d] ? c = c[d] : c = c[d] = {} : c[d] = b; + }; + var Aa = function (a) { + return /^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]; + }, Ia = function (a) { + if (!Ba.test(a)) + return a; + -1 != a.indexOf('&') && (a = a.replace(Ca, '&')); + -1 != a.indexOf('<') && (a = a.replace(Da, '<')); + -1 != a.indexOf('>') && (a = a.replace(Ea, '>')); + -1 != a.indexOf('"') && (a = a.replace(Fa, '"')); + -1 != a.indexOf('\'') && (a = a.replace(Ga, ''')); + -1 != a.indexOf('\0') && (a = a.replace(Ha, '�')); + return a; + }, Ca = /&/g, Da = //g, Fa = /"/g, Ga = /'/g, Ha = /\x00/g, Ba = /[\x00&<>"']/, La = function (a, b) { + var c = 0; + a = Aa(String(a)).split('.'); + b = Aa(String(b)).split('.'); + for (var d = Math.max(a.length, b.length), e = 0; 0 == c && e < d; e++) { + var f = a[e] || '', h = b[e] || ''; + do { + f = /(\d*)(\D*)(.*)/.exec(f) || [ + '', + '', + '', + '' + ]; + h = /(\d*)(\D*)(.*)/.exec(h) || [ + '', + '', + '', + '' + ]; + if (0 == f[0].length && 0 == h[0].length) + break; + c = Ka(0 == f[1].length ? 0 : parseInt(f[1], 10), 0 == h[1].length ? 0 : parseInt(h[1], 10)) || Ka(0 == f[2].length, 0 == h[2].length) || Ka(f[2], h[2]); + f = f[3]; + h = h[3]; + } while (0 == c); + } + return c; + }, Ka = function (a, b) { + return a < b ? -1 : a > b ? 1 : 0; + }; + function Ma() { + var a = z.navigator; + return a && (a = a.userAgent) ? a : ''; + } + function Na(a) { + return -1 != Ma().indexOf(a); + } + ; + var Oa = function (a, b) { + Array.prototype.forEach.call(a, b, void 0); + }, Pa = function (a, b) { + return Array.prototype.filter.call(a, b, void 0); + }, Qa = function (a, b) { + return Array.prototype.map.call(a, b, void 0); + }; + function Ra(a, b) { + a: { + for (var c = a.length, d = 'string' === typeof a ? a.split('') : a, e = 0; e < c; e++) + if (e in d && b.call(void 0, d[e], e, a)) { + b = e; + break a; + } + b = -1; + } + return 0 > b ? null : 'string' === typeof a ? a.charAt(b) : a[b]; + } + function Sa(a, b) { + a: { + for (var c = 'string' === typeof a ? a.split('') : a, d = a.length - 1; 0 <= d; d--) + if (d in c && b.call(void 0, c[d], d, a)) { + b = d; + break a; + } + b = -1; + } + return 0 > b ? null : 'string' === typeof a ? a.charAt(b) : a[b]; + } + function Ta(a, b) { + return 0 <= Array.prototype.indexOf.call(a, b, void 0); + } + ; + var Ua = {}, Va = null, Xa = function (a) { + var b = []; + Wa(a, function (c) { + b.push(c); + }); + return b; + }, Wa = function (a, b) { + function c(k) { + for (; d < a.length;) { + var l = a.charAt(d++), n = Va[l]; + if (null != n) + return n; + if (!/^[\s\xa0]*$/.test(l)) + throw Error('Unknown base64 encoding at char: ' + l); + } + return k; + } + Ya(); + for (var d = 0;;) { + var e = c(-1), f = c(0), h = c(64), g = c(64); + if (64 === g && -1 === e) + break; + b(e << 2 | f >> 4); + 64 != h && (b(f << 4 & 240 | h >> 2), 64 != g && b(h << 6 & 192 | g)); + } + }, Ya = function () { + if (!Va) { + Va = {}; + for (var a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.split(''), b = [ + '+/=', + '+/', + '-_=', + '-_.', + '-_' + ], c = 0; 5 > c; c++) { + var d = a.concat(b[c].split('')); + Ua[c] = d; + for (var e = 0; e < d.length; e++) { + var f = d[e]; + void 0 === Va[f] && (Va[f] = e); + } + } + } + }; + var Za = 'function' === typeof Uint8Array; + var $a = 'function' === typeof m.Symbol && 'symbol' === typeof (0, m.Symbol)() ? (0, m.Symbol)(void 0) : void 0; + function ab(a) { + Object.isFrozen(a) || ($a ? a[$a] |= 1 : void 0 !== a.g ? a.g |= 1 : Object.defineProperties(a, { + g: { + value: 1, + configurable: !0, + writable: !0, + enumerable: !1 + } + })); + return a; + } + ; + function bb(a) { + return null !== a && 'object' === typeof a && !Array.isArray(a) && a.constructor === Object; + } + var cb; + function db(a) { + switch (typeof a) { + case 'number': + return isFinite(a) ? a : String(a); + case 'object': + if (a && !Array.isArray(a) && Za && null != a && a instanceof Uint8Array) { + var b; + void 0 === b && (b = 0); + Ya(); + b = Ua[b]; + for (var c = Array(Math.floor(a.length / 3)), d = b[64] || '', e = 0, f = 0; e < a.length - 2; e += 3) { + var h = a[e], g = a[e + 1], k = a[e + 2], l = b[h >> 2]; + h = b[(h & 3) << 4 | g >> 4]; + g = b[(g & 15) << 2 | k >> 6]; + k = b[k & 63]; + c[f++] = l + h + g + k; + } + l = 0; + k = d; + switch (a.length - e) { + case 2: + l = a[e + 1], k = b[(l & 15) << 2] || d; + case 1: + a = a[e], c[f] = b[a >> 2] + b[(a & 3) << 4 | l >> 4] + k + d; + } + return c.join(''); + } + } + return a; + } + ; + function eb(a, b) { + if (null != a) + return Array.isArray(a) || bb(a) ? fb(a, b) : b(a); + } + function fb(a, b) { + if (Array.isArray(a)) { + for (var c = Array(a.length), d = 0; d < a.length; d++) + c[d] = eb(a[d], b); + if (b = Array.isArray(a)) { + var e; + $a ? e = a[$a] : e = a.g; + b = (null == e ? 0 : e) & 1; + } + b && ab(c); + return c; + } + e = {}; + for (c in a) + Object.prototype.hasOwnProperty.call(a, c) && (e[c] = eb(a[c], b)); + return e; + } + function gb(a) { + if (a && 'object' == typeof a && a.toJSON) + return a.toJSON(); + a = db(a); + return Array.isArray(a) ? fb(a, gb) : a; + } + ; + var hb; + var A = function (a, b, c) { + var d = hb; + hb = null; + a || (a = d); + d = this.constructor.messageId; + a || (a = d ? [d] : []); + this.i = (d ? 0 : -1) - (this.constructor.wa || 0); + this.g = void 0; + this.h = a; + a: { + d = this.h.length; + a = d - 1; + if (d && (d = this.h[a], bb(d))) { + this.l = a - this.i; + this.j = d; + break a; + } + void 0 !== b && -1 < b ? (this.l = Math.max(b, a + 1 - this.i), this.j = void 0) : this.l = Number.MAX_VALUE; + } + if (c) + for (b = 0; b < c.length; b++) + if (a = c[b], a < this.l) + a += this.i, (d = this.h[a]) ? Array.isArray(d) && ab(d) : this.h[a] = kb; + else { + d = this.j || (this.j = this.h[this.l + this.i] = {}); + var e = d[a]; + e ? Array.isArray(e) && ab(e) : d[a] = kb; + } + }, kb = Object.freeze(ab([])), B = function (a, b, c) { + return -1 === b ? null : b >= a.l ? a.j ? a.j[b] : void 0 : (void 0 === c ? 0 : c) && a.j && (c = a.j[b], null != c) ? c : a.h[b + a.i]; + }, lb = function (a, b, c) { + c = void 0 === c ? !1 : c; + var d = B(a, b, c); + null == d && (d = kb); + d === kb && (d = ab(d.slice()), C(a, b, d, c)); + return d; + }, D = function (a, b, c) { + a = B(a, b); + return null == a ? c : a; + }, mb = function (a, b) { + a = B(a, b); + a = null == a ? a : !!a; + return null == a ? !1 : a; + }, nb = function (a, b, c) { + a = B(a, b); + a = null == a ? a : +a; + return null == a ? void 0 === c ? 0 : c : a; + }, C = function (a, b, c, d) { + (void 0 === d ? 0 : d) || b >= a.l ? (a.j || (a.j = a.h[a.l + a.i] = {}))[b] = c : a.h[b + a.i] = c; + return a; + }, ob = function (a, b, c) { + var d = void 0 === d ? !1 : d; + return C(a, b, null == c ? ab([]) : Array.isArray(c) ? ab(c) : c, d); + }; + function F(a, b, c) { + 0 !== c ? C(a, b, c) : C(a, b, void 0, !1); + return a; + } + var pb = function (a, b, c, d) { + (c = G(a, c)) && c !== b && null != d && (a.g && c in a.g && (a.g[c] = void 0), C(a, c, void 0)); + return C(a, b, d); + }, G = function (a, b) { + for (var c = 0, d = 0; d < b.length; d++) { + var e = b[d]; + null != B(a, e) && (0 !== c && C(a, c, void 0, !1), c = e); + } + return c; + }, H = function (a, b, c) { + if (-1 === c) + return null; + a.g || (a.g = {}); + var d = a.g[c]; + if (d) + return d; + var e = B(a, c, !1); + if (null == e) + return d; + b = new b(e); + return a.g[c] = b; + }, I = function (a, b, c) { + a.g || (a.g = {}); + var d = a.g[c]; + if (!d) { + var e = lb(a, c, !1); + d = []; + for (var f = 0; f < e.length; f++) + d[f] = new b(e[f]); + a.g[c] = d; + } + return d; + }, qb = function (a, b, c) { + var d; + a.g || (a.g = {}); + var e = c ? c.h : c; + a.g[b] = c; + return C(a, b, e, void 0 === d ? !1 : d); + }, sb = function (a, b, c) { + var d = rb; + a.g || (a.g = {}); + var e = c ? c.h : c; + a.g[b] = c; + return pb(a, b, d, e); + }, tb = function (a, b, c) { + var d = void 0 === d ? !1 : d; + if (c) { + var e = ab([]); + for (var f = 0; f < c.length; f++) + e[f] = c[f].h; + a.g || (a.g = {}); + a.g[b] = c; + } else + a.g && (a.g[b] = void 0), e = kb; + return C(a, b, e, d); + }; + A.prototype.toJSON = function () { + var a = this.h; + return cb ? a : fb(a, gb); + }; + function ub(a, b) { + return db(b); + } + var vb = function (a) { + cb = !0; + try { + return JSON.stringify(a.toJSON(), ub); + } finally { + cb = !1; + } + }, wb = function (a, b, c) { + return D(a, b, void 0 === c ? '' : c); + }, xb = function (a, b, c) { + b = G(a, c) === b ? b : -1; + return D(a, b, 0); + }; + var Ab = function (a, b) { + this.h = a === yb && b || ''; + this.i = zb; + }; + Ab.prototype.B = !0; + Ab.prototype.g = function () { + return this.h; + }; + var Bb = function (a) { + return a instanceof Ab && a.constructor === Ab && a.i === zb ? a.h : 'type_error:Const'; + }, Cb = function (a) { + return new Ab(yb, a); + }, zb = {}, yb = {}; + function Db(a) { + var b = [], c = 0, d; + for (d in a) + b[c++] = a[d]; + return b; + } + ; + var Eb = { + area: !0, + base: !0, + br: !0, + col: !0, + command: !0, + embed: !0, + hr: !0, + img: !0, + input: !0, + keygen: !0, + link: !0, + meta: !0, + param: !0, + source: !0, + track: !0, + wbr: !0 + }; + var J = function (a, b) { + this.i = b === Fb ? a : ''; + }; + J.prototype.B = !0; + J.prototype.g = function () { + return this.i.toString(); + }; + J.prototype.j = !0; + J.prototype.h = function () { + return 1; + }; + var Jb = function (a, b) { + a = Gb.exec(Hb(a).toString()); + var c = a[3] || ''; + return new J(a[1] + Ib('?', a[2] || '', b) + Ib('#', c, void 0), Fb); + }; + J.prototype.toString = function () { + return this.i + ''; + }; + var Hb = function (a) { + return a instanceof J && a.constructor === J ? a.i : 'type_error:TrustedResourceUrl'; + }, Gb = /^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/, Kb = function (a) { + for (var b = '', c = 0; c < a.length; c++) + b += Bb(a[c]); + return new J(b, Fb); + }, Fb = {}, Ib = function (a, b, c) { + if (null == c) + return b; + if ('string' === typeof c) + return c ? a + encodeURIComponent(c) : ''; + for (var d in c) + if (Object.prototype.hasOwnProperty.call(c, d)) { + var e = c[d]; + e = Array.isArray(e) ? e : [e]; + for (var f = 0; f < e.length; f++) { + var h = e[f]; + null != h && (b || (b = a), b += (b.length > a.length ? '&' : '') + encodeURIComponent(d) + '=' + encodeURIComponent(String(h))); + } + } + return b; + }; + var K = function (a, b) { + this.i = b === Lb ? a : ''; + }; + K.prototype.B = !0; + K.prototype.g = function () { + return this.i.toString(); + }; + K.prototype.j = !0; + K.prototype.h = function () { + return 1; + }; + K.prototype.toString = function () { + return this.i.toString(); + }; + var Mb = RegExp('^(?:audio/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|font/\\w+|image/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|video/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\\w+=(?:\\w+|"[\\w;,= ]+"))*$', 'i'), Nb = /^data:(.*);base64,[a-z0-9+\/]+=*$/i, Ob = /^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i, Lb = {}, Pb = new K('about:invalid#zClosurez', Lb); + var Qb = {}, L = function (a, b, c) { + this.i = c === Qb ? a : ''; + this.l = b; + this.B = this.j = !0; + }; + L.prototype.h = function () { + return this.l; + }; + L.prototype.g = function () { + return this.i.toString(); + }; + L.prototype.toString = function () { + return this.i.toString(); + }; + var Rb = function (a) { + return a instanceof L && a.constructor === L ? a.i : 'type_error:SafeHtml'; + }, Sb = function (a) { + if (a instanceof L) + return a; + var b = 'object' == typeof a, c = null; + b && a.j && (c = a.h()); + a = Ia(b && a.B ? a.g() : String(a)); + return new L(a, c, Qb); + }, Wb = function (a, b) { + var c = { src: a }, d = {}; + a = {}; + for (var e in c) + Object.prototype.hasOwnProperty.call(c, e) && (a[e] = c[e]); + for (var f in d) + Object.prototype.hasOwnProperty.call(d, f) && (a[f] = d[f]); + if (b) + for (var h in b) + if (Object.prototype.hasOwnProperty.call(b, h)) { + e = h.toLowerCase(); + if (e in c) + throw Error(''); + e in d && delete a[e]; + a[h] = b[h]; + } + var g; + b = null; + h = ''; + if (a) + for (k in a) + if (Object.prototype.hasOwnProperty.call(a, k)) { + if (!Tb.test(k)) + throw Error(''); + d = a[k]; + if (null != d) { + c = k; + if (d instanceof Ab) + d = Bb(d); + else { + if ('style' == c.toLowerCase()) + throw Error(''); + if (/^on/i.test(c)) + throw Error(''); + if (c.toLowerCase() in Ub) + if (d instanceof J) + d = Hb(d).toString(); + else if (d instanceof K) + d = d instanceof K && d.constructor === K ? d.i : 'type_error:SafeUrl'; + else if ('string' === typeof d) + d instanceof K || (d = 'object' == typeof d && d.B ? d.g() : String(d), Ob.test(d) ? d = new K(d, Lb) : (d = String(d), d = d.replace(/(%0A|%0D)/g, ''), d = (e = d.match(Nb)) && Mb.test(e[1]) ? new K(d, Lb) : null)), d = (d || Pb).g(); + else + throw Error(''); + } + d.B && (d = d.g()); + c = c + '="' + Ia(String(d)) + '"'; + h += ' ' + c; + } + } + var k = '', b = g.h()); + (a = a && a.dir) && (/^(ltr|rtl|auto)$/i.test(a) ? b = 0 : b = null); + return new L(k, b, Qb); + }, Yb = function (a) { + var b = Sb(Xb), c = b.h(), d = [], e = function (f) { + Array.isArray(f) ? f.forEach(e) : (f = Sb(f), d.push(Rb(f).toString()), f = f.h(), 0 == c ? c = f : 0 != f && c != f && (c = null)); + }; + a.forEach(e); + return new L(d.join(Rb(b).toString()), c, Qb); + }, Vb = function (a) { + return Yb(Array.prototype.slice.call(arguments)); + }, Tb = /^[a-zA-Z0-9-]+$/, Ub = { + action: !0, + cite: !0, + data: !0, + formaction: !0, + href: !0, + manifest: !0, + poster: !0, + src: !0 + }, Xb = new L(z.trustedTypes && z.trustedTypes.emptyHTML || '', 0, Qb); + var Zb = {}; + function $b() { + var a = 'undefined' !== typeof window ? window.trustedTypes : void 0; + return null !== a && void 0 !== a ? a : null; + } + var ac; + function bc() { + var a, b; + if (void 0 === ac) + try { + ac = null !== (b = null === (a = $b()) || void 0 === a ? void 0 : a.createPolicy('google#safe', { + createHTML: function (c) { + return c; + }, + createScript: function (c) { + return c; + }, + createScriptURL: function (c) { + return c; + } + })) && void 0 !== b ? b : null; + } catch (c) { + ac = null; + } + return ac; + } + ; + var cc = function () { + }, dc = function (a) { + this.g = a; + }; + v(dc, cc); + dc.prototype.toString = function () { + return this.g.toString(); + }; + function ec(a) { + var b, c = null === (b = bc()) || void 0 === b ? void 0 : b.createScriptURL(a); + return new dc(null !== c && void 0 !== c ? c : a, Zb); + } + ; + function fc(a) { + if (a instanceof cc) + if (a instanceof dc) + a = a.g; + else + throw Error(''); + else + a = Hb(a); + return a; + } + ; + function gc(a) { + var b, c = (a.ownerDocument && a.ownerDocument.defaultView || window).document, d = null === (b = c.querySelector) || void 0 === b ? void 0 : b.call(c, 'script[nonce]'); + (b = d ? d.nonce || d.getAttribute('nonce') || '' : '') && a.setAttribute('nonce', b); + } + ; + function hc(a, b) { + a.write(Rb(b)); + } + ; + var ic = function (a) { + var b = !1, c; + return function () { + b || (c = a(), b = !0); + return c; + }; + }; + var jc = function (a, b) { + a.addEventListener && a.addEventListener('load', b, !1); + }; + var lc = function () { + a: { + var a = z.document; + if (a.querySelector && (a = a.querySelector('script[nonce]')) && (a = a.nonce || a.getAttribute('nonce')) && kc.test(a)) + break a; + a = ''; + } + return a; + }, kc = /^[\w+/_-]+[=]{0,2}$/; + var mc = function () { + return Na('iPad') || Na('Android') && !Na('Mobile') || Na('Silk'); + }; + var nc = RegExp('^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$'), oc = function (a) { + return a ? decodeURI(a) : a; + }, pc = /#|$/, qc = function (a, b) { + var c = a.search(pc); + a: { + var d = 0; + for (var e = b.length; 0 <= (d = a.indexOf(b, d)) && d < c;) { + var f = a.charCodeAt(d - 1); + if (38 == f || 63 == f) + if (f = a.charCodeAt(d + e), !f || 61 == f || 38 == f || 35 == f) + break a; + d += e + 1; + } + d = -1; + } + if (0 > d) + return null; + e = a.indexOf('&', d); + if (0 > e || e > c) + e = c; + d += b.length + 1; + return decodeURIComponent(a.substr(d, e - d).replace(/\+/g, ' ')); + }; + var uc = function (a, b) { + if (!rc() && !sc()) { + var c = Math.random(); + if (c < b) + return c = tc(), a[Math.floor(c * a.length)]; + } + return null; + }, tc = function () { + if (!m.globalThis.crypto) + return Math.random(); + try { + var a = new Uint32Array(1); + m.globalThis.crypto.getRandomValues(a); + return a[0] / 65536 / 65536; + } catch (b) { + return Math.random(); + } + }, vc = function (a, b) { + if (a) + for (var c in a) + Object.prototype.hasOwnProperty.call(a, c) && b.call(void 0, a[c], c, a); + }, wc = function (a) { + var b = a.length; + if (0 == b) + return 0; + for (var c = 305419896, d = 0; d < b; d++) + c ^= (c << 5) + (c >> 2) + a.charCodeAt(d) & 4294967295; + return 0 < c ? c : 4294967296 + c; + }, sc = ic(function () { + return Array.prototype.some.call([ + 'Google Web Preview', + 'Mediapartners-Google', + 'Google-Read-Aloud', + 'Google-Adwords' + ], xc, void 0) || 0.0001 > Math.random(); + }), rc = ic(function () { + return xc('MSIE'); + }), xc = function (a) { + return -1 != Ma().indexOf(a); + }, yc = /^(-?[0-9.]{1,30})$/, zc = function (a) { + return yc.test(a) && (a = Number(a), !isNaN(a)) ? a : null; + }, Ac = function (a) { + return /^true$/.test(a); + }, Bc = ic(function () { + return !mc() && (Na('iPod') || Na('iPhone') || Na('Android') || Na('IEMobile')) ? 2 : mc() ? 1 : 0; + }), Cc = function (a, b) { + a = void 0 === a ? '' : a; + b = void 0 === b ? window : b; + return (b = oc(b.location.href.match(nc)[3] || null)) ? wc(b + a) : null; + }, Ec = function (a, b) { + b = void 0 === b ? window.document : b; + 0 != a.length && b.head && a.forEach(function (c) { + if (c) { + var d = b; + d = void 0 === d ? window.document : d; + if (c && d.head) { + var e = Dc('META'); + d.head.appendChild(e); + e.httpEquiv = 'origin-trial'; + e.content = c; + } + } + }); + }, Fc = function (a) { + if ('number' !== typeof a.goog_pvsid) + try { + Object.defineProperty(a, 'goog_pvsid', { + value: Math.floor(Math.random() * Math.pow(2, 52)), + configurable: !1 + }); + } catch (b) { + } + return Number(a.goog_pvsid) || -1; + }, Dc = function (a, b) { + b = void 0 === b ? document : b; + return b.createElement(String(a).toLowerCase()); + }; + var Hc = function (a, b) { + var c = 'https://pagead2.googlesyndication.com/pagead/gen_204?id=' + b; + vc(a, function (d, e) { + d && (c += '&' + e + '=' + encodeURIComponent(d)); + }); + Gc(c); + }, Gc = function (a) { + var b = window; + if (b.fetch) + b.fetch(a, { + keepalive: !0, + credentials: 'include', + redirect: 'follow', + method: 'get', + mode: 'no-cors' + }); + else { + b.google_image_requests || (b.google_image_requests = []); + var c = Dc('IMG', b.document); + c.src = a; + b.google_image_requests.push(c); + } + }; + function Ic(a) { + var b = w.apply(1, arguments); + if (0 === b.length) + return ec(a[0]); + for (var c = [a[0]], d = 0; d < b.length; d++) + c.push(encodeURIComponent(b[d])), c.push(a[d + 1]); + return ec(c.join('')); + } + ; + var Jc = 'a'.charCodeAt(), Kc = Db({ + ra: 0, + qa: 1, + na: 2, + ia: 3, + oa: 4, + ja: 5, + pa: 6, + la: 7, + ma: 8, + ha: 9, + ka: 10 + }), Lc = Db({ + ta: 0, + ua: 1, + sa: 2 + }); + var Mc = function (a) { + if (/[^01]/.test(a)) + throw Error('Input bitstring ' + a + ' is malformed!'); + this.h = a; + this.g = 0; + }, Pc = function (a) { + var b = M(a, 16); + return !0 === !!M(a, 1) ? (a = Nc(a), a.forEach(function (c) { + if (c > b) + throw Error('ID ' + c + ' is past MaxVendorId ' + b + '!'); + }), a) : Oc(a, b); + }, Nc = function (a) { + for (var b = M(a, 12), c = []; b--;) { + var d = !0 === !!M(a, 1), e = M(a, 16); + if (d) + for (d = M(a, 16); e <= d; e++) + c.push(e); + else + c.push(e); + } + c.sort(function (f, h) { + return f - h; + }); + return c; + }, Oc = function (a, b, c) { + for (var d = [], e = 0; e < b; e++) + if (M(a, 1)) { + var f = e + 1; + if (c && -1 === c.indexOf(f)) + throw Error('ID: ' + f + ' is outside of allowed values!'); + d.push(f); + } + return d; + }, M = function (a, b) { + if (a.g + b > a.h.length) + throw Error('Requested length ' + b + ' is past end of string.'); + var c = a.h.substring(a.g, a.g + b); + a.g += b; + return parseInt(c, 2); + }; + var Rc = function (a, b) { + try { + var c = Xa(a.split('.')[0]).map(function (e) { + return (aa = e.toString(2), p(aa, 'padStart')).call(aa, 8, '0'); + }).join(''), d = new Mc(c); + c = {}; + c.tcString = a; + c.gdprApplies = !0; + d.g += 78; + c.cmpId = M(d, 12); + c.cmpVersion = M(d, 12); + d.g += 30; + c.tcfPolicyVersion = M(d, 6); + c.isServiceSpecific = !!M(d, 1); + c.useNonStandardStacks = !!M(d, 1); + c.specialFeatureOptins = Qc(Oc(d, 12, Lc), Lc); + c.purpose = { + consents: Qc(Oc(d, 24, Kc), Kc), + legitimateInterests: Qc(Oc(d, 24, Kc), Kc) + }; + c.purposeOneTreatment = !!M(d, 1); + c.publisherCC = String.fromCharCode(Jc + M(d, 6)) + String.fromCharCode(Jc + M(d, 6)); + c.vendor = { + consents: Qc(Pc(d), b), + legitimateInterests: Qc(Pc(d), b) + }; + return c; + } catch (e) { + return null; + } + }, Qc = function (a, b) { + var c = {}; + if (Array.isArray(b) && 0 !== b.length) { + b = t(b); + for (var d = b.next(); !d.done; d = b.next()) + d = d.value, c[d] = -1 !== a.indexOf(d); + } else + for (a = t(a), d = a.next(); !d.done; d = a.next()) + c[d.value] = !0; + delete c[0]; + return c; + }; + function Sc(a) { + return function () { + var b = w.apply(0, arguments); + try { + return a.apply(this, b); + } catch (c) { + } + }; + } + var Tc = Sc(function (a) { + var b = [], c = {}; + a = t(a); + for (var d = a.next(); !d.done; c = { C: c.C }, d = a.next()) + c.C = d.value, Sc(function (e) { + return function () { + b.push('[{"' + e.C.ga + '":' + vb(e.C.message) + '}]'); + }; + }(c))(); + return '[[' + b.join(',') + ']]'; + }); + var Uc = function (a, b) { + if (m.globalThis.fetch) + m.globalThis.fetch(a, { + method: 'POST', + body: b, + keepalive: 65536 > b.length, + credentials: 'omit', + mode: 'no-cors', + redirect: 'follow' + }); + else { + var c = new XMLHttpRequest(); + c.open('POST', a, !0); + c.send(b); + } + }; + function Vc(a) { + a.fa.apply(a, u(w.apply(1, arguments).map(function (b) { + return { + ga: 4, + message: b + }; + }))); + } + ; + var Wc = function (a) { + var b = void 0 === b ? Uc : b; + this.i = void 0 === a ? 1000 : a; + this.j = b; + this.h = []; + this.g = null; + }; + Wc.prototype.fa = function () { + var a = w.apply(0, arguments), b = this; + Sc(function () { + b.h.push.apply(b.h, u(a)); + var c = Sc(function () { + var d = Tc(b.h); + b.j('https://pagead2.googlesyndication.com/pagead/ping?e=1', d); + b.h = []; + b.g = null; + }); + 100 <= b.h.length ? (null !== b.g && clearTimeout(b.g), b.g = setTimeout(c, 0)) : null === b.g && (b.g = setTimeout(c, b.i)); + })(); + }; + var Xc = function (a) { + this.g = a; + this.defaultValue = !1; + }, Yc = function (a) { + this.g = a; + this.defaultValue = 0; + }, Zc = function (a, b) { + b = void 0 === b ? [] : b; + this.g = a; + this.defaultValue = b; + }; + var $c = new Xc(399544548), ad = new Yc(24), bd = new Zc(1939), cd = new Zc(1934, [ + 'A8FHS1NmdCwGqD9DwOicnHHY+y27kdWfxKa0YHSGDfv0CSpDKRHTQdQmZVPDUdaFWUsxdgVxlwAd6o+dhJykPA0AAACWeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9', + 'A8zdXi6dr1hwXEUjQrYiyYQGlU3557y5QWDnN0Lwgj9ePt66XMEvNkVWOEOWPd7TP9sBQ25X0Q15Lr1Nn4oGFQkAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9', + 'A4/Htern2udN9w3yJK9QgWQxQFruxOXsXL7cW60DyCl0EZFGCSme/J33Q/WzF7bBkVvhEWDlcBiUyZaim5CpFQwAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9' + ]), dd = new Xc(1959), ed = new Xc(203), fd = new Xc(1928), gd = new Xc(1941), hd = new Xc(370946349), id = new Xc(392736476), jd = new Yc(406149835), kd = new Zc(1932, [ + 'AxujKG9INjsZ8/gUq8+dTruNvk7RjZQ1oFhhgQbcTJKDnZfbzSTE81wvC2Hzaf3TW4avA76LTZEMdiedF1vIbA4AAABueyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzVGhpcmRQYXJ0eSI6dHJ1ZX0=', + 'Azuce85ORtSnWe1MZDTv68qpaW3iHyfL9YbLRy0cwcCZwVnePnOmkUJlG8HGikmOwhZU22dElCcfrfX2HhrBPAkAAAB7eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'A16nvcdeoOAqrJcmjLRpl1I6f3McDD8EfofAYTt/P/H4/AWwB99nxiPp6kA0fXoiZav908Z8etuL16laFPUdfQsAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'AxBHdr0J44vFBQtZUqX9sjiqf5yWZ/OcHRcRMN3H9TH+t90V/j3ENW6C8+igBZFXMJ7G3Pr8Dd13632aLng42wgAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'A88BWHFjcawUfKU3lIejLoryXoyjooBXLgWmGh+hNcqMK44cugvsI5YZbNarYvi3roc1fYbHA1AVbhAtuHZflgEAAAB2eyJvcmlnaW4iOiJodHRwczovL2dvb2dsZS5jb206NDQzIiwiZmVhdHVyZSI6IlRydXN0VG9rZW5zIiwiZXhwaXJ5IjoxNjUyNzc0NDAwLCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==' + ]), ld = new Yc(1935); + var nd = function (a) { + A.call(this, a, -1, md); + }; + v(nd, A); + var md = [6]; + var pd = function (a) { + A.call(this, a, -1, od); + }; + v(pd, A); + var qd = function (a) { + A.call(this, a); + }; + v(qd, A); + var rd = function (a) { + A.call(this, a); + }; + v(rd, A); + var od = [7]; + var sd = function (a) { + this.g = a || { cookie: '' }; + }; + sd.prototype.set = function (a, b, c) { + var d = !1; + if ('object' === typeof c) { + var e = c.ya; + d = c.za || !1; + var f = c.domain || void 0; + var h = c.path || void 0; + var g = c.da; + } + if (/[;=\s]/.test(a)) + throw Error('Invalid cookie name "' + a + '"'); + if (/[;\r\n]/.test(b)) + throw Error('Invalid cookie value "' + b + '"'); + void 0 === g && (g = -1); + this.g.cookie = a + '=' + b + (f ? ';domain=' + f : '') + (h ? ';path=' + h : '') + (0 > g ? '' : 0 == g ? ';expires=' + new Date(1970, 1, 1).toUTCString() : ';expires=' + new Date(Date.now() + 1000 * g).toUTCString()) + (d ? ';secure' : '') + (null != e ? ';samesite=' + e : ''); + }; + sd.prototype.get = function (a, b) { + for (var c = a + '=', d = (this.g.cookie || '').split(';'), e = 0, f; e < d.length; e++) { + f = Aa(d[e]); + if (0 == f.lastIndexOf(c, 0)) + return f.substr(c.length); + if (f == a) + return ''; + } + return b; + }; + sd.prototype.isEmpty = function () { + return !this.g.cookie; + }; + sd.prototype.clear = function () { + for (var a = (this.g.cookie || '').split(';'), b = [], c = [], d, e, f = 0; f < a.length; f++) + e = Aa(a[f]), d = e.indexOf('='), -1 == d ? (b.push(''), c.push(e)) : (b.push(e.substring(0, d)), c.push(e.substring(d + 1))); + for (a = b.length - 1; 0 <= a; a--) + c = b[a], this.get(c), this.set(c, '', { + da: 0, + path: void 0, + domain: void 0 + }); + }; + function td(a) { + return (a = vd(a)) ? H(a, qd, 4) : null; + } + function vd(a) { + a = (a = new sd(a).get('FCCDCF', '')) ? a : null; + try { + if (a) { + var b = a ? JSON.parse(a) : null; + hb = b; + var c = new pd(b); + hb = null; + var d = c; + } else + d = null; + return d; + } catch (e) { + return null; + } + } + ; + var wd = function (a) { + this.g = a; + this.h = null; + }, yd = function (a) { + a.__tcfapiPostMessageReady || xd(new wd(a)); + }, xd = function (a) { + a.h = function (b) { + var c = 'string' == typeof b.data; + try { + var d = c ? JSON.parse(b.data) : b.data; + } catch (f) { + return; + } + var e = d.__tcfapiCall; + !e || 'ping' !== e.command && 'getTCData' !== e.command && 'addEventListener' !== e.command && 'removeEventListener' !== e.command || a.g.__tcfapi(e.command, e.version, function (f, h) { + var g = {}; + g.__tcfapiReturn = 'removeEventListener' === e.command ? { + success: f, + callId: e.callId + } : { + returnValue: f, + success: h, + callId: e.callId + }; + f = c ? JSON.stringify(g) : g; + b.source && 'function' === typeof b.source.postMessage && b.source.postMessage(f, b.origin); + return f; + }, e.parameter); + }; + a.g.addEventListener('message', a.h); + a.g.__tcfapiPostMessageReady = !0; + }; + var zd = function (a, b) { + var c = a.document, d = function () { + if (!a.frames[b]) + if (c.body) { + var e = Dc('IFRAME', c); + e.style.display = 'none'; + e.style.width = '0px'; + e.style.height = '0px'; + e.style.border = 'none'; + e.style.zIndex = '-1000'; + e.style.left = '-1000px'; + e.style.top = '-1000px'; + e.name = b; + c.body.appendChild(e); + } else + a.setTimeout(d, 5); + }; + d(); + }; + var Ad = function (a) { + this.g = a; + this.h = a.document; + this.l = (a = (a = vd(this.h)) ? H(a, rd, 5) || null : null) ? B(a, 2) : null; + this.j = (a = td(this.h)) && null != B(a, 1) ? B(a, 1) : null; + this.i = (a = td(this.h)) && null != B(a, 2) ? B(a, 2) : null; + }, Dd = function (a) { + a.__uspapi || a.frames.__uspapiLocator || (a = new Ad(a), Bd(a), Cd(a)); + }, Bd = function (a) { + !a.l || a.g.__uspapi || a.g.frames.__uspapiLocator || (a.g.__uspapiManager = 'fc', zd(a.g, '__uspapiLocator'), za('__uspapi', function () { + return a.s.apply(a, u(w.apply(0, arguments))); + })); + }; + Ad.prototype.s = function (a, b, c) { + 'function' === typeof c && 'getUSPData' === a && c({ + version: 1, + uspString: this.l + }, !0); + }; + var Cd = function (a) { + !a.j || a.g.__tcfapi || a.g.frames.__tcfapiLocator || (a.g.__tcfapiManager = 'fc', zd(a.g, '__tcfapiLocator'), a.g.__tcfapiEventListeners = a.g.__tcfapiEventListeners || [], za('__tcfapi', function () { + return a.o.apply(a, u(w.apply(0, arguments))); + }), yd(a.g)); + }; + Ad.prototype.o = function (a, b, c, d) { + d = void 0 === d ? null : d; + if ('function' === typeof c) + if (b && 2 !== b) + c(null, !1); + else + switch (b = this.g.__tcfapiEventListeners, a) { + case 'getTCData': + !d || Array.isArray(d) && d.every(function (e) { + return 'number' === typeof e; + }) ? c(Ed(this, d, null), !0) : c(null, !1); + break; + case 'ping': + c({ + gdprApplies: !0, + cmpLoaded: !0, + cmpStatus: 'loaded', + displayStatus: 'disabled', + apiVersion: '2.0', + cmpVersion: 1, + cmpId: 300 + }); + break; + case 'addEventListener': + a = b.push(c); + c(Ed(this, null, a - 1), !0); + break; + case 'removeEventListener': + b[d] ? (b[d] = null, c(!0)) : c(!1); + break; + case 'getInAppTCData': + case 'getVendorList': + c(null, !1); + } + }; + var Ed = function (a, b, c) { + if (!a.j) + return null; + b = Rc(a.j, b); + b.addtlConsent = null != a.i ? a.i : void 0; + b.cmpStatus = 'loaded'; + b.eventStatus = 'tcloaded'; + null != c && (b.listenerId = c); + return b; + }; + var Gd = function (a) { + A.call(this, a, -1, Fd); + }; + v(Gd, A); + var Hd = function (a, b) { + return qb(a, 1, b); + }, Id = function (a, b) { + return tb(a, 2, b); + }, Jd = function (a, b) { + return ob(a, 4, b); + }, Kd = function (a, b) { + return tb(a, 5, b); + }, Ld = function (a, b) { + return F(a, 6, b); + }, Md = function (a) { + A.call(this, a); + }; + v(Md, A); + Md.prototype.A = function () { + return D(this, 1, 0); + }; + var Nd = function (a, b) { + return F(a, 1, b); + }, Od = function (a, b) { + return F(a, 2, b); + }, Pd = function (a) { + A.call(this, a); + }; + v(Pd, A); + var Fd = [ + 2, + 4, + 5 + ], Qd = [ + 1, + 2 + ]; + var Sd = function (a) { + A.call(this, a, -1, Rd); + }; + v(Sd, A); + var Ud = function (a) { + A.call(this, a, -1, Td); + }; + v(Ud, A); + var Rd = [ + 2, + 3 + ], Td = [5], Vd = [ + 1, + 2, + 3, + 4 + ]; + var Wd = function (a) { + A.call(this, a); + }; + v(Wd, A); + Wd.prototype.getTagSessionCorrelator = function () { + return D(this, 2, 0); + }; + var Xd = function (a) { + var b = new Wd(); + return sb(b, 4, a); + }, rb = [ + 4, + 5, + 7 + ]; + var Yd = function (a, b) { + var c = void 0 === c ? {} : c; + this.error = a; + this.context = b.context; + this.msg = b.message || ''; + this.id = b.id || 'jserror'; + this.meta = c; + }; + var Zd = null, $d = function () { + if (null === Zd) { + Zd = ''; + try { + var a = ''; + try { + a = z.top.location.hash; + } catch (c) { + a = z.location.hash; + } + if (a) { + var b = a.match(/\bdeid=([\d,]+)/); + Zd = b ? b[1] : ''; + } + } catch (c) { + } + } + return Zd; + }; + var be = function (a) { + A.call(this, a, -1, ae); + }; + v(be, A); + var ae = [ + 2, + 8 + ], ce = [ + 3, + 4, + 5 + ], de = [ + 6, + 7 + ]; + var ee; + ee = { + va: 0, + aa: 3, + ba: 4, + ca: 5 + }; + var fe = ee.aa, N = ee.ba, ge = ee.ca, he = function (a) { + return null != a ? !a : a; + }, ie = function (a, b) { + for (var c = !1, d = 0; d < a.length; d++) { + var e = a[d](); + if (e === b) + return e; + null == e && (c = !0); + } + if (!c) + return !b; + }, ke = function (a, b) { + var c = I(a, be, 2); + if (!c.length) + return je(a, b); + a = D(a, 1, 0); + if (1 === a) + return he(ke(c[0], b)); + c = Qa(c, function (d) { + return function () { + return ke(d, b); + }; + }); + switch (a) { + case 2: + return ie(c, !1); + case 3: + return ie(c, !0); + } + }, je = function (a, b) { + var c = G(a, ce); + a: { + switch (c) { + case fe: + var d = xb(a, 3, ce); + break a; + case N: + d = xb(a, 4, ce); + break a; + case ge: + d = xb(a, 5, ce); + break a; + } + d = void 0; + } + if (d && (b = (b = b[c]) && b[d])) { + try { + var e = b.apply(null, u(lb(a, 8))); + } catch (f) { + return; + } + b = D(a, 1, 0); + if (4 === b) + return !!e; + d = null != e; + if (5 === b) + return d; + if (12 === b) + a = wb(a, 7 === G(a, de) ? 7 : -1, void 0); + else + a: { + switch (c) { + case N: + a = nb(a, 6 === G(a, de) ? 6 : -1, void 0); + break a; + case ge: + a = wb(a, 7 === G(a, de) ? 7 : -1, void 0); + break a; + } + a = void 0; + } + if (null != a) { + if (6 === b) + return e === a; + if (9 === b) + return null != e && 0 === La(String(e), a); + if (d) + switch (b) { + case 7: + return e < a; + case 8: + return e > a; + case 12: + return 'string' === typeof a && 'string' === typeof e && new RegExp(a).test(e); + case 10: + return null != e && -1 === La(String(e), a); + case 11: + return null != e && 1 === La(String(e), a); + } + } + } + }, le = function (a, b) { + return !a || !(!b || !ke(a, b)); + }; + var ne = function (a) { + A.call(this, a, -1, me); + }; + v(ne, A); + var me = [4]; + var oe = function (a) { + A.call(this, a); + }; + v(oe, A); + var O = function (a) { + A.call(this, a, -1, pe); + }; + v(O, A); + var pe = [5], qe = [ + 1, + 2, + 3, + 6, + 7 + ]; + var re = function (a, b, c) { + var d = void 0 === d ? new Wc(b) : d; + this.h = a; + this.l = c; + this.j = d; + this.g = []; + this.i = 0 < this.h && tc() < 1 / this.h; + }, te = function (a, b, c, d, e, f) { + var h = Od(Nd(new Md(), b), c); + b = Ld(Id(Hd(Kd(Jd(new Gd(), d), e), h), a.g), f); + b = Xd(b); + a.i && Vc(a.j, se(a, b)); + if (1 === f || 3 === f || 4 === f && !a.g.some(function (g) { + return g.A() === h.A() && D(g, 2, 0) === c; + })) + a.g.push(h), 100 < a.g.length && a.g.shift(); + }, ue = function (a, b, c, d) { + if (a.l) { + var e = new Sd(); + b = tb(e, 2, b); + c = tb(b, 3, c); + d && F(c, 1, d); + d = new Wd(); + d = sb(d, 7, c); + a.i && Vc(a.j, se(a, d)); + } + }, se = function (a, b) { + b = F(b, 1, Date.now()); + var c = Fc(window); + b = F(b, 2, c); + return F(b, 6, a.h); + }; + var P = function (a) { + var b = 'J'; + if (a.J && a.hasOwnProperty(b)) + return a.J; + b = new a(); + return a.J = b; + }; + var ve = function () { + var a = {}; + this.g = (a[fe] = {}, a[N] = {}, a[ge] = {}, a); + }; + var we = Ac('false'); + var xe = we, ye = function (a, b) { + switch (b) { + case 1: + return xb(a, 1, qe); + case 2: + return xb(a, 2, qe); + case 3: + return xb(a, 3, qe); + case 6: + return xb(a, 6, qe); + default: + return null; + } + }, ze = function (a, b) { + if (!a) + return null; + switch (b) { + case 1: + return mb(a, 1); + case 7: + return wb(a, 3); + case 2: + return nb(a, 2); + case 3: + return wb(a, 3); + case 6: + return lb(a, 4); + default: + return null; + } + }, Ae = ic(function () { + if (!xe) + return {}; + try { + var a = window.sessionStorage && window.sessionStorage.getItem('GGDFSSK'); + if (a) + return JSON.parse(a); + } catch (b) { + } + return {}; + }), De = function (a, b, c, d) { + var e = d = void 0 === d ? 0 : d, f, h; + P(Q).j[e] = null != (h = null == (f = P(Q).j[e]) ? void 0 : f.add(b)) ? h : new m.Set().add(b); + e = Ae(); + if (null != e[b]) + return e[b]; + b = Be(d)[b]; + if (!b) + return c; + b = new O(b); + b = Ce(b); + a = ze(b, a); + return null != a ? a : c; + }, Ce = function (a) { + var b = P(ve).g; + if (b) { + var c = Sa(I(a, oe, 5), function (d) { + return le(H(d, be, 1), b); + }); + if (c) + return H(c, ne, 2); + } + return H(a, ne, 4); + }, Q = function () { + this.h = {}; + this.i = []; + this.j = {}; + this.g = new m.Map(); + }, Ee = function (a, b, c) { + return !!De(1, a, void 0 === b ? !1 : b, c); + }, Fe = function (a, b, c) { + b = void 0 === b ? 0 : b; + a = Number(De(2, a, b, c)); + return isNaN(a) ? b : a; + }, Ge = function (a, b, c) { + return De(3, a, void 0 === b ? '' : b, c); + }, He = function (a, b, c) { + b = void 0 === b ? [] : b; + return De(6, a, b, c); + }, Be = function (a) { + return P(Q).h[a] || (P(Q).h[a] = {}); + }, Ie = function (a, b) { + var c = Be(b); + vc(a, function (d, e) { + return c[e] = d; + }); + }, Je = function (a, b, c, d, e) { + e = void 0 === e ? !1 : e; + var f = [], h = []; + Oa(b, function (g) { + var k = Be(g); + Oa(a, function (l) { + var n = G(l, qe), q = ye(l, n); + if (q) { + var y, ib, ud; + var jb = null != (ud = null == (y = P(Q).g.get(g)) ? void 0 : null == (ib = y.get(q)) ? void 0 : ib.slice(0)) ? ud : []; + a: { + y = new Ud(); + switch (n) { + case 1: + pb(y, 1, Vd, q); + break; + case 2: + pb(y, 2, Vd, q); + break; + case 3: + pb(y, 3, Vd, q); + break; + case 6: + pb(y, 4, Vd, q); + break; + default: + n = void 0; + break a; + } + ob(y, 5, jb); + n = y; + } + if (jb = n) { + var Ja; + jb = !(null == (Ja = P(Q).j[g]) || !Ja.has(q)); + } + jb && f.push(n); + if (Ja = n) { + var fa; + Ja = !(null == (fa = P(Q).g.get(g)) || !fa.has(q)); + } + Ja && h.push(n); + e || (fa = P(Q), fa.g.has(g) || fa.g.set(g, new m.Map()), fa.g.get(g).has(q) || fa.g.get(g).set(q, []), d && fa.g.get(g).get(q).push(d)); + k[q] = l.toJSON(); + } + }); + }); + (f.length || h.length) && ue(c, f, h, null != d ? d : void 0); + }, Ke = function (a, b) { + var c = Be(b); + Oa(a, function (d) { + var e = new O(d), f = G(e, qe); + (e = ye(e, f)) && (c[e] || (c[e] = d)); + }); + }, Le = function () { + return Qa(p(Object, 'keys').call(Object, P(Q).h), function (a) { + return Number(a); + }); + }, Me = function (a) { + Ta(P(Q).i, a) || Ie(Be(4), a); + }; + var R = function (a) { + this.methodName = a; + }, Ne = new R(1), Oe = new R(16), Pe = new R(15), Qe = new R(2), Re = new R(3), Se = new R(4), Te = new R(5), Ue = new R(6), Ve = new R(7), We = new R(8), Xe = new R(9), Ye = new R(10), Ze = new R(11), $e = new R(12), af = new R(13), bf = new R(14), S = function (a, b, c) { + c.hasOwnProperty(a.methodName) || Object.defineProperty(c, String(a.methodName), { value: b }); + }, T = function (a, b, c) { + return b[a.methodName] || c || function () { + }; + }, cf = function (a) { + S(Te, Ee, a); + S(Ue, Fe, a); + S(Ve, Ge, a); + S(We, He, a); + S(af, Ke, a); + S(Pe, Me, a); + }, df = function (a) { + S(Se, function (b) { + P(ve).g = b; + }, a); + S(Xe, function (b, c) { + var d = P(ve); + d.g[fe][b] || (d.g[fe][b] = c); + }, a); + S(Ye, function (b, c) { + var d = P(ve); + d.g[N][b] || (d.g[N][b] = c); + }, a); + S(Ze, function (b, c) { + var d = P(ve); + d.g[ge][b] || (d.g[ge][b] = c); + }, a); + S(bf, function (b) { + for (var c = P(ve), d = t([ + fe, + N, + ge + ]), e = d.next(); !e.done; e = d.next()) + e = e.value, p(Object, 'assign').call(Object, c.g[e], b[e]); + }, a); + }, ef = function (a) { + a.hasOwnProperty('init-done') || Object.defineProperty(a, 'init-done', { value: !0 }); + }; + var ff = function () { + this.g = function () { + }; + this.h = function () { + return []; + }; + }, gf = function (a, b, c) { + a.g = function (d) { + T(Qe, b, function () { + return []; + })(d, c); + }; + a.h = function () { + return T(Re, b, function () { + return []; + })(c); + }; + }; + var hf = function (a, b) { + try { + var c = a.split('.'); + a = z; + for (var d = 0, e; null != a && d < c.length; d++) + e = a, a = a[c[d]], 'function' === typeof a && (a = e[c[d]]()); + var f = a; + if (typeof f === b) + return f; + } catch (h) { + } + }, jf = function () { + var a = {}; + this[fe] = (a[8] = function (b) { + try { + return null != va(b); + } catch (c) { + } + }, a[9] = function (b) { + try { + var c = va(b); + } catch (d) { + return; + } + if (b = 'function' === typeof c) + c = c && c.toString && c.toString(), b = 'string' === typeof c && -1 != c.indexOf('[native code]'); + return b; + }, a[10] = function () { + return window == window.top; + }, a[6] = function (b) { + return Ta(P(ff).h(), parseInt(b, 10)); + }, a[27] = function (b) { + b = hf(b, 'boolean'); + return void 0 !== b ? b : void 0; + }, a[60] = function (b) { + try { + return !!z.document.querySelector(b); + } catch (c) { + } + }, a); + a = {}; + this[N] = (a[3] = function () { + return Bc(); + }, a[6] = function (b) { + b = hf(b, 'number'); + return void 0 !== b ? b : void 0; + }, a[11] = function (b) { + b = Cc(void 0 === b ? '' : b, z); + return null == b ? void 0 : b % 1000; + }, a); + a = {}; + this[ge] = (a[2] = function () { + return window.location.href; + }, a[3] = function () { + try { + return window.top.location.hash; + } catch (b) { + return ''; + } + }, a[4] = function (b) { + b = hf(b, 'string'); + return void 0 !== b ? b : void 0; + }, a); + }; + var kf = function () { + var a = void 0 === a ? z : a; + return a.ggeac || (a.ggeac = {}); + }; + var mf = function (a) { + A.call(this, a, -1, lf); + }; + v(mf, A); + mf.prototype.getId = function () { + return D(this, 1, 0); + }; + mf.prototype.A = function () { + return D(this, 7, 0); + }; + var lf = [2]; + var of = function (a) { + A.call(this, a, -1, nf); + }; + v(of, A); + of.prototype.A = function () { + return D(this, 5, 0); + }; + var nf = [2]; + var qf = function (a) { + A.call(this, a, -1, pf); + }; + v(qf, A); + var sf = function (a) { + A.call(this, a, -1, rf); + }; + v(sf, A); + sf.prototype.A = function () { + return D(this, 1, 0); + }; + var tf = function (a) { + A.call(this, a); + }; + v(tf, A); + var pf = [ + 1, + 4, + 2, + 3 + ], rf = [2]; + var uf = [ + 12, + 13, + 20 + ], vf = function () { + }, wf = function (a, b, c, d, e) { + e = void 0 === e ? {} : e; + var f = void 0 === e.Z ? !1 : e.Z, h = void 0 === e.ea ? {} : e.ea; + e = void 0 === e.$ ? [] : e.$; + a.i = b; + a.o = {}; + a.s = f; + a.l = h; + b = {}; + a.h = (b[c] = [], b[4] = [], b); + a.j = {}; + (c = $d()) && Oa(c.split(',') || [], function (g) { + (g = parseInt(g, 10)) && (a.j[g] = !0); + }); + Oa(e, function (g) { + a.j[g] = !0; + }); + a.g = d; + return a; + }, Af = function (a, b, c) { + var d = [], e = xf(a.i, b), f; + if (f = 9 !== b) + a.o[b] ? f = !0 : (a.o[b] = !0, f = !1); + if (f) { + var h; + null == (h = a.g) || te(h, b, c, d, [], 4); + return d; + } + if (!e.length) { + var g; + null == (g = a.g) || te(g, b, c, d, [], 3); + return d; + } + var k = Ta(uf, b), l = []; + Oa(e, function (q) { + var y = new Pd(); + if (q = yf(a, q, c, y)) + 0 !== G(y, Qd) && l.push(y), y = q.getId(), d.push(y), zf(a, y, k ? 4 : c), (q = I(q, O, 2)) && (k ? Je(q, Le(), a.g, y) : Je(q, [c], a.g, y)); + }); + var n; + null == (n = a.g) || te(n, b, c, d, l, 1); + return d; + }, zf = function (a, b, c) { + a.h[c] || (a.h[c] = []); + a = a.h[c]; + Ta(a, b) || a.push(b); + }, Bf = function (a, b) { + a.i.push.apply(a.i, u(Pa(Qa(b, function (c) { + return new sf(c); + }), function (c) { + return !Ta(uf, c.A()); + }))); + }, yf = function (a, b, c, d) { + var e = P(ve).g; + if (!le(H(b, be, 3), e)) + return null; + var f = I(b, mf, 2), h = D(b, 6, 0); + if (h) { + pb(d, 1, Qd, h); + f = e[N]; + switch (c) { + case 2: + var g = f[8]; + break; + case 1: + g = f[7]; + } + c = void 0; + if (g) + try { + c = g(h), F(d, 3, c); + } catch (k) { + } + return (b = Cf(b, c)) ? Df(a, [b], 1) : null; + } + if (h = D(b, 10, 0)) { + pb(d, 2, Qd, h); + g = null; + switch (c) { + case 1: + g = e[N][9]; + break; + case 2: + g = e[N][10]; + break; + default: + return null; + } + c = g ? g(String(h)) : void 0; + if (void 0 === c && 1 === D(b, 11, 0)) + return null; + void 0 !== c && F(d, 3, c); + return (b = Cf(b, c)) ? Df(a, [b], 1) : null; + } + d = e ? Pa(f, function (k) { + return le(H(k, be, 3), e); + }) : f; + if (!d.length) + return null; + c = d.length * D(b, 1, 0); + return (b = D(b, 4, 0)) ? Ef(a, b, c, d) : Df(a, d, c / 1000); + }, Ef = function (a, b, c, d) { + var e = null != a.l[b] ? a.l[b] : 1000; + if (0 >= e) + return null; + d = Df(a, d, c / e); + a.l[b] = d ? 0 : e - c; + return d; + }, Df = function (a, b, c) { + var d = a.j, e = Ra(b, function (f) { + return !!d[f.getId()]; + }); + return e ? e : a.s ? null : uc(b, c); + }, Ff = function (a, b) { + S(Ne, function (c) { + a.j[c] = !0; + }, b); + S(Qe, function (c, d) { + return Af(a, c, d); + }, b); + S(Re, function (c) { + return (a.h[c] || []).concat(a.h[4]); + }, b); + S($e, function (c) { + return Bf(a, c); + }, b); + S(Oe, function (c, d) { + return zf(a, c, d); + }, b); + }, xf = function (a, b) { + return (a = Ra(a, function (c) { + return c.A() == b; + })) && I(a, of, 2) || []; + }, Cf = function (a, b) { + var c = I(a, mf, 2), d = c.length, e = D(a, 8, 0); + a = d * D(a, 1, 0) - 1; + b = void 0 !== b ? b : Math.floor(1000 * tc()); + d = (b - e) % d; + if (b < e || b - e - d >= a) + return null; + c = c[d]; + e = P(ve).g; + return !c || e && !le(H(c, be, 3), e) ? null : c; + }; + var Gf = function () { + var a = {}; + this.j = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.g = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.l = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.h = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.i = function () { + }; + }, Hf = function (a) { + return P(Gf).j(a.g, a.defaultValue); + }; + var If = function () { + this.g = function () { + }; + }, Jf = function (a) { + P(If).g(a); + }; + var Kf, Lf, Mf, Nf, Of, Pf, Sf = function (a) { + var b = P(Qf).g, c = { + Z: U[211], + $: U[226] + }, d = void 0, e = 2; + d = void 0 === d ? kf() : d; + e = void 0 === e ? 0 : e; + var f = void 0 === f ? new re(null != (Nf = null == (Kf = H(a, tf, 5)) ? void 0 : D(Kf, 2, 0)) ? Nf : 0, null != (Of = null == (Lf = H(a, tf, 5)) ? void 0 : D(Lf, 4, 0)) ? Of : 0, null != (Pf = null == (Mf = H(a, tf, 5)) ? void 0 : mb(Mf, 3)) ? Pf : !1) : f; + d.hasOwnProperty('init-done') ? (T($e, d)(Qa(I(a, sf, 2), function (h) { + return h.toJSON(); + })), T(af, d)(Qa(I(a, O, 1), function (h) { + return h.toJSON(); + }), e), b && T(bf, d)(b), Rf(d, e)) : (Ff(wf(P(vf), I(a, sf, 2), e, f, c), d), cf(d), df(d), ef(d), Rf(d, e), Je(I(a, O, 1), [e], f, void 0, !0), xe = xe || !(!c || !c.xa), Jf(P(jf)), b && Jf(b)); + }, Rf = function (a, b) { + a = void 0 === a ? kf() : a; + b = void 0 === b ? 0 : b; + var c = a, d = b; + d = void 0 === d ? 0 : d; + gf(P(ff), c, d); + Tf(a, b); + P(If).g = T(bf, a); + P(Gf).i(); + }, Tf = function (a, b) { + var c = P(Gf); + c.j = function (d, e) { + return T(Te, a, function () { + return !1; + })(d, e, b); + }; + c.g = function (d, e) { + return T(Ue, a, function () { + return 0; + })(d, e, b); + }; + c.l = function (d, e) { + return T(Ve, a, function () { + return ''; + })(d, e, b); + }; + c.h = function (d, e) { + return T(We, a, function () { + return []; + })(d, e, b); + }; + c.i = function () { + T(Pe, a)(b); + }; + }; + var Uf = P(Gf).h(bd.g, bd.defaultValue); + function Vf(a) { + a = void 0 === a ? window.document : a; + Ec(Uf, a); + } + ; + var Wf = function (a) { + a = void 0 === a ? z : a; + return (a = a.performance) && a.now ? a.now() : null; + }; + var Xf = z.performance, Yf = !!(Xf && Xf.mark && Xf.measure && Xf.clearMarks), Zf = ic(function () { + var a; + if (a = Yf) + a = $d(), a = !!a.indexOf && 0 <= a.indexOf('1337'); + return a; + }); + var $f = ka(['https://pagead2.googlesyndication.com/pagead/js/err_rep.js']), ag = function (a, b, c) { + this.g = void 0 === a ? null : a; + this.i = void 0 === b ? 'jserror' : b; + this.h = null; + this.j = void 0 === c ? 0.01 : c; + this.o = this.l; + this.s = null; + }, bg = function (a, b) { + a.h = b; + }; + ag.prototype.l = function (a, b, c, d, e) { + c = void 0 === c ? this.j : c; + e = void 0 === e ? this.i : e; + if (Math.random() > c) + return !1; + b.error && b.meta && b.id || (b = new Yd(b, { + context: a, + id: e + })); + if (d || this.h) + b.meta = {}, this.h && this.h(b.meta), d && d(b.meta); + z.google_js_errors = z.google_js_errors || []; + z.google_js_errors.push(b); + if (!z.error_rep_loaded) { + c = Ic($f); + var f; + a = z.document; + b = null != (f = this.s) ? f : new J(fc(c).toString(), Fb); + f = Dc('SCRIPT', a); + f.src = fc(b); + gc(f); + (a = a.getElementsByTagName('script')[0]) && a.parentNode && a.parentNode.insertBefore(f, a); + z.error_rep_loaded = !0; + } + return !1; + }; + var cg = function (a, b) { + try { + var c = a.g && a.g.start('420', 3); + b(); + a.g && c && a.g.end(c); + } catch (d) { + if (a.g && c && (b = c) && Xf && Zf() && (Xf.clearMarks('goog_' + b.label + '_' + b.uniqueId + '_start'), Xf.clearMarks('goog_' + b.label + '_' + b.uniqueId + '_end')), !a.o(420, d, a.j, void 0, a.i)) + throw d; + } + }; + var dg = P(Gf).h(cd.g, cd.defaultValue); + function eg(a) { + a = void 0 === a ? window.document : a; + Ec(dg, a); + } + ; + var fg = Cb('gpt/pubads_impl_'); + var gg = function (a, b) { + var c = Wf(b); + c && (a = { + label: a, + type: 9, + value: c + }, b = b.google_js_reporting_queue = b.google_js_reporting_queue || [], 2048 > b.length && b.push(a)); + }, hg = function (a, b, c) { + var d = window; + return function () { + var e = Wf(), f = 3; + try { + var h = b.apply(this, arguments); + } catch (g) { + f = 13; + if (c) + return c(a, g), h; + throw g; + } finally { + d.google_measure_js_timing && e && (e = { + label: a.toString(), + value: e, + duration: (Wf() || 0) - e, + type: f + }, f = d.google_js_reporting_queue = d.google_js_reporting_queue || [], 2048 > f.length && f.push(e)); + } + return h; + }; + }, ig = function (a, b) { + return hg(a, b, function (c, d) { + new ag().l(c, d); + }); + }; + var jg = function () { + this.j = this.j; + this.i = this.i; + }; + jg.prototype.j = !1; + jg.prototype.L = function () { + if (this.i) + for (; this.i.length;) + this.i.shift()(); + }; + function V(a, b) { + return null == b ? '&' + a + '=null' : '&' + a + '=' + Math.floor(b); + } + function kg(a, b) { + return '&' + a + '=' + b.toFixed(3); + } + function lg() { + var a = new m.Set(); + var b = void 0 === b ? window : b; + b = b.googletag; + b = (null === b || void 0 === b ? 0 : b.apiReady) ? b : void 0; + try { + if (!b) + return a; + for (var c = b.pubads(), d = t(c.getSlots()), e = d.next(); !e.done; e = d.next()) + a.add(e.value.getSlotId().getDomId()); + } catch (f) { + } + return a; + } + function mg(a) { + a = a.id; + return null != a && (lg().has(a) || p(a, 'startsWith').call(a, 'google_ads_iframe_') || p(a, 'startsWith').call(a, 'aswift')); + } + function ng(a, b, c) { + if (!a.sources) + return !1; + switch (og(a)) { + case 2: + var d = pg(a); + if (d) + return c.some(function (f) { + return qg(d, f); + }); + case 1: + var e = rg(a); + if (e) + return b.some(function (f) { + return qg(e, f); + }); + } + return !1; + } + function og(a) { + if (!a.sources) + return 0; + a = a.sources.filter(function (b) { + return b.previousRect && b.currentRect; + }); + if (1 <= a.length) { + a = a[0]; + if (a.previousRect.top < a.currentRect.top) + return 2; + if (a.previousRect.top > a.currentRect.top) + return 1; + } + return 0; + } + function rg(a) { + return sg(a, function (b) { + return b.currentRect; + }); + } + function pg(a) { + return sg(a, function (b) { + return b.previousRect; + }); + } + function sg(a, b) { + return a.sources.reduce(function (c, d) { + d = b(d); + return c ? d && 0 !== d.width * d.height ? d.top < c.top ? d : c : c : d; + }, null); + } + var tg = function () { + jg.call(this); + this.h = this.g = this.G = this.F = this.K = 0; + this.V = this.S = Number.NEGATIVE_INFINITY; + this.N = this.P = this.R = this.T = this.Y = this.o = this.X = this.I = 0; + this.O = !1; + this.H = this.D = this.s = 0; + var a = document.querySelector('[data-google-query-id]'); + this.W = a ? a.getAttribute('data-google-query-id') : null; + this.l = null; + this.U = !1; + this.M = function () { + }; + }; + v(tg, jg); + var wg = function () { + var a = new tg(); + if (Hf(ed) && !window.google_plmetrics && window.PerformanceObserver) { + window.google_plmetrics = !0; + for (var b = t([ + 'layout-shift', + 'largest-contentful-paint', + 'first-input', + 'longtask' + ]), c = b.next(); !c.done; c = b.next()) + c = c.value, ug(a).observe({ + type: c, + buffered: !0 + }); + vg(a); + } + }, ug = function (a) { + a.l || (a.l = new PerformanceObserver(ig(640, function (b) { + var c = xg !== window.scrollX || yg !== window.scrollY ? [] : zg, d = Ag(); + b = t(b.getEntries()); + for (var e = b.next(); !e.done; e = b.next()) + switch (e = e.value, e.entryType) { + case 'layout-shift': + var f = a; + if (!e.hadRecentInput) { + f.K += Number(e.value); + Number(e.value) > f.F && (f.F = Number(e.value)); + f.G += 1; + var h = ng(e, c, d); + h && (f.o += e.value, f.T++); + if (5000 < e.startTime - f.S || 1000 < e.startTime - f.V) + f.S = e.startTime, f.g = 0, f.h = 0; + f.V = e.startTime; + f.g += e.value; + h && (f.h += e.value); + f.g > f.I && (f.I = f.g, f.Y = f.h, f.X = e.startTime + e.duration); + } + break; + case 'largest-contentful-paint': + a.R = Math.floor(e.renderTime || e.loadTime); + a.P = e.size; + break; + case 'first-input': + a.N = Number((e.processingStart - e.startTime).toFixed(3)); + a.O = !0; + break; + case 'longtask': + e = Math.max(0, e.duration - 50), a.s += e, a.D = Math.max(a.D, e), a.H += 1; + } + }))); + return a.l; + }, vg = function (a) { + var b = ig(641, function () { + var d = document; + 2 == (Hf(dd) && d.prerendering ? 3 : { + visible: 1, + hidden: 2, + prerender: 3, + preview: 4, + unloaded: 5 + }[d.visibilityState || d.webkitVisibilityState || d.mozVisibilityState || ''] || 0) && Bg(a); + }), c = ig(641, function () { + return void Bg(a); + }); + document.addEventListener('visibilitychange', b); + document.addEventListener('unload', c); + a.M = function () { + document.removeEventListener('visibilitychange', b); + document.removeEventListener('unload', c); + ug(a).disconnect(); + }; + }; + tg.prototype.L = function () { + jg.prototype.L.call(this); + this.M(); + }; + var Bg = function (a) { + if (!a.U) { + a.U = !0; + ug(a).takeRecords(); + var b = 'https://pagead2.googlesyndication.com/pagead/gen_204?id=plmetrics'; + window.LayoutShift && (b += kg('cls', a.K), b += kg('mls', a.F), b += V('nls', a.G), window.LayoutShiftAttribution && (b += kg('cas', a.o), b += V('nas', a.T)), b += kg('wls', a.I), b += kg('tls', a.X), window.LayoutShiftAttribution && (b += kg('was', a.Y))); + window.LargestContentfulPaint && (b += V('lcp', a.R), b += V('lcps', a.P)); + window.PerformanceEventTiming && a.O && (b += V('fid', a.N)); + window.PerformanceLongTaskTiming && (b += V('cbt', a.s), b += V('mbt', a.D), b += V('nlt', a.H)); + for (var c = 0, d = t(document.getElementsByTagName('iframe')), e = d.next(); !e.done; e = d.next()) + mg(e.value) && c++; + b += V('nif', c); + c = window.google_unique_id; + b += V('ifi', 'number' === typeof c ? c : 0); + c = P(ff).h(); + b += '&eid=' + encodeURIComponent(c.join()); + b += '&top=' + (z === z.top ? 1 : 0); + b += a.W ? '&qqid=' + encodeURIComponent(a.W) : V('pvsid', Fc(z)); + window.googletag && (b += '&gpt=1'); + window.fetch(b, { + keepalive: !0, + credentials: 'include', + redirect: 'follow', + method: 'get', + mode: 'no-cors' + }); + a.j || (a.j = !0, a.L()); + } + }, qg = function (a, b) { + var c = Math.min(a.right, b.right) - Math.max(a.left, b.left); + a = Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top); + return 0 >= c || 0 >= a ? !1 : 50 <= 100 * c * a / ((b.right - b.left) * (b.bottom - b.top)); + }, Ag = function () { + var a = [].concat(u(document.getElementsByTagName('iframe'))).filter(mg), b = [].concat(u(lg())).map(function (c) { + return document.getElementById(c); + }).filter(function (c) { + return null !== c; + }); + xg = window.scrollX; + yg = window.scrollY; + return zg = [].concat(u(a), u(b)).map(function (c) { + return c.getBoundingClientRect(); + }); + }, xg = void 0, yg = void 0, zg = []; + var W = { + issuerOrigin: 'https://attestation.android.com', + issuancePath: '/att/i', + redemptionPath: '/att/r' + }, X = { + issuerOrigin: 'https://pagead2.googlesyndication.com', + issuancePath: '/dtt/i', + redemptionPath: '/dtt/r', + getStatePath: '/dtt/s' + }; + var Cg = function () { + var a = void 0 === a ? window : a; + a = a.navigator.userAgent; + var b = /Chrome/.test(a); + return /Android/.test(a) && b; + }, Dg = P(Gf).h(kd.g, kd.defaultValue), Eg = function (a, b, c) { + a = void 0 === a ? !1 : a; + b = void 0 === b ? !1 : b; + c = void 0 === c ? !1 : c; + jg.call(this); + var d = this; + this.g = a; + a = []; + b && Cg() && a.push(W); + c && a.push(X); + if (document.hasTrustToken && !Hf(hd) && !Array.isArray(window.goog_tt_state)) { + var e = a.map(function (f) { + return { + issuerOrigin: f.issuerOrigin, + state: d.g ? 1 : 12 + }; + }); + Object.defineProperty(window, 'goog_tt_state', { + configurable: !1, + get: function () { + return e.slice(); + } + }); + } + }; + v(Eg, jg); + var Fg = function () { + var a = window; + a = void 0 === a ? window : a; + return !a.PeriodicSyncManager; + }, Gg = function () { + var a = void 0 === a ? window.document : a; + Ec(Dg, a); + }, Hg = function (a) { + var b = U[150]; + return U[221] || '.google.ch' === b || 'function' === typeof a.__tcfapi; + }, Y = function (a, b, c) { + var d, e = null == (d = window.goog_tt_state) ? void 0 : p(d, 'find').call(d, function (f) { + return f.issuerOrigin === a; + }); + e && (e.state = b, void 0 != c && (e.hasRedemptionRecord = c)); + }, Ig = function () { + var a = W.issuerOrigin + W.redemptionPath, b = { + keepalive: !0, + trustToken: { + type: 'token-redemption', + issuer: W.issuerOrigin, + refreshPolicy: 'none' + } + }; + Y(W.issuerOrigin, 2); + return window.fetch(a, b).then(function (c) { + if (!c.ok) + throw Error(c.status + ': Network response was not ok!'); + Y(W.issuerOrigin, 6, !0); + }).catch(function (c) { + c && 'NoModificationAllowedError' === c.name ? Y(W.issuerOrigin, 6, !0) : Y(W.issuerOrigin, 5); + }); + }, Jg = function () { + var a = W.issuerOrigin + W.issuancePath; + Y(W.issuerOrigin, 8); + return window.fetch(a, { + keepalive: !0, + trustToken: { type: 'token-request' } + }).then(function (b) { + if (!b.ok) + throw Error(b.status + ': Network response was not ok!'); + Y(W.issuerOrigin, 10); + return Ig(); + }).catch(function (b) { + if (b && 'NoModificationAllowedError' === b.name) + return Y(W.issuerOrigin, 10), Ig(); + Y(W.issuerOrigin, 9); + }); + }, Kg = function () { + Y(W.issuerOrigin, 13); + return document.hasTrustToken(W.issuerOrigin).then(function (a) { + return a ? Ig() : Jg(); + }); + }, Lg = function () { + Y(X.issuerOrigin, 13); + if (window.Promise) { + var a = document.hasTrustToken(X.issuerOrigin).then(function (e) { + return e; + }).catch(function (e) { + return window.Promise.reject({ + state: 19, + error: e + }); + }), b = X.issuerOrigin + X.redemptionPath, c = { + keepalive: !0, + trustToken: { + type: 'token-redemption', + refreshPolicy: 'none' + } + }; + Y(X.issuerOrigin, 16); + a = a.then(function (e) { + return window.fetch(b, c).then(function (f) { + if (!f.ok) + throw Error(f.status + ': Network response was not ok!'); + Y(X.issuerOrigin, 18, !0); + }).catch(function (f) { + if (f && 'NoModificationAllowedError' === f.name) + Y(X.issuerOrigin, 18, !0); + else { + if (e) + return window.Promise.reject({ + state: 17, + error: f + }); + Y(X.issuerOrigin, 17); + } + }); + }).then(function () { + return document.hasTrustToken(X.issuerOrigin).then(function (e) { + return e; + }).catch(function (e) { + return window.Promise.reject({ + state: 19, + error: e + }); + }); + }).then(function (e) { + var f = X.issuerOrigin + X.getStatePath; + Y(X.issuerOrigin, 20); + return window.fetch(f + '?ht=' + e, { + trustToken: { + type: 'send-redemption-record', + issuers: [X.issuerOrigin] + } + }).then(function (h) { + if (!h.ok) + throw Error(h.status + ': Network response was not ok!'); + Y(X.issuerOrigin, 22); + return h.text().then(function (g) { + return JSON.parse(g); + }); + }).catch(function (h) { + return window.Promise.reject({ + state: 21, + error: h + }); + }); + }); + var d = Fc(window); + return a.then(function (e) { + var f = X.issuerOrigin + X.issuancePath; + return e && e.srqt && e.cs ? (Y(X.issuerOrigin, 23), window.fetch(f + '?cs=' + e.cs + '&correlator=' + d, { + keepalive: !0, + trustToken: { type: 'token-request' } + }).then(function (h) { + if (!h.ok) + throw Error(h.status + ': Network response was not ok!'); + Y(X.issuerOrigin, 25); + return e; + }).catch(function (h) { + return window.Promise.reject({ + state: 24, + error: h + }); + })) : e; + }).then(function (e) { + if (e && e.srdt && e.cs) + return Y(X.issuerOrigin, 26), window.fetch(b + '?cs=' + e.cs + '&correlator=' + d, { + keepalive: !0, + trustToken: { + type: 'token-redemption', + refreshPolicy: 'refresh' + } + }).then(function (f) { + if (!f.ok) + throw Error(f.status + ': Network response was not ok!'); + Y(X.issuerOrigin, 28, !0); + }).catch(function (f) { + return window.Promise.reject({ + state: 27, + error: f + }); + }); + }).then(function () { + Y(X.issuerOrigin, 29); + }).catch(function (e) { + if (e instanceof Object && e.hasOwnProperty('state') && e.hasOwnProperty('error')) + if ('number' === typeof e.state && e.error instanceof Error) { + Y(X.issuerOrigin, e.state); + var f = P(Gf).g(jd.g, jd.defaultValue); + Math.random() <= f && Hc({ + state: e.state, + err: e.error.toString() + }, 'dtt_err'); + } else + throw Error(e); + else + throw e; + }); + } + }, Mg = function (a) { + if (document.hasTrustToken && !Hf(hd) && a.g) { + if (window.goog_tt_promise) + return window.goog_tt_promise; + a = window.goog_tt_state; + if (Array.isArray(a)) { + var b = []; + p(a, 'find').call(a, function (c) { + return c.issuerOrigin === W.issuerOrigin; + }) && b.push(Kg()); + p(a, 'find').call(a, function (c) { + return c.issuerOrigin === X.issuerOrigin; + }) && b.push(Lg()); + if (window.Promise && window.Promise.all) + return a = window.Promise.all(b), 'object' != typeof window.goog_tt_promise && Object.defineProperty(window, 'goog_tt_promise', { + configurable: !1, + value: a, + writable: !1 + }), a; + } + } + }; + var Ng = 'platform platformVersion architecture model uaFullVersion bitness'.split(' '); + function Og(a) { + var b, c; + return 'function' !== typeof (null === (c = null === (b = null === a || void 0 === a ? void 0 : a.navigator) || void 0 === b ? void 0 : b.userAgentData) || void 0 === c ? void 0 : c.getHighEntropyValues) ? null : a.navigator.userAgentData.getHighEntropyValues(Ng).then(function (d) { + var e = new nd(); + e = C(e, 1, d.platform); + e = C(e, 2, d.platformVersion); + e = C(e, 3, d.architecture); + e = C(e, 4, d.model); + e = C(e, 5, d.uaFullVersion); + return C(e, 9, d.bitness); + }); + } + ; + function Pg() { + var a; + return null !== (a = z.googletag) && void 0 !== a ? a : z.googletag = {}; + } + function Qg(a, b) { + var c = Pg(); + c.hasOwnProperty(a) || (c[a] = b); + } + ; + var Z = {}, U = (Z[23] = 0.001, Z[38] = 0.001, Z[58] = 1, Z[150] = '', Z[211] = !1, Z[253] = !1, Z[172] = null, Z[246] = [], Z[226] = [], Z[252] = null, Z[258] = null, Z[251] = null, Z[259] = null, Z[6] = function (a, b) { + b = void 0 === b ? !0 : b; + try { + for (var c = null; c != a; c = a, a = a.parent) + switch (a.location.protocol) { + case 'https:': + return !0; + case 'file:': + return b; + case 'http:': + return !1; + } + } catch (d) { + } + return !0; + }(window), Z[36] = Ac('false'), Z[148] = we, Z[221] = Ac(''), Z[257] = Ac('false'), Z[260] = void 0, Z[262] = Ac('false'), Z); + function Rg(a, b) { + U[a] = b; + } + var Sg = Pg(); + p(Object, 'assign').call(Object, U, Sg._vars_); + Sg._vars_ = U; + var Tg = new m.WeakMap(), Ug = function (a, b) { + a = [a]; + for (var c = b.length - 1; 0 <= c; --c) + a.push(typeof b[c], b[c]); + return a.join('\x0B'); + }; + var Vg = function (a, b) { + b = void 0 === b ? Ug : b; + var c = ya(a), d = function (e) { + e = t(e); + e.next(); + e = la(e); + return b(c, e); + }; + return function () { + var e = w.apply(0, arguments), f = this || z, h = Tg.get(f); + h || (h = {}, Tg.set(f, h)); + f = h; + h = [this].concat(u(e)); + e = d ? d(h) : h; + if (Object.prototype.hasOwnProperty.call(f, e)) + f = f[e]; + else { + var g = t(h); + h = g.next().value; + g = la(g); + h = a.apply(h, g); + f = f[e] = h; + } + return f; + }; + }(function (a) { + return (null === a || void 0 === a ? 0 : a.src) ? /^(?:https?:)?\/\/(?:www\.googletagservices\.com|securepubads\.g\.doubleclick\.net|pagead2\.googlesyndication\.com)\/tag\/js\/gpt(?:_[a-z]+)*\.js/.test(a.src) ? 0 : 1 : 2; + }, function (a, b) { + var c; + return a + '\x0B' + (null === (c = b[0]) || void 0 === c ? void 0 : c.src); + }); + function Wg() { + return 0 === Vg(U[172]); + } + ; + function Xg() { + return zc('1') || 0; + } + function Yg() { + var a = Zg; + var b = Number(a); + if (1 > b || Math.floor(b) !== b) + Hc({ v: a }, 'gpt_inv_ver'), a = '1'; + return a; + } + var Zg = '2022011002'; + var Qf = function () { + var a = {}, b = {}, c = {}; + this.g = (c[fe] = (a[3] = Wg, a[17] = function () { + return p(w.apply(0, arguments), 'includes').call(w.apply(0, arguments), String(Cc())); + }, a[59] = function () { + var d = w.apply(0, arguments), e = p(d, 'includes'), f = String, h; + var g = void 0 === g ? window : g; + var k; + g = null != (k = null == (h = oc(g.location.href.match(nc)[3] || null)) ? void 0 : h.split('.')) ? k : []; + h = 2 > g.length ? null : 'uk' === g[g.length - 1] ? 3 > g.length ? null : wc(g.splice(g.length - 3).join('.')) : wc(g.splice(g.length - 2).join('.')); + return e.call(d, f(h)); + }, a[21] = function () { + return U[148]; + }, a[61] = function () { + return U[221]; + }, a[63] = function () { + return U[221] || '.google.ch' === U[150]; + }, a[50] = function () { + return 1 === Math.floor(new Date().getTime() / 24 / 60 / 60 / 1000) % 2; + }, a[54] = function () { + return !!U[259]; + }, a), c[N] = (b[1] = function () { + var d; + return null !== (d = zc('{{MOD}}')) && void 0 !== d ? d : -1; + }, b[4] = Xg, b), c); + }; + function $g(a) { + var b = new qf(U[246]); + a = new qf(a); + if (!I(b, O, 1).length && I(a, O, 1).length) { + var c = I(a, O, 1); + tb(b, 1, c); + } + !I(b, sf, 2).length && I(a, sf, 2).length && (c = I(a, sf, 2), tb(b, 2, c)); + null == B(b, 5) && null != B(a, 5) && (a = H(a, tf, 5), qb(b, 5, a)); + Sf(b); + } + ; + function ah(a) { + return (a = a.currentScript) ? a : null; + } + function bh(a) { + var b; + a = t(null !== (b = a.scripts) && void 0 !== b ? b : []); + for (var c = a.next(); !c.done; c = a.next()) + if (c = c.value, p(c.src, 'includes').call(c.src, '/tag/js/gpt')) + return c; + return null; + } + function ch(a) { + return !(null === a || void 0 === a || !a.src) && 'pagead2.googlesyndication.com' === oc(a.src.match(nc)[3] || null); + } + function dh(a) { + var b = ah(a); + return 'complete' === a.readyState || 'loaded' === a.readyState || !(null === b || void 0 === b || !b.async); + } + function eh(a) { + a = ch(a) ? Cb('https://pagead2.googlesyndication.com/') : Cb('https://securepubads.g.doubleclick.net/'); + a = Kb([ + a, + fg, + Cb('2022011002'), + Cb('.js') + ]); + var b = P(Gf).g(ad.g, ad.defaultValue); + return b ? Jb(a, String(b)) : a; + } + var fh = function () { + this.h = []; + this.error = this.g = void 0; + }, gh = function (a, b, c) { + a.g = b; + a.error = c; + for (var d = t(a.h), e = d.next(); !e.done; e = d.next()) + e = e.value, e(b, c); + a.h.length = 0; + }; + function hh(a, b, c) { + a = a.location.host; + var d = b && qc(b.src, 'domain'), e = b && qc(b.src, 'network-code'); + if (!a && !d && !e) + return gh(c, void 0, new m.globalThis.Error('no provided or inferred data')), null; + b = ch(b) ? Cb('https://pagead2.googlesyndication.com') : Cb('https://securepubads.g.doubleclick.net'); + return Jb(Kb([ + b, + Cb('/pagead/ppub_config') + ]), { + ippd: a, + pppd: d, + pppnc: e + }); + } + function ih(a, b) { + const $___old_543280f2abca36de = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_543280f2abca36de) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_cb5c8f55a9bbea8b.XMLHttpRequest)); + return function () { + var c = new fh(); + Rg(260, function (e) { + void 0 !== c.g || c.error ? e(c.g, c.error) : c.h.push(e); + }); + if (b = hh(a, b, c)) { + var d = new m.globalThis.XMLHttpRequest(); + d.open('GET', b.toString(), !0); + d.withCredentials = !1; + d.onload = function () { + 300 > d.status ? (gg('13', a), gh(c, 204 === d.status ? '' : d.responseText)) : gh(c, void 0, new m.globalThis.Error('resp:' + d.status)); + }; + d.onerror = function () { + return void gh(c, void 0, new m.globalThis.Error('s:' + d.status + ' rs:' + d.readyState)); + }; + d.send(); + } + }.apply(this, arguments); + } finally { + if ($___old_543280f2abca36de) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_543280f2abca36de)); + } + } + function jh(a, b, c, d) { + U[172] = d; + U[259] = dh(a); + $g(b); + P(ff).g(12); + P(ff).g(5); + Gg(); + Hg(c) || (a = !Fg() && Hf(fd) || Fg() && Hf(gd), b = Hf(id), a = new Eg(!0, a, b), 0 < P(Gf).g(ld.g, ld.defaultValue) ? Rg(258, Mg(a)) : Mg(a)); + (a = Og(c)) && a.then(function (e) { + e = vb(e); + U[251] = e; + }); + eg(c.document); + Vf(c.document); + } + function kh(a, b) { + var c, d, e, f, h, g = Pg(), k = null !== (c = null !== a && void 0 !== a ? a : g.fifWin) && void 0 !== c ? c : window; + a = k.document; + var l = g.fifWin ? window : k; + Qg('_loaded_', !0); + Qg('getVersion', Yg); + Qg('cmd', []); + var n = null !== (d = ah(a)) && void 0 !== d ? d : bh(a); + jh(a, b, k, n); + try { + wg(); + } catch (ib) { + } + gg('1', k); + b = eh(n); + if (!U[259]) { + k = 'gpt-impl-' + Math.random(); + try { + hc(a, Wb(b, { + id: k, + nonce: lc() + })); + } catch (ib) { + } + a.getElementById(k) && (g._loadStarted_ = !0); + } + if (!g._loadStarted_) { + k = g.fifWin ? l.document : a; + var q = Dc('SCRIPT'); + q.src = fc(b); + gc(q); + q.async = !0; + var y = null !== (f = null !== (e = k.head) && void 0 !== e ? e : k.body) && void 0 !== f ? f : k.documentElement; + 'complete' !== l.document.readyState && g.fifWin ? jc(l, function () { + return void y.appendChild(q); + }) : y.appendChild(q); + g._loadStarted_ = !0; + } + l === l.top && (Hf($c) || U[259] || !ah(a) && (null === (h = bh(a)) || void 0 === h ? 0 : h.async)) && (Dd(l), ih(l, n)); + } + ; + var lh; + a: { + try { + if (Array.isArray(E)) { + lh = E; + break a; + } + } catch (a) { + } + lh = []; + } + (function (a, b) { + var c = new ag(null, 'gpt_exception', 0.01); + bg(c, function (d) { + d.methodId = 420; + }); + cg(c, function () { + return void kh(a, b); + }); + }(void 0, lh)); + }.call(this.googletag && googletag.fifWin ? googletag.fifWin.parent : this, [ + [ + [ + null, + 7, + null, + [ + null, + 0.1 + ] + ], + [ + 410803690, + null, + null, + [1] + ], + [ + 398776878, + null, + null, + [1] + ], + [ + 411170147, + null, + null, + [1] + ], + [ + null, + 408380992, + null, + [ + null, + 0.01 + ] + ], + [ + 400963805, + null, + null, + [1] + ], + [ + 400992468, + null, + null, + [1] + ], + [ + null, + 397316938, + null, + [ + null, + 1000 + ] + ], + [ + null, + 385440135, + null, + [ + null, + 1000 + ] + ], + [ + null, + 377289019, + null, + [ + null, + 10000 + ] + ], + [ + null, + 385610149, + null, + [ + null, + 300 + ] + ], + [ + null, + 529, + null, + [ + null, + 20 + ] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ] + ], + [ + 410568046, + null, + null, + [1] + ], + [ + 411840949, + null, + null, + [1] + ], + [ + 413681686, + null, + null, + [1] + ], + [ + 413477729, + null, + null, + [1] + ], + [ + 413667516, + null, + null, + [1] + ], + [ + 20, + null, + null, + null, + [[ + [ + 1, + [[ + 6, + null, + null, + 3, + null, + 0 + ]] + ], + [1] + ]] + ], + [ + null, + 388529191, + null, + null, + [[ + [ + 4, + null, + 59, + null, + null, + null, + null, + ['4276767238'] + ], + [ + null, + 86400 + ] + ]] + ], + [ + null, + 492, + null, + [ + null, + 0.01 + ] + ], + [ + null, + 389357230, + null, + [ + null, + 1000 + ] + ], + [ + null, + 398776877, + null, + [ + null, + 60000 + ] + ], + [ + 403426966, + null, + null, + [1] + ], + [ + null, + 374201269, + null, + [ + null, + 60000 + ] + ], + [ + null, + 371364213, + null, + [ + null, + 60000 + ] + ], + [ + null, + 373440923, + null, + [ + null, + 0.0001 + ] + ], + [ + null, + 376149757, + null, + [ + null, + 0.0025 + ] + ], + [ + null, + 396668915, + null, + [ + null, + 5 + ] + ], + [ + 399982759, + null, + null, + [1] + ], + [ + null, + 47, + null, + [ + null, + 1 + ] + ], + [ + null, + null, + 2, + [ + null, + null, + '1-0-38' + ] + ], + [ + 392065905, + null, + null, + null, + [[ + [ + 3, + [ + [ + 4, + null, + 15, + null, + null, + null, + null, + ['18190176,155953048'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['49944529'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['5441'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6177'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6782'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6581'] + ] + ] + ], + [1] + ]] + ], + [ + null, + 360245595, + null, + [ + null, + 500 + ] + ], + [ + 396442598, + null, + null, + [1] + ], + [ + null, + 61, + null, + [ + null, + 0.001 + ] + ], + [ + 1936, + null, + null, + [1] + ], + [ + null, + 1921, + null, + [ + null, + 72 + ] + ], + [ + null, + 1920, + null, + [ + null, + 24 + ] + ], + [ + null, + 1922, + null, + [ + null, + 5 + ] + ], + [ + null, + 1917, + null, + [ + null, + 300 + ] + ], + [ + null, + 1916, + null, + [ + null, + 0.001 + ] + ], + [ + null, + null, + null, + [ + null, + null, + null, + [ + 'A8FHS1NmdCwGqD9DwOicnHHY+y27kdWfxKa0YHSGDfv0CSpDKRHTQdQmZVPDUdaFWUsxdgVxlwAd6o+dhJykPA0AAACWeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9', + 'A8zdXi6dr1hwXEUjQrYiyYQGlU3557y5QWDnN0Lwgj9ePt66XMEvNkVWOEOWPd7TP9sBQ25X0Q15Lr1Nn4oGFQkAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9', + 'A4/Htern2udN9w3yJK9QgWQxQFruxOXsXL7cW60DyCl0EZFGCSme/J33Q/WzF7bBkVvhEWDlcBiUyZaim5CpFQwAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9' + ] + ], + null, + 1934 + ], + [ + 1903, + null, + null, + [1] + ], + [ + 1953, + null, + null, + [1] + ], + [ + 1938, + null, + null, + [1] + ], + [ + 1948, + null, + null, + [1] + ], + [ + null, + null, + null, + [ + null, + null, + null, + [ + 'AxujKG9INjsZ8/gUq8+dTruNvk7RjZQ1oFhhgQbcTJKDnZfbzSTE81wvC2Hzaf3TW4avA76LTZEMdiedF1vIbA4AAABueyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzVGhpcmRQYXJ0eSI6dHJ1ZX0=', + 'Azuce85ORtSnWe1MZDTv68qpaW3iHyfL9YbLRy0cwcCZwVnePnOmkUJlG8HGikmOwhZU22dElCcfrfX2HhrBPAkAAAB7eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'A16nvcdeoOAqrJcmjLRpl1I6f3McDD8EfofAYTt/P/H4/AWwB99nxiPp6kA0fXoiZav908Z8etuL16laFPUdfQsAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'AxBHdr0J44vFBQtZUqX9sjiqf5yWZ/OcHRcRMN3H9TH+t90V/j3ENW6C8+igBZFXMJ7G3Pr8Dd13632aLng42wgAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'A88BWHFjcawUfKU3lIejLoryXoyjooBXLgWmGh+hNcqMK44cugvsI5YZbNarYvi3roc1fYbHA1AVbhAtuHZflgEAAAB2eyJvcmlnaW4iOiJodHRwczovL2dvb2dsZS5jb206NDQzIiwiZmVhdHVyZSI6IlRydXN0VG9rZW5zIiwiZXhwaXJ5IjoxNjUyNzc0NDAwLCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==' + ] + ], + null, + 1932 + ], + [ + null, + 397907552, + null, + [ + null, + 500 + ] + ], + [ + 401243724, + null, + null, + [1] + ] + ], + [ + [ + 20, + [[ + 50, + [ + [31062930], + [ + 31062931, + [[ + 380025941, + null, + null, + [1] + ]] + ] + ], + null, + null, + null, + null, + null, + 101, + null, + 102 + ]] + ], + [ + 13, + [ + [ + 10, + [ + [44756894], + [ + 44756895, + [[ + 1947, + null, + null, + [1] + ]] + ] + ] + ], + [ + 10, + [ + [44756896], + [44756897] + ] + ], + [ + 10, + [ + [44756431], + [ + 44756432, + [[ + 1960, + null, + null, + [1] + ]] + ] + ] + ], + [ + 1, + [ + [ + 31062554, + null, + [ + 2, + [ + [ + 6, + null, + null, + 3, + null, + 0 + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(9[23456789]|\\d{3,})', + ['navigator.userAgent'] + ] + ] + ] + ], + [ + 31062555, + [[ + 395842139, + null, + null, + [1] + ]], + [ + 2, + [ + [ + 6, + null, + null, + 3, + null, + 0 + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(9[23456789]|\\d{3,})', + ['navigator.userAgent'] + ] + ] + ] + ] + ] + ], + [ + 1000, + [[21067496]], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['document.hasTrustToken'] + ] + ], + [ + 1000, + [[ + 31060475, + null, + [ + 2, + [ + [ + 1, + [[ + 4, + null, + 9, + null, + null, + null, + null, + ['window.PeriodicSyncManager'] + ]] + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ] + ] + ] + ]] + ], + [ + 500, + [ + [31061692], + [ + 31061693, + [ + [ + 77, + null, + null, + [1] + ], + [ + 78, + null, + null, + [1] + ], + [ + 85, + null, + null, + [1] + ], + [ + 80, + null, + null, + [1] + ], + [ + 76, + null, + null, + [1] + ] + ] + ] + ], + [ + 4, + null, + 6, + null, + null, + null, + null, + ['31061691'] + ] + ], + [ + 1, + [ + [31062890], + [ + 31062891, + [[ + 397841828, + null, + null, + [1] + ]] + ] + ] + ], + [ + 1, + [[31062946]], + [ + 4, + null, + 27, + null, + null, + null, + null, + ['document.prerendering'] + ] + ], + [ + 1, + [[31062947]], + [ + 1, + [[ + 4, + null, + 27, + null, + null, + null, + null, + ['document.prerendering'] + ]] + ] + ] + ] + ], + [ + 4, + [ + [ + null, + [ + [ + 44714449, + [[ + null, + 7, + null, + [ + null, + 1 + ] + ]] + ], + [ + 676982961, + [ + [ + null, + 7, + null, + [ + null, + 0.4 + ] + ], + [ + 212, + null, + null, + [1] + ] + ] + ], + [ + 676982996, + [[ + null, + 7, + null, + [ + null, + 1 + ] + ]] + ] + ] + ], + [ + 10, + [ + [31063162], + [ + 31063163, + [[ + 359351145, + null, + null, + [1] + ]] + ] + ], + [ + 3, + [ + [ + 4, + null, + 15, + null, + null, + null, + null, + ['18190176,155953048'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['49944529'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['5441'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6177'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6782'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6581'] + ] + ] + ], + 40 + ] + ] + ], + [ + 3, + [ + [ + null, + [ + [44732730], + [44732731] + ] + ], + [ + null, + [ + [676982960], + [676982994], + [676982998] + ] + ], + [ + null, + [ + [676982975], + [676982980] + ] + ], + [ + null, + [[ + 1337, + [ + [ + 77, + null, + null, + [1] + ], + [ + 78, + null, + null, + [1] + ], + [ + 85, + null, + null, + [1] + ], + [ + 80, + null, + null, + [1] + ], + [ + 76, + null, + null, + [1] + ], + [ + 84, + null, + null, + [1] + ], + [ + 188, + null, + null, + [1] + ] + ] + ]] + ], + [ + 10, + [ + [21064365], + [ + 21064372, + [[ + null, + null, + null, + [ + null, + null, + null, + ['flash'] + ], + null, + 489 + ]] + ] + ], + null, + 15 + ], + [ + 10, + [ + [21068766], + [ + 21068767, + [[ + null, + 488, + null, + [ + null, + 0.1 + ] + ]] + ] + ], + null, + 42 + ], + [ + 1000, + [[ + 31060545, + [[ + null, + null, + 363931022, + [ + null, + null, + 'A0Bg2nddUj4Nw6FzsXudBXHZs1aAzIgO+UGzfJGkC1f4J56ghvJ6TCirjdt8BUwsK14sBBjWGmOY+QCTr2HrBQoAAACBeyJvcmlnaW4iOiJodHRwczovL3NlY3VyZXB1YmFkcy5nLmRvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiU3VicmVzb3VyY2VXZWJCdW5kbGVzIiwiZXhwaXJ5IjoxNjUyODMxOTk5LCJpc1RoaXJkUGFydHkiOnRydWV9' + ] + ]] + ]], + [ + 2, + [ + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(9\\d|\\d{3,})', + ['navigator.userAgent'] + ], + [ + 3, + [ + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + -1 + ], + [ + 7, + null, + null, + 1, + null, + 10 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 29 + ], + [ + 7, + null, + null, + 1, + null, + 50 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ] + ] + ] + ] + ], + [ + 1, + [ + [31062923], + [ + 31062924, + [[ + 144, + null, + null, + [1] + ]] + ] + ] + ], + [ + 10, + [ + [31063256], + [31063257] + ] + ], + [ + 10, + [ + [31063706], + [ + 31063707, + [[ + null, + 359346956, + null, + [ + null, + 1 + ] + ]] + ], + [ + 31063708, + [[ + null, + 359346956, + null, + [ + null, + 2 + ] + ]] + ] + ] + ], + [ + 500, + [ + [ + 31063709, + null, + [ + 4, + null, + 8, + null, + null, + null, + null, + ['top.frames.google_ads_top_frame'] + ] + ], + [ + 31063710, + [[ + 360245596, + null, + null, + [1] + ]], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['top.frames.google_ads_top_frame'] + ] + ] + ] + ], + [ + null, + [ + [ + 31063831, + null, + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + -1 + ], + [ + 7, + null, + null, + 1, + null, + 5 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ], + [ + 31063832, + null, + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 4 + ], + [ + 7, + null, + null, + 1, + null, + 10 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ] + ], + [ + 4, + null, + 3 + ] + ], + [ + 1, + [ + [31063874], + [ + 31063875, + [[ + null, + 357045128, + null, + [ + null, + 1 + ] + ]] + ], + [ + 31063876, + [[ + null, + 357045128, + null, + [ + null, + 2 + ] + ]] + ] + ] + ], + [ + null, + [ + [ + 31063890, + [[ + null, + 488, + null, + [ + null, + 0.1 + ] + ]] + ], + [ + 31063891, + [ + [ + 402905035, + null, + null, + [1] + ], + [ + null, + 488, + null, + [ + null, + 0.1 + ] + ] + ] + ] + ], + null, + 42 + ], + [ + 1, + [ + [31063916], + [ + 31063917, + [[ + null, + 413725046, + null, + [ + null, + 1 + ] + ]] + ] + ], + null, + 40 + ], + [ + 10, + [ + [31064020], + [ + 31064021, + [ + [ + null, + 385440135, + null, + [] + ], + [ + 378290973, + null, + null, + [1] + ] + ] + ], + [ + 31064022, + [ + [ + null, + 385440135, + null, + [ + null, + 1000 + ] + ], + [ + 378290973, + null, + null, + [1] + ] + ] + ], + [ + 31064023, + [ + [ + null, + 385440135, + null, + [ + null, + 1 + ] + ], + [ + 378290973, + null, + null, + [1] + ] + ] + ] + ] + ], + [ + 10, + [ + [44755845], + [ + 44755846, + [[ + null, + 387165532, + null, + [ + null, + 0.05 + ] + ]] + ] + ], + [ + 2, + [ + [ + 1, + [[ + 4, + null, + 63 + ]] + ], + [ + 4, + null, + 59, + null, + null, + null, + null, + [ + '3372044115', + '2902623493', + '1900948638', + '3922065694', + '1163038905', + '2299118599', + '528876146', + '1417165976' + ] + ] + ] + ] + ] + ] + ], + [ + 5, + [ + [ + 50, + [ + [ + 21062785, + null, + [ + 4, + null, + 8, + null, + null, + null, + null, + ['_gmptnl'] + ] + ], + [ + 21062786, + [[ + 23, + null, + null, + [1] + ]], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['_gmptnl'] + ] + ] + ], + [ + 12, + null, + null, + null, + 2, + null, + 'today\\.line\\.me/.+/(main|article)' + ], + 43 + ], + [ + 900, + [[ + 21062812, + [[ + 23, + null, + null, + [1] + ]], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['_gmptnl'] + ] + ]], + [ + 12, + null, + null, + null, + 2, + null, + 'today\\.line\\.me/.+/(main|article)' + ], + 43 + ], + [ + 50, + [ + [ + 21063916, + null, + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers._gmptnl'] + ] + ], + [ + 21063917, + [[ + 23, + null, + null, + [1] + ]], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers._gmptnl'] + ] + ] + ], + [ + 12, + null, + null, + null, + 2, + null, + 'today\\.line\\.me/.+/(main|article)' + ], + 44 + ], + [ + 900, + [[ + 21064113, + [[ + 23, + null, + null, + [1] + ]], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers._gmptnl'] + ] + ]], + [ + 12, + null, + null, + null, + 2, + null, + 'today\\.line\\.me/.+/(main|article)' + ], + 44 + ], + [ + 10, + [ + [31060437], + [ + 31060438, + [[ + 200, + null, + null, + [1] + ]] + ], + [ + 31060439, + [[ + 220, + null, + null, + [1] + ]] + ] + ], + null, + 24 + ], + [ + 10, + [ + [31060837], + [ + 31060838, + [ + [ + 368279556, + null, + null, + [1] + ], + [ + 366809413, + null, + null, + [1] + ] + ] + ] + ] + ], + [ + 150, + [ + [31061482], + [ + 31061483, + [ + [ + 360245597, + null, + null, + [1] + ], + [ + 45360254, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ], + [ + 31063012, + [ + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ], + [ + 31064123, + [ + [ + null, + null, + null, + [ + null, + null, + null, + ['scar'] + ], + null, + 489 + ], + [ + null, + 405881106, + null, + [ + null, + 1 + ] + ], + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ], + [ + 44753752, + [ + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ] + ], + [ + 3, + [ + [ + 4, + null, + 8, + null, + null, + null, + null, + ['gmaSdk.getQueryInfo'] + ], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers.getGmaQueryInfo.postMessage'] + ], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers.getGmaSig.postMessage'] + ] + ] + ], + 15 + ], + [ + 100, + [ + [31061814], + [ + 31061815, + [ + [ + 384734642, + null, + null, + [1] + ], + [ + null, + 529, + null, + [ + null, + 20 + ] + ] + ] + ] + ] + ], + [ + 50, + [ + [ + 31063011, + [ + [ + null, + null, + null, + [ + null, + null, + null, + ['scar'] + ], + null, + 489 + ], + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ], + [ + 31063841, + [ + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ], + [44753813] + ], + [ + 3, + [ + [ + 4, + null, + 8, + null, + null, + null, + null, + ['gmaSdk.getQueryInfo'] + ], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers.getGmaQueryInfo.postMessage'] + ], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers.getGmaSig.postMessage'] + ] + ] + ], + 15 + ], + [ + 50, + [ + [31063377], + [ + 31063378, + [[ + 1958, + null, + null, + [1] + ]] + ] + ] + ], + [ + 50, + [ + [31063820], + [ + 31063821, + [[ + 410573952, + null, + null, + [1] + ]] + ] + ] + ], + [ + 50, + [ + [31063822], + [ + 31063823, + [ + [ + 402847016, + null, + null, + [1] + ], + [ + 1959, + null, + null, + [1] + ] + ] + ] + ] + ], + [ + 10, + [ + [31063870], + [ + 31063871, + [[ + 384700361, + null, + null, + [1] + ]] + ] + ] + ], + [ + 100, + [ + [31064026], + [ + 31064027, + [[ + 413925305, + null, + null, + [1] + ]] + ] + ] + ], + [ + 1000, + [ + [ + 31064136, + [ + [ + null, + 24, + null, + [ + null, + 31064136 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064136 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 2 + ] + ], + [ + 31064137, + [ + [ + null, + 24, + null, + [ + null, + 31064137 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064137 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 3 + ] + ], + [ + 31064138, + [ + [ + null, + 24, + null, + [ + null, + 31064138 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064138 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 4 + ] + ], + [ + 31064139, + [ + [ + null, + 24, + null, + [ + null, + 31064139 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064139 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 5 + ] + ], + [ + 31064140, + [ + [ + null, + 24, + null, + [ + null, + 31064140 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064140 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 6 + ] + ], + [ + 31064141, + [ + [ + null, + 24, + null, + [ + null, + 31064141 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064141 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 7 + ] + ] + ], + [ + 4, + null, + 3 + ], + 1 + ], + [ + 50, + [ + [44752540], + [ + 44752541, + [[ + 399544548, + null, + null, + [1] + ]] + ] + ] + ], + [ + 50, + [ + [44757100], + [ + 44757101, + [[ + 398776878, + null, + null, + [] + ]] + ] + ], + null, + 40 + ], + [ + 1000, + [ + [ + 31063223, + null, + [ + 3, + [ + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + -1 + ], + [ + 7, + null, + null, + 1, + null, + 3 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 29 + ], + [ + 7, + null, + null, + 1, + null, + 33 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 39 + ], + [ + 7, + null, + null, + 1, + null, + 43 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ] + ] + ], + [ + 31063224, + [[ + 1954, + null, + null, + [1] + ]], + [ + 3, + [ + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 2 + ], + [ + 7, + null, + null, + 1, + null, + 6 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 32 + ], + [ + 7, + null, + null, + 1, + null, + 36 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 42 + ], + [ + 7, + null, + null, + 1, + null, + 46 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ] + ] + ] + ] + ] + ] + ], + [ + 2, + [ + [ + 10, + [[31060888]] + ], + [ + 10, + [ + [31060889], + [31060890] + ], + null, + null, + null, + null, + null, + null, + null, + 104 + ], + [ + 10, + [ + [31061165], + [ + 31061166, + [[ + null, + 363650251, + null, + [ + null, + 2 + ] + ]] + ], + [ + 31061167, + [[ + null, + 363650251, + null, + [ + null, + 1 + ] + ]] + ] + ], + null, + null, + null, + null, + null, + 1, + null, + 102 + ], + [ + 10, + [ + [44742767], + [44742768] + ] + ], + [ + 10, + [ + [44752585], + [ + 44752586, + [[ + 392065905, + null, + null, + [1] + ]] + ] + ], + null, + 41 + ], + [ + 50, + [ + [44753506], + [ + 44753507, + [[ + 392065905, + null, + null, + [] + ]] + ] + ], + [ + 3, + [ + [ + 4, + null, + 15, + null, + null, + null, + null, + ['18190176,155953048'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['49944529'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['5441'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6177'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6782'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6581'] + ] + ] + ], + 41 + ], + [ + null, + [ + [44757045], + [ + 44757046, + [[ + 398776878, + null, + null, + [] + ]] + ] + ], + [ + 3, + [ + [ + 4, + null, + 15, + null, + null, + null, + null, + ['18190176,155953048'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['49944529'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['5441'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6177'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6782'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6581'] + ] + ] + ], + 40 + ], + [ + 1, + [ + [44757300], + [ + 44757301, + [ + [ + 398776878, + null, + null, + [] + ], + [ + 391385505, + null, + null, + [1] + ] + ] + ] + ], + [ + 1, + [[ + 3, + [ + [ + 4, + null, + 15, + null, + null, + null, + null, + ['18190176,155953048'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['49944529'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['5441'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6177'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6782'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6581'] + ] + ] + ]] + ], + 40 + ] + ] + ], + [ + 12, + [ + [ + 1, + [ + [31061828], + [ + 31061829, + [ + [ + null, + 1032, + null, + [ + null, + 200 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 500 + ] + ]] + ], + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ] + ], + null, + 15 + ], + [ + 20, + [ + [21065724], + [ + 21065725, + [[ + 203, + null, + null, + [1] + ]] + ] + ], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['LayoutShift'] + ] + ], + [ + 50, + [ + [ + 31060006, + null, + [ + 2, + [ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(89|9\\d|\\d{3,})', + ['navigator.userAgent'] + ], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['window.PeriodicSyncManager'] + ] + ] + ] + ], + [ + 31060007, + [[ + 1928, + null, + null, + [1] + ]], + [ + 2, + [ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(89|9\\d|\\d{3,})', + ['navigator.userAgent'] + ], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['window.PeriodicSyncManager'] + ] + ] + ] + ] + ], + null, + 21 + ], + [ + 10, + [ + [31060032], + [ + 31060033, + [[ + 1928, + null, + null, + [1] + ]] + ] + ], + null, + 21 + ], + [ + 10, + [ + [31061690], + [ + 31061691, + [ + [ + 83, + null, + null, + [1] + ], + [ + 84, + null, + null, + [1] + ] + ] + ] + ] + ], + [ + 1, + [ + [31063244], + [ + 31063245, + [[ + 392736476, + null, + null, + [1] + ]] + ] + ], + null, + 45 + ], + [ + 50, + [ + [31063246], + [ + 31063247, + [ + [ + 392736476, + null, + null, + [1] + ], + [ + null, + 406149835, + null, + [ + null, + 0.01 + ] + ] + ] + ] + ], + [ + 2, + [ + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(9[3456789]|\\d{3,})', + ['navigator.userAgent'] + ], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['window.PeriodicSyncManager'] + ] + ] + ], + 45 + ], + [ + 10, + [ + [31063910], + [ + 31063911, + [[ + 1948, + null, + null, + [] + ]] + ] + ] + ] + ] + ], + [ + 9, + [[ + 1000, + [[31063049]], + [ + 4, + null, + 13, + null, + null, + null, + null, + ['cxbbhbxm'] + ] + ]] + ], + [ + 6, + [[ + 1000, + [ + [ + 31063877, + null, + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + -1 + ], + [ + 7, + null, + null, + 1, + null, + 10 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ], + [ + 31063878, + [[ + 501, + null, + null, + [1] + ]], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 29 + ], + [ + 7, + null, + null, + 1, + null, + 40 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ] + ], + [ + 2, + [ + [ + 4, + null, + 53 + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(9[23456789]|\\d{3,})', + ['navigator.userAgent'] + ], + [ + 1, + [[ + 4, + null, + 8, + null, + null, + null, + null, + ['navigator.serviceWorker.controller'] + ]] + ], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['document.head.appendChild'] + ] + ] + ] + ]] + ] + ], + null, + null, + [ + 0.001, + 1000, + 1, + 1000 + ] + ])); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-20d16a205863d5a0eb56d0490a10be62d27324b9 b/resources/sugarcoat-20d16a205863d5a0eb56d0490a10be62d27324b9 new file mode 100644 index 00000000..dc7ce85a --- /dev/null +++ b/resources/sugarcoat-20d16a205863d5a0eb56d0490a10be62d27324b9 @@ -0,0 +1,8191 @@ +{ + const $___mock_b46b3bb46442fc90 = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_b46b3bb46442fc90); + const $___mock_1cf1e90738546d40 = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_1cf1e90738546d40); + (function () { + !function (e) { + var t = {}; + function n(r) { + if (t[r]) + return t[r].exports; + var o = t[r] = { + i: r, + l: !1, + exports: {} + }; + return e[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports; + } + n.m = e, n.c = t, n.d = function (e, t, r) { + n.o(e, t) || Object.defineProperty(e, t, { + enumerable: !0, + get: r + }); + }, n.r = function (e) { + 'undefined' !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }), Object.defineProperty(e, '__esModule', { value: !0 }); + }, n.t = function (e, t) { + if (1 & t && (e = n(e)), 8 & t) + return e; + if (4 & t && 'object' === typeof e && e && e.__esModule) + return e; + var r = Object.create(null); + if (n.r(r), Object.defineProperty(r, 'default', { + enumerable: !0, + value: e + }), 2 & t && 'string' != typeof e) + for (var o in e) + n.d(r, o, function (t) { + return e[t]; + }.bind(null, o)); + return r; + }, n.n = function (e) { + var t = e && e.__esModule ? function () { + return e.default; + } : function () { + return e; + }; + return n.d(t, 'a', t), t; + }, n.o = function (e, t) { + return Object.prototype.hasOwnProperty.call(e, t); + }, n.p = '/', n(n.s = 196); + }([ + function (e, t, n) { + e.exports = n(99); + }, + , + , + , + , + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(111)), r(n(112)), r(n(113)), r(n(114)); + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(54)), r(n(115)), r(n(55)), r(n(56)), r(n(116)), r(n(117)), r(n(38)), r(n(57)), r(n(118)), r(n(119)); + }, + function (e, t, n) { + 'use strict'; + var r = n(71), o = Object.prototype.toString; + function i(e) { + return '[object Array]' === o.call(e); + } + function s(e) { + return 'undefined' === typeof e; + } + function a(e) { + return null !== e && 'object' === typeof e; + } + function c(e) { + return '[object Function]' === o.call(e); + } + function u(e, t) { + if (null !== e && 'undefined' !== typeof e) + if ('object' !== typeof e && (e = [e]), i(e)) + for (var n = 0, r = e.length; n < r; n++) + t.call(null, e[n], n, e); + else + for (var o in e) + Object.prototype.hasOwnProperty.call(e, o) && t.call(null, e[o], o, e); + } + e.exports = { + isArray: i, + isArrayBuffer: function (e) { + return '[object ArrayBuffer]' === o.call(e); + }, + isBuffer: function (e) { + return null !== e && !s(e) && null !== e.constructor && !s(e.constructor) && 'function' === typeof e.constructor.isBuffer && e.constructor.isBuffer(e); + }, + isFormData: function (e) { + return 'undefined' !== typeof FormData && e instanceof FormData; + }, + isArrayBufferView: function (e) { + return 'undefined' !== typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && e.buffer instanceof ArrayBuffer; + }, + isString: function (e) { + return 'string' === typeof e; + }, + isNumber: function (e) { + return 'number' === typeof e; + }, + isObject: a, + isUndefined: s, + isDate: function (e) { + return '[object Date]' === o.call(e); + }, + isFile: function (e) { + return '[object File]' === o.call(e); + }, + isBlob: function (e) { + return '[object Blob]' === o.call(e); + }, + isFunction: c, + isStream: function (e) { + return a(e) && c(e.pipe); + }, + isURLSearchParams: function (e) { + return 'undefined' !== typeof URLSearchParams && e instanceof URLSearchParams; + }, + isStandardBrowserEnv: function () { + return ('undefined' === typeof navigator || 'ReactNative' !== navigator.product && 'NativeScript' !== navigator.product && 'NS' !== navigator.product) && ('undefined' !== typeof window && 'undefined' !== typeof document); + }, + forEach: u, + merge: function e() { + var t = {}; + function n(n, r) { + 'object' === typeof t[r] && 'object' === typeof n ? t[r] = e(t[r], n) : t[r] = n; + } + for (var r = 0, o = arguments.length; r < o; r++) + u(arguments[r], n); + return t; + }, + deepMerge: function e() { + var t = {}; + function n(n, r) { + 'object' === typeof t[r] && 'object' === typeof n ? t[r] = e(t[r], n) : t[r] = 'object' === typeof n ? e({}, n) : n; + } + for (var r = 0, o = arguments.length; r < o; r++) + u(arguments[r], n); + return t; + }, + extend: function (e, t, n) { + return u(t, function (t, o) { + e[o] = n && 'function' === typeof t ? r(t, n) : t; + }), e; + }, + trim: function (e) { + return e.replace(/^\s*/, '').replace(/\s*$/, ''); + } + }; + }, + , + , + , + , + , + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(29), o = n(103), i = function () { + function e() { + } + return e.reset = function () { + delete this.cmpId, delete this.cmpVersion, delete this.eventStatus, delete this.gdprApplies, delete this.tcModel, delete this.tcString, delete this.tcfPolicyVersion, this.cmpStatus = r.CmpStatus.LOADING, this.disabled = !1, this.displayStatus = r.DisplayStatus.HIDDEN, this.eventQueue.clear(); + }, e.apiVersion = '2', e.eventQueue = new o.EventListenerQueue(), e.cmpStatus = r.CmpStatus.LOADING, e.disabled = !1, e.displayStatus = r.DisplayStatus.HIDDEN, e; + }(); + t.CmpApiModel = i; + }, + , + function (e, t, n) { + 'use strict'; + var r = this && this.__values || function (e) { + var t = 'function' == typeof Symbol && Symbol.iterator, n = t && e[t], r = 0; + if (n) + return n.call(e); + if (e && 'number' == typeof e.length) + return { + next: function () { + return e && r >= e.length && (e = void 0), { + value: e && e[r++], + done: !e + }; + } + }; + throw new TypeError(t ? 'Object is not iterable.' : 'Symbol.iterator is not defined.'); + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function () { + function e() { + } + return e.prototype.clone = function () { + var e = this, t = new this.constructor(); + return Object.keys(this).forEach(function (n) { + var r = e.deepClone(e[n]); + void 0 !== r && (t[n] = r); + }), t; + }, e.prototype.deepClone = function (e) { + var t, n, o = typeof e; + if ('number' === o || 'string' === o || 'boolean' === o) + return e; + if (null !== e && 'object' === o) { + if ('function' == typeof e.clone) + return e.clone(); + if (e instanceof Date) + return new Date(e.getTime()); + if (void 0 !== e[Symbol.iterator]) { + var i = []; + try { + for (var s = r(e), a = s.next(); !a.done; a = s.next()) { + var c = a.value; + i.push(this.deepClone(c)); + } + } catch (e) { + t = { error: e }; + } finally { + try { + a && !a.done && (n = s.return) && n.call(s); + } finally { + if (t) + throw t.error; + } + } + return e instanceof Array ? i : new e.constructor(i); + } + var u = {}; + for (var p in e) + e.hasOwnProperty(p) && (u[p] = this.deepClone(e[p])); + return u; + } + }, e; + }(); + t.Cloneable = o; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(5), o = function () { + function e() { + } + return e.encode = function (e, t) { + var n; + if ('string' == typeof e && (e = parseInt(e, 10)), (n = e.toString(2)).length > t || e < 0) + throw new r.EncodingError(e + ' too large to encode into ' + t); + return n.length < t && (n = '0'.repeat(t - n.length) + n), n; + }, e.decode = function (e, t) { + if (t !== e.length) + throw new r.DecodingError('invalid bit length'); + return parseInt(e, 2); + }, e; + }(); + t.IntEncoder = o; + }, + , + , + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(), o = this && this.__awaiter || function (e, t, n, r) { + return new (n || (n = Promise))(function (o, i) { + function s(e) { + try { + c(r.next(e)); + } catch (e) { + i(e); + } + } + function a(e) { + try { + c(r.throw(e)); + } catch (e) { + i(e); + } + } + function c(e) { + var t; + e.done ? o(e.value) : (t = e.value, t instanceof n ? t : new n(function (e) { + e(t); + })).then(s, a); + } + c((r = r.apply(e, t || [])).next()); + }); + }, i = this && this.__generator || function (e, t) { + var n, r, o, i, s = { + label: 0, + sent: function () { + if (1 & o[0]) + throw o[1]; + return o[1]; + }, + trys: [], + ops: [] + }; + return i = { + next: a(0), + throw: a(1), + return: a(2) + }, 'function' == typeof Symbol && (i[Symbol.iterator] = function () { + return this; + }), i; + function a(i) { + return function (a) { + return function (i) { + if (n) + throw new TypeError('Generator is already executing.'); + for (; s;) + try { + if (n = 1, r && (o = 2 & i[0] ? r.return : i[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, i[1])).done) + return o; + switch (r = 0, o && (i = [ + 2 & i[0], + o.value + ]), i[0]) { + case 0: + case 1: + o = i; + break; + case 4: + return s.label++, { + value: i[1], + done: !1 + }; + case 5: + s.label++, r = i[1], i = [0]; + continue; + case 7: + i = s.ops.pop(), s.trys.pop(); + continue; + default: + if (!(o = (o = s.trys).length > 0 && o[o.length - 1]) && (6 === i[0] || 2 === i[0])) { + s = 0; + continue; + } + if (3 === i[0] && (!o || i[1] > o[0] && i[1] < o[3])) { + s.label = i[1]; + break; + } + if (6 === i[0] && s.label < o[1]) { + s.label = o[1], o = i; + break; + } + if (o && s.label < o[2]) { + s.label = o[2], s.ops.push(i); + break; + } + o[2] && s.ops.pop(), s.trys.pop(); + continue; + } + i = t.call(e, s); + } catch (e) { + i = [ + 6, + e + ], r = 0; + } finally { + n = o = 0; + } + if (5 & i[0]) + throw i[1]; + return { + value: i[0] ? i[1] : void 0, + done: !0 + }; + }([ + i, + a + ]); + }; + } + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var s = n(15), a = n(5), c = n(65), u = n(6), p = function (e) { + function t(n) { + var r = e.call(this) || this; + r.isReady_ = !1, r.isLatest = !1; + var o = t.baseUrl; + if (r.lang_ = t.DEFAULT_LANGUAGE, r.isVendorList(n)) + r.populate(n), r.readyPromise = Promise.resolve(); + else { + if (!o) + throw new a.GVLError('must specify GVL.baseUrl before loading GVL json'); + if (n > 0) { + var i = n; + t.CACHE.has(i) ? (r.populate(t.CACHE.get(i)), r.readyPromise = Promise.resolve()) : (o += t.versionedFilename.replace('[VERSION]', i + ''), r.readyPromise = r.fetchJson(o)); + } else + t.CACHE.has(t.LATEST_CACHE_KEY) ? (r.populate(t.CACHE.get(t.LATEST_CACHE_KEY)), r.readyPromise = Promise.resolve()) : (r.isLatest = !0, r.readyPromise = r.fetchJson(o + t.latestFilename)); + } + return r; + } + return r(t, e), Object.defineProperty(t, 'baseUrl', { + get: function () { + return this.baseUrl_; + }, + set: function (e) { + if (/^https?:\/\/vendorlist\.consensu\.org\//.test(e)) + throw new a.GVLError('Invalid baseUrl! You may not pull directly from vendorlist.consensu.org and must provide your own cache'); + e.length > 0 && '/' !== e[e.length - 1] && (e += '/'), this.baseUrl_ = e; + }, + enumerable: !0, + configurable: !0 + }), t.emptyLanguageCache = function (e) { + var n = !1; + return void 0 === e && t.LANGUAGE_CACHE.size > 0 ? (t.LANGUAGE_CACHE = new Map(), n = !0) : 'string' == typeof e && this.consentLanguages.has(e.toUpperCase()) && (t.LANGUAGE_CACHE.delete(e.toUpperCase()), n = !0), n; + }, t.emptyCache = function (e) { + var n = !1; + return Number.isInteger(e) && e >= 0 ? (t.CACHE.delete(e), n = !0) : void 0 === e && (t.CACHE = new Map(), n = !0), n; + }, t.prototype.cacheLanguage = function () { + t.LANGUAGE_CACHE.has(this.lang_) || t.LANGUAGE_CACHE.set(this.lang_, { + purposes: this.purposes, + specialPurposes: this.specialPurposes, + features: this.features, + specialFeatures: this.specialFeatures, + stacks: this.stacks + }); + }, t.prototype.fetchJson = function (e) { + return o(this, void 0, void 0, function () { + var t, n; + return i(this, function (r) { + switch (r.label) { + case 0: + return r.trys.push([ + 0, + 2, + , + 3 + ]), t = this.populate, [ + 4, + c.Json.fetch(e) + ]; + case 1: + return t.apply(this, [r.sent()]), [ + 3, + 3 + ]; + case 2: + throw n = r.sent(), new a.GVLError(n.message); + case 3: + return [2]; + } + }); + }); + }, t.prototype.getJson = function () { + return JSON.parse(JSON.stringify({ + gvlSpecificationVersion: this.gvlSpecificationVersion, + vendorListVersion: this.vendorListVersion, + tcfPolicyVersion: this.tcfPolicyVersion, + lastUpdated: this.lastUpdated, + purposes: this.purposes, + specialPurposes: this.specialPurposes, + features: this.features, + specialFeatures: this.specialFeatures, + stacks: this.stacks, + vendors: this.fullVendorList + })); + }, t.prototype.changeLanguage = function (e) { + return o(this, void 0, void 0, function () { + var n, r, o, s, c; + return i(this, function (i) { + switch (i.label) { + case 0: + if (n = e.toUpperCase(), !t.consentLanguages.has(n)) + return [ + 3, + 6 + ]; + if (n === this.lang_) + return [ + 3, + 5 + ]; + if (this.lang_ = n, !t.LANGUAGE_CACHE.has(n)) + return [ + 3, + 1 + ]; + for (o in r = t.LANGUAGE_CACHE.get(n)) + r.hasOwnProperty(o) && (this[o] = r[o]); + return [ + 3, + 5 + ]; + case 1: + s = t.baseUrl + t.languageFilename.replace('[LANG]', e), i.label = 2; + case 2: + return i.trys.push([ + 2, + 4, + , + 5 + ]), [ + 4, + this.fetchJson(s) + ]; + case 3: + return i.sent(), this.cacheLanguage(), [ + 3, + 5 + ]; + case 4: + throw c = i.sent(), new a.GVLError('unable to load language: ' + c.message); + case 5: + return [ + 3, + 7 + ]; + case 6: + throw new a.GVLError('unsupported language ' + e); + case 7: + return [2]; + } + }); + }); + }, Object.defineProperty(t.prototype, 'language', { + get: function () { + return this.lang_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.isVendorList = function (e) { + return void 0 !== e && void 0 !== e.vendors; + }, t.prototype.populate = function (e) { + this.purposes = e.purposes, this.specialPurposes = e.specialPurposes, this.features = e.features, this.specialFeatures = e.specialFeatures, this.stacks = e.stacks, this.isVendorList(e) && (this.gvlSpecificationVersion = e.gvlSpecificationVersion, this.tcfPolicyVersion = e.tcfPolicyVersion, this.vendorListVersion = e.vendorListVersion, this.lastUpdated = e.lastUpdated, 'string' == typeof this.lastUpdated && (this.lastUpdated = new Date(this.lastUpdated)), this.vendors_ = e.vendors, this.fullVendorList = e.vendors, this.mapVendors(), this.isReady_ = !0, this.isLatest && t.CACHE.set(t.LATEST_CACHE_KEY, this.getJson()), t.CACHE.has(this.vendorListVersion) || t.CACHE.set(this.vendorListVersion, this.getJson())), this.cacheLanguage(); + }, t.prototype.mapVendors = function (e) { + var t = this; + this.byPurposeVendorMap = {}, this.bySpecialPurposeVendorMap = {}, this.byFeatureVendorMap = {}, this.bySpecialFeatureVendorMap = {}, Object.keys(this.purposes).forEach(function (e) { + t.byPurposeVendorMap[e] = { + legInt: new Set(), + consent: new Set(), + flexible: new Set() + }; + }), Object.keys(this.specialPurposes).forEach(function (e) { + t.bySpecialPurposeVendorMap[e] = new Set(); + }), Object.keys(this.features).forEach(function (e) { + t.byFeatureVendorMap[e] = new Set(); + }), Object.keys(this.specialFeatures).forEach(function (e) { + t.bySpecialFeatureVendorMap[e] = new Set(); + }), Array.isArray(e) || (e = Object.keys(this.fullVendorList).map(function (e) { + return +e; + })), this.vendorIds = new Set(e), this.vendors_ = e.reduce(function (e, n) { + var r = t.vendors_['' + n]; + return r && void 0 === r.deletedDate && (r.purposes.forEach(function (e) { + t.byPurposeVendorMap[e + ''].consent.add(n); + }), r.specialPurposes.forEach(function (e) { + t.bySpecialPurposeVendorMap[e + ''].add(n); + }), r.legIntPurposes.forEach(function (e) { + t.byPurposeVendorMap[e + ''].legInt.add(n); + }), r.flexiblePurposes && r.flexiblePurposes.forEach(function (e) { + t.byPurposeVendorMap[e + ''].flexible.add(n); + }), r.features.forEach(function (e) { + t.byFeatureVendorMap[e + ''].add(n); + }), r.specialFeatures.forEach(function (e) { + t.bySpecialFeatureVendorMap[e + ''].add(n); + }), e[n] = r), e; + }, {}); + }, t.prototype.getFilteredVendors = function (e, t, n, r) { + var o = this, i = e.charAt(0).toUpperCase() + e.slice(1), s = {}; + return ('purpose' === e && n ? this['by' + i + 'VendorMap'][t + ''][n] : this['by' + (r ? 'Special' : '') + i + 'VendorMap'][t + '']).forEach(function (e) { + s[e + ''] = o.vendors[e + '']; + }), s; + }, t.prototype.getVendorsWithConsentPurpose = function (e) { + return this.getFilteredVendors('purpose', e, 'consent'); + }, t.prototype.getVendorsWithLegIntPurpose = function (e) { + return this.getFilteredVendors('purpose', e, 'legInt'); + }, t.prototype.getVendorsWithFlexiblePurpose = function (e) { + return this.getFilteredVendors('purpose', e, 'flexible'); + }, t.prototype.getVendorsWithSpecialPurpose = function (e) { + return this.getFilteredVendors('purpose', e, void 0, !0); + }, t.prototype.getVendorsWithFeature = function (e) { + return this.getFilteredVendors('feature', e); + }, t.prototype.getVendorsWithSpecialFeature = function (e) { + return this.getFilteredVendors('feature', e, void 0, !0); + }, Object.defineProperty(t.prototype, 'vendors', { + get: function () { + return this.vendors_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.narrowVendorsTo = function (e) { + this.mapVendors(e); + }, Object.defineProperty(t.prototype, 'isReady', { + get: function () { + return this.isReady_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.clone = function () { + var e = new t(this.getJson()); + return this.lang_ !== t.DEFAULT_LANGUAGE && e.changeLanguage(this.lang_), e; + }, t.isInstanceOf = function (e) { + return 'object' == typeof e && 'function' == typeof e.narrowVendorsTo; + }, t.LANGUAGE_CACHE = new Map(), t.CACHE = new Map(), t.LATEST_CACHE_KEY = 0, t.DEFAULT_LANGUAGE = 'EN', t.consentLanguages = new u.ConsentLanguages(), t.latestFilename = 'vendor-list.json', t.versionedFilename = 'archives/vendor-list-v[VERSION].json', t.languageFilename = 'purposes-[LANG].json', t; + }(s.Cloneable); + t.GVL = p; + }, + , + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(36), o = n(6), i = n(16), s = n(33), a = function () { + function e() { + } + return e.encode = function (e, t) { + var n, o, i = ''; + return e = r.SemanticPreEncoder.process(e, t), (o = Array.isArray(null === (n = t) || void 0 === n ? void 0 : n.segments) ? t.segments : new r.SegmentSequence(e, t)['' + e.version]).forEach(function (t, n) { + var s = ''; + n < o.length - 1 && (s = '.'), i += r.SegmentEncoder.encode(e, t) + s; + }), i; + }, e.decode = function (e, t) { + var n = e.split('.'), a = n.length; + t || (t = new s.TCModel()); + for (var c = 0; c < a; c++) { + var u = n[c], p = r.Base64Url.decode(u.charAt(0)).substr(0, r.BitLength.segmentType), l = o.SegmentIDs.ID_TO_KEY[i.IntEncoder.decode(p, r.BitLength.segmentType).toString()]; + r.SegmentEncoder.decode(u, t, l); + } + return t; + }, e; + }(); + t.TCString = a; + }, + , + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.encode = function (e) { + return +e + ''; + }, e.decode = function (e) { + return '1' === e; + }, e; + }(); + t.BooleanEncoder = r; + }, + , + , + , + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(49)), r(n(104)), r(n(105)), r(n(28)), r(n(50)); + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(13); + t.Response = function () { + this.cmpId = r.CmpApiModel.cmpId, this.cmpVersion = r.CmpApiModel.cmpVersion, this.gdprApplies = r.CmpApiModel.gdprApplies, this.tcfPolicyVersion = r.CmpApiModel.tcfPolicyVersion; + }; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(100)), r(n(101)), r(n(102)); + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(31), i = n(27), s = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + this.throwIfParamInvalid(), this.invokeCallback(new i.TCData(this.param, this.listenerId)); + }, t.prototype.throwIfParamInvalid = function () { + if (!(void 0 === this.param || Array.isArray(this.param) && this.param.every(Number.isInteger))) + throw new Error('Invalid Parameter'); + }, t; + }(o.Command); + t.GetTCDataCommand = s; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e(e, t, n, r) { + this.success = !0, Object.assign(this, { + callback: e, + listenerId: n, + param: t, + next: r + }); + try { + this.respond(); + } catch (e) { + this.invokeCallback(null); + } + } + return e.prototype.invokeCallback = function (e) { + var t = null !== e; + 'function' == typeof this.next ? this.callback(this.next, e, t) : this.callback(e, t); + }, e; + }(); + t.Command = r; + }, + , + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(15), i = n(5), s = n(19), a = n(6), c = function (e) { + function t(t) { + var n = e.call(this) || this; + return n.isServiceSpecific_ = !1, n.supportOOB_ = !0, n.useNonStandardStacks_ = !1, n.purposeOneTreatment_ = !1, n.publisherCountryCode_ = 'AA', n.version_ = 2, n.consentScreen_ = 0, n.policyVersion_ = 2, n.consentLanguage_ = 'EN', n.cmpId_ = 0, n.cmpVersion_ = 0, n.vendorListVersion_ = 0, n.numCustomPurposes_ = 0, n.specialFeatureOptins = new a.Vector(), n.purposeConsents = new a.Vector(), n.purposeLegitimateInterests = new a.Vector(), n.publisherConsents = new a.Vector(), n.publisherLegitimateInterests = new a.Vector(), n.publisherCustomConsents = new a.Vector(), n.publisherCustomLegitimateInterests = new a.Vector(), n.vendorConsents = new a.Vector(), n.vendorLegitimateInterests = new a.Vector(), n.vendorsDisclosed = new a.Vector(), n.vendorsAllowed = new a.Vector(), n.publisherRestrictions = new a.PurposeRestrictionVector(), t && (n.gvl = t), n.created = new Date(), n.updated(), n; + } + return r(t, e), Object.defineProperty(t.prototype, 'gvl', { + get: function () { + return this.gvl_; + }, + set: function (e) { + s.GVL.isInstanceOf(e) || (e = new s.GVL(e)), this.gvl_ = e, this.publisherRestrictions.gvl = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'cmpId', { + get: function () { + return this.cmpId_; + }, + set: function (e) { + if (!(Number.isInteger(+e) && e > 1)) + throw new i.TCModelError('cmpId', e); + this.cmpId_ = +e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'cmpVersion', { + get: function () { + return this.cmpVersion_; + }, + set: function (e) { + if (!(Number.isInteger(+e) && e > -1)) + throw new i.TCModelError('cmpVersion', e); + this.cmpVersion_ = +e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'consentScreen', { + get: function () { + return this.consentScreen_; + }, + set: function (e) { + if (!(Number.isInteger(+e) && e > -1)) + throw new i.TCModelError('consentScreen', e); + this.consentScreen_ = +e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'consentLanguage', { + get: function () { + return this.consentLanguage_; + }, + set: function (e) { + this.consentLanguage_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'publisherCountryCode', { + get: function () { + return this.publisherCountryCode_; + }, + set: function (e) { + if (!/^([A-z]){2}$/.test(e)) + throw new i.TCModelError('publisherCountryCode', e); + this.publisherCountryCode_ = e.toUpperCase(); + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'vendorListVersion', { + get: function () { + return this.gvl ? this.gvl.vendorListVersion : this.vendorListVersion_; + }, + set: function (e) { + if ((e = +e >> 0) < 0) + throw new i.TCModelError('vendorListVersion', e); + this.vendorListVersion_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'policyVersion', { + get: function () { + return this.gvl ? this.gvl.tcfPolicyVersion : this.policyVersion_; + }, + set: function (e) { + if (this.policyVersion_ = parseInt(e, 10), this.policyVersion_ < 0) + throw new i.TCModelError('policyVersion', e); + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'version', { + get: function () { + return this.version_; + }, + set: function (e) { + this.version_ = parseInt(e, 10); + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'isServiceSpecific', { + get: function () { + return this.isServiceSpecific_; + }, + set: function (e) { + this.isServiceSpecific_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'useNonStandardStacks', { + get: function () { + return this.useNonStandardStacks_; + }, + set: function (e) { + this.useNonStandardStacks_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'supportOOB', { + get: function () { + return this.supportOOB_; + }, + set: function (e) { + this.supportOOB_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'purposeOneTreatment', { + get: function () { + return this.purposeOneTreatment_; + }, + set: function (e) { + this.purposeOneTreatment_ = e; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.setAllVendorConsents = function () { + this.vendorConsents.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorConsents = function () { + this.vendorConsents.empty(); + }, t.prototype.setAllVendorsDisclosed = function () { + this.vendorsDisclosed.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorsDisclosed = function () { + this.vendorsDisclosed.empty(); + }, t.prototype.setAllVendorsAllowed = function () { + this.vendorsAllowed.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorsAllowed = function () { + this.vendorsAllowed.empty(); + }, t.prototype.setAllVendorLegitimateInterests = function () { + this.vendorLegitimateInterests.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorLegitimateInterests = function () { + this.vendorLegitimateInterests.empty(); + }, t.prototype.setAllPurposeConsents = function () { + this.purposeConsents.set(this.gvl.purposes); + }, t.prototype.unsetAllPurposeConsents = function () { + this.purposeConsents.empty(); + }, t.prototype.setAllPurposeLegitimateInterests = function () { + this.purposeLegitimateInterests.set(this.gvl.purposes); + }, t.prototype.unsetAllPurposeLegitimateInterests = function () { + this.purposeLegitimateInterests.empty(); + }, t.prototype.setAllSpecialFeatureOptins = function () { + this.specialFeatureOptins.set(this.gvl.specialFeatures); + }, t.prototype.unsetAllSpecialFeatureOptins = function () { + this.specialFeatureOptins.empty(); + }, t.prototype.setAll = function () { + this.setAllVendorConsents(), this.setAllPurposeLegitimateInterests(), this.setAllSpecialFeatureOptins(), this.setAllPurposeConsents(), this.setAllVendorLegitimateInterests(); + }, t.prototype.unsetAll = function () { + this.unsetAllVendorConsents(), this.unsetAllPurposeLegitimateInterests(), this.unsetAllSpecialFeatureOptins(), this.unsetAllPurposeConsents(), this.unsetAllVendorLegitimateInterests(); + }, Object.defineProperty(t.prototype, 'numCustomPurposes', { + get: function () { + var e = this.numCustomPurposes_; + if ('object' == typeof this.customPurposes) { + var t = Object.keys(this.customPurposes).sort(function (e, t) { + return +e - +t; + }); + e = parseInt(t.pop(), 10); + } + return e; + }, + set: function (e) { + if (this.numCustomPurposes_ = parseInt(e, 10), this.numCustomPurposes_ < 0) + throw new i.TCModelError('numCustomPurposes', e); + }, + enumerable: !0, + configurable: !0 + }), t.prototype.updated = function () { + this.lastUpdated = new Date(); + }, t.consentLanguages = s.GVL.consentLanguages, t; + }(o.Cloneable); + t.TCModel = c; + }, + , + , + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(53)), r(n(37)), r(n(120)), r(n(124)), r(n(58)), r(n(64)); + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(6), o = function () { + function e() { + } + var t, n, o, i, s, a, c, u, p, l, d, f, h, v, y, g, m, b; + return t = r.Fields.cmpId, n = r.Fields.cmpVersion, o = r.Fields.consentLanguage, i = r.Fields.consentScreen, s = r.Fields.created, a = r.Fields.isServiceSpecific, c = r.Fields.lastUpdated, u = r.Fields.policyVersion, p = r.Fields.publisherCountryCode, l = r.Fields.publisherLegitimateInterests, d = r.Fields.publisherConsents, f = r.Fields.purposeConsents, h = r.Fields.purposeLegitimateInterests, v = r.Fields.purposeOneTreatment, y = r.Fields.specialFeatureOptins, g = r.Fields.useNonStandardStacks, m = r.Fields.vendorListVersion, b = r.Fields.version, e[t] = 12, e[n] = 12, e[o] = 12, e[i] = 6, e[s] = 36, e[a] = 1, e[c] = 36, e[u] = 6, e[p] = 12, e[l] = 24, e[d] = 24, e[f] = 24, e[h] = 24, e[v] = 1, e[y] = 12, e[g] = 1, e[m] = 12, e[b] = 6, e.anyBoolean = 1, e.encodingType = 1, e.maxId = 16, e.numCustomPurposes = 6, e.numEntries = 12, e.numRestrictions = 12, e.purposeId = 6, e.restrictionType = 2, e.segmentType = 3, e.singleOrRange = 1, e.vendorId = 16, e; + }(); + t.BitLength = o; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.RestrictionType || (t.RestrictionType = {}))[r.NOT_ALLOWED = 0] = 'NOT_ALLOWED', r[r.REQUIRE_CONSENT = 1] = 'REQUIRE_CONSENT', r[r.REQUIRE_LI = 2] = 'REQUIRE_LI'; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(23), o = n(5), i = n(6), s = function () { + function e() { + } + return e.encode = function (e, t) { + for (var n = '', o = 1; o <= t; o++) + n += r.BooleanEncoder.encode(e.has(o)); + return n; + }, e.decode = function (e, t) { + if (e.length !== t) + throw new o.DecodingError('bitfield encoding length mismatch'); + for (var n = new i.Vector(), s = 1; s <= t; s++) + r.BooleanEncoder.decode(e[s - 1]) && n.set(s); + return n.bitLength = e.length, n; + }, e; + }(); + t.FixedVectorEncoder = s; + }, + , + , + , + , + , + , + , + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }), function (e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + }(n(48)); + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.TCFCommand || (t.TCFCommand = {})).PING = 'ping', r.GET_TC_DATA = 'getTCData', r.GET_IN_APP_TC_DATA = 'getInAppTCData', r.GET_VENDOR_LIST = 'getVendorList', r.ADD_EVENT_LISTENER = 'addEventListener', r.REMOVE_EVENT_LISTENER = 'removeEventListener'; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(28), i = n(29), s = function (e) { + function t() { + var t = null !== e && e.apply(this, arguments) || this; + return t.cmpStatus = i.CmpStatus.ERROR, t; + } + return r(t, e), t; + }(o.Response); + t.Disabled = s; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(), o = this && this.__read || function (e, t) { + var n = 'function' == typeof Symbol && e[Symbol.iterator]; + if (!n) + return e; + var r, o, i = n.call(e), s = []; + try { + for (; (void 0 === t || t-- > 0) && !(r = i.next()).done;) + s.push(r.value); + } catch (e) { + o = { error: e }; + } finally { + try { + r && !r.done && (n = i.return) && n.call(i); + } finally { + if (o) + throw o.error; + } + } + return s; + }, i = this && this.__spread || function () { + for (var e = [], t = 0; t < arguments.length; t++) + e = e.concat(o(arguments[t])); + return e; + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var s = n(13), a = function (e) { + function t(t, n) { + var r = e.call(this) || this; + if (r.eventStatus = s.CmpApiModel.eventStatus, r.cmpStatus = s.CmpApiModel.cmpStatus, r.listenerId = n, s.CmpApiModel.gdprApplies) { + var o = s.CmpApiModel.tcModel; + r.tcString = s.CmpApiModel.tcString, r.isServiceSpecific = o.isServiceSpecific, r.useNonStandardStacks = o.useNonStandardStacks, r.purposeOneTreatment = o.purposeOneTreatment, r.publisherCC = o.publisherCountryCode, r.outOfBand = { + allowedVendors: r.createVectorField(o.vendorsAllowed, t), + disclosedVendors: r.createVectorField(o.vendorsDisclosed, t) + }, r.purpose = { + consents: r.createVectorField(o.purposeConsents), + legitimateInterests: r.createVectorField(o.purposeLegitimateInterests) + }, r.vendor = { + consents: r.createVectorField(o.vendorConsents, t), + legitimateInterests: r.createVectorField(o.vendorLegitimateInterests, t) + }, r.specialFeatureOptins = r.createVectorField(o.specialFeatureOptins), r.publisher = { + consents: r.createVectorField(o.publisherConsents), + legitimateInterests: r.createVectorField(o.publisherLegitimateInterests), + customPurpose: { + consents: r.createVectorField(o.publisherCustomConsents), + legitimateInterests: r.createVectorField(o.publisherCustomLegitimateInterests) + }, + restrictions: r.createRestrictions(o.publisherRestrictions) + }; + } + return r; + } + return r(t, e), t.prototype.createRestrictions = function (e) { + var t = {}; + if (e.numRestrictions > 0) + for (var n = e.getMaxVendorId(), r = function (n) { + var r = n.toString(); + e.getRestrictions(n).forEach(function (e) { + var n = e.purposeId.toString(); + t[n] || (t[n] = {}), t[n][r] = e.restrictionType; + }); + }, o = 1; o <= n; o++) + r(o); + return t; + }, t.prototype.createVectorField = function (e, t) { + return t ? t.reduce(function (t, n) { + return t[n + ''] = e.has(+n), t; + }, {}) : i(e).reduce(function (e, t) { + return e[t[0].toString(10)] = t[1], e; + }, {}); + }, t; + }(n(28).Response); + t.TCData = a; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__read || function (e, t) { + var n = 'function' == typeof Symbol && e[Symbol.iterator]; + if (!n) + return e; + var r, o, i = n.call(e), s = []; + try { + for (; (void 0 === t || t-- > 0) && !(r = i.next()).done;) + s.push(r.value); + } catch (e) { + o = { error: e }; + } finally { + try { + r && !r.done && (n = i.return) && n.call(i); + } finally { + if (o) + throw o.error; + } + } + return s; + }, o = this && this.__spread || function () { + for (var e = [], t = 0; t < arguments.length; t++) + e = e.concat(r(arguments[t])); + return e; + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var i = n(47), s = n(107), a = n(13), c = n(49), u = n(127); + t.API_KEY = '__tcfapi'; + var p = function () { + function e(e) { + var n, r, o; + if (e) { + var s = i.TCFCommand.ADD_EVENT_LISTENER; + if (null === (n = e) || void 0 === n ? void 0 : n[s]) + throw new Error('Built-In Custom Commmand for ' + s + ' not allowed: Use ' + i.TCFCommand.GET_TC_DATA + ' instead'); + if (s = i.TCFCommand.REMOVE_EVENT_LISTENER, null === (r = e) || void 0 === r ? void 0 : r[s]) + throw new Error('Built-In Custom Commmand for ' + s + ' not allowed'); + (null === (o = e) || void 0 === o ? void 0 : o[i.TCFCommand.GET_TC_DATA]) && (e[i.TCFCommand.ADD_EVENT_LISTENER] = e[i.TCFCommand.GET_TC_DATA], e[i.TCFCommand.REMOVE_EVENT_LISTENER] = e[i.TCFCommand.GET_TC_DATA]), this.customCommands = e; + } + try { + this.callQueue = window[t.API_KEY]() || []; + } catch (e) { + this.callQueue = []; + } finally { + window[t.API_KEY] = this.apiCall.bind(this), this.purgeQueuedCalls(); + } + } + return e.prototype.apiCall = function (e, t, n) { + for (var r, p = [], l = 3; l < arguments.length; l++) + p[l - 3] = arguments[l]; + if ('string' != typeof e) + n(null, !1); + else if (u.SupportedVersions.has(t)) { + if ('function' != typeof n) + throw new Error('invalid callback function'); + a.CmpApiModel.disabled ? n(new c.Disabled(), !1) : this.isCustomCommand(e) || this.isBuiltInCommand(e) ? this.isCustomCommand(e) && !this.isBuiltInCommand(e) ? (r = this.customCommands)[e].apply(r, o([n], p)) : e === i.TCFCommand.PING ? this.isCustomCommand(e) ? new s.CommandMap[e](this.customCommands[e], p[0], null, n) : new s.CommandMap[e](n, p[0]) : void 0 === a.CmpApiModel.tcModel ? this.callQueue.push(o([ + e, + t, + n + ], p)) : this.isCustomCommand(e) && this.isBuiltInCommand(e) ? new s.CommandMap[e](this.customCommands[e], p[0], null, n) : new s.CommandMap[e](n, p[0]) : n(null, !1); + } else + n(null, !1); + }, e.prototype.purgeQueuedCalls = function () { + var e = this.callQueue; + this.callQueue = [], e.forEach(function (e) { + window[t.API_KEY].apply(window, o(e)); + }); + }, e.prototype.isCustomCommand = function (e) { + return this.customCommands && 'function' == typeof this.customCommands[e]; + }, e.prototype.isBuiltInCommand = function (e) { + return void 0 !== s.CommandMap[e]; + }, e; + }(); + t.CallResponder = p; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(36)), r(n(5)), r(n(6)), r(n(15)), r(n(19)), r(n(65)), r(n(33)), r(n(21)); + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(5), o = function () { + function e() { + } + return e.encode = function (e) { + if (!/^[0-1]+$/.test(e)) + throw new r.EncodingError('Invalid bitField'); + var t = e.length % this.LCM; + e += t ? '0'.repeat(this.LCM - t) : ''; + for (var n = '', o = 0; o < e.length; o += this.BASIS) + n += this.DICT[parseInt(e.substr(o, this.BASIS), 2)]; + return n; + }, e.decode = function (e) { + if (!/^[A-Za-z0-9\-_]+$/.test(e)) + throw new r.DecodingError('Invalidly encoded Base64URL string'); + for (var t = '', n = 0; n < e.length; n++) { + var o = this.REVERSE_DICT.get(e[n]).toString(2); + t += '0'.repeat(this.BASIS - o.length) + o; + } + return t; + }, e.DICT = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', e.REVERSE_DICT = new Map([ + [ + 'A', + 0 + ], + [ + 'B', + 1 + ], + [ + 'C', + 2 + ], + [ + 'D', + 3 + ], + [ + 'E', + 4 + ], + [ + 'F', + 5 + ], + [ + 'G', + 6 + ], + [ + 'H', + 7 + ], + [ + 'I', + 8 + ], + [ + 'J', + 9 + ], + [ + 'K', + 10 + ], + [ + 'L', + 11 + ], + [ + 'M', + 12 + ], + [ + 'N', + 13 + ], + [ + 'O', + 14 + ], + [ + 'P', + 15 + ], + [ + 'Q', + 16 + ], + [ + 'R', + 17 + ], + [ + 'S', + 18 + ], + [ + 'T', + 19 + ], + [ + 'U', + 20 + ], + [ + 'V', + 21 + ], + [ + 'W', + 22 + ], + [ + 'X', + 23 + ], + [ + 'Y', + 24 + ], + [ + 'Z', + 25 + ], + [ + 'a', + 26 + ], + [ + 'b', + 27 + ], + [ + 'c', + 28 + ], + [ + 'd', + 29 + ], + [ + 'e', + 30 + ], + [ + 'f', + 31 + ], + [ + 'g', + 32 + ], + [ + 'h', + 33 + ], + [ + 'i', + 34 + ], + [ + 'j', + 35 + ], + [ + 'k', + 36 + ], + [ + 'l', + 37 + ], + [ + 'm', + 38 + ], + [ + 'n', + 39 + ], + [ + 'o', + 40 + ], + [ + 'p', + 41 + ], + [ + 'q', + 42 + ], + [ + 'r', + 43 + ], + [ + 's', + 44 + ], + [ + 't', + 45 + ], + [ + 'u', + 46 + ], + [ + 'v', + 47 + ], + [ + 'w', + 48 + ], + [ + 'x', + 49 + ], + [ + 'y', + 50 + ], + [ + 'z', + 51 + ], + [ + '0', + 52 + ], + [ + '1', + 53 + ], + [ + '2', + 54 + ], + [ + '3', + 55 + ], + [ + '4', + 56 + ], + [ + '5', + 57 + ], + [ + '6', + 58 + ], + [ + '7', + 59 + ], + [ + '8', + 60 + ], + [ + '9', + 61 + ], + [ + '-', + 62 + ], + [ + '_', + 63 + ] + ]), e.BASIS = 6, e.LCM = 24, e; + }(); + t.Base64Url = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t() { + var t = null !== e && e.apply(this, arguments) || this; + return t.root = null, t; + } + return r(t, e), t.prototype.isEmpty = function () { + return !this.root; + }, t.prototype.add = function (e) { + var t, n = { + value: e, + left: null, + right: null + }; + if (this.isEmpty()) + this.root = n; + else + for (t = this.root;;) + if (e < t.value) { + if (null === t.left) { + t.left = n; + break; + } + t = t.left; + } else { + if (!(e > t.value)) + break; + if (null === t.right) { + t.right = n; + break; + } + t = t.right; + } + }, t.prototype.get = function () { + for (var e = [], t = this.root; t;) + if (t.left) { + for (var n = t.left; n.right && n.right != t;) + n = n.right; + n.right == t ? (n.right = null, e.push(t.value), t = t.right) : (n.right = t, t = t.left); + } else + e.push(t.value), t = t.right; + return e; + }, t.prototype.contains = function (e) { + for (var t = !1, n = this.root; n;) { + if (n.value === e) { + t = !0; + break; + } + e > n.value ? n = n.right : e < n.value && (n = n.left); + } + return t; + }, t.prototype.min = function (e) { + var t; + for (void 0 === e && (e = this.root); e;) + e.left ? e = e.left : (t = e.value, e = null); + return t; + }, t.prototype.max = function (e) { + var t; + for (void 0 === e && (e = this.root); e;) + e.right ? e = e.right : (t = e.value, e = null); + return t; + }, t.prototype.remove = function (e, t) { + void 0 === t && (t = this.root); + for (var n = null, r = 'left'; t;) + if (e < t.value) + n = t, t = t.left, r = 'left'; + else if (e > t.value) + n = t, t = t.right, r = 'right'; + else { + if (t.left || t.right) + if (t.left) + if (t.right) { + var o = this.min(t.right); + this.remove(o, t.right), t.value = o; + } else + n ? n[r] = t.left : this.root = t.left; + else + n ? n[r] = t.right : this.root = t.right; + else + n ? n[r] = null : this.root = null; + t = null; + } + }, t; + }(n(15).Cloneable); + t.BinarySearchTree = o; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.cmpId = 'cmpId', e.cmpVersion = 'cmpVersion', e.consentLanguage = 'consentLanguage', e.consentScreen = 'consentScreen', e.created = 'created', e.supportOOB = 'supportOOB', e.isServiceSpecific = 'isServiceSpecific', e.lastUpdated = 'lastUpdated', e.numCustomPurposes = 'numCustomPurposes', e.policyVersion = 'policyVersion', e.publisherCountryCode = 'publisherCountryCode', e.publisherCustomConsents = 'publisherCustomConsents', e.publisherCustomLegitimateInterests = 'publisherCustomLegitimateInterests', e.publisherLegitimateInterests = 'publisherLegitimateInterests', e.publisherConsents = 'publisherConsents', e.publisherRestrictions = 'publisherRestrictions', e.purposeConsents = 'purposeConsents', e.purposeLegitimateInterests = 'purposeLegitimateInterests', e.purposeOneTreatment = 'purposeOneTreatment', e.specialFeatureOptins = 'specialFeatureOptins', e.useNonStandardStacks = 'useNonStandardStacks', e.vendorConsents = 'vendorConsents', e.vendorLegitimateInterests = 'vendorLegitimateInterests', e.vendorListVersion = 'vendorListVersion', e.vendorsAllowed = 'vendorsAllowed', e.vendorsDisclosed = 'vendorsDisclosed', e.version = 'version', e; + }(); + t.Fields = r; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(15), i = n(5), s = n(38), a = function (e) { + function t(t, n) { + var r = e.call(this) || this; + return void 0 !== t && (r.purposeId = t), void 0 !== n && (r.restrictionType = n), r; + } + return r(t, e), t.unHash = function (e) { + var n = e.split(this.hashSeparator), r = new t(); + if (2 !== n.length) + throw new i.TCModelError('hash', e); + return r.purposeId = parseInt(n[0], 10), r.restrictionType = parseInt(n[1], 10), r; + }, Object.defineProperty(t.prototype, 'hash', { + get: function () { + if (!this.isValid()) + throw new Error('cannot hash invalid PurposeRestriction'); + return '' + this.purposeId + t.hashSeparator + this.restrictionType; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'purposeId', { + get: function () { + return this.purposeId_; + }, + set: function (e) { + this.purposeId_ = e; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.isValid = function () { + return Number.isInteger(this.purposeId) && this.purposeId > 0 && (this.restrictionType === s.RestrictionType.NOT_ALLOWED || this.restrictionType === s.RestrictionType.REQUIRE_CONSENT || this.restrictionType === s.RestrictionType.REQUIRE_LI); + }, t.prototype.isSameAs = function (e) { + return this.purposeId === e.purposeId && this.restrictionType === e.restrictionType; + }, t.hashSeparator = '-', t; + }(o.Cloneable); + t.PurposeRestriction = a; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.Segment || (t.Segment = {})).CORE = 'core', r.VENDORS_DISCLOSED = 'vendorsDisclosed', r.VENDORS_ALLOWED = 'vendorsAllowed', r.PUBLISHER_TC = 'publisherTC'; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(23)), r(n(59)), r(n(121)), r(n(39)), r(n(16)), r(n(60)), r(n(61)), r(n(63)), r(n(62)); + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(16), o = n(5), i = function () { + function e() { + } + return e.encode = function (e, t) { + return r.IntEncoder.encode(Math.round(e.getTime() / 100), t); + }, e.decode = function (e, t) { + if (t !== e.length) + throw new o.DecodingError('invalid bit length'); + var n = new Date(); + return n.setTime(100 * r.IntEncoder.decode(e, t)), n; + }, e; + }(); + t.DateEncoder = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(16), o = n(5), i = function () { + function e() { + } + return e.encode = function (e, t) { + var n = (e = e.toUpperCase()).charCodeAt(0) - 65, i = e.charCodeAt(1) - 65; + if (n < 0 || n > 25 || i < 0 || i > 25) + throw new o.EncodingError('invalid language code: ' + e); + if (t % 2 == 1) + throw new o.EncodingError('numBits must be even, ' + t + ' is not valid'); + return t /= 2, r.IntEncoder.encode(n, t) + r.IntEncoder.encode(i, t); + }, e.decode = function (e, t) { + if (t !== e.length || e.length % 2) + throw new o.DecodingError('invalid bit length for language'); + var n = e.length / 2, i = r.IntEncoder.decode(e.slice(0, n), n) + 65, s = r.IntEncoder.decode(e.slice(n), n) + 65; + return String.fromCharCode(i) + String.fromCharCode(s); + }, e; + }(); + t.LangEncoder = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(37), o = n(23), i = n(5), s = n(16), a = n(6), c = function () { + function e() { + } + return e.encode = function (e) { + var t = s.IntEncoder.encode(e.numRestrictions, r.BitLength.numRestrictions); + return e.isEmpty() || e.getRestrictions().forEach(function (n) { + t += s.IntEncoder.encode(n.purposeId, r.BitLength.purposeId), t += s.IntEncoder.encode(n.restrictionType, r.BitLength.restrictionType); + for (var i = e.getVendors(n), a = i.length, c = 0, u = 0, p = '', l = function (t) { + var n = i[t]; + 0 === u && (c++, u = n); + var l = i[a - 1], d = e.gvl.vendorIds; + if (t === a - 1 || i[t + 1] > function (e) { + for (; ++e <= l && !d.has(e);); + return e; + }(n)) { + var f = !(n === u); + p += o.BooleanEncoder.encode(f), p += s.IntEncoder.encode(u, r.BitLength.vendorId), f && (p += s.IntEncoder.encode(n, r.BitLength.vendorId)), u = 0; + } + }, d = 0; d < a; d++) + l(d); + t += s.IntEncoder.encode(c, r.BitLength.numEntries), t += p; + }), t; + }, e.decode = function (e) { + var t = 0, n = new a.PurposeRestrictionVector(), c = s.IntEncoder.decode(e.substr(t, r.BitLength.numRestrictions), r.BitLength.numRestrictions); + t += r.BitLength.numRestrictions; + for (var u = 0; u < c; u++) { + var p = s.IntEncoder.decode(e.substr(t, r.BitLength.purposeId), r.BitLength.purposeId); + t += r.BitLength.purposeId; + var l = s.IntEncoder.decode(e.substr(t, r.BitLength.restrictionType), r.BitLength.restrictionType); + t += r.BitLength.restrictionType; + var d = new a.PurposeRestriction(p, l), f = s.IntEncoder.decode(e.substr(t, r.BitLength.numEntries), r.BitLength.numEntries); + t += r.BitLength.numEntries; + for (var h = 0; h < f; h++) { + var v = o.BooleanEncoder.decode(e.substr(t, r.BitLength.anyBoolean)); + t += r.BitLength.anyBoolean; + var y = s.IntEncoder.decode(e.substr(t, r.BitLength.vendorId), r.BitLength.vendorId); + if (t += r.BitLength.vendorId, v) { + var g = s.IntEncoder.decode(e.substr(t, r.BitLength.vendorId), r.BitLength.vendorId); + if (t += r.BitLength.vendorId, g < y) + throw new i.DecodingError('Invalid RangeEntry: endVendorId ' + g + ' is less than ' + y); + for (var m = y; m <= g; m++) + n.add(m, d); + } else + n.add(y, d); + } + } + return n.bitLength = t, n; + }, e; + }(); + t.PurposeRestrictionVectorEncoder = c; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(6), o = n(36), i = n(16), s = n(23), a = n(39), c = n(63), u = n(5), p = function () { + function e() { + } + return e.encode = function (e) { + var t, n = [], r = [], a = i.IntEncoder.encode(e.maxId, o.BitLength.maxId), u = '', p = o.BitLength.maxId + o.BitLength.encodingType, l = p + e.maxId, d = 2 * o.BitLength.vendorId + o.BitLength.singleOrRange + o.BitLength.numEntries, f = p + o.BitLength.numEntries; + return e.forEach(function (i, a) { + u += s.BooleanEncoder.encode(i), (t = e.maxId > d && f < l) && i && (e.has(a + 1) ? 0 === r.length && (r.push(a), f += o.BitLength.singleOrRange, f += o.BitLength.vendorId) : (r.push(a), f += o.BitLength.vendorId, n.push(r), r = [])); + }), t ? (a += c.VectorEncodingType.RANGE + '', a += this.buildRangeEncoding(n)) : (a += c.VectorEncodingType.FIELD + '', a += u), a; + }, e.decode = function (e, t) { + var n, p = 0, l = i.IntEncoder.decode(e.substr(p, o.BitLength.maxId), o.BitLength.maxId); + p += o.BitLength.maxId; + var d = i.IntEncoder.decode(e.charAt(p), o.BitLength.encodingType); + if (p += o.BitLength.encodingType, d === c.VectorEncodingType.RANGE) { + if (n = new r.Vector(), 1 === t) { + if ('1' === e.substr(p, 1)) + throw new u.DecodingError('Unable to decode default consent=1'); + p++; + } + var f = i.IntEncoder.decode(e.substr(p, o.BitLength.numEntries), o.BitLength.numEntries); + p += o.BitLength.numEntries; + for (var h = 0; h < f; h++) { + var v = s.BooleanEncoder.decode(e.charAt(p)); + p += o.BitLength.singleOrRange; + var y = i.IntEncoder.decode(e.substr(p, o.BitLength.vendorId), o.BitLength.vendorId); + if (p += o.BitLength.vendorId, v) { + var g = i.IntEncoder.decode(e.substr(p, o.BitLength.vendorId), o.BitLength.vendorId); + p += o.BitLength.vendorId; + for (var m = y; m <= g; m++) + n.set(m); + } else + n.set(y); + } + } else { + var b = e.substr(p, l); + p += l, n = a.FixedVectorEncoder.decode(b, l); + } + return n.bitLength = p, n; + }, e.buildRangeEncoding = function (e) { + var t = e.length, n = i.IntEncoder.encode(t, o.BitLength.numEntries); + return e.forEach(function (e) { + var t = 1 === e.length; + n += s.BooleanEncoder.encode(!t), n += i.IntEncoder.encode(e[0], o.BitLength.vendorId), t || (n += i.IntEncoder.encode(e[1], o.BitLength.vendorId)); + }), n; + }, e; + }(); + t.VendorVectorEncoder = p; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.VectorEncodingType || (t.VectorEncodingType = {}))[r.FIELD = 0] = 'FIELD', r[r.RANGE = 1] = 'RANGE'; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(122)), r(n(123)); + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.absCall = function (e, t, n, r) { + return new Promise(function (o, i) { + var s = new XMLHttpRequest(); + s.withCredentials = n, s.addEventListener('load', function () { + if (s.readyState == XMLHttpRequest.DONE) + if (s.status >= 200 && s.status < 300) { + var e = s.response; + if ('string' == typeof e) + try { + e = JSON.parse(e); + } catch (e) { + } + o(e); + } else + i(new Error('HTTP Status: ' + s.status + ' response type: ' + s.responseType)); + }), s.addEventListener('error', function () { + i(new Error('error')); + }), s.addEventListener('abort', function () { + i(new Error('aborted')); + }), null === t ? s.open('GET', e, !0) : s.open('POST', e, !0), s.responseType = 'json', s.timeout = r, s.ontimeout = function () { + i(new Error('Timeout ' + r + 'ms ' + e)); + }, s.send(t); + }); + }, e.post = function (e, t, n, r) { + return void 0 === n && (n = !1), void 0 === r && (r = 0), this.absCall(e, JSON.stringify(t), n, r); + }, e.fetch = function (e, t, n) { + return void 0 === t && (t = !1), void 0 === n && (n = 0), this.absCall(e, null, t, n); + }, e; + }(); + t.Json = r; + }, + function (e, t) { + }, + function (e, t) { + }, + function (e, t) { + }, + function (e, t) { + }, + function (e, t) { + e.exports = [ + 'en', + 'fr', + 'de', + 'it', + 'es', + 'da', + 'nl', + 'el', + 'hu', + 'pt', + 'ro', + 'fi', + 'pl', + 'sk', + 'sv', + 'no', + 'ru', + 'bg', + 'ca', + 'cs', + 'et', + 'hr', + 'lt', + 'lv', + 'mt', + 'sl', + 'tr', + 'zh' + ]; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e, t) { + return function () { + for (var n = new Array(arguments.length), r = 0; r < n.length; r++) + n[r] = arguments[r]; + return e.apply(t, n); + }; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(7); + function o(e) { + return encodeURIComponent(e).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']'); + } + e.exports = function (e, t, n) { + if (!t) + return e; + var i; + if (n) + i = n(t); + else if (r.isURLSearchParams(t)) + i = t.toString(); + else { + var s = []; + r.forEach(t, function (e, t) { + null !== e && 'undefined' !== typeof e && (r.isArray(e) ? t += '[]' : e = [e], r.forEach(e, function (e) { + r.isDate(e) ? e = e.toISOString() : r.isObject(e) && (e = JSON.stringify(e)), s.push(o(t) + '=' + o(e)); + })); + }), i = s.join('&'); + } + if (i) { + var a = e.indexOf('#'); + -1 !== a && (e = e.slice(0, a)), e += (-1 === e.indexOf('?') ? '?' : '&') + i; + } + return e; + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e) { + return !(!e || !e.__CANCEL__); + }; + }, + function (e, t, n) { + 'use strict'; + (function (t) { + var r = n(7), o = n(134), i = { 'Content-Type': 'application/x-www-form-urlencoded' }; + function s(e, t) { + !r.isUndefined(e) && r.isUndefined(e['Content-Type']) && (e['Content-Type'] = t); + } + var a = { + adapter: function () { + const $___old_235faf9696193180 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_235faf9696193180) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_b46b3bb46442fc90.XMLHttpRequest)); + return function () { + var e; + return ('undefined' !== typeof XMLHttpRequest || 'undefined' !== typeof t && '[object process]' === Object.prototype.toString.call(t)) && (e = n(75)), e; + }.apply(this, arguments); + } finally { + if ($___old_235faf9696193180) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_235faf9696193180)); + } + }(), + transformRequest: [function (e, t) { + return o(t, 'Accept'), o(t, 'Content-Type'), r.isFormData(e) || r.isArrayBuffer(e) || r.isBuffer(e) || r.isStream(e) || r.isFile(e) || r.isBlob(e) ? e : r.isArrayBufferView(e) ? e.buffer : r.isURLSearchParams(e) ? (s(t, 'application/x-www-form-urlencoded;charset=utf-8'), e.toString()) : r.isObject(e) ? (s(t, 'application/json;charset=utf-8'), JSON.stringify(e)) : e; + }], + transformResponse: [function (e) { + if ('string' === typeof e) + try { + e = JSON.parse(e); + } catch (t) { + } + return e; + }], + timeout: 0, + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + maxContentLength: -1, + validateStatus: function (e) { + return e >= 200 && e < 300; + }, + headers: { common: { Accept: 'application/json, text/plain, */*' } } + }; + r.forEach([ + 'delete', + 'get', + 'head' + ], function (e) { + a.headers[e] = {}; + }), r.forEach([ + 'post', + 'put', + 'patch' + ], function (e) { + a.headers[e] = r.merge(i); + }), e.exports = a; + }.call(this, n(133))); + }, + function (e, t, n) { + 'use strict'; + var r = n(7), o = n(135), i = n(72), s = n(137), a = n(140), c = n(141), u = n(76); + e.exports = function (e) { + return new Promise(function (t, p) { + var l = e.data, d = e.headers; + r.isFormData(l) && delete d['Content-Type']; + var f = new XMLHttpRequest(); + if (e.auth) { + var h = e.auth.username || '', v = e.auth.password || ''; + d.Authorization = 'Basic ' + btoa(h + ':' + v); + } + var y = s(e.baseURL, e.url); + if (f.open(e.method.toUpperCase(), i(y, e.params, e.paramsSerializer), !0), f.timeout = e.timeout, f.onreadystatechange = function () { + if (f && 4 === f.readyState && (0 !== f.status || f.responseURL && 0 === f.responseURL.indexOf('file:'))) { + var n = 'getAllResponseHeaders' in f ? a(f.getAllResponseHeaders()) : null, r = { + data: e.responseType && 'text' !== e.responseType ? f.response : f.responseText, + status: f.status, + statusText: f.statusText, + headers: n, + config: e, + request: f + }; + o(t, p, r), f = null; + } + }, f.onabort = function () { + f && (p(u('Request aborted', e, 'ECONNABORTED', f)), f = null); + }, f.onerror = function () { + p(u('Network Error', e, null, f)), f = null; + }, f.ontimeout = function () { + var t = 'timeout of ' + e.timeout + 'ms exceeded'; + e.timeoutErrorMessage && (t = e.timeoutErrorMessage), p(u(t, e, 'ECONNABORTED', f)), f = null; + }, r.isStandardBrowserEnv()) { + var g = n(142), m = (e.withCredentials || c(y)) && e.xsrfCookieName ? g.read(e.xsrfCookieName) : void 0; + m && (d[e.xsrfHeaderName] = m); + } + if ('setRequestHeader' in f && r.forEach(d, function (e, t) { + 'undefined' === typeof l && 'content-type' === t.toLowerCase() ? delete d[t] : f.setRequestHeader(t, e); + }), r.isUndefined(e.withCredentials) || (f.withCredentials = !!e.withCredentials), e.responseType) + try { + f.responseType = e.responseType; + } catch (b) { + if ('json' !== e.responseType) + throw b; + } + 'function' === typeof e.onDownloadProgress && f.addEventListener('progress', e.onDownloadProgress), 'function' === typeof e.onUploadProgress && f.upload && f.upload.addEventListener('progress', e.onUploadProgress), e.cancelToken && e.cancelToken.promise.then(function (e) { + f && (f.abort(), p(e), f = null); + }), void 0 === l && (l = null), f.send(l); + }); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(136); + e.exports = function (e, t, n, o, i) { + var s = new Error(e); + return r(s, t, n, o, i); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(7); + e.exports = function (e, t) { + t = t || {}; + var n = {}, o = [ + 'url', + 'method', + 'params', + 'data' + ], i = [ + 'headers', + 'auth', + 'proxy' + ], s = [ + 'baseURL', + 'url', + 'transformRequest', + 'transformResponse', + 'paramsSerializer', + 'timeout', + 'withCredentials', + 'adapter', + 'responseType', + 'xsrfCookieName', + 'xsrfHeaderName', + 'onUploadProgress', + 'onDownloadProgress', + 'maxContentLength', + 'validateStatus', + 'maxRedirects', + 'httpAgent', + 'httpsAgent', + 'cancelToken', + 'socketPath' + ]; + r.forEach(o, function (e) { + 'undefined' !== typeof t[e] && (n[e] = t[e]); + }), r.forEach(i, function (o) { + r.isObject(t[o]) ? n[o] = r.deepMerge(e[o], t[o]) : 'undefined' !== typeof t[o] ? n[o] = t[o] : r.isObject(e[o]) ? n[o] = r.deepMerge(e[o]) : 'undefined' !== typeof e[o] && (n[o] = e[o]); + }), r.forEach(s, function (r) { + 'undefined' !== typeof t[r] ? n[r] = t[r] : 'undefined' !== typeof e[r] && (n[r] = e[r]); + }); + var a = o.concat(i).concat(s), c = Object.keys(t).filter(function (e) { + return -1 === a.indexOf(e); + }); + return r.forEach(c, function (r) { + 'undefined' !== typeof t[r] ? n[r] = t[r] : 'undefined' !== typeof e[r] && (n[r] = e[r]); + }), n; + }; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + this.message = e; + } + r.prototype.toString = function () { + return 'Cancel' + (this.message ? ': ' + this.message : ''); + }, r.prototype.__CANCEL__ = !0, e.exports = r; + }, + , + , + , + , + , + , + , + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(47)), r(n(27)), r(n(29)), r(n(106)); + var o = n(51); + t.API_KEY = o.API_KEY; + }, + function (e, t, n) { + e.exports = n(128); + }, + function (e, t) { + e.exports = 'data:image/svg+xml,%3Csvg viewBox=\'0 0 16 17\' version=\'1.1\' xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\' style=\'margin-right: 5px; height: 17px;\'%3E%3Cg id=\'Page-1\' stroke=\'none\' stroke-width=\'1\' fill=\'none\' fill-rule=\'evenodd\'%3E%3Cg id=\'cog\' fill=\'%23FFFFFF\' fill-rule=\'nonzero\'%3E%3Cpath d=\'M15.596917,9.98326938 L14.5041079,9.33798816 C14.5728064,8.7815386 14.5728064,8.2184614 14.5041079,7.66201184 L15.596917,7.01673062 C15.9178229,6.82726259 16.0726124,6.43742732 15.9670848,6.0741546 C15.5912871,4.78033611 14.9223646,3.61573153 14.0390021,2.66061113 C13.7831755,2.38401797 13.3749053,2.32348965 13.0525249,2.51384881 L11.9613243,3.15813608 C11.5248519,2.81840117 11.0481221,2.53648663 10.542482,2.31910255 L10.542482,1.02991108 C10.542482,0.648438733 10.2860522,0.316869683 9.92305592,0.229024792 C8.66155,-0.07632446 7.33871809,-0.0763587342 6.07694408,0.229024792 C5.71398131,0.316869683 5.457518,0.648404458 5.457518,1.02991108 L5.457518,2.31910255 C4.95187406,2.53647872 4.47514334,2.81839382 4.03867572,3.15813608 L2.94747511,2.51384881 C2.62506122,2.32348965 2.21679094,2.38401797 1.96099786,2.66061113 C1.07763542,3.61573153 0.40871289,4.78037038 0.0329152236,6.0741546 C-0.072612407,6.43742732 0.0821770899,6.82722832 0.403082962,7.01673062 L1.49589212,7.66201184 C1.42719356,8.2184614 1.42719356,8.7815386 1.49589212,9.33798816 L0.403082962,9.98326938 C0.0821770899,10.1727374 -0.072612407,10.5625727 0.0329152236,10.9258454 C0.40871289,12.2196296 1.07763542,13.3842685 1.96099786,14.3393889 C2.21682445,14.615982 2.62509474,14.6765103 2.94747511,14.4861855 L4.03867572,13.8418982 C4.47514096,14.1816349 4.95187243,14.4635389 5.457518,14.6808975 L5.457518,15.9700889 C5.457518,16.3515613 5.7139478,16.6831303 6.07694408,16.7709752 C7.33848351,17.0763245 8.66128191,17.0763587 9.92305592,16.7709752 C10.2860187,16.6831303 10.542482,16.3515955 10.542482,15.9700889 L10.542482,14.6808975 C11.0481183,14.4635198 11.5248475,14.1816171 11.9613243,13.8418982 L13.0525249,14.4861855 C13.3749053,14.6765446 13.7831755,14.6160163 14.0390021,14.3393889 C14.9223646,13.3842685 15.5912871,12.2196296 15.9670848,10.9258454 C16.0726124,10.5625727 15.9178229,10.1727717 15.596917,9.98326938 Z M13.4026193,13.4264943 L11.8507364,12.510001 C10.9463288,13.3007421 10.6255905,13.4997041 9.47011484,13.9172673 L9.47011484,15.7502196 C8.50024808,15.9548373 7.49975192,15.9548373 6.52988516,15.7502196 L6.52988516,13.9172673 C5.4031959,13.5101235 5.07699522,13.3210668 4.14926358,12.510001 L2.59738075,13.4264943 C1.9368696,12.6693763 1.43490124,11.7817076 1.12525522,10.8230912 L2.67780828,9.90659789 C2.4588108,8.69270694 2.45871027,8.30790999 2.67780828,7.09340211 L1.12525522,6.17690879 C1.43490124,5.21829242 1.93690311,4.33058946 2.59738075,3.57312864 L4.14926358,4.49030745 C5.0667072,3.68712478 5.39129933,3.4941265 6.52988516,3.08269846 L6.52988516,1.24978037 C7.49971774,1.04482059 8.50028226,1.04482059 9.47011484,1.24978037 L9.47011484,3.08273274 C10.6087677,3.49419505 10.9333933,3.6872276 11.8507364,4.49034172 L13.4026193,3.57316291 C14.0630969,4.33058946 14.5650988,5.21829242 14.8747448,6.17694306 L13.3221917,7.09343638 C13.5412227,8.3076358 13.5412897,8.69212428 13.3221917,9.90663217 L14.8747448,10.8231255 C14.5650988,11.7817076 14.0631304,12.6694105 13.4026193,13.4264943 Z M8,5.20968958 C6.22607014,5.20968958 4.78289853,6.68570996 4.78289853,8.50001714 C4.78289853,10.3143243 6.22607014,11.7903447 8,11.7903447 C9.77392986,11.7903447 11.2171015,10.3143243 11.2171015,8.50001714 C11.2171015,6.68570996 9.77392986,5.20968958 8,5.20968958 Z M8,10.6935688 C6.81738009,10.6935688 5.85526568,9.70955526 5.85526568,8.50001714 C5.85526568,7.29047902 6.81738009,6.30646543 8,6.30646543 C9.18261991,6.30646543 10.1447343,7.29047902 10.1447343,8.50001714 C10.1447343,9.70955526 9.18261991,10.6935688 8,10.6935688 Z\' id=\'Shape\'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E'; + }, + , + , + , + , + , + , + , + , + , + , + function (e, t, n) { + var r = function (e) { + 'use strict'; + var t = Object.prototype, n = t.hasOwnProperty, r = 'function' === typeof Symbol ? Symbol : {}, o = r.iterator || '@@iterator', i = r.asyncIterator || '@@asyncIterator', s = r.toStringTag || '@@toStringTag'; + function a(e, t, n) { + return Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }), e[t]; + } + try { + a({}, ''); + } catch (L) { + a = function (e, t, n) { + return e[t] = n; + }; + } + function c(e, t, n, r) { + var o = t && t.prototype instanceof l ? t : l, i = Object.create(o.prototype), s = new S(r || []); + return i._invoke = function (e, t, n) { + var r = 'suspendedStart'; + return function (o, i) { + if ('executing' === r) + throw new Error('Generator is already running'); + if ('completed' === r) { + if ('throw' === o) + throw i; + return P(); + } + for (n.method = o, n.arg = i;;) { + var s = n.delegate; + if (s) { + var a = C(s, n); + if (a) { + if (a === p) + continue; + return a; + } + } + if ('next' === n.method) + n.sent = n._sent = n.arg; + else if ('throw' === n.method) { + if ('suspendedStart' === r) + throw r = 'completed', n.arg; + n.dispatchException(n.arg); + } else + 'return' === n.method && n.abrupt('return', n.arg); + r = 'executing'; + var c = u(e, t, n); + if ('normal' === c.type) { + if (r = n.done ? 'completed' : 'suspendedYield', c.arg === p) + continue; + return { + value: c.arg, + done: n.done + }; + } + 'throw' === c.type && (r = 'completed', n.method = 'throw', n.arg = c.arg); + } + }; + }(e, n, s), i; + } + function u(e, t, n) { + try { + return { + type: 'normal', + arg: e.call(t, n) + }; + } catch (L) { + return { + type: 'throw', + arg: L + }; + } + } + e.wrap = c; + var p = {}; + function l() { + } + function d() { + } + function f() { + } + var h = {}; + h[o] = function () { + return this; + }; + var v = Object.getPrototypeOf, y = v && v(v(I([]))); + y && y !== t && n.call(y, o) && (h = y); + var g = f.prototype = l.prototype = Object.create(h); + function m(e) { + [ + 'next', + 'throw', + 'return' + ].forEach(function (t) { + a(e, t, function (e) { + return this._invoke(t, e); + }); + }); + } + function b(e, t) { + var r; + this._invoke = function (o, i) { + function s() { + return new t(function (r, s) { + !function r(o, i, s, a) { + var c = u(e[o], e, i); + if ('throw' !== c.type) { + var p = c.arg, l = p.value; + return l && 'object' === typeof l && n.call(l, '__await') ? t.resolve(l.__await).then(function (e) { + r('next', e, s, a); + }, function (e) { + r('throw', e, s, a); + }) : t.resolve(l).then(function (e) { + p.value = e, s(p); + }, function (e) { + return r('throw', e, s, a); + }); + } + a(c.arg); + }(o, i, r, s); + }); + } + return r = r ? r.then(s, s) : s(); + }; + } + function C(e, t) { + var n = e.iterator[t.method]; + if (void 0 === n) { + if (t.delegate = null, 'throw' === t.method) { + if (e.iterator.return && (t.method = 'return', t.arg = void 0, C(e, t), 'throw' === t.method)) + return p; + t.method = 'throw', t.arg = new TypeError('The iterator does not provide a \'throw\' method'); + } + return p; + } + var r = u(n, e.iterator, t.arg); + if ('throw' === r.type) + return t.method = 'throw', t.arg = r.arg, t.delegate = null, p; + var o = r.arg; + return o ? o.done ? (t[e.resultName] = o.value, t.next = e.nextLoc, 'return' !== t.method && (t.method = 'next', t.arg = void 0), t.delegate = null, p) : o : (t.method = 'throw', t.arg = new TypeError('iterator result is not an object'), t.delegate = null, p); + } + function _(e) { + var t = { tryLoc: e[0] }; + 1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t); + } + function E(e) { + var t = e.completion || {}; + t.type = 'normal', delete t.arg, e.completion = t; + } + function S(e) { + this.tryEntries = [{ tryLoc: 'root' }], e.forEach(_, this), this.reset(!0); + } + function I(e) { + if (e) { + var t = e[o]; + if (t) + return t.call(e); + if ('function' === typeof e.next) + return e; + if (!isNaN(e.length)) { + var r = -1, i = function t() { + for (; ++r < e.length;) + if (n.call(e, r)) + return t.value = e[r], t.done = !1, t; + return t.value = void 0, t.done = !0, t; + }; + return i.next = i; + } + } + return { next: P }; + } + function P() { + return { + value: void 0, + done: !0 + }; + } + return d.prototype = g.constructor = f, f.constructor = d, d.displayName = a(f, s, 'GeneratorFunction'), e.isGeneratorFunction = function (e) { + var t = 'function' === typeof e && e.constructor; + return !!t && (t === d || 'GeneratorFunction' === (t.displayName || t.name)); + }, e.mark = function (e) { + return Object.setPrototypeOf ? Object.setPrototypeOf(e, f) : (e.__proto__ = f, a(e, s, 'GeneratorFunction')), e.prototype = Object.create(g), e; + }, e.awrap = function (e) { + return { __await: e }; + }, m(b.prototype), b.prototype[i] = function () { + return this; + }, e.AsyncIterator = b, e.async = function (t, n, r, o, i) { + void 0 === i && (i = Promise); + var s = new b(c(t, n, r, o), i); + return e.isGeneratorFunction(n) ? s : s.next().then(function (e) { + return e.done ? e.value : s.next(); + }); + }, m(g), a(g, s, 'Generator'), g[o] = function () { + return this; + }, g.toString = function () { + return '[object Generator]'; + }, e.keys = function (e) { + var t = []; + for (var n in e) + t.push(n); + return t.reverse(), function n() { + for (; t.length;) { + var r = t.pop(); + if (r in e) + return n.value = r, n.done = !1, n; + } + return n.done = !0, n; + }; + }, e.values = I, S.prototype = { + constructor: S, + reset: function (e) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = 'next', this.arg = void 0, this.tryEntries.forEach(E), !e) + for (var t in this) + 't' === t.charAt(0) && n.call(this, t) && !isNaN(+t.slice(1)) && (this[t] = void 0); + }, + stop: function () { + this.done = !0; + var e = this.tryEntries[0].completion; + if ('throw' === e.type) + throw e.arg; + return this.rval; + }, + dispatchException: function (e) { + if (this.done) + throw e; + var t = this; + function r(n, r) { + return s.type = 'throw', s.arg = e, t.next = n, r && (t.method = 'next', t.arg = void 0), !!r; + } + for (var o = this.tryEntries.length - 1; o >= 0; --o) { + var i = this.tryEntries[o], s = i.completion; + if ('root' === i.tryLoc) + return r('end'); + if (i.tryLoc <= this.prev) { + var a = n.call(i, 'catchLoc'), c = n.call(i, 'finallyLoc'); + if (a && c) { + if (this.prev < i.catchLoc) + return r(i.catchLoc, !0); + if (this.prev < i.finallyLoc) + return r(i.finallyLoc); + } else if (a) { + if (this.prev < i.catchLoc) + return r(i.catchLoc, !0); + } else { + if (!c) + throw new Error('try statement without catch or finally'); + if (this.prev < i.finallyLoc) + return r(i.finallyLoc); + } + } + } + }, + abrupt: function (e, t) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, 'finallyLoc') && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ('break' === e || 'continue' === e) && i.tryLoc <= t && t <= i.finallyLoc && (i = null); + var s = i ? i.completion : {}; + return s.type = e, s.arg = t, i ? (this.method = 'next', this.next = i.finallyLoc, p) : this.complete(s); + }, + complete: function (e, t) { + if ('throw' === e.type) + throw e.arg; + return 'break' === e.type || 'continue' === e.type ? this.next = e.arg : 'return' === e.type ? (this.rval = this.arg = e.arg, this.method = 'return', this.next = 'end') : 'normal' === e.type && t && (this.next = t), p; + }, + finish: function (e) { + for (var t = this.tryEntries.length - 1; t >= 0; --t) { + var n = this.tryEntries[t]; + if (n.finallyLoc === e) + return this.complete(n.completion, n.afterLoc), E(n), p; + } + }, + catch: function (e) { + for (var t = this.tryEntries.length - 1; t >= 0; --t) { + var n = this.tryEntries[t]; + if (n.tryLoc === e) { + var r = n.completion; + if ('throw' === r.type) { + var o = r.arg; + E(n); + } + return o; + } + } + throw new Error('illegal catch attempt'); + }, + delegateYield: function (e, t, n) { + return this.delegate = { + iterator: I(e), + resultName: t, + nextLoc: n + }, 'next' === this.method && (this.arg = void 0), p; + } + }, e; + }(e.exports); + try { + regeneratorRuntime = r; + } catch (o) { + Function('r', 'regeneratorRuntime = r')(r); + } + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.CmpStatus || (t.CmpStatus = {})).STUB = 'stub', r.LOADING = 'loading', r.LOADED = 'loaded', r.ERROR = 'error'; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.DisplayStatus || (t.DisplayStatus = {})).VISIBLE = 'visible', r.HIDDEN = 'hidden', r.DISABLED = 'disabled'; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.EventStatus || (t.EventStatus = {})).TC_LOADED = 'tcloaded', r.CMP_UI_SHOWN = 'cmpuishown', r.USER_ACTION_COMPLETE = 'useractioncomplete'; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(30), o = function () { + function e() { + this.eventQueue = new Map(), this.queueNumber = 0; + } + return e.prototype.add = function (e) { + return this.eventQueue.set(this.queueNumber, e), this.queueNumber++; + }, e.prototype.remove = function (e) { + return this.eventQueue.delete(e); + }, e.prototype.exec = function () { + this.eventQueue.forEach(function (e, t) { + new r.GetTCDataCommand(e.callback, e.param, t, e.next); + }); + }, e.prototype.clear = function () { + this.queueNumber = 0, this.eventQueue.clear(); + }, Object.defineProperty(e.prototype, 'size', { + get: function () { + return this.eventQueue.size; + }, + enumerable: !0, + configurable: !0 + }), e; + }(); + t.EventListenerQueue = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(), o = this && this.__read || function (e, t) { + var n = 'function' == typeof Symbol && e[Symbol.iterator]; + if (!n) + return e; + var r, o, i = n.call(e), s = []; + try { + for (; (void 0 === t || t-- > 0) && !(r = i.next()).done;) + s.push(r.value); + } catch (e) { + o = { error: e }; + } finally { + try { + r && !r.done && (n = i.return) && n.call(i); + } finally { + if (o) + throw o.error; + } + } + return s; + }, i = this && this.__spread || function () { + for (var e = [], t = 0; t < arguments.length; t++) + e = e.concat(o(arguments[t])); + return e; + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var s = function (e) { + function t(t) { + var n = e.call(this, t) || this; + return delete n.outOfBand, n; + } + return r(t, e), t.prototype.createVectorField = function (e) { + return i(e).reduce(function (e, t) { + return e + (t[1] ? '1' : '0'); + }, ''); + }, t.prototype.createRestrictions = function (e) { + var t = {}; + if (e.numRestrictions > 0) { + var n = e.getMaxVendorId(); + e.getRestrictions().forEach(function (e) { + t[e.purposeId.toString()] = '_'.repeat(n); + }); + for (var r = function (n) { + var r = n + 1; + e.getRestrictions(r).forEach(function (e) { + var r = e.restrictionType.toString(), o = e.purposeId.toString(), i = t[o].substr(0, n), s = t[o].substr(n + 1); + t[o] = i + r + s; + }); + }, o = 0; o < n; o++) + r(o); + } + return t; + }, t; + }(n(50).TCData); + t.InAppTCData = s; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(13), i = function (e) { + function t() { + var t = e.call(this) || this; + return t.cmpLoaded = !0, t.cmpStatus = o.CmpApiModel.cmpStatus, t.displayStatus = o.CmpApiModel.displayStatus, t.apiVersion = '' + o.CmpApiModel.apiVersion, o.CmpApiModel.tcModel && o.CmpApiModel.tcModel.vendorListVersion && (t.gvlVersion = +o.CmpApiModel.tcModel.vendorListVersion), t; + } + return r(t, e), t; + }(n(28).Response); + t.Ping = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(13), o = n(29), i = n(51), s = n(52), a = function () { + function e(e, t, n, o) { + void 0 === n && (n = !1), this.numUpdates = 0, this.throwIfInvalidInt(e, 'cmpId', 2), this.throwIfInvalidInt(t, 'cmpVersion', 0), r.CmpApiModel.cmpId = e, r.CmpApiModel.cmpVersion = t, r.CmpApiModel.tcfPolicyVersion = 2, this.isServiceSpecific = !!n, this.callResponder = new i.CallResponder(o); + } + return e.prototype.throwIfInvalidInt = function (e, t, n) { + if (!('number' == typeof e && Number.isInteger(e) && e >= n)) + throw new Error('Invalid ' + t + ': ' + e); + }, e.prototype.update = function (e, t) { + if (void 0 === t && (t = !1), r.CmpApiModel.disabled) + throw new Error('CmpApi Disabled'); + r.CmpApiModel.cmpStatus = o.CmpStatus.LOADED, t ? (r.CmpApiModel.displayStatus = o.DisplayStatus.VISIBLE, r.CmpApiModel.eventStatus = o.EventStatus.CMP_UI_SHOWN) : void 0 === r.CmpApiModel.tcModel ? (r.CmpApiModel.displayStatus = o.DisplayStatus.DISABLED, r.CmpApiModel.eventStatus = o.EventStatus.TC_LOADED) : (r.CmpApiModel.displayStatus = o.DisplayStatus.HIDDEN, r.CmpApiModel.eventStatus = o.EventStatus.USER_ACTION_COMPLETE), r.CmpApiModel.gdprApplies = null !== e, r.CmpApiModel.gdprApplies ? ('' === e ? (r.CmpApiModel.tcModel = new s.TCModel(), r.CmpApiModel.tcModel.cmpId = r.CmpApiModel.cmpId, r.CmpApiModel.tcModel.cmpVersion = r.CmpApiModel.cmpVersion) : r.CmpApiModel.tcModel = s.TCString.decode(e), r.CmpApiModel.tcModel.isServiceSpecific = this.isServiceSpecific, r.CmpApiModel.tcfPolicyVersion = +r.CmpApiModel.tcModel.policyVersion, r.CmpApiModel.tcString = e) : r.CmpApiModel.tcModel = null, 0 === this.numUpdates ? this.callResponder.purgeQueuedCalls() : r.CmpApiModel.eventQueue.exec(), this.numUpdates++; + }, e.prototype.disable = function () { + r.CmpApiModel.disabled = !0, r.CmpApiModel.cmpStatus = o.CmpStatus.ERROR; + }, e; + }(); + t.CmpApi = a; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(108), o = n(30), i = n(109), s = n(110), a = n(125), c = n(126), u = n(48), p = function () { + function e() { + } + var t, n, p, l, d, f; + return t = u.TCFCommand.PING, n = u.TCFCommand.GET_TC_DATA, p = u.TCFCommand.GET_IN_APP_TC_DATA, l = u.TCFCommand.GET_VENDOR_LIST, d = u.TCFCommand.ADD_EVENT_LISTENER, f = u.TCFCommand.REMOVE_EVENT_LISTENER, e[t] = r.PingCommand, e[n] = o.GetTCDataCommand, e[p] = i.GetInAppTCDataCommand, e[l] = s.GetVendorListCommand, e[d] = a.AddEventListenerCommand, e[f] = c.RemoveEventListenerCommand, e; + }(); + t.CommandMap = p; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(27), i = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + this.invokeCallback(new o.Ping()); + }, t; + }(n(31).Command); + t.PingCommand = i; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(30), i = n(27), s = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + this.throwIfParamInvalid(), this.invokeCallback(new i.InAppTCData(this.param)); + }, t; + }(o.GetTCDataCommand); + t.GetInAppTCDataCommand = s; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(13), i = n(31), s = n(52), a = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + var e, t = this, n = o.CmpApiModel.tcModel, r = n.vendorListVersion; + void 0 === this.param && (this.param = r), (e = this.param === r && n.gvl ? n.gvl : new s.GVL(this.param)).readyPromise.then(function () { + t.invokeCallback(e.getJson()); + }); + }, t; + }(i.Command); + t.GetVendorListCommand = a; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t) { + var n = e.call(this, t) || this; + return n.name = 'DecodingError', n; + } + return r(t, e), t; + }(Error); + t.DecodingError = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t) { + var n = e.call(this, t) || this; + return n.name = 'EncodingError', n; + } + return r(t, e), t; + }(Error); + t.EncodingError = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t) { + var n = e.call(this, t) || this; + return n.name = 'GVLError', n; + } + return r(t, e), t; + }(Error); + t.GVLError = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t, n, r) { + void 0 === r && (r = ''); + var o = e.call(this, 'invalid value ' + n + ' passed for ' + t + ' ' + r) || this; + return o.name = 'TCModelError', o; + } + return r(t, e), t; + }(Error); + t.TCModelError = o; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.prototype.has = function (t) { + return e.langSet.has(t); + }, e.prototype.forEach = function (t) { + e.langSet.forEach(t); + }, Object.defineProperty(e.prototype, 'size', { + get: function () { + return e.langSet.size; + }, + enumerable: !0, + configurable: !0 + }), e.langSet = new Set([ + 'BG', + 'CA', + 'CS', + 'DA', + 'DE', + 'EL', + 'EN', + 'ES', + 'ET', + 'FI', + 'FR', + 'HR', + 'HU', + 'IT', + 'JA', + 'LT', + 'LV', + 'MT', + 'NL', + 'NO', + 'PL', + 'PT', + 'RO', + 'RU', + 'SK', + 'SL', + 'SV', + 'TR', + 'ZH' + ]), e; + }(); + t.ConsentLanguages = r; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(), o = this && this.__values || function (e) { + var t = 'function' == typeof Symbol && Symbol.iterator, n = t && e[t], r = 0; + if (n) + return n.call(e); + if (e && 'number' == typeof e.length) + return { + next: function () { + return e && r >= e.length && (e = void 0), { + value: e && e[r++], + done: !e + }; + } + }; + throw new TypeError(t ? 'Object is not iterable.' : 'Symbol.iterator is not defined.'); + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var i = n(56), s = n(54), a = n(38), c = function (e) { + function t() { + var t = null !== e && e.apply(this, arguments) || this; + return t.bitLength = 0, t.map = new Map(), t; + } + return r(t, e), t.prototype.has = function (e) { + return this.map.has(e); + }, t.prototype.isOkToHave = function (e, t, n) { + var r, o = !0; + if (null === (r = this.gvl) || void 0 === r ? void 0 : r.vendors) { + var i = this.gvl.vendors[n]; + if (i) + if (e === a.RestrictionType.NOT_ALLOWED) + o = i.legIntPurposes.includes(t) || i.purposes.includes(t); + else if (i.flexiblePurposes.length) + switch (e) { + case a.RestrictionType.REQUIRE_CONSENT: + o = i.flexiblePurposes.includes(t) && i.legIntPurposes.includes(t); + break; + case a.RestrictionType.REQUIRE_LI: + o = i.flexiblePurposes.includes(t) && i.purposes.includes(t); + } + else + o = !1; + else + o = !1; + } + return o; + }, t.prototype.add = function (e, t) { + if (this.isOkToHave(t.restrictionType, t.purposeId, e)) { + var n = t.hash; + this.has(n) || (this.map.set(n, new s.BinarySearchTree()), this.bitLength = 0), this.map.get(n).add(e); + } + }, t.prototype.restrictPurposeToLegalBasis = function (e) { + for (var t = this.gvl.vendorIds, n = e.hash, r = function () { + var e, n, r; + try { + for (var i = o(t), s = i.next(); !s.done; s = i.next()) + r = s.value; + } catch (t) { + e = { error: t }; + } finally { + try { + s && !s.done && (n = i.return) && n.call(i); + } finally { + if (e) + throw e.error; + } + } + return r; + }(), i = 1; i <= r; i++) + this.has(n) || (this.map.set(n, new s.BinarySearchTree()), this.bitLength = 0), this.map.get(n).add(i); + }, t.prototype.getVendors = function (e) { + var t = []; + if (e) { + var n = e.hash; + this.has(n) && (t = this.map.get(n).get()); + } else { + var r = new Set(); + this.map.forEach(function (e) { + e.get().forEach(function (e) { + r.add(e); + }); + }), t = Array.from(r); + } + return t; + }, t.prototype.getRestrictionType = function (e, t) { + var n; + return this.getRestrictions(e).forEach(function (e) { + e.purposeId === t && (void 0 === n || n > e.restrictionType) && (n = e.restrictionType); + }), n; + }, t.prototype.vendorHasRestriction = function (e, t) { + for (var n = !1, r = this.getRestrictions(e), o = 0; o < r.length && !n; o++) + n = t.isSameAs(r[o]); + return n; + }, t.prototype.getMaxVendorId = function () { + var e = 0; + return this.map.forEach(function (t) { + e = Math.max(t.max(), e); + }), e; + }, t.prototype.getRestrictions = function (e) { + var t = []; + return this.map.forEach(function (n, r) { + e ? n.contains(e) && t.push(i.PurposeRestriction.unHash(r)) : t.push(i.PurposeRestriction.unHash(r)); + }), t; + }, t.prototype.getPurposes = function () { + var e = new Set(); + return this.map.forEach(function (t, n) { + e.add(i.PurposeRestriction.unHash(n).purposeId); + }), Array.from(e); + }, t.prototype.remove = function (e, t) { + var n = t.hash, r = this.map.get(n); + r && (r.remove(e), r.isEmpty() && (this.map.delete(n), this.bitLength = 0)); + }, Object.defineProperty(t.prototype, 'gvl', { + get: function () { + return this.gvl_; + }, + set: function (e) { + var t = this; + this.gvl_ || (this.gvl_ = e, this.map.forEach(function (e, n) { + var r = i.PurposeRestriction.unHash(n); + e.get().forEach(function (n) { + t.isOkToHave(r.restrictionType, r.purposeId, n) || e.remove(n); + }); + })); + }, + enumerable: !0, + configurable: !0 + }), t.prototype.isEmpty = function () { + return 0 === this.map.size; + }, Object.defineProperty(t.prototype, 'numRestrictions', { + get: function () { + return this.map.size; + }, + enumerable: !0, + configurable: !0 + }), t; + }(n(15).Cloneable); + t.PurposeRestrictionVector = c; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.DeviceDisclosureStorageAccessType || (t.DeviceDisclosureStorageAccessType = {})).COOKIE = 'cookie', r.WEB = 'web', r.APP = 'app'; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(57), i = function () { + function e() { + } + return e.ID_TO_KEY = [ + o.Segment.CORE, + o.Segment.VENDORS_DISCLOSED, + o.Segment.VENDORS_ALLOWED, + o.Segment.PUBLISHER_TC + ], e.KEY_TO_ID = ((r = {})[o.Segment.CORE] = 0, r[o.Segment.VENDORS_DISCLOSED] = 1, r[o.Segment.VENDORS_ALLOWED] = 2, r[o.Segment.PUBLISHER_TC] = 3, r), e; + }(); + t.SegmentIDs = i; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(), o = this && this.__generator || function (e, t) { + var n, r, o, i, s = { + label: 0, + sent: function () { + if (1 & o[0]) + throw o[1]; + return o[1]; + }, + trys: [], + ops: [] + }; + return i = { + next: a(0), + throw: a(1), + return: a(2) + }, 'function' == typeof Symbol && (i[Symbol.iterator] = function () { + return this; + }), i; + function a(i) { + return function (a) { + return function (i) { + if (n) + throw new TypeError('Generator is already executing.'); + for (; s;) + try { + if (n = 1, r && (o = 2 & i[0] ? r.return : i[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, i[1])).done) + return o; + switch (r = 0, o && (i = [ + 2 & i[0], + o.value + ]), i[0]) { + case 0: + case 1: + o = i; + break; + case 4: + return s.label++, { + value: i[1], + done: !1 + }; + case 5: + s.label++, r = i[1], i = [0]; + continue; + case 7: + i = s.ops.pop(), s.trys.pop(); + continue; + default: + if (!(o = (o = s.trys).length > 0 && o[o.length - 1]) && (6 === i[0] || 2 === i[0])) { + s = 0; + continue; + } + if (3 === i[0] && (!o || i[1] > o[0] && i[1] < o[3])) { + s.label = i[1]; + break; + } + if (6 === i[0] && s.label < o[1]) { + s.label = o[1], o = i; + break; + } + if (o && s.label < o[2]) { + s.label = o[2], s.ops.push(i); + break; + } + o[2] && s.ops.pop(), s.trys.pop(); + continue; + } + i = t.call(e, s); + } catch (e) { + i = [ + 6, + e + ], r = 0; + } finally { + n = o = 0; + } + if (5 & i[0]) + throw i[1]; + return { + value: i[0] ? i[1] : void 0, + done: !0 + }; + }([ + i, + a + ]); + }; + } + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var i = n(15), s = n(5), a = function (e) { + function t() { + var t = null !== e && e.apply(this, arguments) || this; + return t.bitLength = 0, t.maxId_ = 0, t.set_ = new Set(), t; + } + return r(t, e), t.prototype[Symbol.iterator] = function () { + var e; + return o(this, function (t) { + switch (t.label) { + case 0: + e = 1, t.label = 1; + case 1: + return e <= this.maxId ? [ + 4, + [ + e, + this.has(e) + ] + ] : [ + 3, + 4 + ]; + case 2: + t.sent(), t.label = 3; + case 3: + return e++, [ + 3, + 1 + ]; + case 4: + return [2]; + } + }); + }, t.prototype.values = function () { + return this.set_.values(); + }, Object.defineProperty(t.prototype, 'maxId', { + get: function () { + return this.maxId_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.has = function (e) { + return this.set_.has(e); + }, t.prototype.unset = function (e) { + var t = this; + Array.isArray(e) ? e.forEach(function (e) { + return t.unset(e); + }) : 'object' == typeof e ? this.unset(Object.keys(e).map(function (e) { + return +e; + })) : (this.set_.delete(e), this.bitLength = 0, e === this.maxId && (this.maxId_ = 0, this.set_.forEach(function (e) { + t.maxId_ = Math.max(t.maxId, e); + }))); + }, t.prototype.isIntMap = function (e) { + var t = this, n = 'object' == typeof e; + return n && Object.keys(e).every(function (n) { + var r = Number.isInteger(parseInt(n, 10)); + return (r = r && t.isValidNumber(e[n].id)) && void 0 !== e[n].name; + }); + }, t.prototype.isValidNumber = function (e) { + return parseInt(e, 10) > 0; + }, t.prototype.isSet = function (e) { + var t = !1; + return e instanceof Set && (t = Array.from(e).every(this.isValidNumber)), t; + }, t.prototype.set = function (e) { + var t = this; + if (Array.isArray(e)) + e.forEach(function (e) { + return t.set(e); + }); + else if (this.isSet(e)) + this.set(Array.from(e)); + else if (this.isIntMap(e)) + this.set(Object.keys(e).map(function (e) { + return +e; + })); + else { + if (!this.isValidNumber(e)) + throw new s.TCModelError('set()', e, 'must be positive integer array, positive integer, Set, or IntMap'); + this.set_.add(e), this.maxId_ = Math.max(this.maxId, e), this.bitLength = 0; + } + }, t.prototype.empty = function () { + this.set_ = new Set(); + }, t.prototype.forEach = function (e) { + for (var t = 1; t <= this.maxId; t++) + e(this.has(t), t); + }, Object.defineProperty(t.prototype, 'size', { + get: function () { + return this.set_.size; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.setAll = function (e) { + this.set(e); + }, t; + }(i.Cloneable); + t.Vector = a; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(53), o = n(37), i = n(58), s = n(64), a = n(5), c = n(55), u = n(6), p = function () { + function e() { + } + return e.encode = function (e, t) { + var n, s = this; + try { + n = this.fieldSequence['' + e.version][t]; + } catch (n) { + throw new a.EncodingError('Unable to encode version: ' + e.version + ', segment: ' + t); + } + var p = ''; + return t !== u.Segment.CORE && (p = i.IntEncoder.encode(u.SegmentIDs.KEY_TO_ID[t], o.BitLength.segmentType)), n.forEach(function (n) { + var r = e[n], u = i.FieldEncoderMap[n], l = o.BitLength[n]; + void 0 === l && s.isPublisherCustom(n) && (l = +e[c.Fields.numCustomPurposes]); + try { + p += u.encode(r, l); + } catch (e) { + throw new a.EncodingError('Error encoding ' + t + '->' + n + ': ' + e.message); + } + }), r.Base64Url.encode(p); + }, e.decode = function (e, t, n) { + var s = this, p = r.Base64Url.decode(e), l = 0; + return n === u.Segment.CORE && (t.version = i.IntEncoder.decode(p.substr(l, o.BitLength[c.Fields.version]), o.BitLength[c.Fields.version])), n !== u.Segment.CORE && (l += o.BitLength.segmentType), this.fieldSequence['' + t.version][n].forEach(function (e) { + var n = i.FieldEncoderMap[e], r = o.BitLength[e]; + if (void 0 === r && s.isPublisherCustom(e) && (r = +t[c.Fields.numCustomPurposes]), 0 !== r) { + var u = p.substr(l, r); + if (n === i.VendorVectorEncoder ? t[e] = n.decode(u, t.version) : t[e] = n.decode(u, r), Number.isInteger(r)) + l += r; + else { + if (!Number.isInteger(t[e].bitLength)) + throw new a.DecodingError(e); + l += t[e].bitLength; + } + } + }), t; + }, e.isPublisherCustom = function (e) { + return 0 === e.indexOf('publisherCustom'); + }, e.fieldSequence = new s.FieldSequence(), e; + }(); + t.SegmentEncoder = p; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(6), o = n(23), i = n(59), s = n(39), a = n(16), c = n(60), u = n(61), p = n(62), l = function () { + function e() { + } + var t, n, l, d, f, h, v, y, g, m, b, C, _, E, S, I, P, L, w, A, O, k, T, V, x, R; + return t = r.Fields.version, n = r.Fields.created, l = r.Fields.lastUpdated, d = r.Fields.cmpId, f = r.Fields.cmpVersion, h = r.Fields.consentScreen, v = r.Fields.consentLanguage, y = r.Fields.vendorListVersion, g = r.Fields.policyVersion, m = r.Fields.isServiceSpecific, b = r.Fields.useNonStandardStacks, C = r.Fields.specialFeatureOptins, _ = r.Fields.purposeConsents, E = r.Fields.purposeLegitimateInterests, S = r.Fields.purposeOneTreatment, I = r.Fields.publisherCountryCode, P = r.Fields.vendorConsents, L = r.Fields.vendorLegitimateInterests, w = r.Fields.publisherRestrictions, A = r.Fields.vendorsDisclosed, O = r.Fields.vendorsAllowed, k = r.Fields.publisherConsents, T = r.Fields.publisherLegitimateInterests, V = r.Fields.numCustomPurposes, x = r.Fields.publisherCustomConsents, R = r.Fields.publisherCustomLegitimateInterests, e[t] = a.IntEncoder, e[n] = i.DateEncoder, e[l] = i.DateEncoder, e[d] = a.IntEncoder, e[f] = a.IntEncoder, e[h] = a.IntEncoder, e[v] = c.LangEncoder, e[y] = a.IntEncoder, e[g] = a.IntEncoder, e[m] = o.BooleanEncoder, e[b] = o.BooleanEncoder, e[C] = s.FixedVectorEncoder, e[_] = s.FixedVectorEncoder, e[E] = s.FixedVectorEncoder, e[S] = o.BooleanEncoder, e[I] = c.LangEncoder, e[P] = p.VendorVectorEncoder, e[L] = p.VendorVectorEncoder, e[w] = u.PurposeRestrictionVectorEncoder, e.segmentType = a.IntEncoder, e[A] = p.VendorVectorEncoder, e[O] = p.VendorVectorEncoder, e[k] = s.FixedVectorEncoder, e[T] = s.FixedVectorEncoder, e[V] = a.IntEncoder, e[x] = s.FixedVectorEncoder, e[R] = s.FixedVectorEncoder, e; + }(); + t.FieldEncoderMap = l; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(6); + t.FieldSequence = function () { + var e, t; + this[1] = ((e = {})[r.Segment.CORE] = [ + r.Fields.version, + r.Fields.created, + r.Fields.lastUpdated, + r.Fields.cmpId, + r.Fields.cmpVersion, + r.Fields.consentScreen, + r.Fields.consentLanguage, + r.Fields.vendorListVersion, + r.Fields.purposeConsents, + r.Fields.vendorConsents + ], e), this[2] = ((t = {})[r.Segment.CORE] = [ + r.Fields.version, + r.Fields.created, + r.Fields.lastUpdated, + r.Fields.cmpId, + r.Fields.cmpVersion, + r.Fields.consentScreen, + r.Fields.consentLanguage, + r.Fields.vendorListVersion, + r.Fields.policyVersion, + r.Fields.isServiceSpecific, + r.Fields.useNonStandardStacks, + r.Fields.specialFeatureOptins, + r.Fields.purposeConsents, + r.Fields.purposeLegitimateInterests, + r.Fields.purposeOneTreatment, + r.Fields.publisherCountryCode, + r.Fields.vendorConsents, + r.Fields.vendorLegitimateInterests, + r.Fields.publisherRestrictions + ], t[r.Segment.PUBLISHER_TC] = [ + r.Fields.publisherConsents, + r.Fields.publisherLegitimateInterests, + r.Fields.numCustomPurposes, + r.Fields.publisherCustomConsents, + r.Fields.publisherCustomLegitimateInterests + ], t[r.Segment.VENDORS_ALLOWED] = [r.Fields.vendorsAllowed], t[r.Segment.VENDORS_DISCLOSED] = [r.Fields.vendorsDisclosed], t); + }; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(6); + t.SegmentSequence = function (e, t) { + if (this[1] = [r.Segment.CORE], this[2] = [r.Segment.CORE], 2 === e.version) + if (e.isServiceSpecific) + this[2].push(r.Segment.PUBLISHER_TC); + else { + var n = !(!t || !t.isForVendors); + n && !0 !== e[r.Fields.supportOOB] || this[2].push(r.Segment.VENDORS_DISCLOSED), n && (e[r.Fields.supportOOB] && e[r.Fields.vendorsAllowed].size > 0 && this[2].push(r.Segment.VENDORS_ALLOWED), this[2].push(r.Segment.PUBLISHER_TC)); + } + }; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(5), o = n(6), i = function () { + function e() { + } + return e.process = function (e, t) { + var n, o, i = e.gvl; + if (!i) + throw new r.EncodingError('Unable to encode TCModel without a GVL'); + if (!i.isReady) + throw new r.EncodingError('Unable to encode TCModel tcModel.gvl.readyPromise is not resolved'); + (e = e.clone()).consentLanguage = i.language.toUpperCase(), (null === (n = t) || void 0 === n ? void 0 : n.version) > 0 && (null === (o = t) || void 0 === o ? void 0 : o.version) <= this.processor.length ? e.version = t.version : e.version = this.processor.length; + var s = e.version - 1; + if (!this.processor[s]) + throw new r.EncodingError('Invalid version: ' + e.version); + return this.processor[s](e, i); + }, e.processor = [ + function (e) { + return e; + }, + function (e, t) { + e.publisherRestrictions.gvl = t, e.purposeLegitimateInterests.unset(1); + var n = new Map(); + return n.set('legIntPurposes', e.vendorLegitimateInterests), n.set('purposes', e.vendorConsents), n.forEach(function (n, r) { + n.forEach(function (i, s) { + if (i) { + var a = t.vendors[s]; + if (!a || a.deletedDate) + n.unset(s); + else if (0 === a[r].length) + if ('legIntPurposes' === r && 0 === a.purposes.length && 0 === a.legIntPurposes.length && a.specialPurposes.length > 0); + else if (e.isServiceSpecific) + if (0 === a.flexiblePurposes.length) + n.unset(s); + else { + for (var c = e.publisherRestrictions.getRestrictions(s), u = !1, p = 0, l = c.length; p < l && !u; p++) + u = c[p].restrictionType === o.RestrictionType.REQUIRE_CONSENT && 'purposes' === r || c[p].restrictionType === o.RestrictionType.REQUIRE_LI && 'legIntPurposes' === r; + u || n.unset(s); + } + else + n.unset(s); + } + }); + }), e.vendorsDisclosed.set(t.vendors), e; + } + ], e; + }(); + t.SemanticPreEncoder = i; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(13), i = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + this.listenerId = o.CmpApiModel.eventQueue.add({ + callback: this.callback, + param: this.param, + next: this.next + }), e.prototype.respond.call(this); + }, t; + }(n(30).GetTCDataCommand); + t.AddEventListenerCommand = i; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(13), i = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + this.invokeCallback(o.CmpApiModel.eventQueue.remove(this.param)); + }, t; + }(n(31).Command); + t.RemoveEventListenerCommand = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.has = function (e) { + return 'string' == typeof e && (e = +e), this.set_.has(e); + }, e.set_ = new Set([ + 0, + 2, + void 0, + null + ]), e; + }(); + t.SupportedVersions = r; + }, + function (e, t, n) { + 'use strict'; + var r = n(7), o = n(71), i = n(129), s = n(77); + function a(e) { + var t = new i(e), n = o(i.prototype.request, t); + return r.extend(n, i.prototype, t), r.extend(n, t), n; + } + var c = a(n(74)); + c.Axios = i, c.create = function (e) { + return a(s(c.defaults, e)); + }, c.Cancel = n(78), c.CancelToken = n(143), c.isCancel = n(73), c.all = function (e) { + return Promise.all(e); + }, c.spread = n(144), e.exports = c, e.exports.default = c; + }, + function (e, t, n) { + 'use strict'; + var r = n(7), o = n(72), i = n(130), s = n(131), a = n(77); + function c(e) { + this.defaults = e, this.interceptors = { + request: new i(), + response: new i() + }; + } + c.prototype.request = function (e) { + 'string' === typeof e ? (e = arguments[1] || {}).url = arguments[0] : e = e || {}, (e = a(this.defaults, e)).method ? e.method = e.method.toLowerCase() : this.defaults.method ? e.method = this.defaults.method.toLowerCase() : e.method = 'get'; + var t = [ + s, + void 0 + ], n = Promise.resolve(e); + for (this.interceptors.request.forEach(function (e) { + t.unshift(e.fulfilled, e.rejected); + }), this.interceptors.response.forEach(function (e) { + t.push(e.fulfilled, e.rejected); + }); t.length;) + n = n.then(t.shift(), t.shift()); + return n; + }, c.prototype.getUri = function (e) { + return e = a(this.defaults, e), o(e.url, e.params, e.paramsSerializer).replace(/^\?/, ''); + }, r.forEach([ + 'delete', + 'get', + 'head', + 'options' + ], function (e) { + c.prototype[e] = function (t, n) { + return this.request(r.merge(n || {}, { + method: e, + url: t + })); + }; + }), r.forEach([ + 'post', + 'put', + 'patch' + ], function (e) { + c.prototype[e] = function (t, n, o) { + return this.request(r.merge(o || {}, { + method: e, + url: t, + data: n + })); + }; + }), e.exports = c; + }, + function (e, t, n) { + 'use strict'; + var r = n(7); + function o() { + this.handlers = []; + } + o.prototype.use = function (e, t) { + return this.handlers.push({ + fulfilled: e, + rejected: t + }), this.handlers.length - 1; + }, o.prototype.eject = function (e) { + this.handlers[e] && (this.handlers[e] = null); + }, o.prototype.forEach = function (e) { + r.forEach(this.handlers, function (t) { + null !== t && e(t); + }); + }, e.exports = o; + }, + function (e, t, n) { + 'use strict'; + var r = n(7), o = n(132), i = n(73), s = n(74); + function a(e) { + e.cancelToken && e.cancelToken.throwIfRequested(); + } + e.exports = function (e) { + return a(e), e.headers = e.headers || {}, e.data = o(e.data, e.headers, e.transformRequest), e.headers = r.merge(e.headers.common || {}, e.headers[e.method] || {}, e.headers), r.forEach([ + 'delete', + 'get', + 'head', + 'post', + 'put', + 'patch', + 'common' + ], function (t) { + delete e.headers[t]; + }), (e.adapter || s.adapter)(e).then(function (t) { + return a(e), t.data = o(t.data, t.headers, e.transformResponse), t; + }, function (t) { + return i(t) || (a(e), t && t.response && (t.response.data = o(t.response.data, t.response.headers, e.transformResponse))), Promise.reject(t); + }); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(7); + e.exports = function (e, t, n) { + return r.forEach(n, function (n) { + e = n(e, t); + }), e; + }; + }, + function (e, t) { + var n, r, o = e.exports = {}; + function i() { + throw new Error('setTimeout has not been defined'); + } + function s() { + throw new Error('clearTimeout has not been defined'); + } + function a(e) { + if (n === setTimeout) + return setTimeout(e, 0); + if ((n === i || !n) && setTimeout) + return n = setTimeout, setTimeout(e, 0); + try { + return n(e, 0); + } catch (t) { + try { + return n.call(null, e, 0); + } catch (t) { + return n.call(this, e, 0); + } + } + } + !function () { + try { + n = 'function' === typeof setTimeout ? setTimeout : i; + } catch (e) { + n = i; + } + try { + r = 'function' === typeof clearTimeout ? clearTimeout : s; + } catch (e) { + r = s; + } + }(); + var c, u = [], p = !1, l = -1; + function d() { + p && c && (p = !1, c.length ? u = c.concat(u) : l = -1, u.length && f()); + } + function f() { + if (!p) { + var e = a(d); + p = !0; + for (var t = u.length; t;) { + for (c = u, u = []; ++l < t;) + c && c[l].run(); + l = -1, t = u.length; + } + c = null, p = !1, function (e) { + if (r === clearTimeout) + return clearTimeout(e); + if ((r === s || !r) && clearTimeout) + return r = clearTimeout, clearTimeout(e); + try { + r(e); + } catch (t) { + try { + return r.call(null, e); + } catch (t) { + return r.call(this, e); + } + } + }(e); + } + } + function h(e, t) { + this.fun = e, this.array = t; + } + function v() { + } + o.nextTick = function (e) { + var t = new Array(arguments.length - 1); + if (arguments.length > 1) + for (var n = 1; n < arguments.length; n++) + t[n - 1] = arguments[n]; + u.push(new h(e, t)), 1 !== u.length || p || a(f); + }, h.prototype.run = function () { + this.fun.apply(null, this.array); + }, o.title = 'browser', o.browser = !0, o.env = {}, o.argv = [], o.version = '', o.versions = {}, o.on = v, o.addListener = v, o.once = v, o.off = v, o.removeListener = v, o.removeAllListeners = v, o.emit = v, o.prependListener = v, o.prependOnceListener = v, o.listeners = function (e) { + return []; + }, o.binding = function (e) { + throw new Error('process.binding is not supported'); + }, o.cwd = function () { + return '/'; + }, o.chdir = function (e) { + throw new Error('process.chdir is not supported'); + }, o.umask = function () { + return 0; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(7); + e.exports = function (e, t) { + r.forEach(e, function (n, r) { + r !== t && r.toUpperCase() === t.toUpperCase() && (e[t] = n, delete e[r]); + }); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(76); + e.exports = function (e, t, n) { + var o = n.config.validateStatus; + !o || o(n.status) ? e(n) : t(r('Request failed with status code ' + n.status, n.config, null, n.request, n)); + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e, t, n, r, o) { + return e.config = t, n && (e.code = n), e.request = r, e.response = o, e.isAxiosError = !0, e.toJSON = function () { + return { + message: this.message, + name: this.name, + description: this.description, + number: this.number, + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + config: this.config, + code: this.code + }; + }, e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(138), o = n(139); + e.exports = function (e, t) { + return e && !r(t) ? o(e, t) : t; + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e) { + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e); + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e, t) { + return t ? e.replace(/\/+$/, '') + '/' + t.replace(/^\/+/, '') : e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(7), o = [ + 'age', + 'authorization', + 'content-length', + 'content-type', + 'etag', + 'expires', + 'from', + 'host', + 'if-modified-since', + 'if-unmodified-since', + 'last-modified', + 'location', + 'max-forwards', + 'proxy-authorization', + 'referer', + 'retry-after', + 'user-agent' + ]; + e.exports = function (e) { + var t, n, i, s = {}; + return e ? (r.forEach(e.split('\n'), function (e) { + if (i = e.indexOf(':'), t = r.trim(e.substr(0, i)).toLowerCase(), n = r.trim(e.substr(i + 1)), t) { + if (s[t] && o.indexOf(t) >= 0) + return; + s[t] = 'set-cookie' === t ? (s[t] ? s[t] : []).concat([n]) : s[t] ? s[t] + ', ' + n : n; + } + }), s) : s; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(7); + e.exports = r.isStandardBrowserEnv() ? function () { + var e, t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement('a'); + function o(e) { + var r = e; + return t && (n.setAttribute('href', r), r = n.href), n.setAttribute('href', r), { + href: n.href, + protocol: n.protocol ? n.protocol.replace(/:$/, '') : '', + host: n.host, + search: n.search ? n.search.replace(/^\?/, '') : '', + hash: n.hash ? n.hash.replace(/^#/, '') : '', + hostname: n.hostname, + port: n.port, + pathname: '/' === n.pathname.charAt(0) ? n.pathname : '/' + n.pathname + }; + } + return e = o(window.location.href), function (t) { + var n = r.isString(t) ? o(t) : t; + return n.protocol === e.protocol && n.host === e.host; + }; + }() : function () { + return !0; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(7); + e.exports = r.isStandardBrowserEnv() ? { + write: function (e, t, n, o, i, s) { + var a = []; + a.push(e + '=' + encodeURIComponent(t)), r.isNumber(n) && a.push('expires=' + new Date(n).toGMTString()), r.isString(o) && a.push('path=' + o), r.isString(i) && a.push('domain=' + i), !0 === s && a.push('secure'), document.cookie = a.join('; '); + }, + read: function (e) { + var t = document.cookie.match(new RegExp('(^|;\\s*)(' + e + ')=([^;]*)')); + return t ? decodeURIComponent(t[3]) : null; + }, + remove: function (e) { + this.write(e, '', Date.now() - 86400000); + } + } : { + write: function () { + }, + read: function () { + return null; + }, + remove: function () { + } + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(78); + function o(e) { + if ('function' !== typeof e) + throw new TypeError('executor must be a function.'); + var t; + this.promise = new Promise(function (e) { + t = e; + }); + var n = this; + e(function (e) { + n.reason || (n.reason = new r(e), t(n.reason)); + }); + } + o.prototype.throwIfRequested = function () { + if (this.reason) + throw this.reason; + }, o.source = function () { + var e; + return { + token: new o(function (t) { + e = t; + }), + cancel: e + }; + }, e.exports = o; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e) { + return function (t) { + return e.apply(null, t); + }; + }; + }, + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + function (e, t, n) { + 'use strict'; + function r(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + function o(e, t) { + var n = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var r = Object.getOwnPropertySymbols(e); + t && (r = r.filter(function (t) { + return Object.getOwnPropertyDescriptor(e, t).enumerable; + })), n.push.apply(n, r); + } + return n; + } + function i(e) { + for (var t = 1; t < arguments.length; t++) { + var n = null != arguments[t] ? arguments[t] : {}; + t % 2 ? o(Object(n), !0).forEach(function (t) { + r(e, t, n[t]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : o(Object(n)).forEach(function (t) { + Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)); + }); + } + return e; + } + n.r(t), n.d(t, 'qcCmpApi', function () { + return Et; + }), n.d(t, 'uspApi', function () { + return St; + }); + var s = n(0), a = n.n(s); + function c(e, t, n, r, o, i, s) { + try { + var a = e[i](s), c = a.value; + } catch (u) { + return void n(u); + } + a.done ? t(c) : Promise.resolve(c).then(r, o); + } + function u(e) { + return function () { + var t = this, n = arguments; + return new Promise(function (r, o) { + var i = e.apply(t, n); + function s(e) { + c(i, r, o, s, a, 'next', e); + } + function a(e) { + c(i, r, o, s, a, 'throw', e); + } + s(void 0); + }); + }; + } + function p(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + function l(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + function d(e, t, n) { + return t && l(e.prototype, t), n && l(e, n), e; + } + var f, h, v, y, g = n(86); + n(66), n(67), n(68); + !function (e) { + e[e.TOP_LEFT = 1] = 'TOP_LEFT', e[e.TOP_RIGHT = 2] = 'TOP_RIGHT', e[e.BOTTOM_RIGHT = 3] = 'BOTTOM_RIGHT', e[e.BOTTOM_LEFT = 4] = 'BOTTOM_LEFT'; + }(f || (f = {})), function (e) { + e.YES = 'Y', e.NOT = 'N'; + }(h || (h = {})), function (e) { + e.SERVICE = 'service', e.SERVICE_GROUP = 'service group'; + }(v || (v = {})), function (e) { + e.GDPR = 'GDPR', e.USP = 'USP'; + }(y || (y = {})); + var m, b, C, _, E, S, I, P, L, w, A, O = { hasCookie: !1 }, k = function e() { + p(this, e), this.vendorConsents = i({}, O), this.purposesConsents = i({}, O), this.specialFeatures = i({}, O), this.vendorLegitimateInterest = i({}, O), this.legitimatePurposesConsents = i({}, O), this.nonIabConsents = i({}, O), this.googleConsents = i({}, O), this.consentScreen = 0, this.allConsents = !1; + }, T = (n(69), { + uspVersion: 1, + uspJurisdiction: [], + uspLspact: h.NOT, + uspPrivacyPolicyLink: '', + uspDeleteDataLink: '', + uspAccessDataLink: '', + cookieDomain: window.location.hostname, + suppressCcpaLinks: !0 + }), V = { + defaultToggleValue: 'off', + displayUi: 'always', + displayPersistentConsentLink: !0, + hashCode: '', + groupSitesUrl: '', + initScreenRejectButtonShowing: !0, + initScreenCloseButtonShowing: !1, + initScreenBodyTextOption: 1, + lang_: 'en', + nonconsentDisplayFrequency: 1, + persistentConsentLinkLocation: f.BOTTOM_RIGHT, + publisherLogo: '', + publisherName: '', + stacks: [], + publisherFeaturesIds: [], + publisherSpecialFeaturesIds: [], + publisherSpecialPurposesIds: [], + publisherPurposeIds: [], + publisherPurposeLegitimateInterestIds: [], + publisherVendorListUrl: '', + publisherCountryCode: 'GB', + vendorPurposeIds: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + vendorPurposeLegitimateInterestIds: [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + vendorSpecialFeaturesIds: [ + 1, + 2 + ], + vendorSpecialPurposesIds: [ + 1, + 2 + ], + vendorFeaturesIds: [ + 1, + 2, + 3 + ], + rejectConsentRedirectUrl: '', + softOptInEnabled: !1, + uiLayout: 'popup', + vendorListUpdateFreq: 30, + consentScopeGroupURL: '', + groupOfWebsitesURL: '', + cookieDomain: window.location.hostname, + cookiePath: '/', + thirdPartyStorageType: 'iframe', + showSummaryView: !0, + googleEnabled: !1, + consentOnSafari: !1, + isAMP: !1, + publisherConsentRestrictionIds: [], + publisherLIRestrictionIds: [] + }, x = { + initScreenCustomLinks: [], + linksTitle: 'Additional Links', + nonIabVendorsLabel: 'Non-IAB Vendors' + }, R = { + uspDnsTitle: 'Do Not Sell My Personal Information', + uspDnsText: [ + '

When you visit this website, we collect personal information such as IP addresses, cookie identifiers and other pseudonymous identifiers. This information may be used to personalize content based on your interests, run and optimize advertising campaigns tailored to you, measure the performance of ads and content, and derive insights about the audiences who engage with ads and content. This information may also be disclosed by us to third parties on the IAB\u2019s List of Downstream Participants that may further disclose it to other third parties. Using personal information as described above is an integral part of how we operate our website, make revenue to support our staff, and generate relevant content for our audience. You can learn more about our data collection and use practices in our Privacy Policy.

', + '

If you wish to opt out of the disclosure of your personal information to third parties by us, please use the below opt out and confirm your selection. Please note that after your opt out request is processed, you may continue seeing interest-based ads based on personal Information utilized by us or personal information disclosed to third parties prior to your opt out. You may separately opt out of the further disclosure of your personal information by third parties on the IAB\u2019s List of Downstream Participants.

' + ], + uspDoNotSellToggleText: 'I want to make a "Do Not Sell My Personal Information" request. Note: this action will make it harder to us to tailor content for you.', + uspPrivacyPolicyLinkText: 'Privacy Policy', + uspDeleteDataLinkText: 'Data Deletion', + uspAccessDataLinkText: 'Data Access', + uspAcceptButton: 'CONFIRM' + }, U = { + initScreenTitle: 'We value your privacy', + agreeButton: 'AGREE', + initScreenRejectButton: 'DISAGREE', + initScreenSettingsButton: 'MORE OPTIONS', + summaryScreenBodyNoRejectService: [ + 'We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.', + ' With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may access more detailed information and change your preferences before consenting or to refuse consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to this website only. You can change your preferences at any time by returning to this site or visit our privacy policy.\n' + ], + summaryScreenBodyNoRejectGroup: [ + 'We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.', + ' With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may access more detailed information and change your preferences before consenting or to refuse consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to a group of websites [hyperlinked to domain where all the properties are listed for this group configuration].You can change your preferences at any time by returning to this site or visit our privacy policy.' + ], + summaryScreenBodyRejectService: [ + 'We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.', + ' With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may click to refuse to consent or access more detailed information and change your preferences before consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to this website only. You can change your preferences at any time by returning to this site or visit our privacy policy.' + ], + summaryScreenBodyRejectGroup: [ + 'We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.', + ' With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may click to refuse to consent or access more detailed information and change your preferences before consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to a group of websites [links to domain where all the properties are listed for this group configuration]. You can change your preferences at any time by returning to this site or visit our privacy policy.' + ], + initScreenBodyService: 'We and our partners store or access information on devices, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for the purposes described below. You may click to consent to our and our partners\u2019 processing for such purposes. Alternatively, you may click to refuse to consent, or access more detailed information and change your preferences before consenting. Your preferences will apply to this website only. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. You can change your preferences at any time by returning to this site or visit our privacy policy.', + initScreenBodyGroup: 'We and our partners store or access information on devices, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for the purposes described below. You may click to consent to our and our partners\u2019 processing for such purposes. Alternatively, you may click to refuse to consent, or access more detailed information and change your preferences before consenting. Your preferences will apply to a group of websites [links to domain where all the properties are listed for this group configuration]. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. You can change your preferences at any time by returning to this site or visit our privacy policy.', + specialPurposesAndFeatures: 'Special Purposes and Features', + saveAndExitButton: 'SAVE & EXIT', + purposeScreenVendorLink: 'PARTNERS', + legitimateInterestLink: 'LEGITIMATE INTEREST ', + specialPurposesLabel: 'Special Purposes', + specialFeaturesLabel: 'Special Features', + featuresLabel: 'Features', + back: 'Back', + onLabel: 'ON', + offLabel: 'OFF', + multiLabel: 'MULTI', + legalDescription: 'Legal Description', + showPartners: 'Show Partners', + hidePartners: 'Hide Partners', + vendorScreenBody: 'Review and set your consent preferences for each partner below. Expand each partner list item for more information to help make your choice. Some personal data is processed without your consent, but you have the right to object.', + privacyPolicyLabel: 'Privacy Policy', + descriptionLabel: 'Vendor Description', + legitimateScreenBody: 'Review and object to processing of personal data without your consent on the basis of a legitimate interest for each purpose and by each partner below. Expand each purpose or partner list item for more information to help make your choice. To object to the special purposes of ensuring security, preventing fraud, and debugging, and technically delivering ads or content click on a partner\'s privacy policy link.', + legitimateInterestPurposesLabel: 'Legitimate Interest Purpose(s)', + legitimateInterestVendorLabel: 'Legitimate Interest Vendors', + legitimateScreenObject: 'OBJECT (translation hint: verb to object)', + legitimateScreenObjected: 'OBJECTED', + legitimateScreenAccept: 'REMOVE OBJECTION', + objectAllButton: 'OBJECT ALL', + persistentConsentLinkLabel: 'Privacy', + nonIabVendorsNotice: 'Vendors who do not participate in the IAB Europe Transparency and Consent Framework and do not adhere to its policies or technical specifications', + googlePartners: 'Google Partners', + cookieMaxAgeLabel: 'Max cookie age', + secondsLabel: 'seconds', + daysLabel: 'days', + storageDisclosureLabel: 'Cookie disclosure' + }, M = { + nonIabVendorListUrl: '', + vendorBlacklist: [], + vendorWhitelist: [], + googleWhitelist: [1] + }, D = { + uxBackgroundColor: '#fff', + uxPrimaryButtonColor: '#206DC5', + uxPrimaryButtonTextColor: '#fff', + uxSecondaryButtonColor: '#fff', + uxSecondaryButtonTextColor: '#206DC5', + uxToogleActiveColor: '#206DC5', + uxLinkColor: '#206DC5', + uxFontColor: '#141e23' + }; + !function (e) { + e.GO_TO_PAGE = 'goToPage', e.PURPOSE = 'purpose', e.LEGITIMATE_PURPOSE = 'legitimatePurpose', e.LEGITIMATE_VENDOR = 'legitimateVendor', e.SPECIAL_FEATURE = 'specialFeature', e.STACK = 'stack', e.PARTIAL_CONSENT = 'partial', e.SAVE_AND_EXIT = 'saveAndExit', e.ACCEPT_ALL = 'acceptAll', e.REJECT_ALL = 'rejectAll', e.ACCEPT_ALL_LEGITIMATE = 'acceptAllLegitimate', e.OBJECT_ALL_LEGITIMATE = 'objectAllLegitimate', e.ACCEPT_ALL_VENDORS = 'acceptAllVendors', e.REJECT_ALL_VENDORS = 'rejectAllVendors', e.ACCEPT_ALL_PURPOSES = 'acceptAllPurposes', e.REJECT_ALL_PURPOSES = 'rejectAllPurposes', e.VENDOR = 'vendor', e.NON_IAB_VENDOR = 'nonIabVendor', e.DISMISS_UI = 'dismissUi', e.START_ON_PAGE = 'startOnPage', e.OPT_OUT_TOGGLE = 'optOutToggle', e.OPT_OUT_CONFIRM = 'optOutConfirm', e.EXPAND_ELEMENT = 'expandElement', e.COLLAPSE_ELEMENT = 'collapseElement', e.GOOGLE = 'googlePartner'; + }(m || (m = {})), function (e) { + e[e.INIT_PAGE = 0] = 'INIT_PAGE', e[e.PURPOSES_PAGE = 1] = 'PURPOSES_PAGE', e[e.VENDORS_PAGE = 2] = 'VENDORS_PAGE', e[e.LEGITIMATE_PAGE = 3] = 'LEGITIMATE_PAGE'; + }(b || (b = {})), function (e) { + e.MANDATORY = 'tcfui:mandatory', e.CHANGE_OF_CONSENT = 'tcfui:changeofconsent', e.CCPA = 'uspui:donotsell'; + }(C || (C = {})), function (e) { + e.FEATURES = 'Features', e.NON_IAB = 'Non IAB', e.PURPOSES = 'Purposes', e.LEGITIMATE_PURPOSES = 'Legitimate Purposes', e.LEGITIMATE_VENDORS = 'Legitimate Vendors', e.SPECIAL_PURPOSES = 'Special Purposes', e.SPECIAL_FEATURES = 'Special Features', e.VENDORS = 'Vendors', e.STACKS = 'Stacks', e.GOOGLE = 'Google'; + }(_ || (_ = {})), function (e) { + e.INIT = 'init', e.NAVIGATION = 'navigation', e.DONE = 'done'; + }(E || (E = {})), function (e) { + e.ACCEPT_ALL = 'All', e.ACCEPT_PARTIAL = 'Partial', e.REJECT = 'Reject'; + }(S || (S = {})), function (e) { + e.NONE_OBJECTED = 'None', e.ALL_OBJECTED = 'All'; + }(I || (I = {})), function (e) { + e.STACKS = 'stacks', e.VENDORS = 'vendors', e.FEATURES = 'features', e.PURPOSES = 'purposes', e.SPECIAL_FEATURES = 'specialFeatures', e.SPECIAL_PURPOSES = 'specialPurposes', e.FLEXIBLE_PURPOSES = 'flexiblePurposes', e.LEGITIMATE_VENDORS = 'legitimateVendors', e.LEGITIMATE_PURPOSES = 'legitimatePurposes', e.UNFILTERED_FEATURES = 'unfilteredFeatures', e.UNFILTERED_PURPOSES = 'unfilteredPurposes', e.UNFILTERED_SPECIAL_FEATURES = 'unfilteredSpecialFeatures', e.UNFILTERED_SPECIAL_PURPOSES = 'unfilteredSpecialPurposes'; + }(P || (P = {})), function (e) { + e.CONSENT_RESPONSE = 'consent-response', e.CONSENT_UI = 'consent-ui'; + }(L || (L = {})), function (e) { + e[e.GDPR = 2] = 'GDPR', e[e.USP = 3] = 'USP'; + }(w || (w = {})), function (e) { + e.ACCEPT = 'accept', e.REJECT = 'reject', e.DISMISS = 'dismiss', e.ENTER_FULLSCREEN = 'enter-fullscreen'; + }(A || (A = {})); + var N = parseInt(''.concat('38')), F = (b.INIT_PAGE, b.PURPOSES_PAGE, b.VENDORS_PAGE, b.LEGITIMATE_PAGE, Number.isNaN(N) ? 1 : N), B = 'CMPList', j = 'euconsent-v2', G = 'noniabvendorconsent', H = 'eupubconsent', q = '_cmpRepromptHash', z = 'usprivacy', J = 'addtl_consent', W = n(70), Y = { + quantcastAccountId: { + type: 'string', + values: '' + }, + consentScope: { + type: 'string', + values: [ + v.SERVICE, + v.SERVICE_GROUP + ] + }, + defaultToggleValue: { + type: 'string', + values: [ + 'on', + 'off' + ] + }, + displayUi: { + type: 'string', + values: [ + 'never', + 'inEU', + 'always' + ] + }, + displayPersistentConsentLink: { + type: 'boolean', + values: '' + }, + groupSitesUrl: { + type: 'string', + values: '' + }, + hashCode: { + type: 'string', + values: '' + }, + initScreenRejectButtonShowing: { + type: 'boolean', + values: '' + }, + initScreenCloseButtonShowing: { + type: 'boolean', + values: '' + }, + isAMP: { + type: 'boolean', + values: '' + }, + initScreenBodyTextOption: { + type: 'number', + values: '' + }, + lang_: { + type: 'string', + values: W + }, + nonconsentDisplayFrequency: { + type: 'number', + values: '' + }, + persistentConsentLinkLocation: { + type: 'number', + values: [ + 1, + 2, + 3, + 4 + ] + }, + publisherLogo: { + type: 'string', + values: '' + }, + publisherName: { + type: 'string', + values: '' + }, + publisherFeaturesIds: { + type: 'array', + values: [ + 1, + 2, + 3 + ] + }, + publisherSpecialFeaturesIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2 + ] + }, + publisherSpecialPurposesIds: { + type: 'array', + values: [ + 1, + 2 + ] + }, + publisherPurposeIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + publisherPurposeLegitimateInterestIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + publisherVendorListUrl: { + type: 'string', + values: '' + }, + publisherCountryCode: { + type: 'string', + values: [ + 'AF', + 'AX', + 'AL', + 'DZ', + 'AS', + 'AD', + 'AO', + 'AI', + 'AQ', + 'AG', + 'AR', + 'AM', + 'AW', + 'AU', + 'AT', + 'AZ', + 'BS', + 'BH', + 'BD', + 'BB', + 'BY', + 'BE', + 'BZ', + 'BJ', + 'BM', + 'BT', + 'BO', + 'BA', + 'BW', + 'BV', + 'BR', + 'IO', + 'BN', + 'BG', + 'BF', + 'BI', + 'KH', + 'CM', + 'CA', + 'CV', + 'KY', + 'CF', + 'TD', + 'CL', + 'CN', + 'CX', + 'CC', + 'CO', + 'KM', + 'CG', + 'CD', + 'CK', + 'CR', + 'CI', + 'HR', + 'CU', + 'CY', + 'CZ', + 'DK', + 'DJ', + 'DM', + 'DO', + 'EC', + 'EG', + 'SV', + 'GQ', + 'ER', + 'EE', + 'ET', + 'FK', + 'FO', + 'FJ', + 'FI', + 'FR', + 'GF', + 'PF', + 'TF', + 'GA', + 'GM', + 'GE', + 'DE', + 'GH', + 'GI', + 'GR', + 'GL', + 'GD', + 'GP', + 'GU', + 'GT', + 'GG', + 'GN', + 'GW', + 'GY', + 'HT', + 'HM', + 'VA', + 'HN', + 'HK', + 'HU', + 'IS', + 'IN', + 'ID', + 'IR', + 'IQ', + 'IE', + 'IM', + 'IL', + 'IT', + 'JM', + 'JP', + 'JE', + 'JO', + 'KZ', + 'KE', + 'KI', + 'KR', + 'KW', + 'KG', + 'LA', + 'LV', + 'LB', + 'LS', + 'LR', + 'LY', + 'LI', + 'LT', + 'LU', + 'MO', + 'MK', + 'MG', + 'MW', + 'MY', + 'MV', + 'ML', + 'MT', + 'MH', + 'MQ', + 'MR', + 'MU', + 'YT', + 'MX', + 'FM', + 'MD', + 'MC', + 'MN', + 'ME', + 'MS', + 'MA', + 'MZ', + 'MM', + 'NA', + 'NR', + 'NP', + 'NL', + 'AN', + 'NC', + 'NZ', + 'NI', + 'NE', + 'NG', + 'NU', + 'NF', + 'MP', + 'NO', + 'OM', + 'PK', + 'PW', + 'PS', + 'PA', + 'PG', + 'PY', + 'PE', + 'PH', + 'PN', + 'PL', + 'PT', + 'PR', + 'QA', + 'RE', + 'RO', + 'RU', + 'RW', + 'BL', + 'SH', + 'KN', + 'LC', + 'MF', + 'PM', + 'VC', + 'WS', + 'SM', + 'ST', + 'SA', + 'SN', + 'RS', + 'SC', + 'SL', + 'SG', + 'SK', + 'SI', + 'SB', + 'SO', + 'ZA', + 'GS', + 'ES', + 'LK', + 'SD', + 'SR', + 'SJ', + 'SZ', + 'SE', + 'CH', + 'SY', + 'TW', + 'TJ', + 'TZ', + 'TH', + 'TL', + 'TG', + 'TK', + 'TO', + 'TT', + 'TN', + 'TR', + 'TM', + 'TC', + 'TV', + 'UG', + 'UA', + 'AE', + 'GB', + 'US', + 'UM', + 'UY', + 'UZ', + 'VU', + 'VE', + 'VN', + 'VG', + 'VI', + 'WF', + 'EH', + 'YE', + 'ZM', + 'ZW' + ] + }, + vendorPurposeIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + vendorPurposeLegitimateInterestIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + vendorSpecialFeaturesIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2 + ] + }, + vendorSpecialPurposesIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2 + ] + }, + vendorFeaturesIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2, + 3 + ] + }, + rejectConsentRedirectUrl: { + type: 'string', + values: '' + }, + stacks: { + type: 'array', + values: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42 + ] + }, + softOptInEnabled: { + type: 'boolean', + values: '' + }, + uiLayout: { + type: 'string', + values: [ + 'popup', + 'banner' + ] + }, + vendorListUpdateFreq: { + type: 'number', + values: '' + }, + consentScopeGroupURL: { + type: 'string', + values: '' + }, + groupOfWebsitesURL: { + type: 'string', + values: '' + }, + cookieDomain: { + type: 'string', + values: '' + }, + cookiePath: { + type: 'string', + values: '' + }, + thirdPartyStorageType: { + type: 'string', + values: [ + 'iframe', + 'api' + ] + }, + showSummaryView: { + type: 'boolean', + values: '' + }, + privacyMode: { + type: 'array', + values: [ + y.GDPR, + y.USP + ] + }, + uspVersion: { + type: 'number', + values: [1] + }, + uspJurisdiction: { + type: 'array', + values: [ + 'US', + 'CA' + ] + }, + uspLspact: { + type: 'string', + values: [ + h.YES, + h.NOT + ] + }, + uspPrivacyPolicyLink: { + type: 'string', + values: '' + }, + uspDeleteDataLink: { + type: 'string', + values: '' + }, + uspAccessDataLink: { + type: 'string', + values: '' + }, + suppressCcpaLinks: { + type: 'boolean', + values: '' + }, + googleEnabled: { + type: 'boolean', + values: '' + }, + publisherConsentRestrictionIds: { + type: 'array', + values: '', + arrayType: 'number' + }, + publisherLIRestrictionIds: { + type: 'array', + values: '', + arrayType: 'number' + }, + consentOnSafari: { + type: 'boolean', + values: '' + } + }, K = { + acceptAll: { type: 'string' }, + initScreenRejectButton: { type: 'string' }, + initScreenSettingsButton: { type: 'string' }, + initScreenTitle: { type: 'string' }, + persistentConsentLinkLabel: { type: 'string' }, + customInitScreenBodyText: { type: 'string' }, + customSecondScreenBodyText: { type: 'string' }, + customVendorScreenBodyText: { type: 'string' }, + customLegitimateScreenBodyText: { type: 'string' }, + summaryScreenBodyNoRejectService: { + type: 'array', + values: '' + }, + summaryScreenBodyTextNoReject: { + type: 'array', + values: '' + }, + summaryScreenBodyTextNoRejectGroup: { + type: 'array', + values: '' + }, + summaryScreenBodyTextReject: { + type: 'array', + values: '' + }, + summaryScreenBodyTextRejectGroup: { + type: 'array', + values: '' + }, + summaryScreenBodyNoRejectGroup: { + type: 'array', + values: '' + }, + summaryScreenBodyRejectService: { + type: 'array', + values: '' + }, + summaryScreenBodyRejectGroup: { + type: 'array', + values: '' + }, + groupOfSitesLabel: { type: 'string' }, + saveAndExitButton: { type: 'string' }, + agreeToSelectedButton: { type: 'string' }, + agreeButton: { type: 'string' }, + agreeAllButton: { type: 'string' }, + rejectAll: { type: 'string' }, + objectAllButton: { type: 'string' } + }, Q = { + nonIabVendorListUrl: { + type: 'string', + values: '' + }, + vendorWhitelist: { + type: 'array', + values: '', + arrayType: 'number' + }, + vendorBlacklist: { + type: 'array', + values: '', + arrayType: 'number' + }, + googleWhitelist: { + type: 'array', + values: '', + arrayType: 'number' + } + }, Z = { + initScreenCustomLinks: { + type: 'array', + values: '', + arrayType: 'object' + }, + linksTitle: { type: 'string' }, + nonIabVendorsLabel: { type: 'string' }, + uspDnsTitle: { type: 'string' }, + uspDnsText: { + type: 'array', + values: '', + arrayType: 'string' + }, + uspDoNotSellToggleText: { type: 'string' }, + uspPrivacyPolicyLinkText: { type: 'string' }, + uspDeleteDataLinkText: { type: 'string' }, + uspAccessDataLinkText: { type: 'string' }, + uspAcceptButton: { type: 'string' } + }, X = { + uxBackgroundColor: { + type: 'string', + values: '' + }, + uxPrimaryButtonColor: { + type: 'string', + values: '' + }, + uxPrimaryButtonTextColor: { + type: 'string', + values: '' + }, + uxSecondaryButtonColor: { + type: 'string', + values: '' + }, + uxSecondaryButtonTextColor: { + type: 'string', + values: '' + }, + uxToogleActiveColor: { + type: 'string', + values: '' + }, + uxLinkColor: { + type: 'string', + values: '' + }, + uxFontColor: { + type: 'string', + values: '' + } + }, $ = { + nonIabVendorList: { + type: 'array', + values: '', + arrayType: 'object' + }, + updateAt: { + type: 'string', + values: '' + }, + nonIabVendorsHash: { + type: 'string', + values: '' + } + }, ee = function (e, t, n) { + if (t in n) { + var r = e[t], o = n[t].type, i = n[t].values; + return '' !== r && (typeof r === o ? 'number' === o && r < 0 ? (console.warn(''.concat(t, ' must be a valid number')), !1) : '' === i || (!!i.includes(r) || (console.warn(''.concat(t, ' must be a valid value')), !1)) : (console.warn(''.concat(t, ' must be ').concat(o)), !1)); + } + return console.warn(''.concat(t, ' is not a valid config value')), !1; + }, te = function (e, t, n) { + var r = e[t]; + if (Array.isArray(r)) { + if (!r.length) + return !0 === n[t].canBeEmpty && r; + var o = []; + return r.forEach(function (e) { + 'string' === typeof n[t].values ? typeof e === n[t].arrayType ? o.push(e) : console.warn(''.concat(e, ' ').concat('is not a valid value for', ' ').concat(t)) : n[t].values.includes(e) ? o.push(e) : console.warn(''.concat(e, ' ').concat('is not a valid value for', ' ').concat(t)); + }), !!o.length && o; + } + return console.warn(''.concat(t, ' must be an array')), !1; + }, ne = function () { + function e(t) { + var n = this; + p(this, e), this._coreConfig = void 0, this._premiumProperties = void 0, this._coreUiLabels = void 0, this._premiumUiLabels = void 0, this._theme = void 0, this._nonIabVendorsInfo = void 0, this._ampData = void 0, this.cleanConfig = void 0, this.checkRequiredValues = function () { + var e = n.cleanConfig.coreConfig; + 'consentScope' in e || (n.cleanConfig.coreConfig.consentScope = v.SERVICE), 'privacyMode' in e || (n.cleanConfig.coreConfig.privacyMode = [y.GDPR]); + }, this.validateConfig = function (e) { + var t = {}, r = {}, o = {}, i = {}, s = {}, a = void 0, c = void 0; + return e.coreConfig && (t = n.filterConfig(e.coreConfig, Y)), e.coreUiLabels && (r = n.filterLabels(e.coreUiLabels, K)), e.premiumProperties && (o = n.filterConfig(e.premiumProperties, Q)), e.premiumUiLabels && (i = n.filterLabels(e.premiumUiLabels, Z)), e.theme && (s = n.filterConfig(e.theme, X)), e.nonIabVendorsInfo && (a = n.filterConfig(e.nonIabVendorsInfo, $)), e.ampData && (c = e.ampData), { + coreConfig: t, + coreUiLabels: r, + premiumProperties: o, + premiumUiLabels: i, + theme: s, + nonIabVendorsInfo: a, + ampData: c + }; + }, this.filterConfig = function (e, t) { + var n = {}; + for (var r in e) + if (r in t) + if ('array' === t[r].type) { + var o = te(e, r, t); + o && (n[r] = o); + } else + ee(e, r, t) && (n[r] = e[r]); + return n; + }, this.filterLabels = function (e, t) { + var n = {}; + for (var r in e) + if (r in t) + if ('string' === t[r].type) + '' !== e[r] ? n[r] = e[r] : console.warn(''.concat(r, ' cannot be empty')); + else { + var o = te(e, r, t); + o && (n[r] = o); + } + return n; + }, this.getCustomCoreUiLabels = function () { + return n.cleanConfig.coreUiLabels; + }, this.initializeConfig = function () { + Object.keys(n.cleanConfig).forEach(function (e) { + n[e] && (n[e] = i(i({}, n[e]), n.cleanConfig[e])); + }); + }, this.cleanConfig = this.validateConfig(t), this.checkRequiredValues(); + var r = this.cleanConfig, o = r.coreConfig, s = o.privacyMode, a = o.consentScope, c = o.quantcastAccountId, u = r.nonIabVendorsInfo, l = r.ampData; + s.includes(y.GDPR) && s.includes(y.USP) ? (this._coreConfig = i(i({ + quantcastAccountId: c, + consentScope: a, + privacyMode: s + }, V), T), this._premiumUiLabels = i(i({}, R), x), this._premiumProperties = i({}, M), this._coreUiLabels = i({}, U), this._theme = i({}, D), u && (this._nonIabVendorsInfo = u)) : s.includes('GDPR') ? (this._coreConfig = i({ + quantcastAccountId: c, + consentScope: a, + privacyMode: s + }, V), this._premiumUiLabels = i({}, x), this._premiumProperties = i({}, M), this._coreUiLabels = i({}, U), this._theme = i({}, D), u && (this._nonIabVendorsInfo = u)) : (this._coreConfig = i({ + quantcastAccountId: c, + consentScope: a, + privacyMode: s + }, T), this._premiumUiLabels = i({}, R), this._premiumProperties = {}, this._coreUiLabels = {}, this._theme = i({}, D)), l && (this._ampData = l); + } + return d(e, [ + { + key: 'getCustomPremiumUiLabels', + value: function () { + return this.cleanConfig.premiumUiLabels; + } + }, + { + key: 'coreConfig', + get: function () { + return this._coreConfig; + }, + set: function (e) { + var t = this, n = [ + 'publisherLogo', + 'publisherName', + 'publisherFeaturesIds', + 'publisherSpecialFeaturesIds', + 'publisherSpecialPurposesIds', + 'publisherPurposeIds', + 'publisherPurposeLegitimateInterestIds', + 'publisherVendorListUrl', + 'publisherVendorListUrl', + 'publisherCountryCode', + 'vendorPurposeIds', + 'vendorPurposeLegitimateInterestIds', + 'vendorSpecialFeaturesIds', + 'vendorSpecialPurposesIds', + 'vendorFeaturesIds', + 'rejectConsentRedirectUrl', + 'stacks' + ], r = [ + 'nonconsentDisplayFrequency', + 'vendorListUpdateFreq' + ]; + Object.keys(e).forEach(function (o) { + if (e[o] !== t.coreConfig[o]) { + if (-1 !== n.indexOf(o) && ('' === e[o] || e[o] === [])) + throw new Error(''.concat(o, ' cannot be empty')); + if (r.indexOf(o) && e[o] < 0) + throw new Error(''.concat(o, ' cannot be a negative number')); + } + }), this._coreConfig = e; + } + }, + { + key: 'premiumProperties', + get: function () { + return this._premiumProperties; + }, + set: function (e) { + var t = this; + Object.keys(e).forEach(function (n) { + if (t.premiumProperties[n] !== e[n] && ('' === e[n] || e[n] === [])) + throw new Error(''.concat(n, ' cannot be empty')); + }), this._premiumProperties = e; + } + }, + { + key: 'coreUiLabels', + get: function () { + return this._coreUiLabels; + }, + set: function (e) { + var t = this; + Object.keys(e).forEach(function (n) { + if (t.coreUiLabels[n] !== e[n] && '' === e[n]) + throw new Error(''.concat(n, ' cannot be empty')); + }), this._coreUiLabels = e; + } + }, + { + key: 'theme', + get: function () { + return this._theme; + }, + set: function (e) { + var t = this; + Object.keys(e).forEach(function (n) { + if (t.theme[n] !== e[n] && '' === e[n]) + throw new Error(''.concat(n, ' cannot be empty')); + }), this._theme = e; + } + }, + { + key: 'nonIabVendorsInfo', + get: function () { + return this._nonIabVendorsInfo; + }, + set: function (e) { + this._nonIabVendorsInfo = e; + } + }, + { + key: 'ampData', + get: function () { + return this._ampData; + }, + set: function (e) { + this._ampData = e; + } + }, + { + key: 'premiumUiLabels', + get: function () { + return this._premiumUiLabels; + }, + set: function (e) { + var t = this; + Object.keys(e).forEach(function (n) { + if (t.premiumUiLabels[n] !== e[n] && !e[n].length) + throw new Error(''.concat(n, ' cannot be empty')); + }), this._premiumUiLabels = e; + } + } + ]), e; + }(), re = n(19), oe = n(33), ie = n(70), se = function () { + function e() { + var t = this; + p(this, e), this.__tcfapiui = void 0, this.__tcfapiui = function (e) { + for (var n = t.__tcfapiui.a = t.__tcfapiui.a || [], r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++) + o[i - 1] = arguments[i]; + n.push([e].concat(o)); + }, window.__tcfapiui || (window.__tcfapiui = this.__tcfapiui); + } + return d(e, [{ + key: 'displayUi', + value: function () { + var t = u(a.a.mark(function t(n) { + var r, o, i, s, c, u, p = arguments; + return a.a.wrap(function (t) { + for (;;) + switch (t.prev = t.next) { + case 0: + if (o = p.length > 1 && void 0 !== p[1] ? p[1] : b.PURPOSES_PAGE, i = p.length > 2 && void 0 !== p[2] && p[2], e.createUiScriptBlock(), s = null === (r = Fe.coreConfig.privacyMode) || void 0 === r ? void 0 : r.includes(n), Ne.updateApiVisible(n, s), s) { + t.next = 8; + break; + } + return console.warn('attempt to show disabled CMP UI regulation='.concat(n)), t.abrupt('return'); + case 8: + if (!(c = 'GDPR' === n) || We) { + t.next = 12; + break; + } + return t.next = 12, Ye(!0); + case 12: + if (t.t0 = n, t.t1 = o, t.t2 = i, t.t3 = Fe, t.t4 = c ? Ne.loadGVL() : void 0, !c) { + t.next = 23; + break; + } + return t.next = 20, Ne.getConsents(); + case 20: + t.t5 = t.sent, t.next = 24; + break; + case 23: + t.t5 = {}; + case 24: + t.t6 = t.t5, t.t7 = c ? He.data.data.nonIabVendorList : {}, t.t8 = c ? Ke.fetchPartners() : void 0, u = { + regulation: t.t0, + page: t.t1, + isMandatory: t.t2, + config: t.t3, + gvl: t.t4, + consentInfo: t.t6, + nonIabVendorList: t.t7, + googleData: t.t8 + }, window.__tcfapiui('displayUi', u); + case 29: + case 'end': + return t.stop(); + } + }, t); + })); + return function (e) { + return t.apply(this, arguments); + }; + }() + }], [{ + key: 'createUiScriptBlock', + value: function () { + var e = window.document; + if (!e.getElementById('__tcfapiuiscript')) { + var t = document.createElement('script'), n = (Fe.coreConfig.lang_ || 'en').toLowerCase(); + ie.includes(n) || (n = 'en'); + var r = 'https://quantcast.mgr.consensu.org/tcfv2/38/cmp2ui.js'; + r = r.replace('.js', '-'.concat(n, '.js')), t.type = 'text/javascript', t.id = '__tcfapiuiscript', t.src = r, e.head.appendChild(t); + } + } + }]), e; + }(), ae = n(87), ce = n.n(ae).a.create({ xsrfCookieName: null }), ue = function (e) { + Object({ + NODE_ENV: 'production', + PUBLIC_URL: '', + AMP_FRAME_URL_BASE: 'https://quantcast.mgr.consensu.org/tcfv2/38', + AMP_CHECK_CONSENT_URL: 'https://apis.quantcast.mgr.consensu.org/amp/check-consent', + LOCAL_STATIC_DIR: '', + REACT_APP_LOG_API: 'https://audit-tcfv2.quantcast.mgr.consensu.org', + REACT_APP_GEOIP_API_URL: 'https://apis.quantcast.mgr.consensu.org/geoip', + REACT_APP_GOOGLE_ATP_URL: 'https://quantcast.mgr.consensu.org/tcfv2/google-atp-list.json', + REACT_APP_VERSION: '38', + REACT_APP_CMPUI_SRC: 'https://quantcast.mgr.consensu.org/tcfv2/38/cmp2ui.js', + REACT_APP_GVL_BASE_URL: 'https://quantcast.mgr.consensu.org/GVL-v2/', + REACT_APP_TRANSLATION_BASE_URL: 'https://www.quantcast.mgr.consensu.org/tcfv2/translations/' + }).REACT_APP_DEBUG && console.log('Debug: ' + e); + }, pe = function () { + function e(t) { + switch (p(this, e), this._isUserInEU = void 0, this._isUserInUS = void 0, this._userSpecificLocation = void 0, this._userSpecificLocation = null, t) { + case 'inUS': + this._isUserInEU = false, this._isUserInUS = true; + break; + case 'inEU': + this._isUserInEU = false, this._isUserInUS = true; + break; + default: + this._isUserInEU = false, this._isUserInUS = true; + } + } + return d(e, [ + { + key: 'checkSpecificLocation', + value: function () { + var e = u(a.a.mark(function e() { + var t, n, r; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Fe.coreConfig.privacyMode, this._userSpecificLocation) { + e.next = 23; + break; + } + if (ue('initUspLocation: exact location request'), !t.includes('USP')) { + e.next = 23; + break; + } + if (n = Fe.coreConfig.uspJurisdiction, !this.isUserInUS) { + e.next = 22; + break; + } + if (n.includes('US')) { + e.next = 19; + break; + } + return e.prev = 7, e.next = 10, ce.get('https://apis.quantcast.mgr.consensu.org/geoip'); + case 10: + r = e.sent, this._userSpecificLocation = r.data, e.next = 17; + break; + case 14: + e.prev = 14, e.t0 = e.catch(7), console.log(e.t0); + case 17: + e.next = 20; + break; + case 19: + this._userSpecificLocation = 'US'; + case 20: + e.next = 23; + break; + case 22: + this._userSpecificLocation = 'non-US'; + case 23: + return e.abrupt('return', this._userSpecificLocation); + case 24: + case 'end': + return e.stop(); + } + }, e, this, [[ + 7, + 14 + ]]); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'isUserInEU', + set: function (e) { + ue('this should only be used for testing'), this._isUserInEU = e; + }, + get: function () { + return this._isUserInEU; + } + }, + { + key: 'isUserInUS', + set: function (e) { + ue('this should only be used for testing'), this._isUserInUS = e; + }, + get: function () { + return this._isUserInUS; + } + }, + { + key: 'userSpecificLocation', + set: function (e) { + ue('this should only be used for testing'), this._userSpecificLocation = e; + }, + get: function () { + return this._userSpecificLocation; + } + } + ]), e; + }(); + function le(e) { + return function (e, t) { + return de = '', fe(t).dispatch(e), function (e) { + return btoa(function (e) { + for (var t = '', n = 0; n < e.length; n++) + for (var r = e[n], o = 0; o < 4; o++) + t += String.fromCharCode(r >> 8 * o & 255); + return t; + }(function (e) { + var t, n = e.length, r = [ + 1732584193, + -271733879, + -1732584194, + 271733878 + ]; + for (t = 64; t <= e.length; t += 64) + he(r, Ce(e.substring(t - 64, t))); + e = e.substring(t - 64); + var o = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ]; + for (t = 0; t < e.length; t++) + o[t >> 2] |= e.charCodeAt(t) << (t % 4 << 3); + if (o[t >> 2] |= 128 << (t % 4 << 3), t > 55) + for (he(r, o), t = 0; t < 16; t++) + o[t] = 0; + return o[14] = 8 * n, he(r, o), r; + }(e))); + }(de); + }(e); + } + var de = ''; + function fe(e, t, n) { + n = n || []; + var r = function (e) { + de += e; + }; + return { + dispatch: function (e) { + var t = typeof e; + return null === e && (t = 'null'), this['_' + t](e); + }, + _object: function (e) { + var t = Object.prototype.toString.call(e), o = /\[object (.*)\]/i.exec(t); + o = (o = o ? o[1] : 'unknown:[' + t + ']').toLowerCase(); + var i; + if ((i = n.indexOf(e)) >= 0) + return this.dispatch('[CIRCULAR:' + i + ']'); + if (n.push(e), 'object' === o || 'function' === o || 'asyncfunction' === o) { + var s = Object.keys(e); + r('object:' + s.length + ':'); + var a = this; + return s.forEach(function (t) { + a.dispatch(t), r(':'), a.dispatch(e[t]), r(','); + }); + } + if (!this['_' + o]) + throw new Error('Unknown object type "' + o + '"'); + this['_' + o](e); + }, + _array: function (e) { + var t = this; + return r('array:' + e.length + ':'), e.forEach(function (e) { + return t.dispatch(e); + }); + }, + _date: function (e) { + return r('date:' + e.toJSON()); + }, + _symbol: function (e) { + return r('symbol:' + e.toString()); + }, + _error: function (e) { + return r('error:' + e.toString()); + }, + _boolean: function (e) { + return r('bool:' + e.toString()); + }, + _string: function (e) { + r('string:' + e.length + ':'), r(e.toString()); + }, + _function: function (e) { + r('fn:'), this.dispatch(e.toString()); + }, + _number: function (e) { + return r('number:' + e.toString()); + }, + _xml: function (e) { + return r('xml:' + e.toString()); + }, + _null: function () { + return r('Null'); + }, + _undefined: function () { + return r('Undefined'); + }, + _regexp: function (e) { + return r('regex:' + e.toString()); + }, + _uint8array: function (e) { + return r('uint8array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _uint8clampedarray: function (e) { + return r('uint8clampedarray:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _int8array: function (e) { + return r('uint8array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _uint16array: function (e) { + return r('uint16array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _int16array: function (e) { + return r('uint16array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _uint32array: function (e) { + return r('uint32array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _int32array: function (e) { + return r('uint32array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _float32array: function (e) { + return r('float32array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _float64array: function (e) { + return r('float64array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _arraybuffer: function (e) { + return r('arraybuffer:'), this.dispatch(new Uint8Array(e)); + }, + _url: function (e) { + return r('url:' + e.toString()); + }, + _map: function (e) { + r('map:'); + var t = Array.from(e); + return this._array(t); + }, + _set: function (e) { + r('set:'); + var t = Array.from(e); + return this._array(t); + } + }; + } + function he(e, t) { + var n = e[0], r = e[1], o = e[2], i = e[3]; + n = ye(n, r, o, i, t[0], 7, -680876936), i = ye(i, n, r, o, t[1], 12, -389564586), o = ye(o, i, n, r, t[2], 17, 606105819), r = ye(r, o, i, n, t[3], 22, -1044525330), n = ye(n, r, o, i, t[4], 7, -176418897), i = ye(i, n, r, o, t[5], 12, 1200080426), o = ye(o, i, n, r, t[6], 17, -1473231341), r = ye(r, o, i, n, t[7], 22, -45705983), n = ye(n, r, o, i, t[8], 7, 1770035416), i = ye(i, n, r, o, t[9], 12, -1958414417), o = ye(o, i, n, r, t[10], 17, -42063), r = ye(r, o, i, n, t[11], 22, -1990404162), n = ye(n, r, o, i, t[12], 7, 1804603682), i = ye(i, n, r, o, t[13], 12, -40341101), o = ye(o, i, n, r, t[14], 17, -1502002290), n = ge(n, r = ye(r, o, i, n, t[15], 22, 1236535329), o, i, t[1], 5, -165796510), i = ge(i, n, r, o, t[6], 9, -1069501632), o = ge(o, i, n, r, t[11], 14, 643717713), r = ge(r, o, i, n, t[0], 20, -373897302), n = ge(n, r, o, i, t[5], 5, -701558691), i = ge(i, n, r, o, t[10], 9, 38016083), o = ge(o, i, n, r, t[15], 14, -660478335), r = ge(r, o, i, n, t[4], 20, -405537848), n = ge(n, r, o, i, t[9], 5, 568446438), i = ge(i, n, r, o, t[14], 9, -1019803690), o = ge(o, i, n, r, t[3], 14, -187363961), r = ge(r, o, i, n, t[8], 20, 1163531501), n = ge(n, r, o, i, t[13], 5, -1444681467), i = ge(i, n, r, o, t[2], 9, -51403784), o = ge(o, i, n, r, t[7], 14, 1735328473), n = me(n, r = ge(r, o, i, n, t[12], 20, -1926607734), o, i, t[5], 4, -378558), i = me(i, n, r, o, t[8], 11, -2022574463), o = me(o, i, n, r, t[11], 16, 1839030562), r = me(r, o, i, n, t[14], 23, -35309556), n = me(n, r, o, i, t[1], 4, -1530992060), i = me(i, n, r, o, t[4], 11, 1272893353), o = me(o, i, n, r, t[7], 16, -155497632), r = me(r, o, i, n, t[10], 23, -1094730640), n = me(n, r, o, i, t[13], 4, 681279174), i = me(i, n, r, o, t[0], 11, -358537222), o = me(o, i, n, r, t[3], 16, -722521979), r = me(r, o, i, n, t[6], 23, 76029189), n = me(n, r, o, i, t[9], 4, -640364487), i = me(i, n, r, o, t[12], 11, -421815835), o = me(o, i, n, r, t[15], 16, 530742520), n = be(n, r = me(r, o, i, n, t[2], 23, -995338651), o, i, t[0], 6, -198630844), i = be(i, n, r, o, t[7], 10, 1126891415), o = be(o, i, n, r, t[14], 15, -1416354905), r = be(r, o, i, n, t[5], 21, -57434055), n = be(n, r, o, i, t[12], 6, 1700485571), i = be(i, n, r, o, t[3], 10, -1894986606), o = be(o, i, n, r, t[10], 15, -1051523), r = be(r, o, i, n, t[1], 21, -2054922799), n = be(n, r, o, i, t[8], 6, 1873313359), i = be(i, n, r, o, t[15], 10, -30611744), o = be(o, i, n, r, t[6], 15, -1560198380), r = be(r, o, i, n, t[13], 21, 1309151649), n = be(n, r, o, i, t[4], 6, -145523070), i = be(i, n, r, o, t[11], 10, -1120210379), o = be(o, i, n, r, t[2], 15, 718787259), r = be(r, o, i, n, t[9], 21, -343485551), e[0] = _e(n, e[0]), e[1] = _e(r, e[1]), e[2] = _e(o, e[2]), e[3] = _e(i, e[3]); + } + function ve(e, t, n, r, o, i) { + return t = _e(_e(t, e), _e(r, i)), _e(t << o | t >>> 32 - o, n); + } + function ye(e, t, n, r, o, i, s) { + return ve(t & n | ~t & r, e, t, o, i, s); + } + function ge(e, t, n, r, o, i, s) { + return ve(t & r | n & ~r, e, t, o, i, s); + } + function me(e, t, n, r, o, i, s) { + return ve(t ^ n ^ r, e, t, o, i, s); + } + function be(e, t, n, r, o, i, s) { + return ve(n ^ (t | ~r), e, t, o, i, s); + } + function Ce(e) { + var t, n = []; + for (t = 0; t < 64; t += 4) + n[t >> 2] = e.charCodeAt(t) + (e.charCodeAt(t + 1) << 8) + (e.charCodeAt(t + 2) << 16) + (e.charCodeAt(t + 3) << 24); + return n; + } + function _e(e, t) { + return e + t & 4294967295; + } + var Ee = function () { + function e() { + p(this, e), this._values = void 0, this._values = { + euconsent: '', + nonIabVendorConsent: '', + nonIabVendorsHash: '', + fetched: !1, + promise: Promise.resolve() + }; + } + return d(e, [{ + key: 'values', + set: function (e) { + this._values = e; + }, + get: function () { + return this._values; + } + }]), e; + }(); + function Se(e, t, n, r) { + var o = n && document.getElementById(n); + return o || (o = document.createElement(e), t && (o.className = t), n && (o.id = n), r && r.insertBefore(o, r.firstChild)), o.setAttribute('data-nosnippet', ''), o; + } + var Ie = function (e) { + var t = e.coreConfig, n = t.publisherFeaturesIds, r = t.publisherSpecialFeaturesIds, o = t.publisherSpecialPurposesIds, i = t.publisherPurposeIds, s = t.publisherPurposeLegitimateInterestIds, a = t.vendorPurposeIds, c = t.vendorPurposeLegitimateInterestIds, u = t.vendorSpecialFeaturesIds, p = t.vendorSpecialPurposesIds, l = t.vendorFeaturesIds, d = [ + n, + r, + o, + i, + s, + a, + c, + u, + p, + l + ], f = (a || []).length; + return d.forEach(function (e) { + var t; + (t = e) && t.sort(function (e, t) { + return e - t; + }); + }), { + purposeIds: (f ? a : i) || [], + purposeLegitimateInterestIds: (f ? c : s) || [], + specialFeaturesIds: (f ? u : r) || [], + specialPurposesIds: (f ? p : o) || [], + featuresIds: (f ? l : n) || [] + }; + }, Pe = function (e) { + var t, n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = ''.concat(e[0], '~'), o = e.match(/\d+/g); + if (o.shift(), n) + return ''.concat(r).concat(null === o || void 0 === o ? void 0 : o.join('.')); + var i = null === o || void 0 === o ? void 0 : o.reduce(function (e, n, r, o) { + if (0 === r) + return t = parseInt(n, 10), e.concat(n); + var i = o[r] ? parseInt(n, 10) + t : null; + return t = i, i ? e.concat('.'.concat(i)) : e; + }, r); + return i; + }; + function Le(e, t) { + return t && 'string' === typeof t ? e(t) : null; + } + var we = function () { + function e() { + p(this, e), this.data = void 0, this._repromptOptionsHash = void 0, this._storedHash = void 0, this.data = new Ee(), this._repromptOptionsHash = '', this._storedHash = ''; + } + return d(e, [ + { + key: 'shouldReprompt', + value: function () { + var e = this.generateRepromptOptionsHash(), t = this._storedHash, n = !1; + return '*' !== t && t !== e && (n = !0), n; + } + }, + { + key: 'generateRepromptOptionsHash', + value: function () { + var e = this.data.values, t = e.euconsent, n = e.nonIabVendorConsent, r = e.nonIabVendorsHash, o = Fe.coreConfig, i = o.stacks, s = o.initScreenBodyTextOption, a = Fe.premiumProperties, c = a.vendorWhitelist, u = a.vendorBlacklist, p = Ie(Fe), l = p.purposeIds, d = p.purposeLegitimateInterestIds, f = p.specialFeaturesIds, h = p.specialPurposesIds, v = p.featuresIds, y = this.createNewHash([ + i, + l, + d, + f, + h, + v, + c, + u + ]), g = t; + return g = ''.concat(g, '.').concat(s, '.').concat(y), g = n ? ''.concat(g, '.').concat(n) : g, g = r ? ''.concat(g, '.').concat(r) : g, this._repromptOptionsHash = g; + } + }, + { + key: 'createNewHash', + value: function (e) { + return le(e); + } + }, + { + key: 'setValues', + value: function (e) { + this.data.values = e; + } + }, + { + key: 'getValues', + value: function () { + return this.data.values; + } + }, + { + key: 'storedHash', + set: function (e) { + this._storedHash = e; + }, + get: function () { + return this._storedHash; + } + } + ]), e; + }(), Ae = n(21), Oe = function () { + function e() { + p(this, e), this.LOWERCASE_START = 97, this.PAD_ZEROS = '00000000000000000000000000000000000000000000000000', this.COOKIE_MAX_AGE = 33696000, this.bitSizes = { + cmpId: 12, + created: 36, + consentScreen: 6, + consentLanguage: 12, + cmpVersion: 12, + cmpVersionOld: 6, + consentValue: 1, + defaultConsent: 1, + endVendorId: 16, + encodingType: 1, + isRange: 1, + lastUpdated: 36, + maxVendorId: 16, + numberCustomPurposes: 6, + numEntries: 12, + publisherPurposesVersion: 12, + purposesAlowed: 24, + standardPurposesAllowed: 24, + startVendorId: 16, + version: 6, + vendorListVersion: 12 + }, this._binaryStr = void 0, this._bitPosition = void 0, this.TCString = void 0, this._binaryStr = '', this._bitPosition = 0, this.TCString = new Ae.TCString(); + } + return d(e, [ + { + key: 'encode', + value: function (e, t) { + var n, r; + switch (e.cookieName) { + case G: + n = dt([ + 'cookieName', + 'created', + 'lastUpdated', + 'cmpId', + 'cmpVersion', + 'maxVendorId', + 'vendorConsents' + ], e), r = 'nonIabVendorToBinary'; + break; + case H: + n = dt([ + 'cookieName', + 'publisherPurposesVersion', + 'standardPurposesAllowed', + 'numberCustomPurposes', + 'version', + 'created', + 'lastUpdated', + 'cmpId', + 'cmpVersion', + 'consentScreen', + 'consentLanguage', + 'vendorListVersion', + 'customPurposeConsents' + ], e), r = 'publisherConsentToBinary'; + break; + case j: + n = dt([ + 'cookieName', + 'vendorConsents', + 'purposeConsents', + 'specialFeatureOptins', + 'purposeLegitimateInterests', + 'vendorLegitimateInterests', + 'purposeLegitimateInterests', + 'publisherConsent', + 'publisherLegitimate', + 'publisherPurposeIds', + 'publisherPurposeLegitimateInterestIds' + ], e), r = 'encodeEuConsent'; + break; + case J: + n = dt([ + 'cookieName', + 'vendorConsents', + 'version' + ], e), r = 'encodeGoogleConsent'; + } + if (r && n) { + if (n.notFound) + return new Error(''.concat(n.notFound, ' keys not found')); + if (r.includes('ToBinary')) { + var o = this[r]({ + verifiedObject: n, + metadataOnly: t + }), i = this.binaryToBytes(o); + return this.toWebSafeBase64(i); + } + return this[r](n); + } + return new Error('Invalid cookie name'); + } + }, + { + key: 'decode', + value: function (e, t) { + var n = ''; + switch (e) { + case G: + n = 'decodeNonIabVendorBinary'; + break; + case H: + n = 'decodePublisherBinary'; + break; + case j: + n = 'decodeEuConsent'; + break; + case J: + n = 'decodeGoogleConsent'; + } + if (n) { + if (n.includes('Binary')) { + var r = this.fromWebSafeBase64(t), o = this.bytesToBinary(r); + return this[n](o); + } + return this[n](t); + } + return new Error('Invalid cookie name'); + } + }, + { + key: 'addBinaryField', + value: function (e, t, n) { + var r = (e || 0).toString(2); + if (!(r.length <= t)) + throw new Error('Encountered an overflow setting cookie field '.concat(n)); + r = this.PAD_ZEROS.substr(0, t - r.length) + r, this.binaryStr += r; + } + }, + { + key: 'encodeGoogleConsent', + value: function (e) { + var t = ''.concat(e.version, '~'); + return Fe.coreConfig.isAMP ? ''.concat(t).concat(e.vendorConsents.join('.')) : e.vendorConsents.reduce(function (e, t, n, r) { + if (0 === n) + return e.concat(t); + var o = r[n] ? t - r[n - 1] : null; + return o ? e.concat('.'.concat(o)) : e; + }, t); + } + }, + { + key: 'decodeGoogleConsent', + value: function (e) { + var t, n = null === (t = Pe(e, Fe.coreConfig.isAMP).match(/\d+/g)) || void 0 === t ? void 0 : t.map(function (e) { + return parseInt(e, 10); + }); + return { + version: null === n || void 0 === n ? void 0 : n.shift(), + consentIds: n + }; + } + }, + { + key: 'encodeEuConsent', + value: function (e) { + var t = i({}, e.vendorConsents), n = i({}, e.vendorLegitimateInterests); + e.vendorConsents = t, e.vendorLegitimateInterests = n; + var o = function (t) { + for (var n in e[t]) + e[t][n] ? We[t].set(parseInt(n)) : We[t].unset(parseInt(n)); + }; + return [ + { + value: e.publisherConsent, + tcModelName: 'publisherConsents', + reduceArray: e.publisherPurposeIds + }, + { + value: e.publisherLegitimate, + tcModelName: 'publisherLegitimateInterests', + reduceArray: e.publisherPurposeLegitimateInterestIds + } + ].forEach(function (t) { + void 0 !== t.value && (e[t.tcModelName] = t.reduceArray.reduce(function (e, n) { + return i(i({}, e), {}, r({}, n, t.value)); + }, {})); + }), o('vendorConsents'), o('purposeConsents'), o('specialFeatureOptins'), o('vendorLegitimateInterests'), o('purposeLegitimateInterests'), o('publisherConsents'), o('publisherLegitimateInterests'), yt(We); + } + }, + { + key: 'decodeEuConsent', + value: function (e) { + return gt(e); + } + }, + { + key: 'nonIabVendorToBinary', + value: function (e) { + var t = e.verifiedObject, n = e.metadataOnly; + if (this.binaryStr = '', this.addBinaryField(pt(t.created), this.bitSizes.created, 'created'), this.addBinaryField(pt(t.lastUpdated), this.bitSizes.lastUpdated, 'lastUpdated'), this.addBinaryField(t.cmpId, this.bitSizes.cmpId, 'cmpId'), this.addBinaryField(t.cmpVersion, this.bitSizes.cmpVersion, 'cmpVersion'), n) + return this.binaryStr; + this.addBinaryField(t.maxVendorId, this.bitSizes.maxVendorId, 'maxVendorId'); + for (var r = 1; r <= t.maxVendorId; r++) + this.binaryStr += t.vendorConsents[r] ? '1' : '0'; + return this.binaryStr; + } + }, + { + key: 'decodeNonIabVendorBinary', + value: function (e) { + this.bitPosition = 0; + for (var t = { + created: lt(this.getBits(this.bitSizes.created, e)), + lastUpdated: lt(this.getBits(this.bitSizes.lastUpdated, e)), + cmpId: this.getBits(this.bitSizes.cmpId, e), + cmpVersion: this.getBits(this.bitSizes.cmpVersion, e), + maxVendorId: this.getBits(this.bitSizes.maxVendorId, e), + vendorConsents: [void 0] + }, n = t.maxVendorId || 1, r = new Array(n), o = 0; o < t.maxVendorId; o++) + r[o + 1] = '1' === e.charAt(this._bitPosition + o); + return t.vendorConsents = r, t; + } + }, + { + key: 'publisherConsentToBinary', + value: function (e) { + var t = e.verifiedObject, n = e.metadataOnly; + if (this.binaryStr = '', 2 !== t.version) + throw new Error('version ' + t.version + ' not supported'); + if (this.addBinaryField(t.version, this.bitSizes.version, 'version'), this.addBinaryField(pt(t.created), this.bitSizes.created, 'created'), this.addBinaryField(pt(t.lastUpdated), this.bitSizes.lastUpdated, 'lastUpdated'), this.addBinaryField(t.cmpId, this.bitSizes.cmpId, 'cmpId'), this.addBinaryField(t.cmpVersion, this.bitSizes.cmpVersion, 'cmpVersion'), this.addBinaryField(t.consentScreen, this.bitSizes.consentScreen, 'consentScreen'), this.addBinaryField(this.languageToCookieValue(t.consentLanguage), this.bitSizes.consentLanguage, 'consentLanguage'), this.addBinaryField(t.vendorListVersion, this.bitSizes.vendorListVersion, 'vendorListVersion'), this.addBinaryField(t.publisherPurposesVersion, this.bitSizes.publisherPurposesVersion, 'publisherPurposesVersion'), n) + return this.binaryStr; + this.addBinaryField(t.standardPurposesAllowed, this.bitSizes.standardPurposesAllowed, 'standardPurposesAllowed'), this.addBinaryField(t.numberCustomPurposes, this.bitSizes.numberCustomPurposes, 'numberCustomPurposes'); + for (var r = 1; r <= t.numberCustomPurposes; r++) + this.binaryStr += t.customPurposeConsents[r] ? '1' : '0'; + return this.binaryStr; + } + }, + { + key: 'decodePublisherBinary', + value: function (e) { + this.bitPosition = 0; + for (var t = { + version: this.getBits(this.bitSizes.version, e), + created: lt(this.getBits(this.bitSizes.created, e)), + lastUpdated: lt(this.getBits(this.bitSizes.lastUpdated, e)), + cmpId: this.getBits(this.bitSizes.cmpId, e), + cmpVersion: this.getBits(this.bitSizes.cmpVersion, e), + consentScreen: this.getBits(this.bitSizes.consentScreen, e), + consentLanguage: this.languageFromCookieValue(this.getBits(this.bitSizes.consentLanguage, e)), + vendorListVersion: this.getBits(this.bitSizes.vendorListVersion, e), + publisherPurposesVersion: this.getBits(this.bitSizes.publisherPurposesVersion, e), + standardPurposesAllowed: this.getBits(this.bitSizes.standardPurposesAllowed, e), + numberCustomPurposes: this.getBits(this.bitSizes.numberCustomPurposes, e), + customPurposeConsents: [void 0] + }, n = new Array(t.numberCustomPurposes + 1), r = 0; r < t.numberCustomPurposes; r++) + n[r + 1] = '1' === e.charAt(this._bitPosition + r); + return t.customPurposeConsents = n, t; + } + }, + { + key: 'binaryToBytes', + value: function (e) { + var t = ''; + e += this.PAD_ZEROS.substr(0, 7 - (e.length + 7) % 8); + for (var n = 0; n < e.length; n += 8) + t += String.fromCharCode(parseInt(e.substr(n, 8), 2)); + return t; + } + }, + { + key: 'bytesToBinary', + value: function (e) { + for (var t = '', n = 0; n < e.length; n++) + t += this.binary8Bits(e.charCodeAt(n)); + return t; + } + }, + { + key: 'binary8Bits', + value: function (e) { + var t = [ + '0000', + '0001', + '0010', + '0011', + '0100', + '0101', + '0110', + '0111', + '1000', + '1001', + '1010', + '1011', + '1100', + '1101', + '1110', + '1111' + ]; + return t[e >>> 4 & 15] + t[15 & e]; + } + }, + { + key: 'getBits', + value: function (e, t) { + var n = parseInt(t.substr(this.bitPosition, e), 2); + return this.bitPosition += e, n; + } + }, + { + key: 'toWebSafeBase64', + value: function (e) { + return btoa(e).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); + } + }, + { + key: 'fromWebSafeBase64', + value: function (e) { + return atob(e.replace(/-/g, '+').replace(/_/g, '/')); + } + }, + { + key: 'languageToCookieValue', + value: function (e) { + return 64 * (e.charCodeAt(0) - this.LOWERCASE_START) + (e.charCodeAt(1) - this.LOWERCASE_START); + } + }, + { + key: 'languageFromCookieValue', + value: function (e) { + return String.fromCharCode(this.LOWERCASE_START + e / 64 >>> 0) + String.fromCharCode(this.LOWERCASE_START + e % 64); + } + }, + { + key: 'deleteCookie', + value: function (e, t) { + document.cookie = ''.concat(e, '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; max-age=-1; domain=').concat(t); + } + }, + { + key: 'fallbackToLocalStorage', + value: function (e, t) { + this.saveOnLocalStorage(e, t) && this.deleteCookie(e); + } + }, + { + key: 'saveOnLocalStorage', + value: function (e, t) { + try { + return window.localStorage.setItem(e, t), !0; + } catch (n) { + return console.warn('Could not save data on local storage: Not enough space.'), !1; + } + } + }, + { + key: 'set', + value: function (e, t) { + var n = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], r = !1; + n && (r = this.saveOnLocalStorage(e, t)), r || vt({ + cookieName: e, + encodedValue: t, + maxAge: this.COOKIE_MAX_AGE + }); + } + }, + { + key: 'get', + value: function (e) { + const $___old_b110dadf6ed89e63 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_b110dadf6ed89e63) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_1cf1e90738546d40.localStorage)); + return function () { + if (window.localStorage.getItem(e)) + return window.localStorage.getItem(e); + var t = e.trim(), n = document.cookie.split(';').filter(function (e) { + return e.trim().startsWith(t + '='); + }).map(function (e) { + return e.trim().substring(t.length + 1); + }); + if (n.length) { + var r = ''; + return r = e === j ? bt(n) : n[0], e !== j && e !== z && e !== J && this.fallbackToLocalStorage(t, r), r; + } + return new Error(''.concat(e, ' not found.')); + }.apply(this, arguments); + } finally { + if ($___old_b110dadf6ed89e63) + ({}.constructor.defineProperty(window, 'localStorage', $___old_b110dadf6ed89e63)); + } + } + }, + { + key: 'bitPosition', + get: function () { + return this._bitPosition; + }, + set: function (e) { + this._bitPosition = e; + } + }, + { + key: 'binaryStr', + set: function (e) { + this._binaryStr = e; + }, + get: function () { + return this._binaryStr; + } + } + ]), e; + }(); + function ke(e, t) { + (null == t || t > e.length) && (t = e.length); + for (var n = 0, r = new Array(t); n < t; n++) + r[n] = e[n]; + return r; + } + function Te(e, t) { + if (e) { + if ('string' === typeof e) + return ke(e, t); + var n = Object.prototype.toString.call(e).slice(8, -1); + return 'Object' === n && e.constructor && (n = e.constructor.name), 'Map' === n || 'Set' === n ? Array.from(n) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? ke(e, t) : void 0; + } + } + function Ve(e, t) { + return function (e) { + if (Array.isArray(e)) + return e; + }(e) || function (e, t) { + if ('undefined' !== typeof Symbol && Symbol.iterator in Object(e)) { + var n = [], r = !0, o = !1, i = void 0; + try { + for (var s, a = e[Symbol.iterator](); !(r = (s = a.next()).done) && (n.push(s.value), !t || n.length !== t); r = !0); + } catch (c) { + o = !0, i = c; + } finally { + try { + r || null == a.return || a.return(); + } finally { + if (o) + throw i; + } + } + return n; + } + }(e, t) || Te(e, t) || function () { + throw new TypeError('Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + }(); + } + function xe(e) { + return function (e) { + if (Array.isArray(e)) + return ke(e); + }(e) || function (e) { + if ('undefined' !== typeof Symbol && Symbol.iterator in Object(e)) + return Array.from(e); + }(e) || Te(e) || function () { + throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + }(); + } + var Re = n(88), Ue = n.n(Re), Me = { + bg: 'Поверителност', + hr: 'Privatnost', + cs: 'Ochrana osobních údajů', + da: 'Privatlivets fred', + nl: 'Privacy', + et: 'Privaatsus', + fi: 'Yksityisyys', + fr: 'Confidentialité', + de: 'Datenschutz', + en: 'Privacy', + el: 'Απόρρητο', + hu: 'Adatvédelem', + it: 'Riservatezza', + lv: 'Privātums', + lt: 'Privatumas', + mt: 'Privatezza', + no: 'Personvern', + pl: 'Prywatność', + pt: 'Privacidade', + ro: 'Confidențialitate', + ru: 'Конфиденциальность', + sk: 'Súkromie', + sl: 'Zasebnost', + es: 'Privacidad', + sv: 'Integritet', + ar: 'إعدادات الخصوصية', + fa: 'تنظیمات حریم خصوصی' + }; + function De(e, t, n) { + var o, i = function () { + var e = 'qc-cmp2-container'; + return Se('div', e, e, document.body); + }(), s = 'qc-cmp2-persistent-link', a = Se('a', s, s, i); + if (a.tabIndex = 0, a.href = '#', a.firstChild) + return a; + a.onclick = function () { + return window.__tcfapi('displayConsentUi', 2, function () { + }), !1; + }; + var c = Se('img', void 0, void 0, a), u = e || Me[(t || 'en').toLowerCase()] || Me.en; + c.src = Ue.a, c.alt = u; + var p = document.createTextNode(u); + a.appendChild(p); + var l = Se('style', void 0, 'qc-cmp2', document.head), d = Ve((o = {}, r(o, f.TOP_LEFT, [ + 'top', + 'left' + ]), r(o, f.TOP_RIGHT, [ + 'top', + 'right' + ]), r(o, f.BOTTOM_LEFT, [ + 'bottom', + 'left' + ]), r(o, f.BOTTOM_RIGHT, [ + 'bottom', + 'right' + ]), o)[n], 2), h = d[0], v = d[1], y = 'top' === h ? 'bottom' : 'top'; + return l.innerHTML = '.qc-cmp2-persistent-link {cursor:pointer; position:fixed; background-color:#368BD6;padding:5px 15px; color:#FFF; display:flex; text-decoration: none;align-items:center; max-height:30px; z-index:2147483640;' + ''.concat(h, ':0; ').concat(v, ':0;') + 'border-'.concat(y, '-left-radius:3px;') + 'border-'.concat(y, '-right-radius:3px;') + '}.qc-cmp2-persistent-link img {width:16px; height:17px; margin-right:5px;}', a; + } + var Ne, Fe, Be, je, Ge, He, qe, ze, Je, We, Ye, Ke, Qe = function () { + function e() { + var t = this; + p(this, e), this._cookieValues = void 0, this.isSafari = void 0, this.resolveCookie = void 0, this._fetchCookiesCalled = void 0, this.resolveCookie = function () { + }, this._cookieValues = { + euconsent: '', + nonIabVendorConsent: '', + googleCookieValue: '', + fetched: !1, + promise: new Promise(function (e) { + return t.resolveCookie = e; + }) + }, this.isSafari = mt('safari'), this._fetchCookiesCalled = !1; + } + return d(e, [ + { + key: 'getCoreConfig', + value: function () { + return Fe.coreConfig; + } + }, + { + key: 'getConsents', + value: function () { + var e = u(a.a.mark(function e() { + var t, n, o, s, c, u, p, l, d, f, h, v, y, g, m, b, C; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = _.VENDORS, n = _.LEGITIMATE_VENDORS, o = _.LEGITIMATE_PURPOSES, s = _.PURPOSES, c = _.SPECIAL_FEATURES, u = _.NON_IAB, p = _.GOOGLE, this._cookieValues.fetched) { + e.next = 4; + break; + } + return e.next = 4, this._cookieValues.promise; + case 4: + return l = Le(ze.decode, this._cookieValues.euconsent), d = new k(), f = We.gvl, h = Fe.coreConfig.publisherName || Fe.coreConfig.cookieDomain || '', v = Fe.coreConfig, y = v.publisherPurposeIds, g = v.publisherPurposeLegitimateInterestIds, m = f.vendors, (y || g) && (m = i(i({}, m), {}, r({}, h, { + id: h, + name: h + }))), this.populateCoreConsents(d, t, m, l), this.populateCoreConsents(d, s, f.purposes, l), this.populateCoreConsents(d, c, f.specialFeatures, l), this.populateCoreConsents(d, n, m, l), this.populateCoreConsents(d, o, f.purposes, l), b = Le(He.decode, this._cookieValues.nonIabVendorConsent), this.populateCoreConsents(d, u, He.data.data.nonIabVendorList, b), C = Le(Ke.decode, this._cookieValues.googleCookieValue), this.populateCoreConsents(d, p, [], C), e.abrupt('return', d); + case 21: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'extractNumericKeys', + value: function (e) { + var t = {}; + for (var n in e) { + var r = parseInt(n); + isNaN(r) || (t[n] = e[n]); + } + return t; + } + }, + { + key: 'setConsents', + value: function (e) { + var t = Fe.coreConfig, n = t.publisherPurposeIds, r = t.publisherPurposeLegitimateInterestIds, o = t.publisherName, s = t.isAMP; + e.consentScreen && (We.consentScreen = e.consentScreen); + var a, c = ze.encode(this.extractNumericKeys(e.vendorConsents), this.extractNumericKeys(e.purposesConsents), this.extractNumericKeys(e.specialFeatures), this.extractNumericKeys(e.vendorLegitimateInterest), this.extractNumericKeys(e.legitimatePurposesConsents), e.vendorConsents[o], e.vendorLegitimateInterest[o], n, r), u = this.formatConsents(e.nonIabConsents), p = Fe.premiumProperties.nonIabVendorListUrl ? He.encode(u.consentArray, u.maxVendorId) : '', l = this.formatGoogleConsents(e), d = Fe.coreConfig.googleEnabled ? Ke.encode(l) : '', f = He.data.data.nonIabVendorsHash; + return l.length || s || Ge.deleteCookie(J, Fe.coreConfig.cookieDomain), Je.setValues({ + euconsent: c, + nonIabVendorConsent: p, + nonIabVendorsHash: f + }), a = Je.generateRepromptOptionsHash(), this.setData(c, p, a, d), this.updateApiVisible('GDPR', !1), i(i({}, this._cookieValues), {}, { allConsents: e.allConsents }); + } + }, + { + key: 'updateApiVisible', + value: function (e, t) { + if ('USP' !== e && ft(Be.isUserInEU, Fe.coreConfig.displayUi)) { + var n = this._cookieValues.euconsent; + n && !n.message || (n = ''), Et.cmpApi.update(n, t); + } else + Et.cmpApi.update(null); + Fe.coreConfig.privacyMode.includes('GDPR') && Fe.coreConfig.displayPersistentConsentLink && !Fe.coreConfig.isAMP && this.hasCookie() && De(Fe.getCustomCoreUiLabels().persistentConsentLinkLabel, Fe.coreConfig.lang_, Fe.coreConfig.persistentConsentLinkLocation); + } + }, + { + key: 'setData', + value: function (e, t, n, r) { + var o = Fe.coreConfig, i = o.consentScope, s = o.thirdPartyStorageType, a = o.consentScopeGroupURL, c = o.consentOnSafari, u = o.isAMP, p = 'api' === s, l = this.isSafari && c; + u || (l ? this.setDataUsingApi(!0, a, e, t, n, r) : i === v.SERVICE || this.isSafari ? this.setDataUsingFirstParty(e, t, n, r) : i === v.SERVICE_GROUP && (p ? this.setDataUsingApi(!0, a, e, t, n, r) : this.setDataUsingIframe(e, t, n, r))), this._cookieValues = { + euconsent: e, + nonIabVendorConsent: t, + googleCookieValue: r, + fetched: !0, + promise: this._cookieValues.promise + }; + } + }, + { + key: 'setDataUsingApi', + value: function (e, t, n, r, o, i) { + var s = {}; + n && (s[j] = n), r && (s[G] = r), o && (s[q] = o), i && (s[J] = i), ce({ + method: 'post', + url: t, + data: s, + withCredentials: e + }).then(function () { + console.log('the cookies was saved successfully'); + }); + } + }, + { + key: 'setDataUsingIframe', + value: function (e, t, n, r) { + e && st.tryGroupCookieAccessCall('set', j, e), t && st.tryGroupCookieAccessCall('set', G, t), n && st.tryGroupCookieAccessCall('set', q, n), r && st.tryGroupCookieAccessCall('set', J, r); + } + }, + { + key: 'setDataUsingFirstParty', + value: function (e, t, n, r) { + e && ze.setCookie(e), t && He.setCookie(t), n && Ge.set(q, n), r && Ke.setCookie(r); + } + }, + { + key: 'fetchCookieValues', + value: function () { + var e = u(a.a.mark(function e() { + var t, n, r, o, i, s, c, u, p, l, d, f, h; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Fe.coreConfig, n = t.consentScope, r = t.consentScopeGroupURL, o = t.thirdPartyStorageType, i = t.consentOnSafari, s = t.isAMP, c = Fe.ampData, u = '', p = '', l = '', d = {}, f = function (e) { + u = e.nonIabCookieValue, p = e.vendorCookieValue, l = e.googleCookieValue; + }, h = this.isSafari && i, this._fetchCookiesCalled = !0, !s) { + e.next = 12; + break; + } + c.consentMetadata && c.consentMetadata.consentStringType === w.GDPR && (p = c.consentString, c.consentMetadata.additionalConsent && (l = c.consentMetadata.additionalConsent)), e.next = 36; + break; + case 12: + if (!h) { + e.next = 19; + break; + } + return e.next = 15, this.getDataUsingApi(!0, r); + case 15: + d = e.sent, f(d), e.next = 36; + break; + case 19: + if (n !== v.SERVICE && !this.isSafari) { + e.next = 24; + break; + } + d = this.getDataUsingFirstParty(), f(d), e.next = 36; + break; + case 24: + if (n !== v.SERVICE_GROUP) { + e.next = 36; + break; + } + if ('api' !== o) { + e.next = 32; + break; + } + return e.next = 28, this.getDataUsingApi(!0, r); + case 28: + d = e.sent, f(d), e.next = 36; + break; + case 32: + return e.next = 34, this.getDataUsingIframe(); + case 34: + d = e.sent, f(d); + case 36: + this._cookieValues = { + euconsent: p, + nonIabVendorConsent: u, + googleCookieValue: l, + fetched: !0, + promise: this._cookieValues.promise + }, this.resolveCookie(); + case 38: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'getDataUsingApi', + value: function () { + var e = u(a.a.mark(function e(t, n) { + var r, o, i; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return e.next = 2, ce({ + method: 'get', + url: n, + withCredentials: t + }); + case 2: + return r = e.sent, o = {}, i = r.data[q], Je.storedHash = i, o.vendorCookieValue = r.data[j], o.nonIabCookieValue = r.data[G], o.googleCookieValue = r.data.addtl_consent, e.abrupt('return', o); + case 10: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t, n) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'getDataUsingIframe', + value: function () { + var e = u(a.a.mark(function e() { + var t, n, r, o, i, s; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return t = Fe.coreConfig.googleEnabled, n = Fe.premiumProperties.nonIabVendorListUrl, r = {}, e.next = 4, st.tryGroupCookieAccessCall('get', q, ''); + case 4: + return o = e.sent, Je.storedHash = o, e.next = 8, st.tryGroupCookieAccessCall('get', j, ''); + case 8: + if (r.vendorCookieValue = e.sent, !n) { + e.next = 15; + break; + } + return e.next = 12, st.tryGroupCookieAccessCall('get', G, ''); + case 12: + (i = e.sent) && Array.isArray(i) ? i = i[0] : i || (i = null), r.nonIabCookieValue = i; + case 15: + if (!t) { + e.next = 21; + break; + } + return e.next = 18, st.tryGroupCookieAccessCall('get', J, ''); + case 18: + (s = e.sent) && Array.isArray(s) ? s = s[0] : s || (s = null), r.googleCookieValue = s; + case 21: + return e.abrupt('return', r); + case 22: + case 'end': + return e.stop(); + } + }, e); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'getDataUsingFirstParty', + value: function () { + var e = {}, t = Fe.coreConfig.googleEnabled, n = Fe.premiumProperties.nonIabVendorListUrl, r = Ge.get(j), o = Ge.get(q), i = Ge.get(G), s = Ge.get(J); + return Je.storedHash = o, 'string' === typeof r && (e.vendorCookieValue = r), t && 'string' === typeof s && (e.googleCookieValue = s), n && 'string' === typeof i && (e.nonIabCookieValue = i), e; + } + }, + { + key: 'repromptDueToInvalidCMPID', + value: function () { + var e = u(a.a.mark(function e() { + var t, n, r, o, i, s, c, u, p; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Fe.coreConfig.isAMP, n = !1, t) { + e.next = 25; + break; + } + if (r = 'https://test.quantcast.mgr.consensu.org/GVL-v2/cmp-list.json', o = [], i = new Date(), s = Ge.get(B), !((c = s && !s.message ? JSON.parse(s) : null) && c.CMP && c.CMP.includes(String(We.cmpId)) && i.getTime() < c.expiry)) { + e.next = 12; + break; + } + n = !1, e.next = 25; + break; + case 12: + return e.prev = 12, e.next = 15, ce.get(r); + case 15: + u = e.sent, o.push.apply(o, xe(Object.keys(u.data.cmps))), p = { + lastUpdated: u.data.lastUpdated, + CMP: o, + expiry: i.getTime() + 259200000 + }, Ge.set(B, JSON.stringify(p)), e.next = 24; + break; + case 21: + e.prev = 21, e.t0 = e.catch(12), console.log(e.t0); + case 24: + n = !o.includes(String(We.cmpId)); + case 25: + return e.abrupt('return', n); + case 26: + case 'end': + return e.stop(); + } + }, e, null, [[ + 12, + 21 + ]]); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'repromptDueToOutdatedGvl', + value: function () { + var e = u(a.a.mark(function e() { + var t, n, r, o, i, s, c, u, p, l; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Fe.coreConfig.vendorListUpdateFreq, this._cookieValues.fetched) { + e.next = 4; + break; + } + return e.next = 4, this._cookieValues.promise; + case 4: + if (n = Le(ze.decode, this._cookieValues.euconsent), r = !1, !n) { + e.next = 17; + break; + } + if (o = n.vendorListVersion, i = n.policyVersion, s = n.lastUpdated, c = Date.now() - s.getTime() > 86400000 * t) { + e.next = 11; + break; + } + return e.abrupt('return', { + outdatedGvlReprompt: r, + decodedEuConsent: n + }); + case 11: + return e.next = 13, this.loadGVL(); + case 13: + u = We.gvl, p = u.vendorListVersion, l = u.tcfPolicyVersion, c && (p > o || l > i) && (r = !0), e.next = 18; + break; + case 17: + r = !0; + case 18: + return e.abrupt('return', { + outdatedGvlReprompt: r, + decodedEuConsent: n + }); + case 19: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'fetchDataToReprompt', + value: function () { + var e = u(a.a.mark(function e() { + var t, n, r, o, s; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return e.next = 2, Promise.all([ + this.repromptDueToOutdatedGvl(), + this.repromptDueToInvalidCMPID() + ]); + case 2: + return t = e.sent, n = Ve(t, 2), r = n[0].outdatedGvlReprompt, o = n[1], (s = r || o) || (Je.setValues(i(i({}, this._cookieValues), {}, { nonIabVendorsHash: He.data.data.nonIabVendorsHash })), s = Je.shouldReprompt()), e.abrupt('return', s); + case 9: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'populateCoreConsents', + value: function (e, t, n, r) { + var o, i = _.NON_IAB, s = _.PURPOSES, a = _.LEGITIMATE_PURPOSES, c = _.LEGITIMATE_VENDORS, u = _.VENDORS, p = _.SPECIAL_FEATURES, l = _.GOOGLE, d = '', f = ''; + switch (t) { + case i: + o = 'nonIabConsents', d = 'vendorConsents'; + break; + case u: + o = 'vendorConsents', d = 'vendorConsents', f = 'publisherConsents'; + break; + case s: + o = 'purposesConsents', d = 'purposeConsents'; + break; + case a: + o = 'legitimatePurposesConsents', d = 'purposeLegitimateInterests'; + break; + case c: + o = 'vendorLegitimateInterest', d = 'vendorLegitimateInterests', f = 'publisherLegitimateInterests'; + break; + case p: + o = 'specialFeatures', d = 'specialFeatureOptins'; + break; + case l: + o = 'googleConsents', d = 'consentIds'; + break; + default: + o = ''; + } + var h = null !== r && !r.message, v = Fe.coreConfig.publisherName; + if (e[o].hasCookie = h, h) + switch (t) { + case i: + if (n) { + var y, g = function (e) { + if ('undefined' === typeof Symbol || null == e[Symbol.iterator]) { + if (Array.isArray(e) || (e = Te(e))) { + var t = 0, n = function () { + }; + return { + s: n, + n: function () { + return t >= e.length ? { done: !0 } : { + done: !1, + value: e[t++] + }; + }, + e: function (e) { + throw e; + }, + f: n + }; + } + throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + } + var r, o, i = !0, s = !1; + return { + s: function () { + r = e[Symbol.iterator](); + }, + n: function () { + var e = r.next(); + return i = e.done, e; + }, + e: function (e) { + s = !0, o = e; + }, + f: function () { + try { + i || null == r.return || r.return(); + } finally { + if (s) + throw o; + } + } + }; + }(n); + try { + for (g.s(); !(y = g.n()).done;) { + var m = y.value, b = r[d][m.id]; + e[o][m.id] = b; + } + } catch (E) { + g.e(E); + } finally { + g.f(); + } + } + break; + case l: + r.consentIds && r.consentIds.forEach(function (t) { + e[o][t] = !0; + }); + break; + default: + if (r[d] && (r[d].forEach(function (t, n) { + e[o][n] = t; + }), f)) + for (var C in n) + C === v && (e[o][C] = xe(r[f].set_).length > 0); + } + } + }, + { + key: 'formatConsents', + value: function (e) { + var t = 0, n = []; + for (var r in e) { + var o = parseInt(r); + isNaN(o) || (o > t && (t = o), n.push({ + consent: e[r], + id: o + })); + } + return { + consentArray: n, + maxVendorId: t + }; + } + }, + { + key: 'formatGoogleConsents', + value: function (e) { + var t = []; + for (var n in e.googleConsents) + !0 === e.googleConsents[n] && t.push(n); + return t.sort(function (e, t) { + return e - t; + }), t; + } + }, + { + key: 'regulationToInit', + value: function () { + var e = u(a.a.mark(function e() { + var t, n, r, o; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Fe.coreConfig.privacyMode, n = '', !t.includes('USP')) { + e.next = 14; + break; + } + if (r = Fe.coreConfig.uspJurisdiction, !Be.isUserInUS || !r.length) { + e.next = 14; + break; + } + if (ue('initUspLocation: US'), r.includes('US')) { + e.next = 13; + break; + } + return e.next = 9, Be.checkSpecificLocation(); + case 9: + ue('initUspLocation: specific location' + JSON.stringify(Be.userSpecificLocation)), Be.userSpecificLocation && Be.userSpecificLocation.region && r.includes(Be.userSpecificLocation.region.toUpperCase()) && (n = 'USP'), e.next = 14; + break; + case 13: + n = 'USP'; + case 14: + return t.includes('GDPR') && 'USP' !== n && (o = Fe.coreConfig.displayUi, (Be.isUserInEU && 'inEU' === o || 'always' === o) && (n = 'GDPR')), e.abrupt('return', n); + case 16: + case 'end': + return e.stop(); + } + }, e); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'loadGVL', + value: function () { + var e = u(a.a.mark(function e() { + var t, n, r, o, i, s, c; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Fe.coreConfig, n = t.privacyMode, r = t.lang_, o = Fe.premiumProperties, i = o.vendorWhitelist, s = o.vendorBlacklist, c = null === r || void 0 === r ? void 0 : r.toUpperCase(), We.gvl) { + e.next = 12; + break; + } + return We.gvl = new re.GVL('LATEST'), e.next = 6, We.gvl.readyPromise; + case 6: + if (!n.includes('GDPR')) { + e.next = 10; + break; + } + return e.next = 9, We.gvl.changeLanguage(c); + case 9: + this.filterGvl(We.gvl, i, s); + case 10: + e.next = 14; + break; + case 12: + return e.next = 14, We.gvl.readyPromise; + case 14: + return e.abrupt('return', We.gvl); + case 15: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'filterGvl', + value: function (e, t, n) { + var r = e.vendors, o = []; + Object.keys(r).forEach(function (e) { + o.push(r[e].id); + }), t.length && (o = t.filter(function (e) { + return o.includes(e); + })), n.length ? e.narrowVendorsTo(o.filter(function (e) { + return !n.includes(e); + })) : e.narrowVendorsTo(o); + } + }, + { + key: 'hasCookie', + value: function () { + return !!this._cookieValues.euconsent; + } + }, + { + key: 'setPublisherRestriction', + value: function (e) { + We.publisherRestrictions.add(e.id, e.purposeRestriction); + } + }, + { + key: 'cookieValues', + get: function () { + return this._cookieValues; + } + }, + { + key: 'fetchCookiesCalled', + get: function () { + return this._fetchCookiesCalled; + } + } + ]), e; + }(), Ze = function () { + function e() { + p(this, e), this._data = void 0, this._fields = void 0, this._fields = { + created: new Date(), + lastUpdated: new Date(), + cmpId: 10, + cmpVersion: 26, + maxVendorId: 0, + vendorConsents: [] + }, this._data = { + nonIabVendorList: [], + updateAt: '', + nonIabVendorsHash: '' + }; + } + return d(e, [ + { + key: 'data', + set: function (e) { + this._data = e; + }, + get: function () { + return this._data; + } + }, + { + key: 'fields', + set: function (e) { + this._fields = e; + }, + get: function () { + return this._fields; + } + } + ]), e; + }(), Xe = function () { + function e() { + p(this, e), this._data = void 0, this.created = void 0, this._data = new Ze(), this.created = !1; + } + return d(e, [ + { + key: 'encode', + value: function (e, t) { + var n = []; + return e.forEach(function (e) { + n[e.id] = e.consent; + }), !1 === this.created ? (this.created = !0, this._data.fields = i(i({}, this._data.fields), {}, { + vendorConsents: n, + created: new Date(), + lastUpdated: new Date(), + maxVendorId: t + })) : this._data.fields = i(i({}, this._data.fields), {}, { + vendorConsents: n, + lastUpdated: new Date() + }), Ge.encode(i({ cookieName: G }, this._data.fields)); + } + }, + { + key: 'decode', + value: function (e) { + return Ge.decode(G, e); + } + }, + { + key: 'setCookie', + value: function (e) { + 'string' === typeof e ? Ge.set(G, e) : console.error(e.message); + } + }, + { + key: 'getCookie', + value: function () { + var e = Ge.get(G); + return e && 'string' === typeof e ? this.decode(e) : e; + } + }, + { + key: 'fetchList', + value: function () { + var e = u(a.a.mark(function e() { + var t, n, r; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (Fe.premiumProperties.nonIabVendorListUrl || Fe.nonIabVendorsInfo) { + e.next = 2; + break; + } + return e.abrupt('return'); + case 2: + if (e.prev = 2, 'undefined' === typeof Fe.nonIabVendorsInfo) { + e.next = 9; + break; + } + if (Fe.nonIabVendorsInfo.nonIabVendorList && 0 !== Fe.nonIabVendorsInfo.nonIabVendorList.length) { + e.next = 6; + break; + } + return e.abrupt('return'); + case 6: + t = Fe.nonIabVendorsInfo, e.next = 13; + break; + case 9: + return e.next = 11, ce.get(Fe.premiumProperties.nonIabVendorListUrl); + case 11: + n = e.sent, t = n.data; + case 13: + r = [], t.nonIabVendorList.forEach(function (e) { + var t = { + name: e.name, + id: e.vendorId, + policyUrl: !!e.privacyPolicyUrl && e.privacyPolicyUrl, + description: !!e.description && e.description, + purposes: 'nonIabPurposeConsentIds' in e && e.nonIabPurposeConsentIds, + legIntPurposes: 'nonIabPurposeLegitimateInterestIds' in e && e.nonIabPurposeLegitimateInterestIds + }; + r.push(t); + }), this._data.data = i(i({}, t), {}, { nonIabVendorList: r }), e.next = 21; + break; + case 18: + e.prev = 18, e.t0 = e.catch(2), console.log('error processing nonIabVendors', e.t0); + case 21: + case 'end': + return e.stop(); + } + }, e, this, [[ + 2, + 18 + ]]); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'data', + get: function () { + return this._data; + } + } + ]), e; + }(), $e = function () { + function e() { + p(this, e); + } + return d(e, [ + { + key: 'encode', + value: function (e, t, n, r, o, i, s, a, c) { + return Ge.encode({ + cookieName: j, + vendorConsents: e, + purposeConsents: t, + specialFeatureOptins: n, + vendorLegitimateInterests: r, + purposeLegitimateInterests: o, + publisherConsent: i, + publisherLegitimate: s, + publisherPurposeIds: a, + publisherPurposeLegitimateInterestIds: c + }); + } + }, + { + key: 'decode', + value: function (e) { + return Ge.decode(j, e); + } + }, + { + key: 'setCookie', + value: function (e) { + 'string' === typeof e ? Ge.set(j, e, !1) : console.error(e.message); + } + }, + { + key: 'getCookie', + value: function () { + var e = Ge.get(j); + return e && 'string' === typeof e ? this.decode(e) : e; + } + } + ]), e; + }(), et = function () { + function e() { + p(this, e), this._uspVersion = void 0, this._baseString = void 0, this._noticegiven = void 0, this._optedout = void 0, this._lspact = void 0, this._uspVersion = 1, this._noticegiven = '-', this._optedout = '-', this._lspact = '-', this._baseString = null; + } + return d(e, [ + { + key: 'baseString', + set: function (e) { + this._baseString = e; + }, + get: function () { + return this._baseString; + } + }, + { + key: 'noticegiven', + set: function (e) { + this._noticegiven = e; + }, + get: function () { + return this._noticegiven; + } + }, + { + key: 'optedout', + set: function (e) { + this._optedout = e; + }, + get: function () { + return this._optedout; + } + }, + { + key: 'lspact', + set: function (e) { + this._lspact = e; + }, + get: function () { + return this._lspact; + } + }, + { + key: 'uspVersion', + get: function () { + return this._uspVersion; + } + } + ]), e; + }(), tt = /^[1][nNyY-][nNyY-][nNyY-]$/, nt = function () { + function e() { + p(this, e), this._data = void 0, this._data = new et(); + } + return d(e, [ + { + key: 'encode', + value: function (e, t) { + return this._data.baseString = ''.concat(e, 'Y').concat(t ? 'Y' : 'N').concat(Fe.coreConfig.uspLspact), this._data.baseString; + } + }, + { + key: 'setCookie', + value: function (e) { + 'string' === typeof e ? tt.test(e) && Ge.set(z, e, !1) : e && 'message' in e && console.error(e.message); + } + }, + { + key: 'getCookie', + value: function () { + return Ge.get(z); + } + } + ]), e; + }(), rt = function () { + function e(t) { + p(this, e), this._cookieAccessIframe = void 0, this._isCookieAccessIframeReady = void 0, this.groupCookieAccessCallbacks = void 0, this._cookieAccessIframe = document.createElement('iframe'), this._isCookieAccessIframeReady = !1, this.groupCookieAccessCallbacks = {}, this.groupCookieAccessHandler = this.groupCookieAccessHandler.bind(this), window.addEventListener ? window.addEventListener('message', this.groupCookieAccessHandler, !1) : window.attachEvent('onmessage', this.groupCookieAccessHandler), this.createGroupCookieAccessIframe(t.coreConfig.consentScopeGroupURL, '_qc_cookie_access'); + } + return d(e, [ + { + key: 'tryGroupCookieAccessCall', + value: function (e, t, n) { + var r = this; + return new Promise(function (o) { + var i = setInterval(function () { + r._isCookieAccessIframeReady && r._cookieAccessIframe.contentWindow && (clearInterval(i), r.groupCookieAccessCall(e, t, n, function (e) { + o(e); + })); + }, 50); + }); + } + }, + { + key: 'groupCookieAccessCall', + value: function (e, t, n, r) { + var o = Math.random().toString(), i = { + callId: o, + __qcCmpCookieAccessCall: { + cmd: e, + cookieName: t + } + }; + if ('set' === e) { + this.groupCookieAccessCallbacks[o] = { + cookieName: t, + cookieValue: n + }; + var s = new Date(Date.now() + 33696000000).toUTCString(); + i.__qcCmpCookieAccessCall.cookieValue = n, i.__qcCmpCookieAccessCall.cookiePath = Fe.coreConfig.cookiePath, i.__qcCmpCookieAccessCall.expires = s; + } else + this.groupCookieAccessCallbacks[o] = { + cookieName: t, + resolve: r + }; + this._cookieAccessIframe.contentWindow.postMessage(i, '*'); + } + }, + { + key: 'createGroupCookieAccessIframe', + value: function (e, t) { + var n = this._cookieAccessIframe; + n.src = e, n.style.display = 'none', n.id = t; + !function e() { + document.body ? document.body.appendChild(n) : setTimeout(e, 5); + }(); + } + }, + { + key: 'groupCookieAccessHandler', + value: function (e) { + var t; + if ((t = 'string' === typeof e.data ? -1 !== e.data.indexOf('__qcCmpCookieAccessReturn') ? JSON.parse(e.data) : {} : e.data).__qcCmpCookieAccessReturn) { + if (t.__qcCmpCookieAccessReturn.isHandlerRegistered) + return void (this._isCookieAccessIframeReady = !0); + var n = t.__qcCmpCookieAccessReturn, r = this.groupCookieAccessCallbacks[t.callId]; + if (r.resolve) { + var o = null; + 'get' === n.cmd && (o = -1 !== [ + 'euconsent-v2', + 'addtl_consent' + ].indexOf(r.cookieName) ? 'euconsent-v2' === r.cookieName ? this.returnLatestVendorCookie(n.cookies) : n.isSuccess ? n.cookies[0] : null : n.cookies, r.resolve(o)), delete this.groupCookieAccessCallbacks[t.callId]; + } + } + } + }, + { + key: 'returnLatestVendorCookie', + value: function (e) { + return e && e.length ? bt(e) : new Error('euconsent-v2 not found.'); + } + }, + { + key: 'isCookieAccessIframeReady', + get: function () { + return this.isCookieAccessIframeReady; + } + }, + { + key: 'cookieAccessIframe', + get: function () { + return this._cookieAccessIframe; + } + } + ]), e; + }(), ot = function () { + function e() { + p(this, e), this.version = void 0, this._data = void 0, this.whitelist = void 0, this.version = 1, this._data = [], this.whitelist = Fe.premiumProperties.googleWhitelist; + } + return d(e, [ + { + key: 'encode', + value: function (e) { + return Ge.encode({ + cookieName: J, + vendorConsents: e, + version: this.version + }); + } + }, + { + key: 'decode', + value: function (e) { + return Ge.decode(J, e); + } + }, + { + key: 'setCookie', + value: function (e) { + 'string' === typeof e ? Ge.set(J, e, !1) : console.error(e.message); + } + }, + { + key: 'getCookie', + value: function (e) { + var t = Ge.get(J); + return t && 'string' === typeof t ? e ? t : this.decode(t) : null; + } + }, + { + key: 'fetchPartners', + value: function () { + var e = this; + if (Fe.coreConfig.googleEnabled) { + return new Promise(function (t) { + return JSON.stringify(e.whitelist) === JSON.stringify([-1]) ? (e._data = [], t(e._data)) : e._data.length > 0 ? t(e._data) : ce.get('https://quantcast.mgr.consensu.org/tcfv2/google-atp-list.json').then(function (n) { + var r = []; + for (var o in n.data) { + var i = n.data[o]; + if ('undefined' !== typeof i.provider_id && '' !== i.provider_id && (JSON.stringify(e.whitelist) === JSON.stringify([1]) || e.whitelist.length > 0 && e.whitelist.includes(parseInt(i.provider_id)))) { + var s = { + name: i.provider_name, + id: i.provider_id, + policyUrl: i.policy_url, + description: i.domains + }; + r.push(s); + } + e._data = r; + } + t(e._data); + }).catch(function (e) { + return console.log(e); + }); + }); + } + } + }, + { + key: 'data', + get: function () { + return this._data; + } + } + ]), e; + }(); + re.GVL.baseUrl = 'https://quantcast.mgr.consensu.org/GVL-v2/', re.GVL.latestFilename = 'vendor-list-trimmed-v1.json'; + var it, st, at = new se(), ct = function () { + var e = u(a.a.mark(function e(t) { + var n, r, o, i; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return n = (Fe = t).coreConfig, r = n.privacyMode, o = n.publisherCountryCode, i = n.showSummaryView, '', it = '', Ne = new Qe(), Be = new pe('inUS'), je = function () { + var e = u(a.a.mark(function e() { + var t, n; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return t = '', e.prev = 1, e.next = 4, Ne.regulationToInit(); + case 4: + 'USP' === (t = e.sent) || r.includes('USP') ? St.initUsp() : (n = function (e, t, n) { + 'getUSPData' === e && 1 === t && 'function' === typeof n && n({ + version: 1, + uspString: '1---' + }, !0); + }, Object.assign(window, { __uspapi: n })), e.next = 11; + break; + case 8: + e.prev = 8, e.t0 = e.catch(1), console.log(e.t0); + case 11: + return e.abrupt('return', t); + case 12: + case 'end': + return e.stop(); + } + }, e, null, [[ + 1, + 8 + ]]); + })); + return function () { + return e.apply(this, arguments); + }; + }(), Ge = new Oe(), He = new Xe(), qe = new nt(), ze = new $e(), Ke = new ot(), Je = new we(), We = null, Ye = function () { + var e = u(a.a.mark(function e() { + var t, n, r, i, s, c = arguments; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = c.length > 0 && void 0 !== c[0] && c[0], ((r = 'GDPR' === it) || t) && ((We = new oe.TCModel()).cmpId = 10, We.cmpVersion = F, We.publisherCountryCode = o, We.isServiceSpecific = !0, i = Ie(Fe), (s = i.purposeIds).includes(1) || ('DE' === o ? We.purposeOneTreatment = !0 : s.push(1))), e.prev = 3, !r && !t) { + e.next = 12; + break; + } + return e.next = 7, Ne.fetchCookieValues(); + case 7: + return e.next = 9, He.fetchList(); + case 9: + return e.next = 11, Ne.fetchDataToReprompt(); + case 11: + n = e.sent; + case 12: + e.next = 17; + break; + case 14: + e.prev = 14, e.t0 = e.catch(3), console.error(e.t0); + case 17: + return e.abrupt('return', n); + case 18: + case 'end': + return e.stop(); + } + }, e, null, [[ + 3, + 14 + ]]); + })); + return function () { + return e.apply(this, arguments); + }; + }(), e.next = 17, je(); + case 17: + return it = e.sent, e.next = 20, Ye(); + case 20: + e.sent && 'GDPR' === it ? at.displayUi('GDPR', i ? 0 : 1, !0) : Ne.updateApiVisible(it, !1); + case 22: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t) { + return e.apply(this, arguments); + }; + }(), ut = function (e) { + return i(i(i(i({}, e.coreConfig), e.premiumProperties), e.coreUiLabels), e.premiumUiLabels); + }, pt = function (e) { + return Math.floor(e.getTime() / 100); + }, lt = function (e) { + return new Date(100 * e); + }, dt = function (e, t) { + var n = Object.keys(t).filter(function (t) { + return -1 === e.indexOf(t); + }); + return n.length && (t.notFound = n), t; + }, ft = function (e, t) { + return !(!e && 'always' !== t); + }, ht = function (e, t) { + var n = {}; + return t && t.length > 0 ? (t.forEach(function (t) { + void 0 !== e[t] ? n[t] = e[t] : n[t] = !1; + }), n) : e; + }, vt = function (e) { + var t = new Date(Date.now() + 1000 * e.maxAge).toUTCString(), n = 'https:' === window.location.protocol ? ';SameSite=Lax;secure' : '', r = Fe.coreConfig.cookiePath || '/'; + document.cookie = e.cookieName + '=' + e.encodedValue + ';path=' + r + ';max-age=' + e.maxAge + ';expires=' + t + ';domain=' + Fe.coreConfig.cookieDomain + n; + }, yt = function (e) { + return Ae.TCString.encode(e); + }, gt = function (e) { + return Ae.TCString.decode(e); + }, mt = function (e) { + var t = !1; + switch (e) { + case 'firefox': + t = navigator.userAgent.toLowerCase().indexOf(e) > -1; + break; + case 'safari': + t = navigator.userAgent.toLowerCase().indexOf(e) > -1 && -1 === navigator.userAgent.toLowerCase().indexOf('chrome'); + } + return t; + }, bt = function (e) { + var t = null, n = new Error('euconsent-v2 not valid'); + return e.forEach(function (e) { + var r = null; + try { + r = gt(e); + } catch (o) { + console.error('Failed to decode euconsent-v2 cookie: ' + e); + } + r && r.lastUpdated && r.lastUpdated > t && (t = r.lastUpdated, n = e); + }), n; + }, Ct = function () { + function e() { + var t = this; + p(this, e), this.cmpApi = void 0, this.isInitialized = void 0, this.config = void 0, this.MyCustomCommands = void 0; + var n, r = window.__tcfapi(); + r.length && r.forEach(function (e) { + e && 'init' === e[0] && (n = e[3]); + }), this.isInitialized = !1; + var o = 'thirdPartyStorageType' in n.coreConfig ? n.coreConfig.thirdPartyStorageType : 'iframe', i = 'consentScope' in n.coreConfig ? n.coreConfig.consentScope : 'service', s = 'consentScopeGroupURL' in n.coreConfig ? n.coreConfig.consentScopeGroupURL : ''; + i.includes('group') && 'iframe' === o && s && (st = new rt(n)), this.MyCustomCommands = { + getConfig: function (e, n) { + var r = t.getConfig(n), o = !1; + 'object' === typeof r && (o = !0), e(r, o); + }, + getNonIABVendorConsents: function () { + var e = u(a.a.mark(function e(n, r) { + var o, i; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return e.next = 2, t.getNonIABVendorConsents(r); + case 2: + o = e.sent, i = !1, 'object' === typeof o && (i = !0), n(o, i); + case 6: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t, n) { + return e.apply(this, arguments); + }; + }(), + displayConsentUi: function (e) { + return e(t.displayConsentUi()); + }, + setConsentInfo: function (e, t) { + return e(Ne.setConsents(t)); + }, + setPublisherRestriction: function (e, t) { + return e(Ne.setPublisherRestriction(t)); + }, + notifyUiState: function (e, t) { + return e(Ne.updateApiVisible(t.regulation, t.visible)); + }, + init: function (e, n) { + return e(t.init(n)); + } + }, this.addGetTCDataToSupportGoogle(n), this.cmpApi = new g.CmpApi(10, F, !0, this.MyCustomCommands); + } + return d(e, [ + { + key: 'addGetTCDataToSupportGoogle', + value: function (e) { + if ('googleEnabled' in e.coreConfig && e.coreConfig.googleEnabled) { + var t = function () { + var e = u(a.a.mark(function e(t, n) { + var r, o; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (null === n || 'object' !== typeof n) { + e.next = 8; + break; + } + if (!Ne.fetchCookiesCalled) { + e.next = 8; + break; + } + if (Ne.cookieValues.fetched) { + e.next = 5; + break; + } + return e.next = 5, Ne.cookieValues.promise; + case 5: + r = Ne.cookieValues.googleCookieValue, o = r ? Pe(r) : void 0, n.addtlConsent = o; + case 8: + 'function' === typeof t && ('boolean' === typeof n ? t(n) : t(n, !0)); + case 9: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t, n) { + return e.apply(this, arguments); + }; + }(); + this.MyCustomCommands.getTCData = t, this.MyCustomCommands.getInAppTCData = t; + } + } + }, + { + key: 'displayConsentUi', + value: function () { + at.displayUi('GDPR', 1, !1); + } + }, + { + key: 'init', + value: function (e) { + if (!this.isInitialized) + return this.isInitialized = !0, this.config || (this.config = new ne(e), this.config.initializeConfig()), ct(this.config); + console.warn('init has already been called and should only be run one time.'); + } + }, + { + key: 'getConfig', + value: function () { + var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 'all'; + if (this.config) + switch (e) { + case 'all': + return { + coreConfig: this.config.coreConfig, + coreUiLabels: this.config.coreUiLabels, + premiumProperties: this.config.premiumProperties, + premiumUiLabels: this.config.premiumUiLabels, + theme: this.config.theme, + nonIabVendorsInfo: this.config.nonIabVendorsInfo + }; + case 'Core Config': + return this.config.coreConfig; + case 'Premium Properties': + return this.config.premiumProperties; + case 'Core UI Labels': + return this.config.coreUiLabels; + case 'Premium UI Labels': + return this.config.premiumUiLabels; + case 'Theme': + return this.config.theme; + case 'Non Iab Vendors Info': + return this.config.nonIabVendorsInfo; + default: + var t = ut(this.config); + if (t[e]) + return t[e]; + console.warn('"'.concat(e, '": was not found in configs')); + } + else + console.error('Should run init before running getConfig'); + } + }, + { + key: 'getConfigInstance', + value: function () { + return this.config; + } + }, + { + key: 'getNonIABVendorConsents', + value: function () { + var e = u(a.a.mark(function e(t) { + var n, r, o; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if ('undefined' === typeof this.config) { + e.next = 12; + break; + } + if (!Ne.fetchCookiesCalled) { + e.next = 5; + break; + } + if (Ne.cookieValues.fetched) { + e.next = 5; + break; + } + return e.next = 5, Ne.cookieValues.promise; + case 5: + return n = Le(He.decode, Ne.cookieValues.nonIabVendorConsent), r = null, o = 'USP' !== it && ft(Be.isUserInEU, this.config.coreConfig.displayUi), n && t ? r = ht(n.vendorConsents, t) : n && (r = i({}, n.vendorConsents)), e.abrupt('return', { + gdprApplies: o, + metadata: r ? Ge.encode(i(i({}, n), {}, { cookieName: 'noniabvendorconsent' }), !0) : null, + nonIabVendorConsents: r || null + }); + case 12: + console.log('Config was not found'); + case 13: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + } + ]), e; + }(), _t = function () { + function e() { + var t = this; + p(this, e), this.__uspapi = void 0, this._uspVersion = 1, this.isUspJurisdiction = function () { + var e = u(a.a.mark(function e(n) { + var r, o, i, s; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (r = !0, o = Fe.coreConfig, i = o.uspJurisdiction, o.isAMP) { + e.next = 8; + break; + } + return e.next = 5, Be.checkSpecificLocation(); + case 5: + (s = e.sent) && 'string' === typeof s.region && (s = s.region.toUpperCase()), i.includes(s) || ('function' === typeof n && n({ + version: t._uspVersion, + uspString: '1---' + }, !0), r = !1); + case 8: + return e.abrupt('return', r); + case 9: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t) { + return e.apply(this, arguments); + }; + }(), this.__uspapi = function (e) { + var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, r = arguments.length > 2 ? arguments[2] : void 0, o = arguments.length > 3 ? arguments[3] : void 0; + if (n === t._uspVersion) + if ('function' === typeof r) + try { + void 0 !== o ? t[e](r, o) : t[e](r); + } catch (i) { + console.error('The function '.concat(e, ' is not defined')); + } + else if (void 0 === r) + try { + t[e](); + } catch (i) { + console.error('The function '.concat(e, ' is missing required parameters')); + } + else + console.warn('The third parameter should be a callback for the '.concat(e, ' function')); + else + console.warn('this command is only available for uspVersion 1'); + }; + } + return d(e, [ + { + key: 'initUsp', + value: function () { + var e = this, t = this.__uspapi; + Fe.coreConfig.isAMP && this.getUSPData(function (t) { + t || e.setUspDftData(function (e) { + var t, n; + t = !0, n = { + type: L.CONSENT_RESPONSE, + action: A.ACCEPT, + info: e.uspString, + consentMetadata: { + consentStringType: w.USP, + gdprApplies: !1 + } + }, t && window.parent.postMessage(n, '*'); + }); + }), Object.assign(window, { __uspapi: t }); + } + }, + { + key: 'uspPing', + value: function () { + var e = u(a.a.mark(function e(t) { + var n; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if ('function' !== typeof t) { + e.next = 8; + break; + } + return e.next = 3, Be.checkSpecificLocation(); + case 3: + (n = e.sent) && 'object' === typeof n && (n = n.region), t({ + mode: Fe.coreConfig.privacyMode, + jurisdiction: Fe.coreConfig.uspJurisdiction, + location: n, + cmpLoaded: !0 + }, !0), e.next = 9; + break; + case 8: + console.error('The callback function is missing'); + case 9: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'setUspDftData', + value: function () { + var e = u(a.a.mark(function e(t) { + var n, r, o; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if ('function' !== typeof t) { + e.next = 10; + break; + } + return n = Fe.coreConfig.isAMP ? null : qe.getCookie(), e.next = 4, this.isUspJurisdiction(t); + case 4: + if (e.sent) { + e.next = 7; + break; + } + return e.abrupt('return'); + case 7: + 'string' !== typeof n ? (r = qe.encode(this._uspVersion, !1), Fe.coreConfig.isAMP || qe.setCookie(r), t({ + version: this._uspVersion, + uspString: r + }, !0)) : (o = n.split('')[0], t({ + version: o, + uspString: n + }, !0)), e.next = 11; + break; + case 10: + console.error('The callback function is missing'); + case 11: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'setUspData', + value: function () { + var e = u(a.a.mark(function e(t, n) { + var r; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if ('function' !== typeof t) { + e.next = 10; + break; + } + return r = qe.encode(this._uspVersion, n), e.next = 4, this.isUspJurisdiction(t); + case 4: + if (e.sent) { + e.next = 7; + break; + } + return e.abrupt('return'); + case 7: + 'string' !== typeof r ? t(null, !1) : (Fe.coreConfig.isAMP || qe.setCookie(r), t({ + version: this._uspVersion, + uspString: r, + doNotSell: n + }, !0)), e.next = 11; + break; + case 10: + console.error('The callback function is missing'); + case 11: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function (t, n) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'getUSPData', + value: function () { + var e = u(a.a.mark(function e(t) { + var n, r; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if ('function' !== typeof t) { + e.next = 10; + break; + } + return n = Fe.coreConfig.isAMP ? Fe.ampData.consentMetadata && Fe.ampData.consentMetadata.consentStringType === w.USP && Fe.ampData.consentString : qe.getCookie(), e.next = 4, this.isUspJurisdiction(t); + case 4: + if (e.sent) { + e.next = 7; + break; + } + return e.abrupt('return'); + case 7: + 'string' === typeof n ? (r = n.split('')[0], t({ + version: r, + uspString: n + }, !0)) : t(null, !1), e.next = 11; + break; + case 10: + console.error('The callback function is missing'); + case 11: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'displayUspUi', + value: function () { + var e = u(a.a.mark(function e(t) { + var n, r = arguments; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return n = r.length > 1 && void 0 !== r[1] ? r[1] : 1, e.next = 3, this.isUspJurisdiction(void 0); + case 3: + if (e.sent) { + e.next = 7; + break; + } + return console.warn('cannot display USP UI outside of configured jurisdiction(s)'), e.abrupt('return'); + case 7: + 1 === n && at.displayUi('USP', n); + case 8: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + } + ]), e; + }(), Et = new Ct(), St = new _t(); + }, + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + function (e, t, n) { + e.exports = n(166); + } + ]); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-501fa30f9f8155b71c084d4272d83dbd84a50120 b/resources/sugarcoat-501fa30f9f8155b71c084d4272d83dbd84a50120 new file mode 100644 index 00000000..4a009505 --- /dev/null +++ b/resources/sugarcoat-501fa30f9f8155b71c084d4272d83dbd84a50120 @@ -0,0 +1,205 @@ +{ + const $___mock_d0c2e2703cb522d7 = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_d0c2e2703cb522d7); + (function () { + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + var geo = [ + 'au', + 'nz', + 'in', + 'sg', + 'my', + 'jp', + 'kr' + ]; + var url = 'v1=&v2=' + Marketing.UDO.deals + '&v3=&s1=' + window.location.href + '&s2=' + document.referrer + '&s3=' + Marketing.UDO.promoid; + var fullUrl = 's1=' + window.location.href + '&s2=' + document.referrer + '&s3=' + Marketing.UDO.promoid + '&s4=' + Marketing.UDO.revenue + '&s5=' + Marketing.UDO.prodcat + '&s7=' + Marketing.UDO.ordercode + '&s8=' + Marketing.UDO.category + '&s9=' + Marketing.UDO.family + '&s10=' + Marketing.UDO.product + '&v2=' + Marketing.UDO.deals + '&v5=' + Marketing.scDataObj.country + '&v6=' + Marketing.scDataObj.language + '&v7=' + Marketing.UDO.cseg + '&v8=' + Marketing.scDataObj.segment + '&v9=' + Marketing.UDO.platform + '&v10=' + Marketing.UDO.dpid; + if (geo.indexOf(Dell.Metrics.sc.country) > -1) + Marketing.insertScript('//pixel.mathtag.com/event/js?mt_id=1367447&mt_adid=189166&mt_exem=&' + fullUrl); + if (Marketing.scDataObj.country == 'au' || Marketing.scDataObj.country == 'nz' || Marketing.scDataObj.country == 'in' || Marketing.scDataObj.country == 'jp') + Marketing.insertScript('//pixel.mathtag.com/event/js?mt_id=1325365&mt_adid=189166&mt_exem=&' + url); + if (Marketing.scDataObj.country == 'au' || Marketing.scDataObj.country == 'nz') + Marketing.insertScript('//pixel.mathtag.com/event/img?mt_id=1338479&mt_adid=189166&mt_exem=&mt_excl=&' + url + '&ord=%n'); + if (Marketing.scDataObj.country == 'jp') + Marketing.insertScript('//pixel.mathtag.com/event/js?mt_id=1338482&mt_adid=189166&mt_exem=&mt_excl=&' + url); + if (Marketing.scDataObj.country == 'in') + Marketing.insertScript('//pixel.mathtag.com/event/js?mt_id=1338481&mt_adid=189166&mt_exem=&mt_excl=&' + url); + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3600274, [ + 3506924, + 3606329 + ], 609820, [ + 610310, + 610323 + ]); + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + if (Marketing.UDO.priorconsent) { + var marketingscDataObj = Marketing.scDataObj; + var marketingUDO = Marketing.UDO; + var segID = ''; + var pixelID = ''; + if (marketingscDataObj.segment == 'bsd') + if (marketingscDataObj.page == 'confirmation') { + segID = 'id=1118371&seg=18017873'; + pixelID = '1118371'; + } else { + segID = 'id=1096951&seg=17552822'; + pixelID = '1096951'; + } + if (marketingscDataObj.segment == 'dhs') + if (marketingscDataObj.page == 'confirmation') { + segID = 'id=1020310&seg=14151261'; + pixelID = '1020310'; + } else { + segID = 'id=1020278&seg=14149195'; + pixelID = '1020278'; + } + if (marketingscDataObj.segment == 'eep') + if (marketingscDataObj.page == 'confirmation') { + segID = 'id=1184281&seg=19739814'; + pixelID = '1184281'; + } else { + segID = 'id=1184275&seg=19739730'; + pixelID = '1184275'; + } + if (marketingscDataObj.cms == 'dellemc' || marketingscDataObj.cms == 'delltech' || marketingscDataObj.cms == 'olr') + if (marketingscDataObj.cms == 'olr') { + var firePremierPixel = function () { + if (window.location.href.includes('/cart/thankyou') || marketingUDO.promoid == '100') { + var encodeURL = encodeURIComponent('https://pixel.mediaiqdigital.com/pixel?u1=' + marketingUDO.cid + '&u2=' + marketingUDO.type + '&u3=&u4=&u5=' + marketingUDO.discount + '&u6=' + marketingUDO.dpid + '&u7=' + marketingUDO.currency + '&u8=' + marketingUDO.coupon + '&u9=' + marketingUDO.prodcat + '&u10=' + marketingUDO.country + '&u11=' + marketingUDO.language + '&u12=' + marketingUDO.device + '&u13=' + marketingUDO.platform + '&u14=' + marketingUDO.promoid + '&u15=' + encodeURIComponent(marketingUDO.category) + '&u16=' + marketingUDO.deals + '&u17=' + encodeURIComponent(marketingUDO.family) + '&u18=' + encodeURIComponent(marketingUDO.product) + '&u19=' + marketingUDO.ordercode + '&u20=' + marketingUDO.accountid + '&u21=' + JSON.stringify(marketingUDO.productlist) + '&u22=' + marketingUDO.country + '&pixel_id=1184274&uid=${UID}'); + Marketing.imageRequest('//secure.adnxs.com/px?id=1184274&seg=19739708&order_id=' + marketingUDO.dpid + '&value=' + marketingUDO.revenue + '&redir=' + encodeURL + '&t=2'); + } + }; + firePremierPixel(); + window.addEventListener('hashchange', function (e) { + firePremierPixel(); + }); + } else { + var encodeURL = encodeURIComponent('https://pixel.mediaiqdigital.com/pixel?u1=' + marketingUDO.accountid + '&u2=' + encodeURIComponent(marketingUDO.category) + '&u3=' + marketingUDO.categorypath + '&u4=' + marketingUDO.country + '&u5=' + marketingUDO.cid + '&u6=' + marketingUDO.language + '&u7=' + encodeURIComponent(marketingUDO.family) + '&u8=' + marketingUDO.prodcat + '&u9=' + encodeURIComponent(marketingUDO.product) + '&pixel_id=1184270&uid=${UID}'); + Marketing.imageRequest('//secure.adnxs.com/px?id=1184270&seg=19739702&order_id=' + marketingUDO.dpid + '&value=' + marketingUDO.revenue + '&redir=' + encodeURL + '&t=2'); + } + if (segID != '' && pixelID != '') + if (marketingscDataObj.page == 'confirmation') { + var redirectURL = encodeURIComponent('https://pixel.mediaiqdigital.com/pixel?u1=' + marketingUDO.cid + '&u2=' + marketingUDO.type + '&u3=&u4=&u5=' + marketingUDO.discount + '&u6=' + marketingUDO.dpid + '&u7=' + marketingUDO.currency + '&u8=' + marketingUDO.coupon + '&u9=' + marketingUDO.prodcat + '&u10=' + marketingUDO.country + '&u11=' + marketingUDO.language + '&u12=' + marketingUDO.device + '&u13=' + marketingUDO.platform + '&u14=' + marketingUDO.promoid + '&u15=' + encodeURIComponent(marketingUDO.category) + '&u16=' + marketingUDO.deals + '&u17=' + encodeURIComponent(marketingUDO.family) + '&u18=' + encodeURIComponent(marketingUDO.product) + '&u19=' + marketingUDO.ordercode + '&u20=' + marketingUDO.accountid + '&u21=' + JSON.stringify(marketingUDO.productlist) + '&u22=' + marketingUDO.country + '&pixel_id=' + pixelID + '&uid=${UID}'); + Marketing.imageRequest('//secure.adnxs.com/px?' + segID + '&order_id=' + marketingUDO.dpid + '&value=' + marketingUDO.revenue + '&redir=' + redirectURL + '&t=2'); + } else { + var redirectURL = encodeURIComponent('https://pixel.mediaiqdigital.com/pixel?u1=' + marketingUDO.accountid + '&u2=' + encodeURIComponent(marketingUDO.category) + '&u3=' + marketingUDO.categorypath + '&u4=' + marketingUDO.country + '&u5=' + marketingUDO.cid + '&u6=' + marketingUDO.language + '&u7=' + encodeURIComponent(marketingUDO.family) + '&u8=' + marketingUDO.prodcat + '&u9=' + encodeURIComponent(marketingUDO.product) + '&pixel_id=' + pixelID + '&uid=${UID}'); + Marketing.imageRequest('//secure.adnxs.com/px?' + segID + '&order_id=' + marketingUDO.dpid + '&value=' + marketingUDO.revenue + '&redir=' + redirectURL + '&t=2'); + } + } + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3593378, [3606329], 631706, [610323]); + Marketing.bindDependencyDOMParsed(function () { + const $___old_1c58268aaf64bb74 = {}.constructor.getOwnPropertyDescriptor(window, 'sessionStorage'); + try { + if ($___old_1c58268aaf64bb74) + ({}.constructor.defineProperty(window, 'sessionStorage', $___mock_d0c2e2703cb522d7.sessionStorage)); + return function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + if (Marketing.UDO.priorconsent) { + var buildUrl = function (spotname) { + return '//pixel.mathtag.com/event/img?mt_id=1252537&mt_adid=129805&mt_exem=&mt_excl=&v1=&v2=&v3=&s1=' + window.location.href + '&s2=' + window.document.referrer + '&s3=' + spotname; + }; + var mpvUrl = buildUrl('HVE_Multi_3_page_views'); + Marketing.UDO.hve_mpv(mpvUrl); + var socialUrl = buildUrl('HVE_Social_shares'); + Marketing.UDO.hve_social(socialUrl); + var downloadUrl = buildUrl('HVE_Asset_downloads'); + Marketing.UDO.hve_download(downloadUrl); + var videoUrl = buildUrl('HVE_Video_play'); + Marketing.UDO.hve_ytube(videoUrl); + Marketing.UDO.hve_bcove(videoUrl); + var chatUrl = buildUrl('HVE_Chat'); + Marketing.UDO.hve_chat(chatUrl); + var contactUrl = buildUrl('HVE_ContactUs'); + Marketing.UDO.hve_contactUs(contactUrl); + var rfqSubmitUrl = buildUrl('HVE_rfq_submit'); + Marketing.UDO.hve_rfq_submit(rfqSubmitUrl); + } + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }.apply(this, arguments); + } finally { + if ($___old_1c58268aaf64bb74) + ({}.constructor.defineProperty(window, 'sessionStorage', $___old_1c58268aaf64bb74)); + } + }, 3593358, [3606329], 634023, [610323]); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-646e5b5090e12bb4f057679af94c25920631ff46 b/resources/sugarcoat-646e5b5090e12bb4f057679af94c25920631ff46 new file mode 100644 index 00000000..1740a271 --- /dev/null +++ b/resources/sugarcoat-646e5b5090e12bb4f057679af94c25920631ff46 @@ -0,0 +1,15769 @@ +var _satellite; +{ + const $___mock_3d049bcfecf95e89 = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_3d049bcfecf95e89); + const $___mock_213c2c698e570270 = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_213c2c698e570270); + (function () { + window._satellite = window._satellite || {}, window._satellite.container = { + buildInfo: { + minified: !0, + buildDate: '2022-01-15T14:10:26Z', + turbineBuildDate: '2021-08-11T20:25:49Z', + turbineVersion: '27.2.0' + }, + environment: { + id: 'EN3932511771fb4e5e9dd852ae89372b59', + stage: 'production' + }, + dataElements: { + 'gTag:btnFBPageListMapping': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + '/en-us/printing/design-services.html': 'AddToCart', + '/en-us/printing/small-medium-business-offers.html': 'Lead' + }; + } + } + }, + 'dfa:pageListMapping': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + sg: { + '/en-sg/open-account/personal.html': 'https://9188205.fls.doubleclick.net/activityi;src=9188205;type=invmedia;cat=perso0;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;ord=', + '/en-sg/open-account/corporate.html': ' https://9188205.fls.doubleclick.net/activityi;src=9188205;type=invmedia;cat=corpo00;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;ord=' + }, + tw: { + '/zh-tw/open-account/personal.html?intcmp=BAL-1005245-4-1-962-1000000-APAC-TW-ZH-FY19Q4PACCLNKXA': 'https://9188205.fls.doubleclick.net/activityi;src=9188205;type=invmedia;cat=perso001;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;ord', + '/en-tw/open-account/personal.html?intcmp=BAL-1005245-4-1-962-1000000-APAC-TW-ZH-FY19Q4PACCLNKXA': 'https://9188205.fls.doubleclick.net/activityi;src=9188205;type=invmedia;cat=perso001;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;ord' + } + }; + } + } + }, + 'content:locale': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.page.pageInfo.locale' } + }, + dotTagPixelId: { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = window.location.href; + pixelIds = _satellite.getVar('dotTagPixelMapping'); + var t = ''; + if (void 0 !== e && '' != e && 'undefined' != typeof pixelIds && '' != pixelIds) + for (var n in pixelIds) + e.indexOf(n) > 0 && (t = pixelIds[n]); + return t; + } + } + }, + 'gTag:DFAPageListMapping': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return [ + '/en-my/shipping/fedex-rewards.html', + '/en-nz/shipping/fedex-rewards.html', + '/en-au/small-business/delighting-customers/rewards-programs-benefits.html', + '/en-nz/small-business/delighting-customers/rewards-programs-benefits.html', + '/en-ph/shipping/fedex-rewards.html', + '/th-th/shipping/fedex-rewards.html', + '/en-my/small-business/delighting-customers/rewards-programs-benefits.html', + '/en-ph/small-business/delighting-customers/rewards-programs-benefits.html', + '/th-th/small-business/delighting-customers/rewards-programs-benefits.html', + '/zh-cn/shipping/fedex-rewards.html', + '/zh-cn/small-business/delighting-customers/rewards-programs-benefits.html', + '/en-my/small-business.html', + '/en-ph/small-business.html', + '/en-au/small-business/success-journey/facts-benefits-grants.html', + '/en-my/small-business/success-journey/facts-benefits-grants.html', + '/en-ph/small-business/success-journey/facts-benefits-grants.html', + '/en-au/small-business/streamline-operations/tips-for-efficient-effective-shipping.html', + '/en-my/small-business/streamline-operations/tips-for-efficient-effective-shipping.html', + '/en-ph/small-business/streamline-operations/tips-for-efficient-effective-shipping.html', + '/en-au/small-business/accelerating-digital/digitalize-customs-documents.html', + '/en-au/small-business/accelerating-digital/opportunities-for-ecommerce-business.html', + '/en-au/small-business/adapt-innovate/sustainable-supply-chain.html', + '/en-my/small-business/accelerating-digital/digitalize-customs-documents.html', + '/en-my/small-business/accelerating-digital/opportunities-for-ecommerce-business.html', + '/en-my/small-business/adapt-innovate/sustainable-supply-chain.html', + '/en-ph/small-business/accelerating-digital/digitalize-customs-documents.html', + '/en-ph/small-business/accelerating-digital/opportunities-for-ecommerce-business.html', + '/en-ph/small-business/adapt-innovate/sustainable-supply-chain.html', + '/en-sg/small-business/success-journey/facts-benefits-grants.html', + '/en-sg/small-business/streamline-operations/tips-for-efficient-effective-shipping.html', + '/en-sg/small-business/accelerating-digital/digitalize-customs-documents.html', + '/en-sg/small-business/accelerating-digital/opportunities-for-ecommerce-business.html', + '/en-sg/small-business/adapt-innovate/sustainable-supply-chain.html' + ]; + } + } + }, + 'content:language': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.page.pageInfo.language' } + }, + 'content:historicalPageName': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.page.pageInfo.historicalPageName' } + }, + 'gTag:ConfigIDMapping': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + us: { + DCConfigID: 'DC-4191263', + AWConfigID: 'AW-863238793' + }, + ca: { + DCConfigID: 'DC-4191263', + AWConfigID: 'AW-1015767490' + }, + za: { + DCConfigID: '', + AWConfigID: '698520817' + }, + au: { + DCConfigID: '', + AWConfigID: 'AW-683987082' + }, + nz: { + DCConfigID: '', + AWConfigID: 'AW-683987082' + }, + co: { + DCConfigID: 'DC-2526289', + AWConfigID: '' + }, + cl: { + DCConfigID: 'DC-2526289', + AWConfigID: '' + }, + br: { + DCConfigID: 'DC-2526289', + AWConfigID: '' + }, + mx: { + DCConfigID: 'DC-2526289', + AWConfigID: '' + }, + kr: { + DCConfigID: 'DC-9929969', + AWConfigID: '' + }, + tw: { + DCConfigID: 'DC-9929969', + AWConfigID: '' + }, + sg: { + DCConfigID: 'DC-9929969', + AWConfigID: '' + }, + hk: { + DCConfigID: 'DC-9929969', + AWConfigID: '' + }, + jp: { + DCConfigID: 'DC-9929969', + AWConfigID: '' + } + }; + } + } + }, + 'content:page name': { + defaultValue: 'no pageName found', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var e = _fdx.pcfUtil(), t = ''; + e.match(/www(sbox.idev|base.idev|dev.idev|drt.idev|stress.dmz.idev|bit.idev|test|).fedex.com/gi) ? t = 'fedex/' : e.match(/(webapp.dev.|www.|)ftn.fedex.com/gi) && (t = 'ftn/'); + var n = _satellite.getVar('content:pagePath'); + return t != n.slice(0, t.length) && (n = t + n), n; + } + } + }, + 'aam:countryFlag': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('aam:countries'), t = _satellite.getVar('content:countryCode'), n = void 0 !== t && '' !== t ? t : ''; + return '' !== n && e.indexOf(n) > -1; + } + } + }, + 'content:countryCode': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.page.pageInfo.country' } + }, + 'verizon:pageList': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = 'https://sp.analytics.yahoo.com/spp.pl?a=10000&.yp=10092907&ec='; + return { + '/en-ca/shipping-services/international-shipping/regulatory-form/thank-you.html': e + 'FedEx_Regulatory_Form_Thank_You_English', + '/fr-ca/shipping-services/international-shipping/regulatory-form/thank-you.html': e + 'FedEx_Regulatory_Form_Thank_You_French', + '/en-ca/shipping-services/international-shipping.html': e + 'FedEx_International_Shipping_EN', + '/fr-ca/shipping-services/international-shipping.html': e + 'FedEx_International_Shipping_FR', + '/en-ca/shipping-services/international-shipping/offer/thank-you.html': e + 'FedEx_Additional_Thank_You_Page_English', + '/fr-ca/shipping-services/international-shipping/offer/thank-you.html': e + 'FedEx_Additional_Thank_You_Page_French', + '/fr-ca/shipping-services/express-freight.html': e + 'FedEx_Additional_Thank_You_Page_French123', + '/en-ca/ecommerce-shipping/support-for-your-customers.html': 'https://sp.analytics.yahoo.com/spp.pl?a=10000&.yp=1016798&ec=FedEx_support_for_your_customers_English', + '/en-ca/manage-my-deliveries.html': 'https://sp.analytics.yahoo.com/spp.pl?a=10000&.yp=10167700&ec=FedEx_manage_my_deliveries_English', + '/fr-ca/ecommerce-shipping/support-for-your-customers.html': 'https://sp.analytics.yahoo.com/spp.pl?a=10000&.yp=10167702&ec=FedEx_support_for_your_customers_French', + '/fr-ca/manage-my-deliveries.html': 'https://sp.analytics.yahoo.com/spp.pl?a=10000&.yp=10167704&ec=FedEx_manage_my_deliveries_French' + }; + } + } + }, + 'user:emailID': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'et_rid', + caseInsensitive: !0 + } + }, + 'search:spData': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.search.result' } + }, + 'user:user-agent': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'navigator.userAgent' } + }, + 'content:deviceType': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = ''; + return window.matchMedia('(min-width: 993px)').matches && (e = 'desktop'), window.matchMedia('(max-width: 992px)').matches && (e = 'tablet'), window.matchMedia('(max-width: 767px)').matches && (e = 'mobile'), e; + } + } + }, + 'gTag:btnOrangeAWPageListMapping': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + signUpContinueButton: 'AW-863238793/SpG1CPrq3NwBEIn1z5sD', + submitPinButton: 'AW-863238793/np2DCK7--NwBEIn1z5sD' + }; + } + } + }, + AllowedProdDomains: { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return [ + 'spain.fedex.com', + 'internationalshippingassist.van.fedex.com', + 'weblets.dmz.apac.fedex.com', + 'getrewards.fedex.com', + 'local.fedex.com' + ]; + } + } + }, + appName: { + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.page.category.appName' } + }, + 'click:blockFlag': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return window.isBlocked = function (e, t) { + var n = _satellite.getVar(t); + if (n.length > 0) + for (var r = 0; r < n.length; r++) + if (n[r].toString().toLowerCase() == e.toLowerCase()) + return !0; + return !1; + }, isBlocked; + } + } + }, + TargetRegions: { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return 'us, can, apac, lac, meisa, eu'; + } + } + }, + 'dotTag:enabledPageList': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + '/en-us/possibilities.html': { + startTime: '', + endTime: '1590969599000' + }, + '/en-us/holiday/consumer-shipping-delivery-guide.html': { + startTime: '', + endTime: '' + }, + '/en-ca/shipping-services/international-shipping.html': { + startTime: '1578268799000', + endTime: '1588550399000' + }, + '/fr-ca/shipping-services/international-shipping.html': { + startTime: '1578268799000', + endTime: '1588550399000' + }, + '/en-us/holiday.html': { + startTime: '', + endTime: '' + }, + '/en-us/coupon-offers/ground.html': { + startTime: '', + endTime: '' + }, + '/en-us/shipping/onsite/walgreens-package-pickup.html': { + startTime: '', + endTime: '' + }, + '/en-us/healthcare/vaccine-shipping.html': { + startTime: '', + endTime: '' + }, + '/en-us/ecommerce/offer-store-pickup-at-checkout.html': { + startTime: '', + endTime: '' + }, + 'en-ca/shipping-tools/freight-quote-no-account.html': { + startTime: '', + endTime: '' + }, + 'en-ca/shipping-tools/freight-quote.html': { + startTime: '', + endTime: '' + }, + 'en-ca/shipping-services/express-freight.html': { + startTime: '', + endTime: '' + }, + 'fr-ca/shipping-tools/freight-quote-no-account.html': { + startTime: '', + endTime: '' + }, + 'fr-ca/shipping-tools/freight-quote.html': { + startTime: '', + endTime: '' + }, + 'fr-ca/shipping-services/express-freight.html': { + startTime: '', + endTime: '' + }, + '/en-ca/small-business/ecommerce-solutions.html': { + startTime: '', + endTime: '' + }, + '/fr-ca/small-business/ecommerce-solutions.html': { + startTime: '', + endTime: '' + }, + '/en-ca/small-business.html': { + startTime: '', + endTime: '' + }, + '/fr-ca/small-business.html': { + startTime: '', + endTime: '' + }, + '/en-ca/shipping-services/express-freight/international-air-freight-quote.html': { + startTime: '', + endTime: '' + }, + '/fr-ca/shipping-services/express-freight/international-air-freight-quote.html': { + startTime: '', + endTime: '' + }, + '/en-ca/careers.html': { + startTime: '', + endTime: '' + }, + '/fr-ca/careers.html': { + startTime: '', + endTime: '' + }, + '/en-ca/shipping-services/healthcare.html': { + startTime: '', + endTime: '' + }, + '/fr-ca/shipping-services/healthcare.html': { + startTime: '', + endTime: '' + }, + '/en-ca/shipping-services/healthcare/contact-us.html': { + startTime: '', + endTime: '' + }, + '/fr-ca/shipping-services/healthcare/contact-us.html': { + startTime: '', + endTime: '' + } + }; + } + } + }, + 'tradedesk:btnClickPageListMapping': { + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + 'link|sign up for free': '//insight.adsrvr.org/track/pxl/?adv=suentvba&ct=0:lanti6d&fmt=3', + 'link|find a dollar general': '//insight.adsrvr.org/track/pxl/?adv=suentvba&ct=0:ye9n18n&fmt=3', + 'hero|find a walgreens near you': '//insight.adsrvr.org/track/pxl/?adv=suentvba&ct=0:z0a6on6&fmt=3', + 'hero|see current offers': '//insight.adsrvr.org/track/pxl/?adv=suentvba&ct=0:8z4fbh4&fmt=3', + 'link|sign up now': '//insight.adsrvr.org/track/pxl/?adv=suentvba&ct=0:kf06v61&fmt=3', + 'link|next time use fedex delivery manager|sign up for free': '//insight.adsrvr.org/track/pxl/?adv=suentvba&ct=0:9pyni6r&fmt=3' + }; + } + } + }, + 'va:caasDisabledCountryList': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = [ + 'vi_vn', + 'es_us' + ], t = _fdx.pageFlag(e, _satellite.getVar('content:locale')), n = [ + '/fedextrack/', + '/fedextracking/' + ], r = window.location.pathname, i = _fdx.pageFlag(n, r); + return !t || !i; + } + } + }, + 'gTag:btnOrangeDCPageListMapping': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + signUpContinueButton: 'DC-4191263/fdmen0/fdm-i0+standard', + submitPinButton: 'DC-4191263/fdmen0/fdm-c0+standard' + }; + } + } + }, + 'va:caasEnabledCountryListNew': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return [ + 'fr_ch', + 'de_ch', + 'it_ch', + 'en_br', + 'pt_br', + 'en_mx', + 'en_ar', + 'en_bo', + 'en_cl', + 'en_co', + 'en_cr', + 'en_do', + 'en_sv', + 'en_gt', + 'en_hn', + 'en_ni', + 'en_pa', + 'en_py', + 'en_pe', + 'en_pr', + 'en_uy', + 'en_ve', + 'en_bz', + 'en_ai', + 'en_ag', + 'en_gf', + 'en_gy', + 'en_sr', + 'en_aw', + 'en_bs', + 'en_bb', + 'en_bm', + 'en_bq', + 'en_vg', + 'en_ky', + 'en_cw', + 'en_dm', + 'en_jm', + 'en_ms', + 'en_mf', + 'en_sx', + 'en_kn', + 'en_lc', + 'en_vc', + 'en_tt', + 'en_tc', + 'en_vi', + 'en_gp', + 'en_mq', + 'en_ht', + 'en_gb', + 'fr_ca', + 'en_ca', + 'en_ch', + 'es_mx', + 'es_ar', + 'es_bo', + 'es_cl', + 'es_co', + 'es_cr', + 'es_do', + 'es_ec', + 'es_sv', + 'es_gt', + 'es_hn', + 'es_ni', + 'es_pa', + 'es_py', + 'es_pe', + 'es_pr', + 'es_uy', + 'es_ve', + 'en_in', + 'en_ae', + 'en_za' + ]; + } + } + }, + 'aam:IdSyncDisable': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return 'false'; + } + } + }, + 'track:btnMapping': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + 'trk-landingPage1TrackingNumbersPresent': 'Tracking Number|TRACK', + 'trk-trackByTCN-TrackBtn': 'Track by TCN|TRACK', + 'trk-landingpage-viewPodSubmitButton': 'Obtain POD|View POD|SUBMIT', + 'trk-trackByReference-TrackBtn': 'Track By Reference|TRACK', + 'trk-landingPage-track-helpLink': 'Track|NEED HELP' + }; + } + } + }, + 'gTag:ctaOrangeDCPageListMapping': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + '/en-ca/shipping-services/international-shipping.html': 'DC-974714/fedex0/fedex0+standard', + '/fr-ca/shipping-services/international-shipping.html': 'DC-974714/fedex0/fedex00+standard', + '/en-us/delivery-manager.html': 'DC-4191263/fdmen0/fdmla000+standard', + '/en-us/printing/consumer-offers.html': 'DC-4191263/consu0/fedex00+standard', + '/en-us/shipping/onsite/walgreens-package-pickup.html': 'DC-4191263/walgr0/fedex00+standard' + }; + } + } + }, + 'content:Delayed Page Type': { + defaultValue: 'normal', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.page.pageInfo.delayType' } + }, + dotTagPixelMapping: { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + '/en-us/possibilities.html': '10006458', + '/en-us/holiday/consumer-shipping-delivery-guide.html': '10006458', + '/en-ca/shipping-services/international-shipping.html': '10092907', + '/fr-ca/shipping-services/international-shipping.html': '10092907', + '/en-us/holiday.html': '10006458', + '/en-us/coupon-offers/ground.html': '10142227', + '/en-us/shipping/onsite/walgreens-package-pickup.html': '10142227', + '/en-us/healthcare/vaccine-shipping.html': '10142227', + '/en-us/ecommerce/offer-store-pickup-at-checkout.html': '10142227', + '/en-ca/shipping-tools/freight-quote-no-account.html': '10145670', + '/en-ca/shipping-tools/freight-quote.html': '10149609', + '/en-ca/shipping-services/express-freight.html': '10145673', + '/fr-ca/shipping-tools/freight-quote-no-account.html': '10145682', + '/fr-ca/shipping-tools/freight-quote.html': '10149610', + '/fr-ca/shipping-services/express-freight.html': '10145684', + '/en-ca/small-business/ecommerce-solutions.html': '10147631', + '/fr-ca/small-business/ecommerce-solutions.html': '10147632', + '/en-ca/small-business.html': '10147633', + '/fr-ca/small-business.html': '10147634', + '/en-ca/shipping-services/express-freight/international-air-freight-quote.html': '10149505', + '/fr-ca/shipping-services/express-freight/international-air-freight-quote.html': '10149506', + '/en-ca/careers.html': '10158193', + '/fr-ca/careers.html': '10158194' + }; + } + } + }, + 'gTag:EnabledLocaleEpic': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return _satellite.getVar('content:locale').match(/ar_ae|en_ae|en_bh|en_br|en_cl|en_cn|en_co|en_kw|en_mx|en_za|es_cl|es_co|es_mx|pt_br|zh_cn/gi); + } + } + }, + 'app:shipSegIds': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return '8092686'; + } + } + }, + 'gTag:AdWordsEventMapping': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + us: { + '/en-us/possibilities.html': 'AW-863238793/ysZTCMOR74YBEIn1z5sD', + '/en-us/shipping/onsite.html': 'AW-863238793/0ZuFCNzX5YYBEIn1z5sD', + '/en-us/shipping/packing.html': 'AW-863238793/jrp5COqC74YBEIn1z5sD', + '/en-us/shipping/store/ground.html': 'AW-863238793/EAXYCPSD74YBEIn1z5sD', + '/en-us/delivery-manager/business-toolkit.html': 'AW-863238793/9nDvCIj77LcBEIn1z5sD', + '/en-us/shipping/returns/business.html': 'AW-863238793/b6IdCLfnh7gBEIn1z5sD', + '/en-us/shipping/international/how-to-ship.html': 'AW-863238793/bZs3CKHph7gBEIn1z5sD', + '/en-us/shipping/7-day-delivery.html': 'AW-863238793/bjnQCOqJ7bcBEIn1z5sD', + '/en-us/ecommerce/fulfillment-shipping.html': 'AW-863238793/tKSLCLXr_LcBEIn1z5sD', + '/en-us/discount-programs/ag13398602.html': '/en-us/discount-programs/ag13398602.html', + '/en-us/ecommerce.html': 'AW-863238793/pg44CPOH6MIBEIn1z5sD', + '/en-us/big-commerce.html': 'AW-863238793/OAfRCLGTyM0BEIn1z5sD', + '/en-us/printing/small-medium-business-offers.html': 'AW-863238793/_wfuCKPQtc8BEIn1z5sD', + '/en-us/printing/design-services.html': 'AW-863238793/ViUiCK2nntABEIn1z5sD', + '/en-us/delivery-manager.html': 'AW-863238793/eS7bCMrh3NwBEIn1z5sD', + '/en-us/delivery-manager/manage-your-deliveries.html': 'AW-863238793/nUeFCLDv5dwBEIn1z5sD', + '/en-us/holiday/consumer-shipping-delivery-guide.html': 'AW-863238793/F5v5CJ_KruEBEIn1z5sD', + '/en-us/holiday.html': 'AW-863238793/K_AyCP61k-EBEIn1z5sD', + '/en-us/printing/consumer-offers.html': 'AW-863238793/i37fCNXpkOIBEIn1z5sD', + '/en-us/shipping/onsite/walgreens-package-pickup.html': 'AW-863238793/COsKCMeEheIBEIn1z5sD', + '/en-us/printing/flash-sale-offers.html': 'AW-863238793/C402CO_9kOIBEIn1z5sD', + '/en-us/shipping/onsite/dollar-general-pick-up-drop-off-package.html': 'AW-863238793/SY0qCN678-EBEIn1z5sD', + '/en-us/shipping/hold-at-location.html': 'AW-863238793/m0FxCJq1luMBEIn1z5sD', + '/en-us/coupon-offers/ground.html': 'AW-863238793/VmlwCIOy-eEBEIn1z5sD', + '/en-us/healthcare/vaccine-shipping.html': 'AW-863238793/vFzsCOfqnPEBEIn1z5sD', + '/en-us/ecommerce/offer-store-pickup-at-checkout.html': 'AW-863238793/RCSLCIP_lfMBEIn1z5sD', + '/en-us/shipping/returns/technology.html': 'AW-863238793/TLyYCMP7zO0BEIn1z5sD', + '/en-us/ecommerce/shipping-options.html': 'AW-863238793/S0a4CMOg8O0BEIn1z5sD', + '/en-us/shipping/international.html': 'AW-863238793/vCwCCKm53-0BEIn1z5sD', + '/en-us/shipping/home-delivery.html': 'AW-863238793/OE39CMr3ze0BEIn1z5sD', + '/en-us/ecommerce/tools-and-services.html': 'AW-863238793/I3YYCI3KlO4BEIn1z5sD', + '/en-us/sweepstakes/come-in-and-cash-in.html': 'AW-863238793/srUBCOPPpfMCEIn1z5sD', + '/en-us/sweepstakes.html': 'AW-863238793/VXr4COuLpvMCEIn1z5sD', + '/en-us/sweepstakes/holiday-drop-off.html': 'AW-863238793/rMVnCKiTpvMCEIn1z5sD', + '/en-us/shipping/saturday-and-sunday-delivery.html': 'AW-863238793/AVvHCPOQpvMCEIn1z5sD', + '/en-us/small-business/grant-contest.html': 'AW-863238793/R_lUCIDbpfMCEIn1z5sD' + }, + za: { + '/en-za/about/possibilities.html': 'AW-698520817/ZsfzCP-iqrMBEPGpis0C', + '/en-za/open-account.html': 'AW-698520817/XRq6CJvnnbMBEPGpis0C', + '/en-za/campaign/delivering-what-matters.html': 'AW-634373607/apJKCLqF4dEBEOeLv64C' + }, + au: { + '/en-au/campaign/tt.html': 'AW-683987082/8rSoCNDBkLgBEIqhk8YC', + '/en-au/new-customer.html': 'AW-683987082/pr-rCJ_bhbgBEIqhk8YC' + }, + nz: { + '/en-nz/campaign/tt.html': 'AW-683987082/cqjWCPLghbgBEIqhk8YC', + '/en-nz/new-customer.html': 'AW-683987082/eT7tCPyG9rcBEIqhk8YC' + }, + in: { '/en-in/open-account/thank-you.html': 'AW-1066501107/zAjuCIXa8gEQ84fG_AM' }, + ca: { + '/en-ca/ecommerce-shipping/support-for-your-customers.html': 'AW-1033577797/t7gpCLSZmPwCEMXK7OwD', + '/fr-ca/ecommerce-shipping/support-for-your-customers.html': 'AW-1033577797/be3XCPLlmfwCEMXK7OwD', + '/en-ca/manage-my-deliveries.html': 'AW-1033577797/aCwBCLCj8fsCEMXK7OwD', + '/fr-ca/manage-my-deliveries.html': 'AW-1033577797/DfIbCITKmfwCEMXK7OwD' + } + }; + } + } + }, + 'content:site section': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.page.category.primaryCategory' } + }, + 'event:vaClick': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.VA.status' } + }, + 'content:pagePath': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.page.pageInfo.pagePath' } + }, + 'va:disabledPageList': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return [ + '/customer-support.html', + '/contact-us.html', + '/es-us/', + '/fr-mq', + '/en-us/servicealert.html', + '/quick-help', + '/da-dk/', + '/no-no/', + '/sv-se/', + '/fr-gp/', + '/fr-ht/', + '/vi-vn/', + '/ar-ae/', + '/office/samsung-repair.html', + '/space.html', + '/en-us/office/psg', + '/en-us/trust-center', + '/en-us/create-account.html', + '/en-us/discount-programs', + '/en-us/ecommerce', + '/en-us/small-business', + '/small-business.html', + '/en-gb/', + '/en-ie/', + '/en-dk/', + '/en-no/', + '/en-se/', + '/en-nl/', + '/nl-nl/', + '/en-fr/', + '/fr-fr/', + '/en-it/', + '/it-it/', + '/en-be/', + '/fr-be/', + '/nl-be/', + '/en-es/', + '/es-es/', + '/en-at/', + '/en-de/', + '/de-de/', + '/en-pl/', + '/pl-pl/' + ]; + } + } + }, + 'site-diagnostics:viewport': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = ''; + return void 0 !== FDX.BREAKPOINTS && (e = void 0 !== FDX.BREAKPOINTS.getViewPort() ? FDX.BREAKPOINTS.getViewPort() : ''), e; + } + } + }, + 'login:fdx_cbid': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return void 0 !== _satellite.cookie.get('fdx_cbid') ? _satellite.cookie.get('fdx_cbid') : ''; + } + } + }, + 'Target:at_property': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = '', t = _satellite.getVar('content:region'); + return 'undefined' != t && '' !== t && ('us' == t ? e = '4ba065c0-6b92-13a5-ccc8-2b8cfb21abda' : 'can' == t ? e = 'c24210ff-8c64-9160-3a7b-fdc4984a7460' : 'apac' == t ? e = 'eb6416d7-0a64-92d9-37d0-c62d5b6e16ed' : 'lac' == t ? e = 'b17e3322-af50-bf7f-cb8b-90ca7daecf49' : 'meisa' == t ? e = '1eaecaf5-a324-c82e-7e0e-33d6251cfdb8' : 'eu' == t && (e = '192423ee-c1c9-66df-804d-5fb7347535bc')), e; + } + } + }, + 'PCF:Util': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('AllowedProdDomains'), t = window.location.hostname; + return null != t.match(/www(base.idev|dev.idev|drt.idev|stress.dmz.idev|bit.idev|test|).fedex.com/gi) ? t : e.length > 0 && e.indexOf(t) > -1 ? 'www.fedex.com' : 'wwwtest.fedex.com'; + } + } + }, + 'aam:RegionContainerNSID': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = '' !== _satellite.getVar('aam:containerNSIDMapping') ? _satellite.getVar('aam:containerNSIDMapping') : '', t = 0, n = _satellite.getVar('content:region'), r = FDX.DATALAYER.page.pageInfo.locale; + if (null != /[a-z]{2}_[a-z]{2}/g.exec(r) && 5 == r.length) { + if (void 0 !== e && '' !== e) + for (var i in e) + if (n.toLowerCase().indexOf(i) > -1) { + t = e[i]; + break; + } + } else + t = 0; + return parseInt(t); + } + } + }, + gTagDisableLocale: { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return _satellite.getVar('content:locale').match(/en_at|de_at|nl_be|fr_be|en_be|bg_bg|en_bg|en_cy|cs_cz|en_cz|da_dk|en_dk|et_ee|en_ee|fi_fi|en_fi|fr_fr|en_fr|en_de|de_de|en_gr|el_gr|en_hu|hu_hu|en_is|en_ie|en_it|it_it|en_lv|lv_lv|en_li|en_lt|lt_lt|fr_lu|en_lu|en_mt|en_no|no_no|en_pl|pl_pl|en_pt|pt_pt|en_ro|ro_ro|en_sk|sk_sk|en_si|sl_si|en_es|es_es|en_se|sv_se|nl_nl|en_nl|en_gb|en_th|th_th|en_ph|en_my|en_cn|zh_cn/gi); + } + } + }, + 'qualtrics:pageListMapping': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return [ + '/en-us/get-started.html', + '/en-us/coupon-offers.html', + '/en-us/coupon-offers/ground.html', + '/en-us/office/walmart.html', + '/en-us/printing.html', + '/en-us/shipping/dropbox.html', + '/en-us/shipping/hold-at-location.html', + '/en-us/shipping/onsite.html', + '/en-us/shipping/packing-boxes/services.html', + '/en-us/shipping/packing-supplies.html', + '/en-us/shipping/store/ground.html', + '/en-us/tracking.html', + '/en-us/billing-online.html', + '/en-us/create-account.html', + '/en-us/create-account/account-management.html', + '/en-us/shipping.html', + '/en-us/shipping/2-3-day.html', + '/en-us/shipping/fedex-smartpost.html', + '/en-us/shipping/ground.html', + '/en-us/shipping/home-delivery.html', + '/en-us/shipping/international-ground-canada.html', + '/en-us/shipping/overnight.html', + '/en-us/shipping/same-day.html', + '/en-us/shipping/schedule-manage-pickups.html', + '/en-us/shipping/services.html', + '/en-us/customer-support.html', + '/en-us/customer-support/claims.html', + '/en-us/service-guide.html', + '/en-us/service-guide/pickup-delivery.html', + '/en-us/shipping/mobile.html', + '/en-us/faq/delivery-manager.html', + '/en-us/shipping/store/shipping-services.html', + '/en-us/shipping/onsite/walgreens-package-pickup.html', + '/en-us/printing/online-printing.html', + '/en-us/shipping/store/all-location-types.html', + '/en-tw/campaign/getstarted.html', + '/zh-tw/campaign/getstarted.html', + '/en-jp/online/shipping.html', + '/en-jp/online/shipping.html#/shipment', + '/ja-jp/online/shipping.html', + '/en-us/customer-support/how-to/door-tag.html', + '/en-us/customer-support/how-to/schedule-a-pickup.html', + '/en-ca/shipping-services/international.html', + '/en-ca/shipping-services/international/export.html', + '/en-au/online/shipping.html', + '/en-nz/online/shipping.html', + '/en-au/campaign/small-business.html', + '/en-nz/campaign/small-business.html', + '/en-us/online/rating.html', + '/zh-hk/open-account.html', + '/en-hk/open-account.html', + '/zh-cn/campaign/frontdoor.html', + '/zh-tw/campaign/frontdoor.html', + '/ja-jp/campaign/frontdoor.html', + '/ko-kr/campaign/frontdoor.html', + '/en-ca/small-business.html', + '/fr-ca/small-business.html', + '/en-au/billing.html', + '/en-gu/billing.html', + '/en-hk/billing.html', + '/zh-hk/billing.html', + '/en-jp/billing.html', + '/ja-jp/billing.html', + '/en-kr/billing.html', + '/ko-kr/billing.html', + '/en-mo/billing.html', + '/en-my/billing.html', + '/en-nz/billing.html', + '/en-ph/billing.html', + '/en-sg/billing.html', + '/en-tw/billing.html', + '/zh-tw/billing.html', + '/en-th/billing.html', + '/th-th/billing.html', + '/en-us/developer.html', + '/en-us/developer/web-services.html', + '/en-us/developer/web-services/process.html', + '/en-ca/contact-us.html', + '/fr-ca/contact-us.html', + '/en-in/online/shipping.html', + '/en-cn/online/shipping.html', + '/th-th/online/shipping.html', + '/en-th/online/shipping.html', + '/zh-hk/online/shipping.html', + '/en-hk/online/shipping.html', + '/zh-cn/online/shipping.html', + '/en-af/online/shipping.html', + '/en-al/online/shipping.html', + '/en-dz/online/shipping.html', + '/en-ao/online/shipping.html', + '/en-am/online/shipping.html', + '/en-my/online/shipping.html', + '/en-sg/online/shipping.html', + '/en-ph/online/shipping.html', + '/en-ae/online/shipping.html', + '/shipment-history/en-th/', + '/shipment-history/zh-cn/', + '/shipment-history/zh-hk/', + '/shipment-history/ja-jp/', + '/shipment-history/en-gb/', + '/shipment-history/en-hk/', + '/shipment-history/en-pl/', + '/shipment-history/en-in/', + '/shipment-history/en-nl/', + '/shipment-history/nl-nl/', + '/shipment-history/en-cn/', + '/shipment-history/en-jp/', + '/shipment-history/pl-pl/', + '/shipment-history/th-th/', + '/shipment-history/en-au/', + '/shipment-history/en-id/', + '/shipment-history/id-id/', + '/shipment-history/ko-kr/', + '/shipment-history/en-kr/', + '/shipment-history/en-my/', + '/shipment-history/en-nz/', + '/shipment-history/en-sg/', + '/en-us/shipping/international.html', + '/en-us/office.html', + '/en-us/shipping/one-rate.html', + '/en-us/shipping/freight.html', + '/en-us/home.html' + ]; + } + } + }, + 'va:mobEnabledUrl': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = '/tracking/advanced.html'; + return [ + '/en-us' + e, + '/en-ca' + e, + '/fr-ca' + e, + '/de-ch' + e, + '/fr-ch' + e, + '/it-ch' + e, + '/en-ch' + e, + '/en-ca/delivery-manager/personal.html', + '/fr-ca/delivery-manager/personal.html', + '/en-ca/manage-my-deliveries.html', + '/fr-ca/manage-my-deliveries.html', + '/en-ca/resources-tools/billing-centre.html', + '/fr-ca/resources-tools/billing-centre.html', + '/en-ca/shipping-services/international/duties-taxes.html', + '/fr-ca/shipping-services/international/duties-taxes.html', + '/en-ca/shipping-services/international/import.html', + '/fr-ca/shipping-services/international/import.html', + '/de-ch/tracking.html', + '/fr-ch/tracking.html', + '/it-ch/tracking.html', + '/en-ch/tracking.html', + '/de-ch/new-customer.html', + '/fr-ch/new-customer.html', + '/it-ch/new-customer.html', + '/en-ch/new-customer.html', + '/de-ch/shipping.html', + '/fr-ch/shipping.html', + '/it-ch/shipping.html', + '/en-ch/shipping.html', + '/de-ch/home.html', + '/fr-ch/home.html', + '/it-ch/home.html', + '/en-ch/home.html' + ]; + } + } + }, + 'tagID:contentSquare': { + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'), 'www.fedex.com' === _fdx.pcfUtil() ? '9c072ebd-0d9a-4b37-9e54-ba0c3bb0588d' : '23a9c2f8-aeb4-454c-be37-8861285e9d0c'; + } + } + }, + 'click:blockList': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return [ + 'hold at location,false', + 'international traffic in arms regulations,false', + 'delivery on invoice acceptance,false', + 'save dia return address,false', + 'returns clearance,false', + 'trk-landingpage1trackingnumberspresent', + 'trk-summarypage-trackbtn', + 'mtrk-detailpage-cdo-button', + 'trk-landingpage-trackbtn', + 'mtrk-detailpage-sendnotifycheckbox-current', + 'trk-detailpage-sendnotifycheckbox-current', + 'trk-trackbyreference-accountnumber', + 'trk-detailpage-asscshipmenticon', + 'mtrk-notificationpage', + 'mtrk-trk-detailpage-sendnotifycheckbox-deliveryexception', + 'trk-detailpage-sendnotifycheckbox-deliveryexception', + 'trk-detailpage-sendnotifycheckbox-delivered', + 'mtrk-detailpage-sendnotifycheckbox-delivered', + 'mtrk-detailpage-sendnotifycheckbox-exception', + 'trk-detailpage-sendnotifycheckbox-exception', + 'trk-detailpage-actionbar-moreactions_header', + 'trk-trackmodule-placard-pressed', + 'mtrk-detailpage-scheduleddeliverydateicon', + 'trk-detailpage-sendnotifycontinuebtn', + 'trk-detailpage-sendnotifydeliveredstatusselected', + 'mtrk-detailpage-sendnotifycontinuebtn', + 'trk-detailpage-sendnotifyestdelupdatestatusselected', + 'mtrk-detailpage-sendnotifydeliveredstatusselected', + 'trk-detailpage-sendnotifycurrenrstatusselected', + 'mtrk-detailpage-sendnotifycurrenrstatusselected', + 'trk-trackmodule-watchlisttab', + 'mtrk-detailpage-sendnotifyestdelupdatestatusselected', + 'trk-detailpage-sendnotifyexceptionsstatusselected', + 'mtrk-trackmodule-allshipmentstab', + 'trk-detailpage-shipmentsnapshot-destination-help', + 'trk-detailpage-timezonedropdown', + 'mtrk-detailpage-sendnotifycheckbox-tendered', + 'trk-detailpage-sendnotifycheckbox-tendered', + 'mtrk-detailpage-sendnotifyexceptionsstatusselected', + 'trk-trackbyreference-destinationcountry', + 'mtrk-detailpage-shipdateicon', + 'mtrk-trackmodule-watchlisttab', + 'mtrk-detailpage-standardtransithelpicon', + 'trk-trackbyreference-trackbtn', + 'trk-detailpage-shipmentfacts-help-icon', + 'trk-trackmodule-allshipmentstab', + 'trk-trackbytcn-tcn-inputfield', + 'mtrk-detailpage-opodpageview', + 'trk-detailpage-savetracknumberchkbox-checked', + 'trk-summarypage1trackingnumberspresent', + 'mtrk-detailpage-travelhistory', + 'mtrk-trackmodule-exceptionstab', + 'mtrk-trackmodule-placard-pressed', + 'trk-detailpage-travelhistory', + 'trk-detailview-scrollinglist-placard-pressed', + 'trk-trackmodule-watchlisttab', + 'trk-trackmodule-exceptionstab', + 'link click: addresscheck, true', + 'getcustomizedviewsfromadmc', + 'link click: addressresult, true', + 'save as default return address,false', + 'returns:saturday delivery allowed,false', + 'hdr|tab|1|Shipping', + 'hdr|tab|2|Tracking', + 'hdr|tab|3|Printing Services', + 'hdr|tab|4|Locations', + 'hdr|tab|5|Support', + 'hero|cube|RATE&SHIP', + 'hero|cube|TRACK', + 'hero|cube|LOCATIONS', + 'home|Open A FedEx Account', + 'tab|envelope|packages', + 'tab|freight|shipping', + 'tab|expedited|extra', + 'tab|air|freight', + 'trk-trackByTCN-TCN-InputField', + 'trk-landingPage-promptToLoginforBOL', + 'trk-landingPage-radioBtn-BillOfLading', + 'trk-landingPage-radioBtn-ProofOfDelivery', + 'trk-landingPage-radioBtn-FaxLetter', + 'trk-landingPage-radioBtn-ViewPrintLetter', + 'trk-trackByTCN-TrackBtn', + 'trk-landingPage-mulitipleTrackingNumberLink', + 'trk-landingPage-singleTrackingNumberLink', + 'trk-landingPage-track-helpLink', + 'hdr|Login' + ]; + } + } + }, + verizonBtnClickMapping: { + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + 'Form|EN-Freight Quote-No-Account': [ + 10145672, + 'FedEx_Heavyweight_Freight_Quote_Button_EN' + ], + 'Form|FR-Freight Quote-No-Account': [ + 10145683, + 'FedEx_Heavyweight_Freight_Quote_Button_FR' + ], + 'Form|FR-Freight Quote': [ + 10145683, + 'FedEx_Heavyweight_Freight_Quote_Button_FR' + ], + 'Form|Freight Quote with Account': [ + 10145672, + 'FedEx_Heavyweight_Freight_Quote_Button_EN' + ], + 'Form|Beyond the Buy Button-FR': [ + 10147630, + 'FedEx_eCommerce_GET NOW Button_FR' + ], + 'Form|Beyond the Buy Button': [ + 10147629, + 'FedEx_eCommerce_GET NOW Button_EN' + ], + 'link|Start your quote': [ + 10149629, + 'FedEx_Heavyweight_Button_NoAcc_EN' + ], + 'link|Commencez votre estimation': [ + 10149630, + 'FedEx_Heavyweight_Button_NoAcc_FR' + ], + 'hero|FIND A JOB': [ + 10158200, + 'Recruitment_SearchButton_EN' + ], + 'hero|TROUVER UN EMPLOI': [ + 10158201, + 'Recruitment_SearchButton_FR' + ], + 'link|REQUEST A CONSULTATION-FR': [ + 10160403, + 'Healtcare_ConsultButton_FR' + ], + 'link|REQUEST A CONSULTATION': [ + 10160401, + 'Healthcare_ConsultButton_EN' + ], + 'Form|Healthcare|Contact Us - CAFR': [ + 10160492, + 'Healthcare_SubmitButton_FR' + ], + 'Form|Healthcare|Contact Us': [ + 10160490, + 'Healthcare_SubmitButton_EN' + ] + }; + } + } + }, + 'verizon:timeFrame': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = '1578268799000', t = '', n = !1; + return 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'), _fdx.isLive(e, t) && (n = !0), n; + } + } + }, + 'aam:regionFlag': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('aam:regions'), t = _satellite.getVar('content:region'), n = void 0 !== t && '' !== t ? t : ''; + return '' != n && e.indexOf(n) > -1; + } + } + }, + 'login:status': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return void 0 !== _satellite.cookie.get('fdx_login') && _satellite.cookie.get('fdx_login') ? 'Logged In' : 'Logged Out'; + } + } + }, + 'gTag:TargetEnabledMapping': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + 'TP|XT|USIS|YTP|HERO|CTA|CheckIntlServices': 'AW-863238793/NWt3CO2j8O0BEIn1z5sD', + 'TP|XT|USIS|YTP|HERO|CTA|CA_CheckIntlServices': 'AW-863238793/NWt3CO2j8O0BEIn1z5sD', + 'TP|XT|USETS|YTP|HERO|CTA|HowToSave': 'AW-863238793/ApLXCPS9hO4BEIn1z5sD', + 'TP|XT|USHD|YTP|HERO|CTA|CheckTransitTimes': 'AW-863238793/zfytCP6D4u0BEIn1z5sD', + 'TP|AB|USS7D|LensrentalA|HERO|CTA|CheckTheServiceMap': 'AW-863238793/vNu1CND2g-4BEIn1z5sD', + 'TP|AB|USS7D|LensRentalB|HERO|CTA|GetARateNow': 'AW-863238793/PiBSCL34g-4BEIn1z5sD', + 'TP|AB|USS7D|Resi|HERO|CTA|ServiceMap': 'AW-863238793/zCiGCP7B7PYBEIn1z5sD', + 'TP|AB|USS7D|Resi|HERO|CTA|GetARateNow': 'AW-863238793/VADDCOiY9vYBEIn1z5sD' + }; + } + } + }, + 'va:caasEnabledCountryList': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return [ + 'fr_ch', + 'de_ch', + 'it_ch', + 'en_br', + 'pt_br', + 'en_mx', + 'en_ar', + 'en_bo', + 'en_cl', + 'en_co', + 'en_cr', + 'en_do', + 'en_sv', + 'en_gt', + 'en_hn', + 'en_ni', + 'en_pa', + 'en_py', + 'en_pe', + 'en_pr', + 'en_uy', + 'en_ve', + 'en_bz', + 'en_ai', + 'en_ag', + 'en_gf', + 'en_gy', + 'en_sr', + 'en_aw', + 'en_bs', + 'en_bb', + 'en_bm', + 'en_bq', + 'en_vg', + 'en_ky', + 'en_cw', + 'en_dm', + 'en_jm', + 'en_ms', + 'en_mf', + 'en_sx', + 'en_kn', + 'en_lc', + 'en_vc', + 'en_tt', + 'en_tc', + 'en_vi', + 'en_gp', + 'en_mq', + 'en_ht', + 'en_us', + 'fr_ca', + 'en_ca', + 'en_ch', + 'es_mx', + 'es_ar', + 'es_bo', + 'es_cl', + 'es_co', + 'es_cr', + 'es_do', + 'es_ec', + 'es_sv', + 'es_gt', + 'es_hn', + 'es_ni', + 'es_pa', + 'es_py', + 'es_pe', + 'es_pr', + 'es_uy', + 'es_ve', + 'en_in', + 'en_ae', + 'en_za' + ]; + } + } + }, + 'gTag:ctaOrangeAWPageListMapping': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + '/en-us/delivery-manager/business-toolkit.html': 'AW-863238793/aRk4CIfq0bkBEIn1z5sD', + '/en-us/shipping/returns/business.html': 'AW-863238793/y6ksCNeQwbkBEIn1z5sD', + '/en-us/shipping/international/how-to-ship.html': 'AW-863238793/NAPcCOOW3bkBEIn1z5sD', + '/en-us/shipping/7-day-delivery.html': 'AW-863238793/917GCOny0bkBEIn1z5sD', + '/en-us/discount-programs/ag13398602.html': 'AW-863238793/moaMCIfwp7oBEIn1z5sD', + '/en-us/big-commerce.html': 'AW-863238793/gdFvCMKK6M0BEIn1z5sD', + '/en-us/printing/design-services.html': 'AW-863238793/SbpvCMiUrtABEIn1z5sD', + '/en-us/printing/small-medium-business-offers.html': 'AW-863238793/Ks1-CNKXhNEBEIn1z5sD', + '/en-us/delivery-manager.html': 'AW-863238793/omf9COL05dwBEIn1z5sD', + '/en-us/printing/consumer-offers.html': 'AW-863238793/DFHoCJazheIBEIn1z5sD', + '/en-us/shipping/onsite/walgreens-package-pickup.html': 'AW-863238793/hGOvCLfLkOIBEIn1z5sD', + '/en-us/shipping/onsite/dollar-general-pick-up-drop-off-package.html': 'AW-863238793/aK-MCLut4-EBEIn1z5sD' + }; + } + } + }, + 'tradedesk:pageListMapping': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = '//insight.adsrvr.org/track/conv/?adv=suentvba&', t = '//insight.adsrvr.org/track/pxl/?adv=suentvba&'; + return { + '/en-us/shipping/freight-services/innovation.html': e + 'ct=0:h9vahhl&fmt=3', + '/en-us/printing/custom-professional-printing.html': e + 'ct=0:gf8b2ga&fmt=3', + '/en-us/printing/small-medium-business-offers.html': e + 'ct=0:3mz8oau&fmt=3', + '/en-us/shipping/freight-services/ltl/quote.html': e + 'ct=0:3id3fjg&fmt=3', + '/en-us/possibilities.html': e + 'ct=0:nzuy8eb&fmt=3', + '/en-us/printing/flash-sale-offers.html': e + 'ct=0:pnp2p5c&fmt=3', + '/en-us/printing/online-printing.html': e + 'ct=0:doh2ftg&fmt=3', + '/en-us/shipping/store/ground.html': e + 'ct=0:wbnq7or&fmt=3', + '/en-us/discount-programs/em15692213.html': e + 'ct=0:zn34oc7&fmt=3', + '/en-us/create-account.html': e + 'ct=0:8qsl8hw&fmt=3', + '/en-us/discount-programs/em15692013.html': e + 'ct=0:v14weo0&fmt=3', + '/en-us/discount-programs/em15692113.html': e + 'ct=0:jg3p5mz&fmt=3', + '/en-us/holiday/consumer-shipping-delivery-guide.html': t + 'ct=0:8iico1h&fmt=3', + '/en-us/printing/business-solutions/knowledge-center.html': t + 'ct=0:2otll08&fmt=3', + '/en-us/discount-programs/ag13398602.html': t + 'ct=0:zhtslsw&fmt=3', + '/en-us/printing/design-services.html': t + 'ct=0:d5f18os&fmt=3', + '/en-us/shipping/office-depot-officemax.html': t + 'ct=0:ziua30z&fmt=3', + '/en-us/printing/national-bid-center.html': t + 'ct=0:fmzrk4f&fmt=3', + '/en-us/shipping/onsite/target-pick-up-drop-off-package.html': t + 'ct=0:zrg68eb&fmt=3', + '/en-us/printing/small-medium-business-offers.html': t + 'ct=0:3mz8oau&fmt=3', + '/en-us/printing/design-services.html': t + 'ct=0:d5f18os&fmt=3', + '/en-us/holiday/consumer-shipping-delivery-guide.html': t + 'ct=0:dk8wqso&fmt=3', + '/en-us/holiday.html': t + 'ct=0:qk2rtlb&fmt=3', + '/en-us/printing/consumer-offers.html': t + 'ct=0:6s84uxx&fmt=3', + '/en-us/shipping/onsite/walgreens-package-pickup.html': t + 'ct=0:jerompp&fmt=3', + '/en-us/shipping/onsite/dollar-general-pick-up-drop-off-package.html': t + 'ct=0:7w8bqzk&fmt=3', + '/en-us/shipping/hold-at-location.html': t + 'ct=0:o4chprn&fmt=3', + '/en-us/delivery-manager.html': t + 'ct=0:3hpw1uq&fmt=3', + '/en-us/shipping/returns/business.html': t + 'ct=0:xlwb8xd&fmt=3', + '/en-us/shipping/returns/technology.html': t + 'ct=0:2beampd&fmt=3', + '/en-us/shipping/returns.html': t + 'ct=0:mr0rsff&fmt=3', + '/en-us/coupon-offers/ground.html': t + 'ct=0:80lizg3&fmt=3', + '/en-us/healthcare/vaccine-shipping.html': t + 'ct=0:6nttf6b&fmt=3', + '/en-us/ecommerce/offer-store-pickup-at-checkout.html': t + 'ct=0:qs2kfqb&fmt=3', + '/en-us/delivery-manager/manage-your-deliveries.html': t + 'ct=0:eewc7i3&fmt=3', + '/en-us/small-business/grant-contest.html': t + 'ct=0:x825ryh&fmt=3', + '/en-us/sweepstakes/come-in-and-cash-in.html': t + 'ct=0:sg2bb3l&fmt=3', + '/en-us/sweepstakes.html': t + 'ct=0:mx3nwkb&fmt=3', + '/en-us/sweepstakes/holiday-drop-off.html': t + 'ct=0:moh3dvr&fmt=3', + '/en-us/shipping/saturday-and-sunday-delivery.html': t + 'ct=0:hxd9zm3&fmt=3' + }; + } + } + }, + 'gTag:ConfigLogic': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:ConfigIDMapping'), t = _satellite.getVar('content:countryCode'), n = ''; + if (void 0 !== e && '' !== e && void 0 !== t && '' !== t) + for (var r in e) { + if (t.indexOf(r) > -1) { + n = e[r]; + break; + } + '' === n && (n = e.us); + } + return n; + } + } + }, + 'external-campaign:link': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'LINK', + caseInsensitive: !0 + } + }, + 'aam:regions': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return 'us,can,apac'; + } + } + }, + 'content:page type': { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.page.category.pageType' } + }, + 'login:user-id': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return _satellite.cookie.get('fcl_uuid') ? _satellite.cookie.get('fcl_uuid') : ''; + } + } + }, + sAccount: { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('content:region'), t = 'fedexglbldev'; + return void 0 !== e && '' != e && ('www.fedex.com' != window.location.host && 'developer.fedex.com' != window.location.host && 'getrewards.fedex.com' != window.location.host || (t = 'fedexglbl')), t; + } + } + }, + 'aam:countries': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return ''; + } + } + }, + 'gTag:TargetVideoMapping': { + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + 6227544185001: 'AW-863238793/gem0CPHng-4BEIn1z5sD', + 6227545658001: 'AW-863238793/pVA-CKOQ4u8BEIn1z5sD', + 6234399559001: 'AW-863238793/7VuBCNrMlO4BEIn1z5sD', + 6233827141001: 'AW-863238793/UuPnCPC41fcBEIn1z5sD' + }; + } + } + }, + 'search:spData - JSObjectChange': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'FDX.DATALAYER.search.result.totalResultCount' } + }, + 'gTag:VideoPlayBtnIdList': { + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + '1650190059434780604': 'DC-2290794/campa0/fedex00+standard', + '1650654296423604975': 'DC-8358006/invmedia/fedex00u+standard', + '1650655099792266769': 'DC-5653020/fy20a0/fy20_004+standard' + }; + } + } + }, + 'gTag:btnDCPageListMapping': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + '/en-ca/shipping-services/international-shipping.html': [ + 'DC-974714/fedex0/fedex000+standard', + 'DC-974714/fedex0/fedex002+standard', + 'DC-974714/fedex0/fedex004+standard', + 'DC-974714/fedex0/fedex006+standard' + ], + '/fr-ca/shipping-services/international-shipping.html': [ + 'DC-974714/fedex0/fedex001+standard', + 'DC-974714/fedex0/fedex003+standard', + 'DC-974714/fedex0/fedex005+standard', + 'DC-974714/fedex0/fedex007+standard' + ], + '/en-hk/campaign/retailfreight.html': 'DC-5667300/fy20_0/fedex003+standard', + '/zh-hk/campaign/retailfreight.html': 'DC-5667300/fy20_0/fedex001+standard', + '/en-my/open-account/personal.html': 'DC-9811313/invmedia/my_pe0+standard', + '/en-my/open-account/corporate.html': 'DC-9811313/invmedia/my_co0+standard', + '/en-au/open-account/personal.html': 'DC-9811313/invmedia/au_pe0+standard', + '/en-au/open-account/corporate.html': 'DC-9811313/invmedia/au_co0+standard', + '/en-nz/open-account/personal.html': 'DC-9811313/invmedia/nz_pe0+standard', + '/en-nz/open-account/corporate.html': 'DC-9811313/invmedia/nz_co0+standard', + '/en-tw/open-account/personal/egui-form.html': 'DC-9811313/invmedia/tw_pe0+standard', + '/zh-tw/open-account/personal/egui-form.html': 'DC-9811313/invmedia/tw_pe0+standard', + '/en-tw/open-account/corporate.html': 'DC-9811313/invmedia/tw_co0+standard', + '/zh-tw/open-account/corporate.html': 'DC-9811313/invmedia/tw_co0+standard', + '/en-ph/open-account.html': [ + '', + 'DC-9811313/invmedia/ph_co0+standard', + 'DC-9811313/invmedia/ph_pe0+standard' + ] + }; + } + } + }, + _fdxUtil: { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e; + window._fdx = {}, window, e = _fdx || {}, f = e || {}, f.isObject = function (e) { + return null != e && e.constructor == Object; + }, f.isLive = function (e, t) { + var n = !0, r = new Date().getTime(); + return null !== e && '' !== e && r < e && (n = !1), null !== t && '' !== t && r > t && (n = !1), n; + }, f.pageFlag = function (e, t, n) { + if (void 0 !== e && '' !== e && void 0 !== t && '' !== t) + for (var r in e) + if (isNaN(r)) { + if (t.toLowerCase().indexOf(r.toLowerCase()) > -1) + return _fdx.isObject(e[r]) ? 'country' == n ? e[r] : (enabledTime = _fdx.isLive(e[r].startTime, e[r].endTime), !!enabledTime && (srcValue = e[r].pixel, 'undefined' == srcValue || srcValue)) : e[r]; + } else { + if (t.toLowerCase().indexOf(e[r].toLowerCase()) > -1) + return !0; + if (t == r) + return e[r]; + } + return !1; + }, f.pcfUtil = function () { + var e = _satellite.getVar('AllowedProdDomains'), t = window.location.hostname; + return null != t.match(/www(base.idev|dev.idev|drt.idev|stress.dmz.idev|bit.idev|test|).fedex.com/gi) ? t : e.length > 0 && e.indexOf(t) > -1 ? 'www.fedex.com' : 'wwwtest.fedex.com'; + }, f.getTestLevel = function () { + var e = '', t = { + wwwsbox: 'L1S', + wwwbase: 'L1', + wwwdev: 'L2', + wwwdrt: 'L3', + wwwstress: 'L4', + wwwbit: 'L5', + wwwtest: 'L6' + }, n = wwwHost.split('.')[0]; + return void 0 !== t[n] && '' !== t[n] && (e = t[n]), e; + }, f.getGtagLabel = function (e, t, n) { + for (var r in t) + if (t[r] === n) + return e[r]; + }; + } + } + }, + 'gTag:btnAWPageListMapping': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + '/en-us/shipping/returns/business.html': 'AW-863238793/af5UCNST3bkBEIn1z5sD', + '/en-us/printing/design-services.html': 'AW-863238793/E68LCLyFvNABEIn1z5sD', + '/en-us/printing/small-medium-business-offers.html': 'AW-863238793/3z1DCL3l89ABEIn1z5sD', + '/en-us/coupon-offers/ground.html': 'AW-863238793/oNjiCP2LheIBEIn1z5sD', + '/en-us/shipping/onsite/dollar-general-pick-up-drop-off-package.html': 'AW-863238793/6Ge7CJ-A7-EBEIn1z5sD', + '/en-in/shipping/industry-solutions/healthcare/contact-us.html': 'AW-673681829/2YT3CM_B5s4BEKWjnsEC', + '/en-ca/small-business/ecommerce-solutions.html': 'AW-1033577797/XPsJCITyp_MCEMXK7OwD', + '/fr-ca/small-business/ecommerce-solutions.html': 'AW-1033577797/2Fo1CKLUp_QCEMXK7OwD', + '/en-ca/ecommerce-shipping/support-for-your-customers.html': 'AW-1033577797/9JPYCLfUl_wCEMXK7OwD', + '/fr-ca/ecommerce-shipping/support-for-your-customers.html': 'AW-1033577797/JCrjCIe5mfwCEMXK7OwD', + '/en-ca/manage-my-deliveries.html': 'AW-1033577797/M-0bCJXP8PsCEMXK7OwD', + '/fr-ca/manage-my-deliveries.html': 'AW-1033577797/CsQzCNnp8PsCEMXK7OwD' + }; + } + } + }, + 'FlashTalking:pageListMapping': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { '/en-us/possibilities.html': 'https://servedby.flashtalking.com/spot/1/5284;117964;12509/?spotName=FedEx_2020_Landing_Page&cachebuster=' }; + } + } + }, + 'va:enabledCountryListNew': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return [ + 'gb', + 'jp', + 'cn', + 'ca', + 'sg', + 'au', + 'ph', + 'nz', + 'id', + 'vn', + 'my', + 'bz', + 'ai', + 'ag', + 'gf', + 'gy', + 'sr', + 'ht', + 'za', + 'in', + 'hk', + 'tw', + 'kr', + 'th', + 'dm', + 'ms', + 'gp', + 'gt', + 'bo', + 'ec', + 'sv', + 'hn', + 'ni', + 'py', + 'pe', + 'aw', + 'bs', + 'bb', + 'bm', + 'bq', + 'vg', + 'ky', + 'cw', + 'gd', + 'jm', + 'mf', + 'sx', + 'kn', + 'lc', + 'vc', + 'tt', + 'tc', + 'vi', + 'ar', + 'cl', + 'co', + 'cr', + 'pa', + 'uy', + 've', + 'mx', + 'pr', + 'do', + 'mq', + 'br', + 'ch', + 'ae', + 'za' + ]; + } + } + }, + 'qualtrics:DisableLocale': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return _satellite.getVar('content:locale').match(/en_al|en_am|de_at|en_at|en_az|en_by|en_be|fr_be|nl_be|en_ba|en_bg|en_hr|en_cy|cs_cz|en_cz|da_dk|en_dk|en_ee|en_fo|en_fi|fi_fi|en_fr|fr_fr|en_ge|de_de|en_de|en_gi|en_gr|en_gl|en_hu|hu_hu|en_is|en_ie|en_il|he_il|en_it|it_it|en_lv|en_lt|en_lu|en_mk|en_mt|en_md|en_me|en_nl|nl_nl|en_no|no_no|en_pl|pl_pl|en_pt|pt_pt|en_ro|en_ru|ru_ru|en_rs|en_sk|sk_sk|en_si|sl_si|en_es|es_es|en_se|sv_se|de_ch|en_ch|fr_ch|it_ch|en_tr|tr_tr|en_gb|en_ua|ru_ua|uk_ua/gi); + } + } + }, + 'va:caasMobEnabledUrl': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return ['/fedextrack/']; + } + } + }, + 'gTag:ctaOrangeFBPageListMapping': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + '/en-us/discount-programs/ag13398602.html': 'InitiateCheckout', + '/en-us/printing/design-services.html': 'CustomizeProduct', + '/en-us/printing/small-medium-business-offers.html': 'AddToCart' + }; + } + } + }, + 'gTag:DFAEventMapping': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + us: { + '/en-us/possibilities.html': 'DC-4191263/fedex005/fedex02i+standard', + '/en-us/coupon-offers.html': 'DC-4191263/fedex00h/fedex021+standard', + '/en-us/shipping/dropbox.html': 'DC-4191263/fedex00h/fedex020+standard', + '/en-us/shipping/freight-services/ltl/volume-services.html': 'DC-4191263/fedex00h/fedex01u+standard', + '/en-us/customer-support.html': 'DC-4191263/fedex00h/fedex00y+standard', + '/en-us/home.html': 'DC-4191263/fedex00h/fedex00x+standard', + '/en-us/printing.html': 'DC-4191263/fedex00h/fedex00w+standard', + '/en-us/shipping.html': 'DC-4191263/fedex00h/fedex00v+standard', + '/en-us/tracking.html': 'DC-4191263/fedex00h/fedex00u+standard', + '/en-us/office.html': 'DC-4191263/fedex00h/fedex00s+standard', + '/en-us/shipping/international-ground-canada.html': 'DC-4191263/fedex00h/fedex00l+standard', + '/en-us/printing/online-printing.html': 'DC-4191263/fedex00h/fedex00h+standard', + '/en-us/shipping/store/ground.html': 'DC-4191263/fedex00h/fedex00b+standard', + '/en-us/shipping/ground.html': 'DC-4191263/fedex00h/fedex00a+standard', + '/en-us/shipping/packing.html': 'DC-4191263/fedex00h/fedex00-+standard', + '/en-us/printing/posters/canvas-prints.html': 'DC-4191263/fedex00h/fedex0+standard', + '/en-us/printing/promotions1.html': 'DC-4191263/fedex00h/fedex00f+standard', + '/en-us/printing/promotions2.html': 'DC-4191263/fedex00h/fedex00e+standard', + '/en-us/printing/promotions3.html': 'DC-4191263/fedex00h/fedex00g+standard', + '/en-us/printing/promotions4.html': 'DC-4191263/fedex00h/fedex00d+standard', + '/en-us/printing/promotions5.html': 'DC-4191263/fedex00h/fedex00c+standard', + '/en-us/printing/flash-sale-offers.html': 'DC-4191263/fedex00h/fedex02e+standard', + '/en-us/shipping/hold-at-location.html': 'DC-4191263/fedex00h/fedex02h+standard', + '/en-us/printing/small-medium-business-offers.html': 'DC-4191263/fedex00h/fedex02g+standard', + '/en-us/office/walmart.html': 'DC-4191263/fedex00h/fedex02i+standard', + '/en-us/shipping/onsite/walgreens-package-pickup.html': 'DC-4191263/walgr0/fedex0+standard', + '/en-us/shipping/onsite.html': 'DC-4191263/fedex00h/fedex02n+standard', + '/en-us/shipping/packing-supplies/custom-branded-boxes.html': 'DC-4191263/fedex00h/fedex02k+standard', + '/en-us/delivery-manager/how-to-prevent-stolen-missing-packages.html': 'DC-4191263/fedex00h/fedex02l+standard', + '/en-us/shipping/freight-services/ltl/quote.html': 'DC-4191263/fedex00h/fedex02r+standard', + '/en-us/printing/custom-professional-printing.html': 'DC-4191263/fedex00h/fy19_0+standard', + '/en-us/shipping/freight-services/innovation.html': 'DC-4191263/fedex00h/fedex02u+standard', + '/en-us/holiday/consumer-shipping-delivery-guide.html': 'DC-4191263/fedex00h/fedex02y+standard', + '/en-us/discount-programs/em15692013.html': 'DC-4191263/fedex00h/fy20_001+standard', + '/en-us/discount-programs/em15692213.html': 'DC-4191263/fedex00h/fy20_000+standard', + '/en-us/create-account.html': 'DC-4191263/fedex00h/fy20_0+standard', + '/en-us/discount-programs/em15692113.html': 'DC-4191263/fedex00h/fy20_00+standard', + '/en-us/printing/business-solutions/knowledge-center.html': 'DC-4191263/fedex00h/fedex031+standard', + '/en-us/discount-programs/ag13398602.html': 'DC-4191263/fedex00h/fedex038+standard', + '/en-us/printing/design-services.html': 'DC-4191263/fedex00h/fedex03h+standard', + '/en-us/shipping/office-depot-officemax.html': 'DC-4191263/fedex00h/fedex03a+standard', + '/en-us/printing/national-bid-center.html': 'DC-4191263/fedex00h/fedex03-+standard', + '/en-us/shipping/onsite/target-pick-up-drop-off-package.html': 'DC-4191263/fedex00h/fedex03b+standard', + '/en-us/small-business/making-it-work-podcast.html': 'DC-4191263/fedex00h/fedex03j+standard', + '/en-us/delivery-manager.html': 'DC-4191263/fdmen0/fdmla0+standard', + '/en-us/delivery-manager/manage-your-deliveries.html': 'DC-4191263/fdmen0/fdmla00+standard', + '/en-us/coupon-offers/ground.html': 'DC-4191263/fedex00h/fedex03m+standard', + '/en-us/printing/consumer-offers.html': 'DC-4191263/consu0/fedex0+standard', + '/en-us/shipping/onsite/dollar-general-pick-up-drop-off-package.html': 'DC-4191263/fedex00h/fedex03l+standard' + }, + ca: { + '/en-ca/shipping-services/international-shipping.html': 'DC-974714/fedex17/fedex0+standard', + '/fr-ca/shipping-services/international-shipping.html': 'DC-974714/fedex17/fedex00+standard', + '/en-ca/shipping-services/international-shipping/regulatory-form/thank-you.html': 'DC-974714/fedex0/fedex008+unique', + '/fr-ca/shipping-services/international-shipping/regulatory-form/thank-you.html': 'DC-974714/fedex0/fedex009+unique', + '/en-ca/shipping-services/healthcare.html': 'DC-974714/fedex00/fy22h0+standard', + '/fr-ca/shipping-services/healthcare.html': 'DC-974714/fedex00/fy22h000+standard', + '/en-ca/shipping-services/healthcare/contact-us.html': 'DC-974714/fedex00/fy22h00+standard', + '/fr-ca/shipping-services/healthcare/contact-us.html': 'DC-974714/fedex00/fy22h001+standard' + }, + bh: { '/en-bh/about/possibilities.html': 'DC-1982574/enx2x0/fedex00+standard' }, + kw: { '/en-kw/about/possibilities.html': 'DC-1982574/enx2x0/fedex000+standard' }, + ae: { + '/ar-ae/about/possibilities.html': 'DC-1982574/ar44x0/fedex0+standard', + '/en-ae/about/possibilities.html': 'DC-1982574/enx2x0/fedex0+standard' + }, + kr: { + '/ko-kr/open-account/personal.html': 'DC-9929969/korea0/fedex000+standard', + '/ko-kr/shipping/fedex-rewards.html': 'DC-9929969/korea0/fedex001+standard', + '/ko-kr/small-business.html': 'DC-9929969/korea0/fedex0+standard', + '/ko-kr/open-account.html': 'DC-9929969/korea0/fedex00+standard' + }, + tw: { + '/zh-tw/about/possibilities.html': 'DC-5653020/fy20a0/fy20_000+standard', + '/en-tw/about/possibilities.html': 'DC-5653020/fy20a0/fy20_000+standard', + '/zh-tw/open-account/corporate.html': 'DC-9929969/taiwa0/fedex000+standard', + '/zh-tw/open-account/personal.html': 'DC-9929969/taiwa0/fedex001+standard', + '/zh-tw/shipping/fedex-rewards.html': 'DC-9929969/taiwa0/fedex002+standard', + '/zh-tw/small-business.html': 'DC-9929969/taiwa0/fedex0+standard', + '/zh-tw/open-account.html': 'DC-9929969/taiwa0/fedex00+standard' + }, + sg: { + '/en-sg/open-account/corporate.html': 'DC-9929969/singa0/fedex000+standard', + '/en-sg/open-account/personal.html': 'DC-9929969/singa0/fedex001+standard', + '/en-sg/shipping/fedex-rewards.html': 'DC-9929969/singa0/fedex002+standard', + '/en-sg/small-business.html': 'DC-9929969/singa0/fedex00b+standard', + '/en-sg/open-account.html': 'DC-9929969/singa0/fedex00+standard', + '/en-sg/small-business/success-journey/facts-benefits-grants.html': 'DC-9929969/singa0/fedex00c+standard', + '/en-sg/small-business/streamline-operations/tips-for-efficient-effective-shipping.html': 'DC-9929969/singa0/fedex00d+standard', + '/en-sg/small-business/accelerating-digital/digitalize-customs-documents.html': 'DC-9929969/singa0/fedex00e+standard', + '/en-sg/small-business/accelerating-digital/opportunities-for-ecommerce-business.html': 'DC-9929969/singa0/fedex00f+standard', + '/en-sg/small-business/adapt-innovate/sustainable-supply-chain.html': 'DC-9929969/singa0/fedex00g+standard' + }, + jp: { + '/ja-jp/open-account/corporate.html': 'DC-9929969/japan0/fedex000+standard', + '/ja-jp/open-account/personal.html': 'DC-9929969/japan0/fedex001+standard', + '/ja-jp/shipping/fedex-rewards.html': 'DC-9929969/japan0/fedex002+standard', + '/ja-jp/small-business.html': 'DC-9929969/japan0/fedex0+standard', + '/ja-jp/open-account.html': 'DC-9929969/japan0/fedex00+standard' + }, + hk: { + '/zh-hk/open-account/personal.html': 'DC-9929969/hongk0/fedex004+standard', + '/en-hk/open-account/personal.html': 'DC-9929969/hongk0/fedex005+standard', + '/zh-hk/shipping/fedex-rewards.html': 'DC-9929969/hongk0/fedex006+standard', + '/en-hk/shipping/fedex-rewards.html': 'DC-9929969/hongk0/fedex007+standard', + '/zh-hk/small-business.html': 'DC-9929969/hongk0/fedex0+standard', + '/en-hk/small-business.html': 'DC-9929969/hongk0/fedex00+standard', + '/zh-hk/open-account.html': 'DC-9929969/hongk0/fedex000+standard', + '/en-hk/open-account.html': 'DC-9929969/hongk0/fedex001+standard', + '/zh-hk/open-account/corporate.html': 'DC-9929969/hongk0/fedex002+standard', + '/en-hk/open-account/corporate.html': 'DC-9929969/hongk0/fedex003+standard' + }, + au: { + '/en-au/shipping/fedex-rewards.html': 'DC-9929969/austr0/fedex002+standard', + '/en-au/small-business.html': 'DC-9929969/austr0/fedex00-+standard', + '/en-au/open-account.html': 'DC-9929969/austr0/fedex00+standard', + '/en-au/open-account/corporate.html': 'DC-9929969/austr0/fedex000+standard', + '/en-au/open-account/personal.html': 'DC-9929969/austr0/fedex001+standard', + '/en-au/small-business/delighting-customers/rewards-programs-benefits.html': 'DC-9929969/austr0/fedex009+standard', + '/en-au/small-business/success-journey/facts-benefits-grants.html': 'DC-9929969/austr0/fedex00a+standard', + '/en-au/small-business/streamline-operations/tips-for-efficient-effective-shipping.html': 'DC-9929969/austr0/fedex00b+standard', + '/en-au/small-business/accelerating-digital/digitalize-customs-documents.html': 'DC-9929969/austr0/fedex00c+standard', + '/en-au/small-business/accelerating-digital/opportunities-for-ecommerce-business.html': 'DC-9929969/austr0/fedex00d+standard', + '/en-au/small-business/adapt-innovate/sustainable-supply-chain.html': 'DC-9929969/austr0/fedex00e+standard' + }, + co: { + '/es-co/open-account.html': 'DC-2526289/bbcjm0/all_f00o+standard', + '/es-co/customer-support.html': 'DC-2526289/bbcjm0/all_f00j+standard', + '/es-co/about/possibilities.html?CMP=PAC-Possibilities-0-0-1052-100000-LAC-co-es-VanityURL#food-beverage': 'DC-2526289/bbcjm0/all_f00+standard', + '/es-co/shipping.html': 'DC-2526289/bbcjm0/all_f002+standard', + '/es-co/about/possibilities.html?CMP=PAC-Possibilities-0-0-1052-100000-LAC-co-es-VanityURL#technology': 'DC-2526289/bbcjm0/all_f000+standard', + '/es-co/about/possibilities.html?CMP=PAC-Possibilities-0-0-1052-100000-LAC-co-es-VanityURL': 'DC-2526289/bbcjm0/all_f0+standard', + '/es-co/shipping/rates.html': 'DC-2526289/bbcjm0/all_f007+standard', + '/es-co/home.html': 'DC-2526289/bbcjm0/all_f00p+standard', + '/es-co/online/rating.html': 'DC-2526289/bbcjm0/all_f005+standard', + '/es-co/tracking.html': 'DC-2526289/bbcjm0/all_f00b+standard', + '/es-co/customs-tools.html': 'DC-2526289/bbcjm0/all_f00c+standard', + '/es-co/about/possibilities.html': 'DC-2526289/bbcjm0/all_f00+standard' + }, + cl: { + '/es-cl/billing.html': 'DC-2526289/bbcjm0/all_f00s+standard', + '/es-cl/about/possibilities.html': 'DC-2526289/bbcjm0/all_f00+standard' + }, + br: { '/pt-br/about/possibilities.html': 'DC-2526289/bbcjm0/all_f00+standard' }, + mx: { '/es-mx/about/possibilities.html': 'DC-2526289/bbcjm0/all_f00+standard' }, + my: { + '/en-my/shipping/fedex-rewards.html': 'DC-9929969/malay0/fedex002+standard', + '/en-my/small-business/delighting-customers/rewards-programs-benefits.html': 'DC-9929969/malay0/fedex004+standard', + '/en-my/small-business.html': 'DC-9929969/malay0/fedex005+standard', + '/en-my/small-business/success-journey/facts-benefits-grants.html': 'DC-9929969/malay0/fedex006+standard', + 'en-my/small-business/streamline-operations/tips-for-efficient-effective-shipping.html': 'DC-9929969/malay0/fedex007+standard', + '/en-my/small-business/accelerating-digital/digitalize-customs-documents.html': 'DC-9929969/malay0/fedex008+standard', + '/en-my/small-business/adapt-innovate/sustainable-supply-chain.html': 'DC-9929969/malay0/fedex00-+standard', + '/en-my/small-business/accelerating-digital/opportunities-for-ecommerce-business.html': 'DC-9929969/malay0/fedex009+standard' + }, + nz: { + '/en-nz/shipping/fedex-rewards.html': 'DC-9929969/newze0/fedex002+standard', + '/en-nz/small-business/delighting-customers/rewards-programs-benefits.html': 'DC-9929969/newze0/fedex004+standard' + }, + ph: { + '/en-ph/shipping/fedex-rewards.html': 'DC-9929969/phili0/fedex002+standard', + '/en-ph/small-business/delighting-customers/rewards-programs-benefits.html': 'DC-9929969/phili0/fedex004+standard', + '/en-ph/small-business.html': 'DC-9929969/phili0/fedex005+standard', + '/en-ph/small-business/success-journey/facts-benefits-grants.html': 'DC-9929969/phili0/fedex006+standard', + '/en-ph/small-business/streamline-operations/tips-for-efficient-effective-shipping.html': 'DC-9929969/phili0/fedex007+standard', + '/en-ph/small-business/accelerating-digital/opportunities-for-ecommerce-business.html': 'DC-9929969/phili0/fedex009+standard', + '/en-ph/small-business/accelerating-digital/digitalize-customs-documents.html': 'DC-9929969/phili0/fedex008+standard', + '/en-ph/small-business/adapt-innovate/sustainable-supply-chain.html': 'DC-9929969/phili0/fedex00-+standard' + }, + th: { + '/th-th/shipping/fedex-rewards.html': 'DC-9929969/thail0/fedex002+standard', + '/th-th/small-business/delighting-customers/rewards-programs-benefits.html': 'DC-9929969/thail0/fedex004+standard' + }, + cn: { + '/zh-cn/shipping/fedex-rewards.html': 'DC-9929969/china0/fedex0+standard', + '/zh-cn/small-business/delighting-customers/rewards-programs-benefits.html': 'DC-9929969/china0/fedex000+standard' + } + }; + } + } + }, + 'search:term': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'q', + caseInsensitive: !0 + } + }, + 'aam:containerNSIDMapping': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + can: '1', + us: '2', + apac: '3', + eu: '4', + lac: '5', + meisa: '6' + }; + } + } + }, + 'gTag:VideoPlayIdList': { + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return { + sg: { + '1648008546168499331': 'DC-2290794/campa0/fedex000+standard', + '1648008547128038436': 'DC-2290794/campa0/fedex001+standard', + '1648282229538662147': 'DC-2290794/campa0/fedex002+standard' + }, + kr: { + '1648008545608591718': 'DC-8358006/invmedia/fedex00r+standard', + '1648008505292991266': 'DC-8358006/invmedia/fedex00s+standard', + '1650185708406445585': 'DC-8358006/invmedia/fedex00t+standard' + }, + tw: { + '1648008470903760640': 'DC-5653020/fy20a0/fy20_001+standard', + '1648008494432891250': 'DC-5653020/fy20a0/fy20_002+standard', + '1650185708406445585': 'DC-5653020/fy20a0/fy20_003+standard' + } + }; + } + } + }, + 'content:region': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = FDX.DATALAYER.page.pageInfo.region; + return 'en_in' == _satellite.getVar('content:locale') && 'meisa' !== e && (e = 'meisa'), e; + } + } + }, + mcorgID: { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return '1E22171B520E93BF0A490D44@AdobeOrg'; + } + } + }, + targetenabledUrlList: { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return ['/online/rating.html']; + } + } + }, + 'va:enabledCountryList': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return [ + 'us', + 'jp', + 'cn', + 'ca', + 'sg', + 'au', + 'ph', + 'nz', + 'id', + 'vn', + 'my', + 'bz', + 'ai', + 'ag', + 'gf', + 'gy', + 'sr', + 'ht', + 'za', + 'in', + 'hk', + 'tw', + 'kr', + 'th', + 'dm', + 'ms', + 'gp', + 'gt', + 'bo', + 'ec', + 'sv', + 'hn', + 'ni', + 'py', + 'pe', + 'aw', + 'bs', + 'bb', + 'bm', + 'bq', + 'vg', + 'ky', + 'cw', + 'gd', + 'jm', + 'mf', + 'sx', + 'kn', + 'lc', + 'vc', + 'tt', + 'tc', + 'vi', + 'ar', + 'cl', + 'co', + 'cr', + 'pa', + 'uy', + 've', + 'mx', + 'pr', + 'do', + 'mq', + 'br', + 'ch', + 'ae', + 'za' + ]; + } + } + }, + 'qualtrics:pageListMappingNew': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return [ + '/fedextrack', + '/fedextracking' + ]; + } + } + }, + 'qualtrics:pageName': { + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return [ + 'fcr/create-new-report', + 'fcr/view-report-status', + 'fcr/view-recurring-report' + ]; + } + } + }, + 'va:version number': { + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + var e = Nina.debug.getUIVersion(), t = e.lastIndexOf('-'); + return e.substring(t + 1); + } + } + } + }, + extensions: { + 'adobe-mcid': { + displayName: 'Experience Cloud ID Service', + hostedLibFilesBaseUrl: 'https://assets.adobedtm.com/extensions/EP6437fa78ab024946a211397689052381/', + settings: { + orgId: '%mcorgID%', + variables: [ + { + name: 'loadTimeout', + value: '7000' + }, + { + name: 'trackingServer', + value: 'metrics.fedex.com' + }, + { + name: 'trackingServerSecure', + value: 'smetrics.fedex.com' + }, + { + name: 'marketingCloudServer', + value: 'metrics.fedex.com' + }, + { + name: 'marketingCloudServerSecure', + value: 'smetrics.fedex.com' + }, + { + name: 'disableIdSyncs', + value: '%aam:IdSyncDisable%' + }, + { + name: 'idSyncContainerID', + value: '%aam:RegionContainerNSID%' + } + ] + }, + modules: { + 'adobe-mcid/src/lib/sharedModules/mcidInstance.js': { + script: function (e, t, n, r) { + 'use strict'; + var i = n('@adobe/reactor-document'), a = n('../codeLibrary/VisitorAPI'), o = n('../../view/utils/timeUnits'), s = function (e) { + return e.reduce(function (e, t) { + var n = /^(true|false)$/i.test(t.value) ? JSON.parse(t.value) : t.value; + return e[t.name] = n, e; + }, {}); + }, c = function (e) { + var t = r.getExtensionSettings(); + if ('string' != typeof t.orgId) + throw new TypeError('Org ID is not a string.'); + var n = s(t.variables || []), i = t.doesOptInApply; + i && ('boolean' == typeof i ? n.doesOptInApply = i : t.optInCallback && (n.doesOptInApply = t.optInCallback)); + var a = t.isOptInStorageEnabled; + a && (n.isOptInStorageEnabled = a); + var c = t.optInCookieDomain; + c && (n.optInCookieDomain = c); + var u = t.optInStorageExpiry; + if (u) { + var l = t.timeUnit; + if (l && o[l]) { + var d = u * o[l]; + n.optInStorageExpiry = d; + } + } else + !0 === a && (n.optInStorageExpiry = 33696000); + var f = t.previousPermissions; + f && (n.previousPermissions = f); + var p = t.preOptInApprovals; + if (p) + n.preOptInApprovals = p; + else { + var m = t.preOptInApprovalInput; + m && (n.preOptInApprovals = m); + } + var g = t.isIabContext; + g && (n.isIabContext = g); + var h = e.getInstance(t.orgId, n); + return r.logger.info('Created instance using orgId: "' + t.orgId + '"'), r.logger.info('Set variables: ' + JSON.stringify(n)), h.getMarketingCloudVisitorID(function (e) { + r.logger.info('Obtained Marketing Cloud Visitor Id: ' + e); + }, !0), h; + }, u = function (e) { + return (r.getExtensionSettings().pathExclusions || []).some(function (t) { + return t.valueIsRegex ? new RegExp(t.value, 'i').test(e) : t.value === e; + }); + }, l = null; + _satellite.getVisitorId = function () { + return l; + }, u(i.location.pathname) ? r.logger.warn('MCID library not loaded. One of the path exclusions matches the current path.') : l = c(a), e.exports = l; + }, + name: 'mcid-instance', + shared: !0 + }, + 'adobe-mcid/src/lib/codeLibrary/VisitorAPI.js': { + script: function (e) { + e.exports = (function () { + 'use strict'; + function e(t) { + return (e = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + })(t); + } + function t(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + function n() { + return { + callbacks: {}, + add: function (e, t) { + this.callbacks[e] = this.callbacks[e] || []; + var n = this.callbacks[e].push(t) - 1, r = this; + return function () { + r.callbacks[e].splice(n, 1); + }; + }, + execute: function (e, t) { + if (this.callbacks[e]) { + t = (t = void 0 === t ? [] : t) instanceof Array ? t : [t]; + try { + for (; this.callbacks[e].length;) { + var n = this.callbacks[e].shift(); + 'function' == typeof n ? n.apply(null, t) : n instanceof Array && n[1].apply(n[0], t); + } + delete this.callbacks[e]; + } catch (e) { + } + } + }, + executeAll: function (e, t) { + (t || e && !T.isObjectEmpty(e)) && Object.keys(this.callbacks).forEach(function (t) { + var n = void 0 !== e[t] ? e[t] : ''; + this.execute(t, n); + }, this); + }, + hasCallbacks: function () { + return Boolean(Object.keys(this.callbacks).length); + } + }; + } + function r(e, t, n) { + var r = null == e ? void 0 : e[t]; + return void 0 === r ? n : r; + } + function i(e) { + for (var t = /^\d+$/, n = 0, r = e.length; n < r; n++) + if (!t.test(e[n])) + return !1; + return !0; + } + function a(e, t) { + for (; e.length < t.length;) + e.push('0'); + for (; t.length < e.length;) + t.push('0'); + } + function o(e, t) { + for (var n = 0; n < e.length; n++) { + var r = parseInt(e[n], 10), i = parseInt(t[n], 10); + if (r > i) + return 1; + if (i > r) + return -1; + } + return 0; + } + function s(e, t) { + if (e === t) + return 0; + var n = e.toString().split('.'), r = t.toString().split('.'); + return i(n.concat(r)) ? (a(n, r), o(n, r)) : NaN; + } + function c(e) { + return e === Object(e) && 0 === Object.keys(e).length; + } + function u(e) { + return 'function' == typeof e || e instanceof Array && e.length; + } + function l() { + var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '', t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function () { + return !0; + }; + this.log = le('log', e, t), this.warn = le('warn', e, t), this.error = le('error', e, t); + } + function d() { + var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).cookieName, t = (arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}).cookies; + if (!e || !t) + return { + get: Ee, + set: Ee, + remove: Ee + }; + var n = { + remove: function () { + t.remove(e); + }, + get: function () { + var n = t.get(e), r = {}; + try { + r = JSON.parse(n); + } catch (n) { + r = {}; + } + return r; + }, + set: function (r, i) { + i = i || {}; + var a = n.get(), o = Object.assign(a, r); + t.set(e, JSON.stringify(o), { + domain: i.optInCookieDomain || '', + cookieLifetime: i.optInStorageExpiry || 34190000, + expires: !0 + }); + } + }; + return n; + } + function f(e) { + this.name = this.constructor.name, this.message = e, 'function' == typeof Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error(e).stack; + } + function p() { + function e(e, t) { + var n = ge(e); + return n.length ? n.every(function (e) { + return !!t[e]; + }) : he(t); + } + function t() { + I(w), E(te.COMPLETE), h(g.status, g.permissions), s && m.set(g.permissions, { + optInCookieDomain: c, + optInStorageExpiry: u + }), v.execute(Pe); + } + function n(e) { + return function (n, r) { + if (!ve(n)) + throw new Error('[OptIn] Invalid category(-ies). Please use the `OptIn.Categories` enum.'); + return E(te.CHANGED), Object.assign(w, be(ge(n), e)), r || t(), g; + }; + } + var r = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, i = r.doesOptInApply, a = r.previousPermissions, o = r.preOptInApprovals, s = r.isOptInStorageEnabled, c = r.optInCookieDomain, u = r.optInStorageExpiry, l = r.isIabContext, f = (arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}).cookies, p = Ie(a); + De(p, 'Invalid `previousPermissions`!'), De(o, 'Invalid `preOptInApprovals`!'); + var m = d({ cookieName: 'adobeujs-optin' }, { cookies: f }), g = this, h = ee(g), v = se(), b = Ce(p), y = Ce(o), _ = s ? m.get() : {}, C = {}, x = function (e, t) { + return xe(e) || t && xe(t) ? te.COMPLETE : te.PENDING; + }(b, _), k = function (e, t, n) { + var r = be(oe, !i); + return i ? Object.assign({}, r, e, t, n) : r; + }(y, b, _), w = ye(k), E = function (e) { + return x = e; + }, I = function (e) { + return k = e; + }; + g.deny = n(!1), g.approve = n(!0), g.denyAll = g.deny.bind(g, oe), g.approveAll = g.approve.bind(g, oe), g.isApproved = function (t) { + return e(t, g.permissions); + }, g.isPreApproved = function (t) { + return e(t, y); + }, g.fetchPermissions = function (e) { + var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], n = t ? g.on(te.COMPLETE, e) : Ee; + return !i || i && g.isComplete || o ? e(g.permissions) : t || v.add(Pe, function () { + return e(g.permissions); + }), n; + }, g.complete = function () { + g.status === te.CHANGED && t(); + }, g.registerPlugin = function (e) { + if (!e || !e.name || 'function' != typeof e.onRegister) + throw new Error(Oe); + C[e.name] || (C[e.name] = e, e.onRegister.call(e, g)); + }, g.execute = Te(C), g.memoizeContent = function (e) { + we(e) && m.set(e, { + optInCookieDomain: c, + optInStorageExpiry: u + }); + }, g.getMemoizedContent = function (e) { + var t = m.get(); + if (t) + return t[e]; + }, Object.defineProperties(g, { + permissions: { + get: function () { + return k; + } + }, + status: { + get: function () { + return x; + } + }, + Categories: { + get: function () { + return ne; + } + }, + doesOptInApply: { + get: function () { + return !!i; + } + }, + isPending: { + get: function () { + return g.status === te.PENDING; + } + }, + isComplete: { + get: function () { + return g.status === te.COMPLETE; + } + }, + __plugins: { + get: function () { + return Object.keys(C); + } + }, + isIabContext: { + get: function () { + return l; + } + } + }); + } + function m(e, t) { + function n() { + i = null, e.call(e, new f('The call took longer than you wanted!')); + } + function r() { + i && (clearTimeout(i), e.apply(e, arguments)); + } + if (void 0 === t) + return e; + var i = setTimeout(n, t); + return r; + } + function g() { + if (window.__tcfapi) + return window.__tcfapi; + var e = window; + if (e !== window.top) { + for (var t; !t;) { + e = e.parent; + try { + e.frames.__tcfapiLocator && (t = e); + } catch (e) { + } + if (e === window.top) + break; + } + if (t) { + var n = {}; + return window.__tcfapi = function (e, r, i, a) { + var o = Math.random() + '', s = { + __tcfapiCall: { + command: e, + parameter: a, + version: r, + callId: o + } + }; + n[o] = i, t.postMessage(s, '*'); + }, window.addEventListener('message', function (e) { + var t = e.data; + if ('string' == typeof t) + try { + t = JSON.parse(e.data); + } catch (e) { + } + if (t.__tcfapiReturn) { + var r = t.__tcfapiReturn; + 'function' == typeof n[r.callId] && (n[r.callId](r.returnValue, r.success), delete n[r.callId]); + } + }, !1), window.__tcfapi; + } + pe.error('__tcfapi not found'); + } else + pe.error('__tcfapi not found'); + } + function h(e, t) { + var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], r = !0 === e.vendor.consents[t], i = n.every(function (t) { + return !0 === e.purpose.consents[t]; + }); + return r && i; + } + function v() { + var e = this; + e.name = 'iabPlugin', e.version = '0.0.2'; + var t, n = se(), r = { transparencyAndConsentData: null }, i = function (e) { + var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + return r[e] = t; + }; + e.fetchConsentData = function (e) { + var t = m(e.callback, e.timeout); + a({ callback: t }); + }, e.isApproved = function (e) { + var t = e.callback, n = e.category, i = e.timeout; + if (r.transparencyAndConsentData) + return t(null, h(r.transparencyAndConsentData, re[n], ie[n])); + var o = m(function (e, r) { + t(e, h(r, re[n], ie[n])); + }, i); + a({ + category: n, + callback: o + }); + }, e.onRegister = function (n) { + t = n; + var r = Object.keys(re), i = function (e, t) { + !e && t && (r.forEach(function (e) { + var r = h(t, re[e], ie[e]); + n[r ? 'approve' : 'deny'](e, !0); + }), n.complete()); + }; + e.fetchConsentData({ callback: i }); + }; + var a = function (e) { + var a = e.callback; + if (r.transparencyAndConsentData) + return a(null, r.transparencyAndConsentData); + n.add('FETCH_CONSENT_DATA', a), o(function (e, a) { + if (a) { + var o = ye(e), s = t.getMemoizedContent('iabConsentHash'), c = fe(o.tcString).toString(32); + o.consentString = e.tcString, o.hasConsentChangedSinceLastCmpPull = s !== c, i('transparencyAndConsentData', o), t.memoizeContent({ iabConsentHash: c }); + } + n.execute('FETCH_CONSENT_DATA', [ + null, + r.transparencyAndConsentData + ]); + }); + }, o = function (e) { + var t = Se(re), n = g(); + 'function' == typeof n && n('getTCData', 2, e, t); + }; + } + var b = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof window ? window : 'undefined' != typeof global ? global : 'undefined' != typeof self ? self : {}; + Object.assign = Object.assign || function (e) { + for (var t, n, r = 1; r < arguments.length; ++r) + for (t in n = arguments[r]) + Object.prototype.hasOwnProperty.call(n, t) && (e[t] = n[t]); + return e; + }; + var y, _, C = { + MESSAGES: { + HANDSHAKE: 'HANDSHAKE', + GETSTATE: 'GETSTATE', + PARENTSTATE: 'PARENTSTATE' + }, + STATE_KEYS_MAP: { + MCMID: 'MCMID', + MCAID: 'MCAID', + MCAAMB: 'MCAAMB', + MCAAMLH: 'MCAAMLH', + MCOPTOUT: 'MCOPTOUT', + CUSTOMERIDS: 'CUSTOMERIDS' + }, + ASYNC_API_MAP: { + MCMID: 'getMarketingCloudVisitorID', + MCAID: 'getAnalyticsVisitorID', + MCAAMB: 'getAudienceManagerBlob', + MCAAMLH: 'getAudienceManagerLocationHint', + MCOPTOUT: 'isOptedOut', + ALLFIELDS: 'getVisitorValues' + }, + SYNC_API_MAP: { CUSTOMERIDS: 'getCustomerIDs' }, + ALL_APIS: { + MCMID: 'getMarketingCloudVisitorID', + MCAAMB: 'getAudienceManagerBlob', + MCAAMLH: 'getAudienceManagerLocationHint', + MCOPTOUT: 'isOptedOut', + MCAID: 'getAnalyticsVisitorID', + CUSTOMERIDS: 'getCustomerIDs', + ALLFIELDS: 'getVisitorValues' + }, + FIELDGROUP_TO_FIELD: { + MC: 'MCMID', + A: 'MCAID', + AAM: 'MCAAMB' + }, + FIELDS: { + MCMID: 'MCMID', + MCOPTOUT: 'MCOPTOUT', + MCAID: 'MCAID', + MCAAMLH: 'MCAAMLH', + MCAAMB: 'MCAAMB' + }, + AUTH_STATE: { + UNKNOWN: 0, + AUTHENTICATED: 1, + LOGGED_OUT: 2 + }, + OPT_OUT: { GLOBAL: 'global' } + }, x = C.STATE_KEYS_MAP, k = function (e) { + function t() { + } + function n(t, n) { + var r = this; + return function () { + var i = e(0, t), a = {}; + return a[t] = i, r.setStateAndPublish(a), n(i), i; + }; + } + this.getMarketingCloudVisitorID = function (e) { + e = e || t; + var r = this.findField(x.MCMID, e), i = n.call(this, x.MCMID, e); + return void 0 !== r ? r : i(); + }, this.getVisitorValues = function (e) { + this.getMarketingCloudVisitorID(function (t) { + e({ MCMID: t }); + }); + }; + }, w = C.MESSAGES, E = C.ASYNC_API_MAP, I = C.SYNC_API_MAP, D = function () { + function e() { + } + function t(e, t) { + var n = this; + return function () { + return n.callbackRegistry.add(e, t), n.messageParent(w.GETSTATE), ''; + }; + } + function n(n) { + this[E[n]] = function (r) { + r = r || e; + var i = this.findField(n, r), a = t.call(this, n, r); + return void 0 !== i ? i : a(); + }; + } + function r(t) { + this[I[t]] = function () { + return this.findField(t, e) || {}; + }; + } + Object.keys(E).forEach(n, this), Object.keys(I).forEach(r, this); + }, A = C.ASYNC_API_MAP, S = function () { + Object.keys(A).forEach(function (e) { + this[A[e]] = function (t) { + this.callbackRegistry.add(e, t); + }; + }, this); + }, T = function (e, t) { + return e(t = { exports: {} }, t.exports), t.exports; + }(function (t, n) { + n.isObjectEmpty = function (e) { + return e === Object(e) && 0 === Object.keys(e).length; + }, n.isValueEmpty = function (e) { + return '' === e || n.isObjectEmpty(e); + }; + var r = function () { + var e = navigator.appName, t = navigator.userAgent; + return 'Microsoft Internet Explorer' === e || t.indexOf('MSIE ') >= 0 || t.indexOf('Trident/') >= 0 && t.indexOf('Windows NT 6') >= 0; + }; + n.getIeVersion = function () { + return document.documentMode ? document.documentMode : r() ? 7 : null; + }, n.encodeAndBuildRequest = function (e, t) { + return e.map(encodeURIComponent).join(t); + }, n.isObject = function (t) { + return null !== t && 'object' === e(t) && !1 === Array.isArray(t); + }, n.defineGlobalNamespace = function () { + return window.adobe = n.isObject(window.adobe) ? window.adobe : {}, window.adobe; + }, n.pluck = function (e, t) { + return t.reduce(function (t, n) { + return e[n] && (t[n] = e[n]), t; + }, Object.create(null)); + }, n.parseOptOut = function (e, t, n) { + t || (t = n, e.d_optout && e.d_optout instanceof Array && (t = e.d_optout.join(','))); + var r = parseInt(e.d_ottl, 10); + return isNaN(r) && (r = 7200), { + optOut: t, + d_ottl: r + }; + }, n.normalizeBoolean = function (e) { + var t = e; + return 'true' === e ? t = !0 : 'false' === e && (t = !1), t; + }; + }), P = (T.isObjectEmpty, T.isValueEmpty, T.getIeVersion, T.encodeAndBuildRequest, T.isObject, T.defineGlobalNamespace, T.pluck, T.parseOptOut, T.normalizeBoolean, n), O = C.MESSAGES, j = { + 0: 'prefix', + 1: 'orgID', + 2: 'state' + }, L = function (e, t) { + this.parse = function (e) { + try { + var t = {}; + return e.data.split('|').forEach(function (e, n) { + void 0 !== e && (t[j[n]] = 2 !== n ? e : JSON.parse(e)); + }), t; + } catch (e) { + } + }, this.isInvalid = function (n) { + var r = this.parse(n); + if (!r || Object.keys(r).length < 2) + return !0; + var i = e !== r.orgID, a = !t || n.origin !== t, o = -1 === Object.keys(O).indexOf(r.prefix); + return i || a || o; + }, this.send = function (n, r, i) { + var a = r + '|' + e; + i && i === Object(i) && (a += '|' + JSON.stringify(i)); + try { + n.postMessage(a, t); + } catch (e) { + } + }; + }, M = C.MESSAGES, V = function (e, t, n, r) { + function i(e) { + Object.assign(p, e); + } + function a(e) { + Object.assign(p.state, e), Object.assign(p.state.ALLFIELDS, e), p.callbackRegistry.executeAll(p.state); + } + function o(e) { + if (!h.isInvalid(e)) { + g = !1; + var t = h.parse(e); + p.setStateAndPublish(t.state); + } + } + function s(e) { + !g && m && (g = !0, h.send(r, e)); + } + function c() { + i(new k(n._generateID)), p.getMarketingCloudVisitorID(), p.callbackRegistry.executeAll(p.state, !0), b.removeEventListener('message', u); + } + function u(e) { + if (!h.isInvalid(e)) { + var t = h.parse(e); + g = !1, b.clearTimeout(p._handshakeTimeout), b.removeEventListener('message', u), i(new D(p)), b.addEventListener('message', o), p.setStateAndPublish(t.state), p.callbackRegistry.hasCallbacks() && s(M.GETSTATE); + } + } + function l() { + m && postMessage ? (b.addEventListener('message', u), s(M.HANDSHAKE), p._handshakeTimeout = setTimeout(c, 250)) : c(); + } + function d() { + b.s_c_in || (b.s_c_il = [], b.s_c_in = 0), p._c = 'Visitor', p._il = b.s_c_il, p._in = b.s_c_in, p._il[p._in] = p, b.s_c_in++; + } + function f() { + function e(e) { + 0 !== e.indexOf('_') && 'function' == typeof n[e] && (p[e] = function () { + }); + } + Object.keys(n).forEach(e), p.getSupplementalDataID = n.getSupplementalDataID, p.isAllowed = function () { + return !0; + }; + } + var p = this, m = t.whitelistParentDomain; + p.state = { ALLFIELDS: {} }, p.version = n.version, p.marketingCloudOrgID = e, p.cookieDomain = n.cookieDomain || '', p._instanceType = 'child'; + var g = !1, h = new L(e, m); + p.callbackRegistry = P(), p.init = function () { + d(), f(), i(new S(p)), l(); + }, p.findField = function (e, t) { + if (void 0 !== p.state[e]) + return t(p.state[e]), p.state[e]; + }, p.messageParent = s, p.setStateAndPublish = a; + }, R = C.MESSAGES, N = C.ALL_APIS, F = C.ASYNC_API_MAP, B = C.FIELDGROUP_TO_FIELD, U = function (e, t) { + function n() { + var t = {}; + return Object.keys(N).forEach(function (n) { + var r = N[n], i = e[r](); + T.isValueEmpty(i) || (t[n] = i); + }), t; + } + function r() { + var t = []; + return e._loading && Object.keys(e._loading).forEach(function (n) { + if (e._loading[n]) { + var r = B[n]; + t.push(r); + } + }), t.length ? t : null; + } + function i(t) { + return function n() { + var i = r(); + if (i) { + var a = F[i[0]]; + e[a](n, !0); + } else + t(); + }; + } + function a(e, r) { + var i = n(); + t.send(e, r, i); + } + function o(e) { + c(e), a(e, R.HANDSHAKE); + } + function s(e) { + i(function () { + a(e, R.PARENTSTATE); + })(); + } + function c(n) { + function r(r) { + i.call(e, r), t.send(n, R.PARENTSTATE, { CUSTOMERIDS: e.getCustomerIDs() }); + } + var i = e.setCustomerIDs; + e.setCustomerIDs = r; + } + return function (e) { + t.isInvalid(e) || (t.parse(e).prefix === R.HANDSHAKE ? o : s)(e.source); + }; + }, z = function (e, t) { + function n(e) { + return function (n) { + r[e] = n, ++i === a && t(r); + }; + } + var r = {}, i = 0, a = Object.keys(e).length; + Object.keys(e).forEach(function (t) { + var r = e[t]; + if (r.fn) { + var i = r.args || []; + i.unshift(n(t)), r.fn.apply(r.context || null, i); + } + }); + }, q = { + get: function (e) { + e = encodeURIComponent(e); + var t = (';' + document.cookie).split(' ').join(';'), n = t.indexOf(';' + e + '='), r = n < 0 ? n : t.indexOf(';', n + 1); + return n < 0 ? '' : decodeURIComponent(t.substring(n + 2 + e.length, r < 0 ? t.length : r)); + }, + set: function (e, t, n) { + var i = r(n, 'cookieLifetime'), a = r(n, 'expires'), o = r(n, 'domain'), s = r(n, 'secure') ? 'Secure' : ''; + if (a && 'SESSION' !== i && 'NONE' !== i) { + var c = '' !== t ? parseInt(i || 0, 10) : -60; + if (c) + (a = new Date()).setTime(a.getTime() + 1000 * c); + else if (1 === a) { + var u = (a = new Date()).getYear(); + a.setYear(u + 2 + (u < 1900 ? 1900 : 0)); + } + } else + a = 0; + return e && 'NONE' !== i ? (document.cookie = encodeURIComponent(e) + '=' + encodeURIComponent(t) + '; path=/;' + (a ? ' expires=' + a.toGMTString() + ';' : '') + (o ? ' domain=' + o + ';' : '') + s, this.get(e) === t) : 0; + }, + remove: function (e, t) { + var n = r(t, 'domain'); + n = n ? ' domain=' + n + ';' : '', document.cookie = encodeURIComponent(e) + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;' + n; + } + }, H = function (e) { + var t; + !e && b.location && (e = b.location.hostname); + var n, r = (t = e).split('.'); + for (n = r.length - 2; n >= 0; n--) + if (t = r.slice(n).join('.'), q.set('test', 'cookie', { domain: t })) + return q.remove('test', { domain: t }), t; + return ''; + }, W = { + compare: s, + isLessThan: function (e, t) { + return s(e, t) < 0; + }, + areVersionsDifferent: function (e, t) { + return 0 !== s(e, t); + }, + isGreaterThan: function (e, t) { + return s(e, t) > 0; + }, + isEqual: function (e, t) { + return 0 === s(e, t); + } + }, G = !!b.postMessage, Y = { + postMessage: function (e, t, n) { + var r = 1; + t && (G ? n.postMessage(e, t.replace(/([^:]+:\/\/[^\/]+).*/, '$1')) : t && (n.location = t.replace(/#.*$/, '') + '#' + +new Date() + r++ + '&' + e)); + }, + receiveMessage: function (e, t) { + var n; + try { + G && (e && (n = function (n) { + if ('string' == typeof t && n.origin !== t || '[object Function]' === Object.prototype.toString.call(t) && !1 === t(n.origin)) + return !1; + e(n); + }), b.addEventListener ? b[e ? 'addEventListener' : 'removeEventListener']('message', n) : b[e ? 'attachEvent' : 'detachEvent']('onmessage', n)); + } catch (e) { + } + } + }, X = function (e) { + var t, n, r = '0123456789', i = '', a = '', o = 8, s = 10, c = 10; + if (1 == e) { + for (r += 'ABCDEF', t = 0; 16 > t; t++) + n = Math.floor(Math.random() * o), i += r.substring(n, n + 1), n = Math.floor(Math.random() * o), a += r.substring(n, n + 1), o = 16; + return i + '-' + a; + } + for (t = 0; 19 > t; t++) + n = Math.floor(Math.random() * s), i += r.substring(n, n + 1), 0 === t && 9 == n ? s = 3 : ((1 == t || 2 == t) && 10 != s && 2 > n || 2 < t) && (s = 10), n = Math.floor(Math.random() * c), a += r.substring(n, n + 1), 0 === t && 9 == n ? c = 3 : ((1 == t || 2 == t) && 10 != c && 2 > n || 2 < t) && (c = 10); + return i + a; + }, K = function (e) { + return { + corsMetadata: function () { + const $___old_4ffcd224358aedee = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_0004aa0f26d1cfa6 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_4ffcd224358aedee) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_3d049bcfecf95e89.XMLHttpRequest)); + if ($___old_0004aa0f26d1cfa6) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_3d049bcfecf95e89.XMLHttpRequest)); + return function () { + var e = 'none', t = !0; + return 'undefined' != typeof XMLHttpRequest && XMLHttpRequest === Object(XMLHttpRequest) && ('withCredentials' in new XMLHttpRequest() ? e = 'XMLHttpRequest' : 'undefined' != typeof XDomainRequest && XDomainRequest === Object(XDomainRequest) && (t = !1), Object.prototype.toString.call(b.HTMLElement).indexOf('Constructor') > 0 && (t = !1)), { + corsType: e, + corsCookiesEnabled: t + }; + }.apply(this, arguments); + } finally { + if ($___old_4ffcd224358aedee) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_4ffcd224358aedee)); + if ($___old_0004aa0f26d1cfa6) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_0004aa0f26d1cfa6)); + } + }(), + getCORSInstance: function () { + const $___old_37cd93cdb6a95c9f = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_2270f279c5c2896f = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_37cd93cdb6a95c9f) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_3d049bcfecf95e89.XMLHttpRequest)); + if ($___old_2270f279c5c2896f) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_3d049bcfecf95e89.XMLHttpRequest)); + return function () { + return 'none' === this.corsMetadata.corsType ? null : new b[this.corsMetadata.corsType](); + }.apply(this, arguments); + } finally { + if ($___old_37cd93cdb6a95c9f) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_37cd93cdb6a95c9f)); + if ($___old_2270f279c5c2896f) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_2270f279c5c2896f)); + } + }, + fireCORS: function (t, n) { + function r(e) { + var n; + try { + if ((n = JSON.parse(e)) !== Object(n)) + return void i.handleCORSError(t, null, 'Response is not JSON'); + } catch (e) { + return void i.handleCORSError(t, e, 'Error parsing response as JSON'); + } + try { + for (var r = t.callback, a = b, o = 0; o < r.length; o++) + a = a[r[o]]; + a(n); + } catch (e) { + i.handleCORSError(t, e, 'Error forming callback function'); + } + } + var i = this; + n && (t.loadErrorHandler = n); + try { + var a = this.getCORSInstance(); + a.open('get', t.corsUrl + '&ts=' + new Date().getTime(), !0), 'XMLHttpRequest' === this.corsMetadata.corsType && (a.withCredentials = !0, a.timeout = e.loadTimeout, a.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'), a.onreadystatechange = function () { + 4 === this.readyState && 200 === this.status && r(this.responseText); + }), a.onerror = function (e) { + i.handleCORSError(t, e, 'onerror'); + }, a.ontimeout = function (e) { + i.handleCORSError(t, e, 'ontimeout'); + }, a.send(), e._log.requests.push(t.corsUrl); + } catch (e) { + this.handleCORSError(t, e, 'try-catch'); + } + }, + handleCORSError: function (t, n, r) { + e.CORSErrors.push({ + corsData: t, + error: n, + description: r + }), t.loadErrorHandler && ('ontimeout' === r ? t.loadErrorHandler(!0) : t.loadErrorHandler(!1)); + } + }; + }, Q = { + POST_MESSAGE_ENABLED: !!b.postMessage, + DAYS_BETWEEN_SYNC_ID_CALLS: 1, + MILLIS_PER_DAY: 86400000, + ADOBE_MC: 'adobe_mc', + ADOBE_MC_SDID: 'adobe_mc_sdid', + VALID_VISITOR_ID_REGEX: /^[0-9a-fA-F\-]+$/, + ADOBE_MC_TTL_IN_MIN: 5, + VERSION_REGEX: /vVersion\|((\d+\.)?(\d+\.)?(\*|\d+))(?=$|\|)/, + FIRST_PARTY_SERVER_COOKIE: 's_ecid' + }, $ = function (e, t) { + var n = b.document; + return { + THROTTLE_START: 30000, + MAX_SYNCS_LENGTH: 649, + throttleTimerSet: !1, + id: null, + onPagePixels: [], + iframeHost: null, + getIframeHost: function (e) { + if ('string' == typeof e) { + var t = e.split('/'); + return t[0] + '//' + t[2]; + } + }, + subdomain: null, + url: null, + getUrl: function () { + var t, r = 'http://fast.', i = '?d_nsid=' + e.idSyncContainerID + '#' + encodeURIComponent(n.location.origin); + return this.subdomain || (this.subdomain = 'nosubdomainreturned'), e.loadSSL && (r = e.idSyncSSLUseAkamai ? 'https://fast.' : 'https://'), t = r + this.subdomain + '.demdex.net/dest5.html' + i, this.iframeHost = this.getIframeHost(t), this.id = 'destination_publishing_iframe_' + this.subdomain + '_' + e.idSyncContainerID, t; + }, + checkDPIframeSrc: function () { + var t = '?d_nsid=' + e.idSyncContainerID + '#' + encodeURIComponent(n.location.href); + 'string' == typeof e.dpIframeSrc && e.dpIframeSrc.length && (this.id = 'destination_publishing_iframe_' + (e._subdomain || this.subdomain || new Date().getTime()) + '_' + e.idSyncContainerID, this.iframeHost = this.getIframeHost(e.dpIframeSrc), this.url = e.dpIframeSrc + t); + }, + idCallNotProcesssed: null, + doAttachIframe: !1, + startedAttachingIframe: !1, + iframeHasLoaded: null, + iframeIdChanged: null, + newIframeCreated: null, + originalIframeHasLoadedAlready: null, + iframeLoadedCallbacks: [], + regionChanged: !1, + timesRegionChanged: 0, + sendingMessages: !1, + messages: [], + messagesPosted: [], + messagesReceived: [], + messageSendingInterval: Q.POST_MESSAGE_ENABLED ? null : 100, + onPageDestinationsFired: [], + jsonForComparison: [], + jsonDuplicates: [], + jsonWaiting: [], + jsonProcessed: [], + canSetThirdPartyCookies: !0, + receivedThirdPartyCookiesNotification: !1, + readyToAttachIframePreliminary: function () { + return !(e.idSyncDisableSyncs || e.disableIdSyncs || e.idSyncDisable3rdPartySyncing || e.disableThirdPartyCookies || e.disableThirdPartyCalls); + }, + readyToAttachIframe: function () { + return this.readyToAttachIframePreliminary() && (this.doAttachIframe || e._doAttachIframe) && (this.subdomain && 'nosubdomainreturned' !== this.subdomain || e._subdomain) && this.url && !this.startedAttachingIframe; + }, + attachIframe: function () { + function e() { + (i = n.createElement('iframe')).sandbox = 'allow-scripts allow-same-origin', i.title = 'Adobe ID Syncing iFrame', i.id = r.id, i.name = r.id + '_name', i.style.cssText = 'display: none; width: 0; height: 0;', i.src = r.url, r.newIframeCreated = !0, t(), n.body.appendChild(i); + } + function t(e) { + i.addEventListener('load', function () { + i.className = 'aamIframeLoaded', r.iframeHasLoaded = !0, r.fireIframeLoadedCallbacks(e), r.requestToProcess(); + }); + } + this.startedAttachingIframe = !0; + var r = this, i = n.getElementById(this.id); + i ? 'IFRAME' !== i.nodeName ? (this.id += '_2', this.iframeIdChanged = !0, e()) : (this.newIframeCreated = !1, 'aamIframeLoaded' !== i.className ? (this.originalIframeHasLoadedAlready = !1, t('The destination publishing iframe already exists from a different library, but hadn\'t loaded yet.')) : (this.originalIframeHasLoadedAlready = !0, this.iframeHasLoaded = !0, this.iframe = i, this.fireIframeLoadedCallbacks('The destination publishing iframe already exists from a different library, and had loaded alresady.'), this.requestToProcess())) : e(), this.iframe = i; + }, + fireIframeLoadedCallbacks: function (e) { + this.iframeLoadedCallbacks.forEach(function (t) { + 'function' == typeof t && t({ message: e || 'The destination publishing iframe was attached and loaded successfully.' }); + }), this.iframeLoadedCallbacks = []; + }, + requestToProcess: function (t) { + function n() { + i.jsonForComparison.push(t), i.jsonWaiting.push(t), i.processSyncOnPage(t); + } + var r, i = this; + if (t === Object(t) && t.ibs) + if (r = JSON.stringify(t.ibs || []), this.jsonForComparison.length) { + var a, o, s, c = !1; + for (a = 0, o = this.jsonForComparison.length; a < o; a++) + if (s = this.jsonForComparison[a], r === JSON.stringify(s.ibs || [])) { + c = !0; + break; + } + c ? this.jsonDuplicates.push(t) : n(); + } else + n(); + if ((this.receivedThirdPartyCookiesNotification || !Q.POST_MESSAGE_ENABLED || this.iframeHasLoaded) && this.jsonWaiting.length) { + var u = this.jsonWaiting.shift(); + this.process(u), this.requestToProcess(); + } + e.idSyncDisableSyncs || e.disableIdSyncs || !this.iframeHasLoaded || !this.messages.length || this.sendingMessages || (this.throttleTimerSet || (this.throttleTimerSet = !0, setTimeout(function () { + i.messageSendingInterval = Q.POST_MESSAGE_ENABLED ? null : 150; + }, this.THROTTLE_START)), this.sendingMessages = !0, this.sendMessages()); + }, + getRegionAndCheckIfChanged: function (t, n) { + var r = e._getField('MCAAMLH'), i = t.d_region || t.dcs_region; + return r ? i && (e._setFieldExpire('MCAAMLH', n), e._setField('MCAAMLH', i), parseInt(r, 10) !== i && (this.regionChanged = !0, this.timesRegionChanged++, e._setField('MCSYNCSOP', ''), e._setField('MCSYNCS', ''), r = i)) : (r = i) && (e._setFieldExpire('MCAAMLH', n), e._setField('MCAAMLH', r)), r || (r = ''), r; + }, + processSyncOnPage: function (e) { + var t, n, r, i; + if ((t = e.ibs) && t instanceof Array && (n = t.length)) + for (r = 0; r < n; r++) + (i = t[r]).syncOnPage && this.checkFirstPartyCookie(i, '', 'syncOnPage'); + }, + process: function (e) { + var t, n, r, i, a, o = encodeURIComponent, s = !1; + if ((t = e.ibs) && t instanceof Array && (n = t.length)) + for (s = !0, r = 0; r < n; r++) + i = t[r], a = [ + o('ibs'), + o(i.id || ''), + o(i.tag || ''), + T.encodeAndBuildRequest(i.url || [], ','), + o(i.ttl || ''), + '', + '', + i.fireURLSync ? 'true' : 'false' + ], i.syncOnPage || (this.canSetThirdPartyCookies ? this.addMessage(a.join('|')) : i.fireURLSync && this.checkFirstPartyCookie(i, a.join('|'))); + s && this.jsonProcessed.push(e); + }, + checkFirstPartyCookie: function (t, n, r) { + var i = 'syncOnPage' === r, a = i ? 'MCSYNCSOP' : 'MCSYNCS'; + e._readVisitor(); + var o, s, c = e._getField(a), u = !1, l = !1, d = Math.ceil(new Date().getTime() / Q.MILLIS_PER_DAY); + c ? (o = c.split('*'), u = (s = this.pruneSyncData(o, t.id, d)).dataPresent, l = s.dataValid, u && l || this.fireSync(i, t, n, o, a, d)) : (o = [], this.fireSync(i, t, n, o, a, d)); + }, + pruneSyncData: function (e, t, n) { + var r, i, a, o = !1, s = !1; + for (i = 0; i < e.length; i++) + r = e[i], a = parseInt(r.split('-')[1], 10), r.match('^' + t + '-') ? (o = !0, n < a ? s = !0 : (e.splice(i, 1), i--)) : n >= a && (e.splice(i, 1), i--); + return { + dataPresent: o, + dataValid: s + }; + }, + manageSyncsSize: function (e) { + if (e.join('*').length > this.MAX_SYNCS_LENGTH) + for (e.sort(function (e, t) { + return parseInt(e.split('-')[1], 10) - parseInt(t.split('-')[1], 10); + }); e.join('*').length > this.MAX_SYNCS_LENGTH;) + e.shift(); + }, + fireSync: function (t, n, r, i, a, o) { + var s = this; + if (t) { + if ('img' === n.tag) { + var c, u, l, d, f = n.url, p = e.loadSSL ? 'https:' : 'http:'; + for (c = 0, u = f.length; c < u; c++) { + l = f[c], d = /^\/\//.test(l); + var m = new Image(); + m.addEventListener('load', function (t, n, r, i) { + return function () { + s.onPagePixels[t] = null, e._readVisitor(); + var o, c, u, l, d = e._getField(a), f = []; + if (d) + for (c = 0, u = (o = d.split('*')).length; c < u; c++) + (l = o[c]).match('^' + n.id + '-') || f.push(l); + s.setSyncTrackingData(f, n, r, i); + }; + }(this.onPagePixels.length, n, a, o)), m.src = (d ? p : '') + l, this.onPagePixels.push(m); + } + } + } else + this.addMessage(r), this.setSyncTrackingData(i, n, a, o); + }, + addMessage: function (t) { + var n = encodeURIComponent(e._enableErrorReporting ? '---destpub-debug---' : '---destpub---'); + this.messages.push((Q.POST_MESSAGE_ENABLED ? '' : n) + t); + }, + setSyncTrackingData: function (t, n, r, i) { + t.push(n.id + '-' + (i + Math.ceil(n.ttl / 60 / 24))), this.manageSyncsSize(t), e._setField(r, t.join('*')); + }, + sendMessages: function () { + var e, t = this, n = '', r = encodeURIComponent; + this.regionChanged && (n = r('---destpub-clear-dextp---'), this.regionChanged = !1), this.messages.length ? Q.POST_MESSAGE_ENABLED ? (e = n + r('---destpub-combined---') + this.messages.join('%01'), this.postMessage(e), this.messages = [], this.sendingMessages = !1) : (e = this.messages.shift(), this.postMessage(n + e), setTimeout(function () { + t.sendMessages(); + }, this.messageSendingInterval)) : this.sendingMessages = !1; + }, + postMessage: function (e) { + Y.postMessage(e, this.url, this.iframe.contentWindow), this.messagesPosted.push(e); + }, + receiveMessage: function (e) { + var t, n = /^---destpub-to-parent---/; + 'string' == typeof e && n.test(e) && ('canSetThirdPartyCookies' === (t = e.replace(n, '').split('|'))[0] && (this.canSetThirdPartyCookies = 'true' === t[1], this.receivedThirdPartyCookiesNotification = !0, this.requestToProcess()), this.messagesReceived.push(e)); + }, + processIDCallData: function (r) { + (null == this.url || r.subdomain && 'nosubdomainreturned' === this.subdomain) && ('string' == typeof e._subdomain && e._subdomain.length ? this.subdomain = e._subdomain : this.subdomain = r.subdomain || '', this.url = this.getUrl()), r.ibs instanceof Array && r.ibs.length && (this.doAttachIframe = !0), this.readyToAttachIframe() && (e.idSyncAttachIframeOnWindowLoad ? (t.windowLoaded || 'complete' === n.readyState || 'loaded' === n.readyState) && this.attachIframe() : this.attachIframeASAP()), 'function' == typeof e.idSyncIDCallResult ? e.idSyncIDCallResult(r) : this.requestToProcess(r), 'function' == typeof e.idSyncAfterIDCallResult && e.idSyncAfterIDCallResult(r); + }, + canMakeSyncIDCall: function (t, n) { + return e._forceSyncIDCall || !t || n - t > Q.DAYS_BETWEEN_SYNC_ID_CALLS; + }, + attachIframeASAP: function () { + function e() { + t.startedAttachingIframe || (n.body ? t.attachIframe() : setTimeout(e, 30)); + } + var t = this; + e(); + } + }; + }, J = { + audienceManagerServer: {}, + audienceManagerServerSecure: {}, + cookieDomain: {}, + cookieLifetime: {}, + cookieName: {}, + doesOptInApply: {}, + disableThirdPartyCalls: {}, + discardTrackingServerECID: {}, + idSyncAfterIDCallResult: {}, + idSyncAttachIframeOnWindowLoad: {}, + idSyncContainerID: {}, + idSyncDisable3rdPartySyncing: {}, + disableThirdPartyCookies: {}, + idSyncDisableSyncs: {}, + disableIdSyncs: {}, + idSyncIDCallResult: {}, + idSyncSSLUseAkamai: {}, + isCoopSafe: {}, + isIabContext: {}, + isOptInStorageEnabled: {}, + loadSSL: {}, + loadTimeout: {}, + marketingCloudServer: {}, + marketingCloudServerSecure: {}, + optInCookieDomain: {}, + optInStorageExpiry: {}, + overwriteCrossDomainMCIDAndAID: {}, + preOptInApprovals: {}, + previousPermissions: {}, + resetBeforeVersion: {}, + sdidParamExpiry: {}, + serverState: {}, + sessionCookieName: {}, + secureCookie: {}, + takeTimeoutMetrics: {}, + trackingServer: {}, + trackingServerSecure: {}, + whitelistIframeDomains: {}, + whitelistParentDomain: {} + }, Z = { + getConfigNames: function () { + return Object.keys(J); + }, + getConfigs: function () { + return J; + }, + normalizeConfig: function (e) { + return 'function' != typeof e ? e : e(); + } + }, ee = function (e) { + var t = {}; + return e.on = function (e, n, r) { + if (!n || 'function' != typeof n) + throw new Error('[ON] Callback should be a function.'); + t.hasOwnProperty(e) || (t[e] = []); + var i = t[e].push({ + callback: n, + context: r + }) - 1; + return function () { + t[e].splice(i, 1), t[e].length || delete t[e]; + }; + }, e.off = function (e, n) { + t.hasOwnProperty(e) && (t[e] = t[e].filter(function (e) { + if (e.callback !== n) + return e; + })); + }, e.publish = function (e) { + if (t.hasOwnProperty(e)) { + var n = [].slice.call(arguments, 1); + t[e].slice(0).forEach(function (e) { + e.callback.apply(e.context, n); + }); + } + }, e.publish; + }, te = { + PENDING: 'pending', + CHANGED: 'changed', + COMPLETE: 'complete' + }, ne = { + AAM: 'aam', + ADCLOUD: 'adcloud', + ANALYTICS: 'aa', + CAMPAIGN: 'campaign', + ECID: 'ecid', + LIVEFYRE: 'livefyre', + TARGET: 'target', + MEDIA_ANALYTICS: 'mediaaa' + }, re = (t(y = {}, ne.AAM, 565), t(y, ne.ECID, 565), y), ie = (t(_ = {}, ne.AAM, [ + 1, + 10 + ]), t(_, ne.ECID, [ + 1, + 10 + ]), _), ae = [ + 'videoaa', + 'iabConsentHash' + ], oe = function (e) { + return Object.keys(e).map(function (t) { + return e[t]; + }); + }(ne), se = function () { + var e = {}; + return e.callbacks = Object.create(null), e.add = function (t, n) { + if (!u(n)) + throw new Error('[callbackRegistryFactory] Make sure callback is a function or an array of functions.'); + e.callbacks[t] = e.callbacks[t] || []; + var r = e.callbacks[t].push(n) - 1; + return function () { + e.callbacks[t].splice(r, 1); + }; + }, e.execute = function (t, n) { + if (e.callbacks[t]) { + n = (n = void 0 === n ? [] : n) instanceof Array ? n : [n]; + try { + for (; e.callbacks[t].length;) { + var r = e.callbacks[t].shift(); + 'function' == typeof r ? r.apply(null, n) : r instanceof Array && r[1].apply(r[0], n); + } + delete e.callbacks[t]; + } catch (e) { + } + } + }, e.executeAll = function (t, n) { + (n || t && !c(t)) && Object.keys(e.callbacks).forEach(function (n) { + var r = void 0 !== t[n] ? t[n] : ''; + e.execute(n, r); + }, e); + }, e.hasCallbacks = function () { + return Boolean(Object.keys(e.callbacks).length); + }, e; + }, ce = function () { + }, ue = function (e) { + var t = window.console; + return !!t && 'function' == typeof t[e]; + }, le = function (e, t, n) { + return n() ? function () { + if (ue(e)) { + for (var n = arguments.length, r = new Array(n), i = 0; i < n; i++) + r[i] = arguments[i]; + console[e].apply(console, [t].concat(r)); + } + } : ce; + }, de = l, fe = function () { + for (var e = [], t = 0; t < 256; t++) { + for (var n = t, r = 0; r < 8; r++) + n = 1 & n ? 3988292384 ^ n >>> 1 : n >>> 1; + e.push(n); + } + return function (t, n) { + t = unescape(encodeURIComponent(t)), n || (n = 0), n ^= -1; + for (var r = 0; r < t.length; r++) { + var i = 255 & (n ^ t.charCodeAt(r)); + n = n >>> 8 ^ e[i]; + } + return (n ^= -1) >>> 0; + }; + }(), pe = new de('[ADOBE OPT-IN]'), me = function (t, n) { + return e(t) === n; + }, ge = function (e, t) { + return e instanceof Array ? e : me(e, 'string') ? [e] : t || []; + }, he = function (e) { + var t = Object.keys(e); + return !!t.length && t.every(function (t) { + return !0 === e[t]; + }); + }, ve = function (e) { + var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + return !(!e || _e(e)) && ge(e).every(function (e) { + return oe.indexOf(e) > -1 || t && ae.indexOf(e) > -1; + }); + }, be = function (e, t) { + return e.reduce(function (e, n) { + return e[n] = t, e; + }, {}); + }, ye = function (e) { + return JSON.parse(JSON.stringify(e)); + }, _e = function (e) { + return '[object Array]' === Object.prototype.toString.call(e) && !e.length; + }, Ce = function (e) { + if (we(e)) + return e; + try { + return JSON.parse(e); + } catch (e) { + return {}; + } + }, xe = function (e) { + return void 0 === e || (we(e) ? ve(Object.keys(e), !0) : ke(e)); + }, ke = function (e) { + try { + var t = JSON.parse(e); + return !!e && me(e, 'string') && ve(Object.keys(t), !0); + } catch (e) { + return !1; + } + }, we = function (e) { + return null !== e && me(e, 'object') && !1 === Array.isArray(e); + }, Ee = function () { + }, Ie = function (e) { + return me(e, 'function') ? e() : e; + }, De = function (e, t) { + xe(e) || pe.error(''.concat(t)); + }, Ae = function (e) { + return Object.keys(e).map(function (t) { + return e[t]; + }); + }, Se = function (e) { + return Ae(e).filter(function (e, t, n) { + return n.indexOf(e) === t; + }); + }, Te = function (e) { + return function () { + var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n = t.command, r = t.params, i = void 0 === r ? {} : r, a = t.callback, o = void 0 === a ? Ee : a; + if (!n || -1 === n.indexOf('.')) + throw new Error('[OptIn.execute] Please provide a valid command.'); + try { + var s = n.split('.'), c = e[s[0]], u = s[1]; + if (!c || 'function' != typeof c[u]) + throw new Error('Make sure the plugin and API name exist.'); + var l = Object.assign(i, { callback: o }); + c[u].call(c, l); + } catch (e) { + pe.error('[execute] Something went wrong: ' + e.message); + } + }; + }; + f.prototype = Object.create(Error.prototype), f.prototype.constructor = f; + var Pe = 'fetchPermissions', Oe = '[OptIn#registerPlugin] Plugin is invalid.'; + p.Categories = ne, p.TimeoutError = f; + var je = Object.freeze({ + OptIn: p, + IabPlugin: v + }), Le = function (e, t) { + e.publishDestinations = function (n) { + var r = arguments[1], i = arguments[2]; + try { + i = 'function' == typeof i ? i : n.callback; + } catch (e) { + i = function () { + }; + } + var a = t; + if (a.readyToAttachIframePreliminary()) { + if ('string' == typeof n) { + if (!n.length) + return void i({ error: 'subdomain is not a populated string.' }); + if (!(r instanceof Array && r.length)) + return void i({ error: 'messages is not a populated array.' }); + var o = !1; + if (r.forEach(function (e) { + 'string' == typeof e && e.length && (a.addMessage(e), o = !0); + }), !o) + return void i({ error: 'None of the messages are populated strings.' }); + } else { + if (!T.isObject(n)) + return void i({ error: 'Invalid parameters passed.' }); + var s = n; + if ('string' != typeof (n = s.subdomain) || !n.length) + return void i({ error: 'config.subdomain is not a populated string.' }); + var c = s.urlDestinations; + if (!(c instanceof Array && c.length)) + return void i({ error: 'config.urlDestinations is not a populated array.' }); + var u = []; + c.forEach(function (e) { + T.isObject(e) && (e.hideReferrer ? e.message && a.addMessage(e.message) : u.push(e)); + }), function e() { + u.length && setTimeout(function () { + var t = new Image(), n = u.shift(); + t.src = n.url, a.onPageDestinationsFired.push(n), e(); + }, 100); + }(); + } + a.iframe ? (i({ message: 'The destination publishing iframe is already attached and loaded.' }), a.requestToProcess()) : !e.subdomain && e._getField('MCMID') ? (a.subdomain = n, a.doAttachIframe = !0, a.url = a.getUrl(), a.readyToAttachIframe() ? (a.iframeLoadedCallbacks.push(function (e) { + i({ message: 'Attempted to attach and load the destination publishing iframe through this API call. Result: ' + (e.message || 'no result') }); + }), a.attachIframe()) : i({ error: 'Encountered a problem in attempting to attach and load the destination publishing iframe through this API call.' })) : a.iframeLoadedCallbacks.push(function (e) { + i({ message: 'Attempted to attach and load the destination publishing iframe through normal Visitor API processing. Result: ' + (e.message || 'no result') }); + }); + } else + i({ error: 'The destination publishing iframe is disabled in the Visitor library.' }); + }; + }, Me = function e(t) { + function n(e, t) { + return e >>> t | e << 32 - t; + } + for (var r, i, a = Math.pow, o = a(2, 32), s = '', c = [], u = 8 * t.length, l = e.h = e.h || [], d = e.k = e.k || [], f = d.length, p = {}, m = 2; f < 64; m++) + if (!p[m]) { + for (r = 0; r < 313; r += m) + p[r] = m; + l[f] = a(m, 0.5) * o | 0, d[f++] = a(m, 1 / 3) * o | 0; + } + for (t += '\x80'; t.length % 64 - 56;) + t += '\0'; + for (r = 0; r < t.length; r++) { + if ((i = t.charCodeAt(r)) >> 8) + return; + c[r >> 2] |= i << (3 - r) % 4 * 8; + } + for (c[c.length] = u / o | 0, c[c.length] = u, i = 0; i < c.length;) { + var g = c.slice(i, i += 16), h = l; + for (l = l.slice(0, 8), r = 0; r < 64; r++) { + var v = g[r - 15], b = g[r - 2], y = l[0], _ = l[4], C = l[7] + (n(_, 6) ^ n(_, 11) ^ n(_, 25)) + (_ & l[5] ^ ~_ & l[6]) + d[r] + (g[r] = r < 16 ? g[r] : g[r - 16] + (n(v, 7) ^ n(v, 18) ^ v >>> 3) + g[r - 7] + (n(b, 17) ^ n(b, 19) ^ b >>> 10) | 0); + (l = [C + ((n(y, 2) ^ n(y, 13) ^ n(y, 22)) + (y & l[1] ^ y & l[2] ^ l[1] & l[2])) | 0].concat(l))[4] = l[4] + C | 0; + } + for (r = 0; r < 8; r++) + l[r] = l[r] + h[r] | 0; + } + for (r = 0; r < 8; r++) + for (i = 3; i + 1; i--) { + var x = l[r] >> 8 * i & 255; + s += (x < 16 ? 0 : '') + x.toString(16); + } + return s; + }, Ve = function (e, t) { + return 'SHA-256' !== t && 'SHA256' !== t && 'sha256' !== t && 'sha-256' !== t || (e = Me(e)), e; + }, Re = function (e) { + return String(e).trim().toLowerCase(); + }, Ne = je.OptIn; + T.defineGlobalNamespace(), window.adobe.OptInCategories = Ne.Categories; + var Fe = function (t, n, r) { + function i() { + y._customerIDsHashChanged = !1; + } + function a(e) { + var t = e; + return function (e) { + var n = e || I.location.href; + try { + var r = y._extractParamFromUri(n, t); + if (r) + return Z.parsePipeDelimetedKeyValues(r); + } catch (e) { + } + }; + } + function o(e) { + function t(e, t, n) { + e && e.match(Q.VALID_VISITOR_ID_REGEX) && (n === P && (E = !0), t(e)); + } + t(e[P], y.setMarketingCloudVisitorID, P), y._setFieldExpire(R, -1), t(e[M], y.setAnalyticsVisitorID); + } + function s(e) { + e = e || {}, y._supplementalDataIDCurrent = e.supplementalDataIDCurrent || '', y._supplementalDataIDCurrentConsumed = e.supplementalDataIDCurrentConsumed || {}, y._supplementalDataIDLast = e.supplementalDataIDLast || '', y._supplementalDataIDLastConsumed = e.supplementalDataIDLastConsumed || {}; + } + function c(e) { + function t(e, t, n) { + return (n = n ? n += '|' : n) + (e + '=') + encodeURIComponent(t); + } + function n(e, n) { + var r = n[0], i = n[1]; + return null != i && i !== N && (e = t(r, i, e)), e; + } + return function (e) { + return (e = e ? e += '|' : e) + 'TS=' + Z.getTimestampInSeconds(); + }(e.reduce(n, '')); + } + function u(e) { + var t = e.minutesToLive, n = ''; + return (y.idSyncDisableSyncs || y.disableIdSyncs) && (n = n || 'Error: id syncs have been disabled'), 'string' == typeof e.dpid && e.dpid.length || (n = n || 'Error: config.dpid is empty'), 'string' == typeof e.url && e.url.length || (n = n || 'Error: config.url is empty'), void 0 === t ? t = 20160 : (t = parseInt(t, 10), (isNaN(t) || t <= 0) && (n = n || 'Error: config.minutesToLive needs to be a positive number')), { + error: n, + ttl: t + }; + } + function l() { + return !(!y.configs.doesOptInApply || _.optIn.isComplete && d()); + } + function d() { + return y.configs.doesOptInApply && y.configs.isIabContext ? _.optIn.isApproved(_.optIn.Categories.ECID) && w : _.optIn.isApproved(_.optIn.Categories.ECID); + } + function f() { + [ + ['getMarketingCloudVisitorID'], + [ + 'setCustomerIDs', + void 0 + ], + [ + 'syncIdentity', + void 0 + ], + ['getAnalyticsVisitorID'], + ['getAudienceManagerLocationHint'], + ['getLocationHint'], + ['getAudienceManagerBlob'] + ].forEach(function (e) { + var t = e[0], n = 2 === e.length ? e[1] : '', r = y[t]; + y[t] = function (e) { + return d() && y.isAllowed() ? r.apply(y, arguments) : ('function' == typeof e && y._callCallback(e, [n]), n); + }; + }); + } + function p() { + var e = y._getAudienceManagerURLData(), t = e.url; + return y._loadData(S, t, null, e); + } + function m(e, t) { + if (w = !0, e) + throw new Error('[IAB plugin] : ' + e); + t && t.gdprApplies && (x = t.consentString, k = t.hasConsentChangedSinceLastCmpPull ? 1 : 0), p(), v(); + } + function g(e, t) { + if (w = !0, e) + throw new Error('[IAB plugin] : ' + e); + t.gdprApplies && (x = t.consentString, k = t.hasConsentChangedSinceLastCmpPull ? 1 : 0), y.init(), v(); + } + function h() { + _.optIn.isComplete && (_.optIn.isApproved(_.optIn.Categories.ECID) ? y.configs.isIabContext ? _.optIn.execute({ + command: 'iabPlugin.fetchConsentData', + callback: g + }) : (y.init(), v()) : y.configs.isIabContext ? _.optIn.execute({ + command: 'iabPlugin.fetchConsentData', + callback: m + }) : (f(), v())); + } + function v() { + _.optIn.off('complete', h); + } + if (!r || r.split('').reverse().join('') !== t) + throw new Error('Please use `Visitor.getInstance` to instantiate Visitor.'); + var y = this, _ = window.adobe, x = '', k = 0, w = !1, E = !1; + y.version = '5.0.1'; + var I = b, D = I.Visitor; + D.version = y.version, D.AuthState = C.AUTH_STATE, D.OptOut = C.OPT_OUT, I.s_c_in || (I.s_c_il = [], I.s_c_in = 0), y._c = 'Visitor', y._il = I.s_c_il, y._in = I.s_c_in, y._il[y._in] = y, I.s_c_in++, y._instanceType = 'regular', y._log = { requests: [] }, y.marketingCloudOrgID = t, y.cookieName = 'AMCV_' + t, y.sessionCookieName = 'AMCVS_' + t, y.cookieDomain = H(), y.loadSSL = !0, y.loadTimeout = 30000, y.CORSErrors = [], y.marketingCloudServer = y.audienceManagerServer = 'dpm.demdex.net', y.sdidParamExpiry = 30; + var A = null, S = 'MC', P = 'MCMID', O = 'MCIDTS', j = 'A', M = 'MCAID', V = 'AAM', R = 'MCAAMB', N = 'NONE', F = function (e) { + return !Object.prototype[e]; + }, B = K(y); + y.FIELDS = C.FIELDS, y.cookieRead = function (e) { + return q.get(e); + }, y.cookieWrite = function (e, t, n) { + var r = y.cookieLifetime ? ('' + y.cookieLifetime).toUpperCase() : '', i = !1; + return y.configs && y.configs.secureCookie && 'https:' === location.protocol && (i = !0), q.set(e, '' + t, { + expires: n, + domain: y.cookieDomain, + cookieLifetime: r, + secure: i + }); + }, y.resetState = function (e) { + e ? y._mergeServerState(e) : s(); + }, y._isAllowedDone = !1, y._isAllowedFlag = !1, y.isAllowed = function () { + return y._isAllowedDone || (y._isAllowedDone = !0, (y.cookieRead(y.cookieName) || y.cookieWrite(y.cookieName, 'T', 1)) && (y._isAllowedFlag = !0)), 'T' === y.cookieRead(y.cookieName) && y._helpers.removeCookie(y.cookieName), y._isAllowedFlag; + }, y.setMarketingCloudVisitorID = function (e) { + y._setMarketingCloudFields(e); + }, y._use1stPartyMarketingCloudServer = !1, y.getMarketingCloudVisitorID = function (e, t) { + y.marketingCloudServer && y.marketingCloudServer.indexOf('.demdex.net') < 0 && (y._use1stPartyMarketingCloudServer = !0); + var n = y._getAudienceManagerURLData('_setMarketingCloudFields'), r = n.url; + return y._getRemoteField(P, r, e, t, n); + }; + var G = function (e, t) { + var n = {}; + y.getMarketingCloudVisitorID(function () { + t.forEach(function (e) { + n[e] = y._getField(e, !0); + }), -1 !== t.indexOf('MCOPTOUT') ? y.isOptedOut(function (t) { + n.MCOPTOUT = t, e(n); + }, null, !0) : e(n); + }, !0); + }; + y.getVisitorValues = function (e, t) { + var n = { + MCMID: { + fn: y.getMarketingCloudVisitorID, + args: [!0], + context: y + }, + MCOPTOUT: { + fn: y.isOptedOut, + args: [ + void 0, + !0 + ], + context: y + }, + MCAID: { + fn: y.getAnalyticsVisitorID, + args: [!0], + context: y + }, + MCAAMLH: { + fn: y.getAudienceManagerLocationHint, + args: [!0], + context: y + }, + MCAAMB: { + fn: y.getAudienceManagerBlob, + args: [!0], + context: y + } + }, r = t && t.length ? T.pluck(n, t) : n; + t && -1 === t.indexOf('MCAID') ? G(e, t) : z(r, e); + }, y._currentCustomerIDs = {}, y._customerIDsHashChanged = !1, y._newCustomerIDsHash = '', y.setCustomerIDs = function (t, n) { + if (!y.isOptedOut() && t) { + if (!T.isObject(t) || T.isObjectEmpty(t)) + return !1; + var r, a, o, s; + for (r in (y._readVisitor(), t)) + if (F(r) && (y._currentCustomerIDs.dataSources = y._currentCustomerIDs.dataSources || {}, n = (a = t[r]).hasOwnProperty('hashType') ? a.hashType : n, a)) + if ('object' === e(a)) { + var c = {}; + if (a.id) { + if (n) { + if (!(s = Ve(Re(a.id), n))) + return; + a.id = s, c.hashType = n; + } + c.id = a.id; + } + null != a.authState && (c.authState = a.authState), y._currentCustomerIDs.dataSources[r] = c; + } else if (n) { + if (!(s = Ve(Re(a), n))) + return; + y._currentCustomerIDs.dataSources[r] = { + id: s, + hashType: n + }; + } else + y._currentCustomerIDs.dataSources[r] = { id: a }; + var u = y.getCustomerIDs(!0), l = y._getField('MCCIDH'), d = ''; + for (o in (l || (l = 0), u)) { + var f = u[o]; + if (!T.isObjectEmpty(f)) + for (r in f) + F(r) && (d += (d ? '|' : '') + r + '|' + ((a = f[r]).id ? a.id : '') + (a.authState ? a.authState : '')); + } + y._newCustomerIDsHash = String(y._hash(d)), y._newCustomerIDsHash !== l && (y._customerIDsHashChanged = !0, y._mapCustomerIDs(i)); + } + }, y.syncIdentity = function (t, n) { + if (!y.isOptedOut() && t) { + if (!T.isObject(t) || T.isObjectEmpty(t)) + return !1; + var r, a, o, s, c; + for (r in (y._readVisitor(), t)) + if (F(r) && (y._currentCustomerIDs.nameSpaces = y._currentCustomerIDs.nameSpaces || {}, n = (a = t[r]).hasOwnProperty('hashType') ? a.hashType : n, a && 'object' === e(a))) { + var u = {}; + if (a.id) { + if (n) { + if (!(o = Ve(Re(a.id), n))) + return; + a.id = o, u.hashType = n; + } + u.id = a.id; + } + null != a.authState && (u.authState = a.authState), a.dataSource && (y._currentCustomerIDs.dataSources = y._currentCustomerIDs.dataSources || {}, s = a.dataSource, y._currentCustomerIDs.dataSources[s] = u), y._currentCustomerIDs.nameSpaces[r] = u; + } + var l = y.getCustomerIDs(!0), d = y._getField('MCCIDH'), f = ''; + for (c in (d || (d = '0'), l)) { + var p = l[c]; + if (!T.isObjectEmpty(p)) + for (r in p) + F(r) && (f += (f ? '|' : '') + r + '|' + ((a = p[r]).id ? a.id : '') + (a.authState ? a.authState : '')); + } + y._newCustomerIDsHash = String(y._hash(f)), y._newCustomerIDsHash !== d && (y._customerIDsHashChanged = !0, y._mapCustomerIDs(i)); + } + }, y.getCustomerIDs = function (e) { + y._readVisitor(); + var t, n, r = { + dataSources: {}, + nameSpaces: {} + }, i = y._currentCustomerIDs.dataSources; + for (t in i) + F(t) && (n = i[t]).id && (r.dataSources[t] || (r.dataSources[t] = {}), r.dataSources[t].id = n.id, null != n.authState ? r.dataSources[t].authState = n.authState : r.dataSources[t].authState = D.AuthState.UNKNOWN, n.hashType && (r.dataSources[t].hashType = n.hashType)); + var a = y._currentCustomerIDs.nameSpaces; + for (t in a) + F(t) && (n = a[t]).id && (r.nameSpaces[t] || (r.nameSpaces[t] = {}), r.nameSpaces[t].id = n.id, null != n.authState ? r.nameSpaces[t].authState = n.authState : r.nameSpaces[t].authState = D.AuthState.UNKNOWN, n.hashType && (r.nameSpaces[t].hashType = n.hashType)); + return e ? r : r.dataSources; + }, y.setAnalyticsVisitorID = function (e) { + y._setAnalyticsFields(e); + }, y.getAnalyticsVisitorID = function (e, t, n) { + if (!Z.isTrackingServerPopulated() && !n) + return y._callCallback(e, ['']), ''; + var r = ''; + if (n || (r = y.getMarketingCloudVisitorID(function () { + y.getAnalyticsVisitorID(e, !0); + })), r || n) { + var i = n ? y.marketingCloudServer : y.trackingServer, a = ''; + y.loadSSL && (n ? y.marketingCloudServerSecure && (i = y.marketingCloudServerSecure) : y.trackingServerSecure && (i = y.trackingServerSecure)); + var o = {}; + if (i) { + var s = 'http' + (y.loadSSL ? 's' : '') + '://' + i + '/id', c = 'd_visid_ver=' + y.version + '&mcorgid=' + encodeURIComponent(y.marketingCloudOrgID) + (r ? '&mid=' + encodeURIComponent(r) : '') + (y.idSyncDisable3rdPartySyncing || y.disableThirdPartyCookies ? '&d_coppa=true' : ''), u = [ + 's_c_il', + y._in, + '_set' + (n ? 'MarketingCloud' : 'Analytics') + 'Fields' + ]; + a = s + '?' + c + '&callback=s_c_il%5B' + y._in + '%5D._set' + (n ? 'MarketingCloud' : 'Analytics') + 'Fields', o.corsUrl = s + '?' + c, o.callback = u; + } + return o.url = a, y._getRemoteField(n ? P : M, a, e, t, o); + } + return ''; + }, y.getAudienceManagerLocationHint = function (e, t) { + if (y.getMarketingCloudVisitorID(function () { + y.getAudienceManagerLocationHint(e, !0); + })) { + var n = y._getField(M); + if (!n && Z.isTrackingServerPopulated() && (n = y.getAnalyticsVisitorID(function () { + y.getAudienceManagerLocationHint(e, !0); + })), n || !Z.isTrackingServerPopulated()) { + var r = y._getAudienceManagerURLData(), i = r.url; + return y._getRemoteField('MCAAMLH', i, e, t, r); + } + } + return ''; + }, y.getLocationHint = y.getAudienceManagerLocationHint, y.getAudienceManagerBlob = function (e, t) { + if (y.getMarketingCloudVisitorID(function () { + y.getAudienceManagerBlob(e, !0); + })) { + var n = y._getField(M); + if (!n && Z.isTrackingServerPopulated() && (n = y.getAnalyticsVisitorID(function () { + y.getAudienceManagerBlob(e, !0); + })), n || !Z.isTrackingServerPopulated()) { + var r = y._getAudienceManagerURLData(), i = r.url; + return y._customerIDsHashChanged && y._setFieldExpire(R, -1), y._getRemoteField(R, i, e, t, r); + } + } + return ''; + }, y._supplementalDataIDCurrent = '', y._supplementalDataIDCurrentConsumed = {}, y._supplementalDataIDLast = '', y._supplementalDataIDLastConsumed = {}, y.getSupplementalDataID = function (e, t) { + y._supplementalDataIDCurrent || t || (y._supplementalDataIDCurrent = y._generateID(1)); + var n = y._supplementalDataIDCurrent; + return y._supplementalDataIDLast && !y._supplementalDataIDLastConsumed[e] ? (n = y._supplementalDataIDLast, y._supplementalDataIDLastConsumed[e] = !0) : n && (y._supplementalDataIDCurrentConsumed[e] && (y._supplementalDataIDLast = y._supplementalDataIDCurrent, y._supplementalDataIDLastConsumed = y._supplementalDataIDCurrentConsumed, y._supplementalDataIDCurrent = n = t ? '' : y._generateID(1), y._supplementalDataIDCurrentConsumed = {}), n && (y._supplementalDataIDCurrentConsumed[e] = !0)), n; + }; + var J = !1; + y._liberatedOptOut = null, y.getOptOut = function (e, t) { + var n = y._getAudienceManagerURLData('_setMarketingCloudFields'), r = n.url; + if (d()) + return y._getRemoteField('MCOPTOUT', r, e, t, n); + if (y._registerCallback('liberatedOptOut', e), null !== y._liberatedOptOut) + return y._callAllCallbacks('liberatedOptOut', [y._liberatedOptOut]), J = !1, y._liberatedOptOut; + if (J) + return null; + J = !0; + var i = 'liberatedGetOptOut'; + return n.corsUrl = n.corsUrl.replace(/\.demdex\.net\/id\?/, '.demdex.net/optOutStatus?'), n.callback = [i], b[i] = function (e) { + if (e === Object(e)) { + var t, n, r = T.parseOptOut(e, t, N); + t = r.optOut, n = 1000 * r.d_ottl, y._liberatedOptOut = t, setTimeout(function () { + y._liberatedOptOut = null; + }, n); + } + y._callAllCallbacks('liberatedOptOut', [t]), J = !1; + }, B.fireCORS(n), null; + }, y.isOptedOut = function (e, t, n) { + t || (t = D.OptOut.GLOBAL); + var r = y.getOptOut(function (n) { + var r = n === D.OptOut.GLOBAL || n.indexOf(t) >= 0; + y._callCallback(e, [r]); + }, n); + return r ? r === D.OptOut.GLOBAL || r.indexOf(t) >= 0 : null; + }, y._fields = null, y._fieldsExpired = null, y._hash = function (e) { + var t, n = 0; + if (e) + for (t = 0; t < e.length; t++) + n = (n << 5) - n + e.charCodeAt(t), n &= n; + return n; + }, y._generateID = X, y._generateLocalMID = function () { + var e = y._generateID(0); + return ne.isClientSideMarketingCloudVisitorID = !0, e; + }, y._callbackList = null, y._callCallback = function (e, t) { + try { + 'function' == typeof e ? e.apply(I, t) : e[1].apply(e[0], t); + } catch (e) { + } + }, y._registerCallback = function (e, t) { + t && (null == y._callbackList && (y._callbackList = {}), null == y._callbackList[e] && (y._callbackList[e] = []), y._callbackList[e].push(t)); + }, y._callAllCallbacks = function (e, t) { + if (null != y._callbackList) { + var n = y._callbackList[e]; + if (n) + for (; n.length > 0;) + y._callCallback(n.shift(), t); + } + }, y._addQuerystringParam = function (e, t, n, r) { + var i = encodeURIComponent(t) + '=' + encodeURIComponent(n), a = Z.parseHash(e), o = Z.hashlessUrl(e); + if (-1 === o.indexOf('?')) + return o + '?' + i + a; + var s = o.split('?'), c = s[0] + '?', u = s[1]; + return c + Z.addQueryParamAtLocation(u, i, r) + a; + }, y._extractParamFromUri = function (e, t) { + var n = new RegExp('[\\?&#]' + t + '=([^&#]*)').exec(e); + if (n && n.length) + return decodeURIComponent(n[1]); + }, y._parseAdobeMcFromUrl = a(Q.ADOBE_MC), y._parseAdobeMcSdidFromUrl = a(Q.ADOBE_MC_SDID), y._attemptToPopulateSdidFromUrl = function (e) { + var n = y._parseAdobeMcSdidFromUrl(e), r = 1000000000; + n && n.TS && (r = Z.getTimestampInSeconds() - n.TS), n && n.SDID && n.MCORGID === t && r < y.sdidParamExpiry && (y._supplementalDataIDCurrent = n.SDID, y._supplementalDataIDCurrentConsumed.SDID_URL_PARAM = !0); + }, y._attemptToPopulateIdsFromUrl = function () { + var e = y._parseAdobeMcFromUrl(); + if (e && e.TS) { + var n = Z.getTimestampInSeconds() - e.TS; + if (Math.floor(n / 60) > Q.ADOBE_MC_TTL_IN_MIN || e.MCORGID !== t) + return; + o(e); + } + }, y._mergeServerState = function (e) { + if (e) + try { + if ((e = function (e) { + return Z.isObject(e) ? e : JSON.parse(e); + }(e))[y.marketingCloudOrgID]) { + var t = e[y.marketingCloudOrgID]; + !function (e) { + Z.isObject(e) && y.setCustomerIDs(e); + }(t.customerIDs), s(t.sdid); + } + } catch (e) { + throw new Error('`serverState` has an invalid format.'); + } + }, y._timeout = null, y._loadData = function (e, t, n, r) { + t = y._addQuerystringParam(t, 'd_fieldgroup', e, 1), r.url = y._addQuerystringParam(r.url, 'd_fieldgroup', e, 1), r.corsUrl = y._addQuerystringParam(r.corsUrl, 'd_fieldgroup', e, 1), ne.fieldGroupObj[e] = !0, r === Object(r) && r.corsUrl && 'XMLHttpRequest' === B.corsMetadata.corsType && B.fireCORS(r, n, e); + }, y._clearTimeout = function (e) { + null != y._timeout && y._timeout[e] && (clearTimeout(y._timeout[e]), y._timeout[e] = 0); + }, y._settingsDigest = 0, y._getSettingsDigest = function () { + if (!y._settingsDigest) { + var e = y.version; + y.audienceManagerServer && (e += '|' + y.audienceManagerServer), y.audienceManagerServerSecure && (e += '|' + y.audienceManagerServerSecure), y._settingsDigest = y._hash(e); + } + return y._settingsDigest; + }, y._readVisitorDone = !1, y._readVisitor = function () { + if (!y._readVisitorDone) { + y._readVisitorDone = !0; + var e, t, n, r, i, a, o = y._getSettingsDigest(), s = !1, c = y.cookieRead(y.cookieName), u = new Date(); + if (c || E || y.discardTrackingServerECID || (c = y.cookieRead(Q.FIRST_PARTY_SERVER_COOKIE)), null == y._fields && (y._fields = {}), c && 'T' !== c) + for ((c = c.split('|'))[0].match(/^[\-0-9]+$/) && (parseInt(c[0], 10) !== o && (s = !0), c.shift()), c.length % 2 == 1 && c.pop(), e = 0; e < c.length; e += 2) + n = (t = c[e].split('-'))[0], r = c[e + 1], t.length > 1 ? (i = parseInt(t[1], 10), a = t[1].indexOf('s') > 0) : (i = 0, a = !1), s && ('MCCIDH' === n && (r = ''), i > 0 && (i = u.getTime() / 1000 - 60)), n && r && (y._setField(n, r, 1), i > 0 && (y._fields['expire' + n] = i + (a ? 's' : ''), (u.getTime() >= 1000 * i || a && !y.cookieRead(y.sessionCookieName)) && (y._fieldsExpired || (y._fieldsExpired = {}), y._fieldsExpired[n] = !0))); + !y._getField(M) && Z.isTrackingServerPopulated() && (c = y.cookieRead('s_vi')) && (c = c.split('|')).length > 1 && c[0].indexOf('v1') >= 0 && ((e = (r = c[1]).indexOf('[')) >= 0 && (r = r.substring(0, e)), r && r.match(Q.VALID_VISITOR_ID_REGEX) && y._setField(M, r)); + } + }, y._appendVersionTo = function (e) { + var t = 'vVersion|' + y.version, n = e ? y._getCookieVersion(e) : null; + return n ? W.areVersionsDifferent(n, y.version) && (e = e.replace(Q.VERSION_REGEX, t)) : e += (e ? '|' : '') + t, e; + }, y._writeVisitor = function () { + var e, t, n = y._getSettingsDigest(); + for (e in y._fields) + F(e) && y._fields[e] && 'expire' !== e.substring(0, 6) && (t = y._fields[e], n += (n ? '|' : '') + e + (y._fields['expire' + e] ? '-' + y._fields['expire' + e] : '') + '|' + t); + n = y._appendVersionTo(n), y.cookieWrite(y.cookieName, n, 1); + }, y._getField = function (e, t) { + return null == y._fields || !t && y._fieldsExpired && y._fieldsExpired[e] ? null : y._fields[e]; + }, y._setField = function (e, t, n) { + null == y._fields && (y._fields = {}), y._fields[e] = t, n || y._writeVisitor(); + }, y._getFieldList = function (e, t) { + var n = y._getField(e, t); + return n ? n.split('*') : null; + }, y._setFieldList = function (e, t, n) { + y._setField(e, t ? t.join('*') : '', n); + }, y._getFieldMap = function (e, t) { + var n = y._getFieldList(e, t); + if (n) { + var r, i = {}; + for (r = 0; r < n.length; r += 2) + i[n[r]] = n[r + 1]; + return i; + } + return null; + }, y._setFieldMap = function (e, t, n) { + var r, i = null; + if (t) + for (r in (i = [], t)) + F(r) && (i.push(r), i.push(t[r])); + y._setFieldList(e, i, n); + }, y._setFieldExpire = function (e, t, n) { + var r = new Date(); + r.setTime(r.getTime() + 1000 * t), null == y._fields && (y._fields = {}), y._fields['expire' + e] = Math.floor(r.getTime() / 1000) + (n ? 's' : ''), t < 0 ? (y._fieldsExpired || (y._fieldsExpired = {}), y._fieldsExpired[e] = !0) : y._fieldsExpired && (y._fieldsExpired[e] = !1), n && (y.cookieRead(y.sessionCookieName) || y.cookieWrite(y.sessionCookieName, '1')); + }, y._findVisitorID = function (t) { + return t && ('object' === e(t) && (t = t.d_mid ? t.d_mid : t.visitorID ? t.visitorID : t.id ? t.id : t.uuid ? t.uuid : '' + t), t && 'NOTARGET' === (t = t.toUpperCase()) && (t = N), t && (t === N || t.match(Q.VALID_VISITOR_ID_REGEX)) || (t = '')), t; + }, y._setFields = function (t, n) { + if (y._clearTimeout(t), null != y._loading && (y._loading[t] = !1), ne.fieldGroupObj[t] && ne.setState(t, !1), t === S) { + !0 !== ne.isClientSideMarketingCloudVisitorID && (ne.isClientSideMarketingCloudVisitorID = !1); + var r = y._getField(P); + if (!r || y.overwriteCrossDomainMCIDAndAID) { + if (!(r = 'object' === e(n) && n.mid ? n.mid : y._findVisitorID(n))) { + if (y._use1stPartyMarketingCloudServer && !y.tried1stPartyMarketingCloudServer) + return y.tried1stPartyMarketingCloudServer = !0, void y.getAnalyticsVisitorID(null, !1, !0); + r = y._generateLocalMID(); + } + y._setField(P, r); + } + r && r !== N || (r = ''), 'object' === e(n) && ((n.d_region || n.dcs_region || n.d_blob || n.blob) && y._setFields(V, n), y._use1stPartyMarketingCloudServer && n.mid && y._setFields(j, { id: n.id })), y._callAllCallbacks(P, [r]); + } + if (t === V && 'object' === e(n)) { + var i = 604800; + null != n.id_sync_ttl && n.id_sync_ttl && (i = parseInt(n.id_sync_ttl, 10)); + var a = ee.getRegionAndCheckIfChanged(n, i); + y._callAllCallbacks('MCAAMLH', [a]); + var o = y._getField(R); + (n.d_blob || n.blob) && ((o = n.d_blob) || (o = n.blob), y._setFieldExpire(R, i), y._setField(R, o)), o || (o = ''), y._callAllCallbacks(R, [o]), !n.error_msg && y._newCustomerIDsHash && y._setField('MCCIDH', y._newCustomerIDsHash); + } + if (t === j) { + var s = y._getField(M); + s && !y.overwriteCrossDomainMCIDAndAID || ((s = y._findVisitorID(n)) ? s !== N && y._setFieldExpire(R, -1) : s = N, y._setField(M, s)), s && s !== N || (s = ''), y._callAllCallbacks(M, [s]); + } + if (y.idSyncDisableSyncs || y.disableIdSyncs) + ee.idCallNotProcesssed = !0; + else { + ee.idCallNotProcesssed = !1; + var c = {}; + c.ibs = n.ibs, c.subdomain = n.subdomain, ee.processIDCallData(c); + } + if (n === Object(n)) { + var u, l; + d() && y.isAllowed() && (u = y._getField('MCOPTOUT')); + var f = T.parseOptOut(n, u, N); + u = f.optOut, l = f.d_ottl, y._setFieldExpire('MCOPTOUT', l, !0), y._setField('MCOPTOUT', u), y._callAllCallbacks('MCOPTOUT', [u]); + } + }, y._loading = null, y._getRemoteField = function (e, t, n, r, i) { + var a, o = '', s = Z.isFirstPartyAnalyticsVisitorIDCall(e), c = { + MCAAMLH: !0, + MCAAMB: !0 + }; + if (d() && y.isAllowed()) + if (y._readVisitor(), !(!(o = y._getField(e, !0 === c[e])) || y._fieldsExpired && y._fieldsExpired[e]) || y.disableThirdPartyCalls && !s) + o || (e === P ? (y._registerCallback(e, n), o = y._generateLocalMID(), y.setMarketingCloudVisitorID(o)) : e === M ? (y._registerCallback(e, n), o = '', y.setAnalyticsVisitorID(o)) : (o = '', r = !0)); + else if (e === P || 'MCOPTOUT' === e ? a = S : 'MCAAMLH' === e || e === R ? a = V : e === M && (a = j), a) + return !t || null != y._loading && y._loading[a] || (null == y._loading && (y._loading = {}), y._loading[a] = !0, a === V && (k = 0), y._loadData(a, t, function (t) { + if (!y._getField(e)) { + t && ne.setState(a, !0); + var n = ''; + e === P ? n = y._generateLocalMID() : a === V && (n = { error_msg: 'timeout' }), y._setFields(a, n); + } + }, i)), y._registerCallback(e, n), o || (t || y._setFields(a, { id: N }), ''); + return e !== P && e !== M || o !== N || (o = '', r = !0), n && r && y._callCallback(n, [o]), o; + }, y._setMarketingCloudFields = function (e) { + y._readVisitor(), y._setFields(S, e); + }, y._mapCustomerIDs = function (e) { + y.getAudienceManagerBlob(e, !0); + }, y._setAnalyticsFields = function (e) { + y._readVisitor(), y._setFields(j, e); + }, y._setAudienceManagerFields = function (e) { + y._readVisitor(), y._setFields(V, e); + }, y._getAudienceManagerURLData = function (e) { + var t = y.audienceManagerServer, n = '', r = y._getField(P), i = y._getField(R, !0), a = y._getField(M), o = a && a !== N ? '&d_cid_ic=AVID%01' + encodeURIComponent(a) : ''; + if (y.loadSSL && y.audienceManagerServerSecure && (t = y.audienceManagerServerSecure), t) { + var s, c, u, l = y.getCustomerIDs(!0); + if (l) + for (c in l) { + var d = l[c]; + if (!T.isObjectEmpty(d)) { + var f = 'nameSpaces' === c ? '&d_cid_ns=' : '&d_cid_ic='; + for (s in d) + F(s) && (u = d[s], o += f + encodeURIComponent(s) + '%01' + encodeURIComponent(u.id ? u.id : '') + (u.authState ? '%01' + u.authState : '')); + } + } + e || (e = '_setAudienceManagerFields'); + var p = 'http' + (y.loadSSL ? 's' : '') + '://' + t + '/id', m = 'd_visid_ver=' + y.version + (x && -1 !== p.indexOf('demdex.net') ? '&gdpr=1&gdpr_consent=' + x : '') + (k && -1 !== p.indexOf('demdex.net') ? '&d_cf=' + k : '') + '&d_rtbd=json&d_ver=2' + (!r && y._use1stPartyMarketingCloudServer ? '&d_verify=1' : '') + '&d_orgid=' + encodeURIComponent(y.marketingCloudOrgID) + '&d_nsid=' + (y.idSyncContainerID || 0) + (r ? '&d_mid=' + encodeURIComponent(r) : '') + (y.idSyncDisable3rdPartySyncing || y.disableThirdPartyCookies ? '&d_coppa=true' : '') + (!0 === A ? '&d_coop_safe=1' : !1 === A ? '&d_coop_unsafe=1' : '') + (i ? '&d_blob=' + encodeURIComponent(i) : '') + o, g = [ + 's_c_il', + y._in, + e + ]; + return { + url: n = p + '?' + m + '&d_cb=s_c_il%5B' + y._in + '%5D.' + e, + corsUrl: p + '?' + m, + callback: g + }; + } + return { url: n }; + }, y.appendVisitorIDsTo = function (e) { + try { + var t = [ + [ + P, + y._getField(P) + ], + [ + M, + y._getField(M) + ], + [ + 'MCORGID', + y.marketingCloudOrgID + ] + ]; + return y._addQuerystringParam(e, Q.ADOBE_MC, c(t)); + } catch (t) { + return e; + } + }, y.appendSupplementalDataIDTo = function (e, t) { + if (!(t = t || y.getSupplementalDataID(Z.generateRandomString(), !0))) + return e; + try { + var n = c([ + [ + 'SDID', + t + ], + [ + 'MCORGID', + y.marketingCloudOrgID + ] + ]); + return y._addQuerystringParam(e, Q.ADOBE_MC_SDID, n); + } catch (t) { + return e; + } + }; + var Z = { + parseHash: function (e) { + var t = e.indexOf('#'); + return t > 0 ? e.substr(t) : ''; + }, + hashlessUrl: function (e) { + var t = e.indexOf('#'); + return t > 0 ? e.substr(0, t) : e; + }, + addQueryParamAtLocation: function (e, t, n) { + var r = e.split('&'); + return n = null != n ? n : r.length, r.splice(n, 0, t), r.join('&'); + }, + isFirstPartyAnalyticsVisitorIDCall: function (e, t, n) { + return e === M && (t || (t = y.trackingServer), n || (n = y.trackingServerSecure), !('string' != typeof (r = y.loadSSL ? n : t) || !r.length) && r.indexOf('2o7.net') < 0 && r.indexOf('omtrdc.net') < 0); + var r; + }, + isObject: function (e) { + return Boolean(e && e === Object(e)); + }, + removeCookie: function (e) { + q.remove(e, { domain: y.cookieDomain }); + }, + isTrackingServerPopulated: function () { + return !!y.trackingServer || !!y.trackingServerSecure; + }, + getTimestampInSeconds: function () { + return Math.round(new Date().getTime() / 1000); + }, + parsePipeDelimetedKeyValues: function (e) { + return e.split('|').reduce(function (e, t) { + var n = t.split('='); + return e[n[0]] = decodeURIComponent(n[1]), e; + }, {}); + }, + generateRandomString: function (e) { + e = e || 5; + for (var t = '', n = 'abcdefghijklmnopqrstuvwxyz0123456789'; e--;) + t += n[Math.floor(Math.random() * n.length)]; + return t; + }, + normalizeBoolean: function (e) { + return 'true' === e || 'false' !== e && e; + }, + parseBoolean: function (e) { + return 'true' === e || 'false' !== e && null; + }, + replaceMethodsWithFunction: function (e, t) { + for (var n in e) + e.hasOwnProperty(n) && 'function' == typeof e[n] && (e[n] = t); + return e; + } + }; + y._helpers = Z; + var ee = $(y, D); + y._destinationPublishing = ee, y.timeoutMetricsLog = []; + var te, ne = { + isClientSideMarketingCloudVisitorID: null, + MCIDCallTimedOut: null, + AnalyticsIDCallTimedOut: null, + AAMIDCallTimedOut: null, + fieldGroupObj: {}, + setState: function (e, t) { + switch (e) { + case S: + !1 === t ? !0 !== this.MCIDCallTimedOut && (this.MCIDCallTimedOut = !1) : this.MCIDCallTimedOut = t; + break; + case j: + !1 === t ? !0 !== this.AnalyticsIDCallTimedOut && (this.AnalyticsIDCallTimedOut = !1) : this.AnalyticsIDCallTimedOut = t; + break; + case V: + !1 === t ? !0 !== this.AAMIDCallTimedOut && (this.AAMIDCallTimedOut = !1) : this.AAMIDCallTimedOut = t; + } + } + }; + y.isClientSideMarketingCloudVisitorID = function () { + return ne.isClientSideMarketingCloudVisitorID; + }, y.MCIDCallTimedOut = function () { + return ne.MCIDCallTimedOut; + }, y.AnalyticsIDCallTimedOut = function () { + return ne.AnalyticsIDCallTimedOut; + }, y.AAMIDCallTimedOut = function () { + return ne.AAMIDCallTimedOut; + }, y.idSyncGetOnPageSyncInfo = function () { + return y._readVisitor(), y._getField('MCSYNCSOP'); + }, y.idSyncByURL = function (e) { + if (!y.isOptedOut()) { + var t = u(e || {}); + if (t.error) + return t.error; + var n, r, i = e.url, a = encodeURIComponent, o = ee; + return i = i.replace(/^https:/, '').replace(/^http:/, ''), n = T.encodeAndBuildRequest([ + '', + e.dpid, + e.dpuuid || '' + ], ','), r = [ + 'ibs', + a(e.dpid), + 'img', + a(i), + t.ttl, + '', + n + ], o.addMessage(r.join('|')), o.requestToProcess(), 'Successfully queued'; + } + }, y.idSyncByDataSource = function (e) { + if (!y.isOptedOut()) + return e === Object(e) && 'string' == typeof e.dpuuid && e.dpuuid.length ? (e.url = '//dpm.demdex.net/ibs:dpid=' + e.dpid + '&dpuuid=' + e.dpuuid, y.idSyncByURL(e)) : 'Error: config or config.dpuuid is empty'; + }, Le(y, ee), y._getCookieVersion = function (e) { + e = e || y.cookieRead(y.cookieName); + var t = Q.VERSION_REGEX.exec(e); + return t && t.length > 1 ? t[1] : null; + }, y._resetAmcvCookie = function (e) { + var t = y._getCookieVersion(); + t && !W.isLessThan(t, e) || Z.removeCookie(y.cookieName); + }, y.setAsCoopSafe = function () { + A = !0; + }, y.setAsCoopUnsafe = function () { + A = !1; + }, function () { + if (y.configs = Object.create(null), Z.isObject(n)) + for (var e in n) + F(e) && (y[e] = n[e], y.configs[e] = n[e]); + }(), f(), y.init = function () { + l() && (_.optIn.fetchPermissions(h, !0), !_.optIn.isApproved(_.optIn.Categories.ECID)) || te || (te = !0, function () { + if (Z.isObject(n)) { + y.idSyncContainerID = y.idSyncContainerID || 0, A = 'boolean' == typeof y.isCoopSafe ? y.isCoopSafe : Z.parseBoolean(y.isCoopSafe), y.resetBeforeVersion && y._resetAmcvCookie(y.resetBeforeVersion), y._attemptToPopulateIdsFromUrl(), y._attemptToPopulateSdidFromUrl(), y._readVisitor(); + var e = y._getField(O), t = Math.ceil(new Date().getTime() / Q.MILLIS_PER_DAY); + y.idSyncDisableSyncs || y.disableIdSyncs || !ee.canMakeSyncIDCall(e, t) || (y._setFieldExpire(R, -1), y._setField(O, t)), y.getMarketingCloudVisitorID(), y.getAudienceManagerLocationHint(), y.getAudienceManagerBlob(), y._mergeServerState(y.serverState); + } else + y._attemptToPopulateIdsFromUrl(), y._attemptToPopulateSdidFromUrl(); + }(), function () { + if (!y.idSyncDisableSyncs && !y.disableIdSyncs) { + ee.checkDPIframeSrc(); + var e = function () { + var e = ee; + e.readyToAttachIframe() && e.attachIframe(); + }; + I.addEventListener('load', function () { + D.windowLoaded = !0, e(); + }); + try { + Y.receiveMessage(function (e) { + ee.receiveMessage(e.data); + }, ee.iframeHost); + } catch (e) { + } + } + }(), y.whitelistIframeDomains && Q.POST_MESSAGE_ENABLED && (y.whitelistIframeDomains = y.whitelistIframeDomains instanceof Array ? y.whitelistIframeDomains : [y.whitelistIframeDomains], y.whitelistIframeDomains.forEach(function (e) { + var n = new L(t, e), r = U(y, n); + Y.receiveMessage(r, e); + }))); + }; + }; + Fe.config = Z, b.Visitor = Fe; + var Be = Fe, Ue = function (e) { + if (T.isObject(e)) + return Object.keys(e).filter(function (t) { + return '' !== e[t]; + }).reduce(function (t, n) { + var r = Z.normalizeConfig(e[n]), i = T.normalizeBoolean(r); + return t[n] = i, t; + }, Object.create(null)); + }, ze = je.OptIn, qe = je.IabPlugin; + Be.getInstance = function (e, t) { + if (!e) + throw new Error('Visitor requires Adobe Marketing Cloud Org ID.'); + e.indexOf('@') < 0 && (e += '@AdobeOrg'); + var n = function () { + var t = b.s_c_il; + if (t) + for (var n = 0; n < t.length; n++) { + var r = t[n]; + if (r && 'Visitor' === r._c && r.marketingCloudOrgID === e) + return r; + } + }(); + if (n) + return n; + var r = Ue(t); + !function (e) { + b.adobe.optIn = b.adobe.optIn || function () { + var t = T.pluck(e, [ + 'doesOptInApply', + 'previousPermissions', + 'preOptInApprovals', + 'isOptInStorageEnabled', + 'optInStorageExpiry', + 'isIabContext' + ]), n = e.optInCookieDomain || e.cookieDomain; + n = (n = n || H()) === window.location.hostname ? '' : n, t.optInCookieDomain = n; + var r = new ze(t, { cookies: q }); + if (t.isIabContext && t.doesOptInApply) { + var i = new qe(); + r.registerPlugin(i); + } + return r; + }(); + }(r || {}); + var i = e.split('').reverse().join(''), a = new Be(e, null, i); + T.isObject(r) && r.cookieDomain && (a.cookieDomain = r.cookieDomain), b.s_c_il.splice(--b.s_c_in, 1); + var o = T.getIeVersion(); + if ('number' == typeof o && o < 10) + return a._helpers.replaceMethodsWithFunction(a, function () { + }); + var s = function () { + try { + return b.self !== b.parent; + } catch (e) { + return !0; + } + }() && !function (e) { + return e.cookieWrite('TEST_AMCV_COOKIE', 'T', 1), 'T' === e.cookieRead('TEST_AMCV_COOKIE') && (e._helpers.removeCookie('TEST_AMCV_COOKIE'), !0); + }(a) && b.parent ? new V(e, r, a, b.parent) : new Be(e, r, i); + return a = null, s.init(), s; + }, function () { + function e() { + Be.windowLoaded = !0; + } + b.addEventListener ? b.addEventListener('load', e) : b.attachEvent && b.attachEvent('onload', e), Be.codeLoadEnd = new Date().getTime(); + }(); + }(), Visitor); + } + }, + 'adobe-mcid/src/view/utils/timeUnits.js': { + script: function (e) { + var t = { + Hours: 3600, + Days: 86400, + Weeks: 604800, + Months: 2592000, + Years: 31536000 + }; + e.exports = t; + } + } + } + }, + 'adobe-analytics': { + displayName: 'Adobe Analytics', + hostedLibFilesBaseUrl: 'https://assets.adobedtm.com/extensions/EPbde2f7ca14e540399dcc1f8208860b7b/', + settings: { + orgId: '1E22171B520E93BF0A490D44@AdobeOrg', + libraryCode: { + type: 'custom', + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/EX63a3e7a2131747b6b4470d7e23aabb0b-libraryCode_source.min.js', + accounts: { + staging: ['fedexglbldev'], + production: ['fedexglbl'], + development: ['fedexglbldev'] + }, + trackerVariableName: 's' + }, + trackerProperties: { + eVars: [{ + name: 'eVar171', + type: 'value', + value: '%appName%' + }], + props: [ + { + name: 'prop2', + type: 'value', + value: '%content:countryCode%' + }, + { + name: 'prop3', + type: 'value', + value: '%content:language%' + }, + { + name: 'prop5', + type: 'value', + value: '%content:region%' + } + ], + currencyCode: 'USD', + trackingServer: 'metrics.fedex.com', + trackInlineStats: !0, + trackDownloadLinks: !0, + trackExternalLinks: !0, + linkExternalFilters: [ + 'open.spotify.com', + 'podcasts.apple.com', + 'soundcloud.com', + 'www.stitcher.com', + 'event.on24.com', + 'custombrandedboxes.fedex.com', + 'bit.ly', + 'spoti.fi', + 'apple.co' + ], + linkInternalFilters: [], + trackingServerSecure: 'smetrics.fedex.com', + linkDownloadFileTypes: [ + 'doc', + 'docx', + 'eps', + 'jpg', + 'png', + 'svg', + 'xls', + 'ppt', + 'pptx', + 'pdf', + 'xlsx', + 'tab', + 'csv', + 'zip', + 'txt', + 'vsd', + 'vxd', + 'xml', + 'js', + 'css', + 'rar', + 'exe', + 'wma', + 'mov', + 'avi', + 'wmv', + 'mp3', + 'wav', + 'm4v', + 'jpeg' + ] + } + }, + modules: { + 'adobe-analytics/src/lib/actions/sendBeacon.js': { + name: 'send-beacon', + displayName: 'Send Beacon', + script: function (e, t, n, r) { + 'use strict'; + var i = n('../sharedModules/getTracker'), a = function (e) { + return e && e.nodeName && 'a' === e.nodeName.toLowerCase(); + }, o = function (e) { + return a(e) ? e.innerHTML : 'link clicked'; + }, s = function (e, t, n) { + if ('page' === t.type) + r.logger.info('Firing page view beacon.'), e.t(); + else { + var i = { + linkType: t.linkType || 'o', + linkName: t.linkName || o(n) + }; + r.logger.info('Firing link track beacon using the values: ' + JSON.stringify(i) + '.'), e.tl(a(n) ? n : 'true', i.linkType, i.linkName); + } + }; + e.exports = function (e, t) { + return i().then(function (n) { + s(n, e, t.element); + }, function (e) { + r.logger.error('Cannot send beacon: ' + e); + }); + }; + } + }, + 'adobe-analytics/src/lib/actions/setVariables.js': { + name: 'set-variables', + displayName: 'Set Variables', + script: function (e, t, n, r) { + 'use strict'; + var i = n('../sharedModules/getTracker'), a = n('../helpers/applyTrackerVariables'); + e.exports = function (e, t) { + return i().then(function (n) { + r.logger.info('Set variables on the tracker.'), a(n, e.trackerProperties), e.customSetup && e.customSetup.source && e.customSetup.source.call(t.element, t, n); + }, function (e) { + r.logger.error('Cannot set variables: ' + e); + }); + }; + } + }, + 'adobe-analytics/src/lib/actions/clearVariables.js': { + name: 'clear-variables', + displayName: 'Clear Variables', + script: function (e, t, n, r) { + 'use strict'; + var i = n('../sharedModules/getTracker'); + e.exports = function () { + return i().then(function (e) { + e.clearVars && (r.logger.info('Clear variables.'), e.clearVars()); + }, function (e) { + r.logger.error('Cannot clear variables: ' + e); + }); + }; + } + }, + 'adobe-analytics/src/lib/sharedModules/getTracker.js': { + script: function (e, t, n, r) { + 'use strict'; + var i, a = n('@adobe/reactor-cookie'), o = n('@adobe/reactor-promise'), s = n('@adobe/reactor-window'), c = n('../helpers/settingsHelper'), u = n('../helpers/augmenters'), l = n('../helpers/applyTrackerVariables'), d = n('../helpers/loadLibrary'), f = n('../helpers/generateVersion')(r.buildInfo.turbineBuildDate), p = 'beforeSettings', m = r.getSharedModule('adobe-mcid', 'mcid-instance'), g = function (e) { + return !e || 'true' === a.get(e); + }, h = function (e) { + return o.all(u.map(function (t) { + var n; + try { + n = t(e); + } catch (e) { + setTimeout(function () { + throw e; + }); + } + return o.resolve(n); + })).then(function () { + return e; + }); + }, v = function (e) { + return m && (r.logger.info('Setting MCID instance on the tracker.'), e.visitor = m), e; + }, b = function (e) { + return r.logger.info('Setting version on tracker: "' + f + '".'), void 0 !== e.tagContainerMarker ? e.tagContainerMarker = f : 'string' == typeof e.version && e.version.substring(e.version.length - 5) !== '-' + f && (e.version += '-' + f), e; + }, y = function (e, t, n) { + return t.loadPhase === p && t.source && (r.logger.info('Calling custom script before settings.'), t.source.call(s, n)), l(n, e || {}), t.loadPhase !== p && t.source && (r.logger.info('Calling custom script after settings.'), t.source.call(s, n)), n; + }, _ = function (e, t) { + return c.isAudienceManagementEnabled(e) && (t.loadModule('AudienceManagement'), r.logger.info('Initializing AudienceManagement module'), t.AudienceManagement.setup(e.moduleProperties.audienceManager.config)), t; + }, C = (i = r.getExtensionSettings(), g(i.trackingCookieName) ? d(i).then(h).then(v).then(b).then(y.bind(null, i.trackerProperties, i.customSetup || {})).then(_.bind(null, i)) : o.reject('EU compliance was not acknowledged by the user.')); + e.exports = function () { + return C; + }; + }, + name: 'get-tracker', + shared: !0 + }, + 'adobe-analytics/src/lib/sharedModules/augmentTracker.js': { + name: 'augment-tracker', + shared: !0, + script: function (e, t, n) { + 'use strict'; + var r = n('../helpers/augmenters'); + e.exports = function (e) { + r.push(e); + }; + } + }, + 'adobe-analytics/src/lib/helpers/settingsHelper.js': { + script: function (e, t, n, r) { + 'use strict'; + var i = n('@adobe/reactor-window'), a = { + LIB_TYPES: { + MANAGED: 'managed', + PREINSTALLED: 'preinstalled', + REMOTE: 'remote', + CUSTOM: 'custom' + }, + MANAGED_LIB_PATHS: { + APP_MEASUREMENT: 'AppMeasurement.js', + ACTIVITY_MAP: 'AppMeasurement_Module_ActivityMap.js', + AUDIENCE_MANAGEMENT: 'AppMeasurement_Module_AudienceManagement.js' + }, + getReportSuites: function (e) { + var t = e.production; + return e[r.buildInfo.environment] && (t = e[r.buildInfo.environment]), t.join(','); + }, + isActivityMapEnabled: function (e) { + return !(e.libraryCode && !e.libraryCode.useActivityMap && !1 === e.libraryCode.useActivityMap); + }, + isAudienceManagementEnabled: function (e) { + var t = !1; + return e && e.moduleProperties && e.moduleProperties.audienceManager && e.moduleProperties.audienceManager.config && i && i._satellite && i._satellite.company && i._satellite.company.orgId && (t = !0), t; + } + }; + e.exports = a; + } + }, + 'adobe-analytics/src/lib/helpers/augmenters.js': { + script: function (e) { + 'use strict'; + e.exports = []; + } + }, + 'adobe-analytics/src/lib/helpers/applyTrackerVariables.js': { + script: function (e, t, n, r) { + 'use strict'; + var i = n('@adobe/reactor-query-string'), a = n('@adobe/reactor-window'), o = /eVar([0-9]+)/, s = /prop([0-9]+)/, c = new RegExp('^(eVar[0-9]+)|(prop[0-9]+)|(hier[0-9]+)|campaign|purchaseID|channel|server|state|zip|pageType$'), u = function (e, t, n) { + return n.indexOf(e) === t; + }, l = function (e, t, n) { + var r = Object.keys(t).filter(c.test.bind(c)); + return n && r.push('events'), (r = r.concat((e.linkTrackVars || '').split(','))).filter(function (e, t) { + return 'None' !== e && e && u(e, t, r); + }).join(','); + }, d = function (e, t) { + var n = t.map(function (e) { + return e.name; + }); + return (n = n.concat((e.linkTrackEvents || '').split(','))).filter(function (e, t) { + return 'None' !== e && u(e, t, n); + }).join(','); + }, f = function (e, t, n) { + e[t] = n[t].join(','); + }, p = function (e, t, n) { + var r = n.dynamicVariablePrefix || 'D='; + n[t].forEach(function (t) { + var n; + if ('value' === t.type) + n = t.value; + else { + var i = o.exec(t.value); + if (i) + n = r + 'v' + i[1]; + else { + var a = s.exec(t.value); + a && (n = r + 'c' + a[1]); + } + } + e[t.name] = n; + }); + }, m = { + linkDownloadFileTypes: f, + linkExternalFilters: f, + linkInternalFilters: f, + hierarchies: function (e, t, n) { + n[t].forEach(function (t) { + e[t.name] = t.sections.join(t.delimiter); + }); + }, + props: p, + eVars: p, + campaign: function (e, t, n) { + if ('queryParam' === n[t].type) { + var r = i.parse(a.location.search); + e[t] = r[n[t].value]; + } else + e[t] = n[t].value; + }, + events: function (e, t, n) { + var r = n[t].map(function (e) { + var t = e.name; + return e.id && (t = [ + t, + e.id + ].join(':')), e.value && (t = [ + t, + e.value + ].join('=')), t; + }); + e[t] = r.join(','); + } + }; + e.exports = function (e, t) { + var n = {}; + t = t || {}, Object.keys(t).forEach(function (e) { + var r = m[e], i = t[e]; + r ? r(n, e, t) : n[e] = i; + }), n.events && e.events && e.events.length > 0 && (n.events = e.events + ',' + n.events); + var i = t && t.events && t.events.length > 0, a = l(e, n, i); + a && (n.linkTrackVars = a); + var o = d(e, t.events || []); + o && (n.linkTrackEvents = o), r.logger.info('Applying the following properties on tracker: "' + JSON.stringify(n) + '".'), Object.keys(n).forEach(function (t) { + e[t] = n[t]; + }); + }; + } + }, + 'adobe-analytics/src/lib/helpers/loadLibrary.js': { + script: function (e, t, n, r) { + 'use strict'; + var i = n('@adobe/reactor-load-script'), a = n('@adobe/reactor-window'), o = n('@adobe/reactor-promise'), s = n('./settingsHelper'), c = n('./pollHelper'), u = function (e, t) { + if (!a.s_gi) + throw new Error('Unable to create AppMeasurement tracker, `s_gi` function not found.' + a.AppMeasurement); + r.logger.info('Creating AppMeasurement tracker with these report suites: "' + t + '"'); + var n = a.s_gi(t); + return e.libraryCode.scopeTrackerGlobally && (r.logger.info('Setting the tracker as window.s'), a.s = n), n; + }, l = function (e) { + var t = []; + switch (e.libraryCode.type) { + case s.LIB_TYPES.MANAGED: + t.push(r.getHostedLibFileUrl(s.MANAGED_LIB_PATHS.APP_MEASUREMENT)), s.isActivityMapEnabled(e) && t.push(r.getHostedLibFileUrl(s.MANAGED_LIB_PATHS.ACTIVITY_MAP)); + break; + case s.LIB_TYPES.CUSTOM: + t.push(e.libraryCode.source); + break; + case s.LIB_TYPES.REMOTE: + t.push('https:' === a.location.protocol ? e.libraryCode.httpsUrl : e.libraryCode.httpUrl); + } + if (s.isAudienceManagementEnabled(e)) { + var n = { namespace: a._satellite.company.orgId }; + e.moduleProperties.audienceManager.config.visitorService = n, t.push(r.getHostedLibFileUrl(s.MANAGED_LIB_PATHS.AUDIENCE_MANAGEMENT)); + } + return t; + }, d = function (e) { + return o.all(l(e).map(function (e) { + return r.logger.info('Loading script: ' + e), i(e); + })); + }, f = function (e, t) { + if (e.libraryCode.accounts) + if (t.sa) { + var n = s.getReportSuites(e.libraryCode.accounts); + r.logger.info('Setting the following report suites on the tracker: "' + n + '"'), t.sa(n); + } else + r.logger.warn('Cannot set report suites on tracker. `sa` method not available.'); + return t; + }, p = function (e) { + if (a[e]) + return r.logger.info('Found tracker located at: "' + e + '".'), a[e]; + throw new Error('Cannot find the global variable name: "' + e + '".'); + }; + e.exports = function (e) { + var t = d(e); + switch (e.libraryCode.type) { + case s.LIB_TYPES.MANAGED: + var n = s.getReportSuites(e.libraryCode.accounts); + return t.then(u.bind(null, e, n)); + case s.LIB_TYPES.PREINSTALLED: + return t.then(c.poll.bind(null, a, e.libraryCode.trackerVariableName)).then(f.bind(null, e)); + case s.LIB_TYPES.CUSTOM: + case s.LIB_TYPES.REMOTE: + return t.then(p.bind(null, e.libraryCode.trackerVariableName)).then(f.bind(null, e)); + default: + throw new Error('Cannot load library. Type not supported.'); + } + }; + } + }, + 'adobe-analytics/src/lib/helpers/generateVersion.js': { + script: function (e) { + 'use strict'; + var t = 8, n = function (e) { + return e.getUTCDate().toString(36); + }, r = function (e) { + return e.substr(e.length - 1); + }, i = function (e) { + return Math.floor(e.getUTCHours() / t); + }, a = function (e) { + var t = (e.getUTCMonth() + 1 + 12 * i(e)).toString(36); + return r(t); + }, o = function (e) { + return (e.getUTCFullYear() - 2010).toString(36); + }; + e.exports = function (e) { + var t = new Date(e); + if (isNaN(t)) + throw new Error('Invalid date provided'); + return ('L' + o(t) + a(t) + n(t)).toUpperCase(); + }; + } + }, + 'adobe-analytics/src/lib/helpers/pollHelper.js': { + script: function (e, t, n, r) { + 'use strict'; + var i = n('@adobe/reactor-promise'), a = 40, o = 250, s = function (e, t, n) { + r.logger.info('Found property located at: "' + t + '"].'), e(n); + }, c = function (e, t) { + return new i(function (n, r) { + if (e[t]) + return s(n, t, e[t]); + var i = 1, c = setInterval(function () { + e[t] && (s(n, t, e[t]), clearInterval(c)), i >= a && (clearInterval(c), r(new Error('Bailing out. Cannot find the variable name: "' + t + '"].'))), i++; + }, o); + }); + }; + e.exports = { + poll: function (e, t) { + return r.logger.info('Waiting for the property to become accessible at: "' + t + '"].'), c(e, t); + } + }; + } + } + } + }, + core: { + displayName: 'Core', + hostedLibFilesBaseUrl: 'https://assets.adobedtm.com/extensions/EP0fe6b1b3170b414e92e8f7ad4f74f857/', + modules: { + 'core/src/lib/dataElements/customCode.js': { + name: 'custom-code', + displayName: 'Custom Code', + script: function (e) { + 'use strict'; + e.exports = function (e, t) { + return e.source(t); + }; + } + }, + 'core/src/lib/dataElements/javascriptVariable.js': { + name: 'javascript-variable', + displayName: 'JavaScript Variable', + script: function (e, t, n) { + 'use strict'; + var r = n('../helpers/getObjectProperty.js'); + e.exports = function (e) { + return r(window, e.path); + }; + } + }, + 'core/src/lib/dataElements/queryStringParameter.js': { + name: 'query-string-parameter', + displayName: 'Query String Parameter', + script: function (e, t, n) { + 'use strict'; + var r = n('@adobe/reactor-window'), i = n('@adobe/reactor-query-string'); + e.exports = function (e) { + var t = i.parse(r.location.search); + if (!e.caseInsensitive) + return t[e.name]; + for (var n = e.name.toLowerCase(), a = Object.keys(t), o = 0; o < a.length; o++) { + var s = a[o]; + if (s.toLowerCase() === n) + return t[s]; + } + }; + } + }, + 'core/src/lib/events/libraryLoaded.js': { + name: 'library-loaded', + displayName: 'Library Loaded (Page Top)', + script: function (e, t, n) { + 'use strict'; + var r = n('./helpers/pageLifecycleEvents'); + e.exports = function (e, t) { + r.registerLibraryLoadedTrigger(t); + }; + } + }, + 'core/src/lib/actions/customCode.js': { + name: 'custom-code', + displayName: 'Custom Code', + script: function (e, t, n, r) { + 'use strict'; + var i, a, o, s = n('@adobe/reactor-document'), c = n('./helpers/decorateCode'), u = n('./helpers/loadCodeSequentially'), l = n('../../../node_modules/postscribe/dist/postscribe'), d = r.getExtensionSettings(), f = (i = function (e) { + l(s.body, e, { + beforeWriteToken: function (e) { + return d.cspNonce && 'script' === e.tagName && (e.attrs.nonce = d.cspNonce), e; + }, + error: function (e) { + r.logger.error(e.msg); + } + }); + }, a = [], o = function () { + if (s.body) + for (; a.length;) + i(a.shift()); + else + setTimeout(o, 20); + }, function (e) { + a.push(e), o(); + }), p = function () { + if (s.currentScript) + return s.currentScript.async; + for (var e = s.querySelectorAll('script'), t = 0; t < e.length; t++) { + var n = e[t]; + if (/(launch|satelliteLib)-[^\/]+.js(\?.*)?$/.test(n.src)) + return n.async; + } + return !0; + }(); + e.exports = function (e, t) { + var n = { + settings: e, + event: t + }, r = n.settings.source; + if (r) + return n.settings.isExternal ? u(r).then(function (e) { + e && f(c(n, e)); + }) : void (p || 'loading' !== s.readyState ? f(c(n, r)) : s.write ? s.write(c(n, r)) : f(c(n, r))); + }; + } + }, + 'core/src/lib/conditions/customCode.js': { + name: 'custom-code', + displayName: 'Custom Code', + script: function (e) { + 'use strict'; + e.exports = function (e, t) { + return e.source.call(t.element, t, t.target); + }; + } + }, + 'core/src/lib/events/customEvent.js': { + name: 'custom-event', + displayName: 'Custom Event', + script: function (e, t, n) { + 'use strict'; + var r = n('./helpers/createBubbly')(), i = []; + e.exports = function (e, t) { + var n = e.type; + -1 === i.indexOf(n) && (i.push(n), window.addEventListener(n, r.evaluateEvent, !0)), r.addListener(e, function (e) { + e.nativeEvent.type === n && (e.detail = e.nativeEvent.detail, t(e)); + }); + }; + } + }, + 'core/src/lib/conditions/pathAndQuerystring.js': { + name: 'path-and-querystring', + displayName: 'Path And Query String', + script: function (e, t, n) { + 'use strict'; + var r = n('@adobe/reactor-document'), i = n('../helpers/textMatch'); + e.exports = function (e) { + var t = r.location.pathname + r.location.search; + return e.paths.some(function (e) { + var n = e.valueIsRegex ? new RegExp(e.value, 'i') : e.value; + return i(t, n); + }); + }; + } + }, + 'core/src/lib/events/pageBottom.js': { + name: 'page-bottom', + displayName: 'Page Bottom', + script: function (e, t, n) { + 'use strict'; + var r = n('./helpers/pageLifecycleEvents'); + e.exports = function (e, t) { + r.registerPageBottomTrigger(t); + }; + } + }, + 'core/src/lib/events/click.js': { + name: 'click', + displayName: 'Click', + script: function (e, t, n) { + 'use strict'; + var r = n('@adobe/reactor-window'), i = n('./helpers/createBubbly')(), a = new (n('./helpers/weakMap'))(), o = function (e) { + for (; e;) { + var t = e.tagName; + if (t && 'a' === t.toLowerCase()) { + var n = e.getAttribute('href'), i = e.getAttribute('target'); + return n && (!i || '_self' === i || '_top' === i && r.top === r || i === r.name) ? e : void 0; + } + e = e.parentNode; + } + }; + document.addEventListener('click', i.evaluateEvent, !0), e.exports = function (e, t) { + i.addListener(e, function (n) { + var i = n.nativeEvent; + if (!i.s_fe) { + if (e.anchorDelay && !a.has(i)) { + var s = o(i.target); + s && (i.preventDefault(), setTimeout(function () { + r.location = s.href; + }, e.anchorDelay)), a.set(i, !0); + } + t(n); + } + }); + }, e.exports.__reset = i.__reset; + } + }, + 'core/src/lib/conditions/path.js': { + name: 'path', + displayName: 'Path Without Query String', + script: function (e, t, n) { + 'use strict'; + var r = n('@adobe/reactor-document'), i = n('../helpers/textMatch'); + e.exports = function (e) { + var t = r.location.pathname; + return e.paths.some(function (e) { + var n = e.valueIsRegex ? new RegExp(e.value, 'i') : e.value; + return i(t, n); + }); + }; + } + }, + 'core/src/lib/events/mediaTimePlayed.js': { + name: 'media-time-played', + displayName: 'Media Time Played', + script: function (e, t, n) { + 'use strict'; + var r = n('./helpers/createBubbly')(), i = new (n('./helpers/weakMap'))(), a = [], o = { + SECOND: 'second', + PERCENT: 'percent' + }, s = function (e) { + var t = e.target; + if (t.seekable && t.seekable.length) { + var n = t.seekable, s = n.start(0), c = n.end(0), u = t.currentTime - s, l = i.get(t) || 0; + a.forEach(function (e) { + var n = e.unit === o.SECOND ? e.amount : (c - s) * (e.amount / 100); + n > l && n <= u && r.evaluateEvent({ + target: t, + amount: e.amount, + unit: e.unit + }, !0); + }), i.set(t, u); + } + }; + document.addEventListener('timeupdate', s, !0), e.exports = function (e, t) { + var n = function (t) { + return t.amount === e.amount && t.unit === e.unit; + }; + a.some(n) || a.push({ + amount: e.amount, + unit: e.unit + }), r.addListener(e, function (n) { + if (n.amount !== e.amount || n.unit !== e.unit) + return !1; + t(n); + }); + }; + } + }, + 'core/src/lib/events/elementExists.js': { + name: 'element-exists', + displayName: 'Element Exists', + script: function (e, t, n) { + 'use strict'; + var r = 3000, i = new (n('./helpers/weakMap'))(), a = n('./helpers/matchesProperties'), o = {}; + setInterval(function () { + Object.keys(o).forEach(function (e) { + for (var t = o[e], n = document.querySelectorAll(e), r = 0; r < n.length; r++) { + var s = n[r]; + if (!i.has(s)) { + i.set(s, !0); + for (var c = 0; c < t.length; c++) { + var u = t[c]; + a(s, u.settings.elementProperties) && (u.trigger({ + element: s, + target: s + }), t.splice(c, 1), c--); + } + } + if (!t.length) { + delete o[e]; + break; + } + } + }); + }, r), e.exports = function (e, t) { + var n = o[e.elementSelector]; + n || (n = o[e.elementSelector] = []), n.push({ + settings: e, + trigger: t + }); + }; + } + }, + 'core/src/lib/events/domReady.js': { + name: 'dom-ready', + displayName: 'DOM Ready', + script: function (e, t, n) { + 'use strict'; + var r = n('./helpers/pageLifecycleEvents'); + e.exports = function (e, t) { + r.registerDomReadyTrigger(t); + }; + } + }, + 'core/src/lib/conditions/valueComparison.js': { + name: 'value-comparison', + displayName: 'Value Comparison', + script: function (e) { + 'use strict'; + var t = function (e) { + return 'number' == typeof e && isFinite(e); + }, n = function (e) { + return 'string' == typeof e || e instanceof String; + }, r = function (e, t) { + return t && n(e) ? e.toLowerCase() : e; + }, i = function (e) { + return t(e) ? String(e) : e; + }, a = function (e) { + return n(e) ? Number(e) : e; + }, o = function (e) { + return function (t, r, a) { + return t = i(t), r = i(r), n(t) && n(r) && e(t, r, a); + }; + }, s = function (e) { + return function (n, r) { + return n = a(n), r = a(r), t(n) && t(r) && e(n, r); + }; + }, c = function (e) { + return function (t, n, i) { + return e(r(t, i), r(n, i)); + }; + }, u = { + equals: c(function (e, t) { + return e == t; + }), + doesNotEqual: function () { + return !u.equals.apply(null, arguments); + }, + contains: o(c(function (e, t) { + return -1 !== e.indexOf(t); + })), + doesNotContain: function () { + return !u.contains.apply(null, arguments); + }, + startsWith: o(c(function (e, t) { + return 0 === e.indexOf(t); + })), + doesNotStartWith: function () { + return !u.startsWith.apply(null, arguments); + }, + endsWith: o(c(function (e, t) { + return e.substring(e.length - t.length, e.length) === t; + })), + doesNotEndWith: function () { + return !u.endsWith.apply(null, arguments); + }, + matchesRegex: o(function (e, t, n) { + return new RegExp(t, n ? 'i' : '').test(e); + }), + doesNotMatchRegex: function () { + return !u.matchesRegex.apply(null, arguments); + }, + lessThan: s(function (e, t) { + return e < t; + }), + lessThanOrEqual: s(function (e, t) { + return e <= t; + }), + greaterThan: s(function (e, t) { + return e > t; + }), + greaterThanOrEqual: s(function (e, t) { + return e >= t; + }), + isTrue: function (e) { + return !0 === e; + }, + isTruthy: function (e) { + return Boolean(e); + }, + isFalse: function (e) { + return !1 === e; + }, + isFalsy: function (e) { + return !e; + } + }; + e.exports = function (e) { + return u[e.comparison.operator](e.leftOperand, e.rightOperand, Boolean(e.comparison.caseInsensitive)); + }; + } + }, + 'core/src/lib/events/timeOnPage.js': { + name: 'time-on-page', + displayName: 'Time On Page', + script: function (e, t, n) { + 'use strict'; + var r = n('@adobe/reactor-document'), i = n('./helpers/once'), a = n('./helpers/visibilityApi')(), o = n('./helpers/timer'), s = a.hiddenProperty, c = a.visibilityChangeEventType, u = {}, l = function (e) { + var t = { timeOnPage: e / 1000 }; + u[e].forEach(function (e) { + e(t); + }); + }, d = i(function () { + var e = new o(); + return e.on('markerPassed', l), r.addEventListener(c, function () { + r[s] ? e.pause() : e.resume(); + }, !0), e.start(), e; + }); + e.exports = function (e, t) { + var n = d(), r = 1000 * e.timeOnPage; + n.addMarker(r), u[r] || (u[r] = []), u[r].push(t); + }; + } + }, + 'core/src/lib/events/dataElementChange.js': { + name: 'data-element-change', + displayName: 'Data Element Change', + script: function (e, t, n, r) { + 'use strict'; + var i = {}, a = {}; + setInterval(function () { + Object.keys(i).forEach(function (e) { + var t = JSON.stringify(r.getDataElementValue(e)); + if (t !== a[e]) { + var n = { dataElementName: e }; + i[e].forEach(function (e) { + e(n); + }), a[e] = t; + } + }); + }, 1000), e.exports = function (e, t) { + var n = e.name, o = i[n]; + o || (o = i[n] = [], a[n] = JSON.stringify(r.getDataElementValue(n))), o.push(t); + }; + } + }, + 'core/src/lib/conditions/cookie.js': { + name: 'cookie', + displayName: 'Cookie', + script: function (e, t, n) { + 'use strict'; + var r = n('@adobe/reactor-cookie'), i = n('../helpers/textMatch'); + e.exports = function (e) { + var t = e.valueIsRegex ? new RegExp(e.value, 'i') : e.value; + return i(r.get(e.name), t); + }; + } + }, + 'core/src/lib/events/change.js': { + name: 'change', + displayName: 'Change', + script: function (e, t, n) { + 'use strict'; + var r = n('./helpers/createBubbly')(), i = n('../helpers/textMatch'); + document.addEventListener('change', r.evaluateEvent, !0), e.exports = function (e, t) { + var n; + void 0 !== e.value && (n = e.valueIsRegex ? new RegExp(e.value, 'i') : e.value), r.addListener(e, function (e) { + if (void 0 !== n && !i(e.target.value, n)) + return !1; + t(e); + }); + }; + } + }, + 'core/src/lib/conditions/maxFrequency.js': { + name: 'max-frequency', + displayName: 'Max Frequency', + script: function (e, t, n) { + 'use strict'; + var r = n('../helpers/visitorTracking'), i = n('../helpers/getNamespacedStorage')('localStorage', 'maxFrequency'), a = { + second: 1000, + minute: 60000, + hour: 3600000, + day: 86400000, + week: 604800000, + month: 2678400000 + }; + e.exports = function (e, t) { + var n = t.$rule.id + '.' + e.unit; + switch (e.unit) { + case 'pageView': + var o = r.getLifetimePageViewCount(); + if (o - Number(i.getItem(n) || 0) >= e.count) + return i.setItem(n, o), !0; + break; + case 'session': + var s = r.getSessionCount(); + if (s - Number(i.getItem(n) || 0) >= e.count) + return i.setItem(n, s), !0; + break; + case 'visitor': + if (!i.getItem(n)) + return i.setItem(n, 'true'), !0; + break; + case 'second': + case 'minute': + case 'hour': + case 'day': + case 'week': + case 'month': + var c = new Date().getTime(); + if (Number(i.getItem(n) || 0) <= c - e.count * a[e.unit]) + return i.setItem(n, c), !0; + } + return !1; + }; + } + }, + 'core/src/lib/conditions/variable.js': { + name: 'variable', + displayName: 'Variable', + script: function (e, t, n) { + 'use strict'; + var r = n('../helpers/getObjectProperty'), i = n('../helpers/textMatch'); + e.exports = function (e) { + var t = e.valueIsRegex ? new RegExp(e.value, 'i') : e.value; + return i(r(window, e.name), t); + }; + } + }, + 'core/src/lib/helpers/getObjectProperty.js': { + script: function (e) { + 'use strict'; + e.exports = function (e, t) { + for (var n = t.split('.'), r = e, i = 0, a = n.length; i < a; i++) { + if (null == r) + return; + r = r[n[i]]; + } + return r; + }; + } + }, + 'core/src/lib/events/helpers/pageLifecycleEvents.js': { + script: function (e, t, n) { + 'use strict'; + var r = n('@adobe/reactor-window'), i = n('@adobe/reactor-document'), a = -1 !== r.navigator.appVersion.indexOf('MSIE 10'), o = 'WINDOW_LOADED', s = 'DOM_READY', c = 'PAGE_BOTTOM', u = [ + c, + s, + o + ], l = function (e, t) { + return { + element: e, + target: e, + nativeEvent: t + }; + }, d = {}; + u.forEach(function (e) { + d[e] = []; + }); + var f = function (e, t) { + u.slice(0, m(e) + 1).forEach(function (e) { + g(t, e); + }); + }, p = function () { + return 'complete' === i.readyState ? o : 'interactive' === i.readyState ? a ? null : s : void 0; + }, m = function (e) { + return u.indexOf(e); + }, g = function (e, t) { + d[t].forEach(function (t) { + h(e, t); + }), d[t] = []; + }, h = function (e, t) { + var n = t.trigger, r = t.syntheticEventFn; + n(r ? r(e) : null); + }; + r._satellite = r._satellite || {}, r._satellite.pageBottom = f.bind(null, c), i.addEventListener('DOMContentLoaded', f.bind(null, s), !0), r.addEventListener('load', f.bind(null, o), !0), r.setTimeout(function () { + var e = p(); + e && f(e); + }, 0), e.exports = { + registerLibraryLoadedTrigger: function (e) { + e(); + }, + registerPageBottomTrigger: function (e) { + d[c].push({ trigger: e }); + }, + registerDomReadyTrigger: function (e) { + d[s].push({ + trigger: e, + syntheticEventFn: l.bind(null, i) + }); + }, + registerWindowLoadedTrigger: function (e) { + d[o].push({ + trigger: e, + syntheticEventFn: l.bind(null, r) + }); + } + }; + } + }, + 'core/src/lib/actions/helpers/decorateCode.js': { + script: function (e, t, n, r) { + 'use strict'; + var i = 0, a = function (e) { + return e.settings.isExternal; + }, o = function (e, t) { + return ''; + }, s = function (e, t) { + var n = '__runScript' + ++i; + return _satellite[n] = function (t) { + t.call(e.event.element, e.event, e.event.target), delete _satellite[n]; + }, ''; + }, c = { + javascript: function (e, t) { + return e.settings.global ? o(e, t) : s(e, t); + }, + html: function (e, t) { + return a(e) ? r.replaceTokens(t, e.event) : t; + } + }; + e.exports = function (e, t) { + return c[e.settings.language](e, t); + }; + } + }, + 'core/src/lib/actions/helpers/loadCodeSequentially.js': { + script: function (e, t, n) { + 'use strict'; + var r = n('@adobe/reactor-promise'), i = n('./getSourceByUrl'), a = r.resolve(); + e.exports = function (e) { + var t = new r(function (t) { + var n = i(e); + r.all([ + n, + a + ]).then(function (e) { + var n = e[0]; + t(n); + }); + }); + return a = t, t; + }; + } + }, + 'core/node_modules/postscribe/dist/postscribe.js': { + script: function (e, t) { + var n, r; + n = this, r = function () { + return function (e) { + function t(r) { + if (n[r]) + return n[r].exports; + var i = n[r] = { + exports: {}, + id: r, + loaded: !1 + }; + return e[r].call(i.exports, i, i.exports, t), i.loaded = !0, i.exports; + } + var n = {}; + return t.m = e, t.c = n, t.p = '', t(0); + }([ + function (e, t, n) { + 'use strict'; + function r(e) { + return e && e.__esModule ? e : { default: e }; + } + var i = r(n(1)); + e.exports = i.default; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + if (e && e.__esModule) + return e; + var t = {}; + if (null != e) + for (var n in e) + Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]); + return t.default = e, t; + } + function i(e) { + return e && e.__esModule ? e : { default: e }; + } + function a() { + } + function o() { + var e = m.shift(); + if (e) { + var t = d.last(e); + t.afterDequeue(), e.stream = s.apply(void 0, e), t.afterStreamStart(); + } + } + function s(e, t, n) { + function r(e) { + e = n.beforeWrite(e), g.write(e), n.afterWrite(e); + } + (g = new l.default(e, n)).id = p++, g.name = n.name || g.id, c.streams[g.name] = g; + var i = e.ownerDocument, s = { + close: i.close, + open: i.open, + write: i.write, + writeln: i.writeln + }; + u(i, { + close: a, + open: a, + write: function () { + for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) + t[n] = arguments[n]; + return r(t.join('')); + }, + writeln: function () { + for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) + t[n] = arguments[n]; + return r(t.join('') + '\n'); + } + }); + var d = g.win.onerror || a; + return g.win.onerror = function (e, t, r) { + n.error({ msg: e + ' - ' + t + ': ' + r }), d.apply(g.win, [ + e, + t, + r + ]); + }, g.write(t, function () { + u(i, s), g.win.onerror = d, n.done(), g = null, o(); + }), g; + } + function c(e, t, n) { + if (d.isFunction(n)) + n = { done: n }; + else if ('clear' === n) + return m = [], g = null, void (p = 0); + n = d.defaults(n, f); + var r = [ + e = /^#/.test(e) ? window.document.getElementById(e.substr(1)) : e.jquery ? e[0] : e, + t, + n + ]; + return e.postscribe = { + cancel: function () { + r.stream ? r.stream.abort() : r[1] = a; + } + }, n.beforeEnqueue(r), m.push(r), g || o(), e.postscribe; + } + t.__esModule = !0; + var u = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }; + t.default = c; + var l = i(n(2)), d = r(n(4)), f = { + afterAsync: a, + afterDequeue: a, + afterStreamStart: a, + afterWrite: a, + autoFix: !0, + beforeEnqueue: a, + beforeWriteToken: function (e) { + return e; + }, + beforeWrite: function (e) { + return e; + }, + done: a, + error: function (e) { + throw new Error(e.msg); + }, + releaseAsync: !1 + }, p = 0, m = [], g = null; + u(c, { + streams: {}, + queue: m, + WriteStream: l.default + }); + }, + function (e, t, n) { + 'use strict'; + function r(e) { + if (e && e.__esModule) + return e; + var t = {}; + if (null != e) + for (var n in e) + Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]); + return t.default = e, t; + } + function i(e) { + return e && e.__esModule ? e : { default: e }; + } + function a(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + function o(e, t) { + var n = f + t, r = e.getAttribute(n); + return l.existy(r) ? String(r) : r; + } + function s(e, t) { + var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, r = f + t; + l.existy(n) && '' !== n ? e.setAttribute(r, n) : e.removeAttribute(r); + } + t.__esModule = !0; + var c = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }, u = i(n(3)), l = r(n(4)), d = !1, f = 'data-ps-', p = 'ps-style', m = 'ps-script', g = function () { + function e(t) { + var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + a(this, e), this.root = t, this.options = n, this.doc = t.ownerDocument, this.win = this.doc.defaultView || this.doc.parentWindow, this.parser = new u.default('', { autoFix: n.autoFix }), this.actuals = [t], this.proxyHistory = '', this.proxyRoot = this.doc.createElement(t.nodeName), this.scriptStack = [], this.writeQueue = [], s(this.proxyRoot, 'proxyof', 0); + } + return e.prototype.write = function () { + var e; + for ((e = this.writeQueue).push.apply(e, arguments); !this.deferredRemote && this.writeQueue.length;) { + var t = this.writeQueue.shift(); + l.isFunction(t) ? this._callFunction(t) : this._writeImpl(t); + } + }, e.prototype._callFunction = function (e) { + var t = { + type: 'function', + value: e.name || e.toString() + }; + this._onScriptStart(t), e.call(this.win, this.doc), this._onScriptDone(t); + }, e.prototype._writeImpl = function (e) { + this.parser.append(e); + for (var t = void 0, n = void 0, r = void 0, i = []; (t = this.parser.readToken()) && !(n = l.isScript(t)) && !(r = l.isStyle(t));) + (t = this.options.beforeWriteToken(t)) && i.push(t); + i.length > 0 && this._writeStaticTokens(i), n && this._handleScriptToken(t), r && this._handleStyleToken(t); + }, e.prototype._writeStaticTokens = function (e) { + var t = this._buildChunk(e); + return t.actual ? (t.html = this.proxyHistory + t.actual, this.proxyHistory += t.proxy, this.proxyRoot.innerHTML = t.html, d && (t.proxyInnerHTML = this.proxyRoot.innerHTML), this._walkChunk(), d && (t.actualInnerHTML = this.root.innerHTML), t) : null; + }, e.prototype._buildChunk = function (e) { + for (var t = this.actuals.length, n = [], r = [], i = [], a = e.length, o = 0; o < a; o++) { + var s = e[o], c = s.toString(); + if (n.push(c), s.attrs) { + if (!/^noscript$/i.test(s.tagName)) { + var u = t++; + r.push(c.replace(/(\/?>)/, ' ' + f + 'id=' + u + ' $1')), s.attrs.id !== m && s.attrs.id !== p && i.push('atomicTag' === s.type ? '' : '<' + s.tagName + ' ' + f + 'proxyof=' + u + (s.unary ? ' />' : '>')); + } + } else + r.push(c), i.push('endTag' === s.type ? c : ''); + } + return { + tokens: e, + raw: n.join(''), + actual: r.join(''), + proxy: i.join('') + }; + }, e.prototype._walkChunk = function () { + for (var e = void 0, t = [this.proxyRoot]; l.existy(e = t.shift());) { + var n = 1 === e.nodeType; + if (!n || !o(e, 'proxyof')) { + n && (this.actuals[o(e, 'id')] = e, s(e, 'id')); + var r = e.parentNode && o(e.parentNode, 'proxyof'); + r && this.actuals[r].appendChild(e); + } + t.unshift.apply(t, l.toArray(e.childNodes)); + } + }, e.prototype._handleScriptToken = function (e) { + var t = this, n = this.parser.clear(); + n && this.writeQueue.unshift(n), e.src = e.attrs.src || e.attrs.SRC, (e = this.options.beforeWriteToken(e)) && (e.src && this.scriptStack.length ? this.deferredRemote = e : this._onScriptStart(e), this._writeScriptToken(e, function () { + t._onScriptDone(e); + })); + }, e.prototype._handleStyleToken = function (e) { + var t = this.parser.clear(); + t && this.writeQueue.unshift(t), e.type = e.attrs.type || e.attrs.TYPE || 'text/css', (e = this.options.beforeWriteToken(e)) && this._writeStyleToken(e), t && this.write(); + }, e.prototype._writeStyleToken = function (e) { + var t = this._buildStyle(e); + this._insertCursor(t, p), e.content && (t.styleSheet && !t.sheet ? t.styleSheet.cssText = e.content : t.appendChild(this.doc.createTextNode(e.content))); + }, e.prototype._buildStyle = function (e) { + var t = this.doc.createElement(e.tagName); + return t.setAttribute('type', e.type), l.eachKey(e.attrs, function (e, n) { + t.setAttribute(e, n); + }), t; + }, e.prototype._insertCursor = function (e, t) { + this._writeImpl(''); + var n = this.doc.getElementById(t); + n && n.parentNode.replaceChild(e, n); + }, e.prototype._onScriptStart = function (e) { + e.outerWrites = this.writeQueue, this.writeQueue = [], this.scriptStack.unshift(e); + }, e.prototype._onScriptDone = function (e) { + e === this.scriptStack[0] ? (this.scriptStack.shift(), this.write.apply(this, e.outerWrites), !this.scriptStack.length && this.deferredRemote && (this._onScriptStart(this.deferredRemote), this.deferredRemote = null)) : this.options.error({ msg: 'Bad script nesting or script finished twice' }); + }, e.prototype._writeScriptToken = function (e, t) { + var n = this._buildScript(e), r = this._shouldRelease(n), i = this.options.afterAsync; + e.src && (n.src = e.src, this._scriptLoadHandler(n, r ? i : function () { + t(), i(); + })); + try { + this._insertCursor(n, m), n.src && !r || t(); + } catch (e) { + this.options.error(e), t(); + } + }, e.prototype._buildScript = function (e) { + var t = this.doc.createElement(e.tagName); + return l.eachKey(e.attrs, function (e, n) { + t.setAttribute(e, n); + }), e.content && (t.text = e.content), t; + }, e.prototype._scriptLoadHandler = function (e, t) { + function n() { + e = e.onload = e.onreadystatechange = e.onerror = null; + } + function r() { + n(), null != t && t(), t = null; + } + function i(e) { + n(), o(e), null != t && t(), t = null; + } + function a(e, t) { + var n = e['on' + t]; + null != n && (e['_on' + t] = n); + } + var o = this.options.error; + a(e, 'load'), a(e, 'error'), c(e, { + onload: function () { + if (e._onload) + try { + e._onload.apply(this, Array.prototype.slice.call(arguments, 0)); + } catch (t) { + i({ msg: 'onload handler failed ' + t + ' @ ' + e.src }); + } + r(); + }, + onerror: function () { + if (e._onerror) + try { + e._onerror.apply(this, Array.prototype.slice.call(arguments, 0)); + } catch (t) { + return void i({ msg: 'onerror handler failed ' + t + ' @ ' + e.src }); + } + i({ msg: 'remote script failed ' + e.src }); + }, + onreadystatechange: function () { + /^(loaded|complete)$/.test(e.readyState) && r(); + } + }); + }, e.prototype._shouldRelease = function (e) { + return !/^script$/i.test(e.nodeName) || !!(this.options.releaseAsync && e.src && e.hasAttribute('async')); + }, e; + }(); + t.default = g; + }, + function (e) { + var t; + t = function () { + return function (e) { + function t(r) { + if (n[r]) + return n[r].exports; + var i = n[r] = { + exports: {}, + id: r, + loaded: !1 + }; + return e[r].call(i.exports, i, i.exports, t), i.loaded = !0, i.exports; + } + var n = {}; + return t.m = e, t.c = n, t.p = '', t(0); + }([ + function (e, t, n) { + 'use strict'; + function r(e) { + return e && e.__esModule ? e : { default: e }; + } + var i = r(n(1)); + e.exports = i.default; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + return e && e.__esModule ? e : { default: e }; + } + function i(e) { + if (e && e.__esModule) + return e; + var t = {}; + if (null != e) + for (var n in e) + Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]); + return t.default = e, t; + } + function a(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + t.__esModule = !0; + var o = i(n(2)), s = i(n(3)), c = r(n(6)), u = n(5), l = { + comment: /^'); + if (t >= 0) + return new u.CommentToken(e.substr(4, t - 1), t + 3); + } + function i(e) { + var t = e.indexOf('<'); + return new u.CharsToken(t >= 0 ? t : e.length); + } + function a(e) { + var t, n, r; + if (-1 !== e.indexOf('>')) { + var i = e.match(l.startTag); + if (i) { + var a = (t = {}, n = {}, r = i[2], i[2].replace(l.attr, function (e, i) { + arguments[2] || arguments[3] || arguments[4] || arguments[5] ? arguments[5] ? (t[arguments[5]] = '', n[arguments[5]] = !0) : t[i] = arguments[2] || arguments[3] || arguments[4] || l.fillAttr.test(i) && i || '' : t[i] = '', r = r.replace(e, ''); + }), { v: new u.StartTagToken(i[1], i[0].length, t, n, !!i[3], r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '')) }); + if ('object' === (void 0 === a ? 'undefined' : c(a))) + return a.v; + } + } + } + function o(e) { + var t = a(e); + if (t) { + var n = e.slice(t.length); + if (n.match(new RegExp('', 'i'))) { + var r = n.match(new RegExp('([\\s\\S]*?)', 'i')); + if (r) + return new u.AtomicTagToken(t.tagName, r[0].length + t.length, t.attrs, t.booleanAttrs, r[1]); + } + } + } + function s(e) { + var t = e.match(l.endTag); + if (t) + return new u.EndTagToken(t[1], t[0].length); + } + t.__esModule = !0; + var c = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + }; + t.comment = r, t.chars = i, t.startTag = a, t.atomicTag = o, t.endTag = s; + var u = n(4), l = { + startTag: /^<([\-A-Za-z0-9_]+)((?:\s+[\w\-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, + endTag: /^<\/([\-A-Za-z0-9_]+)[^>]*>/, + attr: /(?:([\-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([\-A-Za-z0-9_]+)(\s|$)+)/g, + fillAttr: /^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i + }; + }, + function (e, t, n) { + 'use strict'; + function r(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + t.__esModule = !0, t.EndTagToken = t.AtomicTagToken = t.StartTagToken = t.TagToken = t.CharsToken = t.CommentToken = t.Token = void 0; + var i = n(5), a = (t.Token = function e(t, n) { + r(this, e), this.type = t, this.length = n, this.text = ''; + }, t.CommentToken = function () { + function e(t, n) { + r(this, e), this.type = 'comment', this.length = n || (t ? t.length : 0), this.text = '', this.content = t; + } + return e.prototype.toString = function () { + return '\n\n\n\n\n\n', + language: 'html' + } + }] + }, + { + id: 'RL5680a5ab6cc84d41877c8deebeecc8ce', + name: 'adTag:tradedesk', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('tradedesk:pageListMapping'), t = window.location.pathname; + return 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'), _satellite.setVar('tradedeskURL', _fdx.pageFlag(e, t)), !1 !== _satellite.getVar('tradedeskURL'); + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '', + language: 'html' + } + }] + }, + { + id: 'RL3032275111b44566ad9856681e27aef3', + name: 'MAGIC POC', + events: [{ + modulePath: 'core/src/lib/events/customEvent.js', + settings: { + type: 'event-view-start', + elementSelector: 'body', + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC8c69d18aedde45889a6e05ae4bdda4cf-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLc827bfbd658e403e9a4a0adea5a457ee', + name: 'sp:directHits', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { + paths: [{ + value: 'search=true', + valueIsRegex: !0 + }] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + var n = new URLSearchParams().get('spterm'); + void 0 !== n && '' != n && null !== n ? (n = n.replace(/\;.*/, ''), t.prop1 = t.eVar1 = n, t.linkTrackEvents = t.events = t.apl(t.events, 'event118', ',', 2)) : t.linkTrackEvents = t.events = t.apl(t.events, 'event119', ',', 2); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RLb8d70f6cba5243e8b553a2df73e1bffd', + name: 'gTag:TargetVideoExperience', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '.vjs-big-play-button', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/path.js', + settings: { + paths: [{ + value: '/en-us/ecommerce/(shipping-options.html|tools-and-services.html)', + valueIsRegex: !0 + }] + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:TargetVideoMapping'), t = this.parentElement.getAttribute('data-video-id'); + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + return _satellite.setVar('targetVideoGtagLabel', n), !1 !== n; + } + } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC920bc1a3aec8479790f21f7565fe8a98-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RL9d5db3a6be0f4e7bb633d37ef7b7f363', + name: 'AdobeTarget:beaconV2', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 1 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = FDX.DATALAYER.page.category, t = _satellite.getVar('targetenabledUrlList'), n = /.[a-z]{2}-[a-z]{2}(.*)/.exec(window.location.pathname); + return null !== n && (n = n[1]), 'false' == e.isApplication && 'sharednav' !== FDX.DATALAYER.page.category.pageType || 'true' == e.isApplication && null !== n && void 0 !== t && '' !== t && t.length > 0 && t.toString().toLowerCase().indexOf(n.toLowerCase()) > -1; + } + } + }], + actions: [ + { + modulePath: 'adobe-target-v2/lib/loadTarget.js', + settings: {} + }, + { + modulePath: 'adobe-target-v2/lib/addPageLoadParams.js', + settings: { + params: { + at_property: { + value: '%Target:at_property%', + checked: !1 + }, + loggedinStatus: { + value: '%login:status%', + checked: !1 + } + } + } + }, + { + modulePath: 'adobe-target-v2/lib/firePageLoad.js', + settings: { + bodyHiddenStyle: 'body {opacity: 0}', + bodyHidingEnabled: !0 + } + } + ] + }, + { + id: 'RLdb1e395c95674ff7aca26616219e0af7', + name: 'AdobeTarget:Category Affinity', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { + paths: [ + { + value: '/en-us/shipping', + valueIsRegex: !0 + }, + { + value: '/en-us/tracking', + valueIsRegex: !0 + }, + { + value: '/en-us/printing', + valueIsRegex: !0 + }, + { + value: '/en-us/customer-support', + valueIsRegex: !0 + }, + { + value: '/en-us/ecommerce', + valueIsRegex: !0 + }, + { + value: '/en-us/small-business', + valueIsRegex: !0 + } + ] + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'adobe.target.trackEvent({\n "mbox": "category-affinity",\n "params": {\n "user.categoryId": _satellite.getVar("content:pagePath")\n }\n});\n', + language: 'javascript' + } + }] + }, + { + id: 'RLacc2a850b7db4cea8ff8070599b18023', + name: 'video:50% Viewed', + events: [{ + modulePath: 'core/src/lib/events/mediaTimePlayed.js', + settings: { + unit: 'percent', + amount: 50, + elementSelector: '.brightcove-container video', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + if (void 0 !== this.parentElement) { + for (var n = this.parentElement.getAttribute('id'), r = this.parentElement.getAttribute('data-video-id'), i = document.getElementsByClassName('brightcove-container'), a = 0; a < i.length; a++) + if (n == i[a].getAttribute('data-playerid')) { + var o = document.getElementsByClassName('vjs-dock-title'); + t.eVar42 = o[a].innerText, t.eVar31 = r, t.linkTrackVars = t.apl(t.linkTrackVars, 'eVar42,eVar31', ',', 2); + } + t.linkTrackEvents = t.events = 'event205'; + } + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Video:50% Viewed', + linkType: 'o' + } + } + ] + }, + { + id: 'RL063d5aa0856a4efebb793190c41be714', + name: 'event:cube click', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'div .fxg-cube', + elementProperties: [{ + name: 'data-analytics', + value: 'hero.*', + valueIsRegex: !0 + }], + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function (e, t) { + var n = void 0 !== this.getAttribute('data-analytics') ? this.getAttribute('data-analytics') : '', r = (t = void 0 !== this.getAttribute('data-link-target') ? 'newPage' : 'samePage', { hero: 'event200' }); + if (!n || n.indexOf('TRACK') > -1) + return FDX.DATALAYER.page.link.data = '', FDX.DATALAYER.page.link.type = '', window.nltrk = 'y', !1; + if ('newPage' == t) + return FDX.DATALAYER.page.link.data = '', FDX.DATALAYER.page.link.type = '', fdx_setLinkView(n), !1; + if ('samePage' == t) { + var i = r[n.split('|')[0].toLowerCase()]; + return FDX.DATALAYER.page.link.data = '', FDX.DATALAYER.page.link.type = '', fdx_logLinkView(n, i), !1; + } + } + } + }], + actions: [] + }, + { + id: 'RLe1e9c25dd91943bfbbbbb93e38662cb4', + name: 'target:login status trigger', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return void 0 !== adobe.target; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'if (typeof (adobe.target) != "undefined"){\n$("body").on("loggedIn", function (e) {\n adobe.target.getOffers({\n request: {\n execute: {\n pageLoad: {\n parameters: {\n loggedIn: true\n }\n }\n }\n }\n }).then(function (response) {\n return adobe.target.applyOffers({\n response: response\n });\n }).then(function () {\n return ;\n }).catch(function (error) {\n return ;\n });\n});\n$("body").on("loggedOut", function () {\n adobe.target.getOffers({\n request: {\n execute: {\n pageLoad: {\n parameters: {\n loggedIn: false\n }\n }\n }\n }\n }).then(function (response) {\n return adobe.target.applyOffers({\n response: response\n });\n }).then(function () {\n return ;\n }).catch(function (error) {\n return ;\n });\n});\n}', + language: 'javascript' + } + }] + }, + { + id: 'RLc1dcbc6f45714cf68d2715ce1e701f36', + name: 'video:100% Viewed', + events: [{ + modulePath: 'core/src/lib/events/mediaTimePlayed.js', + settings: { + unit: 'percent', + amount: 100, + elementSelector: '.brightcove-container video', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + if (void 0 !== this.parentElement) { + for (var n = this.parentElement.getAttribute('id'), r = this.parentElement.getAttribute('data-video-id'), i = document.getElementsByClassName('brightcove-container'), a = 0; a < i.length; a++) + if (n == i[a].getAttribute('data-playerid')) { + var o = document.getElementsByClassName('vjs-dock-title'); + t.eVar42 = o[a].innerText, t.eVar31 = r, t.linkTrackVars = t.apl(t.linkTrackVars, 'eVar42,eVar31', ',', 2); + } + t.linkTrackEvents = t.events = 'event207'; + } + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Video:Complete', + linkType: 'o' + } + } + ] + }, + { + id: 'RLc858f1d6150f4bf4af035a411cc23223', + name: 'event:phone click', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a', + elementProperties: [{ + name: 'href', + value: 'tel:', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return _satellite.setVar('tele', this.text), !0; + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackEvents = t.events = t.apl(t.events, 'event1', ',', 2); + } + }, + trackerProperties: { + eVars: [{ + name: 'eVar147', + type: 'value', + value: '%tele%' + }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Phone Number', + linkType: 'o' + } + } + ] + }, + { + id: 'RLb5d023e024b64d93b47b6d8f214bb916', + name: 'gTag:ctaOrangeDC', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + anchorDelay: 600, + elementSelector: 'a.fxg-button.fxg-button--orange', + elementProperties: [{ + name: 'data-analytics', + value: '(link \\| SIGN UP NOW)|(link\\|Sign up for free)|(hero\\|See Current Offers)|(hero\\|Find a Walgreens Near You)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 40 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:ctaOrangeDCPageListMapping'), t = window.location.pathname; + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + if ('object' == typeof n) { + var r = document.getElementsByClassName(this.className), i = this; + return _satellite.setVar('dcOrangeLabel', _fdx.getGtagLabel(n, r, i)), !0; + } + return _satellite.setVar('dcOrangeLabel', n), !1 !== n; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC2fb1829526934171a652608724703745-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLb9692b2f1eb14382bb82267f9550f72e', + name: 'adTag:verizon', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('verizon:pageList'), t = window.location.pathname; + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'), _satellite.setVar('verizonURL', _fdx.pageFlag(e, t)); + var n = !1 !== _satellite.getVar('verizonURL'), r = '' !== _satellite.getVar('verizon:timeFrame') && !1 !== _satellite.getVar('verizon:timeFrame'); + return n && r; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '', + language: 'html' + } + }] + }, + { + id: 'RL431a9ea9760f4f42b6f9632f31b18f5f', + name: 'fbTag:Global', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { + paths: [ + { + value: '\\/en-us\\/shipping\\/((freight-services)|(schedule-manage-pickups)|(store\\/ground)|(packing-supplies)|(packing-supplies\\/custom-branded-boxes)|(office-depot-officemax)|(hold-at-location)).html', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/shipping\\/returns(((\\/business)|(\\/technology))\\.html|\\.html)', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/shipping\\/onsite(((\\/walgreens-package-pickup)|(\\/dollar-general-pick-up-drop-off-package)|(\\/target-pick-up-drop-off-package))\\.html|\\.html)', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/printing\\/((small-medium-business-offers)|(consumer-offers)|(flash-sale-offers)|(passport-photo)|(national-bid-center)|(business-solutions\\/knowledge-center)|(design-services))\\.html', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/discount-programs\\/(em15692113|em15692213|em15692013|ag13398602)\\.html', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/delivery-manager((\\/how-to-prevent-stolen-missing-packages|\\/manage-your-deliveries).html|.html)', + valueIsRegex: !0 + }, + { value: '/en-us/home.html?location=home' }, + { + value: '\\/en-us\\/(possibilities|office\\/walmart|create-account|big-commerce|coupon-offers\\/ground|healthcare\\/vaccine-shipping|ecommerce\\/offer-store-pickup-at-checkout).html', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/(small-business|sustainability).html', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/holiday(\\/consumer-shipping-delivery-guide.html|.html)', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/small-business\\/(technology).html', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/sweepstakes((\\/come-in-and-cash-in|\\/holiday-drop-off).html|.html)', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/shipping\\/saturday-and-sunday-delivery.html', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/small-business\\/grant-contest.html', + valueIsRegex: !0 + } + ] + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n\n\n', + language: 'html' + } + }] + }, + { + id: 'RLbfa2f40d0f1f47cdbed784036cd9cfca', + name: 'HPTrackBtn:ValidData', + events: [{ + modulePath: 'core/src/lib/events/elementExists.js', + settings: { elementSelector: 'div .redesignSnapshotTVC' }, + ruleOrder: 50 + }], + conditions: [], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC78909d54823849febd5ad6cde94a7f60-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLf75b1a3cd39746d48665e4c29e2d5c34', + name: 'redirect:appSegIdTarget', + events: [{ + modulePath: 'core/src/lib/events/domReady.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + global: !0, + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RCd5794ebadea64668a54c82a944998eb2-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLf4295bff685d47e695e2665486112687', + name: 'gTag:ctaOrangeAW', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + anchorDelay: 600, + elementSelector: 'a.fxg-button.fxg-button--orange', + elementProperties: [{ + name: 'data-analytics', + value: '(hero\\|free download)|(link\\|Create a label)|(hero\\|ship now)|(hero\\|Chat with a sales specialist)|(hero\\|Apply Now)|(link\\|Start a free BigCommerce trial)|(hero\\|Get Started)|(link\\|Start Order)|(link\\|Sign up for free)|(link\\|Find a Dollar General)|(hero\\|See Current Offers)|(hero\\|Find a Walgreens Near You)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:ctaOrangeAWPageListMapping'), t = window.location.pathname; + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + if ('object' == typeof n) { + var r = document.getElementsByClassName(this.className), i = this; + return _satellite.setVar('awOrangeLabel', _fdx.getGtagLabel(n, r, i)), !0; + } + return _satellite.setVar('awOrangeLabel', n), !1 !== n; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RCbe5f3ca3805b4bb682d19ba22cbd9771-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLb7b3001c66e94e1286f0c8157ba06305', + name: 'video:Play', + events: [{ + modulePath: 'core/src/lib/events/mediaTimePlayed.js', + settings: { + unit: 'percent', + amount: 1, + elementSelector: '.brightcove-container video', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + if (void 0 !== this.parentElement) { + for (var n = this.parentElement.getAttribute('id'), r = this.parentElement.getAttribute('data-video-id'), i = document.getElementsByClassName('brightcove-container'), a = 0; a < i.length; a++) + if (n == i[a].getAttribute('data-playerid')) { + var o = document.getElementsByClassName('vjs-dock-title'); + t.eVar42 = o[a].innerText, t.eVar31 = r, t.linkTrackVars = t.apl(t.linkTrackVars, 'eVar42,eVar31', ',', 2); + } + t.linkTrackEvents = t.events = 'event203'; + } + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Video:Play', + linkType: 'o' + } + } + ] + }, + { + id: 'RL23afbde63b8b40dbbe71346932e70e78', + name: 'gTag:AdWordsEvent', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var e = _fdx.pcfUtil().match(/www(sbox.idev|base.idev|dev.idev|drt.idev|stress.dmz.idev|bit.idev|test|).fedex.com/gi), t = '' == _satellite.getVar('gTagDisableLocale'), n = window.location.pathname, r = _satellite.getVar('content:countryCode'), i = _satellite.getVar('gTag:AdWordsEventMapping'), a = _fdx.pageFlag(i, r, 'country'), o = _fdx.pageFlag(a, n); + return _satellite.setVar('awLabel', o), !(!1 === o || null === e || !t); + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n', + language: 'html' + } + }] + }, + { + id: 'RLcb3074c4f6cd466fb7acafbd53ebd3e6', + name: 'gTag:btnFB', + events: [ + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a.fxg-link.js-fxgc-init.fxg-link--md.fxg-link--rounded_button.fxg-link--align-left.sup.sub', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 60 + }, + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a.fxg-link.js-fxgc-init.fxg-link--blue.fxg-link--mobile-align-center.fxg-mobile--hide', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 60 + } + ], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:btnFBPageListMapping'), t = window.location.pathname; + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + if ('object' == typeof n) { + var r = document.getElementsByClassName(this.className), i = this; + return _satellite.setVar('fbEvent', _fdx.getGtagLabel(n, r, i)), !0; + } + return _satellite.setVar('fbEvent', n), !1 !== n; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC0d3f4179488b4834853fc641b01fb664-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLcc52c9029474460c80f7563c76fc82aa', + name: 'tradedesk:eventBtnClickTTD', + events: [ + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a.fxg-button.fxg-button--orange', + elementProperties: [{ + name: 'data-analytics', + value: '(link\\|Find a Dollar General)|(link\\|Sign up for free)|(hero\\|Find a Walgreens Near You)|(hero\\|See Current Offers)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }, + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a.fxg-link.js-fxgc-init.fxg-link--rounded_button.fxg-button--round', + elementProperties: [{ + name: 'data-analytics', + value: '(link\\|sign up now)|(link\\|Next time use FedEx Delivery Manager\\|SIGN UP FOR FREE)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + } + ], + conditions: [ + { + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { + paths: [ + { + value: '\\/en-us\\/shipping\\/onsite\\/(walgreens-package-pickup|dollar-general-pick-up-drop-off-package).html', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/printing\\/consumer-offers.html', + valueIsRegex: !0 + }, + { + value: '\\/en-us\\/delivery-manager.html', + valueIsRegex: !0 + } + ] + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('tradedesk:btnClickPageListMapping'), t = this.getAttribute('data-analytics').toLowerCase(); + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + return _satellite.setVar('tdPixel', n), !1 !== n; + } + } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC95fc8c7d808448b7af9314f1d7b35f02-source.min.js', + language: 'html', + isExternal: !0 + } + }] + }, + { + id: 'RL91013c284d26417dbd7b4353b8ca0ca3', + name: 'adTag:dotTag ', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('dotTag:enabledPageList'), t = window.location.pathname; + return 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'), !1 !== _fdx.pageFlag(e, t); + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'var dotTagPixelId = _satellite.getVar("dotTagPixelId");\n(function(w,d,t,r,u){w[u]=w[u]||[];w[u].push({\'projectId\':\'10000\',\'properties\':{\'pixelId\':dotTagPixelId}});var s=d.createElement(t);s.src=r;s.async=true;s.onload=s.onreadystatechange=function(){var y,rs=this.readyState,c=w[u];if(rs&&rs!="complete"&&rs!="loaded"){return}try{y=YAHOO.ywa.I13N.fireBeacon;w[u]=[];w[u].push=function(p){y([p])};y(c)}catch(e){}};var scr=d.getElementsByTagName(t)[0],par=scr.parentNode;par.insertBefore(s,scr)})(window,document,"script","https://s.yimg.com/wi/ytc.js","dotq");\n\n\n\n', + language: 'javascript' + } + }] + }, + { + id: 'RL3951d0d56a03434d8fdd276a9f33e600', + name: 'Spike: Qualtrics - Tracking', + events: [{ + modulePath: 'core/src/lib/events/timeOnPage.js', + settings: { timeOnPage: 5 }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/valueComparison.js', + settings: { + comparison: { operator: 'equals' }, + leftOperand: '%content:locale%', + rightOperand: 'en_us' + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var e = [ + '/fedextrack/', + '/fedextracking/' + ], t = window.location.pathname; + return _fdx.pageFlag(e, t); + } + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = document.querySelectorAll('[data-test-id="delivery-date-header"]')[0]; + if (null != e) + return statusDivString = e.innerText, statusDivString.indexOf('Delivered') >= 0 && (e.setAttribute('id', 'status_delivered'), !0); + } + } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RCa084377100744691a32a1f26efc1b3df-source.min.js', + language: 'html', + isExternal: !0 + } + }] + }, + { + id: 'RL252373723837406391ec6b9a05246f55', + name: 'gTag:VideoEventClick', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '.vjs-big-play-button', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/path.js', + settings: { + paths: [{ + value: '/(ko-kr|zh-tw|en-sg)/about/possibilities.html', + valueIsRegex: !0 + }] + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:VideoPlayBtnIdList'), t = this.parentElement.getAttribute('data-video-id'); + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + return _satellite.setVar('videoGtagLabel', n), !1 !== n; + } + } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC0b336201e5ce4363be99623f215c17e5-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLbcc1a50cbbf042b59a2f83b63c4b698d', + name: 'user:Logged In', + events: [{ + modulePath: 'core/src/lib/events/dataElementChange.js', + settings: { name: 'login:status' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/cookie.js', + settings: { + name: 'fdx_login', + value: '.*', + valueIsRegex: !0 + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = t.linkTrackVars + ',events', t.linkTrackEvents = t.linkTrackEvents + ',event3,event4', '' !== _satellite.getVar('login:user-id') && _satellite.getVar('login:user-id') && (t.events = t.apl(t.events, 'event3', ',', 2), t.events = t.apl(t.events, 'event4', ',', 2)); + } + }, + trackerProperties: { + eVars: [ + { + name: 'eVar4', + type: 'value', + value: '%login:status%' + }, + { + name: 'eVar13', + type: 'value', + value: '%login:fdx_cbid%' + }, + { + name: 'eVar60', + type: 'value', + value: '%user:emailID%' + }, + { + name: 'eVar6', + type: 'value', + value: '%login:user-id%' + } + ], + props: [ + { + name: 'prop4', + type: 'alias', + value: 'eVar4' + }, + { + name: 'prop6', + type: 'alias', + value: 'eVar6' + }, + { + name: 'prop75', + type: 'value', + value: '%user:user-agent%' + }, + { + name: 'prop2', + type: 'value', + value: '%content:countryCode%' + }, + { + name: 'prop3', + type: 'value', + value: '%content:language%' + } + ] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'hdr|Logged In', + linkType: 'o' + } + } + ] + }, + { + id: 'RL0af5ffa803c0439c9c7ec1444d626b0c', + name: 'search - S&P', + events: [{ + modulePath: 'core/src/lib/events/dataElementChange.js', + settings: { name: 'search:spData - JSObjectChange' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return window.location.href.indexOf('search.html?q=') > -1; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC16397bad83154e3a9ee5418e4208405e-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RL87ee5aceb1454e8da2ca0735964570bd', + name: 'gTag:btnAW', + events: [ + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a.fxg-link.js-fxgc-init.default.fxg-link--align-left.fxg-link--mobile-align-center', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }, + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a.fxg-link.js-fxgc-init.fxg-link--md.fxg-link--rounded_button.fxg-link--align-left.sup.sub', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }, + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a.fxg-link.js-fxgc-init.fxg-link--blue.fxg-link--mobile-align-center', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }, + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a.fxg-link.js-fxgc-init.fxg-link--rounded_button.fxg-link--align-center.fxg-link--mobile-align-center', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }, + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a.fxg-link.js-fxgc-init.fxg-link--rounded_button.fxg-button--round.fxg-link--align-center.fxg-link--mobile-align-center', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }, + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'button.fxg-button.fxg-button--submit.fxg-button--orange.js-cms-form-submit', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + } + ], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:btnAWPageListMapping'), t = window.location.pathname; + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + if ('object' == typeof n) { + var r = document.getElementsByClassName(this.className), i = this; + return _satellite.setVar('awLabel', _fdx.getGtagLabel(n, r, i)), !0; + } + return _satellite.setVar('awLabel', n), !1 !== n; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RCa43b2296d9b3436bb4e74b0306475990-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RL62dd0b6bdff14f7d94292cf324c5e22e', + name: 'gTagIndia:Adwords', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { + paths: [ + { + value: '\\/en-in\\/(tracking|home|coronavirus|shipping|billing).html', + valueIsRegex: !0 + }, + { + value: '\\/en-in\\/(customer-support|open-account|customs-tools|conditions-of-carriage).html', + valueIsRegex: !0 + }, + { + value: '\\/en-in\\/(about|campaign|open-account|shipping|trust-center|online)\\/(possibilities|delivering-what-matters|start-shipping|surcharges|getstarted|resources|rates|small-business|report-fraud|rating).html', + valueIsRegex: !0 + }, + { + value: '\\/en-in\\/about\\/possibilities\\/articles\\/flowers.html', + valueIsRegex: !0 + }, + { + value: '\\/en-in\\/about\\/possibilities\\/making-it-work.html', + valueIsRegex: !0 + }, + { + value: '\\/en-in\\/shipping\\/industry-solutions\\/(healthcare.html|(healthcare\\/temperature-control.html)|(healthcare\\/contact-us.html))', + valueIsRegex: !0 + } + ] + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'gtag(\'event\', \'page_view\', {\n \'send_to\': \'AW-673681829\',\n});', + language: 'javascript' + } + }] + }, + { + id: 'RL4e0120b8ae6c464699bd4b24a4043ee6', + name: 'user:user info', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [], + actions: [{ + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + 'Logged In' == _satellite.getVar('login:status') && (t.events = t.apl(t.events, 'event3', ',', 2)); + } + }, + trackerProperties: { + eVars: [ + { + name: 'eVar4', + type: 'value', + value: '%login:status%' + }, + { + name: 'eVar13', + type: 'value', + value: '%login:fdx_cbid%' + }, + { + name: 'eVar60', + type: 'value', + value: '%user:emailID%' + } + ], + props: [ + { + name: 'prop4', + type: 'alias', + value: 'eVar4' + }, + { + name: 'prop75', + type: 'value', + value: '%user:user-agent%' + } + ] + } + } + }] + }, + { + id: 'RL3efaaf1f2ac84216b624af7d57d7372f', + name: 'formsOnChange', + events: [{ + modulePath: 'core/src/lib/events/change.js', + settings: { + elementSelector: '.js-form-category', + elementProperties: [{ + name: 'data-index', + value: '1' + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = window.location.pathname, t = this.children; + for (var n in t) + if (t[n].selected) + if (e.indexOf('contact') > -1) { + var r = 'Contact form:' + t[n].value; + _satellite.setVar('form:linkName', r); + } else + r = 'CS Agent Form:' + t[n].value, _satellite.setVar('form:linkName', r); + return '/en-gb/customer-support/contact.html' == e || '/en-gb/customer-support.html' == e; + } + } + }], + actions: [{ + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: '%form:linkName%', + linkType: 'o' + } + }] + }, + { + id: 'RLb70a853b0b7d44419e6f7f587c022bd2', + name: 'event:social share', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'img', + elementProperties: [{ + name: 'data-analytics', + value: 'social', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = this.getAttribute('data-analytics'); + return !(e.indexOf('Newsletter') >= 0 && (fdx_setLinkView(e), 1)); + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = t.apl(t.linkTrackVars, 'prop18,prop19,prop20,eVar65', ',', 2), t.events = t.apl(t.events, 'event56', ',', 2), 'None' !== t.linkTrackEvents ? t.linkTrackEvents = t.linkTrackEvents + ',event56' : t.linkTrackEvents = 'event56', window.nltrk = 'y'; + var n = this.getAttribute('data-analytics'); + 'undefined' !== n && null !== n && (t.eVar65 = n.substring(n.lastIndexOf('|') + 1), t.prop18 = t.pageName, t.prop19 = n, t.prop20 = t.pageName + ' | ' + n); + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkType: 'o' + } + } + ] + }, + { + id: 'RLe80dec80bb1b4566bd48178c86b62a38', + name: 'gTag:btnOrangeDC', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'button.fxg-button', + elementProperties: [{ + name: 'id', + value: '(signUpContinueButton)|(submitPinButton)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { + paths: [{ + value: '\\/fdmenrollment\\/\\?signup\\=true', + valueIsRegex: !0 + }] + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:btnOrangeDCPageListMapping'), t = this.id; + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + return _satellite.setVar('dcOrangeBtnLabel', n), !1 !== n; + } + } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC45e1988f8baf49d4a7f179a802e04a12-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RL03b3e38ca4d8477ea5c41ce39ea1202e', + name: 'gTag:btnDC', + events: [ + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'button.fxg-button.fxg-button--submit.fxg-button--orange.js-cms-form-submit', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 40 + }, + { + modulePath: 'core/src/lib/events/click.js', + settings: { + anchorDelay: 600, + elementSelector: 'a.fxg-link.js-fxgc-init.fxg-link--sm.fxg-link--rounded_button.fxg-link--align-center', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 40 + } + ], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:btnDCPageListMapping'), t = window.location.pathname; + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + if ('object' == typeof n) { + var r = document.getElementsByClassName(this.className), i = this; + return _satellite.setVar('dcLabel', _fdx.getGtagLabel(n, r, i)), !0; + } + return _satellite.setVar('dcLabel', n), !1 !== n; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RCabdb061897514f5f984e338c50342beb-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RL0601596e41d147989e65da56fdb20c36', + name: 'oneTag:Flashtalking Tag', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('FlashTalking:pageListMapping'), t = window.location.href; + t = /.com(.*)/.exec(t)[1]; + var n = 10000000000000 * (Math.random() + ''); + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var r = _fdx.pageFlag(e, t); + return 0 != r && (_satellite.setVar('flashtalkingURL', r + n), !0); + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '', + language: 'html' + } + }] + }, + { + id: 'RL442385b950964798b157ebdd3e34e23e', + name: 'gTag:ButtonEvent', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '#subscribebutton', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return void 0 !== _satellite.getVar('gTag:EnabledLocaleEpic') && null !== _satellite.getVar('gTag:EnabledLocaleEpic') && '' !== _satellite.getVar('gTag:EnabledLocaleEpic'); + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC0ce1043e181047daa5ce609f41fa03e4-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLd0a63ac05e2c4acea3ca2d8126a9f565', + name: 'va:popin', + events: [{ + modulePath: 'core/src/lib/events/domReady.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('content:deviceType'); + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var t = _satellite.getVar('va:enabledCountryList'), n = _satellite.getVar('content:countryCode'), r = _satellite.getVar('va:mobEnabledUrl'), i = _fdx.pageFlag(t, n), a = _satellite.getVar('va:caasEnabledCountryList'), o = _satellite.getVar('va:caasMobEnabledUrl'), s = _satellite.getVar('content:locale'), c = _satellite.getVar('va:caasDisabledCountryList'); + a.indexOf(s) > -1 ? isCaasMobEnabled = !0 : isCaasMobEnabled = !1; + var u = window.location.pathname, l = '/' + _satellite.getVar('content:locale').replace('_', '-') + '/', d = _satellite.getVar('va:disabledPageList'), f = !_fdx.pageFlag(d, u), p = !_fdx.pageFlag(d, l), m = _fdx.pageFlag(r, u), g = _fdx.pageFlag(o, u), h = i && f, v = i && p && c, b = i && m, y = i && p && g && isCaasMobEnabled; + return void 0 === FDX.CAAS ? !('desktop' != e || !h) || !('mobile' != e || !b) : !('desktop' != e || !v) || !('mobile' != e || !y); + } + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return null == _satellite.cookie.get('wcmmode'); + } + } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RCe07e504fe3ee44a08cabb62a78097b21-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RL8a083af2206749299957b37d17f1b9a0', + name: 'gTag:btnOrangeAW', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'button.fxg-button', + elementProperties: [{ + name: 'id', + value: '(signUpContinueButton)|(submitPinButton)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { + paths: [ + { + value: '\\/fdmenrollment\\/\\?signup\\=true', + valueIsRegex: !0 + }, + { + value: '\\/shipping/industry-solutions/healthcare/contact-us', + valueIsRegex: !0 + }, + { + value: '\\/((en|fr)-ca)\\/small-business\\/ecommerce-solutions.html', + valueIsRegex: !0 + } + ] + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:btnOrangeAWPageListMapping'), t = this.id; + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + return _satellite.setVar('awOrangeBtnLabel', n), !1 !== n; + } + } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC3d949f223dcf44dd83ed1c3bbe498090-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RL84c4e13d916141b9a6b48f8ce6d94d03', + name: 'gTag:ctaOrangeFB', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a.fxg-button.fxg-button--orange', + elementProperties: [{ + name: 'data-analytics', + value: '(hero\\|Apply Now)|(hero\\|Get Started)|(link\\|Start Order)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 60 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:ctaOrangeFBPageListMapping'), t = window.location.pathname; + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + if ('object' == typeof n) { + var r = document.getElementsByClassName(this.className), i = this; + return _satellite.setVar('fbOrangeEvent', _fdx.getGtagLabel(n, r, i)), !0; + } + return _satellite.setVar('fbOrangeEvent', n), !1 !== n; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC18a16cd13b204e77993a0b991042c37c-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RL8448d0350b8c477faa0554907fbc4270', + name: 'gTag:ButtonEvent_Possibilities', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + anchorDelay: 100, + elementSelector: '#subscribebutton', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return void 0 !== _satellite.getVar('gTag:EnabledLocaleEpic') && null !== _satellite.getVar('gTag:EnabledLocaleEpic') && '' !== _satellite.getVar('gTag:EnabledLocaleEpic'); + } + } + }, + { + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { paths: [{ value: '/about/possibilities' }] } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC47577e15ef1042e583d2593d4583ee05-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLe58153f861d14c0f92f110b8283ab61f', + name: 'gTag:DFAEvent', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var e = _fdx.pcfUtil().match(/www(sbox.idev|base.idev|dev.idev|drt.idev|stress.dmz.idev|bit.idev|test|).fedex.com/gi), t = '' == _satellite.getVar('gTagDisableLocale'), n = window.location.pathname, r = _satellite.getVar('content:countryCode'), i = _satellite.getVar('gTag:DFAEventMapping'), a = _fdx.pageFlag(i, r, 'country'), o = _fdx.pageFlag(a, n); + return _satellite.setVar('dcLabel', o), !(null === e || !1 === o && !t); + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n', + language: 'html' + } + }] + }, + { + id: 'RLaacfa5daba714090bc6c192215aceab2', + name: 'gTag:TargetExperience', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + anchorDelay: 1200, + elementSelector: 'a.fxg-button.fxg-button--orange', + elementProperties: [{ + name: 'data-analytics', + value: '(TP\\|)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/path.js', + settings: { + paths: [ + { + value: '\\/en-us\\/shipping\\/(international.html|7-day-delivery.html|home-delivery.html)', + valueIsRegex: !0 + }, + { value: '/en-us/ecommerce/tools-and-services.html' } + ] + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:TargetEnabledMapping'), t = this.getAttribute('data-analytics'); + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + return _satellite.setVar('targetGtagLabel', n), !1 !== n; + } + } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC3b50acc509424526a92008865a3a8821-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLe7cb9b41a581433db53a9aea8abb2813', + name: 'video:25% Viewed', + events: [{ + modulePath: 'core/src/lib/events/mediaTimePlayed.js', + settings: { + unit: 'percent', + amount: 25, + elementSelector: '.brightcove-container video', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + if (void 0 !== this.parentElement) { + for (var n = this.parentElement.getAttribute('id'), r = this.parentElement.getAttribute('data-video-id'), i = document.getElementsByClassName('brightcove-container'), a = 0; a < i.length; a++) + if (n == i[a].getAttribute('data-playerid')) { + var o = document.getElementsByClassName('vjs-dock-title'); + t.eVar42 = o[a].innerText, t.eVar31 = r, t.linkTrackVars = t.apl(t.linkTrackVars, 'eVar42,eVar31', ',', 2); + } + t.linkTrackEvents = t.events = 'event204'; + } + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Video:25% View', + linkType: 'o' + } + } + ] + }, + { + id: 'RL46559f169cad499e8fa0c4b1fa8a52d0', + name: 'video:75% Viewed', + events: [{ + modulePath: 'core/src/lib/events/mediaTimePlayed.js', + settings: { + unit: 'percent', + amount: 75, + elementSelector: '.brightcove-container video', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + if (void 0 !== this.parentElement) { + for (var n = this.parentElement.getAttribute('id'), r = this.parentElement.getAttribute('data-video-id'), i = document.getElementsByClassName('brightcove-container'), a = 0; a < i.length; a++) + if (n == i[a].getAttribute('data-playerid')) { + var o = document.getElementsByClassName('vjs-dock-title'); + t.eVar42 = o[a].innerText, t.eVar31 = r, t.linkTrackVars = t.apl(t.linkTrackVars, 'eVar42,eVar31', ',', 2); + } + t.linkTrackEvents = t.events = 'event206'; + } + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Video:75% Viewed', + linkType: 'o' + } + } + ] + }, + { + id: 'RLb328ce8816ba48d9b6d84cab634f4ace', + name: 'searchResultTrack', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '.cq-snp-resultset-header', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'prop31,eVar43,prop51,eVar51,eVar53,prop29,prop18,prop19,prop20,events', t.linkTrackEvents = 'None', t.linkTrackEvents = t.events = 'event122'; + var n = this.firstElementChild.href, r = _satellite.getVar('search:term'); + n = r + '|' + n, t.eVar43 = 'L:IntSrch:' + r, t.eVar51 = t.prop51 = n, t.eVar53 = '+1', t.prop18 = t.pageName, t.prop19 = n, t.prop20 = t.pageName + ':' + n, t.prop31 = '' !== t.visitor.getAnalyticsVisitorID() ? '[CS]v1|' + t.visitor.getAnalyticsVisitorID() + '[CE]' : t.visitor.getMarketingCloudVisitorID(), nltrk = 'y'; + } + }, + trackerProperties: {} + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Search Result', + linkType: 'o' + } + } + ] + }, + { + id: 'RL9e1d508fe00f458785636168d6f75dfa', + name: 'event:vaPopin click', + events: [{ + modulePath: 'core/src/lib/events/dataElementChange.js', + settings: { name: 'event:vaClick' }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = void 0 !== FDX.DATALAYER.VA && FDX.DATALAYER.VA ? FDX.DATALAYER.VA : ''; + 'function' == typeof fdx_logChat && e && fdx_logChat(e, 'va_NINA'); + } + } + }, + { + modulePath: 'core/src/lib/conditions/valueComparison.js', + settings: { + comparison: { operator: 'lessThanOrEqual' }, + leftOperand: '%va:version number%', + rightOperand: 202110261530 + } + } + ], + actions: [] + }, + { + id: 'RL2fde5e408e5b4796b1166d741090253c', + name: 'event:hp link click', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'a', + elementProperties: [{ + name: 'data-analytics', + value: '.*', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = void 0 !== this.getAttribute('data-analytics') ? this.getAttribute('data-analytics') : ''; + s.linkName = e; + var t = void 0 !== this.getAttribute('target') && null !== this.getAttribute('target') && '' !== this.getAttribute('target') ? 'newPage' : 'samePage'; + if ('' != e && e.indexOf('mfxr') > -1 && (t = 'samePage'), 'samePage' == t && e.indexOf('/content/dam/fedex') > -1) + return t = '', !1; + var n = _satellite.getVar('click:blockFlag')(e, 'click:blockList'), r = { hero: 'event200' }; + if (!e || n) + return FDX.DATALAYER.page.link.data = '', FDX.DATALAYER.page.link.type = '', !1; + if ('newPage' == t) + return FDX.DATALAYER.page.link.data = '', FDX.DATALAYER.page.link.type = '', fdx_setLinkView(e), !1; + if ('samePage' == t) { + var i = r[e.split('|')[0].toLowerCase()]; + return FDX.DATALAYER.page.link.data = '', FDX.DATALAYER.page.link.type = '', this.href.indexOf('tel:') > -1 || fdx_logLinkView(e, i), !1; + } + } + } + }], + actions: [] + }, + { + id: 'RL081450c21d144c0c8046abf40593a0eb', + name: 'verizon:ctaOrangeButton', + events: [ + { + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'button.fxg-button.fxg-button--submit', + elementProperties: [{ + name: 'data-analytics', + value: '(Form\\|Freight Quote with Account)|(Form\\|EN-Freight Quote-No-Account)|(Form\\|FR-Freight Quote-No-Account)|(Form\\|FR-Freight Quote)|(Form\\|Beyond the Buy Button)|(Form\\|Beyond the Buy Button-FR)|(Form\\|Healthcare\\|Contact Us)|(Form\\|Healthcare\\|Contact Us - CAFR)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }, + { + modulePath: 'core/src/lib/events/click.js', + settings: { + anchorDelay: 6000, + elementSelector: 'a.fxg-button.fxg-button--orange', + elementProperties: [{ + name: 'data-analytics', + value: '(link\\|Start your quote)|(link\\|Commencez votre estimation)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }, + { + modulePath: 'core/src/lib/events/click.js', + settings: { + anchorDelay: 100, + elementSelector: 'a.fxg-button.fxg-button--orange', + elementProperties: [{ + name: 'data-analytics', + value: '(hero\\|FIND A JOB)|(hero\\|TROUVER UN EMPLOI)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }, + { + modulePath: 'core/src/lib/events/click.js', + settings: { + anchorDelay: 6000, + elementSelector: 'a.fxg-link.fxg-button.fxg-button--orange', + elementProperties: [{ + name: 'data-analytics', + value: '(link\\|REQUEST A CONSULTATION-FR)|(link\\|REQUEST A CONSULTATION)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + } + ], + conditions: [ + { + modulePath: 'core/src/lib/conditions/path.js', + settings: { + paths: [ + { + value: '\\/((en|fr)-ca)\\/shipping-tools\\/(freight-quote.html|freight-quote-no-account.html)', + valueIsRegex: !0 + }, + { + value: '\\/((en|fr)-ca)\\/small-business\\/ecommerce-solutions.html', + valueIsRegex: !0 + }, + { + value: '(link\\|Start your quote)|(link\\|Commencez votre estimation)', + valueIsRegex: !0 + }, + { + value: '\\/((en|fr)-ca)\\/careers.html', + valueIsRegex: !0 + }, + { + value: '\\/((en|fr)-ca)\\/shipping-services\\/healthcare.html', + valueIsRegex: !0 + }, + { + value: '\\/((en|fr)-ca)\\/shipping-services\\/healthcare\\/contact-us.html', + valueIsRegex: !0 + } + ] + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('verizonBtnClickMapping'), t = this.getAttribute('data-analytics'); + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var n = _fdx.pageFlag(e, t); + return _satellite.setVar('pixelId', n[0]), _satellite.setVar('EC', n[1]), !1 !== n; + } + } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC5d340e2bb52b4d128301fdbe0d81137a-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLf318a7e74d10412ea6b27c97deb70490', + name: 'content:all pages', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return !(void 0 !== _satellite.getVar('content:Delayed Page Type') && 'delayed' == _satellite.getVar('content:Delayed Page Type') || window.location.href.indexOf('search.html?q=') > -1 || window.location.href.indexOf('register') > -1 || window.location.href.indexOf('/online/rating.html') > -1 || window.location.href.indexOf('/online/shipping.html') > -1 || window.location.href.indexOf('/user-profile-completion/email?locale') > -1 || window.location.href.indexOf('/fedextracking/') > -1 || window.location.href.indexOf('fedex.com/fdmenrollment/') > -1 || window.location.href.indexOf('/shipment-history') > -1 || window.location.href.indexOf('/fedextrack/digital-code') > -1 || window.location.href.indexOf('/fedextrack/?token') > -1 || window.location.href.indexOf('/fedextrack/?trknbr') > -1 || window.location.href.indexOf('/fedextrack/?action=track&tracknumbers') > -1 || window.location.href.indexOf('/fedextrack/?action=track&trackingnumber') > -1 || window.location.href.indexOf('/fedextrack/?trackingnumber') > -1 || window.location.href.indexOf('/getrewards.fedex.com') > -1 || window.location.href.indexOf('shiponline/#/shipment?section=To') > -1 || window.location.href.indexOf('shiponline') > -1 || window.location.href.indexOf('?search=true') > -1 || window.location.href.indexOf('/fedextrack/?action=track&tracknumber') > -1 || window.location.href.indexOf('/fedextrack/no-results-found?trknbr') > -1 || window.location.href.indexOf('/fedextrack/?trknbr') > -1 || window.location.href.indexOf('/shipping/freight-services/international-air-freight-quote/generic_thankyou.html') > -1); + } + } + }], + actions: [ + { + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'window.fdx_locale = _satellite.getVar("content:locale");', + language: 'javascript' + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar30', + type: 'value', + value: '%site-diagnostics:viewport%' + }, + { + name: 'eVar38', + type: 'value', + value: '%content:page name%' + }, + { + name: 'eVar58', + type: 'value', + value: '%external-campaign:link%' + } + ], + props: [ + { + name: 'prop2', + type: 'value', + value: '%content:countryCode%' + }, + { + name: 'prop3', + type: 'value', + value: '%content:language%' + }, + { + name: 'prop5', + type: 'value', + value: '%content:region%' + }, + { + name: 'prop20', + type: 'value', + value: '%content:page name%' + }, + { + name: 'prop23', + type: 'value', + value: '%content:historicalPageName%' + }, + { + name: 'prop33', + type: 'value', + value: '%content:page type%' + }, + { + name: 'prop38', + type: 'alias', + value: 'eVar38' + }, + { + name: 'prop58', + type: 'alias', + value: 'eVar58' + }, + { + name: 'prop67', + type: 'alias', + value: 'eVar30' + } + ], + channel: '%content:site section%', + campaign: { + type: 'queryParam', + value: 'CMP' + }, + pageName: '%content:page name%' + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RLb75c4c61b6af499b8bfdefe358d7015e', + name: 'medallia', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { + paths: [ + { + value: '/(((en|fr|de|it)-ch)|(he-il)|(ru-ru)|(tr-tr)|(uk-ua))/tracking.html', + valueIsRegex: !0 + }, + { + value: '/((en-(il|ru|tr))|(fr-fr)|((en|de|it)-ch)|(he-il)|(ru-ru)|(tr-tr)|((en|ru|uk)-ua))/online/shipping.html', + valueIsRegex: !0 + } + ] + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'var version = "2006.07242020.01";\nif (window.location.hostname == "www.fedex.com" || window.location.hostname == "www.spain.fedex.com") {\n window.MDIGITAL_ON_PREM_PREFIX = "https://on-prem.kampyle.com/FedexProd/COLO";\n} else {\n window.MDIGITAL_ON_PREM_PREFIX = "https://on-prem.kampyle.com/FedexTest/COLO";\n}\n(function() {\n if (!window.KAMPYLE_EMBED) {\n var onPremEmbedRegex = /\\/[a-zA-Z\\d-]+\\/\\d+\\/onsite\\/medallia-digital-embed\\.js$/;\n var genericPathRegex = /\\/[a-zA-Z\\d-]+\\/\\d+\\/onsite\\/generic\\d{13}\\.js$/;\n window.KAMPYLE_EMBED = {\n kampyleInit: function() {\n var t = document.createElement(\'script\');\n t.type = \'text/javascript\';\n t.async = true;\n t.src = KAMPYLE_EMBED.getGenericLocation();\n t.charset = \'UTF-8\';\n document.body.appendChild(t);\n },\n kampyleLoadLogger: function() {},\n kampyleEventHandler: function(elem, eventType, handler) {\n if (elem.addEventListener) {\n elem.addEventListener(eventType, handler, false);\n } else if (elem.attachEvent) {\n elem.attachEvent(\'on\' + eventType, handler);\n }\n },\n isSupported: function() {\n var result = {\n isIE: false,\n trueVersion: 0,\n actingVersion: 0,\n compatibilityMode: false\n };\n var trident = window.KAMPYLE_EMBED.getUserAgent().match(/Trident\\/(\\d+)/);\n if (trident) {\n result.isIE = true;\n result.trueVersion = parseInt(trident[1], 10) + 4;\n }\n var msie = navigator.userAgent.match(/MSIE (\\d+)/);\n if (msie) {\n result.isIE = true;\n result.actingVersion = parseInt(msie[1]);\n } else {\n result.actingVersion = result.trueVersion;\n }\n if (result.isIE && result.trueVersion > 0 && result.actingVersion > 0) {\n result.compatibilityMode = result.trueVersion != result.actingVersion;\n }\n return !result.isIE || result.trueVersion > 9 || (result.actingVersion >= 9 && result.compatibilityMode);\n },\n getUserAgent: function() {\n return navigator.userAgent;\n },\n getGenericLocation: function() {\n var genericLocation = location.protocol + \'//\' + \'resources.digital-cloud-prem.medallia.eu/wdceuprem/10189/onsite/generic1582912036013.js\';\n var genericPath = (genericLocation.match(genericPathRegex) || [])[0];\n genericLocation = window.KAMPYLE_EMBED.getResourcesPrefix() + genericPath;\n return genericLocation;\n },\n isOnPremScript: function(scriptPath) {\n return onPremEmbedRegex.test(scriptPath);\n },\n isOnPrem: function() {\n if (window.MDIGITAL_ON_PREM_PREFIX) {\n return true;\n }\n var scripts = (document.getElementsByTagName(\'script\') || []);\n if (!(scripts && scripts.length)) {\n return false;\n }\n for (var i = scripts.length - 1; i >= 0; i--) {\n if (window.KAMPYLE_EMBED.isOnPremScript(scripts[i].src)) {\n return true;\n }\n }\n return false;\n },\n getResourcesPrefix: function() {\n if (window.MDIGITAL_ON_PREM_PREFIX) {\n return window.MDIGITAL_ON_PREM_PREFIX;\n }\n var scripts = document.getElementsByTagName(\'script\');\n var neededSrcPath = null;\n var i = 0;\n while (scripts && !neededSrcPath && i < scripts.length) {\n if (scripts[i].src && onPremEmbedRegex.test(scripts[i].src)) {\n neededSrcPath = scripts[i].src;\n }\n i++;\n }\n if (neededSrcPath) {\n window.MDIGITAL_ON_PREM_PREFIX = neededSrcPath.replace(onPremEmbedRegex, \'\');\n return window.MDIGITAL_ON_PREM_PREFIX;\n }\n if (window.location && window.location.origin) {\n return window.location.origin;\n }\n return \'\';\n }\n };\n if (window.KAMPYLE_EMBED.isSupported()) {\n if (document.readyState === \'complete\') {\n window.KAMPYLE_EMBED.kampyleInit();\n } else {\n window.KAMPYLE_EMBED.kampyleEventHandler(window, \'load\', window.KAMPYLE_EMBED.kampyleInit);\n }\n }\n }\n})();', + language: 'javascript' + } + }] + }, + { + id: 'RLffa50bacf48d41e99b38c31bf1374f6c', + name: 'event:formSubmitButton', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: 'button.fxg-button.fxg-button--orange ', + elementProperties: [{ + name: 'data-analytics', + value: '(Form\\|EN-Freight Quote-No-Account)|(Form\\|Submit Button-Logistics Contact Us)|(Form\\|Soumettre-Logistics Contact Us-FR)|(myquote\\|Submit a Quote)', + valueIsRegex: !0 + }], + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = this.getAttribute('data-analytics'), t = { + 'Form|EN-Freight Quote-No-Account': 'event193', + 'Form|Submit Button-Logistics Contact Us': 'event194', + 'Form|Soumettre-Logistics Contact Us-FR': 'event194', + 'myquote|Submit a Quote': 'event309' + }, n = ''; + return n = _fdx.pageFlag(t, e), _satellite.setVar('formEvent', n), 'undefined' !== n && '' !== n; + } + } + }], + actions: [{ + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + var n = _satellite.getVar('formEvent'); + t.linkTrackEvents = t.events = n; + } + }, + trackerProperties: { events: [{ name: 'event309' }] } + } + }] + }, + { + id: 'RLb59ce925f925494096bff11a2b1ae866', + name: 'adTag:dfa', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('dfa:pageListMapping'), t = _satellite.getVar('content:countryCode'), n = window.location.href; + n = /.com(.*)/.exec(n)[1]; + var r = 10000000000000 * (Math.random() + ''); + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var i = _fdx.pageFlag(e, t, 'country'), a = _fdx.pageFlag(i, n); + return _satellite.setVar('dfaLabel', a + r), !1 !== a; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '', + language: 'html' + } + }] + }, + { + id: 'RL9bfeb3df10c74a4f9e67ec00a6141898', + name: 'rectag:ContentSquare', + events: [{ + modulePath: 'core/src/lib/events/domReady.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { + paths: [ + { + value: '\\/(en-us)\\/(printing|office)\\/(personal-projects|online-printing|banners|business-cards|consumer-offers|design-services|flash-sale-offers|greeting-cards|marketing-materials|menus|national-bid-center|online-custom-frames|passport-photo|photobooks|posters|poster-sign-banner-printing|print-preferred|signs|small-medium-business-offers|services|printandgo|customersupport).html', + valueIsRegex: !0 + }, + { + value: '\\/(en-us)\\/(shipping|printing)\\/(marketing-materials|packing-supplies|posters)\\/(brochures|flyers|postcards|custom-branded-boxes|prints).html', + valueIsRegex: !0 + }, + { + value: '\\/(en-us)\\/(office|printing|coupon-offers|).html', + valueIsRegex: !0 + } + ] + } + }], + actions: [{ + modulePath: 'contentsquare/src/lib/actions/uxaInstallation.js', + settings: { + setPathInput: '', + setQueryInput: '', + setPathCheckbox: !1, + setQueryCheckbox: !1 + } + }] + }, + { + id: 'RLbe6e1289f9cf4e7696a25b45f7998fe3', + name: 'qualtrics Mapping', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('qualtrics:pageListMappingNew'), t = window.location.pathname, n = _satellite.getVar('qualtrics:pageName'), r = _satellite.getVar('content:pagePath'); + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var i = _fdx.pageFlag(e, t); + return i || _fdx.pageFlag(n, r); + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n\n
\n\n', + language: 'html' + } + }] + }, + { + id: 'RLb59ec6f78a8f4eb492a32ffda9b18a26', + name: 'event:button click', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + anchorDelay: 100, + elementSelector: 'button', + bubbleFireIfChildFired: !1 + }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('Check Interval'), t = _satellite.getVar('Delay Time'), n = [ + 'hero|track', + 'hero|cube|rate & ship', + 'hero|cube|rate', + 'hero|cube|track', + 'hero|cube|locate', + 'hero|cube|ship' + ], r = setInterval(function () { + var e = FDX.DATALAYER.page.button.data; + void 0 !== e && e && (clearInterval(r), i && clearTimeout(i), setTimeout(function () { + var t = 'undefined' !== FDX.DATALAYER.page.button && '' !== FDX.DATALAYER.page.button.data ? FDX.DATALAYER.page.button.data : '', r = 'undefined' !== FDX.DATALAYER.page.button && '' !== FDX.DATALAYER.page.button.type ? FDX.DATALAYER.page.button.type : ''; + return null != t && '' != t && ('' !== r && 'newPage' == r ? (fdx_setLinkView(t), !1) : void 0 !== r && 'samePage' == r ? (n.indexOf(e.toLowerCase()) > -1 ? fdx_setLinkView(t) : fdx_logLinkView(t), !1) : void 0); + }, t)); + }, e), i = setTimeout(function () { + clearInterval(r); + }, 3000); + } + } + }], + actions: [] + }, + { + id: 'RL3cc926443507480cad38a9d75766b783', + name: 'va:Advanced Tracking US', + events: [{ + modulePath: 'core/src/lib/events/domReady.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('content:deviceType'); + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var t = _satellite.getVar('va:enabledCountryList'), n = _satellite.getVar('content:countryCode'), r = _satellite.getVar('va:mobEnabledUrl'), i = _fdx.pageFlag(t, n), a = _satellite.getVar('va:caasEnabledCountryList'), o = _satellite.getVar('va:caasMobEnabledUrl'), s = _satellite.getVar('content:locale'), c = _satellite.getVar('va:caasDisabledCountryList'); + a.indexOf(s) > -1 ? isCaasMobEnabled = !0 : isCaasMobEnabled = !1; + var u = window.location.pathname, l = '/' + _satellite.getVar('content:locale').replace('_', '-') + '/', d = '/customer-support.html', f = _satellite.getVar('va:disabledPageList'); + f = f.filter(function (e) { + return e !== d; + }); + var p = !_fdx.pageFlag(f, u), m = !_fdx.pageFlag(f, l), g = _fdx.pageFlag(r, u), h = _fdx.pageFlag(o, u), v = i && p, b = i && m && c, y = i && g, _ = i && m && h && isCaasMobEnabled; + return void 0 === FDX.CAAS ? !('desktop' != e || !v) || !('mobile' != e || !y) : !('desktop' != e || !b) || !('mobile' != e || !_); + } + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return null == _satellite.cookie.get('wcmmode'); + } + } + }, + { + modulePath: 'core/src/lib/conditions/valueComparison.js', + settings: { + comparison: { + operator: 'equals', + caseInsensitive: !0 + }, + leftOperand: '%content:countryCode%', + rightOperand: 'us' + } + } + ], + actions: [ + { + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RCf5ace9ce2c02460292ffbbb33fdaf2ce-source.min.js', + language: 'javascript', + isExternal: !0 + } + }, + { + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC6f7028d1bfd44f299fb11fa759c79d78-source.min.js', + language: 'javascript', + isExternal: !0 + } + } + ] + }, + { + id: 'RL52b1fa61e71048f0bcad6d8a83f92afd', + name: 'gTag:DCPageEvent_Possibilities', + events: [{ + modulePath: 'core/src/lib/events/domReady.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return void 0 !== _satellite.getVar('gTag:EnabledLocaleEpic') && null !== _satellite.getVar('gTag:EnabledLocaleEpic') && '' !== _satellite.getVar('gTag:EnabledLocaleEpic'); + } + } + }, + { + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { paths: [{ value: '/about/possibilities.html' }] } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RCf3c678d6b03b4c8bb86cc76c7f2ee3b1-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RL81c5ef8fb72c4171b2e71ad7043fa2f9', + name: 'qualtrics:Site-wide', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var e = _fdx.pcfUtil().match(/www(sbox.idev|base.idev|dev.idev|drt.idev|stress.dmz.idev|bit.idev|test|).fedex.com/gi), t = '' == _satellite.getVar('qualtrics:DisableLocale'); + return !(null === e || !t); + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n\n
\n\n', + language: 'html' + } + }] + }, + { + id: 'RLd9ee42858400466dba005d3c71fc8e44', + name: 'gtag:VideoPlay', + events: [{ + modulePath: 'core/src/lib/events/mediaTimePlayed.js', + settings: { + unit: 'percent', + amount: 1, + elementSelector: '.brightcove-container video', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/pathAndQuerystring.js', + settings: { + paths: [{ + value: '/(ko-kr|zh-tw|en-sg)/about/possibilities.html', + valueIsRegex: !0 + }] + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + var e = _satellite.getVar('gTag:VideoPlayIdList'), t = this.parentElement.getAttribute('data-video-id'), n = _satellite.getVar('content:countryCode'); + 'undefined' == typeof _fdx && _satellite.getVar('_fdxUtil'); + var r = _fdx.pageFlag(e, n, 'country'), i = _fdx.pageFlag(r, t); + return _satellite.setVar('videoGtagLabel', i), !1 !== i; + } + } + } + ], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: 'https://assets.adobedtm.com/686b8f0c4520/4ce401c51b51/68076acba2cc/RC570a690757b1444e94b0cc30f9c21bd2-source.min.js', + language: 'javascript', + isExternal: !0 + } + }] + }, + { + id: 'RLbf53e5bef53c41afb992313a6bc1cc8c', + name: 'vaPopin external link click new window', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '#nina-fedex a', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return 'Dialog' !== this.getAttribute('data-vtz-link-type') && '_blank' == this.getAttribute('target'); + } + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + if ('en_us' !== _satellite.getVar('content:locale') || 'en_gb' !== loccale) + return !0; + } + } + } + ], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + props: [ + { + name: 'prop18', + type: 'value', + value: '%content:page name%' + }, + { + name: 'prop19', + type: 'value', + value: 'vaPopinAsk ' + }, + { + name: 'prop20', + type: 'value', + value: '%content:page name%:vaPopinAsk ' + } + ] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: '#', + linkType: 'e' + } + } + ] + }, + { + id: 'RL970355626bc0412a9e75a45ace4792f5', + name: 'event:AWBThankPage', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/valueComparison.js', + settings: { + comparison: { operator: 'equals' }, + leftOperand: '%content:page name%', + rightOperand: 'fedex/shipping/freight-services/international-air-freight-quote/generic_thankyou' + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return _satellite.setVar('formEvent', 'event309'), !0; + } + } + } + ], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + var n = _satellite.getVar('formEvent'); + t.linkTrackEvents = t.events = n; + } + }, + trackerProperties: { events: [{ name: 'event309' }] } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RL5d2cf0075d814e25874c19bfed0a65ab', + name: 'va:popin Ask', + events: [{ + modulePath: 'core/src/lib/events/dataElementChange.js', + settings: { name: 'event:vaClick' }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/maxFrequency.js', + settings: { + unit: 'session', + count: 1 + } + }, + { + modulePath: 'core/src/lib/conditions/variable.js', + settings: { + name: 'FDX.DATALAYER.VA.status', + value: 'vaPopinAsk', + valueIsRegex: !0 + } + }, + { + modulePath: 'core/src/lib/conditions/valueComparison.js', + settings: { + comparison: { operator: 'greaterThan' }, + leftOperand: '%va:version number%', + rightOperand: 202110261530 + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + if ('en_us' !== _satellite.getVar('content:locale') || 'en_gb' !== loccale) + return !0; + } + } + } + ], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + props: [ + { + name: 'prop18', + type: 'value', + value: '%content:page name%' + }, + { + name: 'prop19', + type: 'value', + value: 'vaPopinAsk ' + }, + { + name: 'prop20', + type: 'value', + value: '%content:page name%:vaPopinAsk ' + } + ] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'va_NINA', + linkType: 'o' + } + } + ] + }, + { + id: 'RL7f6344f56f4247b8a084b430cdf885a6', + name: 'vaPopin internal link click ', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '#nina-fedex a', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [ + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return 'Dialog' === this.getAttribute('data-vtz-link-type'); + } + } + }, + { + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + if ('en_us' !== _satellite.getVar('content:locale') || 'en_gb' !== loccale) + return !0; + } + } + } + ], + actions: [{ + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + props: [ + { + name: 'prop18', + type: 'value', + value: '%content:page name%' + }, + { + name: 'prop19', + type: 'value', + value: 'vaPopinAsk ' + }, + { + name: 'prop20', + type: 'value', + value: '%content:page name%:vaPopinAsk ' + } + ] + } + } + }] + } + ] + }; + var $___var_56b07e5f70910fd1 = function () { + 'use strict'; + function e(e) { + if (null == e) + throw new TypeError('Object.assign cannot be called with null or undefined'); + return Object(e); + } + function t() { + try { + if (!Object.assign) + return !1; + var e = new String('abc'); + if (e[5] = 'de', '5' === Object.getOwnPropertyNames(e)[0]) + return !1; + for (var t = {}, n = 0; n < 10; n++) + t['_' + String.fromCharCode(n)] = n; + if ('0123456789' !== Object.getOwnPropertyNames(t).map(function (e) { + return t[e]; + }).join('')) + return !1; + var r = {}; + return 'abcdefghijklmnopqrst'.split('').forEach(function (e) { + r[e] = e; + }), 'abcdefghijklmnopqrst' === Object.keys(Object.assign({}, r)).join(''); + } catch (e) { + return !1; + } + } + function n(e) { + if (e.__esModule) + return e; + var t = Object.defineProperty({}, '__esModule', { value: !0 }); + return Object.keys(e).forEach(function (n) { + var r = Object.getOwnPropertyDescriptor(e, n); + Object.defineProperty(t, n, r.get ? r : { + enumerable: !0, + get: function () { + return e[n]; + } + }); + }), t; + } + function r(e) { + var t = { exports: {} }; + return e(t, t.exports), t.exports; + } + function i(e) { + var t = this.constructor; + return this.then(function (n) { + return t.resolve(e()).then(function () { + return n; + }); + }, function (n) { + return t.resolve(e()).then(function () { + return t.reject(n); + }); + }); + } + function a(e) { + return Boolean(e && void 0 !== e.length); + } + function o() { + } + function s(e, t) { + return function () { + e.apply(t, arguments); + }; + } + function c(e) { + if (!(this instanceof c)) + throw new TypeError('Promises must be constructed via new'); + if ('function' != typeof e) + throw new TypeError('not a function'); + this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], m(e, this); + } + function u(e, t) { + for (; 3 === e._state;) + e = e._value; + 0 !== e._state ? (e._handled = !0, c._immediateFn(function () { + var n = 1 === e._state ? t.onFulfilled : t.onRejected; + if (null !== n) { + var r; + try { + r = n(e._value); + } catch (e) { + return void d(t.promise, e); + } + l(t.promise, r); + } else + (1 === e._state ? l : d)(t.promise, e._value); + })) : e._deferreds.push(t); + } + function l(e, t) { + try { + if (t === e) + throw new TypeError('A promise cannot be resolved with itself.'); + if (t && ('object' == typeof t || 'function' == typeof t)) { + var n = t.then; + if (t instanceof c) + return e._state = 3, e._value = t, void f(e); + if ('function' == typeof n) + return void m(s(n, t), e); + } + e._state = 1, e._value = t, f(e); + } catch (t) { + d(e, t); + } + } + function d(e, t) { + e._state = 2, e._value = t, f(e); + } + function f(e) { + 2 === e._state && 0 === e._deferreds.length && c._immediateFn(function () { + e._handled || c._unhandledRejectionFn(e._value); + }); + for (var t = 0, n = e._deferreds.length; t < n; t++) + u(e, e._deferreds[t]); + e._deferreds = null; + } + function p(e, t, n) { + this.onFulfilled = 'function' == typeof e ? e : null, this.onRejected = 'function' == typeof t ? t : null, this.promise = n; + } + function m(e, t) { + var n = !1; + try { + e(function (e) { + n || (n = !0, l(t, e)); + }, function (e) { + n || (n = !0, d(t, e)); + }); + } catch (e) { + if (n) + return; + n = !0, d(t, e); + } + } + function g(e) { + return !0 === Xe(e) && '[object Object]' === Object.prototype.toString.call(e); + } + function h(e, t) { + return Object.prototype.hasOwnProperty.call(e, t); + } + function v(e) { + return 'string' == typeof e && -1 !== e.indexOf('[') && -1 !== e.indexOf(']'); + } + function b(e) { + return e.substr(0, e.indexOf('[')); + } + function y(e, t, n) { + if (e.length && Ke(t)) { + var r = e[0]; + if (1 !== e.length) { + var i = e.slice(1); + if (!v(r)) + return y(i, t[r], n); + var a = t[r = b(r)]; + Array.isArray(a) && a.forEach(function (e) { + return y(i, e, n); + }); + } else + t.hasOwnProperty(r) && 'string' == typeof t[r] && (t[r] = n(t[r])); + } + } + if (window.atob) { + var _ = document, C = Object.getOwnPropertySymbols, x = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable, w = t() ? Object.assign : function (t) { + for (var n, r, i = e(t), a = 1; a < arguments.length; a++) { + for (var o in n = Object(arguments[a])) + x.call(n, o) && (i[o] = n[o]); + if (C) { + r = C(n); + for (var s = 0; s < r.length; s++) + k.call(n, r[s]) && (i[r[s]] = n[r[s]]); + } + } + return i; + }, E = w, I = window, D = function (e, t, n) { + var r, i = Array.isArray(t), a = Boolean(i && e), o = document.createElement('a'); + if (o.href = e, (!/^https?:\/\/.*/.test(e) || !o.host) && i) { + var s = new Error('Unable to find the Library Embed Code for Dynamic Host Resolution.'); + throw s.code = 'dynamic_host_resolver_constructor_error', s; + } + if (i && -1 === t.indexOf(o.hostname)) { + var c = new Error('This library is not authorized for this domain. Please contact your CSM for more information.'); + throw c.code = 'dynamic_host_not_allowed', c; + } + var u = function () { + if (null != r) + return r; + if (a) { + var e = o.host; + /:80$/.test(e) ? e = e.replace(':80', '') : /:80\/$/.test(e) ? e = e.replace(':80/', '') : /:443$/.test(e) ? e = e.replace(':443', '') : /:443\/$/.test(e) && (e = e.replace(':443/', '')), r = 'https://' + e; + } else + r = ''; + return r; + }, l = function (e) { + return a && 'string' == typeof e ? [ + u(), + '/' === e.charAt(0) ? e.slice(1) : e + ].join('/') : e; + }, d = { + getTurbineHost: u, + decorateWithDynamicHost: l, + get isDynamicEnforced() { + return i; + } + }; + return I && n.onDebugChanged(function (e) { + e ? I.dynamicHostResolver = d : delete I.dynamicHostResolver; + }), d; + }, A = function (e) { + var t = []; + return e.forEach(function (e) { + e.events && e.events.forEach(function (n) { + t.push({ + rule: e, + event: n + }); + }); + }), t.sort(function (e, t) { + return e.event.ruleOrder - t.event.ruleOrder; + }); + }, S = 'debug', T = function (e, t) { + var n = function () { + return 'true' === e.getItem(S); + }, r = function (t) { + e.setItem(S, t); + }, i = [], a = function (e) { + i.push(e); + }; + return t.outputEnabled = n(), { + onDebugChanged: a, + getDebugEnabled: n, + setDebugEnabled: function (e) { + n() !== e && (r(e), t.outputEnabled = e, i.forEach(function (t) { + t(e); + })); + } + }; + }, P = 'Module did not export a function.', O = function (e, t, n) { + return function (r, i, a) { + a = a || []; + var o = e.getModuleExports(r.modulePath); + if ('function' != typeof o) + throw new Error(P); + var s = e.getModuleDefinition(r.modulePath), c = r.settings || {}; + !r.hasTransformedFilePaths && s.filePaths && (n(c, s.filePaths, r.modulePath), r.hasTransformedFilePaths = !0); + var u = t(c, i); + return o.bind(null, u).apply(null, a); + }; + }, j = function (e) { + return 'string' == typeof e ? e.replace(/\s+/g, ' ').trim() : e; + }, L = { + LOG: 'log', + INFO: 'info', + DEBUG: 'debug', + WARN: 'warn', + ERROR: 'error' + }, M = '\uD83D\uDE80', V = 10 === parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1]) ? '[Launch]' : M, R = !1, N = function (e) { + if (R && window.console) { + var t = Array.prototype.slice.call(arguments, 1); + t.unshift(V), e !== L.DEBUG || window.console[e] || (e = L.INFO), window.console[e].apply(window.console, t); + } + }, F = N.bind(null, L.LOG), B = N.bind(null, L.INFO), U = N.bind(null, L.DEBUG), z = N.bind(null, L.WARN), q = N.bind(null, L.ERROR), H = function () { + var e = R; + R = !0, N.apply(null, Array.prototype.concat(L.WARN, Array.prototype.slice.call(arguments))), e || (R = !1); + }, W = { + log: F, + info: B, + debug: U, + warn: z, + error: q, + deprecation: H, + get outputEnabled() { + return R; + }, + set outputEnabled(e) { + R = e; + }, + createPrefixedLogger: function (e) { + var t = '[' + e + ']'; + return { + log: F.bind(null, t), + info: B.bind(null, t), + debug: U.bind(null, t), + warn: z.bind(null, t), + error: q.bind(null, t) + }; + } + }, G = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof window ? window : 'undefined' != typeof global ? global : 'undefined' != typeof self ? self : {}, Y = r(function (e) { + !function (t) { + if (e.exports = t(), !!0) { + var n = window.Cookies, r = window.Cookies = t(); + r.noConflict = function () { + return window.Cookies = n, r; + }; + } + }(function () { + function e() { + for (var e = 0, t = {}; e < arguments.length; e++) { + var n = arguments[e]; + for (var r in n) + t[r] = n[r]; + } + return t; + } + function t(e) { + return e.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); + } + function n(r) { + function i() { + } + function a(t, n, a) { + if ('undefined' != typeof document) { + 'number' == typeof (a = e({ path: '/' }, i.defaults, a)).expires && (a.expires = new Date(1 * new Date() + 86400000 * a.expires)), a.expires = a.expires ? a.expires.toUTCString() : ''; + try { + var o = JSON.stringify(n); + /^[\{\[]/.test(o) && (n = o); + } catch (e) { + } + n = r.write ? r.write(n, t) : encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), t = encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape); + var s = ''; + for (var c in a) + a[c] && (s += '; ' + c, !0 !== a[c] && (s += '=' + a[c].split(';')[0])); + return document.cookie = t + '=' + n + s; + } + } + function o(e, n) { + if ('undefined' != typeof document) { + for (var i = {}, a = document.cookie ? document.cookie.split('; ') : [], o = 0; o < a.length; o++) { + var s = a[o].split('='), c = s.slice(1).join('='); + n || '"' !== c.charAt(0) || (c = c.slice(1, -1)); + try { + var u = t(s[0]); + if (c = (r.read || r)(c, u) || t(c), n) + try { + c = JSON.parse(c); + } catch (e) { + } + if (i[u] = c, e === u) + break; + } catch (e) { + } + } + return e ? i[e] : i; + } + } + return i.set = a, i.get = function (e) { + return o(e, !1); + }, i.getJSON = function (e) { + return o(e, !0); + }, i.remove = function (t, n) { + a(t, '', e(n, { expires: -1 })); + }, i.defaults = {}, i.withConverter = n, i; + } + return n(function () { + }); + }); + }), X = { + get: Y.get, + set: Y.set, + remove: Y.remove + }, K = 'com.adobe.reactor.', Q = function (e, t) { + var n = K + (t || ''); + return { + getItem: function (t) { + const $___old_cb64c22a0e9c23d7 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_cb64c22a0e9c23d7) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_213c2c698e570270.localStorage)); + return function () { + try { + return I[e].getItem(n + t); + } catch (e) { + return null; + } + }.apply(this, arguments); + } finally { + if ($___old_cb64c22a0e9c23d7) + ({}.constructor.defineProperty(window, 'localStorage', $___old_cb64c22a0e9c23d7)); + } + }, + setItem: function (t, r) { + const $___old_14071c7b1877ea46 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_14071c7b1877ea46) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_213c2c698e570270.localStorage)); + return function () { + try { + return I[e].setItem(n + t, r), !0; + } catch (e) { + return !1; + } + }.apply(this, arguments); + } finally { + if ($___old_14071c7b1877ea46) + ({}.constructor.defineProperty(window, 'localStorage', $___old_14071c7b1877ea46)); + } + } + }; + }, $ = '_sdsat_', J = 'dataElements.', Z = 'dataElementCookiesMigrated', ee = Q('localStorage'), te = Q('sessionStorage', J), ne = Q('localStorage', J), re = { + PAGEVIEW: 'pageview', + SESSION: 'session', + VISITOR: 'visitor' + }, ie = {}, ae = function (e) { + var t; + try { + t = JSON.stringify(e); + } catch (e) { + } + return t; + }, oe = function (e, t, n) { + var r; + switch (t) { + case re.PAGEVIEW: + return void (ie[e] = n); + case re.SESSION: + return void ((r = ae(n)) && te.setItem(e, r)); + case re.VISITOR: + return void ((r = ae(n)) && ne.setItem(e, r)); + } + }, se = function (e, t) { + var n = X.get($ + e); + void 0 !== n && oe(e, t, n); + }, ce = function (e) { + ee.getItem(Z) || (Object.keys(e).forEach(function (t) { + se(t, e[t].storageDuration); + }), ee.setItem(Z, !0)); + }, ue = { + setValue: oe, + getValue: function (e, t) { + var n; + switch (t) { + case re.PAGEVIEW: + return ie.hasOwnProperty(e) ? ie[e] : null; + case re.SESSION: + return null === (n = te.getItem(e)) ? n : JSON.parse(n); + case re.VISITOR: + return null === (n = ne.getItem(e)) ? n : JSON.parse(n); + } + }, + migrateCookieData: ce + }, le = function (e, t, n, r) { + return 'Failed to execute data element module ' + e.modulePath + ' for data element ' + t + '. ' + n + (r ? '\n' + r : ''); + }, de = function (e, t, n, r, i) { + return function (a, o) { + var s = t(a); + if (!s) + return r ? '' : void 0; + var c, u, l = s.storageDuration; + try { + c = e.getModuleExports(s.modulePath), u = e.getModuleDefinition(s.modulePath); + } catch (e) { + return void W.error(le(s, a, e.message, e.stack)); + } + if ('function' == typeof c) { + var d, f = s.settings || {}; + !s.hasTransformedFilePaths && u.filePaths && (i(f, u.filePaths, s.modulePath), s.hasTransformedFilePaths = !0); + try { + d = c(n(f, o), o); + } catch (e) { + return void W.error(le(s, a, e.message, e.stack)); + } + return l && (null != d ? ue.setValue(a, l, d) : d = ue.getValue(a, l)), null == d && null != s.defaultValue && (d = s.defaultValue), 'string' == typeof d && (s.cleanText && (d = j(d)), s.forceLowerCase && (d = d.toLowerCase())), d; + } + W.error(le(s, a, 'Module did not export a function.')); + }; + }, fe = { + text: function (e) { + return e.textContent; + }, + cleanText: function (e) { + return j(e.textContent); + } + }, pe = function (e, t, n) { + for (var r, i = e, a = 0, o = t.length; a < o; a++) { + if (null == i) + return; + var s = t[a]; + if (n && '@' === s.charAt(0)) { + var c = s.slice(1); + i = fe[c](i); + } else if (i.getAttribute && (r = s.match(/^getAttribute\((.+)\)$/))) { + var u = r[1]; + i = i.getAttribute(u); + } else + i = i[s]; + } + return i; + }, me = function (e, t, n) { + return function (r, i) { + var a; + if (t(r)) + a = n(r, i); + else { + var o = r.split('.'), s = o.shift(); + 'this' === s ? i && (a = pe(i.element, o, !0)) : 'event' === s ? i && (a = pe(i, o)) : 'target' === s ? i && (a = pe(i.target, o)) : a = pe(e[s], o); + } + return a; + }; + }, ge = function (e, t) { + return function (n) { + var r = n.split('.')[0]; + return Boolean(t(n) || 'this' === r || 'event' === r || 'target' === r || e.hasOwnProperty(r)); + }; + }, he = function (e, t, n) { + var r = { exports: {} }; + return e.call(r.exports, r, r.exports, t, n), r.exports; + }, ve = function () { + var e = {}, t = function (t) { + var n = e[t]; + if (!n) + throw new Error('Module ' + t + ' not found.'); + return n; + }, n = function () { + Object.keys(e).forEach(function (e) { + try { + r(e); + } catch (n) { + var t = 'Error initializing module ' + e + '. ' + n.message + (n.stack ? '\n' + n.stack : ''); + W.error(t); + } + }); + }, r = function (e) { + var n = t(e); + return n.hasOwnProperty('exports') || (n.exports = he(n.definition.script, n.require, n.turbine)), n.exports; + }; + return { + registerModule: function (t, n, r, i, a) { + var o = { + definition: n, + extensionName: r, + require: i, + turbine: a + }; + o.require = i, e[t] = o; + }, + hydrateCache: n, + getModuleExports: r, + getModuleDefinition: function (e) { + return t(e).definition; + }, + getModuleExtensionName: function (e) { + return t(e).extensionName; + } + }; + }, be = !1, ye = function (e) { + return function (t, n) { + var r = e._monitors; + r && (be || (W.warn('The _satellite._monitors API may change at any time and should only be used for debugging.'), be = !0), r.forEach(function (e) { + e[t] && e[t](n); + })); + }; + }, _e = function (e, t, n) { + var r, i, a, o, s = [], c = function (r, i, a) { + if (!e(i)) + return r; + s.push(i); + var o = t(i, a); + return s.pop(), null == o && n ? '' : o; + }; + return r = function (e, t) { + var n = /^%([^%]+)%$/.exec(e); + return n ? c(e, n[1], t) : e.replace(/%(.+?)%/g, function (e, n) { + return c(e, n, t); + }); + }, i = function (e, t) { + for (var n = {}, r = Object.keys(e), i = 0; i < r.length; i++) { + var a = r[i], s = e[a]; + n[a] = o(s, t); + } + return n; + }, a = function (e, t) { + for (var n = [], r = 0, i = e.length; r < i; r++) + n.push(o(e[r], t)); + return n; + }, o = function (e, t) { + return 'string' == typeof e ? r(e, t) : Array.isArray(e) ? a(e, t) : 'object' == typeof e && null !== e ? i(e, t) : e; + }, function (e, t) { + return s.length > 10 ? (W.error('Data element circular reference detected: ' + s.join(' -> ')), e) : o(e, t); + }; + }, Ce = function (e) { + return function () { + if ('string' == typeof arguments[0]) + e[arguments[0]] = arguments[1]; + else if (arguments[0]) { + var t = arguments[0]; + for (var n in t) + e[n] = t[n]; + } + }; + }, xe = setTimeout; + c.prototype.catch = function (e) { + return this.then(null, e); + }, c.prototype.then = function (e, t) { + var n = new this.constructor(o); + return u(this, new p(e, t, n)), n; + }, c.prototype.finally = i, c.all = function (e) { + return new c(function (t, n) { + function r(e, a) { + try { + if (a && ('object' == typeof a || 'function' == typeof a)) { + var s = a.then; + if ('function' == typeof s) + return void s.call(a, function (t) { + r(e, t); + }, n); + } + i[e] = a, 0 == --o && t(i); + } catch (e) { + n(e); + } + } + if (!a(e)) + return n(new TypeError('Promise.all accepts an array')); + var i = Array.prototype.slice.call(e); + if (0 === i.length) + return t([]); + for (var o = i.length, s = 0; s < i.length; s++) + r(s, i[s]); + }); + }, c.resolve = function (e) { + return e && 'object' == typeof e && e.constructor === c ? e : new c(function (t) { + t(e); + }); + }, c.reject = function (e) { + return new c(function (t, n) { + n(e); + }); + }, c.race = function (e) { + return new c(function (t, n) { + if (!a(e)) + return n(new TypeError('Promise.race accepts an array')); + for (var r = 0, i = e.length; r < i; r++) + c.resolve(e[r]).then(t, n); + }); + }, c._immediateFn = 'function' == typeof setImmediate && function (e) { + setImmediate(e); + } || function (e) { + xe(e, 0); + }, c._unhandledRejectionFn = function (e) { + 'undefined' != typeof console && console && console.warn('Possible Unhandled Promise Rejection:', e); + }; + var ke = n(Object.freeze({ + __proto__: null, + default: c + })), we = 'undefined' != typeof window && window.Promise || void 0 !== G && G.Promise || ke.default || ke, Ee = function (e, t, n) { + return function (r, i, a, o) { + return o.then(function () { + var o, s = r.delayNext; + return new we(function (t, n) { + var i = e(r, a, [a]); + if (!s) + return t(); + var c = r.timeout, u = new we(function (e, t) { + o = setTimeout(function () { + t(new Error('A timeout occurred because the action took longer than ' + c / 1000 + ' seconds to complete. ')); + }, c); + }); + we.race([ + i, + u + ]).then(t, n); + }).catch(function (e) { + return clearTimeout(o), e = t(e), n(r, i, e), we.reject(e); + }).then(function () { + clearTimeout(o); + }); + }); + }; + }, Ie = function (e, t, n, r, i) { + return function (a, o, s, c) { + return c.then(function () { + var c; + return new we(function (t, n) { + var r = e(a, s, [s]), i = a.timeout, o = new we(function (e, t) { + c = setTimeout(function () { + t(new Error('A timeout occurred because the condition took longer than ' + i / 1000 + ' seconds to complete. ')); + }, i); + }); + we.race([ + r, + o + ]).then(t, n); + }).catch(function (e) { + return clearTimeout(c), e = t(e), r(a, o, e), we.reject(e); + }).then(function (e) { + if (clearTimeout(c), !n(a, e)) + return i(a, o), we.reject(); + }); + }); + }; + }, De = we.resolve(), Ae = function (e, t, n) { + return function (r, i) { + return r.conditions && r.conditions.forEach(function (t) { + De = e(t, r, i, De); + }), r.actions && r.actions.forEach(function (e) { + De = t(e, r, i, De); + }), De = (De = De.then(function () { + n(r); + })).catch(function () { + }); + }; + }, Se = function (e) { + return Boolean(e && 'object' == typeof e && 'function' == typeof e.then); + }, Te = function (e, t, n, r) { + return function (i, a) { + var o; + if (i.conditions) + for (var s = 0; s < i.conditions.length; s++) { + o = i.conditions[s]; + try { + var c = e(o, a, [a]); + if (Se(c)) + throw new Error('Rule component sequencing must be enabled on the property for this condition to function properly.'); + if (!t(o, c)) + return n(o, i), !1; + } catch (e) { + return r(o, i, e), !1; + } + } + return !0; + }; + }, Pe = function (e, t) { + return function (n, r) { + e(n, r) && t(n, r); + }; + }, Oe = function (e) { + return function (t) { + var n = e.getModuleDefinition(t.modulePath); + return n && n.displayName || t.modulePath; + }; + }, je = function (e) { + return function (t) { + var n = t.rule, r = t.event, i = e.getModuleDefinition(r.modulePath).name; + return { + $type: e.getModuleExtensionName(r.modulePath) + '.' + i, + $rule: { + id: n.id, + name: n.name + } + }; + }; + }, Le = function (e, t, n, r, i, a) { + return function (o, s) { + var c = s.rule, u = s.event; + u.settings = u.settings || {}; + try { + var l = i(s); + t(u, null, [function (t) { + var r = n(l, t); + o(function () { + e(r, c); + }); + }]); + } catch (e) { + a.error(r(u, c, e)); + } + }; + }, Me = function (e, t, n, r) { + return function (i, a, o) { + var s = t(i); + n.error(e(s, a.name, o)), r('ruleActionFailed', { + rule: a, + action: i + }); + }; + }, Ve = function (e, t, n, r) { + return function (i, a, o) { + var s = t(i); + n.error(e(s, a.name, o)), r('ruleConditionFailed', { + rule: a, + condition: i + }); + }; + }, Re = function (e, t, n) { + return function (r, i) { + var a = e(r); + t.log('Condition "' + a + '" for rule "' + i.name + '" was not met.'), n('ruleConditionFailed', { + rule: i, + condition: r + }); + }; + }, Ne = function (e, t) { + return function (n) { + e.log('Rule "' + n.name + '" fired.'), t('ruleCompleted', { rule: n }); + }; + }, Fe = function (e, t, n) { + return function (r, i) { + var a; + if (r.actions) + for (var o = 0; o < r.actions.length; o++) { + a = r.actions[o]; + try { + e(a, i, [i]); + } catch (e) { + return void t(a, r, e); + } + } + n(r); + }; + }, Be = function (e, t, n, r) { + return function (i, a) { + r('ruleTriggered', { rule: a }), e ? n(a, i) : t(a, i); + }; + }, Ue = function (e, t, n) { + return 'Failed to execute "' + e + '" for "' + t + '" rule. ' + n.message + (n.stack ? '\n' + n.stack : ''); + }, ze = function (e, t) { + return t && !e.negate || !t && e.negate; + }, qe = [], He = !1, We = function (e) { + He ? e() : qe.push(e); + }, Ge = function (e, t, n) { + e(t).forEach(function (e) { + n(We, e); + }), He = !0, qe.forEach(function (e) { + e(); + }), qe = []; + }, Ye = function (e) { + if (e || (e = new Error('The extension triggered an error, but no error information was provided.')), !(e instanceof Error)) { + var t = 'object' == typeof e ? JSON.stringify(e) : String(e); + e = new Error(t); + } + return e; + }, Xe = function (e) { + return null != e && 'object' == typeof e && !1 === Array.isArray(e); + }, Ke = function (e) { + var t, n; + return !1 !== g(e) && ('function' == typeof (t = e.constructor) && (!1 !== g(n = t.prototype) && !1 !== n.hasOwnProperty('isPrototypeOf'))); + }, Qe = function (e, t) { + return Ke(t = t || {}) ? t = E({}, t, e) : E(t, e), t.hasOwnProperty('type') || Object.defineProperty(t, 'type', { + get: function () { + return W.deprecation('Accessing event.type in Adobe Launch has been deprecated and will be removed soon. Please use event.$type instead.'), t.$type; + } + }), t; + }, $e = function (e, t) { + return function (n, r) { + var i = e[n]; + if (i) { + var a = i.modules; + if (a) + for (var o = Object.keys(a), s = 0; s < o.length; s++) { + var c = o[s], u = a[c]; + if (u.shared && u.name === r) + return t.getModuleExports(c); + } + } + }; + }, Je = function (e, t) { + return function () { + return t ? e(t) : {}; + }; + }, Ze = function (e, t, n) { + return function (r) { + if (n) { + var i = r.split('.'); + i.splice(i.length - 1 || 1, 0, 'min'), r = i.join('.'); + } + return e(t) + r; + }; + }, et = '.js', tt = function (e) { + return e.substr(0, e.lastIndexOf('/')); + }, nt = function (e, t) { + return -1 !== e.indexOf(t, e.length - t.length); + }, rt = function (e, t) { + nt(t, et) || (t += et); + var n = t.split('/'), r = tt(e).split('/'); + return n.forEach(function (e) { + e && '.' !== e && ('..' === e ? r.length && r.pop() : r.push(e)); + }), r.join('/'); + }, it = function (e, t) { + return new we(function (n, r) { + t.onload = function () { + n(t); + }, t.onerror = function () { + r(new Error('Failed to load script ' + e)); + }; + }); + }, at = function (e) { + var t = document.createElement('script'); + t.src = e, t.async = !0; + var n = it(e, t); + return document.getElementsByTagName('head')[0].appendChild(t), n; + }, ot = function (e, t, n, r) { + t = t || '&', n = n || '='; + var i = {}; + if ('string' != typeof e || 0 === e.length) + return i; + var a = /\+/g; + e = e.split(t); + var o = 1000; + r && 'number' == typeof r.maxKeys && (o = r.maxKeys); + var s = e.length; + o > 0 && s > o && (s = o); + for (var c = 0; c < s; ++c) { + var u, l, d, f, p = e[c].replace(a, '%20'), m = p.indexOf(n); + m >= 0 ? (u = p.substr(0, m), l = p.substr(m + 1)) : (u = p, l = ''), d = decodeURIComponent(u), f = decodeURIComponent(l), h(i, d) ? Array.isArray(i[d]) ? i[d].push(f) : i[d] = [ + i[d], + f + ] : i[d] = f; + } + return i; + }, st = function (e) { + switch (typeof e) { + case 'string': + return e; + case 'boolean': + return e ? 'true' : 'false'; + case 'number': + return isFinite(e) ? e : ''; + default: + return ''; + } + }, ct = function (e, t, n, r) { + return t = t || '&', n = n || '=', null === e && (e = void 0), 'object' == typeof e ? Object.keys(e).map(function (r) { + var i = encodeURIComponent(st(r)) + n; + return Array.isArray(e[r]) ? e[r].map(function (e) { + return i + encodeURIComponent(st(e)); + }).join(t) : i + encodeURIComponent(st(e[r])); + }).join(t) : r ? encodeURIComponent(st(r)) + n + encodeURIComponent(st(e)) : ''; + }, ut = r(function (e, t) { + t.decode = t.parse = ot, t.encode = t.stringify = ct; + }), lt = '@adobe/reactor-', dt = { + cookie: X, + document: _, + 'load-script': at, + 'object-assign': E, + promise: we, + 'query-string': { + parse: function (e) { + return 'string' == typeof e && (e = e.trim().replace(/^[?#&]/, '')), ut.parse(e); + }, + stringify: function (e) { + return ut.stringify(e); + } + }, + window: I + }, ft = function (e) { + return function (t) { + if (0 === t.indexOf(lt)) { + var n = t.substr(lt.length), r = dt[n]; + if (r) + return r; + } + if (0 === t.indexOf('./') || 0 === t.indexOf('../')) + return e(t); + throw new Error('Cannot resolve module "' + t + '".'); + }; + }, pt = function (e, t, n, r, i, a, o) { + var s = e.extensions, c = e.buildInfo, u = e.environment, l = e.property.settings; + if (s) { + var d = $e(s, t); + Object.keys(s).forEach(function (f) { + var p = s[f], m = p.settings; + Array.isArray(p.filePaths) && (m = a(m, p.filePaths)); + var g = Je(r, m); + if (p.modules) { + var h = W.createPrefixedLogger(p.displayName), v = Ze(o, p.hostedLibFilesBaseUrl, c.minified), b = { + buildInfo: c, + environment: u, + property: { + name: e.property.name, + id: e.property.id + }, + getDataElementValue: i, + getExtensionSettings: g, + getHostedLibFileUrl: v, + getSharedModule: d, + logger: h, + propertySettings: l, + replaceTokens: r, + onDebugChanged: n.onDebugChanged, + get debugEnabled() { + return n.getDebugEnabled(); + } + }; + Object.keys(p.modules).forEach(function (e) { + var n = p.modules[e], r = ft(function (n) { + var r = rt(e, n); + return t.getModuleExports(r); + }); + t.registerModule(e, n, f, r, b); + }); + } + }), t.hydrateCache(); + } + return t; + }, mt = function (e, t, n, r, i) { + var a = W.createPrefixedLogger('Custom Script'); + e.track = function (e) { + W.log('"' + e + '" does not match any direct call identifiers.'); + }, e.getVisitorId = function () { + return null; + }, e.property = { + name: t.property.name, + id: t.property.id + }, e.company = t.company, e.buildInfo = t.buildInfo, e.environment = t.environment, e.logger = a, e.notify = function (e, t) { + switch (W.deprecation('_satellite.notify is deprecated. Please use the `_satellite.logger` API.'), t) { + case 3: + a.info(e); + break; + case 4: + a.warn(e); + break; + case 5: + a.error(e); + break; + default: + a.log(e); + } + }, e.getVar = r, e.setVar = i, e.setCookie = function (e, t, n) { + var r = '', i = {}; + n && (r = ', { expires: ' + n + ' }', i.expires = n); + var a = '_satellite.setCookie is deprecated. Please use _satellite.cookie.set("' + e + '", "' + t + '"' + r + ').'; + W.deprecation(a), X.set(e, t, i); + }, e.readCookie = function (e) { + return W.deprecation('_satellite.readCookie is deprecated. Please use _satellite.cookie.get("' + e + '").'), X.get(e); + }, e.removeCookie = function (e) { + W.deprecation('_satellite.removeCookie is deprecated. Please use _satellite.cookie.remove("' + e + '").'), X.remove(e); + }, e.cookie = X, e.pageBottom = function () { + }, e.setDebug = n; + var o = !1; + Object.defineProperty(e, '_container', { + get: function () { + return o || (W.warn('_satellite._container may change at any time and should only be used for debugging.'), o = !0), t; + } + }); + }, gt = function (e) { + for (var t = _.querySelectorAll('script'), n = 0; n < t.length; n++) { + var r = t[n]; + if (e.test(r.src)) + return r; + } + }, ht = function (e, t) { + return function (n, r, i) { + return e && Ke(n) && Object.keys(n).length && Array.isArray(r) && r.length ? (r.forEach(function (e) { + Boolean(null != i && /^core\/.*actions.*\/customCode\.js$/.test(i)) && 'source' === e && !n.isExternal || y(e.split('.'), n, t); + }), n) : n; + }; + }, vt = { + getTurbine: function () { + return gt(new RegExp(/(launch|satelliteLib)-[^\/]+.js(\?.*)?$/)); + }, + byRegexPattern: gt + }.getTurbine, bt = window._satellite; + if (bt && !window.__satelliteLoaded) { + window.__satelliteLoaded = !0; + var yt = bt.container; + delete bt.container; + var _t = E({}, yt.buildInfo); + Object.defineProperty(_t, 'environment', { + get: function () { + return W.deprecation('container.buildInfo.environment is deprecated.Please use `container.environment.stage` instead'), yt.environment.stage; + } + }), yt.buildInfo = _t; + var Ct, xt = T(Q('localStorage'), W), kt = ''; + _.currentScript && _.currentScript.getAttribute('src') ? kt = _.currentScript.getAttribute('src') : vt() && (kt = vt().getAttribute('src')); + try { + Ct = D(kt, yt.company.cdnAllowList, xt); + } catch (e) { + throw W.warn('Please review the following error:'), e; + } + var wt, Et = ht(Ct.isDynamicEnforced, Ct.decorateWithDynamicHost), It = ve(), Dt = yt.property.settings.undefinedVarsReturnEmpty, At = yt.property.settings.ruleComponentSequencingEnabled, St = yt.dataElements || {}; + ue.migrateCookieData(St); + var Tt = function (e) { + return St[e]; + }, Pt = function () { + return wt.apply(null, arguments); + }, Ot = de(It, Tt, Pt, Dt, Et), jt = {}, Lt = Ce(jt), Mt = ge(jt, Tt), Vt = me(jt, Tt, Ot); + wt = _e(Mt, Vt, Dt), mt(bt, yt, xt.setDebugEnabled, Vt, Lt), pt(yt, It, xt, wt, Ot, Et, Ct.decorateWithDynamicHost); + var Rt = ye(bt), Nt = O(It, wt, Et), Ft = Oe(It), Bt = Re(Ft, W, Rt), Ut = Ve(Ue, Ft, W, Rt), zt = Me(Ue, Ft, W, Rt), qt = Ne(W, Rt), Ht = Le(Be(At, Pe(Te(Nt, ze, Bt, Ut), Fe(Nt, zt, qt)), Ae(Ie(Nt, Ye, ze, Ut, Bt), Ee(Nt, Ye, zt), qt), Rt), Nt, Qe, Ue, je(It), W); + Ge(A, yt.rules || [], Ht); + } + return bt; + } + console.warn('Adobe Launch is unsupported in IE 9 and below.'); + }(); + _satellite = $___var_56b07e5f70910fd1; + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-78a233d465e2385b4f1804ca5bfbacecc08cc23b b/resources/sugarcoat-78a233d465e2385b4f1804ca5bfbacecc08cc23b new file mode 100644 index 00000000..3dca15f5 --- /dev/null +++ b/resources/sugarcoat-78a233d465e2385b4f1804ca5bfbacecc08cc23b @@ -0,0 +1,470 @@ +{ + const $___mock_84863ebea787389b = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_84863ebea787389b); + const $___mock_277c62c6d4795976 = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_277c62c6d4795976); + (function () { + !function (e) { + var r = window.webpackJsonp; + window.webpackJsonp = function (n, t, o) { + for (var c, a, i, u = 0, p = []; u < n.length; u++) + a = n[u], _[a] && p.push(_[a][0]), _[a] = 0; + for (c in t) + Object.prototype.hasOwnProperty.call(t, c) && (e[c] = t[c]); + for (r && r(n, t, o); p.length;) + p.shift()(); + if (o) + for (u = 0; u < o.length; u++) + i = __webpack_require__(__webpack_require__.s = o[u]); + return i; + }; + var n = {}, _ = { 5: 0 }; + function __webpack_require__(r) { + const $___old_b97a574059bf6495 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'), $___old_cbe983024335ee4c = {}.constructor.getOwnPropertyDescriptor(window, 'sessionStorage'), $___old_b265afedbea047e4 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_b97a574059bf6495) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_84863ebea787389b.localStorage)); + if ($___old_cbe983024335ee4c) + ({}.constructor.defineProperty(window, 'sessionStorage', $___mock_84863ebea787389b.sessionStorage)); + if ($___old_b265afedbea047e4) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_277c62c6d4795976.XMLHttpRequest)); + return function () { + if (n[r]) + return n[r].exports; + var _ = n[r] = { + i: r, + l: !1, + exports: {} + }; + return e[r].call(_.exports, _, _.exports, __webpack_require__), _.l = !0, _.exports; + }.apply(this, arguments); + } finally { + if ($___old_b97a574059bf6495) + ({}.constructor.defineProperty(window, 'localStorage', $___old_b97a574059bf6495)); + if ($___old_cbe983024335ee4c) + ({}.constructor.defineProperty(window, 'sessionStorage', $___old_cbe983024335ee4c)); + if ($___old_b265afedbea047e4) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_b265afedbea047e4)); + } + } + __webpack_require__.e = function (e) { + var r = _[e]; + if (0 === r) + return new Promise(function (e) { + e(); + }); + if (r) + return r[2]; + var n = new Promise(function (n, t) { + r = _[e] = [ + n, + t + ]; + }); + r[2] = n; + var t = document.getElementsByTagName('head')[0], o = document.createElement('script'); + o.type = 'text/javascript', o.charset = 'utf-8', o.async = !0, o.timeout = 120000, __webpack_require__.nc && o.setAttribute('nonce', __webpack_require__.nc), o.src = __webpack_require__.p + '' + e + '.a113b136ebdce01cf16d.chunk.js'; + var c = setTimeout(onScriptComplete, 120000); + function onScriptComplete() { + o.onerror = o.onload = null, clearTimeout(c); + var r = _[e]; + 0 !== r && (r && r[1](new Error('Loading chunk ' + e + ' failed.')), _[e] = void 0); + } + return o.onerror = o.onload = onScriptComplete, t.appendChild(o), n; + }, __webpack_require__.m = e, __webpack_require__.c = n, __webpack_require__.i = function (e) { + return e; + }, __webpack_require__.d = function (e, r, n) { + __webpack_require__.o(e, r) || Object.defineProperty(e, r, { + configurable: !1, + enumerable: !0, + get: n + }); + }, __webpack_require__.n = function (e) { + var r = e && e.__esModule ? function () { + return e.default; + } : function () { + return e; + }; + return __webpack_require__.d(r, 'a', r), r; + }, __webpack_require__.o = function (e, r) { + return Object.prototype.hasOwnProperty.call(e, r); + }, __webpack_require__.p = '/', __webpack_require__.oe = function (e) { + throw console.error(e), e; + }, __webpack_require__(__webpack_require__.s = 208); + }({ + 191: function (e, r) { + !function (e, r, n, _, t, o, c) { + e.GoogleAnalyticsObject = t, e.ga = e.ga || function () { + (e.ga.q = e.ga.q || []).push(arguments); + }, e.ga.l = 1 * new Date(), o = r.createElement(n), c = r.getElementsByTagName(n)[0], o.async = 1, o.src = 'https://www.google-analytics.com/analytics.js', c.parentNode.insertBefore(o, c); + }(window, document, 'script', 0, 'ga'), ga('create', 'UA-9875785-25', 'auto'), ga('send', 'pageview'); + }, + 208: function (e, r, n) { + window.location.origin.indexOf('live.house.gov') > -1 && n(191); + } + }); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-7cf18f09d6a063650697adab76d51d51cddc3f58 b/resources/sugarcoat-7cf18f09d6a063650697adab76d51d51cddc3f58 new file mode 100644 index 00000000..2b98566c --- /dev/null +++ b/resources/sugarcoat-7cf18f09d6a063650697adab76d51d51cddc3f58 @@ -0,0 +1,990 @@ +{ + const $___mock_ca918043c745117e = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_ca918043c745117e); + (function () { + window.Adform.Tracking.TrackingPointId = 59896835; + window.Adform.Tracking.TrackingPointName = 'Sky_Corporate_Unique'; + Adform.Tracking.CreateIframeElement('https://track.adform.net/serving/container/?pm=124076&lid=59896835&ctype=0&media=0&PageName=Sky_Corporate_Unique&sysvars=%7c%7c%7c%7c&itm=eyJpZCI6IiIsInN2ODYiOiJodHRwczovL3d3dy5za3kuaXQvIiwic3Y4NyI6ImNvcnBvcmF0ZSIsInN2ODgiOiJob21lIiwic3Y4OSI6IndlYiIsInN2OTIiOiIiLCJzdjkzIjoic2t5OmhvbWUifQ&rnd=1540946641&cpref=&loc=https%3a%2f%2fwww.sky.it%2f', null, { + '__ADFSV65__': '', + '__ADFSV60__': '', + '__ADFSV66__': '', + '__ADFSV86__': 'https://www.sky.it/' + }); + try { + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/tv/skyq/fibra') { + adf.track(124076, 'www.sky.it|corporate|come-vedere|skyq-fibra|sky:come-vedere:skyq-fibra'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/offerte') { + adf.track(124076, 'www.sky.it|corporate|acquista|home|sky:acquista:home'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/tv') { + adf.track(124076, 'www.sky.it|corporate|pacchetti-offerte|index|sky:pacchetti-offerte:index'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/tv/sky-cinema') { + adf.track(124076, 'www.sky.it|corporate|pacchetti e offerte|sky cinema|sky:pacchetti e offerte:sky cinema'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/tv/sky-tv') { + adf.track(124076, 'www.sky.it|corporate|pacchetti e offerte|sky tv|sky:pacchetti e offerte:sky tv'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/tv/sky-tv/serie-tv') { + adf.track(124076, 'www.sky.it|sky:pacchetti-offerte:sky-tv:serie-tv'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/offerte/abbonamento-intrattenimento-plus') { + adf.track(124076, 'www.sky.it|corporate|pacchetti-offerte|intrattenimento-plus|sky:pacchetti-offerte:intrattenimento-plus:nuovi-clienti'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/tv/sky-famiglia') { + adf.track(124076, 'sky.it|offerta-sky|pacchetti-canali|sky-famiglia'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/offerte/abbonamento-cinema') { + adf.track(124076, 'www.sky.it|corporate|landing|abbonarsi|sky:landing:abbonarsi:cinema'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/offerte/abbonamento-digitale-terrestre') { + adf.track(124076, 'www.sky.it|corporate|landing|abbonarsi|sky:landing:abbonarsi:sky-digitale-terrestre'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/offerte/abbonamento-sport/cinema') { + adf.track(124076, 'www.sky.it|corporate|pacchetti e offerte|sky sport|sky:pacchetti e offerte:sky sport'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/landing-new/abbonarsi/serietv') { + adf.track(124076, 'LP_Brand_serieTV'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/landing-new/abbonarsi/parasite') { + adf.track(124076, 'LP_Brand_parasite'); + } + }()); + if ('corporate' == 'corporate' && ('home' == 'tv' && !'https://www.sky.it/'.match('primafila') || 'home' == 'offerte')) { + adf.track(124076, 'Analisi_Organico_Branding'); + } + ; + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/landing-new/abbonarsi/promoskycalcio') { + adf.track(124076, 'LP_Calcio_desk_giu20'); + } + }()); + (function () { + var value = 'https://www.sky.it/'; + if (value == 'https://www.sky.it/callmenow-new/res/promoskycalciomobile') { + adf.track(124076, 'LP_Calcio_mobile_giu20'); + } + }()); + (function () { + if ('corporate' == 'corporate' && ('home' !== 'landing-new' && 'home' !== 'callmenow-new')) { + adf.track(124076, 'Sky_Organic_Corporate'); + } + }()); + (function () { + if ('https://www.sky.it/' == 'https://www.sky.it/landing-new/abbonarsi/serietv' || 'https://www.sky.it/' == 'https://www.sky.it/landing-new/abbonarsi/cinemabrand' || 'https://www.sky.it/' == 'https://www.sky.it/landing-new/abbonarsi/gangsoflondon' || 'https://www.sky.it/' == 'https://www.sky.it/landing-new/abbonarsi/skysport' || 'https://www.sky.it/' == 'https://www.sky.it/landing-new/abbonarsi/parasite') { + adf.track(124076, 'LP_Brand_serieTV'); + } + }()); + (function () { + if ('https://www.sky.it/' == 'https://extra.sky.it/concorsi/Tennis2021/') { + adf.track(124076, 'Extra - Atterraggio Musetti', { sv13: '' }); + } + }()); + (function () { + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5f1aada6b8e05c306c0597d7'].vendorGrant == false) { + return; + } else { + (function () { + var adfScript = document.createElement('script'); + adfScript.src = '//dmp.adform.net/audiencetag/adformat.js'; + adfScript.onload = retrieve_segments; + document.head.appendChild(adfScript); + }()); + function retrieve_segments() { + window.AdformAT = window.AdformAT || function (q, fn) { + fn = function () { + q.push([].slice.call(arguments)); + return fn; + }; + fn.q = q; + return fn; + }([]); + var token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJBZGZvcm0uRE1QLkNsYWltczo6RGF0YVByb3ZpZGVycyI6IlsxMDE5MF0iLCJpc3MiOiJkbXAtYXBpLmFkZm9ybS5jb20iLCJhdWQiOiJhdWRpZW5jZV90YWdfY29uc3VtZXJfdjEiLCJleHAiOjE5MTk0MjMxMTAsIm5iZiI6MTYwNDA2MzA1MH0.WayAEr_9hRqUX89VivEJ46hqJfk7ouY4GuiGrATbMjo'; + AdformAT('init', token); + AdformAT('cookieSegments', function (status, response) { + if (JSON.stringify(response).indexOf('BB_Clienti_Interazioni_Clienti') > -1 || JSON.stringify(response).indexOf('BB_Clienti_Interazioni_ACQ_Trading') > -1 || JSON.stringify(response).indexOf('BB_Clienti_Interazioni_ACQ_Branding') > -1) { + Floodlight_pixel(); + } + }); + } + ; + function Floodlight_pixel() { + (function () { + var axel = Math.random() + ''; + var a = axel * 10000000000000; + new Image().src = 'https://ad.doubleclick.net/ddm/activity/src=10155279;type=invmedia;cat=skywi0;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;gdpr=0;gdpr_consent=;ord=' + a + '?'; + }()); + } + ; + } + }); + }()); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5e7e1298b8e05c54a85c52d2'].vendorGrant == false) { + return; + } else { + fbq('track', 'ACQ_ViewContent'); + } + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5f369a02b8e05c308701f829'].vendorGrant == false) { + return; + } else { + if ('https://www.sky.it/'.match('landing-new') || 'https://www.sky.it/'.match('callmenow-new')) { + var _pix = document.getElementById('_pix_id_9324e26c-8905-f264-87d3-4b55d805cb90'); + if (!_pix) { + var protocol = '//'; + var a = Math.random() * 1000000000000000000; + _pix = document.createElement('iframe'); + _pix.style.display = 'none'; + _pix.setAttribute('src', protocol + 'aax-eu.amazon-adsystem.com/s/iu3?d=generic&ex-fargs=%3Fid%3D9324e26c-8905-f264-87d3-4b55d805cb90%26type%3DUNKNOWN%26m%3D35691&ex-fch=416613&ex-src=https://www.sky.it/&ex-hargs=v%3D1.0%3Bc%3D5650113350602%3Bp%3D9324E26C-8905-F264-87D3-4B55D805CB90' + '&cb=' + a); + _pix.setAttribute('id', '_pix_id_9324e26c-8905-f264-87d3-4b55d805cb90'); + document.body.appendChild(_pix); + } + ; + } + } + }); + var list = [ + 'https://www.sky.it/acquista/index.html', + 'https://www.sky.it/come-vedere/index.html', + 'https://www.sky.it/come-vedere/skyq-fibra.html', + 'https://www.sky.it/content/newaol/promozioni/crosspage_restyling.html', + 'https://www.sky.it/offerte https://www.sky.it/offerte/abbonamento-calcio', + 'https://www.sky.it/offerte/abbonamento-calcio/satellite', + 'https://www.sky.it/offerte/abbonamento-cinema', + 'https://www.sky.it/offerte/abbonamento-cinema/satellite', + 'https://www.sky.it/offerte/abbonamento-digitale-terrestre', + 'https://www.sky.it/offerte/abbonamento-intrattenimento-plus', + 'https://www.sky.it/offerte/abbonamento-sport', + 'https://www.sky.it/offerte/abbonamento-sport/satellite', + 'https://www.sky.it/offerte/abbonamento-sport-cinema', + 'https://www.sky.it/pacchetti-offerte/index.html', + 'https://www.sky.it/pacchetti-offerte/intrattenimento-plus/nuovi-clienti.html', + 'https://www.sky.it/pacchetti-offerte/sky-cinema.html', + 'https://www.sky.it/pacchetti-offerte/sky-tv.html', + 'https://www.sky.it/pacchetti-offerte/sky-tv/serie-tv.html', + 'https://www.sky.it/tv', + 'https://www.sky.it/tv/sky-calcio', + 'https://www.sky.it/tv/sky-cinema', + 'https://www.sky.it/tv/sky-famiglia', + 'https://www.sky.it/tv/sky-sport', + 'https://www.sky.it/tv/sky-tv', + 'https://www.sky.it/tv/sky-tv/serie-tv', + 'https://www.sky.it/offerte/abbonamento-tv', + 'https://www.sky.it/offerte/configuratore-abbonamento-sky', + 'https://www.sky.it/tv/sky-tv/serie-tv/speravo-de-mori-prima' + ]; + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5f369a02b8e05c308701f829'].vendorGrant == false) { + return; + } else { + if (list.includes('https://www.sky.it/')) { + var _pix = document.getElementById('_pix_id_3cb3632b-586c-6700-139f-861cabdad238'); + if (!_pix) { + var protocol = '//'; + var a = Math.random() * 1000000000000000000; + _pix = document.createElement('iframe'); + _pix.style.display = 'none'; + _pix.setAttribute('src', protocol + 'aax-eu.amazon-adsystem.com/s/iu3?d=generic&ex-fargs=%3Fid%3D3cb3632b-586c-6700-139f-861cabdad238%26type%3DUNKNOWN%26m%3D35691&ex-fch=416613&ex-src=https://www.sky.it/&ex-hargs=v%3D1.0%3Bc%3D5650113350602%3Bp%3D3CB3632B-586C-6700-139F-861CABDAD238' + '&cb=' + a); + _pix.setAttribute('id', '_pix_id_3cb3632b-586c-6700-139f-861cabdad238'); + document.body.appendChild(_pix); + } + } + } + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5e7e1298b8e05c485246cd06'].vendorGrant == false) { + return; + } else { + (function (w, d, t, r, u) { + var f, n, i; + w[u] = w[u] || [], f = function () { + var o = { ti: '30000782' }; + o.q = w[u], w[u] = new UET(o), w[u].push('pageLoad'); + }, n = d.createElement(t), n.src = r, n.async = 1, n.onload = n.onreadystatechange = function () { + var s = this.readyState; + s && s !== 'loaded' && s !== 'complete' || (f(), n.onload = n.onreadystatechange = null); + }, i = d.getElementsByTagName(t)[0], i.parentNode.insertBefore(n, i); + }(window, document, 'script', '//bat.bing.com/bat.js', 'uetq')); + } + }); + (function () { + if ('' !== '') { + var tp = new Image(); + tp.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&ADFPageName=Sky%20%E2%80%93%20Cliente%20Riconosciuto%20Analytics&ADFdivider=|&itm={\'itms\':[{sv13:\'\'}]}'; + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5f1aada6b8e05c306c0597d7'].vendorGrant == false) { + return; + } else { + (function () { + var s = document.createElement('script'); + s.type = 'text/javascript'; + s.async = true; + s.src = 'https://www.googletagmanager.com/gtag/js?id=AW-1020504674'; + var x = document.getElementsByTagName('script')[0]; + x.parentNode.insertBefore(s, x); + s.onload = function () { + window.dataLayer = window.dataLayer || []; + function gtag() { + dataLayer.push(arguments); + } + gtag('js', new Date()); + gtag('config', 'AW-1020504674'); + gtag('event', 'conversion', { 'send_to': 'AW-1020504674/UaANCLDKwt4BEOLUzuYD' }); + }; + }()); + } + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5e7e1298b8e05c54a85c52d2'].vendorGrant == false) { + return; + } else { + !function (f, b, e, v, n, t, s) { + if (f.fbq) + return; + n = f.fbq = function () { + n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments); + }; + if (!f._fbq) + f._fbq = n; + n.push = n; + n.loaded = !0; + n.version = '2.0'; + n.queue = []; + t = b.createElement(e); + t.async = !0; + t.src = v; + s = b.getElementsByTagName(e)[0]; + s.parentNode.insertBefore(t, s); + }(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js'); + fbq('init', '769114966468130'); + fbq('track', 'Cliente Riconosciuto Analytics'); + } + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5e7e1298b8e05c485246cd06'].vendorGrant == false) { + return; + } else { + (function (w, d, t, r, u) { + var f, n, i; + w[u] = w[u] || [], f = function () { + var o = { ti: '30004123' }; + o.q = w[u], w[u] = new UET(o), w[u].push('pageLoad'); + }, n = d.createElement(t), n.src = r, n.async = 1, n.onload = n.onreadystatechange = function () { + var s = this.readyState; + s && s !== 'loaded' && s !== 'complete' || (f(), n.onload = n.onreadystatechange = null); + }, i = d.getElementsByTagName(t)[0], i.parentNode.insertBefore(n, i); + }(window, document, 'script', '//bat.bing.com/bat.js', 'uetq')); + } + }); + } + }()); + if ('https://www.sky.it/' == 'https://www.sky.it/landing-new/abbonarsi/newdigitaleterrestre' || 'https://www.sky.it/' == 'https://www.sky.it/callmenow-new/res/newdigitaleterrestre-mobile' || 'https://www.sky.it/' == 'https://www.sky.it/callmenow-new/res/digitaleterrestre-calcio-mobile' || 'https://www.sky.it/' == 'https://www.sky.it/landing-new/abbonarsi/digitaleterrestre-calcio') { + window._qevents = window._qevents || []; + (function () { + var elem = document.createElement('script'); + elem.src = (document.location.protocol == 'https:' ? 'https://secure' : 'http://edge') + '.quantserve.com/quant.js'; + elem.async = true; + elem.type = 'text/javascript'; + var scpt = document.getElementsByTagName('script')[0]; + scpt.parentNode.insertBefore(elem, scpt); + }()); + _qevents.push({ + qacct: 'p-BZSYSpSSPmj6q', + labels: '_fp.event.Upper Funnel DTT', + event: 'refresh' + }); + } + if ('https://www.sky.it/'.match('landing-new') || 'https://www.sky.it/'.match('callmenow-new')) { + window._qevents = window._qevents || []; + (function () { + var elem = document.createElement('script'); + elem.src = (document.location.protocol == 'https:' ? 'https://secure' : 'http://edge') + '.quantserve.com/quant.js'; + elem.async = true; + elem.type = 'text/javascript'; + var scpt = document.getElementsByTagName('script')[0]; + scpt.parentNode.insertBefore(elem, scpt); + }()); + _qevents.push({ + qacct: 'p-BZSYSpSSPmj6q', + labels: '_fp.event.Upper Funnel Fibra', + event: 'refresh' + }); + } + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5f1aada6b8e05c306c0597d7'].vendorGrant == false) { + return; + } else { + if ('https://www.sky.it/' == 'https://www.sky.it/callmenow-new/res/skynetflixmobile') { + var axel = Math.random() + ''; + var a = axel * 10000000000000; + var adfIframe = document.createElement('iframe'); + adfIframe.src = 'https://10019337.fls.doubleclick.net/activityi;src=10019337;type=invmedia;cat=sky_t0;u1=[LP];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;gdpr=0;gdpr_consent=;ord=' + a + '?'; + adfIframe.style.display = 'none'; + document.body.appendChild(adfIframe); + } + } + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['60dc4ceecc52eb4336e0ba02'].vendorGrant == false) { + return; + } else { + (function (w, d, s) { + var js = d.createElement(s); + js.async = true; + js.src = '//cdn.fanplayr.com/customers/sky/adaptor/adaptor.js'; + var fjs = d.getElementsByTagName(s)[0]; + fjs.parentNode.insertBefore(js, fjs); + }(window, document, 'script')); + } + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['60c36fd126b4ae05d420203a'].vendorGrant == false) { + return; + } else { + if ('https://www.sky.it/' == 'https://www.sky.it/landing-new/abbonarsi/provasky') { + var adfIframe = document.createElement('iframe'); + adfIframe.src = 'https://vf.r3f.technology/vf/sync/tags/394'; + adfIframe.style.display = 'none'; + document.body.appendChild(adfIframe); + } + ; + } + ; + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5f1aada6b8e05c306c0597d7'].vendorGrant == false) { + return; + } else { + var adfScript = document.createElement('script'); + adfScript.src = 'https://www.googletagmanager.com/gtag/js?id=AW-673603015'; + document.head.appendChild(adfScript); + window.dataLayer = window.dataLayer || []; + function gtag() { + dataLayer.push(arguments); + } + gtag('js', new Date()); + gtag('config', 'AW-673603015'); + } + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5f1aada6b8e05c306c0597d7'].vendorGrant == false) { + return; + } else { + var adfScript = document.createElement('script'); + adfScript.src = 'https://www.googletagmanager.com/gtag/js?id=AW-1048265226'; + document.head.appendChild(adfScript); + window.dataLayer = window.dataLayer || []; + function gtag() { + dataLayer.push(arguments); + } + gtag('js', new Date()); + gtag('config', 'AW-1048265226'); + if ('https://www.sky.it/' == 'https://www.sky.it/offerte') { + gtag('event', 'conversion', { + 'send_to': 'AW-1048265226/LGBTCOz-oPUBEIqE7fMD', + 'value': 1, + 'currency': 'EUR', + 'aw_remarketing_only': true + }); + } + ; + } + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5f1aada6b8e05c306c0597d7'].vendorGrant == false) { + return; + } else { + var adfScript = document.createElement('script'); + adfScript.src = 'https://www.googletagmanager.com/gtag/js?id=DC-3917886'; + document.head.appendChild(adfScript); + window.dataLayer = window.dataLayer || []; + function gtag() { + dataLayer.push(arguments); + } + gtag('js', new Date()); + gtag('config', 'DC-3917886'); + } + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5e7e1298b8e05c54a85c52d2'].vendorGrant == false) { + return; + } else { + !function (f, b, e, v, n, t, s) { + if (f.fbq) + return; + n = f.fbq = function () { + n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments); + }; + if (!f._fbq) + f._fbq = n; + n.push = n; + n.loaded = !0; + n.version = '2.0'; + n.queue = []; + t = b.createElement(e); + t.async = !0; + t.src = v; + s = b.getElementsByTagName(e)[0]; + s.parentNode.insertBefore(t, s); + }(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js'); + fbq('init', '769114966468130'); + fbq('track', 'PageView'); + } + ; + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5fca0529a22863819f134946'].vendorGrant == false) { + return; + } else { + (function () { + var nameTP = window.Adform.Tracking.TrackingPointName; + var valueID = ''; + if (nameTP == 'Sky_Corporate_Unique' && valueID !== '') { + return; + } + if (window.ADFORM_prevent_double_activation) { + return; + } + window.ADFORM_prevent_double_activation = true; + var awMastertag = document.createElement('script'); + awMastertag.setAttribute('defer', 'defer'); + awMastertag.src = 'https://www.dwin1.com/20730.js'; + awMastertag.style.display = 'none'; + document.getElementsByTagName('body')[0].appendChild(awMastertag); + }()); + } + }); + (function () { + if ('home' == 'landing-new' || 'home' == 'callmenow-new') { + adf.track(124076, 'Sky_Landing_Page'); + } + }()); + (function () { + if ('https://www.sky.it/' == 'https://www.sky.it/tv/skyq-new1') { + adf.track(124076, 'Test Performance - Visit Pre 2', { sv13: '' }); + } + }()); + (function () { + if ('https://www.sky.it/' == 'https://www.sky.it/tv/skyq-new2') { + adf.track(124076, 'Test Performance - Visit Post', { sv13: '' }); + } + }()); + function init() { + if ('https://www.sky.it/' == 'https://www.sky.it/tv/skyq-new3') { + adf.track(124076, 'Test Performance - Visit Post Defer', { sv13: '' }); + } + } + if (document.readyState != 'loading') { + init(); + } else { + document.addEventListener('DOMContentLoaded', init); + } + if ('https://www.sky.it/' == 'https://www.sky.it/') { + window._qevents = window._qevents || []; + try { + (function () { + const $___old_a26c977ec7df79e2 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_a26c977ec7df79e2) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_ca918043c745117e.localStorage)); + return function () { + var prefix = '', hash = 'zPcSoWwHHncJOHGcWdVm', rtbhTags = []; + rtbhTags.push('pr_' + hash + '_offer_C-https://www.sky.it/'); + var key = '__rtbhouse.lid', lid = window.localStorage.getItem(key); + if (!lid) { + lid = ''; + var pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + for (var i = 0; i < 20; i++) + lid += pool.charAt(Math.floor(Math.random() * pool.length)); + window.localStorage.setItem(key, lid); + } + rtbhTags.push('pr_' + hash + '_lid_' + lid); + var ifr = document.createElement('iframe'), sr = encodeURIComponent(document.referrer ? document.referrer : ''), su = encodeURIComponent(document.location.href ? document.location.href : ''), ifrsrc = 'https://' + prefix + 'creativecdn.com/tags?type=iframe', tmstmp = encodeURIComponent('' + Date.now()); + for (var i = 0; i < rtbhTags.length; i++) { + ifrsrc += '&id=' + encodeURIComponent(rtbhTags[i]); + } + ifrsrc += '&su=' + su + '&sr=' + sr + '&ts=' + tmstmp; + ifr.setAttribute('src', ifrsrc); + ifr.setAttribute('width', '1'); + ifr.setAttribute('height', '1'); + ifr.setAttribute('scrolling', 'no'); + ifr.setAttribute('frameBorder', '0'); + ifr.setAttribute('style', 'display:none'); + ifr.setAttribute('referrerpolicy', 'no-referrer-when-downgrade'); + if (document.body) { + document.body.appendChild(ifr); + } else { + window.addEventListener('DOMContentLoaded', function () { + document.body.appendChild(ifr); + }); + } + }.apply(this, arguments); + } finally { + if ($___old_a26c977ec7df79e2) + ({}.constructor.defineProperty(window, 'localStorage', $___old_a26c977ec7df79e2)); + } + }()); + } catch (e) { + } + } + if ('https://www.sky.it/' == 'landing-new' || 'callmenow-new') { + window._qevents = window._qevents || []; + try { + (function () { + const $___old_8b5b40db5f945b02 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_8b5b40db5f945b02) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_ca918043c745117e.localStorage)); + return function () { + var prefix = '', hash = 'zPcSoWwHHncJOHGcWdVm', rtbhTags = []; + rtbhTags.push('pr_' + hash + '_offer_C-https://www.sky.it/'); + var key = '__rtbhouse.lid', lid = window.localStorage.getItem(key); + if (!lid) { + lid = ''; + var pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + for (var i = 0; i < 20; i++) + lid += pool.charAt(Math.floor(Math.random() * pool.length)); + window.localStorage.setItem(key, lid); + } + rtbhTags.push('pr_' + hash + '_lid_' + lid); + var ifr = document.createElement('iframe'), sr = encodeURIComponent(document.referrer ? document.referrer : ''), su = encodeURIComponent(document.location.href ? document.location.href : ''), ifrsrc = 'https://' + prefix + 'creativecdn.com/tags?type=iframe', tmstmp = encodeURIComponent('' + Date.now()); + for (var i = 0; i < rtbhTags.length; i++) { + ifrsrc += '&id=' + encodeURIComponent(rtbhTags[i]); + } + ifrsrc += '&su=' + su + '&sr=' + sr + '&ts=' + tmstmp; + ifr.setAttribute('src', ifrsrc); + ifr.setAttribute('width', '1'); + ifr.setAttribute('height', '1'); + ifr.setAttribute('scrolling', 'no'); + ifr.setAttribute('frameBorder', '0'); + ifr.setAttribute('style', 'display:none'); + ifr.setAttribute('referrerpolicy', 'no-referrer-when-downgrade'); + if (document.body) { + document.body.appendChild(ifr); + } else { + window.addEventListener('DOMContentLoaded', function () { + document.body.appendChild(ifr); + }); + } + }.apply(this, arguments); + } finally { + if ($___old_8b5b40db5f945b02) + ({}.constructor.defineProperty(window, 'localStorage', $___old_8b5b40db5f945b02)); + } + }()); + } catch (e) { + } + } + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['619e53a3298f3306a3ea98e7'].vendorGrant == false) { + return; + } else { + var adfScript = document.createElement('script'); + adfScript.src = '//event.getblue.io/js/blue-tag.min.js'; + document.head.appendChild(adfScript); + window.blue_q = window.blue_q || []; + window.blue_q.push({ + event: 'setCampaignId', + value: '00000-000000-00000000' + }, { + event: 'setPageType', + value: 'visit' + }); + } + }); + if ('https://www.sky.it/' == 'https://www.sky.it/acquista/index.html' || 'https://www.sky.it/' == 'https://www.sky.it/come-vedere/index.html ' || 'https://www.sky.it/' == 'https://www.sky.it/come-vedere/skyq-fibra.html' || 'https://www.sky.it/' == 'https://www.sky.it/content/newaol/promozioni/crosspage_restyling.html' || 'https://www.sky.it/' == 'https://www.sky.it/offerte' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-calcio' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-calcio/satellite' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-cinema' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-cinema/satellite' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-digitale-terrestre' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-intrattenimento-plus' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-sport' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-sport/satellite' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-sport-cinema' || 'https://www.sky.it/' == 'https://www.sky.it/pacchetti-offerte/index.html' || 'https://www.sky.it/' == 'https://www.sky.it/pacchetti-offerte/intrattenimento-plus/nuovi-clienti.html' || 'https://www.sky.it/' == 'https://www.sky.it/pacchetti-offerte/sky-cinema.html' || 'https://www.sky.it/' == 'https://www.sky.it/pacchetti-offerte/sky-tv.html ' || 'https://www.sky.it/' == 'https://www.sky.it/pacchetti-offerte/sky-tv/serie-tv.html ' || 'https://www.sky.it/' == 'https://www.sky.it/tv' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-calcio' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-cinema' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-famiglia' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-sport' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/configuratore-abbonamento-sky' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-tv' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-tv' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-tv/serie-tv' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-tv/serie-tv/speravo-de-mori-prima' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/prova-skyq' || 'https://www.sky.it/' == 'https://www.sky.it/tv/skyq' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-sport/europei-2020' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-tv/serie-tv/anna' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-intrattenimento-plus-calcio' || 'https://www.sky.it/' == 'https://www.sky.it/tv/intrattenimento-plus' || 'https://www.sky.it/' == 'https://abbonamento.sky.it/newaol/crosspage' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/abbonamento-intrattenimento-plus-calcio' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-tv/serie-tv/gomorra' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-tv-intrattenimento' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-cinema-famiglia' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-tv/masterchef' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-tv/serie-tv/a-casa-tutti-bene-la-serie' || 'https://www.sky.it/' == 'https://www.sky.it/offerte/fatti-un-regalo-con-sky' || 'https://www.sky.it/' == 'https://www.sky.it/tv/sky-cinema-famiglia') { + window._qevents = window._qevents || []; + (function () { + var elem = document.createElement('script'); + elem.src = (document.location.protocol == 'https:' ? 'https://secure' : 'http://edge') + '.quantserve.com/quant.js'; + elem.async = true; + elem.type = 'text/javascript'; + var scpt = document.getElementsByTagName('script')[0]; + scpt.parentNode.insertBefore(elem, scpt); + }()); + _qevents.push({ + qacct: 'p-BZSYSpSSPmj6q', + labels: '_fp.event.Organic visitatori', + event: 'refresh' + }); + } + if (window.Adform.Tracking.Vars.Order) { + if (window.Adform.Tracking.Vars.Order.sv1) { + if (window.Adform.Tracking.Vars.Order.sv1.search('1') != -1) { + var adfimage = new Image(); + adfimage.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980045'; + document.getElementsByTagName('body')[0].appendChild(adfimage); + } + } + if (window.Adform.Tracking.Vars.Order.sv2) { + if (window.Adform.Tracking.Vars.Order.sv2.search('1') != -1) { + var adfimage1 = new Image(); + adfimage1.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980046'; + document.getElementsByTagName('body')[0].appendChild(adfimage1); + } + } + if (window.Adform.Tracking.Vars.Order.sv3) { + if (window.Adform.Tracking.Vars.Order.sv3.search('1') != -1) { + var adfimage2 = new Image(); + adfimage2.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980047'; + document.getElementsByTagName('body')[0].appendChild(adfimage2); + } + } + if (window.Adform.Tracking.Vars.Order.sv4) { + if (window.Adform.Tracking.Vars.Order.sv4.search('1') != -1) { + var adfimage3 = new Image(); + adfimage3.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980048'; + document.getElementsByTagName('body')[0].appendChild(adfimage3); + } + } + if (window.Adform.Tracking.Vars.Order.sv5) { + if (window.Adform.Tracking.Vars.Order.sv5.search('1') != -1) { + var adfimage4 = new Image(); + adfimage4.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980049'; + document.getElementsByTagName('body')[0].appendChild(adfimage4); + } + } + if (window.Adform.Tracking.Vars.Order.sv6) { + if (window.Adform.Tracking.Vars.Order.sv6.search('1') != -1) { + var adfimage5 = new Image(); + adfimage5.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980050'; + document.getElementsByTagName('body')[0].appendChild(adfimage5); + } + } + if (window.Adform.Tracking.Vars.Order.sv7) { + if (window.Adform.Tracking.Vars.Order.sv7.search('1') != -1) { + var adfimage6 = new Image(); + adfimage6.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980051'; + document.getElementsByTagName('body')[0].appendChild(adfimage6); + } + } + if (window.Adform.Tracking.Vars.Order.sv8) { + if (window.Adform.Tracking.Vars.Order.sv8.search('1') != -1) { + var adfimage7 = new Image(); + adfimage7.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980052'; + document.getElementsByTagName('body')[0].appendChild(adfimage7); + } + } + if (window.Adform.Tracking.Vars.Order.sv9) { + if (window.Adform.Tracking.Vars.Order.sv9.search('1') != -1) { + var adfimage8 = new Image(); + adfimage8.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980053'; + document.getElementsByTagName('body')[0].appendChild(adfimage8); + } + } + if (window.Adform.Tracking.Vars.Order.sv10) { + if (window.Adform.Tracking.Vars.Order.sv10.search('1') != -1) { + var adfimage9 = new Image(); + adfimage9.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980054'; + document.getElementsByTagName('body')[0].appendChild(adfimage9); + } + } + if (window.Adform.Tracking.Vars.Order.sv11) { + if (window.Adform.Tracking.Vars.Order.sv11.search('1') != -1) { + var adfimage10 = new Image(); + adfimage10.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980055'; + document.getElementsByTagName('body')[0].appendChild(adfimage10); + } + } + if (window.Adform.Tracking.Vars.Order.sv12) { + if (window.Adform.Tracking.Vars.Order.sv12.search('1') != -1) { + var adfimage11 = new Image(); + adfimage11.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=3980056'; + document.getElementsByTagName('body')[0].appendChild(adfimage11); + } + } + if (window.Adform.Tracking.Vars.Order.sv14) { + if (window.Adform.Tracking.Vars.Order.sv14.search('1') != -1) { + var adfimage12 = new Image(); + adfimage12.src = 'https://track.adform.net/Serving/TrackPoint/?pm=124076&lid=4295007'; + document.getElementsByTagName('body')[0].appendChild(adfimage12); + } + } + } + adf.Container(124076, 11004533); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5f1aada6b8e05c306c0597d7'].vendorGrant == false) { + return; + } else { + var google_conversion_id = 1012307471; + var google_conversion_label = 'U87LCNC3p3wQj6za4gM'; + var google_custom_params = window.google_tag_params; + var google_remarketing_only = true; + var adfScript = document.createElement('script'); + adfScript.src = '//www.googleadservices.com/pagead/conversion.js'; + document.head.appendChild(adfScript); + } + }); + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5f1aada6b8e05c306c0597d7'].vendorGrant == false) { + return; + } else { + var google_conversion_id = 1048265226; + var google_conversion_label = '2G9nCMHHy34QioTt8wM'; + var google_custom_params = window.google_tag_params; + var google_remarketing_only = true; + var adfScript = document.createElement('script'); + adfScript.src = '//www.googleadservices.com/pagead/conversion.js'; + document.head.appendChild(adfScript); + } + }); + var _qevents = _qevents || []; + (function () { + var elem = document.createElement('script'); + elem.src = (document.location.protocol == 'https:' ? 'https://secure' : 'http://edge') + '.quantserve.com/quant.js'; + elem.async = true; + elem.type = 'text/javascript'; + var scpt = document.getElementsByTagName('script')[0]; + scpt.parentNode.insertBefore(elem, scpt); + }()); + _qevents.push({ + qacct: 'p-BZSYSpSSPmj6q', + labels: '_fp.event.Purchase Cart Confirmation ,_fp.pcat.INSERT+PRODUCT+CATEGORY,_fp.customer.INSERT+CUSTOMER+TYPE', + orderid: 'INSERT+ORDER+ID', + event: 'refresh' + }); + (function () { + var segmentNames = [ + 'ALL_1', + 'ATTRIBUTO_17_0', + 'ATTRIBUTO_17_1', + 'ATTRIBUTO_18_0', + 'BB_CLIENTI_COVERAGE_MANUALE_DSP', + 'ATTRIBUTO_18_1', + 'ATTRIBUTO_19_0', + 'ATTRIBUTO_19_1', + 'ATTRIBUTO_21_0', + 'ATTRIBUTO_21_1', + 'HD_READY_DSP', + 'Anzianita_oltre 1', + 'Anzianita_entro 1', + 'Anzianita_oltre 3', + 'BB_CLIENTI_COVERAGE_ALL_MIN1', + 'BB_CLIENTI_COVERAGE_ALL_MAG1', + 'BB_CLIENTI_COVERAGE_ALL_MAG3', + 'BB_CLIENTI_COVERAGE_ALL_MAG6', + 'BB_CLIENTI_COVERAGE_ALL_MAG10', + 'Anzianita_oltre 6', + 'Anzianita_oltre 10', + 'BB_CLIENTI_RTG_LP_14GG', + 'BB_CLIENTI_COVERAGE_LUGLIO_PT_1_3', + 'BB_CLIENTI_COVERAGE_LUGLIO_PT_2_3', + 'BB_CLIENTI_COVERAGE_OF_VULA_AB_TEST_TECH_ALL', + 'BB_CLIENTI_COVERAGE_OF_VULA_ALL', + 'BB_CLIENTI_COVERAGE_LUGLIO_PT_3_3', + 'BB_CLIENTI_COVERAGE_LUGLIO_PT_4_3', + 'BB_CLIENTI_COVERAGE_VULA_ALL', + 'HD_NO_DSP', + 'EXTRA_SI_DISDETTA_MEDIOALTA', + 'EXTRA_SI_CLIENTI_MAG1_DISDETTA_MEDIOALTA', + 'EXTRA_NO_CLIENTI_MAG1_DISDETTA_MEDIOALTA', + 'EXTRA_NO_CLIENTI_MAG1', + 'BB_CLIENTI_COVERAGE_ALL', + 'SKYQ_N_DSP', + 'SP_Y_DSP', + 'CA_Y_DSP', + 'DCSS_READY_DSP', + 'BB_CLIENTI_COVERAGE_LUGLIO_PT_1_3_SKYQ_N', + 'BB_CLIENTI_COVERAGE_LUGLIO_PT_2_3_SKYQ_N', + 'BB_CLIENTI_COVERAGE_LUGLIO_PT_3_3_SKYQ_N', + 'BB_CLIENTI_COVERAGE_LUGLIO_PT_4_3_SKYQ_N', + 'BB_CLIENTI_COVERAGE_ALL_SKYQ_N', + 'BB_CLIENTI_COVERAGE_MANUALE_DSP_SKYQ_N', + 'BB_CLIENTI_COVERAGE_LUGLIO_PT_5_3', + 'BB_CLIENTI_COVERAGE_LUGLIO_PT_5_3_MAG10', + 'BB_CLIENTI_COVERAGE_LUGLIO_PT_5_3_MIN10', + 'BB_CLIENTI_COVERAGE_VULA_MAG_50_ALL', + 'DIGITAL_BB_PREV_SPORT_2021_03_25', + 'RTG_LP_Extra_Primissime_21GG', + 'DIGITAL_BB_PREV_SPORT_2021-03-25', + 'CI_N_DSP', + 'BB_CLIENTI_COVERAGE_LUGLIO' + ]; + var segmentRegex = new RegExp(segmentNames.join('|'), 'g'); + (function () { + var adfScript = document.createElement('script'); + adfScript.src = '//dmp.adform.net/audiencetag/adformat.js'; + adfScript.onload = retrieve_segments; + document.head.appendChild(adfScript); + }()); + function retrieve_segments() { + window.AdformAT = window.AdformAT || function (q, fn) { + fn = function () { + q.push([].slice.call(arguments)); + return fn; + }; + fn.q = q; + return fn; + }([]); + var token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJBZGZvcm0uRE1QLkNsYWltczo6RGF0YVByb3ZpZGVycyI6IlsxMDE5MF0iLCJpc3MiOiJkbXAtYXBpLmFkZm9ybS5jb20iLCJhdWQiOiJhdWRpZW5jZV90YWdfY29uc3VtZXJfdjEiLCJleHAiOjE4OTg2OTE5NDMsIm5iZiI6MTU4MzMzMTg4M30.MiwW_ePOlv5vLYBvXKwSeolT1gsaH5ry4oYUTwP1Bwc'; + AdformAT('init', token); + AdformAT('cookieSegments', function (status, response) { + var segmentResponse = JSON.stringify(response); + if (segmentResponse.match('ALL_1')) { + dmpAllGoogleAdsPixel(); + } + if (segmentResponse.match(segmentRegex)) { + fbBasePixel('769114966468130'); + for (var i = 0; i < segmentNames.length; i++) { + if (segmentResponse.indexOf(segmentNames[i]) > -1) { + fbq('track', 'Sky_Clienti_DMP_' + segmentNames[i]); + } + } + } + ; + }); + } + ; + function fbBasePixel(fbid) { + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5e7e1298b8e05c54a85c52d2'].vendorGrant == false) { + return; + } else { + !function (f, b, e, v, n, t, s) { + if (f.fbq) + return; + n = f.fbq = function () { + n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments); + }; + if (!f._fbq) + f._fbq = n; + n.push = n; + n.loaded = !0; + n.version = '2.0'; + n.queue = []; + t = b.createElement(e); + t.async = !0; + t.src = v; + s = b.getElementsByTagName(e)[0]; + s.parentNode.insertBefore(t, s); + }(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js'); + fbq('init', fbid); + fbq('track', 'PageView'); + } + }); + } + ; + function dmpAllGoogleAdsPixel() { + __tcfapi('getCustomVendorConsents', 2, function (vendorConsents, success) { + if (vendorConsents.grants['5f1aada6b8e05c306c0597d7'].vendorGrant == false) { + return; + } else { + var adfScript = document.createElement('script'); + adfScript.src = 'https://www.googletagmanager.com/gtag/js?id=AW-1020504674'; + document.head.appendChild(adfScript); + window.dataLayer = window.dataLayer || []; + function gtag() { + dataLayer.push(arguments); + } + gtag('js', new Date()); + gtag('config', 'AW-1020504674'); + gtag('event', 'conversion', { 'send_to': 'AW-1020504674/zFwSCLjvsNUBEOLUzuYD' }); + } + }); + } + }()); + } catch (e) { + } + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-7ef6938db3b17aa422131955b7760870bc69ac0c b/resources/sugarcoat-7ef6938db3b17aa422131955b7760870bc69ac0c new file mode 100644 index 00000000..86109f82 --- /dev/null +++ b/resources/sugarcoat-7ef6938db3b17aa422131955b7760870bc69ac0c @@ -0,0 +1,14915 @@ +{ + const $___mock_1cf1e90738546d40 = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_1cf1e90738546d40); + const $___mock_b46b3bb46442fc90 = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_b46b3bb46442fc90); + (function () { + !function (e) { + var t = window.pbjsChunk; + window.pbjsChunk = function (n, o, a) { + for (var c, u, s, d = 0, f = []; d < n.length; d++) + u = n[d], r[u] && f.push(r[u][0]), r[u] = 0; + for (c in o) + Object.prototype.hasOwnProperty.call(o, c) && (e[c] = o[c]); + for (t && t(n, o, a); f.length;) + f.shift()(); + if (a) + for (d = 0; d < a.length; d++) + s = i(i.s = a[d]); + return s; + }; + var n = {}, r = { 392: 0 }; + function i(t) { + if (n[t]) + return n[t].exports; + var r = n[t] = { + i: t, + l: !1, + exports: {} + }; + return e[t].call(r.exports, r, r.exports, i), r.l = !0, r.exports; + } + i.m = e, i.c = n, i.d = function (e, t, n) { + i.o(e, t) || Object.defineProperty(e, t, { + configurable: !1, + enumerable: !0, + get: n + }); + }, i.n = function (e) { + var t = e && e.__esModule ? function () { + return e.default; + } : function () { + return e; + }; + return i.d(t, 'a', t), t; + }, i.o = function (e, t) { + return Object.prototype.hasOwnProperty.call(e, t); + }, i.p = '', i.oe = function (e) { + throw console.error(e), e; + }, i(i.s = 974); + }({ + 0: function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }), n.d(t, 'internal', function () { + return C; + }), t.getPrebidInternal = function () { + return R; + }, n.d(t, 'bind', function () { + return B; + }), t.getUniqueIdentifierStr = D, t.generateUUID = function e(t) { + return t ? (t ^ (window && window.crypto && window.crypto.getRandomValues ? crypto.getRandomValues(new Uint8Array(1))[0] % 16 : 16 * Math.random()) >> t / 4).toString(16) : ([10000000] + -1000 + -4000 + -8000 + -100000000000).replace(/[018]/g, e); + }, t.getBidIdParameter = function (e, t) { + if (t && t[e]) + return t[e]; + return ''; + }, t.tryAppendQueryString = function (e, t, n) { + if (n) + return e + t + '=' + encodeURIComponent(n) + '&'; + return e; + }, t.parseQueryStringParameters = function (e) { + var t = ''; + for (var n in e) + e.hasOwnProperty(n) && (t += n + '=' + encodeURIComponent(e[n]) + '&'); + return t = t.replace(/&$/, ''); + }, t.transformAdServerTargetingObj = function (e) { + return e && Object.getOwnPropertyNames(e).length > 0 ? se(e).map(function (t) { + return ''.concat(t, '=').concat(encodeURIComponent(de(e, t))); + }).join('&') : ''; + }, t.getAdUnitSizes = function (e) { + if (!e) + return; + var t = []; + if (e.mediaTypes && e.mediaTypes.banner && Array.isArray(e.mediaTypes.banner.sizes)) { + var n = e.mediaTypes.banner.sizes; + Array.isArray(n[0]) ? t = n : t.push(n); + } else + Array.isArray(e.sizes) && (Array.isArray(e.sizes[0]) ? t = e.sizes : t.push(e.sizes)); + return t; + }, t.parseSizesInput = function (e) { + var t = []; + if ('string' == typeof e) { + var n = e.split(','), r = /^(\d)+x(\d)+$/i; + if (n) + for (var i in n) + ee(n, i) && n[i].match(r) && t.push(n[i]); + } else if ('object' === m(e)) { + var o = e.length; + if (o > 0) + if (2 === o && 'number' == typeof e[0] && 'number' == typeof e[1]) + t.push(k(e)); + else + for (var a = 0; a < o; a++) + t.push(k(e[a])); + } + return t; + }, t.parseGPTSingleSizeArray = k, t.parseGPTSingleSizeArrayToRtbSize = function (e) { + if (N(e)) + return { + w: e[0], + h: e[1] + }; + }, t.getWindowTop = P, t.getWindowSelf = q, t.getWindowLocation = M, t.logMessage = G, t.logInfo = L, t.logWarn = W, t.logError = F, t.hasConsoleLogger = function () { + return E; + }, t.debugTurnedOn = V, t.createInvisibleIframe = function () { + var e = document.createElement('iframe'); + return e.id = D(), e.height = 0, e.width = 0, e.border = '0px', e.hspace = '0', e.vspace = '0', e.marginWidth = '0', e.marginHeight = '0', e.style.border = '0', e.scrolling = 'no', e.frameBorder = '0', e.src = 'about:blank', e.style.display = 'none', e; + }, t.getParameterByName = function (e) { + return je(M().search)[e] || ''; + }, t.isA = H, t.isFn = K, t.isStr = J, t.isArray = Y, t.isNumber = Q, t.isPlainObject = $, t.isBoolean = function (e) { + return H(e, 'Boolean'); + }, t.isEmpty = X, t.isEmptyStr = function (e) { + return J(e) && (!e || 0 === e.length); + }, t._each = Z, t.contains = function (e, t) { + if (X(e)) + return !1; + if (K(e.indexOf)) + return -1 !== e.indexOf(t); + var n = e.length; + for (; n--;) + if (e[n] === t) + return !0; + return !1; + }, t._map = function (e, t) { + if (X(e)) + return []; + if (K(e.map)) + return e.map(t); + var n = []; + return Z(e, function (r, i) { + n.push(t(r, i, e)); + }), n; + }, t.hasOwn = ee, t.insertElement = te, t.waitForElementToLoad = ne, t.triggerPixel = re, t.callBurl = function (e) { + var t = e.source, n = e.burl; + t === O.S2S.SRC && n && C.triggerPixel(n); + }, t.insertHtmlIntoIframe = function (e) { + if (!e) + return; + var t = document.createElement('iframe'); + t.id = D(), t.width = 0, t.height = 0, t.hspace = '0', t.vspace = '0', t.marginWidth = '0', t.marginHeight = '0', t.style.display = 'none', t.style.height = '0px', t.style.width = '0px', t.scrolling = 'no', t.frameBorder = '0', t.allowtransparency = 'true', C.insertElement(t, document, 'body'), t.contentWindow.document.open(), t.contentWindow.document.write(e), t.contentWindow.document.close(); + }, t.insertUserSyncIframe = ie, t.createTrackPixelHtml = function (e) { + if (!e) + return ''; + var t = encodeURI(e), n = '
'; + return n += '
'; + }, t.createTrackPixelIframeHtml = oe, t.getValueString = ae, t.uniques = ce, t.flatten = ue, t.getBidRequest = function (e, t) { + if (!e) + return; + var n; + return t.some(function (t) { + var r = u()(t.bids, function (t) { + return [ + 'bidId', + 'adId', + 'bid_id' + ].some(function (n) { + return t[n] === e; + }); + }); + return r && (n = r), r; + }), n; + }, t.getKeys = se, t.getValue = de, t.getKeyByValue = function (e, t) { + for (var n in e) + if (e.hasOwnProperty(n) && e[n] === t) + return n; + }, t.getBidderCodes = function () { + var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : pbjs.adUnits; + return e.map(function (e) { + return e.bids.map(function (e) { + return e.bidder; + }).reduce(ue, []); + }).reduce(ue).filter(ce); + }, t.isGptPubadsDefined = fe, t.isApnGetTagDefined = function () { + if (window.apntag && K(window.apntag.getTag)) + return !0; + }, n.d(t, 'getHighestCpm', function () { + return le; + }), n.d(t, 'getOldestHighestCpmBid', function () { + return pe; + }), n.d(t, 'getLatestHighestCpmBid', function () { + return ge; + }), t.shuffle = function (e) { + var t = e.length; + for (; t > 0;) { + var n = Math.floor(Math.random() * t); + t--; + var r = e[t]; + e[t] = e[n], e[n] = r; + } + return e; + }, t.adUnitsFilter = function (e, t) { + return d()(e, t && t.adUnitCode); + }, t.deepClone = ve, t.inIframe = function () { + try { + return C.getWindowSelf() !== C.getWindowTop(); + } catch (e) { + return !0; + } + }, t.isSafariBrowser = function () { + return /^((?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent); + }, t.replaceAuctionPrice = function (e, t) { + if (!e) + return; + return e.replace(/\$\{AUCTION_PRICE\}/g, t); + }, t.replaceClickThrough = function (e, t) { + if (!e || !t || 'string' != typeof t) + return; + return e.replace(/\${CLICKTHROUGH}/g, t); + }, t.timestamp = function () { + return new Date().getTime(); + }, t.getPerformanceNow = function () { + return window.performance && window.performance.now && window.performance.now() || 0; + }, t.hasDeviceAccess = function () { + return !1 !== r.b.getConfig('deviceAccess'); + }, t.checkCookieSupport = ye, t.delayExecution = function (e, t) { + if (t < 1) + throw new Error('numRequiredCalls must be a positive number. Got '.concat(t)); + var n = 0; + return function () { + ++n === t && e.apply(this, arguments); + }; + }, t.groupBy = function (e, t) { + return e.reduce(function (e, n) { + return (e[n[t]] = e[n[t]] || []).push(n), e; + }, {}); + }, t.getDefinedParams = function (e, t) { + return t.filter(function (t) { + return e[t]; + }).reduce(function (t, n) { + return h(t, y({}, n, e[n])); + }, {}); + }, t.isValidMediaTypes = function (e) { + var t = [ + 'banner', + 'native', + 'video' + ]; + if (!Object.keys(e).every(function (e) { + return d()(t, e); + })) + return !1; + if (e.video && e.video.context) + return d()([ + 'instream', + 'outstream', + 'adpod' + ], e.video.context); + return !0; + }, t.getBidderRequest = function (e, t, n) { + return u()(e, function (e) { + return e.bids.filter(function (e) { + return e.bidder === t && e.adUnitCode === n; + }).length > 0; + }) || { + start: null, + auctionId: null + }; + }, t.getUserConfiguredParams = function (e, t, n) { + return e.filter(function (e) { + return e.code === t; + }).map(function (e) { + return e.bids; + }).reduce(ue, []).filter(function (e) { + return e.bidder === n; + }).map(function (e) { + return e.params || {}; + }); + }, t.getOrigin = function () { + return window.location.origin ? window.location.origin : window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : ''); + }, t.getDNT = function () { + return '1' === navigator.doNotTrack || '1' === window.doNotTrack || '1' === navigator.msDoNotTrack || 'yes' === navigator.doNotTrack; + }, t.isAdUnitCodeMatchingSlot = function (e) { + return function (t) { + return he(e, t); + }; + }, t.isSlotMatchingAdUnitCode = me, t.getGptSlotInfoForAdUnitCode = function (e) { + var t; + fe() && (t = u()(window.googletag.pubads().getSlots(), me(e))); + if (t) + return { + gptSlot: t.getAdUnitPath(), + divId: t.getSlotElementId() + }; + return {}; + }, t.unsupportedBidderMessage = function (e, t) { + var n = Object.keys(e.mediaTypes || { banner: 'banner' }).join(', '); + return '\n '.concat(e.code, ' is a ').concat(n, ' ad unit\n containing bidders that don\'t support ').concat(n, ': ').concat(t, '.\n This bidder won\'t fetch demand.\n '); + }, t.isInteger = Oe, t.convertCamelToUnderscore = function (e) { + return e.replace(/(?:^|\.?)([A-Z])/g, function (e, t) { + return '_' + t.toLowerCase(); + }).replace(/^_/, ''); + }, t.cleanObj = function (e) { + return Object.keys(e).reduce(function (t, n) { + return void 0 !== e[n] && (t[n] = e[n]), t; + }, {}); + }, t.pick = function (e, t) { + if ('object' !== m(e)) + return {}; + return t.reduce(function (n, r, i) { + if ('function' == typeof r) + return n; + var o = r, a = r.match(/^(.+?)\sas\s(.+?)$/i); + a && (r = a[1], o = a[2]); + var c = e[r]; + return 'function' == typeof t[i + 1] && (c = t[i + 1](c, n)), void 0 !== c && (n[o] = c), n; + }, {}); + }, t.transformBidderParamKeywords = function (e) { + var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 'keywords', n = []; + return Z(e, function (e, r) { + if (Y(e)) { + var i = []; + Z(e, function (e) { + ((e = ae(t + '.' + r, e)) || '' === e) && i.push(e); + }), e = i; + } else { + if (!J(e = ae(t + '.' + r, e))) + return; + e = [e]; + } + n.push({ + key: r, + value: e + }); + }), n; + }, t.convertTypes = function (e, t) { + return Object.keys(e).forEach(function (n) { + var r, i; + t[n] && (K(e[n]) ? t[n] = e[n](t[n]) : t[n] = (r = e[n], i = t[n], 'string' === r ? i && i.toString() : 'number' === r ? Number(i) : i), isNaN(t[n]) && delete t.key); + }), t; + }, t.isArrayOfNums = function (e, t) { + return Y(e) && (!t || e.length === t) && e.every(function (e) { + return Oe(e); + }); + }, t.fill = function (e, t) { + for (var n = [], r = 0; r < t; r++) { + var i = $(e) ? ve(e) : e; + n.push(i); + } + return n; + }, t.chunk = function (e, t) { + for (var n = [], r = 0; r < Math.ceil(e.length / t); r++) { + var i = r * t, o = i + t; + n.push(e.slice(i, o)); + } + return n; + }, t.getMinValueFromArray = function (e) { + return Math.min.apply(Math, g(e)); + }, t.getMaxValueFromArray = function (e) { + return Math.max.apply(Math, g(e)); + }, t.compareOn = function (e) { + return function (t, n) { + return t[e] < n[e] ? 1 : t[e] > n[e] ? -1 : 0; + }; + }, t.parseQS = je, t.formatQS = Se, t.parseUrl = function (e, t) { + var n = document.createElement('a'); + t && 'noDecodeWholeURL' in t && t.noDecodeWholeURL ? n.href = e : n.href = decodeURIComponent(e); + var r = t && 'decodeSearchAsString' in t && t.decodeSearchAsString; + return { + href: n.href, + protocol: (n.protocol || '').replace(/:$/, ''), + hostname: n.hostname, + port: +n.port, + pathname: n.pathname.replace(/^(?!\/)/, '/'), + search: r ? n.search : C.parseQS(n.search || ''), + hash: (n.hash || '').replace(/^#/, ''), + host: n.host || window.location.host + }; + }, t.buildUrl = function (e) { + return (e.protocol || 'http') + '://' + (e.host || e.hostname + (e.port ? ':'.concat(e.port) : '')) + (e.pathname || '') + (e.search ? '?'.concat(C.formatQS(e.search || '')) : '') + (e.hash ? '#'.concat(e.hash) : ''); + }, t.deepEqual = Ee, t.mergeDeep = function e(t) { + for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++) + r[i - 1] = arguments[i]; + if (!r.length) + return t; + var o = r.shift(); + if ($(t) && $(o)) { + var a = function (n) { + $(o[n]) ? (t[n] || h(t, y({}, n, {})), e(t[n], o[n])) : Y(o[n]) && t[n] ? Y(t[n]) && o[n].forEach(function (e) { + for (var r = 1, i = 0; i < t[n].length; i++) + if (Ee(t[n][i], e)) { + r = 0; + break; + } + r && t[n].push(e); + }) : h(t, y({}, n, o[n])); + }; + for (var c in o) + a(c); + } + return e.apply(void 0, [t].concat(r)); + }, t.cyrb53Hash = function (e) { + for (var t, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, r = function (e, t) { + if (K(Math.imul)) + return Math.imul(e, t); + var n = (4194303 & e) * (t |= 0); + return 4290772992 & e && (n += (4290772992 & e) * t | 0), 0 | n; + }, i = 3735928559 ^ n, o = 1103547991 ^ n, a = 0; a < e.length; a++) + t = e.charCodeAt(a), i = r(i ^ t, 2654435761), o = r(o ^ t, 1597334677); + return i = r(i ^ i >>> 16, 2246822507) ^ r(o ^ o >>> 13, 3266489909), (4294967296 * (2097151 & (o = r(o ^ o >>> 16, 2246822507) ^ r(i ^ i >>> 13, 3266489909))) + (i >>> 0)).toString(); + }, t.isAllowZeroCpmBidsEnabled = function (e) { + var t = Object(i.a)().bidderSettings; + return t[e] && !0 === t[e].allowZeroCpmBids || t.standard && !0 === t.standard.allowZeroCpmBids; + }; + var r = n(3), i = n(14), o = n(167), a = n.n(o), c = n(11), u = n.n(c), s = n(12), d = n.n(s), f = n(168); + n.d(t, 'deepAccess', function () { + return f.a; + }); + var l = n(169); + function p(e, t) { + return function (e) { + if (Array.isArray(e)) + return e; + }(e) || function (e, t) { + var n = null == e ? null : 'undefined' != typeof Symbol && e[Symbol.iterator] || e['@@iterator']; + if (null == n) + return; + var r, i, o = [], a = !0, c = !1; + try { + for (n = n.call(e); !(a = (r = n.next()).done) && (o.push(r.value), !t || o.length !== t); a = !0); + } catch (e) { + c = !0, i = e; + } finally { + try { + a || null == n.return || n.return(); + } finally { + if (c) + throw i; + } + } + return o; + }(e, t) || b(e, t) || function () { + throw new TypeError('Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + }(); + } + function g(e) { + return function (e) { + if (Array.isArray(e)) + return v(e); + }(e) || function (e) { + if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) + return Array.from(e); + }(e) || b(e) || function () { + throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + }(); + } + function b(e, t) { + if (e) { + if ('string' == typeof e) + return v(e, t); + var n = Object.prototype.toString.call(e).slice(8, -1); + return 'Object' === n && e.constructor && (n = e.constructor.name), 'Map' === n || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? v(e, t) : void 0; + } + } + function v(e, t) { + (null == t || t > e.length) && (t = e.length); + for (var n = 0, r = new Array(t); n < t; n++) + r[n] = e[n]; + return r; + } + function y(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + function h() { + return (h = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }).apply(this, arguments); + } + function m(e) { + return (m = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + })(e); + } + n.d(t, 'deepSetValue', function () { + return l.a; + }); + var O = n(5), j = Object.prototype.toString, S = Boolean(window.console), E = Boolean(S && window.console.log), A = Boolean(S && window.console.info), T = Boolean(S && window.console.warn), I = Boolean(S && window.console.error), w = n(10), C = { + checkCookieSupport: ye, + createTrackPixelIframeHtml: oe, + getWindowSelf: q, + getWindowTop: P, + getWindowLocation: M, + insertUserSyncIframe: ie, + insertElement: te, + isFn: K, + triggerPixel: re, + logError: F, + logWarn: W, + logMessage: G, + logInfo: L, + parseQS: je, + formatQS: Se, + deepEqual: Ee + }, R = {}; + var _, U = {}, B = function (e, t) { + return t; + }.bind(null, 1, U)() === U ? Function.prototype.bind : function (e) { + var t = this, n = Array.prototype.slice.call(arguments, 1); + return function () { + return t.apply(e, n.concat(Array.prototype.slice.call(arguments))); + }; + }, x = (_ = 0, function () { + return ++_; + }); + function D() { + return x() + Math.random().toString(16).substr(2); + } + function k(e) { + if (N(e)) + return e[0] + 'x' + e[1]; + } + function N(e) { + return Y(e) && 2 === e.length && !isNaN(e[0]) && !isNaN(e[1]); + } + function P() { + return window.top; + } + function q() { + return window.self; + } + function M() { + return window.location; + } + function G() { + V() && E && console.log.apply(console, z(arguments, 'MESSAGE:')); + } + function L() { + V() && A && console.info.apply(console, z(arguments, 'INFO:')); + } + function W() { + V() && T && console.warn.apply(console, z(arguments, 'WARNING:')), w.emit(O.EVENTS.AUCTION_DEBUG, { + type: 'WARNING', + arguments: arguments + }); + } + function F() { + V() && I && console.error.apply(console, z(arguments, 'ERROR:')), w.emit(O.EVENTS.AUCTION_DEBUG, { + type: 'ERROR', + arguments: arguments + }); + } + function z(e, t) { + e = [].slice.call(e); + var n = r.b.getCurrentBidder(); + return t && e.unshift(t), n && e.unshift(i('#aaa')), e.unshift(i('#3b88c3')), e.unshift('%cPrebid' + (n ? '%c'.concat(n) : '')), e; + function i(e) { + return 'display: inline-block; color: #fff; background: '.concat(e, '; padding: 1px 4px; border-radius: 3px;'); + } + } + function V() { + return !!r.b.getConfig('debug'); + } + function H(e, t) { + return j.call(e) === '[object ' + t + ']'; + } + function K(e) { + return H(e, 'Function'); + } + function J(e) { + return H(e, 'String'); + } + function Y(e) { + return H(e, 'Array'); + } + function Q(e) { + return H(e, 'Number'); + } + function $(e) { + return H(e, 'Object'); + } + function X(e) { + if (!e) + return !0; + if (Y(e) || J(e)) + return !(e.length > 0); + for (var t in e) + if (hasOwnProperty.call(e, t)) + return !1; + return !0; + } + function Z(e, t) { + if (!X(e)) { + if (K(e.forEach)) + return e.forEach(t, this); + var n = 0, r = e.length; + if (r > 0) + for (; n < r; n++) + t(e[n], n, e); + else + for (n in e) + hasOwnProperty.call(e, n) && t.call(this, e[n], n); + } + } + function ee(e, t) { + return e.hasOwnProperty ? e.hasOwnProperty(t) : void 0 !== e[t] && e.constructor.prototype[t] !== e[t]; + } + function te(e, t, n, r) { + var i; + t = t || document, i = n ? t.getElementsByTagName(n) : t.getElementsByTagName('head'); + try { + if ((i = i.length ? i : t.getElementsByTagName('body')).length) { + i = i[0]; + var o = r ? null : i.firstChild; + return i.insertBefore(e, o); + } + } catch (e) { + } + } + function ne(e, t) { + var n = null; + return new Promise(function (r) { + var i = function t() { + e.removeEventListener('load', t), e.removeEventListener('error', t), null != n && window.clearTimeout(n), r(); + }; + e.addEventListener('load', i), e.addEventListener('error', i), null != t && (n = window.setTimeout(i, t)); + }); + } + function re(e, t, n) { + var r = new Image(); + t && C.isFn(t) && ne(r, n).then(t), r.src = e; + } + function ie(e, t, n) { + var r = C.createTrackPixelIframeHtml(e, !1, 'allow-scripts allow-same-origin'), i = document.createElement('div'); + i.innerHTML = r; + var o = i.firstChild; + t && C.isFn(t) && ne(o, n).then(t), C.insertElement(o, document, 'html', !0); + } + function oe(e) { + var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : ''; + return e ? (t && (e = encodeURI(e)), n && (n = 'sandbox="'.concat(n, '"')), '')) : ''; + } + function ae(e, t, n) { + return null == t ? n : J(t) ? t : Q(t) ? t.toString() : void C.logWarn('Unsuported type for param: ' + e + ' required type: String'); + } + function ce(e, t, n) { + return n.indexOf(e) === t; + } + function ue(e, t) { + return e.concat(t); + } + function se(e) { + return Object.keys(e); + } + function de(e, t) { + return e[t]; + } + function fe() { + if (window.googletag && K(window.googletag.pubads) && K(window.googletag.pubads().getSlots)) + return !0; + } + var le = be('timeToRespond', function (e, t) { + return e > t; + }), pe = be('responseTimestamp', function (e, t) { + return e > t; + }), ge = be('responseTimestamp', function (e, t) { + return e < t; + }); + function be(e, t) { + return function (n, r) { + return n.cpm === r.cpm ? t(n[e], r[e]) ? r : n : n.cpm < r.cpm ? r : n; + }; + } + function ve(e) { + return a()(e); + } + function ye() { + if (window.navigator.cookieEnabled || document.cookie.length) + return !0; + } + var he = function (e, t) { + return e.getAdUnitPath() === t || e.getSlotElementId() === t; + }; + function me(e) { + return function (t) { + return he(t, e); + }; + } + function Oe(e) { + return Number.isInteger ? Number.isInteger(e) : 'number' == typeof e && isFinite(e) && Math.floor(e) === e; + } + function je(e) { + return e ? e.replace(/^\?/, '').split('&').reduce(function (e, t) { + var n = p(t.split('='), 2), r = n[0], i = n[1]; + return /\[\]$/.test(r) ? (e[r = r.replace('[]', '')] = e[r] || [], e[r].push(i)) : e[r] = i || '', e; + }, {}) : {}; + } + function Se(e) { + return Object.keys(e).map(function (t) { + return Array.isArray(e[t]) ? e[t].map(function (e) { + return ''.concat(t, '[]=').concat(e); + }).join('&') : ''.concat(t, '=').concat(e[t]); + }).join('&'); + } + function Ee(e, t) { + if (e === t) + return !0; + if ('object' === m(e) && null !== e && 'object' === m(t) && null !== t) { + if (Object.keys(e).length !== Object.keys(t).length) + return !1; + for (var n in e) { + if (!t.hasOwnProperty(n)) + return !1; + if (!Ee(e[n], t[n])) + return !1; + } + return !0; + } + return !1; + } + }, + 1: function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }), n.d(t, 'storage', function () { + return T; + }), t.registerBidder = function (e) { + var t = Array.isArray(e.supportedMediaTypes) ? { supportedMediaTypes: e.supportedMediaTypes } : void 0; + function n(e) { + var n = w(e); + i.default.registerBidAdapter(n, e.code, t); + } + n(e), Array.isArray(e.aliases) && e.aliases.forEach(function (t) { + var r, o, a = t; + Object(y.isPlainObject)(t) && (a = t.code, r = t.gvlid, o = t.skipPbsAliasing), i.default.aliasRegistry[a] = e.code, n(A({}, e, { + code: a, + gvlid: r, + skipPbsAliasing: o + })); + }); + }, t.newBidder = w, n.d(t, 'registerSyncInner', function () { + return C; + }), t.preloadBidderMappingFile = R, t.getIabSubCategory = function (e, t) { + var n = i.default.getBidAdapter(e); + if (n.getSpec().getMappingFileInfo) { + var r = n.getSpec().getMappingFileInfo(), o = r.localStorageKey ? r.localStorageKey : n.getBidderCode(), a = T.getDataFromLocalStorage(o); + if (a) { + try { + a = JSON.parse(a); + } catch (t) { + Object(y.logError)('Failed to parse '.concat(e, ' mapping data stored in local storage')); + } + return a.mapping[t] ? a.mapping[t] : null; + } + } + }, t.isValid = _; + var r = n(82), i = n(8), o = n(3), a = n(43), c = n(60), u = n(39), s = n(20), d = n(5), f = n.n(d), l = n(10), p = n.n(l), g = n(12), b = n.n(g), v = n(4), y = n(0), h = n(2), m = n(9), O = n(7); + function j(e, t) { + return function (e) { + if (Array.isArray(e)) + return e; + }(e) || function (e, t) { + var n = null == e ? null : 'undefined' != typeof Symbol && e[Symbol.iterator] || e['@@iterator']; + if (null == n) + return; + var r, i, o = [], a = !0, c = !1; + try { + for (n = n.call(e); !(a = (r = n.next()).done) && (o.push(r.value), !t || o.length !== t); a = !0); + } catch (e) { + c = !0, i = e; + } finally { + try { + a || null == n.return || n.return(); + } finally { + if (c) + throw i; + } + } + return o; + }(e, t) || function (e, t) { + if (!e) + return; + if ('string' == typeof e) + return S(e, t); + var n = Object.prototype.toString.call(e).slice(8, -1); + 'Object' === n && e.constructor && (n = e.constructor.name); + if ('Map' === n || 'Set' === n) + return Array.from(e); + if ('Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) + return S(e, t); + }(e, t) || function () { + throw new TypeError('Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + }(); + } + function S(e, t) { + (null == t || t > e.length) && (t = e.length); + for (var n = 0, r = new Array(t); n < t; n++) + r[n] = e[n]; + return r; + } + function E(e) { + return (E = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + })(e); + } + function A() { + return (A = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }).apply(this, arguments); + } + var T = Object(O.a)('bidderFactory'), I = [ + 'requestId', + 'cpm', + 'ttl', + 'creativeId', + 'netRevenue', + 'currency' + ]; + function w(e) { + return A(new r.a(e.code), { + getSpec: function () { + return Object.freeze(e); + }, + registerSyncs: t, + callBids: function (r, c, u, s, d, l) { + if (Array.isArray(r.bids)) { + var g = {}, b = [], v = r.bids.filter(n); + if (0 !== v.length) { + var h = {}; + v.forEach(function (e) { + h[e.bidId] = e, e.adUnitCode || (e.adUnitCode = e.placementCode); + }); + var m = e.buildRequests(v, r); + if (m && 0 !== m.length) { + Array.isArray(m) || (m = [m]); + var O = Object(y.delayExecution)(l(j), m.length); + m.forEach(function (e) { + return p.a.emit(f.a.EVENTS.BEFORE_BIDDER_HTTP, r); + }), m.forEach(function (t) { + switch (t.method) { + case 'GET': + s(''.concat(t.url).concat(function (e) { + if (e) + return '?'.concat('object' === E(e) ? Object(y.parseQueryStringParameters)(e) : e); + return ''; + }(t.data)), { + success: l(n), + error: o + }, void 0, A({ + method: 'GET', + withCredentials: !0 + }, t.options)); + break; + case 'POST': + s(t.url, { + success: l(n), + error: o + }, 'string' == typeof t.data ? t.data : JSON.stringify(t.data), A({ + method: 'POST', + contentType: 'text/plain', + withCredentials: !0 + }, t.options)); + break; + default: + Object(y.logWarn)('Skipping invalid request from '.concat(e.code, '. Request type ').concat(t.type, ' must be GET or POST')), O(); + } + function n(n, i) { + d(e.code); + try { + n = JSON.parse(n); + } catch (e) { + } + var o; + n = { + body: n, + headers: { get: i.getResponseHeader.bind(i) } + }, b.push(n); + try { + o = e.interpretResponse(n, t); + } catch (t) { + return Object(y.logError)('Bidder '.concat(e.code, ' failed to interpret the server\'s response. Continuing without bids'), null, t), void O(); + } + function u(t) { + var n = h[t.requestId]; + if (n) { + t.originalCpm = t.cpm, t.originalCurrency = t.currency, t.meta = t.meta || A({}, t[n.bidder]); + var i = A(Object(a.a)(f.a.STATUS.GOOD, n), t); + !function (e, t) { + g[e] = !0, _(e, t, [r]) && c(e, t); + }(n.adUnitCode, i); + } else + Object(y.logWarn)('Bidder '.concat(e.code, ' made bid for unknown request ID: ').concat(t.requestId, '. Ignoring.')); + } + o && (Object(y.isArray)(o) ? o.forEach(u) : u(o)), O(o); + } + function o(t, n) { + d(e.code), i.default.callBidderError(e.code, n, r), p.a.emit(f.a.EVENTS.BIDDER_ERROR, { + error: n, + bidderRequest: r + }), Object(y.logError)('Server call for '.concat(e.code, ' failed: ').concat(t, ' ').concat(n.status, '. Continuing without bids.')), O(); + } + }); + } else + j(); + } else + j(); + } + function j() { + u(), o.b.runWithBidder(e.code, function () { + p.a.emit(f.a.EVENTS.BIDDER_DONE, r), t(b, r.gdprConsent, r.uspConsent); + }); + } + } + }); + function t(t, n, r) { + C(e, t, n, r); + } + function n(t) { + return !!e.isBidRequestValid(t) || (Object(y.logWarn)('Invalid bid sent to bidder '.concat(e.code, ': ').concat(JSON.stringify(t))), !1); + } + } + var C = Object(m.b)('async', function (e, t, n, r) { + var a = o.b.getConfig('userSync.aliasSyncEnabled'); + if (e.getUserSyncs && (a || !i.default.aliasRegistry[e.code])) { + var u = o.b.getConfig('userSync.filterSettings'), s = e.getUserSyncs({ + iframeEnabled: !(!u || !u.iframe && !u.all), + pixelEnabled: !(!u || !u.image && !u.all) + }, t, n, r); + s && (Array.isArray(s) || (s = [s]), s.forEach(function (t) { + c.a.registerSync(t.type, e.code, t.url); + })); + } + }, 'registerSyncs'); + function R(e, t) { + if (!o.b.getConfig('adpod.brandCategoryExclusion')) + return e.call(this, t); + t.filter(function (e) { + return Object(y.deepAccess)(e, 'mediaTypes.video.context') === h.a; + }).map(function (e) { + return e.bids.map(function (e) { + return e.bidder; + }); + }).reduce(y.flatten, []).filter(y.uniques).forEach(function (e) { + var t = i.default.getBidAdapter(e); + if (t.getSpec().getMappingFileInfo) { + var n = t.getSpec().getMappingFileInfo(), r = n.refreshInDays ? n.refreshInDays : 1, o = n.localStorageKey ? n.localStorageKey : t.getSpec().code, a = T.getDataFromLocalStorage(o); + try { + (!(a = a ? JSON.parse(a) : void 0) || Object(y.timestamp)() > a.lastUpdated + 24 * r * 60 * 60 * 1000) && Object(v.a)(n.url, { + success: function (t) { + try { + t = JSON.parse(t); + var n = { + lastUpdated: Object(y.timestamp)(), + mapping: t.mapping + }; + T.setDataInLocalStorage(o, JSON.stringify(n)); + } catch (t) { + Object(y.logError)('Failed to parse '.concat(e, ' bidder translation mapping file')); + } + }, + error: function () { + Object(y.logError)('Failed to load '.concat(e, ' bidder translation file')); + } + }); + } catch (t) { + Object(y.logError)('Failed to parse '.concat(e, ' bidder translation mapping file')); + } + } + }), e.call(this, t); + } + function _(e, t, n) { + function r(e) { + return 'Invalid bid from '.concat(t.bidderCode, '. Ignoring bid: ').concat(e); + } + return e ? t ? (i = Object.keys(t), I.every(function (e) { + return b()(i, e) && !b()([ + void 0, + null + ], t[e]); + }) ? 'native' !== t.mediaType || Object(u.g)(t, n) ? 'video' !== t.mediaType || Object(s.d)(t, n) ? !('banner' === t.mediaType && !function (e, t, n) { + if ((t.width || 0 === parseInt(t.width, 10)) && (t.height || 0 === parseInt(t.height, 10))) + return t.width = parseInt(t.width, 10), t.height = parseInt(t.height, 10), !0; + var r = Object(y.getBidderRequest)(n, t.bidderCode, e), i = r && r.bids && r.bids[0] && r.bids[0].sizes, o = Object(y.parseSizesInput)(i); + if (1 === o.length) { + var a = j(o[0].split('x'), 2), c = a[0], u = a[1]; + return t.width = parseInt(c, 10), t.height = parseInt(u, 10), !0; + } + return !1; + }(e, t, n)) || (Object(y.logError)(r('Banner bids require a width and height')), !1) : (Object(y.logError)(r('Video bid does not have required vastUrl or renderer property')), !1) : (Object(y.logError)(r('Native bid missing some required properties.')), !1) : (Object(y.logError)(r('Bidder '.concat(t.bidderCode, ' is missing required params. Check http://prebid.org/dev-docs/bidder-adapter-1.html for list of params.'))), !1)) : (Object(y.logWarn)('Some adapter tried to add an undefined bid for '.concat(e, '.')), !1) : (Object(y.logWarn)('No adUnitCode was supplied to addBidResponse.'), !1); + var i; + } + Object(m.a)('checkAdUnitSetup').before(R); + }, + 10: function (e, t, n) { + function r() { + return (r = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }).apply(this, arguments); + } + var i = n(0), o = n(5), a = Array.prototype.slice, c = Array.prototype.push, u = i._map(o.EVENTS, function (e) { + return e; + }), s = o.EVENT_ID_PATHS, d = []; + e.exports = function () { + var e = {}, t = {}; + function n(t, n) { + i.logMessage('Emitting event for: ' + t); + var r = n[0] || {}, o = r[s[t]], a = e[t] || { que: [] }, u = i._map(a, function (e, t) { + return t; + }), f = []; + d.push({ + eventType: t, + args: r, + id: o, + elapsedTime: i.getPerformanceNow() + }), o && i.contains(u, o) && c.apply(f, a[o].que), c.apply(f, a.que), i._each(f, function (e) { + if (e) + try { + e.apply(null, n); + } catch (e) { + i.logError('Error executing handler:', 'events.js', e); + } + }); + } + return t.on = function (t, n, r) { + if (function (e) { + return i.contains(u, e); + }(t)) { + var o = e[t] || { que: [] }; + r ? (o[r] = o[r] || { que: [] }, o[r].que.push(n)) : o.que.push(n), e[t] = o; + } else + i.logError('Wrong event name : ' + t + ' Valid event names :' + u); + }, t.emit = function (e) { + var t = a.call(arguments, 1); + n(e, t); + }, t.off = function (t, n, r) { + var o = e[t]; + i.isEmpty(o) || i.isEmpty(o.que) && i.isEmpty(o[r]) || r && (i.isEmpty(o[r]) || i.isEmpty(o[r].que)) || (r ? i._each(o[r].que, function (e) { + var t = o[r].que; + e === n && t.splice(t.indexOf(e), 1); + }) : i._each(o.que, function (e) { + var t = o.que; + e === n && t.splice(t.indexOf(e), 1); + }), e[t] = o); + }, t.get = function () { + return e; + }, t.getEvents = function () { + var e = []; + return i._each(d, function (t) { + var n = r({}, t); + e.push(n); + }), e; + }, t; + }(); + }, + 100: function (e, t, n) { + 'use strict'; + t.a = function (e, t) { + if (e.labelAll) + return { + labelAll: !0, + labels: e.labelAll, + activeLabels: t + }; + return { + labelAll: !1, + labels: e.labelAny, + activeLabels: t + }; + }, t.c = function (e) { + var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : u, n = s(t); + if (!n.shouldFilter) + return !0; + return !!n.sizesSupported[e]; + }, t.b = function () { + var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, t = e.labels, n = void 0 === t ? [] : t, r = e.labelAll, o = void 0 !== r && r, c = e.activeLabels, d = void 0 === c ? [] : c, f = arguments.length > 1 ? arguments[1] : void 0, l = arguments.length > 2 ? arguments[2] : void 0, p = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : u, g = s(p); + f = Object(i.isPlainObject)(f) ? Object(i.deepClone)(f) : l ? { banner: { sizes: l } } : {}; + var b = Object(i.deepAccess)(f, 'banner.sizes'); + g.shouldFilter && b && (f.banner.sizes = b.filter(function (e) { + return g.sizesSupported[e]; + })); + var v = Object.keys(f), y = { + active: v.every(function (e) { + return 'banner' !== e; + }) || v.some(function (e) { + return 'banner' === e; + }) && Object(i.deepAccess)(f, 'banner.sizes.length') > 0 && (0 === n.length || !o && (n.some(function (e) { + return g.labels[e]; + }) || n.some(function (e) { + return a()(d, e); + })) || o && n.reduce(function (e, t) { + return e ? g.labels[t] || a()(d, t) : e; + }, !0)), + mediaTypes: f + }; + b && b.length !== f.banner.sizes.length && (y.filterResults = { + before: b, + after: f.banner.sizes + }); + return y; + }; + var r = n(3), i = n(0), o = n(12), a = n.n(o); + function c(e) { + return (c = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + })(e); + } + var u = []; + function s(e) { + return e.reduce(function (e, t) { + if ('object' === c(t) && 'string' == typeof t.mediaQuery && t.mediaQuery.length > 0) { + var n = !1; + try { + n = Object(i.getWindowTop)().matchMedia(t.mediaQuery).matches; + } catch (e) { + Object(i.logWarn)('Unfriendly iFrame blocks sizeConfig from being correctly evaluated'), n = matchMedia(t.mediaQuery).matches; + } + n && (Array.isArray(t.sizesSupported) && (e.shouldFilter = !0), [ + 'labels', + 'sizesSupported' + ].forEach(function (n) { + return (t[n] || []).forEach(function (t) { + return e[n][t] = !0; + }); + })); + } else + Object(i.logWarn)('sizeConfig rule missing required property "mediaQuery"'); + return e; + }, { + labels: {}, + sizesSupported: {}, + shouldFilter: !1 + }); + } + r.b.getConfig('sizeConfig', function (e) { + return function (e) { + u = e; + }(e.sizeConfig); + }); + }, + 101: function (e, t, n) { + 'use strict'; + t.b = function (e, t, n) { + var o = { puts: e.map(a, n) }; + Object(r.a)(i.b.getConfig('cache.url'), function (e) { + return { + success: function (t) { + var n; + try { + n = JSON.parse(t).responses; + } catch (t) { + return void e(t, []); + } + n ? e(null, n) : e(new Error('The cache server didn\'t respond with a responses property.'), []); + }, + error: function (t, n) { + e(new Error('Error storing video ad in the cache: '.concat(t, ': ').concat(JSON.stringify(n))), []); + } + }; + }(t), JSON.stringify(o), { + contentType: 'text/plain', + withCredentials: !0 + }); + }, t.a = function (e) { + return ''.concat(i.b.getConfig('cache.url'), '?uuid=').concat(e); + }; + var r = n(4), i = n(3), o = n(0); + function a(e) { + var t, n, r, a = { + type: 'xml', + value: e.vastXml ? e.vastXml : (t = e.vastUrl, n = e.vastImpUrl, r = n ? '') : '', '\n \n \n prebid.org wrapper\n \n ').concat(r, '\n \n \n \n ')), + ttlseconds: Number(e.ttl) + }; + return i.b.getConfig('cache.vasttrack') && (a.bidder = e.bidder, a.bidid = e.requestId, a.aid = e.auctionId, Object(o.isPlainObject)(this) && this.hasOwnProperty('auctionStart') && (a.timestamp = this.auctionStart)), 'string' == typeof e.customCacheKey && '' !== e.customCacheKey && (a.key = e.customCacheKey), a; + } + }, + 105: function (e, t, n) { + n(106); + var r = n(55); + e.exports = r('Array', 'find'); + }, + 106: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(63).find, o = n(54), a = 'find', c = !0; + a in [] && Array(1).find(function () { + c = !1; + }), r({ + target: 'Array', + proto: !0, + forced: c + }, { + find: function (e) { + return i(this, e, arguments.length > 1 ? arguments[1] : void 0); + } + }), o(a); + }, + 107: function (e, t, n) { + var r = n(33), i = n(108), o = n(44), a = n(49), c = n(62), u = n(31), s = n(84), d = Object.getOwnPropertyDescriptor; + t.f = r ? d : function (e, t) { + if (e = a(e), t = c(t, !0), s) + try { + return d(e, t); + } catch (e) { + } + if (u(e, t)) + return o(!i.f.call(e, t), e[t]); + }; + }, + 108: function (e, t, n) { + 'use strict'; + var r = {}.propertyIsEnumerable, i = Object.getOwnPropertyDescriptor, o = i && !r.call({ 1: 2 }, 1); + t.f = o ? function (e) { + var t = i(this, e); + return !!t && t.enumerable; + } : r; + }, + 109: function (e, t, n) { + var r = n(29), i = /#|\.prototype\./, o = function (e, t) { + var n = c[a(e)]; + return n == s || n != u && ('function' == typeof t ? r(t) : !!t); + }, a = o.normalize = function (e) { + return String(e).replace(i, '.').toLowerCase(); + }, c = o.data = {}, u = o.NATIVE = 'N', s = o.POLYFILL = 'P'; + e.exports = o; + }, + 11: function (e, t, n) { + var r = n(105); + e.exports = r; + }, + 110: function (e, t, n) { + var r = n(30), i = n(111), o = n(23)('species'); + e.exports = function (e, t) { + var n; + return i(e) && ('function' != typeof (n = e.constructor) || n !== Array && !i(n.prototype) ? r(n) && null === (n = n[o]) && (n = void 0) : n = void 0), new (void 0 === n ? Array : n)(0 === t ? 0 : t); + }; + }, + 111: function (e, t, n) { + var r = n(50); + e.exports = Array.isArray || function (e) { + return 'Array' == r(e); + }; + }, + 112: function (e, t, n) { + var r = n(27), i = n(32); + e.exports = function (e, t) { + try { + i(r, e, t); + } catch (n) { + r[e] = t; + } + return t; + }; + }, + 113: function (e, t, n) { + var r, i, o = n(27), a = n(114), c = o.process, u = c && c.versions, s = u && u.v8; + s ? i = (r = s.split('.'))[0] < 4 ? 1 : r[0] + r[1] : a && (!(r = a.match(/Edge\/(\d+)/)) || r[1] >= 74) && (r = a.match(/Chrome\/(\d+)/)) && (i = r[1]), e.exports = i && +i; + }, + 114: function (e, t, n) { + var r = n(26); + e.exports = r('navigator', 'userAgent') || ''; + }, + 115: function (e, t, n) { + var r = n(87); + e.exports = r && !Symbol.sham && 'symbol' == typeof Symbol.iterator; + }, + 116: function (e, t, n) { + n(117); + var r = n(55); + e.exports = r('Array', 'includes'); + }, + 117: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(88).includes, o = n(54); + r({ + target: 'Array', + proto: !0 + }, { + includes: function (e) { + return i(this, e, arguments.length > 1 ? arguments[1] : void 0); + } + }), o('includes'); + }, + 118: function (e, t, n) { + var r = n(64), i = Math.max, o = Math.min; + e.exports = function (e, t) { + var n = r(e); + return n < 0 ? i(n + t, 0) : o(n, t); + }; + }, + 119: function (e, t, n) { + n(120), n(135), n(98), n(137); + var r = n(45); + e.exports = r.Set; + }, + 12: function (e, t, n) { + var r = n(116); + e.exports = r; + }, + 120: function (e, t, n) { + 'use strict'; + var r = n(121), i = n(126); + e.exports = r('Set', function (e) { + return function () { + return e(this, arguments.length ? arguments[0] : void 0); + }; + }, i); + }, + 121: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(27), o = n(90), a = n(29), c = n(32), u = n(21), s = n(68), d = n(30), f = n(59), l = n(34).f, p = n(63).forEach, g = n(33), b = n(46), v = b.set, y = b.getterFor; + e.exports = function (e, t, n) { + var b, h = -1 !== e.indexOf('Map'), m = -1 !== e.indexOf('Weak'), O = h ? 'set' : 'add', j = i[e], S = j && j.prototype, E = {}; + if (g && 'function' == typeof j && (m || S.forEach && !a(function () { + new j().entries().next(); + }))) { + b = t(function (t, n) { + v(s(t, b, e), { + type: e, + collection: new j() + }), null != n && u(n, t[O], { + that: t, + AS_ENTRIES: h + }); + }); + var A = y(e); + p([ + 'add', + 'clear', + 'delete', + 'forEach', + 'get', + 'has', + 'set', + 'keys', + 'values', + 'entries' + ], function (e) { + var t = 'add' == e || 'set' == e; + !(e in S) || m && 'clear' == e || c(b.prototype, e, function (n, r) { + var i = A(this).collection; + if (!t && m && !d(n)) + return 'get' == e && void 0; + var o = i[e](0 === n ? 0 : n, r); + return t ? this : o; + }); + }), m || l(b.prototype, 'size', { + configurable: !0, + get: function () { + return A(this).collection.size; + } + }); + } else + b = n.getConstructor(t, e, h, O), o.REQUIRED = !0; + return f(b, e, !1, !0), E[e] = b, r({ + global: !0, + forced: !0 + }, E), m || n.setStrong(b, e, h), b; + }; + }, + 122: function (e, t, n) { + var r = n(29); + e.exports = !r(function () { + return Object.isExtensible(Object.preventExtensions({})); + }); + }, + 123: function (e, t, n) { + 'use strict'; + var r = n(67), i = n(58); + e.exports = r ? {}.toString : function () { + return '[object ' + i(this) + ']'; + }; + }, + 124: function (e, t, n) { + var r = n(27), i = n(125), o = r.WeakMap; + e.exports = 'function' == typeof o && /native code/.test(i(o)); + }, + 125: function (e, t, n) { + var r = n(65), i = Function.toString; + 'function' != typeof r.inspectSource && (r.inspectSource = function (e) { + return i.call(e); + }), e.exports = r.inspectSource; + }, + 126: function (e, t, n) { + 'use strict'; + var r = n(34).f, i = n(70), o = n(94), a = n(25), c = n(68), u = n(21), s = n(72), d = n(134), f = n(33), l = n(90).fastKey, p = n(46), g = p.set, b = p.getterFor; + e.exports = { + getConstructor: function (e, t, n, s) { + var d = e(function (e, r) { + c(e, d, t), g(e, { + type: t, + index: i(null), + first: void 0, + last: void 0, + size: 0 + }), f || (e.size = 0), null != r && u(r, e[s], { + that: e, + AS_ENTRIES: n + }); + }), p = b(t), v = function (e, t, n) { + var r, i, o = p(e), a = y(e, t); + return a ? a.value = n : (o.last = a = { + index: i = l(t, !0), + key: t, + value: n, + previous: r = o.last, + next: void 0, + removed: !1 + }, o.first || (o.first = a), r && (r.next = a), f ? o.size++ : e.size++, 'F' !== i && (o.index[i] = a)), e; + }, y = function (e, t) { + var n, r = p(e), i = l(t); + if ('F' !== i) + return r.index[i]; + for (n = r.first; n; n = n.next) + if (n.key == t) + return n; + }; + return o(d.prototype, { + clear: function () { + for (var e = p(this), t = e.index, n = e.first; n;) + n.removed = !0, n.previous && (n.previous = n.previous.next = void 0), delete t[n.index], n = n.next; + e.first = e.last = void 0, f ? e.size = 0 : this.size = 0; + }, + delete: function (e) { + var t = this, n = p(t), r = y(t, e); + if (r) { + var i = r.next, o = r.previous; + delete n.index[r.index], r.removed = !0, o && (o.next = i), i && (i.previous = o), n.first == r && (n.first = i), n.last == r && (n.last = o), f ? n.size-- : t.size--; + } + return !!r; + }, + forEach: function (e) { + for (var t, n = p(this), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); t = t ? t.next : n.first;) + for (r(t.value, t.key, this); t && t.removed;) + t = t.previous; + }, + has: function (e) { + return !!y(this, e); + } + }), o(d.prototype, n ? { + get: function (e) { + var t = y(this, e); + return t && t.value; + }, + set: function (e, t) { + return v(this, 0 === e ? 0 : e, t); + } + } : { + add: function (e) { + return v(this, e = 0 === e ? 0 : e, e); + } + }), f && r(d.prototype, 'size', { + get: function () { + return p(this).size; + } + }), d; + }, + setStrong: function (e, t, n) { + var r = t + ' Iterator', i = b(t), o = b(r); + s(e, t, function (e, t) { + g(this, { + type: r, + target: e, + state: i(e), + kind: t, + last: void 0 + }); + }, function () { + for (var e = o(this), t = e.kind, n = e.last; n && n.removed;) + n = n.previous; + return e.target && (e.last = n = n ? n.next : e.state.first) ? 'keys' == t ? { + value: n.key, + done: !1 + } : 'values' == t ? { + value: n.value, + done: !1 + } : { + value: [ + n.key, + n.value + ], + done: !1 + } : (e.target = void 0, { + value: void 0, + done: !0 + }); + }, n ? 'entries' : 'values', !n, !0), d(t); + } + }; + }, + 127: function (e, t, n) { + var r = n(33), i = n(34), o = n(17), a = n(128); + e.exports = r ? Object.defineProperties : function (e, t) { + o(e); + for (var n, r = a(t), c = r.length, u = 0; c > u;) + i.f(e, n = r[u++], t[n]); + return e; + }; + }, + 128: function (e, t, n) { + var r = n(129), i = n(93); + e.exports = Object.keys || function (e) { + return r(e, i); + }; + }, + 129: function (e, t, n) { + var r = n(31), i = n(49), o = n(88).indexOf, a = n(56); + e.exports = function (e, t) { + var n, c = i(e), u = 0, s = []; + for (n in c) + !r(a, n) && r(c, n) && s.push(n); + for (; t.length > u;) + r(c, n = t[u++]) && (~o(s, n) || s.push(n)); + return s; + }; + }, + 13: function (e, t, n) { + 'use strict'; + t.a = u, t.c = function (e) { + return !(!e || !e.url); + }, t.b = function (e, t) { + e.render(t); + }; + var r = n(35), i = n(0), o = n(11), a = n.n(o), c = 'outstream'; + function u(e) { + var t = this, n = e.url, o = e.config, a = e.id, u = e.callback, d = e.loaded, f = e.adUnitCode; + this.url = n, this.config = o, this.handlers = {}, this.id = a, this.loaded = d, this.cmd = [], this.push = function (e) { + 'function' == typeof e ? t.loaded ? e.call() : t.cmd.push(e) : Object(i.logError)('Commands given to Renderer.push must be wrapped in a function'); + }, this.callback = u || function () { + t.loaded = !0, t.process(); + }, this.render = function () { + var e = this, t = arguments, o = function () { + e._render ? e._render.apply(e, t) : Object(i.logWarn)('No render function was provided, please use .setRender on the renderer'); + }; + s(f) ? (Object(i.logWarn)('External Js not loaded by Renderer since renderer url and callback is already defined on adUnit '.concat(f)), o()) : (this.cmd.unshift(o), Object(r.a)(n, c, this.callback)); + }.bind(this); + } + function s(e) { + var t = pbjs.adUnits, n = a()(t, function (t) { + return t.code === e; + }); + if (!n) + return !1; + var r = Object(i.deepAccess)(n, 'renderer'), o = !!(r && r.url && r.render), c = Object(i.deepAccess)(n, 'mediaTypes.video.renderer'), u = !!(c && c.url && c.render); + return !!(o && !0 !== r.backupOnly || u && !0 !== c.backupOnly); + } + u.install = function (e) { + return new u({ + url: e.url, + config: e.config, + id: e.id, + callback: e.callback, + loaded: e.loaded, + adUnitCode: e.adUnitCode + }); + }, u.prototype.getConfig = function () { + return this.config; + }, u.prototype.setRender = function (e) { + this._render = e; + }, u.prototype.setEventHandlers = function (e) { + this.handlers = e; + }, u.prototype.handleVideoEvent = function (e) { + var t = e.id, n = e.eventName; + 'function' == typeof this.handlers[n] && this.handlers[n](), Object(i.logMessage)('Prebid Renderer event for id '.concat(t, ' type ').concat(n)); + }, u.prototype.process = function () { + for (; this.cmd.length > 0;) + try { + this.cmd.shift().call(); + } catch (e) { + Object(i.logError)('Error processing Renderer command: ', e); + } + }; + }, + 130: function (e, t, n) { + var r = n(26); + e.exports = r('document', 'documentElement'); + }, + 131: function (e, t, n) { + var r = n(29); + e.exports = !r(function () { + function e() { + } + return e.prototype.constructor = null, Object.getPrototypeOf(new e()) !== e.prototype; + }); + }, + 132: function (e, t, n) { + var r = n(17), i = n(133); + e.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { + var e, t = !1, n = {}; + try { + (e = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set).call(n, []), t = n instanceof Array; + } catch (e) { + } + return function (n, o) { + return r(n), i(o), t ? e.call(n, o) : n.__proto__ = o, n; + }; + }() : void 0); + }, + 133: function (e, t, n) { + var r = n(30); + e.exports = function (e) { + if (!r(e) && null !== e) + throw TypeError('Can\'t set ' + String(e) + ' as a prototype'); + return e; + }; + }, + 134: function (e, t, n) { + 'use strict'; + var r = n(26), i = n(34), o = n(23), a = n(33), c = o('species'); + e.exports = function (e) { + var t = r(e), n = i.f; + a && t && !t[c] && n(t, c, { + configurable: !0, + get: function () { + return this; + } + }); + }; + }, + 135: function (e, t) { + }, + 136: function (e, t, n) { + var r = n(64), i = n(51), o = function (e) { + return function (t, n) { + var o, a, c = String(i(t)), u = r(n), s = c.length; + return u < 0 || u >= s ? e ? '' : void 0 : (o = c.charCodeAt(u)) < 55296 || o > 56319 || u + 1 === s || (a = c.charCodeAt(u + 1)) < 56320 || a > 57343 ? e ? c.charAt(u) : o : e ? c.slice(u, u + 2) : a - 56320 + (o - 55296 << 10) + 65536; + }; + }; + e.exports = { + codeAt: o(!1), + charAt: o(!0) + }; + }, + 137: function (e, t, n) { + n(99); + var r = n(138), i = n(27), o = n(58), a = n(32), c = n(41), u = n(23)('toStringTag'); + for (var s in r) { + var d = i[s], f = d && d.prototype; + f && o(f) !== u && a(f, u, s), c[s] = c.Array; + } + }, + 138: function (e, t) { + e.exports = { + CSSRuleList: 0, + CSSStyleDeclaration: 0, + CSSValueList: 0, + ClientRectList: 0, + DOMRectList: 0, + DOMStringList: 0, + DOMTokenList: 1, + DataTransferItemList: 0, + FileList: 0, + HTMLAllCollection: 0, + HTMLCollection: 0, + HTMLFormElement: 0, + HTMLSelectElement: 0, + MediaList: 0, + MimeTypeArray: 0, + NamedNodeMap: 0, + NodeList: 1, + PaintRequestList: 0, + Plugin: 0, + PluginArray: 0, + SVGLengthList: 0, + SVGNumberList: 0, + SVGPathSegList: 0, + SVGPointList: 0, + SVGStringList: 0, + SVGTransformList: 0, + SourceBufferList: 0, + StyleSheetList: 0, + TextTrackCueList: 0, + TextTrackList: 0, + TouchList: 0 + }; + }, + 139: function (e, t, n) { + n(16)({ + target: 'Set', + stat: !0 + }, { from: n(140) }); + }, + 14: function (e, t, n) { + 'use strict'; + t.a = function () { + return window.pbjs; + }, window.pbjs = window.pbjs || {}, window.pbjs.cmd = window.pbjs.cmd || [], window.pbjs.que = window.pbjs.que || [], window._pbjsGlobals = window._pbjsGlobals || [], window._pbjsGlobals.push('pbjs'); + }, + 140: function (e, t, n) { + 'use strict'; + var r = n(24), i = n(25), o = n(21); + e.exports = function (e) { + var t, n, a, c, u = arguments.length, s = u > 1 ? arguments[1] : void 0; + return r(this), (t = void 0 !== s) && r(s), null == e ? new this() : (n = [], t ? (a = 0, c = i(s, u > 2 ? arguments[2] : void 0, 2), o(e, function (e) { + n.push(c(e, a++)); + })) : o(e, n.push, { that: n }), new this(n)); + }; + }, + 141: function (e, t, n) { + n(16)({ + target: 'Set', + stat: !0 + }, { of: n(142) }); + }, + 142: function (e, t, n) { + 'use strict'; + e.exports = function () { + for (var e = arguments.length, t = new Array(e); e--;) + t[e] = arguments[e]; + return new this(t); + }; + }, + 143: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(144); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + addAll: function () { + return o.apply(this, arguments); + } + }); + }, + 144: function (e, t, n) { + 'use strict'; + var r = n(17), i = n(24); + e.exports = function () { + for (var e = r(this), t = i(e.add), n = 0, o = arguments.length; n < o; n++) + t.call(e, arguments[n]); + return e; + }; + }, + 145: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(146); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + deleteAll: function () { + return o.apply(this, arguments); + } + }); + }, + 146: function (e, t, n) { + 'use strict'; + var r = n(17), i = n(24); + e.exports = function () { + for (var e, t = r(this), n = i(t.delete), o = !0, a = 0, c = arguments.length; a < c; a++) + e = n.call(t, arguments[a]), o = o && e; + return !!o; + }; + }, + 147: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(17), a = n(25), c = n(38), u = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + every: function (e) { + var t = o(this), n = c(t), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return !u(n, function (e, n) { + if (!r(e, e, t)) + return n(); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + 148: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(26), a = n(17), c = n(24), u = n(42), s = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + difference: function (e) { + var t = a(this), n = new (u(t, o('Set')))(t), r = c(n.delete); + return s(e, function (e) { + r.call(n, e); + }), n; + } + }); + }, + 149: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(26), a = n(17), c = n(24), u = n(25), s = n(42), d = n(38), f = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + filter: function (e) { + var t = a(this), n = d(t), r = u(e, arguments.length > 1 ? arguments[1] : void 0, 3), i = new (s(t, o('Set')))(), l = c(i.add); + return f(n, function (e) { + r(e, e, t) && l.call(i, e); + }, { IS_ITERATOR: !0 }), i; + } + }); + }, + 150: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(17), a = n(25), c = n(38), u = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + find: function (e) { + var t = o(this), n = c(t), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return u(n, function (e, n) { + if (r(e, e, t)) + return n(e); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).result; + } + }); + }, + 151: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(26), a = n(17), c = n(24), u = n(42), s = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + intersection: function (e) { + var t = a(this), n = new (u(t, o('Set')))(), r = c(t.has), i = c(n.add); + return s(e, function (e) { + r.call(t, e) && i.call(n, e); + }), n; + } + }); + }, + 152: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(17), a = n(24), c = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + isDisjointFrom: function (e) { + var t = o(this), n = a(t.has); + return !c(e, function (e, r) { + if (!0 === n.call(t, e)) + return r(); + }, { INTERRUPTED: !0 }).stopped; + } + }); + }, + 153: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(26), a = n(17), c = n(24), u = n(73), s = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + isSubsetOf: function (e) { + var t = u(this), n = a(e), r = n.has; + return 'function' != typeof r && (n = new (o('Set'))(e), r = c(n.has)), !s(t, function (e, t) { + if (!1 === r.call(n, e)) + return t(); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + 154: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(17), a = n(24), c = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + isSupersetOf: function (e) { + var t = o(this), n = a(t.has); + return !c(e, function (e, r) { + if (!1 === n.call(t, e)) + return r(); + }, { INTERRUPTED: !0 }).stopped; + } + }); + }, + 155: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(17), a = n(38), c = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + join: function (e) { + var t = o(this), n = a(t), r = void 0 === e ? ',' : String(e), i = []; + return c(n, i.push, { + that: i, + IS_ITERATOR: !0 + }), i.join(r); + } + }); + }, + 156: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(26), a = n(17), c = n(24), u = n(25), s = n(42), d = n(38), f = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + map: function (e) { + var t = a(this), n = d(t), r = u(e, arguments.length > 1 ? arguments[1] : void 0, 3), i = new (s(t, o('Set')))(), l = c(i.add); + return f(n, function (e) { + l.call(i, r(e, e, t)); + }, { IS_ITERATOR: !0 }), i; + } + }); + }, + 157: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(17), a = n(24), c = n(38), u = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + reduce: function (e) { + var t = o(this), n = c(t), r = arguments.length < 2, i = r ? void 0 : arguments[1]; + if (a(e), u(n, function (n) { + r ? (r = !1, i = n) : i = e(i, n, n, t); + }, { IS_ITERATOR: !0 }), r) + throw TypeError('Reduce of empty set with no initial value'); + return i; + } + }); + }, + 158: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(17), a = n(25), c = n(38), u = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + some: function (e) { + var t = o(this), n = c(t), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return u(n, function (e, n) { + if (r(e, e, t)) + return n(); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + 159: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(26), a = n(17), c = n(24), u = n(42), s = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + symmetricDifference: function (e) { + var t = a(this), n = new (u(t, o('Set')))(t), r = c(n.delete), i = c(n.add); + return s(e, function (e) { + r.call(n, e) || i.call(n, e); + }), n; + } + }); + }, + 16: function (e, t, n) { + 'use strict'; + var r = n(27), i = n(107).f, o = n(109), a = n(45), c = n(25), u = n(32), s = n(31), d = function (e) { + var t = function (t, n, r) { + if (this instanceof e) { + switch (arguments.length) { + case 0: + return new e(); + case 1: + return new e(t); + case 2: + return new e(t, n); + } + return new e(t, n, r); + } + return e.apply(this, arguments); + }; + return t.prototype = e.prototype, t; + }; + e.exports = function (e, t) { + var n, f, l, p, g, b, v, y, h = e.target, m = e.global, O = e.stat, j = e.proto, S = m ? r : O ? r[h] : (r[h] || {}).prototype, E = m ? a : a[h] || (a[h] = {}), A = E.prototype; + for (l in t) + n = !o(m ? l : h + (O ? '.' : '#') + l, e.forced) && S && s(S, l), g = E[l], n && (b = e.noTargetGet ? (y = i(S, l)) && y.value : S[l]), p = n && b ? b : t[l], n && typeof g == typeof p || (v = e.bind && n ? c(p, r) : e.wrap && n ? d(p) : j && 'function' == typeof p ? c(Function.call, p) : p, (e.sham || p && p.sham || g && g.sham) && u(v, 'sham', !0), E[l] = v, j && (s(a, f = h + 'Prototype') || u(a, f, {}), a[f][l] = p, e.real && A && !A[l] && u(A, l, p))); + }; + }, + 160: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(18), o = n(26), a = n(17), c = n(24), u = n(42), s = n(21); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: i + }, { + union: function (e) { + var t = a(this), n = new (u(t, o('Set')))(t); + return s(e, c(n.add), { that: n }), n; + } + }); + }, + 161: function (e, t, n) { + n(98), n(162); + var r = n(45); + e.exports = r.Array.from; + }, + 162: function (e, t, n) { + var r = n(16), i = n(163); + r({ + target: 'Array', + stat: !0, + forced: !n(166)(function (e) { + Array.from(e); + }) + }, { from: i }); + }, + 163: function (e, t, n) { + 'use strict'; + var r = n(25), i = n(52), o = n(164), a = n(91), c = n(53), u = n(165), s = n(57); + e.exports = function (e) { + var t, n, d, f, l, p, g = i(e), b = 'function' == typeof this ? this : Array, v = arguments.length, y = v > 1 ? arguments[1] : void 0, h = void 0 !== y, m = s(g), O = 0; + if (h && (y = r(y, v > 2 ? arguments[2] : void 0, 2)), null == m || b == Array && a(m)) + for (n = new b(t = c(g.length)); t > O; O++) + p = h ? y(g[O], O) : g[O], u(n, O, p); + else + for (l = (f = m.call(g)).next, n = new b(); !(d = l.call(f)).done; O++) + p = h ? o(f, y, [ + d.value, + O + ], !0) : d.value, u(n, O, p); + return n.length = O, n; + }; + }, + 164: function (e, t, n) { + var r = n(17), i = n(92); + e.exports = function (e, t, n, o) { + try { + return o ? t(r(n)[0], n[1]) : t(n); + } catch (t) { + throw i(e), t; + } + }; + }, + 165: function (e, t, n) { + 'use strict'; + var r = n(62), i = n(34), o = n(44); + e.exports = function (e, t, n) { + var a = r(t); + a in e ? i.f(e, a, o(0, n)) : e[a] = n; + }; + }, + 166: function (e, t, n) { + var r = n(23)('iterator'), i = !1; + try { + var o = 0, a = { + next: function () { + return { done: !!o++ }; + }, + return: function () { + i = !0; + } + }; + a[r] = function () { + return this; + }, Array.from(a, function () { + throw 2; + }); + } catch (e) { + } + e.exports = function (e, t) { + if (!t && !i) + return !1; + var n = !1; + try { + var o = {}; + o[r] = function () { + return { + next: function () { + return { done: n = !0 }; + } + }; + }, e(o); + } catch (e) { + } + return n; + }; + }, + 167: function (e, t) { + e.exports = function e(t) { + var n = Array.isArray(t) ? [] : {}; + for (var r in t) { + var i = t[r]; + n[r] = i && 'object' == typeof i ? e(i) : i; + } + return n; + }; + }, + 168: function (e, t, n) { + 'use strict'; + t.a = function (e, t, n, r, i) { + for (t = t.split ? t.split('.') : t, r = 0; r < t.length; r++) + e = e ? e[t[r]] : i; + return e === i ? n : e; + }; + }, + 169: function (e, t, n) { + 'use strict'; + t.a = function (e, t, n) { + t.split && (t = t.split('.')); + for (var r, i = 0, o = t.length, a = e; i < o; ++i) + r = a[t[i]], a = a[t[i]] = i === o - 1 ? n : null != r ? r : !~t[i + 1].indexOf('.') && +t[i + 1] > -1 ? [] : {}; + }; + }, + 17: function (e, t, n) { + var r = n(30); + e.exports = function (e) { + if (!r(e)) + throw TypeError(String(e) + ' is not an object'); + return e; + }; + }, + 170: function (e, t) { + c.SYNC = 1, c.ASYNC = 2, c.QUEUE = 4; + var n = Object.freeze({ + useProxy: !0, + ready: 0 + }), r = new WeakMap(), i = '2,1,0' === [1].reduce(function (e, t, n) { + return [ + e, + t, + n + ]; + }, 2).toString() ? Array.prototype.reduce : function (e, t) { + var n, r = Object(this), i = r.length >>> 0, o = 0; + if (t) + n = t; + else { + for (; o < i && !(o in r);) + o++; + n = r[o++]; + } + for (; o < i;) + o in r && (n = e(n, r[o], o, r)), o++; + return n; + }; + function o(e, t) { + return Array.prototype.slice.call(e, t); + } + var a = Object.assign || function (e) { + return i.call(o(arguments, 1), function (e, t) { + return t && Object.keys(t).forEach(function (n) { + e[n] = t[n]; + }), e; + }, e); + }; + function c(e) { + var t, u = {}, s = []; + function d(e, t) { + return 'function' == typeof e ? g.call(null, 'sync', e, t) : 'string' == typeof e && 'function' == typeof t ? g.apply(null, arguments) : 'object' == typeof e ? f.apply(null, arguments) : void 0; + } + function f(e, t, n) { + var r = !0; + void 0 === t && (t = Object.getOwnPropertyNames(e), r = !1); + var i = {}, o = ['constructor']; + do { + (t = t.filter(function (t) { + return !('function' != typeof e[t] || -1 !== o.indexOf(t) || t.match(/^_/)); + })).forEach(function (t) { + var r = t.split(':'), o = r[0], a = r[1] || 'sync'; + if (!i[o]) { + var c = e[o]; + i[o] = e[o] = g(a, c, n ? [ + n, + o + ] : void 0); + } + }), e = Object.getPrototypeOf(e); + } while (r && e); + return i; + } + function l(e) { + var n = Array.isArray(e) ? e : e.split('.'); + return i.call(n, function (r, i, o) { + var a = r[i], c = !1; + return a || (o === n.length - 1 ? (t || s.push(function () { + c || console.warn('fun-hooks: referenced \'' + e + '\' but it was never created'); + }), r[i] = p(function (e) { + r[i] = e, c = !0; + })) : r[i] = {}); + }, u); + } + function p(e) { + var t = [], n = [], i = function () { + }, o = { + before: function (e, n) { + return u.call(this, t, 'before', e, n); + }, + after: function (e, t) { + return u.call(this, n, 'after', e, t); + }, + getHooks: function (e) { + var r = t.concat(n); + 'object' == typeof e && (r = r.filter(function (t) { + return Object.keys(e).every(function (n) { + return t[n] === e[n]; + }); + })); + try { + a(r, { + remove: function () { + return r.forEach(function (e) { + e.remove(); + }), this; + } + }); + } catch (e) { + console.error('error adding `remove` to array, did you modify Array.prototype?'); + } + return r; + }, + removeAll: function () { + return this.getHooks().remove(); + } + }, c = { + install: function (r, o, a) { + this.type = r, i = a, a(t, n), e && e(o); + } + }; + return r.set(o.after, c), o; + function u(e, r, o, a) { + var c = { + hook: o, + type: r, + priority: a || 10, + remove: function () { + var r = e.indexOf(c); + -1 !== r && (e.splice(r, 1), i(t, n)); + } + }; + return e.push(c), e.sort(function (e, t) { + return t.priority - e.priority; + }), i(t, n), this; + } + } + function g(n, i, u) { + var d = i.after && r.get(i.after); + if (d) { + if (d.type !== n) + throw 'fun-hooks: recreated hookable with different type'; + return i; + } + var f, g, b = u ? l(u) : p(), v = { + get: function (e, t) { + return b[t] || Reflect.get.apply(Reflect, arguments); + } + }; + return t || s.push(y), e.useProxy && 'function' == typeof Proxy && Proxy.revocable ? g = new Proxy(i, v) : a(g = function () { + return v.apply ? v.apply(i, this, o(arguments)) : i.apply(this, arguments); + }, b), r.get(g.after).install(n, g, function (e, t) { + var r, i = []; + e.length || t.length ? (e.forEach(a), r = i.push(void 0) - 1, t.forEach(a), f = function (e, t, a) { + var c, u = 0, s = 'async' === n && 'function' == typeof a[a.length - 1] && a.pop(); + function d(e) { + 'sync' === n ? c = e : s && s.apply(null, arguments); + } + function f(e) { + if (i[u]) { + var r = o(arguments); + return f.bail = d, r.unshift(f), i[u++].apply(t, r); + } + 'sync' === n ? c = e : s && s.apply(null, arguments); + } + return i[r] = function () { + var r = o(arguments, 1); + 'async' === n && s && (delete f.bail, r.push(f)); + var i = e.apply(t, r); + 'sync' === n && f(i); + }, f.apply(null, a), c; + }) : f = void 0; + function a(e) { + i.push(e.hook); + } + y(); + }), g; + function y() { + !t && ('sync' !== n || e.ready & c.SYNC) && ('async' !== n || e.ready & c.ASYNC) ? 'sync' !== n && e.ready & c.QUEUE ? v.apply = function () { + var e = arguments; + s.push(function () { + g.apply(e[1], e[2]); + }); + } : v.apply = function () { + throw 'fun-hooks: hooked function not ready'; + } : v.apply = f; + } + } + return (e = a({}, n, e)).ready ? d.ready = function () { + t = !0, function (e) { + for (var t; t = e.shift();) + t(); + }(s); + } : t = !0, d.get = l, d; + } + e.exports = c; + }, + 18: function (e, t) { + e.exports = !0; + }, + 19: function (e, t, n) { + 'use strict'; + n.d(t, 'a', function () { + return o; + }); + var r = n(3), i = n(0); + var o = function (e) { + function t(e) { + var t = r.b.getConfig('pageUrl'); + if (t) + return t; + try { + var n = e.querySelector('link[rel=\'canonical\']'); + if (null !== n) + return n.href; + } catch (e) { + } + return null; + } + return function () { + var n, o, a, c = [], u = function (e) { + try { + if (!e.location.ancestorOrigins) + return; + return e.location.ancestorOrigins; + } catch (e) { + } + }(e), s = r.b.getConfig('maxNestedIframes'), d = !1, f = 0, l = !1, p = !1; + do { + var g = n, b = p, v = void 0, y = !1, h = null; + p = !1, n = n ? n.parent : e; + try { + v = n.location.href || null; + } catch (e) { + y = !0; + } + if (y) + if (b) { + var m = g.context; + try { + o = h = m.sourceUrl, l = !0, n === e.top && (d = !0), m.canonicalUrl && (a = m.canonicalUrl); + } catch (e) { + } + } else { + Object(i.logWarn)('Trying to access cross domain iframe. Continuing without referrer and location'); + try { + var O = g.document.referrer; + O && (h = O, n === e.top && (d = !0)); + } catch (e) { + } + !h && u && u[f - 1] && (h = u[f - 1]), h && !l && (o = h); + } + else { + if (v && (o = h = v, l = !1, n === e.top)) { + d = !0; + var j = t(n.document); + j && (a = j); + } + n.context && n.context.sourceUrl && (p = !0); + } + c.push(h), f++; + } while (n !== e.top && f < s); + return c.reverse(), { + referer: o || null, + reachedTop: d, + isAmp: l, + numIframes: f - 1, + stack: c, + canonicalUrl: a || null + }; + }; + }(window); + }, + 2: function (e, t, n) { + 'use strict'; + n.d(t, 'c', function () { + return r; + }), n.d(t, 'd', function () { + return i; + }), n.d(t, 'b', function () { + return o; + }), n.d(t, 'a', function () { + return a; + }); + var r = 'native', i = 'video', o = 'banner', a = 'adpod'; + }, + 20: function (e, t, n) { + 'use strict'; + n.d(t, 'b', function () { + return c; + }), n.d(t, 'a', function () { + return u; + }), t.d = function (e, t) { + var n = Object(r.getBidRequest)(e.requestId, t), i = n && Object(r.deepAccess)(n, 'mediaTypes.video'), o = i && Object(r.deepAccess)(i, 'context'); + return s(e, n, i, o); + }, n.d(t, 'c', function () { + return s; + }); + n(8); + var r = n(0), i = n(3), o = n(12), a = (n.n(o), n(9)), c = 'outstream', u = 'instream'; + var s = Object(a.b)('sync', function (e, t, n, o) { + return !t || n && o !== c ? i.b.getConfig('cache.url') || !e.vastXml || e.vastUrl ? !(!e.vastUrl && !e.vastXml) : (Object(r.logError)('\n This bid contains only vastXml and will not work when a prebid cache url is not specified.\n Try enabling prebid cache with pbjs.setConfig({ cache: {url: "..."} });\n '), !1) : o !== c || !!(e.renderer || t.renderer || n.renderer); + }, 'checkVideoBidSetup'); + }, + 21: function (e, t, n) { + var r = n(17), i = n(91), o = n(53), a = n(25), c = n(57), u = n(92), s = function (e, t) { + this.stopped = e, this.result = t; + }; + e.exports = function (e, t, n) { + var d, f, l, p, g, b, v, y = n && n.that, h = !(!n || !n.AS_ENTRIES), m = !(!n || !n.IS_ITERATOR), O = !(!n || !n.INTERRUPTED), j = a(t, y, 1 + h + O), S = function (e) { + return d && u(d), new s(!0, e); + }, E = function (e) { + return h ? (r(e), O ? j(e[0], e[1], S) : j(e[0], e[1])) : O ? j(e, S) : j(e); + }; + if (m) + d = e; + else { + if ('function' != typeof (f = c(e))) + throw TypeError('Target is not iterable'); + if (i(f)) { + for (l = 0, p = o(e.length); p > l; l++) + if ((g = E(e[l])) && g instanceof s) + return g; + return new s(!1); + } + d = f.call(e); + } + for (b = d.next; !(v = b.call(d)).done;) { + try { + g = E(v.value); + } catch (e) { + throw u(d), e; + } + if ('object' == typeof g && g && g instanceof s) + return g; + } + return new s(!1); + }; + }, + 22: function (e, t, n) { + 'use strict'; + n.d(t, 'a', function () { + return u; + }); + var r = n(0), i = n(28), o = n(11), a = n.n(o), c = n(5); + var u = function () { + var e = [], t = {}; + return t.addWinningBid = function (t) { + var n = a()(e, function (e) { + return e.getAuctionId() === t.auctionId; + }); + n ? (t.status = c.BID_STATUS.RENDERED, n.addWinningBid(t)) : Object(r.logWarn)('Auction not found when adding winning bid'); + }, t.getAllWinningBids = function () { + return e.map(function (e) { + return e.getWinningBids(); + }).reduce(r.flatten, []); + }, t.getBidsRequested = function () { + return e.map(function (e) { + return e.getBidRequests(); + }).reduce(r.flatten, []); + }, t.getNoBids = function () { + return e.map(function (e) { + return e.getNoBids(); + }).reduce(r.flatten, []); + }, t.getBidsReceived = function () { + return e.map(function (e) { + if (e.getAuctionStatus() === i.a) + return e.getBidsReceived(); + }).reduce(r.flatten, []).filter(function (e) { + return e; + }); + }, t.getAllBidsForAdUnitCode = function (t) { + return e.map(function (e) { + return e.getBidsReceived(); + }).reduce(r.flatten, []).filter(function (e) { + return e && e.adUnitCode === t; + }); + }, t.getAdUnits = function () { + return e.map(function (e) { + return e.getAdUnits(); + }).reduce(r.flatten, []); + }, t.getAdUnitCodes = function () { + return e.map(function (e) { + return e.getAdUnitCodes(); + }).reduce(r.flatten, []).filter(r.uniques); + }, t.createAuction = function (t) { + var n = t.adUnits, r = t.adUnitCodes, o = t.callback, a = t.cbTimeout, c = t.labels, u = t.auctionId, s = Object(i.k)({ + adUnits: n, + adUnitCodes: r, + callback: o, + cbTimeout: a, + labels: c, + auctionId: u + }); + return function (t) { + e.push(t); + }(s), s; + }, t.findBidByAdId = function (t) { + return a()(e.map(function (e) { + return e.getBidsReceived(); + }).reduce(r.flatten, []), function (e) { + return e.adId === t; + }); + }, t.getStandardBidderAdServerTargeting = function () { + return Object(i.j)()[c.JSON_MAPPING.ADSERVER_TARGETING]; + }, t.setStatusForBids = function (n, r) { + var i = t.findBidByAdId(n); + if (i && (i.status = r), i && r === c.BID_STATUS.BID_TARGETING_SET) { + var o = a()(e, function (e) { + return e.getAuctionId() === i.auctionId; + }); + o && o.setBidTargeting(i); + } + }, t.getLastAuctionId = function () { + return e.length && e[e.length - 1].getAuctionId(); + }, t.clearAllAuctions = function () { + e.length = 0; + }, t; + }(); + }, + 220: function (e, t, n) { + n(221); + var r = n(55); + e.exports = r('Array', 'findIndex'); + }, + 221: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(63).findIndex, o = n(54), a = 'findIndex', c = !0; + a in [] && Array(1).findIndex(function () { + c = !1; + }), r({ + target: 'Array', + proto: !0, + forced: c + }, { + findIndex: function (e) { + return i(this, e, arguments.length > 1 ? arguments[1] : void 0); + } + }), o(a); + }, + 23: function (e, t, n) { + var r = n(27), i = n(86), o = n(31), a = n(66), c = n(87), u = n(115), s = i('wks'), d = r.Symbol, f = u ? d : d && d.withoutSetter || a; + e.exports = function (e) { + return o(s, e) && (c || 'string' == typeof s[e]) || (c && o(d, e) ? s[e] = d[e] : s[e] = f('Symbol.' + e)), s[e]; + }; + }, + 230: function (e, t, n) { + 'use strict'; + t.a = function () { + window.addEventListener('message', h, !1); + }; + var r = n(10), i = n.n(r), o = n(39), a = n(5), c = n.n(a), u = n(0), s = n(22), d = n(11), f = n.n(d), l = n(13), p = n(12), g = n.n(p), b = n(3), v = c.a.EVENTS.BID_WON, y = c.a.EVENTS.STALE_RENDER; + function h(e) { + var t = e.message ? 'message' : 'data', n = {}; + try { + n = JSON.parse(e[t]); + } catch (e) { + return; + } + if (n && n.adId) { + var r = f()(s.a.getBidsReceived(), function (e) { + return e.adId === n.adId; + }); + if (r && 'Prebid Request' === n.message) { + if (r.status === c.a.BID_STATUS.RENDERED && (Object(u.logWarn)('Ad id '.concat(r.adId, ' has been rendered before')), i.a.emit(y, r), Object(u.deepAccess)(b.b.getConfig('auctionOptions'), 'suppressStaleRender'))) + return; + !function (e, t) { + var n = e.adId, r = e.ad, i = e.adUrl, o = e.width, a = e.height, c = e.renderer, s = e.cpm; + Object(l.c)(c) ? Object(l.b)(c, e) : n && (m(e), t.source.postMessage(JSON.stringify({ + message: 'Prebid Response', + ad: Object(u.replaceAuctionPrice)(r, s), + adUrl: Object(u.replaceAuctionPrice)(i, s), + adId: n, + width: o, + height: a + }), t.origin)); + }(r, e), s.a.addWinningBid(r), i.a.emit(v, r); + } + if (r && 'Prebid Native' === n.message) + if ('assetRequest' === n.action) { + var a = Object(o.d)(n, r); + e.source.postMessage(JSON.stringify(a), e.origin); + } else if ('allAssetRequest' === n.action) { + var d = Object(o.c)(n, r); + e.source.postMessage(JSON.stringify(d), e.origin); + } else if ('resizeNativeHeight' === n.action) + r.height = n.height, r.width = n.width, m(r); + else { + if ('click' === Object(o.b)(n, r)) + return; + s.a.addWinningBid(r), i.a.emit(v, r); + } + } + } + function m(e) { + var t = e.adId, n = e.adUnitCode, r = e.width, i = e.height; + [ + 'div', + 'iframe' + ].forEach(function (e) { + var o = function (e) { + var r = function (e, t) { + return Object(u.isGptPubadsDefined)() ? function (e) { + return f()(window.googletag.pubads().getSlots(), function (t) { + return f()(t.getTargetingKeys(), function (n) { + return g()(t.getTargeting(n), e); + }); + }).getSlotElementId(); + }(e) : Object(u.isApnGetTagDefined)() ? function (e) { + var t = window.apntag.getTag(e); + return t && t.targetId; + }(t) : t; + }(t, n), i = document.getElementById(r); + return i && i.querySelector(e); + }(e + ':not([style*="display: none"])'); + if (o) { + var a = o.style; + a.width = r + 'px', a.height = i + 'px'; + } else + Object(u.logWarn)('Unable to locate matching page element for adUnitCode '.concat(n, '. Can\'t resize it to ad\'s dimensions. Please review setup.')); + }); + } + }, + 231: function (e, t, n) { + 'use strict'; + t.a = function (e) { + const $___old_4fc309dbd0b6d962 = {}.constructor.getOwnPropertyDescriptor(window, 'sessionStorage'); + try { + if ($___old_4fc309dbd0b6d962) + ({}.constructor.defineProperty(window, 'sessionStorage', $___mock_1cf1e90738546d40.sessionStorage)); + return function () { + var t; + try { + e = e || window.sessionStorage, t = JSON.parse(e.getItem(u)); + } catch (e) { + } + t && p(t, !0); + }.apply(this, arguments); + } finally { + if ($___old_4fc309dbd0b6d962) + ({}.constructor.defineProperty(window, 'sessionStorage', $___old_4fc309dbd0b6d962)); + } + }; + var r, i, o = n(3), a = n(0), c = n(28), u = 'pbjs:debugging'; + function s(e) { + Object(a.logMessage)('DEBUG: ' + e); + } + function d(e) { + Object(a.logWarn)('DEBUG: ' + e); + } + function f(e) { + r = y.bind(e), c.c.before(r, 5), i = h.bind(e), c.e.before(i, 5); + } + function l() { + c.c.getHooks({ hook: r }).remove(), c.e.getHooks({ hook: i }).remove(); + } + function p(e) { + var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + o.b.setConfig({ debug: !0 }), l(), f(e), s('bidder overrides enabled'.concat(t ? ' from session' : '')); + } + function g(e, t, n) { + return !(!e.bidder || e.bidder === t) || !(!e.adUnitCode || e.adUnitCode === n); + } + function b(e, t) { + return Array.isArray(e) && -1 === e.indexOf(t); + } + function v(e, t, n) { + return Object.keys(e).filter(function (e) { + return -1 === [ + 'adUnitCode', + 'bidder' + ].indexOf(e); + }).reduce(function (t, r) { + return s('bidder overrides changed \''.concat(t.adUnitCode, '/').concat(t.bidderCode, '\' ').concat(n, '.').concat(r, ' from \'').concat(t[r], '.js\' to \'').concat(e[r], '\'')), t[r] = e[r], t; + }, t); + } + function y(e, t, n) { + var r = this; + b(r.bidders, n.bidderCode) ? d('bidder \''.concat(n.bidderCode, '\' excluded from auction by bidder overrides')) : (Array.isArray(r.bids) && r.bids.forEach(function (e) { + g(e, n.bidderCode, t) || v(e, n, 'bidder'); + }), e(t, n)); + } + function h(e, t) { + var n = this, r = t.filter(function (e) { + return !b(n.bidders, e.bidderCode) || (d('bidRequest \''.concat(e.bidderCode, '\' excluded from auction by bidder overrides')), !1); + }); + Array.isArray(n.bidRequests) && r.forEach(function (e) { + n.bidRequests.forEach(function (t) { + e.bids.forEach(function (n) { + g(t, e.bidderCode, n.adUnitCode) || v(t, n, 'bidRequest'); + }); + }); + }), e(r); + } + function m(e) { + if (e.enabled) { + try { + window.sessionStorage.setItem(u, JSON.stringify(e)); + } catch (e) { + } + p(e); + } else { + l(), s('bidder overrides disabled'); + try { + window.sessionStorage.removeItem(u); + } catch (e) { + } + } + } + o.b.getConfig('debugging', function (e) { + return m(e.debugging); + }); + }, + 24: function (e, t) { + e.exports = function (e) { + if ('function' != typeof e) + throw TypeError(String(e) + ' is not a function'); + return e; + }; + }, + 25: function (e, t, n) { + var r = n(24); + e.exports = function (e, t, n) { + if (r(e), void 0 === t) + return e; + switch (n) { + case 0: + return function () { + return e.call(t); + }; + case 1: + return function (n) { + return e.call(t, n); + }; + case 2: + return function (n, r) { + return e.call(t, n, r); + }; + case 3: + return function (n, r, i) { + return e.call(t, n, r, i); + }; + } + return function () { + return e.apply(t, arguments); + }; + }; + }, + 26: function (e, t, n) { + var r = n(45), i = n(27), o = function (e) { + return 'function' == typeof e ? e : void 0; + }; + e.exports = function (e, t) { + return arguments.length < 2 ? o(r[e]) || o(i[e]) : r[e] && r[e][t] || i[e] && i[e][t]; + }; + }, + 27: function (e, t, n) { + (function (t) { + var n = function (e) { + return e && e.Math == Math && e; + }; + e.exports = n('object' == typeof globalThis && globalThis) || n('object' == typeof window && window) || n('object' == typeof self && self) || n('object' == typeof t && t) || function () { + return this; + }() || Function('return this')(); + }.call(t, n(37))); + }, + 28: function (e, t, n) { + 'use strict'; + n.d(t, 'b', function () { + return E; + }), n.d(t, 'a', function () { + return A; + }), t.k = function (e) { + var t, n, o, a, s = e.adUnits, d = e.adUnitCodes, f = e.callback, p = e.cbTimeout, v = e.labels, U = e.auctionId, k = s, N = v, P = d, q = [], G = [], L = [], W = U || Object(r.generateUUID)(), F = f, z = p, V = [], H = new Set(); + function K() { + return { + auctionId: W, + timestamp: t, + auctionEnd: n, + auctionStatus: o, + adUnits: k, + adUnitCodes: P, + labels: N, + bidderRequests: q, + noBids: L, + bidsReceived: G, + winningBids: V, + timeout: z + }; + } + function J(e, t) { + if (t && clearTimeout(a), void 0 === n) { + var i = []; + e && (Object(r.logMessage)('Auction '.concat(W, ' timedOut')), c = H, (i = q.map(function (e) { + return (e.bids || []).filter(function (e) { + return !c.has(e.bidder); + }); + }).reduce(r.flatten, []).map(function (e) { + return { + bidId: e.bidId, + bidder: e.bidder, + adUnitCode: e.adUnitCode, + auctionId: e.auctionId + }; + })).length && j.emit(S.EVENTS.BID_TIMEOUT, i)), o = A, n = Date.now(), j.emit(S.EVENTS.AUCTION_END, K()), _(k, function () { + try { + if (null != F) { + var t = P, n = G.filter(r.bind.call(r.adUnitsFilter, this, t)).reduce(M, {}); + F.apply(pbjs, [ + n, + e, + W + ]), F = null; + } + } catch (e) { + Object(r.logError)('Error executing bidsBackHandler', null, e); + } finally { + i.length && O.callTimedOutBidders(s, i, z); + var o = u.b.getConfig('userSync') || {}; + o.enableOverride || m(o.syncDelay); + } + }); + } + var c; + } + function Y() { + u.b.resetBidder(), Object(r.logInfo)('Bids Received for Auction with id: '.concat(W), G), o = A, J(!1, !0); + } + function Q(e) { + H.add(e); + } + function $(e) { + var t = this; + e.forEach(function (e) { + var t; + t = e, q = q.concat(t); + }); + var n = {}, s = { + bidRequests: e, + run: function () { + var s, p; + s = J.bind(null, !0), p = setTimeout(s, z), a = p, o = E, j.emit(S.EVENTS.AUCTION_INIT, K()); + var v = function (e, t) { + var n = 0, o = !1, a = new Set(), s = {}; + function d() { + n--, o && 0 === n && e(); + } + function f(e, o) { + var a = this; + s[o.requestId] = !0, n++; + var f = function (e) { + var t = e.adUnitCode, n = e.bid, o = e.bidderRequest, a = e.auctionId, s = o.start, d = h({}, n, { + auctionId: a, + responseTimestamp: Object(r.timestamp)(), + requestTimestamp: s, + cpm: parseFloat(n.cpm) || 0, + bidder: n.bidderCode, + adUnitCode: t + }); + d.timeToRespond = d.responseTimestamp - d.requestTimestamp, j.emit(S.EVENTS.BID_ADJUSTMENT, d); + var f = o.bids && l()(o.bids, function (e) { + return e.adUnitCode == t && e.bidId == d.requestId; + }), p = f && f.renderer, g = d.mediaType, b = f && f.mediaTypes && f.mediaTypes[g], v = b && b.renderer, m = null; + v && v.url && v.render && (!0 !== v.backupOnly || !n.renderer) ? m = v : p && p.url && p.render && (!0 !== p.backupOnly || !n.renderer) && (m = p); + m && (d.renderer = c.a.install({ url: m.url }), d.renderer.setRender(m.render)); + var O = D(n.mediaType, f, u.b.getConfig('mediaTypePriceGranularity')), E = Object(i.a)(d.cpm, 'object' === y(O) ? O : u.b.getConfig('customPriceBucket'), u.b.getConfig('currency.granularityMultiplier')); + return d.pbLg = E.low, d.pbMg = E.med, d.pbHg = E.high, d.pbAg = E.auto, d.pbDg = E.dense, d.pbCg = E.custom, d; + }({ + adUnitCode: e, + bid: o, + bidderRequest: a, + auctionId: t.getAuctionId() + }); + 'video' === f.mediaType ? function (e, t, n, i) { + var o = !0, a = Object(r.getBidRequest)(t.originalRequestId || t.requestId, [n]), c = a && Object(r.deepAccess)(a, 'mediaTypes.video'), s = c && Object(r.deepAccess)(c, 'context'); + u.b.getConfig('cache.url') && s !== b.b && (!t.videoCacheKey || u.b.getConfig('cache.ignoreBidderCacheKey') ? (o = !1, x(e, t, i, a)) : t.vastUrl || (Object(r.logError)('videoCacheKey specified but not required vastUrl for video bid'), o = !1)); + o && (B(e, t), i()); + }(t, f, a, d) : (B(t, f), d()); + } + function p() { + var i = this, c = t.getBidRequests(), d = u.b.getConfig('auctionOptions'); + if (a.add(i), d && !Object(r.isEmpty)(d)) { + var f = d.secondaryBidders; + f && !c.every(function (e) { + return g()(f, e.bidderCode); + }) && (c = c.filter(function (e) { + return !g()(f, e.bidderCode); + })); + } + o = c.every(function (e) { + return a.has(e); + }), i.bids.forEach(function (e) { + s[e.bidId] || (t.addNoBid(e), j.emit(S.EVENTS.NO_BID, e)); + }), o && 0 === n && e(); + } + return { + addBidResponse: f, + adapterDone: p + }; + }(Y, t); + O.callBids(k, e, function () { + for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) + t[n] = arguments[n]; + C.apply({ + dispatch: v.addBidResponse, + bidderRequest: this + }, t); + }, v.adapterDone, { + request: function (e, t) { + f(T, t), f(n, e), I[e] || (I[e] = { + SRA: !0, + origin: t + }), n[e] > 1 && (I[e].SRA = !1); + }, + done: function (e) { + T[e]--, w[0] && d(w[0]) && w.shift(); + } + }, z, Q); + } + }; + function d(e) { + var t = !0, n = u.b.getConfig('maxRequestsPerOrigin') || 4; + return e.bidRequests.some(function (e) { + var r = 1, i = void 0 !== e.src && e.src === S.S2S.SRC ? 's2s' : e.bidderCode; + return I[i] && (!1 === I[i].SRA && (r = Math.min(e.bids.length, n)), T[I[i].origin] + r > n && (t = !1)), !t; + }), t && e.run(), t; + } + function f(e, t) { + void 0 === e[t] ? e[t] = 1 : e[t]++; + } + d(s) || (Object(r.logWarn)('queueing auction due to limited endpoint capacity'), w.push(s)); + } + return { + addBidReceived: function (e) { + G = G.concat(e); + }, + addNoBid: function (e) { + L = L.concat(e); + }, + executeCallback: J, + callBids: function () { + o = 'started', t = Date.now(); + var e = O.makeBidRequests(k, t, W, z, N); + Object(r.logInfo)('Bids Requested for Auction with id: '.concat(W), e), e.length < 1 ? (Object(r.logWarn)('No valid bid requests returned for auction'), Y()) : R.call({ + dispatch: $, + context: this + }, e); + }, + addWinningBid: function (e) { + V = V.concat(e), O.callBidWonBidder(e.bidder, e, s); + }, + setBidTargeting: function (e) { + O.callSetTargetingBidder(e.bidder, e); + }, + getWinningBids: function () { + return V; + }, + getTimeout: function () { + return z; + }, + getAuctionId: function () { + return W; + }, + getAuctionStatus: function () { + return o; + }, + getAdUnits: function () { + return k; + }, + getAdUnitCodes: function () { + return P; + }, + getBidRequests: function () { + return q; + }, + getBidsReceived: function () { + return G; + }, + getNoBids: function () { + return L; + } + }; + }, n.d(t, 'c', function () { + return C; + }), n.d(t, 'e', function () { + return R; + }), t.g = U, t.d = B, n.d(t, 'f', function () { + return x; + }), n.d(t, 'i', function () { + return k; + }), n.d(t, 'h', function () { + return N; + }), t.j = P; + var r = n(0), i = n(48), o = n(39), a = n(101), c = n(13), u = n(3), s = n(60), d = n(9), f = n(11), l = n.n(f), p = n(12), g = n.n(p), b = n(20), v = n(2); + function y(e) { + return (y = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + })(e); + } + function h() { + return (h = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }).apply(this, arguments); + } + var m = s.a.syncUsers, O = n(8).default, j = n(10), S = n(5), E = 'inProgress', A = 'completed'; + j.on(S.EVENTS.BID_ADJUSTMENT, function (e) { + !function (e) { + var t, n = e.bidderCode, i = e.cpm; + if (pbjs.bidderSettings && (n && pbjs.bidderSettings[n] && 'function' == typeof pbjs.bidderSettings[n].bidCpmAdjustment ? t = pbjs.bidderSettings[n].bidCpmAdjustment : pbjs.bidderSettings[S.JSON_MAPPING.BD_SETTING_STANDARD] && 'function' == typeof pbjs.bidderSettings[S.JSON_MAPPING.BD_SETTING_STANDARD].bidCpmAdjustment && (t = pbjs.bidderSettings[S.JSON_MAPPING.BD_SETTING_STANDARD].bidCpmAdjustment), t)) + try { + i = t(e.cpm, h({}, e)); + } catch (e) { + Object(r.logError)('Error during bid adjustment', 'bidmanager.js', e); + } + i >= 0 && (e.cpm = i); + }(e); + }); + var T = {}, I = {}, w = []; + var C = Object(d.b)('async', function (e, t) { + this.dispatch.call(this.bidderRequest, e, t); + }, 'addBidResponse'), R = Object(d.b)('sync', function (e) { + this.dispatch.call(this.context, e); + }, 'addBidderRequests'), _ = Object(d.b)('async', function (e, t) { + t && t(); + }, 'bidsBackCallback'); + function U(e, t) { + t.timeToRespond > e.getTimeout() + u.b.getConfig('timeoutBuffer') && e.executeCallback(!0); + } + function B(e, t) { + var n = e.getBidRequests(), i = l()(n, function (e) { + return e.bidderCode === t.bidderCode; + }); + !function (e, t) { + var n, i = Object(r.isAllowZeroCpmBidsEnabled)(e.bidderCode) ? e.cpm >= 0 : e.cpm > 0; + if (e.bidderCode && (i || e.dealId)) { + var a = l()(t.bids, function (t) { + return t.adUnitCode === e.adUnitCode && t.bidId === e.requestId; + }); + n = function (e, t, n) { + if (!t) + return {}; + var r = {}, i = pbjs.bidderSettings; + if (i) { + q(r, P(t.mediaType, e), t, n), e && i[e] && i[e][S.JSON_MAPPING.ADSERVER_TARGETING] && (q(r, i[e], t, n), t.sendStandardTargeting = i[e].sendStandardTargeting); + } + t.native && (r = h({}, r, Object(o.e)(t, n))); + return r; + }(e.bidderCode, e, a); + } + e.adserverTargeting = h(e.adserverTargeting || {}, n); + }(t, i), j.emit(S.EVENTS.BID_RESPONSE, t), e.addBidReceived(t), U(e, t); + } + var x = Object(d.b)('async', function (e, t, n, i) { + Object(a.b)([t], function (i, o) { + i ? (Object(r.logWarn)('Failed to save to the video cache: '.concat(i, '. Video bid must be discarded.')), U(e, t)) : '' === o[0].uuid ? (Object(r.logWarn)('Supplied video cache key was already in use by Prebid Cache; caching attempt was rejected. Video bid must be discarded.'), U(e, t)) : (t.videoCacheKey = o[0].uuid, t.vastUrl || (t.vastUrl = Object(a.a)(t.videoCacheKey)), B(e, t), n()); + }, i); + }, 'callPrebidCache'); + function D(e, t, n) { + if (e && n) { + if (e === v.d) { + var i = Object(r.deepAccess)(t, 'mediaTypes.'.concat(v.d, '.context'), 'instream'); + if (n[''.concat(v.d, '-').concat(i)]) + return n[''.concat(v.d, '-').concat(i)]; + } + return n[e]; + } + } + var k = function (e, t) { + var n = D(e, t, u.b.getConfig('mediaTypePriceGranularity')); + return 'string' == typeof e && n ? 'string' == typeof n ? n : 'custom' : u.b.getConfig('priceGranularity'); + }, N = function (e) { + return function (t, n) { + return (e = e || k(t.mediaType, n)) === S.GRANULARITY_OPTIONS.AUTO ? t.pbAg : e === S.GRANULARITY_OPTIONS.DENSE ? t.pbDg : e === S.GRANULARITY_OPTIONS.LOW ? t.pbLg : e === S.GRANULARITY_OPTIONS.MEDIUM ? t.pbMg : e === S.GRANULARITY_OPTIONS.HIGH ? t.pbHg : e === S.GRANULARITY_OPTIONS.CUSTOM ? t.pbCg : void 0; + }; + }; + function P(e, t) { + function n(e, t) { + return { + key: e, + val: 'function' == typeof t ? function (e, n) { + return t(e, n); + } : function (e) { + return Object(r.getValue)(e, t); + } + }; + } + var i = S.TARGETING_KEYS, o = pbjs.bidderSettings; + if (o[S.JSON_MAPPING.BD_SETTING_STANDARD] || (o[S.JSON_MAPPING.BD_SETTING_STANDARD] = {}), o[S.JSON_MAPPING.BD_SETTING_STANDARD][S.JSON_MAPPING.ADSERVER_TARGETING] || (o[S.JSON_MAPPING.BD_SETTING_STANDARD][S.JSON_MAPPING.ADSERVER_TARGETING] = [ + n(i.BIDDER, 'bidderCode'), + n(i.AD_ID, 'adId'), + n(i.PRICE_BUCKET, N()), + n(i.SIZE, 'size'), + n(i.DEAL, 'dealId'), + n(i.SOURCE, 'source'), + n(i.FORMAT, 'mediaType'), + n(i.ADOMAIN, function (e) { + return e.meta && e.meta.advertiserDomains && e.meta.advertiserDomains.length > 0 ? e.meta.advertiserDomains[0] : ''; + }) + ]), 'video' === e) { + var a = o[S.JSON_MAPPING.BD_SETTING_STANDARD][S.JSON_MAPPING.ADSERVER_TARGETING]; + if ([ + i.UUID, + i.CACHE_ID + ].forEach(function (e) { + void 0 === l()(a, function (t) { + return t.key === e; + }) && a.push(n(e, 'videoCacheKey')); + }), u.b.getConfig('cache.url') && (!t || !1 !== Object(r.deepAccess)(o, ''.concat(t, '.sendStandardTargeting')))) { + var c = Object(r.parseUrl)(u.b.getConfig('cache.url')); + void 0 === l()(a, function (e) { + return e.key === i.CACHE_HOST; + }) && a.push(n(i.CACHE_HOST, function (e) { + return Object(r.deepAccess)(e, 'adserverTargeting.'.concat(i.CACHE_HOST)) ? e.adserverTargeting[i.CACHE_HOST] : c.hostname; + })); + } + } + return o[S.JSON_MAPPING.BD_SETTING_STANDARD]; + } + function q(e, t, n, i) { + var o = t[S.JSON_MAPPING.ADSERVER_TARGETING]; + return n.size = n.getSize(), Object(r._each)(o, function (o) { + var a = o.key, c = o.val; + if (e[a] && Object(r.logWarn)('The key: ' + a + ' is being overwritten'), Object(r.isFn)(c)) + try { + c = c(n, i); + } catch (e) { + Object(r.logError)('bidmanager', 'ERROR', e); + } + (void 0 === t.suppressEmptyKeys || !0 !== t.suppressEmptyKeys) && a !== S.TARGETING_KEYS.DEAL || !Object(r.isEmptyStr)(c) && null != c ? e[a] = c : Object(r.logInfo)('suppressing empty key \'' + a + '\' from adserver targeting'); + }), e; + } + function M(e, t) { + return e[t.adUnitCode] || (e[t.adUnitCode] = { bids: [] }), e[t.adUnitCode].bids.push(t), e; + } + }, + 29: function (e, t) { + e.exports = function (e) { + try { + return !!e(); + } catch (e) { + return !0; + } + }; + }, + 3: function (e, t, n) { + 'use strict'; + n.d(t, 'a', function () { + return j; + }), n.d(t, 'b', function () { + return T; + }); + var r = n(48), i = n(11), o = n.n(i), a = n(12), c = n.n(a), u = n(89), s = n.n(u), d = n(0), f = ['fpd']; + function l(e, t) { + var n = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var r = Object.getOwnPropertySymbols(e); + t && (r = r.filter(function (t) { + return Object.getOwnPropertyDescriptor(e, t).enumerable; + })), n.push.apply(n, r); + } + return n; + } + function p(e, t) { + if (null == e) + return {}; + var n, r, i = function (e, t) { + if (null == e) + return {}; + var n, r, i = {}, o = Object.keys(e); + for (r = 0; r < o.length; r++) + n = o[r], t.indexOf(n) >= 0 || (i[n] = e[n]); + return i; + }(e, t); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + for (r = 0; r < o.length; r++) + n = o[r], t.indexOf(n) >= 0 || Object.prototype.propertyIsEnumerable.call(e, n) && (i[n] = e[n]); + } + return i; + } + function g(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + function b(e) { + return (b = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + })(e); + } + function v() { + return (v = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }).apply(this, arguments); + } + var y = n(74), h = n(5), m = 'TRUE' === Object(d.getParameterByName)(h.DEBUG_MODE).toUpperCase(), O = window.location.origin, j = 'random', S = {}; + S[j] = !0, S.fixed = !0; + var E = j, A = { + LOW: 'low', + MEDIUM: 'medium', + HIGH: 'high', + AUTO: 'auto', + DENSE: 'dense', + CUSTOM: 'custom' + }; + var T = function () { + var e, t, n, i = [], a = null; + function u() { + e = {}; + var i = { + _debug: m, + get debug() { + return this._debug; + }, + set debug(e) { + this._debug = e; + }, + _bidderTimeout: 3000, + get bidderTimeout() { + return this._bidderTimeout; + }, + set bidderTimeout(e) { + this._bidderTimeout = e; + }, + _publisherDomain: O, + get publisherDomain() { + return this._publisherDomain; + }, + set publisherDomain(e) { + this._publisherDomain = e; + }, + _priceGranularity: A.MEDIUM, + set priceGranularity(e) { + c(e) && ('string' == typeof e ? this._priceGranularity = a(e) ? e : A.MEDIUM : Object(d.isPlainObject)(e) && (this._customPriceBucket = e, this._priceGranularity = A.CUSTOM, Object(d.logMessage)('Using custom price granularity'))); + }, + get priceGranularity() { + return this._priceGranularity; + }, + _customPriceBucket: {}, + get customPriceBucket() { + return this._customPriceBucket; + }, + _mediaTypePriceGranularity: {}, + get mediaTypePriceGranularity() { + return this._mediaTypePriceGranularity; + }, + set mediaTypePriceGranularity(e) { + var t = this; + this._mediaTypePriceGranularity = Object.keys(e).reduce(function (n, r) { + return c(e[r]) ? 'string' == typeof e ? n[r] = a(e[r]) ? e[r] : t._priceGranularity : Object(d.isPlainObject)(e) && (n[r] = e[r], Object(d.logMessage)('Using custom price granularity for '.concat(r))) : Object(d.logWarn)('Invalid price granularity for media type: '.concat(r)), n; + }, {}); + }, + _sendAllBids: true, + get enableSendAllBids() { + return this._sendAllBids; + }, + set enableSendAllBids(e) { + this._sendAllBids = e; + }, + _useBidCache: false, + get useBidCache() { + return this._useBidCache; + }, + set useBidCache(e) { + this._useBidCache = e; + }, + _deviceAccess: true, + get deviceAccess() { + return this._deviceAccess; + }, + set deviceAccess(e) { + this._deviceAccess = e; + }, + _bidderSequence: E, + get bidderSequence() { + return this._bidderSequence; + }, + set bidderSequence(e) { + S[e] ? this._bidderSequence = e : Object(d.logWarn)('Invalid order: '.concat(e, '. Bidder Sequence was not set.')); + }, + _timeoutBuffer: 400, + get timeoutBuffer() { + return this._timeoutBuffer; + }, + set timeoutBuffer(e) { + this._timeoutBuffer = e; + }, + _disableAjaxTimeout: false, + get disableAjaxTimeout() { + return this._disableAjaxTimeout; + }, + set disableAjaxTimeout(e) { + this._disableAjaxTimeout = e; + }, + _maxNestedIframes: 10, + get maxNestedIframes() { + return this._maxNestedIframes; + }, + set maxNestedIframes(e) { + this._maxNestedIframes = e; + }, + _auctionOptions: {}, + get auctionOptions() { + return this._auctionOptions; + }, + set auctionOptions(e) { + (function (e) { + if (!Object(d.isPlainObject)(e)) + return Object(d.logWarn)('Auction Options must be an object'), !1; + for (var t = 0, n = Object.keys(e); t < n.length; t++) { + var r = n[t]; + if ('secondaryBidders' !== r && 'suppressStaleRender' !== r) + return Object(d.logWarn)('Auction Options given an incorrect param: '.concat(r)), !1; + if ('secondaryBidders' === r) { + if (!Object(d.isArray)(e[r])) + return Object(d.logWarn)('Auction Options '.concat(r, ' must be of type Array')), !1; + if (!e[r].every(d.isStr)) + return Object(d.logWarn)('Auction Options '.concat(r, ' must be only string')), !1; + } else if ('suppressStaleRender' === r && !Object(d.isBoolean)(e[r])) + return Object(d.logWarn)('Auction Options '.concat(r, ' must be of type boolean')), !1; + } + return !0; + }(e) && (this._auctionOptions = e)); + } + }; + function a(e) { + return o()(Object.keys(A), function (t) { + return e === A[t]; + }); + } + function c(e) { + if (!e) + return Object(d.logError)('Prebid Error: no value passed to `setPriceGranularity()`'), !1; + if ('string' == typeof e) + a(e) || Object(d.logWarn)('Prebid Warning: setPriceGranularity was called with invalid setting, using `medium` as default.'); + else if (Object(d.isPlainObject)(e) && !Object(r.b)(e)) + return Object(d.logError)('Invalid custom price value passed to `setPriceGranularity()`'), !1; + return !0; + } + t && C(Object.keys(t).reduce(function (e, n) { + return t[n] !== i[n] && (e[n] = i[n] || {}), e; + }, {})), t = i, n = {}; + } + function h() { + if (a && n && Object(d.isPlainObject)(n[a])) { + var e = n[a], r = new s.a(Object.keys(t).concat(Object.keys(e))); + return y(r).reduce(function (n, r) { + return void 0 === e[r] ? n[r] = t[r] : void 0 === t[r] ? n[r] = e[r] : Object(d.isPlainObject)(e[r]) ? n[r] = Object(d.mergeDeep)({}, t[r], e[r]) : n[r] = e[r], n; + }, {}); + } + return v({}, t); + } + function j(e) { + var t = {}; + return Object.keys(e).forEach(function (n) { + var r = 'context' === n ? 'site' : n; + t[r] = 'site' === r || 'user' === r ? Object.keys(e[n]).reduce(function (t, r) { + return 'data' === r ? Object(d.mergeDeep)(t, { ext: { data: e[n][r] } }) : Object(d.mergeDeep)(t, g({}, r, e[n][r])), t; + }, {}) : e[n]; + }), t; + } + function T(e) { + var t = {}; + return Object.keys(e).filter(function (e) { + return 'context' === e; + }).forEach(function (n) { + Object.keys(e[n]).forEach(function (r) { + 'data' === r ? Object(d.mergeDeep)(t, { ext: { data: e[n][r] } }) : 'object' !== b(e[n][r]) || Array.isArray(e[n][r]) ? Object(d.mergeDeep)(t, { ext: { data: g({}, r.toLowerCase(), e[n][r]) } }) : Object.keys(e[n][r]).forEach(function (i) { + Object(d.mergeDeep)(t, { ext: { data: g({}, r.toLowerCase(), g({}, i.toLowerCase(), e[n][r][i])) } }); + }); + }); + }), t; + } + function I(n) { + if (Object(d.isPlainObject)(n)) { + var r = Object.keys(n), i = {}; + r.forEach(function (r) { + var o = 'fpd' === r ? 'ortb2' : r, a = 'fpd' === r ? j(n[r]) : n[r]; + Object(d.isPlainObject)(e[o]) && Object(d.isPlainObject)(a) && (a = v({}, e[o], a)), i[o] = t[o] = a; + }), C(i); + } else + Object(d.logError)('setConfig options must be an object'); + } + function w(e, t) { + var n = t; + if ('string' != typeof e && (n = e, e = '*'), 'function' == typeof n) { + var r = { + topic: e, + callback: n + }; + return i.push(r), function () { + i.splice(i.indexOf(r), 1); + }; + } + Object(d.logError)('listener must be a function'); + } + function C(e) { + var t = Object.keys(e); + i.filter(function (e) { + return c()(t, e.topic); + }).forEach(function (t) { + t.callback(g({}, t.topic, e[t.topic])); + }), i.filter(function (e) { + return '*' === e.topic; + }).forEach(function (t) { + return t.callback(e); + }); + } + function R(e) { + var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + try { + r(e), e.bidders.forEach(function (r) { + n[r] || (n[r] = {}), Object.keys(e.config).forEach(function (i) { + var o = 'fpd' === i ? 'ortb2' : i, a = 'fpd' === i ? j(e.config[i]) : e.config[i]; + if (Object(d.isPlainObject)(a)) { + var c = t ? d.mergeDeep : Object.assign; + n[r][o] = c({}, n[r][o] || {}, a); + } else + n[r][o] = a; + }); + }); + } catch (e) { + Object(d.logError)(e); + } + function r(e) { + if (!Object(d.isPlainObject)(e)) + throw 'setBidderConfig bidder options must be an object'; + if (!Array.isArray(e.bidders) || !e.bidders.length) + throw 'setBidderConfig bidder options must contain a bidders list with at least 1 bidder'; + if (!Object(d.isPlainObject)(e.config)) + throw 'setBidderConfig bidder options must contain a config object'; + } + } + function _(e, t) { + a = e; + try { + return t(); + } finally { + U(); + } + } + function U() { + a = null; + } + return u(), { + getCurrentBidder: function () { + return a; + }, + resetBidder: U, + getConfig: function () { + if (arguments.length <= 1 && 'function' != typeof (arguments.length <= 0 ? void 0 : arguments[0])) { + var e = arguments.length <= 0 ? void 0 : arguments[0]; + return e ? Object(d.deepAccess)(h(), e) : h(); + } + return w.apply(void 0, arguments); + }, + readConfig: function () { + if (arguments.length <= 1 && 'function' != typeof (arguments.length <= 0 ? void 0 : arguments[0])) { + var e = arguments.length <= 0 ? void 0 : arguments[0], t = Object(d.deepClone)(h()); + return e ? Object(d.deepAccess)(t, e) : t; + } + return w.apply(void 0, arguments); + }, + setConfig: I, + mergeConfig: function (e) { + if (Object(d.isPlainObject)(e)) { + var t = Object.keys(e).reduce(function (t, n) { + var r = h()[n] || {}; + return t[n] = Object(d.mergeDeep)(r, e[n]), t; + }, {}); + return I(function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = null != arguments[t] ? arguments[t] : {}; + t % 2 ? l(Object(n), !0).forEach(function (t) { + g(e, t, n[t]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : l(Object(n)).forEach(function (t) { + Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)); + }); + } + return e; + }({}, t)), t; + } + Object(d.logError)('mergeConfig input must be an object'); + }, + setDefaults: function (n) { + Object(d.isPlainObject)(e) ? (v(e, n), v(t, n)) : Object(d.logError)('defaults must be an object'); + }, + resetConfig: u, + runWithBidder: _, + callbackWithBidder: function (e) { + return function (t) { + return function () { + if ('function' == typeof t) { + for (var n = arguments.length, r = new Array(n), i = 0; i < n; i++) + r[i] = arguments[i]; + return _(e, d.bind.call.apply(d.bind, [ + t, + this + ].concat(r))); + } + Object(d.logWarn)('config.callbackWithBidder callback is not a function'); + }; + }; + }, + setBidderConfig: R, + getBidderConfig: function () { + return n; + }, + mergeBidderConfig: function (e) { + return R(e, !0); + }, + convertAdUnitFpd: function (e) { + var t = []; + return e.forEach(function (e) { + e.fpd ? (e.ortb2Imp ? Object(d.mergeDeep)(e.ortb2Imp, T(e.fpd)) : e.ortb2Imp = T(e.fpd), t.push(function (e) { + e.fpd; + return p(e, f); + }(e))) : t.push(e); + }), t; + }, + getLegacyFpd: function (e) { + if ('object' === b(e)) { + var t = {}; + return Object.keys(e).forEach(function (n) { + var r = 'site' === n ? 'context' : n; + t[r] = 'context' === r || 'user' === r ? Object.keys(e[n]).filter(function (e) { + return 'data' !== e; + }).reduce(function (t, r) { + return 'ext' === r ? Object(d.mergeDeep)(t, e[n][r]) : Object(d.mergeDeep)(t, g({}, r, e[n][r])), t; + }, {}) : e[n]; + }), t; + } + }, + getLegacyImpFpd: function (e) { + if ('object' === b(e)) { + var t = {}; + return Object(d.deepAccess)(e, 'ext.data') && Object.keys(e.ext.data).forEach(function (n) { + 'pbadslot' === n ? Object(d.mergeDeep)(t, { context: { pbAdSlot: e.ext.data[n] } }) : 'adserver' === n ? Object(d.mergeDeep)(t, { context: { adServer: e.ext.data[n] } }) : Object(d.mergeDeep)(t, { context: { data: g({}, n, e.ext.data[n]) } }); + }), t; + } + } + }; + }(); + }, + 30: function (e, t) { + e.exports = function (e) { + return 'object' == typeof e ? null !== e : 'function' == typeof e; + }; + }, + 31: function (e, t, n) { + var r = n(52), i = {}.hasOwnProperty; + e.exports = Object.hasOwn || function (e, t) { + return i.call(r(e), t); + }; + }, + 32: function (e, t, n) { + var r = n(33), i = n(34), o = n(44); + e.exports = r ? function (e, t, n) { + return i.f(e, t, o(1, n)); + } : function (e, t, n) { + return e[t] = n, e; + }; + }, + 33: function (e, t, n) { + var r = n(29); + e.exports = !r(function () { + return 7 != Object.defineProperty({}, 1, { + get: function () { + return 7; + } + })[1]; + }); + }, + 34: function (e, t, n) { + var r = n(33), i = n(84), o = n(17), a = n(62), c = Object.defineProperty; + t.f = r ? c : function (e, t, n) { + if (o(e), t = a(t, !0), o(n), i) + try { + return c(e, t, n); + } catch (e) { + } + if ('get' in n || 'set' in n) + throw TypeError('Accessors not supported'); + return 'value' in n && (e[t] = n.value), e; + }; + }, + 35: function (e, t, n) { + 'use strict'; + t.a = function (e, t, n) { + if (!t || !e) + return void Object(o.logError)('cannot load external script without url and moduleCode'); + if (!i()(c, t)) + return void Object(o.logError)(''.concat(t, ' not whitelisted for loading external JavaScript')); + if (a[e]) + return n && 'function' == typeof n && (a[e].loaded ? n() : a[e].callbacks.push(n)), a[e].tag; + a[e] = { + loaded: !1, + tag: null, + callbacks: [] + }, n && 'function' == typeof n && a[e].callbacks.push(n); + return Object(o.logWarn)('module '.concat(t, ' is loading external JavaScript')), function (t, n) { + var r = document.createElement('script'); + r.type = 'text/javascript', r.async = !0, a[e].tag = r, r.readyState ? r.onreadystatechange = function () { + 'loaded' !== r.readyState && 'complete' !== r.readyState || (r.onreadystatechange = null, n()); + } : r.onload = function () { + n(); + }; + return r.src = t, Object(o.insertElement)(r), r; + }(e, function () { + a[e].loaded = !0; + try { + for (var t = 0; t < a[e].callbacks.length; t++) + a[e].callbacks[t](); + } catch (e) { + Object(o.logError)('Error executing callback', 'adloader.js:loadExternalScript', e); + } + }); + }; + var r = n(12), i = n.n(r), o = n(0), a = {}, c = [ + 'adloox', + 'criteo', + 'outstream', + 'adagio', + 'browsi' + ]; + }, + 37: function (e, t) { + var n; + n = function () { + return this; + }(); + try { + n = n || Function('return this')() || (0, eval)('this'); + } catch (e) { + 'object' == typeof window && (n = window); + } + e.exports = n; + }, + 38: function (e, t, n) { + var r = n(18), i = n(73); + e.exports = r ? i : function (e) { + return Set.prototype.values.call(e); + }; + }, + 381: function (e, t, n) { + n(382); + var r = n(55); + e.exports = r('String', 'includes'); + }, + 382: function (e, t, n) { + 'use strict'; + var r = n(16), i = n(383), o = n(51); + r({ + target: 'String', + proto: !0, + forced: !n(385)('includes') + }, { + includes: function (e) { + return !!~String(o(this)).indexOf(i(e), arguments.length > 1 ? arguments[1] : void 0); + } + }); + }, + 383: function (e, t, n) { + var r = n(384); + e.exports = function (e) { + if (r(e)) + throw TypeError('The method doesn\'t accept regular expressions'); + return e; + }; + }, + 384: function (e, t, n) { + var r = n(30), i = n(50), o = n(23)('match'); + e.exports = function (e) { + var t; + return r(e) && (void 0 !== (t = e[o]) ? !!t : 'RegExp' == i(e)); + }; + }, + 385: function (e, t, n) { + var r = n(23)('match'); + e.exports = function (e) { + var t = /./; + try { + '/./'[e](t); + } catch (n) { + try { + return t[r] = !1, '/./'[e](t); + } catch (e) { + } + } + return !1; + }; + }, + 39: function (e, t, n) { + 'use strict'; + n.d(t, 'f', function () { + return f; + }), n.d(t, 'a', function () { + return l; + }), t.h = function (e) { + if (e && e.type && function (e) { + if (!e || !o()(Object.keys(p), e)) + return Object(r.logError)(''.concat(e, ' nativeParam is not supported')), !1; + return !0; + }(e.type)) + return p[e.type]; + return e; + }, t.g = function (e, t) { + var n = Object(r.getBidRequest)(e.requestId, t); + if (!n) + return !1; + if (!Object(r.deepAccess)(e, 'native.clickUrl')) + return !1; + var i = n.nativeParams; + if (!i) + return !0; + var a = Object.keys(i).filter(function (e) { + return i[e].required; + }), c = Object.keys(e.native).filter(function (t) { + return e.native[t]; + }); + return a.every(function (e) { + return o()(c, e); + }); + }, t.b = function (e, t) { + var n; + 'click' === e.action ? n = t.native && t.native.clickTrackers : (n = t.native && t.native.impressionTrackers, t.native && t.native.javascriptTrackers && Object(r.insertHtmlIntoIframe)(t.native.javascriptTrackers)); + return (n || []).forEach(r.triggerPixel), e.action; + }, t.e = function (e, t) { + var n = {}; + Object(r.deepAccess)(t, 'nativeParams.rendererUrl') ? e.native.rendererUrl = g(t.nativeParams.rendererUrl) : Object(r.deepAccess)(t, 'nativeParams.adTemplate') && (e.native.adTemplate = g(t.nativeParams.adTemplate)); + var i = !1 !== Object(r.deepAccess)(t, 'nativeParams.sendTargetingKeys'), o = function (e) { + var t = {}; + Object(r.deepAccess)(e, 'nativeParams.ext') && Object.keys(e.nativeParams.ext).forEach(function (e) { + t[e] = 'hb_native_'.concat(e); + }); + return u(u({}, d.NATIVE_KEYS), t); + }(t), a = u(u({}, e.native), e.native.ext); + return delete a.ext, Object.keys(a).forEach(function (a) { + var c = o[a], u = g(e.native[a]) || g(Object(r.deepAccess)(e, 'native.ext.'.concat(a))); + if ('adTemplate' !== a && c && u) { + var s = Object(r.deepAccess)(t, 'nativeParams.'.concat(a, '.sendId')); + if ('boolean' != typeof s && (s = Object(r.deepAccess)(t, 'nativeParams.ext.'.concat(a, '.sendId'))), s) + u = ''.concat(c, ':').concat(e.adId); + var d = Object(r.deepAccess)(t, 'nativeParams.'.concat(a, '.sendTargetingKeys')); + 'boolean' != typeof d && (d = Object(r.deepAccess)(t, 'nativeParams.ext.'.concat(a, '.sendTargetingKeys'))), ('boolean' == typeof d ? d : i) && (n[c] = u); + } + }), n; + }, t.d = function (e, t) { + var n = { + message: 'assetResponse', + adId: e.adId, + assets: [] + }; + t.native.hasOwnProperty('adTemplate') && (n.adTemplate = g(t.native.adTemplate)); + t.native.hasOwnProperty('rendererUrl') && (n.rendererUrl = g(t.native.rendererUrl)); + return e.assets.forEach(function (e) { + var i = Object(r.getKeyByValue)(d.NATIVE_KEYS, e), o = g(t.native[i]); + n.assets.push({ + key: i, + value: o + }); + }), n; + }, t.c = function (e, t) { + var n = { + message: 'assetResponse', + adId: e.adId, + assets: [] + }; + return Object.keys(t.native).forEach(function (e, r) { + if ('adTemplate' === e && t.native[e]) + n.adTemplate = g(t.native[e]); + else if ('rendererUrl' === e && t.native[e]) + n.rendererUrl = g(t.native[e]); + else if ('ext' === e) + Object.keys(t.native[e]).forEach(function (r) { + if (t.native[e][r]) { + var i = g(t.native[e][r]); + n.assets.push({ + key: r, + value: i + }); + } + }); + else if (t.native[e] && d.NATIVE_KEYS.hasOwnProperty(e)) { + var i = g(t.native[e]); + n.assets.push({ + key: e, + value: i + }); + } + }), n; + }; + var r = n(0), i = n(12), o = n.n(i); + function a(e) { + return (a = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + })(e); + } + function c(e, t) { + var n = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var r = Object.getOwnPropertySymbols(e); + t && (r = r.filter(function (t) { + return Object.getOwnPropertyDescriptor(e, t).enumerable; + })), n.push.apply(n, r); + } + return n; + } + function u(e) { + for (var t = 1; t < arguments.length; t++) { + var n = null != arguments[t] ? arguments[t] : {}; + t % 2 ? c(Object(n), !0).forEach(function (t) { + s(e, t, n[t]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : c(Object(n)).forEach(function (t) { + Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)); + }); + } + return e; + } + function s(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + var d = n(5), f = [], l = Object.keys(d.NATIVE_KEYS).map(function (e) { + return d.NATIVE_KEYS[e]; + }), p = { + image: { + image: { required: !0 }, + title: { required: !0 }, + sponsoredBy: { required: !0 }, + clickUrl: { required: !0 }, + body: { required: !1 }, + icon: { required: !1 } + } + }; + function g(e) { + return 'object' === a(e) && e.url ? e.url : e; + } + }, + 4: function (e, t, n) { + 'use strict'; + n.d(t, 'a', function () { + return c; + }), t.b = u; + var r = n(3), i = n(0); + function o() { + return (o = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }).apply(this, arguments); + } + function a(e) { + return (a = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + })(e); + } + var c = u(); + function u() { + var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 3000, t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, n = t.request, c = t.done; + return function (t, u, s) { + const $___old_1bc5193adceffe48 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_4fe4f9da9be1ed32 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_1bc5193adceffe48) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_b46b3bb46442fc90.XMLHttpRequest)); + if ($___old_4fe4f9da9be1ed32) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_b46b3bb46442fc90.XMLHttpRequest)); + return function () { + var d = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}; + try { + var f, l = d.method || (s ? 'POST' : 'GET'), p = document.createElement('a'); + p.href = t; + var g = 'object' === a(u) && null !== u ? u : { + success: function () { + Object(i.logMessage)('xhr success'); + }, + error: function (e) { + Object(i.logError)('xhr error', null, e); + } + }; + if ('function' == typeof u && (g.success = u), (f = new window.XMLHttpRequest()).onreadystatechange = function () { + if (4 === f.readyState) { + 'function' == typeof c && c(p.origin); + var e = f.status; + e >= 200 && e < 300 || 304 === e ? g.success(f.responseText, f) : g.error(f.statusText, f); + } + }, r.b.getConfig('disableAjaxTimeout') || (f.ontimeout = function () { + Object(i.logError)(' xhr timeout after ', f.timeout, 'ms'); + }), 'GET' === l && s) { + var b = Object(i.parseUrl)(t, d); + o(b.search, s), t = Object(i.buildUrl)(b); + } + f.open(l, t, !0), r.b.getConfig('disableAjaxTimeout') || (f.timeout = e), d.withCredentials && (f.withCredentials = !0), Object(i._each)(d.customHeaders, function (e, t) { + f.setRequestHeader(t, e); + }), d.preflight && f.setRequestHeader('X-Requested-With', 'XMLHttpRequest'), f.setRequestHeader('Content-Type', d.contentType || 'text/plain'), 'function' == typeof n && n(p.origin), 'POST' === l && s ? f.send(s) : f.send(); + } catch (e) { + Object(i.logError)('xhr construction', e), 'object' === a(u) && null !== u && u.error(e); + } + }.apply(this, arguments); + } finally { + if ($___old_1bc5193adceffe48) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_1bc5193adceffe48)); + if ($___old_4fe4f9da9be1ed32) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_4fe4f9da9be1ed32)); + } + }; + } + }, + 40: function (e, t, n) { + 'use strict'; + n.d(t, 'a', function () { + return A; + }), n.d(t, 'b', function () { + return T; + }), t.c = I, n.d(t, 'd', function () { + return w; + }); + var r = n(0), i = n(3), o = n(39), a = n(22), c = n(100), u = n(2), s = n(9), d = n(12), f = n.n(d), l = n(11), p = n.n(l); + function g() { + return (g = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }).apply(this, arguments); + } + function b(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + function v(e) { + return function (e) { + if (Array.isArray(e)) + return y(e); + }(e) || function (e) { + if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) + return Array.from(e); + }(e) || function (e, t) { + if (!e) + return; + if ('string' == typeof e) + return y(e, t); + var n = Object.prototype.toString.call(e).slice(8, -1); + 'Object' === n && e.constructor && (n = e.constructor.name); + if ('Map' === n || 'Set' === n) + return Array.from(e); + if ('Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) + return y(e, t); + }(e) || function () { + throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + }(); + } + function y(e, t) { + (null == t || t > e.length) && (t = e.length); + for (var n = 0, r = new Array(t); n < t; n++) + r[n] = e[n]; + return r; + } + var h = n(5), m = [], O = 'targetingControls.allowTargetingKeys', j = 'targetingControls.addTargetingKeys', S = 'Only one of "'.concat(O, '" or "').concat(j, '" can be set'), E = Object.keys(h.TARGETING_KEYS).map(function (e) { + return h.TARGETING_KEYS[e]; + }), A = { + isBidNotExpired: function (e) { + return e.responseTimestamp + 1000 * e.ttl - 1000 > Object(r.timestamp)(); + }, + isUnusedBid: function (e) { + return e && (e.status && !f()([h.BID_STATUS.RENDERED], e.status) || !e.status); + } + }, T = Object(s.b)('sync', function (e, t) { + var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, o = arguments.length > 3 && void 0 !== arguments[3] && arguments[3]; + if (!o) { + var a = [], c = i.b.getConfig('sendBidsControl.dealPrioritization'), u = Object(r.groupBy)(e, 'adUnitCode'); + return Object.keys(u).forEach(function (e) { + var i = [], o = Object(r.groupBy)(u[e], 'bidderCode'); + Object.keys(o).forEach(function (e) { + return i.push(o[e].reduce(t)); + }), n > 0 ? (i = c ? i.sort(I(!0)) : i.sort(function (e, t) { + return t.cpm - e.cpm; + }), a.push.apply(a, v(i.slice(0, n)))) : a.push.apply(a, v(i)); + }), a; + } + return e; + }); + function I() { + var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; + return function (t, n) { + return void 0 !== t.adserverTargeting.hb_deal && void 0 === n.adserverTargeting.hb_deal ? -1 : void 0 === t.adserverTargeting.hb_deal && void 0 !== n.adserverTargeting.hb_deal ? 1 : e ? n.cpm - t.cpm : n.adserverTargeting.hb_pb - t.adserverTargeting.hb_pb; + }; + } + var w = function (e) { + var t = {}, n = {}; + function a(e, t) { + return e.adserverTargeting && t && (Object(r.isArray)(t) && f()(t, e.adUnitCode) || 'string' == typeof t && e.adUnitCode === t); + } + function s(e, t) { + if (!0 === i.b.getConfig('targetingControls.alwaysIncludeDeals')) { + var n = E.concat(o.a); + return T(t, r.getHighestCpm).map(function (t) { + if (t.dealId && a(t, e)) + return b({}, t.adUnitCode, N(t, n.filter(function (e) { + return void 0 !== t.adserverTargeting[e]; + }))); + }).filter(function (e) { + return e; + }); + } + return []; + } + function d(e, t) { + var n = g({}, h.TARGETING_KEYS, h.NATIVE_KEYS), i = Object.keys(n), o = {}; + Object(r.logInfo)('allowTargetingKeys - allowed keys [ '.concat(t.map(function (e) { + return n[e]; + }).join(', '), ' ]')), e.map(function (e) { + var r = Object.keys(e)[0], a = e[r].filter(function (e) { + var r = Object.keys(e)[0], a = 0 === i.filter(function (e) { + return 0 === r.indexOf(n[e]); + }).length || p()(t, function (e) { + var t = n[e]; + return 0 === r.indexOf(t); + }); + return o[r] = !a, a; + }); + e[r] = a; + }); + var a = Object.keys(o).filter(function (e) { + return o[e]; + }); + return Object(r.logInfo)('allowTargetingKeys - removed keys [ '.concat(a.join(', '), ' ]')), e.filter(function (e) { + return e[Object.keys(e)[0]].length > 0; + }); + } + function l(e, t) { + var n = Object(r.deepClone)(e); + return Object.keys(n).map(function (e) { + return { + adUnitCode: e, + adserverTargeting: n[e] + }; + }).sort(I()).reduce(function (e, i, o, a) { + var c, u = (c = i.adserverTargeting, Object.keys(c).reduce(function (e, t) { + return e + ''.concat(t, '%3d').concat(encodeURIComponent(c[t]), '%26'); + }, '')); + o + 1 === a.length && (u = u.slice(0, -3)); + var s = i.adUnitCode, d = u.length; + return d <= t ? (t -= d, Object(r.logInfo)('AdUnit \''.concat(s, '\' auction keys comprised of ').concat(d, ' characters. Deducted from running threshold; new limit is ').concat(t), n[s]), e[s] = n[s]) : Object(r.logWarn)('The following keys for adUnitCode \''.concat(s, '\' exceeded the current limit of the \'auctionKeyMaxChars\' setting.\nThe key-set size was ').concat(d, ', the current allotted amount was ').concat(t, '.\n'), n[s]), o + 1 === a.length && 0 === Object.keys(e).length && Object(r.logError)('No auction targeting keys were permitted due to the setting in setConfig(targetingControls.auctionKeyMaxChars). Please review setup and consider adjusting.'), e; + }, {}); + } + function y(e) { + return e.map(function (e) { + return b({}, Object.keys(e)[0], e[Object.keys(e)[0]].map(function (e) { + return b({}, Object.keys(e)[0], e[Object.keys(e)[0]].join(',')); + }).reduce(function (e, t) { + return g(t, e); + }, {})); + }).reduce(function (e, t) { + var n = Object.keys(t)[0]; + return e[n] = g({}, e[n], t[n]), e; + }, {}); + } + function w(t) { + return 'string' == typeof t ? [t] : Object(r.isArray)(t) ? t : e.getAdUnitCodes() || []; + } + function C() { + var t = e.getBidsReceived(); + return i.b.getConfig('useBidCache') || (t = t.filter(function (e) { + return n[e.adUnitCode] === e.auctionId; + })), t = t.filter(function (e) { + return Object(r.deepAccess)(e, 'video.context') !== u.a; + }).filter(function (e) { + return 'banner' !== e.mediaType || Object(c.c)([ + e.width, + e.height + ]); + }).filter(A.isUnusedBid).filter(A.isBidNotExpired), T(t, r.getOldestHighestCpmBid); + } + function R(e, n) { + var r = t.getWinningBids(e, n), i = _(); + return r = r.map(function (e) { + return b({}, e.adUnitCode, Object.keys(e.adserverTargeting).filter(function (t) { + return void 0 === e.sendStandardTargeting || e.sendStandardTargeting || -1 === i.indexOf(t); + }).reduce(function (t, n) { + var r = [e.adserverTargeting[n]], i = b({}, n.substring(0, 20), r); + if (n === h.TARGETING_KEYS.DEAL) { + var o = b({}, ''.concat(n, '_').concat(e.bidderCode).substring(0, 20), r); + return [].concat(v(t), [ + i, + o + ]); + } + return [].concat(v(t), [i]); + }, [])); + }); + } + function _() { + return e.getStandardBidderAdServerTargeting().map(function (e) { + return e.key; + }).concat(E).filter(r.uniques); + } + function U(e, t, n, i) { + return Object.keys(t.adserverTargeting).filter(B()).forEach(function (n) { + e.length && e.filter(function (e) { + return function (n) { + return n.adUnitCode === t.adUnitCode && n.adserverTargeting[e]; + }; + }(n)).forEach(function (e) { + return function (n) { + Object(r.isArray)(n.adserverTargeting[e]) || (n.adserverTargeting[e] = [n.adserverTargeting[e]]), n.adserverTargeting[e] = n.adserverTargeting[e].concat(t.adserverTargeting[e]).filter(r.uniques), delete t.adserverTargeting[e]; + }; + }(n)); + }), e.push(t), e; + } + function B() { + var e = _().concat(o.a); + return function (t) { + return -1 === e.indexOf(t); + }; + } + function x(e) { + return b({}, e.adUnitCode, Object.keys(e.adserverTargeting).filter(B()).map(function (t) { + return b({}, t.substring(0, 20), [e.adserverTargeting[t]]); + })); + } + function D(e, t) { + return t.filter(function (t) { + return f()(e, t.adUnitCode); + }).map(function (e) { + return g({}, e); + }).reduce(U, []).map(x).filter(function (e) { + return e; + }); + } + function k(e, t) { + var n = E.concat(o.a), c = i.b.getConfig('sendBidsControl.bidLimit'), u = T(t, r.getHighestCpm, c), s = i.b.getConfig('targetingControls.allowSendAllBidsTargetingKeys'), d = s ? s.map(function (e) { + return h.TARGETING_KEYS[e]; + }) : n; + return u.map(function (t) { + if (a(t, e)) + return b({}, t.adUnitCode, N(t, n.filter(function (e) { + return void 0 !== t.adserverTargeting[e] && -1 !== d.indexOf(e); + }))); + }).filter(function (e) { + return e; + }); + } + function N(e, t) { + return t.map(function (t) { + return b({}, ''.concat(t, '_').concat(e.bidderCode).substring(0, 20), [e.adserverTargeting[t]]); + }); + } + function P(t) { + function n(e) { + return Object(r.deepAccess)(e, h.JSON_MAPPING.ADSERVER_TARGETING); + } + return e.getAdUnits().filter(function (e) { + return f()(t, e.code) && n(e); + }).map(function (e) { + return b({}, e.code, function (e) { + var t = n(e); + return Object.keys(t).map(function (e) { + return Object(r.isStr)(t[e]) && (t[e] = t[e].split(',').map(function (e) { + return e.trim(); + })), Object(r.isArray)(t[e]) || (t[e] = [t[e]]), b({}, e, t[e]); + }); + }(e)); + }); + } + return t.setLatestAuctionForAdUnit = function (e, t) { + n[e] = t; + }, t.resetPresetTargeting = function (t, n) { + if (Object(r.isGptPubadsDefined)()) { + var i = w(t), o = e.getAdUnits().filter(function (e) { + return f()(i, e.code); + }), a = m.reduce(function (e, t) { + return e[t] = null, e; + }, {}); + window.googletag.pubads().getSlots().forEach(function (e) { + var t = Object(r.isFn)(n) && n(e); + o.forEach(function (n) { + (n.code === e.getAdUnitPath() || n.code === e.getSlotElementId() || Object(r.isFn)(t) && t(n.code)) && e.updateTargetingFromMap(a); + }); + }); + } + }, t.resetPresetTargetingAST = function (e) { + w(e).forEach(function (e) { + var t = window.apntag.getTag(e); + if (t && t.keywords) { + var n = Object.keys(t.keywords), r = {}; + n.forEach(function (e) { + f()(m, e.toLowerCase()) || (r[e] = t.keywords[e]); + }), window.apntag.modifyTag(e, { keywords: r }); + } + }); + }, t.getAllTargeting = function (e) { + var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : C(), n = w(e), o = R(n, t).concat(D(n, t)).concat(i.b.getConfig('enableSendAllBids') ? k(n, t) : s(n, t)).concat(P(n)); + o.map(function (e) { + Object.keys(e).map(function (t) { + e[t].map(function (e) { + -1 === m.indexOf(Object.keys(e)[0]) && (m = Object.keys(e).concat(m)); + }); + }); + }); + var a = Object.keys(g({}, h.DEFAULT_TARGETING_KEYS, h.NATIVE_KEYS)), c = i.b.getConfig(O), u = i.b.getConfig(j); + if (null != u && null != c) + throw new Error(S); + c = null != u ? a.concat(u) : c || a, Array.isArray(c) && c.length > 0 && (o = d(o, c)), o = y(o); + var f = i.b.getConfig('targetingControls.auctionKeyMaxChars'); + return f && (Object(r.logInfo)('Detected \'targetingControls.auctionKeyMaxChars\' was active for this auction; set with a limit of '.concat(f, ' characters. Running checks on auction keys...')), o = l(o, f)), n.forEach(function (e) { + o[e] || (o[e] = {}); + }), o; + }, i.b.getConfig('targetingControls', function (e) { + null != Object(r.deepAccess)(e, O) && null != Object(r.deepAccess)(e, j) && Object(r.logError)(S); + }), t.setTargetingForGPT = function (e, t) { + window.googletag.pubads().getSlots().forEach(function (n) { + Object.keys(e).filter(t ? t(n) : Object(r.isAdUnitCodeMatchingSlot)(n)).forEach(function (t) { + Object.keys(e[t]).forEach(function (n) { + var r = e[t][n]; + 'string' == typeof r && -1 !== r.indexOf(',') && (r = r.split(',')), e[t][n] = r; + }), Object(r.logMessage)('Attempting to set targeting-map for slot: '.concat(n.getSlotElementId(), ' with targeting-map:'), e[t]), n.updateTargetingFromMap(e[t]); + }); + }); + }, t.getWinningBids = function (e) { + var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : C(), n = w(e); + return t.filter(function (e) { + return f()(n, e.adUnitCode); + }).filter(function (e) { + return Object(r.isAllowZeroCpmBidsEnabled)(e.bidderCode) ? e.cpm >= 0 : e.cpm > 0; + }).map(function (e) { + return e.adUnitCode; + }).filter(r.uniques).map(function (e) { + return t.filter(function (t) { + return t.adUnitCode === e ? t : null; + }).reduce(r.getHighestCpm); + }); + }, t.setTargetingForAst = function (e) { + var n = t.getAllTargeting(e); + try { + t.resetPresetTargetingAST(e); + } catch (e) { + Object(r.logError)('unable to reset targeting for AST' + e); + } + Object.keys(n).forEach(function (e) { + return Object.keys(n[e]).forEach(function (t) { + if (Object(r.logMessage)('Attempting to set targeting for targetId: '.concat(e, ' key: ').concat(t, ' value: ').concat(n[e][t])), Object(r.isStr)(n[e][t]) || Object(r.isArray)(n[e][t])) { + var i = {}; + t.search(/pt[0-9]/) < 0 ? i[t.toUpperCase()] = n[e][t] : i[t] = n[e][t], window.apntag.setKeywords(e, i, { overrideKeyValue: !0 }); + } + }); + }); + }, t.isApntagDefined = function () { + if (window.apntag && Object(r.isFn)(window.apntag.setKeywords)) + return !0; + }, t; + }(a.a); + }, + 41: function (e, t) { + e.exports = {}; + }, + 42: function (e, t, n) { + var r = n(17), i = n(24), o = n(23)('species'); + e.exports = function (e, t) { + var n, a = r(e).constructor; + return void 0 === a || null == (n = r(a)[o]) ? t : i(n); + }; + }, + 43: function (e, t, n) { + 'use strict'; + t.a = function (e, t) { + return new i(e, t); + }; + var r = n(0); + function i(e, t) { + var n = t && t.src || 'client', i = e || 0; + this.bidderCode = t && t.bidder || '', this.width = 0, this.height = 0, this.statusMessage = function () { + switch (i) { + case 0: + return 'Pending'; + case 1: + return 'Bid available'; + case 2: + return 'Bid returned empty or error response'; + case 3: + return 'Bid timed out'; + } + }(), this.adId = Object(r.getUniqueIdentifierStr)(), this.requestId = t && t.bidId, this.mediaType = 'banner', this.source = n, this.getStatusCode = function () { + return i; + }, this.getSize = function () { + return this.width + 'x' + this.height; + }; + } + }, + 44: function (e, t) { + e.exports = function (e, t) { + return { + enumerable: !(1 & e), + configurable: !(2 & e), + writable: !(4 & e), + value: t + }; + }; + }, + 45: function (e, t) { + e.exports = {}; + }, + 458: function (e, t, n) { + n(459); + var r = n(45); + e.exports = r.URLSearchParams; + }, + 459: function (e, t, n) { + 'use strict'; + n(99); + var r = n(16), i = n(26), o = n(460), a = n(71), c = n(94), u = n(59), s = n(95), d = n(46), f = n(68), l = n(31), p = n(25), g = n(58), b = n(17), v = n(30), y = n(70), h = n(44), m = n(73), O = n(57), j = n(23), S = i('fetch'), E = i('Headers'), A = j('iterator'), T = 'URLSearchParams', I = 'URLSearchParamsIterator', w = d.set, C = d.getterFor(T), R = d.getterFor(I), _ = /\+/g, U = Array(4), B = function (e) { + return U[e - 1] || (U[e - 1] = RegExp('((?:%[\\da-f]{2}){' + e + '})', 'gi')); + }, x = function (e) { + try { + return decodeURIComponent(e); + } catch (t) { + return e; + } + }, D = function (e) { + var t = e.replace(_, ' '), n = 4; + try { + return decodeURIComponent(t); + } catch (e) { + for (; n;) + t = t.replace(B(n--), x); + return t; + } + }, k = /[!'()~]|%20/g, N = { + '!': '%21', + '\'': '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+' + }, P = function (e) { + return N[e]; + }, q = function (e) { + return encodeURIComponent(e).replace(k, P); + }, M = function (e, t) { + if (t) + for (var n, r, i = t.split('&'), o = 0; o < i.length;) + (n = i[o++]).length && (r = n.split('='), e.push({ + key: D(r.shift()), + value: D(r.join('=')) + })); + }, G = function (e) { + this.entries.length = 0, M(this.entries, e); + }, L = function (e, t) { + if (e < t) + throw TypeError('Not enough arguments'); + }, W = s(function (e, t) { + w(this, { + type: I, + iterator: m(C(e).entries), + kind: t + }); + }, 'Iterator', function () { + var e = R(this), t = e.kind, n = e.iterator.next(), r = n.value; + return n.done || (n.value = 'keys' === t ? r.key : 'values' === t ? r.value : [ + r.key, + r.value + ]), n; + }), F = function () { + f(this, F, T); + var e, t, n, r, i, o, a, c, u, s = arguments.length > 0 ? arguments[0] : void 0, d = this, p = []; + if (w(d, { + type: T, + entries: p, + updateURL: function () { + }, + updateSearchParams: G + }), void 0 !== s) + if (v(s)) + if ('function' == typeof (e = O(s))) + for (n = (t = e.call(s)).next; !(r = n.call(t)).done;) { + if ((a = (o = (i = m(b(r.value))).next).call(i)).done || (c = o.call(i)).done || !o.call(i).done) + throw TypeError('Expected sequence with length 2'); + p.push({ + key: a.value + '', + value: c.value + '' + }); + } + else + for (u in s) + l(s, u) && p.push({ + key: u, + value: s[u] + '' + }); + else + M(p, 'string' == typeof s ? '?' === s.charAt(0) ? s.slice(1) : s : s + ''); + }, z = F.prototype; + c(z, { + append: function (e, t) { + L(arguments.length, 2); + var n = C(this); + n.entries.push({ + key: e + '', + value: t + '' + }), n.updateURL(); + }, + delete: function (e) { + L(arguments.length, 1); + for (var t = C(this), n = t.entries, r = e + '', i = 0; i < n.length;) + n[i].key === r ? n.splice(i, 1) : i++; + t.updateURL(); + }, + get: function (e) { + L(arguments.length, 1); + for (var t = C(this).entries, n = e + '', r = 0; r < t.length; r++) + if (t[r].key === n) + return t[r].value; + return null; + }, + getAll: function (e) { + L(arguments.length, 1); + for (var t = C(this).entries, n = e + '', r = [], i = 0; i < t.length; i++) + t[i].key === n && r.push(t[i].value); + return r; + }, + has: function (e) { + L(arguments.length, 1); + for (var t = C(this).entries, n = e + '', r = 0; r < t.length;) + if (t[r++].key === n) + return !0; + return !1; + }, + set: function (e, t) { + L(arguments.length, 1); + for (var n, r = C(this), i = r.entries, o = !1, a = e + '', c = t + '', u = 0; u < i.length; u++) + (n = i[u]).key === a && (o ? i.splice(u--, 1) : (o = !0, n.value = c)); + o || i.push({ + key: a, + value: c + }), r.updateURL(); + }, + sort: function () { + var e, t, n, r = C(this), i = r.entries, o = i.slice(); + for (i.length = 0, n = 0; n < o.length; n++) { + for (e = o[n], t = 0; t < n; t++) + if (i[t].key > e.key) { + i.splice(t, 0, e); + break; + } + t === n && i.push(e); + } + r.updateURL(); + }, + forEach: function (e) { + for (var t, n = C(this).entries, r = p(e, arguments.length > 1 ? arguments[1] : void 0, 3), i = 0; i < n.length;) + r((t = n[i++]).value, t.key, this); + }, + keys: function () { + return new W(this, 'keys'); + }, + values: function () { + return new W(this, 'values'); + }, + entries: function () { + return new W(this, 'entries'); + } + }, { enumerable: !0 }), a(z, A, z.entries), a(z, 'toString', function () { + for (var e, t = C(this).entries, n = [], r = 0; r < t.length;) + e = t[r++], n.push(q(e.key) + '=' + q(e.value)); + return n.join('&'); + }, { enumerable: !0 }), u(F, T), r({ + global: !0, + forced: !o + }, { URLSearchParams: F }), o || 'function' != typeof S || 'function' != typeof E || r({ + global: !0, + enumerable: !0, + forced: !0 + }, { + fetch: function (e) { + var t, n, r, i = [e]; + return arguments.length > 1 && (v(t = arguments[1]) && (n = t.body, g(n) === T && ((r = t.headers ? new E(t.headers) : new E()).has('content-type') || r.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'), t = y(t, { + body: h(0, String(n)), + headers: h(0, r) + }))), i.push(t)), S.apply(this, i); + } + }), e.exports = { + URLSearchParams: F, + getState: C + }; + }, + 46: function (e, t, n) { + var r, i, o, a = n(124), c = n(27), u = n(30), s = n(32), d = n(31), f = n(65), l = n(69), p = n(56), g = 'Object already initialized', b = c.WeakMap; + if (a || f.state) { + var v = f.state || (f.state = new b()), y = v.get, h = v.has, m = v.set; + r = function (e, t) { + if (h.call(v, e)) + throw new TypeError(g); + return t.facade = e, m.call(v, e, t), t; + }, i = function (e) { + return y.call(v, e) || {}; + }, o = function (e) { + return h.call(v, e); + }; + } else { + var O = l('state'); + p[O] = !0, r = function (e, t) { + if (d(e, O)) + throw new TypeError(g); + return t.facade = e, s(e, O, t), t; + }, i = function (e) { + return d(e, O) ? e[O] : {}; + }, o = function (e) { + return d(e, O); + }; + } + e.exports = { + set: r, + get: i, + has: o, + enforce: function (e) { + return o(e) ? i(e) : r(e, {}); + }, + getterFor: function (e) { + return function (t) { + var n; + if (!u(t) || (n = i(t)).type !== e) + throw TypeError('Incompatible receiver, ' + e + ' required'); + return n; + }; + } + }; + }, + 460: function (e, t, n) { + var r = n(29), i = n(23), o = n(18), a = i('iterator'); + e.exports = !r(function () { + var e = new URL('b?a=1&b=2&c=3', 'http://a'), t = e.searchParams, n = ''; + return e.pathname = 'c%20d', t.forEach(function (e, r) { + t.delete('b'), n += r + e; + }), o && !e.toJSON || !t.sort || 'http://a/c%20d?a=1&c=3' !== e.href || '3' !== t.get('c') || 'a=1' !== String(new URLSearchParams('?a=1')) || !t[a] || 'a' !== new URL('https://a@b').username || 'b' !== new URLSearchParams(new URLSearchParams('a=b')).get('a') || 'xn--e1aybc' !== new URL('http://тест').host || '#%D0%B1' !== new URL('http://a#б').hash || 'a1c3' !== n || 'x' !== new URL('http://x', void 0).host; + }); + }, + 48: function (e, t, n) { + 'use strict'; + n.d(t, 'a', function () { + return f; + }), n.d(t, 'b', function () { + return p; + }); + var r = n(11), i = n.n(r), o = n(0), a = { + buckets: [{ + max: 5, + increment: 0.5 + }] + }, c = { + buckets: [{ + max: 20, + increment: 0.1 + }] + }, u = { + buckets: [{ + max: 20, + increment: 0.01 + }] + }, s = { + buckets: [ + { + max: 3, + increment: 0.01 + }, + { + max: 8, + increment: 0.05 + }, + { + max: 20, + increment: 0.5 + } + ] + }, d = { + buckets: [ + { + max: 5, + increment: 0.05 + }, + { + max: 10, + increment: 0.1 + }, + { + max: 20, + increment: 0.5 + } + ] + }; + function f(e, t) { + var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, r = parseFloat(e); + return isNaN(r) && (r = ''), { + low: '' === r ? '' : l(e, a, n), + med: '' === r ? '' : l(e, c, n), + high: '' === r ? '' : l(e, u, n), + auto: '' === r ? '' : l(e, d, n), + dense: '' === r ? '' : l(e, s, n), + custom: '' === r ? '' : l(e, t, n) + }; + } + function l(e, t, n) { + var r = ''; + if (!p(t)) + return r; + var o = t.buckets.reduce(function (e, t) { + return e.max > t.max ? e : t; + }, { max: 0 }), a = 0, c = i()(t.buckets, function (t) { + if (e > o.max * n) { + var i = t.precision; + void 0 === i && (i = 2), r = (t.max * n).toFixed(i); + } else { + if (e <= t.max * n && e >= a * n) + return t.min = a, t; + a = t.max; + } + }); + return c && (r = function (e, t, n) { + var r = void 0 !== t.precision ? t.precision : 2, i = t.increment * n, o = t.min * n, a = Math.pow(10, r + 2), c = (e * a - o * a) / (i * a), u = Math.floor(c) * i + o; + return (u = Number(u.toFixed(10))).toFixed(r); + }(e, c, n)), r; + } + function p(e) { + if (Object(o.isEmpty)(e) || !e.buckets || !Array.isArray(e.buckets)) + return !1; + var t = !0; + return e.buckets.forEach(function (e) { + e.max && e.increment || (t = !1); + }), t; + } + }, + 49: function (e, t, n) { + var r = n(83), i = n(51); + e.exports = function (e) { + return r(i(e)); + }; + }, + 5: function (e, t) { + e.exports = { + JSON_MAPPING: { + PL_CODE: 'code', + PL_SIZE: 'sizes', + PL_BIDS: 'bids', + BD_BIDDER: 'bidder', + BD_ID: 'paramsd', + BD_PL_ID: 'placementId', + ADSERVER_TARGETING: 'adserverTargeting', + BD_SETTING_STANDARD: 'standard' + }, + DEBUG_MODE: 'pbjs_debug', + STATUS: { + GOOD: 1, + NO_BID: 2 + }, + CB: { + TYPE: { + ALL_BIDS_BACK: 'allRequestedBidsBack', + AD_UNIT_BIDS_BACK: 'adUnitBidsBack', + BID_WON: 'bidWon', + REQUEST_BIDS: 'requestBids' + } + }, + EVENTS: { + AUCTION_INIT: 'auctionInit', + AUCTION_END: 'auctionEnd', + BID_ADJUSTMENT: 'bidAdjustment', + BID_TIMEOUT: 'bidTimeout', + BID_REQUESTED: 'bidRequested', + BID_RESPONSE: 'bidResponse', + NO_BID: 'noBid', + BID_WON: 'bidWon', + BIDDER_DONE: 'bidderDone', + BIDDER_ERROR: 'bidderError', + SET_TARGETING: 'setTargeting', + BEFORE_REQUEST_BIDS: 'beforeRequestBids', + BEFORE_BIDDER_HTTP: 'beforeBidderHttp', + REQUEST_BIDS: 'requestBids', + ADD_AD_UNITS: 'addAdUnits', + AD_RENDER_FAILED: 'adRenderFailed', + AD_RENDER_SUCCEEDED: 'adRenderSucceeded', + TCF2_ENFORCEMENT: 'tcf2Enforcement', + AUCTION_DEBUG: 'auctionDebug', + BID_VIEWABLE: 'bidViewable', + STALE_RENDER: 'staleRender' + }, + AD_RENDER_FAILED_REASON: { + PREVENT_WRITING_ON_MAIN_DOCUMENT: 'preventWritingOnMainDocument', + NO_AD: 'noAd', + EXCEPTION: 'exception', + CANNOT_FIND_AD: 'cannotFindAd', + MISSING_DOC_OR_ADID: 'missingDocOrAdid' + }, + EVENT_ID_PATHS: { bidWon: 'adUnitCode' }, + GRANULARITY_OPTIONS: { + LOW: 'low', + MEDIUM: 'medium', + HIGH: 'high', + AUTO: 'auto', + DENSE: 'dense', + CUSTOM: 'custom' + }, + TARGETING_KEYS: { + BIDDER: 'hb_bidder', + AD_ID: 'hb_adid', + PRICE_BUCKET: 'hb_pb', + SIZE: 'hb_size', + DEAL: 'hb_deal', + SOURCE: 'hb_source', + FORMAT: 'hb_format', + UUID: 'hb_uuid', + CACHE_ID: 'hb_cache_id', + CACHE_HOST: 'hb_cache_host', + ADOMAIN: 'hb_adomain' + }, + DEFAULT_TARGETING_KEYS: { + BIDDER: 'hb_bidder', + AD_ID: 'hb_adid', + PRICE_BUCKET: 'hb_pb', + SIZE: 'hb_size', + DEAL: 'hb_deal', + FORMAT: 'hb_format', + UUID: 'hb_uuid', + CACHE_HOST: 'hb_cache_host' + }, + NATIVE_KEYS: { + title: 'hb_native_title', + body: 'hb_native_body', + body2: 'hb_native_body2', + privacyLink: 'hb_native_privacy', + privacyIcon: 'hb_native_privicon', + sponsoredBy: 'hb_native_brand', + image: 'hb_native_image', + icon: 'hb_native_icon', + clickUrl: 'hb_native_linkurl', + displayUrl: 'hb_native_displayurl', + cta: 'hb_native_cta', + rating: 'hb_native_rating', + address: 'hb_native_address', + downloads: 'hb_native_downloads', + likes: 'hb_native_likes', + phone: 'hb_native_phone', + price: 'hb_native_price', + salePrice: 'hb_native_saleprice', + rendererUrl: 'hb_renderer_url', + adTemplate: 'hb_adTemplate' + }, + S2S: { + SRC: 's2s', + DEFAULT_ENDPOINT: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction', + SYNCED_BIDDERS_KEY: 'pbjsSyncs' + }, + BID_STATUS: { + BID_TARGETING_SET: 'targetingSet', + RENDERED: 'rendered', + BID_REJECTED: 'bidRejected' + } + }; + }, + 50: function (e, t) { + var n = {}.toString; + e.exports = function (e) { + return n.call(e).slice(8, -1); + }; + }, + 51: function (e, t) { + e.exports = function (e) { + if (null == e) + throw TypeError('Can\'t call method on ' + e); + return e; + }; + }, + 52: function (e, t, n) { + var r = n(51); + e.exports = function (e) { + return Object(r(e)); + }; + }, + 53: function (e, t, n) { + var r = n(64), i = Math.min; + e.exports = function (e) { + return e > 0 ? i(r(e), 9007199254740991) : 0; + }; + }, + 54: function (e, t) { + e.exports = function () { + }; + }, + 55: function (e, t, n) { + var r = n(26); + e.exports = r; + }, + 56: function (e, t) { + e.exports = {}; + }, + 57: function (e, t, n) { + var r = n(58), i = n(41), o = n(23)('iterator'); + e.exports = function (e) { + if (null != e) + return e[o] || e['@@iterator'] || i[r(e)]; + }; + }, + 58: function (e, t, n) { + var r = n(67), i = n(50), o = n(23)('toStringTag'), a = 'Arguments' == i(function () { + return arguments; + }()); + e.exports = r ? i : function (e) { + var t, n, r; + return void 0 === e ? 'Undefined' : null === e ? 'Null' : 'string' == typeof (n = function (e, t) { + try { + return e[t]; + } catch (e) { + } + }(t = Object(e), o)) ? n : a ? i(t) : 'Object' == (r = i(t)) && 'function' == typeof t.callee ? 'Arguments' : r; + }; + }, + 59: function (e, t, n) { + var r = n(67), i = n(34).f, o = n(32), a = n(31), c = n(123), u = n(23)('toStringTag'); + e.exports = function (e, t, n, s) { + if (e) { + var d = n ? e : e.prototype; + a(d, u) || i(d, u, { + configurable: !0, + value: t + }), s && !r && o(d, 'toString', c); + } + }; + }, + 60: function (e, t, n) { + 'use strict'; + n.d(t, 'a', function () { + return p; + }); + var r = n(0), i = n(3), o = n(12), a = n.n(o), c = n(7); + function u(e, t) { + return function (e) { + if (Array.isArray(e)) + return e; + }(e) || function (e, t) { + var n = null == e ? null : 'undefined' != typeof Symbol && e[Symbol.iterator] || e['@@iterator']; + if (null == n) + return; + var r, i, o = [], a = !0, c = !1; + try { + for (n = n.call(e); !(a = (r = n.next()).done) && (o.push(r.value), !t || o.length !== t); a = !0); + } catch (e) { + c = !0, i = e; + } finally { + try { + a || null == n.return || n.return(); + } finally { + if (c) + throw i; + } + } + return o; + }(e, t) || function (e, t) { + if (!e) + return; + if ('string' == typeof e) + return s(e, t); + var n = Object.prototype.toString.call(e).slice(8, -1); + 'Object' === n && e.constructor && (n = e.constructor.name); + if ('Map' === n || 'Set' === n) + return Array.from(e); + if ('Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) + return s(e, t); + }(e, t) || function () { + throw new TypeError('Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + }(); + } + function s(e, t) { + (null == t || t > e.length) && (t = e.length); + for (var n = 0, r = new Array(t); n < t; n++) + r[n] = e[n]; + return r; + } + function d() { + return (d = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }).apply(this, arguments); + } + i.b.setDefaults({ + userSync: Object(r.deepClone)({ + syncEnabled: !0, + filterSettings: { + image: { + bidders: '*', + filter: 'include' + } + }, + syncsPerBidder: 5, + syncDelay: 3000, + auctionDelay: 0 + }) + }); + var f = Object(c.a)('usersync'); + var l = !Object(r.isSafariBrowser)() && f.cookiesAreEnabled(), p = function (e) { + var t = {}, n = { + image: [], + iframe: [] + }, o = new Set(), c = {}, s = { + image: !0, + iframe: !1 + }, f = e.config; + function l() { + if (f.syncEnabled && e.browserSupportsCookies) { + try { + !function () { + if (!s.iframe) + return; + p(n.iframe, function (e) { + var t = u(e, 2), i = t[0], o = t[1]; + Object(r.logMessage)('Invoking iframe user sync for bidder: '.concat(i)), Object(r.insertUserSyncIframe)(o), function (e, t) { + e.image = e.image.filter(function (e) { + return e[0] !== t; + }); + }(n, i); + }); + }(), function () { + if (!s.image) + return; + p(n.image, function (e) { + var t = u(e, 2), n = t[0], i = t[1]; + Object(r.logMessage)('Invoking image pixel user sync for bidder: '.concat(n)), Object(r.triggerPixel)(i); + }); + }(); + } catch (e) { + return Object(r.logError)('Error firing user syncs', e); + } + n = { + image: [], + iframe: [] + }; + } + } + function p(e, t) { + Object(r.shuffle)(e).forEach(function (e) { + t(e), o.add(e[0]); + }); + } + function g(e, t) { + var n = f.filterSettings; + if (function (e, t) { + if (e.all && e[t]) + return Object(r.logWarn)('Detected presence of the "filterSettings.all" and "filterSettings.'.concat(t, '" in userSync config. You cannot mix "all" with "iframe/image" configs; they are mutually exclusive.')), !1; + var n = e.all ? e.all : e[t], i = e.all ? 'all' : t; + if (!n) + return !1; + var o = n.filter, a = n.bidders; + if (o && 'include' !== o && 'exclude' !== o) + return Object(r.logWarn)('UserSync "filterSettings.'.concat(i, '.filter" setting \'').concat(o, '\' is not a valid option; use either \'include\' or \'exclude\'.')), !1; + if ('*' !== a && !(Array.isArray(a) && a.length > 0 && a.every(function (e) { + return Object(r.isStr)(e) && '*' !== e; + }))) + return Object(r.logWarn)('Detected an invalid setup in userSync "filterSettings.'.concat(i, '.bidders"; use either \'*\' (to represent all bidders) or an array of bidders.')), !1; + return !0; + }(n, e)) { + s[e] = !0; + var i = n.all ? n.all : n[e], o = '*' === i.bidders ? [t] : i.bidders; + return { + include: function (e, t) { + return !a()(e, t); + }, + exclude: function (e, t) { + return a()(e, t); + } + }[i.filter || 'include'](o, t); + } + return !s[e]; + } + return i.b.getConfig('userSync', function (e) { + if (e.userSync) { + var t = e.userSync.filterSettings; + Object(r.isPlainObject)(t) && (t.image || t.all || (e.userSync.filterSettings.image = { + bidders: '*', + filter: 'include' + })); + } + f = d(f, e.userSync); + }), t.registerSync = function (e, i, a) { + return o.has(i) ? Object(r.logMessage)('already fired syncs for "'.concat(i, '", ignoring registerSync call')) : f.syncEnabled && Object(r.isArray)(n[e]) ? i ? 0 !== f.syncsPerBidder && Number(c[i]) >= f.syncsPerBidder ? Object(r.logWarn)('Number of user syncs exceeded for "'.concat(i, '"')) : t.canBidderRegisterSync(e, i) ? (n[e].push([ + i, + a + ]), void (c = function (e, t) { + return e[t] ? e[t] += 1 : e[t] = 1, e; + }(c, i))) : Object(r.logWarn)('Bidder "'.concat(i, '" not permitted to register their "').concat(e, '" userSync pixels.')) : Object(r.logWarn)('Bidder is required for registering sync') : Object(r.logWarn)('User sync type "'.concat(e, '" not supported')); + }, t.syncUsers = function () { + var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0; + if (e) + return setTimeout(l, Number(e)); + l(); + }, t.triggerUserSyncs = function () { + f.enableOverride && t.syncUsers(); + }, t.canBidderRegisterSync = function (e, t) { + return !f.filterSettings || !g(e, t); + }, t; + }({ + config: i.b.getConfig('userSync'), + browserSupportsCookies: l + }); + }, + 61: function (e, t, n) { + 'use strict'; + t.a = function (e, t) { + o.adServers = o.adServers || {}, o.adServers[e] = o.adServers[e] || {}, Object.keys(t).forEach(function (n) { + o.adServers[e][n] ? Object(i.logWarn)('Attempting to add an already registered function property '.concat(n, ' for AdServer ').concat(e, '.')) : o.adServers[e][n] = t[n]; + }); + }; + var r = n(14), i = n(0), o = Object(r.a)(); + }, + 62: function (e, t, n) { + var r = n(30); + e.exports = function (e, t) { + if (!r(e)) + return e; + var n, i; + if (t && 'function' == typeof (n = e.toString) && !r(i = n.call(e))) + return i; + if ('function' == typeof (n = e.valueOf) && !r(i = n.call(e))) + return i; + if (!t && 'function' == typeof (n = e.toString) && !r(i = n.call(e))) + return i; + throw TypeError('Can\'t convert object to primitive value'); + }; + }, + 63: function (e, t, n) { + var r = n(25), i = n(83), o = n(52), a = n(53), c = n(110), u = [].push, s = function (e) { + var t = 1 == e, n = 2 == e, s = 3 == e, d = 4 == e, f = 6 == e, l = 7 == e, p = 5 == e || f; + return function (g, b, v, y) { + for (var h, m, O = o(g), j = i(O), S = r(b, v, 3), E = a(j.length), A = 0, T = y || c, I = t ? T(g, E) : n || l ? T(g, 0) : void 0; E > A; A++) + if ((p || A in j) && (m = S(h = j[A], A, O), e)) + if (t) + I[A] = m; + else if (m) + switch (e) { + case 3: + return !0; + case 5: + return h; + case 6: + return A; + case 2: + u.call(I, h); + } + else + switch (e) { + case 4: + return !1; + case 7: + u.call(I, h); + } + return f ? -1 : s || d ? d : I; + }; + }; + e.exports = { + forEach: s(0), + map: s(1), + filter: s(2), + some: s(3), + every: s(4), + find: s(5), + findIndex: s(6), + filterOut: s(7) + }; + }, + 64: function (e, t) { + var n = Math.ceil, r = Math.floor; + e.exports = function (e) { + return isNaN(e = +e) ? 0 : (e > 0 ? r : n)(e); + }; + }, + 65: function (e, t, n) { + var r = n(27), i = n(112), o = '__core-js_shared__', a = r[o] || i(o, {}); + e.exports = a; + }, + 66: function (e, t) { + var n = 0, r = Math.random(); + e.exports = function (e) { + return 'Symbol(' + String(void 0 === e ? '' : e) + ')_' + (++n + r).toString(36); + }; + }, + 67: function (e, t, n) { + var r = {}; + r[n(23)('toStringTag')] = 'z', e.exports = '[object z]' === String(r); + }, + 68: function (e, t) { + e.exports = function (e, t, n) { + if (!(e instanceof t)) + throw TypeError('Incorrect ' + (n ? n + ' ' : '') + 'invocation'); + return e; + }; + }, + 69: function (e, t, n) { + var r = n(86), i = n(66), o = r('keys'); + e.exports = function (e) { + return o[e] || (o[e] = i(e)); + }; + }, + 7: function (e, t, n) { + 'use strict'; + n.d(t, 'c', function () { + return u; + }), n.d(t, 'd', function () { + return d; + }), t.a = function (e) { + return s({ + moduleName: e, + moduleType: 'core' + }); + }, t.b = function (e, t) { + return s({ + gvlid: e, + moduleName: t + }); + }; + var r = n(9), i = n(0), o = n(12), a = n.n(o), c = [ + 'core', + 'prebid-module' + ], u = []; + function s() { + var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, t = e.gvlid, n = e.moduleName, r = e.moduleType; + function o(e) { + if (a()(c, r)) { + return e({ valid: !0 }); + } + var o; + return d(t, n, { hasEnforcementHook: !1 }, function (t) { + if (t && t.hasEnforcementHook) + o = e(t); + else { + var n = { + hasEnforcementHook: !1, + valid: Object(i.hasDeviceAccess)() + }; + o = e(n); + } + }), o; + } + var s = function (e, t, n, r, i, a) { + var c = function (o) { + if (o && o.valid) { + var a = i && '' !== i ? ' ;domain='.concat(encodeURIComponent(i)) : '', c = n && '' !== n ? ' ;expires='.concat(n) : '', u = null != r && 'none' == r.toLowerCase() ? '; Secure' : ''; + document.cookie = ''.concat(e, '=').concat(encodeURIComponent(t)).concat(c, '; path=/').concat(a).concat(r ? '; SameSite='.concat(r) : '').concat(u); + } + }; + if (!a || 'function' != typeof a) + return o(c); + u.push(function () { + var e = o(c); + a(e); + }); + }, f = function (e, t) { + var n = function (t) { + if (t && t.valid) { + var n = window.document.cookie.match('(^|;)\\s*' + e + '\\s*=\\s*([^;]*)\\s*(;|$)'); + return n ? decodeURIComponent(n[2]) : null; + } + return null; + }; + if (!t || 'function' != typeof t) + return o(n); + u.push(function () { + var e = o(n); + t(e); + }); + }, l = function (e) { + var t = function (e) { + const $___old_806cdfe67eef1efe = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_806cdfe67eef1efe) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_1cf1e90738546d40.localStorage)); + return function () { + if (e && e.valid) + try { + return localStorage.setItem('prebid.cookieTest', '1'), '1' === localStorage.getItem('prebid.cookieTest'); + } catch (e) { + } finally { + try { + localStorage.removeItem('prebid.cookieTest'); + } catch (e) { + } + } + return !1; + }.apply(this, arguments); + } finally { + if ($___old_806cdfe67eef1efe) + ({}.constructor.defineProperty(window, 'localStorage', $___old_806cdfe67eef1efe)); + } + }; + if (!e || 'function' != typeof e) + return o(t); + u.push(function () { + var n = o(t); + e(n); + }); + }, p = function (e) { + var t = function (e) { + return !(!e || !e.valid) && (!!Object(i.checkCookieSupport)() || (window.document.cookie = 'prebid.cookieTest', -1 !== window.document.cookie.indexOf('prebid.cookieTest'))); + }; + if (!e || 'function' != typeof e) + return o(t); + u.push(function () { + var n = o(t); + e(n); + }); + }, g = function (e, t, n) { + var r = function (n) { + const $___old_7fd633e8d4219974 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_7fd633e8d4219974) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_1cf1e90738546d40.localStorage)); + return function () { + n && n.valid && y() && window.localStorage.setItem(e, t); + }.apply(this, arguments); + } finally { + if ($___old_7fd633e8d4219974) + ({}.constructor.defineProperty(window, 'localStorage', $___old_7fd633e8d4219974)); + } + }; + if (!n || 'function' != typeof n) + return o(r); + u.push(function () { + var e = o(r); + n(e); + }); + }, b = function (e, t) { + var n = function (t) { + const $___old_1c1d289b0dc546a4 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_1c1d289b0dc546a4) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_1cf1e90738546d40.localStorage)); + return function () { + return t && t.valid && y() ? window.localStorage.getItem(e) : null; + }.apply(this, arguments); + } finally { + if ($___old_1c1d289b0dc546a4) + ({}.constructor.defineProperty(window, 'localStorage', $___old_1c1d289b0dc546a4)); + } + }; + if (!t || 'function' != typeof t) + return o(n); + u.push(function () { + var e = o(n); + t(e); + }); + }, v = function (e, t) { + var n = function (t) { + t && t.valid && y() && window.localStorage.removeItem(e); + }; + if (!t || 'function' != typeof t) + return o(n); + u.push(function () { + var e = o(n); + t(e); + }); + }, y = function (e) { + var t = function (e) { + const $___old_3577f0e563d7c8f4 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_3577f0e563d7c8f4) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_1cf1e90738546d40.localStorage)); + return function () { + if (e && e.valid) + try { + return !!window.localStorage; + } catch (e) { + Object(i.logError)('Local storage api disabled'); + } + return !1; + }.apply(this, arguments); + } finally { + if ($___old_3577f0e563d7c8f4) + ({}.constructor.defineProperty(window, 'localStorage', $___old_3577f0e563d7c8f4)); + } + }; + if (!e || 'function' != typeof e) + return o(t); + u.push(function () { + var n = o(t); + e(n); + }); + }, h = function (e, t) { + var n = function (t) { + if (t && t.valid) { + var n = []; + if (Object(i.hasDeviceAccess)()) + for (var r = document.cookie.split(';'); r.length;) { + var o = r.pop(), a = o.indexOf('='); + a = a < 0 ? o.length : a, decodeURIComponent(o.slice(0, a).replace(/^\s+/, '')).indexOf(e) >= 0 && n.push(decodeURIComponent(o.slice(a + 1))); + } + return n; + } + }; + if (!t || 'function' != typeof t) + return o(n); + u.push(function () { + var e = o(n); + t(e); + }); + }; + return { + setCookie: s, + getCookie: f, + localStorageIsEnabled: l, + cookiesAreEnabled: p, + setDataInLocalStorage: g, + getDataFromLocalStorage: b, + removeDataFromLocalStorage: v, + hasLocalStorage: y, + findSimilarCookies: h + }; + } + var d = Object(r.b)('async', function (e, t, n, r) { + r(n); + }, 'validateStorageEnforcement'); + }, + 70: function (e, t, n) { + var r, i = n(17), o = n(127), a = n(93), c = n(56), u = n(130), s = n(85), d = n(69), f = d('IE_PROTO'), l = function () { + }, p = function (e) { + return ''; + }, h = function () { + try { + r = document.domain && new ActiveXObject('htmlfile'); + } catch (t) { + } + h = r ? function (e) { + e.write(d('')), e.close(); + var t = e.parentWindow.Object; + return e = null, t; + }(r) : function () { + var e, t = c('iframe'); + return t.style.display = 'none', u.appendChild(t), t.src = String('javascript:'), (e = t.contentWindow.document).open(), e.write(d('document.F=Object')), e.close(), e.F; + }(); + for (var e = s.length; e--;) + delete h.prototype[s[e]]; + return h(); + }; + a[l] = !0, e.exports = Object.create || function (e, t) { + var n; + return null !== e ? (p.prototype = o(e), n = new p(), p.prototype = null, n[l] = e) : n = h(), void 0 === t ? n : i(n, t); + }; + }, + function (e, t) { + e.exports = {}; + }, + function (e, t, n) { + 'use strict'; + var r = n(5), o = function (e) { + var t, n; + this.promise = new e(function (e, r) { + if (void 0 !== t || void 0 !== n) + throw TypeError('Bad Promise constructor'); + t = e, n = r; + }), this.resolve = r(t), this.reject = r(n); + }; + e.exports.f = function (e) { + return new o(e); + }; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.encode = function (e) { + return +e + ''; + }, e.decode = function (e) { + return '1' === e; + }, e; + }(); + t.BooleanEncoder = r; + }, + function (e, t, n) { + 'use strict'; + var r = {}.propertyIsEnumerable, o = Object.getOwnPropertyDescriptor, i = o && !r.call({ 1: 2 }, 1); + t.f = i ? function (e) { + var t = o(this, e); + return !!t && t.enumerable; + } : r; + }, + function (e, t, n) { + var r = n(12); + e.exports = function (e, t) { + if (!r(e)) + return e; + var n, o; + if (t && 'function' == typeof (n = e.toString) && !r(o = n.call(e))) + return o; + if ('function' == typeof (n = e.valueOf) && !r(o = n.call(e))) + return o; + if (!t && 'function' == typeof (n = e.toString) && !r(o = n.call(e))) + return o; + throw TypeError('Can\'t convert object to primitive value'); + }; + }, + function (e, t, n) { + var r = n(61), o = n(46), i = r('keys'); + e.exports = function (e) { + return i[e] || (i[e] = o(e)); + }; + }, + function (e, t) { + var n = 0, r = Math.random(); + e.exports = function (e) { + return 'Symbol(' + String(void 0 === e ? '' : e) + ')_' + (++n + r).toString(36); + }; + }, + function (e, t, n) { + var r = n(36); + e.exports = Array.isArray || function (e) { + return 'Array' == r(e); + }; + }, + function (e, t, n) { + var r = n(85), o = n(63); + e.exports = Object.keys || function (e) { + return r(e, o); + }; + }, + function (e, t, n) { + var r = n(7), o = n(39), i = n(18), s = r('unscopables'), a = Array.prototype; + void 0 == a[s] && i.f(a, s, { + configurable: !0, + value: o(null) + }), e.exports = function (e) { + a[s][e] = !0; + }; + }, + function (e, t) { + e.exports = function (e) { + try { + return { + error: !1, + value: e() + }; + } catch (t) { + return { + error: !0, + value: t + }; + } + }; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(115)), r(n(263)), r(n(264)), r(n(52)), r(n(116)); + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(25); + t.Response = function () { + this.cmpId = r.CmpApiModel.cmpId, this.cmpVersion = r.CmpApiModel.cmpVersion, this.gdprApplies = r.CmpApiModel.gdprApplies, this.tcfPolicyVersion = r.CmpApiModel.tcfPolicyVersion; + }; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(259)), r(n(260)), r(n(261)); + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(55), i = n(51), s = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + this.throwIfParamInvalid(), this.invokeCallback(new i.TCData(this.param, this.listenerId)); + }, t.prototype.throwIfParamInvalid = function () { + if (!(void 0 === this.param || Array.isArray(this.param) && this.param.every(Number.isInteger))) + throw new Error('Invalid Parameter'); + }, t; + }(o.Command); + t.GetTCDataCommand = s; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e(e, t, n, r) { + this.success = !0, Object.assign(this, { + callback: e, + listenerId: n, + param: t, + next: r + }); + try { + this.respond(); + } catch (e) { + this.invokeCallback(null); + } + } + return e.prototype.invokeCallback = function (e) { + null !== e ? 'function' == typeof this.next ? this.callback(this.next, e, !0) : this.callback(e, !0) : this.callback(e, !1); + }, e; + }(); + t.Command = r; + }, + function (e, t, n) { + var r = n(11), o = n(36), i = ''.split; + e.exports = r(function () { + return !Object('z').propertyIsEnumerable(0); + }) ? function (e) { + return 'String' == o(e) ? i.call(e, '') : Object(e); + } : Object; + }, + function (e, t, n) { + var r = n(6), o = n(12), i = r.document, s = o(i) && o(i.createElement); + e.exports = function (e) { + return s ? i.createElement(e) : {}; + }; + }, + function (e, t, n) { + var r = n(6), o = n(22); + e.exports = function (e, t) { + try { + o(r, e, t); + } catch (n) { + r[e] = t; + } + return t; + }; + }, + function (e, t, n) { + var r = n(60), o = Function.toString; + 'function' != typeof r.inspectSource && (r.inspectSource = function (e) { + return o.call(e); + }), e.exports = r.inspectSource; + }, + function (e, t, n) { + var r = n(6), o = n(58), i = r['__core-js_shared__'] || o('__core-js_shared__', {}); + e.exports = i; + }, + function (e, t, n) { + var r = n(3), o = n(60); + (e.exports = function (e, t) { + return o[e] || (o[e] = void 0 !== t ? t : {}); + })('versions', []).push({ + version: '3.7.0', + mode: r ? 'pure' : 'global', + copyright: '\xA9 2020 Denis Pushkarev (zloirock.ru)' + }); + }, + function (e, t, n) { + var r = n(85), o = n(63).concat('length', 'prototype'); + t.f = Object.getOwnPropertyNames || function (e) { + return r(e, o); + }; + }, + function (e, t) { + e.exports = [ + 'constructor', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'toLocaleString', + 'toString', + 'valueOf' + ]; + }, + function (e, t) { + t.f = Object.getOwnPropertySymbols; + }, + function (e, t, n) { + var r = n(11), o = /#|\.prototype\./, i = function (e, t) { + var n = a[s(e)]; + return n == c || n != u && ('function' == typeof t ? r(t) : !!t); + }, s = i.normalize = function (e) { + return String(e).replace(o, '.').toLowerCase(); + }, a = i.data = {}, u = i.NATIVE = 'N', c = i.POLYFILL = 'P'; + e.exports = i; + }, + function (e, t, n) { + var r = n(11); + e.exports = !!Object.getOwnPropertySymbols && !r(function () { + return !String(Symbol()); + }); + }, + function (e, t, n) { + var r = n(12), o = n(47), i = n(7)('species'); + e.exports = function (e, t) { + var n; + return o(e) && ('function' != typeof (n = e.constructor) || n !== Array && !o(n.prototype) ? r(n) && null === (n = n[i]) && (n = void 0) : n = void 0), new (void 0 === n ? Array : n)(0 === t ? 0 : t); + }; + }, + function (e, t, n) { + var r, o, i = n(6), s = n(92), a = i.process, u = a && a.versions, c = u && u.v8; + c ? o = (r = c.split('.'))[0] + r[1] : s && (!(r = s.match(/Edge\/(\d+)/)) || r[1] >= 74) && (r = s.match(/Chrome\/(\d+)/)) && (o = r[1]), e.exports = o && +o; + }, + function (e, t, n) { + var r = n(96), o = n(40), i = n(7)('iterator'); + e.exports = function (e) { + if (void 0 != e) + return e[i] || e['@@iterator'] || o[r(e)]; + }; + }, + function (e, t, n) { + var r = {}; + r[n(7)('toStringTag')] = 'z', e.exports = '[object z]' === String(r); + }, + function (e, t, n) { + var r = n(7)('iterator'), o = !1; + try { + var i = 0, s = { + next: function () { + return { done: !!i++ }; + }, + return: function () { + o = !0; + } + }; + s[r] = function () { + return this; + }, Array.from(s, function () { + throw 2; + }); + } catch (a) { + } + e.exports = function (e, t) { + if (!t && !o) + return !1; + var n = !1; + try { + var i = {}; + i[r] = function () { + return { + next: function () { + return { done: n = !0 }; + } + }; + }, e(i); + } catch (a) { + } + return n; + }; + }, + function (e, t) { + e.exports = function (e, t, n) { + if (!(e instanceof t)) + throw TypeError('Incorrect ' + (n ? n + ' ' : '') + 'invocation'); + return e; + }; + }, + function (e, t, n) { + var r = n(2), o = n(186); + e.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { + var e, t = !1, n = {}; + try { + (e = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set).call(n, []), t = n instanceof Array; + } catch (i) { + } + return function (n, i) { + return r(n), o(i), t ? e.call(n, i) : n.__proto__ = i, n; + }; + }() : void 0); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(187), i = n(75), s = n(73), a = n(28), u = n(22), c = n(23), f = n(7), l = n(3), p = n(40), d = n(101), h = d.IteratorPrototype, v = d.BUGGY_SAFARI_ITERATORS, y = f('iterator'), g = function () { + return this; + }; + e.exports = function (e, t, n, f, d, m, b) { + o(n, t, f); + var E, C, _, S = function (e) { + if (e === d && L) + return L; + if (!v && e in O) + return O[e]; + switch (e) { + case 'keys': + case 'values': + case 'entries': + return function () { + return new n(this, e); + }; + } + return function () { + return new n(this); + }; + }, w = t + ' Iterator', I = !1, O = e.prototype, A = O[y] || O['@@iterator'] || d && O[d], L = !v && A || S(d), P = 'Array' == t && O.entries || A; + if (P && (E = i(P.call(new e())), h !== Object.prototype && E.next && (l || i(E) === h || (s ? s(E, h) : 'function' != typeof E[y] && u(E, y, g)), a(E, w, !0, !0), l && (p[w] = g))), 'values' == d && A && 'values' !== A.name && (I = !0, L = function () { + return A.call(this); + }), l && !b || O[y] === L || u(O, y, L), p[t] = L, d) + if (C = { + values: S('values'), + keys: m ? L : S('keys'), + entries: S('entries') + }, b) + for (_ in C) + (v || I || !(_ in O)) && c(O, _, C[_]); + else + r({ + target: t, + proto: !0, + forced: v || I + }, C); + return C; + }; + }, + function (e, t, n) { + var r = n(13), o = n(27), i = n(45), s = n(188), a = i('IE_PROTO'), u = Object.prototype; + e.exports = s ? Object.getPrototypeOf : function (e) { + return e = o(e), r(e, a) ? e[a] : 'function' == typeof e.constructor && e instanceof e.constructor ? e.constructor.prototype : e instanceof Object ? u : null; + }; + }, + function (e, t, n) { + var r = n(36), o = n(6); + e.exports = 'process' == r(o.process); + }, + function (e, t, n) { + var r = n(2), o = n(69); + e.exports = function (e) { + var t = o(e); + if ('function' != typeof t) + throw TypeError(String(e) + ' is not iterable'); + return r(t.call(e)); + }; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(118)), r(n(79)), r(n(278)), r(n(282)), r(n(123)), r(n(129)); + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(15), o = function () { + function e() { + } + var t, n, o, i, s, a, u, c, f, l, p, d, h, v, y, g, m, b; + return t = r.Fields.cmpId, n = r.Fields.cmpVersion, o = r.Fields.consentLanguage, i = r.Fields.consentScreen, s = r.Fields.created, a = r.Fields.isServiceSpecific, u = r.Fields.lastUpdated, c = r.Fields.policyVersion, f = r.Fields.publisherCountryCode, l = r.Fields.publisherLegitimateInterests, p = r.Fields.publisherConsents, d = r.Fields.purposeConsents, h = r.Fields.purposeLegitimateInterests, v = r.Fields.purposeOneTreatment, y = r.Fields.specialFeatureOptins, g = r.Fields.useNonStandardStacks, m = r.Fields.vendorListVersion, b = r.Fields.version, e[t] = 12, e[n] = 12, e[o] = 12, e[i] = 6, e[s] = 36, e[a] = 1, e[u] = 36, e[c] = 6, e[f] = 12, e[l] = 24, e[p] = 24, e[d] = 24, e[h] = 24, e[v] = 1, e[y] = 12, e[g] = 1, e[m] = 12, e[b] = 6, e.anyBoolean = 1, e.encodingType = 1, e.maxId = 16, e.numCustomPurposes = 6, e.numEntries = 12, e.numRestrictions = 12, e.purposeId = 6, e.restrictionType = 2, e.segmentType = 3, e.singleOrRange = 1, e.vendorId = 16, e; + }(); + t.BitLength = o; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.RestrictionType || (t.RestrictionType = {}))[r.NOT_ALLOWED = 0] = 'NOT_ALLOWED', r[r.REQUIRE_CONSENT = 1] = 'REQUIRE_CONSENT', r[r.REQUIRE_LI = 2] = 'REQUIRE_LI'; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(42), o = n(14), i = n(15), s = function () { + function e() { + } + return e.encode = function (e, t) { + for (var n = '', o = 1; o <= t; o++) + n += r.BooleanEncoder.encode(e.has(o)); + return n; + }, e.decode = function (e, t) { + if (e.length !== t) + throw new o.DecodingError('bitfield encoding length mismatch'); + for (var n = new i.Vector(), s = 1; s <= t; s++) + r.BooleanEncoder.decode(e[s - 1]) && n.set(s); + return n.bitLength = e.length, n; + }, e; + }(); + t.FixedVectorEncoder = s; + }, + function (e, t, n) { + var r = n(17), o = n(11), i = n(57); + e.exports = !r && !o(function () { + return 7 != Object.defineProperty(i('div'), 'a', { + get: function () { + return 7; + } + }).a; + }); + }, + function (e, t, n) { + var r = n(13), o = n(155), i = n(35), s = n(18); + e.exports = function (e, t) { + for (var n = o(t), a = s.f, u = i.f, c = 0; c < n.length; c++) { + var f = n[c]; + r(e, f) || a(e, f, u(t, f)); + } + }; + }, + function (e, t, n) { + var r = n(6); + e.exports = r; + }, + function (e, t, n) { + var r = n(13), o = n(26), i = n(86).indexOf, s = n(37); + e.exports = function (e, t) { + var n, a = o(e), u = 0, c = []; + for (n in a) + !r(s, n) && r(a, n) && c.push(n); + for (; t.length > u;) + r(a, n = t[u++]) && (~i(c, n) || c.push(n)); + return c; + }; + }, + function (e, t, n) { + var r = n(26), o = n(24), i = n(156), s = function (e) { + return function (t, n, s) { + var a, u = r(t), c = o(u.length), f = i(s, c); + if (e && n != n) { + for (; c > f;) + if ((a = u[f++]) != a) + return !0; + } else + for (; c > f; f++) + if ((e || f in u) && u[f] === n) + return e || f || 0; + return !e && -1; + }; + }; + e.exports = { + includes: s(!0), + indexOf: s(!1) + }; + }, + function (e, t, n) { + var r = n(66); + e.exports = r && !Symbol.sham && 'symbol' == typeof Symbol.iterator; + }, + function (e, t, n) { + var r = n(9); + e.exports = r('document', 'documentElement'); + }, + function (e, t, n) { + var r = n(7); + t.f = r; + }, + function (e, t, n) { + var r = n(8), o = n(56), i = n(27), s = n(24), a = n(67), u = [].push, c = function (e) { + var t = 1 == e, n = 2 == e, c = 3 == e, f = 4 == e, l = 6 == e, p = 5 == e || l; + return function (d, h, v, y) { + for (var g, m, b = i(d), E = o(b), C = r(h, v, 3), _ = s(E.length), S = 0, w = y || a, I = t ? w(d, _) : n ? w(d, 0) : void 0; _ > S; S++) + if ((p || S in E) && (m = C(g = E[S], S, b), e)) + if (t) + I[S] = m; + else if (m) + switch (e) { + case 3: + return !0; + case 5: + return g; + case 6: + return S; + case 2: + u.call(I, g); + } + else if (f) + return !1; + return l ? -1 : c || f ? f : I; + }; + }; + e.exports = { + forEach: c(0), + map: c(1), + filter: c(2), + some: c(3), + every: c(4), + find: c(5), + findIndex: c(6) + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(44), o = n(18), i = n(32); + e.exports = function (e, t, n) { + var s = r(t); + s in e ? o.f(e, s, i(0, n)) : e[s] = n; + }; + }, + function (e, t, n) { + var r = n(9); + e.exports = r('navigator', 'userAgent') || ''; + }, + function (e, t, n) { + var r = n(17), o = n(11), i = n(13), s = Object.defineProperty, a = {}, u = function (e) { + throw e; + }; + e.exports = function (e, t) { + if (i(a, e)) + return a[e]; + t || (t = {}); + var n = [][e], c = !!i(t, 'ACCESSORS') && t.ACCESSORS, f = i(t, 0) ? t[0] : u, l = i(t, 1) ? t[1] : void 0; + return a[e] = !!n && !o(function () { + if (c && !r) + return !0; + var e = { length: -1 }; + c ? s(e, 1, { + enumerable: !0, + get: u + }) : e[1] = 1, n.call(e, f, l); + }); + }; + }, + function (e, t, n) { + var r = n(2); + e.exports = function (e) { + var t = e.return; + if (void 0 !== t) + return r(t.call(e)).value; + }; + }, + function (e, t, n) { + var r = n(7), o = n(40), i = r('iterator'), s = Array.prototype; + e.exports = function (e) { + return void 0 !== e && (o.Array === e || s[i] === e); + }; + }, + function (e, t, n) { + var r = n(70), o = n(36), i = n(7)('toStringTag'), s = 'Arguments' == o(function () { + return arguments; + }()); + e.exports = r ? o : function (e) { + var t, n, r; + return void 0 === e ? 'Undefined' : null === e ? 'Null' : 'string' == typeof (n = function (e, t) { + try { + return e[t]; + } catch (n) { + } + }(t = Object(e), i)) ? n : s ? o(t) : 'Object' == (r = o(t)) && 'function' == typeof t.callee ? 'Arguments' : r; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(6), i = n(65), s = n(23), a = n(98), u = n(4), c = n(72), f = n(12), l = n(11), p = n(71), d = n(28), h = n(185); + e.exports = function (e, t, n) { + var v = -1 !== e.indexOf('Map'), y = -1 !== e.indexOf('Weak'), g = v ? 'set' : 'add', m = o[e], b = m && m.prototype, E = m, C = {}, _ = function (e) { + var t = b[e]; + s(b, e, 'add' == e ? function (e) { + return t.call(this, 0 === e ? 0 : e), this; + } : 'delete' == e ? function (e) { + return !(y && !f(e)) && t.call(this, 0 === e ? 0 : e); + } : 'get' == e ? function (e) { + return y && !f(e) ? void 0 : t.call(this, 0 === e ? 0 : e); + } : 'has' == e ? function (e) { + return !(y && !f(e)) && t.call(this, 0 === e ? 0 : e); + } : function (e, n) { + return t.call(this, 0 === e ? 0 : e, n), this; + }); + }; + if (i(e, 'function' != typeof m || !(y || b.forEach && !l(function () { + new m().entries().next(); + })))) + E = n.getConstructor(t, e, v, g), a.REQUIRED = !0; + else if (i(e, !0)) { + var S = new E(), w = S[g](y ? {} : -0, 1) != S, I = l(function () { + S.has(1); + }), O = p(function (e) { + new m(e); + }), A = !y && l(function () { + for (var e = new m(), t = 5; t--;) + e[g](t, t); + return !e.has(-0); + }); + O || ((E = t(function (t, n) { + c(t, E, e); + var r = h(new m(), t, E); + return void 0 != n && u(n, r[g], { + that: r, + AS_ENTRIES: v + }), r; + })).prototype = b, b.constructor = E), (I || A) && (_('delete'), _('has'), v && _('get')), (A || w) && _(g), y && b.clear && delete b.clear; + } + return C[e] = E, r({ + global: !0, + forced: E != m + }, C), d(E, e), y || n.setStrong(E, e, v), E; + }; + }, + function (e, t, n) { + var r = n(37), o = n(12), i = n(13), s = n(18).f, a = n(46), u = n(184), c = a('meta'), f = 0, l = Object.isExtensible || function () { + return !0; + }, p = function (e) { + s(e, c, { + value: { + objectID: 'O' + ++f, + weakData: {} + } + }); + }, d = e.exports = { + REQUIRED: !1, + fastKey: function (e, t) { + if (!o(e)) + return 'symbol' == typeof e ? e : ('string' == typeof e ? 'S' : 'P') + e; + if (!i(e, c)) { + if (!l(e)) + return 'F'; + if (!t) + return 'E'; + p(e); + } + return e[c].objectID; + }, + getWeakData: function (e, t) { + if (!i(e, c)) { + if (!l(e)) + return !0; + if (!t) + return !1; + p(e); + } + return e[c].weakData; + }, + onFreeze: function (e) { + return u && d.REQUIRED && l(e) && !i(e, c) && p(e), e; + } + }; + r[c] = !0; + }, + function (e, t, n) { + 'use strict'; + var r = n(18).f, o = n(39), i = n(100), s = n(8), a = n(72), u = n(4), c = n(74), f = n(102), l = n(17), p = n(98).fastKey, d = n(34), h = d.set, v = d.getterFor; + e.exports = { + getConstructor: function (e, t, n, c) { + var f = e(function (e, r) { + a(e, f, t), h(e, { + type: t, + index: o(null), + first: void 0, + last: void 0, + size: 0 + }), l || (e.size = 0), void 0 != r && u(r, e[c], { + that: e, + AS_ENTRIES: n + }); + }), d = v(t), y = function (e, t, n) { + var r, o, i = d(e), s = g(e, t); + return s ? s.value = n : (i.last = s = { + index: o = p(t, !0), + key: t, + value: n, + previous: r = i.last, + next: void 0, + removed: !1 + }, i.first || (i.first = s), r && (r.next = s), l ? i.size++ : e.size++, 'F' !== o && (i.index[o] = s)), e; + }, g = function (e, t) { + var n, r = d(e), o = p(t); + if ('F' !== o) + return r.index[o]; + for (n = r.first; n; n = n.next) + if (n.key == t) + return n; + }; + return i(f.prototype, { + clear: function () { + for (var e = d(this), t = e.index, n = e.first; n;) + n.removed = !0, n.previous && (n.previous = n.previous.next = void 0), delete t[n.index], n = n.next; + e.first = e.last = void 0, l ? e.size = 0 : this.size = 0; + }, + delete: function (e) { + var t = d(this), n = g(this, e); + if (n) { + var r = n.next, o = n.previous; + delete t.index[n.index], n.removed = !0, o && (o.next = r), r && (r.previous = o), t.first == n && (t.first = r), t.last == n && (t.last = o), l ? t.size-- : this.size--; + } + return !!n; + }, + forEach: function (e) { + for (var t, n = d(this), r = s(e, arguments.length > 1 ? arguments[1] : void 0, 3); t = t ? t.next : n.first;) + for (r(t.value, t.key, this); t && t.removed;) + t = t.previous; + }, + has: function (e) { + return !!g(this, e); + } + }), i(f.prototype, n ? { + get: function (e) { + var t = g(this, e); + return t && t.value; + }, + set: function (e, t) { + return y(this, 0 === e ? 0 : e, t); + } + } : { + add: function (e) { + return y(this, e = 0 === e ? 0 : e, e); + } + }), l && r(f.prototype, 'size', { + get: function () { + return d(this).size; + } + }), f; + }, + setStrong: function (e, t, n) { + var r = t + ' Iterator', o = v(t), i = v(r); + c(e, t, function (e, t) { + h(this, { + type: r, + target: e, + state: o(e), + kind: t, + last: void 0 + }); + }, function () { + for (var e = i(this), t = e.kind, n = e.last; n && n.removed;) + n = n.previous; + return e.target && (e.last = n = n ? n.next : e.state.first) ? 'keys' == t ? { + value: n.key, + done: !1 + } : 'values' == t ? { + value: n.value, + done: !1 + } : { + value: [ + n.key, + n.value + ], + done: !1 + } : (e.target = void 0, { + value: void 0, + done: !0 + }); + }, n ? 'entries' : 'values', !n, !0), f(t); + } + }; + }, + function (e, t, n) { + var r = n(23); + e.exports = function (e, t, n) { + for (var o in t) + r(e, o, t[o], n); + return e; + }; + }, + function (e, t, n) { + 'use strict'; + var r, o, i, s = n(75), a = n(22), u = n(13), c = n(7), f = n(3), l = c('iterator'), p = !1; + [].keys && ('next' in (i = [].keys()) ? (o = s(s(i))) !== Object.prototype && (r = o) : p = !0), void 0 == r && (r = {}), f || u(r, l) || a(r, l, function () { + return this; + }), e.exports = { + IteratorPrototype: r, + BUGGY_SAFARI_ITERATORS: p + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(9), o = n(18), i = n(7), s = n(17), a = i('species'); + e.exports = function (e) { + var t = r(e), n = o.f; + s && t && !t[a] && n(t, a, { + configurable: !0, + get: function () { + return this; + } + }); + }; + }, + function (e, t, n) { + var r = n(17), o = n(48), i = n(26), s = n(43).f, a = function (e) { + return function (t) { + for (var n, a = i(t), u = o(a), c = u.length, f = 0, l = []; c > f;) + n = u[f++], r && !s.call(a, n) || l.push(e ? [ + n, + a[n] + ] : a[n]); + return l; + }; + }; + e.exports = { + entries: a(!0), + values: a(!1) + }; + }, + function (e, t, n) { + var r = n(6); + e.exports = r.Promise; + }, + function (e, t, n) { + var r, o, i, s = n(6), a = n(11), u = n(8), c = n(88), f = n(57), l = n(106), p = n(76), d = s.location, h = s.setImmediate, v = s.clearImmediate, y = s.process, g = s.MessageChannel, m = s.Dispatch, b = 0, E = {}, C = function (e) { + if (E.hasOwnProperty(e)) { + var t = E[e]; + delete E[e], t(); + } + }, _ = function (e) { + return function () { + C(e); + }; + }, S = function (e) { + C(e.data); + }, w = function (e) { + s.postMessage(e + '', d.protocol + '//' + d.host); + }; + h && v || (h = function (e) { + for (var t = [], n = 1; arguments.length > n;) + t.push(arguments[n++]); + return E[++b] = function () { + ('function' == typeof e ? e : Function(e)).apply(void 0, t); + }, r(b), b; + }, v = function (e) { + delete E[e]; + }, p ? r = function (e) { + y.nextTick(_(e)); + } : m && m.now ? r = function (e) { + m.now(_(e)); + } : g && !l ? (i = (o = new g()).port2, o.port1.onmessage = S, r = u(i.postMessage, i, 1)) : s.addEventListener && 'function' == typeof postMessage && !s.importScripts && d && 'file:' !== d.protocol && !a(w) ? (r = w, s.addEventListener('message', S, !1)) : r = 'onreadystatechange' in f('script') ? function (e) { + c.appendChild(f('script')).onreadystatechange = function () { + c.removeChild(this), C(e); + }; + } : function (e) { + setTimeout(_(e), 0); + }), e.exports = { + set: h, + clear: v + }; + }, + function (e, t, n) { + var r = n(92); + e.exports = /(iphone|ipod|ipad).*applewebkit/i.test(r); + }, + function (e, t, n) { + var r = n(2), o = n(12), i = n(41); + e.exports = function (e, t) { + if (r(e), o(t) && t.constructor === e) + return t; + var n = i.f(e); + return (0, n.resolve)(t), n.promise; + }; + }, + function (e, t, n) { + var r = n(202); + e.exports = function (e) { + if (r(e)) + throw TypeError('The method doesn\'t accept regular expressions'); + return e; + }; + }, + function (e, t, n) { + var r = n(7)('match'); + e.exports = function (e) { + var t = /./; + try { + '/./'[e](t); + } catch (n) { + try { + return t[r] = !1, '/./'[e](t); + } catch (o) { + } + } + return !1; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(2), o = n(5); + e.exports = function () { + for (var e, t = r(this), n = o(t.delete), i = !0, s = 0, a = arguments.length; s < a; s++) + e = n.call(t, arguments[s]), i = i && e; + return !!i; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(5), o = n(8), i = n(4); + e.exports = function (e) { + var t, n, s, a, u = arguments.length, c = u > 1 ? arguments[1] : void 0; + return r(this), (t = void 0 !== c) && r(c), void 0 == e ? new this() : (n = [], t ? (s = 0, a = o(c, u > 2 ? arguments[2] : void 0, 2), i(e, function (e) { + n.push(a(e, s++)); + })) : i(e, n.push, { that: n }), new this(n)); + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function () { + for (var e = arguments.length, t = new Array(e); e--;) + t[e] = arguments[e]; + return new this(t); + }; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }), function (e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + }(n(114)); + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.TCFCommand || (t.TCFCommand = {})).PING = 'ping', r.GET_TC_DATA = 'getTCData', r.GET_IN_APP_TC_DATA = 'getInAppTCData', r.GET_VENDOR_LIST = 'getVendorList', r.ADD_EVENT_LISTENER = 'addEventListener', r.REMOVE_EVENT_LISTENER = 'removeEventListener'; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(52), i = n(53), s = function (e) { + function t() { + var t = null !== e && e.apply(this, arguments) || this; + return t.cmpStatus = i.CmpStatus.ERROR, t; + } + return r(t, e), t; + }(o.Response); + t.Disabled = s; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(), o = this && this.__read || function (e, t) { + var n = 'function' == typeof Symbol && e[Symbol.iterator]; + if (!n) + return e; + var r, o, i = n.call(e), s = []; + try { + for (; (void 0 === t || t-- > 0) && !(r = i.next()).done;) + s.push(r.value); + } catch (e) { + o = { error: e }; + } finally { + try { + r && !r.done && (n = i.return) && n.call(i); + } finally { + if (o) + throw o.error; + } + } + return s; + }, i = this && this.__spread || function () { + for (var e = [], t = 0; t < arguments.length; t++) + e = e.concat(o(arguments[t])); + return e; + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var s = n(25), a = function (e) { + function t(t, n) { + var r = e.call(this) || this; + if (r.eventStatus = s.CmpApiModel.eventStatus, r.cmpStatus = s.CmpApiModel.cmpStatus, r.listenerId = n, s.CmpApiModel.gdprApplies) { + var o = s.CmpApiModel.tcModel; + r.tcString = s.CmpApiModel.tcString, r.isServiceSpecific = o.isServiceSpecific, r.useNonStandardStacks = o.useNonStandardStacks, r.purposeOneTreatment = o.purposeOneTreatment, r.publisherCC = o.publisherCountryCode, r.outOfBand = { + allowedVendors: r.createVectorField(o.vendorsAllowed, t), + disclosedVendors: r.createVectorField(o.vendorsDisclosed, t) + }, r.purpose = { + consents: r.createVectorField(o.purposeConsents), + legitimateInterests: r.createVectorField(o.purposeLegitimateInterests) + }, r.vendor = { + consents: r.createVectorField(o.vendorConsents, t), + legitimateInterests: r.createVectorField(o.vendorLegitimateInterests, t) + }, r.specialFeatureOptins = r.createVectorField(o.specialFeatureOptins), r.publisher = { + consents: r.createVectorField(o.publisherConsents), + legitimateInterests: r.createVectorField(o.publisherLegitimateInterests), + customPurpose: { + consents: r.createVectorField(o.publisherCustomConsents), + legitimateInterests: r.createVectorField(o.publisherCustomLegitimateInterests) + }, + restrictions: r.createRestrictions(o.publisherRestrictions) + }; + } + return r; + } + return r(t, e), t.prototype.createRestrictions = function (e) { + var t = {}; + if (e.numRestrictions > 0) + for (var n = e.getMaxVendorId(), r = function (n) { + var r = n.toString(); + e.getRestrictions(n).forEach(function (e) { + var n = e.purposeId.toString(); + t[n] || (t[n] = {}), t[n][r] = e.restrictionType; + }); + }, o = 1; o <= n; o++) + r(o); + return t; + }, t.prototype.createVectorField = function (e, t) { + return t ? t.reduce(function (t, n) { + return t[n + ''] = e.has(+n), t; + }, {}) : i(e).reduce(function (e, t) { + return e[t[0].toString(10)] = t[1], e; + }, {}); + }, t; + }(n(52).Response); + t.TCData = a; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__read || function (e, t) { + var n = 'function' == typeof Symbol && e[Symbol.iterator]; + if (!n) + return e; + var r, o, i = n.call(e), s = []; + try { + for (; (void 0 === t || t-- > 0) && !(r = i.next()).done;) + s.push(r.value); + } catch (e) { + o = { error: e }; + } finally { + try { + r && !r.done && (n = i.return) && n.call(i); + } finally { + if (o) + throw o.error; + } + } + return s; + }, o = this && this.__spread || function () { + for (var e = [], t = 0; t < arguments.length; t++) + e = e.concat(r(arguments[t])); + return e; + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var i = n(113), s = n(266), a = n(25), u = n(115), c = n(286); + t.API_KEY = '__tcfapi'; + var f = function () { + function e(e) { + this.customCommands = e; + try { + this.callQueue = window[t.API_KEY]() || []; + } catch (e) { + this.callQueue = []; + } finally { + window[t.API_KEY] = this.apiCall.bind(this), this.purgeQueuedCalls(); + } + } + return e.prototype.apiCall = function (e, t, n) { + for (var r, f = [], l = 3; l < arguments.length; l++) + f[l - 3] = arguments[l]; + if ('string' != typeof e) + n(null, !1); + else if (c.SupportedVersions.has(t)) { + if ('function' != typeof n) + throw new Error('invalid callback function'); + a.CmpApiModel.disabled ? n(new u.Disabled(), !1) : this.isCustomCommand(e) || this.isBuiltInCommand(e) ? this.isCustomCommand(e) && !this.isBuiltInCommand(e) ? (r = this.customCommands)[e].apply(r, o([n], f)) : e === i.TCFCommand.PING ? this.isCustomCommand(e) ? new s.CommandMap[e](this.customCommands[e], f[0], null, n) : new s.CommandMap[e](n, f[0]) : void 0 === a.CmpApiModel.tcModel ? this.callQueue.push(o([ + e, + t, + n + ], f)) : this.isCustomCommand(e) && this.isBuiltInCommand(e) ? new s.CommandMap[e](this.customCommands[e], f[0], null, n) : new s.CommandMap[e](n, f[0]) : n(null, !1); + } else + n(null, !1); + }, e.prototype.purgeQueuedCalls = function () { + var e = this.callQueue; + this.callQueue = [], e.forEach(function (e) { + window[t.API_KEY].apply(window, o(e)); + }); + }, e.prototype.isCustomCommand = function (e) { + return this.customCommands && 'function' == typeof this.customCommands[e]; + }, e.prototype.isBuiltInCommand = function (e) { + return void 0 !== s.CommandMap[e]; + }, e; + }(); + t.CallResponder = f; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(14), o = function () { + function e() { + } + return e.encode = function (e) { + if (!/^[0-1]+$/.test(e)) + throw new r.EncodingError('Invalid bitField'); + var t = e.length % this.LCM; + e += t ? '0'.repeat(this.LCM - t) : ''; + for (var n = '', o = 0; o < e.length; o += this.BASIS) + n += this.DICT[parseInt(e.substr(o, this.BASIS), 2)]; + return n; + }, e.decode = function (e) { + if (!/^[A-Za-z0-9\-_]+$/.test(e)) + throw new r.DecodingError('Invalidly encoded Base64URL string'); + for (var t = '', n = 0; n < e.length; n++) { + var o = this.REVERSE_DICT.get(e[n]).toString(2); + t += '0'.repeat(this.BASIS - o.length) + o; + } + return t; + }, e.DICT = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', e.REVERSE_DICT = new Map([ + [ + 'A', + 0 + ], + [ + 'B', + 1 + ], + [ + 'C', + 2 + ], + [ + 'D', + 3 + ], + [ + 'E', + 4 + ], + [ + 'F', + 5 + ], + [ + 'G', + 6 + ], + [ + 'H', + 7 + ], + [ + 'I', + 8 + ], + [ + 'J', + 9 + ], + [ + 'K', + 10 + ], + [ + 'L', + 11 + ], + [ + 'M', + 12 + ], + [ + 'N', + 13 + ], + [ + 'O', + 14 + ], + [ + 'P', + 15 + ], + [ + 'Q', + 16 + ], + [ + 'R', + 17 + ], + [ + 'S', + 18 + ], + [ + 'T', + 19 + ], + [ + 'U', + 20 + ], + [ + 'V', + 21 + ], + [ + 'W', + 22 + ], + [ + 'X', + 23 + ], + [ + 'Y', + 24 + ], + [ + 'Z', + 25 + ], + [ + 'a', + 26 + ], + [ + 'b', + 27 + ], + [ + 'c', + 28 + ], + [ + 'd', + 29 + ], + [ + 'e', + 30 + ], + [ + 'f', + 31 + ], + [ + 'g', + 32 + ], + [ + 'h', + 33 + ], + [ + 'i', + 34 + ], + [ + 'j', + 35 + ], + [ + 'k', + 36 + ], + [ + 'l', + 37 + ], + [ + 'm', + 38 + ], + [ + 'n', + 39 + ], + [ + 'o', + 40 + ], + [ + 'p', + 41 + ], + [ + 'q', + 42 + ], + [ + 'r', + 43 + ], + [ + 's', + 44 + ], + [ + 't', + 45 + ], + [ + 'u', + 46 + ], + [ + 'v', + 47 + ], + [ + 'w', + 48 + ], + [ + 'x', + 49 + ], + [ + 'y', + 50 + ], + [ + 'z', + 51 + ], + [ + '0', + 52 + ], + [ + '1', + 53 + ], + [ + '2', + 54 + ], + [ + '3', + 55 + ], + [ + '4', + 56 + ], + [ + '5', + 57 + ], + [ + '6', + 58 + ], + [ + '7', + 59 + ], + [ + '8', + 60 + ], + [ + '9', + 61 + ], + [ + '-', + 62 + ], + [ + '_', + 63 + ] + ]), e.BASIS = 6, e.LCM = 24, e; + }(); + t.Base64Url = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t() { + var t = null !== e && e.apply(this, arguments) || this; + return t.root = null, t; + } + return r(t, e), t.prototype.isEmpty = function () { + return !this.root; + }, t.prototype.add = function (e) { + var t, n = { + value: e, + left: null, + right: null + }; + if (this.isEmpty()) + this.root = n; + else + for (t = this.root;;) + if (e < t.value) { + if (null === t.left) { + t.left = n; + break; + } + t = t.left; + } else { + if (!(e > t.value)) + break; + if (null === t.right) { + t.right = n; + break; + } + t = t.right; + } + }, t.prototype.get = function () { + for (var e = [], t = this.root; t;) + if (t.left) { + for (var n = t.left; n.right && n.right != t;) + n = n.right; + n.right == t ? (n.right = null, e.push(t.value), t = t.right) : (n.right = t, t = t.left); + } else + e.push(t.value), t = t.right; + return e; + }, t.prototype.contains = function (e) { + for (var t = !1, n = this.root; n;) { + if (n.value === e) { + t = !0; + break; + } + e > n.value ? n = n.right : e < n.value && (n = n.left); + } + return t; + }, t.prototype.min = function (e) { + var t; + for (void 0 === e && (e = this.root); e;) + e.left ? e = e.left : (t = e.value, e = null); + return t; + }, t.prototype.max = function (e) { + var t; + for (void 0 === e && (e = this.root); e;) + e.right ? e = e.right : (t = e.value, e = null); + return t; + }, t.prototype.remove = function (e, t) { + void 0 === t && (t = this.root); + for (var n = null, r = 'left'; t;) + if (e < t.value) + n = t, t = t.left, r = 'left'; + else if (e > t.value) + n = t, t = t.right, r = 'right'; + else { + if (t.left || t.right) + if (t.left) + if (t.right) { + var o = this.min(t.right); + this.remove(o, t.right), t.value = o; + } else + n ? n[r] = t.left : this.root = t.left; + else + n ? n[r] = t.right : this.root = t.right; + else + n ? n[r] = null : this.root = null; + t = null; + } + }, t; + }(n(30).Cloneable); + t.BinarySearchTree = o; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.cmpId = 'cmpId', e.cmpVersion = 'cmpVersion', e.consentLanguage = 'consentLanguage', e.consentScreen = 'consentScreen', e.created = 'created', e.supportOOB = 'supportOOB', e.isServiceSpecific = 'isServiceSpecific', e.lastUpdated = 'lastUpdated', e.numCustomPurposes = 'numCustomPurposes', e.policyVersion = 'policyVersion', e.publisherCountryCode = 'publisherCountryCode', e.publisherCustomConsents = 'publisherCustomConsents', e.publisherCustomLegitimateInterests = 'publisherCustomLegitimateInterests', e.publisherLegitimateInterests = 'publisherLegitimateInterests', e.publisherConsents = 'publisherConsents', e.publisherRestrictions = 'publisherRestrictions', e.purposeConsents = 'purposeConsents', e.purposeLegitimateInterests = 'purposeLegitimateInterests', e.purposeOneTreatment = 'purposeOneTreatment', e.specialFeatureOptins = 'specialFeatureOptins', e.useNonStandardStacks = 'useNonStandardStacks', e.vendorConsents = 'vendorConsents', e.vendorLegitimateInterests = 'vendorLegitimateInterests', e.vendorListVersion = 'vendorListVersion', e.vendorsAllowed = 'vendorsAllowed', e.vendorsDisclosed = 'vendorsDisclosed', e.version = 'version', e; + }(); + t.Fields = r; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(30), i = n(14), s = n(80), a = function (e) { + function t(t, n) { + var r = e.call(this) || this; + return void 0 !== t && (r.purposeId = t), void 0 !== n && (r.restrictionType = n), r; + } + return r(t, e), t.unHash = function (e) { + var n = e.split(this.hashSeparator), r = new t(); + if (2 !== n.length) + throw new i.TCModelError('hash', e); + return r.purposeId = parseInt(n[0], 10), r.restrictionType = parseInt(n[1], 10), r; + }, Object.defineProperty(t.prototype, 'hash', { + get: function () { + if (!this.isValid()) + throw new Error('cannot hash invalid PurposeRestriction'); + return '' + this.purposeId + t.hashSeparator + this.restrictionType; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'purposeId', { + get: function () { + return this.purposeId_; + }, + set: function (e) { + this.purposeId_ = e; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.isValid = function () { + return Number.isInteger(this.purposeId) && this.purposeId > 0 && (this.restrictionType === s.RestrictionType.NOT_ALLOWED || this.restrictionType === s.RestrictionType.REQUIRE_CONSENT || this.restrictionType === s.RestrictionType.REQUIRE_LI); + }, t.prototype.isSameAs = function (e) { + return this.purposeId === e.purposeId && this.restrictionType === e.restrictionType; + }, t.hashSeparator = '-', t; + }(o.Cloneable); + t.PurposeRestriction = a; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.Segment || (t.Segment = {})).CORE = 'core', r.VENDORS_DISCLOSED = 'vendorsDisclosed', r.VENDORS_ALLOWED = 'vendorsAllowed', r.PUBLISHER_TC = 'publisherTC'; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(42)), r(n(124)), r(n(279)), r(n(81)), r(n(31)), r(n(125)), r(n(126)), r(n(128)), r(n(127)); + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(31), o = n(14), i = function () { + function e() { + } + return e.encode = function (e, t) { + return r.IntEncoder.encode(Math.round(e.getTime() / 100), t); + }, e.decode = function (e, t) { + if (t !== e.length) + throw new o.DecodingError('invalid bit length'); + var n = new Date(); + return n.setTime(100 * r.IntEncoder.decode(e, t)), n; + }, e; + }(); + t.DateEncoder = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(31), o = n(14), i = function () { + function e() { + } + return e.encode = function (e, t) { + var n = (e = e.toUpperCase()).charCodeAt(0) - 65, i = e.charCodeAt(1) - 65; + if (n < 0 || n > 25 || i < 0 || i > 25) + throw new o.EncodingError('invalid language code: ' + e); + if (t % 2 == 1) + throw new o.EncodingError('numBits must be even, ' + t + ' is not valid'); + return t /= 2, r.IntEncoder.encode(n, t) + r.IntEncoder.encode(i, t); + }, e.decode = function (e, t) { + if (t !== e.length || e.length % 2) + throw new o.DecodingError('invalid bit length for language'); + var n = e.length / 2, i = r.IntEncoder.decode(e.slice(0, n), n) + 65, s = r.IntEncoder.decode(e.slice(n), n) + 65; + return String.fromCharCode(i) + String.fromCharCode(s); + }, e; + }(); + t.LangEncoder = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(79), o = n(42), i = n(14), s = n(31), a = n(15), u = function () { + function e() { + } + return e.encode = function (e) { + var t = s.IntEncoder.encode(e.numRestrictions, r.BitLength.numRestrictions); + return e.isEmpty() || e.getRestrictions().forEach(function (n) { + t += s.IntEncoder.encode(n.purposeId, r.BitLength.purposeId), t += s.IntEncoder.encode(n.restrictionType, r.BitLength.restrictionType); + for (var i = e.getVendors(n), a = i.length, u = 0, c = 0, f = '', l = 0; l < a; l++) { + var p = i[l]; + if (0 === c && (u++, c = p), l === a - 1 || i[l + 1] > p + 1) { + var d = !(p === c); + f += o.BooleanEncoder.encode(d), f += s.IntEncoder.encode(c, r.BitLength.vendorId), d && (f += s.IntEncoder.encode(p, r.BitLength.vendorId)), c = 0; + } + } + t += s.IntEncoder.encode(u, r.BitLength.numEntries), t += f; + }), t; + }, e.decode = function (e) { + var t = 0, n = new a.PurposeRestrictionVector(), u = s.IntEncoder.decode(e.substr(t, r.BitLength.numRestrictions), r.BitLength.numRestrictions); + t += r.BitLength.numRestrictions; + for (var c = 0; c < u; c++) { + var f = s.IntEncoder.decode(e.substr(t, r.BitLength.purposeId), r.BitLength.purposeId); + t += r.BitLength.purposeId; + var l = s.IntEncoder.decode(e.substr(t, r.BitLength.restrictionType), r.BitLength.restrictionType); + t += r.BitLength.restrictionType; + var p = new a.PurposeRestriction(f, l), d = s.IntEncoder.decode(e.substr(t, r.BitLength.numEntries), r.BitLength.numEntries); + t += r.BitLength.numEntries; + for (var h = 0; h < d; h++) { + var v = o.BooleanEncoder.decode(e.substr(t, r.BitLength.anyBoolean)); + t += r.BitLength.anyBoolean; + var y = s.IntEncoder.decode(e.substr(t, r.BitLength.vendorId), r.BitLength.vendorId); + if (t += r.BitLength.vendorId, v) { + var g = s.IntEncoder.decode(e.substr(t, r.BitLength.vendorId), r.BitLength.vendorId); + if (t += r.BitLength.vendorId, g < y) + throw new i.DecodingError('Invalid RangeEntry: endVendorId ' + g + ' is less than ' + y); + for (var m = y; m <= g; m++) + n.add(m, p); + } else + n.add(y, p); + } + } + return n.bitLength = t, n; + }, e; + }(); + t.PurposeRestrictionVectorEncoder = u; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(15), o = n(78), i = n(31), s = n(42), a = n(81), u = n(128), c = n(14), f = function () { + function e() { + } + return e.encode = function (e) { + var t, n = [], r = [], a = i.IntEncoder.encode(e.maxId, o.BitLength.maxId), c = '', f = o.BitLength.maxId + o.BitLength.encodingType, l = f + e.maxId, p = 2 * o.BitLength.vendorId + o.BitLength.singleOrRange + o.BitLength.numEntries, d = f + o.BitLength.numEntries; + return e.forEach(function (i, a) { + c += s.BooleanEncoder.encode(i), (t = e.maxId > p && d < l) && i && (e.has(a + 1) ? 0 === r.length && (r.push(a), d += o.BitLength.singleOrRange, d += o.BitLength.vendorId) : (r.push(a), d += o.BitLength.vendorId, n.push(r), r = [])); + }), t ? (a += u.VectorEncodingType.RANGE + '', a += this.buildRangeEncoding(n)) : (a += u.VectorEncodingType.FIELD + '', a += c), a; + }, e.decode = function (e, t) { + var n, f = 0, l = i.IntEncoder.decode(e.substr(f, o.BitLength.maxId), o.BitLength.maxId); + f += o.BitLength.maxId; + var p = i.IntEncoder.decode(e.charAt(f), o.BitLength.encodingType); + if (f += o.BitLength.encodingType, p === u.VectorEncodingType.RANGE) { + if (n = new r.Vector(), 1 === t) { + if ('1' === e.substr(f, 1)) + throw new c.DecodingError('Unable to decode default consent=1'); + f++; + } + var d = i.IntEncoder.decode(e.substr(f, o.BitLength.numEntries), o.BitLength.numEntries); + f += o.BitLength.numEntries; + for (var h = 0; h < d; h++) { + var v = s.BooleanEncoder.decode(e.charAt(f)); + f += o.BitLength.singleOrRange; + var y = i.IntEncoder.decode(e.substr(f, o.BitLength.vendorId), o.BitLength.vendorId); + if (f += o.BitLength.vendorId, v) { + var g = i.IntEncoder.decode(e.substr(f, o.BitLength.vendorId), o.BitLength.vendorId); + f += o.BitLength.vendorId; + for (var m = y; m <= g; m++) + n.set(m); + } else + n.set(y); + } + } else { + var b = e.substr(f, l); + f += l, n = a.FixedVectorEncoder.decode(b, l); + } + return n.bitLength = f, n; + }, e.buildRangeEncoding = function (e) { + var t = e.length, n = i.IntEncoder.encode(t, o.BitLength.numEntries); + return e.forEach(function (e) { + var t = 1 === e.length; + n += s.BooleanEncoder.encode(!t), n += i.IntEncoder.encode(e[0], o.BitLength.vendorId), t || (n += i.IntEncoder.encode(e[1], o.BitLength.vendorId)); + }), n; + }, e; + }(); + t.VendorVectorEncoder = f; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.VectorEncodingType || (t.VectorEncodingType = {}))[r.FIELD = 0] = 'FIELD', r[r.RANGE = 1] = 'RANGE'; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(280)), r(n(281)); + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(), o = this && this.__awaiter || function (e, t, n, r) { + return new (n || (n = Promise))(function (o, i) { + function s(e) { + try { + u(r.next(e)); + } catch (e) { + i(e); + } + } + function a(e) { + try { + u(r.throw(e)); + } catch (e) { + i(e); + } + } + function u(e) { + var t; + e.done ? o(e.value) : (t = e.value, t instanceof n ? t : new n(function (e) { + e(t); + })).then(s, a); + } + u((r = r.apply(e, t || [])).next()); + }); + }, i = this && this.__generator || function (e, t) { + var n, r, o, i, s = { + label: 0, + sent: function () { + if (1 & o[0]) + throw o[1]; + return o[1]; + }, + trys: [], + ops: [] + }; + return i = { + next: a(0), + throw: a(1), + return: a(2) + }, 'function' == typeof Symbol && (i[Symbol.iterator] = function () { + return this; + }), i; + function a(i) { + return function (a) { + return function (i) { + if (n) + throw new TypeError('Generator is already executing.'); + for (; s;) + try { + if (n = 1, r && (o = 2 & i[0] ? r.return : i[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, i[1])).done) + return o; + switch (r = 0, o && (i = [ + 2 & i[0], + o.value + ]), i[0]) { + case 0: + case 1: + o = i; + break; + case 4: + return s.label++, { + value: i[1], + done: !1 + }; + case 5: + s.label++, r = i[1], i = [0]; + continue; + case 7: + i = s.ops.pop(), s.trys.pop(); + continue; + default: + if (!(o = (o = s.trys).length > 0 && o[o.length - 1]) && (6 === i[0] || 2 === i[0])) { + s = 0; + continue; + } + if (3 === i[0] && (!o || i[1] > o[0] && i[1] < o[3])) { + s.label = i[1]; + break; + } + if (6 === i[0] && s.label < o[1]) { + s.label = o[1], o = i; + break; + } + if (o && s.label < o[2]) { + s.label = o[2], s.ops.push(i); + break; + } + o[2] && s.ops.pop(), s.trys.pop(); + continue; + } + i = t.call(e, s); + } catch (e) { + i = [ + 6, + e + ], r = 0; + } finally { + n = o = 0; + } + if (5 & i[0]) + throw i[1]; + return { + value: i[0] ? i[1] : void 0, + done: !0 + }; + }([ + i, + a + ]); + }; + } + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var s = n(30), a = n(14), u = n(131), c = n(15), f = function (e) { + function t(n) { + var r = e.call(this) || this; + r.isReady_ = !1, r.isLatest = !1; + var o = t.baseUrl; + if (r.lang_ = t.DEFAULT_LANGUAGE, r.isVendorList(n)) + r.populate(n), r.readyPromise = Promise.resolve(); + else { + if (!o) + throw new a.GVLError('must specify GVL.baseUrl before loading GVL json'); + if (n > 0) { + var i = n; + t.CACHE.has(i) ? (r.populate(t.CACHE.get(i)), r.readyPromise = Promise.resolve()) : (o += t.versionedFilename.replace('[VERSION]', i + ''), r.readyPromise = r.fetchJson(o)); + } else + t.CACHE.has(t.LATEST_CACHE_KEY) ? (r.populate(t.CACHE.get(t.LATEST_CACHE_KEY)), r.readyPromise = Promise.resolve()) : (r.isLatest = !0, r.readyPromise = r.fetchJson(o + t.latestFilename)); + } + return r; + } + return r(t, e), Object.defineProperty(t, 'baseUrl', { + get: function () { + return this.baseUrl_; + }, + set: function (e) { + if (/^https?:\/\/vendorlist\.consensu\.org\//.test(e)) + throw new a.GVLError('Invalid baseUrl! You may not pull directly from vendorlist.consensu.org and must provide your own cache'); + e.length > 0 && '/' !== e[e.length - 1] && (e += '/'), this.baseUrl_ = e; + }, + enumerable: !0, + configurable: !0 + }), t.emptyLanguageCache = function (e) { + var n = !1; + return void 0 === e && t.LANGUAGE_CACHE.size > 0 ? (t.LANGUAGE_CACHE = new Map(), n = !0) : 'string' == typeof e && this.consentLanguages.has(e.toUpperCase()) && (t.LANGUAGE_CACHE.delete(e.toUpperCase()), n = !0), n; + }, t.emptyCache = function (e) { + var n = !1; + return Number.isInteger(e) && e >= 0 ? (t.CACHE.delete(e), n = !0) : void 0 === e && (t.CACHE = new Map(), n = !0), n; + }, t.prototype.cacheLanguage = function () { + t.LANGUAGE_CACHE.has(this.lang_) || t.LANGUAGE_CACHE.set(this.lang_, { + purposes: this.purposes, + specialPurposes: this.specialPurposes, + features: this.features, + specialFeatures: this.specialFeatures, + stacks: this.stacks + }); + }, t.prototype.fetchJson = function (e) { + return o(this, void 0, void 0, function () { + var t, n; + return i(this, function (r) { + switch (r.label) { + case 0: + return r.trys.push([ + 0, + 2, + , + 3 + ]), t = this.populate, [ + 4, + u.Json.fetch(e) + ]; + case 1: + return t.apply(this, [r.sent()]), [ + 3, + 3 + ]; + case 2: + throw n = r.sent(), new a.GVLError(n.message); + case 3: + return [2]; + } + }); + }); + }, t.prototype.getJson = function () { + return JSON.parse(JSON.stringify({ + gvlSpecificationVersion: this.gvlSpecificationVersion, + vendorListVersion: this.vendorListVersion, + tcfPolicyVersion: this.tcfPolicyVersion, + lastUpdated: this.lastUpdated, + purposes: this.purposes, + specialPurposes: this.specialPurposes, + features: this.features, + specialFeatures: this.specialFeatures, + stacks: this.stacks, + vendors: this.fullVendorList + })); + }, t.prototype.changeLanguage = function (e) { + return o(this, void 0, void 0, function () { + var n, r, o, s, u; + return i(this, function (i) { + switch (i.label) { + case 0: + if (n = e.toUpperCase(), !t.consentLanguages.has(n)) + return [ + 3, + 6 + ]; + if (n === this.lang_) + return [ + 3, + 5 + ]; + if (this.lang_ = n, !t.LANGUAGE_CACHE.has(n)) + return [ + 3, + 1 + ]; + for (o in r = t.LANGUAGE_CACHE.get(n)) + r.hasOwnProperty(o) && (this[o] = r[o]); + return [ + 3, + 5 + ]; + case 1: + s = t.baseUrl + t.languageFilename.replace('[LANG]', e), i.label = 2; + case 2: + return i.trys.push([ + 2, + 4, + , + 5 + ]), [ + 4, + this.fetchJson(s) + ]; + case 3: + return i.sent(), this.cacheLanguage(), [ + 3, + 5 + ]; + case 4: + throw u = i.sent(), new a.GVLError('unable to load language: ' + u.message); + case 5: + return [ + 3, + 7 + ]; + case 6: + throw new a.GVLError('unsupported language ' + e); + case 7: + return [2]; + } + }); + }); + }, Object.defineProperty(t.prototype, 'language', { + get: function () { + return this.lang_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.isVendorList = function (e) { + return void 0 !== e && void 0 !== e.vendors; + }, t.prototype.populate = function (e) { + this.purposes = e.purposes, this.specialPurposes = e.specialPurposes, this.features = e.features, this.specialFeatures = e.specialFeatures, this.stacks = e.stacks, this.isVendorList(e) && (this.gvlSpecificationVersion = e.gvlSpecificationVersion, this.tcfPolicyVersion = e.tcfPolicyVersion, this.vendorListVersion = e.vendorListVersion, this.lastUpdated = e.lastUpdated, 'string' == typeof this.lastUpdated && (this.lastUpdated = new Date(this.lastUpdated)), this.vendors_ = e.vendors, this.fullVendorList = e.vendors, this.mapVendors(), this.isReady_ = !0, this.isLatest && t.CACHE.set(t.LATEST_CACHE_KEY, this.getJson()), t.CACHE.has(this.vendorListVersion) || t.CACHE.set(this.vendorListVersion, this.getJson())), this.cacheLanguage(); + }, t.prototype.mapVendors = function (e) { + var t = this; + this.byPurposeVendorMap = {}, this.bySpecialPurposeVendorMap = {}, this.byFeatureVendorMap = {}, this.bySpecialFeatureVendorMap = {}, Object.keys(this.purposes).forEach(function (e) { + t.byPurposeVendorMap[e] = { + legInt: new Set(), + consent: new Set(), + flexible: new Set() + }; + }), Object.keys(this.specialPurposes).forEach(function (e) { + t.bySpecialPurposeVendorMap[e] = new Set(); + }), Object.keys(this.features).forEach(function (e) { + t.byFeatureVendorMap[e] = new Set(); + }), Object.keys(this.specialFeatures).forEach(function (e) { + t.bySpecialFeatureVendorMap[e] = new Set(); + }), Array.isArray(e) || (e = Object.keys(this.fullVendorList).map(function (e) { + return +e; + })), this.vendorIds = new Set(e), this.vendors_ = e.reduce(function (e, n) { + var r = t.vendors_['' + n]; + return r && void 0 === r.deletedDate && (r.purposes.forEach(function (e) { + t.byPurposeVendorMap[e + ''].consent.add(n); + }), r.specialPurposes.forEach(function (e) { + t.bySpecialPurposeVendorMap[e + ''].add(n); + }), r.legIntPurposes.forEach(function (e) { + t.byPurposeVendorMap[e + ''].legInt.add(n); + }), r.flexiblePurposes && r.flexiblePurposes.forEach(function (e) { + t.byPurposeVendorMap[e + ''].flexible.add(n); + }), r.features.forEach(function (e) { + t.byFeatureVendorMap[e + ''].add(n); + }), r.specialFeatures.forEach(function (e) { + t.bySpecialFeatureVendorMap[e + ''].add(n); + }), e[n] = r), e; + }, {}); + }, t.prototype.getFilteredVendors = function (e, t, n, r) { + var o = this, i = e.charAt(0).toUpperCase() + e.slice(1), s = {}; + return ('purpose' === e && n ? this['by' + i + 'VendorMap'][t + ''][n] : this['by' + (r ? 'Special' : '') + i + 'VendorMap'][t + '']).forEach(function (e) { + s[e + ''] = o.vendors[e + '']; + }), s; + }, t.prototype.getVendorsWithConsentPurpose = function (e) { + return this.getFilteredVendors('purpose', e, 'consent'); + }, t.prototype.getVendorsWithLegIntPurpose = function (e) { + return this.getFilteredVendors('purpose', e, 'legInt'); + }, t.prototype.getVendorsWithFlexiblePurpose = function (e) { + return this.getFilteredVendors('purpose', e, 'flexible'); + }, t.prototype.getVendorsWithSpecialPurpose = function (e) { + return this.getFilteredVendors('purpose', e, void 0, !0); + }, t.prototype.getVendorsWithFeature = function (e) { + return this.getFilteredVendors('feature', e); + }, t.prototype.getVendorsWithSpecialFeature = function (e) { + return this.getFilteredVendors('feature', e, void 0, !0); + }, Object.defineProperty(t.prototype, 'vendors', { + get: function () { + return this.vendors_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.narrowVendorsTo = function (e) { + this.mapVendors(e); + }, Object.defineProperty(t.prototype, 'isReady', { + get: function () { + return this.isReady_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.clone = function () { + return new t(this.getJson()); + }, t.isInstanceOf = function (e) { + return 'object' == typeof e && 'function' == typeof e.narrowVendorsTo; + }, t.LANGUAGE_CACHE = new Map(), t.CACHE = new Map(), t.LATEST_CACHE_KEY = 0, t.DEFAULT_LANGUAGE = 'EN', t.consentLanguages = new c.ConsentLanguages(), t.latestFilename = 'vendor-list.json', t.versionedFilename = 'archives/vendor-list-v[VERSION].json', t.languageFilename = 'purposes-[LANG].json', t; + }(s.Cloneable); + t.GVL = f; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.absCall = function (e, t, n, r) { + return new Promise(function (o, i) { + const $___old_346d208e4aa760e0 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_1be2b2d37eff3f5b = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_346d208e4aa760e0) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_5a84e19b2122ba96.XMLHttpRequest)); + if ($___old_1be2b2d37eff3f5b) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_5a84e19b2122ba96.XMLHttpRequest)); + return function () { + var s = new XMLHttpRequest(); + s.withCredentials = n, s.addEventListener('load', function () { + const $___old_c6b2f0bcd813be05 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_c6b2f0bcd813be05) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_5a84e19b2122ba96.XMLHttpRequest)); + return function () { + if (s.readyState == XMLHttpRequest.DONE) + if (s.status >= 200 && s.status < 300) { + var e = s.response; + if ('string' == typeof e) + try { + e = JSON.parse(e); + } catch (e) { + } + o(e); + } else + i(new Error('HTTP Status: ' + s.status + ' response type: ' + s.responseType)); + }.apply(this, arguments); + } finally { + if ($___old_c6b2f0bcd813be05) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_c6b2f0bcd813be05)); + } + }), s.addEventListener('error', function () { + i(new Error('error')); + }), s.addEventListener('abort', function () { + i(new Error('aborted')); + }), null === t ? s.open('GET', e, !0) : s.open('POST', e, !0), s.responseType = 'json', s.timeout = r, s.ontimeout = function () { + i(new Error('Timeout ' + r + 'ms ' + e)); + }, s.send(t); + }.apply(this, arguments); + } finally { + if ($___old_346d208e4aa760e0) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_346d208e4aa760e0)); + if ($___old_1be2b2d37eff3f5b) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_1be2b2d37eff3f5b)); + } + }); + }, e.post = function (e, t, n, r) { + return void 0 === n && (n = !1), void 0 === r && (r = 0), this.absCall(e, JSON.stringify(t), n, r); + }, e.fetch = function (e, t, n) { + return void 0 === t && (t = !1), void 0 === n && (n = 0), this.absCall(e, null, t, n); + }, e; + }(); + t.Json = r; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(30), i = n(14), s = n(130), a = n(15), u = function (e) { + function t(t) { + var n = e.call(this) || this; + return n.isServiceSpecific_ = !1, n.supportOOB_ = !0, n.useNonStandardStacks_ = !1, n.purposeOneTreatment_ = !1, n.publisherCountryCode_ = 'AA', n.version_ = 2, n.consentScreen_ = 0, n.policyVersion_ = 2, n.consentLanguage_ = 'EN', n.cmpId_ = 0, n.cmpVersion_ = 0, n.vendorListVersion_ = 0, n.numCustomPurposes_ = 0, n.specialFeatureOptins = new a.Vector(), n.purposeConsents = new a.Vector(), n.purposeLegitimateInterests = new a.Vector(), n.publisherConsents = new a.Vector(), n.publisherLegitimateInterests = new a.Vector(), n.publisherCustomConsents = new a.Vector(), n.publisherCustomLegitimateInterests = new a.Vector(), n.vendorConsents = new a.Vector(), n.vendorLegitimateInterests = new a.Vector(), n.vendorsDisclosed = new a.Vector(), n.vendorsAllowed = new a.Vector(), n.publisherRestrictions = new a.PurposeRestrictionVector(), t && (n.gvl = t), n.created = new Date(), n.updated(), n; + } + return r(t, e), Object.defineProperty(t.prototype, 'gvl', { + get: function () { + return this.gvl_; + }, + set: function (e) { + s.GVL.isInstanceOf(e) || (e = new s.GVL(e)), this.gvl_ = e, this.publisherRestrictions.gvl = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'cmpId', { + get: function () { + return this.cmpId_; + }, + set: function (e) { + if (!(Number.isInteger(+e) && e > 1)) + throw new i.TCModelError('cmpId', e); + this.cmpId_ = +e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'cmpVersion', { + get: function () { + return this.cmpVersion_; + }, + set: function (e) { + if (!(Number.isInteger(+e) && e > -1)) + throw new i.TCModelError('cmpVersion', e); + this.cmpVersion_ = +e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'consentScreen', { + get: function () { + return this.consentScreen_; + }, + set: function (e) { + if (!(Number.isInteger(+e) && e > -1)) + throw new i.TCModelError('consentScreen', e); + this.consentScreen_ = +e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'consentLanguage', { + get: function () { + return this.consentLanguage_; + }, + set: function (e) { + this.consentLanguage_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'publisherCountryCode', { + get: function () { + return this.publisherCountryCode_; + }, + set: function (e) { + if (!/^([A-z]){2}$/.test(e)) + throw new i.TCModelError('publisherCountryCode', e); + this.publisherCountryCode_ = e.toUpperCase(); + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'vendorListVersion', { + get: function () { + return this.gvl ? this.gvl.vendorListVersion : this.vendorListVersion_; + }, + set: function (e) { + if ((e = +e >> 0) < 0) + throw new i.TCModelError('vendorListVersion', e); + this.vendorListVersion_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'policyVersion', { + get: function () { + return this.gvl ? this.gvl.tcfPolicyVersion : this.policyVersion_; + }, + set: function (e) { + if (this.policyVersion_ = parseInt(e, 10), this.policyVersion_ < 0) + throw new i.TCModelError('policyVersion', e); + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'version', { + get: function () { + return this.version_; + }, + set: function (e) { + this.version_ = parseInt(e, 10); + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'isServiceSpecific', { + get: function () { + return this.isServiceSpecific_; + }, + set: function (e) { + this.isServiceSpecific_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'useNonStandardStacks', { + get: function () { + return this.useNonStandardStacks_; + }, + set: function (e) { + this.useNonStandardStacks_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'supportOOB', { + get: function () { + return this.supportOOB_; + }, + set: function (e) { + this.supportOOB_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'purposeOneTreatment', { + get: function () { + return this.purposeOneTreatment_; + }, + set: function (e) { + this.purposeOneTreatment_ = e; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.setAllVendorConsents = function () { + this.vendorConsents.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorConsents = function () { + this.vendorConsents.empty(); + }, t.prototype.setAllVendorsDisclosed = function () { + this.vendorsDisclosed.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorsDisclosed = function () { + this.vendorsDisclosed.empty(); + }, t.prototype.setAllVendorsAllowed = function () { + this.vendorsAllowed.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorsAllowed = function () { + this.vendorsAllowed.empty(); + }, t.prototype.setAllVendorLegitimateInterests = function () { + this.vendorLegitimateInterests.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorLegitimateInterests = function () { + this.vendorLegitimateInterests.empty(); + }, t.prototype.setAllPurposeConsents = function () { + this.purposeConsents.set(this.gvl.purposes); + }, t.prototype.unsetAllPurposeConsents = function () { + this.purposeConsents.empty(); + }, t.prototype.setAllPurposeLegitimateInterests = function () { + this.purposeLegitimateInterests.set(this.gvl.purposes); + }, t.prototype.unsetAllPurposeLegitimateInterests = function () { + this.purposeLegitimateInterests.empty(); + }, t.prototype.setAllSpecialFeatureOptins = function () { + this.specialFeatureOptins.set(this.gvl.specialFeatures); + }, t.prototype.unsetAllSpecialFeatureOptins = function () { + this.specialFeatureOptins.empty(); + }, t.prototype.setAll = function () { + this.setAllVendorConsents(), this.setAllPurposeLegitimateInterests(), this.setAllSpecialFeatureOptins(), this.setAllPurposeConsents(), this.setAllVendorLegitimateInterests(); + }, t.prototype.unsetAll = function () { + this.unsetAllVendorConsents(), this.unsetAllPurposeLegitimateInterests(), this.unsetAllSpecialFeatureOptins(), this.unsetAllPurposeConsents(), this.unsetAllVendorLegitimateInterests(); + }, Object.defineProperty(t.prototype, 'numCustomPurposes', { + get: function () { + var e = this.numCustomPurposes_; + if ('object' == typeof this.customPurposes) { + var t = Object.keys(this.customPurposes).sort(function (e, t) { + return +e - +t; + }); + e = parseInt(t.pop(), 10); + } + return e; + }, + set: function (e) { + if (this.numCustomPurposes_ = parseInt(e, 10), this.numCustomPurposes_ < 0) + throw new i.TCModelError('numCustomPurposes', e); + }, + enumerable: !0, + configurable: !0 + }), t.prototype.updated = function () { + this.lastUpdated = new Date(); + }, t.consentLanguages = s.GVL.consentLanguages, t; + }(o.Cloneable); + t.TCModel = u; + }, + function (e, t) { + }, + function (e, t) { + }, + function (e, t) { + }, + function (e, t) { + }, + function (e, t) { + e.exports = [ + 'en', + 'fr', + 'de', + 'it', + 'es', + 'da', + 'nl', + 'el', + 'hu', + 'pt', + 'ro', + 'fi', + 'pl', + 'sk', + 'sv', + 'no', + 'ru', + 'bg', + 'ca', + 'cs', + 'et', + 'hr', + 'lt', + 'lv', + 'mt', + 'sl', + 'tr', + 'zh' + ]; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e, t) { + return function () { + for (var n = new Array(arguments.length), r = 0; r < n.length; r++) + n[r] = arguments[r]; + return e.apply(t, n); + }; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + function o(e) { + return encodeURIComponent(e).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']'); + } + e.exports = function (e, t, n) { + if (!t) + return e; + var i; + if (n) + i = n(t); + else if (r.isURLSearchParams(t)) + i = t.toString(); + else { + var s = []; + r.forEach(t, function (e, t) { + null !== e && 'undefined' !== typeof e && (r.isArray(e) ? t += '[]' : e = [e], r.forEach(e, function (e) { + r.isDate(e) ? e = e.toISOString() : r.isObject(e) && (e = JSON.stringify(e)), s.push(o(t) + '=' + o(e)); + })); + }), i = s.join('&'); + } + if (i) { + var a = e.indexOf('#'); + -1 !== a && (e = e.slice(0, a)), e += (-1 === e.indexOf('?') ? '?' : '&') + i; + } + return e; + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e) { + return !(!e || !e.__CANCEL__); + }; + }, + function (e, t, n) { + 'use strict'; + (function (t) { + var r = n(16), o = n(293), i = { 'Content-Type': 'application/x-www-form-urlencoded' }; + function s(e, t) { + !r.isUndefined(e) && r.isUndefined(e['Content-Type']) && (e['Content-Type'] = t); + } + var a = { + adapter: function () { + const $___old_e1d57aadd5ec6eb5 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_e1d57aadd5ec6eb5) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_5a84e19b2122ba96.XMLHttpRequest)); + return function () { + var e; + return ('undefined' !== typeof XMLHttpRequest || 'undefined' !== typeof t && '[object process]' === Object.prototype.toString.call(t)) && (e = n(142)), e; + }.apply(this, arguments); + } finally { + if ($___old_e1d57aadd5ec6eb5) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_e1d57aadd5ec6eb5)); + } + }(), + transformRequest: [function (e, t) { + return o(t, 'Accept'), o(t, 'Content-Type'), r.isFormData(e) || r.isArrayBuffer(e) || r.isBuffer(e) || r.isStream(e) || r.isFile(e) || r.isBlob(e) ? e : r.isArrayBufferView(e) ? e.buffer : r.isURLSearchParams(e) ? (s(t, 'application/x-www-form-urlencoded;charset=utf-8'), e.toString()) : r.isObject(e) ? (s(t, 'application/json;charset=utf-8'), JSON.stringify(e)) : e; + }], + transformResponse: [function (e) { + if ('string' === typeof e) + try { + e = JSON.parse(e); + } catch (t) { + } + return e; + }], + timeout: 0, + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + maxContentLength: -1, + validateStatus: function (e) { + return e >= 200 && e < 300; + }, + headers: { common: { Accept: 'application/json, text/plain, */*' } } + }; + r.forEach([ + 'delete', + 'get', + 'head' + ], function (e) { + a.headers[e] = {}; + }), r.forEach([ + 'post', + 'put', + 'patch' + ], function (e) { + a.headers[e] = r.merge(i); + }), e.exports = a; + }.call(this, n(292))); + }, + function (e, t, n) { + 'use strict'; + var r = n(16), o = n(294), i = n(139), s = n(296), a = n(299), u = n(300), c = n(143); + e.exports = function (e) { + return new Promise(function (t, f) { + const $___old_82b113a8c1542772 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_f0618a77af959552 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_82b113a8c1542772) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_5a84e19b2122ba96.XMLHttpRequest)); + if ($___old_f0618a77af959552) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_5a84e19b2122ba96.XMLHttpRequest)); + return function () { + var l = e.data, p = e.headers; + r.isFormData(l) && delete p['Content-Type']; + var d = new XMLHttpRequest(); + if (e.auth) { + var h = e.auth.username || '', v = e.auth.password || ''; + p.Authorization = 'Basic ' + btoa(h + ':' + v); + } + var y = s(e.baseURL, e.url); + if (d.open(e.method.toUpperCase(), i(y, e.params, e.paramsSerializer), !0), d.timeout = e.timeout, d.onreadystatechange = function () { + if (d && 4 === d.readyState && (0 !== d.status || d.responseURL && 0 === d.responseURL.indexOf('file:'))) { + var n = 'getAllResponseHeaders' in d ? a(d.getAllResponseHeaders()) : null, r = { + data: e.responseType && 'text' !== e.responseType ? d.response : d.responseText, + status: d.status, + statusText: d.statusText, + headers: n, + config: e, + request: d + }; + o(t, f, r), d = null; + } + }, d.onabort = function () { + d && (f(c('Request aborted', e, 'ECONNABORTED', d)), d = null); + }, d.onerror = function () { + f(c('Network Error', e, null, d)), d = null; + }, d.ontimeout = function () { + var t = 'timeout of ' + e.timeout + 'ms exceeded'; + e.timeoutErrorMessage && (t = e.timeoutErrorMessage), f(c(t, e, 'ECONNABORTED', d)), d = null; + }, r.isStandardBrowserEnv()) { + var g = n(301), m = (e.withCredentials || u(y)) && e.xsrfCookieName ? g.read(e.xsrfCookieName) : void 0; + m && (p[e.xsrfHeaderName] = m); + } + if ('setRequestHeader' in d && r.forEach(p, function (e, t) { + 'undefined' === typeof l && 'content-type' === t.toLowerCase() ? delete p[t] : d.setRequestHeader(t, e); + }), r.isUndefined(e.withCredentials) || (d.withCredentials = !!e.withCredentials), e.responseType) + try { + d.responseType = e.responseType; + } catch (b) { + if ('json' !== e.responseType) + throw b; + } + 'function' === typeof e.onDownloadProgress && d.addEventListener('progress', e.onDownloadProgress), 'function' === typeof e.onUploadProgress && d.upload && d.upload.addEventListener('progress', e.onUploadProgress), e.cancelToken && e.cancelToken.promise.then(function (e) { + d && (d.abort(), f(e), d = null); + }), void 0 === l && (l = null), d.send(l); + }.apply(this, arguments); + } finally { + if ($___old_82b113a8c1542772) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_82b113a8c1542772)); + if ($___old_f0618a77af959552) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_f0618a77af959552)); + } + }); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(295); + e.exports = function (e, t, n, o, i) { + var s = new Error(e); + return r(s, t, n, o, i); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + e.exports = function (e, t) { + t = t || {}; + var n = {}, o = [ + 'url', + 'method', + 'params', + 'data' + ], i = [ + 'headers', + 'auth', + 'proxy' + ], s = [ + 'baseURL', + 'url', + 'transformRequest', + 'transformResponse', + 'paramsSerializer', + 'timeout', + 'withCredentials', + 'adapter', + 'responseType', + 'xsrfCookieName', + 'xsrfHeaderName', + 'onUploadProgress', + 'onDownloadProgress', + 'maxContentLength', + 'validateStatus', + 'maxRedirects', + 'httpAgent', + 'httpsAgent', + 'cancelToken', + 'socketPath' + ]; + r.forEach(o, function (e) { + 'undefined' !== typeof t[e] && (n[e] = t[e]); + }), r.forEach(i, function (o) { + r.isObject(t[o]) ? n[o] = r.deepMerge(e[o], t[o]) : 'undefined' !== typeof t[o] ? n[o] = t[o] : r.isObject(e[o]) ? n[o] = r.deepMerge(e[o]) : 'undefined' !== typeof e[o] && (n[o] = e[o]); + }), r.forEach(s, function (r) { + 'undefined' !== typeof t[r] ? n[r] = t[r] : 'undefined' !== typeof e[r] && (n[r] = e[r]); + }); + var a = o.concat(i).concat(s), u = Object.keys(t).filter(function (e) { + return -1 === a.indexOf(e); + }); + return r.forEach(u, function (r) { + 'undefined' !== typeof t[r] ? n[r] = t[r] : 'undefined' !== typeof e[r] && (n[r] = e[r]); + }), n; + }; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + this.message = e; + } + r.prototype.toString = function () { + return 'Cancel' + (this.message ? ': ' + this.message : ''); + }, r.prototype.__CANCEL__ = !0, e.exports = r; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(113)), r(n(51)), r(n(53)), r(n(265)); + var o = n(117); + t.API_KEY = o.API_KEY; + }, + function (e, t, n) { + e.exports = n(287); + }, + function (e, t, n) { + e.exports = function e(t, n, r) { + function o(s, a) { + if (!n[s]) { + if (!t[s]) { + if (i) + return i(s, !0); + throw new Error('Cannot find module \'' + s + '\''); + } + var u = n[s] = { exports: {} }; + t[s][0].call(u.exports, function (e) { + return o(t[s][1][e] || e); + }, u, u.exports, e, t, n, r); + } + return n[s].exports; + } + for (var i = !1, s = 0; s < r.length; s++) + o(r[s]); + return o; + }({ + 1: [ + function (e, t, n) { + (function (r, o, i, s, a, u, c, f, l) { + 'use strict'; + var p = e('crypto'); + function d(e, t) { + return function (e, t) { + var n; + if (void 0 === (n = 'passthrough' !== t.algorithm ? p.createHash(t.algorithm) : new b()).write && (n.write = n.update, n.end = n.update), m(t, n).dispatch(e), n.update || n.end(''), n.digest) + return n.digest('buffer' === t.encoding ? void 0 : t.encoding); + var r = n.read(); + return 'buffer' !== t.encoding ? r.toString(t.encoding) : r; + }(e, t = y(e, t)); + } + (n = t.exports = d).sha1 = function (e) { + return d(e); + }, n.keys = function (e) { + return d(e, { + excludeValues: !0, + algorithm: 'sha1', + encoding: 'hex' + }); + }, n.MD5 = function (e) { + return d(e, { + algorithm: 'md5', + encoding: 'hex' + }); + }, n.keysMD5 = function (e) { + return d(e, { + algorithm: 'md5', + encoding: 'hex', + excludeValues: !0 + }); + }; + var h = p.getHashes ? p.getHashes().slice() : [ + 'sha1', + 'md5' + ]; + h.push('passthrough'); + var v = [ + 'buffer', + 'hex', + 'binary', + 'base64' + ]; + function y(e, t) { + t = t || {}; + var n = {}; + if (n.algorithm = t.algorithm || 'sha1', n.encoding = t.encoding || 'hex', n.excludeValues = !!t.excludeValues, n.algorithm = n.algorithm.toLowerCase(), n.encoding = n.encoding.toLowerCase(), n.ignoreUnknown = !0 === t.ignoreUnknown, n.respectType = !1 !== t.respectType, n.respectFunctionNames = !1 !== t.respectFunctionNames, n.respectFunctionProperties = !1 !== t.respectFunctionProperties, n.unorderedArrays = !0 === t.unorderedArrays, n.unorderedSets = !1 !== t.unorderedSets, n.unorderedObjects = !1 !== t.unorderedObjects, n.replacer = t.replacer || void 0, n.excludeKeys = t.excludeKeys || void 0, void 0 === e) + throw new Error('Object argument required.'); + for (var r = 0; r < h.length; ++r) + h[r].toLowerCase() === n.algorithm.toLowerCase() && (n.algorithm = h[r]); + if (-1 === h.indexOf(n.algorithm)) + throw new Error('Algorithm "' + n.algorithm + '" not supported. supported values: ' + h.join(', ')); + if (-1 === v.indexOf(n.encoding) && 'passthrough' !== n.algorithm) + throw new Error('Encoding "' + n.encoding + '" not supported. supported values: ' + v.join(', ')); + return n; + } + function g(e) { + if ('function' == typeof e) + return null != /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(e)); + } + function m(e, t, n) { + function r(e) { + return t.update ? t.update(e, 'utf8') : t.write(e, 'utf8'); + } + return n = n || [], { + dispatch: function (t) { + e.replacer && (t = e.replacer(t)); + var n = typeof t; + return null === t && (n = 'null'), this['_' + n](t); + }, + _object: function (t) { + var o, s = Object.prototype.toString.call(t), a = /\[object (.*)\]/i.exec(s); + if (a = (a = a ? a[1] : 'unknown:[' + s + ']').toLowerCase(), 0 <= (o = n.indexOf(t))) + return this.dispatch('[CIRCULAR:' + o + ']'); + if (n.push(t), void 0 !== i && i.isBuffer && i.isBuffer(t)) + return r('buffer:'), r(t); + if ('object' === a || 'function' === a || 'asyncfunction' === a) { + var u = Object.keys(t); + e.unorderedObjects && (u = u.sort()), !1 === e.respectType || g(t) || u.splice(0, 0, 'prototype', '__proto__', 'constructor'), e.excludeKeys && (u = u.filter(function (t) { + return !e.excludeKeys(t); + })), r('object:' + u.length + ':'); + var c = this; + return u.forEach(function (n) { + c.dispatch(n), r(':'), e.excludeValues || c.dispatch(t[n]), r(','); + }); + } + if (!this['_' + a]) { + if (e.ignoreUnknown) + return r('[' + a + ']'); + throw new Error('Unknown object type "' + a + '"'); + } + this['_' + a](t); + }, + _array: function (t, o) { + o = void 0 !== o ? o : !1 !== e.unorderedArrays; + var i = this; + if (r('array:' + t.length + ':'), !o || t.length <= 1) + return t.forEach(function (e) { + return i.dispatch(e); + }); + var s = [], a = t.map(function (t) { + var r = new b(), o = n.slice(); + return m(e, r, o).dispatch(t), s = s.concat(o.slice(n.length)), r.read().toString(); + }); + return n = n.concat(s), a.sort(), this._array(a, !1); + }, + _date: function (e) { + return r('date:' + e.toJSON()); + }, + _symbol: function (e) { + return r('symbol:' + e.toString()); + }, + _error: function (e) { + return r('error:' + e.toString()); + }, + _boolean: function (e) { + return r('bool:' + e.toString()); + }, + _string: function (e) { + r('string:' + e.length + ':'), r(e.toString()); + }, + _function: function (t) { + r('fn:'), g(t) ? this.dispatch('[native]') : this.dispatch(t.toString()), !1 !== e.respectFunctionNames && this.dispatch('function-name:' + String(t.name)), e.respectFunctionProperties && this._object(t); + }, + _number: function (e) { + return r('number:' + e.toString()); + }, + _xml: function (e) { + return r('xml:' + e.toString()); + }, + _null: function () { + return r('Null'); + }, + _undefined: function () { + return r('Undefined'); + }, + _regexp: function (e) { + return r('regex:' + e.toString()); + }, + _uint8array: function (e) { + return r('uint8array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _uint8clampedarray: function (e) { + return r('uint8clampedarray:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _int8array: function (e) { + return r('uint8array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _uint16array: function (e) { + return r('uint16array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _int16array: function (e) { + return r('uint16array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _uint32array: function (e) { + return r('uint32array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _int32array: function (e) { + return r('uint32array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _float32array: function (e) { + return r('float32array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _float64array: function (e) { + return r('float64array:'), this.dispatch(Array.prototype.slice.call(e)); + }, + _arraybuffer: function (e) { + return r('arraybuffer:'), this.dispatch(new Uint8Array(e)); + }, + _url: function (e) { + return r('url:' + e.toString()); + }, + _map: function (t) { + r('map:'); + var n = Array.from(t); + return this._array(n, !1 !== e.unorderedSets); + }, + _set: function (t) { + r('set:'); + var n = Array.from(t); + return this._array(n, !1 !== e.unorderedSets); + }, + _blob: function () { + if (e.ignoreUnknown) + return r('[blob]'); + throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n'); + }, + _domwindow: function () { + return r('domwindow'); + }, + _process: function () { + return r('process'); + }, + _timer: function () { + return r('timer'); + }, + _pipe: function () { + return r('pipe'); + }, + _tcp: function () { + return r('tcp'); + }, + _udp: function () { + return r('udp'); + }, + _tty: function () { + return r('tty'); + }, + _statwatcher: function () { + return r('statwatcher'); + }, + _securecontext: function () { + return r('securecontext'); + }, + _connection: function () { + return r('connection'); + }, + _zlib: function () { + return r('zlib'); + }, + _context: function () { + return r('context'); + }, + _nodescript: function () { + return r('nodescript'); + }, + _httpparser: function () { + return r('httpparser'); + }, + _dataview: function () { + return r('dataview'); + }, + _signal: function () { + return r('signal'); + }, + _fsevent: function () { + return r('fsevent'); + }, + _tlswrap: function () { + return r('tlswrap'); + } + }; + } + function b() { + return { + buf: '', + write: function (e) { + this.buf += e; + }, + end: function (e) { + this.buf += e; + }, + read: function () { + return this.buf; + } + }; + } + n.writeToStream = function (e, t, n) { + return void 0 === n && (n = t, t = {}), m(t = y(e, t), n).dispatch(e); + }; + }.call(this, e('lYpoI2'), 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : {}, e('buffer').Buffer, arguments[3], arguments[4], arguments[5], arguments[6], '/fake_794fcf4d.js', '/')); + }, + { + buffer: 3, + crypto: 5, + lYpoI2: 10 + } + ], + 2: [ + function (e, t, n) { + (function (e, t, r, o, i, s, a, u, c) { + !function (e) { + 'use strict'; + var t = 'undefined' != typeof Uint8Array ? Uint8Array : Array, n = '+'.charCodeAt(0), r = '/'.charCodeAt(0), o = '0'.charCodeAt(0), i = 'a'.charCodeAt(0), s = 'A'.charCodeAt(0), a = '-'.charCodeAt(0), u = '_'.charCodeAt(0); + function c(e) { + var t = e.charCodeAt(0); + return t === n || t === a ? 62 : t === r || t === u ? 63 : t < o ? -1 : t < o + 10 ? t - o + 26 + 26 : t < s + 26 ? t - s : t < i + 26 ? t - i + 26 : void 0; + } + e.toByteArray = function (e) { + var n, r, o, i, s; + if (0 < e.length % 4) + throw new Error('Invalid string. Length must be a multiple of 4'); + var a = e.length; + i = '=' === e.charAt(a - 2) ? 2 : '=' === e.charAt(a - 1) ? 1 : 0, s = new t(3 * e.length / 4 - i), r = 0 < i ? e.length - 4 : e.length; + var u = 0; + function f(e) { + s[u++] = e; + } + for (n = 0; n < r; n += 4, 0) + f((16711680 & (o = c(e.charAt(n)) << 18 | c(e.charAt(n + 1)) << 12 | c(e.charAt(n + 2)) << 6 | c(e.charAt(n + 3)))) >> 16), f((65280 & o) >> 8), f(255 & o); + return 2 == i ? f(255 & (o = c(e.charAt(n)) << 2 | c(e.charAt(n + 1)) >> 4)) : 1 == i && (f((o = c(e.charAt(n)) << 10 | c(e.charAt(n + 1)) << 4 | c(e.charAt(n + 2)) >> 2) >> 8 & 255), f(255 & o)), s; + }, e.fromByteArray = function (e) { + var t, n, r, o, i = e.length % 3, s = ''; + function a(e) { + return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(e); + } + for (t = 0, r = e.length - i; t < r; t += 3) + s += a((o = n = (e[t] << 16) + (e[t + 1] << 8) + e[t + 2]) >> 18 & 63) + a(o >> 12 & 63) + a(o >> 6 & 63) + a(63 & o); + switch (i) { + case 1: + s += a((n = e[e.length - 1]) >> 2), s += a(n << 4 & 63), s += '=='; + break; + case 2: + s += a((n = (e[e.length - 2] << 8) + e[e.length - 1]) >> 10), s += a(n >> 4 & 63), s += a(n << 2 & 63), s += '='; + } + return s; + }; + }(void 0 === n ? this.base64js = {} : n); + }.call(this, e('lYpoI2'), 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : {}, e('buffer').Buffer, arguments[3], arguments[4], arguments[5], arguments[6], '/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js', '/node_modules/gulp-browserify/node_modules/base64-js/lib')); + }, + { + buffer: 3, + lYpoI2: 10 + } + ], + 3: [ + function (e, t, n) { + (function (t, r, o, i, s, a, u, c, f) { + var l = e('base64-js'), p = e('ieee754'); + function o(e, t, n) { + if (!(this instanceof o)) + return new o(e, t, n); + var r, i, s, a, u, c = typeof e; + if ('base64' === t && 'string' == c) + for (e = (r = e).trim ? r.trim() : r.replace(/^\s+|\s+$/g, ''); e.length % 4 != 0;) + e += '='; + if ('number' == c) + i = P(e); + else if ('string' == c) + i = o.byteLength(e, t); + else { + if ('object' != c) + throw new Error('First argument needs to be a number, array or string.'); + i = P(e.length); + } + if (o._useTypedArrays ? s = o._augment(new Uint8Array(i)) : ((s = this).length = i, s._isBuffer = !0), o._useTypedArrays && 'number' == typeof e.byteLength) + s._set(e); + else if (T(u = e) || o.isBuffer(u) || u && 'object' == typeof u && 'number' == typeof u.length) + for (a = 0; a < i; a++) + o.isBuffer(e) ? s[a] = e.readUInt8(a) : s[a] = e[a]; + else if ('string' == c) + s.write(e, 0, t); + else if ('number' == c && !o._useTypedArrays && !n) + for (a = 0; a < i; a++) + s[a] = 0; + return s; + } + function d(e, t, n, r) { + return o._charsWritten = N(function (e) { + for (var t = [], n = 0; n < e.length; n++) + t.push(255 & e.charCodeAt(n)); + return t; + }(t), e, n, r); + } + function h(e, t, n) { + var r = ''; + n = Math.min(e.length, n); + for (var o = t; o < n; o++) + r += String.fromCharCode(e[o]); + return r; + } + function v(e, t, n, r) { + r || (M('boolean' == typeof n, 'missing or invalid endian'), M(null != t, 'missing offset'), M(t + 1 < e.length, 'Trying to read beyond buffer length')); + var o, i = e.length; + if (!(i <= t)) + return n ? (o = e[t], t + 1 < i && (o |= e[t + 1] << 8)) : (o = e[t] << 8, t + 1 < i && (o |= e[t + 1])), o; + } + function y(e, t, n, r) { + r || (M('boolean' == typeof n, 'missing or invalid endian'), M(null != t, 'missing offset'), M(t + 3 < e.length, 'Trying to read beyond buffer length')); + var o, i = e.length; + if (!(i <= t)) + return n ? (t + 2 < i && (o = e[t + 2] << 16), t + 1 < i && (o |= e[t + 1] << 8), o |= e[t], t + 3 < i && (o += e[t + 3] << 24 >>> 0)) : (t + 1 < i && (o = e[t + 1] << 16), t + 2 < i && (o |= e[t + 2] << 8), t + 3 < i && (o |= e[t + 3]), o += e[t] << 24 >>> 0), o; + } + function g(e, t, n, r) { + if (r || (M('boolean' == typeof n, 'missing or invalid endian'), M(null != t, 'missing offset'), M(t + 1 < e.length, 'Trying to read beyond buffer length')), !(e.length <= t)) { + var o = v(e, t, n, !0); + return 32768 & o ? -1 * (65535 - o + 1) : o; + } + } + function m(e, t, n, r) { + if (r || (M('boolean' == typeof n, 'missing or invalid endian'), M(null != t, 'missing offset'), M(t + 3 < e.length, 'Trying to read beyond buffer length')), !(e.length <= t)) { + var o = y(e, t, n, !0); + return 2147483648 & o ? -1 * (4294967295 - o + 1) : o; + } + } + function b(e, t, n, r) { + return r || (M('boolean' == typeof n, 'missing or invalid endian'), M(t + 3 < e.length, 'Trying to read beyond buffer length')), p.read(e, t, n, 23, 4); + } + function E(e, t, n, r) { + return r || (M('boolean' == typeof n, 'missing or invalid endian'), M(t + 7 < e.length, 'Trying to read beyond buffer length')), p.read(e, t, n, 52, 8); + } + function C(e, t, n, r, o) { + o || (M(null != t, 'missing value'), M('boolean' == typeof r, 'missing or invalid endian'), M(null != n, 'missing offset'), M(n + 1 < e.length, 'trying to write beyond buffer length'), U(t, 65535)); + var i = e.length; + if (!(i <= n)) + for (var s = 0, a = Math.min(i - n, 2); s < a; s++) + e[n + s] = (t & 255 << 8 * (r ? s : 1 - s)) >>> 8 * (r ? s : 1 - s); + } + function _(e, t, n, r, o) { + o || (M(null != t, 'missing value'), M('boolean' == typeof r, 'missing or invalid endian'), M(null != n, 'missing offset'), M(n + 3 < e.length, 'trying to write beyond buffer length'), U(t, 4294967295)); + var i = e.length; + if (!(i <= n)) + for (var s = 0, a = Math.min(i - n, 4); s < a; s++) + e[n + s] = t >>> 8 * (r ? s : 3 - s) & 255; + } + function S(e, t, n, r, o) { + o || (M(null != t, 'missing value'), M('boolean' == typeof r, 'missing or invalid endian'), M(null != n, 'missing offset'), M(n + 1 < e.length, 'Trying to write beyond buffer length'), j(t, 32767, -32768)), e.length <= n || C(e, 0 <= t ? t : 65535 + t + 1, n, r, o); + } + function w(e, t, n, r, o) { + o || (M(null != t, 'missing value'), M('boolean' == typeof r, 'missing or invalid endian'), M(null != n, 'missing offset'), M(n + 3 < e.length, 'Trying to write beyond buffer length'), j(t, 2147483647, -2147483648)), e.length <= n || _(e, 0 <= t ? t : 4294967295 + t + 1, n, r, o); + } + function I(e, t, n, r, o) { + o || (M(null != t, 'missing value'), M('boolean' == typeof r, 'missing or invalid endian'), M(null != n, 'missing offset'), M(n + 3 < e.length, 'Trying to write beyond buffer length'), B(t, 3.4028234663852886e+38, -3.4028234663852886e+38)), e.length <= n || p.write(e, t, n, r, 23, 4); + } + function O(e, t, n, r, o) { + o || (M(null != t, 'missing value'), M('boolean' == typeof r, 'missing or invalid endian'), M(null != n, 'missing offset'), M(n + 7 < e.length, 'Trying to write beyond buffer length'), B(t, 1.7976931348623157e+308, -1.7976931348623157e+308)), e.length <= n || p.write(e, t, n, r, 52, 8); + } + n.Buffer = o, n.SlowBuffer = o, n.INSPECT_MAX_BYTES = 50, o.poolSize = 8192, o._useTypedArrays = function () { + try { + var e = new ArrayBuffer(0), t = new Uint8Array(e); + return t.foo = function () { + return 42; + }, 42 === t.foo() && 'function' == typeof t.subarray; + } catch (e) { + return !1; + } + }(), o.isEncoding = function (e) { + switch (String(e).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'binary': + case 'base64': + case 'raw': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return !0; + default: + return !1; + } + }, o.isBuffer = function (e) { + return !(null == e || !e._isBuffer); + }, o.byteLength = function (e, t) { + var n; + switch (e += '', t || 'utf8') { + case 'hex': + n = e.length / 2; + break; + case 'utf8': + case 'utf-8': + n = x(e).length; + break; + case 'ascii': + case 'binary': + case 'raw': + n = e.length; + break; + case 'base64': + n = R(e).length; + break; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + n = 2 * e.length; + break; + default: + throw new Error('Unknown encoding'); + } + return n; + }, o.concat = function (e, t) { + if (M(T(e), 'Usage: Buffer.concat(list, [totalLength])\nlist should be an Array.'), 0 === e.length) + return new o(0); + if (1 === e.length) + return e[0]; + var n; + if ('number' != typeof t) + for (n = t = 0; n < e.length; n++) + t += e[n].length; + var r = new o(t), i = 0; + for (n = 0; n < e.length; n++) { + var s = e[n]; + s.copy(r, i), i += s.length; + } + return r; + }, o.prototype.write = function (e, t, n, r) { + if (isFinite(t)) + isFinite(n) || (r = n, n = void 0); + else { + var i = r; + r = t, t = n, n = i; + } + t = Number(t) || 0; + var s, a, u, c, f, l = this.length - t; + switch ((!n || l < (n = Number(n))) && (n = l), r = String(r || 'utf8').toLowerCase()) { + case 'hex': + s = function (e, t, n, r) { + n = Number(n) || 0; + var i = e.length - n; + (!r || i < (r = Number(r))) && (r = i); + var s = t.length; + M(s % 2 == 0, 'Invalid hex string'), s / 2 < r && (r = s / 2); + for (var a = 0; a < r; a++) { + var u = parseInt(t.substr(2 * a, 2), 16); + M(!isNaN(u), 'Invalid hex string'), e[n + a] = u; + } + return o._charsWritten = 2 * a, a; + }(this, e, t, n); + break; + case 'utf8': + case 'utf-8': + c = t, f = n, s = o._charsWritten = N(x(e), this, c, f); + break; + case 'ascii': + case 'binary': + s = d(this, e, t, n); + break; + case 'base64': + a = t, u = n, s = o._charsWritten = N(R(e), this, a, u); + break; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + s = function (e, t, n, r) { + return o._charsWritten = N(function (e) { + for (var t, n, r, o = [], i = 0; i < e.length; i++) + n = (t = e.charCodeAt(i)) >> 8, r = t % 256, o.push(r), o.push(n); + return o; + }(t), e, n, r); + }(this, e, t, n); + break; + default: + throw new Error('Unknown encoding'); + } + return s; + }, o.prototype.toString = function (e, t, n) { + var r, o, i, s, a = this; + if (e = String(e || 'utf8').toLowerCase(), t = Number(t) || 0, (n = void 0 !== n ? Number(n) : n = a.length) === t) + return ''; + switch (e) { + case 'hex': + r = function (e, t, n) { + var r = e.length; + (!t || t < 0) && (t = 0), (!n || n < 0 || r < n) && (n = r); + for (var o = '', i = t; i < n; i++) + o += k(e[i]); + return o; + }(a, t, n); + break; + case 'utf8': + case 'utf-8': + r = function (e, t, n) { + var r = '', o = ''; + n = Math.min(e.length, n); + for (var i = t; i < n; i++) + e[i] <= 127 ? (r += V(o) + String.fromCharCode(e[i]), o = '') : o += '%' + e[i].toString(16); + return r + V(o); + }(a, t, n); + break; + case 'ascii': + case 'binary': + r = h(a, t, n); + break; + case 'base64': + o = a, s = n, r = 0 === (i = t) && s === o.length ? l.fromByteArray(o) : l.fromByteArray(o.slice(i, s)); + break; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + r = function (e, t, n) { + for (var r = e.slice(t, n), o = '', i = 0; i < r.length; i += 2) + o += String.fromCharCode(r[i] + 256 * r[i + 1]); + return o; + }(a, t, n); + break; + default: + throw new Error('Unknown encoding'); + } + return r; + }, o.prototype.toJSON = function () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + }; + }, o.prototype.copy = function (e, t, n, r) { + if (n = n || 0, r || 0 === r || (r = this.length), t = t || 0, r !== n && 0 !== e.length && 0 !== this.length) { + M(n <= r, 'sourceEnd < sourceStart'), M(0 <= t && t < e.length, 'targetStart out of bounds'), M(0 <= n && n < this.length, 'sourceStart out of bounds'), M(0 <= r && r <= this.length, 'sourceEnd out of bounds'), r > this.length && (r = this.length), e.length - t < r - n && (r = e.length - t + n); + var i = r - n; + if (i < 100 || !o._useTypedArrays) + for (var s = 0; s < i; s++) + e[s + t] = this[s + n]; + else + e._set(this.subarray(n, n + i), t); + } + }, o.prototype.slice = function (e, t) { + var n = this.length; + if (e = L(e, n, 0), t = L(t, n, n), o._useTypedArrays) + return o._augment(this.subarray(e, t)); + for (var r = t - e, i = new o(r, void 0, !0), s = 0; s < r; s++) + i[s] = this[s + e]; + return i; + }, o.prototype.get = function (e) { + return console.log('.get() is deprecated. Access using array indexes instead.'), this.readUInt8(e); + }, o.prototype.set = function (e, t) { + return console.log('.set() is deprecated. Access using array indexes instead.'), this.writeUInt8(e, t); + }, o.prototype.readUInt8 = function (e, t) { + if (t || (M(null != e, 'missing offset'), M(e < this.length, 'Trying to read beyond buffer length')), !(e >= this.length)) + return this[e]; + }, o.prototype.readUInt16LE = function (e, t) { + return v(this, e, !0, t); + }, o.prototype.readUInt16BE = function (e, t) { + return v(this, e, !1, t); + }, o.prototype.readUInt32LE = function (e, t) { + return y(this, e, !0, t); + }, o.prototype.readUInt32BE = function (e, t) { + return y(this, e, !1, t); + }, o.prototype.readInt8 = function (e, t) { + if (t || (M(null != e, 'missing offset'), M(e < this.length, 'Trying to read beyond buffer length')), !(e >= this.length)) + return 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e]; + }, o.prototype.readInt16LE = function (e, t) { + return g(this, e, !0, t); + }, o.prototype.readInt16BE = function (e, t) { + return g(this, e, !1, t); + }, o.prototype.readInt32LE = function (e, t) { + return m(this, e, !0, t); + }, o.prototype.readInt32BE = function (e, t) { + return m(this, e, !1, t); + }, o.prototype.readFloatLE = function (e, t) { + return b(this, e, !0, t); + }, o.prototype.readFloatBE = function (e, t) { + return b(this, e, !1, t); + }, o.prototype.readDoubleLE = function (e, t) { + return E(this, e, !0, t); + }, o.prototype.readDoubleBE = function (e, t) { + return E(this, e, !1, t); + }, o.prototype.writeUInt8 = function (e, t, n) { + n || (M(null != e, 'missing value'), M(null != t, 'missing offset'), M(t < this.length, 'trying to write beyond buffer length'), U(e, 255)), t >= this.length || (this[t] = e); + }, o.prototype.writeUInt16LE = function (e, t, n) { + C(this, e, t, !0, n); + }, o.prototype.writeUInt16BE = function (e, t, n) { + C(this, e, t, !1, n); + }, o.prototype.writeUInt32LE = function (e, t, n) { + _(this, e, t, !0, n); + }, o.prototype.writeUInt32BE = function (e, t, n) { + _(this, e, t, !1, n); + }, o.prototype.writeInt8 = function (e, t, n) { + n || (M(null != e, 'missing value'), M(null != t, 'missing offset'), M(t < this.length, 'Trying to write beyond buffer length'), j(e, 127, -128)), t >= this.length || (0 <= e ? this.writeUInt8(e, t, n) : this.writeUInt8(255 + e + 1, t, n)); + }, o.prototype.writeInt16LE = function (e, t, n) { + S(this, e, t, !0, n); + }, o.prototype.writeInt16BE = function (e, t, n) { + S(this, e, t, !1, n); + }, o.prototype.writeInt32LE = function (e, t, n) { + w(this, e, t, !0, n); + }, o.prototype.writeInt32BE = function (e, t, n) { + w(this, e, t, !1, n); + }, o.prototype.writeFloatLE = function (e, t, n) { + I(this, e, t, !0, n); + }, o.prototype.writeFloatBE = function (e, t, n) { + I(this, e, t, !1, n); + }, o.prototype.writeDoubleLE = function (e, t, n) { + O(this, e, t, !0, n); + }, o.prototype.writeDoubleBE = function (e, t, n) { + O(this, e, t, !1, n); + }, o.prototype.fill = function (e, t, n) { + if (e = e || 0, t = t || 0, n = n || this.length, 'string' == typeof e && (e = e.charCodeAt(0)), M('number' == typeof e && !isNaN(e), 'value is not a number'), M(t <= n, 'end < start'), n !== t && 0 !== this.length) { + M(0 <= t && t < this.length, 'start out of bounds'), M(0 <= n && n <= this.length, 'end out of bounds'); + for (var r = t; r < n; r++) + this[r] = e; + } + }, o.prototype.inspect = function () { + for (var e = [], t = this.length, r = 0; r < t; r++) + if (e[r] = k(this[r]), r === n.INSPECT_MAX_BYTES) { + e[r + 1] = '...'; + break; + } + return ''; + }, o.prototype.toArrayBuffer = function () { + if ('undefined' == typeof Uint8Array) + throw new Error('Buffer.toArrayBuffer not supported in this browser'); + if (o._useTypedArrays) + return new o(this).buffer; + for (var e = new Uint8Array(this.length), t = 0, n = e.length; t < n; t += 1) + e[t] = this[t]; + return e.buffer; + }; + var A = o.prototype; + function L(e, t, n) { + return 'number' != typeof e ? n : t <= (e = ~~e) ? t : 0 <= e || 0 <= (e += t) ? e : 0; + } + function P(e) { + return (e = ~~Math.ceil(+e)) < 0 ? 0 : e; + } + function T(e) { + return (Array.isArray || function (e) { + return '[object Array]' === Object.prototype.toString.call(e); + })(e); + } + function k(e) { + return e < 16 ? '0' + e.toString(16) : e.toString(16); + } + function x(e) { + for (var t = [], n = 0; n < e.length; n++) { + var r = e.charCodeAt(n); + if (r <= 127) + t.push(e.charCodeAt(n)); + else { + var o = n; + 55296 <= r && r <= 57343 && n++; + for (var i = encodeURIComponent(e.slice(o, n + 1)).substr(1).split('%'), s = 0; s < i.length; s++) + t.push(parseInt(i[s], 16)); + } + } + return t; + } + function R(e) { + return l.toByteArray(e); + } + function N(e, t, n, r) { + for (var o = 0; o < r && !(o + n >= t.length || o >= e.length); o++) + t[o + n] = e[o]; + return o; + } + function V(e) { + try { + return decodeURIComponent(e); + } catch (e) { + return String.fromCharCode(65533); + } + } + function U(e, t) { + M('number' == typeof e, 'cannot write a non-number as a number'), M(0 <= e, 'specified a negative value for writing an unsigned value'), M(e <= t, 'value is larger than maximum value for type'), M(Math.floor(e) === e, 'value has a fractional component'); + } + function j(e, t, n) { + M('number' == typeof e, 'cannot write a non-number as a number'), M(e <= t, 'value larger than maximum allowed value'), M(n <= e, 'value smaller than minimum allowed value'), M(Math.floor(e) === e, 'value has a fractional component'); + } + function B(e, t, n) { + M('number' == typeof e, 'cannot write a non-number as a number'), M(e <= t, 'value larger than maximum allowed value'), M(n <= e, 'value smaller than minimum allowed value'); + } + function M(e, t) { + if (!e) + throw new Error(t || 'Failed assertion'); + } + o._augment = function (e) { + return e._isBuffer = !0, e._get = e.get, e._set = e.set, e.get = A.get, e.set = A.set, e.write = A.write, e.toString = A.toString, e.toLocaleString = A.toString, e.toJSON = A.toJSON, e.copy = A.copy, e.slice = A.slice, e.readUInt8 = A.readUInt8, e.readUInt16LE = A.readUInt16LE, e.readUInt16BE = A.readUInt16BE, e.readUInt32LE = A.readUInt32LE, e.readUInt32BE = A.readUInt32BE, e.readInt8 = A.readInt8, e.readInt16LE = A.readInt16LE, e.readInt16BE = A.readInt16BE, e.readInt32LE = A.readInt32LE, e.readInt32BE = A.readInt32BE, e.readFloatLE = A.readFloatLE, e.readFloatBE = A.readFloatBE, e.readDoubleLE = A.readDoubleLE, e.readDoubleBE = A.readDoubleBE, e.writeUInt8 = A.writeUInt8, e.writeUInt16LE = A.writeUInt16LE, e.writeUInt16BE = A.writeUInt16BE, e.writeUInt32LE = A.writeUInt32LE, e.writeUInt32BE = A.writeUInt32BE, e.writeInt8 = A.writeInt8, e.writeInt16LE = A.writeInt16LE, e.writeInt16BE = A.writeInt16BE, e.writeInt32LE = A.writeInt32LE, e.writeInt32BE = A.writeInt32BE, e.writeFloatLE = A.writeFloatLE, e.writeFloatBE = A.writeFloatBE, e.writeDoubleLE = A.writeDoubleLE, e.writeDoubleBE = A.writeDoubleBE, e.fill = A.fill, e.inspect = A.inspect, e.toArrayBuffer = A.toArrayBuffer, e; + }; + }.call(this, e('lYpoI2'), 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : {}, e('buffer').Buffer, arguments[3], arguments[4], arguments[5], arguments[6], '/node_modules/gulp-browserify/node_modules/buffer/index.js', '/node_modules/gulp-browserify/node_modules/buffer')); + }, + { + 'base64-js': 2, + buffer: 3, + ieee754: 11, + lYpoI2: 10 + } + ], + 4: [ + function (e, t, n) { + (function (n, r, o, i, s, a, u, c, f) { + var l = new (o = (e('buffer')).Buffer)(4); + l.fill(0), t.exports = { + hash: function (e, t, n, r) { + return o.isBuffer(e) || (e = new o(e)), function (e, t, n) { + for (var r = new o(t), i = n ? r.writeInt32BE : r.writeInt32LE, s = 0; s < e.length; s++) + i.call(r, e[s], 4 * s, !0); + return r; + }(t(function (e, t) { + if (e.length % 4 != 0) { + var n = e.length + (4 - e.length % 4); + e = o.concat([ + e, + l + ], n); + } + for (var r = [], i = t ? e.readInt32BE : e.readInt32LE, s = 0; s < e.length; s += 4) + r.push(i.call(e, s)); + return r; + }(e, r), 8 * e.length), n, r); + } + }; + }.call(this, e('lYpoI2'), 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : {}, e('buffer').Buffer, arguments[3], arguments[4], arguments[5], arguments[6], '/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js', '/node_modules/gulp-browserify/node_modules/crypto-browserify')); + }, + { + buffer: 3, + lYpoI2: 10 + } + ], + 5: [ + function (e, t, n) { + (function (t, r, o, i, s, a, u, c, f) { + o = e('buffer').Buffer; + var l = e('./sha'), p = e('./sha256'), d = e('./rng'), h = { + sha1: l, + sha256: p, + md5: e('./md5') + }, v = 64, y = new o(v); + function g(e, t) { + var n = h[e = e || 'sha1'], r = []; + return n || m('algorithm:', e, 'is not yet supported'), { + update: function (e) { + return o.isBuffer(e) || (e = new o(e)), r.push(e), e.length, this; + }, + digest: function (e) { + var i = o.concat(r), s = t ? function (e, t, n) { + o.isBuffer(t) || (t = new o(t)), o.isBuffer(n) || (n = new o(n)), t.length > v ? t = e(t) : t.length < v && (t = o.concat([ + t, + y + ], v)); + for (var r = new o(v), i = new o(v), s = 0; s < v; s++) + r[s] = 54 ^ t[s], i[s] = 92 ^ t[s]; + var a = e(o.concat([ + r, + n + ])); + return e(o.concat([ + i, + a + ])); + }(n, t, i) : n(i); + return r = null, e ? s.toString(e) : s; + } + }; + } + function m() { + var e = [].slice.call(arguments).join(' '); + throw new Error([ + e, + 'we accept pull requests', + 'http://github.com/dominictarr/crypto-browserify' + ].join('\n')); + } + y.fill(0), n.createHash = function (e) { + return g(e); + }, n.createHmac = function (e, t) { + return g(e, t); + }, n.randomBytes = function (e, t) { + if (!t || !t.call) + return new o(d(e)); + try { + t.call(this, void 0, new o(d(e))); + } catch (e) { + t(e); + } + }, function (e, t) { + for (var n in e) + t(e[n]); + }([ + 'createCredentials', + 'createCipher', + 'createCipheriv', + 'createDecipher', + 'createDecipheriv', + 'createSign', + 'createVerify', + 'createDiffieHellman', + 'pbkdf2' + ], function (e) { + n[e] = function () { + m('sorry,', e, 'is not implemented yet'); + }; + }); + }.call(this, e('lYpoI2'), 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : {}, e('buffer').Buffer, arguments[3], arguments[4], arguments[5], arguments[6], '/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js', '/node_modules/gulp-browserify/node_modules/crypto-browserify')); + }, + { + './md5': 6, + './rng': 7, + './sha': 8, + './sha256': 9, + buffer: 3, + lYpoI2: 10 + } + ], + 6: [ + function (e, t, n) { + (function (n, r, o, i, s, a, u, c, f) { + var l = e('./helpers'); + function p(e, t) { + e[t >> 5] |= 128 << t % 32, e[14 + (t + 64 >>> 9 << 4)] = t; + for (var n = 1732584193, r = -271733879, o = -1732584194, i = 271733878, s = 0; s < e.length; s += 16) { + var a = n, u = r, c = o, f = i; + n = h(n, r, o, i, e[s + 0], 7, -680876936), i = h(i, n, r, o, e[s + 1], 12, -389564586), o = h(o, i, n, r, e[s + 2], 17, 606105819), r = h(r, o, i, n, e[s + 3], 22, -1044525330), n = h(n, r, o, i, e[s + 4], 7, -176418897), i = h(i, n, r, o, e[s + 5], 12, 1200080426), o = h(o, i, n, r, e[s + 6], 17, -1473231341), r = h(r, o, i, n, e[s + 7], 22, -45705983), n = h(n, r, o, i, e[s + 8], 7, 1770035416), i = h(i, n, r, o, e[s + 9], 12, -1958414417), o = h(o, i, n, r, e[s + 10], 17, -42063), r = h(r, o, i, n, e[s + 11], 22, -1990404162), n = h(n, r, o, i, e[s + 12], 7, 1804603682), i = h(i, n, r, o, e[s + 13], 12, -40341101), o = h(o, i, n, r, e[s + 14], 17, -1502002290), n = v(n, r = h(r, o, i, n, e[s + 15], 22, 1236535329), o, i, e[s + 1], 5, -165796510), i = v(i, n, r, o, e[s + 6], 9, -1069501632), o = v(o, i, n, r, e[s + 11], 14, 643717713), r = v(r, o, i, n, e[s + 0], 20, -373897302), n = v(n, r, o, i, e[s + 5], 5, -701558691), i = v(i, n, r, o, e[s + 10], 9, 38016083), o = v(o, i, n, r, e[s + 15], 14, -660478335), r = v(r, o, i, n, e[s + 4], 20, -405537848), n = v(n, r, o, i, e[s + 9], 5, 568446438), i = v(i, n, r, o, e[s + 14], 9, -1019803690), o = v(o, i, n, r, e[s + 3], 14, -187363961), r = v(r, o, i, n, e[s + 8], 20, 1163531501), n = v(n, r, o, i, e[s + 13], 5, -1444681467), i = v(i, n, r, o, e[s + 2], 9, -51403784), o = v(o, i, n, r, e[s + 7], 14, 1735328473), n = y(n, r = v(r, o, i, n, e[s + 12], 20, -1926607734), o, i, e[s + 5], 4, -378558), i = y(i, n, r, o, e[s + 8], 11, -2022574463), o = y(o, i, n, r, e[s + 11], 16, 1839030562), r = y(r, o, i, n, e[s + 14], 23, -35309556), n = y(n, r, o, i, e[s + 1], 4, -1530992060), i = y(i, n, r, o, e[s + 4], 11, 1272893353), o = y(o, i, n, r, e[s + 7], 16, -155497632), r = y(r, o, i, n, e[s + 10], 23, -1094730640), n = y(n, r, o, i, e[s + 13], 4, 681279174), i = y(i, n, r, o, e[s + 0], 11, -358537222), o = y(o, i, n, r, e[s + 3], 16, -722521979), r = y(r, o, i, n, e[s + 6], 23, 76029189), n = y(n, r, o, i, e[s + 9], 4, -640364487), i = y(i, n, r, o, e[s + 12], 11, -421815835), o = y(o, i, n, r, e[s + 15], 16, 530742520), n = g(n, r = y(r, o, i, n, e[s + 2], 23, -995338651), o, i, e[s + 0], 6, -198630844), i = g(i, n, r, o, e[s + 7], 10, 1126891415), o = g(o, i, n, r, e[s + 14], 15, -1416354905), r = g(r, o, i, n, e[s + 5], 21, -57434055), n = g(n, r, o, i, e[s + 12], 6, 1700485571), i = g(i, n, r, o, e[s + 3], 10, -1894986606), o = g(o, i, n, r, e[s + 10], 15, -1051523), r = g(r, o, i, n, e[s + 1], 21, -2054922799), n = g(n, r, o, i, e[s + 8], 6, 1873313359), i = g(i, n, r, o, e[s + 15], 10, -30611744), o = g(o, i, n, r, e[s + 6], 15, -1560198380), r = g(r, o, i, n, e[s + 13], 21, 1309151649), n = g(n, r, o, i, e[s + 4], 6, -145523070), i = g(i, n, r, o, e[s + 11], 10, -1120210379), o = g(o, i, n, r, e[s + 2], 15, 718787259), r = g(r, o, i, n, e[s + 9], 21, -343485551), n = m(n, a), r = m(r, u), o = m(o, c), i = m(i, f); + } + return Array(n, r, o, i); + } + function d(e, t, n, r, o, i) { + return m((s = m(m(t, e), m(r, i))) << (a = o) | s >>> 32 - a, n); + var s, a; + } + function h(e, t, n, r, o, i, s) { + return d(t & n | ~t & r, e, t, o, i, s); + } + function v(e, t, n, r, o, i, s) { + return d(t & r | n & ~r, e, t, o, i, s); + } + function y(e, t, n, r, o, i, s) { + return d(t ^ n ^ r, e, t, o, i, s); + } + function g(e, t, n, r, o, i, s) { + return d(n ^ (t | ~r), e, t, o, i, s); + } + function m(e, t) { + var n = (65535 & e) + (65535 & t); + return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n; + } + t.exports = function (e) { + return l.hash(e, p, 16); + }; + }.call(this, e('lYpoI2'), 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : {}, e('buffer').Buffer, arguments[3], arguments[4], arguments[5], arguments[6], '/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js', '/node_modules/gulp-browserify/node_modules/crypto-browserify')); + }, + { + './helpers': 4, + buffer: 3, + lYpoI2: 10 + } + ], + 7: [ + function (e, t, n) { + (function (e, n, r, o, i, s, a, u, c) { + var f; + f = function (e) { + for (var t, n = new Array(e), r = 0; r < e; r++) + 0 == (3 & r) && (t = 4294967296 * Math.random()), n[r] = t >>> ((3 & r) << 3) & 255; + return n; + }, t.exports = f; + }.call(this, e('lYpoI2'), 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : {}, e('buffer').Buffer, arguments[3], arguments[4], arguments[5], arguments[6], '/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js', '/node_modules/gulp-browserify/node_modules/crypto-browserify')); + }, + { + buffer: 3, + lYpoI2: 10 + } + ], + 8: [ + function (e, t, n) { + (function (n, r, o, i, s, a, u, c, f) { + var l = e('./helpers'); + function p(e, t) { + e[t >> 5] |= 128 << 24 - t % 32, e[15 + (t + 64 >> 9 << 4)] = t; + for (var n, r = Array(80), o = 1732584193, i = -271733879, s = -1732584194, a = 271733878, u = -1009589776, c = 0; c < e.length; c += 16) { + for (var f = o, l = i, p = s, y = a, g = u, m = 0; m < 80; m++) { + r[m] = m < 16 ? e[c + m] : v(r[m - 3] ^ r[m - 8] ^ r[m - 14] ^ r[m - 16], 1); + var b = h(h(v(o, 5), d(m, i, s, a)), h(h(u, r[m]), (n = m) < 20 ? 1518500249 : n < 40 ? 1859775393 : n < 60 ? -1894007588 : -899497514)); + u = a, a = s, s = v(i, 30), i = o, o = b; + } + o = h(o, f), i = h(i, l), s = h(s, p), a = h(a, y), u = h(u, g); + } + return Array(o, i, s, a, u); + } + function d(e, t, n, r) { + return e < 20 ? t & n | ~t & r : !(e < 40) && e < 60 ? t & n | t & r | n & r : t ^ n ^ r; + } + function h(e, t) { + var n = (65535 & e) + (65535 & t); + return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n; + } + function v(e, t) { + return e << t | e >>> 32 - t; + } + t.exports = function (e) { + return l.hash(e, p, 20, !0); + }; + }.call(this, e('lYpoI2'), 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : {}, e('buffer').Buffer, arguments[3], arguments[4], arguments[5], arguments[6], '/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js', '/node_modules/gulp-browserify/node_modules/crypto-browserify')); + }, + { + './helpers': 4, + buffer: 3, + lYpoI2: 10 + } + ], + 9: [ + function (e, t, n) { + (function (n, r, o, i, s, a, u, c, f) { + function l(e, t) { + var n = (65535 & e) + (65535 & t); + return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n; + } + function p(e, t) { + return e >>> t | e << 32 - t; + } + function d(e, t) { + return e >>> t; + } + function h(e, t) { + var n, r, o, i, s, a, u, c, f, h, v, y, g, m, b, E, C, _, S = new Array(1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298), w = new Array(1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225), I = new Array(64); + e[t >> 5] |= 128 << 24 - t % 32, e[15 + (t + 64 >> 9 << 4)] = t; + for (var O = 0; O < e.length; O += 16) { + n = w[0], r = w[1], o = w[2], i = w[3], s = w[4], a = w[5], u = w[6], c = w[7]; + for (var A = 0; A < 64; A++) + I[A] = A < 16 ? e[A + O] : l(l(l(p(_ = I[A - 2], 17) ^ p(_, 19) ^ d(_, 10), I[A - 7]), p(C = I[A - 15], 7) ^ p(C, 18) ^ d(C, 3)), I[A - 16]), f = l(l(l(l(c, p(E = s, 6) ^ p(E, 11) ^ p(E, 25)), (b = s) & a ^ ~b & u), S[A]), I[A]), h = l(p(m = n, 2) ^ p(m, 13) ^ p(m, 22), (v = n) & (y = r) ^ v & (g = o) ^ y & g), c = u, u = a, a = s, s = l(i, f), i = o, o = r, r = n, n = l(f, h); + w[0] = l(n, w[0]), w[1] = l(r, w[1]), w[2] = l(o, w[2]), w[3] = l(i, w[3]), w[4] = l(s, w[4]), w[5] = l(a, w[5]), w[6] = l(u, w[6]), w[7] = l(c, w[7]); + } + return w; + } + var v = e('./helpers'); + t.exports = function (e) { + return v.hash(e, h, 32, !0); + }; + }.call(this, e('lYpoI2'), 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : {}, e('buffer').Buffer, arguments[3], arguments[4], arguments[5], arguments[6], '/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js', '/node_modules/gulp-browserify/node_modules/crypto-browserify')); + }, + { + './helpers': 4, + buffer: 3, + lYpoI2: 10 + } + ], + 10: [ + function (e, t, n) { + (function (e, n, r, o, i, s, a, u, c) { + function f() { + } + (e = t.exports = {}).nextTick = function () { + var e = 'undefined' != typeof window && window.setImmediate, t = 'undefined' != typeof window && window.postMessage && window.addEventListener; + if (e) + return function (e) { + return window.setImmediate(e); + }; + if (t) { + var n = []; + return window.addEventListener('message', function (e) { + var t = e.source; + t !== window && null !== t || 'process-tick' !== e.data || (e.stopPropagation(), 0 < n.length && n.shift()()); + }, !0), function (e) { + n.push(e), window.postMessage('process-tick', '*'); + }; + } + return function (e) { + setTimeout(e, 0); + }; + }(), e.title = 'browser', e.browser = !0, e.env = {}, e.argv = [], e.on = f, e.addListener = f, e.once = f, e.off = f, e.removeListener = f, e.removeAllListeners = f, e.emit = f, e.binding = function (e) { + throw new Error('process.binding is not supported'); + }, e.cwd = function () { + return '/'; + }, e.chdir = function (e) { + throw new Error('process.chdir is not supported'); + }; + }.call(this, e('lYpoI2'), 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : {}, e('buffer').Buffer, arguments[3], arguments[4], arguments[5], arguments[6], '/node_modules/gulp-browserify/node_modules/process/browser.js', '/node_modules/gulp-browserify/node_modules/process')); + }, + { + buffer: 3, + lYpoI2: 10 + } + ], + 11: [ + function (e, t, n) { + (function (e, t, r, o, i, s, a, u, c) { + n.read = function (e, t, n, r, o) { + var i, s, a = 8 * o - r - 1, u = (1 << a) - 1, c = u >> 1, f = -7, l = n ? o - 1 : 0, p = n ? -1 : 1, d = e[t + l]; + for (l += p, i = d & (1 << -f) - 1, d >>= -f, f += a; 0 < f; i = 256 * i + e[t + l], l += p, f -= 8); + for (s = i & (1 << -f) - 1, i >>= -f, f += r; 0 < f; s = 256 * s + e[t + l], l += p, f -= 8); + if (0 === i) + i = 1 - c; + else { + if (i === u) + return s ? NaN : 1 / 0 * (d ? -1 : 1); + s += Math.pow(2, r), i -= c; + } + return (d ? -1 : 1) * s * Math.pow(2, i - r); + }, n.write = function (e, t, n, r, o, i) { + var s, a, u, c = 8 * i - o - 1, f = (1 << c) - 1, l = f >> 1, p = 23 === o ? Math.pow(2, -24) - Math.pow(2, -77) : 0, d = r ? 0 : i - 1, h = r ? 1 : -1, v = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0; + for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (a = isNaN(t) ? 1 : 0, s = f) : (s = Math.floor(Math.log(t) / Math.LN2), t * (u = Math.pow(2, -s)) < 1 && (s--, u *= 2), 2 <= (t += 1 <= s + l ? p / u : p * Math.pow(2, 1 - l)) * u && (s++, u /= 2), f <= s + l ? (a = 0, s = f) : 1 <= s + l ? (a = (t * u - 1) * Math.pow(2, o), s += l) : (a = t * Math.pow(2, l - 1) * Math.pow(2, o), s = 0)); 8 <= o; e[n + d] = 255 & a, d += h, a /= 256, o -= 8); + for (s = s << o | a, c += o; 0 < c; e[n + d] = 255 & s, d += h, s /= 256, c -= 8); + e[n + d - h] |= 128 * v; + }; + }.call(this, e('lYpoI2'), 'undefined' != typeof self ? self : 'undefined' != typeof window ? window : {}, e('buffer').Buffer, arguments[3], arguments[4], arguments[5], arguments[6], '/node_modules/ieee754/index.js', '/node_modules/ieee754')); + }, + { + buffer: 3, + lYpoI2: 10 + } + ] + }, {}, [1])(1); + }, + function (e, t) { + e.exports = 'data:image/svg+xml,%3Csvg viewBox=\'0 0 16 17\' version=\'1.1\' xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\' style=\'margin-right: 5px; height: 17px;\'%3E%3Cg id=\'Page-1\' stroke=\'none\' stroke-width=\'1\' fill=\'none\' fill-rule=\'evenodd\'%3E%3Cg id=\'cog\' fill=\'%23FFFFFF\' fill-rule=\'nonzero\'%3E%3Cpath d=\'M15.596917,9.98326938 L14.5041079,9.33798816 C14.5728064,8.7815386 14.5728064,8.2184614 14.5041079,7.66201184 L15.596917,7.01673062 C15.9178229,6.82726259 16.0726124,6.43742732 15.9670848,6.0741546 C15.5912871,4.78033611 14.9223646,3.61573153 14.0390021,2.66061113 C13.7831755,2.38401797 13.3749053,2.32348965 13.0525249,2.51384881 L11.9613243,3.15813608 C11.5248519,2.81840117 11.0481221,2.53648663 10.542482,2.31910255 L10.542482,1.02991108 C10.542482,0.648438733 10.2860522,0.316869683 9.92305592,0.229024792 C8.66155,-0.07632446 7.33871809,-0.0763587342 6.07694408,0.229024792 C5.71398131,0.316869683 5.457518,0.648404458 5.457518,1.02991108 L5.457518,2.31910255 C4.95187406,2.53647872 4.47514334,2.81839382 4.03867572,3.15813608 L2.94747511,2.51384881 C2.62506122,2.32348965 2.21679094,2.38401797 1.96099786,2.66061113 C1.07763542,3.61573153 0.40871289,4.78037038 0.0329152236,6.0741546 C-0.072612407,6.43742732 0.0821770899,6.82722832 0.403082962,7.01673062 L1.49589212,7.66201184 C1.42719356,8.2184614 1.42719356,8.7815386 1.49589212,9.33798816 L0.403082962,9.98326938 C0.0821770899,10.1727374 -0.072612407,10.5625727 0.0329152236,10.9258454 C0.40871289,12.2196296 1.07763542,13.3842685 1.96099786,14.3393889 C2.21682445,14.615982 2.62509474,14.6765103 2.94747511,14.4861855 L4.03867572,13.8418982 C4.47514096,14.1816349 4.95187243,14.4635389 5.457518,14.6808975 L5.457518,15.9700889 C5.457518,16.3515613 5.7139478,16.6831303 6.07694408,16.7709752 C7.33848351,17.0763245 8.66128191,17.0763587 9.92305592,16.7709752 C10.2860187,16.6831303 10.542482,16.3515955 10.542482,15.9700889 L10.542482,14.6808975 C11.0481183,14.4635198 11.5248475,14.1816171 11.9613243,13.8418982 L13.0525249,14.4861855 C13.3749053,14.6765446 13.7831755,14.6160163 14.0390021,14.3393889 C14.9223646,13.3842685 15.5912871,12.2196296 15.9670848,10.9258454 C16.0726124,10.5625727 15.9178229,10.1727717 15.596917,9.98326938 Z M13.4026193,13.4264943 L11.8507364,12.510001 C10.9463288,13.3007421 10.6255905,13.4997041 9.47011484,13.9172673 L9.47011484,15.7502196 C8.50024808,15.9548373 7.49975192,15.9548373 6.52988516,15.7502196 L6.52988516,13.9172673 C5.4031959,13.5101235 5.07699522,13.3210668 4.14926358,12.510001 L2.59738075,13.4264943 C1.9368696,12.6693763 1.43490124,11.7817076 1.12525522,10.8230912 L2.67780828,9.90659789 C2.4588108,8.69270694 2.45871027,8.30790999 2.67780828,7.09340211 L1.12525522,6.17690879 C1.43490124,5.21829242 1.93690311,4.33058946 2.59738075,3.57312864 L4.14926358,4.49030745 C5.0667072,3.68712478 5.39129933,3.4941265 6.52988516,3.08269846 L6.52988516,1.24978037 C7.49971774,1.04482059 8.50028226,1.04482059 9.47011484,1.24978037 L9.47011484,3.08273274 C10.6087677,3.49419505 10.9333933,3.6872276 11.8507364,4.49034172 L13.4026193,3.57316291 C14.0630969,4.33058946 14.5650988,5.21829242 14.8747448,6.17694306 L13.3221917,7.09343638 C13.5412227,8.3076358 13.5412897,8.69212428 13.3221917,9.90663217 L14.8747448,10.8231255 C14.5650988,11.7817076 14.0631304,12.6694105 13.4026193,13.4264943 Z M8,5.20968958 C6.22607014,5.20968958 4.78289853,6.68570996 4.78289853,8.50001714 C4.78289853,10.3143243 6.22607014,11.7903447 8,11.7903447 C9.77392986,11.7903447 11.2171015,10.3143243 11.2171015,8.50001714 C11.2171015,6.68570996 9.77392986,5.20968958 8,5.20968958 Z M8,10.6935688 C6.81738009,10.6935688 5.85526568,9.70955526 5.85526568,8.50001714 C5.85526568,7.29047902 6.81738009,6.30646543 8,6.30646543 C9.18261991,6.30646543 10.1447343,7.29047902 10.1447343,8.50001714 C10.1447343,9.70955526 9.18261991,10.6935688 8,10.6935688 Z\' id=\'Shape\'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E'; + }, + function (e, t, n) { + n(151), e.exports = n(304); + }, + function (e, t, n) { + 'use strict'; + n.r(t); + n(152), n(159), n(160), n(161), n(162), n(163), n(164), n(165), n(166), n(167), n(168), n(169), n(170), n(171), n(172), n(174), n(175), n(177), n(180), n(181), n(182), n(183), n(189), n(190), n(192), n(193), n(195), n(196), n(199), n(200), n(201), n(203), n(205), n(207), n(208), n(210), n(211), n(212), n(213), n(214), n(215), n(216), n(217), n(219), n(220), n(221), n(222), n(223), n(224), n(225), n(226), n(227), n(228), n(230), n(232), n(233), n(235), n(236), n(237), n(238), n(239), n(240), n(241), n(242), n(243), n(244), n(245), n(246), n(247), n(248), n(249), n(250), n(251), n(252), n(253), n(254), n(255); + void 0 === function () { + return arguments[Symbol.iterator]; + }() && Object.defineProperty && Object.defineProperty(Object.prototype, Symbol.iterator, { + get: function () { + return '[object Arguments]' === [].toString.call(this) ? [][Symbol.iterator] : this.__Symbol_iterator; + }, + set: function (e) { + Object.defineProperty(this, '__Symbol_iterator', { + configurable: !0, + value: e, + writable: !0 + }); + } + }), Number.isInteger = Number.isInteger || function (e) { + return 'number' === typeof e && isFinite(e) && Math.floor(e) === e; + }, Number.isNaN = Number.isNaN || function (e) { + return 'number' === typeof e && e !== e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(6), i = n(9), s = n(3), a = n(17), u = n(66), c = n(87), f = n(11), l = n(13), p = n(47), d = n(12), h = n(2), v = n(27), y = n(26), g = n(44), m = n(32), b = n(39), E = n(48), C = n(62), _ = n(158), S = n(64), w = n(35), I = n(18), O = n(43), A = n(22), L = n(23), P = n(61), T = n(45), k = n(37), x = n(46), R = n(7), N = n(89), V = n(10), U = n(28), j = n(34), B = n(90).forEach, M = T('hidden'), D = R('toPrimitive'), F = j.set, G = j.getterFor('Symbol'), H = Object.prototype, q = o.Symbol, Y = i('JSON', 'stringify'), z = w.f, W = I.f, J = _.f, K = O.f, Q = P('symbols'), Z = P('op-symbols'), X = P('string-to-symbol-registry'), $ = P('symbol-to-string-registry'), ee = P('wks'), te = o.QObject, ne = !te || !te.prototype || !te.prototype.findChild, re = a && f(function () { + return 7 != b(W({}, 'a', { + get: function () { + return W(this, 'a', { value: 7 }).a; + } + })).a; + }) ? function (e, t, n) { + var r = z(H, t); + r && delete H[t], W(e, t, n), r && e !== H && W(H, t, r); + } : W, oe = function (e, t) { + var n = Q[e] = b(q.prototype); + return F(n, { + type: 'Symbol', + tag: e, + description: t + }), a || (n.description = t), n; + }, ie = c ? function (e) { + return 'symbol' == typeof e; + } : function (e) { + return Object(e) instanceof q; + }, se = function (e, t, n) { + e === H && se(Z, t, n), h(e); + var r = g(t, !0); + return h(n), l(Q, r) ? (n.enumerable ? (l(e, M) && e[M][r] && (e[M][r] = !1), n = b(n, { enumerable: m(0, !1) })) : (l(e, M) || W(e, M, m(1, {})), e[M][r] = !0), re(e, r, n)) : W(e, r, n); + }, ae = function (e, t) { + h(e); + var n = y(t), r = E(n).concat(le(n)); + return B(r, function (t) { + a && !ue.call(n, t) || se(e, t, n[t]); + }), e; + }, ue = function (e) { + var t = g(e, !0), n = K.call(this, t); + return !(this === H && l(Q, t) && !l(Z, t)) && (!(n || !l(this, t) || !l(Q, t) || l(this, M) && this[M][t]) || n); + }, ce = function (e, t) { + var n = y(e), r = g(t, !0); + if (n !== H || !l(Q, r) || l(Z, r)) { + var o = z(n, r); + return !o || !l(Q, r) || l(n, M) && n[M][r] || (o.enumerable = !0), o; + } + }, fe = function (e) { + var t = J(y(e)), n = []; + return B(t, function (e) { + l(Q, e) || l(k, e) || n.push(e); + }), n; + }, le = function (e) { + var t = e === H, n = J(t ? Z : y(e)), r = []; + return B(n, function (e) { + !l(Q, e) || t && !l(H, e) || r.push(Q[e]); + }), r; + }; + (u || (L((q = function () { + if (this instanceof q) + throw TypeError('Symbol is not a constructor'); + var e = arguments.length && void 0 !== arguments[0] ? String(arguments[0]) : void 0, t = x(e), n = function e(n) { + this === H && e.call(Z, n), l(this, M) && l(this[M], t) && (this[M][t] = !1), re(this, t, m(1, n)); + }; + return a && ne && re(H, t, { + configurable: !0, + set: n + }), oe(t, e); + }).prototype, 'toString', function () { + return G(this).tag; + }), L(q, 'withoutSetter', function (e) { + return oe(x(e), e); + }), O.f = ue, I.f = se, w.f = ce, C.f = _.f = fe, S.f = le, N.f = function (e) { + return oe(R(e), e); + }, a && (W(q.prototype, 'description', { + configurable: !0, + get: function () { + return G(this).description; + } + }), s || L(H, 'propertyIsEnumerable', ue, { unsafe: !0 }))), r({ + global: !0, + wrap: !0, + forced: !u, + sham: !u + }, { Symbol: q }), B(E(ee), function (e) { + V(e); + }), r({ + target: 'Symbol', + stat: !0, + forced: !u + }, { + for: function (e) { + var t = String(e); + if (l(X, t)) + return X[t]; + var n = q(t); + return X[t] = n, $[n] = t, n; + }, + keyFor: function (e) { + if (!ie(e)) + throw TypeError(e + ' is not a symbol'); + if (l($, e)) + return $[e]; + }, + useSetter: function () { + ne = !0; + }, + useSimple: function () { + ne = !1; + } + }), r({ + target: 'Object', + stat: !0, + forced: !u, + sham: !a + }, { + create: function (e, t) { + return void 0 === t ? b(e) : ae(b(e), t); + }, + defineProperty: se, + defineProperties: ae, + getOwnPropertyDescriptor: ce + }), r({ + target: 'Object', + stat: !0, + forced: !u + }, { + getOwnPropertyNames: fe, + getOwnPropertySymbols: le + }), r({ + target: 'Object', + stat: !0, + forced: f(function () { + S.f(1); + }) + }, { + getOwnPropertySymbols: function (e) { + return S.f(v(e)); + } + }), Y) && r({ + target: 'JSON', + stat: !0, + forced: !u || f(function () { + var e = q(); + return '[null]' != Y([e]) || '{}' != Y({ a: e }) || '{}' != Y(Object(e)); + }) + }, { + stringify: function (e, t, n) { + for (var r, o = [e], i = 1; arguments.length > i;) + o.push(arguments[i++]); + if (r = t, (d(t) || void 0 !== e) && !ie(e)) + return p(t) || (t = function (e, t) { + if ('function' == typeof r && (t = r.call(this, e, t)), !ie(t)) + return t; + }), o[1] = t, Y.apply(null, o); + } + }); + q.prototype[D] || A(q.prototype, D, q.prototype.valueOf), U(q, 'Symbol'), k[M] = !0; + }, + function (e, t) { + var n; + n = function () { + return this; + }(); + try { + n = n || new Function('return this')(); + } catch (r) { + 'object' === typeof window && (n = window); + } + e.exports = n; + }, + function (e, t, n) { + var r = n(6), o = n(59), i = r.WeakMap; + e.exports = 'function' === typeof i && /native code/.test(o(i)); + }, + function (e, t, n) { + var r = n(9), o = n(62), i = n(64), s = n(2); + e.exports = r('Reflect', 'ownKeys') || function (e) { + var t = o.f(s(e)), n = i.f; + return n ? t.concat(n(e)) : t; + }; + }, + function (e, t, n) { + var r = n(38), o = Math.max, i = Math.min; + e.exports = function (e, t) { + var n = r(e); + return n < 0 ? o(n + t, 0) : i(n, t); + }; + }, + function (e, t, n) { + var r = n(17), o = n(18), i = n(2), s = n(48); + e.exports = r ? Object.defineProperties : function (e, t) { + i(e); + for (var n, r = s(t), a = r.length, u = 0; a > u;) + o.f(e, n = r[u++], t[n]); + return e; + }; + }, + function (e, t, n) { + var r = n(26), o = n(62).f, i = {}.toString, s = 'object' == typeof window && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; + e.exports.f = function (e) { + return s && '[object Window]' == i.call(e) ? function (e) { + try { + return o(e); + } catch (t) { + return s.slice(); + } + }(e) : o(r(e)); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(17), i = n(6), s = n(13), a = n(12), u = n(18).f, c = n(83), f = i.Symbol; + if (o && 'function' == typeof f && (!('description' in f.prototype) || void 0 !== f().description)) { + var l = {}, p = function () { + var e = arguments.length < 1 || void 0 === arguments[0] ? void 0 : String(arguments[0]), t = this instanceof p ? new f(e) : void 0 === e ? f() : f(e); + return '' === e && (l[t] = !0), t; + }; + c(p, f); + var d = p.prototype = f.prototype; + d.constructor = p; + var h = d.toString, v = 'Symbol(test)' == String(f('test')), y = /^Symbol\((.*)\)[^)]+$/; + u(d, 'description', { + configurable: !0, + get: function () { + var e = a(this) ? this.valueOf() : this, t = h.call(e); + if (s(l, e)) + return ''; + var n = v ? t.slice(7, -1) : t.replace(y, '$1'); + return '' === n ? void 0 : n; + } + }), r({ + global: !0, + forced: !0 + }, { Symbol: p }); + } + }, + function (e, t, n) { + n(10)('asyncIterator'); + }, + function (e, t, n) { + n(10)('hasInstance'); + }, + function (e, t, n) { + n(10)('isConcatSpreadable'); + }, + function (e, t, n) { + n(10)('iterator'); + }, + function (e, t, n) { + n(10)('match'); + }, + function (e, t, n) { + n(10)('replace'); + }, + function (e, t, n) { + n(10)('search'); + }, + function (e, t, n) { + n(10)('species'); + }, + function (e, t, n) { + n(10)('split'); + }, + function (e, t, n) { + n(10)('toPrimitive'); + }, + function (e, t, n) { + n(10)('toStringTag'); + }, + function (e, t, n) { + n(10)('unscopables'); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(11), i = n(47), s = n(12), a = n(27), u = n(24), c = n(91), f = n(67), l = n(173), p = n(7), d = n(68), h = p('isConcatSpreadable'), v = d >= 51 || !o(function () { + var e = []; + return e[h] = !1, e.concat()[0] !== e; + }), y = l('concat'), g = function (e) { + if (!s(e)) + return !1; + var t = e[h]; + return void 0 !== t ? !!t : i(e); + }; + r({ + target: 'Array', + proto: !0, + forced: !v || !y + }, { + concat: function (e) { + var t, n, r, o, i, s = a(this), l = f(s, 0), p = 0; + for (t = -1, r = arguments.length; t < r; t++) + if (g(i = -1 === t ? s : arguments[t])) { + if (p + (o = u(i.length)) > 9007199254740991) + throw TypeError('Maximum allowed index exceeded'); + for (n = 0; n < o; n++, p++) + n in i && c(l, p, i[n]); + } else { + if (p >= 9007199254740991) + throw TypeError('Maximum allowed index exceeded'); + c(l, p++, i); + } + return l.length = p, l; + } + }); + }, + function (e, t, n) { + var r = n(11), o = n(7), i = n(68), s = o('species'); + e.exports = function (e) { + return i >= 51 || !r(function () { + var t = []; + return (t.constructor = {})[s] = function () { + return { foo: 1 }; + }, 1 !== t[e](Boolean).foo; + }); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(90).find, i = n(49), s = n(93), a = !0, u = s('find'); + 'find' in [] && Array(1).find(function () { + a = !1; + }), r({ + target: 'Array', + proto: !0, + forced: a || !u + }, { + find: function (e) { + return o(this, e, arguments.length > 1 ? arguments[1] : void 0); + } + }), i('find'); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(176), i = n(27), s = n(24), a = n(38), u = n(67); + r({ + target: 'Array', + proto: !0 + }, { + flat: function () { + var e = arguments.length ? arguments[0] : void 0, t = i(this), n = s(t.length), r = u(t, 0); + return r.length = o(r, t, t, n, 0, void 0 === e ? 1 : a(e)), r; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(47), o = n(24), i = n(8); + e.exports = function e(t, n, s, a, u, c, f, l) { + for (var p, d = u, h = 0, v = !!f && i(f, l, 3); h < a;) { + if (h in s) { + if (p = v ? v(s[h], h, n) : s[h], c > 0 && r(p)) + d = e(t, n, p, o(p.length), d, c - 1) - 1; + else { + if (d >= 9007199254740991) + throw TypeError('Exceed the acceptable array length'); + t[d] = p; + } + d++; + } + h++; + } + return d; + }; + }, + function (e, t, n) { + var r = n(1), o = n(178); + r({ + target: 'Array', + stat: !0, + forced: !n(71)(function (e) { + Array.from(e); + }) + }, { from: o }); + }, + function (e, t, n) { + 'use strict'; + var r = n(8), o = n(27), i = n(179), s = n(95), a = n(24), u = n(91), c = n(69); + e.exports = function (e) { + var t, n, f, l, p, d, h = o(e), v = 'function' == typeof this ? this : Array, y = arguments.length, g = y > 1 ? arguments[1] : void 0, m = void 0 !== g, b = c(h), E = 0; + if (m && (g = r(g, y > 2 ? arguments[2] : void 0, 2)), void 0 == b || v == Array && s(b)) + for (n = new v(t = a(h.length)); t > E; E++) + d = m ? g(h[E], E) : h[E], u(n, E, d); + else + for (p = (l = b.call(h)).next, n = new v(); !(f = p.call(l)).done; E++) + d = m ? i(l, g, [ + f.value, + E + ], !0) : f.value, u(n, E, d); + return n.length = E, n; + }; + }, + function (e, t, n) { + var r = n(2), o = n(94); + e.exports = function (e, t, n, i) { + try { + return i ? t(r(n)[0], n[1]) : t(n); + } catch (s) { + throw o(e), s; + } + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(86).includes, i = n(49); + r({ + target: 'Array', + proto: !0, + forced: !n(93)('indexOf', { + ACCESSORS: !0, + 1: 0 + }) + }, { + includes: function (e) { + return o(this, e, arguments.length > 1 ? arguments[1] : void 0); + } + }), i('includes'); + }, + function (e, t, n) { + n(49)('flat'); + }, + function (e, t, n) { + var r = n(6); + n(28)(r.JSON, 'JSON', !0); + }, + function (e, t, n) { + 'use strict'; + var r = n(97), o = n(99); + e.exports = r('Map', function (e) { + return function () { + return e(this, arguments.length ? arguments[0] : void 0); + }; + }, o); + }, + function (e, t, n) { + var r = n(11); + e.exports = !r(function () { + return Object.isExtensible(Object.preventExtensions({})); + }); + }, + function (e, t, n) { + var r = n(12), o = n(73); + e.exports = function (e, t, n) { + var i, s; + return o && 'function' == typeof (i = t.constructor) && i !== n && r(s = i.prototype) && s !== n.prototype && o(e, s), e; + }; + }, + function (e, t, n) { + var r = n(12); + e.exports = function (e) { + if (!r(e) && null !== e) + throw TypeError('Can\'t set ' + String(e) + ' as a prototype'); + return e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(101).IteratorPrototype, o = n(39), i = n(32), s = n(28), a = n(40), u = function () { + return this; + }; + e.exports = function (e, t, n) { + var c = t + ' Iterator'; + return e.prototype = o(r, { next: i(1, n) }), s(e, c, !1, !0), a[c] = u, e; + }; + }, + function (e, t, n) { + var r = n(11); + e.exports = !r(function () { + function e() { + } + return e.prototype.constructor = null, Object.getPrototypeOf(new e()) !== e.prototype; + }); + }, + function (e, t, n) { + n(28)(Math, 'Math', !0); + }, + function (e, t, n) { + var r = n(1), o = n(191); + r({ + target: 'Object', + stat: !0, + forced: Object.assign !== o + }, { assign: o }); + }, + function (e, t, n) { + 'use strict'; + var r = n(17), o = n(11), i = n(48), s = n(64), a = n(43), u = n(27), c = n(56), f = Object.assign, l = Object.defineProperty; + e.exports = !f || o(function () { + if (r && 1 !== f({ b: 1 }, f(l({}, 'a', { + enumerable: !0, + get: function () { + l(this, 'b', { + value: 3, + enumerable: !1 + }); + } + }), { b: 2 })).b) + return !0; + var e = {}, t = {}, n = Symbol(); + return e[n] = 7, 'abcdefghijklmnopqrst'.split('').forEach(function (e) { + t[e] = e; + }), 7 != f({}, e)[n] || 'abcdefghijklmnopqrst' != i(f({}, t)).join(''); + }) ? function (e, t) { + for (var n = u(e), o = arguments.length, f = 1, l = s.f, p = a.f; o > f;) + for (var d, h = c(arguments[f++]), v = l ? i(h).concat(l(h)) : i(h), y = v.length, g = 0; y > g;) + d = v[g++], r && !p.call(h, d) || (n[d] = h[d]); + return n; + } : f; + }, + function (e, t, n) { + var r = n(1), o = n(103).entries; + r({ + target: 'Object', + stat: !0 + }, { + entries: function (e) { + return o(e); + } + }); + }, + function (e, t, n) { + var r = n(70), o = n(23), i = n(194); + r || o(Object.prototype, 'toString', i, { unsafe: !0 }); + }, + function (e, t, n) { + 'use strict'; + var r = n(70), o = n(96); + e.exports = r ? {}.toString : function () { + return '[object ' + o(this) + ']'; + }; + }, + function (e, t, n) { + var r = n(1), o = n(103).values; + r({ + target: 'Object', + stat: !0 + }, { + values: function (e) { + return o(e); + } + }); + }, + function (e, t, n) { + 'use strict'; + var r, o, i, s, a = n(1), u = n(3), c = n(6), f = n(9), l = n(104), p = n(23), d = n(100), h = n(28), v = n(102), y = n(12), g = n(5), m = n(72), b = n(59), E = n(4), C = n(71), _ = n(20), S = n(105).set, w = n(197), I = n(107), O = n(198), A = n(41), L = n(50), P = n(34), T = n(65), k = n(7), x = n(76), R = n(68), N = k('species'), V = 'Promise', U = P.get, j = P.set, B = P.getterFor(V), M = l, D = c.TypeError, F = c.document, G = c.process, H = f('fetch'), q = A.f, Y = q, z = !!(F && F.createEvent && c.dispatchEvent), W = 'function' == typeof PromiseRejectionEvent, J = T(V, function () { + if (!(b(M) !== String(M))) { + if (66 === R) + return !0; + if (!x && !W) + return !0; + } + if (u && !M.prototype.finally) + return !0; + if (R >= 51 && /native code/.test(M)) + return !1; + var e = M.resolve(1), t = function (e) { + e(function () { + }, function () { + }); + }; + return (e.constructor = {})[N] = t, !(e.then(function () { + }) instanceof t); + }), K = J || !C(function (e) { + M.all(e).catch(function () { + }); + }), Q = function (e) { + var t; + return !(!y(e) || 'function' != typeof (t = e.then)) && t; + }, Z = function (e, t) { + if (!e.notified) { + e.notified = !0; + var n = e.reactions; + w(function () { + for (var r = e.value, o = 1 == e.state, i = 0; n.length > i;) { + var s, a, u, c = n[i++], f = o ? c.ok : c.fail, l = c.resolve, p = c.reject, d = c.domain; + try { + f ? (o || (2 === e.rejection && te(e), e.rejection = 1), !0 === f ? s = r : (d && d.enter(), s = f(r), d && (d.exit(), u = !0)), s === c.promise ? p(D('Promise-chain cycle')) : (a = Q(s)) ? a.call(s, l, p) : l(s)) : p(r); + } catch (h) { + d && !u && d.exit(), p(h); + } + } + e.reactions = [], e.notified = !1, t && !e.rejection && $(e); + }); + } + }, X = function (e, t, n) { + var r, o; + z ? ((r = F.createEvent('Event')).promise = t, r.reason = n, r.initEvent(e, !1, !0), c.dispatchEvent(r)) : r = { + promise: t, + reason: n + }, !W && (o = c['on' + e]) ? o(r) : 'unhandledrejection' === e && O('Unhandled promise rejection', n); + }, $ = function (e) { + S.call(c, function () { + var t, n = e.facade, r = e.value; + if (ee(e) && (t = L(function () { + x ? G.emit('unhandledRejection', r, n) : X('unhandledrejection', n, r); + }), e.rejection = x || ee(e) ? 2 : 1, t.error)) + throw t.value; + }); + }, ee = function (e) { + return 1 !== e.rejection && !e.parent; + }, te = function (e) { + S.call(c, function () { + var t = e.facade; + x ? G.emit('rejectionHandled', t) : X('rejectionhandled', t, e.value); + }); + }, ne = function (e, t, n) { + return function (r) { + e(t, r, n); + }; + }, re = function (e, t, n) { + e.done || (e.done = !0, n && (e = n), e.value = t, e.state = 2, Z(e, !0)); + }, oe = function e(t, n, r) { + if (!t.done) { + t.done = !0, r && (t = r); + try { + if (t.facade === n) + throw D('Promise can\'t be resolved itself'); + var o = Q(n); + o ? w(function () { + var r = { done: !1 }; + try { + o.call(n, ne(e, r, t), ne(re, r, t)); + } catch (i) { + re(r, i, t); + } + }) : (t.value = n, t.state = 1, Z(t, !1)); + } catch (i) { + re({ done: !1 }, i, t); + } + } + }; + J && (M = function (e) { + m(this, M, V), g(e), r.call(this); + var t = U(this); + try { + e(ne(oe, t), ne(re, t)); + } catch (n) { + re(t, n); + } + }, (r = function (e) { + j(this, { + type: V, + done: !1, + notified: !1, + parent: !1, + reactions: [], + rejection: !1, + state: 0, + value: void 0 + }); + }).prototype = d(M.prototype, { + then: function (e, t) { + var n = B(this), r = q(_(this, M)); + return r.ok = 'function' != typeof e || e, r.fail = 'function' == typeof t && t, r.domain = x ? G.domain : void 0, n.parent = !0, n.reactions.push(r), 0 != n.state && Z(n, !1), r.promise; + }, + catch: function (e) { + return this.then(void 0, e); + } + }), o = function () { + var e = new r(), t = U(e); + this.promise = e, this.resolve = ne(oe, t), this.reject = ne(re, t); + }, A.f = q = function (e) { + return e === M || e === i ? new o(e) : Y(e); + }, u || 'function' != typeof l || (s = l.prototype.then, p(l.prototype, 'then', function (e, t) { + var n = this; + return new M(function (e, t) { + s.call(n, e, t); + }).then(e, t); + }, { unsafe: !0 }), 'function' == typeof H && a({ + global: !0, + enumerable: !0, + forced: !0 + }, { + fetch: function (e) { + return I(M, H.apply(c, arguments)); + } + }))), a({ + global: !0, + wrap: !0, + forced: J + }, { Promise: M }), h(M, V, !1, !0), v(V), i = f(V), a({ + target: V, + stat: !0, + forced: J + }, { + reject: function (e) { + var t = q(this); + return t.reject.call(void 0, e), t.promise; + } + }), a({ + target: V, + stat: !0, + forced: u || J + }, { + resolve: function (e) { + return I(u && this === i ? M : this, e); + } + }), a({ + target: V, + stat: !0, + forced: K + }, { + all: function (e) { + var t = this, n = q(t), r = n.resolve, o = n.reject, i = L(function () { + var n = g(t.resolve), i = [], s = 0, a = 1; + E(e, function (e) { + var u = s++, c = !1; + i.push(void 0), a++, n.call(t, e).then(function (e) { + c || (c = !0, i[u] = e, --a || r(i)); + }, o); + }), --a || r(i); + }); + return i.error && o(i.value), n.promise; + }, + race: function (e) { + var t = this, n = q(t), r = n.reject, o = L(function () { + var o = g(t.resolve); + E(e, function (e) { + o.call(t, e).then(n.resolve, r); + }); + }); + return o.error && r(o.value), n.promise; + } + }); + }, + function (e, t, n) { + var r, o, i, s, a, u, c, f, l = n(6), p = n(35).f, d = n(105).set, h = n(106), v = n(76), y = l.MutationObserver || l.WebKitMutationObserver, g = l.document, m = l.process, b = l.Promise, E = p(l, 'queueMicrotask'), C = E && E.value; + C || (r = function () { + var e, t; + for (v && (e = m.domain) && e.exit(); o;) { + t = o.fn, o = o.next; + try { + t(); + } catch (n) { + throw o ? s() : i = void 0, n; + } + } + i = void 0, e && e.enter(); + }, !h && !v && y && g ? (a = !0, u = g.createTextNode(''), new y(r).observe(u, { characterData: !0 }), s = function () { + u.data = a = !a; + }) : b && b.resolve ? (c = b.resolve(void 0), f = c.then, s = function () { + f.call(c, r); + }) : s = v ? function () { + m.nextTick(r); + } : function () { + d.call(l, r); + }), e.exports = C || function (e) { + var t = { + fn: e, + next: void 0 + }; + i && (i.next = t), o || (o = t, s()), i = t; + }; + }, + function (e, t, n) { + var r = n(6); + e.exports = function (e, t) { + var n = r.console; + n && n.error && (1 === arguments.length ? n.error(e) : n.error(e, t)); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(104), s = n(11), a = n(9), u = n(20), c = n(107), f = n(23); + r({ + target: 'Promise', + proto: !0, + real: !0, + forced: !!i && s(function () { + i.prototype.finally.call({ + then: function () { + } + }, function () { + }); + }) + }, { + finally: function (e) { + var t = u(this, a('Promise')), n = 'function' == typeof e; + return this.then(n ? function (n) { + return c(t, e()).then(function () { + return n; + }); + } : e, n ? function (n) { + return c(t, e()).then(function () { + throw n; + }); + } : e); + } + }), o || 'function' != typeof i || i.prototype.finally || f(i.prototype, 'finally', a('Promise').prototype.finally); + }, + function (e, t, n) { + 'use strict'; + var r = n(97), o = n(99); + e.exports = r('Set', function (e) { + return function () { + return e(this, arguments.length ? arguments[0] : void 0); + }; + }, o); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(108), i = n(33); + r({ + target: 'String', + proto: !0, + forced: !n(109)('includes') + }, { + includes: function (e) { + return !!~String(i(this)).indexOf(o(e), arguments.length > 1 ? arguments[1] : void 0); + } + }); + }, + function (e, t, n) { + var r = n(12), o = n(36), i = n(7)('match'); + e.exports = function (e) { + var t; + return r(e) && (void 0 !== (t = e[i]) ? !!t : 'RegExp' == o(e)); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(204).charAt, o = n(34), i = n(74), s = o.set, a = o.getterFor('String Iterator'); + i(String, 'String', function (e) { + s(this, { + type: 'String Iterator', + string: String(e), + index: 0 + }); + }, function () { + var e, t = a(this), n = t.string, o = t.index; + return o >= n.length ? { + value: void 0, + done: !0 + } : (e = r(n, o), t.index += e.length, { + value: e, + done: !1 + }); + }); + }, + function (e, t, n) { + var r = n(38), o = n(33), i = function (e) { + return function (t, n) { + var i, s, a = String(o(t)), u = r(n), c = a.length; + return u < 0 || u >= c ? e ? '' : void 0 : (i = a.charCodeAt(u)) < 55296 || i > 56319 || u + 1 === c || (s = a.charCodeAt(u + 1)) < 56320 || s > 57343 ? e ? a.charAt(u) : i : e ? a.slice(u, u + 2) : s - 56320 + (i - 55296 << 10) + 65536; + }; + }; + e.exports = { + codeAt: i(!1), + charAt: i(!0) + }; + }, + function (e, t, n) { + n(1)({ + target: 'String', + proto: !0 + }, { repeat: n(206) }); + }, + function (e, t, n) { + 'use strict'; + var r = n(38), o = n(33); + e.exports = ''.repeat || function (e) { + var t = String(o(this)), n = '', i = r(e); + if (i < 0 || i == 1 / 0) + throw RangeError('Wrong number of repetitions'); + for (; i > 0; (i >>>= 1) && (t += t)) + 1 & i && (n += t); + return n; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(35).f, i = n(24), s = n(108), a = n(33), u = n(109), c = n(3), f = ''.startsWith, l = Math.min, p = u('startsWith'); + r({ + target: 'String', + proto: !0, + forced: !(!c && !p && !!function () { + var e = o(String.prototype, 'startsWith'); + return e && !e.writable; + }()) && !p + }, { + startsWith: function (e) { + var t = String(a(this)); + s(e); + var n = i(l(arguments.length > 1 ? arguments[1] : void 0, t.length)), r = String(e); + return f ? f.call(t, r, n) : t.slice(n, n + r.length) === r; + } + }); + }, + function (e, t, n) { + n(209); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(75), i = n(73), s = n(39), a = n(22), u = n(32), c = n(4), f = function (e, t) { + var n = this; + if (!(n instanceof f)) + return new f(e, t); + i && (n = i(new Error(void 0), o(n))), void 0 !== t && a(n, 'message', String(t)); + var r = []; + return c(e, r.push, { that: r }), a(n, 'errors', r), n; + }; + f.prototype = s(Error.prototype, { + constructor: u(5, f), + message: u(5, ''), + name: u(5, 'AggregateError') + }), r({ global: !0 }, { AggregateError: f }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(110); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + deleteAll: function () { + return i.apply(this, arguments); + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(8), a = n(21), u = n(4); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + every: function (e) { + var t = i(this), n = a(t), r = s(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return !u(n, function (e, n, o) { + if (!r(n, e, t)) + return o(); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(9), s = n(2), a = n(5), u = n(8), c = n(20), f = n(21), l = n(4); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + filter: function (e) { + var t = s(this), n = f(t), r = u(e, arguments.length > 1 ? arguments[1] : void 0, 3), o = new (c(t, i('Map')))(), p = a(o.set); + return l(n, function (e, n) { + r(n, e, t) && p.call(o, e, n); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0 + }), o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(8), a = n(21), u = n(4); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + find: function (e) { + var t = i(this), n = a(t), r = s(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return u(n, function (e, n, o) { + if (r(n, e, t)) + return o(n); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).result; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(8), a = n(21), u = n(4); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + findKey: function (e) { + var t = i(this), n = a(t), r = s(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return u(n, function (e, n, o) { + if (r(n, e, t)) + return o(e); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).result; + } + }); + }, + function (e, t, n) { + n(1)({ + target: 'Map', + stat: !0 + }, { from: n(111) }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(5); + r({ + target: 'Map', + stat: !0 + }, { + groupBy: function (e, t) { + var n = new this(); + i(t); + var r = i(n.has), s = i(n.get), a = i(n.set); + return o(e, function (e) { + var o = t(e); + r.call(n, o) ? s.call(n, o).push(e) : a.call(n, o, [e]); + }), n; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(21), a = n(218), u = n(4); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + includes: function (e) { + return u(s(i(this)), function (t, n, r) { + if (a(n, e)) + return r(); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t) { + e.exports = function (e, t) { + return e === t || e != e && t != t; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(5); + r({ + target: 'Map', + stat: !0 + }, { + keyBy: function (e, t) { + var n = new this(); + i(t); + var r = i(n.set); + return o(e, function (e) { + r.call(n, t(e), e); + }), n; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(21), a = n(4); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + keyOf: function (e) { + return a(s(i(this)), function (t, n, r) { + if (n === e) + return r(t); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).result; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(9), s = n(2), a = n(5), u = n(8), c = n(20), f = n(21), l = n(4); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + mapKeys: function (e) { + var t = s(this), n = f(t), r = u(e, arguments.length > 1 ? arguments[1] : void 0, 3), o = new (c(t, i('Map')))(), p = a(o.set); + return l(n, function (e, n) { + p.call(o, r(n, e, t), n); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0 + }), o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(9), s = n(2), a = n(5), u = n(8), c = n(20), f = n(21), l = n(4); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + mapValues: function (e) { + var t = s(this), n = f(t), r = u(e, arguments.length > 1 ? arguments[1] : void 0, 3), o = new (c(t, i('Map')))(), p = a(o.set); + return l(n, function (e, n) { + p.call(o, e, r(n, e, t)); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0 + }), o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(5), a = n(4); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + merge: function (e) { + for (var t = i(this), n = s(t.set), r = 0; r < arguments.length;) + a(arguments[r++], n, { + that: t, + AS_ENTRIES: !0 + }); + return t; + } + }); + }, + function (e, t, n) { + n(1)({ + target: 'Map', + stat: !0 + }, { of: n(112) }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(5), a = n(21), u = n(4); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + reduce: function (e) { + var t = i(this), n = a(t), r = arguments.length < 2, o = r ? void 0 : arguments[1]; + if (s(e), u(n, function (n, i) { + r ? (r = !1, o = i) : o = e(o, i, n, t); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0 + }), r) + throw TypeError('Reduce of empty map with no initial value'); + return o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(8), a = n(21), u = n(4); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + some: function (e) { + var t = i(this), n = a(t), r = s(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return u(n, function (e, n, o) { + if (r(n, e, t)) + return o(); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + update: function (e, t) { + var n = i(this), r = arguments.length; + s(t); + var o = n.has(e); + if (!o && r < 3) + throw TypeError('Updating absent value'); + var a = o ? n.get(e) : s(r > 2 ? arguments[2] : void 0)(e, n); + return n.set(e, t(a, e, n)), n; + } + }); + }, + function (e, t, n) { + n(229); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(5), i = n(41), s = n(50), a = n(4); + r({ + target: 'Promise', + stat: !0 + }, { + allSettled: function (e) { + var t = this, n = i.f(t), r = n.resolve, u = n.reject, c = s(function () { + var n = o(t.resolve), i = [], s = 0, u = 1; + a(e, function (e) { + var o = s++, a = !1; + i.push(void 0), u++, n.call(t, e).then(function (e) { + a || (a = !0, i[o] = { + status: 'fulfilled', + value: e + }, --u || r(i)); + }, function (e) { + a || (a = !0, i[o] = { + status: 'rejected', + reason: e + }, --u || r(i)); + }); + }), --u || r(i); + }); + return c.error && u(c.value), n.promise; + } + }); + }, + function (e, t, n) { + n(231); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(5), i = n(9), s = n(41), a = n(50), u = n(4); + r({ + target: 'Promise', + stat: !0 + }, { + any: function (e) { + var t = this, n = s.f(t), r = n.resolve, c = n.reject, f = a(function () { + var n = o(t.resolve), s = [], a = 0, f = 1, l = !1; + u(e, function (e) { + var o = a++, u = !1; + s.push(void 0), f++, n.call(t, e).then(function (e) { + u || l || (l = !0, r(e)); + }, function (e) { + u || l || (u = !0, s[o] = e, --f || c(new (i('AggregateError'))(s, 'No one promise resolved'))); + }); + }), --f || c(new (i('AggregateError'))(s, 'No one promise resolved')); + }); + return f.error && c(f.value), n.promise; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(41), i = n(50); + r({ + target: 'Promise', + stat: !0 + }, { + try: function (e) { + var t = o.f(this), n = i(e); + return (n.error ? t.reject : t.resolve)(n.value), t.promise; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(234); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + addAll: function () { + return i.apply(this, arguments); + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(2), o = n(5); + e.exports = function () { + for (var e = r(this), t = o(e.add), n = 0, i = arguments.length; n < i; n++) + t.call(e, arguments[n]); + return e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(110); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + deleteAll: function () { + return i.apply(this, arguments); + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(9), s = n(2), a = n(5), u = n(20), c = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + difference: function (e) { + var t = s(this), n = new (u(t, i('Set')))(t), r = a(n.delete); + return c(e, function (e) { + r.call(n, e); + }), n; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(8), a = n(29), u = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + every: function (e) { + var t = i(this), n = a(t), r = s(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return !u(n, function (e, n) { + if (!r(e, e, t)) + return n(); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(9), s = n(2), a = n(5), u = n(8), c = n(20), f = n(29), l = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + filter: function (e) { + var t = s(this), n = f(t), r = u(e, arguments.length > 1 ? arguments[1] : void 0, 3), o = new (c(t, i('Set')))(), p = a(o.add); + return l(n, function (e) { + r(e, e, t) && p.call(o, e); + }, { IS_ITERATOR: !0 }), o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(8), a = n(29), u = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + find: function (e) { + var t = i(this), n = a(t), r = s(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return u(n, function (e, n) { + if (r(e, e, t)) + return n(e); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).result; + } + }); + }, + function (e, t, n) { + n(1)({ + target: 'Set', + stat: !0 + }, { from: n(111) }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(9), s = n(2), a = n(5), u = n(20), c = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + intersection: function (e) { + var t = s(this), n = new (u(t, i('Set')))(), r = a(t.has), o = a(n.add); + return c(e, function (e) { + r.call(t, e) && o.call(n, e); + }), n; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(5), a = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + isDisjointFrom: function (e) { + var t = i(this), n = s(t.has); + return !a(e, function (e, r) { + if (!0 === n.call(t, e)) + return r(); + }, { INTERRUPTED: !0 }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(9), s = n(2), a = n(5), u = n(77), c = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + isSubsetOf: function (e) { + var t = u(this), n = s(e), r = n.has; + return 'function' != typeof r && (n = new (i('Set'))(e), r = a(n.has)), !c(t, function (e, t) { + if (!1 === r.call(n, e)) + return t(); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(5), a = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + isSupersetOf: function (e) { + var t = i(this), n = s(t.has); + return !a(e, function (e, r) { + if (!1 === n.call(t, e)) + return r(); + }, { INTERRUPTED: !0 }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(29), a = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + join: function (e) { + var t = i(this), n = s(t), r = void 0 === e ? ',' : String(e), o = []; + return a(n, o.push, { + that: o, + IS_ITERATOR: !0 + }), o.join(r); + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(9), s = n(2), a = n(5), u = n(8), c = n(20), f = n(29), l = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + map: function (e) { + var t = s(this), n = f(t), r = u(e, arguments.length > 1 ? arguments[1] : void 0, 3), o = new (c(t, i('Set')))(), p = a(o.add); + return l(n, function (e) { + p.call(o, r(e, e, t)); + }, { IS_ITERATOR: !0 }), o; + } + }); + }, + function (e, t, n) { + n(1)({ + target: 'Set', + stat: !0 + }, { of: n(112) }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(5), a = n(29), u = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + reduce: function (e) { + var t = i(this), n = a(t), r = arguments.length < 2, o = r ? void 0 : arguments[1]; + if (s(e), u(n, function (n) { + r ? (r = !1, o = n) : o = e(o, n, n, t); + }, { IS_ITERATOR: !0 }), r) + throw TypeError('Reduce of empty set with no initial value'); + return o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(2), s = n(8), a = n(29), u = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + some: function (e) { + var t = i(this), n = a(t), r = s(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return u(n, function (e, n) { + if (r(e, e, t)) + return n(); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(9), s = n(2), a = n(5), u = n(20), c = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + symmetricDifference: function (e) { + var t = s(this), n = new (u(t, i('Set')))(t), r = a(n.delete), o = a(n.add); + return c(e, function (e) { + r.call(n, e) || o.call(n, e); + }), n; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(3), i = n(9), s = n(2), a = n(5), u = n(20), c = n(4); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + union: function (e) { + var t = s(this), n = new (u(t, i('Set')))(t); + return c(e, a(n.add), { that: n }), n; + } + }); + }, + function (e, t, n) { + n(10)('dispose'); + }, + function (e, t, n) { + n(10)('observable'); + }, + function (e, t, n) { + n(10)('patternMatch'); + }, + function (e, t, n) { + var r = n(6), o = n(256), i = n(257), s = n(22), a = n(7), u = a('iterator'), c = a('toStringTag'), f = i.values; + for (var l in o) { + var p = r[l], d = p && p.prototype; + if (d) { + if (d[u] !== f) + try { + s(d, u, f); + } catch (v) { + d[u] = f; + } + if (d[c] || s(d, c, l), o[l]) + for (var h in i) + if (d[h] !== i[h]) + try { + s(d, h, i[h]); + } catch (v) { + d[h] = i[h]; + } + } + } + }, + function (e, t) { + e.exports = { + CSSRuleList: 0, + CSSStyleDeclaration: 0, + CSSValueList: 0, + ClientRectList: 0, + DOMRectList: 0, + DOMStringList: 0, + DOMTokenList: 1, + DataTransferItemList: 0, + FileList: 0, + HTMLAllCollection: 0, + HTMLCollection: 0, + HTMLFormElement: 0, + HTMLSelectElement: 0, + MediaList: 0, + MimeTypeArray: 0, + NamedNodeMap: 0, + NodeList: 1, + PaintRequestList: 0, + Plugin: 0, + PluginArray: 0, + SVGLengthList: 0, + SVGNumberList: 0, + SVGPathSegList: 0, + SVGPointList: 0, + SVGStringList: 0, + SVGTransformList: 0, + SourceBufferList: 0, + StyleSheetList: 0, + TextTrackCueList: 0, + TextTrackList: 0, + TouchList: 0 + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(26), o = n(49), i = n(40), s = n(34), a = n(74), u = s.set, c = s.getterFor('Array Iterator'); + e.exports = a(Array, 'Array', function (e, t) { + u(this, { + type: 'Array Iterator', + target: r(e), + index: 0, + kind: t + }); + }, function () { + var e = c(this), t = e.target, n = e.kind, r = e.index++; + return !t || r >= t.length ? (e.target = void 0, { + value: void 0, + done: !0 + }) : 'keys' == n ? { + value: r, + done: !1 + } : 'values' == n ? { + value: t[r], + done: !1 + } : { + value: [ + r, + t[r] + ], + done: !1 + }; + }, 'values'), i.Arguments = i.Array, o('keys'), o('values'), o('entries'); + }, + function (e, t, n) { + var r = function (e) { + 'use strict'; + var t = Object.prototype, n = t.hasOwnProperty, r = 'function' === typeof Symbol ? Symbol : {}, o = r.iterator || '@@iterator', i = r.asyncIterator || '@@asyncIterator', s = r.toStringTag || '@@toStringTag'; + function a(e, t, n) { + return Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }), e[t]; + } + try { + a({}, ''); + } catch (O) { + a = function (e, t, n) { + return e[t] = n; + }; + } + function u(e, t, n, r) { + var o = t && t.prototype instanceof l ? t : l, i = Object.create(o.prototype), s = new S(r || []); + return i._invoke = function (e, t, n) { + var r = 'suspendedStart'; + return function (o, i) { + if ('executing' === r) + throw new Error('Generator is already running'); + if ('completed' === r) { + if ('throw' === o) + throw i; + return I(); + } + for (n.method = o, n.arg = i;;) { + var s = n.delegate; + if (s) { + var a = E(s, n); + if (a) { + if (a === f) + continue; + return a; + } + } + if ('next' === n.method) + n.sent = n._sent = n.arg; + else if ('throw' === n.method) { + if ('suspendedStart' === r) + throw r = 'completed', n.arg; + n.dispatchException(n.arg); + } else + 'return' === n.method && n.abrupt('return', n.arg); + r = 'executing'; + var u = c(e, t, n); + if ('normal' === u.type) { + if (r = n.done ? 'completed' : 'suspendedYield', u.arg === f) + continue; + return { + value: u.arg, + done: n.done + }; + } + 'throw' === u.type && (r = 'completed', n.method = 'throw', n.arg = u.arg); + } + }; + }(e, n, s), i; + } + function c(e, t, n) { + try { + return { + type: 'normal', + arg: e.call(t, n) + }; + } catch (O) { + return { + type: 'throw', + arg: O + }; + } + } + e.wrap = u; + var f = {}; + function l() { + } + function p() { + } + function d() { + } + var h = {}; + h[o] = function () { + return this; + }; + var v = Object.getPrototypeOf, y = v && v(v(w([]))); + y && y !== t && n.call(y, o) && (h = y); + var g = d.prototype = l.prototype = Object.create(h); + function m(e) { + [ + 'next', + 'throw', + 'return' + ].forEach(function (t) { + a(e, t, function (e) { + return this._invoke(t, e); + }); + }); + } + function b(e, t) { + var r; + this._invoke = function (o, i) { + function s() { + return new t(function (r, s) { + !function r(o, i, s, a) { + var u = c(e[o], e, i); + if ('throw' !== u.type) { + var f = u.arg, l = f.value; + return l && 'object' === typeof l && n.call(l, '__await') ? t.resolve(l.__await).then(function (e) { + r('next', e, s, a); + }, function (e) { + r('throw', e, s, a); + }) : t.resolve(l).then(function (e) { + f.value = e, s(f); + }, function (e) { + return r('throw', e, s, a); + }); + } + a(u.arg); + }(o, i, r, s); + }); + } + return r = r ? r.then(s, s) : s(); + }; + } + function E(e, t) { + var n = e.iterator[t.method]; + if (void 0 === n) { + if (t.delegate = null, 'throw' === t.method) { + if (e.iterator.return && (t.method = 'return', t.arg = void 0, E(e, t), 'throw' === t.method)) + return f; + t.method = 'throw', t.arg = new TypeError('The iterator does not provide a \'throw\' method'); + } + return f; + } + var r = c(n, e.iterator, t.arg); + if ('throw' === r.type) + return t.method = 'throw', t.arg = r.arg, t.delegate = null, f; + var o = r.arg; + return o ? o.done ? (t[e.resultName] = o.value, t.next = e.nextLoc, 'return' !== t.method && (t.method = 'next', t.arg = void 0), t.delegate = null, f) : o : (t.method = 'throw', t.arg = new TypeError('iterator result is not an object'), t.delegate = null, f); + } + function C(e) { + var t = { tryLoc: e[0] }; + 1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t); + } + function _(e) { + var t = e.completion || {}; + t.type = 'normal', delete t.arg, e.completion = t; + } + function S(e) { + this.tryEntries = [{ tryLoc: 'root' }], e.forEach(C, this), this.reset(!0); + } + function w(e) { + if (e) { + var t = e[o]; + if (t) + return t.call(e); + if ('function' === typeof e.next) + return e; + if (!isNaN(e.length)) { + var r = -1, i = function t() { + for (; ++r < e.length;) + if (n.call(e, r)) + return t.value = e[r], t.done = !1, t; + return t.value = void 0, t.done = !0, t; + }; + return i.next = i; + } + } + return { next: I }; + } + function I() { + return { + value: void 0, + done: !0 + }; + } + return p.prototype = g.constructor = d, d.constructor = p, p.displayName = a(d, s, 'GeneratorFunction'), e.isGeneratorFunction = function (e) { + var t = 'function' === typeof e && e.constructor; + return !!t && (t === p || 'GeneratorFunction' === (t.displayName || t.name)); + }, e.mark = function (e) { + return Object.setPrototypeOf ? Object.setPrototypeOf(e, d) : (e.__proto__ = d, a(e, s, 'GeneratorFunction')), e.prototype = Object.create(g), e; + }, e.awrap = function (e) { + return { __await: e }; + }, m(b.prototype), b.prototype[i] = function () { + return this; + }, e.AsyncIterator = b, e.async = function (t, n, r, o, i) { + void 0 === i && (i = Promise); + var s = new b(u(t, n, r, o), i); + return e.isGeneratorFunction(n) ? s : s.next().then(function (e) { + return e.done ? e.value : s.next(); + }); + }, m(g), a(g, s, 'Generator'), g[o] = function () { + return this; + }, g.toString = function () { + return '[object Generator]'; + }, e.keys = function (e) { + var t = []; + for (var n in e) + t.push(n); + return t.reverse(), function n() { + for (; t.length;) { + var r = t.pop(); + if (r in e) + return n.value = r, n.done = !1, n; + } + return n.done = !0, n; + }; + }, e.values = w, S.prototype = { + constructor: S, + reset: function (e) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = 'next', this.arg = void 0, this.tryEntries.forEach(_), !e) + for (var t in this) + 't' === t.charAt(0) && n.call(this, t) && !isNaN(+t.slice(1)) && (this[t] = void 0); + }, + stop: function () { + this.done = !0; + var e = this.tryEntries[0].completion; + if ('throw' === e.type) + throw e.arg; + return this.rval; + }, + dispatchException: function (e) { + if (this.done) + throw e; + var t = this; + function r(n, r) { + return s.type = 'throw', s.arg = e, t.next = n, r && (t.method = 'next', t.arg = void 0), !!r; + } + for (var o = this.tryEntries.length - 1; o >= 0; --o) { + var i = this.tryEntries[o], s = i.completion; + if ('root' === i.tryLoc) + return r('end'); + if (i.tryLoc <= this.prev) { + var a = n.call(i, 'catchLoc'), u = n.call(i, 'finallyLoc'); + if (a && u) { + if (this.prev < i.catchLoc) + return r(i.catchLoc, !0); + if (this.prev < i.finallyLoc) + return r(i.finallyLoc); + } else if (a) { + if (this.prev < i.catchLoc) + return r(i.catchLoc, !0); + } else { + if (!u) + throw new Error('try statement without catch or finally'); + if (this.prev < i.finallyLoc) + return r(i.finallyLoc); + } + } + } + }, + abrupt: function (e, t) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, 'finallyLoc') && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ('break' === e || 'continue' === e) && i.tryLoc <= t && t <= i.finallyLoc && (i = null); + var s = i ? i.completion : {}; + return s.type = e, s.arg = t, i ? (this.method = 'next', this.next = i.finallyLoc, f) : this.complete(s); + }, + complete: function (e, t) { + if ('throw' === e.type) + throw e.arg; + return 'break' === e.type || 'continue' === e.type ? this.next = e.arg : 'return' === e.type ? (this.rval = this.arg = e.arg, this.method = 'return', this.next = 'end') : 'normal' === e.type && t && (this.next = t), f; + }, + finish: function (e) { + for (var t = this.tryEntries.length - 1; t >= 0; --t) { + var n = this.tryEntries[t]; + if (n.finallyLoc === e) + return this.complete(n.completion, n.afterLoc), _(n), f; + } + }, + catch: function (e) { + for (var t = this.tryEntries.length - 1; t >= 0; --t) { + var n = this.tryEntries[t]; + if (n.tryLoc === e) { + var r = n.completion; + if ('throw' === r.type) { + var o = r.arg; + _(n); + } + return o; + } + } + throw new Error('illegal catch attempt'); + }, + delegateYield: function (e, t, n) { + return this.delegate = { + iterator: w(e), + resultName: t, + nextLoc: n + }, 'next' === this.method && (this.arg = void 0), f; + } + }, e; + }(e.exports); + try { + regeneratorRuntime = r; + } catch (o) { + Function('r', 'regeneratorRuntime = r')(r); + } + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.CmpStatus || (t.CmpStatus = {})).STUB = 'stub', r.LOADING = 'loading', r.LOADED = 'loaded', r.ERROR = 'error'; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.DisplayStatus || (t.DisplayStatus = {})).VISIBLE = 'visible', r.HIDDEN = 'hidden', r.DISABLED = 'disabled'; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.EventStatus || (t.EventStatus = {})).TC_LOADED = 'tcloaded', r.CMP_UI_SHOWN = 'cmpuishown', r.USER_ACTION_COMPLETE = 'useractioncomplete'; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(54), o = function () { + function e() { + this.eventQueue = new Map(), this.queueNumber = 0; + } + return e.prototype.add = function (e) { + return this.eventQueue.set(this.queueNumber, e), this.queueNumber++; + }, e.prototype.remove = function (e) { + return this.eventQueue.delete(e); + }, e.prototype.exec = function () { + this.eventQueue.forEach(function (e, t) { + new r.GetTCDataCommand(e.callback, e.param, t, e.next); + }); + }, e.prototype.clear = function () { + this.queueNumber = 0, this.eventQueue.clear(); + }, Object.defineProperty(e.prototype, 'size', { + get: function () { + return this.eventQueue.size; + }, + enumerable: !0, + configurable: !0 + }), e; + }(); + t.EventListenerQueue = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(), o = this && this.__read || function (e, t) { + var n = 'function' == typeof Symbol && e[Symbol.iterator]; + if (!n) + return e; + var r, o, i = n.call(e), s = []; + try { + for (; (void 0 === t || t-- > 0) && !(r = i.next()).done;) + s.push(r.value); + } catch (e) { + o = { error: e }; + } finally { + try { + r && !r.done && (n = i.return) && n.call(i); + } finally { + if (o) + throw o.error; + } + } + return s; + }, i = this && this.__spread || function () { + for (var e = [], t = 0; t < arguments.length; t++) + e = e.concat(o(arguments[t])); + return e; + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var s = function (e) { + function t(t) { + var n = e.call(this, t) || this; + return delete n.outOfBand, n; + } + return r(t, e), t.prototype.createVectorField = function (e) { + return i(e).reduce(function (e, t) { + return e + (t[1] ? '1' : '0'); + }, ''); + }, t.prototype.createRestrictions = function (e) { + var t = {}; + if (e.numRestrictions > 0) { + var n = e.getMaxVendorId(); + e.getRestrictions().forEach(function (e) { + t[e.purposeId.toString()] = '_'.repeat(n); + }); + for (var r = function (n) { + var r = n + 1; + e.getRestrictions(r).forEach(function (e) { + var r = e.restrictionType.toString(), o = e.purposeId.toString(), i = t[o].substr(0, n), s = t[o].substr(n + 1); + t[o] = i + r + s; + }); + }, o = 0; o < n; o++) + r(o); + } + return t; + }, t; + }(n(116).TCData); + t.InAppTCData = s; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(25), i = function (e) { + function t() { + var t = e.call(this) || this; + return t.cmpLoaded = !0, t.cmpStatus = o.CmpApiModel.cmpStatus, t.displayStatus = o.CmpApiModel.displayStatus, t.apiVersion = '' + o.CmpApiModel.apiVersion, o.CmpApiModel.tcModel && o.CmpApiModel.tcModel.vendorListVersion && (t.gvlVersion = +o.CmpApiModel.tcModel.vendorListVersion), t; + } + return r(t, e), t; + }(n(52).Response); + t.Ping = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(25), o = n(53), i = n(117), s = n(19), a = function () { + function e(e, t, n, o) { + void 0 === n && (n = !1), this.numUpdates = 0, this.throwIfInvalidInt(e, 'cmpId', 2), this.throwIfInvalidInt(t, 'cmpVersion', 0), r.CmpApiModel.cmpId = e, r.CmpApiModel.cmpVersion = t, this.isServiceSpecific = !!n, this.callResponder = new i.CallResponder(o); + } + return Object.defineProperty(e.prototype, 'tcModel', { + set: function (e) { + console.error('@iabtcf/cmpapi: As of v1.0.0-beta.21 setting tcModel via CmpApi.tcModel is deprecated. Use cmpApi.update(tcString, uiVisible) instead'), console.log(' see: https://github.com/InteractiveAdvertisingBureau/iabtcf-es/tree/master/modules/cmpapi#cmpapi-examples'); + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(e.prototype, 'tcString', { + set: function (e) { + console.error('@iabtcf/cmpapi: As of v1.0.0-beta.21 setting tcString via CmpApi.tcString is deprecated. Use cmpApi.update(tcString, uiVisible) instead'), console.log(' see: https://github.com/InteractiveAdvertisingBureau/iabtcf-es/tree/master/modules/cmpapi#cmpapi-examples'); + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(e.prototype, 'uiVisible', { + set: function (e) { + console.error('@iabtcf/cmpapi: As of v1.0.0-beta.21 setting uiVisible via CmpApi.uiVisible is deprecated. Use cmpApi.update(tcString, uiVisible) instead'), console.log(' see: https://github.com/InteractiveAdvertisingBureau/iabtcf-es/tree/master/modules/cmpapi#cmpapi-examples'); + }, + enumerable: !0, + configurable: !0 + }), e.prototype.throwIfInvalidInt = function (e, t, n) { + if (!('number' == typeof e && Number.isInteger(e) && e >= n)) + throw new Error('Invalid ' + t + ': ' + e); + }, e.prototype.update = function (e, t) { + if (void 0 === t && (t = !1), r.CmpApiModel.disabled) + throw new Error('CmpApi Disabled'); + r.CmpApiModel.cmpStatus = o.CmpStatus.LOADED, t ? (r.CmpApiModel.displayStatus = o.DisplayStatus.VISIBLE, r.CmpApiModel.eventStatus = o.EventStatus.CMP_UI_SHOWN) : void 0 === r.CmpApiModel.tcModel ? (r.CmpApiModel.displayStatus = o.DisplayStatus.DISABLED, r.CmpApiModel.eventStatus = o.EventStatus.TC_LOADED) : (r.CmpApiModel.displayStatus = o.DisplayStatus.HIDDEN, r.CmpApiModel.eventStatus = o.EventStatus.USER_ACTION_COMPLETE), r.CmpApiModel.gdprApplies = null !== e, r.CmpApiModel.gdprApplies ? ('' === e ? (r.CmpApiModel.tcModel = new s.TCModel(), r.CmpApiModel.tcModel.cmpId = r.CmpApiModel.cmpId, r.CmpApiModel.tcModel.cmpVersion = r.CmpApiModel.cmpVersion) : r.CmpApiModel.tcModel = s.TCString.decode(e), r.CmpApiModel.tcModel.isServiceSpecific = this.isServiceSpecific, r.CmpApiModel.tcfPolicyVersion = +r.CmpApiModel.tcModel.policyVersion, r.CmpApiModel.tcString = e) : r.CmpApiModel.tcModel = null, 0 === this.numUpdates ? this.callResponder.purgeQueuedCalls() : r.CmpApiModel.eventQueue.exec(), this.numUpdates++; + }, e.prototype.disable = function () { + r.CmpApiModel.disabled = !0, r.CmpApiModel.cmpStatus = o.CmpStatus.ERROR; + }, e; + }(); + t.CmpApi = a; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(267), o = n(54), i = n(268), s = n(269), a = n(284), u = n(285), c = n(114), f = function () { + function e() { + } + var t, n, f, l, p, d; + return t = c.TCFCommand.PING, n = c.TCFCommand.GET_TC_DATA, f = c.TCFCommand.GET_IN_APP_TC_DATA, l = c.TCFCommand.GET_VENDOR_LIST, p = c.TCFCommand.ADD_EVENT_LISTENER, d = c.TCFCommand.REMOVE_EVENT_LISTENER, e[t] = r.PingCommand, e[n] = o.GetTCDataCommand, e[f] = i.GetInAppTCDataCommand, e[l] = s.GetVendorListCommand, e[p] = a.AddEventListenerCommand, e[d] = u.RemoveEventListenerCommand, e; + }(); + t.CommandMap = f; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(51), i = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + this.invokeCallback(new o.Ping()); + }, t; + }(n(55).Command); + t.PingCommand = i; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(54), i = n(51), s = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + this.throwIfParamInvalid(), this.invokeCallback(new i.InAppTCData(this.param)); + }, t; + }(o.GetTCDataCommand); + t.GetInAppTCDataCommand = s; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(25), i = n(55), s = n(19), a = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + var e, t = this, n = o.CmpApiModel.tcModel, r = n.vendorListVersion; + void 0 === this.param && (this.param = r), (e = this.param === r && n.gvl ? n.gvl : new s.GVL(this.param)).readyPromise.then(function () { + t.invokeCallback(e.getJson()); + }); + }, t; + }(i.Command); + t.GetVendorListCommand = a; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t) { + var n = e.call(this, t) || this; + return n.name = 'DecodingError', n; + } + return r(t, e), t; + }(Error); + t.DecodingError = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t) { + var n = e.call(this, t) || this; + return n.name = 'EncodingError', n; + } + return r(t, e), t; + }(Error); + t.EncodingError = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t) { + var n = e.call(this, t) || this; + return n.name = 'GVLError', n; + } + return r(t, e), t; + }(Error); + t.GVLError = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t, n, r) { + void 0 === r && (r = ''); + var o = e.call(this, 'invalid value ' + n + ' passed for ' + t + ' ' + r) || this; + return o.name = 'TCModelError', o; + } + return r(t, e), t; + }(Error); + t.TCModelError = o; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.prototype.has = function (t) { + return e.langSet.has(t); + }, e.prototype.forEach = function (t) { + e.langSet.forEach(t); + }, Object.defineProperty(e.prototype, 'size', { + get: function () { + return e.langSet.size; + }, + enumerable: !0, + configurable: !0 + }), e.langSet = new Set([ + 'BG', + 'CA', + 'CS', + 'DA', + 'DE', + 'EL', + 'EN', + 'ES', + 'ET', + 'FI', + 'FR', + 'HR', + 'HU', + 'IT', + 'JA', + 'LT', + 'LV', + 'MT', + 'NL', + 'NO', + 'PL', + 'PT', + 'RO', + 'RU', + 'SK', + 'SL', + 'SV', + 'TR', + 'ZH' + ]), e; + }(); + t.ConsentLanguages = r; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(121), i = n(119), s = n(80), a = function (e) { + function t() { + var t = null !== e && e.apply(this, arguments) || this; + return t.bitLength = 0, t.map = new Map(), t; + } + return r(t, e), t.prototype.has = function (e) { + return this.map.has(e); + }, t.prototype.isOkToHave = function (e, t, n) { + var r, o = !0; + if (null === (r = this.gvl) || void 0 === r ? void 0 : r.vendors) { + var i = this.gvl.vendors[n]; + if (i) + if (e === s.RestrictionType.NOT_ALLOWED) + o = i.legIntPurposes.includes(t) || i.purposes.includes(t); + else if (i.flexiblePurposes.length) + switch (e) { + case s.RestrictionType.REQUIRE_CONSENT: + o = i.flexiblePurposes.includes(t) && i.legIntPurposes.includes(t); + break; + case s.RestrictionType.REQUIRE_LI: + o = i.flexiblePurposes.includes(t) && i.purposes.includes(t); + } + else + o = !1; + else + o = !1; + } + return o; + }, t.prototype.add = function (e, t) { + if (this.isOkToHave(t.restrictionType, t.purposeId, e)) { + var n = t.hash; + this.has(n) || (this.map.set(n, new i.BinarySearchTree()), this.bitLength = 0), this.map.get(n).add(e); + } + }, t.prototype.getVendors = function (e) { + var t = []; + if (e) { + var n = e.hash; + this.has(n) && (t = this.map.get(n).get()); + } else { + var r = new Set(); + this.map.forEach(function (e) { + e.get().forEach(function (e) { + r.add(e); + }); + }), t = Array.from(r); + } + return t; + }, t.prototype.getRestrictionType = function (e, t) { + var n; + return this.getRestrictions(e).forEach(function (e) { + e.purposeId === t && (void 0 === n || n > e.restrictionType) && (n = e.restrictionType); + }), n; + }, t.prototype.vendorHasRestriction = function (e, t) { + for (var n = !1, r = this.getRestrictions(e), o = 0; o < r.length && !n; o++) + n = t.isSameAs(r[o]); + return n; + }, t.prototype.getMaxVendorId = function () { + var e = 0; + return this.map.forEach(function (t) { + e = Math.max(t.max(), e); + }), e; + }, t.prototype.getRestrictions = function (e) { + var t = []; + return this.map.forEach(function (n, r) { + e ? n.contains(e) && t.push(o.PurposeRestriction.unHash(r)) : t.push(o.PurposeRestriction.unHash(r)); + }), t; + }, t.prototype.getPurposes = function () { + var e = new Set(); + return this.map.forEach(function (t, n) { + e.add(o.PurposeRestriction.unHash(n).purposeId); + }), Array.from(e); + }, t.prototype.remove = function (e, t) { + var n = t.hash, r = this.map.get(n); + r && (r.remove(e), r.isEmpty() && (this.map.delete(n), this.bitLength = 0)); + }, Object.defineProperty(t.prototype, 'gvl', { + get: function () { + return this.gvl_; + }, + set: function (e) { + var t = this; + this.gvl_ || (this.gvl_ = e, this.map.forEach(function (e, n) { + var r = o.PurposeRestriction.unHash(n); + e.get().forEach(function (n) { + t.isOkToHave(r.restrictionType, r.purposeId, n) || e.remove(n); + }); + })); + }, + enumerable: !0, + configurable: !0 + }), t.prototype.isEmpty = function () { + return 0 === this.map.size; + }, Object.defineProperty(t.prototype, 'numRestrictions', { + get: function () { + return this.map.size; + }, + enumerable: !0, + configurable: !0 + }), t; + }(n(30).Cloneable); + t.PurposeRestrictionVector = a; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(122), i = function () { + function e() { + } + return e.ID_TO_KEY = [ + o.Segment.CORE, + o.Segment.VENDORS_DISCLOSED, + o.Segment.VENDORS_ALLOWED, + o.Segment.PUBLISHER_TC + ], e.KEY_TO_ID = ((r = {})[o.Segment.CORE] = 0, r[o.Segment.VENDORS_DISCLOSED] = 1, r[o.Segment.VENDORS_ALLOWED] = 2, r[o.Segment.PUBLISHER_TC] = 3, r), e; + }(); + t.SegmentIDs = i; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(), o = this && this.__generator || function (e, t) { + var n, r, o, i, s = { + label: 0, + sent: function () { + if (1 & o[0]) + throw o[1]; + return o[1]; + }, + trys: [], + ops: [] + }; + return i = { + next: a(0), + throw: a(1), + return: a(2) + }, 'function' == typeof Symbol && (i[Symbol.iterator] = function () { + return this; + }), i; + function a(i) { + return function (a) { + return function (i) { + if (n) + throw new TypeError('Generator is already executing.'); + for (; s;) + try { + if (n = 1, r && (o = 2 & i[0] ? r.return : i[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, i[1])).done) + return o; + switch (r = 0, o && (i = [ + 2 & i[0], + o.value + ]), i[0]) { + case 0: + case 1: + o = i; + break; + case 4: + return s.label++, { + value: i[1], + done: !1 + }; + case 5: + s.label++, r = i[1], i = [0]; + continue; + case 7: + i = s.ops.pop(), s.trys.pop(); + continue; + default: + if (!(o = (o = s.trys).length > 0 && o[o.length - 1]) && (6 === i[0] || 2 === i[0])) { + s = 0; + continue; + } + if (3 === i[0] && (!o || i[1] > o[0] && i[1] < o[3])) { + s.label = i[1]; + break; + } + if (6 === i[0] && s.label < o[1]) { + s.label = o[1], o = i; + break; + } + if (o && s.label < o[2]) { + s.label = o[2], s.ops.push(i); + break; + } + o[2] && s.ops.pop(), s.trys.pop(); + continue; + } + i = t.call(e, s); + } catch (e) { + i = [ + 6, + e + ], r = 0; + } finally { + n = o = 0; + } + if (5 & i[0]) + throw i[1]; + return { + value: i[0] ? i[1] : void 0, + done: !0 + }; + }([ + i, + a + ]); + }; + } + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var i = n(30), s = n(14), a = function (e) { + function t() { + var t = null !== e && e.apply(this, arguments) || this; + return t.bitLength = 0, t.maxId_ = 0, t.set_ = new Set(), t; + } + return r(t, e), t.prototype[Symbol.iterator] = function () { + var e; + return o(this, function (t) { + switch (t.label) { + case 0: + e = 1, t.label = 1; + case 1: + return e <= this.maxId ? [ + 4, + [ + e, + this.has(e) + ] + ] : [ + 3, + 4 + ]; + case 2: + t.sent(), t.label = 3; + case 3: + return e++, [ + 3, + 1 + ]; + case 4: + return [2]; + } + }); + }, t.prototype.values = function () { + return this.set_.values(); + }, Object.defineProperty(t.prototype, 'maxId', { + get: function () { + return this.maxId_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.has = function (e) { + return this.set_.has(e); + }, t.prototype.unset = function (e) { + var t = this; + Array.isArray(e) ? e.forEach(function (e) { + return t.unset(e); + }) : 'object' == typeof e ? this.unset(Object.keys(e).map(function (e) { + return +e; + })) : (this.set_.delete(e), this.bitLength = 0, e === this.maxId && (this.maxId_ = 0, this.set_.forEach(function (e) { + t.maxId_ = Math.max(t.maxId, e); + }))); + }, t.prototype.isIntMap = function (e) { + var t = this, n = 'object' == typeof e; + return n && Object.keys(e).every(function (n) { + var r = Number.isInteger(parseInt(n, 10)); + return (r = r && t.isValidNumber(e[n].id)) && void 0 !== e[n].name; + }); + }, t.prototype.isValidNumber = function (e) { + return parseInt(e, 10) > 0; + }, t.prototype.isSet = function (e) { + var t = !1; + return e instanceof Set && (t = Array.from(e).every(this.isValidNumber)), t; + }, t.prototype.set = function (e) { + var t = this; + if (Array.isArray(e)) + e.forEach(function (e) { + return t.set(e); + }); + else if (this.isSet(e)) + this.set(Array.from(e)); + else if (this.isIntMap(e)) + this.set(Object.keys(e).map(function (e) { + return +e; + })); + else { + if (!this.isValidNumber(e)) + throw new s.TCModelError('set()', e, 'must be positive integer array, positive integer, Set, or IntMap'); + this.set_.add(e), this.maxId_ = Math.max(this.maxId, e), this.bitLength = 0; + } + }, t.prototype.empty = function () { + this.set_ = new Set(); + }, t.prototype.forEach = function (e) { + for (var t = 1; t <= this.maxId; t++) + e(this.has(t), t); + }, Object.defineProperty(t.prototype, 'size', { + get: function () { + return this.set_.size; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.setAll = function (e) { + this.set(e); + }, t; + }(i.Cloneable); + t.Vector = a; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(118), o = n(79), i = n(123), s = n(129), a = n(14), u = n(120), c = n(15), f = function () { + function e() { + } + return e.encode = function (e, t) { + var n, s = this; + try { + n = this.fieldSequence['' + e.version][t]; + } catch (n) { + throw new a.EncodingError('Unable to encode version: ' + e.version + ', segment: ' + t); + } + var f = ''; + return t !== c.Segment.CORE && (f = i.IntEncoder.encode(c.SegmentIDs.KEY_TO_ID[t], o.BitLength.segmentType)), n.forEach(function (n) { + var r = e[n], c = i.FieldEncoderMap[n], l = o.BitLength[n]; + void 0 === l && s.isPublisherCustom(n) && (l = +e[u.Fields.numCustomPurposes]); + try { + f += c.encode(r, l); + } catch (e) { + throw new a.EncodingError('Error encoding ' + t + '->' + n + ': ' + e.message); + } + }), r.Base64Url.encode(f); + }, e.decode = function (e, t, n) { + var s = this, f = r.Base64Url.decode(e), l = 0; + return n === c.Segment.CORE && (t.version = i.IntEncoder.decode(f.substr(l, o.BitLength[u.Fields.version]), o.BitLength[u.Fields.version])), n !== c.Segment.CORE && (l += o.BitLength.segmentType), this.fieldSequence['' + t.version][n].forEach(function (e) { + var n = i.FieldEncoderMap[e], r = o.BitLength[e]; + if (void 0 === r && s.isPublisherCustom(e) && (r = +t[u.Fields.numCustomPurposes]), 0 !== r) { + var c = f.substr(l, r); + if (n === i.VendorVectorEncoder ? t[e] = n.decode(c, t.version) : t[e] = n.decode(c, r), Number.isInteger(r)) + l += r; + else { + if (!Number.isInteger(t[e].bitLength)) + throw new a.DecodingError(e); + l += t[e].bitLength; + } + } + }), t; + }, e.isPublisherCustom = function (e) { + return 0 === e.indexOf('publisherCustom'); + }, e.fieldSequence = new s.FieldSequence(), e; + }(); + t.SegmentEncoder = f; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(15), o = n(42), i = n(124), s = n(81), a = n(31), u = n(125), c = n(126), f = n(127), l = function () { + function e() { + } + var t, n, l, p, d, h, v, y, g, m, b, E, C, _, S, w, I, O, A, L, P, T, k, x, R, N; + return t = r.Fields.version, n = r.Fields.created, l = r.Fields.lastUpdated, p = r.Fields.cmpId, d = r.Fields.cmpVersion, h = r.Fields.consentScreen, v = r.Fields.consentLanguage, y = r.Fields.vendorListVersion, g = r.Fields.policyVersion, m = r.Fields.isServiceSpecific, b = r.Fields.useNonStandardStacks, E = r.Fields.specialFeatureOptins, C = r.Fields.purposeConsents, _ = r.Fields.purposeLegitimateInterests, S = r.Fields.purposeOneTreatment, w = r.Fields.publisherCountryCode, I = r.Fields.vendorConsents, O = r.Fields.vendorLegitimateInterests, A = r.Fields.publisherRestrictions, L = r.Fields.vendorsDisclosed, P = r.Fields.vendorsAllowed, T = r.Fields.publisherConsents, k = r.Fields.publisherLegitimateInterests, x = r.Fields.numCustomPurposes, R = r.Fields.publisherCustomConsents, N = r.Fields.publisherCustomLegitimateInterests, e[t] = a.IntEncoder, e[n] = i.DateEncoder, e[l] = i.DateEncoder, e[p] = a.IntEncoder, e[d] = a.IntEncoder, e[h] = a.IntEncoder, e[v] = u.LangEncoder, e[y] = a.IntEncoder, e[g] = a.IntEncoder, e[m] = o.BooleanEncoder, e[b] = o.BooleanEncoder, e[E] = s.FixedVectorEncoder, e[C] = s.FixedVectorEncoder, e[_] = s.FixedVectorEncoder, e[S] = o.BooleanEncoder, e[w] = u.LangEncoder, e[I] = f.VendorVectorEncoder, e[O] = f.VendorVectorEncoder, e[A] = c.PurposeRestrictionVectorEncoder, e.segmentType = a.IntEncoder, e[L] = f.VendorVectorEncoder, e[P] = f.VendorVectorEncoder, e[T] = s.FixedVectorEncoder, e[k] = s.FixedVectorEncoder, e[x] = a.IntEncoder, e[R] = s.FixedVectorEncoder, e[N] = s.FixedVectorEncoder, e; + }(); + t.FieldEncoderMap = l; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(15); + t.FieldSequence = function () { + var e, t; + this[1] = ((e = {})[r.Segment.CORE] = [ + r.Fields.version, + r.Fields.created, + r.Fields.lastUpdated, + r.Fields.cmpId, + r.Fields.cmpVersion, + r.Fields.consentScreen, + r.Fields.consentLanguage, + r.Fields.vendorListVersion, + r.Fields.purposeConsents, + r.Fields.vendorConsents + ], e), this[2] = ((t = {})[r.Segment.CORE] = [ + r.Fields.version, + r.Fields.created, + r.Fields.lastUpdated, + r.Fields.cmpId, + r.Fields.cmpVersion, + r.Fields.consentScreen, + r.Fields.consentLanguage, + r.Fields.vendorListVersion, + r.Fields.policyVersion, + r.Fields.isServiceSpecific, + r.Fields.useNonStandardStacks, + r.Fields.specialFeatureOptins, + r.Fields.purposeConsents, + r.Fields.purposeLegitimateInterests, + r.Fields.purposeOneTreatment, + r.Fields.publisherCountryCode, + r.Fields.vendorConsents, + r.Fields.vendorLegitimateInterests, + r.Fields.publisherRestrictions + ], t[r.Segment.PUBLISHER_TC] = [ + r.Fields.publisherConsents, + r.Fields.publisherLegitimateInterests, + r.Fields.numCustomPurposes, + r.Fields.publisherCustomConsents, + r.Fields.publisherCustomLegitimateInterests + ], t[r.Segment.VENDORS_ALLOWED] = [r.Fields.vendorsAllowed], t[r.Segment.VENDORS_DISCLOSED] = [r.Fields.vendorsDisclosed], t); + }; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(15); + t.SegmentSequence = function (e, t) { + if (this[1] = [r.Segment.CORE], this[2] = [r.Segment.CORE], 2 === e.version) + if (e.isServiceSpecific) + this[2].push(r.Segment.PUBLISHER_TC); + else { + var n = !(!t || !t.isForVendors); + n && !0 !== e[r.Fields.supportOOB] || this[2].push(r.Segment.VENDORS_DISCLOSED), n && (e[r.Fields.supportOOB] && e[r.Fields.vendorsAllowed].size > 0 && this[2].push(r.Segment.VENDORS_ALLOWED), this[2].push(r.Segment.PUBLISHER_TC)); + } + }; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(14), o = n(15), i = function () { + function e() { + } + return e.process = function (e, t) { + var n, o, i = e.gvl; + if (!i) + throw new r.EncodingError('Unable to encode TCModel without a GVL'); + if (!i.isReady) + throw new r.EncodingError('Unable to encode TCModel tcModel.gvl.readyPromise is not resolved'); + (e = e.clone()).consentLanguage = i.language.toUpperCase(), (null === (n = t) || void 0 === n ? void 0 : n.version) > 0 && (null === (o = t) || void 0 === o ? void 0 : o.version) <= this.processor.length ? e.version = t.version : e.version = this.processor.length; + var s = e.version - 1; + if (!this.processor[s]) + throw new r.EncodingError('Invalid version: ' + e.version); + return this.processor[s](e, i); + }, e.processor = [ + function (e) { + return e; + }, + function (e, t) { + e.publisherRestrictions.gvl = t, e.purposeLegitimateInterests.unset(1); + var n = new Map(); + return n.set('legIntPurposes', e.vendorLegitimateInterests), n.set('purposes', e.vendorConsents), n.forEach(function (n, r) { + n.forEach(function (i, s) { + if (i) { + var a = t.vendors[s]; + if (!a || a.deletedDate) + n.unset(s); + else if (0 === a[r].length) + if (e.isServiceSpecific) + if (0 === a.flexiblePurposes.length) + n.unset(s); + else { + for (var u = e.publisherRestrictions.getRestrictions(s), c = !1, f = 0, l = u.length; f < l && !c; f++) + c = u[f].restrictionType === o.RestrictionType.REQUIRE_CONSENT && 'purposes' === r || u[f].restrictionType === o.RestrictionType.REQUIRE_LI && 'legIntPurposes' === r; + c || n.unset(s); + } + else + n.unset(s); + } + }); + }), e.vendorsDisclosed.set(t.vendors), e; + } + ], e; + }(); + t.SemanticPreEncoder = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(78), o = n(15), i = n(31), s = n(132), a = function () { + function e() { + } + return e.encode = function (e, t) { + var n, o, i = ''; + return e = r.SemanticPreEncoder.process(e, t), (o = Array.isArray(null === (n = t) || void 0 === n ? void 0 : n.segments) ? t.segments : new r.SegmentSequence(e, t)['' + e.version]).forEach(function (t, n) { + var s = ''; + n < o.length - 1 && (s = '.'), i += r.SegmentEncoder.encode(e, t) + s; + }), i; + }, e.decode = function (e, t) { + var n = e.split('.'), a = n.length; + t || (t = new s.TCModel()); + for (var u = 0; u < a; u++) { + var c = n[u], f = r.Base64Url.decode(c.charAt(0)).substr(0, r.BitLength.segmentType), l = o.SegmentIDs.ID_TO_KEY[i.IntEncoder.decode(f, r.BitLength.segmentType).toString()]; + r.SegmentEncoder.decode(c, t, l); + } + return t; + }, e; + }(); + t.TCString = a; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(25), i = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + this.listenerId = o.CmpApiModel.eventQueue.add({ + callback: this.callback, + param: this.param, + next: this.next + }), e.prototype.respond.call(this); + }, t; + }(n(54).GetTCDataCommand); + t.AddEventListenerCommand = i; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(25), i = function (e) { + function t() { + return null !== e && e.apply(this, arguments) || this; + } + return r(t, e), t.prototype.respond = function () { + this.invokeCallback(o.CmpApiModel.eventQueue.remove(this.param)); + }, t; + }(n(55).Command); + t.RemoveEventListenerCommand = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.has = function (e) { + return 'string' == typeof e && (e = +e), this.set_.has(e); + }, e.set_ = new Set([ + 0, + 2, + void 0, + null + ]), e; + }(); + t.SupportedVersions = r; + }, + function (e, t, n) { + 'use strict'; + var r = n(16), o = n(138), i = n(288), s = n(144); + function a(e) { + var t = new i(e), n = o(i.prototype.request, t); + return r.extend(n, i.prototype, t), r.extend(n, t), n; + } + var u = a(n(141)); + u.Axios = i, u.create = function (e) { + return a(s(u.defaults, e)); + }, u.Cancel = n(145), u.CancelToken = n(302), u.isCancel = n(140), u.all = function (e) { + return Promise.all(e); + }, u.spread = n(303), e.exports = u, e.exports.default = u; + }, + function (e, t, n) { + 'use strict'; + var r = n(16), o = n(139), i = n(289), s = n(290), a = n(144); + function u(e) { + this.defaults = e, this.interceptors = { + request: new i(), + response: new i() + }; + } + u.prototype.request = function (e) { + 'string' === typeof e ? (e = arguments[1] || {}).url = arguments[0] : e = e || {}, (e = a(this.defaults, e)).method ? e.method = e.method.toLowerCase() : this.defaults.method ? e.method = this.defaults.method.toLowerCase() : e.method = 'get'; + var t = [ + s, + void 0 + ], n = Promise.resolve(e); + for (this.interceptors.request.forEach(function (e) { + t.unshift(e.fulfilled, e.rejected); + }), this.interceptors.response.forEach(function (e) { + t.push(e.fulfilled, e.rejected); + }); t.length;) + n = n.then(t.shift(), t.shift()); + return n; + }, u.prototype.getUri = function (e) { + return e = a(this.defaults, e), o(e.url, e.params, e.paramsSerializer).replace(/^\?/, ''); + }, r.forEach([ + 'delete', + 'get', + 'head', + 'options' + ], function (e) { + u.prototype[e] = function (t, n) { + return this.request(r.merge(n || {}, { + method: e, + url: t + })); + }; + }), r.forEach([ + 'post', + 'put', + 'patch' + ], function (e) { + u.prototype[e] = function (t, n, o) { + return this.request(r.merge(o || {}, { + method: e, + url: t, + data: n + })); + }; + }), e.exports = u; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + function o() { + this.handlers = []; + } + o.prototype.use = function (e, t) { + return this.handlers.push({ + fulfilled: e, + rejected: t + }), this.handlers.length - 1; + }, o.prototype.eject = function (e) { + this.handlers[e] && (this.handlers[e] = null); + }, o.prototype.forEach = function (e) { + r.forEach(this.handlers, function (t) { + null !== t && e(t); + }); + }, e.exports = o; + }, + function (e, t, n) { + 'use strict'; + var r = n(16), o = n(291), i = n(140), s = n(141); + function a(e) { + e.cancelToken && e.cancelToken.throwIfRequested(); + } + e.exports = function (e) { + return a(e), e.headers = e.headers || {}, e.data = o(e.data, e.headers, e.transformRequest), e.headers = r.merge(e.headers.common || {}, e.headers[e.method] || {}, e.headers), r.forEach([ + 'delete', + 'get', + 'head', + 'post', + 'put', + 'patch', + 'common' + ], function (t) { + delete e.headers[t]; + }), (e.adapter || s.adapter)(e).then(function (t) { + return a(e), t.data = o(t.data, t.headers, e.transformResponse), t; + }, function (t) { + return i(t) || (a(e), t && t.response && (t.response.data = o(t.response.data, t.response.headers, e.transformResponse))), Promise.reject(t); + }); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + e.exports = function (e, t, n) { + return r.forEach(n, function (n) { + e = n(e, t); + }), e; + }; + }, + function (e, t) { + var n, r, o = e.exports = {}; + function i() { + throw new Error('setTimeout has not been defined'); + } + function s() { + throw new Error('clearTimeout has not been defined'); + } + function a(e) { + if (n === setTimeout) + return setTimeout(e, 0); + if ((n === i || !n) && setTimeout) + return n = setTimeout, setTimeout(e, 0); + try { + return n(e, 0); + } catch (t) { + try { + return n.call(null, e, 0); + } catch (t) { + return n.call(this, e, 0); + } + } + } + !function () { + try { + n = 'function' === typeof setTimeout ? setTimeout : i; + } catch (e) { + n = i; + } + try { + r = 'function' === typeof clearTimeout ? clearTimeout : s; + } catch (e) { + r = s; + } + }(); + var u, c = [], f = !1, l = -1; + function p() { + f && u && (f = !1, u.length ? c = u.concat(c) : l = -1, c.length && d()); + } + function d() { + if (!f) { + var e = a(p); + f = !0; + for (var t = c.length; t;) { + for (u = c, c = []; ++l < t;) + u && u[l].run(); + l = -1, t = c.length; + } + u = null, f = !1, function (e) { + if (r === clearTimeout) + return clearTimeout(e); + if ((r === s || !r) && clearTimeout) + return r = clearTimeout, clearTimeout(e); + try { + r(e); + } catch (t) { + try { + return r.call(null, e); + } catch (t) { + return r.call(this, e); + } + } + }(e); + } + } + function h(e, t) { + this.fun = e, this.array = t; + } + function v() { + } + o.nextTick = function (e) { + var t = new Array(arguments.length - 1); + if (arguments.length > 1) + for (var n = 1; n < arguments.length; n++) + t[n - 1] = arguments[n]; + c.push(new h(e, t)), 1 !== c.length || f || a(d); + }, h.prototype.run = function () { + this.fun.apply(null, this.array); + }, o.title = 'browser', o.browser = !0, o.env = {}, o.argv = [], o.version = '', o.versions = {}, o.on = v, o.addListener = v, o.once = v, o.off = v, o.removeListener = v, o.removeAllListeners = v, o.emit = v, o.prependListener = v, o.prependOnceListener = v, o.listeners = function (e) { + return []; + }, o.binding = function (e) { + throw new Error('process.binding is not supported'); + }, o.cwd = function () { + return '/'; + }, o.chdir = function (e) { + throw new Error('process.chdir is not supported'); + }, o.umask = function () { + return 0; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + e.exports = function (e, t) { + r.forEach(e, function (n, r) { + r !== t && r.toUpperCase() === t.toUpperCase() && (e[t] = n, delete e[r]); + }); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(143); + e.exports = function (e, t, n) { + var o = n.config.validateStatus; + !o || o(n.status) ? e(n) : t(r('Request failed with status code ' + n.status, n.config, null, n.request, n)); + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e, t, n, r, o) { + return e.config = t, n && (e.code = n), e.request = r, e.response = o, e.isAxiosError = !0, e.toJSON = function () { + return { + message: this.message, + name: this.name, + description: this.description, + number: this.number, + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + config: this.config, + code: this.code + }; + }, e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(297), o = n(298); + e.exports = function (e, t) { + return e && !r(t) ? o(e, t) : t; + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e) { + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e); + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e, t) { + return t ? e.replace(/\/+$/, '') + '/' + t.replace(/^\/+/, '') : e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16), o = [ + 'age', + 'authorization', + 'content-length', + 'content-type', + 'etag', + 'expires', + 'from', + 'host', + 'if-modified-since', + 'if-unmodified-since', + 'last-modified', + 'location', + 'max-forwards', + 'proxy-authorization', + 'referer', + 'retry-after', + 'user-agent' + ]; + e.exports = function (e) { + var t, n, i, s = {}; + return e ? (r.forEach(e.split('\n'), function (e) { + if (i = e.indexOf(':'), t = r.trim(e.substr(0, i)).toLowerCase(), n = r.trim(e.substr(i + 1)), t) { + if (s[t] && o.indexOf(t) >= 0) + return; + s[t] = 'set-cookie' === t ? (s[t] ? s[t] : []).concat([n]) : s[t] ? s[t] + ', ' + n : n; + } + }), s) : s; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + e.exports = r.isStandardBrowserEnv() ? function () { + var e, t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement('a'); + function o(e) { + var r = e; + return t && (n.setAttribute('href', r), r = n.href), n.setAttribute('href', r), { + href: n.href, + protocol: n.protocol ? n.protocol.replace(/:$/, '') : '', + host: n.host, + search: n.search ? n.search.replace(/^\?/, '') : '', + hash: n.hash ? n.hash.replace(/^#/, '') : '', + hostname: n.hostname, + port: n.port, + pathname: '/' === n.pathname.charAt(0) ? n.pathname : '/' + n.pathname + }; + } + return e = o(window.location.href), function (t) { + var n = r.isString(t) ? o(t) : t; + return n.protocol === e.protocol && n.host === e.host; + }; + }() : function () { + return !0; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + e.exports = r.isStandardBrowserEnv() ? { + write: function (e, t, n, o, i, s) { + var a = []; + a.push(e + '=' + encodeURIComponent(t)), r.isNumber(n) && a.push('expires=' + new Date(n).toGMTString()), r.isString(o) && a.push('path=' + o), r.isString(i) && a.push('domain=' + i), !0 === s && a.push('secure'), document.cookie = a.join('; '); + }, + read: function (e) { + var t = document.cookie.match(new RegExp('(^|;\\s*)(' + e + ')=([^;]*)')); + return t ? decodeURIComponent(t[3]) : null; + }, + remove: function (e) { + this.write(e, '', Date.now() - 86400000); + } + } : { + write: function () { + }, + read: function () { + return null; + }, + remove: function () { + } + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(145); + function o(e) { + if ('function' !== typeof e) + throw new TypeError('executor must be a function.'); + var t; + this.promise = new Promise(function (e) { + t = e; + }); + var n = this; + e(function (e) { + n.reason || (n.reason = new r(e), t(n.reason)); + }); + } + o.prototype.throwIfRequested = function () { + if (this.reason) + throw this.reason; + }, o.source = function () { + var e; + return { + token: new o(function (t) { + e = t; + }), + cancel: e + }; + }, e.exports = o; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e) { + return function (t) { + return e.apply(null, t); + }; + }; + }, + function (e, t, n) { + 'use strict'; + function r(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + function o(e, t) { + var n = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var r = Object.getOwnPropertySymbols(e); + t && (r = r.filter(function (t) { + return Object.getOwnPropertyDescriptor(e, t).enumerable; + })), n.push.apply(n, r); + } + return n; + } + function i(e) { + for (var t = 1; t < arguments.length; t++) { + var n = null != arguments[t] ? arguments[t] : {}; + t % 2 ? o(Object(n), !0).forEach(function (t) { + r(e, t, n[t]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : o(Object(n)).forEach(function (t) { + Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)); + }); + } + return e; + } + n.r(t), n.d(t, 'qcCmpApi', function () { + return ut; + }), n.d(t, 'uspApi', function () { + return ct; + }); + var s = n(0), a = n.n(s); + function u(e, t, n, r, o, i, s) { + try { + var a = e[i](s), u = a.value; + } catch (c) { + return void n(c); + } + a.done ? t(u) : Promise.resolve(u).then(r, o); + } + function c(e) { + return function () { + var t = this, n = arguments; + return new Promise(function (r, o) { + var i = e.apply(t, n); + function s(e) { + u(i, r, o, s, a, 'next', e); + } + function a(e) { + u(i, r, o, s, a, 'throw', e); + } + s(void 0); + }); + }; + } + function f(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + function l(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + function p(e, t, n) { + return t && l(e.prototype, t), n && l(e, n), e; + } + var d, h, v, y, g = n(146); + n(133), n(134), n(135); + !function (e) { + e[e.TOP_LEFT = 1] = 'TOP_LEFT', e[e.TOP_RIGHT = 2] = 'TOP_RIGHT', e[e.BOTTOM_RIGHT = 3] = 'BOTTOM_RIGHT', e[e.BOTTOM_LEFT = 4] = 'BOTTOM_LEFT'; + }(d || (d = {})), function (e) { + e.YES = 'Y', e.NOT = 'N'; + }(h || (h = {})), function (e) { + e.GLOBAL = 'global', e.SERVICE = 'service', e.GLOBAL_GROUP = 'global group', e.SERVICE_GROUP = 'service group'; + }(v || (v = {})), function (e) { + e.GDPR = 'GDPR', e.USP = 'USP'; + }(y || (y = {})); + var m = { hasCookie: !1 }, b = function e() { + f(this, e), this.vendorConsents = i({}, m), this.purposesConsents = i({}, m), this.specialFeatures = i({}, m), this.vendorLegitimateInterest = i({}, m), this.legitimatePurposesConsents = i({}, m), this.nonIabConsents = i({}, m), this.googleConsents = i({}, m), this.consentScreen = 0, this.allConsents = !1; + }, E = (n(136), { + uspVersion: 1, + uspJurisdiction: [], + uspLspact: h.NOT, + uspPrivacyPolicyLink: '', + uspDeleteDataLink: '', + uspAccessDataLink: '', + cookieDomain: window.location.hostname, + suppressCcpaLinks: !0 + }), C = { + defaultToggleValue: 'off', + displayUi: 'always', + displayPersistentConsentLink: !0, + hashCode: '', + groupSitesUrl: '', + initScreenRejectButtonShowing: !0, + initScreenBodyTextOption: 1, + lang_: 'en', + nonconsentDisplayFrequency: 1, + persistentConsentLinkLocation: d.BOTTOM_RIGHT, + publisherLogo: '', + publisherName: '', + stacks: [], + publisherFeaturesIds: [], + publisherSpecialFeaturesIds: [], + publisherSpecialPurposesIds: [], + publisherPurposeIds: [], + publisherPurposeLegitimateInterestIds: [], + publisherVendorListUrl: '', + publisherCountryCode: 'GB', + vendorPurposeIds: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + vendorPurposeLegitimateInterestIds: [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + vendorSpecialFeaturesIds: [ + 1, + 2 + ], + vendorSpecialPurposesIds: [ + 1, + 2 + ], + vendorFeaturesIds: [ + 1, + 2, + 3 + ], + rejectConsentRedirectUrl: '', + softOptInEnabled: !1, + uiLayout: 'popup', + vendorListUpdateFreq: 30, + consentScopeGroupURL: '', + cookieDomain: window.location.hostname, + cookiePath: '/', + thirdPartyStorageType: 'iframe', + showSummaryView: !0, + googleEnabled: !1, + consentOnSafari: !1, + isAMP: !1, + publisherConsentRestrictionIds: [], + publisherLIRestrictionIds: [], + consentIdentityEnabled: !1 + }, _ = { + initScreenCustomLinks: [], + linksTitle: 'Additional Links', + nonIabVendorsLabel: 'Non-IAB Vendors' + }, S = { + uspDnsTitle: 'Do Not Sell My Personal Information', + uspDnsText: [ + 'We, and our partners, use technologies to process personal information, including IP addresses, pseudonymous identifiers associated with cookies, and in some cases mobile ad IDs. This information is processed to personalize content based on your interests, run and optimize marketing campaigns, measure the performance of ads and content, and derive insights about the audiences who engage with ads and content. This data is an integral part of how we operate our site, make revenue to support our staff, and generate relevant content for our audience. You can learn more about our data collection and use practices in our Privacy Policy.', + 'If you wish to request that your personal information is not shared with third parties, please click on the below checkbox and confirm your selection. Please note that after your opt out request is processed, we may still collect your information in order to operate our site.' + ], + uspDoNotSellToggleText: 'I want to make a "Do Not Sell My Personal Information" request. Note: this action will make it harder to us to tailor content for you.', + uspPrivacyPolicyLinkText: 'Privacy Policy', + uspDeleteDataLinkText: 'Data Deletion', + uspAccessDataLinkText: 'Data Access', + uspAcceptButton: 'CONFIRM' + }, w = { + initScreenTitle: 'We value your privacy', + agreeButton: 'AGREE', + initScreenRejectButton: 'DISAGREE', + initScreenSettingsButton: 'MORE OPTIONS', + summaryScreenBodyNoRejectService: [ + 'We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.', + ' With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may access more detailed information and change your preferences before consenting or to refuse consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to this website only. You can change your preferences at any time by returning to this site or visit our privacy policy.\n' + ], + summaryScreenBodyNoRejectGlobal: [ + 'We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.', + ' With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may access more detailed information and change your preferences before consenting or to refuse consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply across the web. You can change your preferences at any time by returning to this site or visit our privacy policy.' + ], + summaryScreenBodyNoRejectGroup: [ + 'We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.', + ' With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may access more detailed information and change your preferences before consenting or to refuse consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to a group of websites [hyperlinked to domain where all the properties are listed for this group configuration].You can change your preferences at any time by returning to this site or visit our privacy policy.' + ], + summaryScreenBodyRejectService: [ + 'We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.', + ' With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may click to refuse to consent or access more detailed information and change your preferences before consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to this website only. You can change your preferences at any time by returning to this site or visit our privacy policy.' + ], + summaryScreenBodyRejectGlobal: [ + 'We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.', + ' With your permission we and our partners may use precise geolocation data and identification through device scanning.You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may click to refuse to consent or access more detailed information and change your preferences before consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply across the web.You can change your preferences at any time by returning to this site or visit our privacy policy.' + ], + summaryScreenBodyRejectGroup: [ + 'We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.', + ' With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may click to refuse to consent or access more detailed information and change your preferences before consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to a group of websites [links to domain where all the properties are listed for this group configuration]. You can change your preferences at any time by returning to this site or visit our privacy policy.' + ], + initScreenBodyGlobal: 'We and our partners store or access information on devices, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for the purposes described below. You may click to consent to our and our partners\u2019 processing for such purposes. Alternatively, you may click to refuse to consent, or access more detailed information to change your preferences before consenting. Your preferences will apply across the web. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. You can change your preferences at any time by returning to this site or visit our privacy policy.', + initScreenBodyService: 'We and our partners store or access information on devices, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for the purposes described below. You may click to consent to our and our partners\u2019 processing for such purposes. Alternatively, you may click to refuse to consent, or access more detailed information and change your preferences before consenting. Your preferences will apply to this website only. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. You can change your preferences at any time by returning to this site or visit our privacy policy.', + initScreenBodyGroup: 'We and our partners store or access information on devices, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for the purposes described below. You may click to consent to our and our partners\u2019 processing for such purposes. Alternatively, you may click to refuse to consent, or access more detailed information and change your preferences before consenting. Your preferences will apply to a group of websites [links to domain where all the properties are listed for this group configuration]. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. You can change your preferences at any time by returning to this site or visit our privacy policy.', + specialPurposesAndFeatures: 'Special Purposes and Features', + saveAndExitButton: 'SAVE & EXIT', + purposeScreenVendorLink: 'PARTNERS', + legitimateInterestLink: 'LEGITIMATE INTEREST ', + specialPurposesLabel: 'Special Purposes', + specialFeaturesLabel: 'Special Features', + featuresLabel: 'Features', + back: 'Back', + onLabel: 'ON', + offLabel: 'OFF', + multiLabel: 'MULTI', + legalDescription: 'Legal Description', + showPartners: 'Show Partners', + hidePartners: 'Hide Partners', + vendorScreenBody: 'Review and set your consent preferences for each partner below. Expand each partner list item for more information to help make your choice. Some personal data is processed without your consent, but you have the right to object.', + privacyPolicyLabel: 'Privacy Policy', + descriptionLabel: 'Vendor Description', + legitimateScreenBody: 'Review and object to processing of personal data without your consent on the basis of a legitimate interest for each purpose and by each partner below. Expand each purpose or partner list item for more information to help make your choice. To object to the special purposes of ensuring security, preventing fraud, and debugging, and technically delivering ads or content click on a partner\'s privacy policy link.', + legitimateInterestPurposesLabel: 'Legitimate Interest Purpose(s)', + legitimateInterestVendorLabel: 'Legitimate Interest Vendors', + legitimateScreenObject: 'OBJECT (translation hint: verb to object)', + legitimateScreenObjected: 'OBJECTED', + legitimateScreenAccept: 'REMOVE OBJECTION', + objectAllButton: 'OBJECT ALL', + persistentConsentLinkLabel: 'Privacy', + nonIabVendorsNotice: 'Vendors who do not participate in the IAB Europe Transparency and Consent Framework and do not adhere to its policies or technical specifications', + googlePartners: 'Google Partners', + cookieMaxAgeLabel: 'Max cookie age', + secondsLabel: 'seconds', + daysLabel: 'days', + storageDisclosureLabel: 'Cookie disclosure' + }, I = { + nonIabVendorListUrl: '', + vendorBlacklist: [], + vendorWhitelist: [] + }, O = { + uxBackgroundColor: '#fff', + uxPrimaryButtonColor: '#206DC5', + uxPrimaryButtonTextColor: '#fff', + uxSecondaryButtonColor: '#fff', + uxSecondaryButtonTextColor: '#206DC5', + uxToogleActiveColor: '#206DC5', + uxLinkColor: '#206DC5', + uxFontColor: '#141e23' + }, A = parseInt(''.concat('23')), L = Number.isNaN(A) ? 1 : A, P = { + VENDOR_CONSENT: 'cmpconsent', + NONIABVENDOR_CONSENT: 'cmpnoniab', + REPROMPT_HASH: 'cmpreprompthash' + }, T = i(i({}, P), {}, { + QUANTCAST_ACCOUNT_ID: 'cmpaccountid', + REFERRER: 'ref' + }), k = i(i({}, P), {}, { + DISPLAY_UI: 'displayconsentui', + LOGGED_IN: 'cmploggedin' + }), x = { + CMPLIST: 'CMPList', + VENDOR_CONSENT: 'euconsent-v2', + NONIABVENDOR_CONSENT: 'noniabvendorconsent', + PUBLISHER_CONSENT: 'eupubconsent', + BLOCKED_HASH: '_cmpBlockedVendorsHash', + NON_IAB_HASH: '_cmpNonIabVendorsHash', + REPROMPT_HASH: '_cmpRepromptHash', + US_PRIVACY: 'usprivacy', + GOOGLE_CONSENT: 'addtl_consent' + }, R = n(137), N = { + quantcastAccountId: { + type: 'string', + values: '' + }, + consentScope: { + type: 'string', + values: [ + v.GLOBAL, + v.SERVICE, + v.GLOBAL_GROUP, + v.SERVICE_GROUP + ] + }, + defaultToggleValue: { + type: 'string', + values: [ + 'on', + 'off' + ] + }, + displayUi: { + type: 'string', + values: [ + 'never', + 'inEU', + 'always' + ] + }, + displayPersistentConsentLink: { + type: 'boolean', + values: '' + }, + groupSitesUrl: { + type: 'string', + values: '' + }, + hashCode: { + type: 'string', + values: '' + }, + initScreenRejectButtonShowing: { + type: 'boolean', + values: '' + }, + isAMP: { + type: 'boolean', + values: '' + }, + initScreenBodyTextOption: { + type: 'number', + values: '' + }, + lang_: { + type: 'string', + values: R + }, + nonconsentDisplayFrequency: { + type: 'number', + values: '' + }, + persistentConsentLinkLocation: { + type: 'number', + values: [ + 1, + 2, + 3, + 4 + ] + }, + publisherLogo: { + type: 'string', + values: '' + }, + publisherName: { + type: 'string', + values: '' + }, + publisherFeaturesIds: { + type: 'array', + values: [ + 1, + 2, + 3 + ] + }, + publisherSpecialFeaturesIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2 + ] + }, + publisherSpecialPurposesIds: { + type: 'array', + values: [ + 1, + 2 + ] + }, + publisherPurposeIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + publisherPurposeLegitimateInterestIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + publisherVendorListUrl: { + type: 'string', + values: '' + }, + publisherCountryCode: { + type: 'string', + values: [ + 'AF', + 'AX', + 'AL', + 'DZ', + 'AS', + 'AD', + 'AO', + 'AI', + 'AQ', + 'AG', + 'AR', + 'AM', + 'AW', + 'AU', + 'AT', + 'AZ', + 'BS', + 'BH', + 'BD', + 'BB', + 'BY', + 'BE', + 'BZ', + 'BJ', + 'BM', + 'BT', + 'BO', + 'BA', + 'BW', + 'BV', + 'BR', + 'IO', + 'BN', + 'BG', + 'BF', + 'BI', + 'KH', + 'CM', + 'CA', + 'CV', + 'KY', + 'CF', + 'TD', + 'CL', + 'CN', + 'CX', + 'CC', + 'CO', + 'KM', + 'CG', + 'CD', + 'CK', + 'CR', + 'CI', + 'HR', + 'CU', + 'CY', + 'CZ', + 'DK', + 'DJ', + 'DM', + 'DO', + 'EC', + 'EG', + 'SV', + 'GQ', + 'ER', + 'EE', + 'ET', + 'FK', + 'FO', + 'FJ', + 'FI', + 'FR', + 'GF', + 'PF', + 'TF', + 'GA', + 'GM', + 'GE', + 'DE', + 'GH', + 'GI', + 'GR', + 'GL', + 'GD', + 'GP', + 'GU', + 'GT', + 'GG', + 'GN', + 'GW', + 'GY', + 'HT', + 'HM', + 'VA', + 'HN', + 'HK', + 'HU', + 'IS', + 'IN', + 'ID', + 'IR', + 'IQ', + 'IE', + 'IM', + 'IL', + 'IT', + 'JM', + 'JP', + 'JE', + 'JO', + 'KZ', + 'KE', + 'KI', + 'KR', + 'KW', + 'KG', + 'LA', + 'LV', + 'LB', + 'LS', + 'LR', + 'LY', + 'LI', + 'LT', + 'LU', + 'MO', + 'MK', + 'MG', + 'MW', + 'MY', + 'MV', + 'ML', + 'MT', + 'MH', + 'MQ', + 'MR', + 'MU', + 'YT', + 'MX', + 'FM', + 'MD', + 'MC', + 'MN', + 'ME', + 'MS', + 'MA', + 'MZ', + 'MM', + 'NA', + 'NR', + 'NP', + 'NL', + 'AN', + 'NC', + 'NZ', + 'NI', + 'NE', + 'NG', + 'NU', + 'NF', + 'MP', + 'NO', + 'OM', + 'PK', + 'PW', + 'PS', + 'PA', + 'PG', + 'PY', + 'PE', + 'PH', + 'PN', + 'PL', + 'PT', + 'PR', + 'QA', + 'RE', + 'RO', + 'RU', + 'RW', + 'BL', + 'SH', + 'KN', + 'LC', + 'MF', + 'PM', + 'VC', + 'WS', + 'SM', + 'ST', + 'SA', + 'SN', + 'RS', + 'SC', + 'SL', + 'SG', + 'SK', + 'SI', + 'SB', + 'SO', + 'ZA', + 'GS', + 'ES', + 'LK', + 'SD', + 'SR', + 'SJ', + 'SZ', + 'SE', + 'CH', + 'SY', + 'TW', + 'TJ', + 'TZ', + 'TH', + 'TL', + 'TG', + 'TK', + 'TO', + 'TT', + 'TN', + 'TR', + 'TM', + 'TC', + 'TV', + 'UG', + 'UA', + 'AE', + 'GB', + 'US', + 'UM', + 'UY', + 'UZ', + 'VU', + 'VE', + 'VN', + 'VG', + 'VI', + 'WF', + 'EH', + 'YE', + 'ZM', + 'ZW' + ] + }, + vendorPurposeIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + vendorPurposeLegitimateInterestIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ] + }, + vendorSpecialFeaturesIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2 + ] + }, + vendorSpecialPurposesIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2 + ] + }, + vendorFeaturesIds: { + type: 'array', + canBeEmpty: !0, + values: [ + 1, + 2, + 3 + ] + }, + rejectConsentRedirectUrl: { + type: 'string', + values: '' + }, + stacks: { + type: 'array', + values: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42 + ] + }, + softOptInEnabled: { + type: 'boolean', + values: '' + }, + uiLayout: { + type: 'string', + values: [ + 'popup', + 'banner' + ] + }, + vendorListUpdateFreq: { + type: 'number', + values: '' + }, + consentScopeGroupURL: { + type: 'string', + values: '' + }, + cookieDomain: { + type: 'string', + values: '' + }, + cookiePath: { + type: 'string', + values: '' + }, + thirdPartyStorageType: { + type: 'string', + values: [ + 'iframe', + 'api' + ] + }, + showSummaryView: { + type: 'boolean', + values: '' + }, + privacyMode: { + type: 'array', + values: [ + y.GDPR, + y.USP + ] + }, + uspVersion: { + type: 'number', + values: [1] + }, + uspJurisdiction: { + type: 'array', + values: [ + 'US', + 'CA' + ] + }, + uspLspact: { + type: 'string', + values: [ + h.YES, + h.NOT + ] + }, + uspPrivacyPolicyLink: { + type: 'string', + values: '' + }, + uspDeleteDataLink: { + type: 'string', + values: '' + }, + uspAccessDataLink: { + type: 'string', + values: '' + }, + suppressCcpaLinks: { + type: 'boolean', + values: '' + }, + googleEnabled: { + type: 'boolean', + values: '' + }, + publisherConsentRestrictionIds: { + type: 'array', + values: '', + arrayType: 'number' + }, + publisherLIRestrictionIds: { + type: 'array', + values: '', + arrayType: 'number' + }, + consentOnSafari: { + type: 'boolean', + values: '' + }, + consentIdentityEnabled: { + type: 'boolean', + values: '' + } + }, V = { + acceptAll: { type: 'string' }, + initScreenRejectButton: { type: 'string' }, + initScreenSettingsButton: { type: 'string' }, + initScreenTitle: { type: 'string' }, + persistentConsentLinkLabel: { type: 'string' }, + customInitScreenBodyText: { type: 'string' }, + customSecondScreenBodyText: { type: 'string' }, + customVendorScreenBodyText: { type: 'string' }, + customLegitimateScreenBodyText: { type: 'string' }, + summaryScreenBodyNoRejectService: { + type: 'array', + values: '' + }, + summaryScreenBodyNoRejectGlobal: { + type: 'array', + values: '' + }, + summaryScreenBodyNoRejectGroup: { + type: 'array', + values: '' + }, + summaryScreenBodyRejectService: { + type: 'array', + values: '' + }, + summaryScreenBodyRejectGlobal: { + type: 'array', + values: '' + }, + summaryScreenBodyRejectGroup: { + type: 'array', + values: '' + }, + groupOfSitesLabel: { type: 'string' }, + saveAndExitButton: { type: 'string' }, + agreeToSelectedButton: { type: 'string' }, + agreeButton: { type: 'string' }, + agreeAllButton: { type: 'string' }, + objectAllButton: { type: 'string' } + }, U = { + nonIabVendorListUrl: { + type: 'string', + values: '' + }, + vendorWhitelist: { + type: 'array', + values: '', + arrayType: 'number' + }, + vendorBlacklist: { + type: 'array', + values: '', + arrayType: 'number' + } + }, j = { + initScreenCustomLinks: { + type: 'array', + values: '', + arrayType: 'object' + }, + linksTitle: { type: 'string' }, + nonIabVendorsLabel: { type: 'string' }, + uspDnsTitle: { type: 'string' }, + uspDnsText: { + type: 'array', + values: '', + arrayType: 'string' + }, + uspDoNotSellToggleText: { type: 'string' }, + uspPrivacyPolicyLinkText: { type: 'string' }, + uspDeleteDataLinkText: { type: 'string' }, + uspAccessDataLinkText: { type: 'string' }, + uspAcceptButton: { type: 'string' } + }, B = { + uxBackgroundColor: { + type: 'string', + values: '' + }, + uxPrimaryButtonColor: { + type: 'string', + values: '' + }, + uxPrimaryButtonTextColor: { + type: 'string', + values: '' + }, + uxSecondaryButtonColor: { + type: 'string', + values: '' + }, + uxSecondaryButtonTextColor: { + type: 'string', + values: '' + }, + uxToogleActiveColor: { + type: 'string', + values: '' + }, + uxLinkColor: { + type: 'string', + values: '' + }, + uxFontColor: { + type: 'string', + values: '' + } + }, M = { + nonIabVendorList: { + type: 'array', + values: '', + arrayType: 'object' + }, + updateAt: { + type: 'string', + values: '' + }, + nonIabVendorsHash: { + type: 'string', + values: '' + } + }, D = function (e, t, n) { + if (t in n) { + var r = e[t], o = n[t].type, i = n[t].values; + return '' !== r && (typeof r === o ? 'number' === o && r < 0 ? (console.warn(''.concat(t, ' must be a valid number')), !1) : '' === i || (!!i.includes(r) || (console.warn(''.concat(t, ' must be a valid value')), !1)) : (console.warn(''.concat(t, ' must be ').concat(o)), !1)); + } + return console.warn(''.concat(t, ' is not a valid config value')), !1; + }, F = function (e, t, n) { + var r = e[t]; + if (Array.isArray(r)) { + if (!r.length) + return !0 === n[t].canBeEmpty && r; + var o = []; + return r.forEach(function (e) { + 'string' === typeof n[t].values ? typeof e === n[t].arrayType ? o.push(e) : console.warn(''.concat(e, ' ').concat('is not a valid value for', ' ').concat(t)) : n[t].values.includes(e) ? o.push(e) : console.warn(''.concat(e, ' ').concat('is not a valid value for', ' ').concat(t)); + }), !!o.length && o; + } + return console.warn(''.concat(t, ' must be an array')), !1; + }, G = function () { + function e(t) { + var n = this; + f(this, e), this._coreConfig = void 0, this._premiumProperties = void 0, this._coreUiLabels = void 0, this._premiumUiLabels = void 0, this._theme = void 0, this._nonIabVendorsInfo = void 0, this.cleanConfig = void 0, this.checkRequiredValues = function () { + var e = n.cleanConfig.coreConfig; + 'consentScope' in e || (n.cleanConfig.coreConfig.consentScope = v.SERVICE), 'privacyMode' in e || (n.cleanConfig.coreConfig.privacyMode = [y.GDPR]); + }, this.validateConfig = function (e) { + var t = {}, r = {}, o = {}, i = {}, s = {}, a = void 0; + return e.coreConfig && (t = n.filterConfig(e.coreConfig, N)), e.coreUiLabels && (r = n.filterLabels(e.coreUiLabels, V)), e.premiumProperties && (o = n.filterConfig(e.premiumProperties, U)), e.premiumUiLabels && (i = n.filterLabels(e.premiumUiLabels, j)), e.theme && (s = n.filterConfig(e.theme, B)), e.nonIabVendorsInfo && (a = n.filterConfig(e.nonIabVendorsInfo, M)), { + coreConfig: t, + coreUiLabels: r, + premiumProperties: o, + premiumUiLabels: i, + theme: s, + nonIabVendorsInfo: a + }; + }, this.filterConfig = function (e, t) { + var n = {}; + for (var r in e) + if (r in t) + if ('array' === t[r].type) { + var o = F(e, r, t); + o && (n[r] = o); + } else + D(e, r, t) && (n[r] = e[r]); + return n; + }, this.filterLabels = function (e, t) { + var n = {}; + for (var r in e) + if (r in t) + if ('string' === t[r].type) + '' !== e[r] ? n[r] = e[r] : console.warn(''.concat(r, ' cannot be empty')); + else { + var o = F(e, r, t); + o && (n[r] = o); + } + return n; + }, this.getCustomCoreUiLabels = function () { + return n.cleanConfig.coreUiLabels; + }, this.initializeConfig = function () { + Object.keys(n.cleanConfig).forEach(function (e) { + n[e] && (n[e] = i(i({}, n[e]), n.cleanConfig[e])); + }); + }, this.cleanConfig = this.validateConfig(t), this.checkRequiredValues(); + var r = this.cleanConfig, o = r.coreConfig, s = o.privacyMode, a = o.consentScope, u = o.quantcastAccountId, c = r.nonIabVendorsInfo; + s.includes(y.GDPR) && s.includes(y.USP) ? (this._coreConfig = i(i({ + quantcastAccountId: u, + consentScope: a, + privacyMode: s + }, C), E), this._premiumUiLabels = i(i({}, S), _), this._premiumProperties = i({}, I), this._coreUiLabels = i({}, w), this._theme = i({}, O), c && (this._nonIabVendorsInfo = c)) : s.includes('GDPR') ? (this._coreConfig = i({ + quantcastAccountId: u, + consentScope: a, + privacyMode: s + }, C), this._premiumUiLabels = i({}, _), this._premiumProperties = i({}, I), this._coreUiLabels = i({}, w), this._theme = i({}, O), c && (this._nonIabVendorsInfo = c)) : (this._coreConfig = i({ + quantcastAccountId: u, + consentScope: a, + privacyMode: s + }, E), this._premiumUiLabels = i({}, S), this._premiumProperties = {}, this._coreUiLabels = {}, this._theme = i({}, O)); + } + return p(e, [ + { + key: 'getCustomPremiumUiLabels', + value: function () { + return this.cleanConfig.premiumUiLabels; + } + }, + { + key: 'coreConfig', + get: function () { + return this._coreConfig; + }, + set: function (e) { + var t = this, n = [ + 'publisherLogo', + 'publisherName', + 'publisherFeaturesIds', + 'publisherSpecialFeaturesIds', + 'publisherSpecialPurposesIds', + 'publisherPurposeIds', + 'publisherPurposeLegitimateInterestIds', + 'publisherVendorListUrl', + 'publisherVendorListUrl', + 'publisherCountryCode', + 'vendorPurposeIds', + 'vendorPurposeLegitimateInterestIds', + 'vendorSpecialFeaturesIds', + 'vendorSpecialPurposesIds', + 'vendorFeaturesIds', + 'rejectConsentRedirectUrl', + 'stacks' + ], r = [ + 'nonconsentDisplayFrequency', + 'vendorListUpdateFreq' + ]; + Object.keys(e).forEach(function (o) { + if (e[o] !== t.coreConfig[o]) { + if (-1 !== n.indexOf(o) && ('' === e[o] || e[o] === [])) + throw new Error(''.concat(o, ' cannot be empty')); + if (r.indexOf(o) && e[o] < 0) + throw new Error(''.concat(o, ' cannot be a negative number')); + } + }), this._coreConfig = e; + } + }, + { + key: 'premiumProperties', + get: function () { + return this._premiumProperties; + }, + set: function (e) { + var t = this; + Object.keys(e).forEach(function (n) { + if (t.premiumProperties[n] !== e[n] && ('' === e[n] || e[n] === [])) + throw new Error(''.concat(n, ' cannot be empty')); + }), this._premiumProperties = e; + } + }, + { + key: 'coreUiLabels', + get: function () { + return this._coreUiLabels; + }, + set: function (e) { + var t = this; + Object.keys(e).forEach(function (n) { + if (t.coreUiLabels[n] !== e[n] && '' === e[n]) + throw new Error(''.concat(n, ' cannot be empty')); + }), this._coreUiLabels = e; + } + }, + { + key: 'theme', + get: function () { + return this._theme; + }, + set: function (e) { + var t = this; + Object.keys(e).forEach(function (n) { + if (t.theme[n] !== e[n] && '' === e[n]) + throw new Error(''.concat(n, ' cannot be empty')); + }), this._theme = e; + } + }, + { + key: 'nonIabVendorsInfo', + get: function () { + return this._nonIabVendorsInfo; + }, + set: function (e) { + this._nonIabVendorsInfo = e; + } + }, + { + key: 'premiumUiLabels', + get: function () { + return this._premiumUiLabels; + }, + set: function (e) { + var t = this; + Object.keys(e).forEach(function (n) { + if (t.premiumUiLabels[n] !== e[n] && !e[n].length) + throw new Error(''.concat(n, ' cannot be empty')); + }), this._premiumUiLabels = e; + } + } + ]), e; + }(); + function H(e, t) { + (null == t || t > e.length) && (t = e.length); + for (var n = 0, r = new Array(t); n < t; n++) + r[n] = e[n]; + return r; + } + function q(e, t) { + if (e) { + if ('string' === typeof e) + return H(e, t); + var n = Object.prototype.toString.call(e).slice(8, -1); + return 'Object' === n && e.constructor && (n = e.constructor.name), 'Map' === n || 'Set' === n ? Array.from(n) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? H(e, t) : void 0; + } + } + function Y(e, t) { + return function (e) { + if (Array.isArray(e)) + return e; + }(e) || function (e, t) { + if ('undefined' !== typeof Symbol && Symbol.iterator in Object(e)) { + var n = [], r = !0, o = !1, i = void 0; + try { + for (var s, a = e[Symbol.iterator](); !(r = (s = a.next()).done) && (n.push(s.value), !t || n.length !== t); r = !0); + } catch (u) { + o = !0, i = u; + } finally { + try { + r || null == a.return || a.return(); + } finally { + if (o) + throw i; + } + } + return n; + } + }(e, t) || q(e, t) || function () { + throw new TypeError('Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + }(); + } + var z = n(19), W = n(137), J = function () { + function e() { + var t = this; + f(this, e), this.__tcfapiui = void 0, this.__tcfapiui = function (e) { + for (var n = t.__tcfapiui.a = t.__tcfapiui.a || [], r = window.document, o = arguments.length, i = new Array(o > 1 ? o - 1 : 0), s = 1; s < o; s++) + i[s - 1] = arguments[s]; + if (n.push([e].concat(i)), !r.getElementById('__tcfapiuiscript')) { + var a = document.createElement('script'), u = (Ie.coreConfig.lang_ || 'en').toLowerCase(); + W.includes(u) || (u = 'en'); + var c = 'https://quantcast.mgr.consensu.org/tcfv2/23/cmp2ui.js'; + c = c.replace('.js', '-'.concat(u, '.js')), a.type = 'text/javascript', a.id = '__tcfapiuiscript', a.src = c, r.head.appendChild(a); + } + }, window.__tcfapiui || (window.__tcfapiui = this.__tcfapiui); + } + return p(e, [{ + key: 'displayUi', + value: function () { + var e = c(a.a.mark(function e(t) { + var n, r, o, i, s, u, c, f = arguments; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (r = f.length > 1 && void 0 !== f[1] ? f[1] : 1, o = f.length > 2 && void 0 !== f[2] && f[2], i = null === (n = Ie.coreConfig.privacyMode) || void 0 === n ? void 0 : n.includes(t), we.updateApiVisible(t, i), i) { + e.next = 7; + break; + } + return console.warn('attempt to show disabled CMP UI regulation='.concat(t)), e.abrupt('return'); + case 7: + if (!(s = 'GDPR' === t)) { + e.next = 14; + break; + } + return e.next = 11, we.loadGVL(); + case 11: + e.t0 = e.sent, e.next = 15; + break; + case 14: + e.t0 = void 0; + case 15: + if (u = e.t0, e.t1 = t, e.t2 = r, e.t3 = o, e.t4 = Ie, e.t5 = u, !s) { + e.next = 27; + break; + } + return e.next = 24, we.getConsents(); + case 24: + e.t6 = e.sent, e.next = 28; + break; + case 27: + e.t6 = {}; + case 28: + e.t7 = e.t6, e.t8 = s ? Pe.data.data.nonIabVendorList : {}, e.t9 = s ? Ue.data : {}, c = { + regulation: e.t1, + page: e.t2, + isMandatory: e.t3, + config: e.t4, + gvl: e.t5, + consentInfo: e.t7, + nonIabVendorList: e.t8, + googleData: e.t9 + }, window.__tcfapiui('displayUi', c); + case 33: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + }]), e; + }(), K = n(147), Q = n.n(K).a.create({ xsrfCookieName: null }), Z = function (e) { + Object({ + NODE_ENV: 'production', + PUBLIC_URL: '', + REACT_APP_LOG_API: 'https://audit-tcfv2.quantcast.mgr.consensu.org', + REACT_APP_GEOIP_API_URL: 'https://apis.quantcast.mgr.consensu.org/geoip', + REACT_APP_CMP_COOKIE_API: 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', + REACT_APP_GOOGLE_ATP_URL: 'https://quantcast.mgr.consensu.org/tcfv2/google-atp-list.json', + REACT_APP_CONSENTED_IDENTITY_WEBSITE_API: 'https://app.permisio.com/api', + REACT_APP_VERSION: '23', + REACT_APP_CMPUI_SRC: 'https://quantcast.mgr.consensu.org/tcfv2/23/cmp2ui.js', + REACT_APP_GVL_BASE_URL: 'https://quantcast.mgr.consensu.org/GVL-v2/', + REACT_APP_TRANSLATION_BASE_URL: 'https://www.quantcast.mgr.consensu.org/tcfv2/translations/' + }).REACT_APP_DEBUG && console.log('Debug: ' + e); + }, X = function () { + function e(t) { + switch (f(this, e), this._isUserInEU = void 0, this._isUserInUS = void 0, this._userSpecificLocation = void 0, this._userSpecificLocation = null, t) { + case 'inUS': + this._isUserInEU = false, this._isUserInUS = true; + break; + case 'inEU': + this._isUserInEU = false, this._isUserInUS = true; + break; + default: + this._isUserInEU = false, this._isUserInUS = true; + } + } + return p(e, [ + { + key: 'checkSpecificLocation', + value: function () { + var e = c(a.a.mark(function e() { + var t, n, r; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Ie.coreConfig.privacyMode, this._userSpecificLocation) { + e.next = 23; + break; + } + if (Z('initUspLocation: exact location request'), !t.includes('USP')) { + e.next = 23; + break; + } + if (n = Ie.coreConfig.uspJurisdiction, !this.isUserInUS) { + e.next = 22; + break; + } + if (n.includes('US')) { + e.next = 19; + break; + } + return e.prev = 7, e.next = 10, Q.get('https://apis.quantcast.mgr.consensu.org/geoip'); + case 10: + r = e.sent, this._userSpecificLocation = r.data, e.next = 17; + break; + case 14: + e.prev = 14, e.t0 = e.catch(7), console.log(e.t0); + case 17: + e.next = 20; + break; + case 19: + this._userSpecificLocation = 'US'; + case 20: + e.next = 23; + break; + case 22: + this._userSpecificLocation = 'non-US'; + case 23: + return e.abrupt('return', this._userSpecificLocation); + case 24: + case 'end': + return e.stop(); + } + }, e, this, [[ + 7, + 14 + ]]); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'isUserInEU', + set: function (e) { + Z('this should only be used for testing'), this._isUserInEU = e; + }, + get: function () { + return this._isUserInEU; + } + }, + { + key: 'isUserInUS', + set: function (e) { + Z('this should only be used for testing'), this._isUserInUS = e; + }, + get: function () { + return this._isUserInUS; + } + }, + { + key: 'userSpecificLocation', + set: function (e) { + Z('this should only be used for testing'), this._userSpecificLocation = e; + }, + get: function () { + return this._userSpecificLocation; + } + } + ]), e; + }(), $ = function () { + function e(t) { + var n = this; + if (f(this, e), this._searchParams = void 0, this._consentValues = void 0, this._searchParams = {}, t) { + var r = Object.keys(k).map(function (e) { + return k[e]; + }), o = new RegExp('(?:^|[?&])('.concat(r.join('|'), ')(?:=([^&]*))?'), 'g'), i = new URL(window.location.href); + i.search = window.location.search.replace(o, function (e, t, r) { + return n._searchParams[t] = r || null, ''; + }).replace(/^&/, '?').replace(/^\?$/, ''), window.history.replaceState({}, '', i.toString()); + } + } + return p(e, [ + { + key: 'shouldRedirectForConsent', + value: function () { + var e = this; + return new Promise(function (t) { + var n = Ie.coreConfig.quantcastAccountId; + if (Object.keys(P).some(function (t) { + return e.hasParam(P[t]); + })) + t(!1); + else { + var r = ''.concat(T.QUANTCAST_ACCOUNT_ID, '=').concat(n) + '&'.concat(T.REFERRER, '=').concat(encodeURIComponent(window.location.href)); + e.checkRedirectAPI().then(function () { + t(!0), window.location.assign(''.concat('https://app.permisio.com/api', '/check?').concat(r)); + }).catch(function () { + t(!1); + }); + } + }); + } + }, + { + key: 'checkRedirectAPI', + value: function () { + var e = c(a.a.mark(function e() { + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return e.abrupt('return', new Promise(function () { + var e = c(a.a.mark(function e(t, n) { + var r; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return r = ''.concat('https://app.permisio.com/api'.replace('/api', '/alive')), e.prev = 1, e.next = 4, Q.get(r, { timeout: 1000 }); + case 4: + 'ok' === e.sent.data ? t('alive') : n('bad response'), e.next = 11; + break; + case 8: + e.prev = 8, e.t0 = e.catch(1), n('error'); + case 11: + case 'end': + return e.stop(); + } + }, e, null, [[ + 1, + 8 + ]]); + })); + return function (t, n) { + return e.apply(this, arguments); + }; + }())); + case 1: + case 'end': + return e.stop(); + } + }, e); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'saveConsentFromRedirect', + value: function () { + var e = this.getConsentFromParams(), t = e[x.VENDOR_CONSENT], n = e[x.REPROMPT_HASH], r = e[x.NONIABVENDOR_CONSENT]; + t && n && we.setData(t, r, n); + } + }, + { + key: 'saveConsentToPermisio', + value: function (e, t, n) { + var r = Ie.coreConfig.quantcastAccountId, o = encodeURIComponent(window.location.href), i = ''.concat(T.QUANTCAST_ACCOUNT_ID, '=').concat(r) + '&'.concat(T.REFERRER, '=').concat(o) + '&'.concat(T.VENDOR_CONSENT, '=').concat(e || '') + '&'.concat(T.NONIABVENDOR_CONSENT, '=').concat(t || '') + '&'.concat(T.REPROMPT_HASH, '=').concat(n || ''), s = ''.concat('https://app.permisio.com/api', '/save?').concat(i); + if (this.isLoggedInToPermisio()) + this.checkRedirectAPI().then(function () { + window.location.assign(s); + }).catch(function (e) { + console.log(e); + }); + else { + var a = window.open(s, 'LogInToPermisioWindow'); + a && a.focus(); + } + } + }, + { + key: 'hasParam', + value: function (e) { + return this._searchParams.hasOwnProperty(e); + } + }, + { + key: 'hasEditConsentParam', + value: function () { + return this.hasParam(k.DISPLAY_UI); + } + }, + { + key: 'isLoggedInToPermisio', + value: function () { + return this.hasParam(k.LOGGED_IN); + } + }, + { + key: 'getConsentFromParams', + value: function () { + var e = this; + if (!this._consentValues) { + var t = this._searchParams[P.VENDOR_CONSENT] && this._searchParams[P.REPROMPT_HASH]; + this._consentValues = Object.keys(P).reduce(function (n, r) { + var o = P[r]; + return n[x[r]] = t && e._searchParams[o] || null, n; + }, {}); + } + return this._consentValues; + } + } + ]), e; + }(), ee = n(148), te = n.n(ee), ne = function () { + function e() { + f(this, e), this._values = void 0, this._values = { + euconsent: '', + nonIabVendorConsent: '', + nonIabVendorsHash: '', + fetched: !1, + promise: Promise.resolve() + }; + } + return p(e, [{ + key: 'values', + set: function (e) { + this._values = e; + }, + get: function () { + return this._values; + } + }]), e; + }(); + function re(e, t, n, r) { + var o = n && document.getElementById(n); + return o || (o = document.createElement(e), t && (o.className = t), n && (o.id = n), r && r.insertBefore(o, r.firstChild)), o; + } + var oe = function (e) { + var t = e.coreConfig, n = t.publisherFeaturesIds, r = t.publisherSpecialFeaturesIds, o = t.publisherSpecialPurposesIds, i = t.publisherPurposeIds, s = t.publisherPurposeLegitimateInterestIds, a = t.vendorPurposeIds, u = t.vendorPurposeLegitimateInterestIds, c = t.vendorSpecialFeaturesIds, f = t.vendorSpecialPurposesIds, l = t.vendorFeaturesIds, p = [ + n, + r, + o, + i, + s, + a, + u, + c, + f, + l + ], d = (a || []).length; + return p.forEach(function (e) { + var t; + (t = e) && t.sort(function (e, t) { + return e - t; + }); + }), { + purposeIds: (d ? a : i) || [], + purposeLegitimateInterestIds: (d ? u : s) || [], + specialFeaturesIds: (d ? c : r) || [], + specialPurposesIds: (d ? f : o) || [], + featuresIds: (d ? l : n) || [] + }; + }, ie = function (e) { + var t, n = e.match(/\d+/g); + return n.shift(), null === n || void 0 === n ? void 0 : n.reduce(function (e, n, r, o) { + if (0 === r) + return t = parseInt(n, 10), e.concat(n); + var i = o[r] ? parseInt(n, 10) + t : null; + return t = i, i ? e.concat('.'.concat(i)) : e; + }, ''.concat(e[0], '~')); + }; + function se(e, t) { + return t && 'string' === typeof t ? e(t) : null; + } + var ae, ue, ce, fe, le, pe, de, he, ve, ye = function () { + function e() { + f(this, e), this.data = void 0, this._repromptOptionsHash = void 0, this._storedHash = void 0, this.data = new ne(), this._repromptOptionsHash = '', this._storedHash = ''; + } + return p(e, [ + { + key: 'shouldReprompt', + value: function () { + var e = this.generateRepromptOptionsHash(), t = !1; + return this._storedHash !== e && (t = !0), t; + } + }, + { + key: 'generateRepromptOptionsHash', + value: function () { + var e = this.data.values, t = e.euconsent, n = e.nonIabVendorConsent, r = e.nonIabVendorsHash, o = Ie.coreConfig, i = o.stacks, s = o.initScreenBodyTextOption, a = Ie.premiumProperties, u = a.vendorWhitelist, c = a.vendorBlacklist, f = oe(Ie), l = f.purposeIds, p = f.purposeLegitimateInterestIds, d = f.specialFeaturesIds, h = f.specialPurposesIds, v = f.featuresIds, y = this.createNewHash([ + i, + l, + p, + d, + h, + v, + u, + c + ]), g = t; + return g = ''.concat(g, '.').concat(s, '.').concat(y), g = n ? ''.concat(g, '.').concat(n) : g, g = r ? ''.concat(g, '.').concat(r) : g, this._repromptOptionsHash = g; + } + }, + { + key: 'createNewHash', + value: function (e) { + return te()(e, { + algorithm: 'md5', + encoding: 'base64' + }); + } + }, + { + key: 'setValues', + value: function (e) { + this.data.values = e; + } + }, + { + key: 'getValues', + value: function () { + return this.data.values; + } + }, + { + key: 'storedHash', + set: function (e) { + this._storedHash = e; + } + } + ]), e; + }(), ge = function () { + function e() { + f(this, e), this.LOWERCASE_START = 97, this.PAD_ZEROS = '00000000000000000000000000000000000000000000000000', this.COOKIE_MAX_AGE = 33696000, this.bitSizes = { + cmpId: 12, + created: 36, + consentScreen: 6, + consentLanguage: 12, + cmpVersion: 12, + cmpVersionOld: 6, + consentValue: 1, + defaultConsent: 1, + endVendorId: 16, + encodingType: 1, + isRange: 1, + lastUpdated: 36, + maxVendorId: 16, + numberCustomPurposes: 6, + numEntries: 12, + publisherPurposesVersion: 12, + purposesAlowed: 24, + standardPurposesAllowed: 24, + startVendorId: 16, + version: 6, + vendorListVersion: 12 + }, this._binaryStr = void 0, this._bitPosition = void 0, this.TCString = void 0, this._binaryStr = '', this._bitPosition = 0, this.TCString = new z.TCString(); + } + return p(e, [ + { + key: 'encode', + value: function (e, t) { + var n, r; + switch (e.cookieName) { + case x.NONIABVENDOR_CONSENT: + n = Ze([ + 'cookieName', + 'created', + 'lastUpdated', + 'cmpId', + 'cmpVersion', + 'maxVendorId', + 'vendorConsents' + ], e), r = 'nonIabVendorToBinary'; + break; + case x.PUBLISHER_CONSENT: + n = Ze([ + 'cookieName', + 'publisherPurposesVersion', + 'standardPurposesAllowed', + 'numberCustomPurposes', + 'version', + 'created', + 'lastUpdated', + 'cmpId', + 'cmpVersion', + 'consentScreen', + 'consentLanguage', + 'vendorListVersion', + 'customPurposeConsents' + ], e), r = 'publisherConsentToBinary'; + break; + case x.VENDOR_CONSENT: + n = Ze([ + 'cookieName', + 'vendorConsents', + 'purposeConsents', + 'specialFeatureOptins', + 'purposeLegitimateInterests', + 'vendorLegitimateInterests', + 'purposeLegitimateInterests', + 'publisherConsent', + 'publisherLegitimate', + 'publisherPurposeIds', + 'publisherPurposeLegitimateInterestIds' + ], e), r = 'encodeEuConsent'; + break; + case x.GOOGLE_CONSENT: + n = Ze([ + 'cookieName', + 'vendorConsents', + 'version' + ], e), r = 'encodeGoogleConsent'; + } + if (r && n) { + if (n.notFound) + return new Error(''.concat(n.notFound, ' keys not found')); + if (r.includes('ToBinary')) { + var o = this[r]({ + verifiedObject: n, + metadataOnly: t + }), i = this.binaryToBytes(o); + return this.toWebSafeBase64(i); + } + return this[r](n); + } + return new Error('Invalid cookie name'); + } + }, + { + key: 'decode', + value: function (e, t) { + var n = ''; + switch (e) { + case x.NONIABVENDOR_CONSENT: + n = 'decodeNonIabVendorBinary'; + break; + case x.PUBLISHER_CONSENT: + n = 'decodePublisherBinary'; + break; + case x.VENDOR_CONSENT: + n = 'decodeEuConsent'; + break; + case x.GOOGLE_CONSENT: + n = 'decodeGoogleConsent'; + } + if (n) { + if (n.includes('Binary')) { + var r = this.fromWebSafeBase64(t), o = this.bytesToBinary(r); + return this[n](o); + } + return this[n](t); + } + return new Error('Invalid cookie name'); + } + }, + { + key: 'addBinaryField', + value: function (e, t, n) { + var r = (e || 0).toString(2); + if (!(r.length <= t)) + throw new Error('Encountered an overflow setting cookie field '.concat(n)); + r = this.PAD_ZEROS.substr(0, t - r.length) + r, this.binaryStr += r; + } + }, + { + key: 'encodeGoogleConsent', + value: function (e) { + return e.vendorConsents.reduce(function (e, t, n, r) { + if (0 === n) + return e.concat(t); + var o = r[n] ? t - r[n - 1] : null; + return o ? e.concat('.'.concat(o)) : e; + }, ''.concat(e.version, '~')); + } + }, + { + key: 'decodeGoogleConsent', + value: function (e) { + var t, n = null === (t = ie(e).match(/\d+/g)) || void 0 === t ? void 0 : t.map(function (e) { + return parseInt(e, 10); + }); + return { + version: null === n || void 0 === n ? void 0 : n.shift(), + consentIds: n + }; + } + }, + { + key: 'encodeEuConsent', + value: function (e) { + var t = i({}, e.vendorConsents), n = i({}, e.vendorLegitimateInterests); + e.vendorConsents = t, e.vendorLegitimateInterests = n; + var o = function (t) { + for (var n in e[t]) + e[t][n] ? Ne[t].set(parseInt(n)) : Ne[t].unset(parseInt(n)); + }; + return [ + { + value: e.publisherConsent, + tcModelName: 'publisherConsents', + reduceArray: e.publisherPurposeIds + }, + { + value: e.publisherLegitimate, + tcModelName: 'publisherLegitimateInterests', + reduceArray: e.publisherPurposeLegitimateInterestIds + } + ].forEach(function (t) { + void 0 !== t.value && (e[t.tcModelName] = t.reduceArray.reduce(function (e, n) { + return i(i({}, e), {}, r({}, n, t.value)); + }, {})); + }), o('vendorConsents'), o('purposeConsents'), o('specialFeatureOptins'), o('vendorLegitimateInterests'), o('purposeLegitimateInterests'), o('publisherConsents'), o('publisherLegitimateInterests'), nt(Ne); + } + }, + { + key: 'decodeEuConsent', + value: function (e) { + return rt(e); + } + }, + { + key: 'nonIabVendorToBinary', + value: function (e) { + var t = e.verifiedObject, n = e.metadataOnly; + if (this.binaryStr = '', this.addBinaryField(Ke(t.created), this.bitSizes.created, 'created'), this.addBinaryField(Ke(t.lastUpdated), this.bitSizes.lastUpdated, 'lastUpdated'), this.addBinaryField(t.cmpId, this.bitSizes.cmpId, 'cmpId'), this.addBinaryField(t.cmpVersion, this.bitSizes.cmpVersion, 'cmpVersion'), n) + return this.binaryStr; + this.addBinaryField(t.maxVendorId, this.bitSizes.maxVendorId, 'maxVendorId'); + for (var r = 1; r <= t.maxVendorId; r++) + this.binaryStr += t.vendorConsents[r] ? '1' : '0'; + return this.binaryStr; + } + }, + { + key: 'decodeNonIabVendorBinary', + value: function (e) { + this.bitPosition = 0; + for (var t = { + created: Qe(this.getBits(this.bitSizes.created, e)), + lastUpdated: Qe(this.getBits(this.bitSizes.lastUpdated, e)), + cmpId: this.getBits(this.bitSizes.cmpId, e), + cmpVersion: this.getBits(this.bitSizes.cmpVersion, e), + maxVendorId: this.getBits(this.bitSizes.maxVendorId, e), + vendorConsents: [void 0] + }, n = t.maxVendorId || 1, r = new Array(n), o = 0; o < t.maxVendorId; o++) + r[o + 1] = '1' === e.charAt(this._bitPosition + o); + return t.vendorConsents = r, t; + } + }, + { + key: 'publisherConsentToBinary', + value: function (e) { + var t = e.verifiedObject, n = e.metadataOnly; + if (this.binaryStr = '', 2 !== t.version) + throw new Error('version ' + t.version + ' not supported'); + if (this.addBinaryField(t.version, this.bitSizes.version, 'version'), this.addBinaryField(Ke(t.created), this.bitSizes.created, 'created'), this.addBinaryField(Ke(t.lastUpdated), this.bitSizes.lastUpdated, 'lastUpdated'), this.addBinaryField(t.cmpId, this.bitSizes.cmpId, 'cmpId'), this.addBinaryField(t.cmpVersion, this.bitSizes.cmpVersion, 'cmpVersion'), this.addBinaryField(t.consentScreen, this.bitSizes.consentScreen, 'consentScreen'), this.addBinaryField(this.languageToCookieValue(t.consentLanguage), this.bitSizes.consentLanguage, 'consentLanguage'), this.addBinaryField(t.vendorListVersion, this.bitSizes.vendorListVersion, 'vendorListVersion'), this.addBinaryField(t.publisherPurposesVersion, this.bitSizes.publisherPurposesVersion, 'publisherPurposesVersion'), n) + return this.binaryStr; + this.addBinaryField(t.standardPurposesAllowed, this.bitSizes.standardPurposesAllowed, 'standardPurposesAllowed'), this.addBinaryField(t.numberCustomPurposes, this.bitSizes.numberCustomPurposes, 'numberCustomPurposes'); + for (var r = 1; r <= t.numberCustomPurposes; r++) + this.binaryStr += t.customPurposeConsents[r] ? '1' : '0'; + return this.binaryStr; + } + }, + { + key: 'decodePublisherBinary', + value: function (e) { + this.bitPosition = 0; + for (var t = { + version: this.getBits(this.bitSizes.version, e), + created: Qe(this.getBits(this.bitSizes.created, e)), + lastUpdated: Qe(this.getBits(this.bitSizes.lastUpdated, e)), + cmpId: this.getBits(this.bitSizes.cmpId, e), + cmpVersion: this.getBits(this.bitSizes.cmpVersion, e), + consentScreen: this.getBits(this.bitSizes.consentScreen, e), + consentLanguage: this.languageFromCookieValue(this.getBits(this.bitSizes.consentLanguage, e)), + vendorListVersion: this.getBits(this.bitSizes.vendorListVersion, e), + publisherPurposesVersion: this.getBits(this.bitSizes.publisherPurposesVersion, e), + standardPurposesAllowed: this.getBits(this.bitSizes.standardPurposesAllowed, e), + numberCustomPurposes: this.getBits(this.bitSizes.numberCustomPurposes, e), + customPurposeConsents: [void 0] + }, n = new Array(t.numberCustomPurposes + 1), r = 0; r < t.numberCustomPurposes; r++) + n[r + 1] = '1' === e.charAt(this._bitPosition + r); + return t.customPurposeConsents = n, t; + } + }, + { + key: 'binaryToBytes', + value: function (e) { + var t = ''; + e += this.PAD_ZEROS.substr(0, 7 - (e.length + 7) % 8); + for (var n = 0; n < e.length; n += 8) + t += String.fromCharCode(parseInt(e.substr(n, 8), 2)); + return t; + } + }, + { + key: 'bytesToBinary', + value: function (e) { + for (var t = '', n = 0; n < e.length; n++) + t += this.binary8Bits(e.charCodeAt(n)); + return t; + } + }, + { + key: 'binary8Bits', + value: function (e) { + var t = [ + '0000', + '0001', + '0010', + '0011', + '0100', + '0101', + '0110', + '0111', + '1000', + '1001', + '1010', + '1011', + '1100', + '1101', + '1110', + '1111' + ]; + return t[e >>> 4 & 15] + t[15 & e]; + } + }, + { + key: 'getBits', + value: function (e, t) { + var n = parseInt(t.substr(this.bitPosition, e), 2); + return this.bitPosition += e, n; + } + }, + { + key: 'toWebSafeBase64', + value: function (e) { + return btoa(e).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); + } + }, + { + key: 'fromWebSafeBase64', + value: function (e) { + return atob(e.replace(/-/g, '+').replace(/_/g, '/')); + } + }, + { + key: 'languageToCookieValue', + value: function (e) { + return 64 * (e.charCodeAt(0) - this.LOWERCASE_START) + (e.charCodeAt(1) - this.LOWERCASE_START); + } + }, + { + key: 'languageFromCookieValue', + value: function (e) { + return String.fromCharCode(this.LOWERCASE_START + e / 64 >>> 0) + String.fromCharCode(this.LOWERCASE_START + e % 64); + } + }, + { + key: 'deleteCookie', + value: function (e, t) { + document.cookie = ''.concat(e, '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; max-age=-1; domain=').concat(t); + } + }, + { + key: 'fallbackToLocalStorage', + value: function (e, t) { + this.saveOnLocalStorage(e, t) && this.deleteCookie(e); + } + }, + { + key: 'saveOnLocalStorage', + value: function (e, t) { + const $___old_7d9f63bbcd591f3f = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_7d9f63bbcd591f3f) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_923d772bdc21fd88.localStorage)); + return function () { + try { + return window.localStorage.setItem(e, t), !0; + } catch (n) { + return console.warn('Could not save data on local storage: Not enough space.'), !1; + } + }.apply(this, arguments); + } finally { + if ($___old_7d9f63bbcd591f3f) + ({}.constructor.defineProperty(window, 'localStorage', $___old_7d9f63bbcd591f3f)); + } + } + }, + { + key: 'set', + value: function (e, t) { + var n = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], r = !1; + n && (r = this.saveOnLocalStorage(e, t)), r || tt({ + cookieName: e, + encodedValue: t, + maxAge: this.COOKIE_MAX_AGE + }); + } + }, + { + key: 'get', + value: function (e) { + const $___old_d099478f95f89ec4 = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_d099478f95f89ec4) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_923d772bdc21fd88.localStorage)); + return function () { + if (window.localStorage.getItem(e)) + return window.localStorage.getItem(e); + var t = e.trim(), n = document.cookie.split(';').filter(function (e) { + return e.trim().startsWith(t + '='); + }).map(function (e) { + return e.trim().substring(t.length + 1); + }); + if (n.length) { + var r = ''; + return r = e === x.VENDOR_CONSENT ? it(n) : n[0], e !== x.VENDOR_CONSENT && e !== x.US_PRIVACY && e !== x.GOOGLE_CONSENT && this.fallbackToLocalStorage(t, r), r; + } + return new Error(''.concat(e, ' not found.')); + }.apply(this, arguments); + } finally { + if ($___old_d099478f95f89ec4) + ({}.constructor.defineProperty(window, 'localStorage', $___old_d099478f95f89ec4)); + } + } + }, + { + key: 'bitPosition', + get: function () { + return this._bitPosition; + }, + set: function (e) { + this._bitPosition = e; + } + }, + { + key: 'binaryStr', + set: function (e) { + this._binaryStr = e; + }, + get: function () { + return this._binaryStr; + } + } + ]), e; + }(); + function me(e) { + if ('undefined' === typeof Symbol || null == e[Symbol.iterator]) { + if (Array.isArray(e) || (e = q(e))) { + var t = 0, n = function () { + }; + return { + s: n, + n: function () { + return t >= e.length ? { done: !0 } : { + done: !1, + value: e[t++] + }; + }, + e: function (e) { + throw e; + }, + f: n + }; + } + throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + } + var r, o, i = !0, s = !1; + return { + s: function () { + r = e[Symbol.iterator](); + }, + n: function () { + var e = r.next(); + return i = e.done, e; + }, + e: function (e) { + s = !0, o = e; + }, + f: function () { + try { + i || null == r.return || r.return(); + } finally { + if (s) + throw o; + } + } + }; + } + function be(e) { + return function (e) { + if (Array.isArray(e)) + return H(e); + }(e) || function (e) { + if ('undefined' !== typeof Symbol && Symbol.iterator in Object(e)) + return Array.from(e); + }(e) || q(e) || function () { + throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + }(); + } + !function (e) { + e.GO_TO_PAGE = 'goToPage', e.PURPOSE = 'purpose', e.LEGITIMATE_PURPOSE = 'legitimatePurpose', e.LEGITIMATE_VENDOR = 'legitimateVendor', e.SPECIAL_FEATURE = 'specialFeature', e.STACK = 'stack', e.PARTIAL_CONSENT = 'partial', e.SAVE_AND_EXIT = 'saveAndExit', e.ACCEPT_ALL = 'acceptAll', e.REJECT_ALL = 'rejectAll', e.ACCEPT_ALL_LEGITIMATE = 'acceptAllLegitimate', e.OBJECT_ALL_LEGITIMATE = 'objectAllLegitimate', e.VENDOR = 'vendor', e.NON_IAB_VENDOR = 'nonIabVendor', e.DISMISS_UI = 'dismissUi', e.START_ON_PAGE = 'startOnPage', e.OPT_OUT_TOGGLE = 'optOutToggle', e.OPT_OUT_CONFIRM = 'optOutConfirm', e.EXPAND_ELEMENT = 'expandElement', e.COLLAPSE_ELEMENT = 'collapseElement', e.GOOGLE = 'googlePartner'; + }(ae || (ae = {})), function (e) { + e.MANDATORY = 'tcfui:mandatory', e.CHANGE_OF_CONSENT = 'tcfui:changeofconsent', e.CCPA = 'uspui:donotsell'; + }(ue || (ue = {})), function (e) { + e.FEATURES = 'Features', e.NON_IAB = 'Non IAB', e.PURPOSES = 'Purposes', e.LEGITIMATE_PURPOSES = 'Legitimate Purposes', e.LEGITIMATE_VENDORS = 'Legitimate Vendors', e.SPECIAL_PURPOSES = 'Special Purposes', e.SPECIAL_FEATURES = 'Special Features', e.VENDORS = 'Vendors', e.STACKS = 'Stacks', e.GOOGLE = 'Google'; + }(ce || (ce = {})), function (e) { + e.INIT = 'init', e.NAVIGATION = 'navigation', e.DONE = 'done'; + }(fe || (fe = {})), function (e) { + e.ACCEPT_ALL = 'All', e.ACCEPT_PARTIAL = 'Partial', e.REJECT = 'Reject'; + }(le || (le = {})), function (e) { + e.NONE_OBJECTED = 'None', e.ALL_OBJECTED = 'All'; + }(pe || (pe = {})), function (e) { + e.STACKS = 'stacks', e.VENDORS = 'vendors', e.FEATURES = 'features', e.PURPOSES = 'purposes', e.SPECIAL_FEATURES = 'specialFeatures', e.SPECIAL_PURPOSES = 'specialPurposes', e.FLEXIBLE_PURPOSES = 'flexiblePurposes', e.LEGITIMATE_VENDORS = 'legitimateVendors', e.LEGITIMATE_PURPOSES = 'legitimatePurposes', e.UNFILTERED_FEATURES = 'unfilteredFeatures', e.UNFILTERED_PURPOSES = 'unfilteredPurposes', e.UNFILTERED_SPECIAL_FEATURES = 'unfilteredSpecialFeatures', e.UNFILTERED_SPECIAL_PURPOSES = 'unfilteredSpecialPurposes'; + }(de || (de = {})), function (e) { + e.CONSENT_RESPONSE = 'consent-response', e.CONSENT_UI = 'consent-ui'; + }(he || (he = {})), function (e) { + e.ACCEPT = 'accept', e.REJECT = 'reject', e.DISMISS = 'dismiss', e.ENTER_FULLSCREEN = 'enter-fullscreen'; + }(ve || (ve = {})); + var Ee = n(149), Ce = n.n(Ee), _e = { + en: 'Privacy', + fr: 'Confidentialité', + de: 'Datenschutz', + it: 'Riservatezza', + es: 'Privacidad', + da: 'Privatlivets fred', + nl: 'Privacy', + el: 'Απόρρητο', + hu: 'Adatvédelem', + pt: 'Privacidade', + ro: 'Confidențialitate', + fi: 'Yksityisyys', + pl: 'Prywatność', + sk: 'Súkromie', + sv: 'Integritet', + no: 'Personvern', + ru: 'Конфиденциальность', + ar: 'إعدادات الخصوصية', + fa: 'تنظیمات حریم خصوصی' + }; + function Se(e, t, n) { + var o, i = function () { + var e = 'qc-cmp2-container'; + return re('div', e, e, document.body); + }(), s = 'qc-cmp2-persistent-link', a = re('a', s, s, i); + if (a.firstChild) + return a; + a.onclick = function () { + return window.__tcfapi('displayConsentUi', 2, function () { + }); + }; + var u = re('img', void 0, void 0, a), c = e || _e[(t || 'en').toLowerCase()] || _e.en; + u.src = Ce.a, u.alt = c; + var f = document.createTextNode(c); + a.appendChild(f); + var l = re('style', void 0, 'qc-cmp2', document.head), p = Y((o = {}, r(o, d.TOP_LEFT, [ + 'top', + 'left' + ]), r(o, d.TOP_RIGHT, [ + 'top', + 'right' + ]), r(o, d.BOTTOM_LEFT, [ + 'bottom', + 'left' + ]), r(o, d.BOTTOM_RIGHT, [ + 'bottom', + 'right' + ]), o)[n], 2), h = p[0], v = p[1], y = 'top' === h ? 'bottom' : 'top'; + return l.innerHTML = '.qc-cmp2-persistent-link {cursor:pointer; position:fixed; background-color:#368BD6;padding:5px 15px; color:#FFF; display:flex;align-items:center; max-height:30px; z-index:2147483640;' + ''.concat(h, ':0; ').concat(v, ':0;') + 'border-'.concat(y, '-left-radius:3px;') + 'border-'.concat(y, '-right-radius:3px;') + '}.qc-cmp2-persistent-link img {width:16px; height:17px; margin-right:5px;}', a; + } + var we, Ie, Oe, Ae, Le, Pe, Te, ke, xe, Re, Ne, Ve, Ue, je = function () { + function e() { + var t = this; + f(this, e), this._cookieValues = void 0, this._deletedVendors = void 0, this.isSafari = void 0, this.resolveCookie = void 0, this.resolveCookie = function () { + }, this._cookieValues = { + euconsent: '', + nonIabVendorConsent: '', + googleCookieValue: '', + fetched: !1, + promise: new Promise(function (e) { + return t.resolveCookie = e; + }) + }, this._deletedVendors = [], this.isSafari = ot('safari'); + } + return p(e, [ + { + key: 'getCoreConfig', + value: function () { + return Ie.coreConfig; + } + }, + { + key: 'getConsents', + value: function () { + var e = c(a.a.mark(function e() { + var t, n, o, s, u, c, f, l, p, d, h, v, y, g, m, E, C; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = ce.VENDORS, n = ce.LEGITIMATE_VENDORS, o = ce.LEGITIMATE_PURPOSES, s = ce.PURPOSES, u = ce.SPECIAL_FEATURES, c = ce.NON_IAB, f = ce.GOOGLE, this._cookieValues.fetched) { + e.next = 4; + break; + } + return e.next = 4, this._cookieValues.promise; + case 4: + return l = se(ke.decode, this._cookieValues.euconsent), p = new b(), d = Ne.gvl, h = Ie.coreConfig.publisherName || Ie.coreConfig.cookieDomain || '', v = Ie.coreConfig, y = v.publisherPurposeIds, g = v.publisherPurposeLegitimateInterestIds, m = d.vendors, (y || g) && (m = i(i({}, m), {}, r({}, h, { + id: h, + name: h + }))), this.populateConsents(p, t, m, l), this.populateConsents(p, s, d.purposes, l), this.populateConsents(p, u, d.specialFeatures, l), this.populateConsents(p, n, m, l), this.populateConsents(p, o, d.purposes, l), E = se(Pe.decode, this._cookieValues.nonIabVendorConsent), this.populateConsents(p, c, Pe.data.data.nonIabVendorList, E), C = se(Ue.decode, this._cookieValues.googleCookieValue), this.populateConsents(p, f, Ue.data, C), e.abrupt('return', p); + case 21: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'extractNumericKeys', + value: function (e) { + var t = {}; + for (var n in e) { + var r = parseInt(n); + isNaN(r) || (t[n] = e[n]); + } + return t; + } + }, + { + key: 'setConsents', + value: function (e) { + var t = Ie.coreConfig, n = t.publisherPurposeIds, r = t.publisherPurposeLegitimateInterestIds, o = t.publisherName, s = t.consentIdentityEnabled, a = t.isAMP; + e.consentScreen && (Ne.consentScreen = e.consentScreen); + var u, c = ke.encode(this.extractNumericKeys(e.vendorConsents), this.extractNumericKeys(e.purposesConsents), this.extractNumericKeys(e.specialFeatures), this.extractNumericKeys(e.vendorLegitimateInterest), this.extractNumericKeys(e.legitimatePurposesConsents), e.vendorConsents[o], e.vendorLegitimateInterest[o], n, r), f = this.formatConsents(e.nonIabConsents), l = Ie.premiumProperties.nonIabVendorListUrl ? Pe.encode(f.consentArray, f.maxVendorId) : '', p = this.formatGoogleConsents(e), d = Ie.coreConfig.googleEnabled && p.length ? Ue.encode(p) : '', h = Pe.data.data.nonIabVendorsHash; + return p.length || a || Le.deleteCookie(x.GOOGLE_CONSENT, Ie.coreConfig.cookieDomain), Re.setValues({ + euconsent: c, + nonIabVendorConsent: l, + nonIabVendorsHash: h + }), u = Re.generateRepromptOptionsHash(), this.setData(c, l, u, d), this.updateApiVisible('GDPR', !1), s && xe.saveConsentToPermisio(c, l, u), i(i({}, this._cookieValues), {}, { allConsents: e.allConsents }); + } + }, + { + key: 'updateApiVisible', + value: function (e, t) { + if ('USP' !== e && Xe(Oe.isUserInEU, Ie.coreConfig.displayUi)) { + var n = this._cookieValues.euconsent; + n && !n.message || (n = ''), ut.cmpApi.update(n, t); + } else + ut.cmpApi.update(null); + Ie.coreConfig.privacyMode.includes('GDPR') && Ie.coreConfig.displayPersistentConsentLink && !Ie.coreConfig.isAMP && this.hasCookie() && Se(Ie.getCustomCoreUiLabels().persistentConsentLinkLabel, Ie.coreConfig.lang_, Ie.coreConfig.persistentConsentLinkLocation); + } + }, + { + key: 'setData', + value: function (e, t, n, r) { + var o = Ie.coreConfig, i = o.consentScope, s = o.thirdPartyStorageType, a = o.consentScopeGroupURL, u = o.consentOnSafari, c = o.isAMP, f = 'api' === s, l = this.isSafari && u; + c || (l ? this.setDataUsingApi(!0, a, e, t, n, r) : i === v.SERVICE || this.isSafari ? this.setDataUsingFirstParty(e, t, n, r) : i === v.GLOBAL ? (this.setDataUsingApi(!0, 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', e), this.setDataUsingFirstParty('', t, n)) : i === v.GLOBAL_GROUP ? f ? (this.setDataUsingApi(!0, 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', e), this.setDataUsingApi(!0, a, '', t, n)) : (this.setDataUsingApi(!0, 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', e), this.setDataUsingIframe('', t, n)) : i === v.SERVICE_GROUP && (f ? this.setDataUsingApi(!0, a, e, t, n, r) : this.setDataUsingIframe(e, t, n, r))), this._cookieValues = { + euconsent: e, + nonIabVendorConsent: t, + googleCookieValue: r, + fetched: !0, + promise: this._cookieValues.promise + }; + } + }, + { + key: 'setDataUsingApi', + value: function (e, t, n, r, o, i) { + var s = {}; + n && (s[x.VENDOR_CONSENT] = n), r && (s[x.NONIABVENDOR_CONSENT] = r), o && (s[x.REPROMPT_HASH] = o), i && (s[x.GOOGLE_CONSENT] = i), Q({ + method: 'post', + url: t, + data: s, + withCredentials: e + }).then(function () { + console.log('the cookies was saved successfully'); + }); + } + }, + { + key: 'setDataUsingIframe', + value: function (e, t, n, r) { + e && ze.tryGroupCookieAccessCall('set', x.VENDOR_CONSENT, e), t && ze.tryGroupCookieAccessCall('set', x.NONIABVENDOR_CONSENT, t), n && ze.tryGroupCookieAccessCall('set', x.REPROMPT_HASH, n), r && ze.tryGroupCookieAccessCall('set', x.GOOGLE_CONSENT, r); + } + }, + { + key: 'setDataUsingFirstParty', + value: function (e, t, n, r) { + e && ke.setCookie(e), t && Pe.setCookie(t), n && Le.set(x.REPROMPT_HASH, n), r && Ue.setCookie(r); + } + }, + { + key: 'fetchCookieValues', + value: function () { + var e = c(a.a.mark(function e() { + var t, n, r, o, i, s, u, c, f, l, p, d, h; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Ie.coreConfig, n = t.consentScope, r = t.consentScopeGroupURL, o = t.thirdPartyStorageType, i = t.consentOnSafari, s = t.isAMP, u = '', c = '', f = '', l = {}, p = function (e) { + u = e.nonIabCookieValue, c = e.vendorCookieValue, f = e.googleCookieValue; + }, d = this.isSafari && i, !s) { + e.next = 13; + break; + } + h = JSON.parse(window.name), c = h.consentString, h.consentMetadata && h.consentMetadata.additionalConsent && (f = h.consentMetadata.additionalConsent), e.next = 68; + break; + case 13: + if (!d) { + e.next = 20; + break; + } + return e.next = 16, this.getDataUsingApi(!0, r); + case 16: + l = e.sent, p(l), e.next = 68; + break; + case 20: + if (n !== v.SERVICE && !this.isSafari) { + e.next = 25; + break; + } + l = this.getDataUsingFirstParty(), p(l), e.next = 68; + break; + case 25: + if (n !== v.GLOBAL) { + e.next = 34; + break; + } + return e.next = 28, this.getDataUsingApi(!0, 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', !0); + case 28: + l = e.sent, c = l.vendorCookieValue, l = this.getDataUsingFirstParty(!0), u = l.nonIabCookieValue, e.next = 68; + break; + case 34: + if (n !== v.GLOBAL_GROUP) { + e.next = 56; + break; + } + if ('api' !== o) { + e.next = 46; + break; + } + return e.next = 38, this.getDataUsingApi(!0, 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', !0); + case 38: + return l = e.sent, c = l.vendorCookieValue, e.next = 42, this.getDataUsingApi(!0, r); + case 42: + l = e.sent, u = l.nonIabCookieValue, e.next = 54; + break; + case 46: + return e.next = 48, this.getDataUsingApi(!0, 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', !0); + case 48: + return l = e.sent, c = l.vendorCookieValue, e.next = 52, this.getDataUsingIframe(!0); + case 52: + l = e.sent, u = l.nonIabCookieValue; + case 54: + e.next = 68; + break; + case 56: + if (n !== v.SERVICE_GROUP) { + e.next = 68; + break; + } + if ('api' !== o) { + e.next = 64; + break; + } + return e.next = 60, this.getDataUsingApi(!0, r); + case 60: + l = e.sent, p(l), e.next = 68; + break; + case 64: + return e.next = 66, this.getDataUsingIframe(); + case 66: + l = e.sent, p(l); + case 68: + this._cookieValues = { + euconsent: c, + nonIabVendorConsent: u, + googleCookieValue: f, + fetched: !0, + promise: this._cookieValues.promise + }, this.resolveCookie(); + case 70: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'getDataUsingApi', + value: function () { + var e = c(a.a.mark(function e(t, n, r) { + var o, i, s, u, c; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return o = Ie.coreConfig.consentIdentityEnabled, i = xe.getConsentFromParams(), e.next = 4, Q({ + method: 'get', + url: n, + withCredentials: t + }); + case 4: + return s = e.sent, u = {}, r ? u.vendorCookieValue = o && i[x.VENDOR_CONSENT] || s.data[x.VENDOR_CONSENT] : (c = o && i[x.REPROMPT_HASH] || s.data[x.REPROMPT_HASH], Re.storedHash = c, u.vendorCookieValue = o && i[x.VENDOR_CONSENT] || s.data[x.VENDOR_CONSENT], u.nonIabCookieValue = o && i[x.NONIABVENDOR_CONSENT] || s.data[x.NONIABVENDOR_CONSENT], u.googleCookieValue = s.data.addtl_consent), e.abrupt('return', u); + case 8: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t, n, r) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'getDataUsingIframe', + value: function () { + var e = c(a.a.mark(function e(t) { + var n, r, o, i, s, u, c, f, l; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (n = Ie.coreConfig, r = n.googleEnabled, o = n.consentIdentityEnabled, i = Ie.premiumProperties.nonIabVendorListUrl, s = xe.getConsentFromParams(), u = {}, e.t0 = o && s[x.REPROMPT_HASH], e.t0) { + e.next = 8; + break; + } + return e.next = 7, ze.tryGroupCookieAccessCall('get', x.REPROMPT_HASH, ''); + case 7: + e.t0 = e.sent; + case 8: + if (c = e.t0, Re.storedHash = c, !t || !i) { + e.next = 19; + break; + } + if (e.t1 = o && s[x.NONIABVENDOR_CONSENT], e.t1) { + e.next = 16; + break; + } + return e.next = 15, ze.tryGroupCookieAccessCall('get', x.NONIABVENDOR_CONSENT, ''); + case 15: + e.t1 = e.sent; + case 16: + u.nonIabCookieValue = e.t1, e.next = 37; + break; + case 19: + if (e.t2 = o && s[x.VENDOR_CONSENT], e.t2) { + e.next = 24; + break; + } + return e.next = 23, ze.tryGroupCookieAccessCall('get', x.VENDOR_CONSENT, ''); + case 23: + e.t2 = e.sent; + case 24: + if (u.vendorCookieValue = e.t2, !i) { + e.next = 31; + break; + } + return e.next = 28, ze.tryGroupCookieAccessCall('get', x.NONIABVENDOR_CONSENT, ''); + case 28: + (f = e.sent) && Array.isArray(f) ? f = f[0] : f || (f = null), u.nonIabCookieValue = o && s[x.NONIABVENDOR_CONSENT] || f; + case 31: + if (!r) { + e.next = 37; + break; + } + return e.next = 34, ze.tryGroupCookieAccessCall('get', x.GOOGLE_CONSENT, ''); + case 34: + (l = e.sent) && Array.isArray(l) ? l = l[0] : l || (l = null), u.googleCookieValue = l; + case 37: + return e.abrupt('return', u); + case 38: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'getDataUsingFirstParty', + value: function (e) { + var t = {}, n = Ie.coreConfig, r = n.googleEnabled, o = n.consentIdentityEnabled, i = Ie.premiumProperties.nonIabVendorListUrl, s = xe.getConsentFromParams(), a = s[x.VENDOR_CONSENT], u = s[x.REPROMPT_HASH], c = s[x.NONIABVENDOR_CONSENT], f = Le.get(x.VENDOR_CONSENT), l = Le.get(x.REPROMPT_HASH), p = Le.get(x.NONIABVENDOR_CONSENT), d = Le.get(x.GOOGLE_CONSENT); + Re.storedHash = l || o && u; + var h = f || o && a, v = p || o && c, y = d; + return e || ('string' === typeof h && (t.vendorCookieValue = h), r && 'string' === typeof y && (t.googleCookieValue = y)), i && 'string' === typeof v && (t.nonIabCookieValue = v), t; + } + }, + { + key: 'repromptDueToInvalidCMPID', + value: function () { + var e = c(a.a.mark(function e() { + var t, n, r, o, i, s, u, c, f; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Ie.coreConfig.isAMP, n = !1, t) { + e.next = 25; + break; + } + if (r = 'https://test.quantcast.mgr.consensu.org/GVL-v2/cmp-list.json', o = [], i = new Date(), s = Le.get(x.CMPLIST), !((u = s && !s.message ? JSON.parse(s) : null) && u.CMP && u.CMP.includes(String(Ne.cmpId)) && i.getTime() < u.expiry)) { + e.next = 12; + break; + } + n = !1, e.next = 25; + break; + case 12: + return e.prev = 12, e.next = 15, Q.get(r); + case 15: + c = e.sent, o.push.apply(o, be(Object.keys(c.data.cmps))), f = { + lastUpdated: c.data.lastUpdated, + CMP: o, + expiry: i.getTime() + 259200000 + }, Le.set(x.CMPLIST, JSON.stringify(f)), e.next = 24; + break; + case 21: + e.prev = 21, e.t0 = e.catch(12), console.log(e.t0); + case 24: + n = !o.includes(String(Ne.cmpId)); + case 25: + return e.abrupt('return', n); + case 26: + case 'end': + return e.stop(); + } + }, e, null, [[ + 12, + 21 + ]]); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'repromptDueToOutdatedGvl', + value: function () { + var e = c(a.a.mark(function e() { + var t, n, r, o, i, s, u, c, f, l; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Ie.coreConfig.vendorListUpdateFreq, this._cookieValues.fetched) { + e.next = 4; + break; + } + return e.next = 4, this._cookieValues.promise; + case 4: + if (n = se(ke.decode, this._cookieValues.euconsent), r = !1, !n) { + e.next = 17; + break; + } + if (o = n.vendorListVersion, i = n.policyVersion, s = n.lastUpdated, u = Date.now() - s.getTime() > 86400000 * t) { + e.next = 11; + break; + } + return e.abrupt('return', { + outdatedGvlReprompt: r, + decodedEuConsent: n + }); + case 11: + return e.next = 13, this.loadGVL(); + case 13: + c = Ne.gvl, f = c.vendorListVersion, l = c.tcfPolicyVersion, u && (f > o || l > i) && (r = !0), e.next = 18; + break; + case 17: + r = !0; + case 18: + return e.abrupt('return', { + outdatedGvlReprompt: r, + decodedEuConsent: n + }); + case 19: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'repromptDueToConsentOnDeletedVendors', + value: function (e) { + var t, n = !1, r = me(this._deletedVendors); + try { + for (r.s(); !(t = r.n()).done;) { + var o = t.value; + if (e.has(o)) { + n = !0; + break; + } + } + } catch (i) { + r.e(i); + } finally { + r.f(); + } + return n; + } + }, + { + key: 'fetchDataToReprompt', + value: function () { + var e = c(a.a.mark(function e() { + var t, n, r, o, s, u; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return e.next = 2, this.repromptDueToOutdatedGvl(); + case 2: + return t = e.sent, n = t.outdatedGvlReprompt, r = t.decodedEuConsent, e.next = 7, this.repromptDueToInvalidCMPID(); + case 7: + return o = e.sent, s = Ie.coreConfig.consentScope, (u = n || o) || (u = this.repromptDueToConsentOnDeletedVendors(r.vendorConsents.set_)) || 'global' === s || (Re.setValues(i(i({}, this._cookieValues), {}, { nonIabVendorsHash: Pe.data.data.nonIabVendorsHash })), u = Re.shouldReprompt()), e.abrupt('return', u); + case 12: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'populateConsents', + value: function (e, t, n, r) { + var o, i = ce.NON_IAB, s = ce.PURPOSES, a = ce.LEGITIMATE_PURPOSES, u = ce.LEGITIMATE_VENDORS, c = ce.VENDORS, f = ce.SPECIAL_FEATURES, l = ce.GOOGLE, p = '', d = ''; + switch (t) { + case i: + o = 'nonIabConsents', p = 'vendorConsents'; + break; + case c: + o = 'vendorConsents', p = 'vendorConsents', d = 'publisherConsents'; + break; + case s: + o = 'purposesConsents', p = 'purposeConsents'; + break; + case a: + o = 'legitimatePurposesConsents', p = 'purposeLegitimateInterests'; + break; + case u: + o = 'vendorLegitimateInterest', p = 'vendorLegitimateInterests', d = 'publisherLegitimateInterests'; + break; + case f: + o = 'specialFeatures', p = 'specialFeatureOptins'; + break; + case l: + o = 'googleConsents', p = 'consentIds'; + break; + default: + o = ''; + } + var h = null !== r && !r.message, v = Ie.coreConfig.publisherName; + if (e[o].hasCookie = h, h) + switch (t) { + case i: + if (n) { + var y, g = me(n); + try { + for (g.s(); !(y = g.n()).done;) { + var m = y.value, b = r[p][m.id]; + e[o][m.id] = b; + } + } catch (A) { + g.e(A); + } finally { + g.f(); + } + } + break; + case l: + if (n) { + var E, C = me(n); + try { + for (C.s(); !(E = C.n()).done;) { + var _ = E.value, S = parseInt(_.id, 10), w = r[p].includes(S); + e[o][S] = w; + } + } catch (A) { + C.e(A); + } finally { + C.f(); + } + } + break; + default: + for (var I in n) { + var O = I === v && d ? be(r[d].set_).length > 0 : r[p].has(parseInt(I)); + e[o][I] = O; + } + } + } + }, + { + key: 'formatConsents', + value: function (e) { + var t = 0, n = []; + for (var r in e) { + var o = parseInt(r); + isNaN(o) || (o > t && (t = o), n.push({ + consent: e[r], + id: o + })); + } + return { + consentArray: n, + maxVendorId: t + }; + } + }, + { + key: 'formatGoogleConsents', + value: function (e) { + var t = []; + for (var n in e.googleConsents) + !0 === e.googleConsents[n] && t.push(n); + return t.sort(function (e, t) { + return e - t; + }), t; + } + }, + { + key: 'regulationToInit', + value: function () { + var e = c(a.a.mark(function e() { + var t, n, r, o; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Ie.coreConfig.privacyMode, n = '', !t.includes('USP')) { + e.next = 14; + break; + } + if (r = Ie.coreConfig.uspJurisdiction, !Oe.isUserInUS || !r.length) { + e.next = 14; + break; + } + if (Z('initUspLocation: US'), r.includes('US')) { + e.next = 13; + break; + } + return e.next = 9, Oe.checkSpecificLocation(); + case 9: + Z('initUspLocation: specific location' + JSON.stringify(Oe.userSpecificLocation)), Oe.userSpecificLocation && Oe.userSpecificLocation.region && r.includes(Oe.userSpecificLocation.region.toUpperCase()) && (n = 'USP'), e.next = 14; + break; + case 13: + n = 'USP'; + case 14: + return t.includes('GDPR') && 'USP' !== n && (o = Ie.coreConfig.displayUi, (Oe.isUserInEU && 'inEU' === o || 'always' === o) && (n = 'GDPR')), e.abrupt('return', n); + case 16: + case 'end': + return e.stop(); + } + }, e); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'loadGVL', + value: function () { + var e = c(a.a.mark(function e() { + var t, n, r, o, i, s, u; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (t = Ie.coreConfig, n = t.privacyMode, r = t.lang_, o = Ie.premiumProperties, i = o.vendorWhitelist, s = o.vendorBlacklist, u = null === r || void 0 === r ? void 0 : r.toUpperCase(), Ne.gvl) { + e.next = 12; + break; + } + return Ne.gvl = new z.GVL('LATEST'), e.next = 6, Ne.gvl.readyPromise; + case 6: + if (!n.includes('GDPR')) { + e.next = 10; + break; + } + return e.next = 9, Ne.gvl.changeLanguage(u); + case 9: + this.filterGvl(Ne.gvl, i, s); + case 10: + e.next = 14; + break; + case 12: + return e.next = 14, Ne.gvl.readyPromise; + case 14: + return e.abrupt('return', Ne.gvl); + case 15: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'filterGvl', + value: function (e, t, n) { + var r = e.vendors, o = [], i = []; + Object.keys(r).forEach(function (e) { + r[e].deletedDate ? i.push(r[e].id) : o.push(r[e].id); + }), this.deletedVendors = i, t.length && (o = t.filter(function (e) { + return o.includes(e); + })), n.length ? e.narrowVendorsTo(o.filter(function (e) { + return !n.includes(e); + })) : e.narrowVendorsTo(o); + } + }, + { + key: 'hasCookie', + value: function () { + return !!this._cookieValues.euconsent; + } + }, + { + key: 'setPublisherRestriction', + value: function (e) { + Ne.publisherRestrictions.add(e.id, e.purposeRestriction); + } + }, + { + key: 'cookieValues', + get: function () { + return this._cookieValues; + } + }, + { + key: 'deletedVendors', + set: function (e) { + this._deletedVendors = e; + } + } + ]), e; + }(), Be = function () { + function e() { + f(this, e), this._data = void 0, this._fields = void 0, this._fields = { + created: new Date(), + lastUpdated: new Date(), + cmpId: 10, + cmpVersion: 26, + maxVendorId: 0, + vendorConsents: [] + }, this._data = { + nonIabVendorList: [], + updateAt: '', + nonIabVendorsHash: '' + }; + } + return p(e, [ + { + key: 'data', + set: function (e) { + this._data = e; + }, + get: function () { + return this._data; + } + }, + { + key: 'fields', + set: function (e) { + this._fields = e; + }, + get: function () { + return this._fields; + } + } + ]), e; + }(), Me = function () { + function e() { + f(this, e), this._data = void 0, this.created = void 0, this._data = new Be(), this.created = !1; + } + return p(e, [ + { + key: 'encode', + value: function (e, t) { + var n = []; + return e.forEach(function (e) { + n[e.id] = e.consent; + }), !1 === this.created ? (this.created = !0, this._data.fields = i(i({}, this._data.fields), {}, { + vendorConsents: n, + created: new Date(), + lastUpdated: new Date(), + maxVendorId: t + })) : this._data.fields = i(i({}, this._data.fields), {}, { + vendorConsents: n, + lastUpdated: new Date() + }), Le.encode(i({ cookieName: x.NONIABVENDOR_CONSENT }, this._data.fields)); + } + }, + { + key: 'decode', + value: function (e) { + return Le.decode(x.NONIABVENDOR_CONSENT, e); + } + }, + { + key: 'setCookie', + value: function (e) { + 'string' === typeof e ? Le.set(x.NONIABVENDOR_CONSENT, e) : console.error(e.message); + } + }, + { + key: 'getCookie', + value: function () { + var e = Le.get(x.NONIABVENDOR_CONSENT); + return e && 'string' === typeof e ? this.decode(e) : e; + } + }, + { + key: 'fetchList', + value: function () { + var e = c(a.a.mark(function e() { + var t, n, r; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (Ie.premiumProperties.nonIabVendorListUrl || Ie.nonIabVendorsInfo) { + e.next = 2; + break; + } + return e.abrupt('return'); + case 2: + if (e.prev = 2, 'undefined' === typeof Ie.nonIabVendorsInfo) { + e.next = 9; + break; + } + if (Ie.nonIabVendorsInfo.nonIabVendorList && 0 !== Ie.nonIabVendorsInfo.nonIabVendorList.length) { + e.next = 6; + break; + } + return e.abrupt('return'); + case 6: + t = Ie.nonIabVendorsInfo, e.next = 13; + break; + case 9: + return e.next = 11, Q.get(Ie.premiumProperties.nonIabVendorListUrl); + case 11: + n = e.sent, t = n.data; + case 13: + r = [], t.nonIabVendorList.forEach(function (e) { + var t = { + name: e.name, + id: e.vendorId, + policyUrl: !!e.privacyPolicyUrl && e.privacyPolicyUrl, + description: !!e.description && e.description, + purposes: 'nonIabPurposeConsentIds' in e && e.nonIabPurposeConsentIds, + legIntPurposes: 'nonIabPurposeLegitimateInterestIds' in e && e.nonIabPurposeLegitimateInterestIds + }; + r.push(t); + }), this._data.data = i(i({}, t), {}, { nonIabVendorList: r }), e.next = 21; + break; + case 18: + e.prev = 18, e.t0 = e.catch(2), console.log('error processing nonIabVendors', e.t0); + case 21: + case 'end': + return e.stop(); + } + }, e, this, [[ + 2, + 18 + ]]); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'data', + get: function () { + return this._data; + } + } + ]), e; + }(), De = function () { + function e() { + f(this, e); + } + return p(e, [ + { + key: 'encode', + value: function (e, t, n, r, o, i, s, a, u) { + return Le.encode({ + cookieName: x.VENDOR_CONSENT, + vendorConsents: e, + purposeConsents: t, + specialFeatureOptins: n, + vendorLegitimateInterests: r, + purposeLegitimateInterests: o, + publisherConsent: i, + publisherLegitimate: s, + publisherPurposeIds: a, + publisherPurposeLegitimateInterestIds: u + }); + } + }, + { + key: 'decode', + value: function (e) { + return Le.decode(x.VENDOR_CONSENT, e); + } + }, + { + key: 'setCookie', + value: function (e) { + 'string' === typeof e ? Le.set(x.VENDOR_CONSENT, e, !1) : console.error(e.message); + } + }, + { + key: 'getCookie', + value: function () { + var e = Le.get(x.VENDOR_CONSENT); + return e && 'string' === typeof e ? this.decode(e) : e; + } + } + ]), e; + }(), Fe = function () { + function e() { + f(this, e), this._uspVersion = void 0, this._baseString = void 0, this._noticegiven = void 0, this._optedout = void 0, this._lspact = void 0, this._uspVersion = 1, this._noticegiven = '-', this._optedout = '-', this._lspact = '-', this._baseString = null; + } + return p(e, [ + { + key: 'baseString', + set: function (e) { + this._baseString = e; + }, + get: function () { + return this._baseString; + } + }, + { + key: 'noticegiven', + set: function (e) { + this._noticegiven = e; + }, + get: function () { + return this._noticegiven; + } + }, + { + key: 'optedout', + set: function (e) { + this._optedout = e; + }, + get: function () { + return this._optedout; + } + }, + { + key: 'lspact', + set: function (e) { + this._lspact = e; + }, + get: function () { + return this._lspact; + } + }, + { + key: 'uspVersion', + get: function () { + return this._uspVersion; + } + } + ]), e; + }(), Ge = /^[1][nNyY-][nNyY-][nNyY-]$/, He = function () { + function e() { + f(this, e), this._data = void 0, this._data = new Fe(); + } + return p(e, [ + { + key: 'encode', + value: function (e, t) { + return this._data.baseString = ''.concat(e, 'Y').concat(t ? 'Y' : 'N').concat(Ie.coreConfig.uspLspact), this._data.baseString; + } + }, + { + key: 'setCookie', + value: function (e) { + 'string' === typeof e ? Ge.test(e) && Le.set(x.US_PRIVACY, e, !1) : e && 'message' in e && console.error(e.message); + } + }, + { + key: 'getCookie', + value: function () { + return Le.get(x.US_PRIVACY); + } + } + ]), e; + }(), qe = function () { + function e(t) { + f(this, e), this._cookieAccessIframe = void 0, this._isCookieAccessIframeReady = void 0, this.groupCookieAccessCallbacks = void 0, this._cookieAccessIframe = document.createElement('iframe'), this._isCookieAccessIframeReady = !1, this.groupCookieAccessCallbacks = {}, this.groupCookieAccessHandler = this.groupCookieAccessHandler.bind(this), window.addEventListener ? window.addEventListener('message', this.groupCookieAccessHandler, !1) : window.attachEvent('onmessage', this.groupCookieAccessHandler), this.createGroupCookieAccessIframe(t.coreConfig.consentScopeGroupURL, '_qc_cookie_access'); + } + return p(e, [ + { + key: 'tryGroupCookieAccessCall', + value: function (e, t, n) { + var r = this; + return new Promise(function (o) { + var i = setInterval(function () { + r._isCookieAccessIframeReady && r._cookieAccessIframe.contentWindow && (clearInterval(i), r.groupCookieAccessCall(e, t, n, function (e) { + o(e); + })); + }, 50); + }); + } + }, + { + key: 'groupCookieAccessCall', + value: function (e, t, n, r) { + var o = Math.random().toString(), i = { + callId: o, + __qcCmpCookieAccessCall: { + cmd: e, + cookieName: t + } + }; + if ('set' === e) { + this.groupCookieAccessCallbacks[o] = { + cookieName: t, + cookieValue: n + }; + var s = new Date(Date.now() + 33696000000).toUTCString(); + i.__qcCmpCookieAccessCall.cookieValue = n, i.__qcCmpCookieAccessCall.cookiePath = Ie.coreConfig.cookiePath, i.__qcCmpCookieAccessCall.expires = s; + } else + this.groupCookieAccessCallbacks[o] = { + cookieName: t, + resolve: r + }; + this._cookieAccessIframe.contentWindow.postMessage(i, '*'); + } + }, + { + key: 'createGroupCookieAccessIframe', + value: function (e, t) { + var n = this._cookieAccessIframe; + n.src = e, n.style.display = 'none', n.id = t; + !function e() { + document.body ? document.body.appendChild(n) : setTimeout(e, 5); + }(); + } + }, + { + key: 'groupCookieAccessHandler', + value: function (e) { + var t; + if ((t = 'string' === typeof e.data ? -1 !== e.data.indexOf('__qcCmpCookieAccessReturn') ? JSON.parse(e.data) : {} : e.data).__qcCmpCookieAccessReturn) { + if (t.__qcCmpCookieAccessReturn.isHandlerRegistered) + return void (this._isCookieAccessIframeReady = !0); + var n = t.__qcCmpCookieAccessReturn, r = this.groupCookieAccessCallbacks[t.callId]; + if (r.resolve) { + var o = null; + 'get' === n.cmd && (o = -1 !== [ + 'euconsent-v2', + 'addtl_consent' + ].indexOf(r.cookieName) ? 'euconsent-v2' === r.cookieName ? this.returnLatestVendorCookie(n.cookies) : n.isSuccess ? n.cookies[0] : null : n.cookies, r.resolve(o)), delete this.groupCookieAccessCallbacks[t.callId]; + } + } + } + }, + { + key: 'returnLatestVendorCookie', + value: function (e) { + return e && e.length ? it(e) : new Error('euconsent-v2 not found.'); + } + }, + { + key: 'isCookieAccessIframeReady', + get: function () { + return this.isCookieAccessIframeReady; + } + }, + { + key: 'cookieAccessIframe', + get: function () { + return this._cookieAccessIframe; + } + } + ]), e; + }(), Ye = function () { + function e() { + f(this, e), this.version = void 0, this._data = void 0, this.version = 1, this._data = []; + } + return p(e, [ + { + key: 'encode', + value: function (e) { + return Le.encode({ + cookieName: x.GOOGLE_CONSENT, + vendorConsents: e, + version: this.version + }); + } + }, + { + key: 'decode', + value: function (e) { + return Le.decode(x.GOOGLE_CONSENT, e); + } + }, + { + key: 'setCookie', + value: function (e) { + 'string' === typeof e ? Le.set(x.GOOGLE_CONSENT, e, !1) : console.error(e.message); + } + }, + { + key: 'getCookie', + value: function (e) { + var t = Le.get(x.GOOGLE_CONSENT); + return t && 'string' === typeof t ? e ? t : this.decode(t) : null; + } + }, + { + key: 'fetchPartners', + value: function () { + var e = c(a.a.mark(function e() { + var t, n, r, o, i; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (Ie.coreConfig.googleEnabled && !Ie.coreConfig.consentScope.includes('global')) { + e.next = 2; + break; + } + return e.abrupt('return'); + case 2: + return e.prev = 2, 'https://quantcast.mgr.consensu.org/tcfv2/google-atp-list.json', e.next = 6, Q.get('https://quantcast.mgr.consensu.org/tcfv2/google-atp-list.json'); + case 6: + for (r in (t = e.sent, n = [], t.data)) + 'undefined' !== typeof (o = t.data[r]).provider_id && '' !== o.provider_id && (i = { + name: o.provider_name, + id: o.provider_id, + policyUrl: o.policy_url, + description: o.domains + }, n.push(i)), this._data = n; + e.next = 14; + break; + case 11: + e.prev = 11, e.t0 = e.catch(2), console.log(e.t0); + case 14: + case 'end': + return e.stop(); + } + }, e, this, [[ + 2, + 11 + ]]); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'data', + get: function () { + return this._data; + } + } + ]), e; + }(); + z.GVL.baseUrl = 'https://quantcast.mgr.consensu.org/GVL-v2/'; + var ze, We = new J(), Je = function (e) { + return i(i(i(i({}, e.coreConfig), e.premiumProperties), e.coreUiLabels), e.premiumUiLabels); + }, Ke = function (e) { + return Math.floor(e.getTime() / 100); + }, Qe = function (e) { + return new Date(100 * e); + }, Ze = function (e, t) { + var n = Object.keys(t).filter(function (t) { + return -1 === e.indexOf(t); + }); + return n.length && (t.notFound = n), t; + }, Xe = function (e, t) { + return !(!e && 'always' !== t); + }, $e = function (e) { + return e.coreConfig.consentScope === v.GLOBAL || e.coreConfig.consentScope === v.GLOBAL_GROUP; + }, et = function (e, t) { + var n = {}; + return t && t.length > 0 ? (t.forEach(function (t) { + void 0 !== e[t] ? n[t] = e[t] : n[t] = !1; + }), n) : e; + }, tt = function (e) { + var t = new Date(Date.now() + 1000 * e.maxAge).toUTCString(), n = 'https:' === window.location.protocol ? ';SameSite=Lax;secure' : '', r = Ie.coreConfig.cookiePath || '/'; + document.cookie = e.cookieName + '=' + e.encodedValue + ';path=' + r + ';max-age=' + e.maxAge + ';expires=' + t + ';domain=' + Ie.coreConfig.cookieDomain + n; + }, nt = function (e) { + return z.TCString.encode(e); + }, rt = function (e) { + return z.TCString.decode(e); + }, ot = function (e) { + var t = !1; + switch (e) { + case 'firefox': + t = navigator.userAgent.toLowerCase().indexOf(e) > -1; + break; + case 'safari': + t = navigator.userAgent.toLowerCase().indexOf(e) > -1 && -1 === navigator.userAgent.toLowerCase().indexOf('chrome'); + } + return t; + }, it = function (e) { + var t = null, n = new Error('euconsent-v2 not valid'); + return e.forEach(function (e) { + var r = null; + try { + r = rt(e); + } catch (o) { + console.error('Failed to decode euconsent-v2 cookie: ' + e); + } + r && r.lastUpdated && r.lastUpdated > t && (t = r.lastUpdated, n = e); + }), n; + }, st = function () { + function e() { + var t = this; + f(this, e), this.cmpApi = void 0, this.isInitialized = void 0, this.config = void 0, this.MyCustomCommands = void 0; + var n, r = window.__tcfapi(); + r.length && r.forEach(function (e) { + e && 'init' === e[0] && (n = e[3]); + }), this.isInitialized = !1; + var o = 'thirdPartyStorageType' in n.coreConfig ? n.coreConfig.thirdPartyStorageType : 'iframe', i = 'consentScope' in n.coreConfig ? n.coreConfig.consentScope : 'service', s = 'consentScopeGroupURL' in n.coreConfig ? n.coreConfig.consentScopeGroupURL : '', u = i.includes('service'), l = i.includes('group'), p = l && 'api' === o, d = l && 'iframe' === o; + d && s && (ze = new qe(n)), this.MyCustomCommands = { + getConfig: function (e, n) { + var r = t.getConfig(n), o = !1; + 'object' === typeof r && (o = !0), e(r, o); + }, + getNonIABVendorConsents: function () { + var e = c(a.a.mark(function e(n, r) { + var o, i; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return e.next = 2, t.getNonIABVendorConsents(r); + case 2: + o = e.sent, i = !1, 'object' === typeof o && (i = !0), n(o, i); + case 6: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t, n) { + return e.apply(this, arguments); + }; + }(), + displayConsentUi: function (e) { + return e(t.displayConsentUi()); + }, + setConsentInfo: function (e, t) { + return e(we.setConsents(t)); + }, + setPublisherRestriction: function (e, t) { + return e(we.setPublisherRestriction(t)); + }, + notifyUiState: function (e, t) { + return e(we.updateApiVisible(t.regulation, t.visible)); + }, + init: function (e, n) { + return e(t.init(n)); + } + }, this.addGetTCDataToSupportGoogle(n, u, p, d), this.cmpApi = new g.CmpApi(10, L, u, this.MyCustomCommands); + } + return p(e, [ + { + key: 'addGetTCDataToSupportGoogle', + value: function () { + var e = c(a.a.mark(function e(t, n, r, o) { + var i, s; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + i = 'googleEnabled' in t.coreConfig && t.coreConfig.googleEnabled, n && i && (s = function () { + var e = c(a.a.mark(function e(t, n) { + var r, o; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if ('function' !== typeof t || 'object' !== typeof n) { + e.next = 8; + break; + } + if (we.cookieValues.fetched) { + e.next = 4; + break; + } + return e.next = 4, we.cookieValues.promise; + case 4: + r = we.cookieValues.googleCookieValue, o = r ? ie(r) : void 0, n.addtlConsent = o, t(n, !0); + case 8: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t, n) { + return e.apply(this, arguments); + }; + }(), this.MyCustomCommands.getTCData = s, this.MyCustomCommands.addEventListener = s, this.MyCustomCommands.getInAppTCData = s); + case 2: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function (t, n, r, o) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'displayConsentUi', + value: function () { + We.displayUi('GDPR', 1, !1); + } + }, + { + key: 'init', + value: function (e) { + this.isInitialized ? console.warn('init has already been called and should only be run one time.') : (this.isInitialized = !0, this.config || (this.config = new G(e), this.config.initializeConfig()), function (e) { + var t = (Ie = e).coreConfig, n = t.consentScope, r = t.privacyMode, o = t.publisherCountryCode, i = t.showSummaryView, s = t.consentIdentityEnabled; + we = new je(), Oe = new X('inUS'), Ae = function () { + var e = c(a.a.mark(function e() { + var t, n; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return t = '', e.prev = 1, e.next = 4, we.regulationToInit(); + case 4: + 'USP' === (t = e.sent) || r.includes('USP') ? ct.initUsp() : (n = function (e, t, n) { + 'getUSPData' === e && 1 === t && 'function' === typeof n && n({ + version: 1, + uspString: '1---' + }, !0); + }, Object.assign(window, { __uspapi: n })), e.next = 11; + break; + case 8: + e.prev = 8, e.t0 = e.catch(1), console.log(e.t0); + case 11: + return e.abrupt('return', t); + case 12: + case 'end': + return e.stop(); + } + }, e, null, [[ + 1, + 8 + ]]); + })); + return function () { + return e.apply(this, arguments); + }; + }(), Le = new ge(), Pe = new Me(), Te = new He(), ke = new De(), Ue = new Ye(), xe = new $(s), Re = new ye(), Ve = function () { + var e = c(a.a.mark(function e() { + var t, i, s, u, c; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return i = n.includes('service'), s = r.includes('GDPR'), (Ne = new z.TCModel()).cmpId = 10, Ne.cmpVersion = L, s && (Ne.publisherCountryCode = o), i && s && (u = oe(Ie), c = u.purposeIds, Ne.isServiceSpecific = !0, c.includes(1) || ('DE' === o ? Ne.purposeOneTreatment = !0 : c.push(1))), e.prev = 7, e.next = 10, we.fetchCookieValues(); + case 10: + if (!s) { + e.next = 15; + break; + } + return e.next = 13, Pe.fetchList(); + case 13: + return e.next = 15, Ue.fetchPartners(); + case 15: + return e.next = 17, we.fetchDataToReprompt(); + case 17: + if (!(t = e.sent)) { + e.next = 21; + break; + } + return e.next = 21, we.loadGVL(); + case 21: + e.next = 26; + break; + case 23: + e.prev = 23, e.t0 = e.catch(7), console.error(e.t0); + case 26: + return e.abrupt('return', t); + case 27: + case 'end': + return e.stop(); + } + }, e, null, [[ + 7, + 23 + ]]); + })); + return function () { + return e.apply(this, arguments); + }; + }(), s && xe.saveConsentFromRedirect(); + var u = Ve(), f = Ae(); + Promise.all([ + u, + f + ]).then(function () { + var e = c(a.a.mark(function e(t) { + var n, r, o; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (n = Y(t, 2), r = n[0], o = n[1], !s || !xe.hasEditConsentParam()) { + e.next = 5; + break; + } + We.displayUi('GDPR', 1, !1), e.next = 16; + break; + case 5: + if (!r || 'GDPR' !== o) { + e.next = 15; + break; + } + if (!s) { + e.next = 12; + break; + } + return e.next = 9, xe.shouldRedirectForConsent(); + case 9: + if (!e.sent) { + e.next = 12; + break; + } + return e.abrupt('return'); + case 12: + We.displayUi('GDPR', i ? 0 : 1, !0), e.next = 16; + break; + case 15: + we.updateApiVisible(o, !1); + case 16: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t) { + return e.apply(this, arguments); + }; + }()); + }(this.config)); + } + }, + { + key: 'getConfig', + value: function () { + var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 'all'; + if (this.config) + switch (e) { + case 'all': + return { + coreConfig: this.config.coreConfig, + coreUiLabels: this.config.coreUiLabels, + premiumProperties: this.config.premiumProperties, + premiumUiLabels: this.config.premiumUiLabels, + theme: this.config.theme + }; + case 'Core Config': + return this.config.coreConfig; + case 'Premium Properties': + return this.config.premiumProperties; + case 'Core UI Labels': + return this.config.coreUiLabels; + case 'Premium UI Labels': + return this.config.premiumUiLabels; + case 'Theme': + return this.config.theme; + default: + var t = Je(this.config); + if (t[e]) + return t[e]; + console.warn('"'.concat(e, '": was not found in configs')); + } + else + console.error('Should run init before running getConfig'); + } + }, + { + key: 'getConfigInstance', + value: function () { + return this.config; + } + }, + { + key: 'getNonIABVendorConsents', + value: function () { + var e = c(a.a.mark(function e(t) { + var n, r, o; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if (!this.config || (null === (n = this.config.coreConfig.privacyMode) || void 0 === n ? void 0 : n.includes('GDPR'))) { + e.next = 2; + break; + } + return e.abrupt('return'); + case 2: + if ('undefined' === typeof this.config) { + e.next = 12; + break; + } + if (we.cookieValues.fetched) { + e.next = 6; + break; + } + return e.next = 6, we.cookieValues.promise; + case 6: + return r = se(Pe.decode, we.cookieValues.nonIabVendorConsent), o = null, r && t ? o = et(r.vendorConsents, t) : r && (o = i({}, r.vendorConsents)), e.abrupt('return', { + gdprApplies: Xe(Oe.isUserInEU, this.config.coreConfig.displayUi), + hasGlobalConsent: $e(this.config), + hasGlobalScope: $e(this.config), + metadata: o ? Le.encode(i(i({}, r), {}, { cookieName: 'noniabvendorconsent' }), !0) : null, + nonIabVendorConsents: o || null + }); + case 12: + console.log('Config was not found'); + case 13: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + } + ]), e; + }(), at = function () { + function e() { + var t = this; + f(this, e), this.__uspapi = void 0, this._uspVersion = 1, this.checkLocationToStopExecution = function () { + var e = c(a.a.mark(function e(n) { + var r, o, i; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return r = !1, o = Ie.coreConfig.uspJurisdiction, e.next = 4, Oe.checkSpecificLocation(); + case 4: + return (i = e.sent) && 'object' === typeof i && (i = i.region.toUpperCase()), o.includes(i) || ('function' === typeof n && n({ + version: t._uspVersion, + uspString: '1---' + }, !0), r = !0), e.abrupt('return', r); + case 8: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t) { + return e.apply(this, arguments); + }; + }(), this.__uspapi = function (e) { + var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, r = arguments.length > 2 ? arguments[2] : void 0, o = arguments.length > 3 ? arguments[3] : void 0; + if (n === t._uspVersion) + if ('function' === typeof r) + try { + void 0 !== o ? t[e](r, o) : t[e](r); + } catch (i) { + console.error('The function '.concat(e, ' is not defined')); + } + else if (void 0 === r) + try { + t[e](); + } catch (i) { + console.error('The function '.concat(e, ' is missing required parameters')); + } + else + console.warn('The third parameter should be a callback for the '.concat(e, ' function')); + else + console.warn('this command is only available for uspVersion 1'); + }; + } + return p(e, [ + { + key: 'initUsp', + value: function () { + var e = this.__uspapi; + Object.assign(window, { __uspapi: e }); + } + }, + { + key: 'uspPing', + value: function () { + var e = c(a.a.mark(function e(t) { + var n; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if ('function' !== typeof t) { + e.next = 8; + break; + } + return e.next = 3, Oe.checkSpecificLocation(); + case 3: + (n = e.sent) && 'object' === typeof n && (n = n.region), t({ + mode: Ie.coreConfig.privacyMode, + jurisdiction: Ie.coreConfig.uspJurisdiction, + location: n, + cmpLoaded: !0 + }, !0), e.next = 9; + break; + case 8: + console.error('The callback function is missing'); + case 9: + case 'end': + return e.stop(); + } + }, e); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'setUspDftData', + value: function () { + var e = c(a.a.mark(function e(t) { + var n, r, o; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if ('function' !== typeof t) { + e.next = 10; + break; + } + return n = Te.getCookie(), e.next = 4, this.checkLocationToStopExecution(t); + case 4: + if (!e.sent) { + e.next = 7; + break; + } + return e.abrupt('return'); + case 7: + 'string' !== typeof n ? (r = Te.encode(this._uspVersion, !1), Te.setCookie(r), t({ + version: this._uspVersion, + uspString: r + }, !0)) : (o = n.split('')[0], t({ + version: o, + uspString: n + }, !0)), e.next = 11; + break; + case 10: + console.error('The callback function is missing'); + case 11: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'setUspData', + value: function () { + var e = c(a.a.mark(function e(t, n) { + var r; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if ('function' !== typeof t) { + e.next = 10; + break; + } + return r = Te.encode(this._uspVersion, n), e.next = 4, this.checkLocationToStopExecution(t); + case 4: + if (!e.sent) { + e.next = 7; + break; + } + return e.abrupt('return'); + case 7: + 'string' !== typeof r ? t(null, !1) : (Te.setCookie(r), t({ + version: this._uspVersion, + uspString: r + }, !0)), e.next = 11; + break; + case 10: + console.error('The callback function is missing'); + case 11: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function (t, n) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'getUSPData', + value: function () { + var e = c(a.a.mark(function e(t) { + var n, r; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + if ('function' !== typeof t) { + e.next = 10; + break; + } + return n = Te.getCookie(), e.next = 4, this.checkLocationToStopExecution(t); + case 4: + if (!e.sent) { + e.next = 7; + break; + } + return e.abrupt('return'); + case 7: + 'string' === typeof n ? (r = n.split('')[0], t({ + version: r, + uspString: n + }, !0)) : t(null, !1), e.next = 11; + break; + case 10: + console.error('The callback function is missing'); + case 11: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + }, + { + key: 'displayUspUi', + value: function () { + var e = c(a.a.mark(function e(t) { + var n, r = arguments; + return a.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return n = r.length > 1 && void 0 !== r[1] ? r[1] : 1, e.next = 3, this.checkLocationToStopExecution(void 0); + case 3: + if (!e.sent) { + e.next = 7; + break; + } + return console.warn('cannot display USP UI outside of configured jurisdiction(s)'), e.abrupt('return'); + case 7: + 1 === n && We.displayUi('USP', n); + case 8: + case 'end': + return e.stop(); + } + }, e, this); + })); + return function (t) { + return e.apply(this, arguments); + }; + }() + } + ]), e; + }(), ut = new st(), ct = new at(); + } + ]); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-8a781a44c232f576b9148f440e69f1a64d74d543 b/resources/sugarcoat-8a781a44c232f576b9148f440e69f1a64d74d543 new file mode 100644 index 00000000..4d61064e --- /dev/null +++ b/resources/sugarcoat-8a781a44c232f576b9148f440e69f1a64d74d543 @@ -0,0 +1,3931 @@ +{ + const $___mock_448b95a47dd49f0a = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_448b95a47dd49f0a); + (function () { + (function () { + function b(d, a) { + try { + var m = d.frames; + } catch (q) { + } + if (m) { + (a = a || []).push(d); + for (var t = 0; m && t < m.length; t++) + b(d.frames[t], a); + } + return a; + } + function a(d, a, m) { + d.addEventListener ? d.addEventListener(a, m, !1) : d.attachEvent && d.attachEvent('on' + a, m); + } + function k(d, a, m) { + d.removeEventListener ? d.removeEventListener(a, m, !1) : d.detachEvent && d.detachEvent('on' + a, m); + } + function x(d) { + var a = d.data; + 'string' === typeof a && (a = I(function () { + return window.JSON.parse(a); + })); + a && (a = a.__uspapiReturn || {}); + a && a.success && (k(window, 'message', x), w(a.returnValue)); + } + function w(d) { + d = void 0 === d ? {} : d; + g('Adform', {}).us_privacy = d.uspString; + } + function H(d, a, m) { + a = void 0 === a ? 10000 : a; + m = void 0 === m ? !1 : m; + A(); + G || window.__tcfapi ? (m ? E.push(d) : N.push(d), C(), J(function () { + var a = [ + B(N, d), + B(E, d) + ], m = g('Adform', {}), b = m.gdpr, t = m.gdpr_consent, f = m.adform_consent; + m = m.us_privacy; + if (-1 < a[0]) + N.splice(a[0], 1)[0]({ + gdpr: b, + gdpr_consent: t, + adform_consent: f, + us_privacy: m + }); + if (-1 < a[1]) + E.splice(a[1], 1)[0]({ + gdpr: b, + gdpr_consent: t, + adform_consent: f, + us_privacy: m + }); + }, a)) : d(null, 'CMP not found.'); + } + function A() { + if (!G) { + var d = t('__tcfapiLocator'); + d.frameRef && (G = d.frameRef, P = d.isCrossDomain); + } + return { + cmpFrame: G, + isCrossDomain: P + }; + } + function C() { + if (P && G && G.postMessage) { + var d = window.__tcfapi; + k(window, 'message', z); + a(window, 'message', z); + G.postMessage({ + __tcfapiCall: { + command: 'addEventListener', + callId: V++ + } + }, '*'); + } else + d = G && !P ? G.__tcfapi : window.__tcfapi; + d && I(function () { + return d('addEventListener', null, l); + }); + } + function z(d) { + var a = d.data; + 'string' === typeof a && (a = I(function () { + return window.JSON.parse(a); + })); + a && (a = (a.__tcfapiReturn || {}).returnValue); + a && null != a.gdprApplies && (d = a, l({ + gdprApplies: d.gdprApplies, + tcString: d.tcString, + purpose: d.purpose, + vendor: d.vendor, + restrictions: d.restrictions, + eventStatus: d.eventStatus + })); + } + function l(d) { + d = void 0 === d ? {} : d; + if ('cmpuishown' !== d.eventStatus) { + var a = F(d.gdprApplies), m = g('Adform', {}); + m.gdpr = a; + m.gdpr_consent = d.tcString; + if (a = !(!d.purpose || !d.vendor) || 0 === a) { + var b = d; + d = b.gdprApplies; + var t = f(b, 'purpose.consents.1', !1), M = f(b, 'vendor.consents.50', !1); + b = f(b, 'restrictions.1.50', 1); + d = 0 === F(d) ? !0 : t && M && 0 !== b; + m.adform_consent = d; + } + d = m.gdpr; + t = m.gdpr_consent; + m = m.adform_consent; + if (void 0 !== m && a) + for (; E.length;) + E.shift()({ + gdpr: d, + gdpr_consent: t, + adform_consent: m + }); + for (; N.length;) + N.shift()({ + gdpr: d, + gdpr_consent: t, + adform_consent: m + }); + } + } + function F(d) { + if ('1' == d) + return 1; + if ('0' == d) + return 0; + } + function B(d, a) { + var m = d.length; + if (d.indexOf) + return d.indexOf(a); + for (; m-- && d[m] !== a;); + return m; + } + function f(d, a, m) { + a = a.split('.'); + for (var b = 0; b < a.length; b++) + if (d = d[a[b]], void 0 === d) { + d = m; + break; + } + return d; + } + var g = function (d, a) { + var m, t, f = b(window.top); + for (m = f.length; m--;) + try { + if ((t = f[m]) && (t = t[d]) && (t = t.shared)) + return t; + } catch (r) { + } + return window[d].shared = a; + }, I = function (d) { + try { + return d(); + } catch (y) { + } + }, t = function (a) { + for (var m, b, t = window; t;) { + if (I(function () { + return t.frames[a]; + })) { + m = t; + break; + } + if (t === d) + break; + t = t.parent; + } + m && (b = !I(function () { + return !!m.document.getElementById; + })); + return { + frameRef: m, + isCrossDomain: b + }; + }, d = window.top; + window.Adform = window.Adform || {}; + var m = window.__uspapi, M = t('__uspapiLocator'), K = M.frameRef; + (M = M.isCrossDomain) && K && K.postMessage ? (a(window, 'message', x), K.postMessage({ + __uspapiCall: { + command: 'getUSPData', + version: 1, + callId: 1 + } + }, '*')) : K && !M && K.__uspapi && (m = K.__uspapi); + m && I(function () { + return m('getUSPData', 1, w); + }); + var J = window.setTimeout, G, P, V = 1, N = [], E = []; + K = window.Adform = window.Adform || {}; + K.getConsent = function () { + C(); + var d = g('Adform', {}); + return { + gdpr: d.gdpr, + gdpr_consent: d.gdpr_consent, + us_privacy: d.us_privacy + }; + }; + K.waitForConsent = H; + K.hasConsent = function (d) { + H(function (a) { + d(null === a ? !0 : a.adform_consent); + }, 10000, !0); + }; + K.getUSPString = function () { + return g('Adform', {}).us_privacy; + }; + A(); + g('Adform', {}); + C(); + }()); + (function (b) { + var a = b.Adform = b.Adform || {}, k = { + '\\': '\\\\', + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"': '\\"' + }, x = function (a) { + var b = ''; + if ('string' === typeof a && null != a && 0 < a.length) + for (var w = 0; w < a.length; w++) { + var x = a.charAt(w), z = k[x]; + b = 'string' === typeof z ? b + z : b + x; + } + return b; + }; + a.JSON = {}; + a.JSON.stringify = function (b) { + var k = typeof b; + if ('object' != k || null === b) + return 'string' == k && (b = '"' + x(b) + '"'), String(b); + var w, C = [], z = b && b.constructor == Array; + for (w in b) { + var l = b[w]; + k = typeof l; + 'undefined' != k && 'function' != k && b.hasOwnProperty(w) && ('string' == k ? l = '"' + x(l) + '"' : 'object' == k && null !== l && (l = a.JSON.stringify(l)), C.push((z ? '' : '"' + w + '":') + String(l))); + } + return (z ? '[' : '{') + String(C) + (z ? ']' : '}'); + }; + }(window)); + window.Adform = window.Adform || {}; + Adform.CryptoJS = Adform.CryptoJS || function (b, a) { + var k = {}, x = k.lib = {}, w = function () { + }, H = x.Base = { + extend: function (a) { + w.prototype = this; + var b = new w(); + a && b.mixIn(a); + b.hasOwnProperty('init') || (b.init = function () { + b.$super.init.apply(this, arguments); + }); + b.init.prototype = b; + b.$super = this; + return b; + }, + create: function () { + var a = this.extend(); + a.init.apply(a, arguments); + return a; + }, + init: function () { + }, + mixIn: function (a) { + for (var b in a) + a.hasOwnProperty(b) && (this[b] = a[b]); + a.hasOwnProperty('toString') && (this.toString = a.toString); + }, + clone: function () { + return this.init.prototype.extend(this); + } + }, A = x.WordArray = H.extend({ + init: function (b, f) { + b = this.words = b || []; + this.sigBytes = f != a ? f : 4 * b.length; + }, + toString: function (a) { + return (a || z).stringify(this); + }, + concat: function (a) { + var b = this.words, f = a.words, d = this.sigBytes; + a = a.sigBytes; + this.clamp(); + if (d % 4) + for (var g = 0; g < a; g++) + b[d + g >>> 2] |= (f[g >>> 2] >>> 24 - g % 4 * 8 & 255) << 24 - (d + g) % 4 * 8; + else if (65535 < f.length) + for (g = 0; g < a; g += 4) + b[d + g >>> 2] = f[g >>> 2]; + else + b.push.apply(b, f); + this.sigBytes += a; + return this; + }, + clamp: function () { + var a = this.words, f = this.sigBytes; + a[f >>> 2] &= 4294967295 << 32 - f % 4 * 8; + a.length = b.ceil(f / 4); + }, + clone: function () { + var a = H.clone.call(this); + a.words = this.words.slice(0); + return a; + }, + random: function (a) { + for (var f = [], g = 0; g < a; g += 4) + f.push(4294967296 * b.random() | 0); + return new A.init(f, a); + } + }), C = k.enc = {}, z = C.Hex = { + stringify: function (a) { + var b = a.words; + a = a.sigBytes; + for (var f = [], d = 0; d < a; d++) { + var g = b[d >>> 2] >>> 24 - d % 4 * 8 & 255; + f.push((g >>> 4).toString(16)); + f.push((g & 15).toString(16)); + } + return f.join(''); + }, + parse: function (a) { + for (var b = a.length, f = [], d = 0; d < b; d += 2) + f[d >>> 3] |= parseInt(a.substr(d, 2), 16) << 24 - d % 8 * 4; + return new A.init(f, b / 2); + } + }, l = C.Latin1 = { + stringify: function (a) { + var b = a.words; + a = a.sigBytes; + for (var f = [], d = 0; d < a; d++) + f.push(String.fromCharCode(b[d >>> 2] >>> 24 - d % 4 * 8 & 255)); + return f.join(''); + }, + parse: function (a) { + for (var b = a.length, f = [], d = 0; d < b; d++) + f[d >>> 2] |= (a.charCodeAt(d) & 255) << 24 - d % 4 * 8; + return new A.init(f, b); + } + }, F = C.Utf8 = { + stringify: function (a) { + try { + return decodeURIComponent(escape(l.stringify(a))); + } catch (I) { + throw Error('Malformed UTF-8 data'); + } + }, + parse: function (a) { + return l.parse(unescape(encodeURIComponent(a))); + } + }, B = x.BufferedBlockAlgorithm = H.extend({ + reset: function () { + this._data = new A.init(); + this._nDataBytes = 0; + }, + _append: function (a) { + 'string' == typeof a && (a = F.parse(a)); + this._data.concat(a); + this._nDataBytes += a.sigBytes; + }, + _process: function (a) { + var f = this._data, g = f.words, d = f.sigBytes, m = this.blockSize, k = d / (4 * m); + k = a ? b.ceil(k) : b.max((k | 0) - this._minBufferSize, 0); + a = k * m; + d = b.min(4 * a, d); + if (a) { + for (var l = 0; l < a; l += m) + this._doProcessBlock(g, l); + l = g.splice(0, a); + f.sigBytes -= d; + } + return new A.init(l, d); + }, + clone: function () { + var a = H.clone.call(this); + a._data = this._data.clone(); + return a; + }, + _minBufferSize: 0 + }); + x.Hasher = B.extend({ + cfg: H.extend(), + init: function (a) { + this.cfg = this.cfg.extend(a); + this.reset(); + }, + reset: function () { + B.reset.call(this); + this._doReset(); + }, + update: function (a) { + this._append(a); + this._process(); + return this; + }, + finalize: function (a) { + a && this._append(a); + return this._doFinalize(); + }, + blockSize: 16, + _createHelper: function (a) { + return function (b, f) { + return new a.init(f).finalize(b); + }; + }, + _createHmacHelper: function (a) { + return function (b, g) { + return new f.HMAC.init(a, g).finalize(b); + }; + } + }); + var f = k.algo = {}; + return k; + }(Math); + (function (b) { + function a(a, b, g, k, l, d, m) { + a = a + (b & g | ~b & k) + l + m; + return (a << d | a >>> 32 - d) + b; + } + function k(a, b, g, k, l, d, m) { + a = a + (b & k | g & ~k) + l + m; + return (a << d | a >>> 32 - d) + b; + } + function x(a, b, g, k, l, d, m) { + a = a + (b ^ g ^ k) + l + m; + return (a << d | a >>> 32 - d) + b; + } + function w(a, b, g, k, l, d, m) { + a = a + (g ^ (b | ~k)) + l + m; + return (a << d | a >>> 32 - d) + b; + } + var H = Adform.CryptoJS, A = H.lib, C = A.WordArray, z = A.Hasher; + A = H.algo; + for (var l = [], F = 0; 64 > F; F++) + l[F] = 4294967296 * b.abs(b.sin(F + 1)) | 0; + A = A.MD5 = z.extend({ + _doReset: function () { + this._hash = new C.init([ + 1732584193, + 4023233417, + 2562383102, + 271733878 + ]); + }, + _doProcessBlock: function (b, f) { + for (var g = 0; 16 > g; g++) { + var I = f + g, t = b[I]; + b[I] = (t << 8 | t >>> 24) & 16711935 | (t << 24 | t >>> 8) & 4278255360; + } + g = this._hash.words; + I = b[f + 0]; + t = b[f + 1]; + var d = b[f + 2], m = b[f + 3], A = b[f + 4], B = b[f + 5], z = b[f + 6], G = b[f + 7], C = b[f + 8], F = b[f + 9], H = b[f + 10], E = b[f + 11], L = b[f + 12], y = b[f + 13], O = b[f + 14]; + b = b[f + 15]; + f = g[0]; + var p = g[1], q = g[2], r = g[3]; + f = a(f, p, q, r, I, 7, l[0]); + r = a(r, f, p, q, t, 12, l[1]); + q = a(q, r, f, p, d, 17, l[2]); + p = a(p, q, r, f, m, 22, l[3]); + f = a(f, p, q, r, A, 7, l[4]); + r = a(r, f, p, q, B, 12, l[5]); + q = a(q, r, f, p, z, 17, l[6]); + p = a(p, q, r, f, G, 22, l[7]); + f = a(f, p, q, r, C, 7, l[8]); + r = a(r, f, p, q, F, 12, l[9]); + q = a(q, r, f, p, H, 17, l[10]); + p = a(p, q, r, f, E, 22, l[11]); + f = a(f, p, q, r, L, 7, l[12]); + r = a(r, f, p, q, y, 12, l[13]); + q = a(q, r, f, p, O, 17, l[14]); + p = a(p, q, r, f, b, 22, l[15]); + f = k(f, p, q, r, t, 5, l[16]); + r = k(r, f, p, q, z, 9, l[17]); + q = k(q, r, f, p, E, 14, l[18]); + p = k(p, q, r, f, I, 20, l[19]); + f = k(f, p, q, r, B, 5, l[20]); + r = k(r, f, p, q, H, 9, l[21]); + q = k(q, r, f, p, b, 14, l[22]); + p = k(p, q, r, f, A, 20, l[23]); + f = k(f, p, q, r, F, 5, l[24]); + r = k(r, f, p, q, O, 9, l[25]); + q = k(q, r, f, p, m, 14, l[26]); + p = k(p, q, r, f, C, 20, l[27]); + f = k(f, p, q, r, y, 5, l[28]); + r = k(r, f, p, q, d, 9, l[29]); + q = k(q, r, f, p, G, 14, l[30]); + p = k(p, q, r, f, L, 20, l[31]); + f = x(f, p, q, r, B, 4, l[32]); + r = x(r, f, p, q, C, 11, l[33]); + q = x(q, r, f, p, E, 16, l[34]); + p = x(p, q, r, f, O, 23, l[35]); + f = x(f, p, q, r, t, 4, l[36]); + r = x(r, f, p, q, A, 11, l[37]); + q = x(q, r, f, p, G, 16, l[38]); + p = x(p, q, r, f, H, 23, l[39]); + f = x(f, p, q, r, y, 4, l[40]); + r = x(r, f, p, q, I, 11, l[41]); + q = x(q, r, f, p, m, 16, l[42]); + p = x(p, q, r, f, z, 23, l[43]); + f = x(f, p, q, r, F, 4, l[44]); + r = x(r, f, p, q, L, 11, l[45]); + q = x(q, r, f, p, b, 16, l[46]); + p = x(p, q, r, f, d, 23, l[47]); + f = w(f, p, q, r, I, 6, l[48]); + r = w(r, f, p, q, G, 10, l[49]); + q = w(q, r, f, p, O, 15, l[50]); + p = w(p, q, r, f, B, 21, l[51]); + f = w(f, p, q, r, L, 6, l[52]); + r = w(r, f, p, q, m, 10, l[53]); + q = w(q, r, f, p, H, 15, l[54]); + p = w(p, q, r, f, t, 21, l[55]); + f = w(f, p, q, r, C, 6, l[56]); + r = w(r, f, p, q, b, 10, l[57]); + q = w(q, r, f, p, z, 15, l[58]); + p = w(p, q, r, f, y, 21, l[59]); + f = w(f, p, q, r, A, 6, l[60]); + r = w(r, f, p, q, E, 10, l[61]); + q = w(q, r, f, p, d, 15, l[62]); + p = w(p, q, r, f, F, 21, l[63]); + g[0] = g[0] + f | 0; + g[1] = g[1] + p | 0; + g[2] = g[2] + q | 0; + g[3] = g[3] + r | 0; + }, + _doFinalize: function () { + var a = this._data, f = a.words, g = 8 * this._nDataBytes, k = 8 * a.sigBytes; + f[k >>> 5] |= 128 << 24 - k % 32; + var l = b.floor(g / 4294967296); + f[(k + 64 >>> 9 << 4) + 15] = (l << 8 | l >>> 24) & 16711935 | (l << 24 | l >>> 8) & 4278255360; + f[(k + 64 >>> 9 << 4) + 14] = (g << 8 | g >>> 24) & 16711935 | (g << 24 | g >>> 8) & 4278255360; + a.sigBytes = 4 * (f.length + 1); + this._process(); + a = this._hash; + f = a.words; + for (g = 0; 4 > g; g++) + k = f[g], f[g] = (k << 8 | k >>> 24) & 16711935 | (k << 24 | k >>> 8) & 4278255360; + return a; + }, + clone: function () { + var a = z.clone.call(this); + a._hash = this._hash.clone(); + return a; + } + }); + H.MD5 = z._createHelper(A); + H.HmacMD5 = z._createHmacHelper(A); + }(Math)); + (function (b) { + var a = Adform.CryptoJS, k = a.lib, x = k.WordArray, w = k.Hasher; + k = a.algo; + for (var H = [], A = [], C = function (a) { + return 4294967296 * (a - (a | 0)) | 0; + }, z = 2, l = 0; 64 > l;) { + a: { + var F = z; + for (var B = b.sqrt(F), f = 2; f <= B; f++) + if (!(F % f)) { + F = !1; + break a; + } + F = !0; + } + F && (8 > l && (H[l] = C(b.pow(z, 0.5))), A[l] = C(b.pow(z, 1 / 3)), l++); + z++; + } + var g = []; + k = k.SHA256 = w.extend({ + _doReset: function () { + this._hash = new x.init(H.slice(0)); + }, + _doProcessBlock: function (a, b) { + for (var d = this._hash.words, f = d[0], k = d[1], l = d[2], t = d[3], w = d[4], x = d[5], z = d[6], C = d[7], E = 0; 64 > E; E++) { + if (16 > E) + g[E] = a[b + E] | 0; + else { + var B = g[E - 15], y = g[E - 2]; + g[E] = ((B << 25 | B >>> 7) ^ (B << 14 | B >>> 18) ^ B >>> 3) + g[E - 7] + ((y << 15 | y >>> 17) ^ (y << 13 | y >>> 19) ^ y >>> 10) + g[E - 16]; + } + B = C + ((w << 26 | w >>> 6) ^ (w << 21 | w >>> 11) ^ (w << 7 | w >>> 25)) + (w & x ^ ~w & z) + A[E] + g[E]; + y = ((f << 30 | f >>> 2) ^ (f << 19 | f >>> 13) ^ (f << 10 | f >>> 22)) + (f & k ^ f & l ^ k & l); + C = z; + z = x; + x = w; + w = t + B | 0; + t = l; + l = k; + k = f; + f = B + y | 0; + } + d[0] = d[0] + f | 0; + d[1] = d[1] + k | 0; + d[2] = d[2] + l | 0; + d[3] = d[3] + t | 0; + d[4] = d[4] + w | 0; + d[5] = d[5] + x | 0; + d[6] = d[6] + z | 0; + d[7] = d[7] + C | 0; + }, + _doFinalize: function () { + var a = this._data, f = a.words, d = 8 * this._nDataBytes, g = 8 * a.sigBytes; + f[g >>> 5] |= 128 << 24 - g % 32; + f[(g + 64 >>> 9 << 4) + 14] = b.floor(d / 4294967296); + f[(g + 64 >>> 9 << 4) + 15] = d; + a.sigBytes = 4 * f.length; + this._process(); + return this._hash; + }, + clone: function () { + var a = w.clone.call(this); + a._hash = this._hash.clone(); + return a; + } + }); + a.SHA256 = w._createHelper(k); + a.HmacSHA256 = w._createHmacHelper(k); + }(Math)); + (function (b) { + function a(c, e, h) { + null != c && ('number' == typeof c ? this.fromNumber(c, e, h) : null == e && 'string' != typeof c ? this.fromString(c, 256) : this.fromString(c, e)); + } + function k() { + return new a(null); + } + function x(c, e, h, a, n, b) { + for (; 0 <= --b;) { + var u = e * this[c++] + h[a] + n; + n = Math.floor(u / 67108864); + h[a++] = u & 67108863; + } + return n; + } + function w(c, e, h, a, n, b) { + var u = e & 32767; + for (e >>= 15; 0 <= --b;) { + var d = this[c] & 32767, f = this[c++] >> 15, Q = e * d + f * u; + d = u * d + ((Q & 32767) << 15) + h[a] + (n & 1073741823); + n = (d >>> 30) + (Q >>> 15) + e * f + (n >>> 30); + h[a++] = d & 1073741823; + } + return n; + } + function H(c, e, h, a, n, b) { + var u = e & 16383; + for (e >>= 14; 0 <= --b;) { + var d = this[c] & 16383, f = this[c++] >> 14, Q = e * d + f * u; + d = u * d + ((Q & 16383) << 14) + h[a] + n; + n = (d >> 28) + (Q >> 14) + e * f; + h[a++] = d & 268435455; + } + return n; + } + function A(c, e) { + c = N[c.charCodeAt(e)]; + return null == c ? -1 : c; + } + function C(c) { + var e = k(); + e.fromInt(c); + return e; + } + function z(c) { + var e = 1, h; + 0 != (h = c >>> 16) && (c = h, e += 16); + 0 != (h = c >> 8) && (c = h, e += 8); + 0 != (h = c >> 4) && (c = h, e += 4); + 0 != (h = c >> 2) && (c = h, e += 2); + 0 != c >> 1 && (e += 1); + return e; + } + function l(c) { + this.m = c; + } + function F(c) { + this.m = c; + this.mp = c.invDigit(); + this.mpl = this.mp & 32767; + this.mph = this.mp >> 15; + this.um = (1 << c.DB - 15) - 1; + this.mt2 = 2 * c.t; + } + function B(c, e) { + return c & e; + } + function f(c, e) { + return c | e; + } + function g(c, e) { + return c ^ e; + } + function I(c, e) { + return c & ~e; + } + function t() { + } + function d(c) { + return c; + } + function m(c) { + this.r2 = k(); + this.q3 = k(); + a.ONE.dlShiftTo(2 * c.t, this.r2); + this.mu = this.r2.divide(c); + this.m = c; + } + function M() { + this.j = this.i = 0; + this.S = []; + } + function K() { + } + function J(c, e) { + return new a(c, e); + } + function G() { + this.n = null; + this.e = 0; + this.coeff = this.dmq1 = this.dmp1 = this.q = this.p = this.d = null; + } + function P(c) { + var e, h = ''; + for (e = 0; e + 3 <= c.length; e += 3) { + var a = parseInt(c.substring(e, e + 3), 16); + h += 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(a >> 6) + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(a & 63); + } + e + 1 == c.length ? (a = parseInt(c.substring(e, e + 1), 16), h += 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(a << 2)) : e + 2 == c.length && (a = parseInt(c.substring(e, e + 2), 16), h += 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(a >> 2) + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt((a & 3) << 4)); + for (; 0 < (h.length & 3);) + h += '='; + return h; + } + function V(c) { + var e = '', a, u = 0; + for (a = 0; a < c.length && '=' != c.charAt(a); ++a) + if (v = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.indexOf(c.charAt(a)), !(0 > v)) + if (0 == u) { + e += '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(v >> 2); + var n = v & 3; + u = 1; + } else + 1 == u ? (e += '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(n << 2 | v >> 4), n = v & 15, u = 2) : 2 == u ? (e += '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(n), e += '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(v >> 2), n = v & 3, u = 3) : (e += '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(n << 2 | v >> 4), e += '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(v & 15), u = 0); + 1 == u && (e += '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(n << 2)); + return e; + } + window.Adform = window.Adform || {}; + window.Adform.JSEncryptHelpers = {}; + 'Microsoft Internet Explorer' == navigator.appName ? (a.prototype.am = w, b = 30) : 'Netscape' != navigator.appName ? (a.prototype.am = x, b = 26) : (a.prototype.am = H, b = 28); + a.prototype.DB = b; + a.prototype.DM = (1 << b) - 1; + a.prototype.DV = 1 << b; + a.prototype.FV = Math.pow(2, 52); + a.prototype.F1 = 52 - b; + a.prototype.F2 = 2 * b - 52; + var N = [], E; + b = 48; + for (E = 0; 9 >= E; ++E) + N[b++] = E; + b = 97; + for (E = 10; 36 > E; ++E) + N[b++] = E; + b = 65; + for (E = 10; 36 > E; ++E) + N[b++] = E; + l.prototype.convert = function (c) { + return 0 > c.s || 0 <= c.compareTo(this.m) ? c.mod(this.m) : c; + }; + l.prototype.revert = function (c) { + return c; + }; + l.prototype.reduce = function (c) { + c.divRemTo(this.m, null, c); + }; + l.prototype.mulTo = function (c, e, a) { + c.multiplyTo(e, a); + this.reduce(a); + }; + l.prototype.sqrTo = function (c, e) { + c.squareTo(e); + this.reduce(e); + }; + F.prototype.convert = function (c) { + var e = k(); + c.abs().dlShiftTo(this.m.t, e); + e.divRemTo(this.m, null, e); + 0 > c.s && 0 < e.compareTo(a.ZERO) && this.m.subTo(e, e); + return e; + }; + F.prototype.revert = function (c) { + var e = k(); + c.copyTo(e); + this.reduce(e); + return e; + }; + F.prototype.reduce = function (c) { + for (; c.t <= this.mt2;) + c[c.t++] = 0; + for (var e = 0; e < this.m.t; ++e) { + var a = c[e] & 32767, u = a * this.mpl + ((a * this.mph + (c[e] >> 15) * this.mpl & this.um) << 15) & c.DM; + a = e + this.m.t; + for (c[a] += this.m.am(0, u, c, e, 0, this.m.t); c[a] >= c.DV;) + c[a] -= c.DV, c[++a]++; + } + c.clamp(); + c.drShiftTo(this.m.t, c); + 0 <= c.compareTo(this.m) && c.subTo(this.m, c); + }; + F.prototype.mulTo = function (c, e, a) { + c.multiplyTo(e, a); + this.reduce(a); + }; + F.prototype.sqrTo = function (c, e) { + c.squareTo(e); + this.reduce(e); + }; + a.prototype.copyTo = function (c) { + for (var e = this.t - 1; 0 <= e; --e) + c[e] = this[e]; + c.t = this.t; + c.s = this.s; + }; + a.prototype.fromInt = function (c) { + this.t = 1; + this.s = 0 > c ? -1 : 0; + 0 < c ? this[0] = c : -1 > c ? this[0] = c + this.DV : this.t = 0; + }; + a.prototype.fromString = function (c, e) { + if (16 == e) + e = 4; + else if (8 == e) + e = 3; + else if (256 == e) + e = 8; + else if (2 == e) + e = 1; + else if (32 == e) + e = 5; + else if (4 == e) + e = 2; + else { + this.fromRadix(c, e); + return; + } + this.s = this.t = 0; + for (var h = c.length, u = !1, n = 0; 0 <= --h;) { + var b = 8 == e ? c[h] & 255 : A(c, h); + 0 > b ? '-' == c.charAt(h) && (u = !0) : (u = !1, 0 == n ? this[this.t++] = b : n + e > this.DB ? (this[this.t - 1] |= (b & (1 << this.DB - n) - 1) << n, this[this.t++] = b >> this.DB - n) : this[this.t - 1] |= b << n, n += e, n >= this.DB && (n -= this.DB)); + } + 8 == e && 0 != (c[0] & 128) && (this.s = -1, 0 < n && (this[this.t - 1] |= (1 << this.DB - n) - 1 << n)); + this.clamp(); + u && a.ZERO.subTo(this, this); + }; + a.prototype.clamp = function () { + for (var c = this.s & this.DM; 0 < this.t && this[this.t - 1] == c;) + --this.t; + }; + a.prototype.dlShiftTo = function (c, e) { + var a; + for (a = this.t - 1; 0 <= a; --a) + e[a + c] = this[a]; + for (a = c - 1; 0 <= a; --a) + e[a] = 0; + e.t = this.t + c; + e.s = this.s; + }; + a.prototype.drShiftTo = function (c, e) { + for (var a = c; a < this.t; ++a) + e[a - c] = this[a]; + e.t = Math.max(this.t - c, 0); + e.s = this.s; + }; + a.prototype.lShiftTo = function (c, e) { + var a = c % this.DB, u = this.DB - a, n = (1 << u) - 1; + c = Math.floor(c / this.DB); + var b = this.s << a & this.DM, d; + for (d = this.t - 1; 0 <= d; --d) + e[d + c + 1] = this[d] >> u | b, b = (this[d] & n) << a; + for (d = c - 1; 0 <= d; --d) + e[d] = 0; + e[c] = b; + e.t = this.t + c + 1; + e.s = this.s; + e.clamp(); + }; + a.prototype.rShiftTo = function (c, e) { + e.s = this.s; + var a = Math.floor(c / this.DB); + if (a >= this.t) + e.t = 0; + else { + c %= this.DB; + var u = this.DB - c, n = (1 << c) - 1; + e[0] = this[a] >> c; + for (var b = a + 1; b < this.t; ++b) + e[b - a - 1] |= (this[b] & n) << u, e[b - a] = this[b] >> c; + 0 < c && (e[this.t - a - 1] |= (this.s & n) << u); + e.t = this.t - a; + e.clamp(); + } + }; + a.prototype.subTo = function (c, e) { + for (var a = 0, u = 0, n = Math.min(c.t, this.t); a < n;) + u += this[a] - c[a], e[a++] = u & this.DM, u >>= this.DB; + if (c.t < this.t) { + for (u -= c.s; a < this.t;) + u += this[a], e[a++] = u & this.DM, u >>= this.DB; + u += this.s; + } else { + for (u += this.s; a < c.t;) + u -= c[a], e[a++] = u & this.DM, u >>= this.DB; + u -= c.s; + } + e.s = 0 > u ? -1 : 0; + -1 > u ? e[a++] = this.DV + u : 0 < u && (e[a++] = u); + e.t = a; + e.clamp(); + }; + a.prototype.multiplyTo = function (c, e) { + var h = this.abs(), u = c.abs(), n = h.t; + for (e.t = n + u.t; 0 <= --n;) + e[n] = 0; + for (n = 0; n < u.t; ++n) + e[n + h.t] = h.am(0, u[n], e, n, 0, h.t); + e.s = 0; + e.clamp(); + this.s != c.s && a.ZERO.subTo(e, e); + }; + a.prototype.squareTo = function (c) { + for (var e = this.abs(), a = c.t = 2 * e.t; 0 <= --a;) + c[a] = 0; + for (a = 0; a < e.t - 1; ++a) { + var u = e.am(a, e[a], c, 2 * a, 0, 1); + (c[a + e.t] += e.am(a + 1, 2 * e[a], c, 2 * a + 1, u, e.t - a - 1)) >= e.DV && (c[a + e.t] -= e.DV, c[a + e.t + 1] = 1); + } + 0 < c.t && (c[c.t - 1] += e.am(a, e[a], c, 2 * a, 0, 1)); + c.s = 0; + c.clamp(); + }; + a.prototype.divRemTo = function (c, e, h) { + var u = c.abs(); + if (!(0 >= u.t)) { + var n = this.abs(); + if (n.t < u.t) + null != e && e.fromInt(0), null != h && this.copyTo(h); + else { + null == h && (h = k()); + var b = k(), d = this.s; + c = c.s; + var f = this.DB - z(u[u.t - 1]); + 0 < f ? (u.lShiftTo(f, b), n.lShiftTo(f, h)) : (u.copyTo(b), n.copyTo(h)); + u = b.t; + n = b[u - 1]; + if (0 != n) { + var g = n * (1 << this.F1) + (1 < u ? b[u - 2] >> this.F2 : 0), m = this.FV / g; + g = (1 << this.F1) / g; + var l = 1 << this.F2, q = h.t, p = q - u, r = null == e ? k() : e; + b.dlShiftTo(p, r); + 0 <= h.compareTo(r) && (h[h.t++] = 1, h.subTo(r, h)); + a.ONE.dlShiftTo(u, r); + for (r.subTo(b, b); b.t < u;) + b[b.t++] = 0; + for (; 0 <= --p;) { + var t = h[--q] == n ? this.DM : Math.floor(h[q] * m + (h[q - 1] + l) * g); + if ((h[q] += b.am(0, t, h, p, 0, u)) < t) + for (b.dlShiftTo(p, r), h.subTo(r, h); h[q] < --t;) + h.subTo(r, h); + } + null != e && (h.drShiftTo(u, e), d != c && a.ZERO.subTo(e, e)); + h.t = u; + h.clamp(); + 0 < f && h.rShiftTo(f, h); + 0 > d && a.ZERO.subTo(h, h); + } + } + } + }; + a.prototype.invDigit = function () { + if (1 > this.t) + return 0; + var c = this[0]; + if (0 == (c & 1)) + return 0; + var e = c & 3; + e = e * (2 - (c & 15) * e) & 15; + e = e * (2 - (c & 255) * e) & 255; + e = e * (2 - ((c & 65535) * e & 65535)) & 65535; + e = e * (2 - c * e % this.DV) % this.DV; + return 0 < e ? this.DV - e : -e; + }; + a.prototype.isEven = function () { + return 0 == (0 < this.t ? this[0] & 1 : this.s); + }; + a.prototype.exp = function (c, e) { + if (4294967295 < c || 1 > c) + return a.ONE; + var h = k(), u = k(), n = e.convert(this), b = z(c) - 1; + for (n.copyTo(h); 0 <= --b;) + if (e.sqrTo(h, u), 0 < (c & 1 << b)) + e.mulTo(u, n, h); + else { + var d = h; + h = u; + u = d; + } + return e.revert(h); + }; + a.prototype.toString = function (c) { + if (0 > this.s) + return '-' + this.negate().toString(c); + if (16 == c) + c = 4; + else if (8 == c) + c = 3; + else if (2 == c) + c = 1; + else if (32 == c) + c = 5; + else if (4 == c) + c = 2; + else + return this.toRadix(c); + var e = (1 << c) - 1, a, b = !1, n = '', d = this.t, f = this.DB - d * this.DB % c; + if (0 < d--) + for (f < this.DB && 0 < (a = this[d] >> f) && (b = !0, n = '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(a)); 0 <= d;) + f < c ? (a = (this[d] & (1 << f) - 1) << c - f, a |= this[--d] >> (f += this.DB - c)) : (a = this[d] >> (f -= c) & e, 0 >= f && (f += this.DB, --d)), 0 < a && (b = !0), b && (n += '0123456789abcdefghijklmnopqrstuvwxyz'.charAt(a)); + return b ? n : '0'; + }; + a.prototype.negate = function () { + var c = k(); + a.ZERO.subTo(this, c); + return c; + }; + a.prototype.abs = function () { + return 0 > this.s ? this.negate() : this; + }; + a.prototype.compareTo = function (c) { + var e = this.s - c.s; + if (0 != e) + return e; + var a = this.t; + e = a - c.t; + if (0 != e) + return 0 > this.s ? -e : e; + for (; 0 <= --a;) + if (0 != (e = this[a] - c[a])) + return e; + return 0; + }; + a.prototype.bitLength = function () { + return 0 >= this.t ? 0 : this.DB * (this.t - 1) + z(this[this.t - 1] ^ this.s & this.DM); + }; + a.prototype.mod = function (c) { + var e = k(); + this.abs().divRemTo(c, null, e); + 0 > this.s && 0 < e.compareTo(a.ZERO) && c.subTo(e, e); + return e; + }; + a.prototype.modPowInt = function (c, e) { + e = 256 > c || e.isEven() ? new l(e) : new F(e); + return this.exp(c, e); + }; + a.ZERO = C(0); + a.ONE = C(1); + t.prototype.convert = d; + t.prototype.revert = d; + t.prototype.mulTo = function (c, e, a) { + c.multiplyTo(e, a); + }; + t.prototype.sqrTo = function (c, e) { + c.squareTo(e); + }; + m.prototype.convert = function (c) { + if (0 > c.s || c.t > 2 * this.m.t) + return c.mod(this.m); + if (0 > c.compareTo(this.m)) + return c; + var e = k(); + c.copyTo(e); + this.reduce(e); + return e; + }; + m.prototype.revert = function (c) { + return c; + }; + m.prototype.reduce = function (c) { + c.drShiftTo(this.m.t - 1, this.r2); + c.t > this.m.t + 1 && (c.t = this.m.t + 1, c.clamp()); + this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3); + for (this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); 0 > c.compareTo(this.r2);) + c.dAddOffset(1, this.m.t + 1); + for (c.subTo(this.r2, c); 0 <= c.compareTo(this.m);) + c.subTo(this.m, c); + }; + m.prototype.mulTo = function (c, e, a) { + c.multiplyTo(e, a); + this.reduce(a); + }; + m.prototype.sqrTo = function (c, a) { + c.squareTo(a); + this.reduce(a); + }; + var L = [ + 2, + 3, + 5, + 7, + 11, + 13, + 17, + 19, + 23, + 29, + 31, + 37, + 41, + 43, + 47, + 53, + 59, + 61, + 67, + 71, + 73, + 79, + 83, + 89, + 97, + 101, + 103, + 107, + 109, + 113, + 127, + 131, + 137, + 139, + 149, + 151, + 157, + 163, + 167, + 173, + 179, + 181, + 191, + 193, + 197, + 199, + 211, + 223, + 227, + 229, + 233, + 239, + 241, + 251, + 257, + 263, + 269, + 271, + 277, + 281, + 283, + 293, + 307, + 311, + 313, + 317, + 331, + 337, + 347, + 349, + 353, + 359, + 367, + 373, + 379, + 383, + 389, + 397, + 401, + 409, + 419, + 421, + 431, + 433, + 439, + 443, + 449, + 457, + 461, + 463, + 467, + 479, + 487, + 491, + 499, + 503, + 509, + 521, + 523, + 541, + 547, + 557, + 563, + 569, + 571, + 577, + 587, + 593, + 599, + 601, + 607, + 613, + 617, + 619, + 631, + 641, + 643, + 647, + 653, + 659, + 661, + 673, + 677, + 683, + 691, + 701, + 709, + 719, + 727, + 733, + 739, + 743, + 751, + 757, + 761, + 769, + 773, + 787, + 797, + 809, + 811, + 821, + 823, + 827, + 829, + 839, + 853, + 857, + 859, + 863, + 877, + 881, + 883, + 887, + 907, + 911, + 919, + 929, + 937, + 941, + 947, + 953, + 967, + 971, + 977, + 983, + 991, + 997 + ], y = 67108864 / L[L.length - 1]; + a.prototype.chunkSize = function (c) { + return Math.floor(Math.LN2 * this.DB / Math.log(c)); + }; + a.prototype.toRadix = function (c) { + null == c && (c = 10); + if (0 == this.signum() || 2 > c || 36 < c) + return '0'; + var a = this.chunkSize(c); + a = Math.pow(c, a); + var h = C(a), b = k(), n = k(), d = ''; + for (this.divRemTo(h, b, n); 0 < b.signum();) + d = (a + n.intValue()).toString(c).substr(1) + d, b.divRemTo(h, b, n); + return n.intValue().toString(c) + d; + }; + a.prototype.fromRadix = function (c, e) { + this.fromInt(0); + null == e && (e = 10); + for (var h = this.chunkSize(e), b = Math.pow(e, h), n = !1, d = 0, f = 0, g = 0; g < c.length; ++g) { + var m = A(c, g); + 0 > m ? '-' == c.charAt(g) && 0 == this.signum() && (n = !0) : (f = e * f + m, ++d >= h && (this.dMultiply(b), this.dAddOffset(f, 0), f = d = 0)); + } + 0 < d && (this.dMultiply(Math.pow(e, d)), this.dAddOffset(f, 0)); + n && a.ZERO.subTo(this, this); + }; + a.prototype.fromNumber = function (c, e, h) { + if ('number' == typeof e) + if (2 > c) + this.fromInt(1); + else + for (this.fromNumber(c, h), this.testBit(c - 1) || this.bitwiseTo(a.ONE.shiftLeft(c - 1), f, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e);) + this.dAddOffset(2, 0), this.bitLength() > c && this.subTo(a.ONE.shiftLeft(c - 1), this); + else { + h = []; + var b = c & 7; + h.length = (c >> 3) + 1; + e.nextBytes(h); + h[0] = 0 < b ? h[0] & (1 << b) - 1 : 0; + this.fromString(h, 256); + } + }; + a.prototype.bitwiseTo = function (c, a, h) { + var e, n = Math.min(c.t, this.t); + for (e = 0; e < n; ++e) + h[e] = a(this[e], c[e]); + if (c.t < this.t) { + var b = c.s & this.DM; + for (e = n; e < this.t; ++e) + h[e] = a(this[e], b); + h.t = this.t; + } else { + b = this.s & this.DM; + for (e = n; e < c.t; ++e) + h[e] = a(b, c[e]); + h.t = c.t; + } + h.s = a(this.s, c.s); + h.clamp(); + }; + a.prototype.changeBit = function (c, e) { + c = a.ONE.shiftLeft(c); + this.bitwiseTo(c, e, c); + return c; + }; + a.prototype.addTo = function (c, a) { + for (var e = 0, b = 0, n = Math.min(c.t, this.t); e < n;) + b += this[e] + c[e], a[e++] = b & this.DM, b >>= this.DB; + if (c.t < this.t) { + for (b += c.s; e < this.t;) + b += this[e], a[e++] = b & this.DM, b >>= this.DB; + b += this.s; + } else { + for (b += this.s; e < c.t;) + b += c[e], a[e++] = b & this.DM, b >>= this.DB; + b += c.s; + } + a.s = 0 > b ? -1 : 0; + 0 < b ? a[e++] = b : -1 > b && (a[e++] = this.DV + b); + a.t = e; + a.clamp(); + }; + a.prototype.dMultiply = function (c) { + this[this.t] = this.am(0, c - 1, this, 0, 0, this.t); + ++this.t; + this.clamp(); + }; + a.prototype.dAddOffset = function (c, a) { + if (0 != c) { + for (; this.t <= a;) + this[this.t++] = 0; + for (this[a] += c; this[a] >= this.DV;) + this[a] -= this.DV, ++a >= this.t && (this[this.t++] = 0), ++this[a]; + } + }; + a.prototype.multiplyLowerTo = function (c, a, h) { + var e = Math.min(this.t + c.t, a); + h.s = 0; + for (h.t = e; 0 < e;) + h[--e] = 0; + var b; + for (b = h.t - this.t; e < b; ++e) + h[e + this.t] = this.am(0, c[e], h, e, 0, this.t); + for (b = Math.min(c.t, a); e < b; ++e) + this.am(0, c[e], h, e, 0, a - e); + h.clamp(); + }; + a.prototype.multiplyUpperTo = function (c, a, h) { + --a; + var e = h.t = this.t + c.t - a; + for (h.s = 0; 0 <= --e;) + h[e] = 0; + for (e = Math.max(a - this.t, 0); e < c.t; ++e) + h[this.t + e - a] = this.am(a - e, c[e], h, 0, 0, this.t + e - a); + h.clamp(); + h.drShiftTo(1, h); + }; + a.prototype.modInt = function (c) { + if (0 >= c) + return 0; + var a = this.DV % c, h = 0 > this.s ? c - 1 : 0; + if (0 < this.t) + if (0 == a) + h = this[0] % c; + else + for (var b = this.t - 1; 0 <= b; --b) + h = (a * h + this[b]) % c; + return h; + }; + a.prototype.millerRabin = function (c) { + var e = this.subtract(a.ONE), h = e.getLowestSetBit(); + if (0 >= h) + return !1; + var b = e.shiftRight(h); + c = c + 1 >> 1; + c > L.length && (c = L.length); + for (var n = k(), d = 0; d < c; ++d) { + n.fromInt(L[Math.floor(Math.random() * L.length)]); + var f = n.modPow(b, this); + if (0 != f.compareTo(a.ONE) && 0 != f.compareTo(e)) { + for (var g = 1; g++ < h && 0 != f.compareTo(e);) + if (f = f.modPowInt(2, this), 0 == f.compareTo(a.ONE)) + return !1; + if (0 != f.compareTo(e)) + return !1; + } + } + return !0; + }; + a.prototype.clone = function () { + var c = k(); + this.copyTo(c); + return c; + }; + a.prototype.intValue = function () { + if (0 > this.s) { + if (1 == this.t) + return this[0] - this.DV; + if (0 == this.t) + return -1; + } else { + if (1 == this.t) + return this[0]; + if (0 == this.t) + return 0; + } + return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0]; + }; + a.prototype.byteValue = function () { + return 0 == this.t ? this.s : this[0] << 24 >> 24; + }; + a.prototype.shortValue = function () { + return 0 == this.t ? this.s : this[0] << 16 >> 16; + }; + a.prototype.signum = function () { + return 0 > this.s ? -1 : 0 >= this.t || 1 == this.t && 0 >= this[0] ? 0 : 1; + }; + a.prototype.toByteArray = function () { + var c = this.t, a = []; + a[0] = this.s; + var h = this.DB - c * this.DB % 8, b, n = 0; + if (0 < c--) + for (h < this.DB && (b = this[c] >> h) != (this.s & this.DM) >> h && (a[n++] = b | this.s << this.DB - h); 0 <= c;) + if (8 > h ? (b = (this[c] & (1 << h) - 1) << 8 - h, b |= this[--c] >> (h += this.DB - 8)) : (b = this[c] >> (h -= 8) & 255, 0 >= h && (h += this.DB, --c)), 0 != (b & 128) && (b |= -256), 0 == n && (this.s & 128) != (b & 128) && ++n, 0 < n || b != this.s) + a[n++] = b; + return a; + }; + a.prototype.equals = function (c) { + return 0 == this.compareTo(c); + }; + a.prototype.min = function (c) { + return 0 > this.compareTo(c) ? this : c; + }; + a.prototype.max = function (c) { + return 0 < this.compareTo(c) ? this : c; + }; + a.prototype.and = function (c) { + var a = k(); + this.bitwiseTo(c, B, a); + return a; + }; + a.prototype.or = function (c) { + var a = k(); + this.bitwiseTo(c, f, a); + return a; + }; + a.prototype.xor = function (c) { + var a = k(); + this.bitwiseTo(c, g, a); + return a; + }; + a.prototype.andNot = function (c) { + var a = k(); + this.bitwiseTo(c, I, a); + return a; + }; + a.prototype.not = function () { + for (var c = k(), a = 0; a < this.t; ++a) + c[a] = this.DM & ~this[a]; + c.t = this.t; + c.s = ~this.s; + return c; + }; + a.prototype.shiftLeft = function (c) { + var a = k(); + 0 > c ? this.rShiftTo(-c, a) : this.lShiftTo(c, a); + return a; + }; + a.prototype.shiftRight = function (c) { + var a = k(); + 0 > c ? this.lShiftTo(-c, a) : this.rShiftTo(c, a); + return a; + }; + a.prototype.getLowestSetBit = function () { + for (var c = 0; c < this.t; ++c) + if (0 != this[c]) { + var a = c * this.DB; + c = this[c]; + if (0 == c) + c = -1; + else { + var b = 0; + 0 == (c & 65535) && (c >>= 16, b += 16); + 0 == (c & 255) && (c >>= 8, b += 8); + 0 == (c & 15) && (c >>= 4, b += 4); + 0 == (c & 3) && (c >>= 2, b += 2); + 0 == (c & 1) && ++b; + c = b; + } + return a + c; + } + return 0 > this.s ? this.t * this.DB : -1; + }; + a.prototype.bitCount = function () { + for (var c = 0, a = this.s & this.DM, b = 0; b < this.t; ++b) { + for (var d = this[b] ^ a, n = 0; 0 != d;) + d &= d - 1, ++n; + c += n; + } + return c; + }; + a.prototype.testBit = function (c) { + var a = Math.floor(c / this.DB); + return a >= this.t ? 0 != this.s : 0 != (this[a] & 1 << c % this.DB); + }; + a.prototype.setBit = function (c) { + return this.changeBit(c, f); + }; + a.prototype.clearBit = function (c) { + return this.changeBit(c, I); + }; + a.prototype.flipBit = function (c) { + return this.changeBit(c, g); + }; + a.prototype.add = function (c) { + var a = k(); + this.addTo(c, a); + return a; + }; + a.prototype.subtract = function (c) { + var a = k(); + this.subTo(c, a); + return a; + }; + a.prototype.multiply = function (c) { + var a = k(); + this.multiplyTo(c, a); + return a; + }; + a.prototype.divide = function (c) { + var a = k(); + this.divRemTo(c, a, null); + return a; + }; + a.prototype.remainder = function (c) { + var a = k(); + this.divRemTo(c, null, a); + return a; + }; + a.prototype.divideAndRemainder = function (c) { + var a = k(), b = k(); + this.divRemTo(c, a, b); + return [ + a, + b + ]; + }; + a.prototype.modPow = function (c, a) { + var e = c.bitLength(), b = C(1); + if (0 >= e) + return b; + var n = 18 > e ? 1 : 48 > e ? 3 : 144 > e ? 4 : 768 > e ? 5 : 6; + a = 8 > e ? new l(a) : a.isEven() ? new m(a) : new F(a); + var d = [], f = 3, g = n - 1, q = (1 << n) - 1; + d[1] = a.convert(this); + if (1 < n) + for (e = k(), a.sqrTo(d[1], e); f <= q;) + d[f] = k(), a.mulTo(e, d[f - 2], d[f]), f += 2; + var p = c.t - 1, r = !0, t = k(); + for (e = z(c[p]) - 1; 0 <= p;) { + if (e >= g) + var B = c[p] >> e - g & q; + else + B = (c[p] & (1 << e + 1) - 1) << g - e, 0 < p && (B |= c[p - 1] >> this.DB + e - g); + for (f = n; 0 == (B & 1);) + B >>= 1, --f; + 0 > (e -= f) && (e += this.DB, --p); + if (r) + d[B].copyTo(b), r = !1; + else { + for (; 1 < f;) + a.sqrTo(b, t), a.sqrTo(t, b), f -= 2; + 0 < f ? a.sqrTo(b, t) : (f = b, b = t, t = f); + a.mulTo(t, d[B], b); + } + for (; 0 <= p && 0 == (c[p] & 1 << e);) + a.sqrTo(b, t), f = b, b = t, t = f, 0 > --e && (e = this.DB - 1, --p); + } + return a.revert(b); + }; + a.prototype.modInverse = function (c) { + var e = c.isEven(); + if (this.isEven() && e || 0 == c.signum()) + return a.ZERO; + for (var b = c.clone(), d = this.clone(), n = C(1), f = C(0), R = C(0), g = C(1); 0 != b.signum();) { + for (; b.isEven();) + b.rShiftTo(1, b), e ? (n.isEven() && f.isEven() || (n.addTo(this, n), f.subTo(c, f)), n.rShiftTo(1, n)) : f.isEven() || f.subTo(c, f), f.rShiftTo(1, f); + for (; d.isEven();) + d.rShiftTo(1, d), e ? (R.isEven() && g.isEven() || (R.addTo(this, R), g.subTo(c, g)), R.rShiftTo(1, R)) : g.isEven() || g.subTo(c, g), g.rShiftTo(1, g); + 0 <= b.compareTo(d) ? (b.subTo(d, b), e && n.subTo(R, n), f.subTo(g, f)) : (d.subTo(b, d), e && R.subTo(n, R), g.subTo(f, g)); + } + if (0 != d.compareTo(a.ONE)) + return a.ZERO; + if (0 <= g.compareTo(c)) + return g.subtract(c); + if (0 > g.signum()) + g.addTo(c, g); + else + return g; + return 0 > g.signum() ? g.add(c) : g; + }; + a.prototype.pow = function (c) { + return this.exp(c, new t()); + }; + a.prototype.gcd = function (c) { + var a = 0 > this.s ? this.negate() : this.clone(); + c = 0 > c.s ? c.negate() : c.clone(); + if (0 > a.compareTo(c)) { + var b = a; + a = c; + c = b; + } + b = a.getLowestSetBit(); + var d = c.getLowestSetBit(); + if (0 > d) + return a; + b < d && (d = b); + 0 < d && (a.rShiftTo(d, a), c.rShiftTo(d, c)); + for (; 0 < a.signum();) + 0 < (b = a.getLowestSetBit()) && a.rShiftTo(b, a), 0 < (b = c.getLowestSetBit()) && c.rShiftTo(b, c), 0 <= a.compareTo(c) ? (a.subTo(c, a), a.rShiftTo(1, a)) : (c.subTo(a, c), c.rShiftTo(1, c)); + 0 < d && c.lShiftTo(d, c); + return c; + }; + a.prototype.isProbablePrime = function (a) { + var c, b = this.abs(); + if (1 == b.t && b[0] <= L[L.length - 1]) { + for (c = 0; c < L.length; ++c) + if (b[0] == L[c]) + return !0; + return !1; + } + if (b.isEven()) + return !1; + for (c = 1; c < L.length;) { + for (var d = L[c], n = c + 1; n < L.length && d < y;) + d *= L[n++]; + for (d = b.modInt(d); c < n;) + if (0 == d % L[c++]) + return !1; + } + return b.millerRabin(a); + }; + a.prototype.square = function () { + var a = k(); + this.squareTo(a); + return a; + }; + M.prototype.init = function (a) { + var c, b; + for (c = 0; 256 > c; ++c) + this.S[c] = c; + for (c = b = 0; 256 > c; ++c) { + b = b + this.S[c] + a[c % a.length] & 255; + var d = this.S[c]; + this.S[c] = this.S[b]; + this.S[b] = d; + } + this.j = this.i = 0; + }; + M.prototype.next = function () { + this.i = this.i + 1 & 255; + this.j = this.j + this.S[this.i] & 255; + var a = this.S[this.i]; + this.S[this.i] = this.S[this.j]; + this.S[this.j] = a; + return this.S[a + this.S[this.i] & 255]; + }; + var O; + if (null == p) { + var p = []; + var q = 0; + if (window.crypto && window.crypto.getRandomValues) + for (E = new Uint32Array(256), window.crypto.getRandomValues(E), b = 0; b < E.length; ++b) + p[q++] = E[b] & 255; + var r = function (a) { + this.count = this.count || 0; + if (256 <= this.count || 256 <= q) + window.removeEventListener ? window.removeEventListener('mousemove', r, !1) : window.detachEvent && window.detachEvent('onmousemove', r); + else + try { + var c = a.x + a.y; + p[q++] = c & 255; + this.count += 1; + } catch (h) { + } + }; + window.addEventListener ? window.addEventListener('mousemove', r, !1) : window.attachEvent && window.attachEvent('onmousemove', r); + } + K.prototype.nextBytes = function (a) { + var c; + for (c = 0; c < a.length; ++c) { + var b = c; + if (null == O) { + for (O = new M(); 256 > q;) { + var d = Math.floor(65536 * Math.random()); + p[q++] = d & 255; + } + O.init(p); + for (q = 0; q < p.length; ++q) + p[q] = 0; + q = 0; + } + d = O.next(); + a[b] = d; + } + }; + G.prototype.doPublic = function (a) { + return a.modPowInt(this.e, this.n); + }; + G.prototype.setPublic = function (a, e) { + null != a && null != e && 0 < a.length && 0 < e.length ? (this.n = J(a, 16), this.e = parseInt(e, 16)) : console.error('Invalid RSA public key'); + }; + G.prototype.encrypt = function (c) { + var e = this.n.bitLength() + 7 >> 3; + if (e < c.length + 11) + console.error('Message too long for RSA'), e = null; + else { + for (var b = [], d = c.length - 1; 0 <= d && 0 < e;) { + var n = c.charCodeAt(d--); + 128 > n ? b[--e] = n : 127 < n && 2048 > n ? (b[--e] = n & 63 | 128, b[--e] = n >> 6 | 192) : (b[--e] = n & 63 | 128, b[--e] = n >> 6 & 63 | 128, b[--e] = n >> 12 | 224); + } + b[--e] = 0; + c = new K(); + for (d = []; 2 < e;) { + for (d[0] = 0; 0 == d[0];) + c.nextBytes(d); + b[--e] = d[0]; + } + b[--e] = 2; + b[--e] = 0; + e = new a(b); + } + if (null == e) + return null; + e = this.doPublic(e); + if (null == e) + return null; + e = e.toString(16); + return 0 == (e.length & 1) ? e : '0' + e; + }; + G.prototype.doPrivate = function (a) { + if (null == this.p || null == this.q) + return a.modPow(this.d, this.n); + var c = a.mod(this.p).modPow(this.dmp1, this.p); + for (a = a.mod(this.q).modPow(this.dmq1, this.q); 0 > c.compareTo(a);) + c = c.add(this.p); + return c.subtract(a).multiply(this.coeff).mod(this.p).multiply(this.q).add(a); + }; + G.prototype.setPrivate = function (a, e, b) { + null != a && null != e && 0 < a.length && 0 < e.length ? (this.n = J(a, 16), this.e = parseInt(e, 16), this.d = J(b, 16)) : console.error('Invalid RSA private key'); + }; + G.prototype.setPrivateEx = function (a, e, b, d, n, f, g, m) { + null != a && null != e && 0 < a.length && 0 < e.length ? (this.n = J(a, 16), this.e = parseInt(e, 16), this.d = J(b, 16), this.p = J(d, 16), this.q = J(n, 16), this.dmp1 = J(f, 16), this.dmq1 = J(g, 16), this.coeff = J(m, 16)) : console.error('Invalid RSA private key'); + }; + G.prototype.generate = function (c, e) { + var b = new K(), d = c >> 1; + this.e = parseInt(e, 16); + for (e = new a(e, 16);;) { + for (; this.p = new a(c - d, 1, b), 0 != this.p.subtract(a.ONE).gcd(e).compareTo(a.ONE) || !this.p.isProbablePrime(10);); + for (; this.q = new a(d, 1, b), 0 != this.q.subtract(a.ONE).gcd(e).compareTo(a.ONE) || !this.q.isProbablePrime(10);); + if (0 >= this.p.compareTo(this.q)) { + var n = this.p; + this.p = this.q; + this.q = n; + } + n = this.p.subtract(a.ONE); + var f = this.q.subtract(a.ONE), g = n.multiply(f); + if (0 == g.gcd(e).compareTo(a.ONE)) { + this.n = this.p.multiply(this.q); + this.d = e.modInverse(g); + this.dmp1 = this.d.mod(n); + this.dmq1 = this.d.mod(f); + this.coeff = this.q.modInverse(this.p); + break; + } + } + }; + G.prototype.decrypt = function (a) { + a = J(a, 16); + a = this.doPrivate(a); + if (null == a) + return null; + a: { + var c = this.n.bitLength() + 7 >> 3; + a = a.toByteArray(); + for (var b = 0; b < a.length && 0 == a[b];) + ++b; + if (a.length - b != c - 1 || 2 != a[b]) + a = null; + else { + for (++b; 0 != a[b];) + if (++b >= a.length) { + a = null; + break a; + } + for (c = ''; ++b < a.length;) { + var d = a[b] & 255; + 128 > d ? c += String.fromCharCode(d) : 191 < d && 224 > d ? (c += String.fromCharCode((d & 31) << 6 | a[b + 1] & 63), ++b) : (c += String.fromCharCode((d & 15) << 12 | (a[b + 1] & 63) << 6 | a[b + 2] & 63), b += 2); + } + a = c; + } + } + return a; + }; + (function () { + G.prototype.generateAsync = function (c, e, b) { + var d = new K(), n = c >> 1; + this.e = parseInt(e, 16); + var f = new a(e, 16), h = this, g = function () { + var e = function () { + if (0 >= h.p.compareTo(h.q)) { + var c = h.p; + h.p = h.q; + h.q = c; + } + c = h.p.subtract(a.ONE); + var e = h.q.subtract(a.ONE), d = c.multiply(e); + 0 == d.gcd(f).compareTo(a.ONE) ? (h.n = h.p.multiply(h.q), h.d = f.modInverse(d), h.dmp1 = h.d.mod(c), h.dmq1 = h.d.mod(e), h.coeff = h.q.modInverse(h.p), setTimeout(function () { + b(); + }, 0)) : setTimeout(g, 0); + }, u = function () { + h.q = k(); + h.q.fromNumberAsync(n, 1, d, function () { + h.q.subtract(a.ONE).gcda(f, function (c) { + 0 == c.compareTo(a.ONE) && h.q.isProbablePrime(10) ? setTimeout(e, 0) : setTimeout(u, 0); + }); + }); + }, Q = function () { + h.p = k(); + h.p.fromNumberAsync(c - n, 1, d, function () { + h.p.subtract(a.ONE).gcda(f, function (c) { + 0 == c.compareTo(a.ONE) && h.p.isProbablePrime(10) ? setTimeout(u, 0) : setTimeout(Q, 0); + }); + }); + }; + setTimeout(Q, 0); + }; + setTimeout(g, 0); + }; + a.prototype.gcda = function (a, e) { + var c = 0 > this.s ? this.negate() : this.clone(), b = 0 > a.s ? a.negate() : a.clone(); + 0 > c.compareTo(b) && (a = c, c = b, b = a); + var d = c.getLowestSetBit(), f = b.getLowestSetBit(); + if (0 > f) + e(c); + else { + d < f && (f = d); + 0 < f && (c.rShiftTo(f, c), b.rShiftTo(f, b)); + var g = function () { + 0 < (d = c.getLowestSetBit()) && c.rShiftTo(d, c); + 0 < (d = b.getLowestSetBit()) && b.rShiftTo(d, b); + 0 <= c.compareTo(b) ? (c.subTo(b, c), c.rShiftTo(1, c)) : (b.subTo(c, b), b.rShiftTo(1, b)); + 0 < c.signum() ? setTimeout(g, 0) : (0 < f && b.lShiftTo(f, b), setTimeout(function () { + e(b); + }, 0)); + }; + setTimeout(g, 10); + } + }; + a.prototype.fromNumberAsync = function (c, e, b, d) { + if ('number' == typeof e) + if (2 > c) + this.fromInt(1); + else { + this.fromNumber(c, b); + this.testBit(c - 1) || this.bitwiseTo(a.ONE.shiftLeft(c - 1), f, this); + this.isEven() && this.dAddOffset(1, 0); + var n = this, h = function () { + n.dAddOffset(2, 0); + n.bitLength() > c && n.subTo(a.ONE.shiftLeft(c - 1), n); + n.isProbablePrime(e) ? setTimeout(function () { + d(); + }, 0) : setTimeout(h, 0); + }; + setTimeout(h, 0); + } + else { + b = []; + var g = c & 7; + b.length = (c >> 3) + 1; + e.nextBytes(b); + b[0] = 0 < g ? b[0] & (1 << g) - 1 : 0; + this.fromString(b, 256); + } + }; + }()); + var D = D || {}; + D.env = D.env || {}; + var U = D, S = Object.prototype, X = [ + 'toString', + 'valueOf' + ]; + D.env.parseUA = function (a) { + var c = function (a) { + var c = 0; + return parseFloat(a.replace(/\./g, function () { + return 1 == c++ ? '' : '.'; + })); + }, b = navigator; + b = { + ie: 0, + opera: 0, + gecko: 0, + webkit: 0, + chrome: 0, + mobile: null, + air: 0, + ipad: 0, + iphone: 0, + ipod: 0, + ios: null, + android: 0, + webos: 0, + caja: b && b.cajaVersion, + secure: !1, + os: null + }; + a = a || navigator && navigator.userAgent; + var d = window && window.location; + d = d && d.href; + b.secure = d && 0 === d.toLowerCase().indexOf('https'); + if (a) { + /windows|win32/i.test(a) ? b.os = 'windows' : /macintosh/i.test(a) ? b.os = 'macintosh' : /rhino/i.test(a) && (b.os = 'rhino'); + /KHTML/.test(a) && (b.webkit = 1); + if ((d = a.match(/AppleWebKit\/([^\s]*)/)) && d[1]) { + b.webkit = c(d[1]); + if (/ Mobile\//.test(a)) + b.mobile = 'Apple', (d = a.match(/OS ([^\s]*)/)) && d[1] && (d = c(d[1].replace('_', '.'))), b.ios = d, b.ipad = b.ipod = b.iphone = 0, (d = a.match(/iPad|iPod|iPhone/)) && d[0] && (b[d[0].toLowerCase()] = b.ios); + else { + if (d = a.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/)) + b.mobile = d[0]; + /webOS/.test(a) && (b.mobile = 'WebOS', (d = a.match(/webOS\/([^\s]*);/)) && d[1] && (b.webos = c(d[1]))); + / Android/.test(a) && (b.mobile = 'Android', (d = a.match(/Android ([^\s]*);/)) && d[1] && (b.android = c(d[1]))); + } + if ((d = a.match(/Chrome\/([^\s]*)/)) && d[1]) + b.chrome = c(d[1]); + else if (d = a.match(/AdobeAIR\/([^\s]*)/)) + b.air = d[0]; + } + if (!b.webkit) + if ((d = a.match(/Opera[\s\/]([^\s]*)/)) && d[1]) { + if (b.opera = c(d[1]), (d = a.match(/Version\/([^\s]*)/)) && d[1] && (b.opera = c(d[1])), d = a.match(/Opera Mini[^;]*/)) + b.mobile = d[0]; + } else if ((d = a.match(/MSIE\s([^;]*)/)) && d[1]) + b.ie = c(d[1]); + else if (d = a.match(/Gecko\/([^\s]*)/)) + b.gecko = 1, (d = a.match(/rv:([^\s\)]*)/)) && d[1] && (b.gecko = c(d[1])); + } + return b; + }; + D.env.ua = D.env.parseUA(); + D.isFunction = function (a) { + return 'function' === typeof a || '[object Function]' === S.toString.apply(a); + }; + D._IEEnumFix = D.env.ua.ie ? function (a, b) { + var c; + for (c = 0; c < X.length; c += 1) { + var e = X[c]; + var d = b[e]; + U.isFunction(d) && d != S[e] && (a[e] = d); + } + } : function () { + }; + D.extend = function (a, b, d) { + if (!b || !a) + throw Error('extend failed, please check that all dependencies are included.'); + var c = function () { + }, e; + c.prototype = b.prototype; + a.prototype = new c(); + a.prototype.constructor = a; + a.superclass = b.prototype; + b.prototype.constructor == S.constructor && (b.prototype.constructor = b); + if (d) { + for (e in d) + U.hasOwnProperty(d, e) && (a.prototype[e] = d[e]); + U._IEEnumFix(a.prototype, d); + } + }; + 'undefined' != typeof KJUR && KJUR || (KJUR = {}); + 'undefined' != typeof KJUR.asn1 && KJUR.asn1 || (KJUR.asn1 = {}); + KJUR.asn1.ASN1Util = new function () { + this.integerToByteHex = function (a) { + a = a.toString(16); + 1 == a.length % 2 && (a = '0' + a); + return a; + }; + this.bigIntToMinTwosComplementsHex = function (c) { + var b = c.toString(16); + if ('-' != b.substr(0, 1)) + 1 == b.length % 2 ? b = '0' + b : b.match(/^[0-7]/) || (b = '00' + b); + else { + var d = b.substr(1).length; + 1 == d % 2 ? d += 1 : b.match(/^[0-7]/) || (d += 2); + b = ''; + for (var f = 0; f < d; f++) + b += 'f'; + b = new a(b, 16).xor(c).add(a.ONE).toString(16).replace(/^-/, ''); + } + return b; + }; + this.getPEMStringFromHex = function (a, b) { + a = CryptoJS.enc.Hex.parse(a); + a = CryptoJS.enc.Base64.stringify(a).replace(/(.{64})/g, '$1\r\n'); + a = a.replace(/\r\n$/, ''); + return '-----BEGIN ' + b + '-----\r\n' + a + '\r\n-----END ' + b + '-----\r\n'; + }; + }(); + KJUR.asn1.ASN1Object = function () { + this.getLengthHexFromValue = function () { + if ('undefined' == typeof this.hV || null == this.hV) + throw 'this.hV is null or undefined.'; + if (1 == this.hV.length % 2) + throw 'value hex must be even length: n=0,v=' + this.hV; + var a = this.hV.length / 2, b = a.toString(16); + 1 == b.length % 2 && (b = '0' + b); + if (128 > a) + return b; + var d = b.length / 2; + if (15 < d) + throw 'ASN.1 length too long to represent by 8x: n = ' + a.toString(16); + return (128 + d).toString(16) + b; + }; + this.getEncodedHex = function () { + if (null == this.hTLV || this.isModified) + this.hV = this.getFreshValueHex(), this.hL = this.getLengthHexFromValue(), this.hTLV = this.hT + this.hL + this.hV, this.isModified = !1; + return this.hTLV; + }; + this.getValueHex = function () { + this.getEncodedHex(); + return this.hV; + }; + this.getFreshValueHex = function () { + return ''; + }; + }; + KJUR.asn1.DERAbstractString = function (a) { + KJUR.asn1.DERAbstractString.superclass.constructor.call(this); + this.getString = function () { + return this.s; + }; + this.setString = function (a) { + this.hTLV = null; + this.isModified = !0; + this.s = a; + this.hV = stohex(this.s); + }; + this.setStringHex = function (a) { + this.hTLV = null; + this.isModified = !0; + this.s = null; + this.hV = a; + }; + this.getFreshValueHex = function () { + return this.hV; + }; + 'undefined' != typeof a && ('undefined' != typeof a.str ? this.setString(a.str) : 'undefined' != typeof a.hex && this.setStringHex(a.hex)); + }; + D.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object); + KJUR.asn1.DERAbstractTime = function (a) { + KJUR.asn1.DERAbstractTime.superclass.constructor.call(this); + this.localDateToUTC = function (a) { + utc = a.getTime() + 60000 * a.getTimezoneOffset(); + return new Date(utc); + }; + this.formatDate = function (a, c) { + var b = this.zeroPadding, e = this.localDateToUTC(a); + a = String(e.getFullYear()); + 'utc' == c && (a = a.substr(2, 2)); + c = b(String(e.getMonth() + 1), 2); + var d = b(String(e.getDate()), 2), f = b(String(e.getHours()), 2), h = b(String(e.getMinutes()), 2); + b = b(String(e.getSeconds()), 2); + return a + c + d + f + h + b + 'Z'; + }; + this.zeroPadding = function (a, c) { + return a.length >= c ? a : Array(c - a.length + 1).join('0') + a; + }; + this.getString = function () { + return this.s; + }; + this.setString = function (a) { + this.hTLV = null; + this.isModified = !0; + this.s = a; + this.hV = stohex(this.s); + }; + this.setByDateValue = function (a, c, b, d, f, g) { + a = new Date(Date.UTC(a, c - 1, b, d, f, g, 0)); + this.setByDate(a); + }; + this.getFreshValueHex = function () { + return this.hV; + }; + }; + D.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object); + KJUR.asn1.DERAbstractStructured = function (a) { + KJUR.asn1.DERAbstractString.superclass.constructor.call(this); + this.setByASN1ObjectArray = function (a) { + this.hTLV = null; + this.isModified = !0; + this.asn1Array = a; + }; + this.appendASN1Object = function (a) { + this.hTLV = null; + this.isModified = !0; + this.asn1Array.push(a); + }; + this.asn1Array = []; + 'undefined' != typeof a && 'undefined' != typeof a.array && (this.asn1Array = a.array); + }; + D.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object); + KJUR.asn1.DERBoolean = function () { + KJUR.asn1.DERBoolean.superclass.constructor.call(this); + this.hT = '01'; + this.hTLV = '0101ff'; + }; + D.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object); + KJUR.asn1.DERInteger = function (c) { + KJUR.asn1.DERInteger.superclass.constructor.call(this); + this.hT = '02'; + this.setByBigInteger = function (a) { + this.hTLV = null; + this.isModified = !0; + this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(a); + }; + this.setByInteger = function (c) { + c = new a(String(c), 10); + this.setByBigInteger(c); + }; + this.setValueHex = function (a) { + this.hV = a; + }; + this.getFreshValueHex = function () { + return this.hV; + }; + 'undefined' != typeof c && ('undefined' != typeof c.bigint ? this.setByBigInteger(c.bigint) : 'undefined' != typeof c['int'] ? this.setByInteger(c['int']) : 'undefined' != typeof c.hex && this.setValueHex(c.hex)); + }; + D.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object); + KJUR.asn1.DERBitString = function (a) { + KJUR.asn1.DERBitString.superclass.constructor.call(this); + this.hT = '03'; + this.setHexValueIncludingUnusedBits = function (a) { + this.hTLV = null; + this.isModified = !0; + this.hV = a; + }; + this.setUnusedBitsAndHexValue = function (a, c) { + if (0 > a || 7 < a) + throw 'unused bits shall be from 0 to 7: u = ' + a; + this.hTLV = null; + this.isModified = !0; + this.hV = '0' + a + c; + }; + this.setByBinaryString = function (a) { + a = a.replace(/0+$/, ''); + var c = 8 - a.length % 8; + 8 == c && (c = 0); + for (var b = 0; b <= c; b++) + a += '0'; + var e = ''; + for (b = 0; b < a.length - 1; b += 8) { + var d = a.substr(b, 8); + d = parseInt(d, 2).toString(16); + 1 == d.length && (d = '0' + d); + e += d; + } + this.hTLV = null; + this.isModified = !0; + this.hV = '0' + c + e; + }; + this.setByBooleanArray = function (a) { + for (var c = '', b = 0; b < a.length; b++) + c = 1 == a[b] ? c + '1' : c + '0'; + this.setByBinaryString(c); + }; + this.newFalseArray = function (a) { + for (var c = Array(a), b = 0; b < a; b++) + c[b] = !1; + return c; + }; + this.getFreshValueHex = function () { + return this.hV; + }; + 'undefined' != typeof a && ('undefined' != typeof a.hex ? this.setHexValueIncludingUnusedBits(a.hex) : 'undefined' != typeof a.bin ? this.setByBinaryString(a.bin) : 'undefined' != typeof a.array && this.setByBooleanArray(a.array)); + }; + D.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object); + KJUR.asn1.DEROctetString = function (a) { + KJUR.asn1.DEROctetString.superclass.constructor.call(this, a); + this.hT = '04'; + }; + D.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString); + KJUR.asn1.DERNull = function () { + KJUR.asn1.DERNull.superclass.constructor.call(this); + this.hT = '05'; + this.hTLV = '0500'; + }; + D.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object); + KJUR.asn1.DERObjectIdentifier = function (c) { + var b = function (a) { + a = a.toString(16); + 1 == a.length && (a = '0' + a); + return a; + }; + KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this); + this.hT = '06'; + this.setValueHex = function (a) { + this.hTLV = null; + this.isModified = !0; + this.s = null; + this.hV = a; + }; + this.setValueOidString = function (c) { + if (!c.match(/^[0-9.]+$/)) + throw 'malformed oid string: ' + c; + var d = ''; + c = c.split('.'); + var e = 40 * parseInt(c[0]) + parseInt(c[1]); + d += b(e); + c.splice(0, 2); + for (e = 0; e < c.length; e++) { + var f = '', h = new a(c[e], 10).toString(2), g = 7 - h.length % 7; + 7 == g && (g = 0); + for (var m = '', k = 0; k < g; k++) + m += '0'; + h = m + h; + for (k = 0; k < h.length - 1; k += 7) + g = h.substr(k, 7), k != h.length - 7 && (g = '1' + g), f += b(parseInt(g, 2)); + d += f; + } + this.hTLV = null; + this.isModified = !0; + this.s = null; + this.hV = d; + }; + this.setValueName = function (a) { + if ('undefined' != typeof KJUR.asn1.x509.OID.name2oidList[a]) + this.setValueOidString(KJUR.asn1.x509.OID.name2oidList[a]); + else + throw 'DERObjectIdentifier oidName undefined: ' + a; + }; + this.getFreshValueHex = function () { + return this.hV; + }; + 'undefined' != typeof c && ('undefined' != typeof c.oid ? this.setValueOidString(c.oid) : 'undefined' != typeof c.hex ? this.setValueHex(c.hex) : 'undefined' != typeof c.name && this.setValueName(c.name)); + }; + D.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object); + KJUR.asn1.DERUTF8String = function (a) { + KJUR.asn1.DERUTF8String.superclass.constructor.call(this, a); + this.hT = '0c'; + }; + D.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString); + KJUR.asn1.DERNumericString = function (a) { + KJUR.asn1.DERNumericString.superclass.constructor.call(this, a); + this.hT = '12'; + }; + D.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString); + KJUR.asn1.DERPrintableString = function (a) { + KJUR.asn1.DERPrintableString.superclass.constructor.call(this, a); + this.hT = '13'; + }; + D.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString); + KJUR.asn1.DERTeletexString = function (a) { + KJUR.asn1.DERTeletexString.superclass.constructor.call(this, a); + this.hT = '14'; + }; + D.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString); + KJUR.asn1.DERIA5String = function (a) { + KJUR.asn1.DERIA5String.superclass.constructor.call(this, a); + this.hT = '16'; + }; + D.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString); + KJUR.asn1.DERUTCTime = function (a) { + KJUR.asn1.DERUTCTime.superclass.constructor.call(this, a); + this.hT = '17'; + this.setByDate = function (a) { + this.hTLV = null; + this.isModified = !0; + this.date = a; + this.s = this.formatDate(this.date, 'utc'); + this.hV = stohex(this.s); + }; + 'undefined' != typeof a && ('undefined' != typeof a.str ? this.setString(a.str) : 'undefined' != typeof a.hex ? this.setStringHex(a.hex) : 'undefined' != typeof a.date && this.setByDate(a.date)); + }; + D.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime); + KJUR.asn1.DERGeneralizedTime = function (a) { + KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, a); + this.hT = '18'; + this.setByDate = function (a) { + this.hTLV = null; + this.isModified = !0; + this.date = a; + this.s = this.formatDate(this.date, 'gen'); + this.hV = stohex(this.s); + }; + 'undefined' != typeof a && ('undefined' != typeof a.str ? this.setString(a.str) : 'undefined' != typeof a.hex ? this.setStringHex(a.hex) : 'undefined' != typeof a.date && this.setByDate(a.date)); + }; + D.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime); + KJUR.asn1.DERSequence = function (a) { + KJUR.asn1.DERSequence.superclass.constructor.call(this, a); + this.hT = '30'; + this.getFreshValueHex = function () { + for (var a = '', c = 0; c < this.asn1Array.length; c++) + a += this.asn1Array[c].getEncodedHex(); + return this.hV = a; + }; + }; + D.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured); + KJUR.asn1.DERSet = function (a) { + KJUR.asn1.DERSet.superclass.constructor.call(this, a); + this.hT = '31'; + this.getFreshValueHex = function () { + for (var a = [], c = 0; c < this.asn1Array.length; c++) + a.push(this.asn1Array[c].getEncodedHex()); + a.sort(); + return this.hV = a.join(''); + }; + }; + D.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured); + KJUR.asn1.DERTaggedObject = function (a) { + KJUR.asn1.DERTaggedObject.superclass.constructor.call(this); + this.hT = 'a0'; + this.hV = ''; + this.isExplicit = !0; + this.asn1Object = null; + this.setASN1Object = function (a, c, b) { + this.hT = c; + this.isExplicit = a; + this.asn1Object = b; + this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), this.hTLV = null, this.isModified = !0) : (this.hV = null, this.hTLV = b.getEncodedHex(), this.hTLV = this.hTLV.replace(/^../, c), this.isModified = !1); + }; + this.getFreshValueHex = function () { + return this.hV; + }; + 'undefined' != typeof a && ('undefined' != typeof a.tag && (this.hT = a.tag), 'undefined' != typeof a.explicit && (this.isExplicit = a.explicit), 'undefined' != typeof a.obj && (this.asn1Object = a.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object))); + }; + D.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); + (function (a) { + var c = {}, b; + c.decode = function (c) { + var d; + if (b === a) { + var e = '0123456789ABCDEF'; + b = []; + for (d = 0; 16 > d; ++d) + b[e.charAt(d)] = d; + e = e.toLowerCase(); + for (d = 10; 16 > d; ++d) + b[e.charAt(d)] = d; + for (d = 0; 8 > d; ++d) + b[' \f\n\r\t\xA0\u2028\u2029'.charAt(d)] = -1; + } + e = []; + var f = 0, g = 0; + for (d = 0; d < c.length; ++d) { + var h = c.charAt(d); + if ('=' == h) + break; + h = b[h]; + if (-1 != h) { + if (h === a) + throw 'Illegal character at offset ' + d; + f |= h; + 2 <= ++g ? (e[e.length] = f, g = f = 0) : f <<= 4; + } + } + if (g) + throw 'Hex encoding incomplete: 4 bits missing'; + return e; + }; + Adform.JSEncryptHelpers.Hex = c; + }()); + (function (a) { + var c = {}, b; + c.decode = function (c) { + var d; + if (b === a) { + b = []; + for (d = 0; 64 > d; ++d) + b['ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(d)] = d; + for (d = 0; 9 > d; ++d) + b['= \f\n\r\t\xA0\u2028\u2029'.charAt(d)] = -1; + } + var e = [], f = 0, g = 0; + for (d = 0; d < c.length; ++d) { + var h = c.charAt(d); + if ('=' == h) + break; + h = b[h]; + if (-1 != h) { + if (h === a) + throw 'Illegal character at offset ' + d; + f |= h; + 4 <= ++g ? (e[e.length] = f >> 16, e[e.length] = f >> 8 & 255, e[e.length] = f & 255, g = f = 0) : f <<= 6; + } + } + switch (g) { + case 1: + throw 'Base64 encoding incomplete: at least 2 bits missing'; + case 2: + e[e.length] = f >> 10; + break; + case 3: + e[e.length] = f >> 16, e[e.length] = f >> 8 & 255; + } + return e; + }; + c.re = /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/; + c.unarmor = function (a) { + var b = c.re.exec(a); + if (b) + if (b[1]) + a = b[1]; + else if (b[2]) + a = b[2]; + else + throw 'RegExp out of sync'; + return c.decode(a); + }; + Adform.JSEncryptHelpers.Base64 = c; + }()); + (function (a) { + function c(a, b) { + a instanceof c ? (this.enc = a.enc, this.pos = a.pos) : (this.enc = a, this.pos = b); + } + function b(a, c, b, d, e) { + this.stream = a; + this.header = c; + this.length = b; + this.tag = d; + this.sub = e; + } + var d = { + tag: function (a, c) { + a = document.createElement(a); + a.className = c; + return a; + }, + text: function (a) { + return document.createTextNode(a); + } + }; + c.prototype.get = function (c) { + c === a && (c = this.pos++); + if (c >= this.enc.length) + throw 'Requesting byte offset ' + c + ' on a stream of length ' + this.enc.length; + return this.enc[c]; + }; + c.prototype.hexDigits = '0123456789ABCDEF'; + c.prototype.hexByte = function (a) { + return this.hexDigits.charAt(a >> 4 & 15) + this.hexDigits.charAt(a & 15); + }; + c.prototype.hexDump = function (a, c, b) { + for (var d = ''; a < c; ++a) + if (d += this.hexByte(this.get(a)), !0 !== b) + switch (a & 15) { + case 7: + d += ' '; + break; + case 15: + d += '\n'; + break; + default: + d += ' '; + } + return d; + }; + c.prototype.parseStringISO = function (a, c) { + for (var b = ''; a < c; ++a) + b += String.fromCharCode(this.get(a)); + return b; + }; + c.prototype.parseStringUTF = function (a, c) { + for (var b = ''; a < c;) { + var d = this.get(a++); + b = 128 > d ? b + String.fromCharCode(d) : 191 < d && 224 > d ? b + String.fromCharCode((d & 31) << 6 | this.get(a++) & 63) : b + String.fromCharCode((d & 15) << 12 | (this.get(a++) & 63) << 6 | this.get(a++) & 63); + } + return b; + }; + c.prototype.parseStringBMP = function (a, c) { + for (var b = ''; a < c; a += 2) { + var d = this.get(a), e = this.get(a + 1); + b += String.fromCharCode((d << 8) + e); + } + return b; + }; + c.prototype.reTime = /^((?:1[89]|2\d)?\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/; + c.prototype.parseTime = function (a, c) { + a = this.parseStringISO(a, c); + c = this.reTime.exec(a); + if (!c) + return 'Unrecognized time: ' + a; + a = c[1] + '-' + c[2] + '-' + c[3] + ' ' + c[4]; + c[5] && (a += ':' + c[5], c[6] && (a += ':' + c[6], c[7] && (a += '.' + c[7]))); + c[8] && (a += ' UTC', 'Z' != c[8] && (a += c[8], c[9] && (a += ':' + c[9]))); + return a; + }; + c.prototype.parseInteger = function (a, c) { + var b = c - a; + if (4 < b) { + b <<= 3; + c = this.get(a); + if (0 === c) + b -= 8; + else + for (; 128 > c;) + c <<= 1, --b; + return '(' + b + ' bit)'; + } + for (b = 0; a < c; ++a) + b = b << 8 | this.get(a); + return b; + }; + c.prototype.parseBitString = function (a, c) { + var b = this.get(a), d = (c - a - 1 << 3) - b, e = '(' + d + ' bit)'; + if (20 >= d) + for (e += ' ', --c; c > a; --c) { + for (d = this.get(c); 8 > b; ++b) + e += d >> b & 1 ? '1' : '0'; + b = 0; + } + return e; + }; + c.prototype.parseOctetString = function (a, c) { + var b = c - a, d = '(' + b + ' byte) '; + for (100 < b && (c = a + 100); a < c; ++a) + d += this.hexByte(this.get(a)); + 100 < b && (d += '\u2026'); + return d; + }; + c.prototype.parseOID = function (a, c) { + for (var b = '', d = 0, e = 0; a < c; ++a) { + var f = this.get(a); + d = d << 7 | f & 127; + e += 7; + f & 128 || ('' === b ? (b = 80 > d ? 40 > d ? 0 : 1 : 2, b = b + '.' + (d - 40 * b)) : b += '.' + (31 <= e ? 'bigint' : d), d = e = 0); + } + return b; + }; + b.prototype.typeName = function () { + if (this.tag === a) + return 'unknown'; + var c = this.tag & 31; + switch (this.tag >> 6) { + case 0: + switch (c) { + case 0: + return 'EOC'; + case 1: + return 'BOOLEAN'; + case 2: + return 'INTEGER'; + case 3: + return 'BIT_STRING'; + case 4: + return 'OCTET_STRING'; + case 5: + return 'NULL'; + case 6: + return 'OBJECT_IDENTIFIER'; + case 7: + return 'ObjectDescriptor'; + case 8: + return 'EXTERNAL'; + case 9: + return 'REAL'; + case 10: + return 'ENUMERATED'; + case 11: + return 'EMBEDDED_PDV'; + case 12: + return 'UTF8String'; + case 16: + return 'SEQUENCE'; + case 17: + return 'SET'; + case 18: + return 'NumericString'; + case 19: + return 'PrintableString'; + case 20: + return 'TeletexString'; + case 21: + return 'VideotexString'; + case 22: + return 'IA5String'; + case 23: + return 'UTCTime'; + case 24: + return 'GeneralizedTime'; + case 25: + return 'GraphicString'; + case 26: + return 'VisibleString'; + case 27: + return 'GeneralString'; + case 28: + return 'UniversalString'; + case 30: + return 'BMPString'; + default: + return 'Universal_' + c.toString(16); + } + case 1: + return 'Application_' + c.toString(16); + case 2: + return '[' + c + ']'; + case 3: + return 'Private_' + c.toString(16); + } + }; + b.prototype.reSeemsASCII = /^[ -~]+$/; + b.prototype.content = function () { + if (this.tag === a) + return null; + var c = this.tag >> 6, b = this.tag & 31, d = this.posContent(), e = Math.abs(this.length); + if (0 !== c) { + if (null !== this.sub) + return '(' + this.sub.length + ' elem)'; + c = this.stream.parseStringISO(d, d + Math.min(e, 100)); + return this.reSeemsASCII.test(c) ? c.substring(0, 200) + (200 < c.length ? '\u2026' : '') : this.stream.parseOctetString(d, d + e); + } + switch (b) { + case 1: + return 0 === this.stream.get(d) ? 'false' : 'true'; + case 2: + return this.stream.parseInteger(d, d + e); + case 3: + return this.sub ? '(' + this.sub.length + ' elem)' : this.stream.parseBitString(d, d + e); + case 4: + return this.sub ? '(' + this.sub.length + ' elem)' : this.stream.parseOctetString(d, d + e); + case 6: + return this.stream.parseOID(d, d + e); + case 16: + case 17: + return '(' + this.sub.length + ' elem)'; + case 12: + return this.stream.parseStringUTF(d, d + e); + case 18: + case 19: + case 20: + case 21: + case 22: + case 26: + return this.stream.parseStringISO(d, d + e); + case 30: + return this.stream.parseStringBMP(d, d + e); + case 23: + case 24: + return this.stream.parseTime(d, d + e); + } + return null; + }; + b.prototype.toString = function () { + return this.typeName() + '@' + this.stream.pos + '[header:' + this.header + ',length:' + this.length + ',sub:' + (null === this.sub ? 'null' : this.sub.length) + ']'; + }; + b.prototype.print = function (c) { + c === a && (c = ''); + document.writeln(c + this); + if (null !== this.sub) { + c += ' '; + for (var b = 0, d = this.sub.length; b < d; ++b) + this.sub[b].print(c); + } + }; + b.prototype.toPrettyString = function (c) { + c === a && (c = ''); + var b = c + this.typeName() + ' @' + this.stream.pos; + 0 <= this.length && (b += '+'); + b += this.length; + this.tag & 32 ? b += ' (constructed)' : 3 != this.tag && 4 != this.tag || null === this.sub || (b += ' (encapsulates)'); + b += '\n'; + if (null !== this.sub) { + c += ' '; + for (var d = 0, e = this.sub.length; d < e; ++d) + b += this.sub[d].toPrettyString(c); + } + return b; + }; + b.prototype.toDOM = function () { + var a = d.tag('div', 'node'); + a.asn1 = this; + var c = d.tag('div', 'head'), b = this.typeName().replace(/_/g, ' '); + c.innerHTML = b; + var e = this.content(); + null !== e && (e = String(e).replace(/'; + b += 'Length: ' + this.header + '+'; + b = 0 <= this.length ? b + this.length : b + (-this.length + ' (undefined)'); + this.tag & 32 ? b += '
(constructed)' : 3 != this.tag && 4 != this.tag || null === this.sub || (b += '
(encapsulates)'); + null !== e && (b += '
Value:
' + e + '', 'object' === typeof oids && 6 == this.tag && (e = oids[e])) && (e.d && (b += '
' + e.d), e.c && (b += '
' + e.c), e.w && (b += '
(warning!)')); + f.innerHTML = b; + a.appendChild(f); + b = d.tag('div', 'sub'); + if (null !== this.sub) + for (e = 0, f = this.sub.length; e < f; ++e) + b.appendChild(this.sub[e].toDOM()); + a.appendChild(b); + c.onclick = function () { + a.className = 'node collapsed' == a.className ? 'node' : 'node collapsed'; + }; + return a; + }; + b.prototype.posStart = function () { + return this.stream.pos; + }; + b.prototype.posContent = function () { + return this.stream.pos + this.header; + }; + b.prototype.posEnd = function () { + return this.stream.pos + this.header + Math.abs(this.length); + }; + b.prototype.fakeHover = function (a) { + this.node.className += ' hover'; + a && (this.head.className += ' hover'); + }; + b.prototype.fakeOut = function (a) { + var c = / ?hover/; + this.node.className = this.node.className.replace(c, ''); + a && (this.head.className = this.head.className.replace(c, '')); + }; + b.prototype.toHexDOM_sub = function (a, c, b, e, f) { + e >= f || (c = d.tag('span', c), c.appendChild(d.text(b.hexDump(e, f))), a.appendChild(c)); + }; + b.prototype.toHexDOM = function (c) { + var b = d.tag('span', 'hex'); + c === a && (c = b); + this.head.hexNode = b; + this.head.onmouseover = function () { + this.hexNode.className = 'hexCurrent'; + }; + this.head.onmouseout = function () { + this.hexNode.className = 'hex'; + }; + b.asn1 = this; + b.onmouseover = function () { + var a = !c.selected; + a && (c.selected = this.asn1, this.className = 'hexCurrent'); + this.asn1.fakeHover(a); + }; + b.onmouseout = function () { + var a = c.selected == this.asn1; + this.asn1.fakeOut(a); + a && (c.selected = null, this.className = 'hex'); + }; + this.toHexDOM_sub(b, 'tag', this.stream, this.posStart(), this.posStart() + 1); + this.toHexDOM_sub(b, 0 <= this.length ? 'dlen' : 'ulen', this.stream, this.posStart() + 1, this.posContent()); + if (null === this.sub) + b.appendChild(d.text(this.stream.hexDump(this.posContent(), this.posEnd()))); + else if (0 < this.sub.length) { + var e = this.sub[0], f = this.sub[this.sub.length - 1]; + this.toHexDOM_sub(b, 'intro', this.stream, this.posContent(), e.posStart()); + e = 0; + for (var g = this.sub.length; e < g; ++e) + b.appendChild(this.sub[e].toHexDOM(c)); + this.toHexDOM_sub(b, 'outro', this.stream, f.posEnd(), this.posEnd()); + } + return b; + }; + b.prototype.toHexString = function (a) { + return this.stream.hexDump(this.posStart(), this.posEnd(), !0); + }; + b.decodeLength = function (a) { + var c = a.get(), b = c & 127; + if (b == c) + return b; + if (3 < b) + throw 'Length over 24 bits not supported at position ' + (a.pos - 1); + if (0 === b) + return -1; + for (var d = c = 0; d < b; ++d) + c = c << 8 | a.get(); + return c; + }; + b.hasContent = function (a, d, e) { + if (a & 32) + return !0; + if (3 > a || 4 < a) + return !1; + var f = new c(e); + 3 == a && f.get(); + if (f.get() >> 6 & 1) + return !1; + try { + var g = b.decodeLength(f); + return f.pos - e.pos + g == d; + } catch (Y) { + return !1; + } + }; + b.decode = function (a) { + a instanceof c || (a = new c(a, 0)); + var d = new c(a), e = a.get(), f = b.decodeLength(a), g = a.pos - d.pos, h = null; + if (b.hasContent(e, f, a)) { + var m = a.pos; + 3 == e && a.get(); + h = []; + if (0 <= f) { + for (var n = m + f; a.pos < n;) + h[h.length] = b.decode(a); + if (a.pos != n) + throw 'Content size is not correct for container starting at offset ' + m; + } else + try { + for (;;) { + n = b.decode(a); + if (0 === n.tag) + break; + h[h.length] = n; + } + f = m - a.pos; + } catch (W) { + throw 'Exception while decoding undefined length content: ' + W; + } + } else + a.pos += f; + return new b(d, g, f, e, h); + }; + b.test = function () { + for (var a = [ + { + value: [39], + expected: 39 + }, + { + value: [ + 129, + 201 + ], + expected: 201 + }, + { + value: [ + 131, + 254, + 220, + 186 + ], + expected: 16702650 + } + ], d = 0, e = a.length; d < e; ++d) { + var f = new c(a[d].value, 0); + f = b.decodeLength(f); + f != a[d].expected && document.write('In test[' + d + '] expected ' + a[d].expected + ' got ' + f + '\n'); + } + }; + Adform.JSEncryptHelpers.ASN1 = b; + }()); + Adform.JSEncryptHelpers.ASN1.prototype.getHexStringValue = function () { + return this.toHexString().substr(2 * this.header, 2 * this.length); + }; + G.prototype.parseKey = function (a) { + try { + var c = 0, b = 0, d = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(a) ? Adform.JSEncryptHelpers.Hex.decode(a) : Adform.JSEncryptHelpers.Base64.unarmor(a), f = Adform.JSEncryptHelpers.ASN1.decode(d); + 3 === f.sub.length && (f = f.sub[2].sub[0]); + if (9 === f.sub.length) { + c = f.sub[1].getHexStringValue(); + this.n = J(c, 16); + b = f.sub[2].getHexStringValue(); + this.e = parseInt(b, 16); + var g = f.sub[3].getHexStringValue(); + this.d = J(g, 16); + var m = f.sub[4].getHexStringValue(); + this.p = J(m, 16); + var k = f.sub[5].getHexStringValue(); + this.q = J(k, 16); + var l = f.sub[6].getHexStringValue(); + this.dmp1 = J(l, 16); + var p = f.sub[7].getHexStringValue(); + this.dmq1 = J(p, 16); + var q = f.sub[8].getHexStringValue(); + this.coeff = J(q, 16); + } else if (2 === f.sub.length) { + var r = f.sub[1].sub[0]; + c = r.sub[0].getHexStringValue(); + this.n = J(c, 16); + b = r.sub[1].getHexStringValue(); + this.e = parseInt(b, 16); + } else + return !1; + return !0; + } catch (W) { + return !1; + } + }; + G.prototype.getPrivateBaseKey = function () { + var a = { + array: [ + new KJUR.asn1.DERInteger({ 'int': 0 }), + new KJUR.asn1.DERInteger({ bigint: this.n }), + new KJUR.asn1.DERInteger({ 'int': this.e }), + new KJUR.asn1.DERInteger({ bigint: this.d }), + new KJUR.asn1.DERInteger({ bigint: this.p }), + new KJUR.asn1.DERInteger({ bigint: this.q }), + new KJUR.asn1.DERInteger({ bigint: this.dmp1 }), + new KJUR.asn1.DERInteger({ bigint: this.dmq1 }), + new KJUR.asn1.DERInteger({ bigint: this.coeff }) + ] + }; + return new KJUR.asn1.DERSequence(a).getEncodedHex(); + }; + G.prototype.getPrivateBaseKeyB64 = function () { + return P(this.getPrivateBaseKey()); + }; + G.prototype.getPublicBaseKey = function () { + var a = { + array: [ + new KJUR.asn1.DERObjectIdentifier({ oid: '1.2.840.113549.1.1.1' }), + new KJUR.asn1.DERNull() + ] + }, b = new KJUR.asn1.DERSequence(a); + a = { + array: [ + new KJUR.asn1.DERInteger({ bigint: this.n }), + new KJUR.asn1.DERInteger({ 'int': this.e }) + ] + }; + a = { hex: '00' + new KJUR.asn1.DERSequence(a).getEncodedHex() }; + a = new KJUR.asn1.DERBitString(a); + a = { + array: [ + b, + a + ] + }; + return new KJUR.asn1.DERSequence(a).getEncodedHex(); + }; + G.prototype.getPublicBaseKeyB64 = function () { + return P(this.getPublicBaseKey()); + }; + G.prototype.wordwrap = function (a, b) { + b = b || 64; + return a ? a.match(RegExp('(.{1,' + b + '})( +|$\n?)|(.{1,' + b + '})', 'g')).join('\n') : a; + }; + G.prototype.getPrivateKey = function () { + return '-----BEGIN RSA PRIVATE KEY-----\n' + (this.wordwrap(this.getPrivateBaseKeyB64()) + '\n') + '-----END RSA PRIVATE KEY-----'; + }; + G.prototype.getPublicKey = function () { + return '-----BEGIN PUBLIC KEY-----\n' + (this.wordwrap(this.getPublicBaseKeyB64()) + '\n') + '-----END PUBLIC KEY-----'; + }; + G.prototype.hasPublicKeyProperty = function (a) { + a = a || {}; + return a.hasOwnProperty('n') && a.hasOwnProperty('e'); + }; + G.prototype.hasPrivateKeyProperty = function (a) { + a = a || {}; + return a.hasOwnProperty('n') && a.hasOwnProperty('e') && a.hasOwnProperty('d') && a.hasOwnProperty('p') && a.hasOwnProperty('q') && a.hasOwnProperty('dmp1') && a.hasOwnProperty('dmq1') && a.hasOwnProperty('coeff'); + }; + G.prototype.parsePropertiesFrom = function (a) { + this.n = a.n; + this.e = a.e; + a.hasOwnProperty('d') && (this.d = a.d, this.p = a.p, this.q = a.q, this.dmp1 = a.dmp1, this.dmq1 = a.dmq1, this.coeff = a.coeff); + }; + var T = function (a) { + G.call(this); + a && ('string' === typeof a ? this.parseKey(a) : (this.hasPrivateKeyProperty(a) || this.hasPublicKeyProperty(a)) && this.parsePropertiesFrom(a)); + }; + T.prototype = new G(); + T.prototype.constructor = T; + D = function (a) { + a = a || {}; + this.default_key_size = parseInt(a.default_key_size) || 1024; + this.default_public_exponent = a.default_public_exponent || '010001'; + this.log = a.log || !1; + this.key = null; + }; + D.prototype.setKey = function (a) { + this.log && this.key && console.warn('A key was already set, overriding existing.'); + this.key = new T(a); + }; + D.prototype.setPrivateKey = function (a) { + this.setKey(a); + }; + D.prototype.setPublicKey = function (a) { + this.setKey(a); + }; + D.prototype.decrypt = function (a) { + try { + return this.getKey().decrypt(V(a)); + } catch (e) { + return !1; + } + }; + D.prototype.encrypt = function (a) { + try { + return P(this.getKey().encrypt(a)); + } catch (e) { + return !1; + } + }; + D.prototype.getKey = function (a) { + if (!this.key) { + this.key = new T(); + if (a && '[object Function]' === {}.toString.call(a)) { + this.key.generateAsync(this.default_key_size, this.default_public_exponent, a); + return; + } + this.key.generate(this.default_key_size, this.default_public_exponent); + } + return this.key; + }; + D.prototype.getPrivateKey = function () { + return this.getKey().getPrivateKey(); + }; + D.prototype.getPrivateKeyB64 = function () { + return this.getKey().getPrivateBaseKeyB64(); + }; + D.prototype.getPublicKey = function () { + return this.getKey().getPublicKey(); + }; + D.prototype.getPublicKeyB64 = function () { + return this.getKey().getPublicBaseKeyB64(); + }; + D.version = '2.3.1'; + window.Adform.JSEncrypt = D; + }()); + (function (b) { + var a = b.screen, k = b.navigator, x = b.Adform = b.Adform || {}; + if (!x.BrowserInfo) { + k = k && k.language ? k.language : k && k.browserLanguage ? k.browserLanguage : ''; + if (a) + var w = a.width + 'x' + a.height; + else if (!a && b.java) + try { + var H = b.java.awt.Toolkit.getDefaultToolkit().getScreenSize(); + w = H.width + 'x' + H.height; + } catch (A) { + } + x.BrowserInfo = { + language: k, + screenSize: w, + colorDepth: a ? a.colorDepth : '' + }; + } + }(window)); + (function (b) { + var a = b.document, k = b.location; + b.adf = b.adf || {}; + b.adf.fpc = b.adf.fpc || { + setCookie: function (b, k, H, A, C) { + var w = ''; + H && (w = new Date(), w.setTime(w.getTime() + 86400000 * H), w = '; expires=' + w.toGMTString()); + try { + a.cookie = b + '=' + k + w + '; path=/; ' + (A ? 'domain=' + A + '; ' : '') + (C ? C : ''); + } catch (l) { + } + }, + readCookie: function (b) { + b += '='; + var k = []; + try { + k = a.cookie.split(';'); + } catch (C) { + } + for (var x = 0; x < k.length; x++) { + for (var A = k[x]; ' ' == A.charAt(0);) + A = A.substring(1, A.length); + if (0 == A.indexOf(b)) + return A.substring(b.length, A.length); + } + return null; + }, + isOptedOut: function () { + return '1' == this.readCookie('adfoptout'); + }, + readCookieSafely: function (a) { + return this.isOptedOut() ? null : this.readCookie(a); + }, + setCookieSafely: function (a, b, k, A) { + this.isOptedOut() || this.setCookie(a, b, k, A); + }, + eraseCookie: function (a, b) { + b ? this.setCookie(a, '', -1, b) : this.setCookie(a, '', -1); + }, + setFPCookie: function (a, b) { + this.setCookieSafely('adfcid', a, 60, b); + }, + readFPCookie: function () { + var a = this.readCookieSafely('adfcid'); + return 'undefined' != typeof a && a ? a : 0; + }, + getQSParam: function (a, b) { + try { + var w = 'undefined' != typeof b && b ? b : k.search; + if ('undefined' == typeof w || !w) + return null; + '?' == w[0] && (w = w.substring(1)); + var A = w.split('&'); + if ('undefined' == typeof A || !A) + return null; + for (b = 0; b < A.length; b++) { + var x = A[b]; + if ('undefined' != typeof x && x) { + var z = x.split('='); + if (null != z && 1 < z.length && z[0].toLowerCase() == a) + return decodeURIComponent(z[1]); + } + } + } catch (l) { + } + return null; + }, + processFirstPartyCookie: function (a) { + var b = this.getQSParam('uid'), k = this.getQSParam('rdir'), A = this.getQSParam('domain'), x = 0, z = 0; + if (this.isOptedOut()) + x = 3; + else if (z = this.readFPCookie(), z = 'undefined' != typeof z && z ? z : b) + this.setFPCookie(z, A), x = (b = this.readFPCookie()) && b == z ? 1 : 2; + (k = 'undefined' != typeof k && k ? k.replace('{fpcid}', z).replace('{fpcon}', x) : a) && this.redirectBack(k); + }, + redirectBack: function (b) { + b && (a.location.href = b); + }, + optOutForNumberOfDays: function (a, b) { + this.setCookie('adfoptout', '1', b, a); + this.eraseCookie('adfcid', a); + }, + optOut: function (a) { + this.optOutForNumberOfDays(a, 730); + } + }; + }(window)); + (function (b) { + var a = b.Adform = b.Adform || {}; + if (!a.TrackingPixel) { + var k = b.Image, x = b.document; + a.TrackingPixel = { + imgs: [], + loadPixel: function (a) { + var b = k ? new k(1, 1) : x.createElement('img'); + b.src = a; + this.imgs.push(b); + } + }; + } + }(window)); + (function (b) { + const $___old_3364f92445646b10 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_3364f92445646b10) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_448b95a47dd49f0a.XMLHttpRequest)); + return function () { + function a() { + var a = l.Tracking.pendingRequests, d = l.getConsent(), m; + for (m in a) + a[m] && a.hasOwnProperty(m) && (new b.Image().src = w(m, d).replace('ADFtpmode=2', 'ADFtpmode=0'), delete a[m]); + } + function k(a) { + a = (a || '').split('.'); + return { + adform: 1, + adformdsp: 1, + seadform: 1, + adfnet: 1 + }[a[a.length - 2]]; + } + function x(a) { + a = a.src; + var d = F.createElement('a'); + d.href = a; + a = d.hostname; + if (k(a)) + return a; + } + function w(a, d) { + var m = [], t = b.Adform.Tracking, f = t.Gdpr = t.Gdpr || d.gdpr, g = t.GdprConsent = t.GdprConsent || d.gdpr_consent; + d = t.us_privacy = t.us_privacy || d.us_privacy || l.getUSPString(); + 1 == f ? m.push('gdpr=1') : (0 === f || '0' === f || !1 === f) && m.push('gdpr=0'); + g && g.length && m.push('gdpr_consent=' + g); + d && m.push('us_privacy=' + d); + m.length && (a += '&' + m.join('&')); + return a; + } + function H() { + var a, d, b; + (a = F.currentScript) && (b = x(a)); + if (!b) + for (a = F.getElementsByTagName('script'), d = a.length; d-- && !(0 < a[d].src.indexOf('serving/scripts/trackpoint') && (b = x(a[d])));); + return b || 'a1.adform.net'; + } + function A(a) { + try { + var d = a.location; + var m = d.href; + var f = d.protocol; + var g = d.hostname; + } catch (J) { + return ''; + } + return !{ + 'http:': 1, + 'https:': 1, + 'file:': 1 + }[f] || k(g) && a !== a.top ? a !== a.parent ? A(b.parent) : '' : m; + } + function C(a, d, b) { + a.addEventListener ? a.addEventListener(d, b, !1) : a.attachEvent && a.attachEvent('on' + d, b); + } + function z(a, d) { + if (d && d.length) + for (var b = 0; b < d.length; b++) { + var f = d[b] || {}; + var g = f.source; + f = f.uids; + if (g && f && f.length) + for (var t = 0; t < f.length; t++) + f[t] && f[t].id && a.push(encodeURIComponent('eid_' + g + '_' + (parseInt(f[t].atype, 10) || 0)) + '=' + encodeURIComponent(f[t].id)); + } + } + var l = b.Adform = b.Adform || {}, F = b.document, B = b.setTimeout, f = b.top, g = b.XMLHttpRequest, I = b.ActiveXObject; + C(b, 'beforeunload', a); + C(b, 'visibilitychange', a); + C(b, 'pagehide', a); + b.Adform.Tracking = b.Adform.Tracking || {}; + b.Adform.Tracking.Params = b.Adform.Tracking.Params || {}; + b.Adform.Tracking.Params.HttpHost = b.Adform.Tracking.Params.HttpHost || H(); + b.Adform.Tracking.Vars = b.Adform.Tracking.Vars || {}; + b.Adform.Tracking.Vars.Custom = b.Adform.Tracking.Vars.Custom || {}; + b.Adform.Tracking.Vars.toString = function () { + for (var a, d = '', m, f = 'ADF__Sale ADF__OrderID ADF__TD ADF__BasketSize ADF__Country ADF__var1 ADF__var2 ADF__var3 ADF__var4 ADF__var5 ADF__var6 ADF__var7 ADF__var8 ADF__var9 ADF__var10'.split(' '), g = 0; g < f.length; g++) + try { + a = (this[f[g].substring(5)] || b[f[g]] || '').toString(), m = -1 < a.toLowerCase().indexOf(''; + F.body.appendChild(g.removeChild(g.firstChild)); + } else + C(b, 'load', function () { + K(a, m, f); + }); + } catch (P) { + } + }, + LoadScript: function (a) { + var d = F.createElement('script'), b = F.getElementsByTagName('script')[0]; + d.type = 'text/javascript'; + d.src = a; + b.parentNode.insertBefore(d, b); + return !0; + }, + Base64: { + _keyStr: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=', + encode: function (a) { + var d = [], b = 0; + for (a = this._utf8_encode(a); b < a.length;) { + var f = a.charCodeAt(b++); + var g = a.charCodeAt(b++); + var k = a.charCodeAt(b++); + var l = f >> 2; + f = (f & 3) << 4 | g >> 4; + var I = (g & 15) << 2 | k >> 6; + var B = k & 63; + isNaN(g) ? I = B = 64 : isNaN(k) && (B = 64); + d.push(this._keyStr.charAt(l), this._keyStr.charAt(f)); + 64 != I && d.push(this._keyStr.charAt(I)); + 64 != B && d.push(this._keyStr.charAt(B)); + } + return d.join(''); + }, + _utf8_encode: function (a) { + a = a.replace(/\r\n/g, '\n'); + for (var d = '', b = 0; b < a.length; b++) { + var f = a.charCodeAt(b); + 128 > f ? d += String.fromCharCode(f) : (127 < f && 2048 > f ? d += String.fromCharCode(f >> 6 | 192) : (d += String.fromCharCode(f >> 12 | 224), d += String.fromCharCode(f >> 6 & 63 | 128)), d += String.fromCharCode(f & 63 | 128)); + } + return d; + } + }, + ClickTrack: function (a, f, g, k, l) { + 'undefined' != typeof a.href ? (this.Track(f, g, k, l, 0, 10), 'undefined' != typeof a.target && '' != a.target ? B(function () { + b.open(a.href, a.target); + }, 100) : B(function () { + b.location = a.href; + }, 100)) : 'undefined' != typeof a.type && 'submit' == a.type ? (this.Track(f, g, k, l, 0, 10), B(function () { + a.form.submit(); + }, 100)) : this.Track(f, g, k, l); + this.CleanUp(); + return !1; + }, + Container: function (a, b, f, g) { + this.Track(a, b, f, g, 'Container'); + this.CleanUp(); + }, + Track: function (a, m, g, k, I, B) { + var d = this, x = encodeURIComponent(l.BrowserInfo.language + '|' + l.BrowserInfo.language + '|' + l.BrowserInfo.screenSize + '|' + l.BrowserInfo.colorDepth), G = 'https://' + l.Tracking.Params.HttpHost, E = ''; + try { + E = f.document.referrer; + } catch (S) { + E = F.referrer; + } + var K = A(b), y = b.Adform.Tracking; + y.Params.PageName = y.Params.PageName || b.ADFPageName || ''; + y.Params.Divider = '' == y.Params.PageName ? '' : y.Params.Divider || b.ADFdivider || '|'; + y.Vars.Sale = y.Vars.Sale || b.ADF__Sale || ''; + y.Vars.OrderID = y.Vars.OrderID || b.ADF__OrderID || ''; + y.Vars.SubOrders = y.Vars.SubOrders || b.ADF__SubOrders || ''; + y.Vars.CPref = E || ''; + y.Vars.loc = K || ''; + y.AdvertiserId = y.AdvertiserId || ''; + y.ThirdPartyId = y.ThirdPartyId || ''; + var M = Math.floor(1000000000000 * Math.random()); + m = 'undefined' != typeof m && m ? m : ''; + this.IsNumber(m) || '' != y.Params.PageName || (y.Params.PageName = m, y.Params.Divider = '|', m = ''); + var p = y.Vars.toString(), q = encodeURIComponent(y.Vars.SubOrders); + p = null != p && '' != p || null != q && '' != q ? p + '@@' + q : ''; + 'undefined' != typeof g && null != g && (this.IsString(g) ? p = g + '@@' : this.CreateOrderAndProductVars(g)); + g = []; + this.PushIfNotEmpty(g, this.JoinIfNotEmpty('ADFPageName', this.CheckEscape(y.Params.PageName))); + this.PushIfNotEmpty(g, this.JoinIfNotEmpty('ADFdivider', this.CheckEscape(y.Params.Divider))); + this.PushIfNotEmpty(g, this.JoinIfNotEmpty('ADFsysvars', p)); + this.PushIfNotEmpty(g, this.JoinIfNotEmpty('ord', M)); + this.PushIfNotEmpty(g, this.JoinIfNotEmpty('Set1', x)); + this.PushIfNotEmpty(g, this.JoinAndEncodeIfNotEmpty('CPref', E)); + this.PushIfNotEmpty(g, this.JoinAndEncodeIfNotEmpty('iprodgrp', y.Vars.InterestProductGroup)); + this.PushIfNotEmpty(g, this.JoinAndEncodeIfNotEmpty('iprod', y.Vars.InterestProduct)); + this.PushIfNotEmpty(g, this.JoinAndEncodeIfNotEmpty('iprodwght', y.Vars.InterestProductWeight)); + 'undefined' != typeof k && '' != k && k ? this.PushIfNotEmpty(g, this.JoinAndEncodeIfNotEmpty('rdir', k)) : ('Container' == I ? g.push('ADFtpmode=3') : g.push('ADFtpmode=2'), this.PushIfNotEmpty(g, this.JoinAndEncodeIfNotEmpty('ADFsale', y.Vars.Sale)), this.PushIfNotEmpty(g, this.JoinAndEncodeIfNotEmpty('ADForderid', y.Vars.OrderID)), this.PushIfNotEmpty(g, this.JoinAndEncodeIfNotEmpty('ADFSubOrders', y.Vars.SubOrders))); + var r = !0, D; + for (D in y.Vars.Custom) + if (y.Vars.Custom.hasOwnProperty(D)) { + r = !1; + break; + } + try { + this.PushIfNotEmpty(g, this.JoinIf('adfcustvars', encodeURIComponent(b.Adform.JSON.stringify(y.Vars.Custom)), function () { + return !r; + })), this.PushIfNotEmpty(g, this.JoinIf('ecpr', this.Base64.encode(b.Adform.JSON.stringify(y.Products)), function () { + return 0 < y.Products.length; + })), this.PushIfNotEmpty(g, this.JoinIf('itm', this.Base64.encode(b.Adform.JSON.stringify(y.Order)), function () { + return null != y.Order; + })), this.PushIfNotEmpty(g, this.JoinAndEncodeIfNotEmpty('loc', K)), this.PushIfNotEmpty(g, this.JoinIf('msrc', '1', function () { + return 0 < y.AdvertiserId.length; + })), this.PushIfNotEmpty(g, this.JoinIf('adid', encodeURIComponent(y.AdvertiserId), function () { + return 0 < y.AdvertiserId.length; + })); + } catch (S) { + } + z(g, y.eids); + a = a ? '/Serving/TrackPoint/?pm=' + a + ('' == m ? '' : '&lid=' + m) + '&' + g.join('&') : '/Banners/Invisible.gif'; + var C = G + a; + d.pendingRequests[C] = 1; + l.waitForConsent(function (a) { + a = a || {}; + d.pendingRequests[C] && (d.LoadScript(w(C, a)), delete d.pendingRequests[C]); + }, B || 10000); + }, + JoinIf: function (a, b, g) { + return g() ? a + '=' + b : ''; + }, + JoinIfNotEmpty: function (a, b) { + return this.JoinIf(a, b, function () { + return null != b && '' != b; + }); + }, + JoinAndEncodeIfNotEmpty: function (a, b) { + return this.JoinIf(a, encodeURIComponent(b), function () { + return null != b && '' != b; + }); + }, + PushIfNotEmpty: function (a, b) { + null != b && '' != b && a.push(b); + }, + TrackClean: function (a, b, g, f) { + this.Track(a, b, g, f); + this.CleanUp(); + }, + CreateOrderAndProductVars: function (a) { + this.IsString(a) || (this.IsObject(a) && (this.Order = null, this.Products = [], this.createOrder(a), this.IsArray(a.itms) && this.AddProductsFromArray(a.itms)), this.IsArray(a) && this.AddProductsFromArray(a)); + }, + IsArray: function (a) { + return 'undefined' != typeof a && '[object Array]' == Object.prototype.toString.call(a); + }, + IsObject: function (a) { + return 'undefined' != typeof a && '[object Object]' == Object.prototype.toString.call(a); + }, + IsString: function (a) { + return 'undefined' != typeof a && '[object String]' == Object.prototype.toString.call(a); + }, + IsNumber: function (a) { + return !isNaN(parseFloat(a)) && isFinite(a); + }, + AddProductsFromArray: function (a) { + try { + for (var b = 0; b < a.length; b++) + this.addProduct(a[b]); + } catch (M) { + } + }, + CleanUp: function () { + for (var a = l.Tracking.Vars, b = 'var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 Sale OrderID SubOrders'.split(' '), g = 0; g < b.length; g++) + a[b[g]] = ''; + l.Tracking.Products = []; + l.Tracking.Order = null; + l.Tracking.Params.PageName = ''; + l.Tracking.Params.Divider = ''; + }, + appendFirstPartyId: function (a, b) { + var d = this.fpc.readCookie('adformfrpid'); + this.fpc.setCookie('adformfrpid', d || b, 30, void 0, 'secure; SameSite=Lax'); + b = this.fpc.readCookie('adformfrpid') || 0; + this.LoadScript(a + '&frpid=' + b); + }, + Post: function (a, f, k) { + if ('' != f) { + f = this.IsNumber(f) ? '&lid=' + f : '&ADFPageName=' + f + '&ADFdivider=|'; + var d = []; + try { + this.PushIfNotEmpty(d, this.JoinIf('ecpr', this.Base64.encode(b.Adform.JSON.stringify(b.Adform.Tracking.Products)), function () { + return 0 < b.Adform.Tracking.Products.length; + })), this.PushIfNotEmpty(d, this.JoinIf('itm', this.Base64.encode(b.Adform.JSON.stringify(b.Adform.Tracking.Order)), function () { + return null != b.Adform.Tracking.Order; + })); + } catch (N) { + } + var m = ''; + 0 < d.length && (m = '&' + d.join('&')); + a = 'https://' + l.Tracking.Params.HttpHost + (a ? '/Serving/TrackPoint/?pm=' + a + f + '&ADFtpmode=2' + m : '/Banners/Invisible.gif'); + try { + var B; + if ('undefined' != typeof JSON) + var w = JSON.stringify(k); + else { + w = '\'{'; + for (var x in k) + w += '"' + x + '":"' + k[x] + '",'; + w += '}\''; + } + b.XMLHttpRequest ? B = new g() : I && (B = new I('Microsoft.XMLHTTP')); + B.open('POST', a, !1); + B.setRequestHeader('Content-Type', 'application/json'); + B.send(w); + } catch (N) { + } + } + } + }; + b.Adform.Tracking.fpc = b.adf.fpc || {}; + b.Adform.Tracking.async = b.adf.async || {}; + b.adf = b.Adform.Tracking; + b.adf.track = b.Adform.Tracking.TrackClean; + b.adf.clicktrack = b.Adform.Tracking.ClickTrack; + b.adf.container = b.Adform.Tracking.Container; + b.adf.post = b.Adform.Tracking.Post; + b.adf.createItem = b.adf.createOrder; + b.adf.addSubItem = b.adf.addProduct; + }.apply(this, arguments); + } finally { + if ($___old_3364f92445646b10) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_3364f92445646b10)); + } + }(window)); + (function (b) { + b.adf = b.adf || {}; + b.adf.Params = b.adf.Params || {}; + b.adf.async = b.adf.async || {}; + b.adf.async.IsArray = function (a) { + return 'undefined' != typeof a && '[object Array]' == Object.prototype.toString.call(a); + }; + b.adf.async.IsObject = function (a) { + return 'undefined' != typeof a && '[object Object]' == Object.prototype.toString.call(a); + }; + b.adf.async.TrackOne = function (a) { + if (a && !a.isTracked) { + var k = a.pm || null, x = a.id || null, w = a.order || a.products || null, H = a.rdir || null, A = a.pagename || null, C = a.divider || null, z = a.encryptor || null, l = a.publicKey || null, F = a.adid || null, B = a.tpid || null, f = a.gdpr || null, g = a.gdpr_consent || null, I = a.HttpHost || null, t = a.us_privacy || null, d = a.eids || null; + null != k && (F && (b.adf.AdvertiserId = F), B && (b.adf.ThirdPartyId = B), z && (b.adf.Params.encryptor = z), l && (b.adf.Params.publicKey = l), f && (b.adf.Gdpr = f), g && (b.adf.GdprConsent = g), I && (b.adf.Params.HttpHost = I), t && (b.adf.us_privacy = t), d && (b.adf.eids = d), A ? (b.adf.Params.PageName = A, b.adf.Params.Divider = C, b.adf.track(k, null, w, H)) : b.adf.track(k, x, w, H), a.isTracked = !0); + } + }; + b.adf.async.track = function () { + for (var a = this.IsArray(b._adftrack) ? b._adftrack : this.IsObject(b._adftrack) ? [b._adftrack] : [], k = 0; k < a.length; k++) + this.TrackOne(a[k]); + }; + b.adf.async.track(b.adf); + }(window)); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-8c173320401d8fc5291c1ea5e26e89a50fb17a42 b/resources/sugarcoat-8c173320401d8fc5291c1ea5e26e89a50fb17a42 new file mode 100644 index 00000000..26fa4057 --- /dev/null +++ b/resources/sugarcoat-8c173320401d8fc5291c1ea5e26e89a50fb17a42 @@ -0,0 +1,483 @@ +{ + const $___mock_d0c2e2703cb522d7 = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_d0c2e2703cb522d7); + (function () { + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + var geoLocation = [ + 'au', + 'nz', + 'in', + 'sg', + 'my', + 'jp', + 'kr', + 'tw', + 'hk' + ]; + var firePixel = function (pixelID) { + var scriptUrl = pixelID + '&s1=' + encodeURIComponent(window.location.href) + '&s2=' + encodeURIComponent(document.referrer) + '&s3=' + Marketing.UDO.promoid + '&s4=&s5=' + Marketing.UDO.prodcat + '&s6=&s7=' + Marketing.UDO.ordercode + '&s8=' + encodeURIComponent(Marketing.UDO.category) + '&s9=' + encodeURIComponent(Marketing.UDO.family) + '&s10=' + Marketing.UDO.product + '&v1=' + Marketing.UDO.revenue + '&v2=' + Marketing.UDO.deals + '&v3=&v4=&v5=' + Marketing.scDataObj.country + '&v6=' + Marketing.scDataObj.language + '&v7=' + Marketing.UDO.cseg + '&v8=' + Marketing.scDataObj.segment + '&v9=' + Marketing.UDO.platform + '&v10=' + Marketing.UDO.dpid; + Marketing.insertScript('//pixel.mathtag.com/event/js?' + scriptUrl); + }; + if (Marketing.UDO.country == 'us') { + firePixel('mt_id=776221&mt_adid=129805'); + if (Marketing.scDataObj.cms == 'olr') + window.addEventListener('udoReady', function () { + firePixel('mt_id=776221&mt_adid=129805'); + }); + } + if (Marketing.UDO.country == 'in' && Marketing.scDataObj.cms != 'dellemc' && Marketing.scDataObj.cms != 'delltech') + firePixel('mt_id=769817&mt_adid=141629'); + if (geoLocation.indexOf(Marketing.UDO.country) > -1 && Marketing.scDataObj.cms != 'compuindia') { + firePixel('mt_id=1324676&mt_adid=189166&mt_exem=&mt_excl='); + if ((Marketing.UDO.country == 'au' || Marketing.UDO.country == 'sg' || Marketing.UDO.country == 'my') && Marketing.scDataObj.cms == 'olr') { + if (Marketing.UDO.promoid == '100') + firePixel('mt_id=1558422&mt_adid=189166&mt_exem=&mt_excl='); + window.addEventListener('udoReady', function () { + firePixel('mt_id=1324676&mt_adid=189166&mt_exem=&mt_excl='); + if (Marketing.UDO.promoid == '100') + firePixel('mt_id=1558422&mt_adid=189166&mt_exem=&mt_excl='); + }); + } + } + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3644298, [3606329], 630680, [610323]); + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + var marketingscDataObj = Marketing.scDataObj; + var marketingUDO = Marketing.UDO; + if (marketingscDataObj.segment == 'bsd') { + if (marketingUDO.promoid == '2') + Marketing.imageRequest('//r.turn.com/r/beacon?b2=1DPQkbMPobrPtu1E7F4a-tv6iuNNeEJauQtnGxAiqpafnoOTocNvFwEE4YgHHkvbxL4jJGyNK0ZmhCLXGy2tKw&cid='); + if (marketingscDataObj.categoryid == 'pcaas' && marketingscDataObj.page == 'campaign' || marketingscDataObj.categoryid == 'poweredge-tower-server-deals' && marketingscDataObj.page == 'deals' || (marketingscDataObj.categoryid == 'xps-laptops' || marketingscDataObj.categoryid == '8141' || marketingscDataObj.categoryid == 'optiplex-desktops' || marketingscDataObj.categoryid == 'vostro-laptops') && marketingscDataObj.page == 'productdetails') { + Marketing.imageRequest('//r.turn.com/r/beacon?b2=Heu7d2f1JunfAv4ifSfOLbqN0J45Ipb_K64KmVPycB2fnoOTocNvFwEE4YgHHkvbbwxzeCFRWt9LBz6FFIK6mQ&cid='); + Marketing.imageRequest('//r.turn.com/r/beacon?b2=OpuCTdgmwi8KEzQGFh_l6sklkCMEdtFf3LvniQRx2rCfnoOTocNvFwEE4YgHHkvb9xNDUrjF6vd8tP5T8eyWqw&cid='); + } + if (marketingscDataObj.categoryid == 'small-business-central' && marketingscDataObj.page == 'campaign') + Marketing.imageRequest('//r.turn.com/r/beacon?b2=bx92ne6J6DEc8GN2R1Mtju88gR-DBsDB7iRYGAPlxeefnoOTocNvFwEE4YgHHkvb8p4tY5MYkPEoIUEuTGjGFQ&cid='); + if (marketingscDataObj.page == 'confirmation') + Marketing.imageRequest('//r.turn.com/r/beacon?b2=4yZtKsnwzmjv5gHFq-r-tINntvUvdI1Zm-9D4clTmuCfnoOTocNvFwEE4YgHHkvb-r7cYD6noeJ-ljnFx_yWeg&cid='); + } + if (marketingscDataObj.segment == 'dhs') { + if (marketingUDO.promoid == '2') + Marketing.imageRequest('//r.turn.com/r/beacon?b2=qG-vMk7SHB3Tfb8MlqsW9pYmYKImtXkEzlZq48o3IvefnoOTocNvFwEE4YgHHkvbdFz9KIWLmIas3RnGuPuIRw&cid='); + if (marketingUDO.promoid == '4') + Marketing.imageRequest('//r.turn.com/r/beacon?b2=bbF829HEKCaFG_5LyXfAGd96P1thMezDPqzVrXhqIAOfnoOTocNvFwEE4YgHHkvb66dQNZKx69q-ZVJtSAaeRg&cid='); + if (marketingscDataObj.page == 'confirmation') + Marketing.imageRequest('//r.turn.com/r/beacon?b2=-7_opcGMxXQ7pGZ0WPtFj84PYtq--ib6DgmjqwNXcuWfnoOTocNvFwEE4YgHHkvbUN5xNEhHRZ3eG_mA_UynBw&cid=&bprice=' + marketingUDO.revenue); + } + if (marketingscDataObj.segment == 'eep') { + if (marketingUDO.promoid == '2') + Marketing.imageRequest('//r.turn.com/r/beacon?b2=1SK7hNl4JEWSH8BHhiaA1OmIF19p_a0i5NyMQpVNflqfnoOTocNvFwEE4YgHHkvbqUM3muj8MT6r7V_-tW1YNw&cid='); + if (marketingUDO.promoid == '4') + Marketing.imageRequest('//r.turn.com/r/beacon?b2=AMHpT6tWQ6AlJ5GQarjy9MW1w2Dh3zCXJGeQHCj-_OmfnoOTocNvFwEE4YgHHkvbeK1aKZ1yZifwlT0w7cUnWw&cid='); + if (marketingscDataObj.page == 'confirmation') + Marketing.imageRequest('//r.turn.com/r/beacon?b2=gM9M5d2LbChqrgEmJP8od3YWKz-yjenm5KVJfjZV8IOfnoOTocNvFwEE4YgHHkvbjvlj_BaBM4VjxPJH6-aGzw&cid=&bprice=' + marketingUDO.revenue); + } + if (marketingscDataObj.categoryid.includes('game') || marketingscDataObj.categoryid.includes('gaming') || marketingscDataObj.categoryid.includes('g-series') || marketingscDataObj.page.includes('alienware') || marketingscDataObj.categoryid.includes('alienware') || window.location.href.includes('gaming')) { + if (marketingUDO.promoid == '2' || marketingUDO.promoid == '3' || marketingUDO.promoid == '13') + Marketing.imageRequest('//r.turn.com/r/beacon?b2=5Z9oReu5eUFDdjlbzEt2B6vcF6D_mAyI5hGDbe3M_oSfnoOTocNvFwEE4YgHHkvbHzBmyIBMMoj8Vg-q4wtVhA&cid='); + if (marketingUDO.category.includes('deals')) + Marketing.imageRequest('//r.turn.com/r/beacon?b2=9CbfyviWCMkhJiFZhC26kicHJ9r29cGoCkhrUUby5YmfnoOTocNvFwEE4YgHHkvb1wBIHgmLTuc0P0v0xrE-Sw&cid='); + if (marketingscDataObj.page == 'confirmation') + Marketing.imageRequest('//r.turn.com/r/beacon?b2=kTrBKobVZxWcadalx8ATUfts_cRYDAQapDEM5JtSRKufnoOTocNvFwEE4YgHHkvbvdOJI7yM8nNm1jyO41XBdg&cid=&bprice=' + marketingUDO.revenue); + } + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3600273, [3606329], 631928, [610323]); + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + var marketingscDataObj = Marketing.scDataObj; + var marketingUDO = Marketing.UDO; + var pix_id = '', type = ''; + var siteUrl = window.location.origin + window.location.pathname; + if (marketingUDO.segment == 'bsd') { + if (marketingUDO.promoid == '9') { + pix_id = '6746c68c-de6e-a200-8bf1-966b4678c2c4'; + type = '10'; + } + if (marketingUDO.promoid == '3') { + pix_id = '7173bde5-b3f6-a515-042f-8ec0e3849d79'; + type = '4'; + } + if (marketingUDO.promoid == '7' && marketingscDataObj.module.includes('configurator')) { + pix_id = '98f00cdb-2465-6795-5522-8cb8cff9eda1'; + type = '4'; + } + if (marketingUDO.promoid == '4') { + pix_id = '8aa379a1-eb57-ff9c-14a3-f80f73286f5e'; + type = '4'; + } + if (marketingUDO.promoid == '5') { + pix_id = '1e9dde17-e149-bb51-dbf2-3d45f3dd465f'; + type = '4'; + } + if (marketingUDO.promoid == '2') { + pix_id = '75255aed-d1a8-0486-12a7-150fbe34d0af'; + type = '55'; + } + if (marketingUDO.promoid == '7' && marketingscDataObj.module.includes('productdetail')) { + pix_id = '543f7a78-a0a5-afd8-58f9-39e87d6e69fa'; + type = '54'; + } + } + if (marketingUDO.segment == 'eep') { + if (marketingUDO.promoid == '9') { + pix_id = '5a78c63c-5286-70e1-6abf-a027bb3dc3c2'; + type = '10'; + } + if (marketingUDO.promoid == '3') { + pix_id = '171ab4f6-0184-be75-7e9c-845fedf10e7b'; + type = '4'; + } + if (marketingUDO.promoid == '7' && marketingscDataObj.module.includes('configurator')) { + pix_id = '98ec6eb0-3e30-adea-c70d-fda51efdf817'; + type = '4'; + } + if (marketingUDO.promoid == '4') { + pix_id = 'c373b38d-f4b6-e519-130f-90be08bd134c'; + type = '4'; + } + if (marketingUDO.promoid == '5') { + pix_id = '0b63d287-09c7-c9b8-85cf-4c91d87764e9'; + type = '4'; + } + if (marketingUDO.promoid == '2') { + pix_id = 'c6ee3706-ab08-bcb2-6130-75f1d0c4b157'; + type = '55'; + } + if (marketingUDO.promoid == '7' && marketingscDataObj.module.includes('productdetail')) { + pix_id = '8f197917-c26d-7566-fa90-571aff48fbed'; + type = '54'; + } + } + if (marketingUDO.segment == 'dhs') { + if (marketingUDO.promoid == '9') { + pix_id = 'afce6942-d624-1702-c3a3-b5d39fba1ca3'; + type = '10'; + } + if (marketingUDO.promoid == '3') { + pix_id = '160046f7-7a25-6e01-13a5-2ccb590660d4'; + type = '4'; + } + if (marketingUDO.promoid == '7' && marketingscDataObj.module.includes('configurator')) { + pix_id = '4564ecea-ad3c-3e54-ecf3-ae8714ac9b37'; + type = '4'; + } + if (marketingUDO.promoid == '4') { + pix_id = 'b9f7a35b-78b9-5887-ff13-9da4be228d79'; + type = '4'; + } + if (marketingUDO.promoid == '5') { + pix_id = '1f03a7de-e6f3-7747-094b-091af4790062'; + type = '4'; + } + if (marketingUDO.promoid == '2') { + pix_id = 'a45f6ef5-fb81-c0fa-0cd0-489f1afb3072'; + type = '55'; + } + if (marketingUDO.promoid == '7' && marketingscDataObj.module.includes('productdetail')) { + pix_id = 'af142662-30a7-51a8-208f-76eabbf3e29c'; + type = '54'; + } + } + if (marketingUDO.category.includes('alienware') || siteUrl.includes('alienwarearena.com')) { + if (marketingUDO.promoid == '9') { + pix_id = '08c2d6df-21cf-0f9c-18f2-8d5907a457b1'; + type = '10'; + } + if (marketingUDO.promoid == '3') { + pix_id = 'fca8c8e1-129c-8094-cff2-ce11fedc81ac'; + type = '4'; + } + if (marketingUDO.promoid == '7' && marketingscDataObj.module.includes('configurator')) { + pix_id = '0a0aa3bd-8625-45c8-0d6b-2e890aa6b0ee'; + type = '4'; + } + if (marketingUDO.promoid == '4') { + pix_id = '3d61efdc-625a-2f40-c1bd-251cab2879cd'; + type = '4'; + } + if (marketingUDO.promoid == '2') { + pix_id = '4e028564-7a2b-9adc-70a9-06b40e14e124'; + type = '55'; + } + if (marketingUDO.promoid == '7' && marketingscDataObj.module.includes('productdetail')) { + pix_id = '03596ace-43bd-b1ae-2f81-263ab41c1486'; + type = '54'; + } + if (marketingUDO.promoid == '1' || siteUrl.includes('alienwarearena.com')) { + pix_id = '11750a8a-6580-fd5f-28c1-9af61bc43188'; + type = '4'; + } + } + if (marketingUDO.category.includes('gam')) { + if (marketingUDO.promoid == '9') { + pix_id = 'de2efbf5-87ed-e8b4-921f-50542f32c780'; + type = '10'; + } + if (marketingUDO.promoid == '13') { + pix_id = '24e02bdc-db12-54b7-f520-f1c0c9d661fb'; + type = '4'; + } + if (marketingUDO.promoid == '7' && marketingscDataObj.module.includes('configurator')) { + pix_id = 'd2d0c3cc-1625-dcdf-5875-54413fd5c0af'; + type = '4'; + } + if (marketingUDO.promoid == '4') { + pix_id = 'd588329f-5c99-5212-58b0-5b6af0a5af6b'; + type = '4'; + } + if (marketingUDO.promoid == '2') { + pix_id = 'eb6530e5-53c9-84e1-b718-609bd7b56c29'; + type = '55'; + } + if (marketingUDO.promoid == '7' && marketingscDataObj.module.includes('productdetail')) { + pix_id = '608577c2-688f-2da9-8645-10a3b209b624'; + type = '54'; + } + } + if (pix_id && type) { + var _pix = document.getElementById('_pix_id_' + pix_id); + if (!_pix) + Marketing.imageRequest('//s.amazon-adsystem.com/iui3?d=forester-did&ex-fargs=%3Fid%3D' + pix_id + '%26type%3D' + type + '%26m%3D1&ex-fch=416613&ex-src=' + siteUrl + '&ex-hargs=v%3D1.0%3Bc%3D5267592560401%3Bp%3D' + pix_id.toUpperCase()); + } + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3600264, [3606329], 662728, [610323]); + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + var firePixel = function () { + const $___old_33327354093f0dab = {}.constructor.getOwnPropertyDescriptor(window, 'sessionStorage'); + try { + if ($___old_33327354093f0dab) + ({}.constructor.defineProperty(window, 'sessionStorage', $___mock_d0c2e2703cb522d7.sessionStorage)); + return function () { + var udo = Marketing.UDO; + var cachebuster = Math.random() * 1000000; + if (Marketing.UDO.promoid == '100' || location.href.includes('thankyou')) + Marketing.imageRequest('//t.myvisualiq.net/activity_pixel?pt=i&et=a&r=' + cachebuster + '&ago=212&ao=1018&px=1129&ord=' + udo.dpid + '&revenue=' + udo.revenue + '&u1=' + udo.ogid + '&u2=' + udo.dpid + '&othercookie_id=' + udo.mcmid); + else + Marketing.insertScript('//vt.myvisualiq.net/2/4OjfMMv3zSMk2KODUE8leQ%3D%3D/vt-335.js'); + var hvePixel = '//t.myvisualiq.net/activity_pixel?pt=i&et=a&r=' + cachebuster + '&ago=212&ao=1018&px=1130&ord=' + udo.dpid + '&revenue=' + udo.revenue + '&u1=' + udo.gacd + '&othercookie_id=' + udo.mcmid; + udo.hve_bcove(hvePixel); + udo.hve_chat(hvePixel); + udo.hve_contactUs(hvePixel); + udo.hve_download(hvePixel); + udo.hve_mpv(hvePixel); + udo.hve_rfq_submit(hvePixel); + udo.hve_social(hvePixel); + udo.hve_ytube(hvePixel); + }.apply(this, arguments); + } finally { + if ($___old_33327354093f0dab) + ({}.constructor.defineProperty(window, 'sessionStorage', $___old_33327354093f0dab)); + } + }; + firePixel(); + if (Marketing.scDataObj.cms == 'olr') + window.addEventListener('udoReady', function () { + firePixel(); + }); + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3644309, [3606329], 683751, [610323]); + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + if (Marketing.UDO.promoid !== '100') { + window.a9 = {}; + a9.eventType = 'visitor'; + a9.segmentNumber = '0'; + a9.segmentName = 'Site Visitor'; + if (/alienware/i.test(Marketing.UDO.category || Marketing.UDO.family || Marketing.UDO.product)) { + a9.clientName = 'Dell%20Alienware'; + a9.clientID = '793863'; + } else if (Marketing.UDO.segment == 'dhs') { + a9.clientName = 'Dell%20Consumer'; + a9.clientID = '793873'; + } + if (JSON.stringify(a9) !== '{}' && a9.clientName && a9.clientID && a9.eventType && a9.segmentNumber && a9.segmentName) + Marketing.insertScript('//a.tribalfusion.com/pixel/tags/' + a9.clientName + '/' + a9.clientID + '/pixel.js'); + } + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3582474, [3606329], 692718, [610323]); + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + var marketingUDO = Marketing.UDO; + var marketingscDataObj = Marketing.scDataObj; + (function (w, d, t, r, u) { + w[u] = w[u] || []; + w[u].push({ + 'projectId': '10000', + 'properties': { 'pixelId': '10094623' } + }); + var s = d.createElement(t); + s.src = r; + s.async = true; + s.onload = s.onreadystatechange = function () { + var y, rs = this.readyState, c = w[u]; + if (rs && rs != 'complete' && rs != 'loaded') + return; + try { + y = YAHOO.ywa.I13N.fireBeacon; + w[u] = []; + w[u].push = function (p) { + y([p]); + }; + y(c); + } catch (e) { + } + }; + var scr = d.getElementsByTagName(t)[0], par = scr.parentNode; + if (Marketing.scDataObj.page != 'confirmation' || Marketing.scDataObj.page == 'confirmation') + par.insertBefore(s, scr); + }(window, document, 'script', 'https://s.yimg.com/wi/ytc.js', 'dotq')); + window.dotq = window.dotq || []; + var ecValue = '', qstringParam = {}; + if (marketingscDataObj.categoryid.includes('gam') || marketingscDataObj.categoryid.includes('g-series') || marketingscDataObj.page.includes('alienware') || marketingscDataObj.categoryid.includes('alienware')) + ecValue = marketingUDO.promoid == '100' ? 'gaming' : 'gam'; + else if (marketingUDO.segment == 'dhs') + ecValue = marketingUDO.promoid == '100' ? 'consumerconversion' : 'con'; + else if (marketingUDO.segment == 'bsd') + ecValue = marketingUDO.promoid == '100' ? 'purchase' : 'sbrtg'; + else if (marketingUDO.segment == 'eep') + ecValue = marketingUDO.promoid == '100' ? 'mppconversion' : 'member'; + if (marketingUDO.promoid == '100') + if (marketingUDO.segment == 'dhs' || marketingUDO.segment == 'bsd') + qstringParam = { + 'et': 'custom', + 'ec': ecValue, + 'ea': 'Purchase', + 'product_id': marketingUDO.ordercode, + 'gv': marketingUDO.revenue + }; + else + qstringParam = { + 'et': 'custom', + 'ec': ecValue, + 'gv': marketingUDO.revenue + }; + else + qstringParam = { + 'et': 'custom', + 'ec': ecValue + }; + if (marketingUDO.promoid == '7') + if (marketingUDO.segment == 'dhs' || marketingUDO.segment == 'bsd') + qstringParam = { + 'et': 'custom', + 'ea': 'ViewProduct', + 'product_id': marketingUDO.ordercode, + 'ec': ecValue + }; + if (marketingUDO.promoid == '9') + if (marketingUDO.segment == 'dhs' || marketingUDO.segment == 'bsd') + qstringParam = { + 'et': 'custom', + 'ea': 'AddToCart', + 'product_id': marketingUDO.ordercode, + 'ec': ecValue + }; + if (ecValue !== '') + window.dotq.push({ + 'projectId': '10000', + 'properties': { + 'pixelId': '10094623', + 'qstrings': qstringParam + } + }); + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3593300, [3606329], 632317, [610323]); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-8db49593133758f7fe84678381f329915b2ccbe3 b/resources/sugarcoat-8db49593133758f7fe84678381f329915b2ccbe3 new file mode 100644 index 00000000..220ea0d3 --- /dev/null +++ b/resources/sugarcoat-8db49593133758f7fe84678381f329915b2ccbe3 @@ -0,0 +1,135 @@ +{ + const $___mock_60c190b43186521b = {}; + (exports => { + 'use strict'; + const fetch = async (resource, init = null) => { + throw new TypeError('Failed to fetch'); + }; + exports.fetch = { + configurable: true, + enumerable: true, + value: fetch, + writable: true + }; + })($___mock_60c190b43186521b); + const $___mock_d0c2e2703cb522d7 = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_d0c2e2703cb522d7); + (function () { + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + var firePixel = function () { + if (Marketing.UDO.promoid !== '100' && !location.href.includes('thankyou')) + Marketing.loadScriptCallback('https://ats.rlcdn.com/ats.js', function () { + const $___old_37888949c8184dc1 = {}.constructor.getOwnPropertyDescriptor(window, 'fetch'), $___old_2b40fcc81096caad = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_37888949c8184dc1) + ({}.constructor.defineProperty(window, 'fetch', $___mock_60c190b43186521b.fetch)); + if ($___old_2b40fcc81096caad) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_d0c2e2703cb522d7.localStorage)); + return function () { + window.ats.start({ + 'placementID': '13442', + 'storageType': 'localStorage', + 'detectionType': 'scrapeAndUrl', + 'urlParameter': 'env', + 'emailHashes': [Marketing.UDO.emailhash], + 'logging': 'error' + }); + var domainMap = location.host.includes('delltechnologies') ? 'delltechnologies.com' : 'dell.com'; + var promoidMap = { + 1: 'main_homepage', + 2: 'seg_homepage', + 3: 'productcategory', + 4: 'deals', + 5: 'family', + 6: 'features', + 7: 'productdetails', + 8: 'configurator', + 9: 'cart' + }; + var pageName = promoidMap[Marketing.UDO.promoid] ? promoidMap[Marketing.UDO.promoid] : domainMap.includes('dell.com') ? 'dell_page' : 'delltech_page'; + var envelopValue = localStorage.getItem('_lr_env') ? JSON.parse(atob(localStorage.getItem('_lr_env'))).envelope : ''; + var pdataMap = 'country=' + Marketing.UDO.country + ',language=' + Marketing.UDO.language + ',segment=' + Marketing.UDO.segment + ',domain=' + domainMap + ',page=' + pageName; + Marketing.imageRequest('//t.rlcdn.com/api/segment?pid=711394&it=19&iv=' + envelopValue + '&pdata=' + encodeURIComponent(pdataMap)); + }.apply(this, arguments); + } finally { + if ($___old_37888949c8184dc1) + ({}.constructor.defineProperty(window, 'fetch', $___old_37888949c8184dc1)); + if ($___old_2b40fcc81096caad) + ({}.constructor.defineProperty(window, 'localStorage', $___old_2b40fcc81096caad)); + } + }); + }; + firePixel(); + if (Marketing.scDataObj.cms == 'olr') + window.addEventListener('udoReady', function (e) { + firePixel(); + }); + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3593291, [3606329], 687149, [610323]); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-972e8be011822bca0cb25ecca1f34fd347ca4875 b/resources/sugarcoat-972e8be011822bca0cb25ecca1f34fd347ca4875 new file mode 100644 index 00000000..dc8d3417 --- /dev/null +++ b/resources/sugarcoat-972e8be011822bca0cb25ecca1f34fd347ca4875 @@ -0,0 +1,19624 @@ +{ + const $___mock_5c55ea952df43cbe = {}; + (exports => { + 'use strict'; + const fetch = async (resource, init = null) => { + throw new TypeError('Failed to fetch'); + }; + exports.fetch = { + configurable: true, + enumerable: true, + value: fetch, + writable: true + }; + })($___mock_5c55ea952df43cbe); + const $___mock_5951fd968a9e489b = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_5951fd968a9e489b); + const $___mock_00465284004d4aa8 = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_00465284004d4aa8); + (function () { + (function (_) { + var p, ba, fa, ha, ia, ma, oa, qa, na, ra, sa, ta, ua, va, ya, za, Aa, Ba, Ca, Da, Fa, Ea, Ga, Ha, Ia, Ka, Na, Qa, Ra, Sa, Va, Ya, Za, $a, ab, bb, cb, eb, gb, ob, rb, vb, yb, Ab, Bb, Fb, Hb, Jb, Ib, Kb, Nb, Pb, Qb, Tb, Vb, Yb, Zb, dc, fc, A, hc, kc, mc, nc, oc, pc, qc, rc, sc, tc, uc, wc, yc, Ec, Kc, Mc, Tc, Zc, bd, td, zd, Bd, Dd, Fd, Id, Jd, Kd, Md, Ld, Qd, Sd, Td, Ud, Vd, Xd, Yd, $d, ae, be, ce, ee, ke, me, ne, oe, qe, De, Pe, Se, Te, Ue, Ve, Xe, We, $e, gf, K, pf, rf, Mf, Pf, Rf, Vf, Xf, Zf, $f, bg, cg, dg, gg, jg, lg, og, pg, sg, xg, yg, zg, Ag, qg, Bg, Eg, Fg, Gg, rg, Kg, Lg, Ng, Pg, Sg, Ug, Vg, Wg, Zg, ih, jh, mh, nh, ph, rh, sh, uh, qh, xh, zh, Ah, Ih, Kh, Sh, Th, Mh, Wh, Zh, ai, gi, hi, ki, li, mi, pi, qi, ri, ui, vi, xi, yi, Ai, zi, Ci, Bi, Di, Ni, Pi, Si, bj, cj, dj, ej, jj, kj, mj, nj, oj, pj, qj, rj, sj, jk, ok, pk, uk, Dk, Ek, Gk, Lk, Mk, Nk, Pk, Qk, Sk, Uk, Vk, Yk, Xk, dl, el, fl, hl, kl, nl, ol, pl, ql, rl, sl, tl, ul, xl, vl, wl, yl, Al, El, Gl, Hl, Kl, Ml, pa, Ol, Ql, Rl, $l, dm, gm, hm, om, rm, L, sm, tm, um, vm, wm, v, xm, ym, zm, P, Am, Bm, Cm, Dm, Hm, Im, Jm, Xm, ah, la, Ym, Zm, $m, an, xd; + ba = function (a, b) { + a: { + for (var c = a.length, d = 'string' === typeof a ? a.split('') : a, e = 0; e < c; e++) + if (e in d && b.call(void 0, d[e], e, a)) { + b = e; + break a; + } + b = -1; + } + return 0 > b ? null : 'string' === typeof a ? a.charAt(b) : a[b]; + }; + fa = function (a, b) { + b = _.da(a, b); + var c; + (c = 0 <= b) && Array.prototype.splice.call(a, b, 1); + return c; + }; + ha = function (a) { + var b = a.length; + if (0 < b) { + for (var c = Array(b), d = 0; d < b; d++) + c[d] = a[d]; + return c; + } + return []; + }; + ia = function (a, b, c) { + return 2 >= arguments.length ? Array.prototype.slice.call(a, b) : Array.prototype.slice.call(a, b, c); + }; + ma = function (a) { + for (var b = 0, c = 0, d = {}; c < a.length;) { + var e = a[c++], f = _.ja(e) ? 'o' + la(e) : (typeof e).charAt(0) + e; + Object.prototype.hasOwnProperty.call(d, f) || (d[f] = !0, a[b++] = e); + } + a.length = b; + }; + oa = function (a, b) { + a.sort(b || na); + }; + qa = function (a) { + for (var b = pa, c = Array(a.length), d = 0; d < a.length; d++) + c[d] = { + index: d, + value: a[d] + }; + var e = b || na; + oa(c, function (f, g) { + return e(f.value, g.value) || f.index - g.index; + }); + for (b = 0; b < a.length; b++) + a[b] = c[b].value; + }; + na = function (a, b) { + return a > b ? 1 : a < b ? -1 : 0; + }; + ra = function (a, b) { + return a === b; + }; + sa = function (a, b) { + for (var c = {}, d = 0; d < a.length; d++) { + var e = a[d], f = b.call(void 0, e, d, a); + void 0 !== f && (c[f] || (c[f] = [])).push(e); + } + return c; + }; + ta = function (a) { + for (var b = [], c = 0; c < arguments.length; c++) { + var d = arguments[c]; + if (Array.isArray(d)) + for (var e = 0; e < d.length; e += 8192) + for (var f = ta.apply(null, ia(d, e, e + 8192)), g = 0; g < f.length; g++) + b.push(f[g]); + else + b.push(d); + } + return b; + }; + ua = function (a, b) { + for (var c in a) + b.call(void 0, a[c], c, a); + }; + va = function (a, b) { + for (var c in a) + if (b.call(void 0, a[c], c, a)) + return c; + }; + ya = function (a, b) { + for (var c, d, e = 1; e < arguments.length; e++) { + d = arguments[e]; + for (c in d) + a[c] = d[c]; + for (var f = 0; f < wa.length; f++) + c = wa[f], Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c]); + } + }; + za = function () { + var a = _.r.navigator; + return a && (a = a.userAgent) ? a : ''; + }; + Aa = function (a) { + return -1 != za().indexOf(a); + }; + Ba = function (a) { + for (var b = RegExp('([A-Z][\\w ]+)/([^\\s]+)\\s*(?:\\((.*?)\\))?', 'g'), c = [], d; d = b.exec(a);) + c.push([ + d[1], + d[2], + d[3] || void 0 + ]); + return c; + }; + Ca = function () { + return Aa('Trident') || Aa('MSIE'); + }; + Da = function () { + return Aa('Firefox') || Aa('FxiOS'); + }; + Fa = function () { + return Aa('Safari') && !(Ea() || Aa('Coast') || Aa('Opera') || Aa('Edge') || Aa('Edg/') || Aa('OPR') || Da() || Aa('Silk') || Aa('Android')); + }; + Ea = function () { + return (Aa('Chrome') || Aa('CriOS')) && !Aa('Edge') || Aa('Silk'); + }; + Ga = function (a) { + var b = {}; + a.forEach(function (c) { + b[c[0]] = c[1]; + }); + return function (c) { + return b[_.t(c, 'find').call(c, function (d) { + return d in b; + })] || ''; + }; + }; + Ha = function () { + var a = za(); + if (Ca()) { + var b = /rv: *([\d\.]*)/.exec(a); + if (b && b[1]) + a = b[1]; + else { + b = ''; + var c = /MSIE +([\d\.]+)/.exec(a); + if (c && c[1]) + if (a = /Trident\/(\d.\d)/.exec(a), '7.0' == c[1]) + if (a && a[1]) + switch (a[1]) { + case '4.0': + b = '8.0'; + break; + case '5.0': + b = '9.0'; + break; + case '6.0': + b = '10.0'; + break; + case '7.0': + b = '11.0'; + } + else + b = '7.0'; + else + b = c[1]; + a = b; + } + return a; + } + a = Ba(a); + b = Ga(a); + return Aa('Opera') ? b([ + 'Version', + 'Opera' + ]) : Aa('Edge') ? b(['Edge']) : Aa('Edg/') ? b(['Edg']) : Aa('Silk') ? b(['Silk']) : Ea() ? b([ + 'Chrome', + 'CriOS', + 'HeadlessChrome' + ]) : (a = a[2]) && a[1] || ''; + }; + Ia = function () { + var a = 'undefined' !== typeof window ? window.trustedTypes : void 0; + return null !== a && void 0 !== a ? a : null; + }; + Ka = function () { + var a, b; + if (void 0 === Ja) + try { + Ja = null !== (b = null === (a = Ia()) || void 0 === a ? void 0 : a.createPolicy('google#safe', { + createHTML: function (c) { + return c; + }, + createScript: function (c) { + return c; + }, + createScriptURL: function (c) { + return c; + } + })) && void 0 !== b ? b : null; + } catch (c) { + Ja = null; + } + return Ja; + }; + Na = function (a) { + var b, c = null === (b = Ka()) || void 0 === b ? void 0 : b.createHTML(a); + return new La(null !== c && void 0 !== c ? c : a, _.Ma); + }; + Qa = function (a) { + var b, c = null === (b = Ka()) || void 0 === b ? void 0 : b.createScriptURL(a); + return new Oa(null !== c && void 0 !== c ? c : a, _.Ma); + }; + Ra = function (a) { + if (a instanceof Oa) + return a.j; + throw Error(''); + }; + Sa = function (a) { + var b; + a = Ra(a); + return (null === (b = Ia()) || void 0 === b ? 0 : b.isScriptURL(a)) ? TrustedScriptURL.prototype.toString.apply(a) : a; + }; + Va = function (a) { + if (a instanceof Ta) + if (a instanceof La) + a = a.j; + else + throw Error(''); + else + a = Ua(a); + return a; + }; + Ya = function (a) { + return a instanceof Wa ? Ra(a) : Xa(a); + }; + Za = function (a) { + return a instanceof Wa ? Ra(a).toString() : Xa(a).toString(); + }; + $a = function (a, b) { + if (null !== a && void 0 !== a.tagName) { + if ('script' === a.tagName.toLowerCase()) + throw Error('Use setTextContent with a SafeScript.'); + if ('style' === a.tagName.toLowerCase()) + throw Error('Use setTextContent with a SafeStyleSheet.'); + } + a.innerHTML = Va(b); + }; + ab = function (a) { + var b, c = (a.ownerDocument && a.ownerDocument.defaultView || window).document, d = null === (b = c.querySelector) || void 0 === b ? void 0 : b.call(c, 'script[nonce]'); + (b = d ? d.nonce || d.getAttribute('nonce') || '' : '') && a.setAttribute('nonce', b); + }; + bb = function (a, b) { + a.src = Ya(b); + ab(a); + }; + cb = function (a, b) { + const $___old_72118f54a19037cd = {}.constructor.getOwnPropertyDescriptor(window, 'fetch'); + try { + if ($___old_72118f54a19037cd) + ({}.constructor.defineProperty(window, 'fetch', $___mock_5c55ea952df43cbe.fetch)); + return function () { + a.write(Va(b)); + }.apply(this, arguments); + } finally { + if ($___old_72118f54a19037cd) + ({}.constructor.defineProperty(window, 'fetch', $___old_72118f54a19037cd)); + } + }; + eb = function (a) { + return a ? a.passive && db() ? a : a.capture || !1 : !1; + }; + gb = function (a) { + var b = window, c = !0; + c = void 0 === c ? !1 : c; + new v.Promise(function (d, e) { + function f() { + var h; + g.onload = null; + g.onerror = null; + null === (h = g.parentElement) || void 0 === h ? void 0 : h.removeChild(g); + } + var g = b.document.createElement('script'); + g.onload = function () { + f(); + d(); + }; + g.onerror = function () { + f(); + e(void 0); + }; + g.type = 'text/javascript'; + bb(g, a); + c && 'complete' !== b.document.readyState ? _.fb(b, 'load', function () { + b.document.body.appendChild(g); + }) : b.document.body.appendChild(g); + }); + }; + ob = function (a) { + var b, c, d, e, f, g; + return ib(function (h) { + switch (h.j) { + case 1: + return b = 'https://pagead2.googlesyndication.com/getconfig/sodar?sv=200&tid=' + a.j + ('&tv=' + a.m + '&st=') + a.ab, c = void 0, h.F = 2, jb(h, kb(b), 4); + case 4: + c = h.m; + lb(h, 3); + break; + case 2: + mb(h); + case 3: + if (!c) + return h.return(void 0); + d = a.rb || c.sodar_query_id; + e = void 0 !== c.rc_enable && a.F ? c.rc_enable : 'n'; + f = void 0 === c.bg_snapshot_delay_ms ? '0' : c.bg_snapshot_delay_ms; + g = void 0 === c.is_gen_204 ? '1' : c.is_gen_204; + return d && c.bg_hash_basename && c.bg_binary ? h.return({ + context: a.A, + nd: c.bg_hash_basename, + md: c.bg_binary, + Ud: a.j + '_' + a.m, + rb: d, + ab: a.ab, + Ib: e, + Sb: f, + Hb: g + }) : h.return(void 0); + } + }); + }; + rb = function (a) { + var b; + return ib(function (c) { + if (1 == c.j) + return jb(c, ob(a), 2); + if (b = c.m) { + var d = 'sodar2'; + d = void 0 === d ? 'sodar2' : d; + var e = window, f = e.GoogleGcLKhOms; + f && 'function' === typeof f.push || (f = e.GoogleGcLKhOms = []); + var g = {}; + f.push((g._ctx_ = b.context, g._bgv_ = b.nd, g._bgp_ = b.md, g._li_ = b.Ud, g._jk_ = b.rb, g._st_ = b.ab, g._rc_ = b.Ib, g._dl_ = b.Sb, g._g2_ = b.Hb, g)); + if (f = e.GoogleDX5YKUSk) + e.GoogleDX5YKUSk = void 0, f[1](); + d = pb(qb, { basename: d }); + gb(d); + } + return c.return(b); + }); + }; + vb = function (a) { + if (sb) + a = (ub || (ub = new TextEncoder())).encode(a); + else { + var b = void 0; + b = void 0 === b ? !1 : b; + for (var c = 0, d = new Uint8Array(3 * a.length), e = 0; e < a.length; e++) { + var f = a.charCodeAt(e); + if (128 > f) + d[c++] = f; + else { + if (2048 > f) + d[c++] = f >> 6 | 192; + else { + if (55296 <= f && 57343 >= f) { + if (56319 >= f && e < a.length) { + var g = a.charCodeAt(++e); + if (56320 <= g && 57343 >= g) { + f = 1024 * (f - 55296) + g - 56320 + 65536; + d[c++] = f >> 18 | 240; + d[c++] = f >> 12 & 63 | 128; + d[c++] = f >> 6 & 63 | 128; + d[c++] = f & 63 | 128; + continue; + } else + e--; + } + if (b) + throw Error('Found an unpaired surrogate'); + f = 65533; + } + d[c++] = f >> 12 | 224; + d[c++] = f >> 6 & 63 | 128; + } + d[c++] = f & 63 | 128; + } + } + a = d.subarray(0, c); + } + return a; + }; + yb = function (a) { + var b = 0 > a; + a = Math.abs(a); + var c = a >>> 0; + a = Math.floor((a - c) / 4294967296); + a >>>= 0; + b && (a = ~a >>> 0, c = (~c >>> 0) + 1, 4294967295 < c && (c = 0, a++, 4294967295 < a && (a = 0))); + wb = c; + xb = a; + }; + Ab = function (a) { + Object.isFrozen(a) || (zb ? a[zb] |= 1 : void 0 !== a.Gb ? a.Gb |= 1 : Object.defineProperties(a, { + Gb: { + value: 1, + configurable: !0, + writable: !0, + enumerable: !1 + } + })); + return a; + }; + Bb = function (a) { + return null !== a && 'object' === typeof a && !Array.isArray(a) && a.constructor === Object; + }; + Fb = function (a) { + a = null == a || 'string' === typeof a ? a : Cb && a instanceof Uint8Array ? Eb(a) : null; + return a; + }; + Hb = function (a) { + switch (typeof a) { + case 'number': + return isFinite(a) ? a : String(a); + case 'object': + if (a && !Array.isArray(a)) { + if (Cb && null != a && a instanceof Uint8Array) + return Eb(a); + if (a instanceof Gb) + return a.Oa(); + } + } + return a; + }; + Jb = function (a, b) { + if (null != a) + return Array.isArray(a) || Bb(a) ? Ib(a, b) : b(a); + }; + Ib = function (a, b) { + if (Array.isArray(a)) { + for (var c = Array(a.length), d = 0; d < a.length; d++) + c[d] = Jb(a[d], b); + if (b = Array.isArray(a)) { + var e; + zb ? e = a[zb] : e = a.Gb; + b = (null == e ? 0 : e) & 1; + } + b && Ab(c); + return c; + } + e = {}; + for (c in a) + Object.prototype.hasOwnProperty.call(a, c) && (e[c] = Jb(a[c], b)); + return e; + }; + Kb = function (a) { + if (a && 'object' == typeof a && a.toJSON) + return a.toJSON(); + a = Hb(a); + return Array.isArray(a) ? Ib(a, Kb) : a; + }; + Nb = function (a) { + if (Cb && null != a && a instanceof Uint8Array) + a = new Uint8Array(a); + else if (a instanceof Gb) { + var b = a.F, c = new Gb(Ab([]), b), d; + for (d in a.map) { + var e = a.map[d]; + b ? c.set(e[0], Lb(Mb(a, e))) : c.set(e[0], Jb(e[1], Nb)); + } + a = c; + } + return a; + }; + Pb = function (a, b) { + Ob = b; + a = new a(b); + Ob = null; + return a; + }; + Qb = function (a, b, c, d) { + c !== d ? w(a, b, c) : w(a, b, void 0, !1); + return a; + }; + Tb = function (a, b) { + return Hb(b); + }; + Vb = function (a, b) { + b.l && (a.l = b.l.slice()); + var c = b.j; + if (c) { + b = b.m; + for (var d in c) + if (Object.prototype.hasOwnProperty.call(c, d)) { + var e = c[d]; + if (e) { + var f = !(!b || !b[d]), g = +d; + if (Array.isArray(e)) { + if (e.length) + for (f = Ub(a, e[0].constructor, g, f), g = 0; g < Math.min(f.length, e.length); g++) + Vb(f[g], e[g]); + } else + (f = Wb(a, e.constructor, g, void 0, f)) && Vb(f, e); + } + } + } + }; + Yb = function (a, b, c) { + return Xb(a, b) === c ? c : -1; + }; + Zb = function (a) { + switch (a) { + case 1: + return 'gda'; + case 2: + return 'gpt'; + case 3: + return 'ima'; + case 4: + return 'pal'; + case 5: + return 'xfad'; + case 6: + return 'dv3n'; + case 7: + return 'spa'; + default: + return 'unk'; + } + }; + dc = function (a, b, c, d) { + d = void 0 === d ? [] : d; + var e = new a.MutationObserver(function (f) { + f = _.y(f); + for (var g = f.next(); !g.done; g = f.next()) { + g = _.y(g.value.removedNodes); + for (var h = g.next(); !h.done; h = g.next()) + if (h = h.value, d && (h === b || $b(h, b))) { + f = _.y(d); + for (g = f.next(); !g.done; g = f.next()) + g.value.disconnect(); + d.length = 0; + c(); + return; + } + } + }); + d.push(e); + e.observe(a.document.documentElement, { + childList: !0, + subtree: !0 + }); + ac(function (f) { + if (!f.parent || !bc(f.parent)) + return !1; + for (var g = f.parent.document.getElementsByTagName('iframe'), h = 0; h < g.length; h++) + try { + if (cc(g[h]) == f) { + dc(f.parent, g[h], c, d); + break; + } + } catch (k) { + } + return !1; + }, !1, !1, a); + }; + fc = function (a) { + return new _.ec(function (b) { + return b.substr(0, a.length + 1).toLowerCase() === a + ':'; + }); + }; + A = function (a) { + var b = gc.apply(1, arguments); + if (0 === b.length) + return Qa(a[0]); + for (var c = [a[0]], d = 0; d < b.length; d++) + c.push(encodeURIComponent(b[d])), c.push(a[d + 1]); + return Qa(c.join('')); + }; + hc = function (a, b) { + var c = Sa(a); + if (/#/.test(c)) + throw Error(''); + var d = /\?/.test(c) ? '&' : '?'; + b.forEach(function (e, f) { + e = e instanceof Array ? e : [e]; + for (var g = 0; g < e.length; g++) { + var h = e[g]; + null !== h && void 0 !== h && (c += d + encodeURIComponent(f) + '=' + encodeURIComponent(String(h)), d = '&'); + } + }); + return Qa(c); + }; + kc = function (a) { + return function () { + var b = gc.apply(0, arguments); + try { + return a.apply(this, b); + } catch (c) { + } + }; + }; + mc = function (a) { + a.Zc.apply(a, _.lc(gc.apply(1, arguments).map(function (b) { + return { + $c: 2, + message: b + }; + }))); + }; + nc = function (a) { + a.Zc.apply(a, _.lc(gc.apply(1, arguments).map(function (b) { + return { + $c: 5, + message: b + }; + }))); + }; + oc = function (a) { + a && 'function' == typeof a.ua && a.ua(); + }; + pc = function (a) { + return a; + }; + qc = function (a, b) { + if (!b(a)) + throw Error(String(a)); + }; + rc = function (a, b) { + qc(a, b); + return a; + }; + sc = function (a, b, c) { + if (!a) { + if (c && 0 < c.length) + throw Error('[' + c.map(String).join(',') + ']'); + throw Error(String(a)); + } + }; + tc = function (a, b) { + const $___old_4ac519ca7eba936a = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_4ac519ca7eba936a) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_5951fd968a9e489b.localStorage)); + return function () { + b = void 0 === b ? window : b; + if (E(a, 5)) + try { + return b.localStorage; + } catch (c) { + } + return null; + }.apply(this, arguments); + } finally { + if ($___old_4ac519ca7eba936a) + ({}.constructor.defineProperty(window, 'localStorage', $___old_4ac519ca7eba936a)); + } + }; + uc = function (a) { + return 'null' !== a.origin; + }; + wc = function (a, b, c) { + b = E(b, 5) && uc(c) ? c.document.cookie : null; + return null === b ? null : new vc({ cookie: b }).get(a) || ''; + }; + yc = function (a, b) { + var c, d, e; + return ib(function (f) { + if (1 == f.j) + return c = 0 < b ? a.filter(function (g) { + return !g.Dc; + }) : a, jb(f, v.Promise.all(c.map(function (g) { + return g.Gc.promise; + })), 2); + if (3 != f.j) { + if (a.length === c.length) + return f.return(0); + d = a.filter(function (g) { + return g.Dc; + }); + e = _.xc(); + return jb(f, v.Promise.race([ + v.Promise.all(d.map(function (g) { + return g.Gc.promise; + })), + new v.Promise(function (g) { + return void setTimeout(g, b); + }) + ]), 3); + } + return f.return(_.xc() - e); + }); + }; + Ec = function (a, b, c, d) { + c = void 0 === c ? null : c; + d = void 0 === d ? {} : d; + if (Math.random() < _.zc(Ac)) { + var e = {}; + Bc(_.t(Object, 'assign').call(Object, (e.c = String(a), e.pc = String(Cc(window)), e.em = c, e.lid = b, e.eids = Dc().m().join(), e), d), 'esp'); + } + }; + Kc = function (a, b, c, d) { + Ec(18, a); + try { + var e = _.xc(); + _.zc(Fc) && (Gc(b, Number(((0, F.H)(Hc(b, 8)) - 1).toFixed(3))), w(b, 7, Math.round(e / 1000 / 60))); + return c().then(function (f) { + Ec(29, a, null, { delta: String(_.xc() - e) }); + w(b, 3, Date.now()); + Ic(a, b, f, d); + return b; + }).catch(function (f) { + Ic(a, b, G(b, 2), d); + Ec(28, a, Jc(f)); + return b; + }); + } catch (f) { + return Ic(a, b, G(b, 2), d), Ec(1, a, Jc(f)), v.Promise.resolve(b); + } + }; + Mc = function () { + var a = window; + var b = void 0 === b ? function () { + } : b; + return new v.Promise(function (c) { + var d = function () { + c(b()); + _.Lc(a, 'load', d); + }; + _.fb(a, 'load', d); + }); + }; + Tc = function (a, b, c, d) { + var e, f, g, h, k; + return ib(function (l) { + if (1 == l.j) + return e = new Nc(a, b, c, d), f = new Oc(e.o, e.B, c, d), g = new Pc(f.o, f.B, c, d), h = new Qc(), Rc(h, [ + e, + f, + g + ]), Sc(h), jb(l, f.l.promise, 2); + k = l.m; + return l.return(k ? k : { + id: a, + collectorGeneratedData: null + }); + }); + }; + Zc = function (a, b, c) { + var d; + if (b) + if (Uc() === Vc(window) || _.H(Wc)) + if (a.encryptedSignalProviders instanceof Xc) + a.encryptedSignalProviders.addErrorHandler(c); + else { + var e = new Yc(null !== (d = a.encryptedSignalProviders) && void 0 !== d ? d : [], b); + a.encryptedSignalProviders = new Xc(e); + e.addErrorHandler(c); + } + else + Ec(16, ''); + else + Ec(15, ''); + }; + bd = function (a, b, c) { + var d, e = b.toString(); + if (c && !document.querySelector('[src="' + e + '"]')) + if (c = $c().get(a, c), c.getError()) + Ec(c.getError(), a, c.errorMessage); + else if (c = c.Ub, !c || !(0 === ad(c) || 1 > (null !== (d = Hc(c, 8)) && void 0 !== d ? d : 0))) { + Ec(30, a, null, { url: e }); + var f = document.createElement('script'); + f.setAttribute('esp-signal', 'true'); + bb(f, b); + var g = function () { + Ec(31, a, null, { url: e }); + _.Lc(f, 'error', g); + }; + document.head.appendChild(f); + _.fb(f, 'error', g); + } + }; + td = function (a) { + var b = a.id, c = ['id'], d = {}, e; + for (e in a) + Object.prototype.hasOwnProperty.call(a, e) && 0 > c.indexOf(e) && (d[e] = a[e]); + if (null != a && 'function' === typeof Object.getOwnPropertySymbols) { + var f = 0; + for (e = Object.getOwnPropertySymbols(a); f < e.length; f++) + 0 > c.indexOf(e[f]) && (d[e[f]] = a[e[f]]); + } + if (_.t(Object, 'keys').call(Object, d).length) + throw Error('Invalid attribute(s): ' + _.t(Object, 'keys').call(Object, d)); + a = { id: b }; + if (!cd.test('div')) + throw Error(''); + if ('DIV' in dd) + throw Error(''); + c = void 0; + b = null; + d = ''; + if (a) + for (h in a) + if (Object.prototype.hasOwnProperty.call(a, h)) { + if (!cd.test(h)) + throw Error(''); + f = a[h]; + if (null != f) { + e = h; + if (f instanceof ed) + f = fd(f); + else { + if ('style' == e.toLowerCase()) + throw Error(''); + if (/^on/i.test(e)) + throw Error(''); + if (e.toLowerCase() in gd) + if (f instanceof hd) + f = Xa(f).toString(); + else if (f instanceof id) + f = _.jd(f); + else if ('string' === typeof f) { + if (!(f instanceof id)) + if (f = 'object' == typeof f && f.Ha ? f.Ea() : String(f), kd.test(f)) + f = new id(f, ld); + else { + f = String(f); + f = f.replace(/(%0A|%0D)/g, ''); + var g = f.match(md); + f = g && nd.test(g[1]) ? new id(f, ld) : null; + } + f = (f || od).Ea(); + } else + throw Error(''); + } + f.Ha && (f = f.Ea()); + e = e + '="' + pd(String(f)) + '"'; + d += ' ' + e; + } + } + var h = '', b = b.Za()); + (a = a && a.dir) && (/^(ltr|rtl|auto)$/i.test(a) ? b = 0 : b = null); + h = sd(h, b); + return Na(Va(h).toString()); + }; + zd = function (a) { + ud(); + var b = vd.googleToken[5] || 0; + a && (0 != b || wd[3] >= xd() ? yd.Fc(a) : (yd.Jc().push(a), yd.Uc())); + wd[3] >= xd() && wd[2] >= xd() || yd.Uc(); + }; + Bd = function (a) { + a = _.Ad(a.split(/\s+/), function (b) { + return (b = /^(-?\d+)(px|%)$/.exec(b)) ? { + value: parseFloat(b[1]), + type: b[2] + } : { + value: 0, + type: 'px' + }; + }); + a[1] = a[1] || a[0]; + a[2] = a[2] || a[0]; + a[3] = a[3] || a[1]; + return a; + }; + Dd = function (a) { + if (!a) + return [0]; + a = 'number' === typeof a ? [a] : a; + a = _.Cd(a, function (b) { + return 'number' === typeof b && 0 <= b && 1 >= b ? !0 : !1; + }); + ma(a); + oa(a, function (b, c) { + return b - c; + }); + return a; + }; + Fd = function (a) { + try { + var b = a.getBoundingClientRect(); + } catch (c) { + } + return b ? { + top: b.top, + right: b.right, + bottom: b.bottom, + left: b.left, + width: b.width || b.right - b.left, + height: b.height || b.bottom - b.top + } : { + top: 0, + right: 0, + bottom: 0, + left: 0, + width: 0, + height: 0 + }; + }; + Id = function (a, b, c, d) { + var e, f, g, h, k, l, m, n = new Gd(), q = '', u = function (B) { + try { + var x = 'object' === typeof B.data ? B.data : JSON.parse(B.data); + q === x.paw_id && (_.Lc(a, 'message', u), x.error ? n.reject(Error(x.error)) : n.resolve(d(x))); + } catch (z) { + } + }; + return 'function' === typeof (null === (e = a.gmaSdk) || void 0 === e ? void 0 : e.getQueryInfo) ? (_.fb(a, 'message', u), q = c(a.gmaSdk), n.promise) : 'function' === typeof (null === (h = null === (g = null === (f = a.webkit) || void 0 === f ? void 0 : f.messageHandlers) || void 0 === g ? void 0 : g.getGmaQueryInfo) || void 0 === h ? void 0 : h.postMessage) || 'function' === typeof (null === (m = null === (l = null === (k = a.webkit) || void 0 === k ? void 0 : k.messageHandlers) || void 0 === l ? void 0 : l.getGmaSig) || void 0 === m ? void 0 : m.postMessage) ? (q = String(Math.floor(2147483647 * Hd())), _.fb(a, 'message', u), b(a.webkit.messageHandlers, q), n.promise) : null; + }; + Jd = function (a) { + return Id(a, function (b, c) { + var d; + return void (null !== (d = b.getGmaQueryInfo) && void 0 !== d ? d : b.getGmaSig).postMessage(c); + }, function (b) { + return b.getQueryInfo(); + }, function (b) { + return b.signal; + }); + }; + Kd = function (a, b, c, d) { + try { + if (a.setAttribute('data-google-query-id', c), !d) { + var e, f; + null !== (e = b.googletag) && void 0 !== e ? e : b.googletag = {}; + var g = null !== (f = b.googletag.queryIds) && void 0 !== f ? f : []; + g.push(c); + 500 < g.length && g.shift(); + b.googletag.queryIds = g; + } + } catch (h) { + } + }; + Md = function (a, b, c) { + c = void 0 === c ? null : c; + b = _.y(b); + for (var d = b.next(); !d.done; d = b.next()) { + var e = a, f = d.value; + d = c; + d = void 0 === d ? null : d; + var g = e.document; + var h = f.x, k = f.y; + g.hasOwnProperty('_goog_efp_called_') || (g._goog_efp_called_ = g.elementFromPoint(h, k)); + if (g = g.elementFromPoint(h, k)) { + if (!(h = Ld(g, e, f, d))) + a: { + d = void 0 === d ? null : d; + h = e.document; + for (g = g.offsetParent; g && g != h.body; g = g.offsetParent) + if (k = Ld(g, e, f, d)) { + h = k; + break a; + } + h = null; + } + d = h || null; + } else + d = null; + if (d) + return d; + } + return null; + }; + Ld = function (a, b, c, d) { + d = void 0 === d ? null : d; + if ('fixed' !== Nd(a, 'position')) + return null; + var e = 'GoogleActiveViewInnerContainer' == a.getAttribute('class') || 1 >= _.Od(_.Pd, a).width && 1 >= _.Od(_.Pd, a).height ? !0 : !1; + d && d.j('ach_evt', { + url: b.location.href, + tn: a.tagName, + id: a.getAttribute('id'), + cls: a.getAttribute('class'), + ign: e, + pw: b.innerWidth, + ph: b.innerHeight, + x: c.x, + y: c.y + }, 1); + return e ? null : a; + }; + Qd = function (a, b) { + b = void 0 === b ? [] : b; + var c = Date.now(); + return _.Cd(b, function (d) { + return c - d < 1000 * a; + }); + }; + Sd = function (a, b) { + try { + var c = a.getItem('__lsv__'); + if (!c) + return []; + try { + var d = JSON.parse(c); + } catch (e) { + } + if (!Array.isArray(d) || _.Rd(d, function (e) { + return !_.t(Number, 'isInteger').call(Number, e); + })) + return a.removeItem('__lsv__'), []; + d = Qd(b, d); + d.length || null == a || a.removeItem('__lsv__'); + return d; + } catch (e) { + return null; + } + }; + Td = function (a, b) { + 0.001 > Hd() && Bc({ + c: a, + s: b + }, 'gpt_whirs'); + }; + Ud = function (a) { + return 'number' === typeof a || 'string' === typeof a; + }; + Vd = function (a) { + switch (a) { + case void 0: + case null: + case 2: + return !1; + case 0: + case 1: + return !0; + default: + throw Error('Unexpected encryption mode: ' + a); + } + }; + Xd = function (a, b, c) { + c = void 0 === c ? Wd : c; + a.goog_sdr_l || (Object.defineProperty(a, 'goog_sdr_l', { value: !0 }), 'complete' === a.document.readyState ? c(a, b) : _.fb(a, 'load', function () { + return void c(a, b); + })); + }; + Yd = function (a) { + var b, c; + try { + return (null !== (c = null === (b = a.top) || void 0 === b ? void 0 : b.frames) && void 0 !== c ? c : {}).google_ads_top_frame; + } catch (d) { + } + return null; + }; + $d = function (a) { + var b = RegExp('^https?://[^/#?]+/?$'); + return !!a && !b.test(a); + }; + ae = function (a) { + if (a === a.top || bc(a.top)) + return v.Promise.resolve({ status: 4 }); + var b = Yd(a); + if (!b) + return v.Promise.resolve({ status: 2 }); + if (a.parent === a.top && $d(a.document.referrer)) + return v.Promise.resolve({ status: 3 }); + var c = new Gd(); + a = new MessageChannel(); + a.port1.onmessage = function (d) { + '__goog_top_url_resp' === d.data.msgType && c.resolve({ + nb: d.data.topUrl, + status: d.data.topUrl ? 0 : 1 + }); + }; + b.postMessage({ msgType: '__goog_top_url_req' }, '*', [a.port2]); + return c.promise; + }; + be = function (a) { + var b = ''; + ac(function (c) { + var d; + if (c === c.top) + return !0; + if (null === (d = c.document) || void 0 === d ? 0 : d.referrer) + b = c.document.referrer; + return !1; + }, !1, !1, a); + return b; + }; + ce = function (a) { + var b; + if (a = null === (b = a.navigator) || void 0 === b ? void 0 : b.userActivation) { + var c = 0; + if (null === a || void 0 === a ? 0 : a.hasBeenActive) + c |= 1; + if (null === a || void 0 === a ? 0 : a.isActive) + c |= 2; + return c; + } + }; + ee = function (a, b) { + if (!document.getElementById('gatc:host:script')) { + var c = document.createElement('script'); + c.id = 'gatc:host:script'; + bb(c, a.cd.Id); + a.Kc.appendChild(c); + } + a = window.gatc_host; + de(a) ? b(a) : Array.isArray(a) && 'function' === typeof a.push ? a.push(b) : window.gatc_host = [b]; + }; + ke = function (a, b) { + var c = fe; + b = void 0 === b ? ge : b; + var d = function (f) { + 'string' === typeof f && (f = c.j(f), a(f)); + }, e = new he(); + ee(b, function (f) { + if (de(f)) { + var g = new ie(); + Qb(g, 1, c.m, 0); + f.openConsoleTab(g.X(), d, function (h) { + if (!(e.j instanceof MessagePort)) { + var k = e.j; + e.j = h; + h = _.y(je(k)); + for (k = h.next(); !k.done; k = h.next()) + e.send(k.value); + } + }); + } + }); + return e; + }; + me = function (a, b) { + (0, F.jb)(!le.has(a)); + le.set(a, b); + }; + ne = function () { + var a; + return null !== (a = _.r.googletag) && void 0 !== a ? a : _.r.googletag = {}; + }; + oe = function (a, b) { + var c = ne(); + c.hasOwnProperty(a) || (c[a] = b); + }; + qe = function (a) { + var b; + a = pe[a]; + return null !== (b = ne()[a]()) && void 0 !== b ? b : null; + }; + De = function (a) { + var b = new re(); + if (se(a)) + return te(b, 1, ue, a), b; + if (ve(a)) + return te(b, 2, ue, a), b; + if (we(a)) + return te(b, 3, ue, a), b; + if (xe(a)) + return te(b, 4, ue, 2), b; + if (ye(a)) + return te(b, 4, ue, 1), b; + if (ze(a)) + return te(b, 7, ue, a.toString()), b; + if (Ae(a)) { + var c = new Be(); + Ce(c, a.map(function (h) { + return De(h); + })); + Ee(b, 5, ue, c); + return b; + } + c = new Fe(); + var d = Ge(c), e = !1; + if (a === ne()) + w(c, 2, 1), e = !0; + else if (void 0 !== a.constructor && le.has(a.constructor)) { + var f = (0, F.H)(le.get(a.constructor)); + w(c, 2, f); + e = !0; + 8 === f ? (f = a.getSlotId().getDomId(), He(c, Ie(new Je(), Ke.O().m[f]))) : 7 === f && (f = Ke.O().j, He(c, Oe(f))); + } + a = _.y(_.t(Object, 'entries').call(Object, a)); + for (f = a.next(); !f.done; f = a.next()) { + var g = _.y(f.value); + f = g.next().value; + g = g.next().value; + e && ze(g) || d.set(f, De(g)); + } + Ee(b, 6, ue, c); + return b; + }; + Pe = function (a) { + var b = a.split('/'); + return '/' === a.charAt(0) && 2 <= b.length ? b[1] : '/' !== a.charAt(0) && 1 <= b.length ? b[0] : ''; + }; + Se = function (a) { + if (15360 >= a.length) + return a; + var b = a; + 15360 < b.length && (b = b.substring(0, 15352), b = b.replace(/%\w?$/, ''), b = b.replace(/&[^=]*=?$/, ''), b += '&trunc=1'); + Qe(Re.O(), 9 .toString(), 9, a.length - b.length + 8); + return b; + }; + Te = function (a) { + var b = a.indexOf('google_preview=', a.lastIndexOf('?')), c = a.indexOf('&', b); + -1 === c && (c = a.length - 1, --b); + return a.substring(0, b) + a.substring(c + 1, a.length); + }; + Ue = function (a, b) { + b = void 0 === b ? window : b; + return b.location ? b.URLSearchParams ? (a = new URLSearchParams(b.location.search).get(a), (null === a || void 0 === a ? 0 : a.length) ? a : null) : (a = new RegExp('[?&]' + a + '=([^&]*)').exec(b.location.search)) ? decodeURIComponent(a[1]) : null : null; + }; + Ve = function (a, b) { + b = void 0 === b ? window : b; + return !!Ue(a, b); + }; + Xe = function () { + return We(); + }; + We = function () { + var a = Ye, b = Number(a); + return 1 > b || Math.floor(b) !== b ? (Bc({ v: a }, 'gpt_inv_ver'), '1') : a; + }; + $e = function (a, b) { + a = { methodId: a }; + b.name && (a.name = b.name); + b.message && (a.message = b.message.substring(0, 512)); + b.fileName && (a.fileName = b.fileName); + b.lineNumber && (a.lineNumber = b.lineNumber); + b.stack && (a.stack = Ze(b.stack, '')); + return a; + }; + gf = function (a, b) { + var c = void 0 === c ? af : c; + if (!b.isReported) + try { + b.isReported = !0; + if ('__throw_for_testing' === b.name && _.bf[148]) + throw Error('throwing error for testing'); + var d = $e(a, b), e = new cf('gpt_exception'); + try { + df(e); + } catch (f) { + } + _.ef(d, function (f, g) { + I(e, g, f); + }); + ff(e, c); + } catch (f) { + } + }; + K = function (a, b, c) { + c = void 0 === c ? !1 : c; + var d = void 0 === d ? hf : d; + _.bf[148] && (jf || (jf = new kf(), jf.initialize()), b = lf(a, b)); + return _.mf(a, b, c, _.H(nf), d); + }; + pf = function (a, b) { + if (0.1 > Math.random()) + try { + var c = Error(); + of('gpt_api_usage', function (d) { + I(d, 'methodId', a); + I(d, 'args', b); + c.stack && I(d, 'stack', Ze(c.stack, c.message)); + df(d); + }, { pa: 1 }); + } catch (d) { + } + }; + _.mf = function (a, b, c, d, e) { + c = void 0 === c ? !1 : c; + d = void 0 === d ? !1 : d; + e = void 0 === e ? hf : e; + return function () { + var f = gc.apply(0, arguments), g = void 0, h = !1, k = null, l = Re.O(); + try { + var m = _.H(qf); + m && l && (k = l.start(a.toString(), 3)); + g = b.apply(this, f); + h = !0; + m && l && l.end(k); + } catch (n) { + try { + if (h) + rf.call(this, 110, n, e); + else if (rf.call(this, a, n, e), !c) + throw n; + } catch (q) { + if (k && sf && tf() && (sf.clearMarks('goog_' + k.label + '_' + k.uniqueId + '_start'), sf.clearMarks('goog_' + k.label + '_' + k.uniqueId + '_end')), !h && !c) + throw n; + } + } + d && pf.call(this, a, f.length); + return g; + }; + }; + _.uf = function (a, b, c) { + var d = void 0 === d ? hf : d; + return _.mf(a, b, void 0 === c ? !1 : c, !1, d)(); + }; + rf = function (a, b, c) { + c = void 0 === c ? hf : c; + b = b.error && b.meta && b.id ? b.error : b; + if (_.H(vf)) { + if (c = c(), c.qe) { + var d = new wf(), e = new xf(); + try { + var f = Cc(window); + Qb(e, 1, f, 0); + } catch (u) { + } + try { + var g = Dc().m(); + yf(e, 2, g); + } catch (u) { + } + try { + Qb(e, 3, window.document.URL, ''); + } catch (u) { + } + f = zf(d, 2, e); + g = new Af(); + a = Qb(g, 1, a, 0); + try { + var h = se(null === b || void 0 === b ? void 0 : b.name) ? b.name : 'Unknown error'; + Qb(a, 2, h, ''); + } catch (u) { + } + try { + var k = se(null === b || void 0 === b ? void 0 : b.message) ? b.message : 'Caught ' + b; + Qb(a, 3, k, ''); + } catch (u) { + } + try { + var l = se(null === b || void 0 === b ? void 0 : b.stack) ? b.stack : Error().stack; + l && yf(a, 4, l.split(/\n\s*/)); + } catch (u) { + } + h = zf(f, 1, a); + k = new Bf(); + try { + var m = We(); + Qb(k, 1, m, ''); + } catch (u) { + } + try { + var n = Cf(); + Qb(k, 2, n, 0); + } catch (u) { + } + try { + var q = [].concat(_.lc(_.t(Df, 'keys').call(Df))); + yf(k, 3, q); + } catch (u) { + } + Ee(h, 4, Ef, k); + Qb(h, 5, c.zd, 0); + mc(c.sb, h); + } + } else + gf.call(this, a, b); + }; + Mf = function (a, b, c) { + c = void 0 === c ? null : c; + b = (void 0 === b ? 0 : b) ? _.zc(_.Ff) || 3600 : -1; + var d = 0; + try { + d |= a != a.top ? 512 : 0, d |= a.navigator && /Android 2/.test(a.navigator.userAgent) ? 1048576 : 0; + } catch (g) { + d |= 32; + } + c = c ? tc(c) : null; + var e = 0; + try { + e |= Gf(a, 2500); + if (_.H(Hf)) { + var f = _.If(a).clientHeight; + e |= f ? 320 > f ? -2147483648 : 0 : 1073741824; + } + e |= Jf(a); + 0 < b && !_.Kf(_.Lf(c, b)) && (e |= 134217728); + } catch (g) { + e |= 32; + } + return d | e; + }; + Pf = function (a, b, c, d) { + if (5 !== Nf(b)) + return !1; + var e = Mf(c, '22639388115' !== Pe(a.getAdUnitPath()), d); + e && of('gpt_int_ns', function (f) { + I(f, 'nsr', e); + df(f); + }, { pa: _.zc(Of) }); + return !!e; + }; + Rf = function (a, b) { + var c; + a = _.t(a, 'find').call(a, function (d) { + d = (0, F.H)(Wb(d, Qf, 1)); + return d.getWidth() <= b.getWidth() && d.getHeight() <= b.getHeight(); + }); + return null !== (c = null === a || void 0 === a ? void 0 : Ub(a, Qf, 2)) && void 0 !== c ? c : null; + }; + Vf = function (a, b, c) { + return 'number' === typeof b && 'number' === typeof c && Ub(a, Sf, 6).length ? Rf(Ub(a, Sf, 6), Tf(Uf(new Qf(), b), c)) : Ub(a, Qf, 5); + }; + Xf = function (a) { + var b = void 0 === b ? window : b; + var c = null; + b.top === b && (b = Wf(!1, b), c = Vf(a, b.width, b.height)); + null !== c && void 0 !== c ? c : c = Vf(a); + return null == c ? [] : c.map(function (d) { + return E(d, 3) ? 'fluid' : [ + (0, F.va)(d.getWidth()), + (0, F.va)(d.getHeight()) + ]; + }); + }; + Zf = function (a) { + if (!Xf(a).length && Yf(a, 16)) + return '1x1'; + var b = [], c = !1; + a = _.y(Xf(a)); + for (var d = a.next(); !d.done; d = a.next()) + d = d.value, Array.isArray(d) ? b.push(d.join('x')) : 'fluid' === d ? c = !0 : b.push(d); + c && b.unshift('320x50'); + return b.join('|'); + }; + $f = function (a) { + return (L = Xf(a), _.t(L, 'includes')).call(L, 'fluid'); + }; + bg = function (a, b) { + b = void 0 === b ? null : b; + var c = []; + a && (c.push(a.getAdUnitPath()), c.push(Zf(a)), c.push(a.getDomId())); + if (b) { + a = []; + for (var d = 0; b && 25 > d; b = b.parentNode, ++d) + 9 === b.nodeType ? a.push('') : a.push(b.id); + (b = a.join()) && c.push(b); + } + return c.length ? ag(c.join(':')).toString() : '0'; + }; + cg = function (a) { + return 0 !== a && 1 !== a; + }; + dg = function (a, b) { + var c; + return !(null !== (c = E(b, 22)) && void 0 !== c ? !c : !E(a, 15)); + }; + gg = function (a) { + var b = a.document; + return fg(a) ? b.URL : b.referrer; + }; + jg = function (a) { + try { + return hg(a, window.top); + } catch (b) { + return new _.ig(-12245933, -12245933); + } + }; + lg = function (a) { + var b; + if (!a) + return null; + a = kg(a); + return null !== (b = null === a || void 0 === a ? void 0 : a.floor()) && void 0 !== b ? b : null; + }; + og = function (a, b) { + for (var c = {}, d = _.y(_.t(Object, 'keys').call(Object, b)), e = d.next(); !e.done; e = d.next()) { + e = e.value; + var f = Lb(b[e]), g = mg.O(), h = g.j.get(e); + null == h ? h = ++Re.O().m : g.j.delete(e); + w(f, 20, h); + c[e] = f; + } + a = Lb(a); + b = new Date(Date.now()); + b = b.getUTCFullYear() + ng(b.getUTCMonth() + 1) + ng(b.getUTCDate()); + return { + U: a, + P: c, + Rb: b + }; + }; + pg = function () { + var a, b, c; + if ('function' === typeof (null === (a = window.crypto) || void 0 === a ? void 0 : a.getRandomValues)) { + var d = new Uint8Array(16); + null === (b = window.crypto) || void 0 === b ? void 0 : b.getRandomValues(d); + return d; + } + d = window; + if ('function' === typeof (null === (c = d.msCrypto) || void 0 === c ? void 0 : c.getRandomValues)) { + var e = new Uint8Array(16); + d.msCrypto.getRandomValues(e); + return e; + } + d = Array(16); + for (e = 0; e < d.length; e++) + d[e] = Math.floor(255 * Math.random()); + return d; + }; + sg = function (a, b) { + return qg(a, b) || rg(a, b); + }; + xg = function (a, b, c, d) { + var e, f, g = sg(b, a); + if (!g) + return null; + var h = jg(g), k = g === rg(b, a), l = tg(function () { + var q = k ? rg(b, a) : g; + return q && ug(q, window); + }), m = function (q) { + var u; + return null === (u = l()) || void 0 === u ? void 0 : u.getPropertyValue(q); + }; + c = Xf(c)[0]; + var n = !1; + Array.isArray(c) && (n = d ? k : 0 === h.x && 'center' === m('text-align')); + n && (h.x += Math.round(Math.max(0, (k ? g.clientWidth : g.parentElement.clientWidth) - Number(c[0])) / 2)); + k && (h.y += Math.round(Math.min(null !== (e = vg(m('padding-top'))) && void 0 !== e ? e : 0, g.clientHeight)), n || (d = g.clientWidth, h.x += Math.round(Math.min(null !== (f = vg(m('padding-left'))) && void 0 !== f ? f : 0, d)))); + return h && wg(g) ? h : new _.ig(-12245933, -12245933); + }; + yg = function (a, b, c, d) { + var e = rg(a, c), f = 'none' === (null === e || void 0 === e ? void 0 : e.style.display); + f && (e.style.display = 'block'); + a = xg(c, a, b, d); + f && (e.style.display = 'none'); + return a; + }; + zg = function (a) { + return 'google_ads_iframe_' + a.toString(); + }; + Ag = function (a) { + return zg(a) + '__container__'; + }; + qg = function (a, b) { + b = rg(a, b); + return (null === b || void 0 === b ? void 0 : b.querySelector('[id="' + Ag(a) + '"]')) || null; + }; + Bg = function (a, b) { + var c, d; + return null !== (d = null === (c = qg(a, b)) || void 0 === c ? void 0 : c.querySelector('iframe[id="' + zg(a) + '"]')) && void 0 !== d ? d : null; + }; + Eg = function (a, b) { + for (var c = new Cg(), d = 0; d < a.length; d++) + c.set(a.length - d - 1, b(a[d])); + return Dg(c); + }; + Fg = function (a, b, c, d) { + var e = 0; + e = void 0 === e ? '' : e; + c = void 0 === c ? function (l) { + return !!l; + } : c; + d = void 0 === d ? ',' : d; + var f = [], g = !1; + a = _.y(a); + for (var h = a.next(); !h.done; h = a.next()) { + var k = (h = b(h.value)) ? c(h) : !1; + g = g || k; + f.push(String(k ? h : e)); + } + return g ? f.join(d) : null; + }; + Gg = function (a) { + var b = window; + _.uf(831, function () { + var c, d; + return void (null === (d = null === (c = b.performance) || void 0 === c ? void 0 : c.mark) || void 0 === d ? void 0 : d.call(c, a)); + }); + }; + rg = function (a, b) { + b = void 0 === b ? document : b; + return Ke.O().F.get(a) || b.getElementById(a.getDomId()); + }; + Kg = function (a) { + return _.bf[260] ? _.Hg(Ig).l.then(_.mf(895, function () { + return Jg(a); + })) : v.Promise.resolve(Jg(a)); + }; + Lg = function (a) { + return !!a && !!G(a, 1); + }; + Ng = function (a) { + a = (bc(a.top) ? a.top : a).AMP; + return 'object' === typeof a && !!Mg(a, function (b, c) { + return !/^inabox/i.test(c); + }); + }; + Pg = function (a) { + return new v.Map([ + [ + 'arp', + { value: Ng(a) ? 1 : null } + ], + [ + 'abxe', + { value: bc(a.top) || Og(a.IntersectionObserver) ? 1 : null } + ] + ]); + }; + Sg = function (a) { + return (0, F.va)(Qg(a, function () { + return new Rg(a); + })); + }; + Ug = function (a) { + return function () { + return new Tg(a, [].concat(_.lc(gc.apply(0, arguments)))); + }; + }; + Vg = function (a) { + return '[' + a.map(function (b) { + return 'string' === typeof b ? '\'' + b + '\'' : Array.isArray(b) ? Vg(b) : String(b); + }).join(', ') + ']'; + }; + Wg = function (a, b) { + b = Vg(b); + b = b.substring(1, b.length - 1); + return new Tg(96, [ + a, + b + ]); + }; + Zg = function (a) { + return _.H(Xg) && 'rewardedSlotCanceled' === a ? null : (L = _.t(Object, 'values').call(Object, Yg), _.t(L, 'find')).call(L, function (b) { + return b === a; + }); + }; + ih = function (a, b, c, d, e) { + if ('string' !== typeof c || $g(c)) + M(e, Wg('Slot.setTargeting', [ + c, + d + ]), a); + else { + var f = []; + Array.isArray(d) ? f = d : ah(d) ? f = _.t(Array, 'from').call(Array, d) : d && (f = [d]); + f = f.map(String); + (d = (L = bh(b), _.t(L, 'find')).call(L, function (g) { + return ch(g) === c; + })) ? dh(d, f) : (d = dh(eh(new fh(), c), f), gh(b, 9, fh, d)); + e.info(hh(c, f.join(), (0, F.H)(b.getAdUnitPath())), a); + } + }; + jh = function (a, b, c, d) { + if (null != c && 'object' === typeof c) + for (var e = _.y(_.t(Object, 'keys').call(Object, c)), f = e.next(); !f.done; f = e.next()) + f = f.value, ih(a, b, f, c[f], d); + else + d.error(Wg('Slot.updateTargetingFromMap', [c]), a); + }; + mh = function (a) { + return Array.isArray(a) && 2 === a.length ? a.every(lh) : 'fluid' === a; + }; + nh = function (a) { + return Array.isArray(a) && 2 === a.length && lh(a[0]) && lh(a[1]); + }; + ph = function (a) { + return Array.isArray(a) ? Tf(Uf(new Qf(), (0, F.va)(a[0])), (0, F.va)(a[1])) : oh(); + }; + rh = function (a) { + var b = []; + if (qh(a)) + b.push(ph((0, F.H)(a))); + else if (Array.isArray(a)) { + a = _.y(a); + for (var c = a.next(); !c.done; c = a.next()) + if (c = c.value, qh(c)) + b.push(ph((0, F.H)(c))); + else { + a: { + var d = ['fluid']; + if (ah(c) && ah(d) && c.length == d.length) { + for (var e = c.length, f = ra, g = 0; g < e; g++) + if (!f(c[g], d[g])) { + c = !1; + break a; + } + c = !0; + } else + c = !1; + } + c && b.push(oh()); + } + } + return b; + }; + sh = function (a) { + if (!Array.isArray(a) || 2 !== a.length) + return null; + var b = a[0]; + a = a[1]; + if ('number' === typeof b && 0 <= b) + b = Math.floor(b); + else if (null !== b) + return null; + if ('number' === typeof a && 0 <= a) + a = Math.floor(a); + else if (null !== a) + return null; + return Tf(Uf(new Qf(), b), a); + }; + uh = function (a) { + var b = void 0 === b ? window : b; + var c, d; + if (!a) + return { + ec: [], + Fa: null + }; + if (Array.isArray(a) ? 0 : Array.isArray(a.fixed) || 'fluid' === a.fixed || Array.isArray(a.max)) { + var e = rh(a.fixed), f; + if (f = sh(a.max)) { + var g = a.min ? sh(a.min) : new Qf(); + null == (null === g || void 0 === g ? void 0 : g.getWidth()) && (null === g || void 0 === g ? void 0 : Uf(g, 0)); + null == (null === g || void 0 === g ? void 0 : g.getHeight()) && (null === g || void 0 === g ? void 0 : Tf(g, 0)); + f = { + max: f, + min: g + }; + } else + f = { + max: null, + min: null + }; + g = f; + f = g.max; + g = g.min; + var h; + if (a.max && !f) + throw Error('Invalid GPT maximum size: ' + JSON.stringify(a)); + if (a.min && !g) + throw Error('Invalid GPT minimum size: ' + JSON.stringify(a)); + if (null !== (h = a.fixed) && void 0 !== h && h.length || f) { + b = (0, F.H)(f); + if (0 === b.getWidth() || 0 === b.getHeight()) + throw Error('Invalid GPT size,\n maximums cannot be zero: ' + JSON.stringify(a)); + if (g) { + h = (0, F.H)(g); + var k = h.getWidth(); + var l = b.getWidth(); + if (null != k && null != l && k > l) + throw Error('Invalid GPT size: minimum width larger than maximum width: ' + JSON.stringify(a)); + h = h.getHeight(); + b = b.getHeight(); + if (null != h && null != b && h > b) + throw Error(' Invalid GPT size: minimum height larger than maximum height: ' + JSON.stringify(a)); + } + } else + null === (l = null === (k = b.console) || void 0 === k ? void 0 : k.warn) || void 0 === l ? void 0 : l.call(k, 'Invalid GPT fixed size specification: ' + JSON.stringify(a)); + f && g ? (a = new th(), a = zf(a, 1, f), a = zf(a, 2, g)) : a = null; + return { + ec: e, + Fa: a + }; + } + a.length || (null === (d = null === (c = b.console) || void 0 === c ? void 0 : c.warn) || void 0 === d ? void 0 : d.call(c, 'Invalid GPT fixed size specification: ' + JSON.stringify(a))); + return { + ec: rh(a), + Fa: null + }; + }; + qh = function (a) { + return Array.isArray(a) && 1 < a.length ? 'number' === typeof a[0] && 'number' === typeof a[1] : 'fluid' === a; + }; + xh = function (a) { + if (!Array.isArray(a) || 2 !== a.length) + throw new vh('Each mapping entry must be an array of size 2'); + var b = a[0]; + if (!nh(b)) + throw new vh('Size must be an array of two non-negative integers'); + b = Tf(Uf(new Qf(), b[0]), b[1]); + if (Array.isArray(a[1]) && 0 === a[1].length) + a = []; + else if (a = rh(a[1]), 0 === a.length) + throw new vh('At least one slot size must be present'); + var c = new Sf(); + b = zf(c, 1, b); + return wh(b, 2, a); + }; + zh = function (a) { + return Qg(a, function () { + return new yh(a); + }); + }; + Ah = function (a) { + if (4 === a) + return 11; + switch (a) { + case 2: + return 2; + case 3: + return 1; + case 5: + return 8; + default: + return null; + } + }; + Ih = function (a) { + a = Ah(a); + if (!a) + return null; + var b = 0; + if (11 !== a) { + b |= _.r != _.r.top ? 512 : 0; + var c = _.Bh(_.r); + c = 26 !== a && 27 !== a && 40 !== a && 10 !== a && c.adCount ? 1 == a || 2 == a ? !(!c.adCount[1] && !c.adCount[2]) : (c = c.adCount[a]) ? 1 <= c : !1 : !1; + c && (b |= 64); + if (b) + return b; + } + if (2 === a || 1 === a) { + 0 === Ch() && (b |= 536870912); + var d = { + ha: _.r, + Vd: Dh + }; + c = 0; + try { + var e = d.ha; + c |= e != e.top ? 512 : 0; + var f = d.ha, g = Math.min(f.screen.width || 0, f.screen.height || 0); + e = c |= g ? 320 > g ? 8192 : 0 : 2048; + var h = d.ha, k; + if (k = h.navigator) { + var l = h.navigator.userAgent; + k = !_.H(Eh) && /Firefox/.test(l) || /Android 2/.test(l) || /iPhone OS [34]_/.test(l) || /Windows Phone (?:OS )?[67]/.test(l) || /MSIE.*Windows NT/.test(l) || /Windows NT.*Trident/.test(l); + } + c = e | (k ? 1048576 : 0); + c = d.Yd ? c | (d.ha.innerHeight >= d.Yd ? 0 : 1024) : c | (_.Fh(d.ha) ? 0 : 8); + c |= Gf(d.ha, d.Vd); + c |= Jf(d.ha); + } catch (m) { + c |= 32; + } + switch (d.uf) { + case 2: + h = d.ha; + k = d.Na; + k = void 0 === k ? null : k; + l = Gh(h.innerWidth, 0, Math.min(Math.round(h.innerWidth / 320 * 50), Hh) + 15); + null != Md(h, l, void 0 === k ? null : k) && (c |= 16777216); + break; + case 1: + h = d.ha, k = d.Na, k = void 0 === k ? null : k, l = h.innerWidth, e = h.innerHeight, f = Math.min(Math.round(h.innerWidth / 320 * 50), Hh) + 15, g = Gh(l, e - f, e), 25 < f && g.push({ + x: l - 25, + y: e - 25 + }), null != Md(h, g, void 0 === k ? null : k) && (c |= 16777216); + } + b |= c; + } else + 8 === a ? b |= Mf(_.r) : 11 !== a && (b |= 32); + b || (c = _.Bh(_.r), c.adCount = c.adCount || {}, c.adCount[a] = c.adCount[a] + 1 || 1); + return b; + }; + Kh = function (a) { + var b = new RegExp('(^|,|/)' + a + '($|,|/)'); + return [].concat(_.lc(_.Hg(Jh).ca)).some(function (c) { + return b.test(Pe(c.getAdUnitPath())); + }); + }; + Sh = function (a) { + var b = Lh(), c = Mh(a), d = c.slotId, e = c.ud; + c = c.vd; + if (d) { + if (c = Ke.O(), (a = Nh(c, d.getDomId())) && !E(a, 19)) + if (e && c.F.set(d, e), rg(d) || cg(Nf(a))) + for (w(a, 19, !0), b = og(c.j, c.m), e = _.y(Oh(a, 4)), a = e.next(); !a.done; a = e.next()) + a = qe(a.value), a = (0, F.H)(Ph.get((0, F.H)(a))), a.A && a.R(b, d); + else + M(b, Qh(String(a.getAdUnitPath()), String(a.getDomId())), d); + } else + c ? b.error(Rh(c)) : b.error(Wg('googletag.display', [String(a)])); + }; + Th = function () { + oe('display', K(95, function (a) { + return void Sh(a); + })); + }; + Mh = function (a) { + var b, c = null, d = null, e = ''; + c = _.Hg(Jh); + 'string' === typeof a ? (e = a, c = Uh(c, e)) : _.ja(a) && 1 == a.nodeType ? (d = a, e = d.id, c = Uh(c, e)) : c = null !== (b = (L = [].concat(_.lc(c.ca)), _.t(L, 'find')).call(L, function (f) { + return f.j === a; + })) && void 0 !== b ? b : null; + return { + slotId: c, + ud: d, + vd: e + }; + }; + Wh = function (a) { + return Qg(a, function () { + return new Vh(a); + }); + }; + Zh = function () { + var a = Xh.O(); + return Qg(a, function () { + return new Yh(a); + }); + }; + ai = function (a) { + var b, c = gg(a); + return null !== (b = (L = [ + 'google_debug', + 'dfpdeb', + 'google_console', + 'google_force_console', + 'googfc' + ], _.t(L, 'find')).call(L, function (d) { + return null !== $h(c, d); + })) && void 0 !== b ? b : null; + }; + gi = function (a) { + a = void 0 === a ? _.r : a; + if (!bi) { + var b = new cf('gpt_pubconsole_loaded'); + df(b); + I(b, 'param', String(ai(a))); + I(b, 'api', String(ci)); + ff(b, 1); + di(a.document, ei(Ya(fi).toString())); + bi = !0; + } + }; + hi = function () { + ne()._pubconsole_disable_ = !0; + }; + ki = function () { + ii && (ne().console.openConsole(ji), ji = null, ii = !1); + }; + li = function (a) { + a = void 0 === a ? '' : a; + var b; + ci = !0; + (null === (b = ne()) || void 0 === b ? 0 : b.console) ? ne().console.openConsole(a) : (a && (ji = a), ii = !0, gi()); + }; + mi = function (a, b) { + var c; + return !(null !== (c = E(a, 11)) && void 0 !== c ? !c : !E(b, 10)); + }; + pi = function (a, b, c, d) { + var e; + if (a = rg(a, b)) { + if (c = null !== (e = E(c, 24)) && void 0 !== e ? e : E(d, 30)) + b = a.getBoundingClientRect(), d = b.top, c = b.bottom, 0 === b.height ? c = !1 : (b = _.r.innerHeight, c = 0 < c && c < b || 0 < d && d < b); + c || (a.style.display = 'none'); + } + }; + qi = function (a, b) { + return null === a || void 0 === a ? void 0 : a.replace(/\$\{AUCTION_PRICE\}/g, String(b)); + }; + ri = function (a) { + var b = {}; + a = _.y(a); + for (var c = a.next(); !c.done; c = a.next()) + c = c.value, b[G(c, 1)] = G(c, 2); + return b; + }; + ui = function (a, b) { + var c; + return si(a, ti, function (d) { + d = d.detail.data; + try { + return c = JSON.parse(d), 'rewarded' === c.type && c.message === b; + } catch (e) { + return !1; + } + }).then(function () { + return c; + }); + }; + vi = function (a) { + return Math.round(Number(vg(a))); + }; + xi = function (a, b, c) { + for (var d = 100; a && a !== b && --d;) + _.wi(a, c), a = a.parentElement; + }; + yi = function (a, b, c, d, e) { + _.wi(a, { + 'margin-left': '0px', + 'margin-right': '0px' + }); + var f = { 'z-index': '0' }; + 'absolute' !== d.position && 'fixed' !== d.position && 'relative' !== d.position && (f.position = 'relative'); + var g = 'rtl' === d.direction, h = ((e && -12245933 !== e.width ? e.width : b.innerWidth) - c) / 2; + d = function () { + var k = a.getBoundingClientRect().left; + return g ? h - k : k - h; + }; + b = d(); + return 0 !== b ? (c = function (k) { + g ? f['margin-right'] = k + 'px' : f['margin-left'] = k + 'px'; + }, c(-b), _.wi(a, f), d = d(), 0 !== d && b !== d && (c(b / (d - b) * b), _.wi(a, f)), !0) : !1; + }; + Ai = function (a, b, c, d, e, f, g, h) { + var k = Zf(c); + _.r.setTimeout(_.mf(459, function () { + return void zi(a, b, d, e, f, k, g, h); + }), 500); + }; + zi = function (a, b, c, d, e, f, g, h) { + var k; + if (_.r.IntersectionObserver) { + var l = null, m = null !== (k = Bg(b, a)) && void 0 !== k ? k : rg(b, a), n = _.mf(459, function (q) { + if (q = q && q[0]) { + var u = q.boundingClientRect, B = window.innerWidth, x = Math.round(u.left), z = Math.round(u.right), C = 0 > x + 2, D = 0 < z - (B + 2); + if (q.intersectionRatio >= 1 - ((0 <= Math.round(u.left) ? 0 : 2) + (Math.round(u.right) <= window.innerWidth ? 0 : 2)) / d || C || D) + of(g, function (J) { + if (C || D) { + var T = new Cg(); + T.set(8); + Bi(m) && T.set(10); + T = Dg(T); + } else + T = Ci(a, b); + var aa = Di(b, m, e), X = aa.Od; + aa = aa.Pd; + df(J); + I(J, 'qid', h); + I(J, 'iu', b.getAdUnitPath()); + I(J, 'e', String(T)); + C && I(J, 'ofl', String(x)); + D && I(J, 'ofr', String(z - B)); + I(J, 'ret', d + 'x' + e); + I(J, 'req', f); + I(J, 'bm', String(c)); + I(J, 'efh', Number(X)); + I(J, 'stk', Number(aa)); + I(J, 'ifi', Ei(window)); + }, { pa: _.zc(Fi) }), l && l.unobserve((0, F.H)(m)); + } + }); + m && (l = new _.r.IntersectionObserver(n, { threshold: [1] }), (0, F.H)(l).observe(m)); + } + }; + Ci = function (a, b) { + var c = Bg(b, a) || rg(b, a), d = new Cg(); + try { + var e = c.getBoundingClientRect(), f = e.left, g = e.top, h = e.width, k = e.height, l = rg(b, a), m = (0, F.H)(ug(l, window)); + if ('hidden' === m.visibility || 'none' === m.display) + return Dg(d); + var n = vi(m.getPropertyValue('border-top-width') || 0) + 1; + b = f + h; + k = g + k; + var q = a.elementsFromPoint(f + n + 2, g + n); + var u = a.elementsFromPoint(b - n - 2, g + n); + var B = a.elementsFromPoint(b - n - 2, k - n); + var x = a.elementsFromPoint(f + n + 2, k - n); + var z = a.elementsFromPoint(b / 2, k - n); + } catch (D) { + return d.set(1), Dg(d); + } + if (!(q && q.length && u && u.length && B && B.length && x && x.length && z && z.length)) + return d.set(7), Dg(d); + a = function (D, J) { + for (var T = !1, aa = 0; aa < D.length; aa++) { + var X = D[aa]; + if (T) { + var S = ug(X, window); + if ('hidden' !== S.visibility && !Gi(X) && !C(c, X)) { + d.set(J); + 'absolute' === S.position && d.set(11); + break; + } + } else + c === X && (T = !0); + } + }; + Hi(c) && d.set(9); + var C = function (D, J) { + return Ii(D, J) || Ii(J, D); + }; + f = q[0]; + c === f || C(c, f) || Gi(f) || d.set(2); + f = u[0]; + c === f || C(c, f) || Gi(f) || d.set(3); + f = B[0]; + c === f || C(c, f) || Gi(f) || d.set(4); + f = x[0]; + c === f || C(c, f) || Gi(f) || d.set(5); + if (Gi(c)) + return Dg(d); + a(q, 12); + a(u, 13); + a(B, 14); + a(x, 15); + a(z, 6); + return Dg(d); + }; + Bi = function (a) { + var b = !1, c = !1; + return Ji(a, function (d) { + c = c || 'scroll' === d.overflowX || 'auto' === d.overflowX; + return (b = b || 'flex' === d.display) && c; + }); + }; + Di = function (a, b, c) { + var d = (a = rg(a)) && ug(a, window), e = d ? 'absolute' !== d.position : !0, f = !1, g = a && a.parentElement, h = !1; + Ki(b, function (k) { + var l = k.style; + if (e) + if (h || (h = k === g)) + e = Li(k, _.r, !0, -1, -1); + else { + l = l && l.height; + var m = (l && _.t(l, 'endsWith').call(l, 'px') ? vi(l) : 0) >= c; + !l || m || 'string' === typeof l && _.t(Mi, 'includes').call(Mi, l) || (e = !1); + } + f || (k = ug(k, _.r), 'sticky' !== k.position && 'fixed' !== k.position) || (f = !0); + return !(f && !e); + }, 100); + return { + Od: e, + Pd: f + }; + }; + Ni = function (a, b, c) { + $f(b) && setTimeout(function () { + of('gpt_fluid_sz', function (d) { + var e = Bg(a, document); + e = e ? kg(e) : null; + I(d, 'sz', e ? e.width + 'x' + e.height : 'null'); + I(d, 'qqid', c); + }); + }, 250); + }; + Pi = function (a, b, c, d) { + var e = _.Oi('DIV'); + e.id = b; + e.name = b; + b = e.style; + b.border = '0pt none'; + c && (b.margin = 'auto', b.textAlign = 'center'); + d && (c = Array.isArray(d), b.width = c ? d[0] + 'px' : '100%', b.height = c ? d[1] + 'px' : '0%'); + a.appendChild(e); + return e; + }; + Si = function (a, b, c) { + var d = Qi; + c = _.Oi((void 0 === c ? 0 : c) ? 'fencedframe' : 'IFRAME'); + c.id = a; + c.title = d; + c.name = a; + Array.isArray(b) ? null != b[0] && null != b[1] && (c.width = String(b[0]), c.height = String(b[1])) : (c.width = '100%', c.height = '0'); + c.allowTransparency = 'true'; + c.scrolling = 'no'; + c.marginWidth = '0'; + c.marginHeight = '0'; + c.frameBorder = '0'; + c.style.border = '0'; + c.style.verticalAlign = 'bottom'; + _.H(Ri) && (c.setAttribute('role', 'region'), c.setAttribute('aria-label', 'Advertisement'), c.tabIndex = 0); + return c; + }; + bj = function (a, b, c, d, e, f, g, h, k, l, m, n, q, u, B, x, z) { + var C = _.Hg(Ti).hostpageLibraryTokens; + var D; + Array.isArray(e) ? D = new _.Ui(Number(e[0]), Number(e[1])) : D = 1; + e = null; + null !== d && (e = null === n ? Vi(d, '', 'sf') : '' + d + ''); + d = e; + g = { + zb: Yf(g, 1) ? !!E(g, 1) : !l, + Ab: Yf(g, 2) ? !!E(g, 2) : !1 + }; + l = !!ne().fifWin; + e = Wi(); + if (null == Xi) { + for (var J = Yi(Zi), T = [], aa = 0; aa < J.length; aa += 2) + $i(J[aa], J[aa + 1], T); + Xi = T.join('&'); + } + return new aj({ + wc: a, + Lc: b, + Jd: c, + content: d, + size: D, + xd: m, + Qc: f, + Yc: k || void 0, + permissions: g, + qb: l, + ne: e, + qd: Xi, + dd: !1, + hostpageLibraryTokens: C, + za: rf, + Sa: null === n ? void 0 : n, + uniqueId: u, + Rb: q, + Qb: h || void 0, + Cb: B || void 0, + pb: x || void 0, + $a: z || void 0 + }); + }; + cj = function (a) { + return 'sticky' === (null === a || void 0 === a ? void 0 : a.position) || 'fixed' === (null === a || void 0 === a ? void 0 : a.position); + }; + dj = function (a) { + Qi = a; + }; + ej = function (a, b) { + /^urn:uuid:[0-9a-fA-F-]*$/.test(b) && (b = ei(b), a.src = Za(b)); + }; + jj = function (a) { + switch (a.id) { + case 5: + return new fj(a); + case 6: + return new gj(a); + case 0: + return new hj(a); + default: + return new ij(a); + } + }; + kj = function (a) { + if (!bc(a)) + return -1; + a = a.pageYOffset; + return 0 > a ? -1 : a; + }; + mj = function (a) { + var b = { + threshold: [ + 0, + 0.3, + 0.5, + 0.75, + 1 + ] + }; + return window.IntersectionObserver ? new IntersectionObserver(a, b) : new lj(a, b); + }; + nj = function (a, b) { + return 'undefined' === typeof IntersectionObserver ? new lj(b, { rootMargin: a }) : new IntersectionObserver(b, { rootMargin: a }); + }; + oj = function (a, b) { + return a && (a = Wb(a, Qf, 1)) ? a.getWidth() || b.innerWidth : 0; + }; + pj = function (a, b) { + return a && (a = Wb(a, Qf, 1)) ? a.getHeight() || b.innerHeight : 0; + }; + qj = function (a) { + return a && (a = Wb(a, Qf, 2)) ? a.getWidth() || 0 : 0; + }; + rj = function (a) { + return a && (a = Wb(a, Qf, 2)) ? a.getHeight() || 0 : 0; + }; + sj = function (a, b, c) { + a = a.map(function (e) { + return b[e.getDomId()]; + }); + var d = a.some(function (e) { + return Yf(e, 16); + }); + return new v.Map([ + [ + 'rtgs', + { + value: d ? a.map(function (e) { + return Yf(e, 16) ? Xf(e).length ? '1' : '2' : '0'; + }) : null, + options: { ya: '!' } + } + ], + [ + 'max_w', + { + value: d ? a.map(function (e) { + return oj(Wb(e, th, 16), c); + }) : null, + options: { ya: '!' } + } + ], + [ + 'max_h', + { + value: d ? a.map(function (e) { + return pj(Wb(e, th, 16), c); + }) : null, + options: { ya: '!' } + } + ], + [ + 'min_w', + { + value: d ? a.map(function (e) { + return qj(Wb(e, th, 16)); + }) : null, + options: { ya: '!' } + } + ], + [ + 'min_h', + { + value: d ? a.map(function (e) { + return rj(Wb(e, th, 16)); + }) : null, + options: { ya: '!' } + } + ] + ]); + }; + jk = function (a, b, c, d, e, f, g) { + var h = new Qc(), k = Wf(!0, window), l = c.U, m = c.P[a.getDomId()], n = new tj(window); + N(h, n); + var q = d.Gd, u = d.ac, B = d.ld, x = d.yd, z = d.Md, C = d.ye, D = d.Hd, J = d.Dd, T = d.wb, aa = d.ze, X = d.Mc, S = d.xe, ca = d.Ce, ka = d.De, ea = d.Kd, xa = d.Ae, hb = d.yb, Pa = d.Bd, Db = d.ve, ic = d.ue, kh = d.be, jc = new uj(b, a, d.ob, d.tb, d.ja, d.Ee); + N(h, jc); + d = new vj(); + d.j(f); + f = new wj(); + f.notify(); + f = new xj(window.top, d, f); + N(h, f); + Pa = new yj(Pe(a.getAdUnitPath()), Pa, f.C); + N(h, Pa); + var tb = new zj(Nf(m), k.height, J, jc.ob); + N(h, tb); + Pa = new Aj(a, rg(a, e), a.getDomId(), Ag(a), e, Nf(m), b); + N(h, Pa); + var nb = new Bj(jc.ja, B, x, z, C); + N(h, nb); + C = new Cj(l, m, window, B, x, C); + N(h, C); + ca = new Dj(Wb(l, Ej, 5), ca); + N(h, ca); + tb = new Fj(a.getAdUnitPath(), m, k.width, window, T, jc.tb, tb.C, nb.ja, Pa.C); + N(h, tb); + T = new Gj(a, l, m, Nf(m), e, b, Pa.C, C.C, tb.o, q); + N(h, T); + nb = new Hj(T.C); + N(h, nb); + var Ed = new Ij(a, k, b, nb.C, ca.l); + N(h, Ed); + nb = new Jj(window, Pa.C); + N(h, nb); + ka = new Kj(Ed.C, T.C, ka, ca.l); + N(h, ka); + k = new Lj(e, a, m, k, q, Pa.C, T.C, tb.o, tb.wb, nb.C, u); + N(h, k); + ca = new Mj(ic); + N(h, ca); + ic = new Nj(ic, ca.C, tb.ja, tb.o); + N(h, ic); + C = new Oj(C.C, ic.ja); + N(h, C); + aa = new Pj(l, m, C.C, B, z, aa); + N(h, aa); + hb = new Qj(window, hb, n.C); + N(h, hb); + xa = new Rj(a, c, z, xa); + N(h, xa); + ca = new Sj(Db); + N(h, ca); + tb = new Tj(e); + N(h, tb); + Db = new Uj(Nf(m), J, D); + N(h, Db); + z = new Vj(a, b, c, g, window, ic.ja, xa.C, ka.C, Pa.C, T.C, ic.o, C.C, x, u, q, aa.C, z, X, S, k.C, hb.C, ca.C, tb.C, Db.C, jc.l); + N(h, z); + _.H(Wj) && (X = new Xj(window, a, z.B, d), N(h, X)); + J = new Yj(b, Nf(m), a, window, J, z.l, Pa.C, Db.C); + N(h, J); + c = new Zj(a, Nf(m), (0, F.H)(c.eb), D, z.l, Pa.C, f.C, Db.C); + N(h, c); + c = new ak(a, window, B, z.l, z.o); + N(h, c); + m = new bk(a, Nf(m), g, window, z.l, Pa.C); + N(h, m); + e = new ck(a, z.l, e, g); + N(h, e); + b = new dk(ek(b, a), window.top, z.l, n.C); + N(h, b); + a = new fk(a, u, q, x, B, S, z.l, T.C, z.o); + N(h, a); + ea = new gk(window, ea, z.l, T.C, Pa.C); + N(h, ea); + _.H(hk) && N(h, new ik(kh, ne(), l)); + return h; + }; + ok = function (a, b) { + var c; + return null !== (c = (L = Ub(a, kk, 2), _.t(L, 'find')).call(L, function (d) { + return lk(d, 1) === b; + })) && void 0 !== c ? c : mk(a, nk(new kk(), b)); + }; + pk = function (a, b, c) { + Yf(a, 3) || (c === b.getAdUnitPath() ? w(a, 3, 1) : c === b.getDomId() && w(a, 3, 2)); + }; + uk = function (a, b, c, d, e) { + var f, g, h, k, l, m, n, q, u = function (J, T) { + null !== d && void 0 !== d ? d : d = qk(c); + pk(d, e, T); + return ok(d, J); + }, B = !1, x = null !== (g = null === (f = null === a || void 0 === a ? void 0 : a.getEvents) || void 0 === f ? void 0 : f.call(a)) && void 0 !== g ? g : []; + x = _.y(x); + for (var z = x.next(); !z.done; z = x.next()) + switch (z = z.value, z.eventType) { + case 'bidRequested': + if (!Array.isArray(z.args) && Array.isArray(z.args.bids)) + for (var C = _.y(z.args.bids), D = C.next(); !D.done; D = C.next()) + D = D.value, D.bidder && D.adUnitCode && D.auctionId === b && (B || (B = !0), null === (h = u(D.bidder, D.adUnitCode)) || void 0 === h ? void 0 : rk(h, z.elapsedTime)); + break; + case 'bidResponse': + !Array.isArray(z.args) && z.args.bidder && z.args.adUnitCode && z.args.auctionId === b && (B || (B = !0), C = u(z.args.bidder, z.args.adUnitCode), null === C || void 0 === C ? void 0 : rk(C, z.elapsedTime - (null !== (k = null === C || void 0 === C ? void 0 : sk(C, 2)) && void 0 !== k ? k : 0)), null === C || void 0 === C ? void 0 : w(C, 4, 1)); + break; + case 'bidTimeout': + if (Array.isArray(z.args)) + for (z = _.y(z.args), D = z.next(); !D.done; D = z.next()) + C = D.value, C.bidder && C.adUnitCode && C.auctionId === b && (B || (B = !0), C = u(C.bidder, C.adUnitCode), null === C || void 0 === C ? void 0 : w(C, 4, 3), null === C || void 0 === C ? void 0 : rk(C, null !== (n = null === (m = null === (l = null === a || void 0 === a ? void 0 : a.getConfig) || void 0 === l ? void 0 : l.call(a)) || void 0 === m ? void 0 : m.bidderTimeout) && void 0 !== n ? n : 0)); + break; + case 'noBid': + !Array.isArray(z.args) && z.args.bidder && z.args.adUnitCode && z.args.auctionId === b && (B || (B = !0), C = u(z.args.bidder, z.args.adUnitCode), 3 !== (null === C || void 0 === C ? void 0 : tk(C, 4, 0)) && (null === C || void 0 === C ? void 0 : w(C, 4, 2), null === C || void 0 === C ? void 0 : rk(C, z.elapsedTime - (null !== (q = sk(C, 2)) && void 0 !== q ? q : 0)))); + } + return B; + }; + Dk = function (a, b, c) { + c = void 0 === c ? [] : c; + var d, e = new vk(); + 'number' === typeof a.cpm && w(e, 2, 1000000 * a.cpm); + 'string' === typeof a.currency && wk(e, (0, F.H)(a.currency)); + if ('number' === typeof a.dealId) { + var f = new xk(); + w(f, 1, String(a.dealId)); + zf(e, 6, f); + } + if (a.adserverTargeting && 'object' === typeof a.adserverTargeting) { + c = _.t(Object, 'fromEntries').call(Object, c.map(function (n) { + return [ + ch(n), + Oh(n, 2) + ]; + })); + f = _.y([ + '', + '_' + a.bidder + ]); + for (var g = f.next(); !g.done; g = f.next()) { + g = g.value; + for (var h = [], k = _.y(_.t(Object, 'entries').call(Object, a.adserverTargeting)), l = k.next(); !l.done; l = k.next()) { + var m = _.y(l.value); + l = m.next().value; + m = m.next().value; + l += g; + if (null !== (d = c[l]) && void 0 !== d && d.length) + if (c[l][0] === String(m)) + h.push(l); + else { + h = []; + break; + } + } + yk(e, Oh(e, 4).concat(h)); + } + } + switch (a.mediaType || 'banner') { + case 'banner': + w(e, 5, 1); + break; + case 'native': + w(e, 5, 2); + break; + case 'video': + w(e, 5, 3); + } + c = 'number' === typeof a.height ? a.height : void 0; + f = 'number' === typeof a.height ? a.width : void 0; + void 0 !== c && void 0 !== f && zk(e, Ak(Bk(f), c)); + 'string' === typeof a.adId && (Ck(e, (0, F.H)(a.adId)), b.set((0, F.H)(a.adId), { + height: c, + width: f, + adUrl: 'string' === typeof a.adUrl ? a.adUrl : void 0, + jd: 'string' === typeof a.ad ? a.ad : void 0, + format: tk(e, 5, 0), + cpm: Yf(e, 2) ? sk(e, 2) : void 0 + })); + return e; + }; + Ek = function (a, b) { + var c = new v.Map(), d = function (l) { + var m = c.get(l); + m || (m = {}, c.set(l, m)); + return m; + }; + a = _.y(a); + for (var e = a.next(); !e.done; e = a.next()) { + var f = e.value; + e = f.elapsedTime; + var g = f.args, h = g.bidId, k = g.bids; + if (g.auctionId === b) + switch (f.eventType) { + case 'bidRequested': + if (!Array.isArray(k)) + continue; + f = _.y(k); + for (g = f.next(); !g.done; g = f.next()) + if (g = g.value.bidId) + d(g).requestTime = e; + break; + case 'noBid': + h && (d(h).ie = e); + } + } + b = new v.Map(); + d = _.y(_.t(c, 'entries').call(c)); + for (a = d.next(); !a.done; a = d.next()) + e = _.y(a.value), a = e.next().value, f = e.next().value, e = f.requestTime, f = f.ie, e && f && b.set(a, f - e); + return b; + }; + Gk = function (a) { + var b = new Fk(); + b = Qb(b, 1, Date.now(), 0); + b = Qb(b, 2, a.ce, 0); + b = Qb(b, 3, a.ic, ''); + var c = Dc().m(); + b = yf(b, 4, c); + return Qb(b, 5, a.Td, 0); + }; + Lk = function (a, b) { + var c = Hk(); + if (a.Bc) { + var d = a.sb; + a = Gk(a); + var e = new Ik(); + b = Jk(e, 1, b); + c = Qb(b, 2, c, 0); + c = Ee(a, 6, Kk, c); + nc(d, c); + } + }; + Mk = function (a) { + of('gpt_fc_has_namespace_but_no_iframes', function (b) { + df(b); + I(b, 'networkId', a); + }, { pa: 1 }); + }; + Nk = function (a, b) { + return window.IntersectionObserver ? new IntersectionObserver(a, { rootMargin: b }) : new lj(a, { rootMargin: b }); + }; + Pk = function () { + if (Fa()) + var a = 0 <= Ok(Ha(), 11); + else + a = Ba(za()), Ga(a), a = Da() ? (a = a[2]) && a[1] || '' : '', '' === a ? a = NaN : (a = a.split('.'), a = 0 === a.length ? NaN : Number(a[0])), a = 65 <= a; + return a; + }; + Qk = function (a) { + var b = a, c = 0; + Ki(b, function (d) { + var e; + return 1 === (null === (e = d.parentElement) || void 0 === e ? void 0 : e.childElementCount) ? (b = d.parentElement, c++, !0) : !1; + }); + return { + pe: b, + depth: c + }; + }; + Sk = function () { + var a = void 0 === a ? window : a; + Rk = _.xc(a); + }; + Uk = function (a, b) { + a = a.map(function (c) { + return b[c.getDomId()]; + }); + a = new v.Map([ + [ + 'ists', + { + value: Eg(a, function (c) { + return 0 !== Nf(c); + }) || null + } + ], + [ + 'fas', + { + value: Fg(a, function (c) { + return Ah(Nf(c)); + }) + } + ] + ]); + (0, F.jb)(!_.H(Tk)); + return a; + }; + Vk = function (a) { + return new v.Map([[ + 'rbvs', + { + value: Eg(a, function (b) { + return 4 === Nf(b); + }) || null + } + ]]); + }; + Yk = function (a, b) { + var c = [], d = []; + a = _.y(a); + for (var e = a.next(); !e.done; e = a.next()) { + var f = void 0, g = void 0, h = void 0; + var k = b; + e = rg(e.value); + var l = Wk((null === e || void 0 === e ? void 0 : e.parentElement) && ug(e.parentElement, k) || null); + !l || 1 === l[0] && 1 === l[3] ? (l = null !== (h = null === e || void 0 === e ? void 0 : e.parentElement) && void 0 !== h ? h : null, h = null !== (g = lg(l)) && void 0 !== g ? g : new _.Ui(0, 0), Xk(h, l, k, 100), g = null !== (f = lg(e)) && void 0 !== f ? f : new _.Ui(0, 0), Xk(g, e, k, 1), -1 === h.height && (g.height = -1), k = h, g = f = g, f = k.width + 'x' + k.height, k = g.width + 'x' + g.height) : k = f = '-1x-1'; + c.push(f); + d.push(k); + } + return new v.Map([ + [ + 'psz', + { + value: c, + options: { ya: '|' } + } + ], + [ + 'msz', + { + value: d, + options: { ya: '|' } + } + ] + ]); + }; + Xk = function (a, b, c, d) { + try { + var e; + if (!(e = !b)) { + var f; + if (!(f = !Zk(b, c, d))) { + a: { + do { + var g = ug(b, c); + if (g && 'fixed' == g.position) { + var h = !1; + break a; + } + } while (b = b.parentElement); + h = !0; + } + f = !h; + } + e = f; + } + e && (a.height = -1); + } catch (k) { + a.width = -1, a.height = -1; + } + }; + dl = function (a) { + var b, c, d, e, f, g, h; + var k = a; + k = void 0 === k ? $k : k; + try { + var l = k.history.length; + } catch (ca) { + l = 0; + } + k = v.Map; + l = [ + 'u_his', + { value: l } + ]; + var m = [ + 'u_h', + { value: null === (b = a.screen) || void 0 === b ? void 0 : b.height } + ], n = [ + 'u_w', + { value: null === (c = a.screen) || void 0 === c ? void 0 : c.width } + ], q = [ + 'u_ah', + { value: null === (d = a.screen) || void 0 === d ? void 0 : d.availHeight } + ], u = [ + 'u_aw', + { value: null === (e = a.screen) || void 0 === e ? void 0 : e.availWidth } + ], B = [ + 'u_cd', + { value: null === (f = a.screen) || void 0 === f ? void 0 : f.colorDepth } + ], x = a; + x = void 0 === x ? _.r : x; + x = x.devicePixelRatio; + k = new k([ + l, + m, + n, + q, + u, + B, + [ + 'u_sd', + { value: 'number' === typeof x ? +x.toFixed(3) : null } + ], + [ + 'u_tz', + { value: -new Date().getTimezoneOffset() } + ] + ]); + if (_.H(al)) { + l = k.set; + var z, C, D, J, T; + try { + var aa = null !== (J = null === (D = null === (C = null === (z = a.external) || void 0 === z ? void 0 : z.zf) || void 0 === C ? void 0 : C.bind(a.external)) || void 0 === D ? void 0 : D('os-mode')) && void 0 !== J ? J : '', X = Number(null === (T = JSON.parse(aa)) || void 0 === T ? void 0 : T['os-mode']); + var S = 0 <= X ? X + 1 : null; + } catch (ca) { + S = null; + } + l.call(k, 'wsm', { value: S }); + } + _.H(bl) && (k.set('flash', { + value: cl(a), + options: { + ba: !1, + qa: !0 + } + }), k.set('dmc', { value: null !== (h = null === (g = a.navigator) || void 0 === g ? void 0 : g.deviceMemory) && void 0 !== h ? h : null })); + return k; + }; + el = function (a, b) { + return new v.Map([[ + 'click', + { value: !b && a.getClickUrl() ? a.getClickUrl() : null } + ]]); + }; + fl = function (a) { + return a ? new v.Map([ + [ + 'floc_id', + { value: a.id } + ], + [ + 'floc_ver', + { value: a.version } + ] + ]) : new v.Map([ + [ + 'floc_id', + { value: null } + ], + [ + 'floc_ver', + { value: null } + ] + ]); + }; + hl = function (a) { + if (_.H(gl)) + return new v.Map(); + var b = a.Wb, c = a.yc, d = 0 === a.sd; + return new v.Map([ + [ + 'adsid', + { value: d ? b : null } + ], + [ + 'pucrd', + { value: d ? c : null } + ], + [ + 'jar', + { value: a.oc } + ] + ]); + }; + kl = function (a, b) { + var c, d, e, f; + a = il(a) || new jl(); + var g = tk(a, 6, 2); + return new v.Map([ + [ + 'rdp', + { value: E(a, 1) ? '1' : null } + ], + [ + 'ltd', + { value: E(a, 9) ? '1' : null } + ], + [ + 'gdpr_consent', + { value: null !== (c = G(b, 2)) && void 0 !== c ? c : null } + ], + [ + 'gdpr', + { + value: Yf(b, 3) ? E(b, 3) ? '1' : '0' : null, + options: { qa: !0 } + } + ], + [ + 'addtl_consent', + { value: null !== (d = G(b, 4)) && void 0 !== d ? d : null } + ], + [ + 'tcfe', + { value: null !== (e = G(b, 7)) && void 0 !== e ? e : null } + ], + [ + 'us_privacy', + { value: null !== (f = G(b, 1)) && void 0 !== f ? f : null } + ], + [ + 'npa', + { value: E(b, 6) || E(a, 8) ? 1 : null } + ], + [ + 'tfua', + { + value: 2 !== g ? g : null, + options: { qa: !0 } + } + ], + [ + 'tfcd', + { + value: Yf(a, 5) ? G(a, 5) : null, + options: { qa: !0 } + } + ], + [ + 'trt', + { + value: Yf(a, 10) ? G(a, 10) : null, + options: { qa: !0 } + } + ], + [ + 'macr', + { + value: Yf(a, 11) ? tk(a, 11, 0) : null, + options: { qa: !0 } + } + ] + ]); + }; + nl = function (a, b, c) { + var d = window; + return new v.Map([ + [ + 'ris', + { + value: Fg(b, function (e) { + var f, g; + e = null !== (g = null === (f = a.j.get(e)) || void 0 === f ? void 0 : f.Pc) && void 0 !== g ? g : 0; + f = _.ll(d); + return Math.round(Math.min((e && f ? f - e : 0) / 1000, 1800)); + }, void 0, '~') + } + ], + [ + 'rcs', + { + value: Fg(b, function (e) { + if (!c) { + var f = void 0 === f ? _.r : f; + var g = a.j.get(e); + g && (g.Pc = _.ll(f) || 0, g.Wc++); + } + return ml(a, e); + }) + } + ] + ]); + }; + ol = function (a, b) { + var c = []; + a = a.map(function (d) { + return d.getAdUnitPath().replace(/,/g, ':').split('/').map(function (e) { + if (!e) + return ''; + var f = _.t(c, 'findIndex').call(c, function (g) { + return g === e; + }); + return 0 <= f ? f : c.push(e) - 1; + }).join('/'); + }); + return new v.Map([ + [ + 'iu_parts', + { value: c } + ], + [ + 'enc_prev_ius', + { value: a } + ], + [ + 'prev_iu_szs', + { + value: b.map(function (d) { + return Zf(d); + }) + } + ], + [ + 'fluid', + { + value: function () { + var d = !1, e = b.map(function (f) { + f = $f(f); + d || (d = f); + return f ? 'height' : '0'; + }); + return d ? e : null; + }() + } + ] + ]); + }; + pl = function (a, b, c) { + var d, e = E(a, 21); + return new v.Map([ + [ + 'hxva', + { + value: e ? 1 : null, + options: { ba: !1 } + } + ], + [ + 'cmsid', + { value: e ? G(a, 23) : null } + ], + [ + 'vid', + { value: e ? G(a, 22) : null } + ], + [ + 'pod', + { + value: isNaN(c) ? null : c, + options: { ba: !1 } + } + ], + [ + 'ppos', + { + value: isNaN(b) ? null : b, + options: { ba: !1 } + } + ], + [ + 'scor', + { + value: null !== (d = G(a, 29)) && void 0 !== d ? d : null, + options: { ba: !1 } + } + ] + ]); + }; + ql = function (a, b, c) { + return 'wbn' === a ? new v.Map([ + [ + 'wbsu', + { value: Xa((0, F.H)(b)).toString().replace(/^urn:uuid:/, '') } + ], + [ + 'callback', + { value: c } + ] + ]) : new v.Map(); + }; + rl = function (a) { + for (var b, c = {}, d = _.y(bh(a)), e = d.next(); !e.done; e = d.next()) + e = e.value, c[(0, F.H)(ch(e))] = Oh(e, 2); + a = Oh(a, 8); + a.length && (null !== (b = c.excl_cat) && void 0 !== b ? b : c.excl_cat = a); + return c; + }; + sl = function (a) { + a = rl(a); + var b = []; + _.ef(a, function (c, d) { + c.length && (c = c.map(encodeURIComponent), d = encodeURIComponent(d), b.push(d + '=' + c.join())); + }); + return b; + }; + tl = function (a) { + var b = !1, c = Ub(a, fh, 2).map(function (d) { + var e = (0, F.H)(ch(d)); + b = 'excl_cat' === e; + d = Oh(d, 2); + return encodeURIComponent(e) + '=' + encodeURIComponent(d.join()); + }); + a = Oh(a, 3); + !b && a.length && c.push(encodeURIComponent('excl_cat') + '=' + encodeURIComponent(a.join())); + return c; + }; + ul = function (a) { + var b; + if (null === (b = a.location) || void 0 === b ? 0 : b.ancestorOrigins) + return a.location.ancestorOrigins.length; + var c = 0; + ac(function () { + c++; + return !1; + }, !0, !0, a); + return c; + }; + xl = function (a, b) { + return !!vl(b.U) || a.some(function (c) { + return null !== wl(b.P[c.getDomId()]); + }); + }; + vl = function (a) { + var b; + return (null === (b = (L = Ub(a, fh, 14), _.t(L, 'find')).call(L, function (c) { + return 'page_url' === ch(c); + })) || void 0 === b ? void 0 : Oh(b, 2)[0]) || null; + }; + wl = function (a) { + var b; + return (null === (b = (L = Ub(a, fh, 3), _.t(L, 'find')).call(L, function (c) { + return 'page_url' === ch(c); + })) || void 0 === b ? void 0 : Oh(b, 2)[0]) || null; + }; + yl = function (a, b) { + return b ? encodeURIComponent(a.toString()) : a.toString(); + }; + Al = function (a, b) { + function c(g) { + var h = g; + return function () { + var k = gc.apply(0, arguments); + if (h) { + var l = h; + h = null; + l.apply(null, _.lc(k)); + } + }; + } + var d = null, e = 0, f = 0; + return function () { + var g, h, k, l; + return ib(function (m) { + if (1 == m.j) + return e && clearTimeout(e), e = 0, g = new Gd(), h = c(g.resolve), k = ++f, jb(m, 0, 2); + if (f !== k) + return h(!1), m.return(g.promise); + d ? d(!1) : h(!0); + l = c(function () { + d = null; + e = 0; + h(!0); + }); + e = setTimeout(l, a); + _.zl(b, function () { + return void h(!1); + }); + d = h; + return m.return(g.promise); + }); + }; + }; + El = function () { + oe('pubadsReady', !0); + if (_.H(Bl)) { + var a = 0; + Object.defineProperty(ne(), 'pubadsReady', { + get: function () { + M(Lh(), Cl()); + if (5 > a) { + var b = _.zc(Dl); + of('gpt_pubads_ready', function (c) { + var d; + ++a; + df(c); + var e = Error('pubadsReady'); + I(c, 'stack', Ze(null !== (d = e.stack) && void 0 !== d ? d : '', e.message)); + }, { pa: b }); + } + return !0; + }, + configurable: !0, + enumerable: !0 + }); + } + }; + Gl = function (a) { + return Qg(a, function () { + return new Fl(a, a.j); + }); + }; + Hl = function (a) { + return _.t(Object, 'assign').call(Object, _.t(Object, 'assign').call(Object, {}, a), _.t(Object, 'fromEntries').call(Object, _.t(Object, 'entries').call(Object, a).map(function (b) { + b = _.y(b); + var c = b.next().value; + return [ + b.next().value, + c + ]; + }))); + }; + Kl = function (a, b, c) { + var d = Il(b, c, void 0, !0), e = d.slotId; + d = d.Ja; + if (!e || !d) + return M(Lh(), Wg('PubAdsService.definePassback', [ + b, + c + ])), null; + w(d, 17, !0); + a.Ka(e, d); + return { + Sc: Gl(new Jl(e, a)), + Ja: d + }; + }; + Ml = function (a) { + return Qg(a, function () { + return new Ll(a); + }); + }; + pa = function (a, b) { + a = (0, F.va)(a[0]); + b = (0, F.va)(b[0]); + a: { + for (var c = na, d = Math.min(b.length, a.length), e = 0; e < d; e++) { + var f = c(b[e], a[e]); + if (0 != f) { + a = f; + break a; + } + } + a = na(b.length, a.length); + } + return a; + }; + Ol = function (a) { + return !!Mg(Nl, function (b) { + return b === a; + }); + }; + Ql = function (a, b, c) { + c = _.Hg(Jh).add(a, [ + 1, + 1 + ], { + Ra: c, + format: b + }); + a = c.slotId; + c = c.Ja; + if (a && c) { + if (5 === b && _.H(Pl)) + return null; + w(c, 15, b); + _.zl(a, function () { + var d = window, e = Ah(b); + if (null != e) { + d = _.Bh(d); + var f = d.adCount && d.adCount[e]; + f && (d.adCount[e] = f - 1); + } + }); + } + return null !== a && void 0 !== a ? a : null; + }; + Rl = function (a) { + var b = function () { + return a.Reflect.construct(a.HTMLElement, [], this.constructor); + }; + b.prototype = a.HTMLElement.prototype; + b.prototype.constructor = b; + _.t(Object, 'setPrototypeOf').call(Object, b, a.HTMLElement); + return b; + }; + $l = function () { + var a = window; + var b = void 0 === b ? rb : b; + var c; + if (a.customElements && null !== (c = a.Reflect) && void 0 !== c && c.construct && !a.customElements.get('google-product-ad')) { + var d = Rl(a), e = function () { + return d.apply(this, arguments) || this; + }; + _.O(e, d); + e.prototype.connectedCallback = function () { + var f = this.dataset.rendering; + if (f) { + try { + var g = Sl(Tl, Ul(f)); + } catch (l) { + } + if (null === g || void 0 === g ? 0 : Yf(g, 1)) { + var h = new Vl(); + h = Qb(h, 4, 1, 0); + h = Qb(h, 2, 7, 0); + f = We(); + h = Qb(h, 3, f, ''); + f = Wb(g, Wl, 1); + h = zf(h, 5, f); + var k = Jk(h, 6, !0); + } else + Lh().error(Xl('invalid data-rendering attribute')); + h = null === g || void 0 === g ? void 0 : lk(g, 2); + } else + Lh().error(Xl('missing data-rendering attribute')); + (g = k) && b(Yl(window, g)); + h && Zl(h); + }; + a.customElements.define('google-product-ad', e); + } + }; + dm = function () { + for (var a = _.y(_.t(Array, 'from').call(Array, document.getElementsByTagName('script'))), b = a.next(); !b.done; b = a.next()) { + var c = b.value; + b = c; + var d = c.src; + if (d && (-1 != d.indexOf('/tag/js/gpt.js') || -1 != d.indexOf('/tag/js/gpt_mobile.js')) && !b.googletag_executed && c.textContent) { + b.googletag_executed = !0; + b = document.createElement('script'); + d = void 0; + c = c.textContent; + var e = null === (d = Ka()) || void 0 === d ? void 0 : d.createScript(c); + c = new am(null !== e && void 0 !== e ? e : c, _.Ma); + if (c instanceof bm) + if (c instanceof am) + c = c.j; + else + throw Error(''); + else + c = c instanceof cm && c.constructor === cm ? c.j : 'type_error:SafeScript'; + b.textContent = c; + ab(b); + document.head.appendChild(b); + document.head.removeChild(b); + } + } + }; + gm = function (a) { + var b = []; + b = _.Hg(Jh); + b = [].concat(_.lc(b.ca)).slice(); + if (a) { + if (!Array.isArray(a)) + return M(Lh(), Wg('googletag.destroySlots', [a])), !1; + ma(a); + b = b.filter(function (c) { + return _.t(a, 'includes').call(a, c.j); + }); + } + if (!b.length) + return !1; + em(b); + fm(b); + return !0; + }; + hm = function () { + var a, b; + try { + dm(); + } catch (c) { + rf(297, c), null === (b = null === (a = window.console) || void 0 === a ? void 0 : a.error) || void 0 === b ? void 0 : b.call(a, c); + } + }; + om = function () { + var a = window, b = new im(a); + Kg(b).then(_.mf(894, function (c) { + of('cmpMet', function (d) { + df(d); + var e = new jm(a), f = new km(a); + I(d, 'fc', Number(null !== c && void 0 !== c ? c : 0)); + I(d, 'tcfv1', a.__cmp ? 1 : 0); + I(d, 'tcfv2', lm(e) ? 1 : 0); + I(d, 'usp', mm(f) ? 1 : 0); + I(d, 'ptt', 17); + }, { pa: _.zc(nm) }); + })); + }; + rm = function () { + var a = We(), b = Cc(window), c = new pm(), d = _.zc(qm); + return { + ic: a, + ce: b, + sb: c, + Bc: 0 < d && Hd() < 1 / d, + Td: d + }; + }; + sm = function (a) { + var b = 0; + return function () { + return b < a.length ? { + done: !1, + value: a[b++] + } : { done: !0 }; + }; + }; + tm = 'function' == typeof Object.defineProperties ? Object.defineProperty : function (a, b, c) { + if (a == Array.prototype || a == Object.prototype) + return a; + a[b] = c.value; + return a; + }; + um = function (a) { + a = [ + 'object' == typeof globalThis && globalThis, + a, + 'object' == typeof window && window, + 'object' == typeof self && self, + 'object' == typeof global && global + ]; + for (var b = 0; b < a.length; ++b) { + var c = a[b]; + if (c && c.Math == Math) + return c; + } + throw Error('Cannot find global object'); + }; + vm = um(this); + wm = 'function' === typeof Symbol && 'symbol' === typeof Symbol('x'); + v = {}; + xm = {}; + _.t = function (a, b) { + var c = xm[b]; + if (null == c) + return a[b]; + c = a[c]; + return void 0 !== c ? c : a[b]; + }; + ym = function (a, b, c) { + if (b) + a: { + var d = a.split('.'); + a = 1 === d.length; + var e = d[0], f; + !a && e in v ? f = v : f = vm; + for (e = 0; e < d.length - 1; e++) { + var g = d[e]; + if (!(g in f)) + break a; + f = f[g]; + } + d = d[d.length - 1]; + c = wm && 'es6' === c ? f[d] : null; + b = b(c); + null != b && (a ? tm(v, d, { + configurable: !0, + writable: !0, + value: b + }) : b !== c && (void 0 === xm[d] && (a = 1000000000 * Math.random() >>> 0, xm[d] = wm ? vm.Symbol(d) : '$jscp$' + a + '$' + d), tm(f, xm[d], { + configurable: !0, + writable: !0, + value: b + }))); + } + }; + ym('Symbol', function (a) { + if (a) + return a; + var b = function (f, g) { + this.j = f; + tm(this, 'description', { + configurable: !0, + writable: !0, + value: g + }); + }; + b.prototype.toString = function () { + return this.j; + }; + var c = 'jscomp_symbol_' + (1000000000 * Math.random() >>> 0) + '_', d = 0, e = function (f) { + if (this instanceof e) + throw new TypeError('Symbol is not a constructor'); + return new b(c + (f || '') + '_' + d++, f); + }; + return e; + }, 'es6'); + ym('Symbol.iterator', function (a) { + if (a) + return a; + a = (0, v.Symbol)('Symbol.iterator'); + for (var b = 'Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' '), c = 0; c < b.length; c++) { + var d = vm[b[c]]; + 'function' === typeof d && 'function' != typeof d.prototype[a] && tm(d.prototype, a, { + configurable: !0, + writable: !0, + value: function () { + return zm(sm(this)); + } + }); + } + return a; + }, 'es6'); + zm = function (a) { + a = { next: a }; + a[_.t(v.Symbol, 'iterator')] = function () { + return this; + }; + return a; + }; + P = function (a) { + return a.raw = a; + }; + _.y = function (a) { + var b = 'undefined' != typeof v.Symbol && _.t(v.Symbol, 'iterator') && a[_.t(v.Symbol, 'iterator')]; + return b ? b.call(a) : { next: sm(a) }; + }; + Am = function (a) { + for (var b, c = []; !(b = a.next()).done;) + c.push(b.value); + return c; + }; + _.lc = function (a) { + return a instanceof Array ? a : Am(_.y(a)); + }; + Bm = 'function' == typeof Object.create ? Object.create : function (a) { + var b = function () { + }; + b.prototype = a; + return new b(); + }; + Cm = function () { + function a() { + function c() { + } + new c(); + _.t(v.Reflect, 'construct').call(v.Reflect, c, [], function () { + }); + return new c() instanceof c; + } + if (wm && 'undefined' != typeof v.Reflect && _.t(v.Reflect, 'construct')) { + if (a()) + return _.t(v.Reflect, 'construct'); + var b = _.t(v.Reflect, 'construct'); + return function (c, d, e) { + c = b(c, d); + e && _.t(v.Reflect, 'setPrototypeOf').call(v.Reflect, c, e.prototype); + return c; + }; + } + return function (c, d, e) { + void 0 === e && (e = c); + e = Bm(e.prototype || Object.prototype); + return Function.prototype.apply.call(c, e, d) || e; + }; + }(); + if (wm && 'function' == typeof _.t(Object, 'setPrototypeOf')) + Dm = _.t(Object, 'setPrototypeOf'); + else { + var Em; + a: { + var Fm = { a: !0 }, Gm = {}; + try { + Gm.__proto__ = Fm; + Em = Gm.a; + break a; + } catch (a) { + } + Em = !1; + } + Dm = Em ? function (a, b) { + a.__proto__ = b; + if (a.__proto__ !== b) + throw new TypeError(a + ' is not extensible'); + return a; + } : null; + } + Hm = Dm; + _.O = function (a, b) { + a.prototype = Bm(b.prototype); + a.prototype.constructor = a; + if (Hm) + Hm(a, b); + else + for (var c in b) + if ('prototype' != c) + if (Object.defineProperties) { + var d = Object.getOwnPropertyDescriptor(b, c); + d && Object.defineProperty(a, c, d); + } else + a[c] = b[c]; + a.Vf = b.prototype; + }; + Im = function () { + this.l = !1; + this.A = null; + this.m = void 0; + this.j = 1; + this.B = this.F = 0; + this.D = null; + }; + Jm = function (a) { + if (a.l) + throw new TypeError('Generator is already running'); + a.l = !0; + }; + Im.prototype.o = function (a) { + this.m = a; + }; + var Km = function (a, b) { + a.D = { + Ic: b, + Nd: !0 + }; + a.j = a.F || a.B; + }; + Im.prototype.return = function (a) { + this.D = { return: a }; + this.j = this.B; + }; + var jb = function (a, b, c) { + a.j = c; + return { value: b }; + }, Lm = function (a) { + a.j = 0; + }, lb = function (a, b) { + a.j = b; + a.F = 0; + }, mb = function (a) { + a.F = 0; + var b = a.D.Ic; + a.D = null; + return b; + }, Mm = function (a) { + this.j = new Im(); + this.m = a; + }, Pm = function (a, b) { + Jm(a.j); + var c = a.j.A; + if (c) + return Nm(a, 'return' in c ? c['return'] : function (d) { + return { + value: d, + done: !0 + }; + }, b, a.j.return); + a.j.return(b); + return Om(a); + }, Nm = function (a, b, c, d) { + try { + var e = b.call(a.j.A, c); + if (!(e instanceof Object)) + throw new TypeError('Iterator result ' + e + ' is not an object'); + if (!e.done) + return a.j.l = !1, e; + var f = e.value; + } catch (g) { + return a.j.A = null, Km(a.j, g), Om(a); + } + a.j.A = null; + d.call(a.j, f); + return Om(a); + }, Om = function (a) { + for (; a.j.j;) + try { + var b = a.m(a.j); + if (b) + return a.j.l = !1, { + value: b.value, + done: !1 + }; + } catch (c) { + a.j.m = void 0, Km(a.j, c); + } + a.j.l = !1; + if (a.j.D) { + b = a.j.D; + a.j.D = null; + if (b.Nd) + throw b.Ic; + return { + value: b.return, + done: !0 + }; + } + return { + value: void 0, + done: !0 + }; + }, Qm = function (a) { + this.next = function (b) { + Jm(a.j); + a.j.A ? b = Nm(a, a.j.A.next, b, a.j.o) : (a.j.o(b), b = Om(a)); + return b; + }; + this.throw = function (b) { + Jm(a.j); + a.j.A ? b = Nm(a, a.j.A['throw'], b, a.j.o) : (Km(a.j, b), b = Om(a)); + return b; + }; + this.return = function (b) { + return Pm(a, b); + }; + this[_.t(v.Symbol, 'iterator')] = function () { + return this; + }; + }, Rm = function (a) { + function b(d) { + return a.next(d); + } + function c(d) { + return a.throw(d); + } + return new v.Promise(function (d, e) { + function f(g) { + g.done ? d(g.value) : v.Promise.resolve(g.value).then(b, c).then(f, e); + } + f(a.next()); + }); + }, ib = function (a) { + return Rm(new Qm(new Mm(a))); + }, gc = function () { + for (var a = Number(this), b = [], c = a; c < arguments.length; c++) + b[c - a] = arguments[c]; + return b; + }; + ym('Reflect', function (a) { + return a ? a : {}; + }, 'es6'); + ym('Reflect.construct', function () { + return Cm; + }, 'es6'); + ym('Reflect.setPrototypeOf', function (a) { + return a ? a : Hm ? function (b, c) { + try { + return Hm(b, c), !0; + } catch (d) { + return !1; + } + } : null; + }, 'es6'); + ym('Promise', function (a) { + function b() { + this.j = null; + } + function c(g) { + return g instanceof e ? g : new e(function (h) { + h(g); + }); + } + if (a) + return a; + b.prototype.m = function (g) { + if (null == this.j) { + this.j = []; + var h = this; + this.F(function () { + h.D(); + }); + } + this.j.push(g); + }; + var d = vm.setTimeout; + b.prototype.F = function (g) { + d(g, 0); + }; + b.prototype.D = function () { + for (; this.j && this.j.length;) { + var g = this.j; + this.j = []; + for (var h = 0; h < g.length; ++h) { + var k = g[h]; + g[h] = null; + try { + k(); + } catch (l) { + this.A(l); + } + } + } + this.j = null; + }; + b.prototype.A = function (g) { + this.F(function () { + throw g; + }); + }; + var e = function (g) { + this.m = 0; + this.F = void 0; + this.j = []; + this.o = !1; + var h = this.A(); + try { + g(h.resolve, h.reject); + } catch (k) { + h.reject(k); + } + }; + e.prototype.A = function () { + function g(l) { + return function (m) { + k || (k = !0, l.call(h, m)); + }; + } + var h = this, k = !1; + return { + resolve: g(this.T), + reject: g(this.D) + }; + }; + e.prototype.T = function (g) { + if (g === this) + this.D(new TypeError('A Promise cannot resolve to itself')); + else if (g instanceof e) + this.J(g); + else { + a: + switch (typeof g) { + case 'object': + var h = null != g; + break a; + case 'function': + h = !0; + break a; + default: + h = !1; + } + h ? this.R(g) : this.l(g); + } + }; + e.prototype.R = function (g) { + var h = void 0; + try { + h = g.then; + } catch (k) { + this.D(k); + return; + } + 'function' == typeof h ? this.N(h, g) : this.l(g); + }; + e.prototype.D = function (g) { + this.B(2, g); + }; + e.prototype.l = function (g) { + this.B(1, g); + }; + e.prototype.B = function (g, h) { + if (0 != this.m) + throw Error('Cannot settle(' + g + ', ' + h + '): Promise already settled in state' + this.m); + this.m = g; + this.F = h; + 2 === this.m && this.G(); + this.M(); + }; + e.prototype.G = function () { + var g = this; + d(function () { + if (g.ia()) { + var h = vm.console; + 'undefined' !== typeof h && h.error(g.F); + } + }, 1); + }; + e.prototype.ia = function () { + if (this.o) + return !1; + var g = vm.CustomEvent, h = vm.Event, k = vm.dispatchEvent; + if ('undefined' === typeof k) + return !0; + 'function' === typeof g ? g = new g('unhandledrejection', { cancelable: !0 }) : 'function' === typeof h ? g = new h('unhandledrejection', { cancelable: !0 }) : (g = vm.document.createEvent('CustomEvent'), g.initCustomEvent('unhandledrejection', !1, !0, g)); + g.promise = this; + g.reason = this.F; + return k(g); + }; + e.prototype.M = function () { + if (null != this.j) { + for (var g = 0; g < this.j.length; ++g) + f.m(this.j[g]); + this.j = null; + } + }; + var f = new b(); + e.prototype.J = function (g) { + var h = this.A(); + g.xb(h.resolve, h.reject); + }; + e.prototype.N = function (g, h) { + var k = this.A(); + try { + g.call(h, k.resolve, k.reject); + } catch (l) { + k.reject(l); + } + }; + e.prototype.then = function (g, h) { + function k(q, u) { + return 'function' == typeof q ? function (B) { + try { + l(q(B)); + } catch (x) { + m(x); + } + } : u; + } + var l, m, n = new e(function (q, u) { + l = q; + m = u; + }); + this.xb(k(g, l), k(h, m)); + return n; + }; + e.prototype.catch = function (g) { + return this.then(void 0, g); + }; + e.prototype.xb = function (g, h) { + function k() { + switch (l.m) { + case 1: + g(l.F); + break; + case 2: + h(l.F); + break; + default: + throw Error('Unexpected state: ' + l.m); + } + } + var l = this; + null == this.j ? f.m(k) : this.j.push(k); + this.o = !0; + }; + e.resolve = c; + e.reject = function (g) { + return new e(function (h, k) { + k(g); + }); + }; + e.race = function (g) { + return new e(function (h, k) { + for (var l = _.y(g), m = l.next(); !m.done; m = l.next()) + c(m.value).xb(h, k); + }); + }; + e.all = function (g) { + var h = _.y(g), k = h.next(); + return k.done ? c([]) : new e(function (l, m) { + function n(B) { + return function (x) { + q[B] = x; + u--; + 0 == u && l(q); + }; + } + var q = [], u = 0; + do + q.push(void 0), u++, c(k.value).xb(n(q.length - 1), m), k = h.next(); + while (!k.done); + }); + }; + return e; + }, 'es6'); + ym('Object.setPrototypeOf', function (a) { + return a || Hm; + }, 'es6'); + var Sm = function (a, b) { + return Object.prototype.hasOwnProperty.call(a, b); + }, Tm = wm && 'function' == typeof _.t(Object, 'assign') ? _.t(Object, 'assign') : function (a, b) { + for (var c = 1; c < arguments.length; c++) { + var d = arguments[c]; + if (d) + for (var e in d) + Sm(d, e) && (a[e] = d[e]); + } + return a; + }; + ym('Object.assign', function (a) { + return a || Tm; + }, 'es6'); + ym('WeakMap', function (a) { + function b() { + } + function c(g) { + var h = typeof g; + return 'object' === h && null !== g || 'function' === h; + } + if (function () { + if (!a || !Object.seal) + return !1; + try { + var g = Object.seal({}), h = Object.seal({}), k = new a([ + [ + g, + 2 + ], + [ + h, + 3 + ] + ]); + if (2 != k.get(g) || 3 != k.get(h)) + return !1; + k.delete(g); + k.set(h, 4); + return !k.has(g) && 4 == k.get(h); + } catch (l) { + return !1; + } + }()) + return a; + var d = '$jscomp_hidden_' + Math.random(), e = 0, f = function (g) { + this.j = (e += Math.random() + 1).toString(); + if (g) { + g = _.y(g); + for (var h; !(h = g.next()).done;) + h = h.value, this.set(h[0], h[1]); + } + }; + f.prototype.set = function (g, h) { + if (!c(g)) + throw Error('Invalid WeakMap key'); + if (!Sm(g, d)) { + var k = new b(); + tm(g, d, { value: k }); + } + if (!Sm(g, d)) + throw Error('WeakMap key fail: ' + g); + g[d][this.j] = h; + return this; + }; + f.prototype.get = function (g) { + return c(g) && Sm(g, d) ? g[d][this.j] : void 0; + }; + f.prototype.has = function (g) { + return c(g) && Sm(g, d) && Sm(g[d], this.j); + }; + f.prototype.delete = function (g) { + return c(g) && Sm(g, d) && Sm(g[d], this.j) ? delete g[d][this.j] : !1; + }; + return f; + }, 'es6'); + ym('Map', function (a) { + if (function () { + if (!a || 'function' != typeof a || !_.t(a.prototype, 'entries') || 'function' != typeof Object.seal) + return !1; + try { + var h = Object.seal({ x: 4 }), k = new a(_.y([[ + h, + 's' + ]])); + if ('s' != k.get(h) || 1 != k.size || k.get({ x: 4 }) || k.set({ x: 4 }, 't') != k || 2 != k.size) + return !1; + var l = _.t(k, 'entries').call(k), m = l.next(); + if (m.done || m.value[0] != h || 's' != m.value[1]) + return !1; + m = l.next(); + return m.done || 4 != m.value[0].x || 't' != m.value[1] || !l.next().done ? !1 : !0; + } catch (n) { + return !1; + } + }()) + return a; + var b = new v.WeakMap(), c = function (h) { + this.m = {}; + this.j = f(); + this.size = 0; + if (h) { + h = _.y(h); + for (var k; !(k = h.next()).done;) + k = k.value, this.set(k[0], k[1]); + } + }; + c.prototype.set = function (h, k) { + h = 0 === h ? 0 : h; + var l = d(this, h); + l.list || (l.list = this.m[l.id] = []); + l.oa ? l.oa.value = k : (l.oa = { + next: this.j, + Ia: this.j.Ia, + head: this.j, + key: h, + value: k + }, l.list.push(l.oa), this.j.Ia.next = l.oa, this.j.Ia = l.oa, this.size++); + return this; + }; + c.prototype.delete = function (h) { + h = d(this, h); + return h.oa && h.list ? (h.list.splice(h.index, 1), h.list.length || delete this.m[h.id], h.oa.Ia.next = h.oa.next, h.oa.next.Ia = h.oa.Ia, h.oa.head = null, this.size--, !0) : !1; + }; + c.prototype.clear = function () { + this.m = {}; + this.j = this.j.Ia = f(); + this.size = 0; + }; + c.prototype.has = function (h) { + return !!d(this, h).oa; + }; + c.prototype.get = function (h) { + return (h = d(this, h).oa) && h.value; + }; + c.prototype.entries = function () { + return e(this, function (h) { + return [ + h.key, + h.value + ]; + }); + }; + c.prototype.keys = function () { + return e(this, function (h) { + return h.key; + }); + }; + c.prototype.values = function () { + return e(this, function (h) { + return h.value; + }); + }; + c.prototype.forEach = function (h, k) { + for (var l = _.t(this, 'entries').call(this), m; !(m = l.next()).done;) + m = m.value, h.call(k, m[1], m[0], this); + }; + c.prototype[_.t(v.Symbol, 'iterator')] = _.t(c.prototype, 'entries'); + var d = function (h, k) { + var l = k && typeof k; + 'object' == l || 'function' == l ? b.has(k) ? l = b.get(k) : (l = '' + ++g, b.set(k, l)) : l = 'p_' + k; + var m = h.m[l]; + if (m && Sm(h.m, l)) + for (h = 0; h < m.length; h++) { + var n = m[h]; + if (k !== k && n.key !== n.key || k === n.key) + return { + id: l, + list: m, + index: h, + oa: n + }; + } + return { + id: l, + list: m, + index: -1, + oa: void 0 + }; + }, e = function (h, k) { + var l = h.j; + return zm(function () { + if (l) { + for (; l.head != h.j;) + l = l.Ia; + for (; l.next != l.head;) + return l = l.next, { + done: !1, + value: k(l) + }; + l = null; + } + return { + done: !0, + value: void 0 + }; + }); + }, f = function () { + var h = {}; + return h.Ia = h.next = h.head = h; + }, g = 0; + return c; + }, 'es6'); + var Um = function (a, b, c) { + if (null == a) + throw new TypeError('The \'this\' value for String.prototype.' + c + ' must not be null or undefined'); + if (b instanceof RegExp) + throw new TypeError('First argument to String.prototype.' + c + ' must not be a regular expression'); + return a + ''; + }; + ym('String.prototype.endsWith', function (a) { + return a ? a : function (b, c) { + var d = Um(this, b, 'endsWith'); + void 0 === c && (c = d.length); + c = Math.max(0, Math.min(c | 0, d.length)); + for (var e = b.length; 0 < e && 0 < c;) + if (d[--c] != b[--e]) + return !1; + return 0 >= e; + }; + }, 'es6'); + var Vm = function (a, b, c) { + a instanceof String && (a = String(a)); + for (var d = a.length, e = 0; e < d; e++) { + var f = a[e]; + if (b.call(c, f, e, a)) + return { + i: e, + ed: f + }; + } + return { + i: -1, + ed: void 0 + }; + }; + ym('Array.prototype.find', function (a) { + return a ? a : function (b, c) { + return Vm(this, b, c).ed; + }; + }, 'es6'); + var Wm = function (a, b) { + a instanceof String && (a += ''); + var c = 0, d = !1, e = { + next: function () { + if (!d && c < a.length) { + var f = c++; + return { + value: b(f, a[f]), + done: !1 + }; + } + d = !0; + return { + done: !0, + value: void 0 + }; + } + }; + e[_.t(v.Symbol, 'iterator')] = function () { + return e; + }; + return e; + }; + ym('Array.prototype.entries', function (a) { + return a ? a : function () { + return Wm(this, function (b, c) { + return [ + b, + c + ]; + }); + }; + }, 'es6'); + ym('String.prototype.startsWith', function (a) { + return a ? a : function (b, c) { + var d = Um(this, b, 'startsWith'), e = d.length, f = b.length; + c = Math.max(0, Math.min(c | 0, d.length)); + for (var g = 0; g < f && c < e;) + if (d[c++] != b[g++]) + return !1; + return g >= f; + }; + }, 'es6'); + ym('Number.isFinite', function (a) { + return a ? a : function (b) { + return 'number' !== typeof b ? !1 : !isNaN(b) && Infinity !== b && -Infinity !== b; + }; + }, 'es6'); + ym('globalThis', function (a) { + return a || vm; + }, 'es_2020'); + ym('Array.prototype.findIndex', function (a) { + return a ? a : function (b, c) { + return Vm(this, b, c).i; + }; + }, 'es6'); + ym('Set', function (a) { + if (function () { + if (!a || 'function' != typeof a || !_.t(a.prototype, 'entries') || 'function' != typeof Object.seal) + return !1; + try { + var c = Object.seal({ x: 4 }), d = new a(_.y([c])); + if (!d.has(c) || 1 != d.size || d.add(c) != d || 1 != d.size || d.add({ x: 4 }) != d || 2 != d.size) + return !1; + var e = _.t(d, 'entries').call(d), f = e.next(); + if (f.done || f.value[0] != c || f.value[1] != c) + return !1; + f = e.next(); + return f.done || f.value[0] == c || 4 != f.value[0].x || f.value[1] != f.value[0] ? !1 : e.next().done; + } catch (g) { + return !1; + } + }()) + return a; + var b = function (c) { + this.j = new v.Map(); + if (c) { + c = _.y(c); + for (var d; !(d = c.next()).done;) + this.add(d.value); + } + this.size = this.j.size; + }; + b.prototype.add = function (c) { + c = 0 === c ? 0 : c; + this.j.set(c, c); + this.size = this.j.size; + return this; + }; + b.prototype.delete = function (c) { + c = this.j.delete(c); + this.size = this.j.size; + return c; + }; + b.prototype.clear = function () { + this.j.clear(); + this.size = 0; + }; + b.prototype.has = function (c) { + return this.j.has(c); + }; + b.prototype.entries = function () { + return _.t(this.j, 'entries').call(this.j); + }; + b.prototype.values = function () { + return _.t(this.j, 'values').call(this.j); + }; + b.prototype.keys = _.t(b.prototype, 'values'); + b.prototype[_.t(v.Symbol, 'iterator')] = _.t(b.prototype, 'values'); + b.prototype.forEach = function (c, d) { + var e = this; + this.j.forEach(function (f) { + return c.call(d, f, f, e); + }); + }; + return b; + }, 'es6'); + ym('Object.entries', function (a) { + return a ? a : function (b) { + var c = [], d; + for (d in b) + Sm(b, d) && c.push([ + d, + b[d] + ]); + return c; + }; + }, 'es8'); + ym('Array.prototype.keys', function (a) { + return a ? a : function () { + return Wm(this, function (b) { + return b; + }); + }; + }, 'es6'); + ym('Array.from', function (a) { + return a ? a : function (b, c, d) { + c = null != c ? c : function (h) { + return h; + }; + var e = [], f = 'undefined' != typeof v.Symbol && _.t(v.Symbol, 'iterator') && b[_.t(v.Symbol, 'iterator')]; + if ('function' == typeof f) { + b = f.call(b); + for (var g = 0; !(f = b.next()).done;) + e.push(c.call(d, f.value, g++)); + } else + for (f = b.length, g = 0; g < f; g++) + e.push(c.call(d, b[g], g)); + return e; + }; + }, 'es6'); + ym('Array.prototype.values', function (a) { + return a ? a : function () { + return Wm(this, function (b, c) { + return c; + }); + }; + }, 'es8'); + ym('Object.values', function (a) { + return a ? a : function (b) { + var c = [], d; + for (d in b) + Sm(b, d) && c.push(b[d]); + return c; + }; + }, 'es8'); + ym('Object.is', function (a) { + return a ? a : function (b, c) { + return b === c ? 0 !== b || 1 / b === 1 / c : b !== b && c !== c; + }; + }, 'es6'); + ym('Array.prototype.includes', function (a) { + return a ? a : function (b, c) { + var d = this; + d instanceof String && (d = String(d)); + var e = d.length; + c = c || 0; + for (0 > c && (c = Math.max(c + e, 0)); c < e; c++) { + var f = d[c]; + if (f === b || _.t(Object, 'is').call(Object, f, b)) + return !0; + } + return !1; + }; + }, 'es7'); + ym('String.prototype.includes', function (a) { + return a ? a : function (b, c) { + return -1 !== Um(this, b, 'includes').indexOf(b, c || 0); + }; + }, 'es6'); + ym('Number.isInteger', function (a) { + return a ? a : function (b) { + return _.t(Number, 'isFinite').call(Number, b) ? b === Math.floor(b) : !1; + }; + }, 'es6'); + ym('Object.fromEntries', function (a) { + return a ? a : function (b) { + var c = {}; + if (!(_.t(v.Symbol, 'iterator') in b)) + throw new TypeError('' + b + ' is not iterable'); + b = b[_.t(v.Symbol, 'iterator')].call(b); + for (var d = b.next(); !d.done; d = b.next()) { + d = d.value; + if (Object(d) !== d) + throw new TypeError('iterable for fromEntries should yield objects'); + c[d[0]] = d[1]; + } + return c; + }; + }, 'es_2019'); + ym('Number.isNaN', function (a) { + return a ? a : function (b) { + return 'number' === typeof b && isNaN(b); + }; + }, 'es6'); + _.r = this || self; + Xm = function (a) { + a.Ua = void 0; + a.O = function () { + return a.Ua ? a.Ua : a.Ua = new a(); + }; + }; + ah = function (a) { + var b = typeof a; + b = 'object' != b ? b : a ? Array.isArray(a) ? 'array' : b : 'null'; + return 'array' == b || 'object' == b && 'number' == typeof a.length; + }; + _.ja = function (a) { + var b = typeof a; + return 'object' == b && null != a || 'function' == b; + }; + la = function (a) { + return Object.prototype.hasOwnProperty.call(a, Ym) && a[Ym] || (a[Ym] = ++Zm); + }; + Ym = 'closure_uid_' + (1000000000 * Math.random() >>> 0); + Zm = 0; + $m = function (a, b, c) { + return a.call.apply(a.bind, arguments); + }; + an = function (a, b, c) { + if (!a) + throw Error(); + if (2 < arguments.length) { + var d = Array.prototype.slice.call(arguments, 2); + return function () { + var e = Array.prototype.slice.call(arguments); + Array.prototype.unshift.apply(e, d); + return a.apply(b, e); + }; + } + return function () { + return a.apply(b, arguments); + }; + }; + _.bn = function (a, b, c) { + Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf('native code') ? _.bn = $m : _.bn = an; + return _.bn.apply(null, arguments); + }; + _.cn = function (a, b) { + var c = Array.prototype.slice.call(arguments, 1); + return function () { + var d = c.slice(); + d.push.apply(d, arguments); + return a.apply(this, d); + }; + }; + xd = function () { + return Date.now(); + }; + var dn; + var ed = function (a, b) { + this.j = a === en && b || ''; + this.m = fn; + }; + ed.prototype.Ha = !0; + ed.prototype.Ea = function () { + return this.j; + }; + var fd = function (a) { + return a instanceof ed && a.constructor === ed && a.m === fn ? a.j : 'type_error:Const'; + }, gn = function (a) { + return new ed(en, a); + }, fn = {}, en = {}; + var qb = gn('https://tpc.googlesyndication.com/sodar/%{basename}.js'); + var jn; + _.da = function (a, b) { + return Array.prototype.indexOf.call(a, b, void 0); + }; + _.hn = function (a, b) { + Array.prototype.forEach.call(a, b, void 0); + }; + _.Cd = function (a, b) { + return Array.prototype.filter.call(a, b, void 0); + }; + _.Ad = function (a, b) { + return Array.prototype.map.call(a, b, void 0); + }; + jn = function (a, b) { + return Array.prototype.reduce.call(a, b, 0); + }; + _.Rd = function (a, b) { + return Array.prototype.some.call(a, b, void 0); + }; + var wa = 'constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf'.split(' '); + var qd = { + area: !0, + base: !0, + br: !0, + col: !0, + command: !0, + embed: !0, + hr: !0, + img: !0, + input: !0, + keygen: !0, + link: !0, + meta: !0, + param: !0, + source: !0, + track: !0, + wbr: !0 + }; + var kn = {}, cm = function (a, b) { + this.j = b === kn ? a : ''; + this.Ha = !0; + }; + cm.prototype.Ea = function () { + return this.j.toString(); + }; + cm.prototype.toString = function () { + return this.j.toString(); + }; + var hd = function (a, b) { + this.j = b === vn ? a : ''; + }; + hd.prototype.Ha = !0; + hd.prototype.Ea = function () { + return this.j.toString(); + }; + hd.prototype.jc = !0; + hd.prototype.Za = function () { + return 1; + }; + var yn = function (a, b) { + a = Xa(a).toString(); + a = wn.exec(a); + var c = a[3] || ''; + return ei(a[1] + xn('?', a[2] || '', b) + xn('#', c, void 0)); + }; + hd.prototype.toString = function () { + return this.j + ''; + }; + var Xa = function (a) { + return a instanceof hd && a.constructor === hd ? a.j : 'type_error:TrustedResourceUrl'; + }, pb = function (a, b) { + var c = fd(a); + if (!zn.test(c)) + throw Error('Invalid TrustedResourceUrl format: ' + c); + a = c.replace(An, function (d, e) { + if (!Object.prototype.hasOwnProperty.call(b, e)) + throw Error('Found marker, "' + e + '", in format string, "' + c + '", but no valid label mapping found in args: ' + JSON.stringify(b)); + d = b[e]; + return d instanceof ed ? fd(d) : encodeURIComponent(String(d)); + }); + return ei(a); + }, An = /%{(\w+)}/g, zn = RegExp('^((https:)?//[0-9a-z.:[\\]-]+/|/[^/\\\\]|[^:/\\\\%]+/|[^:/\\\\%]*[?#]|about:blank#)', 'i'), wn = /^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/, vn = {}, ei = function (a) { + return new hd(a, vn); + }, xn = function (a, b, c) { + if (null == c) + return b; + if ('string' === typeof c) + return c ? a + encodeURIComponent(c) : ''; + for (var d in c) + if (Object.prototype.hasOwnProperty.call(c, d)) { + var e = c[d]; + e = Array.isArray(e) ? e : [e]; + for (var f = 0; f < e.length; f++) { + var g = e[f]; + null != g && (b || (b = a), b += (b.length > a.length ? '&' : '') + encodeURIComponent(d) + '=' + encodeURIComponent(String(g))); + } + } + return b; + }; + var Bn = function (a, b) { + var c = a.length - b.length; + return 0 <= c && a.indexOf(b, c) == c; + }, $g = function (a) { + return /^[\s\xa0]*$/.test(a); + }, Cn = function (a) { + return /^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]; + }, pd = function (a, b) { + if (b) + a = a.replace(Dn, '&').replace(En, '<').replace(Fn, '>').replace(Gn, '"').replace(Hn, ''').replace(In, '�'); + else { + if (!Jn.test(a)) + return a; + -1 != a.indexOf('&') && (a = a.replace(Dn, '&')); + -1 != a.indexOf('<') && (a = a.replace(En, '<')); + -1 != a.indexOf('>') && (a = a.replace(Fn, '>')); + -1 != a.indexOf('"') && (a = a.replace(Gn, '"')); + -1 != a.indexOf('\'') && (a = a.replace(Hn, ''')); + -1 != a.indexOf('\0') && (a = a.replace(In, '�')); + } + return a; + }, Dn = /&/g, En = //g, Gn = /"/g, Hn = /'/g, In = /\x00/g, Jn = /[\x00&<>"']/, Ok = function (a, b) { + var c = 0; + a = Cn(String(a)).split('.'); + b = Cn(String(b)).split('.'); + for (var d = Math.max(a.length, b.length), e = 0; 0 == c && e < d; e++) { + var f = a[e] || '', g = b[e] || ''; + do { + f = /(\d*)(\D*)(.*)/.exec(f) || [ + '', + '', + '', + '' + ]; + g = /(\d*)(\D*)(.*)/.exec(g) || [ + '', + '', + '', + '' + ]; + if (0 == f[0].length && 0 == g[0].length) + break; + c = Kn(0 == f[1].length ? 0 : parseInt(f[1], 10), 0 == g[1].length ? 0 : parseInt(g[1], 10)) || Kn(0 == f[2].length, 0 == g[2].length) || Kn(f[2], g[2]); + f = f[3]; + g = g[3]; + } while (0 == c); + } + return c; + }, Kn = function (a, b) { + return a < b ? -1 : a > b ? 1 : 0; + }; + var id = function (a, b) { + this.j = b === ld ? a : ''; + }, nd, md, kd, ld, od; + p = id.prototype; + p.Ha = !0; + p.Ea = function () { + return this.j.toString(); + }; + p.jc = !0; + p.Za = function () { + return 1; + }; + p.toString = function () { + return this.j.toString(); + }; + _.jd = function (a) { + return a instanceof id && a.constructor === id ? a.j : 'type_error:SafeUrl'; + }; + nd = RegExp('^(?:audio/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|font/\\w+|image/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|video/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\\w+=(?:\\w+|"[\\w;,= ]+"))*$', 'i'); + md = /^data:(.*);base64,[a-z0-9+\/]+=*$/i; + kd = /^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i; + ld = {}; + od = new id('about:invalid#zClosurez', ld); + var Ln = {}, Mn = function (a, b, c) { + this.j = c === Ln ? a : ''; + this.m = b; + this.Ha = this.jc = !0; + }; + Mn.prototype.Za = function () { + return this.m; + }; + Mn.prototype.Ea = function () { + return this.j.toString(); + }; + Mn.prototype.toString = function () { + return this.j.toString(); + }; + var Ua = function (a) { + return a instanceof Mn && a.constructor === Mn ? a.j : 'type_error:SafeHtml'; + }, Nn = function (a) { + if (a instanceof Mn) + return a; + var b = 'object' == typeof a, c = null; + b && a.jc && (c = a.Za()); + return sd(pd(b && a.Ha ? a.Ea() : String(a)), c); + }, Pn = function (a) { + var b = Nn(On), c = b.Za(), d = [], e = function (f) { + Array.isArray(f) ? f.forEach(e) : (f = Nn(f), d.push(Ua(f).toString()), f = f.Za(), 0 == c ? c = f : 0 != f && c != f && (c = null)); + }; + a.forEach(e); + return sd(d.join(Ua(b).toString()), c); + }, rd = function (a) { + return Pn(Array.prototype.slice.call(arguments)); + }, sd = function (a, b) { + return new Mn(a, b, Ln); + }, cd = /^[a-zA-Z0-9-]+$/, gd = { + action: !0, + cite: !0, + data: !0, + formaction: !0, + href: !0, + manifest: !0, + poster: !0, + src: !0 + }, dd = { + APPLET: !0, + BASE: !0, + EMBED: !0, + IFRAME: !0, + LINK: !0, + MATH: !0, + META: !0, + OBJECT: !0, + SCRIPT: !0, + STYLE: !0, + SVG: !0, + TEMPLATE: !0 + }, On = new Mn(_.r.trustedTypes && _.r.trustedTypes.emptyHTML || '', 0, Ln); + _.Ma = {}; + var Ja; + var Ta = function () { + }, La = function (a) { + this.j = a; + }; + _.O(La, Ta); + La.prototype.toString = function () { + return this.j.toString(); + }; + var Wa = function () { + }, Oa = function (a) { + this.j = a; + }; + _.O(Oa, Wa); + Oa.prototype.toString = function () { + return this.j.toString(); + }; + var bm = function () { + }, am = function (a) { + this.j = a; + }; + _.O(am, bm); + am.prototype.toString = function () { + return this.j.toString(); + }; + _.Qn = function () { + }; + _.Rn = function (a) { + this.j = a; + }; + _.O(_.Rn, _.Qn); + _.Rn.prototype.toString = function () { + return this.j; + }; + _.Sn = new _.Rn('about:invalid#zTSz', _.Ma); + var Tn, Un, tg, Wn; + Tn = function () { + return !0; + }; + Un = function (a) { + return function () { + return !a.apply(this, arguments); + }; + }; + tg = function (a) { + var b = !1, c; + return function () { + b || (c = a(), b = !0); + return c; + }; + }; + _.Vn = function (a) { + var b = a; + return function () { + if (b) { + var c = b; + b = null; + c(); + } + }; + }; + Wn = function (a, b, c) { + var d = 0, e = !1, f = [], g = function () { + d = 0; + e && (e = !1, h()); + }, h = function () { + d = _.r.setTimeout(g, b); + var k = f; + f = []; + a.apply(c, k); + }; + return function (k) { + f = arguments; + d ? e = !0 : h(); + }; + }; + var db; + db = tg(function () { + var a = !1; + try { + var b = Object.defineProperty({}, 'passive', { + get: function () { + a = !0; + } + }); + _.r.addEventListener('test', null, b); + } catch (c) { + } + return a; + }); + _.fb = function (a, b, c, d) { + return a.addEventListener ? (a.addEventListener(b, c, eb(d)), !0) : !1; + }; + _.Lc = function (a, b, c, d) { + return a.removeEventListener ? (a.removeEventListener(b, c, eb(d)), !0) : !1; + }; + var kb = function (a) { + return new v.Promise(function (b, c) { + const $___old_22d88436a9f51009 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_b5d2a552f149fe02 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_22d88436a9f51009) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_00465284004d4aa8.XMLHttpRequest)); + if ($___old_b5d2a552f149fe02) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_00465284004d4aa8.XMLHttpRequest)); + return function () { + var d = new XMLHttpRequest(); + d.onreadystatechange = function () { + d.readyState === d.DONE && (200 <= d.status && 300 > d.status ? b(JSON.parse(d.responseText)) : c()); + }; + d.open('GET', a, !0); + d.send(); + }.apply(this, arguments); + } finally { + if ($___old_22d88436a9f51009) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_22d88436a9f51009)); + if ($___old_b5d2a552f149fe02) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_b5d2a552f149fe02)); + } + }); + }; + var ub, sb = 'undefined' !== typeof TextEncoder; + var Xn = function (a) { + Xn[' '](a); + return a; + }; + Xn[' '] = function () { + }; + var Yn = function (a, b) { + try { + return Xn(a[b]), !0; + } catch (c) { + } + return !1; + }, Zn = function (a, b, c, d) { + d = d ? d(b) : b; + return Object.prototype.hasOwnProperty.call(a, d) ? a[d] : a[d] = c(b); + }; + var $n, bo, co, eo, fo, go, ho, io; + $n = Aa('Opera'); + _.ao = Ca(); + bo = Aa('Edge'); + co = Aa('Gecko') && !(-1 != za().toLowerCase().indexOf('webkit') && !Aa('Edge')) && !(Aa('Trident') || Aa('MSIE')) && !Aa('Edge'); + eo = -1 != za().toLowerCase().indexOf('webkit') && !Aa('Edge'); + fo = eo && Aa('Mobile'); + go = Aa('Android'); + ho = function () { + var a = _.r.document; + return a ? a.documentMode : void 0; + }; + a: { + var jo = '', ko = function () { + var a = za(); + if (co) + return /rv:([^\);]+)(\)|;)/.exec(a); + if (bo) + return /Edge\/([\d\.]+)/.exec(a); + if (_.ao) + return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a); + if (eo) + return /WebKit\/(\S+)/.exec(a); + if ($n) + return /(?:Version)[ \/]?(\S+)/.exec(a); + }(); + ko && (jo = ko ? ko[1] : ''); + if (_.ao) { + var lo = ho(); + if (null != lo && lo > parseFloat(jo)) { + io = String(lo); + break a; + } + } + io = jo; + } + var mo = io, no = {}, oo = function (a) { + return Zn(no, a, function () { + return 0 <= Ok(mo, a); + }); + }, po; + if (_.r.document && _.ao) { + var qo = ho(); + po = qo ? qo : parseInt(mo, 10) || void 0; + } else + po = void 0; + var ro = po; + !Aa('Android') || Ea(); + Ea(); + Fa(); + var so = {}, to = null, uo = co || eo || 'function' == typeof _.r.btoa, Eb = function (a, b) { + void 0 === b && (b = 0); + vo(); + b = so[b]; + for (var c = Array(Math.floor(a.length / 3)), d = b[64] || '', e = 0, f = 0; e < a.length - 2; e += 3) { + var g = a[e], h = a[e + 1], k = a[e + 2], l = b[g >> 2]; + g = b[(g & 3) << 4 | h >> 4]; + h = b[(h & 15) << 2 | k >> 6]; + k = b[k & 63]; + c[f++] = l + g + h + k; + } + l = 0; + k = d; + switch (a.length - e) { + case 2: + l = a[e + 1], k = b[(l & 15) << 2] || d; + case 1: + a = a[e], c[f] = b[a >> 2] + b[(a & 3) << 4 | l >> 4] + k + d; + } + return c.join(''); + }, wo = function (a, b) { + if (uo && !b) + a = _.r.btoa(a); + else { + for (var c = [], d = 0, e = 0; e < a.length; e++) { + var f = a.charCodeAt(e); + 255 < f && (c[d++] = f & 255, f >>= 8); + c[d++] = f; + } + a = Eb(c, b); + } + return a; + }, Ul = function (a) { + var b = ''; + xo(a, function (c) { + b += String.fromCharCode(c); + }); + return b; + }, xo = function (a, b) { + function c(k) { + for (; d < a.length;) { + var l = a.charAt(d++), m = to[l]; + if (null != m) + return m; + if (!$g(l)) + throw Error('Unknown base64 encoding at char: ' + l); + } + return k; + } + vo(); + for (var d = 0;;) { + var e = c(-1), f = c(0), g = c(64), h = c(64); + if (64 === h && -1 === e) + break; + b(e << 2 | f >> 4); + 64 != g && (b(f << 4 & 240 | g >> 2), 64 != h && b(g << 6 & 192 | h)); + } + }, vo = function () { + if (!to) { + to = {}; + for (var a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.split(''), b = [ + '+/=', + '+/', + '-_=', + '-_.', + '-_' + ], c = 0; 5 > c; c++) { + var d = a.concat(b[c].split('')); + so[c] = d; + for (var e = 0; e < d.length; e++) { + var f = d[e]; + void 0 === to[f] && (to[f] = e); + } + } + } + }; + var Cb = 'function' === typeof Uint8Array; + var wb = 0, xb = 0; + var yo = function () { + this.j = []; + }; + yo.prototype.length = function () { + return this.j.length; + }; + yo.prototype.end = function () { + var a = this.j; + this.j = []; + return a; + }; + var zo = function (a) { + for (var b = wb, c = xb; 0 < c || 127 < b;) + a.j.push(b & 127 | 128), b = (b >>> 7 | c << 25) >>> 0, c >>>= 7; + a.j.push(b); + }, Ao = function (a, b) { + for (; 127 < b;) + a.j.push(b & 127 | 128), b >>>= 7; + a.j.push(b); + }, Bo = function (a, b) { + if (0 <= b) + Ao(a, b); + else { + for (var c = 0; 9 > c; c++) + a.j.push(b & 127 | 128), b >>= 7; + a.j.push(1); + } + }; + var Co = function () { + this.F = []; + this.m = 0; + this.j = new yo(); + }, Do = function (a, b) { + 0 !== b.length && (a.F.push(b), a.m += b.length); + }, Eo = function (a, b) { + Ao(a.j, 8 * b + 2); + b = a.j.end(); + Do(a, b); + b.push(a.m); + return b; + }, Fo = function (a, b) { + var c = b.pop(); + for (c = a.m + a.j.length() - c; 127 < c;) + b.push(c & 127 | 128), c >>>= 7, a.m++; + b.push(c); + a.m++; + }, Go = function (a) { + Do(a, a.j.end()); + for (var b = new Uint8Array(a.m), c = a.F, d = c.length, e = 0, f = 0; f < d; f++) { + var g = c[f]; + b.set(g, e); + e += g.length; + } + a.F = [b]; + return b; + }, Ho = function (a, b, c) { + null != c && null != c && (Ao(a.j, 8 * b), Bo(a.j, c)); + }, Io = function (a, b, c) { + null != c && null != c && (Ao(a.j, 8 * b), a = a.j, yb(c), zo(a)); + }, Jo = function (a, b, c) { + null != c && (Ao(a.j, 8 * b), a.j.j.push(c ? 1 : 0)); + }, Ko = function (a, b, c) { + null != c && (c = parseInt(c, 10), Ao(a.j, 8 * b), Bo(a.j, c)); + }, Lo = function (a, b, c) { + Ao(a.j, 8 * b + 2); + Ao(a.j, c.length); + Do(a, a.j.end()); + Do(a, c); + }, Mo = function (a, b, c, d) { + null != c && (b = Eo(a, b), d(c, a), Fo(a, b)); + }, No = function (a, b, c, d) { + if (null != c) + for (var e = 0; e < c.length; e++) { + var f = Eo(a, b); + d(c[e], a); + Fo(a, f); + } + }; + var zb = 'function' === typeof v.Symbol && 'symbol' === typeof (0, v.Symbol)() ? (0, v.Symbol)(void 0) : void 0; + var Oo; + var Gb = function (a, b) { + this.j = a; + this.F = b; + this.map = {}; + this.m = !1; + for (a = this.size = 0; a < this.j.length; a++) { + b = this.j[a]; + var c = b[0].toString(), d = this.map[c]; + this.map[c] = b; + void 0 === d && this.size++; + } + }; + p = Gb.prototype; + p.Oa = function () { + if (!this.m) { + var a = Po(this); + a.sort(); + for (var b = 0; b < a.length; b++) + this.j[b] = this.map[a[b]]; + a.length < this.j.length && (this.j.length = a.length); + this.m = !0; + this.size = this.j.length; + } + return this.j; + }; + p.clear = function () { + this.map = {}; + this.size = this.j.length = 0; + this.m = !0; + }; + p.delete = function (a) { + a = a.toString(); + return this.map.hasOwnProperty(a) ? (delete this.map[a], this.size--, this.m = !1, !0) : !1; + }; + p.entries = function () { + var a = [], b = Po(this); + b.sort(); + for (var c = 0; c < b.length; c++) { + var d = this.map[b[c]]; + a.push([ + d[0], + Mb(this, d) + ]); + } + return new Qo(a); + }; + p.keys = function () { + var a = [], b = Po(this); + b.sort(); + for (var c = 0; c < b.length; c++) + a.push(this.map[b[c]][0]); + return new Qo(a); + }; + p.values = function () { + var a = [], b = Po(this); + b.sort(); + for (var c = 0; c < b.length; c++) + a.push(Mb(this, this.map[b[c]])); + return new Qo(a); + }; + p.forEach = function (a, b) { + var c = Po(this); + c.sort(); + for (var d = 0; d < c.length; d++) { + var e = this.map[c[d]]; + a.call(b, Mb(this, e), e[0], this); + } + }; + p.set = function (a, b) { + var c = a.toString(), d = this.map[c]; + d ? d[1] = b : (a = [ + a, + b + ], this.map[c] = a, this.j.push(a), this.m = !1, this.size++); + return this; + }; + var Mb = function (a, b) { + var c = b[1]; + a.F && (Array.isArray(c) || null == c) && (a = new a.F(c), c = b[1] = a); + return c; + }; + Gb.prototype.get = function (a) { + if (a = this.map[a.toString()]) + return Mb(this, a); + }; + Gb.prototype.has = function (a) { + return a.toString() in this.map; + }; + var Po = function (a) { + a = a.map; + var b = [], c; + for (c in a) + Object.prototype.hasOwnProperty.call(a, c) && b.push(c); + return b; + }; + Gb.prototype[_.t(v.Symbol, 'iterator')] = function () { + return _.t(this, 'entries').call(this); + }; + var Qo = function (a) { + this.m = 0; + this.j = a; + }; + Qo.prototype.next = function () { + return this.m < this.j.length ? { + done: !1, + value: this.j[this.m++] + } : { + done: !0, + value: void 0 + }; + }; + Qo.prototype[_.t(v.Symbol, 'iterator')] = function () { + return this; + }; + var Ob; + var Q = function (a, b, c) { + var d = Ob; + Ob = null; + a || (a = d); + d = this.constructor.messageId; + a || (a = d ? [d] : []); + this.A = (d ? 0 : -1) - (this.constructor.Cf || 0); + this.j = void 0; + this.F = a; + a: { + d = this.F.length; + a = d - 1; + if (d && (d = this.F[a], Bb(d))) { + this.D = a - this.A; + this.m = d; + break a; + } + void 0 !== b && -1 < b ? (this.D = Math.max(b, a + 1 - this.A), this.m = void 0) : this.D = Number.MAX_VALUE; + } + if (c) + for (b = 0; b < c.length; b++) + if (a = c[b], a < this.D) + a += this.A, (d = this.F[a]) ? Array.isArray(d) && Ab(d) : this.F[a] = Ro; + else { + d = this.m || (this.m = this.F[this.D + this.A] = {}); + var e = d[a]; + e ? Array.isArray(e) && Ab(e) : d[a] = Ro; + } + }, Ro = Object.freeze(Ab([])), G = function (a, b, c) { + return -1 === b ? null : b >= a.D ? a.m ? a.m[b] : void 0 : (void 0 === c ? 0 : c) && a.m && (c = a.m[b], null != c) ? c : a.F[b + a.A]; + }, Yf = function (a, b) { + return null != G(a, b); + }, Oh = function (a, b, c) { + c = void 0 === c ? !1 : c; + var d = G(a, b, c); + null == d && (d = Ro); + d === Ro && (d = Ab(d.slice()), w(a, b, d, c)); + return d; + }, Hc = function (a, b) { + a = G(a, b); + return null == a ? a : +a; + }, E = function (a, b) { + a = G(a, b); + return null == a ? a : !!a; + }, tk = function (a, b, c) { + a = G(a, b); + return null == a ? c : a; + }, So = function (a, b, c) { + a = E(a, b); + return null == a ? void 0 === c ? !1 : c : a; + }, w = function (a, b, c, d) { + (void 0 === d ? 0 : d) || b >= a.D ? (a.m || (a.m = a.F[a.D + a.A] = {}))[b] = c : a.F[b + a.A] = c; + return a; + }, yf = function (a, b, c) { + var d = void 0 === d ? !1 : d; + return w(a, b, null == c ? Ab([]) : Array.isArray(c) ? Ab(c) : c, d); + }, To = function (a, b, c) { + Oh(a, b).push(c); + }, te = function (a, b, c, d) { + (c = Xb(a, c)) && c !== b && null != d && (a.j && c in a.j && (a.j[c] = void 0), w(a, c, void 0)); + return w(a, b, d); + }, Xb = function (a, b) { + for (var c = 0, d = 0; d < b.length; d++) { + var e = b[d]; + null != G(a, e) && (0 !== c && w(a, c, void 0, !1), c = e); + } + return c; + }, Wb = function (a, b, c, d, e) { + if (-1 === c) + return null; + a.j || (a.j = {}); + var f = a.j[c]; + if (f) + return f; + e = G(a, c, void 0 === e ? !1 : e); + if (null == e && !d) + return f; + b = new b(e); + return a.j[c] = b; + }, Ub = function (a, b, c, d) { + a.j || (a.j = {}); + var e = a.j[c]; + if (!e) { + d = Oh(a, c, void 0 === d ? !1 : d); + e = []; + for (var f = 0; f < d.length; f++) + e[f] = new b(d[f]); + a.j[c] = e; + } + return e; + }, zf = function (a, b, c) { + var d = void 0 === d ? !1 : d; + a.j || (a.j = {}); + var e = c ? c.Oa() : c; + a.j[b] = c; + return w(a, b, e, d); + }, Ee = function (a, b, c, d) { + a.j || (a.j = {}); + var e = d ? d.Oa() : d; + a.j[b] = d; + return te(a, b, c, e); + }, wh = function (a, b, c) { + var d = void 0 === d ? !1 : d; + if (c) { + var e = Ab([]); + for (var f = 0; f < c.length; f++) + e[f] = c[f].Oa(); + a.j || (a.j = {}); + a.j[b] = c; + } else + a.j && (a.j[b] = void 0), e = Ro; + return w(a, b, e, d); + }, gh = function (a, b, c, d) { + var e = Ub(a, c, b, void 0 === e ? !1 : e); + c = d ? d : new c(); + a = Oh(a, b); + e.push(c); + a.push(c.Oa()); + return c; + }; + Q.prototype.toJSON = function () { + var a = this.Oa(); + return Oo ? a : Ib(a, Kb); + }; + Q.prototype.Oa = function () { + return this.F; + }; + Q.prototype.X = function () { + Oo = !0; + try { + return JSON.stringify(this.toJSON(), Tb); + } finally { + Oo = !1; + } + }; + var Sl = function (a, b) { + return Pb(a, b ? JSON.parse(b) : null); + }, Lb = function (a) { + var b = a.constructor, c = Ib(a.Oa(), Nb); + b = Pb(b, c); + Vb(b, a); + return b; + }, sk = function (a, b, c) { + return tk(a, b, void 0 === c ? 0 : c); + }, lk = function (a, b, c) { + return tk(a, b, void 0 === c ? '' : c); + }, Vo = function (a) { + return sk(a, Yb(a, Uo, 3), void 0); + }, Wo = function (a) { + return lk(a, Yb(a, Uo, 2), void 0); + }, Jk = function (a, b, c) { + return Qb(a, b, c, !1); + }; + var Xo = function (a, b) { + if (a = a.l) { + Do(b, b.j.end()); + for (var c = 0; c < a.length; c++) + Do(b, a[c]); + } + }, Yo = function (a, b) { + var c = new Co(); + b(a, c); + return Go(c); + }, Zo = function (a, b, c) { + b = G(b, c); + null != b && null != b && (Ao(a.j, 8 * c), a = a.j, yb(b), zo(a)); + }, $o = function (a, b, c) { + b = G(b, c); + null != b && Lo(a, c, vb(b)); + }; + var Vl = function (a) { + Q.call(this, a); + }; + _.O(Vl, Q); + var Wl = function (a) { + Q.call(this, a); + }; + _.O(Wl, Q); + var ap = function (a) { + this.j = a.m; + this.m = a.F; + this.A = a.A; + this.rb = a.rb; + this.I = a.I; + this.ab = a.ab; + this.Ib = a.Ib; + this.Sb = a.Sb; + this.Hb = a.Hb; + this.F = a.j; + }, bp = function (a, b, c) { + this.m = a; + this.F = b; + this.A = c; + this.I = window; + this.ab = 'env'; + this.Ib = 'n'; + this.Sb = '0'; + this.Hb = '1'; + this.j = !0; + }; + bp.prototype.build = function () { + return new ap(this); + }; + var Yl = function (a, b) { + var c, d, e = void 0 === So(b, 6) ? !0 : So(b, 6); + a: + switch (tk(b, 4, 0)) { + case 1: + var f = 'pt'; + break a; + case 2: + f = 'cr'; + break a; + default: + f = ''; + } + f = new bp(Zb(tk(b, 2, 0)), lk(b, 3), f); + b = null !== (d = null === (c = Wb(b, Wl, 5)) || void 0 === c ? void 0 : lk(c, 1)) && void 0 !== d ? d : ''; + f.rb = b; + f.j = e; + f.I = a; + return f.build(); + }; + var kk = function (a) { + Q.call(this, a, -1, cp); + }; + _.O(kk, Q); + var nk = function (a, b) { + return w(a, 1, b); + }, rk = function (a, b) { + w(a, 2, b); + }, dp = function (a, b) { + gh(a, 3, vk, b); + }, fp = function (a, b) { + $o(b, a, 1); + Zo(b, a, 2); + var c = ep; + No(b, 3, Ub(a, vk, 3), c); + Ko(b, 4, G(a, 4)); + Xo(a, b); + }, vk = function (a) { + Q.call(this, a, -1, gp); + }; + _.O(vk, Q); + var Ck = function (a, b) { + w(a, 1, b); + }, wk = function (a, b) { + w(a, 3, b); + }, yk = function (a, b) { + yf(a, 4, b); + }, zk = function (a, b) { + zf(a, 7, b); + }, ep = function (a, b) { + $o(b, a, 1); + Zo(b, a, 2); + $o(b, a, 3); + var c = Oh(a, 4); + if (null != c) + for (var d = 0; d < c.length; d++) { + var e = c[d]; + null != e && Lo(b, 4, vb(e)); + } + Ko(b, 5, G(a, 5)); + c = hp; + Mo(b, 6, Wb(a, xk, 6), c); + c = ip; + Mo(b, 7, Wb(a, jp, 7), c); + Xo(a, b); + }, xk = function (a) { + Q.call(this, a); + }; + _.O(xk, Q); + xk.prototype.getId = function () { + return lk(this, 1); + }; + var hp = function (a, b) { + $o(b, a, 1); + Xo(a, b); + }, jp = function (a) { + Q.call(this, a); + }; + _.O(jp, Q); + jp.prototype.getWidth = function () { + return sk(this, 1); + }; + var Bk = function (a) { + var b = new jp(); + return w(b, 1, a); + }; + jp.prototype.getHeight = function () { + return sk(this, 2); + }; + var Ak = function (a, b) { + return w(a, 2, b); + }, ip = function (a, b) { + Ho(b, 1, G(a, 1)); + Ho(b, 2, G(a, 2)); + Xo(a, b); + }, cp = [3], gp = [4]; + var lp = function (a) { + Q.call(this, a, -1, kp); + }; + _.O(lp, Q); + var mk = function (a, b) { + return gh(a, 2, kk, b); + }, mp = function (a, b) { + Ko(b, 1, G(a, 1)); + No(b, 2, Ub(a, kk, 2), fp); + Ko(b, 3, G(a, 3)); + $o(b, a, 4); + Xo(a, b); + }, kp = [2]; + var op = function (a) { + Q.call(this, a, -1, np); + }; + _.O(op, Q); + var qk = function (a) { + var b = new lp(); + b = w(b, 1, 1); + return gh(a, 1, lp, b); + }, pp = function (a, b) { + No(b, 1, Ub(a, lp, 1), mp); + Xo(a, b); + }, np = [1]; + var rp = function (a) { + Q.call(this, a, -1, qp); + }; + _.O(rp, Q); + var tp = function (a) { + Q.call(this, a, -1, sp); + }; + _.O(tp, Q); + var up = function (a) { + Q.call(this, a); + }; + _.O(up, Q); + var qp = [1], sp = [1], Uo = [ + 2, + 3 + ]; + var wp = function (a) { + Q.call(this, a, -1, vp); + }; + _.O(wp, Q); + var xp = function (a) { + Q.call(this, a); + }; + _.O(xp, Q); + var vp = [4]; + var zp = function (a) { + Q.call(this, a, -1, yp); + }; + _.O(zp, Q); + var yp = [4]; + var Ap = function (a) { + Q.call(this, a); + }; + _.O(Ap, Q); + var Cp = function (a) { + Q.call(this, a, -1, Bp); + }; + _.O(Cp, Q); + var Bp = [1]; + var Ep = function (a) { + Q.call(this, a, -1, Dp); + }; + _.O(Ep, Q); + var Fp = function (a) { + Q.call(this, a); + }; + _.O(Fp, Q); + var Dp = [1]; + var Hp = function (a) { + Q.call(this, a, -1, Gp); + }; + _.O(Hp, Q); + var Gp = [4]; + var Ip = function (a) { + Q.call(this, a); + }; + _.O(Ip, Q); + var Kp = function (a) { + Q.call(this, a, -1, Jp); + }; + _.O(Kp, Q); + var Jp = [13]; + var Mp = function (a) { + Q.call(this, a, -1, Lp); + }; + _.O(Mp, Q); + var Lp = [13]; + var Op = function (a) { + Q.call(this, a, -1, Np); + }; + _.O(Op, Q); + var Tp = function (a, b) { + var c = Pp; + No(b, 1, Ub(a, Qp, 1), c); + c = Rp; + No(b, 2, Ub(a, Sp, 2), c); + Xo(a, b); + }, Qp = function (a) { + Q.call(this, a); + }; + _.O(Qp, Q); + var Pp = function (a, b) { + Io(b, 1, G(a, 1)); + var c = Up; + Mo(b, 2, Wb(a, Vp, 2), c); + c = Up; + Mo(b, 3, Wb(a, Vp, 3), c); + $o(b, a, 4); + $o(b, a, 5); + Jo(b, 6, G(a, 6)); + Xo(a, b); + }, Vp = function (a) { + Q.call(this, a); + }; + _.O(Vp, Q); + var Up = function (a, b) { + Io(b, 1, G(a, 1)); + Io(b, 2, G(a, 2)); + Io(b, 3, G(a, 3)); + Xo(a, b); + }, Sp = function (a) { + Q.call(this, a); + }; + _.O(Sp, Q); + var Gc = function (a, b) { + return w(a, 8, b); + }, Rp = function (a, b) { + $o(b, a, 1); + $o(b, a, 2); + Zo(b, a, 3); + Zo(b, a, 7); + var c = G(a, 8); + if (null != c) { + Ao(b.j, 69); + var d = b.j, e = c; + e = (c = 0 > e ? 1 : 0) ? -e : e; + if (0 === e) + 0 < 1 / e ? wb = xb = 0 : (xb = 0, wb = 2147483648); + else if (isNaN(e)) + xb = 0, wb = 2147483647; + else if (3.4028234663852886e+38 < e) + xb = 0, wb = (c << 31 | 2139095040) >>> 0; + else if (1.1754943508222875e-38 > e) + e = Math.round(e / Math.pow(2, -149)), xb = 0, wb = (c << 31 | e) >>> 0; + else { + var f = Math.floor(Math.log(e) / Math.LN2); + e *= Math.pow(2, -f); + e = Math.round(8388608 * e); + 16777216 <= e && ++f; + xb = 0; + wb = (c << 31 | f + 127 << 23 | e & 8388607) >>> 0; + } + c = wb; + d.j.push(c >>> 0 & 255); + d.j.push(c >>> 8 & 255); + d.j.push(c >>> 16 & 255); + d.j.push(c >>> 24 & 255); + } + Ho(b, 4, G(a, 4)); + Ho(b, 5, G(a, 5)); + Ho(b, 6, G(a, 6)); + Jo(b, 9, G(a, 9)); + Xo(a, b); + }, Np = [ + 1, + 2 + ]; + var Wp = function (a) { + Q.call(this, a); + }; + _.O(Wp, Q); + var Yp = function (a) { + Q.call(this, a, -1, Xp); + }; + _.O(Yp, Q); + var Xp = [1]; + var Zp = function (a) { + Q.call(this, a); + }; + _.O(Zp, Q); + var $p = function (a) { + Q.call(this, a); + }; + _.O($p, Q); + $p.prototype.getVersion = function () { + return G(this, 5); + }; + var aq = function (a) { + Q.call(this, a); + }; + _.O(aq, Q); + var bq = function (a) { + Q.call(this, a); + }; + _.O(bq, Q); + var cq = function (a) { + Q.call(this, a); + }; + _.O(cq, Q); + var dq = function (a) { + Q.call(this, a); + }; + _.O(dq, Q); + var eq = function (a) { + Q.call(this, a); + }; + _.O(eq, Q); + eq.prototype.getAdUnitPath = function () { + return lk(this, 2); + }; + var gq = function (a) { + Q.call(this, a, -1, fq); + }; + _.O(gq, Q); + gq.prototype.getEscapedQemQueryId = function () { + return lk(this, 4); + }; + var fq = [2]; + var hq = function (a) { + Q.call(this, a); + }; + _.O(hq, Q); + var iq = function (a) { + Q.call(this, a); + }; + _.O(iq, Q); + iq.prototype.getEscapedQemQueryId = function () { + return lk(this, 2); + }; + var kq = function (a) { + Q.call(this, a, -1, jq); + }; + _.O(kq, Q); + kq.prototype.getWidth = function () { + return sk(this, 9); + }; + kq.prototype.getHeight = function () { + return sk(this, 10); + }; + var jq = [ + 3, + 7 + ]; + var mq = function (a) { + Q.call(this, a, -1, lq); + }; + _.O(mq, Q); + mq.prototype.getHeight = function () { + return G(this, 6); + }; + mq.prototype.getWidth = function () { + return G(this, 7); + }; + mq.prototype.getEscapedQemQueryId = function () { + return G(this, 34); + }; + var nq = function (a) { + Q.call(this, a); + }; + _.O(nq, Q); + nq.prototype.getHtml = function () { + return G(this, 1); + }; + var lq = [ + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 45, + 23, + 27, + 28, + 38, + 53, + 62 + ], oq = [ + 4, + 41 + ], pq = [ + 39, + 48 + ]; + var Tl = function (a) { + Q.call(this, a); + }; + _.O(Tl, Q); + var qq = document, $k = window; + var sq = function (a) { + Q.call(this, a, -1, rq); + }; + _.O(sq, Q); + var uq = function () { + var a = new sq(), b = _.H(tq); + return Jk(a, 7, b); + }, wq = function () { + var a = uq(), b = _.H(vq); + return Jk(a, 8, b); + }, yq = function () { + var a = wq(), b = _.H(xq); + return Jk(a, 9, b); + }, rq = [15]; + var zq = function (a) { + Q.call(this, a); + }; + _.O(zq, Q); + zq.prototype.getCorrelator = function () { + return sk(this, 1); + }; + zq.prototype.setCorrelator = function (a) { + return Qb(this, 1, a, 0); + }; + var Aq = function (a) { + Q.call(this, a); + }; + _.O(Aq, Q); + var Bq = _.ao || eo; + var Dq = function (a, b, c) { + a.rel = c; + -1 != c.toLowerCase().indexOf('stylesheet') ? (a.href = Xa(b).toString(), (b = Cq('style[nonce],link[rel="stylesheet"][nonce]', a.ownerDocument && a.ownerDocument.defaultView)) && a.setAttribute('nonce', b)) : (b instanceof hd ? b = Xa(b).toString() : b instanceof id ? b = _.jd(b) : (b instanceof id || (b = 'object' == typeof b && b.Ha ? b.Ea() : String(b), kd.test(b) || (b = 'about:invalid#zClosurez'), b = new id(b, ld)), b = _.jd(b)), a.href = b); + }, Eq = /^[\w+/_-]+[=]{0,2}$/, Cq = function (a, b) { + b = (b || _.r).document; + return b.querySelector ? (a = b.querySelector(a)) && (a = a.nonce || a.getAttribute('nonce')) && Eq.test(a) ? a : '' : ''; + }; + _.ig = function (a, b) { + this.x = void 0 !== a ? a : 0; + this.y = void 0 !== b ? b : 0; + }; + _.ig.prototype.ceil = function () { + this.x = Math.ceil(this.x); + this.y = Math.ceil(this.y); + return this; + }; + _.ig.prototype.floor = function () { + this.x = Math.floor(this.x); + this.y = Math.floor(this.y); + return this; + }; + _.ig.prototype.round = function () { + this.x = Math.round(this.x); + this.y = Math.round(this.y); + return this; + }; + _.Ui = function (a, b) { + this.width = a; + this.height = b; + }; + p = _.Ui.prototype; + p.aspectRatio = function () { + return this.width / this.height; + }; + p.isEmpty = function () { + return !(this.width * this.height); + }; + p.ceil = function () { + this.width = Math.ceil(this.width); + this.height = Math.ceil(this.height); + return this; + }; + p.floor = function () { + this.width = Math.floor(this.width); + this.height = Math.floor(this.height); + return this; + }; + p.round = function () { + this.width = Math.round(this.width); + this.height = Math.round(this.height); + return this; + }; + var Fq, Gq, ng, Hq, Iq, Kq; + Fq = function (a) { + return a = pd(a, void 0); + }; + Gq = String.prototype.repeat ? function (a, b) { + return a.repeat(b); + } : function (a, b) { + return Array(b + 1).join(a); + }; + ng = function (a) { + if (!_.t(Number, 'isFinite').call(Number, a)) + return String(a); + a = String(a); + var b = a.indexOf('.'); + -1 === b && (b = a.length); + var c = '-' === a[0] ? '-' : ''; + c && (a = a.substring(1)); + return c + Gq('0', Math.max(0, 2 - b)) + a; + }; + Hq = function () { + return Math.floor(2147483648 * Math.random()).toString(36) + Math.abs(Math.floor(2147483648 * Math.random()) ^ xd()).toString(36); + }; + Iq = 2147483648 * Math.random() | 0; + _.Jq = function (a) { + return String(a).replace(/\-([a-z])/g, function (b, c) { + return c.toUpperCase(); + }); + }; + Kq = function (a) { + return a.replace(RegExp('(^|[\\s]+)([a-z])', 'g'), function (b, c, d) { + return c + d.toUpperCase(); + }); + }; + var Nq, Pq, Oq, Sq, Uq, $b, cc, Lq; + Nq = function (a) { + return a ? new Lq(_.Mq(a)) : dn || (dn = new Lq()); + }; + Pq = function (a, b) { + ua(b, function (c, d) { + c && 'object' == typeof c && c.Ha && (c = c.Ea()); + 'style' == d ? a.style.cssText = c : 'class' == d ? a.className = c : 'for' == d ? a.htmlFor = c : Oq.hasOwnProperty(d) ? a.setAttribute(Oq[d], c) : 0 == d.lastIndexOf('aria-', 0) || 0 == d.lastIndexOf('data-', 0) ? a.setAttribute(d, c) : a[d] = c; + }); + }; + Oq = { + cellpadding: 'cellPadding', + cellspacing: 'cellSpacing', + colspan: 'colSpan', + frameborder: 'frameBorder', + height: 'height', + maxlength: 'maxLength', + nonce: 'nonce', + role: 'role', + rowspan: 'rowSpan', + type: 'type', + usemap: 'useMap', + valign: 'vAlign', + width: 'width' + }; + _.Rq = function (a) { + a = a.document; + a = _.Qq(a) ? a.documentElement : a.body; + return new _.Ui(a.clientWidth, a.clientHeight); + }; + Sq = function (a) { + return a.scrollingElement ? a.scrollingElement : !eo && _.Qq(a) ? a.documentElement : a.body || a.documentElement; + }; + _.Tq = function (a) { + return a ? a.parentWindow || a.defaultView : window; + }; + Uq = function (a, b, c) { + function d(h) { + h && b.appendChild('string' === typeof h ? a.createTextNode(h) : h); + } + for (var e = 1; e < c.length; e++) { + var f = c[e]; + if (!ah(f) || _.ja(f) && 0 < f.nodeType) + d(f); + else { + a: { + if (f && 'number' == typeof f.length) { + if (_.ja(f)) { + var g = 'function' == typeof f.item || 'string' == typeof f.item; + break a; + } + if ('function' === typeof f) { + g = 'function' == typeof f.item; + break a; + } + } + g = !1; + } + _.hn(g ? ha(f) : f, d); + } + } + }; + _.Qq = function (a) { + return 'CSS1Compat' == a.compatMode; + }; + _.Vq = function (a) { + return a && a.parentNode ? a.parentNode.removeChild(a) : null; + }; + _.Wq = function (a) { + var b; + if (Bq && !(_.ao && oo('9') && !oo('10') && _.r.SVGElement && a instanceof _.r.SVGElement) && (b = a.parentElement)) + return b; + b = a.parentNode; + return _.ja(b) && 1 == b.nodeType ? b : null; + }; + $b = function (a) { + var b, c = arguments.length; + if (!c) + return null; + if (1 == c) + return arguments[0]; + var d = [], e = Infinity; + for (b = 0; b < c; b++) { + for (var f = [], g = arguments[b]; g;) + f.unshift(g), g = g.parentNode; + d.push(f); + e = Math.min(e, f.length); + } + f = null; + for (b = 0; b < e; b++) { + g = d[0][b]; + for (var h = 1; h < c; h++) + if (g != d[h][b]) + return f; + f = g; + } + return f; + }; + _.Mq = function (a) { + return 9 == a.nodeType ? a : a.ownerDocument || a.document; + }; + cc = function (a) { + try { + return a.contentWindow || (a.contentDocument ? _.Tq(a.contentDocument) : null); + } catch (b) { + } + return null; + }; + Lq = function (a) { + this.j = a || _.r.document || document; + }; + p = Lq.prototype; + p.getElementsByTagName = function (a, b) { + return (b || this.j).getElementsByTagName(String(a)); + }; + p.createElement = function (a) { + var b = this.j; + a = String(a); + 'application/xhtml+xml' === b.contentType && (a = a.toLowerCase()); + return b.createElement(a); + }; + p.createTextNode = function (a) { + return this.j.createTextNode(String(a)); + }; + p.append = function (a, b) { + Uq(_.Mq(a), a, arguments); + }; + p.gd = _.Vq; + var Xq = function () { + return Aa('iPad') || Aa('Android') && !Aa('Mobile') || Aa('Silk'); + }; + var Zq, $i, $q, $h; + _.Yq = RegExp('^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$'); + Zq = function (a) { + return a ? decodeURI(a) : a; + }; + $i = function (a, b, c) { + if (Array.isArray(b)) + for (var d = 0; d < b.length; d++) + $i(a, String(b[d]), c); + else + null != b && c.push(a + ('' === b ? '' : '=' + encodeURIComponent(String(b)))); + }; + $q = /#|$/; + $h = function (a, b) { + var c = a.search($q); + a: { + var d = 0; + for (var e = b.length; 0 <= (d = a.indexOf(b, d)) && d < c;) { + var f = a.charCodeAt(d - 1); + if (38 == f || 63 == f) + if (f = a.charCodeAt(d + e), !f || 61 == f || 38 == f || 35 == f) + break a; + d += e + 1; + } + d = -1; + } + if (0 > d) + return null; + e = a.indexOf('&', d); + if (0 > e || e > c) + e = c; + d += b.length + 1; + return decodeURIComponent(a.substr(d, e - d).replace(/\+/g, ' ')); + }; + var bc, ac, Uc, ar, Vc, di, ug, Hd, br, cr, Mg, ag, fr, gr, er, hr, ir, vg, jr, kr, lr, mr, nr, or, Og, pr, qr, rr, Ch, Ii, Ki, Gi, Hi, Ji, Wk, sr, ur, vr, wr, xr, yr, Cc, zr, Ar, lh, Br, Cr, Dr, Er, Fr; + bc = function (a) { + try { + return !!a && null != a.location.href && Yn(a, 'foo'); + } catch (b) { + return !1; + } + }; + ac = function (a, b, c, d) { + d = d || _.r; + c && (d = ar(d)); + for (c = 0; d && 40 > c++ && (!b && !bc(d) || !a(d));) + d = ar(d); + }; + Uc = function () { + var a, b = a = void 0 === a ? _.r : a; + ac(function (c) { + b = c; + return !1; + }); + return b; + }; + ar = function (a) { + try { + var b = a.parent; + if (b && b != a) + return b; + } catch (c) { + } + return null; + }; + Vc = function (a) { + return bc(a.top) ? a.top : null; + }; + di = function (a, b) { + var c = _.Oi('SCRIPT', a); + bb(c, b); + return (a = a.getElementsByTagName('script')[0]) && a.parentNode ? (a.parentNode.insertBefore(c, a), c) : null; + }; + ug = function (a, b) { + return b.getComputedStyle ? b.getComputedStyle(a, null) : a.currentStyle; + }; + Hd = function () { + if (!v.globalThis.crypto) + return Math.random(); + try { + var a = new Uint32Array(1); + v.globalThis.crypto.getRandomValues(a); + return a[0] / 65536 / 65536; + } catch (b) { + return Math.random(); + } + }; + _.ef = function (a, b, c) { + if (a) + for (var d in a) + Object.prototype.hasOwnProperty.call(a, d) && b.call(c, a[d], d, a); + }; + br = function (a) { + for (var b in a) + if (Object.prototype.hasOwnProperty.call(a, b)) + return !1; + return !0; + }; + cr = function (a) { + var b = []; + _.ef(a, function (c, d) { + b.push(d); + }); + return b; + }; + _.dr = function (a) { + var b = []; + _.ef(a, function (c) { + b.push(c); + }); + return b; + }; + Mg = function (a, b) { + return va(a, function (c, d) { + return Object.prototype.hasOwnProperty.call(a, d) && b(c, d); + }); + }; + ag = function (a) { + var b = a.length; + if (0 == b) + return 0; + for (var c = 305419896, d = 0; d < b; d++) + c ^= (c << 5) + (c >> 2) + a.charCodeAt(d) & 4294967295; + return 0 < c ? c : 4294967296 + c; + }; + fr = tg(function () { + return _.Rd([ + 'Google Web Preview', + 'Mediapartners-Google', + 'Google-Read-Aloud', + 'Google-Adwords' + ], er) || 0.0001 > Math.random(); + }); + gr = function (a, b) { + try { + if (a) + return a.setItem('google_experiment_mod', b), b; + } catch (c) { + } + return null; + }; + er = function (a) { + return -1 != za().indexOf(a); + }; + hr = /^([0-9.]+)px$/; + ir = function () { + return /^true$/.test('false'); + }; + vg = function (a) { + return (a = hr.exec(a)) ? +a[1] : null; + }; + jr = function (a, b) { + b = void 0 === b ? !0 : b; + try { + for (var c = null; c != a; c = a, a = a.parent) + switch (a.location.protocol) { + case 'https:': + return !0; + case 'file:': + return b; + case 'http:': + return !1; + } + } catch (d) { + } + return !0; + }; + kr = function (a) { + if (!a) + return ''; + var b = RegExp('.*[&#?]google_debug(=[^&]*)?(&.*)?$'); + try { + var c = b.exec(decodeURIComponent(a)); + if (c) + return c[1] && 1 < c[1].length ? c[1].substring(1) : 'true'; + } catch (d) { + } + return ''; + }; + lr = { + Ie: 'allow-forms', + Je: 'allow-modals', + Ke: 'allow-orientation-lock', + Le: 'allow-pointer-lock', + Me: 'allow-popups', + Ne: 'allow-popups-to-escape-sandbox', + Oe: 'allow-presentation', + Pe: 'allow-same-origin', + Qe: 'allow-scripts', + Re: 'allow-top-navigation', + Se: 'allow-top-navigation-by-user-activation' + }; + mr = tg(function () { + return _.dr(lr); + }); + nr = function (a) { + var b = mr(); + return a.length ? _.Cd(b, function (c) { + return !(0 <= _.da(a, c)); + }) : b; + }; + or = function () { + var a = _.Oi('IFRAME'), b = {}; + _.hn(mr(), function (c) { + a.sandbox && a.sandbox.supports && a.sandbox.supports(c) && (b[c] = !0); + }); + return b; + }; + Og = function (a) { + a = a && a.toString && a.toString(); + return 'string' === typeof a && -1 != a.indexOf('[native code]'); + }; + pr = function (a, b) { + try { + return !(!a.frames || !a.frames[b]); + } catch (c) { + return !1; + } + }; + qr = function (a, b) { + for (var c = 0; 50 > c; ++c) { + if (pr(a, b)) + return a; + if (!(a = ar(a))) + break; + } + return null; + }; + rr = function (a, b) { + if (!b || !b.frames) + return null; + if (b.frames[a]) + return b.frames[a].frameElement; + try { + var c = b.document, d = c.head, e, f = null != (e = c.body) ? e : null == d ? void 0 : d.parentElement; + if (f) { + var g = _.Oi('IFRAME'); + g.name = a; + g.id = a; + g.setAttribute('style', 'display:none;position:fixed;left:-999px;top:-999px;width:0px;height:0px;'); + f.appendChild(g); + return g; + } + } catch (h) { + } + return null; + }; + Ch = tg(function () { + return !Xq() && (Aa('iPod') || Aa('iPhone') || Aa('Android') || Aa('IEMobile')) ? 2 : Xq() ? 1 : 0; + }); + Ii = function (a, b) { + var c; + for (c = void 0 === c ? 100 : c; a && c--;) { + if (a == b) + return !0; + a = a.parentElement; + } + return !1; + }; + _.wi = function (a, b) { + _.ef(b, function (c, d) { + a.style.setProperty(d, c, 'important'); + }); + }; + Ki = function (a, b, c) { + for (c = void 0 === c ? 100 : c; a && c-- && !1 !== b(a);) + a = a.parentElement; + }; + Gi = function (a) { + return Ji(a, function (b) { + return 'fixed' == b.position || 'sticky' == b.position; + }); + }; + Hi = function (a) { + return Ji(a, function (b) { + return 'left' == b['float'] || 'right' == b['float'] || 'left' == b.cssFloat || 'right' == b.cssFloat; + }); + }; + Ji = function (a, b) { + var c; + for (c = void 0 === c ? 100 : c; a && c--;) { + var d = ug(a, window); + if (d) { + if (b(d)) + return !0; + a = a.parentElement; + } + } + return !1; + }; + Wk = function (a) { + if (!a) + return null; + a = a.transform; + if (!a) + return null; + a = a.replace(/^.*\(([0-9., -]+)\)$/, '$1').split(/, /); + return 6 != a.length ? null : _.Ad(a, parseFloat); + }; + sr = {}; + _.tr = (sr['http://googleads.g.doubleclick.net'] = !0, sr['http://pagead2.googlesyndication.com'] = !0, sr['https://googleads.g.doubleclick.net'] = !0, sr['https://pagead2.googlesyndication.com'] = !0, sr); + ur = function (a) { + _.r.console && _.r.console.warn && _.r.console.warn(a); + }; + vr = []; + wr = function () { + var a = vr; + vr = []; + a = _.y(a); + for (var b = a.next(); !b.done; b = a.next()) { + b = b.value; + try { + b(); + } catch (c) { + } + } + }; + xr = function (a) { + return a.replace(/\\(n|r|\\)/g, function (b, c) { + return 'n' == c ? '\n' : 'r' == c ? '\r' : '\\'; + }); + }; + yr = function () { + return Math.floor(Math.random() * Math.pow(2, 52)); + }; + Cc = function (a) { + if ('number' !== typeof a.goog_pvsid) + try { + Object.defineProperty(a, 'goog_pvsid', { + value: yr(), + configurable: !1 + }); + } catch (b) { + } + return Number(a.goog_pvsid) || -1; + }; + zr = function (a, b) { + dc(_.Tq(_.Mq(a)), a, b); + }; + Ar = function (a, b) { + 'complete' === a.readyState || 'interactive' === a.readyState ? (vr.push(b), 1 == vr.length && (v.Promise ? v.Promise.resolve().then(wr) : window.setImmediate ? setImmediate(wr) : setTimeout(wr, 0))) : a.addEventListener('DOMContentLoaded', b); + }; + lh = function (a) { + return 0 === a || 'number' === typeof a && isFinite(a) && 0 == a % 1 && 0 < a; + }; + Br = function (a) { + try { + return Math.round(Date.parse(a.lastModified) / 1000) || null; + } catch (b) { + return null; + } + }; + Cr = function (a, b) { + var c = _.Oi('DIV'); + c.id = a; + c.textContent = b; + _.wi(c, { + height: '24px', + 'line-height': '24px', + 'text-align': 'center', + 'vertical-align': 'middle', + color: 'white', + 'background-color': 'black', + margin: '0', + 'font-family': 'Roboto', + 'font-style': 'normal', + 'font-weight': '500', + 'font-size': '11px', + 'letter-spacing': '0.08em' + }); + return c; + }; + Dr = function (a) { + return new v.Promise(function (b) { + setTimeout(function () { + return void b('timeout'); + }, a); + }); + }; + Er = function (a) { + try { + var b = JSON.stringify(a); + } catch (c) { + } + return b || String(a); + }; + _.Oi = function (a, b) { + b = void 0 === b ? document : b; + return b.createElement(String(a).toLowerCase()); + }; + Fr = function (a) { + for (var b = a; a && a != a.parent;) + a = a.parent, bc(a) && (b = a); + return b; + }; + _.Gr = function (a, b, c, d) { + this.top = a; + this.right = b; + this.bottom = c; + this.left = d; + }; + _.Gr.prototype.getWidth = function () { + return this.right - this.left; + }; + _.Gr.prototype.getHeight = function () { + return this.bottom - this.top; + }; + _.Hr = function (a) { + return new _.Gr(a.top, a.right, a.bottom, a.left); + }; + _.Gr.prototype.ceil = function () { + this.top = Math.ceil(this.top); + this.right = Math.ceil(this.right); + this.bottom = Math.ceil(this.bottom); + this.left = Math.ceil(this.left); + return this; + }; + _.Gr.prototype.floor = function () { + this.top = Math.floor(this.top); + this.right = Math.floor(this.right); + this.bottom = Math.floor(this.bottom); + this.left = Math.floor(this.left); + return this; + }; + _.Gr.prototype.round = function () { + this.top = Math.round(this.top); + this.right = Math.round(this.right); + this.bottom = Math.round(this.bottom); + this.left = Math.round(this.left); + return this; + }; + var Ir = function (a, b, c, d) { + this.left = a; + this.top = b; + this.width = c; + this.height = d; + }, Jr = function (a) { + return new _.Gr(a.top, a.left + a.width, a.top + a.height, a.left); + }, Kr = function (a, b) { + var c = Math.max(a.left, b.left), d = Math.min(a.left + a.width, b.left + b.width); + if (c <= d) { + var e = Math.max(a.top, b.top); + a = Math.min(a.top + a.height, b.top + b.height); + if (e <= a) + return new Ir(c, e, d - c, a - e); + } + return null; + }; + Ir.prototype.ceil = function () { + this.left = Math.ceil(this.left); + this.top = Math.ceil(this.top); + this.width = Math.ceil(this.width); + this.height = Math.ceil(this.height); + return this; + }; + Ir.prototype.floor = function () { + this.left = Math.floor(this.left); + this.top = Math.floor(this.top); + this.width = Math.floor(this.width); + this.height = Math.floor(this.height); + return this; + }; + Ir.prototype.round = function () { + this.left = Math.round(this.left); + this.top = Math.round(this.top); + this.width = Math.round(this.width); + this.height = Math.round(this.height); + return this; + }; + var Lr = function (a) { + a = void 0 === a ? _.r : a; + var b = a.context || a.AMP_CONTEXT_DATA; + if (!b) + try { + b = a.parent.context || a.parent.AMP_CONTEXT_DATA; + } catch (c) { + } + try { + if (b && b.pageViewId && b.canonicalUrl) + return b; + } catch (c) { + } + return null; + }, Mr = function (a) { + return (a = a || Lr()) ? bc(a.master) ? a.master : null : null; + }, Or = function (a, b) { + if (a.ampInaboxInitialized) + return !0; + var c, d = 'amp-ini-load' === b.data; + a.ampInaboxPendingMessages && !d && (c = /^amp-(\d{15,20})?/.exec(b.data)) && (a.ampInaboxPendingMessages.push(b), Nr(a, c[1])); + return !1; + }, Pr = function (a, b, c) { + var d = !0; + d = void 0 === d ? !1 : d; + var e = a.ampInaboxIframes = a.ampInaboxIframes || [], f = function () { + }, g = function () { + }; + b && (e.push(b), g = function () { + a.AMP && a.AMP.inaboxUnregisterIframe && a.AMP.inaboxUnregisterIframe(b); + fa(e, b); + f(); + }); + if (a.ampInaboxInitialized) + return g; + a.ampInaboxPendingMessages = a.ampInaboxPendingMessages || []; + c && /^\d{15,20}$/.test(c) && Nr(a, c); + var h = function (k) { + Or(a, k) && f(); + }; + d || e.google_amp_listener_added || (e.google_amp_listener_added = !0, _.fb(a, 'message', h), f = function () { + _.Lc(a, 'message', h); + }); + return g; + }, Nr = function (a, b) { + a.ampInaboxInitialized || b && !/^\d{15,20}$/.test(b) || a.document.querySelector('script[src$="amp4ads-host-v0.js"]') || di(a.document, b ? pb(gn('https://cdn.ampproject.org/rtv/%{ampVersion}/amp4ads-host-v0.js'), { ampVersion: b }) : ei(fd(gn('https://cdn.ampproject.org/amp4ads-host-v0.js')))); + }; + var Bc, Zl; + _.Qr = function (a, b) { + a.google_image_requests || (a.google_image_requests = []); + var c = _.Oi('IMG', a.document); + c.src = b; + a.google_image_requests.push(c); + }; + Bc = function (a, b) { + var c = 'https://pagead2.googlesyndication.com/pagead/gen_204?id=' + b; + _.ef(a, function (d, e) { + d && (c += '&' + e + '=' + encodeURIComponent(d)); + }); + Zl(c); + }; + Zl = function (a) { + var b = window; + b.fetch ? b.fetch(a, { + keepalive: !0, + credentials: 'include', + redirect: 'follow', + method: 'get', + mode: 'no-cors' + }) : _.Qr(b, a); + }; + _.ec = function (a) { + this.Qd = a; + }; + _.Rr = [ + fc('data'), + fc('http'), + fc('https'), + fc('mailto'), + fc('ftp'), + new _.ec(function (a) { + return /^[^:]*([/?#]|$)/.test(a); + }) + ]; + var Ur, Nd, Wr, Xr, Yr, hg, kg; + _.Tr = function (a, b, c) { + if ('string' === typeof b) + (b = _.Sr(a, b)) && (a.style[b] = c); + else + for (var d in b) { + c = a; + var e = b[d], f = _.Sr(c, d); + f && (c.style[f] = e); + } + }; + Ur = {}; + _.Sr = function (a, b) { + var c = Ur[b]; + if (!c) { + var d = _.Jq(b); + c = d; + void 0 === a.style[d] && (d = (eo ? 'Webkit' : co ? 'Moz' : _.ao ? 'ms' : null) + Kq(d), void 0 !== a.style[d] && (c = d)); + Ur[b] = c; + } + return c; + }; + _.Vr = function (a, b) { + var c = _.Mq(a); + return c.defaultView && c.defaultView.getComputedStyle && (a = c.defaultView.getComputedStyle(a, null)) ? a[b] || a.getPropertyValue(b) || '' : ''; + }; + Nd = function (a, b) { + return _.Vr(a, b) || (a.currentStyle ? a.currentStyle[b] : null) || a.style && a.style[b]; + }; + Wr = function (a) { + try { + return a.getBoundingClientRect(); + } catch (b) { + return { + left: 0, + top: 0, + right: 0, + bottom: 0 + }; + } + }; + Xr = function (a) { + if (_.ao && !(8 <= Number(ro))) + return a.offsetParent; + var b = _.Mq(a), c = Nd(a, 'position'), d = 'fixed' == c || 'absolute' == c; + for (a = a.parentNode; a && a != b; a = a.parentNode) + if (11 == a.nodeType && a.host && (a = a.host), c = Nd(a, 'position'), d = d && 'static' == c && a != b.documentElement && a != b.body, !d && (a.scrollWidth > a.clientWidth || a.scrollHeight > a.clientHeight || 'fixed' == c || 'absolute' == c || 'relative' == c)) + return a; + return null; + }; + Yr = function (a) { + var b = _.Mq(a), c = new _.ig(0, 0); + var d = b ? _.Mq(b) : document; + d = !_.ao || 9 <= Number(ro) || _.Qq(Nq(d).j) ? d.documentElement : d.body; + if (a == d) + return c; + a = Wr(a); + d = Nq(b).j; + b = Sq(d); + d = d.parentWindow || d.defaultView; + b = _.ao && oo('10') && d.pageYOffset != b.scrollTop ? new _.ig(b.scrollLeft, b.scrollTop) : new _.ig(d.pageXOffset || b.scrollLeft, d.pageYOffset || b.scrollTop); + c.x = a.left + b.x; + c.y = a.top + b.y; + return c; + }; + hg = function (a, b) { + var c = new _.ig(0, 0), d = _.Tq(_.Mq(a)); + if (!Yn(d, 'parent')) + return c; + do { + var e = d == b ? Yr(a) : _.Zr(a); + c.x += e.x; + c.y += e.y; + } while (d && d != b && d != d.parent && (a = d.frameElement) && (d = d.parent)); + return c; + }; + _.Zr = function (a) { + a = Wr(a); + return new _.ig(a.left, a.top); + }; + _.$r = function (a, b) { + 'number' == typeof a && (a = (b ? Math.round(a) : a) + 'px'); + return a; + }; + _.Od = function (a, b) { + if ('none' != Nd(b, 'display')) + return a(b); + var c = b.style, d = c.display, e = c.visibility, f = c.position; + c.visibility = 'hidden'; + c.position = 'absolute'; + c.display = 'inline'; + a = a(b); + c.display = d; + c.position = f; + c.visibility = e; + return a; + }; + _.Pd = function (a) { + var b = a.offsetWidth, c = a.offsetHeight, d = eo && !b && !c; + return (void 0 === b || d) && a.getBoundingClientRect ? (a = Wr(a), new _.Ui(a.right - a.left, a.bottom - a.top)) : new _.Ui(b, c); + }; + kg = function (a) { + if (!a.getBoundingClientRect) + return null; + a = _.Od(Wr, a); + return new _.Ui(a.right - a.left, a.bottom - a.top); + }; + var Ei = function (a) { + a = Mr(Lr(a)) || a; + a = a.google_unique_id; + return 'number' === typeof a ? a : 0; + }, as = !!window.google_async_iframe_id, bs = as && window.parent || window, cs = function () { + if (as && !bc(bs)) { + var a = '.' + qq.domain; + try { + for (; 2 < a.split('.').length && !bc(bs);) + qq.domain = a = a.substr(a.indexOf('.') + 1), bs = window.parent; + } catch (b) { + } + bc(bs) || (bs = window); + } + bs !== window && 0.01 > Math.random() && Bc({ + stack: Error().stack, + aswift: window.google_async_iframe_id + }, 'badpubwin'); + return bs; + }, ds = function (a) { + var b = a.ActiveXObject; + if (a.navigator.plugins && a.navigator.mimeTypes.length) { + if ((b = a.navigator.plugins['Shockwave Flash']) && b.description) + return b.description.replace(/([a-zA-Z]|\s)+/, '').replace(/(\s)+r/, '.'); + } else { + if (a.navigator.userAgent && 0 <= a.navigator.userAgent.indexOf('Windows CE')) { + var c = 3; + for (a = 1; a;) + try { + a = new b('ShockwaveFlash.ShockwaveFlash.' + (c + 1)), c++; + } catch (d) { + a = null; + } + return c.toString(); + } + if (Ca()) { + a = null; + try { + a = new b('ShockwaveFlash.ShockwaveFlash.7'); + } catch (d) { + c = 0; + try { + a = new b('ShockwaveFlash.ShockwaveFlash.6'), c = 6, a.AllowScriptAccess = 'always'; + } catch (e) { + if (6 === c) + return c.toString(); + } + try { + a = new b('ShockwaveFlash.ShockwaveFlash'); + } catch (e) { + } + } + if (a) + return c = a.GetVariable('$version').split(' ')[1], c.replace(/,/g, '.'); + } + } + return '0'; + }, cl = function (a) { + a = void 0 === a ? window : a; + try { + return ds(a); + } catch (b) { + return '0'; + } + }; + var es = kc(function (a) { + var b = [], c = {}; + a = _.y(a); + for (var d = a.next(); !d.done; c = { vb: c.vb }, d = a.next()) + c.vb = d.value, kc(function (e) { + return function () { + b.push('[{"' + e.vb.$c + '":' + e.vb.message.X() + '}]'); + }; + }(c))(); + return '[[' + b.join(',') + ']]'; + }); + var fs = function (a, b) { + if (v.globalThis.fetch) + v.globalThis.fetch(a, { + method: 'POST', + body: b, + keepalive: 65536 > b.length, + credentials: 'omit', + mode: 'no-cors', + redirect: 'follow' + }); + else { + var c = new XMLHttpRequest(); + c.open('POST', a, !0); + c.send(b); + } + }; + var pm = function (a) { + var b = void 0 === b ? fs : b; + this.A = void 0 === a ? 1000 : a; + this.F = b; + this.m = []; + this.j = null; + }; + pm.prototype.Zc = function () { + var a = gc.apply(0, arguments), b = this; + kc(function () { + b.m.push.apply(b.m, _.lc(a)); + var c = kc(function () { + var d = es(b.m); + b.F('https://pagead2.googlesyndication.com/pagead/ping?e=1', d); + b.m = []; + b.j = null; + }); + 100 <= b.m.length ? (null !== b.j && clearTimeout(b.j), b.j = setTimeout(c, 0)) : null === b.j && (b.j = setTimeout(c, b.A)); + })(); + }; + var R = function (a, b) { + this.j = a; + this.defaultValue = void 0 === b ? !1 : b; + }, gs = function (a, b) { + this.j = a; + this.defaultValue = void 0 === b ? 0 : b; + }, hs = function (a, b) { + this.j = a; + this.defaultValue = void 0 === b ? '' : b; + }, is = function (a, b) { + b = void 0 === b ? [] : b; + this.j = a; + this.defaultValue = b; + }; + var Tk, Bl, Dl, nf, js, ks, ls, ms, Fi, ns, os, ps, qs, rs, ss, ts, us, vs, ws, xs, ys, zs, As, Bs, Cs, Ds, Es, Fs, Gs, Hs, Is, Js, Ks, vf, Ls, Ms, Ns, Os, Ps, Qs, Rs, Ss, Ts, Us, Vs, Ws, Wj, Xs, Ys, bl, Zs, $s, at, bt, ct, al, dt, et, gl, ft, Pl, Of, gt, ht, qf, it, qm, jt, kt, lt, mt, nt, ot, pt, qt, hk, rt, st, Zi, tt, ut, Xg, vt, wt, xt, yt, zt, At, Bt, Ct, Dt, Et, nm, Ft, Gt, Ht, It, Wc, Jt, Kt, Fc, Lt, Mt, Nt, Ac, Ot, vq, xq, Hf, Pt, Qt, Eh, Rt, tq, St, Ut, Vt, Wt, Ri, Xt, Yt, Zt, $t, au, bu, cu; + Tk = new R(98); + Bl = new R(206); + Dl = new gs(465); + nf = new R(144); + js = new R(368279556); + ks = new R(366809413); + ls = new hs(3); + ms = new is(481); + Fi = new gs(7, 0.1); + ns = new R(212); + os = new gs(383474324); + ps = new gs(413725046); + qs = new gs(387165532); + rs = new R(410803690); + ss = new R(401851958); + ts = new R(359351145); + us = new R(398776878); + vs = new R(391385505); + ws = new R(23); + xs = new R(369430); + ys = new gs(357045128); + zs = new R(410883576); + As = new R(411170147); + Bs = new R(402905035); + Cs = new R(395842139); + Ds = new R(403405932); + Es = new gs(408380992, 0.01); + Fs = new R(400963806); + Gs = new R(400963805); + Hs = new R(400992469); + Is = new R(400992468, !0); + Js = new gs(397316938, 1000); + Ks = new gs(385440135, 1000); + vf = new R(378290973); + Ls = new gs(377289019, 10000); + Ms = new gs(385610149, 300); + Ns = new R(384734642); + Os = new gs(488); + Ps = new gs(529, 20); + Qs = new hs(10); + Rs = new gs(405881106); + Ss = new R(360245597); + Ts = new R(45360254); + Us = new gs(494, 5000); + Vs = new gs(517); + Ws = new R(384700360); + Wj = new R(384700361); + Xs = new R(410573952); + Ys = new R(411840949); + bl = new R(413681686); + Zs = new R(371390390); + $s = new R(413477729); + at = new R(413925305); + bt = new R(387626692); + ct = new R(402181801); + al = new R(413667516); + dt = new R(20); + et = new R(220); + gl = new R(200); + ft = new R(111); + Pl = new R(323); + _.Ff = new gs(388529191); + Of = new gs(492, 0.01); + gt = new gs(363650251); + ht = new R(83); + qf = new R(85); + it = new R(402847016); + qm = new gs(389357230, 1000); + jt = new gs(398776877, 60000); + kt = new gs(374201269, 60000); + lt = new gs(371364213, 60000); + mt = new gs(373440923, 0.0001); + nt = new gs(376149757, 0.0025); + ot = new gs(396668915, 5); + pt = new R(396668914); + qt = new R(399982759, !0); + hk = new R(377936516); + rt = new gs(47, 1); + st = new gs(25); + Zi = new is(1); + tt = new hs(2, '1-0-38'); + ut = new R(116); + Xg = new R(416); + vt = new R(414440070); + wt = new R(409147416); + xt = new is(489); + yt = new R(371157910); + zt = new R(392065905); + At = new R(360245598); + Bt = new gs(360245595, 500); + Ct = new R(360245596); + Dt = new R(396442598, !0); + Et = new gs(359346956); + nm = new gs(61, 0.001); + Ft = new R(399705355); + Gt = new R(522); + Ht = new R(501); + It = new hs(363931022); + Wc = new R(1930); + Jt = new R(453); + Kt = new R(454); + Fc = new gs(360261971); + Lt = new gs(1921, 72); + Mt = new gs(1920, 24); + Nt = new gs(1917, 300); + Ac = new gs(1916, 0.001); + Ot = new is(1934, [ + 'A8FHS1NmdCwGqD9DwOicnHHY+y27kdWfxKa0YHSGDfv0CSpDKRHTQdQmZVPDUdaFWUsxdgVxlwAd6o+dhJykPA0AAACWeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9', + 'A8zdXi6dr1hwXEUjQrYiyYQGlU3557y5QWDnN0Lwgj9ePt66XMEvNkVWOEOWPd7TP9sBQ25X0Q15Lr1Nn4oGFQkAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9', + 'A4/Htern2udN9w3yJK9QgWQxQFruxOXsXL7cW60DyCl0EZFGCSme/J33Q/WzF7bBkVvhEWDlcBiUyZaim5CpFQwAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9' + ]); + vq = new R(77); + xq = new R(78); + Hf = new R(309); + Pt = new R(1959); + Qt = new R(1953, !0); + Eh = new R(1960); + Rt = new R(80); + tq = new R(76); + St = new R(81); + _.Tt = new R(1947); + Ut = new R(84); + Vt = new R(1958); + Wt = new R(188); + Ri = new R(1948, !0); + Xt = new R(1928); + Yt = new R(1941); + Zt = new R(370946349); + $t = new R(392736476); + au = new gs(406149835); + bu = new R(397841828); + cu = new is(1932, [ + 'AxujKG9INjsZ8/gUq8+dTruNvk7RjZQ1oFhhgQbcTJKDnZfbzSTE81wvC2Hzaf3TW4avA76LTZEMdiedF1vIbA4AAABueyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzVGhpcmRQYXJ0eSI6dHJ1ZX0=', + 'Azuce85ORtSnWe1MZDTv68qpaW3iHyfL9YbLRy0cwcCZwVnePnOmkUJlG8HGikmOwhZU22dElCcfrfX2HhrBPAkAAAB7eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'A16nvcdeoOAqrJcmjLRpl1I6f3McDD8EfofAYTt/P/H4/AWwB99nxiPp6kA0fXoiZav908Z8etuL16laFPUdfQsAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'AxBHdr0J44vFBQtZUqX9sjiqf5yWZ/OcHRcRMN3H9TH+t90V/j3ENW6C8+igBZFXMJ7G3Pr8Dd13632aLng42wgAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'A88BWHFjcawUfKU3lIejLoryXoyjooBXLgWmGh+hNcqMK44cugvsI5YZbNarYvi3roc1fYbHA1AVbhAtuHZflgEAAAB2eyJvcmlnaW4iOiJodHRwczovL2dvb2dsZS5jb206NDQzIiwiZmVhdHVyZSI6IlRydXN0VG9rZW5zIiwiZXhwaXJ5IjoxNjUyNzc0NDAwLCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==' + ]); + var du = function (a, b, c, d, e, f) { + try { + var g = a.j, h = _.Oi('SCRIPT', g); + h.async = !0; + bb(h, b); + g.head.appendChild(h); + h.addEventListener('load', function () { + e(); + d && g.head.removeChild(h); + }); + h.addEventListener('error', function () { + 0 < c ? du(a, b, c - 1, d, e, f) : (d && g.head.removeChild(h), f()); + }); + } catch (k) { + f(); + } + }, eu = function (a, b, c, d) { + c = void 0 === c ? function () { + } : c; + d = void 0 === d ? function () { + } : d; + du(Nq(a), b, 0, !1, c, d); + }; + var fu = function (a) { + var b = a.document, c = function () { + if (!a.frames.googlefcPresent) + if (b.body) { + var d = _.Oi('IFRAME', b); + d.style.display = 'none'; + d.style.width = '0px'; + d.style.height = '0px'; + d.style.border = 'none'; + d.style.zIndex = '-1000'; + d.style.left = '-1000px'; + d.style.top = '-1000px'; + d.name = 'googlefcPresent'; + b.body.appendChild(d); + } else + a.setTimeout(c, 5); + }; + c(); + }; + _.gu = function () { + this.m = this.m; + this.ia = this.ia; + }; + _.gu.prototype.m = !1; + _.gu.prototype.ua = function () { + this.m || (this.m = !0, this.F()); + }; + _.hu = function (a, b) { + _.zl(a, _.cn(oc, b)); + }; + _.zl = function (a, b) { + a.m ? b() : (a.ia || (a.ia = []), a.ia.push(b)); + }; + _.gu.prototype.F = function () { + if (this.ia) + for (; this.ia.length;) + this.ia.shift()(); + }; + var iu = function (a) { + void 0 !== a.addtlConsent && 'string' !== typeof a.addtlConsent && (a.addtlConsent = void 0); + void 0 !== a.gdprApplies && 'boolean' !== typeof a.gdprApplies && (a.gdprApplies = void 0); + return void 0 !== a.tcString && 'string' !== typeof a.tcString || void 0 !== a.listenerId && 'number' !== typeof a.listenerId ? 2 : a.cmpStatus && 'error' !== a.cmpStatus ? 0 : 3; + }, jm = function (a, b) { + b = void 0 === b ? 500 : b; + _.gu.call(this); + this.j = a; + this.A = null; + this.l = {}; + this.B = 0; + this.o = b; + this.D = null; + }; + _.O(jm, _.gu); + jm.prototype.F = function () { + this.l = {}; + this.D && (_.Lc(this.j, 'message', this.D), delete this.D); + delete this.l; + delete this.j; + delete this.A; + _.gu.prototype.F.call(this); + }; + var lm = function (a) { + return 'function' === typeof a.j.__tcfapi || null != ju(a); + }; + jm.prototype.addEventListener = function (a) { + var b = {}, c = _.Vn(function () { + return a(b); + }), d = 0; + -1 !== this.o && (d = setTimeout(function () { + b.tcString = 'tcunavailable'; + b.internalErrorState = 1; + c(); + }, this.o)); + var e = function (f, g) { + clearTimeout(d); + f ? (b = f, b.internalErrorState = iu(b), g && 0 === b.internalErrorState || (b.tcString = 'tcunavailable', g || (b.internalErrorState = 3))) : (b.tcString = 'tcunavailable', b.internalErrorState = 3); + a(b); + }; + try { + ku(this, 'addEventListener', e); + } catch (f) { + b.tcString = 'tcunavailable', b.internalErrorState = 3, d && (clearTimeout(d), d = 0), c(); + } + }; + jm.prototype.removeEventListener = function (a) { + a && a.listenerId && ku(this, 'removeEventListener', null, a.listenerId); + }; + var mu = function (a, b) { + var c = { internalErrorState: 0 }, d = _.Vn(function () { + return b(c); + }), e = 0; + -1 !== a.o && (e = setTimeout(function () { + c.tcString = 'tcunavailable'; + c.internalErrorState = 1; + d(); + }, a.o)); + ku(a, 'addEventListener', function (f, g) { + e && (clearTimeout(e), e = 0); + g && (c = f); + c.internalErrorState = iu(c); + 0 != c.internalErrorState && (c.tcString = 'tcunavailable'); + if (0 != c.internalErrorState || lu(c)) + ku(a, 'removeEventListener', null, c.listenerId), d(); + }); + }, ku = function (a, b, c, d) { + c || (c = function () { + }); + if ('function' === typeof a.j.__tcfapi) + a = a.j.__tcfapi, a(b, 2, c, d); + else if (ju(a)) { + nu(a); + var e = ++a.B; + a.l[e] = c; + a.A && (c = {}, a.A.postMessage((c.__tcfapiCall = { + command: b, + version: 2, + callId: e, + parameter: d + }, c), '*')); + } else + c({}, !1); + }, ju = function (a) { + if (a.A) + return a.A; + a.A = qr(a.j, '__tcfapiLocator'); + return a.A; + }, nu = function (a) { + a.D || (a.D = function (b) { + try { + var c = ('string' === typeof b.data ? JSON.parse(b.data) : b.data).__tcfapiReturn; + a.l[c.callId](c.returnValue, c.success); + } catch (d) { + } + }, _.fb(a.j, 'message', a.D)); + }, lu = function (a) { + if (!1 === a.gdprApplies) + return !0; + void 0 === a.internalErrorState && (a.internalErrorState = iu(a)); + return 'error' === a.cmpStatus || 0 !== a.internalErrorState || 'loaded' === a.cmpStatus && ('tcloaded' === a.eventStatus || 'useractioncomplete' === a.eventStatus) ? !0 : !1; + }; + var ou = function (a, b, c) { + this.j = a; + this.F = b; + this.m = void 0 === c ? function () { + } : c; + }, pu = function (a, b, c) { + return new ou(a, b, c); + }; + ou.prototype.start = function () { + try { + fu(this.j), qu(this); + } catch (a) { + } + }; + var qu = function (a) { + var b = pb(gn('https://fundingchoicesmessages.google.com/i/%{id}?ers=%{ers}'), { + id: a.F, + ers: 3 + }); + eu(a.j, b, function () { + a.m(!0); + }, function () { + a.m(!1); + }); + }; + var F = { + Ze: function () { + }, + Af: function () { + return ''; + }, + Ve: function () { + } + }; + F.Ma = pc; + var ru = pc(function (a) { + return null !== a && void 0 !== a; + }, 'exists'); + F.assert = function () { + }; + F.va = function (a) { + return a; + }; + F.Kf = qc; + F.Nf = rc; + F.jb = function () { + }; + F.tf = function (a) { + return a; + }; + F.Mf = sc; + F.Pf = function (a) { + sc(a); + return a; + }; + F.sf = function () { + }; + F.H = function (a) { + return a; + }; + F.Lf = function (a) { + qc(a, ru); + }; + F.Of = function (a) { + return rc(a, ru); + }; + F.yf = function (a, b) { + return a(b); + }; + F.functionName = function (a) { + var b = a.name; + b || (b = (a = /function\s+([^\(]+)/m.exec(String(a))) ? a[1] : '(Anonymous)'); + return b; + }; + var ve = (0, F.Ma)(function (a) { + return 'number' === typeof a; + }, 'number'), se = (0, F.Ma)(function (a) { + return 'string' === typeof a; + }, 'string'), we = (0, F.Ma)(function (a) { + return 'boolean' === typeof a; + }, 'boolean'), ye = (0, F.Ma)(function (a) { + return null === a; + }, 'null'), xe = (0, F.Ma)(function (a) { + return void 0 === a; + }, 'undefined'), ze = (0, F.Ma)(function (a) { + return 'function' === typeof a; + }, 'Function'), Ae = (0, F.Ma)(function (a) { + return Array.isArray(a); + }, 'Array'); + var su = function (a) { + Q.call(this, a); + }; + _.O(su, Q); + var tu = function (a) { + Q.call(this, a); + }; + _.O(tu, Q); + var Ik = function (a) { + Q.call(this, a); + }; + _.O(Ik, Q); + var Fk = function (a) { + Q.call(this, a, -1, uu); + }; + _.O(Fk, Q); + Fk.prototype.getTagSessionCorrelator = function () { + return sk(this, 2); + }; + var uu = [4], Kk = [ + 6, + 7, + 8 + ]; + var Bf = function (a) { + Q.call(this, a, -1, vu); + }; + _.O(Bf, Q); + var vu = [3]; + var Af = function (a) { + Q.call(this, a, -1, wu); + }; + _.O(Af, Q); + var wu = [4]; + var xf = function (a) { + Q.call(this, a, -1, xu); + }; + _.O(xf, Q); + xf.prototype.getTagSessionCorrelator = function () { + return sk(this, 1); + }; + var xu = [2]; + var wf = function (a) { + Q.call(this, a); + }; + _.O(wf, Q); + var Ef = [4]; + _.Hg = function (a) { + var b = 'Ua'; + if (a.Ua && a.hasOwnProperty(b)) + return a.Ua; + b = new a(); + return a.Ua = b; + }; + var yu, zu, Yi; + yu = function () { + var a = {}; + this.m = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.F = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.A = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.D = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.j = function () { + }; + }; + _.H = function (a) { + return _.Hg(yu).m(a.j, a.defaultValue); + }; + _.zc = function (a) { + return _.Hg(yu).F(a.j, a.defaultValue); + }; + zu = function (a) { + return _.Hg(yu).A(a.j, a.defaultValue); + }; + Yi = function (a) { + return _.Hg(yu).D(a.j, a.defaultValue); + }; + var Au = navigator, Iu = function (a, b, c, d, e, f) { + if (Lr()) + return cs().gaGlobal || {}; + var g = Math.round(new Date().getTime() / 1000), h = f.google_analytics_domain_name; + a = 'undefined' == typeof h ? Bu('auto', a) : Bu(h, a); + var k = -1 < b.indexOf('__utma=' + a + '.'), l = -1 < b.indexOf('__utmb=' + a); + (f = (Mr() || cs()).gaGlobal) || (f = {}, (Mr() || cs()).gaGlobal = f); + var m = !1; + if (k) + e = b.split('__utma=' + a + '.')[1].split(';')[0].split('.'), l ? f.sid = e[3] : f.sid || (f.sid = g + ''), f.vid = e[0] + '.' + e[1], f.from_cookie = !0; + else { + f.sid || (f.sid = g + ''); + if (!f.vid) { + m = !0; + l = Math.round(2147483647 * Math.random()); + k = Au.appName; + var n = Au.version, q = Au.language ? Au.language : Au.browserLanguage, u = Au.platform, B = Au.userAgent; + try { + var x = Au.javaEnabled(); + } catch (C) { + x = !1; + } + x = [ + k, + n, + q, + u, + B, + x ? 1 : 0 + ].join(''); + d ? x += d.width + 'x' + d.height + d.colorDepth : _.r.java && _.r.java.awt && (d = _.r.java.awt.Toolkit.getDefaultToolkit().getScreenSize(), x += d.screen.width + 'x' + d.screen.height); + x = x + b + (e || ''); + for (e = x.length; 0 < c;) + x += c-- ^ e++; + f.vid = (l ^ Cu(x) & 2147483647) + '.' + g; + } + _.H(Qt) && f.from_cookie || (f.from_cookie = !1); + } + if (!f.cid) { + a: + for (g = 999, h && (h = 0 == h.indexOf('.') ? h.substr(1) : h, g = h.split('.').length), h = 999, b = b.split(';'), e = 0; e < b.length; e++) + if (d = Du.exec(b[e]) || Eu.exec(b[e]) || Fu.exec(b[e])) { + x = d[1] || 0; + if (x == g) { + var z = d[2]; + break a; + } + x < h && (h = x, z = d[2]); + } + m && z && -1 != z.search(/^\d+\.\d+$/) ? (f.vid = z, f.from_cookie = !0) : z != f.vid && (f.cid = z); + } + f.dh = a; + f.hid || (f.hid = Math.round(2147483647 * Math.random())); + return f; + }, Cu = function (a) { + var b = 1, c; + if (void 0 != a && '' != a) + for (b = 0, c = a.length - 1; 0 <= c; c--) { + var d = a.charCodeAt(c); + b = (b << 6 & 268435455) + d + (d << 14); + d = b & 266338304; + b = 0 != d ? b ^ d >> 21 : b; + } + return b; + }, Bu = function (a, b) { + if (!a || 'none' == a) + return 1; + a = String(a); + 'auto' == a && (a = b, 'www.' == a.substring(0, 4) && (a = a.substring(4, a.length))); + return Cu(a.toLowerCase()); + }, Du = RegExp('^\\s*_ga=\\s*1\\.(\\d+)[^.]*\\.(.*?)\\s*$'), Eu = RegExp('^[^=]+=\\s*GA1\\.(\\d+)[^.]*\\.(.*?)\\s*$'), Fu = RegExp('^\\s*_ga=\\s*()(amp-[\\w.-]{22,64})$'); + var fg = function (a) { + return !!a && a.top == a; + }, Ju = function (a, b, c, d) { + c = c || a.google_ad_width; + d = d || a.google_ad_height; + if (fg(a)) + return !1; + var e = b.documentElement; + if (c && d) { + var f = 1, g = 1; + a.innerHeight ? (f = a.innerWidth, g = a.innerHeight) : e && e.clientHeight ? (f = e.clientWidth, g = e.clientHeight) : b.body && (f = b.body.clientWidth, g = b.body.clientHeight); + if (g > 2 * d || f > 2 * c) + return !1; + } + return !0; + }; + var Ku = function (a) { + a = void 0 === a ? window : a; + return a._gmptnl ? 'afma-gpt-sdk-a' : a.webkit && a.webkit.messageHandlers && a.webkit.messageHandlers._gmptnl ? 'afma-gpt-sdk-i' : null; + }, Lu = function (a, b) { + b = void 0 === b ? window : b; + var c = Ku(b); + if (!c) + return null; + var d = null; + try { + 'afma-gpt-sdk-a' == c ? d = b._gmptnl.pm('GAM=', a) || '5' : (d = b.__gmptnl_n || '5', b.webkit.messageHandlers._gmptnl.postMessage('GAM=')); + } catch (e) { + return '3'; + } + return 'string' === typeof d ? d : '3'; + }; + var Cg = function () { + this.j = []; + this.m = -1; + }; + Cg.prototype.set = function (a, b) { + b = void 0 === b ? !0 : b; + 0 <= a && 52 > a && 0 === a % 1 && this.j[a] != b && (this.j[a] = b, this.m = -1); + }; + Cg.prototype.get = function (a) { + return !!this.j[a]; + }; + var Dg = function (a) { + -1 == a.m && (a.m = jn(a.j, function (b, c, d) { + return c ? b + Math.pow(2, d) : b; + })); + return a.m; + }; + var Nu = function (a) { + Q.call(this, a, -1, Mu); + }; + _.O(Nu, Q); + var Pu = function (a, b) { + gh(a, 1, Ou, b); + }, Ou = function (a) { + Q.call(this, a); + }; + _.O(Ou, Q); + var Qu = function (a) { + var b = new Ou(); + return Qb(b, 1, a, 0); + }, Ru = function (a, b) { + return Qb(a, 2, b, 0); + }, Mu = [1]; + var Tu = function (a, b) { + a: { + try { + if (a) { + var c = a.getItem('google_experiment_mod'); + break a; + } + } catch (g) { + } + c = null; + } + var d = c || ''; + c = null; + try { + if (c = Sl(Nu, d), d) { + var e = Sl(Nu, d); + Pu(e, Ru(Qu(1), -1)); + e.X(); + } + } catch (g) { + Su(d), c = new Nu(); + } + e = Ub(c, Ou, 1); + if (e = ba(e, function (g) { + return tk(g, 1, 0) === b; + })) { + var f = sk(e, 2); + if (null === f || isNaN(f)) + Su(d); + else + return f; + } + d = fr() ? null : Math.floor(1000 * Hd()); + if (null === d) + return null; + e ? Ru(e, d) : Pu(c, Ru(Qu(b), d)); + return gr(a, c.X()) ? d : null; + }, Su = function (a) { + 0.01 > Math.random() && Bc({ data: a }, 'ls_tamp'); + }; + var vc = function (a) { + this.j = a || { cookie: '' }; + }, Vu = function () { + var a = Uu; + if (!_.r.navigator.cookieEnabled) + return !1; + if (!a.isEmpty()) + return !0; + a.set('TESTCOOKIESENABLED', '1', { qc: 60 }); + if ('1' !== a.get('TESTCOOKIESENABLED')) + return !1; + a.remove('TESTCOOKIESENABLED'); + return !0; + }; + p = vc.prototype; + p.set = function (a, b, c) { + var d = !1; + if ('object' === typeof c) { + var e = c.Qf; + d = c.oe || !1; + var f = c.domain || void 0; + var g = c.path || void 0; + var h = c.qc; + } + if (/[;=\s]/.test(a)) + throw Error('Invalid cookie name "' + a + '"'); + if (/[;\r\n]/.test(b)) + throw Error('Invalid cookie value "' + b + '"'); + void 0 === h && (h = -1); + this.j.cookie = a + '=' + b + (f ? ';domain=' + f : '') + (g ? ';path=' + g : '') + (0 > h ? '' : 0 == h ? ';expires=' + new Date(1970, 1, 1).toUTCString() : ';expires=' + new Date(Date.now() + 1000 * h).toUTCString()) + (d ? ';secure' : '') + (null != e ? ';samesite=' + e : ''); + }; + p.get = function (a, b) { + for (var c = a + '=', d = (this.j.cookie || '').split(';'), e = 0, f; e < d.length; e++) { + f = Cn(d[e]); + if (0 == f.lastIndexOf(c, 0)) + return f.substr(c.length); + if (f == a) + return ''; + } + return b; + }; + p.remove = function (a, b, c) { + var d = void 0 !== this.get(a); + this.set(a, '', { + qc: 0, + path: b, + domain: c + }); + return d; + }; + p.isEmpty = function () { + return !this.j.cookie; + }; + p.clear = function () { + for (var a = (this.j.cookie || '').split(';'), b = [], c = [], d, e, f = 0; f < a.length; f++) + e = Cn(a[f]), d = e.indexOf('='), -1 == d ? (b.push(''), c.push(e)) : (b.push(e.substring(0, d)), c.push(e.substring(d + 1))); + for (a = b.length - 1; 0 <= a; a--) + this.remove(b[a]); + }; + var Wu = new vc('undefined' == typeof document ? null : document); + var Xu = null, Yu = function () { + if (null === Xu) { + Xu = ''; + try { + var a = ''; + try { + a = _.r.top.location.hash; + } catch (c) { + a = _.r.location.hash; + } + if (a) { + var b = a.match(/\bdeid=([\d,]+)/); + Xu = b ? b[1] : ''; + } + } catch (c) { + } + } + return Xu; + }; + var Zu, Hk; + _.xc = function (a) { + a = void 0 === a ? _.r : a; + return (a = a.performance) && a.now && a.timing ? Math.floor(a.now() + a.timing.navigationStart) : xd(); + }; + _.ll = function (a) { + a = void 0 === a ? _.r : a; + return (a = a.performance) && a.now ? a.now() : null; + }; + Zu = function (a, b) { + b = void 0 === b ? _.r : b; + var c, d; + return (null == (c = b.performance) ? void 0 : null == (d = c.timing) ? void 0 : d[a]) || 0; + }; + Hk = function (a) { + a = void 0 === a ? _.r : a; + var b = Math.min(Zu('domLoading', a) || Infinity, Zu('domInteractive', a) || Infinity); + return Infinity == b ? Math.max(Zu('responseEnd', a), Zu('navigationStart', a)) : b; + }; + var $u = function (a, b, c, d, e) { + this.label = a; + this.type = b; + this.value = c; + this.duration = void 0 === d ? 0 : d; + this.uniqueId = Math.random(); + this.slotId = e; + }; + var sf = _.r.performance, av = !!(sf && sf.mark && sf.measure && sf.clearMarks), tf = tg(function () { + var a; + if (a = av) + a = Yu(), a = !!a.indexOf && 0 <= a.indexOf('1337'); + return a; + }), bv = function (a, b) { + this.events = []; + var c = null; + b && (b.google_js_reporting_queue = b.google_js_reporting_queue || [], this.events = b.google_js_reporting_queue, c = b.google_measure_js_timing); + this.j = tf() || (null != c ? c : Math.random() < a); + }, Qe = function (a, b, c, d, e, f) { + a.j && (b = new $u(b, c, d, void 0 === e ? 0 : e, f), !a.j || 2048 < a.events.length || a.events.push(b)); + }; + bv.prototype.start = function (a, b) { + if (!this.j) + return null; + a = new $u(a, b, _.ll() || _.xc()); + b = 'goog_' + a.label + '_' + a.uniqueId + '_start'; + sf && tf() && sf.mark(b); + return a; + }; + bv.prototype.end = function (a) { + if (this.j && 'number' === typeof a.value) { + a.duration = (_.ll() || _.xc()) - a.value; + var b = 'goog_' + a.label + '_' + a.uniqueId + '_end'; + sf && tf() && sf.mark(b); + !this.j || 2048 < this.events.length || this.events.push(a); + } + }; + var cv = function (a, b, c) { + var d = _.ll(); + d && Qe(a, b, 9, d, 0, c); + }; + var Ze = function (a, b) { + try { + -1 == a.indexOf(b) && (a = b + '\n' + a); + for (var c; a != c;) + c = a, a = a.replace(/((https?:\/..*\/)[^\/:]*:\d+(?:.|\n)*)\2/, '$1'); + return a.replace(/\n */g, '\n'); + } catch (d) { + return b; + } + }; + var vh = function (a) { + a = Error.call(this, a); + this.message = a.message; + 'stack' in a && (this.stack = a.stack); + _.t(Object, 'setPrototypeOf').call(Object, this, vh.prototype); + }; + _.O(vh, Error); + vh.prototype.name = 'PublisherInputError'; + var dv = function (a) { + a = Error.call(this, a); + this.message = a.message; + 'stack' in a && (this.stack = a.stack); + _.t(Object, 'setPrototypeOf').call(Object, this, dv.prototype); + }; + _.O(dv, Error); + dv.prototype.name = 'ServerError'; + var ev = function (a) { + a = Error.call(this, a); + this.message = a.message; + 'stack' in a && (this.stack = a.stack); + _.t(Object, 'setPrototypeOf').call(Object, this, ev.prototype); + }; + _.O(ev, Error); + ev.prototype.name = 'NetworkError'; + var fv = function () { + _.gu.apply(this, arguments); + this.j = []; + this.A = []; + this.D = []; + }; + _.O(fv, _.gu); + var gv = function (a, b, c) { + a.A.push({ + Dc: void 0 === c ? !1 : c, + Gc: b + }); + }; + fv.prototype.F = function () { + this.j.length = 0; + this.D.length = 0; + this.A.length = 0; + _.gu.prototype.F.call(this); + }; + var Gd = function () { + var a = this; + this.promise = new v.Promise(function (b, c) { + a.resolve = b; + a.reject = c; + }); + }; + var hv = function (a) { + a = Error.call(this, a); + this.message = a.message; + 'stack' in a && (this.stack = a.stack); + _.t(Object, 'setPrototypeOf').call(Object, this, hv.prototype); + this.name = 'InputError'; + }; + _.O(hv, Error); + var iv = function () { + var a = this; + this.M = this.F = null; + this.D = -1; + this.A = new Gd(); + this.m = !1; + this.A.promise.then(function () { + -1 !== a.D && (a.M = _.xc() - a.D); + }, function () { + }); + }, vj = function () { + iv.apply(this, arguments); + }; + _.O(vj, iv); + vj.prototype.j = function (a) { + this.m || (this.m = !0, this.F = a, this.A.resolve(a)); + }; + vj.prototype.fa = function (a) { + null == a ? jv(this) : this.j(a); + }; + var jv = function (a) { + a.m || (a.m = !0, a.F = null, a.A.resolve(null)); + }, kv = function (a, b) { + a.m || (a.m = !0, a.F = null, a.B = b, a.A.reject(b)); + }; + vm.Object.defineProperties(vj.prototype, { + promise: { + configurable: !0, + enumerable: !0, + get: function () { + return this.A.promise; + } + }, + l: { + configurable: !0, + enumerable: !0, + get: function () { + return this.m; + } + }, + o: { + configurable: !0, + enumerable: !0, + get: function () { + return this.M; + } + } + }); + var lv = function (a) { + iv.call(this); + this.j = a; + }; + _.O(lv, iv); + var mv = function (a) { + return null !== a.j.F; + }; + vm.Object.defineProperties(lv.prototype, { + error: { + configurable: !0, + enumerable: !0, + get: function () { + return this.j.B; + } + } + }); + var nv = function (a) { + lv.call(this, a); + this.j = a; + }; + _.O(nv, lv); + vm.Object.defineProperties(nv.prototype, { + value: { + configurable: !0, + enumerable: !0, + get: function () { + return this.j.F; + } + } + }); + var ov = function () { + lv.apply(this, arguments); + }; + _.O(ov, lv); + vm.Object.defineProperties(ov.prototype, { + value: { + configurable: !0, + enumerable: !0, + get: function () { + return this.j.F; + } + } + }); + var wj = function () { + vj.apply(this, arguments); + }; + _.O(wj, vj); + wj.prototype.notify = function () { + jv(this); + }; + var pv = function (a, b) { + b = void 0 === b ? 0 : b; + _.gu.call(this); + this.id = a; + this.ga = b; + this.D = new fv(); + this.aa = !1; + this.T = -1; + _.hu(this, this.D); + }; + _.O(pv, _.gu); + pv.prototype.start = function () { + var a = this, b, c, d, e, f; + return ib(function (g) { + switch (g.j) { + case 1: + if (a.aa) + return g.return(); + a.aa = !0; + g.F = 2; + b = a; + return jb(g, yc(a.D.A, a.ga), 4); + case 4: + b.T = g.m; + if (a.m) { + g.j = 5; + break; + } + for (var h = 0, k = _.y(a.D.D), l = k.next(); !l.done; l = k.next()) { + if (!mv(l.value)) + throw Error('missing input: ' + a.id + '/' + h); + ++h; + } + c = _.y(a.D.j); + for (d = c.next(); !d.done; d = c.next()) + e = d.value, e.D = _.xc(); + return jb(g, a.j(), 5); + case 5: + lb(g, 0); + break; + case 2: + f = mb(g); + if (a.m) + return g.return(); + f instanceof hv ? a.M(f) : f instanceof Error && (a.R(f), a.A(f)); + Lm(g); + } + }); + }; + var U = function (a) { + var b = new vj(); + a.D.j.push(b); + return b; + }, qv = function (a) { + var b = new wj(); + a.D.j.push(b); + return b; + }, V = function (a, b) { + gv(a.D, b); + b = new ov(b); + a.D.D.push(b); + return b; + }, W = function (a, b) { + gv(a.D, b); + return new nv(b); + }, rv = function (a, b) { + gv(a.D, b, !0); + return new nv(b); + }, sv = function (a, b) { + gv(a.D, b); + }; + pv.prototype.M = function () { + }; + pv.prototype.A = function (a) { + if (this.D.j.length) { + a = new hv(a.message); + for (var b = _.y(this.D.j), c = b.next(); !c.done; c = b.next()) + if (c = c.value, !c.l) { + var d = a; + c.m = !0; + c.B = d; + c.A.reject(d); + } + } + }; + var tv = function (a, b) { + pv.call(this, a); + this.id = a; + this.J = b; + }; + _.O(tv, pv); + tv.prototype.R = function (a) { + this.J(this.id, a); + }; + var uv = function () { + this.errorMessage = this.info = this.error = this.Ub = null; + }, vv = function (a, b) { + a.Ub = b; + return a; + }; + uv.prototype.getError = function () { + return this.error; + }; + var wv = function (a, b) { + a.errorMessage = b; + return a; + }, xv = function () { + this.cache = {}; + }, $c = function () { + yv || (zv = _.zc(Mt), Av = _.zc(Lt), yv = new xv()); + return yv; + }, ad = function (a) { + var b = G(a, 3); + if (!b) + return 3; + if (void 0 === G(a, 2)) + return 4; + a = Date.now(); + return a > b + 3600000 * Av ? 2 : a > b + 3600000 * zv ? 1 : 0; + }; + xv.prototype.get = function (a, b) { + var c = new uv(); + if (this.cache[a]) + return vv(c, this.cache[a]); + var d = ''; + try { + d = b.getItem('_GESPSK-' + a); + } catch (e) { + return c.error = 6, wv(c, e.message); + } + if (!d) + return new uv(); + b = null; + try { + b = Sl(Sp, d); + } catch (e) { + return a = new uv(), a.error = 5, wv(a, e.message); + } + b && (this.cache[a] = b); + return vv(new uv(), b); + }; + xv.prototype.set = function (a, b) { + var c = (0, F.H)(G(a, 1)), d = '_GESPSK-' + c, e = vv(new uv(), a); + try { + b.setItem(d, a.X()); + } catch (f) { + e.info = 7, wv(e, f.message); + } + this.cache[c] = a; + return e; + }; + var yv = null, zv = 24, Av = 72; + var Bv; + Bv = { + cf: 0, + fd: 3, + hd: 4, + qf: 5 + }; + var Cv = Bv.fd, Dv = Bv.hd; + var Ev = ir(); + var Fv = function (a) { + this.methodName = a; + }, Gv = new Fv(1), Hv = new Fv(15), Iv = new Fv(2), Jv = new Fv(3), Kv = new Fv(5), Lv = new Fv(6), Mv = new Fv(7), Nv = new Fv(8), Ov = new Fv(14), Pv = function (a, b, c) { + return b[a.methodName] || c || function () { + }; + }; + var Qv = function () { + this.F = function () { + }; + this.j = function () { + return []; + }; + this.m = function () { + return []; + }; + }, Rv = function (a, b, c) { + a.F = Pv(Gv, b, function () { + }); + a.j = function (d) { + return Pv(Iv, b, function () { + return []; + })(d, c); + }; + a.m = function () { + return Pv(Jv, b, function () { + return []; + })(c); + }; + }, Dc = function () { + return _.Hg(Qv); + }; + var Nc = function (a, b, c, d) { + tv.call(this, 655, d); + this.Ga = a; + this.collectorFunction = b; + this.storage = c; + this.o = U(this); + this.B = U(this); + this.l = _.zc(Fc); + }; + _.O(Nc, tv); + Nc.prototype.j = function () { + var a, b = $c().get(this.Ga, this.storage); + if (b.getError()) + Ec(b.getError(), this.Ga, b.errorMessage), jv(this.o), jv(this.B); + else { + var c = Date.now(); + if (b = b.Ub) + if (this.l && (Yf(b, 8) || (Ec(33, this.Ga), Gc(b, this.l)), Yf(b, 7) || (Ec(34, this.Ga), w(b, 7, Math.round(Date.now() / 1000 / 60)))), Yf(b, 3) || Ec(35, this.Ga), this.l) { + var d = (0, F.H)(Hc(b, 8)), e = null !== (a = G(b, 7)) && void 0 !== a ? a : c; + d < this.l && Gc(b, Math.min(d + Number((this.l * (c / 1000 / 60 - e) / 60).toFixed(3)), this.l)); + 1 > (0, F.H)(Hc(b, 8)) ? (c = {}, Ec(22, this.Ga, null, (c.t = String(e), c.cr = String(d), c.cs = String(ad(b)), c)), jv(this.o), jv(this.B)) : (this.o.j(this.collectorFunction), this.B.j(b)); + } else + this.o.j(this.collectorFunction), this.B.j(b); + else + this.o.j(this.collectorFunction), b = this.B, d = b.j, e = new Sp(), e = w(e, 1, this.Ga), e = Gc(e, this.l), c = w(e, 3, c), d.call(b, c); + } + }; + var Ic = function (a, b, c, d) { + 'string' !== typeof c ? Ec(21, a) : c || Ec(20, a); + w(b, 2, c); + b = $c().set(b, d); + b.errorMessage ? Ec((0, F.H)(b.info), a, b.errorMessage) : Ec(27, a); + }, Jc = function (a) { + return 'string' === typeof a ? a : a instanceof Error ? a.message : null; + }; + var Oc = function (a, b, c, d) { + tv.call(this, 658, d); + this.storage = c; + this.l = U(this); + this.o = U(this); + this.B = U(this); + this.G = W(this, a); + this.N = W(this, b); + }; + _.O(Oc, tv); + Oc.prototype.j = function () { + var a = this; + if (this.G.value) { + var b = function (g) { + a.l.j({ + id: (0, F.H)(G(g, 1)), + collectorGeneratedData: G(g, 2) + }); + }, c = this.G.value, d = (0, F.H)(this.N.value), e = (0, F.H)(G(d, 1)), f = ad(d); + switch (f) { + case 0: + Ec(24, e); + break; + case 1: + Ec(25, e); + break; + case 2: + Ec(26, e); + break; + case 3: + Ec(9, e); + break; + case 4: + Ec(23, e); + } + switch (f) { + case 0: + b(d); + Sv(this); + break; + case 1: + b(d); + this.o.j(c); + this.B.j(d); + break; + case 3: + case 2: + case 4: + w(d, 2, null), Kc(e, d, c, this.storage).then(b), Sv(this); + } + } else + jv(this.l), Sv(this); + }; + var Sv = function (a) { + jv(a.o); + jv(a.B); + }; + var Pc = function (a, b, c, d) { + tv.call(this, 662, d); + this.storage = c; + this.l = W(this, a); + this.o = W(this, b); + }; + _.O(Pc, tv); + Pc.prototype.j = function () { + var a = this; + this.o.value && this.l.value && Mc().then(function () { + var b = (0, F.H)(a.o.value), c = (0, F.H)(G(b, 1)); + Kc(c, b, (0, F.H)(a.l.value), a.storage); + }); + }; + var Qc = function () { + _.gu.apply(this, arguments); + this.j = []; + }; + _.O(Qc, _.gu); + var Rc = function (a, b) { + b = _.y(b); + for (var c = b.next(); !c.done; c = b.next()) + c = c.value, _.hu(a, c), a.j.push(c); + }, N = function (a, b) { + Rc(a, [b]); + }, Sc = function (a) { + if (a.j.length) { + a = _.y(a.j); + for (var b = a.next(); !b.done; b = a.next()) + b.value.start(); + } + }; + Qc.prototype.F = function () { + _.gu.prototype.F.call(this); + this.j.length = 0; + }; + var Yc = function (a, b) { + this.storage = b; + this.F = []; + this.m = []; + this.j = []; + a = _.y(a); + for (b = a.next(); !b.done; b = a.next()) + this.push(b.value); + }; + Yc.prototype.push = function (a) { + var b = a.id; + a = a.collectorFunction; + if ('string' !== typeof b) + Ec(37, 'invalid-id'); + else if ('function' !== typeof a) + Ec(14, b); + else { + var c = {}; + Ec(17, b, null, (c.api = '1', c)); + b = Tc(b, a, this.storage, this.A); + this.F.push(b); + a = _.y(this.m); + for (c = a.next(); !c.done; c = a.next()) + b.then(c.value); + } + }; + Yc.prototype.addOnSignalResolveCallback = function (a) { + this.m.push(a); + for (var b = _.y(this.F), c = b.next(); !c.done; c = b.next()) + c.value.then(a); + }; + Yc.prototype.addErrorHandler = function (a) { + this.j.push(a); + }; + Yc.prototype.A = function (a, b) { + for (var c = _.y(this.j), d = c.next(); !d.done; d = c.next()) + d = d.value, d(a, b); + }; + var Xc = function (a) { + this.push = function (b) { + a.push(b); + }; + this.addOnSignalResolveCallback = function (b) { + a.addOnSignalResolveCallback(b); + }; + this.addErrorHandler = function (b) { + a.addErrorHandler(b); + }; + }; + var Tv = 0, Uv = ei(fd(gn('https://pagead2.googlesyndication.com/pagead/expansion_embed.js'))); + var Vv = function () { + this.j = function () { + }; + }, Xv = function () { + var a = _.Hg(Wv).D; + _.Hg(Vv).j(a); + }; + var Zv = function () { + var a = void 0, b = 2; + if (void 0 === a) { + var c = void 0 === c ? _.r : c; + a = c.ggeac || (c.ggeac = {}); + } + b = void 0 === b ? 0 : b; + c = a; + var d = b; + d = void 0 === d ? 0 : d; + Rv(Dc(), c, d); + Yv(a, b); + b = a; + _.Hg(Vv).j = Pv(Ov, b); + _.Hg(yu).j(); + }, Yv = function (a, b) { + var c = _.Hg(yu); + c.m = function (d, e) { + return Pv(Kv, a, function () { + return !1; + })(d, e, b); + }; + c.F = function (d, e) { + return Pv(Lv, a, function () { + return 0; + })(d, e, b); + }; + c.A = function (d, e) { + return Pv(Mv, a, function () { + return ''; + })(d, e, b); + }; + c.D = function (d, e) { + return Pv(Nv, a, function () { + return []; + })(d, e, b); + }; + c.j = function () { + Pv(Hv, a)(b); + }; + }; + var Wf = function (a, b, c) { + a && null !== b && b != b.top && (b = b.top); + try { + return (void 0 === c ? 0 : c) ? new _.Ui(b.innerWidth, b.innerHeight).round() : _.Rq(b || window).round(); + } catch (d) { + return new _.Ui(-12245933, -12245933); + } + }, $v = function (a) { + return 'CSS1Compat' == a.compatMode ? a.documentElement : a.body; + }, aw = function (a, b) { + b = void 0 === b ? _.r : b; + a = a.scrollingElement || $v(a); + return new _.ig(b.pageXOffset || a.scrollLeft, b.pageYOffset || a.scrollTop); + }, wg = function (a) { + try { + return !(!a || !(a.offsetWidth || a.offsetHeight || a.getClientRects().length)); + } catch (b) { + return !1; + } + }; + var bw = function (a) { + Q.call(this, a); + }; + _.O(bw, Q); + var cw = function (a) { + this.j = a; + this.m = 0; + }, ew = function (a, b) { + if (0 === a.m) { + if (dw(a, '__gads', b)) + b = !0; + else { + var c = a.j; + E(b, 5) && uc(c) && new vc(c.document).set('GoogleAdServingTest', 'Good', void 0); + if (c = 'Good' === wc('GoogleAdServingTest', b, a.j)) { + var d = a.j; + E(b, 5) && uc(d) && new vc(d.document).remove('GoogleAdServingTest', void 0, void 0); + } + b = c; + } + a.m = b ? 2 : 1; + } + return 2 === a.m; + }, dw = function (a, b, c) { + return c ? wc(b, c, a.j) : null; + }, fw = function (a, b, c, d) { + if (d) { + var e = { + qc: G(c, 2) - Date.now() / 1000, + path: G(c, 3), + domain: G(c, 4), + oe: !1 + }; + a = a.j; + E(d, 5) && uc(a) && new vc(a.document).set(b, G(c, 1), e); + } + }, gw = function (a, b, c) { + if (c && wc(b, c, a.j)) { + var d = a.j.location.hostname; + if ('localhost' === d) + d = ['localhost']; + else if (d = d.split('.'), 2 > d.length) + d = []; + else { + for (var e = [], f = 0; f < d.length - 1; ++f) + e.push(d.slice(f).join('.')); + d = e; + } + d = _.y(d); + for (e = d.next(); !e.done; e = d.next()) + f = a.j, E(c, 5) && uc(f) && new vc(f.document).remove(b, '/', e.value); + } + }; + var hw = {}, iw = (hw[3] = ei(fd(gn('https://s0.2mdn.net/ads/richmedia/studio/mu/templates/hifi/hifi.js'))), hw), jw = {}, kw = (jw[3] = ei(fd(gn('https://s0.2mdn.net/ads/richmedia/studio_canary/mu/templates/hifi/hifi_canary.js'))), jw); + var lw = function (a) { + this.j = a; + this.m = Hq(); + }, mw = function (a) { + var b = {}; + _.hn(a, function (c) { + b[c.j] = c.m; + }); + return b; + }; + var nw = P([ + 'https://adservice.google.com/adsid/integrator.', + '' + ]), ow = P([ + 'https://adservice.google.ad/adsid/integrator.', + '' + ]), pw = P([ + 'https://adservice.google.ae/adsid/integrator.', + '' + ]), qw = P([ + 'https://adservice.google.com.af/adsid/integrator.', + '' + ]), rw = P([ + 'https://adservice.google.com.ag/adsid/integrator.', + '' + ]), sw = P([ + 'https://adservice.google.com.ai/adsid/integrator.', + '' + ]), tw = P([ + 'https://adservice.google.al/adsid/integrator.', + '' + ]), uw = P([ + 'https://adservice.google.co.ao/adsid/integrator.', + '' + ]), vw = P([ + 'https://adservice.google.com.ar/adsid/integrator.', + '' + ]), ww = P([ + 'https://adservice.google.as/adsid/integrator.', + '' + ]), xw = P([ + 'https://adservice.google.at/adsid/integrator.', + '' + ]), yw = P([ + 'https://adservice.google.com.au/adsid/integrator.', + '' + ]), zw = P([ + 'https://adservice.google.az/adsid/integrator.', + '' + ]), Aw = P([ + 'https://adservice.google.com.bd/adsid/integrator.', + '' + ]), Bw = P([ + 'https://adservice.google.be/adsid/integrator.', + '' + ]), Cw = P([ + 'https://adservice.google.bf/adsid/integrator.', + '' + ]), Dw = P([ + 'https://adservice.google.bg/adsid/integrator.', + '' + ]), Ew = P([ + 'https://adservice.google.com.bh/adsid/integrator.', + '' + ]), Fw = P([ + 'https://adservice.google.bi/adsid/integrator.', + '' + ]), Gw = P([ + 'https://adservice.google.bj/adsid/integrator.', + '' + ]), Hw = P([ + 'https://adservice.google.com.bn/adsid/integrator.', + '' + ]), Iw = P([ + 'https://adservice.google.com.bo/adsid/integrator.', + '' + ]), Jw = P([ + 'https://adservice.google.com.br/adsid/integrator.', + '' + ]), Kw = P([ + 'https://adservice.google.bs/adsid/integrator.', + '' + ]), Lw = P([ + 'https://adservice.google.bt/adsid/integrator.', + '' + ]), Mw = P([ + 'https://adservice.google.co.bw/adsid/integrator.', + '' + ]), Nw = P([ + 'https://adservice.google.com.bz/adsid/integrator.', + '' + ]), Ow = P([ + 'https://adservice.google.ca/adsid/integrator.', + '' + ]), Pw = P([ + 'https://adservice.google.cd/adsid/integrator.', + '' + ]), Qw = P([ + 'https://adservice.google.cf/adsid/integrator.', + '' + ]), Rw = P([ + 'https://adservice.google.cg/adsid/integrator.', + '' + ]), Sw = P([ + 'https://adservice.google.ch/adsid/integrator.', + '' + ]), Tw = P([ + 'https://adservice.google.ci/adsid/integrator.', + '' + ]), Uw = P([ + 'https://adservice.google.co.ck/adsid/integrator.', + '' + ]), Vw = P([ + 'https://adservice.google.cl/adsid/integrator.', + '' + ]), Ww = P([ + 'https://adservice.google.cm/adsid/integrator.', + '' + ]), Xw = P([ + 'https://adservice.google.com.co/adsid/integrator.', + '' + ]), Yw = P([ + 'https://adservice.google.co.cr/adsid/integrator.', + '' + ]), Zw = P([ + 'https://adservice.google.com.cu/adsid/integrator.', + '' + ]), $w = P([ + 'https://adservice.google.cv/adsid/integrator.', + '' + ]), ax = P([ + 'https://adservice.google.com.cy/adsid/integrator.', + '' + ]), bx = P([ + 'https://adservice.google.cz/adsid/integrator.', + '' + ]), cx = P([ + 'https://adservice.google.de/adsid/integrator.', + '' + ]), dx = P([ + 'https://adservice.google.dj/adsid/integrator.', + '' + ]), ex = P([ + 'https://adservice.google.dk/adsid/integrator.', + '' + ]), fx = P([ + 'https://adservice.google.dm/adsid/integrator.', + '' + ]), gx = P([ + 'https://adservice.google.dz/adsid/integrator.', + '' + ]), hx = P([ + 'https://adservice.google.com.ec/adsid/integrator.', + '' + ]), ix = P([ + 'https://adservice.google.ee/adsid/integrator.', + '' + ]), jx = P([ + 'https://adservice.google.com.eg/adsid/integrator.', + '' + ]), kx = P([ + 'https://adservice.google.es/adsid/integrator.', + '' + ]), lx = P([ + 'https://adservice.google.com.et/adsid/integrator.', + '' + ]), mx = P([ + 'https://adservice.google.fi/adsid/integrator.', + '' + ]), nx = P([ + 'https://adservice.google.com.fj/adsid/integrator.', + '' + ]), ox = P([ + 'https://adservice.google.fm/adsid/integrator.', + '' + ]), px = P([ + 'https://adservice.google.fr/adsid/integrator.', + '' + ]), qx = P([ + 'https://adservice.google.ga/adsid/integrator.', + '' + ]), rx = P([ + 'https://adservice.google.ge/adsid/integrator.', + '' + ]), sx = P([ + 'https://adservice.google.gg/adsid/integrator.', + '' + ]), tx = P([ + 'https://adservice.google.com.gh/adsid/integrator.', + '' + ]), ux = P([ + 'https://adservice.google.com.gi/adsid/integrator.', + '' + ]), vx = P([ + 'https://adservice.google.gl/adsid/integrator.', + '' + ]), wx = P([ + 'https://adservice.google.gm/adsid/integrator.', + '' + ]), xx = P([ + 'https://adservice.google.gr/adsid/integrator.', + '' + ]), yx = P([ + 'https://adservice.google.com.gt/adsid/integrator.', + '' + ]), zx = P([ + 'https://adservice.google.gy/adsid/integrator.', + '' + ]), Ax = P([ + 'https://adservice.google.com.hk/adsid/integrator.', + '' + ]), Bx = P([ + 'https://adservice.google.hn/adsid/integrator.', + '' + ]), Cx = P([ + 'https://adservice.google.hr/adsid/integrator.', + '' + ]), Dx = P([ + 'https://adservice.google.ht/adsid/integrator.', + '' + ]), Ex = P([ + 'https://adservice.google.hu/adsid/integrator.', + '' + ]), Fx = P([ + 'https://adservice.google.co.id/adsid/integrator.', + '' + ]), Gx = P([ + 'https://adservice.google.ie/adsid/integrator.', + '' + ]), Hx = P([ + 'https://adservice.google.co.il/adsid/integrator.', + '' + ]), Ix = P([ + 'https://adservice.google.im/adsid/integrator.', + '' + ]), Jx = P([ + 'https://adservice.google.co.in/adsid/integrator.', + '' + ]), Kx = P([ + 'https://adservice.google.iq/adsid/integrator.', + '' + ]), Lx = P([ + 'https://adservice.google.is/adsid/integrator.', + '' + ]), Mx = P([ + 'https://adservice.google.it/adsid/integrator.', + '' + ]), Nx = P([ + 'https://adservice.google.je/adsid/integrator.', + '' + ]), Ox = P([ + 'https://adservice.google.com.jm/adsid/integrator.', + '' + ]), Px = P([ + 'https://adservice.google.jo/adsid/integrator.', + '' + ]), Qx = P([ + 'https://adservice.google.co.jp/adsid/integrator.', + '' + ]), Rx = P([ + 'https://adservice.google.co.ke/adsid/integrator.', + '' + ]), Sx = P([ + 'https://adservice.google.com.kh/adsid/integrator.', + '' + ]), Tx = P([ + 'https://adservice.google.ki/adsid/integrator.', + '' + ]), Ux = P([ + 'https://adservice.google.kg/adsid/integrator.', + '' + ]), Vx = P([ + 'https://adservice.google.co.kr/adsid/integrator.', + '' + ]), Wx = P([ + 'https://adservice.google.com.kw/adsid/integrator.', + '' + ]), Xx = P([ + 'https://adservice.google.kz/adsid/integrator.', + '' + ]), Yx = P([ + 'https://adservice.google.la/adsid/integrator.', + '' + ]), Zx = P([ + 'https://adservice.google.com.lb/adsid/integrator.', + '' + ]), $x = P([ + 'https://adservice.google.li/adsid/integrator.', + '' + ]), ay = P([ + 'https://adservice.google.lk/adsid/integrator.', + '' + ]), by = P([ + 'https://adservice.google.co.ls/adsid/integrator.', + '' + ]), cy = P([ + 'https://adservice.google.lt/adsid/integrator.', + '' + ]), dy = P([ + 'https://adservice.google.lu/adsid/integrator.', + '' + ]), ey = P([ + 'https://adservice.google.lv/adsid/integrator.', + '' + ]), fy = P([ + 'https://adservice.google.com.ly/adsid/integrator.', + '' + ]), gy = P([ + 'https://adservice.google.md/adsid/integrator.', + '' + ]), hy = P([ + 'https://adservice.google.me/adsid/integrator.', + '' + ]), iy = P([ + 'https://adservice.google.mg/adsid/integrator.', + '' + ]), jy = P([ + 'https://adservice.google.mk/adsid/integrator.', + '' + ]), ky = P([ + 'https://adservice.google.ml/adsid/integrator.', + '' + ]), ly = P([ + 'https://adservice.google.com.mm/adsid/integrator.', + '' + ]), my = P([ + 'https://adservice.google.mn/adsid/integrator.', + '' + ]), ny = P([ + 'https://adservice.google.ms/adsid/integrator.', + '' + ]), oy = P([ + 'https://adservice.google.com.mt/adsid/integrator.', + '' + ]), py = P([ + 'https://adservice.google.mu/adsid/integrator.', + '' + ]), qy = P([ + 'https://adservice.google.mv/adsid/integrator.', + '' + ]), ry = P([ + 'https://adservice.google.mw/adsid/integrator.', + '' + ]), sy = P([ + 'https://adservice.google.com.mx/adsid/integrator.', + '' + ]), ty = P([ + 'https://adservice.google.com.my/adsid/integrator.', + '' + ]), uy = P([ + 'https://adservice.google.co.mz/adsid/integrator.', + '' + ]), vy = P([ + 'https://adservice.google.com.na/adsid/integrator.', + '' + ]), wy = P([ + 'https://adservice.google.com.ng/adsid/integrator.', + '' + ]), xy = P([ + 'https://adservice.google.com.ni/adsid/integrator.', + '' + ]), yy = P([ + 'https://adservice.google.ne/adsid/integrator.', + '' + ]), zy = P([ + 'https://adservice.google.nl/adsid/integrator.', + '' + ]), Ay = P([ + 'https://adservice.google.no/adsid/integrator.', + '' + ]), By = P([ + 'https://adservice.google.com.np/adsid/integrator.', + '' + ]), Cy = P([ + 'https://adservice.google.nr/adsid/integrator.', + '' + ]), Dy = P([ + 'https://adservice.google.nu/adsid/integrator.', + '' + ]), Ey = P([ + 'https://adservice.google.co.nz/adsid/integrator.', + '' + ]), Fy = P([ + 'https://adservice.google.com.om/adsid/integrator.', + '' + ]), Gy = P([ + 'https://adservice.google.com.pa/adsid/integrator.', + '' + ]), Hy = P([ + 'https://adservice.google.com.pe/adsid/integrator.', + '' + ]), Iy = P([ + 'https://adservice.google.com.pg/adsid/integrator.', + '' + ]), Jy = P([ + 'https://adservice.google.com.ph/adsid/integrator.', + '' + ]), Ky = P([ + 'https://adservice.google.com.pk/adsid/integrator.', + '' + ]), Ly = P([ + 'https://adservice.google.pl/adsid/integrator.', + '' + ]), My = P([ + 'https://adservice.google.pn/adsid/integrator.', + '' + ]), Ny = P([ + 'https://adservice.google.com.pr/adsid/integrator.', + '' + ]), Oy = P([ + 'https://adservice.google.ps/adsid/integrator.', + '' + ]), Py = P([ + 'https://adservice.google.pt/adsid/integrator.', + '' + ]), Qy = P([ + 'https://adservice.google.com.py/adsid/integrator.', + '' + ]), Ry = P([ + 'https://adservice.google.com.qa/adsid/integrator.', + '' + ]), Sy = P([ + 'https://adservice.google.ro/adsid/integrator.', + '' + ]), Ty = P([ + 'https://adservice.google.ru/adsid/integrator.', + '' + ]), Uy = P([ + 'https://adservice.google.rw/adsid/integrator.', + '' + ]), Vy = P([ + 'https://adservice.google.com.sa/adsid/integrator.', + '' + ]), Wy = P([ + 'https://adservice.google.com.sb/adsid/integrator.', + '' + ]), Xy = P([ + 'https://adservice.google.sc/adsid/integrator.', + '' + ]), Yy = P([ + 'https://adservice.google.se/adsid/integrator.', + '' + ]), Zy = P([ + 'https://adservice.google.com.sg/adsid/integrator.', + '' + ]), $y = P([ + 'https://adservice.google.sh/adsid/integrator.', + '' + ]), az = P([ + 'https://adservice.google.si/adsid/integrator.', + '' + ]), bz = P([ + 'https://adservice.google.sk/adsid/integrator.', + '' + ]), cz = P([ + 'https://adservice.google.sn/adsid/integrator.', + '' + ]), dz = P([ + 'https://adservice.google.so/adsid/integrator.', + '' + ]), ez = P([ + 'https://adservice.google.sm/adsid/integrator.', + '' + ]), fz = P([ + 'https://adservice.google.sr/adsid/integrator.', + '' + ]), gz = P([ + 'https://adservice.google.st/adsid/integrator.', + '' + ]), hz = P([ + 'https://adservice.google.com.sv/adsid/integrator.', + '' + ]), iz = P([ + 'https://adservice.google.td/adsid/integrator.', + '' + ]), jz = P([ + 'https://adservice.google.tg/adsid/integrator.', + '' + ]), kz = P([ + 'https://adservice.google.co.th/adsid/integrator.', + '' + ]), lz = P([ + 'https://adservice.google.com.tj/adsid/integrator.', + '' + ]), mz = P([ + 'https://adservice.google.tl/adsid/integrator.', + '' + ]), nz = P([ + 'https://adservice.google.tm/adsid/integrator.', + '' + ]), oz = P([ + 'https://adservice.google.tn/adsid/integrator.', + '' + ]), pz = P([ + 'https://adservice.google.to/adsid/integrator.', + '' + ]), qz = P([ + 'https://adservice.google.com.tr/adsid/integrator.', + '' + ]), rz = P([ + 'https://adservice.google.tt/adsid/integrator.', + '' + ]), sz = P([ + 'https://adservice.google.com.tw/adsid/integrator.', + '' + ]), tz = P([ + 'https://adservice.google.co.tz/adsid/integrator.', + '' + ]), uz = P([ + 'https://adservice.google.com.ua/adsid/integrator.', + '' + ]), vz = P([ + 'https://adservice.google.co.ug/adsid/integrator.', + '' + ]), wz = P([ + 'https://adservice.google.co.uk/adsid/integrator.', + '' + ]), xz = P([ + 'https://adservice.google.com.uy/adsid/integrator.', + '' + ]), yz = P([ + 'https://adservice.google.co.uz/adsid/integrator.', + '' + ]), zz = P([ + 'https://adservice.google.com.vc/adsid/integrator.', + '' + ]), Az = P([ + 'https://adservice.google.co.ve/adsid/integrator.', + '' + ]), Bz = P([ + 'https://adservice.google.vg/adsid/integrator.', + '' + ]), Cz = P([ + 'https://adservice.google.co.vi/adsid/integrator.', + '' + ]), Dz = P([ + 'https://adservice.google.com.vn/adsid/integrator.', + '' + ]), Ez = P([ + 'https://adservice.google.vu/adsid/integrator.', + '' + ]), Fz = P([ + 'https://adservice.google.ws/adsid/integrator.', + '' + ]), Gz = P([ + 'https://adservice.google.rs/adsid/integrator.', + '' + ]), Hz = P([ + 'https://adservice.google.co.za/adsid/integrator.', + '' + ]), Iz = P([ + 'https://adservice.google.co.zm/adsid/integrator.', + '' + ]), Jz = P([ + 'https://adservice.google.co.zw/adsid/integrator.', + '' + ]), Kz = P([ + 'https://adservice.google.cat/adsid/integrator.', + '' + ]), Lz = new v.Map([ + [ + '.google.com', + function (a) { + return A(nw, a); + } + ], + [ + '.google.ad', + function (a) { + return A(ow, a); + } + ], + [ + '.google.ae', + function (a) { + return A(pw, a); + } + ], + [ + '.google.com.af', + function (a) { + return A(qw, a); + } + ], + [ + '.google.com.ag', + function (a) { + return A(rw, a); + } + ], + [ + '.google.com.ai', + function (a) { + return A(sw, a); + } + ], + [ + '.google.al', + function (a) { + return A(tw, a); + } + ], + [ + '.google.co.ao', + function (a) { + return A(uw, a); + } + ], + [ + '.google.com.ar', + function (a) { + return A(vw, a); + } + ], + [ + '.google.as', + function (a) { + return A(ww, a); + } + ], + [ + '.google.at', + function (a) { + return A(xw, a); + } + ], + [ + '.google.com.au', + function (a) { + return A(yw, a); + } + ], + [ + '.google.az', + function (a) { + return A(zw, a); + } + ], + [ + '.google.com.bd', + function (a) { + return A(Aw, a); + } + ], + [ + '.google.be', + function (a) { + return A(Bw, a); + } + ], + [ + '.google.bf', + function (a) { + return A(Cw, a); + } + ], + [ + '.google.bg', + function (a) { + return A(Dw, a); + } + ], + [ + '.google.com.bh', + function (a) { + return A(Ew, a); + } + ], + [ + '.google.bi', + function (a) { + return A(Fw, a); + } + ], + [ + '.google.bj', + function (a) { + return A(Gw, a); + } + ], + [ + '.google.com.bn', + function (a) { + return A(Hw, a); + } + ], + [ + '.google.com.bo', + function (a) { + return A(Iw, a); + } + ], + [ + '.google.com.br', + function (a) { + return A(Jw, a); + } + ], + [ + '.google.bs', + function (a) { + return A(Kw, a); + } + ], + [ + '.google.bt', + function (a) { + return A(Lw, a); + } + ], + [ + '.google.co.bw', + function (a) { + return A(Mw, a); + } + ], + [ + '.google.com.bz', + function (a) { + return A(Nw, a); + } + ], + [ + '.google.ca', + function (a) { + return A(Ow, a); + } + ], + [ + '.google.cd', + function (a) { + return A(Pw, a); + } + ], + [ + '.google.cf', + function (a) { + return A(Qw, a); + } + ], + [ + '.google.cg', + function (a) { + return A(Rw, a); + } + ], + [ + '.google.ch', + function (a) { + return A(Sw, a); + } + ], + [ + '.google.ci', + function (a) { + return A(Tw, a); + } + ], + [ + '.google.co.ck', + function (a) { + return A(Uw, a); + } + ], + [ + '.google.cl', + function (a) { + return A(Vw, a); + } + ], + [ + '.google.cm', + function (a) { + return A(Ww, a); + } + ], + [ + '.google.com.co', + function (a) { + return A(Xw, a); + } + ], + [ + '.google.co.cr', + function (a) { + return A(Yw, a); + } + ], + [ + '.google.com.cu', + function (a) { + return A(Zw, a); + } + ], + [ + '.google.cv', + function (a) { + return A($w, a); + } + ], + [ + '.google.com.cy', + function (a) { + return A(ax, a); + } + ], + [ + '.google.cz', + function (a) { + return A(bx, a); + } + ], + [ + '.google.de', + function (a) { + return A(cx, a); + } + ], + [ + '.google.dj', + function (a) { + return A(dx, a); + } + ], + [ + '.google.dk', + function (a) { + return A(ex, a); + } + ], + [ + '.google.dm', + function (a) { + return A(fx, a); + } + ], + [ + '.google.dz', + function (a) { + return A(gx, a); + } + ], + [ + '.google.com.ec', + function (a) { + return A(hx, a); + } + ], + [ + '.google.ee', + function (a) { + return A(ix, a); + } + ], + [ + '.google.com.eg', + function (a) { + return A(jx, a); + } + ], + [ + '.google.es', + function (a) { + return A(kx, a); + } + ], + [ + '.google.com.et', + function (a) { + return A(lx, a); + } + ], + [ + '.google.fi', + function (a) { + return A(mx, a); + } + ], + [ + '.google.com.fj', + function (a) { + return A(nx, a); + } + ], + [ + '.google.fm', + function (a) { + return A(ox, a); + } + ], + [ + '.google.fr', + function (a) { + return A(px, a); + } + ], + [ + '.google.ga', + function (a) { + return A(qx, a); + } + ], + [ + '.google.ge', + function (a) { + return A(rx, a); + } + ], + [ + '.google.gg', + function (a) { + return A(sx, a); + } + ], + [ + '.google.com.gh', + function (a) { + return A(tx, a); + } + ], + [ + '.google.com.gi', + function (a) { + return A(ux, a); + } + ], + [ + '.google.gl', + function (a) { + return A(vx, a); + } + ], + [ + '.google.gm', + function (a) { + return A(wx, a); + } + ], + [ + '.google.gr', + function (a) { + return A(xx, a); + } + ], + [ + '.google.com.gt', + function (a) { + return A(yx, a); + } + ], + [ + '.google.gy', + function (a) { + return A(zx, a); + } + ], + [ + '.google.com.hk', + function (a) { + return A(Ax, a); + } + ], + [ + '.google.hn', + function (a) { + return A(Bx, a); + } + ], + [ + '.google.hr', + function (a) { + return A(Cx, a); + } + ], + [ + '.google.ht', + function (a) { + return A(Dx, a); + } + ], + [ + '.google.hu', + function (a) { + return A(Ex, a); + } + ], + [ + '.google.co.id', + function (a) { + return A(Fx, a); + } + ], + [ + '.google.ie', + function (a) { + return A(Gx, a); + } + ], + [ + '.google.co.il', + function (a) { + return A(Hx, a); + } + ], + [ + '.google.im', + function (a) { + return A(Ix, a); + } + ], + [ + '.google.co.in', + function (a) { + return A(Jx, a); + } + ], + [ + '.google.iq', + function (a) { + return A(Kx, a); + } + ], + [ + '.google.is', + function (a) { + return A(Lx, a); + } + ], + [ + '.google.it', + function (a) { + return A(Mx, a); + } + ], + [ + '.google.je', + function (a) { + return A(Nx, a); + } + ], + [ + '.google.com.jm', + function (a) { + return A(Ox, a); + } + ], + [ + '.google.jo', + function (a) { + return A(Px, a); + } + ], + [ + '.google.co.jp', + function (a) { + return A(Qx, a); + } + ], + [ + '.google.co.ke', + function (a) { + return A(Rx, a); + } + ], + [ + '.google.com.kh', + function (a) { + return A(Sx, a); + } + ], + [ + '.google.ki', + function (a) { + return A(Tx, a); + } + ], + [ + '.google.kg', + function (a) { + return A(Ux, a); + } + ], + [ + '.google.co.kr', + function (a) { + return A(Vx, a); + } + ], + [ + '.google.com.kw', + function (a) { + return A(Wx, a); + } + ], + [ + '.google.kz', + function (a) { + return A(Xx, a); + } + ], + [ + '.google.la', + function (a) { + return A(Yx, a); + } + ], + [ + '.google.com.lb', + function (a) { + return A(Zx, a); + } + ], + [ + '.google.li', + function (a) { + return A($x, a); + } + ], + [ + '.google.lk', + function (a) { + return A(ay, a); + } + ], + [ + '.google.co.ls', + function (a) { + return A(by, a); + } + ], + [ + '.google.lt', + function (a) { + return A(cy, a); + } + ], + [ + '.google.lu', + function (a) { + return A(dy, a); + } + ], + [ + '.google.lv', + function (a) { + return A(ey, a); + } + ], + [ + '.google.com.ly', + function (a) { + return A(fy, a); + } + ], + [ + '.google.md', + function (a) { + return A(gy, a); + } + ], + [ + '.google.me', + function (a) { + return A(hy, a); + } + ], + [ + '.google.mg', + function (a) { + return A(iy, a); + } + ], + [ + '.google.mk', + function (a) { + return A(jy, a); + } + ], + [ + '.google.ml', + function (a) { + return A(ky, a); + } + ], + [ + '.google.com.mm', + function (a) { + return A(ly, a); + } + ], + [ + '.google.mn', + function (a) { + return A(my, a); + } + ], + [ + '.google.ms', + function (a) { + return A(ny, a); + } + ], + [ + '.google.com.mt', + function (a) { + return A(oy, a); + } + ], + [ + '.google.mu', + function (a) { + return A(py, a); + } + ], + [ + '.google.mv', + function (a) { + return A(qy, a); + } + ], + [ + '.google.mw', + function (a) { + return A(ry, a); + } + ], + [ + '.google.com.mx', + function (a) { + return A(sy, a); + } + ], + [ + '.google.com.my', + function (a) { + return A(ty, a); + } + ], + [ + '.google.co.mz', + function (a) { + return A(uy, a); + } + ], + [ + '.google.com.na', + function (a) { + return A(vy, a); + } + ], + [ + '.google.com.ng', + function (a) { + return A(wy, a); + } + ], + [ + '.google.com.ni', + function (a) { + return A(xy, a); + } + ], + [ + '.google.ne', + function (a) { + return A(yy, a); + } + ], + [ + '.google.nl', + function (a) { + return A(zy, a); + } + ], + [ + '.google.no', + function (a) { + return A(Ay, a); + } + ], + [ + '.google.com.np', + function (a) { + return A(By, a); + } + ], + [ + '.google.nr', + function (a) { + return A(Cy, a); + } + ], + [ + '.google.nu', + function (a) { + return A(Dy, a); + } + ], + [ + '.google.co.nz', + function (a) { + return A(Ey, a); + } + ], + [ + '.google.com.om', + function (a) { + return A(Fy, a); + } + ], + [ + '.google.com.pa', + function (a) { + return A(Gy, a); + } + ], + [ + '.google.com.pe', + function (a) { + return A(Hy, a); + } + ], + [ + '.google.com.pg', + function (a) { + return A(Iy, a); + } + ], + [ + '.google.com.ph', + function (a) { + return A(Jy, a); + } + ], + [ + '.google.com.pk', + function (a) { + return A(Ky, a); + } + ], + [ + '.google.pl', + function (a) { + return A(Ly, a); + } + ], + [ + '.google.pn', + function (a) { + return A(My, a); + } + ], + [ + '.google.com.pr', + function (a) { + return A(Ny, a); + } + ], + [ + '.google.ps', + function (a) { + return A(Oy, a); + } + ], + [ + '.google.pt', + function (a) { + return A(Py, a); + } + ], + [ + '.google.com.py', + function (a) { + return A(Qy, a); + } + ], + [ + '.google.com.qa', + function (a) { + return A(Ry, a); + } + ], + [ + '.google.ro', + function (a) { + return A(Sy, a); + } + ], + [ + '.google.ru', + function (a) { + return A(Ty, a); + } + ], + [ + '.google.rw', + function (a) { + return A(Uy, a); + } + ], + [ + '.google.com.sa', + function (a) { + return A(Vy, a); + } + ], + [ + '.google.com.sb', + function (a) { + return A(Wy, a); + } + ], + [ + '.google.sc', + function (a) { + return A(Xy, a); + } + ], + [ + '.google.se', + function (a) { + return A(Yy, a); + } + ], + [ + '.google.com.sg', + function (a) { + return A(Zy, a); + } + ], + [ + '.google.sh', + function (a) { + return A($y, a); + } + ], + [ + '.google.si', + function (a) { + return A(az, a); + } + ], + [ + '.google.sk', + function (a) { + return A(bz, a); + } + ], + [ + '.google.sn', + function (a) { + return A(cz, a); + } + ], + [ + '.google.so', + function (a) { + return A(dz, a); + } + ], + [ + '.google.sm', + function (a) { + return A(ez, a); + } + ], + [ + '.google.sr', + function (a) { + return A(fz, a); + } + ], + [ + '.google.st', + function (a) { + return A(gz, a); + } + ], + [ + '.google.com.sv', + function (a) { + return A(hz, a); + } + ], + [ + '.google.td', + function (a) { + return A(iz, a); + } + ], + [ + '.google.tg', + function (a) { + return A(jz, a); + } + ], + [ + '.google.co.th', + function (a) { + return A(kz, a); + } + ], + [ + '.google.com.tj', + function (a) { + return A(lz, a); + } + ], + [ + '.google.tl', + function (a) { + return A(mz, a); + } + ], + [ + '.google.tm', + function (a) { + return A(nz, a); + } + ], + [ + '.google.tn', + function (a) { + return A(oz, a); + } + ], + [ + '.google.to', + function (a) { + return A(pz, a); + } + ], + [ + '.google.com.tr', + function (a) { + return A(qz, a); + } + ], + [ + '.google.tt', + function (a) { + return A(rz, a); + } + ], + [ + '.google.com.tw', + function (a) { + return A(sz, a); + } + ], + [ + '.google.co.tz', + function (a) { + return A(tz, a); + } + ], + [ + '.google.com.ua', + function (a) { + return A(uz, a); + } + ], + [ + '.google.co.ug', + function (a) { + return A(vz, a); + } + ], + [ + '.google.co.uk', + function (a) { + return A(wz, a); + } + ], + [ + '.google.com.uy', + function (a) { + return A(xz, a); + } + ], + [ + '.google.co.uz', + function (a) { + return A(yz, a); + } + ], + [ + '.google.com.vc', + function (a) { + return A(zz, a); + } + ], + [ + '.google.co.ve', + function (a) { + return A(Az, a); + } + ], + [ + '.google.vg', + function (a) { + return A(Bz, a); + } + ], + [ + '.google.co.vi', + function (a) { + return A(Cz, a); + } + ], + [ + '.google.com.vn', + function (a) { + return A(Dz, a); + } + ], + [ + '.google.vu', + function (a) { + return A(Ez, a); + } + ], + [ + '.google.ws', + function (a) { + return A(Fz, a); + } + ], + [ + '.google.rs', + function (a) { + return A(Gz, a); + } + ], + [ + '.google.co.za', + function (a) { + return A(Hz, a); + } + ], + [ + '.google.co.zm', + function (a) { + return A(Iz, a); + } + ], + [ + '.google.co.zw', + function (a) { + return A(Jz, a); + } + ], + [ + '.google.cat', + function (a) { + return A(Kz, a); + } + ] + ].map(function (a) { + var b = _.y(a); + a = b.next().value; + b = b.next().value; + var c = {}; + return [ + a, + (c.json = b('json'), c.js = b('js'), c['sync.js'] = b('sync.js'), c) + ]; + })); + var Mz = function (a, b, c) { + var d = 'script'; + d = void 0 === d ? '' : d; + var e = _.Oi('LINK', a); + try { + Dq(e, b, 'preload'); + } catch (f) { + return; + } + d && (e.as = d); + c && e.setAttribute('nonce', c); + if (a = a.getElementsByTagName('head')[0]) + try { + a.appendChild(e); + } catch (f) { + } + }; + var vd = _.r, Nz = function (a) { + var b = new v.Map([[ + 'domain', + _.r.location.hostname + ]]); + wd[3] >= xd() && b.set('adsid', wd[1]); + return hc(Lz.get(a).js, b); + }, wd, Oz, ud = function () { + vd = _.r; + wd = vd.googleToken = vd.googleToken || {}; + var a = xd(); + wd[1] && wd[3] > a && 0 < wd[2] || (wd[1] = '', wd[2] = -1, wd[3] = -1, wd[4] = '', wd[6] = ''); + Oz = vd.googleIMState = vd.googleIMState || {}; + Lz.has(Oz[1]) || (Oz[1] = '.google.com'); + Array.isArray(Oz[5]) || (Oz[5] = []); + 'boolean' !== typeof Oz[6] && (Oz[6] = !1); + Array.isArray(Oz[7]) || (Oz[7] = []); + 'number' !== typeof Oz[8] && (Oz[8] = 0); + }, Pz = function (a) { + ud(); + Lz.has(a) && (Oz[1] = a); + }, yd = { + hc: function () { + return 0 < Oz[8]; + }, + fe: function () { + Oz[8]++; + }, + ge: function () { + 0 < Oz[8] && Oz[8]--; + }, + he: function () { + Oz[8] = 0; + }, + Uf: function () { + return !1; + }, + Jc: function () { + return Oz[5]; + }, + Fc: function (a) { + try { + a(); + } catch (b) { + _.r.setTimeout(function () { + throw b; + }, 0); + } + }, + Uc: function () { + if (!yd.hc()) { + var a = _.r.document, b = function (e) { + e = Nz(e); + a: { + try { + var f = Cq('script[nonce]', void 0); + break a; + } catch (g) { + } + f = void 0; + } + Mz(a, e.toString(), f); + f = _.Oi('SCRIPT', a); + f.type = 'text/javascript'; + f.onerror = function () { + return _.r.processGoogleToken({}, 2); + }; + bb(f, e); + try { + (a.head || a.body || a.documentElement).appendChild(f), yd.fe(); + } catch (g) { + } + }, c = Oz[1]; + b(c); + '.google.com' != c && b('.google.com'); + b = {}; + var d = (b.newToken = 'FBT', b); + _.r.setTimeout(function () { + return _.r.processGoogleToken(d, 1); + }, 1000); + } + } + }, Qz = function (a) { + _.r.processGoogleToken = _.r.processGoogleToken || function (b, c) { + var d = b; + d = void 0 === d ? {} : d; + c = void 0 === c ? 0 : c; + b = d.newToken || ''; + var e = 'NT' == b, f = parseInt(d.freshLifetimeSecs || '', 10), g = parseInt(d.validLifetimeSecs || '', 10), h = d['1p_jar'] || ''; + d = d.pucrd || ''; + ud(); + 1 == c ? yd.he() : yd.ge(); + var k = vd.googleToken = vd.googleToken || {}, l = 0 == c && b && 'string' === typeof b && !e && 'number' === typeof f && 0 < f && 'number' === typeof g && 0 < g && 'string' === typeof h; + e = e && !yd.hc() && (!(wd[3] >= xd()) || 'NT' == wd[1]); + var m = !(wd[3] >= xd()) && 0 != c; + if (l || e || m) + e = xd(), f = e + 1000 * f, g = e + 1000 * g, 0.00001 > Math.random() && _.Qr(_.r, 'https://pagead2.googlesyndication.com/pagead/gen_204?id=imerr&err=' + c), k[5] = c, k[1] = b, k[2] = f, k[3] = g, k[4] = h, k[6] = d, ud(); + if (l || !yd.hc()) { + c = yd.Jc(); + for (b = 0; b < c.length; b++) + yd.Fc(c[b]); + c.length = 0; + } + }; + zd(a); + }; + var lj = function (a, b) { + b = void 0 === b ? {} : b; + this.root = b.root ? b.root : null; + this.o = b.rootMargin ? Bd(b.rootMargin) : [ + { + value: 0, + type: 'px' + }, + { + value: 0, + type: 'px' + }, + { + value: 0, + type: 'px' + }, + { + value: 0, + type: 'px' + } + ]; + this.rootMargin = _.Ad(this.o, function (c) { + return '' + c.value + c.type; + }).join(' '); + this.M = Dd(b.threshold); + this.B = a; + this.j = []; + this.A = []; + this.D = !1; + this.m = null; + this.F = Wn(this.l, 100, this); + }, Rz = function (a) { + if (a.root) + var b = Fd(a.root); + else { + var c = _.Rq(window); + b = { + top: 0, + right: c.width, + bottom: c.height, + left: 0, + width: c.width, + height: c.height + }; + } + a = _.Ad(a.o, function (d, e) { + return 'px' == d.type ? d.value : d.value * (e % 2 ? b.width : b.height) / 100; + }); + return { + top: b.top - a[0], + right: b.right + a[1], + bottom: b.bottom + a[2], + left: b.left - a[3], + width: b.width + a[1] + a[3], + height: b.height + a[0] + a[2] + }; + }, Sz = function (a, b, c) { + if (!b || b.isIntersecting != c.isIntersecting) + return !0; + var d = b.intersectionRatio, e = c.intersectionRatio; + return d == e ? !1 : _.Rd(a.M, function (f) { + return f < d != f < e; + }); + }; + lj.prototype.l = function () { + var a = this, b = Rz(this); + _.hn(this.j, function (c) { + var d = c.target, e = Fd(d), f = e.width * e.height; + var g = Math.max(b.top, e.top); + var h = Math.min(b.right, e.right), k = Math.min(b.bottom, e.bottom), l = Math.max(b.left, e.left), m = h - l, n = k - g; + g = 0 <= m && 0 <= n ? { + top: g, + right: h, + bottom: k, + left: l, + width: m, + height: n + } : null; + h = !!g; + k = g ? g.width * g.height : 0; + l = window.performance; + d = { + boundingClientRect: e, + intersectionRatio: f ? k / f : h ? 1 : 0, + intersectionRect: g || { + top: 0, + bottom: 0, + left: 0, + right: 0, + width: 0, + height: 0 + }, + isIntersecting: h, + rootBounds: b, + target: d, + time: l && l.now ? l.now() : 0 + }; + Sz(a, c.oa, d) && a.A.push(d); + c.oa = d; + }); + this.A.length && this.B(Tz(this), this); + }; + lj.prototype.observe = function (a) { + _.Rd(this.j, function (b) { + return b.target == a; + }) || (this.j.push({ + target: a, + oa: null + }), this.l(), this.D || (this.D = !0, _.fb(_.r, 'scroll', this.F), _.fb(_.r, 'resize', this.F), _.r.MutationObserver && !this.m && (this.m = new MutationObserver(this.F), this.m.observe(_.r.document, { + attributes: !0, + childList: !0, + characterData: !0, + subtree: !0 + })))); + }; + lj.prototype.unobserve = function (a) { + this.j = _.Cd(this.j, function (b) { + return b.target != a; + }); + 0 == this.j.length && this.disconnect(); + }; + lj.prototype.disconnect = function () { + this.D = !1; + this.j.length = 0; + _.Lc(_.r, 'scroll', this.F); + _.Lc(_.r, 'resize', this.F); + this.m && (this.m.disconnect(), this.m = null); + }; + var Tz = function (a) { + var b = [].concat(_.lc(a.A)); + a.A.length = 0; + return b; + }; + var Uz = function (a, b, c, d, e, f) { + _.gu.call(this); + this.l = a; + this.status = 1; + this.D = b; + this.A = c; + this.J = d; + this.qb = !!e; + this.o = Math.random(); + this.B = {}; + this.j = null; + this.R = (0, _.bn)(this.G, this); + this.M = f; + }; + _.O(Uz, _.gu); + Uz.prototype.G = function (a) { + if (!('*' !== this.A && a.origin !== this.A || !this.qb && a.source != this.D)) { + var b = null; + try { + b = JSON.parse(a.data); + } catch (c) { + } + if (_.ja(b) && (a = b.i, b.c === this.l && a != this.o)) { + if (2 !== this.status) + try { + this.status = 2, Vz(this), this.j && (this.j(), this.j = null); + } catch (c) { + } + a = b.s; + b = b.p; + if ('string' === typeof a && ('string' === typeof b || _.ja(b)) && this.B.hasOwnProperty(a)) + this.B[a](b); + } + } + }; + var Vz = function (a) { + var b = {}; + b.c = a.l; + b.i = a.o; + a.M && (b.e = a.M); + a.D.postMessage(JSON.stringify(b), a.A); + }; + Uz.prototype.T = function () { + if (1 === this.status) { + try { + this.D.postMessage && Vz(this); + } catch (a) { + } + window.setTimeout((0, _.bn)(this.T, this), 50); + } + }; + Uz.prototype.connect = function (a) { + a && (this.j = a); + _.fb(window, 'message', this.R); + this.J && this.T(); + }; + var Wz = function (a, b, c) { + a.B[b] = c; + }; + Uz.prototype.send = function (a, b) { + var c = {}; + c.c = this.l; + c.i = this.o; + c.s = a; + c.p = b; + try { + this.D.postMessage(JSON.stringify(c), this.A); + } catch (d) { + } + }; + Uz.prototype.F = function () { + this.status = 3; + _.Lc(window, 'message', this.R); + _.gu.prototype.F.call(this); + }; + var Xz = new v.Map([ + [ + 'navigate', + 1 + ], + [ + 'reload', + 2 + ], + [ + 'back_forward', + 3 + ], + [ + 'prerender', + 4 + ] + ]), Yz = new v.Map([ + [ + 0, + 1 + ], + [ + 1, + 2 + ], + [ + 2, + 3 + ] + ]); + Yi(Ot); + var Zz = function (a) { + Q.call(this, a); + }; + _.O(Zz, Q); + var $z = function (a) { + Q.call(this, a); + }; + _.O($z, Q); + var aA = function (a) { + Q.call(this, a); + }; + _.O(aA, Q); + ei(fd(gn('https://pagead2.googlesyndication.com/pagead/osd.js'))); + var cA = function () { + return 0 != bA(document); + }, bA = function (a) { + return _.H(Pt) && a.prerendering ? 3 : { + visible: 1, + hidden: 2, + prerender: 3, + preview: 4, + unloaded: 5 + }[a.visibilityState || a.webkitVisibilityState || a.mozVisibilityState || ''] || 0; + }, dA = function (a) { + var b; + a.visibilityState ? b = 'visibilitychange' : a.mozVisibilityState ? b = 'mozvisibilitychange' : a.webkitVisibilityState && (b = 'webkitvisibilitychange'); + return b; + }, eA = function (a) { + return null != a.hidden ? a.hidden : null != a.mozHidden ? a.mozHidden : null != a.webkitHidden ? a.webkitHidden : null; + }, fA = function (a, b) { + if (3 == bA(b)) + return !1; + a(); + return !0; + }, gA = function (a, b) { + if (!fA(a, b)) { + var c = !1, d = dA(b), e = function () { + !c && fA(a, b) && (c = !0, _.Lc(b, d, e)); + }; + d && _.fb(b, d, e); + } + }; + var iA, hA; + iA = function () { + this.wasPlaTagProcessed = !1; + this.wasReactiveAdConfigReceived = {}; + this.adCount = {}; + this.wasReactiveAdVisible = {}; + this.stateForType = {}; + this.reactiveTypeEnabledInAsfe = {}; + this.wasReactiveTagRequestSent = !1; + this.reactiveTypeDisabledByPublisher = {}; + this.tagSpecificState = {}; + this.messageValidationEnabled = !1; + this.floatingAdsStacking = new hA(); + this.sideRailProcessedFixedElements = new v.Set(); + this.sideRailAvailableSpace = new v.Map(); + }; + _.Bh = function (a) { + a.google_reactive_ads_global_state ? (null == a.google_reactive_ads_global_state.sideRailProcessedFixedElements && (a.google_reactive_ads_global_state.sideRailProcessedFixedElements = new v.Set()), null == a.google_reactive_ads_global_state.sideRailAvailableSpace && (a.google_reactive_ads_global_state.sideRailAvailableSpace = new v.Map())) : a.google_reactive_ads_global_state = new iA(); + return a.google_reactive_ads_global_state; + }; + hA = function () { + this.maxZIndexRestrictions = {}; + this.nextRestrictionId = 0; + this.maxZIndexListeners = []; + }; + var lA; + _.jA = function (a) { + this.j = _.Bh(a).floatingAdsStacking; + }; + _.kA = function (a) { + a = _.dr(a.j.maxZIndexRestrictions); + return a.length ? Math.min.apply(null, a) : null; + }; + lA = function (a) { + var b = _.kA(a); + _.hn(a.j.maxZIndexListeners, function (c) { + return c(b); + }); + }; + _.mA = function (a) { + this.m = a; + this.j = null; + }; + _.nA = function (a) { + if (null == a.j) { + var b = a.m, c = b.j.nextRestrictionId++; + b.j.maxZIndexRestrictions[c] = 2147483646; + lA(b); + a.j = c; + } + }; + _.oA = function (a) { + if (null != a.j) { + var b = a.m; + delete b.j.maxZIndexRestrictions[a.j]; + lA(b); + a.j = null; + } + }; + var Dh, Gf, Jf; + Dh = 728 * 1.38; + _.Fh = function (a) { + return a.innerHeight >= a.innerWidth; + }; + _.pA = function (a) { + var b = _.If(a).clientWidth; + a = a.innerWidth; + return b && a ? b / a : 0; + }; + Gf = function (a, b) { + return (a = _.If(a).clientWidth) ? a > (void 0 === b ? 420 : b) ? 32768 : 320 > a ? 65536 : 0 : 16384; + }; + Jf = function (a) { + return (a = _.pA(a)) ? 1.05 < a ? 262144 : 0.95 > a ? 524288 : 0 : 131072; + }; + _.If = function (a) { + a = a.document; + var b = {}; + a && (b = 'CSS1Compat' == a.compatMode ? a.documentElement : a.body); + return b || {}; + }; + _.qA = function (a) { + return void 0 === a.pageYOffset ? (a.document.documentElement || a.document.body.parentNode || a.document.body).scrollTop : a.pageYOffset; + }; + var Gh = function (a, b, c) { + for (var d = [], e = 0; 3 > e; e++) + for (var f = 0; 3 > f; f++) { + var g = d; + g.push.call(g, { + x: f / 2 * a, + y: b + e / 2 * (c - b) + }); + } + return d; + }, Hh = 90 * 1.38; + var rA; + _.sA = function (a, b) { + if (!a.body) + return null; + var c = new rA(); + c.apply(a, b); + return function () { + _.Tr(a.body, { + filter: c.j, + webkitFilter: c.j, + overflow: c.F, + position: c.A, + top: c.D + }); + b.scrollTo(0, c.m); + }; + }; + rA = function () { + this.j = this.D = this.A = this.F = null; + this.m = 0; + }; + rA.prototype.apply = function (a, b) { + this.F = a.body.style.overflow; + this.A = a.body.style.position; + this.D = a.body.style.top; + this.j = a.body.style.filter ? a.body.style.filter : a.body.style.webkitFilter; + this.m = _.qA(b); + _.Tr(a.body, 'top', -this.m + 'px'); + }; + _.Lf = function (a, b) { + var c; + if (!(c = 0 >= b) && !(c = null == a)) { + try { + a.setItem('__storage_test__', '__storage_test__'); + var d = a.getItem('__storage_test__'); + a.removeItem('__storage_test__'); + var e = '__storage_test__' === d; + } catch (f) { + e = !1; + } + c = !e; + } + return c ? null : Sd(a, b); + }; + _.Kf = function (a) { + return !!a && 1 > a.length; + }; + var km = function (a, b) { + b = void 0 === b ? 500 : b; + _.gu.call(this); + this.A = a; + this.o = b; + this.j = null; + this.l = {}; + this.B = 0; + this.D = null; + }; + _.O(km, _.gu); + km.prototype.F = function () { + this.l = {}; + this.D && (_.Lc(this.A, 'message', this.D), delete this.D); + delete this.l; + delete this.A; + delete this.j; + _.gu.prototype.F.call(this); + }; + var mm = function (a) { + var b; + return 'function' === typeof (null === (b = a.A) || void 0 === b ? void 0 : b.__uspapi) || null != tA(a); + }, vA = function (a, b) { + var c = {}; + if (mm(a)) { + var d = _.Vn(function () { + return b(c); + }); + uA(a, function (e, f) { + f && (c = e); + d(); + }); + setTimeout(d, a.o); + } else + b(c); + }, uA = function (a, b) { + var c; + if ('function' === typeof (null === (c = a.A) || void 0 === c ? void 0 : c.__uspapi)) + a = a.A.__uspapi, a('getUSPData', 1, b); + else if (tA(a)) { + wA(a); + var d = ++a.B; + a.l[d] = b; + a.j && (b = {}, a.j.postMessage((b.__uspapiCall = { + command: 'getUSPData', + version: 1, + callId: d + }, b), '*')); + } + }, tA = function (a) { + if (a.j) + return a.j; + a.j = qr(a.A, '__uspapiLocator'); + return a.j; + }, wA = function (a) { + a.D || (a.D = function (b) { + var c; + try { + var d = {}; + 'string' === typeof b.data ? d = JSON.parse(b.data) : d = b.data; + var e = d.__uspapiReturn; + null === (c = a.l) || void 0 === c ? void 0 : c[e.callId](e.returnValue, e.success); + } catch (f) { + } + }, _.fb(a.A, 'message', a.D)); + }; + var xA = function (a) { + Q.call(this, a); + }; + _.O(xA, Q); + var zA = function (a) { + Q.call(this, a, -1, yA); + }; + _.O(zA, Q); + var yA = [ + 1, + 2 + ]; + var AA = function (a) { + Q.call(this, a); + }; + _.O(AA, Q); + var BA = function (a) { + Q.call(this, a); + }; + _.O(BA, Q); + var im = function (a) { + _.gu.call(this); + this.A = a; + this.D = this.j = null; + this.l = {}; + this.B = 0; + this.o = !1; + }; + _.O(im, _.gu); + var Jg = function (a) { + a.o || (a.j || (a.j = a.A.googlefc ? a.A : qr(a.A, 'googlefcPresent')), a.o = !0); + return !!a.j; + }, DA = function (a, b, c) { + if (Jg(a)) + if (a.j === a.A) + a = a.j.googlefc || (a.j.googlefc = {}), a.__fci = a.__fci || [], a.__fci.push(b, function (f) { + c(Sl(BA, f)); + }); + else { + CA(a); + var d = a.B++; + a.l[d] = c; + var e = {}; + a.j.postMessage((e.__fciCall = { + command: b, + callId: d + }, e), '*'); + } + }, EA = function (a, b) { + return new v.Promise(function (c) { + DA(a, b, c); + }); + }, CA = function (a) { + a.D || (a.D = function (b) { + try { + var c = Sl(BA, b.data.__fciReturn); + (0, a.l[G(c, 1)])(c); + } catch (d) { + } + }, _.fb(a.A, 'message', a.D)); + }, FA = function (a, b, c, d) { + if (!b) + return v.Promise.resolve(null); + var e = Wb(b, xA, 3); + b = Wb(b, AA, 2); + return e && b && 1 === G(b, 1) && 2 === G(e, 1) ? EA(a, 'getM25Consent').then(function (f) { + var g = Wb(f, zA, 4); + if (g) { + if (f = d, c) { + var h = Oh(g, 1); + h && _.t(h, 'includes').call(h, c) && (f = !1); + (g = Oh(g, 2)) && _.t(g, 'includes').call(g, c) && (f = !0); + } + } else + f = null; + return f; + }) : v.Promise.resolve(null); + }; + var Vi = function (a, b, c) { + var d = !0; + b = void 0 === b ? '' : b; + d = void 0 === d ? !1 : d; + c = void 0 === c ? '' : c; + if (!a) + return d && Td(c, 1), a; + var e = a.toLowerCase(); + if (-1 < e.indexOf('' + b + '' + a + ''; + }; + var Mi = [ + 'auto', + 'inherit', + '100%' + ], GA = Mi.concat(['none']), HA = function (a, b, c, d, e, f) { + e = void 0 === e ? 10 : e; + f = void 0 === f ? 10 : f; + b = b.styleSheets; + if (!b) + return !1; + var g = a.matches || a.webkitMatchesSelector || a.mozMatchesSelector || a.msMatchesSelector || a.oMatchesSelector; + e = -1 == e ? Infinity : e; + f = -1 == f ? Infinity : f; + for (var h = 0; h < Math.min(b.length, e); ++h) { + var k = void 0; + try { + var l = b[h], m = null; + try { + m = l.cssRules || l.rules; + } catch (D) { + if (15 == D.code) + throw D.styleSheet = l, D; + } + k = m; + } catch (D) { + continue; + } + if (k && 0 < k.length) + for (m = 0; m < Math.min(k.length, f); ++m) { + var n = k[m], q; + if (q = 1 == n.type) { + q = n; + var u = c; + q = g.call(a, q.selectorText) && u(q); + } + if (!q && (q = d && 4 == n.type)) + a: { + q = a; + u = c; + var B = f; + n = n.cssRules || []; + for (var x = 0; x < Math.min(n.length, B); x++) { + var z = n[x], C; + if (C = 1 === z.type) + C = u, C = g.call(q, z.selectorText) && C(z); + if (C) { + q = !0; + break a; + } + } + q = !1; + } + if (q) + return !0; + } + } + return !1; + }, Zk = function (a, b, c) { + var d = void 0 === d ? 10 : d; + var e = void 0 === e ? 10 : e; + if (!a) + return !0; + var f = !0; + Ki(a, function (g) { + return f = Li(g, b, !1, d, e); + }, void 0 === c ? 100 : c); + return f; + }, Li = function (a, b, c, d, e) { + var f = a.style; + return f && f.height && !(0 <= _.da(Mi, f.height)) || f && f.maxHeight && !(0 <= _.da(GA, f.maxHeight)) || HA(a, b.document, function (g) { + var h = g.style.height; + g = g.style['max-height']; + return h && !(0 <= _.da(Mi, h)) || g && !(0 <= _.da(GA, g)); + }, c, d, e) ? !1 : !0; + }; + var IA = function (a, b, c, d, e, f) { + this.F = _.Hr(a); + this.m = _.Hr(b); + this.A = c; + this.j = _.Hr(d); + this.D = e; + this.l = f; + }; + IA.prototype.X = function () { + return JSON.stringify({ + windowCoords_t: this.F.top, + windowCoords_r: this.F.right, + windowCoords_b: this.F.bottom, + windowCoords_l: this.F.left, + frameCoords_t: this.m.top, + frameCoords_r: this.m.right, + frameCoords_b: this.m.bottom, + frameCoords_l: this.m.left, + styleZIndex: this.A, + allowedExpansion_t: this.j.top, + allowedExpansion_r: this.j.right, + allowedExpansion_b: this.j.bottom, + allowedExpansion_l: this.j.left, + xInView: this.D, + yInView: this.l + }); + }; + var JA = function (a, b) { + var c = window, d = c.screenX || c.screenLeft || 0, e = c.screenY || c.screenTop || 0; + c = new _.Gr(e, d + (c.outerWidth || document.documentElement.clientWidth || 0), e + (c.outerHeight || document.documentElement.clientHeight || 0), d); + var f = Yr(a); + d = _.Od(_.Pd, a); + var g = new Ir(f.x, f.y, d.width, d.height); + d = Jr(g); + e = String(Nd(a, 'zIndex')); + var h = new _.Gr(0, Infinity, Infinity, 0); + for (var k = Nq(a), l = k.j.body, m = k.j.documentElement, n = Sq(k.j); a = Xr(a);) + if (!(_.ao && 0 == a.clientWidth || eo && 0 == a.clientHeight && a == l) && a != l && a != m && 'visible' != Nd(a, 'overflow')) { + var q = Yr(a), u = new _.ig(a.clientLeft, a.clientTop); + q.x += u.x; + q.y += u.y; + h.top = Math.max(h.top, q.y); + h.right = Math.min(h.right, q.x + a.clientWidth); + h.bottom = Math.min(h.bottom, q.y + a.clientHeight); + h.left = Math.max(h.left, q.x); + } + a = n.scrollLeft; + n = n.scrollTop; + h.left = Math.max(h.left, a); + h.top = Math.max(h.top, n); + k = k.j; + k = _.Rq(k.parentWindow || k.defaultView || window); + h.right = Math.min(h.right, a + k.width); + h.bottom = Math.min(h.bottom, n + k.height); + h = (h = 0 <= h.top && 0 <= h.left && h.bottom > h.top && h.right > h.left ? h : null) ? new Ir(h.left, h.top, h.right - h.left, h.bottom - h.top) : null; + b ? (k = b.boundingClientRect, b = new Ir(f.x - k.left, f.y - k.top, b.rootBounds.width, b.rootBounds.height)) : b = h; + k = h ? Kr(g, h) : null; + h = f = 0; + k && !new _.Ui(k.width, k.height).isEmpty() && (f = k.width / g.width, h = k.height / g.height); + k = new _.Gr(0, 0, 0, 0); + if (a = b) + (g = Kr(g, b)) ? (n = Jr(b), l = Jr(g), a = l.right != n.left && n.right != l.left, n = l.bottom != n.top && n.bottom != l.top, a = (0 != g.width || a) && (0 != g.height || n)) : a = !1; + a && (k = new _.Gr(Math.max(d.top - b.top, 0), Math.max(b.left + b.width - d.right, 0), Math.max(b.top + b.height - d.bottom, 0), Math.max(d.left - b.left, 0))); + return new IA(c, d, e, k, f, h); + }; + var KA = function (a) { + this.A = a; + this.D = null; + this.R = this.status = 0; + this.m = null; + this.ka = 'sfchannel' + a; + }; + var Uu = Wu; + var LA = function (a) { + this.j = a; + }; + LA.prototype.X = function () { + return JSON.stringify(this.j); + }; + var MA = function (a, b) { + this.zb = a; + this.Ab = b; + this.m = this.j = !1; + }; + MA.prototype.X = function () { + return JSON.stringify({ + expandByOverlay: this.zb, + expandByPush: this.Ab, + readCookie: this.j, + writeCookie: this.m + }); + }; + var NA = function (a, b, c, d, e, f, g, h, k, l) { + k = void 0 === k ? [] : k; + this.m = a; + this.F = b; + this.A = c; + this.permissions = d; + this.metadata = e; + this.D = f; + this.qb = g; + this.hostpageLibraryTokens = k; + this.j = ''; + this.Sa = h; + this.$a = void 0 === l ? '' : l; + }; + NA.prototype.X = function () { + var a = {}; + a = (a.uid = this.m, a.hostPeerName = this.F, a.initialGeometry = this.A.X(), a.permissions = this.permissions.X(), a.metadata = this.metadata.X(), a.reportCreativeGeometry = this.D, a.isDifferentSourceWindow = this.qb, a.goog_safeframe_hlt = mw(this.hostpageLibraryTokens), a.encryptionMode = this.Sa, a); + this.j && (a.sentinel = this.j); + this.$a && (a.pbjsAdConfig = this.$a); + return JSON.stringify(a); + }; + var OA = function (a, b) { + this.j = a; + this.F = b; + }; + OA.prototype.X = function (a) { + this.F && a && (a.sentinel = this.F); + return JSON.stringify(a); + }; + var PA = function (a, b, c) { + OA.call(this, a, void 0 === c ? '' : c); + this.version = b; + }; + _.O(PA, OA); + PA.prototype.X = function () { + return OA.prototype.X.call(this, { + uid: this.j, + version: this.version + }); + }; + var QA = function (a, b, c, d) { + OA.call(this, a, void 0 === d ? '' : d); + this.A = b; + this.m = c; + }; + _.O(QA, OA); + QA.prototype.X = function () { + return OA.prototype.X.call(this, { + uid: this.j, + initialWidth: this.A, + initialHeight: this.m + }); + }; + var RA = function (a, b, c) { + OA.call(this, a, void 0 === c ? '' : c); + this.description = b; + }; + _.O(RA, OA); + RA.prototype.X = function () { + return OA.prototype.X.call(this, { + uid: this.j, + description: this.description + }); + }; + var SA = function (a, b, c, d) { + OA.call(this, a, void 0 === d ? '' : d); + this.m = b; + this.push = c; + }; + _.O(SA, OA); + SA.prototype.X = function () { + return OA.prototype.X.call(this, { + uid: this.j, + expand_t: this.m.top, + expand_r: this.m.right, + expand_b: this.m.bottom, + expand_l: this.m.left, + push: this.push + }); + }; + var TA = function (a, b) { + OA.call(this, a, void 0 === b ? '' : b); + }; + _.O(TA, OA); + TA.prototype.X = function () { + return OA.prototype.X.call(this, { uid: this.j }); + }; + var UA = function (a, b, c) { + OA.call(this, a, void 0 === c ? '' : c); + this.A = b; + }; + _.O(UA, OA); + UA.prototype.X = function () { + var a = { + uid: this.j, + newGeometry: this.A.X() + }; + return OA.prototype.X.call(this, a); + }; + var VA = function (a, b, c, d, e, f) { + UA.call(this, a, c, void 0 === f ? '' : f); + this.success = b; + this.m = d; + this.push = e; + }; + _.O(VA, UA); + VA.prototype.X = function () { + var a = { + uid: this.j, + success: this.success, + newGeometry: this.A.X(), + expand_t: this.m.top, + expand_r: this.m.right, + expand_b: this.m.bottom, + expand_l: this.m.left, + push: this.push + }; + this.F && (a.sentinel = this.F); + return JSON.stringify(a); + }; + var WA = function (a, b, c, d) { + OA.call(this, a, void 0 === d ? '' : d); + this.width = b; + this.height = c; + }; + _.O(WA, OA); + WA.prototype.X = function () { + return OA.prototype.X.call(this, { + uid: this.j, + width: this.width, + height: this.height + }); + }; + var XA = function () { + this.j = []; + }, ZA = function (a, b, c, d, e) { + a.j.push(new YA(b, c, d, e)); + }, $A = function (a, b, c, d) { + ZA(a, b, c, d + 'px', void 0); + }, aB = function (a) { + for (var b = a.j.length - 1; 0 <= b; b--) { + var c = a.j[b]; + c.m ? (c.F.style.removeProperty(c.j), c.F.style.setProperty(c.j, String(c.A), c.D)) : c.F.style[c.j] = c.A; + } + a.j.length = 0; + }, YA = function (a, b, c, d) { + this.F = a; + this.j = (this.m = !(void 0 === d || !a.style || !a.style.getPropertyPriority)) ? String(b).replace(/([A-Z])/g, '-$1').toLowerCase() : b; + this.A = this.m ? a.style.getPropertyValue(this.j) : a.style[this.j]; + this.D = this.m ? a.style.getPropertyPriority(this.j) : void 0; + this.m ? (a.style.removeProperty(this.j), a.style.setProperty(this.j, String(c), d)) : a.style[this.j] = String(c); + }; + var bB = function () { + var a = window, b = _.ll(a); + b && (b = { + label: '2', + type: 9, + value: b + }, a = a.google_js_reporting_queue = a.google_js_reporting_queue || [], 2048 > a.length && a.push(b)); + }, cB = function (a, b, c) { + var d = window; + return function () { + var e = _.ll(), f = 3; + try { + var g = b.apply(this, arguments); + } catch (h) { + f = 13; + if (c) + return c(a, h), g; + throw h; + } finally { + d.google_measure_js_timing && e && (e = { + label: a.toString(), + value: e, + duration: (_.ll() || 0) - e, + type: f + }, f = d.google_js_reporting_queue = d.google_js_reporting_queue || [], 2048 > f.length && f.push(e)); + } + return g; + }; + }; + var aj = function (a) { + KA.call(this, a.uniqueId); + var b = this; + this.o = a.Ff; + this.ia = 1 === a.size; + this.ga = new MA(a.permissions.zb && !this.ia, a.permissions.Ab && !this.ia); + this.l = a.wc; + var c; + this.ra = null != (c = a.hostpageLibraryTokens) ? c : []; + var d = window.location; + c = d.protocol; + d = d.host; + this.ta = 'file:' == c ? '*' : c + '//' + d; + this.xa = !!a.qb; + c = !1 === a.dd ? 'https:' : window.location.protocol; + this.N = a.Qb ? '//' + a.Qb + '.safeframe.googlesyndication.com' : '//tpc.googlesyndication.com'; + this.sa = a.pb ? '*' : Vd(a.Sa) ? 'https://secureframe.doubleclick.net' : c + this.N; + this.Y = !!a.xd; + this.ea = dB(a); + this.F = new XA(); + eB(this, a.wc, a.size); + this.D = this.da = JA(a.wc); + this.J = a.ne || '1-0-38'; + var e; + this.na = null != (e = a.qd) ? e : ''; + var f; + this.Z = null != (f = a.Sa) ? f : null; + this.La = a.$a; + fB(this, a); + this.aa = null; + this.T = cB(412, function () { + return gB(b); + }, a.za); + this.G = -1; + this.M = 0; + this.B = null; + !a.Xf || 'function' !== typeof IntersectionObserver || go || fo || (this.B = new IntersectionObserver(cB(414, function (h) { + b.aa = h[h.length - 1]; + gB(b); + }, a.za))); + this.m = new Uz(this.ka, this.j.contentWindow, this.sa, !1); + Wz(this.m, 'init_done', (0, _.bn)(this.kc, this)); + Wz(this.m, 'register_done', (0, _.bn)(this.zc, this)); + Wz(this.m, 'report_error', (0, _.bn)(this.Ac, this)); + Wz(this.m, 'expand_request', (0, _.bn)(this.bc, this)); + Wz(this.m, 'collapse_request', (0, _.bn)(this.Yb, this)); + Wz(this.m, 'creative_geometry_update', (0, _.bn)(this.V, this)); + this.m.connect((0, _.bn)(this.rc, this)); + var g = cB(415, function () { + b.j && (b.j.name = '', a.Qc && a.Qc(), _.Lc(b.j, 'load', g)); + }, a.za); + _.fb(this.j, 'load', g); + this.kc = cB(413, this.kc, a.za); + this.zc = cB(417, this.zc, a.za); + this.Ac = cB(419, this.Ac, a.za); + this.bc = cB(411, this.bc, a.za); + this.Yb = cB(409, this.Yb, a.za); + this.V = cB(410, this.V, a.za); + this.rc = cB(416, this.rc, a.za); + }; + _.O(aj, KA); + var eB = function (a, b, c) { + a.ia ? (b.style.width = _.$r('100%', !0), b.style.height = _.$r('auto', !0)) : (b.style.width = _.$r(c.width, !0), b.style.height = _.$r(c.height, !0)); + }, fB = function (a, b) { + var c, d = b.pb ? '' : null != (c = b.content) ? c : ''; + c = { + shared: { + sf_ver: a.J, + ck_on: Vu() ? 1 : 0, + flash_ver: '0' + } + }; + var e = a.J + ';' + d.length + ';' + d + new NA(a.A, a.ta, a.da, a.ga, new LA(c), a.ia, a.xa, a.Z, a.ra, a.La).X(); + c = !1 === b.dd; + if (a.Y && b.size instanceof _.Ui) { + d = Vd(b.Sa) ? 'https://secureframe.doubleclick.net' : _.Tq(_.Mq(a.l)).location.protocol + a.N; + var f = _.Tq(_.Mq(a.l)), g = b.Lc, h = b.size; + Tv || di(f.document, Uv); + Tv++; + f.google_eas_queue = f.google_eas_queue || []; + f.google_eas_queue.push({ + a: g, + b: d, + c: h.width, + d: h.height, + e: 'sf-gdn-exp-' + Tv, + f: void 0, + g: void 0, + h: void 0, + i: void 0 + }); + } + d = _.H(Ri) ? '3rd party ad content' : ''; + var k = b.size; + g = b.Rb; + h = b.Jd || d; + d = b.Cb; + f = void 0 === b.pb; + var l = k.width; + k = k.height; + a.ia && (k = l = 0); + var m = {}; + e = (m.id = b.Lc, m.title = h, m.name = e, m.scrolling = 'no', m.marginWidth = '0', m.marginHeight = '0', m.width = String(l), m.height = String(k), m['data-is-safeframe'] = 'true', m); + if (f) { + f = _.Tq(_.Mq(a.l)); + if (Vd(a.Z)) + c = 'https://secureframe.doubleclick.net/container.html?ecs=' + g; + else { + g = a.na; + h = a.N; + (l = g) && (l = '?' + l); + h = (void 0 === h ? '//tpc.googlesyndication.com' : h) + ('/safeframe/' + a.J + '/html/container.html' + l); + l = f; + for (k = 0; l != l.parent;) + k++, l = l.parent; + (l = k) && (h += (g ? '&' : '?') + 'n=' + l); + c = (c || jr(f, !1) ? 'https:' : 'http:') + h; + } + g = []; + a.Y && (h = kr(f.location.href), f = g.push, h = [ + 0 < h.length ? 'google_debug' + (h ? '=' + h : '') + '&' : '', + 'xpc=', + 'sf-gdn-exp-' + a.A, + '&p=', + encodeURIComponent(_.r.document.location.protocol), + '//', + encodeURIComponent(_.r.document.location.host) + ].join(''), f.call(g, h)); + g.length && (c += '#' + g.join('&')); + e.src = c; + } + null !== a.ea && (e.sandbox = a.ea); + d && (e.allow = d); + _.H(Ri) && (e.role = 'region', e['aria-label'] = 'Advertisement', e.tabIndex = '0'); + b.pb ? (a.j = b.pb, Pq(a.j, e)) : (b = {}, b = (b.frameborder = 0, b.allowTransparency = 'true', b.style = 'border:0;vertical-align:bottom;', b.src = 'about:blank', b), e && ya(b, e), d = _.Oi('IFRAME'), Pq(d, b), a.j = d); + a.ia && (a.j.style.minWidth = '100%'); + a.l.appendChild(a.j); + }; + p = aj.prototype; + p.rc = function () { + this.B && this.j ? this.B.observe(this.j) : (_.fb(window, 'resize', this.T), _.fb(window, 'scroll', this.T)); + }; + p.kc = function (a) { + try { + if (0 != this.status) + throw Error('Container already initialized'); + if ('string' !== typeof a) + throw Error('Could not parse serialized message'); + var b = JSON.parse(a); + if (!_.ja(b) || !Ud(b.uid) || 'string' !== typeof b.version) + throw Error('Cannot parse JSON message'); + var c = new PA(b.uid, b.version, b.sentinel); + if (this.A !== c.j || this.J !== c.version) + throw Error('Wrong source container'); + this.status = 1; + } catch (e) { + var d; + null == (d = this.o) || d.error('Invalid INITIALIZE_DONE message. Reason: ' + e.message); + } + }; + p.zc = function (a) { + try { + if (1 != this.status) + throw Error('Container not initialized'); + if ('string' !== typeof a) + throw Error('Could not parse serialized message'); + var b = JSON.parse(a); + if (!_.ja(b) || !Ud(b.uid) || 'number' !== typeof b.initialWidth || 'number' !== typeof b.initialHeight) + throw Error('Cannot parse JSON message'); + if (this.A !== new QA(b.uid, b.initialWidth, b.initialHeight, b.sentinel).j) + throw Error('Wrong source container'); + this.status = 2; + } catch (d) { + var c; + null == (c = this.o) || c.error('Invalid REGISTER_DONE message. Reason: ' + d.message); + } + }; + p.Ac = function (a) { + try { + if ('string' !== typeof a) + throw Error('Could not parse serialized message'); + var b = JSON.parse(a); + if (!_.ja(b) || !Ud(b.uid) || 'string' !== typeof b.description) + throw Error('Cannot parse JSON message'); + var c = new RA(b.uid, b.description, b.sentinel); + if (this.A !== c.j) + throw Error('Wrong source container'); + var d; + null == (d = this.o) || d.info('Ext reported an error. Description: ' + c.description); + } catch (f) { + var e; + null == (e = this.o) || e.error('Invalid REPORT_ERROR message. Reason: ' + f.message); + } + }; + p.bc = function (a) { + try { + if (2 != this.status) + throw Error('Container is not registered'); + if (0 != this.R) + throw Error('Container is not collapsed'); + if ('string' !== typeof a) + throw Error('Could not parse serialized message'); + var b = JSON.parse(a); + if (!_.ja(b) || !Ud(b.uid) || 'number' !== typeof b.expand_t || 'number' !== typeof b.expand_r || 'number' !== typeof b.expand_b || 'number' !== typeof b.expand_l || 'boolean' !== typeof b.push) + throw Error('Cannot parse JSON message'); + var c = new SA(b.uid, new _.Gr(b.expand_t, b.expand_r, b.expand_b, b.expand_l), b.push, b.sentinel); + if (this.A !== c.j) + throw Error('Wrong source container'); + if (!(0 <= c.m.top && 0 <= c.m.left && 0 <= c.m.bottom && 0 <= c.m.right)) + throw Error('Invalid expansion amounts'); + var d; + if (d = c.push && this.ga.Ab || !c.push && this.ga.zb) { + var e = c.m, f = c.push, g = this.D = JA(this.j); + if (e.top <= g.j.top && e.right <= g.j.right && e.bottom <= g.j.bottom && e.left <= g.j.left) { + if (!f) + for (var h = this.j.parentNode; h && h.style; h = h.parentNode) + ZA(this.F, h, 'overflowX', 'visible', 'important'), ZA(this.F, h, 'overflowY', 'visible', 'important'); + var k = Jr(new Ir(0, 0, this.D.m.getWidth(), this.D.m.getHeight())); + _.ja(e) ? (k.top -= e.top, k.right += e.right, k.bottom += e.bottom, k.left -= e.left) : (k.top -= e, k.right += Number(void 0), k.bottom += Number(void 0), k.left -= Number(void 0)); + ZA(this.F, this.l, 'position', 'relative'); + ZA(this.F, this.j, 'position', 'absolute'); + f ? ($A(this.F, this.l, 'width', k.getWidth()), $A(this.F, this.l, 'height', k.getHeight())) : ZA(this.F, this.j, 'zIndex', '10000'); + $A(this.F, this.j, 'width', k.getWidth()); + $A(this.F, this.j, 'height', k.getHeight()); + $A(this.F, this.j, 'left', k.left); + $A(this.F, this.j, 'top', k.top); + this.R = 2; + this.D = JA(this.j); + d = !0; + } else + d = !1; + } + a = d; + this.m.send('expand_response', new VA(this.A, a, this.D, c.m, c.push).X()); + if (!a) + throw Error('Viewport or document body not large enough to expand into.'); + } catch (m) { + var l; + null == (l = this.o) || l.error('Invalid EXPAND_REQUEST message. Reason: ' + m.message); + } + }; + p.Yb = function (a) { + try { + if (2 != this.status) + throw Error('Container is not registered'); + if (2 != this.R) + throw Error('Container is not expanded'); + if ('string' !== typeof a) + throw Error('Could not parse serialized message'); + var b = JSON.parse(a); + if (!_.ja(b) || !Ud(b.uid)) + throw Error('Cannot parse JSON message'); + if (this.A !== new TA(b.uid, b.sentinel).j) + throw Error('Wrong source container'); + aB(this.F); + this.R = 0; + this.j && (this.D = JA(this.j)); + this.m.send('collapse_response', new UA(this.A, this.D).X()); + } catch (d) { + var c; + null == (c = this.o) || c.error('Invalid COLLAPSE_REQUEST message. Reason: ' + d.message); + } + }; + var gB = function (a) { + if (1 == a.status || 2 == a.status) + switch (a.M) { + case 0: + hB(a); + a.G = window.setTimeout((0, _.bn)(a.$, a), 1000); + a.M = 1; + break; + case 1: + a.M = 2; + break; + case 2: + a.M = 2; + } + }; + aj.prototype.V = function (a) { + try { + if ('string' !== typeof a) + throw Error('Could not parse serialized message'); + var b = JSON.parse(a); + if (!_.ja(b) || !Ud(b.uid) || 'number' !== typeof b.width || 'number' !== typeof b.height || b.sentinel && 'string' !== typeof b.sentinel) + throw Error('Cannot parse JSON message'); + var c = new WA(b.uid, b.width, b.height, b.sentinel); + if (this.A !== c.j) + throw Error('Wrong source container'); + var d = String(c.height); + if (this.ia) + d !== this.j.height && (this.j.height = d, gB(this)); + else { + var e; + null == (e = this.o) || e.error('Got CreativeGeometryUpdate message in non-fluidcontainer. The container is not resized.'); + } + } catch (g) { + var f; + null == (f = this.o) || f.error('Invalid CREATIVE_GEOMETRY_UPDATE message. Reason: ' + g.message); + } + }; + aj.prototype.$ = function () { + if (1 == this.status || 2 == this.status) + switch (this.M) { + case 1: + this.M = 0; + break; + case 2: + hB(this), this.G = window.setTimeout((0, _.bn)(this.$, this), 1000), this.M = 1; + } + }; + var hB = function (a) { + a.D = JA(a.j, a.aa); + a.aa = null; + a.m.send('geometry_update', new UA(a.A, a.D).X()); + }, dB = function (a) { + var b = null; + a.Yc && (b = a.Yc); + return null == b ? null : b.join(' '); + }, iB = [ + 'allow-modals', + 'allow-orientation-lock', + 'allow-presentation', + 'allow-pointer-lock' + ], jB = ['allow-top-navigation'], kB = ['allow-same-origin'], lB = nr([].concat(_.lc(iB), _.lc(jB))); + nr([].concat(_.lc(iB), _.lc(kB))); + nr([].concat(_.lc(iB), _.lc(jB), _.lc(kB))); + var mB = P([ + 'https://tpc.googlesyndication.com/safeframe/', + '/html/container.html' + ]), nB = P(['https://secureframe.doubleclick.net/container.html']), oB = { + Rd: function (a) { + if ('string' !== typeof a.version) + throw new TypeError('version is not a string'); + if (!/^[0-9]+-[0-9]+-[0-9]+$/.test(a.version)) + throw new RangeError('Invalid version: ' + a.version); + if ('string' !== typeof a.Tb) + throw new TypeError('subdomain is not a string'); + if (!/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/.test(a.Tb)) + throw new RangeError('Invalid subdomain: ' + a.Tb); + return Qa('https://' + a.Tb + '.safeframe.googlesyndication.com/safeframe/' + a.version + '/html/container.html'); + }, + Sf: function (a) { + return A(mB, a); + }, + Rf: A(nB) + }; + var Wd = function (a, b) { + try { + rb(Yl(a, b)); + } catch (c) { + } + }; + var pB = function (a) { + Q.call(this, a); + }; + _.O(pB, Q); + var qB = function (a, b) { + Zo(b, a, 4); + Zo(b, a, 2); + Zo(b, a, 1); + Zo(b, a, 3); + Jo(b, 5, G(a, 5)); + Xo(a, b); + }; + var rB = function () { + }; + var sB = [ + 0.05, + 0.1, + 0.2, + 0.5 + ], tB = [ + 0, + 0.5, + 1 + ], uB = function (a) { + a = Vc(a); + if (!a) + return -1; + try { + var b = $v(a.document); + var c = new _.Ui(b.clientWidth, b.clientHeight); + } catch (d) { + c = new _.Ui(-12245933, -12245933); + } + return -12245933 == c.width || -12245933 == c.height ? -1 : c.width * c.height; + }, vB = function (a, b) { + return 0 > a ? [] : _.Ad(sB, function (c) { + return Math.min(a / b * c, 1); + }); + }, yB = function (a) { + this.j = a.I; + this.F = a.Ra; + this.M = a.Wa; + this.A = null; + this.D = a.za; + this.m = wB(this); + this.B = a.re || !1; + this.o = a.Tf || !1; + this.l = null; + this.o && xB(this); + }; + yB.prototype.getSlotId = function () { + return this.A; + }; + var AB = function (a, b) { + if (a.m) { + if (null != a.A) { + try { + zB(a, Math.round(performance.now()), 0, 0, 0, !1); + } catch (g) { + a.D && a.D(g); + } + a.m && a.m.unobserve(a.F); + a.l = null; + } + a.A = b; + a.m.observe(a.F); + if (a.o) { + b = Math.round(performance.now()); + var c = a.F.getBoundingClientRect(), d = c.width * c.height; + a: { + var e = 0; + if (!eA(a.j.document)) { + e = Vc(a.j); + if (!e) { + c = -1; + break a; + } + var f = $v(e.document); + e = Math.min(f.clientWidth, c.left + c.width) - Math.max(0, c.left); + c = Math.min(f.clientHeight, c.top + c.height) - Math.max(0, c.top); + e = 0 < e && 0 < c ? e * c : 0; + } + c = e; + } + a.l = new rB({ + time: b, + Ef: 0 < d ? c / d > (242500 < d ? 0.3 : 0.5) : !1, + Df: 1 == bA(a.j.document) + }); + } + } + }, wB = function (a) { + var b = a.F.offsetWidth * a.F.offsetHeight, c = uB(a.j); + b = [].concat(_.lc(tB), _.lc(vB(c, b))); + ma(b); + return _.r.IntersectionObserver ? new _.r.IntersectionObserver(function (d) { + return BB(a, d); + }, { threshold: b }) : new lj(function (d) { + return BB(a, d); + }, { threshold: b }); + }, BB = function (a, b) { + try { + var c = uB(a.j); + _.hn(b, function (d) { + var e = Math.round(d.time), f = d.boundingClientRect.width * d.boundingClientRect.height, g = d.intersectionRect.width * d.intersectionRect.height; + d = d.isIntersecting; + a.B && zB(a, e, f, g, c, d); + }); + } catch (d) { + a.D && a.D(d); + } + }, zB = function (a, b, c, d, e, f) { + if (null == a.A) + throw Error('Not Attached.'); + var g = new pB(); + c = w(g, 1, c); + d = w(c, 2, d); + e = w(d, 3, e); + b = w(e, 4, b); + f = w(b, 5, f); + f = Eb(Yo(f, qB), 4); + Qe(a.M, '1', 10, f, void 0, a.A); + }, xB = function (a) { + var b = dA(a.j.document); + b && _.fb(a.j.document, b, function () { + a.l && bA(a.j.document); + }); + }; + var CB = function (a, b) { + this.j = a; + this.m = b; + }, DB = function (a) { + if (a.j.frames.google_ads_top_frame) + return !0; + var b = rr('google_ads_top_frame', a.j); + b = b && b.contentWindow; + if (!b) + return !1; + b.addEventListener('message', function (c) { + var d = c.ports; + '__goog_top_url_req' === c.data.msgType && d.length && d[0].postMessage({ + msgType: '__goog_top_url_resp', + topUrl: a.m + }); + }, !1); + return !0; + }; + var EB = { + issuerOrigin: 'https://attestation.android.com', + issuancePath: '/att/i', + redemptionPath: '/att/r' + }, FB = { + issuerOrigin: 'https://pagead2.googlesyndication.com', + issuancePath: '/dtt/i', + redemptionPath: '/dtt/r', + getStatePath: '/dtt/s' + }; + var GB = function () { + var a = void 0 === a ? window : a; + a = a.navigator.userAgent; + var b = /Chrome/.test(a); + return /Android/.test(a) && b; + }; + Yi(cu); + var HB = function (a, b, c) { + a = void 0 === a ? !1 : a; + b = void 0 === b ? !1 : b; + c = void 0 === c ? !1 : c; + _.gu.call(this); + var d = this; + this.j = a; + a = []; + b && GB() && a.push(EB); + c && a.push(FB); + if (document.hasTrustToken && !_.H(Zt) && !Array.isArray(window.goog_tt_state)) { + var e = a.map(function (f) { + return { + issuerOrigin: f.issuerOrigin, + state: d.j ? 1 : 12 + }; + }); + Object.defineProperty(window, 'goog_tt_state', { + configurable: !1, + get: function () { + return e.slice(); + } + }); + } + }; + _.O(HB, _.gu); + var IB = function () { + var a = window; + a = void 0 === a ? window : a; + return !a.PeriodicSyncManager; + }, JB = function () { + var a = void 0 === a ? window : a; + return a.goog_tt_state; + }, KB = function (a) { + return a.some(function (b) { + return b.hasRedemptionRecord; + }); + }, LB = function () { + var a = window, b = _.bf[150]; + return _.bf[221] || '.google.ch' === b || 'function' === typeof a.__tcfapi; + }, MB = function (a, b) { + a = a.filter(function (c) { + return c.hasRedemptionRecord; + }).map(function (c) { + return c.issuerOrigin; + }); + if (0 == a.length) + return null; + a = { + type: 'send-redemption-record', + issuers: a, + refreshPolicy: 'none', + signRequestData: 'include', + includeTimestampHeader: !0, + additionalSignedHeaders: [ + 'sec-time', + 'Sec-Redemption-Record' + ] + }; + b && 0 < _.t(Object, 'keys').call(Object, b).length && (a.additionalSigningData = wo(JSON.stringify(b), 3)); + return a; + }, NB = function (a) { + var b = JB(), c = _.bf[252]; + if (a.setTrustToken && b && KB(b)) + try { + var d = MB(b, c); + d && a.setTrustToken(d); + } catch (e) { + } + }, OB = function (a, b, c) { + var d, e = null == (d = window.goog_tt_state) ? void 0 : _.t(d, 'find').call(d, function (f) { + return f.issuerOrigin === a; + }); + e && (e.state = b, void 0 != c && (e.hasRedemptionRecord = c)); + }, PB = function () { + var a = EB.issuerOrigin + EB.redemptionPath, b = { + keepalive: !0, + trustToken: { + type: 'token-redemption', + issuer: EB.issuerOrigin, + refreshPolicy: 'none' + } + }; + OB(EB.issuerOrigin, 2); + return window.fetch(a, b).then(function (c) { + if (!c.ok) + throw Error(c.status + ': Network response was not ok!'); + OB(EB.issuerOrigin, 6, !0); + }).catch(function (c) { + c && 'NoModificationAllowedError' === c.name ? OB(EB.issuerOrigin, 6, !0) : OB(EB.issuerOrigin, 5); + }); + }, QB = function () { + var a = EB.issuerOrigin + EB.issuancePath; + OB(EB.issuerOrigin, 8); + return window.fetch(a, { + keepalive: !0, + trustToken: { type: 'token-request' } + }).then(function (b) { + if (!b.ok) + throw Error(b.status + ': Network response was not ok!'); + OB(EB.issuerOrigin, 10); + return PB(); + }).catch(function (b) { + if (b && 'NoModificationAllowedError' === b.name) + return OB(EB.issuerOrigin, 10), PB(); + OB(EB.issuerOrigin, 9); + }); + }, RB = function () { + OB(EB.issuerOrigin, 13); + return document.hasTrustToken(EB.issuerOrigin).then(function (a) { + return a ? PB() : QB(); + }); + }, SB = function () { + OB(FB.issuerOrigin, 13); + if (v.Promise) { + var a = document.hasTrustToken(FB.issuerOrigin).then(function (e) { + return e; + }).catch(function (e) { + return v.Promise.reject({ + state: 19, + error: e + }); + }), b = FB.issuerOrigin + FB.redemptionPath, c = { + keepalive: !0, + trustToken: { + type: 'token-redemption', + refreshPolicy: 'none' + } + }; + OB(FB.issuerOrigin, 16); + a = a.then(function (e) { + return window.fetch(b, c).then(function (f) { + if (!f.ok) + throw Error(f.status + ': Network response was not ok!'); + OB(FB.issuerOrigin, 18, !0); + }).catch(function (f) { + if (f && 'NoModificationAllowedError' === f.name) + OB(FB.issuerOrigin, 18, !0); + else { + if (e) + return v.Promise.reject({ + state: 17, + error: f + }); + OB(FB.issuerOrigin, 17); + } + }); + }).then(function () { + return document.hasTrustToken(FB.issuerOrigin).then(function (e) { + return e; + }).catch(function (e) { + return v.Promise.reject({ + state: 19, + error: e + }); + }); + }).then(function (e) { + var f = FB.issuerOrigin + FB.getStatePath; + OB(FB.issuerOrigin, 20); + return window.fetch(f + '?ht=' + e, { + trustToken: { + type: 'send-redemption-record', + issuers: [FB.issuerOrigin] + } + }).then(function (g) { + if (!g.ok) + throw Error(g.status + ': Network response was not ok!'); + OB(FB.issuerOrigin, 22); + return g.text().then(function (h) { + return JSON.parse(h); + }); + }).catch(function (g) { + return v.Promise.reject({ + state: 21, + error: g + }); + }); + }); + var d = Cc(window); + return a.then(function (e) { + var f = FB.issuerOrigin + FB.issuancePath; + return e && e.srqt && e.cs ? (OB(FB.issuerOrigin, 23), window.fetch(f + '?cs=' + e.cs + '&correlator=' + d, { + keepalive: !0, + trustToken: { type: 'token-request' } + }).then(function (g) { + if (!g.ok) + throw Error(g.status + ': Network response was not ok!'); + OB(FB.issuerOrigin, 25); + return e; + }).catch(function (g) { + return v.Promise.reject({ + state: 24, + error: g + }); + })) : e; + }).then(function (e) { + if (e && e.srdt && e.cs) + return OB(FB.issuerOrigin, 26), window.fetch(b + '?cs=' + e.cs + '&correlator=' + d, { + keepalive: !0, + trustToken: { + type: 'token-redemption', + refreshPolicy: 'refresh' + } + }).then(function (f) { + if (!f.ok) + throw Error(f.status + ': Network response was not ok!'); + OB(FB.issuerOrigin, 28, !0); + }).catch(function (f) { + return v.Promise.reject({ + state: 27, + error: f + }); + }); + }).then(function () { + OB(FB.issuerOrigin, 29); + }).catch(function (e) { + if (e instanceof Object && e.hasOwnProperty('state') && e.hasOwnProperty('error')) + if ('number' === typeof e.state && e.error instanceof Error) { + OB(FB.issuerOrigin, e.state); + var f = _.zc(au); + Math.random() <= f && Bc({ + state: e.state, + err: e.error.toString() + }, 'dtt_err'); + } else + throw Error(e); + else + throw e; + }); + } + }, TB = function (a) { + if (document.hasTrustToken && !_.H(Zt) && a.j) { + if (window.goog_tt_promise) + return window.goog_tt_promise; + a = window.goog_tt_state; + if (Array.isArray(a)) { + var b = []; + _.t(a, 'find').call(a, function (c) { + return c.issuerOrigin === EB.issuerOrigin; + }) && b.push(RB()); + _.t(a, 'find').call(a, function (c) { + return c.issuerOrigin === FB.issuerOrigin; + }) && b.push(SB()); + if (v.Promise && v.Promise.all) + return a = v.Promise.all(b), 'object' != typeof window.goog_tt_promise && Object.defineProperty(window, 'goog_tt_promise', { + configurable: !1, + value: a, + writable: !1 + }), a; + } + } + }; + var de = (0, F.Ma)(function (a) { + return !!a && 'function' === typeof a.openConsoleTab && 'function' === typeof a.attachOverlay; + }, 'HostModule'); + var ie = function (a) { + Q.call(this, a); + }; + _.O(ie, Q); + var UB = function (a) { + this.m = 0; + this.F = a || 100; + this.j = []; + }; + p = UB.prototype; + p.add = function (a) { + var b = this.j[this.m]; + this.j[this.m] = a; + this.m = (this.m + 1) % this.F; + return b; + }; + p.get = function (a) { + a = VB(this, a); + return this.j[a]; + }; + p.set = function (a, b) { + a = VB(this, a); + this.j[a] = b; + }; + p.isEmpty = function () { + return 0 == this.j.length; + }; + p.clear = function () { + this.m = this.j.length = 0; + }; + var je = function (a) { + for (var b = a.j.length, c = [], d = a.j.length - a.j.length; d < b; d++) + c.push(a.get(d)); + return c; + }, VB = function (a, b) { + if (b >= a.j.length) + throw Error('Out of bounds exception'); + return a.j.length < a.F ? b : (a.m + Number(b)) % a.F; + }; + var he = function () { + this.j = new UB(100); + }; + he.prototype.send = function (a) { + this.j instanceof MessagePort ? this.j.postMessage(a.X()) : this.j.add(a); + }; + var WB = P(['https://www.googletagservices.com/console/host/host.js']), XB = P(['https://www.googletagservices.com/console/panel/index.html']), YB = P(['https://www.googletagservices.com/console/overlay/index.html']), ZB = { + Id: A(WB), + If: A(XB), + Gf: A(YB) + }; + var ge = { + Kc: document.body, + cd: ZB + }; + var fh = function (a) { + Q.call(this, a, -1, $B); + }; + _.O(fh, Q); + var ch = function (a) { + return G(a, 1); + }, eh = function (a, b) { + return w(a, 1, b); + }, dh = function (a, b) { + return yf(a, 2, b); + }, $B = [2]; + var Ej = function (a) { + Q.call(this, a); + }; + _.O(Ej, Q); + var jl = function (a) { + Q.call(this, a); + }; + _.O(jl, Q); + jl.prototype.setTagForChildDirectedTreatment = function (a) { + return w(this, 5, a); + }; + jl.prototype.clearTagForChildDirectedTreatment = function () { + return w(this, 5, void 0, !1); + }; + jl.prototype.setTagForUnderAgeOfConsent = function (a) { + return w(this, 6, a); + }; + var bC = function (a) { + Q.call(this, a, -1, aC); + }; + _.O(bC, Q); + bC.prototype.getTaxonomy = function () { + return G(this, 1); + }; + var cC = function (a, b) { + return w(a, 1, b); + }; + bC.prototype.clearTaxonomy = function () { + return w(this, 1, void 0, !1); + }; + var dC = function (a, b) { + return yf(a, 2, b); + }, aC = [2]; + var eC = function (a) { + Q.call(this, a); + }; + _.O(eC, Q); + var gC = function (a) { + Q.call(this, a, -1, fC); + }; + _.O(gC, Q); + gC.prototype.Ba = function () { + return Wb(this, eC, 18); + }; + var il = function (a) { + return Wb(a, jl, 25); + }; + gC.prototype.getCorrelator = function () { + return G(this, 26); + }; + gC.prototype.setCorrelator = function (a) { + return w(this, 26, a); + }; + var hC = function (a, b) { + gh(a, 32, bC, b); + }, fC = [ + 2, + 3, + 14, + 32 + ]; + var Qf = function (a) { + Q.call(this, a); + }; + _.O(Qf, Q); + Qf.prototype.getWidth = function () { + return G(this, 1); + }; + var Uf = function (a, b) { + return w(a, 1, b); + }; + Qf.prototype.getHeight = function () { + return G(this, 2); + }; + var Tf = function (a, b) { + return w(a, 2, b); + }, oh = function () { + var a = new Qf(); + return w(a, 3, !0); + }; + var th = function (a) { + Q.call(this, a); + }; + _.O(th, Q); + var Sf = function (a) { + Q.call(this, a, -1, iC); + }; + _.O(Sf, Q); + var iC = [2]; + var kC = function (a) { + Q.call(this, a, -1, jC); + }; + _.O(kC, Q); + kC.prototype.getAdUnitPath = function () { + return G(this, 1); + }; + kC.prototype.getDomId = function () { + return G(this, 2); + }; + var lC = function (a, b) { + w(a, 2, b); + }; + kC.prototype.getClickUrl = function () { + return G(this, 7); + }; + kC.prototype.setClickUrl = function (a) { + return w(this, 7, a); + }; + var bh = function (a) { + return Ub(a, fh, 9); + }; + kC.prototype.Ba = function () { + return Wb(this, eC, 13); + }; + var Nf = function (a) { + return tk(a, 15, 0); + }, jC = [ + 3, + 4, + 5, + 6, + 8, + 9 + ]; + var Je = function (a) { + Q.call(this, a); + }; + _.O(Je, Q); + var Ie = function (a, b) { + return Ee(a, 1, mC, b); + }, Oe = function (a) { + var b = new Je(); + return Ee(b, 2, mC, a); + }, mC = [ + 1, + 2 + ]; + var re = function (a) { + Q.call(this, a); + }; + _.O(re, Q); + var Be = function (a) { + Q.call(this, a, -1, nC); + }; + _.O(Be, Q); + var Ce = function (a, b) { + wh(a, 1, b); + }, Fe = function (a) { + Q.call(this, a); + }; + _.O(Fe, Q); + var Ge = function (a) { + var b = G(a, 1); + null == b && (b = Ab([])); + b.constructor === Gb ? a = b : (b = new Gb(b, re), w(a, 1, b, !1), a = b); + return a; + }, He = function (a, b) { + zf(a, 3, b); + }, ue = [ + 1, + 2, + 3, + 4, + 7, + 5, + 6 + ], nC = [1]; + var pC = function (a) { + Q.call(this, a, -1, oC); + }; + _.O(pC, Q); + var qC = function (a, b) { + return Qb(a, 1, b, 0); + }, rC = function (a, b) { + return zf(a, 2, b); + }, sC = function (a, b) { + return wh(a, 3, b); + }, oC = [3]; + var tC = function (a) { + Q.call(this, a); + }; + _.O(tC, Q); + tC.prototype.getTimestamp = function () { + return sk(this, 1); + }; + var vC = function (a) { + var b = new tC(); + b = Qb(b, 1, Date.now(), 0); + return Ee(b, 2, uC, a); + }, uC = [ + 2, + 3 + ]; + var wC = function (a) { + Q.call(this, a); + }; + _.O(wC, Q); + var xC = function (a) { + var b = new wC(); + return zf(b, 1, a); + }; + var yC = function (a) { + Q.call(this, a); + }; + _.O(yC, Q); + var fe = new function (a, b, c) { + this.j = b; + this.m = c; + }(function (a) { + return Sl(wC, a); + }, function (a) { + return Sl(yC, a); + }, 4); + var le = new v.Map(); + var zC = {}, pe = (zC.companion_ads = 'companionAds', zC.content = 'content', zC.publisher_ads = 'pubads', zC), AC = function (a) { + return a + 'Correlator has been deprecated. Please see the Google Ad Manager help page on "Pageviews in GPT" for more information: https://support.google.com/admanager/answer/183281?hl=en'; + }, Yg = { + hf: 'rewardedSlotReady', + gf: 'rewardedSlotGranted', + df: 'rewardedSlotCanceled', + ef: 'rewardedSlotClosed', + ff: 'rewardedSlotCompleted', + jf: 'slotAdded', + mf: 'slotRequested', + nf: 'slotResponseReceived', + lf: 'slotRenderEnded', + kf: 'slotOnload', + pf: 'slotVisibilityChanged', + $e: 'impressionViewable' + }; + var BC = function () { + bv.apply(this, arguments); + }; + _.O(BC, bv); + BC.O = function () { + throw Error('Must be overridden'); + }; + var Re = function () { + BC.call(this, _.H(qf) || _.H(Ut) ? 1 : 0, _.r); + this.m = 0; + var a = _.H(qf) || _.H(Ut); + _.r.google_measure_js_timing = a || _.r.google_measure_js_timing; + }; + _.O(Re, BC); + Xm(Re); + var CC = function () { + }; + CC.O = function () { + throw Error('Must be overridden'); + }; + var mg = function () { + this.j = new v.Map(); + }; + _.O(mg, CC); + Xm(mg); + var DC, EC; + DC = {}; + _.bf = (DC[23] = 0.001, DC[38] = 0.001, DC[58] = 1, DC[150] = '', DC[211] = !1, DC[253] = !1, DC[172] = null, DC[246] = [], DC[226] = [], DC[252] = null, DC[258] = null, DC[251] = null, DC[259] = null, DC[6] = jr(window), DC[36] = ir(), DC[148] = Ev, DC[221] = ir(), DC[257] = ir(), DC[260] = void 0, DC[262] = ir(), DC); + EC = ne(); + _.t(Object, 'assign').call(Object, _.bf, EC._vars_); + EC._vars_ = _.bf; + var FC = function () { + }; + FC.O = function () { + throw Error('Must be overridden'); + }; + var Ke = function () { + this.m = {}; + this.j = new gC(); + this.F = new v.Map(); + this.j.setCorrelator(yr()); + _.bf[36] && w(this.j, 15, !0); + }; + _.O(Ke, FC); + var GC = function (a) { + var b = Ke.O(), c = a.getDomId(); + if (c && !b.m.hasOwnProperty(c)) { + var d = mg.O(), e = ++Re.O().m; + d.j.set(c, e); + w(a, 20, e); + b.m[c] = a; + } + }, Nh = function (a, b) { + var c; + return null !== (c = a.m[b]) && void 0 !== c ? c : null; + }; + Xm(Ke); + var HC = { + Kc: document.body, + cd: ZB + }, kf = function () { + var a = void 0 === a ? HC : a; + var b = void 0 === b ? document.URL : b; + this.F = a; + this.url = b; + this.m = !1; + }, jf; + kf.prototype.initialize = function () { + var a; + if (null !== $h(this.url, 'googtime') && !this.j) + try { + this.j = ke(function () { + }, this.F); + } catch (b) { + null === (a = null === console || void 0 === console ? void 0 : console.error) || void 0 === a ? void 0 : a.call(console, b); + } + }; + kf.prototype.sendMessage = function (a, b, c, d) { + a = sC(rC(qC(new pC(), a), De(b)), c.map(function (e) { + return De(e); + })); + d && w(a, 4, d); + d = vC(a); + d = xC(d); + (0, F.H)(this.j).send(d); + }; + var lf = function (a, b) { + var c = jf; + return function () { + var d = gc.apply(0, arguments), e; + if (c.j && !c.m) { + c.m = !0; + try { + c.sendMessage(a, this, d, Error().stack); + } catch (f) { + null === (e = null === console || void 0 === console ? void 0 : console.error) || void 0 === e ? void 0 : e.call(console, f); + } finally { + c.m = !1; + } + } + return b.apply(this, d); + }; + }; + var IC = tg(function () { + return !!kr(_.r.location.href); + }); + var Ye = '2022011002'; + var cf = function (a, b) { + b = void 0 === b ? 'https://pagead2.googlesyndication.com' : b; + var c = void 0 === c ? Cc(_.r) : c; + this.id = a; + this.Xb = b; + this.m = Math.random(); + if (null == d || 0 > d || 1 < d) + var d = _.bf[23]; + this.F = this.m < d; + this.j = { pvsid: String(c) }; + }, JC = function (a) { + var b; + a = Pe(a); + Df.set(a, (null !== (b = Df.get(a)) && void 0 !== b ? b : 0) + 1); + }, Cf = function () { + return [].concat(_.lc(_.t(Df, 'values').call(Df))).reduce(function (a, b) { + return a + b; + }, 0); + }, I = function (a, b, c) { + 'string' !== typeof c && (c = String(c)); + /^\w+$/.test(b) && (c ? a.j[b] = c : delete a.j[b]); + }, ff = function (a, b, c) { + b = void 0 === b ? null : b; + c = void 0 === c ? !1 : c; + b = void 0 === b ? null : b; + c = void 0 === c ? !1 : c; + if (IC()) + b = !0; + else { + var d = a.F; + b && 0 <= b && (d = (c ? a.m : Math.random()) < b); + b = d && !!a.id; + } + b && (a = KC(a) || '', _.Qr(window, a)); + }, KC = function (a) { + var b = a.Xb + '/pagead/gen_204?id=' + encodeURIComponent(a.id); + _.ef(a.j, function (c, d) { + c && (b += '&' + d + '=' + encodeURIComponent(c)); + }); + return b; + }, LC = function (a, b) { + b = b.map(function (c) { + return c.replace(/,/g, '\\,'); + }); + 3 >= b.length ? I(a, 'nw_id', b.join()) : (b = b.slice(0, 3), b.push('__extra__'), I(a, 'nw_id', b.join())); + }, df = function (a, b) { + I(a, 'vrg', We()); + b ? (LC(a, b), I(a, 'nslots', b.length.toString())) : (LC(a, [].concat(_.lc(_.t(Df, 'keys').call(Df)))), I(a, 'nslots', Cf().toString())); + b = Dc().m(); + b.length && I(a, 'eid', b.join()); + I(a, 'pub_url', document.URL); + }, of = function (a, b, c) { + c = void 0 === c ? { + Xb: 'https://pagead2.googlesyndication.com', + pa: _.bf[23] + } : c; + var d = c.Xb || 'https://pagead2.googlesyndication.com'; + c = c.pa; + if (void 0 === c || 0 > c || 1 < c) + c = _.bf[23]; + Math.random() < c && (a = new cf(a, d), b(a), ff(a, 1, !0)); + }, Df = new v.Map(); + var af, hf; + af = _.bf[38]; + hf = tg(function () { + var a = _.zc(Js); + a = new pm(a); + var b = _.zc(Ks); + return { + sb: a, + qe: 0 < b ? Hd() < 1 / b : !1, + zd: b + }; + }); + _.MC = function () { + }; + var NC = function () { + this.id = 'goog_' + Iq++; + }, OC = function () { + _.gu.apply(this, arguments); + this.l = new v.Map(); + }; + _.O(OC, _.gu); + OC.prototype.F = function () { + _.gu.prototype.F.call(this); + this.l.clear(); + }; + var QC = function (a, b, c) { + var d, e; + if (a.m) + return function () { + }; + var f = 'string' === typeof b ? b : b.id, g = null !== (e = null === (d = a.l.get(f)) || void 0 === d ? void 0 : d.add(c)) && void 0 !== e ? e : new v.Set([c]); + a.l.set(f, g); + return function () { + return void PC(a, b, c); + }; + }, si = function (a, b, c) { + c = void 0 === c ? function () { + return !0; + } : c; + return new v.Promise(function (d) { + var e = QC(a, b, function (f) { + c(f) && (e(), d(f)); + }); + }); + }, PC = function (a, b, c) { + var d; + return !(null === (d = a.l.get('string' === typeof b ? b : b.id)) || void 0 === d || !d.delete(c)); + }; + OC.prototype.dispatchEvent = function (a, b, c) { + var d = this, e, f, g, h, k, l, m; + return ib(function (n) { + 1 == n.j && (f = 'string' === typeof a ? a : a.id, g = document.createEvent('CustomEvent'), g.initCustomEvent(f, !0, !0, c), h = null !== (e = d.l.get(f)) && void 0 !== e ? e : new v.Set(), k = {}, l = _.y(h), m = l.next()); + if (5 != n.j) { + if (m.done) { + n.j = 0; + return; + } + k.ub = m.value; + return jb(n, 0, 5); + } + _.uf(b, function (q) { + return function () { + d.l.has(f) && h.has(q.ub) && q.ub(g); + }; + }(k), !0); + k = { ub: k.ub }; + m = l.next(); + n.j = 2; + }); + }; + var RC = new NC(), SC = new NC(), TC = new NC(), UC = new NC(), VC = new NC(), WC = new NC(), XC = new NC(), ti = new NC(), YC = new NC(); + var Y = function () { + pv.apply(this, arguments); + }; + _.O(Y, pv); + Y.prototype.R = function (a) { + var b, c; + rf(this.id, a); + null === (c = null === (b = window.console) || void 0 === b ? void 0 : b.error) || void 0 === c ? void 0 : c.call(b, a); + }; + var ZC = function (a, b, c, d, e) { + var f = null, g = _.mf(b, e); + _.fb(c, d, g) && (f = function () { + return _.Lc(c, d, g); + }, _.zl(a, f)); + return f; + }; + var $C = function (a) { + Y.call(this, 937, _.zc(jt)); + this.o = U(this); + this.l = U(this); + this.B = U(this); + this.G = rv(this, a); + }; + _.O($C, Y); + $C.prototype.j = function () { + var a, b, c = this.G.value; + if (_.H(us) && c) { + for (var d = {}, e = new v.Set(), f = _.y(Ub(c, zp, 1)), g = f.next(); !g.done; g = f.next()) { + g = g.value; + d[[ + lk(g, 2), + lk(g, 1) + ].filter(function (k) { + return !!k; + }).join()] = { Wd: So(g, 3) }; + g = _.y(Oh(g, 4)); + for (var h = g.next(); !h.done; h = g.next()) + e.add(h.value); + } + this.o.fa(d); + this.l.fa([].concat(_.lc(e))); + c = null === (b = null === (a = Wb(c, Ap, 2)) || void 0 === a ? void 0 : Wb(a, rp, 1)) || void 0 === b ? void 0 : Ub(b, tp, 1); + this.B.fa((null === c || void 0 === c ? 0 : c.length) ? c : null); + } else + jv(this.o), jv(this.l), jv(this.B); + }; + $C.prototype.M = function (a) { + this.A(a); + }; + $C.prototype.A = function () { + jv(this.o); + jv(this.l); + jv(this.B); + }; + var Ph = new v.Map(), aD = new v.Map(), bD = function () { + }, Qg = function (a, b) { + var c = aD.get(a); + c || (b = c = b(), Ph.set(b, a), aD.set(a, b)); + return c; + }; + var cD = function (a) { + this.push = K(932, function (b) { + a.push(b); + }); + }; + _.O(cD, bD); + var dD = function (a, b) { + this.pbjs = a; + this.j = b; + }; + dD.prototype.push = function (a) { + var b, c, d, e, f, g, h, k, l, m, n = a.context, q = a.nextFunction; + a = a.requestBidsConfig; + var u = null !== (d = null !== (b = null === a || void 0 === a ? void 0 : a.adUnits) && void 0 !== b ? b : null === (c = this.pbjs) || void 0 === c ? void 0 : c.adUnits) && void 0 !== d ? d : [], B = {}; + u = _.y(u); + for (var x = u.next(); !x.done; B = { gb: B.gb }, x = u.next()) { + var z = x.value; + if ((x = z.code) && (null !== (e = z.bids) && void 0 !== e ? e : []).length && (B.gb = null !== (k = null !== (g = null === (f = this.j) || void 0 === f ? void 0 : f[x]) && void 0 !== g ? g : null === (h = this.j) || void 0 === h ? void 0 : h[ag(x)]) && void 0 !== k ? k : _.zc(qs), B.gb && !(0 > B.gb))) { + x = {}; + z = _.y(null !== (l = z.bids) && void 0 !== l ? l : []); + for (var C = z.next(); !C.done; x = { Vb: x.Vb }, C = z.next()) + C = C.value, x.Vb = null !== (m = C.getFloor) && void 0 !== m ? m : function () { + return { + currency: 'USD', + floor: 0 + }; + }, C.getFloor = function (D, J) { + return function () { + var T = D.Vb.apply(n, gc.apply(0, arguments)); + return 'USD' !== T.currency ? T : { + currency: 'USD', + floor: Math.max((null === T || void 0 === T ? void 0 : T.floor) || 0, J.gb) + }; + }; + }(x, B); + } + } + null === q || void 0 === q ? void 0 : q.apply(n, [a]); + }; + var eD = function (a) { + Y.call(this, 931); + this.I = window; + this.l = W(this, a); + }; + _.O(eD, Y); + eD.prototype.j = function () { + var a, b, c, d, e, f, g; + if (_.zc(qs) || this.l.value) { + null !== (a = (f = this.I).pbjs) && void 0 !== a ? a : f.pbjs = {}; + null !== (b = (g = this.I.pbjs).que) && void 0 !== b ? b : g.que = []; + var h = null !== (c = ne().pbjs_hooks) && void 0 !== c ? c : [], k = {}; + if (null === (d = this.l.value) || void 0 === d ? 0 : d.length) + for (var l = _.y(this.l.value), m = l.next(); !m.done; m = l.next()) { + m = m.value; + var n = Ub(m, up, 1); + n = 1 === tk(n[0], 1, 0) ? Vo(n[0]) : Wo(n[0]); + m = sk(m, 2) / 1000000; + k[n] = Math.min(null !== (e = k[n]) && void 0 !== e ? e : Number.MAX_VALUE, m); + } + var q = new dD(this.I.pbjs, k); + h = _.y(h); + for (k = h.next(); !k.done; k = h.next()) + q.push(k.value); + h = !!ne().pbjs_hooks; + ne().pbjs_hooks = Qg(q, function () { + return new cD(q); + }); + h || fD(this); + } + }; + var fD = function (a) { + var b, c, d = (0, F.H)(null === (c = null === (b = a.I) || void 0 === b ? void 0 : b.pbjs) || void 0 === c ? void 0 : c.que), e = function () { + var f, g; + null === (g = null === (f = a.I.pbjs) || void 0 === f ? void 0 : f.requestBids) || void 0 === g ? void 0 : g.before.call(a.I, function (h, k) { + return ne().pbjs_hooks.push({ + context: a.I, + nextFunction: h, + requestBidsConfig: k + }); + }, 0); + }; + d.hasOwnProperty('push') ? d.push(e) : d.unshift(e); + }; + var gD = function (a) { + Y.call(this, 892, _.zc(lt)); + this.o = U(this); + this.G = U(this); + this.B = U(this); + this.l = U(this); + this.J = rv(this, a); + }; + _.O(gD, Y); + gD.prototype.j = function () { + var a = this.J.value; + if (!a) + throw Error('config timeout'); + this.o.fa(Wb(a, Cp, 3)); + this.B.fa(Wb(a, wp, 1)); + this.G.fa(Wb(a, Ep, 2)); + this.l.fa(Oh(a, 4)); + }; + gD.prototype.M = function (a) { + this.A(a); + }; + gD.prototype.A = function (a) { + kv(this.o, a); + kv(this.G, a); + kv(this.B, a); + jv(this.l); + }; + var hD = [ + { + name: 'Interstitial', + cc: 1 + }, + { + name: 'TopAnchor', + cc: 2 + }, + { + name: 'BottomAnchor', + cc: 3 + } + ], iD = function (a) { + Y.call(this, 789); + this.l = a; + this.C = U(this); + }; + _.O(iD, Y); + iD.prototype.j = function () { + var a = this; + this.C.j(hD.filter(function (b) { + return new RegExp('gam' + b.name + 'Demo', 'i').test(a.l); + }).map(function (b) { + var c = b.name; + b = b.cc; + var d, e; + null === (e = null === (d = window.console) || void 0 === d ? void 0 : d.warn) || void 0 === e ? void 0 : e.call(d, 'GPT - Demo ' + c + ' ENABLED'); + var f = new eq(); + b = w(f, 3, b); + return w(b, 2, '/22639388115/example/' + c.toLowerCase()); + })); + }; + var jD = function (a, b, c) { + Y.call(this, 906, _.zc(kt)); + this.I = a; + this.l = qv(this); + this.B = rv(this, b); + this.o = si(c, WC).then(function (d) { + return Pe((0, F.H)(d.detail.P.getAdUnitPath())); + }); + this.I !== this.I.top && this.l.notify(); + }; + _.O(jD, Y); + jD.prototype.j = function () { + var a = this, b; + return ib(function (c) { + if (a.I !== a.I.top) + return c.return(); + if (b = a.B.value) + return jb(c, kD(a, b), 0); + a.l.notify(); + c.j = 0; + }); + }; + var kD = function (a, b) { + var c, d; + return ib(function (e) { + c = Ub(b, Fp, 1); + if (!c.length) + return a.l.notify(), e.return(); + d = c[0]; + return (L = [ + 2, + 3 + ], _.t(L, 'includes')).call(L, tk(d, 3, 0)) ? (lD(a, lk(d, 1)), e.return()) : jb(e, _.uf(917, function () { + return mD(a, b); + }), 0); + }); + }, mD = function (a, b) { + var c, d; + return ib(function (e) { + if (1 == e.j) + return jb(e, a.o, 2); + c = e.m; + (d = Ub(b, Fp, 1).some(function (f) { + return lk(f, 1) === c; + })) ? lD(a, c) : (of('pp_iris_failure', function (f) { + I(f, 'fnc', c); + df(f); + }, { pa: _.zc(nt) }), a.l.notify()); + Lm(e); + }); + }, lD = function (a, b) { + var c = pu(a.I, b, function (d) { + if (!d) { + d = Nq(c.j); + for (var e = _.y(document.getElementsByName('googlefcPresent')), f = e.next(); !f.done; f = e.next()) + d.gd(f.value); + } + a.l.notify(); + }); + c.start(); + }; + jD.prototype.M = function (a) { + this.A(a); + }; + jD.prototype.A = function () { + this.l.notify(); + }; + var nD = function (a, b) { + Y.call(this, 901); + this.l = W(this, a); + this.o = si(b, WC).then(function (c) { + return (0, F.H)(c.detail.P.getAdUnitPath()); + }); + }; + _.O(nD, Y); + nD.prototype.j = function () { + var a = this, b, c, d, e, f; + return ib(function (g) { + if (1 == g.j) + return (c = a.l.value) ? jb(g, a.o, 2) : g.return(); + d = g.m; + e = Pe(d); + f = null === (b = Ub(c, xp, 4)) || void 0 === b ? void 0 : b.some(function (h) { + return lk(h, 2) === e; + }); + of('pp_fsm', function (h) { + I(h, 'fsnc', e); + I(h, 'aup', d); + I(h, 'tld', lk(c, 1)); + I(h, 'pdu', lk(c, 2)); + I(h, 'idu', lk(c, 3)); + I(h, 'pnc', lk(c, 5)); + I(h, 'dm', f); + df(h); + }, { pa: _.zc(mt) }); + Lm(g); + }); + }; + var oD = function () { + Y.call(this, 891); + this.l = U(this); + }; + _.O(oD, Y); + oD.prototype.j = function () { + var a = this, b, c; + return ib(function (d) { + if (1 == d.j) + return jb(d, new v.Promise(function (e, f) { + var g; + null === (g = _.bf[260]) || void 0 === g ? void 0 : g(function (h, k) { + k ? f(k) : e(h); + }); + }), 2); + b = d.m; + try { + 'string' === typeof b && (c = JSON.parse(b || '[]')); + } catch (e) { + } + if (c && Array.isArray(c)) + a.l.j(new Hp(c)); + else + throw Error('malformed response'); + Lm(d); + }); + }; + var pD = new v.Map([ + [ + 1, + 5 + ], + [ + 2, + 2 + ], + [ + 3, + 3 + ] + ]), ik = function (a, b, c, d) { + d = void 0 === d ? document : d; + Y.call(this, 912); + this.googletag = b; + this.U = c; + this.W = d; + this.l = V(this, a); + }; + _.O(ik, Y); + ik.prototype.j = function () { + for (var a = this, b = {}, c = _.y(this.l.value), d = c.next(); !d.done; b = { Xa: b.Xa }, d = c.next()) + d = d.value, pD.has(tk(d, 3, 0)) && d.getAdUnitPath() && (b.Xa = this.googletag.defineOutOfPageSlot((0, F.H)(d.getAdUnitPath()), (0, F.H)(pD.get(tk(d, 3, 0)))), b.Xa && (b.Xa.addService(this.googletag.pubads()), Ar(this.W, function (e) { + return function () { + var f; + a.googletag.display(e.Xa); + E(null !== (f = a.U) && void 0 !== f ? f : Ke.O().j, 4) && a.googletag.pubads().refresh([e.Xa]); + }; + }(b)))); + }; + var Ig = function () { + this.o = new oD(); + this.j = new gD(this.o.l); + this.D = this.j.l; + this.m = new $C(this.j.o); + this.l = null; + this.A = this.m.o; + this.F = this.m.l; + _.bf[260] || (jv(this.D), jv(this.A), jv(this.F)); + }, qD = function (a) { + var b = _.Hg(Ig), c, d = new Qc(); + N(d, b.o); + N(d, b.j); + N(d, b.m); + N(d, new eD(b.m.B)); + var e = new jD(window, b.j.G, a); + b.l = e.l.promise; + N(d, e); + N(d, new nD(b.j.B, a)); + a = new iD(null !== (c = window.location.hash) && void 0 !== c ? c : ''); + N(d, a); + N(d, new ik(a.C, ne(), null)); + Sc(d); + }; + var rD = tg(function () { + for (var a = '', b = _.y(pg()), c = b.next(); !c.done; c = b.next()) + c = c.value, 15 >= c && (a += '0'), a += c.toString(16); + return a; + }); + var sD = 0, tD = function () { + }, zD, DD, ek, ml, ED, yD, xD, wD, FD; + tD.O = function () { + throw Error('Must be overridden'); + }; + var uD = function () { + this.m = new v.Map(); + this.o = 0; + this.B = Cc(_.r); + this.A = this.nb = null; + this.D = 0; + this.l = _.Vn(function () { + return void Gg('gpt-first-ad-request'); + }); + this.j = new v.Map(); + this.F = new v.Map(); + }; + _.O(uD, tD); + zD = function (a, b) { + a.j.get(b) || (a.j.set(b, { + Va: !0, + vc: '', + Ya: '', + Wc: 0, + Pc: 0, + tc: [], + uc: [], + Ta: !1 + }), _.zl(b, function () { + vD(a, b); + a.j.delete(b); + wD(a, b); + }), QC(b, SC, function (c) { + c = c.detail; + var d = (0, F.H)(a.j.get(b)); + d.vc = G(c, 33) || ''; + d.Ta = !0; + xD(a, b, function () { + d.vc = ''; + }); + yD(a, b, function () { + d.Ta = !1; + }); + })); + }; + _.AD = function (a, b) { + var c, d; + return null !== (d = null === (c = a.j.get(b)) || void 0 === c ? void 0 : c.Va) && void 0 !== d ? d : !1; + }; + _.BD = function (a, b) { + a.j.get(b) && (a.j.get(b).Va = !1); + }; + _.CD = function (a, b) { + a.j.get(b) && (a.j.get(b).Va = !0); + }; + DD = function (a, b) { + if (!b.length) + return []; + var c = Pe(b[0].getAdUnitPath()); + (0, F.jb)(b.every(function (g) { + return Pe(g.getAdUnitPath()) === c; + })); + var d = []; + a = _.y(a.j); + for (var e = a.next(); !e.done; e = a.next()) { + var f = _.y(e.value); + e = f.next().value; + (f = f.next().value.vc) && Pe(e.getAdUnitPath()) === c && !_.t(b, 'includes').call(b, e) && d.push(f); + } + return d; + }; + ek = function (a, b) { + var c, d; + return null !== (d = null === (c = a.j.get(b)) || void 0 === c ? void 0 : c.Ya) && void 0 !== d ? d : ''; + }; + ml = function (a, b) { + return (a = a.j.get(b)) && a.Wc - 1 || 0; + }; + ED = function (a, b, c) { + (0, F.jb)(!a.m.has(b)); + a.m.set(b, c); + }; + yD = function (a, b, c) { + (a = a.j.get(b)) && a.tc.push(c); + }; + xD = function (a, b, c) { + (a = a.j.get(b)) && a.uc.push(c); + }; + wD = function (a, b) { + if (a = a.j.get(b)) + for (b = a.uc.slice(), a.uc.length = 0, a = _.y(b), b = a.next(); !b.done; b = a.next()) + b = b.value, b(); + }; + FD = function (a, b) { + if (a = a.j.get(b)) + for (b = a.tc.slice(), a.tc.length = 0, a = _.y(b), b = a.next(); !b.done; b = a.next()) + b = b.value, b(); + }; + uD.prototype.Ta = function (a) { + var b, c; + return null !== (c = null === (b = this.j.get(a)) || void 0 === b ? void 0 : b.Ta) && void 0 !== c ? c : !1; + }; + var vD = function (a, b) { + var c; + if (a = a.j.get(b)) + null === (c = a.xc) || void 0 === c ? void 0 : c.ua(), delete a.xc; + }, GD = function (a, b) { + var c = a.F.get(b); + c || (c = window === window.top ? (++sD).toString(36) : Hq(), a.F.set(b, c), _.zl(b, function () { + a.F.delete(b); + })); + return c; + }, ID = function (a, b, c) { + (0, F.H)(a.j.get(b)).Ec = c; + yD(a, b, function () { + return void HD(a, b); + }); + }, HD = function (a, b) { + var c; + null === (c = a.j.get(b)) || void 0 === c ? !0 : delete c.Ec; + }; + Xm(uD); + var JD = function () { + var a = {}; + return a.adsense_channel_ids = 'channel', a.adsense_ad_types = 'ad_type', a.adsense_ad_format = 'format', a.adsense_background_color = 'color_bg', a.adsense_border_color = 'color_border', a.adsense_link_color = 'color_link', a.adsense_text_color = 'color_text', a.adsense_url_color = 'color_url', a.page_url = 'url', a.adsense_allow_expandable_ads = 'ea', a.adsense_encoding = 'oe', a.adsense_family_safe = 'adsafe', a.adsense_flash_version = 'flash', a.adsense_font_face = 'f', a.adsense_hints = 'hints', a.adsense_keyword_type = 'kw_type', a.adsense_keywords = 'kw', a.adsense_test_mode = 'adtest', a.alternate_ad_iframe_color = 'alt_color', a.alternate_ad_url = 'alternate_ad_url', a.demographic_age = 'cust_age', a.demographic_gender = 'cust_gender', a.document_language = 'hl', a; + }; + var fk = function (a, b, c, d, e, f, g, h, k) { + Y.call(this, 718); + this.G = W(this, b); + this.J = W(this, c); + this.B = W(this, d); + this.l = W(this, e); + sv(this, f); + this.N = V(this, g); + this.o = V(this, h); + this.V = V(this, k); + this.Y = si(a, YC); + }; + _.O(fk, Y); + fk.prototype.j = function () { + var a = this, b, c, d; + return ib(function (e) { + if (1 == e.j) { + if (!KD(a)) + return e.return(); + b = a.N.value; + c = a.o.value; + _.Tr(c, 'visibility', 'hidden'); + _.Tr(c, 'min-width', '100%'); + _.Tr(b, 'min-width', '100%'); + return jb(e, a.Y, 2); + } + if (a.m) + return e.return(); + d = b.contentDocument; + if (!d) + return of('gpt_amp_fluid_no_iframedoc', function (f) { + df(f); + }), e.return(); + LD(a, b, c, (0, F.H)(d.body).offsetWidth, d.body.offsetHeight); + Lm(e); + }); + }; + var KD = function (a) { + var b = !a.V.value; + return null == a.l.value || a.B.value || 'height' !== a.J.value || b ? !1 : !0; + }, LD = function (a, b, c, d, e) { + b.setAttribute('height', String(e)); + b.setAttribute('width', String(d)); + _.Tr(c, 'visibility', 'visible'); + MD(a, e, d); + }, MD = function (a, b, c) { + var d = a.G.value; + of('gpt_fluid_sz', function (e) { + I(e, 'sz', c + 'x' + b); + I(e, 'qqid', d || ''); + df(e); + I(e, 'ff', 1); + }); + }; + var ak = function (a, b, c, d, e) { + Y.call(this, 685); + var f = this; + this.slotId = a; + this.I = b; + this.l = W(this, c); + this.o = V(this, d); + this.B = V(this, e); + si(this.slotId, ti, function (g) { + return Or(f.I, g.detail); + }); + }; + _.O(ak, Y); + ak.prototype.j = function () { + var a, b; + if (!_.H(ft) && !this.B.value) { + var c = null !== (b = null === (a = this.l.value) || void 0 === a ? void 0 : G(a, 1)) && void 0 !== b ? b : '', d = Pr(this.I, this.o.value, c); + _.zl(this, function () { + try { + d(); + } catch (e) { + rf(493, e); + } + }); + } + }; + var ND = /(]*)?>)/i, Bj = function (a, b, c, d, e) { + Y.call(this, 665); + this.ja = U(this); + this.l = V(this, a); + this.o = W(this, b); + this.B = W(this, c); + this.G = W(this, d); + this.J = W(this, e); + }; + _.O(Bj, Y); + Bj.prototype.j = function () { + if (0 !== this.l.value.kind || !Lg(this.o.value) || mv(this.B)) + this.ja.j(this.l.value); + else { + var a = this.l.value.wa || '', b = !!this.G.value, c = !!this.J.value; + c || Da() || (a = a.replace(ND, '$1')); + b && !c && (a = a.replace(ND, '$1')); + this.ja.j({ + kind: 0, + wa: a + }); + } + }; + var Rg = function (a) { + this.push = K(76, a.push.bind(a)); + }; + _.O(Rg, bD); + me(Rg, 2); + var OD = [ + 'Debug', + 'Info', + 'Warning', + 'Error', + 'Fatal' + ], PD = function (a, b, c) { + this.j = a; + this.message = b; + this.m = c; + this.timestamp = new Date(); + }; + p = PD.prototype; + p.getSlot = function () { + return this.m; + }; + p.getLevel = function () { + return this.j; + }; + p.getTimestamp = function () { + return this.timestamp; + }; + p.getMessage = function () { + return this.message; + }; + p.toString = function () { + return this.timestamp.toTimeString() + ': ' + OD[this.j] + ': ' + this.message; + }; + var QD = { + 20: function (a) { + return 'Ignoring a call to setCollapseEmptyDiv(false, true). Slots that start out collapsed should also collapse when empty. Slot: ' + a[0] + '.'; + }, + 23: function (a) { + return 'Error in googletag.display: could not find div with id "' + a[1] + '" in DOM for slot: ' + a[0] + '.'; + }, + 34: function (a) { + return 'Size mapping is null because invalid mappings were added: ' + a[0] + '.'; + }, + 60: function (a) { + return 'Ignoring the ' + a[0] + '(' + (a[1] || '') + ') call since the service is already enabled.'; + }, + 66: function (a) { + return 'Slot ' + a[0] + ' cannot be refreshed until PubAdsService is enabled.'; + }, + 68: function () { + return 'Slots cannot be cleared until service is enabled.'; + }, + 80: function (a) { + return 'Slot object at position ' + a[0] + ' is of incorrect type.'; + }, + 84: function (a) { + return 'Cannot find targeting attribute "' + a[0] + '" for "' + a[1] + '".'; + }, + 93: function (a) { + return 'Failed to register listener. Unknown event type: ' + a[0] + '.'; + }, + 96: function (a) { + return 'Invalid arguments: ' + a[0] + '(' + a[1] + ').'; + }, + 122: function (a) { + return 'Invalid argument: ' + a[0] + '(' + a[1] + '). Valid values: ' + a[2] + '.'; + }, + 121: function (a) { + return 'Invalid object passed to ' + a[0] + '(' + a[1] + '), for ' + a[2] + ': ' + a[3] + '.'; + }, + 105: function (a) { + return 'SRA requests may include a maximum of 30 ad slots. ' + a[1] + ' were requested, so the last ' + a[2] + ' were ignored.'; + }, + 106: function (a) { + return 'Publisher betas ' + a[0] + ' were declared after enableServices() was called.'; + }, + 107: function (a) { + return 'Publisher betas may only be declared once. ' + a[0] + ' were added after betas had already been declared.'; + }, + 108: function (a) { + return 'Beta keys cannot be cleared. clearTargeting() was called on ' + a[0] + '.'; + }, + 123: function (a) { + return 'Refresh was throttled for slot: ' + a[0] + '.'; + }, + 113: function (a) { + return a[0] + ' ad slot ineligible as page is not mobile optimized: ' + a[1] + '.'; + }, + 116: function (a) { + return 'The unique SafeFrame domain setting in Google Ad Manager conflicts with the "useUniqueDomain" setting passed to the setSafeFrameConfig API method. GPT will use useUniqueDomain=' + a[0] + ' based on the API call.'; + }, + 114: function () { + return 'setCorrelator has been deprecated. See the Google Ad Manager help page on "Creative selection for multiple ad slots" for more information: https://support.google.com/admanager/answer/183281.'; + }, + 115: function () { + return 'updateCorrelator has been deprecated. See the Google Ad Manager help page on "Creative selection for multiple ad slots" for more information: https://support.google.com/admanager/answer/183281.'; + }, + 120: function () { + return 'Checking googletag.pubadsReady is discouraged. Please use googletag.cmd.push instead.'; + }, + 124: function (a) { + return 'To reserve space and reduce layout shifts, consider setting min-width=' + a[2] + 'px, min-height=' + a[3] + 'px styles on the div element with id=' + a[1] + '. Learn more: https://developers.google.com/publisher-tag/guides/minimize-layout-shift'; + }, + 128: function () { + return 'ContentService is deprecated. The setContent() method will have no effect after January 18, 2022. The content() method will be removed from googletag after July 19, 2022. Use the browser\'s built-in DOM APIs to directly add content to div elements instead.'; + }, + 132: function (a) { + return 'Taxonomy with id ' + a[0] + ' has reached the limit of ' + a[1] + ' values.'; + }, + 133: function () { + return 'No taxonomy values were cleared, either due to an invalid taxonomy or no values present.'; + } + }, RD = { + 26: function (a) { + return 'Div ID passed to googletag.display() does not match any defined slots: ' + a[0] + '.'; + }, + 28: function (a) { + return 'Error in googletag.defineSlot: Cannot create slot ' + a[1] + '. Div element "' + a[0] + '" is already associated with another slot: ' + a[2] + '.'; + }, + 92: function (a) { + return 'Exception in ' + a[1] + ' event listener: "' + a[0] + '".'; + }, + 30: function (a) { + return 'Exception in googletag.cmd function: ' + a[0] + '.'; + }, + 125: function (a) { + return 'google-product-ad element is invalid: ' + a[0] + '.'; + }, + 126: function () { + return 'Attempted to collect prebid data but window.pbjs is undefined.'; + }, + 127: function (a) { + return 'Encountered the following error while attempting to collect prebid metadata: ' + a[0] + '.'; + } + }; + var SD = function () { + this.events = new UB(1000); + this.j = this.m = 0; + this.F = window; + }, TD = function (a, b) { + return je(a.events).filter(function (c) { + return c.getSlot() === b; + }); + }, UD = function (a, b) { + return je(a.events).filter(function (c) { + return c.getLevel() >= b; + }); + }; + SD.prototype.log = function (a, b, c, d) { + var e = this; + c = void 0 === c ? null : c; + d = void 0 === d ? !1 : d; + var f; + c = new PD(a, b, null !== (f = null === c || void 0 === c ? void 0 : c.j) && void 0 !== f ? f : null); + this.events.add(c); + var g = _.H(Ns) && this.F === top, h = _.zc(Os) && 100 > this.m, k = 2 === a || 3 === a, l = this.j < _.zc(Ps) && k && _.r.console, m = b.getMessageArgs(), n = b.getMessageId(), q = QD[n] || RD[n]; + h && k && (b = _.zc(Os), of('gpt_eventlog_messages', function (u) { + var B; + ++e.m; + df(u); + I(u, 'level', a); + I(u, 'messageId', n); + I(u, 'args', m.join('|')); + q || I(u, 'noMsg', !0); + var x = Error(); + I(u, 'stack', Ze(null !== (B = x.stack) && void 0 !== B ? B : '', x.message)); + }, { pa: b })); + if (q) { + b = '[GPT] ' + q(m); + if (d) + throw new vh(b); + g && l && (function (u) { + var B, x, z, C; + return void (2 === a ? null === (x = (B = _.r.console).warn) || void 0 === x ? void 0 : x.call(B, u) : null === (C = (z = _.r.console).error) || void 0 === C ? void 0 : C.call(z, u)); + }(b), this.j++); + } + return c; + }; + SD.prototype.info = function (a, b) { + return this.log(1, a, void 0 === b ? null : b); + }; + var M = function (a, b, c) { + a.log(2, b, c); + }; + SD.prototype.error = function (a, b, c) { + return this.log(3, a, b, void 0 === c ? !1 : c); + }; + var Lh = function () { + return _.Hg(SD); + }; + var Tg = function (a, b) { + b = void 0 === b ? [] : b; + this.messageId = a; + this.args = b; + }; + Tg.prototype.getMessageId = function () { + return this.messageId; + }; + Tg.prototype.getMessageArgs = function () { + return this.args; + }; + var VD = Ug(2), WD = Ug(3), XD = Ug(4), YD = Ug(5), ZD = Ug(6), $D = Ug(12), aE = Ug(14), bE = Ug(16), cE = Ug(19), dE = Ug(20), Qh = Ug(23), Rh = Ug(26), eE = Ug(28), fE = Ug(30), gE = Ug(31), hE = Ug(34), iE = Ug(35), jE = Ug(36), kE = Ug(38), lE = Ug(40), mE = Ug(48), nE = Ug(50), oE = Ug(60), pE = Ug(63), qE = Ug(64), rE = Ug(66), sE = Ug(68), tE = Ug(69), uE = Ug(70), vE = Ug(71), wE = Ug(78), xE = Ug(80), yE = Ug(82), zE = Ug(84), AE = Ug(85), BE = Ug(87), hh = Ug(88), CE = Ug(92), DE = Ug(93), EE = Ug(99), FE = Ug(103), GE = Ug(104), HE = Ug(105), IE = Ug(106), JE = Ug(107), KE = Ug(108), LE = Ug(113), ME = Ug(114), NE = Ug(115), OE = Ug(116), PE = Ug(117), QE = Ug(118), RE = Ug(119), Cl = Ug(120), SE = Ug(121), TE = Ug(122), UE = Ug(123), Xl = Ug(125), VE = Ug(126), WE = Ug(127), XE = Ug(128), YE = Ug(129), ZE = Ug(130), $E = Ug(131), aF = Ug(132), bF = Ug(133); + var cF = function (a, b) { + this.serviceName = b; + this.slot = a.j; + }, dF = function (a, b) { + cF.call(this, a, b); + this.isEmpty = !1; + this.slotContentChanged = !0; + this.sourceAgnosticLineItemId = this.sourceAgnosticCreativeId = this.lineItemId = this.labelIds = this.creativeTemplateId = this.creativeId = this.campaignId = this.advertiserId = this.size = null; + this.isBackfill = !1; + this.companyIds = this.yieldGroupIds = null; + }; + _.O(dF, cF); + var eF = function () { + cF.apply(this, arguments); + }; + _.O(eF, cF); + var fF = function (a, b, c) { + cF.call(this, a, b); + this.inViewPercentage = c; + }; + _.O(fF, cF); + var gF = function () { + cF.apply(this, arguments); + }; + _.O(gF, cF); + var hF = function () { + cF.apply(this, arguments); + }; + _.O(hF, cF); + var iF = function (a, b, c, d) { + cF.call(this, a, b); + this.payload = d; + this.makeRewardedVisible = c; + }; + _.O(iF, cF); + var jF = function (a, b, c) { + cF.call(this, a, b); + this.payload = this.payload = c; + }; + _.O(jF, cF); + var kF = function () { + cF.apply(this, arguments); + }; + _.O(kF, cF); + var lF = function () { + cF.apply(this, arguments); + }; + _.O(lF, cF); + var mF = function () { + cF.apply(this, arguments); + }; + _.O(mF, cF); + var nF = function () { + cF.apply(this, arguments); + }; + _.O(nF, cF); + var oF = function () { + cF.apply(this, arguments); + }; + _.O(oF, cF); + var pF = new v.Set(), qF = function (a, b, c) { + var d = 0, e = function () { + d = 0; + }; + return function (f) { + d || (d = _.r.setTimeout(e, b), a.apply(c, arguments)); + }; + }(function () { + throw new vh('Reached Limit for addEventListener'); + }, 1000 * _.zc(Ms)), rF = function () { + OC.call(this); + this.j = []; + this.A = !1; + this.M = 0; + this.o = new v.Map(); + this.log = Lh(); + this.G = []; + pF.add(this); + this.log.info(iE(this.getName())); + }; + _.O(rF, OC); + p = rF.prototype; + p.enable = function () { + if (!this.A) { + this.A = !0; + Dc().j(6); + this.lc(); + for (var a = _.y(this.G), b = a.next(); !b.done; b = a.next()) { + b = b.value; + try { + b(); + } catch (c) { + } + } + this.G.length = 0; + } + }; + p.Ka = function (a, b) { + this.j.push(a); + var c = new hF(a, this.getName()); + this.dispatchEvent('slotAdded', 818, c); + this.log.info(lE(this.getName(), a.getAdUnitPath()), a); + a = this.getName(); + To(b, 4, a); + }; + p.destroySlots = function (a) { + var b = this; + return a.filter(function (c) { + return fa(b.j, c); + }); + }; + p.addEventListener = function (a, b) { + var c = this, d; + if (this.M >= _.zc(Ls) && 0 < _.zc(Ls)) + qF(); + else if (null === (d = this.o.get(a)) || void 0 === d || !d.has(b)) { + this.o.has(a) || this.o.set(a, new v.Map()); + var e = function (f) { + f = f.detail; + var g, h; + try { + b(f); + } catch (k) { + c.log.error(CE(String(k), a)), null === (h = null === (g = window.console) || void 0 === g ? void 0 : g.error) || void 0 === h ? void 0 : h.call(g, k); + } + }; + (0, F.H)(this.o.get(a)).set(b, e); + QC(this, a, e); + this.M++; + } + }; + p.removeEventListener = function (a, b) { + var c, d = null === (c = this.o.get(a)) || void 0 === c ? void 0 : c.get(b); + if (!d || !PC(this, a, d)) + return !1; + this.M--; + return (0, F.H)(this.o.get(a)).delete(b); + }; + var em = function (a) { + for (var b = _.y(pF), c = b.next(); !c.done; c = b.next()) + c.value.destroySlots(a); + }; + var sF = function (a) { + var b = this; + this.addEventListener = K(86, function (c, d) { + if ('function' !== typeof d) + return M(Lh(), Wg('Service.addEventListener', [ + c, + d + ])), b; + var e = Zg(c); + if (!e) + return M(Lh(), DE(c)), b; + a.addEventListener(e, d); + return b; + }); + this.removeEventListener = K(904, function (c, d) { + var e = Zg(c); + if ('function' === typeof d && e) + return a.removeEventListener(e, d); + M(Lh(), Wg('Service.removeEventListener', [ + c, + d + ])); + }); + this.getSlots = K(573, function () { + return a.j.map(function (c) { + return c.j; + }); + }); + this.getSlotIdMap = K(574, function () { + for (var c = {}, d = _.y(a.j), e = d.next(); !e.done; e = d.next()) + e = e.value, c[e.toString()] = e.j; + return c; + }); + this.enable = K(87, function () { + return a.enable(); + }, !0); + this.getName = K(575, function () { + return a.getName(); + }); + }; + _.O(sF, bD); + var tF = function (a) { + this.getId = K(593, function () { + return a.getId(); + }); + this.getAdUnitPath = K(594, function () { + return a.getAdUnitPath(); + }); + this.getName = K(595, function () { + return a.getName(); + }); + this.toString = K(596, function () { + return a.toString(); + }); + this.getDomId = K(597, function () { + return a.getDomId(); + }); + }; + var uF = function () { + this.sourceAgnosticLineItemId = this.sourceAgnosticCreativeId = this.lineItemId = this.creativeId = this.campaignId = this.advertiserId = null; + this.isBackfill = !1; + this.encryptedTroubleshootingInfo = this.creativeTemplateId = this.companyIds = this.yieldGroupIds = null; + }; + var vF = '', Xi = null, wF = function () { + for (var a = zu(tt) || '0-0-0', b = a.split('-').map(function (e) { + return Number(e); + }), c = [ + '1', + '0', + '38' + ].map(function (e) { + return Number(e); + }), d = 0; d < b.length; d++) { + if (b[d] > c[d]) + return a; + if (b[d] < c[d]) + break; + } + return '1-0-38'; + }, Wi = function () { + vF || (vF = wF()); + return vF; + }, xF = _.Vn(function () { + var a, b; + null === (b = null === (a = window.console) || void 0 === a ? void 0 : a.warn) || void 0 === b ? void 0 : b.call(a, 'googletag.pubads().setSafeFrameConfig({useUniqueDomain: ...}) is deprecated, and will stop having an effect in early 2022.'); + }), yF = _.Vn(function () { + var a, b; + null === (b = null === (a = window.console) || void 0 === a ? void 0 : a.warn) || void 0 === b ? void 0 : b.call(a, 'googletag.pubads().setSafeFrameConfig({useUniqueDomain: ...}) has been removed, and no longer has any effect.'); + }), zF = function (a) { + var b = Lh(), c = new eC(); + if (!a || !_.ja(a)) + return null; + var d = !1; + _.ef(a, function (e, f) { + var g = !1; + switch (f) { + case 'allowOverlayExpansion': + 'boolean' === typeof e ? w(c, 1, a.allowOverlayExpansion) : d = g = !0; + break; + case 'allowPushExpansion': + 'boolean' === typeof e ? w(c, 2, a.allowPushExpansion) : d = g = !0; + break; + case 'sandbox': + !0 === e ? w(c, 3, a.sandbox) : d = g = !0; + break; + case 'useUniqueDomain': + if (_.H(Hs)) { + yF(); + return; + } + _.H(Is) && xF(); + 'boolean' === typeof e ? w(c, 4, a.useUniqueDomain) : null !== e && (d = g = !0); + break; + default: + g = !0; + } + g && b.error(SE('setSafeFrameConfig', Er(a), f, Er(e))); + }); + return d ? null : c; + }, AF = function (a) { + var b = new eC(); + a = _.y(a); + for (var c = a.next(); !c.done; c = a.next()) + if (c = c.value) + Yf(c, 1) && w(b, 1, E(c, 1)), Yf(c, 2) && w(b, 2, E(c, 2)), Yf(c, 3) && w(b, 3, E(c, 3)), Yf(c, 4) && w(b, 4, E(c, 4)); + return b; + }; + var BF = function (a, b) { + this.width = a; + this.height = b; + }; + BF.prototype.getWidth = function () { + return this.width; + }; + BF.prototype.getHeight = function () { + return this.height; + }; + var CF = function (a, b, c) { + OC.call(this); + this.A = a; + this.instance = b; + this.Ra = c; + this.j = null; + this.id = this.A + '_' + this.instance; + }; + _.O(CF, OC); + p = CF.prototype; + p.getId = function () { + return this.id; + }; + p.getAdUnitPath = function () { + return this.A; + }; + p.getName = function () { + return this.A; + }; + p.O = function () { + return this.instance; + }; + p.toString = function () { + return this.getId(); + }; + p.getDomId = function () { + return this.Ra; + }; + var DF = function (a, b) { + a.j = b; + }; + var yh = function (a) { + var b = this, c = Lh(), d = Nh(Ke.O(), a.getDomId()), e = '', f = !1; + QC(a, TC, function (m) { + var n = m.detail; + m = n.$b; + n = n.isBackfill; + m && (e = m, f = n); + }); + this.set = K(40, function (m, n) { + if ('string' !== typeof m || 'string' !== typeof n || void 0 === JD()[m]) + return M(c, Wg('Slot.set', [ + m, + n + ]), a), b; + var q = (L = Ub(d, fh, 3), _.t(L, 'find')).call(L, function (u) { + return ch(u) === m; + }); + q ? dh(q, [n]) : (q = eh(new fh(), m), To(q, 2, n), gh(d, 3, fh, q)); + return b; + }); + this.get = K(41, function (m) { + if ('string' !== typeof m) + return M(c, Wg('Slot.get', [m]), a), null; + var n = (L = Ub(d, fh, 3), _.t(L, 'find')).call(L, function (q) { + return ch(q) === m; + }); + return (n = n && Oh(n, 2)) ? n[0] : null; + }); + this.getAttributeKeys = K(42, function () { + return Ub(d, fh, 3).map(function (m) { + return ch(m); + }); + }); + this.addService = K(43, function (m) { + m = Ph.get(m); + if (!m) + return M(c, Wg('Slot.addService', [m]), a), b; + if ((L = Oh(d, 4), _.t(L, 'includes')).call(L, m.getName())) + return c.info($D(m.getName(), a.toString()), a), b; + m.Ka(a, d); + return b; + }); + this.defineSizeMapping = K(44, function (m) { + try { + if (!Array.isArray(m)) + throw new vh('Size mapping must be an array'); + var n = m.map(xh); + wh(d, 6, n); + } catch (q) { + rf(44, q), ur('Incorrect usage of SlotInterface defineSizeMapping: ' + q.message); + } + return b; + }); + this.setClickUrl = K(45, function (m) { + if ('string' !== typeof m) + return M(c, Wg('Slot.setClickUrl', [m]), a), b; + d.setClickUrl(m); + return b; + }); + this.setCategoryExclusion = K(46, function (m) { + 'string' !== typeof m || $g(m) ? M(c, Wg('Slot.setCategoryExclusion', [m]), a) : ((L = Oh(d, 8), _.t(L, 'includes')).call(L, m) || To(d, 8, m), c.info(aE(m), a)); + return b; + }); + this.clearCategoryExclusions = K(47, function () { + w(d, 8, Ro); + c.info(bE(), a); + return b; + }); + this.getCategoryExclusions = K(48, function () { + return Oh(d, 8).slice(); + }); + this.setTargeting = K(49, function (m, n) { + ih(a, d, m, n, c); + return b; + }); + this.updateTargetingFromMap = K(649, function (m) { + jh(a, d, m, c); + return b; + }); + this.clearTargeting = K(50, function (m) { + if (void 0 === m) + return wh(d, 9, void 0), c.info(cE(a.getAdUnitPath()), a), b; + var n = bh(d), q = _.t(n, 'findIndex').call(n, function (u) { + return ch(u) === m; + }); + if (0 > q) + return M(c, zE(m, a.getAdUnitPath()), a), b; + n.splice(q, 1); + wh(d, 9, n); + c.info(FE(m, a.getAdUnitPath()), a); + return b; + }); + this.getTargeting = K(51, function (m) { + if ('string' !== typeof m) + return M(c, Wg('Slot.getTargeting', [m]), a), []; + var n = (L = bh(d), _.t(L, 'find')).call(L, function (q) { + return ch(q) === m; + }); + return n ? Oh(n, 2).slice() : []; + }); + this.getTargetingKeys = K(52, function () { + return bh(d).map(function (m) { + return ch(m); + }); + }); + this.setCollapseEmptyDiv = K(53, function (m, n) { + n = void 0 === n ? !1 : n; + if ('boolean' !== typeof m || 'boolean' !== typeof n) + return M(c, Wg('Slot.setCollapseEmptyDiv', [ + m, + n + ]), a), b; + w(d, 10, m); + w(d, 11, m && n); + of('gpt_ced', function (q) { + I(q, 'sc', E(d, 11) ? 't' : 'f'); + I(q, 'level', 'slot'); + df(q); + }); + n && !m && M(c, dE(a.toString()), a); + return b; + }); + this.getAdUnitPath = K(54, function () { + return a.getAdUnitPath(); + }); + this.getSlotElementId = K(598, function () { + return a.getDomId(); + }); + this.setForceSafeFrame = K(55, function (m) { + if ('boolean' !== typeof m) + return M(c, Wg('Slot.setForceSafeFrame', [String(m)]), a), b; + w(d, 12, m); + return b; + }); + this.setSafeFrameConfig = K(56, function (m) { + var n = zF(m); + if (!n) + return c.error(Wg('Slot.setSafeFrameConfig', [m]), a), b; + zf(d, 13, n); + return b; + }); + var g = null; + QC(a, SC, function (m) { + m = m.detail; + if (E(m, 8)) + g = null; + else { + g = new uF(); + var n = !!E(m, 9); + g.isBackfill = n; + var q = Oh(m, 15), u = Oh(m, 16); + q.length && u.length && (g.sourceAgnosticCreativeId = q[0], g.sourceAgnosticLineItemId = u[0], n || (g.creativeId = q[0], g.lineItemId = u[0], (n = Oh(m, 22)) && n.length && (g.creativeTemplateId = n[0]))); + Oh(m, 17).length && (n = Oh(m, 17)[0], g.advertiserId = n); + Oh(m, 18).length && (n = Oh(m, 18)[0], g.campaignId = n); + Oh(m, 19).length && (n = Oh(m, 19), g.yieldGroupIds = n); + Oh(m, 20).length && (n = Oh(m, 20), g.companyIds = n); + m = Oh(m, 45); + m = m.length && 'string' !== typeof m[0] ? _.Ad(m, Fb) : m; + m.length && (g.encryptedTroubleshootingInfo = m[0]); + } + }); + this.getResponseInformation = K(355, function () { + return g; + }); + this.getName = K(170, function () { + window.console && console.error && console.error('getName on SlotInterface is deprecated and will be removed. Use getAdUnitPath instead.'); + var m = new cf('slot_get_name'); + df(m); + ff(m); + return a.getAdUnitPath(); + }); + var h = new tF(a); + this.getSlotId = K(579, function () { + return h; + }); + this.getServices = K(580, function () { + return Oh(d, 4).map(function (m) { + return qe(m); + }); + }); + this.getSizes = K(581, function (m, n) { + return (m = Vf(d, m, n)) ? m.map(function (q) { + return E(q, 3) ? 'fluid' : new BF(q.getWidth(), q.getHeight()); + }) : null; + }); + this.getClickUrl = K(582, function () { + return Yf(d, 7) ? d.getClickUrl() : ''; + }); + this.getTargetingMap = K(583, function () { + for (var m = {}, n = _.y(bh(d)), q = n.next(); !q.done; q = n.next()) + q = q.value, m[ch(q)] = Oh(q, 2); + return m; + }); + this.getOutOfPage = K(584, function (m) { + return 'number' === typeof m ? Nf(d) === m : 0 !== Nf(d); + }); + this.getCollapseEmptyDiv = K(585, function () { + return Yf(d, 10) ? E(d, 10) : null; + }); + this.getDivStartsCollapsed = K(586, function () { + return Yf(d, 11) ? E(d, 11) : null; + }); + var k = function () { + return ''; + }; + QC(a, UC, function (m) { + k = m.detail.rd; + }); + this.getContentUrl = K(587, function () { + return k(); + }); + this.getFirstLook = K(588, function () { + ur('The getFirstLook method of SlotInterface is deprecated. Please update your code to no longer call this method.'); + return 0; + }); + var l = ''; + QC(a, SC, function (m) { + var n; + l = null != (n = m.detail.getEscapedQemQueryId()) ? n : ''; + }); + this.getEscapedQemQueryId = K(591, function () { + return l; + }); + this.getHtml = K(592, function () { + return f ? (window.console && console.warn && console.warn('This ad\'s html cannot be accessed using the getHtml method on SlotInterface. Returning the empty string instead.'), '') : e; + }); + }; + _.O(yh, bD); + me(yh, 8); + var Ti = function () { + this.m = []; + this.hostpageLibraryTokens = []; + this.j = {}; + }, EF = function (a, b) { + if (!_.t(a.m, 'includes').call(a.m, b) && (L = [ + 1, + 2, + 3 + ], _.t(L, 'includes')).call(L, b)) { + var c; + if (c = _.H(ut) ? kw[b] : iw[b]) { + var d = b + '_hostpage_library'; + if (c = di(document, c)) + c.id = d; + } + a.m.push(b); + b = new lw(b); + a.hostpageLibraryTokens.push(b); + a = ne(); + a.hostpageLibraryTokens || (a.hostpageLibraryTokens = {}); + a.hostpageLibraryTokens[b.j] = b.m; + } + }, FF = function (a, b, c) { + var d; + a.j[b] = null !== (d = a.j[b]) && void 0 !== d ? d : new v.Set(); + a.j[b].add(c); + }, GF = function (a, b) { + var c, d; + a = null !== (d = null === (c = a.j[b]) || void 0 === c ? void 0 : _.t(c, 'values').call(c)) && void 0 !== d ? d : []; + return [].concat(_.lc(a)); + }; + var Wv = function (a, b) { + var c = this; + a = void 0 === a ? Ke.O().j : a; + b = void 0 === b ? _.r : b; + this.A = ''; + this.j = this.storage = null; + this.m = !1; + this.F = function () { + return !1; + }; + var d = {}, e = {}, f = {}; + this.D = (f[Cv] = (d[19] = function () { + return !!E(a, 10); + }, d[13] = function () { + return gc.apply(0, arguments).some(function (g) { + return 0 == c.A.lastIndexOf(g, 0); + }); + }, d[12] = function () { + return !!E(a, 6); + }, d[11] = cA, d[15] = function (g) { + return c.F(g); + }, d[7] = function () { + var g; + return !(null === (g = b.crypto) || void 0 === g || !g.subtle); + }, d[48] = function () { + return !!c.storage; + }, d[51] = function () { + return c.m; + }, d[53] = function () { + try { + return !!_.Oi('LINK').relList.supports('webbundle'); + } catch (g) { + return !1; + } + }, d), f[Dv] = (e[8] = function (g) { + var h; + return null !== (h = Tu(c.storage, Number(g))) && void 0 !== h ? h : void 0; + }, e[10] = function (g) { + return c.j ? ag(g + c.j) % 1000 : void 0; + }, e), f); + }, HF = function (a, b) { + b && !a.j && (a.j = _.t(b.split(':'), 'find').call(b.split(':'), function (c) { + return 0 === c.indexOf('ID='); + }) || null); + }; + var IF = _.Vn(function () { + ur('The googletag.pubads().definePassback function has been deprecated. The function may break in certain contexts, see https://developers.google.com/publisher-tag/guides/passback-tags#construct_passback_tags for how to correctly create a passback.'); + }), Jh = function () { + this.j = new v.Map(); + this.ca = new v.Set(); + _.Hg(Wv).F = Kh; + }; + Jh.prototype.add = function (a, b, c) { + var d = this, e = void 0 === c ? {} : c; + c = void 0 === e.Ra ? void 0 : e.Ra; + var f = void 0 === e.format ? 0 : e.format; + e = void 0 === e.Rc ? !1 : e.Rc; + var g, h = Ih(f); + if (h) + return of('gpt_pla_ns', function (l) { + I(l, 'iu', a); + I(l, 'f', null !== f && void 0 !== f ? f : ''); + I(l, 'nsr', h); + df(l); + }), {}; + e && IF(); + e = this.j.get(a) || Number(e); + b = null !== (g = JF(a, e, b, c || 'gpt_unit_' + a + '_' + e)) && void 0 !== g ? g : {}; + c = b.Ja; + var k = b.slotId; + if (!k) + return {}; + this.j.set(a, e + 1); + this.ca.add(k); + _.zl(k, function () { + return void d.ca.delete(k); + }); + JC(a); + return { + slotId: k, + Ja: c + }; + }; + var KF = function (a) { + return GF(_.Hg(Ti), a).map(function (b) { + var c; + return null === (c = Bg(b, document)) || void 0 === c ? void 0 : c.contentWindow; + }).filter(function (b) { + return !!b; + }); + }, fm = function (a) { + a = _.y(a); + for (var b = a.next(); !b.done; b = a.next()) + oc(b.value); + }, Uh = function (a, b) { + a = _.y(a.ca); + for (var c = a.next(); !c.done; c = a.next()) + if (c = c.value, c.getDomId() === b) + return c; + return null; + }, Il = function (a, b, c, d) { + d = void 0 === d ? !1 : d; + return 'string' === typeof a && 0 < a.length && b && (void 0 === c || 'string' === typeof c) ? _.Hg(Jh).add(a, b, { + Ra: c, + Rc: d + }) : {}; + }, LF = function (a, b, c) { + var d = Il(a, b, c).slotId; + if (d) + return d.j; + Lh().error(Wg('googletag.defineSlot', [ + a, + b, + c + ]), void 0, _.H(ks)); + return null; + }, MF = function () { + var a = _.mf(74, LF); + oe('defineSlot', a); + oe('defineUnit', a); + oe('getWindowsThatCanCommunicateWithHostpageLibrary', KF); + }, JF = function (a, b, c, d) { + var e = Uh(_.Hg(Jh), d); + if (e) + return Lh().error(eE(d, a, e.getAdUnitPath())), null; + var f = new kC(); + lC(w(f, 1, a), d); + c = uh(c); + e = c.Fa; + wh(f, 5, c.ec); + null !== e && zf(f, 16, e); + GC(f); + var g = new CF(a, b, d); + DF(g, zh(g)); + _.zl(g, function () { + var h = Ke.O(), k = g.getDomId(); + delete h.m[k]; + h.F.delete(g); + h = g.getAdUnitPath(); + var l; + h = Pe(h); + k = (null !== (l = Df.get(h)) && void 0 !== l ? l : 0) - 1; + 0 >= k ? Df.delete(h) : Df.set(h, k); + Lh().info(EE(g.toString()), g); + _.H(zs) && ((l = aD.get(g)) && Ph.delete(l), aD.delete(g)); + }); + Lh().info(VD(g.toString()), g); + QC(g, UC, function (h) { + h = h.detail.ke; + Lh().info(WD(g.getAdUnitPath()), g); + Qe(Re.O(), '7', 9, ml(uD.O(), g), 0, h); + }); + QC(g, SC, function (h) { + var k = h.detail, l; + Lh().info(XD(g.getAdUnitPath()), g); + h = Re.O(); + var m = G(f, 20); + k = null !== (l = k.getEscapedQemQueryId()) && void 0 !== l ? l : ''; + h.j && (_.r.google_timing_params = _.r.google_timing_params || {}, _.r.google_timing_params['qqid.' + m] = k); + }); + QC(g, TC, function () { + return void Lh().info(YD(g.getAdUnitPath()), g); + }); + QC(g, VC, function () { + return void Lh().info(ZD(g.getAdUnitPath()), g); + }); + return { + Ja: f, + slotId: g + }; + }; + var NF = function (a) { + rF.call(this); + this.B = a; + this.ads = new v.Map(); + this.D = {}; + this.T = this.Va = !1; + _.Hg(Wv).m = !0; + }; + _.O(NF, rF); + p = NF.prototype; + p.set = function (a, b) { + 'string' === typeof a && a.length ? (this.D[a] = b, this.log.info(jE(a, String(b), this.getName()))) : M(this.log, Wg('CompanionAdsService.set', [ + a, + b + ])); + return this; + }; + p.get = function (a) { + var b; + return null !== (b = this.D[a]) && void 0 !== b ? b : null; + }; + p.display = function (a, b, c, d) { + this.enable(); + b = Il(a, b, c); + a = b.slotId; + b = b.Ja; + this.Ka((0, F.H)(a), (0, F.H)(b)); + null === b || void 0 === b ? void 0 : b.setClickUrl(d); + Sh(null === a || void 0 === a ? void 0 : a.getDomId()); + }; + p.Ka = function (a, b) { + var c = this; + QC(a, SC, function (d) { + E(d.detail, 11) && (OF(c, a).ae = !0); + }); + rF.prototype.Ka.call(this, a, b); + }; + p.lc = function () { + }; + p.setRefreshUnfilledSlots = function (a) { + 'boolean' === typeof a && (this.Va = a); + }; + var PF = function (a, b) { + (b = void 0 === b ? '' : b) && !a.T && of('ima_sdk_v', function (c) { + a.T = !0; + I(c, 'v', b); + }); + return String(Ke.O().j.getCorrelator()); + }, QF = function (a, b) { + var c = Ke.O().j, d = Ke.O().m; + if (a.B.A) { + var e = { Ca: 3 }; + a.J && (e.Pa = a.J); + a.N && (e.Qa = a.N); + b = null !== b && void 0 !== b ? b : a.j; + c = og(c, d); + d = e.Pa; + var f = e.Qa; + d && 'number' !== typeof d || f && 'number' !== typeof f || a.B.refresh(c, b, e); + } else + (null === b || void 0 === b ? 0 : b[0]) && a.log.error(rE(b[0].getDomId())); + }, RF = function (a, b) { + var c; + return a.B.A && !(null === (c = a.ads.get(b)) || void 0 === c || !c.ae); + }, SF = function (a, b) { + return a.j.filter(function (c) { + return _.t(b, 'includes').call(b, c.toString()); + }); + }; + NF.prototype.getName = function () { + return 'companion_ads'; + }; + NF.prototype.R = function () { + }; + var TF = function (a, b, c, d) { + b = new dF(b, a.getName()); + null != c && null != d && (b.size = [ + c, + d + ]); + a.dispatchEvent('slotRenderEnded', 67, b); + }, OF = function (a, b) { + var c = a.ads.get(b); + c || (c = {}, a.ads.set(b, c), _.zl(b, function () { + return a.ads.delete(b); + })); + return c; + }; + var Vh = function (a) { + sF.call(this, a); + var b = this; + this.set = K(576, function (c, d) { + a.set(c, d); + return b; + }); + this.get = K(577, function (c) { + return a.get(c); + }); + this.getAttributeKeys = K(578, function () { + return cr(a.D); + }); + this.display = K(558, function (c, d, e, f) { + return a.display(c, d, null != e ? e : '', null != f ? f : ''); + }); + this.notifyUnfilledSlots = K(69, function (c) { + a.Va && QF(a, SF(a, c)); + }); + this.refreshAllSlots = K(60, function () { + a.Va && QF(a); + }); + this.setVideoSession = K(61, function (c, d, e) { + a.J = d; + a.N = e; + 'number' === typeof c && w(Ke.O().j, 29, c); + }); + this.getDisplayAdsCorrelator = K(62, function (c) { + return PF(a, void 0 === c ? '' : c); + }); + this.getVideoStreamCorrelator = K(63, function () { + var c; + return null !== (c = G(Ke.O().j, 29)) && void 0 !== c ? c : 0; + }); + this.isSlotAPersistentRoadblock = K(64, function (c) { + var d = _.t(a.j, 'find').call(a.j, function (e) { + return e.j === c; + }); + return !!d && RF(a, d); + }); + this.onImplementationLoaded = K(65, function () { + a.log.info(mE('GPT CompanionAds')); + }); + this.slotRenderEnded = K(67, function (c, d, e) { + var f = _.t(a.j, 'find').call(a.j, function (g) { + return g.j === c; + }); + return f && TF(a, f, d, e); + }); + this.setRefreshUnfilledSlots = K(59, function (c) { + return a.setRefreshUnfilledSlots(c); + }); + }; + _.O(Vh, sF); + me(Vh, 3); + var UF = function () { + rF.apply(this, arguments); + }; + _.O(UF, rF); + UF.O = function () { + throw Error('Must be overridden'); + }; + var Xh = function () { + UF.apply(this, arguments); + this.D = new v.Map(); + }; + _.O(Xh, UF); + Xh.prototype.getName = function () { + return 'content'; + }; + Xh.prototype.display = function (a, b, c, d) { + c = void 0 === c ? '' : c; + d = void 0 === d ? '' : d; + this.enable(); + b = Il(a, b, c); + a = b.slotId; + b = b.Ja; + this.Ka((0, F.H)(a), (0, F.H)(b)); + b.setClickUrl(d); + Sh(a.getDomId()); + }; + Xh.prototype.destroySlots = function (a) { + a = UF.prototype.destroySlots.call(this, a); + for (var b = _.y(a), c = b.next(); !c.done; c = b.next()) + this.D.delete(c.value); + return a; + }; + var VF = function (a, b) { + var c = a.D.get(b), d = rg(b); + !(c && void 0 !== c.content && d && a.A) || c && c.Vc || (c.Vc = !0, $a(d, Na(c.content)), of('gpt_cont_svc', function (e) { + var f; + I(e, 'cl', String(null === (f = null === c || void 0 === c ? void 0 : c.content) || void 0 === f ? void 0 : f.length)); + df(e, [b.getAdUnitPath()]); + }), a.dispatchEvent('slotRenderEnded', 819, new dF(b, a.getName()))); + }; + Xh.prototype.lc = function () { + }; + Xh.prototype.R = function (a, b) { + VF(this, b); + }; + Xh.prototype.setContent = function (a, b) { + var c = this; + if (_.t(this.j, 'includes').call(this.j, a) && 'string' === typeof b && b.length) { + var d = this.D.get(a); + d ? d.content = b : this.D.set(a, { + content: b, + Vc: void 0 + }); + _.zl(a, function () { + return void c.D.delete(a); + }); + VF(this, a); + } + }; + Xm(Xh); + var Yh = function (a) { + sF.call(this, a); + this.setContent = K(72, function (b, c) { + var d = _.t(a.j, 'find').call(a.j, function (e) { + return e.j === b; + }); + return !!d && a.setContent(d, c); + }); + }; + _.O(Yh, sF); + me(Yh, 4); + var WF = P(['https://console.googletagservices.com/pubconsole/loader.js']), XF = P(['/pubconsole/loader.js']), ji = null, ii = !1, bi = !1, ci = !1, fi = A(WF); + A(XF); + var YF = _.mf(94, function (a) { + a = void 0 === a ? _.r : a; + ne()._pubconsole_disable_ || null !== ai(a) && gi(a); + }); + 'complete' === _.r.document.readyState ? YF() : _.fb(_.r, 'load', function () { + return void YF(); + }); + var ZF = function () { + var a = Lh(); + this.getAllEvents = K(563, function () { + return bi ? je(a.events).slice() : []; + }); + this.getEventsBySlot = K(565, function (b) { + return bi ? TD(a, b).slice() : []; + }); + this.getEventsByLevel = K(566, function (b) { + return bi ? UD(a, b).slice() : []; + }); + }; + _.O(ZF, bD); + me(ZF, 5); + var Jl = function (a, b) { + OC.call(this); + this.slotId = a; + this.j = b; + }; + _.O(Jl, OC); + Jl.prototype.getSlotId = function () { + return this.slotId; + }; + var bG = function (a) { + var b = this; + this.j = new v.Map(); + this.m = new v.Map(); + this.Wa = Re.O(); + window.performance && Og(window.performance.now) && (_.fb(window, 'DOMContentLoaded', _.mf(334, function () { + for (var c = _.y(b.j), d = c.next(); !d.done; d = c.next()) { + var e = _.y(d.value); + d = e.next().value; + e = e.next().value; + $F(b, d, e) && b.j.delete(d); + } + })), QC(a, WC, function (c) { + var d = c.detail; + c = d.Cc; + d = d.P; + return void aG(b, (0, F.H)(Uh(_.Hg(Jh), c)), (0, F.H)(G(d, 20))); + }), QC(a, XC, function (c) { + var d = c.detail; + c = d.Cc; + d = d.P; + c = (0, F.H)(Uh(_.Hg(Jh), c)); + d = (0, F.H)(G(d, 20)); + var e = b.m.get(c); + null != e ? AB(e, d) : aG(b, c, d); + })); + }, aG = function (a, b, c) { + $F(a, b, c) ? a.j.delete(b) : (a.j.set(b, c), _.zl(b, function () { + a.j.delete(b); + })); + }, $F = function (a, b, c) { + var d = rg(b); + if (d && 'DIV' === d.nodeName) { + var e = _.H(Ut); + d = new yB({ + I: window, + Wa: a.Wa, + Ra: d, + za: function (f) { + rf(336, f); + }, + re: e + }); + if (d.m) + return AB(d, c), a.m.set(b, d), yD(uD.O(), b, function () { + return void a.m.delete(b); + }), !0; + } + return !1; + }; + var cG = new v.Map([[ + 2, + { Zd: 'page_level_ads' } + ]]), dG = function () { + }, gG; + dG.O = function () { + throw Error('Must be overridden'); + }; + _.eG = function (a) { + this.j = a = void 0 === a ? cG : a; + this.m = new v.Map(); + this.loaded = new v.Set(); + this.F = null; + }; + _.O(_.eG, dG); + _.fG = function (a, b) { + b = b.module; + a.m.has(b) || a.m.set(b, new Gd()); + return (0, F.H)(a.m.get(b)); + }; + gG = function (a, b) { + var c = b.module; + b = '_gpt_js_load_' + c + '_'; + var d = _.mf(340, function (e) { + if (a.j.has(c) && 'function' === typeof e) { + var f = (0, F.H)(a.j.get(c)); + f = (void 0 === f.td ? [] : f.td).map(function (g) { + return _.fG(a, g).promise; + }); + v.Promise.all(f).then(function () { + e.call(window, _); + }); + } + }); + Object.defineProperty(ne(), b, { + value: function (e) { + if (d) { + var f = d; + d = null; + f(e); + } + }, + writable: !1, + enumerable: !1 + }); + }; + _.eG.prototype.load = function (a) { + var b, c = _.fG(this, a), d = (null !== (b = this.j.get(a.module)) && void 0 !== b ? b : {}).Zd; + if (!d) + throw Error('cannot load invalid module: ' + d); + if (!this.loaded.has(a.module)) { + var e = _.bf[172]; + e = e && 'pagead2.googlesyndication.com' === Zq((e.src || '').match(_.Yq)[3] || null); + var f = (0, F.H)(this.F); + d = ei(Ya(e ? f.od(d) : f.pd(d)).toString()); + d = (e = _.zc(st)) ? yn(d, { cb: e }) : d; + gG(this, a); + di(document, d); + this.loaded.add(a.module); + } + return c.promise; + }; + Xm(_.eG); + var hG = function () { + this.resources = {}; + }; + var uj = function (a, b, c, d, e, f) { + Y.call(this, 856); + this.K = a; + this.slotId = b; + this.ob = U(this); + this.tb = U(this); + this.ja = U(this); + this.J = U(this); + this.l = U(this); + this.B = W(this, c); + this.G = W(this, d); + this.o = W(this, e); + this.N = W(this, f); + }; + _.O(uj, Y); + var iG = function (a) { + a.ob.fa(a.B.value); + a.tb.fa(a.G.value); + a.ja.fa(a.o.value); + jv(a.J); + jv(a.l); + }; + uj.prototype.j = function () { + var a = this.N.value, b = this.o.value; + if (_.H(ts) && a) { + var c; + var d = null === (c = this.K.j.get(this.slotId)) || void 0 === c ? void 0 : c.Ec; + d = null === d || void 0 === d ? void 0 : d.get(a); + if (!d) + throw new vh('Could not find bid with id: ' + a); + this.J.j(d); + var e = d.height; + c = d.width; + var f = d.adUrl, g = d.jd, h = d.cpm; + if (1 !== d.format) + iG(this); + else { + if (!g && !f) + throw new vh('Could not find ad to render for bid id: ' + a); + d = null !== e && void 0 !== e ? e : this.B.value; + c = null !== c && void 0 !== c ? c : this.G.value; + f = { + ad: qi(g, null !== h && void 0 !== h ? h : 0), + adUrl: qi(f, null !== h && void 0 !== h ? h : 0), + adId: a, + width: c, + height: d + }; + h = btoa(JSON.stringify(f)); + 0 === (null === b || void 0 === b ? void 0 : b.kind) ? (f = this.ja, g = f.j, b = b.wa.replace(new RegExp('{{GOOGLE_PBJS_AD_CONFIG}}'.replace(/([-()\[\]{}+?*.$\^|,:#var inDapIF=true,inGptIF=true;', 'sd'); + var B = null !== (k = null === (h = e.contentWindow) || void 0 === h ? void 0 : h.document) && void 0 !== k ? k : e.contentDocument; + Da() && B.open('text/html', 'replace'); + cb(B, sd(g, null)); + Bn(null !== (n = null === (m = null === (l = e.contentWindow) || void 0 === l ? void 0 : l.location) || void 0 === m ? void 0 : m.href) && void 0 !== n ? n : '', '#') && (null === (u = null === (q = e.contentWindow) || void 0 === q ? void 0 : q.history) || void 0 === u ? void 0 : u.replaceState(null, '', '#' + Math.random())); + B.close(); + }, !0); + return e; + }; + hj.prototype.D = function () { + return !0; + }; + var zG = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); + var gj = function () { + xG.apply(this, arguments); + }; + _.O(gj, xG); + gj.prototype.l = function () { + var a = this.j, b = a.Da; + a = a.Zb; + var c = Si(zg(this.j.slotId), this.A, !0); + ej(c, b.te); + yG(this, c, this.A, a); + return c; + }; + gj.prototype.D = function () { + return !1; + }; + var fj = function () { + xG.apply(this, arguments); + }; + _.O(fj, xG); + fj.prototype.l = function () { + var a = this.j, b = a.L, c = a.Da.url, d = b.U; + a = b.P[a.slotId.getDomId()]; + d = AF([ + d.Ba(), + null === a || void 0 === a ? void 0 : a.Ba() + ]); + var e = Si(zg(this.j.slotId), this.A, void 0); + ej(e, c); + xG.prototype.o.call(this, d, e); + var f = function () { + e.removeEventListener('load', f); + AG(c); + }; + e.addEventListener('load', f); + zr(e, function () { + return void AG(c); + }); + return e; + }; + var AG = function (a) { + var b = document.querySelectorAll('link[rel=webbundle][resources*=\'' + a + '\']'); + if (1 === b.length) { + var c = b[0]; + c.resources.remove(a); + c.resources.length || b[0].remove(); + } + }; + fj.prototype.D = function () { + return !1; + }; + var Vj = function (a, b, c, d, e, f, g, h, k, l, m, n, q, u, B, x, z, C, D, J, T, aa, X, S, ca) { + Y.call(this, 680); + this.slotId = a; + this.K = b; + this.L = c; + this.ma = d; + this.I = e; + this.l = U(this); + this.o = U(this); + this.B = qv(this); + this.J = V(this, f); + sv(this, h); + this.ea = V(this, k); + this.G = V(this, l); + this.da = V(this, m); + this.$ = V(this, n); + sv(this, J); + this.N = W(this, q); + this.V = W(this, u); + this.Y = W(this, B); + this.ta = W(this, x); + this.Z = W(this, z); + this.na = W(this, C); + this.xa = W(this, D); + this.sa = W(this, g); + sv(this, T); + sv(this, aa); + this.ka = V(this, X); + sv(this, S); + this.ra = W(this, ca); + }; + _.O(Vj, Y); + Vj.prototype.j = function () { + var a = this, b = this.N.value, c = this.J.value; + if (0 === c.kind) { + var d = null === b || void 0 === b ? void 0 : Fb(b.getHtml()); + d && (c.wa = d); + if (null == c.wa) + throw new dv('invalid html'); + } + b = jj({ + id: this.$.value, + W: document, + slotId: this.slotId, + K: this.K, + L: this.L, + ma: this.ma, + size: this.da.value, + Da: c, + bb: this.ea.value, + Zb: this.G.value, + Hc: this.V.value, + Fd: this.Y.value, + Xc: this.ta.value, + Sa: null === b || void 0 === b ? void 0 : G(b, 2), + isBackfill: this.Z.value, + nc: this.na.value, + bd: this.xa.value, + Qb: this.sa.value, + Cb: this.ka.value, + $a: this.ra.value + }); + _.hu(this, b); + var e = b.render(); + ZC(this, this.id, this.I, 'message', function (f) { + e.contentWindow === f.source && a.slotId.dispatchEvent(ti, 824, f); + }); + this.B.notify(); + this.l.j(e); + this.o.j(b.D()); + }; + var dk = function (a, b, c, d) { + Y.call(this, 863); + this.l = b; + this.Ya = Number(a); + this.o = V(this, c); + this.B = V(this, d); + this.G = BG(this); + }; + _.O(dk, Y); + var BG = function (a) { + return ib(function (b) { + return b.return(new v.Promise(function (c) { + try { + ZC(a, a.id, a.l, 'message', function (d) { + var e; + 'asmreq' === (null === (e = d.data) || void 0 === e ? void 0 : e.type) && sk(Sl(Zz, d.data.payload), 1) === a.Ya && c(d); + }); + } catch (d) { + } + })); + }); + }; + dk.prototype.j = function () { + var a = this, b, c, d, e, f, g; + return ib(function (h) { + if (1 == h.j) + return b = kj(a.l), c = a.o.value, d = a.B.value, jb(h, a.G, 2); + e = h.m; + var k = a.l, l = kj(k); + var m = c.getBoundingClientRect(); + var n = bc(k) ? hg(c, k) : { + x: 0, + y: 0 + }; + k = n.x; + n = n.y; + m = new _.Gr(n, k + m.right, n + m.bottom, k); + k = new aA(); + k = w(k, 1, m.top); + k = w(k, 3, m.bottom); + k = w(k, 2, m.left); + m = w(k, 4, m.right); + k = new $z(); + k = w(k, 1, a.Ya); + k = w(k, 2, !d); + m = zf(k, 3, m); + m = w(m, 4, b); + f = w(m, 5, l); + g = { + type: 'asmres', + payload: f.X() + }; + e.ports[0].postMessage(g); + Lm(h); + }); + }; + var Lj = function (a, b, c, d, e, f, g, h, k, l, m) { + Y.call(this, 699); + this.W = a; + this.slotId = b; + this.l = c; + this.eb = d; + this.C = qv(this); + this.J = W(this, e); + this.V = V(this, f); + this.B = V(this, g); + this.N = V(this, h); + this.o = W(this, k); + this.Y = V(this, l); + this.G = V(this, m); + }; + _.O(Lj, Y); + Lj.prototype.j = function () { + var a, b = this.V.value, c = this.B.value; + c.style.width = ''; + c.style.height = ''; + if ('height' !== this.J.value) { + var d = null !== (a = this.o.value) && void 0 !== a ? a : 0, e = this.N.value, f = this.Y.value, g = this.G.value, h = !1; + switch (d) { + case 1: + case 2: + h = this.W; + var k = this.slotId, l = this.l, m = this.eb; + var n = e.width, q = e.height, u = 0; + var B = 0; + var x = Xf(l); + x = _.y(x); + for (var z = x.next(); !z.done; z = x.next()) { + var C = z.value; + Array.isArray(C) && (z = (0, F.va)(C[0]), C = (0, F.va)(C[1]), u < z && (u = z), B < C && (B = C)); + } + B = [ + u, + B + ]; + u = B[0] < n; + q = B[1] < q; + u || q ? (B = n + 'px', x = { + 'max-height': 'none', + 'max-width': B, + padding: '0px', + width: B + }, q && (x.height = 'auto'), xi(c, b, x), c = {}, u && (u = vi(f.width), n > u && (c.width = B, c['max-width'] = B)), q && (c.height = 'auto', c['max-height'] = 'none'), br(c) ? c = !1 : (c['padding-' + ('ltr' === f.direction ? 'left' : 'right')] = '0px', _.wi(b, c), c = !0)) : c = !1; + b: + switch (x = e.width, n = h.defaultView || h.parentWindow || _.r, d) { + case 2: + b = yi(b, n, x, f, m); + break b; + case 1: + var D, J; + if (f = b.parentElement) + if (m = lg(f)) { + C = m.width; + m = rg(k, n.document); + q = (0, F.H)(ug(m, n)); + u = q.position; + var T = vi(q.width) || 0; + B = ug(f, n); + z = 'rtl' === B.direction ? 'Right' : 'Left'; + m = z.toLowerCase(); + n = 'absolute' === u ? 0 : vi(B['padding' + z]); + B = vi(B['border' + z + 'Width']); + x = Math.max(Math.round((C - Math.max(T, x)) / 2), 0); + C = {}; + T = 0; + var aa = Wk(q); + aa && (T = aa[4] * ('Right' === z ? -1 : 1), z = aa[3] || 1, 1 !== (aa[0] || 1) || 1 !== z) && (aa[0] = 1, aa[3] = 1, C.transform = 'matrix(' + aa.join(',') + ')'); + z = 0; + switch (u) { + case 'fixed': + var X = null !== (D = Number(vg(q.getPropertyValue(m)))) && void 0 !== D ? D : 0; + D = null !== (J = f.getBoundingClientRect().left) && void 0 !== J ? J : 0; + z = X - D; + break; + case 'relative': + z = null !== (X = Number(vg(q.getPropertyValue(m)))) && void 0 !== X ? X : 0; + break; + case 'absolute': + C[m] = '0'; + } + C['margin-' + m] = x - n - B - z - T + 'px'; + _.wi(b, C); + b = !0; + } else + b = !1; + else + b = !1; + break b; + default: + b = !1; + } + c || b ? (Ai(h, k, l, d, e.width, e.height, 'gpt_slotexp', g), h = !0) : h = !1; + break; + case 3: + d = this.W, h = this.slotId, k = this.l, D = this.eb, l = e.width, J = e.height, X = vi(f.height) || 0, J >= X || 'none' === f.display || 'hidden' === f.visibility || !D || -12245933 === D.width || b.getBoundingClientRect().bottom <= D.height ? h = !1 : (D = { height: J + 'px' }, xi(c, b, D), _.wi(b, D), Ai(d, h, k, 3, l, J, 'gpt_slotred', g), h = !0); + } + !h && _.H(ns) && Ai(this.W, this.slotId, this.l, 0, e.width, e.height, 'gpt_pgbrk', g); + } + this.C.notify(); + }; + var zj = function (a, b, c, d) { + Y.call(this, 720); + this.format = a; + this.B = b; + this.C = U(this); + this.l = W(this, c); + this.o = W(this, d); + }; + _.O(zj, Y); + zj.prototype.j = function () { + var a = this.o.value; + if (null == a) + jv(this.C); + else { + var b = Math.round(0.3 * this.B); + 2 !== this.format && 3 !== this.format || !mv(this.l) || !So(this.l.value, 12, !1) || 0 >= b || a <= b ? this.C.j(a) : this.C.j(b); + } + }; + var Gj = function (a, b, c, d, e, f, g, h, k, l) { + Y.call(this, 674); + this.slotId = a; + this.U = b; + this.o = c; + this.W = e; + this.K = f; + this.C = U(this); + this.G = 2 === d || 3 === d; + this.l = V(this, g); + this.N = V(this, h); + this.J = W(this, k); + this.B = W(this, l); + }; + _.O(Gj, Y); + Gj.prototype.j = function () { + var a = dg(this.U, this.o), b = qg(this.slotId, this.W) || Pi(this.l.value, Ag(this.slotId), a); + this.N.value && !a && (b.style.display = 'inline-block'); + this.G ? xD(this.K, this.slotId, function () { + return void _.Vq(b); + }) : _.zl(this, function () { + return void _.Vq(b); + }); + a = CG(this); + 0 < a && (b.style.paddingTop = a + 'px'); + this.C.j(b); + }; + var CG = function (a) { + var b, c = a.l.value, d = null === (b = (0, F.H)(a.J).value) || void 0 === b ? void 0 : b.height; + if (c && !(0, F.H)(a.B).value && d) { + var e; + var f = (null !== (e = E(a.o, 23)) && void 0 !== e ? e : E(a.U, 31)) ? Math.floor((c.offsetHeight - d) / 2) : 0; + } else + f = 0; + return f; + }; + var tj = function (a) { + Y.call(this, 859); + this.I = a; + this.C = U(this); + }; + _.O(tj, Y); + tj.prototype.j = function () { + this.C.j(!bc(this.I.top)); + }; + var Jj = function (a, b) { + Y.call(this, 698); + this.I = a; + this.C = U(this); + this.l = V(this, b); + }; + _.O(Jj, Y); + Jj.prototype.j = function () { + this.C.fa(ug(this.l.value, this.I)); + }; + var yj = function (a, b, c) { + Y.call(this, 813); + this.Aa = a; + this.l = U(this); + this.B = W(this, b); + this.o = W(this, c); + }; + _.O(yj, Y); + yj.prototype.j = function () { + var a, b = this.B.value; + if (!b || _.H(Jt)) + this.l.j(!1); + else if (DG.has(this.Aa)) + this.l.j(!1); + else { + DG.add(this.Aa); + b = _.y(b); + for (var c = b.next(); !c.done; c = b.next()) { + var d = c.value; + c = d.Ga; + (d = d.Sd) && bd(c, d, null !== (a = this.o.value) && void 0 !== a ? a : null); + } + this.l.j(!0); + } + }; + var DG = new v.Set(); + var Tj = function (a) { + Y.call(this, 840); + this.W = a; + this.C = U(this); + }; + _.O(Tj, Y); + Tj.prototype.j = function () { + var a; + var b = void 0 === b ? window.navigator.userAgent : b; + b = (b = b.match(/Chrome\/([0-9]+)/)) && 92 > Number(b[1]) ? 'conversion-measurement' : 'attribution-reporting'; + (null === (a = this.W.featurePolicy) || void 0 === a ? 0 : (L = a.features(), _.t(L, 'includes')).call(L, b)) ? this.C.j(b) : this.C.j(''); + }; + var Xj = function (a, b, c, d) { + Y.call(this, 934); + this.I = a; + this.slotId = b; + sv(this, c); + this.l = W(this, d); + }; + _.O(Xj, Y); + Xj.prototype.j = function () { + var a = this; + QC(this.slotId, ti, function (b) { + b = b.detail; + var c = void 0; + try { + if (c = JSON.parse(b.data), !c || 'gpi-uoo' !== c.googMsgType) + return; + } catch (f) { + return; + } + b = c; + c = a.l.value; + var d = new $p(); + d = w(d, 1, b.userOptOut ? '1' : '0'); + d = w(w(d, 2, 2147483647), 3, '/'); + d = w(d, 4, a.I.location.hostname); + var e = new cw(a.I); + fw(e, '__gpi_opt_out', d, c); + if (b.userOptOut || b.clearAdsData) + gw(e, '__gads', c), gw(e, '__gpi', c); + }); + }; + var EG = function (a, b, c, d, e, f, g) { + Y.call(this, 758); + this.slotId = a; + this.L = b; + this.K = c; + this.Wa = d; + this.I = e; + this.W = f; + this.l = W(this, g); + }; + _.O(EG, Y); + EG.prototype.j = function () { + var a = this; + return ib(function (b) { + if (1 == b.j) { + var c, d = rg(a.slotId, a.W); + d && Kd(d, a.I, null !== (c = a.l.value) && void 0 !== c ? c : '', !0); + cv(a.Wa, '5', (0, F.H)(G(a.L.P[a.slotId.getDomId()], 20))); + return jb(b, a.slotId.dispatchEvent(TC, 801, { + $b: null, + isBackfill: !1 + }), 2); + } + if (_.AD(a.K, a.slotId) && !Bg(a.slotId, a.W)) { + var e = a.L; + c = e.U; + e = e.P[a.slotId.getDomId()]; + (null !== (d = E(e, 10)) && void 0 !== d ? d : E(c, 11)) && pi(a.slotId, a.W, e, c); + } + return jb(b, a.slotId.dispatchEvent(VC, 825, { isEmpty: !0 }), 0); + }); + }; + var gk = function (a, b, c, d, e) { + Y.call(this, 721); + this.I = a; + this.G = W(this, b); + this.o = V(this, c); + this.l = V(this, d); + this.B = V(this, e); + }; + _.O(gk, Y); + gk.prototype.j = function () { + var a = this, b, c, d, e = this.G.value, f = null === (b = null === e || void 0 === e ? void 0 : G(e, 1)) || void 0 === b ? void 0 : b.toUpperCase(); + e = null === (c = null === e || void 0 === e ? void 0 : G(e, 2)) || void 0 === c ? void 0 : c.toUpperCase(); + if (f && e) { + var g = this.o.value, h = this.l.value, k = this.B.value, l = k.style.height, m = k.style.width, n = k.style.display, q = k.style.position, u = Cr(g.id + '_top', f), B = Cr(g.id + '_bottom', e); + _.wi(B, { + position: 'relative', + top: 'calc(100vh - 48px)' + }); + k.appendChild(u); + k.appendChild(B); + _.wi(h, { + position: 'absolute', + top: '24px', + clip: 'rect(0, auto, auto, 0)', + width: '100vw', + height: 'calc(100vh - 48px)' + }); + _.wi(g, { + position: 'fixed', + top: '0', + height: '100vh' + }); + _.wi(k, { + position: 'relative', + display: (null === (d = this.I.screen.orientation) || void 0 === d ? 0 : d.angle) ? 'none' : 'block', + width: '100vw', + height: '100vh' + }); + ZC(this, 722, this.I, 'orientationchange', function () { + var x; + (null === (x = a.I.screen.orientation) || void 0 === x ? 0 : x.angle) ? _.wi(k, { display: 'none' }) : _.wi(k, { display: 'block' }); + }); + _.zl(this, function () { + _.Vq(u); + _.Vq(B); + k.style.position = q; + k.style.height = l; + k.style.width = m; + k.style.display = n; + }); + } + }; + var ck = function (a, b, c, d, e) { + e = void 0 === e ? mj : e; + Y.call(this, 783); + var f = this; + this.slotId = a; + this.W = c; + this.ma = d; + this.J = e; + this.G = !1; + this.l = null; + this.B = this.o = -1; + this.V = _.Vn(function () { + f.ma.dispatchEvent('impressionViewable', 715, new eF(f.slotId, 'publisher_ads')); + }); + this.Y = Wn(function () { + f.ma.dispatchEvent('slotVisibilityChanged', 716, new fF(f.slotId, 'publisher_ads', f.B)); + }, 200); + this.N = V(this, b); + var g = new wj(); + si(this.slotId, YC).then(function () { + return void g.notify(); + }); + sv(this, g); + }; + _.O(ck, Y); + ck.prototype.j = function () { + var a = this, b = this.J(_.mf(this.id, function (c) { + c = _.y(c); + for (var d = c.next(); !d.done; d = c.next()) + a.o = 100 * d.value.intersectionRatio, _.t(Number, 'isFinite').call(Number, a.o) && FG(a); + })); + b.observe(this.N.value); + ZC(this, this.id, this.W, 'visibilitychange', function () { + FG(a); + }); + _.zl(this, function () { + b.disconnect(); + }); + }; + var FG = function (a) { + var b = !eA(a.W); + GG(a, 50 <= a.o && b); + b = Math.floor(b ? a.o : 0); + if (0 > b || 100 < b || b === a.B ? 0 : -1 !== a.B || 0 !== b) + a.B = b, a.Y(); + }, GG = function (a, b) { + a.G || (b ? null === a.l && (a.l = setTimeout(function () { + eA(a.W) || (a.V(), a.G = !0); + a.l = null; + }, 1000)) : null !== a.l && (clearTimeout(a.l), a.l = null)); + }; + var Dj = function (a, b) { + Y.call(this, 666); + this.o = a; + this.l = U(this); + this.B = W(this, b); + }; + _.O(Dj, Y); + Dj.prototype.j = function () { + var a = new Ej(); + mv(this.B) && (w(a, 2, this.B.value), w(a, 3, 1)); + if (this.o) { + var b = [ + this.o, + a + ], c = new Ej(); + b = _.y(b); + for (a = b.next(); !a.done; a = b.next()) + a = a.value, Yf(a, 1) && w(c, 1, G(a, 1)), Yf(a, 2) && w(c, 2, G(a, 2)), Yf(a, 3) && w(c, 3, Hc(a, 3)); + a = c; + } + c = this.l; + b = c.fa; + a = Yf(a, 2) ? Yf(a, 3) && 0 !== Ch() ? (0, F.va)(G(a, 2)) * (0, F.va)(Hc(a, 3)) : G(a, 2) : null; + b.call(c, a); + }; + var Kj = function (a, b, c, d) { + Y.call(this, 666); + this.C = U(this); + sv(this, a); + this.l = V(this, b); + this.o = W(this, d); + this.B = W(this, c); + }; + _.O(Kj, Y); + Kj.prototype.j = function () { + var a, b = this.o.value, c = null !== (a = this.B.value) && void 0 !== a ? a : void 0; + if (null == b || 0 > b || 0 === c) + this.C.j(!1); + else { + var d = this.l.value; + wg(d) ? HG(this, b, c, d) : this.C.j(!1); + } + }; + var HG = function (a, b, c, d) { + var e = nj(b + '%', _.mf(291, function (f, g) { + f = _.y(f); + for (var h = f.next(); !h.done; h = f.next()) + if (h = h.value, !(0 >= h.intersectionRatio)) { + g.unobserve(h.target); + a.C.j(!0); + break; + } + })); + null != c && setTimeout(function () { + a.C.j(!0); + e.disconnect(); + }, c); + e.observe(d); + _.zl(a, function () { + e.disconnect(); + }); + }; + var Ij = function (a, b, c, d, e) { + Y.call(this, 664); + this.slotId = a; + this.eb = b; + this.K = c; + this.C = qv(this); + this.o = W(this, d); + this.l = W(this, e); + }; + _.O(Ij, Y); + Ij.prototype.j = function () { + var a = this, b, c = null !== (b = this.l.value) && void 0 !== b ? b : 0; + if (_.H(dt) || 0 < c) { + var d = document; + c = dA(d); + if (eA(d) && c && (0 < ml(this.K, this.slotId) || !IG(this)) && c) { + var e = ZC(this, 324, d, c, function () { + eA(d) || (e && e(), a.C.notify()); + }); + if (e) + return; + } + } + this.C.notify(); + }; + var IG = function (a) { + var b = a.o.value; + if (null == b) + return !1; + try { + var c = null !== top && void 0 !== top ? top : void 0; + if (void 0 === c) + return !0; + var d = aw(null === c || void 0 === c ? void 0 : c.document, c).y, e = d + a.eb.height; + return b.y >= d && b.y <= e; + } catch (f) { + return !0; + } + }; + var Oj = function (a, b) { + Y.call(this, 762); + this.C = U(this); + this.o = V(this, a); + this.l = V(this, b); + }; + _.O(Oj, Y); + Oj.prototype.j = function () { + var a = this.l.value.kind, b = 0; + 1 === a ? b = 5 : 2 === a ? b = 6 : this.o.value && (b = 1); + this.C.j(b); + }; + var Cj = function (a, b, c, d, e, f) { + Y.call(this, 669); + this.U = a; + this.P = b; + this.I = c; + this.C = U(this); + this.l = W(this, d); + this.o = W(this, e); + this.B = W(this, f); + }; + _.O(Cj, Y); + Cj.prototype.j = function () { + var a; + if (!(a = mv(this.o))) { + a = this.P; + var b = this.I; + b = void 0 === b ? window : b; + a = !!(zu(ls) || a && Yf(a, 16) && Ve('google_range_debug', b)); + } + a ? this.C.j(!0) : this.C.j(!!(Lg(this.l.value) && (E(this.P, 12) || E(this.U, 13)) || this.B.value)); + }; + var Rj = function (a, b, c, d) { + Y.call(this, 828); + this.slotId = a; + this.L = b; + this.C = U(this); + this.l = W(this, c); + this.o = W(this, d); + }; + _.O(Rj, Y); + Rj.prototype.j = function () { + var a = this, b, c, d, e, f, g, h, k, l, m, n; + return ib(function (q) { + c = a.L; + d = c.U; + e = c.P; + f = e[a.slotId.getDomId()]; + g = a.o.value; + h = null; + k = null !== (b = null === f || void 0 === f ? void 0 : f.Ba()) && void 0 !== b ? b : null; + l = d.Ba(); + (null === k || void 0 === k ? 0 : Yf(k, 4)) ? h = E(k, 4) : (null === l || void 0 === l ? 0 : Yf(l, 4)) ? h = E(l, 4) : null != g && (h = g); + m = String(h); + null == g || g === h || a.l.value || M(Lh(), OE(m, String(g))); + a.l.value || of('gpt_sf_r', function (u) { + df(u); + I(u, 'GAM', String(g)); + I(u, 'Final', m); + }); + n = _.H(Hs) || a.l.value || h || null == h; + if (!n) + return jv(a.C), q.return(); + a.C.j(rD()); + Lm(q); + }); + }; + var Pj = function (a, b, c, d, e, f) { + Y.call(this, 719); + this.U = a; + this.B = b; + this.C = U(this); + this.o = V(this, c); + this.l = W(this, d); + this.G = W(this, f); + }; + _.O(Pj, Y); + Pj.prototype.j = function () { + var a = this.l.value, b = this.o.value; + if (1 === b || 5 === b) { + if (a = this.G.value, b = new eC(), a = w(b, 3, a), E(AF([ + a, + this.U.Ba(), + this.B.Ba() + ]), 3)) { + this.C.j(lB); + return; + } + } else { + if (a = 0 === b && a) + a = or(), a = !(!a['allow-top-navigation-by-user-activation'] || !a['allow-popups-to-escape-sandbox']); + if (a) { + this.C.j(lB); + return; + } + } + jv(this.C); + }; + var Fj = function (a, b, c, d, e, f, g, h, k) { + Y.call(this, 681); + this.N = a; + this.da = b; + this.J = c; + this.window = d; + this.ja = U(this); + this.o = U(this); + this.wb = U(this); + this.l = zu(ls).split(','); + this.B = Yi(ms); + this.Fa = Yf(b, 16) ? Wb(b, th, 16) : null; + this.G = Ue('google_range_debug', this.window); + this.V = W(this, e); + this.ea = W(this, f); + this.Z = W(this, g); + this.Y = V(this, h); + this.$ = V(this, k); + }; + _.O(Fj, Y); + Fj.prototype.j = function () { + var a; + if (a = !!(this.l.length || this.Fa && this.G)) { + var b; + b: + if (this.l.length) { + if (this.B.length && (a = this.N.split('/'), !_.t(this.B, 'includes').call(this.B, a[a.length - 1]))) { + a = !1; + break b; + } + a = !0; + } else + a = !1; + var c = a; + a = c ? JG(this) : null; + if (c && a) { + c = this.$.value; + var d = lg(c.parentElement); + d = null !== (b = null === d || void 0 === d ? void 0 : d.width) && void 0 !== b ? b : 0; + b = 'p' === this.l[0]; + var e = Number(this.l[0]); + if (b = 'f' === this.l[0] ? this.J : e && 0 < e ? e : b ? Math.min(d, this.J) : null) { + e = a.width; + var f = a.height, g = this.l[1], h = Number(g); + e = 'ratio' === g && e ? Math.floor(f / e * b) : h && 0 < h ? f * h : f; + KG(this, b, e, { + kind: 0, + wa: LG(b, e, '

Requested size:' + a.width + 'x' + a.height + '

') + }, b <= d ? 1 : 2, c); + a = !0; + } else + a = !1; + } else + a = !1; + if (!a) + a: + if (this.Fa && this.G) { + a = oj(this.Fa, this.window); + c = pj(this.Fa, this.window); + d = qj(this.Fa); + b = rj(this.Fa); + switch (this.G) { + case 'max': + e = a; + f = c; + break; + case 'min': + e = d; + f = b; + break; + case 'banner': + e = a; + f = 90 > c ? c : 90 < b ? b : 90; + break; + case 'skyscraper': + e = 90 > a ? a : 90 < d ? d : 90; + f = c; + break; + default: + a = !1; + break a; + } + KG(this, e, f, { + kind: 0, + wa: LG(e, f, '

Minimum size:' + d + 'x' + b + '

Maximum size:' + (a + 'x' + c + '

')) + }); + a = !0; + } else + a = !1; + } + if (!a) { + a = this.ea.value; + if (null == a) + throw new vh('Missing \'width\'.'); + c = this.Z.value; + if (null == c) + throw new vh('Missing \'height\'.'); + KG(this, a, c, this.Y.value); + } + }; + var JG = function (a) { + a = Xf(a.da)[0]; + return Array.isArray(a) && a.every(function (b) { + return 'number' === typeof b; + }) ? new _.Ui(a[0], a[1]) : null; + }, LG = function (a, b, c) { + return '')) + c + ('

Rendered size:' + a + 'x' + b + '

'); + }, KG = function (a, b, c, d, e, f) { + e = void 0 === e ? a.V.value : e; + a.o.j(new _.Ui(b, c)); + a.ja.j(d); + a.wb.fa(e); + f && _.Tr(f, 'opacity', 0.5); + }; + var Aj = function (a, b, c, d, e, f, g) { + Y.call(this, 673); + this.slotId = a; + this.bb = b; + this.B = c; + this.o = d; + this.W = e; + this.l = f; + this.K = g; + this.C = U(this); + }; + _.O(Aj, Y); + Aj.prototype.j = function () { + var a = this, b, c; + return ib(function (d) { + if (1 == d.j) { + if (a.bb) { + MG(a, a.bb); + a.C.j(a.bb); + d.j = 0; + return; + } + if (cg(a.l)) { + a.C.j(NG(a)); + d.j = 0; + return; + } + return jb(d, si(a.slotId, RC), 4); + } + b = d.m; + c = b.detail; + if (a.m) + return d.return(); + MG(a, c); + a.C.j(c); + Lm(d); + }); + }; + var NG = function (a) { + var b = _.Oi('INS'); + b.id = a.B; + _.wi(b, { display: 'none' }); + a.W.documentElement.appendChild(b); + var c = function () { + return void _.Vq(b); + }; + 2 === a.l || 3 === a.l ? xD(a.K, a.slotId, c) : _.zl(a, c); + return b; + }, MG = function (a, b) { + if (2 !== a.l && 3 !== a.l) { + for (var c = _.y(_.t(Array, 'from').call(Array, b.childNodes)), d = c.next(); !d.done; d = c.next()) + d = d.value, 1 === d.nodeType && d.id !== a.o && _.Vq(d); + b.style.display = ''; + } + }; + var Hj = function (a) { + Y.call(this, 676); + this.C = U(this); + this.l = V(this, a); + }; + _.O(Hj, Y); + Hj.prototype.j = function () { + var a = jg(this.l.value); + this.C.j(a); + }; + var Qj = function (a, b, c) { + Y.call(this, 807); + this.I = a; + this.C = qv(this); + this.l = W(this, b); + this.o = W(this, c); + }; + _.O(Qj, Y); + Qj.prototype.j = function () { + var a = _.zc(Et); + if (0 !== a) { + var b = this.l.value; + if (b && !this.o.value) { + var c = Fr(this.I); + b = new CB(c, b); + 1 === a ? b = DB(b) : (b = rr('google_ads_top_frame_ctrl', b.j), b = !(!b || !b.contentWindow)); + b || this.R(new vh('Cannot create top window frame: ' + a)); + } + } + this.C.notify(); + }; + var Mj = function (a) { + Y.call(this, 881); + this.C = U(this); + this.l = W(this, a); + }; + _.O(Mj, Y); + Mj.prototype.j = function () { + var a; + if (_.H(Ft) || !this.l.value) + jv(this.C); + else { + for (var b = this.l.value, c = {}, d = _.y(Ub(b, hq, 7)), e = d.next(); !e.done; e = d.next()) + e = e.value, c[lk(e, 1)] = JSON.parse(lk(e, 2)); + (d = Wb(b, gq, 6)) && (c['https://googleads.g.doubleclick.net'] = d.toJSON()); + this.C.j({ + seller: 'https://pubads.g.doubleclick.net', + decisionLogicUrl: lk(b, 1), + trustedScoringSignalsUrl: lk(b, 2), + interestGroupBuyers: Oh(b, 3), + additionalBids: [], + auctionSignals: JSON.parse(lk(b, 4) || '{}'), + sellerSignals: (null === (a = Wb(b, iq, 5)) || void 0 === a ? void 0 : a.toJSON()) || [], + perBuyerSignals: c + }); + } + }; + Mj.prototype.A = function () { + jv(this.C); + }; + var OG = navigator, Nj = function (a, b, c, d) { + Y.call(this, 882); + this.ja = U(this); + this.o = U(this); + this.l = W(this, a); + this.B = W(this, b); + this.G = W(this, c); + this.J = W(this, d); + }; + _.O(Nj, Y); + var PG = function (a) { + a.ja.fa(a.G.value); + a.o.fa(a.J.value); + }; + Nj.prototype.j = function () { + var a = this, b, c, d, e, f, g, h, k, l, m, n; + return ib(function (q) { + if (1 == q.j) { + if (_.H(Ft) || !a.B.value) + return PG(a), q.return(); + f = null === (b = a.l.value) || void 0 === b ? void 0 : b.getWidth(); + g = null === (c = a.l.value) || void 0 === c ? void 0 : c.getHeight(); + if (!f || !g) + return PG(a), q.return(); + h = performance.now(); + k = (null === (d = a.l.value) || void 0 === d ? void 0 : sk(d, 8)) || 1000; + return jb(q, v.Promise.race([ + null === (e = OG.runAdAuction) || void 0 === e ? void 0 : e.call(OG, a.B.value), + Dr(k) + ]), 2); + } + l = q.m; + m = performance.now() - h; + n = 'timeout' === l; + if (!l || n) { + var u, B, x, z, C, D, J, T, aa = 'https://googleads.g.doubleclick.net/td/auctionwinner?status=nowinner&isContextualWinner=1', X = null === (B = null === (u = a.l.value) || void 0 === u ? void 0 : Wb(u, iq, 5)) || void 0 === B ? void 0 : B.getEscapedQemQueryId(); + X && (aa += '&qqid=' + encodeURIComponent(X)); + (u = null === (z = null === (x = a.l.value) || void 0 === x ? void 0 : Wb(x, iq, 5)) || void 0 === z ? void 0 : lk(z, 6)) && (aa += '&xfpQid=' + encodeURIComponent(u)); + if (null === (D = null === (C = a.l.value) || void 0 === C ? void 0 : Wb(C, iq, 5)) || void 0 === D ? 0 : So(D, 4)) + aa += '&is_plog=1'; + if (null === (T = null === (J = a.l.value) || void 0 === J ? void 0 : Wb(J, iq, 5)) || void 0 === T ? 0 : So(T, 7)) + aa += '&hasXfpAds=1'; + aa += '&applied_timeout_ms=' + (n ? k : 0) + '&duration_ms=' + Math.round(m); + Zl(aa); + PG(a); + return q.return(); + } + a.ja.j({ + kind: 2, + te: l + }); + a.o.j(new _.Ui(f, g)); + Lm(q); + }); + }; + Nj.prototype.A = function () { + PG(this); + }; + var Sj = function (a) { + Y.call(this, 839); + this.C = qv(this); + this.l = W(this, a); + }; + _.O(Sj, Y); + Sj.prototype.j = function () { + var a = this, b, c, d, e; + return ib(function (f) { + switch (f.j) { + case 1: + if (_.H(Gt) || !mv(a.l)) + return a.C.notify(), f.return(); + b = a.l.value; + c = Wb(b, cq, 3); + if (null === c || void 0 === c || !So(c, 11)) { + f.j = 2; + break; + } + d = performance.now(); + e = sk(c, 12); + f.F = 3; + return jb(f, new v.Promise(function (g, h) { + var k = 'https://pubads.g.doubleclick.net/td/sts?render_urls='; + Yf(c, 13) && (k += lk(c, 13)); + var l = new XMLHttpRequest(); + l.open('GET', k); + l.timeout = e; + l.onload = function () { + 200 <= l.status && 300 > l.status ? (of('gpt_td_sts_rpc', function (m) { + df(m); + I(m, 'timeout_ms', e); + I(m, 'duration_ms', Math.round(performance.now() - d)); + I(m, 'url_count', sk(c, 14)); + }, {}), g()) : h(Error('status: ' + l.status.toString() + ' ' + l.statusText)); + }; + l.onerror = function () { + h(Error('status: ' + l.status.toString() + ' ' + l.statusText)); + }; + l.ontimeout = function () { + of('gpt_td_sts_rpc_timeout', function (m) { + df(m); + I(m, 'timeout_ms', e); + I(m, 'duration_ms', Math.round(performance.now() - d)); + I(m, 'url_count', sk(c, 14)); + }, {}); + g(); + }; + l.send(); + }), 5); + case 5: + lb(f, 2); + break; + case 3: + mb(f), of('gpt_td_sts_rpc_error', function (g) { + df(g); + I(g, 'timeout_ms', e); + I(g, 'duration_ms', Math.round(performance.now() - d)); + I(g, 'url_count', sk(c, 14)); + }, { pa: 1 }); + case 2: + a.C.notify(), Lm(f); + } + }); + }; + Sj.prototype.A = function () { + this.C.notify(); + }; + var QG = function () { + this.j = new v.Map(); + }, RG = function (a, b) { + var c; + b && (null === (c = a.j.get(b)) || void 0 === c ? void 0 : c.ua(), a.j.delete(b)); + }, TG = function (a, b, c, d, e, f, g, h) { + var k = document, l = window; + RG(a, b); + QC(b, VC, SG); + h && _.H(ct) ? (f = new Qc(), c = new EG(b, d, c, Re.O(), l, k, e.ac), N(f, c), a.j.set(b, f), _.zl(b, function () { + return void RG(a, b); + }), Sc(f)) : (c = jk(b, c, d, e, k, f, g), a.j.set(b, c), _.zl(b, function () { + return void RG(a, b); + }), Sc(c)); + }, SG = _.Vn(function () { + return void Gg('gpt-first-ad-render'); + }); + var UG = function (a, b, c, d, e) { + Y.call(this, 920); + this.P = b; + this.Aa = d; + this.K = e; + this.C = U(this); + this.o = V(this, a); + this.B = W(this, c); + this.l = _.bf[148] && _.H(ss); + }; + _.O(UG, Y); + UG.prototype.j = function () { + var a, b, c, d, e, f, g, h, k, l, m, n, q, u, B, x, z, C = window.pbjs; + of('hbm_bca', function (aa) { + df(aa); + var X = (0, F.H)(C), S, ca, ka, ea = new v.Map(); + X = _.y(_.t(Object, 'entries').call(Object, null !== (S = X.bidderSettings) && void 0 !== S ? S : {})); + for (S = X.next(); !S.done; S = X.next()) { + var xa = _.y(S.value); + S = xa.next().value; + xa = xa.next().value; + try { + var hb = null === (ca = xa.bidCpmAdjustment) || void 0 === ca ? void 0 : ca.call(xa, 1); + void 0 !== hb && ea.set(S, hb); + } catch (Pa) { + ea.set(S, 'err_' + (null === (ka = Pa) || void 0 === ka ? void 0 : ka.message)); + } + } + ca = _.y(_.t(ea, 'entries').call(ea)); + for (ka = ca.next(); !ka.done; ka = ca.next()) + ea = _.y(ka.value), ka = ea.next().value, ea = ea.next().value, I(aa, ka, ea); + }, { pa: C ? _.zc(ps) : 0 }); + if (!_.H(vs) && !_.H(us)) + if (this.l) + null === (b = null === (a = window.console) || void 0 === a ? void 0 : a.log) || void 0 === b ? void 0 : b.call(a, '[GPT] metadata debug: disabled by configuration'); + else { + jv(this.C); + return; + } + if (_.H(us) && (null === (d = null === (c = this.B.value) || void 0 === c ? void 0 : c[this.Aa]) || void 0 === d || !d.Wd)) + if (this.l) + null === (f = null === (e = window.console) || void 0 === e ? void 0 : e.log) || void 0 === f ? void 0 : f.call(e, '[GPT] metadata debug: collection not enabled'); + else { + jv(this.C); + return; + } + if (null === C || void 0 === C || !C.libLoaded) + if (this.l) + null === (h = null === (g = window.console) || void 0 === g ? void 0 : g.log) || void 0 === h ? void 0 : h.call(g, '[GPT] metadata debug: prebid not loaded'); + else { + jv(this.C); + return; + } + if ('function' !== typeof (null === C || void 0 === C ? void 0 : C.getEvents)) + if (Lh().error(VE()), this.l) + null === (l = null === (k = window.console) || void 0 === k ? void 0 : k.log) || void 0 === l ? void 0 : l.call(k, '[GPT] metadata debug: events unavailable'); + else { + jv(this.C); + return; + } + var D = _.H(rs) ? VG(this, C) : WG(this, C); + if (D) + if (this.l) { + null === (n = null === (m = window.console) || void 0 === m ? void 0 : m.group) || void 0 === n ? void 0 : n.call(m, '[GPT] metadata debug for ' + this.o.value.length + ' slots'); + for (var J = 0; J < this.o.value.length; J++) { + var T = new Co(); + pp(D[J], T); + T = Eb(Go(T), 3); + null === (u = null === (q = window.console) || void 0 === q ? void 0 : q.log) || void 0 === u ? void 0 : u.call(q, '[GPT] slot ' + this.o.value[J] + ': http://go/metadata-debug/' + T); + } + null === (B = window.console) || void 0 === B ? void 0 : B.groupEnd(); + jv(this.C); + } else + this.C.j(D); + else + this.l ? (null === (z = null === (x = window.console) || void 0 === x ? void 0 : x.log) || void 0 === z ? void 0 : z.call(x, '[GPT] metadata debug: no bidding data'), jv(this.C)) : this.C.j([]); + }; + UG.prototype.M = function (a) { + this.A(a); + }; + UG.prototype.A = function (a) { + Lh().error(WE(a.message)); + jv(this.C); + }; + var WG = function (a, b) { + var c, d = b ? null !== (c = (0, F.H)(b.getEvents)().filter(function (f) { + var g; + return 'auctionEnd' === f.eventType && (null === (g = f.args) || void 0 === g ? void 0 : g.auctionId); + })) && void 0 !== c ? c : [] : [], e = !1; + b = a.o.value.map(function (f) { + var g, h, k, l, m, n, q = new op(), u = f.getAdUnitPath(), B = null !== (g = XG.get(f)) && void 0 !== g ? g : 0, x = null !== (h = d.filter(function (X) { + var S, ca, ka, ea, xa; + return Number(null === (S = X.args) || void 0 === S ? void 0 : S.timestamp) > B && ((null === (ka = null === (ca = X.args) || void 0 === ca ? void 0 : ca.adUnitCodes) || void 0 === ka ? void 0 : _.t(ka, 'includes').call(ka, f.getDomId())) || (null === (xa = null === (ea = X.args) || void 0 === ea ? void 0 : ea.adUnitCodes) || void 0 === xa ? void 0 : _.t(xa, 'includes').call(xa, u))); + })) && void 0 !== h ? h : []; + if (!x.length) + return q; + var z = x.reduce(function (X, S) { + return Number(S.args.timestamp) > Number(X.args.timestamp) ? S : X; + }), C = null === (k = null === z || void 0 === z ? void 0 : z.args) || void 0 === k ? void 0 : k.auctionId; + if (!C) + return q; + var D = null !== (n = null === (m = null === (l = z.args) || void 0 === l ? void 0 : l.bidsReceived) || void 0 === m ? void 0 : m.filter(function (X) { + return X.adUnitCode === f.getDomId() || X.adUnitCode === u; + })) && void 0 !== n ? n : []; + x = new v.Map(); + var J = null; + D = _.y(D); + for (var T = D.next(); !T.done; T = D.next()) + if (T = T.value, 'string' === typeof T.bidder) { + null !== J && void 0 !== J ? J : J = qk(q); + pk(J, f, T.adUnitCode); + var aa = ok(J, (0, F.H)(T.bidder)); + w(aa, 4, 1); + dp(aa, Dk(T, x, bh(a.P[f.getDomId()]))); + e || (e = !0); + XG.set(f, (0, F.H)(z.args.timestamp)); + } + z = uk((0, F.H)(window.pbjs), C, q, J, f); + e || (e = z); + XG.has(f) || _.zl(f, function () { + return XG.delete(f); + }); + ID(a.K, f, x); + return q; + }); + return e ? b : null; + }, VG = function (a, b) { + var c = b ? (0, F.H)(b.getEvents)() : [], d = c.filter(function (f) { + var g = f.args; + return 'auctionEnd' === f.eventType && g.auctionId; + }), e = !1; + b = a.o.value.map(function (f) { + var g, h, k, l = new op(), m = function (ca) { + return ca === f.getDomId() || ca === f.getAdUnitPath(); + }, n = null !== (g = XG.get(f)) && void 0 !== g ? g : 0, q = null !== (h = d.filter(function (ca) { + var ka, ea, xa; + return Number(null === (ka = ca.args) || void 0 === ka ? void 0 : ka.timestamp) > n && (null === (xa = null === (ea = ca.args) || void 0 === ea ? void 0 : ea.adUnitCodes) || void 0 === xa ? void 0 : _.t(xa, 'find').call(xa, m)); + })) && void 0 !== h ? h : []; + if (!q.length) + return l; + var u = null === (k = q.reduce(function (ca, ka) { + return Number(ka.args.timestamp) > Number(ca.args.timestamp) ? ka : ca; + })) || void 0 === k ? void 0 : k.args; + if (!u) + return l; + var B = void 0 === u.bidderRequests ? [] : u.bidderRequests; + q = void 0 === u.bidsReceived ? [] : u.bidsReceived; + var x = u.auctionId; + u = u.timestamp; + if (!x || void 0 == u || !B.length) + return l; + XG.has(f) || _.zl(f, function () { + return XG.delete(f); + }); + XG.set(f, u); + u = qk(l); + var z = new v.Map(), C = tg(function () { + return Ek(c, x); + }); + B = _.y(B); + for (var D = B.next(); !D.done; D = B.next()) { + var J = D.value; + D = J.bidderCode; + var T = J.timeout, aa = {}; + J = _.y(J.bids); + for (var X = J.next(); !X.done; aa = { fb: aa.fb }, X = J.next()) { + var S = X.value; + aa.fb = S.bidId; + X = S.transactionId; + S = S.adUnitCode; + aa.fb && m(S) && (e = !0, pk(u, f, S), X && !Yf(u, 4) && w(u, 4, X), S = _.t(q, 'find').call(q, function (ca) { + return function (ka) { + return ka.requestId === ca.fb; + }; + }(aa)), X = mk(u, nk(new kk(), D)), S ? (w(X, 4, 1), 'number' === typeof S.timeToRespond && rk(X, S.timeToRespond), dp(X, Dk(S, z, bh(a.P[f.getDomId()])))) : (S = C().get(aa.fb)) ? (w(X, 4, 2), rk(X, Math.round(S))) : (w(X, 4, 3), rk(X, T))); + } + } + ID(a.K, f, z); + return l; + }); + return e ? b : null; + }, XG = new v.Map(); + var YG = function (a, b, c, d, e) { + Y.call(this, 876); + this.J = a; + this.l = b; + this.o = U(this); + this.B = W(this, c); + this.G = W(this, d); + this.N = W(this, e); + }; + _.O(YG, Y); + YG.prototype.j = function () { + var a = this, b, c, d, e, f; + return ib(function (g) { + d = new bw(); + e = null === (b = a.J) || void 0 === b ? void 0 : E(b, 9); + f = a.N.value; + if (null != f) { + var h; + if (h = !e) { + var k = void 0 === k ? !1 : k; + if (lu(f)) + if (!1 === f.gdprApplies || 'tcunavailable' === f.tcString || void 0 === f.gdprApplies && !k || 'string' !== typeof f.tcString || !f.tcString.length) + var l = !0; + else { + l = void 0 === l ? '755' : l; + b: { + if (f.publisher && f.publisher.restrictions && (h = f.publisher.restrictions['1'], void 0 !== h)) { + h = h[void 0 === l ? '755' : l]; + break b; + } + h = void 0; + } + 0 === h ? l = !1 : f.purpose && f.vendor ? (h = f.vendor.consents, (l = !(!h || !h[void 0 === l ? '755' : l])) && f.purposeOneTreatment && 'CH' === f.publisherCC ? l = !0 : l && (l = f.purpose.consents, l = !(!l || !l['1']))) : l = !0; + } + else + l = !1; + h = l; + } + l = w(d, 5, h); + l = w(l, 2, f.tcString); + h = null !== (c = f.addtlConsent) && void 0 !== c ? c : ''; + l = w(l, 4, h); + w(l, 7, f.internalErrorState); + null != f.gdprApplies && w(d, 3, f.gdprApplies); + 'tcunavailable' === f.tcString ? a.l.info(RE('failed')) : a.l.info(RE('succeeded')); + } else + w(d, 5, !e); + a.G.value && w(d, 1, a.G.value); + null != a.B.value && w(d, 6, a.B.value); + a.o.j(d); + Lm(g); + }); + }; + var ZG = function (a, b, c, d, e, f) { + f = void 0 === f ? Mk : f; + Y.call(this, 879); + this.Aa = a; + this.o = b; + this.I = d; + this.ha = e; + this.G = f; + this.l = U(this); + this.B = null; + _.bf[260] && (this.B = V(this, c)); + }; + _.O(ZG, Y); + ZG.prototype.j = function () { + var a = this, b, c, d; + return ib(function (e) { + if (1 == e.j) { + var f = a.ha; + f = void 0 === f ? _.r.top : f; + f = pr(f, 'googlefcPresent'); + var g = a.I; + g = void 0 === g ? _.r : g; + g.googlefc && !f && a.G(a.Aa); + if (null !== (c = null === (b = a.B) || void 0 === b ? void 0 : b.value) && void 0 !== c ? !c : !Jg(a.o)) { + jv(a.l); + e.j = 0; + return; + } + return jb(e, EA(a.o, 'loaded'), 3); + } + d = e.m; + a.l.j(d); + Lm(e); + }); + }; + var $G = function (a, b, c, d) { + Y.call(this, 877); + this.Aa = a; + this.o = b; + this.G = c; + this.l = U(this); + this.B = W(this, d); + }; + _.O($G, Y); + $G.prototype.j = function () { + var a = this, b, c; + return ib(function (d) { + if (1 == d.j) + return b = a.B.value, jb(d, FA(a.o, b, a.Aa, a.G), 2); + c = d.m; + a.l.fa(c); + Lm(d); + }); + }; + var aH = function (a, b) { + Y.call(this, 874); + this.I = a; + this.l = U(this); + sv(this, b); + }; + _.O(aH, Y); + aH.prototype.j = function () { + var a = this, b, c; + return ib(function (d) { + b = new jm(a.I, -1); + _.hu(a, b); + if (!lm(b)) + return jv(a.l), d.return(); + Lh().info(QE()); + c = _.mf(661, function (e) { + a.l.fa(e); + }); + mu(b, c); + Lm(d); + }); + }; + var bH = function (a, b, c) { + Y.call(this, 875); + this.o = a; + this.I = b; + this.l = U(this); + sv(this, c); + }; + _.O(bH, Y); + bH.prototype.j = function () { + var a = this, b, c; + return ib(function (d) { + b = new km(a.I); + _.hu(a, b); + if (!mm(b)) + return jv(a.l), d.return(); + c = _.mf(660, function (e) { + e && 'string' === typeof e.uspString ? a.l.j(e.uspString) : jv(a.l); + }); + a.o.info(PE()); + vA(b, c); + Lm(d); + }); + }; + var cH = function (a) { + Y.call(this, 896); + this.o = a; + this.l = U(this); + }; + _.O(cH, Y); + cH.prototype.j = function () { + var a = this, b; + return ib(function (c) { + if (1 == c.j) + return jb(c, Kg(a.o), 2); + b = c.m; + a.l.j(b); + Lm(c); + }); + }; + var dH = function (a, b, c, d, e) { + d = void 0 === d ? Nk : d; + e = void 0 === e ? document : e; + Y.call(this, 886); + this.ca = a; + this.K = b; + this.L = c; + this.l = d; + this.W = e; + this.C = qv(this); + }; + _.O(dH, Y); + dH.prototype.j = function () { + var a = this, b, c, d, e, f, g; + return ib(function (h) { + if (1 == h.j) + return _.H(it) && 3 === bA(a.W) ? h = jb(h, new v.Promise(function (k) { + return void gA(k, a.W); + }), 2) : (h.j = 2, h = void 0), h; + if (4 != h.j) { + c = a.L; + d = c.U; + e = null !== (b = Wb(d, Ej, 5)) && void 0 !== b ? b : new Ej(); + f = Yf(e, 1) ? Yf(e, 3) && 0 !== Ch() ? (0, F.va)(G(e, 1)) * (0, F.va)(Hc(e, 3)) : G(e, 1) : null; + if (null == f) + return a.C.notify(), h.return(); + g = a.ca.every(function (k) { + return wg(rg(k)); + }); + return g ? jb(h, eH(a, f), 4) : (a.C.notify(), h.return()); + } + a.C.notify(); + Lm(h); + }); + }; + var eH = function (a, b) { + return ib(function (c) { + return c.return(new v.Promise(function (d) { + var e = a.l(function (k, l) { + k.some(function (m) { + return 0 < m.intersectionRatio; + }) && (l.disconnect(), d()); + }, b + '%'); + _.zl(a, function () { + e.disconnect(); + }); + for (var f = {}, g = _.y(a.ca), h = g.next(); !h.done; f = { hb: f.hb }, h = g.next()) + h = h.value, f.hb = rg(h), f.hb && (e.observe(f.hb), yD(a.K, h, function (k) { + return function () { + e.unobserve(k.hb); + }; + }(f))); + })); + }); + }; + var fH = function (a, b) { + Y.call(this, 944); + this.I = a; + this.l = new cw(this.I); + this.o = W(this, b); + }; + _.O(fH, Y); + fH.prototype.j = function () { + var a = this.o.value; + if (a && ew(this.l, a)) { + var b = dw(this.l, '__gpi_opt_out', a); + if (b) { + var c = new $p(); + b = w(c, 1, b); + b = w(w(b, 2, 2147483647), 3, '/'); + b = w(b, 4, this.I.location.hostname); + fw(this.l, '__gpi_opt_out', b, a); + } + } + }; + var gH = function (a, b, c) { + c = void 0 === c ? Pk : c; + Y.call(this, 883); + this.B = a; + this.G = c; + this.l = qv(this); + this.o = V(this, b); + }; + _.O(gH, Y); + gH.prototype.j = function () { + var a = this; + return ib(function (b) { + if (1 == b.j) { + if (!E(a.o.value, 5) || _.H(gl)) + return a.l.notify(), b.return(); + _.H(et) || Pz(a.B); + if (!a.G()) { + Qz(null); + b.j = 2; + return; + } + return jb(b, new v.Promise(function (c) { + return void Qz(c); + }), 2); + } + a.l.notify(); + Lm(b); + }); + }; + var hH = function (a, b, c) { + Y.call(this, 884); + this.B = a; + this.l = qv(this); + this.G = W(this, b); + this.o = V(this, c); + }; + _.O(hH, Y); + hH.prototype.j = function () { + _.Hg(Wv).storage = this.G.value; + HF(_.Hg(Wv), dw(this.B, '__gads', this.o.value)); + Dc().j(20); + Dc().j(2); + this.l.notify(); + }; + var iH = function (a, b, c) { + Y.call(this, 890); + this.o = a; + this.console = b; + this.l = W(this, c); + }; + _.O(iH, Y); + iH.prototype.j = function () { + var a = this; + Zc(this.o, this.l.value, function (b, c) { + var d, e; + rf(b, c); + null === (e = null === (d = a.console) || void 0 === d ? void 0 : d.error) || void 0 === e ? void 0 : e.call(d, c); + }); + }; + var jH = function (a, b) { + Y.call(this, 873); + this.I = a; + this.l = V(this, b); + }; + _.O(jH, Y); + jH.prototype.j = function () { + var a = this.l.value, b = this.I; + !ne()._pubconsole_disable_ && (a = wc('google_pubconsole', a, b)) && (a = a.split('|'), '1' !== a[0] && '0' !== a[0] || gi()); + }; + var kH = function (a, b, c) { + Y.call(this, 878); + this.l = a; + this.W = b; + this.L = c; + this.C = qv(this); + }; + _.O(kH, Y); + kH.prototype.j = function () { + for (var a = _.y(this.l), b = a.next(); !b.done; b = a.next()) { + b = b.value; + var c = rg(b, this.W); + if (!qg(b, this.W) && c) { + var d = this.L, e = d.U; + d = d.P[b.getDomId()]; + a: { + var f = b; + var g = this.L.P[f.getDomId()], h = Xf(g); + (f = rg(f, this.W)) && lH(this, f); + var k = g = 0; + h = _.y(h); + for (var l = h.next(); !l.done; l = h.next()) + if (l = l.value, Array.isArray(l)) { + var m = _.y(l); + l = m.next().value; + m = m.next().value; + if (!('number' !== typeof l || 'number' !== typeof m || 1 >= l || 1 >= m) && (g = g || l, k = Math.min(k || Infinity, m), l = _.Tq(this.W), f && !cj(ug(f, l)) && f.parentElement && !cj(ug(f.parentElement, l)))) { + f = [ + g, + 0 + ]; + break a; + } + } + f = g || k ? [ + g, + k + ] : null; + } + Pi(c, Ag(b), dg(e, d), f); + } + } + this.C.notify(); + }; + var lH = function (a, b) { + if (Math.random() < _.bf[23]) { + b = Qk(b); + var c = b.depth; + b = b.pe.getBoundingClientRect(); + if (0 === (null === b || void 0 === b ? void 0 : b.height)) { + var d = 0 <= b.top && b.bottom <= (_.r.innerHeight || a.W.documentElement.clientHeight); + of('gpt_not_reserved', function (e) { + df(e); + I(e, 'inViewport', d); + I(e, 'depth', c); + }, { pa: 1 }); + } + } + }; + var mH = function (a, b, c, d, e, f) { + Y.call(this, 885); + this.L = a; + this.I = b; + this.o = c; + this.B = d; + this.W = e; + this.K = f; + this.l = U(this); + }; + _.O(mH, Y); + mH.prototype.j = function () { + var a = this, b, c, d, e; + return ib(function (f) { + if (1 == f.j) { + if (!a.o) + return jv(a.l), f.return(); + b = a.o; + c = b.Aa; + d = b.ca; + return jb(f, nH(a, c, d, a.L, a.W, a.K), 2); + } + e = f.m; + a.l.j(e); + Lm(f); + }); + }; + var nH = function (a, b, c, d, e, f) { + var g, h, k, l, m, n, q, u, B, x, z, C, D, J, T, aa, X, S; + return ib(function (ca) { + switch (ca.j) { + case 1: + k = new Qc(); + _.hu(a, k); + var ka = a.L, ea = a.I, xa = new Qc(), hb = new im(ea); + _.hu(xa, hb); + var Pa = new cH(hb); + N(xa, Pa); + var Db = new ZG(b, hb, Pa.l, ea, ea.top); + N(xa, Db); + Pa = new bH(Lh(), ea, Db.l); + N(xa, Pa); + hb = new $G(b, hb, _.bf[221], Db.l); + N(xa, hb); + ea = new aH(ea, Db.l); + N(xa, ea); + ka = new YG(il(ka.U), Lh(), hb.l, Pa.l, ea.l); + N(xa, ka); + Sc(xa); + g = ka.o; + h = xa; + l = g; + m = h; + _.hu(a, m); + n = new jH(a.I, l); + N(k, n); + _.H(Ws) && (q = new fH(a.I, l), N(k, q)); + u = new gH(_.bf[150], l); + N(k, u); + B = new xj(a.I, l, u.l); + N(k, B); + x = new hH(a.B, B.C, l); + N(k, x); + _.H(Jt) || (z = new iH(ne(), a.I.console, B.C), N(k, z)); + C = new kH(c, e, d); + N(k, C); + D = new dH(c, f, d); + N(k, D); + Sc(k); + return jb(ca, v.Promise.all([ + x.l.promise, + C.C.promise, + D.C.promise + ]), 2); + case 2: + return J = c, T = F, aa = T.H, X = T, jb(ca, l.promise, 3); + case 3: + return S = aa.call(X, ca.m), jb(ca, B.C.promise, 4); + case 4: + return ca.return({ + ca: J, + la: S, + storage: ca.m + }); + } + }); + }; + var Rk = 0; + var oH = new v.WeakMap(), pH = function (a, b) { + a = [a]; + for (var c = b.length - 1; 0 <= c; --c) + a.push(typeof b[c], b[c]); + return a.join('\x0B'); + }; + var qH = function (a, b) { + b = void 0 === b ? pH : b; + var c = la(a), d = function (f) { + f = _.y(f); + f.next(); + f = Am(f); + return b(c, f); + }, e = function (f) { + var g = _.y(f); + f = g.next().value; + g = Am(g); + return a.apply(f, g); + }; + return function () { + var f = gc.apply(0, arguments), g = this || _.r, h = oH.get(g); + h || (h = {}, oH.set(g, h)); + return Zn(h, [this].concat(_.lc(f)), e, d); + }; + }(function (a) { + return (null === a || void 0 === a ? 0 : a.src) ? /^(?:https?:)?\/\/(?:www\.googletagservices\.com|securepubads\.g\.doubleclick\.net|pagead2\.googlesyndication\.com)\/tag\/js\/gpt(?:_[a-z]+)*\.js/.test(a.src) ? 0 : 1 : 2; + }, function (a, b) { + var c; + return a + '\x0B' + (null === (c = b[0]) || void 0 === c ? void 0 : c.src); + }); + var rH = function (a, b, c, d, e, f, g, h, k, l, m, n, q, u, B, x, z, C, D, J) { + this.ca = a; + this.m = b; + this.K = c; + this.ia = d; + this.la = e; + this.L = f; + this.A = g; + this.Ca = h; + this.Qa = k; + this.Pa = l; + this.T = m; + this.Wb = n; + this.oc = q; + this.yc = u; + this.G = B; + this.interestCohort = x; + this.R = z; + this.M = C; + this.l = D; + this.o = void 0 === J ? !1 : J; + this.D = []; + this.j = ''; + this.F = []; + this.B = []; + this.J = new v.Set(Yi(xt)); + }, uH = function (a) { + var b = void 0 === b ? window : b; + if (0 === a.ca.length) + return ''; + sH(a, a.ca, b); + var c, d; + b = null !== (d = null === (c = il(a.L.U)) || void 0 === c ? void 0 : E(c, 9)) && void 0 !== d && d || !E(a.la, 5) ? 'https://pagead2.googlesyndication.com/gampad/ads?' : 'https://securepubads.g.doubleclick.net/gampad/ads?'; + a.j = b; + c = a.D; + if (_.H(Zs)) + for (d = Math.random, b = c.length - 1; 0 < b; b--) { + var e = Math.floor(d() * (b + 1)), f = c[b]; + c[b] = c[e]; + c[e] = f; + } + c = _.y(c); + for (b = c.next(); !b.done; b = c.next()) + if (d = a, b = b.value, e = tH(b)) + '?' !== d.j[d.j.length - 1] && (d.j += '&'), d.j += b.$d + '=' + e; + return a.j; + }, vH = function (a, b) { + try { + var c = (0, F.H)(b.top); + var d = aw(c.document, c); + } catch (e) { + d = new _.ig(-12245933, -12245933); + } + Z(a, 'scr_x', Math.round(d.x), { qa: !0 }); + Z(a, 'scr_y', Math.round(d.y), { qa: !0 }); + }, wH = function (a, b) { + var c, d; + try { + var e = null === (d = null === (c = b.external) || void 0 === c ? void 0 : c.getHostEnvironmentValue) || void 0 === d ? void 0 : d.bind(b.external); + if (e) { + var f = parseInt(JSON.parse(e('os-mode'))['os-mode'], 10); + 0 <= f && Z(a, 'wsm', f + 1); + } + } catch (g) { + } + }, xH = function (a, b) { + if (_.H(Dt)) { + a: { + var c, d, e, f, g, h; + try { + var k = null === (d = null === (c = b.performance) || void 0 === c ? void 0 : c.getEntriesByType('navigation')) || void 0 === d ? void 0 : d[0]; + if (null === k || void 0 === k ? 0 : k.type) { + var l = null !== (e = Xz.get(k.type)) && void 0 !== e ? e : 0; + break a; + } + } catch (m) { + } + l = null !== (h = Yz.get(null === (g = null === (f = b.performance) || void 0 === f ? void 0 : f.navigation) || void 0 === g ? void 0 : g.type)) && void 0 !== h ? h : 0; + } + b = l; + 0 !== b && Z(a, 'nvt', b); + } + }, sH = function (a, b, c) { + c = void 0 === c ? window : c; + var d, e, f = c.document, g = a.L, h = g.U, k = g.P, l = g.Rb; + g = a.K.B; + Z(a, 'gdfp_req', 1, { ba: !1 }); + Z(a, 'pvsid', g); + Z(a, 'correlator', h.getCorrelator()); + Z(a, 'output', a.A, { ba: !1 }); + yH(a, ql(a.A, a.R, a.M)); + Z(a, 'impl', E(h, 6) ? 'fifs' : 'fif', { ba: !1 }); + yH(a, hl({ + sd: tk(h, 24, 0), + Wb: a.Wb, + yc: a.yc, + oc: a.oc + })); + yH(a, pl(h, a.Qa, a.Pa)); + yH(a, new v.Map([ + [ + 'eid', + { value: a.T } + ], + [ + 'debug_experiment_id', + { value: Yu().split(',') } + ] + ])); + Z(a, 'vrg', We()); + Z(a, 'ptt', 17); + yH(a, new v.Map([[ + 'co', + { + value: 0 !== tk(h, 24, 0) ? tk(h, 24, 0) : null, + options: { qa: !0 } + } + ]])); + yH(a, kl(h, a.la)); + Z(a, 'sc', _.bf[6] ? 1 : 0, { qa: !0 }); + window.postMessage && Z(a, 'sfv', Wi()); + Z(a, 'ecs', l); + zH(a, b); + AH(a); + BH(a, b); + CH(a, b); + DH(a, c); + Ve('google_preview') && Z(a, 'gct', Ue('google_preview')); + yH(a, Pg(c)); + yH(a, new v.Map([[ + 'expflags', + { value: _.bf[253] ? zu(Qs) || null : null } + ]])); + EH(a, b, c); + yH(a, dl(c)); + _.H(bl) || Z(a, 'flash', cl(), { + ba: !1, + qa: !0 + }); + FH(a, b, c); + (_.H(Ut) || Re.O().j) && Z(a, 'rumc', g, { ba: !1 }); + _.H(ht) && Z(a, 'rume', 1, { ba: !1 }); + Z(a, 'vis', bA(f), { ba: !1 }); + 0 === qH(_.bf[172]) || Z(a, 'stss', qH(_.bf[172])); + !_.H(bl) && (null === (d = _.r.navigator) || void 0 === d ? 0 : d.deviceMemory) && Z(a, 'dmc', _.r.navigator.deviceMemory); + vH(a, c); + yH(a, Yk(b, c)); + yH(a, sj(b, k, c)); + yH(a, new v.Map([[ + 'psts', + { value: DD(a.K, b) } + ]])); + f = Iu(c.document.domain, null !== (e = E(a.la, 5) && uc(c) ? c.document.cookie : null) && void 0 !== e ? e : '', c.history.length, c.screen, c.document.referrer, c); + yH(a, f.from_cookie && !E(a.la, 5) ? new v.Map() : new v.Map([ + [ + 'ga_vid', + { + value: f.vid, + options: { ba: !1 } + } + ], + [ + 'ga_sid', + { + value: f.sid, + options: { ba: !1 } + } + ], + [ + 'ga_hid', + { + value: f.hid, + options: { ba: !1 } + } + ], + [ + 'ga_fc', + { + value: f.from_cookie, + options: { ba: !1 } + } + ], + [ + 'ga_cid', + { + value: f.cid, + options: { ba: !1 } + } + ], + [ + 'ga_wpids', + { value: c.google_analytics_uacct } + ] + ])); + _.bf[221] || Z(a, 'uas', ce(c)); + _.H(al) || wH(a, c); + _.H(ws) && (Z(a, 'js', Ku(c)), Z(a, 'ms', Lu(g.toString(), c))); + GH(a, c, b); + HH(a, b, c); + yH(a, fl(a.interestCohort)); + 'runAdAuction' in navigator && 'joinAdInterestGroup' in navigator && Z(a, 'td', 1); + IH(a); + JH(a); + KH(a); + a.l && Z(a, 'cbidsp', a.l.map(function (m) { + var n = new Co(); + pp(m, n); + return Eb(Go(n), 3); + }).join('~')); + xH(a, c); + }, IH = function (a) { + var b = _.bf[251]; + b && Z(a, 'uach', wo(b, 3)); + }, JH = function (a) { + var b = JB(); + null !== b && void 0 !== b && b.length && Z(a, 'tt_state', wo(JSON.stringify(b), 3)); + }, GH = function (a, b, c) { + var d = 0 !== Ch(), e = Wf(!0, b, d).width, f = [], g = [], h = []; + if (null !== b && b != b.top) { + var k = Wf(!1, b).width; + (-12245933 === e || -12245933 === k || k < e) && h.push(8); + } + -12245933 !== e && (1.5 * e < b.document.documentElement.scrollWidth ? h.push(10) : d && 1.5 * b.outerWidth < e && h.push(10)); + c = _.y(c); + for (k = c.next(); !k.done; k = c.next()) { + d = new Cg(); + var l = rg(k.value); + k = 0; + var m = !1, n = !1; + if (l) { + for (var q = 0, u = l; u && 100 > q; q++, u = u.parentElement) { + var B = ug(u, b); + if (B) { + var x = B, z = x.display, C = x.overflowX; + if ('visible' !== x.overflowY && (d.set(2), (x = lg(u)) && (k = k ? Math.min(k, x.width) : x.width), d.get(9))) + break; + cj(B) && d.set(9); + 'none' === z && d.set(7); + 'IFRAME' === u.nodeName && (B = parseInt(B.width, 10), B < e && (d.set(8), k = k ? Math.min(B, k) : B)); + n || (n = 'scroll' === C || 'auto' === C); + m || (m = 'flex' === z); + } else + d.set(3); + } + n && m && (l = l.getBoundingClientRect().left, (l > e || 0 > l) && d.set(11)); + } else + d.set(1); + l = _.y(h); + for (m = l.next(); !m.done; m = l.next()) + d.set(m.value); + f.push(Dg(d)); + g.push(k); + } + Z(a, 'fws', f); + Z(a, 'ohw', g); + }, HH = function (a, b, c) { + try { + var d = (0, F.H)(c.top), e = aw(d.document, d).y; + Z(a, 'btvi', b.map(function (f) { + var g, h = a.L, k = h.U; + h = h.P[f.getDomId()]; + f = null === (g = yg(f, h, c.document, dg(k, h))) || void 0 === g ? void 0 : g.y; + k = Wf(!0, c).height; + return void 0 === f || -12245933 === f || -12245933 === k ? -1 : f < e + k ? 0 : ++LH; + }), { + qa: !0, + ya: '|' + }); + } catch (f) { + } + }, MH = function (a, b) { + var c = a.L.P; + return a.m ? b.map(function (d) { + var e = c[d.getDomId()]; + e = bg(e); + if (d = a.K.j.get(d)) + d.Ya = e; + return e; + }).join(',') : b.map(function (d) { + var e = a.L.P[d.getDomId()]; + e = ek(a.K, d) || bg(e, E(a.L.U, 6) || E(e, 17) ? null : rg(d)); + if (d = a.K.j.get(d)) + d.Ya = e; + return e; + }).join(','); + }, FH = function (a, b, c) { + c = void 0 === c ? window : c; + var d = Ve('google_preview'), e = c.document, f = d ? Te(e.URL) : e.URL; + e = d ? Te(e.referrer) : e.referrer; + d = !1; + var g; + b = a.m ? vl(a.L.U) : null !== (g = wl(a.L.P[b[0].getDomId()])) && void 0 !== g ? g : vl(a.L.U); + if (null != b) { + var h = f; + fg(c) || (e = '', d = !_.H(yt) || !a.K.nb); + } else + b = f; + f = ul(c); + Z(a, 'nhd', f || null); + Z(a, 'url', b); + g = _.bf[252] || {}; + g.url = b; + _.bf[252] = g; + null != h && h !== b && Z(a, 'loc', h); + Z(a, 'ref', e); + if (f) { + var k, l, m; + h = bc(c.top) && (null === (m = null === (l = c.top) || void 0 === l ? void 0 : l.location) || void 0 === m ? void 0 : m.href); + l = null === (k = c.location) || void 0 === k ? void 0 : k.ancestorOrigins; + (k = h || be(c) || (null === l || void 0 === l ? void 0 : l[l.length - 1]) || '') && Z(a, 'top', d ? Zq(k.match(_.Yq)[3] || null) : k); + Z(a, 'etu', a.K.nb); + } + Z(a, 'scar', a.G); + }, BH = function (a, b) { + var c = a.L.P, d = b = b.map(function (e) { + e = c[e.getDomId()]; + return sl(e).join('&'); + }); + d.join('|').length === b.length - 1 && (d = null); + Z(a, 'prev_scp', d, { ya: '|' }); + }, AH = function (a) { + var b = a.L.U; + 1 !== tk(b, 24, 0) && Yf(b, 16) && Z(a, 'ppid', G(b, 16), { qa: !0 }); + }, CH = function (a, b) { + var c = a.L, d = c.U, e = c.P[b[0].getDomId()]; + c = 1 !== a.Ca; + e = !!E(e, 17); + b = xl(b, a.L); + d = E(d, 27) || !1; + var f = 3 === a.Ca, g = new Cg(); + g.set(0, c); + g.set(1, e); + g.set(2, b); + g.set(3, d); + g.set(4, f); + c = Dg(g); + 0 < c && Z(a, 'eri', c); + }, DH = function (a, b) { + var c = a.L.U, d = tl(c); + Z(a, 'cust_params', d, { ya: '&' }); + d = a.ia; + var e = a.la, f = vl(c); + if (0 === tk(c, 24, 0) && d) { + var g = null === d || void 0 === d ? void 0 : dw(d, '__gads', e), h = v.Map, k = [ + 'cookie_enabled', + { + value: !g && (null === d || void 0 === d ? 0 : ew(d, e)) ? '1' : null, + options: { qa: !0 } + } + ], l = b.document; + b = [ + 'cdm', + { value: (f || gg(b)) === l.URL ? '' : l.domain } + ]; + f = _.H(Wj) && _.H(Ws) ? (f = dw(d, '__gpi', e)) && !_.t(f, 'includes').call(f, '&') ? f : null : null; + d = new h([ + [ + 'cookie', + { + value: g, + options: { qa: !0 } + } + ], + k, + b, + [ + 'gpic', + { value: f } + ], + [ + 'gpico', + { value: _.H(Wj) && '1' === dw(d, '__gpi_opt_out', e) ? '1' : null } + ] + ]); + } else + d = new v.Map(); + yH(a, d); + (c = G(c, 8)) ? (50 < c.length && (c = c.substring(0, 50)), c = 'a ' + wo('role:1 producer:12 loc:"' + c + '"')) : c = ''; + c && Z(a, 'uule', c); + c = new Cg(); + _.r.SVGElement && _.r.document.createElementNS && c.set(0); + d = or(); + d['allow-top-navigation-by-user-activation'] && c.set(1); + d['allow-popups-to-escape-sandbox'] && c.set(2); + _.r.crypto && _.r.crypto.subtle && c.set(3); + _.r.TextDecoder && _.r.TextEncoder && c.set(4); + c = Dg(c); + Z(a, 'bc', c); + }, NH = function (a, b) { + var c = a.L, d = c.P, e = new v.Map(); + c = _.y(Ub(c.U, fh, 14)); + for (var f = c.next(); !f.done; f = c.next()) { + var g = f.value; + e.set((0, F.H)(ch(g)), [Oh(g, 2)[0]]); + } + for (c = 0; c < b.length; c++) { + g = d[b[c].getDomId()]; + if (!g) + return; + g = _.y(Ub(g, fh, 3)); + for (f = g.next(); !f.done; f = g.next()) { + var h = f.value; + f = (0, F.H)(ch(h)); + var k = e.get(f) || []; + h = Oh(h, 2)[0]; + 1 === b.length ? k[0] = h : h !== k[0] && (k[c + 1] = h); + e.set(f, k); + } + } + b = []; + d = _.y(_.t(e, 'keys').call(e)); + for (c = d.next(); !c.done; c = d.next()) + g = c.value, c = JD()[g], g = e.get(g), c && g && (1 < g.length ? (g = g.map(function (l) { + return encodeURIComponent(l || ''); + }).join(), b.push(c + ',' + g)) : 1 === g.length && 'url' !== c && Z(a, c, g[0])); + b.length && Z(a, 'sps', b.join('|')); + }, EH = function (a, b, c) { + var d; + if (_.H(at)) { + var e = vl(a.L.U), f = new v.Map([[ + 'dt', + { + value: new Date().getTime(), + options: { ba: !1 } + } + ]]); + e || f.set('lmt', { value: Br(c.document) }); + e = Rk; + var g = Hk(c); + 0 < g && e >= g && (f.set('dlt', { + value: g, + options: { ba: !1 } + }), f.set('idt', { + value: e - g, + options: { ba: !1 } + })); + yH(a, f); + } else { + vl(a.L.U) || (e = Br(c.document), Z(a, 'lmt', e ? e.toString() : null)); + Z(a, 'dt', new Date().getTime(), { ba: !1 }); + try { + e = Rk, f = Hk(), 0 < f && e >= f && (Z(a, 'dlt', f, { ba: !1 }), Z(a, 'idt', e - f, { ba: !1 })); + } catch (q) { + Z(a, 'idt', -9, { ba: !1 }), q instanceof Error && rf(479, q); + } + } + if (null !== (d = OH) && void 0 !== d) + d; + else { + a: { + f = c.navigator; + e = c.document; + g = f.userAgent; + var h = f.platform, k = /WebKit\/(\d+)/, l = /rv:(\d+\.\d+)/, m = /rv:1\.8([^.]|\.0)/; + if (/Win|Mac|Linux|iPad|iPod|iPhone/.test(h) && !/^Opera/.test(g) && (k = (k.exec(g) || [ + 0, + 0 + ])[1], l = (l.exec(g) || [ + 0, + 0 + ])[1], /Win/.test(h) && /Trident/.test(g) && 11 <= e.documentMode || !k && 'Gecko' === f.product && 27 <= l && !m.test(g) || 536 <= k)) { + f = !0; + break a; + } + f = !1; + } + e = Ju(c, c.document, 500, 300); + OH = f && !e; + } + OH || Z(a, 'ea', '0', { qa: !0 }); + f = c.document; + h = Fr(cs()); + e = h.location.href; + h == h.top ? e = { + url: e, + Oc: !0 + } : (g = !1, (m = h.document) && m.referrer && (e = m.referrer, h.parent == h.top && (g = !0)), (h = h.location.ancestorOrigins) && (h = h[h.length - 1]) && -1 == e.indexOf(h) && (g = !1, e = h), e = { + url: e, + Oc: g + }); + f = Ju(cs(), f, c.google_ad_width, c.google_ad_height); + e = e.Oc; + g = cs(); + g = g.top == g ? 0 : bc(g.top) ? 1 : 2; + h = 4; + f || 1 != g ? f || 2 != g ? f && 1 == g ? h = 7 : f && 2 == g && (h = 8) : h = 6 : h = 5; + e && (h |= 16); + f = '' + h; + e = cs(); + if (e != e.top) + for (; e && e != e.top && bc(e) && !e.sf_ && !e.$sf && !e.inGptIF && !e.inDapIF; e = e.parent); + Z(a, 'frm', f || null); + if (f = Wf(!0, c)) + a.L.eb = f, Z(a, 'biw', f.width), Z(a, 'bih', f.height); + !fg(c) && (f = Wf(!1, c)) && (Z(a, 'isw', f.width), Z(a, 'ish', f.height)); + Z(a, 'oid', 2); + f = c.document; + e = []; + g = []; + m = a.L; + h = m.U; + m = m.P; + l = _.y(b); + for (k = l.next(); !k.done; k = l.next()) { + k = k.value; + var n = m[k.getDomId()]; + k = yg(k, n, f, dg(h, n)); + a.m && (k = k || new _.ig(-9, -9)); + k && (e.push(Math.round(k.x)), g.push(Math.round(k.y))); + if (!a.m) + break; + } + Z(a, 'adxs', e); + Z(a, 'adys', g); + Z(a, 'adks', MH(a, b)); + PH(a, b); + NH(a, b); + f = Ei(c); + a.o ? Z(a, 'ifi', f) : (Z(a, 'ifi', f + 1), a = c, b = b.length, b = void 0 === b ? 1 : b, a = Mr(Lr(a)) || a, a.google_unique_id = (a.google_unique_id || 0) + b); + }, zH = function (a, b) { + var c = a.L, d = c.U, e = c.P, f = b.map(function (k) { + return e[k.getDomId()]; + }); + if (_.H($s)) + yH(a, ol(b, f)); + else { + c = _.y(b); + for (var g = c.next(); !g.done; g = c.next()) + QH(a, g.value.getAdUnitPath()); + Z(a, 'iu_parts', a.F); + Z(a, 'enc_prev_ius', a.B); + Z(a, 'prev_iu_szs', f.map(function (k) { + return Zf(k); + }).join()); + f.some(function (k) { + return $f(k); + }) && (c = f.map(function (k) { + return $f(k) ? 'height' : '0'; + }), Z(a, 'fluid', c)); + } + Z(a, 'fsfs', Fg(b, function (k) { + var l; + k = e[k.getDomId()]; + return Number(null !== (l = null === k || void 0 === k ? void 0 : E(k, 12)) && void 0 !== l ? l : E(d, 13)); + })); + Z(a, 'fsbs', Fg(b, function (k) { + var l = a.L.P[k.getDomId()]; + k = a.L.U.Ba(); + l = null === l || void 0 === l ? void 0 : l.Ba(); + return (null === l || void 0 === l ? 0 : E(l, 3)) || (null === k || void 0 === k ? 0 : E(k, 3)) ? 1 : 0; + })); + yH(a, nl(a.K, b, a.o)); + yH(a, el(e[b[0].getDomId()], a.m)); + yH(a, Uk(b, e)); + yH(a, Vk(f)); + c = {}; + f = _.y(f); + for (g = f.next(); !g.done; g = f.next()) + (g = g.value.getClickUrl()) && (c[g] = (c[g] || 0) + 1); + if (!br(c)) { + f = new cf('gpt_sra_setclickurl'); + var h = []; + _.ef(c, function (k, l) { + h.push(String(l.length) + ':' + String(k)); + }); + I(f, 'lenfreqs', h.join()); + df(f); + ff(f, _.bf[58]); + } + _.H(zt) && Z(a, 'didk', b.map(function (k) { + return ag(k.getDomId()); + }).join('~')); + }, RH = function (a, b) { + b = _.y(b); + for (var c = b.next(); !c.done; c = b.next()) + if (c = c.value, '' !== c) { + for (var d = !1, e = _.y(a.F), f = e.next(); !f.done; f = e.next()) + if (c === f.value) { + d = !0; + break; + } + d || a.F.push(c); + } + }, SH = function (a, b) { + for (var c = '', d = 0; d < b.length; d++) { + if (0 < d) + c += '/'; + else if ('' === b[0]) + continue; + for (var e = 0; e < a.F.length; e++) + if (b[d] === a.F[e]) { + c += e; + break; + } + } + return c; + }, QH = function (a, b) { + var c = ''; + '' !== b && (b = b.split('/').map(function (d) { + return d.replace(/,/g, ':'); + }), RH(a, b), c = SH(a, b)); + a.B.push(c); + }, PH = function (a, b) { + b = b.map(function (c) { + var d; + return null !== (d = GD(a.K, c)) && void 0 !== d ? d : []; + }); + Z(a, 'ucis', b, { ya: '|' }); + }, KH = function (a) { + if (!_.H(Kt)) { + var b; + if (b = tc(a.la, window)) { + var c = new Op(), d = _.zc(Nt), e = [], f = RegExp('^_GESPSK-(.+)$'); + try { + for (var g = 0; g < b.length; g++) { + var h = (f.exec(b.key(g)) || [])[1]; + h && e.push(h); + } + } catch (k) { + } + e = _.y(e); + for (f = e.next(); !f.done; f = e.next()) + if (f = f.value, g = $c().get(f, b), g.getError()) + Ec(g.getError(), f, g.errorMessage); + else if (g = g.Ub) + if (h = ad(g), 0 === h || 1 === h) + h = G(g, 2), 0 <= d && h && h.length > d ? Ec(12, f) : (gh(c, 2, Sp, g), Ec(19, f)); + b = Ub(c, Sp, 2).length ? Eb(Yo(c, Tp), 2) : null; + } else + b = null; + Z(a, 'a3p', b); + } + }, Z = function (a, b, c, d) { + d = void 0 === d ? {} : d; + a.J.has(b) || null == c || a.D.push({ + $d: b, + value: c, + options: d + }); + }, yH = function (a, b) { + b = _.y(_.t(b, 'entries').call(b)); + for (var c = b.next(); !c.done; c = b.next()) { + var d = _.y(c.value); + c = d.next().value; + d = d.next().value; + Z(a, c, d.value, d.options); + } + }, tH = function (a) { + var b = a.value, c = a.options, d = void 0 === c.ba ? !0 : c.ba; + a = void 0 === c.ya ? ',' : c.ya; + c = void 0 === c.qa ? !1 : c.qa; + return 'object' !== typeof b ? null == b || !c && 0 === b ? null : yl(b, d) : Array.isArray(b) && b.length ? b.map(function (e) { + return yl(e, d); + }).join(yl(a, d)) : null; + }, LH = 0, OH = null; + var TH = function (a, b, c, d, e, f, g, h, k, l, m, n, q, u, B, x, z, C, D, J) { + Y.call(this, 798); + this.K = a; + this.L = b; + this.B = c; + this.Y = d; + this.V = e; + this.Ca = f; + this.Qa = g; + this.Pa = h; + this.$ = l; + this.o = m; + this.C = U(this); + this.na = V(this, n); + this.Z = V(this, q); + this.G = V(this, k); + this.N = rv(this, u); + this.J = rv(this, B); + this.da = V(this, x); + this.ea = V(this, z); + this.ka = V(this, C); + this.l = W(this, D); + sv(this, J); + }; + _.O(TH, Y); + TH.prototype.j = function () { + for (var a = this, b = new v.Map(), c = _.y(this.Z.value), d = c.next(); !d.done; d = c.next()) + d = d.value, b.set(d, this.V ? UH(this, d) : function () { + return a.na.value; + }); + this.C.j(b); + }; + var UH = function (a, b) { + return tg(function () { + var c, d = new bw(); + d = new rH([b], !1, a.K, a.B, d, a.L, a.Y, a.Ca, a.Qa, a.Pa, a.G.value, a.da.value, a.ea.value, a.ka.value, null !== (c = a.N.value) && void 0 !== c ? c : '0', a.J.value, a.$, a.o, a.l.value, !0); + return Se(uH(d)); + }); + }; + var VH = new v.Map(), WH = function (a, b) { + b = void 0 === b ? VH : b; + Y.call(this, 834); + this.ca = a; + this.l = b; + this.o = U(this); + this.B = v.Promise.all(this.ca.map(this.G, this)); + }; + _.O(WH, Y); + WH.prototype.j = function () { + var a = this, b; + return ib(function (c) { + if (1 == c.j) + return jb(c, a.B, 2); + b = c.m; + a.o.j(b.filter(function (d) { + return null != d && !d.m; + })); + Lm(c); + }); + }; + WH.prototype.G = function (a) { + var b = this, c, d, e; + return ib(function (f) { + if (1 == f.j) { + c = 1000 * _.zc(rt); + if (a.m) + return f.return(null); + if (0 >= c) + return f.return(a); + b.l.has(a) || (b.l.set(a, Al(c, a)), _.zl(a, function () { + return void b.l.delete(a); + })); + d = (0, F.H)(b.l.get(a)); + return jb(f, d(), 2); + } + e = f.m; + if (b.m) + return f.return(null); + if (e) + return f.return(a); + M(Lh(), UE(a.getAdUnitPath())); + return f.return(null); + }); + }; + var XH = function (a, b, c) { + Y.call(this, 936); + this.o = a; + this.C = U(this); + this.l = W(this, b); + this.B = W(this, c); + }; + _.O(XH, Y); + XH.prototype.j = function () { + var a, b; + this.C.j([].concat(_.lc(this.o), _.lc(null !== (a = this.l.value) && void 0 !== a ? a : []), _.lc(null !== (b = this.B.value) && void 0 !== b ? b : []))); + }; + var YH = function (a, b, c, d, e, f, g, h, k, l, m, n) { + Y.call(this, 866); + this.N = a; + this.V = b; + this.J = c; + this.l = e; + this.G = f; + this.W = g; + this.C = qv(this); + this.B = V(this, h); + this.Z = V(this, k); + sv(this, l); + this.Y = V(this, m); + this.o = V(this, n); + }; + _.O(YH, Y); + YH.prototype.j = function () { + var a = this, b, c, d, e, f, g, h, k, l, m; + return ib(function (n) { + if (1 == n.j) { + c = a.Z.value; + if (!c) + return a.C.notify(), n.return(); + d = _.Oi('LINK'); + (/^https:/.test(c) || _.bf[257]) && Dq(d, new id(c, ld), 'webbundle'); + null === (b = d.resources) || void 0 === b ? void 0 : b.add(Xa(a.G).toString()); + d.crossOrigin = a.Y.value ? 'use-credentials' : 'anonymous'; + e = _.Oi('SCRIPT'); + bb(e, a.G); + a.W.head.appendChild(d); + a.W.head.appendChild(e); + a.C.notify(); + return jb(n, ZH(a), 2); + } + f = n.m; + g = f.kd; + h = f.Xd; + _.H(As) && delete ne()[a.l.replace('googletag.', '')]; + d.resources.remove(d.resources[0]); + if (g.length !== h.length) + return a.V(new dv('Received ' + g.length + ' but ' + h.length + ' metadatas')), n.return(); + for (k = 0; k < g.length; k++) + l = g[k], m = h[k], l && d.resources.add(l), a.N(k, m, { + kind: 1, + url: l + }, a.B.value, a.o.value); + d.resources.length || d.remove(); + a.J(g.length - 1, a.B.value, a.o.value); + Lm(n); + }); + }; + var ZH = function (a) { + var b = ne(), c = a.l.replace('googletag.', ''); + return new v.Promise(function (d) { + var e = !1; + Object.defineProperty(b, c, { + value: function (f, g) { + e || d({ + kd: f, + Xd: g + }); + e = !0; + }, + writable: !1, + enumerable: !1, + configurable: !0 + }); + }); + }; + var $H = function (a, b, c, d, e, f) { + Y.call(this, 810); + this.o = a; + this.J = b; + this.L = c; + this.G = d; + this.I = e; + this.l = U(this); + this.B = V(this, f); + }; + _.O($H, Y); + $H.prototype.j = function () { + var a = this, b = this.o; + !this.J && 1 < this.o.length && (b = [b[0]]); + b = b.filter(function (c) { + var d = a.L.P[c.getDomId()]; + if (Jf(a.I) && 4 === Nf(d)) { + M(Lh(), LE('googletag.enums.OutOfPageFormat.REWARDED', String(c.getAdUnitPath()))); + var e = !0; + } else + e = !1; + return !e && !Pf(c, d, a.I, a.B.value); + }); + 30 < b.length && (M(this.G, HE('30', String(b.length), String(b.length - 30))), b = b.slice(0, 30)); + this.l.j(b); + }; + var aI = function (a) { + Y.call(this, 826); + this.K = a; + this.C = U(this); + }; + _.O(aI, Y); + aI.prototype.j = function () { + var a = this, b, c; + return ib(function (d) { + if (1 == d.j) + return b = a.C, c = b.fa, jb(d, a.K.A, 2); + c.call(b, d.m); + Lm(d); + }); + }; + aI.prototype.A = function () { + jv(this.C); + }; + var bI = function (a) { + Y.call(this, 802); + this.I = a; + this.l = U(this); + }; + _.O(bI, Y); + bI.prototype.j = function () { + var a = this, b, c, d, e, f; + return ib(function (g) { + if (1 == g.j) { + if (!_.H(Ss)) + return a.l.j(''), g.return(); + c = _.zc(Rs); + d = 0 < c ? new v.Promise(function (h) { + return void setTimeout(function () { + return void h('0'); + }, c); + }) : Jd(a.I); + if (!d) { + a.l.j(''); + g.j = 0; + return; + } + g.F = 3; + return jb(g, d, 5); + } + if (3 != g.j) + return e = null !== (b = g.m) && void 0 !== b ? b : '0', e.length > _.zc(Us) && (rf(a.id, new vh('ML:' + (_.H(Ts) ? e : e.length))), e = '0'), a.l.j(e), lb(g, 0); + f = mb(g); + rf(a.id, f); + a.l.j('0'); + Lm(g); + }); + }; + bI.prototype.A = function () { + this.l.j(''); + }; + var cI = function (a, b, c, d) { + Y.call(this, 847); + this.K = a; + this.o = b; + this.B = c; + this.l = U(this); + this.G = V(this, d); + }; + _.O(cI, Y); + cI.prototype.j = function () { + var a = this.G.value; + if (a.length) { + for (var b = _.y(a), c = b.next(); !c.done; c = b.next()) + FD(this.K, c.value); + this.B ? jv(this.l) : this.o ? (b = Pe(a[0].getAdUnitPath()), a = dI(a, b), this.l.j(a)) : (a = a.map(function (d) { + return { + Aa: Pe(d.getAdUnitPath()), + ca: [d] + }; + }), this.l.j(a)); + } else + jv(this.l); + }; + var dI = function (a, b) { + var c = []; + a = sa(a, function (f) { + return Pe(f.getAdUnitPath()); + }); + a = _.y(_.t(Object, 'entries').call(Object, a)); + for (var d = a.next(); !d.done; d = a.next()) { + var e = _.y(d.value); + d = e.next().value; + e = e.next().value; + d === b ? c.unshift({ + Aa: d, + ca: e + }) : c.push({ + Aa: d, + ca: e + }); + } + return c; + }; + var eI = function (a, b) { + Y.call(this, 845); + this.P = a; + this.l = U(this); + this.o = U(this); + this.B = V(this, b); + }; + _.O(eI, Y); + eI.prototype.j = function () { + var a = this, b = function (d) { + d = a.P[d.getDomId()]; + return !!Xf(d).length || Yf(d, 16); + }, c = this.B.value; + this.l.j(c.filter(b)); + this.o.j(c.filter(Un(b))); + }; + var fI = function (a, b) { + Y.call(this, 919); + this.o = a; + this.C = U(this); + this.l = V(this, b); + }; + _.O(fI, Y); + fI.prototype.j = function () { + var a, b = !(null === (a = this.o) || void 0 === a ? 0 : E(a, 9)) && !!E(this.l.value, 5); + this.C.j(b); + }; + var gI = function (a, b, c, d, e) { + Y.call(this, 935); + this.K = a; + this.L = b; + this.W = c; + this.C = qv(this); + this.l = V(this, d); + sv(this, e); + }; + _.O(gI, Y); + gI.prototype.j = function () { + var a = this.L, b = a.U; + a = a.P; + for (var c = _.y(this.l.value), d = c.next(); !d.done; d = c.next()) { + d = d.value; + var e = a[d.getDomId()], f = this.W; + f = void 0 === f ? document : f; + mi(e, b) && !this.K.Ta(d) && pi(d, f, e, b); + } + this.C.notify(); + }; + var hI = function (a, b, c, d) { + Y.call(this, 864); + this.K = a; + this.L = b; + this.W = c; + this.l = qv(this); + this.o = V(this, d); + }; + _.O(hI, Y); + hI.prototype.j = function () { + for (var a = _.y(this.o.value), b = a.next(); !b.done; b = a.next()) + if (b = b.value, _.AD(this.K, b)) { + var c = this.L, d = c.U; + c = c.P[b.getDomId()]; + mi(c, d) && pi(b, this.W, c, d); + FD(this.K, b); + var e = void 0, f = void 0; + null !== (e = null !== (f = E(c, 10)) && void 0 !== f ? f : E(d, 11)) && void 0 !== e && e && pi(b, this.W, c, d); + } + this.l.notify(); + }; + var iI = function (a, b, c, d, e, f) { + f = void 0 === f ? Xd : f; + Y.call(this, 939); + this.B = a; + this.ic = b; + this.I = c; + this.o = f; + this.l = V(this, d); + sv(this, e); + }; + _.O(iI, Y); + iI.prototype.j = function () { + if (E(this.l.value, 5)) { + var a = this.o, b = this.I, c = new Vl(); + var d = new Wl(); + d = Qb(d, 1, String(this.B), ''); + c = zf(c, 5, d); + c = Qb(c, 4, 1, 0); + c = Qb(c, 2, 2, 0); + c = Qb(c, 3, this.ic, ''); + a.call(this, b, Jk(c, 6, !0)); + } + }; + var jI = function (a, b, c, d) { + Y.call(this, 905); + this.L = a; + this.l = b; + this.C = qv(this); + this.o = V(this, c); + sv(this, d); + }; + _.O(jI, Y); + jI.prototype.j = function () { + for (var a, b = _.y(this.o.value), c = b.next(); !c.done; c = b.next()) + switch (null === (a = this.L.P[c.value.getDomId()]) || void 0 === a ? void 0 : Nf(a)) { + case 2: + case 3: + case 5: + this.l.load(_.lG); + return; + } + this.C.notify(); + }; + var kI = function (a, b, c, d) { + Y.call(this, 833); + this.l = a; + this.o = b; + this.I = c; + this.C = qv(this); + sv(this, d); + }; + _.O(kI, Y); + kI.prototype.j = function () { + if ('wbn' !== this.l) { + var a = this.o, b = this.I, c = rD(), d; + c = { + version: Wi(), + Tb: c + }; + c = oB.Rd(c); + for (var e = b, f = 0; e !== e.parent;) + f++, e = e.parent; + c = f ? hc(c, new v.Map([[ + 'n', + String(f) + ]])) : c; + e = Yi(Zi); + f = new v.Map(); + for (var g = 0; g < e.length; g += 2) + f.set(e[g], e[g + 1]); + c = hc(c, f); + a.resources[c.toString()] || (null === (d = ne()) || void 0 === d ? 0 : d.fifWin) || (a.resources[c.toString()] = 1, b = b.document, a = _.Oi('IFRAME'), a.src = Za(c), a.style.visibility = 'hidden', a.style.display = 'none', b = b.getElementsByTagName('script'), b.length && (b = b[b.length - 1], b.parentNode && b.parentNode.insertBefore(a, b.nextSibling))); + } + this.C.notify(); + }; + var lI = function (a, b, c, d) { + Y.call(this, 928); + this.K = a; + this.context = b; + this.C = qv(this); + this.l = V(this, c); + sv(this, d); + }; + _.O(lI, Y); + lI.prototype.j = function () { + this.K.l(); + var a = this.context, b = this.l.value.length; + if (a.Bc) { + var c = a.sb; + a = Gk(a); + var d = new su(); + b = Qb(d, 1, b, 0); + b = Ee(a, 7, Kk, b); + nc(c, b); + } + this.C.notify(); + }; + var mI = function (a, b, c) { + Y.call(this, 867); + this.ma = a; + this.L = b; + this.C = qv(this); + this.l = V(this, c); + }; + _.O(mI, Y); + mI.prototype.j = function () { + for (var a = _.y(this.l.value), b = a.next(); !b.done; b = a.next()) { + var c = _.y(b.value); + b = c.next().value; + c = c.next().value; + var d = G(this.L.P[b.getDomId()], 20); + b.dispatchEvent(UC, 808, { + rd: c, + ke: d + }); + this.ma.dispatchEvent('slotRequested', 705, new nF(b, 'publisher_ads')); + } + this.C.notify(); + }; + var nI = function (a, b, c, d, e, f, g, h, k, l, m, n, q, u, B, x, z, C) { + Y.call(this, 785, _.zc(Bt)); + this.sa = a; + this.K = b; + this.da = c; + this.L = d; + this.ta = e; + this.Ca = f; + this.Qa = g; + this.Pa = h; + this.ra = l; + this.Z = m; + this.J = q; + this.yb = u; + this.l = U(this); + this.G = U(this); + this.N = U(this); + this.V = U(this); + this.$ = V(this, n); + this.na = rv(this, q); + this.o = rv(this, u); + this.ea = V(this, k); + this.B = W(this, B); + this.ka = rv(this, x); + this.Y = W(this, C); + gv(this.D, z, !0); + }; + _.O(nI, Y); + nI.prototype.j = function () { + var a = this, b, c, d, e, f, g, h, k; + return ib(function (l) { + if (1 == l.j) { + if (null === (b = a.B.value) || void 0 === b || !b.length) + return a.l.j(''), l.return(); + d = !_.H(gl); + if (d) { + ud(); + var m = wd[1]; + } else + m = ''; + e = m; + d ? (ud(), m = wd[4]) : m = ''; + f = m; + d ? (ud(), m = wd[6]) : m = ''; + g = m; + h = null !== (c = a.na.value) && void 0 !== c ? c : '0'; + a.o.value && (a.K.nb = a.o.value); + k = new rH(a.B.value, a.sa, a.K, a.da, a.$.value, a.L, a.ta, a.Ca, a.Qa, a.Pa, a.ea.value, e, f, g, h, a.ka.value, a.ra, a.Z, a.Y.value); + a.l.j(Se(uH(k))); + a.G.j(e); + a.N.j(f); + a.V.j(g); + return jb(l, a.J.promise, 2); + } + if (4 != l.j) { + if (a.m) + return l.return(); + of('gpt_paw', function (n) { + var q, u; + df(n); + I(n, 'sig', null !== (q = a.J.o) && void 0 !== q ? q : -1); + I(n, 'req', a.T); + I(n, 'req_cnt', a.K.D); + I(n, 'dm', null !== (u = window.navigator.deviceMemory) && void 0 !== u ? u : -1); + }, { pa: _.zc(Vs) }); + a.o.value ? l = jb(l, a.yb.promise, 4) : (l.j = 0, l = void 0); + return l; + } + of('gpt_etu', function (n) { + var q; + df(n); + I(n, 'sig', null !== (q = a.yb.o) && void 0 !== q ? q : -1); + I(n, 'req', a.T); + }); + Lm(l); + }); + }; + var oI = function (a, b, c, d, e) { + this.D = a; + this.l = b; + this.A = c; + this.ca = d; + this.la = e; + this.F = ''; + this.m = -1; + this.state = 1; + this.j = ''; + }, pI = function (a, b) { + a.state = 4; + try { + a.l(b); + } catch (c) { + } + }; + var qI = function (a, b, c, d, e, f, g, h, k) { + const $___old_c33a69c470a6bc31 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_f6a249458fec61a0 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_c33a69c470a6bc31) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_00465284004d4aa8.XMLHttpRequest)); + if ($___old_f6a249458fec61a0) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_00465284004d4aa8.XMLHttpRequest)); + return function () { + Y.call(this, 788); + this.J = a; + this.N = b; + this.G = c; + this.C = qv(this); + this.B = 0; + this.o = !1; + this.l = null !== k && void 0 !== k ? k : new XMLHttpRequest(); + this.Z = V(this, d); + this.$ = V(this, e); + sv(this, f); + this.Y = V(this, g); + this.V = V(this, h); + }.apply(this, arguments); + } finally { + if ($___old_c33a69c470a6bc31) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_c33a69c470a6bc31)); + if ($___old_f6a249458fec61a0) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_f6a249458fec61a0)); + } + }; + _.O(qI, Y); + qI.prototype.j = function () { + var a = this, b = this.$.value; + if (b) { + var c = new oI(this.J, this.N, this.G, this.Z.value, this.V.value); + this.l.open('GET', b); + this.l.withCredentials = this.Y.value; + NB(this.l); + this.l.onreadystatechange = function () { + rI(a, c, !1); + }; + this.l.onload = function () { + rI(a, c, !0); + }; + this.l.onerror = function () { + pI(c, new ev('XHR error')); + }; + this.l.send(); + } + this.C.notify(); + }; + var rI = function (a, b, c) { + try { + if (3 === a.l.readyState || 4 === a.l.readyState) { + if (300 <= a.l.status) { + if (a.o) + return; + pI(b, new ev('xhr_err-' + a.l.status)); + a.o = !0; + if (_.H(Ys)) + return; + } + var d = a.l.responseText.substr(a.B); + if (d && d) + if (1 !== b.state && 2 !== b.state) + pI(b, new dv('state err: (' + ([ + b.state, + b.j.length + ].join() + ')'))); + else { + b.j && (d = b.j + d); + var e = 0, f = !1; + do { + var g = d.indexOf('\n', e); + f = -1 !== g; + if (!f) + break; + var h = b, k = d.substr(e, g - e); + if (1 === h.state) + h.F = k, ++h.m, h.state = 2; + else { + try { + h.D(h.m, h.F, { + kind: 0, + wa: xr(k) + }, h.ca, h.la), h.F = ''; + } catch (l) { + } + h.state = 1; + } + e = g + 1; + } while (f && e < d.length); + b.j = d.substr(e); + } + a.B = a.l.responseText.length; + c && 4 === a.l.readyState && (1 !== b.state || b.j ? pI(b, new dv('state err (' + ([ + b.state, + b.j.length + ].join() + ')'))) : (b.state = 3, b.A(b.m, b.ca, b.la))); + } + } catch (l) { + pI(b, l); + } + }; + var sI = function (a, b, c, d) { + Y.call(this, 918); + this.L = a; + this.Wa = b; + this.C = qv(this); + this.l = V(this, d); + sv(this, c); + }; + _.O(sI, Y); + sI.prototype.j = function () { + var a = this.l.value; + a.length && cv(this.Wa, '3', (0, F.H)(G(this.L.P[a[0].getDomId()], 20))); + this.C.notify(); + }; + var tI = function (a) { + Y.call(this, 820); + this.I = a; + this.C = U(this); + }; + _.O(tI, Y); + tI.prototype.j = function () { + var a = this, b, c, d; + return ib(function (e) { + if (1 == e.j) + return _.H(Ct) ? jb(e, ae(a.I), 2) : (a.C.j(''), e.return()); + b = e.m; + c = b.nb; + d = b.status; + c || of('gpt_etu', function (f) { + df(f); + I(f, 'rsn', d); + }); + a.C.j(null !== c && void 0 !== c ? c : ''); + Lm(e); + }); + }; + var uI = function (a, b) { + Y.call(this, 858); + this.o = a; + this.C = qv(this); + this.l = V(this, b); + }; + _.O(uI, Y); + uI.prototype.j = function () { + var a = this, b, c, d, e, f, g, h; + return ib(function (k) { + switch (k.j) { + case 1: + k.F = 2; + if (LB()) + return d = !IB() && _.H(Xt) || IB() && _.H(Yt), e = _.H($t), f = new HB(!!E(a.l.value, 5), d, e), jb(k, TB(f), 7); + c = _.bf[258]; + return jb(k, c, 6); + case 6: + a.C.notify(); + k.j = 5; + break; + case 7: + a.C.notify(); + case 5: + _.H(bu) && (g = null === (b = a.o) || void 0 === b ? void 0 : E(b, 9)) && !LB() && Bc({ mc: '1' }, 'gptttmc'); + lb(k, 0); + break; + case 2: + h = mb(k), h instanceof Error && a.R(h), a.C.notify(), Lm(k); + } + }); + }; + var wI = function (a, b, c, d, e, f, g, h, k, l) { + var m = gc.apply(10, arguments); + Y.call(this, 814); + this.slotId = a; + this.L = b; + this.K = c; + this.B = d; + this.la = e; + this.ma = g; + this.W = h; + this.I = k; + this.G = l; + this.l = qv(this); + this.o = W(this, l.Nc); + this.nc = W(this, l.Mc); + m = _.y(m); + for (var n = m.next(); !n.done; n = m.next()) + sv(this, n.value); + QC(this.slotId, VC, vI); + }; + _.O(wI, Y); + wI.prototype.j = function () { + if (!(this.B || this.o.value || _.H(Xs) && this.nc.value)) { + var a = jk(this.slotId, this.K, this.L, this.G, this.W, this.la, this.ma), b, c = this.K.j.get(this.slotId); + c && (null === (b = c.xc) || void 0 === b ? void 0 : b.ua(), c.xc = a); + Sc(a); + } + this.l.notify(); + }; + var vI = _.Vn(function () { + return void Gg('gpt-first-ad-render'); + }); + var yI = function (a, b) { + Y.call(this, 804); + this.Da = b; + this.o = []; + this.metadata = { + wf: xI(this, function (c) { + return G(c, Yb(c, oq, 4)); + }), + ob: xI(this, function (c) { + return c.getHeight(); + }), + tb: xI(this, function (c) { + return c.getWidth(); + }), + Nc: xI(this, function (c) { + return E(c, 8); + }), + Gd: xI(this, function (c) { + return G(c, 10); + }), + xf: xI(this, function (c) { + return Oh(c, 15); + }), + ac: xI(this, function (c) { + return c.getEscapedQemQueryId(); + }), + ld: xI(this, function (c) { + return Wb(c, Zp, 43); + }), + yd: xI(this, function (c) { + return Wb(c, nq, Yb(c, oq, 41)); + }), + Md: xI(this, function (c) { + return E(c, 9); + }), + ye: xI(this, function (c) { + return E(c, 12); + }), + Hd: xI(this, function (c) { + return Wb(c, Mp, Yb(c, pq, 48)); + }), + Dd: xI(this, function (c) { + return Wb(c, Kp, Yb(c, pq, 39)); + }), + wb: xI(this, function (c) { + return G(c, 36); + }), + ze: xI(this, function (c) { + return E(c, 13); + }), + Mc: xI(this, function (c) { + return E(c, 3); + }), + xe: xI(this, function (c) { + return G(c, 49); + }), + Ce: xI(this, function (c) { + return G(c, 29); + }), + De: xI(this, function (c) { + return G(c, 30); + }), + Kd: xI(this, function (c) { + return Wb(c, bq, 51); + }), + Ae: xI(this, function (c) { + return E(c, 52); + }), + yb: xI(this, function (c) { + return G(c, 61); + }), + Bd: xI(this, function (c) { + return (c = Wb(c, Yp, 54)) ? Ub(c, Wp, 1).filter(function (d) { + lk(d, 1) || Ec(32, ''); + return !!lk(d, 1); + }).map(function (d) { + var e = lk(d, 2); + return { + Ga: lk(d, 1), + Sd: e && (_.t(e, 'startsWith').call(e, window.location.protocol) || _.t(e, 'startsWith').call(e, 'data:') && 40 >= e.length) ? Qa(e) : void 0 + }; + }) : []; + }), + Bf: xI(this, function (c) { + return Oh(c, 23); + }), + vf: xI(this, function (c) { + return Ub(c, $p, 14); + }), + Jf: xI(this, function (c) { + return E(c, 11); + }), + Hf: xI(this, function (c) { + return G(c, 33); + }), + rf: xI(this, function (c) { + return Oh(c, 27); + }), + ja: U(this), + ve: xI(this, function (c) { + return Wb(c, dq, 55); + }), + ue: xI(this, function (c) { + return Wb(c, kq, 58); + }), + Ee: xI(this, function (c) { + var d, e; + return null !== (e = null === (d = Wb(c, aq, 56)) || void 0 === d ? void 0 : G(d, 1)) && void 0 !== e ? e : null; + }), + be: xI(this, function (c) { + var d; + return null !== (d = Ub(c, eq, 62)) && void 0 !== d ? d : []; + }) + }; + this.l = V(this, a); + }; + _.O(yI, Y); + var xI = function (a, b) { + var c = U(a); + a.o.push({ + C: c, + Cd: b + }); + return c; + }; + yI.prototype.j = function () { + for (var a = _.y(this.o), b = a.next(); !b.done; b = a.next()) { + b = b.value; + var c = b.Cd; + b.C.fa(c(this.l.value)); + } + 0 === this.Da.kind || 1 === this.Da.kind && this.Da.url ? this.metadata.ja.j(this.Da) : (a = this.metadata.ja, b = a.j, c = this.l.value, c = G(c, Yb(c, oq, 4)), b.call(a, { + kind: 0, + wa: c || '' + })); + }; + var zI = function (a, b) { + Y.call(this, 822); + this.slotId = a; + this.l = qv(this); + this.o = V(this, b); + }; + _.O(zI, Y); + zI.prototype.j = function () { + for (var a, b = null !== (a = Oh(this.o.value, 23)) && void 0 !== a ? a : [], c = _.Hg(Ti), d = _.y(b), e = d.next(); !e.done; e = d.next()) + e = e.value, EF(c, e), FF(c, e, this.slotId); + this.l.notify(); + b.length && of('gpt_hp', function (f) { + df(f); + I(f, 'ls', b.join()); + }, { pa: _.zc(Es) }); + }; + var AI = function (a, b) { + Y.call(this, 803); + this.l = a; + this.slotId = b; + this.C = U(this); + }; + _.O(AI, Y); + AI.prototype.j = function () { + var a, b = JSON.parse(this.l), c = b ? Mg(b, Tn) : void 0; + if (!c) + throw Error('missing ad unit path'); + if (null === b || void 0 === b || !b[c]) + throw Error('invalid ad unit path: ' + c); + b = b[c]; + if (!Array.isArray(b)) + throw Error('dictionary not an array: ' + this.l); + b = new mq(b.slice()); + c = _.y(null !== (a = Oh(b, 27)) && void 0 !== a ? a : []); + for (var d = c.next(); !d.done; d = c.next()) + d = d.value, Dc().F(d); + Dc().j(4); + this.slotId.dispatchEvent(SC, 800, b); + this.C.j(b); + }; + var BI = function (a, b, c, d) { + Y.call(this, 823); + this.slotId = a; + this.L = b; + this.K = c; + this.l = qv(this); + this.o = V(this, d); + }; + _.O(BI, Y); + BI.prototype.j = function () { + var a = this, b = this.L.P[this.slotId.getDomId()]; + try { + b && (4 === Nf(b) || 5 === Nf(b) || E(this.o.value, 11)) && (_.BD(this.K, this.slotId), xD(this.K, this.slotId, function () { + _.CD(a.K, a.slotId); + })); + } finally { + this.l.notify(); + } + }; + var CI = function (a, b, c) { + Y.call(this, 821); + this.la = a; + this.o = b; + this.l = qv(this); + this.B = V(this, c); + }; + _.O(CI, Y); + CI.prototype.j = function () { + if (this.la && E(this.la, 5)) { + var a = new v.Set(), b = Ub(this.B.value, $p, 14); + b = _.y(b); + for (var c = b.next(); !c.done; c = b.next()) { + c = c.value; + var d = c.getVersion() || 1; + 1 === d ? a.has(1) || (fw(this.o, '__gads', c, this.la), a.add(d)) : _.H(Ws) && 2 === d && !a.has(2) && '1' !== dw(this.o, '__gpi_opt_out', this.la) && (fw(this.o, '__gpi', c, this.la), a.add(d)); + } + } + this.l.notify(); + }; + var DI = function () { + this.j = new v.Map(); + }, HI = function (a, b, c, d, e, f, g, h, k, l, m) { + var n = document, q = window, u = ++e.o; + EI(a, u, b, e, d).then(_.mf(872, function (B) { + if (null !== B && void 0 !== B && B.length) { + ED(e, u, B.length); + B = _.y(B); + for (var x = B.next(); !x.done; x = B.next()) + FI(a, u, x.value, d, f, n, e, q).then(_.mf(907, function (z) { + if (z) { + var C = z.ca; + z = z.la; + var D = c.Ca, J = c.Qa || NaN, T = c.Pa || NaN, aa = null, X = null, S = ++e.D, ca = window.isSecureContext && _.H(Ht) ? 'wbn' : 'ldjh'; + if ('wbn' === ca) { + aa = Array(36); + X = 0; + for (var ka, ea = 0; 36 > ea; ea++) + 8 == ea || 13 == ea || 18 == ea || 23 == ea ? aa[ea] = '-' : 14 == ea ? aa[ea] = '4' : (2 >= X && (X = 33554432 + 16777216 * Math.random() | 0), ka = X & 15, X >>= 4, aa[ea] = zG[19 == ea ? ka & 3 | 8 : ka]); + aa = ei('urn:uuid:' + aa.join('').toLowerCase()); + X = 'googletag.wbn' + S; + } + GI(a, u, C, e, ca, z, d, f, !!E(d.U, 6), D, J, T, Dc().m(), Pe(C[0].getAdUnitPath()), aa, X, n, q, g, h, k, l, m); + } + })); + } + })); + }, EI = function (a, b, c, d, e) { + var f = Ve('google_nofetch'), g, h, k, l, m; + return ib(function (n) { + return 1 == n.j ? (g = new Qc(), (0, F.jb)(!a.j.has(b)), a.j.set(b, g), h = new WH(c), N(g, h), k = new eI(e.P, h.o), N(g, k), l = new cI(d, !!E(e.U, 6), f, k.l), N(g, l), m = new hI(d, e, document, k.o), N(g, m), Sc(g), jb(n, m.l.promise, 2)) : n.return(l.l.promise); + }); + }, FI = function (a, b, c, d, e, f, g, h) { + var k, l; + return ib(function (m) { + k = new Qc(); + _.hu((0, F.H)(a.j.get(b)), k); + l = new mH(d, h, c, e, f, g); + N(k, l); + Sc(k); + return m.return(l.l.promise); + }); + }, GI = function (a, b, c, d, e, f, g, h, k, l, m, n, q, u, B, x, z, C, D, J, T, aa, X) { + var S, ca, ka, ea, xa, hb, Pa, Db, ic, kh, jc, tb, nb, Ed, ni, ln, mn, Gu, nn, Le, on, pn, qn, rn, sn, tn, Hu; + ib(function (CK) { + S = new Qc(); + _.hu((0, F.H)(a.j.get(b)), S); + ca = new vj(); + ca.j(f); + ka = new bI(C); + N(S, ka); + ea = new $H(c, k, g, Lh(), C, ca); + N(S, ea); + xa = new tI(C); + N(S, xa); + hb = new aI(d); + N(S, hb); + Pa = new uI(il(g.U), ca); + N(S, Pa); + Db = (0, F.H)(_.Hg(Ig).D); + ic = (0, F.H)(_.Hg(Ig).A); + kh = (0, F.H)(_.Hg(Ig).F); + jc = new UG(ea.l, g.P, ic, u, d); + N(S, jc); + tb = new XH(q, kh, Db); + N(S, tb); + nb = new nI(k, d, h, g, e, l, m, n, tb.C, B, x, ca, ka.l, xa.C, ea.l, hb.C, Pa.C, jc.C); + N(S, nb); + Ed = new sI(g, Re.O(), nb.l, ea.l); + N(S, Ed); + ni = new fI(il(g.U), ca); + N(S, ni); + ln = _.mf(646, function (Rb, Me, un, oi, eg) { + var Ne = function () { + return void II(eg, g, Rb, Me, un, oi, d, h, J, X); + }; + 0 < Rb && _.H(xs) ? setTimeout(Ne, 0) : Ne(); + }); + mn = _.mf(647, function (Rb, Me, un) { + var oi = function () { + var eg = Rb + 1, Ne = Me.length; + if (D.Bc) { + var Sb = D.sb, Zd = Gk(D), DK = new tu(); + eg = Qb(DK, 1, eg, 0); + Ne = Qb(eg, 2, Ne, 0); + Zd = Ee(Zd, 8, Kk, Ne); + nc(Sb, Zd); + } + for (Sb = Rb + 1; Sb < Me.length; ++Sb) + Me[Sb] && (Zd = new mq(), Zd = '{"empty":' + w(Zd, 8, !0).X() + '}', II(un, g, Sb, Zd, { + kind: 0, + wa: '' + }, Me, d, h, J, X)); + Sb = (0, F.H)(d.m.get(b)) - 1; + 0 === Sb ? d.m.delete(b) : d.m.set(b, Sb); + 0 === Sb && (Sb = a.j.get(b)) && (a.j.delete(b), Sb.ua()); + }; + _.H(xs) ? setTimeout(oi, 0) : oi(); + }); + Gu = function (Rb) { + Rb = Rb instanceof Error ? Rb : Error(); + Rb.message = Rb.message || 'strm_err'; + rf(289, Rb); + }; + nn = _.mf(289, Gu); + Le = null; + 'ldjh' === e ? Le = new qI(ln, nn, mn, ea.l, nb.l, Ed.C, ni.C, ca) : Le = new YH(ln, nn, mn, e, (0, F.H)(x), (0, F.H)(B), z, ea.l, nb.l, Ed.C, ni.C, ca); + N(S, Le); + on = new lI(d, D, ea.l, Le.C); + N(S, on); + pn = new TH(d, g, h, e, k, l, m, n, tb.C, B, x, nb.l, ea.l, ka.l, hb.C, nb.G, nb.N, nb.V, jc.C, on.C); + N(S, pn); + qn = new mI(J, g, pn.C); + N(S, qn); + rn = new kI(e, T, C, qn.C); + N(S, rn); + sn = new jI(g, aa, ea.l, rn.C); + N(S, sn); + tn = new gI(d, g, z, ea.l, sn.C); + N(S, tn); + Hu = new iI(Cc(C), We(), C, ca, Le.C); + N(S, Hu); + Sc(S); + return jb(CK, tn.C.promise, 0); + }); + }, II = function (a, b, c, d, e, f, g, h, k, l) { + var m, n; + return ib(function (q) { + m = f[c]; + if (!m) + return rf(646, Error('missing slot')), q.return(); + 0 === c && (n = (0, F.H)(G(b.P[m.getDomId()], 20)), cv(Re.O(), '4', n)); + return jb(q, JI(m, d, e, g, b, a, h, k, l), 0); + }); + }, JI = function (a, b, c, d, e, f, g, h, k) { + var l, m, n, q, u, B, x, z, C, D, J, T, aa, X; + return ib(function (S) { + switch (S.j) { + case 1: + n = Ve('google_norender'); + q = _.H(bt); + u = new Qc(); + B = new AI(b, a); + N(u, B); + x = new CI(f, g, B.C); + N(u, x); + z = new zI(a, B.C); + N(u, z); + C = new BI(a, e, d, B.C); + N(u, C); + D = new yI(B.C, c); + N(u, D); + J = D.metadata; + if (q) + return T = new wI(a, e, d, n, f, g, h, document, window, J, x.l, z.l, C.l), N(u, T), Sc(u), jb(S, T.l.promise, 3); + Sc(u); + return jb(S, v.Promise.all([ + x.l.promise, + z.l.promise, + C.l.promise + ]), 3); + case 3: + return a.m ? S.return() : jb(S, J.Nc.promise, 6); + case 6: + return aa = null !== (l = S.m) && void 0 !== l ? l : !1, jb(S, J.ac.promise, 7); + case 7: + X = null !== (m = S.m) && void 0 !== m ? m : ''; + if (!aa && !n || _.H(ct)) + q || TG(k, a, d, e, J, f, h, aa || n); + else { + var ca = rg(a, document); + ca && Kd(ca, window, X, !0); + cv(Re.O(), '5', (0, F.H)(G(e.P[a.getDomId()], 20))); + a.dispatchEvent(TC, 801, { + $b: null, + isBackfill: !1 + }); + var ka; + if (_.AD(d, a) && !Bg(a, document)) { + ca = e.U; + var ea = e.P[a.getDomId()]; + (null !== (ka = E(ea, 10)) && void 0 !== ka ? ka : E(ca, 11)) && pi(a, document, ea, ca); + } + a.dispatchEvent(VC, 825, { isEmpty: !0 }); + } + u.ua(); + return S.return(); + } + }); + }; + var KI = function (a) { + rF.call(this); + this.context = a; + this.D = new v.Set(); + this.B = {}; + this.K = uD.O(); + this.aa = new DI(); + this.T = new QG(); + this.J = new cw(window); + this.V = _.Hg(hG); + this.N = _.eG.O(); + _.H(Ut) && new bG(this); + }; + _.O(KI, rF); + KI.prototype.getName = function () { + return 'publisher_ads'; + }; + KI.prototype.display = function (a, b, c, d) { + c = void 0 === c ? '' : c; + d = void 0 === d ? '' : d; + var e = ''; + if (c) + if (_.ja(c) && 1 == c.nodeType) { + var f = c; + e = f.id; + } else + e = c; + this.enable(); + var g = Il(a, b, e), h = g.slotId; + g = g.Ja; + h && g ? (f && !e && (f.id = h.getDomId()), this.Ka(h, g), g.setClickUrl(d), Sh(null !== f && void 0 !== f ? f : h.getDomId())) : M(this.log, Wg('PubAdsService.display', [ + a, + b, + c + ])); + }; + var MI = function (a, b, c) { + var d = void 0 === d ? document : d; + var e; + null === (e = c.P[b.getDomId()]) || void 0 === e ? void 0 : w(e, 19, !0); + var f = { id: Fq(b.getDomId()) }; + cb(d, td(f)); + rg(b, d) ? (a.enable(), zD(a.K, b), LI(a, c, b)) : of('gpt_pb_write', function (g) { + df(g); + }); + }; + KI.prototype.Ka = function (a, b) { + var c = this; + E(b, 17) || this.A && zD(this.K, a); + this.dispatchEvent(WC, 724, { + Cc: a.getDomId(), + P: b + }); + QC(a, VC, function (d) { + var e = d.detail; + d = e.size; + var f = e.isEmpty; + e = new dF(a, 'publisher_ads'); + f && (e.isEmpty = f); + f = a.j.getResponseInformation(); + d && f && (e.size = [ + d.width, + d.height + ], e.sourceAgnosticCreativeId = f.sourceAgnosticCreativeId, e.sourceAgnosticLineItemId = f.sourceAgnosticLineItemId, e.isBackfill = f.isBackfill, e.creativeId = f.creativeId, e.lineItemId = f.lineItemId, e.creativeTemplateId = f.creativeTemplateId, e.advertiserId = f.advertiserId, e.campaignId = f.campaignId, e.yieldGroupIds = f.yieldGroupIds, e.companyIds = f.companyIds); + c.dispatchEvent('slotRenderEnded', 708, e); + }); + QC(a, SC, function () { + return void c.dispatchEvent('slotResponseReceived', 709, new oF(a, c.getName())); + }); + rF.prototype.Ka.call(this, a, b); + }; + KI.prototype.R = function (a, b) { + this.enable(); + this.A && zD(this.K, b); + this.log.info(nE()); + var c = E(a.U, 6); + if (c || !this.K.Ta(b)) { + c && (c = rg(b)) && b.dispatchEvent(RC, 778, c); + if (E(a.U, 4)) { + c = a.U; + var d = a.P[b.getDomId()], e = document; + e = void 0 === e ? document : e; + mi(d, c) && !this.K.Ta(b) && pi(b, e, d, c); + } + LI(this, a, b); + } + }; + var LI = function (a, b, c) { + var d = NI(a, b, c); + OI(a, d, b, { Ca: 1 }); + b = c.getAdUnitPath(); + if (c = a.B[b]) { + c = _.y(c); + for (d = c.next(); !d.done; d = c.next()) + d = d.value, OI(a, d.ca, d.L, d.ee); + delete a.B[b]; + } + }, NI = function (a, b, c) { + var d; + return E(b.U, 4) ? [] : !E(b.U, 6) || (null === (d = b.P[c.getDomId()]) || void 0 === d ? 0 : E(d, 17)) ? (a.D.add(c), _.zl(c, function () { + return void a.D.delete(c); + }), [c]) : a.j.filter(function (e) { + if (a.D.has(e)) + return !1; + a.D.add(e); + _.zl(e, function () { + return void a.D.delete(e); + }); + return !0; + }); + }, OI = function (a, b, c, d) { + a.log.info(uE()); + if (PI(a, b, d, c) && 1 !== d.Ca) + for (b = _.y(b), d = b.next(); !d.done; d = b.next()) + d = d.value.getDomId(), a.dispatchEvent(XC, 725, { + Cc: d, + P: c.P[d] + }); + }, PI = function (a, b, c, d) { + b = b.filter(function (e) { + return _.AD(a.K, e); + }); + if (!b.length) + return null; + HI(a.aa, b, c, d, a.K, a.J, a.context, a, a.V, a.N, a.T); + return b; + }; + KI.prototype.refresh = function (a, b, c) { + b = b ? QI(this, b) : this.j; + if (!b.length) + return !1; + RI(this, a, b, null !== c && void 0 !== c ? c : { Ca: 2 }); + return !0; + }; + var QI = function (a, b) { + return b.filter(function (c, d) { + if (!c.m) + return !0; + M(a.log, xE(String(d))); + return !1; + }); + }, RI = function (a, b, c, d) { + var e, f, g = c[0], h = null !== (e = null === g || void 0 === g ? void 0 : g.getDomId()) && void 0 !== e ? e : ''; + if (a.A) { + g = {}; + h = _.y(c); + for (var k = h.next(); !k.done; g = { ib: g.ib }, k = h.next()) + g.ib = k.value, a.D.add(g.ib), _.zl(g.ib, function (l) { + return function () { + return void a.D.delete(l.ib); + }; + }(g)); + OI(a, c, b, d); + } else + c.length && E(b.U, 6) ? (M(a.log, tE(h), g), g = g.getAdUnitPath(), h = null !== (f = a.B[g]) && void 0 !== f ? f : [], h.push({ + ca: c, + L: b, + ee: d + }), a.B[g] = h) : M(a.log, rE(h), g); + }; + KI.prototype.lc = function () { + var a = this, b = Ke.O().j; + if (E(b, 6)) + for (var c = _.y(this.j), d = c.next(); !d.done; d = c.next()) + this.A && zD(this.K, d.value); + SI(this, b); + QC(this, 'rewardedSlotClosed', function (e) { + var f = e.detail.slot; + e = _.t(a.j, 'find').call(a.j, function (g) { + return f === g.j; + }); + TI(a, [e], Ke.O().j, Ke.O().m, a.K); + }); + El(); + }; + KI.prototype.destroySlots = function (a, b) { + var c, d; + a = rF.prototype.destroySlots.call(this, a); + if (a.length && this.A) { + var e = null !== (c = null === b || void 0 === b ? void 0 : b.U) && void 0 !== c ? c : Ke.O().j; + b = null !== (d = null === b || void 0 === b ? void 0 : b.P) && void 0 !== d ? d : Ke.O().m; + UI(this, a, e, b); + } + return a; + }; + var VI = function (a, b, c, d) { + if (!a.A) + return M(a.log, sE(), d[0]), !1; + var e = QI(a, d); + if (!e.length) + return M(a.log, Wg('PubAdsService.clear', [d].filter(function (f) { + return void 0 !== f; + }))), !1; + a.log.info(vE()); + UI(a, e, b, c); + return !0; + }, UI = function (a, b, c, d) { + for (var e = _.y(b), f = e.next(); !f.done; f = e.next()) + wD(a.K, f.value); + TI(a, b, c, d, a.K); + }; + KI.prototype.forceExperiment = function (a) { + a = Number(a); + 0 < a && Dc().F(a); + }; + var TI = function (a, b, c, d, e) { + var f = void 0 === f ? window : f; + for (var g = _.H(bt), h = _.y(b), k = h.next(); !k.done; k = h.next()) + k = k.value, g ? vD(e, k) : RG(a.T, k); + a = _.y(b); + for (k = a.next(); !k.done; k = a.next()) + b = k.value, g = d[b.getDomId()], mi(g, c) && pi(b, f.document, g, c), FD(e, b); + }, WI = function (a, b, c, d) { + w(d, 21, !0); + w(d, 22, String(null !== b && void 0 !== b ? b : '')); + w(d, 23, String(null !== c && void 0 !== c ? c : '')); + SI(a, d); + }, XI = function (a, b) { + var c, d; + return a.A ? { + vid: null !== (c = G(b, 22)) && void 0 !== c ? c : '', + cmsid: null !== (d = G(b, 23)) && void 0 !== d ? d : '' + } : null; + }, SI = function (a, b) { + E(b, 21) && a.A && w(b, 29, yr()); + }; + var Fl = function (a, b) { + var c = this, d = Lh(), e = a.getSlotId(), f = Ke.O().j, g = Nh(Ke.O(), e.getDomId()); + this.set = K(83, function (h, k) { + 'page_url' === h && k && (h = [dh(eh(new fh(), h), [String(k)])], wh(g, 3, h)); + return c; + }); + this.get = K(84, function (h) { + if ('page_url' !== h) + return null; + var k; + return null == (k = (L = Ub(g, fh, 3), _.t(L, 'find')).call(L, function (l) { + return ch(l) === h; + })) ? void 0 : Oh(k, 2)[0]; + }); + this.setClickUrl = K(79, function (h) { + if ('string' !== typeof h) + return M(d, Wg('Slot.setClickUrl', [h]), e), c; + g.setClickUrl(h); + return c; + }); + this.setTargeting = K(81, function (h, k) { + ih(e, g, h, k, d); + return c; + }); + this.updateTargetingFromMap = K(85, function (h) { + jh(e, g, h, d); + return c; + }); + this.display = K(78, function () { + MI(b, e, og(f, Ke.O().m)); + }); + this.setTagForChildDirectedTreatment = K(80, function (h) { + if (0 === h || 1 === h) { + var k = il(f) || new jl(); + k.setTagForChildDirectedTreatment(h); + zf(f, 25, k); + } + return c; + }); + this.setForceSafeFrame = K(567, function (h) { + if ('boolean' !== typeof h) + return M(d, Wg('PassbackSlot.setForceSafeFrame', [String(h)]), e), c; + w(g, 12, h); + return c; + }); + this.setTagForUnderAgeOfConsent = K(448, function (h) { + if (0 === h || 1 === h) { + var k = il(f) || new jl(); + k.setTagForUnderAgeOfConsent(h); + zf(f, 25, k); + } + return c; + }); + }; + _.O(Fl, bD); + me(Fl, 6); + var Nl = { + REWARDED: 4, + TOP_ANCHOR: 2, + BOTTOM_ANCHOR: 3, + INTERSTITIAL: 5 + }, YI = { + IAB_AUDIENCE_1_1: 1, + IAB_CONTENT_2_1: 2 + }, ZI = { + PURCHASED: 1, + ORGANIC: 2 + }, $I = { + EVERYONE: 1, + PARENTAL_GUIDANCE: 2, + TEEN: 3, + MATURE_AUDIENCE: 4 + }, aJ = function () { + if (!ne().enums) { + var a = {}, b = Hl(Nl); + a.OutOfPageFormat = b; + _.H(qt) && (b = Hl(ZI), a.TrafficSource = b); + _.H(pt) && (b = Hl(YI), a.Taxonomies = b); + _.H(Ds) && (b = Hl($I), a.AdContentRating = b); + ne().enums = a; + } + }; + var bJ = function (a, b) { + var c = b.j; + return a.map(function (d) { + return _.t(c, 'find').call(c, function (e) { + return e.j === d; + }); + }).filter(function (d) { + return !!d; + }); + }, cJ = function (a) { + var b = _.Hg(Wv), c = []; + a = _.y(a); + for (var d = a.next(); !d.done; d = a.next()) { + d = d.value; + b.A = d; + var e = Dc().j(9); + 1 === e.length && (c.push(d), c.push(d + '-' + e[0])); + } + return c; + }, dJ = _.Vn(function () { + return ur('google_DisableInitialLoad is deprecated and will be removed. Please use googletag.pubads().isInitialLoadDisabled() instead to check if initial load has been disabled.'); + }), eJ = _.Vn(function () { + return ur('googletag.pubadds().setCookieOptions() is deprecated, and will stop having an effect in early 2022. Consider migrating to Limited Ads.'); + }), fJ = _.Vn(function () { + return ur('googletag.pubadds().setCookieOptions() has been removed, and no longer has any effect. Consider migrating to Limited Ads.'); + }), gJ = function () { + Object.defineProperty(window, 'google_DisableInitialLoad', { + get: function () { + dJ(); + return !0; + }, + set: function () { + dJ(); + }, + configurable: !0 + }); + }, Ll = function (a) { + sF.call(this, a); + var b = this, c = Lh(), d = Ke.O().j, e = Ke.O().m, f = !1; + this.setTargeting = K(1, function (g, h) { + var k = null; + 'string' === typeof h ? k = [h] : Array.isArray(h) ? k = h : ah(h) && (k = _.t(Array, 'from').call(Array, h)); + var l = 'string' === typeof g && !$g(g); + k = k && ta(k); + var m, n = null != (m = null == k ? void 0 : k.every(function (q) { + return 'string' === typeof q; + })) ? m : !1; + if (!l || !n) + return M(c, Wg('PubAdsService.setTargeting', [ + g, + h + ])), b; + h = (L = Ub(d, fh, 2), _.t(L, 'find')).call(L, function (q) { + return ch(q) === g; + }); + if ('gpt-beta' === g) { + if (a.A) + return M(c, IE(k.join())), b; + if (h) + return M(c, JE(k.join())), b; + k = cJ(k); + } + h ? dh(h, k) : (h = dh(eh(new fh(), g), k), gh(d, 2, fh, h)); + c.info(hh(g, k.join(), a.getName())); + return b; + }); + this.clearTargeting = K(2, function (g) { + if (void 0 === g) + return wh(d, 2, void 0), c.info(GE(a.getName())), b; + if ('gpt-beta' === g) + return M(c, KE(g)), b; + var h = Ub(d, fh, 2), k = _.t(h, 'findIndex').call(h, function (l) { + return ch(l) === g; + }); + if (0 > k) + return M(c, zE(g, a.getName())), b; + h.splice(k, 1); + wh(d, 2, h); + c.info(yE(g, a.getName())); + return b; + }); + this.getTargeting = K(38, function (g) { + if ('string' !== typeof g) + return M(c, Wg('PubAdsService.getTargeting', [g])), []; + var h = (L = Ub(d, fh, 2), _.t(L, 'find')).call(L, function (k) { + return ch(k) === g; + }); + return h ? Oh(h, 2).slice() : []; + }); + this.getTargetingKeys = K(39, function () { + return Ub(d, fh, 2).map(function (g) { + return ch(g); + }); + }); + this.setCategoryExclusion = K(3, function (g) { + if ('string' !== typeof g || $g(g)) + return M(c, Wg('PubAdsService.setCategoryExclusion', [g])), b; + (L = Oh(d, 3), _.t(L, 'includes')).call(L, g) || To(d, 3, g); + c.info(AE(g)); + return b; + }); + this.clearCategoryExclusions = K(4, function () { + w(d, 3, Ro); + c.info(BE()); + return b; + }); + this.disableInitialLoad = K(5, function () { + w(d, 4, !0); + f || (f = !0, gJ()); + }); + this.enableSingleRequest = K(6, function () { + if (a.A && !E(d, 6)) + return M(c, oE('PubAdsService.enableSingleRequest')), !1; + c.info(pE('single request')); + w(d, 6, !0); + return !0; + }); + this.enableAsyncRendering = K(7, function () { + return !0; + }); + this.enableSyncRendering = K(8, function () { + ur('GPT synchronous rendering is no longer supported, ads will be requested and rendered asynchronously. See https://support.google.com/admanager/answer/9212594 for more details.'); + return !1; + }); + this.enableLazyLoad = K(485, function (g) { + var h = new Ej(); + w(h, 1, 800); + w(h, 2, 400); + w(h, 3, 3); + if (_.ja(g)) { + var k = g.fetchMarginPercent; + 'number' === typeof k && (0 <= k ? w(h, 1, k) : -1 == k && w(h, 1, void 0, !1)); + k = g.renderMarginPercent; + 'number' === typeof k && (0 <= k ? w(h, 2, k) : -1 == k && w(h, 2, void 0, !1)); + g = g.mobileScaling; + 'number' === typeof g && (0 < g ? w(h, 3, g) : -1 == g && w(h, 3, 1)); + } + zf(d, 5, h); + }); + this.setCentering = K(9, function (g) { + g = !!g; + c.info(qE('centering', String(g))); + w(d, 15, g); + }); + this.definePassback = K(10, function (g, h) { + return (g = Kl(a, g, h)) && g.Sc; + }); + this.refresh = K(11, function (g, h) { + h = void 0 === h ? {} : h; + if (g && !Array.isArray(g) || !_.ja(h) || h.changeCorrelator && 'boolean' !== typeof h.changeCorrelator) + M(c, Wg('PubAdsService.refresh', _.t(Array, 'from').call(Array, arguments))); + else { + h && 0 == h.changeCorrelator || d.setCorrelator(yr()); + var k = g ? bJ(g, a) : a.j; + a.refresh(og(d, e), k) || M(c, Wg('PubAdsService.refresh', _.t(Array, 'from').call(Array, arguments))); + } + }); + this.enableVideoAds = K(12, function () { + w(d, 21, !0); + SI(a, d); + }); + this.setVideoContent = K(13, function (g, h) { + WI(a, g, h, d); + }); + this.collapseEmptyDivs = K(14, function (g) { + g = void 0 === g ? !1 : g; + w(d, 11, !0); + var h = !!g; + w(d, 10, h); + of('gpt_ced', function (k) { + I(k, 'sc', h ? 't' : 'f'); + I(k, 'level', 'page'); + df(k); + }); + c.info(wE(String(h))); + return !!E(d, 11); + }); + this.clear = K(15, function (g) { + if (Array.isArray(g)) + return VI(a, d, e, bJ(g, a)); + if (void 0 === g) + return VI(a, d, e, a.j); + M(c, Wg('PubAdsService.clear', [g])); + return !1; + }); + this.setLocation = K(16, function (g) { + if ('string' !== typeof g) + return M(c, Wg('PubAdsService.setLocation', [g])), b; + w(d, 8, g); + return b; + }); + this.setCookieOptions = K(17, function (g) { + if (_.H(Fs)) + return fJ(), b; + _.H(Gs) && eJ(); + if (0 !== g && 1 !== g) + return M(c, TE('PubadsService.setCookieOptions', Er(g), '0,1')), b; + w(d, 24, g); + return b; + }); + this.setTagForChildDirectedTreatment = K(18, function (g) { + if (1 !== g && 0 !== g) + return M(c, TE('PubadsService.setTagForChildDirectedTreatment', Er(g), '0,1')), b; + var h = il(d) || new jl(); + h.setTagForChildDirectedTreatment(g); + zf(d, 25, h); + return b; + }); + this.clearTagForChildDirectedTreatment = K(19, function () { + var g = il(d); + if (!g) + return b; + g.clearTagForChildDirectedTreatment(); + zf(d, 25, g); + return b; + }); + this.setPublisherProvidedId = K(20, function (g) { + g = String(g); + c.info(qE('PPID', g)); + w(d, 16, g); + return b; + }); + this.set = K(21, function (g, h) { + if ('string' !== typeof g || !g.length || void 0 === JD()[g] || 'string' !== typeof h) + return M(c, Wg('PubAdsService.set', [ + g, + h + ])), b; + var k = (L = Ub(d, fh, 14), _.t(L, 'find')).call(L, function (l) { + return ch(l) === g; + }); + k ? dh(k, [h]) : (k = eh(new fh(), g), To(k, 2, h), gh(d, 14, fh, k)); + c.info(jE(g, String(h), a.getName())); + return b; + }); + this.get = K(22, function (g) { + if ('string' !== typeof g) + return M(c, Wg('PubAdsService.get', [g])), null; + var h = (L = Ub(d, fh, 14), _.t(L, 'find')).call(L, function (k) { + return ch(k) === g; + }); + return (h = h && Oh(h, 2)) ? h[0] : null; + }); + this.getAttributeKeys = K(23, function () { + return Ub(d, fh, 14).map(function (g) { + return ch(g); + }); + }); + this.display = K(24, function (g, h, k, l) { + return void a.display(g, h, void 0 === k ? '' : k, void 0 === l ? '' : l); + }); + this.updateCorrelator = K(25, function () { + ur(AC('update')); + M(c, NE()); + d.setCorrelator(yr()); + return b; + }); + this.defineOutOfPagePassback = K(35, function (g) { + g = Kl(a, g, [ + 1, + 1 + ]); + if (!g) + return null; + w(g.Ja, 15, 1); + return g.Sc; + }); + this.setForceSafeFrame = K(36, function (g) { + if ('boolean' !== typeof g) + return M(c, Wg('PubAdsService.setForceSafeFrame', [Er(g)])), b; + w(d, 13, g); + return b; + }); + this.setSafeFrameConfig = K(37, function (g) { + var h = zF(g); + if (!h) + return M(c, Wg('PubAdsService.setSafeFrameConfig', [g])), b; + zf(d, 18, h); + return b; + }); + this.setRequestNonPersonalizedAds = K(445, function (g) { + if (0 !== g && 1 !== g) + return M(c, TE('PubAdsService.setRequestNonPersonalizedAds', Er(g), '0,1')), b; + var h = il(d) || new jl(); + w(h, 8, !!g); + zf(d, 25, h); + return b; + }); + this.setTagForUnderAgeOfConsent = K(447, function (g) { + g = void 0 === g ? 2 : g; + if (2 !== g && 0 !== g && 1 !== g) + return M(c, TE('PubadsService.setTagForUnderAgeOfConsent', Er(g), '2,0,1')), b; + var h = il(d) || new jl(); + h.setTagForUnderAgeOfConsent(g); + zf(d, 25, h); + return b; + }); + this.getCorrelator = K(27, function () { + return String(d.getCorrelator()); + }); + this.getTagSessionCorrelator = K(631, function () { + return Cc(_.r); + }); + this.getVideoContent = K(30, function () { + return XI(a, d); + }); + this.getVersion = K(568, Xe); + this.forceExperiment = K(569, function (g) { + return void a.forceExperiment(g); + }); + this.setCorrelator = K(28, function (g) { + ur(AC('set')); + M(c, ME()); + if (fg(window)) + return b; + if (!('number' === typeof g && isFinite(g) && 0 == g % 1 && 0 < g)) + return M(c, Wg('PubadsService.setCorrelator', [Er(g)])), b; + d.setCorrelator(g); + w(d, 27, !0); + return b; + }); + this.markAsAmp = K(570, function () { + window.console && window.console.warn && window.console.warn('googletag.pubads().markAsAmp() is deprecated and ignored.'); + }); + this.isSRA = K(571, function () { + return !!E(d, 6); + }); + this.setImaContent = K(328, function (g, h) { + Yf(d, 22) ? WI(a, g, h, d) : (w(d, 21, !0), SI(a, d), 'string' === typeof g && w(d, 19, g), 'string' === typeof h && w(d, 20, h)); + }); + this.getImaContent = K(329, function () { + return Yf(d, 22) ? XI(a, d) : a.A ? { + vid: G(d, 19) || '', + cmsid: G(d, 20) || '' + } : null; + }); + this.isInitialLoadDisabled = K(572, function () { + return !!E(d, 4); + }); + this.setPrivacySettings = K(648, function (g) { + if (!_.ja(g)) + return M(c, Wg('PubAdsService.setPrivacySettings', [g])), b; + var h = g.restrictDataProcessing, k = g.childDirectedTreatment, l = g.underAgeOfConsent, m = g.limitedAds, n = g.nonPersonalizedAds, q = g.trafficSource, u = g.adContentRating, B, x = null != (B = il(d)) ? B : new jl(); + if (_.H(Ds) && void 0 !== u) + if (null === u || 0 === u) + w(x, 11, void 0, !1); + else if (Mg($I, function (z) { + return z === u; + })) + w(x, 11, u); + else + throw Error('Invalid Ad Content Rating value ' + Er(u)); + 'boolean' === typeof n ? w(x, 8, n) : void 0 !== n && M(c, SE('PubAdsService.setPrivacySettings', Er(g), 'nonPersonalizedAds', Er(n))); + 'boolean' === typeof h ? w(x, 1, h) : void 0 !== h && M(c, SE('PubAdsService.setPrivacySettings', Er(g), 'restrictDataProcessing', Er(h))); + 'boolean' === typeof m ? w(x, 9, m) : void 0 !== m && M(c, SE('PubAdsService.setPrivacySettings', Er(g), 'limitedAds', Er(m))); + void 0 !== l && (null === l ? x.setTagForUnderAgeOfConsent(2) : !1 === l ? x.setTagForUnderAgeOfConsent(0) : !0 === l ? x.setTagForUnderAgeOfConsent(1) : M(c, SE('PubAdsService.setPrivacySettings', Er(g), 'underAgeOfConsent', Er(l)))); + void 0 !== k && (null === k ? x.clearTagForChildDirectedTreatment() : !1 === k ? x.setTagForChildDirectedTreatment(0) : !0 === k ? x.setTagForChildDirectedTreatment(1) : M(c, SE('PubAdsService.setPrivacySettings', Er(g), 'childDirectedTreatment', Er(k)))); + _.H(qt) && void 0 !== q && (null === q ? w(x, 10, void 0, !1) : Mg(ZI, function (z) { + return z === q; + }) ? w(x, 10, q) : M(c, SE('PubAdsService.setPrivacySettings', Er(g), 'trafficSource', Er(q)))); + zf(d, 25, x); + return b; + }); + _.H(pt) && (this.addTaxonomyValue = K(922, function (g, h) { + if (!Mg(YI, function (z) { + return z === g; + }) || null == h || 'object' === typeof h && !Array.isArray(h)) + return M(c, Wg('PubAdsService.addTaxonomyValue', [ + g, + h + ])), b; + var k = (L = Ub(d, bC, 32), _.t(L, 'find')).call(L, function (z) { + return z.getTaxonomy() === g; + }), l = k ? [].concat(_.lc(Oh(k, 2))) : [], m = l.length, n = _.zc(ot), q = []; + h = _.y(Array.isArray(h) ? h : [h]); + for (var u = h.next(); !u.done; u = h.next()) { + u = u.value; + var B = Number(u), x = String(u); + !_.t(Number, 'isInteger').call(Number, B) || 0 >= B || 999999 < B ? q.push(u) : _.t(l, 'includes').call(l, x) || l.push(x); + } + q.length && M(c, Wg('PubAdsService.addTaxonomyValue', [ + g, + q + ])); + l.length > n && (M(c, aF(g.toString(), String(n))), l.splice(n)); + l.length > m && (c.info(YE(JSON.stringify(l.slice(m)), g)), k ? dC(k, l) : hC(d, dC(cC(new bC(), g), l))); + return b; + }), this.getTaxonomy = K(923, function (g) { + if (!Mg(YI, function (l) { + return l === g; + })) + return M(c, Wg('PubAdsService.getTaxonomy', [g])), []; + var h, k; + return null != (k = null == (h = (L = Ub(d, bC, 32), _.t(L, 'find')).call(L, function (l) { + return l.getTaxonomy() === g; + })) ? void 0 : Oh(h, 2).slice()) ? k : []; + }), this.getTaxonomies = K(924, function () { + for (var g = new v.Map(), h = _.y(Ub(d, bC, 32)), k = h.next(); !k.done; k = h.next()) + k = k.value, g.set(k.getTaxonomy(), Oh(k, 2).slice()); + return g; + }), this.clearTaxonomy = K(925, function (g) { + if (void 0 === g) { + if (!Ub(d, bC, 32).length) + return M(c, bF()), b; + wh(d, 32, void 0); + c.info($E()); + } else { + var h = Ub(d, bC, 32), k = h.filter(function (l) { + return l.getTaxonomy() !== g; + }); + h.length === k.length ? M(c, bF()) : (wh(d, 32, k), c.info(ZE(g))); + } + return b; + })); + }; + _.O(Ll, sF); + me(Ll, 7); + var hJ = function () { + var a = this, b = [], c = [], d = Lh(); + this.addSize = _.mf(88, function (e, f) { + var g; + if (g = nh(e)) + g = mh(f) || Array.isArray(f) && f.every(mh); + g ? b.push([ + e, + f + ]) : (c.push([ + e, + f + ]), M(d, Wg('SizeMappingBuilder.addSize', [ + e, + f + ]))); + return a; + }); + this.build = _.mf(89, function () { + if (c.length) + return M(d, hE(Er(c))), null; + qa(b); + return b; + }); + }; + var iJ = function () { + OC.apply(this, arguments); + this.A = this.j = 0; + }; + _.O(iJ, OC); + iJ.prototype.push = function () { + const $___old_b55313d960a40e92 = {}.constructor.getOwnPropertyDescriptor(window, 'sessionStorage'); + try { + if ($___old_b55313d960a40e92) + ({}.constructor.defineProperty(window, 'sessionStorage', $___mock_5951fd968a9e489b.sessionStorage)); + return function () { + for (var a, b = Lh(), c = 0; c < arguments.length; ++c) + try { + if ('function' === typeof arguments[c]) { + if (_.H(Bs)) + (0, arguments[c])(); + else + arguments[c](); + this.j++; + } + } catch (d) { + this.A++, null === (a = null === window || void 0 === window ? void 0 : window.console) || void 0 === a ? void 0 : a.error('Exception in queued GPT command', d), b.error(fE(String(d))); + } + b.info(gE(String(this.j), String(this.A))); + return this.j; + }.apply(this, arguments); + } finally { + if ($___old_b55313d960a40e92) + ({}.constructor.defineProperty(window, 'sessionStorage', $___old_b55313d960a40e92)); + } + }; + var jJ = function () { + var a = new zq(), b = new Aq(); + a.setCorrelator(Cc(_.r)); + var c = Dc().m().join(); + Qb(a, 5, c, ''); + Qb(a, 2, 1, 0); + zf(b, 1, a); + a = yq(); + a = Jk(a, 10, !0); + c = _.H(Rt); + a = Jk(a, 13, c); + c = _.H(St); + a = Jk(a, 14, c); + a = Jk(a, 16, !0); + zf(b, 2, a); + window.google_rum_config = b.toJSON(); + }; + var kJ = P([ + 'https://securepubads.g.doubleclick.net/gpt/pubads_impl_', + '_', + '.js' + ]), lJ = P([ + 'https://pagead2.googlesyndication.com/gpt/pubads_impl_', + '_', + '.js' + ]), mJ = P(['https://securepubads.g.doubleclick.net/pagead/js/rum.js']), nJ = P(['https://securepubads.g.doubleclick.net/pagead/js/rum_debug.js']); + (function (a, b, c) { + var d, e; + try { + var f = window.googletag; + if (null === f || void 0 === f ? 0 : f.evalScripts) + f.evalScripts(); + else { + bB(); + oe('evalScripts', hm); + try { + Zv(); + } catch (D) { + rf(408, D); + } + Sk(); + try { + Xv(), Dc().j(13), Dc().j(3); + } catch (D) { + rf(408, D); + } + Gg('gpt-tag-load'); + var g = null !== c && void 0 !== c ? c : rm(), h = !!_.bf[259]; + Lk(g, h); + _.Hg(Jh); + var k = new KI(g); + _.bf[260] && qD(k); + var l = b(a); + _.eG.O().F = l; + _.zc(nm) && om(); + _.uf(827, function () { + var D, J = document; + 'function' === typeof J.interestCohort && _.H(At) && (uD.O().A = null === (D = J.interestCohort) || void 0 === D ? void 0 : D.call(J)); + }, !0); + var m = zu(It); + m && _.uf(862, function () { + var D = document; + D = void 0 === D ? window.document : D; + if (m && D.head) { + var J = _.Oi('META'); + D.head.appendChild(J); + J.httpEquiv = 'origin-trial'; + J.content = m; + } + }, !0); + oe('defineOutOfPageSlot', K(73, function (D, J) { + var T; + 'string' === typeof D && D.length && (null == J || 'string' === typeof J || 'number' === typeof J && Ol(J)) ? D = Ql(D, 'number' === typeof J ? J : 1, 'string' === typeof J ? J : void 0) : (Lh().error(Wg('googletag.defineOutOfPageSlot', [ + D, + J + ]), void 0, _.H(js)), D = null); + return D ? null !== (T = D.j) && void 0 !== T ? T : null : null; + })); + MF(); + Th(); + aJ(); + oe('getVersion', K(946, Xe)); + oe('pubads', K(947, function () { + return Ml(k); + })); + var n = null; + oe('companionAds', K(816, function () { + null !== n && void 0 !== n ? n : n = new NF(k); + return Wh(n); + })); + var q = !1; + oe('content', K(817, function () { + _.H(wt) && !q && (M(Lh(), XE()), q = !0); + return Zh(); + })); + oe('setAdIframeTitle', K(729, dj)); + oe('getEventLog', K(945, function () { + return new ZF(); + })); + oe('sizeMapping', K(90, function () { + return new hJ(); + })); + oe('enableServices', K(91, function () { + for (var D = _.y(pF), J = D.next(); !J.done; J = D.next()) + J = J.value, J.A && Lh().info(kE()), J.enable(); + })); + oe('destroySlots', K(75, gm)); + oe('apiReady', !0); + var u = function () { + _.uf(77, function () { + var D = ne().cmd; + if (!D || Array.isArray(D)) { + var J = new iJ(); + ne().cmd = Sg(J); + null !== D && void 0 !== D && D.length && J.push.apply(J, D); + } + }); + }; + ne().fifWin && 'complete' !== document.readyState ? _.fb(window, 'load', function () { + window.setTimeout(u, 0); + }) : u(); + dm(); + if (_.H(Ut) || Re.O().j) + jJ(), di(document, ei(Ya(_.H(Wt) ? l.je : l.le).toString())); + $l(); + oe('disablePublisherConsole', K(93, hi)); + oe('onPubConsoleJsLoad', K(731, ki)); + oe('openConsole', K(732, li)); + var B = _.zc(ys); + if (0 !== B) { + var x = _.Oi('SCRIPT'), z = 1 === B ? ei(fd(gn('https://pagead2.googlesyndication.com/pagead/managed/js/m202102160101/pubads_impl.js'))) : ei(fd(gn('https://securepubads.g.doubleclick.net/gpt/pubads_impl_2021021602.js'))); + bb(x, yn(z, String(Math.random()))); + var C = _.xc(); + (null !== (e = null !== (d = document.head) && void 0 !== d ? d : document.body) && void 0 !== e ? e : document.documentElement).appendChild(x); + x.onload = function () { + of('gpt_bvslt', function (D) { + df(D); + I(D, 't', _.xc() - C); + I(D, 'f', B); + }, { pa: 1 }); + }; + } + of('gpt_ila', function (D) { + df(D); + I(D, 'ila', h); + }, { pa: _.zc(os) }); + if (_.H(Cs)) + try { + new SharedArrayBuffer(1), Bc({ sab: '1' }, 'gpt_sab'); + } catch (D) { + 0.01 >= Math.random() && Bc({ sab: '0' }, 'gpt_sab'); + } + } + } catch (D) { + rf(106, D); + } + }(We(), function (a) { + return { + pd: function (b) { + return A(kJ, b, a); + }, + od: function (b) { + return A(lJ, b, a); + }, + le: A(mJ), + je: A(nJ) + }; + })); + }.call(this, {})); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-a8259f1424fe238ddadb822d18e5b54e9da87475 b/resources/sugarcoat-a8259f1424fe238ddadb822d18e5b54e9da87475 new file mode 100644 index 00000000..2b803911 --- /dev/null +++ b/resources/sugarcoat-a8259f1424fe238ddadb822d18e5b54e9da87475 @@ -0,0 +1,852 @@ +{ + const $___mock_dd8aef2bdd8d0413 = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_dd8aef2bdd8d0413); + const $___mock_d0c2e2703cb522d7 = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_d0c2e2703cb522d7); + (function () { + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + (function (w, d, t, r, u) { + var f, n, i; + w[u] = w[u] || [], f = function () { + const $___old_f630b12f0677a0c0 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_cefeac633a35db2c = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_f630b12f0677a0c0) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_dd8aef2bdd8d0413.XMLHttpRequest)); + if ($___old_cefeac633a35db2c) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_d0c2e2703cb522d7.localStorage)); + return function () { + var o = { ti: '5102261' }; + o.q = w[u], w[u] = new UET(o), w[u].push('pageLoad'); + }.apply(this, arguments); + } finally { + if ($___old_f630b12f0677a0c0) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_f630b12f0677a0c0)); + if ($___old_cefeac633a35db2c) + ({}.constructor.defineProperty(window, 'localStorage', $___old_cefeac633a35db2c)); + } + }, n = d.createElement(t), n.src = r, n.async = 1, n.onload = n.onreadystatechange = function () { + var s = this.readyState; + s && s !== 'loaded' && s !== 'complete' || (f(), n.onload = n.onreadystatechange = null); + }, i = d.getElementsByTagName(t)[0], i.parentNode.insertBefore(n, i); + }(window, document, 'script', '//bat.bing.com/bat.js', 'uetq')); + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3605242, [3606329], 695874, [610323]); + Marketing.bindDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + if (Marketing.UDO.priorconsent) + Marketing.imageRequest('https://px.ads.linkedin.com/collect/?pid=7513&fmt=gif'); + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3593287, 619089); + Marketing.bindDependencyImmediate(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + Marketing.UDO.g_download = function (idString, eventType, category) { + window.addEventListener('hve', function (e) { + Marketing.UDO.hveoverlay = false; + if (e.detail.type === 'download') + if (!category) + Marketing.gEvent(idString, eventType); + else { + var docUrl = e.detail.event && e.detail.event.target ? e.detail.event.target.baseURI : ''; + docUrl = docUrl.substring(docUrl.lastIndexOf('/') + 1).replace('.pdf', ''); + gtag(idString, eventType, { + 'event_category': category, + 'event_label': docUrl + }); + } + }); + if (Marketing.UDO.hveoverlay) + if (!category) + Marketing.gEvent(idString, eventType); + else { + var docUrl = window.location.href ? window.location.href : ''; + docUrl = docUrl.substring(docUrl.lastIndexOf('/') + 1).replace('.pdf', ''); + gtag(idString, eventType, { + 'event_category': category, + 'event_label': docUrl + }); + } + }; + Marketing.UDO.g_share = function (idString, eventType) { + window.addEventListener('hve', function (e) { + if (e.detail.type === 'share') + Marketing.gEvent(idString, eventType); + }); + }; + Marketing.UDO.g_mpv = function (idString, eventType, category) { + const $___old_7baa1e8089b23d0d = {}.constructor.getOwnPropertyDescriptor(window, 'sessionStorage'); + try { + if ($___old_7baa1e8089b23d0d) + ({}.constructor.defineProperty(window, 'sessionStorage', $___mock_d0c2e2703cb522d7.sessionStorage)); + return function () { + if (sessionStorage.enspagecountFLT == 3) + if (!category) + Marketing.gEvent(idString, eventType); + else + gtag(idString, eventType, { 'event_category': category }); + }.apply(this, arguments); + } finally { + if ($___old_7baa1e8089b23d0d) + ({}.constructor.defineProperty(window, 'sessionStorage', $___old_7baa1e8089b23d0d)); + } + }; + Marketing.UDO.g_bc_start = function (idString, eventType) { + if (typeof videojs !== 'undefined' && videojs.players) + for (var v in videojs.players) + videojs.players[v].ready(function () { + var myplayer = this, userVideo = !myplayer.el_.hasAttribute('muted'); + if (userVideo) + myplayer.on('start', function () { + if (!myplayer.video_start) { + myplayer.video_50_percent = false; + myplayer.video_80_percent = false; + Marketing.gEvent(idString, eventType); + } + }); + }); + else + window.addEventListener('hve', function _handler(e) { + if (e.detail.type === 'brightcove') { + Marketing.UDO.g_bc_start(idString, eventType); + window.removeEventListener('hve', _handler); + } + }); + }; + Marketing.UDO.g_bc_50 = function (idString, eventType) { + window.addEventListener('brightcove50', function (e) { + Marketing.gEvent(idString, eventType); + }); + }; + Marketing.UDO.g_bc_80 = function (idString, eventType, category) { + window.addEventListener('brightcove80', function (e) { + if (!category) + Marketing.gEvent(idString, eventType); + else if (typeof videojs !== 'undefined' && videojs.players) + for (v in videojs.players) + videojs.players[v].ready(function () { + var myplayer = this; + if (myplayer && myplayer.mediainfo) + gtag(idString, eventType, { + 'event_category': category, + 'event_label': myplayer.mediainfo.name + }); + }); + }); + }; + Marketing.UDO.g_bc_end = function (idString, eventType) { + if (typeof videojs !== 'undefined' && videojs.players) + for (var v in videojs.players) + videojs.players[v].ready(function () { + var myplayer = this, userVideo = !myplayer.el_.hasAttribute('muted'); + if (userVideo) + myplayer.on('ended', function () { + Marketing.gEvent(idString, eventType); + myplayer.video_start = false; + }); + }); + else + window.addEventListener('hve', function _handler(e) { + if (e.detail.type === 'brightcove') { + Marketing.UDO.g_bc_end(idString, eventType); + window.removeEventListener('hve', _handler); + } + }); + }; + Marketing.UDO.g_contactus = function (idString, eventType, category) { + window.addEventListener('hve', function (e) { + if (e.detail.type === 'contactus') + if (!category) + Marketing.gEvent(idString, eventType); + else { + var pageName = dell_marketing_util.getscMap('pagename'); + gtag(idString, eventType, { + 'event_category': category, + 'event_label': pageName + }); + } + }); + }; + Marketing.UDO.g_chat = function (idString, eventType) { + window.addEventListener('hve', function (e) { + if (e.detail.type === 'chat') + Marketing.gEvent(idString, eventType); + }); + }; + Marketing.UDO.g_addtocart = function (idString, eventType) { + if (dell_marketing_util.getscMap('wacontroller') === 'contents' || dell_marketing_util.getscMap('workflowstep') === 'cart') + Marketing.gEvent(idString, eventType); + }; + Marketing.UDO.g_checkout = function (idString, eventType) { + if (dell_marketing_util.getscMap('wacontroller') === 'confirmation') + Marketing.gEvent(idString, eventType); + }; + Marketing.UDO.g_podcast_listen = function (idString, eventType) { + window.addEventListener('hve', function (e) { + if (e.detail.type === 'podcast_listen') + Marketing.gEvent(idString, eventType); + }); + }; + Marketing.UDO.g_podcast_subscribe = function (idString, eventType) { + window.addEventListener('hve', function (e) { + if (e.detail.type === 'podcast_subscribe') + Marketing.gEvent(idString, eventType); + }); + }; + Marketing.UDO.g_rfq_submit = function (idString, eventType) { + window.addEventListener('hve', function (e) { + if (e.detail.type === 'rfq_submit') + Marketing.gEvent(idString, eventType); + }); + }; + Marketing.UDO.g_ion_submit = function (idString, eventType) { + if (/liveball.*completed/gi.test(dell_marketing_util.getscMap('pagename'))) + Marketing.gEvent(idString, eventType); + }; + Marketing.UDO.g_gated_submit = function (idString, eventType) { + window.addEventListener('hve', function (e) { + if (e.detail.type === 'gated_submit') + Marketing.gEvent(idString, eventType); + }); + }; + }, 3644317, [3617682], 620818, [619404]); + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + var ga_dimension_map = function () { + return { + 'dimension1': 'accountid', + 'dimension2': 'login_status', + 'dimension3': 'language', + 'dimension4': 'site_segment', + 'dimension5': 'currency', + 'dimension6': 'category', + 'dimension7': 'category_path', + 'dimension8': 'cseg', + 'dimension9': 'emailhash', + 'dimension10': 'platform', + 'dimension11': 'dgc', + 'dimension12': 'lid', + 'dimension13': 'ven1', + 'dimension14': 'tfcid', + 'dimension15': 'dpid', + 'dimension16': 'gclid', + 'dimension17': 'demandgen_vehicle', + 'dimension18': 'gacd' + }; + }; + var ga_config_map = function () { + return { + 'accountid': Marketing.UDO.accountid, + 'page_title': dell_marketing_util.getscMap('pagename'), + 'login_status': dell_marketing_util.getCookie('GAAuth') ? 'logged_in' : 'not_logged_in', + 'language': Marketing.UDO.language, + 'site_segment': Marketing.UDO.segment, + 'currency': Marketing.UDO.currency, + 'category': Marketing.UDO.category, + 'category_path': Marketing.UDO.categorypath, + 'cseg': Marketing.UDO.cseg, + 'emailhash': Marketing.UDO.emailhash, + 'platform': Marketing.UDO.platform, + 'dgc': dell_marketing_util.getParameterByName('dgc', location.toString().toLowerCase()), + 'lid': dell_marketing_util.getParameterByName('lid', location.toString().toLowerCase()), + 'ven1': Marketing.UDO.ven1, + 'tfcid': dell_marketing_util.getParameterByName('tfcid', location.toString().toLowerCase()), + 'gclid': dell_marketing_util.getParameterByName('gclid', location.toString().toLowerCase()), + 'demandgen_vehicle': 'demandgen_vehicle', + 'gacd': Marketing.UDO.gacd, + 'dpid': Marketing.UDO.dpid + }; + }; + var product_item_list = function (listName) { + var prodList = []; + if (Marketing.UDO.productlist && Marketing.UDO.productlist.length > 0) { + Marketing.UDO.productlist.forEach(function (list, index) { + let prodDetails = {}; + prodDetails['id'] = list.ITEM ? list.ITEM : ''; + prodDetails['name'] = list.PRODUCTID ? list.PRODUCTID : ''; + prodDetails['variant'] = list.PRODUCTID ? list.PRODUCTID : ''; + prodDetails['quantity'] = list.QTY ? list.QTY : ''; + prodDetails['price'] = list.AMT ? list.AMT : ''; + prodDetails['brand'] = Marketing.UDO.family.split('|')[index] ? Marketing.UDO.family.split('|')[index] : ''; + prodDetails['category'] = Marketing.UDO.category.split('|')[index] ? Marketing.UDO.category.split('|')[index] : ''; + prodDetails['list_name'] = listName; + prodDetails['list_position'] = index + 1; + prodList.push(prodDetails); + }); + return prodList; + } + }; + gtag('set', { 'custom_map': ga_dimension_map() }); + if (Marketing.ensightenOptions.publishPath == 'marketing') + gtag('config', 'UA-208533932-1', ga_config_map()); + else + gtag('config', 'UA-208533932-2', ga_config_map()); + if (Marketing.UDO.promoid == '7') + gtag('event', 'view_item', { + 'items': [{ + 'id': Marketing.UDO.ordercode, + 'brand': Marketing.UDO.family, + 'name': Marketing.UDO.product, + 'variant': Marketing.UDO.product, + 'category': Marketing.UDO.category, + 'list_name': 'Single Product View', + 'list_position': '1' + }] + }); + if (Marketing.UDO.promoid == '9') { + if (document.referrer.indexOf('shop/rec') > 0) + gtag('event', 'add_to_cart', { 'items': product_item_list('Cart Add') }); + gtag('event', 'view_cart', { 'items': product_item_list('Cart View') }); + } + if (Marketing.UDO.promoid == '100') { + var transactionData = Dell && Dell.Transactional && Dell.Transactional.Cart ? Dell.Transactional.Cart.Metrics.Data.Analytics : ''; + gtag('event', 'purchase', { + 'transaction_id': Marketing.UDO.dpid, + 'value': Marketing.UDO.revenue, + 'currency': Marketing.UDO.currency, + 'discount': Marketing.UDO.discount, + 'tax': transactionData ? transactionData.OrderTaxTotal : 0, + 'shipping': transactionData ? transactionData.OrderTaxesShippingFeesTotal : 0, + 'irn_dpid': Marketing.UDO.dpid, + 'coupon': Marketing.UDO.coupon, + 'items': product_item_list('Purchase Item') + }); + } + Marketing.UDO.g_download('event', 'pdf_download', 'download'); + Marketing.UDO.g_mpv('event', 'multi-page view', 'user_interaction'); + Marketing.UDO.g_bc_80('event', 'video:80', 'media'); + Marketing.UDO.g_contactus('event', 'contact us', 'user_interaction'); + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3644354, [ + 3617682, + 3644317 + ], 699277, [ + 619404, + 620818 + ]); + Marketing.bindDependencyImmediate(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + if (dell_marketing_util.getParameterByName('mdebug', location.search) == 'true') { + dell_marketing_util.getDpid = function () { + return new Date().getTime(); + }; + Marketing.gEvent('DC-9632645/sales0/csb_test+transactions', 'purchase'); + document.querySelectorAll('iframe').forEach(function (key) { + if (key.src.includes('type=sales')) + key.contentWindow.postMessage(JSON.stringify(Marketing), '*'); + }); + } + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3600311, [3617682], 636142, [619404]); + Marketing.bindDependencyDOMParsed(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + if (Marketing.UDO.priorconsent) { + var c = Marketing.scDataObj.country; + if (c === 'us') + Marketing.insertScript('//vt.myvisualiq.net/2/TxUQNHSKvGWIiMj1Oh3tfw%3D%3D/vt-288.js'); + if (c === 'ca') + Marketing.insertScript('//vt.myvisualiq.net/2/TxUQNHSKvGWIiMj1Oh3tfw%3D%3D/vt-289.js'); + if (c === 'br') + Marketing.insertScript('//vt.myvisualiq.net/2/wQQtTiizl4SixrhITyTqbg%3D%3D/vt-286.js'); + if (c === 'uk') + Marketing.insertScript('//vt.myvisualiq.net/2/ami7eWD7Ma9qku9HDG232w%3D%3D/vt-213.js'); + if (c === 'jp') + Marketing.insertScript('//vt.myvisualiq.net/2/6%2BxT%2BO3z1zh14yulJBDN6g%3D%3D/vt-287.js'); + if (c === 'au') + Marketing.insertScript('//vt.myvisualiq.net/2/ipeeyHht4npQEiziCWaYzw%3D%3D/vt-299.js'); + if (c === 'nz') + Marketing.insertScript('//vt.myvisualiq.net/2/ipeeyHht4npQEiziCWaYzw%3D%3D/vt-301.js'); + if (c === 'in') + Marketing.insertScript('//vt.myvisualiq.net/2/uBF%2BndJT7n0r9WysNI1Vww%3D%3D/vt-298.js'); + if (c === 'fr') + Marketing.insertScript('//vt.myvisualiq.net/2/GXOdN%2BWugY3N3n4a5LAkNQ%3D%3D/vt-300.js'); + if (c === 'de') + Marketing.insertScript('//vt.myvisualiq.net/2/v9BJOGcgl4wfjn7pXBhunA%3D%3D/vt-302.js'); + } + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }, 3593365, [ + 3506924, + 3606329 + ], 621919, [ + 610310, + 610323 + ]); + Marketing.bindDependencyImmediate(function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + Marketing.UDO.fl_loaded = false; + if (Marketing.UDO.priorconsent) { + Marketing.loadScriptCallback('https://www.googletagmanager.com/gtag/js?id=DC-9632645', function () { + dell_marketing_util.custom_marketing_event('fl_loaded'); + Marketing.UDO.fl_loaded = true; + }); + window.dataLayer = window.dataLayer || []; + window.gtag = function () { + dataLayer.push(arguments); + }; + gtag('js', new Date()); + gtag('config', 'DC-9632645'); + gtag('config', 'DC-9632921'); + gtag('config', 'DC-9632648'); + var cflv_master_setup = function () { + return { + allow_custom_scripts: true, + u1: Marketing.UDO.language, + u10: Marketing.UDO.cseg, + u11: Marketing.UDO.deals, + u12: Marketing.UDO.device, + u13: Marketing.UDO.discount, + u14: Marketing.UDO.family, + u15: Marketing.UDO.ogid, + u16: Marketing.UDO.ordercode, + u17: Marketing.UDO.platform, + u18: Marketing.UDO.prodcat, + u19: Marketing.UDO.product, + u2: Marketing.UDO.segment, + u20: Marketing.UDO.promoid, + u21: Marketing.UDO.type, + u22: dell_marketing_util.getParameterByName('dgc', location.toString().toLowerCase()), + u23: Marketing.UDO.gacd, + u24: dell_marketing_util.getParameterByName('lid', location.toString().toLowerCase()), + u25: Marketing.UDO.ven1, + u26: Marketing.UDO.ven2, + u28: dell_marketing_util.getParameterByName('tfcid', location.toString().toLowerCase()), + u29: Marketing.UDO.revenue, + u3: Marketing.UDO.currency, + u30: Marketing.UDO.usdrev, + u35: Marketing.UDO.dpid, + u36: Marketing.UDO.land, + u37: Marketing.UDO.serialprodlist, + u38: Marketing.UDO.cjevent, + u4: Marketing.UDO.country, + u5: Marketing.UDO.accountid, + u6: Marketing.UDO.category, + u7: Marketing.UDO.categorypath, + u8: Marketing.UDO.cid, + u9: Marketing.UDO.coupon + }; + }; + Marketing.UDO.readData(); + var cflv_master = cflv_master_setup(); + cflv_master['u31'] = ''; + var adobe_mcmid = dell_marketing_util.getCookie('AMCV_4DD80861515CAB990A490D45%40AdobeOrg'); + if (adobe_mcmid) + cflv_master['u31'] = adobe_mcmid.split('MCMID|')[1].split('|')[0]; + Marketing.gEvent = Marketing.gEvent || function (idString, eventType) { + window.addEventListener('fl_loaded', function () { + var cflv = cflv_master; + if (eventType === 'purchase') { + cflv['value'] = Marketing.UDO.usdrev || Marketing.UDO.revenue; + cflv['transaction_id'] = dell_marketing_util.getDpid(); + } + cflv['send_to'] = idString; + gtag('event', eventType, cflv); + }); + if (Marketing.UDO.fl_loaded) { + cflv_master = cflv_master_setup(); + var cflv = cflv_master; + if (eventType === 'purchase') { + cflv['value'] = Marketing.UDO.usdrev || Marketing.UDO.revenue; + cflv['transaction_id'] = dell_marketing_util.getDpid(); + } + cflv['send_to'] = idString; + gtag('event', eventType, cflv); + } + }; + } + }, 3617682, [3606329], 619404, [610323]); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-bc51028c5fccd8dec101b0f2fc0e2887b1e7ef5e b/resources/sugarcoat-bc51028c5fccd8dec101b0f2fc0e2887b1e7ef5e new file mode 100644 index 00000000..3bf7d0dd --- /dev/null +++ b/resources/sugarcoat-bc51028c5fccd8dec101b0f2fc0e2887b1e7ef5e @@ -0,0 +1,127 @@ +{ + const $___mock_d0c2e2703cb522d7 = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_d0c2e2703cb522d7); + (function () { + Marketing.bindDependencyDOMParsed(function () { + const $___old_a7d3b600ceb76141 = {}.constructor.getOwnPropertyDescriptor(window, 'sessionStorage'); + try { + if ($___old_a7d3b600ceb76141) + ({}.constructor.defineProperty(window, 'sessionStorage', $___mock_d0c2e2703cb522d7.sessionStorage)); + return function () { + var Bootstrapper = window['Marketing']; + var ensightenOptions = Marketing.ensightenOptions; + try { + Marketing.UDO.perfTimingStart('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + var marketingscDataObj = Marketing.scDataObj, marketingUDO = Marketing.UDO, cachebuster = new Date().getTime(), pixelID = '', hvePixelID = ''; + var pixelFire = function (pixelid) { + Marketing.imageRequest('//t.myvisualiq.net/activity_pixel?pt=i&et=a&r=' + cachebuster + '&ago=212&ao=871&px=' + pixelid + '&ord=' + marketingUDO.dpid + '&revenue=' + marketingUDO.revenue); + }; + Marketing.on('click', '.OoyalaVideo', function () { + pixelid = '1001'; + pixelFire(pixelid); + if (marketingscDataObj.page.includes('alienware') || marketingscDataObj.categoryid.includes('alienware') || marketingUDO.category.includes('alienware') || marketingUDO.family.toLowerCase().includes('alienware')) { + pixelid = '1002'; + pixelFire(pixelid); + } + if (marketingUDO.segment == 'bsd') { + pixelid = '1003'; + pixelFire(pixelid); + } + if (marketingUDO.segment == 'dhs') { + pixelid = '1004'; + pixelFire(pixelid); + } + if (marketingUDO.segment == 'eep') { + pixelid = '1005'; + pixelFire(pixelid); + } + }); + if (window.location.pathname == '/en/small-business-central') { + pixelid = '1006'; + pixelFire(pixelid); + } + if (window.location.pathname.includes('/en/small-business-central/contact-dell/thank-you')) { + pixelid = '1007'; + pixelFire(pixelid); + } + marketingUDO.hve_mpv('//t.myvisualiq.net/activity_pixel?pt=i&et=a&r=' + cachebuster + '&ago=212&ao=871&px=878&ord=' + marketingUDO.dpid + '&revenue=' + marketingUDO.revenue); + if (marketingUDO.segment == 'bsd') + hvePixelID = '880'; + if (marketingUDO.segment == 'dhs') + hvePixelID = '881'; + if (marketingUDO.segment == 'eep') + hvePixelID = '882'; + if (marketingscDataObj.page.includes('alienware') || marketingscDataObj.categoryid.includes('alienware') || marketingUDO.category.includes('alienware') || marketingUDO.family.toLowerCase().includes('alienware')) + hvePixelID = '879'; + if (hvePixelID !== '') + marketingUDO.hve_mpv('//t.myvisualiq.net/activity_pixel?pt=i&et=a&r=' + cachebuster + '&ago=212&ao=871&px=' + hvePixelID + '&ord=' + marketingUDO.dpid + '&revenue=' + marketingUDO.revenue); + Marketing.UDO.perfTimingEnd('ruleId-' + this.id + '-deploymentId-' + this.deploymentId); + } catch (e) { + dell_marketing_util.debug(e); + } + }.apply(this, arguments); + } finally { + if ($___old_a7d3b600ceb76141) + ({}.constructor.defineProperty(window, 'sessionStorage', $___old_a7d3b600ceb76141)); + } + }, 3593374, [3606329], 638020, [610323]); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-cce8c1365e310397573f250aac085a12a8319bb7 b/resources/sugarcoat-cce8c1365e310397573f250aac085a12a8319bb7 new file mode 100644 index 00000000..a562bd80 --- /dev/null +++ b/resources/sugarcoat-cce8c1365e310397573f250aac085a12a8319bb7 @@ -0,0 +1,18925 @@ +{ + const $___mock_5a84e19b2122ba96 = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_5a84e19b2122ba96); + (function () { + !function (e) { + var t = {}; + function n(r) { + if (t[r]) + return t[r].exports; + var o = t[r] = { + i: r, + l: !1, + exports: {} + }; + return e[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports; + } + n.m = e, n.c = t, n.d = function (e, t, r) { + n.o(e, t) || Object.defineProperty(e, t, { + enumerable: !0, + get: r + }); + }, n.r = function (e) { + 'undefined' !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }), Object.defineProperty(e, '__esModule', { value: !0 }); + }, n.t = function (e, t) { + if (1 & t && (e = n(e)), 8 & t) + return e; + if (4 & t && 'object' === typeof e && e && e.__esModule) + return e; + var r = Object.create(null); + if (n.r(r), Object.defineProperty(r, 'default', { + enumerable: !0, + value: e + }), 2 & t && 'string' != typeof e) + for (var o in e) + n.d(r, o, function (t) { + return e[t]; + }.bind(null, o)); + return r; + }, n.n = function (e) { + var t = e && e.__esModule ? function () { + return e.default; + } : function () { + return e; + }; + return n.d(t, 'a', t), t; + }, n.o = function (e, t) { + return Object.prototype.hasOwnProperty.call(e, t); + }, n.p = '/', n(n.s = 152); + }([ + function (e, t, n) { + 'use strict'; + e.exports = n(260); + }, + function (e, t, n) { + var r = n(7), o = n(36).f, i = n(22), a = n(23), s = n(57), c = n(87), u = n(64); + e.exports = function (e, t) { + var n, l, f, p, d, h = e.target, m = e.global, g = e.stat; + if (n = m ? r : g ? r[h] || s(h, {}) : (r[h] || {}).prototype) + for (l in t) { + if (p = t[l], f = e.noTargetGet ? (d = o(n, l)) && d.value : n[l], !u(m ? l : h + (g ? '.' : '#') + l, e.forced) && void 0 !== f) { + if (typeof p === typeof f) + continue; + c(p, f); + } + (e.sham || f && f.sham) && i(p, 'sham', !0), a(n, l, p, e); + } + }; + }, + function (e, t, n) { + 'use strict'; + (function (e) { + n.d(t, 'a', function () { + return et; + }), n.d(t, 'b', function () { + return be; + }); + var r = n(83), o = n.n(r), i = n(148), a = n.n(i), s = n(0), c = n.n(s), u = n(149), l = n(34), f = n(84), p = (n(118), n(150)), d = n(151), h = function (e, t) { + for (var n = [e[0]], r = 0, o = t.length; r < o; r += 1) + n.push(t[r], e[r + 1]); + return n; + }, m = 'function' === typeof Symbol && 'symbol' === typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' === typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + }, g = function (e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + }, v = function () { + function e(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + return function (t, n, r) { + return n && e(t.prototype, n), r && e(t, r), t; + }; + }(), y = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }, b = function (e, t) { + if ('function' !== typeof t && null !== t) + throw new TypeError('Super expression must either be null or a function, not ' + typeof t); + e.prototype = Object.create(t && t.prototype, { + constructor: { + value: e, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); + }, E = function (e, t) { + if (!e) + throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); + return !t || 'object' !== typeof t && 'function' !== typeof t ? e : t; + }, w = function (e) { + return 'object' === ('undefined' === typeof e ? 'undefined' : m(e)) && e.constructor === Object; + }, x = Object.freeze([]), S = Object.freeze({}); + function C(e) { + return 'function' === typeof e; + } + function k(e) { + return e.displayName || e.name || 'Component'; + } + function T(e) { + return e && 'string' === typeof e.styledComponentId; + } + var _ = 'undefined' !== typeof e && (Object({ + NODE_ENV: 'production', + PUBLIC_URL: '', + REACT_APP_LOG_API: 'https://audit-tcfv2.quantcast.mgr.consensu.org', + REACT_APP_GEOIP_API_URL: 'https://apis.quantcast.mgr.consensu.org/geoip', + REACT_APP_CMP_COOKIE_API: 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', + REACT_APP_GOOGLE_ATP_URL: 'https://quantcast.mgr.consensu.org/tcfv2/google-atp-list.json', + REACT_APP_CONSENTED_IDENTITY_WEBSITE_API: 'https://app.permisio.com/api', + REACT_APP_VERSION: '23', + REACT_APP_CMPUI_SRC: 'https://quantcast.mgr.consensu.org/tcfv2/23/cmp2ui.js', + REACT_APP_GVL_BASE_URL: 'https://quantcast.mgr.consensu.org/GVL-v2/', + REACT_APP_TRANSLATION_BASE_URL: 'https://www.quantcast.mgr.consensu.org/tcfv2/translations/' + }).REACT_APP_SC_ATTR || Object({ + NODE_ENV: 'production', + PUBLIC_URL: '', + REACT_APP_LOG_API: 'https://audit-tcfv2.quantcast.mgr.consensu.org', + REACT_APP_GEOIP_API_URL: 'https://apis.quantcast.mgr.consensu.org/geoip', + REACT_APP_CMP_COOKIE_API: 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', + REACT_APP_GOOGLE_ATP_URL: 'https://quantcast.mgr.consensu.org/tcfv2/google-atp-list.json', + REACT_APP_CONSENTED_IDENTITY_WEBSITE_API: 'https://app.permisio.com/api', + REACT_APP_VERSION: '23', + REACT_APP_CMPUI_SRC: 'https://quantcast.mgr.consensu.org/tcfv2/23/cmp2ui.js', + REACT_APP_GVL_BASE_URL: 'https://quantcast.mgr.consensu.org/GVL-v2/', + REACT_APP_TRANSLATION_BASE_URL: 'https://www.quantcast.mgr.consensu.org/tcfv2/translations/' + }).SC_ATTR) || 'data-styled', P = 'undefined' !== typeof window && 'HTMLElement' in window, O = 'boolean' === typeof SC_DISABLE_SPEEDY && SC_DISABLE_SPEEDY || 'undefined' !== typeof e && (Object({ + NODE_ENV: 'production', + PUBLIC_URL: '', + REACT_APP_LOG_API: 'https://audit-tcfv2.quantcast.mgr.consensu.org', + REACT_APP_GEOIP_API_URL: 'https://apis.quantcast.mgr.consensu.org/geoip', + REACT_APP_CMP_COOKIE_API: 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', + REACT_APP_GOOGLE_ATP_URL: 'https://quantcast.mgr.consensu.org/tcfv2/google-atp-list.json', + REACT_APP_CONSENTED_IDENTITY_WEBSITE_API: 'https://app.permisio.com/api', + REACT_APP_VERSION: '23', + REACT_APP_CMPUI_SRC: 'https://quantcast.mgr.consensu.org/tcfv2/23/cmp2ui.js', + REACT_APP_GVL_BASE_URL: 'https://quantcast.mgr.consensu.org/GVL-v2/', + REACT_APP_TRANSLATION_BASE_URL: 'https://www.quantcast.mgr.consensu.org/tcfv2/translations/' + }).REACT_APP_SC_DISABLE_SPEEDY || Object({ + NODE_ENV: 'production', + PUBLIC_URL: '', + REACT_APP_LOG_API: 'https://audit-tcfv2.quantcast.mgr.consensu.org', + REACT_APP_GEOIP_API_URL: 'https://apis.quantcast.mgr.consensu.org/geoip', + REACT_APP_CMP_COOKIE_API: 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', + REACT_APP_GOOGLE_ATP_URL: 'https://quantcast.mgr.consensu.org/tcfv2/google-atp-list.json', + REACT_APP_CONSENTED_IDENTITY_WEBSITE_API: 'https://app.permisio.com/api', + REACT_APP_VERSION: '23', + REACT_APP_CMPUI_SRC: 'https://quantcast.mgr.consensu.org/tcfv2/23/cmp2ui.js', + REACT_APP_GVL_BASE_URL: 'https://quantcast.mgr.consensu.org/GVL-v2/', + REACT_APP_TRANSLATION_BASE_URL: 'https://www.quantcast.mgr.consensu.org/tcfv2/translations/' + }).SC_DISABLE_SPEEDY) || !1, I = {}; + var L = function (e) { + function t(n) { + g(this, t); + for (var r = arguments.length, o = Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++) + o[i - 1] = arguments[i]; + var a = E(this, e.call(this, 'An error occurred. See https://github.com/styled-components/styled-components/blob/master/packages/styled-components/src/utils/errors.md#' + n + ' for more information.' + (o.length > 0 ? ' Additional arguments: ' + o.join(', ') : ''))); + return E(a); + } + return b(t, e), t; + }(Error), A = /^[^\S\n]*?\/\* sc-component-id:\s*(\S+)\s+\*\//gm, R = function (e) { + var t = '' + (e || ''), n = []; + return t.replace(A, function (e, t, r) { + return n.push({ + componentId: t, + matchIndex: r + }), e; + }), n.map(function (e, r) { + var o = e.componentId, i = e.matchIndex, a = n[r + 1]; + return { + componentId: o, + cssFromDOM: a ? t.slice(i, a.matchIndex) : t.slice(i) + }; + }); + }, N = /^\s*\/\/.*$/gm, j = new o.a({ + global: !1, + cascade: !0, + keyframe: !1, + prefix: !1, + compress: !1, + semicolon: !0 + }), q = new o.a({ + global: !1, + cascade: !0, + keyframe: !1, + prefix: !0, + compress: !1, + semicolon: !1 + }), F = [], D = function (e) { + if (-2 === e) { + var t = F; + return F = [], t; + } + }, M = a()(function (e) { + F.push(e); + }), U = void 0, V = void 0, B = void 0, z = function (e, t, n) { + return t > 0 && -1 !== n.slice(0, t).indexOf(V) && n.slice(t - V.length, t) !== V ? '.' + U : e; + }; + q.use([ + function (e, t, n) { + 2 === e && n.length && n[0].lastIndexOf(V) > 0 && (n[0] = n[0].replace(B, z)); + }, + M, + D + ]), j.use([ + M, + D + ]); + var G = function (e) { + return j('', e); + }; + function H(e, t, n) { + var r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : '&', o = e.join('').replace(N, ''), i = t && n ? n + ' ' + t + ' { ' + o + ' }' : o; + return U = r, V = t, B = new RegExp('\\' + V + '\\b', 'g'), q(n || !t ? '' : t, i); + } + var W = function () { + return n.nc; + }, $ = function (e, t, n) { + n && ((e[t] || (e[t] = Object.create(null)))[n] = !0); + }, Y = function (e, t) { + e[t] = Object.create(null); + }, Q = function (e) { + return function (t, n) { + return void 0 !== e[t] && e[t][n]; + }; + }, K = function (e) { + var t = ''; + for (var n in e) + t += Object.keys(e[n]).join(' ') + ' '; + return t.trim(); + }, J = function (e) { + if (e.sheet) + return e.sheet; + for (var t = e.ownerDocument.styleSheets.length, n = 0; n < t; n += 1) { + var r = e.ownerDocument.styleSheets[n]; + if (r.ownerNode === e) + return r; + } + throw new L(10); + }, X = function (e, t, n) { + if (!t) + return !1; + var r = e.cssRules.length; + try { + e.insertRule(t, n <= r ? n : r); + } catch (o) { + return !1; + } + return !0; + }, Z = function (e) { + return '\n/* sc-component-id: ' + e + ' */\n'; + }, ee = function (e, t) { + for (var n = 0, r = 0; r <= t; r += 1) + n += e[r]; + return n; + }, te = function (e, t) { + return function (n) { + var r = W(); + return ''; + }; + }, ne = function (e, t) { + return function () { + var n, r = ((n = {})[_] = K(t), n['data-styled-version'] = '4.4.1', n), o = W(); + return o && (r.nonce = o), c.a.createElement('style', y({}, r, { dangerouslySetInnerHTML: { __html: e() } })); + }; + }, re = function (e) { + return function () { + return Object.keys(e); + }; + }, oe = function (e, t) { + return e.createTextNode(Z(t)); + }, ie = function e(t, n) { + var r = void 0 === t ? Object.create(null) : t, o = void 0 === n ? Object.create(null) : n, i = function (e) { + var t = o[e]; + return void 0 !== t ? t : o[e] = ['']; + }, a = function () { + var e = ''; + for (var t in o) { + var n = o[t][0]; + n && (e += Z(t) + n); + } + return e; + }; + return { + clone: function () { + var t = function (e) { + var t = Object.create(null); + for (var n in e) + t[n] = y({}, e[n]); + return t; + }(r), n = Object.create(null); + for (var i in o) + n[i] = [o[i][0]]; + return e(t, n); + }, + css: a, + getIds: re(o), + hasNameForId: Q(r), + insertMarker: i, + insertRules: function (e, t, n) { + i(e)[0] += t.join(' '), $(r, e, n); + }, + removeRules: function (e) { + var t = o[e]; + void 0 !== t && (t[0] = '', Y(r, e)); + }, + sealed: !1, + styleTag: null, + toElement: ne(a, r), + toHTML: te(a, r) + }; + }, ae = function (e, t, n, r, o) { + if (P && !n) { + var i = function (e, t, n) { + var r = document; + e ? r = e.ownerDocument : t && (r = t.ownerDocument); + var o = r.createElement('style'); + o.setAttribute(_, ''), o.setAttribute('data-styled-version', '4.4.1'); + var i = W(); + if (i && o.setAttribute('nonce', i), o.appendChild(r.createTextNode('')), e && !t) + e.appendChild(o); + else { + if (!t || !e || !t.parentNode) + throw new L(6); + t.parentNode.insertBefore(o, n ? t : t.nextSibling); + } + return o; + }(e, t, r); + return O ? function (e, t) { + var n = Object.create(null), r = Object.create(null), o = void 0 !== t, i = !1, a = function (t) { + var o = r[t]; + return void 0 !== o ? o : (r[t] = oe(e.ownerDocument, t), e.appendChild(r[t]), n[t] = Object.create(null), r[t]); + }, s = function () { + var e = ''; + for (var t in r) + e += r[t].data; + return e; + }; + return { + clone: function () { + throw new L(5); + }, + css: s, + getIds: re(r), + hasNameForId: Q(n), + insertMarker: a, + insertRules: function (e, r, s) { + for (var c = a(e), u = [], l = r.length, f = 0; f < l; f += 1) { + var p = r[f], d = o; + if (d && -1 !== p.indexOf('@import')) + u.push(p); + else { + d = !1; + var h = f === l - 1 ? '' : ' '; + c.appendData('' + p + h); + } + } + $(n, e, s), o && u.length > 0 && (i = !0, t().insertRules(e + '-import', u)); + }, + removeRules: function (a) { + var s = r[a]; + if (void 0 !== s) { + var c = oe(e.ownerDocument, a); + e.replaceChild(c, s), r[a] = c, Y(n, a), o && i && t().removeRules(a + '-import'); + } + }, + sealed: !1, + styleTag: e, + toElement: ne(s, n), + toHTML: te(s, n) + }; + }(i, o) : function (e, t) { + var n = Object.create(null), r = Object.create(null), o = [], i = void 0 !== t, a = !1, s = function (e) { + var t = r[e]; + return void 0 !== t ? t : (r[e] = o.length, o.push(0), Y(n, e), r[e]); + }, c = function () { + var t = J(e).cssRules, n = ''; + for (var i in r) { + n += Z(i); + for (var a = r[i], s = ee(o, a), c = s - o[a]; c < s; c += 1) { + var u = t[c]; + void 0 !== u && (n += u.cssText); + } + } + return n; + }; + return { + clone: function () { + throw new L(5); + }, + css: c, + getIds: re(r), + hasNameForId: Q(n), + insertMarker: s, + insertRules: function (r, c, u) { + for (var l = s(r), f = J(e), p = ee(o, l), d = 0, h = [], m = c.length, g = 0; g < m; g += 1) { + var v = c[g], y = i; + y && -1 !== v.indexOf('@import') ? h.push(v) : X(f, v, p + d) && (y = !1, d += 1); + } + i && h.length > 0 && (a = !0, t().insertRules(r + '-import', h)), o[l] += d, $(n, r, u); + }, + removeRules: function (s) { + var c = r[s]; + if (void 0 !== c && !1 !== e.isConnected) { + var u = o[c]; + !function (e, t, n) { + for (var r = t - n, o = t; o > r; o -= 1) + e.deleteRule(o); + }(J(e), ee(o, c) - 1, u), o[c] = 0, Y(n, s), i && a && t().removeRules(s + '-import'); + } + }, + sealed: !1, + styleTag: e, + toElement: ne(c, n), + toHTML: te(c, n) + }; + }(i, o); + } + return ie(); + }, se = /\s+/, ce = void 0; + ce = P ? O ? 40 : 1000 : -1; + var ue = 0, le = void 0, fe = function () { + function e() { + var t = this, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : P ? document.head : null, r = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + g(this, e), this.getImportRuleTag = function () { + var e = t.importRuleTag; + if (void 0 !== e) + return e; + var n = t.tags[0]; + return t.importRuleTag = ae(t.target, n ? n.styleTag : null, t.forceServer, !0); + }, ue += 1, this.id = ue, this.forceServer = r, this.target = r ? null : n, this.tagMap = {}, this.deferred = {}, this.rehydratedNames = {}, this.ignoreRehydratedNames = {}, this.tags = [], this.capacity = 1, this.clones = []; + } + return e.prototype.rehydrate = function () { + if (!P || this.forceServer) + return this; + var e = [], t = [], n = !1, r = document.querySelectorAll('style[' + _ + '][data-styled-version="4.4.1"]'), o = r.length; + if (!o) + return this; + for (var i = 0; i < o; i += 1) { + var a = r[i]; + n || (n = !!a.getAttribute('data-styled-streamed')); + for (var s, c = (a.getAttribute(_) || '').trim().split(se), u = c.length, l = 0; l < u; l += 1) + s = c[l], this.rehydratedNames[s] = !0; + t.push.apply(t, R(a.textContent)), e.push(a); + } + var f = t.length; + if (!f) + return this; + var p = this.makeTag(null); + !function (e, t, n) { + for (var r = 0, o = n.length; r < o; r += 1) { + var i = n[r], a = i.componentId, s = i.cssFromDOM, c = G(s); + e.insertRules(a, c); + } + for (var u = 0, l = t.length; u < l; u += 1) { + var f = t[u]; + f.parentNode && f.parentNode.removeChild(f); + } + }(p, e, t), this.capacity = Math.max(1, ce - f), this.tags.push(p); + for (var d = 0; d < f; d += 1) + this.tagMap[t[d].componentId] = p; + return this; + }, e.reset = function () { + var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; + le = new e(void 0, t).rehydrate(); + }, e.prototype.clone = function () { + var t = new e(this.target, this.forceServer); + return this.clones.push(t), t.tags = this.tags.map(function (e) { + for (var n = e.getIds(), r = e.clone(), o = 0; o < n.length; o += 1) + t.tagMap[n[o]] = r; + return r; + }), t.rehydratedNames = y({}, this.rehydratedNames), t.deferred = y({}, this.deferred), t; + }, e.prototype.sealAllTags = function () { + this.capacity = 1, this.tags.forEach(function (e) { + e.sealed = !0; + }); + }, e.prototype.makeTag = function (e) { + var t = e ? e.styleTag : null; + return ae(this.target, t, this.forceServer, !1, this.getImportRuleTag); + }, e.prototype.getTagForId = function (e) { + var t = this.tagMap[e]; + if (void 0 !== t && !t.sealed) + return t; + var n = this.tags[this.tags.length - 1]; + return this.capacity -= 1, 0 === this.capacity && (this.capacity = ce, n = this.makeTag(n), this.tags.push(n)), this.tagMap[e] = n; + }, e.prototype.hasId = function (e) { + return void 0 !== this.tagMap[e]; + }, e.prototype.hasNameForId = function (e, t) { + if (void 0 === this.ignoreRehydratedNames[e] && this.rehydratedNames[t]) + return !0; + var n = this.tagMap[e]; + return void 0 !== n && n.hasNameForId(e, t); + }, e.prototype.deferredInject = function (e, t) { + if (void 0 === this.tagMap[e]) { + for (var n = this.clones, r = 0; r < n.length; r += 1) + n[r].deferredInject(e, t); + this.getTagForId(e).insertMarker(e), this.deferred[e] = t; + } + }, e.prototype.inject = function (e, t, n) { + for (var r = this.clones, o = 0; o < r.length; o += 1) + r[o].inject(e, t, n); + var i = this.getTagForId(e); + if (void 0 !== this.deferred[e]) { + var a = this.deferred[e].concat(t); + i.insertRules(e, a, n), this.deferred[e] = void 0; + } else + i.insertRules(e, t, n); + }, e.prototype.remove = function (e) { + var t = this.tagMap[e]; + if (void 0 !== t) { + for (var n = this.clones, r = 0; r < n.length; r += 1) + n[r].remove(e); + t.removeRules(e), this.ignoreRehydratedNames[e] = !0, this.deferred[e] = void 0; + } + }, e.prototype.toHTML = function () { + return this.tags.map(function (e) { + return e.toHTML(); + }).join(''); + }, e.prototype.toReactElements = function () { + var e = this.id; + return this.tags.map(function (t, n) { + var r = 'sc-' + e + '-' + n; + return Object(s.cloneElement)(t.toElement(), { key: r }); + }); + }, v(e, null, [ + { + key: 'master', + get: function () { + return le || (le = new e().rehydrate()); + } + }, + { + key: 'instance', + get: function () { + return e.master; + } + } + ]), e; + }(), pe = function () { + function e(t, n) { + var r = this; + g(this, e), this.inject = function (e) { + e.hasNameForId(r.id, r.name) || e.inject(r.id, r.rules, r.name); + }, this.toString = function () { + throw new L(12, String(r.name)); + }, this.name = t, this.rules = n, this.id = 'sc-keyframes-' + t; + } + return e.prototype.getName = function () { + return this.name; + }, e; + }(), de = /([A-Z])/g, he = /^ms-/; + function me(e) { + return e.replace(de, '-$1').toLowerCase().replace(he, '-ms-'); + } + var ge = function (e) { + return void 0 === e || null === e || !1 === e || '' === e; + }, ve = function e(t, n) { + var r = []; + return Object.keys(t).forEach(function (n) { + if (!ge(t[n])) { + if (w(t[n])) + return r.push.apply(r, e(t[n], n)), r; + if (C(t[n])) + return r.push(me(n) + ':', t[n], ';'), r; + r.push(me(n) + ': ' + (o = n, (null == (i = t[n]) || 'boolean' === typeof i || '' === i ? '' : 'number' !== typeof i || 0 === i || o in u.a ? String(i).trim() : i + 'px') + ';')); + } + var o, i; + return r; + }), n ? [n + ' {'].concat(r, ['}']) : r; + }; + function ye(e, t, n) { + if (Array.isArray(e)) { + for (var r, o = [], i = 0, a = e.length; i < a; i += 1) + null !== (r = ye(e[i], t, n)) && (Array.isArray(r) ? o.push.apply(o, r) : o.push(r)); + return o; + } + return ge(e) ? null : T(e) ? '.' + e.styledComponentId : C(e) ? 'function' !== typeof (s = e) || s.prototype && s.prototype.isReactComponent || !t ? e : ye(e(t), t, n) : e instanceof pe ? n ? (e.inject(n), e.getName()) : e : w(e) ? ve(e) : e.toString(); + var s; + } + function be(e) { + for (var t = arguments.length, n = Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) + n[r - 1] = arguments[r]; + return C(e) || w(e) ? ye(h(x, [e].concat(n))) : ye(h(e, n)); + } + function Ee(e) { + for (var t, n = 0 | e.length, r = 0 | n, o = 0; n >= 4;) + t = 1540483477 * (65535 & (t = 255 & e.charCodeAt(o) | (255 & e.charCodeAt(++o)) << 8 | (255 & e.charCodeAt(++o)) << 16 | (255 & e.charCodeAt(++o)) << 24)) + ((1540483477 * (t >>> 16) & 65535) << 16), r = 1540483477 * (65535 & r) + ((1540483477 * (r >>> 16) & 65535) << 16) ^ (t = 1540483477 * (65535 & (t ^= t >>> 24)) + ((1540483477 * (t >>> 16) & 65535) << 16)), n -= 4, ++o; + switch (n) { + case 3: + r ^= (255 & e.charCodeAt(o + 2)) << 16; + case 2: + r ^= (255 & e.charCodeAt(o + 1)) << 8; + case 1: + r = 1540483477 * (65535 & (r ^= 255 & e.charCodeAt(o))) + ((1540483477 * (r >>> 16) & 65535) << 16); + } + return ((r = 1540483477 * (65535 & (r ^= r >>> 13)) + ((1540483477 * (r >>> 16) & 65535) << 16)) ^ r >>> 15) >>> 0; + } + var we = function (e) { + return String.fromCharCode(e + (e > 25 ? 39 : 97)); + }; + function xe(e) { + var t = '', n = void 0; + for (n = e; n > 52; n = Math.floor(n / 52)) + t = we(n % 52) + t; + return we(n % 52) + t; + } + function Se(e, t) { + for (var n = 0; n < e.length; n += 1) { + var r = e[n]; + if (Array.isArray(r) && !Se(r, t)) + return !1; + if (C(r) && !T(r)) + return !1; + } + return !t.some(function (e) { + return C(e) || function (e) { + for (var t in e) + if (C(e[t])) + return !0; + return !1; + }(e); + }); + } + var Ce, ke = function (e) { + return xe(Ee(e)); + }, Te = function () { + function e(t, n, r) { + g(this, e), this.rules = t, this.isStatic = Se(t, n), this.componentId = r, fe.master.hasId(r) || fe.master.deferredInject(r, []); + } + return e.prototype.generateAndInjectStyles = function (e, t) { + var n = this.isStatic, r = this.componentId, o = this.lastClassName; + if (P && n && 'string' === typeof o && t.hasNameForId(r, o)) + return o; + var i = ye(this.rules, e, t), a = ke(this.componentId + i.join('')); + return t.hasNameForId(r, a) || t.inject(this.componentId, H(i, '.' + a, void 0, r), a), this.lastClassName = a, a; + }, e.generateName = function (e) { + return ke(e); + }, e; + }(), _e = function (e, t) { + var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : S, r = !!n && e.theme === n.theme, o = e.theme && !r ? e.theme : t || n.theme; + return o; + }, Pe = /[[\].#*$><+~=|^:(),"'`-]+/g, Oe = /(^-|-$)/g; + function Ie(e) { + return e.replace(Pe, '-').replace(Oe, ''); + } + function Le(e) { + return 'string' === typeof e && !0; + } + var Ae = { + childContextTypes: !0, + contextTypes: !0, + defaultProps: !0, + displayName: !0, + getDerivedStateFromProps: !0, + propTypes: !0, + type: !0 + }, Re = { + name: !0, + length: !0, + prototype: !0, + caller: !0, + callee: !0, + arguments: !0, + arity: !0 + }, Ne = ((Ce = {})[l.ForwardRef] = { + $$typeof: !0, + render: !0 + }, Ce), je = Object.defineProperty, qe = Object.getOwnPropertyNames, Fe = Object.getOwnPropertySymbols, De = void 0 === Fe ? function () { + return []; + } : Fe, Me = Object.getOwnPropertyDescriptor, Ue = Object.getPrototypeOf, Ve = Object.prototype, Be = Array.prototype; + function ze(e, t, n) { + if ('string' !== typeof t) { + var r = Ue(t); + r && r !== Ve && ze(e, r, n); + for (var o = Be.concat(qe(t), De(t)), i = Ne[e.$$typeof] || Ae, a = Ne[t.$$typeof] || Ae, s = o.length, c = void 0, u = void 0; s--;) + if (u = o[s], !Re[u] && (!n || !n[u]) && (!a || !a[u]) && (!i || !i[u]) && (c = Me(t, u))) + try { + je(e, u, c); + } catch (l) { + } + return e; + } + return e; + } + var Ge = Object(s.createContext)(), He = Ge.Consumer, We = (function (e) { + function t(n) { + g(this, t); + var r = E(this, e.call(this, n)); + return r.getContext = Object(f.a)(r.getContext.bind(r)), r.renderInner = r.renderInner.bind(r), r; + } + b(t, e), t.prototype.render = function () { + return this.props.children ? c.a.createElement(Ge.Consumer, null, this.renderInner) : null; + }, t.prototype.renderInner = function (e) { + var t = this.getContext(this.props.theme, e); + return c.a.createElement(Ge.Provider, { value: t }, this.props.children); + }, t.prototype.getTheme = function (e, t) { + if (C(e)) + return e(t); + if (null === e || Array.isArray(e) || 'object' !== ('undefined' === typeof e ? 'undefined' : m(e))) + throw new L(8); + return y({}, t, e); + }, t.prototype.getContext = function (e, t) { + return this.getTheme(e, t); + }; + }(s.Component), function () { + function e() { + g(this, e), this.masterSheet = fe.master, this.instance = this.masterSheet.clone(), this.sealed = !1; + } + e.prototype.seal = function () { + if (!this.sealed) { + var e = this.masterSheet.clones.indexOf(this.instance); + this.masterSheet.clones.splice(e, 1), this.sealed = !0; + } + }, e.prototype.collectStyles = function (e) { + if (this.sealed) + throw new L(2); + return c.a.createElement(Ye, { sheet: this.instance }, e); + }, e.prototype.getStyleTags = function () { + return this.seal(), this.instance.toHTML(); + }, e.prototype.getStyleElement = function () { + return this.seal(), this.instance.toReactElements(); + }, e.prototype.interleaveWithNodeStream = function (e) { + throw new L(3); + }; + }(), Object(s.createContext)()), $e = We.Consumer, Ye = function (e) { + function t(n) { + g(this, t); + var r = E(this, e.call(this, n)); + return r.getContext = Object(f.a)(r.getContext), r; + } + return b(t, e), t.prototype.getContext = function (e, t) { + if (e) + return e; + if (t) + return new fe(t); + throw new L(4); + }, t.prototype.render = function () { + var e = this.props, t = e.children, n = e.sheet, r = e.target; + return c.a.createElement(We.Provider, { value: this.getContext(n, r) }, t); + }, t; + }(s.Component), Qe = {}; + var Ke = function (e) { + function t() { + g(this, t); + var n = E(this, e.call(this)); + return n.attrs = {}, n.renderOuter = n.renderOuter.bind(n), n.renderInner = n.renderInner.bind(n), n; + } + return b(t, e), t.prototype.render = function () { + return c.a.createElement($e, null, this.renderOuter); + }, t.prototype.renderOuter = function () { + var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : fe.master; + return this.styleSheet = e, this.props.forwardedComponent.componentStyle.isStatic ? this.renderInner() : c.a.createElement(He, null, this.renderInner); + }, t.prototype.renderInner = function (e) { + var t = this.props.forwardedComponent, n = t.componentStyle, r = t.defaultProps, o = (t.displayName, t.foldedComponentIds), i = t.styledComponentId, a = t.target, c = void 0; + c = n.isStatic ? this.generateAndInjectStyles(S, this.props) : this.generateAndInjectStyles(_e(this.props, e, r) || S, this.props); + var u = this.props.as || this.attrs.as || a, l = Le(u), f = {}, d = y({}, this.props, this.attrs), h = void 0; + for (h in d) + 'forwardedComponent' !== h && 'as' !== h && ('forwardedRef' === h ? f.ref = d[h] : 'forwardedAs' === h ? f.as = d[h] : l && !Object(p.a)(h) || (f[h] = d[h])); + return this.props.style && this.attrs.style && (f.style = y({}, this.attrs.style, this.props.style)), f.className = Array.prototype.concat(o, i, c !== i ? c : null, this.props.className, this.attrs.className).filter(Boolean).join(' '), Object(s.createElement)(u, f); + }, t.prototype.buildExecutionContext = function (e, t, n) { + var r = this, o = y({}, t, { theme: e }); + return n.length ? (this.attrs = {}, n.forEach(function (e) { + var t, n = e, i = !1, a = void 0, s = void 0; + for (s in (C(n) && (n = n(o), i = !0), n)) + a = n[s], i || !C(a) || (t = a) && t.prototype && t.prototype.isReactComponent || T(a) || (a = a(o)), r.attrs[s] = a, o[s] = a; + }), o) : o; + }, t.prototype.generateAndInjectStyles = function (e, t) { + var n = t.forwardedComponent, r = n.attrs, o = n.componentStyle; + n.warnTooManyClasses; + return o.isStatic && !r.length ? o.generateAndInjectStyles(S, this.styleSheet) : o.generateAndInjectStyles(this.buildExecutionContext(e, t, r), this.styleSheet); + }, t; + }(s.Component); + function Je(e, t, n) { + var r = T(e), o = !Le(e), i = t.displayName, a = void 0 === i ? function (e) { + return Le(e) ? 'styled.' + e : 'Styled(' + k(e) + ')'; + }(e) : i, s = t.componentId, u = void 0 === s ? function (e, t, n) { + var r = 'string' !== typeof t ? 'sc' : Ie(t), o = (Qe[r] || 0) + 1; + Qe[r] = o; + var i = r + '-' + e.generateName(r + o); + return n ? n + '-' + i : i; + }(Te, t.displayName, t.parentComponentId) : s, l = t.ParentComponent, f = void 0 === l ? Ke : l, p = t.attrs, h = void 0 === p ? x : p, m = t.displayName && t.componentId ? Ie(t.displayName) + '-' + t.componentId : t.componentId || u, g = r && e.attrs ? Array.prototype.concat(e.attrs, h).filter(Boolean) : h, v = new Te(r ? e.componentStyle.rules.concat(n) : n, g, m), b = void 0, E = function (e, t) { + return c.a.createElement(f, y({}, e, { + forwardedComponent: b, + forwardedRef: t + })); + }; + return E.displayName = a, (b = c.a.forwardRef(E)).displayName = a, b.attrs = g, b.componentStyle = v, b.foldedComponentIds = r ? Array.prototype.concat(e.foldedComponentIds, e.styledComponentId) : x, b.styledComponentId = m, b.target = r ? e.target : e, b.withComponent = function (e) { + var r = t.componentId, o = function (e, t) { + var n = {}; + for (var r in e) + t.indexOf(r) >= 0 || Object.prototype.hasOwnProperty.call(e, r) && (n[r] = e[r]); + return n; + }(t, ['componentId']), i = r && r + '-' + (Le(e) ? e : Ie(k(e))); + return Je(e, y({}, o, { + attrs: g, + componentId: i, + ParentComponent: f + }), n); + }, Object.defineProperty(b, 'defaultProps', { + get: function () { + return this._foldedDefaultProps; + }, + set: function (t) { + this._foldedDefaultProps = r ? Object(d.a)(e.defaultProps, t) : t; + } + }), b.toString = function () { + return '.' + b.styledComponentId; + }, o && ze(b, e, { + attrs: !0, + componentStyle: !0, + displayName: !0, + foldedComponentIds: !0, + styledComponentId: !0, + target: !0, + withComponent: !0 + }), b; + } + var Xe = function (e) { + return function e(t, n) { + var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : S; + if (!Object(l.isValidElementType)(n)) + throw new L(1, String(n)); + var o = function () { + return t(n, r, be.apply(void 0, arguments)); + }; + return o.withConfig = function (o) { + return e(t, n, y({}, r, o)); + }, o.attrs = function (o) { + return e(t, n, y({}, r, { attrs: Array.prototype.concat(r.attrs, o).filter(Boolean) })); + }, o; + }(Je, e); + }; + [ + 'a', + 'abbr', + 'address', + 'area', + 'article', + 'aside', + 'audio', + 'b', + 'base', + 'bdi', + 'bdo', + 'big', + 'blockquote', + 'body', + 'br', + 'button', + 'canvas', + 'caption', + 'cite', + 'code', + 'col', + 'colgroup', + 'data', + 'datalist', + 'dd', + 'del', + 'details', + 'dfn', + 'dialog', + 'div', + 'dl', + 'dt', + 'em', + 'embed', + 'fieldset', + 'figcaption', + 'figure', + 'footer', + 'form', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'head', + 'header', + 'hgroup', + 'hr', + 'html', + 'i', + 'iframe', + 'img', + 'input', + 'ins', + 'kbd', + 'keygen', + 'label', + 'legend', + 'li', + 'link', + 'main', + 'map', + 'mark', + 'marquee', + 'menu', + 'menuitem', + 'meta', + 'meter', + 'nav', + 'noscript', + 'object', + 'ol', + 'optgroup', + 'option', + 'output', + 'p', + 'param', + 'picture', + 'pre', + 'progress', + 'q', + 'rp', + 'rt', + 'ruby', + 's', + 'samp', + 'script', + 'section', + 'select', + 'small', + 'source', + 'span', + 'strong', + 'style', + 'sub', + 'summary', + 'sup', + 'table', + 'tbody', + 'td', + 'textarea', + 'tfoot', + 'th', + 'thead', + 'time', + 'title', + 'tr', + 'track', + 'u', + 'ul', + 'var', + 'video', + 'wbr', + 'circle', + 'clipPath', + 'defs', + 'ellipse', + 'foreignObject', + 'g', + 'image', + 'line', + 'linearGradient', + 'marker', + 'mask', + 'path', + 'pattern', + 'polygon', + 'polyline', + 'radialGradient', + 'rect', + 'stop', + 'svg', + 'text', + 'tspan' + ].forEach(function (e) { + Xe[e] = Xe(e); + }); + var Ze = function () { + function e(t, n) { + g(this, e), this.rules = t, this.componentId = n, this.isStatic = Se(t, x), fe.master.hasId(n) || fe.master.deferredInject(n, []); + } + return e.prototype.createStyles = function (e, t) { + var n = H(ye(this.rules, e, t), ''); + t.inject(this.componentId, n); + }, e.prototype.removeStyles = function (e) { + var t = this.componentId; + e.hasId(t) && e.remove(t); + }, e.prototype.renderStyles = function (e, t) { + this.removeStyles(t), this.createStyles(e, t); + }, e; + }(); + function et(e) { + for (var t = arguments.length, n = Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) + n[r - 1] = arguments[r]; + var o = be.apply(void 0, [e].concat(n)), i = 'sc-global-' + Ee(JSON.stringify(o)), a = new Ze(o, i), s = function (e) { + function t(n) { + g(this, t); + var r = E(this, e.call(this, n)), o = r.constructor, i = o.globalStyle, a = o.styledComponentId; + return P && (window.scCGSHMRCache[a] = (window.scCGSHMRCache[a] || 0) + 1), r.state = { + globalStyle: i, + styledComponentId: a + }, r; + } + return b(t, e), t.prototype.componentWillUnmount = function () { + window.scCGSHMRCache[this.state.styledComponentId] && (window.scCGSHMRCache[this.state.styledComponentId] -= 1), 0 === window.scCGSHMRCache[this.state.styledComponentId] && this.state.globalStyle.removeStyles(this.styleSheet); + }, t.prototype.render = function () { + var e = this; + return c.a.createElement($e, null, function (t) { + e.styleSheet = t || fe.master; + var n = e.state.globalStyle; + return n.isStatic ? (n.renderStyles(I, e.styleSheet), null) : c.a.createElement(He, null, function (t) { + var r = e.constructor.defaultProps, o = y({}, e.props); + return 'undefined' !== typeof t && (o.theme = _e(e.props, t, r)), n.renderStyles(o, e.styleSheet), null; + }); + }); + }, t; + }(c.a.Component); + return s.globalStyle = a, s.styledComponentId = i, s; + } + P && (window.scCGSHMRCache = {}); + t.c = Xe; + }.call(this, n(119))); + }, + function (e, t, n) { + var r = n(13); + e.exports = function (e) { + if (!r(e)) + throw TypeError(String(e) + ' is not an object'); + return e; + }; + }, + function (e, t) { + e.exports = !1; + }, + function (e, t, n) { + var r = n(3), o = n(99), i = n(24), a = n(9), s = n(68), c = n(98), u = function (e, t) { + this.stopped = e, this.result = t; + }; + e.exports = function (e, t, n) { + var l, f, p, d, h, m, g, v = n && n.that, y = !(!n || !n.AS_ENTRIES), b = !(!n || !n.IS_ITERATOR), E = !(!n || !n.INTERRUPTED), w = a(t, v, 1 + y + E), x = function (e) { + return l && c(l), new u(!0, e); + }, S = function (e) { + return y ? (r(e), E ? w(e[0], e[1], x) : w(e[0], e[1])) : E ? w(e, x) : w(e); + }; + if (b) + l = e; + else { + if ('function' != typeof (f = s(e))) + throw TypeError('Target is not iterable'); + if (o(f)) { + for (p = 0, d = i(e.length); d > p; p++) + if ((h = S(e[p])) && h instanceof u) + return h; + return new u(!1); + } + l = f.call(e); + } + for (m = l.next; !(g = m.call(l)).done;) { + try { + h = S(g.value); + } catch (C) { + throw c(l), C; + } + if ('object' == typeof h && h && h instanceof u) + return h; + } + return new u(!1); + }; + }, + function (e, t) { + e.exports = function (e) { + if ('function' != typeof e) + throw TypeError(String(e) + ' is not a function'); + return e; + }; + }, + function (e, t, n) { + (function (t) { + var n = function (e) { + return e && e.Math == Math && e; + }; + e.exports = n('object' == typeof globalThis && globalThis) || n('object' == typeof window && window) || n('object' == typeof self && self) || n('object' == typeof t && t) || function () { + return this; + }() || Function('return this')(); + }.call(this, n(85))); + }, + function (e, t, n) { + var r = n(7), o = n(60), i = n(14), a = n(47), s = n(65), c = n(91), u = o('wks'), l = r.Symbol, f = c ? l : l && l.withoutSetter || a; + e.exports = function (e) { + return i(u, e) || (s && i(l, e) ? u[e] = l[e] : u[e] = f('Symbol.' + e)), u[e]; + }; + }, + function (e, t, n) { + var r = n(6); + e.exports = function (e, t, n) { + if (r(e), void 0 === t) + return e; + switch (n) { + case 0: + return function () { + return e.call(t); + }; + case 1: + return function (n) { + return e.call(t, n); + }; + case 2: + return function (n, r) { + return e.call(t, n, r); + }; + case 3: + return function (n, r, o) { + return e.call(t, n, r, o); + }; + } + return function () { + return e.apply(t, arguments); + }; + }; + }, + function (e, t, n) { + var r = n(88), o = n(7), i = function (e) { + return 'function' == typeof e ? e : void 0; + }; + e.exports = function (e, t) { + return arguments.length < 2 ? i(r[e]) || i(o[e]) : r[e] && r[e][t] || o[e] && o[e][t]; + }; + }, + function (e, t, n) { + var r = n(88), o = n(14), i = n(93), a = n(19).f; + e.exports = function (e) { + var t = r.Symbol || (r.Symbol = {}); + o(t, e) || a(t, e, { value: i.f(e) }); + }; + }, + function (e, t) { + e.exports = function (e) { + try { + return !!e(); + } catch (t) { + return !0; + } + }; + }, + function (e, t) { + e.exports = function (e) { + return 'object' === typeof e ? null !== e : 'function' === typeof e; + }; + }, + function (e, t) { + var n = {}.hasOwnProperty; + e.exports = function (e, t) { + return n.call(e, t); + }; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(284)), r(n(285)), r(n(286)), r(n(287)); + }, + function (e, t, n) { + 'use strict'; + var r = n(120), o = Object.prototype.toString; + function i(e) { + return '[object Array]' === o.call(e); + } + function a(e) { + return 'undefined' === typeof e; + } + function s(e) { + return null !== e && 'object' === typeof e; + } + function c(e) { + return '[object Function]' === o.call(e); + } + function u(e, t) { + if (null !== e && 'undefined' !== typeof e) + if ('object' !== typeof e && (e = [e]), i(e)) + for (var n = 0, r = e.length; n < r; n++) + t.call(null, e[n], n, e); + else + for (var o in e) + Object.prototype.hasOwnProperty.call(e, o) && t.call(null, e[o], o, e); + } + e.exports = { + isArray: i, + isArrayBuffer: function (e) { + return '[object ArrayBuffer]' === o.call(e); + }, + isBuffer: function (e) { + return null !== e && !a(e) && null !== e.constructor && !a(e.constructor) && 'function' === typeof e.constructor.isBuffer && e.constructor.isBuffer(e); + }, + isFormData: function (e) { + return 'undefined' !== typeof FormData && e instanceof FormData; + }, + isArrayBufferView: function (e) { + return 'undefined' !== typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && e.buffer instanceof ArrayBuffer; + }, + isString: function (e) { + return 'string' === typeof e; + }, + isNumber: function (e) { + return 'number' === typeof e; + }, + isObject: s, + isUndefined: a, + isDate: function (e) { + return '[object Date]' === o.call(e); + }, + isFile: function (e) { + return '[object File]' === o.call(e); + }, + isBlob: function (e) { + return '[object Blob]' === o.call(e); + }, + isFunction: c, + isStream: function (e) { + return s(e) && c(e.pipe); + }, + isURLSearchParams: function (e) { + return 'undefined' !== typeof URLSearchParams && e instanceof URLSearchParams; + }, + isStandardBrowserEnv: function () { + return ('undefined' === typeof navigator || 'ReactNative' !== navigator.product && 'NativeScript' !== navigator.product && 'NS' !== navigator.product) && ('undefined' !== typeof window && 'undefined' !== typeof document); + }, + forEach: u, + merge: function e() { + var t = {}; + function n(n, r) { + 'object' === typeof t[r] && 'object' === typeof n ? t[r] = e(t[r], n) : t[r] = n; + } + for (var r = 0, o = arguments.length; r < o; r++) + u(arguments[r], n); + return t; + }, + deepMerge: function e() { + var t = {}; + function n(n, r) { + 'object' === typeof t[r] && 'object' === typeof n ? t[r] = e(t[r], n) : t[r] = 'object' === typeof n ? e({}, n) : n; + } + for (var r = 0, o = arguments.length; r < o; r++) + u(arguments[r], n); + return t; + }, + extend: function (e, t, n) { + return u(t, function (t, o) { + e[o] = n && 'function' === typeof t ? r(t, n) : t; + }), e; + }, + trim: function (e) { + return e.replace(/^\s*/, '').replace(/\s*$/, ''); + } + }; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(133)), r(n(288)), r(n(134)), r(n(135)), r(n(289)), r(n(79)), r(n(136)), r(n(290)), r(n(291)); + }, + function (e, t, n) { + var r = n(12); + e.exports = !r(function () { + return 7 != Object.defineProperty({}, 1, { + get: function () { + return 7; + } + })[1]; + }); + }, + function (e, t, n) { + var r = n(18), o = n(86), i = n(3), a = n(45), s = Object.defineProperty; + t.f = r ? s : function (e, t, n) { + if (i(e), t = a(t, !0), i(n), o) + try { + return s(e, t, n); + } catch (r) { + } + if ('get' in n || 'set' in n) + throw TypeError('Accessors not supported'); + return 'value' in n && (e[t] = n.value), e; + }; + }, + function (e, t, n) { + var r = n(3), o = n(6), i = n(8)('species'); + e.exports = function (e, t) { + var n, a = r(e).constructor; + return void 0 === a || void 0 == (n = r(a)[i]) ? t : o(n); + }; + }, + function (e, t, n) { + var r = n(4), o = n(76); + e.exports = r ? o : function (e) { + return Map.prototype.entries.call(e); + }; + }, + function (e, t, n) { + var r = n(18), o = n(19), i = n(31); + e.exports = r ? function (e, t, n) { + return o.f(e, t, i(1, n)); + } : function (e, t, n) { + return e[t] = n, e; + }; + }, + function (e, t, n) { + var r = n(7), o = n(22), i = n(14), a = n(57), s = n(58), c = n(33), u = c.get, l = c.enforce, f = String(String).split('String'); + (e.exports = function (e, t, n, s) { + var c, u = !!s && !!s.unsafe, p = !!s && !!s.enumerable, d = !!s && !!s.noTargetGet; + 'function' == typeof n && ('string' != typeof t || i(n, 'name') || o(n, 'name', t), (c = l(n)).source || (c.source = f.join('string' == typeof t ? t : ''))), e !== r ? (u ? !d && e[t] && (p = !0) : delete e[t], p ? e[t] = n : o(e, t, n)) : p ? e[t] = n : a(t, n); + })(Function.prototype, 'toString', function () { + return 'function' == typeof this && u(this).source || s(this); + }); + }, + function (e, t, n) { + var r = n(39), o = Math.min; + e.exports = function (e) { + return e > 0 ? o(r(e), 9007199254740991) : 0; + }; + }, + function (e, t, n) { + var r = n(55), o = n(32); + e.exports = function (e) { + return r(o(e)); + }; + }, + function (e, t, n) { + var r = n(32); + e.exports = function (e) { + return Object(r(e)); + }; + }, + function (e, t, n) { + var r = n(19).f, o = n(14), i = n(8)('toStringTag'); + e.exports = function (e, t, n) { + e && !o(e = n ? e : e.prototype, i) && r(e, i, { + configurable: !0, + value: t + }); + }; + }, + function (e, t, n) { + var r = n(4), o = n(76); + e.exports = r ? o : function (e) { + return Set.prototype.values.call(e); + }; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__values || function (e) { + var t = 'function' == typeof Symbol && Symbol.iterator, n = t && e[t], r = 0; + if (n) + return n.call(e); + if (e && 'number' == typeof e.length) + return { + next: function () { + return e && r >= e.length && (e = void 0), { + value: e && e[r++], + done: !e + }; + } + }; + throw new TypeError(t ? 'Object is not iterable.' : 'Symbol.iterator is not defined.'); + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function () { + function e() { + } + return e.prototype.clone = function () { + var e = this, t = new this.constructor(); + return Object.keys(this).forEach(function (n) { + var r = e.deepClone(e[n]); + void 0 !== r && (t[n] = r); + }), t; + }, e.prototype.deepClone = function (e) { + var t, n, o = typeof e; + if ('number' === o || 'string' === o || 'boolean' === o) + return e; + if (null !== e && 'object' === o) { + if ('function' == typeof e.clone) + return e.clone(); + if (e instanceof Date) + return new Date(e.getTime()); + if (void 0 !== e[Symbol.iterator]) { + var i = []; + try { + for (var a = r(e), s = a.next(); !s.done; s = a.next()) { + var c = s.value; + i.push(this.deepClone(c)); + } + } catch (e) { + t = { error: e }; + } finally { + try { + s && !s.done && (n = a.return) && n.call(a); + } finally { + if (t) + throw t.error; + } + } + return e instanceof Array ? i : new e.constructor(i); + } + var u = {}; + for (var l in e) + e.hasOwnProperty(l) && (u[l] = this.deepClone(e[l])); + return u; + } + }, e; + }(); + t.Cloneable = o; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(15), o = function () { + function e() { + } + return e.encode = function (e, t) { + var n; + if ('string' == typeof e && (e = parseInt(e, 10)), (n = e.toString(2)).length > t || e < 0) + throw new r.EncodingError(e + ' too large to encode into ' + t); + return n.length < t && (n = '0'.repeat(t - n.length) + n), n; + }, e.decode = function (e, t) { + if (t !== e.length) + throw new r.DecodingError('invalid bit length'); + return parseInt(e, 2); + }, e; + }(); + t.IntEncoder = o; + }, + function (e, t) { + e.exports = function (e, t) { + return { + enumerable: !(1 & e), + configurable: !(2 & e), + writable: !(4 & e), + value: t + }; + }; + }, + function (e, t) { + e.exports = function (e) { + if (void 0 == e) + throw TypeError('Can\'t call method on ' + e); + return e; + }; + }, + function (e, t, n) { + var r, o, i, a = n(155), s = n(7), c = n(13), u = n(22), l = n(14), f = n(59), p = n(46), d = n(38), h = s.WeakMap; + if (a) { + var m = f.state || (f.state = new h()), g = m.get, v = m.has, y = m.set; + r = function (e, t) { + return t.facade = e, y.call(m, e, t), t; + }, o = function (e) { + return g.call(m, e) || {}; + }, i = function (e) { + return v.call(m, e); + }; + } else { + var b = p('state'); + d[b] = !0, r = function (e, t) { + return t.facade = e, u(e, b, t), t; + }, o = function (e) { + return l(e, b) ? e[b] : {}; + }, i = function (e) { + return l(e, b); + }; + } + e.exports = { + set: r, + get: o, + has: i, + enforce: function (e) { + return i(e) ? o(e) : r(e, {}); + }, + getterFor: function (e) { + return function (t) { + var n; + if (!c(t) || (n = o(t)).type !== e) + throw TypeError('Incompatible receiver, ' + e + ' required'); + return n; + }; + } + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = n(266); + }, + function (e, t, n) { + e.exports = n(259); + }, + function (e, t, n) { + var r = n(18), o = n(44), i = n(31), a = n(25), s = n(45), c = n(14), u = n(86), l = Object.getOwnPropertyDescriptor; + t.f = r ? l : function (e, t) { + if (e = a(e), t = s(t, !0), u) + try { + return l(e, t); + } catch (n) { + } + if (c(e, t)) + return i(!o.f.call(e, t), e[t]); + }; + }, + function (e, t) { + var n = {}.toString; + e.exports = function (e) { + return n.call(e).slice(8, -1); + }; + }, + function (e, t) { + e.exports = {}; + }, + function (e, t) { + var n = Math.ceil, r = Math.floor; + e.exports = function (e) { + return isNaN(e = +e) ? 0 : (e > 0 ? r : n)(e); + }; + }, + function (e, t, n) { + var r, o = n(3), i = n(158), a = n(62), s = n(38), c = n(92), u = n(56), l = n(46), f = l('IE_PROTO'), p = function () { + }, d = function (e) { + return ''; + }, h = function () { + try { + r = document.domain && new ActiveXObject('htmlfile'); + } catch (t) { + } + h = r ? function (e) { + e.write(d('')), e.close(); + var t = e.parentWindow.Object; + return e = null, t; + }(r) : function () { + var e, t = u('iframe'); + return t.style.display = 'none', c.appendChild(t), t.src = String('javascript:'), (e = t.contentWindow.document).open(), e.write(d('document.F=Object')), e.close(), e.F; + }(); + for (var e = a.length; e--;) + delete h.prototype[a[e]]; + return h(); + }; + s[f] = !0, e.exports = Object.create || function (e, t) { + var n; + return null !== e ? (p.prototype = o(e), n = new p(), p.prototype = null, n[f] = e) : n = h(), void 0 === t ? n : i(n, t); + }; + }, + function (e, t) { + e.exports = {}; + }, + function (e, t, n) { + 'use strict'; + var r = n(6), o = function (e) { + var t, n; + this.promise = new e(function (e, r) { + if (void 0 !== t || void 0 !== n) + throw TypeError('Bad Promise constructor'); + t = e, n = r; + }), this.resolve = r(t), this.reject = r(n); + }; + e.exports.f = function (e) { + return new o(e); + }; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.encode = function (e) { + return +e + ''; + }, e.decode = function (e) { + return '1' === e; + }, e; + }(); + t.BooleanEncoder = r; + }, + function (e, t, n) { + 'use strict'; + var r = {}.propertyIsEnumerable, o = Object.getOwnPropertyDescriptor, i = o && !r.call({ 1: 2 }, 1); + t.f = i ? function (e) { + var t = o(this, e); + return !!t && t.enumerable; + } : r; + }, + function (e, t, n) { + var r = n(13); + e.exports = function (e, t) { + if (!r(e)) + return e; + var n, o; + if (t && 'function' == typeof (n = e.toString) && !r(o = n.call(e))) + return o; + if ('function' == typeof (n = e.valueOf) && !r(o = n.call(e))) + return o; + if (!t && 'function' == typeof (n = e.toString) && !r(o = n.call(e))) + return o; + throw TypeError('Can\'t convert object to primitive value'); + }; + }, + function (e, t, n) { + var r = n(60), o = n(47), i = r('keys'); + e.exports = function (e) { + return i[e] || (i[e] = o(e)); + }; + }, + function (e, t) { + var n = 0, r = Math.random(); + e.exports = function (e) { + return 'Symbol(' + String(void 0 === e ? '' : e) + ')_' + (++n + r).toString(36); + }; + }, + function (e, t, n) { + var r = n(37); + e.exports = Array.isArray || function (e) { + return 'Array' == r(e); + }; + }, + function (e, t, n) { + var r = n(89), o = n(62); + e.exports = Object.keys || function (e) { + return r(e, o); + }; + }, + function (e, t, n) { + var r = n(8), o = n(40), i = n(19), a = r('unscopables'), s = Array.prototype; + void 0 == s[a] && i.f(s, a, { + configurable: !0, + value: o(null) + }), e.exports = function (e) { + s[a][e] = !0; + }; + }, + function (e, t) { + e.exports = function (e) { + try { + return { + error: !1, + value: e() + }; + } catch (t) { + return { + error: !0, + value: t + }; + } + }; + }, + function (e, t, n) { + 'use strict'; + !function e() { + if ('undefined' !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && 'function' === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE) { + 0; + try { + __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e); + } catch (t) { + console.error(t); + } + } + }(), e.exports = n(261); + }, + function (e, t, n) { + e.exports = n(268); + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(77)), r(n(15)), r(n(17)), r(n(29)), r(n(144)), r(n(145)), r(n(146)), r(n(297)); + }, + function (e, t, n) { + var r = n(12), o = n(37), i = ''.split; + e.exports = r(function () { + return !Object('z').propertyIsEnumerable(0); + }) ? function (e) { + return 'String' == o(e) ? i.call(e, '') : Object(e); + } : Object; + }, + function (e, t, n) { + var r = n(7), o = n(13), i = r.document, a = o(i) && o(i.createElement); + e.exports = function (e) { + return a ? i.createElement(e) : {}; + }; + }, + function (e, t, n) { + var r = n(7), o = n(22); + e.exports = function (e, t) { + try { + o(r, e, t); + } catch (n) { + r[e] = t; + } + return t; + }; + }, + function (e, t, n) { + var r = n(59), o = Function.toString; + 'function' != typeof r.inspectSource && (r.inspectSource = function (e) { + return o.call(e); + }), e.exports = r.inspectSource; + }, + function (e, t, n) { + var r = n(7), o = n(57), i = r['__core-js_shared__'] || o('__core-js_shared__', {}); + e.exports = i; + }, + function (e, t, n) { + var r = n(4), o = n(59); + (e.exports = function (e, t) { + return o[e] || (o[e] = void 0 !== t ? t : {}); + })('versions', []).push({ + version: '3.7.0', + mode: r ? 'pure' : 'global', + copyright: '\xA9 2020 Denis Pushkarev (zloirock.ru)' + }); + }, + function (e, t, n) { + var r = n(89), o = n(62).concat('length', 'prototype'); + t.f = Object.getOwnPropertyNames || function (e) { + return r(e, o); + }; + }, + function (e, t) { + e.exports = [ + 'constructor', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'toLocaleString', + 'toString', + 'valueOf' + ]; + }, + function (e, t) { + t.f = Object.getOwnPropertySymbols; + }, + function (e, t, n) { + var r = n(12), o = /#|\.prototype\./, i = function (e, t) { + var n = s[a(e)]; + return n == u || n != c && ('function' == typeof t ? r(t) : !!t); + }, a = i.normalize = function (e) { + return String(e).replace(o, '.').toLowerCase(); + }, s = i.data = {}, c = i.NATIVE = 'N', u = i.POLYFILL = 'P'; + e.exports = i; + }, + function (e, t, n) { + var r = n(12); + e.exports = !!Object.getOwnPropertySymbols && !r(function () { + return !String(Symbol()); + }); + }, + function (e, t, n) { + var r = n(13), o = n(48), i = n(8)('species'); + e.exports = function (e, t) { + var n; + return o(e) && ('function' != typeof (n = e.constructor) || n !== Array && !o(n.prototype) ? r(n) && null === (n = n[i]) && (n = void 0) : n = void 0), new (void 0 === n ? Array : n)(0 === t ? 0 : t); + }; + }, + function (e, t, n) { + var r, o, i = n(7), a = n(96), s = i.process, c = s && s.versions, u = c && c.v8; + u ? o = (r = u.split('.'))[0] + r[1] : a && (!(r = a.match(/Edge\/(\d+)/)) || r[1] >= 74) && (r = a.match(/Chrome\/(\d+)/)) && (o = r[1]), e.exports = o && +o; + }, + function (e, t, n) { + var r = n(100), o = n(41), i = n(8)('iterator'); + e.exports = function (e) { + if (void 0 != e) + return e[i] || e['@@iterator'] || o[r(e)]; + }; + }, + function (e, t, n) { + var r = {}; + r[n(8)('toStringTag')] = 'z', e.exports = '[object z]' === String(r); + }, + function (e, t, n) { + var r = n(8)('iterator'), o = !1; + try { + var i = 0, a = { + next: function () { + return { done: !!i++ }; + }, + return: function () { + o = !0; + } + }; + a[r] = function () { + return this; + }, Array.from(a, function () { + throw 2; + }); + } catch (s) { + } + e.exports = function (e, t) { + if (!t && !o) + return !1; + var n = !1; + try { + var i = {}; + i[r] = function () { + return { + next: function () { + return { done: n = !0 }; + } + }; + }, e(i); + } catch (s) { + } + return n; + }; + }, + function (e, t) { + e.exports = function (e, t, n) { + if (!(e instanceof t)) + throw TypeError('Incorrect ' + (n ? n + ' ' : '') + 'invocation'); + return e; + }; + }, + function (e, t, n) { + var r = n(3), o = n(187); + e.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { + var e, t = !1, n = {}; + try { + (e = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set).call(n, []), t = n instanceof Array; + } catch (i) { + } + return function (n, i) { + return r(n), o(i), t ? e.call(n, i) : n.__proto__ = i, n; + }; + }() : void 0); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(188), i = n(74), a = n(72), s = n(27), c = n(22), u = n(23), l = n(8), f = n(4), p = n(41), d = n(105), h = d.IteratorPrototype, m = d.BUGGY_SAFARI_ITERATORS, g = l('iterator'), v = function () { + return this; + }; + e.exports = function (e, t, n, l, d, y, b) { + o(n, t, l); + var E, w, x, S = function (e) { + if (e === d && P) + return P; + if (!m && e in T) + return T[e]; + switch (e) { + case 'keys': + case 'values': + case 'entries': + return function () { + return new n(this, e); + }; + } + return function () { + return new n(this); + }; + }, C = t + ' Iterator', k = !1, T = e.prototype, _ = T[g] || T['@@iterator'] || d && T[d], P = !m && _ || S(d), O = 'Array' == t && T.entries || _; + if (O && (E = i(O.call(new e())), h !== Object.prototype && E.next && (f || i(E) === h || (a ? a(E, h) : 'function' != typeof E[g] && c(E, g, v)), s(E, C, !0, !0), f && (p[C] = v))), 'values' == d && _ && 'values' !== _.name && (k = !0, P = function () { + return _.call(this); + }), f && !b || T[g] === P || c(T, g, P), p[t] = P, d) + if (w = { + values: S('values'), + keys: y ? P : S('keys'), + entries: S('entries') + }, b) + for (x in w) + (m || k || !(x in T)) && u(T, x, w[x]); + else + r({ + target: t, + proto: !0, + forced: m || k + }, w); + return w; + }; + }, + function (e, t, n) { + var r = n(14), o = n(26), i = n(46), a = n(189), s = i('IE_PROTO'), c = Object.prototype; + e.exports = a ? Object.getPrototypeOf : function (e) { + return e = o(e), r(e, s) ? e[s] : 'function' == typeof e.constructor && e instanceof e.constructor ? e.constructor.prototype : e instanceof Object ? c : null; + }; + }, + function (e, t, n) { + var r = n(37), o = n(7); + e.exports = 'process' == r(o.process); + }, + function (e, t, n) { + var r = n(3), o = n(68); + e.exports = function (e) { + var t = o(e); + if ('function' != typeof t) + throw TypeError(String(e) + ' is not iterable'); + return r(t.call(e)); + }; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(132)), r(n(78)), r(n(292)), r(n(296)), r(n(137)), r(n(143)); + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(17), o = function () { + function e() { + } + var t, n, o, i, a, s, c, u, l, f, p, d, h, m, g, v, y, b; + return t = r.Fields.cmpId, n = r.Fields.cmpVersion, o = r.Fields.consentLanguage, i = r.Fields.consentScreen, a = r.Fields.created, s = r.Fields.isServiceSpecific, c = r.Fields.lastUpdated, u = r.Fields.policyVersion, l = r.Fields.publisherCountryCode, f = r.Fields.publisherLegitimateInterests, p = r.Fields.publisherConsents, d = r.Fields.purposeConsents, h = r.Fields.purposeLegitimateInterests, m = r.Fields.purposeOneTreatment, g = r.Fields.specialFeatureOptins, v = r.Fields.useNonStandardStacks, y = r.Fields.vendorListVersion, b = r.Fields.version, e[t] = 12, e[n] = 12, e[o] = 12, e[i] = 6, e[a] = 36, e[s] = 1, e[c] = 36, e[u] = 6, e[l] = 12, e[f] = 24, e[p] = 24, e[d] = 24, e[h] = 24, e[m] = 1, e[g] = 12, e[v] = 1, e[y] = 12, e[b] = 6, e.anyBoolean = 1, e.encodingType = 1, e.maxId = 16, e.numCustomPurposes = 6, e.numEntries = 12, e.numRestrictions = 12, e.purposeId = 6, e.restrictionType = 2, e.segmentType = 3, e.singleOrRange = 1, e.vendorId = 16, e; + }(); + t.BitLength = o; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.RestrictionType || (t.RestrictionType = {}))[r.NOT_ALLOWED = 0] = 'NOT_ALLOWED', r[r.REQUIRE_CONSENT = 1] = 'REQUIRE_CONSENT', r[r.REQUIRE_LI = 2] = 'REQUIRE_LI'; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(43), o = n(15), i = n(17), a = function () { + function e() { + } + return e.encode = function (e, t) { + for (var n = '', o = 1; o <= t; o++) + n += r.BooleanEncoder.encode(e.has(o)); + return n; + }, e.decode = function (e, t) { + if (e.length !== t) + throw new o.DecodingError('bitfield encoding length mismatch'); + for (var n = new i.Vector(), a = 1; a <= t; a++) + r.BooleanEncoder.decode(e[a - 1]) && n.set(a); + return n.bitLength = e.length, n; + }, e; + }(); + t.FixedVectorEncoder = a; + }, + function (e, t, n) { + 'use strict'; + var r = n(34), o = { + childContextTypes: !0, + contextType: !0, + contextTypes: !0, + defaultProps: !0, + displayName: !0, + getDefaultProps: !0, + getDerivedStateFromError: !0, + getDerivedStateFromProps: !0, + mixins: !0, + propTypes: !0, + type: !0 + }, i = { + name: !0, + length: !0, + prototype: !0, + caller: !0, + callee: !0, + arguments: !0, + arity: !0 + }, a = { + $$typeof: !0, + compare: !0, + defaultProps: !0, + displayName: !0, + propTypes: !0, + type: !0 + }, s = {}; + function c(e) { + return r.isMemo(e) ? a : s[e.$$typeof] || o; + } + s[r.ForwardRef] = { + $$typeof: !0, + render: !0, + defaultProps: !0, + displayName: !0, + propTypes: !0 + }, s[r.Memo] = a; + var u = Object.defineProperty, l = Object.getOwnPropertyNames, f = Object.getOwnPropertySymbols, p = Object.getOwnPropertyDescriptor, d = Object.getPrototypeOf, h = Object.prototype; + e.exports = function e(t, n, r) { + if ('string' !== typeof n) { + if (h) { + var o = d(n); + o && o !== h && e(t, o, r); + } + var a = l(n); + f && (a = a.concat(f(n))); + for (var s = c(t), m = c(n), g = 0; g < a.length; ++g) { + var v = a[g]; + if (!i[v] && (!r || !r[v]) && (!m || !m[v]) && (!s || !s[v])) { + var y = p(n, v); + try { + u(t, v, y); + } catch (b) { + } + } + } + } + return t; + }; + }, + function (e, t, n) { + 'use strict'; + (function (e, r) { + var o, i = n(147); + o = 'undefined' !== typeof self ? self : 'undefined' !== typeof window ? window : 'undefined' !== typeof e ? e : r; + var a = Object(i.a)(o); + t.a = a; + }.call(this, n(85), n(267)(e))); + }, + function (e, t, n) { + e.exports = function e(t) { + 'use strict'; + var n = /^\0+/g, r = /[\0\r\f]/g, o = /: */g, i = /zoo|gra/, a = /([,: ])(transform)/g, s = /,+\s*(?![^(]*[)])/g, c = / +\s*(?![^(]*[)])/g, u = / *[\0] */g, l = /,\r+?/g, f = /([\t\r\n ])*\f?&/g, p = /:global\(((?:[^\(\)\[\]]*|\[.*\]|\([^\(\)]*\))*)\)/g, d = /\W+/g, h = /@(k\w+)\s*(\S*)\s*/, m = /::(place)/g, g = /:(read-only)/g, v = /\s+(?=[{\];=:>])/g, y = /([[}=:>])\s+/g, b = /(\{[^{]+?);(?=\})/g, E = /\s{2,}/g, w = /([^\(])(:+) */g, x = /[svh]\w+-[tblr]{2}/, S = /\(\s*(.*)\s*\)/g, C = /([\s\S]*?);/g, k = /-self|flex-/g, T = /[^]*?(:[rp][el]a[\w-]+)[^]*/, _ = /stretch|:\s*\w+\-(?:conte|avail)/, P = /([^-])(image-set\()/, O = '-webkit-', I = '-moz-', L = '-ms-', A = 59, R = 125, N = 123, j = 40, q = 41, F = 10, D = 13, M = 32, U = 45, V = 42, B = 44, z = 58, G = 47, H = 1, W = 1, $ = 0, Y = 1, Q = 1, K = 1, J = 0, X = 0, Z = 0, ee = [], te = [], ne = 0, re = null, oe = 0, ie = 1, ae = '', se = '', ce = ''; + function ue(e, t, o, i, a) { + for (var s, c, l = 0, f = 0, p = 0, d = 0, v = 0, y = 0, b = 0, E = 0, x = 0, C = 0, k = 0, T = 0, _ = 0, P = 0, I = 0, L = 0, J = 0, te = 0, re = 0, fe = o.length, ve = fe - 1, ye = '', be = '', Ee = '', we = '', xe = '', Se = ''; I < fe;) { + if (b = o.charCodeAt(I), I === ve && f + d + p + l !== 0 && (0 !== f && (b = f === G ? F : G), d = p = l = 0, fe++, ve++), f + d + p + l === 0) { + if (I === ve && (L > 0 && (be = be.replace(r, '')), be.trim().length > 0)) { + switch (b) { + case M: + case 9: + case A: + case D: + case F: + break; + default: + be += o.charAt(I); + } + b = A; + } + if (1 === J) + switch (b) { + case N: + case R: + case A: + case 34: + case 39: + case j: + case q: + case B: + J = 0; + case 9: + case D: + case F: + case M: + break; + default: + for (J = 0, re = I, v = b, I--, b = A; re < fe;) + switch (o.charCodeAt(re++)) { + case F: + case D: + case A: + ++I, b = v, re = fe; + break; + case z: + L > 0 && (++I, b = v); + case N: + re = fe; + } + } + switch (b) { + case N: + for (v = (be = be.trim()).charCodeAt(0), k = 1, re = ++I; I < fe;) { + switch (b = o.charCodeAt(I)) { + case N: + k++; + break; + case R: + k--; + break; + case G: + switch (y = o.charCodeAt(I + 1)) { + case V: + case G: + I = ge(y, I, ve, o); + } + break; + case 91: + b++; + case j: + b++; + case 34: + case 39: + for (; I++ < ve && o.charCodeAt(I) !== b;); + } + if (0 === k) + break; + I++; + } + switch (Ee = o.substring(re, I), 0 === v && (v = (be = be.replace(n, '').trim()).charCodeAt(0)), v) { + case 64: + switch (L > 0 && (be = be.replace(r, '')), y = be.charCodeAt(1)) { + case 100: + case 109: + case 115: + case U: + s = t; + break; + default: + s = ee; + } + if (re = (Ee = ue(t, s, Ee, y, a + 1)).length, Z > 0 && 0 === re && (re = be.length), ne > 0 && (c = me(3, Ee, s = le(ee, be, te), t, W, H, re, y, a, i), be = s.join(''), void 0 !== c && 0 === (re = (Ee = c.trim()).length) && (y = 0, Ee = '')), re > 0) + switch (y) { + case 115: + be = be.replace(S, he); + case 100: + case 109: + case U: + Ee = be + '{' + Ee + '}'; + break; + case 107: + Ee = (be = be.replace(h, '$1 $2' + (ie > 0 ? ae : ''))) + '{' + Ee + '}', Ee = 1 === Q || 2 === Q && de('@' + Ee, 3) ? '@' + O + Ee + '@' + Ee : '@' + Ee; + break; + default: + Ee = be + Ee, 112 === i && (we += Ee, Ee = ''); + } + else + Ee = ''; + break; + default: + Ee = ue(t, le(t, be, te), Ee, i, a + 1); + } + xe += Ee, T = 0, J = 0, P = 0, L = 0, te = 0, _ = 0, be = '', Ee = '', b = o.charCodeAt(++I); + break; + case R: + case A: + if ((re = (be = (L > 0 ? be.replace(r, '') : be).trim()).length) > 1) + switch (0 === P && ((v = be.charCodeAt(0)) === U || v > 96 && v < 123) && (re = (be = be.replace(' ', ':')).length), ne > 0 && void 0 !== (c = me(1, be, t, e, W, H, we.length, i, a, i)) && 0 === (re = (be = c.trim()).length) && (be = '\0\0'), v = be.charCodeAt(0), y = be.charCodeAt(1), v) { + case 0: + break; + case 64: + if (105 === y || 99 === y) { + Se += be + o.charAt(I); + break; + } + default: + if (be.charCodeAt(re - 1) === z) + break; + we += pe(be, v, y, be.charCodeAt(2)); + } + T = 0, J = 0, P = 0, L = 0, te = 0, be = '', b = o.charCodeAt(++I); + } + } + switch (b) { + case D: + case F: + if (f + d + p + l + X === 0) + switch (C) { + case q: + case 39: + case 34: + case 64: + case 126: + case 62: + case V: + case 43: + case G: + case U: + case z: + case B: + case A: + case N: + case R: + break; + default: + P > 0 && (J = 1); + } + f === G ? f = 0 : Y + T === 0 && 107 !== i && be.length > 0 && (L = 1, be += '\0'), ne * oe > 0 && me(0, be, t, e, W, H, we.length, i, a, i), H = 1, W++; + break; + case A: + case R: + if (f + d + p + l === 0) { + H++; + break; + } + default: + switch (H++, ye = o.charAt(I), b) { + case 9: + case M: + if (d + l + f === 0) + switch (E) { + case B: + case z: + case 9: + case M: + ye = ''; + break; + default: + b !== M && (ye = ' '); + } + break; + case 0: + ye = '\\0'; + break; + case 12: + ye = '\\f'; + break; + case 11: + ye = '\\v'; + break; + case 38: + d + f + l === 0 && Y > 0 && (te = 1, L = 1, ye = '\f' + ye); + break; + case 108: + if (d + f + l + $ === 0 && P > 0) + switch (I - P) { + case 2: + 112 === E && o.charCodeAt(I - 3) === z && ($ = E); + case 8: + 111 === x && ($ = x); + } + break; + case z: + d + f + l === 0 && (P = I); + break; + case B: + f + p + d + l === 0 && (L = 1, ye += '\r'); + break; + case 34: + case 39: + 0 === f && (d = d === b ? 0 : 0 === d ? b : d); + break; + case 91: + d + f + p === 0 && l++; + break; + case 93: + d + f + p === 0 && l--; + break; + case q: + d + f + l === 0 && p--; + break; + case j: + if (d + f + l === 0) { + if (0 === T) + switch (2 * E + 3 * x) { + case 533: + break; + default: + k = 0, T = 1; + } + p++; + } + break; + case 64: + f + p + d + l + P + _ === 0 && (_ = 1); + break; + case V: + case G: + if (d + l + p > 0) + break; + switch (f) { + case 0: + switch (2 * b + 3 * o.charCodeAt(I + 1)) { + case 235: + f = G; + break; + case 220: + re = I, f = V; + } + break; + case V: + b === G && E === V && re + 2 !== I && (33 === o.charCodeAt(re + 2) && (we += o.substring(re, I + 1)), ye = '', f = 0); + } + } + if (0 === f) { + if (Y + d + l + _ === 0 && 107 !== i && b !== A) + switch (b) { + case B: + case 126: + case 62: + case 43: + case q: + case j: + if (0 === T) { + switch (E) { + case 9: + case M: + case F: + case D: + ye += '\0'; + break; + default: + ye = '\0' + ye + (b === B ? '' : '\0'); + } + L = 1; + } else + switch (b) { + case j: + P + 7 === I && 108 === E && (P = 0), T = ++k; + break; + case q: + 0 == (T = --k) && (L = 1, ye += '\0'); + } + break; + case 9: + case M: + switch (E) { + case 0: + case N: + case R: + case A: + case B: + case 12: + case 9: + case M: + case F: + case D: + break; + default: + 0 === T && (L = 1, ye += '\0'); + } + } + be += ye, b !== M && 9 !== b && (C = b); + } + } + x = E, E = b, I++; + } + if (re = we.length, Z > 0 && 0 === re && 0 === xe.length && 0 === t[0].length == 0 && (109 !== i || 1 === t.length && (Y > 0 ? se : ce) === t[0]) && (re = t.join(',').length + 2), re > 0) { + if (s = 0 === Y && 107 !== i ? function (e) { + for (var t, n, o = 0, i = e.length, a = Array(i); o < i; ++o) { + for (var s = e[o].split(u), c = '', l = 0, f = 0, p = 0, d = 0, h = s.length; l < h; ++l) + if (!(0 === (f = (n = s[l]).length) && h > 1)) { + if (p = c.charCodeAt(c.length - 1), d = n.charCodeAt(0), t = '', 0 !== l) + switch (p) { + case V: + case 126: + case 62: + case 43: + case M: + case j: + break; + default: + t = ' '; + } + switch (d) { + case 38: + n = t + se; + case 126: + case 62: + case 43: + case M: + case q: + case j: + break; + case 91: + n = t + n + se; + break; + case z: + switch (2 * n.charCodeAt(1) + 3 * n.charCodeAt(2)) { + case 530: + if (K > 0) { + n = t + n.substring(8, f - 1); + break; + } + default: + (l < 1 || s[l - 1].length < 1) && (n = t + se + n); + } + break; + case B: + t = ''; + default: + n = f > 1 && n.indexOf(':') > 0 ? t + n.replace(w, '$1' + se + '$2') : t + n + se; + } + c += n; + } + a[o] = c.replace(r, '').trim(); + } + return a; + }(t) : t, ne > 0 && void 0 !== (c = me(2, we, s, e, W, H, re, i, a, i)) && 0 === (we = c).length) + return Se + we + xe; + if (we = s.join(',') + '{' + we + '}', Q * $ != 0) { + switch (2 !== Q || de(we, 2) || ($ = 0), $) { + case 111: + we = we.replace(g, ':-moz-$1') + we; + break; + case 112: + we = we.replace(m, '::' + O + 'input-$1') + we.replace(m, '::-moz-$1') + we.replace(m, ':-ms-input-$1') + we; + } + $ = 0; + } + } + return Se + we + xe; + } + function le(e, t, n) { + var r = t.trim().split(l), o = r, i = r.length, a = e.length; + switch (a) { + case 0: + case 1: + for (var s = 0, c = 0 === a ? '' : e[0] + ' '; s < i; ++s) + o[s] = fe(c, o[s], n, a).trim(); + break; + default: + s = 0; + var u = 0; + for (o = []; s < i; ++s) + for (var f = 0; f < a; ++f) + o[u++] = fe(e[f] + ' ', r[s], n, a).trim(); + } + return o; + } + function fe(e, t, n, r) { + var o = t, i = o.charCodeAt(0); + switch (i < 33 && (i = (o = o.trim()).charCodeAt(0)), i) { + case 38: + switch (Y + r) { + case 0: + case 1: + if (0 === e.trim().length) + break; + default: + return o.replace(f, '$1' + e.trim()); + } + break; + case z: + switch (o.charCodeAt(1)) { + case 103: + if (K > 0 && Y > 0) + return o.replace(p, '$1').replace(f, '$1' + ce); + break; + default: + return e.trim() + o.replace(f, '$1' + e.trim()); + } + default: + if (n * Y > 0 && o.indexOf('\f') > 0) + return o.replace(f, (e.charCodeAt(0) === z ? '' : '$1') + e.trim()); + } + return e + o; + } + function pe(e, t, n, r) { + var u, l = 0, f = e + ';', p = 2 * t + 3 * n + 4 * r; + if (944 === p) + return function (e) { + var t = e.length, n = e.indexOf(':', 9) + 1, r = e.substring(0, n).trim(), o = e.substring(n, t - 1).trim(); + switch (e.charCodeAt(9) * ie) { + case 0: + break; + case U: + if (110 !== e.charCodeAt(10)) + break; + default: + var i = o.split((o = '', s)), a = 0; + for (n = 0, t = i.length; a < t; n = 0, ++a) { + for (var u = i[a], l = u.split(c); u = l[n];) { + var f = u.charCodeAt(0); + if (1 === ie && (f > 64 && f < 90 || f > 96 && f < 123 || 95 === f || f === U && u.charCodeAt(1) !== U)) + switch (isNaN(parseFloat(u)) + (-1 !== u.indexOf('('))) { + case 1: + switch (u) { + case 'infinite': + case 'alternate': + case 'backwards': + case 'running': + case 'normal': + case 'forwards': + case 'both': + case 'none': + case 'linear': + case 'ease': + case 'ease-in': + case 'ease-out': + case 'ease-in-out': + case 'paused': + case 'reverse': + case 'alternate-reverse': + case 'inherit': + case 'initial': + case 'unset': + case 'step-start': + case 'step-end': + break; + default: + u += ae; + } + } + l[n++] = u; + } + o += (0 === a ? '' : ',') + l.join(' '); + } + } + return o = r + o + ';', 1 === Q || 2 === Q && de(o, 1) ? O + o + o : o; + }(f); + if (0 === Q || 2 === Q && !de(f, 1)) + return f; + switch (p) { + case 1015: + return 97 === f.charCodeAt(10) ? O + f + f : f; + case 951: + return 116 === f.charCodeAt(3) ? O + f + f : f; + case 963: + return 110 === f.charCodeAt(5) ? O + f + f : f; + case 1009: + if (100 !== f.charCodeAt(4)) + break; + case 969: + case 942: + return O + f + f; + case 978: + return O + f + I + f + f; + case 1019: + case 983: + return O + f + I + f + L + f + f; + case 883: + return f.charCodeAt(8) === U ? O + f + f : f.indexOf('image-set(', 11) > 0 ? f.replace(P, '$1' + O + '$2') + f : f; + case 932: + if (f.charCodeAt(4) === U) + switch (f.charCodeAt(5)) { + case 103: + return O + 'box-' + f.replace('-grow', '') + O + f + L + f.replace('grow', 'positive') + f; + case 115: + return O + f + L + f.replace('shrink', 'negative') + f; + case 98: + return O + f + L + f.replace('basis', 'preferred-size') + f; + } + return O + f + L + f + f; + case 964: + return O + f + L + 'flex-' + f + f; + case 1023: + if (99 !== f.charCodeAt(8)) + break; + return u = f.substring(f.indexOf(':', 15)).replace('flex-', '').replace('space-between', 'justify'), O + 'box-pack' + u + O + f + L + 'flex-pack' + u + f; + case 1005: + return i.test(f) ? f.replace(o, ':' + O) + f.replace(o, ':' + I) + f : f; + case 1000: + switch (l = (u = f.substring(13).trim()).indexOf('-') + 1, u.charCodeAt(0) + u.charCodeAt(l)) { + case 226: + u = f.replace(x, 'tb'); + break; + case 232: + u = f.replace(x, 'tb-rl'); + break; + case 220: + u = f.replace(x, 'lr'); + break; + default: + return f; + } + return O + f + L + u + f; + case 1017: + if (-1 === f.indexOf('sticky', 9)) + return f; + case 975: + switch (l = (f = e).length - 10, p = (u = (33 === f.charCodeAt(l) ? f.substring(0, l) : f).substring(e.indexOf(':', 7) + 1).trim()).charCodeAt(0) + (0 | u.charCodeAt(7))) { + case 203: + if (u.charCodeAt(8) < 111) + break; + case 115: + f = f.replace(u, O + u) + ';' + f; + break; + case 207: + case 102: + f = f.replace(u, O + (p > 102 ? 'inline-' : '') + 'box') + ';' + f.replace(u, O + u) + ';' + f.replace(u, L + u + 'box') + ';' + f; + } + return f + ';'; + case 938: + if (f.charCodeAt(5) === U) + switch (f.charCodeAt(6)) { + case 105: + return u = f.replace('-items', ''), O + f + O + 'box-' + u + L + 'flex-' + u + f; + case 115: + return O + f + L + 'flex-item-' + f.replace(k, '') + f; + default: + return O + f + L + 'flex-line-pack' + f.replace('align-content', '').replace(k, '') + f; + } + break; + case 973: + case 989: + if (f.charCodeAt(3) !== U || 122 === f.charCodeAt(4)) + break; + case 931: + case 953: + if (!0 === _.test(e)) + return 115 === (u = e.substring(e.indexOf(':') + 1)).charCodeAt(0) ? pe(e.replace('stretch', 'fill-available'), t, n, r).replace(':fill-available', ':stretch') : f.replace(u, O + u) + f.replace(u, I + u.replace('fill-', '')) + f; + break; + case 962: + if (f = O + f + (102 === f.charCodeAt(5) ? L + f : '') + f, n + r === 211 && 105 === f.charCodeAt(13) && f.indexOf('transform', 10) > 0) + return f.substring(0, f.indexOf(';', 27) + 1).replace(a, '$1' + O + '$2') + f; + } + return f; + } + function de(e, t) { + var n = e.indexOf(1 === t ? ':' : '{'), r = e.substring(0, 3 !== t ? n : 10), o = e.substring(n + 1, e.length - 1); + return re(2 !== t ? r : r.replace(T, '$1'), o, t); + } + function he(e, t) { + var n = pe(t, t.charCodeAt(0), t.charCodeAt(1), t.charCodeAt(2)); + return n !== t + ';' ? n.replace(C, ' or ($1)').substring(4) : '(' + t + ')'; + } + function me(e, t, n, r, o, i, a, s, c, u) { + for (var l, f = 0, p = t; f < ne; ++f) + switch (l = te[f].call(ye, e, p, n, r, o, i, a, s, c, u)) { + case void 0: + case !1: + case !0: + case null: + break; + default: + p = l; + } + if (p !== t) + return p; + } + function ge(e, t, n, r) { + for (var o = t + 1; o < n; ++o) + switch (r.charCodeAt(o)) { + case G: + if (e === V && r.charCodeAt(o - 1) === V && t + 2 !== o) + return o + 1; + break; + case F: + if (e === G) + return o + 1; + } + return o; + } + function ve(e) { + for (var t in e) { + var n = e[t]; + switch (t) { + case 'keyframe': + ie = 0 | n; + break; + case 'global': + K = 0 | n; + break; + case 'cascade': + Y = 0 | n; + break; + case 'compress': + J = 0 | n; + break; + case 'semicolon': + X = 0 | n; + break; + case 'preserve': + Z = 0 | n; + break; + case 'prefix': + re = null, n ? 'function' != typeof n ? Q = 1 : (Q = 2, re = n) : Q = 0; + } + } + return ve; + } + function ye(t, n) { + if (void 0 !== this && this.constructor === ye) + return e(t); + var o = t, i = o.charCodeAt(0); + i < 33 && (i = (o = o.trim()).charCodeAt(0)), ie > 0 && (ae = o.replace(d, 91 === i ? '' : '-')), i = 1, 1 === Y ? ce = o : se = o; + var a, s = [ce]; + ne > 0 && void 0 !== (a = me(-1, n, s, s, W, H, 0, 0, 0, 0)) && 'string' == typeof a && (n = a); + var c = ue(ee, s, n, 0, 0); + return ne > 0 && void 0 !== (a = me(-2, c, s, s, W, H, c.length, 0, 0, 0)) && 'string' != typeof (c = a) && (i = 0), ae = '', ce = '', se = '', $ = 0, W = 1, H = 1, J * i == 0 ? c : c.replace(r, '').replace(v, '').replace(y, '$1').replace(b, '$1').replace(E, ' '); + } + return ye.use = function e(t) { + switch (t) { + case void 0: + case null: + ne = te.length = 0; + break; + default: + if ('function' == typeof t) + te[ne++] = t; + else if ('object' == typeof t) + for (var n = 0, r = t.length; n < r; ++n) + e(t[n]); + else + oe = 0 | !!t; + } + return e; + }, ye.set = ve, void 0 !== t && ve(t), ye; + }(null); + }, + function (e, t, n) { + 'use strict'; + function r(e, t) { + if (e.length !== t.length) + return !1; + for (var n = 0; n < e.length; n++) + if (e[n] !== t[n]) + return !1; + return !0; + } + t.a = function (e, t) { + var n; + void 0 === t && (t = r); + var o, i = [], a = !1; + return function () { + for (var r = [], s = 0; s < arguments.length; s++) + r[s] = arguments[s]; + return a && n === this && t(r, i) || (o = e.apply(this, r), a = !0, n = this, i = r), o; + }; + }; + }, + function (e, t) { + var n; + n = function () { + return this; + }(); + try { + n = n || new Function('return this')(); + } catch (r) { + 'object' === typeof window && (n = window); + } + e.exports = n; + }, + function (e, t, n) { + var r = n(18), o = n(12), i = n(56); + e.exports = !r && !o(function () { + return 7 != Object.defineProperty(i('div'), 'a', { + get: function () { + return 7; + } + }).a; + }); + }, + function (e, t, n) { + var r = n(14), o = n(156), i = n(36), a = n(19); + e.exports = function (e, t) { + for (var n = o(t), s = a.f, c = i.f, u = 0; u < n.length; u++) { + var l = n[u]; + r(e, l) || s(e, l, c(t, l)); + } + }; + }, + function (e, t, n) { + var r = n(7); + e.exports = r; + }, + function (e, t, n) { + var r = n(14), o = n(25), i = n(90).indexOf, a = n(38); + e.exports = function (e, t) { + var n, s = o(e), c = 0, u = []; + for (n in s) + !r(a, n) && r(s, n) && u.push(n); + for (; t.length > c;) + r(s, n = t[c++]) && (~i(u, n) || u.push(n)); + return u; + }; + }, + function (e, t, n) { + var r = n(25), o = n(24), i = n(157), a = function (e) { + return function (t, n, a) { + var s, c = r(t), u = o(c.length), l = i(a, u); + if (e && n != n) { + for (; u > l;) + if ((s = c[l++]) != s) + return !0; + } else + for (; u > l; l++) + if ((e || l in c) && c[l] === n) + return e || l || 0; + return !e && -1; + }; + }; + e.exports = { + includes: a(!0), + indexOf: a(!1) + }; + }, + function (e, t, n) { + var r = n(65); + e.exports = r && !Symbol.sham && 'symbol' == typeof Symbol.iterator; + }, + function (e, t, n) { + var r = n(10); + e.exports = r('document', 'documentElement'); + }, + function (e, t, n) { + var r = n(8); + t.f = r; + }, + function (e, t, n) { + var r = n(9), o = n(55), i = n(26), a = n(24), s = n(66), c = [].push, u = function (e) { + var t = 1 == e, n = 2 == e, u = 3 == e, l = 4 == e, f = 6 == e, p = 5 == e || f; + return function (d, h, m, g) { + for (var v, y, b = i(d), E = o(b), w = r(h, m, 3), x = a(E.length), S = 0, C = g || s, k = t ? C(d, x) : n ? C(d, 0) : void 0; x > S; S++) + if ((p || S in E) && (y = w(v = E[S], S, b), e)) + if (t) + k[S] = y; + else if (y) + switch (e) { + case 3: + return !0; + case 5: + return v; + case 6: + return S; + case 2: + c.call(k, v); + } + else if (l) + return !1; + return f ? -1 : u || l ? l : k; + }; + }; + e.exports = { + forEach: u(0), + map: u(1), + filter: u(2), + some: u(3), + every: u(4), + find: u(5), + findIndex: u(6) + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(45), o = n(19), i = n(31); + e.exports = function (e, t, n) { + var a = r(t); + a in e ? o.f(e, a, i(0, n)) : e[a] = n; + }; + }, + function (e, t, n) { + var r = n(10); + e.exports = r('navigator', 'userAgent') || ''; + }, + function (e, t, n) { + var r = n(18), o = n(12), i = n(14), a = Object.defineProperty, s = {}, c = function (e) { + throw e; + }; + e.exports = function (e, t) { + if (i(s, e)) + return s[e]; + t || (t = {}); + var n = [][e], u = !!i(t, 'ACCESSORS') && t.ACCESSORS, l = i(t, 0) ? t[0] : c, f = i(t, 1) ? t[1] : void 0; + return s[e] = !!n && !o(function () { + if (u && !r) + return !0; + var e = { length: -1 }; + u ? a(e, 1, { + enumerable: !0, + get: c + }) : e[1] = 1, n.call(e, l, f); + }); + }; + }, + function (e, t, n) { + var r = n(3); + e.exports = function (e) { + var t = e.return; + if (void 0 !== t) + return r(t.call(e)).value; + }; + }, + function (e, t, n) { + var r = n(8), o = n(41), i = r('iterator'), a = Array.prototype; + e.exports = function (e) { + return void 0 !== e && (o.Array === e || a[i] === e); + }; + }, + function (e, t, n) { + var r = n(69), o = n(37), i = n(8)('toStringTag'), a = 'Arguments' == o(function () { + return arguments; + }()); + e.exports = r ? o : function (e) { + var t, n, r; + return void 0 === e ? 'Undefined' : null === e ? 'Null' : 'string' == typeof (n = function (e, t) { + try { + return e[t]; + } catch (n) { + } + }(t = Object(e), i)) ? n : a ? o(t) : 'Object' == (r = o(t)) && 'function' == typeof t.callee ? 'Arguments' : r; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(7), i = n(64), a = n(23), s = n(102), c = n(5), u = n(71), l = n(13), f = n(12), p = n(70), d = n(27), h = n(186); + e.exports = function (e, t, n) { + var m = -1 !== e.indexOf('Map'), g = -1 !== e.indexOf('Weak'), v = m ? 'set' : 'add', y = o[e], b = y && y.prototype, E = y, w = {}, x = function (e) { + var t = b[e]; + a(b, e, 'add' == e ? function (e) { + return t.call(this, 0 === e ? 0 : e), this; + } : 'delete' == e ? function (e) { + return !(g && !l(e)) && t.call(this, 0 === e ? 0 : e); + } : 'get' == e ? function (e) { + return g && !l(e) ? void 0 : t.call(this, 0 === e ? 0 : e); + } : 'has' == e ? function (e) { + return !(g && !l(e)) && t.call(this, 0 === e ? 0 : e); + } : function (e, n) { + return t.call(this, 0 === e ? 0 : e, n), this; + }); + }; + if (i(e, 'function' != typeof y || !(g || b.forEach && !f(function () { + new y().entries().next(); + })))) + E = n.getConstructor(t, e, m, v), s.REQUIRED = !0; + else if (i(e, !0)) { + var S = new E(), C = S[v](g ? {} : -0, 1) != S, k = f(function () { + S.has(1); + }), T = p(function (e) { + new y(e); + }), _ = !g && f(function () { + for (var e = new y(), t = 5; t--;) + e[v](t, t); + return !e.has(-0); + }); + T || ((E = t(function (t, n) { + u(t, E, e); + var r = h(new y(), t, E); + return void 0 != n && c(n, r[v], { + that: r, + AS_ENTRIES: m + }), r; + })).prototype = b, b.constructor = E), (k || _) && (x('delete'), x('has'), m && x('get')), (_ || C) && x(v), g && b.clear && delete b.clear; + } + return w[e] = E, r({ + global: !0, + forced: E != y + }, w), d(E, e), g || n.setStrong(E, e, m), E; + }; + }, + function (e, t, n) { + var r = n(38), o = n(13), i = n(14), a = n(19).f, s = n(47), c = n(185), u = s('meta'), l = 0, f = Object.isExtensible || function () { + return !0; + }, p = function (e) { + a(e, u, { + value: { + objectID: 'O' + ++l, + weakData: {} + } + }); + }, d = e.exports = { + REQUIRED: !1, + fastKey: function (e, t) { + if (!o(e)) + return 'symbol' == typeof e ? e : ('string' == typeof e ? 'S' : 'P') + e; + if (!i(e, u)) { + if (!f(e)) + return 'F'; + if (!t) + return 'E'; + p(e); + } + return e[u].objectID; + }, + getWeakData: function (e, t) { + if (!i(e, u)) { + if (!f(e)) + return !0; + if (!t) + return !1; + p(e); + } + return e[u].weakData; + }, + onFreeze: function (e) { + return c && d.REQUIRED && f(e) && !i(e, u) && p(e), e; + } + }; + r[u] = !0; + }, + function (e, t, n) { + 'use strict'; + var r = n(19).f, o = n(40), i = n(104), a = n(9), s = n(71), c = n(5), u = n(73), l = n(106), f = n(18), p = n(102).fastKey, d = n(33), h = d.set, m = d.getterFor; + e.exports = { + getConstructor: function (e, t, n, u) { + var l = e(function (e, r) { + s(e, l, t), h(e, { + type: t, + index: o(null), + first: void 0, + last: void 0, + size: 0 + }), f || (e.size = 0), void 0 != r && c(r, e[u], { + that: e, + AS_ENTRIES: n + }); + }), d = m(t), g = function (e, t, n) { + var r, o, i = d(e), a = v(e, t); + return a ? a.value = n : (i.last = a = { + index: o = p(t, !0), + key: t, + value: n, + previous: r = i.last, + next: void 0, + removed: !1 + }, i.first || (i.first = a), r && (r.next = a), f ? i.size++ : e.size++, 'F' !== o && (i.index[o] = a)), e; + }, v = function (e, t) { + var n, r = d(e), o = p(t); + if ('F' !== o) + return r.index[o]; + for (n = r.first; n; n = n.next) + if (n.key == t) + return n; + }; + return i(l.prototype, { + clear: function () { + for (var e = d(this), t = e.index, n = e.first; n;) + n.removed = !0, n.previous && (n.previous = n.previous.next = void 0), delete t[n.index], n = n.next; + e.first = e.last = void 0, f ? e.size = 0 : this.size = 0; + }, + delete: function (e) { + var t = d(this), n = v(this, e); + if (n) { + var r = n.next, o = n.previous; + delete t.index[n.index], n.removed = !0, o && (o.next = r), r && (r.previous = o), t.first == n && (t.first = r), t.last == n && (t.last = o), f ? t.size-- : this.size--; + } + return !!n; + }, + forEach: function (e) { + for (var t, n = d(this), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); t = t ? t.next : n.first;) + for (r(t.value, t.key, this); t && t.removed;) + t = t.previous; + }, + has: function (e) { + return !!v(this, e); + } + }), i(l.prototype, n ? { + get: function (e) { + var t = v(this, e); + return t && t.value; + }, + set: function (e, t) { + return g(this, 0 === e ? 0 : e, t); + } + } : { + add: function (e) { + return g(this, e = 0 === e ? 0 : e, e); + } + }), f && r(l.prototype, 'size', { + get: function () { + return d(this).size; + } + }), l; + }, + setStrong: function (e, t, n) { + var r = t + ' Iterator', o = m(t), i = m(r); + u(e, t, function (e, t) { + h(this, { + type: r, + target: e, + state: o(e), + kind: t, + last: void 0 + }); + }, function () { + for (var e = i(this), t = e.kind, n = e.last; n && n.removed;) + n = n.previous; + return e.target && (e.last = n = n ? n.next : e.state.first) ? 'keys' == t ? { + value: n.key, + done: !1 + } : 'values' == t ? { + value: n.value, + done: !1 + } : { + value: [ + n.key, + n.value + ], + done: !1 + } : (e.target = void 0, { + value: void 0, + done: !0 + }); + }, n ? 'entries' : 'values', !n, !0), l(t); + } + }; + }, + function (e, t, n) { + var r = n(23); + e.exports = function (e, t, n) { + for (var o in t) + r(e, o, t[o], n); + return e; + }; + }, + function (e, t, n) { + 'use strict'; + var r, o, i, a = n(74), s = n(22), c = n(14), u = n(8), l = n(4), f = u('iterator'), p = !1; + [].keys && ('next' in (i = [].keys()) ? (o = a(a(i))) !== Object.prototype && (r = o) : p = !0), void 0 == r && (r = {}), l || c(r, f) || s(r, f, function () { + return this; + }), e.exports = { + IteratorPrototype: r, + BUGGY_SAFARI_ITERATORS: p + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(10), o = n(19), i = n(8), a = n(18), s = i('species'); + e.exports = function (e) { + var t = r(e), n = o.f; + a && t && !t[s] && n(t, s, { + configurable: !0, + get: function () { + return this; + } + }); + }; + }, + function (e, t, n) { + var r = n(18), o = n(49), i = n(25), a = n(44).f, s = function (e) { + return function (t) { + for (var n, s = i(t), c = o(s), u = c.length, l = 0, f = []; u > l;) + n = c[l++], r && !a.call(s, n) || f.push(e ? [ + n, + s[n] + ] : s[n]); + return f; + }; + }; + e.exports = { + entries: s(!0), + values: s(!1) + }; + }, + function (e, t, n) { + var r = n(7); + e.exports = r.Promise; + }, + function (e, t, n) { + var r, o, i, a = n(7), s = n(12), c = n(9), u = n(92), l = n(56), f = n(110), p = n(75), d = a.location, h = a.setImmediate, m = a.clearImmediate, g = a.process, v = a.MessageChannel, y = a.Dispatch, b = 0, E = {}, w = function (e) { + if (E.hasOwnProperty(e)) { + var t = E[e]; + delete E[e], t(); + } + }, x = function (e) { + return function () { + w(e); + }; + }, S = function (e) { + w(e.data); + }, C = function (e) { + a.postMessage(e + '', d.protocol + '//' + d.host); + }; + h && m || (h = function (e) { + for (var t = [], n = 1; arguments.length > n;) + t.push(arguments[n++]); + return E[++b] = function () { + ('function' == typeof e ? e : Function(e)).apply(void 0, t); + }, r(b), b; + }, m = function (e) { + delete E[e]; + }, p ? r = function (e) { + g.nextTick(x(e)); + } : y && y.now ? r = function (e) { + y.now(x(e)); + } : v && !f ? (i = (o = new v()).port2, o.port1.onmessage = S, r = c(i.postMessage, i, 1)) : a.addEventListener && 'function' == typeof postMessage && !a.importScripts && d && 'file:' !== d.protocol && !s(C) ? (r = C, a.addEventListener('message', S, !1)) : r = 'onreadystatechange' in l('script') ? function (e) { + u.appendChild(l('script')).onreadystatechange = function () { + u.removeChild(this), w(e); + }; + } : function (e) { + setTimeout(x(e), 0); + }), e.exports = { + set: h, + clear: m + }; + }, + function (e, t, n) { + var r = n(96); + e.exports = /(iphone|ipod|ipad).*applewebkit/i.test(r); + }, + function (e, t, n) { + var r = n(3), o = n(13), i = n(42); + e.exports = function (e, t) { + if (r(e), o(t) && t.constructor === e) + return t; + var n = i.f(e); + return (0, n.resolve)(t), n.promise; + }; + }, + function (e, t, n) { + var r = n(203); + e.exports = function (e) { + if (r(e)) + throw TypeError('The method doesn\'t accept regular expressions'); + return e; + }; + }, + function (e, t, n) { + var r = n(8)('match'); + e.exports = function (e) { + var t = /./; + try { + '/./'[e](t); + } catch (n) { + try { + return t[r] = !1, '/./'[e](t); + } catch (o) { + } + } + return !1; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(3), o = n(6); + e.exports = function () { + for (var e, t = r(this), n = o(t.delete), i = !0, a = 0, s = arguments.length; a < s; a++) + e = n.call(t, arguments[a]), i = i && e; + return !!i; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(6), o = n(9), i = n(5); + e.exports = function (e) { + var t, n, a, s, c = arguments.length, u = c > 1 ? arguments[1] : void 0; + return r(this), (t = void 0 !== u) && r(u), void 0 == e ? new this() : (n = [], t ? (a = 0, s = o(u, c > 2 ? arguments[2] : void 0, 2), i(e, function (e) { + n.push(s(e, a++)); + })) : i(e, n.push, { that: n }), new this(n)); + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function () { + for (var e = arguments.length, t = new Array(e); e--;) + t[e] = arguments[e]; + return new this(t); + }; + }, + function (e, t, n) { + 'use strict'; + var r = Object.getOwnPropertySymbols, o = Object.prototype.hasOwnProperty, i = Object.prototype.propertyIsEnumerable; + function a(e) { + if (null === e || void 0 === e) + throw new TypeError('Object.assign cannot be called with null or undefined'); + return Object(e); + } + e.exports = function () { + try { + if (!Object.assign) + return !1; + var e = new String('abc'); + if (e[5] = 'de', '5' === Object.getOwnPropertyNames(e)[0]) + return !1; + for (var t = {}, n = 0; n < 10; n++) + t['_' + String.fromCharCode(n)] = n; + if ('0123456789' !== Object.getOwnPropertyNames(t).map(function (e) { + return t[e]; + }).join('')) + return !1; + var r = {}; + return 'abcdefghijklmnopqrst'.split('').forEach(function (e) { + r[e] = e; + }), 'abcdefghijklmnopqrst' === Object.keys(Object.assign({}, r)).join(''); + } catch (o) { + return !1; + } + }() ? Object.assign : function (e, t) { + for (var n, s, c = a(e), u = 1; u < arguments.length; u++) { + for (var l in n = Object(arguments[u])) + o.call(n, l) && (c[l] = n[l]); + if (r) { + s = r(n); + for (var f = 0; f < s.length; f++) + i.call(n, s[f]) && (c[s[f]] = n[s[f]]); + } + } + return c; + }; + }, + function (e, t, n) { + e.exports = n(264)(); + }, + function (e, t) { + var n, r, o = e.exports = {}; + function i() { + throw new Error('setTimeout has not been defined'); + } + function a() { + throw new Error('clearTimeout has not been defined'); + } + function s(e) { + if (n === setTimeout) + return setTimeout(e, 0); + if ((n === i || !n) && setTimeout) + return n = setTimeout, setTimeout(e, 0); + try { + return n(e, 0); + } catch (t) { + try { + return n.call(null, e, 0); + } catch (t) { + return n.call(this, e, 0); + } + } + } + !function () { + try { + n = 'function' === typeof setTimeout ? setTimeout : i; + } catch (e) { + n = i; + } + try { + r = 'function' === typeof clearTimeout ? clearTimeout : a; + } catch (e) { + r = a; + } + }(); + var c, u = [], l = !1, f = -1; + function p() { + l && c && (l = !1, c.length ? u = c.concat(u) : f = -1, u.length && d()); + } + function d() { + if (!l) { + var e = s(p); + l = !0; + for (var t = u.length; t;) { + for (c = u, u = []; ++f < t;) + c && c[f].run(); + f = -1, t = u.length; + } + c = null, l = !1, function (e) { + if (r === clearTimeout) + return clearTimeout(e); + if ((r === a || !r) && clearTimeout) + return r = clearTimeout, clearTimeout(e); + try { + r(e); + } catch (t) { + try { + return r.call(null, e); + } catch (t) { + return r.call(this, e); + } + } + }(e); + } + } + function h(e, t) { + this.fun = e, this.array = t; + } + function m() { + } + o.nextTick = function (e) { + var t = new Array(arguments.length - 1); + if (arguments.length > 1) + for (var n = 1; n < arguments.length; n++) + t[n - 1] = arguments[n]; + u.push(new h(e, t)), 1 !== u.length || l || s(d); + }, h.prototype.run = function () { + this.fun.apply(null, this.array); + }, o.title = 'browser', o.browser = !0, o.env = {}, o.argv = [], o.version = '', o.versions = {}, o.on = m, o.addListener = m, o.once = m, o.off = m, o.removeListener = m, o.removeAllListeners = m, o.emit = m, o.prependListener = m, o.prependOnceListener = m, o.listeners = function (e) { + return []; + }, o.binding = function (e) { + throw new Error('process.binding is not supported'); + }, o.cwd = function () { + return '/'; + }, o.chdir = function (e) { + throw new Error('process.chdir is not supported'); + }, o.umask = function () { + return 0; + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e, t) { + return function () { + for (var n = new Array(arguments.length), r = 0; r < n.length; r++) + n[r] = arguments[r]; + return e.apply(t, n); + }; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + function o(e) { + return encodeURIComponent(e).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']'); + } + e.exports = function (e, t, n) { + if (!t) + return e; + var i; + if (n) + i = n(t); + else if (r.isURLSearchParams(t)) + i = t.toString(); + else { + var a = []; + r.forEach(t, function (e, t) { + null !== e && 'undefined' !== typeof e && (r.isArray(e) ? t += '[]' : e = [e], r.forEach(e, function (e) { + r.isDate(e) ? e = e.toISOString() : r.isObject(e) && (e = JSON.stringify(e)), a.push(o(t) + '=' + o(e)); + })); + }), i = a.join('&'); + } + if (i) { + var s = e.indexOf('#'); + -1 !== s && (e = e.slice(0, s)), e += (-1 === e.indexOf('?') ? '?' : '&') + i; + } + return e; + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e) { + return !(!e || !e.__CANCEL__); + }; + }, + function (e, t, n) { + 'use strict'; + (function (t) { + var r = n(16), o = n(273), i = { 'Content-Type': 'application/x-www-form-urlencoded' }; + function a(e, t) { + !r.isUndefined(e) && r.isUndefined(e['Content-Type']) && (e['Content-Type'] = t); + } + var s = { + adapter: function () { + const $___old_13ec5429c09c102c = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_13ec5429c09c102c) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_5a84e19b2122ba96.XMLHttpRequest)); + return function () { + var e; + return ('undefined' !== typeof XMLHttpRequest || 'undefined' !== typeof t && '[object process]' === Object.prototype.toString.call(t)) && (e = n(124)), e; + }.apply(this, arguments); + } finally { + if ($___old_13ec5429c09c102c) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_13ec5429c09c102c)); + } + }(), + transformRequest: [function (e, t) { + return o(t, 'Accept'), o(t, 'Content-Type'), r.isFormData(e) || r.isArrayBuffer(e) || r.isBuffer(e) || r.isStream(e) || r.isFile(e) || r.isBlob(e) ? e : r.isArrayBufferView(e) ? e.buffer : r.isURLSearchParams(e) ? (a(t, 'application/x-www-form-urlencoded;charset=utf-8'), e.toString()) : r.isObject(e) ? (a(t, 'application/json;charset=utf-8'), JSON.stringify(e)) : e; + }], + transformResponse: [function (e) { + if ('string' === typeof e) + try { + e = JSON.parse(e); + } catch (t) { + } + return e; + }], + timeout: 0, + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + maxContentLength: -1, + validateStatus: function (e) { + return e >= 200 && e < 300; + }, + headers: { common: { Accept: 'application/json, text/plain, */*' } } + }; + r.forEach([ + 'delete', + 'get', + 'head' + ], function (e) { + s.headers[e] = {}; + }), r.forEach([ + 'post', + 'put', + 'patch' + ], function (e) { + s.headers[e] = r.merge(i); + }), e.exports = s; + }.call(this, n(119))); + }, + function (e, t, n) { + 'use strict'; + var r = n(16), o = n(274), i = n(121), a = n(276), s = n(279), c = n(280), u = n(125); + e.exports = function (e) { + return new Promise(function (t, l) { + const $___old_b821163133a6abe7 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_faabcc12184e31ff = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_b821163133a6abe7) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_5a84e19b2122ba96.XMLHttpRequest)); + if ($___old_faabcc12184e31ff) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_5a84e19b2122ba96.XMLHttpRequest)); + return function () { + var f = e.data, p = e.headers; + r.isFormData(f) && delete p['Content-Type']; + var d = new XMLHttpRequest(); + if (e.auth) { + var h = e.auth.username || '', m = e.auth.password || ''; + p.Authorization = 'Basic ' + btoa(h + ':' + m); + } + var g = a(e.baseURL, e.url); + if (d.open(e.method.toUpperCase(), i(g, e.params, e.paramsSerializer), !0), d.timeout = e.timeout, d.onreadystatechange = function () { + if (d && 4 === d.readyState && (0 !== d.status || d.responseURL && 0 === d.responseURL.indexOf('file:'))) { + var n = 'getAllResponseHeaders' in d ? s(d.getAllResponseHeaders()) : null, r = { + data: e.responseType && 'text' !== e.responseType ? d.response : d.responseText, + status: d.status, + statusText: d.statusText, + headers: n, + config: e, + request: d + }; + o(t, l, r), d = null; + } + }, d.onabort = function () { + d && (l(u('Request aborted', e, 'ECONNABORTED', d)), d = null); + }, d.onerror = function () { + l(u('Network Error', e, null, d)), d = null; + }, d.ontimeout = function () { + var t = 'timeout of ' + e.timeout + 'ms exceeded'; + e.timeoutErrorMessage && (t = e.timeoutErrorMessage), l(u(t, e, 'ECONNABORTED', d)), d = null; + }, r.isStandardBrowserEnv()) { + var v = n(281), y = (e.withCredentials || c(g)) && e.xsrfCookieName ? v.read(e.xsrfCookieName) : void 0; + y && (p[e.xsrfHeaderName] = y); + } + if ('setRequestHeader' in d && r.forEach(p, function (e, t) { + 'undefined' === typeof f && 'content-type' === t.toLowerCase() ? delete p[t] : d.setRequestHeader(t, e); + }), r.isUndefined(e.withCredentials) || (d.withCredentials = !!e.withCredentials), e.responseType) + try { + d.responseType = e.responseType; + } catch (b) { + if ('json' !== e.responseType) + throw b; + } + 'function' === typeof e.onDownloadProgress && d.addEventListener('progress', e.onDownloadProgress), 'function' === typeof e.onUploadProgress && d.upload && d.upload.addEventListener('progress', e.onUploadProgress), e.cancelToken && e.cancelToken.promise.then(function (e) { + d && (d.abort(), l(e), d = null); + }), void 0 === f && (f = null), d.send(f); + }.apply(this, arguments); + } finally { + if ($___old_b821163133a6abe7) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_b821163133a6abe7)); + if ($___old_faabcc12184e31ff) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_faabcc12184e31ff)); + } + }); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(275); + e.exports = function (e, t, n, o, i) { + var a = new Error(e); + return r(a, t, n, o, i); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + e.exports = function (e, t) { + t = t || {}; + var n = {}, o = [ + 'url', + 'method', + 'params', + 'data' + ], i = [ + 'headers', + 'auth', + 'proxy' + ], a = [ + 'baseURL', + 'url', + 'transformRequest', + 'transformResponse', + 'paramsSerializer', + 'timeout', + 'withCredentials', + 'adapter', + 'responseType', + 'xsrfCookieName', + 'xsrfHeaderName', + 'onUploadProgress', + 'onDownloadProgress', + 'maxContentLength', + 'validateStatus', + 'maxRedirects', + 'httpAgent', + 'httpsAgent', + 'cancelToken', + 'socketPath' + ]; + r.forEach(o, function (e) { + 'undefined' !== typeof t[e] && (n[e] = t[e]); + }), r.forEach(i, function (o) { + r.isObject(t[o]) ? n[o] = r.deepMerge(e[o], t[o]) : 'undefined' !== typeof t[o] ? n[o] = t[o] : r.isObject(e[o]) ? n[o] = r.deepMerge(e[o]) : 'undefined' !== typeof e[o] && (n[o] = e[o]); + }), r.forEach(a, function (r) { + 'undefined' !== typeof t[r] ? n[r] = t[r] : 'undefined' !== typeof e[r] && (n[r] = e[r]); + }); + var s = o.concat(i).concat(a), c = Object.keys(t).filter(function (e) { + return -1 === s.indexOf(e); + }); + return r.forEach(c, function (r) { + 'undefined' !== typeof t[r] ? n[r] = t[r] : 'undefined' !== typeof e[r] && (n[r] = e[r]); + }), n; + }; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + this.message = e; + } + r.prototype.toString = function () { + return 'Cancel' + (this.message ? ': ' + this.message : ''); + }, r.prototype.__CANCEL__ = !0, e.exports = r; + }, + function (e, t) { + }, + function (e, t) { + }, + function (e, t) { + }, + function (e, t) { + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(15), o = function () { + function e() { + } + return e.encode = function (e) { + if (!/^[0-1]+$/.test(e)) + throw new r.EncodingError('Invalid bitField'); + var t = e.length % this.LCM; + e += t ? '0'.repeat(this.LCM - t) : ''; + for (var n = '', o = 0; o < e.length; o += this.BASIS) + n += this.DICT[parseInt(e.substr(o, this.BASIS), 2)]; + return n; + }, e.decode = function (e) { + if (!/^[A-Za-z0-9\-_]+$/.test(e)) + throw new r.DecodingError('Invalidly encoded Base64URL string'); + for (var t = '', n = 0; n < e.length; n++) { + var o = this.REVERSE_DICT.get(e[n]).toString(2); + t += '0'.repeat(this.BASIS - o.length) + o; + } + return t; + }, e.DICT = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', e.REVERSE_DICT = new Map([ + [ + 'A', + 0 + ], + [ + 'B', + 1 + ], + [ + 'C', + 2 + ], + [ + 'D', + 3 + ], + [ + 'E', + 4 + ], + [ + 'F', + 5 + ], + [ + 'G', + 6 + ], + [ + 'H', + 7 + ], + [ + 'I', + 8 + ], + [ + 'J', + 9 + ], + [ + 'K', + 10 + ], + [ + 'L', + 11 + ], + [ + 'M', + 12 + ], + [ + 'N', + 13 + ], + [ + 'O', + 14 + ], + [ + 'P', + 15 + ], + [ + 'Q', + 16 + ], + [ + 'R', + 17 + ], + [ + 'S', + 18 + ], + [ + 'T', + 19 + ], + [ + 'U', + 20 + ], + [ + 'V', + 21 + ], + [ + 'W', + 22 + ], + [ + 'X', + 23 + ], + [ + 'Y', + 24 + ], + [ + 'Z', + 25 + ], + [ + 'a', + 26 + ], + [ + 'b', + 27 + ], + [ + 'c', + 28 + ], + [ + 'd', + 29 + ], + [ + 'e', + 30 + ], + [ + 'f', + 31 + ], + [ + 'g', + 32 + ], + [ + 'h', + 33 + ], + [ + 'i', + 34 + ], + [ + 'j', + 35 + ], + [ + 'k', + 36 + ], + [ + 'l', + 37 + ], + [ + 'm', + 38 + ], + [ + 'n', + 39 + ], + [ + 'o', + 40 + ], + [ + 'p', + 41 + ], + [ + 'q', + 42 + ], + [ + 'r', + 43 + ], + [ + 's', + 44 + ], + [ + 't', + 45 + ], + [ + 'u', + 46 + ], + [ + 'v', + 47 + ], + [ + 'w', + 48 + ], + [ + 'x', + 49 + ], + [ + 'y', + 50 + ], + [ + 'z', + 51 + ], + [ + '0', + 52 + ], + [ + '1', + 53 + ], + [ + '2', + 54 + ], + [ + '3', + 55 + ], + [ + '4', + 56 + ], + [ + '5', + 57 + ], + [ + '6', + 58 + ], + [ + '7', + 59 + ], + [ + '8', + 60 + ], + [ + '9', + 61 + ], + [ + '-', + 62 + ], + [ + '_', + 63 + ] + ]), e.BASIS = 6, e.LCM = 24, e; + }(); + t.Base64Url = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t() { + var t = null !== e && e.apply(this, arguments) || this; + return t.root = null, t; + } + return r(t, e), t.prototype.isEmpty = function () { + return !this.root; + }, t.prototype.add = function (e) { + var t, n = { + value: e, + left: null, + right: null + }; + if (this.isEmpty()) + this.root = n; + else + for (t = this.root;;) + if (e < t.value) { + if (null === t.left) { + t.left = n; + break; + } + t = t.left; + } else { + if (!(e > t.value)) + break; + if (null === t.right) { + t.right = n; + break; + } + t = t.right; + } + }, t.prototype.get = function () { + for (var e = [], t = this.root; t;) + if (t.left) { + for (var n = t.left; n.right && n.right != t;) + n = n.right; + n.right == t ? (n.right = null, e.push(t.value), t = t.right) : (n.right = t, t = t.left); + } else + e.push(t.value), t = t.right; + return e; + }, t.prototype.contains = function (e) { + for (var t = !1, n = this.root; n;) { + if (n.value === e) { + t = !0; + break; + } + e > n.value ? n = n.right : e < n.value && (n = n.left); + } + return t; + }, t.prototype.min = function (e) { + var t; + for (void 0 === e && (e = this.root); e;) + e.left ? e = e.left : (t = e.value, e = null); + return t; + }, t.prototype.max = function (e) { + var t; + for (void 0 === e && (e = this.root); e;) + e.right ? e = e.right : (t = e.value, e = null); + return t; + }, t.prototype.remove = function (e, t) { + void 0 === t && (t = this.root); + for (var n = null, r = 'left'; t;) + if (e < t.value) + n = t, t = t.left, r = 'left'; + else if (e > t.value) + n = t, t = t.right, r = 'right'; + else { + if (t.left || t.right) + if (t.left) + if (t.right) { + var o = this.min(t.right); + this.remove(o, t.right), t.value = o; + } else + n ? n[r] = t.left : this.root = t.left; + else + n ? n[r] = t.right : this.root = t.right; + else + n ? n[r] = null : this.root = null; + t = null; + } + }, t; + }(n(29).Cloneable); + t.BinarySearchTree = o; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.cmpId = 'cmpId', e.cmpVersion = 'cmpVersion', e.consentLanguage = 'consentLanguage', e.consentScreen = 'consentScreen', e.created = 'created', e.supportOOB = 'supportOOB', e.isServiceSpecific = 'isServiceSpecific', e.lastUpdated = 'lastUpdated', e.numCustomPurposes = 'numCustomPurposes', e.policyVersion = 'policyVersion', e.publisherCountryCode = 'publisherCountryCode', e.publisherCustomConsents = 'publisherCustomConsents', e.publisherCustomLegitimateInterests = 'publisherCustomLegitimateInterests', e.publisherLegitimateInterests = 'publisherLegitimateInterests', e.publisherConsents = 'publisherConsents', e.publisherRestrictions = 'publisherRestrictions', e.purposeConsents = 'purposeConsents', e.purposeLegitimateInterests = 'purposeLegitimateInterests', e.purposeOneTreatment = 'purposeOneTreatment', e.specialFeatureOptins = 'specialFeatureOptins', e.useNonStandardStacks = 'useNonStandardStacks', e.vendorConsents = 'vendorConsents', e.vendorLegitimateInterests = 'vendorLegitimateInterests', e.vendorListVersion = 'vendorListVersion', e.vendorsAllowed = 'vendorsAllowed', e.vendorsDisclosed = 'vendorsDisclosed', e.version = 'version', e; + }(); + t.Fields = r; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(29), i = n(15), a = n(79), s = function (e) { + function t(t, n) { + var r = e.call(this) || this; + return void 0 !== t && (r.purposeId = t), void 0 !== n && (r.restrictionType = n), r; + } + return r(t, e), t.unHash = function (e) { + var n = e.split(this.hashSeparator), r = new t(); + if (2 !== n.length) + throw new i.TCModelError('hash', e); + return r.purposeId = parseInt(n[0], 10), r.restrictionType = parseInt(n[1], 10), r; + }, Object.defineProperty(t.prototype, 'hash', { + get: function () { + if (!this.isValid()) + throw new Error('cannot hash invalid PurposeRestriction'); + return '' + this.purposeId + t.hashSeparator + this.restrictionType; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'purposeId', { + get: function () { + return this.purposeId_; + }, + set: function (e) { + this.purposeId_ = e; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.isValid = function () { + return Number.isInteger(this.purposeId) && this.purposeId > 0 && (this.restrictionType === a.RestrictionType.NOT_ALLOWED || this.restrictionType === a.RestrictionType.REQUIRE_CONSENT || this.restrictionType === a.RestrictionType.REQUIRE_LI); + }, t.prototype.isSameAs = function (e) { + return this.purposeId === e.purposeId && this.restrictionType === e.restrictionType; + }, t.hashSeparator = '-', t; + }(o.Cloneable); + t.PurposeRestriction = s; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.Segment || (t.Segment = {})).CORE = 'core', r.VENDORS_DISCLOSED = 'vendorsDisclosed', r.VENDORS_ALLOWED = 'vendorsAllowed', r.PUBLISHER_TC = 'publisherTC'; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(43)), r(n(138)), r(n(293)), r(n(80)), r(n(30)), r(n(139)), r(n(140)), r(n(142)), r(n(141)); + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(30), o = n(15), i = function () { + function e() { + } + return e.encode = function (e, t) { + return r.IntEncoder.encode(Math.round(e.getTime() / 100), t); + }, e.decode = function (e, t) { + if (t !== e.length) + throw new o.DecodingError('invalid bit length'); + var n = new Date(); + return n.setTime(100 * r.IntEncoder.decode(e, t)), n; + }, e; + }(); + t.DateEncoder = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(30), o = n(15), i = function () { + function e() { + } + return e.encode = function (e, t) { + var n = (e = e.toUpperCase()).charCodeAt(0) - 65, i = e.charCodeAt(1) - 65; + if (n < 0 || n > 25 || i < 0 || i > 25) + throw new o.EncodingError('invalid language code: ' + e); + if (t % 2 == 1) + throw new o.EncodingError('numBits must be even, ' + t + ' is not valid'); + return t /= 2, r.IntEncoder.encode(n, t) + r.IntEncoder.encode(i, t); + }, e.decode = function (e, t) { + if (t !== e.length || e.length % 2) + throw new o.DecodingError('invalid bit length for language'); + var n = e.length / 2, i = r.IntEncoder.decode(e.slice(0, n), n) + 65, a = r.IntEncoder.decode(e.slice(n), n) + 65; + return String.fromCharCode(i) + String.fromCharCode(a); + }, e; + }(); + t.LangEncoder = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(78), o = n(43), i = n(15), a = n(30), s = n(17), c = function () { + function e() { + } + return e.encode = function (e) { + var t = a.IntEncoder.encode(e.numRestrictions, r.BitLength.numRestrictions); + return e.isEmpty() || e.getRestrictions().forEach(function (n) { + t += a.IntEncoder.encode(n.purposeId, r.BitLength.purposeId), t += a.IntEncoder.encode(n.restrictionType, r.BitLength.restrictionType); + for (var i = e.getVendors(n), s = i.length, c = 0, u = 0, l = '', f = 0; f < s; f++) { + var p = i[f]; + if (0 === u && (c++, u = p), f === s - 1 || i[f + 1] > p + 1) { + var d = !(p === u); + l += o.BooleanEncoder.encode(d), l += a.IntEncoder.encode(u, r.BitLength.vendorId), d && (l += a.IntEncoder.encode(p, r.BitLength.vendorId)), u = 0; + } + } + t += a.IntEncoder.encode(c, r.BitLength.numEntries), t += l; + }), t; + }, e.decode = function (e) { + var t = 0, n = new s.PurposeRestrictionVector(), c = a.IntEncoder.decode(e.substr(t, r.BitLength.numRestrictions), r.BitLength.numRestrictions); + t += r.BitLength.numRestrictions; + for (var u = 0; u < c; u++) { + var l = a.IntEncoder.decode(e.substr(t, r.BitLength.purposeId), r.BitLength.purposeId); + t += r.BitLength.purposeId; + var f = a.IntEncoder.decode(e.substr(t, r.BitLength.restrictionType), r.BitLength.restrictionType); + t += r.BitLength.restrictionType; + var p = new s.PurposeRestriction(l, f), d = a.IntEncoder.decode(e.substr(t, r.BitLength.numEntries), r.BitLength.numEntries); + t += r.BitLength.numEntries; + for (var h = 0; h < d; h++) { + var m = o.BooleanEncoder.decode(e.substr(t, r.BitLength.anyBoolean)); + t += r.BitLength.anyBoolean; + var g = a.IntEncoder.decode(e.substr(t, r.BitLength.vendorId), r.BitLength.vendorId); + if (t += r.BitLength.vendorId, m) { + var v = a.IntEncoder.decode(e.substr(t, r.BitLength.vendorId), r.BitLength.vendorId); + if (t += r.BitLength.vendorId, v < g) + throw new i.DecodingError('Invalid RangeEntry: endVendorId ' + v + ' is less than ' + g); + for (var y = g; y <= v; y++) + n.add(y, p); + } else + n.add(g, p); + } + } + return n.bitLength = t, n; + }, e; + }(); + t.PurposeRestrictionVectorEncoder = c; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(17), o = n(77), i = n(30), a = n(43), s = n(80), c = n(142), u = n(15), l = function () { + function e() { + } + return e.encode = function (e) { + var t, n = [], r = [], s = i.IntEncoder.encode(e.maxId, o.BitLength.maxId), u = '', l = o.BitLength.maxId + o.BitLength.encodingType, f = l + e.maxId, p = 2 * o.BitLength.vendorId + o.BitLength.singleOrRange + o.BitLength.numEntries, d = l + o.BitLength.numEntries; + return e.forEach(function (i, s) { + u += a.BooleanEncoder.encode(i), (t = e.maxId > p && d < f) && i && (e.has(s + 1) ? 0 === r.length && (r.push(s), d += o.BitLength.singleOrRange, d += o.BitLength.vendorId) : (r.push(s), d += o.BitLength.vendorId, n.push(r), r = [])); + }), t ? (s += c.VectorEncodingType.RANGE + '', s += this.buildRangeEncoding(n)) : (s += c.VectorEncodingType.FIELD + '', s += u), s; + }, e.decode = function (e, t) { + var n, l = 0, f = i.IntEncoder.decode(e.substr(l, o.BitLength.maxId), o.BitLength.maxId); + l += o.BitLength.maxId; + var p = i.IntEncoder.decode(e.charAt(l), o.BitLength.encodingType); + if (l += o.BitLength.encodingType, p === c.VectorEncodingType.RANGE) { + if (n = new r.Vector(), 1 === t) { + if ('1' === e.substr(l, 1)) + throw new u.DecodingError('Unable to decode default consent=1'); + l++; + } + var d = i.IntEncoder.decode(e.substr(l, o.BitLength.numEntries), o.BitLength.numEntries); + l += o.BitLength.numEntries; + for (var h = 0; h < d; h++) { + var m = a.BooleanEncoder.decode(e.charAt(l)); + l += o.BitLength.singleOrRange; + var g = i.IntEncoder.decode(e.substr(l, o.BitLength.vendorId), o.BitLength.vendorId); + if (l += o.BitLength.vendorId, m) { + var v = i.IntEncoder.decode(e.substr(l, o.BitLength.vendorId), o.BitLength.vendorId); + l += o.BitLength.vendorId; + for (var y = g; y <= v; y++) + n.set(y); + } else + n.set(g); + } + } else { + var b = e.substr(l, f); + l += f, n = s.FixedVectorEncoder.decode(b, f); + } + return n.bitLength = l, n; + }, e.buildRangeEncoding = function (e) { + var t = e.length, n = i.IntEncoder.encode(t, o.BitLength.numEntries); + return e.forEach(function (e) { + var t = 1 === e.length; + n += a.BooleanEncoder.encode(!t), n += i.IntEncoder.encode(e[0], o.BitLength.vendorId), t || (n += i.IntEncoder.encode(e[1], o.BitLength.vendorId)); + }), n; + }, e; + }(); + t.VendorVectorEncoder = l; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }), (r = t.VectorEncodingType || (t.VectorEncodingType = {}))[r.FIELD = 0] = 'FIELD', r[r.RANGE = 1] = 'RANGE'; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + for (var n in e) + t.hasOwnProperty(n) || (t[n] = e[n]); + } + Object.defineProperty(t, '__esModule', { value: !0 }), r(n(294)), r(n(295)); + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(), o = this && this.__awaiter || function (e, t, n, r) { + return new (n || (n = Promise))(function (o, i) { + function a(e) { + try { + c(r.next(e)); + } catch (e) { + i(e); + } + } + function s(e) { + try { + c(r.throw(e)); + } catch (e) { + i(e); + } + } + function c(e) { + var t; + e.done ? o(e.value) : (t = e.value, t instanceof n ? t : new n(function (e) { + e(t); + })).then(a, s); + } + c((r = r.apply(e, t || [])).next()); + }); + }, i = this && this.__generator || function (e, t) { + var n, r, o, i, a = { + label: 0, + sent: function () { + if (1 & o[0]) + throw o[1]; + return o[1]; + }, + trys: [], + ops: [] + }; + return i = { + next: s(0), + throw: s(1), + return: s(2) + }, 'function' == typeof Symbol && (i[Symbol.iterator] = function () { + return this; + }), i; + function s(i) { + return function (s) { + return function (i) { + if (n) + throw new TypeError('Generator is already executing.'); + for (; a;) + try { + if (n = 1, r && (o = 2 & i[0] ? r.return : i[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, i[1])).done) + return o; + switch (r = 0, o && (i = [ + 2 & i[0], + o.value + ]), i[0]) { + case 0: + case 1: + o = i; + break; + case 4: + return a.label++, { + value: i[1], + done: !1 + }; + case 5: + a.label++, r = i[1], i = [0]; + continue; + case 7: + i = a.ops.pop(), a.trys.pop(); + continue; + default: + if (!(o = (o = a.trys).length > 0 && o[o.length - 1]) && (6 === i[0] || 2 === i[0])) { + a = 0; + continue; + } + if (3 === i[0] && (!o || i[1] > o[0] && i[1] < o[3])) { + a.label = i[1]; + break; + } + if (6 === i[0] && a.label < o[1]) { + a.label = o[1], o = i; + break; + } + if (o && a.label < o[2]) { + a.label = o[2], a.ops.push(i); + break; + } + o[2] && a.ops.pop(), a.trys.pop(); + continue; + } + i = t.call(e, a); + } catch (e) { + i = [ + 6, + e + ], r = 0; + } finally { + n = o = 0; + } + if (5 & i[0]) + throw i[1]; + return { + value: i[0] ? i[1] : void 0, + done: !0 + }; + }([ + i, + s + ]); + }; + } + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var a = n(29), s = n(15), c = n(145), u = n(17), l = function (e) { + function t(n) { + var r = e.call(this) || this; + r.isReady_ = !1, r.isLatest = !1; + var o = t.baseUrl; + if (r.lang_ = t.DEFAULT_LANGUAGE, r.isVendorList(n)) + r.populate(n), r.readyPromise = Promise.resolve(); + else { + if (!o) + throw new s.GVLError('must specify GVL.baseUrl before loading GVL json'); + if (n > 0) { + var i = n; + t.CACHE.has(i) ? (r.populate(t.CACHE.get(i)), r.readyPromise = Promise.resolve()) : (o += t.versionedFilename.replace('[VERSION]', i + ''), r.readyPromise = r.fetchJson(o)); + } else + t.CACHE.has(t.LATEST_CACHE_KEY) ? (r.populate(t.CACHE.get(t.LATEST_CACHE_KEY)), r.readyPromise = Promise.resolve()) : (r.isLatest = !0, r.readyPromise = r.fetchJson(o + t.latestFilename)); + } + return r; + } + return r(t, e), Object.defineProperty(t, 'baseUrl', { + get: function () { + return this.baseUrl_; + }, + set: function (e) { + if (/^https?:\/\/vendorlist\.consensu\.org\//.test(e)) + throw new s.GVLError('Invalid baseUrl! You may not pull directly from vendorlist.consensu.org and must provide your own cache'); + e.length > 0 && '/' !== e[e.length - 1] && (e += '/'), this.baseUrl_ = e; + }, + enumerable: !0, + configurable: !0 + }), t.emptyLanguageCache = function (e) { + var n = !1; + return void 0 === e && t.LANGUAGE_CACHE.size > 0 ? (t.LANGUAGE_CACHE = new Map(), n = !0) : 'string' == typeof e && this.consentLanguages.has(e.toUpperCase()) && (t.LANGUAGE_CACHE.delete(e.toUpperCase()), n = !0), n; + }, t.emptyCache = function (e) { + var n = !1; + return Number.isInteger(e) && e >= 0 ? (t.CACHE.delete(e), n = !0) : void 0 === e && (t.CACHE = new Map(), n = !0), n; + }, t.prototype.cacheLanguage = function () { + t.LANGUAGE_CACHE.has(this.lang_) || t.LANGUAGE_CACHE.set(this.lang_, { + purposes: this.purposes, + specialPurposes: this.specialPurposes, + features: this.features, + specialFeatures: this.specialFeatures, + stacks: this.stacks + }); + }, t.prototype.fetchJson = function (e) { + return o(this, void 0, void 0, function () { + var t, n; + return i(this, function (r) { + switch (r.label) { + case 0: + return r.trys.push([ + 0, + 2, + , + 3 + ]), t = this.populate, [ + 4, + c.Json.fetch(e) + ]; + case 1: + return t.apply(this, [r.sent()]), [ + 3, + 3 + ]; + case 2: + throw n = r.sent(), new s.GVLError(n.message); + case 3: + return [2]; + } + }); + }); + }, t.prototype.getJson = function () { + return JSON.parse(JSON.stringify({ + gvlSpecificationVersion: this.gvlSpecificationVersion, + vendorListVersion: this.vendorListVersion, + tcfPolicyVersion: this.tcfPolicyVersion, + lastUpdated: this.lastUpdated, + purposes: this.purposes, + specialPurposes: this.specialPurposes, + features: this.features, + specialFeatures: this.specialFeatures, + stacks: this.stacks, + vendors: this.fullVendorList + })); + }, t.prototype.changeLanguage = function (e) { + return o(this, void 0, void 0, function () { + var n, r, o, a, c; + return i(this, function (i) { + switch (i.label) { + case 0: + if (n = e.toUpperCase(), !t.consentLanguages.has(n)) + return [ + 3, + 6 + ]; + if (n === this.lang_) + return [ + 3, + 5 + ]; + if (this.lang_ = n, !t.LANGUAGE_CACHE.has(n)) + return [ + 3, + 1 + ]; + for (o in r = t.LANGUAGE_CACHE.get(n)) + r.hasOwnProperty(o) && (this[o] = r[o]); + return [ + 3, + 5 + ]; + case 1: + a = t.baseUrl + t.languageFilename.replace('[LANG]', e), i.label = 2; + case 2: + return i.trys.push([ + 2, + 4, + , + 5 + ]), [ + 4, + this.fetchJson(a) + ]; + case 3: + return i.sent(), this.cacheLanguage(), [ + 3, + 5 + ]; + case 4: + throw c = i.sent(), new s.GVLError('unable to load language: ' + c.message); + case 5: + return [ + 3, + 7 + ]; + case 6: + throw new s.GVLError('unsupported language ' + e); + case 7: + return [2]; + } + }); + }); + }, Object.defineProperty(t.prototype, 'language', { + get: function () { + return this.lang_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.isVendorList = function (e) { + return void 0 !== e && void 0 !== e.vendors; + }, t.prototype.populate = function (e) { + this.purposes = e.purposes, this.specialPurposes = e.specialPurposes, this.features = e.features, this.specialFeatures = e.specialFeatures, this.stacks = e.stacks, this.isVendorList(e) && (this.gvlSpecificationVersion = e.gvlSpecificationVersion, this.tcfPolicyVersion = e.tcfPolicyVersion, this.vendorListVersion = e.vendorListVersion, this.lastUpdated = e.lastUpdated, 'string' == typeof this.lastUpdated && (this.lastUpdated = new Date(this.lastUpdated)), this.vendors_ = e.vendors, this.fullVendorList = e.vendors, this.mapVendors(), this.isReady_ = !0, this.isLatest && t.CACHE.set(t.LATEST_CACHE_KEY, this.getJson()), t.CACHE.has(this.vendorListVersion) || t.CACHE.set(this.vendorListVersion, this.getJson())), this.cacheLanguage(); + }, t.prototype.mapVendors = function (e) { + var t = this; + this.byPurposeVendorMap = {}, this.bySpecialPurposeVendorMap = {}, this.byFeatureVendorMap = {}, this.bySpecialFeatureVendorMap = {}, Object.keys(this.purposes).forEach(function (e) { + t.byPurposeVendorMap[e] = { + legInt: new Set(), + consent: new Set(), + flexible: new Set() + }; + }), Object.keys(this.specialPurposes).forEach(function (e) { + t.bySpecialPurposeVendorMap[e] = new Set(); + }), Object.keys(this.features).forEach(function (e) { + t.byFeatureVendorMap[e] = new Set(); + }), Object.keys(this.specialFeatures).forEach(function (e) { + t.bySpecialFeatureVendorMap[e] = new Set(); + }), Array.isArray(e) || (e = Object.keys(this.fullVendorList).map(function (e) { + return +e; + })), this.vendorIds = new Set(e), this.vendors_ = e.reduce(function (e, n) { + var r = t.vendors_['' + n]; + return r && void 0 === r.deletedDate && (r.purposes.forEach(function (e) { + t.byPurposeVendorMap[e + ''].consent.add(n); + }), r.specialPurposes.forEach(function (e) { + t.bySpecialPurposeVendorMap[e + ''].add(n); + }), r.legIntPurposes.forEach(function (e) { + t.byPurposeVendorMap[e + ''].legInt.add(n); + }), r.flexiblePurposes && r.flexiblePurposes.forEach(function (e) { + t.byPurposeVendorMap[e + ''].flexible.add(n); + }), r.features.forEach(function (e) { + t.byFeatureVendorMap[e + ''].add(n); + }), r.specialFeatures.forEach(function (e) { + t.bySpecialFeatureVendorMap[e + ''].add(n); + }), e[n] = r), e; + }, {}); + }, t.prototype.getFilteredVendors = function (e, t, n, r) { + var o = this, i = e.charAt(0).toUpperCase() + e.slice(1), a = {}; + return ('purpose' === e && n ? this['by' + i + 'VendorMap'][t + ''][n] : this['by' + (r ? 'Special' : '') + i + 'VendorMap'][t + '']).forEach(function (e) { + a[e + ''] = o.vendors[e + '']; + }), a; + }, t.prototype.getVendorsWithConsentPurpose = function (e) { + return this.getFilteredVendors('purpose', e, 'consent'); + }, t.prototype.getVendorsWithLegIntPurpose = function (e) { + return this.getFilteredVendors('purpose', e, 'legInt'); + }, t.prototype.getVendorsWithFlexiblePurpose = function (e) { + return this.getFilteredVendors('purpose', e, 'flexible'); + }, t.prototype.getVendorsWithSpecialPurpose = function (e) { + return this.getFilteredVendors('purpose', e, void 0, !0); + }, t.prototype.getVendorsWithFeature = function (e) { + return this.getFilteredVendors('feature', e); + }, t.prototype.getVendorsWithSpecialFeature = function (e) { + return this.getFilteredVendors('feature', e, void 0, !0); + }, Object.defineProperty(t.prototype, 'vendors', { + get: function () { + return this.vendors_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.narrowVendorsTo = function (e) { + this.mapVendors(e); + }, Object.defineProperty(t.prototype, 'isReady', { + get: function () { + return this.isReady_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.clone = function () { + return new t(this.getJson()); + }, t.isInstanceOf = function (e) { + return 'object' == typeof e && 'function' == typeof e.narrowVendorsTo; + }, t.LANGUAGE_CACHE = new Map(), t.CACHE = new Map(), t.LATEST_CACHE_KEY = 0, t.DEFAULT_LANGUAGE = 'EN', t.consentLanguages = new u.ConsentLanguages(), t.latestFilename = 'vendor-list.json', t.versionedFilename = 'archives/vendor-list-v[VERSION].json', t.languageFilename = 'purposes-[LANG].json', t; + }(a.Cloneable); + t.GVL = l; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.absCall = function (e, t, n, r) { + return new Promise(function (o, i) { + var a = new XMLHttpRequest(); + a.withCredentials = n, a.addEventListener('load', function () { + if (a.readyState == XMLHttpRequest.DONE) + if (a.status >= 200 && a.status < 300) { + var e = a.response; + if ('string' == typeof e) + try { + e = JSON.parse(e); + } catch (e) { + } + o(e); + } else + i(new Error('HTTP Status: ' + a.status + ' response type: ' + a.responseType)); + }), a.addEventListener('error', function () { + i(new Error('error')); + }), a.addEventListener('abort', function () { + i(new Error('aborted')); + }), null === t ? a.open('GET', e, !0) : a.open('POST', e, !0), a.responseType = 'json', a.timeout = r, a.ontimeout = function () { + i(new Error('Timeout ' + r + 'ms ' + e)); + }, a.send(t); + }); + }, e.post = function (e, t, n, r) { + return void 0 === n && (n = !1), void 0 === r && (r = 0), this.absCall(e, JSON.stringify(t), n, r); + }, e.fetch = function (e, t, n) { + return void 0 === t && (t = !1), void 0 === n && (n = 0), this.absCall(e, null, t, n); + }, e; + }(); + t.Json = r; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(29), i = n(15), a = n(144), s = n(17), c = function (e) { + function t(t) { + var n = e.call(this) || this; + return n.isServiceSpecific_ = !1, n.supportOOB_ = !0, n.useNonStandardStacks_ = !1, n.purposeOneTreatment_ = !1, n.publisherCountryCode_ = 'AA', n.version_ = 2, n.consentScreen_ = 0, n.policyVersion_ = 2, n.consentLanguage_ = 'EN', n.cmpId_ = 0, n.cmpVersion_ = 0, n.vendorListVersion_ = 0, n.numCustomPurposes_ = 0, n.specialFeatureOptins = new s.Vector(), n.purposeConsents = new s.Vector(), n.purposeLegitimateInterests = new s.Vector(), n.publisherConsents = new s.Vector(), n.publisherLegitimateInterests = new s.Vector(), n.publisherCustomConsents = new s.Vector(), n.publisherCustomLegitimateInterests = new s.Vector(), n.vendorConsents = new s.Vector(), n.vendorLegitimateInterests = new s.Vector(), n.vendorsDisclosed = new s.Vector(), n.vendorsAllowed = new s.Vector(), n.publisherRestrictions = new s.PurposeRestrictionVector(), t && (n.gvl = t), n.created = new Date(), n.updated(), n; + } + return r(t, e), Object.defineProperty(t.prototype, 'gvl', { + get: function () { + return this.gvl_; + }, + set: function (e) { + a.GVL.isInstanceOf(e) || (e = new a.GVL(e)), this.gvl_ = e, this.publisherRestrictions.gvl = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'cmpId', { + get: function () { + return this.cmpId_; + }, + set: function (e) { + if (!(Number.isInteger(+e) && e > 1)) + throw new i.TCModelError('cmpId', e); + this.cmpId_ = +e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'cmpVersion', { + get: function () { + return this.cmpVersion_; + }, + set: function (e) { + if (!(Number.isInteger(+e) && e > -1)) + throw new i.TCModelError('cmpVersion', e); + this.cmpVersion_ = +e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'consentScreen', { + get: function () { + return this.consentScreen_; + }, + set: function (e) { + if (!(Number.isInteger(+e) && e > -1)) + throw new i.TCModelError('consentScreen', e); + this.consentScreen_ = +e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'consentLanguage', { + get: function () { + return this.consentLanguage_; + }, + set: function (e) { + this.consentLanguage_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'publisherCountryCode', { + get: function () { + return this.publisherCountryCode_; + }, + set: function (e) { + if (!/^([A-z]){2}$/.test(e)) + throw new i.TCModelError('publisherCountryCode', e); + this.publisherCountryCode_ = e.toUpperCase(); + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'vendorListVersion', { + get: function () { + return this.gvl ? this.gvl.vendorListVersion : this.vendorListVersion_; + }, + set: function (e) { + if ((e = +e >> 0) < 0) + throw new i.TCModelError('vendorListVersion', e); + this.vendorListVersion_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'policyVersion', { + get: function () { + return this.gvl ? this.gvl.tcfPolicyVersion : this.policyVersion_; + }, + set: function (e) { + if (this.policyVersion_ = parseInt(e, 10), this.policyVersion_ < 0) + throw new i.TCModelError('policyVersion', e); + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'version', { + get: function () { + return this.version_; + }, + set: function (e) { + this.version_ = parseInt(e, 10); + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'isServiceSpecific', { + get: function () { + return this.isServiceSpecific_; + }, + set: function (e) { + this.isServiceSpecific_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'useNonStandardStacks', { + get: function () { + return this.useNonStandardStacks_; + }, + set: function (e) { + this.useNonStandardStacks_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'supportOOB', { + get: function () { + return this.supportOOB_; + }, + set: function (e) { + this.supportOOB_ = e; + }, + enumerable: !0, + configurable: !0 + }), Object.defineProperty(t.prototype, 'purposeOneTreatment', { + get: function () { + return this.purposeOneTreatment_; + }, + set: function (e) { + this.purposeOneTreatment_ = e; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.setAllVendorConsents = function () { + this.vendorConsents.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorConsents = function () { + this.vendorConsents.empty(); + }, t.prototype.setAllVendorsDisclosed = function () { + this.vendorsDisclosed.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorsDisclosed = function () { + this.vendorsDisclosed.empty(); + }, t.prototype.setAllVendorsAllowed = function () { + this.vendorsAllowed.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorsAllowed = function () { + this.vendorsAllowed.empty(); + }, t.prototype.setAllVendorLegitimateInterests = function () { + this.vendorLegitimateInterests.set(this.gvl.vendors); + }, t.prototype.unsetAllVendorLegitimateInterests = function () { + this.vendorLegitimateInterests.empty(); + }, t.prototype.setAllPurposeConsents = function () { + this.purposeConsents.set(this.gvl.purposes); + }, t.prototype.unsetAllPurposeConsents = function () { + this.purposeConsents.empty(); + }, t.prototype.setAllPurposeLegitimateInterests = function () { + this.purposeLegitimateInterests.set(this.gvl.purposes); + }, t.prototype.unsetAllPurposeLegitimateInterests = function () { + this.purposeLegitimateInterests.empty(); + }, t.prototype.setAllSpecialFeatureOptins = function () { + this.specialFeatureOptins.set(this.gvl.specialFeatures); + }, t.prototype.unsetAllSpecialFeatureOptins = function () { + this.specialFeatureOptins.empty(); + }, t.prototype.setAll = function () { + this.setAllVendorConsents(), this.setAllPurposeLegitimateInterests(), this.setAllSpecialFeatureOptins(), this.setAllPurposeConsents(), this.setAllVendorLegitimateInterests(); + }, t.prototype.unsetAll = function () { + this.unsetAllVendorConsents(), this.unsetAllPurposeLegitimateInterests(), this.unsetAllSpecialFeatureOptins(), this.unsetAllPurposeConsents(), this.unsetAllVendorLegitimateInterests(); + }, Object.defineProperty(t.prototype, 'numCustomPurposes', { + get: function () { + var e = this.numCustomPurposes_; + if ('object' == typeof this.customPurposes) { + var t = Object.keys(this.customPurposes).sort(function (e, t) { + return +e - +t; + }); + e = parseInt(t.pop(), 10); + } + return e; + }, + set: function (e) { + if (this.numCustomPurposes_ = parseInt(e, 10), this.numCustomPurposes_ < 0) + throw new i.TCModelError('numCustomPurposes', e); + }, + enumerable: !0, + configurable: !0 + }), t.prototype.updated = function () { + this.lastUpdated = new Date(); + }, t.consentLanguages = a.GVL.consentLanguages, t; + }(o.Cloneable); + t.TCModel = c; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + var t, n = e.Symbol; + return 'function' === typeof n ? n.observable ? t = n.observable : (t = n('observable'), n.observable = t) : t = '@@observable', t; + } + n.d(t, 'a', function () { + return r; + }); + }, + function (e, t, n) { + e.exports = function () { + 'use strict'; + return function (e) { + function t(t) { + if (t) + try { + e(t + '}'); + } catch (n) { + } + } + return function (n, r, o, i, a, s, c, u, l, f) { + switch (n) { + case 1: + if (0 === l && 64 === r.charCodeAt(0)) + return e(r + ';'), ''; + break; + case 2: + if (0 === u) + return r + '/*|*/'; + break; + case 3: + switch (u) { + case 102: + case 112: + return e(o[0] + r), ''; + default: + return r + (0 === f ? '/*|*/' : ''); + } + case -2: + r.split('/*|*/}').forEach(t); + } + }; + }; + }(); + }, + function (e, t, n) { + 'use strict'; + t.a = { + animationIterationCount: 1, + borderImageOutset: 1, + borderImageSlice: 1, + borderImageWidth: 1, + boxFlex: 1, + boxFlexGroup: 1, + boxOrdinalGroup: 1, + columnCount: 1, + columns: 1, + flex: 1, + flexGrow: 1, + flexPositive: 1, + flexShrink: 1, + flexNegative: 1, + flexOrder: 1, + gridRow: 1, + gridRowEnd: 1, + gridRowSpan: 1, + gridRowStart: 1, + gridColumn: 1, + gridColumnEnd: 1, + gridColumnSpan: 1, + gridColumnStart: 1, + msGridRow: 1, + msGridRowSpan: 1, + msGridColumn: 1, + msGridColumnSpan: 1, + fontWeight: 1, + lineHeight: 1, + opacity: 1, + order: 1, + orphans: 1, + tabSize: 1, + widows: 1, + zIndex: 1, + zoom: 1, + WebkitLineClamp: 1, + fillOpacity: 1, + floodOpacity: 1, + stopOpacity: 1, + strokeDasharray: 1, + strokeDashoffset: 1, + strokeMiterlimit: 1, + strokeOpacity: 1, + strokeWidth: 1 + }; + }, + function (e, t, n) { + 'use strict'; + var r = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/, o = function (e) { + var t = {}; + return function (n) { + return void 0 === t[n] && (t[n] = e(n)), t[n]; + }; + }(function (e) { + return r.test(e) || 111 === e.charCodeAt(0) && 110 === e.charCodeAt(1) && e.charCodeAt(2) < 91; + }); + t.a = o; + }, + function (e, t, n) { + 'use strict'; + function r(e) { + return Object.prototype.toString.call(e).slice(8, -1); + } + function o(e) { + return 'Object' === r(e) && (e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype); + } + function i(e) { + return 'Array' === r(e); + } + function a(e) { + return 'Symbol' === r(e); + } + function s() { + for (var e = 0, t = 0, n = arguments.length; t < n; t++) + e += arguments[t].length; + var r = Array(e), o = 0; + for (t = 0; t < n; t++) + for (var i = arguments[t], a = 0, s = i.length; a < s; a++, o++) + r[o] = i[a]; + return r; + } + function c(e, t, n, r) { + var o = r.propertyIsEnumerable(t) ? 'enumerable' : 'nonenumerable'; + 'enumerable' === o && (e[t] = n), 'nonenumerable' === o && Object.defineProperty(e, t, { + value: n, + enumerable: !1, + writable: !0, + configurable: !0 + }); + } + function u(e, t, n) { + if (!o(t)) + return n && i(n) && n.forEach(function (n) { + t = n(e, t); + }), t; + var r = {}; + o(e) && (r = s(Object.getOwnPropertyNames(e), Object.getOwnPropertySymbols(e)).reduce(function (n, r) { + var o = e[r]; + return (!a(r) && !Object.getOwnPropertyNames(t).includes(r) || a(r) && !Object.getOwnPropertySymbols(t).includes(r)) && c(n, r, o, e), n; + }, {})); + return s(Object.getOwnPropertyNames(t), Object.getOwnPropertySymbols(t)).reduce(function (r, a) { + var s = t[a], l = o(e) ? e[a] : void 0; + return n && i(n) && n.forEach(function (e) { + s = e(l, s); + }), void 0 !== l && o(s) && (s = u(l, s, n)), c(r, a, s, t), r; + }, r); + } + t.a = function (e) { + for (var t = [], n = 1; n < arguments.length; n++) + t[n - 1] = arguments[n]; + var r = null, i = e; + return o(e) && e.extensions && 1 === Object.keys(e).length && (i = {}, r = e.extensions), t.reduce(function (e, t) { + return u(e, t, r); + }, i); + }; + }, + function (e, t, n) { + n(153), e.exports = n(299); + }, + function (e, t, n) { + 'use strict'; + n.r(t); + n(154), n(160), n(161), n(162), n(163), n(164), n(165), n(166), n(167), n(168), n(169), n(170), n(171), n(172), n(173), n(175), n(176), n(178), n(181), n(182), n(183), n(184), n(190), n(191), n(193), n(194), n(196), n(197), n(200), n(201), n(202), n(204), n(206), n(208), n(209), n(211), n(212), n(213), n(214), n(215), n(216), n(217), n(218), n(220), n(221), n(222), n(223), n(224), n(225), n(226), n(227), n(228), n(229), n(231), n(233), n(234), n(236), n(237), n(238), n(239), n(240), n(241), n(242), n(243), n(244), n(245), n(246), n(247), n(248), n(249), n(250), n(251), n(252), n(253), n(254), n(255), n(256); + void 0 === function () { + return arguments[Symbol.iterator]; + }() && Object.defineProperty && Object.defineProperty(Object.prototype, Symbol.iterator, { + get: function () { + return '[object Arguments]' === [].toString.call(this) ? [][Symbol.iterator] : this.__Symbol_iterator; + }, + set: function (e) { + Object.defineProperty(this, '__Symbol_iterator', { + configurable: !0, + value: e, + writable: !0 + }); + } + }), Number.isInteger = Number.isInteger || function (e) { + return 'number' === typeof e && isFinite(e) && Math.floor(e) === e; + }, Number.isNaN = Number.isNaN || function (e) { + return 'number' === typeof e && e !== e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(7), i = n(10), a = n(4), s = n(18), c = n(65), u = n(91), l = n(12), f = n(14), p = n(48), d = n(13), h = n(3), m = n(26), g = n(25), v = n(45), y = n(31), b = n(40), E = n(49), w = n(61), x = n(159), S = n(63), C = n(36), k = n(19), T = n(44), _ = n(22), P = n(23), O = n(60), I = n(46), L = n(38), A = n(47), R = n(8), N = n(93), j = n(11), q = n(27), F = n(33), D = n(94).forEach, M = I('hidden'), U = R('toPrimitive'), V = F.set, B = F.getterFor('Symbol'), z = Object.prototype, G = o.Symbol, H = i('JSON', 'stringify'), W = C.f, $ = k.f, Y = x.f, Q = T.f, K = O('symbols'), J = O('op-symbols'), X = O('string-to-symbol-registry'), Z = O('symbol-to-string-registry'), ee = O('wks'), te = o.QObject, ne = !te || !te.prototype || !te.prototype.findChild, re = s && l(function () { + return 7 != b($({}, 'a', { + get: function () { + return $(this, 'a', { value: 7 }).a; + } + })).a; + }) ? function (e, t, n) { + var r = W(z, t); + r && delete z[t], $(e, t, n), r && e !== z && $(z, t, r); + } : $, oe = function (e, t) { + var n = K[e] = b(G.prototype); + return V(n, { + type: 'Symbol', + tag: e, + description: t + }), s || (n.description = t), n; + }, ie = u ? function (e) { + return 'symbol' == typeof e; + } : function (e) { + return Object(e) instanceof G; + }, ae = function (e, t, n) { + e === z && ae(J, t, n), h(e); + var r = v(t, !0); + return h(n), f(K, r) ? (n.enumerable ? (f(e, M) && e[M][r] && (e[M][r] = !1), n = b(n, { enumerable: y(0, !1) })) : (f(e, M) || $(e, M, y(1, {})), e[M][r] = !0), re(e, r, n)) : $(e, r, n); + }, se = function (e, t) { + h(e); + var n = g(t), r = E(n).concat(fe(n)); + return D(r, function (t) { + s && !ce.call(n, t) || ae(e, t, n[t]); + }), e; + }, ce = function (e) { + var t = v(e, !0), n = Q.call(this, t); + return !(this === z && f(K, t) && !f(J, t)) && (!(n || !f(this, t) || !f(K, t) || f(this, M) && this[M][t]) || n); + }, ue = function (e, t) { + var n = g(e), r = v(t, !0); + if (n !== z || !f(K, r) || f(J, r)) { + var o = W(n, r); + return !o || !f(K, r) || f(n, M) && n[M][r] || (o.enumerable = !0), o; + } + }, le = function (e) { + var t = Y(g(e)), n = []; + return D(t, function (e) { + f(K, e) || f(L, e) || n.push(e); + }), n; + }, fe = function (e) { + var t = e === z, n = Y(t ? J : g(e)), r = []; + return D(n, function (e) { + !f(K, e) || t && !f(z, e) || r.push(K[e]); + }), r; + }; + (c || (P((G = function () { + if (this instanceof G) + throw TypeError('Symbol is not a constructor'); + var e = arguments.length && void 0 !== arguments[0] ? String(arguments[0]) : void 0, t = A(e), n = function e(n) { + this === z && e.call(J, n), f(this, M) && f(this[M], t) && (this[M][t] = !1), re(this, t, y(1, n)); + }; + return s && ne && re(z, t, { + configurable: !0, + set: n + }), oe(t, e); + }).prototype, 'toString', function () { + return B(this).tag; + }), P(G, 'withoutSetter', function (e) { + return oe(A(e), e); + }), T.f = ce, k.f = ae, C.f = ue, w.f = x.f = le, S.f = fe, N.f = function (e) { + return oe(R(e), e); + }, s && ($(G.prototype, 'description', { + configurable: !0, + get: function () { + return B(this).description; + } + }), a || P(z, 'propertyIsEnumerable', ce, { unsafe: !0 }))), r({ + global: !0, + wrap: !0, + forced: !c, + sham: !c + }, { Symbol: G }), D(E(ee), function (e) { + j(e); + }), r({ + target: 'Symbol', + stat: !0, + forced: !c + }, { + for: function (e) { + var t = String(e); + if (f(X, t)) + return X[t]; + var n = G(t); + return X[t] = n, Z[n] = t, n; + }, + keyFor: function (e) { + if (!ie(e)) + throw TypeError(e + ' is not a symbol'); + if (f(Z, e)) + return Z[e]; + }, + useSetter: function () { + ne = !0; + }, + useSimple: function () { + ne = !1; + } + }), r({ + target: 'Object', + stat: !0, + forced: !c, + sham: !s + }, { + create: function (e, t) { + return void 0 === t ? b(e) : se(b(e), t); + }, + defineProperty: ae, + defineProperties: se, + getOwnPropertyDescriptor: ue + }), r({ + target: 'Object', + stat: !0, + forced: !c + }, { + getOwnPropertyNames: le, + getOwnPropertySymbols: fe + }), r({ + target: 'Object', + stat: !0, + forced: l(function () { + S.f(1); + }) + }, { + getOwnPropertySymbols: function (e) { + return S.f(m(e)); + } + }), H) && r({ + target: 'JSON', + stat: !0, + forced: !c || l(function () { + var e = G(); + return '[null]' != H([e]) || '{}' != H({ a: e }) || '{}' != H(Object(e)); + }) + }, { + stringify: function (e, t, n) { + for (var r, o = [e], i = 1; arguments.length > i;) + o.push(arguments[i++]); + if (r = t, (d(t) || void 0 !== e) && !ie(e)) + return p(t) || (t = function (e, t) { + if ('function' == typeof r && (t = r.call(this, e, t)), !ie(t)) + return t; + }), o[1] = t, H.apply(null, o); + } + }); + G.prototype[U] || _(G.prototype, U, G.prototype.valueOf), q(G, 'Symbol'), L[M] = !0; + }, + function (e, t, n) { + var r = n(7), o = n(58), i = r.WeakMap; + e.exports = 'function' === typeof i && /native code/.test(o(i)); + }, + function (e, t, n) { + var r = n(10), o = n(61), i = n(63), a = n(3); + e.exports = r('Reflect', 'ownKeys') || function (e) { + var t = o.f(a(e)), n = i.f; + return n ? t.concat(n(e)) : t; + }; + }, + function (e, t, n) { + var r = n(39), o = Math.max, i = Math.min; + e.exports = function (e, t) { + var n = r(e); + return n < 0 ? o(n + t, 0) : i(n, t); + }; + }, + function (e, t, n) { + var r = n(18), o = n(19), i = n(3), a = n(49); + e.exports = r ? Object.defineProperties : function (e, t) { + i(e); + for (var n, r = a(t), s = r.length, c = 0; s > c;) + o.f(e, n = r[c++], t[n]); + return e; + }; + }, + function (e, t, n) { + var r = n(25), o = n(61).f, i = {}.toString, a = 'object' == typeof window && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; + e.exports.f = function (e) { + return a && '[object Window]' == i.call(e) ? function (e) { + try { + return o(e); + } catch (t) { + return a.slice(); + } + }(e) : o(r(e)); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(18), i = n(7), a = n(14), s = n(13), c = n(19).f, u = n(87), l = i.Symbol; + if (o && 'function' == typeof l && (!('description' in l.prototype) || void 0 !== l().description)) { + var f = {}, p = function () { + var e = arguments.length < 1 || void 0 === arguments[0] ? void 0 : String(arguments[0]), t = this instanceof p ? new l(e) : void 0 === e ? l() : l(e); + return '' === e && (f[t] = !0), t; + }; + u(p, l); + var d = p.prototype = l.prototype; + d.constructor = p; + var h = d.toString, m = 'Symbol(test)' == String(l('test')), g = /^Symbol\((.*)\)[^)]+$/; + c(d, 'description', { + configurable: !0, + get: function () { + var e = s(this) ? this.valueOf() : this, t = h.call(e); + if (a(f, e)) + return ''; + var n = m ? t.slice(7, -1) : t.replace(g, '$1'); + return '' === n ? void 0 : n; + } + }), r({ + global: !0, + forced: !0 + }, { Symbol: p }); + } + }, + function (e, t, n) { + n(11)('asyncIterator'); + }, + function (e, t, n) { + n(11)('hasInstance'); + }, + function (e, t, n) { + n(11)('isConcatSpreadable'); + }, + function (e, t, n) { + n(11)('iterator'); + }, + function (e, t, n) { + n(11)('match'); + }, + function (e, t, n) { + n(11)('replace'); + }, + function (e, t, n) { + n(11)('search'); + }, + function (e, t, n) { + n(11)('species'); + }, + function (e, t, n) { + n(11)('split'); + }, + function (e, t, n) { + n(11)('toPrimitive'); + }, + function (e, t, n) { + n(11)('toStringTag'); + }, + function (e, t, n) { + n(11)('unscopables'); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(12), i = n(48), a = n(13), s = n(26), c = n(24), u = n(95), l = n(66), f = n(174), p = n(8), d = n(67), h = p('isConcatSpreadable'), m = d >= 51 || !o(function () { + var e = []; + return e[h] = !1, e.concat()[0] !== e; + }), g = f('concat'), v = function (e) { + if (!a(e)) + return !1; + var t = e[h]; + return void 0 !== t ? !!t : i(e); + }; + r({ + target: 'Array', + proto: !0, + forced: !m || !g + }, { + concat: function (e) { + var t, n, r, o, i, a = s(this), f = l(a, 0), p = 0; + for (t = -1, r = arguments.length; t < r; t++) + if (v(i = -1 === t ? a : arguments[t])) { + if (p + (o = c(i.length)) > 9007199254740991) + throw TypeError('Maximum allowed index exceeded'); + for (n = 0; n < o; n++, p++) + n in i && u(f, p, i[n]); + } else { + if (p >= 9007199254740991) + throw TypeError('Maximum allowed index exceeded'); + u(f, p++, i); + } + return f.length = p, f; + } + }); + }, + function (e, t, n) { + var r = n(12), o = n(8), i = n(67), a = o('species'); + e.exports = function (e) { + return i >= 51 || !r(function () { + var t = []; + return (t.constructor = {})[a] = function () { + return { foo: 1 }; + }, 1 !== t[e](Boolean).foo; + }); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(94).find, i = n(50), a = n(97), s = !0, c = a('find'); + 'find' in [] && Array(1).find(function () { + s = !1; + }), r({ + target: 'Array', + proto: !0, + forced: s || !c + }, { + find: function (e) { + return o(this, e, arguments.length > 1 ? arguments[1] : void 0); + } + }), i('find'); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(177), i = n(26), a = n(24), s = n(39), c = n(66); + r({ + target: 'Array', + proto: !0 + }, { + flat: function () { + var e = arguments.length ? arguments[0] : void 0, t = i(this), n = a(t.length), r = c(t, 0); + return r.length = o(r, t, t, n, 0, void 0 === e ? 1 : s(e)), r; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(48), o = n(24), i = n(9); + e.exports = function e(t, n, a, s, c, u, l, f) { + for (var p, d = c, h = 0, m = !!l && i(l, f, 3); h < s;) { + if (h in a) { + if (p = m ? m(a[h], h, n) : a[h], u > 0 && r(p)) + d = e(t, n, p, o(p.length), d, u - 1) - 1; + else { + if (d >= 9007199254740991) + throw TypeError('Exceed the acceptable array length'); + t[d] = p; + } + d++; + } + h++; + } + return d; + }; + }, + function (e, t, n) { + var r = n(1), o = n(179); + r({ + target: 'Array', + stat: !0, + forced: !n(70)(function (e) { + Array.from(e); + }) + }, { from: o }); + }, + function (e, t, n) { + 'use strict'; + var r = n(9), o = n(26), i = n(180), a = n(99), s = n(24), c = n(95), u = n(68); + e.exports = function (e) { + var t, n, l, f, p, d, h = o(e), m = 'function' == typeof this ? this : Array, g = arguments.length, v = g > 1 ? arguments[1] : void 0, y = void 0 !== v, b = u(h), E = 0; + if (y && (v = r(v, g > 2 ? arguments[2] : void 0, 2)), void 0 == b || m == Array && a(b)) + for (n = new m(t = s(h.length)); t > E; E++) + d = y ? v(h[E], E) : h[E], c(n, E, d); + else + for (p = (f = b.call(h)).next, n = new m(); !(l = p.call(f)).done; E++) + d = y ? i(f, v, [ + l.value, + E + ], !0) : l.value, c(n, E, d); + return n.length = E, n; + }; + }, + function (e, t, n) { + var r = n(3), o = n(98); + e.exports = function (e, t, n, i) { + try { + return i ? t(r(n)[0], n[1]) : t(n); + } catch (a) { + throw o(e), a; + } + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(90).includes, i = n(50); + r({ + target: 'Array', + proto: !0, + forced: !n(97)('indexOf', { + ACCESSORS: !0, + 1: 0 + }) + }, { + includes: function (e) { + return o(this, e, arguments.length > 1 ? arguments[1] : void 0); + } + }), i('includes'); + }, + function (e, t, n) { + n(50)('flat'); + }, + function (e, t, n) { + var r = n(7); + n(27)(r.JSON, 'JSON', !0); + }, + function (e, t, n) { + 'use strict'; + var r = n(101), o = n(103); + e.exports = r('Map', function (e) { + return function () { + return e(this, arguments.length ? arguments[0] : void 0); + }; + }, o); + }, + function (e, t, n) { + var r = n(12); + e.exports = !r(function () { + return Object.isExtensible(Object.preventExtensions({})); + }); + }, + function (e, t, n) { + var r = n(13), o = n(72); + e.exports = function (e, t, n) { + var i, a; + return o && 'function' == typeof (i = t.constructor) && i !== n && r(a = i.prototype) && a !== n.prototype && o(e, a), e; + }; + }, + function (e, t, n) { + var r = n(13); + e.exports = function (e) { + if (!r(e) && null !== e) + throw TypeError('Can\'t set ' + String(e) + ' as a prototype'); + return e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(105).IteratorPrototype, o = n(40), i = n(31), a = n(27), s = n(41), c = function () { + return this; + }; + e.exports = function (e, t, n) { + var u = t + ' Iterator'; + return e.prototype = o(r, { next: i(1, n) }), a(e, u, !1, !0), s[u] = c, e; + }; + }, + function (e, t, n) { + var r = n(12); + e.exports = !r(function () { + function e() { + } + return e.prototype.constructor = null, Object.getPrototypeOf(new e()) !== e.prototype; + }); + }, + function (e, t, n) { + n(27)(Math, 'Math', !0); + }, + function (e, t, n) { + var r = n(1), o = n(192); + r({ + target: 'Object', + stat: !0, + forced: Object.assign !== o + }, { assign: o }); + }, + function (e, t, n) { + 'use strict'; + var r = n(18), o = n(12), i = n(49), a = n(63), s = n(44), c = n(26), u = n(55), l = Object.assign, f = Object.defineProperty; + e.exports = !l || o(function () { + if (r && 1 !== l({ b: 1 }, l(f({}, 'a', { + enumerable: !0, + get: function () { + f(this, 'b', { + value: 3, + enumerable: !1 + }); + } + }), { b: 2 })).b) + return !0; + var e = {}, t = {}, n = Symbol(); + return e[n] = 7, 'abcdefghijklmnopqrst'.split('').forEach(function (e) { + t[e] = e; + }), 7 != l({}, e)[n] || 'abcdefghijklmnopqrst' != i(l({}, t)).join(''); + }) ? function (e, t) { + for (var n = c(e), o = arguments.length, l = 1, f = a.f, p = s.f; o > l;) + for (var d, h = u(arguments[l++]), m = f ? i(h).concat(f(h)) : i(h), g = m.length, v = 0; g > v;) + d = m[v++], r && !p.call(h, d) || (n[d] = h[d]); + return n; + } : l; + }, + function (e, t, n) { + var r = n(1), o = n(107).entries; + r({ + target: 'Object', + stat: !0 + }, { + entries: function (e) { + return o(e); + } + }); + }, + function (e, t, n) { + var r = n(69), o = n(23), i = n(195); + r || o(Object.prototype, 'toString', i, { unsafe: !0 }); + }, + function (e, t, n) { + 'use strict'; + var r = n(69), o = n(100); + e.exports = r ? {}.toString : function () { + return '[object ' + o(this) + ']'; + }; + }, + function (e, t, n) { + var r = n(1), o = n(107).values; + r({ + target: 'Object', + stat: !0 + }, { + values: function (e) { + return o(e); + } + }); + }, + function (e, t, n) { + 'use strict'; + var r, o, i, a, s = n(1), c = n(4), u = n(7), l = n(10), f = n(108), p = n(23), d = n(104), h = n(27), m = n(106), g = n(13), v = n(6), y = n(71), b = n(58), E = n(5), w = n(70), x = n(20), S = n(109).set, C = n(198), k = n(111), T = n(199), _ = n(42), P = n(51), O = n(33), I = n(64), L = n(8), A = n(75), R = n(67), N = L('species'), j = 'Promise', q = O.get, F = O.set, D = O.getterFor(j), M = f, U = u.TypeError, V = u.document, B = u.process, z = l('fetch'), G = _.f, H = G, W = !!(V && V.createEvent && u.dispatchEvent), $ = 'function' == typeof PromiseRejectionEvent, Y = I(j, function () { + if (!(b(M) !== String(M))) { + if (66 === R) + return !0; + if (!A && !$) + return !0; + } + if (c && !M.prototype.finally) + return !0; + if (R >= 51 && /native code/.test(M)) + return !1; + var e = M.resolve(1), t = function (e) { + e(function () { + }, function () { + }); + }; + return (e.constructor = {})[N] = t, !(e.then(function () { + }) instanceof t); + }), Q = Y || !w(function (e) { + M.all(e).catch(function () { + }); + }), K = function (e) { + var t; + return !(!g(e) || 'function' != typeof (t = e.then)) && t; + }, J = function (e, t) { + if (!e.notified) { + e.notified = !0; + var n = e.reactions; + C(function () { + for (var r = e.value, o = 1 == e.state, i = 0; n.length > i;) { + var a, s, c, u = n[i++], l = o ? u.ok : u.fail, f = u.resolve, p = u.reject, d = u.domain; + try { + l ? (o || (2 === e.rejection && te(e), e.rejection = 1), !0 === l ? a = r : (d && d.enter(), a = l(r), d && (d.exit(), c = !0)), a === u.promise ? p(U('Promise-chain cycle')) : (s = K(a)) ? s.call(a, f, p) : f(a)) : p(r); + } catch (h) { + d && !c && d.exit(), p(h); + } + } + e.reactions = [], e.notified = !1, t && !e.rejection && Z(e); + }); + } + }, X = function (e, t, n) { + var r, o; + W ? ((r = V.createEvent('Event')).promise = t, r.reason = n, r.initEvent(e, !1, !0), u.dispatchEvent(r)) : r = { + promise: t, + reason: n + }, !$ && (o = u['on' + e]) ? o(r) : 'unhandledrejection' === e && T('Unhandled promise rejection', n); + }, Z = function (e) { + S.call(u, function () { + var t, n = e.facade, r = e.value; + if (ee(e) && (t = P(function () { + A ? B.emit('unhandledRejection', r, n) : X('unhandledrejection', n, r); + }), e.rejection = A || ee(e) ? 2 : 1, t.error)) + throw t.value; + }); + }, ee = function (e) { + return 1 !== e.rejection && !e.parent; + }, te = function (e) { + S.call(u, function () { + var t = e.facade; + A ? B.emit('rejectionHandled', t) : X('rejectionhandled', t, e.value); + }); + }, ne = function (e, t, n) { + return function (r) { + e(t, r, n); + }; + }, re = function (e, t, n) { + e.done || (e.done = !0, n && (e = n), e.value = t, e.state = 2, J(e, !0)); + }, oe = function e(t, n, r) { + if (!t.done) { + t.done = !0, r && (t = r); + try { + if (t.facade === n) + throw U('Promise can\'t be resolved itself'); + var o = K(n); + o ? C(function () { + var r = { done: !1 }; + try { + o.call(n, ne(e, r, t), ne(re, r, t)); + } catch (i) { + re(r, i, t); + } + }) : (t.value = n, t.state = 1, J(t, !1)); + } catch (i) { + re({ done: !1 }, i, t); + } + } + }; + Y && (M = function (e) { + y(this, M, j), v(e), r.call(this); + var t = q(this); + try { + e(ne(oe, t), ne(re, t)); + } catch (n) { + re(t, n); + } + }, (r = function (e) { + F(this, { + type: j, + done: !1, + notified: !1, + parent: !1, + reactions: [], + rejection: !1, + state: 0, + value: void 0 + }); + }).prototype = d(M.prototype, { + then: function (e, t) { + var n = D(this), r = G(x(this, M)); + return r.ok = 'function' != typeof e || e, r.fail = 'function' == typeof t && t, r.domain = A ? B.domain : void 0, n.parent = !0, n.reactions.push(r), 0 != n.state && J(n, !1), r.promise; + }, + catch: function (e) { + return this.then(void 0, e); + } + }), o = function () { + var e = new r(), t = q(e); + this.promise = e, this.resolve = ne(oe, t), this.reject = ne(re, t); + }, _.f = G = function (e) { + return e === M || e === i ? new o(e) : H(e); + }, c || 'function' != typeof f || (a = f.prototype.then, p(f.prototype, 'then', function (e, t) { + var n = this; + return new M(function (e, t) { + a.call(n, e, t); + }).then(e, t); + }, { unsafe: !0 }), 'function' == typeof z && s({ + global: !0, + enumerable: !0, + forced: !0 + }, { + fetch: function (e) { + return k(M, z.apply(u, arguments)); + } + }))), s({ + global: !0, + wrap: !0, + forced: Y + }, { Promise: M }), h(M, j, !1, !0), m(j), i = l(j), s({ + target: j, + stat: !0, + forced: Y + }, { + reject: function (e) { + var t = G(this); + return t.reject.call(void 0, e), t.promise; + } + }), s({ + target: j, + stat: !0, + forced: c || Y + }, { + resolve: function (e) { + return k(c && this === i ? M : this, e); + } + }), s({ + target: j, + stat: !0, + forced: Q + }, { + all: function (e) { + var t = this, n = G(t), r = n.resolve, o = n.reject, i = P(function () { + var n = v(t.resolve), i = [], a = 0, s = 1; + E(e, function (e) { + var c = a++, u = !1; + i.push(void 0), s++, n.call(t, e).then(function (e) { + u || (u = !0, i[c] = e, --s || r(i)); + }, o); + }), --s || r(i); + }); + return i.error && o(i.value), n.promise; + }, + race: function (e) { + var t = this, n = G(t), r = n.reject, o = P(function () { + var o = v(t.resolve); + E(e, function (e) { + o.call(t, e).then(n.resolve, r); + }); + }); + return o.error && r(o.value), n.promise; + } + }); + }, + function (e, t, n) { + var r, o, i, a, s, c, u, l, f = n(7), p = n(36).f, d = n(109).set, h = n(110), m = n(75), g = f.MutationObserver || f.WebKitMutationObserver, v = f.document, y = f.process, b = f.Promise, E = p(f, 'queueMicrotask'), w = E && E.value; + w || (r = function () { + var e, t; + for (m && (e = y.domain) && e.exit(); o;) { + t = o.fn, o = o.next; + try { + t(); + } catch (n) { + throw o ? a() : i = void 0, n; + } + } + i = void 0, e && e.enter(); + }, !h && !m && g && v ? (s = !0, c = v.createTextNode(''), new g(r).observe(c, { characterData: !0 }), a = function () { + c.data = s = !s; + }) : b && b.resolve ? (u = b.resolve(void 0), l = u.then, a = function () { + l.call(u, r); + }) : a = m ? function () { + y.nextTick(r); + } : function () { + d.call(f, r); + }), e.exports = w || function (e) { + var t = { + fn: e, + next: void 0 + }; + i && (i.next = t), o || (o = t, a()), i = t; + }; + }, + function (e, t, n) { + var r = n(7); + e.exports = function (e, t) { + var n = r.console; + n && n.error && (1 === arguments.length ? n.error(e) : n.error(e, t)); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(108), a = n(12), s = n(10), c = n(20), u = n(111), l = n(23); + r({ + target: 'Promise', + proto: !0, + real: !0, + forced: !!i && a(function () { + i.prototype.finally.call({ + then: function () { + } + }, function () { + }); + }) + }, { + finally: function (e) { + var t = c(this, s('Promise')), n = 'function' == typeof e; + return this.then(n ? function (n) { + return u(t, e()).then(function () { + return n; + }); + } : e, n ? function (n) { + return u(t, e()).then(function () { + throw n; + }); + } : e); + } + }), o || 'function' != typeof i || i.prototype.finally || l(i.prototype, 'finally', s('Promise').prototype.finally); + }, + function (e, t, n) { + 'use strict'; + var r = n(101), o = n(103); + e.exports = r('Set', function (e) { + return function () { + return e(this, arguments.length ? arguments[0] : void 0); + }; + }, o); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(112), i = n(32); + r({ + target: 'String', + proto: !0, + forced: !n(113)('includes') + }, { + includes: function (e) { + return !!~String(i(this)).indexOf(o(e), arguments.length > 1 ? arguments[1] : void 0); + } + }); + }, + function (e, t, n) { + var r = n(13), o = n(37), i = n(8)('match'); + e.exports = function (e) { + var t; + return r(e) && (void 0 !== (t = e[i]) ? !!t : 'RegExp' == o(e)); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(205).charAt, o = n(33), i = n(73), a = o.set, s = o.getterFor('String Iterator'); + i(String, 'String', function (e) { + a(this, { + type: 'String Iterator', + string: String(e), + index: 0 + }); + }, function () { + var e, t = s(this), n = t.string, o = t.index; + return o >= n.length ? { + value: void 0, + done: !0 + } : (e = r(n, o), t.index += e.length, { + value: e, + done: !1 + }); + }); + }, + function (e, t, n) { + var r = n(39), o = n(32), i = function (e) { + return function (t, n) { + var i, a, s = String(o(t)), c = r(n), u = s.length; + return c < 0 || c >= u ? e ? '' : void 0 : (i = s.charCodeAt(c)) < 55296 || i > 56319 || c + 1 === u || (a = s.charCodeAt(c + 1)) < 56320 || a > 57343 ? e ? s.charAt(c) : i : e ? s.slice(c, c + 2) : a - 56320 + (i - 55296 << 10) + 65536; + }; + }; + e.exports = { + codeAt: i(!1), + charAt: i(!0) + }; + }, + function (e, t, n) { + n(1)({ + target: 'String', + proto: !0 + }, { repeat: n(207) }); + }, + function (e, t, n) { + 'use strict'; + var r = n(39), o = n(32); + e.exports = ''.repeat || function (e) { + var t = String(o(this)), n = '', i = r(e); + if (i < 0 || i == 1 / 0) + throw RangeError('Wrong number of repetitions'); + for (; i > 0; (i >>>= 1) && (t += t)) + 1 & i && (n += t); + return n; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(36).f, i = n(24), a = n(112), s = n(32), c = n(113), u = n(4), l = ''.startsWith, f = Math.min, p = c('startsWith'); + r({ + target: 'String', + proto: !0, + forced: !(!u && !p && !!function () { + var e = o(String.prototype, 'startsWith'); + return e && !e.writable; + }()) && !p + }, { + startsWith: function (e) { + var t = String(s(this)); + a(e); + var n = i(f(arguments.length > 1 ? arguments[1] : void 0, t.length)), r = String(e); + return l ? l.call(t, r, n) : t.slice(n, n + r.length) === r; + } + }); + }, + function (e, t, n) { + n(210); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(74), i = n(72), a = n(40), s = n(22), c = n(31), u = n(5), l = function (e, t) { + var n = this; + if (!(n instanceof l)) + return new l(e, t); + i && (n = i(new Error(void 0), o(n))), void 0 !== t && s(n, 'message', String(t)); + var r = []; + return u(e, r.push, { that: r }), s(n, 'errors', r), n; + }; + l.prototype = a(Error.prototype, { + constructor: c(5, l), + message: c(5, ''), + name: c(5, 'AggregateError') + }), r({ global: !0 }, { AggregateError: l }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(114); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + deleteAll: function () { + return i.apply(this, arguments); + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(9), s = n(21), c = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + every: function (e) { + var t = i(this), n = s(t), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return !c(n, function (e, n, o) { + if (!r(n, e, t)) + return o(); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(10), a = n(3), s = n(6), c = n(9), u = n(20), l = n(21), f = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + filter: function (e) { + var t = a(this), n = l(t), r = c(e, arguments.length > 1 ? arguments[1] : void 0, 3), o = new (u(t, i('Map')))(), p = s(o.set); + return f(n, function (e, n) { + r(n, e, t) && p.call(o, e, n); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0 + }), o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(9), s = n(21), c = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + find: function (e) { + var t = i(this), n = s(t), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return c(n, function (e, n, o) { + if (r(n, e, t)) + return o(n); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).result; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(9), s = n(21), c = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + findKey: function (e) { + var t = i(this), n = s(t), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return c(n, function (e, n, o) { + if (r(n, e, t)) + return o(e); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).result; + } + }); + }, + function (e, t, n) { + n(1)({ + target: 'Map', + stat: !0 + }, { from: n(115) }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(5), i = n(6); + r({ + target: 'Map', + stat: !0 + }, { + groupBy: function (e, t) { + var n = new this(); + i(t); + var r = i(n.has), a = i(n.get), s = i(n.set); + return o(e, function (e) { + var o = t(e); + r.call(n, o) ? a.call(n, o).push(e) : s.call(n, o, [e]); + }), n; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(21), s = n(219), c = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + includes: function (e) { + return c(a(i(this)), function (t, n, r) { + if (s(n, e)) + return r(); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t) { + e.exports = function (e, t) { + return e === t || e != e && t != t; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(5), i = n(6); + r({ + target: 'Map', + stat: !0 + }, { + keyBy: function (e, t) { + var n = new this(); + i(t); + var r = i(n.set); + return o(e, function (e) { + r.call(n, t(e), e); + }), n; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(21), s = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + keyOf: function (e) { + return s(a(i(this)), function (t, n, r) { + if (n === e) + return r(t); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).result; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(10), a = n(3), s = n(6), c = n(9), u = n(20), l = n(21), f = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + mapKeys: function (e) { + var t = a(this), n = l(t), r = c(e, arguments.length > 1 ? arguments[1] : void 0, 3), o = new (u(t, i('Map')))(), p = s(o.set); + return f(n, function (e, n) { + p.call(o, r(n, e, t), n); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0 + }), o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(10), a = n(3), s = n(6), c = n(9), u = n(20), l = n(21), f = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + mapValues: function (e) { + var t = a(this), n = l(t), r = c(e, arguments.length > 1 ? arguments[1] : void 0, 3), o = new (u(t, i('Map')))(), p = s(o.set); + return f(n, function (e, n) { + p.call(o, e, r(n, e, t)); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0 + }), o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(6), s = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + merge: function (e) { + for (var t = i(this), n = a(t.set), r = 0; r < arguments.length;) + s(arguments[r++], n, { + that: t, + AS_ENTRIES: !0 + }); + return t; + } + }); + }, + function (e, t, n) { + n(1)({ + target: 'Map', + stat: !0 + }, { of: n(116) }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(6), s = n(21), c = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + reduce: function (e) { + var t = i(this), n = s(t), r = arguments.length < 2, o = r ? void 0 : arguments[1]; + if (a(e), c(n, function (n, i) { + r ? (r = !1, o = i) : o = e(o, i, n, t); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0 + }), r) + throw TypeError('Reduce of empty map with no initial value'); + return o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(9), s = n(21), c = n(5); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + some: function (e) { + var t = i(this), n = s(t), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return c(n, function (e, n, o) { + if (r(n, e, t)) + return o(); + }, { + AS_ENTRIES: !0, + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(6); + r({ + target: 'Map', + proto: !0, + real: !0, + forced: o + }, { + update: function (e, t) { + var n = i(this), r = arguments.length; + a(t); + var o = n.has(e); + if (!o && r < 3) + throw TypeError('Updating absent value'); + var s = o ? n.get(e) : a(r > 2 ? arguments[2] : void 0)(e, n); + return n.set(e, t(s, e, n)), n; + } + }); + }, + function (e, t, n) { + n(230); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(6), i = n(42), a = n(51), s = n(5); + r({ + target: 'Promise', + stat: !0 + }, { + allSettled: function (e) { + var t = this, n = i.f(t), r = n.resolve, c = n.reject, u = a(function () { + var n = o(t.resolve), i = [], a = 0, c = 1; + s(e, function (e) { + var o = a++, s = !1; + i.push(void 0), c++, n.call(t, e).then(function (e) { + s || (s = !0, i[o] = { + status: 'fulfilled', + value: e + }, --c || r(i)); + }, function (e) { + s || (s = !0, i[o] = { + status: 'rejected', + reason: e + }, --c || r(i)); + }); + }), --c || r(i); + }); + return u.error && c(u.value), n.promise; + } + }); + }, + function (e, t, n) { + n(232); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(6), i = n(10), a = n(42), s = n(51), c = n(5); + r({ + target: 'Promise', + stat: !0 + }, { + any: function (e) { + var t = this, n = a.f(t), r = n.resolve, u = n.reject, l = s(function () { + var n = o(t.resolve), a = [], s = 0, l = 1, f = !1; + c(e, function (e) { + var o = s++, c = !1; + a.push(void 0), l++, n.call(t, e).then(function (e) { + c || f || (f = !0, r(e)); + }, function (e) { + c || f || (c = !0, a[o] = e, --l || u(new (i('AggregateError'))(a, 'No one promise resolved'))); + }); + }), --l || u(new (i('AggregateError'))(a, 'No one promise resolved')); + }); + return l.error && u(l.value), n.promise; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(42), i = n(51); + r({ + target: 'Promise', + stat: !0 + }, { + try: function (e) { + var t = o.f(this), n = i(e); + return (n.error ? t.reject : t.resolve)(n.value), t.promise; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(235); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + addAll: function () { + return i.apply(this, arguments); + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(3), o = n(6); + e.exports = function () { + for (var e = r(this), t = o(e.add), n = 0, i = arguments.length; n < i; n++) + t.call(e, arguments[n]); + return e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(114); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + deleteAll: function () { + return i.apply(this, arguments); + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(10), a = n(3), s = n(6), c = n(20), u = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + difference: function (e) { + var t = a(this), n = new (c(t, i('Set')))(t), r = s(n.delete); + return u(e, function (e) { + r.call(n, e); + }), n; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(9), s = n(28), c = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + every: function (e) { + var t = i(this), n = s(t), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return !c(n, function (e, n) { + if (!r(e, e, t)) + return n(); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(10), a = n(3), s = n(6), c = n(9), u = n(20), l = n(28), f = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + filter: function (e) { + var t = a(this), n = l(t), r = c(e, arguments.length > 1 ? arguments[1] : void 0, 3), o = new (u(t, i('Set')))(), p = s(o.add); + return f(n, function (e) { + r(e, e, t) && p.call(o, e); + }, { IS_ITERATOR: !0 }), o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(9), s = n(28), c = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + find: function (e) { + var t = i(this), n = s(t), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return c(n, function (e, n) { + if (r(e, e, t)) + return n(e); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).result; + } + }); + }, + function (e, t, n) { + n(1)({ + target: 'Set', + stat: !0 + }, { from: n(115) }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(10), a = n(3), s = n(6), c = n(20), u = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + intersection: function (e) { + var t = a(this), n = new (c(t, i('Set')))(), r = s(t.has), o = s(n.add); + return u(e, function (e) { + r.call(t, e) && o.call(n, e); + }), n; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(6), s = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + isDisjointFrom: function (e) { + var t = i(this), n = a(t.has); + return !s(e, function (e, r) { + if (!0 === n.call(t, e)) + return r(); + }, { INTERRUPTED: !0 }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(10), a = n(3), s = n(6), c = n(76), u = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + isSubsetOf: function (e) { + var t = c(this), n = a(e), r = n.has; + return 'function' != typeof r && (n = new (i('Set'))(e), r = s(n.has)), !u(t, function (e, t) { + if (!1 === r.call(n, e)) + return t(); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(6), s = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + isSupersetOf: function (e) { + var t = i(this), n = a(t.has); + return !s(e, function (e, r) { + if (!1 === n.call(t, e)) + return r(); + }, { INTERRUPTED: !0 }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(28), s = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + join: function (e) { + var t = i(this), n = a(t), r = void 0 === e ? ',' : String(e), o = []; + return s(n, o.push, { + that: o, + IS_ITERATOR: !0 + }), o.join(r); + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(10), a = n(3), s = n(6), c = n(9), u = n(20), l = n(28), f = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + map: function (e) { + var t = a(this), n = l(t), r = c(e, arguments.length > 1 ? arguments[1] : void 0, 3), o = new (u(t, i('Set')))(), p = s(o.add); + return f(n, function (e) { + p.call(o, r(e, e, t)); + }, { IS_ITERATOR: !0 }), o; + } + }); + }, + function (e, t, n) { + n(1)({ + target: 'Set', + stat: !0 + }, { of: n(116) }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(6), s = n(28), c = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + reduce: function (e) { + var t = i(this), n = s(t), r = arguments.length < 2, o = r ? void 0 : arguments[1]; + if (a(e), c(n, function (n) { + r ? (r = !1, o = n) : o = e(o, n, n, t); + }, { IS_ITERATOR: !0 }), r) + throw TypeError('Reduce of empty set with no initial value'); + return o; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(3), a = n(9), s = n(28), c = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + some: function (e) { + var t = i(this), n = s(t), r = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); + return c(n, function (e, n) { + if (r(e, e, t)) + return n(); + }, { + IS_ITERATOR: !0, + INTERRUPTED: !0 + }).stopped; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(10), a = n(3), s = n(6), c = n(20), u = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + symmetricDifference: function (e) { + var t = a(this), n = new (c(t, i('Set')))(t), r = s(n.delete), o = s(n.add); + return u(e, function (e) { + r.call(n, e) || o.call(n, e); + }), n; + } + }); + }, + function (e, t, n) { + 'use strict'; + var r = n(1), o = n(4), i = n(10), a = n(3), s = n(6), c = n(20), u = n(5); + r({ + target: 'Set', + proto: !0, + real: !0, + forced: o + }, { + union: function (e) { + var t = a(this), n = new (c(t, i('Set')))(t); + return u(e, s(n.add), { that: n }), n; + } + }); + }, + function (e, t, n) { + n(11)('dispose'); + }, + function (e, t, n) { + n(11)('observable'); + }, + function (e, t, n) { + n(11)('patternMatch'); + }, + function (e, t, n) { + var r = n(7), o = n(257), i = n(258), a = n(22), s = n(8), c = s('iterator'), u = s('toStringTag'), l = i.values; + for (var f in o) { + var p = r[f], d = p && p.prototype; + if (d) { + if (d[c] !== l) + try { + a(d, c, l); + } catch (m) { + d[c] = l; + } + if (d[u] || a(d, u, f), o[f]) + for (var h in i) + if (d[h] !== i[h]) + try { + a(d, h, i[h]); + } catch (m) { + d[h] = i[h]; + } + } + } + }, + function (e, t) { + e.exports = { + CSSRuleList: 0, + CSSStyleDeclaration: 0, + CSSValueList: 0, + ClientRectList: 0, + DOMRectList: 0, + DOMStringList: 0, + DOMTokenList: 1, + DataTransferItemList: 0, + FileList: 0, + HTMLAllCollection: 0, + HTMLCollection: 0, + HTMLFormElement: 0, + HTMLSelectElement: 0, + MediaList: 0, + MimeTypeArray: 0, + NamedNodeMap: 0, + NodeList: 1, + PaintRequestList: 0, + Plugin: 0, + PluginArray: 0, + SVGLengthList: 0, + SVGNumberList: 0, + SVGPathSegList: 0, + SVGPointList: 0, + SVGStringList: 0, + SVGTransformList: 0, + SourceBufferList: 0, + StyleSheetList: 0, + TextTrackCueList: 0, + TextTrackList: 0, + TouchList: 0 + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(25), o = n(50), i = n(41), a = n(33), s = n(73), c = a.set, u = a.getterFor('Array Iterator'); + e.exports = s(Array, 'Array', function (e, t) { + c(this, { + type: 'Array Iterator', + target: r(e), + index: 0, + kind: t + }); + }, function () { + var e = u(this), t = e.target, n = e.kind, r = e.index++; + return !t || r >= t.length ? (e.target = void 0, { + value: void 0, + done: !0 + }) : 'keys' == n ? { + value: r, + done: !1 + } : 'values' == n ? { + value: t[r], + done: !1 + } : { + value: [ + r, + t[r] + ], + done: !1 + }; + }, 'values'), i.Arguments = i.Array, o('keys'), o('values'), o('entries'); + }, + function (e, t, n) { + var r = function (e) { + 'use strict'; + var t = Object.prototype, n = t.hasOwnProperty, r = 'function' === typeof Symbol ? Symbol : {}, o = r.iterator || '@@iterator', i = r.asyncIterator || '@@asyncIterator', a = r.toStringTag || '@@toStringTag'; + function s(e, t, n) { + return Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }), e[t]; + } + try { + s({}, ''); + } catch (T) { + s = function (e, t, n) { + return e[t] = n; + }; + } + function c(e, t, n, r) { + var o = t && t.prototype instanceof f ? t : f, i = Object.create(o.prototype), a = new S(r || []); + return i._invoke = function (e, t, n) { + var r = 'suspendedStart'; + return function (o, i) { + if ('executing' === r) + throw new Error('Generator is already running'); + if ('completed' === r) { + if ('throw' === o) + throw i; + return k(); + } + for (n.method = o, n.arg = i;;) { + var a = n.delegate; + if (a) { + var s = E(a, n); + if (s) { + if (s === l) + continue; + return s; + } + } + if ('next' === n.method) + n.sent = n._sent = n.arg; + else if ('throw' === n.method) { + if ('suspendedStart' === r) + throw r = 'completed', n.arg; + n.dispatchException(n.arg); + } else + 'return' === n.method && n.abrupt('return', n.arg); + r = 'executing'; + var c = u(e, t, n); + if ('normal' === c.type) { + if (r = n.done ? 'completed' : 'suspendedYield', c.arg === l) + continue; + return { + value: c.arg, + done: n.done + }; + } + 'throw' === c.type && (r = 'completed', n.method = 'throw', n.arg = c.arg); + } + }; + }(e, n, a), i; + } + function u(e, t, n) { + try { + return { + type: 'normal', + arg: e.call(t, n) + }; + } catch (T) { + return { + type: 'throw', + arg: T + }; + } + } + e.wrap = c; + var l = {}; + function f() { + } + function p() { + } + function d() { + } + var h = {}; + h[o] = function () { + return this; + }; + var m = Object.getPrototypeOf, g = m && m(m(C([]))); + g && g !== t && n.call(g, o) && (h = g); + var v = d.prototype = f.prototype = Object.create(h); + function y(e) { + [ + 'next', + 'throw', + 'return' + ].forEach(function (t) { + s(e, t, function (e) { + return this._invoke(t, e); + }); + }); + } + function b(e, t) { + var r; + this._invoke = function (o, i) { + function a() { + return new t(function (r, a) { + !function r(o, i, a, s) { + var c = u(e[o], e, i); + if ('throw' !== c.type) { + var l = c.arg, f = l.value; + return f && 'object' === typeof f && n.call(f, '__await') ? t.resolve(f.__await).then(function (e) { + r('next', e, a, s); + }, function (e) { + r('throw', e, a, s); + }) : t.resolve(f).then(function (e) { + l.value = e, a(l); + }, function (e) { + return r('throw', e, a, s); + }); + } + s(c.arg); + }(o, i, r, a); + }); + } + return r = r ? r.then(a, a) : a(); + }; + } + function E(e, t) { + var n = e.iterator[t.method]; + if (void 0 === n) { + if (t.delegate = null, 'throw' === t.method) { + if (e.iterator.return && (t.method = 'return', t.arg = void 0, E(e, t), 'throw' === t.method)) + return l; + t.method = 'throw', t.arg = new TypeError('The iterator does not provide a \'throw\' method'); + } + return l; + } + var r = u(n, e.iterator, t.arg); + if ('throw' === r.type) + return t.method = 'throw', t.arg = r.arg, t.delegate = null, l; + var o = r.arg; + return o ? o.done ? (t[e.resultName] = o.value, t.next = e.nextLoc, 'return' !== t.method && (t.method = 'next', t.arg = void 0), t.delegate = null, l) : o : (t.method = 'throw', t.arg = new TypeError('iterator result is not an object'), t.delegate = null, l); + } + function w(e) { + var t = { tryLoc: e[0] }; + 1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t); + } + function x(e) { + var t = e.completion || {}; + t.type = 'normal', delete t.arg, e.completion = t; + } + function S(e) { + this.tryEntries = [{ tryLoc: 'root' }], e.forEach(w, this), this.reset(!0); + } + function C(e) { + if (e) { + var t = e[o]; + if (t) + return t.call(e); + if ('function' === typeof e.next) + return e; + if (!isNaN(e.length)) { + var r = -1, i = function t() { + for (; ++r < e.length;) + if (n.call(e, r)) + return t.value = e[r], t.done = !1, t; + return t.value = void 0, t.done = !0, t; + }; + return i.next = i; + } + } + return { next: k }; + } + function k() { + return { + value: void 0, + done: !0 + }; + } + return p.prototype = v.constructor = d, d.constructor = p, p.displayName = s(d, a, 'GeneratorFunction'), e.isGeneratorFunction = function (e) { + var t = 'function' === typeof e && e.constructor; + return !!t && (t === p || 'GeneratorFunction' === (t.displayName || t.name)); + }, e.mark = function (e) { + return Object.setPrototypeOf ? Object.setPrototypeOf(e, d) : (e.__proto__ = d, s(e, a, 'GeneratorFunction')), e.prototype = Object.create(v), e; + }, e.awrap = function (e) { + return { __await: e }; + }, y(b.prototype), b.prototype[i] = function () { + return this; + }, e.AsyncIterator = b, e.async = function (t, n, r, o, i) { + void 0 === i && (i = Promise); + var a = new b(c(t, n, r, o), i); + return e.isGeneratorFunction(n) ? a : a.next().then(function (e) { + return e.done ? e.value : a.next(); + }); + }, y(v), s(v, a, 'Generator'), v[o] = function () { + return this; + }, v.toString = function () { + return '[object Generator]'; + }, e.keys = function (e) { + var t = []; + for (var n in e) + t.push(n); + return t.reverse(), function n() { + for (; t.length;) { + var r = t.pop(); + if (r in e) + return n.value = r, n.done = !1, n; + } + return n.done = !0, n; + }; + }, e.values = C, S.prototype = { + constructor: S, + reset: function (e) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = 'next', this.arg = void 0, this.tryEntries.forEach(x), !e) + for (var t in this) + 't' === t.charAt(0) && n.call(this, t) && !isNaN(+t.slice(1)) && (this[t] = void 0); + }, + stop: function () { + this.done = !0; + var e = this.tryEntries[0].completion; + if ('throw' === e.type) + throw e.arg; + return this.rval; + }, + dispatchException: function (e) { + if (this.done) + throw e; + var t = this; + function r(n, r) { + return a.type = 'throw', a.arg = e, t.next = n, r && (t.method = 'next', t.arg = void 0), !!r; + } + for (var o = this.tryEntries.length - 1; o >= 0; --o) { + var i = this.tryEntries[o], a = i.completion; + if ('root' === i.tryLoc) + return r('end'); + if (i.tryLoc <= this.prev) { + var s = n.call(i, 'catchLoc'), c = n.call(i, 'finallyLoc'); + if (s && c) { + if (this.prev < i.catchLoc) + return r(i.catchLoc, !0); + if (this.prev < i.finallyLoc) + return r(i.finallyLoc); + } else if (s) { + if (this.prev < i.catchLoc) + return r(i.catchLoc, !0); + } else { + if (!c) + throw new Error('try statement without catch or finally'); + if (this.prev < i.finallyLoc) + return r(i.finallyLoc); + } + } + } + }, + abrupt: function (e, t) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, 'finallyLoc') && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ('break' === e || 'continue' === e) && i.tryLoc <= t && t <= i.finallyLoc && (i = null); + var a = i ? i.completion : {}; + return a.type = e, a.arg = t, i ? (this.method = 'next', this.next = i.finallyLoc, l) : this.complete(a); + }, + complete: function (e, t) { + if ('throw' === e.type) + throw e.arg; + return 'break' === e.type || 'continue' === e.type ? this.next = e.arg : 'return' === e.type ? (this.rval = this.arg = e.arg, this.method = 'return', this.next = 'end') : 'normal' === e.type && t && (this.next = t), l; + }, + finish: function (e) { + for (var t = this.tryEntries.length - 1; t >= 0; --t) { + var n = this.tryEntries[t]; + if (n.finallyLoc === e) + return this.complete(n.completion, n.afterLoc), x(n), l; + } + }, + catch: function (e) { + for (var t = this.tryEntries.length - 1; t >= 0; --t) { + var n = this.tryEntries[t]; + if (n.tryLoc === e) { + var r = n.completion; + if ('throw' === r.type) { + var o = r.arg; + x(n); + } + return o; + } + } + throw new Error('illegal catch attempt'); + }, + delegateYield: function (e, t, n) { + return this.delegate = { + iterator: C(e), + resultName: t, + nextLoc: n + }, 'next' === this.method && (this.arg = void 0), l; + } + }, e; + }(e.exports); + try { + regeneratorRuntime = r; + } catch (o) { + Function('r', 'regeneratorRuntime = r')(r); + } + }, + function (e, t, n) { + 'use strict'; + var r = n(117), o = 'function' === typeof Symbol && Symbol.for, i = o ? Symbol.for('react.element') : 60103, a = o ? Symbol.for('react.portal') : 60106, s = o ? Symbol.for('react.fragment') : 60107, c = o ? Symbol.for('react.strict_mode') : 60108, u = o ? Symbol.for('react.profiler') : 60114, l = o ? Symbol.for('react.provider') : 60109, f = o ? Symbol.for('react.context') : 60110, p = o ? Symbol.for('react.forward_ref') : 60112, d = o ? Symbol.for('react.suspense') : 60113, h = o ? Symbol.for('react.memo') : 60115, m = o ? Symbol.for('react.lazy') : 60116, g = 'function' === typeof Symbol && Symbol.iterator; + function v(e) { + for (var t = 'https://reactjs.org/docs/error-decoder.html?invariant=' + e, n = 1; n < arguments.length; n++) + t += '&args[]=' + encodeURIComponent(arguments[n]); + return 'Minified React error #' + e + '; visit ' + t + ' for the full message or use the non-minified dev environment for full errors and additional helpful warnings.'; + } + var y = { + isMounted: function () { + return !1; + }, + enqueueForceUpdate: function () { + }, + enqueueReplaceState: function () { + }, + enqueueSetState: function () { + } + }, b = {}; + function E(e, t, n) { + this.props = e, this.context = t, this.refs = b, this.updater = n || y; + } + function w() { + } + function x(e, t, n) { + this.props = e, this.context = t, this.refs = b, this.updater = n || y; + } + E.prototype.isReactComponent = {}, E.prototype.setState = function (e, t) { + if ('object' !== typeof e && 'function' !== typeof e && null != e) + throw Error(v(85)); + this.updater.enqueueSetState(this, e, t, 'setState'); + }, E.prototype.forceUpdate = function (e) { + this.updater.enqueueForceUpdate(this, e, 'forceUpdate'); + }, w.prototype = E.prototype; + var S = x.prototype = new w(); + S.constructor = x, r(S, E.prototype), S.isPureReactComponent = !0; + var C = { current: null }, k = Object.prototype.hasOwnProperty, T = { + key: !0, + ref: !0, + __self: !0, + __source: !0 + }; + function _(e, t, n) { + var r, o = {}, a = null, s = null; + if (null != t) + for (r in (void 0 !== t.ref && (s = t.ref), void 0 !== t.key && (a = '' + t.key), t)) + k.call(t, r) && !T.hasOwnProperty(r) && (o[r] = t[r]); + var c = arguments.length - 2; + if (1 === c) + o.children = n; + else if (1 < c) { + for (var u = Array(c), l = 0; l < c; l++) + u[l] = arguments[l + 2]; + o.children = u; + } + if (e && e.defaultProps) + for (r in c = e.defaultProps) + void 0 === o[r] && (o[r] = c[r]); + return { + $$typeof: i, + type: e, + key: a, + ref: s, + props: o, + _owner: C.current + }; + } + function P(e) { + return 'object' === typeof e && null !== e && e.$$typeof === i; + } + var O = /\/+/g, I = []; + function L(e, t, n, r) { + if (I.length) { + var o = I.pop(); + return o.result = e, o.keyPrefix = t, o.func = n, o.context = r, o.count = 0, o; + } + return { + result: e, + keyPrefix: t, + func: n, + context: r, + count: 0 + }; + } + function A(e) { + e.result = null, e.keyPrefix = null, e.func = null, e.context = null, e.count = 0, 10 > I.length && I.push(e); + } + function R(e, t, n) { + return null == e ? 0 : function e(t, n, r, o) { + var s = typeof t; + 'undefined' !== s && 'boolean' !== s || (t = null); + var c = !1; + if (null === t) + c = !0; + else + switch (s) { + case 'string': + case 'number': + c = !0; + break; + case 'object': + switch (t.$$typeof) { + case i: + case a: + c = !0; + } + } + if (c) + return r(o, t, '' === n ? '.' + N(t, 0) : n), 1; + if (c = 0, n = '' === n ? '.' : n + ':', Array.isArray(t)) + for (var u = 0; u < t.length; u++) { + var l = n + N(s = t[u], u); + c += e(s, l, r, o); + } + else if (null === t || 'object' !== typeof t ? l = null : l = 'function' === typeof (l = g && t[g] || t['@@iterator']) ? l : null, 'function' === typeof l) + for (t = l.call(t), u = 0; !(s = t.next()).done;) + c += e(s = s.value, l = n + N(s, u++), r, o); + else if ('object' === s) + throw r = '' + t, Error(v(31, '[object Object]' === r ? 'object with keys {' + Object.keys(t).join(', ') + '}' : r, '')); + return c; + }(e, '', t, n); + } + function N(e, t) { + return 'object' === typeof e && null !== e && null != e.key ? function (e) { + var t = { + '=': '=0', + ':': '=2' + }; + return '$' + ('' + e).replace(/[=:]/g, function (e) { + return t[e]; + }); + }(e.key) : t.toString(36); + } + function j(e, t) { + e.func.call(e.context, t, e.count++); + } + function q(e, t, n) { + var r = e.result, o = e.keyPrefix; + e = e.func.call(e.context, t, e.count++), Array.isArray(e) ? F(e, r, n, function (e) { + return e; + }) : null != e && (P(e) && (e = function (e, t) { + return { + $$typeof: i, + type: e.type, + key: t, + ref: e.ref, + props: e.props, + _owner: e._owner + }; + }(e, o + (!e.key || t && t.key === e.key ? '' : ('' + e.key).replace(O, '$&/') + '/') + n)), r.push(e)); + } + function F(e, t, n, r, o) { + var i = ''; + null != n && (i = ('' + n).replace(O, '$&/') + '/'), R(e, q, t = L(t, i, r, o)), A(t); + } + var D = { current: null }; + function M() { + var e = D.current; + if (null === e) + throw Error(v(321)); + return e; + } + var U = { + ReactCurrentDispatcher: D, + ReactCurrentBatchConfig: { suspense: null }, + ReactCurrentOwner: C, + IsSomeRendererActing: { current: !1 }, + assign: r + }; + t.Children = { + map: function (e, t, n) { + if (null == e) + return e; + var r = []; + return F(e, r, null, t, n), r; + }, + forEach: function (e, t, n) { + if (null == e) + return e; + R(e, j, t = L(null, null, t, n)), A(t); + }, + count: function (e) { + return R(e, function () { + return null; + }, null); + }, + toArray: function (e) { + var t = []; + return F(e, t, null, function (e) { + return e; + }), t; + }, + only: function (e) { + if (!P(e)) + throw Error(v(143)); + return e; + } + }, t.Component = E, t.Fragment = s, t.Profiler = u, t.PureComponent = x, t.StrictMode = c, t.Suspense = d, t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = U, t.cloneElement = function (e, t, n) { + if (null === e || void 0 === e) + throw Error(v(267, e)); + var o = r({}, e.props), a = e.key, s = e.ref, c = e._owner; + if (null != t) { + if (void 0 !== t.ref && (s = t.ref, c = C.current), void 0 !== t.key && (a = '' + t.key), e.type && e.type.defaultProps) + var u = e.type.defaultProps; + for (l in t) + k.call(t, l) && !T.hasOwnProperty(l) && (o[l] = void 0 === t[l] && void 0 !== u ? u[l] : t[l]); + } + var l = arguments.length - 2; + if (1 === l) + o.children = n; + else if (1 < l) { + u = Array(l); + for (var f = 0; f < l; f++) + u[f] = arguments[f + 2]; + o.children = u; + } + return { + $$typeof: i, + type: e.type, + key: a, + ref: s, + props: o, + _owner: c + }; + }, t.createContext = function (e, t) { + return void 0 === t && (t = null), (e = { + $$typeof: f, + _calculateChangedBits: t, + _currentValue: e, + _currentValue2: e, + _threadCount: 0, + Provider: null, + Consumer: null + }).Provider = { + $$typeof: l, + _context: e + }, e.Consumer = e; + }, t.createElement = _, t.createFactory = function (e) { + var t = _.bind(null, e); + return t.type = e, t; + }, t.createRef = function () { + return { current: null }; + }, t.forwardRef = function (e) { + return { + $$typeof: p, + render: e + }; + }, t.isValidElement = P, t.lazy = function (e) { + return { + $$typeof: m, + _ctor: e, + _status: -1, + _result: null + }; + }, t.memo = function (e, t) { + return { + $$typeof: h, + type: e, + compare: void 0 === t ? null : t + }; + }, t.useCallback = function (e, t) { + return M().useCallback(e, t); + }, t.useContext = function (e, t) { + return M().useContext(e, t); + }, t.useDebugValue = function () { + }, t.useEffect = function (e, t) { + return M().useEffect(e, t); + }, t.useImperativeHandle = function (e, t, n) { + return M().useImperativeHandle(e, t, n); + }, t.useLayoutEffect = function (e, t) { + return M().useLayoutEffect(e, t); + }, t.useMemo = function (e, t) { + return M().useMemo(e, t); + }, t.useReducer = function (e, t, n) { + return M().useReducer(e, t, n); + }, t.useRef = function (e) { + return M().useRef(e); + }, t.useState = function (e) { + return M().useState(e); + }, t.version = '16.14.0'; + }, + function (e, t, n) { + 'use strict'; + var r = n(0), o = n(117), i = n(262); + function a(e) { + for (var t = 'https://reactjs.org/docs/error-decoder.html?invariant=' + e, n = 1; n < arguments.length; n++) + t += '&args[]=' + encodeURIComponent(arguments[n]); + return 'Minified React error #' + e + '; visit ' + t + ' for the full message or use the non-minified dev environment for full errors and additional helpful warnings.'; + } + if (!r) + throw Error(a(227)); + function s(e, t, n, r, o, i, a, s, c) { + var u = Array.prototype.slice.call(arguments, 3); + try { + t.apply(n, u); + } catch (l) { + this.onError(l); + } + } + var c = !1, u = null, l = !1, f = null, p = { + onError: function (e) { + c = !0, u = e; + } + }; + function d(e, t, n, r, o, i, a, l, f) { + c = !1, u = null, s.apply(p, arguments); + } + var h = null, m = null, g = null; + function v(e, t, n) { + var r = e.type || 'unknown-event'; + e.currentTarget = g(n), function (e, t, n, r, o, i, s, p, h) { + if (d.apply(this, arguments), c) { + if (!c) + throw Error(a(198)); + var m = u; + c = !1, u = null, l || (l = !0, f = m); + } + }(r, t, void 0, e), e.currentTarget = null; + } + var y = null, b = {}; + function E() { + if (y) + for (var e in b) { + var t = b[e], n = y.indexOf(e); + if (!(-1 < n)) + throw Error(a(96, e)); + if (!x[n]) { + if (!t.extractEvents) + throw Error(a(97, e)); + for (var r in (x[n] = t, n = t.eventTypes)) { + var o = void 0, i = n[r], s = t, c = r; + if (S.hasOwnProperty(c)) + throw Error(a(99, c)); + S[c] = i; + var u = i.phasedRegistrationNames; + if (u) { + for (o in u) + u.hasOwnProperty(o) && w(u[o], s, c); + o = !0; + } else + i.registrationName ? (w(i.registrationName, s, c), o = !0) : o = !1; + if (!o) + throw Error(a(98, r, e)); + } + } + } + } + function w(e, t, n) { + if (C[e]) + throw Error(a(100, e)); + C[e] = t, k[e] = t.eventTypes[n].dependencies; + } + var x = [], S = {}, C = {}, k = {}; + function T(e) { + var t, n = !1; + for (t in e) + if (e.hasOwnProperty(t)) { + var r = e[t]; + if (!b.hasOwnProperty(t) || b[t] !== r) { + if (b[t]) + throw Error(a(102, t)); + b[t] = r, n = !0; + } + } + n && E(); + } + var _ = !('undefined' === typeof window || 'undefined' === typeof window.document || 'undefined' === typeof window.document.createElement), P = null, O = null, I = null; + function L(e) { + if (e = m(e)) { + if ('function' !== typeof P) + throw Error(a(280)); + var t = e.stateNode; + t && (t = h(t), P(e.stateNode, e.type, t)); + } + } + function A(e) { + O ? I ? I.push(e) : I = [e] : O = e; + } + function R() { + if (O) { + var e = O, t = I; + if (I = O = null, L(e), t) + for (e = 0; e < t.length; e++) + L(t[e]); + } + } + function N(e, t) { + return e(t); + } + function j(e, t, n, r, o) { + return e(t, n, r, o); + } + function q() { + } + var F = N, D = !1, M = !1; + function U() { + null === O && null === I || (q(), R()); + } + function V(e, t, n) { + if (M) + return e(t, n); + M = !0; + try { + return F(e, t, n); + } finally { + M = !1, U(); + } + } + var B = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/, z = Object.prototype.hasOwnProperty, G = {}, H = {}; + function W(e, t, n, r, o, i) { + this.acceptsBooleans = 2 === t || 3 === t || 4 === t, this.attributeName = r, this.attributeNamespace = o, this.mustUseProperty = n, this.propertyName = e, this.type = t, this.sanitizeURL = i; + } + var $ = {}; + 'children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style'.split(' ').forEach(function (e) { + $[e] = new W(e, 0, !1, e, null, !1); + }), [ + [ + 'acceptCharset', + 'accept-charset' + ], + [ + 'className', + 'class' + ], + [ + 'htmlFor', + 'for' + ], + [ + 'httpEquiv', + 'http-equiv' + ] + ].forEach(function (e) { + var t = e[0]; + $[t] = new W(t, 1, !1, e[1], null, !1); + }), [ + 'contentEditable', + 'draggable', + 'spellCheck', + 'value' + ].forEach(function (e) { + $[e] = new W(e, 2, !1, e.toLowerCase(), null, !1); + }), [ + 'autoReverse', + 'externalResourcesRequired', + 'focusable', + 'preserveAlpha' + ].forEach(function (e) { + $[e] = new W(e, 2, !1, e, null, !1); + }), 'allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope'.split(' ').forEach(function (e) { + $[e] = new W(e, 3, !1, e.toLowerCase(), null, !1); + }), [ + 'checked', + 'multiple', + 'muted', + 'selected' + ].forEach(function (e) { + $[e] = new W(e, 3, !0, e, null, !1); + }), [ + 'capture', + 'download' + ].forEach(function (e) { + $[e] = new W(e, 4, !1, e, null, !1); + }), [ + 'cols', + 'rows', + 'size', + 'span' + ].forEach(function (e) { + $[e] = new W(e, 6, !1, e, null, !1); + }), [ + 'rowSpan', + 'start' + ].forEach(function (e) { + $[e] = new W(e, 5, !1, e.toLowerCase(), null, !1); + }); + var Y = /[\-:]([a-z])/g; + function Q(e) { + return e[1].toUpperCase(); + } + 'accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height'.split(' ').forEach(function (e) { + var t = e.replace(Y, Q); + $[t] = new W(t, 1, !1, e, null, !1); + }), 'xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type'.split(' ').forEach(function (e) { + var t = e.replace(Y, Q); + $[t] = new W(t, 1, !1, e, 'http://www.w3.org/1999/xlink', !1); + }), [ + 'xml:base', + 'xml:lang', + 'xml:space' + ].forEach(function (e) { + var t = e.replace(Y, Q); + $[t] = new W(t, 1, !1, e, 'http://www.w3.org/XML/1998/namespace', !1); + }), [ + 'tabIndex', + 'crossOrigin' + ].forEach(function (e) { + $[e] = new W(e, 1, !1, e.toLowerCase(), null, !1); + }), $.xlinkHref = new W('xlinkHref', 1, !1, 'xlink:href', 'http://www.w3.org/1999/xlink', !0), [ + 'src', + 'href', + 'action', + 'formAction' + ].forEach(function (e) { + $[e] = new W(e, 1, !1, e.toLowerCase(), null, !0); + }); + var K = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + function J(e, t, n, r) { + var o = $.hasOwnProperty(t) ? $[t] : null; + (null !== o ? 0 === o.type : !r && (2 < t.length && ('o' === t[0] || 'O' === t[0]) && ('n' === t[1] || 'N' === t[1]))) || (function (e, t, n, r) { + if (null === t || 'undefined' === typeof t || function (e, t, n, r) { + if (null !== n && 0 === n.type) + return !1; + switch (typeof t) { + case 'function': + case 'symbol': + return !0; + case 'boolean': + return !r && (null !== n ? !n.acceptsBooleans : 'data-' !== (e = e.toLowerCase().slice(0, 5)) && 'aria-' !== e); + default: + return !1; + } + }(e, t, n, r)) + return !0; + if (r) + return !1; + if (null !== n) + switch (n.type) { + case 3: + return !t; + case 4: + return !1 === t; + case 5: + return isNaN(t); + case 6: + return isNaN(t) || 1 > t; + } + return !1; + }(t, n, o, r) && (n = null), r || null === o ? function (e) { + return !!z.call(H, e) || !z.call(G, e) && (B.test(e) ? H[e] = !0 : (G[e] = !0, !1)); + }(t) && (null === n ? e.removeAttribute(t) : e.setAttribute(t, '' + n)) : o.mustUseProperty ? e[o.propertyName] = null === n ? 3 !== o.type && '' : n : (t = o.attributeName, r = o.attributeNamespace, null === n ? e.removeAttribute(t) : (n = 3 === (o = o.type) || 4 === o && !0 === n ? '' : '' + n, r ? e.setAttributeNS(r, t, n) : e.setAttribute(t, n)))); + } + K.hasOwnProperty('ReactCurrentDispatcher') || (K.ReactCurrentDispatcher = { current: null }), K.hasOwnProperty('ReactCurrentBatchConfig') || (K.ReactCurrentBatchConfig = { suspense: null }); + var X = /^(.*)[\\\/]/, Z = 'function' === typeof Symbol && Symbol.for, ee = Z ? Symbol.for('react.element') : 60103, te = Z ? Symbol.for('react.portal') : 60106, ne = Z ? Symbol.for('react.fragment') : 60107, re = Z ? Symbol.for('react.strict_mode') : 60108, oe = Z ? Symbol.for('react.profiler') : 60114, ie = Z ? Symbol.for('react.provider') : 60109, ae = Z ? Symbol.for('react.context') : 60110, se = Z ? Symbol.for('react.concurrent_mode') : 60111, ce = Z ? Symbol.for('react.forward_ref') : 60112, ue = Z ? Symbol.for('react.suspense') : 60113, le = Z ? Symbol.for('react.suspense_list') : 60120, fe = Z ? Symbol.for('react.memo') : 60115, pe = Z ? Symbol.for('react.lazy') : 60116, de = Z ? Symbol.for('react.block') : 60121, he = 'function' === typeof Symbol && Symbol.iterator; + function me(e) { + return null === e || 'object' !== typeof e ? null : 'function' === typeof (e = he && e[he] || e['@@iterator']) ? e : null; + } + function ge(e) { + if (null == e) + return null; + if ('function' === typeof e) + return e.displayName || e.name || null; + if ('string' === typeof e) + return e; + switch (e) { + case ne: + return 'Fragment'; + case te: + return 'Portal'; + case oe: + return 'Profiler'; + case re: + return 'StrictMode'; + case ue: + return 'Suspense'; + case le: + return 'SuspenseList'; + } + if ('object' === typeof e) + switch (e.$$typeof) { + case ae: + return 'Context.Consumer'; + case ie: + return 'Context.Provider'; + case ce: + var t = e.render; + return t = t.displayName || t.name || '', e.displayName || ('' !== t ? 'ForwardRef(' + t + ')' : 'ForwardRef'); + case fe: + return ge(e.type); + case de: + return ge(e.render); + case pe: + if (e = 1 === e._status ? e._result : null) + return ge(e); + } + return null; + } + function ve(e) { + var t = ''; + do { + e: + switch (e.tag) { + case 3: + case 4: + case 6: + case 7: + case 10: + case 9: + var n = ''; + break e; + default: + var r = e._debugOwner, o = e._debugSource, i = ge(e.type); + n = null, r && (n = ge(r.type)), r = i, i = '', o ? i = ' (at ' + o.fileName.replace(X, '') + ':' + o.lineNumber + ')' : n && (i = ' (created by ' + n + ')'), n = '\n in ' + (r || 'Unknown') + i; + } + t += n, e = e.return; + } while (e); + return t; + } + function ye(e) { + switch (typeof e) { + case 'boolean': + case 'number': + case 'object': + case 'string': + case 'undefined': + return e; + default: + return ''; + } + } + function be(e) { + var t = e.type; + return (e = e.nodeName) && 'input' === e.toLowerCase() && ('checkbox' === t || 'radio' === t); + } + function Ee(e) { + e._valueTracker || (e._valueTracker = function (e) { + var t = be(e) ? 'checked' : 'value', n = Object.getOwnPropertyDescriptor(e.constructor.prototype, t), r = '' + e[t]; + if (!e.hasOwnProperty(t) && 'undefined' !== typeof n && 'function' === typeof n.get && 'function' === typeof n.set) { + var o = n.get, i = n.set; + return Object.defineProperty(e, t, { + configurable: !0, + get: function () { + return o.call(this); + }, + set: function (e) { + r = '' + e, i.call(this, e); + } + }), Object.defineProperty(e, t, { enumerable: n.enumerable }), { + getValue: function () { + return r; + }, + setValue: function (e) { + r = '' + e; + }, + stopTracking: function () { + e._valueTracker = null, delete e[t]; + } + }; + } + }(e)); + } + function we(e) { + if (!e) + return !1; + var t = e._valueTracker; + if (!t) + return !0; + var n = t.getValue(), r = ''; + return e && (r = be(e) ? e.checked ? 'true' : 'false' : e.value), (e = r) !== n && (t.setValue(e), !0); + } + function xe(e, t) { + var n = t.checked; + return o({}, t, { + defaultChecked: void 0, + defaultValue: void 0, + value: void 0, + checked: null != n ? n : e._wrapperState.initialChecked + }); + } + function Se(e, t) { + var n = null == t.defaultValue ? '' : t.defaultValue, r = null != t.checked ? t.checked : t.defaultChecked; + n = ye(null != t.value ? t.value : n), e._wrapperState = { + initialChecked: r, + initialValue: n, + controlled: 'checkbox' === t.type || 'radio' === t.type ? null != t.checked : null != t.value + }; + } + function Ce(e, t) { + null != (t = t.checked) && J(e, 'checked', t, !1); + } + function ke(e, t) { + Ce(e, t); + var n = ye(t.value), r = t.type; + if (null != n) + 'number' === r ? (0 === n && '' === e.value || e.value != n) && (e.value = '' + n) : e.value !== '' + n && (e.value = '' + n); + else if ('submit' === r || 'reset' === r) + return void e.removeAttribute('value'); + t.hasOwnProperty('value') ? _e(e, t.type, n) : t.hasOwnProperty('defaultValue') && _e(e, t.type, ye(t.defaultValue)), null == t.checked && null != t.defaultChecked && (e.defaultChecked = !!t.defaultChecked); + } + function Te(e, t, n) { + if (t.hasOwnProperty('value') || t.hasOwnProperty('defaultValue')) { + var r = t.type; + if (!('submit' !== r && 'reset' !== r || void 0 !== t.value && null !== t.value)) + return; + t = '' + e._wrapperState.initialValue, n || t === e.value || (e.value = t), e.defaultValue = t; + } + '' !== (n = e.name) && (e.name = ''), e.defaultChecked = !!e._wrapperState.initialChecked, '' !== n && (e.name = n); + } + function _e(e, t, n) { + 'number' === t && e.ownerDocument.activeElement === e || (null == n ? e.defaultValue = '' + e._wrapperState.initialValue : e.defaultValue !== '' + n && (e.defaultValue = '' + n)); + } + function Pe(e, t) { + return e = o({ children: void 0 }, t), (t = function (e) { + var t = ''; + return r.Children.forEach(e, function (e) { + null != e && (t += e); + }), t; + }(t.children)) && (e.children = t), e; + } + function Oe(e, t, n, r) { + if (e = e.options, t) { + t = {}; + for (var o = 0; o < n.length; o++) + t['$' + n[o]] = !0; + for (n = 0; n < e.length; n++) + o = t.hasOwnProperty('$' + e[n].value), e[n].selected !== o && (e[n].selected = o), o && r && (e[n].defaultSelected = !0); + } else { + for (n = '' + ye(n), t = null, o = 0; o < e.length; o++) { + if (e[o].value === n) + return e[o].selected = !0, void (r && (e[o].defaultSelected = !0)); + null !== t || e[o].disabled || (t = e[o]); + } + null !== t && (t.selected = !0); + } + } + function Ie(e, t) { + if (null != t.dangerouslySetInnerHTML) + throw Error(a(91)); + return o({}, t, { + value: void 0, + defaultValue: void 0, + children: '' + e._wrapperState.initialValue + }); + } + function Le(e, t) { + var n = t.value; + if (null == n) { + if (n = t.children, t = t.defaultValue, null != n) { + if (null != t) + throw Error(a(92)); + if (Array.isArray(n)) { + if (!(1 >= n.length)) + throw Error(a(93)); + n = n[0]; + } + t = n; + } + null == t && (t = ''), n = t; + } + e._wrapperState = { initialValue: ye(n) }; + } + function Ae(e, t) { + var n = ye(t.value), r = ye(t.defaultValue); + null != n && ((n = '' + n) !== e.value && (e.value = n), null == t.defaultValue && e.defaultValue !== n && (e.defaultValue = n)), null != r && (e.defaultValue = '' + r); + } + function Re(e) { + var t = e.textContent; + t === e._wrapperState.initialValue && '' !== t && null !== t && (e.value = t); + } + var Ne = 'http://www.w3.org/1999/xhtml', je = 'http://www.w3.org/2000/svg'; + function qe(e) { + switch (e) { + case 'svg': + return 'http://www.w3.org/2000/svg'; + case 'math': + return 'http://www.w3.org/1998/Math/MathML'; + default: + return 'http://www.w3.org/1999/xhtml'; + } + } + function Fe(e, t) { + return null == e || 'http://www.w3.org/1999/xhtml' === e ? qe(t) : 'http://www.w3.org/2000/svg' === e && 'foreignObject' === t ? 'http://www.w3.org/1999/xhtml' : e; + } + var De, Me = function (e) { + return 'undefined' !== typeof MSApp && MSApp.execUnsafeLocalFunction ? function (t, n, r, o) { + MSApp.execUnsafeLocalFunction(function () { + return e(t, n); + }); + } : e; + }(function (e, t) { + if (e.namespaceURI !== je || 'innerHTML' in e) + e.innerHTML = t; + else { + for ((De = De || document.createElement('div')).innerHTML = '' + t.valueOf().toString() + '', t = De.firstChild; e.firstChild;) + e.removeChild(e.firstChild); + for (; t.firstChild;) + e.appendChild(t.firstChild); + } + }); + function Ue(e, t) { + if (t) { + var n = e.firstChild; + if (n && n === e.lastChild && 3 === n.nodeType) + return void (n.nodeValue = t); + } + e.textContent = t; + } + function Ve(e, t) { + var n = {}; + return n[e.toLowerCase()] = t.toLowerCase(), n['Webkit' + e] = 'webkit' + t, n['Moz' + e] = 'moz' + t, n; + } + var Be = { + animationend: Ve('Animation', 'AnimationEnd'), + animationiteration: Ve('Animation', 'AnimationIteration'), + animationstart: Ve('Animation', 'AnimationStart'), + transitionend: Ve('Transition', 'TransitionEnd') + }, ze = {}, Ge = {}; + function He(e) { + if (ze[e]) + return ze[e]; + if (!Be[e]) + return e; + var t, n = Be[e]; + for (t in n) + if (n.hasOwnProperty(t) && t in Ge) + return ze[e] = n[t]; + return e; + } + _ && (Ge = document.createElement('div').style, 'AnimationEvent' in window || (delete Be.animationend.animation, delete Be.animationiteration.animation, delete Be.animationstart.animation), 'TransitionEvent' in window || delete Be.transitionend.transition); + var We = He('animationend'), $e = He('animationiteration'), Ye = He('animationstart'), Qe = He('transitionend'), Ke = 'abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting'.split(' '), Je = new ('function' === typeof WeakMap ? WeakMap : Map)(); + function Xe(e) { + var t = Je.get(e); + return void 0 === t && (t = new Map(), Je.set(e, t)), t; + } + function Ze(e) { + var t = e, n = e; + if (e.alternate) + for (; t.return;) + t = t.return; + else { + e = t; + do { + 0 !== (1026 & (t = e).effectTag) && (n = t.return), e = t.return; + } while (e); + } + return 3 === t.tag ? n : null; + } + function et(e) { + if (13 === e.tag) { + var t = e.memoizedState; + if (null === t && (null !== (e = e.alternate) && (t = e.memoizedState)), null !== t) + return t.dehydrated; + } + return null; + } + function tt(e) { + if (Ze(e) !== e) + throw Error(a(188)); + } + function nt(e) { + if (!(e = function (e) { + var t = e.alternate; + if (!t) { + if (null === (t = Ze(e))) + throw Error(a(188)); + return t !== e ? null : e; + } + for (var n = e, r = t;;) { + var o = n.return; + if (null === o) + break; + var i = o.alternate; + if (null === i) { + if (null !== (r = o.return)) { + n = r; + continue; + } + break; + } + if (o.child === i.child) { + for (i = o.child; i;) { + if (i === n) + return tt(o), e; + if (i === r) + return tt(o), t; + i = i.sibling; + } + throw Error(a(188)); + } + if (n.return !== r.return) + n = o, r = i; + else { + for (var s = !1, c = o.child; c;) { + if (c === n) { + s = !0, n = o, r = i; + break; + } + if (c === r) { + s = !0, r = o, n = i; + break; + } + c = c.sibling; + } + if (!s) { + for (c = i.child; c;) { + if (c === n) { + s = !0, n = i, r = o; + break; + } + if (c === r) { + s = !0, r = i, n = o; + break; + } + c = c.sibling; + } + if (!s) + throw Error(a(189)); + } + } + if (n.alternate !== r) + throw Error(a(190)); + } + if (3 !== n.tag) + throw Error(a(188)); + return n.stateNode.current === n ? e : t; + }(e))) + return null; + for (var t = e;;) { + if (5 === t.tag || 6 === t.tag) + return t; + if (t.child) + t.child.return = t, t = t.child; + else { + if (t === e) + break; + for (; !t.sibling;) { + if (!t.return || t.return === e) + return null; + t = t.return; + } + t.sibling.return = t.return, t = t.sibling; + } + } + return null; + } + function rt(e, t) { + if (null == t) + throw Error(a(30)); + return null == e ? t : Array.isArray(e) ? Array.isArray(t) ? (e.push.apply(e, t), e) : (e.push(t), e) : Array.isArray(t) ? [e].concat(t) : [ + e, + t + ]; + } + function ot(e, t, n) { + Array.isArray(e) ? e.forEach(t, n) : e && t.call(n, e); + } + var it = null; + function at(e) { + if (e) { + var t = e._dispatchListeners, n = e._dispatchInstances; + if (Array.isArray(t)) + for (var r = 0; r < t.length && !e.isPropagationStopped(); r++) + v(e, t[r], n[r]); + else + t && v(e, t, n); + e._dispatchListeners = null, e._dispatchInstances = null, e.isPersistent() || e.constructor.release(e); + } + } + function st(e) { + if (null !== e && (it = rt(it, e)), e = it, it = null, e) { + if (ot(e, at), it) + throw Error(a(95)); + if (l) + throw e = f, l = !1, f = null, e; + } + } + function ct(e) { + return (e = e.target || e.srcElement || window).correspondingUseElement && (e = e.correspondingUseElement), 3 === e.nodeType ? e.parentNode : e; + } + function ut(e) { + if (!_) + return !1; + var t = (e = 'on' + e) in document; + return t || ((t = document.createElement('div')).setAttribute(e, 'return;'), t = 'function' === typeof t[e]), t; + } + var lt = []; + function ft(e) { + e.topLevelType = null, e.nativeEvent = null, e.targetInst = null, e.ancestors.length = 0, 10 > lt.length && lt.push(e); + } + function pt(e, t, n, r) { + if (lt.length) { + var o = lt.pop(); + return o.topLevelType = e, o.eventSystemFlags = r, o.nativeEvent = t, o.targetInst = n, o; + } + return { + topLevelType: e, + eventSystemFlags: r, + nativeEvent: t, + targetInst: n, + ancestors: [] + }; + } + function dt(e) { + var t = e.targetInst, n = t; + do { + if (!n) { + e.ancestors.push(n); + break; + } + var r = n; + if (3 === r.tag) + r = r.stateNode.containerInfo; + else { + for (; r.return;) + r = r.return; + r = 3 !== r.tag ? null : r.stateNode.containerInfo; + } + if (!r) + break; + 5 !== (t = n.tag) && 6 !== t || e.ancestors.push(n), n = _n(r); + } while (n); + for (n = 0; n < e.ancestors.length; n++) { + t = e.ancestors[n]; + var o = ct(e.nativeEvent); + r = e.topLevelType; + var i = e.nativeEvent, a = e.eventSystemFlags; + 0 === n && (a |= 64); + for (var s = null, c = 0; c < x.length; c++) { + var u = x[c]; + u && (u = u.extractEvents(r, t, i, o, a)) && (s = rt(s, u)); + } + st(s); + } + } + function ht(e, t, n) { + if (!n.has(e)) { + switch (e) { + case 'scroll': + Yt(t, 'scroll', !0); + break; + case 'focus': + case 'blur': + Yt(t, 'focus', !0), Yt(t, 'blur', !0), n.set('blur', null), n.set('focus', null); + break; + case 'cancel': + case 'close': + ut(e) && Yt(t, e, !0); + break; + case 'invalid': + case 'submit': + case 'reset': + break; + default: + -1 === Ke.indexOf(e) && $t(e, t); + } + n.set(e, null); + } + } + var mt, gt, vt, yt = !1, bt = [], Et = null, wt = null, xt = null, St = new Map(), Ct = new Map(), kt = [], Tt = 'mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput close cancel copy cut paste click change contextmenu reset submit'.split(' '), _t = 'focus blur dragenter dragleave mouseover mouseout pointerover pointerout gotpointercapture lostpointercapture'.split(' '); + function Pt(e, t, n, r, o) { + return { + blockedOn: e, + topLevelType: t, + eventSystemFlags: 32 | n, + nativeEvent: o, + container: r + }; + } + function Ot(e, t) { + switch (e) { + case 'focus': + case 'blur': + Et = null; + break; + case 'dragenter': + case 'dragleave': + wt = null; + break; + case 'mouseover': + case 'mouseout': + xt = null; + break; + case 'pointerover': + case 'pointerout': + St.delete(t.pointerId); + break; + case 'gotpointercapture': + case 'lostpointercapture': + Ct.delete(t.pointerId); + } + } + function It(e, t, n, r, o, i) { + return null === e || e.nativeEvent !== i ? (e = Pt(t, n, r, o, i), null !== t && (null !== (t = Pn(t)) && gt(t)), e) : (e.eventSystemFlags |= r, e); + } + function Lt(e) { + var t = _n(e.target); + if (null !== t) { + var n = Ze(t); + if (null !== n) + if (13 === (t = n.tag)) { + if (null !== (t = et(n))) + return e.blockedOn = t, void i.unstable_runWithPriority(e.priority, function () { + vt(n); + }); + } else if (3 === t && n.stateNode.hydrate) + return void (e.blockedOn = 3 === n.tag ? n.stateNode.containerInfo : null); + } + e.blockedOn = null; + } + function At(e) { + if (null !== e.blockedOn) + return !1; + var t = Xt(e.topLevelType, e.eventSystemFlags, e.container, e.nativeEvent); + if (null !== t) { + var n = Pn(t); + return null !== n && gt(n), e.blockedOn = t, !1; + } + return !0; + } + function Rt(e, t, n) { + At(e) && n.delete(t); + } + function Nt() { + for (yt = !1; 0 < bt.length;) { + var e = bt[0]; + if (null !== e.blockedOn) { + null !== (e = Pn(e.blockedOn)) && mt(e); + break; + } + var t = Xt(e.topLevelType, e.eventSystemFlags, e.container, e.nativeEvent); + null !== t ? e.blockedOn = t : bt.shift(); + } + null !== Et && At(Et) && (Et = null), null !== wt && At(wt) && (wt = null), null !== xt && At(xt) && (xt = null), St.forEach(Rt), Ct.forEach(Rt); + } + function jt(e, t) { + e.blockedOn === t && (e.blockedOn = null, yt || (yt = !0, i.unstable_scheduleCallback(i.unstable_NormalPriority, Nt))); + } + function qt(e) { + function t(t) { + return jt(t, e); + } + if (0 < bt.length) { + jt(bt[0], e); + for (var n = 1; n < bt.length; n++) { + var r = bt[n]; + r.blockedOn === e && (r.blockedOn = null); + } + } + for (null !== Et && jt(Et, e), null !== wt && jt(wt, e), null !== xt && jt(xt, e), St.forEach(t), Ct.forEach(t), n = 0; n < kt.length; n++) + (r = kt[n]).blockedOn === e && (r.blockedOn = null); + for (; 0 < kt.length && null === (n = kt[0]).blockedOn;) + Lt(n), null === n.blockedOn && kt.shift(); + } + var Ft = {}, Dt = new Map(), Mt = new Map(), Ut = [ + 'abort', + 'abort', + We, + 'animationEnd', + $e, + 'animationIteration', + Ye, + 'animationStart', + 'canplay', + 'canPlay', + 'canplaythrough', + 'canPlayThrough', + 'durationchange', + 'durationChange', + 'emptied', + 'emptied', + 'encrypted', + 'encrypted', + 'ended', + 'ended', + 'error', + 'error', + 'gotpointercapture', + 'gotPointerCapture', + 'load', + 'load', + 'loadeddata', + 'loadedData', + 'loadedmetadata', + 'loadedMetadata', + 'loadstart', + 'loadStart', + 'lostpointercapture', + 'lostPointerCapture', + 'playing', + 'playing', + 'progress', + 'progress', + 'seeking', + 'seeking', + 'stalled', + 'stalled', + 'suspend', + 'suspend', + 'timeupdate', + 'timeUpdate', + Qe, + 'transitionEnd', + 'waiting', + 'waiting' + ]; + function Vt(e, t) { + for (var n = 0; n < e.length; n += 2) { + var r = e[n], o = e[n + 1], i = 'on' + (o[0].toUpperCase() + o.slice(1)); + i = { + phasedRegistrationNames: { + bubbled: i, + captured: i + 'Capture' + }, + dependencies: [r], + eventPriority: t + }, Mt.set(r, t), Dt.set(r, i), Ft[o] = i; + } + } + Vt('blur blur cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focus focus input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange'.split(' '), 0), Vt('drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel'.split(' '), 1), Vt(Ut, 2); + for (var Bt = 'change selectionchange textInput compositionstart compositionend compositionupdate'.split(' '), zt = 0; zt < Bt.length; zt++) + Mt.set(Bt[zt], 0); + var Gt = i.unstable_UserBlockingPriority, Ht = i.unstable_runWithPriority, Wt = !0; + function $t(e, t) { + Yt(t, e, !1); + } + function Yt(e, t, n) { + var r = Mt.get(t); + switch (void 0 === r ? 2 : r) { + case 0: + r = Qt.bind(null, t, 1, e); + break; + case 1: + r = Kt.bind(null, t, 1, e); + break; + default: + r = Jt.bind(null, t, 1, e); + } + n ? e.addEventListener(t, r, !0) : e.addEventListener(t, r, !1); + } + function Qt(e, t, n, r) { + D || q(); + var o = Jt, i = D; + D = !0; + try { + j(o, e, t, n, r); + } finally { + (D = i) || U(); + } + } + function Kt(e, t, n, r) { + Ht(Gt, Jt.bind(null, e, t, n, r)); + } + function Jt(e, t, n, r) { + if (Wt) + if (0 < bt.length && -1 < Tt.indexOf(e)) + e = Pt(null, e, t, n, r), bt.push(e); + else { + var o = Xt(e, t, n, r); + if (null === o) + Ot(e, r); + else if (-1 < Tt.indexOf(e)) + e = Pt(o, e, t, n, r), bt.push(e); + else if (!function (e, t, n, r, o) { + switch (t) { + case 'focus': + return Et = It(Et, e, t, n, r, o), !0; + case 'dragenter': + return wt = It(wt, e, t, n, r, o), !0; + case 'mouseover': + return xt = It(xt, e, t, n, r, o), !0; + case 'pointerover': + var i = o.pointerId; + return St.set(i, It(St.get(i) || null, e, t, n, r, o)), !0; + case 'gotpointercapture': + return i = o.pointerId, Ct.set(i, It(Ct.get(i) || null, e, t, n, r, o)), !0; + } + return !1; + }(o, e, t, n, r)) { + Ot(e, r), e = pt(e, r, null, t); + try { + V(dt, e); + } finally { + ft(e); + } + } + } + } + function Xt(e, t, n, r) { + if (null !== (n = _n(n = ct(r)))) { + var o = Ze(n); + if (null === o) + n = null; + else { + var i = o.tag; + if (13 === i) { + if (null !== (n = et(o))) + return n; + n = null; + } else if (3 === i) { + if (o.stateNode.hydrate) + return 3 === o.tag ? o.stateNode.containerInfo : null; + n = null; + } else + o !== n && (n = null); + } + } + e = pt(e, r, n, t); + try { + V(dt, e); + } finally { + ft(e); + } + return null; + } + var Zt = { + animationIterationCount: !0, + borderImageOutset: !0, + borderImageSlice: !0, + borderImageWidth: !0, + boxFlex: !0, + boxFlexGroup: !0, + boxOrdinalGroup: !0, + columnCount: !0, + columns: !0, + flex: !0, + flexGrow: !0, + flexPositive: !0, + flexShrink: !0, + flexNegative: !0, + flexOrder: !0, + gridArea: !0, + gridRow: !0, + gridRowEnd: !0, + gridRowSpan: !0, + gridRowStart: !0, + gridColumn: !0, + gridColumnEnd: !0, + gridColumnSpan: !0, + gridColumnStart: !0, + fontWeight: !0, + lineClamp: !0, + lineHeight: !0, + opacity: !0, + order: !0, + orphans: !0, + tabSize: !0, + widows: !0, + zIndex: !0, + zoom: !0, + fillOpacity: !0, + floodOpacity: !0, + stopOpacity: !0, + strokeDasharray: !0, + strokeDashoffset: !0, + strokeMiterlimit: !0, + strokeOpacity: !0, + strokeWidth: !0 + }, en = [ + 'Webkit', + 'ms', + 'Moz', + 'O' + ]; + function tn(e, t, n) { + return null == t || 'boolean' === typeof t || '' === t ? '' : n || 'number' !== typeof t || 0 === t || Zt.hasOwnProperty(e) && Zt[e] ? ('' + t).trim() : t + 'px'; + } + function nn(e, t) { + for (var n in (e = e.style, t)) + if (t.hasOwnProperty(n)) { + var r = 0 === n.indexOf('--'), o = tn(n, t[n], r); + 'float' === n && (n = 'cssFloat'), r ? e.setProperty(n, o) : e[n] = o; + } + } + Object.keys(Zt).forEach(function (e) { + en.forEach(function (t) { + t = t + e.charAt(0).toUpperCase() + e.substring(1), Zt[t] = Zt[e]; + }); + }); + var rn = o({ menuitem: !0 }, { + area: !0, + base: !0, + br: !0, + col: !0, + embed: !0, + hr: !0, + img: !0, + input: !0, + keygen: !0, + link: !0, + meta: !0, + param: !0, + source: !0, + track: !0, + wbr: !0 + }); + function on(e, t) { + if (t) { + if (rn[e] && (null != t.children || null != t.dangerouslySetInnerHTML)) + throw Error(a(137, e, '')); + if (null != t.dangerouslySetInnerHTML) { + if (null != t.children) + throw Error(a(60)); + if ('object' !== typeof t.dangerouslySetInnerHTML || !('__html' in t.dangerouslySetInnerHTML)) + throw Error(a(61)); + } + if (null != t.style && 'object' !== typeof t.style) + throw Error(a(62, '')); + } + } + function an(e, t) { + if (-1 === e.indexOf('-')) + return 'string' === typeof t.is; + switch (e) { + case 'annotation-xml': + case 'color-profile': + case 'font-face': + case 'font-face-src': + case 'font-face-uri': + case 'font-face-format': + case 'font-face-name': + case 'missing-glyph': + return !1; + default: + return !0; + } + } + var sn = Ne; + function cn(e, t) { + var n = Xe(e = 9 === e.nodeType || 11 === e.nodeType ? e : e.ownerDocument); + t = k[t]; + for (var r = 0; r < t.length; r++) + ht(t[r], e, n); + } + function un() { + } + function ln(e) { + if ('undefined' === typeof (e = e || ('undefined' !== typeof document ? document : void 0))) + return null; + try { + return e.activeElement || e.body; + } catch (t) { + return e.body; + } + } + function fn(e) { + for (; e && e.firstChild;) + e = e.firstChild; + return e; + } + function pn(e, t) { + var n, r = fn(e); + for (e = 0; r;) { + if (3 === r.nodeType) { + if (n = e + r.textContent.length, e <= t && n >= t) + return { + node: r, + offset: t - e + }; + e = n; + } + e: { + for (; r;) { + if (r.nextSibling) { + r = r.nextSibling; + break e; + } + r = r.parentNode; + } + r = void 0; + } + r = fn(r); + } + } + function dn() { + for (var e = window, t = ln(); t instanceof e.HTMLIFrameElement;) { + try { + var n = 'string' === typeof t.contentWindow.location.href; + } catch (r) { + n = !1; + } + if (!n) + break; + t = ln((e = t.contentWindow).document); + } + return t; + } + function hn(e) { + var t = e && e.nodeName && e.nodeName.toLowerCase(); + return t && ('input' === t && ('text' === e.type || 'search' === e.type || 'tel' === e.type || 'url' === e.type || 'password' === e.type) || 'textarea' === t || 'true' === e.contentEditable); + } + var mn = null, gn = null; + function vn(e, t) { + switch (e) { + case 'button': + case 'input': + case 'select': + case 'textarea': + return !!t.autoFocus; + } + return !1; + } + function yn(e, t) { + return 'textarea' === e || 'option' === e || 'noscript' === e || 'string' === typeof t.children || 'number' === typeof t.children || 'object' === typeof t.dangerouslySetInnerHTML && null !== t.dangerouslySetInnerHTML && null != t.dangerouslySetInnerHTML.__html; + } + var bn = 'function' === typeof setTimeout ? setTimeout : void 0, En = 'function' === typeof clearTimeout ? clearTimeout : void 0; + function wn(e) { + for (; null != e; e = e.nextSibling) { + var t = e.nodeType; + if (1 === t || 3 === t) + break; + } + return e; + } + function xn(e) { + e = e.previousSibling; + for (var t = 0; e;) { + if (8 === e.nodeType) { + var n = e.data; + if ('$' === n || '$!' === n || '$?' === n) { + if (0 === t) + return e; + t--; + } else + '/$' === n && t++; + } + e = e.previousSibling; + } + return null; + } + var Sn = Math.random().toString(36).slice(2), Cn = '__reactInternalInstance$' + Sn, kn = '__reactEventHandlers$' + Sn, Tn = '__reactContainere$' + Sn; + function _n(e) { + var t = e[Cn]; + if (t) + return t; + for (var n = e.parentNode; n;) { + if (t = n[Tn] || n[Cn]) { + if (n = t.alternate, null !== t.child || null !== n && null !== n.child) + for (e = xn(e); null !== e;) { + if (n = e[Cn]) + return n; + e = xn(e); + } + return t; + } + n = (e = n).parentNode; + } + return null; + } + function Pn(e) { + return !(e = e[Cn] || e[Tn]) || 5 !== e.tag && 6 !== e.tag && 13 !== e.tag && 3 !== e.tag ? null : e; + } + function On(e) { + if (5 === e.tag || 6 === e.tag) + return e.stateNode; + throw Error(a(33)); + } + function In(e) { + return e[kn] || null; + } + function Ln(e) { + do { + e = e.return; + } while (e && 5 !== e.tag); + return e || null; + } + function An(e, t) { + var n = e.stateNode; + if (!n) + return null; + var r = h(n); + if (!r) + return null; + n = r[t]; + e: + switch (t) { + case 'onClick': + case 'onClickCapture': + case 'onDoubleClick': + case 'onDoubleClickCapture': + case 'onMouseDown': + case 'onMouseDownCapture': + case 'onMouseMove': + case 'onMouseMoveCapture': + case 'onMouseUp': + case 'onMouseUpCapture': + case 'onMouseEnter': + (r = !r.disabled) || (r = !('button' === (e = e.type) || 'input' === e || 'select' === e || 'textarea' === e)), e = !r; + break e; + default: + e = !1; + } + if (e) + return null; + if (n && 'function' !== typeof n) + throw Error(a(231, t, typeof n)); + return n; + } + function Rn(e, t, n) { + (t = An(e, n.dispatchConfig.phasedRegistrationNames[t])) && (n._dispatchListeners = rt(n._dispatchListeners, t), n._dispatchInstances = rt(n._dispatchInstances, e)); + } + function Nn(e) { + if (e && e.dispatchConfig.phasedRegistrationNames) { + for (var t = e._targetInst, n = []; t;) + n.push(t), t = Ln(t); + for (t = n.length; 0 < t--;) + Rn(n[t], 'captured', e); + for (t = 0; t < n.length; t++) + Rn(n[t], 'bubbled', e); + } + } + function jn(e, t, n) { + e && n && n.dispatchConfig.registrationName && (t = An(e, n.dispatchConfig.registrationName)) && (n._dispatchListeners = rt(n._dispatchListeners, t), n._dispatchInstances = rt(n._dispatchInstances, e)); + } + function qn(e) { + e && e.dispatchConfig.registrationName && jn(e._targetInst, null, e); + } + function Fn(e) { + ot(e, Nn); + } + var Dn = null, Mn = null, Un = null; + function Vn() { + if (Un) + return Un; + var e, t, n = Mn, r = n.length, o = 'value' in Dn ? Dn.value : Dn.textContent, i = o.length; + for (e = 0; e < r && n[e] === o[e]; e++); + var a = r - e; + for (t = 1; t <= a && n[r - t] === o[i - t]; t++); + return Un = o.slice(e, 1 < t ? 1 - t : void 0); + } + function Bn() { + return !0; + } + function zn() { + return !1; + } + function Gn(e, t, n, r) { + for (var o in (this.dispatchConfig = e, this._targetInst = t, this.nativeEvent = n, e = this.constructor.Interface)) + e.hasOwnProperty(o) && ((t = e[o]) ? this[o] = t(n) : 'target' === o ? this.target = r : this[o] = n[o]); + return this.isDefaultPrevented = (null != n.defaultPrevented ? n.defaultPrevented : !1 === n.returnValue) ? Bn : zn, this.isPropagationStopped = zn, this; + } + function Hn(e, t, n, r) { + if (this.eventPool.length) { + var o = this.eventPool.pop(); + return this.call(o, e, t, n, r), o; + } + return new this(e, t, n, r); + } + function Wn(e) { + if (!(e instanceof this)) + throw Error(a(279)); + e.destructor(), 10 > this.eventPool.length && this.eventPool.push(e); + } + function $n(e) { + e.eventPool = [], e.getPooled = Hn, e.release = Wn; + } + o(Gn.prototype, { + preventDefault: function () { + this.defaultPrevented = !0; + var e = this.nativeEvent; + e && (e.preventDefault ? e.preventDefault() : 'unknown' !== typeof e.returnValue && (e.returnValue = !1), this.isDefaultPrevented = Bn); + }, + stopPropagation: function () { + var e = this.nativeEvent; + e && (e.stopPropagation ? e.stopPropagation() : 'unknown' !== typeof e.cancelBubble && (e.cancelBubble = !0), this.isPropagationStopped = Bn); + }, + persist: function () { + this.isPersistent = Bn; + }, + isPersistent: zn, + destructor: function () { + var e, t = this.constructor.Interface; + for (e in t) + this[e] = null; + this.nativeEvent = this._targetInst = this.dispatchConfig = null, this.isPropagationStopped = this.isDefaultPrevented = zn, this._dispatchInstances = this._dispatchListeners = null; + } + }), Gn.Interface = { + type: null, + target: null, + currentTarget: function () { + return null; + }, + eventPhase: null, + bubbles: null, + cancelable: null, + timeStamp: function (e) { + return e.timeStamp || Date.now(); + }, + defaultPrevented: null, + isTrusted: null + }, Gn.extend = function (e) { + function t() { + } + function n() { + return r.apply(this, arguments); + } + var r = this; + t.prototype = r.prototype; + var i = new t(); + return o(i, n.prototype), n.prototype = i, n.prototype.constructor = n, n.Interface = o({}, r.Interface, e), n.extend = r.extend, $n(n), n; + }, $n(Gn); + var Yn = Gn.extend({ data: null }), Qn = Gn.extend({ data: null }), Kn = [ + 9, + 13, + 27, + 32 + ], Jn = _ && 'CompositionEvent' in window, Xn = null; + _ && 'documentMode' in document && (Xn = document.documentMode); + var Zn = _ && 'TextEvent' in window && !Xn, er = _ && (!Jn || Xn && 8 < Xn && 11 >= Xn), tr = String.fromCharCode(32), nr = { + beforeInput: { + phasedRegistrationNames: { + bubbled: 'onBeforeInput', + captured: 'onBeforeInputCapture' + }, + dependencies: [ + 'compositionend', + 'keypress', + 'textInput', + 'paste' + ] + }, + compositionEnd: { + phasedRegistrationNames: { + bubbled: 'onCompositionEnd', + captured: 'onCompositionEndCapture' + }, + dependencies: 'blur compositionend keydown keypress keyup mousedown'.split(' ') + }, + compositionStart: { + phasedRegistrationNames: { + bubbled: 'onCompositionStart', + captured: 'onCompositionStartCapture' + }, + dependencies: 'blur compositionstart keydown keypress keyup mousedown'.split(' ') + }, + compositionUpdate: { + phasedRegistrationNames: { + bubbled: 'onCompositionUpdate', + captured: 'onCompositionUpdateCapture' + }, + dependencies: 'blur compositionupdate keydown keypress keyup mousedown'.split(' ') + } + }, rr = !1; + function or(e, t) { + switch (e) { + case 'keyup': + return -1 !== Kn.indexOf(t.keyCode); + case 'keydown': + return 229 !== t.keyCode; + case 'keypress': + case 'mousedown': + case 'blur': + return !0; + default: + return !1; + } + } + function ir(e) { + return 'object' === typeof (e = e.detail) && 'data' in e ? e.data : null; + } + var ar = !1; + var sr = { + eventTypes: nr, + extractEvents: function (e, t, n, r) { + var o; + if (Jn) + e: { + switch (e) { + case 'compositionstart': + var i = nr.compositionStart; + break e; + case 'compositionend': + i = nr.compositionEnd; + break e; + case 'compositionupdate': + i = nr.compositionUpdate; + break e; + } + i = void 0; + } + else + ar ? or(e, n) && (i = nr.compositionEnd) : 'keydown' === e && 229 === n.keyCode && (i = nr.compositionStart); + return i ? (er && 'ko' !== n.locale && (ar || i !== nr.compositionStart ? i === nr.compositionEnd && ar && (o = Vn()) : (Mn = 'value' in (Dn = r) ? Dn.value : Dn.textContent, ar = !0)), i = Yn.getPooled(i, t, n, r), o ? i.data = o : null !== (o = ir(n)) && (i.data = o), Fn(i), o = i) : o = null, (e = Zn ? function (e, t) { + switch (e) { + case 'compositionend': + return ir(t); + case 'keypress': + return 32 !== t.which ? null : (rr = !0, tr); + case 'textInput': + return (e = t.data) === tr && rr ? null : e; + default: + return null; + } + }(e, n) : function (e, t) { + if (ar) + return 'compositionend' === e || !Jn && or(e, t) ? (e = Vn(), Un = Mn = Dn = null, ar = !1, e) : null; + switch (e) { + case 'paste': + return null; + case 'keypress': + if (!(t.ctrlKey || t.altKey || t.metaKey) || t.ctrlKey && t.altKey) { + if (t.char && 1 < t.char.length) + return t.char; + if (t.which) + return String.fromCharCode(t.which); + } + return null; + case 'compositionend': + return er && 'ko' !== t.locale ? null : t.data; + default: + return null; + } + }(e, n)) ? ((t = Qn.getPooled(nr.beforeInput, t, n, r)).data = e, Fn(t)) : t = null, null === o ? t : null === t ? o : [ + o, + t + ]; + } + }, cr = { + color: !0, + date: !0, + datetime: !0, + 'datetime-local': !0, + email: !0, + month: !0, + number: !0, + password: !0, + range: !0, + search: !0, + tel: !0, + text: !0, + time: !0, + url: !0, + week: !0 + }; + function ur(e) { + var t = e && e.nodeName && e.nodeName.toLowerCase(); + return 'input' === t ? !!cr[e.type] : 'textarea' === t; + } + var lr = { + change: { + phasedRegistrationNames: { + bubbled: 'onChange', + captured: 'onChangeCapture' + }, + dependencies: 'blur change click focus input keydown keyup selectionchange'.split(' ') + } + }; + function fr(e, t, n) { + return (e = Gn.getPooled(lr.change, e, t, n)).type = 'change', A(n), Fn(e), e; + } + var pr = null, dr = null; + function hr(e) { + st(e); + } + function mr(e) { + if (we(On(e))) + return e; + } + function gr(e, t) { + if ('change' === e) + return t; + } + var vr = !1; + function yr() { + pr && (pr.detachEvent('onpropertychange', br), dr = pr = null); + } + function br(e) { + if ('value' === e.propertyName && mr(dr)) + if (e = fr(dr, e, ct(e)), D) + st(e); + else { + D = !0; + try { + N(hr, e); + } finally { + D = !1, U(); + } + } + } + function Er(e, t, n) { + 'focus' === e ? (yr(), dr = n, (pr = t).attachEvent('onpropertychange', br)) : 'blur' === e && yr(); + } + function wr(e) { + if ('selectionchange' === e || 'keyup' === e || 'keydown' === e) + return mr(dr); + } + function xr(e, t) { + if ('click' === e) + return mr(t); + } + function Sr(e, t) { + if ('input' === e || 'change' === e) + return mr(t); + } + _ && (vr = ut('input') && (!document.documentMode || 9 < document.documentMode)); + var Cr = { + eventTypes: lr, + _isInputEventSupported: vr, + extractEvents: function (e, t, n, r) { + var o = t ? On(t) : window, i = o.nodeName && o.nodeName.toLowerCase(); + if ('select' === i || 'input' === i && 'file' === o.type) + var a = gr; + else if (ur(o)) + if (vr) + a = Sr; + else { + a = wr; + var s = Er; + } + else + (i = o.nodeName) && 'input' === i.toLowerCase() && ('checkbox' === o.type || 'radio' === o.type) && (a = xr); + if (a && (a = a(e, t))) + return fr(a, n, r); + s && s(e, o, t), 'blur' === e && (e = o._wrapperState) && e.controlled && 'number' === o.type && _e(o, 'number', o.value); + } + }, kr = Gn.extend({ + view: null, + detail: null + }), Tr = { + Alt: 'altKey', + Control: 'ctrlKey', + Meta: 'metaKey', + Shift: 'shiftKey' + }; + function _r(e) { + var t = this.nativeEvent; + return t.getModifierState ? t.getModifierState(e) : !!(e = Tr[e]) && !!t[e]; + } + function Pr() { + return _r; + } + var Or = 0, Ir = 0, Lr = !1, Ar = !1, Rr = kr.extend({ + screenX: null, + screenY: null, + clientX: null, + clientY: null, + pageX: null, + pageY: null, + ctrlKey: null, + shiftKey: null, + altKey: null, + metaKey: null, + getModifierState: Pr, + button: null, + buttons: null, + relatedTarget: function (e) { + return e.relatedTarget || (e.fromElement === e.srcElement ? e.toElement : e.fromElement); + }, + movementX: function (e) { + if ('movementX' in e) + return e.movementX; + var t = Or; + return Or = e.screenX, Lr ? 'mousemove' === e.type ? e.screenX - t : 0 : (Lr = !0, 0); + }, + movementY: function (e) { + if ('movementY' in e) + return e.movementY; + var t = Ir; + return Ir = e.screenY, Ar ? 'mousemove' === e.type ? e.screenY - t : 0 : (Ar = !0, 0); + } + }), Nr = Rr.extend({ + pointerId: null, + width: null, + height: null, + pressure: null, + tangentialPressure: null, + tiltX: null, + tiltY: null, + twist: null, + pointerType: null, + isPrimary: null + }), jr = { + mouseEnter: { + registrationName: 'onMouseEnter', + dependencies: [ + 'mouseout', + 'mouseover' + ] + }, + mouseLeave: { + registrationName: 'onMouseLeave', + dependencies: [ + 'mouseout', + 'mouseover' + ] + }, + pointerEnter: { + registrationName: 'onPointerEnter', + dependencies: [ + 'pointerout', + 'pointerover' + ] + }, + pointerLeave: { + registrationName: 'onPointerLeave', + dependencies: [ + 'pointerout', + 'pointerover' + ] + } + }, qr = { + eventTypes: jr, + extractEvents: function (e, t, n, r, o) { + var i = 'mouseover' === e || 'pointerover' === e, a = 'mouseout' === e || 'pointerout' === e; + if (i && 0 === (32 & o) && (n.relatedTarget || n.fromElement) || !a && !i) + return null; + (i = r.window === r ? r : (i = r.ownerDocument) ? i.defaultView || i.parentWindow : window, a) ? (a = t, null !== (t = (t = n.relatedTarget || n.toElement) ? _n(t) : null) && (t !== Ze(t) || 5 !== t.tag && 6 !== t.tag) && (t = null)) : a = null; + if (a === t) + return null; + if ('mouseout' === e || 'mouseover' === e) + var s = Rr, c = jr.mouseLeave, u = jr.mouseEnter, l = 'mouse'; + else + 'pointerout' !== e && 'pointerover' !== e || (s = Nr, c = jr.pointerLeave, u = jr.pointerEnter, l = 'pointer'); + if (e = null == a ? i : On(a), i = null == t ? i : On(t), (c = s.getPooled(c, a, n, r)).type = l + 'leave', c.target = e, c.relatedTarget = i, (n = s.getPooled(u, t, n, r)).type = l + 'enter', n.target = i, n.relatedTarget = e, l = t, (r = a) && l) + e: { + for (u = l, a = 0, e = s = r; e; e = Ln(e)) + a++; + for (e = 0, t = u; t; t = Ln(t)) + e++; + for (; 0 < a - e;) + s = Ln(s), a--; + for (; 0 < e - a;) + u = Ln(u), e--; + for (; a--;) { + if (s === u || s === u.alternate) + break e; + s = Ln(s), u = Ln(u); + } + s = null; + } + else + s = null; + for (u = s, s = []; r && r !== u && (null === (a = r.alternate) || a !== u);) + s.push(r), r = Ln(r); + for (r = []; l && l !== u && (null === (a = l.alternate) || a !== u);) + r.push(l), l = Ln(l); + for (l = 0; l < s.length; l++) + jn(s[l], 'bubbled', c); + for (l = r.length; 0 < l--;) + jn(r[l], 'captured', n); + return 0 === (64 & o) ? [c] : [ + c, + n + ]; + } + }; + var Fr = 'function' === typeof Object.is ? Object.is : function (e, t) { + return e === t && (0 !== e || 1 / e === 1 / t) || e !== e && t !== t; + }, Dr = Object.prototype.hasOwnProperty; + function Mr(e, t) { + if (Fr(e, t)) + return !0; + if ('object' !== typeof e || null === e || 'object' !== typeof t || null === t) + return !1; + var n = Object.keys(e), r = Object.keys(t); + if (n.length !== r.length) + return !1; + for (r = 0; r < n.length; r++) + if (!Dr.call(t, n[r]) || !Fr(e[n[r]], t[n[r]])) + return !1; + return !0; + } + var Ur = _ && 'documentMode' in document && 11 >= document.documentMode, Vr = { + select: { + phasedRegistrationNames: { + bubbled: 'onSelect', + captured: 'onSelectCapture' + }, + dependencies: 'blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange'.split(' ') + } + }, Br = null, zr = null, Gr = null, Hr = !1; + function Wr(e, t) { + var n = t.window === t ? t.document : 9 === t.nodeType ? t : t.ownerDocument; + return Hr || null == Br || Br !== ln(n) ? null : ('selectionStart' in (n = Br) && hn(n) ? n = { + start: n.selectionStart, + end: n.selectionEnd + } : n = { + anchorNode: (n = (n.ownerDocument && n.ownerDocument.defaultView || window).getSelection()).anchorNode, + anchorOffset: n.anchorOffset, + focusNode: n.focusNode, + focusOffset: n.focusOffset + }, Gr && Mr(Gr, n) ? null : (Gr = n, (e = Gn.getPooled(Vr.select, zr, e, t)).type = 'select', e.target = Br, Fn(e), e)); + } + var $r = { + eventTypes: Vr, + extractEvents: function (e, t, n, r, o, i) { + if (!(i = !(o = i || (r.window === r ? r.document : 9 === r.nodeType ? r : r.ownerDocument)))) { + e: { + o = Xe(o), i = k.onSelect; + for (var a = 0; a < i.length; a++) + if (!o.has(i[a])) { + o = !1; + break e; + } + o = !0; + } + i = !o; + } + if (i) + return null; + switch (o = t ? On(t) : window, e) { + case 'focus': + (ur(o) || 'true' === o.contentEditable) && (Br = o, zr = t, Gr = null); + break; + case 'blur': + Gr = zr = Br = null; + break; + case 'mousedown': + Hr = !0; + break; + case 'contextmenu': + case 'mouseup': + case 'dragend': + return Hr = !1, Wr(n, r); + case 'selectionchange': + if (Ur) + break; + case 'keydown': + case 'keyup': + return Wr(n, r); + } + return null; + } + }, Yr = Gn.extend({ + animationName: null, + elapsedTime: null, + pseudoElement: null + }), Qr = Gn.extend({ + clipboardData: function (e) { + return 'clipboardData' in e ? e.clipboardData : window.clipboardData; + } + }), Kr = kr.extend({ relatedTarget: null }); + function Jr(e) { + var t = e.keyCode; + return 'charCode' in e ? 0 === (e = e.charCode) && 13 === t && (e = 13) : e = t, 10 === e && (e = 13), 32 <= e || 13 === e ? e : 0; + } + var Xr = { + Esc: 'Escape', + Spacebar: ' ', + Left: 'ArrowLeft', + Up: 'ArrowUp', + Right: 'ArrowRight', + Down: 'ArrowDown', + Del: 'Delete', + Win: 'OS', + Menu: 'ContextMenu', + Apps: 'ContextMenu', + Scroll: 'ScrollLock', + MozPrintableKey: 'Unidentified' + }, Zr = { + 8: 'Backspace', + 9: 'Tab', + 12: 'Clear', + 13: 'Enter', + 16: 'Shift', + 17: 'Control', + 18: 'Alt', + 19: 'Pause', + 20: 'CapsLock', + 27: 'Escape', + 32: ' ', + 33: 'PageUp', + 34: 'PageDown', + 35: 'End', + 36: 'Home', + 37: 'ArrowLeft', + 38: 'ArrowUp', + 39: 'ArrowRight', + 40: 'ArrowDown', + 45: 'Insert', + 46: 'Delete', + 112: 'F1', + 113: 'F2', + 114: 'F3', + 115: 'F4', + 116: 'F5', + 117: 'F6', + 118: 'F7', + 119: 'F8', + 120: 'F9', + 121: 'F10', + 122: 'F11', + 123: 'F12', + 144: 'NumLock', + 145: 'ScrollLock', + 224: 'Meta' + }, eo = kr.extend({ + key: function (e) { + if (e.key) { + var t = Xr[e.key] || e.key; + if ('Unidentified' !== t) + return t; + } + return 'keypress' === e.type ? 13 === (e = Jr(e)) ? 'Enter' : String.fromCharCode(e) : 'keydown' === e.type || 'keyup' === e.type ? Zr[e.keyCode] || 'Unidentified' : ''; + }, + location: null, + ctrlKey: null, + shiftKey: null, + altKey: null, + metaKey: null, + repeat: null, + locale: null, + getModifierState: Pr, + charCode: function (e) { + return 'keypress' === e.type ? Jr(e) : 0; + }, + keyCode: function (e) { + return 'keydown' === e.type || 'keyup' === e.type ? e.keyCode : 0; + }, + which: function (e) { + return 'keypress' === e.type ? Jr(e) : 'keydown' === e.type || 'keyup' === e.type ? e.keyCode : 0; + } + }), to = Rr.extend({ dataTransfer: null }), no = kr.extend({ + touches: null, + targetTouches: null, + changedTouches: null, + altKey: null, + metaKey: null, + ctrlKey: null, + shiftKey: null, + getModifierState: Pr + }), ro = Gn.extend({ + propertyName: null, + elapsedTime: null, + pseudoElement: null + }), oo = Rr.extend({ + deltaX: function (e) { + return 'deltaX' in e ? e.deltaX : 'wheelDeltaX' in e ? -e.wheelDeltaX : 0; + }, + deltaY: function (e) { + return 'deltaY' in e ? e.deltaY : 'wheelDeltaY' in e ? -e.wheelDeltaY : 'wheelDelta' in e ? -e.wheelDelta : 0; + }, + deltaZ: null, + deltaMode: null + }), io = { + eventTypes: Ft, + extractEvents: function (e, t, n, r) { + var o = Dt.get(e); + if (!o) + return null; + switch (e) { + case 'keypress': + if (0 === Jr(n)) + return null; + case 'keydown': + case 'keyup': + e = eo; + break; + case 'blur': + case 'focus': + e = Kr; + break; + case 'click': + if (2 === n.button) + return null; + case 'auxclick': + case 'dblclick': + case 'mousedown': + case 'mousemove': + case 'mouseup': + case 'mouseout': + case 'mouseover': + case 'contextmenu': + e = Rr; + break; + case 'drag': + case 'dragend': + case 'dragenter': + case 'dragexit': + case 'dragleave': + case 'dragover': + case 'dragstart': + case 'drop': + e = to; + break; + case 'touchcancel': + case 'touchend': + case 'touchmove': + case 'touchstart': + e = no; + break; + case We: + case $e: + case Ye: + e = Yr; + break; + case Qe: + e = ro; + break; + case 'scroll': + e = kr; + break; + case 'wheel': + e = oo; + break; + case 'copy': + case 'cut': + case 'paste': + e = Qr; + break; + case 'gotpointercapture': + case 'lostpointercapture': + case 'pointercancel': + case 'pointerdown': + case 'pointermove': + case 'pointerout': + case 'pointerover': + case 'pointerup': + e = Nr; + break; + default: + e = Gn; + } + return Fn(t = e.getPooled(o, t, n, r)), t; + } + }; + if (y) + throw Error(a(101)); + y = Array.prototype.slice.call('ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin'.split(' ')), E(), h = In, m = Pn, g = On, T({ + SimpleEventPlugin: io, + EnterLeaveEventPlugin: qr, + ChangeEventPlugin: Cr, + SelectEventPlugin: $r, + BeforeInputEventPlugin: sr + }); + var ao = [], so = -1; + function co(e) { + 0 > so || (e.current = ao[so], ao[so] = null, so--); + } + function uo(e, t) { + so++, ao[so] = e.current, e.current = t; + } + var lo = {}, fo = { current: lo }, po = { current: !1 }, ho = lo; + function mo(e, t) { + var n = e.type.contextTypes; + if (!n) + return lo; + var r = e.stateNode; + if (r && r.__reactInternalMemoizedUnmaskedChildContext === t) + return r.__reactInternalMemoizedMaskedChildContext; + var o, i = {}; + for (o in n) + i[o] = t[o]; + return r && ((e = e.stateNode).__reactInternalMemoizedUnmaskedChildContext = t, e.__reactInternalMemoizedMaskedChildContext = i), i; + } + function go(e) { + return null !== (e = e.childContextTypes) && void 0 !== e; + } + function vo() { + co(po), co(fo); + } + function yo(e, t, n) { + if (fo.current !== lo) + throw Error(a(168)); + uo(fo, t), uo(po, n); + } + function bo(e, t, n) { + var r = e.stateNode; + if (e = t.childContextTypes, 'function' !== typeof r.getChildContext) + return n; + for (var i in r = r.getChildContext()) + if (!(i in e)) + throw Error(a(108, ge(t) || 'Unknown', i)); + return o({}, n, {}, r); + } + function Eo(e) { + return e = (e = e.stateNode) && e.__reactInternalMemoizedMergedChildContext || lo, ho = fo.current, uo(fo, e), uo(po, po.current), !0; + } + function wo(e, t, n) { + var r = e.stateNode; + if (!r) + throw Error(a(169)); + n ? (e = bo(e, t, ho), r.__reactInternalMemoizedMergedChildContext = e, co(po), co(fo), uo(fo, e)) : co(po), uo(po, n); + } + var xo = i.unstable_runWithPriority, So = i.unstable_scheduleCallback, Co = i.unstable_cancelCallback, ko = i.unstable_requestPaint, To = i.unstable_now, _o = i.unstable_getCurrentPriorityLevel, Po = i.unstable_ImmediatePriority, Oo = i.unstable_UserBlockingPriority, Io = i.unstable_NormalPriority, Lo = i.unstable_LowPriority, Ao = i.unstable_IdlePriority, Ro = {}, No = i.unstable_shouldYield, jo = void 0 !== ko ? ko : function () { + }, qo = null, Fo = null, Do = !1, Mo = To(), Uo = 10000 > Mo ? To : function () { + return To() - Mo; + }; + function Vo() { + switch (_o()) { + case Po: + return 99; + case Oo: + return 98; + case Io: + return 97; + case Lo: + return 96; + case Ao: + return 95; + default: + throw Error(a(332)); + } + } + function Bo(e) { + switch (e) { + case 99: + return Po; + case 98: + return Oo; + case 97: + return Io; + case 96: + return Lo; + case 95: + return Ao; + default: + throw Error(a(332)); + } + } + function zo(e, t) { + return e = Bo(e), xo(e, t); + } + function Go(e, t, n) { + return e = Bo(e), So(e, t, n); + } + function Ho(e) { + return null === qo ? (qo = [e], Fo = So(Po, $o)) : qo.push(e), Ro; + } + function Wo() { + if (null !== Fo) { + var e = Fo; + Fo = null, Co(e); + } + $o(); + } + function $o() { + if (!Do && null !== qo) { + Do = !0; + var e = 0; + try { + var t = qo; + zo(99, function () { + for (; e < t.length; e++) { + var n = t[e]; + do { + n = n(!0); + } while (null !== n); + } + }), qo = null; + } catch (n) { + throw null !== qo && (qo = qo.slice(e + 1)), So(Po, Wo), n; + } finally { + Do = !1; + } + } + } + function Yo(e, t, n) { + return 1073741821 - (1 + ((1073741821 - e + t / 10) / (n /= 10) | 0)) * n; + } + function Qo(e, t) { + if (e && e.defaultProps) + for (var n in (t = o({}, t), e = e.defaultProps)) + void 0 === t[n] && (t[n] = e[n]); + return t; + } + var Ko = { current: null }, Jo = null, Xo = null, Zo = null; + function ei() { + Zo = Xo = Jo = null; + } + function ti(e) { + var t = Ko.current; + co(Ko), e.type._context._currentValue = t; + } + function ni(e, t) { + for (; null !== e;) { + var n = e.alternate; + if (e.childExpirationTime < t) + e.childExpirationTime = t, null !== n && n.childExpirationTime < t && (n.childExpirationTime = t); + else { + if (!(null !== n && n.childExpirationTime < t)) + break; + n.childExpirationTime = t; + } + e = e.return; + } + } + function ri(e, t) { + Jo = e, Zo = Xo = null, null !== (e = e.dependencies) && null !== e.firstContext && (e.expirationTime >= t && (Ia = !0), e.firstContext = null); + } + function oi(e, t) { + if (Zo !== e && !1 !== t && 0 !== t) + if ('number' === typeof t && 1073741823 !== t || (Zo = e, t = 1073741823), t = { + context: e, + observedBits: t, + next: null + }, null === Xo) { + if (null === Jo) + throw Error(a(308)); + Xo = t, Jo.dependencies = { + expirationTime: 0, + firstContext: t, + responders: null + }; + } else + Xo = Xo.next = t; + return e._currentValue; + } + var ii = !1; + function ai(e) { + e.updateQueue = { + baseState: e.memoizedState, + baseQueue: null, + shared: { pending: null }, + effects: null + }; + } + function si(e, t) { + e = e.updateQueue, t.updateQueue === e && (t.updateQueue = { + baseState: e.baseState, + baseQueue: e.baseQueue, + shared: e.shared, + effects: e.effects + }); + } + function ci(e, t) { + return (e = { + expirationTime: e, + suspenseConfig: t, + tag: 0, + payload: null, + callback: null, + next: null + }).next = e; + } + function ui(e, t) { + if (null !== (e = e.updateQueue)) { + var n = (e = e.shared).pending; + null === n ? t.next = t : (t.next = n.next, n.next = t), e.pending = t; + } + } + function li(e, t) { + var n = e.alternate; + null !== n && si(n, e), null === (n = (e = e.updateQueue).baseQueue) ? (e.baseQueue = t.next = t, t.next = t) : (t.next = n.next, n.next = t); + } + function fi(e, t, n, r) { + var i = e.updateQueue; + ii = !1; + var a = i.baseQueue, s = i.shared.pending; + if (null !== s) { + if (null !== a) { + var c = a.next; + a.next = s.next, s.next = c; + } + a = s, i.shared.pending = null, null !== (c = e.alternate) && (null !== (c = c.updateQueue) && (c.baseQueue = s)); + } + if (null !== a) { + c = a.next; + var u = i.baseState, l = 0, f = null, p = null, d = null; + if (null !== c) + for (var h = c;;) { + if ((s = h.expirationTime) < r) { + var m = { + expirationTime: h.expirationTime, + suspenseConfig: h.suspenseConfig, + tag: h.tag, + payload: h.payload, + callback: h.callback, + next: null + }; + null === d ? (p = d = m, f = u) : d = d.next = m, s > l && (l = s); + } else { + null !== d && (d = d.next = { + expirationTime: 1073741823, + suspenseConfig: h.suspenseConfig, + tag: h.tag, + payload: h.payload, + callback: h.callback, + next: null + }), ic(s, h.suspenseConfig); + e: { + var g = e, v = h; + switch (s = t, m = n, v.tag) { + case 1: + if ('function' === typeof (g = v.payload)) { + u = g.call(m, u, s); + break e; + } + u = g; + break e; + case 3: + g.effectTag = -4097 & g.effectTag | 64; + case 0: + if (null === (s = 'function' === typeof (g = v.payload) ? g.call(m, u, s) : g) || void 0 === s) + break e; + u = o({}, u, s); + break e; + case 2: + ii = !0; + } + } + null !== h.callback && (e.effectTag |= 32, null === (s = i.effects) ? i.effects = [h] : s.push(h)); + } + if (null === (h = h.next) || h === c) { + if (null === (s = i.shared.pending)) + break; + h = a.next = s.next, s.next = c, i.baseQueue = a = s, i.shared.pending = null; + } + } + null === d ? f = u : d.next = p, i.baseState = f, i.baseQueue = d, ac(l), e.expirationTime = l, e.memoizedState = u; + } + } + function pi(e, t, n) { + if (e = t.effects, t.effects = null, null !== e) + for (t = 0; t < e.length; t++) { + var r = e[t], o = r.callback; + if (null !== o) { + if (r.callback = null, r = o, o = n, 'function' !== typeof r) + throw Error(a(191, r)); + r.call(o); + } + } + } + var di = K.ReactCurrentBatchConfig, hi = new r.Component().refs; + function mi(e, t, n, r) { + n = null === (n = n(r, t = e.memoizedState)) || void 0 === n ? t : o({}, t, n), e.memoizedState = n, 0 === e.expirationTime && (e.updateQueue.baseState = n); + } + var gi = { + isMounted: function (e) { + return !!(e = e._reactInternalFiber) && Ze(e) === e; + }, + enqueueSetState: function (e, t, n) { + e = e._reactInternalFiber; + var r = Ws(), o = di.suspense; + (o = ci(r = $s(r, e, o), o)).payload = t, void 0 !== n && null !== n && (o.callback = n), ui(e, o), Ys(e, r); + }, + enqueueReplaceState: function (e, t, n) { + e = e._reactInternalFiber; + var r = Ws(), o = di.suspense; + (o = ci(r = $s(r, e, o), o)).tag = 1, o.payload = t, void 0 !== n && null !== n && (o.callback = n), ui(e, o), Ys(e, r); + }, + enqueueForceUpdate: function (e, t) { + e = e._reactInternalFiber; + var n = Ws(), r = di.suspense; + (r = ci(n = $s(n, e, r), r)).tag = 2, void 0 !== t && null !== t && (r.callback = t), ui(e, r), Ys(e, n); + } + }; + function vi(e, t, n, r, o, i, a) { + return 'function' === typeof (e = e.stateNode).shouldComponentUpdate ? e.shouldComponentUpdate(r, i, a) : !t.prototype || !t.prototype.isPureReactComponent || (!Mr(n, r) || !Mr(o, i)); + } + function yi(e, t, n) { + var r = !1, o = lo, i = t.contextType; + return 'object' === typeof i && null !== i ? i = oi(i) : (o = go(t) ? ho : fo.current, i = (r = null !== (r = t.contextTypes) && void 0 !== r) ? mo(e, o) : lo), t = new t(n, i), e.memoizedState = null !== t.state && void 0 !== t.state ? t.state : null, t.updater = gi, e.stateNode = t, t._reactInternalFiber = e, r && ((e = e.stateNode).__reactInternalMemoizedUnmaskedChildContext = o, e.__reactInternalMemoizedMaskedChildContext = i), t; + } + function bi(e, t, n, r) { + e = t.state, 'function' === typeof t.componentWillReceiveProps && t.componentWillReceiveProps(n, r), 'function' === typeof t.UNSAFE_componentWillReceiveProps && t.UNSAFE_componentWillReceiveProps(n, r), t.state !== e && gi.enqueueReplaceState(t, t.state, null); + } + function Ei(e, t, n, r) { + var o = e.stateNode; + o.props = n, o.state = e.memoizedState, o.refs = hi, ai(e); + var i = t.contextType; + 'object' === typeof i && null !== i ? o.context = oi(i) : (i = go(t) ? ho : fo.current, o.context = mo(e, i)), fi(e, n, o, r), o.state = e.memoizedState, 'function' === typeof (i = t.getDerivedStateFromProps) && (mi(e, t, i, n), o.state = e.memoizedState), 'function' === typeof t.getDerivedStateFromProps || 'function' === typeof o.getSnapshotBeforeUpdate || 'function' !== typeof o.UNSAFE_componentWillMount && 'function' !== typeof o.componentWillMount || (t = o.state, 'function' === typeof o.componentWillMount && o.componentWillMount(), 'function' === typeof o.UNSAFE_componentWillMount && o.UNSAFE_componentWillMount(), t !== o.state && gi.enqueueReplaceState(o, o.state, null), fi(e, n, o, r), o.state = e.memoizedState), 'function' === typeof o.componentDidMount && (e.effectTag |= 4); + } + var wi = Array.isArray; + function xi(e, t, n) { + if (null !== (e = n.ref) && 'function' !== typeof e && 'object' !== typeof e) { + if (n._owner) { + if (n = n._owner) { + if (1 !== n.tag) + throw Error(a(309)); + var r = n.stateNode; + } + if (!r) + throw Error(a(147, e)); + var o = '' + e; + return null !== t && null !== t.ref && 'function' === typeof t.ref && t.ref._stringRef === o ? t.ref : ((t = function (e) { + var t = r.refs; + t === hi && (t = r.refs = {}), null === e ? delete t[o] : t[o] = e; + })._stringRef = o, t); + } + if ('string' !== typeof e) + throw Error(a(284)); + if (!n._owner) + throw Error(a(290, e)); + } + return e; + } + function Si(e, t) { + if ('textarea' !== e.type) + throw Error(a(31, '[object Object]' === Object.prototype.toString.call(t) ? 'object with keys {' + Object.keys(t).join(', ') + '}' : t, '')); + } + function Ci(e) { + function t(t, n) { + if (e) { + var r = t.lastEffect; + null !== r ? (r.nextEffect = n, t.lastEffect = n) : t.firstEffect = t.lastEffect = n, n.nextEffect = null, n.effectTag = 8; + } + } + function n(n, r) { + if (!e) + return null; + for (; null !== r;) + t(n, r), r = r.sibling; + return null; + } + function r(e, t) { + for (e = new Map(); null !== t;) + null !== t.key ? e.set(t.key, t) : e.set(t.index, t), t = t.sibling; + return e; + } + function o(e, t) { + return (e = Tc(e, t)).index = 0, e.sibling = null, e; + } + function i(t, n, r) { + return t.index = r, e ? null !== (r = t.alternate) ? (r = r.index) < n ? (t.effectTag = 2, n) : r : (t.effectTag = 2, n) : n; + } + function s(t) { + return e && null === t.alternate && (t.effectTag = 2), t; + } + function c(e, t, n, r) { + return null === t || 6 !== t.tag ? ((t = Oc(n, e.mode, r)).return = e, t) : ((t = o(t, n)).return = e, t); + } + function u(e, t, n, r) { + return null !== t && t.elementType === n.type ? ((r = o(t, n.props)).ref = xi(e, t, n), r.return = e, r) : ((r = _c(n.type, n.key, n.props, null, e.mode, r)).ref = xi(e, t, n), r.return = e, r); + } + function l(e, t, n, r) { + return null === t || 4 !== t.tag || t.stateNode.containerInfo !== n.containerInfo || t.stateNode.implementation !== n.implementation ? ((t = Ic(n, e.mode, r)).return = e, t) : ((t = o(t, n.children || [])).return = e, t); + } + function f(e, t, n, r, i) { + return null === t || 7 !== t.tag ? ((t = Pc(n, e.mode, r, i)).return = e, t) : ((t = o(t, n)).return = e, t); + } + function p(e, t, n) { + if ('string' === typeof t || 'number' === typeof t) + return (t = Oc('' + t, e.mode, n)).return = e, t; + if ('object' === typeof t && null !== t) { + switch (t.$$typeof) { + case ee: + return (n = _c(t.type, t.key, t.props, null, e.mode, n)).ref = xi(e, null, t), n.return = e, n; + case te: + return (t = Ic(t, e.mode, n)).return = e, t; + } + if (wi(t) || me(t)) + return (t = Pc(t, e.mode, n, null)).return = e, t; + Si(e, t); + } + return null; + } + function d(e, t, n, r) { + var o = null !== t ? t.key : null; + if ('string' === typeof n || 'number' === typeof n) + return null !== o ? null : c(e, t, '' + n, r); + if ('object' === typeof n && null !== n) { + switch (n.$$typeof) { + case ee: + return n.key === o ? n.type === ne ? f(e, t, n.props.children, r, o) : u(e, t, n, r) : null; + case te: + return n.key === o ? l(e, t, n, r) : null; + } + if (wi(n) || me(n)) + return null !== o ? null : f(e, t, n, r, null); + Si(e, n); + } + return null; + } + function h(e, t, n, r, o) { + if ('string' === typeof r || 'number' === typeof r) + return c(t, e = e.get(n) || null, '' + r, o); + if ('object' === typeof r && null !== r) { + switch (r.$$typeof) { + case ee: + return e = e.get(null === r.key ? n : r.key) || null, r.type === ne ? f(t, e, r.props.children, o, r.key) : u(t, e, r, o); + case te: + return l(t, e = e.get(null === r.key ? n : r.key) || null, r, o); + } + if (wi(r) || me(r)) + return f(t, e = e.get(n) || null, r, o, null); + Si(t, r); + } + return null; + } + function m(o, a, s, c) { + for (var u = null, l = null, f = a, m = a = 0, g = null; null !== f && m < s.length; m++) { + f.index > m ? (g = f, f = null) : g = f.sibling; + var v = d(o, f, s[m], c); + if (null === v) { + null === f && (f = g); + break; + } + e && f && null === v.alternate && t(o, f), a = i(v, a, m), null === l ? u = v : l.sibling = v, l = v, f = g; + } + if (m === s.length) + return n(o, f), u; + if (null === f) { + for (; m < s.length; m++) + null !== (f = p(o, s[m], c)) && (a = i(f, a, m), null === l ? u = f : l.sibling = f, l = f); + return u; + } + for (f = r(o, f); m < s.length; m++) + null !== (g = h(f, o, m, s[m], c)) && (e && null !== g.alternate && f.delete(null === g.key ? m : g.key), a = i(g, a, m), null === l ? u = g : l.sibling = g, l = g); + return e && f.forEach(function (e) { + return t(o, e); + }), u; + } + function g(o, s, c, u) { + var l = me(c); + if ('function' !== typeof l) + throw Error(a(150)); + if (null == (c = l.call(c))) + throw Error(a(151)); + for (var f = l = null, m = s, g = s = 0, v = null, y = c.next(); null !== m && !y.done; g++, y = c.next()) { + m.index > g ? (v = m, m = null) : v = m.sibling; + var b = d(o, m, y.value, u); + if (null === b) { + null === m && (m = v); + break; + } + e && m && null === b.alternate && t(o, m), s = i(b, s, g), null === f ? l = b : f.sibling = b, f = b, m = v; + } + if (y.done) + return n(o, m), l; + if (null === m) { + for (; !y.done; g++, y = c.next()) + null !== (y = p(o, y.value, u)) && (s = i(y, s, g), null === f ? l = y : f.sibling = y, f = y); + return l; + } + for (m = r(o, m); !y.done; g++, y = c.next()) + null !== (y = h(m, o, g, y.value, u)) && (e && null !== y.alternate && m.delete(null === y.key ? g : y.key), s = i(y, s, g), null === f ? l = y : f.sibling = y, f = y); + return e && m.forEach(function (e) { + return t(o, e); + }), l; + } + return function (e, r, i, c) { + var u = 'object' === typeof i && null !== i && i.type === ne && null === i.key; + u && (i = i.props.children); + var l = 'object' === typeof i && null !== i; + if (l) + switch (i.$$typeof) { + case ee: + e: { + for (l = i.key, u = r; null !== u;) { + if (u.key === l) { + switch (u.tag) { + case 7: + if (i.type === ne) { + n(e, u.sibling), (r = o(u, i.props.children)).return = e, e = r; + break e; + } + break; + default: + if (u.elementType === i.type) { + n(e, u.sibling), (r = o(u, i.props)).ref = xi(e, u, i), r.return = e, e = r; + break e; + } + } + n(e, u); + break; + } + t(e, u), u = u.sibling; + } + i.type === ne ? ((r = Pc(i.props.children, e.mode, c, i.key)).return = e, e = r) : ((c = _c(i.type, i.key, i.props, null, e.mode, c)).ref = xi(e, r, i), c.return = e, e = c); + } + return s(e); + case te: + e: { + for (u = i.key; null !== r;) { + if (r.key === u) { + if (4 === r.tag && r.stateNode.containerInfo === i.containerInfo && r.stateNode.implementation === i.implementation) { + n(e, r.sibling), (r = o(r, i.children || [])).return = e, e = r; + break e; + } + n(e, r); + break; + } + t(e, r), r = r.sibling; + } + (r = Ic(i, e.mode, c)).return = e, e = r; + } + return s(e); + } + if ('string' === typeof i || 'number' === typeof i) + return i = '' + i, null !== r && 6 === r.tag ? (n(e, r.sibling), (r = o(r, i)).return = e, e = r) : (n(e, r), (r = Oc(i, e.mode, c)).return = e, e = r), s(e); + if (wi(i)) + return m(e, r, i, c); + if (me(i)) + return g(e, r, i, c); + if (l && Si(e, i), 'undefined' === typeof i && !u) + switch (e.tag) { + case 1: + case 0: + throw e = e.type, Error(a(152, e.displayName || e.name || 'Component')); + } + return n(e, r); + }; + } + var ki = Ci(!0), Ti = Ci(!1), _i = {}, Pi = { current: _i }, Oi = { current: _i }, Ii = { current: _i }; + function Li(e) { + if (e === _i) + throw Error(a(174)); + return e; + } + function Ai(e, t) { + switch (uo(Ii, t), uo(Oi, e), uo(Pi, _i), e = t.nodeType) { + case 9: + case 11: + t = (t = t.documentElement) ? t.namespaceURI : Fe(null, ''); + break; + default: + t = Fe(t = (e = 8 === e ? t.parentNode : t).namespaceURI || null, e = e.tagName); + } + co(Pi), uo(Pi, t); + } + function Ri() { + co(Pi), co(Oi), co(Ii); + } + function Ni(e) { + Li(Ii.current); + var t = Li(Pi.current), n = Fe(t, e.type); + t !== n && (uo(Oi, e), uo(Pi, n)); + } + function ji(e) { + Oi.current === e && (co(Pi), co(Oi)); + } + var qi = { current: 0 }; + function Fi(e) { + for (var t = e; null !== t;) { + if (13 === t.tag) { + var n = t.memoizedState; + if (null !== n && (null === (n = n.dehydrated) || '$?' === n.data || '$!' === n.data)) + return t; + } else if (19 === t.tag && void 0 !== t.memoizedProps.revealOrder) { + if (0 !== (64 & t.effectTag)) + return t; + } else if (null !== t.child) { + t.child.return = t, t = t.child; + continue; + } + if (t === e) + break; + for (; null === t.sibling;) { + if (null === t.return || t.return === e) + return null; + t = t.return; + } + t.sibling.return = t.return, t = t.sibling; + } + return null; + } + function Di(e, t) { + return { + responder: e, + props: t + }; + } + var Mi = K.ReactCurrentDispatcher, Ui = K.ReactCurrentBatchConfig, Vi = 0, Bi = null, zi = null, Gi = null, Hi = !1; + function Wi() { + throw Error(a(321)); + } + function $i(e, t) { + if (null === t) + return !1; + for (var n = 0; n < t.length && n < e.length; n++) + if (!Fr(e[n], t[n])) + return !1; + return !0; + } + function Yi(e, t, n, r, o, i) { + if (Vi = i, Bi = t, t.memoizedState = null, t.updateQueue = null, t.expirationTime = 0, Mi.current = null === e || null === e.memoizedState ? va : ya, e = n(r, o), t.expirationTime === Vi) { + i = 0; + do { + if (t.expirationTime = 0, !(25 > i)) + throw Error(a(301)); + i += 1, Gi = zi = null, t.updateQueue = null, Mi.current = ba, e = n(r, o); + } while (t.expirationTime === Vi); + } + if (Mi.current = ga, t = null !== zi && null !== zi.next, Vi = 0, Gi = zi = Bi = null, Hi = !1, t) + throw Error(a(300)); + return e; + } + function Qi() { + var e = { + memoizedState: null, + baseState: null, + baseQueue: null, + queue: null, + next: null + }; + return null === Gi ? Bi.memoizedState = Gi = e : Gi = Gi.next = e, Gi; + } + function Ki() { + if (null === zi) { + var e = Bi.alternate; + e = null !== e ? e.memoizedState : null; + } else + e = zi.next; + var t = null === Gi ? Bi.memoizedState : Gi.next; + if (null !== t) + Gi = t, zi = e; + else { + if (null === e) + throw Error(a(310)); + e = { + memoizedState: (zi = e).memoizedState, + baseState: zi.baseState, + baseQueue: zi.baseQueue, + queue: zi.queue, + next: null + }, null === Gi ? Bi.memoizedState = Gi = e : Gi = Gi.next = e; + } + return Gi; + } + function Ji(e, t) { + return 'function' === typeof t ? t(e) : t; + } + function Xi(e) { + var t = Ki(), n = t.queue; + if (null === n) + throw Error(a(311)); + n.lastRenderedReducer = e; + var r = zi, o = r.baseQueue, i = n.pending; + if (null !== i) { + if (null !== o) { + var s = o.next; + o.next = i.next, i.next = s; + } + r.baseQueue = o = i, n.pending = null; + } + if (null !== o) { + o = o.next, r = r.baseState; + var c = s = i = null, u = o; + do { + var l = u.expirationTime; + if (l < Vi) { + var f = { + expirationTime: u.expirationTime, + suspenseConfig: u.suspenseConfig, + action: u.action, + eagerReducer: u.eagerReducer, + eagerState: u.eagerState, + next: null + }; + null === c ? (s = c = f, i = r) : c = c.next = f, l > Bi.expirationTime && (Bi.expirationTime = l, ac(l)); + } else + null !== c && (c = c.next = { + expirationTime: 1073741823, + suspenseConfig: u.suspenseConfig, + action: u.action, + eagerReducer: u.eagerReducer, + eagerState: u.eagerState, + next: null + }), ic(l, u.suspenseConfig), r = u.eagerReducer === e ? u.eagerState : e(r, u.action); + u = u.next; + } while (null !== u && u !== o); + null === c ? i = r : c.next = s, Fr(r, t.memoizedState) || (Ia = !0), t.memoizedState = r, t.baseState = i, t.baseQueue = c, n.lastRenderedState = r; + } + return [ + t.memoizedState, + n.dispatch + ]; + } + function Zi(e) { + var t = Ki(), n = t.queue; + if (null === n) + throw Error(a(311)); + n.lastRenderedReducer = e; + var r = n.dispatch, o = n.pending, i = t.memoizedState; + if (null !== o) { + n.pending = null; + var s = o = o.next; + do { + i = e(i, s.action), s = s.next; + } while (s !== o); + Fr(i, t.memoizedState) || (Ia = !0), t.memoizedState = i, null === t.baseQueue && (t.baseState = i), n.lastRenderedState = i; + } + return [ + i, + r + ]; + } + function ea(e) { + var t = Qi(); + return 'function' === typeof e && (e = e()), t.memoizedState = t.baseState = e, e = (e = t.queue = { + pending: null, + dispatch: null, + lastRenderedReducer: Ji, + lastRenderedState: e + }).dispatch = ma.bind(null, Bi, e), [ + t.memoizedState, + e + ]; + } + function ta(e, t, n, r) { + return e = { + tag: e, + create: t, + destroy: n, + deps: r, + next: null + }, null === (t = Bi.updateQueue) ? (t = { lastEffect: null }, Bi.updateQueue = t, t.lastEffect = e.next = e) : null === (n = t.lastEffect) ? t.lastEffect = e.next = e : (r = n.next, n.next = e, e.next = r, t.lastEffect = e), e; + } + function na() { + return Ki().memoizedState; + } + function ra(e, t, n, r) { + var o = Qi(); + Bi.effectTag |= e, o.memoizedState = ta(1 | t, n, void 0, void 0 === r ? null : r); + } + function oa(e, t, n, r) { + var o = Ki(); + r = void 0 === r ? null : r; + var i = void 0; + if (null !== zi) { + var a = zi.memoizedState; + if (i = a.destroy, null !== r && $i(r, a.deps)) + return void ta(t, n, i, r); + } + Bi.effectTag |= e, o.memoizedState = ta(1 | t, n, i, r); + } + function ia(e, t) { + return ra(516, 4, e, t); + } + function aa(e, t) { + return oa(516, 4, e, t); + } + function sa(e, t) { + return oa(4, 2, e, t); + } + function ca(e, t) { + return 'function' === typeof t ? (e = e(), t(e), function () { + t(null); + }) : null !== t && void 0 !== t ? (e = e(), t.current = e, function () { + t.current = null; + }) : void 0; + } + function ua(e, t, n) { + return n = null !== n && void 0 !== n ? n.concat([e]) : null, oa(4, 2, ca.bind(null, t, e), n); + } + function la() { + } + function fa(e, t) { + return Qi().memoizedState = [ + e, + void 0 === t ? null : t + ], e; + } + function pa(e, t) { + var n = Ki(); + t = void 0 === t ? null : t; + var r = n.memoizedState; + return null !== r && null !== t && $i(t, r[1]) ? r[0] : (n.memoizedState = [ + e, + t + ], e); + } + function da(e, t) { + var n = Ki(); + t = void 0 === t ? null : t; + var r = n.memoizedState; + return null !== r && null !== t && $i(t, r[1]) ? r[0] : (e = e(), n.memoizedState = [ + e, + t + ], e); + } + function ha(e, t, n) { + var r = Vo(); + zo(98 > r ? 98 : r, function () { + e(!0); + }), zo(97 < r ? 97 : r, function () { + var r = Ui.suspense; + Ui.suspense = void 0 === t ? null : t; + try { + e(!1), n(); + } finally { + Ui.suspense = r; + } + }); + } + function ma(e, t, n) { + var r = Ws(), o = di.suspense; + o = { + expirationTime: r = $s(r, e, o), + suspenseConfig: o, + action: n, + eagerReducer: null, + eagerState: null, + next: null + }; + var i = t.pending; + if (null === i ? o.next = o : (o.next = i.next, i.next = o), t.pending = o, i = e.alternate, e === Bi || null !== i && i === Bi) + Hi = !0, o.expirationTime = Vi, Bi.expirationTime = Vi; + else { + if (0 === e.expirationTime && (null === i || 0 === i.expirationTime) && null !== (i = t.lastRenderedReducer)) + try { + var a = t.lastRenderedState, s = i(a, n); + if (o.eagerReducer = i, o.eagerState = s, Fr(s, a)) + return; + } catch (c) { + } + Ys(e, r); + } + } + var ga = { + readContext: oi, + useCallback: Wi, + useContext: Wi, + useEffect: Wi, + useImperativeHandle: Wi, + useLayoutEffect: Wi, + useMemo: Wi, + useReducer: Wi, + useRef: Wi, + useState: Wi, + useDebugValue: Wi, + useResponder: Wi, + useDeferredValue: Wi, + useTransition: Wi + }, va = { + readContext: oi, + useCallback: fa, + useContext: oi, + useEffect: ia, + useImperativeHandle: function (e, t, n) { + return n = null !== n && void 0 !== n ? n.concat([e]) : null, ra(4, 2, ca.bind(null, t, e), n); + }, + useLayoutEffect: function (e, t) { + return ra(4, 2, e, t); + }, + useMemo: function (e, t) { + var n = Qi(); + return t = void 0 === t ? null : t, e = e(), n.memoizedState = [ + e, + t + ], e; + }, + useReducer: function (e, t, n) { + var r = Qi(); + return t = void 0 !== n ? n(t) : t, r.memoizedState = r.baseState = t, e = (e = r.queue = { + pending: null, + dispatch: null, + lastRenderedReducer: e, + lastRenderedState: t + }).dispatch = ma.bind(null, Bi, e), [ + r.memoizedState, + e + ]; + }, + useRef: function (e) { + return e = { current: e }, Qi().memoizedState = e; + }, + useState: ea, + useDebugValue: la, + useResponder: Di, + useDeferredValue: function (e, t) { + var n = ea(e), r = n[0], o = n[1]; + return ia(function () { + var n = Ui.suspense; + Ui.suspense = void 0 === t ? null : t; + try { + o(e); + } finally { + Ui.suspense = n; + } + }, [ + e, + t + ]), r; + }, + useTransition: function (e) { + var t = ea(!1), n = t[0]; + return t = t[1], [ + fa(ha.bind(null, t, e), [ + t, + e + ]), + n + ]; + } + }, ya = { + readContext: oi, + useCallback: pa, + useContext: oi, + useEffect: aa, + useImperativeHandle: ua, + useLayoutEffect: sa, + useMemo: da, + useReducer: Xi, + useRef: na, + useState: function () { + return Xi(Ji); + }, + useDebugValue: la, + useResponder: Di, + useDeferredValue: function (e, t) { + var n = Xi(Ji), r = n[0], o = n[1]; + return aa(function () { + var n = Ui.suspense; + Ui.suspense = void 0 === t ? null : t; + try { + o(e); + } finally { + Ui.suspense = n; + } + }, [ + e, + t + ]), r; + }, + useTransition: function (e) { + var t = Xi(Ji), n = t[0]; + return t = t[1], [ + pa(ha.bind(null, t, e), [ + t, + e + ]), + n + ]; + } + }, ba = { + readContext: oi, + useCallback: pa, + useContext: oi, + useEffect: aa, + useImperativeHandle: ua, + useLayoutEffect: sa, + useMemo: da, + useReducer: Zi, + useRef: na, + useState: function () { + return Zi(Ji); + }, + useDebugValue: la, + useResponder: Di, + useDeferredValue: function (e, t) { + var n = Zi(Ji), r = n[0], o = n[1]; + return aa(function () { + var n = Ui.suspense; + Ui.suspense = void 0 === t ? null : t; + try { + o(e); + } finally { + Ui.suspense = n; + } + }, [ + e, + t + ]), r; + }, + useTransition: function (e) { + var t = Zi(Ji), n = t[0]; + return t = t[1], [ + pa(ha.bind(null, t, e), [ + t, + e + ]), + n + ]; + } + }, Ea = null, wa = null, xa = !1; + function Sa(e, t) { + var n = Cc(5, null, null, 0); + n.elementType = 'DELETED', n.type = 'DELETED', n.stateNode = t, n.return = e, n.effectTag = 8, null !== e.lastEffect ? (e.lastEffect.nextEffect = n, e.lastEffect = n) : e.firstEffect = e.lastEffect = n; + } + function Ca(e, t) { + switch (e.tag) { + case 5: + var n = e.type; + return null !== (t = 1 !== t.nodeType || n.toLowerCase() !== t.nodeName.toLowerCase() ? null : t) && (e.stateNode = t, !0); + case 6: + return null !== (t = '' === e.pendingProps || 3 !== t.nodeType ? null : t) && (e.stateNode = t, !0); + case 13: + default: + return !1; + } + } + function ka(e) { + if (xa) { + var t = wa; + if (t) { + var n = t; + if (!Ca(e, t)) { + if (!(t = wn(n.nextSibling)) || !Ca(e, t)) + return e.effectTag = -1025 & e.effectTag | 2, xa = !1, void (Ea = e); + Sa(Ea, n); + } + Ea = e, wa = wn(t.firstChild); + } else + e.effectTag = -1025 & e.effectTag | 2, xa = !1, Ea = e; + } + } + function Ta(e) { + for (e = e.return; null !== e && 5 !== e.tag && 3 !== e.tag && 13 !== e.tag;) + e = e.return; + Ea = e; + } + function _a(e) { + if (e !== Ea) + return !1; + if (!xa) + return Ta(e), xa = !0, !1; + var t = e.type; + if (5 !== e.tag || 'head' !== t && 'body' !== t && !yn(t, e.memoizedProps)) + for (t = wa; t;) + Sa(e, t), t = wn(t.nextSibling); + if (Ta(e), 13 === e.tag) { + if (!(e = null !== (e = e.memoizedState) ? e.dehydrated : null)) + throw Error(a(317)); + e: { + for (e = e.nextSibling, t = 0; e;) { + if (8 === e.nodeType) { + var n = e.data; + if ('/$' === n) { + if (0 === t) { + wa = wn(e.nextSibling); + break e; + } + t--; + } else + '$' !== n && '$!' !== n && '$?' !== n || t++; + } + e = e.nextSibling; + } + wa = null; + } + } else + wa = Ea ? wn(e.stateNode.nextSibling) : null; + return !0; + } + function Pa() { + wa = Ea = null, xa = !1; + } + var Oa = K.ReactCurrentOwner, Ia = !1; + function La(e, t, n, r) { + t.child = null === e ? Ti(t, null, n, r) : ki(t, e.child, n, r); + } + function Aa(e, t, n, r, o) { + n = n.render; + var i = t.ref; + return ri(t, o), r = Yi(e, t, n, r, i, o), null === e || Ia ? (t.effectTag |= 1, La(e, t, r, o), t.child) : (t.updateQueue = e.updateQueue, t.effectTag &= -517, e.expirationTime <= o && (e.expirationTime = 0), Ya(e, t, o)); + } + function Ra(e, t, n, r, o, i) { + if (null === e) { + var a = n.type; + return 'function' !== typeof a || kc(a) || void 0 !== a.defaultProps || null !== n.compare || void 0 !== n.defaultProps ? ((e = _c(n.type, null, r, null, t.mode, i)).ref = t.ref, e.return = t, t.child = e) : (t.tag = 15, t.type = a, Na(e, t, a, r, o, i)); + } + return a = e.child, o < i && (o = a.memoizedProps, (n = null !== (n = n.compare) ? n : Mr)(o, r) && e.ref === t.ref) ? Ya(e, t, i) : (t.effectTag |= 1, (e = Tc(a, r)).ref = t.ref, e.return = t, t.child = e); + } + function Na(e, t, n, r, o, i) { + return null !== e && Mr(e.memoizedProps, r) && e.ref === t.ref && (Ia = !1, o < i) ? (t.expirationTime = e.expirationTime, Ya(e, t, i)) : qa(e, t, n, r, i); + } + function ja(e, t) { + var n = t.ref; + (null === e && null !== n || null !== e && e.ref !== n) && (t.effectTag |= 128); + } + function qa(e, t, n, r, o) { + var i = go(n) ? ho : fo.current; + return i = mo(t, i), ri(t, o), n = Yi(e, t, n, r, i, o), null === e || Ia ? (t.effectTag |= 1, La(e, t, n, o), t.child) : (t.updateQueue = e.updateQueue, t.effectTag &= -517, e.expirationTime <= o && (e.expirationTime = 0), Ya(e, t, o)); + } + function Fa(e, t, n, r, o) { + if (go(n)) { + var i = !0; + Eo(t); + } else + i = !1; + if (ri(t, o), null === t.stateNode) + null !== e && (e.alternate = null, t.alternate = null, t.effectTag |= 2), yi(t, n, r), Ei(t, n, r, o), r = !0; + else if (null === e) { + var a = t.stateNode, s = t.memoizedProps; + a.props = s; + var c = a.context, u = n.contextType; + 'object' === typeof u && null !== u ? u = oi(u) : u = mo(t, u = go(n) ? ho : fo.current); + var l = n.getDerivedStateFromProps, f = 'function' === typeof l || 'function' === typeof a.getSnapshotBeforeUpdate; + f || 'function' !== typeof a.UNSAFE_componentWillReceiveProps && 'function' !== typeof a.componentWillReceiveProps || (s !== r || c !== u) && bi(t, a, r, u), ii = !1; + var p = t.memoizedState; + a.state = p, fi(t, r, a, o), c = t.memoizedState, s !== r || p !== c || po.current || ii ? ('function' === typeof l && (mi(t, n, l, r), c = t.memoizedState), (s = ii || vi(t, n, s, r, p, c, u)) ? (f || 'function' !== typeof a.UNSAFE_componentWillMount && 'function' !== typeof a.componentWillMount || ('function' === typeof a.componentWillMount && a.componentWillMount(), 'function' === typeof a.UNSAFE_componentWillMount && a.UNSAFE_componentWillMount()), 'function' === typeof a.componentDidMount && (t.effectTag |= 4)) : ('function' === typeof a.componentDidMount && (t.effectTag |= 4), t.memoizedProps = r, t.memoizedState = c), a.props = r, a.state = c, a.context = u, r = s) : ('function' === typeof a.componentDidMount && (t.effectTag |= 4), r = !1); + } else + a = t.stateNode, si(e, t), s = t.memoizedProps, a.props = t.type === t.elementType ? s : Qo(t.type, s), c = a.context, 'object' === typeof (u = n.contextType) && null !== u ? u = oi(u) : u = mo(t, u = go(n) ? ho : fo.current), (f = 'function' === typeof (l = n.getDerivedStateFromProps) || 'function' === typeof a.getSnapshotBeforeUpdate) || 'function' !== typeof a.UNSAFE_componentWillReceiveProps && 'function' !== typeof a.componentWillReceiveProps || (s !== r || c !== u) && bi(t, a, r, u), ii = !1, c = t.memoizedState, a.state = c, fi(t, r, a, o), p = t.memoizedState, s !== r || c !== p || po.current || ii ? ('function' === typeof l && (mi(t, n, l, r), p = t.memoizedState), (l = ii || vi(t, n, s, r, c, p, u)) ? (f || 'function' !== typeof a.UNSAFE_componentWillUpdate && 'function' !== typeof a.componentWillUpdate || ('function' === typeof a.componentWillUpdate && a.componentWillUpdate(r, p, u), 'function' === typeof a.UNSAFE_componentWillUpdate && a.UNSAFE_componentWillUpdate(r, p, u)), 'function' === typeof a.componentDidUpdate && (t.effectTag |= 4), 'function' === typeof a.getSnapshotBeforeUpdate && (t.effectTag |= 256)) : ('function' !== typeof a.componentDidUpdate || s === e.memoizedProps && c === e.memoizedState || (t.effectTag |= 4), 'function' !== typeof a.getSnapshotBeforeUpdate || s === e.memoizedProps && c === e.memoizedState || (t.effectTag |= 256), t.memoizedProps = r, t.memoizedState = p), a.props = r, a.state = p, a.context = u, r = l) : ('function' !== typeof a.componentDidUpdate || s === e.memoizedProps && c === e.memoizedState || (t.effectTag |= 4), 'function' !== typeof a.getSnapshotBeforeUpdate || s === e.memoizedProps && c === e.memoizedState || (t.effectTag |= 256), r = !1); + return Da(e, t, n, r, i, o); + } + function Da(e, t, n, r, o, i) { + ja(e, t); + var a = 0 !== (64 & t.effectTag); + if (!r && !a) + return o && wo(t, n, !1), Ya(e, t, i); + r = t.stateNode, Oa.current = t; + var s = a && 'function' !== typeof n.getDerivedStateFromError ? null : r.render(); + return t.effectTag |= 1, null !== e && a ? (t.child = ki(t, e.child, null, i), t.child = ki(t, null, s, i)) : La(e, t, s, i), t.memoizedState = r.state, o && wo(t, n, !0), t.child; + } + function Ma(e) { + var t = e.stateNode; + t.pendingContext ? yo(0, t.pendingContext, t.pendingContext !== t.context) : t.context && yo(0, t.context, !1), Ai(e, t.containerInfo); + } + var Ua, Va, Ba, za = { + dehydrated: null, + retryTime: 0 + }; + function Ga(e, t, n) { + var r, o = t.mode, i = t.pendingProps, a = qi.current, s = !1; + if ((r = 0 !== (64 & t.effectTag)) || (r = 0 !== (2 & a) && (null === e || null !== e.memoizedState)), r ? (s = !0, t.effectTag &= -65) : null !== e && null === e.memoizedState || void 0 === i.fallback || !0 === i.unstable_avoidThisFallback || (a |= 1), uo(qi, 1 & a), null === e) { + if (void 0 !== i.fallback && ka(t), s) { + if (s = i.fallback, (i = Pc(null, o, 0, null)).return = t, 0 === (2 & t.mode)) + for (e = null !== t.memoizedState ? t.child.child : t.child, i.child = e; null !== e;) + e.return = i, e = e.sibling; + return (n = Pc(s, o, n, null)).return = t, i.sibling = n, t.memoizedState = za, t.child = i, n; + } + return o = i.children, t.memoizedState = null, t.child = Ti(t, null, o, n); + } + if (null !== e.memoizedState) { + if (o = (e = e.child).sibling, s) { + if (i = i.fallback, (n = Tc(e, e.pendingProps)).return = t, 0 === (2 & t.mode) && (s = null !== t.memoizedState ? t.child.child : t.child) !== e.child) + for (n.child = s; null !== s;) + s.return = n, s = s.sibling; + return (o = Tc(o, i)).return = t, n.sibling = o, n.childExpirationTime = 0, t.memoizedState = za, t.child = n, o; + } + return n = ki(t, e.child, i.children, n), t.memoizedState = null, t.child = n; + } + if (e = e.child, s) { + if (s = i.fallback, (i = Pc(null, o, 0, null)).return = t, i.child = e, null !== e && (e.return = i), 0 === (2 & t.mode)) + for (e = null !== t.memoizedState ? t.child.child : t.child, i.child = e; null !== e;) + e.return = i, e = e.sibling; + return (n = Pc(s, o, n, null)).return = t, i.sibling = n, n.effectTag |= 2, i.childExpirationTime = 0, t.memoizedState = za, t.child = i, n; + } + return t.memoizedState = null, t.child = ki(t, e, i.children, n); + } + function Ha(e, t) { + e.expirationTime < t && (e.expirationTime = t); + var n = e.alternate; + null !== n && n.expirationTime < t && (n.expirationTime = t), ni(e.return, t); + } + function Wa(e, t, n, r, o, i) { + var a = e.memoizedState; + null === a ? e.memoizedState = { + isBackwards: t, + rendering: null, + renderingStartTime: 0, + last: r, + tail: n, + tailExpiration: 0, + tailMode: o, + lastEffect: i + } : (a.isBackwards = t, a.rendering = null, a.renderingStartTime = 0, a.last = r, a.tail = n, a.tailExpiration = 0, a.tailMode = o, a.lastEffect = i); + } + function $a(e, t, n) { + var r = t.pendingProps, o = r.revealOrder, i = r.tail; + if (La(e, t, r.children, n), 0 !== (2 & (r = qi.current))) + r = 1 & r | 2, t.effectTag |= 64; + else { + if (null !== e && 0 !== (64 & e.effectTag)) + e: + for (e = t.child; null !== e;) { + if (13 === e.tag) + null !== e.memoizedState && Ha(e, n); + else if (19 === e.tag) + Ha(e, n); + else if (null !== e.child) { + e.child.return = e, e = e.child; + continue; + } + if (e === t) + break e; + for (; null === e.sibling;) { + if (null === e.return || e.return === t) + break e; + e = e.return; + } + e.sibling.return = e.return, e = e.sibling; + } + r &= 1; + } + if (uo(qi, r), 0 === (2 & t.mode)) + t.memoizedState = null; + else + switch (o) { + case 'forwards': + for (n = t.child, o = null; null !== n;) + null !== (e = n.alternate) && null === Fi(e) && (o = n), n = n.sibling; + null === (n = o) ? (o = t.child, t.child = null) : (o = n.sibling, n.sibling = null), Wa(t, !1, o, n, i, t.lastEffect); + break; + case 'backwards': + for (n = null, o = t.child, t.child = null; null !== o;) { + if (null !== (e = o.alternate) && null === Fi(e)) { + t.child = o; + break; + } + e = o.sibling, o.sibling = n, n = o, o = e; + } + Wa(t, !0, n, null, i, t.lastEffect); + break; + case 'together': + Wa(t, !1, null, null, void 0, t.lastEffect); + break; + default: + t.memoizedState = null; + } + return t.child; + } + function Ya(e, t, n) { + null !== e && (t.dependencies = e.dependencies); + var r = t.expirationTime; + if (0 !== r && ac(r), t.childExpirationTime < n) + return null; + if (null !== e && t.child !== e.child) + throw Error(a(153)); + if (null !== t.child) { + for (n = Tc(e = t.child, e.pendingProps), t.child = n, n.return = t; null !== e.sibling;) + e = e.sibling, (n = n.sibling = Tc(e, e.pendingProps)).return = t; + n.sibling = null; + } + return t.child; + } + function Qa(e, t) { + switch (e.tailMode) { + case 'hidden': + t = e.tail; + for (var n = null; null !== t;) + null !== t.alternate && (n = t), t = t.sibling; + null === n ? e.tail = null : n.sibling = null; + break; + case 'collapsed': + n = e.tail; + for (var r = null; null !== n;) + null !== n.alternate && (r = n), n = n.sibling; + null === r ? t || null === e.tail ? e.tail = null : e.tail.sibling = null : r.sibling = null; + } + } + function Ka(e, t, n) { + var r = t.pendingProps; + switch (t.tag) { + case 2: + case 16: + case 15: + case 0: + case 11: + case 7: + case 8: + case 12: + case 9: + case 14: + return null; + case 1: + return go(t.type) && vo(), null; + case 3: + return Ri(), co(po), co(fo), (n = t.stateNode).pendingContext && (n.context = n.pendingContext, n.pendingContext = null), null !== e && null !== e.child || !_a(t) || (t.effectTag |= 4), null; + case 5: + ji(t), n = Li(Ii.current); + var i = t.type; + if (null !== e && null != t.stateNode) + Va(e, t, i, r, n), e.ref !== t.ref && (t.effectTag |= 128); + else { + if (!r) { + if (null === t.stateNode) + throw Error(a(166)); + return null; + } + if (e = Li(Pi.current), _a(t)) { + r = t.stateNode, i = t.type; + var s = t.memoizedProps; + switch (r[Cn] = t, r[kn] = s, i) { + case 'iframe': + case 'object': + case 'embed': + $t('load', r); + break; + case 'video': + case 'audio': + for (e = 0; e < Ke.length; e++) + $t(Ke[e], r); + break; + case 'source': + $t('error', r); + break; + case 'img': + case 'image': + case 'link': + $t('error', r), $t('load', r); + break; + case 'form': + $t('reset', r), $t('submit', r); + break; + case 'details': + $t('toggle', r); + break; + case 'input': + Se(r, s), $t('invalid', r), cn(n, 'onChange'); + break; + case 'select': + r._wrapperState = { wasMultiple: !!s.multiple }, $t('invalid', r), cn(n, 'onChange'); + break; + case 'textarea': + Le(r, s), $t('invalid', r), cn(n, 'onChange'); + } + for (var c in (on(i, s), e = null, s)) + if (s.hasOwnProperty(c)) { + var u = s[c]; + 'children' === c ? 'string' === typeof u ? r.textContent !== u && (e = [ + 'children', + u + ]) : 'number' === typeof u && r.textContent !== '' + u && (e = [ + 'children', + '' + u + ]) : C.hasOwnProperty(c) && null != u && cn(n, c); + } + switch (i) { + case 'input': + Ee(r), Te(r, s, !0); + break; + case 'textarea': + Ee(r), Re(r); + break; + case 'select': + case 'option': + break; + default: + 'function' === typeof s.onClick && (r.onclick = un); + } + n = e, t.updateQueue = n, null !== n && (t.effectTag |= 4); + } else { + switch (c = 9 === n.nodeType ? n : n.ownerDocument, e === sn && (e = qe(i)), e === sn ? 'script' === i ? ((e = c.createElement('div')).innerHTML = '', e = e.removeChild(e.firstChild)) : 'string' === typeof r.is ? e = c.createElement(i, { is: r.is }) : (e = c.createElement(i), 'select' === i && (c = e, r.multiple ? c.multiple = !0 : r.size && (c.size = r.size))) : e = c.createElementNS(e, i), e[Cn] = t, e[kn] = r, Ua(e, t), t.stateNode = e, c = an(i, r), i) { + case 'iframe': + case 'object': + case 'embed': + $t('load', e), u = r; + break; + case 'video': + case 'audio': + for (u = 0; u < Ke.length; u++) + $t(Ke[u], e); + u = r; + break; + case 'source': + $t('error', e), u = r; + break; + case 'img': + case 'image': + case 'link': + $t('error', e), $t('load', e), u = r; + break; + case 'form': + $t('reset', e), $t('submit', e), u = r; + break; + case 'details': + $t('toggle', e), u = r; + break; + case 'input': + Se(e, r), u = xe(e, r), $t('invalid', e), cn(n, 'onChange'); + break; + case 'option': + u = Pe(e, r); + break; + case 'select': + e._wrapperState = { wasMultiple: !!r.multiple }, u = o({}, r, { value: void 0 }), $t('invalid', e), cn(n, 'onChange'); + break; + case 'textarea': + Le(e, r), u = Ie(e, r), $t('invalid', e), cn(n, 'onChange'); + break; + default: + u = r; + } + on(i, u); + var l = u; + for (s in l) + if (l.hasOwnProperty(s)) { + var f = l[s]; + 'style' === s ? nn(e, f) : 'dangerouslySetInnerHTML' === s ? null != (f = f ? f.__html : void 0) && Me(e, f) : 'children' === s ? 'string' === typeof f ? ('textarea' !== i || '' !== f) && Ue(e, f) : 'number' === typeof f && Ue(e, '' + f) : 'suppressContentEditableWarning' !== s && 'suppressHydrationWarning' !== s && 'autoFocus' !== s && (C.hasOwnProperty(s) ? null != f && cn(n, s) : null != f && J(e, s, f, c)); + } + switch (i) { + case 'input': + Ee(e), Te(e, r, !1); + break; + case 'textarea': + Ee(e), Re(e); + break; + case 'option': + null != r.value && e.setAttribute('value', '' + ye(r.value)); + break; + case 'select': + e.multiple = !!r.multiple, null != (n = r.value) ? Oe(e, !!r.multiple, n, !1) : null != r.defaultValue && Oe(e, !!r.multiple, r.defaultValue, !0); + break; + default: + 'function' === typeof u.onClick && (e.onclick = un); + } + vn(i, r) && (t.effectTag |= 4); + } + null !== t.ref && (t.effectTag |= 128); + } + return null; + case 6: + if (e && null != t.stateNode) + Ba(0, t, e.memoizedProps, r); + else { + if ('string' !== typeof r && null === t.stateNode) + throw Error(a(166)); + n = Li(Ii.current), Li(Pi.current), _a(t) ? (n = t.stateNode, r = t.memoizedProps, n[Cn] = t, n.nodeValue !== r && (t.effectTag |= 4)) : ((n = (9 === n.nodeType ? n : n.ownerDocument).createTextNode(r))[Cn] = t, t.stateNode = n); + } + return null; + case 13: + return co(qi), r = t.memoizedState, 0 !== (64 & t.effectTag) ? (t.expirationTime = n, t) : (n = null !== r, r = !1, null === e ? void 0 !== t.memoizedProps.fallback && _a(t) : (r = null !== (i = e.memoizedState), n || null === i || null !== (i = e.child.sibling) && (null !== (s = t.firstEffect) ? (t.firstEffect = i, i.nextEffect = s) : (t.firstEffect = t.lastEffect = i, i.nextEffect = null), i.effectTag = 8)), n && !r && 0 !== (2 & t.mode) && (null === e && !0 !== t.memoizedProps.unstable_avoidThisFallback || 0 !== (1 & qi.current) ? _s === Es && (_s = ws) : (_s !== Es && _s !== ws || (_s = xs), 0 !== As && null !== Cs && (Rc(Cs, Ts), Nc(Cs, As)))), (n || r) && (t.effectTag |= 4), null); + case 4: + return Ri(), null; + case 10: + return ti(t), null; + case 17: + return go(t.type) && vo(), null; + case 19: + if (co(qi), null === (r = t.memoizedState)) + return null; + if (i = 0 !== (64 & t.effectTag), null === (s = r.rendering)) { + if (i) + Qa(r, !1); + else if (_s !== Es || null !== e && 0 !== (64 & e.effectTag)) + for (s = t.child; null !== s;) { + if (null !== (e = Fi(s))) { + for (t.effectTag |= 64, Qa(r, !1), null !== (i = e.updateQueue) && (t.updateQueue = i, t.effectTag |= 4), null === r.lastEffect && (t.firstEffect = null), t.lastEffect = r.lastEffect, r = t.child; null !== r;) + s = n, (i = r).effectTag &= 2, i.nextEffect = null, i.firstEffect = null, i.lastEffect = null, null === (e = i.alternate) ? (i.childExpirationTime = 0, i.expirationTime = s, i.child = null, i.memoizedProps = null, i.memoizedState = null, i.updateQueue = null, i.dependencies = null) : (i.childExpirationTime = e.childExpirationTime, i.expirationTime = e.expirationTime, i.child = e.child, i.memoizedProps = e.memoizedProps, i.memoizedState = e.memoizedState, i.updateQueue = e.updateQueue, s = e.dependencies, i.dependencies = null === s ? null : { + expirationTime: s.expirationTime, + firstContext: s.firstContext, + responders: s.responders + }), r = r.sibling; + return uo(qi, 1 & qi.current | 2), t.child; + } + s = s.sibling; + } + } else { + if (!i) + if (null !== (e = Fi(s))) { + if (t.effectTag |= 64, i = !0, null !== (n = e.updateQueue) && (t.updateQueue = n, t.effectTag |= 4), Qa(r, !0), null === r.tail && 'hidden' === r.tailMode && !s.alternate) + return null !== (t = t.lastEffect = r.lastEffect) && (t.nextEffect = null), null; + } else + 2 * Uo() - r.renderingStartTime > r.tailExpiration && 1 < n && (t.effectTag |= 64, i = !0, Qa(r, !1), t.expirationTime = t.childExpirationTime = n - 1); + r.isBackwards ? (s.sibling = t.child, t.child = s) : (null !== (n = r.last) ? n.sibling = s : t.child = s, r.last = s); + } + return null !== r.tail ? (0 === r.tailExpiration && (r.tailExpiration = Uo() + 500), n = r.tail, r.rendering = n, r.tail = n.sibling, r.lastEffect = t.lastEffect, r.renderingStartTime = Uo(), n.sibling = null, t = qi.current, uo(qi, i ? 1 & t | 2 : 1 & t), n) : null; + } + throw Error(a(156, t.tag)); + } + function Ja(e) { + switch (e.tag) { + case 1: + go(e.type) && vo(); + var t = e.effectTag; + return 4096 & t ? (e.effectTag = -4097 & t | 64, e) : null; + case 3: + if (Ri(), co(po), co(fo), 0 !== (64 & (t = e.effectTag))) + throw Error(a(285)); + return e.effectTag = -4097 & t | 64, e; + case 5: + return ji(e), null; + case 13: + return co(qi), 4096 & (t = e.effectTag) ? (e.effectTag = -4097 & t | 64, e) : null; + case 19: + return co(qi), null; + case 4: + return Ri(), null; + case 10: + return ti(e), null; + default: + return null; + } + } + function Xa(e, t) { + return { + value: e, + source: t, + stack: ve(t) + }; + } + Ua = function (e, t) { + for (var n = t.child; null !== n;) { + if (5 === n.tag || 6 === n.tag) + e.appendChild(n.stateNode); + else if (4 !== n.tag && null !== n.child) { + n.child.return = n, n = n.child; + continue; + } + if (n === t) + break; + for (; null === n.sibling;) { + if (null === n.return || n.return === t) + return; + n = n.return; + } + n.sibling.return = n.return, n = n.sibling; + } + }, Va = function (e, t, n, r, i) { + var a = e.memoizedProps; + if (a !== r) { + var s, c, u = t.stateNode; + switch (Li(Pi.current), e = null, n) { + case 'input': + a = xe(u, a), r = xe(u, r), e = []; + break; + case 'option': + a = Pe(u, a), r = Pe(u, r), e = []; + break; + case 'select': + a = o({}, a, { value: void 0 }), r = o({}, r, { value: void 0 }), e = []; + break; + case 'textarea': + a = Ie(u, a), r = Ie(u, r), e = []; + break; + default: + 'function' !== typeof a.onClick && 'function' === typeof r.onClick && (u.onclick = un); + } + for (s in (on(n, r), n = null, a)) + if (!r.hasOwnProperty(s) && a.hasOwnProperty(s) && null != a[s]) + if ('style' === s) + for (c in u = a[s]) + u.hasOwnProperty(c) && (n || (n = {}), n[c] = ''); + else + 'dangerouslySetInnerHTML' !== s && 'children' !== s && 'suppressContentEditableWarning' !== s && 'suppressHydrationWarning' !== s && 'autoFocus' !== s && (C.hasOwnProperty(s) ? e || (e = []) : (e = e || []).push(s, null)); + for (s in r) { + var l = r[s]; + if (u = null != a ? a[s] : void 0, r.hasOwnProperty(s) && l !== u && (null != l || null != u)) + if ('style' === s) + if (u) { + for (c in u) + !u.hasOwnProperty(c) || l && l.hasOwnProperty(c) || (n || (n = {}), n[c] = ''); + for (c in l) + l.hasOwnProperty(c) && u[c] !== l[c] && (n || (n = {}), n[c] = l[c]); + } else + n || (e || (e = []), e.push(s, n)), n = l; + else + 'dangerouslySetInnerHTML' === s ? (l = l ? l.__html : void 0, u = u ? u.__html : void 0, null != l && u !== l && (e = e || []).push(s, l)) : 'children' === s ? u === l || 'string' !== typeof l && 'number' !== typeof l || (e = e || []).push(s, '' + l) : 'suppressContentEditableWarning' !== s && 'suppressHydrationWarning' !== s && (C.hasOwnProperty(s) ? (null != l && cn(i, s), e || u === l || (e = [])) : (e = e || []).push(s, l)); + } + n && (e = e || []).push('style', n), i = e, (t.updateQueue = i) && (t.effectTag |= 4); + } + }, Ba = function (e, t, n, r) { + n !== r && (t.effectTag |= 4); + }; + var Za = 'function' === typeof WeakSet ? WeakSet : Set; + function es(e, t) { + var n = t.source, r = t.stack; + null === r && null !== n && (r = ve(n)), null !== n && ge(n.type), t = t.value, null !== e && 1 === e.tag && ge(e.type); + try { + console.error(t); + } catch (o) { + setTimeout(function () { + throw o; + }); + } + } + function ts(e) { + var t = e.ref; + if (null !== t) + if ('function' === typeof t) + try { + t(null); + } catch (n) { + yc(e, n); + } + else + t.current = null; + } + function ns(e, t) { + switch (t.tag) { + case 0: + case 11: + case 15: + case 22: + return; + case 1: + if (256 & t.effectTag && null !== e) { + var n = e.memoizedProps, r = e.memoizedState; + t = (e = t.stateNode).getSnapshotBeforeUpdate(t.elementType === t.type ? n : Qo(t.type, n), r), e.__reactInternalSnapshotBeforeUpdate = t; + } + return; + case 3: + case 5: + case 6: + case 4: + case 17: + return; + } + throw Error(a(163)); + } + function rs(e, t) { + if (null !== (t = null !== (t = t.updateQueue) ? t.lastEffect : null)) { + var n = t = t.next; + do { + if ((n.tag & e) === e) { + var r = n.destroy; + n.destroy = void 0, void 0 !== r && r(); + } + n = n.next; + } while (n !== t); + } + } + function os(e, t) { + if (null !== (t = null !== (t = t.updateQueue) ? t.lastEffect : null)) { + var n = t = t.next; + do { + if ((n.tag & e) === e) { + var r = n.create; + n.destroy = r(); + } + n = n.next; + } while (n !== t); + } + } + function is(e, t, n) { + switch (n.tag) { + case 0: + case 11: + case 15: + case 22: + return void os(3, n); + case 1: + if (e = n.stateNode, 4 & n.effectTag) + if (null === t) + e.componentDidMount(); + else { + var r = n.elementType === n.type ? t.memoizedProps : Qo(n.type, t.memoizedProps); + e.componentDidUpdate(r, t.memoizedState, e.__reactInternalSnapshotBeforeUpdate); + } + return void (null !== (t = n.updateQueue) && pi(n, t, e)); + case 3: + if (null !== (t = n.updateQueue)) { + if (e = null, null !== n.child) + switch (n.child.tag) { + case 5: + e = n.child.stateNode; + break; + case 1: + e = n.child.stateNode; + } + pi(n, t, e); + } + return; + case 5: + return e = n.stateNode, void (null === t && 4 & n.effectTag && vn(n.type, n.memoizedProps) && e.focus()); + case 6: + case 4: + case 12: + return; + case 13: + return void (null === n.memoizedState && (n = n.alternate, null !== n && (n = n.memoizedState, null !== n && (n = n.dehydrated, null !== n && qt(n))))); + case 19: + case 17: + case 20: + case 21: + return; + } + throw Error(a(163)); + } + function as(e, t, n) { + switch ('function' === typeof xc && xc(t), t.tag) { + case 0: + case 11: + case 14: + case 15: + case 22: + if (null !== (e = t.updateQueue) && null !== (e = e.lastEffect)) { + var r = e.next; + zo(97 < n ? 97 : n, function () { + var e = r; + do { + var n = e.destroy; + if (void 0 !== n) { + var o = t; + try { + n(); + } catch (i) { + yc(o, i); + } + } + e = e.next; + } while (e !== r); + }); + } + break; + case 1: + ts(t), 'function' === typeof (n = t.stateNode).componentWillUnmount && function (e, t) { + try { + t.props = e.memoizedProps, t.state = e.memoizedState, t.componentWillUnmount(); + } catch (n) { + yc(e, n); + } + }(t, n); + break; + case 5: + ts(t); + break; + case 4: + ls(e, t, n); + } + } + function ss(e) { + var t = e.alternate; + e.return = null, e.child = null, e.memoizedState = null, e.updateQueue = null, e.dependencies = null, e.alternate = null, e.firstEffect = null, e.lastEffect = null, e.pendingProps = null, e.memoizedProps = null, e.stateNode = null, null !== t && ss(t); + } + function cs(e) { + return 5 === e.tag || 3 === e.tag || 4 === e.tag; + } + function us(e) { + e: { + for (var t = e.return; null !== t;) { + if (cs(t)) { + var n = t; + break e; + } + t = t.return; + } + throw Error(a(160)); + } + switch (t = n.stateNode, n.tag) { + case 5: + var r = !1; + break; + case 3: + case 4: + t = t.containerInfo, r = !0; + break; + default: + throw Error(a(161)); + } + 16 & n.effectTag && (Ue(t, ''), n.effectTag &= -17); + e: + t: + for (n = e;;) { + for (; null === n.sibling;) { + if (null === n.return || cs(n.return)) { + n = null; + break e; + } + n = n.return; + } + for (n.sibling.return = n.return, n = n.sibling; 5 !== n.tag && 6 !== n.tag && 18 !== n.tag;) { + if (2 & n.effectTag) + continue t; + if (null === n.child || 4 === n.tag) + continue t; + n.child.return = n, n = n.child; + } + if (!(2 & n.effectTag)) { + n = n.stateNode; + break e; + } + } + r ? function e(t, n, r) { + var o = t.tag, i = 5 === o || 6 === o; + if (i) + t = i ? t.stateNode : t.stateNode.instance, n ? 8 === r.nodeType ? r.parentNode.insertBefore(t, n) : r.insertBefore(t, n) : (8 === r.nodeType ? (n = r.parentNode).insertBefore(t, r) : (n = r).appendChild(t), null !== (r = r._reactRootContainer) && void 0 !== r || null !== n.onclick || (n.onclick = un)); + else if (4 !== o && null !== (t = t.child)) + for (e(t, n, r), t = t.sibling; null !== t;) + e(t, n, r), t = t.sibling; + }(e, n, t) : function e(t, n, r) { + var o = t.tag, i = 5 === o || 6 === o; + if (i) + t = i ? t.stateNode : t.stateNode.instance, n ? r.insertBefore(t, n) : r.appendChild(t); + else if (4 !== o && null !== (t = t.child)) + for (e(t, n, r), t = t.sibling; null !== t;) + e(t, n, r), t = t.sibling; + }(e, n, t); + } + function ls(e, t, n) { + for (var r, o, i = t, s = !1;;) { + if (!s) { + s = i.return; + e: + for (;;) { + if (null === s) + throw Error(a(160)); + switch (r = s.stateNode, s.tag) { + case 5: + o = !1; + break e; + case 3: + case 4: + r = r.containerInfo, o = !0; + break e; + } + s = s.return; + } + s = !0; + } + if (5 === i.tag || 6 === i.tag) { + e: + for (var c = e, u = i, l = n, f = u;;) + if (as(c, f, l), null !== f.child && 4 !== f.tag) + f.child.return = f, f = f.child; + else { + if (f === u) + break e; + for (; null === f.sibling;) { + if (null === f.return || f.return === u) + break e; + f = f.return; + } + f.sibling.return = f.return, f = f.sibling; + } + o ? (c = r, u = i.stateNode, 8 === c.nodeType ? c.parentNode.removeChild(u) : c.removeChild(u)) : r.removeChild(i.stateNode); + } else if (4 === i.tag) { + if (null !== i.child) { + r = i.stateNode.containerInfo, o = !0, i.child.return = i, i = i.child; + continue; + } + } else if (as(e, i, n), null !== i.child) { + i.child.return = i, i = i.child; + continue; + } + if (i === t) + break; + for (; null === i.sibling;) { + if (null === i.return || i.return === t) + return; + 4 === (i = i.return).tag && (s = !1); + } + i.sibling.return = i.return, i = i.sibling; + } + } + function fs(e, t) { + switch (t.tag) { + case 0: + case 11: + case 14: + case 15: + case 22: + return void rs(3, t); + case 1: + return; + case 5: + var n = t.stateNode; + if (null != n) { + var r = t.memoizedProps, o = null !== e ? e.memoizedProps : r; + e = t.type; + var i = t.updateQueue; + if (t.updateQueue = null, null !== i) { + for (n[kn] = r, 'input' === e && 'radio' === r.type && null != r.name && Ce(n, r), an(e, o), t = an(e, r), o = 0; o < i.length; o += 2) { + var s = i[o], c = i[o + 1]; + 'style' === s ? nn(n, c) : 'dangerouslySetInnerHTML' === s ? Me(n, c) : 'children' === s ? Ue(n, c) : J(n, s, c, t); + } + switch (e) { + case 'input': + ke(n, r); + break; + case 'textarea': + Ae(n, r); + break; + case 'select': + t = n._wrapperState.wasMultiple, n._wrapperState.wasMultiple = !!r.multiple, null != (e = r.value) ? Oe(n, !!r.multiple, e, !1) : t !== !!r.multiple && (null != r.defaultValue ? Oe(n, !!r.multiple, r.defaultValue, !0) : Oe(n, !!r.multiple, r.multiple ? [] : '', !1)); + } + } + } + return; + case 6: + if (null === t.stateNode) + throw Error(a(162)); + return void (t.stateNode.nodeValue = t.memoizedProps); + case 3: + return void ((t = t.stateNode).hydrate && (t.hydrate = !1, qt(t.containerInfo))); + case 12: + return; + case 13: + if (n = t, null === t.memoizedState ? r = !1 : (r = !0, n = t.child, Ns = Uo()), null !== n) + e: + for (e = n;;) { + if (5 === e.tag) + i = e.stateNode, r ? 'function' === typeof (i = i.style).setProperty ? i.setProperty('display', 'none', 'important') : i.display = 'none' : (i = e.stateNode, o = void 0 !== (o = e.memoizedProps.style) && null !== o && o.hasOwnProperty('display') ? o.display : null, i.style.display = tn('display', o)); + else if (6 === e.tag) + e.stateNode.nodeValue = r ? '' : e.memoizedProps; + else { + if (13 === e.tag && null !== e.memoizedState && null === e.memoizedState.dehydrated) { + (i = e.child.sibling).return = e, e = i; + continue; + } + if (null !== e.child) { + e.child.return = e, e = e.child; + continue; + } + } + if (e === n) + break; + for (; null === e.sibling;) { + if (null === e.return || e.return === n) + break e; + e = e.return; + } + e.sibling.return = e.return, e = e.sibling; + } + return void ps(t); + case 19: + return void ps(t); + case 17: + return; + } + throw Error(a(163)); + } + function ps(e) { + var t = e.updateQueue; + if (null !== t) { + e.updateQueue = null; + var n = e.stateNode; + null === n && (n = e.stateNode = new Za()), t.forEach(function (t) { + var r = Ec.bind(null, e, t); + n.has(t) || (n.add(t), t.then(r, r)); + }); + } + } + var ds = 'function' === typeof WeakMap ? WeakMap : Map; + function hs(e, t, n) { + (n = ci(n, null)).tag = 3, n.payload = { element: null }; + var r = t.value; + return n.callback = function () { + qs || (qs = !0, Fs = r), es(e, t); + }, n; + } + function ms(e, t, n) { + (n = ci(n, null)).tag = 3; + var r = e.type.getDerivedStateFromError; + if ('function' === typeof r) { + var o = t.value; + n.payload = function () { + return es(e, t), r(o); + }; + } + var i = e.stateNode; + return null !== i && 'function' === typeof i.componentDidCatch && (n.callback = function () { + 'function' !== typeof r && (null === Ds ? Ds = new Set([this]) : Ds.add(this), es(e, t)); + var n = t.stack; + this.componentDidCatch(t.value, { componentStack: null !== n ? n : '' }); + }), n; + } + var gs, vs = Math.ceil, ys = K.ReactCurrentDispatcher, bs = K.ReactCurrentOwner, Es = 0, ws = 3, xs = 4, Ss = 0, Cs = null, ks = null, Ts = 0, _s = Es, Ps = null, Os = 1073741823, Is = 1073741823, Ls = null, As = 0, Rs = !1, Ns = 0, js = null, qs = !1, Fs = null, Ds = null, Ms = !1, Us = null, Vs = 90, Bs = null, zs = 0, Gs = null, Hs = 0; + function Ws() { + return 0 !== (48 & Ss) ? 1073741821 - (Uo() / 10 | 0) : 0 !== Hs ? Hs : Hs = 1073741821 - (Uo() / 10 | 0); + } + function $s(e, t, n) { + if (0 === (2 & (t = t.mode))) + return 1073741823; + var r = Vo(); + if (0 === (4 & t)) + return 99 === r ? 1073741823 : 1073741822; + if (0 !== (16 & Ss)) + return Ts; + if (null !== n) + e = Yo(e, 0 | n.timeoutMs || 5000, 250); + else + switch (r) { + case 99: + e = 1073741823; + break; + case 98: + e = Yo(e, 150, 100); + break; + case 97: + case 96: + e = Yo(e, 5000, 250); + break; + case 95: + e = 2; + break; + default: + throw Error(a(326)); + } + return null !== Cs && e === Ts && --e, e; + } + function Ys(e, t) { + if (50 < zs) + throw zs = 0, Gs = null, Error(a(185)); + if (null !== (e = Qs(e, t))) { + var n = Vo(); + 1073741823 === t ? 0 !== (8 & Ss) && 0 === (48 & Ss) ? Zs(e) : (Js(e), 0 === Ss && Wo()) : Js(e), 0 === (4 & Ss) || 98 !== n && 99 !== n || (null === Bs ? Bs = new Map([[ + e, + t + ]]) : (void 0 === (n = Bs.get(e)) || n > t) && Bs.set(e, t)); + } + } + function Qs(e, t) { + e.expirationTime < t && (e.expirationTime = t); + var n = e.alternate; + null !== n && n.expirationTime < t && (n.expirationTime = t); + var r = e.return, o = null; + if (null === r && 3 === e.tag) + o = e.stateNode; + else + for (; null !== r;) { + if (n = r.alternate, r.childExpirationTime < t && (r.childExpirationTime = t), null !== n && n.childExpirationTime < t && (n.childExpirationTime = t), null === r.return && 3 === r.tag) { + o = r.stateNode; + break; + } + r = r.return; + } + return null !== o && (Cs === o && (ac(t), _s === xs && Rc(o, Ts)), Nc(o, t)), o; + } + function Ks(e) { + var t = e.lastExpiredTime; + if (0 !== t) + return t; + if (!Ac(e, t = e.firstPendingTime)) + return t; + var n = e.lastPingedTime; + return 2 >= (e = n > (e = e.nextKnownPendingLevel) ? n : e) && t !== e ? 0 : e; + } + function Js(e) { + if (0 !== e.lastExpiredTime) + e.callbackExpirationTime = 1073741823, e.callbackPriority = 99, e.callbackNode = Ho(Zs.bind(null, e)); + else { + var t = Ks(e), n = e.callbackNode; + if (0 === t) + null !== n && (e.callbackNode = null, e.callbackExpirationTime = 0, e.callbackPriority = 90); + else { + var r = Ws(); + if (1073741823 === t ? r = 99 : 1 === t || 2 === t ? r = 95 : r = 0 >= (r = 10 * (1073741821 - t) - 10 * (1073741821 - r)) ? 99 : 250 >= r ? 98 : 5250 >= r ? 97 : 95, null !== n) { + var o = e.callbackPriority; + if (e.callbackExpirationTime === t && o >= r) + return; + n !== Ro && Co(n); + } + e.callbackExpirationTime = t, e.callbackPriority = r, t = 1073741823 === t ? Ho(Zs.bind(null, e)) : Go(r, Xs.bind(null, e), { timeout: 10 * (1073741821 - t) - Uo() }), e.callbackNode = t; + } + } + } + function Xs(e, t) { + if (Hs = 0, t) + return jc(e, t = Ws()), Js(e), null; + var n = Ks(e); + if (0 !== n) { + if (t = e.callbackNode, 0 !== (48 & Ss)) + throw Error(a(327)); + if (mc(), e === Cs && n === Ts || nc(e, n), null !== ks) { + var r = Ss; + Ss |= 16; + for (var o = oc();;) + try { + cc(); + break; + } catch (c) { + rc(e, c); + } + if (ei(), Ss = r, ys.current = o, 1 === _s) + throw t = Ps, nc(e, n), Rc(e, n), Js(e), t; + if (null === ks) + switch (o = e.finishedWork = e.current.alternate, e.finishedExpirationTime = n, r = _s, Cs = null, r) { + case Es: + case 1: + throw Error(a(345)); + case 2: + jc(e, 2 < n ? 2 : n); + break; + case ws: + if (Rc(e, n), n === (r = e.lastSuspendedTime) && (e.nextKnownPendingLevel = fc(o)), 1073741823 === Os && 10 < (o = Ns + 500 - Uo())) { + if (Rs) { + var i = e.lastPingedTime; + if (0 === i || i >= n) { + e.lastPingedTime = n, nc(e, n); + break; + } + } + if (0 !== (i = Ks(e)) && i !== n) + break; + if (0 !== r && r !== n) { + e.lastPingedTime = r; + break; + } + e.timeoutHandle = bn(pc.bind(null, e), o); + break; + } + pc(e); + break; + case xs: + if (Rc(e, n), n === (r = e.lastSuspendedTime) && (e.nextKnownPendingLevel = fc(o)), Rs && (0 === (o = e.lastPingedTime) || o >= n)) { + e.lastPingedTime = n, nc(e, n); + break; + } + if (0 !== (o = Ks(e)) && o !== n) + break; + if (0 !== r && r !== n) { + e.lastPingedTime = r; + break; + } + if (1073741823 !== Is ? r = 10 * (1073741821 - Is) - Uo() : 1073741823 === Os ? r = 0 : (r = 10 * (1073741821 - Os) - 5000, 0 > (r = (o = Uo()) - r) && (r = 0), (n = 10 * (1073741821 - n) - o) < (r = (120 > r ? 120 : 480 > r ? 480 : 1080 > r ? 1080 : 1920 > r ? 1920 : 3000 > r ? 3000 : 4320 > r ? 4320 : 1960 * vs(r / 1960)) - r) && (r = n)), 10 < r) { + e.timeoutHandle = bn(pc.bind(null, e), r); + break; + } + pc(e); + break; + case 5: + if (1073741823 !== Os && null !== Ls) { + i = Os; + var s = Ls; + if (0 >= (r = 0 | s.busyMinDurationMs) ? r = 0 : (o = 0 | s.busyDelayMs, r = (i = Uo() - (10 * (1073741821 - i) - (0 | s.timeoutMs || 5000))) <= o ? 0 : o + r - i), 10 < r) { + Rc(e, n), e.timeoutHandle = bn(pc.bind(null, e), r); + break; + } + } + pc(e); + break; + default: + throw Error(a(329)); + } + if (Js(e), e.callbackNode === t) + return Xs.bind(null, e); + } + } + return null; + } + function Zs(e) { + var t = e.lastExpiredTime; + if (t = 0 !== t ? t : 1073741823, 0 !== (48 & Ss)) + throw Error(a(327)); + if (mc(), e === Cs && t === Ts || nc(e, t), null !== ks) { + var n = Ss; + Ss |= 16; + for (var r = oc();;) + try { + sc(); + break; + } catch (o) { + rc(e, o); + } + if (ei(), Ss = n, ys.current = r, 1 === _s) + throw n = Ps, nc(e, t), Rc(e, t), Js(e), n; + if (null !== ks) + throw Error(a(261)); + e.finishedWork = e.current.alternate, e.finishedExpirationTime = t, Cs = null, pc(e), Js(e); + } + return null; + } + function ec(e, t) { + var n = Ss; + Ss |= 1; + try { + return e(t); + } finally { + 0 === (Ss = n) && Wo(); + } + } + function tc(e, t) { + var n = Ss; + Ss &= -2, Ss |= 8; + try { + return e(t); + } finally { + 0 === (Ss = n) && Wo(); + } + } + function nc(e, t) { + e.finishedWork = null, e.finishedExpirationTime = 0; + var n = e.timeoutHandle; + if (-1 !== n && (e.timeoutHandle = -1, En(n)), null !== ks) + for (n = ks.return; null !== n;) { + var r = n; + switch (r.tag) { + case 1: + null !== (r = r.type.childContextTypes) && void 0 !== r && vo(); + break; + case 3: + Ri(), co(po), co(fo); + break; + case 5: + ji(r); + break; + case 4: + Ri(); + break; + case 13: + case 19: + co(qi); + break; + case 10: + ti(r); + } + n = n.return; + } + Cs = e, ks = Tc(e.current, null), Ts = t, _s = Es, Ps = null, Is = Os = 1073741823, Ls = null, As = 0, Rs = !1; + } + function rc(e, t) { + for (;;) { + try { + if (ei(), Mi.current = ga, Hi) + for (var n = Bi.memoizedState; null !== n;) { + var r = n.queue; + null !== r && (r.pending = null), n = n.next; + } + if (Vi = 0, Gi = zi = Bi = null, Hi = !1, null === ks || null === ks.return) + return _s = 1, Ps = t, ks = null; + e: { + var o = e, i = ks.return, a = ks, s = t; + if (t = Ts, a.effectTag |= 2048, a.firstEffect = a.lastEffect = null, null !== s && 'object' === typeof s && 'function' === typeof s.then) { + var c = s; + if (0 === (2 & a.mode)) { + var u = a.alternate; + u ? (a.updateQueue = u.updateQueue, a.memoizedState = u.memoizedState, a.expirationTime = u.expirationTime) : (a.updateQueue = null, a.memoizedState = null); + } + var l = 0 !== (1 & qi.current), f = i; + do { + var p; + if (p = 13 === f.tag) { + var d = f.memoizedState; + if (null !== d) + p = null !== d.dehydrated; + else { + var h = f.memoizedProps; + p = void 0 !== h.fallback && (!0 !== h.unstable_avoidThisFallback || !l); + } + } + if (p) { + var m = f.updateQueue; + if (null === m) { + var g = new Set(); + g.add(c), f.updateQueue = g; + } else + m.add(c); + if (0 === (2 & f.mode)) { + if (f.effectTag |= 64, a.effectTag &= -2981, 1 === a.tag) + if (null === a.alternate) + a.tag = 17; + else { + var v = ci(1073741823, null); + v.tag = 2, ui(a, v); + } + a.expirationTime = 1073741823; + break e; + } + s = void 0, a = t; + var y = o.pingCache; + if (null === y ? (y = o.pingCache = new ds(), s = new Set(), y.set(c, s)) : void 0 === (s = y.get(c)) && (s = new Set(), y.set(c, s)), !s.has(a)) { + s.add(a); + var b = bc.bind(null, o, c, a); + c.then(b, b); + } + f.effectTag |= 4096, f.expirationTime = t; + break e; + } + f = f.return; + } while (null !== f); + s = Error((ge(a.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display.' + ve(a)); + } + 5 !== _s && (_s = 2), s = Xa(s, a), f = i; + do { + switch (f.tag) { + case 3: + c = s, f.effectTag |= 4096, f.expirationTime = t, li(f, hs(f, c, t)); + break e; + case 1: + c = s; + var E = f.type, w = f.stateNode; + if (0 === (64 & f.effectTag) && ('function' === typeof E.getDerivedStateFromError || null !== w && 'function' === typeof w.componentDidCatch && (null === Ds || !Ds.has(w)))) { + f.effectTag |= 4096, f.expirationTime = t, li(f, ms(f, c, t)); + break e; + } + } + f = f.return; + } while (null !== f); + } + ks = lc(ks); + } catch (x) { + t = x; + continue; + } + break; + } + } + function oc() { + var e = ys.current; + return ys.current = ga, null === e ? ga : e; + } + function ic(e, t) { + e < Os && 2 < e && (Os = e), null !== t && e < Is && 2 < e && (Is = e, Ls = t); + } + function ac(e) { + e > As && (As = e); + } + function sc() { + for (; null !== ks;) + ks = uc(ks); + } + function cc() { + for (; null !== ks && !No();) + ks = uc(ks); + } + function uc(e) { + var t = gs(e.alternate, e, Ts); + return e.memoizedProps = e.pendingProps, null === t && (t = lc(e)), bs.current = null, t; + } + function lc(e) { + ks = e; + do { + var t = ks.alternate; + if (e = ks.return, 0 === (2048 & ks.effectTag)) { + if (t = Ka(t, ks, Ts), 1 === Ts || 1 !== ks.childExpirationTime) { + for (var n = 0, r = ks.child; null !== r;) { + var o = r.expirationTime, i = r.childExpirationTime; + o > n && (n = o), i > n && (n = i), r = r.sibling; + } + ks.childExpirationTime = n; + } + if (null !== t) + return t; + null !== e && 0 === (2048 & e.effectTag) && (null === e.firstEffect && (e.firstEffect = ks.firstEffect), null !== ks.lastEffect && (null !== e.lastEffect && (e.lastEffect.nextEffect = ks.firstEffect), e.lastEffect = ks.lastEffect), 1 < ks.effectTag && (null !== e.lastEffect ? e.lastEffect.nextEffect = ks : e.firstEffect = ks, e.lastEffect = ks)); + } else { + if (null !== (t = Ja(ks))) + return t.effectTag &= 2047, t; + null !== e && (e.firstEffect = e.lastEffect = null, e.effectTag |= 2048); + } + if (null !== (t = ks.sibling)) + return t; + ks = e; + } while (null !== ks); + return _s === Es && (_s = 5), null; + } + function fc(e) { + var t = e.expirationTime; + return t > (e = e.childExpirationTime) ? t : e; + } + function pc(e) { + var t = Vo(); + return zo(99, dc.bind(null, e, t)), null; + } + function dc(e, t) { + do { + mc(); + } while (null !== Us); + if (0 !== (48 & Ss)) + throw Error(a(327)); + var n = e.finishedWork, r = e.finishedExpirationTime; + if (null === n) + return null; + if (e.finishedWork = null, e.finishedExpirationTime = 0, n === e.current) + throw Error(a(177)); + e.callbackNode = null, e.callbackExpirationTime = 0, e.callbackPriority = 90, e.nextKnownPendingLevel = 0; + var o = fc(n); + if (e.firstPendingTime = o, r <= e.lastSuspendedTime ? e.firstSuspendedTime = e.lastSuspendedTime = e.nextKnownPendingLevel = 0 : r <= e.firstSuspendedTime && (e.firstSuspendedTime = r - 1), r <= e.lastPingedTime && (e.lastPingedTime = 0), r <= e.lastExpiredTime && (e.lastExpiredTime = 0), e === Cs && (ks = Cs = null, Ts = 0), 1 < n.effectTag ? null !== n.lastEffect ? (n.lastEffect.nextEffect = n, o = n.firstEffect) : o = n : o = n.firstEffect, null !== o) { + var i = Ss; + Ss |= 32, bs.current = null, mn = Wt; + var s = dn(); + if (hn(s)) { + if ('selectionStart' in s) + var c = { + start: s.selectionStart, + end: s.selectionEnd + }; + else + e: { + var u = (c = (c = s.ownerDocument) && c.defaultView || window).getSelection && c.getSelection(); + if (u && 0 !== u.rangeCount) { + c = u.anchorNode; + var l = u.anchorOffset, f = u.focusNode; + u = u.focusOffset; + try { + c.nodeType, f.nodeType; + } catch (T) { + c = null; + break e; + } + var p = 0, d = -1, h = -1, m = 0, g = 0, v = s, y = null; + t: + for (;;) { + for (var b; v !== c || 0 !== l && 3 !== v.nodeType || (d = p + l), v !== f || 0 !== u && 3 !== v.nodeType || (h = p + u), 3 === v.nodeType && (p += v.nodeValue.length), null !== (b = v.firstChild);) + y = v, v = b; + for (;;) { + if (v === s) + break t; + if (y === c && ++m === l && (d = p), y === f && ++g === u && (h = p), null !== (b = v.nextSibling)) + break; + y = (v = y).parentNode; + } + v = b; + } + c = -1 === d || -1 === h ? null : { + start: d, + end: h + }; + } else + c = null; + } + c = c || { + start: 0, + end: 0 + }; + } else + c = null; + gn = { + activeElementDetached: null, + focusedElem: s, + selectionRange: c + }, Wt = !1, js = o; + do { + try { + hc(); + } catch (T) { + if (null === js) + throw Error(a(330)); + yc(js, T), js = js.nextEffect; + } + } while (null !== js); + js = o; + do { + try { + for (s = e, c = t; null !== js;) { + var E = js.effectTag; + if (16 & E && Ue(js.stateNode, ''), 128 & E) { + var w = js.alternate; + if (null !== w) { + var x = w.ref; + null !== x && ('function' === typeof x ? x(null) : x.current = null); + } + } + switch (1038 & E) { + case 2: + us(js), js.effectTag &= -3; + break; + case 6: + us(js), js.effectTag &= -3, fs(js.alternate, js); + break; + case 1024: + js.effectTag &= -1025; + break; + case 1028: + js.effectTag &= -1025, fs(js.alternate, js); + break; + case 4: + fs(js.alternate, js); + break; + case 8: + ls(s, l = js, c), ss(l); + } + js = js.nextEffect; + } + } catch (T) { + if (null === js) + throw Error(a(330)); + yc(js, T), js = js.nextEffect; + } + } while (null !== js); + if (x = gn, w = dn(), E = x.focusedElem, c = x.selectionRange, w !== E && E && E.ownerDocument && function e(t, n) { + return !(!t || !n) && (t === n || (!t || 3 !== t.nodeType) && (n && 3 === n.nodeType ? e(t, n.parentNode) : 'contains' in t ? t.contains(n) : !!t.compareDocumentPosition && !!(16 & t.compareDocumentPosition(n)))); + }(E.ownerDocument.documentElement, E)) { + null !== c && hn(E) && (w = c.start, void 0 === (x = c.end) && (x = w), 'selectionStart' in E ? (E.selectionStart = w, E.selectionEnd = Math.min(x, E.value.length)) : (x = (w = E.ownerDocument || document) && w.defaultView || window).getSelection && (x = x.getSelection(), l = E.textContent.length, s = Math.min(c.start, l), c = void 0 === c.end ? s : Math.min(c.end, l), !x.extend && s > c && (l = c, c = s, s = l), l = pn(E, s), f = pn(E, c), l && f && (1 !== x.rangeCount || x.anchorNode !== l.node || x.anchorOffset !== l.offset || x.focusNode !== f.node || x.focusOffset !== f.offset) && ((w = w.createRange()).setStart(l.node, l.offset), x.removeAllRanges(), s > c ? (x.addRange(w), x.extend(f.node, f.offset)) : (w.setEnd(f.node, f.offset), x.addRange(w))))), w = []; + for (x = E; x = x.parentNode;) + 1 === x.nodeType && w.push({ + element: x, + left: x.scrollLeft, + top: x.scrollTop + }); + for ('function' === typeof E.focus && E.focus(), E = 0; E < w.length; E++) + (x = w[E]).element.scrollLeft = x.left, x.element.scrollTop = x.top; + } + Wt = !!mn, gn = mn = null, e.current = n, js = o; + do { + try { + for (E = e; null !== js;) { + var S = js.effectTag; + if (36 & S && is(E, js.alternate, js), 128 & S) { + w = void 0; + var C = js.ref; + if (null !== C) { + var k = js.stateNode; + switch (js.tag) { + case 5: + w = k; + break; + default: + w = k; + } + 'function' === typeof C ? C(w) : C.current = w; + } + } + js = js.nextEffect; + } + } catch (T) { + if (null === js) + throw Error(a(330)); + yc(js, T), js = js.nextEffect; + } + } while (null !== js); + js = null, jo(), Ss = i; + } else + e.current = n; + if (Ms) + Ms = !1, Us = e, Vs = t; + else + for (js = o; null !== js;) + t = js.nextEffect, js.nextEffect = null, js = t; + if (0 === (t = e.firstPendingTime) && (Ds = null), 1073741823 === t ? e === Gs ? zs++ : (zs = 0, Gs = e) : zs = 0, 'function' === typeof wc && wc(n.stateNode, r), Js(e), qs) + throw qs = !1, e = Fs, Fs = null, e; + return 0 !== (8 & Ss) || Wo(), null; + } + function hc() { + for (; null !== js;) { + var e = js.effectTag; + 0 !== (256 & e) && ns(js.alternate, js), 0 === (512 & e) || Ms || (Ms = !0, Go(97, function () { + return mc(), null; + })), js = js.nextEffect; + } + } + function mc() { + if (90 !== Vs) { + var e = 97 < Vs ? 97 : Vs; + return Vs = 90, zo(e, gc); + } + } + function gc() { + if (null === Us) + return !1; + var e = Us; + if (Us = null, 0 !== (48 & Ss)) + throw Error(a(331)); + var t = Ss; + for (Ss |= 32, e = e.current.firstEffect; null !== e;) { + try { + var n = e; + if (0 !== (512 & n.effectTag)) + switch (n.tag) { + case 0: + case 11: + case 15: + case 22: + rs(5, n), os(5, n); + } + } catch (r) { + if (null === e) + throw Error(a(330)); + yc(e, r); + } + n = e.nextEffect, e.nextEffect = null, e = n; + } + return Ss = t, Wo(), !0; + } + function vc(e, t, n) { + ui(e, t = hs(e, t = Xa(n, t), 1073741823)), null !== (e = Qs(e, 1073741823)) && Js(e); + } + function yc(e, t) { + if (3 === e.tag) + vc(e, e, t); + else + for (var n = e.return; null !== n;) { + if (3 === n.tag) { + vc(n, e, t); + break; + } + if (1 === n.tag) { + var r = n.stateNode; + if ('function' === typeof n.type.getDerivedStateFromError || 'function' === typeof r.componentDidCatch && (null === Ds || !Ds.has(r))) { + ui(n, e = ms(n, e = Xa(t, e), 1073741823)), null !== (n = Qs(n, 1073741823)) && Js(n); + break; + } + } + n = n.return; + } + } + function bc(e, t, n) { + var r = e.pingCache; + null !== r && r.delete(t), Cs === e && Ts === n ? _s === xs || _s === ws && 1073741823 === Os && Uo() - Ns < 500 ? nc(e, Ts) : Rs = !0 : Ac(e, n) && (0 !== (t = e.lastPingedTime) && t < n || (e.lastPingedTime = n, Js(e))); + } + function Ec(e, t) { + var n = e.stateNode; + null !== n && n.delete(t), 0 === (t = 0) && (t = $s(t = Ws(), e, null)), null !== (e = Qs(e, t)) && Js(e); + } + gs = function (e, t, n) { + var r = t.expirationTime; + if (null !== e) { + var o = t.pendingProps; + if (e.memoizedProps !== o || po.current) + Ia = !0; + else { + if (r < n) { + switch (Ia = !1, t.tag) { + case 3: + Ma(t), Pa(); + break; + case 5: + if (Ni(t), 4 & t.mode && 1 !== n && o.hidden) + return t.expirationTime = t.childExpirationTime = 1, null; + break; + case 1: + go(t.type) && Eo(t); + break; + case 4: + Ai(t, t.stateNode.containerInfo); + break; + case 10: + r = t.memoizedProps.value, o = t.type._context, uo(Ko, o._currentValue), o._currentValue = r; + break; + case 13: + if (null !== t.memoizedState) + return 0 !== (r = t.child.childExpirationTime) && r >= n ? Ga(e, t, n) : (uo(qi, 1 & qi.current), null !== (t = Ya(e, t, n)) ? t.sibling : null); + uo(qi, 1 & qi.current); + break; + case 19: + if (r = t.childExpirationTime >= n, 0 !== (64 & e.effectTag)) { + if (r) + return $a(e, t, n); + t.effectTag |= 64; + } + if (null !== (o = t.memoizedState) && (o.rendering = null, o.tail = null), uo(qi, qi.current), !r) + return null; + } + return Ya(e, t, n); + } + Ia = !1; + } + } else + Ia = !1; + switch (t.expirationTime = 0, t.tag) { + case 2: + if (r = t.type, null !== e && (e.alternate = null, t.alternate = null, t.effectTag |= 2), e = t.pendingProps, o = mo(t, fo.current), ri(t, n), o = Yi(null, t, r, e, o, n), t.effectTag |= 1, 'object' === typeof o && null !== o && 'function' === typeof o.render && void 0 === o.$$typeof) { + if (t.tag = 1, t.memoizedState = null, t.updateQueue = null, go(r)) { + var i = !0; + Eo(t); + } else + i = !1; + t.memoizedState = null !== o.state && void 0 !== o.state ? o.state : null, ai(t); + var s = r.getDerivedStateFromProps; + 'function' === typeof s && mi(t, r, s, e), o.updater = gi, t.stateNode = o, o._reactInternalFiber = t, Ei(t, r, e, n), t = Da(null, t, r, !0, i, n); + } else + t.tag = 0, La(null, t, o, n), t = t.child; + return t; + case 16: + e: { + if (o = t.elementType, null !== e && (e.alternate = null, t.alternate = null, t.effectTag |= 2), e = t.pendingProps, function (e) { + if (-1 === e._status) { + e._status = 0; + var t = e._ctor; + t = t(), e._result = t, t.then(function (t) { + 0 === e._status && (t = t.default, e._status = 1, e._result = t); + }, function (t) { + 0 === e._status && (e._status = 2, e._result = t); + }); + } + }(o), 1 !== o._status) + throw o._result; + switch (o = o._result, t.type = o, i = t.tag = function (e) { + if ('function' === typeof e) + return kc(e) ? 1 : 0; + if (void 0 !== e && null !== e) { + if ((e = e.$$typeof) === ce) + return 11; + if (e === fe) + return 14; + } + return 2; + }(o), e = Qo(o, e), i) { + case 0: + t = qa(null, t, o, e, n); + break e; + case 1: + t = Fa(null, t, o, e, n); + break e; + case 11: + t = Aa(null, t, o, e, n); + break e; + case 14: + t = Ra(null, t, o, Qo(o.type, e), r, n); + break e; + } + throw Error(a(306, o, '')); + } + return t; + case 0: + return r = t.type, o = t.pendingProps, qa(e, t, r, o = t.elementType === r ? o : Qo(r, o), n); + case 1: + return r = t.type, o = t.pendingProps, Fa(e, t, r, o = t.elementType === r ? o : Qo(r, o), n); + case 3: + if (Ma(t), r = t.updateQueue, null === e || null === r) + throw Error(a(282)); + if (r = t.pendingProps, o = null !== (o = t.memoizedState) ? o.element : null, si(e, t), fi(t, r, null, n), (r = t.memoizedState.element) === o) + Pa(), t = Ya(e, t, n); + else { + if ((o = t.stateNode.hydrate) && (wa = wn(t.stateNode.containerInfo.firstChild), Ea = t, o = xa = !0), o) + for (n = Ti(t, null, r, n), t.child = n; n;) + n.effectTag = -3 & n.effectTag | 1024, n = n.sibling; + else + La(e, t, r, n), Pa(); + t = t.child; + } + return t; + case 5: + return Ni(t), null === e && ka(t), r = t.type, o = t.pendingProps, i = null !== e ? e.memoizedProps : null, s = o.children, yn(r, o) ? s = null : null !== i && yn(r, i) && (t.effectTag |= 16), ja(e, t), 4 & t.mode && 1 !== n && o.hidden ? (t.expirationTime = t.childExpirationTime = 1, t = null) : (La(e, t, s, n), t = t.child), t; + case 6: + return null === e && ka(t), null; + case 13: + return Ga(e, t, n); + case 4: + return Ai(t, t.stateNode.containerInfo), r = t.pendingProps, null === e ? t.child = ki(t, null, r, n) : La(e, t, r, n), t.child; + case 11: + return r = t.type, o = t.pendingProps, Aa(e, t, r, o = t.elementType === r ? o : Qo(r, o), n); + case 7: + return La(e, t, t.pendingProps, n), t.child; + case 8: + case 12: + return La(e, t, t.pendingProps.children, n), t.child; + case 10: + e: { + r = t.type._context, o = t.pendingProps, s = t.memoizedProps, i = o.value; + var c = t.type._context; + if (uo(Ko, c._currentValue), c._currentValue = i, null !== s) + if (c = s.value, 0 === (i = Fr(c, i) ? 0 : 0 | ('function' === typeof r._calculateChangedBits ? r._calculateChangedBits(c, i) : 1073741823))) { + if (s.children === o.children && !po.current) { + t = Ya(e, t, n); + break e; + } + } else + for (null !== (c = t.child) && (c.return = t); null !== c;) { + var u = c.dependencies; + if (null !== u) { + s = c.child; + for (var l = u.firstContext; null !== l;) { + if (l.context === r && 0 !== (l.observedBits & i)) { + 1 === c.tag && ((l = ci(n, null)).tag = 2, ui(c, l)), c.expirationTime < n && (c.expirationTime = n), null !== (l = c.alternate) && l.expirationTime < n && (l.expirationTime = n), ni(c.return, n), u.expirationTime < n && (u.expirationTime = n); + break; + } + l = l.next; + } + } else + s = 10 === c.tag && c.type === t.type ? null : c.child; + if (null !== s) + s.return = c; + else + for (s = c; null !== s;) { + if (s === t) { + s = null; + break; + } + if (null !== (c = s.sibling)) { + c.return = s.return, s = c; + break; + } + s = s.return; + } + c = s; + } + La(e, t, o.children, n), t = t.child; + } + return t; + case 9: + return o = t.type, r = (i = t.pendingProps).children, ri(t, n), r = r(o = oi(o, i.unstable_observedBits)), t.effectTag |= 1, La(e, t, r, n), t.child; + case 14: + return i = Qo(o = t.type, t.pendingProps), Ra(e, t, o, i = Qo(o.type, i), r, n); + case 15: + return Na(e, t, t.type, t.pendingProps, r, n); + case 17: + return r = t.type, o = t.pendingProps, o = t.elementType === r ? o : Qo(r, o), null !== e && (e.alternate = null, t.alternate = null, t.effectTag |= 2), t.tag = 1, go(r) ? (e = !0, Eo(t)) : e = !1, ri(t, n), yi(t, r, o), Ei(t, r, o, n), Da(null, t, r, !0, e, n); + case 19: + return $a(e, t, n); + } + throw Error(a(156, t.tag)); + }; + var wc = null, xc = null; + function Sc(e, t, n, r) { + this.tag = e, this.key = n, this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null, this.index = 0, this.ref = null, this.pendingProps = t, this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null, this.mode = r, this.effectTag = 0, this.lastEffect = this.firstEffect = this.nextEffect = null, this.childExpirationTime = this.expirationTime = 0, this.alternate = null; + } + function Cc(e, t, n, r) { + return new Sc(e, t, n, r); + } + function kc(e) { + return !(!(e = e.prototype) || !e.isReactComponent); + } + function Tc(e, t) { + var n = e.alternate; + return null === n ? ((n = Cc(e.tag, t, e.key, e.mode)).elementType = e.elementType, n.type = e.type, n.stateNode = e.stateNode, n.alternate = e, e.alternate = n) : (n.pendingProps = t, n.effectTag = 0, n.nextEffect = null, n.firstEffect = null, n.lastEffect = null), n.childExpirationTime = e.childExpirationTime, n.expirationTime = e.expirationTime, n.child = e.child, n.memoizedProps = e.memoizedProps, n.memoizedState = e.memoizedState, n.updateQueue = e.updateQueue, t = e.dependencies, n.dependencies = null === t ? null : { + expirationTime: t.expirationTime, + firstContext: t.firstContext, + responders: t.responders + }, n.sibling = e.sibling, n.index = e.index, n.ref = e.ref, n; + } + function _c(e, t, n, r, o, i) { + var s = 2; + if (r = e, 'function' === typeof e) + kc(e) && (s = 1); + else if ('string' === typeof e) + s = 5; + else + e: + switch (e) { + case ne: + return Pc(n.children, o, i, t); + case se: + s = 8, o |= 7; + break; + case re: + s = 8, o |= 1; + break; + case oe: + return (e = Cc(12, n, t, 8 | o)).elementType = oe, e.type = oe, e.expirationTime = i, e; + case ue: + return (e = Cc(13, n, t, o)).type = ue, e.elementType = ue, e.expirationTime = i, e; + case le: + return (e = Cc(19, n, t, o)).elementType = le, e.expirationTime = i, e; + default: + if ('object' === typeof e && null !== e) + switch (e.$$typeof) { + case ie: + s = 10; + break e; + case ae: + s = 9; + break e; + case ce: + s = 11; + break e; + case fe: + s = 14; + break e; + case pe: + s = 16, r = null; + break e; + case de: + s = 22; + break e; + } + throw Error(a(130, null == e ? e : typeof e, '')); + } + return (t = Cc(s, n, t, o)).elementType = e, t.type = r, t.expirationTime = i, t; + } + function Pc(e, t, n, r) { + return (e = Cc(7, e, r, t)).expirationTime = n, e; + } + function Oc(e, t, n) { + return (e = Cc(6, e, null, t)).expirationTime = n, e; + } + function Ic(e, t, n) { + return (t = Cc(4, null !== e.children ? e.children : [], e.key, t)).expirationTime = n, t.stateNode = { + containerInfo: e.containerInfo, + pendingChildren: null, + implementation: e.implementation + }, t; + } + function Lc(e, t, n) { + this.tag = t, this.current = null, this.containerInfo = e, this.pingCache = this.pendingChildren = null, this.finishedExpirationTime = 0, this.finishedWork = null, this.timeoutHandle = -1, this.pendingContext = this.context = null, this.hydrate = n, this.callbackNode = null, this.callbackPriority = 90, this.lastExpiredTime = this.lastPingedTime = this.nextKnownPendingLevel = this.lastSuspendedTime = this.firstSuspendedTime = this.firstPendingTime = 0; + } + function Ac(e, t) { + var n = e.firstSuspendedTime; + return e = e.lastSuspendedTime, 0 !== n && n >= t && e <= t; + } + function Rc(e, t) { + var n = e.firstSuspendedTime, r = e.lastSuspendedTime; + n < t && (e.firstSuspendedTime = t), (r > t || 0 === n) && (e.lastSuspendedTime = t), t <= e.lastPingedTime && (e.lastPingedTime = 0), t <= e.lastExpiredTime && (e.lastExpiredTime = 0); + } + function Nc(e, t) { + t > e.firstPendingTime && (e.firstPendingTime = t); + var n = e.firstSuspendedTime; + 0 !== n && (t >= n ? e.firstSuspendedTime = e.lastSuspendedTime = e.nextKnownPendingLevel = 0 : t >= e.lastSuspendedTime && (e.lastSuspendedTime = t + 1), t > e.nextKnownPendingLevel && (e.nextKnownPendingLevel = t)); + } + function jc(e, t) { + var n = e.lastExpiredTime; + (0 === n || n > t) && (e.lastExpiredTime = t); + } + function qc(e, t, n, r) { + var o = t.current, i = Ws(), s = di.suspense; + i = $s(i, o, s); + e: + if (n) { + t: { + if (Ze(n = n._reactInternalFiber) !== n || 1 !== n.tag) + throw Error(a(170)); + var c = n; + do { + switch (c.tag) { + case 3: + c = c.stateNode.context; + break t; + case 1: + if (go(c.type)) { + c = c.stateNode.__reactInternalMemoizedMergedChildContext; + break t; + } + } + c = c.return; + } while (null !== c); + throw Error(a(171)); + } + if (1 === n.tag) { + var u = n.type; + if (go(u)) { + n = bo(n, u, c); + break e; + } + } + n = c; + } else + n = lo; + return null === t.context ? t.context = n : t.pendingContext = n, (t = ci(i, s)).payload = { element: e }, null !== (r = void 0 === r ? null : r) && (t.callback = r), ui(o, t), Ys(o, i), i; + } + function Fc(e) { + if (!(e = e.current).child) + return null; + switch (e.child.tag) { + case 5: + default: + return e.child.stateNode; + } + } + function Dc(e, t) { + null !== (e = e.memoizedState) && null !== e.dehydrated && e.retryTime < t && (e.retryTime = t); + } + function Mc(e, t) { + Dc(e, t), (e = e.alternate) && Dc(e, t); + } + function Uc(e, t, n) { + var r = new Lc(e, t, n = null != n && !0 === n.hydrate), o = Cc(3, null, null, 2 === t ? 7 : 1 === t ? 3 : 0); + r.current = o, o.stateNode = r, ai(o), e[Tn] = r.current, n && 0 !== t && function (e, t) { + var n = Xe(t); + Tt.forEach(function (e) { + ht(e, t, n); + }), _t.forEach(function (e) { + ht(e, t, n); + }); + }(0, 9 === e.nodeType ? e : e.ownerDocument), this._internalRoot = r; + } + function Vc(e) { + return !(!e || 1 !== e.nodeType && 9 !== e.nodeType && 11 !== e.nodeType && (8 !== e.nodeType || ' react-mount-point-unstable ' !== e.nodeValue)); + } + function Bc(e, t, n, r, o) { + var i = n._reactRootContainer; + if (i) { + var a = i._internalRoot; + if ('function' === typeof o) { + var s = o; + o = function () { + var e = Fc(a); + s.call(e); + }; + } + qc(t, a, e, o); + } else { + if (i = n._reactRootContainer = function (e, t) { + if (t || (t = !(!(t = e ? 9 === e.nodeType ? e.documentElement : e.firstChild : null) || 1 !== t.nodeType || !t.hasAttribute('data-reactroot'))), !t) + for (var n; n = e.lastChild;) + e.removeChild(n); + return new Uc(e, 0, t ? { hydrate: !0 } : void 0); + }(n, r), a = i._internalRoot, 'function' === typeof o) { + var c = o; + o = function () { + var e = Fc(a); + c.call(e); + }; + } + tc(function () { + qc(t, a, e, o); + }); + } + return Fc(a); + } + function zc(e, t, n) { + var r = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null; + return { + $$typeof: te, + key: null == r ? null : '' + r, + children: e, + containerInfo: t, + implementation: n + }; + } + function Gc(e, t) { + var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null; + if (!Vc(t)) + throw Error(a(200)); + return zc(e, t, null, n); + } + Uc.prototype.render = function (e) { + qc(e, this._internalRoot, null, null); + }, Uc.prototype.unmount = function () { + var e = this._internalRoot, t = e.containerInfo; + qc(null, e, null, function () { + t[Tn] = null; + }); + }, mt = function (e) { + if (13 === e.tag) { + var t = Yo(Ws(), 150, 100); + Ys(e, t), Mc(e, t); + } + }, gt = function (e) { + 13 === e.tag && (Ys(e, 3), Mc(e, 3)); + }, vt = function (e) { + if (13 === e.tag) { + var t = Ws(); + Ys(e, t = $s(t, e, null)), Mc(e, t); + } + }, P = function (e, t, n) { + switch (t) { + case 'input': + if (ke(e, n), t = n.name, 'radio' === n.type && null != t) { + for (n = e; n.parentNode;) + n = n.parentNode; + for (n = n.querySelectorAll('input[name=' + JSON.stringify('' + t) + '][type="radio"]'), t = 0; t < n.length; t++) { + var r = n[t]; + if (r !== e && r.form === e.form) { + var o = In(r); + if (!o) + throw Error(a(90)); + we(r), ke(r, o); + } + } + } + break; + case 'textarea': + Ae(e, n); + break; + case 'select': + null != (t = n.value) && Oe(e, !!n.multiple, t, !1); + } + }, N = ec, j = function (e, t, n, r, o) { + var i = Ss; + Ss |= 4; + try { + return zo(98, e.bind(null, t, n, r, o)); + } finally { + 0 === (Ss = i) && Wo(); + } + }, q = function () { + 0 === (49 & Ss) && (function () { + if (null !== Bs) { + var e = Bs; + Bs = null, e.forEach(function (e, t) { + jc(t, e), Js(t); + }), Wo(); + } + }(), mc()); + }, F = function (e, t) { + var n = Ss; + Ss |= 2; + try { + return e(t); + } finally { + 0 === (Ss = n) && Wo(); + } + }; + var Hc = { + Events: [ + Pn, + On, + In, + T, + S, + Fn, + function (e) { + ot(e, qn); + }, + A, + R, + Jt, + st, + mc, + { current: !1 } + ] + }; + !function (e) { + var t = e.findFiberByHostInstance; + (function (e) { + if ('undefined' === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) + return !1; + var t = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (t.isDisabled || !t.supportsFiber) + return !0; + try { + var n = t.inject(e); + wc = function (e) { + try { + t.onCommitFiberRoot(n, e, void 0, 64 === (64 & e.current.effectTag)); + } catch (r) { + } + }, xc = function (e) { + try { + t.onCommitFiberUnmount(n, e); + } catch (r) { + } + }; + } catch (r) { + } + }(o({}, e, { + overrideHookState: null, + overrideProps: null, + setSuspenseHandler: null, + scheduleUpdate: null, + currentDispatcherRef: K.ReactCurrentDispatcher, + findHostInstanceByFiber: function (e) { + return null === (e = nt(e)) ? null : e.stateNode; + }, + findFiberByHostInstance: function (e) { + return t ? t(e) : null; + }, + findHostInstancesForRefresh: null, + scheduleRefresh: null, + scheduleRoot: null, + setRefreshHandler: null, + getCurrentFiber: null + }))); + }({ + findFiberByHostInstance: _n, + bundleType: 0, + version: '16.14.0', + rendererPackageName: 'react-dom' + }), t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Hc, t.createPortal = Gc, t.findDOMNode = function (e) { + if (null == e) + return null; + if (1 === e.nodeType) + return e; + var t = e._reactInternalFiber; + if (void 0 === t) { + if ('function' === typeof e.render) + throw Error(a(188)); + throw Error(a(268, Object.keys(e))); + } + return e = null === (e = nt(t)) ? null : e.stateNode; + }, t.flushSync = function (e, t) { + if (0 !== (48 & Ss)) + throw Error(a(187)); + var n = Ss; + Ss |= 1; + try { + return zo(99, e.bind(null, t)); + } finally { + Ss = n, Wo(); + } + }, t.hydrate = function (e, t, n) { + if (!Vc(t)) + throw Error(a(200)); + return Bc(null, e, t, !0, n); + }, t.render = function (e, t, n) { + if (!Vc(t)) + throw Error(a(200)); + return Bc(null, e, t, !1, n); + }, t.unmountComponentAtNode = function (e) { + if (!Vc(e)) + throw Error(a(40)); + return !!e._reactRootContainer && (tc(function () { + Bc(null, null, e, !1, function () { + e._reactRootContainer = null, e[Tn] = null; + }); + }), !0); + }, t.unstable_batchedUpdates = ec, t.unstable_createPortal = function (e, t) { + return Gc(e, t, 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null); + }, t.unstable_renderSubtreeIntoContainer = function (e, t, n, r) { + if (!Vc(n)) + throw Error(a(200)); + if (null == e || void 0 === e._reactInternalFiber) + throw Error(a(38)); + return Bc(e, t, n, !1, r); + }, t.version = '16.14.0'; + }, + function (e, t, n) { + 'use strict'; + e.exports = n(263); + }, + function (e, t, n) { + 'use strict'; + var r, o, i, a, s; + if ('undefined' === typeof window || 'function' !== typeof MessageChannel) { + var c = null, u = null, l = function e() { + if (null !== c) + try { + var n = t.unstable_now(); + c(!0, n), c = null; + } catch (r) { + throw setTimeout(e, 0), r; + } + }, f = Date.now(); + t.unstable_now = function () { + return Date.now() - f; + }, r = function (e) { + null !== c ? setTimeout(r, 0, e) : (c = e, setTimeout(l, 0)); + }, o = function (e, t) { + u = setTimeout(e, t); + }, i = function () { + clearTimeout(u); + }, a = function () { + return !1; + }, s = t.unstable_forceFrameRate = function () { + }; + } else { + var p = window.performance, d = window.Date, h = window.setTimeout, m = window.clearTimeout; + if ('undefined' !== typeof console) { + var g = window.cancelAnimationFrame; + 'function' !== typeof window.requestAnimationFrame && console.error('This browser doesn\'t support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills'), 'function' !== typeof g && console.error('This browser doesn\'t support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills'); + } + if ('object' === typeof p && 'function' === typeof p.now) + t.unstable_now = function () { + return p.now(); + }; + else { + var v = d.now(); + t.unstable_now = function () { + return d.now() - v; + }; + } + var y = !1, b = null, E = -1, w = 5, x = 0; + a = function () { + return t.unstable_now() >= x; + }, s = function () { + }, t.unstable_forceFrameRate = function (e) { + 0 > e || 125 < e ? console.error('forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported') : w = 0 < e ? Math.floor(1000 / e) : 5; + }; + var S = new MessageChannel(), C = S.port2; + S.port1.onmessage = function () { + if (null !== b) { + var e = t.unstable_now(); + x = e + w; + try { + b(!0, e) ? C.postMessage(null) : (y = !1, b = null); + } catch (n) { + throw C.postMessage(null), n; + } + } else + y = !1; + }, r = function (e) { + b = e, y || (y = !0, C.postMessage(null)); + }, o = function (e, n) { + E = h(function () { + e(t.unstable_now()); + }, n); + }, i = function () { + m(E), E = -1; + }; + } + function k(e, t) { + var n = e.length; + e.push(t); + e: + for (;;) { + var r = n - 1 >>> 1, o = e[r]; + if (!(void 0 !== o && 0 < P(o, t))) + break e; + e[r] = t, e[n] = o, n = r; + } + } + function T(e) { + return void 0 === (e = e[0]) ? null : e; + } + function _(e) { + var t = e[0]; + if (void 0 !== t) { + var n = e.pop(); + if (n !== t) { + e[0] = n; + e: + for (var r = 0, o = e.length; r < o;) { + var i = 2 * (r + 1) - 1, a = e[i], s = i + 1, c = e[s]; + if (void 0 !== a && 0 > P(a, n)) + void 0 !== c && 0 > P(c, a) ? (e[r] = c, e[s] = n, r = s) : (e[r] = a, e[i] = n, r = i); + else { + if (!(void 0 !== c && 0 > P(c, n))) + break e; + e[r] = c, e[s] = n, r = s; + } + } + } + return t; + } + return null; + } + function P(e, t) { + var n = e.sortIndex - t.sortIndex; + return 0 !== n ? n : e.id - t.id; + } + var O = [], I = [], L = 1, A = null, R = 3, N = !1, j = !1, q = !1; + function F(e) { + for (var t = T(I); null !== t;) { + if (null === t.callback) + _(I); + else { + if (!(t.startTime <= e)) + break; + _(I), t.sortIndex = t.expirationTime, k(O, t); + } + t = T(I); + } + } + function D(e) { + if (q = !1, F(e), !j) + if (null !== T(O)) + j = !0, r(M); + else { + var t = T(I); + null !== t && o(D, t.startTime - e); + } + } + function M(e, n) { + j = !1, q && (q = !1, i()), N = !0; + var r = R; + try { + for (F(n), A = T(O); null !== A && (!(A.expirationTime > n) || e && !a());) { + var s = A.callback; + if (null !== s) { + A.callback = null, R = A.priorityLevel; + var c = s(A.expirationTime <= n); + n = t.unstable_now(), 'function' === typeof c ? A.callback = c : A === T(O) && _(O), F(n); + } else + _(O); + A = T(O); + } + if (null !== A) + var u = !0; + else { + var l = T(I); + null !== l && o(D, l.startTime - n), u = !1; + } + return u; + } finally { + A = null, R = r, N = !1; + } + } + function U(e) { + switch (e) { + case 1: + return -1; + case 2: + return 250; + case 5: + return 1073741823; + case 4: + return 10000; + default: + return 5000; + } + } + var V = s; + t.unstable_IdlePriority = 5, t.unstable_ImmediatePriority = 1, t.unstable_LowPriority = 4, t.unstable_NormalPriority = 3, t.unstable_Profiling = null, t.unstable_UserBlockingPriority = 2, t.unstable_cancelCallback = function (e) { + e.callback = null; + }, t.unstable_continueExecution = function () { + j || N || (j = !0, r(M)); + }, t.unstable_getCurrentPriorityLevel = function () { + return R; + }, t.unstable_getFirstCallbackNode = function () { + return T(O); + }, t.unstable_next = function (e) { + switch (R) { + case 1: + case 2: + case 3: + var t = 3; + break; + default: + t = R; + } + var n = R; + R = t; + try { + return e(); + } finally { + R = n; + } + }, t.unstable_pauseExecution = function () { + }, t.unstable_requestPaint = V, t.unstable_runWithPriority = function (e, t) { + switch (e) { + case 1: + case 2: + case 3: + case 4: + case 5: + break; + default: + e = 3; + } + var n = R; + R = e; + try { + return t(); + } finally { + R = n; + } + }, t.unstable_scheduleCallback = function (e, n, a) { + var s = t.unstable_now(); + if ('object' === typeof a && null !== a) { + var c = a.delay; + c = 'number' === typeof c && 0 < c ? s + c : s, a = 'number' === typeof a.timeout ? a.timeout : U(e); + } else + a = U(e), c = s; + return e = { + id: L++, + callback: n, + priorityLevel: e, + startTime: c, + expirationTime: a = c + a, + sortIndex: -1 + }, c > s ? (e.sortIndex = c, k(I, e), null === T(O) && e === T(I) && (q ? i() : q = !0, o(D, c - s))) : (e.sortIndex = a, k(O, e), j || N || (j = !0, r(M))), e; + }, t.unstable_shouldYield = function () { + var e = t.unstable_now(); + F(e); + var n = T(O); + return n !== A && null !== A && null !== n && null !== n.callback && n.startTime <= e && n.expirationTime < A.expirationTime || a(); + }, t.unstable_wrapCallback = function (e) { + var t = R; + return function () { + var n = R; + R = t; + try { + return e.apply(this, arguments); + } finally { + R = n; + } + }; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(265); + function o() { + } + function i() { + } + i.resetWarningCache = o, e.exports = function () { + function e(e, t, n, o, i, a) { + if (a !== r) { + var s = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types'); + throw s.name = 'Invariant Violation', s; + } + } + function t() { + return e; + } + e.isRequired = e; + var n = { + array: e, + bool: e, + func: e, + number: e, + object: e, + string: e, + symbol: e, + any: e, + arrayOf: t, + element: e, + elementType: e, + instanceOf: t, + node: e, + objectOf: t, + oneOf: t, + oneOfType: t, + shape: t, + exact: t, + checkPropTypes: i, + resetWarningCache: o + }; + return n.PropTypes = n, n; + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + }, + function (e, t, n) { + 'use strict'; + var r = 'function' === typeof Symbol && Symbol.for, o = r ? Symbol.for('react.element') : 60103, i = r ? Symbol.for('react.portal') : 60106, a = r ? Symbol.for('react.fragment') : 60107, s = r ? Symbol.for('react.strict_mode') : 60108, c = r ? Symbol.for('react.profiler') : 60114, u = r ? Symbol.for('react.provider') : 60109, l = r ? Symbol.for('react.context') : 60110, f = r ? Symbol.for('react.async_mode') : 60111, p = r ? Symbol.for('react.concurrent_mode') : 60111, d = r ? Symbol.for('react.forward_ref') : 60112, h = r ? Symbol.for('react.suspense') : 60113, m = r ? Symbol.for('react.suspense_list') : 60120, g = r ? Symbol.for('react.memo') : 60115, v = r ? Symbol.for('react.lazy') : 60116, y = r ? Symbol.for('react.block') : 60121, b = r ? Symbol.for('react.fundamental') : 60117, E = r ? Symbol.for('react.responder') : 60118, w = r ? Symbol.for('react.scope') : 60119; + function x(e) { + if ('object' === typeof e && null !== e) { + var t = e.$$typeof; + switch (t) { + case o: + switch (e = e.type) { + case f: + case p: + case a: + case c: + case s: + case h: + return e; + default: + switch (e = e && e.$$typeof) { + case l: + case d: + case v: + case g: + case u: + return e; + default: + return t; + } + } + case i: + return t; + } + } + } + function S(e) { + return x(e) === p; + } + t.AsyncMode = f, t.ConcurrentMode = p, t.ContextConsumer = l, t.ContextProvider = u, t.Element = o, t.ForwardRef = d, t.Fragment = a, t.Lazy = v, t.Memo = g, t.Portal = i, t.Profiler = c, t.StrictMode = s, t.Suspense = h, t.isAsyncMode = function (e) { + return S(e) || x(e) === f; + }, t.isConcurrentMode = S, t.isContextConsumer = function (e) { + return x(e) === l; + }, t.isContextProvider = function (e) { + return x(e) === u; + }, t.isElement = function (e) { + return 'object' === typeof e && null !== e && e.$$typeof === o; + }, t.isForwardRef = function (e) { + return x(e) === d; + }, t.isFragment = function (e) { + return x(e) === a; + }, t.isLazy = function (e) { + return x(e) === v; + }, t.isMemo = function (e) { + return x(e) === g; + }, t.isPortal = function (e) { + return x(e) === i; + }, t.isProfiler = function (e) { + return x(e) === c; + }, t.isStrictMode = function (e) { + return x(e) === s; + }, t.isSuspense = function (e) { + return x(e) === h; + }, t.isValidElementType = function (e) { + return 'string' === typeof e || 'function' === typeof e || e === a || e === p || e === c || e === s || e === h || e === m || 'object' === typeof e && null !== e && (e.$$typeof === v || e.$$typeof === g || e.$$typeof === u || e.$$typeof === l || e.$$typeof === d || e.$$typeof === b || e.$$typeof === E || e.$$typeof === w || e.$$typeof === y); + }, t.typeOf = x; + }, + function (e, t) { + e.exports = function (e) { + if (!e.webpackPolyfill) { + var t = Object.create(e); + t.children || (t.children = []), Object.defineProperty(t, 'loaded', { + enumerable: !0, + get: function () { + return t.l; + } + }), Object.defineProperty(t, 'id', { + enumerable: !0, + get: function () { + return t.i; + } + }), Object.defineProperty(t, 'exports', { enumerable: !0 }), t.webpackPolyfill = 1; + } + return t; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16), o = n(120), i = n(269), a = n(126); + function s(e) { + var t = new i(e), n = o(i.prototype.request, t); + return r.extend(n, i.prototype, t), r.extend(n, t), n; + } + var c = s(n(123)); + c.Axios = i, c.create = function (e) { + return s(a(c.defaults, e)); + }, c.Cancel = n(127), c.CancelToken = n(282), c.isCancel = n(122), c.all = function (e) { + return Promise.all(e); + }, c.spread = n(283), e.exports = c, e.exports.default = c; + }, + function (e, t, n) { + 'use strict'; + var r = n(16), o = n(121), i = n(270), a = n(271), s = n(126); + function c(e) { + this.defaults = e, this.interceptors = { + request: new i(), + response: new i() + }; + } + c.prototype.request = function (e) { + 'string' === typeof e ? (e = arguments[1] || {}).url = arguments[0] : e = e || {}, (e = s(this.defaults, e)).method ? e.method = e.method.toLowerCase() : this.defaults.method ? e.method = this.defaults.method.toLowerCase() : e.method = 'get'; + var t = [ + a, + void 0 + ], n = Promise.resolve(e); + for (this.interceptors.request.forEach(function (e) { + t.unshift(e.fulfilled, e.rejected); + }), this.interceptors.response.forEach(function (e) { + t.push(e.fulfilled, e.rejected); + }); t.length;) + n = n.then(t.shift(), t.shift()); + return n; + }, c.prototype.getUri = function (e) { + return e = s(this.defaults, e), o(e.url, e.params, e.paramsSerializer).replace(/^\?/, ''); + }, r.forEach([ + 'delete', + 'get', + 'head', + 'options' + ], function (e) { + c.prototype[e] = function (t, n) { + return this.request(r.merge(n || {}, { + method: e, + url: t + })); + }; + }), r.forEach([ + 'post', + 'put', + 'patch' + ], function (e) { + c.prototype[e] = function (t, n, o) { + return this.request(r.merge(o || {}, { + method: e, + url: t, + data: n + })); + }; + }), e.exports = c; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + function o() { + this.handlers = []; + } + o.prototype.use = function (e, t) { + return this.handlers.push({ + fulfilled: e, + rejected: t + }), this.handlers.length - 1; + }, o.prototype.eject = function (e) { + this.handlers[e] && (this.handlers[e] = null); + }, o.prototype.forEach = function (e) { + r.forEach(this.handlers, function (t) { + null !== t && e(t); + }); + }, e.exports = o; + }, + function (e, t, n) { + 'use strict'; + var r = n(16), o = n(272), i = n(122), a = n(123); + function s(e) { + e.cancelToken && e.cancelToken.throwIfRequested(); + } + e.exports = function (e) { + return s(e), e.headers = e.headers || {}, e.data = o(e.data, e.headers, e.transformRequest), e.headers = r.merge(e.headers.common || {}, e.headers[e.method] || {}, e.headers), r.forEach([ + 'delete', + 'get', + 'head', + 'post', + 'put', + 'patch', + 'common' + ], function (t) { + delete e.headers[t]; + }), (e.adapter || a.adapter)(e).then(function (t) { + return s(e), t.data = o(t.data, t.headers, e.transformResponse), t; + }, function (t) { + return i(t) || (s(e), t && t.response && (t.response.data = o(t.response.data, t.response.headers, e.transformResponse))), Promise.reject(t); + }); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + e.exports = function (e, t, n) { + return r.forEach(n, function (n) { + e = n(e, t); + }), e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + e.exports = function (e, t) { + r.forEach(e, function (n, r) { + r !== t && r.toUpperCase() === t.toUpperCase() && (e[t] = n, delete e[r]); + }); + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(125); + e.exports = function (e, t, n) { + var o = n.config.validateStatus; + !o || o(n.status) ? e(n) : t(r('Request failed with status code ' + n.status, n.config, null, n.request, n)); + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e, t, n, r, o) { + return e.config = t, n && (e.code = n), e.request = r, e.response = o, e.isAxiosError = !0, e.toJSON = function () { + return { + message: this.message, + name: this.name, + description: this.description, + number: this.number, + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + config: this.config, + code: this.code + }; + }, e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(277), o = n(278); + e.exports = function (e, t) { + return e && !r(t) ? o(e, t) : t; + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e) { + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e); + }; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e, t) { + return t ? e.replace(/\/+$/, '') + '/' + t.replace(/^\/+/, '') : e; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16), o = [ + 'age', + 'authorization', + 'content-length', + 'content-type', + 'etag', + 'expires', + 'from', + 'host', + 'if-modified-since', + 'if-unmodified-since', + 'last-modified', + 'location', + 'max-forwards', + 'proxy-authorization', + 'referer', + 'retry-after', + 'user-agent' + ]; + e.exports = function (e) { + var t, n, i, a = {}; + return e ? (r.forEach(e.split('\n'), function (e) { + if (i = e.indexOf(':'), t = r.trim(e.substr(0, i)).toLowerCase(), n = r.trim(e.substr(i + 1)), t) { + if (a[t] && o.indexOf(t) >= 0) + return; + a[t] = 'set-cookie' === t ? (a[t] ? a[t] : []).concat([n]) : a[t] ? a[t] + ', ' + n : n; + } + }), a) : a; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + e.exports = r.isStandardBrowserEnv() ? function () { + var e, t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement('a'); + function o(e) { + var r = e; + return t && (n.setAttribute('href', r), r = n.href), n.setAttribute('href', r), { + href: n.href, + protocol: n.protocol ? n.protocol.replace(/:$/, '') : '', + host: n.host, + search: n.search ? n.search.replace(/^\?/, '') : '', + hash: n.hash ? n.hash.replace(/^#/, '') : '', + hostname: n.hostname, + port: n.port, + pathname: '/' === n.pathname.charAt(0) ? n.pathname : '/' + n.pathname + }; + } + return e = o(window.location.href), function (t) { + var n = r.isString(t) ? o(t) : t; + return n.protocol === e.protocol && n.host === e.host; + }; + }() : function () { + return !0; + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(16); + e.exports = r.isStandardBrowserEnv() ? { + write: function (e, t, n, o, i, a) { + var s = []; + s.push(e + '=' + encodeURIComponent(t)), r.isNumber(n) && s.push('expires=' + new Date(n).toGMTString()), r.isString(o) && s.push('path=' + o), r.isString(i) && s.push('domain=' + i), !0 === a && s.push('secure'), document.cookie = s.join('; '); + }, + read: function (e) { + var t = document.cookie.match(new RegExp('(^|;\\s*)(' + e + ')=([^;]*)')); + return t ? decodeURIComponent(t[3]) : null; + }, + remove: function (e) { + this.write(e, '', Date.now() - 86400000); + } + } : { + write: function () { + }, + read: function () { + return null; + }, + remove: function () { + } + }; + }, + function (e, t, n) { + 'use strict'; + var r = n(127); + function o(e) { + if ('function' !== typeof e) + throw new TypeError('executor must be a function.'); + var t; + this.promise = new Promise(function (e) { + t = e; + }); + var n = this; + e(function (e) { + n.reason || (n.reason = new r(e), t(n.reason)); + }); + } + o.prototype.throwIfRequested = function () { + if (this.reason) + throw this.reason; + }, o.source = function () { + var e; + return { + token: new o(function (t) { + e = t; + }), + cancel: e + }; + }, e.exports = o; + }, + function (e, t, n) { + 'use strict'; + e.exports = function (e) { + return function (t) { + return e.apply(null, t); + }; + }; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t) { + var n = e.call(this, t) || this; + return n.name = 'DecodingError', n; + } + return r(t, e), t; + }(Error); + t.DecodingError = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t) { + var n = e.call(this, t) || this; + return n.name = 'EncodingError', n; + } + return r(t, e), t; + }(Error); + t.EncodingError = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t) { + var n = e.call(this, t) || this; + return n.name = 'GVLError', n; + } + return r(t, e), t; + }(Error); + t.GVLError = o; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = function (e) { + function t(t, n, r) { + void 0 === r && (r = ''); + var o = e.call(this, 'invalid value ' + n + ' passed for ' + t + ' ' + r) || this; + return o.name = 'TCModelError', o; + } + return r(t, e), t; + }(Error); + t.TCModelError = o; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = function () { + function e() { + } + return e.prototype.has = function (t) { + return e.langSet.has(t); + }, e.prototype.forEach = function (t) { + e.langSet.forEach(t); + }, Object.defineProperty(e.prototype, 'size', { + get: function () { + return e.langSet.size; + }, + enumerable: !0, + configurable: !0 + }), e.langSet = new Set([ + 'BG', + 'CA', + 'CS', + 'DA', + 'DE', + 'EL', + 'EN', + 'ES', + 'ET', + 'FI', + 'FR', + 'HR', + 'HU', + 'IT', + 'JA', + 'LT', + 'LV', + 'MT', + 'NL', + 'NO', + 'PL', + 'PT', + 'RO', + 'RU', + 'SK', + 'SL', + 'SV', + 'TR', + 'ZH' + ]), e; + }(); + t.ConsentLanguages = r; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(); + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(135), i = n(133), a = n(79), s = function (e) { + function t() { + var t = null !== e && e.apply(this, arguments) || this; + return t.bitLength = 0, t.map = new Map(), t; + } + return r(t, e), t.prototype.has = function (e) { + return this.map.has(e); + }, t.prototype.isOkToHave = function (e, t, n) { + var r, o = !0; + if (null === (r = this.gvl) || void 0 === r ? void 0 : r.vendors) { + var i = this.gvl.vendors[n]; + if (i) + if (e === a.RestrictionType.NOT_ALLOWED) + o = i.legIntPurposes.includes(t) || i.purposes.includes(t); + else if (i.flexiblePurposes.length) + switch (e) { + case a.RestrictionType.REQUIRE_CONSENT: + o = i.flexiblePurposes.includes(t) && i.legIntPurposes.includes(t); + break; + case a.RestrictionType.REQUIRE_LI: + o = i.flexiblePurposes.includes(t) && i.purposes.includes(t); + } + else + o = !1; + else + o = !1; + } + return o; + }, t.prototype.add = function (e, t) { + if (this.isOkToHave(t.restrictionType, t.purposeId, e)) { + var n = t.hash; + this.has(n) || (this.map.set(n, new i.BinarySearchTree()), this.bitLength = 0), this.map.get(n).add(e); + } + }, t.prototype.getVendors = function (e) { + var t = []; + if (e) { + var n = e.hash; + this.has(n) && (t = this.map.get(n).get()); + } else { + var r = new Set(); + this.map.forEach(function (e) { + e.get().forEach(function (e) { + r.add(e); + }); + }), t = Array.from(r); + } + return t; + }, t.prototype.getRestrictionType = function (e, t) { + var n; + return this.getRestrictions(e).forEach(function (e) { + e.purposeId === t && (void 0 === n || n > e.restrictionType) && (n = e.restrictionType); + }), n; + }, t.prototype.vendorHasRestriction = function (e, t) { + for (var n = !1, r = this.getRestrictions(e), o = 0; o < r.length && !n; o++) + n = t.isSameAs(r[o]); + return n; + }, t.prototype.getMaxVendorId = function () { + var e = 0; + return this.map.forEach(function (t) { + e = Math.max(t.max(), e); + }), e; + }, t.prototype.getRestrictions = function (e) { + var t = []; + return this.map.forEach(function (n, r) { + e ? n.contains(e) && t.push(o.PurposeRestriction.unHash(r)) : t.push(o.PurposeRestriction.unHash(r)); + }), t; + }, t.prototype.getPurposes = function () { + var e = new Set(); + return this.map.forEach(function (t, n) { + e.add(o.PurposeRestriction.unHash(n).purposeId); + }), Array.from(e); + }, t.prototype.remove = function (e, t) { + var n = t.hash, r = this.map.get(n); + r && (r.remove(e), r.isEmpty() && (this.map.delete(n), this.bitLength = 0)); + }, Object.defineProperty(t.prototype, 'gvl', { + get: function () { + return this.gvl_; + }, + set: function (e) { + var t = this; + this.gvl_ || (this.gvl_ = e, this.map.forEach(function (e, n) { + var r = o.PurposeRestriction.unHash(n); + e.get().forEach(function (n) { + t.isOkToHave(r.restrictionType, r.purposeId, n) || e.remove(n); + }); + })); + }, + enumerable: !0, + configurable: !0 + }), t.prototype.isEmpty = function () { + return 0 === this.map.size; + }, Object.defineProperty(t.prototype, 'numRestrictions', { + get: function () { + return this.map.size; + }, + enumerable: !0, + configurable: !0 + }), t; + }(n(29).Cloneable); + t.PurposeRestrictionVector = s; + }, + function (e, t, n) { + 'use strict'; + var r; + Object.defineProperty(t, '__esModule', { value: !0 }); + var o = n(136), i = function () { + function e() { + } + return e.ID_TO_KEY = [ + o.Segment.CORE, + o.Segment.VENDORS_DISCLOSED, + o.Segment.VENDORS_ALLOWED, + o.Segment.PUBLISHER_TC + ], e.KEY_TO_ID = ((r = {})[o.Segment.CORE] = 0, r[o.Segment.VENDORS_DISCLOSED] = 1, r[o.Segment.VENDORS_ALLOWED] = 2, r[o.Segment.PUBLISHER_TC] = 3, r), e; + }(); + t.SegmentIDs = i; + }, + function (e, t, n) { + 'use strict'; + var r = this && this.__extends || function () { + var e = function (t, n) { + return (e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (e, t) { + e.__proto__ = t; + } || function (e, t) { + for (var n in t) + t.hasOwnProperty(n) && (e[n] = t[n]); + })(t, n); + }; + return function (t, n) { + function r() { + this.constructor = t; + } + e(t, n), t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype, new r()); + }; + }(), o = this && this.__generator || function (e, t) { + var n, r, o, i, a = { + label: 0, + sent: function () { + if (1 & o[0]) + throw o[1]; + return o[1]; + }, + trys: [], + ops: [] + }; + return i = { + next: s(0), + throw: s(1), + return: s(2) + }, 'function' == typeof Symbol && (i[Symbol.iterator] = function () { + return this; + }), i; + function s(i) { + return function (s) { + return function (i) { + if (n) + throw new TypeError('Generator is already executing.'); + for (; a;) + try { + if (n = 1, r && (o = 2 & i[0] ? r.return : i[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, i[1])).done) + return o; + switch (r = 0, o && (i = [ + 2 & i[0], + o.value + ]), i[0]) { + case 0: + case 1: + o = i; + break; + case 4: + return a.label++, { + value: i[1], + done: !1 + }; + case 5: + a.label++, r = i[1], i = [0]; + continue; + case 7: + i = a.ops.pop(), a.trys.pop(); + continue; + default: + if (!(o = (o = a.trys).length > 0 && o[o.length - 1]) && (6 === i[0] || 2 === i[0])) { + a = 0; + continue; + } + if (3 === i[0] && (!o || i[1] > o[0] && i[1] < o[3])) { + a.label = i[1]; + break; + } + if (6 === i[0] && a.label < o[1]) { + a.label = o[1], o = i; + break; + } + if (o && a.label < o[2]) { + a.label = o[2], a.ops.push(i); + break; + } + o[2] && a.ops.pop(), a.trys.pop(); + continue; + } + i = t.call(e, a); + } catch (e) { + i = [ + 6, + e + ], r = 0; + } finally { + n = o = 0; + } + if (5 & i[0]) + throw i[1]; + return { + value: i[0] ? i[1] : void 0, + done: !0 + }; + }([ + i, + s + ]); + }; + } + }; + Object.defineProperty(t, '__esModule', { value: !0 }); + var i = n(29), a = n(15), s = function (e) { + function t() { + var t = null !== e && e.apply(this, arguments) || this; + return t.bitLength = 0, t.maxId_ = 0, t.set_ = new Set(), t; + } + return r(t, e), t.prototype[Symbol.iterator] = function () { + var e; + return o(this, function (t) { + switch (t.label) { + case 0: + e = 1, t.label = 1; + case 1: + return e <= this.maxId ? [ + 4, + [ + e, + this.has(e) + ] + ] : [ + 3, + 4 + ]; + case 2: + t.sent(), t.label = 3; + case 3: + return e++, [ + 3, + 1 + ]; + case 4: + return [2]; + } + }); + }, t.prototype.values = function () { + return this.set_.values(); + }, Object.defineProperty(t.prototype, 'maxId', { + get: function () { + return this.maxId_; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.has = function (e) { + return this.set_.has(e); + }, t.prototype.unset = function (e) { + var t = this; + Array.isArray(e) ? e.forEach(function (e) { + return t.unset(e); + }) : 'object' == typeof e ? this.unset(Object.keys(e).map(function (e) { + return +e; + })) : (this.set_.delete(e), this.bitLength = 0, e === this.maxId && (this.maxId_ = 0, this.set_.forEach(function (e) { + t.maxId_ = Math.max(t.maxId, e); + }))); + }, t.prototype.isIntMap = function (e) { + var t = this, n = 'object' == typeof e; + return n && Object.keys(e).every(function (n) { + var r = Number.isInteger(parseInt(n, 10)); + return (r = r && t.isValidNumber(e[n].id)) && void 0 !== e[n].name; + }); + }, t.prototype.isValidNumber = function (e) { + return parseInt(e, 10) > 0; + }, t.prototype.isSet = function (e) { + var t = !1; + return e instanceof Set && (t = Array.from(e).every(this.isValidNumber)), t; + }, t.prototype.set = function (e) { + var t = this; + if (Array.isArray(e)) + e.forEach(function (e) { + return t.set(e); + }); + else if (this.isSet(e)) + this.set(Array.from(e)); + else if (this.isIntMap(e)) + this.set(Object.keys(e).map(function (e) { + return +e; + })); + else { + if (!this.isValidNumber(e)) + throw new a.TCModelError('set()', e, 'must be positive integer array, positive integer, Set, or IntMap'); + this.set_.add(e), this.maxId_ = Math.max(this.maxId, e), this.bitLength = 0; + } + }, t.prototype.empty = function () { + this.set_ = new Set(); + }, t.prototype.forEach = function (e) { + for (var t = 1; t <= this.maxId; t++) + e(this.has(t), t); + }, Object.defineProperty(t.prototype, 'size', { + get: function () { + return this.set_.size; + }, + enumerable: !0, + configurable: !0 + }), t.prototype.setAll = function (e) { + this.set(e); + }, t; + }(i.Cloneable); + t.Vector = s; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(132), o = n(78), i = n(137), a = n(143), s = n(15), c = n(134), u = n(17), l = function () { + function e() { + } + return e.encode = function (e, t) { + var n, a = this; + try { + n = this.fieldSequence['' + e.version][t]; + } catch (n) { + throw new s.EncodingError('Unable to encode version: ' + e.version + ', segment: ' + t); + } + var l = ''; + return t !== u.Segment.CORE && (l = i.IntEncoder.encode(u.SegmentIDs.KEY_TO_ID[t], o.BitLength.segmentType)), n.forEach(function (n) { + var r = e[n], u = i.FieldEncoderMap[n], f = o.BitLength[n]; + void 0 === f && a.isPublisherCustom(n) && (f = +e[c.Fields.numCustomPurposes]); + try { + l += u.encode(r, f); + } catch (e) { + throw new s.EncodingError('Error encoding ' + t + '->' + n + ': ' + e.message); + } + }), r.Base64Url.encode(l); + }, e.decode = function (e, t, n) { + var a = this, l = r.Base64Url.decode(e), f = 0; + return n === u.Segment.CORE && (t.version = i.IntEncoder.decode(l.substr(f, o.BitLength[c.Fields.version]), o.BitLength[c.Fields.version])), n !== u.Segment.CORE && (f += o.BitLength.segmentType), this.fieldSequence['' + t.version][n].forEach(function (e) { + var n = i.FieldEncoderMap[e], r = o.BitLength[e]; + if (void 0 === r && a.isPublisherCustom(e) && (r = +t[c.Fields.numCustomPurposes]), 0 !== r) { + var u = l.substr(f, r); + if (n === i.VendorVectorEncoder ? t[e] = n.decode(u, t.version) : t[e] = n.decode(u, r), Number.isInteger(r)) + f += r; + else { + if (!Number.isInteger(t[e].bitLength)) + throw new s.DecodingError(e); + f += t[e].bitLength; + } + } + }), t; + }, e.isPublisherCustom = function (e) { + return 0 === e.indexOf('publisherCustom'); + }, e.fieldSequence = new a.FieldSequence(), e; + }(); + t.SegmentEncoder = l; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(17), o = n(43), i = n(138), a = n(80), s = n(30), c = n(139), u = n(140), l = n(141), f = function () { + function e() { + } + var t, n, f, p, d, h, m, g, v, y, b, E, w, x, S, C, k, T, _, P, O, I, L, A, R, N; + return t = r.Fields.version, n = r.Fields.created, f = r.Fields.lastUpdated, p = r.Fields.cmpId, d = r.Fields.cmpVersion, h = r.Fields.consentScreen, m = r.Fields.consentLanguage, g = r.Fields.vendorListVersion, v = r.Fields.policyVersion, y = r.Fields.isServiceSpecific, b = r.Fields.useNonStandardStacks, E = r.Fields.specialFeatureOptins, w = r.Fields.purposeConsents, x = r.Fields.purposeLegitimateInterests, S = r.Fields.purposeOneTreatment, C = r.Fields.publisherCountryCode, k = r.Fields.vendorConsents, T = r.Fields.vendorLegitimateInterests, _ = r.Fields.publisherRestrictions, P = r.Fields.vendorsDisclosed, O = r.Fields.vendorsAllowed, I = r.Fields.publisherConsents, L = r.Fields.publisherLegitimateInterests, A = r.Fields.numCustomPurposes, R = r.Fields.publisherCustomConsents, N = r.Fields.publisherCustomLegitimateInterests, e[t] = s.IntEncoder, e[n] = i.DateEncoder, e[f] = i.DateEncoder, e[p] = s.IntEncoder, e[d] = s.IntEncoder, e[h] = s.IntEncoder, e[m] = c.LangEncoder, e[g] = s.IntEncoder, e[v] = s.IntEncoder, e[y] = o.BooleanEncoder, e[b] = o.BooleanEncoder, e[E] = a.FixedVectorEncoder, e[w] = a.FixedVectorEncoder, e[x] = a.FixedVectorEncoder, e[S] = o.BooleanEncoder, e[C] = c.LangEncoder, e[k] = l.VendorVectorEncoder, e[T] = l.VendorVectorEncoder, e[_] = u.PurposeRestrictionVectorEncoder, e.segmentType = s.IntEncoder, e[P] = l.VendorVectorEncoder, e[O] = l.VendorVectorEncoder, e[I] = a.FixedVectorEncoder, e[L] = a.FixedVectorEncoder, e[A] = s.IntEncoder, e[R] = a.FixedVectorEncoder, e[N] = a.FixedVectorEncoder, e; + }(); + t.FieldEncoderMap = f; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(17); + t.FieldSequence = function () { + var e, t; + this[1] = ((e = {})[r.Segment.CORE] = [ + r.Fields.version, + r.Fields.created, + r.Fields.lastUpdated, + r.Fields.cmpId, + r.Fields.cmpVersion, + r.Fields.consentScreen, + r.Fields.consentLanguage, + r.Fields.vendorListVersion, + r.Fields.purposeConsents, + r.Fields.vendorConsents + ], e), this[2] = ((t = {})[r.Segment.CORE] = [ + r.Fields.version, + r.Fields.created, + r.Fields.lastUpdated, + r.Fields.cmpId, + r.Fields.cmpVersion, + r.Fields.consentScreen, + r.Fields.consentLanguage, + r.Fields.vendorListVersion, + r.Fields.policyVersion, + r.Fields.isServiceSpecific, + r.Fields.useNonStandardStacks, + r.Fields.specialFeatureOptins, + r.Fields.purposeConsents, + r.Fields.purposeLegitimateInterests, + r.Fields.purposeOneTreatment, + r.Fields.publisherCountryCode, + r.Fields.vendorConsents, + r.Fields.vendorLegitimateInterests, + r.Fields.publisherRestrictions + ], t[r.Segment.PUBLISHER_TC] = [ + r.Fields.publisherConsents, + r.Fields.publisherLegitimateInterests, + r.Fields.numCustomPurposes, + r.Fields.publisherCustomConsents, + r.Fields.publisherCustomLegitimateInterests + ], t[r.Segment.VENDORS_ALLOWED] = [r.Fields.vendorsAllowed], t[r.Segment.VENDORS_DISCLOSED] = [r.Fields.vendorsDisclosed], t); + }; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(17); + t.SegmentSequence = function (e, t) { + if (this[1] = [r.Segment.CORE], this[2] = [r.Segment.CORE], 2 === e.version) + if (e.isServiceSpecific) + this[2].push(r.Segment.PUBLISHER_TC); + else { + var n = !(!t || !t.isForVendors); + n && !0 !== e[r.Fields.supportOOB] || this[2].push(r.Segment.VENDORS_DISCLOSED), n && (e[r.Fields.supportOOB] && e[r.Fields.vendorsAllowed].size > 0 && this[2].push(r.Segment.VENDORS_ALLOWED), this[2].push(r.Segment.PUBLISHER_TC)); + } + }; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(15), o = n(17), i = function () { + function e() { + } + return e.process = function (e, t) { + var n, o, i = e.gvl; + if (!i) + throw new r.EncodingError('Unable to encode TCModel without a GVL'); + if (!i.isReady) + throw new r.EncodingError('Unable to encode TCModel tcModel.gvl.readyPromise is not resolved'); + (e = e.clone()).consentLanguage = i.language.toUpperCase(), (null === (n = t) || void 0 === n ? void 0 : n.version) > 0 && (null === (o = t) || void 0 === o ? void 0 : o.version) <= this.processor.length ? e.version = t.version : e.version = this.processor.length; + var a = e.version - 1; + if (!this.processor[a]) + throw new r.EncodingError('Invalid version: ' + e.version); + return this.processor[a](e, i); + }, e.processor = [ + function (e) { + return e; + }, + function (e, t) { + e.publisherRestrictions.gvl = t, e.purposeLegitimateInterests.unset(1); + var n = new Map(); + return n.set('legIntPurposes', e.vendorLegitimateInterests), n.set('purposes', e.vendorConsents), n.forEach(function (n, r) { + n.forEach(function (i, a) { + if (i) { + var s = t.vendors[a]; + if (!s || s.deletedDate) + n.unset(a); + else if (0 === s[r].length) + if (e.isServiceSpecific) + if (0 === s.flexiblePurposes.length) + n.unset(a); + else { + for (var c = e.publisherRestrictions.getRestrictions(a), u = !1, l = 0, f = c.length; l < f && !u; l++) + u = c[l].restrictionType === o.RestrictionType.REQUIRE_CONSENT && 'purposes' === r || c[l].restrictionType === o.RestrictionType.REQUIRE_LI && 'legIntPurposes' === r; + u || n.unset(a); + } + else + n.unset(a); + } + }); + }), e.vendorsDisclosed.set(t.vendors), e; + } + ], e; + }(); + t.SemanticPreEncoder = i; + }, + function (e, t, n) { + 'use strict'; + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = n(77), o = n(17), i = n(30), a = n(146), s = function () { + function e() { + } + return e.encode = function (e, t) { + var n, o, i = ''; + return e = r.SemanticPreEncoder.process(e, t), (o = Array.isArray(null === (n = t) || void 0 === n ? void 0 : n.segments) ? t.segments : new r.SegmentSequence(e, t)['' + e.version]).forEach(function (t, n) { + var a = ''; + n < o.length - 1 && (a = '.'), i += r.SegmentEncoder.encode(e, t) + a; + }), i; + }, e.decode = function (e, t) { + var n = e.split('.'), s = n.length; + t || (t = new a.TCModel()); + for (var c = 0; c < s; c++) { + var u = n[c], l = r.Base64Url.decode(u.charAt(0)).substr(0, r.BitLength.segmentType), f = o.SegmentIDs.ID_TO_KEY[i.IntEncoder.decode(l, r.BitLength.segmentType).toString()]; + r.SegmentEncoder.decode(u, t, f); + } + return t; + }, e; + }(); + t.TCString = s; + }, + function (e) { + e.exports = JSON.parse('{"Parent":{"Child":"English"},"coreUiLabels":{"initScreenTitle":"We value your privacy","agreeButton":"AGREE","agreeAllButton":"AGREE TO ALL","initScreenRejectButton":"DISAGREE","initScreenSettingsButton":"MORE OPTIONS","summaryScreenBodyNoRejectService":["We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.","With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may access more detailed information and change your preferences before consenting or to refuse consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to this website only. You can change your preferences at any time by returning to this site or visit our privacy policy.\\n"],"summaryScreenBodyNoRejectGlobal":["We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.","With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may access more detailed information and change your preferences before consenting or to refuse consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply across the web. You can change your preferences at any time by returning to this site or visit our privacy policy."],"summaryScreenBodyNoRejectGroup":["We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.","With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may access more detailed information and change your preferences before consenting or to refuse consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to a group of websites. You can change your preferences at any time by returning to this site or visit our privacy policy."],"summaryScreenBodyRejectService":["We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.","With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may click to refuse to consent or access more detailed information and change your preferences before consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to this website only. You can change your preferences at any time by returning to this site or visit our privacy policy."],"summaryScreenBodyRejectGlobal":["We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.","With your permission we and our partners may use precise geolocation data and identification through device scanning.You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may click to refuse to consent or access more detailed information and change your preferences before consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply across the web.You can change your preferences at any time by returning to this site or visit our privacy policy."],"summaryScreenBodyRejectGroup":["We and our partners store and/or access information on a device, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for personalised ads and content, ad and content measurement, and audience insights, as well as to develop and improve products.","With your permission we and our partners may use precise geolocation data and identification through device scanning. You may click to consent to our and our partners\u2019 processing as described above. Alternatively you may click to refuse to consent or access more detailed information and change your preferences before consenting. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. Your preferences will apply to a group of websites. You can change your preferences at any time by returning to this site or visit our privacy policy."],"initScreenBodyGlobal":"We and our partners store or access information on devices, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for the purposes described below. You may click to consent to our and our partners\u2019 processing for such purposes. Alternatively, you may click to refuse to consent, or access more detailed information to change your preferences before consenting. Your preferences will apply across the web. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. You can change your preferences at any time by returning to this site or visit our privacy policy.","initScreenBodyService":"We and our partners store or access information on devices, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for the purposes described below. You may click to consent to our and our partners\u2019 processing for such purposes. Alternatively, you may click to refuse to consent, or access more detailed information and change your preferences before consenting. Your preferences will apply to this website only. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. You can change your preferences at any time by returning to this site or visit our privacy policy.","initScreenBodyGroup":"We and our partners store or access information on devices, such as cookies and process personal data, such as unique identifiers and standard information sent by a device for the purposes described below. You may click to consent to our and our partners\u2019 processing for such purposes. Alternatively, you may click to refuse to consent, or access more detailed information and change your preferences before consenting. Your preferences will apply to a group of websites. Please note that some processing of your personal data may not require your consent, but you have a right to object to such processing. You can change your preferences at any time by returning to this site or visit our privacy policy.","specialPurposesAndFeatures":"Special Purposes and Features","saveAndExitButton":"SAVE & EXIT","agreeToSelectedButton":"AGREE TO SELECTED","purposeScreenVendorLink":"PARTNERS","legitimateInterestLink":"LEGITIMATE INTEREST ","specialPurposesLabel":"Special Purposes","specialFeaturesLabel":"Special Features","featuresLabel":"Features","back":"Back","onLabel":"ON","offLabel":"OFF","multiLabel":"MULTI","legalDescription":"Legal Description","showPartners":"Show Partners","hidePartners":"Hide Partners","vendorScreenBody":"Review and set your consent preferences for each partner below. Expand each partner list item for more information to help make your choice. Some personal data is processed without your consent, but you have the right to object.","privacyPolicyLabel":"Privacy Policy","descriptionLabel":"Vendor Description","legitimateScreenBody":"Review and object to processing of personal data without your consent on the basis of a legitimate interest for each purpose and by each partner below. Expand each purpose or partner list item for more information to help make your choice. To object to the special purposes of ensuring security, preventing fraud, and debugging, and technically delivering ads or content click on a partner\'s privacy policy link.","legitimateInterestPurposesLabel":"Legitimate Interest Purpose(s)","legitimateInterestVendorLabel":"Legitimate Interest Vendors","legitimateScreenObject":"OBJECT","legitimateScreenObjected":"OBJECTED","legitimateScreenAccept":"REMOVE OBJECTION","objectAllButton":"OBJECT ALL","persistentConsentLinkLabel":"Privacy","nonIabVendorsNotice":"Vendors who do not participate in the IAB Europe Transparency and Consent Framework and do not adhere to its policies or technical specifications","googlePartners":"Google Partners","purposesLabel":"Purposes","cookieMaxAgeLabel":"Cookie max age","secondsLabel":"Seconds","storageDisclosureLabel":"Storage disclosure","daysLabel":"Days"},"premiumUiLabels":{"linksTitle":"Additional Links","nonIabVendorsLabel":"Non-IAB Vendors","uspAcceptButton":"CONFIRM","uspAccessDataLinkText":"Data Access","uspDeleteDataLinkText":"Data Deletion","uspDnsTitle":"Do Not Sell My Personal Information","uspDoNotSellToggleText":"I want to make a \'Do Not Sell My Personal Information\' request. Note: this action will make it harder to us to tailor content for you.","uspPrivacyPolicyLinkText":"Privacy Policy","uspDnsText":["We, and our partners, use technologies to process personal information, including IP addresses, pseudonymous identifiers associated with cookies, and in some cases mobile ad IDs. This information is processed to personalize content based on your interests, run and optimize marketing campaigns, measure the performance of ads and content, and derive insights about the audiences who engage with ads and content. This data is an integral part of how we operate our site, make revenue to support our staff, and generate relevant content for our audience. You can learn more about our data collection and use practices in our Privacy Policy.-","If you wish to request that your personal information is not shared with third parties, please click on the below checkbox and confirm your selection. Please note that after your opt out request is processed, we may still collect your information in order to operate our site.\\n"]}}'); + }, + function (e, t, n) { + 'use strict'; + function r(e, t) { + (null == t || t > e.length) && (t = e.length); + for (var n = 0, r = new Array(t); n < t; n++) + r[n] = e[n]; + return r; + } + function o(e) { + if ('undefined' !== typeof Symbol && Symbol.iterator in Object(e)) + return Array.from(e); + } + function i(e, t) { + if (e) { + if ('string' === typeof e) + return r(e, t); + var n = Object.prototype.toString.call(e).slice(8, -1); + return 'Object' === n && e.constructor && (n = e.constructor.name), 'Map' === n || 'Set' === n ? Array.from(n) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? r(e, t) : void 0; + } + } + function a(e) { + return function (e) { + if (Array.isArray(e)) + return r(e); + }(e) || o(e) || i(e) || function () { + throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + }(); + } + function s(e) { + if (Array.isArray(e)) + return e; + } + function c() { + throw new TypeError('Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + } + function u(e) { + if ('undefined' === typeof Symbol || null == e[Symbol.iterator]) { + if (Array.isArray(e) || (e = i(e))) { + var t = 0, n = function () { + }; + return { + s: n, + n: function () { + return t >= e.length ? { done: !0 } : { + done: !1, + value: e[t++] + }; + }, + e: function (e) { + throw e; + }, + f: n + }; + } + throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); + } + var r, o, a = !0, s = !1; + return { + s: function () { + r = e[Symbol.iterator](); + }, + n: function () { + var e = r.next(); + return a = e.done, e; + }, + e: function (e) { + s = !0, o = e; + }, + f: function () { + try { + a || null == r.return || r.return(); + } finally { + if (s) + throw o; + } + } + }; + } + function l(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + function f(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + function p(e, t, n) { + return t && f(e.prototype, t), n && f(e, n), e; + } + function d(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + function h(e, t) { + var n = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var r = Object.getOwnPropertySymbols(e); + t && (r = r.filter(function (t) { + return Object.getOwnPropertyDescriptor(e, t).enumerable; + })), n.push.apply(n, r); + } + return n; + } + function m(e) { + for (var t = 1; t < arguments.length; t++) { + var n = null != arguments[t] ? arguments[t] : {}; + t % 2 ? h(Object(n), !0).forEach(function (t) { + d(e, t, n[t]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : h(Object(n)).forEach(function (t) { + Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)); + }); + } + return e; + } + function g(e) { + for (var t = arguments.length, n = Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) + n[r - 1] = arguments[r]; + throw Error('[Immer] minified error nr: ' + e + (n.length ? ' ' + n.map(function (e) { + return '\'' + e + '\''; + }).join(',') : '') + '. Find the full error at: https://bit.ly/3cXEKWf'); + } + function v(e) { + return !!e && !!e[ie]; + } + function y(e) { + return !!e && (function (e) { + if (!e || 'object' != typeof e) + return !1; + var t = Object.getPrototypeOf(e); + return !t || t === Object.prototype; + }(e) || Array.isArray(e) || !!e[oe] || !!e.constructor[oe] || k(e) || T(e)); + } + function b(e, t, n) { + void 0 === n && (n = !1), 0 === E(e) ? (n ? Object.keys : ae)(e).forEach(function (r) { + n && 'symbol' == typeof r || t(r, e[r], e); + }) : e.forEach(function (n, r) { + return t(r, n, e); + }); + } + function E(e) { + var t = e[ie]; + return t ? t.i > 3 ? t.i - 4 : t.i : Array.isArray(e) ? 1 : k(e) ? 2 : T(e) ? 3 : 0; + } + function w(e, t) { + return 2 === E(e) ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t); + } + function x(e, t) { + return 2 === E(e) ? e.get(t) : e[t]; + } + function S(e, t, n) { + var r = E(e); + 2 === r ? e.set(t, n) : 3 === r ? (e.delete(t), e.add(n)) : e[t] = n; + } + function C(e, t) { + return e === t ? 0 !== e || 1 / e == 1 / t : e != e && t != t; + } + function k(e) { + return ee && e instanceof Map; + } + function T(e) { + return te && e instanceof Set; + } + function _(e) { + return e.o || e.t; + } + function P(e) { + if (Array.isArray(e)) + return Array.prototype.slice.call(e); + var t = se(e); + delete t[ie]; + for (var n = ae(t), r = 0; r < n.length; r++) { + var o = n[r], i = t[o]; + !1 === i.writable && (i.writable = !0, i.configurable = !0), (i.get || i.set) && (t[o] = { + configurable: !0, + writable: !0, + enumerable: i.enumerable, + value: e[o] + }); + } + return Object.create(Object.getPrototypeOf(e), t); + } + function O(e, t) { + L(e) || v(e) || !y(e) || (E(e) > 1 && (e.set = e.add = e.clear = e.delete = I), Object.freeze(e), t && b(e, function (e, t) { + return O(t, !0); + }, !0)); + } + function I() { + g(2); + } + function L(e) { + return null == e || 'object' != typeof e || Object.isFrozen(e); + } + function A(e) { + var t = ce[e]; + return t || g(18, e), t; + } + function R(e, t) { + ce[e] || (ce[e] = t); + } + function N() { + return X; + } + function j(e, t) { + t && (A('Patches'), e.u = [], e.s = [], e.v = t); + } + function q(e) { + F(e), e.p.forEach(M), e.p = null; + } + function F(e) { + e === X && (X = e.l); + } + function D(e) { + return X = { + p: [], + l: X, + h: e, + m: !0, + _: 0 + }; + } + function M(e) { + var t = e[ie]; + 0 === t.i || 1 === t.i ? t.j() : t.g = !0; + } + function U(e, t) { + t._ = t.p.length; + var n = t.p[0], r = void 0 !== e && e !== n; + return t.h.O || A('ES5').S(t, e, r), r ? (n[ie].P && (q(t), g(4)), y(e) && (e = V(t, e), t.l || z(t, e)), t.u && A('Patches').M(n[ie], e, t.u, t.s)) : e = V(t, n, []), q(t), t.u && t.v(t.u, t.s), e !== re ? e : void 0; + } + function V(e, t, n) { + if (L(t)) + return t; + var r = t[ie]; + if (!r) + return b(t, function (o, i) { + return B(e, r, t, o, i, n); + }, !0), t; + if (r.A !== e) + return t; + if (!r.P) + return z(e, r.t, !0), r.t; + if (!r.I) { + r.I = !0, r.A._--; + var o = 4 === r.i || 5 === r.i ? r.o = P(r.k) : r.o; + b(3 === r.i ? new Set(o) : o, function (t, i) { + return B(e, r, o, t, i, n); + }), z(e, o, !1), n && e.u && A('Patches').R(r, n, e.u, e.s); + } + return r.o; + } + function B(e, t, n, r, o, i) { + if (v(o)) { + var a = V(e, o, i && t && 3 !== t.i && !w(t.D, r) ? i.concat(r) : void 0); + if (S(n, r, a), !v(a)) + return; + e.m = !1; + } + if (y(o) && !L(o)) { + if (!e.h.N && e._ < 1) + return; + V(e, o), t && t.A.l || z(e, o); + } + } + function z(e, t, n) { + void 0 === n && (n = !1), e.h.N && e.m && O(t, n); + } + function G(e, t) { + var n = e[ie]; + return (n ? _(n) : e)[t]; + } + function H(e, t) { + if (t in e) + for (var n = Object.getPrototypeOf(e); n;) { + var r = Object.getOwnPropertyDescriptor(n, t); + if (r) + return r; + n = Object.getPrototypeOf(n); + } + } + function W(e) { + e.P || (e.P = !0, e.l && W(e.l)); + } + function $(e) { + e.o || (e.o = P(e.t)); + } + function Y(e, t, n) { + var r = k(t) ? A('MapSet').T(t, n) : T(t) ? A('MapSet').F(t, n) : e.O ? function (e, t) { + var n = Array.isArray(e), r = { + i: n ? 1 : 0, + A: t ? t.A : N(), + P: !1, + I: !1, + D: {}, + l: t, + t: e, + k: null, + o: null, + j: null, + C: !1 + }, o = r, i = ue; + n && (o = [r], i = le); + var a = Proxy.revocable(o, i), s = a.revoke, c = a.proxy; + return r.k = c, r.j = s, c; + }(t, n) : A('ES5').J(t, n); + return (n ? n.A : N()).p.push(r), r; + } + function Q(e, t) { + switch (t) { + case 2: + return new Map(e); + case 3: + return Array.from(e); + } + return P(e); + } + function K() { + function e(e, t) { + var n = o[e]; + return n ? n.enumerable = t : o[e] = n = { + configurable: !0, + enumerable: t, + get: function () { + var t = this[ie]; + return ue.get(t, e); + }, + set: function (t) { + var n = this[ie]; + ue.set(n, e, t); + } + }, n; + } + function t(e) { + for (var t = e.length - 1; t >= 0; t--) { + var o = e[t][ie]; + if (!o.P) + switch (o.i) { + case 5: + r(o) && W(o); + break; + case 4: + n(o) && W(o); + } + } + } + function n(e) { + for (var t = e.t, n = e.k, r = ae(n), o = r.length - 1; o >= 0; o--) { + var i = r[o]; + if (i !== ie) { + var a = t[i]; + if (void 0 === a && !w(t, i)) + return !0; + var s = n[i], c = s && s[ie]; + if (c ? c.t !== a : !C(s, a)) + return !0; + } + } + var u = !!t[ie]; + return r.length !== ae(t).length + (u ? 0 : 1); + } + function r(e) { + var t = e.k; + if (t.length !== e.t.length) + return !0; + var n = Object.getOwnPropertyDescriptor(t, t.length - 1); + return !(!n || n.get); + } + var o = {}; + R('ES5', { + J: function (t, n) { + var r = Array.isArray(t), o = function (t, n) { + if (t) { + for (var r = Array(n.length), o = 0; o < n.length; o++) + Object.defineProperty(r, '' + o, e(o, !0)); + return r; + } + var i = se(n); + delete i[ie]; + for (var a = ae(i), s = 0; s < a.length; s++) { + var c = a[s]; + i[c] = e(c, t || !!i[c].enumerable); + } + return Object.create(Object.getPrototypeOf(n), i); + }(r, t), i = { + i: r ? 5 : 4, + A: n ? n.A : N(), + P: !1, + I: !1, + D: {}, + l: n, + t: t, + k: o, + o: null, + g: !1, + C: !1 + }; + return Object.defineProperty(o, ie, { + value: i, + writable: !0 + }), o; + }, + S: function (e, n, o) { + o ? v(n) && n[ie].A === e && t(e.p) : (e.u && function e(t) { + if (t && 'object' == typeof t) { + var n = t[ie]; + if (n) { + var o = n.t, i = n.k, a = n.D, s = n.i; + if (4 === s) + b(i, function (t) { + t !== ie && (void 0 !== o[t] || w(o, t) ? a[t] || e(i[t]) : (a[t] = !0, W(n))); + }), b(o, function (e) { + void 0 !== i[e] || w(i, e) || (a[e] = !1, W(n)); + }); + else if (5 === s) { + if (r(n) && (W(n), a.length = !0), i.length < o.length) + for (var c = i.length; c < o.length; c++) + a[c] = !1; + else + for (var u = o.length; u < i.length; u++) + a[u] = !0; + for (var l = Math.min(i.length, o.length), f = 0; f < l; f++) + void 0 === a[f] && e(i[f]); + } + } + } + }(e.p[0]), t(e.p)); + }, + K: function (e) { + return 4 === e.i ? n(e) : r(e); + } + }); + } + n.r(t), n.d(t, 'cmpApiUi', function () { + return Ko; + }); + var J, X, Z = 'undefined' != typeof Symbol && 'symbol' == typeof Symbol('x'), ee = 'undefined' != typeof Map, te = 'undefined' != typeof Set, ne = 'undefined' != typeof Proxy && void 0 !== Proxy.revocable && 'undefined' != typeof Reflect, re = Z ? Symbol.for('immer-nothing') : ((J = {})['immer-nothing'] = !0, J), oe = Z ? Symbol.for('immer-draftable') : '__$immer_draftable', ie = Z ? Symbol.for('immer-state') : '__$immer_state', ae = ('undefined' != typeof Symbol && Symbol.iterator, 'undefined' != typeof Reflect && Reflect.ownKeys ? Reflect.ownKeys : void 0 !== Object.getOwnPropertySymbols ? function (e) { + return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)); + } : Object.getOwnPropertyNames), se = Object.getOwnPropertyDescriptors || function (e) { + var t = {}; + return ae(e).forEach(function (n) { + t[n] = Object.getOwnPropertyDescriptor(e, n); + }), t; + }, ce = {}, ue = { + get: function (e, t) { + if (t === ie) + return e; + var n = _(e); + if (!w(n, t)) + return function (e, t, n) { + var r, o = H(t, n); + return o ? 'value' in o ? o.value : null === (r = o.get) || void 0 === r ? void 0 : r.call(e.k) : void 0; + }(e, n, t); + var r = n[t]; + return e.I || !y(r) ? r : r === G(e.t, t) ? ($(e), e.o[t] = Y(e.A.h, r, e)) : r; + }, + has: function (e, t) { + return t in _(e); + }, + ownKeys: function (e) { + return Reflect.ownKeys(_(e)); + }, + set: function (e, t, n) { + var r = H(_(e), t); + if (null == r ? void 0 : r.set) + return r.set.call(e.k, n), !0; + if (!e.P) { + var o = G(_(e), t), i = null == o ? void 0 : o[ie]; + if (i && i.t === n) + return e.o[t] = n, e.D[t] = !1, !0; + if (C(n, o) && (void 0 !== n || w(e.t, t))) + return !0; + $(e), W(e); + } + return e.o[t] = n, e.D[t] = !0, !0; + }, + deleteProperty: function (e, t) { + return void 0 !== G(e.t, t) || t in e.t ? (e.D[t] = !1, $(e), W(e)) : delete e.D[t], e.o && delete e.o[t], !0; + }, + getOwnPropertyDescriptor: function (e, t) { + var n = _(e), r = Reflect.getOwnPropertyDescriptor(n, t); + return r ? { + writable: !0, + configurable: 1 !== e.i || 'length' !== t, + enumerable: r.enumerable, + value: n[t] + } : r; + }, + defineProperty: function () { + g(11); + }, + getPrototypeOf: function (e) { + return Object.getPrototypeOf(e.t); + }, + setPrototypeOf: function () { + g(12); + } + }, le = {}; + b(ue, function (e, t) { + le[e] = function () { + return arguments[0] = arguments[0][0], t.apply(this, arguments); + }; + }), le.deleteProperty = function (e, t) { + return ue.deleteProperty.call(this, e[0], t); + }, le.set = function (e, t, n) { + return ue.set.call(this, e[0], t, n, e[0]); + }; + var fe = new (function () { + function e(e) { + this.O = ne, this.N = !1, 'boolean' == typeof (null == e ? void 0 : e.useProxies) && this.setUseProxies(e.useProxies), 'boolean' == typeof (null == e ? void 0 : e.autoFreeze) && this.setAutoFreeze(e.autoFreeze), this.produce = this.produce.bind(this), this.produceWithPatches = this.produceWithPatches.bind(this); + } + var t = e.prototype; + return t.produce = function (e, t, n) { + if ('function' == typeof e && 'function' != typeof t) { + var r = t; + t = e; + var o = this; + return function (e) { + var n = this; + void 0 === e && (e = r); + for (var i = arguments.length, a = Array(i > 1 ? i - 1 : 0), s = 1; s < i; s++) + a[s - 1] = arguments[s]; + return o.produce(e, function (e) { + var r; + return (r = t).call.apply(r, [ + n, + e + ].concat(a)); + }); + }; + } + var i; + if ('function' != typeof t && g(6), void 0 !== n && 'function' != typeof n && g(7), y(e)) { + var a = D(this), s = Y(this, e, void 0), c = !0; + try { + i = t(s), c = !1; + } finally { + c ? q(a) : F(a); + } + return 'undefined' != typeof Promise && i instanceof Promise ? i.then(function (e) { + return j(a, n), U(e, a); + }, function (e) { + throw q(a), e; + }) : (j(a, n), U(i, a)); + } + if (!e || 'object' != typeof e) { + if ((i = t(e)) === re) + return; + return void 0 === i && (i = e), this.N && O(i, !0), i; + } + g(21, e); + }, t.produceWithPatches = function (e, t) { + var n, r, o = this; + return 'function' == typeof e ? function (t) { + for (var n = arguments.length, r = Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++) + r[i - 1] = arguments[i]; + return o.produceWithPatches(t, function (t) { + return e.apply(void 0, [t].concat(r)); + }); + } : [ + this.produce(e, t, function (e, t) { + n = e, r = t; + }), + n, + r + ]; + }, t.createDraft = function (e) { + y(e) || g(8), v(e) && (e = function (e) { + return v(e) || g(22, e), function e(t) { + if (!y(t)) + return t; + var n, r = t[ie], o = E(t); + if (r) { + if (!r.P && (r.i < 4 || !A('ES5').K(r))) + return r.t; + r.I = !0, n = Q(t, o), r.I = !1; + } else + n = Q(t, o); + return b(n, function (t, o) { + r && x(r.t, t) === o || S(n, t, e(o)); + }), 3 === o ? new Set(n) : n; + }(e); + }(e)); + var t = D(this), n = Y(this, e, void 0); + return n[ie].C = !0, F(t), n; + }, t.finishDraft = function (e, t) { + var n = (e && e[ie]).A; + return j(n, t), U(void 0, n); + }, t.setAutoFreeze = function (e) { + this.N = e; + }, t.setUseProxies = function (e) { + e && !ne && g(20), this.O = e; + }, t.applyPatches = function (e, t) { + var n; + for (n = t.length - 1; n >= 0; n--) { + var r = t[n]; + if (0 === r.path.length && 'replace' === r.op) { + e = r.value; + break; + } + } + var o = A('Patches').$; + return v(e) ? o(e, t) : this.produce(e, function (e) { + return o(e, t.slice(n + 1)); + }); + }, e; + }())(), pe = fe.produce, de = (fe.produceWithPatches.bind(fe), fe.setAutoFreeze.bind(fe), fe.setUseProxies.bind(fe), fe.applyPatches.bind(fe), fe.createDraft.bind(fe), fe.finishDraft.bind(fe), pe), he = n(82), me = function () { + return Math.random().toString(36).substring(7).split('').join('.'); + }, ge = { + INIT: '@@redux/INIT' + me(), + REPLACE: '@@redux/REPLACE' + me(), + PROBE_UNKNOWN_ACTION: function () { + return '@@redux/PROBE_UNKNOWN_ACTION' + me(); + } + }; + function ve(e) { + if ('object' !== typeof e || null === e) + return !1; + for (var t = e; null !== Object.getPrototypeOf(t);) + t = Object.getPrototypeOf(t); + return Object.getPrototypeOf(e) === t; + } + function ye(e, t, n) { + var r; + if ('function' === typeof t && 'function' === typeof n || 'function' === typeof n && 'function' === typeof arguments[3]) + throw new Error('It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.'); + if ('function' === typeof t && 'undefined' === typeof n && (n = t, t = void 0), 'undefined' !== typeof n) { + if ('function' !== typeof n) + throw new Error('Expected the enhancer to be a function.'); + return n(ye)(e, t); + } + if ('function' !== typeof e) + throw new Error('Expected the reducer to be a function.'); + var o = e, i = t, a = [], s = a, c = !1; + function u() { + s === a && (s = a.slice()); + } + function l() { + if (c) + throw new Error('You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.'); + return i; + } + function f(e) { + if ('function' !== typeof e) + throw new Error('Expected the listener to be a function.'); + if (c) + throw new Error('You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.'); + var t = !0; + return u(), s.push(e), function () { + if (t) { + if (c) + throw new Error('You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.'); + t = !1, u(); + var n = s.indexOf(e); + s.splice(n, 1), a = null; + } + }; + } + function p(e) { + if (!ve(e)) + throw new Error('Actions must be plain objects. Use custom middleware for async actions.'); + if ('undefined' === typeof e.type) + throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?'); + if (c) + throw new Error('Reducers may not dispatch actions.'); + try { + c = !0, i = o(i, e); + } finally { + c = !1; + } + for (var t = a = s, n = 0; n < t.length; n++) { + (0, t[n])(); + } + return e; + } + function d(e) { + if ('function' !== typeof e) + throw new Error('Expected the nextReducer to be a function.'); + o = e, p({ type: ge.REPLACE }); + } + function h() { + var e, t = f; + return (e = { + subscribe: function (e) { + if ('object' !== typeof e || null === e) + throw new TypeError('Expected the observer to be an object.'); + function n() { + e.next && e.next(l()); + } + return n(), { unsubscribe: t(n) }; + } + })[he.a] = function () { + return this; + }, e; + } + return p({ type: ge.INIT }), (r = { + dispatch: p, + subscribe: f, + getState: l, + replaceReducer: d + })[he.a] = h, r; + } + function be(e, t) { + var n = t && t.type; + return 'Given ' + (n && 'action "' + String(n) + '"' || 'an action') + ', reducer "' + e + '" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'; + } + function Ee(e) { + for (var t = Object.keys(e), n = {}, r = 0; r < t.length; r++) { + var o = t[r]; + 0, 'function' === typeof e[o] && (n[o] = e[o]); + } + var i, a = Object.keys(n); + try { + !function (e) { + Object.keys(e).forEach(function (t) { + var n = e[t]; + if ('undefined' === typeof n(void 0, { type: ge.INIT })) + throw new Error('Reducer "' + t + '" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don\'t want to set a value for this reducer, you can use null instead of undefined.'); + if ('undefined' === typeof n(void 0, { type: ge.PROBE_UNKNOWN_ACTION() })) + throw new Error('Reducer "' + t + '" returned undefined when probed with a random type. Don\'t try to handle ' + ge.INIT + ' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.'); + }); + }(n); + } catch (s) { + i = s; + } + return function (e, t) { + if (void 0 === e && (e = {}), i) + throw i; + for (var r = !1, o = {}, s = 0; s < a.length; s++) { + var c = a[s], u = n[c], l = e[c], f = u(l, t); + if ('undefined' === typeof f) { + var p = be(c, t); + throw new Error(p); + } + o[c] = f, r = r || f !== l; + } + return (r = r || a.length !== Object.keys(e).length) ? o : e; + }; + } + function we(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + function xe(e, t) { + var n = Object.keys(e); + return Object.getOwnPropertySymbols && n.push.apply(n, Object.getOwnPropertySymbols(e)), t && (n = n.filter(function (t) { + return Object.getOwnPropertyDescriptor(e, t).enumerable; + })), n; + } + function Se(e) { + for (var t = 1; t < arguments.length; t++) { + var n = null != arguments[t] ? arguments[t] : {}; + t % 2 ? xe(n, !0).forEach(function (t) { + we(e, t, n[t]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : xe(n).forEach(function (t) { + Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)); + }); + } + return e; + } + function Ce() { + for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) + t[n] = arguments[n]; + return 0 === t.length ? function (e) { + return e; + } : 1 === t.length ? t[0] : t.reduce(function (e, t) { + return function () { + return e(t.apply(void 0, arguments)); + }; + }); + } + function ke() { + for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) + t[n] = arguments[n]; + return function (e) { + return function () { + var n = e.apply(void 0, arguments), r = function () { + throw new Error('Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.'); + }, o = { + getState: n.getState, + dispatch: function () { + return r.apply(void 0, arguments); + } + }, i = t.map(function (e) { + return e(o); + }); + return Se({}, n, { dispatch: r = Ce.apply(void 0, i)(n.dispatch) }); + }; + }; + } + function Te(e, t) { + return e === t; + } + function _e(e, t, n) { + if (null === t || null === n || t.length !== n.length) + return !1; + for (var r = t.length, o = 0; o < r; o++) + if (!e(t[o], n[o])) + return !1; + return !0; + } + function Pe(e) { + var t = Array.isArray(e[0]) ? e[0] : e; + if (!t.every(function (e) { + return 'function' === typeof e; + })) { + var n = t.map(function (e) { + return typeof e; + }).join(', '); + throw new Error('Selector creators expect all input-selectors to be functions, instead received the following types: [' + n + ']'); + } + return t; + } + !function (e) { + for (var t = arguments.length, n = Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) + n[r - 1] = arguments[r]; + }(function (e) { + var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : Te, n = null, r = null; + return function () { + return _e(t, n, arguments) || (r = e.apply(null, arguments)), n = arguments, r; + }; + }); + function Oe(e) { + return function (t) { + var n = t.dispatch, r = t.getState; + return function (t) { + return function (o) { + return 'function' === typeof o ? o(n, r, e) : t(o); + }; + }; + }; + } + var Ie = Oe(); + Ie.withExtraArgument = Oe; + var Le = Ie; + function Ae() { + return (Ae = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }).apply(this, arguments); + } + function Re(e) { + return (Re = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) { + return e.__proto__ || Object.getPrototypeOf(e); + })(e); + } + function Ne(e, t) { + return (Ne = Object.setPrototypeOf || function (e, t) { + return e.__proto__ = t, e; + })(e, t); + } + function je() { + if ('undefined' === typeof Reflect || !Reflect.construct) + return !1; + if (Reflect.construct.sham) + return !1; + if ('function' === typeof Proxy) + return !0; + try { + return Date.prototype.toString.call(Reflect.construct(Date, [], function () { + })), !0; + } catch (e) { + return !1; + } + } + function qe(e, t, n) { + return (qe = je() ? Reflect.construct : function (e, t, n) { + var r = [null]; + r.push.apply(r, t); + var o = new (Function.bind.apply(e, r))(); + return n && Ne(o, n.prototype), o; + }).apply(null, arguments); + } + function Fe(e) { + var t = 'function' === typeof Map ? new Map() : void 0; + return (Fe = function (e) { + if (null === e || !function (e) { + return -1 !== Function.toString.call(e).indexOf('[native code]'); + }(e)) + return e; + if ('function' !== typeof e) + throw new TypeError('Super expression must either be null or a function'); + if ('undefined' !== typeof t) { + if (t.has(e)) + return t.get(e); + t.set(e, n); + } + function n() { + return qe(e, arguments, Re(this).constructor); + } + return n.prototype = Object.create(e.prototype, { + constructor: { + value: n, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), Ne(n, e); + })(e); + } + var De = 'undefined' !== typeof window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function () { + if (0 !== arguments.length) + return 'object' === typeof arguments[0] ? Ce : Ce.apply(null, arguments); + }; + function Me(e) { + if ('object' !== typeof e || null === e) + return !1; + for (var t = e; null !== Object.getPrototypeOf(t);) + t = Object.getPrototypeOf(t); + return Object.getPrototypeOf(e) === t; + } + var Ue = function (e) { + var t, n; + function r() { + return e.apply(this, arguments) || this; + } + n = e, (t = r).prototype = Object.create(n.prototype), t.prototype.constructor = t, t.__proto__ = n; + var o = r.prototype; + return o.concat = function () { + for (var t, n = arguments.length, o = new Array(n), i = 0; i < n; i++) + o[i] = arguments[i]; + return qe(r, (t = e.prototype.concat).call.apply(t, [this].concat(o))); + }, o.prepend = function () { + for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) + t[n] = arguments[n]; + return 1 === t.length && Array.isArray(t[0]) ? qe(r, t[0].concat(this)) : qe(r, t.concat(this)); + }, r; + }(Fe(Array)); + function Ve() { + return function (e) { + return function (e) { + void 0 === e && (e = {}); + var t = e, n = t.thunk, r = void 0 === n || n, o = (t.immutableCheck, t.serializableCheck, new Ue()); + r && ('boolean' === typeof r ? o.push(Le) : o.push(Le.withExtraArgument(r.extraArgument))); + 0; + return o; + }(e); + }; + } + function Be(e, t) { + function n() { + if (t) { + var n = t.apply(void 0, arguments); + if (!n) + throw new Error('prepareAction did not return an object'); + return Ae({ + type: e, + payload: n.payload + }, 'meta' in n && { meta: n.meta }, {}, 'error' in n && { error: n.error }); + } + return { + type: e, + payload: arguments.length <= 0 ? void 0 : arguments[0] + }; + } + return n.toString = function () { + return '' + e; + }, n.type = e, n.match = function (t) { + return t.type === e; + }, n; + } + function ze(e) { + var t, n = {}, r = [], o = { + addCase: function (e, t) { + var r = 'string' === typeof e ? e : e.type; + if (r in n) + throw new Error('addCase cannot be called with two reducers for the same action type'); + return n[r] = t, o; + }, + addMatcher: function (e, t) { + return r.push({ + matcher: e, + reducer: t + }), o; + }, + addDefaultCase: function (e) { + return t = e, o; + } + }; + return e(o), [ + n, + r, + t + ]; + } + 'undefined' !== typeof Symbol && (Symbol.iterator || (Symbol.iterator = Symbol('Symbol.iterator'))), 'undefined' !== typeof Symbol && (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol('Symbol.asyncIterator'))); + K(); + var Ge = n(35), He = n.n(Ge); + function We(e, t, n, r, o, i, a) { + try { + var s = e[i](a), c = s.value; + } catch (u) { + return void n(u); + } + s.done ? t(c) : Promise.resolve(c).then(r, o); + } + function $e(e) { + return function () { + var t = this, n = arguments; + return new Promise(function (r, o) { + var i = e.apply(t, n); + function a(e) { + We(i, r, o, a, s, 'next', e); + } + function s(e) { + We(i, r, o, a, s, 'throw', e); + } + a(void 0); + }); + }; + } + var Ye = n(0), Qe = n.n(Ye), Ke = n(52), Je = n.n(Ke), Xe = (n(118), Qe.a.createContext(null)); + var Ze = function (e) { + e(); + }, et = { + notify: function () { + } + }; + function tt() { + var e = Ze, t = null, n = null; + return { + clear: function () { + t = null, n = null; + }, + notify: function () { + e(function () { + for (var e = t; e;) + e.callback(), e = e.next; + }); + }, + get: function () { + for (var e = [], n = t; n;) + e.push(n), n = n.next; + return e; + }, + subscribe: function (e) { + var r = !0, o = n = { + callback: e, + next: null, + prev: n + }; + return o.prev ? o.prev.next = o : t = o, function () { + r && null !== t && (r = !1, o.next ? o.next.prev = o.prev : n = o.prev, o.prev ? o.prev.next = o.next : t = o.next); + }; + } + }; + } + var nt = function () { + function e(e, t) { + this.store = e, this.parentSub = t, this.unsubscribe = null, this.listeners = et, this.handleChangeWrapper = this.handleChangeWrapper.bind(this); + } + var t = e.prototype; + return t.addNestedSub = function (e) { + return this.trySubscribe(), this.listeners.subscribe(e); + }, t.notifyNestedSubs = function () { + this.listeners.notify(); + }, t.handleChangeWrapper = function () { + this.onStateChange && this.onStateChange(); + }, t.isSubscribed = function () { + return Boolean(this.unsubscribe); + }, t.trySubscribe = function () { + this.unsubscribe || (this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.handleChangeWrapper) : this.store.subscribe(this.handleChangeWrapper), this.listeners = tt()); + }, t.tryUnsubscribe = function () { + this.unsubscribe && (this.unsubscribe(), this.unsubscribe = null, this.listeners.clear(), this.listeners = et); + }, e; + }(); + var rt = function (e) { + var t = e.store, n = e.context, r = e.children, o = Object(Ye.useMemo)(function () { + var e = new nt(t); + return e.onStateChange = e.notifyNestedSubs, { + store: t, + subscription: e + }; + }, [t]), i = Object(Ye.useMemo)(function () { + return t.getState(); + }, [t]); + Object(Ye.useEffect)(function () { + var e = o.subscription; + return e.trySubscribe(), i !== t.getState() && e.notifyNestedSubs(), function () { + e.tryUnsubscribe(), e.onStateChange = null; + }; + }, [ + o, + i + ]); + var a = n || Xe; + return Qe.a.createElement(a.Provider, { value: o }, r); + }; + function ot() { + return (ot = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var r in n) + Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); + } + return e; + }).apply(this, arguments); + } + n(81), n(34); + var it = 'undefined' !== typeof window && 'undefined' !== typeof window.document && 'undefined' !== typeof window.document.createElement ? Ye.useLayoutEffect : Ye.useEffect; + function at() { + return Object(Ye.useContext)(Xe); + } + function st(e) { + void 0 === e && (e = Xe); + var t = e === Xe ? at : function () { + return Object(Ye.useContext)(e); + }; + return function () { + return t().store; + }; + } + var ct = st(); + function ut(e) { + void 0 === e && (e = Xe); + var t = e === Xe ? ct : st(e); + return function () { + return t().dispatch; + }; + } + var lt = ut(), ft = function (e, t) { + return e === t; + }; + function pt(e) { + void 0 === e && (e = Xe); + var t = e === Xe ? at : function () { + return Object(Ye.useContext)(e); + }; + return function (e, n) { + void 0 === n && (n = ft); + var r = t(), o = function (e, t, n, r) { + var o, i = Object(Ye.useReducer)(function (e) { + return e + 1; + }, 0)[1], a = Object(Ye.useMemo)(function () { + return new nt(n, r); + }, [ + n, + r + ]), s = Object(Ye.useRef)(), c = Object(Ye.useRef)(), u = Object(Ye.useRef)(), l = Object(Ye.useRef)(), f = n.getState(); + try { + o = e !== c.current || f !== u.current || s.current ? e(f) : l.current; + } catch (p) { + throw s.current && (p.message += '\nThe error may be correlated with this previous error:\n' + s.current.stack + '\n\n'), p; + } + return it(function () { + c.current = e, u.current = f, l.current = o, s.current = void 0; + }), it(function () { + function e() { + try { + var e = c.current(n.getState()); + if (t(e, l.current)) + return; + l.current = e; + } catch (p) { + s.current = p; + } + i(); + } + return a.onStateChange = e, a.trySubscribe(), e(), function () { + return a.tryUnsubscribe(); + }; + }, [ + n, + a + ]), o; + }(e, n, r.store, r.subscription); + return Object(Ye.useDebugValue)(o), o; + }; + } + var dt, ht = pt(); + function mt(e, t) { + return s(e) || function (e, t) { + if ('undefined' !== typeof Symbol && Symbol.iterator in Object(e)) { + var n = [], r = !0, o = !1, i = void 0; + try { + for (var a, s = e[Symbol.iterator](); !(r = (a = s.next()).done) && (n.push(a.value), !t || n.length !== t); r = !0); + } catch (c) { + o = !0, i = c; + } finally { + try { + r || null == s.return || s.return(); + } finally { + if (o) + throw i; + } + } + return n; + } + }(e, t) || i(e, t) || c(); + } + function gt(e, t) { + return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); + } + dt = Ke.unstable_batchedUpdates, Ze = dt; + var vt = n(2); + function yt() { + var e = gt([ + '\n && {\n max-width: 1600px;\n width: 100%;\n margin-top: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n height: auto;\n padding: 20px 15px 10px;\n flex-wrap: wrap;\n position: relative;\n background: none;\n\n &::before {\n content: "";\n position: absolute;\n height: 100%;\n width: 100vw;\n background: ', + ';\n top: -1px;\n left: 0;\n z-index: -1;\n }\n &::after {\n content: "";\n position: absolute;\n height: 100%;\n width: 100vw;\n background: ', + ';\n top: -1px;\n right: 0;\n z-index: -1;\n }\n\n .qc-cmp2-summary-section {\n width: 72%;\n align-items: flex-start;\n }\n\n .qc-cmp2-footer {\n width: 28%;\n padding: 0;\n max-height: 150px;\n box-shadow: none;\n border-top: none;\n\n .qc-cmp2-summary-buttons {\n flex-direction: column;\n justify-content: end;\n\n button{\n order: 1;\n margin-bottom: 10px\n\n &:last-child {\n order 0;\n }\n\n &:first-child {\n order 2;\n margin-bottom: 0;\n }\n }\n }\n }\n\n p,\n h2 {\n justify-self: flex-start;\n text-align: left;\n }\n }\n ' + ]); + return yt = function () { + return e; + }, e; + } + function bt() { + var e = gt(['\n height: 19px;\n svg {\n width: 12px;\n }\n ']); + return bt = function () { + return e; + }, e; + } + function Et() { + var e = gt([ + '\n .qc-cmp2-scrollable-section {\n height: ', + ';\n }\n ' + ]); + return Et = function () { + return e; + }, e; + } + function wt() { + var e = gt([ + '\n && {\n background: ', + ';\n height: 95%;\n width: 100%;\n display: grid;\n grid-template-rows: ', + ';\n justify-items: center;\n position: relative;\n\n ', + '\n\n h2 {\n color: ', + ';\n font-size: 18px;\n font-weight: 600;\n }\n\n p {\n color: ', + ';\n font-size: 14px;\n line-height: 21px;\n\n a {\n color: ', + ';\n text-decoration: none;\n }\n }\n\n .qc-cmp2-close-icon {\n background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'24\' height=\'24\'%3E%3Cpath d=\'M.5.5l23 23m0-23l-23 23\' fill=\'none\' stroke=\'%23000\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-miterlimit=\'10\'/%3E%3Cpath fill=\'none\' d=\'M0 0h24v24H0z\'/%3E%3C/svg%3E")\n no-repeat;\n background-size: 66%;\n border: none;\n box-shadow: none;\n outline: none;\n position: absolute;\n height: 38px;\n width: 38px;\n right: 20px;\n top: 20px;\n z-index: 1;\n cursor: pointer;\n }\n\n .qc-cmp2-info-icon {\n background-image: url("data:image/svg+xml,%3Csvg aria-hidden=\'true\' focusable=\'false\' xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 512 512\'%3E%3Cpath fill=\'%23FAAD14\' d=\'M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z\'%3E%3C/path%3E%3C/svg%3E%0A");\n background-repeat: no-repeat;\n flex-shrink: 0;\n margin-right: 5px;\n height: 15px;\n width: 21px;\n }\n\n .qc-cmp2-consent-info {\n padding: 5% 20px 2%;\n text-align: center;\n\n .qc-cmp2-publisher-logo-container {\n position: relative;\n text-align: center;\n\n .qc-cmp2-home-button {\n background: none;\n border: none;\n box-shadow: none;\n color: ', + ';\n cursor: pointer;\n display: flex;\n align-items: center;\n font-size: 14px;\n font-weight: bold;\n text-transform: uppercase;\n position: absolute;\n top: 0%;\n left: 0%;\n z-index: 1;\n svg {\n use {\n fill: ', + ';\n }\n }\n ', + '\n\n &:focus {\n outline: none;\n }\n\n img {\n margin: 0 5px 0 0;\n }\n }\n\n figure .logo-container {\n margin: 0 auto;\n }\n\n img {\n margin-bottom: 2%;\n }\n }\n\n h2 {\n margin-bottom: 3%;\n }\n\n p {\n text-align: left;\n margin-bottom: 3%;\n max-height: 20vh;\n font-size: 13px;\n overflow: auto;\n }\n }\n\n .qc-cmp2-summary-section {\n display: grid;\n justify-items: center;\n overflow: hidden;\n\n h2 {\n margin-top: 0;\n margin-bottom: 10px;\n }\n\n .logo-container {\n margin-bottom: 13px;\n }\n .qc-cmp2-publisher-logo-container {\n height: 100%;\n }\n\n .qc-cmp2-summary-info {\n padding-bottom: 30px;\n height: 100%;\n overflow-y: auto;\n\n p {\n line-height: 1.5em;\n margin-bottom: 15px;\n max-height: none;\n }\n }\n }\n\n .qc-cmp2-scrollable-section {\n overflow-y: auto;\n flex: 1;\n width: 100%;\n max-width: 770px;\n max-height: 100%;\n\n &::-webkit-scrollbar {\n width: 0.7rem;\n visibility: hidden;\n }\n &::-webkit-scrollbar-thumb {\n background: ', + ';\n }\n &.loading {\n &::-webkit-scrollbar-thumb {\n background: ', + ';\n }\n }\n span.qc-cmp2-loading-message {\n display: none;\n position: absolute;\n margin: auto;\n left: 0;\n right: 0;\n text-align: center;\n background-color: ', + ';\n }\n }\n\n .qc-cmp2-privacy-policy {\n border-top: solid 1px ', + ';\n padding: 2.5% 60px;\n\n a {\n text-decoration: none;\n color: ', + ';\n }\n }\n\n .qc-cmp2-footer {\n background-color: transparent;\n border-top: solid 1px ', + ';\n padding: 3% 15px;\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n position: relative;\n width: 100%;\n\n &.qc-cmp2-footer-overlay {\n &::before {\n content: \'\';\n display: block;\n width: 100%;\n position: absolute;\n height: 50px;\n background: linear-gradient(0deg, #ffffff, rgba(255, 255, 255, 0));\n left: 0;\n top: -51px;\n pointer-events: none;\n transition: all 0.2s ease;\n opacity: 1;\n }\n\n &.qc-cmp2-footer-scrolled {\n &::before {\n height: 0;\n opacity: 0;\n }\n }\n }\n\n * {\n box-sizing: border-box;\n }\n\n [mode=\'link\'] {\n &:not(.qc-cmp2-link-active) {\n color: ', + ';\n }\n }\n\n & > button {\n width: 100%;\n &:first-child {\n margin-bottom: 2.8%;\n }\n }\n\n .qc-cmp2-footer-links {\n display: flex;\n justify-content: space-between;\n padding-top: 10px;\n width: 100%;\n }\n\n .qc-cmp2-footer-permisio {\n align-items: center;\n background: ', + ';\n border-radius: 4px;\n color: ', + ';\n display: flex;\n margin-bottom: 12px;\n padding: 0 10px;\n width: 100%;\n > a {\n letter-spacing: 0.1em;\n }\n }\n\n .qc-cmp2-footer-permisio-link {\n color: ', + ';\n font-weight: bold;\n }\n\n .qc-cmp2-footer-permisio-warning {\n color: ', + ';\n }\n\n .qc-cmp2-buttons-desktop {\n display: none;\n }\n\n .qc-cmp2-summary-buttons {\n width: 100%;\n display: flex;\n flex-direction: column;\n\n button {\n width: 100%;\n margin-bottom: 10px;\n order: 1;\n\n &:first-child {\n order: 2;\n }\n\n &:last-child {\n order: 0;\n }\n }\n }\n }\n\n @media (max-width: 360px) {\n /* support for iPhone 5/SE and Galaxy S5 */\n display: block;\n height: 100%;\n\n p {\n font-size: 13px;\n }\n\n .qc-cmp2-summary-section {\n max-height: 70%;\n overflow-y: auto;\n }\n\n .qc-cmp2-consent-info {\n padding-top: 10px;\n\n img {\n margin-bottom: 0;\n }\n\n h2 {\n margin-bottom: 3px;\n }\n\n p {\n margin-bottom: 5px;\n max-height: 15vh;\n }\n }\n\n .qc-cmp2-scrollable-section {\n max-height: 42%;\n }\n\n .qc-cmp2-privacy-policy {\n padding: 8px 25px;\n\n p {\n text-align: center;\n }\n }\n }\n\n @media (min-width: 768px) {\n height: ', + ';\n max-height: ', + ';\n width: 770px;\n grid-template-rows: auto 1fr;\n\n h2 {\n font-size: 20px;\n margin-top: 10px;\n }\n\n p {\n font-size: 15px;\n }\n\n .qc-cmp2-hide-desktop {\n display: none;\n }\n\n .qc-cmp2-consent-info {\n padding: 15px 30px;\n width: 100%;\n\n p {\n margin-bottom: 0;\n max-height: none;\n font-size: 14px;\n }\n\n .qc-cmp2-publisher-logo-container {\n img {\n margin-bottom: 0;\n }\n h2 {\n margin-bottom: 10px;\n }\n }\n }\n\n .qc-cmp2-scrollable-section {\n padding: 0 30px;\n }\n\n .qc-cmp2-footer {\n padding: 13px 30px;\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n box-shadow: 0 -2px 4px 0 rgba(0, 0, 0, 0.1);\n\n .qc-cmp2-footer-links {\n padding-top: 0;\n width: auto;\n button {\n &:not(.qc-cmp2-link-active) {\n color: ', + ';\n }\n margin-left: 15px;\n &:first-child {\n margin-left: 0;\n }\n }\n }\n\n .qc-cmp2-footer-permisio {\n margin-bottom: 7px;\n padding: 7px 10px;\n }\n\n .qc-cmp2-buttons-desktop {\n display: inline-flex;\n flex: 1;\n margin-left: 50px;\n button {\n margin: 0;\n flex: 1;\n font-size: 11px;\n }\n\n button {\n &:first-of-type {\n margin-right: 1em;\n }\n }\n }\n\n .qc-cmp2-summary-buttons {\n flex-direction: row;\n justify-content: space-between;\n padding: 5px 0;\n\n button {\n margin-bottom: 0;\n margin-right: 15px;\n order: 0;\n\n &:first-child {\n order: 0;\n }\n\n &:last-child {\n margin-right: 0;\n }\n }\n }\n\n &.qc-cmp2-footer-overlay {\n &::before {\n display: none;\n }\n }\n }\n\n ', + '\n }\n }\n' + ]); + return wt = function () { + return e; + }, e; + } + var xt, St, Ct, kt, Tt, _t, Pt, Ot, It, Lt, At = vt.c.div(wt(), function (e) { + return e.uxBackgroundColor; + }, function (e) { + return 0 !== e.page ? 'auto 3fr auto' : 'none'; + }, function (e) { + return e.isIE && Object(vt.b)(Et(), function () { + return 1 === e.page ? e.usesLogo ? '192px' : '262px' : 2 === e.page ? e.usesLogo ? '282px' : '342px' : e.usesLogo ? '262px' : '332px'; + }); + }, function (e) { + return e.uxFontColor; + }, function (e) { + return e.uxFontColor; + }, function (e) { + return e.uxPrimaryButtonColor; + }, function (e) { + return e.uxPrimaryButtonColor; + }, function (e) { + return e.uxPrimaryButtonColor; + }, function (e) { + return e.isIE && Object(vt.b)(bt()); + }, function (e) { + return e.uxPrimaryButtonColor; + }, function (e) { + return e.uxBackgroundColor; + }, function (e) { + return e.uxBackgroundColor; + }, function (e) { + return e.borderColor; + }, function (e) { + return e.uxPrimaryButtonColor; + }, function (e) { + return e.borderColor; + }, function (e) { + return e.uxLinkColor; + }, function (e) { + return e.warningBackgroundColor; + }, function (e) { + return e.warningTextColor; + }, function (e) { + return e.warningTextColor; + }, function (e) { + return e.warningTextColor; + }, function (e) { + return 0 === e.page ? 'auto' : 'inherit'; + }, function (e) { + return 0 === e.page ? 'none' : '550px'; + }, function (e) { + return e.uxLinkColor; + }, function (e) { + var t = e.isPopup, n = e.page, r = e.uxBackgroundColor; + return !t && 0 === n && Object(vt.b)(yt(), r, r); + }); + function Rt() { + var e = gt(['\n height: 34px;\n\n svg {\n height: 22px;\n width: 14px;\n }\n ']); + return Rt = function () { + return e; + }, e; + } + function Nt() { + var e = gt([ + '\n && {\n list-style: none;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n\n &:first-of-type {\n .qc-cmp2-list-header {\n margin: 0;\n }\n }\n\n &:last-of-type {\n margin-bottom: 0;\n }\n\n .qc-cmp2-list-header {\n color: ', + ';\n font-size: 12px;\n font-weight: 900;\n text-transform: uppercase;\n margin-top: 20px;\n padding-left: 20px;\n }\n\n .qc-cmp2-list-item {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n padding: 10px 20px;\n font-size: 14px;\n font-weight: 400;\n\n &.qc-cmp2-expanded {\n background: ', + ';\n z-index: 10;\n }\n\n &:only-of-type {\n border-bottom: 1px solid ', + ';\n }\n\n &:nth-of-type(even) {\n border-top: 1px solid ', + ';\n border-bottom: 1px solid ', + ';\n }\n\n .qc-cmp2-list-item-header {\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n background: none;\n border: none;\n outline: none;\n box-shadow: none;\n text-align: left;\n padding: 0;\n min-height: 21px;\n cursor: pointer;\n color: ', + ';\n\n &:focus {\n outline: none;\n }\n }\n\n &.qc-cmp2-list-item-legitimate {\n .qc-cmp2-list-item-title {\n width: 75%;\n }\n .qc-cmp2-toggle-switch {\n order: 2;\n }\n }\n\n .qc-cmp2-list-item-title {\n margin: 0;\n padding: 0;\n width: 80%;\n font-size: 14px;\n cursor: pointer;\n strong {\n color: ', + ';\n }\n }\n\n .qc-cmp2-list-item-status {\n color: ', + ';\n margin: 0 10px 0 0;\n padding: 0;\n cursor: pointer;\n\n &.qc-cmp-long-label {\n font-size: 9px;\n line-height: 1em;\n }\n }\n\n img {\n transition: transform 0.2s ease;\n max-width: 12px;\n }\n\n &.qc-cmp2-toggle-switch {\n pointer-events: fill;\n padding: 0 20px;\n }\n\n .qc-cmp2-toggle {\n &:not(:last-child) {\n margin-right: 15px;\n }\n }\n\n .qc-cmp2-expandable-list {\n list-style: none;\n display: flex;\n justify-content: space-between;\n width: 100%;\n margin: 0;\n padding: 0;\n max-height: 0;\n opacity: 0;\n transition: opacity 0.2s ease, max-height 0.3s ease, padding 0.3s ease,\n margin 0.3s ease;\n pointer-events: none;\n\n &.qc-wrap {\n flex-wrap: wrap;\n\n .qc-cmp2-expandable-info {\n order: 1;\n }\n }\n\n p,\n li {\n font-size: 14px;\n line-height: 18px;\n font-weight: 400;\n color: ', + ';\n margin: 0;\n padding: 0;\n text-transform: none;\n\n a {\n color: ', + ';\n font-weight: 500;\n text-decoration: none;\n word-break: break-all;\n }\n\n &:not(:first-child) {\n strong {\n margin-top: 8px;\n display: block;\n }\n }\n }\n .qc-cmp2-expandable-info {\n width: 85%;\n\n .qc-cmp2-expandable-legal {\n .qc-cmp2-toggle-legal-button {\n text-transform: capitalize;\n margin-top: 10px;\n align-items: center;\n ', + '\n }\n\n .qc-cmp2-legal-description {\n display: none;\n padding-left: 15px;\n }\n\n &.qc-cmp2-expanded {\n .qc-cmp2-legal-description {\n margin-top: 10px;\n display: block;\n\n &.qc-cmp2-non-iab {\n opacity: 0.65;\n }\n }\n }\n }\n }\n }\n\n &.qc-cmp2-expanded {\n .qc-cmp2-expandable-list {\n max-height: 150000px;\n opacity: 1;\n pointer-events: fill;\n margin: 15px 0;\n }\n }\n }\n\n @media (min-width: 768px) {\n .qc-cmp2-list-item {\n padding: 15px;\n font-size: 14px;\n\n &.qc-cmp2-list-item-legitimate {\n .qc-cmp2-list-item-title {\n width: 82%;\n }\n }\n\n .qc-cmp2-list-item-title {\n width: 90%;\n }\n\n .qc-cmp2-expandable-list {\n &.qc-wrap {\n .qc-cmp2-expandable-info {\n order: 0;\n\n &.qc-w75 {\n width: 75%;\n }\n }\n }\n }\n\n .qc-cmp2-list-item-status {\n &.qc-cmp-long-label {\n font-size: 10px;\n }\n }\n }\n\n .qc-cmp2-list-header {\n padding-left: 0;\n }\n }\n @media (max-width: 768px) {\n .qc-cmp2-list-item {\n &.qc-cmp2-list-item-legitimate {\n .qc-cmp2-expandable-list {\n flex-wrap: no-wrap;\n .qc-cmp2-toggle-switch {\n order: 1;\n width: 100%;\n button{\n float:right;\n }\n }\n .qc-cmp2-expandable-info {\n width:100%\n order: 2;\n }\n }\n }\n }\n }\n }\n' + ]); + return Nt = function () { + return e; + }, e; + } + !function (e) { + e.GO_TO_PAGE = 'goToPage', e.PURPOSE = 'purpose', e.LEGITIMATE_PURPOSE = 'legitimatePurpose', e.LEGITIMATE_VENDOR = 'legitimateVendor', e.SPECIAL_FEATURE = 'specialFeature', e.STACK = 'stack', e.PARTIAL_CONSENT = 'partial', e.SAVE_AND_EXIT = 'saveAndExit', e.ACCEPT_ALL = 'acceptAll', e.REJECT_ALL = 'rejectAll', e.ACCEPT_ALL_LEGITIMATE = 'acceptAllLegitimate', e.OBJECT_ALL_LEGITIMATE = 'objectAllLegitimate', e.VENDOR = 'vendor', e.NON_IAB_VENDOR = 'nonIabVendor', e.DISMISS_UI = 'dismissUi', e.START_ON_PAGE = 'startOnPage', e.OPT_OUT_TOGGLE = 'optOutToggle', e.OPT_OUT_CONFIRM = 'optOutConfirm', e.EXPAND_ELEMENT = 'expandElement', e.COLLAPSE_ELEMENT = 'collapseElement', e.GOOGLE = 'googlePartner'; + }(xt || (xt = {})), function (e) { + e.MANDATORY = 'tcfui:mandatory', e.CHANGE_OF_CONSENT = 'tcfui:changeofconsent', e.CCPA = 'uspui:donotsell'; + }(St || (St = {})), (kt = Ct || (Ct = {})).FEATURES = 'Features', kt.NON_IAB = 'Non IAB', kt.PURPOSES = 'Purposes', kt.LEGITIMATE_PURPOSES = 'Legitimate Purposes', kt.LEGITIMATE_VENDORS = 'Legitimate Vendors', kt.SPECIAL_PURPOSES = 'Special Purposes', kt.SPECIAL_FEATURES = 'Special Features', kt.VENDORS = 'Vendors', kt.STACKS = 'Stacks', kt.GOOGLE = 'Google', function (e) { + e.INIT = 'init', e.NAVIGATION = 'navigation', e.DONE = 'done'; + }(Tt || (Tt = {})), function (e) { + e.ACCEPT_ALL = 'All', e.ACCEPT_PARTIAL = 'Partial', e.REJECT = 'Reject'; + }(_t || (_t = {})), function (e) { + e.NONE_OBJECTED = 'None', e.ALL_OBJECTED = 'All'; + }(Pt || (Pt = {})), function (e) { + e.STACKS = 'stacks', e.VENDORS = 'vendors', e.FEATURES = 'features', e.PURPOSES = 'purposes', e.SPECIAL_FEATURES = 'specialFeatures', e.SPECIAL_PURPOSES = 'specialPurposes', e.FLEXIBLE_PURPOSES = 'flexiblePurposes', e.LEGITIMATE_VENDORS = 'legitimateVendors', e.LEGITIMATE_PURPOSES = 'legitimatePurposes', e.UNFILTERED_FEATURES = 'unfilteredFeatures', e.UNFILTERED_PURPOSES = 'unfilteredPurposes', e.UNFILTERED_SPECIAL_FEATURES = 'unfilteredSpecialFeatures', e.UNFILTERED_SPECIAL_PURPOSES = 'unfilteredSpecialPurposes'; + }(Ot || (Ot = {})), function (e) { + e.CONSENT_RESPONSE = 'consent-response', e.CONSENT_UI = 'consent-ui'; + }(It || (It = {})), function (e) { + e.ACCEPT = 'accept', e.REJECT = 'reject', e.DISMISS = 'dismiss', e.ENTER_FULLSCREEN = 'enter-fullscreen'; + }(Lt || (Lt = {})); + var jt = vt.c.ul(Nt(), function (e) { + return e.subHeaderColor; + }, function (e) { + return e.uxBackgroundColor; + }, function (e) { + return e.borderColor; + }, function (e) { + return e.borderColor; + }, function (e) { + return e.borderColor; + }, function (e) { + return e.lightTextColor; + }, function (e) { + return e.secondaryTextColor; + }, function (e) { + return e.lightTextColor; + }, function (e) { + return e.secondaryTextColor; + }, function (e) { + return e.uxPrimaryButtonColor; + }, function (e) { + return e.isIE && Object(vt.b)(Rt()); + }); + function qt() { + var e = gt(['\n margin-top: 10px;\n margin-right: 3px;\n transform-origin: 15% 30%;\n\n .qc-cmp2-expandable-legal.qc-cmp2-expanded & {\n transform: rotate(90deg);\n }\n ']); + return qt = function () { + return e; + }, e; + } + function Ft() { + var e = gt(['\n height: 12px;\n transform: rotate(180deg);\n width: 12px;\n\n .expanded & {\n transform: rotate(270deg);\n }\n ']); + return Ft = function () { + return e; + }, e; + } + function Dt() { + var e = gt(['\n height: 19px;\n transform: rotate(180deg);\n width: 12px;\n\n .qc-cmp2-expanded & {\n transform: rotate(270deg);\n }\n ']); + return Dt = function () { + return e; + }, e; + } + function Mt() { + var e = gt(['\n margin-right: 5px;\n ']); + return Mt = function () { + return e; + }, e; + } + function Ut() { + var e = gt([ + '\n &&& {\n transition: transform 0.3s ease;\n\n ', + '\n\n ', + '\n\n ', + '\n\n ', + '\n }\n' + ]); + return Ut = function () { + return e; + }, e; + } + var Vt = vt.c.svg(Ut(), function (e) { + return 'back' === e.type && Object(vt.b)(Mt()); + }, function (e) { + return 'expand' === e.type && Object(vt.b)(Dt()); + }, function (e) { + return 'inner' === e.type && Object(vt.b)(Ft()); + }, function (e) { + return 'fill' === e.type && Object(vt.b)(qt()); + }), Bt = function (e) { + var t, n = e.type; + switch (n) { + case 'fill': + t = Qe.a.createElement('path', { + d: 'M5 4.5L0.5 0L0.5 9L5 4.5Z', + fill: 'currentColor' + }); + break; + case 'expand': + case 'inner': + t = Qe.a.createElement(Qe.a.Fragment, null, Qe.a.createElement('defs', null, Qe.a.createElement('path', { + d: 'M3.88716886,8.47048371 L12.1431472,0.315826419 C12.4725453,-0.0145777987 13.005189,-0.0145777987 13.3345872,0.315826419 L13.8321886,0.814947685 C14.1615867,1.1453519 14.1615867,1.67962255 13.8321886,2.01002677 L6.6625232,9.06802326 L13.8251801,16.1260197 C14.1545782,16.456424 14.1545782,16.9906946 13.8251801,17.3210988 L13.3275787,17.8202201 C12.9981806,18.1506243 12.4655368,18.1506243 12.1361387,17.8202201 L3.88016039,9.6655628 C3.55777075,9.33515858 3.55777075,8.80088793 3.88716886,8.47048371 Z', + id: 'path-1' + }), Qe.a.createElement('rect', { + id: 'path-3', + x: '0', + y: '0', + width: '18', + height: '18' + })), Qe.a.createElement('g', { + id: 'New---Mobile-2', + stroke: 'none', + strokeWidth: '1', + fill: 'none', + fillRule: 'evenodd' + }, Qe.a.createElement('g', { + id: 'iPhone-11-6-Copy', + transform: 'translate(-23.000000, -138.000000)' + }, Qe.a.createElement('g', { + id: 'v1', + transform: 'translate(20.000000, 138.000000)' + }, Qe.a.createElement('g', { id: 'Icons/angle-left' }, Qe.a.createElement('mask', { + id: 'mask-2', + fill: 'white' + }, Qe.a.createElement('use', { href: '#path-1' })), Qe.a.createElement('use', { + id: 'Mask', + fill: 'currentColor', + fillRule: 'nonzero', + href: '#path-1' + })))))); + break; + default: + t = Qe.a.createElement(Qe.a.Fragment, null, Qe.a.createElement('defs', null, Qe.a.createElement('path', { + d: 'M3.88716886,8.47048371 L12.1431472,0.315826419 C12.4725453,-0.0145777987 13.005189,-0.0145777987 13.3345872,0.315826419 L13.8321886,0.814947685 C14.1615867,1.1453519 14.1615867,1.67962255 13.8321886,2.01002677 L6.6625232,9.06802326 L13.8251801,16.1260197 C14.1545782,16.456424 14.1545782,16.9906946 13.8251801,17.3210988 L13.3275787,17.8202201 C12.9981806,18.1506243 12.4655368,18.1506243 12.1361387,17.8202201 L3.88016039,9.6655628 C3.55777075,9.33515858 3.55777075,8.80088793 3.88716886,8.47048371 Z', + id: 'path-1' + }), Qe.a.createElement('rect', { + id: 'path-3', + x: '0', + y: '0', + width: '18', + height: '18' + })), Qe.a.createElement('g', { + id: 'New---Mobile-2', + stroke: 'none', + strokeWidth: '1', + fill: 'none', + fillRule: 'evenodd' + }, Qe.a.createElement('g', { + id: 'iPhone-11-6-Copy', + transform: 'translate(-23.000000, -138.000000)' + }, Qe.a.createElement('g', { + id: 'v1', + transform: 'translate(20.000000, 138.000000)' + }, Qe.a.createElement('g', { id: 'Icons/angle-left' }, Qe.a.createElement('mask', { + id: 'mask-2', + fill: 'white' + }, Qe.a.createElement('use', { href: '#path-1' })), Qe.a.createElement('use', { + id: 'Mask', + fill: '#000000', + fillRule: 'nonzero', + href: '#path-1' + })))))); + } + return Qe.a.createElement(Vt, { + type: n, + width: '12px', + height: '19px', + viewBox: '0 0 12 19', + version: '1.1' + }, t); + }; + function zt(e, t) { + if (null == e) + return {}; + var n, r, o = function (e, t) { + if (null == e) + return {}; + var n, r, o = {}, i = Object.keys(e); + for (r = 0; r < i.length; r++) + n = i[r], t.indexOf(n) >= 0 || (o[n] = e[n]); + return o; + }(e, t); + if (Object.getOwnPropertySymbols) { + var i = Object.getOwnPropertySymbols(e); + for (r = 0; r < i.length; r++) + n = i[r], t.indexOf(n) >= 0 || Object.prototype.propertyIsEnumerable.call(e, n) && (o[n] = e[n]); + } + return o; + } + function Gt() { + var e = gt([ + '\n background: ', + ';\n border-color: ', + ';\n min-height: 18px;\n border-radius: 18px;\n .toggle {\n right: 0;\n }\n p.text {\n &.on {\n display: ', + ';\n }\n &.off {\n display: none;\n }\n }\n\n @media (min-width: 768px) {\n min-height: 25px;\n border-radius: 25px;\n }\n ' + ]); + return Gt = function () { + return e; + }, e; + } + function Ht() { + var e = gt([ + '\n &&&& {\n width: 30px;\n height: 18px;\n border-radius: 18px;\n padding: 0;\n align-items: center;\n margin: 0 0 0 auto;\n background: #a6a9ae;\n position: relative;\n border: 1px solid #a6a9ae;\n box-sizing: content-box;\n border-radius: 18px;\n min-height: 18px;\n\n .toggle {\n width: ', + ';\n height: ', + ';\n border-radius: 50%;\n background: white;\n position: absolute;\n top: 0;\n right: 12px;\n }\n\n p.text {\n font-size: 9px;\n font-weight: 700;\n text-transform: capitalize;\n margin-top: 20px;\n text-align: center;\n display: ', + ';\n &.on {\n color: ', + ';\n display: none;\n }\n &.off {\n color: ', + ';\n }\n }\n @media (min-width: 768px) {\n width: 50px;\n height: 25px;\n min-height: 25px;\n border-radius: 25px;\n p.text {\n margin-top: 30px;\n text-transform: uppercase;\n }\n\n .toggle {\n width: ', + ';\n height: ', + ';\n right: 25px;\n }\n }\n\n ', + ';\n }\n' + ]); + return Ht = function () { + return e; + }, e; + } + var Wt = vt.c.button(Ht(), '18px', '18px', function (e) { + return e.showLabel ? 'block' : 'none'; + }, function (e) { + return e.uxPrimaryButtonColor; + }, function (e) { + return e.secondaryTextColor; + }, '25px', '25px', function (e) { + var t = e.switchState, n = e.uxToogleActiveColor; + return t && Object(vt.b)(Gt(), n, n, function (e) { + return e.showLabel ? 'block' : 'none'; + }); + }), $t = function (e) { + var t = e.on, n = void 0 !== t && t, r = e.className, o = e.onClick, i = e.showLabel, a = void 0 !== i && i, s = e.disabled, c = void 0 !== s && s, u = zt(e, [ + 'on', + 'className', + 'onClick', + 'showLabel', + 'disabled' + ]); + return Qe.a.createElement(Wt, Object.assign({ + tabIndex: 0, + role: 'switch', + 'aria-label': 'Consent toggle', + 'aria-checked': n, + switchState: n, + onClick: o, + className: r && r, + showLabel: a, + disabled: c, + uxPrimaryButtonColor: _o.uxPrimaryButtonColor, + secondaryTextColor: _o.secondaryTextColor, + uxToogleActiveColor: _o.uxToogleActiveColor + }, u), Qe.a.createElement('div', { className: 'toggle' }), Qe.a.createElement('p', { + className: 'text off', + 'aria-label': 'Toggle off' + }, Po.coreUiLabels.offLabel), Qe.a.createElement('p', { + className: 'text on', + 'aria-label': 'Toggle on' + }, Po.coreUiLabels.onLabel)); + }; + function Yt(e) { + return (Yt = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) { + return e.__proto__ || Object.getPrototypeOf(e); + })(e); + } + function Qt(e, t) { + return (Qt = Object.setPrototypeOf || function (e, t) { + return e.__proto__ = t, e; + })(e, t); + } + function Kt() { + if ('undefined' === typeof Reflect || !Reflect.construct) + return !1; + if (Reflect.construct.sham) + return !1; + if ('function' === typeof Proxy) + return !0; + try { + return Date.prototype.toString.call(Reflect.construct(Date, [], function () { + })), !0; + } catch (e) { + return !1; + } + } + function Jt(e, t, n) { + return (Jt = Kt() ? Reflect.construct : function (e, t, n) { + var r = [null]; + r.push.apply(r, t); + var o = new (Function.bind.apply(e, r))(); + return n && Qt(o, n.prototype), o; + }).apply(null, arguments); + } + function Xt(e) { + var t = 'function' === typeof Map ? new Map() : void 0; + return (Xt = function (e) { + if (null === e || !function (e) { + return -1 !== Function.toString.call(e).indexOf('[native code]'); + }(e)) + return e; + if ('function' !== typeof e) + throw new TypeError('Super expression must either be null or a function'); + if ('undefined' !== typeof t) { + if (t.has(e)) + return t.get(e); + t.set(e, n); + } + function n() { + return Jt(e, arguments, Yt(this).constructor); + } + return n.prototype = Object.create(e.prototype, { + constructor: { + value: n, + enumerable: !1, + writable: !0, + configurable: !0 + } + }), Qt(n, e); + })(e); + } + var Zt = function (e) { + var t, n; + function r(t) { + return function (e) { + if (void 0 === e) + throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called'); + return e; + }(e.call(this, 'An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#' + t + ' for more information.') || this); + } + return n = e, (t = r).prototype = Object.create(n.prototype), t.prototype.constructor = t, t.__proto__ = n, r; + }(Xt(Error)); + function en(e) { + return Math.round(255 * e); + } + function tn(e, t, n) { + return en(e) + ',' + en(t) + ',' + en(n); + } + function nn(e, t, n, r) { + if (void 0 === r && (r = tn), 0 === t) + return r(n, n, n); + var o = (e % 360 + 360) % 360 / 60, i = (1 - Math.abs(2 * n - 1)) * t, a = i * (1 - Math.abs(o % 2 - 1)), s = 0, c = 0, u = 0; + o >= 0 && o < 1 ? (s = i, c = a) : o >= 1 && o < 2 ? (s = a, c = i) : o >= 2 && o < 3 ? (c = i, u = a) : o >= 3 && o < 4 ? (c = a, u = i) : o >= 4 && o < 5 ? (s = a, u = i) : o >= 5 && o < 6 && (s = i, u = a); + var l = n - i / 2; + return r(s + l, c + l, u + l); + } + var rn = { + aliceblue: 'f0f8ff', + antiquewhite: 'faebd7', + aqua: '00ffff', + aquamarine: '7fffd4', + azure: 'f0ffff', + beige: 'f5f5dc', + bisque: 'ffe4c4', + black: '000', + blanchedalmond: 'ffebcd', + blue: '0000ff', + blueviolet: '8a2be2', + brown: 'a52a2a', + burlywood: 'deb887', + cadetblue: '5f9ea0', + chartreuse: '7fff00', + chocolate: 'd2691e', + coral: 'ff7f50', + cornflowerblue: '6495ed', + cornsilk: 'fff8dc', + crimson: 'dc143c', + cyan: '00ffff', + darkblue: '00008b', + darkcyan: '008b8b', + darkgoldenrod: 'b8860b', + darkgray: 'a9a9a9', + darkgreen: '006400', + darkgrey: 'a9a9a9', + darkkhaki: 'bdb76b', + darkmagenta: '8b008b', + darkolivegreen: '556b2f', + darkorange: 'ff8c00', + darkorchid: '9932cc', + darkred: '8b0000', + darksalmon: 'e9967a', + darkseagreen: '8fbc8f', + darkslateblue: '483d8b', + darkslategray: '2f4f4f', + darkslategrey: '2f4f4f', + darkturquoise: '00ced1', + darkviolet: '9400d3', + deeppink: 'ff1493', + deepskyblue: '00bfff', + dimgray: '696969', + dimgrey: '696969', + dodgerblue: '1e90ff', + firebrick: 'b22222', + floralwhite: 'fffaf0', + forestgreen: '228b22', + fuchsia: 'ff00ff', + gainsboro: 'dcdcdc', + ghostwhite: 'f8f8ff', + gold: 'ffd700', + goldenrod: 'daa520', + gray: '808080', + green: '008000', + greenyellow: 'adff2f', + grey: '808080', + honeydew: 'f0fff0', + hotpink: 'ff69b4', + indianred: 'cd5c5c', + indigo: '4b0082', + ivory: 'fffff0', + khaki: 'f0e68c', + lavender: 'e6e6fa', + lavenderblush: 'fff0f5', + lawngreen: '7cfc00', + lemonchiffon: 'fffacd', + lightblue: 'add8e6', + lightcoral: 'f08080', + lightcyan: 'e0ffff', + lightgoldenrodyellow: 'fafad2', + lightgray: 'd3d3d3', + lightgreen: '90ee90', + lightgrey: 'd3d3d3', + lightpink: 'ffb6c1', + lightsalmon: 'ffa07a', + lightseagreen: '20b2aa', + lightskyblue: '87cefa', + lightslategray: '789', + lightslategrey: '789', + lightsteelblue: 'b0c4de', + lightyellow: 'ffffe0', + lime: '0f0', + limegreen: '32cd32', + linen: 'faf0e6', + magenta: 'f0f', + maroon: '800000', + mediumaquamarine: '66cdaa', + mediumblue: '0000cd', + mediumorchid: 'ba55d3', + mediumpurple: '9370db', + mediumseagreen: '3cb371', + mediumslateblue: '7b68ee', + mediumspringgreen: '00fa9a', + mediumturquoise: '48d1cc', + mediumvioletred: 'c71585', + midnightblue: '191970', + mintcream: 'f5fffa', + mistyrose: 'ffe4e1', + moccasin: 'ffe4b5', + navajowhite: 'ffdead', + navy: '000080', + oldlace: 'fdf5e6', + olive: '808000', + olivedrab: '6b8e23', + orange: 'ffa500', + orangered: 'ff4500', + orchid: 'da70d6', + palegoldenrod: 'eee8aa', + palegreen: '98fb98', + paleturquoise: 'afeeee', + palevioletred: 'db7093', + papayawhip: 'ffefd5', + peachpuff: 'ffdab9', + peru: 'cd853f', + pink: 'ffc0cb', + plum: 'dda0dd', + powderblue: 'b0e0e6', + purple: '800080', + rebeccapurple: '639', + red: 'f00', + rosybrown: 'bc8f8f', + royalblue: '4169e1', + saddlebrown: '8b4513', + salmon: 'fa8072', + sandybrown: 'f4a460', + seagreen: '2e8b57', + seashell: 'fff5ee', + sienna: 'a0522d', + silver: 'c0c0c0', + skyblue: '87ceeb', + slateblue: '6a5acd', + slategray: '708090', + slategrey: '708090', + snow: 'fffafa', + springgreen: '00ff7f', + steelblue: '4682b4', + tan: 'd2b48c', + teal: '008080', + thistle: 'd8bfd8', + tomato: 'ff6347', + turquoise: '40e0d0', + violet: 'ee82ee', + wheat: 'f5deb3', + white: 'fff', + whitesmoke: 'f5f5f5', + yellow: 'ff0', + yellowgreen: '9acd32' + }; + var on = /^#[a-fA-F0-9]{6}$/, an = /^#[a-fA-F0-9]{8}$/, sn = /^#[a-fA-F0-9]{3}$/, cn = /^#[a-fA-F0-9]{4}$/, un = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i, ln = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i, fn = /^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i, pn = /^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i; + function dn(e) { + if ('string' !== typeof e) + throw new Zt(3); + var t = function (e) { + if ('string' !== typeof e) + return e; + var t = e.toLowerCase(); + return rn[t] ? '#' + rn[t] : e; + }(e); + if (t.match(on)) + return { + red: parseInt('' + t[1] + t[2], 16), + green: parseInt('' + t[3] + t[4], 16), + blue: parseInt('' + t[5] + t[6], 16) + }; + if (t.match(an)) { + var n = parseFloat((parseInt('' + t[7] + t[8], 16) / 255).toFixed(2)); + return { + red: parseInt('' + t[1] + t[2], 16), + green: parseInt('' + t[3] + t[4], 16), + blue: parseInt('' + t[5] + t[6], 16), + alpha: n + }; + } + if (t.match(sn)) + return { + red: parseInt('' + t[1] + t[1], 16), + green: parseInt('' + t[2] + t[2], 16), + blue: parseInt('' + t[3] + t[3], 16) + }; + if (t.match(cn)) { + var r = parseFloat((parseInt('' + t[4] + t[4], 16) / 255).toFixed(2)); + return { + red: parseInt('' + t[1] + t[1], 16), + green: parseInt('' + t[2] + t[2], 16), + blue: parseInt('' + t[3] + t[3], 16), + alpha: r + }; + } + var o = un.exec(t); + if (o) + return { + red: parseInt('' + o[1], 10), + green: parseInt('' + o[2], 10), + blue: parseInt('' + o[3], 10) + }; + var i = ln.exec(t); + if (i) + return { + red: parseInt('' + i[1], 10), + green: parseInt('' + i[2], 10), + blue: parseInt('' + i[3], 10), + alpha: parseFloat('' + i[4]) + }; + var a = fn.exec(t); + if (a) { + var s = 'rgb(' + nn(parseInt('' + a[1], 10), parseInt('' + a[2], 10) / 100, parseInt('' + a[3], 10) / 100) + ')', c = un.exec(s); + if (!c) + throw new Zt(4, t, s); + return { + red: parseInt('' + c[1], 10), + green: parseInt('' + c[2], 10), + blue: parseInt('' + c[3], 10) + }; + } + var u = pn.exec(t); + if (u) { + var l = 'rgb(' + nn(parseInt('' + u[1], 10), parseInt('' + u[2], 10) / 100, parseInt('' + u[3], 10) / 100) + ')', f = un.exec(l); + if (!f) + throw new Zt(4, t, l); + return { + red: parseInt('' + f[1], 10), + green: parseInt('' + f[2], 10), + blue: parseInt('' + f[3], 10), + alpha: parseFloat('' + u[4]) + }; + } + throw new Zt(5); + } + function hn(e) { + return function (e) { + var t, n = e.red / 255, r = e.green / 255, o = e.blue / 255, i = Math.max(n, r, o), a = Math.min(n, r, o), s = (i + a) / 2; + if (i === a) + return void 0 !== e.alpha ? { + hue: 0, + saturation: 0, + lightness: s, + alpha: e.alpha + } : { + hue: 0, + saturation: 0, + lightness: s + }; + var c = i - a, u = s > 0.5 ? c / (2 - i - a) : c / (i + a); + switch (i) { + case n: + t = (r - o) / c + (r < o ? 6 : 0); + break; + case r: + t = (o - n) / c + 2; + break; + default: + t = (n - r) / c + 4; + } + return t *= 60, void 0 !== e.alpha ? { + hue: t, + saturation: u, + lightness: s, + alpha: e.alpha + } : { + hue: t, + saturation: u, + lightness: s + }; + }(dn(e)); + } + var mn = function (e) { + return 7 === e.length && e[1] === e[2] && e[3] === e[4] && e[5] === e[6] ? '#' + e[1] + e[3] + e[5] : e; + }; + function gn(e) { + var t = e.toString(16); + return 1 === t.length ? '0' + t : t; + } + function vn(e) { + return gn(Math.round(255 * e)); + } + function yn(e, t, n) { + return mn('#' + vn(e) + vn(t) + vn(n)); + } + function bn(e, t, n) { + return nn(e, t, n, yn); + } + function En(e, t, n) { + if ('number' === typeof e && 'number' === typeof t && 'number' === typeof n) + return bn(e, t, n); + if ('object' === typeof e && void 0 === t && void 0 === n) + return bn(e.hue, e.saturation, e.lightness); + throw new Zt(1); + } + function wn(e, t, n, r) { + if ('number' === typeof e && 'number' === typeof t && 'number' === typeof n && 'number' === typeof r) + return r >= 1 ? bn(e, t, n) : 'rgba(' + nn(e, t, n) + ',' + r + ')'; + if ('object' === typeof e && void 0 === t && void 0 === n && void 0 === r) + return e.alpha >= 1 ? bn(e.hue, e.saturation, e.lightness) : 'rgba(' + nn(e.hue, e.saturation, e.lightness) + ',' + e.alpha + ')'; + throw new Zt(2); + } + function xn(e, t, n) { + if ('number' === typeof e && 'number' === typeof t && 'number' === typeof n) + return mn('#' + gn(e) + gn(t) + gn(n)); + if ('object' === typeof e && void 0 === t && void 0 === n) + return mn('#' + gn(e.red) + gn(e.green) + gn(e.blue)); + throw new Zt(6); + } + function Sn(e, t, n, r) { + if ('string' === typeof e && 'number' === typeof t) { + var o = dn(e); + return 'rgba(' + o.red + ',' + o.green + ',' + o.blue + ',' + t + ')'; + } + if ('number' === typeof e && 'number' === typeof t && 'number' === typeof n && 'number' === typeof r) + return r >= 1 ? xn(e, t, n) : 'rgba(' + e + ',' + t + ',' + n + ',' + r + ')'; + if ('object' === typeof e && void 0 === t && void 0 === n && void 0 === r) + return e.alpha >= 1 ? xn(e.red, e.green, e.blue) : 'rgba(' + e.red + ',' + e.green + ',' + e.blue + ',' + e.alpha + ')'; + throw new Zt(7); + } + function Cn(e) { + if ('object' !== typeof e) + throw new Zt(8); + if (function (e) { + return 'number' === typeof e.red && 'number' === typeof e.green && 'number' === typeof e.blue && 'number' === typeof e.alpha; + }(e)) + return Sn(e); + if (function (e) { + return 'number' === typeof e.red && 'number' === typeof e.green && 'number' === typeof e.blue && ('number' !== typeof e.alpha || 'undefined' === typeof e.alpha); + }(e)) + return xn(e); + if (function (e) { + return 'number' === typeof e.hue && 'number' === typeof e.saturation && 'number' === typeof e.lightness && 'number' === typeof e.alpha; + }(e)) + return wn(e); + if (function (e) { + return 'number' === typeof e.hue && 'number' === typeof e.saturation && 'number' === typeof e.lightness && ('number' !== typeof e.alpha || 'undefined' === typeof e.alpha); + }(e)) + return En(e); + throw new Zt(8); + } + function kn(e) { + return function e(t, n, r) { + return function () { + var o = r.concat(Array.prototype.slice.call(arguments)); + return o.length >= n ? t.apply(this, o) : e(t, n, o); + }; + }(e, e.length, []); + } + function Tn(e, t, n) { + return Math.max(e, Math.min(t, n)); + } + function _n(e, t) { + if ('transparent' === t) + return t; + var n = hn(t); + return Cn(ot({}, n, { lightness: Tn(0, 1, n.lightness - parseFloat(e)) })); + } + var Pn = kn(_n); + function On(e) { + return 'transparent' === e ? e : Cn(ot({}, hn(e), { saturation: 0 })); + } + function In() { + var e = gt([ + '\n @media (min-width: 768px) {\n min-width: 190px;\n min-height: 40px;\n font-size: ', + 'px;\n padding: ', + ';\n }\n ' + ]); + return In = function () { + return e; + }, e; + } + function Ln() { + var e = gt([ + '\n border: none;\n font-size: 14px;\n padding: 5px 0;\n width: auto;\n height: auto;\n font-weight: 500;\n letter-spacing: 0;\n background: none;\n color: ', + ';\n box-shadow: none;\n margin-top: 0;\n\n &.qc-cmp2-link-active {\n color: ', + ';\n cursor: default;\n }\n\n &:hover {\n background: none;\n }\n\n @media (min-width: 768px) {\n font-size: ', + 'px;\n }\n ' + ]); + return Ln = function () { + return e; + }, e; + } + function An() { + var e = gt([ + '\n background: ', + ';\n border: solid 1px ', + ';\n color: ', + ';\n\n @media (min-width: 768px) {\n &:hover {\n background: ', + '\n border-color: ', + '\n color: ', + ';\n }\n }\n ' + ]); + return An = function () { + return e; + }, e; + } + function Rn() { + var e = gt([ + '\n &&,\n && &:hover {\n background: ', + ';\n border: solid 1px ', + ';\n color: ', + ';\n }\n ' + ]); + return Rn = function () { + return e; + }, e; + } + function Nn() { + var e = gt([ + '\n&& {\n align-content: center;\n backface-visibility: hidden;\n border: none;\n background: ', + ';\n border-radius: 2px;\n color: ', + ';\n cursor: pointer;\n display: flex;\n align-items: center;\n font-size: 13px;\n line-height: 0;\n min-height: 34px;\n justify-content: center;\n letter-spacing: 2px;\n margin: 0.5em;\n padding: 12px;\n text-align: center;\n text-transform: uppercase;\n transition: all 0.35s ease;\n white-space: nowrap;\n width: 95%;\n box-shadow: 0 1px 1px 1px rgba(0,0,0,.1);\n\n @media(min-width: 768px) {\n &:hover {\n background: ', + ';\n }\n }\n\n ', + '\n\n ', + '\n\n ', + '\n\n ', + '\n\n @media(max-width: 360px) {\n /* support for iPhone 5/SE Galaxy S5 */\n margin: 0.3em;\n }\n}\n' + ]); + return Nn = function () { + return e; + }, e; + } + var jn = vt.c.button(Nn(), function (e) { + return e.uxPrimaryButtonColor; + }, function (e) { + return e.uxPrimaryButtonTextColor; + }, function (e) { + return e.primaryButtonHoverBackground; + }, function (e) { + var t = e.disabled, n = e.uxSecondaryButtonColor, r = e.uxSecondaryButtonTextColor; + return t && Object(vt.b)(Rn(), On(n), On(r), On(r)); + }, function (e) { + var t = e.uxSecondaryButtonColor, n = e.uxSecondaryButtonTextColor, r = e.mode, o = e.secondaryButtonHoverBackground, i = e.uxPrimaryButtonTextColor; + return 'secondary' === r && Object(vt.b)(An(), t, n, n, o, o, i); + }, function (e) { + var t = e.mode, n = e.uxPrimaryButtonColor, r = e.secondaryTextColor, o = e.isLong; + return 'link' === t && Object(vt.b)(Ln(), n, r, o ? 11 : 14); + }, function (e) { + return 'large' === e.size && Object(vt.b)(In(), e.isLong ? 11 : 14, e.isLong ? '0 15px !important' : 0); + }), qn = function (e) { + var t = e.children, n = zt(e, ['children']); + return Qe.a.createElement(jn, Object.assign({}, n, { + uxPrimaryButtonColor: _o.uxPrimaryButtonColor, + uxPrimaryButtonTextColor: _o.uxPrimaryButtonTextColor, + primaryButtonHoverBackground: _o.primaryButtonHoverBackground, + uxSecondaryButtonColor: _o.uxSecondaryButtonColor, + uxSecondaryButtonTextColor: _o.uxSecondaryButtonTextColor, + secondaryButtonHoverBackground: _o.secondaryButtonHoverBackground, + secondaryTextColor: _o.secondaryTextColor + }), t); + }; + qn.defaultProps = { + tabIndex: '0', + type: 'button', + mode: 'primary', + size: 'large', + className: '' + }; + var Fn = qn, Dn = function (e) { + var t = e.url, n = e.label, r = e.bolded; + return Qe.a.createElement('li', null, r ? Qe.a.createElement('strong', null, ''.concat(n, ': ')) : ''.concat(n, ': '), Qe.a.createElement('a', { + href: t, + target: '_blank', + rel: 'noopener noreferrer' + }, t)); + }; + Dn.defaultProps = { bolded: !1 }; + var Mn = Dn, Un = function () { + return window.navigator.userAgent.indexOf('Trident/') > -1; + }, Vn = function (e, t) { + if (Array.isArray(e) && e.length) { + var n = [], r = [], o = function (e) { + return e.sort(function (e, n) { + return t && isNaN(e[t]) ? -1 : e.name.toLowerCase().localeCompare(n.name.toLowerCase()); + }); + }; + return navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && t ? (e.forEach(function (e) { + isNaN(e[t]) ? n.push(e) : r.push(e); + }), [].concat(n, a(o(r)))) : o(e); + } + return e; + }, Bn = function (e) { + var t = e.seconds, n = e.label; + return Qe.a.createElement('li', null, ''.concat(n, ': ').concat(function (e) { + if (e < 0) + return '0 '.concat(Po.coreUiLabels.secondsLabel); + var t = e / 86400; + return t >= 1 ? ''.concat(Math.round(t), ' ').concat(Po.coreUiLabels.daysLabel) : ''.concat(e, ' ').concat(Po.coreUiLabels.secondsLabel); + }(t))); + }; + function zn() { + var e = gt(['\n &&& {\n ul.items {\n list-style: none;\n padding-left: 15px;\n\n li {\n padding-bottom: 15px;\n }\n }\n }\n']); + return zn = function () { + return e; + }, e; + } + function Gn() { + var e = gt(['\n &&& {\n display: flex;\n justify-content: space-between;\n padding: 5px 0;\n width: 50%;\n }\n']); + return Gn = function () { + return e; + }, e; + } + var Hn = vt.c.div(Gn()), Wn = vt.c.div(zn()), $n = n(53), Yn = n.n($n), Qn = function (e) { + var t = e.label, n = e.url, r = mt(Object(Ye.useState)(!1), 2), o = r[0], i = r[1], a = mt(Object(Ye.useState)([]), 2), s = a[0], c = a[1], u = mt(Object(Ye.useState)(!1), 2), l = u[0], f = u[1], p = mt(Object(Ye.useState)(''), 2), d = p[0], h = p[1]; + return Object(Ye.useEffect)(function () { + o && !l && Yn.a.get(n).then(function (e) { + return e.data; + }).then(function (e) { + e.disclosures && c(e.disclosures); + }).catch(function (e) { + c([]), h('Error: cannot load vendor file.'); + }).finally(function () { + return f(!0); + }); + }, [ + s.length, + o, + l, + n + ]), Qe.a.createElement('li', { + className: ''.concat(o ? 'expanded' : ''), + onClick: function () { + return i(!o); + } + }, Qe.a.createElement(Hn, null, t, ' ', Qe.a.createElement(Bt, { type: 'inner' })), o && Qe.a.createElement(Wn, null, s.length > 0 && Qe.a.createElement('ul', { className: 'items' }, s.map(function (e, t) { + return Qe.a.createElement('li', { key: t }, Object.keys(e).map(function (t, n) { + return Qe.a.createElement('p', { key: n }, t, ': ', e[t]); + })); + })), d && Qe.a.createElement('span', null, '\xA0\xA0', d))); + }, Kn = Ot.LEGITIMATE_VENDORS, Jn = Ot.LEGITIMATE_PURPOSES, Xn = Ot.PURPOSES, Zn = Ot.FEATURES, er = Ot.SPECIAL_PURPOSES, tr = Ot.SPECIAL_FEATURES, nr = function (e, t) { + return e ? t.legitimateScreenObject : t.legitimateScreenAccept; + }, rr = function (e) { + var t = e.cmpUI, n = e.element, r = e.coreUiLabels, o = e.togglesHidden, i = e.dataType, a = e.populateVendorInfo, s = e.setStatus, c = e.status; + return Qe.a.createElement('ul', { className: 'qc-cmp2-expandable-list' }, Qe.a.createElement('div', { className: 'qc-cmp2-expandable-info' }, n.policyUrl && Qe.a.createElement(Mn, { + url: n.policyUrl, + label: r.privacyPolicyLabel, + bolded: !0 + }), n.description && Qe.a.createElement('li', null, Qe.a.createElement('strong', null, r.descriptionLabel), Qe.a.createElement('p', null, n.description)), n.purposes && n.purposes.length > 0 && a(n.purposes, Xn, r), n.legIntPurposes && n.legIntPurposes.length > 0 && a(n.legIntPurposes, Jn, r)), !o && Qe.a.createElement('div', { className: 'qc-cmp2-toggle-switch' }, Qe.a.createElement($t, { + on: c, + className: 'qc-cmp2-toggle', + onClick: function (e) { + e && e.preventDefault(), s(!c), t.handleConsent(n.id, i); + } + }))); + }, or = function (e) { + var t = e.cmpUI, n = e.element, r = e.coreUiLabels, o = e.togglesHidden, i = e.dataType, a = e.populateVendorInfo, s = e.setStatus, c = e.status; + return Qe.a.createElement('ul', { className: 'qc-cmp2-expandable-list' }, Qe.a.createElement('div', { className: 'qc-cmp2-expandable-info' }, n.policyUrl && Qe.a.createElement(Mn, { + url: n.policyUrl, + label: r.privacyPolicyLabel + }), void 0 !== n.cookieMaxAgeSeconds && Qe.a.createElement(Bn, { + seconds: n.cookieMaxAgeSeconds, + label: r.cookieMaxAgeLabel + }), void 0 !== n.deviceStorageDisclosureUrl && Qe.a.createElement(Qn, { + url: n.deviceStorageDisclosureUrl, + label: r.storageDisclosureLabel + }), n.purposes && n.purposes.length > 0 && a(n.purposes, Xn, r), n.specialPurposes && n.specialPurposes.length > 0 && a(n.specialPurposes, er, r), n.features && n.features.length > 0 && a(n.features, Zn, r), n.specialFeatures && n.specialFeatures.length > 0 && a(n.specialFeatures, tr, r)), !o && Qe.a.createElement('div', { className: 'qc-cmp2-toggle-switch' }, Qe.a.createElement($t, { + on: c, + className: 'qc-cmp2-toggle', + onClick: function (e) { + e.preventDefault(), s(!c), t.handleConsent(n.id, i); + } + }))); + }, ir = function (e) { + var t = e.cmpUI, n = e.element, r = e.coreUiLabels, o = e.dataType, i = e.populateVendorInfo, a = e.setStatus, s = e.status; + return Qe.a.createElement('ul', { className: 'qc-cmp2-expandable-list qc-wrap' }, Qe.a.createElement('div', { className: 'qc-cmp2-expandable-info qc-w75' }, n.policyUrl && Qe.a.createElement(Mn, { + url: n.policyUrl, + label: r.privacyPolicyLabel + }), void 0 !== n.cookieMaxAgeSeconds && Qe.a.createElement(Bn, { + seconds: n.cookieMaxAgeSeconds, + label: r.cookieMaxAgeLabel + }), void 0 !== n.deviceStorageDisclosureUrl && Qe.a.createElement(Qn, { + url: n.deviceStorageDisclosureUrl, + label: r.storageDisclosureLabel + }), n.legIntPurposes && n.legIntPurposes.length > 0 && i(n.legIntPurposes, Kn, r), n.specialPurposes && n.specialPurposes.length > 0 && i(n.specialPurposes, er, r), n.features && n.features.length > 0 && i(n.features, Zn, r), n.specialFeatures && n.specialFeatures.length > 0 && i(n.specialFeatures, tr, r)), Qe.a.createElement('div', { className: 'qc-cmp2-toggle-switch qc-cmp2-no-margin' }, Qe.a.createElement(Fn, { + onClick: function (e) { + e.preventDefault(), a(!s), t.handleConsent(n.id, o); + }, + mode: 'link', + size: 'small', + isLong: r.legitimateScreenAccept.length > 19 + }, nr(s, r)))); + }, ar = function (e) { + var t = e.cmpUI, n = e.element, r = e.coreUiLabels, o = e.togglesHidden, i = e.dataType, a = e.setStatus, s = e.status; + return Qe.a.createElement('ul', { className: 'qc-cmp2-expandable-list' }, Qe.a.createElement('div', { className: 'qc-cmp2-expandable-info' }, n.policyUrl && Qe.a.createElement(Mn, { + url: n.policyUrl, + label: r.privacyPolicyLabel, + bolded: !0 + }), n.description && Qe.a.createElement('li', null, Qe.a.createElement('strong', null, r.descriptionLabel), Qe.a.createElement('p', null, n.description))), !o && Qe.a.createElement('div', { className: 'qc-cmp2-toggle-switch' }, Qe.a.createElement($t, { + on: s, + className: 'qc-cmp2-toggle', + onClick: function (e) { + e.preventDefault(), a(!s), t.handleConsent(n.id, i); + } + }))); + }, sr = function (e) { + var t = e.cmpUI, n = e.element, r = e.coreUiLabels, o = e.togglesHidden, i = e.dataType, a = e.legitimate, s = e.handleClick, c = e.toggleExpandedLegal, u = e.premiumUiLabels, l = e.setStatus, f = e.status; + return Qe.a.createElement('ul', { className: 'qc-cmp2-expandable-list '.concat(a ? 'qc-wrap' : '') }, Qe.a.createElement('li', { className: 'qc-cmp2-expandable-info '.concat(a ? 'qc-w75' : '') }, Qe.a.createElement('p', null, n.description), n.descriptionLegal && Qe.a.createElement('div', { className: 'qc-cmp2-expandable-legal' }, Qe.a.createElement(Fn, { + mode: 'link', + size: 'small', + className: 'qc-cmp2-toggle-legal-button', + onClick: function (e) { + e.preventDefault(), s(e, 'legalDescription-'.concat(i, '-').concat(n.id)), c(); + } + }, Qe.a.createElement(Bt, { type: 'fill' }), r.legalDescription), Qe.a.createElement('p', { className: 'qc-cmp2-legal-description' }, n.descriptionLegal)), n.vendors && Qe.a.createElement('div', { className: 'qc-cmp2-expandable-legal' }, Qe.a.createElement(Fn, { + mode: 'link', + size: 'small', + className: 'qc-cmp2-toggle-legal-button', + onClick: function (e) { + e.preventDefault(), s(e, 'vendors-'.concat(i, '-').concat(n.id)), c(); + } + }, Qe.a.createElement(Bt, { type: 'fill' }), r.showPartners), n.vendors.map(function (e) { + return Qe.a.createElement('p', { + key: e.id, + className: 'qc-cmp2-legal-description' + }, '- '.concat(e.name)); + }), !(!n.nonIabVendors || !n.nonIabVendors.length) && Qe.a.createElement(Qe.a.Fragment, null, n.nonIabVendors.map(function (e) { + return Qe.a.createElement('p', { + key: e.name, + className: 'qc-cmp2-legal-description' + }, '- '.concat(e.name), '*'); + }), Qe.a.createElement('p', { className: 'qc-cmp2-legal-description qc-cmp2-non-iab' }, '* ', u.nonIabVendorsLabel)))), a ? Qe.a.createElement('div', { className: 'qc-cmp2-toggle-switch' }, Qe.a.createElement(Fn, { + onClick: function (e) { + e.preventDefault(), l(!f), t.handleConsent(n.id, i); + }, + mode: 'link', + size: 'small', + isLong: r.legitimateScreenAccept.length > 19 + }, nr(f, r))) : !o && Qe.a.createElement('div', { className: 'qc-cmp2-toggle-switch' }, Qe.a.createElement($t, { + on: f, + className: 'qc-cmp2-toggle', + onClick: function (e) { + e.preventDefault(), l(!f), t.handleConsent(n.id, i); + } + }))); + }, cr = function (e) { + var t = e.coreUiLabels, n = e.premiumUiLabels, r = e.dataType, o = e.legitimate, i = e.togglesHidden, a = e.expandable, s = e.handleClick, c = e.cmpUI, u = e.item, l = e.populateVendorInfo, f = mt(Object(Ye.useState)(!1), 2), p = f[0], d = f[1], h = mt(Object(Ye.useState)(!1), 2), m = h[0], g = h[1], v = mt(Object(Ye.useState)(u.status), 2), y = v[0], b = v[1], E = function () { + g(!m); + }, w = ''.concat(r, '-id:').concat(u.id); + return Qe.a.useEffect(function () { + b(u.status); + }, [u.status]), Qe.a.createElement('li', { + id: w, + className: 'qc-cmp2-list-item '.concat(p ? 'qc-cmp2-expanded' : '', ' ').concat(o ? 'qc-cmp2-list-item-legitimate' : '') + }, Qe.a.createElement('button', { + className: 'qc-cmp2-list-item-header', + onClick: function (e) { + return function (e, t) { + d(!p), s(e, t); + }(e, w); + } + }, Qe.a.createElement('p', { className: 'qc-cmp2-list-item-title' }, u.name), o ? Qe.a.createElement('p', { className: 'qc-cmp2-list-item-status '.concat(t.legitimateScreenObjected.length > 12 ? 'qc-cmp-long-label' : '') }, y ? '' : t.legitimateScreenObjected) : !i && Qe.a.createElement('p', { className: 'qc-cmp2-list-item-status' }, y ? t.onLabel : t.offLabel), a && Qe.a.createElement(Bt, { type: 'expand' })), a && p && function (e) { + var a = { + cmpUI: c, + element: e, + coreUiLabels: t, + togglesHidden: i, + dataType: r, + populateVendorInfo: l, + setStatus: b, + status: y + }; + switch (r) { + case Ct.NON_IAB: + return Qe.a.createElement(rr, a); + case Ct.VENDORS: + return Qe.a.createElement(or, a); + case Ct.LEGITIMATE_VENDORS: + return Qe.a.createElement(ir, a); + case Ct.GOOGLE: + return Qe.a.createElement(ar, a); + default: + return Qe.a.createElement(sr, Object.assign({}, a, { + legitimate: o, + handleClick: s, + toggleExpandedLegal: E, + premiumUiLabels: n + })); + } + }(u)); + }, ur = Ot.LEGITIMATE_VENDORS, lr = Ot.LEGITIMATE_PURPOSES, fr = Ot.PURPOSES, pr = Ot.FEATURES, dr = Ot.SPECIAL_PURPOSES, hr = Ot.SPECIAL_FEATURES, mr = Ot.FLEXIBLE_PURPOSES, gr = Ot.UNFILTERED_FEATURES, vr = Ot.UNFILTERED_PURPOSES, yr = Ot.UNFILTERED_SPECIAL_FEATURES, br = Ot.UNFILTERED_SPECIAL_PURPOSES, Er = Qe.a.memo(function (e) { + var t, n = e.className, r = e.coreUiLabels, o = e.data, i = e.dataType, a = e.togglesHidden, s = e.expandable, c = e.legitimate, u = e.premiumUiLabels, l = e.nonIabData, f = e.handleClick, p = e.onFullyRendered, d = e.triggerReRender, h = e.setShowLoader, m = Object.keys(o).length, g = m ? function (e, t, n, r) { + var o = []; + switch (n) { + case t.NON_IAB: + if (r && r.vendors.length) + return r.vendors; + break; + case t.VENDORS: + return Vn(Object.values(e.vendors), 'id'); + case t.LEGITIMATE_VENDORS: + return Vn(Object.values(e.legitimateVendors), 'id'); + case t.GOOGLE: + return Vn(e, 'id'); + default: + Object.keys(e).length && function () { + var i = r && r.vendors, a = 'nonIabPurposeConsentIds'; + n === t.LEGITIMATE_VENDORS && (a = 'nonIabPurposeLegitimateInterestIds'); + var s = function (t) { + var n = e[t], r = (n.descriptionLegal || '').replace(/(:\s\*)|(:\*)/gi, ':').replace(/(\.\s\*)|(\.\*)|(\s\*)/gi, '.'), s = { + name: n.name, + status: n.status || !1, + id: n.id, + description: n.description, + descriptionLegal: r, + vendors: Vn(n.vendors, 'id'), + nonIabVendors: i && i.length && i.filter(function (e) { + return e[a] && e[a].includes(n.id); + }) + }; + o.push(s); + }; + for (var c in e) + s(c); + }(); + } + return o; + }(o, Ct, i, l) : [], v = mt(Qe.a.useState(!1), 2), y = v[0], b = v[1], E = mt(Qe.a.useState(g.slice(0, 100)), 2), w = E[0], x = E[1], S = function (e, t, n) { + return function (e, t, n, r) { + var o = '', i = ''; + switch (t) { + case fr: + o = n.purposesLabel, i = vr; + break; + case lr: + o = n.legitimateInterestPurposesLabel, i = vr; + break; + case dr: + o = n.specialPurposesLabel, i = br; + break; + case mr: + o = n.flexiblePurposesLabel, i = vr; + break; + case pr: + o = n.featuresLabel, i = gr; + break; + case hr: + o = n.specialFeaturesLabel, i = yr; + break; + case ur: + o = n.legitimateInterestPurposesLabel, i = vr; + } + var a = e.map(function (e) { + return Qe.a.createElement('p', { key: ''.concat(i).concat(e) }, '- ', r[i][e].name); + }); + return Qe.a.createElement('li', null, Qe.a.createElement('strong', null, o), a); + }(e, t, n, o); + }; + return Qe.a.useEffect(function () { + if (y) + return w.length < g.length && (t = setTimeout(function () { + x(g.slice(0, w.length + 100)); + }, 1000)), function () { + clearTimeout(t); + }; + }, [d]), Qe.a.useEffect(function () { + h && (h(!1), p && w.length === g.length && p(!0)); + }, [w]), Qe.a.useEffect(function () { + b(!0); + }, []), m ? Qe.a.createElement(Qe.a.Fragment, null, Qe.a.createElement(jt, { + className: ''.concat(n || '', ' qc-cmp2-consent-list'), + subHeaderColor: _o.subHeaderColor, + borderColor: _o.borderColor, + lightTextColor: _o.lightTextColor, + secondaryTextColor: _o.secondaryTextColor, + uxPrimaryButtonColor: _o.uxPrimaryButtonColor, + uxBackgroundColor: _o.uxBackgroundColor, + isIE: Un() + }, (i === Ct.NON_IAB || i === Ct.LEGITIMATE_PURPOSES || i === Ct.LEGITIMATE_VENDORS || i === Ct.GOOGLE) && Qe.a.createElement('p', { className: 'qc-cmp2-list-header' }, function () { + switch (i) { + case Ct.NON_IAB: + return u.nonIabVendorsLabel; + case Ct.LEGITIMATE_PURPOSES: + return r.legitimateInterestPurposesLabel; + case Ct.LEGITIMATE_VENDORS: + return r.legitimateInterestVendorLabel; + case Ct.GOOGLE: + return r.googlePartners; + } + return ''; + }()), w.map(function (e, t) { + return Qe.a.createElement(cr, { + key: t, + coreUiLabels: r, + premiumUiLabels: u, + dataType: i, + legitimate: c, + togglesHidden: a, + expandable: s, + handleClick: f, + cmpUI: ko, + item: e, + populateVendorInfo: S + }); + }))) : null; + }); + function wr() { + var e = gt([ + '\n && {\n text-align: center;\n margin: 10px auto !important;\n z-index: 100;\n background-color: ', + ';\n }\n\n .loader {\n display: inline-block;\n @keyframes line-scale {\n 0% {\n -webkit-transform: scaley(1);\n transform: scaley(1);\n }\n 50% {\n -webkit-transform: scaley(0.4);\n transform: scaley(0.4);\n }\n 100% {\n -webkit-transform: scaley(1);\n transform: scaley(1);\n }\n }\n .line-scale {\n & > div:nth-child(1) {\n -webkit-animation: line-scale 1s -0.4s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\n animation: line-scale 1s -0.4s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\n }\n & > div:nth-child(2) {\n -webkit-animation: line-scale 1s -0.3s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\n animation: line-scale 1s -0.3s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\n }\n & > div:nth-child(3) {\n -webkit-animation: line-scale 1s -0.2s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\n animation: line-scale 1s -0.2s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\n }\n & > div:nth-child(4) {\n -webkit-animation: line-scale 1s -0.1s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\n animation: line-scale 1s -0.1s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\n }\n & > div:nth-child(5) {\n -webkit-animation: line-scale 1s 0s infinite\n cubic-bezier(0.2, 0.68, 0.18, 1.08);\n animation: line-scale 1s 0s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08);\n }\n & > div {\n background: ', + ';\n width: 4px;\n height: 35px;\n border-radius: 2px;\n margin: 2px;\n -webkit-animation-fill-mode: both;\n animation-fill-mode: both;\n display: inline-block;\n }\n }\n' + ]); + return wr = function () { + return e; + }, e; + } + var xr = vt.c.div(wr(), function (e) { + return e.uxBackgroundColor; + }, function (e) { + return e.uxPrimaryButtonColor; + }), Sr = function () { + return Qe.a.createElement(xr, { + uxPrimaryButtonColor: _o.uxPrimaryButtonColor, + uxBackgroundColor: _o.uxBackgroundColor + }, Qe.a.createElement('div', { className: 'loader' }, Qe.a.createElement('div', { className: 'line-scale' }, Qe.a.createElement('div', null), Qe.a.createElement('div', null), Qe.a.createElement('div', null), Qe.a.createElement('div', null), Qe.a.createElement('div', null)))); + }, Cr = function (e, t, n) { + e.map(function (e) { + var r = t.filter(function (t) { + return (t[n] || []).includes(e.id); + }); + return e.vendors = r, e; + }); + }, kr = function (e) { + var t, n = e.coreUiLabels, r = e.premiumUiLabels, o = e.vendorsData, i = e.handleClick, a = e.nonIabData, s = e.children, c = Qe.a.useRef(null), u = !Object.values(o.legitimatePurposes).every(function (e) { + return e.status; + }) && !Object.values(o.legitimateVendors).every(function (e) { + return e.status; + }), l = m({}, o.legitimatePurposes), f = { + isEnabled: a.isEnabled, + vendors: a.vendors.filter(function (e) { + return e.legIntPurposes.length > 0; + }) + }, p = a.isEnabled && a.vendors.length && f.vendors.length > 0, d = mt(Qe.a.useState(!1), 2), h = d[0], g = d[1], v = mt(Qe.a.useState(0), 2), y = v[0], b = v[1], E = mt(Qe.a.useState(!1), 2), w = E[0], x = E[1]; + if (Object.keys(l).length) { + var S = Object.values(m({}, o.vendors)), C = Object.values(l); + Cr(C, S, 'legIntPurposes'); + } + return Qe.a.useEffect(function () { + var e = c.current; + y && e && x(!0); + }, [y]), Qe.a.useEffect(function () { + var e = c.current; + w && e && (e.scrollTop = e.scrollHeight); + }, [w]), Qe.a.useEffect(function () { + return function () { + clearTimeout(t); + }; + }, [t]), Qe.a.createElement(Qe.a.Fragment, null, s[0], Qe.a.createElement('div', { + className: 'qc-cmp2-scrollable-section '.concat(w ? 'loading' : ''), + ref: c, + onScroll: function () { + var e = c.current; + clearTimeout(t), e && !h && e.scrollTop + e.offsetHeight > e.scrollHeight - 50 && (t = setTimeout(function () { + b(new Date().getTime()); + }, 300)); + } + }, Qe.a.createElement(Er, { + coreUiLabels: n, + premiumUiLabels: r, + data: o.legitimatePurposes, + dataType: Ct.LEGITIMATE_PURPOSES, + nonIabData: a, + handleClick: i, + key: u ? 1 : 0, + expandable: !0, + legitimate: !0 + }), Qe.a.createElement(Er, { + coreUiLabels: n, + premiumUiLabels: r, + data: o, + dataType: Ct.LEGITIMATE_VENDORS, + handleClick: i, + onFullyRendered: g, + triggerReRender: y, + setShowLoader: x, + expandable: !0, + legitimate: !0 + }), !!p && Qe.a.createElement(Er, { + coreUiLabels: n, + data: o, + nonIabData: f, + dataType: Ct.NON_IAB, + handleClick: i, + premiumUiLabels: r, + expandable: !0 + }), w && Qe.a.createElement(Sr, null)), Qe.a.cloneElement(s[1], { isObjecting: u })); + }, Tr = function (e) { + var t = e.item, n = e.id, r = e.sectionName, o = e.coreUiLabels, i = e.premiumUiLabels, a = e.handleClick, s = e.handleConsent, c = e.DATA_TYPE; + return Qe.a.createElement(Qe.a.Fragment, { key: ''.concat(t.name).concat(n) }, Qe.a.createElement('li', { className: 'qc-cmp2-expandable-info' }, Qe.a.createElement('strong', null, t.name), Qe.a.createElement('p', null, t.description), t.descriptionLegal && Qe.a.createElement('div', { className: 'qc-cmp2-expandable-legal' }, Qe.a.createElement(Fn, { + mode: 'link', + size: 'small', + className: 'qc-cmp2-toggle-legal-button', + onClick: function (e) { + return a(e, 'legalDescription-stacks-'.concat(r, '-').concat(n)); + } + }, Qe.a.createElement(Bt, { type: 'fill' }), o.legalDescription), Qe.a.createElement('p', { className: 'qc-cmp2-legal-description' }, t.descriptionLegal.replace(/(:\s\*)|(:\*)/gi, ':').replace(/(\.\s\*)|(\.\*)|(\s\*)/gi, '.'))), t.vendors && Qe.a.createElement('div', { className: 'qc-cmp2-expandable-legal' }, Qe.a.createElement(Fn, { + mode: 'link', + size: 'small', + className: 'qc-cmp2-toggle-legal-button', + onClick: function (e) { + return a(e, 'vendors-stacks-'.concat(t.id)); + } + }, Qe.a.createElement(Bt, { type: 'fill' }), o.showPartners), Vn(t.vendors, 'id').map(function (e) { + return Qe.a.createElement('p', { + key: e.id, + className: 'qc-cmp2-legal-description' + }, '- '.concat(e.name)); + }), !(!t.nonIabVendors || !t.nonIabVendors.length) && Qe.a.createElement(Qe.a.Fragment, null, t.nonIabVendors.map(function (e) { + return Qe.a.createElement('p', { + key: e.name, + className: 'qc-cmp2-legal-description' + }, '- '.concat(e.name), '*'); + }), Qe.a.createElement('p', { className: 'qc-cmp2-legal-description qc-cmp2-non-iab' }, '* ', i.nonIabVendorsLabel)))), Qe.a.createElement('div', { className: 'qc-cmp2-toggle-switch' }, Qe.a.createElement($t, { + showLabel: !0, + on: t.status, + onClick: function () { + s(n, 'purposes' === r ? c.PURPOSES : c.SPECIAL_FEATURES, !t.status); + }, + className: 'qc-cmp2-toggle' + }))); + }, _r = xt.EXPAND_ELEMENT, Pr = xt.COLLAPSE_ELEMENT, Or = function (e, t, n, r) { + return e[t].length ? e[t].map(function (e) { + var o = n.find(function (t) { + return t.id === e; + }); + if (o) { + var i = 'purposes' === t && r && r.vendors; + o.nonIabVendors = i && i.length && i.filter(function (e) { + return e.nonIabPurposeConsentIds && e.nonIabPurposeConsentIds.includes(o.id); + }); + } + return o; + }).filter(function (e) { + return void 0 !== e; + }) : []; + }, Ir = function (e) { + var t = e.id, n = e.stack, r = e.onToggle, o = e.purposes, i = e.specialFeatures, a = e.nonIabData, s = e.coreUiLabels, c = e.premiumUiLabels, u = e.handleClick, l = e.handleConsent, f = e.className, p = e.DATA_TYPE, d = ''.concat(t, '-expandable'), h = mt(Qe.a.useState(Or(n, 'purposes', o, a)), 2), g = h[0], v = h[1], y = mt(Qe.a.useState(Or(n, 'specialFeatures', i, a)), 2), b = y[0], E = y[1], w = mt(Qe.a.useState(g.filter(function (e) { + return !0 === e.status; + }).length + b.filter(function (e) { + return !0 === e.status; + }).length), 2), x = w[0], S = w[1], C = mt(Qe.a.useState(!1), 2), k = C[0], T = C[1], _ = mt(Qe.a.useState(n.status), 2), P = _[0], O = _[1], I = mt(Qe.a.useState(n.stateLabel), 2), L = I[0], A = I[1], R = function (e, t, n) { + l(e, t), t === p.PURPOSES ? v(g.map(function (t) { + return t.id === e && (t.status = n), t; + })) : E(b.map(function (t) { + return t.id === e && (t.status = n), t; + })), S(x + (n ? 1 : -1)); + }; + return Qe.a.useEffect(function () { + var e = s.onLabel, t = s.offLabel, n = s.multiLabel; + 0 === x ? (A(t), O(!1)) : x === g.length + b.length ? (A(e), O(!0)) : (A(n), O(!1)); + }, [x]), Qe.a.createElement('li', { + 'data-testid': 'stack-item', + className: ''.concat(f, ' ').concat(k ? 'qc-cmp2-expanded' : '') + }, Qe.a.createElement('button', { + className: 'qc-cmp2-list-item-header', + 'aria-expanded': k, + 'aria-controls': d, + 'data-testid': 'stack-item-header', + onClick: function () { + k ? ko.eventTracker(Pr, t) : ko.eventTracker(_r, t), T(!k); + } + }, Qe.a.createElement('p', { className: 'qc-cmp2-list-item-title' }, n.name), Qe.a.createElement('p', { className: 'qc-cmp2-list-item-status' }, L), Qe.a.createElement(Bt, { type: 'expand' })), Qe.a.createElement('ul', { + id: d, + className: 'qc-cmp2-expandable-list' + }, Qe.a.createElement('li', { className: 'qc-cmp2-expandable-info' }, n.description), Qe.a.createElement('div', { className: 'qc-cmp2-toggle-switch' }, Qe.a.createElement($t, { + showLabel: !0, + className: 'qc-cmp2-toggle', + on: P, + onClick: function () { + r(), function (e) { + v(g.map(function (t) { + return m(m({}, t), {}, { status: e }); + })), E(b.map(function (t) { + return m(m({}, t), {}, { status: e }); + })), S(e ? g.length + b.length : 0); + }(!P); + }, + disabled: !k + })), g.map(function (e, t) { + return Qe.a.createElement(Tr, { + id: e.id, + key: t, + item: e, + sectionName: 'purposes', + coreUiLabels: s, + premiumUiLabels: c, + handleClick: u, + handleConsent: R, + DATA_TYPE: p + }); + }), b.map(function (e, t) { + return Qe.a.createElement(Tr, { + id: e.id, + key: t, + item: e, + sectionName: 'specialFeatures', + coreUiLabels: s, + premiumUiLabels: c, + handleClick: u, + handleConsent: R, + DATA_TYPE: p + }); + }))); + }; + function Lr() { + var e = gt(['\n .qc-cmp2-toggle-legal-button {\n height: 34px;\n }\n\n .qc-cmp2-toggle-legal-button svg {\n height: 22px;\n width: 14px;\n }\n ']); + return Lr = function () { + return e; + }, e; + } + function Ar() { + var e = gt([ + '\n && {\n ', + '\n\n .qc-cmp2-list-item {\n &:only-child {\n border-bottom: solid 1px ', + ';\n }\n\n .qc-cmp2-expandable-list {\n flex-wrap: wrap;\n justify-content: space-between;\n\n .qc-cmp2-expandable-info {\n margin-bottom: 20px;\n width: 85%;\n &:first-of-type {\n margin: 20px 0px;\n }\n li {\n margin: 0;\n padding: 0;\n\n p {\n margin: 0;\n padding: 0;\n }\n }\n\n strong {\n margin-top: 0;\n margin-bottom: 5px;\n }\n\n &:last-of-type {\n margin-bottom: 0%;\n }\n }\n\n .qc-cmp2-toggle-switch {\n margin-bottom: 10px;\n &:first-of-type {\n margin-top: 20px;\n margin-bottom: 30px;\n }\n }\n }\n }\n }\n' + ]); + return Ar = function () { + return e; + }, e; + } + var Rr = Object(vt.c)(jt)(Ar(), function (e) { + return e.isIE && Object(vt.b)(Lr()); + }, function (e) { + return e.borderColor; + }), Nr = function (e) { + var t = e.vendorsData, n = e.handleClick, r = e.coreUiLabels, o = e.purposes, i = e.specialFeatures, a = e.premiumUiLabels, s = e.nonIabData, c = function (e, t) { + ko.handleConsent(e, t); + }; + return Qe.a.createElement(Rr, { + borderColor: _o.borderColor, + lightTextColor: _o.lightTextColor, + secondaryTextColor: _o.secondaryTextColor, + uxPrimaryButtonColor: _o.uxPrimaryButtonColor, + isIE: Un() + }, Object.entries(t.stacks).map(function (e) { + var t = mt(e, 2), u = t[0], l = t[1]; + return Qe.a.createElement(Ir, { + id: 'stack-item-id:'.concat(u), + stack: l, + onToggle: function () { + return function (e) { + ko.handleConsent(e, Ct.STACKS); + }(u); + }, + purposes: o, + specialFeatures: i, + nonIabData: s, + coreUiLabels: r, + premiumUiLabels: a, + handleClick: n, + handleConsent: c, + key: 'stack-item-'.concat(u), + 'data-testid': 'stack-item', + className: 'qc-cmp2-list-item', + DATA_TYPE: Ct + }); + })); + }; + function jr() { + var e = gt(['\n &&&& {\n .qc-cmp2-toggle-legal-button {\n height: 34px;\n }\n\n .qc-cmp2-toggle-legal-button svg {\n height: 22px;\n width: 14px;\n }\n }\n ']); + return jr = function () { + return e; + }, e; + } + function qr() { + var e = gt([ + '\n ', + '\n' + ]); + return qr = function () { + return e; + }, e; + } + function Fr() { + var e = gt(['\n &&&& {\n list-style: none;\n\n li {\n margin-bottom: 10px;\n\n &:last-of-type {\n margin-bottom: 0;\n }\n\n strong {\n display: block;\n }\n }\n }\n']); + return Fr = function () { + return e; + }, e; + } + var Dr = vt.c.ul(Fr()), Mr = vt.c.div(qr(), function (e) { + return e.isIE && Object(vt.b)(jr()); + }), Ur = function (e) { + var t, n = e.handleClick, r = e.coreUiLabels, o = e.premiumUiLabels, i = e.data, a = e.id, s = e.title; + if (s === o.linksTitle) + t = i.map(function (e, t) { + return Qe.a.createElement('li', { key: e.label + t }, Qe.a.createElement('a', { + href: e.link, + target: '_blank', + rel: 'noopener noreferrer' + }, e.label)); + }); + else { + var c = []; + for (var u in i) { + var l = i[u]; + for (var f in l) { + var p = l[f], d = (p.descriptionLegal || '').replace(/(:\s\*)|(:\*)/gi, ':').replace(/(\.\s\*)|(\.\*)|(\s\*)/gi, '.'), h = { + id: ''.concat(u, ' ').concat(p.id), + title: p.name, + description: p.description, + descriptionLegal: d + }; + c.push(h); + } + } + t = c.map(function (e, t) { + return Qe.a.createElement('li', { key: t }, Qe.a.createElement('strong', null, e.title), e.description, e.descriptionLegal && Qe.a.createElement('div', { className: 'qc-cmp2-expandable-legal' }, Qe.a.createElement(Fn, { + mode: 'link', + size: 'small', + className: 'qc-cmp2-toggle-legal-button', + onClick: function (t) { + return n(t, 'legalDescription-'.concat(e.id)); + } + }, Qe.a.createElement(Bt, { type: 'fill' }), r.legalDescription), Qe.a.createElement('p', { className: 'qc-cmp2-legal-description' }, e.descriptionLegal))); + }); + } + return Qe.a.createElement(jt, { + className: 'qc-cmp2-consent-list', + subHeaderColor: _o.subHeaderColor, + borderColor: _o.borderColor, + lightTextColor: _o.lightTextColor, + secondaryTextColor: _o.secondaryTextColor, + uxPrimaryButtonColor: _o.uxPrimaryButtonColor + }, Qe.a.createElement('li', { + id: a, + className: 'qc-cmp2-list-item' + }, Qe.a.createElement('button', { + className: 'qc-cmp2-list-item-header', + onClick: function (e) { + return n(e, a); + } + }, Qe.a.createElement('p', { className: 'qc-cmp2-list-item-title' }, s === o.linksTitle ? Qe.a.createElement('strong', null, s) : s), Qe.a.createElement(Bt, { type: 'expand' })), Qe.a.createElement('ul', { className: 'qc-cmp2-expandable-list' }, Qe.a.createElement(Mr, { + isIE: Un(), + className: 'qc-cmp2-expandable-info' + }, Qe.a.createElement(Dr, null, t))))); + }, Vr = function (e) { + var t = e.coreUiLabels, n = e.premiumUiLabels, r = e.vendorsData, o = e.handleClick, i = e.nonIabData, a = e.children, s = ht(function (e) { + return e.app; + }).disableAcceptButton, c = mt(Object(Ye.useState)(s), 2), u = c[0], l = c[1], f = r.stacks, p = m({}, r.specialFeatures), d = m({}, r.purposes), h = JSON.parse(JSON.stringify(d)), g = JSON.parse(JSON.stringify(p)), v = Object.values(h), y = Object.values(g), b = Object(Ye.useRef)(null), E = Object(Ye.useCallback)(function () { + var e = b.current, t = document.getElementById('Special Purposes and Features Group'), n = null === e || void 0 === e ? void 0 : e.getBoundingClientRect(), r = null === t || void 0 === t ? void 0 : t.getBoundingClientRect(); + e && u && r && n && (n.bottom - r.top >= 0 && (l(!1), e.removeEventListener('scroll', E))); + }, [u]); + if (Object(Ye.useEffect)(function () { + var e = b.current; + u && e && (E(), e.addEventListener('scroll', E)); + }, [ + E, + u, + b + ]), Object.keys(f).length) + for (var w in f) { + var x = f[w]; + if (x.specialFeatures.length) + for (var S in p) + x.specialFeatures.includes(parseInt(S, 10)) && delete p[S]; + if (x.purposes.length) + for (var C in d) + x.purposes.includes(parseInt(C, 10)) && delete d[C]; + } + if (Object.keys(d).length) { + var k = Object.values(m({}, r.vendors)), T = Object.values(d), _ = Object.values(p); + Cr(T, k, 'purposes'), Cr(_, k, 'specialFeatures'), Cr(v, k, 'purposes'), Cr(y, k, 'specialFeatures'); + } + return Qe.a.createElement(Qe.a.Fragment, null, a && a[0], Qe.a.createElement('div', { + ref: b, + className: 'qc-cmp2-scrollable-section' + }, !!Object.keys(f).length && Qe.a.createElement(Nr, { + vendorsData: r, + coreUiLabels: t, + handleClick: o, + purposes: v, + specialFeatures: y, + nonIabData: i, + premiumUiLabels: n + }), !!Object.keys(d).length && Qe.a.createElement(Er, { + coreUiLabels: t, + data: d, + dataType: Ct.PURPOSES, + nonIabData: i, + handleClick: o, + premiumUiLabels: n, + expandable: !0 + }), !!Object.keys(p).length && Qe.a.createElement(Er, { + coreUiLabels: t, + data: p, + dataType: Ct.SPECIAL_FEATURES, + handleClick: o, + premiumUiLabels: n, + expandable: !0 + }), (!!Object.keys(r.specialPurposes).length || !!Object.keys(r.features)) && Qe.a.createElement(Ur, { + id: 'Special Purposes and Features Group', + title: t.specialPurposesAndFeatures, + coreUiLabels: t, + handleClick: o, + data: { + 'Special Features': r.specialPurposes, + Features: r.features + }, + premiumUiLabels: n + }), !!(n && n.initScreenCustomLinks && n.initScreenCustomLinks.length) && Qe.a.createElement(Ur, { + id: n.linksTitle, + title: n.linksTitle, + coreUiLabels: t, + handleClick: o, + data: n.initScreenCustomLinks, + premiumUiLabels: n + })), a && Qe.a.cloneElement(a[1], { disabledAcceptAllButton: u })); + }, Br = function (e) { + var t, n = e.coreUiLabels, r = e.nonIabData, o = e.vendorsData, i = e.handleClick, a = e.premiumUiLabels, s = e.googleVendors, c = e.children, u = { + isEnabled: r.isEnabled, + vendors: r.vendors.filter(function (e) { + return !e.legIntPurposes || 0 === e.legIntPurposes.length; + }) + }, l = r.isEnabled && r.vendors.length > 0 && u.vendors.length > 0, f = Qe.a.useRef(null), p = mt(Qe.a.useState(!1), 2), d = p[0], h = p[1], m = mt(Qe.a.useState(!1), 2), g = m[0], v = m[1], y = mt(Qe.a.useState(!1), 2), b = y[0], E = y[1], w = mt(Qe.a.useState(0), 2), x = w[0], S = w[1], C = mt(Qe.a.useState(!1), 2), k = C[0], T = C[1], _ = mt(Qe.a.useState(!1), 2), P = _[0], O = _[1], I = mt(Qe.a.useState(!1), 2), L = I[0], A = I[1]; + return Qe.a.useEffect(function () { + var e = f.current; + x && e && A(!0); + }, [x]), Qe.a.useEffect(function () { + var e = f.current; + L && e && (e.scrollTop = e.scrollHeight); + }, [L]), Qe.a.useEffect(function () { + T(!!l && d), O(l && g || !l && d); + }, [ + d, + g + ]), Qe.a.useEffect(function () { + return function () { + clearTimeout(t); + }; + }, []), Qe.a.createElement(Qe.a.Fragment, null, c[0], Qe.a.createElement('div', { + className: 'qc-cmp2-scrollable-section '.concat(L ? 'loading' : ''), + ref: f, + onScroll: function () { + var e = f.current; + clearTimeout(t), e && (!d || l && !g || s.isEnabled && !b) && e.scrollTop + e.offsetHeight > e.scrollHeight - 50 && (t = setTimeout(function () { + S(new Date().getTime()); + }, 300)); + } + }, Qe.a.createElement(Er, { + coreUiLabels: n, + data: o, + dataType: Ct.VENDORS, + handleClick: i, + premiumUiLabels: a, + onFullyRendered: h, + triggerReRender: x, + setShowLoader: A, + expandable: !0 + }), l && k && Qe.a.createElement(Er, { + coreUiLabels: n, + data: o, + nonIabData: u, + dataType: Ct.NON_IAB, + handleClick: i, + premiumUiLabels: a, + onFullyRendered: v, + triggerReRender: x, + setShowLoader: A, + expandable: !0 + }), s.isEnabled && P && !(Po.coreConfig.consentScope || '').includes('global') && Qe.a.createElement(Er, { + coreUiLabels: n, + data: Ao, + dataType: Ct.GOOGLE, + handleClick: i, + premiumUiLabels: a, + onFullyRendered: E, + triggerReRender: x, + setShowLoader: A, + expandable: !0 + }), L && Qe.a.createElement(Sr, null)), c[1]); + }; + function zr() { + var e = gt(['\n width: 130px;\n\n img {\n max-width: 100%;\n height: auto;\n }\n\n @media (min-width: 768px) {\n width: 170px;\n }\n ']); + return zr = function () { + return e; + }, e; + } + function Gr() { + var e = gt(['\n height: 45px;\n text-align: center;\n\n img {\n max-height: 100%;\n }\n\n @media (min-width: 768px) {\n height: 60px;\n text-align: center;\n max-width: 770px;\n }\n ']); + return Gr = function () { + return e; + }, e; + } + function Hr() { + var e = gt([ + '\n && {\n ', + '\n }\n' + ]); + return Hr = function () { + return e; + }, e; + } + var Wr, $r = vt.c.div(Hr(), function (e) { + return e.isSquare ? Object(vt.b)(Gr()) : Object(vt.b)(zr()); + }), Yr = function (e) { + var t = e.logoUrl, n = mt(Object(Ye.useState)(!1), 2), r = n[0], o = n[1]; + return Qe.a.createElement($r, { + isSquare: r, + className: 'logo-container' + }, Qe.a.createElement('img', { + alt: 'Publisher Logo', + src: t, + onLoad: function (e) { + var t = e.target; + t.offsetHeight >= t.offsetWidth && o(!0); + } + })); + }, Qr = function (e) { + var t = e.coreUiLabels, n = e.page, r = e.handleScroll, o = e.bodyContent, i = e.isAmp, a = e.isDesktop, s = Po.coreConfig.publisherLogo, c = o.bodyText, u = o.isCustomized, l = function (e) { + return 0 === n ? Qe.a.createElement('div', { + className: 'qc-cmp2-summary-info '.concat(s ? 'qc-cmp2-logo-displayed' : ''), + onScroll: function () { + return r && r(); + } + }, e.children) : Qe.a.createElement('div', null, e.children); + }, f = function () { + return u ? Qe.a.createElement('div', null, c) : Array.isArray(c) ? Qe.a.createElement(Qe.a.Fragment, null, c.map(function (e, t) { + return Qe.a.createElement('p', { key: t }, e); + })) : Qe.a.createElement('p', null, c); + }; + return Qe.a.createElement('div', { className: 'qc-cmp2-consent-info' }, Qe.a.createElement('div', { className: 'qc-cmp2-publisher-logo-container' }, n > 1 && Qe.a.createElement('button', { + className: 'qc-cmp2-home-button', + onClick: function () { + window.__tcfapiui('goToPage', n - 1); + } + }, Qe.a.createElement(Bt, { type: 'back' }), ' ', (!i || a) && t.back), Qe.a.createElement('figure', null, s && Qe.a.createElement(Yr, { logoUrl: s }), Qe.a.createElement('h2', null, t.initScreenTitle)), Qe.a.createElement(l, null, Qe.a.createElement(f, null)))); + }, Kr = function (e) { + var t, n, r = e.coreUiLabels, o = e.acceptAllFunction, i = e.rejectAllFunction, a = e.acceptSelected, s = e.page, c = e.setAllLegitimatesTo, u = e.isObjecting, l = e.disabledAcceptAllButton, f = e.showRejectButton, p = e.showOverlay, d = e.isScrolled, h = e.isAmp, m = Po.coreConfig, g = m.lang_, v = m.consentIdentityEnabled, y = function () { + c && c(u); + }; + t = u ? r && r.legitimateScreenAccept : r && r.objectAllButton; + var b = r ? r.saveAndExitButton.length > 18 || r.agreeButton.length > 18 || t.length > 18 || r.initScreenSettingsButton.length > 18 || r.initScreenRejectButton.length > 18 : null, E = r ? 'en' !== g && r.legitimateInterestLink.length > 18 || r.purposeScreenVendorLink.length > 18 : null; + return n = 0 === s ? Qe.a.createElement('div', { className: 'qc-cmp2-summary-buttons' }, f && Qe.a.createElement(Fn, { + isLong: b, + onClick: i, + mode: 'secondary' + }, r.initScreenRejectButton), Qe.a.createElement(Fn, { + isLong: b, + onClick: function () { + window.__tcfapiui('goToPage', 1), h && window.parent.postMessage({ + type: It.CONSENT_UI, + action: Lt.ENTER_FULLSCREEN + }, '*'); + }, + mode: 'secondary' + }, r.initScreenSettingsButton), Qe.a.createElement(Fn, { + isLong: b, + onClick: o + }, r.agreeButton)) : Qe.a.createElement(Qe.a.Fragment, null, Qe.a.createElement(Fn, { + isLong: b, + disabled: l, + onClick: 3 === s ? a : o, + className: 'qc-cmp2-hide-desktop' + }, 3 === s ? r.saveAndExitButton : r.agreeAllButton), Qe.a.createElement(Fn, { + isLong: b, + onClick: 3 === s ? y : a, + mode: 'secondary', + className: 'qc-cmp2-hide-desktop' + }, 3 === s ? t : r.agreeToSelectedButton), Qe.a.createElement('div', { className: 'qc-cmp2-footer-links' }, Qe.a.createElement(Fn, { + isLong: E, + onClick: function () { + window.__tcfapiui('goToPage', 2); + }, + mode: 'link', + size: 'small', + className: 2 === s ? 'qc-cmp2-link-active' : '' + }, r.purposeScreenVendorLink), Qe.a.createElement(Fn, { + isLong: E, + onClick: function () { + window.__tcfapiui('goToPage', 3); + }, + mode: 'link', + size: 'small', + className: 3 === s ? 'qc-cmp2-link-active' : '' + }, r.legitimateInterestLink)), Qe.a.createElement('div', { className: 'qc-cmp2-buttons-desktop' }, Qe.a.createElement(Fn, { + isLong: b, + onClick: 3 === s ? y : a, + mode: 'secondary' + }, 3 === s ? t : r.agreeToSelectedButton), Qe.a.createElement(Fn, { + isLong: b, + disabled: l, + onClick: 3 === s ? a : o + }, 3 === s ? r.saveAndExitButton : r.agreeAllButton))), Qe.a.createElement('div', { className: 'qc-cmp2-footer '.concat(p ? 'qc-cmp2-footer-overlay' : '', ' ').concat(d ? 'qc-cmp2-footer-scrolled' : '') }, v && Qe.a.createElement('div', { className: 'qc-cmp2-footer-permisio' }, Qe.a.createElement('div', { className: 'qc-cmp2-info-icon' }), Qe.a.createElement('p', { className: 'qc-cmp2-footer-permisio-warning' }, 'To record your choice, please note that you will be temporarily redirected to', ' ', Qe.a.createElement('a', { + href: 'https://permisio.com/', + className: 'qc-cmp2-footer-permisio-link', + rel: 'noopener noreferrer', + target: '_blank' + }, 'permisio.com'))), n); + }; + function Jr() { + var e = gt(['\n && {\n display: inline-flex;\n min-width: 0;\n min-height: 0;\n text-transform: none;\n }\n']); + return Jr = function () { + return e; + }, e; + } + !function (e) { + e.GLOBAL = 'global', e.SERVICE = 'service', e.GLOBAL_GROUP = 'global group', e.SERVICE_GROUP = 'service group'; + }(Wr || (Wr = {})); + var Xr = Object(vt.c)(Fn)(Jr()), Zr = function (e, t, n) { + return t ? Qe.a.createElement(Qe.a.Fragment, null, e.split(t).reduce(function (e, r, o) { + return o ? e.concat(Qe.a.createElement('a', { + href: n.consentScopeGroupURL, + target: '_blank', + rel: 'noopener noreferrer', + key: t + r + }, t), r) : [r]; + }, [])) : e; + }, eo = function (e, t) { + var n = function () { + Po.coreConfig.isAMP && window.parent.postMessage({ + type: It.CONSENT_UI, + action: Lt.ENTER_FULLSCREEN + }, '*'), window.__tcfapiui('goToPage', 2); + }; + return t ? Qe.a.createElement(Qe.a.Fragment, null, e.split(t).reduce(function (e, r, o) { + return o ? e.concat(Qe.a.createElement(Xr, { + onClick: n, + mode: 'link', + key: t + r + }, t), r) : [r]; + }, [])) : e; + }, to = function (e, t) { + return Qe.a.createElement('div', null, e.split('[[/]]').reduce(function (e, n, r) { + return e.concat(no(n, t, r)); + }, [])); + }, no = function (e, t, n) { + if (!e.length) + return e; + var r = new RegExp(/\[\[(.*?)\]\]/), o = new RegExp(/((.*?)([=@])?\|(.*?))|((.*?)\*)|(\/)/); + return Qe.a.createElement('p', { key: 'p-' + n }, e.split(r).reduce(function (e, n, r) { + if (!r && !n.match(o)) + return [n]; + var i = n.split('|'), a = i[0], s = a.slice(-1), c = a.slice(0, a.length - 1), u = i[1], l = n; + if ('*' === s) + l = Qe.a.createElement('strong', { key: r }, c); + else if ('=' === s) + if (u.match(new RegExp(/{(.*?)}/))) { + var f = u.slice(1, u.length - 1); + f && t[f] && (l = Qe.a.createElement('a', { + href: t[f], + key: r + }, c)); + } else + l = Qe.a.createElement('a', { + href: u, + key: r + }, c); + else + '@' === s && (l = Qe.a.createElement('a', { + onClick: function () { + return window.__tcfapiui('goToPage', Number(u)); + }, + href: '#', + key: r + }, c)); + return e.concat(l); + }, [])); + }, ro = function (e, t, n) { + if (e.includes('[break]')) { + var r = e.split('[break]'), o = []; + return r.length > 1 && r[1].split('
').forEach(function (e, t) { + o.push(Qe.a.createElement('p', { + key: t, + dangerouslySetInnerHTML: { __html: e } + })); + }), [Qe.a.createElement('p', { key: -1 }, eo(r[0], t))].concat(o); + } + return [Qe.a.createElement('div', { key: -1 }, to(e, n))]; + }, oo = function (e) { + Object({ + NODE_ENV: 'production', + PUBLIC_URL: '', + REACT_APP_LOG_API: 'https://audit-tcfv2.quantcast.mgr.consensu.org', + REACT_APP_GEOIP_API_URL: 'https://apis.quantcast.mgr.consensu.org/geoip', + REACT_APP_CMP_COOKIE_API: 'https://apis.quantcast.mgr.consensu.org/CookieAccessV2', + REACT_APP_GOOGLE_ATP_URL: 'https://quantcast.mgr.consensu.org/tcfv2/google-atp-list.json', + REACT_APP_CONSENTED_IDENTITY_WEBSITE_API: 'https://app.permisio.com/api', + REACT_APP_VERSION: '23', + REACT_APP_CMPUI_SRC: 'https://quantcast.mgr.consensu.org/tcfv2/23/cmp2ui.js', + REACT_APP_GVL_BASE_URL: 'https://quantcast.mgr.consensu.org/GVL-v2/', + REACT_APP_TRANSLATION_BASE_URL: 'https://www.quantcast.mgr.consensu.org/tcfv2/translations/' + }).REACT_APP_DEBUG && console.log('Debug: ' + e); + }, io = function (e) { + var t = e.acceptAllFunction, n = e.rejectAllFunction, r = e.coreUiLabels, o = e.premiumUiLabels, i = e.isPopup, s = e.nonIabData, c = e.page, u = e.acceptSelected, l = e.vendorsData, f = e.setAllLegitimatesTo, p = e.showRejectButton, d = e.googleVendors, h = e.isAmp, m = lt(), g = mt(Object(Ye.useState)(!1), 2), v = g[0], y = g[1], b = function (e, t) { + var n = e.currentTarget.parentNode, o = xt.EXPAND_ELEMENT, i = xt.COLLAPSE_ELEMENT; + n.classList.contains('qc-cmp2-expanded') ? ko.eventTracker(i, t) : ko.eventTracker(o, t), n.classList.toggle('qc-cmp2-expanded'), e.currentTarget.innerHTML === r.showPartners ? e.currentTarget.innerHTML = r.hidePartners : e.currentTarget.innerHTML === r.hidePartners && (e.currentTarget.innerHTML = r.showPartners); + }, E = function (e, t, n, r) { + var o = e.initScreenBodyTextOption, i = t.customInitScreenBodyText, s = t.customSecondScreenBodyText, c = t.customVendorScreenBodyText, u = t.customLegitimateScreenBodyText, l = '', f = !1, p = e.consentScope; + switch (r) { + case 0: + var d, h = 4 === o && i, m = !1; + if (h) + d = ro(i, t.purposeScreenVendorLink.toLowerCase(), e); + else if (n) + switch (p) { + case Wr.SERVICE: + d = t.summaryScreenBodyRejectService; + break; + case Wr.GLOBAL: + d = t.summaryScreenBodyRejectGlobal; + break; + default: + m = !0, d = t.summaryScreenBodyRejectGroup; + } + else + switch (p) { + case Wr.SERVICE: + d = t.summaryScreenBodyNoRejectService; + break; + case Wr.GLOBAL: + d = t.summaryScreenBodyNoRejectGlobal; + break; + default: + m = !0, d = t.summaryScreenBodyNoRejectGroup; + } + return m && (d = [].concat(a(d), [Zr(d[1], t.groupOfSitesLabel, e)])), h || (d = [ + eo(d[0], t.purposeScreenVendorLink.toLowerCase()), + d[1] + ]), { + bodyText: d, + isCustomized: !!h + }; + case 1: + return 4 === o && s ? (l = ro(s, t.purposeScreenVendorLink.toLowerCase(), e), f = !0) : l = p === Wr.SERVICE ? t.initScreenBodyService || '' : p === Wr.GLOBAL ? t.initScreenBodyGlobal || '' : t.initScreenBodyGroup || '', { + bodyText: l, + isCustomized: f + }; + case 2: + return 4 === o && c ? (l = ro(c, t.purposeScreenVendorLink.toLowerCase(), e), f = !0) : l = t.vendorScreenBody || '', { + bodyText: l, + isCustomized: f + }; + case 3: + return 4 === o && u ? (l = ro(u, t.purposeScreenVendorLink.toLowerCase(), e), f = !0) : l = t.legitimateScreenBody || '', { + bodyText: l, + isCustomized: f + }; + default: + return { + bodyText: l, + isCustomized: f + }; + } + }(Po.coreConfig, r, p, c), w = function (e) { + if (e && e.target) { + var t = e.target; + t.scrollHeight - t.scrollTop === t.clientHeight ? y(!0) : v && y(!1); + } + }; + return Object(Ye.useEffect)(function () { + if (0 === c) { + var e = document.querySelector('.qc-cmp2-summary-info'); + e.scrollHeight - e.scrollTop === e.clientHeight ? y(!0) : v && y(!1); + } + }, []), Qe.a.createElement(At, { + isPopup: i, + id: 'qc-cmp2-ui', + page: c, + borderColor: _o.borderColor, + lightestTextColor: _o.lightestTextColor, + uxBackgroundColor: _o.uxBackgroundColor, + uxPrimaryButtonColor: _o.uxPrimaryButtonColor, + uxFontColor: _o.uxFontColor, + uxLinkColor: _o.uxLinkColor, + warningTextColor: _o.warningTextColor, + warningBackgroundColor: _o.warningBackgroundColor, + isIE: Un(), + usesLogo: '' !== Po.coreConfig.publisherLogo + }, ko.getDisplayType() !== St.MANDATORY && 0 !== c && Qe.a.createElement('button', { + className: 'qc-cmp2-close-icon', + onClick: function () { + m(Wo({ regulation: 'GDPR' })), ko.eventTracker(xt.DISMISS_UI, 'click'), To.sendDoneLog(void 0, '', ''), ko.notifyUiClosed('GDPR'), h && window.parent.postMessage({ + type: It.CONSENT_RESPONSE, + action: Lt.DISMISS + }, '*'); + } + }), function () { + var e = Qe.a.createElement(Qr, { + coreUiLabels: r, + page: c, + bodyContent: E, + handleScroll: 0 === c ? w : void 0, + isDesktop: window.screen.width > 767, + isAmp: h + }), i = function (e) { + return Qe.a.createElement(Kr, Object.assign({ + acceptAllFunction: t, + acceptSelected: u, + coreUiLabels: r, + page: c + }, e)); + }; + switch (c) { + case 1: + return Qe.a.createElement(Vr, { + coreUiLabels: r, + premiumUiLabels: o, + vendorsData: l, + nonIabData: s, + acceptAllFunction: t, + acceptSelected: u, + handleClick: b, + page: c + }, e, Qe.a.createElement(i, null)); + case 2: + return oo('Vendors rendered: '.concat(Object.keys(l.vendors).length)), Qe.a.createElement(Br, { + coreUiLabels: r, + premiumUiLabels: o, + vendorsData: l, + nonIabData: s, + acceptAllFunction: t, + acceptSelected: u, + handleClick: b, + page: c, + googleVendors: d + }, e, Qe.a.createElement(i, null)); + case 3: + return oo('Vendors rendered: '.concat(Object.keys(l.vendors).length)), Qe.a.createElement(kr, { + coreUiLabels: r, + premiumUiLabels: o, + vendorsData: l, + acceptAllFunction: t, + acceptSelected: u, + handleClick: b, + page: c, + setAllLegitimatesTo: f, + nonIabData: s + }, e, Qe.a.createElement(i, { setAllLegitimatesTo: f })); + default: + return Qe.a.createElement(Qe.a.Fragment, null, Qe.a.createElement('div', { className: 'qc-cmp2-summary-section' }, e), Qe.a.createElement(i, { + rejectAllFunction: n, + showRejectButton: p, + showOverlay: !0, + isScrolled: v, + isAmp: h + })); + } + }()); + }; + function ao() { + var e = gt(['\n align-items: flex-end;\n ']); + return ao = function () { + return e; + }, e; + } + function so() { + var e = gt([ + '\n && {\n background-color: ', + ';\n display: flex;\n align-items: center;\n justify-content: center;\n height: ', + 'px;\n width: 100vw;\n overflow: hidden;\n color: ', + ';\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99999999999999;\n\n * {\n font-family: ', + ';\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n line-height: 1;\n }\n\n @media (min-width: 768px) {\n ', + '\n }\n }\n' + ]); + return so = function () { + return e; + }, e; + } + var co = vt.c.div(so(), function (e) { + var t = e.overlayColor, n = e.isAMP, r = e.page; + return n && 0 === r ? 'none' : t; + }, function (e) { + return e.height; + }, function (e) { + return e.uxFontColor; + }, function (e) { + return e.font; + }, function (e) { + var t = e.isPopup, n = e.page; + return !t && 0 === n && Object(vt.b)(ao()); + }), uo = function (e) { + var t = e.isPopup, n = e.className, r = e.isOpen, o = e.page, i = e.children, a = e.isAMP, s = mt(Object(Ye.useState)(window.innerHeight), 2), c = s[0], u = s[1]; + Object(Ye.useEffect)(function () { + return window.addEventListener('resize', l), function () { + window.removeEventListener('resize', l); + }; + }); + var l = function () { + u(window.innerHeight); + }; + return Qe.a.createElement(Qe.a.Fragment, null, r && Qe.a.createElement(co, { + height: c, + isPopup: t, + className: n, + page: o, + overlayColor: _o.overlayColor, + uxFontColor: _o.uxFontColor, + font: _o.font, + isAMP: a + }, i)); + }, lo = function (e) { + var t = e.coreConfig, n = e.coreUiLabels, r = e.premiumUiLabels, o = e.nonIabData, i = e.vendorsData, a = e.consentGroupHandler, s = e.eventTracker, c = e.setAllLegitimatesTo, u = e.googleVendors, l = window.innerWidth <= 768 || document.documentElement.clientWidth <= 768 || document.body.clientWidth < 768, f = ht(function (e) { + return e.app.pageGDPR; + }), p = ht(function (e) { + return e.app.displayGDPR; + }), d = 0; + return 'number' === typeof f && (d = f), Qe.a.createElement(uo, { + isPopup: 'popup' === t.uiLayout || l, + isOpen: p, + className: 'qc-cmp-cleanslate', + page: f, + isAMP: t.isAMP + }, p && Qe.a.createElement(io, { + coreUiLabels: n, + isPopup: 'popup' === t.uiLayout || l, + nonIabData: o, + vendorsData: i, + eventTracker: s, + acceptAllFunction: function () { + a(d, !0); + }, + acceptSelected: function () { + a(d); + }, + rejectAllFunction: function () { + a(d, !1); + }, + page: f, + setAllLegitimatesTo: c, + showRejectButton: t.initScreenRejectButtonShowing, + premiumUiLabels: r, + googleVendors: u, + isAmp: t.isAMP + })); + }; + function fo() { + var e = gt([ + '\n && {\n max-width: 770px;\n width: 100%;\n position: relative;\n background: #fff;\n\n .qc-usp-ui-content {\n display: flex;\n flex-direction: column;\n margin: auto;\n max-width: 660px;\n padding: 60px 30px 30px;\n\n .qc-usp-ui-form-content {\n margin: auto;\n max-width: 600px;\n padding: 10px 10px 15px;\n border: 1px solid ', + ';\n\n > button {\n margin-top: 15px;\n font-size: 14px;\n width: 140px;\n height: 30px;\n }\n\n .qc-usp-container {\n border: none;\n margin: 0;\n\n .qc-usp-container-row {\n border: none;\n padding: 0;\n font-size: 14px;\n width: 100%;\n font-weight: 100;\n line-height: 20px;\n\n .qc-usp-purpose-info {\n display: flex;\n align-items: center;\n\n .qc-usp-toogle {\n margin-left: 0px;\n }\n\n .qc-usp-action-description {\n margin-left: 15px;\n width: calc(100% - 50px);\n }\n }\n }\n }\n }\n\n .qc-usp-title {\n color: ', + ';\n font-weight: 600;\n }\n\n .qc-usp-main-messaging {\n color: ', + ';\n font-size: 14px;\n line-height: 20px;\n max-height: 200px;\n padding: 15px 0;\n margin: 15px 0;\n overflow: auto;\n\n p:first-of-type {\n margin-bottom: 15px;\n }\n }\n }\n\n .qc-usp-alt-buttons {\n margin: 0 auto;\n padding-bottom: 60px;\n text-align: center;\n\n .qc-usp-alt-action {\n cursor: pointer;\n color: ', + ';\n font-size: 14px;\n text-align: center;\n\n &.qc-usp-center-bottom {\n display: inline;\n padding: 0 15px;\n text-decoration: none;\n\n & + .qc-usp-center-bottom {\n border-left: 1px solid ', + ';\n }\n }\n }\n }\n\n .qc-usp-close-icon {\n background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'24\' height=\'24\'%3E%3Cpath d=\'M.5.5l23 23m0-23l-23 23\' fill=\'none\' stroke=\'%23000\' stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-miterlimit=\'10\'/%3E%3Cpath fill=\'none\' d=\'M0 0h24v24H0z\'/%3E%3C/svg%3E")\n no-repeat;\n background-size: 65%;\n border: none;\n height: 38px;\n margin: auto 0;\n width: 38px;\n right: 20px;\n position: absolute;\n top: 20px;\n }\n\n @media (min-width: 768px) {\n .qc-usp-ui-content {\n .qc-usp-ui-form-content {\n .qc-usp-container {\n .qc-usp-container-row {\n .qc-usp-purpose-info {\n .qc-usp-toogle {\n margin-left: 3px;\n }\n\n .qc-usp-action-description {\n margin-left: 15px;\n width: calc(100% - 75px);\n }\n }\n }\n }\n }\n }\n }\n }\n' + ]); + return fo = function () { + return e; + }, e; + } + var po = vt.c.div(fo(), function (e) { + return e.borderColor; + }, function (e) { + return e.subHeaderColor; + }, function (e) { + return e.uxFontColor; + }, function (e) { + return e.uxPrimaryButtonColor; + }, function (e) { + return e.borderColor; + }), ho = function (e) { + var t = e.premiumUiLabels, n = e.coreConfig, r = e.close, o = e.eventTracker, i = mt(Object(Ye.useState)(!1), 2), a = i[0], s = i[1], c = mt(Object(Ye.useState)({ uspString: '' }), 2), u = c[0], l = c[1]; + Object(Ye.useLayoutEffect)(function () { + window.__uspapi('getUSPData', 1, function (e) { + s(e && 'Y' === e.uspString[2]), l(e); + }); + }, []); + return Qe.a.createElement(po, { + role: 'dialog', + 'aria-labelledby': 'qc-usp-title', + 'aria-modal': 'true', + tabIndex: 0, + borderColor: _o.borderColor, + subHeaderColor: _o.subHeaderColor, + uxFontColor: _o.uxFontColor, + uxPrimaryButtonColor: _o.uxPrimaryButtonColor + }, Qe.a.createElement('button', { + tabIndex: 0, + 'aria-label': 'Close', + 'aria-pressed': 'false', + className: 'qc-usp-close-icon ', + onClick: function (e) { + return r(), o(xt.DISMISS_UI, 'click'), void To.sendDoneLogUsp(_t.ACCEPT_PARTIAL, u.uspString); + } + }), Qe.a.createElement('div', { className: 'qc-usp-ui-content' }, Qe.a.createElement('p', { + id: 'qc-usp-title', + className: 'qc-usp-title' + }, n.publisherName && ''.concat(n.publisherName, ' - '), t.uspDnsTitle), Qe.a.createElement('div', { + className: 'qc-usp-main-messaging', + tabIndex: 0 + }, t.uspDnsText.map(function (e, t) { + return Qe.a.createElement('div', { + key: t, + dangerouslySetInnerHTML: { __html: e } + }); + })), Qe.a.createElement('div', { className: 'qc-usp-ui-form-content' }, Qe.a.createElement('div', { className: 'qc-usp-container' }, Qe.a.createElement('div', { className: 'qc-usp-container-row' }, Qe.a.createElement('div', { className: 'qc-usp-purpose-info' }, Qe.a.createElement($t, { + on: a, + className: 'qc-usp-toogle', + onClick: function () { + o(xt.OPT_OUT_TOGGLE, String(!a)), s(!a); + } + }), Qe.a.createElement('p', { className: 'qc-usp-action-description' }, t.uspDoNotSellToggleText)))), Qe.a.createElement(Fn, { + 'aria-label': 'Accept', + 'aria-pressed': 'false', + size: 'large', + onClick: function (e) { + return o(xt.OPT_OUT_CONFIRM, String(a)), window.__uspapi('setUspData', 1, function (e) { + To.sendDoneLogUsp(a ? _t.REJECT : _t.ACCEPT_ALL, e.uspString); + }, a), void r(); + } + }, t.uspAcceptButton))), Qe.a.createElement('div', { className: 'qc-usp-alt-buttons' }, !n.suppressCcpaLinks && Qe.a.createElement(Qe.a.Fragment, null, Qe.a.createElement('a', { + tabIndex: 0, + id: 'qc-usp-delete-link', + className: 'qc-usp-alt-action qc-usp-center-bottom', + href: n.uspDeleteDataLink, + title: 'Read More about the Data Deletion Policy' + }, t.uspDeleteDataLinkText), Qe.a.createElement('a', { + tabIndex: 0, + id: 'qc-usp-access-link', + className: 'qc-usp-alt-action qc-usp-center-bottom', + href: n.uspAccessDataLink, + title: 'Read More about the Data Access Policy' + }, t.uspAccessDataLinkText), Qe.a.createElement('a', { + tabIndex: 0, + id: 'qc-usp-policy-link', + className: 'qc-usp-alt-action qc-usp-center-bottom', + href: n.uspPrivacyPolicyLink, + title: 'Read More about the Privacy Policy' + }, t.uspPrivacyPolicyLinkText)))); + }, mo = function (e) { + var t = e.coreConfig, n = e.premiumUiLabels, r = e.eventTracker, o = ht(function (e) { + return e.app.displayUSP; + }), i = lt(); + return Qe.a.createElement(uo, { + className: 'qc-cmp-cleanslate', + isPopup: !0, + isOpen: o + }, o && Qe.a.createElement(ho, { + coreConfig: t, + premiumUiLabels: n, + eventTracker: r, + close: function () { + i(Wo({ regulation: 'USP' })); + } + })); + }; + function go() { + var e = gt(['\n/* This is a customized version of cleaslate. For more info go here: http://cleanslatecss.com/ */\n .qc-cmp-cleanslate, .qc-cmp-cleanslate h1, .qc-cmp-cleanslate h2, .qc-cmp-cleanslate h3, .qc-cmp-cleanslate h4, .qc-cmp-cleanslate h5, .qc-cmp-cleanslate h6, .qc-cmp-cleanslate p, .qc-cmp-cleanslate td, .qc-cmp-cleanslate dl, .qc-cmp-cleanslate tr, .qc-cmp-cleanslate dt, .qc-cmp-cleanslate ol, .qc-cmp-cleanslate form, .qc-cmp-cleanslate select, .qc-cmp-cleanslate option, .qc-cmp-cleanslate pre, .qc-cmp-cleanslate div, .qc-cmp-cleanslate table, .qc-cmp-cleanslate th, .qc-cmp-cleanslate tbody, .qc-cmp-cleanslate tfoot, .qc-cmp-cleanslate caption, .qc-cmp-cleanslate thead, .qc-cmp-cleanslate ul, .qc-cmp-cleanslate li, .qc-cmp-cleanslate address, .qc-cmp-cleanslate blockquote, .qc-cmp-cleanslate dd, .qc-cmp-cleanslate fieldset, .qc-cmp-cleanslate li, .qc-cmp-cleanslate iframe, .qc-cmp-cleanslate strong, .qc-cmp-cleanslate legend, .qc-cmp-cleanslate em, .qc-cmp-cleanslate summary, .qc-cmp-cleanslate cite, .qc-cmp-cleanslate span, .qc-cmp-cleanslate input, .qc-cmp-cleanslate sup, .qc-cmp-cleanslate label, .qc-cmp-cleanslate dfn, .qc-cmp-cleanslate object, .qc-cmp-cleanslate big, .qc-cmp-cleanslate q, .qc-cmp-cleanslate samp, .qc-cmp-cleanslate acronym, .qc-cmp-cleanslate small, .qc-cmp-cleanslate img, .qc-cmp-cleanslate strike, .qc-cmp-cleanslate code, .qc-cmp-cleanslate sub, .qc-cmp-cleanslate ins, .qc-cmp-cleanslate textarea, .qc-cmp-cleanslate button, .qc-cmp-cleanslate var, .qc-cmp-cleanslate a, .qc-cmp-cleanslate abbr, .qc-cmp-cleanslate applet, .qc-cmp-cleanslate del, .qc-cmp-cleanslate kbd, .qc-cmp-cleanslate tt, .qc-cmp-cleanslate b, .qc-cmp-cleanslate i, .qc-cmp-cleanslate hr,\n\n .qc-cmp-cleanslate article, .qc-cmp-cleanslate aside, .qc-cmp-cleanslate figure, .qc-cmp-cleanslate figcaption, .qc-cmp-cleanslate footer, .qc-cmp-cleanslate header, .qc-cmp-cleanslate menu, .qc-cmp-cleanslate nav, .qc-cmp-cleanslate section, .qc-cmp-cleanslate time, .qc-cmp-cleanslate mark, .qc-cmp-cleanslate audio, .qc-cmp-cleanslate video, .qc-cmp-cleanslate abbr, .qc-cmp-cleanslate address, .qc-cmp-cleanslate area, .qc-cmp-cleanslate blockquote, .qc-cmp-cleanslate canvas, .qc-cmp-cleanslate caption, .qc-cmp-cleanslate cite, .qc-cmp-cleanslate code, .qc-cmp-cleanslate colgroup, .qc-cmp-cleanslate col, .qc-cmp-cleanslate datalist, .qc-cmp-cleanslate fieldset, .qc-cmp-cleanslate main, .qc-cmp-cleanslate map, .qc-cmp-cleanslate meta, .qc-cmp-cleanslate optgroup, .qc-cmp-cleanslate output, .qc-cmp-cleanslate progress, .qc-cmp-cleanslate svg {\n background-attachment: scroll;\n background-color: transparent;\n background-image: none; \n background-position: 0 0;\n background-repeat: repeat;\n border-color: black;\n border-color: currentColor; \n border-radius: 0;\n border-style: none;\n border-width: medium;\n bottom: auto;\n clear: none;\n clip: auto;\n color: inherit;\n counter-increment: none;\n counter-reset: none;\n cursor: auto;\n direction: inherit;\n display: inline;\n float: none;\n font-family: inherit;\n font-size: inherit;\n font-style: inherit;\n font-variant: normal;\n font-weight: inherit;\n height: auto;\n left: auto;\n letter-spacing: normal;\n line-height: inherit;\n list-style-type: inherit;\n list-style-position: outside;\n list-style-image: none;\n margin: 0;\n max-height: none;\n max-width: none;\n min-height: 0;\n min-width: 0;\n opacity: 1;\n outline: invert none medium;\n overflow: visible;\n padding: 0;\n position: static;\n quotes: \'\' \'\';\n right: auto;\n table-layout: auto;\n text-align: inherit;\n text-decoration: inherit;\n text-indent: 0;\n text-transform: none;\n top: auto;\n unicode-bidi: normal;\n vertical-align: baseline;\n visibility: inherit;\n white-space: normal;\n width: auto;\n word-spacing: normal;\n z-index: auto;\n\n -webkit-background-origin: padding-box;\n background-origin: padding-box;\n -webkit-background-clip: border-box;\n background-clip: border-box;\n -webkit-background-size: auto;\n -moz-background-size: auto;\n background-size: auto;\n -webkit-border-image: none;\n -moz-border-image: none;\n -o-border-image: none;\n border-image: none;\n -webkit-border-radius: 0;\n -moz-border-radius: 0;\n border-radius: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n -webkit-box-sizing: content-box;\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n -webkit-column-count: auto;\n -moz-column-count: auto;\n column-count: auto;\n -webkit-column-gap: normal;\n -moz-column-gap: normal;\n column-gap: normal;\n -webkit-column-rule: medium none black;\n -moz-column-rule: medium none black;\n column-rule: medium none black;\n -webkit-column-span: 1;\n -moz-column-span: 1;\n column-span: 1;\n -webkit-column-width: auto;\n -moz-column-width: auto;\n column-width: auto;\n font-feature-settings: normal;\n overflow-x: visible;\n overflow-y: visible;\n -webkit-hyphens: manual;\n -moz-hyphens: manual;\n hyphens: manual;\n -webkit-perspective: none;\n -moz-perspective: none;\n -ms-perspective: none;\n -o-perspective: none;\n perspective: none;\n -webkit-perspective-origin: 50% 50%;\n -moz-perspective-origin: 50% 50%;\n -ms-perspective-origin: 50% 50%;\n -o-perspective-origin: 50% 50%;\n perspective-origin: 50% 50%;\n -webkit-backface-visibility: visible;\n -moz-backface-visibility: visible;\n -ms-backface-visibility: visible;\n -o-backface-visibility: visible;\n backface-visibility: visible;\n text-shadow: none;\n -webkit-transition: all 0s ease 0s;\n transition: all 0s ease 0s;\n -webkit-transform: none;\n -moz-transform: none;\n -ms-transform: none;\n -o-transform: none;\n transform: none;\n -webkit-transform-origin: 50% 50%;\n -moz-transform-origin: 50% 50%;\n -ms-transform-origin: 50% 50%;\n -o-transform-origin: 50% 50%;\n transform-origin: 50% 50%;\n -webkit-transform-style: flat;\n -moz-transform-style: flat;\n -ms-transform-style: flat;\n -o-transform-style: flat;\n transform-style: flat;\n word-break: normal;\n }\n\n .qc-cmp-cleanslate, .qc-cmp-cleanslate h3, .qc-cmp-cleanslate h5, .qc-cmp-cleanslate p, .qc-cmp-cleanslate h1, .qc-cmp-cleanslate dl, .qc-cmp-cleanslate dt, .qc-cmp-cleanslate h6, .qc-cmp-cleanslate ol, .qc-cmp-cleanslate form, .qc-cmp-cleanslate option, .qc-cmp-cleanslate pre, .qc-cmp-cleanslate div, .qc-cmp-cleanslate h2, .qc-cmp-cleanslate caption, .qc-cmp-cleanslate h4, .qc-cmp-cleanslate ul, .qc-cmp-cleanslate address, .qc-cmp-cleanslate blockquote, .qc-cmp-cleanslate dd, .qc-cmp-cleanslate fieldset, .qc-cmp-cleanslate hr,\n\n .qc-cmp-cleanslate article, .qc-cmp-cleanslate dialog, .qc-cmp-cleanslate figure, .qc-cmp-cleanslate footer, .qc-cmp-cleanslate header, .qc-cmp-cleanslate hgroup, .qc-cmp-cleanslate menu, .qc-cmp-cleanslate nav, .qc-cmp-cleanslate section, .qc-cmp-cleanslate audio, .qc-cmp-cleanslate video, .qc-cmp-cleanslate address, .qc-cmp-cleanslate blockquote, .qc-cmp-cleanslate colgroup, .qc-cmp-cleanslate main, .qc-cmp-cleanslate progress, .qc-cmp-cleanslate summary {\n display: block;\n }\n .qc-cmp-cleanslate h1,\n .qc-cmp-cleanslate h2,\n .qc-cmp-cleanslate h3,\n .qc-cmp-cleanslate h4,\n .qc-cmp-cleanslate h5,\n .qc-cmp-cleanslate h6 {\n font-weight: bold;\n }\n .qc-cmp-cleanslate h1 {\n font-size: 2em;\n padding: 0.67em 0;\n }\n .qc-cmp-cleanslate h2 {\n font-size: 1.5em;\n padding: 0.83em 0;\n }\n .qc-cmp-cleanslate h3 {\n font-size: 1.17em;\n padding: 0.83em 0;\n }\n .qc-cmp-cleanslate h4 {\n font-size: 1em;\n }\n .qc-cmp-cleanslate h5 {\n font-size: 0.83em;\n }\n .qc-cmp-cleanslate p {\n margin: 1em 0;\n }\n .qc-cmp-cleanslate table {\n display: table;\n }\n .qc-cmp-cleanslate thead {\n display: table-header-group;\n }\n .qc-cmp-cleanslate tbody {\n display: table-row-group;\n }\n .qc-cmp-cleanslate tfoot {\n display: table-footer-group;\n }\n .qc-cmp-cleanslate tr {\n display: table-row;\n }\n .qc-cmp-cleanslate th,\n .qc-cmp-cleanslate td {\n display: table-cell;\n padding: 2px;\n }\n\n .qc-cmp-cleanslate ol,\n .qc-cmp-cleanslate ul {\n margin: 1em 0;\n }\n .qc-cmp-cleanslate ul li,\n .qc-cmp-cleanslate ul ul li,\n .qc-cmp-cleanslate ul ul ul li,\n .qc-cmp-cleanslate ol li,\n .qc-cmp-cleanslate ol ol li,\n .qc-cmp-cleanslate ol ol ol li,\n .qc-cmp-cleanslate ul ol ol li,\n .qc-cmp-cleanslate ul ul ol li,\n .qc-cmp-cleanslate ol ul ul li,\n .qc-cmp-cleanslate ol ol ul li {\n list-style-position: inside;\n margin-top: 0.08em;\n }\n .qc-cmp-cleanslate ol ol,\n .qc-cmp-cleanslate ol ol ol,\n .qc-cmp-cleanslate ul ul,\n .qc-cmp-cleanslate ul ul ul,\n .qc-cmp-cleanslate ol ul,\n .qc-cmp-cleanslate ol ul ul,\n .qc-cmp-cleanslate ol ol ul,\n .qc-cmp-cleanslate ul ol,\n .qc-cmp-cleanslate ul ol ol,\n .qc-cmp-cleanslate ul ul ol {\n padding-left: 40px;\n margin: 0;\n }\n\n .qc-cmp-cleanslate nav ul,\n .qc-cmp-cleanslate nav ol {\n list-style-type: none;\n }\n .qc-cmp-cleanslate ul,\n .qc-cmp-cleanslate menu {\n list-style-type: disc;\n }\n .qc-cmp-cleanslate ol {\n list-style-type: decimal;\n }\n .qc-cmp-cleanslate ol ul,\n .qc-cmp-cleanslate ul ul,\n .qc-cmp-cleanslate menu ul,\n .qc-cmp-cleanslate ol menu,\n .qc-cmp-cleanslate ul menu,\n .qc-cmp-cleanslate menu menu {\n list-style-type: circle;\n }\n .qc-cmp-cleanslate ol ol ul,\n .qc-cmp-cleanslate ol ul ul,\n .qc-cmp-cleanslate ol menu ul,\n .qc-cmp-cleanslate ol ol menu,\n .qc-cmp-cleanslate ol ul menu,\n .qc-cmp-cleanslate ol menu menu,\n .qc-cmp-cleanslate ul ol ul,\n .qc-cmp-cleanslate ul ul ul,\n .qc-cmp-cleanslate ul menu ul,\n .qc-cmp-cleanslate ul ol menu,\n .qc-cmp-cleanslate ul ul menu,\n .qc-cmp-cleanslate ul menu menu,\n .qc-cmp-cleanslate menu ol ul,\n .qc-cmp-cleanslate menu ul ul,\n .qc-cmp-cleanslate menu menu ul,\n .qc-cmp-cleanslate menu ol menu,\n .qc-cmp-cleanslate menu ul menu,\n .qc-cmp-cleanslate menu menu menu {\n list-style-type: square;\n }\n .qc-cmp-cleanslate li {\n display: list-item;\n min-height: auto;\n min-width: auto;\n padding-left: 20px;\n }\n .qc-cmp-cleanslate strong {\n font-weight: bold;\n }\n .qc-cmp-cleanslate em {\n font-style: italic;\n }\n .qc-cmp-cleanslate kbd,\n .qc-cmp-cleanslate samp,\n .qc-cmp-cleanslate code,\n .qc-cmp-cleanslate pre {\n font-family: monospace;\n }\n .qc-cmp-cleanslate a {\n color: blue;\n text-decoration: underline;\n }\n .qc-cmp-cleanslate a:visited {\n color: #529;\n }\n .qc-cmp-cleanslate a,\n .qc-cmp-cleanslate a *,\n .qc-cmp-cleanslate input[type=\'submit\'],\n .qc-cmp-cleanslate input[type=\'button\'],\n .qc-cmp-cleanslate input[type=\'radio\'],\n .qc-cmp-cleanslate input[type=\'checkbox\'],\n .qc-cmp-cleanslate select,\n .qc-cmp-cleanslate button {\n cursor: pointer;\n }\n .qc-cmp-cleanslate button,\n .qc-cmp-cleanslate input[type=\'submit\'] {\n text-align: center;\n padding: 2px 6px 3px;\n border-radius: 0;\n text-decoration: none;\n font-family: arial, helvetica, sans-serif;\n font-size: small;\n background: white;\n color: buttontext;\n border: 1px #a6a6a6 solid;\n background: none;\n filter: none;\n box-shadow: none;\n outline: initial;\n\n &:focus {\n box-shadow: 0 0 0 2px #ffffff, 0 0 3px 5px #206DC5;\n outline: 2px dotted transparent;\n outline-offset: 2px;\n }\n }\n .qc-cmp-cleanslate button:active,\n .qc-cmp-cleanslate input[type=\'submit\']:active,\n .qc-cmp-cleanslate input[type=\'button\']:active,\n .qc-cmp-cleanslate button:active {\n background: none;\n border: none;\n }\n .qc-cmp-cleanslate button {\n padding: 1px 6px 2px 6px;\n margin-right: 5px;\n }\n .qc-cmp-cleanslate input[type=\'hidden\'] {\n display: none;\n }\n\n .qc-cmp-cleanslate textarea {\n -webkit-appearance: textarea;\n background: white;\n padding: 2px;\n margin-left: 4px;\n word-wrap: break-word;\n white-space: pre-wrap;\n font-size: 11px;\n font-family: arial, helvetica, sans-serif;\n line-height: 13px;\n resize: both;\n }\n .qc-cmp-cleanslate select,\n .qc-cmp-cleanslate textarea,\n .qc-cmp-cleanslate input {\n border: 1px solid #ccc;\n }\n .qc-cmp-cleanslate select {\n font-size: 11px;\n font-family: helvetica, arial, sans-serif;\n display: inline-block;\n }\n .qc-cmp-cleanslate textarea:focus,\n .qc-cmp-cleanslate input:focus {\n outline: auto 5px -webkit-focus-ring-color;\n outline: initial;\n }\n .qc-cmp-cleanslate input[type=\'text\'] {\n background: white;\n padding: 1px;\n font-family: initial;\n font-size: small;\n }\n .qc-cmp-cleanslate input[type=\'checkbox\'],\n .qc-cmp-cleanslate input[type=\'radio\'] {\n border: 1px #2b2b2b solid;\n border-radius: 4px;\n }\n .qc-cmp-cleanslate input[type=\'checkbox\'],\n .qc-cmp-cleanslate input[type=\'radio\'] {\n outline: initial;\n }\n .qc-cmp-cleanslate input[type=\'radio\'] {\n margin: 2px 2px 3px 2px;\n }\n .qc-cmp-cleanslate abbr[title],\n .qc-cmp-cleanslate acronym[title],\n .qc-cmp-cleanslate dfn[title] {\n cursor: help;\n border-bottom-width: 1px;\n border-bottom-style: dotted;\n }\n .qc-cmp-cleanslate ins {\n background-color: #ff9;\n color: black;\n }\n .qc-cmp-cleanslate del {\n text-decoration: line-through;\n }\n .qc-cmp-cleanslate blockquote,\n .qc-cmp-cleanslate q {\n quotes: none; \n }\n .qc-cmp-cleanslate blockquote:before,\n .qc-cmp-cleanslate blockquote:after,\n .qc-cmp-cleanslate q:before,\n .qc-cmp-cleanslate q:after,\n .qc-cmp-cleanslate li:before,\n .qc-cmp-cleanslate li:after {\n content: \'\';\n }\n .qc-cmp-cleanslate input,\n .qc-cmp-cleanslate select {\n vertical-align: middle;\n }\n\n .qc-cmp-cleanslate table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n .qc-cmp-cleanslate hr {\n display: block;\n height: 1px;\n border: 0;\n border-top: 1px solid #ccc;\n margin: 1em 0;\n }\n .qc-cmp-cleanslate *[dir=\'rtl\'] {\n direction: rtl;\n }\n .qc-cmp-cleanslate mark {\n background-color: #ff9;\n color: black;\n font-style: italic;\n font-weight: bold;\n }\n .qc-cmp-cleanslate menu {\n padding-left: 40px;\n padding-top: 8px;\n }\n\n .qc-cmp-cleanslate [hidden],\n .qc-cmp-cleanslate template {\n display: none;\n }\n .qc-cmp-cleanslate abbr[title] {\n border-bottom: 1px dotted;\n }\n .qc-cmp-cleanslate sub,\n .qc-cmp-cleanslate sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n .qc-cmp-cleanslate sup {\n top: -0.5em;\n }\n .qc-cmp-cleanslate sub {\n bottom: -0.25em;\n }\n .qc-cmp-cleanslate img {\n border: 0;\n }\n .qc-cmp-cleanslate figure {\n margin: 0;\n }\n .qc-cmp-cleanslate textarea {\n overflow: auto;\n vertical-align: top;\n }\n\n .qc-cmp-cleanslate {\n font-size: medium;\n line-height: 1;\n direction: ltr;\n text-align: left;\n text-align: start;\n font-family: \'Times New Roman\', Times, serif;\n color: black;\n font-style: normal;\n font-weight: normal;\n text-decoration: none;\n list-style-type: disc;\n }\n\n .qc-cmp-cleanslate pre {\n white-space: pre;\n }\n']); + return go = function () { + return e; + }, e; + } + var vo, yo, bo, Eo = Object(vt.a)(go()); + n(128), n(129), n(130); + !function (e) { + e[e.TOP_LEFT = 1] = 'TOP_LEFT', e[e.TOP_RIGHT = 2] = 'TOP_RIGHT', e[e.BOTTOM_RIGHT = 3] = 'BOTTOM_RIGHT', e[e.BOTTOM_LEFT = 4] = 'BOTTOM_LEFT'; + }(vo || (vo = {})), function (e) { + e.YES = 'Y', e.NOT = 'N'; + }(yo || (yo = {})), function (e) { + e.GDPR = 'GDPR', e.USP = 'USP'; + }(bo || (bo = {})); + n(131); + var wo = function (e) { + var t, n = e.ui, r = e.mode, o = ht(function (e) { + return e.app.changed; + }), i = ht(function (e) { + return e.app.displayGDPR; + }), a = ht(function (e) { + return e.app.displayUSP; + }), s = n.consentGroupHandler, c = n.setAllLegitimatesTo, u = n.getCoreConfig(), l = n.getCoreUiLabels(), f = n.getPremiumUiLabels(), p = n.eventTracker, d = mt(Object(Ye.useState)(), 2), h = d[0], m = d[1], g = mt(Object(Ye.useState)(), 2), v = g[0], y = g[1], b = mt(Object(Ye.useState)(), 2), E = b[0], w = b[1]; + return Object(Ye.useEffect)(function () { + (i && !v || !n.GVLVendorsDataInitialized && i) && (m(n.getNonIabData()), w(n.getGoogleVendors()), Oo.readyPromise.then(function () { + y(n.getGVLVendorsData()); + })), o && oo('Last changed '.concat(o)); + }, [ + o, + i, + a, + n, + v + ]), t = '', r === bo.GDPR && v && h && E ? t = Qe.a.createElement(lo, { + coreConfig: u, + coreUiLabels: l, + nonIabData: h, + vendorsData: v, + consentGroupHandler: s, + setAllLegitimatesTo: c, + premiumUiLabels: f, + eventTracker: p, + googleVendors: E + }) : r === bo.USP && (t = Qe.a.createElement(mo, { + coreConfig: u, + premiumUiLabels: f, + eventTracker: p + })), Qe.a.createElement(Qe.a.Fragment, null, t, Qe.a.createElement(Eo, null)); + }, xo = n(54); + function So(e, t, n, r) { + var o = n && document.getElementById(n); + return o || (o = document.createElement(e), t && (o.className = t), n && (o.id = n), r && r.insertBefore(o, r.firstChild)), o; + } + var Co = function (e) { + var t = e.coreConfig, n = t.publisherFeaturesIds, r = t.publisherSpecialFeaturesIds, o = t.publisherSpecialPurposesIds, i = t.publisherPurposeIds, a = t.publisherPurposeLegitimateInterestIds, s = t.vendorPurposeIds, c = t.vendorPurposeLegitimateInterestIds, u = t.vendorSpecialFeaturesIds, l = t.vendorSpecialPurposesIds, f = t.vendorFeaturesIds, p = [ + n, + r, + o, + i, + a, + s, + c, + u, + l, + f + ], d = (s || []).length; + return p.forEach(function (e) { + var t; + (t = e) && t.sort(function (e, t) { + return e - t; + }); + }), { + purposeIds: (d ? s : i) || [], + purposeLegitimateInterestIds: (d ? c : a) || [], + specialFeaturesIds: (d ? u : r) || [], + specialPurposesIds: (d ? l : o) || [], + featuresIds: (d ? f : n) || [] + }; + }; + var ko, To, _o, Po, Oo, Io, Lo, Ao, Ro = function () { + function e(t, n) { + if (l(this, e), this._data = { + features: {}, + legitimatePurposes: {}, + legitimateVendors: {}, + purposes: {}, + specialPurposes: {}, + stacks: {}, + specialFeatures: {}, + unfilteredSpecialPurposes: {}, + unfilteredSpecialFeatures: {}, + unfilteredPurposes: {}, + unfilteredFeatures: {}, + vendors: {} + }, t) { + var r = Ot.STACKS, o = Ot.SPECIAL_FEATURES, i = Ot.SPECIAL_PURPOSES, a = Ot.FEATURES, s = t.stacks, c = t.features, u = t.purposes, f = t.vendors, p = t.specialPurposes, h = t.specialFeatures, g = Co(n), v = g.specialFeaturesIds, y = g.specialPurposesIds, b = g.featuresIds, E = n.coreConfig, w = E.stacks, x = E.publisherPurposeIds, S = E.publisherPurposeLegitimateInterestIds, C = E.publisherFeaturesIds, k = E.publisherSpecialFeaturesIds, T = E.publisherSpecialPurposesIds, _ = E.consentScope, P = n.coreConfig.publisherName || n.coreConfig.cookieDomain || '', O = { + id: P, + name: P, + specialPurposes: T, + features: C, + flexiblePurposes: [], + legIntPurposes: S, + specialFeatures: k, + purposes: x + }, I = f; + (O.purposes || O.legIntPurposes) && ([ + 'service', + 'service group' + ].includes(_ || '') ? I = m(d({}, P, O), f) : console.warn('You can\'t use publisher legal basis on '.concat(_, ' consent scope.'))); + var L = this.filterVendors(I, n), A = L.vendors, R = L.legitimateVendors, N = this.filterStacksAndSpecial(w || [], r, s).stacks, j = this.filterPurposes(u, n), q = j.purposes, F = j.legitimatePurposes, D = this.filterStacksAndSpecial(b, a, c).features, M = this.filterStacksAndSpecial(v, o, h).specialFeatures, U = this.filterStacksAndSpecial(y, i, p).specialPurposes; + this._data = { + stacks: N, + vendors: A, + features: D, + purposes: q, + specialFeatures: M, + specialPurposes: U, + legitimateVendors: R, + legitimatePurposes: F, + unfilteredFeatures: c, + unfilteredPurposes: u, + unfilteredSpecialFeatures: h, + unfilteredSpecialPurposes: p + }; + } + } + return p(e, [ + { + key: 'filterVendors', + value: function (e, t) { + var n = Co(t), r = n.purposeIds, o = n.purposeLegitimateInterestIds, i = Ot.VENDORS, a = Ot.LEGITIMATE_VENDORS, s = {}, c = t.coreConfig.publisherConsentRestrictionIds || [], u = t.coreConfig.publisherLIRestrictionIds || []; + s[i] = {}, s[a] = {}; + var l = function (t) { + var n = e[t], l = n.legIntPurposes, f = n.purposes, p = n.flexiblePurposes, d = n.id; + l.length > 0 && (l.some(function (e) { + return r.includes(e); + }) || l.some(function (e) { + return o.includes(e); + })) && (s[a][t] = n), f.length > 0 && (f.some(function (e) { + return r.includes(e); + }) || f.some(function (e) { + return o.includes(e); + })) && (s[i][t] = n), p.length > 0 && (p.some(function (e) { + return c.includes(e); + }) || p.some(function (e) { + return u.includes(e); + })) && p.forEach(function (e) { + if (c.includes(e) || u.includes(e)) { + var t = new xo.PurposeRestriction(); + t.purposeId = e, t.restrictionType = c.includes(e) ? xo.RestrictionType.REQUIRE_LI : xo.RestrictionType.REQUIRE_CONSENT, window.__tcfapi('setPublisherRestriction', 2, function () { + return oo('Setting publisher restriction - Vendor: '.concat(d, ' Purpose: ').concat(e)); + }, { + id: d, + purposeRestriction: t + }); + } + }); + }; + for (var f in e) + l(f); + return oo('Regular vendors loaded: '.concat(Object.keys(s[i]).length)), oo('Legitimate vendors loaded: '.concat(Object.keys(s[a]).length)), s[i] = JSON.parse(JSON.stringify(s[i])), s[a] = JSON.parse(JSON.stringify(s[a])), s; + } + }, + { + key: 'filterPurposes', + value: function (e, t) { + var n = t.coreConfig.consentScope, r = Co(t), o = r.purposeIds, i = r.purposeLegitimateInterestIds, a = Ot.PURPOSES, s = Ot.LEGITIMATE_PURPOSES, c = {}; + return c[a] = {}, c[s] = {}, o.forEach(function (t) { + i.includes(t) && 1 !== t && (c[s][t] = m({}, e[t])), c[a][t] = m({}, e[t]); + }), !c[a][1] && (n || '').includes('global') && (c[a][1] = m({}, e[1])), c; + } + }, + { + key: 'filterStacksAndSpecial', + value: function (e, t, n) { + var r = {}; + return r[t] = {}, e.length && e.forEach(function (e) { + r[t][e] = n[e]; + }), r; + } + }, + { + key: 'updateStatus', + value: function (e, t, n) { + this._data[t][e].status = n; + } + }, + { + key: 'data', + get: function () { + return this._data; + }, + set: function (e) { + this._data = e; + } + } + ]), e; + }(), No = function () { + function e() { + l(this, e), this._cmpInfo = void 0, this._nonIabConsents = void 0, this._vendorConsents = void 0, this._vendorLegitimateInterest = void 0, this._purposesConsents = void 0, this._legitimatePurposesConsents = void 0, this._stacksConsents = void 0, this._specialPurposesConsents = void 0, this._specialFeaturesConsents = void 0, this._googleConsents = void 0, this.sessionId = void 0, this.allConsents = void 0, this.displayType = void 0, this._nonIabVendorsInitialized = !1, this._googleVendorsInitialized = !1, this._GVLVendorsDataInitialized = !1, this._nonIabConsents = {}, this._vendorConsents = {}, this._purposesConsents = {}, this._legitimatePurposesConsents = { + 1: !0, + 2: !0, + 3: !0, + 4: !0, + 5: !0, + 6: !0, + 7: !0, + 8: !0, + 9: !0, + 10: !0 + }, this._stacksConsents = {}, this._specialPurposesConsents = {}, this._vendorLegitimateInterest = {}, this._specialFeaturesConsents = {}, this._googleConsents = {}, this.consentGroupHandler = this.consentGroupHandler.bind(this), this.setAllLegitimatesTo = this.setAllLegitimatesTo.bind(this), this.allConsents = !0, this.sessionId = '', this.displayType = St.CHANGE_OF_CONSENT, this._cmpInfo = new Ro(Oo, Po); + } + return p(e, [ + { + key: 'getCoreConfig', + value: function () { + return Po.coreConfig; + } + }, + { + key: 'getPremiumUiLabels', + value: function () { + return Po.premiumUiLabels; + } + }, + { + key: 'getCoreUiLabels', + value: function () { + return Po.coreUiLabels; + } + }, + { + key: 'getDisplayType', + value: function () { + return this.displayType; + } + }, + { + key: 'getNonIabData', + value: function () { + var e = Ct.NON_IAB; + return this.populateConsents(!this._nonIabVendorsInitialized, e, Lo, Io), this._nonIabVendorsInitialized || (this._nonIabVendorsInitialized = !0), { + isEnabled: !!Po.premiumProperties.nonIabVendorListUrl, + vendors: Lo + }; + } + }, + { + key: 'getGoogleVendors', + value: function () { + var e = Ct.GOOGLE; + return this.populateConsents(!this._googleVendorsInitialized, e, Ao, Io), this._googleVendorsInitialized || (this._googleVendorsInitialized = !0), { + isEnabled: Po.coreConfig.googleEnabled, + data: Ao + }; + } + }, + { + key: 'getGVLVendorsData', + value: function () { + var e = Ct.VENDORS, t = Ct.LEGITIMATE_VENDORS, n = Ct.LEGITIMATE_PURPOSES, r = Ct.PURPOSES, o = Ct.SPECIAL_FEATURES, i = Ct.STACKS, a = !this._GVLVendorsDataInitialized; + return this.populateConsents(a, e, this._cmpInfo.data.vendors, Io), this.populateConsents(a, r, this._cmpInfo.data.purposes, Io), this.populateConsents(a, o, this._cmpInfo.data.specialFeatures, Io), this.populateConsents(a, t, this._cmpInfo.data.legitimateVendors, Io), this.populateConsents(a, n, this._cmpInfo.data.legitimatePurposes, Io), this.populateConsents(!0, i, this._cmpInfo.data.stacks, Io), this.populateStacksLabels(this._cmpInfo.data.stacks), this._GVLVendorsDataInitialized = !0, this._cmpInfo.data; + } + }, + { + key: 'populateStacksLabels', + value: function (e) { + var t = this, n = Po.coreUiLabels, r = n.onLabel, o = n.offLabel, i = n.multiLabel; + for (var a in e) { + var s = e[a], c = s.purposes.reduce(function (e, n) { + return e || t._purposesConsents[n]; + }, !1), u = !!s.specialFeatures && s.specialFeatures.reduce(function (e, n) { + return e || t._specialFeaturesConsents[n]; + }, !1), l = void 0; + l = this._stacksConsents[a] ? r : c || u ? i : o, s.stateLabel = l; + } + } + }, + { + key: 'setAllConsentsTo', + value: function (e) { + var t = [ + this._vendorConsents, + this._purposesConsents, + this._stacksConsents, + this._specialFeaturesConsents, + this._nonIabConsents, + this._googleConsents + ], n = [ + this._cmpInfo.data.purposes, + this._cmpInfo.data.vendors, + this._cmpInfo.data.specialFeatures + ]; + this._nonIabVendorsInitialized && Lo.length && n.push(Lo), this._googleVendorsInitialized && Ao.length && n.push(Ao), e && t.concat(this._legitimatePurposesConsents, this._vendorLegitimateInterest); + for (var r = 0, o = t; r < o.length; r++) { + var i = o[r]; + for (var a in i) + i[a] = e; + } + n.forEach(function (t) { + for (var n in t) + t[n].status = e; + }), Object.keys(this._cmpInfo.data.stacks).length && (this.updateStacksConsent(), this.populateStacksLabels(this._cmpInfo.data.stacks)); + } + }, + { + key: 'setAllLegitimatesTo', + value: function (e) { + var t = xt.ACCEPT_ALL_LEGITIMATE, n = xt.OBJECT_ALL_LEGITIMATE, r = [ + this._legitimatePurposesConsents, + this._vendorLegitimateInterest + ], o = [ + this._cmpInfo.data.legitimateVendors, + this._cmpInfo.data.legitimatePurposes + ]; + this.eventTracker(e ? t : n, 'click'), r.forEach(function (t) { + for (var n in t) + t[n] = e; + }), o.forEach(function (t) { + for (var n in t) + t[n].status = e; + }), Qo.dispatch(Yo('allLegitimates-'.concat(e))); + } + }, + { + key: 'consentGroupHandler', + value: function (e, t) { + this.allConsents = t, void 0 !== t && this.setAllConsentsTo(t); + var n = { + vendorConsents: this.vendorConsents, + purposesConsents: this.purposesConsents, + specialFeatures: this.specialFeaturesConsents, + vendorLegitimateInterest: this.vendorLegitimateInterest, + legitimatePurposesConsents: this.legitimatePurposesConsents, + nonIabConsents: this.nonIabConsents, + googleConsents: this._googleConsents, + consentScreen: e, + allConsents: t + }; + Qo.dispatch(Wo({ regulation: 'GDPR' })), window.__tcfapi('setConsentInfo', 2, this.handleSetConsentInfoCallback.bind(this), n); + } + }, + { + key: 'notifyUiClosed', + value: function (e) { + window.__tcfapi('notifyUiState', 2, function () { + }, { + regulation: e, + visible: !1 + }); + } + }, + { + key: 'handleSetConsentInfoCallback', + value: function (e) { + var t = xt.ACCEPT_ALL, n = xt.SAVE_AND_EXIT, r = xt.REJECT_ALL; + this.eventTracker(void 0 !== this.allConsents ? this.allConsents ? t : r : n, 'click'), To.sendDoneLog(this.allConsents, e.euconsent, e.nonIabCookieValue), Po.coreConfig.isAMP && window.parent.postMessage({ + type: It.CONSENT_RESPONSE, + action: void 0 !== this.allConsents ? this.allConsents ? Lt.ACCEPT : Lt.REJECT : Lt.ACCEPT, + info: e.euconsent, + consentMetadata: { additionalConsent: e.googleCookieValue } + }, '*'); + } + }, + { + key: 'populateConsents', + value: function (e, t, n, r) { + var o, i = Ct.NON_IAB, a = Ct.PURPOSES, s = Ct.LEGITIMATE_PURPOSES, c = Ct.LEGITIMATE_VENDORS, l = Ct.VENDORS, f = Ct.SPECIAL_FEATURES, p = Ct.STACKS, d = Ct.GOOGLE, h = ''; + switch (t) { + case i: + o = '_nonIabConsents', h = 'nonIabConsents'; + break; + case l: + o = '_vendorConsents', h = 'vendorConsents'; + break; + case a: + o = '_purposesConsents', h = 'purposesConsents'; + break; + case s: + o = '_legitimatePurposesConsents', h = 'legitimatePurposesConsents'; + break; + case c: + o = '_vendorLegitimateInterest', h = 'vendorLegitimateInterest'; + break; + case f: + o = '_specialFeaturesConsents', h = 'specialFeatures'; + break; + case p: + o = '_stacksConsents', h = 'purposesConsents'; + break; + case d: + o = '_googleConsents', h = 'googleConsents'; + break; + default: + o = ''; + } + var m = r[h].hasCookie, g = t === s || t === c || 'on' === Po.coreConfig.defaultToggleValue, v = !m || t === p; + if (t === i) { + if (n) { + var y, b = u(n); + try { + for (b.s(); !(y = b.n()).done;) { + var E = y.value; + if (e) { + var w = v ? g : r[h][E.id]; + this[o][E.id] = Boolean(w), E.status = Boolean(w); + } else + E.status = this[o][E.id]; + } + } catch (O) { + b.e(O); + } finally { + b.f(); + } + } + } else if (t === d) { + if (n) { + var x, S = u(n); + try { + for (S.s(); !(x = S.n()).done;) { + var C = x.value, k = parseInt(C.id, 10); + if (e) { + var T = v ? g : r[h][k]; + this[o][k] = T, C.status = T; + } else + C.status = this[o][k]; + } + } catch (O) { + S.e(O); + } finally { + S.f(); + } + } + } else { + for (var _ in n) + if (e) { + var P = v ? g : r[h][_]; + this[o][_] = P, n[_].status = P; + } else + n[_].status = this[o][_]; + t === p && m && this.updateStacksConsent(); + } + } + }, + { + key: 'handleConsent', + value: function (e, t) { + var n, r, o, i, a = xt.VENDOR, s = xt.PURPOSE, c = xt.LEGITIMATE_PURPOSE, u = xt.NON_IAB_VENDOR, l = xt.SPECIAL_FEATURE, f = xt.STACK, p = xt.LEGITIMATE_VENDOR, d = xt.GOOGLE, h = !1; + switch (t) { + case Ct.NON_IAB: + n = '_nonIabConsents', i = Lo, r = ''.concat(u, '_').concat(e); + break; + case Ct.VENDORS: + n = '_vendorConsents', o = 'vendors', r = ''.concat(a, '_').concat(e); + break; + case Ct.PURPOSES: + n = '_purposesConsents', o = 'purposes', r = ''.concat(s, '_').concat(e), h = !0; + break; + case Ct.LEGITIMATE_PURPOSES: + n = '_legitimatePurposesConsents', o = 'legitimatePurposes', r = ''.concat(c, '_').concat(e); + break; + case Ct.LEGITIMATE_VENDORS: + n = '_vendorLegitimateInterest', o = 'legitimateVendors', r = ''.concat(p, '_').concat(e); + break; + case Ct.SPECIAL_FEATURES: + n = '_specialFeaturesConsents', o = 'specialFeatures', r = ''.concat(l, '_').concat(e), h = !0; + break; + case Ct.SPECIAL_PURPOSES: + n = '_specialPurposesConsents', o = 'specialPurposes', r = ''.concat(l, '_').concat(e); + break; + case Ct.STACKS: + n = '_stacksConsents', o = 'stacks', r = ''.concat(f, '_').concat(e), h = !0, this.handleStackConsent(e); + break; + case Ct.GOOGLE: + n = '_googleConsents', i = Ao, r = ''.concat(d, '_').concat(e); + break; + default: + n = ''; + } + if (this[n]) { + var m = !this[n][e]; + if (i) + mt(i.filter(function (t) { + return t.id === e; + }), 1)[0].status = m; + else + this._cmpInfo.updateStatus(e, o, m); + this[n][e] = m, this.eventTracker(r, this[n][e]); + } + Object.keys(this._cmpInfo.data.stacks).length && h && this.populateStacksLabels(this._cmpInfo.data.stacks); + } + }, + { + key: 'linkVendorsToPurposes', + value: function () { + var e = this, t = Oo.vendors, n = Object.keys(this._purposesConsents).filter(function (t) { + return !0 === e._purposesConsents[t]; + }), r = function (r) { + n.forEach(function (n) { + t[r].purposes.includes(parseInt(n, 10)) && (e._vendorConsents[r] = !0); + }); + }; + for (var o in t) + this._vendorConsents[o] = !1, n.length && r(o); + } + }, + { + key: 'linkPurposesToVendors', + value: function () { + var e = this, t = Oo.vendors, n = Object.keys(this._vendorConsents).filter(function (t) { + return !0 === e._vendorConsents[t]; + }), r = Object.keys(this._purposesConsents).filter(function (t) { + return !0 === e._purposesConsents[t]; + }); + n.length ? r.length || n.forEach(function (n) { + t[n].purposes.forEach(function (r) { + t[n].purposes.includes(r) && (e._purposesConsents[r] = !0); + }); + }) : function () { + for (var t in e._purposesConsents) + e._purposesConsents[t] = !1; + }(); + } + }, + { + key: 'linkConsents', + value: function (e) { + switch (e) { + case '_purposesConsents': + case '_stacksConsents': + this.linkVendorsToPurposes(); + break; + case '_vendorConsents': + this.linkPurposesToVendors(); + } + } + }, + { + key: 'handleStackConsent', + value: function (e) { + var t, n = Oo.stacks[e], r = !this._stacksConsents[e], o = u(n.purposes); + try { + for (o.s(); !(t = o.n()).done;) { + var i = t.value; + this._purposesConsents[i] = r, this._cmpInfo.updateStatus(i, 'purposes', r); + } + } catch (l) { + o.e(l); + } finally { + o.f(); + } + if (n.specialFeatures) { + var a, s = u(n.specialFeatures); + try { + for (s.s(); !(a = s.n()).done;) { + var c = a.value; + this._specialFeaturesConsents[c] = r, this._cmpInfo.updateStatus(c, 'specialFeatures', r); + } + } catch (l) { + s.e(l); + } finally { + s.f(); + } + } + } + }, + { + key: 'updateStacksConsent', + value: function () { + var e = this; + for (var t in this._cmpInfo.data.stacks) { + var n = this._cmpInfo.data.stacks[t], r = n.purposes.reduce(function (t, n) { + return t && e._purposesConsents[n]; + }, !0), o = !n.specialFeaturesConsents || n.specialFeatures.reduce(function (t, n) { + return t && e._specialFeaturesConsents[n]; + }, !0); + n.status = r && o, this._stacksConsents[t] = n.status; + } + } + }, + { + key: 'formatConsents', + value: function (e) { + var t = 0; + return { + consentArray: Object.keys(e).map(function (n) { + var r = parseInt(n); + return t = r, { + consent: e[r], + id: +n + }; + }), + maxVendorId: t + }; + } + }, + { + key: 'displayConsentUi', + value: function (e) { + var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; + 'GDPR' === e ? (this.displayType = n ? St.MANDATORY : St.CHANGE_OF_CONSENT, Qo.dispatch($o({ + page: t, + onInit: !0 + }))) : 'USP' === e && (this.displayType = St.CCPA, t = 1), Qo.dispatch(Wo({ + regulation: e, + isMandatory: n + })), this.generateSessionId(e), this.eventTracker(xt.START_ON_PAGE, ''.concat(e, '_').concat(t)), To.sendInitLog(); + } + }, + { + key: 'generateSessionId', + value: function (e) { + var t = window.navigator.userAgent.indexOf('Trident/'), n = new Int32Array(4), r = ''.concat(e, '-'); + try { + n = (-1 !== t ? msCrypto : crypto).getRandomValues(n); + for (var o = 0; o < 4; o++) + r += n[o].toString(36).substring(1, 6); + } catch (i) { + } + this.sessionId = r; + } + }, + { + key: 'getSessionId', + value: function () { + return this.sessionId; + } + }, + { + key: 'eventTracker', + value: function (e, t) { + To.pushEvent(e, t); + } + }, + { + key: 'nonIabConsents', + get: function () { + return this._nonIabConsents; + }, + set: function (e) { + this._nonIabConsents = e; + } + }, + { + key: 'vendorConsents', + get: function () { + return this._vendorConsents; + }, + set: function (e) { + this._vendorConsents = e; + } + }, + { + key: 'purposesConsents', + get: function () { + return this._purposesConsents; + }, + set: function (e) { + this._purposesConsents = e; + } + }, + { + key: 'legitimatePurposesConsents', + get: function () { + return this._legitimatePurposesConsents; + }, + set: function (e) { + this._legitimatePurposesConsents = e; + } + }, + { + key: 'vendorLegitimateInterest', + get: function () { + return this._vendorLegitimateInterest; + }, + set: function (e) { + this._vendorLegitimateInterest = e; + } + }, + { + key: 'stacksConsents', + get: function () { + return this._stacksConsents; + }, + set: function (e) { + this._stacksConsents = e; + } + }, + { + key: 'specialFeaturesConsents', + get: function () { + return this._specialFeaturesConsents; + }, + set: function (e) { + this._specialFeaturesConsents = e; + } + }, + { + key: 'GVLVendorsDataInitialized', + get: function () { + return this._GVLVendorsDataInitialized; + } + }, + { + key: 'cmpInfo', + get: function () { + return this._cmpInfo; + }, + set: function (e) { + this._cmpInfo = e; + } + } + ], [{ + key: 'initLabels', + value: function () { + var e = $e(He.a.mark(function e() { + var t, r, o, i; + return He.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + t = Po.getCustomCoreUiLabels(), r = Po.getCustomPremiumUiLabels(), o = n(298), (i = Po.coreConfig.privacyMode) && i.includes('GDPR') && (Po.coreUiLabels = m(m({}, o.coreUiLabels), t)), Po.premiumUiLabels = m(m({}, o.premiumUiLabels), r); + case 6: + case 'end': + return e.stop(); + } + }, e); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }]), e; + }(), jo = Yn.a.create({ xsrfCookieName: null }), qo = parseInt(''.concat('23')), Fo = [ + 0, + 1, + 2, + 3 + ], Do = Number.isNaN(qo) ? 1 : qo, Mo = { + VENDOR_CONSENT: 'cmpconsent', + NONIABVENDOR_CONSENT: 'cmpnoniab', + REPROMPT_HASH: 'cmpreprompthash' + }, Uo = (m(m({}, Mo), {}, { + QUANTCAST_ACCOUNT_ID: 'cmpaccountid', + REFERRER: 'ref' + }), m(m({}, Mo), {}, { + DISPLAY_UI: 'displayconsentui', + LOGGED_IN: 'cmploggedin' + }), function () { + function e() { + l(this, e), this.userEvents = void 0, this.userEvents = []; + } + return p(e, [ + { + key: 'pushEvent', + value: function (e, t) { + oo(JSON.stringify({ + identifier: e, + value: t + })), this.userEvents.push({ + clientTimestamp: new Date().getTime(), + event: ''.concat(e, ':').concat(t) + }); + } + }, + { + key: 'resolveAcceptanceState', + value: function (e) { + var t = _t.ACCEPT_ALL, n = _t.ACCEPT_PARTIAL, r = _t.REJECT, o = Pt.ALL_OBJECTED, i = Pt.NONE_OBJECTED, a = 'legitimate' === e, s = a ? [ + Object.values(ko.legitimatePurposesConsents), + Object.values(ko.vendorLegitimateInterest) + ].flat() : [ + Object.values(ko.purposesConsents), + Object.values(ko.specialFeaturesConsents), + Object.values(ko.vendorConsents), + Object.values(ko.nonIabConsents) + ].flat(); + return s.every(function (e) { + return !0 === e; + }) ? a ? i : t : s.every(function (e) { + return !1 === e; + }) ? a ? o : r : n; + } + }, + { + key: 'sendInitLog', + value: function () { + var e = Po.coreConfig, t = e.quantcastAccountId, n = e.publisherName, r = e.hashCode, o = { + accountId: t, + domain: window.location.host, + publisher: n, + cmpId: 10, + cmpVersion: '2.'.concat(Do), + displayType: ko.getDisplayType(), + configurationHashCode: r + }; + this.log(Tt.INIT, o); + } + }, + { + key: 'sendNavigationLog', + value: function () { + var e = { userEvents: this.userEvents }; + this.userEvents = [], this.log(Tt.NAVIGATION, e); + } + }, + { + key: 'sendDoneLog', + value: function (e, t, n, r) { + var o = e ? _t.ACCEPT_ALL : this.resolveAcceptanceState(), i = e ? Pt.NONE_OBJECTED : this.resolveAcceptanceState('legitimate'), a = { + userEvents: this.userEvents, + acceptanceState: o, + objectionState: i, + tcData: t, + nonIabConsentData: n, + uspData: r + }; + this.userEvents = [], this.log(Tt.DONE, a); + } + }, + { + key: 'sendDoneLogUsp', + value: function (e, t) { + var n = { + userEvents: this.userEvents, + acceptanceState: e, + uspData: t + }; + this.userEvents = [], this.log(Tt.DONE, n); + } + }, + { + key: 'log', + value: function (e, t) { + t = m(m({}, t), {}, { + clientTimestamp: new Date().getTime(), + operationType: e, + sessionId: ko.getSessionId() + }); + var n = encodeURIComponent(JSON.stringify(t)); + jo.get(''.concat('https://audit-tcfv2.quantcast.mgr.consensu.org', '/?log=').concat(n)).catch(function (e) { + return console.error(e); + }), oo(''.concat(e, ' sent')); + } + } + ]), e; + }()), Vo = /^#([\dA-F]{6}|[\dA-F]{3})$/i, Bo = function () { + function e() { + l(this, e), this._uxPrimaryButtonTextColor = void 0, this._uxPrimaryButtonColor = void 0, this._uxSecondaryButtonTextColor = void 0, this._uxSecondaryButtonColor = void 0, this._uxFontColor = void 0, this._uxBackgroundColor = void 0, this._uxToogleActiveColor = void 0, this._uxLinkColor = void 0, this._primaryButtonHoverBackground = void 0, this._secondaryButtonHoverBackground = void 0, this._secondaryTextColor = void 0, this._lightTextColor = void 0, this._lightestTextColor = void 0, this._overlayColor = void 0, this._borderColor = void 0, this._subHeaderColor = void 0, this._persistentConsentLinkColor = void 0, this._persistentConsentLinkTextColor = void 0, this._warningBackgroundColor = void 0, this._warningTextColor = void 0, this._font = void 0; + var t = Po.theme, n = t.uxPrimaryButtonColor, r = t.uxBackgroundColor, o = t.uxFontColor, i = t.uxPrimaryButtonTextColor, a = t.uxSecondaryButtonColor, s = t.uxSecondaryButtonTextColor, c = t.uxToogleActiveColor, u = t.uxLinkColor; + this._uxPrimaryButtonTextColor = i, this._uxPrimaryButtonColor = n, this._uxSecondaryButtonTextColor = s, this._uxSecondaryButtonColor = a, this._uxFontColor = o, this._uxBackgroundColor = r, this._uxToogleActiveColor = c, this._uxLinkColor = u, this._primaryButtonHoverBackground = Pn(0.3, this._uxPrimaryButtonColor), this._secondaryButtonHoverBackground = n, this._subHeaderColor = '#212934', this._secondaryTextColor = '#4D545D', this._lightTextColor = '#7A7F85', this._lightestTextColor = '#B7B7B7', this._overlayColor = 'rgba(33, 41, 52, 0.75)', this._borderColor = '#D8D8D8', this._persistentConsentLinkColor = '#368BD6', this._persistentConsentLinkTextColor = '#FFF', this._warningBackgroundColor = 'rgba(255, 229, 143, 0.35)', this._warningTextColor = '#FAAD14', this._font = 'Helvetica, Arial, sans-serif'; + } + return p(e, [ + { + key: 'checkValidHex', + value: function (e, t) { + Vo.test(e) ? this[t] = e : console.warn(''.concat(e, ' is not a valid hex value')); + } + }, + { + key: 'uxLinkColor', + get: function () { + return this._uxLinkColor; + }, + set: function (e) { + this.checkValidHex(e, '_uxLinkColor'); + } + }, + { + key: 'uxToogleActiveColor', + get: function () { + return this._uxToogleActiveColor; + }, + set: function (e) { + this.checkValidHex(e, '_uxToogleActiveColor'); + } + }, + { + key: 'uxPrimaryButtonTextColor', + get: function () { + return this._uxPrimaryButtonTextColor; + }, + set: function (e) { + this.checkValidHex(e, '_uxPrimaryButtonTextColor'); + } + }, + { + key: 'uxPrimaryButtonColor', + get: function () { + return this._uxPrimaryButtonColor; + }, + set: function (e) { + this.checkValidHex(e, '_uxPrimaryButtonColor'); + } + }, + { + key: 'primaryButtonHoverBackground', + get: function () { + return this._primaryButtonHoverBackground; + }, + set: function (e) { + this.checkValidHex(e, '_primaryButtonHoverBackground'); + } + }, + { + key: 'uxSecondaryButtonTextColor', + get: function () { + return this._uxSecondaryButtonTextColor; + }, + set: function (e) { + this.checkValidHex(e, '_uxSecondaryButtonTextColor'); + } + }, + { + key: 'uxSecondaryButtonColor', + get: function () { + return this._uxSecondaryButtonColor; + }, + set: function (e) { + this.checkValidHex(e, '_uxSecondaryButtonColor'); + } + }, + { + key: 'secondaryButtonHoverBackground', + get: function () { + return this._secondaryButtonHoverBackground; + }, + set: function (e) { + this.checkValidHex(e, '_secondaryButtonHoverBackground'); + } + }, + { + key: 'uxFontColor', + get: function () { + return this._uxFontColor; + }, + set: function (e) { + this.checkValidHex(e, '_uxFontColor'); + } + }, + { + key: 'secondaryTextColor', + get: function () { + return this._secondaryTextColor; + }, + set: function (e) { + this.checkValidHex(e, '_secondaryTextColor'); + } + }, + { + key: 'lightTextColor', + get: function () { + return this._lightTextColor; + }, + set: function (e) { + this.checkValidHex(e, '_lightTextColor'); + } + }, + { + key: 'lightestTextColor', + get: function () { + return this._lightestTextColor; + }, + set: function (e) { + this.checkValidHex(e, '_lightestTextColor'); + } + }, + { + key: 'uxBackgroundColor', + get: function () { + return this._uxBackgroundColor; + }, + set: function (e) { + this.checkValidHex(e, '_uxBackgroundColor'); + } + }, + { + key: 'overlayColor', + get: function () { + return this._overlayColor; + }, + set: function (e) { + this._overlayColor = e; + } + }, + { + key: 'borderColor', + get: function () { + return this._borderColor; + }, + set: function (e) { + this.checkValidHex(e, '_borderColor'); + } + }, + { + key: 'subHeaderColor', + get: function () { + return this._subHeaderColor; + }, + set: function (e) { + this.checkValidHex(e, '_subHeaderColor'); + } + }, + { + key: 'warningBackgroundColor', + get: function () { + return this._warningBackgroundColor; + }, + set: function (e) { + this._warningBackgroundColor = e; + } + }, + { + key: 'warningTextColor', + get: function () { + return this._warningTextColor; + }, + set: function (e) { + this.checkValidHex(e, '_warningTextColor'); + } + }, + { + key: 'persistentConsentLinkColor', + get: function () { + return this._persistentConsentLinkColor; + }, + set: function (e) { + this.checkValidHex(e, '_persistentConsentLinkColor'); + } + }, + { + key: 'persistentConsentLinkTextColor', + get: function () { + return this._persistentConsentLinkTextColor; + }, + set: function (e) { + this.checkValidHex(e, '_persistentConsentLinkTextColor'); + } + }, + { + key: 'font', + get: function () { + return this._font; + }, + set: function (e) { + this._font = e; + } + } + ]), e; + }(), zo = function (e) { + Po = e.config, Oo = e.gvl, Io = e.consentInfo, Lo = e.nonIabVendorList, Ao = e.googleData; + var t = e.regulation, n = e.page, r = function () { + var e = $e(He.a.mark(function e() { + return He.a.wrap(function (e) { + for (;;) + switch (e.prev = e.next) { + case 0: + return e.next = 2, No.initLabels(); + case 2: + return e.next = 4, new No(); + case 4: + ko = e.sent; + case 5: + case 'end': + return e.stop(); + } + }, e); + })); + return function () { + return e.apply(this, arguments); + }; + }(); + To = new Uo(), _o = new Bo(); + var o = function () { + var e = 'qc-cmp2-container'; + return So('div', e, e, document.body); + }(), i = 'qc-cmp2-main', a = So('div', i, i, o); + r().then(function () { + ko.displayConsentUi(t, n, e.isMandatory), Je.a.render(Qe.a.createElement(rt, { store: Qo }, Qe.a.createElement(wo, { + ui: ko, + mode: t + })), a); + }); + }, Go = function (e) { + var t = e.name, n = e.initialState; + if (!t) + throw new Error('`name` is a required option for createSlice'); + var r = e.reducers || {}, o = 'undefined' === typeof e.extraReducers ? [] : 'function' === typeof e.extraReducers ? ze(e.extraReducers) : [e.extraReducers], i = o[0], a = void 0 === i ? {} : i, s = o[1], c = void 0 === s ? [] : s, u = o[2], l = void 0 === u ? void 0 : u, f = Object.keys(r), p = {}, d = {}, h = {}; + f.forEach(function (e) { + var n, o, i = r[e], a = t + '/' + e; + 'reducer' in i ? (n = i.reducer, o = i.prepare) : n = i, p[e] = n, d[a] = n, h[e] = o ? Be(a, o) : Be(a); + }); + var m = function (e, t, n, r) { + void 0 === n && (n = []); + var o = 'function' === typeof t ? ze(t) : [ + t, + n, + r + ], i = o[0], a = o[1], s = o[2]; + return function (t, n) { + void 0 === t && (t = e); + var r = [i[n.type]].concat(a.filter(function (e) { + return (0, e.matcher)(n); + }).map(function (e) { + return e.reducer; + })); + return 0 === r.filter(function (e) { + return !!e; + }).length && (r = [s]), r.reduce(function (e, t) { + if (t) { + if (v(e)) { + var r = t(e, n); + return 'undefined' === typeof r ? e : r; + } + if (y(e)) + return de(e, function (e) { + return t(e, n); + }); + var o = t(e, n); + if ('undefined' === typeof o) + throw Error('A case reducer on a non-draftable value must not return undefined'); + return o; + } + return e; + }, t); + }; + }(n, Ae({}, a, {}, d), c, l); + return { + name: t, + reducer: m, + actions: h, + caseReducers: p + }; + }({ + name: 'app', + initialState: { + displayGDPR: !1, + displayUSP: !1, + pageChanged: !1, + pageGDPR: 1, + disableAcceptButton: !1, + changed: '' + }, + reducers: { + toggleDisplay: function (e, t) { + var n = t.payload, r = n.regulation, o = n.isMandatory, i = !1, a = !1, s = !1; + switch (r) { + case 'USP': + a && (a = !1), i = !e.displayUSP; + break; + case 'GDPR': + i && (i = !1), s = !!o && !e.pageChanged, a = !e.displayGDPR; + break; + default: + return e; + } + return m(m({}, e), {}, { + displayGDPR: a, + displayUSP: i, + disableAcceptButton: s + }); + }, + changePage: function (e, t) { + var n = t.payload.page; + t.payload.onInit || (ko.eventTracker(xt.GO_TO_PAGE, n), To.sendNavigationLog()); + var r = 1 !== n || n !== e.pageGDPR; + return m(m({}, e), {}, { + pageGDPR: n, + pageChanged: r, + disableAcceptButton: !r + }); + }, + toggleChange: function (e, t) { + var n = t.payload; + return m(m({}, e), {}, { changed: n }); + } + } + }), Ho = Go.actions, Wo = Ho.toggleDisplay, $o = Ho.changePage, Yo = Ho.toggleChange, Qo = (Go.reducer, function (e) { + var t, n = Ve(), r = e || {}, o = r.reducer, i = void 0 === o ? void 0 : o, a = r.middleware, s = void 0 === a ? n() : a, c = r.devTools, u = void 0 === c || c, l = r.preloadedState, f = void 0 === l ? void 0 : l, p = r.enhancers, d = void 0 === p ? void 0 : p; + if ('function' === typeof i) + t = i; + else { + if (!Me(i)) + throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers'); + t = Ee(i); + } + var h = ke.apply(void 0, 'function' === typeof s ? s(n) : s), m = Ce; + u && (m = De(Ae({ trace: !1 }, 'object' === typeof u && u))); + var g = [h]; + return Array.isArray(d) ? g = [h].concat(d) : 'function' === typeof d && (g = d(g)), ye(t, f, m.apply(void 0, g)); + }({ reducer: Ee({ app: Go.reducer }) })), Ko = new (function () { + function e() { + var t = this; + l(this, e), this.__tcfapiui = void 0, this.goToPage = function (e) { + Fo.includes(e) ? Qo.dispatch($o({ + page: e, + onInit: !1 + })) : console.warn(''.concat(e, ' is not a supported page')); + }, this.initApiUi = function () { + var e = t.__tcfapiui, n = [], r = window; + r.__tcfapiui && r.__tcfapiui.a && (n = r.__tcfapiui.a), Object.assign(window, { __tcfapiui: e }); + var l, f, p = u(n); + try { + for (p.s(); !(l = p.n()).done;) { + var d = l.value, h = s(f = d) || o(f) || i(f) || c(), m = h[0], g = h.slice(1); + t[m].apply(t, a(g)); + } + } catch (v) { + p.e(v); + } finally { + p.f(); + } + }, this.__tcfapiui = function (e) { + try { + for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++) + r[o - 1] = arguments[o]; + t[e].apply(t, r); + } catch (i) { + console.error('The function '.concat(e, ' is not defined')); + } + }; + } + return p(e, [{ + key: 'displayUi', + value: function (e) { + zo(e); + } + }]), e; + }())(); + Ko.initApiUi(); + } + ]); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-d46a0542506f49cf865d98cb5ffd6c7a7854adb7 b/resources/sugarcoat-d46a0542506f49cf865d98cb5ffd6c7a7854adb7 new file mode 100644 index 00000000..6cd1a476 --- /dev/null +++ b/resources/sugarcoat-d46a0542506f49cf865d98cb5ffd6c7a7854adb7 @@ -0,0 +1,10386 @@ +var _satellite; +{ + const $___mock_00a2ebef713bb5ea = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_00a2ebef713bb5ea); + const $___mock_53ae6ebfdece7690 = {}; + (exports => { + 'use strict'; + let isSealed = false; + class Storage { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + } + get length() { + return Object.keys(this).length; + } + key(index) { + const keys = Object.keys(this); + if (index < 0 || index >= keys.length) { + return null; + } + return keys[index]; + } + getItem(key) { + return Object.prototype.hasOwnProperty.call(this, key) ? this[key] : null; + } + setItem(key, value) { + this[key] = String(value); + } + removeItem(key) { + delete this[key]; + } + clear() { + const keys = Object.keys(this); + for (const key of keys) { + delete this[key]; + } + } + } + exports.Storage = { + configurable: true, + enumerable: true, + value: Storage, + writable: true + }; + const localStorage = new Storage(); + exports.localStorage = { + configurable: true, + enumerable: true, + get() { + return localStorage; + } + }; + const sessionStorage = new Storage(); + exports.sessionStorage = { + configurable: true, + enumerable: true, + get() { + return sessionStorage; + } + }; + isSealed = true; + })($___mock_53ae6ebfdece7690); + (function () { + window._satellite = window._satellite || {}, window._satellite.container = { + buildInfo: { + minified: !0, + buildDate: '2021-12-20T20:31:12Z', + turbineBuildDate: '2021-08-11T20:25:49Z', + turbineVersion: '27.2.0' + }, + environment: { + id: 'ENb97d7f9d2d4b4720ac9782a711994995', + stage: 'production' + }, + dataElements: { + 'event:jobCategory': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.jobCategory' } + }, + 'Opt Out: Beamery Conversation ID': { + defaultValue: '', + storageDuration: 'session', + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'cn', + caseInsensitive: !0 + } + }, + 'content:LinkName': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return digitalData.eventData.linkType + '|' + digitalData.eventData.linkName; + } + } + }, + CMPID: { + defaultValue: '', + forceLowerCase: !0, + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'CMPID', + caseInsensitive: !0 + } + }, + 'jobApplication:applicationId': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.application_id' } + }, + 'SMS:SiteError ': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.errorMessage' } + }, + 'SMS assessmentRequired': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.assessmentRequired' } + }, + 'content: SubSectionLevel1': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.pageLevel1' } + }, + 'jobDescription: relatedJobImpressions': { + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.relatedJobImpressions' } + }, + 'Form: FormErrors': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.formErrors' } + }, + 'jobDescription:hiringYear': { + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.hiring_year' } + }, + 'content:peopleSoftId': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.peopleSoftId' } + }, + 'JobSearch:SortBy': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.sortBy' } + }, + 'JobSearch:FilterBy': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return digitalData.eventData.filterType + '|' + digitalData.eventData.filterName; + } + } + }, + 'jobDescription:subCategory': { + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.subCategory' } + }, + 'jobDescription:jobCountry': { + defaultValue: 'No Job Country Found', + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.country' } + }, + 'jobApplication:resumeType': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.resumeSource' } + }, + 'jobDescription:jobName': { + defaultValue: 'No Job Name Found', + cleanText: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + if (digitalData && digitalData.job && digitalData.job.title) + return digitalData.job.title; + } + } + }, + relatedJobId: { + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.relatedJobId' } + }, + 'Form : formIndex': { + defaultValue: '', + cleanText: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.form_index' } + }, + 'jobDescription:jobFindingMethod': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.jobFindingMethod' } + }, + campaign: { + defaultValue: '', + forceLowerCase: !0, + cleanText: !0, + storageDuration: 'session', + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'utm_campaign', + caseInsensitive: !0 + } + }, + 'content:userID': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.userID' } + }, + 'PhoneNumber Match': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.phoneNumberMatch' } + }, + 'Marketing: SocialPlatform': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.socialPlatform' } + }, + 'UTM User': { + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'utm_user', + caseInsensitive: !0 + } + }, + 'content:userActionStore': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.userActionStoreId' } + }, + 'eventData:jobId': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.jobId' } + }, + 'Phone Number Added': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.phoneNumberAdded' } + }, + 'banner:destinURL': { + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return bannerAA = document.querySelector('div[data-react-class="HomepageCampaignBanner"]'), !!bannerAA && (bannerAAprops = JSON.parse(bannerAA.getAttribute('data-react-props')), bannerAAlink = bannerAAprops.button_link, !!getQueryParameters(bannerAAlink) && bannerAAlink); + } + } + }, + 'JobSearch:SearchTerm': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.search.keywordQuery' } + }, + 'eventData:peopleSoftId': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.peoplesoftId' } + }, + successConfirmation: { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + if (document.location.href.indexOf('summary?result=success') > 0) + return !0; + } + } + }, + 'SMS - Option Selected': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.option' } + }, + 'JobSearch: SearchSelection': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.searchSelection' } + }, + CCUID: { + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'ccuid', + caseInsensitive: !0 + } + }, + 'content:SiteSection': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.siteSection' } + }, + 'content:SiteError': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.siteError' } + }, + 'jobDescription:jobBusinessPurpose': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.businessPurpose' } + }, + 'content:userType': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.userType' } + }, + 'event:jobCountry': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.jobCountry' } + }, + passportEventParams: { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventParams' } + }, + 'User Status': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.userStatus' } + }, + 'Opt Out: System': { + defaultValue: '', + storageDuration: 'session', + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'sy', + caseInsensitive: !0 + } + }, + 'content:CountryLanguage': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + return digitalData.page.pageInfo.countryLanguage; + } + } + }, + intcmpid: { + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'intcmpid', + caseInsensitive: !0 + } + }, + 'Phone Number Verified': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.phoneNumberVerified' } + }, + 'Opt Out: Source': { + defaultValue: '', + storageDuration: 'session', + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'so', + caseInsensitive: !0 + } + }, + 'JobSearch:SearchPosition': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.searchPosition' } + }, + DCLID: { + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'dclid', + caseInsensitive: !0 + } + }, + 'jobDescription:jobID': { + defaultValue: 'No Job ID Found', + cleanText: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/customCode.js', + settings: { + source: function () { + if (digitalData && digitalData.job && digitalData.job.id) + return digitalData.job.id; + } + } + }, + 'jobDescription:jobCategory': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.category' } + }, + 'event:jobDivision': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.jobDivision' } + }, + 'content:PageName': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.pageName' } + }, + 'PhoneNumber CountryCode': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.phoneNumberCountryCode' } + }, + 'Form:FormErrors': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.formErrors' } + }, + 'User Auth Mode': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.userAuthMode' } + }, + 'Job Role': { + defaultValue: 'No Job Role Found', + cleanText: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.job_role' } + }, + 'content: SubSectionLevel2': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.pageLevel2' } + }, + 'content:PageType': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.pageType' } + }, + 'jobDescription:jobShareSocialMedia': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.socialMedia' } + }, + 'Page URL': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'window.location.href' } + }, + 'JobSearch:NoOfResults': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.search.noOfResults' } + }, + 'SMS:Stepname': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.stepName' } + }, + 'jobDescription:jobType': { + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.type' } + }, + 'content:personID': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.personId' } + }, + 'SMS OptedIn': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.smsOptedIn' } + }, + 'Form : formTitle': { + defaultValue: '', + cleanText: !0, + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.form_title' } + }, + 'event:jobID': { + defaultValue: '', + storageDuration: 'pageview', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.jobID' } + }, + 'jobDescription:jobLocation': { + cleanText: !0, + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.location' } + }, + 'Form: FormName': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.formName' } + }, + 'Sms Visible': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.smsVisible' } + }, + 'Opt Out: Beamery Campaign ID': { + defaultValue: '', + storageDuration: 'session', + modulePath: 'core/src/lib/dataElements/queryStringParameter.js', + settings: { + name: 'ca', + caseInsensitive: !0 + } + }, + 'SMS - Event - smsOptedIn': { + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.smsOptedIn' } + }, + 'content: SubSectionLevel3': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.page.pageInfo.pageLevel3' } + }, + 'event:jobName': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.eventData.jobName' } + }, + 'jobDescription:jobDivision': { + defaultValue: '', + modulePath: 'core/src/lib/dataElements/javascriptVariable.js', + settings: { path: 'digitalData.job.division' } + } + }, + extensions: { + core: { + displayName: 'Core', + hostedLibFilesBaseUrl: 'https://assets.adobedtm.com/extensions/EPdf95439ac27745eea50d3c75fd6ed235/', + modules: { + 'core/src/lib/dataElements/javascriptVariable.js': { + name: 'javascript-variable', + displayName: 'JavaScript Variable', + script: function (e, t, n) { + 'use strict'; + var a = n('../helpers/getObjectProperty.js'); + e.exports = function (e) { + return a(window, e.path); + }; + } + }, + 'core/src/lib/dataElements/queryStringParameter.js': { + name: 'query-string-parameter', + displayName: 'Query String Parameter', + script: function (e, t, n) { + 'use strict'; + var a = n('@adobe/reactor-window'), i = n('@adobe/reactor-query-string'); + e.exports = function (e) { + var t = i.parse(a.location.search); + if (!e.caseInsensitive) + return t[e.name]; + for (var n = e.name.toLowerCase(), r = Object.keys(t), s = 0; s < r.length; s++) { + var o = r[s]; + if (o.toLowerCase() === n) + return t[o]; + } + }; + } + }, + 'core/src/lib/dataElements/customCode.js': { + name: 'custom-code', + displayName: 'Custom Code', + script: function (e) { + 'use strict'; + e.exports = function (e, t) { + return e.source(t); + }; + } + }, + 'core/src/lib/events/directCall.js': { + name: 'direct-call', + displayName: 'Direct Call', + script: function (e, t, n, a) { + 'use strict'; + var i = {}; + window._satellite = window._satellite || {}, window._satellite.track = function (e, t) { + e = e.trim(); + var n = i[e]; + if (n) { + var r = { + identifier: e, + detail: t + }; + n.forEach(function (e) { + e(r); + }); + var s = ['Rules using the direct call event type with identifier "' + e + '" have been triggered' + (t ? ' with additional detail:' : '.')]; + t && s.push(t), a.logger.log.apply(a.logger, s); + } else + a.logger.log('"' + e + '" does not match any direct call identifiers.'); + }, e.exports = function (e, t) { + var n = i[e.identifier]; + n || (n = i[e.identifier] = []), n.push(t); + }; + } + }, + 'core/src/lib/conditions/customCode.js': { + name: 'custom-code', + displayName: 'Custom Code', + script: function (e) { + 'use strict'; + e.exports = function (e, t) { + return e.source.call(t.element, t, t.target); + }; + } + }, + 'core/src/lib/events/pageBottom.js': { + name: 'page-bottom', + displayName: 'Page Bottom', + script: function (e, t, n) { + 'use strict'; + var a = n('./helpers/pageLifecycleEvents'); + e.exports = function (e, t) { + a.registerPageBottomTrigger(t); + }; + } + }, + 'core/src/lib/actions/customCode.js': { + name: 'custom-code', + displayName: 'Custom Code', + script: function (e, t, n, a) { + 'use strict'; + var i, r, s, o, c = n('@adobe/reactor-document'), l = n('@adobe/reactor-promise'), u = n('./helpers/decorateCode'), d = n('./helpers/loadCodeSequentially'), p = n('../../../node_modules/postscribe/dist/postscribe'), f = n('./helpers/unescapeHtmlCode'), m = (r = function (e) { + p(c.body, e, { + beforeWriteToken: function (e) { + var t = e.tagName && e.tagName.toLowerCase(); + return i && 'script' === t && (e.attrs.nonce = i), 'script' !== t && 'style' !== t || (Object.keys(e.attrs || {}).forEach(function (t) { + e.attrs[t] = f(e.attrs[t]); + }), e.src && (e.src = f(e.src))), e; + }, + error: function (e) { + a.logger.error(e.msg); + } + }); + }, s = [], o = function () { + if (c.body) + for (; s.length;) + r(s.shift()); + else + setTimeout(o, 20); + }, function (e) { + s.push(e), o(); + }), g = function () { + if (c.currentScript) + return c.currentScript.async; + for (var e = c.querySelectorAll('script'), t = 0; t < e.length; t++) { + var n = e[t]; + if (/(launch|satelliteLib)-[^\/]+.js(\?.*)?$/.test(n.src)) + return n.async; + } + return !0; + }(); + e.exports = function (e, t) { + var n; + i = a.getExtensionSettings().cspNonce; + var r = { + settings: e, + event: t + }, s = r.settings.source; + if (s) + return r.settings.isExternal ? d(s).then(function (e) { + return e ? (n = u(r, e), m(n.code), n.promise) : l.resolve(); + }) : (n = u(r, s), g || 'loading' !== c.readyState ? m(n.code) : c.write && !1 === a.propertySettings.ruleComponentSequencingEnabled ? c.write(n.code) : m(n.code), n.promise); + }; + } + }, + 'core/src/lib/events/click.js': { + name: 'click', + displayName: 'Click', + script: function (e, t, n) { + 'use strict'; + var a = n('@adobe/reactor-window'), i = n('./helpers/createBubbly')(), r = new (n('./helpers/weakMap'))(), s = function (e) { + for (; e;) { + var t = e.tagName; + if (t && 'a' === t.toLowerCase()) { + var n = e.getAttribute('href'), i = e.getAttribute('target'); + return n && (!i || '_self' === i || '_top' === i && a.top === a || i === a.name) ? e : void 0; + } + e = e.parentNode; + } + }; + document.addEventListener('click', i.evaluateEvent, !0), e.exports = function (e, t) { + i.addListener(e, function (n) { + var i = n.nativeEvent; + if (!i.s_fe) { + if (e.anchorDelay && !r.has(i)) { + var o = s(i.target); + o && (i.preventDefault(), setTimeout(function () { + a.location = o.href; + }, e.anchorDelay)), r.set(i, !0); + } + t(n); + } + }); + }, e.exports.__reset = i.__reset; + } + }, + 'core/src/lib/conditions/valueComparison.js': { + name: 'value-comparison', + displayName: 'Value Comparison', + script: function (e) { + 'use strict'; + var t = function (e) { + return 'number' == typeof e && isFinite(e); + }, n = function (e) { + return 'string' == typeof e || e instanceof String; + }, a = function (e, t) { + return t && n(e) ? e.toLowerCase() : e; + }, i = function (e) { + return t(e) ? String(e) : e; + }, r = function (e) { + return n(e) ? Number(e) : e; + }, s = function (e) { + return function (t, a, r) { + return t = i(t), a = i(a), n(t) && n(a) && e(t, a, r); + }; + }, o = function (e) { + return function (n, a) { + return n = r(n), a = r(a), t(n) && t(a) && e(n, a); + }; + }, c = function (e) { + return function (t, n, i) { + return e(a(t, i), a(n, i)); + }; + }, l = { + equals: c(function (e, t) { + return e == t; + }), + doesNotEqual: function () { + return !l.equals.apply(null, arguments); + }, + contains: s(c(function (e, t) { + return -1 !== e.indexOf(t); + })), + doesNotContain: function () { + return !l.contains.apply(null, arguments); + }, + startsWith: s(c(function (e, t) { + return 0 === e.indexOf(t); + })), + doesNotStartWith: function () { + return !l.startsWith.apply(null, arguments); + }, + endsWith: s(c(function (e, t) { + return e.substring(e.length - t.length, e.length) === t; + })), + doesNotEndWith: function () { + return !l.endsWith.apply(null, arguments); + }, + matchesRegex: s(function (e, t, n) { + return new RegExp(t, n ? 'i' : '').test(e); + }), + doesNotMatchRegex: function () { + return !l.matchesRegex.apply(null, arguments); + }, + lessThan: o(function (e, t) { + return e < t; + }), + lessThanOrEqual: o(function (e, t) { + return e <= t; + }), + greaterThan: o(function (e, t) { + return e > t; + }), + greaterThanOrEqual: o(function (e, t) { + return e >= t; + }), + isTrue: function (e) { + return !0 === e; + }, + isTruthy: function (e) { + return Boolean(e); + }, + isFalse: function (e) { + return !1 === e; + }, + isFalsy: function (e) { + return !e; + } + }; + e.exports = function (e) { + return l[e.comparison.operator](e.leftOperand, e.rightOperand, Boolean(e.comparison.caseInsensitive)); + }; + } + }, + 'core/src/lib/conditions/subdomain.js': { + name: 'subdomain', + displayName: 'Subdomain', + script: function (e, t, n) { + 'use strict'; + var a = n('@adobe/reactor-document'), i = n('../helpers/textMatch'); + e.exports = function (e) { + var t = a.location.hostname; + return e.subdomains.some(function (e) { + var n = e.valueIsRegex ? new RegExp(e.value, 'i') : e.value; + return i(t, n); + }); + }; + } + }, + 'core/src/lib/conditions/path.js': { + name: 'path', + displayName: 'Path Without Query String', + script: function (e, t, n) { + 'use strict'; + var a = n('@adobe/reactor-document'), i = n('../helpers/textMatch'); + e.exports = function (e) { + var t = a.location.pathname; + return e.paths.some(function (e) { + var n = e.valueIsRegex ? new RegExp(e.value, 'i') : e.value; + return i(t, n); + }); + }; + } + }, + 'core/src/lib/events/libraryLoaded.js': { + name: 'library-loaded', + displayName: 'Library Loaded (Page Top)', + script: function (e, t, n) { + 'use strict'; + var a = n('./helpers/pageLifecycleEvents'); + e.exports = function (e, t) { + a.registerLibraryLoadedTrigger(t); + }; + } + }, + 'core/src/lib/conditions/domain.js': { + name: 'domain', + displayName: 'Domain', + script: function (e, t, n) { + 'use strict'; + var a = n('@adobe/reactor-document'), i = /[|\\{}()[\]^$+*?.-]/g, r = function (e) { + if ('string' != typeof e) + throw new TypeError('Expected a string'); + return e.replace(i, '\\$&'); + }; + e.exports = function (e) { + var t = a.location.hostname; + return e.domains.some(function (e) { + return t.match(new RegExp('(^|\\.)' + r(e) + '$', 'i')); + }); + }; + } + }, + 'core/src/lib/helpers/getObjectProperty.js': { + script: function (e) { + 'use strict'; + e.exports = function (e, t) { + for (var n = t.split('.'), a = e, i = 0, r = n.length; i < r; i++) { + if (null == a) + return; + a = a[n[i]]; + } + return a; + }; + } + }, + 'core/src/lib/events/helpers/pageLifecycleEvents.js': { + script: function (e, t, n) { + 'use strict'; + var a = n('@adobe/reactor-window'), i = n('@adobe/reactor-document'), r = -1 !== a.navigator.appVersion.indexOf('MSIE 10'), s = 'WINDOW_LOADED', o = 'DOM_READY', c = 'PAGE_BOTTOM', l = [ + c, + o, + s + ], u = function (e, t) { + return { + element: e, + target: e, + nativeEvent: t + }; + }, d = {}; + l.forEach(function (e) { + d[e] = []; + }); + var p = function (e, t) { + l.slice(0, m(e) + 1).forEach(function (e) { + g(t, e); + }); + }, f = function () { + return 'complete' === i.readyState ? s : 'interactive' === i.readyState ? r ? null : o : void 0; + }, m = function (e) { + return l.indexOf(e); + }, g = function (e, t) { + d[t].forEach(function (t) { + b(e, t); + }), d[t] = []; + }, b = function (e, t) { + var n = t.trigger, a = t.syntheticEventFn; + n(a ? a(e) : null); + }; + a._satellite = a._satellite || {}, a._satellite.pageBottom = p.bind(null, c), i.addEventListener('DOMContentLoaded', p.bind(null, o), !0), a.addEventListener('load', p.bind(null, s), !0), a.setTimeout(function () { + var e = f(); + e && p(e); + }, 0), e.exports = { + registerLibraryLoadedTrigger: function (e) { + e(); + }, + registerPageBottomTrigger: function (e) { + d[c].push({ trigger: e }); + }, + registerDomReadyTrigger: function (e) { + d[o].push({ + trigger: e, + syntheticEventFn: u.bind(null, i) + }); + }, + registerWindowLoadedTrigger: function (e) { + d[s].push({ + trigger: e, + syntheticEventFn: u.bind(null, a) + }); + } + }; + } + }, + 'core/src/lib/actions/helpers/decorateCode.js': { + script: function (e, t, n) { + 'use strict'; + var a = n('./decorators/decorateGlobalJavaScriptCode'), i = n('./decorators/decorateNonGlobalJavaScriptCode'), r = { + javascript: function (e, t) { + return e.settings.global ? a(e, t) : i(e, t); + }, + html: n('./decorators/decorateHtmlCode') + }; + e.exports = function (e, t) { + return r[e.settings.language](e, t); + }; + } + }, + 'core/src/lib/actions/helpers/loadCodeSequentially.js': { + script: function (e, t, n) { + 'use strict'; + var a = n('@adobe/reactor-promise'), i = n('./getSourceByUrl'), r = a.resolve(); + e.exports = function (e) { + var t = new a(function (t) { + var n = i(e); + a.all([ + n, + r + ]).then(function (e) { + var n = e[0]; + t(n); + }); + }); + return r = t, t; + }; + } + }, + 'core/node_modules/postscribe/dist/postscribe.js': { + script: function (e, t) { + var n, a; + n = this, a = function () { + return function (e) { + function t(a) { + if (n[a]) + return n[a].exports; + var i = n[a] = { + exports: {}, + id: a, + loaded: !1 + }; + return e[a].call(i.exports, i, i.exports, t), i.loaded = !0, i.exports; + } + var n = {}; + return t.m = e, t.c = n, t.p = '', t(0); + }([ + function (e, t, n) { + 'use strict'; + function a(e) { + return e && e.__esModule ? e : { default: e }; + } + var i = a(n(1)); + e.exports = i.default; + }, + function (e, t, n) { + 'use strict'; + function a(e) { + if (e && e.__esModule) + return e; + var t = {}; + if (null != e) + for (var n in e) + Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]); + return t.default = e, t; + } + function i(e) { + return e && e.__esModule ? e : { default: e }; + } + function r() { + } + function s() { + var e = m.shift(); + if (e) { + var t = d.last(e); + t.afterDequeue(), e.stream = o.apply(void 0, e), t.afterStreamStart(); + } + } + function o(e, t, n) { + function a(e) { + e = n.beforeWrite(e), g.write(e), n.afterWrite(e); + } + (g = new u.default(e, n)).id = f++, g.name = n.name || g.id, c.streams[g.name] = g; + var i = e.ownerDocument, o = { + close: i.close, + open: i.open, + write: i.write, + writeln: i.writeln + }; + l(i, { + close: r, + open: r, + write: function () { + for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) + t[n] = arguments[n]; + return a(t.join('')); + }, + writeln: function () { + for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) + t[n] = arguments[n]; + return a(t.join('') + '\n'); + } + }); + var d = g.win.onerror || r; + return g.win.onerror = function (e, t, a) { + n.error({ msg: e + ' - ' + t + ': ' + a }), d.apply(g.win, [ + e, + t, + a + ]); + }, g.write(t, function () { + l(i, o), g.win.onerror = d, n.done(), g = null, s(); + }), g; + } + function c(e, t, n) { + if (d.isFunction(n)) + n = { done: n }; + else if ('clear' === n) + return m = [], g = null, void (f = 0); + n = d.defaults(n, p); + var a = [ + e = /^#/.test(e) ? window.document.getElementById(e.substr(1)) : e.jquery ? e[0] : e, + t, + n + ]; + return e.postscribe = { + cancel: function () { + a.stream ? a.stream.abort() : a[1] = r; + } + }, n.beforeEnqueue(a), m.push(a), g || s(), e.postscribe; + } + t.__esModule = !0; + var l = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var a in n) + Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]); + } + return e; + }; + t.default = c; + var u = i(n(2)), d = a(n(4)), p = { + afterAsync: r, + afterDequeue: r, + afterStreamStart: r, + afterWrite: r, + autoFix: !0, + beforeEnqueue: r, + beforeWriteToken: function (e) { + return e; + }, + beforeWrite: function (e) { + return e; + }, + done: r, + error: function (e) { + throw new Error(e.msg); + }, + releaseAsync: !1 + }, f = 0, m = [], g = null; + l(c, { + streams: {}, + queue: m, + WriteStream: u.default + }); + }, + function (e, t, n) { + 'use strict'; + function a(e) { + if (e && e.__esModule) + return e; + var t = {}; + if (null != e) + for (var n in e) + Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]); + return t.default = e, t; + } + function i(e) { + return e && e.__esModule ? e : { default: e }; + } + function r(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + function s(e, t) { + var n = p + t, a = e.getAttribute(n); + return u.existy(a) ? String(a) : a; + } + function o(e, t) { + var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, a = p + t; + u.existy(n) && '' !== n ? e.setAttribute(a, n) : e.removeAttribute(a); + } + t.__esModule = !0; + var c = Object.assign || function (e) { + for (var t = 1; t < arguments.length; t++) { + var n = arguments[t]; + for (var a in n) + Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]); + } + return e; + }, l = i(n(3)), u = a(n(4)), d = !1, p = 'data-ps-', f = 'ps-style', m = 'ps-script', g = function () { + function e(t) { + var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + r(this, e), this.root = t, this.options = n, this.doc = t.ownerDocument, this.win = this.doc.defaultView || this.doc.parentWindow, this.parser = new l.default('', { autoFix: n.autoFix }), this.actuals = [t], this.proxyHistory = '', this.proxyRoot = this.doc.createElement(t.nodeName), this.scriptStack = [], this.writeQueue = [], o(this.proxyRoot, 'proxyof', 0); + } + return e.prototype.write = function () { + var e; + for ((e = this.writeQueue).push.apply(e, arguments); !this.deferredRemote && this.writeQueue.length;) { + var t = this.writeQueue.shift(); + u.isFunction(t) ? this._callFunction(t) : this._writeImpl(t); + } + }, e.prototype._callFunction = function (e) { + var t = { + type: 'function', + value: e.name || e.toString() + }; + this._onScriptStart(t), e.call(this.win, this.doc), this._onScriptDone(t); + }, e.prototype._writeImpl = function (e) { + this.parser.append(e); + for (var t = void 0, n = void 0, a = void 0, i = []; (t = this.parser.readToken()) && !(n = u.isScript(t)) && !(a = u.isStyle(t));) + (t = this.options.beforeWriteToken(t)) && i.push(t); + i.length > 0 && this._writeStaticTokens(i), n && this._handleScriptToken(t), a && this._handleStyleToken(t); + }, e.prototype._writeStaticTokens = function (e) { + var t = this._buildChunk(e); + return t.actual ? (t.html = this.proxyHistory + t.actual, this.proxyHistory += t.proxy, this.proxyRoot.innerHTML = t.html, d && (t.proxyInnerHTML = this.proxyRoot.innerHTML), this._walkChunk(), d && (t.actualInnerHTML = this.root.innerHTML), t) : null; + }, e.prototype._buildChunk = function (e) { + for (var t = this.actuals.length, n = [], a = [], i = [], r = e.length, s = 0; s < r; s++) { + var o = e[s], c = o.toString(); + if (n.push(c), o.attrs) { + if (!/^noscript$/i.test(o.tagName)) { + var l = t++; + a.push(c.replace(/(\/?>)/, ' ' + p + 'id=' + l + ' $1')), o.attrs.id !== m && o.attrs.id !== f && i.push('atomicTag' === o.type ? '' : '<' + o.tagName + ' ' + p + 'proxyof=' + l + (o.unary ? ' />' : '>')); + } + } else + a.push(c), i.push('endTag' === o.type ? c : ''); + } + return { + tokens: e, + raw: n.join(''), + actual: a.join(''), + proxy: i.join('') + }; + }, e.prototype._walkChunk = function () { + for (var e = void 0, t = [this.proxyRoot]; u.existy(e = t.shift());) { + var n = 1 === e.nodeType; + if (!n || !s(e, 'proxyof')) { + n && (this.actuals[s(e, 'id')] = e, o(e, 'id')); + var a = e.parentNode && s(e.parentNode, 'proxyof'); + a && this.actuals[a].appendChild(e); + } + t.unshift.apply(t, u.toArray(e.childNodes)); + } + }, e.prototype._handleScriptToken = function (e) { + var t = this, n = this.parser.clear(); + n && this.writeQueue.unshift(n), e.src = e.attrs.src || e.attrs.SRC, (e = this.options.beforeWriteToken(e)) && (e.src && this.scriptStack.length ? this.deferredRemote = e : this._onScriptStart(e), this._writeScriptToken(e, function () { + t._onScriptDone(e); + })); + }, e.prototype._handleStyleToken = function (e) { + var t = this.parser.clear(); + t && this.writeQueue.unshift(t), e.type = e.attrs.type || e.attrs.TYPE || 'text/css', (e = this.options.beforeWriteToken(e)) && this._writeStyleToken(e), t && this.write(); + }, e.prototype._writeStyleToken = function (e) { + var t = this._buildStyle(e); + this._insertCursor(t, f), e.content && (t.styleSheet && !t.sheet ? t.styleSheet.cssText = e.content : t.appendChild(this.doc.createTextNode(e.content))); + }, e.prototype._buildStyle = function (e) { + var t = this.doc.createElement(e.tagName); + return t.setAttribute('type', e.type), u.eachKey(e.attrs, function (e, n) { + t.setAttribute(e, n); + }), t; + }, e.prototype._insertCursor = function (e, t) { + this._writeImpl(''); + var n = this.doc.getElementById(t); + n && n.parentNode.replaceChild(e, n); + }, e.prototype._onScriptStart = function (e) { + e.outerWrites = this.writeQueue, this.writeQueue = [], this.scriptStack.unshift(e); + }, e.prototype._onScriptDone = function (e) { + e === this.scriptStack[0] ? (this.scriptStack.shift(), this.write.apply(this, e.outerWrites), !this.scriptStack.length && this.deferredRemote && (this._onScriptStart(this.deferredRemote), this.deferredRemote = null)) : this.options.error({ msg: 'Bad script nesting or script finished twice' }); + }, e.prototype._writeScriptToken = function (e, t) { + var n = this._buildScript(e), a = this._shouldRelease(n), i = this.options.afterAsync; + e.src && (n.src = e.src, this._scriptLoadHandler(n, a ? i : function () { + t(), i(); + })); + try { + this._insertCursor(n, m), n.src && !a || t(); + } catch (e) { + this.options.error(e), t(); + } + }, e.prototype._buildScript = function (e) { + var t = this.doc.createElement(e.tagName); + return u.eachKey(e.attrs, function (e, n) { + t.setAttribute(e, n); + }), e.content && (t.text = e.content), t; + }, e.prototype._scriptLoadHandler = function (e, t) { + function n() { + e = e.onload = e.onreadystatechange = e.onerror = null; + } + function a() { + n(), null != t && t(), t = null; + } + function i(e) { + n(), s(e), null != t && t(), t = null; + } + function r(e, t) { + var n = e['on' + t]; + null != n && (e['_on' + t] = n); + } + var s = this.options.error; + r(e, 'load'), r(e, 'error'), c(e, { + onload: function () { + if (e._onload) + try { + e._onload.apply(this, Array.prototype.slice.call(arguments, 0)); + } catch (t) { + i({ msg: 'onload handler failed ' + t + ' @ ' + e.src }); + } + a(); + }, + onerror: function () { + if (e._onerror) + try { + e._onerror.apply(this, Array.prototype.slice.call(arguments, 0)); + } catch (t) { + return void i({ msg: 'onerror handler failed ' + t + ' @ ' + e.src }); + } + i({ msg: 'remote script failed ' + e.src }); + }, + onreadystatechange: function () { + /^(loaded|complete)$/.test(e.readyState) && a(); + } + }); + }, e.prototype._shouldRelease = function (e) { + return !/^script$/i.test(e.nodeName) || !!(this.options.releaseAsync && e.src && e.hasAttribute('async')); + }, e; + }(); + t.default = g; + }, + function (e) { + var t; + t = function () { + return function (e) { + function t(a) { + if (n[a]) + return n[a].exports; + var i = n[a] = { + exports: {}, + id: a, + loaded: !1 + }; + return e[a].call(i.exports, i, i.exports, t), i.loaded = !0, i.exports; + } + var n = {}; + return t.m = e, t.c = n, t.p = '', t(0); + }([ + function (e, t, n) { + 'use strict'; + function a(e) { + return e && e.__esModule ? e : { default: e }; + } + var i = a(n(1)); + e.exports = i.default; + }, + function (e, t, n) { + 'use strict'; + function a(e) { + return e && e.__esModule ? e : { default: e }; + } + function i(e) { + if (e && e.__esModule) + return e; + var t = {}; + if (null != e) + for (var n in e) + Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]); + return t.default = e, t; + } + function r(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + t.__esModule = !0; + var s = i(n(2)), o = i(n(3)), c = a(n(6)), l = n(5), u = { + comment: /^'); + if (t >= 0) + return new l.CommentToken(e.substr(4, t - 1), t + 3); + } + function i(e) { + var t = e.indexOf('<'); + return new l.CharsToken(t >= 0 ? t : e.length); + } + function r(e) { + var t, n, a; + if (-1 !== e.indexOf('>')) { + var i = e.match(u.startTag); + if (i) { + var r = (t = {}, n = {}, a = i[2], i[2].replace(u.attr, function (e, i) { + arguments[2] || arguments[3] || arguments[4] || arguments[5] ? arguments[5] ? (t[arguments[5]] = '', n[arguments[5]] = !0) : t[i] = arguments[2] || arguments[3] || arguments[4] || u.fillAttr.test(i) && i || '' : t[i] = '', a = a.replace(e, ''); + }), { v: new l.StartTagToken(i[1], i[0].length, t, n, !!i[3], a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '')) }); + if ('object' === (void 0 === r ? 'undefined' : c(r))) + return r.v; + } + } + } + function s(e) { + var t = r(e); + if (t) { + var n = e.slice(t.length); + if (n.match(new RegExp('', 'i'))) { + var a = n.match(new RegExp('([\\s\\S]*?)', 'i')); + if (a) + return new l.AtomicTagToken(t.tagName, a[0].length + t.length, t.attrs, t.booleanAttrs, a[1]); + } + } + } + function o(e) { + var t = e.match(u.endTag); + if (t) + return new l.EndTagToken(t[1], t[0].length); + } + t.__esModule = !0; + var c = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + }; + t.comment = a, t.chars = i, t.startTag = r, t.atomicTag = s, t.endTag = o; + var l = n(4), u = { + startTag: /^<([\-A-Za-z0-9_]+)((?:\s+[\w\-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, + endTag: /^<\/([\-A-Za-z0-9_]+)[^>]*>/, + attr: /(?:([\-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([\-A-Za-z0-9_]+)(\s|$)+)/g, + fillAttr: /^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i + }; + }, + function (e, t, n) { + 'use strict'; + function a(e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + } + t.__esModule = !0, t.EndTagToken = t.AtomicTagToken = t.StartTagToken = t.TagToken = t.CharsToken = t.CommentToken = t.Token = void 0; + var i = n(5), r = (t.Token = function e(t, n) { + a(this, e), this.type = t, this.length = n, this.text = ''; + }, t.CommentToken = function () { + function e(t, n) { + a(this, e), this.type = 'comment', this.length = n || (t ? t.length : 0), this.text = '', this.content = t; + } + return e.prototype.toString = function () { + return '\n\n\n\n', + language: 'html' + } + }] + }, + { + id: 'RLfa37ff4b6f50458b931ce354683b8fb9', + name: 'JobApplication:RelatedJobClicks', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'RelatedJobClicks' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar20', + type: 'value', + value: '%jobDescription:jobCategory%' + }, + { + name: 'eVar22', + type: 'value', + value: '%jobDescription:jobDivision%' + }, + { + name: 'eVar37', + type: 'value', + value: '%jobDescription:jobCountry%' + }, + { + name: 'eVar58', + type: 'value', + value: '%jobDescription:applicationType%' + }, + { + name: 'eVar60', + type: 'value', + value: '%Job Role%' + }, + { + name: 'eVar80', + type: 'value', + value: '%jobDescription:hiringYear%' + } + ], + events: [{ name: 'event126' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'RelatedJobClicks', + linkType: 'o' + } + } + ] + }, + { + id: 'RLc262cb953ff24477bcf21162b12a8a52', + name: 'passport:SocialLoginExistingAccountLinked', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportSocialLoginExistingAccountLinked' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar5', + type: 'value', + value: '%content:PageName%' + }, + { + name: 'eVar4', + type: 'value', + value: '%content:userType%' + }, + { + name: 'eVar30', + type: 'value', + value: '%content:userID%' + }, + { + name: 'eVar14', + type: 'value', + value: '%campaign%' + } + ], + props: [{ + name: 'prop40', + type: 'value', + value: '%passportEventParams%' + }], + events: [{ name: 'event73' }], + channel: '%content:SiteSection%', + pageName: '%content:PageName%' + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RL8ae19a2dd31241d5a7a66a76f3365d35', + name: 'jobAplicationFlow', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'app_form_save' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'eVar1,eVar2,eVar34,eVar35,eVar36,eVar10,events', t.linkTrackEvents = 'event13', t.eVar34 = _satellite.getVar('Form : formIndex') + 1, t.eVar35 = _satellite.getVar('Form : formTitle'), t.eVar36 = t.eVar34 + '|' + t.eVar35, 'RESUME' == _satellite.getVar('Form : formTitle') && (t.eVar10 = _satellite.getVar('jobApplication:resumeType')); + } + }, + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar28', + type: 'value', + value: '%content:personID%' + }, + { + name: 'eVar37', + type: 'value', + value: '%event:jobCountry%' + } + ], + events: [{ name: 'event13' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Application Flow', + linkType: 'o' + } + } + ] + }, + { + id: 'RL61ef88a9eb434f0cbfe6178f1bede828', + name: 'jobApplication:formError', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'formErrorsJobApplication' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar28', + type: 'value', + value: '%content:personID%' + }], + events: [{ name: 'event40' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Application - Form Error', + linkType: 'o' + } + } + ] + }, + { + id: 'RL23169365d15e4178a5c322698cc6c051', + name: 'JobSearch:Sorting', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'searchSortBy' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar19', + type: 'value', + value: '%JobSearch:SortBy%' + }], + events: [{ name: 'event36' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Search Sorting', + linkType: 'o' + } + } + ] + }, + { + id: 'RL910c1d9b5cc74b3587260d64f0ae23af', + name: 'JobApplication:JobApplyModalClickThrough', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'jobApplyClickThrough' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar20', + type: 'value', + value: '%jobDescription:jobCategory%' + }, + { + name: 'eVar22', + type: 'value', + value: '%jobDescription:jobDivision%' + } + ], + events: [{ name: 'event95' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Apply Modal Click Through', + linkType: 'o' + } + } + ] + }, + { + id: 'RLf42fcaba154c4d149a84697738e81249', + name: 'SK Landing Page - SKLIK', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + if ('https://www.amazon.jobs/en/landing_pages/praca-v-logistike' == document.location.href) + return !0; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n\n', + language: 'html' + } + }] + }, + { + id: 'RL2a3231e8338144ebbc6678e5d9feb4ff', + name: 'SMS -Save Number and Verify Later', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'SMS Save Number and Verify Later' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event137' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMS Save Number and Verify Later', + linkType: 'o' + } + } + ] + }, + { + id: 'RLb9baea8be9eb46728fe5f97ae527f343', + name: 'unsubscribe:alreadyUnsubscribed', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'alreadyUnsubscribed' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar39', + type: 'value', + value: '%Opt Out: System%' + }, + { + name: 'eVar40', + type: 'value', + value: '%Opt Out: Source%' + }, + { + name: 'eVar41', + type: 'value', + value: '%Opt Out: Beamery Campaign ID%' + }, + { + name: 'eVar42', + type: 'value', + value: '%Opt Out: Beamery Conversation ID%' + } + ], + events: [{ name: 'event54' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Already Unsubscribed', + linkType: 'o' + } + } + ] + }, + { + id: 'RLb6996746f8084038b5fdee30a0556317', + name: 'User: Registration Start', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'registrationStart' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event17' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Registration Start', + linkType: 'o' + } + } + ] + }, + { + id: 'RL1c1f59b3d1a249a298e73dc066a79328', + name: 'SMS Successful Verifications', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'Verification-Success' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar89', + type: 'value', + value: '%User Status%' + }, + { + name: 'eVar99', + type: 'value', + value: '%SMS:Stepname%' + } + ], + events: [{ name: 'event120' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMS - Verification-Success', + linkType: 'o' + } + } + ] + }, + { + id: 'RLce775b6e36df40399ac47ff200cace36', + name: 'Consent - Customize Cookie Click', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '#btn-customize-cookies', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + var n = Visitor.getInstance('CCBC879D5572070E7F000101@AdobeOrg').getMarketingCloudVisitorID(); + n && (t.eVar6 = n), t.linkTrackVars = 'events,eVar6,eVar5,prop13', t.linkTrackEvents = 'event91'; + } + }, + trackerProperties: { + eVars: [ + { + name: 'eVar5', + type: 'value', + value: '%content:PageName%' + }, + { + name: 'eVar28', + type: 'value', + value: '%content:personID%' + } + ], + props: [{ + name: 'prop13', + type: 'value', + value: '%Page URL%' + }], + events: [{ name: 'event91' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Consent Form-Customize Cookie Button', + linkType: 'o' + } + } + ] + }, + { + id: 'RL6d5dbd3768f648b5a9a864c916209f3e', + name: 'SMS - ConsiderForOtherJobOpportunitiesOptionSelected', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'ConsiderForOtherJobOpportunitiesOptionSelected' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar98', + type: 'value', + value: '%SMS - Option Selected%' + }], + events: [{ name: 'event119' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'ConsiderForOtherJobOpportunitiesOptionSelected', + linkType: 'o' + } + } + ] + }, + { + id: 'RL760841538293419a9aeab0f19f679f87', + name: '\u2022\tLogin with Amazon initialization', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '#btn-lwa-init', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + var n = Visitor.getInstance('4EE1BB6555F9369A7F000101@AdobeOrg').getMarketingCloudVisitorID(); + n && (t.eVar6 = n), t.linkTrackVars = 'events,eVar6,eVar5,prop13', t.linkTrackEvents = 'event92'; + } + }, + trackerProperties: { + eVars: [{ + name: 'eVar5', + type: 'value', + value: '%content:PageName%' + }], + props: [{ + name: 'prop13', + type: 'value', + value: '%Page URL%' + }], + events: [{ name: 'event92' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Consent Form-Customize Cookie Button', + linkType: 'o' + } + } + ] + }, + { + id: 'RL702c49c25d504383ac0f7a2ba9a57446', + name: 'SMS Flow Cancelled', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'SMS Flow Cancelled' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar89', + type: 'value', + value: '%User Status%' + }, + { + name: 'eVar99', + type: 'value', + value: '%SMS:Stepname%' + } + ], + events: [{ name: 'event114' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMS Flow Cancelled', + linkType: 'o' + } + } + ] + }, + { + id: 'RLe21d88273ce44b5b8b96c445bbc2f6f6', + name: 'passport:ForgotPasswordError', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportForgotPasswordError' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event50' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RLc896f2ce1e0c48098078d3c81370315e', + name: 'jobDescription:jobView', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/valueComparison.js', + settings: { + comparison: { + operator: 'equals', + caseInsensitive: !0 + }, + leftOperand: '%content:PageName%', + rightOperand: 'Amazon.jobs | Job Details Page' + } + }], + actions: [{ + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.list1 = _satellite.getVar('relatedJobId'), 1 == digitalData.job.relatedJobId.length && (t.events = t.apl(t.events, 'event124')), t.linkTrackVars = 'list1', t.linkTrackEvents = 'event124'; + } + }, + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar9', + type: 'value', + value: '%jobDescription:jobFindingMethod%' + }, + { + name: 'eVar20', + type: 'value', + value: '%jobDescription:jobCategory%' + }, + { + name: 'eVar22', + type: 'value', + value: '%jobDescription:jobDivision%' + }, + { + name: 'eVar28', + type: 'value', + value: '%content:personID%' + } + ], + events: [{ name: 'event5' }] + } + } + }] + }, + { + id: 'RLfcf2ec342498489c87be8921e0af130d', + name: 'Consent - Cookie Accept Form', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '#btn-accept-cookies', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + var n = Visitor.getInstance('CCBC879D5572070E7F000101@AdobeOrg').getMarketingCloudVisitorID(); + n && (t.eVar6 = n), t.linkTrackVars = 'events,eVar6,eVar5,prop13', t.linkTrackEvents = 'event90'; + } + }, + trackerProperties: { + eVars: [{ + name: 'eVar5', + type: 'value', + value: '%content:PageName%' + }], + props: [{ + name: 'prop13', + type: 'value', + value: '%Page URL%' + }], + events: [{ name: 'event90' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Consent Form - Cookie Accept All Button', + linkType: 'o' + } + } + ] + }, + { + id: 'RL68524c72fe354b00a7ef4164c2b6c909', + name: 'SK Landing Page - Global RMK', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + if ('https://www.amazon.jobs/en/landing_pages/praca-v-logistike' == document.location.href) + return !0; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n\n\n', + language: 'html' + } + }] + }, + { + id: 'RL26dbff0ef71f4e6f9b7827328dcf8417', + name: 'CZ Landing Page - GTag', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + if ('https://www.amazon.jobs/cs/landing_pages/prace' == document.location.href) + return !0; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n', + language: 'html' + } + }] + }, + { + id: 'RLc9f41a93df3a4b7085ce6f51f1235d78', + name: 'passport:ForgotPasswordSuccess', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportForgotPasswordSuccess' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event49' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RLfd05101d1d394c90af05413ca7aa9506', + name: 'passport:LoginFailure', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportLoginFailure' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + props: [{ + name: 'prop26', + type: 'value', + value: '%event.detail.eventDetail%' + }], + events: [{ name: 'event43' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RL1544da947d2f482b84c4a1f8772dce60', + name: 'passport:UpdatePasswordSucceeded', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportUpdatePasswordSucceeded' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event47' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RL939d8f2de56d49b2a882d54abea1b245', + name: 'Email Verify button', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '.btn.btn-main.btn.btn-default.btn-block', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + var n = Visitor.getInstance('4EE1BB6555F9369A7F000101@AdobeOrg').getMarketingCloudVisitorID(); + n && (t.eVar6 = n), t.linkTrackVars = 'events,eVar6,eVar5,prop13', t.linkTrackEvents = 'event111'; + } + }, + trackerProperties: { + eVars: [{ + name: 'eVar5', + type: 'value', + value: '%content:PageName%' + }], + props: [{ + name: 'prop13', + type: 'value', + value: '%Page URL%' + }], + events: [{ name: 'event111' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Email Verify', + linkType: 'o' + } + } + ] + }, + { + id: 'RLd0407aad0e484e56a2b146c943099042', + name: 'passport:ForgotPasswordRequest', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportForgotPasswordRequest' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event48' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RL3f47abb1535b4f479437afcf49cd0beb', + name: 'passport:LoginSuccess', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportLoginSuccess' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar28', + type: 'value', + value: '%content:personID%' + }], + events: [{ name: 'event44' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RLfbfbfcf05005403ea7a4a6774c49fbef', + name: 'jobDescription:jobShare', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'jobShare' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar3', + type: 'value', + value: '%jobDescription:jobShareSocialMedia%' + }], + events: [{ name: 'event6' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Share on Social Media', + linkType: 'o' + } + } + ] + }, + { + id: 'RLbfa393dbd5ef4748b2e37d524754513f', + name: 'communicationPreferences:subscribe', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'communicationPreferencesSubscribe' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar39', + type: 'value', + value: '%Opt Out: System%' + }, + { + name: 'eVar40', + type: 'value', + value: '%Opt Out: Source%' + }, + { + name: 'eVar41', + type: 'value', + value: '%Opt Out: Beamery Campaign ID%' + }, + { + name: 'eVar42', + type: 'value', + value: '%Opt Out: Beamery Conversation ID%' + } + ], + events: [{ name: 'event52' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Communication Preferences Subscribe', + linkType: 'o' + } + } + ] + }, + { + id: 'RL077de8f41c564780a25776fcb1d40169', + name: 'Form:FormStart', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'formStart' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar18', + type: 'value', + value: '%Form: FormName%' + }], + events: [{ name: 'event10' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Form Start', + linkType: 'o' + } + } + ] + }, + { + id: 'RLa92e538572fa4fca9b5df846619b9edf', + name: 'SMS Enable SMS Updates', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'Enable SMS Updates' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar99', + type: 'value', + value: '%SMS:Stepname%' + }], + events: [{ name: 'event130' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMS Enable SMS Updates', + linkType: 'o' + } + } + ] + }, + { + id: 'RL992122ce2f8941619125cabc004d41e2', + name: 'jobApplication:job resume', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'dash_resume_app' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar20', + type: 'value', + value: '%jobDescription:jobCategory%' + }, + { + name: 'eVar22', + type: 'value', + value: '%jobDescription:jobDivision%' + }, + { + name: 'eVar28', + type: 'value', + value: '%content:personID%' + }, + { + name: 'eVar37', + type: 'value', + value: '%event:jobCountry%' + }, + { + name: 'eVar43', + type: 'value', + value: '%jobDescription:jobBusinessPurpose%' + } + ], + events: [{ name: 'event27' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Application - Resume the flow', + linkType: 'o' + } + } + ] + }, + { + id: 'RLf5501061732d4e9893b19132dc967d0e', + name: 'jobApplication:jobApplicationComplete- Success Page', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'jobApplicationComplete' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar28', + type: 'value', + value: '%content:personID%' + }, + { + name: 'eVar33', + type: 'value', + value: '%jobApplication:applicationId%' + }, + { + name: 'eVar37', + type: 'value', + value: '%event:jobCountry%' + }, + { + name: 'eVar43', + type: 'value', + value: '%jobDescription:jobBusinessPurpose%' + } + ], + events: [{ name: 'event9' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Application Complete', + linkType: 'o' + } + } + ] + }, + { + id: 'RLd71e765f34f84526815a973932a94e7d', + name: 'SMS - DivergentNumberActionClicked', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'DivergentNumberActionClicked' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + var n = digitalData.eventData.action; + t.eVar88 = n; + } + }, + trackerProperties: { events: [{ name: 'event131' }] } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'DivergentNumberActionClicked', + linkType: 'o' + } + } + ] + }, + { + id: 'RLbf707d8aa005475b8f21715da9bdb804', + name: 'SMS - SMSOpted', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'SMSOpted' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar56', + type: 'value', + value: '%SMS - Event - smsOptedIn%' + }], + events: [{ name: 'event117' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMSOpted', + linkType: 'o' + } + } + ] + }, + { + id: 'RL0ddd39127ad44bf7a4dccde6e3e3a1c2', + name: 'Job page - Not for me button', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'JobNotForMe' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }], + events: [{ name: 'event93' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Not For Me', + linkType: 'o' + } + } + ] + }, + { + id: 'RL11bdf63af6f649d9b9ae78937f7a8c52', + name: 'JobApplication:centralizedHiringApply', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'centralizedHiringApply' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar20', + type: 'value', + value: '%jobDescription:jobCategory%' + }, + { + name: 'eVar22', + type: 'value', + value: '%jobDescription:jobDivision%' + }, + { + name: 'eVar37', + type: 'value', + value: '%jobDescription:jobCountry%' + }, + { + name: 'eVar58', + type: 'value', + value: 'Centralized Hiring Process' + }, + { + name: 'eVar60', + type: 'value', + value: '%Job Role%' + }, + { + name: 'eVar80', + type: 'value', + value: '%jobDescription:hiringYear%' + } + ], + events: [{ name: 'event129' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Centralized Hiring Apply Now Click', + linkType: 'o' + } + } + ] + }, + { + id: 'RL4c6ed47a923045e28fa5fde995d6bdae', + name: 'passport:asyncPageLoad', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'asyncPageLoad' }, + ruleOrder: 40 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/subdomain.js', + settings: { + subdomains: [ + { + value: 'passport', + valueIsRegex: !0 + }, + { + value: 'aka\\.corp\\.amazon\\.com', + valueIsRegex: !0 + } + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + function n() { + if (!window.s_loadT) { + var e = new Date().getTime(), t = window.performance ? performance.timing : 0, n = t ? t.requestStart : window.inHeadTS || 0; + s_loadT = n ? Math.round((e - n) / 100) : ''; + } + return s_loadT; + } + var a = Visitor.getInstance('4EE1BB6555F9369A7F000101@AdobeOrg').getMarketingCloudVisitorID(); + a && (t.eVar6 = a), t.prop5 = 'undefined' != typeof Visitor ? 'VisitorAPI Present' : 'VisitorAPI Missing', t.prop2 = 'D=t', window.location.href.indexOf('404') > 0 && (t.pageType = 'errorPage'), t.eVar15 = window.location.hostname, t.eVar16 = window.location.pathname, t.prop13 = window.location.href, t.prop14 = n(), t.prop17 = 'D=j', t.prop18 = document.title; + var i = location.search.split('='), r = i[0].substr(1, i[0].length); + t.prop19 = r, t.usePlugins = !0, t.doPlugins = function (e) { + e.Util.getQueryParam('utm_medium') && (e.eVar17 = e.Util.getQueryParam('utm_medium') + ':' + e.Util.getQueryParam('utm_source') + ':' + e.Util.getQueryParam('utm_term') + ':' + e.Util.getQueryParam('utm_content')), e.eVar17 = e.getValOnce(e.eVar17, 's_eVar17'), digitalData.page.search && 'Zero' == digitalData.page.search.noOfResults && (e.events = e.apl(e.events, 'event34', ',', 2)), e.prop25 = e.getDaysSinceLastVisit('s_lv'), e.prop22 = e.getNewRepeat(30, 's_getNewRepeat'), e.prop10 = e.getPreviousValue(e.pageName, 'gpv', ''), e.prop10 && (e.eVar25 = 'D=c10', e.prop11 = e.getPercentPageViewed(), e.prop10 && 'no value' != e.prop10 || (e.prop11 = '')), e.eVar32 = e.prop3 = e.getTimeParting('n', '-8'); + }, t._tpDST = { + 2012: '4/1,10/7', + 2013: '4/7,10/6', + 2014: '4/6,10/5', + 2015: '4/5,10/4', + 2016: '4/3,10/2', + 2017: '4/2,10/1', + 2018: '4/1,10/7', + 2019: '4/7,10/6', + 2020: '4/5,10/4', + 2021: '4/4,10/3' + }, t._tpDST = { + 2012: '3/11,11/4', + 2013: '3/10,11/3', + 2014: '3/9,11/2', + 2015: '3/8,11/1', + 2016: '3/13,11/6', + 2017: '3/12,11/5', + 2018: '3/11,11/4', + 2019: '3/10,11/3', + 2020: '3/8,11/1', + 2021: '3/14,11/7' + }, t._tpDST = { + 2012: '3/25,10/28', + 2013: '3/31,10/27', + 2014: '3/30,10/26', + 2015: '3/29,10/25', + 2016: '3/27,10/30', + 2017: '3/26,10/29', + 2018: '3/25,10/28', + 2019: '3/31,10/27', + 2020: '3/29,10/25', + 2021: '3/28,10/31' + }, t.getPreviousValue = new Function('v', 'c', 'el', 'var s=this,t=new Date,i,j,r=\'\';t.setTime(t.getTime()+1800000);if(el){if(s.events){i=s.split(el,\',\');j=s.split(s.events,\',\');for(x in i){for(y in j){if(i[x]==j[y]){if(s.c_r(c)) r=s.c_r(c);v?s.c_w(c,v,t):s.c_w(c,\'no value\',t);return r}}}}}else{if(s.c_r(c)) r=s.c_r(c);v?s.c_w(c,v,t):s.c_w(c,\'no value\',t);return r}'), t.split = new Function('l', 'd', 'var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x++]=l.substring(0,i);l=l.substring(i+d.length);}return a'), t.getPercentPageViewed = new Function('n', 'var s=this,W=window,EL=W.addEventListener,AE=W.attachEvent,E=[\'load\',\'unload\',\'scroll\',\'resize\',\'zoom\',\'keyup\',\'mouseup\',\'touchend\',\'orientationchange\',\'pan\'];W.s_Obj=s;s_PPVid=(n==\'-\'?s.pageName:n)||s.pageName||location.href;if(!W.s_PPVevent){s.s_PPVg=function(n,r){var k=\'s_ppv\',p=k+\'l\',c=s.c_r(n||r?k:p),a=c.indexOf(\',\')>-1?c.split(\',\',10):[\'\'],l=a.length,i;a[0]=unescape(a[0]);r=r||(n&&n!=a[0])||0;a.length=10;if(typeof a[0]!=\'string\')a[0]=\'\';for(i=1;i<10;i++)a[i]=!r&&i0&&b>0?M.round(C*b/h):0,O=W.orientation,o=!isNaN(O)?M.abs(o)%180:Y>X?0:90,L=e==\'load\'||s_PPVi<1,a=s.s_PPVg(s_PPVid,L),V=function(i,v,f,n){i=parseInt(typeof a==J&&a.length>i?a[i]:\'0\')||0;v=typeof v!=N?i:v;v=f||v>i?v:i;return n?v:v>C?C:v<0?0:v};if(new RegExp(\'(iPod|iPad|iPhone)\').exec(navigator.userAgent||\'\')&&o){o=x;x=y;y=o}o=o?\'P\':\'L\';a[9]=L?\'\':a[9].substring(0,1);s.c_w(\'s_ppv\',escape(W.s_PPVid)+\',\'+V(1,p,L)+\',\'+(L||!V(2)?p:V(2))+\',\'+V(3,b,L,1)+\',\'+X+\',\'+Y+\',\'+x+\',\'+y+\',\'+r+\',\'+a[9]+(a[9]==o?\'\':o))}if(!W.s_PPVt&&e!=\'unload\')W.s_PPVt=setTimeout(W.s_PPVevent,333)};for(var f=W.s_PPVevent,i=0;ids&&dde||d=12){U=\' PM\';H=H-12;}if(H==0){H=12;}D=da[D];tm=H+\':\'+M+U;return(tm+\'|\'+D);}'), t.getNewRepeat = new Function('d', 'cn', 'var s=this,e=new Date(),cval,sval,ct=e.getTime();d=d?d:30;cn=cn?cn:\'s_nr\';e.setTime(ct+d*24*60*60*1000);cval=s.c_r(cn);if(cval.length==0){s.c_w(cn,ct+\'-New\',e);return\'New\';}sval=s.split(cval,\'-\');if(ct-sval[0]<30*60*1000&&sval[1]==\'New\'){s.c_w(cn,ct+\'-New\',e);return\'New\';}else{s.c_w(cn,ct+\'-Repeat\',e);return\'Repeat\';}'), t.split = new Function('l', 'd', 'var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x++]=l.substring(0,i);l=l.substring(i+d.length);}return a'), t.getValOnce = new Function('v', 'c', 'e', 't', 'var s=this,a=new Date,v=v?v:\'\',c=c?c:\'s_gvo\',e=e?e:0,i=t==\'m\'?60000:86400000,k=s.c_r(c);if(v){a.setTime(a.getTime()+e*i);s.c_w(c,v,e==0?0:a);}return v==k?\'\':v'), t.apl = new Function('l', 'v', 'd', 'u', 'var s=this,m=0;if(!l)l=\'\';if(u){var i,n,a=s.split(l,d);for(i=0;i-1?t.substring(0,t.indexOf(\'#\')):t;}if(t)v+=v?d+t:t;p=p.substring(i==p.length?i:i+1)}return v'), t.p_gpv = new Function('k', 'u', 'var s=this,v=\'\',i=u.indexOf(\'?\'),q;if(k&&i>-1){q=u.substring(i+1);v=s.pt(q,\'&\',\'p_gvf\',k)}return v'), t.p_gvf = new Function('t', 'k', 'if(t){var s=this,i=t.indexOf(\'=\'),p=i<0?t:t.substring(0,i),v=i<0?\'True\':t.substring(i+1);if(p.toLowerCase()==k.toLowerCase())return s.epa(v)}return \'\''), t.getDaysSinceLastVisit = new Function('c', 'var s=this,e=new Date(),es=new Date(),cval,cval_s,cval_ss,ct=e.getTime(),day=24*60*60*1000,f1,f2,f3,f4,f5;e.setTime(ct+3*365*day);es.setTime(ct+30*60*1000);f0=\'Cookies Not Supported\';f1=\'First Visit\';f2=\'More than 30 days\';f3=\'More than 7 days\';f4=\'Less than 7 days\';f5=\'Less than 1 day\';cval=s.c_r(c);if(cval.length==0){s.c_w(c,ct,e);s.c_w(c+\'_s\',f1,es);}else{var d=ct-cval;if(d>30*60*1000){if(d>30*day){s.c_w(c,ct,e);s.c_w(c+\'_s\',f2,es);}else if(d<30*day+1 && d>7*day){s.c_w(c,ct,e);s.c_w(c+\'_s\',f3,es);}else if(d<7*day+1 && d>day){s.c_w(c,ct,e);s.c_w(c+\'_s\',f4,es);}else if(d\n\n\n', + language: 'html' + } + }] + }, + { + id: 'RLe55cc0f17ed349bf8e4d4620d4887564', + name: 'CZ Landing Page - RMK SKLIK tag', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + if ('https://www.amazon.jobs/cs/landing_pages/prace' == document.location.href) + return !0; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n\n\n', + language: 'html' + } + }] + }, + { + id: 'RLcbdbc5597067470ea86fa44e478a2b3f', + name: 'Job Application : Apply Now (Page Load)', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'jobStart' }, + ruleOrder: 40 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar28', + type: 'value', + value: '%content:personID%' + }, + { + name: 'eVar37', + type: 'value', + value: '%event:jobCountry%' + }, + { + name: 'eVar43', + type: 'value', + value: '%jobDescription:jobBusinessPurpose%' + } + ], + events: [{ name: 'event2' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Application Start', + linkType: 'o' + } + } + ] + }, + { + id: 'RLbfd675e3e2554242a7c7242fe0fdc77b', + name: 'JobApplication:JobApply', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'applicationStart' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar20', + type: 'value', + value: '%jobDescription:jobCategory%' + }, + { + name: 'eVar22', + type: 'value', + value: '%jobDescription:jobDivision%' + }, + { + name: 'eVar28', + type: 'value', + value: '%content:personID%' + } + ], + events: [{ name: 'event8' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Apply', + linkType: 'o' + } + } + ] + }, + { + id: 'RLd6eb8e0b685e4a50b51b25a76a4392c1', + name: 'launch_assessment', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'ty_app_launch_assessment' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event133' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'launch_assessment', + linkType: 'o' + } + } + ] + }, + { + id: 'RL4fd735d241e34055bd1e896019c91ad5', + name: 'communicationPreferences:unsubscribe', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'communicationPreferencesUnsubscribe' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar39', + type: 'value', + value: '%Opt Out: System%' + }, + { + name: 'eVar40', + type: 'value', + value: '%Opt Out: Source%' + }, + { + name: 'eVar41', + type: 'value', + value: '%Opt Out: Beamery Campaign ID%' + }, + { + name: 'eVar42', + type: 'value', + value: '%Opt Out: Beamery Conversation ID%' + } + ], + events: [{ name: 'event51' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Communication Preferences Unsubscribe', + linkType: 'o' + } + } + ] + }, + { + id: 'RL7d95290aec494e6fa0a5178563c059a7', + name: 'Form:FormSubmit', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'formSubmit' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar18', + type: 'value', + value: '%Form: FormName%' + }], + events: [{ name: 'event39' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Form Submit', + linkType: 'o' + } + } + ] + }, + { + id: 'RL04e85c77d4c144ee9cc47376a20098f6', + name: 'JobApplication:JobRefer', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'jobRefer' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar20', + type: 'value', + value: '%jobDescription:jobCategory%' + }, + { + name: 'eVar22', + type: 'value', + value: '%jobDescription:jobDivision%' + } + ], + events: [{ name: 'event94' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Refer', + linkType: 'o' + } + } + ] + }, + { + id: 'RL9b676d8a597c480582f16d8b6a061571', + name: 'Send Me New Code button ', + events: [{ + modulePath: 'core/src/lib/events/click.js', + settings: { + elementSelector: '.btn.btn-secondary.btn.btn-default.btn-block', + bubbleFireIfParent: !0, + bubbleFireIfChildFired: !0 + }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + var n = Visitor.getInstance('4EE1BB6555F9369A7F000101@AdobeOrg').getMarketingCloudVisitorID(); + n && (t.eVar6 = n), t.linkTrackVars = 'events,eVar6,eVar5,prop13', t.linkTrackEvents = 'event112'; + } + }, + trackerProperties: { + eVars: [{ + name: 'eVar5', + type: 'value', + value: '%content:PageName%' + }], + props: [{ + name: 'prop13', + type: 'value', + value: '%Page URL%' + }], + events: [{ name: 'event112' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Send Me New Code', + linkType: 'o' + } + } + ] + }, + { + id: 'RLf17f850a4dfd468aaab43ee626f45e61', + name: 'passport:SocialLoginAccountCreated', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportSocialLoginAccountCreated' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar5', + type: 'value', + value: '%content:PageName%' + }, + { + name: 'eVar4', + type: 'value', + value: '%content:userType%' + }, + { + name: 'eVar30', + type: 'value', + value: '%content:userID%' + }, + { + name: 'eVar14', + type: 'value', + value: '%campaign%' + } + ], + props: [{ + name: 'prop40', + type: 'value', + value: '%passportEventParams%' + }], + events: [{ name: 'event72' }], + channel: '%content:SiteSection%', + pageName: '%content:PageName%' + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RL9c448bb418ef4eb58aedc38313e2476f', + name: 'SK Landing Page - AdForm ', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + if ('https://www.amazon.jobs/en/landing_pages/praca-v-logistike' == document.location.href) + return !0; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '----------------------------------------------------------------------------------------------\nTracking Code: Standard (Asynchronous) "amazon_remarketing_microsite_visits_sk"\n----------------------------------------------------------------------------------------------\n\n\n\n\n', + language: 'html' + } + }] + }, + { + id: 'RL1fc2be13bbc74bb8839c3510aa996940', + name: 'SMS Send New Code', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'SMS Send New Code' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar89', + type: 'value', + value: '%User Status%' + }, + { + name: 'eVar99', + type: 'value', + value: '%SMS:Stepname%' + } + ], + events: [{ name: 'event135' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMS - Send new Code', + linkType: 'o' + } + } + ] + }, + { + id: 'RLa7289305bae140a8b06a578444eb3635', + name: 'passport:SocialLoginSuccess', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportSocialLoginSuccess' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar4', + type: 'value', + value: '%content:userType%' + }, + { + name: 'eVar5', + type: 'value', + value: '%content:PageName%' + }, + { + name: 'eVar14', + type: 'value', + value: '%campaign%' + }, + { + name: 'eVar28', + type: 'value', + value: '%content:personID%' + }, + { + name: 'eVar30', + type: 'value', + value: '%content:userID%' + } + ], + props: [{ + name: 'prop40', + type: 'value', + value: '%passportEventParams%' + }], + events: [{ name: 'event71' }], + channel: '%content:SiteSection%', + pageName: '%content:PageName%' + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RL497f3a60ed8e4a4b8ec20810780ed2b6', + name: 'jobApplication:jobWithdraw', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'dash_withdraw_withdraw' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar20', + type: 'value', + value: '%jobDescription:jobCategory%' + }, + { + name: 'eVar22', + type: 'value', + value: '%jobDescription:jobDivision%' + }, + { + name: 'eVar28', + type: 'value', + value: '%content:personID%' + }, + { + name: 'eVar37', + type: 'value', + value: '%event:jobCountry%' + } + ], + events: [{ name: 'event11' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Application Withdraw', + linkType: 'o' + } + } + ] + }, + { + id: 'RLa17bdd2f0084424a9578ec5f492ebaf3', + name: 'SMS Allow', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'SMS Allow' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar99', + type: 'value', + value: '%SMS:Stepname%' + }], + events: [{ name: 'event136' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMS Allow', + linkType: 'o' + } + } + ] + }, + { + id: 'RL797ef58465e14e0fbd2cd816fefe1b19', + name: 'passport:UpdatePasswordStarted', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportUpdatePasswordStarted' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event45' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RL1671e824697042f2aa17bdf9ce5a153e', + name: 'JobSearch:Filter', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'searchFilterBy' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar29', + type: 'value', + value: '%JobSearch:FilterBy%' + }], + events: [{ name: 'event33' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Search Filtering', + linkType: 'o' + } + } + ] + }, + { + id: 'RL0b3861b3e9384f04a90c6b49cb548368', + name: 'jobApplication:exitApplication', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'exitApplication' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + t.linkTrackVars = 'eVar1,eVar2,eVar34,eVar35,eVar36,events', t.linkTrackEvents = 'event12', t.eVar1 = _satellite.getVar('jobDescription:jobID'), t.eVar2 = _satellite.getVar('jobDescription:jobName'), t.eVar34 = _satellite.getVar('Form : formIndex') + 1, t.eVar35 = _satellite.getVar('Form : formTitle'), t.eVar36 = t.eVar34 + '|' + t.eVar35; + } + }, + trackerProperties: { + eVars: [ + { + name: 'eVar28', + type: 'value', + value: '%content:personID%' + }, + { + name: 'eVar37', + type: 'value', + value: '%event:jobCountry%' + } + ], + events: [{ name: 'event12' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Application - Exit', + linkType: 'o' + } + } + ] + }, + { + id: 'RL208baa3460f4446da728ca9f9b3a0c57', + name: 'SMS Get verification code', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'SMS Get verification code' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar89', + type: 'value', + value: '%User Status%' + }, + { + name: 'eVar99', + type: 'value', + value: '%SMS:Stepname%' + } + ], + events: [{ name: 'event109' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMS Get verification code', + linkType: 'o' + } + } + ] + }, + { + id: 'RLbd1c594848c44630a71eb12c69a382ee', + name: 'passport:PasswordInputError', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportPasswordInputError' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + props: [{ + name: 'prop29', + type: 'value', + value: '%passportEventParams%' + }], + events: [{ name: 'event55' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RLd137ceb7a1e24d519dfa43d2c6ae8ebe', + name: 'SK Landing Page - RMK', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + if ('https://www.amazon.jobs/en/landing_pages/praca-v-logistike' == document.location.href) + return !0; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n', + language: 'html' + } + }] + }, + { + id: 'RL26b5a0a037204396be9b47385e0866e9', + name: 'SMS Decline', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'SMS Decline' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar99', + type: 'value', + value: '%SMS:Stepname%' + }], + events: [{ name: 'event116' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMS Decline', + linkType: 'o' + } + } + ] + }, + { + id: 'RL882f9126d77a4108ad4527b6a8c370ff', + name: 'Form:FormErrors', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'formErrors' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar23', + type: 'value', + value: '%Form:FormErrors%' + }], + events: [{ name: 'event16' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Form Error', + linkType: 'o' + } + } + ] + }, + { + id: 'RL521947b4a8b14ae7b54cecdf2ea6beef', + name: 'CTA Click', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'ctaClick' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar21', + type: 'value', + value: '%CTA Name%' + }], + events: [{ name: 'event37' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: '%CTA Name%', + linkType: 'o' + } + } + ] + }, + { + id: 'RL6086aadada1144a6b05874050f35d8f3', + name: 'ResumeParsingService:ProfileDifferentFromPopulated', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'external_parsed_resume_different_from_profile' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: {} } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RLa3009becbb1d4a86870a12b1a35ee6d5', + name: 'passportLoginFailure', + events: [], + conditions: [], + actions: [] + }, + { + id: 'RL9de3da762ce149ec80440c1587b17eb0', + name: 'JobApplication:JobReferModalClickThrough', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'jobReferClickThrough' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%jobDescription:jobID%' + }, + { + name: 'eVar2', + type: 'value', + value: '%jobDescription:jobName%' + }, + { + name: 'eVar20', + type: 'value', + value: '%jobDescription:jobCategory%' + }, + { + name: 'eVar22', + type: 'value', + value: '%jobDescription:jobDivision%' + } + ], + events: [{ name: 'event96' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Refer Modal Click Through', + linkType: 'o' + } + } + ] + }, + { + id: 'RL2bc77b056e514d44afcfbdcdf06da517', + name: 'SMS Edit Number', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'Edit Number' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar99', + type: 'value', + value: '%SMS:Stepname%' + }], + events: [{ name: 'event110' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMS Edit Number', + linkType: 'o' + } + } + ] + }, + { + id: 'RLfe56d28f047f4a97834998dab35f5e7b', + name: 'JobSearch:ClickThrough', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'searchClickThrough' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar26', + type: 'value', + value: '%JobSearch:SearchPosition%' + }, + { + name: 'eVar27', + type: 'value', + value: '%JobSearch: SearchSelection%' + } + ], + events: [{ name: 'event35' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Search Clickthrough', + linkType: 'o' + } + } + ] + }, + { + id: 'RL7cb4553b9f5141f59f6f1811b87168e8', + name: 'passport:AccountCreated', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportAccountCreated' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event41' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RLdf3758b403dc45118292fb72654ac611', + name: 'ResumeParsingService:PopulatedValueChange', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'external_parsed_resume_value_update' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: {} } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RL439f193168004d07a61bf0f5198fbccb', + name: 'Initialize Plugins', + events: [{ + modulePath: 'core/src/lib/events/libraryLoaded.js', + settings: {}, + ruleOrder: 30 + }], + conditions: [], + actions: [{ + modulePath: 'common-analytics-plugins/src/lib/actions/initialize.js', + settings: { + cs: !1, + ft: !1, + il: !0, + mv: !1, + ns: !1, + pt: !0, + ape: !1, + apl: !0, + apv: !1, + fpo: !0, + ggc: !1, + gnr: !0, + gpn: !1, + gpv: !0, + gqp: !1, + grl: !1, + gtp: !0, + gvd: !1, + gvn: !1, + gvo: !0, + rfl: !1, + gapv: !1, + gplt: !0, + gtbe: !1, + gttc: !1, + gdslv: !1, + gtslv: !1 + } + }] + }, + { + id: 'RLaf92df9205b44653a177b54845ca34e2', + name: 'content:allPages', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 40 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'amazon.jobs', + 'passport.amazon.work' + ] + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + function n(e, t, n, i, r) { + var s = e, o = t, c = n, l = i, u = r; + if ('-v' === s) + return { + plugin: 'apl', + version: '4.0' + }; + var d = function () { + if (void 0 !== window.s_c_il) + for (var e, t = 0; t < window.s_c_il.length; t++) + if ((e = window.s_c_il[t])._c && 's_c' === e._c) + return e; + }(); + if (void 0 !== d && (d.contextData.apl = '4.0'), window.inList = window.inList || function (e, t, n, i) { + if ('string' != typeof t) + return !1; + if ('string' == typeof e) + e = e.split(n || ','); + else if ('object' != typeof e) + return !1; + for (n = 0, a = e.length; n < a; n++) + if (1 == i && t === e[n] || t.toLowerCase() === e[n].toLowerCase()) + return !0; + return !1; + }, !s || 'string' == typeof s) { + if ('string' != typeof o || '' === o) + return s; + c = c || ',', 1 == (l = l || c) && (l = c, u || (u = 1)), 2 == l && 1 != u && (l = c), d = (o = o.split(',')).length; + for (var p = 0; p < d; p++) + window.inList(s, o[p], c, u) || (s = s ? s + l + o[p] : o[p]); + } + return s; + } + function i() { + if (!window.s_loadT) { + var e = new Date().getTime(), t = window.performance ? performance.timing : 0, n = t ? t.requestStart : window.inHeadTS || 0; + s_loadT = n ? Math.round((e - n) / 100) : ''; + } + return s_loadT; + } + console.log(JSON.stringify(digitalData, null, '\t')); + var r = Visitor.getInstance('CCBC879D5572070E7F000101@AdobeOrg').getMarketingCloudVisitorID(); + r && (t.eVar6 = r), t.prop5 = 'undefined' != typeof Visitor ? 'VisitorAPI Present' : 'VisitorAPI Missing', t.prop2 = 'D=t', window.location.href.indexOf('404') > 0 && (t.pageType = 'errorPage'), t.eVar15 = window.location.hostname, t.eVar16 = window.location.pathname, t.prop13 = window.location.href, t.prop17 = 'D=j', t.prop18 = document.title; + var s = location.search.split('='), o = s[0].substr(1, s[0].length); + t.prop19 = o, t.usePlugins = !0, t.doPlugins = function (e) { + e.prop14 = i(), e.Util.getQueryParam('utm_medium') && (e.eVar17 = e.Util.getQueryParam('utm_medium') + ':' + e.Util.getQueryParam('utm_source') + ':' + e.Util.getQueryParam('utm_term') + ':' + e.Util.getQueryParam('utm_content')), e.eVar17 = e.getValOnce(e.eVar17, 's_eVar17'), digitalData.page.search && 'Zero' == digitalData.page.search.noOfResults && (e.events = e.apl(e.events, 'event34', ',', 2)), e.prop25 = e.getDaysSinceLastVisit('s_lv'), e.prop22 = e.getNewRepeat(30, 's_getNewRepeat'), e.prop10 = e.getPreviousValue(e.pageName, 'gpv', ''), e.prop10 && (e.eVar25 = 'D=c10', e.prop11 = e.getPercentPageViewed(), e.prop10 && 'no value' != e.prop10 || (e.prop11 = '')), e.eVar32 = e.prop3 = getTimeParting('America/Los_Angeles'), e.eVar5 = e.pageName, e.prop13 = window.location.href, e.linkTrackVars = n(e.linkTrackVars, 'eVar5'), e.linkTrackVars = n(e.linkTrackVars, 'prop13'), console.log('*** Both' + e.eVar5 + e.prop13); + }, t.split = new Function('l', 'd', 'var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x++]=l.substring(0,i);l=l.substring(i+d.length);}return a'), t.getPercentPageViewed = new Function('n', 'var s=this,W=window,EL=W.addEventListener,AE=W.attachEvent,E=[\'load\',\'unload\',\'scroll\',\'resize\',\'zoom\',\'keyup\',\'mouseup\',\'touchend\',\'orientationchange\',\'pan\'];W.s_Obj=s;s_PPVid=(n==\'-\'?s.pageName:n)||s.pageName||location.href;if(!W.s_PPVevent){s.s_PPVg=function(n,r){var k=\'s_ppv\',p=k+\'l\',c=s.c_r(n||r?k:p),a=c.indexOf(\',\')>-1?c.split(\',\',10):[\'\'],l=a.length,i;a[0]=unescape(a[0]);r=r||(n&&n!=a[0])||0;a.length=10;if(typeof a[0]!=\'string\')a[0]=\'\';for(i=1;i<10;i++)a[i]=!r&&i0&&b>0?M.round(C*b/h):0,O=W.orientation,o=!isNaN(O)?M.abs(o)%180:Y>X?0:90,L=e==\'load\'||s_PPVi<1,a=s.s_PPVg(s_PPVid,L),V=function(i,v,f,n){i=parseInt(typeof a==J&&a.length>i?a[i]:\'0\')||0;v=typeof v!=N?i:v;v=f||v>i?v:i;return n?v:v>C?C:v<0?0:v};if(new RegExp(\'(iPod|iPad|iPhone)\').exec(navigator.userAgent||\'\')&&o){o=x;x=y;y=o}o=o?\'P\':\'L\';a[9]=L?\'\':a[9].substring(0,1);s.c_w(\'s_ppv\',escape(W.s_PPVid)+\',\'+V(1,p,L)+\',\'+(L||!V(2)?p:V(2))+\',\'+V(3,b,L,1)+\',\'+X+\',\'+Y+\',\'+x+\',\'+y+\',\'+r+\',\'+a[9]+(a[9]==o?\'\':o))}if(!W.s_PPVt&&e!=\'unload\')W.s_PPVt=setTimeout(W.s_PPVevent,333)};for(var f=W.s_PPVevent,i=0;i-1?t.substring(0,t.indexOf(\'#\')):t;}if(t)v+=v?d+t:t;p=p.substring(i==p.length?i:i+1)}return v'), t.p_gpv = new Function('k', 'u', 'var s=this,v=\'\',i=u.indexOf(\'?\'),q;if(k&&i>-1){q=u.substring(i+1);v=s.pt(q,\'&\',\'p_gvf\',k)}return v'), t.p_gvf = new Function('t', 'k', 'if(t){var s=this,i=t.indexOf(\'=\'),p=i<0?t:t.substring(0,i),v=i<0?\'True\':t.substring(i+1);if(p.toLowerCase()==k.toLowerCase())return s.epa(v)}return \'\''), t.getDaysSinceLastVisit = new Function('c', 'var s=this,e=new Date(),es=new Date(),cval,cval_s,cval_ss,ct=e.getTime(),day=24*60*60*1000,f1,f2,f3,f4,f5;e.setTime(ct+3*365*day);es.setTime(ct+30*60*1000);f0=\'Cookies Not Supported\';f1=\'First Visit\';f2=\'More than 30 days\';f3=\'More than 7 days\';f4=\'Less than 7 days\';f5=\'Less than 1 day\';cval=s.c_r(c);if(cval.length==0){s.c_w(c,ct,e);s.c_w(c+\'_s\',f1,es);}else{var d=ct-cval;if(d>30*60*1000){if(d>30*day){s.c_w(c,ct,e);s.c_w(c+\'_s\',f2,es);}else if(d<30*day+1 && d>7*day){s.c_w(c,ct,e);s.c_w(c+\'_s\',f3,es);}else if(d<7*day+1 && d>day){s.c_w(c,ct,e);s.c_w(c+\'_s\',f4,es);}else if(d\n\n\n', + language: 'html' + } + }] + }, + { + id: 'RLc522f653f5834c98b70bbd97a1faefcb', + name: 'JobApplication:RequestInfo', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'requestInformationalButtonClick' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%eventData:jobId%' + }, + { + name: 'eVar62', + type: 'value', + value: '%eventData:peopleSoftId%' + } + ], + events: [{ name: 'event97' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Request Information', + linkType: 'o' + } + } + ] + }, + { + id: 'RLa5a0695e007f44edac2f4787ebb36b5a', + name: 'passport:UpdatePasswordExit', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportUpdatePasswordExit' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event46' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RL1971538d3b9a4153a93ca18b043906ca', + name: 'content:LinkClick', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'linkClick' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar21', + type: 'value', + value: '%content:LinkName%' + }], + props: [{ + name: 'prop23', + type: 'value', + value: '%content:LinkName%' + }], + events: [{ name: 'event37' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Link Click', + linkType: 'o' + } + } + ] + }, + { + id: 'RL634df6be748249e3a5bf6a608f26d876', + name: 'jobApplication:Dashboard Views', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'jobApplicationViews' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar28', + type: 'value', + value: '%content:personID%' + }], + events: [{ name: 'event20' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Job Application Dashboard Views', + linkType: 'o' + } + } + ] + }, + { + id: 'RL772d010eb269423fae7b6cbc0a76450e', + name: 'CZ Landing Page - RMK tag', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + if ('https://www.amazon.jobs/cs/landing_pages/prace' == document.location.href) + return !0; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n\n\n\n', + language: 'html' + } + }] + }, + { + id: 'RL4a99811306d842838663a7dd16ad3bbf', + name: 'SMS Error', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'SMS Error' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar54', + type: 'value', + value: '%SMS:SiteError %' + }, + { + name: 'eVar89', + type: 'value', + value: '%User Status%' + }, + { + name: 'eVar99', + type: 'value', + value: '%SMS:Stepname%' + } + ], + events: [{ name: 'event118' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMS Error', + linkType: 'o' + } + } + ] + }, + { + id: 'RL86d8254f4cf04a7caeb7e4a4714955f6', + name: 'JobSearch:JobSearchResults', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'search' }, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + return console.log(JSON.stringify(digitalData, null, '\t')), !0; + } + } + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + console.log(JSON.stringify(digitalData, null, '\t')), t.linkTrackVars = 'events,eVar7,eVar8,prop21', t.linkTrackEvents = 'event3,event7,event34', console.log(_satellite.getVar('JobSearch:NoOfResults') + 'fired'), 'zero' == _satellite.getVar('JobSearch:NoOfResults') ? t.events = t.apl(t.events, 'event34', ',', 1) : t.events = t.apl(t.events, 'event7', ',', 1); + } + }, + trackerProperties: { + eVars: [ + { + name: 'eVar7', + type: 'value', + value: '%JobSearch:SearchTerm%' + }, + { + name: 'eVar8', + type: 'value', + value: '%JobSearch:NoOfResults%' + }, + { + name: 'eVar28', + type: 'value', + value: '%content:personID%' + } + ], + props: [{ + name: 'prop21', + type: 'value', + value: '%JobSearch:SearchTerm%' + }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { type: 'page' } + } + ] + }, + { + id: 'RLb2ba54e51db34f758e32df027cee7243', + name: 'passport:AccountConfirmed', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportAccountConfirmed' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event42' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RL55cbb8ed88664bcfb663ec312ed9a018', + name: 'User:Login Start', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'loginStart' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event1' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Login Start', + linkType: 'o' + } + } + ] + }, + { + id: 'RL85e6e72a26844cf3aeac2a019d6cf295', + name: 'passport:SocialLoginSuccessAlreadyLinked', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportSocialLoginSuccessAlreadyLinked' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar5', + type: 'value', + value: '%content:PageName%' + }, + { + name: 'eVar4', + type: 'value', + value: '%content:userType%' + }, + { + name: 'eVar30', + type: 'value', + value: '%content:userID%' + }, + { + name: 'eVar14', + type: 'value', + value: '%campaign%' + } + ], + props: [{ + name: 'prop40', + type: 'value', + value: '%passportEventParams%' + }], + events: [{ name: 'event74' }], + channel: '%content:SiteSection%', + pageName: '%content:PageName%' + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RL5e8d195c830b4291a62a04977952626a', + name: 'SMS Verify Number', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'SMS Verify Number' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar89', + type: 'value', + value: '%User Status%' + }, + { + name: 'eVar99', + type: 'value', + value: '%SMS:Stepname%' + } + ], + events: [{ name: 'event134' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'SMS Verify Number', + linkType: 'o' + } + } + ] + }, + { + id: 'RLce3cd5cff8e4410eb6fed0ceba267106', + name: 'passport:ConfirmPasswordInputError', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportConfirmPasswordInputError' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { trackerProperties: { events: [{ name: 'event56' }] } } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RLc83b33e80b6d443f8447a3fc6a677bc5', + name: 'PL Landing Page - Pixel', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/customCode.js', + settings: { + source: function () { + if ('https://www.amazon.jobs/pl/landing_pages/praca' == document.location.href || 'https://www.amazon.jobs/pl/landing_pages/praca-katowice' == document.location.href || 'https://www.amazon.jobs/pl/landing_pages/praca-wroclaw' == document.location.href || 'https://www.amazon.jobs/pl/landing_pages/praca-lodz' == document.location.href || 'https://www.amazon.jobs/pl/landing_pages/praca-Szczecin' == document.location.href || 'https://www.amazon.jobs/pl/landing_pages/praca-poznan' == document.location.href || 'https://www.amazon.jobs/pl/landing_pages/praca-swiebodzin' == document.location.href) + return !0; + } + } + }], + actions: [{ + modulePath: 'core/src/lib/actions/customCode.js', + settings: { + source: '\n\n\n', + language: 'html' + } + }] + }, + { + id: 'RL22c83110687b413fbde50fa3bf84d8b6', + name: 'unsubscribe:unsubscribe', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'unsubscribe' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar39', + type: 'value', + value: '%Opt Out: System%' + }, + { + name: 'eVar40', + type: 'value', + value: '%Opt Out: Source%' + }, + { + name: 'eVar41', + type: 'value', + value: '%Opt Out: Beamery Campaign ID%' + }, + { + name: 'eVar42', + type: 'value', + value: '%Opt Out: Beamery Conversation ID%' + } + ], + events: [{ name: 'event53' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Unsubscribe', + linkType: 'o' + } + } + ] + }, + { + id: 'RLffe106ce62a74c80be793979c49eead0', + name: 'Marketing:SocialClicks', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'socialShare' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar3', + type: 'value', + value: '%Marketing: SocialPlatform%' + }], + events: [{ name: 'event4' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Social Clicks', + linkType: 'o' + } + } + ] + }, + { + id: 'RL98b8cab8830d4c179d7d5e4d6546a468', + name: 'passport:SocialLoginInitiated', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'passportSocialLoginInitiated' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar5', + type: 'value', + value: '%content:PageName%' + }, + { + name: 'eVar4', + type: 'value', + value: '%content:userType%' + }, + { + name: 'eVar30', + type: 'value', + value: '%content:userID%' + }, + { + name: 'eVar14', + type: 'value', + value: '%campaign%' + } + ], + props: [{ + name: 'prop40', + type: 'value', + value: '%passportEventParams%' + }], + events: [{ name: 'event70' }], + channel: '%content:SiteSection%', + pageName: '%content:PageName%' + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Passport Events', + linkType: 'o' + } + } + ] + }, + { + id: 'RL4a1865abd63a4d679fef02409393d956', + name: 'Career day rule', + events: [{ + modulePath: 'core/src/lib/events/pageBottom.js', + settings: {}, + ruleOrder: 50 + }], + conditions: [{ + modulePath: 'core/src/lib/conditions/domain.js', + settings: { + domains: [ + 'amazon.jobs', + 'passport.amazon.work' + ] + }, + negate: !0 + }], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + customSetup: { + source: function (e, t) { + function n() { + if (!window.s_loadT) { + var e = new Date().getTime(), t = window.performance ? performance.timing : 0, n = t ? t.requestStart : window.inHeadTS || 0; + s_loadT = n ? Math.round((e - n) / 100) : ''; + } + return s_loadT; + } + var a = Visitor.getInstance('4EE1BB6555F9369A7F000101@AdobeOrg').getMarketingCloudVisitorID(); + a && (t.eVar6 = a), t.prop5 = 'undefined' != typeof Visitor ? 'VisitorAPI Present' : 'VisitorAPI Missing', t.prop2 = 'D=t', window.location.href.indexOf('404') > 0 && (t.pageType = 'errorPage'), t.eVar15 = window.location.hostname, t.eVar16 = window.location.pathname, t.prop13 = window.location.href, t.prop14 = n(), t.prop17 = 'D=j', t.prop18 = document.title; + var i = location.search.split('='), r = i[0].substr(1, i[0].length); + t.prop19 = r, t.usePlugins = !0, t.doPlugins = function (e) { + e.pageName = s(), e.Util.getQueryParam('utm_medium') && (e.eVar17 = e.Util.getQueryParam('utm_medium') + ':' + e.Util.getQueryParam('utm_source') + ':' + e.Util.getQueryParam('utm_term') + ':' + e.Util.getQueryParam('utm_content')), e.eVar17 = e.getValOnce(e.eVar17, 's_eVar17'), e.prop25 = e.getDaysSinceLastVisit('s_lv'), e.prop22 = e.getNewRepeat(30, 's_getNewRepeat'), e.prop10 = e.getPreviousValue(e.pageName, 'gpv', ''), e.prop10 && (e.eVar25 = 'D=c10', e.prop11 = e.getPercentPageViewed(), e.prop10 && 'no value' != e.prop10 || (e.prop11 = '')), e.eVar32 = e.prop3 = e.getTimeParting('n', '-8'); + }, t._tpDST = { + 2012: '4/1,10/7', + 2013: '4/7,10/6', + 2014: '4/6,10/5', + 2015: '4/5,10/4', + 2016: '4/3,10/2', + 2017: '4/2,10/1', + 2018: '4/1,10/7', + 2019: '4/7,10/6', + 2020: '4/5,10/4', + 2021: '4/4,10/3' + }, t._tpDST = { + 2012: '3/11,11/4', + 2013: '3/10,11/3', + 2014: '3/9,11/2', + 2015: '3/8,11/1', + 2016: '3/13,11/6', + 2017: '3/12,11/5', + 2018: '3/11,11/4', + 2019: '3/10,11/3', + 2020: '3/8,11/1', + 2021: '3/14,11/7' + }, t._tpDST = { + 2012: '3/25,10/28', + 2013: '3/31,10/27', + 2014: '3/30,10/26', + 2015: '3/29,10/25', + 2016: '3/27,10/30', + 2017: '3/26,10/29', + 2018: '3/25,10/28', + 2019: '3/31,10/27', + 2020: '3/29,10/25', + 2021: '3/28,10/31' + }, t.getPreviousValue = new Function('v', 'c', 'el', 'var s=this,t=new Date,i,j,r=\'\';t.setTime(t.getTime()+1800000);if(el){if(s.events){i=s.split(el,\',\');j=s.split(s.events,\',\');for(x in i){for(y in j){if(i[x]==j[y]){if(s.c_r(c)) r=s.c_r(c);v?s.c_w(c,v,t):s.c_w(c,\'no value\',t);return r}}}}}else{if(s.c_r(c)) r=s.c_r(c);v?s.c_w(c,v,t):s.c_w(c,\'no value\',t);return r}'); + var s = function (e, t, n, a) { + var i = location.hostname, r = location.pathname.substring(1).split('/'), s = r.length, o = location.search.substring(1).split('&'), c = o.length, l = location.hash.substring(1).split('&'), u = l.length; + if (a = a || ': ', e = e || i, t = t || '', n = n || '', 1 === s && '' === r[0]) + e = e + a + 'home'; + else + for (i = 0; i < s; i++) + e = e + a + decodeURIComponent(r[i]); + if (t && (1 !== c || '' !== o[0])) + for (s = (r = t.split(',')).length, i = 0; i < s; i++) + for (t = 0; t < c; t++) + if (r[i] === o[t].split('=')[0]) { + e = e + a + decodeURIComponent(o[t]); + break; + } + if (n && (1 !== u || '' !== l[0])) + for (o = (n = n.split(',')).length, i = 0; i < o; i++) + for (t = 0; t < u; t++) + if (n[i] === l[t].split('=')[0]) { + e = e + a + decodeURIComponent(l[t]); + break; + } + return e.substring(e.length - a.length) === a ? e.substring(0, e.length - a.length) : e; + }; + t.split = new Function('l', 'd', 'var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x++]=l.substring(0,i);l=l.substring(i+d.length);}return a'), t.getPercentPageViewed = new Function('n', 'var s=this,W=window,EL=W.addEventListener,AE=W.attachEvent,E=[\'load\',\'unload\',\'scroll\',\'resize\',\'zoom\',\'keyup\',\'mouseup\',\'touchend\',\'orientationchange\',\'pan\'];W.s_Obj=s;s_PPVid=(n==\'-\'?s.pageName:n)||s.pageName||location.href;if(!W.s_PPVevent){s.s_PPVg=function(n,r){var k=\'s_ppv\',p=k+\'l\',c=s.c_r(n||r?k:p),a=c.indexOf(\',\')>-1?c.split(\',\',10):[\'\'],l=a.length,i;a[0]=unescape(a[0]);r=r||(n&&n!=a[0])||0;a.length=10;if(typeof a[0]!=\'string\')a[0]=\'\';for(i=1;i<10;i++)a[i]=!r&&i0&&b>0?M.round(C*b/h):0,O=W.orientation,o=!isNaN(O)?M.abs(o)%180:Y>X?0:90,L=e==\'load\'||s_PPVi<1,a=s.s_PPVg(s_PPVid,L),V=function(i,v,f,n){i=parseInt(typeof a==J&&a.length>i?a[i]:\'0\')||0;v=typeof v!=N?i:v;v=f||v>i?v:i;return n?v:v>C?C:v<0?0:v};if(new RegExp(\'(iPod|iPad|iPhone)\').exec(navigator.userAgent||\'\')&&o){o=x;x=y;y=o}o=o?\'P\':\'L\';a[9]=L?\'\':a[9].substring(0,1);s.c_w(\'s_ppv\',escape(W.s_PPVid)+\',\'+V(1,p,L)+\',\'+(L||!V(2)?p:V(2))+\',\'+V(3,b,L,1)+\',\'+X+\',\'+Y+\',\'+x+\',\'+y+\',\'+r+\',\'+a[9]+(a[9]==o?\'\':o))}if(!W.s_PPVt&&e!=\'unload\')W.s_PPVt=setTimeout(W.s_PPVevent,333)};for(var f=W.s_PPVevent,i=0;ids&&dde||d=12){U=\' PM\';H=H-12;}if(H==0){H=12;}D=da[D];tm=H+\':\'+M+U;return(tm+\'|\'+D);}'), t.getNewRepeat = new Function('d', 'cn', 'var s=this,e=new Date(),cval,sval,ct=e.getTime();d=d?d:30;cn=cn?cn:\'s_nr\';e.setTime(ct+d*24*60*60*1000);cval=s.c_r(cn);if(cval.length==0){s.c_w(cn,ct+\'-New\',e);return\'New\';}sval=s.split(cval,\'-\');if(ct-sval[0]<30*60*1000&&sval[1]==\'New\'){s.c_w(cn,ct+\'-New\',e);return\'New\';}else{s.c_w(cn,ct+\'-Repeat\',e);return\'Repeat\';}'), t.split = new Function('l', 'd', 'var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x++]=l.substring(0,i);l=l.substring(i+d.length);}return a'), t.getValOnce = new Function('v', 'c', 'e', 't', 'var s=this,a=new Date,v=v?v:\'\',c=c?c:\'s_gvo\',e=e?e:0,i=t==\'m\'?60000:86400000,k=s.c_r(c);if(v){a.setTime(a.getTime()+e*i);s.c_w(c,v,e==0?0:a);}return v==k?\'\':v'), t.apl = new Function('l', 'v', 'd', 'u', 'var s=this,m=0;if(!l)l=\'\';if(u){var i,n,a=s.split(l,d);for(i=0;i-1?t.substring(0,t.indexOf(\'#\')):t;}if(t)v+=v?d+t:t;p=p.substring(i==p.length?i:i+1)}return v'), t.p_gpv = new Function('k', 'u', 'var s=this,v=\'\',i=u.indexOf(\'?\'),q;if(k&&i>-1){q=u.substring(i+1);v=s.pt(q,\'&\',\'p_gvf\',k)}return v'), t.p_gvf = new Function('t', 'k', 'if(t){var s=this,i=t.indexOf(\'=\'),p=i<0?t:t.substring(0,i),v=i<0?\'True\':t.substring(i+1);if(p.toLowerCase()==k.toLowerCase())return s.epa(v)}return \'\''), t.getDaysSinceLastVisit = new Function('c', 'var s=this,e=new Date(),es=new Date(),cval,cval_s,cval_ss,ct=e.getTime(),day=24*60*60*1000,f1,f2,f3,f4,f5;e.setTime(ct+3*365*day);es.setTime(ct+30*60*1000);f0=\'Cookies Not Supported\';f1=\'First Visit\';f2=\'More than 30 days\';f3=\'More than 7 days\';f4=\'Less than 7 days\';f5=\'Less than 1 day\';cval=s.c_r(c);if(cval.length==0){s.c_w(c,ct,e);s.c_w(c+\'_s\',f1,es);}else{var d=ct-cval;if(d>30*60*1000){if(d>30*day){s.c_w(c,ct,e);s.c_w(c+\'_s\',f2,es);}else if(d<30*day+1 && d>7*day){s.c_w(c,ct,e);s.c_w(c+\'_s\',f3,es);}else if(d<7*day+1 && d>day){s.c_w(c,ct,e);s.c_w(c+\'_s\',f4,es);}else if(d 0) + return !0; + } + } + }, + { + modulePath: 'core/src/lib/conditions/domain.js', + settings: { domains: ['amazon.jobs'] } + } + ], + actions: [{ + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [{ + name: 'eVar51', + type: 'value', + value: '%banner:destinURL%' + }], + events: [{ name: 'event32' }] + } + } + }] + }, + { + id: 'RLb34590eed93e4c0cb206de398bb56bc8', + name: 'JobApplication:RequestInfoProceed', + events: [{ + modulePath: 'core/src/lib/events/directCall.js', + settings: { identifier: 'proceedButtonClick' }, + ruleOrder: 50 + }], + conditions: [], + actions: [ + { + modulePath: 'adobe-analytics/src/lib/actions/clearVariables.js', + settings: {} + }, + { + modulePath: 'adobe-analytics/src/lib/actions/setVariables.js', + settings: { + trackerProperties: { + eVars: [ + { + name: 'eVar1', + type: 'value', + value: '%eventData:jobId%' + }, + { + name: 'eVar62', + type: 'value', + value: '%eventData:peopleSoftId%' + } + ], + events: [{ name: 'event98' }] + } + } + }, + { + modulePath: 'adobe-analytics/src/lib/actions/sendBeacon.js', + settings: { + type: 'link', + linkName: 'Request Information | Proceed', + linkType: 'o' + } + } + ] + } + ] + }; + var $___var_ab0e8b17bca56090 = function () { + 'use strict'; + function e(e) { + if (null == e) + throw new TypeError('Object.assign cannot be called with null or undefined'); + return Object(e); + } + function t() { + try { + if (!Object.assign) + return !1; + var e = new String('abc'); + if (e[5] = 'de', '5' === Object.getOwnPropertyNames(e)[0]) + return !1; + for (var t = {}, n = 0; n < 10; n++) + t['_' + String.fromCharCode(n)] = n; + if ('0123456789' !== Object.getOwnPropertyNames(t).map(function (e) { + return t[e]; + }).join('')) + return !1; + var a = {}; + return 'abcdefghijklmnopqrst'.split('').forEach(function (e) { + a[e] = e; + }), 'abcdefghijklmnopqrst' === Object.keys(Object.assign({}, a)).join(''); + } catch (e) { + return !1; + } + } + function n(e) { + if (e.__esModule) + return e; + var t = Object.defineProperty({}, '__esModule', { value: !0 }); + return Object.keys(e).forEach(function (n) { + var a = Object.getOwnPropertyDescriptor(e, n); + Object.defineProperty(t, n, a.get ? a : { + enumerable: !0, + get: function () { + return e[n]; + } + }); + }), t; + } + function a(e) { + var t = { exports: {} }; + return e(t, t.exports), t.exports; + } + function i(e) { + var t = this.constructor; + return this.then(function (n) { + return t.resolve(e()).then(function () { + return n; + }); + }, function (n) { + return t.resolve(e()).then(function () { + return t.reject(n); + }); + }); + } + function r(e) { + return Boolean(e && void 0 !== e.length); + } + function s() { + } + function o(e, t) { + return function () { + e.apply(t, arguments); + }; + } + function c(e) { + if (!(this instanceof c)) + throw new TypeError('Promises must be constructed via new'); + if ('function' != typeof e) + throw new TypeError('not a function'); + this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], m(e, this); + } + function l(e, t) { + for (; 3 === e._state;) + e = e._value; + 0 !== e._state ? (e._handled = !0, c._immediateFn(function () { + var n = 1 === e._state ? t.onFulfilled : t.onRejected; + if (null !== n) { + var a; + try { + a = n(e._value); + } catch (e) { + return void d(t.promise, e); + } + u(t.promise, a); + } else + (1 === e._state ? u : d)(t.promise, e._value); + })) : e._deferreds.push(t); + } + function u(e, t) { + try { + if (t === e) + throw new TypeError('A promise cannot be resolved with itself.'); + if (t && ('object' == typeof t || 'function' == typeof t)) { + var n = t.then; + if (t instanceof c) + return e._state = 3, e._value = t, void p(e); + if ('function' == typeof n) + return void m(o(n, t), e); + } + e._state = 1, e._value = t, p(e); + } catch (t) { + d(e, t); + } + } + function d(e, t) { + e._state = 2, e._value = t, p(e); + } + function p(e) { + 2 === e._state && 0 === e._deferreds.length && c._immediateFn(function () { + e._handled || c._unhandledRejectionFn(e._value); + }); + for (var t = 0, n = e._deferreds.length; t < n; t++) + l(e, e._deferreds[t]); + e._deferreds = null; + } + function f(e, t, n) { + this.onFulfilled = 'function' == typeof e ? e : null, this.onRejected = 'function' == typeof t ? t : null, this.promise = n; + } + function m(e, t) { + var n = !1; + try { + e(function (e) { + n || (n = !0, u(t, e)); + }, function (e) { + n || (n = !0, d(t, e)); + }); + } catch (e) { + if (n) + return; + n = !0, d(t, e); + } + } + function g(e) { + return !0 === Ye(e) && '[object Object]' === Object.prototype.toString.call(e); + } + function b(e, t) { + return Object.prototype.hasOwnProperty.call(e, t); + } + function v(e) { + return 'string' == typeof e && -1 !== e.indexOf('[') && -1 !== e.indexOf(']'); + } + function h(e) { + return e.substr(0, e.indexOf('[')); + } + function y(e, t, n) { + if (e.length && Qe(t)) { + var a = e[0]; + if (1 !== e.length) { + var i = e.slice(1); + if (!v(a)) + return y(i, t[a], n); + var r = t[a = h(a)]; + Array.isArray(r) && r.forEach(function (e) { + return y(i, e, n); + }); + } else + t.hasOwnProperty(a) && 'string' == typeof t[a] && (t[a] = n(t[a])); + } + } + if (window.atob) { + var _ = document, P = Object.getOwnPropertySymbols, S = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable, k = t() ? Object.assign : function (t) { + for (var n, a, i = e(t), r = 1; r < arguments.length; r++) { + for (var s in n = Object(arguments[r])) + S.call(n, s) && (i[s] = n[s]); + if (P) { + a = P(n); + for (var o = 0; o < a.length; o++) + C.call(n, a[o]) && (i[a[o]] = n[a[o]]); + } + } + return i; + }, j = k, w = window, D = function (e, t, n) { + var a, i = Array.isArray(t), r = Boolean(i && e), s = document.createElement('a'); + if (s.href = e, (!/^https?:\/\/.*/.test(e) || !s.host) && i) { + var o = new Error('Unable to find the Library Embed Code for Dynamic Host Resolution.'); + throw o.code = 'dynamic_host_resolver_constructor_error', o; + } + if (i && -1 === t.indexOf(s.hostname)) { + var c = new Error('This library is not authorized for this domain. Please contact your CSM for more information.'); + throw c.code = 'dynamic_host_not_allowed', c; + } + var l = function () { + if (null != a) + return a; + if (r) { + var e = s.host; + /:80$/.test(e) ? e = e.replace(':80', '') : /:80\/$/.test(e) ? e = e.replace(':80/', '') : /:443$/.test(e) ? e = e.replace(':443', '') : /:443\/$/.test(e) && (e = e.replace(':443/', '')), a = 'https://' + e; + } else + a = ''; + return a; + }, u = function (e) { + return r && 'string' == typeof e ? [ + l(), + '/' === e.charAt(0) ? e.slice(1) : e + ].join('/') : e; + }, d = { + getTurbineHost: l, + decorateWithDynamicHost: u, + get isDynamicEnforced() { + return i; + } + }; + return w && n.onDebugChanged(function (e) { + e ? w.dynamicHostResolver = d : delete w.dynamicHostResolver; + }), d; + }, V = function (e) { + var t = []; + return e.forEach(function (e) { + e.events && e.events.forEach(function (n) { + t.push({ + rule: e, + event: n + }); + }); + }), t.sort(function (e, t) { + return e.event.ruleOrder - t.event.ruleOrder; + }); + }, I = 'debug', T = function (e, t) { + var n = function () { + return 'true' === e.getItem(I); + }, a = function (t) { + e.setItem(I, t); + }, i = [], r = function (e) { + i.push(e); + }; + return t.outputEnabled = n(), { + onDebugChanged: r, + getDebugEnabled: n, + setDebugEnabled: function (e) { + n() !== e && (a(e), t.outputEnabled = e, i.forEach(function (t) { + t(e); + })); + } + }; + }, E = 'Module did not export a function.', O = function (e, t, n) { + return function (a, i, r) { + r = r || []; + var s = e.getModuleExports(a.modulePath); + if ('function' != typeof s) + throw new Error(E); + var o = e.getModuleDefinition(a.modulePath), c = a.settings || {}; + !a.hasTransformedFilePaths && o.filePaths && (n(c, o.filePaths, a.modulePath), a.hasTransformedFilePaths = !0); + var l = t(c, i); + return s.bind(null, l).apply(null, r); + }; + }, A = function (e) { + return 'string' == typeof e ? e.replace(/\s+/g, ' ').trim() : e; + }, M = { + LOG: 'log', + INFO: 'info', + DEBUG: 'debug', + WARN: 'warn', + ERROR: 'error' + }, L = '\uD83D\uDE80', N = 10 === parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1]) ? '[Launch]' : L, x = !1, R = function (e) { + if (x && window.console) { + var t = Array.prototype.slice.call(arguments, 1); + t.unshift(N), e !== M.DEBUG || window.console[e] || (e = M.INFO), window.console[e].apply(window.console, t); + } + }, F = R.bind(null, M.LOG), B = R.bind(null, M.INFO), U = R.bind(null, M.DEBUG), H = R.bind(null, M.WARN), z = R.bind(null, M.ERROR), W = function () { + var e = x; + x = !0, R.apply(null, Array.prototype.concat(M.WARN, Array.prototype.slice.call(arguments))), e || (x = !1); + }, J = { + log: F, + info: B, + debug: U, + warn: H, + error: z, + deprecation: W, + get outputEnabled() { + return x; + }, + set outputEnabled(e) { + x = e; + }, + createPrefixedLogger: function (e) { + var t = '[' + e + ']'; + return { + log: F.bind(null, t), + info: B.bind(null, t), + debug: U.bind(null, t), + warn: H.bind(null, t), + error: z.bind(null, t) + }; + } + }, q = 'undefined' != typeof globalThis ? globalThis : 'undefined' != typeof window ? window : 'undefined' != typeof global ? global : 'undefined' != typeof self ? self : {}, G = a(function (e) { + !function (t) { + if (e.exports = t(), !!0) { + var n = window.Cookies, a = window.Cookies = t(); + a.noConflict = function () { + return window.Cookies = n, a; + }; + } + }(function () { + function e() { + for (var e = 0, t = {}; e < arguments.length; e++) { + var n = arguments[e]; + for (var a in n) + t[a] = n[a]; + } + return t; + } + function t(e) { + return e.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); + } + function n(a) { + function i() { + } + function r(t, n, r) { + if ('undefined' != typeof document) { + 'number' == typeof (r = e({ path: '/' }, i.defaults, r)).expires && (r.expires = new Date(1 * new Date() + 86400000 * r.expires)), r.expires = r.expires ? r.expires.toUTCString() : ''; + try { + var s = JSON.stringify(n); + /^[\{\[]/.test(s) && (n = s); + } catch (e) { + } + n = a.write ? a.write(n, t) : encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent), t = encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape); + var o = ''; + for (var c in r) + r[c] && (o += '; ' + c, !0 !== r[c] && (o += '=' + r[c].split(';')[0])); + return document.cookie = t + '=' + n + o; + } + } + function s(e, n) { + if ('undefined' != typeof document) { + for (var i = {}, r = document.cookie ? document.cookie.split('; ') : [], s = 0; s < r.length; s++) { + var o = r[s].split('='), c = o.slice(1).join('='); + n || '"' !== c.charAt(0) || (c = c.slice(1, -1)); + try { + var l = t(o[0]); + if (c = (a.read || a)(c, l) || t(c), n) + try { + c = JSON.parse(c); + } catch (e) { + } + if (i[l] = c, e === l) + break; + } catch (e) { + } + } + return e ? i[e] : i; + } + } + return i.set = r, i.get = function (e) { + return s(e, !1); + }, i.getJSON = function (e) { + return s(e, !0); + }, i.remove = function (t, n) { + r(t, '', e(n, { expires: -1 })); + }, i.defaults = {}, i.withConverter = n, i; + } + return n(function () { + }); + }); + }), Y = { + get: G.get, + set: G.set, + remove: G.remove + }, Q = 'com.adobe.reactor.', $ = function (e, t) { + var n = Q + (t || ''); + return { + getItem: function (t) { + const $___old_406b84ff93dd2b7b = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'), $___old_1e339b34ccaaf45e = {}.constructor.getOwnPropertyDescriptor(window, 'sessionStorage'); + try { + if ($___old_406b84ff93dd2b7b) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_53ae6ebfdece7690.localStorage)); + if ($___old_1e339b34ccaaf45e) + ({}.constructor.defineProperty(window, 'sessionStorage', $___mock_53ae6ebfdece7690.sessionStorage)); + return function () { + try { + return w[e].getItem(n + t); + } catch (e) { + return null; + } + }.apply(this, arguments); + } finally { + if ($___old_406b84ff93dd2b7b) + ({}.constructor.defineProperty(window, 'localStorage', $___old_406b84ff93dd2b7b)); + if ($___old_1e339b34ccaaf45e) + ({}.constructor.defineProperty(window, 'sessionStorage', $___old_1e339b34ccaaf45e)); + } + }, + setItem: function (t, a) { + const $___old_e57c813343da9b0d = {}.constructor.getOwnPropertyDescriptor(window, 'localStorage'); + try { + if ($___old_e57c813343da9b0d) + ({}.constructor.defineProperty(window, 'localStorage', $___mock_53ae6ebfdece7690.localStorage)); + return function () { + try { + return w[e].setItem(n + t, a), !0; + } catch (e) { + return !1; + } + }.apply(this, arguments); + } finally { + if ($___old_e57c813343da9b0d) + ({}.constructor.defineProperty(window, 'localStorage', $___old_e57c813343da9b0d)); + } + } + }; + }, K = '_sdsat_', X = 'dataElements.', Z = 'dataElementCookiesMigrated', ee = $('localStorage'), te = $('sessionStorage', X), ne = $('localStorage', X), ae = { + PAGEVIEW: 'pageview', + SESSION: 'session', + VISITOR: 'visitor' + }, ie = {}, re = function (e) { + var t; + try { + t = JSON.stringify(e); + } catch (e) { + } + return t; + }, se = function (e, t, n) { + var a; + switch (t) { + case ae.PAGEVIEW: + return void (ie[e] = n); + case ae.SESSION: + return void ((a = re(n)) && te.setItem(e, a)); + case ae.VISITOR: + return void ((a = re(n)) && ne.setItem(e, a)); + } + }, oe = function (e, t) { + var n = Y.get(K + e); + void 0 !== n && se(e, t, n); + }, ce = function (e) { + ee.getItem(Z) || (Object.keys(e).forEach(function (t) { + oe(t, e[t].storageDuration); + }), ee.setItem(Z, !0)); + }, le = { + setValue: se, + getValue: function (e, t) { + var n; + switch (t) { + case ae.PAGEVIEW: + return ie.hasOwnProperty(e) ? ie[e] : null; + case ae.SESSION: + return null === (n = te.getItem(e)) ? n : JSON.parse(n); + case ae.VISITOR: + return null === (n = ne.getItem(e)) ? n : JSON.parse(n); + } + }, + migrateCookieData: ce + }, ue = function (e, t, n, a) { + return 'Failed to execute data element module ' + e.modulePath + ' for data element ' + t + '. ' + n + (a ? '\n' + a : ''); + }, de = function (e, t, n, a, i) { + return function (r, s) { + var o = t(r); + if (!o) + return a ? '' : void 0; + var c, l, u = o.storageDuration; + try { + c = e.getModuleExports(o.modulePath), l = e.getModuleDefinition(o.modulePath); + } catch (e) { + return void J.error(ue(o, r, e.message, e.stack)); + } + if ('function' == typeof c) { + var d, p = o.settings || {}; + !o.hasTransformedFilePaths && l.filePaths && (i(p, l.filePaths, o.modulePath), o.hasTransformedFilePaths = !0); + try { + d = c(n(p, s), s); + } catch (e) { + return void J.error(ue(o, r, e.message, e.stack)); + } + return u && (null != d ? le.setValue(r, u, d) : d = le.getValue(r, u)), null == d && null != o.defaultValue && (d = o.defaultValue), 'string' == typeof d && (o.cleanText && (d = A(d)), o.forceLowerCase && (d = d.toLowerCase())), d; + } + J.error(ue(o, r, 'Module did not export a function.')); + }; + }, pe = { + text: function (e) { + return e.textContent; + }, + cleanText: function (e) { + return A(e.textContent); + } + }, fe = function (e, t, n) { + for (var a, i = e, r = 0, s = t.length; r < s; r++) { + if (null == i) + return; + var o = t[r]; + if (n && '@' === o.charAt(0)) { + var c = o.slice(1); + i = pe[c](i); + } else if (i.getAttribute && (a = o.match(/^getAttribute\((.+)\)$/))) { + var l = a[1]; + i = i.getAttribute(l); + } else + i = i[o]; + } + return i; + }, me = function (e, t, n) { + return function (a, i) { + var r; + if (t(a)) + r = n(a, i); + else { + var s = a.split('.'), o = s.shift(); + 'this' === o ? i && (r = fe(i.element, s, !0)) : 'event' === o ? i && (r = fe(i, s)) : 'target' === o ? i && (r = fe(i.target, s)) : r = fe(e[o], s); + } + return r; + }; + }, ge = function (e, t) { + return function (n) { + var a = n.split('.')[0]; + return Boolean(t(n) || 'this' === a || 'event' === a || 'target' === a || e.hasOwnProperty(a)); + }; + }, be = function (e, t, n) { + var a = { exports: {} }; + return e.call(a.exports, a, a.exports, t, n), a.exports; + }, ve = function () { + var e = {}, t = function (t) { + var n = e[t]; + if (!n) + throw new Error('Module ' + t + ' not found.'); + return n; + }, n = function () { + Object.keys(e).forEach(function (e) { + try { + a(e); + } catch (n) { + var t = 'Error initializing module ' + e + '. ' + n.message + (n.stack ? '\n' + n.stack : ''); + J.error(t); + } + }); + }, a = function (e) { + var n = t(e); + return n.hasOwnProperty('exports') || (n.exports = be(n.definition.script, n.require, n.turbine)), n.exports; + }; + return { + registerModule: function (t, n, a, i, r) { + var s = { + definition: n, + extensionName: a, + require: i, + turbine: r + }; + s.require = i, e[t] = s; + }, + hydrateCache: n, + getModuleExports: a, + getModuleDefinition: function (e) { + return t(e).definition; + }, + getModuleExtensionName: function (e) { + return t(e).extensionName; + } + }; + }, he = !1, ye = function (e) { + return function (t, n) { + var a = e._monitors; + a && (he || (J.warn('The _satellite._monitors API may change at any time and should only be used for debugging.'), he = !0), a.forEach(function (e) { + e[t] && e[t](n); + })); + }; + }, _e = function (e, t, n) { + var a, i, r, s, o = [], c = function (a, i, r) { + if (!e(i)) + return a; + o.push(i); + var s = t(i, r); + return o.pop(), null == s && n ? '' : s; + }; + return a = function (e, t) { + var n = /^%([^%]+)%$/.exec(e); + return n ? c(e, n[1], t) : e.replace(/%(.+?)%/g, function (e, n) { + return c(e, n, t); + }); + }, i = function (e, t) { + for (var n = {}, a = Object.keys(e), i = 0; i < a.length; i++) { + var r = a[i], o = e[r]; + n[r] = s(o, t); + } + return n; + }, r = function (e, t) { + for (var n = [], a = 0, i = e.length; a < i; a++) + n.push(s(e[a], t)); + return n; + }, s = function (e, t) { + return 'string' == typeof e ? a(e, t) : Array.isArray(e) ? r(e, t) : 'object' == typeof e && null !== e ? i(e, t) : e; + }, function (e, t) { + return o.length > 10 ? (J.error('Data element circular reference detected: ' + o.join(' -> ')), e) : s(e, t); + }; + }, Pe = function (e) { + return function () { + if ('string' == typeof arguments[0]) + e[arguments[0]] = arguments[1]; + else if (arguments[0]) { + var t = arguments[0]; + for (var n in t) + e[n] = t[n]; + } + }; + }, Se = setTimeout; + c.prototype.catch = function (e) { + return this.then(null, e); + }, c.prototype.then = function (e, t) { + var n = new this.constructor(s); + return l(this, new f(e, t, n)), n; + }, c.prototype.finally = i, c.all = function (e) { + return new c(function (t, n) { + function a(e, r) { + try { + if (r && ('object' == typeof r || 'function' == typeof r)) { + var o = r.then; + if ('function' == typeof o) + return void o.call(r, function (t) { + a(e, t); + }, n); + } + i[e] = r, 0 == --s && t(i); + } catch (e) { + n(e); + } + } + if (!r(e)) + return n(new TypeError('Promise.all accepts an array')); + var i = Array.prototype.slice.call(e); + if (0 === i.length) + return t([]); + for (var s = i.length, o = 0; o < i.length; o++) + a(o, i[o]); + }); + }, c.resolve = function (e) { + return e && 'object' == typeof e && e.constructor === c ? e : new c(function (t) { + t(e); + }); + }, c.reject = function (e) { + return new c(function (t, n) { + n(e); + }); + }, c.race = function (e) { + return new c(function (t, n) { + if (!r(e)) + return n(new TypeError('Promise.race accepts an array')); + for (var a = 0, i = e.length; a < i; a++) + c.resolve(e[a]).then(t, n); + }); + }, c._immediateFn = 'function' == typeof setImmediate && function (e) { + setImmediate(e); + } || function (e) { + Se(e, 0); + }, c._unhandledRejectionFn = function (e) { + 'undefined' != typeof console && console && console.warn('Possible Unhandled Promise Rejection:', e); + }; + var Ce = n(Object.freeze({ + __proto__: null, + default: c + })), ke = 'undefined' != typeof window && window.Promise || void 0 !== q && q.Promise || Ce.default || Ce, je = function (e, t, n) { + return function (a, i, r, s) { + return s.then(function () { + var s, o = a.delayNext; + return new ke(function (t, n) { + var i = e(a, r, [r]); + if (!o) + return t(); + var c = a.timeout, l = new ke(function (e, t) { + s = setTimeout(function () { + t(new Error('A timeout occurred because the action took longer than ' + c / 1000 + ' seconds to complete. ')); + }, c); + }); + ke.race([ + i, + l + ]).then(t, n); + }).catch(function (e) { + return clearTimeout(s), e = t(e), n(a, i, e), ke.reject(e); + }).then(function () { + clearTimeout(s); + }); + }); + }; + }, we = function (e, t, n, a, i) { + return function (r, s, o, c) { + return c.then(function () { + var c; + return new ke(function (t, n) { + var a = e(r, o, [o]), i = r.timeout, s = new ke(function (e, t) { + c = setTimeout(function () { + t(new Error('A timeout occurred because the condition took longer than ' + i / 1000 + ' seconds to complete. ')); + }, i); + }); + ke.race([ + a, + s + ]).then(t, n); + }).catch(function (e) { + return clearTimeout(c), e = t(e), a(r, s, e), ke.reject(e); + }).then(function (e) { + if (clearTimeout(c), !n(r, e)) + return i(r, s), ke.reject(); + }); + }); + }; + }, De = ke.resolve(), Ve = function (e, t, n) { + return function (a, i) { + return a.conditions && a.conditions.forEach(function (t) { + De = e(t, a, i, De); + }), a.actions && a.actions.forEach(function (e) { + De = t(e, a, i, De); + }), De = (De = De.then(function () { + n(a); + })).catch(function () { + }); + }; + }, Ie = function (e) { + return Boolean(e && 'object' == typeof e && 'function' == typeof e.then); + }, Te = function (e, t, n, a) { + return function (i, r) { + var s; + if (i.conditions) + for (var o = 0; o < i.conditions.length; o++) { + s = i.conditions[o]; + try { + var c = e(s, r, [r]); + if (Ie(c)) + throw new Error('Rule component sequencing must be enabled on the property for this condition to function properly.'); + if (!t(s, c)) + return n(s, i), !1; + } catch (e) { + return a(s, i, e), !1; + } + } + return !0; + }; + }, Ee = function (e, t) { + return function (n, a) { + e(n, a) && t(n, a); + }; + }, Oe = function (e) { + return function (t) { + var n = e.getModuleDefinition(t.modulePath); + return n && n.displayName || t.modulePath; + }; + }, Ae = function (e) { + return function (t) { + var n = t.rule, a = t.event, i = e.getModuleDefinition(a.modulePath).name; + return { + $type: e.getModuleExtensionName(a.modulePath) + '.' + i, + $rule: { + id: n.id, + name: n.name + } + }; + }; + }, Me = function (e, t, n, a, i, r) { + return function (s, o) { + var c = o.rule, l = o.event; + l.settings = l.settings || {}; + try { + var u = i(o); + t(l, null, [function (t) { + var a = n(u, t); + s(function () { + e(a, c); + }); + }]); + } catch (e) { + r.error(a(l, c, e)); + } + }; + }, Le = function (e, t, n, a) { + return function (i, r, s) { + var o = t(i); + n.error(e(o, r.name, s)), a('ruleActionFailed', { + rule: r, + action: i + }); + }; + }, Ne = function (e, t, n, a) { + return function (i, r, s) { + var o = t(i); + n.error(e(o, r.name, s)), a('ruleConditionFailed', { + rule: r, + condition: i + }); + }; + }, xe = function (e, t, n) { + return function (a, i) { + var r = e(a); + t.log('Condition "' + r + '" for rule "' + i.name + '" was not met.'), n('ruleConditionFailed', { + rule: i, + condition: a + }); + }; + }, Re = function (e, t) { + return function (n) { + e.log('Rule "' + n.name + '" fired.'), t('ruleCompleted', { rule: n }); + }; + }, Fe = function (e, t, n) { + return function (a, i) { + var r; + if (a.actions) + for (var s = 0; s < a.actions.length; s++) { + r = a.actions[s]; + try { + e(r, i, [i]); + } catch (e) { + return void t(r, a, e); + } + } + n(a); + }; + }, Be = function (e, t, n, a) { + return function (i, r) { + a('ruleTriggered', { rule: r }), e ? n(r, i) : t(r, i); + }; + }, Ue = function (e, t, n) { + return 'Failed to execute "' + e + '" for "' + t + '" rule. ' + n.message + (n.stack ? '\n' + n.stack : ''); + }, He = function (e, t) { + return t && !e.negate || !t && e.negate; + }, ze = [], We = !1, Je = function (e) { + We ? e() : ze.push(e); + }, qe = function (e, t, n) { + e(t).forEach(function (e) { + n(Je, e); + }), We = !0, ze.forEach(function (e) { + e(); + }), ze = []; + }, Ge = function (e) { + if (e || (e = new Error('The extension triggered an error, but no error information was provided.')), !(e instanceof Error)) { + var t = 'object' == typeof e ? JSON.stringify(e) : String(e); + e = new Error(t); + } + return e; + }, Ye = function (e) { + return null != e && 'object' == typeof e && !1 === Array.isArray(e); + }, Qe = function (e) { + var t, n; + return !1 !== g(e) && ('function' == typeof (t = e.constructor) && (!1 !== g(n = t.prototype) && !1 !== n.hasOwnProperty('isPrototypeOf'))); + }, $e = function (e, t) { + return Qe(t = t || {}) ? t = j({}, t, e) : j(t, e), t.hasOwnProperty('type') || Object.defineProperty(t, 'type', { + get: function () { + return J.deprecation('Accessing event.type in Adobe Launch has been deprecated and will be removed soon. Please use event.$type instead.'), t.$type; + } + }), t; + }, Ke = function (e, t) { + return function (n, a) { + var i = e[n]; + if (i) { + var r = i.modules; + if (r) + for (var s = Object.keys(r), o = 0; o < s.length; o++) { + var c = s[o], l = r[c]; + if (l.shared && l.name === a) + return t.getModuleExports(c); + } + } + }; + }, Xe = function (e, t) { + return function () { + return t ? e(t) : {}; + }; + }, Ze = function (e, t, n) { + return function (a) { + if (n) { + var i = a.split('.'); + i.splice(i.length - 1 || 1, 0, 'min'), a = i.join('.'); + } + return e(t) + a; + }; + }, et = '.js', tt = function (e) { + return e.substr(0, e.lastIndexOf('/')); + }, nt = function (e, t) { + return -1 !== e.indexOf(t, e.length - t.length); + }, at = function (e, t) { + nt(t, et) || (t += et); + var n = t.split('/'), a = tt(e).split('/'); + return n.forEach(function (e) { + e && '.' !== e && ('..' === e ? a.length && a.pop() : a.push(e)); + }), a.join('/'); + }, it = function (e, t) { + return new ke(function (n, a) { + t.onload = function () { + n(t); + }, t.onerror = function () { + a(new Error('Failed to load script ' + e)); + }; + }); + }, rt = function (e) { + var t = document.createElement('script'); + t.src = e, t.async = !0; + var n = it(e, t); + return document.getElementsByTagName('head')[0].appendChild(t), n; + }, st = function (e, t, n, a) { + t = t || '&', n = n || '='; + var i = {}; + if ('string' != typeof e || 0 === e.length) + return i; + var r = /\+/g; + e = e.split(t); + var s = 1000; + a && 'number' == typeof a.maxKeys && (s = a.maxKeys); + var o = e.length; + s > 0 && o > s && (o = s); + for (var c = 0; c < o; ++c) { + var l, u, d, p, f = e[c].replace(r, '%20'), m = f.indexOf(n); + m >= 0 ? (l = f.substr(0, m), u = f.substr(m + 1)) : (l = f, u = ''), d = decodeURIComponent(l), p = decodeURIComponent(u), b(i, d) ? Array.isArray(i[d]) ? i[d].push(p) : i[d] = [ + i[d], + p + ] : i[d] = p; + } + return i; + }, ot = function (e) { + switch (typeof e) { + case 'string': + return e; + case 'boolean': + return e ? 'true' : 'false'; + case 'number': + return isFinite(e) ? e : ''; + default: + return ''; + } + }, ct = function (e, t, n, a) { + return t = t || '&', n = n || '=', null === e && (e = void 0), 'object' == typeof e ? Object.keys(e).map(function (a) { + var i = encodeURIComponent(ot(a)) + n; + return Array.isArray(e[a]) ? e[a].map(function (e) { + return i + encodeURIComponent(ot(e)); + }).join(t) : i + encodeURIComponent(ot(e[a])); + }).join(t) : a ? encodeURIComponent(ot(a)) + n + encodeURIComponent(ot(e)) : ''; + }, lt = a(function (e, t) { + t.decode = t.parse = st, t.encode = t.stringify = ct; + }), ut = '@adobe/reactor-', dt = { + cookie: Y, + document: _, + 'load-script': rt, + 'object-assign': j, + promise: ke, + 'query-string': { + parse: function (e) { + return 'string' == typeof e && (e = e.trim().replace(/^[?#&]/, '')), lt.parse(e); + }, + stringify: function (e) { + return lt.stringify(e); + } + }, + window: w + }, pt = function (e) { + return function (t) { + if (0 === t.indexOf(ut)) { + var n = t.substr(ut.length), a = dt[n]; + if (a) + return a; + } + if (0 === t.indexOf('./') || 0 === t.indexOf('../')) + return e(t); + throw new Error('Cannot resolve module "' + t + '".'); + }; + }, ft = function (e, t, n, a, i, r, s) { + var o = e.extensions, c = e.buildInfo, l = e.environment, u = e.property.settings; + if (o) { + var d = Ke(o, t); + Object.keys(o).forEach(function (p) { + var f = o[p], m = f.settings; + Array.isArray(f.filePaths) && (m = r(m, f.filePaths)); + var g = Xe(a, m); + if (f.modules) { + var b = J.createPrefixedLogger(f.displayName), v = Ze(s, f.hostedLibFilesBaseUrl, c.minified), h = { + buildInfo: c, + environment: l, + property: { + name: e.property.name, + id: e.property.id + }, + getDataElementValue: i, + getExtensionSettings: g, + getHostedLibFileUrl: v, + getSharedModule: d, + logger: b, + propertySettings: u, + replaceTokens: a, + onDebugChanged: n.onDebugChanged, + get debugEnabled() { + return n.getDebugEnabled(); + } + }; + Object.keys(f.modules).forEach(function (e) { + var n = f.modules[e], a = pt(function (n) { + var a = at(e, n); + return t.getModuleExports(a); + }); + t.registerModule(e, n, p, a, h); + }); + } + }), t.hydrateCache(); + } + return t; + }, mt = function (e, t, n, a, i) { + var r = J.createPrefixedLogger('Custom Script'); + e.track = function (e) { + J.log('"' + e + '" does not match any direct call identifiers.'); + }, e.getVisitorId = function () { + return null; + }, e.property = { + name: t.property.name, + id: t.property.id + }, e.company = t.company, e.buildInfo = t.buildInfo, e.environment = t.environment, e.logger = r, e.notify = function (e, t) { + switch (J.deprecation('_satellite.notify is deprecated. Please use the `_satellite.logger` API.'), t) { + case 3: + r.info(e); + break; + case 4: + r.warn(e); + break; + case 5: + r.error(e); + break; + default: + r.log(e); + } + }, e.getVar = a, e.setVar = i, e.setCookie = function (e, t, n) { + var a = '', i = {}; + n && (a = ', { expires: ' + n + ' }', i.expires = n); + var r = '_satellite.setCookie is deprecated. Please use _satellite.cookie.set("' + e + '", "' + t + '"' + a + ').'; + J.deprecation(r), Y.set(e, t, i); + }, e.readCookie = function (e) { + return J.deprecation('_satellite.readCookie is deprecated. Please use _satellite.cookie.get("' + e + '").'), Y.get(e); + }, e.removeCookie = function (e) { + J.deprecation('_satellite.removeCookie is deprecated. Please use _satellite.cookie.remove("' + e + '").'), Y.remove(e); + }, e.cookie = Y, e.pageBottom = function () { + }, e.setDebug = n; + var s = !1; + Object.defineProperty(e, '_container', { + get: function () { + return s || (J.warn('_satellite._container may change at any time and should only be used for debugging.'), s = !0), t; + } + }); + }, gt = function (e) { + for (var t = _.querySelectorAll('script'), n = 0; n < t.length; n++) { + var a = t[n]; + if (e.test(a.src)) + return a; + } + }, bt = function (e, t) { + return function (n, a, i) { + return e && Qe(n) && Object.keys(n).length && Array.isArray(a) && a.length ? (a.forEach(function (e) { + Boolean(null != i && /^core\/.*actions.*\/customCode\.js$/.test(i)) && 'source' === e && !n.isExternal || y(e.split('.'), n, t); + }), n) : n; + }; + }, vt = { + getTurbine: function () { + return gt(new RegExp(/(launch|satelliteLib)-[^\/]+.js(\?.*)?$/)); + }, + byRegexPattern: gt + }.getTurbine, ht = window._satellite; + if (ht && !window.__satelliteLoaded) { + window.__satelliteLoaded = !0; + var yt = ht.container; + delete ht.container; + var _t = j({}, yt.buildInfo); + Object.defineProperty(_t, 'environment', { + get: function () { + return J.deprecation('container.buildInfo.environment is deprecated.Please use `container.environment.stage` instead'), yt.environment.stage; + } + }), yt.buildInfo = _t; + var Pt, St = T($('localStorage'), J), Ct = ''; + _.currentScript && _.currentScript.getAttribute('src') ? Ct = _.currentScript.getAttribute('src') : vt() && (Ct = vt().getAttribute('src')); + try { + Pt = D(Ct, yt.company.cdnAllowList, St); + } catch (e) { + throw J.warn('Please review the following error:'), e; + } + var kt, jt = bt(Pt.isDynamicEnforced, Pt.decorateWithDynamicHost), wt = ve(), Dt = yt.property.settings.undefinedVarsReturnEmpty, Vt = yt.property.settings.ruleComponentSequencingEnabled, It = yt.dataElements || {}; + le.migrateCookieData(It); + var Tt = function (e) { + return It[e]; + }, Et = function () { + return kt.apply(null, arguments); + }, Ot = de(wt, Tt, Et, Dt, jt), At = {}, Mt = Pe(At), Lt = ge(At, Tt), Nt = me(At, Tt, Ot); + kt = _e(Lt, Nt, Dt), mt(ht, yt, St.setDebugEnabled, Nt, Mt), ft(yt, wt, St, kt, Ot, jt, Pt.decorateWithDynamicHost); + var xt = ye(ht), Rt = O(wt, kt, jt), Ft = Oe(wt), Bt = xe(Ft, J, xt), Ut = Ne(Ue, Ft, J, xt), Ht = Le(Ue, Ft, J, xt), zt = Re(J, xt), Wt = Me(Be(Vt, Ee(Te(Rt, He, Bt, Ut), Fe(Rt, Ht, zt)), Ve(we(Rt, Ge, He, Ut, Bt), je(Rt, Ge, Ht), zt), xt), Rt, $e, Ue, Ae(wt), J); + qe(V, yt.rules || [], Wt); + } + return ht; + } + console.warn('Adobe Launch is unsupported in IE 9 and below.'); + }(); + _satellite = $___var_ab0e8b17bca56090; + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-dfc7510b217a08b434f81d37728e218b563e02e5 b/resources/sugarcoat-dfc7510b217a08b434f81d37728e218b563e02e5 new file mode 100644 index 00000000..3d795634 --- /dev/null +++ b/resources/sugarcoat-dfc7510b217a08b434f81d37728e218b563e02e5 @@ -0,0 +1,1247 @@ +{ + const $___mock_7306ea556da572ae = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_7306ea556da572ae); + (function () { + !function (e) { + var t = {}; + function n(r) { + if (t[r]) + return t[r].exports; + var a = t[r] = { + i: r, + l: !1, + exports: {} + }; + return e[r].call(a.exports, a, a.exports, n), a.l = !0, a.exports; + } + n.m = e, n.c = t, n.d = function (e, t, r) { + n.o(e, t) || Object.defineProperty(e, t, { + enumerable: !0, + get: r + }); + }, n.r = function (e) { + 'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }), Object.defineProperty(e, '__esModule', { value: !0 }); + }, n.t = function (e, t) { + if (1 & t && (e = n(e)), 8 & t) + return e; + if (4 & t && 'object' == typeof e && e && e.__esModule) + return e; + var r = Object.create(null); + if (n.r(r), Object.defineProperty(r, 'default', { + enumerable: !0, + value: e + }), 2 & t && 'string' != typeof e) + for (var a in e) + n.d(r, a, function (t) { + return e[t]; + }.bind(null, a)); + return r; + }, n.n = function (e) { + var t = e && e.__esModule ? function () { + return e.default; + } : function () { + return e; + }; + return n.d(t, 'a', t), t; + }, n.o = function (e, t) { + return Object.prototype.hasOwnProperty.call(e, t); + }, n.p = '', n(n.s = 1); + }([ + function (e, t) { + }, + function (e, t, n) { + 'use strict'; + n.r(t); + n(0); + var r = function (e) { + return { + width: e.innerWidth || -1, + height: e.innerHeight || -1 + }; + }, a = function (e) { + return { + width: e.screen && e.screen.width || -1, + height: e.screen && e.screen.height || -1 + }; + }, i = window, o = top; + function s(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + function u(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + var c = new (function () { + function e() { + !function (e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + }(this, e), u(this, 'log', null), u(this, 'warn', null), u(this, 'error', null), i.diagPixSentCodes = i.diagPixSentCodes || {}, this.log = this.logger.bind(this, 'log'), this.warn = this.logger.bind(this, 'warn'), this.error = this.logger.bind(this, 'error'); + } + var t, n, r; + return t = e, (n = [ + { + key: 'getAnid', + value: function () { + return i.__iasPET.pubId || ''; + } + }, + { + key: 'getSessionId', + value: function () { + return i.__iasPET.sessionId || ''; + } + }, + { + key: 'resetDiagPixSentCodes', + value: function () { + i.diagPixSentCodes = {}; + } + }, + { + key: 'buildQueryString', + value: function (e, t) { + var n = ''; + return e && (n = Object.keys(e).reduce(function (n, r) { + return n.push([ + r, + e[r] + ].join(t)), n; + }, []).join('&')), n; + } + }, + { + key: 'getQueryParamByName', + value: function (e) { + var t, n, r, a, o = i.location.search && i.location.search.toLowerCase(), s = o && o.indexOf(e); + return -1 !== s && (t = o.indexOf('=', s) + 1, n = -1 === (r = o.indexOf('&', t)) ? void 0 : r, a = decodeURIComponent(o.slice(t, n))), a; + } + }, + { + key: 'diagPix', + value: function (e, t) { + var n, r, a, o; + if (!i.diagPixSentCodes[e]) + try { + n = this.getAnid(), r = this.getSessionId(), i.diagPixSentCodes[e] = !0, a = { + code: 'pet_' + e, + anid: n, + sessionId: r + }, t && (a.err = encodeURIComponent(t.message)), o = this.buildQueryString(a, ':'), new i.Image().src = '//pixel.adsafeprotected.com/jsdiagnostic?' + o; + } catch (e) { + c.error(e); + } + } + }, + { + key: 'logger', + value: function (e, t) { + var n = 'background-color: ', r = i.console && 'function' == typeof i.console.error, a = this.getQueryParamByName('iasdebug'), o = a && 'TRUE' === a.toUpperCase(); + 'log' === e ? n += 'lightgreen' : 'error' === e ? n += 'pink' : 'warn' === e && (n += 'lightyellow'), r && o && console.log('%cIAS_DEBUG: ' + t, n); + } + } + ]) && s(t.prototype, n), r && s(t, r), e; + }())(), l = 'gpt', f = 'longreq', d = 'm', g = 'na', h = 'profile', p = 'x', y = 'xe', m = 'xt'; + function v(e) { + return (v = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + })(e); + } + function S(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + var b = new (function () { + function e() { + !function (e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + }(this, e); + } + var t, n, r; + return t = e, (n = [ + { + key: 'sendXHR', + value: function (e, t, n, r) { + const $___old_a4d9deb876036c15 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_bf458cf584301231 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_a4d9deb876036c15) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_7306ea556da572ae.XMLHttpRequest)); + if ($___old_bf458cf584301231) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_7306ea556da572ae.XMLHttpRequest)); + return function () { + var a, i; + try { + (a = new XMLHttpRequest()) && (i = encodeURI(e + '?' + t), a.open('GET', i), a.onreadystatechange = function () { + var e; + if (4 === a.readyState && 200 === a.status) + if ((e = a.responseText).code) + c.error('XMLHttpRequest failure code: ' + e.code + ', message: ' + e.message); + else if (n) + try { + n.call({}, e || {}); + } catch (e) { + c.error('Error firing the XMLHttpRequest callback: ' + e.message); + } + }, r && (a.timeout = r), a.ontimeout = function () { + c.error('XMLHttpRequest timeout event is fired.'), c.diagPix(m, { message: 'timeout:' + r }); + }, a.onerror = function (e) { + c.error('XMLHttpRequest error event is fired.'), c.diagPix(y, e); + }, a.send()); + } catch (e) { + c.error('Error sending XMLHttpRequest: ' + e.message), c.diagPix(p, e); + } + }.apply(this, arguments); + } finally { + if ($___old_a4d9deb876036c15) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_a4d9deb876036c15)); + if ($___old_bf458cf584301231) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_bf458cf584301231)); + } + } + }, + { + key: 'forIn', + value: function (e, t) { + var n; + for (n in e) + e.hasOwnProperty(n) && t(n, e[n]); + } + }, + { + key: 'getUID', + value: function () { + var e = function () { + return Math.floor(65536 * (1 + Math.random())).toString(16).substring(1); + }; + return e() + e() + '-' + e() + '-' + e() + '-' + e() + '-' + e() + e() + e(); + } + }, + { + key: 'extend', + value: function (e, t) { + return t && Object.keys(t).forEach(function (n) { + e[n] = t[n]; + }), e; + } + }, + { + key: 'isArray', + value: function (e) { + return e instanceof Array; + } + }, + { + key: 'isDef', + value: function (e) { + return void 0 !== e; + } + }, + { + key: 'isFn', + value: function (e) { + return 'function' == typeof e; + } + }, + { + key: 'isObj', + value: function (e) { + return 'object' === v(e); + } + }, + { + key: 'isEmptyObj', + value: function (e) { + return 0 === Object.getOwnPropertyNames(e).length; + } + }, + { + key: 'now', + value: function () { + return new Date().getTime(); + } + }, + { + key: 'chance', + value: function (e) { + return 100 * Math.random() < e; + } + } + ]) && S(t.prototype, n), r && S(t, r), e; + }())(), _ = function (e) { + var t, n, r, a, i, o, s, u, c = {}, l = function (e) { + return e && e.replace(/[^\w-_.>\/]/g, ''); + }; + t = l((i = e.adSlotId) && i.replace(/\//g, '')), n = e.size && e.size instanceof Array && e.size.join('.'), r = l(e.adUnitPath), a = function (t) { + var n = 'display'; + return void 0 !== e.type && null != t && 'video' == l(t) && (n = 'video'), n; + }(e.type), c.id = t, (c = b.extend(c, (o = e.size, u = {}, b.isArray(o) && (o.every(b.isArray) ? (s = o.map(function (e) { + return e.join('.'); + }).join(','), u.ss = '[' + s + ']') : u.s = o.join('.')), u))).p = r, c.t = a; + return { + toString: function () { + var e, t = []; + for (e in c) + t.push(e + ':' + c[e]); + return 'slot={' + t.join(',') + '}'; + }, + isValid: function () { + return t && n && r; + } + }; + }; + function E(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + var A = new (function () { + function e() { + var t, n, r; + !function (e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + }(this, e), r = [], (n = 'list') in (t = this) ? Object.defineProperty(t, n, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }) : t[n] = r; + } + var t, n, r; + return t = e, (n = [ + { + key: 'add', + value: function (e) { + new _(e).isValid() ? this.list.push(new _(e)) : c.error('Missing ad slot id, slot size and/or ad unit path.'); + } + }, + { + key: 'setAdSlots', + value: function (e) { + var t = e.adSlots, n = this; + t && (t instanceof Array ? t.forEach(function (e) { + n.add(e); + }) : b.isObj(t) && this.add(t)); + } + }, + { + key: 'clear', + value: function () { + this.list = []; + } + }, + { + key: 'stringify', + value: function () { + return this.list.join('&'); + } + }, + { + key: 'isEmpty', + value: function () { + return 0 === this.list.length; + } + } + ]) && E(t.prototype, n), r && E(t, r), e; + }())(); + function I(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + function w(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + var D = new (function () { + function e() { + !function (e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + }(this, e), w(this, 'cachedPageData', {}), w(this, 'cachedSlotsData', {}), w(this, 'cachedCustomData', {}), w(this, 'BRAND_SAFETY_OBJECT_FIELD_NAME', 'brandSafety'), w(this, 'FRAUD_FIELD_NAME', 'fr'), w(this, 'SLOTS_OBJECT_FIELD_NAME', 'slots'), w(this, 'CUSTOM_FIELD_NAME', 'custom'); + } + var t, n, r; + return t = e, (n = [ + { + key: 'updateData', + value: function (e) { + var t = JSON.parse(e), n = t[this.BRAND_SAFETY_OBJECT_FIELD_NAME], r = t[this.SLOTS_OBJECT_FIELD_NAME], a = t[this.CUSTOM_FIELD_NAME]; + t[this.FRAUD_FIELD_NAME] && (this.cachedPageData[this.FRAUD_FIELD_NAME] = t[this.FRAUD_FIELD_NAME]); + var i = function (e, t) { + b.forIn(e, function (e, n) { + t[e] = n; + }); + }; + i(n, this.cachedPageData), i(r, this.cachedSlotsData), i(a, this.cachedCustomData); + } + }, + { + key: 'clearCaches', + value: function () { + this.cachedPageData = {}, this.cachedSlotsData = {}, this.cachedCustomData = {}; + } + }, + { + key: 'setTargetingWrapper', + value: function (e, t) { + e && b.isFn(e.setTargeting) && b.forIn(t, function (t, n) { + c.log('setting targeting: {' + t + ': ' + n + '}'), e.setTargeting(t, n); + }); + } + }, + { + key: 'setSlotLevelData', + value: function () { + var e, t = this, n = i.googletag.pubads().getSlots(); + n ? n.forEach(function (n) { + (e = b.isFn(n.getSlotElementId) && n.getSlotElementId()) && t.setTargetingWrapper(n, t.cachedSlotsData[e]); + }) : c.error('GPT slots have to be defined before setting slot level keyword targeting'); + } + }, + { + key: 'setPageLevelData', + value: function () { + this.setTargetingWrapper(i.googletag.pubads(), this.cachedPageData); + } + }, + { + key: 'setCustomLevelData', + value: function () { + this.setTargetingWrapper(i.googletag.pubads(), this.cachedCustomData); + } + }, + { + key: 'setTargeting', + value: function () { + var e = this; + return function () { + i.googletag ? i.googletag.cmd.push(function () { + e.setPageLevelData(), e.setSlotLevelData(), e.setCustomLevelData(); + }) : (c.error('googletag is not available. Cannot set keyword targeting for GPT.'), c.diagPix(l)); + }; + } + } + ]) && I(t.prototype, n), r && I(t, r), e; + }())(); + function T(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + function P(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + var x = new (function () { + function e() { + !function (e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + }(this, e), P(this, 'cachedPageData', {}), P(this, 'cachedSlotsData', {}), P(this, 'cachedCustomData', {}), P(this, 'BRAND_SAFETY_OBJECT_FIELD_NAME', 'brandSafety'), P(this, 'FRAUD_FIELD_NAME', 'fr'), P(this, 'SLOTS_OBJECT_FIELD_NAME', 'slots'), P(this, 'CUSTOM_FIELD_NAME', 'custom'); + } + var t, n, r; + return t = e, (n = [ + { + key: 'updateData', + value: function (e) { + var t = JSON.parse(e), n = t[this.BRAND_SAFETY_OBJECT_FIELD_NAME], r = t[this.SLOTS_OBJECT_FIELD_NAME], a = t[this.CUSTOM_FIELD_NAME]; + t[this.FRAUD_FIELD_NAME] && (this.cachedPageData[this.FRAUD_FIELD_NAME] = t[this.FRAUD_FIELD_NAME]); + var i = function (e, t) { + b.forIn(e, function (e, n) { + t[e] = n; + }); + }; + i(n, this.cachedPageData), i(r, this.cachedSlotsData), i(a, this.cachedCustomData); + } + }, + { + key: 'clearCaches', + value: function () { + this.cachedPageData = {}, this.cachedSlotsData = {}, this.cachedCustomData = {}; + } + }, + { + key: 'setTargeting', + value: function () { + var e = this; + return function () { + if (i.apntag && i.apntag.requests && i.apntag.requests.tags) { + var t = apntag.requests.tags; + Object.keys(t).map(function (t) { + apntag.setKeywords(t, e.cachedPageData), apntag.setKeywords(t, e.cachedSlotsData[t]), apntag.setKeywords(t, e.cachedCustomData); + }); + } else + c.error('apntag is not available. Cannot set keyword targeting for AppNexus.'); + }; + } + } + ]) && T(t.prototype, n), r && T(t, r), e; + }())(); + function k(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + var C = function () { + function e() { + var t, n, r; + !function (e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + }(this, e), r = {}, (n = 'requestStatusDict') in (t = this) ? Object.defineProperty(t, n, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }) : t[n] = r; + } + var t, n, o; + return t = e, (n = [ + { + key: 'reportLongRequest', + value: function (e) { + var t = this; + return setTimeout(function () { + t.requestStatusDict[e] || (c.diagPix(f, { message: 'threshold:2000' }), c.warn('Long PET request that exceeds 2000ms.')); + }, 2000); + } + }, + { + key: 'reportResponseTime', + value: function (e) { + var t, n, r = this, a = c.getQueryParamByName('iasprofileprobability') || 10, i = {}; + b.chance(a) && setTimeout(function () { + t = r.requestStatusDict[e], n = t && t - e, i.responsetime = n, i.probability = a, c.diagPix(h, { message: c.buildQueryString(i, ':') }); + }, 2000); + } + }, + { + key: 'send', + value: function (e, t) { + var n, r, a, i = this, o = !1, s = c.getQueryParamByName('iasendpoint') || '//pixel.adsafeprotected.com/services/pub', u = this.buildQueryStrings(), l = b.isFn(e); + u && (n = function (t) { + o = b.now(), c.log('PET response ' + t), i.requestStatusDict[r] = o, D.updateData(t), x.updateData(t), l && e(t), clearTimeout(a); + }, r = b.now(), this.requestStatusDict[r] = !1, b.sendXHR(s, u, n, t), a = this.reportLongRequest(r), this.reportResponseTime(r), A.clear()); + } + }, + { + key: 'stringifySize', + value: function (e) { + return e.width + '.' + e.height; + } + }, + { + key: 'buildQueryStrings', + value: function () { + var e = [], t = i.__iasPET.pubId, n = this.stringifySize(r(i)), o = this.stringifySize(a(i)), s = i.__iasPET.sessionId, u = window.location.href; + if (window.context && window.context.domFingerprint.match(/amp/g) && (u = u || i.document.referrer), !A.isEmpty() && t) + return e.push('anId=' + t), e.push(A.stringify()), e.push('wr=' + n), e.push('sr=' + o), e.push('sessionId=' + s), e.push('url=' + encodeURIComponent(u)), c.log('ad slots set: ' + JSON.stringify(A)), c.log('anid set: ' + t), e.join('&'); + A.isEmpty() && c.error('Expected valid ad slot configuration.'), t || c.error('Expecting valid IAS publisher id.'), c.diagPix(d); + } + } + ]) && k(t.prototype, n), o && k(t, o), e; + }(); + function O(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + function R(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + var N = function () { + function e() { + !function (e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + }(this, e), R(this, 'timeout', null), R(this, 'dataHandler', null), R(this, 'outputManager', null), R(this, 'commands', null), this.outputManager = new C(), this.commands = this.commands || i.__iasPET.queue; + var t = this; + this.commands.push = function (e) { + var n; + try { + if (b.isFn(e)) + n = e(); + else { + if (!b.isObj(e)) + throw Error('Items pushed into the queue must be a function or object'); + n = e; + } + } catch (e) { + c.error('Error processing queued command: ' + e.message); + } + t.setFromConfig(n), t.outputManager.send(t.dataHandler, t.timeout); + }; + } + var t, n, r; + return t = e, (n = [ + { + key: 'executeCommands', + value: function () { + var e, t; + if (this.commands = this.commands || i.__iasPET.queue, this.commands && this.commands.length) { + for (e = 0; e < this.commands.length; ++e) { + try { + b.isFn(this.commands[e]) ? t = this.commands[e]() : b.isObj(this.commands[e]) && (t = this.commands[e]); + } catch (e) { + c.error('Error processing queued command: ' + e.message); + } + this.setFromConfig(t); + } + this.outputManager.send(this.dataHandler, this.timeout); + } + } + }, + { + key: 'setFromConfig', + value: function (e) { + e && (this.dataHandler = b.isFn(e.dataHandler) ? e.dataHandler : this.dataHandler, this.timeout = e.timeout || this.timeout, A.setAdSlots(e)); + } + } + ]) && O(t.prototype, n), r && O(t, r), e; + }(); + function j(e) { + return (j = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) { + return typeof e; + } : function (e) { + return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e; + })(e); + } + function L(e, t) { + for (var n = 0; n < t.length; n++) { + var r = t[n]; + r.enumerable = r.enumerable || !1, r.configurable = !0, 'value' in r && (r.writable = !0), Object.defineProperty(e, r.key, r); + } + } + function F(e, t, n) { + return t in e ? Object.defineProperty(e, t, { + value: n, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[t] = n, e; + } + var M = function () { + var e, t, n; + function r() { + !function (e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + }(this, r), F(this, 'adServer', void 0), F(this, 'iframesHtmlContents', {}), F(this, 'topRequests', [ + { + id: 'isRefreshable', + handler: function (e, t) { + var n = e.identifyAdServer(e.adServerList); + t.source.postMessage(JSON.stringify(n), t.origin); + } + }, + { + id: 'recordAdSlotImpression', + handler: function (e, t, n) { + try { + var r = e.getAdServer(), a = r.getAllAdSlots(); + r.findAdSlotByAdUnitId(a, n.adUnitId, function (r, a) { + !r && a ? e.recordAdSlotImpression(t, n.asid, n.adUnitId, a, n.cacheId) : c.warn('Unable to find adSlot by adUnitId', r); + }, e.getIframesHtmlContents(), n.cacheId); + } catch (e) { + c.error(e); + } + } + }, + { + id: 'refreshAd', + handler: function (e, t, n) { + try { + var r = e.getAdServer(), a = n && n.adUnitId; + r.refresh(r.findAdSlotByCacheId(n.cacheId), a); + } catch (e) { + c.error(e); + } + } + } + ]), F(this, 'adServerList', [{ + adServerName: 'GPT', + available: function () { + return !!(i.googletag && i.googletag.apiReady && i.googletag.pubads && 'function' == typeof i.googletag.pubads); + }, + findAdSlotByCacheId: function (e) { + var t = Object.keys(o.__IntegralASExec.adSlotData).filter(function (t) { + return o.__IntegralASExec.adSlotData[t].adSlot.cacheId === e; + })[0]; + return o.__IntegralASExec && o.__IntegralASExec.adSlotData && o.__IntegralASExec.adSlotData[t] && o.__IntegralASExec.adSlotData[t].adSlot || null; + }, + getAdSlot: function (e) { + return o.__IntegralASExec && o.__IntegralASExec.adSlotData && o.__IntegralASExec.adSlotData[e] && o.__IntegralASExec.adSlotData[e].adSlot || null; + }, + getAllAdSlots: function () { + var e = i.googletag.pubads && 'function' == typeof i.googletag.pubads && i.googletag.pubads(); + return e && 'function' == typeof e.getSlots && e.getSlots(); + }, + isAdUnitIdInSlot: function (e, t, n) { + var r = null, a = new RegExp('&chanId='.concat(t, '&'), 'g'), i = new RegExp(''.concat(n), 'gim'), o = e && e.iasHtml && 'string' == typeof e.iasHtml && e.iasHtml || null, s = a.test(o), u = i.test(o); + return o && s && u && (r = e), r; + }, + updateUnsafeAdSlots: function (e, t) { + var n = JSON.parse(JSON.stringify(t)); + return e.forEach(function (e) { + var r = [ + 'google_ads_iframe_'.concat(e.getSlotId().toString()), + 'google_ads_iframe'.concat(e.getSlotId().toString()) + ].filter(function (e) { + return Boolean(i.document.getElementById(e)) && !t.hasOwnProperty(e); + })[0], a = i.document.getElementById(r) || null; + if (a) + try { + var o = a.contentDocument || a.contentWindow && a.contentWindow.document; + o && Object.defineProperty(n, r, { + value: o.body.innerHTML, + enumerable: !0, + writable: !0 + }); + } catch (e) { + c.warn('Unable to access the unsafe iframe html contents', e); + } + }), n; + }, + matchAdSlotHtml: function (e, t) { + if (!e) + return null; + var n, r, a, i = this.updateUnsafeAdSlots(e, t), o = Object.keys(i).map(function (e) { + return i[e]; + }); + return e.forEach(function (e) { + n = e.getEscapedQemQueryId(), a = new RegExp(''.concat(n), 'g'), e.iasHtml = o.filter(function (e) { + return a.test(e); + })[0] || null, e.iasHtml || (r = new RegExp(''.concat(e.getSlotId().toString()), 'g'), Object.keys(i).forEach(function (t) { + r.test(t) && (e.iasHtml = i[t]); + })); + }), e; + }, + findAdSlotByAdUnitId: function (e, t, n, r, a) { + var i = this.matchAdSlotHtml(e, r); + if (i && Array.isArray(i)) { + var o, s = null; + for (o = 0; o < i.length; o += 1) + if (s = this.isAdUnitIdInSlot(i[o], t, a)) { + n(null, s); + break; + } + s || n(new Error('Ad Slot Not Found')); + } else + n(new Error('slots or ad unit id missing from request')); + }, + refresh: function (e, t) { + var n = i.googletag && i.googletag.cmd, r = i.googletag && i.googletag.pubads && 'function' == typeof i.googletag.pubads && i.googletag.pubads(); + n && r && 'function' == typeof r.refresh && e && !this.isAdSlotExcluded(e, t) && (this.setRefreshTargeting(e, t), n.push(function () { + r.refresh([e]); + })); + }, + setRefreshTargeting: function (e, t) { + var n = 'AD_UNIT_'.concat(t, '__').concat(e.getSlotId().toString()); + i.__iasAdRefreshConfig.refreshTargeting && i.__iasAdRefreshConfig.refreshTargeting.enabled && i.__IntegralASExec.adSlotData.hasOwnProperty(n) && ('string' == typeof i.__iasAdRefreshConfig.refreshTargeting.targetingKey && i.__iasAdRefreshConfig.refreshTargeting.targetingKey.trim() ? e.setTargeting(i.__iasAdRefreshConfig.refreshTargeting.targetingKey.trim(), i.__IntegralASExec.adSlotData[n].refreshCount + 1) : c.warn('Invalid refresh targeting key specficied in config')); + }, + buildAndValidateExtras: function (e, t, n) { + var r = !1; + if ('adSize' === e) { + var a = t.map(function (e) { + return '&campId='.concat(e, '&'); + }); + r = new RegExp('('.concat(a.join('|'), ')'), 'g').test(n); + } + if (/^custom/.test(e)) { + var i = t.map(function (t) { + return '&'.concat(e, '=').concat(t); + }); + r = new RegExp('('.concat(i.join('|'), ')'), 'g').test(n); + } + return r; + }, + isAdSlotExcluded: function (e, t) { + var n = this, r = e.getResponseInformation(), a = i.__iasAdRefreshConfig.excludeList ? JSON.parse(JSON.stringify(i.__iasAdRefreshConfig.excludeList)) : null, o = !1; + return r.adUnitId = NaN !== Number(t) ? Number(t) : t, r.chanId = r.adUnitId, a && Object.keys(a).forEach(function (t) { + Array.isArray(a[t]) || 'object' === j(a[t]) || (a[t] = [a[t]]), r.hasOwnProperty(t) && a[t].indexOf(r[t]) > -1 && (o = !0), ('adSize' === t || /^custom/.test(t)) && (o = n.buildAndValidateExtras(t, a[t], e.iasHtml)); + }), o; + } + }]); + var e = this; + i.__iasAdRefreshConfig = i.__iasAdRefreshConfig || {}, o.addEventListener('message', function (t) { + e.setIframesHtmlContents(), /requestTop/g.test(t.data) && e.handleTopRequests(t); + }); + } + return e = r, (t = [ + { + key: 'getAdServer', + value: function () { + return this.adServer; + } + }, + { + key: 'setAdServer', + value: function (e) { + this.adServer = e; + } + }, + { + key: 'identifyAdServer', + value: function (e) { + for (var t = 0; t < e.length; t += 1) + if (e[t].adServerName && e[t].available && 'function' == typeof e[t].available && e[t].available()) + return this.setAdServer(e[t]), { + isRefreshable: !0, + adServerName: e[t].adServerName + }; + return { + isRefreshable: !1, + adServerName: null + }; + } + }, + { + key: 'findAdServerByName', + value: function (e) { + for (var t = 0; t < this.adServerList.length; t += 1) + if (this.adServerList[t].adServerName === e) + return this.adServerList[t]; + return null; + } + }, + { + key: 'getTopRequestById', + value: function (e) { + for (var t = null, n = 0; n < this.topRequests.length; n += 1) + if (e === this.topRequests[n].id) { + t = this.topRequests[n]; + break; + } + return t; + } + }, + { + key: 'handleTopRequests', + value: function (e) { + var t, n = JSON.parse(e.data); + n && n.requestTop && (t = this.getTopRequestById(n.requestTop)) && t.handler && 'function' == typeof t.handler && t.handler(this, e, n); + } + }, + { + key: 'getAdSlotDataIdForAdUnitId', + value: function (e) { + return 'AD_UNIT_' + e; + } + }, + { + key: 'recordAdSlotImpression', + value: function (e, t, n, r, a) { + try { + var i = ''.concat(this.getAdSlotDataIdForAdUnitId(n), '__').concat(r.getSlotId().toString()); + r.cacheId = a, o.__IntegralASExec = o.__IntegralASExec || {}, o.__IntegralASExec.adSlotData = o.__IntegralASExec.adSlotData || {}, o.__IntegralASExec.adSlotData.hasOwnProperty(i) ? o.__IntegralASExec.adSlotData[i].refreshCount += 1 : o.__IntegralASExec.adSlotData[i] = { + refreshCount: 0, + refreshSessionId: t, + adSlot: r + }, this.sendRefreshSession(e, o.__IntegralASExec.adSlotData[i], i); + } catch (e) { + c.error('Unable to record ad slot impression', e); + } + } + }, + { + key: 'sendRefreshSession', + value: function (e, t) { + var n = { + requestId: 'refreshSession', + refreshCount: t.refreshCount, + refreshSessionId: t.refreshSessionId + }; + e.source.postMessage(JSON.stringify(n), e.origin); + } + }, + { + key: 'setIframesHtmlContents', + value: function () { + var e = this; + o.ampInaboxIframes && o.ampInaboxIframes.forEach(function (t) { + try { + (Boolean(t.getAttribute('data-is-safeframe')) || Boolean(t.getAttribute('sandbox'))) && t.name && (e.iframesHtmlContents[t.id] = t.name); + } catch (e) { + c.warn('Unable to access the safe iframe html contents', e); + } + }); + } + }, + { + key: 'getIframesHtmlContents', + value: function () { + return this.iframesHtmlContents; + } + } + ]) && L(e.prototype, t), n && L(e, n), r; + }(); + var U = function e() { + const $___old_b5fbc197eceae91a = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_b5fbc197eceae91a) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_7306ea556da572ae.XMLHttpRequest)); + return function () { + if (function (e, t) { + if (!(e instanceof t)) + throw new TypeError('Cannot call a class as a function'); + }(this, e), i.__iasPET.queue = i.__iasPET.queue || [], i.__iasPET.VERSION = '1.16.34', i.__iasPET.setTargetingForGPT = D.setTargeting(), i.__iasPET.setTargetingForAppNexus = x.setTargeting(), 'undefined' != typeof XMLHttpRequest) { + i.__iasPET.sessionId = b.getUID(), new N().executeCommands(); + new M(); + } else + c.diagPix(g); + }.apply(this, arguments); + } finally { + if ($___old_b5fbc197eceae91a) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_b5fbc197eceae91a)); + } + }; + n.d(t, 'start', function () { + return q; + }); + var q = function () { + try { + new U(); + } catch (e) { + c.error(e.message); + } + }; + i.__iasPET = window.__iasPET || {}, i.__iasPET.start = window.__iasPET.start || q, i.__iasPET.start(); + } + ]); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-e40cf8b1b251a846b2adda42a1521d0b92745c79 b/resources/sugarcoat-e40cf8b1b251a846b2adda42a1521d0b92745c79 new file mode 100644 index 00000000..1c64907d --- /dev/null +++ b/resources/sugarcoat-e40cf8b1b251a846b2adda42a1521d0b92745c79 @@ -0,0 +1,3585 @@ +{ + const $___mock_00465284004d4aa8 = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_00465284004d4aa8); + (function () { + !function (a, b) { + 'use strict'; + 'object' == typeof module && 'object' == typeof module.exports ? module.exports = a.document ? b(a, !0) : function (a) { + if (!a.document) + throw new Error('jQuery requires a window with a document'); + return b(a); + } : b(a); + }('undefined' != typeof window ? window : this, function (a, b) { + 'use strict'; + var c = [], d = a.document, e = Object.getPrototypeOf, f = c.slice, g = c.concat, h = c.push, i = c.indexOf, j = {}, k = j.toString, l = j.hasOwnProperty, m = l.toString, n = m.call(Object), o = {}; + function p(a, b) { + b = b || d; + var c = b.createElement('script'); + c.text = a, b.head.appendChild(c).parentNode.removeChild(c); + } + var q = '3.1.1', r = function (a, b) { + return new r.fn.init(a, b); + }, s = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, t = /^-ms-/, u = /-([a-z])/g, v = function (a, b) { + return b.toUpperCase(); + }; + r.fn = r.prototype = { + jquery: q, + constructor: r, + length: 0, + toArray: function () { + return f.call(this); + }, + get: function (a) { + return null == a ? f.call(this) : a < 0 ? this[a + this.length] : this[a]; + }, + pushStack: function (a) { + var b = r.merge(this.constructor(), a); + return b.prevObject = this, b; + }, + each: function (a) { + return r.each(this, a); + }, + map: function (a) { + return this.pushStack(r.map(this, function (b, c) { + return a.call(b, c, b); + })); + }, + slice: function () { + return this.pushStack(f.apply(this, arguments)); + }, + first: function () { + return this.eq(0); + }, + last: function () { + return this.eq(-1); + }, + eq: function (a) { + var b = this.length, c = +a + (a < 0 ? b : 0); + return this.pushStack(c >= 0 && c < b ? [this[c]] : []); + }, + end: function () { + return this.prevObject || this.constructor(); + }, + push: h, + sort: c.sort, + splice: c.splice + }, r.extend = r.fn.extend = function () { + var a, b, c, d, e, f, g = arguments[0] || {}, h = 1, i = arguments.length, j = !1; + for ('boolean' == typeof g && (j = g, g = arguments[h] || {}, h++), 'object' == typeof g || r.isFunction(g) || (g = {}), h === i && (g = this, h--); h < i; h++) + if (null != (a = arguments[h])) + for (b in a) + c = g[b], d = a[b], g !== d && (j && d && (r.isPlainObject(d) || (e = r.isArray(d))) ? (e ? (e = !1, f = c && r.isArray(c) ? c : []) : f = c && r.isPlainObject(c) ? c : {}, g[b] = r.extend(j, f, d)) : void 0 !== d && (g[b] = d)); + return g; + }, r.extend({ + expando: 'jQuery' + (q + Math.random()).replace(/\D/g, ''), + isReady: !0, + error: function (a) { + throw new Error(a); + }, + noop: function () { + }, + isFunction: function (a) { + return 'function' === r.type(a); + }, + isArray: Array.isArray, + isWindow: function (a) { + return null != a && a === a.window; + }, + isNumeric: function (a) { + var b = r.type(a); + return ('number' === b || 'string' === b) && !isNaN(a - parseFloat(a)); + }, + isPlainObject: function (a) { + var b, c; + return !(!a || '[object Object]' !== k.call(a)) && (!(b = e(a)) || (c = l.call(b, 'constructor') && b.constructor, 'function' == typeof c && m.call(c) === n)); + }, + isEmptyObject: function (a) { + var b; + for (b in a) + return !1; + return !0; + }, + type: function (a) { + return null == a ? a + '' : 'object' == typeof a || 'function' == typeof a ? j[k.call(a)] || 'object' : typeof a; + }, + globalEval: function (a) { + p(a); + }, + camelCase: function (a) { + return a.replace(t, 'ms-').replace(u, v); + }, + nodeName: function (a, b) { + return a.nodeName && a.nodeName.toLowerCase() === b.toLowerCase(); + }, + each: function (a, b) { + var c, d = 0; + if (w(a)) { + for (c = a.length; d < c; d++) + if (b.call(a[d], d, a[d]) === !1) + break; + } else + for (d in a) + if (b.call(a[d], d, a[d]) === !1) + break; + return a; + }, + trim: function (a) { + return null == a ? '' : (a + '').replace(s, ''); + }, + makeArray: function (a, b) { + var c = b || []; + return null != a && (w(Object(a)) ? r.merge(c, 'string' == typeof a ? [a] : a) : h.call(c, a)), c; + }, + inArray: function (a, b, c) { + return null == b ? -1 : i.call(b, a, c); + }, + merge: function (a, b) { + for (var c = +b.length, d = 0, e = a.length; d < c; d++) + a[e++] = b[d]; + return a.length = e, a; + }, + grep: function (a, b, c) { + for (var d, e = [], f = 0, g = a.length, h = !c; f < g; f++) + d = !b(a[f], f), d !== h && e.push(a[f]); + return e; + }, + map: function (a, b, c) { + var d, e, f = 0, h = []; + if (w(a)) + for (d = a.length; f < d; f++) + e = b(a[f], f, c), null != e && h.push(e); + else + for (f in a) + e = b(a[f], f, c), null != e && h.push(e); + return g.apply([], h); + }, + guid: 1, + proxy: function (a, b) { + var c, d, e; + if ('string' == typeof b && (c = a[b], b = a, a = c), r.isFunction(a)) + return d = f.call(arguments, 2), e = function () { + return a.apply(b || this, d.concat(f.call(arguments))); + }, e.guid = a.guid = a.guid || r.guid++, e; + }, + now: Date.now, + support: o + }), 'function' == typeof Symbol && (r.fn[Symbol.iterator] = c[Symbol.iterator]), r.each('Boolean Number String Function Array Date RegExp Object Error Symbol'.split(' '), function (a, b) { + j['[object ' + b + ']'] = b.toLowerCase(); + }); + function w(a) { + var b = !!a && 'length' in a && a.length, c = r.type(a); + return 'function' !== c && !r.isWindow(a) && ('array' === c || 0 === b || 'number' == typeof b && b > 0 && b - 1 in a); + } + var x = function (a) { + var b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u = 'sizzle' + 1 * new Date(), v = a.document, w = 0, x = 0, y = ha(), z = ha(), A = ha(), B = function (a, b) { + return a === b && (l = !0), 0; + }, C = {}.hasOwnProperty, D = [], E = D.pop, F = D.push, G = D.push, H = D.slice, I = function (a, b) { + for (var c = 0, d = a.length; c < d; c++) + if (a[c] === b) + return c; + return -1; + }, J = 'checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped', K = '[\\x20\\t\\r\\n\\f]', L = '(?:\\\\.|[\\w-]|[^\0-\\xa0])+', M = '\\[' + K + '*(' + L + ')(?:' + K + '*([*^$|!~]?=)' + K + '*(?:\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)"|(' + L + '))|)' + K + '*\\]', N = ':(' + L + ')(?:\\(((\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|' + M + ')*)|.*)\\)|)', O = new RegExp(K + '+', 'g'), P = new RegExp('^' + K + '+|((?:^|[^\\\\])(?:\\\\.)*)' + K + '+$', 'g'), Q = new RegExp('^' + K + '*,' + K + '*'), R = new RegExp('^' + K + '*([>+~]|' + K + ')' + K + '*'), S = new RegExp('=' + K + '*([^\\]\'"]*?)' + K + '*\\]', 'g'), T = new RegExp(N), U = new RegExp('^' + L + '$'), V = { + ID: new RegExp('^#(' + L + ')'), + CLASS: new RegExp('^\\.(' + L + ')'), + TAG: new RegExp('^(' + L + '|[*])'), + ATTR: new RegExp('^' + M), + PSEUDO: new RegExp('^' + N), + CHILD: new RegExp('^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(' + K + '*(even|odd|(([+-]|)(\\d*)n|)' + K + '*(?:([+-]|)' + K + '*(\\d+)|))' + K + '*\\)|)', 'i'), + bool: new RegExp('^(?:' + J + ')$', 'i'), + needsContext: new RegExp('^' + K + '*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(' + K + '*((?:-\\d)?\\d*)' + K + '*\\)|)(?=[^-]|$)', 'i') + }, W = /^(?:input|select|textarea|button)$/i, X = /^h\d$/i, Y = /^[^{]+\{\s*\[native \w/, Z = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, $ = /[+~]/, _ = new RegExp('\\\\([\\da-f]{1,6}' + K + '?|(' + K + ')|.)', 'ig'), aa = function (a, b, c) { + var d = '0x' + b - 65536; + return d !== d || c ? b : d < 0 ? String.fromCharCode(d + 65536) : String.fromCharCode(d >> 10 | 55296, 1023 & d | 56320); + }, ba = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, ca = function (a, b) { + return b ? '\0' === a ? '\uFFFD' : a.slice(0, -1) + '\\' + a.charCodeAt(a.length - 1).toString(16) + ' ' : '\\' + a; + }, da = function () { + m(); + }, ea = ta(function (a) { + return a.disabled === !0 && ('form' in a || 'label' in a); + }, { + dir: 'parentNode', + next: 'legend' + }); + try { + G.apply(D = H.call(v.childNodes), v.childNodes), D[v.childNodes.length].nodeType; + } catch (fa) { + G = { + apply: D.length ? function (a, b) { + F.apply(a, H.call(b)); + } : function (a, b) { + var c = a.length, d = 0; + while (a[c++] = b[d++]); + a.length = c - 1; + } + }; + } + function ga(a, b, d, e) { + var f, h, j, k, l, o, r, s = b && b.ownerDocument, w = b ? b.nodeType : 9; + if (d = d || [], 'string' != typeof a || !a || 1 !== w && 9 !== w && 11 !== w) + return d; + if (!e && ((b ? b.ownerDocument || b : v) !== n && m(b), b = b || n, p)) { + if (11 !== w && (l = Z.exec(a))) + if (f = l[1]) { + if (9 === w) { + if (!(j = b.getElementById(f))) + return d; + if (j.id === f) + return d.push(j), d; + } else if (s && (j = s.getElementById(f)) && t(b, j) && j.id === f) + return d.push(j), d; + } else { + if (l[2]) + return G.apply(d, b.getElementsByTagName(a)), d; + if ((f = l[3]) && c.getElementsByClassName && b.getElementsByClassName) + return G.apply(d, b.getElementsByClassName(f)), d; + } + if (c.qsa && !A[a + ' '] && (!q || !q.test(a))) { + if (1 !== w) + s = b, r = a; + else if ('object' !== b.nodeName.toLowerCase()) { + (k = b.getAttribute('id')) ? k = k.replace(ba, ca) : b.setAttribute('id', k = u), o = g(a), h = o.length; + while (h--) + o[h] = '#' + k + ' ' + sa(o[h]); + r = o.join(','), s = $.test(a) && qa(b.parentNode) || b; + } + if (r) + try { + return G.apply(d, s.querySelectorAll(r)), d; + } catch (x) { + } finally { + k === u && b.removeAttribute('id'); + } + } + } + return i(a.replace(P, '$1'), b, d, e); + } + function ha() { + var a = []; + function b(c, e) { + return a.push(c + ' ') > d.cacheLength && delete b[a.shift()], b[c + ' '] = e; + } + return b; + } + function ia(a) { + return a[u] = !0, a; + } + function ja(a) { + var b = n.createElement('fieldset'); + try { + return !!a(b); + } catch (c) { + return !1; + } finally { + b.parentNode && b.parentNode.removeChild(b), b = null; + } + } + function ka(a, b) { + var c = a.split('|'), e = c.length; + while (e--) + d.attrHandle[c[e]] = b; + } + function la(a, b) { + var c = b && a, d = c && 1 === a.nodeType && 1 === b.nodeType && a.sourceIndex - b.sourceIndex; + if (d) + return d; + if (c) + while (c = c.nextSibling) + if (c === b) + return -1; + return a ? 1 : -1; + } + function ma(a) { + return function (b) { + var c = b.nodeName.toLowerCase(); + return 'input' === c && b.type === a; + }; + } + function na(a) { + return function (b) { + var c = b.nodeName.toLowerCase(); + return ('input' === c || 'button' === c) && b.type === a; + }; + } + function oa(a) { + return function (b) { + return 'form' in b ? b.parentNode && b.disabled === !1 ? 'label' in b ? 'label' in b.parentNode ? b.parentNode.disabled === a : b.disabled === a : b.isDisabled === a || b.isDisabled !== !a && ea(b) === a : b.disabled === a : 'label' in b && b.disabled === a; + }; + } + function pa(a) { + return ia(function (b) { + return b = +b, ia(function (c, d) { + var e, f = a([], c.length, b), g = f.length; + while (g--) + c[e = f[g]] && (c[e] = !(d[e] = c[e])); + }); + }); + } + function qa(a) { + return a && 'undefined' != typeof a.getElementsByTagName && a; + } + c = ga.support = {}, f = ga.isXML = function (a) { + var b = a && (a.ownerDocument || a).documentElement; + return !!b && 'HTML' !== b.nodeName; + }, m = ga.setDocument = function (a) { + var b, e, g = a ? a.ownerDocument || a : v; + return g !== n && 9 === g.nodeType && g.documentElement ? (n = g, o = n.documentElement, p = !f(n), v !== n && (e = n.defaultView) && e.top !== e && (e.addEventListener ? e.addEventListener('unload', da, !1) : e.attachEvent && e.attachEvent('onunload', da)), c.attributes = ja(function (a) { + return a.className = 'i', !a.getAttribute('className'); + }), c.getElementsByTagName = ja(function (a) { + return a.appendChild(n.createComment('')), !a.getElementsByTagName('*').length; + }), c.getElementsByClassName = Y.test(n.getElementsByClassName), c.getById = ja(function (a) { + return o.appendChild(a).id = u, !n.getElementsByName || !n.getElementsByName(u).length; + }), c.getById ? (d.filter.ID = function (a) { + var b = a.replace(_, aa); + return function (a) { + return a.getAttribute('id') === b; + }; + }, d.find.ID = function (a, b) { + if ('undefined' != typeof b.getElementById && p) { + var c = b.getElementById(a); + return c ? [c] : []; + } + }) : (d.filter.ID = function (a) { + var b = a.replace(_, aa); + return function (a) { + var c = 'undefined' != typeof a.getAttributeNode && a.getAttributeNode('id'); + return c && c.value === b; + }; + }, d.find.ID = function (a, b) { + if ('undefined' != typeof b.getElementById && p) { + var c, d, e, f = b.getElementById(a); + if (f) { + if (c = f.getAttributeNode('id'), c && c.value === a) + return [f]; + e = b.getElementsByName(a), d = 0; + while (f = e[d++]) + if (c = f.getAttributeNode('id'), c && c.value === a) + return [f]; + } + return []; + } + }), d.find.TAG = c.getElementsByTagName ? function (a, b) { + return 'undefined' != typeof b.getElementsByTagName ? b.getElementsByTagName(a) : c.qsa ? b.querySelectorAll(a) : void 0; + } : function (a, b) { + var c, d = [], e = 0, f = b.getElementsByTagName(a); + if ('*' === a) { + while (c = f[e++]) + 1 === c.nodeType && d.push(c); + return d; + } + return f; + }, d.find.CLASS = c.getElementsByClassName && function (a, b) { + if ('undefined' != typeof b.getElementsByClassName && p) + return b.getElementsByClassName(a); + }, r = [], q = [], (c.qsa = Y.test(n.querySelectorAll)) && (ja(function (a) { + o.appendChild(a).innerHTML = '', a.querySelectorAll('[msallowcapture^=\'\']').length && q.push('[*^$]=' + K + '*(?:\'\'|"")'), a.querySelectorAll('[selected]').length || q.push('\\[' + K + '*(?:value|' + J + ')'), a.querySelectorAll('[id~=' + u + '-]').length || q.push('~='), a.querySelectorAll(':checked').length || q.push(':checked'), a.querySelectorAll('a#' + u + '+*').length || q.push('.#.+[+~]'); + }), ja(function (a) { + a.innerHTML = ''; + var b = n.createElement('input'); + b.setAttribute('type', 'hidden'), a.appendChild(b).setAttribute('name', 'D'), a.querySelectorAll('[name=d]').length && q.push('name' + K + '*[*^$|!~]?='), 2 !== a.querySelectorAll(':enabled').length && q.push(':enabled', ':disabled'), o.appendChild(a).disabled = !0, 2 !== a.querySelectorAll(':disabled').length && q.push(':enabled', ':disabled'), a.querySelectorAll('*,:x'), q.push(',.*:'); + })), (c.matchesSelector = Y.test(s = o.matches || o.webkitMatchesSelector || o.mozMatchesSelector || o.oMatchesSelector || o.msMatchesSelector)) && ja(function (a) { + c.disconnectedMatch = s.call(a, '*'), s.call(a, '[s!=\'\']:x'), r.push('!=', N); + }), q = q.length && new RegExp(q.join('|')), r = r.length && new RegExp(r.join('|')), b = Y.test(o.compareDocumentPosition), t = b || Y.test(o.contains) ? function (a, b) { + var c = 9 === a.nodeType ? a.documentElement : a, d = b && b.parentNode; + return a === d || !(!d || 1 !== d.nodeType || !(c.contains ? c.contains(d) : a.compareDocumentPosition && 16 & a.compareDocumentPosition(d))); + } : function (a, b) { + if (b) + while (b = b.parentNode) + if (b === a) + return !0; + return !1; + }, B = b ? function (a, b) { + if (a === b) + return l = !0, 0; + var d = !a.compareDocumentPosition - !b.compareDocumentPosition; + return d ? d : (d = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1, 1 & d || !c.sortDetached && b.compareDocumentPosition(a) === d ? a === n || a.ownerDocument === v && t(v, a) ? -1 : b === n || b.ownerDocument === v && t(v, b) ? 1 : k ? I(k, a) - I(k, b) : 0 : 4 & d ? -1 : 1); + } : function (a, b) { + if (a === b) + return l = !0, 0; + var c, d = 0, e = a.parentNode, f = b.parentNode, g = [a], h = [b]; + if (!e || !f) + return a === n ? -1 : b === n ? 1 : e ? -1 : f ? 1 : k ? I(k, a) - I(k, b) : 0; + if (e === f) + return la(a, b); + c = a; + while (c = c.parentNode) + g.unshift(c); + c = b; + while (c = c.parentNode) + h.unshift(c); + while (g[d] === h[d]) + d++; + return d ? la(g[d], h[d]) : g[d] === v ? -1 : h[d] === v ? 1 : 0; + }, n) : n; + }, ga.matches = function (a, b) { + return ga(a, null, null, b); + }, ga.matchesSelector = function (a, b) { + if ((a.ownerDocument || a) !== n && m(a), b = b.replace(S, '=\'$1\']'), c.matchesSelector && p && !A[b + ' '] && (!r || !r.test(b)) && (!q || !q.test(b))) + try { + var d = s.call(a, b); + if (d || c.disconnectedMatch || a.document && 11 !== a.document.nodeType) + return d; + } catch (e) { + } + return ga(b, n, null, [a]).length > 0; + }, ga.contains = function (a, b) { + return (a.ownerDocument || a) !== n && m(a), t(a, b); + }, ga.attr = function (a, b) { + (a.ownerDocument || a) !== n && m(a); + var e = d.attrHandle[b.toLowerCase()], f = e && C.call(d.attrHandle, b.toLowerCase()) ? e(a, b, !p) : void 0; + return void 0 !== f ? f : c.attributes || !p ? a.getAttribute(b) : (f = a.getAttributeNode(b)) && f.specified ? f.value : null; + }, ga.escape = function (a) { + return (a + '').replace(ba, ca); + }, ga.error = function (a) { + throw new Error('Syntax error, unrecognized expression: ' + a); + }, ga.uniqueSort = function (a) { + var b, d = [], e = 0, f = 0; + if (l = !c.detectDuplicates, k = !c.sortStable && a.slice(0), a.sort(B), l) { + while (b = a[f++]) + b === a[f] && (e = d.push(f)); + while (e--) + a.splice(d[e], 1); + } + return k = null, a; + }, e = ga.getText = function (a) { + var b, c = '', d = 0, f = a.nodeType; + if (f) { + if (1 === f || 9 === f || 11 === f) { + if ('string' == typeof a.textContent) + return a.textContent; + for (a = a.firstChild; a; a = a.nextSibling) + c += e(a); + } else if (3 === f || 4 === f) + return a.nodeValue; + } else + while (b = a[d++]) + c += e(b); + return c; + }, d = ga.selectors = { + cacheLength: 50, + createPseudo: ia, + match: V, + attrHandle: {}, + find: {}, + relative: { + '>': { + dir: 'parentNode', + first: !0 + }, + ' ': { dir: 'parentNode' }, + '+': { + dir: 'previousSibling', + first: !0 + }, + '~': { dir: 'previousSibling' } + }, + preFilter: { + ATTR: function (a) { + return a[1] = a[1].replace(_, aa), a[3] = (a[3] || a[4] || a[5] || '').replace(_, aa), '~=' === a[2] && (a[3] = ' ' + a[3] + ' '), a.slice(0, 4); + }, + CHILD: function (a) { + return a[1] = a[1].toLowerCase(), 'nth' === a[1].slice(0, 3) ? (a[3] || ga.error(a[0]), a[4] = +(a[4] ? a[5] + (a[6] || 1) : 2 * ('even' === a[3] || 'odd' === a[3])), a[5] = +(a[7] + a[8] || 'odd' === a[3])) : a[3] && ga.error(a[0]), a; + }, + PSEUDO: function (a) { + var b, c = !a[6] && a[2]; + return V.CHILD.test(a[0]) ? null : (a[3] ? a[2] = a[4] || a[5] || '' : c && T.test(c) && (b = g(c, !0)) && (b = c.indexOf(')', c.length - b) - c.length) && (a[0] = a[0].slice(0, b), a[2] = c.slice(0, b)), a.slice(0, 3)); + } + }, + filter: { + TAG: function (a) { + var b = a.replace(_, aa).toLowerCase(); + return '*' === a ? function () { + return !0; + } : function (a) { + return a.nodeName && a.nodeName.toLowerCase() === b; + }; + }, + CLASS: function (a) { + var b = y[a + ' ']; + return b || (b = new RegExp('(^|' + K + ')' + a + '(' + K + '|$)')) && y(a, function (a) { + return b.test('string' == typeof a.className && a.className || 'undefined' != typeof a.getAttribute && a.getAttribute('class') || ''); + }); + }, + ATTR: function (a, b, c) { + return function (d) { + var e = ga.attr(d, a); + return null == e ? '!=' === b : !b || (e += '', '=' === b ? e === c : '!=' === b ? e !== c : '^=' === b ? c && 0 === e.indexOf(c) : '*=' === b ? c && e.indexOf(c) > -1 : '$=' === b ? c && e.slice(-c.length) === c : '~=' === b ? (' ' + e.replace(O, ' ') + ' ').indexOf(c) > -1 : '|=' === b && (e === c || e.slice(0, c.length + 1) === c + '-')); + }; + }, + CHILD: function (a, b, c, d, e) { + var f = 'nth' !== a.slice(0, 3), g = 'last' !== a.slice(-4), h = 'of-type' === b; + return 1 === d && 0 === e ? function (a) { + return !!a.parentNode; + } : function (b, c, i) { + var j, k, l, m, n, o, p = f !== g ? 'nextSibling' : 'previousSibling', q = b.parentNode, r = h && b.nodeName.toLowerCase(), s = !i && !h, t = !1; + if (q) { + if (f) { + while (p) { + m = b; + while (m = m[p]) + if (h ? m.nodeName.toLowerCase() === r : 1 === m.nodeType) + return !1; + o = p = 'only' === a && !o && 'nextSibling'; + } + return !0; + } + if (o = [g ? q.firstChild : q.lastChild], g && s) { + m = q, l = m[u] || (m[u] = {}), k = l[m.uniqueID] || (l[m.uniqueID] = {}), j = k[a] || [], n = j[0] === w && j[1], t = n && j[2], m = n && q.childNodes[n]; + while (m = ++n && m && m[p] || (t = n = 0) || o.pop()) + if (1 === m.nodeType && ++t && m === b) { + k[a] = [ + w, + n, + t + ]; + break; + } + } else if (s && (m = b, l = m[u] || (m[u] = {}), k = l[m.uniqueID] || (l[m.uniqueID] = {}), j = k[a] || [], n = j[0] === w && j[1], t = n), t === !1) + while (m = ++n && m && m[p] || (t = n = 0) || o.pop()) + if ((h ? m.nodeName.toLowerCase() === r : 1 === m.nodeType) && ++t && (s && (l = m[u] || (m[u] = {}), k = l[m.uniqueID] || (l[m.uniqueID] = {}), k[a] = [ + w, + t + ]), m === b)) + break; + return t -= e, t === d || t % d === 0 && t / d >= 0; + } + }; + }, + PSEUDO: function (a, b) { + var c, e = d.pseudos[a] || d.setFilters[a.toLowerCase()] || ga.error('unsupported pseudo: ' + a); + return e[u] ? e(b) : e.length > 1 ? (c = [ + a, + a, + '', + b + ], d.setFilters.hasOwnProperty(a.toLowerCase()) ? ia(function (a, c) { + var d, f = e(a, b), g = f.length; + while (g--) + d = I(a, f[g]), a[d] = !(c[d] = f[g]); + }) : function (a) { + return e(a, 0, c); + }) : e; + } + }, + pseudos: { + not: ia(function (a) { + var b = [], c = [], d = h(a.replace(P, '$1')); + return d[u] ? ia(function (a, b, c, e) { + var f, g = d(a, null, e, []), h = a.length; + while (h--) + (f = g[h]) && (a[h] = !(b[h] = f)); + }) : function (a, e, f) { + return b[0] = a, d(b, null, f, c), b[0] = null, !c.pop(); + }; + }), + has: ia(function (a) { + return function (b) { + return ga(a, b).length > 0; + }; + }), + contains: ia(function (a) { + return a = a.replace(_, aa), function (b) { + return (b.textContent || b.innerText || e(b)).indexOf(a) > -1; + }; + }), + lang: ia(function (a) { + return U.test(a || '') || ga.error('unsupported lang: ' + a), a = a.replace(_, aa).toLowerCase(), function (b) { + var c; + do + if (c = p ? b.lang : b.getAttribute('xml:lang') || b.getAttribute('lang')) + return c = c.toLowerCase(), c === a || 0 === c.indexOf(a + '-'); + while ((b = b.parentNode) && 1 === b.nodeType); + return !1; + }; + }), + target: function (b) { + var c = a.location && a.location.hash; + return c && c.slice(1) === b.id; + }, + root: function (a) { + return a === o; + }, + focus: function (a) { + return a === n.activeElement && (!n.hasFocus || n.hasFocus()) && !!(a.type || a.href || ~a.tabIndex); + }, + enabled: oa(!1), + disabled: oa(!0), + checked: function (a) { + var b = a.nodeName.toLowerCase(); + return 'input' === b && !!a.checked || 'option' === b && !!a.selected; + }, + selected: function (a) { + return a.parentNode && a.parentNode.selectedIndex, a.selected === !0; + }, + empty: function (a) { + for (a = a.firstChild; a; a = a.nextSibling) + if (a.nodeType < 6) + return !1; + return !0; + }, + parent: function (a) { + return !d.pseudos.empty(a); + }, + header: function (a) { + return X.test(a.nodeName); + }, + input: function (a) { + return W.test(a.nodeName); + }, + button: function (a) { + var b = a.nodeName.toLowerCase(); + return 'input' === b && 'button' === a.type || 'button' === b; + }, + text: function (a) { + var b; + return 'input' === a.nodeName.toLowerCase() && 'text' === a.type && (null == (b = a.getAttribute('type')) || 'text' === b.toLowerCase()); + }, + first: pa(function () { + return [0]; + }), + last: pa(function (a, b) { + return [b - 1]; + }), + eq: pa(function (a, b, c) { + return [c < 0 ? c + b : c]; + }), + even: pa(function (a, b) { + for (var c = 0; c < b; c += 2) + a.push(c); + return a; + }), + odd: pa(function (a, b) { + for (var c = 1; c < b; c += 2) + a.push(c); + return a; + }), + lt: pa(function (a, b, c) { + for (var d = c < 0 ? c + b : c; --d >= 0;) + a.push(d); + return a; + }), + gt: pa(function (a, b, c) { + for (var d = c < 0 ? c + b : c; ++d < b;) + a.push(d); + return a; + }) + } + }, d.pseudos.nth = d.pseudos.eq; + for (b in { + radio: !0, + checkbox: !0, + file: !0, + password: !0, + image: !0 + }) + d.pseudos[b] = ma(b); + for (b in { + submit: !0, + reset: !0 + }) + d.pseudos[b] = na(b); + function ra() { + } + ra.prototype = d.filters = d.pseudos, d.setFilters = new ra(), g = ga.tokenize = function (a, b) { + var c, e, f, g, h, i, j, k = z[a + ' ']; + if (k) + return b ? 0 : k.slice(0); + h = a, i = [], j = d.preFilter; + while (h) { + c && !(e = Q.exec(h)) || (e && (h = h.slice(e[0].length) || h), i.push(f = [])), c = !1, (e = R.exec(h)) && (c = e.shift(), f.push({ + value: c, + type: e[0].replace(P, ' ') + }), h = h.slice(c.length)); + for (g in d.filter) + !(e = V[g].exec(h)) || j[g] && !(e = j[g](e)) || (c = e.shift(), f.push({ + value: c, + type: g, + matches: e + }), h = h.slice(c.length)); + if (!c) + break; + } + return b ? h.length : h ? ga.error(a) : z(a, i).slice(0); + }; + function sa(a) { + for (var b = 0, c = a.length, d = ''; b < c; b++) + d += a[b].value; + return d; + } + function ta(a, b, c) { + var d = b.dir, e = b.next, f = e || d, g = c && 'parentNode' === f, h = x++; + return b.first ? function (b, c, e) { + while (b = b[d]) + if (1 === b.nodeType || g) + return a(b, c, e); + return !1; + } : function (b, c, i) { + var j, k, l, m = [ + w, + h + ]; + if (i) { + while (b = b[d]) + if ((1 === b.nodeType || g) && a(b, c, i)) + return !0; + } else + while (b = b[d]) + if (1 === b.nodeType || g) + if (l = b[u] || (b[u] = {}), k = l[b.uniqueID] || (l[b.uniqueID] = {}), e && e === b.nodeName.toLowerCase()) + b = b[d] || b; + else { + if ((j = k[f]) && j[0] === w && j[1] === h) + return m[2] = j[2]; + if (k[f] = m, m[2] = a(b, c, i)) + return !0; + } + return !1; + }; + } + function ua(a) { + return a.length > 1 ? function (b, c, d) { + var e = a.length; + while (e--) + if (!a[e](b, c, d)) + return !1; + return !0; + } : a[0]; + } + function va(a, b, c) { + for (var d = 0, e = b.length; d < e; d++) + ga(a, b[d], c); + return c; + } + function wa(a, b, c, d, e) { + for (var f, g = [], h = 0, i = a.length, j = null != b; h < i; h++) + (f = a[h]) && (c && !c(f, d, e) || (g.push(f), j && b.push(h))); + return g; + } + function xa(a, b, c, d, e, f) { + return d && !d[u] && (d = xa(d)), e && !e[u] && (e = xa(e, f)), ia(function (f, g, h, i) { + var j, k, l, m = [], n = [], o = g.length, p = f || va(b || '*', h.nodeType ? [h] : h, []), q = !a || !f && b ? p : wa(p, m, a, h, i), r = c ? e || (f ? a : o || d) ? [] : g : q; + if (c && c(q, r, h, i), d) { + j = wa(r, n), d(j, [], h, i), k = j.length; + while (k--) + (l = j[k]) && (r[n[k]] = !(q[n[k]] = l)); + } + if (f) { + if (e || a) { + if (e) { + j = [], k = r.length; + while (k--) + (l = r[k]) && j.push(q[k] = l); + e(null, r = [], j, i); + } + k = r.length; + while (k--) + (l = r[k]) && (j = e ? I(f, l) : m[k]) > -1 && (f[j] = !(g[j] = l)); + } + } else + r = wa(r === g ? r.splice(o, r.length) : r), e ? e(null, g, r, i) : G.apply(g, r); + }); + } + function ya(a) { + for (var b, c, e, f = a.length, g = d.relative[a[0].type], h = g || d.relative[' '], i = g ? 1 : 0, k = ta(function (a) { + return a === b; + }, h, !0), l = ta(function (a) { + return I(b, a) > -1; + }, h, !0), m = [function (a, c, d) { + var e = !g && (d || c !== j) || ((b = c).nodeType ? k(a, c, d) : l(a, c, d)); + return b = null, e; + }]; i < f; i++) + if (c = d.relative[a[i].type]) + m = [ta(ua(m), c)]; + else { + if (c = d.filter[a[i].type].apply(null, a[i].matches), c[u]) { + for (e = ++i; e < f; e++) + if (d.relative[a[e].type]) + break; + return xa(i > 1 && ua(m), i > 1 && sa(a.slice(0, i - 1).concat({ value: ' ' === a[i - 2].type ? '*' : '' })).replace(P, '$1'), c, i < e && ya(a.slice(i, e)), e < f && ya(a = a.slice(e)), e < f && sa(a)); + } + m.push(c); + } + return ua(m); + } + function za(a, b) { + var c = b.length > 0, e = a.length > 0, f = function (f, g, h, i, k) { + var l, o, q, r = 0, s = '0', t = f && [], u = [], v = j, x = f || e && d.find.TAG('*', k), y = w += null == v ? 1 : Math.random() || 0.1, z = x.length; + for (k && (j = g === n || g || k); s !== z && null != (l = x[s]); s++) { + if (e && l) { + o = 0, g || l.ownerDocument === n || (m(l), h = !p); + while (q = a[o++]) + if (q(l, g || n, h)) { + i.push(l); + break; + } + k && (w = y); + } + c && ((l = !q && l) && r--, f && t.push(l)); + } + if (r += s, c && s !== r) { + o = 0; + while (q = b[o++]) + q(t, u, g, h); + if (f) { + if (r > 0) + while (s--) + t[s] || u[s] || (u[s] = E.call(i)); + u = wa(u); + } + G.apply(i, u), k && !f && u.length > 0 && r + b.length > 1 && ga.uniqueSort(i); + } + return k && (w = y, j = v), t; + }; + return c ? ia(f) : f; + } + return h = ga.compile = function (a, b) { + var c, d = [], e = [], f = A[a + ' ']; + if (!f) { + b || (b = g(a)), c = b.length; + while (c--) + f = ya(b[c]), f[u] ? d.push(f) : e.push(f); + f = A(a, za(e, d)), f.selector = a; + } + return f; + }, i = ga.select = function (a, b, c, e) { + var f, i, j, k, l, m = 'function' == typeof a && a, n = !e && g(a = m.selector || a); + if (c = c || [], 1 === n.length) { + if (i = n[0] = n[0].slice(0), i.length > 2 && 'ID' === (j = i[0]).type && 9 === b.nodeType && p && d.relative[i[1].type]) { + if (b = (d.find.ID(j.matches[0].replace(_, aa), b) || [])[0], !b) + return c; + m && (b = b.parentNode), a = a.slice(i.shift().value.length); + } + f = V.needsContext.test(a) ? 0 : i.length; + while (f--) { + if (j = i[f], d.relative[k = j.type]) + break; + if ((l = d.find[k]) && (e = l(j.matches[0].replace(_, aa), $.test(i[0].type) && qa(b.parentNode) || b))) { + if (i.splice(f, 1), a = e.length && sa(i), !a) + return G.apply(c, e), c; + break; + } + } + } + return (m || h(a, n))(e, b, !p, c, !b || $.test(a) && qa(b.parentNode) || b), c; + }, c.sortStable = u.split('').sort(B).join('') === u, c.detectDuplicates = !!l, m(), c.sortDetached = ja(function (a) { + return 1 & a.compareDocumentPosition(n.createElement('fieldset')); + }), ja(function (a) { + return a.innerHTML = '', '#' === a.firstChild.getAttribute('href'); + }) || ka('type|href|height|width', function (a, b, c) { + if (!c) + return a.getAttribute(b, 'type' === b.toLowerCase() ? 1 : 2); + }), c.attributes && ja(function (a) { + return a.innerHTML = '', a.firstChild.setAttribute('value', ''), '' === a.firstChild.getAttribute('value'); + }) || ka('value', function (a, b, c) { + if (!c && 'input' === a.nodeName.toLowerCase()) + return a.defaultValue; + }), ja(function (a) { + return null == a.getAttribute('disabled'); + }) || ka(J, function (a, b, c) { + var d; + if (!c) + return a[b] === !0 ? b.toLowerCase() : (d = a.getAttributeNode(b)) && d.specified ? d.value : null; + }), ga; + }(a); + r.find = x, r.expr = x.selectors, r.expr[':'] = r.expr.pseudos, r.uniqueSort = r.unique = x.uniqueSort, r.text = x.getText, r.isXMLDoc = x.isXML, r.contains = x.contains, r.escapeSelector = x.escape; + var y = function (a, b, c) { + var d = [], e = void 0 !== c; + while ((a = a[b]) && 9 !== a.nodeType) + if (1 === a.nodeType) { + if (e && r(a).is(c)) + break; + d.push(a); + } + return d; + }, z = function (a, b) { + for (var c = []; a; a = a.nextSibling) + 1 === a.nodeType && a !== b && c.push(a); + return c; + }, A = r.expr.match.needsContext, B = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i, C = /^.[^:#\[\.,]*$/; + function D(a, b, c) { + return r.isFunction(b) ? r.grep(a, function (a, d) { + return !!b.call(a, d, a) !== c; + }) : b.nodeType ? r.grep(a, function (a) { + return a === b !== c; + }) : 'string' != typeof b ? r.grep(a, function (a) { + return i.call(b, a) > -1 !== c; + }) : C.test(b) ? r.filter(b, a, c) : (b = r.filter(b, a), r.grep(a, function (a) { + return i.call(b, a) > -1 !== c && 1 === a.nodeType; + })); + } + r.filter = function (a, b, c) { + var d = b[0]; + return c && (a = ':not(' + a + ')'), 1 === b.length && 1 === d.nodeType ? r.find.matchesSelector(d, a) ? [d] : [] : r.find.matches(a, r.grep(b, function (a) { + return 1 === a.nodeType; + })); + }, r.fn.extend({ + find: function (a) { + var b, c, d = this.length, e = this; + if ('string' != typeof a) + return this.pushStack(r(a).filter(function () { + for (b = 0; b < d; b++) + if (r.contains(e[b], this)) + return !0; + })); + for (c = this.pushStack([]), b = 0; b < d; b++) + r.find(a, e[b], c); + return d > 1 ? r.uniqueSort(c) : c; + }, + filter: function (a) { + return this.pushStack(D(this, a || [], !1)); + }, + not: function (a) { + return this.pushStack(D(this, a || [], !0)); + }, + is: function (a) { + return !!D(this, 'string' == typeof a && A.test(a) ? r(a) : a || [], !1).length; + } + }); + var E, F = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, G = r.fn.init = function (a, b, c) { + var e, f; + if (!a) + return this; + if (c = c || E, 'string' == typeof a) { + if (e = '<' === a[0] && '>' === a[a.length - 1] && a.length >= 3 ? [ + null, + a, + null + ] : F.exec(a), !e || !e[1] && b) + return !b || b.jquery ? (b || c).find(a) : this.constructor(b).find(a); + if (e[1]) { + if (b = b instanceof r ? b[0] : b, r.merge(this, r.parseHTML(e[1], b && b.nodeType ? b.ownerDocument || b : d, !0)), B.test(e[1]) && r.isPlainObject(b)) + for (e in b) + r.isFunction(this[e]) ? this[e](b[e]) : this.attr(e, b[e]); + return this; + } + return f = d.getElementById(e[2]), f && (this[0] = f, this.length = 1), this; + } + return a.nodeType ? (this[0] = a, this.length = 1, this) : r.isFunction(a) ? void 0 !== c.ready ? c.ready(a) : a(r) : r.makeArray(a, this); + }; + G.prototype = r.fn, E = r(d); + var H = /^(?:parents|prev(?:Until|All))/, I = { + children: !0, + contents: !0, + next: !0, + prev: !0 + }; + r.fn.extend({ + has: function (a) { + var b = r(a, this), c = b.length; + return this.filter(function () { + for (var a = 0; a < c; a++) + if (r.contains(this, b[a])) + return !0; + }); + }, + closest: function (a, b) { + var c, d = 0, e = this.length, f = [], g = 'string' != typeof a && r(a); + if (!A.test(a)) + for (; d < e; d++) + for (c = this[d]; c && c !== b; c = c.parentNode) + if (c.nodeType < 11 && (g ? g.index(c) > -1 : 1 === c.nodeType && r.find.matchesSelector(c, a))) { + f.push(c); + break; + } + return this.pushStack(f.length > 1 ? r.uniqueSort(f) : f); + }, + index: function (a) { + return a ? 'string' == typeof a ? i.call(r(a), this[0]) : i.call(this, a.jquery ? a[0] : a) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1; + }, + add: function (a, b) { + return this.pushStack(r.uniqueSort(r.merge(this.get(), r(a, b)))); + }, + addBack: function (a) { + return this.add(null == a ? this.prevObject : this.prevObject.filter(a)); + } + }); + function J(a, b) { + while ((a = a[b]) && 1 !== a.nodeType); + return a; + } + r.each({ + parent: function (a) { + var b = a.parentNode; + return b && 11 !== b.nodeType ? b : null; + }, + parents: function (a) { + return y(a, 'parentNode'); + }, + parentsUntil: function (a, b, c) { + return y(a, 'parentNode', c); + }, + next: function (a) { + return J(a, 'nextSibling'); + }, + prev: function (a) { + return J(a, 'previousSibling'); + }, + nextAll: function (a) { + return y(a, 'nextSibling'); + }, + prevAll: function (a) { + return y(a, 'previousSibling'); + }, + nextUntil: function (a, b, c) { + return y(a, 'nextSibling', c); + }, + prevUntil: function (a, b, c) { + return y(a, 'previousSibling', c); + }, + siblings: function (a) { + return z((a.parentNode || {}).firstChild, a); + }, + children: function (a) { + return z(a.firstChild); + }, + contents: function (a) { + return a.contentDocument || r.merge([], a.childNodes); + } + }, function (a, b) { + r.fn[a] = function (c, d) { + var e = r.map(this, b, c); + return 'Until' !== a.slice(-5) && (d = c), d && 'string' == typeof d && (e = r.filter(d, e)), this.length > 1 && (I[a] || r.uniqueSort(e), H.test(a) && e.reverse()), this.pushStack(e); + }; + }); + var K = /[^\x20\t\r\n\f]+/g; + function L(a) { + var b = {}; + return r.each(a.match(K) || [], function (a, c) { + b[c] = !0; + }), b; + } + r.Callbacks = function (a) { + a = 'string' == typeof a ? L(a) : r.extend({}, a); + var b, c, d, e, f = [], g = [], h = -1, i = function () { + for (e = a.once, d = b = !0; g.length; h = -1) { + c = g.shift(); + while (++h < f.length) + f[h].apply(c[0], c[1]) === !1 && a.stopOnFalse && (h = f.length, c = !1); + } + a.memory || (c = !1), b = !1, e && (f = c ? [] : ''); + }, j = { + add: function () { + return f && (c && !b && (h = f.length - 1, g.push(c)), function d(b) { + r.each(b, function (b, c) { + r.isFunction(c) ? a.unique && j.has(c) || f.push(c) : c && c.length && 'string' !== r.type(c) && d(c); + }); + }(arguments), c && !b && i()), this; + }, + remove: function () { + return r.each(arguments, function (a, b) { + var c; + while ((c = r.inArray(b, f, c)) > -1) + f.splice(c, 1), c <= h && h--; + }), this; + }, + has: function (a) { + return a ? r.inArray(a, f) > -1 : f.length > 0; + }, + empty: function () { + return f && (f = []), this; + }, + disable: function () { + return e = g = [], f = c = '', this; + }, + disabled: function () { + return !f; + }, + lock: function () { + return e = g = [], c || b || (f = c = ''), this; + }, + locked: function () { + return !!e; + }, + fireWith: function (a, c) { + return e || (c = c || [], c = [ + a, + c.slice ? c.slice() : c + ], g.push(c), b || i()), this; + }, + fire: function () { + return j.fireWith(this, arguments), this; + }, + fired: function () { + return !!d; + } + }; + return j; + }; + function M(a) { + return a; + } + function N(a) { + throw a; + } + function O(a, b, c) { + var d; + try { + a && r.isFunction(d = a.promise) ? d.call(a).done(b).fail(c) : a && r.isFunction(d = a.then) ? d.call(a, b, c) : b.call(void 0, a); + } catch (a) { + c.call(void 0, a); + } + } + r.extend({ + Deferred: function (b) { + var c = [ + [ + 'notify', + 'progress', + r.Callbacks('memory'), + r.Callbacks('memory'), + 2 + ], + [ + 'resolve', + 'done', + r.Callbacks('once memory'), + r.Callbacks('once memory'), + 0, + 'resolved' + ], + [ + 'reject', + 'fail', + r.Callbacks('once memory'), + r.Callbacks('once memory'), + 1, + 'rejected' + ] + ], d = 'pending', e = { + state: function () { + return d; + }, + always: function () { + return f.done(arguments).fail(arguments), this; + }, + 'catch': function (a) { + return e.then(null, a); + }, + pipe: function () { + var a = arguments; + return r.Deferred(function (b) { + r.each(c, function (c, d) { + var e = r.isFunction(a[d[4]]) && a[d[4]]; + f[d[1]](function () { + var a = e && e.apply(this, arguments); + a && r.isFunction(a.promise) ? a.promise().progress(b.notify).done(b.resolve).fail(b.reject) : b[d[0] + 'With'](this, e ? [a] : arguments); + }); + }), a = null; + }).promise(); + }, + then: function (b, d, e) { + var f = 0; + function g(b, c, d, e) { + return function () { + var h = this, i = arguments, j = function () { + var a, j; + if (!(b < f)) { + if (a = d.apply(h, i), a === c.promise()) + throw new TypeError('Thenable self-resolution'); + j = a && ('object' == typeof a || 'function' == typeof a) && a.then, r.isFunction(j) ? e ? j.call(a, g(f, c, M, e), g(f, c, N, e)) : (f++, j.call(a, g(f, c, M, e), g(f, c, N, e), g(f, c, M, c.notifyWith))) : (d !== M && (h = void 0, i = [a]), (e || c.resolveWith)(h, i)); + } + }, k = e ? j : function () { + try { + j(); + } catch (a) { + r.Deferred.exceptionHook && r.Deferred.exceptionHook(a, k.stackTrace), b + 1 >= f && (d !== N && (h = void 0, i = [a]), c.rejectWith(h, i)); + } + }; + b ? k() : (r.Deferred.getStackHook && (k.stackTrace = r.Deferred.getStackHook()), a.setTimeout(k)); + }; + } + return r.Deferred(function (a) { + c[0][3].add(g(0, a, r.isFunction(e) ? e : M, a.notifyWith)), c[1][3].add(g(0, a, r.isFunction(b) ? b : M)), c[2][3].add(g(0, a, r.isFunction(d) ? d : N)); + }).promise(); + }, + promise: function (a) { + return null != a ? r.extend(a, e) : e; + } + }, f = {}; + return r.each(c, function (a, b) { + var g = b[2], h = b[5]; + e[b[1]] = g.add, h && g.add(function () { + d = h; + }, c[3 - a][2].disable, c[0][2].lock), g.add(b[3].fire), f[b[0]] = function () { + return f[b[0] + 'With'](this === f ? void 0 : this, arguments), this; + }, f[b[0] + 'With'] = g.fireWith; + }), e.promise(f), b && b.call(f, f), f; + }, + when: function (a) { + var b = arguments.length, c = b, d = Array(c), e = f.call(arguments), g = r.Deferred(), h = function (a) { + return function (c) { + d[a] = this, e[a] = arguments.length > 1 ? f.call(arguments) : c, --b || g.resolveWith(d, e); + }; + }; + if (b <= 1 && (O(a, g.done(h(c)).resolve, g.reject), 'pending' === g.state() || r.isFunction(e[c] && e[c].then))) + return g.then(); + while (c--) + O(e[c], h(c), g.reject); + return g.promise(); + } + }); + var P = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; + r.Deferred.exceptionHook = function (b, c) { + a.console && a.console.warn && b && P.test(b.name) && a.console.warn('jQuery.Deferred exception: ' + b.message, b.stack, c); + }, r.readyException = function (b) { + a.setTimeout(function () { + throw b; + }); + }; + var Q = r.Deferred(); + r.fn.ready = function (a) { + return Q.then(a)['catch'](function (a) { + r.readyException(a); + }), this; + }, r.extend({ + isReady: !1, + readyWait: 1, + holdReady: function (a) { + a ? r.readyWait++ : r.ready(!0); + }, + ready: function (a) { + (a === !0 ? --r.readyWait : r.isReady) || (r.isReady = !0, a !== !0 && --r.readyWait > 0 || Q.resolveWith(d, [r])); + } + }), r.ready.then = Q.then; + function R() { + d.removeEventListener('DOMContentLoaded', R), a.removeEventListener('load', R), r.ready(); + } + 'complete' === d.readyState || 'loading' !== d.readyState && !d.documentElement.doScroll ? a.setTimeout(r.ready) : (d.addEventListener('DOMContentLoaded', R), a.addEventListener('load', R)); + var S = function (a, b, c, d, e, f, g) { + var h = 0, i = a.length, j = null == c; + if ('object' === r.type(c)) { + e = !0; + for (h in c) + S(a, b, h, c[h], !0, f, g); + } else if (void 0 !== d && (e = !0, r.isFunction(d) || (g = !0), j && (g ? (b.call(a, d), b = null) : (j = b, b = function (a, b, c) { + return j.call(r(a), c); + })), b)) + for (; h < i; h++) + b(a[h], c, g ? d : d.call(a[h], h, b(a[h], c))); + return e ? a : j ? b.call(a) : i ? b(a[0], c) : f; + }, T = function (a) { + return 1 === a.nodeType || 9 === a.nodeType || !+a.nodeType; + }; + function U() { + this.expando = r.expando + U.uid++; + } + U.uid = 1, U.prototype = { + cache: function (a) { + var b = a[this.expando]; + return b || (b = {}, T(a) && (a.nodeType ? a[this.expando] = b : Object.defineProperty(a, this.expando, { + value: b, + configurable: !0 + }))), b; + }, + set: function (a, b, c) { + var d, e = this.cache(a); + if ('string' == typeof b) + e[r.camelCase(b)] = c; + else + for (d in b) + e[r.camelCase(d)] = b[d]; + return e; + }, + get: function (a, b) { + return void 0 === b ? this.cache(a) : a[this.expando] && a[this.expando][r.camelCase(b)]; + }, + access: function (a, b, c) { + return void 0 === b || b && 'string' == typeof b && void 0 === c ? this.get(a, b) : (this.set(a, b, c), void 0 !== c ? c : b); + }, + remove: function (a, b) { + var c, d = a[this.expando]; + if (void 0 !== d) { + if (void 0 !== b) { + r.isArray(b) ? b = b.map(r.camelCase) : (b = r.camelCase(b), b = b in d ? [b] : b.match(K) || []), c = b.length; + while (c--) + delete d[b[c]]; + } + (void 0 === b || r.isEmptyObject(d)) && (a.nodeType ? a[this.expando] = void 0 : delete a[this.expando]); + } + }, + hasData: function (a) { + var b = a[this.expando]; + return void 0 !== b && !r.isEmptyObject(b); + } + }; + var V = new U(), W = new U(), X = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, Y = /[A-Z]/g; + function Z(a) { + return 'true' === a || 'false' !== a && ('null' === a ? null : a === +a + '' ? +a : X.test(a) ? JSON.parse(a) : a); + } + function $(a, b, c) { + var d; + if (void 0 === c && 1 === a.nodeType) + if (d = 'data-' + b.replace(Y, '-$&').toLowerCase(), c = a.getAttribute(d), 'string' == typeof c) { + try { + c = Z(c); + } catch (e) { + } + W.set(a, b, c); + } else + c = void 0; + return c; + } + r.extend({ + hasData: function (a) { + return W.hasData(a) || V.hasData(a); + }, + data: function (a, b, c) { + return W.access(a, b, c); + }, + removeData: function (a, b) { + W.remove(a, b); + }, + _data: function (a, b, c) { + return V.access(a, b, c); + }, + _removeData: function (a, b) { + V.remove(a, b); + } + }), r.fn.extend({ + data: function (a, b) { + var c, d, e, f = this[0], g = f && f.attributes; + if (void 0 === a) { + if (this.length && (e = W.get(f), 1 === f.nodeType && !V.get(f, 'hasDataAttrs'))) { + c = g.length; + while (c--) + g[c] && (d = g[c].name, 0 === d.indexOf('data-') && (d = r.camelCase(d.slice(5)), $(f, d, e[d]))); + V.set(f, 'hasDataAttrs', !0); + } + return e; + } + return 'object' == typeof a ? this.each(function () { + W.set(this, a); + }) : S(this, function (b) { + var c; + if (f && void 0 === b) { + if (c = W.get(f, a), void 0 !== c) + return c; + if (c = $(f, a), void 0 !== c) + return c; + } else + this.each(function () { + W.set(this, a, b); + }); + }, null, b, arguments.length > 1, null, !0); + }, + removeData: function (a) { + return this.each(function () { + W.remove(this, a); + }); + } + }), r.extend({ + queue: function (a, b, c) { + var d; + if (a) + return b = (b || 'fx') + 'queue', d = V.get(a, b), c && (!d || r.isArray(c) ? d = V.access(a, b, r.makeArray(c)) : d.push(c)), d || []; + }, + dequeue: function (a, b) { + b = b || 'fx'; + var c = r.queue(a, b), d = c.length, e = c.shift(), f = r._queueHooks(a, b), g = function () { + r.dequeue(a, b); + }; + 'inprogress' === e && (e = c.shift(), d--), e && ('fx' === b && c.unshift('inprogress'), delete f.stop, e.call(a, g, f)), !d && f && f.empty.fire(); + }, + _queueHooks: function (a, b) { + var c = b + 'queueHooks'; + return V.get(a, c) || V.access(a, c, { + empty: r.Callbacks('once memory').add(function () { + V.remove(a, [ + b + 'queue', + c + ]); + }) + }); + } + }), r.fn.extend({ + queue: function (a, b) { + var c = 2; + return 'string' != typeof a && (b = a, a = 'fx', c--), arguments.length < c ? r.queue(this[0], a) : void 0 === b ? this : this.each(function () { + var c = r.queue(this, a, b); + r._queueHooks(this, a), 'fx' === a && 'inprogress' !== c[0] && r.dequeue(this, a); + }); + }, + dequeue: function (a) { + return this.each(function () { + r.dequeue(this, a); + }); + }, + clearQueue: function (a) { + return this.queue(a || 'fx', []); + }, + promise: function (a, b) { + var c, d = 1, e = r.Deferred(), f = this, g = this.length, h = function () { + --d || e.resolveWith(f, [f]); + }; + 'string' != typeof a && (b = a, a = void 0), a = a || 'fx'; + while (g--) + c = V.get(f[g], a + 'queueHooks'), c && c.empty && (d++, c.empty.add(h)); + return h(), e.promise(b); + } + }); + var _ = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, aa = new RegExp('^(?:([+-])=|)(' + _ + ')([a-z%]*)$', 'i'), ba = [ + 'Top', + 'Right', + 'Bottom', + 'Left' + ], ca = function (a, b) { + return a = b || a, 'none' === a.style.display || '' === a.style.display && r.contains(a.ownerDocument, a) && 'none' === r.css(a, 'display'); + }, da = function (a, b, c, d) { + var e, f, g = {}; + for (f in b) + g[f] = a.style[f], a.style[f] = b[f]; + e = c.apply(a, d || []); + for (f in b) + a.style[f] = g[f]; + return e; + }; + function ea(a, b, c, d) { + var e, f = 1, g = 20, h = d ? function () { + return d.cur(); + } : function () { + return r.css(a, b, ''); + }, i = h(), j = c && c[3] || (r.cssNumber[b] ? '' : 'px'), k = (r.cssNumber[b] || 'px' !== j && +i) && aa.exec(r.css(a, b)); + if (k && k[3] !== j) { + j = j || k[3], c = c || [], k = +i || 1; + do + f = f || '.5', k /= f, r.style(a, b, k + j); + while (f !== (f = h() / i) && 1 !== f && --g); + } + return c && (k = +k || +i || 0, e = c[1] ? k + (c[1] + 1) * c[2] : +c[2], d && (d.unit = j, d.start = k, d.end = e)), e; + } + var fa = {}; + function ga(a) { + var b, c = a.ownerDocument, d = a.nodeName, e = fa[d]; + return e ? e : (b = c.body.appendChild(c.createElement(d)), e = r.css(b, 'display'), b.parentNode.removeChild(b), 'none' === e && (e = 'block'), fa[d] = e, e); + } + function ha(a, b) { + for (var c, d, e = [], f = 0, g = a.length; f < g; f++) + d = a[f], d.style && (c = d.style.display, b ? ('none' === c && (e[f] = V.get(d, 'display') || null, e[f] || (d.style.display = '')), '' === d.style.display && ca(d) && (e[f] = ga(d))) : 'none' !== c && (e[f] = 'none', V.set(d, 'display', c))); + for (f = 0; f < g; f++) + null != e[f] && (a[f].style.display = e[f]); + return a; + } + r.fn.extend({ + show: function () { + return ha(this, !0); + }, + hide: function () { + return ha(this); + }, + toggle: function (a) { + return 'boolean' == typeof a ? a ? this.show() : this.hide() : this.each(function () { + ca(this) ? r(this).show() : r(this).hide(); + }); + } + }); + var ia = /^(?:checkbox|radio)$/i, ja = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i, ka = /^$|\/(?:java|ecma)script/i, la = { + option: [ + 1, + '' + ], + thead: [ + 1, + '', + '
' + ], + col: [ + 2, + '', + '
' + ], + tr: [ + 2, + '', + '
' + ], + td: [ + 3, + '', + '
' + ], + _default: [ + 0, + '', + '' + ] + }; + la.optgroup = la.option, la.tbody = la.tfoot = la.colgroup = la.caption = la.thead, la.th = la.td; + function ma(a, b) { + var c; + return c = 'undefined' != typeof a.getElementsByTagName ? a.getElementsByTagName(b || '*') : 'undefined' != typeof a.querySelectorAll ? a.querySelectorAll(b || '*') : [], void 0 === b || b && r.nodeName(a, b) ? r.merge([a], c) : c; + } + function na(a, b) { + for (var c = 0, d = a.length; c < d; c++) + V.set(a[c], 'globalEval', !b || V.get(b[c], 'globalEval')); + } + var oa = /<|&#?\w+;/; + function pa(a, b, c, d, e) { + for (var f, g, h, i, j, k, l = b.createDocumentFragment(), m = [], n = 0, o = a.length; n < o; n++) + if (f = a[n], f || 0 === f) + if ('object' === r.type(f)) + r.merge(m, f.nodeType ? [f] : f); + else if (oa.test(f)) { + g = g || l.appendChild(b.createElement('div')), h = (ja.exec(f) || [ + '', + '' + ])[1].toLowerCase(), i = la[h] || la._default, g.innerHTML = i[1] + r.htmlPrefilter(f) + i[2], k = i[0]; + while (k--) + g = g.lastChild; + r.merge(m, g.childNodes), g = l.firstChild, g.textContent = ''; + } else + m.push(b.createTextNode(f)); + l.textContent = '', n = 0; + while (f = m[n++]) + if (d && r.inArray(f, d) > -1) + e && e.push(f); + else if (j = r.contains(f.ownerDocument, f), g = ma(l.appendChild(f), 'script'), j && na(g), c) { + k = 0; + while (f = g[k++]) + ka.test(f.type || '') && c.push(f); + } + return l; + } + !function () { + var a = d.createDocumentFragment(), b = a.appendChild(d.createElement('div')), c = d.createElement('input'); + c.setAttribute('type', 'radio'), c.setAttribute('checked', 'checked'), c.setAttribute('name', 't'), b.appendChild(c), o.checkClone = b.cloneNode(!0).cloneNode(!0).lastChild.checked, b.innerHTML = '', o.noCloneChecked = !!b.cloneNode(!0).lastChild.defaultValue; + }(); + var qa = d.documentElement, ra = /^key/, sa = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, ta = /^([^.]*)(?:\.(.+)|)/; + function ua() { + return !0; + } + function va() { + return !1; + } + function wa() { + try { + return d.activeElement; + } catch (a) { + } + } + function xa(a, b, c, d, e, f) { + var g, h; + if ('object' == typeof b) { + 'string' != typeof c && (d = d || c, c = void 0); + for (h in b) + xa(a, h, c, d, b[h], f); + return a; + } + if (null == d && null == e ? (e = c, d = c = void 0) : null == e && ('string' == typeof c ? (e = d, d = void 0) : (e = d, d = c, c = void 0)), e === !1) + e = va; + else if (!e) + return a; + return 1 === f && (g = e, e = function (a) { + return r().off(a), g.apply(this, arguments); + }, e.guid = g.guid || (g.guid = r.guid++)), a.each(function () { + r.event.add(this, b, e, d, c); + }); + } + r.event = { + global: {}, + add: function (a, b, c, d, e) { + var f, g, h, i, j, k, l, m, n, o, p, q = V.get(a); + if (q) { + c.handler && (f = c, c = f.handler, e = f.selector), e && r.find.matchesSelector(qa, e), c.guid || (c.guid = r.guid++), (i = q.events) || (i = q.events = {}), (g = q.handle) || (g = q.handle = function (b) { + return 'undefined' != typeof r && r.event.triggered !== b.type ? r.event.dispatch.apply(a, arguments) : void 0; + }), b = (b || '').match(K) || [''], j = b.length; + while (j--) + h = ta.exec(b[j]) || [], n = p = h[1], o = (h[2] || '').split('.').sort(), n && (l = r.event.special[n] || {}, n = (e ? l.delegateType : l.bindType) || n, l = r.event.special[n] || {}, k = r.extend({ + type: n, + origType: p, + data: d, + handler: c, + guid: c.guid, + selector: e, + needsContext: e && r.expr.match.needsContext.test(e), + namespace: o.join('.') + }, f), (m = i[n]) || (m = i[n] = [], m.delegateCount = 0, l.setup && l.setup.call(a, d, o, g) !== !1 || a.addEventListener && a.addEventListener(n, g)), l.add && (l.add.call(a, k), k.handler.guid || (k.handler.guid = c.guid)), e ? m.splice(m.delegateCount++, 0, k) : m.push(k), r.event.global[n] = !0); + } + }, + remove: function (a, b, c, d, e) { + var f, g, h, i, j, k, l, m, n, o, p, q = V.hasData(a) && V.get(a); + if (q && (i = q.events)) { + b = (b || '').match(K) || [''], j = b.length; + while (j--) + if (h = ta.exec(b[j]) || [], n = p = h[1], o = (h[2] || '').split('.').sort(), n) { + l = r.event.special[n] || {}, n = (d ? l.delegateType : l.bindType) || n, m = i[n] || [], h = h[2] && new RegExp('(^|\\.)' + o.join('\\.(?:.*\\.|)') + '(\\.|$)'), g = f = m.length; + while (f--) + k = m[f], !e && p !== k.origType || c && c.guid !== k.guid || h && !h.test(k.namespace) || d && d !== k.selector && ('**' !== d || !k.selector) || (m.splice(f, 1), k.selector && m.delegateCount--, l.remove && l.remove.call(a, k)); + g && !m.length && (l.teardown && l.teardown.call(a, o, q.handle) !== !1 || r.removeEvent(a, n, q.handle), delete i[n]); + } else + for (n in i) + r.event.remove(a, n + b[j], c, d, !0); + r.isEmptyObject(i) && V.remove(a, 'handle events'); + } + }, + dispatch: function (a) { + var b = r.event.fix(a), c, d, e, f, g, h, i = new Array(arguments.length), j = (V.get(this, 'events') || {})[b.type] || [], k = r.event.special[b.type] || {}; + for (i[0] = b, c = 1; c < arguments.length; c++) + i[c] = arguments[c]; + if (b.delegateTarget = this, !k.preDispatch || k.preDispatch.call(this, b) !== !1) { + h = r.event.handlers.call(this, b, j), c = 0; + while ((f = h[c++]) && !b.isPropagationStopped()) { + b.currentTarget = f.elem, d = 0; + while ((g = f.handlers[d++]) && !b.isImmediatePropagationStopped()) + b.rnamespace && !b.rnamespace.test(g.namespace) || (b.handleObj = g, b.data = g.data, e = ((r.event.special[g.origType] || {}).handle || g.handler).apply(f.elem, i), void 0 !== e && (b.result = e) === !1 && (b.preventDefault(), b.stopPropagation())); + } + return k.postDispatch && k.postDispatch.call(this, b), b.result; + } + }, + handlers: function (a, b) { + var c, d, e, f, g, h = [], i = b.delegateCount, j = a.target; + if (i && j.nodeType && !('click' === a.type && a.button >= 1)) + for (; j !== this; j = j.parentNode || this) + if (1 === j.nodeType && ('click' !== a.type || j.disabled !== !0)) { + for (f = [], g = {}, c = 0; c < i; c++) + d = b[c], e = d.selector + ' ', void 0 === g[e] && (g[e] = d.needsContext ? r(e, this).index(j) > -1 : r.find(e, this, null, [j]).length), g[e] && f.push(d); + f.length && h.push({ + elem: j, + handlers: f + }); + } + return j = this, i < b.length && h.push({ + elem: j, + handlers: b.slice(i) + }), h; + }, + addProp: function (a, b) { + Object.defineProperty(r.Event.prototype, a, { + enumerable: !0, + configurable: !0, + get: r.isFunction(b) ? function () { + if (this.originalEvent) + return b(this.originalEvent); + } : function () { + if (this.originalEvent) + return this.originalEvent[a]; + }, + set: function (b) { + Object.defineProperty(this, a, { + enumerable: !0, + configurable: !0, + writable: !0, + value: b + }); + } + }); + }, + fix: function (a) { + return a[r.expando] ? a : new r.Event(a); + }, + special: { + load: { noBubble: !0 }, + focus: { + trigger: function () { + if (this !== wa() && this.focus) + return this.focus(), !1; + }, + delegateType: 'focusin' + }, + blur: { + trigger: function () { + if (this === wa() && this.blur) + return this.blur(), !1; + }, + delegateType: 'focusout' + }, + click: { + trigger: function () { + if ('checkbox' === this.type && this.click && r.nodeName(this, 'input')) + return this.click(), !1; + }, + _default: function (a) { + return r.nodeName(a.target, 'a'); + } + }, + beforeunload: { + postDispatch: function (a) { + void 0 !== a.result && a.originalEvent && (a.originalEvent.returnValue = a.result); + } + } + } + }, r.removeEvent = function (a, b, c) { + a.removeEventListener && a.removeEventListener(b, c); + }, r.Event = function (a, b) { + return this instanceof r.Event ? (a && a.type ? (this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || void 0 === a.defaultPrevented && a.returnValue === !1 ? ua : va, this.target = a.target && 3 === a.target.nodeType ? a.target.parentNode : a.target, this.currentTarget = a.currentTarget, this.relatedTarget = a.relatedTarget) : this.type = a, b && r.extend(this, b), this.timeStamp = a && a.timeStamp || r.now(), void (this[r.expando] = !0)) : new r.Event(a, b); + }, r.Event.prototype = { + constructor: r.Event, + isDefaultPrevented: va, + isPropagationStopped: va, + isImmediatePropagationStopped: va, + isSimulated: !1, + preventDefault: function () { + var a = this.originalEvent; + this.isDefaultPrevented = ua, a && !this.isSimulated && a.preventDefault(); + }, + stopPropagation: function () { + var a = this.originalEvent; + this.isPropagationStopped = ua, a && !this.isSimulated && a.stopPropagation(); + }, + stopImmediatePropagation: function () { + var a = this.originalEvent; + this.isImmediatePropagationStopped = ua, a && !this.isSimulated && a.stopImmediatePropagation(), this.stopPropagation(); + } + }, r.each({ + altKey: !0, + bubbles: !0, + cancelable: !0, + changedTouches: !0, + ctrlKey: !0, + detail: !0, + eventPhase: !0, + metaKey: !0, + pageX: !0, + pageY: !0, + shiftKey: !0, + view: !0, + 'char': !0, + charCode: !0, + key: !0, + keyCode: !0, + button: !0, + buttons: !0, + clientX: !0, + clientY: !0, + offsetX: !0, + offsetY: !0, + pointerId: !0, + pointerType: !0, + screenX: !0, + screenY: !0, + targetTouches: !0, + toElement: !0, + touches: !0, + which: function (a) { + var b = a.button; + return null == a.which && ra.test(a.type) ? null != a.charCode ? a.charCode : a.keyCode : !a.which && void 0 !== b && sa.test(a.type) ? 1 & b ? 1 : 2 & b ? 3 : 4 & b ? 2 : 0 : a.which; + } + }, r.event.addProp), r.each({ + mouseenter: 'mouseover', + mouseleave: 'mouseout', + pointerenter: 'pointerover', + pointerleave: 'pointerout' + }, function (a, b) { + r.event.special[a] = { + delegateType: b, + bindType: b, + handle: function (a) { + var c, d = this, e = a.relatedTarget, f = a.handleObj; + return e && (e === d || r.contains(d, e)) || (a.type = f.origType, c = f.handler.apply(this, arguments), a.type = b), c; + } + }; + }), r.fn.extend({ + on: function (a, b, c, d) { + return xa(this, a, b, c, d); + }, + one: function (a, b, c, d) { + return xa(this, a, b, c, d, 1); + }, + off: function (a, b, c) { + var d, e; + if (a && a.preventDefault && a.handleObj) + return d = a.handleObj, r(a.delegateTarget).off(d.namespace ? d.origType + '.' + d.namespace : d.origType, d.selector, d.handler), this; + if ('object' == typeof a) { + for (e in a) + this.off(e, b, a[e]); + return this; + } + return b !== !1 && 'function' != typeof b || (c = b, b = void 0), c === !1 && (c = va), this.each(function () { + r.event.remove(this, a, c, b); + }); + } + }); + var ya = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, za = /\s*$/g; + function Da(a, b) { + return r.nodeName(a, 'table') && r.nodeName(11 !== b.nodeType ? b : b.firstChild, 'tr') ? a.getElementsByTagName('tbody')[0] || a : a; + } + function Ea(a) { + return a.type = (null !== a.getAttribute('type')) + '/' + a.type, a; + } + function Fa(a) { + var b = Ba.exec(a.type); + return b ? a.type = b[1] : a.removeAttribute('type'), a; + } + function Ga(a, b) { + var c, d, e, f, g, h, i, j; + if (1 === b.nodeType) { + if (V.hasData(a) && (f = V.access(a), g = V.set(b, f), j = f.events)) { + delete g.handle, g.events = {}; + for (e in j) + for (c = 0, d = j[e].length; c < d; c++) + r.event.add(b, e, j[e][c]); + } + W.hasData(a) && (h = W.access(a), i = r.extend({}, h), W.set(b, i)); + } + } + function Ha(a, b) { + var c = b.nodeName.toLowerCase(); + 'input' === c && ia.test(a.type) ? b.checked = a.checked : 'input' !== c && 'textarea' !== c || (b.defaultValue = a.defaultValue); + } + function Ia(a, b, c, d) { + b = g.apply([], b); + var e, f, h, i, j, k, l = 0, m = a.length, n = m - 1, q = b[0], s = r.isFunction(q); + if (s || m > 1 && 'string' == typeof q && !o.checkClone && Aa.test(q)) + return a.each(function (e) { + var f = a.eq(e); + s && (b[0] = q.call(this, e, f.html())), Ia(f, b, c, d); + }); + if (m && (e = pa(b, a[0].ownerDocument, !1, a, d), f = e.firstChild, 1 === e.childNodes.length && (e = f), f || d)) { + for (h = r.map(ma(e, 'script'), Ea), i = h.length; l < m; l++) + j = e, l !== n && (j = r.clone(j, !0, !0), i && r.merge(h, ma(j, 'script'))), c.call(a[l], j, l); + if (i) + for (k = h[h.length - 1].ownerDocument, r.map(h, Fa), l = 0; l < i; l++) + j = h[l], ka.test(j.type || '') && !V.access(j, 'globalEval') && r.contains(k, j) && (j.src ? r._evalUrl && r._evalUrl(j.src) : p(j.textContent.replace(Ca, ''), k)); + } + return a; + } + function Ja(a, b, c) { + for (var d, e = b ? r.filter(b, a) : a, f = 0; null != (d = e[f]); f++) + c || 1 !== d.nodeType || r.cleanData(ma(d)), d.parentNode && (c && r.contains(d.ownerDocument, d) && na(ma(d, 'script')), d.parentNode.removeChild(d)); + return a; + } + r.extend({ + htmlPrefilter: function (a) { + return a.replace(ya, '<$1>'); + }, + clone: function (a, b, c) { + var d, e, f, g, h = a.cloneNode(!0), i = r.contains(a.ownerDocument, a); + if (!(o.noCloneChecked || 1 !== a.nodeType && 11 !== a.nodeType || r.isXMLDoc(a))) + for (g = ma(h), f = ma(a), d = 0, e = f.length; d < e; d++) + Ha(f[d], g[d]); + if (b) + if (c) + for (f = f || ma(a), g = g || ma(h), d = 0, e = f.length; d < e; d++) + Ga(f[d], g[d]); + else + Ga(a, h); + return g = ma(h, 'script'), g.length > 0 && na(g, !i && ma(a, 'script')), h; + }, + cleanData: function (a) { + for (var b, c, d, e = r.event.special, f = 0; void 0 !== (c = a[f]); f++) + if (T(c)) { + if (b = c[V.expando]) { + if (b.events) + for (d in b.events) + e[d] ? r.event.remove(c, d) : r.removeEvent(c, d, b.handle); + c[V.expando] = void 0; + } + c[W.expando] && (c[W.expando] = void 0); + } + } + }), r.fn.extend({ + detach: function (a) { + return Ja(this, a, !0); + }, + remove: function (a) { + return Ja(this, a); + }, + text: function (a) { + return S(this, function (a) { + return void 0 === a ? r.text(this) : this.empty().each(function () { + 1 !== this.nodeType && 11 !== this.nodeType && 9 !== this.nodeType || (this.textContent = a); + }); + }, null, a, arguments.length); + }, + append: function () { + return Ia(this, arguments, function (a) { + if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) { + var b = Da(this, a); + b.appendChild(a); + } + }); + }, + prepend: function () { + return Ia(this, arguments, function (a) { + if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) { + var b = Da(this, a); + b.insertBefore(a, b.firstChild); + } + }); + }, + before: function () { + return Ia(this, arguments, function (a) { + this.parentNode && this.parentNode.insertBefore(a, this); + }); + }, + after: function () { + return Ia(this, arguments, function (a) { + this.parentNode && this.parentNode.insertBefore(a, this.nextSibling); + }); + }, + empty: function () { + for (var a, b = 0; null != (a = this[b]); b++) + 1 === a.nodeType && (r.cleanData(ma(a, !1)), a.textContent = ''); + return this; + }, + clone: function (a, b) { + return a = null != a && a, b = null == b ? a : b, this.map(function () { + return r.clone(this, a, b); + }); + }, + html: function (a) { + return S(this, function (a) { + var b = this[0] || {}, c = 0, d = this.length; + if (void 0 === a && 1 === b.nodeType) + return b.innerHTML; + if ('string' == typeof a && !za.test(a) && !la[(ja.exec(a) || [ + '', + '' + ])[1].toLowerCase()]) { + a = r.htmlPrefilter(a); + try { + for (; c < d; c++) + b = this[c] || {}, 1 === b.nodeType && (r.cleanData(ma(b, !1)), b.innerHTML = a); + b = 0; + } catch (e) { + } + } + b && this.empty().append(a); + }, null, a, arguments.length); + }, + replaceWith: function () { + var a = []; + return Ia(this, arguments, function (b) { + var c = this.parentNode; + r.inArray(this, a) < 0 && (r.cleanData(ma(this)), c && c.replaceChild(b, this)); + }, a); + } + }), r.each({ + appendTo: 'append', + prependTo: 'prepend', + insertBefore: 'before', + insertAfter: 'after', + replaceAll: 'replaceWith' + }, function (a, b) { + r.fn[a] = function (a) { + for (var c, d = [], e = r(a), f = e.length - 1, g = 0; g <= f; g++) + c = g === f ? this : this.clone(!0), r(e[g])[b](c), h.apply(d, c.get()); + return this.pushStack(d); + }; + }); + var Ka = /^margin/, La = new RegExp('^(' + _ + ')(?!px)[a-z%]+$', 'i'), Ma = function (b) { + var c = b.ownerDocument.defaultView; + return c && c.opener || (c = a), c.getComputedStyle(b); + }; + !function () { + function b() { + if (i) { + i.style.cssText = 'box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%', i.innerHTML = '', qa.appendChild(h); + var b = a.getComputedStyle(i); + c = '1%' !== b.top, g = '2px' === b.marginLeft, e = '4px' === b.width, i.style.marginRight = '50%', f = '4px' === b.marginRight, qa.removeChild(h), i = null; + } + } + var c, e, f, g, h = d.createElement('div'), i = d.createElement('div'); + i.style && (i.style.backgroundClip = 'content-box', i.cloneNode(!0).style.backgroundClip = '', o.clearCloneStyle = 'content-box' === i.style.backgroundClip, h.style.cssText = 'border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute', h.appendChild(i), r.extend(o, { + pixelPosition: function () { + return b(), c; + }, + boxSizingReliable: function () { + return b(), e; + }, + pixelMarginRight: function () { + return b(), f; + }, + reliableMarginLeft: function () { + return b(), g; + } + })); + }(); + function Na(a, b, c) { + var d, e, f, g, h = a.style; + return c = c || Ma(a), c && (g = c.getPropertyValue(b) || c[b], '' !== g || r.contains(a.ownerDocument, a) || (g = r.style(a, b)), !o.pixelMarginRight() && La.test(g) && Ka.test(b) && (d = h.width, e = h.minWidth, f = h.maxWidth, h.minWidth = h.maxWidth = h.width = g, g = c.width, h.width = d, h.minWidth = e, h.maxWidth = f)), void 0 !== g ? g + '' : g; + } + function Oa(a, b) { + return { + get: function () { + return a() ? void delete this.get : (this.get = b).apply(this, arguments); + } + }; + } + var Pa = /^(none|table(?!-c[ea]).+)/, Qa = { + position: 'absolute', + visibility: 'hidden', + display: 'block' + }, Ra = { + letterSpacing: '0', + fontWeight: '400' + }, Sa = [ + 'Webkit', + 'Moz', + 'ms' + ], Ta = d.createElement('div').style; + function Ua(a) { + if (a in Ta) + return a; + var b = a[0].toUpperCase() + a.slice(1), c = Sa.length; + while (c--) + if (a = Sa[c] + b, a in Ta) + return a; + } + function Va(a, b, c) { + var d = aa.exec(b); + return d ? Math.max(0, d[2] - (c || 0)) + (d[3] || 'px') : b; + } + function Wa(a, b, c, d, e) { + var f, g = 0; + for (f = c === (d ? 'border' : 'content') ? 4 : 'width' === b ? 1 : 0; f < 4; f += 2) + 'margin' === c && (g += r.css(a, c + ba[f], !0, e)), d ? ('content' === c && (g -= r.css(a, 'padding' + ba[f], !0, e)), 'margin' !== c && (g -= r.css(a, 'border' + ba[f] + 'Width', !0, e))) : (g += r.css(a, 'padding' + ba[f], !0, e), 'padding' !== c && (g += r.css(a, 'border' + ba[f] + 'Width', !0, e))); + return g; + } + function Xa(a, b, c) { + var d, e = !0, f = Ma(a), g = 'border-box' === r.css(a, 'boxSizing', !1, f); + if (a.getClientRects().length && (d = a.getBoundingClientRect()[b]), d <= 0 || null == d) { + if (d = Na(a, b, f), (d < 0 || null == d) && (d = a.style[b]), La.test(d)) + return d; + e = g && (o.boxSizingReliable() || d === a.style[b]), d = parseFloat(d) || 0; + } + return d + Wa(a, b, c || (g ? 'border' : 'content'), e, f) + 'px'; + } + r.extend({ + cssHooks: { + opacity: { + get: function (a, b) { + if (b) { + var c = Na(a, 'opacity'); + return '' === c ? '1' : c; + } + } + } + }, + cssNumber: { + animationIterationCount: !0, + columnCount: !0, + fillOpacity: !0, + flexGrow: !0, + flexShrink: !0, + fontWeight: !0, + lineHeight: !0, + opacity: !0, + order: !0, + orphans: !0, + widows: !0, + zIndex: !0, + zoom: !0 + }, + cssProps: { 'float': 'cssFloat' }, + style: function (a, b, c, d) { + if (a && 3 !== a.nodeType && 8 !== a.nodeType && a.style) { + var e, f, g, h = r.camelCase(b), i = a.style; + return b = r.cssProps[h] || (r.cssProps[h] = Ua(h) || h), g = r.cssHooks[b] || r.cssHooks[h], void 0 === c ? g && 'get' in g && void 0 !== (e = g.get(a, !1, d)) ? e : i[b] : (f = typeof c, 'string' === f && (e = aa.exec(c)) && e[1] && (c = ea(a, b, e), f = 'number'), null != c && c === c && ('number' === f && (c += e && e[3] || (r.cssNumber[h] ? '' : 'px')), o.clearCloneStyle || '' !== c || 0 !== b.indexOf('background') || (i[b] = 'inherit'), g && 'set' in g && void 0 === (c = g.set(a, c, d)) || (i[b] = c)), void 0); + } + }, + css: function (a, b, c, d) { + var e, f, g, h = r.camelCase(b); + return b = r.cssProps[h] || (r.cssProps[h] = Ua(h) || h), g = r.cssHooks[b] || r.cssHooks[h], g && 'get' in g && (e = g.get(a, !0, c)), void 0 === e && (e = Na(a, b, d)), 'normal' === e && b in Ra && (e = Ra[b]), '' === c || c ? (f = parseFloat(e), c === !0 || isFinite(f) ? f || 0 : e) : e; + } + }), r.each([ + 'height', + 'width' + ], function (a, b) { + r.cssHooks[b] = { + get: function (a, c, d) { + if (c) + return !Pa.test(r.css(a, 'display')) || a.getClientRects().length && a.getBoundingClientRect().width ? Xa(a, b, d) : da(a, Qa, function () { + return Xa(a, b, d); + }); + }, + set: function (a, c, d) { + var e, f = d && Ma(a), g = d && Wa(a, b, d, 'border-box' === r.css(a, 'boxSizing', !1, f), f); + return g && (e = aa.exec(c)) && 'px' !== (e[3] || 'px') && (a.style[b] = c, c = r.css(a, b)), Va(a, c, g); + } + }; + }), r.cssHooks.marginLeft = Oa(o.reliableMarginLeft, function (a, b) { + if (b) + return (parseFloat(Na(a, 'marginLeft')) || a.getBoundingClientRect().left - da(a, { marginLeft: 0 }, function () { + return a.getBoundingClientRect().left; + })) + 'px'; + }), r.each({ + margin: '', + padding: '', + border: 'Width' + }, function (a, b) { + r.cssHooks[a + b] = { + expand: function (c) { + for (var d = 0, e = {}, f = 'string' == typeof c ? c.split(' ') : [c]; d < 4; d++) + e[a + ba[d] + b] = f[d] || f[d - 2] || f[0]; + return e; + } + }, Ka.test(a) || (r.cssHooks[a + b].set = Va); + }), r.fn.extend({ + css: function (a, b) { + return S(this, function (a, b, c) { + var d, e, f = {}, g = 0; + if (r.isArray(b)) { + for (d = Ma(a), e = b.length; g < e; g++) + f[b[g]] = r.css(a, b[g], !1, d); + return f; + } + return void 0 !== c ? r.style(a, b, c) : r.css(a, b); + }, a, b, arguments.length > 1); + } + }); + function Ya(a, b, c, d, e) { + return new Ya.prototype.init(a, b, c, d, e); + } + r.Tween = Ya, Ya.prototype = { + constructor: Ya, + init: function (a, b, c, d, e, f) { + this.elem = a, this.prop = c, this.easing = e || r.easing._default, this.options = b, this.start = this.now = this.cur(), this.end = d, this.unit = f || (r.cssNumber[c] ? '' : 'px'); + }, + cur: function () { + var a = Ya.propHooks[this.prop]; + return a && a.get ? a.get(this) : Ya.propHooks._default.get(this); + }, + run: function (a) { + var b, c = Ya.propHooks[this.prop]; + return this.options.duration ? this.pos = b = r.easing[this.easing](a, this.options.duration * a, 0, 1, this.options.duration) : this.pos = b = a, this.now = (this.end - this.start) * b + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), c && c.set ? c.set(this) : Ya.propHooks._default.set(this), this; + } + }, Ya.prototype.init.prototype = Ya.prototype, Ya.propHooks = { + _default: { + get: function (a) { + var b; + return 1 !== a.elem.nodeType || null != a.elem[a.prop] && null == a.elem.style[a.prop] ? a.elem[a.prop] : (b = r.css(a.elem, a.prop, ''), b && 'auto' !== b ? b : 0); + }, + set: function (a) { + r.fx.step[a.prop] ? r.fx.step[a.prop](a) : 1 !== a.elem.nodeType || null == a.elem.style[r.cssProps[a.prop]] && !r.cssHooks[a.prop] ? a.elem[a.prop] = a.now : r.style(a.elem, a.prop, a.now + a.unit); + } + } + }, Ya.propHooks.scrollTop = Ya.propHooks.scrollLeft = { + set: function (a) { + a.elem.nodeType && a.elem.parentNode && (a.elem[a.prop] = a.now); + } + }, r.easing = { + linear: function (a) { + return a; + }, + swing: function (a) { + return 0.5 - Math.cos(a * Math.PI) / 2; + }, + _default: 'swing' + }, r.fx = Ya.prototype.init, r.fx.step = {}; + var Za, $a, _a = /^(?:toggle|show|hide)$/, ab = /queueHooks$/; + function bb() { + $a && (a.requestAnimationFrame(bb), r.fx.tick()); + } + function cb() { + return a.setTimeout(function () { + Za = void 0; + }), Za = r.now(); + } + function db(a, b) { + var c, d = 0, e = { height: a }; + for (b = b ? 1 : 0; d < 4; d += 2 - b) + c = ba[d], e['margin' + c] = e['padding' + c] = a; + return b && (e.opacity = e.width = a), e; + } + function eb(a, b, c) { + for (var d, e = (hb.tweeners[b] || []).concat(hb.tweeners['*']), f = 0, g = e.length; f < g; f++) + if (d = e[f].call(c, b, a)) + return d; + } + function fb(a, b, c) { + var d, e, f, g, h, i, j, k, l = 'width' in b || 'height' in b, m = this, n = {}, o = a.style, p = a.nodeType && ca(a), q = V.get(a, 'fxshow'); + c.queue || (g = r._queueHooks(a, 'fx'), null == g.unqueued && (g.unqueued = 0, h = g.empty.fire, g.empty.fire = function () { + g.unqueued || h(); + }), g.unqueued++, m.always(function () { + m.always(function () { + g.unqueued--, r.queue(a, 'fx').length || g.empty.fire(); + }); + })); + for (d in b) + if (e = b[d], _a.test(e)) { + if (delete b[d], f = f || 'toggle' === e, e === (p ? 'hide' : 'show')) { + if ('show' !== e || !q || void 0 === q[d]) + continue; + p = !0; + } + n[d] = q && q[d] || r.style(a, d); + } + if (i = !r.isEmptyObject(b), i || !r.isEmptyObject(n)) { + l && 1 === a.nodeType && (c.overflow = [ + o.overflow, + o.overflowX, + o.overflowY + ], j = q && q.display, null == j && (j = V.get(a, 'display')), k = r.css(a, 'display'), 'none' === k && (j ? k = j : (ha([a], !0), j = a.style.display || j, k = r.css(a, 'display'), ha([a]))), ('inline' === k || 'inline-block' === k && null != j) && 'none' === r.css(a, 'float') && (i || (m.done(function () { + o.display = j; + }), null == j && (k = o.display, j = 'none' === k ? '' : k)), o.display = 'inline-block')), c.overflow && (o.overflow = 'hidden', m.always(function () { + o.overflow = c.overflow[0], o.overflowX = c.overflow[1], o.overflowY = c.overflow[2]; + })), i = !1; + for (d in n) + i || (q ? 'hidden' in q && (p = q.hidden) : q = V.access(a, 'fxshow', { display: j }), f && (q.hidden = !p), p && ha([a], !0), m.done(function () { + p || ha([a]), V.remove(a, 'fxshow'); + for (d in n) + r.style(a, d, n[d]); + })), i = eb(p ? q[d] : 0, d, m), d in q || (q[d] = i.start, p && (i.end = i.start, i.start = 0)); + } + } + function gb(a, b) { + var c, d, e, f, g; + for (c in a) + if (d = r.camelCase(c), e = b[d], f = a[c], r.isArray(f) && (e = f[1], f = a[c] = f[0]), c !== d && (a[d] = f, delete a[c]), g = r.cssHooks[d], g && 'expand' in g) { + f = g.expand(f), delete a[d]; + for (c in f) + c in a || (a[c] = f[c], b[c] = e); + } else + b[d] = e; + } + function hb(a, b, c) { + var d, e, f = 0, g = hb.prefilters.length, h = r.Deferred().always(function () { + delete i.elem; + }), i = function () { + if (e) + return !1; + for (var b = Za || cb(), c = Math.max(0, j.startTime + j.duration - b), d = c / j.duration || 0, f = 1 - d, g = 0, i = j.tweens.length; g < i; g++) + j.tweens[g].run(f); + return h.notifyWith(a, [ + j, + f, + c + ]), f < 1 && i ? c : (h.resolveWith(a, [j]), !1); + }, j = h.promise({ + elem: a, + props: r.extend({}, b), + opts: r.extend(!0, { + specialEasing: {}, + easing: r.easing._default + }, c), + originalProperties: b, + originalOptions: c, + startTime: Za || cb(), + duration: c.duration, + tweens: [], + createTween: function (b, c) { + var d = r.Tween(a, j.opts, b, c, j.opts.specialEasing[b] || j.opts.easing); + return j.tweens.push(d), d; + }, + stop: function (b) { + var c = 0, d = b ? j.tweens.length : 0; + if (e) + return this; + for (e = !0; c < d; c++) + j.tweens[c].run(1); + return b ? (h.notifyWith(a, [ + j, + 1, + 0 + ]), h.resolveWith(a, [ + j, + b + ])) : h.rejectWith(a, [ + j, + b + ]), this; + } + }), k = j.props; + for (gb(k, j.opts.specialEasing); f < g; f++) + if (d = hb.prefilters[f].call(j, a, k, j.opts)) + return r.isFunction(d.stop) && (r._queueHooks(j.elem, j.opts.queue).stop = r.proxy(d.stop, d)), d; + return r.map(k, eb, j), r.isFunction(j.opts.start) && j.opts.start.call(a, j), r.fx.timer(r.extend(i, { + elem: a, + anim: j, + queue: j.opts.queue + })), j.progress(j.opts.progress).done(j.opts.done, j.opts.complete).fail(j.opts.fail).always(j.opts.always); + } + r.Animation = r.extend(hb, { + tweeners: { + '*': [function (a, b) { + var c = this.createTween(a, b); + return ea(c.elem, a, aa.exec(b), c), c; + }] + }, + tweener: function (a, b) { + r.isFunction(a) ? (b = a, a = ['*']) : a = a.match(K); + for (var c, d = 0, e = a.length; d < e; d++) + c = a[d], hb.tweeners[c] = hb.tweeners[c] || [], hb.tweeners[c].unshift(b); + }, + prefilters: [fb], + prefilter: function (a, b) { + b ? hb.prefilters.unshift(a) : hb.prefilters.push(a); + } + }), r.speed = function (a, b, c) { + var e = a && 'object' == typeof a ? r.extend({}, a) : { + complete: c || !c && b || r.isFunction(a) && a, + duration: a, + easing: c && b || b && !r.isFunction(b) && b + }; + return r.fx.off || d.hidden ? e.duration = 0 : 'number' != typeof e.duration && (e.duration in r.fx.speeds ? e.duration = r.fx.speeds[e.duration] : e.duration = r.fx.speeds._default), null != e.queue && e.queue !== !0 || (e.queue = 'fx'), e.old = e.complete, e.complete = function () { + r.isFunction(e.old) && e.old.call(this), e.queue && r.dequeue(this, e.queue); + }, e; + }, r.fn.extend({ + fadeTo: function (a, b, c, d) { + return this.filter(ca).css('opacity', 0).show().end().animate({ opacity: b }, a, c, d); + }, + animate: function (a, b, c, d) { + var e = r.isEmptyObject(a), f = r.speed(b, c, d), g = function () { + var b = hb(this, r.extend({}, a), f); + (e || V.get(this, 'finish')) && b.stop(!0); + }; + return g.finish = g, e || f.queue === !1 ? this.each(g) : this.queue(f.queue, g); + }, + stop: function (a, b, c) { + var d = function (a) { + var b = a.stop; + delete a.stop, b(c); + }; + return 'string' != typeof a && (c = b, b = a, a = void 0), b && a !== !1 && this.queue(a || 'fx', []), this.each(function () { + var b = !0, e = null != a && a + 'queueHooks', f = r.timers, g = V.get(this); + if (e) + g[e] && g[e].stop && d(g[e]); + else + for (e in g) + g[e] && g[e].stop && ab.test(e) && d(g[e]); + for (e = f.length; e--;) + f[e].elem !== this || null != a && f[e].queue !== a || (f[e].anim.stop(c), b = !1, f.splice(e, 1)); + !b && c || r.dequeue(this, a); + }); + }, + finish: function (a) { + return a !== !1 && (a = a || 'fx'), this.each(function () { + var b, c = V.get(this), d = c[a + 'queue'], e = c[a + 'queueHooks'], f = r.timers, g = d ? d.length : 0; + for (c.finish = !0, r.queue(this, a, []), e && e.stop && e.stop.call(this, !0), b = f.length; b--;) + f[b].elem === this && f[b].queue === a && (f[b].anim.stop(!0), f.splice(b, 1)); + for (b = 0; b < g; b++) + d[b] && d[b].finish && d[b].finish.call(this); + delete c.finish; + }); + } + }), r.each([ + 'toggle', + 'show', + 'hide' + ], function (a, b) { + var c = r.fn[b]; + r.fn[b] = function (a, d, e) { + return null == a || 'boolean' == typeof a ? c.apply(this, arguments) : this.animate(db(b, !0), a, d, e); + }; + }), r.each({ + slideDown: db('show'), + slideUp: db('hide'), + slideToggle: db('toggle'), + fadeIn: { opacity: 'show' }, + fadeOut: { opacity: 'hide' }, + fadeToggle: { opacity: 'toggle' } + }, function (a, b) { + r.fn[a] = function (a, c, d) { + return this.animate(b, a, c, d); + }; + }), r.timers = [], r.fx.tick = function () { + var a, b = 0, c = r.timers; + for (Za = r.now(); b < c.length; b++) + a = c[b], a() || c[b] !== a || c.splice(b--, 1); + c.length || r.fx.stop(), Za = void 0; + }, r.fx.timer = function (a) { + r.timers.push(a), a() ? r.fx.start() : r.timers.pop(); + }, r.fx.interval = 13, r.fx.start = function () { + $a || ($a = a.requestAnimationFrame ? a.requestAnimationFrame(bb) : a.setInterval(r.fx.tick, r.fx.interval)); + }, r.fx.stop = function () { + a.cancelAnimationFrame ? a.cancelAnimationFrame($a) : a.clearInterval($a), $a = null; + }, r.fx.speeds = { + slow: 600, + fast: 200, + _default: 400 + }, r.fn.delay = function (b, c) { + return b = r.fx ? r.fx.speeds[b] || b : b, c = c || 'fx', this.queue(c, function (c, d) { + var e = a.setTimeout(c, b); + d.stop = function () { + a.clearTimeout(e); + }; + }); + }, function () { + var a = d.createElement('input'), b = d.createElement('select'), c = b.appendChild(d.createElement('option')); + a.type = 'checkbox', o.checkOn = '' !== a.value, o.optSelected = c.selected, a = d.createElement('input'), a.value = 't', a.type = 'radio', o.radioValue = 't' === a.value; + }(); + var ib, jb = r.expr.attrHandle; + r.fn.extend({ + attr: function (a, b) { + return S(this, r.attr, a, b, arguments.length > 1); + }, + removeAttr: function (a) { + return this.each(function () { + r.removeAttr(this, a); + }); + } + }), r.extend({ + attr: function (a, b, c) { + var d, e, f = a.nodeType; + if (3 !== f && 8 !== f && 2 !== f) + return 'undefined' == typeof a.getAttribute ? r.prop(a, b, c) : (1 === f && r.isXMLDoc(a) || (e = r.attrHooks[b.toLowerCase()] || (r.expr.match.bool.test(b) ? ib : void 0)), void 0 !== c ? null === c ? void r.removeAttr(a, b) : e && 'set' in e && void 0 !== (d = e.set(a, c, b)) ? d : (a.setAttribute(b, c + ''), c) : e && 'get' in e && null !== (d = e.get(a, b)) ? d : (d = r.find.attr(a, b), null == d ? void 0 : d)); + }, + attrHooks: { + type: { + set: function (a, b) { + if (!o.radioValue && 'radio' === b && r.nodeName(a, 'input')) { + var c = a.value; + return a.setAttribute('type', b), c && (a.value = c), b; + } + } + } + }, + removeAttr: function (a, b) { + var c, d = 0, e = b && b.match(K); + if (e && 1 === a.nodeType) + while (c = e[d++]) + a.removeAttribute(c); + } + }), ib = { + set: function (a, b, c) { + return b === !1 ? r.removeAttr(a, c) : a.setAttribute(c, c), c; + } + }, r.each(r.expr.match.bool.source.match(/\w+/g), function (a, b) { + var c = jb[b] || r.find.attr; + jb[b] = function (a, b, d) { + var e, f, g = b.toLowerCase(); + return d || (f = jb[g], jb[g] = e, e = null != c(a, b, d) ? g : null, jb[g] = f), e; + }; + }); + var kb = /^(?:input|select|textarea|button)$/i, lb = /^(?:a|area)$/i; + r.fn.extend({ + prop: function (a, b) { + return S(this, r.prop, a, b, arguments.length > 1); + }, + removeProp: function (a) { + return this.each(function () { + delete this[r.propFix[a] || a]; + }); + } + }), r.extend({ + prop: function (a, b, c) { + var d, e, f = a.nodeType; + if (3 !== f && 8 !== f && 2 !== f) + return 1 === f && r.isXMLDoc(a) || (b = r.propFix[b] || b, e = r.propHooks[b]), void 0 !== c ? e && 'set' in e && void 0 !== (d = e.set(a, c, b)) ? d : a[b] = c : e && 'get' in e && null !== (d = e.get(a, b)) ? d : a[b]; + }, + propHooks: { + tabIndex: { + get: function (a) { + var b = r.find.attr(a, 'tabindex'); + return b ? parseInt(b, 10) : kb.test(a.nodeName) || lb.test(a.nodeName) && a.href ? 0 : -1; + } + } + }, + propFix: { + 'for': 'htmlFor', + 'class': 'className' + } + }), o.optSelected || (r.propHooks.selected = { + get: function (a) { + var b = a.parentNode; + return b && b.parentNode && b.parentNode.selectedIndex, null; + }, + set: function (a) { + var b = a.parentNode; + b && (b.selectedIndex, b.parentNode && b.parentNode.selectedIndex); + } + }), r.each([ + 'tabIndex', + 'readOnly', + 'maxLength', + 'cellSpacing', + 'cellPadding', + 'rowSpan', + 'colSpan', + 'useMap', + 'frameBorder', + 'contentEditable' + ], function () { + r.propFix[this.toLowerCase()] = this; + }); + function mb(a) { + var b = a.match(K) || []; + return b.join(' '); + } + function nb(a) { + return a.getAttribute && a.getAttribute('class') || ''; + } + r.fn.extend({ + addClass: function (a) { + var b, c, d, e, f, g, h, i = 0; + if (r.isFunction(a)) + return this.each(function (b) { + r(this).addClass(a.call(this, b, nb(this))); + }); + if ('string' == typeof a && a) { + b = a.match(K) || []; + while (c = this[i++]) + if (e = nb(c), d = 1 === c.nodeType && ' ' + mb(e) + ' ') { + g = 0; + while (f = b[g++]) + d.indexOf(' ' + f + ' ') < 0 && (d += f + ' '); + h = mb(d), e !== h && c.setAttribute('class', h); + } + } + return this; + }, + removeClass: function (a) { + var b, c, d, e, f, g, h, i = 0; + if (r.isFunction(a)) + return this.each(function (b) { + r(this).removeClass(a.call(this, b, nb(this))); + }); + if (!arguments.length) + return this.attr('class', ''); + if ('string' == typeof a && a) { + b = a.match(K) || []; + while (c = this[i++]) + if (e = nb(c), d = 1 === c.nodeType && ' ' + mb(e) + ' ') { + g = 0; + while (f = b[g++]) + while (d.indexOf(' ' + f + ' ') > -1) + d = d.replace(' ' + f + ' ', ' '); + h = mb(d), e !== h && c.setAttribute('class', h); + } + } + return this; + }, + toggleClass: function (a, b) { + var c = typeof a; + return 'boolean' == typeof b && 'string' === c ? b ? this.addClass(a) : this.removeClass(a) : r.isFunction(a) ? this.each(function (c) { + r(this).toggleClass(a.call(this, c, nb(this), b), b); + }) : this.each(function () { + var b, d, e, f; + if ('string' === c) { + d = 0, e = r(this), f = a.match(K) || []; + while (b = f[d++]) + e.hasClass(b) ? e.removeClass(b) : e.addClass(b); + } else + void 0 !== a && 'boolean' !== c || (b = nb(this), b && V.set(this, '__className__', b), this.setAttribute && this.setAttribute('class', b || a === !1 ? '' : V.get(this, '__className__') || '')); + }); + }, + hasClass: function (a) { + var b, c, d = 0; + b = ' ' + a + ' '; + while (c = this[d++]) + if (1 === c.nodeType && (' ' + mb(nb(c)) + ' ').indexOf(b) > -1) + return !0; + return !1; + } + }); + var ob = /\r/g; + r.fn.extend({ + val: function (a) { + var b, c, d, e = this[0]; + { + if (arguments.length) + return d = r.isFunction(a), this.each(function (c) { + var e; + 1 === this.nodeType && (e = d ? a.call(this, c, r(this).val()) : a, null == e ? e = '' : 'number' == typeof e ? e += '' : r.isArray(e) && (e = r.map(e, function (a) { + return null == a ? '' : a + ''; + })), b = r.valHooks[this.type] || r.valHooks[this.nodeName.toLowerCase()], b && 'set' in b && void 0 !== b.set(this, e, 'value') || (this.value = e)); + }); + if (e) + return b = r.valHooks[e.type] || r.valHooks[e.nodeName.toLowerCase()], b && 'get' in b && void 0 !== (c = b.get(e, 'value')) ? c : (c = e.value, 'string' == typeof c ? c.replace(ob, '') : null == c ? '' : c); + } + } + }), r.extend({ + valHooks: { + option: { + get: function (a) { + var b = r.find.attr(a, 'value'); + return null != b ? b : mb(r.text(a)); + } + }, + select: { + get: function (a) { + var b, c, d, e = a.options, f = a.selectedIndex, g = 'select-one' === a.type, h = g ? null : [], i = g ? f + 1 : e.length; + for (d = f < 0 ? i : g ? f : 0; d < i; d++) + if (c = e[d], (c.selected || d === f) && !c.disabled && (!c.parentNode.disabled || !r.nodeName(c.parentNode, 'optgroup'))) { + if (b = r(c).val(), g) + return b; + h.push(b); + } + return h; + }, + set: function (a, b) { + var c, d, e = a.options, f = r.makeArray(b), g = e.length; + while (g--) + d = e[g], (d.selected = r.inArray(r.valHooks.option.get(d), f) > -1) && (c = !0); + return c || (a.selectedIndex = -1), f; + } + } + } + }), r.each([ + 'radio', + 'checkbox' + ], function () { + r.valHooks[this] = { + set: function (a, b) { + if (r.isArray(b)) + return a.checked = r.inArray(r(a).val(), b) > -1; + } + }, o.checkOn || (r.valHooks[this].get = function (a) { + return null === a.getAttribute('value') ? 'on' : a.value; + }); + }); + var pb = /^(?:focusinfocus|focusoutblur)$/; + r.extend(r.event, { + trigger: function (b, c, e, f) { + var g, h, i, j, k, m, n, o = [e || d], p = l.call(b, 'type') ? b.type : b, q = l.call(b, 'namespace') ? b.namespace.split('.') : []; + if (h = i = e = e || d, 3 !== e.nodeType && 8 !== e.nodeType && !pb.test(p + r.event.triggered) && (p.indexOf('.') > -1 && (q = p.split('.'), p = q.shift(), q.sort()), k = p.indexOf(':') < 0 && 'on' + p, b = b[r.expando] ? b : new r.Event(p, 'object' == typeof b && b), b.isTrigger = f ? 2 : 3, b.namespace = q.join('.'), b.rnamespace = b.namespace ? new RegExp('(^|\\.)' + q.join('\\.(?:.*\\.|)') + '(\\.|$)') : null, b.result = void 0, b.target || (b.target = e), c = null == c ? [b] : r.makeArray(c, [b]), n = r.event.special[p] || {}, f || !n.trigger || n.trigger.apply(e, c) !== !1)) { + if (!f && !n.noBubble && !r.isWindow(e)) { + for (j = n.delegateType || p, pb.test(j + p) || (h = h.parentNode); h; h = h.parentNode) + o.push(h), i = h; + i === (e.ownerDocument || d) && o.push(i.defaultView || i.parentWindow || a); + } + g = 0; + while ((h = o[g++]) && !b.isPropagationStopped()) + b.type = g > 1 ? j : n.bindType || p, m = (V.get(h, 'events') || {})[b.type] && V.get(h, 'handle'), m && m.apply(h, c), m = k && h[k], m && m.apply && T(h) && (b.result = m.apply(h, c), b.result === !1 && b.preventDefault()); + return b.type = p, f || b.isDefaultPrevented() || n._default && n._default.apply(o.pop(), c) !== !1 || !T(e) || k && r.isFunction(e[p]) && !r.isWindow(e) && (i = e[k], i && (e[k] = null), r.event.triggered = p, e[p](), r.event.triggered = void 0, i && (e[k] = i)), b.result; + } + }, + simulate: function (a, b, c) { + var d = r.extend(new r.Event(), c, { + type: a, + isSimulated: !0 + }); + r.event.trigger(d, null, b); + } + }), r.fn.extend({ + trigger: function (a, b) { + return this.each(function () { + r.event.trigger(a, b, this); + }); + }, + triggerHandler: function (a, b) { + var c = this[0]; + if (c) + return r.event.trigger(a, b, c, !0); + } + }), r.each('blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu'.split(' '), function (a, b) { + r.fn[b] = function (a, c) { + return arguments.length > 0 ? this.on(b, null, a, c) : this.trigger(b); + }; + }), r.fn.extend({ + hover: function (a, b) { + return this.mouseenter(a).mouseleave(b || a); + } + }), o.focusin = 'onfocusin' in a, o.focusin || r.each({ + focus: 'focusin', + blur: 'focusout' + }, function (a, b) { + var c = function (a) { + r.event.simulate(b, a.target, r.event.fix(a)); + }; + r.event.special[b] = { + setup: function () { + var d = this.ownerDocument || this, e = V.access(d, b); + e || d.addEventListener(a, c, !0), V.access(d, b, (e || 0) + 1); + }, + teardown: function () { + var d = this.ownerDocument || this, e = V.access(d, b) - 1; + e ? V.access(d, b, e) : (d.removeEventListener(a, c, !0), V.remove(d, b)); + } + }; + }); + var qb = a.location, rb = r.now(), sb = /\?/; + r.parseXML = function (b) { + var c; + if (!b || 'string' != typeof b) + return null; + try { + c = new a.DOMParser().parseFromString(b, 'text/xml'); + } catch (d) { + c = void 0; + } + return c && !c.getElementsByTagName('parsererror').length || r.error('Invalid XML: ' + b), c; + }; + var tb = /\[\]$/, ub = /\r?\n/g, vb = /^(?:submit|button|image|reset|file)$/i, wb = /^(?:input|select|textarea|keygen)/i; + function xb(a, b, c, d) { + var e; + if (r.isArray(b)) + r.each(b, function (b, e) { + c || tb.test(a) ? d(a, e) : xb(a + '[' + ('object' == typeof e && null != e ? b : '') + ']', e, c, d); + }); + else if (c || 'object' !== r.type(b)) + d(a, b); + else + for (e in b) + xb(a + '[' + e + ']', b[e], c, d); + } + r.param = function (a, b) { + var c, d = [], e = function (a, b) { + var c = r.isFunction(b) ? b() : b; + d[d.length] = encodeURIComponent(a) + '=' + encodeURIComponent(null == c ? '' : c); + }; + if (r.isArray(a) || a.jquery && !r.isPlainObject(a)) + r.each(a, function () { + e(this.name, this.value); + }); + else + for (c in a) + xb(c, a[c], b, e); + return d.join('&'); + }, r.fn.extend({ + serialize: function () { + return r.param(this.serializeArray()); + }, + serializeArray: function () { + return this.map(function () { + var a = r.prop(this, 'elements'); + return a ? r.makeArray(a) : this; + }).filter(function () { + var a = this.type; + return this.name && !r(this).is(':disabled') && wb.test(this.nodeName) && !vb.test(a) && (this.checked || !ia.test(a)); + }).map(function (a, b) { + var c = r(this).val(); + return null == c ? null : r.isArray(c) ? r.map(c, function (a) { + return { + name: b.name, + value: a.replace(ub, '\r\n') + }; + }) : { + name: b.name, + value: c.replace(ub, '\r\n') + }; + }).get(); + } + }); + var yb = /%20/g, zb = /#.*$/, Ab = /([?&])_=[^&]*/, Bb = /^(.*?):[ \t]*([^\r\n]*)$/gm, Cb = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, Db = /^(?:GET|HEAD)$/, Eb = /^\/\//, Fb = {}, Gb = {}, Hb = '*/'.concat('*'), Ib = d.createElement('a'); + Ib.href = qb.href; + function Jb(a) { + return function (b, c) { + 'string' != typeof b && (c = b, b = '*'); + var d, e = 0, f = b.toLowerCase().match(K) || []; + if (r.isFunction(c)) + while (d = f[e++]) + '+' === d[0] ? (d = d.slice(1) || '*', (a[d] = a[d] || []).unshift(c)) : (a[d] = a[d] || []).push(c); + }; + } + function Kb(a, b, c, d) { + var e = {}, f = a === Gb; + function g(h) { + var i; + return e[h] = !0, r.each(a[h] || [], function (a, h) { + var j = h(b, c, d); + return 'string' != typeof j || f || e[j] ? f ? !(i = j) : void 0 : (b.dataTypes.unshift(j), g(j), !1); + }), i; + } + return g(b.dataTypes[0]) || !e['*'] && g('*'); + } + function Lb(a, b) { + var c, d, e = r.ajaxSettings.flatOptions || {}; + for (c in b) + void 0 !== b[c] && ((e[c] ? a : d || (d = {}))[c] = b[c]); + return d && r.extend(!0, a, d), a; + } + function Mb(a, b, c) { + var d, e, f, g, h = a.contents, i = a.dataTypes; + while ('*' === i[0]) + i.shift(), void 0 === d && (d = a.mimeType || b.getResponseHeader('Content-Type')); + if (d) + for (e in h) + if (h[e] && h[e].test(d)) { + i.unshift(e); + break; + } + if (i[0] in c) + f = i[0]; + else { + for (e in c) { + if (!i[0] || a.converters[e + ' ' + i[0]]) { + f = e; + break; + } + g || (g = e); + } + f = f || g; + } + if (f) + return f !== i[0] && i.unshift(f), c[f]; + } + function Nb(a, b, c, d) { + var e, f, g, h, i, j = {}, k = a.dataTypes.slice(); + if (k[1]) + for (g in a.converters) + j[g.toLowerCase()] = a.converters[g]; + f = k.shift(); + while (f) + if (a.responseFields[f] && (c[a.responseFields[f]] = b), !i && d && a.dataFilter && (b = a.dataFilter(b, a.dataType)), i = f, f = k.shift()) + if ('*' === f) + f = i; + else if ('*' !== i && i !== f) { + if (g = j[i + ' ' + f] || j['* ' + f], !g) + for (e in j) + if (h = e.split(' '), h[1] === f && (g = j[i + ' ' + h[0]] || j['* ' + h[0]])) { + g === !0 ? g = j[e] : j[e] !== !0 && (f = h[0], k.unshift(h[1])); + break; + } + if (g !== !0) + if (g && a['throws']) + b = g(b); + else + try { + b = g(b); + } catch (l) { + return { + state: 'parsererror', + error: g ? l : 'No conversion from ' + i + ' to ' + f + }; + } + } + return { + state: 'success', + data: b + }; + } + r.extend({ + active: 0, + lastModified: {}, + etag: {}, + ajaxSettings: { + url: qb.href, + type: 'GET', + isLocal: Cb.test(qb.protocol), + global: !0, + processData: !0, + async: !0, + contentType: 'application/x-www-form-urlencoded; charset=UTF-8', + accepts: { + '*': Hb, + text: 'text/plain', + html: 'text/html', + xml: 'application/xml, text/xml', + json: 'application/json, text/javascript' + }, + contents: { + xml: /\bxml\b/, + html: /\bhtml/, + json: /\bjson\b/ + }, + responseFields: { + xml: 'responseXML', + text: 'responseText', + json: 'responseJSON' + }, + converters: { + '* text': String, + 'text html': !0, + 'text json': JSON.parse, + 'text xml': r.parseXML + }, + flatOptions: { + url: !0, + context: !0 + } + }, + ajaxSetup: function (a, b) { + return b ? Lb(Lb(a, r.ajaxSettings), b) : Lb(r.ajaxSettings, a); + }, + ajaxPrefilter: Jb(Fb), + ajaxTransport: Jb(Gb), + ajax: function (b, c) { + 'object' == typeof b && (c = b, b = void 0), c = c || {}; + var e, f, g, h, i, j, k, l, m, n, o = r.ajaxSetup({}, c), p = o.context || o, q = o.context && (p.nodeType || p.jquery) ? r(p) : r.event, s = r.Deferred(), t = r.Callbacks('once memory'), u = o.statusCode || {}, v = {}, w = {}, x = 'canceled', y = { + readyState: 0, + getResponseHeader: function (a) { + var b; + if (k) { + if (!h) { + h = {}; + while (b = Bb.exec(g)) + h[b[1].toLowerCase()] = b[2]; + } + b = h[a.toLowerCase()]; + } + return null == b ? null : b; + }, + getAllResponseHeaders: function () { + return k ? g : null; + }, + setRequestHeader: function (a, b) { + return null == k && (a = w[a.toLowerCase()] = w[a.toLowerCase()] || a, v[a] = b), this; + }, + overrideMimeType: function (a) { + return null == k && (o.mimeType = a), this; + }, + statusCode: function (a) { + var b; + if (a) + if (k) + y.always(a[y.status]); + else + for (b in a) + u[b] = [ + u[b], + a[b] + ]; + return this; + }, + abort: function (a) { + var b = a || x; + return e && e.abort(b), A(0, b), this; + } + }; + if (s.promise(y), o.url = ((b || o.url || qb.href) + '').replace(Eb, qb.protocol + '//'), o.type = c.method || c.type || o.method || o.type, o.dataTypes = (o.dataType || '*').toLowerCase().match(K) || [''], null == o.crossDomain) { + j = d.createElement('a'); + try { + j.href = o.url, j.href = j.href, o.crossDomain = Ib.protocol + '//' + Ib.host != j.protocol + '//' + j.host; + } catch (z) { + o.crossDomain = !0; + } + } + if (o.data && o.processData && 'string' != typeof o.data && (o.data = r.param(o.data, o.traditional)), Kb(Fb, o, c, y), k) + return y; + l = r.event && o.global, l && 0 === r.active++ && r.event.trigger('ajaxStart'), o.type = o.type.toUpperCase(), o.hasContent = !Db.test(o.type), f = o.url.replace(zb, ''), o.hasContent ? o.data && o.processData && 0 === (o.contentType || '').indexOf('application/x-www-form-urlencoded') && (o.data = o.data.replace(yb, '+')) : (n = o.url.slice(f.length), o.data && (f += (sb.test(f) ? '&' : '?') + o.data, delete o.data), o.cache === !1 && (f = f.replace(Ab, '$1'), n = (sb.test(f) ? '&' : '?') + '_=' + rb++ + n), o.url = f + n), o.ifModified && (r.lastModified[f] && y.setRequestHeader('If-Modified-Since', r.lastModified[f]), r.etag[f] && y.setRequestHeader('If-None-Match', r.etag[f])), (o.data && o.hasContent && o.contentType !== !1 || c.contentType) && y.setRequestHeader('Content-Type', o.contentType), y.setRequestHeader('Accept', o.dataTypes[0] && o.accepts[o.dataTypes[0]] ? o.accepts[o.dataTypes[0]] + ('*' !== o.dataTypes[0] ? ', ' + Hb + '; q=0.01' : '') : o.accepts['*']); + for (m in o.headers) + y.setRequestHeader(m, o.headers[m]); + if (o.beforeSend && (o.beforeSend.call(p, y, o) === !1 || k)) + return y.abort(); + if (x = 'abort', t.add(o.complete), y.done(o.success), y.fail(o.error), e = Kb(Gb, o, c, y)) { + if (y.readyState = 1, l && q.trigger('ajaxSend', [ + y, + o + ]), k) + return y; + o.async && o.timeout > 0 && (i = a.setTimeout(function () { + y.abort('timeout'); + }, o.timeout)); + try { + k = !1, e.send(v, A); + } catch (z) { + if (k) + throw z; + A(-1, z); + } + } else + A(-1, 'No Transport'); + function A(b, c, d, h) { + var j, m, n, v, w, x = c; + k || (k = !0, i && a.clearTimeout(i), e = void 0, g = h || '', y.readyState = b > 0 ? 4 : 0, j = b >= 200 && b < 300 || 304 === b, d && (v = Mb(o, y, d)), v = Nb(o, v, y, j), j ? (o.ifModified && (w = y.getResponseHeader('Last-Modified'), w && (r.lastModified[f] = w), w = y.getResponseHeader('etag'), w && (r.etag[f] = w)), 204 === b || 'HEAD' === o.type ? x = 'nocontent' : 304 === b ? x = 'notmodified' : (x = v.state, m = v.data, n = v.error, j = !n)) : (n = x, !b && x || (x = 'error', b < 0 && (b = 0))), y.status = b, y.statusText = (c || x) + '', j ? s.resolveWith(p, [ + m, + x, + y + ]) : s.rejectWith(p, [ + y, + x, + n + ]), y.statusCode(u), u = void 0, l && q.trigger(j ? 'ajaxSuccess' : 'ajaxError', [ + y, + o, + j ? m : n + ]), t.fireWith(p, [ + y, + x + ]), l && (q.trigger('ajaxComplete', [ + y, + o + ]), --r.active || r.event.trigger('ajaxStop'))); + } + return y; + }, + getJSON: function (a, b, c) { + return r.get(a, b, c, 'json'); + }, + getScript: function (a, b) { + return r.get(a, void 0, b, 'script'); + } + }), r.each([ + 'get', + 'post' + ], function (a, b) { + r[b] = function (a, c, d, e) { + return r.isFunction(c) && (e = e || d, d = c, c = void 0), r.ajax(r.extend({ + url: a, + type: b, + dataType: e, + data: c, + success: d + }, r.isPlainObject(a) && a)); + }; + }), r._evalUrl = function (a) { + return r.ajax({ + url: a, + type: 'GET', + dataType: 'script', + cache: !0, + async: !1, + global: !1, + 'throws': !0 + }); + }, r.fn.extend({ + wrapAll: function (a) { + var b; + return this[0] && (r.isFunction(a) && (a = a.call(this[0])), b = r(a, this[0].ownerDocument).eq(0).clone(!0), this[0].parentNode && b.insertBefore(this[0]), b.map(function () { + var a = this; + while (a.firstElementChild) + a = a.firstElementChild; + return a; + }).append(this)), this; + }, + wrapInner: function (a) { + return r.isFunction(a) ? this.each(function (b) { + r(this).wrapInner(a.call(this, b)); + }) : this.each(function () { + var b = r(this), c = b.contents(); + c.length ? c.wrapAll(a) : b.append(a); + }); + }, + wrap: function (a) { + var b = r.isFunction(a); + return this.each(function (c) { + r(this).wrapAll(b ? a.call(this, c) : a); + }); + }, + unwrap: function (a) { + return this.parent(a).not('body').each(function () { + r(this).replaceWith(this.childNodes); + }), this; + } + }), r.expr.pseudos.hidden = function (a) { + return !r.expr.pseudos.visible(a); + }, r.expr.pseudos.visible = function (a) { + return !!(a.offsetWidth || a.offsetHeight || a.getClientRects().length); + }, r.ajaxSettings.xhr = function () { + const $___old_8cc9f9e4fba5b543 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_593cc8ea5f05915f = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_8cc9f9e4fba5b543) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_00465284004d4aa8.XMLHttpRequest)); + if ($___old_593cc8ea5f05915f) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_00465284004d4aa8.XMLHttpRequest)); + return function () { + try { + return new a.XMLHttpRequest(); + } catch (b) { + } + }.apply(this, arguments); + } finally { + if ($___old_8cc9f9e4fba5b543) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_8cc9f9e4fba5b543)); + if ($___old_593cc8ea5f05915f) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_593cc8ea5f05915f)); + } + }; + var Ob = { + 0: 200, + 1223: 204 + }, Pb = r.ajaxSettings.xhr(); + o.cors = !!Pb && 'withCredentials' in Pb, o.ajax = Pb = !!Pb, r.ajaxTransport(function (b) { + var c, d; + if (o.cors || Pb && !b.crossDomain) + return { + send: function (e, f) { + var g, h = b.xhr(); + if (h.open(b.type, b.url, b.async, b.username, b.password), b.xhrFields) + for (g in b.xhrFields) + h[g] = b.xhrFields[g]; + b.mimeType && h.overrideMimeType && h.overrideMimeType(b.mimeType), b.crossDomain || e['X-Requested-With'] || (e['X-Requested-With'] = 'XMLHttpRequest'); + for (g in e) + h.setRequestHeader(g, e[g]); + c = function (a) { + return function () { + c && (c = d = h.onload = h.onerror = h.onabort = h.onreadystatechange = null, 'abort' === a ? h.abort() : 'error' === a ? 'number' != typeof h.status ? f(0, 'error') : f(h.status, h.statusText) : f(Ob[h.status] || h.status, h.statusText, 'text' !== (h.responseType || 'text') || 'string' != typeof h.responseText ? { binary: h.response } : { text: h.responseText }, h.getAllResponseHeaders())); + }; + }, h.onload = c(), d = h.onerror = c('error'), void 0 !== h.onabort ? h.onabort = d : h.onreadystatechange = function () { + 4 === h.readyState && a.setTimeout(function () { + c && d(); + }); + }, c = c('abort'); + try { + h.send(b.hasContent && b.data || null); + } catch (i) { + if (c) + throw i; + } + }, + abort: function () { + c && c(); + } + }; + }), r.ajaxPrefilter(function (a) { + a.crossDomain && (a.contents.script = !1); + }), r.ajaxSetup({ + accepts: { script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript' }, + contents: { script: /\b(?:java|ecma)script\b/ }, + converters: { + 'text script': function (a) { + return r.globalEval(a), a; + } + } + }), r.ajaxPrefilter('script', function (a) { + void 0 === a.cache && (a.cache = !1), a.crossDomain && (a.type = 'GET'); + }), r.ajaxTransport('script', function (a) { + if (a.crossDomain) { + var b, c; + return { + send: function (e, f) { + b = r(''))) : (c = M.createElement('script'), c.type = 'text/javascript', c.async = !0, c.src = ff.createScriptURL(a), d && (c.onload = d), e && (c.onerror = e), b && (c.id = b), g && c.setAttribute('nonce', g), a = M.getElementsByTagName('script')[0], a.parentNode.insertBefore(c, a)); + } + }, be = function (a, b) { + return E(M.location[b ? 'href' : 'search'], a); + }, E = function (a, b) { + return (a = a.match('(?:&|#|\\?)' + K(b).replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1') + '=([^&#]*)')) && 2 == a.length ? a[1] : ''; + }, xa = function () { + var a = '' + M.location.hostname; + return 0 == a.indexOf('www.') ? a.substring(4) : a; + }, de = function (a, b) { + var c = a.indexOf(b); + if (5 == c || 6 == c) + if (a = a.charAt(c + b.length), '/' == a || '?' == a || '' == a || ':' == a) + return !0; + return !1; + }, za = function (a, b) { + if (1 == b.length && null != b[0] && 'object' === typeof b[0]) + return b[0]; + for (var c = {}, d = Math.min(a.length + 1, b.length), e = 0; e < d; e++) + if ('object' === typeof b[e]) { + for (var g in b[e]) + b[e].hasOwnProperty(g) && (c[g] = b[e][g]); + break; + } else + e < a.length && (c[a[e]] = b[e]); + return c; + }, Ee = function (a, b) { + for (var c = 0; c < a.length; c++) + if (b == a[c]) + return !0; + return !1; + }; + var ee = function () { + this.oa = []; + this.ea = {}; + this.m = {}; + }; + ee.prototype.set = function (a, b, c) { + this.oa.push(a); + c ? this.m[':' + a] = b : this.ea[':' + a] = b; + }; + ee.prototype.get = function (a) { + return this.m.hasOwnProperty(':' + a) ? this.m[':' + a] : this.ea[':' + a]; + }; + ee.prototype.map = function (a) { + for (var b = 0; b < this.oa.length; b++) { + var c = this.oa[b], d = this.get(c); + d && a(c, d); + } + }; + var O = window, M = document, jf = document.currentScript ? document.currentScript.src : '', va = function (a, b) { + return setTimeout(a, b); + }; + var Qa = window, Za = document, G = function (a) { + var b = Qa._gaUserPrefs; + if (b && b.ioo && b.ioo() || a && !0 === Qa['ga-disable-' + a]) + return !0; + try { + var c = Qa.external; + if (c && c._gaUserPrefs && 'oo' == c._gaUserPrefs) + return !0; + } catch (g) { + } + a = []; + b = String(Za.cookie).split(';'); + for (c = 0; c < b.length; c++) { + var d = b[c].split('='), e = d[0].replace(/^\s*|\s*$/g, ''); + e && 'AMP_TOKEN' == e && ((d = d.slice(1).join('=').replace(/^\s*|\s*$/g, '')) && (d = decodeURIComponent(d)), a.push(d)); + } + for (b = 0; b < a.length; b++) + if ('$OPT_OUT' == a[b]) + return !0; + return Za.getElementById('__gaOptOutExtension') ? !0 : !1; + }; + var Ca = function (a) { + var b = [], c = M.cookie.split(';'); + a = new RegExp('^\\s*' + a + '=\\s*(.*?)\\s*$'); + for (var d = 0; d < c.length; d++) { + var e = c[d].match(a); + e && b.push(e[1]); + } + return b; + }, zc = function (a, b, c, d, e, g, ca) { + e = G(e) ? !1 : eb.test(M.location.hostname) || '/' == c && vc.test(d) ? !1 : !0; + if (!e) + return !1; + b && 1200 < b.length && (b = b.substring(0, 1200)); + c = a + '=' + b + '; path=' + c + '; '; + g && (c += 'expires=' + new Date(new Date().getTime() + g).toGMTString() + '; '); + d && 'none' !== d && (c += 'domain=' + d + ';'); + ca && (c += ca + ';'); + d = M.cookie; + M.cookie = c; + if (!(d = d != M.cookie)) + a: { + a = Ca(a); + for (d = 0; d < a.length; d++) + if (b == a[d]) { + d = !0; + break a; + } + d = !1; + } + return d; + }, Cc = function (a) { + return encodeURIComponent ? encodeURIComponent(a).replace(/\(/g, '%28').replace(/\)/g, '%29') : a; + }, vc = /^(www\.)?google(\.com?)?(\.[a-z]{2})?$/, eb = /(^|\.)doubleclick\.net$/i; + var Oe = function (a) { + var b = [], c = M.cookie.split(';'); + a = new RegExp('^\\s*' + (a || '_gac') + '_(UA-\\d+-\\d+)=\\s*(.+?)\\s*$'); + for (var d = 0; d < c.length; d++) { + var e = c[d].match(a); + e && b.push({ + ja: e[1], + value: e[2], + timestamp: Number(e[2].split('.')[1]) || 0 + }); + } + b.sort(function (g, ca) { + return ca.timestamp - g.timestamp; + }); + return b; + }; + function df(a, b, c) { + b = Oe(b); + var d = {}; + if (!b || !b.length) + return d; + for (var e = 0; e < b.length; e++) { + var g = b[e].value.split('.'); + if ('1' !== g[0] || c && 3 > g.length || !c && 3 !== g.length) + a && (a.na = !0); + else if (Number(g[1])) { + d[b[e].ja] ? a && (a.pa = !0) : d[b[e].ja] = []; + var ca = { + version: g[0], + timestamp: 1000 * Number(g[1]), + qa: g[2] + }; + c && 3 < g.length && (ca.labels = g.slice(3)); + d[b[e].ja].push(ca); + } + } + return d; + } + ; + var Fa, Ga, fb, Ab, ja = /^https?:\/\/[^/]*cdn\.ampproject\.org\//, Ue = /^(?:www\.|m\.|amp\.)+/, Ub = [], da = function (a) { + if (ye(a[Kd])) { + if (void 0 === Ab) { + var b; + if (b = (b = De.get()) && b._ga || void 0) + Ab = b, J(81); + } + if (void 0 !== Ab) + return a[Q] || (a[Q] = Ab), !1; + } + if (a[Kd]) { + J(67); + if (a[ac] && 'cookie' != a[ac]) + return !1; + if (void 0 !== Ab) + a[Q] || (a[Q] = Ab); + else { + a: { + b = String(a[W] || xa()); + var c = String(a[Yb] || '/'), d = Ca(String(a[U] || '_ga')); + b = na(d, b, c); + if (!b || jd.test(b)) + b = !0; + else if (b = Ca('AMP_TOKEN'), 0 == b.length) + b = !0; + else { + if (1 == b.length && (b = decodeURIComponent(b[0]), '$RETRIEVING' == b || '$OPT_OUT' == b || '$ERROR' == b || '$NOT_FOUND' == b)) { + b = !0; + break a; + } + b = !1; + } + } + if (b && tc(ic, String(a[Na]))) + return !0; + } + } + return !1; + }, ic = function () { + Z.D([ua]); + }, tc = function (a, b) { + var c = Ca('AMP_TOKEN'); + if (1 < c.length) + return J(55), !1; + c = decodeURIComponent(c[0] || ''); + if ('$OPT_OUT' == c || '$ERROR' == c || G(b)) + return J(62), !1; + if (!ja.test(M.referrer) && '$NOT_FOUND' == c) + return J(68), !1; + if (void 0 !== Ab) + return J(56), va(function () { + a(Ab); + }, 0), !0; + if (Fa) + return Ub.push(a), !0; + if ('$RETRIEVING' == c) + return J(57), va(function () { + tc(a, b); + }, 10000), !0; + Fa = !0; + c && '$' != c[0] || (xc('$RETRIEVING', 30000), setTimeout(Mc, 30000), c = ''); + return Pc(c, b) ? (Ub.push(a), !0) : !1; + }, Pc = function (a, b, c) { + if (!window.JSON) + return J(58), !1; + var d = O.XMLHttpRequest; + if (!d) + return J(59), !1; + var e = new d(); + if (!('withCredentials' in e)) + return J(60), !1; + e.open('POST', (c || 'https://ampcid.google.com/v1/publisher:getClientId') + '?key=AIzaSyA65lEHUEizIsNtlbNo-l2K18dT680nsaM', !0); + e.withCredentials = !0; + e.setRequestHeader('Content-Type', 'text/plain'); + e.onload = function () { + Fa = !1; + if (4 == e.readyState) { + try { + 200 != e.status && (J(61), Qc('', '$ERROR', 30000)); + var g = JSON.parse(e.responseText); + g.optOut ? (J(63), Qc('', '$OPT_OUT', 31536000000)) : g.clientId ? Qc(g.clientId, g.securityToken, 31536000000) : !c && g.alternateUrl ? (Ga && clearTimeout(Ga), Fa = !0, Pc(a, b, g.alternateUrl)) : (J(64), Qc('', '$NOT_FOUND', 3600000)); + } catch (ca) { + J(65), Qc('', '$ERROR', 30000); + } + e = null; + } + }; + d = { originScope: 'AMP_ECID_GOOGLE' }; + a && (d.securityToken = a); + e.send(JSON.stringify(d)); + Ga = va(function () { + J(66); + Qc('', '$ERROR', 30000); + }, 10000); + return !0; + }, Mc = function () { + Fa = !1; + }, xc = function (a, b) { + if (void 0 === fb) { + fb = ''; + for (var c = id(), d = 0; d < c.length; d++) { + var e = c[d]; + if (zc('AMP_TOKEN', encodeURIComponent(a), '/', e, '', b)) { + fb = e; + return; + } + } + } + zc('AMP_TOKEN', encodeURIComponent(a), '/', fb, '', b); + }, Qc = function (a, b, c) { + Ga && clearTimeout(Ga); + b && xc(b, c); + Ab = a; + b = Ub; + Ub = []; + for (c = 0; c < b.length; c++) + b[c](a); + }, ye = function (a) { + a: { + if (ja.test(M.referrer)) { + var b = M.location.hostname.replace(Ue, ''); + b: { + var c = M.referrer; + c = c.replace(/^https?:\/\//, ''); + var d = c.replace(/^[^/]+/, '').split('/'), e = d[2]; + d = (d = 's' == e ? d[3] : e) ? decodeURIComponent(d) : d; + if (!d) { + if (0 == c.indexOf('xn--')) { + c = ''; + break b; + } + (c = c.match(/(.*)\.cdn\.ampproject\.org\/?$/)) && 2 == c.length && (d = c[1].replace(/-/g, '.').replace(/\.\./g, '-')); + } + c = d ? d.replace(Ue, '') : ''; + } + (d = b === c) || (c = '.' + c, d = b.substring(b.length - c.length, b.length) === c); + if (d) { + b = !0; + break a; + } else + J(78); + } + b = !1; + } + return b && !1 !== a; + }; + var bd = function (a) { + return (a ? 'https:' : Ba || 'https:' == M.location.protocol ? 'https:' : 'http:') + '//www.google-analytics.com'; + }, Ge = function (a) { + switch (a) { + default: + case 1: + return 'https://www.google-analytics.com/gtm/js?id='; + case 2: + return 'https://www.googletagmanager.com/gtag/js?id='; + } + }, Da = function (a) { + this.name = 'len'; + this.message = a + '-8192'; + }, ba = function (a, b, c) { + c = c || ua; + if (2036 >= b.length) + wc(a, b, c); + else if (8192 >= b.length) + x(a, b, c) || wd(a, b, c) || wc(a, b, c); + else + throw ge('len', b.length), new Da(b.length); + }, pe = function (a, b, c, d) { + d = d || ua; + wd(a + '?' + b, '', d, c); + }, wc = function (a, b, c) { + var d = ta(a + '?' + b); + d.onload = d.onerror = function () { + d.onload = null; + d.onerror = null; + c(); + }; + }, wd = function (a, b, c, d) { + const $___old_b77476e2494501b8 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_b77476e2494501b8) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_277c62c6d4795976.XMLHttpRequest)); + return function () { + var e = O.XMLHttpRequest; + if (!e) + return !1; + var g = new e(); + if (!('withCredentials' in g)) + return !1; + a = a.replace(/^http:/, 'https:'); + g.open('POST', a, !0); + g.withCredentials = !0; + g.setRequestHeader('Content-Type', 'text/plain'); + g.onreadystatechange = function () { + if (4 == g.readyState) { + if (d && 'text/plain' === g.getResponseHeader('Content-Type')) + try { + Ea(d, g.responseText, c); + } catch (ca) { + ge('xhr', 'rsp'), c(); + } + else + c(); + g = null; + } + }; + g.send(b); + return !0; + }.apply(this, arguments); + } finally { + if ($___old_b77476e2494501b8) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_b77476e2494501b8)); + } + }, Ea = function (a, b, c) { + if (1 > b.length) + ge('xhr', 'ver', '0'), c(); + else if (3 < a.count++) + ge('xhr', 'tmr', '' + a.count), c(); + else { + var d = b.charAt(0); + if ('1' === d) + oc(a, b.substring(1), c); + else if (a.V && '2' === d) { + var e = b.substring(1).split(','), g = 0; + b = function () { + ++g === e.length && c(); + }; + for (d = 0; d < e.length; d++) + oc(a, e[d], b); + } else + ge('xhr', 'ver', String(b.length)), c(); + } + }, oc = function (a, b, c) { + if (0 === b.length) + c(); + else { + var d = b.charAt(0); + switch (d) { + case 'd': + pe('https://stats.g.doubleclick.net/j/collect', a.U, a, c); + break; + case 'g': + wc('https://www.google.com/ads/ga-audiences', a.google, c); + (b = b.substring(1)) && (/^[a-z.]{1,6}$/.test(b) ? wc('https://www.google.%/ads/ga-audiences'.replace('%', b), a.google, ua) : ge('tld', 'bcc', b)); + break; + case 'G': + if (a.V) { + a.V('G-' + b.substring(1)); + c(); + break; + } + case 'x': + if (a.V) { + a.V(); + c(); + break; + } + default: + ge('xhr', 'brc', d), c(); + } + } + }, x = function (a, b, c) { + return O.navigator.sendBeacon ? O.navigator.sendBeacon(a, b) ? (c(), !0) : !1 : !1; + }, ge = function (a, b, c) { + 1 <= 100 * Math.random() || G('?') || (a = [ + 't=error', + '_e=' + a, + '_v=j96', + 'sr=1' + ], b && a.push('_f=' + b), c && a.push('_m=' + K(c.substring(0, 100))), a.push('aip=1'), a.push('z=' + hd()), wc(bd(!0) + '/u/d', a.join('&'), ua)); + }; + var qc = function () { + return O.gaData = O.gaData || {}; + }, h = function (a) { + var b = qc(); + return b[a] = b[a] || {}; + }; + var Ha = function () { + this.M = []; + }; + Ha.prototype.add = function (a) { + this.M.push(a); + }; + Ha.prototype.D = function (a) { + try { + for (var b = 0; b < this.M.length; b++) { + var c = a.get(this.M[b]); + c && ea(c) && c.call(O, a); + } + } catch (d) { + } + b = a.get(Ia); + b != ua && ea(b) && (a.set(Ia, ua, !0), setTimeout(b, 10)); + }; + function Ja(a) { + if (100 != a.get(Ka) && La(P(a, Q)) % 10000 >= 100 * R(a, Ka)) + throw 'abort'; + } + function Ma(a) { + if (G(P(a, Na))) + throw 'abort'; + } + function Oa() { + var a = M.location.protocol; + if ('http:' != a && 'https:' != a) + throw 'abort'; + } + function Pa(a) { + try { + O.navigator.sendBeacon ? J(42) : O.XMLHttpRequest && 'withCredentials' in new O.XMLHttpRequest() && J(40); + } catch (c) { + } + a.set(ld, Td(a), !0); + a.set(Ac, R(a, Ac) + 1); + var b = []; + ue.map(function (c, d) { + d.F && (c = a.get(c), void 0 != c && c != d.defaultValue && ('boolean' == typeof c && (c *= 1), b.push(d.F + '=' + K('' + c)))); + }); + !1 === a.get(xe) && b.push('npa=1'); + b.push('z=' + Bd()); + a.set(Ra, b.join('&'), !0); + } + function Sa(a) { + var b = P(a, fa); + !b && a.get(Vd) && (b = 'beacon'); + var c = P(a, gd), d = P(a, oe), e = c || (d || bd(!1) + '') + '/collect'; + switch (P(a, ad)) { + case 'd': + e = c || (d || bd(!1) + '') + '/j/collect'; + b = a.get(qe) || void 0; + pe(e, P(a, Ra), b, a.Z(Ia)); + break; + default: + b ? (c = P(a, Ra), d = (d = a.Z(Ia)) || ua, 'image' == b ? wc(e, c, d) : 'xhr' == b && wd(e, c, d) || 'beacon' == b && x(e, c, d) || ba(e, c, d)) : ba(e, P(a, Ra), a.Z(Ia)); + } + e = P(a, Na); + e = h(e); + b = e.hitcount; + e.hitcount = b ? b + 1 : 1; + e.first_hit || (e.first_hit = new Date().getTime()); + e = P(a, Na); + delete h(e).pending_experiments; + a.set(Ia, ua, !0); + } + function Hc(a) { + qc().expId && a.set(Nc, qc().expId); + qc().expVar && a.set(Oc, qc().expVar); + var b = P(a, Na); + if (b = h(b).pending_experiments) { + var c = []; + for (d in b) + b.hasOwnProperty(d) && b[d] && c.push(encodeURIComponent(d) + '.' + encodeURIComponent(b[d])); + var d = c.join('!'); + } else + d = void 0; + d && ((b = a.get(m)) && (d = b + '!' + d), a.set(m, d, !0)); + } + function cd() { + if (O.navigator && 'preview' == O.navigator.loadPurpose) + throw 'abort'; + } + function yd(a) { + var b = O.gaDevIds || []; + if (ka(b)) { + var c = a.get('&did'); + qa(c) && 0 < c.length && (b = b.concat(c.split(','))); + c = []; + for (var d = 0; d < b.length; d++) + Ee(c, b[d]) || c.push(b[d]); + 0 != c.length && a.set('&did', c.join(','), !0); + } + } + function vb(a) { + if (!a.get(Na)) + throw 'abort'; + } + function Pe(a) { + try { + if (!a.get(Qe) && (a.set(Qe, !0), !a.get('>m'))) { + var b = void 0; + lf(be('gtm_debug')) && (b = 2); + !b && D(M.referrer, 'https://tagassistant.google.com/') && (b = 3); + !b && Ee(M.cookie.split('; '), '__TAG_ASSISTANT=x') && (b = 4); + if (!b) { + var c = M.documentElement.getAttribute('data-tag-assistant-present'); + lf(c) && (b = 5); + } + if (b) { + O['google.tagmanager.debugui2.queue'] || (O['google.tagmanager.debugui2.queue'] = [], Id('https://www.google-analytics.com/debug/bootstrap?id=' + a.get(Na) + '&src=LEGACY&cond=' + b)); + var d = M.currentScript; + O['google.tagmanager.debugui2.queue'].push({ + messageType: 'LEGACY_CONTAINER_STARTING', + data: { + id: a.get(Na), + scriptSource: d && d.src || '' + } + }); + } + } + } catch (e) { + } + } + function lf(a) { + if (null == a || 0 === a.length) + return !1; + a = Number(a); + var b = Date.now(); + return a < b + 300000 && a > b - 900000; + } + ; + var hd = function () { + return Math.round(2147483647 * Math.random()); + }, Bd = function () { + try { + var a = new Uint32Array(1); + O.crypto.getRandomValues(a); + return a[0] & 2147483647; + } catch (b) { + return hd(); + } + }; + function Ta(a) { + var b = R(a, Ua); + 500 <= b && J(15); + var c = P(a, Va); + if ('transaction' != c && 'item' != c) { + c = R(a, Wa); + var d = new Date().getTime(), e = R(a, Xa); + 0 == e && a.set(Xa, d); + e = Math.round(2 * (d - e) / 1000); + 0 < e && (c = Math.min(c + e, 20), a.set(Xa, d)); + if (0 >= c) + throw 'abort'; + a.set(Wa, --c); + } + a.set(Ua, ++b); + } + ; + var Ya = function () { + this.data = new ee(); + }; + Ya.prototype.get = function (a) { + var b = $a(a), c = this.data.get(a); + b && void 0 == c && (c = ea(b.defaultValue) ? b.defaultValue() : b.defaultValue); + return b && b.Z ? b.Z(this, a, c) : c; + }; + var P = function (a, b) { + a = a.get(b); + return void 0 == a ? '' : '' + a; + }, R = function (a, b) { + a = a.get(b); + return void 0 == a || '' === a ? 0 : Number(a); + }; + Ya.prototype.Z = function (a) { + return (a = this.get(a)) && ea(a) ? a : ua; + }; + Ya.prototype.set = function (a, b, c) { + if (a) + if ('object' == typeof a) + for (var d in a) + a.hasOwnProperty(d) && ab(this, d, a[d], c); + else + ab(this, a, b, c); + }; + var ab = function (a, b, c, d) { + if (void 0 != c) + switch (b) { + case Na: + wb.test(c); + } + var e = $a(b); + e && e.o ? e.o(a, b, c, d) : a.data.set(b, c, d); + }; + var ue = new ee(), ve = [], bb = function (a, b, c, d, e) { + this.name = a; + this.F = b; + this.Z = d; + this.o = e; + this.defaultValue = c; + }, $a = function (a) { + var b = ue.get(a); + if (!b) + for (var c = 0; c < ve.length; c++) { + var d = ve[c], e = d[0].exec(a); + if (e) { + b = d[1](e); + ue.set(b.name, b); + break; + } + } + return b; + }, yc = function (a) { + var b; + ue.map(function (c, d) { + d.F == a && (b = d); + }); + return b && b.name; + }, S = function (a, b, c, d, e) { + a = new bb(a, b, c, d, e); + ue.set(a.name, a); + return a.name; + }, cb = function (a, b) { + ve.push([ + new RegExp('^' + a + '$'), + b + ]); + }, T = function (a, b, c) { + return S(a, b, c, void 0, db); + }, db = function () { + }; + var hb = T('apiVersion', 'v'), ib = T('clientVersion', '_v'); + S('anonymizeIp', 'aip'); + var jb = S('adSenseId', 'a'), Va = S('hitType', 't'), Ia = S('hitCallback'), Ra = S('hitPayload'); + S('nonInteraction', 'ni'); + S('currencyCode', 'cu'); + S('dataSource', 'ds'); + var Vd = S('useBeacon', void 0, !1), fa = S('transport'); + S('sessionControl', 'sc', ''); + S('sessionGroup', 'sg'); + S('queueTime', 'qt'); + var Ac = S('_s', '_s'); + S('screenName', 'cd'); + var kb = S('location', 'dl', ''), lb = S('referrer', 'dr'), mb = S('page', 'dp', ''); + S('hostname', 'dh'); + var nb = S('language', 'ul'), ob = S('encoding', 'de'); + S('title', 'dt', function () { + return M.title || void 0; + }); + cb('contentGroup([0-9]+)', function (a) { + return new bb(a[0], 'cg' + a[1]); + }); + var pb = S('screenColors', 'sd'), qb = S('screenResolution', 'sr'), rb = S('viewportSize', 'vp'), sb = S('javaEnabled', 'je'), tb = S('flashVersion', 'fl'); + S('campaignId', 'ci'); + S('campaignName', 'cn'); + S('campaignSource', 'cs'); + S('campaignMedium', 'cm'); + S('campaignKeyword', 'ck'); + S('campaignContent', 'cc'); + var ub = S('eventCategory', 'ec'), xb = S('eventAction', 'ea'), yb = S('eventLabel', 'el'), zb = S('eventValue', 'ev'), Bb = S('socialNetwork', 'sn'), Cb = S('socialAction', 'sa'), Db = S('socialTarget', 'st'), Eb = S('l1', 'plt'), Fb = S('l2', 'pdt'), Gb = S('l3', 'dns'), Hb = S('l4', 'rrt'), Ib = S('l5', 'srt'), Jb = S('l6', 'tcp'), Kb = S('l7', 'dit'), Lb = S('l8', 'clt'), Ve = S('l9', '_gst'), We = S('l10', '_gbt'), Xe = S('l11', '_cst'), Ye = S('l12', '_cbt'), Mb = S('timingCategory', 'utc'), Nb = S('timingVar', 'utv'), Ob = S('timingLabel', 'utl'), Pb = S('timingValue', 'utt'); + S('appName', 'an'); + S('appVersion', 'av', ''); + S('appId', 'aid', ''); + S('appInstallerId', 'aiid', ''); + S('exDescription', 'exd'); + S('exFatal', 'exf'); + var Nc = S('expId', 'xid'), Oc = S('expVar', 'xvar'), m = S('exp', 'exp'), Rc = S('_utma', '_utma'), Sc = S('_utmz', '_utmz'), Tc = S('_utmht', '_utmht'), Ua = S('_hc', void 0, 0), Xa = S('_ti', void 0, 0), Wa = S('_to', void 0, 20); + cb('dimension([0-9]+)', function (a) { + return new bb(a[0], 'cd' + a[1]); + }); + cb('metric([0-9]+)', function (a) { + return new bb(a[0], 'cm' + a[1]); + }); + S('linkerParam', void 0, void 0, Bc, db); + var Ze = T('_cd2l', void 0, !1), ld = S('usage', '_u'), Gd = S('_um'); + S('forceSSL', void 0, void 0, function () { + return Ba; + }, function (a, b, c) { + J(34); + Ba = !!c; + }); + var ed = S('_j1', 'jid'), ia = S('_j2', 'gjid'); + cb('\\&(.*)', function (a) { + var b = new bb(a[0], a[1]), c = yc(a[0].substring(1)); + c && (b.Z = function (d) { + return d.get(c); + }, b.o = function (d, e, g, ca) { + d.set(c, g, ca); + }, b.F = void 0); + return b; + }); + var Qb = T('_oot'), dd = S('previewTask'), Rb = S('checkProtocolTask'), md = S('validationTask'), Sb = S('checkStorageTask'), Uc = S('historyImportTask'), Tb = S('samplerTask'), Vb = S('_rlt'), Wb = S('buildHitTask'), Xb = S('sendHitTask'), Vc = S('ceTask'), zd = S('devIdTask'), Cd = S('timingTask'), Ld = S('displayFeaturesTask'), oa = S('customTask'), ze = S('fpsCrossDomainTask'), Re = T('_cta'), V = T('name'), Q = T('clientId', 'cid'), n = T('clientIdTime'), xd = T('storedClientId'), Ad = S('userId', 'uid'), Na = T('trackingId', 'tid'), U = T('cookieName', void 0, '_ga'), W = T('cookieDomain'), Yb = T('cookiePath', void 0, '/'), Zb = T('cookieExpires', void 0, 63072000), Hd = T('cookieUpdate', void 0, !0), Be = T('cookieFlags', void 0, ''), $b = T('legacyCookieDomain'), Wc = T('legacyHistoryImport', void 0, !0), ac = T('storage', void 0, 'cookie'), bc = T('allowLinker', void 0, !1), cc = T('allowAnchor', void 0, !0), Ka = T('sampleRate', 'sf', 100), dc = T('siteSpeedSampleRate', void 0, 1), ec = T('alwaysSendReferrer', void 0, !1), I = T('_gid', '_gid'), la = T('_gcn'), Kd = T('useAmpClientId'), ce = T('_gclid'), fe = T('_gt'), he = T('_ge', void 0, 7776000000), ie = T('_gclsrc'), je = T('storeGac', void 0, !0), oe = S('_x_19'), Ae = S('_fplc', '_fplc'), F = T('_cs'), Je = T('_useUp', void 0, !1), Le = S('up', 'up'), Qe = S('_tac', void 0, !1), Se = T('_gbraid'), Te = T('_gbt'), bf = T('_gbe', void 0, 7776000000), gd = S('transportUrl'), Md = S('_r', '_r'), Od = S('_slc', '_slc'), qe = S('_dp'), ad = S('_jt', void 0, 'n'), Ud = S('allowAdFeatures', void 0, !0), xe = S('allowAdPersonalizationSignals', void 0, !0); + function X(a, b, c, d) { + b[a] = function () { + try { + return d && J(d), c.apply(this, arguments); + } catch (e) { + throw ge('exc', a, e && e.name), e; + } + }; + } + ; + var Ed = function (a) { + if ('cookie' == a.get(ac)) + return a = Ca('FPLC'), 0 < a.length ? a[0] : void 0; + }, Fe = function (a) { + var b; + if (b = P(a, oe) && a.get(Ze)) + b = De.get(a.get(cc)), b = !(b && b._fplc); + b && !Ed(a) && a.set(Ae, '0'); + }; + var aa = function (a) { + var b = Math.min(R(a, dc), 100); + return La(P(a, Q)) % 100 >= b ? !1 : !0; + }, gc = function (a) { + var b = {}; + if (Ec(b) || Fc(b)) { + var c = b[Eb]; + void 0 == c || Infinity == c || isNaN(c) || (0 < c ? (Y(b, Gb), Y(b, Jb), Y(b, Ib), Y(b, Fb), Y(b, Hb), Y(b, Kb), Y(b, Lb), Y(b, Ve), Y(b, We), Y(b, Xe), Y(b, Ye), va(function () { + a(b); + }, 10)) : L(O, 'load', function () { + gc(a); + }, !1)); + } + }, Ec = function (a) { + var b = O.performance || O.webkitPerformance; + b = b && b.timing; + if (!b) + return !1; + var c = b.navigationStart; + if (0 == c) + return !1; + a[Eb] = b.loadEventStart - c; + a[Gb] = b.domainLookupEnd - b.domainLookupStart; + a[Jb] = b.connectEnd - b.connectStart; + a[Ib] = b.responseStart - b.requestStart; + a[Fb] = b.responseEnd - b.responseStart; + a[Hb] = b.fetchStart - c; + a[Kb] = b.domInteractive - c; + a[Lb] = b.domContentLoadedEventStart - c; + a[Ve] = N.L - c; + a[We] = N.ya - c; + O.google_tag_manager && O.google_tag_manager._li && (b = O.google_tag_manager._li, a[Xe] = b.cst, a[Ye] = b.cbt); + return !0; + }, Fc = function (a) { + if (O.top != O) + return !1; + var b = O.external, c = b && b.onloadT; + b && !b.isValidLoadTime && (c = void 0); + 2147483648 < c && (c = void 0); + 0 < c && b.setPageReadyTime(); + if (void 0 == c) + return !1; + a[Eb] = c; + return !0; + }, Y = function (a, b) { + var c = a[b]; + if (isNaN(c) || Infinity == c || 0 > c) + a[b] = void 0; + }, Fd = function (a) { + return function (b) { + if ('pageview' == b.get(Va) && !a.I) { + a.I = !0; + var c = aa(b), d = 0 < E(P(b, kb), 'gclid').length, e = 0 < E(P(b, kb), 'wbraid').length; + (c || d || e) && gc(function (g) { + c && a.send('timing', g); + (d || e) && a.send('adtiming', g); + }); + } + }; + }; + var hc = !1, mc = function (a) { + if ('cookie' == P(a, ac)) { + if (a.get(Hd) || P(a, xd) != P(a, Q)) { + var b = 1000 * R(a, Zb); + ma(a, Q, U, b); + a.data.set(xd, P(a, Q)); + } + (a.get(Hd) || uc(a) != P(a, I)) && ma(a, I, la, 86400000); + if (a.get(je)) { + if (b = P(a, ce)) { + var c = Math.min(R(a, he), 1000 * R(a, Zb)); + c = 0 === c ? 0 : Math.min(c, 1000 * R(a, fe) + c - new Date().getTime()); + a.data.set(he, c); + var d = {}, e = P(a, fe), g = P(a, ie), ca = kc(P(a, Yb)), l = lc(P(a, W)), k = P(a, Na), w = P(a, Be); + g && 'aw.ds' != g ? d && (d.ua = !0) : (b = [ + '1', + e, + Cc(b) + ].join('.'), 0 <= c && (d && (d.ta = !0), zc('_gac_' + Cc(k), b, ca, l, k, c, w))); + le(d); + } + } else + J(75); + a.get(je) && (b = P(a, Se)) && (c = Math.min(R(a, bf), 1000 * R(a, Zb)), c = 0 === c ? 0 : Math.min(c, 1000 * R(a, Te) + c - new Date().getTime()), a.data.set(bf, c), d = {}, w = P(a, Te), ca = kc(P(a, Yb)), l = lc(P(a, W)), k = P(a, Na), a = P(a, Be), b = [ + '1', + w, + Cc(b) + ].join('.'), 0 <= c && (d && (d.ta = !0), zc('_gac_gb_' + Cc(k), b, ca, l, k, c, a)), ef(d)); + } + }, ma = function (a, b, c, d) { + var e = nd(a, b); + if (e) { + c = P(a, c); + var g = kc(P(a, Yb)), ca = lc(P(a, W)), l = P(a, Be), k = P(a, Na); + if ('auto' != ca) + zc(c, e, g, ca, k, d, l) && (hc = !0); + else { + J(32); + for (var w = id(), Ce = 0; Ce < w.length; Ce++) + if (ca = w[Ce], a.data.set(W, ca), e = nd(a, b), zc(c, e, g, ca, k, d, l)) { + hc = !0; + return; + } + a.data.set(W, 'auto'); + } + } + }, uc = function (a) { + var b = Ca(P(a, la)); + return Xd(a, b); + }, nc = function (a) { + if ('cookie' == P(a, ac) && !hc && (mc(a), !hc)) + throw 'abort'; + }, Yc = function (a) { + if (a.get(Wc)) { + var b = P(a, W), c = P(a, $b) || xa(), d = Xc('__utma', c, b); + d && (J(19), a.set(Tc, new Date().getTime(), !0), a.set(Rc, d.R), (b = Xc('__utmz', c, b)) && d.hash == b.hash && a.set(Sc, b.R)); + } + }, nd = function (a, b) { + b = Cc(P(a, b)); + var c = lc(P(a, W)).split('.').length; + a = jc(P(a, Yb)); + 1 < a && (c += '-' + a); + return b ? [ + 'GA1', + c, + b + ].join('.') : ''; + }, Xd = function (a, b) { + return na(b, P(a, W), P(a, Yb)); + }, na = function (a, b, c) { + if (!a || 1 > a.length) + J(12); + else { + for (var d = [], e = 0; e < a.length; e++) { + var g = a[e]; + var ca = g.split('.'); + var l = ca.shift(); + ('GA1' == l || '1' == l) && 1 < ca.length ? (g = ca.shift().split('-'), 1 == g.length && (g[1] = '1'), g[0] *= 1, g[1] *= 1, ca = { + H: g, + s: ca.join('.') + }) : ca = kd.test(g) ? { + H: [ + 0, + 0 + ], + s: g + } : void 0; + ca && d.push(ca); + } + if (1 == d.length) + return J(13), d[0].s; + if (0 == d.length) + J(12); + else { + J(14); + d = Gc(d, lc(b).split('.').length, 0); + if (1 == d.length) + return d[0].s; + d = Gc(d, jc(c), 1); + 1 < d.length && J(41); + return d[0] && d[0].s; + } + } + }, Gc = function (a, b, c) { + for (var d = [], e = [], g, ca = 0; ca < a.length; ca++) { + var l = a[ca]; + l.H[c] == b ? d.push(l) : void 0 == g || l.H[c] < g ? (e = [l], g = l.H[c]) : l.H[c] == g && e.push(l); + } + return 0 < d.length ? d : e; + }, lc = function (a) { + return 0 == a.indexOf('.') ? a.substr(1) : a; + }, id = function () { + var a = [], b = xa().split('.'); + if (4 == b.length) { + var c = b[b.length - 1]; + if (parseInt(c, 10) == c) + return ['none']; + } + for (c = b.length - 2; 0 <= c; c--) + a.push(b.slice(c).join('.')); + b = M.location.hostname; + eb.test(b) || vc.test(b) || a.push('none'); + return a; + }, kc = function (a) { + if (!a) + return '/'; + 1 < a.length && a.lastIndexOf('/') == a.length - 1 && (a = a.substr(0, a.length - 1)); + 0 != a.indexOf('/') && (a = '/' + a); + return a; + }, jc = function (a) { + a = kc(a); + return '/' == a ? 1 : a.split('/').length; + }, le = function (a) { + a.ta && J(77); + a.na && J(74); + a.pa && J(73); + a.ua && J(69); + }, ef = function (a) { + a.ta && J(85); + a.na && J(86); + a.pa && J(87); + }; + function Xc(a, b, c) { + 'none' == b && (b = ''); + var d = [], e = Ca(a); + a = '__utma' == a ? 6 : 2; + for (var g = 0; g < e.length; g++) { + var ca = ('' + e[g]).split('.'); + ca.length >= a && d.push({ + hash: ca[0], + R: e[g], + O: ca + }); + } + if (0 != d.length) + return 1 == d.length ? d[0] : Zc(b, d) || Zc(c, d) || Zc(null, d) || d[0]; + } + function Zc(a, b) { + if (null == a) + var c = a = 1; + else + c = La(a), a = La(D(a, '.') ? a.substring(1) : '.' + a); + for (var d = 0; d < b.length; d++) + if (b[d].hash == c || b[d].hash == a) + return b[d]; + } + ; + var Jc = new RegExp(/^https?:\/\/([^\/:]+)/), De = O.google_tag_data.glBridge, Kc = RegExp('(.*)([?&#])(?:_ga=[^&#]*)(?:&?)(.*)'), od = RegExp('(.*)([?&#])(?:_gac=[^&#]*)(?:&?)(.*)'); + function Bc(a) { + if (a.get(Ze)) + return J(35), De.generate($e(a)); + var b = P(a, Q), c = P(a, I) || ''; + b = '_ga=2.' + K(pa(c + b, 0) + '.' + c + '-' + b); + (a = af(a)) ? (J(44), a = '&_gac=1.' + K([ + pa(a.qa, 0), + a.timestamp, + a.qa + ].join('.'))) : a = ''; + return b + a; + } + function Ic(a, b) { + var c = new Date(), d = O.navigator, e = d.plugins || []; + a = [ + a, + d.userAgent, + c.getTimezoneOffset(), + c.getYear(), + c.getDate(), + c.getHours(), + c.getMinutes() + b + ]; + for (b = 0; b < e.length; ++b) + a.push(e[b].description); + return La(a.join('.')); + } + function pa(a, b) { + var c = new Date(), d = O.navigator, e = c.getHours() + Math.floor((c.getMinutes() + b) / 60); + return La([ + a, + d.userAgent, + d.language || '', + c.getTimezoneOffset(), + c.getYear(), + c.getDate() + Math.floor(e / 24), + (24 + e) % 24, + (60 + c.getMinutes() + b) % 60 + ].join('.')); + } + var Dc = function (a) { + J(48); + this.target = a; + this.T = !1; + }; + Dc.prototype.ca = function (a, b) { + if (a) { + if (this.target.get(Ze)) + return De.decorate($e(this.target), a, b); + if (a.tagName) { + if ('a' == a.tagName.toLowerCase()) { + a.href && (a.href = qd(this, a.href, b)); + return; + } + if ('form' == a.tagName.toLowerCase()) + return rd(this, a); + } + if ('string' == typeof a) + return qd(this, a, b); + } + }; + var qd = function (a, b, c) { + var d = Kc.exec(b); + d && 3 <= d.length && (b = d[1] + (d[3] ? d[2] + d[3] : '')); + (d = od.exec(b)) && 3 <= d.length && (b = d[1] + (d[3] ? d[2] + d[3] : '')); + a = a.target.get('linkerParam'); + d = b.indexOf('?'); + var e = b.indexOf('#'); + b = c ? b + ((-1 == e ? '#' : '&') + a) : -1 == e ? b + ((-1 === d ? '?' : '&') + a) : b.substring(0, e) + (-1 === d || d > e ? '?' : '&') + a + b.substring(e); + b = b.replace(/&+_ga=/, '&_ga='); + return b = b.replace(RegExp('&+_gac='), '&_gac='); + }, rd = function (a, b) { + if (b && b.action) + if ('get' == b.method.toLowerCase()) { + a = a.target.get('linkerParam').split('&'); + for (var c = 0; c < a.length; c++) { + var d = a[c].split('='), e = d[1]; + d = d[0]; + for (var g = b.childNodes || [], ca = !1, l = 0; l < g.length; l++) + if (g[l].name == d) { + g[l].setAttribute('value', e); + ca = !0; + break; + } + ca || (g = M.createElement('input'), g.setAttribute('type', 'hidden'), g.setAttribute('name', d), g.setAttribute('value', e), b.appendChild(g)); + } + } else + 'post' == b.method.toLowerCase() && (b.action = qd(a, b.action)); + }; + Dc.prototype.S = function (a, b, c) { + function d(g) { + try { + g = g || O.event; + a: { + var ca = g.target || g.srcElement; + for (g = 100; ca && 0 < g;) { + if (ca.href && ca.nodeName.match(/^a(?:rea)?$/i)) { + var l = ca; + break a; + } + ca = ca.parentNode; + g--; + } + l = {}; + } + ('http:' == l.protocol || 'https:' == l.protocol) && sd(a, l.hostname || '') && l.href && (l.href = qd(e, l.href, b)); + } catch (k) { + J(26); + } + } + var e = this; + this.target.get(Ze) ? De.auto(function () { + return $e(e.target); + }, a, b ? 'fragment' : '', c) : (this.T || (this.T = !0, L(M, 'mousedown', d, !1), L(M, 'keyup', d, !1)), c && L(M, 'submit', function (g) { + g = g || O.event; + if ((g = g.target || g.srcElement) && g.action) { + var ca = g.action.match(Jc); + ca && sd(a, ca[1]) && rd(e, g); + } + })); + }; + Dc.prototype.$ = function (a) { + if (a) { + var b = this, c = b.target.get(F); + void 0 !== c && De.passthrough(function () { + if (c('analytics_storage')) + return {}; + var d = {}; + return d._ga = b.target.get(Q), d._up = '1', d; + }, 1, !0); + } + }; + function sd(a, b) { + if (b == M.location.hostname) + return !1; + for (var c = 0; c < a.length; c++) + if (a[c] instanceof RegExp) { + if (a[c].test(b)) + return !0; + } else if (0 <= b.indexOf(a[c])) + return !0; + return !1; + } + function ke(a, b) { + return b != Ic(a, 0) && b != Ic(a, -1) && b != Ic(a, -2) && b != pa(a, 0) && b != pa(a, -1) && b != pa(a, -2); + } + function $e(a) { + var b = af(a), c = {}; + c._ga = a.get(Q); + c._gid = a.get(I) || void 0; + c._gac = b ? [ + b.qa, + b.timestamp + ].join('.') : void 0; + b = a.get(Ae); + a = Ed(a); + return c._fplc = b && '0' !== b ? b : a, c; + } + function af(a) { + function b(e) { + return void 0 == e || '' === e ? 0 : Number(e); + } + var c = a.get(ce); + if (c && a.get(je)) { + var d = b(a.get(fe)); + if (1000 * d + b(a.get(he)) <= new Date().getTime()) + J(76); + else + return { + timestamp: d, + qa: c + }; + } + } + ; + var p = /^(GTM|OPT)-[A-Z0-9]+$/, Ie = /^G-[A-Z0-9]+$/, q = /;_gaexp=[^;]*/g, r = /;((__utma=)|([^;=]+=GAX?\d+\.))[^;]*/g, Aa = /^https?:\/\/[\w\-.]+\.google.com(:\d+)?\/optimize\/opt-launch\.html\?.*$/, t = function (a) { + function b(d, e) { + e && (c += '&' + d + '=' + K(e)); + } + var c = Ge(a.type) + K(a.id); + 'dataLayer' != a.B && b('l', a.B); + b('cx', a.context); + b('t', a.target); + b('cid', a.clientId); + b('cidt', a.ka); + b('gac', a.la); + b('aip', a.ia); + a.sync && b('m', 'sync'); + b('cycle', a.G); + a.qa && b('gclid', a.qa); + Aa.test(M.referrer) && b('cb', String(hd())); + return c; + }, He = function (a, b) { + var c = new Date().getTime(); + O[a.B] = O[a.B] || []; + c = { 'gtm.start': c }; + a.sync || (c.event = 'gtm.js'); + O[a.B].push(c); + 2 === a.type && function (d, e, g) { + O[a.B].push(arguments); + }('config', a.id, b); + }, Ke = function (a, b, c, d) { + c = c || {}; + var e = 1; + Ie.test(b) && (e = 2); + var g = { + id: b, + type: e, + B: c.dataLayer || 'dataLayer', + G: !1 + }, ca = void 0; + a.get('>m') == b && (g.G = !0); + 1 === e ? (g.ia = !!a.get('anonymizeIp'), g.sync = d, b = String(a.get('name')), 't0' != b && (g.target = b), G(String(a.get('trackingId'))) || (g.clientId = String(a.get(Q)), g.ka = Number(a.get(n)), c = c.palindrome ? r : q, c = (c = M.cookie.replace(/^|(; +)/g, ';').match(c)) ? c.sort().join('').substring(1) : void 0, g.la = c, g.qa = E(P(a, kb), 'gclid'))) : 2 === e && (g.context = 'c', ca = { + allow_google_signals: a.get(Ud), + allow_ad_personalization_signals: a.get(xe) + }); + He(g, ca); + return t(g); + }; + var H = {}, Jd = function (a, b) { + b || (b = (b = P(a, V)) && 't0' != b ? Wd.test(b) ? '_gat_' + Cc(P(a, Na)) : '_gat_' + Cc(b) : '_gat'); + this.Y = b; + }, Rd = function (a, b) { + var c = b.get(Wb); + b.set(Wb, function (e) { + Pd(a, e, ed); + Pd(a, e, ia); + var g = c(e); + Qd(a, e); + return g; + }); + var d = b.get(Xb); + b.set(Xb, function (e) { + var g = d(e); + if (se(e)) { + J(80); + var ca = { + U: re(e, 1), + google: re(e, 2), + count: 0 + }; + pe('https://stats.g.doubleclick.net/j/collect', ca.U, ca); + e.set(ed, '', !0); + } + return g; + }); + }, Pd = function (a, b, c) { + !1 === b.get(Ud) || b.get(c) || ('1' == Ca(a.Y)[0] ? b.set(c, '', !0) : b.set(c, '' + hd(), !0)); + }, Qd = function (a, b) { + se(b) && zc(a.Y, '1', P(b, Yb), P(b, W), P(b, Na), 60000, P(b, Be)); + }, se = function (a) { + return !!a.get(ed) && !1 !== a.get(Ud); + }, Ne = function (a) { + return !H[P(a, Na)] && void 0 === a.get('>m') && void 0 === a.get(fa) && void 0 === a.get(gd) && void 0 === a.get(oe); + }, re = function (a, b) { + var c = new ee(), d = function (g) { + $a(g).F && c.set($a(g).F, a.get(g)); + }; + d(hb); + d(ib); + d(Na); + d(Q); + d(ed); + 1 == b && (d(Ad), d(ia), d(I)); + !1 === a.get(xe) && c.set('npa', '1'); + c.set($a(ld).F, Td(a)); + var e = ''; + c.map(function (g, ca) { + e += K(g) + '='; + e += K('' + ca) + '&'; + }); + e += 'z=' + hd(); + 1 == b ? e = 't=dc&aip=1&_r=3&' + e : 2 == b && (e = 't=sr&aip=1&_r=4&slf_rd=1&' + e); + return e; + }, Me = function (a) { + if (Ne(a)) + return H[P(a, Na)] = !0, function (b) { + if (b && !H[b]) { + var c = Ke(a, b); + Id(c); + H[b] = !0; + } + }; + }, Wd = /^gtm\d+$/; + var fd = function (a, b) { + a = a.model; + if (!a.get('dcLoaded')) { + var c = new $c(Dd(a)); + c.set(29); + a.set(Gd, c.C); + b = b || {}; + var d; + b[U] && (d = Cc(b[U])); + b = new Jd(a, d); + Rd(b, a); + a.set('dcLoaded', !0); + } + }; + var Sd = function (a) { + if (!a.get('dcLoaded') && 'cookie' == a.get(ac)) { + var b = new Jd(a); + Pd(b, a, ed); + Pd(b, a, ia); + Qd(b, a); + b = se(a); + var c = Ne(a); + b && a.set(Md, 1, !0); + c && a.set(Od, 1, !0); + if (b || c) + a.set(ad, 'd', !0), J(79), a.set(qe, { + U: re(a, 1), + google: re(a, 2), + V: Me(a), + count: 0 + }, !0); + } + }; + var Lc = function () { + var a = O.gaGlobal = O.gaGlobal || {}; + return a.hid = a.hid || hd(); + }; + var wb = /^(UA|YT|MO|GP)-(\d+)-(\d+)$/, pc = function (a) { + function b(e, g) { + d.model.data.set(e, g); + } + function c(e, g) { + b(e, g); + d.filters.add(e); + } + var d = this; + this.model = new Ya(); + this.filters = new Ha(); + b(V, a[V]); + b(Na, sa(a[Na])); + b(U, a[U]); + b(W, a[W] || xa()); + b(Yb, a[Yb]); + b(Zb, a[Zb]); + b(Hd, a[Hd]); + b(Be, a[Be]); + b($b, a[$b]); + b(Wc, a[Wc]); + b(bc, a[bc]); + b(cc, a[cc]); + b(Ka, a[Ka]); + b(dc, a[dc]); + b(ec, a[ec]); + b(ac, a[ac]); + b(Ad, a[Ad]); + b(n, a[n]); + b(Kd, a[Kd]); + b(je, a[je]); + b(Ze, a[Ze]); + b(oe, a[oe]); + b(Je, a[Je]); + b(F, a[F]); + b(hb, 1); + b(ib, 'j96'); + c(Re, Pe); + c(Qb, Ma); + c(oa, ua); + c(dd, cd); + c(Rb, Oa); + c(md, vb); + c(Sb, nc); + c(Uc, Yc); + c(Tb, Ja); + c(Vb, Ta); + c(Vc, Hc); + c(zd, yd); + c(Ld, Sd); + c(ze, Fe); + c(Wb, Pa); + c(Xb, Sa); + c(Cd, Fd(this)); + pd(this.model); + td(this.model, a[Q]); + this.model.set(jb, Lc()); + }; + pc.prototype.get = function (a) { + return this.model.get(a); + }; + pc.prototype.set = function (a, b) { + this.model.set(a, b); + }; + pc.prototype.send = function (a) { + if (!(1 > arguments.length)) { + if ('string' === typeof arguments[0]) { + var b = arguments[0]; + var c = [].slice.call(arguments, 1); + } else + b = arguments[0] && arguments[0][Va], c = arguments; + b && (c = za(me[b] || [], c), c[Va] = b, this.model.set(c, void 0, !0), this.filters.D(this.model), this.model.data.m = {}); + } + }; + pc.prototype.ma = function (a, b) { + var c = this; + u(a, c, b) || (v(a, function () { + u(a, c, b); + }), y(String(c.get(V)), a, void 0, b, !0)); + }; + var td = function (a, b) { + var c = P(a, U); + a.data.set(la, '_ga' == c ? '_gid' : c + '_gid'); + if ('cookie' == P(a, ac)) { + hc = !1; + c = Ca(P(a, U)); + c = Xd(a, c); + if (!c) { + c = P(a, W); + var d = P(a, $b) || xa(); + c = Xc('__utma', d, c); + void 0 != c ? (J(10), c = c.O[1] + '.' + c.O[2]) : c = void 0; + } + c && (hc = !0); + if (d = c && !a.get(Hd)) + if (d = c.split('.'), 2 != d.length) + d = !1; + else if (d = Number(d[1])) { + var e = R(a, Zb); + d = d + e < new Date().getTime() / 1000; + } else + d = !1; + d && (c = void 0); + c && (a.data.set(xd, c), a.data.set(Q, c), (c = uc(a)) && a.data.set(I, c)); + a.get(je) && (c = a.get(ce), d = a.get(ie), !c || d && 'aw.ds' != d) && (c = {}, d = (M ? df(c) : {})[P(a, Na)], le(c), d && 0 != d.length && (c = d[0], a.data.set(fe, c.timestamp / 1000), a.data.set(ce, c.qa))); + a.get(je) && (c = a.get(Se), d = {}, e = (M ? df(d, '_gac_gb', !0) : {})[P(a, Na)], ef(d), e && 0 != e.length && (d = e[0], e = d.qa, c && c !== e || (d.labels && d.labels.length && (e += '.' + d.labels.join('.')), a.data.set(Te, d.timestamp / 1000), a.data.set(Se, e)))); + } + if (a.get(Hd)) { + c = be('_ga', !!a.get(cc)); + var g = be('_gl', !!a.get(cc)); + d = De.get(a.get(cc)); + e = d._ga; + g && 0 < g.indexOf('_ga*') && !e && J(30); + if (b || !a.get(Je)) + g = !1; + else if (g = a.get(F), void 0 === g || g('analytics_storage')) + g = !1; + else { + J(84); + a.data.set(Le, 1); + if (g = d._up) + if (g = Jc.exec(M.referrer)) { + g = g[1]; + var ca = M.location.hostname; + g = ca === g || 0 <= ca.indexOf('.' + g) || 0 <= g.indexOf('.' + ca) ? !0 : !1; + } else + g = !1; + g = g ? !0 : !1; + } + ca = d.gclid; + var l = d._gac; + if (c || e || ca || l) + if (c && e && J(36), a.get(bc) || ye(a.get(Kd)) || g) { + if (e && (J(38), a.data.set(Q, e), d._gid && (J(51), a.data.set(I, d._gid))), ca ? (J(82), a.data.set(ce, ca), d.gclsrc && a.data.set(ie, d.gclsrc)) : l && (e = l.split('.')) && 2 === e.length && (J(37), a.data.set(ce, e[0]), a.data.set(fe, e[1])), (d = d._fplc) && P(a, oe) && (J(83), a.data.set(Ae, d)), c) + b: + if (d = c.indexOf('.'), -1 == d) + J(22); + else { + e = c.substring(0, d); + g = c.substring(d + 1); + d = g.indexOf('.'); + c = g.substring(0, d); + g = g.substring(d + 1); + if ('1' == e) { + if (d = g, ke(d, c)) { + J(23); + break b; + } + } else if ('2' == e) { + d = g.indexOf('-'); + e = ''; + 0 < d ? (e = g.substring(0, d), d = g.substring(d + 1)) : d = g.substring(1); + if (ke(e + d, c)) { + J(53); + break b; + } + e && (J(2), a.data.set(I, e)); + } else { + J(22); + break b; + } + J(11); + a.data.set(Q, d); + if (c = be('_gac', !!a.get(cc))) + c = c.split('.'), '1' != c[0] || 4 != c.length ? J(72) : ke(c[3], c[1]) ? J(71) : (a.data.set(ce, c[3]), a.data.set(fe, c[2]), J(70)); + } + } else + J(21); + } + b && (J(9), a.data.set(Q, K(b))); + a.get(Q) || (b = (b = O.gaGlobal) && b.from_cookie && 'cookie' !== P(a, ac) ? void 0 : (b = b && b.vid) && -1 !== b.search(jd) ? b : void 0, b ? (J(17), a.data.set(Q, b)) : (J(8), a.data.set(Q, ra()))); + a.get(I) || (J(3), a.data.set(I, ra())); + mc(a); + b = O.gaGlobal = O.gaGlobal || {}; + c = P(a, Q); + a = c === P(a, xd); + if (void 0 == b.vid || a && !b.from_cookie) + b.vid = c, b.from_cookie = a; + }, pd = function (a) { + var b = O.navigator, c = O.screen, d = M.location, e = a.set; + a: { + var g = !!a.get(ec), ca = !!a.get(Kd); + var l = M.referrer; + if (/^(https?|android-app):\/\//i.test(l)) { + if (g) + break a; + g = '//' + M.location.hostname; + if (!de(l, g)) { + if (ca && (ca = g.replace(/\./g, '-') + '.cdn.ampproject.org', de(l, ca))) { + l = void 0; + break a; + } + break a; + } + } + l = void 0; + } + e.call(a, lb, l); + d && (e = d.pathname || '', '/' != e.charAt(0) && (J(31), e = '/' + e), a.set(kb, d.protocol + '//' + d.hostname + e + d.search)); + c && a.set(qb, c.width + 'x' + c.height); + c && a.set(pb, c.colorDepth + '-bit'); + c = M.documentElement; + l = (e = M.body) && e.clientWidth && e.clientHeight; + ca = []; + c && c.clientWidth && c.clientHeight && ('CSS1Compat' === M.compatMode || !l) ? ca = [ + c.clientWidth, + c.clientHeight + ] : l && (ca = [ + e.clientWidth, + e.clientHeight + ]); + c = 0 >= ca[0] || 0 >= ca[1] ? '' : ca.join('x'); + a.set(rb, c); + c = a.set; + var k; + if ((e = (e = O.navigator) ? e.plugins : null) && e.length) + for (l = 0; l < e.length && !k; l++) + ca = e[l], -1 < ca.name.indexOf('Shockwave Flash') && (k = ca.description); + if (!k) + try { + var w = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7'); + k = w.GetVariable('$version'); + } catch (Ce) { + } + if (!k) + try { + w = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'), k = 'WIN 6,0,21,0', w.AllowScriptAccess = 'always', k = w.GetVariable('$version'); + } catch (Ce) { + } + if (!k) + try { + w = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'), k = w.GetVariable('$version'); + } catch (Ce) { + } + k && (w = k.match(/[\d]+/g)) && 3 <= w.length && (k = w[0] + '.' + w[1] + ' r' + w[2]); + c.call(a, tb, k || void 0); + a.set(ob, M.characterSet || M.charset); + a.set(sb, b && 'function' === typeof b.javaEnabled && b.javaEnabled() || !1); + a.set(nb, (b && (b.language || b.browserLanguage) || '').toLowerCase()); + a.data.set(ce, be('gclid', !0)); + a.data.set(ie, be('gclsrc', !0)); + a.data.set(fe, Math.round(new Date().getTime() / 1000)); + a.get(ce) || (a.data.set(Se, be('wbraid', !0)), a.data.set(Te, Math.round(new Date().getTime() / 1000))); + if (d && a.get(cc) && (b = M.location.hash)) { + b = b.split(/[?&#]+/); + d = []; + for (k = 0; k < b.length; ++k) + (D(b[k], 'utm_id') || D(b[k], 'utm_campaign') || D(b[k], 'utm_source') || D(b[k], 'utm_medium') || D(b[k], 'utm_term') || D(b[k], 'utm_content') || D(b[k], 'gclid') || D(b[k], 'dclid') || D(b[k], 'gclsrc') || D(b[k], 'wbraid')) && d.push(b[k]); + 0 < d.length && (b = '#' + d.join('&'), a.set(kb, a.get(kb) + b)); + } + }, me = { + pageview: [mb], + event: [ + ub, + xb, + yb, + zb + ], + social: [ + Bb, + Cb, + Db + ], + timing: [ + Mb, + Nb, + Pb, + Ob + ] + }; + var rc = function (a) { + if ('prerender' == M.visibilityState) + return !1; + a(); + return !0; + }, z = function (a) { + if (!rc(a)) { + J(16); + var b = !1, c = function () { + if (!b && rc(a)) { + b = !0; + var d = c, e = M; + e.removeEventListener ? e.removeEventListener('visibilitychange', d, !1) : e.detachEvent && e.detachEvent('onvisibilitychange', d); + } + }; + L(M, 'visibilitychange', c); + } + }; + var te = /^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/, sc = function (a) { + if (ea(a[0])) + this.u = a[0]; + else { + var b = te.exec(a[0]); + null != b && 4 == b.length && (this.da = b[1] || 't0', this.K = b[2] || '', this.methodName = b[3], this.aa = [].slice.call(a, 1), this.K || (this.A = 'create' == this.methodName, this.i = 'require' == this.methodName, this.g = 'provide' == this.methodName, this.ba = 'remove' == this.methodName), this.i && (3 <= this.aa.length ? (this.X = this.aa[1], this.W = this.aa[2]) : this.aa[1] && (qa(this.aa[1]) ? this.X = this.aa[1] : this.W = this.aa[1]))); + b = a[1]; + a = a[2]; + if (!this.methodName) + throw 'abort'; + if (this.i && (!qa(b) || '' == b)) + throw 'abort'; + if (this.g && (!qa(b) || '' == b || !ea(a))) + throw 'abort'; + if (ud(this.da) || ud(this.K)) + throw 'abort'; + if (this.g && 't0' != this.da) + throw 'abort'; + } + }; + function ud(a) { + return 0 <= a.indexOf('.') || 0 <= a.indexOf(':'); + } + ; + var Yd, Zd, $d, A; + Yd = new ee(); + $d = new ee(); + A = new ee(); + Zd = { + ec: 45, + ecommerce: 46, + linkid: 47 + }; + var u = function (a, b, c) { + b == N || b.get(V); + var d = Yd.get(a); + if (!ea(d)) + return !1; + b.plugins_ = b.plugins_ || new ee(); + if (b.plugins_.get(a)) + return !0; + b.plugins_.set(a, new d(b, c || {})); + return !0; + }, y = function (a, b, c, d, e) { + if (!ea(Yd.get(b)) && !$d.get(b)) { + Zd.hasOwnProperty(b) && J(Zd[b]); + var g = void 0; + if (p.test(b)) { + J(52); + a = N.j(a); + if (!a) + return !0; + c = Ke(a.model, b, d, e); + g = function () { + Z.D([ + 'provide', + b, + function () { + } + ]); + var l = O[d && d.dataLayer || 'dataLayer']; + l && l.hide && ea(l.hide.end) && l.hide[b] && (l.hide.end(), l.hide.end = void 0); + }; + } + !c && Zd.hasOwnProperty(b) ? (J(39), c = b + '.js') : J(43); + if (c) { + var ca; + d && (ca = d[oe]); + qa(ca) || (ca = void 0); + a = ae(cf(c, ca)); + !ca || ne(a.protocol) && B(a) || (a = ae(cf(c))); + ne(a.protocol) && B(a) && (Id(a.url, void 0, e, void 0, g), $d.set(b, !0)); + } + } + }, v = function (a, b) { + var c = A.get(a) || []; + c.push(b); + A.set(a, c); + }, C = function (a, b) { + Yd.set(a, b); + b = A.get(a) || []; + for (var c = 0; c < b.length; c++) + b[c](); + A.set(a, []); + }, B = function (a) { + var b = ae(M.location.href); + if (D(a.url, Ge(1)) || D(a.url, Ge(2))) + return !0; + if (a.query || 0 <= a.url.indexOf('?') || 0 <= a.path.indexOf('://')) + return !1; + if (a.host == b.host && a.port == b.port || jf && (b = M.createElement('a'), b.href = jf, b = kf(b), a.host === b[0] && a.port === b[1])) + return !0; + b = 'http:' == a.protocol ? 80 : 443; + return 'www.google-analytics.com' == a.host && (a.port || b) == b && D(a.path, '/plugins/') ? !0 : !1; + }, ne = function (a) { + var b = M.location.protocol; + return 'https:' == a || a == b ? !0 : 'http:' != a ? !1 : 'http:' == b; + }, kf = function (a) { + var b = a.hostname || '', c = 0 <= b.indexOf(']'); + b = b.split(c ? ']' : ':')[0].toLowerCase(); + c && (b += ']'); + c = (a.protocol || '').toLowerCase(); + c = 1 * a.port || ('http:' == c ? 80 : 'https:' == c ? 443 : ''); + a = a.pathname || ''; + D(a, '/') || (a = '/' + a); + return [ + b, + '' + c, + a + ]; + }, ae = function (a) { + var b = M.createElement('a'); + b.href = M.location.href; + var c = (b.protocol || '').toLowerCase(), d = kf(b), e = b.search || '', g = c + '//' + d[0] + (d[1] ? ':' + d[1] : ''); + D(a, '//') ? a = c + a : D(a, '/') ? a = g + a : !a || D(a, '?') ? a = g + d[2] + (a || e) : 0 > a.split('/')[0].indexOf(':') && (a = g + d[2].substring(0, d[2].lastIndexOf('/')) + '/' + a); + b.href = a; + c = kf(b); + return { + protocol: (b.protocol || '').toLowerCase(), + host: c[0], + port: c[1], + path: c[2], + query: b.search || '', + url: a || '' + }; + }, cf = function (a, b) { + return a && 0 <= a.indexOf('/') ? a : (b || bd(!1)) + '/plugins/ua/' + a; + }; + var Z = { + ga: function () { + Z.fa = []; + } + }; + Z.ga(); + Z.D = function (a) { + var b = Z.J.apply(Z, arguments); + b = Z.fa.concat(b); + for (Z.fa = []; 0 < b.length && !Z.v(b[0]) && !(b.shift(), 0 < Z.fa.length);); + Z.fa = Z.fa.concat(b); + }; + Z.ra = function (a) { + N.q && (300 === N.q.length && (N.q.shift(), N.qd++), N.q.push(a)); + }; + Z.J = function (a) { + for (var b = [], c = 0; c < arguments.length; c++) + try { + var d = new sc(arguments[c]); + d.g ? C(d.aa[0], d.aa[1]) : (d.i && (d.ha = y(d.da, d.aa[0], d.X, d.W)), b.push(d)); + Z.ra(arguments[c]); + } catch (e) { + } + return b; + }; + Z.v = function (a) { + try { + if (a.u) + a.u.call(O, N.j('t0')); + else { + var b = a.da == gb ? N : N.j(a.da); + if (a.A) { + if ('t0' == a.da && (b = N.create.apply(N, a.aa), null === b)) + return !0; + } else if (a.ba) + N.remove(a.da); + else if (b) + if (a.i) { + if (a.ha && (a.ha = y(a.da, a.aa[0], a.X, a.W)), !u(a.aa[0], b, a.W)) + return !0; + } else if (a.K) { + var c = a.methodName, d = a.aa, e = b.plugins_.get(a.K); + e[c].apply(e, d); + } else + b[a.methodName].apply(b, a.aa); + } + } catch (g) { + } + }; + var N = function (a) { + J(1); + Z.D.apply(Z, [arguments]); + }; + N.h = {}; + N.P = []; + N.L = 0; + N.ya = 0; + N.answer = 42; + var we = [ + Na, + W, + V + ]; + N.create = function (a) { + var b = za(we, [].slice.call(arguments)); + b[V] || (b[V] = 't0'); + var c = '' + b[V]; + if (N.h[c]) + return N.h[c]; + if (da(b)) + return null; + b = new pc(b); + N.h[c] = b; + N.P.push(b); + c = qc().tracker_created; + if (ea(c)) + try { + c(b); + } catch (d) { + } + return b; + }; + N.remove = function (a) { + for (var b = 0; b < N.P.length; b++) + if (N.P[b].get(V) == a) { + N.P.splice(b, 1); + N.h[a] = null; + break; + } + }; + N.j = function (a) { + return N.h[a]; + }; + N.getAll = function () { + return N.P.slice(0); + }; + N.N = function () { + 'ga' != gb && J(49); + var a = O[gb]; + if (!a || 42 != a.answer) { + N.L = a && a.l; + N.ya = 1 * new Date(); + N.loaded = !0; + var b = a && a.q, c = ka(b); + a = []; + c ? a = b.slice(0) : J(50); + N.q = c ? b : []; + N.q.splice(0); + N.qd = 0; + b = O[gb] = N; + X('create', b, b.create); + X('remove', b, b.remove); + X('getByName', b, b.j, 5); + X('getAll', b, b.getAll, 6); + b = pc.prototype; + X('get', b, b.get, 7); + X('set', b, b.set, 4); + X('send', b, b.send); + X('requireSync', b, b.ma); + b = Ya.prototype; + X('get', b, b.get); + X('set', b, b.set); + if ('https:' != M.location.protocol && !Ba) { + a: { + b = M.getElementsByTagName('script'); + for (c = 0; c < b.length && 100 > c; c++) { + var d = b[c].src; + if (d && 0 == d.indexOf(bd(!0) + '/analytics')) { + b = !0; + break a; + } + } + b = !1; + } + b && (Ba = !0); + } + (O.gaplugins = O.gaplugins || {}).Linker = Dc; + b = Dc.prototype; + C('linker', Dc); + X('decorate', b, b.ca, 20); + X('autoLink', b, b.S, 25); + X('passthrough', b, b.$, 25); + C('displayfeatures', fd); + C('adfeatures', fd); + Z.D.apply(N, a); + } + }; + var gf = N.N, hf = O[gb]; + hf && hf.r ? gf() : z(gf); + z(function () { + Z.D([ + 'provide', + 'render', + ua + ]); + }); + }(window)); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-f542409ccbdc9bf05ab43353222723e26ac37628 b/resources/sugarcoat-f542409ccbdc9bf05ab43353222723e26ac37628 new file mode 100644 index 00000000..0db3e327 --- /dev/null +++ b/resources/sugarcoat-f542409ccbdc9bf05ab43353222723e26ac37628 @@ -0,0 +1,618 @@ +{ + const $___mock_448b95a47dd49f0a = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_448b95a47dd49f0a); + (function () { + (function () { + var g = e; + function e(a, b) { + var c, d, f = h(window.top); + for (c = f.length; c--;) + try { + if ((d = f[c]) && (d = d[a]) && (d = d.shared)) + return d; + } catch (l) { + } + return window[a].shared = b; + } + function h(a, b) { + try { + var c = a.frames; + } catch (f) { + } + if (c) { + (b = b || []).push(a); + for (var d = 0; c && d < c.length; d++) + h(a.frames[d], b); + } + return b; + } + ; + function k(a, b, c) { + a.addEventListener ? a.addEventListener(b, c, !1) : a.attachEvent && a.attachEvent('on' + b, c); + } + function m(a, b, c) { + a.removeEventListener ? a.removeEventListener(b, c, !1) : a.detachEvent && a.detachEvent('on' + b, c); + } + ; + var p = n; + function n(a) { + try { + return a(); + } catch (b) { + } + } + ; + var r = q, t = window.top; + function q(a) { + for (var b, c, d = window; d;) { + if (p(function () { + return d.frames[a]; + })) { + b = d; + break; + } + if (d === t) + break; + d = d.parent; + } + b && (c = !p(function () { + return !!b.document.getElementById; + })); + return { + frameRef: b, + isCrossDomain: c + }; + } + ; + var v = u; + window.Adform = window.Adform || {}; + var w = window.__uspapi, x = r('__uspapiLocator'), y = x.frameRef, z = x.isCrossDomain; + z && y && y.postMessage ? (k(window, 'message', A), y.postMessage({ + __uspapiCall: { + command: 'getUSPData', + version: 1, + callId: 1 + } + }, '*')) : y && !z && y.__uspapi && (w = y.__uspapi); + w && p(function () { + return w('getUSPData', 1, B); + }); + function u() { + return g('Adform', {}).us_privacy; + } + function A(a) { + var b = a.data; + 'string' === typeof b && (b = p(function () { + return window.JSON.parse(b); + })); + b && (b = b.__uspapiReturn || {}); + b && b.success && (m(window, 'message', A), B(b.returnValue)); + } + function B(a) { + a = void 0 === a ? {} : a; + g('Adform', {}).us_privacy = a.uspString; + } + ; + var C = window.setTimeout, D, E, F = 1, G = [], H = [], I = window.Adform = window.Adform || {}; + I.getConsent = J; + I.waitForConsent = M; + I.hasConsent = aa; + I.getUSPString = v; + N(); + g('Adform', {}); + O(); + function aa(a) { + M(function (b) { + a(null === b ? !0 : b.adform_consent); + }, 10000, !0); + } + function M(a, b, c) { + b = void 0 === b ? 10000 : b; + c = void 0 === c ? !1 : c; + N(); + D || window.__tcfapi ? (c ? H.push(a) : G.push(a), O(), C(function () { + var b = [ + P(G, a), + P(H, a) + ], c = g('Adform', {}), l = c.gdpr, K = c.gdpr_consent, L = c.adform_consent; + c = c.us_privacy; + if (-1 < b[0]) + G.splice(b[0], 1)[0]({ + gdpr: l, + gdpr_consent: K, + adform_consent: L, + us_privacy: c + }); + if (-1 < b[1]) + H.splice(b[1], 1)[0]({ + gdpr: l, + gdpr_consent: K, + adform_consent: L, + us_privacy: c + }); + }, b)) : a(null, 'CMP not found.'); + } + function N() { + if (!D) { + var a = r('__tcfapiLocator'); + a.frameRef && (D = a.frameRef, E = a.isCrossDomain); + } + return { + cmpFrame: D, + isCrossDomain: E + }; + } + function J() { + O(); + var a = g('Adform', {}); + return { + gdpr: a.gdpr, + gdpr_consent: a.gdpr_consent, + us_privacy: a.us_privacy + }; + } + function O() { + if (E && D && D.postMessage) { + var a = window.__tcfapi; + m(window, 'message', Q); + k(window, 'message', Q); + D.postMessage({ + __tcfapiCall: { + command: 'addEventListener', + callId: F++ + } + }, '*'); + } else + a = D && !E ? D.__tcfapi : window.__tcfapi; + a && p(function () { + return a('addEventListener', null, R); + }); + } + function Q(a) { + var b = a.data; + 'string' === typeof b && (b = p(function () { + return window.JSON.parse(b); + })); + b && (b = (b.__tcfapiReturn || {}).returnValue); + b && null != b.gdprApplies && (a = b, R({ + gdprApplies: a.gdprApplies, + tcString: a.tcString, + purpose: a.purpose, + vendor: a.vendor, + restrictions: a.restrictions, + eventStatus: a.eventStatus + })); + } + function R(a) { + a = void 0 === a ? {} : a; + if ('cmpuishown' !== a.eventStatus) { + var b = S(a.gdprApplies), c = g('Adform', {}); + c.gdpr = b; + c.gdpr_consent = a.tcString; + if (b = !(!a.purpose || !a.vendor) || 0 === b) { + var d = a; + a = d.gdprApplies; + var f = T(d, 'purpose.consents.1', !1), l = T(d, 'vendor.consents.50', !1); + d = T(d, 'restrictions.1.50', 1); + a = 0 === S(a) ? !0 : f && l && 0 !== d; + c.adform_consent = a; + } + a = c.gdpr; + f = c.gdpr_consent; + c = c.adform_consent; + if (void 0 !== c && b) + for (; H.length;) + H.shift()({ + gdpr: a, + gdpr_consent: f, + adform_consent: c + }); + for (; G.length;) + G.shift()({ + gdpr: a, + gdpr_consent: f, + adform_consent: c + }); + } + } + function S(a) { + if ('1' == a) + return 1; + if ('0' == a) + return 0; + } + function P(a, b) { + var c = a.length; + if (a.indexOf) + return a.indexOf(b); + for (; c-- && a[c] !== b;); + return c; + } + function T(a, b, c) { + b = b.split('.'); + for (var d = 0; d < b.length; d++) + if (a = a[b[d]], void 0 === a) { + a = c; + break; + } + return a; + } + ; + for (var ba = Array.prototype.slice, U = {}, V = { + init: ca, + cookieSegments: da + }, W = window.AdformAT && window.AdformAT.q || []; 0 in W;) + X(W.shift()); + W.push = X; + window.AdformAT = Y; + function da(a) { + var b = U.baseUrl + '/cookiesegments?token=' + U.token; + M(function (c) { + c && (b += '&gdpr=' + Z(c.gdpr) + '&gdpr_consent=' + Z(c.gdpr_consent)); + (c = v()) && (b += '&us_privacy=' + c); + ea(b, a); + }); + } + function ea(a, b) { + const $___old_b17823a70b07df4a = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_cce5b5ce6cc94e3a = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_b17823a70b07df4a) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_448b95a47dd49f0a.XMLHttpRequest)); + if ($___old_cce5b5ce6cc94e3a) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_448b95a47dd49f0a.XMLHttpRequest)); + return function () { + var c = new window.XMLHttpRequest(); + c.open('GET', a, !0); + c.setRequestHeader('Accept', 'application/json'); + c.withCredentials = !0; + c.onreadystatechange = function () { + const $___old_1fb798b285428049 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_1fb798b285428049) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_448b95a47dd49f0a.XMLHttpRequest)); + return function () { + c.readyState === window.XMLHttpRequest.DONE && b(c.status, c.response || c.responseText, c); + }.apply(this, arguments); + } finally { + if ($___old_1fb798b285428049) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_1fb798b285428049)); + } + }; + c.onerror = function () { + return b(null, 'Error', c); + }; + c.ontimeout = function () { + return b(null, 'Timeout', c); + }; + c.send(); + }.apply(this, arguments); + } finally { + if ($___old_b17823a70b07df4a) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_b17823a70b07df4a)); + if ($___old_cce5b5ce6cc94e3a) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_cce5b5ce6cc94e3a)); + } + } + function ca(a, b) { + U.token = a; + U.baseUrl = b || 'https://dmp.adform.net/audiencetag'; + } + function Y(a) { + V[a] && V[a].apply(null, ba.call(arguments, 1)); + return Y; + } + function Z(a) { + return void 0 === a ? '' : '' + a; + } + function X(a) { + return Y.apply(null, a); + } + ; + }()); + }()) +} \ No newline at end of file diff --git a/resources/sugarcoat-f7ada209562e58fd31703fb8f6187652f7e75ed2 b/resources/sugarcoat-f7ada209562e58fd31703fb8f6187652f7e75ed2 new file mode 100644 index 00000000..f9833367 --- /dev/null +++ b/resources/sugarcoat-f7ada209562e58fd31703fb8f6187652f7e75ed2 @@ -0,0 +1,7150 @@ +{ + const $___mock_00465284004d4aa8 = {}; + (exports => { + 'use strict'; + const xhrUnsent = 0; + const xhrOpened = 1; + const xhrHeadersReceived = 2; + const xhrLoading = 3; + const xhrDone = 4; + const xhrDeferredHandleSymbol = Symbol('deferredHandle'); + const xhrOnLoadStartSymbol = Symbol('onloadstart'); + const xhrOnProgressSymbol = Symbol('onprogress'); + const xhrOnAbortSymbol = Symbol('onabort'); + const xhrOnErrorSymbol = Symbol('onerror'); + const xhrOnLoadSymbol = Symbol('onload'); + const xhrOnTimeoutSymbol = Symbol('ontimeout'); + const xhrOnLoadEndSymbol = Symbol('onloadend'); + const xhrOnReadyStateChangeSymbol = Symbol('onreadystatechange'); + const xhrReadyStateSymbol = Symbol('readyState'); + const xhrTimeoutSymbol = Symbol('timeout'); + const xhrWithCredentialsSymbol = Symbol('withCredentials'); + const xhrUploadSymbol = Symbol('upload'); + const xhrResponseTypeSymbol = Symbol('responseType'); + const defineEvent = (obj, symbol) => { + const type = symbol.description.substring(2); + Object.defineProperty(obj, symbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + obj.addEventListener(type, function (event) { + const handler = this[symbol]; + if (handler) { + handler.call(this, event); + } + }); + }; + const changeReadyState = (xhr, readyState) => { + xhr[xhrReadyStateSymbol] = readyState; + xhr.dispatchEvent(new Event('readystatechange')); + }; + let isSealed = true; + class XMLHttpRequestEventTarget extends EventTarget { + constructor() { + super(); + if (!(this instanceof XMLHttpRequest) && !(this instanceof XMLHttpRequestUpload)) { + throw new TypeError('Illegal constructor'); + } + defineEvent(this, xhrOnLoadStartSymbol); + defineEvent(this, xhrOnProgressSymbol); + defineEvent(this, xhrOnAbortSymbol); + defineEvent(this, xhrOnErrorSymbol); + defineEvent(this, xhrOnLoadSymbol); + defineEvent(this, xhrOnTimeoutSymbol); + defineEvent(this, xhrOnLoadEndSymbol); + } + get onloadstart() { + return this[xhrOnLoadStartSymbol]; + } + set onloadstart(value) { + this[xhrOnLoadStartSymbol] = value; + } + get onprogress() { + return this[xhrOnProgressSymbol]; + } + set onprogress(value) { + this[xhrOnProgressSymbol] = value; + } + get onabort() { + return this[xhrOnAbortSymbol]; + } + set onabort(value) { + this[xhrOnAbortSymbol] = value; + } + get onerror() { + return this[xhrOnErrorSymbol]; + } + set onerror(value) { + this[xhrOnErrorSymbol] = value; + } + get ontimeout() { + return this[xhrOnTimeoutSymbol]; + } + set ontimeout(value) { + this[xhrOnTimeoutSymbol] = value; + } + get onloadend() { + return this[xhrOnLoadEndSymbol]; + } + set onloadend(value) { + this[xhrOnLoadEndSymbol] = value; + } + } + exports.XMLHttpRequestEventTarget = { + configurable: true, + enumerable: true, + value: XMLHttpRequestEventTarget, + writable: true + }; + class XMLHttpRequestUpload extends XMLHttpRequestEventTarget { + constructor() { + if (isSealed) { + throw new TypeError('Illegal constructor'); + } + super(); + } + } + exports.XMLHttpRequestUpload = { + configurable: true, + enumerable: true, + value: XMLHttpRequestUpload, + writable: true + }; + class XMLHttpRequest extends XMLHttpRequestEventTarget { + constructor() { + super(); + isSealed = false; + const xhrUpload = new XMLHttpRequestUpload(); + isSealed = true; + Object.defineProperty(this, xhrDeferredHandleSymbol, { + configurable: false, + enumerable: false, + value: null, + writable: true + }); + defineEvent(this, xhrOnReadyStateChangeSymbol); + Object.defineProperty(this, xhrReadyStateSymbol, { + configurable: false, + enumerable: false, + value: xhrUnsent, + writable: true + }); + Object.defineProperty(this, xhrTimeoutSymbol, { + configurable: false, + enumerable: false, + value: 0, + writable: true + }); + Object.defineProperty(this, xhrWithCredentialsSymbol, { + configurable: false, + enumerable: false, + value: false, + writable: true + }); + Object.defineProperty(this, xhrUploadSymbol, { + configurable: false, + enumerable: false, + value: xhrUpload, + writable: false + }); + Object.defineProperty(this, xhrResponseTypeSymbol, { + configurable: false, + enumerable: false, + value: '', + writable: true + }); + } + get onreadystatechange() { + return this[xhrOnReadyStateChangeSymbol]; + } + set onreadystatechange(value) { + this[xhrOnReadyStateChangeSymbol] = value; + } + get readyState() { + return this[xhrReadyStateSymbol]; + } + open(method, url) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrDone: { + changeReadyState(this, xhrOpened); + break; + } + } + } + setRequestHeader(name, value) { + } + setTrustToken(trustToken) { + } + get timeout() { + return this[xhrTimeoutSymbol]; + } + set timeout(value) { + this[xhrTimeoutSymbol] = value; + } + get withCredentials() { + return this[xhrWithCredentialsSymbol]; + } + set withCredentials(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrUnsent: + case xhrOpened: { + break; + } + default: { + throw new DOMException('Failed to set the \'withCredentials\' property on \'XMLHttpRequest\': The value may only be set if the object\'s state is UNSENT or OPENED.'); + } + } + this[xhrWithCredentialsSymbol] = !!value; + } + get upload() { + return this[xhrUploadSymbol]; + } + send() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] === null) { + this[xhrDeferredHandleSymbol] = setTimeout(() => { + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrDone); + this.dispatchEvent(new ProgressEvent('error')); + this.dispatchEvent(new ProgressEvent('loadend')); + }, 0); + } else { + throw new DOMException('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.'); + } + } + abort() { + if (this[xhrReadyStateSymbol] === xhrOpened && this[xhrDeferredHandleSymbol] !== null) { + clearTimeout(this[xhrDeferredHandleSymbol]); + this[xhrDeferredHandleSymbol] = null; + changeReadyState(this, xhrUnsent); + this.dispatchEvent(new ProgressEvent('abort')); + this.dispatchEvent(new ProgressEvent('loadend')); + } + } + get responseURL() { + return ''; + } + get status() { + return 0; + } + get statusText() { + return ''; + } + getResponseHeader(name) { + return null; + } + overrideMimeType(mime) { + } + get responseType() { + return this[xhrResponseTypeSymbol]; + } + set responseType(value) { + switch (this[xhrReadyStateSymbol]) { + case xhrDone: { + throw new DOMException('Failed to set the \'responseType\' property on \'XMLHttpRequest\': The response type cannot be set if the object\'s state is LOADING or DONE.'); + } + } + switch (value) { + case '': + case 'arraybuffer': + case 'blob': + case 'document': + case 'json': + case 'text': { + this[xhrResponseTypeSymbol] = value; + break; + } + } + } + get response() { + const responseType = this[xhrResponseTypeSymbol]; + return responseType === '' || responseType === 'text' ? '' : null; + } + get responseText() { + const responseType = this[xhrResponseTypeSymbol]; + if (responseType === '' || responseType === 'text') { + return ''; + } else { + throw new DOMException('Failed to read the \'responseText\' property from \'XMLHttpRequest\': The value is only accessible if the object\'s \'responseType\' is \'\' or \'text\' (was \'arraybuffer\').'); + } + } + get responseXML() { + return null; + } + } + Object.defineProperty(XMLHttpRequest, 'UNSENT', { + configurable: false, + enumerable: true, + value: xhrUnsent + }); + Object.defineProperty(XMLHttpRequest, 'OPENED', { + configurable: false, + enumerable: true, + value: xhrOpened + }); + Object.defineProperty(XMLHttpRequest, 'HEADERS_RECEIVED', { + configurable: false, + enumerable: true, + value: xhrHeadersReceived + }); + Object.defineProperty(XMLHttpRequest, 'LOADING', { + configurable: false, + enumerable: true, + value: xhrLoading + }); + Object.defineProperty(XMLHttpRequest, 'DONE', { + configurable: false, + enumerable: true, + value: xhrDone + }); + exports.XMLHttpRequest = { + configurable: true, + enumerable: true, + value: XMLHttpRequest, + writable: true + }; + })($___mock_00465284004d4aa8); + (function () { + (function (E) { + var window = this; + if (window.googletag && googletag.evalScripts) { + googletag.evalScripts(); + } + if (window.googletag && googletag._loaded_) + return; + var aa, ba = function (a) { + var b = 0; + return function () { + return b < a.length ? { + done: !1, + value: a[b++] + } : { done: !0 }; + }; + }, ca = 'function' == typeof Object.defineProperties ? Object.defineProperty : function (a, b, c) { + if (a == Array.prototype || a == Object.prototype) + return a; + a[b] = c.value; + return a; + }, da = function (a) { + a = [ + 'object' == typeof globalThis && globalThis, + a, + 'object' == typeof window && window, + 'object' == typeof self && self, + 'object' == typeof global && global + ]; + for (var b = 0; b < a.length; ++b) { + var c = a[b]; + if (c && c.Math == Math) + return c; + } + throw Error('Cannot find global object'); + }, ea = da(this), ha = 'function' === typeof Symbol && 'symbol' === typeof Symbol('x'), m = {}, ia = {}, p = function (a, b) { + var c = ia[b]; + if (null == c) + return a[b]; + c = a[c]; + return void 0 !== c ? c : a[b]; + }, r = function (a, b, c) { + if (b) + a: { + var d = a.split('.'); + a = 1 === d.length; + var e = d[0], f; + !a && e in m ? f = m : f = ea; + for (e = 0; e < d.length - 1; e++) { + var h = d[e]; + if (!(h in f)) + break a; + f = f[h]; + } + d = d[d.length - 1]; + c = ha && 'es6' === c ? f[d] : null; + b = b(c); + null != b && (a ? ca(m, d, { + configurable: !0, + writable: !0, + value: b + }) : b !== c && (void 0 === ia[d] && (a = 1000000000 * Math.random() >>> 0, ia[d] = ha ? ea.Symbol(d) : '$jscp$' + a + '$' + d), ca(f, ia[d], { + configurable: !0, + writable: !0, + value: b + }))); + } + }; + r('Symbol', function (a) { + if (a) + return a; + var b = function (f, h) { + this.g = f; + ca(this, 'description', { + configurable: !0, + writable: !0, + value: h + }); + }; + b.prototype.toString = function () { + return this.g; + }; + var c = 'jscomp_symbol_' + (1000000000 * Math.random() >>> 0) + '_', d = 0, e = function (f) { + if (this instanceof e) + throw new TypeError('Symbol is not a constructor'); + return new b(c + (f || '') + '_' + d++, f); + }; + return e; + }, 'es6'); + r('Symbol.iterator', function (a) { + if (a) + return a; + a = (0, m.Symbol)('Symbol.iterator'); + for (var b = 'Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' '), c = 0; c < b.length; c++) { + var d = ea[b[c]]; + 'function' === typeof d && 'function' != typeof d.prototype[a] && ca(d.prototype, a, { + configurable: !0, + writable: !0, + value: function () { + return ja(ba(this)); + } + }); + } + return a; + }, 'es6'); + var ja = function (a) { + a = { next: a }; + a[p(m.Symbol, 'iterator')] = function () { + return this; + }; + return a; + }, ka = function (a) { + return a.raw = a; + }, t = function (a) { + var b = 'undefined' != typeof m.Symbol && p(m.Symbol, 'iterator') && a[p(m.Symbol, 'iterator')]; + return b ? b.call(a) : { next: ba(a) }; + }, la = function (a) { + for (var b, c = []; !(b = a.next()).done;) + c.push(b.value); + return c; + }, u = function (a) { + return a instanceof Array ? a : la(t(a)); + }, ma = 'function' == typeof Object.create ? Object.create : function (a) { + var b = function () { + }; + b.prototype = a; + return new b(); + }, na; + if (ha && 'function' == typeof Object.setPrototypeOf) + na = Object.setPrototypeOf; + else { + var oa; + a: { + var pa = { a: !0 }, qa = {}; + try { + qa.__proto__ = pa; + oa = qa.a; + break a; + } catch (a) { + } + oa = !1; + } + na = oa ? function (a, b) { + a.__proto__ = b; + if (a.__proto__ !== b) + throw new TypeError(a + ' is not extensible'); + return a; + } : null; + } + var ra = na, v = function (a, b) { + a.prototype = ma(b.prototype); + a.prototype.constructor = a; + if (ra) + ra(a, b); + else + for (var c in b) + if ('prototype' != c) + if (Object.defineProperties) { + var d = Object.getOwnPropertyDescriptor(b, c); + d && Object.defineProperty(a, c, d); + } else + a[c] = b[c]; + a.Aa = b.prototype; + }, w = function () { + for (var a = Number(this), b = [], c = a; c < arguments.length; c++) + b[c - a] = arguments[c]; + return b; + }, x = function (a, b) { + return Object.prototype.hasOwnProperty.call(a, b); + }, sa = ha && 'function' == typeof p(Object, 'assign') ? p(Object, 'assign') : function (a, b) { + for (var c = 1; c < arguments.length; c++) { + var d = arguments[c]; + if (d) + for (var e in d) + x(d, e) && (a[e] = d[e]); + } + return a; + }; + r('Object.assign', function (a) { + return a || sa; + }, 'es6'); + r('Array.prototype.find', function (a) { + return a ? a : function (b, c) { + a: { + var d = this; + d instanceof String && (d = String(d)); + for (var e = d.length, f = 0; f < e; f++) { + var h = d[f]; + if (b.call(c, h, f, d)) { + b = h; + break a; + } + } + b = void 0; + } + return b; + }; + }, 'es6'); + r('WeakMap', function (a) { + function b() { + } + function c(h) { + var g = typeof h; + return 'object' === g && null !== h || 'function' === g; + } + if (function () { + if (!a || !Object.seal) + return !1; + try { + var h = Object.seal({}), g = Object.seal({}), k = new a([ + [ + h, + 2 + ], + [ + g, + 3 + ] + ]); + if (2 != k.get(h) || 3 != k.get(g)) + return !1; + k.delete(h); + k.set(g, 4); + return !k.has(h) && 4 == k.get(g); + } catch (l) { + return !1; + } + }()) + return a; + var d = '$jscomp_hidden_' + Math.random(), e = 0, f = function (h) { + this.g = (e += Math.random() + 1).toString(); + if (h) { + h = t(h); + for (var g; !(g = h.next()).done;) + g = g.value, this.set(g[0], g[1]); + } + }; + f.prototype.set = function (h, g) { + if (!c(h)) + throw Error('Invalid WeakMap key'); + if (!x(h, d)) { + var k = new b(); + ca(h, d, { value: k }); + } + if (!x(h, d)) + throw Error('WeakMap key fail: ' + h); + h[d][this.g] = g; + return this; + }; + f.prototype.get = function (h) { + return c(h) && x(h, d) ? h[d][this.g] : void 0; + }; + f.prototype.has = function (h) { + return c(h) && x(h, d) && x(h[d], this.g); + }; + f.prototype.delete = function (h) { + return c(h) && x(h, d) && x(h[d], this.g) ? delete h[d][this.g] : !1; + }; + return f; + }, 'es6'); + r('Map', function (a) { + if (function () { + if (!a || 'function' != typeof a || !a.prototype.entries || 'function' != typeof Object.seal) + return !1; + try { + var g = Object.seal({ x: 4 }), k = new a(t([[ + g, + 's' + ]])); + if ('s' != k.get(g) || 1 != k.size || k.get({ x: 4 }) || k.set({ x: 4 }, 't') != k || 2 != k.size) + return !1; + var l = k.entries(), n = l.next(); + if (n.done || n.value[0] != g || 's' != n.value[1]) + return !1; + n = l.next(); + return n.done || 4 != n.value[0].x || 't' != n.value[1] || !l.next().done ? !1 : !0; + } catch (q) { + return !1; + } + }()) + return a; + var b = new m.WeakMap(), c = function (g) { + this.h = {}; + this.g = f(); + this.size = 0; + if (g) { + g = t(g); + for (var k; !(k = g.next()).done;) + k = k.value, this.set(k[0], k[1]); + } + }; + c.prototype.set = function (g, k) { + g = 0 === g ? 0 : g; + var l = d(this, g); + l.list || (l.list = this.h[l.id] = []); + l.m ? l.m.value = k : (l.m = { + next: this.g, + u: this.g.u, + head: this.g, + key: g, + value: k + }, l.list.push(l.m), this.g.u.next = l.m, this.g.u = l.m, this.size++); + return this; + }; + c.prototype.delete = function (g) { + g = d(this, g); + return g.m && g.list ? (g.list.splice(g.index, 1), g.list.length || delete this.h[g.id], g.m.u.next = g.m.next, g.m.next.u = g.m.u, g.m.head = null, this.size--, !0) : !1; + }; + c.prototype.clear = function () { + this.h = {}; + this.g = this.g.u = f(); + this.size = 0; + }; + c.prototype.has = function (g) { + return !!d(this, g).m; + }; + c.prototype.get = function (g) { + return (g = d(this, g).m) && g.value; + }; + c.prototype.entries = function () { + return e(this, function (g) { + return [ + g.key, + g.value + ]; + }); + }; + c.prototype.keys = function () { + return e(this, function (g) { + return g.key; + }); + }; + c.prototype.values = function () { + return e(this, function (g) { + return g.value; + }); + }; + c.prototype.forEach = function (g, k) { + for (var l = this.entries(), n; !(n = l.next()).done;) + n = n.value, g.call(k, n[1], n[0], this); + }; + c.prototype[p(m.Symbol, 'iterator')] = c.prototype.entries; + var d = function (g, k) { + var l = k && typeof k; + 'object' == l || 'function' == l ? b.has(k) ? l = b.get(k) : (l = '' + ++h, b.set(k, l)) : l = 'p_' + k; + var n = g.h[l]; + if (n && x(g.h, l)) + for (g = 0; g < n.length; g++) { + var q = n[g]; + if (k !== k && q.key !== q.key || k === q.key) + return { + id: l, + list: n, + index: g, + m: q + }; + } + return { + id: l, + list: n, + index: -1, + m: void 0 + }; + }, e = function (g, k) { + var l = g.g; + return ja(function () { + if (l) { + for (; l.head != g.g;) + l = l.u; + for (; l.next != l.head;) + return l = l.next, { + done: !1, + value: k(l) + }; + l = null; + } + return { + done: !0, + value: void 0 + }; + }); + }, f = function () { + var g = {}; + return g.u = g.next = g.head = g; + }, h = 0; + return c; + }, 'es6'); + var ta = function (a, b) { + a instanceof String && (a += ''); + var c = 0, d = !1, e = { + next: function () { + if (!d && c < a.length) { + var f = c++; + return { + value: b(f, a[f]), + done: !1 + }; + } + d = !0; + return { + done: !0, + value: void 0 + }; + } + }; + e[p(m.Symbol, 'iterator')] = function () { + return e; + }; + return e; + }, ua = function (a, b, c) { + if (null == a) + throw new TypeError('The \'this\' value for String.prototype.' + c + ' must not be null or undefined'); + if (b instanceof RegExp) + throw new TypeError('First argument to String.prototype.' + c + ' must not be a regular expression'); + return a + ''; + }; + r('String.prototype.startsWith', function (a) { + return a ? a : function (b, c) { + var d = ua(this, b, 'startsWith'), e = d.length, f = b.length; + c = Math.max(0, Math.min(c | 0, d.length)); + for (var h = 0; h < f && c < e;) + if (d[c++] != b[h++]) + return !1; + return h >= f; + }; + }, 'es6'); + r('String.prototype.repeat', function (a) { + return a ? a : function (b) { + var c = ua(this, null, 'repeat'); + if (0 > b || 1342177279 < b) + throw new RangeError('Invalid count value'); + b |= 0; + for (var d = ''; b;) + if (b & 1 && (d += c), b >>>= 1) + c += c; + return d; + }; + }, 'es6'); + r('globalThis', function (a) { + return a || ea; + }, 'es_2020'); + r('Set', function (a) { + if (function () { + if (!a || 'function' != typeof a || !a.prototype.entries || 'function' != typeof Object.seal) + return !1; + try { + var c = Object.seal({ x: 4 }), d = new a(t([c])); + if (!d.has(c) || 1 != d.size || d.add(c) != d || 1 != d.size || d.add({ x: 4 }) != d || 2 != d.size) + return !1; + var e = d.entries(), f = e.next(); + if (f.done || f.value[0] != c || f.value[1] != c) + return !1; + f = e.next(); + return f.done || f.value[0] == c || 4 != f.value[0].x || f.value[1] != f.value[0] ? !1 : e.next().done; + } catch (h) { + return !1; + } + }()) + return a; + var b = function (c) { + this.g = new m.Map(); + if (c) { + c = t(c); + for (var d; !(d = c.next()).done;) + this.add(d.value); + } + this.size = this.g.size; + }; + b.prototype.add = function (c) { + c = 0 === c ? 0 : c; + this.g.set(c, c); + this.size = this.g.size; + return this; + }; + b.prototype.delete = function (c) { + c = this.g.delete(c); + this.size = this.g.size; + return c; + }; + b.prototype.clear = function () { + this.g.clear(); + this.size = 0; + }; + b.prototype.has = function (c) { + return this.g.has(c); + }; + b.prototype.entries = function () { + return this.g.entries(); + }; + b.prototype.values = function () { + return p(this.g, 'values').call(this.g); + }; + b.prototype.keys = p(b.prototype, 'values'); + b.prototype[p(m.Symbol, 'iterator')] = p(b.prototype, 'values'); + b.prototype.forEach = function (c, d) { + var e = this; + this.g.forEach(function (f) { + return c.call(d, f, f, e); + }); + }; + return b; + }, 'es6'); + r('String.prototype.padStart', function (a) { + return a ? a : function (b, c) { + var d = ua(this, null, 'padStart'); + b -= d.length; + c = void 0 !== c ? String(c) : ' '; + return (0 < b && c ? p(c, 'repeat').call(c, Math.ceil(b / c.length)).substring(0, b) : '') + d; + }; + }, 'es8'); + r('Array.prototype.keys', function (a) { + return a ? a : function () { + return ta(this, function (b) { + return b; + }); + }; + }, 'es6'); + r('Array.prototype.values', function (a) { + return a ? a : function () { + return ta(this, function (b, c) { + return c; + }); + }; + }, 'es8'); + r('Object.is', function (a) { + return a ? a : function (b, c) { + return b === c ? 0 !== b || 1 / b === 1 / c : b !== b && c !== c; + }; + }, 'es6'); + r('Array.prototype.includes', function (a) { + return a ? a : function (b, c) { + var d = this; + d instanceof String && (d = String(d)); + var e = d.length; + c = c || 0; + for (0 > c && (c = Math.max(c + e, 0)); c < e; c++) { + var f = d[c]; + if (f === b || p(Object, 'is').call(Object, f, b)) + return !0; + } + return !1; + }; + }, 'es7'); + r('String.prototype.includes', function (a) { + return a ? a : function (b, c) { + return -1 !== ua(this, b, 'includes').indexOf(b, c || 0); + }; + }, 'es6'); + var z = this || self, va = function (a) { + a = a.split('.'); + for (var b = z, c = 0; c < a.length; c++) + if (b = b[a[c]], null == b) + return null; + return b; + }, ya = function (a) { + return Object.prototype.hasOwnProperty.call(a, wa) && a[wa] || (a[wa] = ++xa); + }, wa = 'closure_uid_' + (1000000000 * Math.random() >>> 0), xa = 0, za = function (a, b) { + a = a.split('.'); + var c = z; + a[0] in c || 'undefined' == typeof c.execScript || c.execScript('var ' + a[0]); + for (var d; a.length && (d = a.shift());) + a.length || void 0 === b ? c[d] && c[d] !== Object.prototype[d] ? c = c[d] : c = c[d] = {} : c[d] = b; + }; + var Aa = function (a) { + return /^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]; + }, Ia = function (a) { + if (!Ba.test(a)) + return a; + -1 != a.indexOf('&') && (a = a.replace(Ca, '&')); + -1 != a.indexOf('<') && (a = a.replace(Da, '<')); + -1 != a.indexOf('>') && (a = a.replace(Ea, '>')); + -1 != a.indexOf('"') && (a = a.replace(Fa, '"')); + -1 != a.indexOf('\'') && (a = a.replace(Ga, ''')); + -1 != a.indexOf('\0') && (a = a.replace(Ha, '�')); + return a; + }, Ca = /&/g, Da = //g, Fa = /"/g, Ga = /'/g, Ha = /\x00/g, Ba = /[\x00&<>"']/, La = function (a, b) { + var c = 0; + a = Aa(String(a)).split('.'); + b = Aa(String(b)).split('.'); + for (var d = Math.max(a.length, b.length), e = 0; 0 == c && e < d; e++) { + var f = a[e] || '', h = b[e] || ''; + do { + f = /(\d*)(\D*)(.*)/.exec(f) || [ + '', + '', + '', + '' + ]; + h = /(\d*)(\D*)(.*)/.exec(h) || [ + '', + '', + '', + '' + ]; + if (0 == f[0].length && 0 == h[0].length) + break; + c = Ka(0 == f[1].length ? 0 : parseInt(f[1], 10), 0 == h[1].length ? 0 : parseInt(h[1], 10)) || Ka(0 == f[2].length, 0 == h[2].length) || Ka(f[2], h[2]); + f = f[3]; + h = h[3]; + } while (0 == c); + } + return c; + }, Ka = function (a, b) { + return a < b ? -1 : a > b ? 1 : 0; + }; + function Ma() { + var a = z.navigator; + return a && (a = a.userAgent) ? a : ''; + } + function Na(a) { + return -1 != Ma().indexOf(a); + } + ; + var Oa = function (a, b) { + Array.prototype.forEach.call(a, b, void 0); + }, Pa = function (a, b) { + return Array.prototype.filter.call(a, b, void 0); + }, Qa = function (a, b) { + return Array.prototype.map.call(a, b, void 0); + }; + function Ra(a, b) { + a: { + for (var c = a.length, d = 'string' === typeof a ? a.split('') : a, e = 0; e < c; e++) + if (e in d && b.call(void 0, d[e], e, a)) { + b = e; + break a; + } + b = -1; + } + return 0 > b ? null : 'string' === typeof a ? a.charAt(b) : a[b]; + } + function Sa(a, b) { + a: { + for (var c = 'string' === typeof a ? a.split('') : a, d = a.length - 1; 0 <= d; d--) + if (d in c && b.call(void 0, c[d], d, a)) { + b = d; + break a; + } + b = -1; + } + return 0 > b ? null : 'string' === typeof a ? a.charAt(b) : a[b]; + } + function Ta(a, b) { + return 0 <= Array.prototype.indexOf.call(a, b, void 0); + } + ; + var Ua = {}, Va = null, Xa = function (a) { + var b = []; + Wa(a, function (c) { + b.push(c); + }); + return b; + }, Wa = function (a, b) { + function c(k) { + for (; d < a.length;) { + var l = a.charAt(d++), n = Va[l]; + if (null != n) + return n; + if (!/^[\s\xa0]*$/.test(l)) + throw Error('Unknown base64 encoding at char: ' + l); + } + return k; + } + Ya(); + for (var d = 0;;) { + var e = c(-1), f = c(0), h = c(64), g = c(64); + if (64 === g && -1 === e) + break; + b(e << 2 | f >> 4); + 64 != h && (b(f << 4 & 240 | h >> 2), 64 != g && b(h << 6 & 192 | g)); + } + }, Ya = function () { + if (!Va) { + Va = {}; + for (var a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.split(''), b = [ + '+/=', + '+/', + '-_=', + '-_.', + '-_' + ], c = 0; 5 > c; c++) { + var d = a.concat(b[c].split('')); + Ua[c] = d; + for (var e = 0; e < d.length; e++) { + var f = d[e]; + void 0 === Va[f] && (Va[f] = e); + } + } + } + }; + var Za = 'function' === typeof Uint8Array; + var $a = 'function' === typeof m.Symbol && 'symbol' === typeof (0, m.Symbol)() ? (0, m.Symbol)(void 0) : void 0; + function ab(a) { + Object.isFrozen(a) || ($a ? a[$a] |= 1 : void 0 !== a.g ? a.g |= 1 : Object.defineProperties(a, { + g: { + value: 1, + configurable: !0, + writable: !0, + enumerable: !1 + } + })); + return a; + } + ; + function bb(a) { + return null !== a && 'object' === typeof a && !Array.isArray(a) && a.constructor === Object; + } + var cb; + function db(a) { + switch (typeof a) { + case 'number': + return isFinite(a) ? a : String(a); + case 'object': + if (a && !Array.isArray(a) && Za && null != a && a instanceof Uint8Array) { + var b; + void 0 === b && (b = 0); + Ya(); + b = Ua[b]; + for (var c = Array(Math.floor(a.length / 3)), d = b[64] || '', e = 0, f = 0; e < a.length - 2; e += 3) { + var h = a[e], g = a[e + 1], k = a[e + 2], l = b[h >> 2]; + h = b[(h & 3) << 4 | g >> 4]; + g = b[(g & 15) << 2 | k >> 6]; + k = b[k & 63]; + c[f++] = l + h + g + k; + } + l = 0; + k = d; + switch (a.length - e) { + case 2: + l = a[e + 1], k = b[(l & 15) << 2] || d; + case 1: + a = a[e], c[f] = b[a >> 2] + b[(a & 3) << 4 | l >> 4] + k + d; + } + return c.join(''); + } + } + return a; + } + ; + function eb(a, b) { + if (null != a) + return Array.isArray(a) || bb(a) ? fb(a, b) : b(a); + } + function fb(a, b) { + if (Array.isArray(a)) { + for (var c = Array(a.length), d = 0; d < a.length; d++) + c[d] = eb(a[d], b); + if (b = Array.isArray(a)) { + var e; + $a ? e = a[$a] : e = a.g; + b = (null == e ? 0 : e) & 1; + } + b && ab(c); + return c; + } + e = {}; + for (c in a) + Object.prototype.hasOwnProperty.call(a, c) && (e[c] = eb(a[c], b)); + return e; + } + function gb(a) { + if (a && 'object' == typeof a && a.toJSON) + return a.toJSON(); + a = db(a); + return Array.isArray(a) ? fb(a, gb) : a; + } + ; + var hb; + var A = function (a, b, c) { + var d = hb; + hb = null; + a || (a = d); + d = this.constructor.messageId; + a || (a = d ? [d] : []); + this.i = (d ? 0 : -1) - (this.constructor.wa || 0); + this.g = void 0; + this.h = a; + a: { + d = this.h.length; + a = d - 1; + if (d && (d = this.h[a], bb(d))) { + this.l = a - this.i; + this.j = d; + break a; + } + void 0 !== b && -1 < b ? (this.l = Math.max(b, a + 1 - this.i), this.j = void 0) : this.l = Number.MAX_VALUE; + } + if (c) + for (b = 0; b < c.length; b++) + if (a = c[b], a < this.l) + a += this.i, (d = this.h[a]) ? Array.isArray(d) && ab(d) : this.h[a] = kb; + else { + d = this.j || (this.j = this.h[this.l + this.i] = {}); + var e = d[a]; + e ? Array.isArray(e) && ab(e) : d[a] = kb; + } + }, kb = Object.freeze(ab([])), B = function (a, b, c) { + return -1 === b ? null : b >= a.l ? a.j ? a.j[b] : void 0 : (void 0 === c ? 0 : c) && a.j && (c = a.j[b], null != c) ? c : a.h[b + a.i]; + }, lb = function (a, b, c) { + c = void 0 === c ? !1 : c; + var d = B(a, b, c); + null == d && (d = kb); + d === kb && (d = ab(d.slice()), C(a, b, d, c)); + return d; + }, D = function (a, b, c) { + a = B(a, b); + return null == a ? c : a; + }, mb = function (a, b) { + a = B(a, b); + a = null == a ? a : !!a; + return null == a ? !1 : a; + }, nb = function (a, b, c) { + a = B(a, b); + a = null == a ? a : +a; + return null == a ? void 0 === c ? 0 : c : a; + }, C = function (a, b, c, d) { + (void 0 === d ? 0 : d) || b >= a.l ? (a.j || (a.j = a.h[a.l + a.i] = {}))[b] = c : a.h[b + a.i] = c; + return a; + }, ob = function (a, b, c) { + var d = void 0 === d ? !1 : d; + return C(a, b, null == c ? ab([]) : Array.isArray(c) ? ab(c) : c, d); + }; + function F(a, b, c) { + 0 !== c ? C(a, b, c) : C(a, b, void 0, !1); + return a; + } + var pb = function (a, b, c, d) { + (c = G(a, c)) && c !== b && null != d && (a.g && c in a.g && (a.g[c] = void 0), C(a, c, void 0)); + return C(a, b, d); + }, G = function (a, b) { + for (var c = 0, d = 0; d < b.length; d++) { + var e = b[d]; + null != B(a, e) && (0 !== c && C(a, c, void 0, !1), c = e); + } + return c; + }, H = function (a, b, c) { + if (-1 === c) + return null; + a.g || (a.g = {}); + var d = a.g[c]; + if (d) + return d; + var e = B(a, c, !1); + if (null == e) + return d; + b = new b(e); + return a.g[c] = b; + }, I = function (a, b, c) { + a.g || (a.g = {}); + var d = a.g[c]; + if (!d) { + var e = lb(a, c, !1); + d = []; + for (var f = 0; f < e.length; f++) + d[f] = new b(e[f]); + a.g[c] = d; + } + return d; + }, qb = function (a, b, c) { + var d; + a.g || (a.g = {}); + var e = c ? c.h : c; + a.g[b] = c; + return C(a, b, e, void 0 === d ? !1 : d); + }, sb = function (a, b, c) { + var d = rb; + a.g || (a.g = {}); + var e = c ? c.h : c; + a.g[b] = c; + return pb(a, b, d, e); + }, tb = function (a, b, c) { + var d = void 0 === d ? !1 : d; + if (c) { + var e = ab([]); + for (var f = 0; f < c.length; f++) + e[f] = c[f].h; + a.g || (a.g = {}); + a.g[b] = c; + } else + a.g && (a.g[b] = void 0), e = kb; + return C(a, b, e, d); + }; + A.prototype.toJSON = function () { + var a = this.h; + return cb ? a : fb(a, gb); + }; + function ub(a, b) { + return db(b); + } + var vb = function (a) { + cb = !0; + try { + return JSON.stringify(a.toJSON(), ub); + } finally { + cb = !1; + } + }, wb = function (a, b, c) { + return D(a, b, void 0 === c ? '' : c); + }, xb = function (a, b, c) { + b = G(a, c) === b ? b : -1; + return D(a, b, 0); + }; + var Ab = function (a, b) { + this.h = a === yb && b || ''; + this.i = zb; + }; + Ab.prototype.B = !0; + Ab.prototype.g = function () { + return this.h; + }; + var Bb = function (a) { + return a instanceof Ab && a.constructor === Ab && a.i === zb ? a.h : 'type_error:Const'; + }, Cb = function (a) { + return new Ab(yb, a); + }, zb = {}, yb = {}; + function Db(a) { + var b = [], c = 0, d; + for (d in a) + b[c++] = a[d]; + return b; + } + ; + var Eb = { + area: !0, + base: !0, + br: !0, + col: !0, + command: !0, + embed: !0, + hr: !0, + img: !0, + input: !0, + keygen: !0, + link: !0, + meta: !0, + param: !0, + source: !0, + track: !0, + wbr: !0 + }; + var J = function (a, b) { + this.i = b === Fb ? a : ''; + }; + J.prototype.B = !0; + J.prototype.g = function () { + return this.i.toString(); + }; + J.prototype.j = !0; + J.prototype.h = function () { + return 1; + }; + var Jb = function (a, b) { + a = Gb.exec(Hb(a).toString()); + var c = a[3] || ''; + return new J(a[1] + Ib('?', a[2] || '', b) + Ib('#', c, void 0), Fb); + }; + J.prototype.toString = function () { + return this.i + ''; + }; + var Hb = function (a) { + return a instanceof J && a.constructor === J ? a.i : 'type_error:TrustedResourceUrl'; + }, Gb = /^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/, Kb = function (a) { + for (var b = '', c = 0; c < a.length; c++) + b += Bb(a[c]); + return new J(b, Fb); + }, Fb = {}, Ib = function (a, b, c) { + if (null == c) + return b; + if ('string' === typeof c) + return c ? a + encodeURIComponent(c) : ''; + for (var d in c) + if (Object.prototype.hasOwnProperty.call(c, d)) { + var e = c[d]; + e = Array.isArray(e) ? e : [e]; + for (var f = 0; f < e.length; f++) { + var h = e[f]; + null != h && (b || (b = a), b += (b.length > a.length ? '&' : '') + encodeURIComponent(d) + '=' + encodeURIComponent(String(h))); + } + } + return b; + }; + var K = function (a, b) { + this.i = b === Lb ? a : ''; + }; + K.prototype.B = !0; + K.prototype.g = function () { + return this.i.toString(); + }; + K.prototype.j = !0; + K.prototype.h = function () { + return 1; + }; + K.prototype.toString = function () { + return this.i.toString(); + }; + var Mb = RegExp('^(?:audio/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|font/\\w+|image/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|video/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\\w+=(?:\\w+|"[\\w;,= ]+"))*$', 'i'), Nb = /^data:(.*);base64,[a-z0-9+\/]+=*$/i, Ob = /^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i, Lb = {}, Pb = new K('about:invalid#zClosurez', Lb); + var Qb = {}, L = function (a, b, c) { + this.i = c === Qb ? a : ''; + this.l = b; + this.B = this.j = !0; + }; + L.prototype.h = function () { + return this.l; + }; + L.prototype.g = function () { + return this.i.toString(); + }; + L.prototype.toString = function () { + return this.i.toString(); + }; + var Rb = function (a) { + return a instanceof L && a.constructor === L ? a.i : 'type_error:SafeHtml'; + }, Sb = function (a) { + if (a instanceof L) + return a; + var b = 'object' == typeof a, c = null; + b && a.j && (c = a.h()); + a = Ia(b && a.B ? a.g() : String(a)); + return new L(a, c, Qb); + }, Wb = function (a, b) { + var c = { src: a }, d = {}; + a = {}; + for (var e in c) + Object.prototype.hasOwnProperty.call(c, e) && (a[e] = c[e]); + for (var f in d) + Object.prototype.hasOwnProperty.call(d, f) && (a[f] = d[f]); + if (b) + for (var h in b) + if (Object.prototype.hasOwnProperty.call(b, h)) { + e = h.toLowerCase(); + if (e in c) + throw Error(''); + e in d && delete a[e]; + a[h] = b[h]; + } + var g; + b = null; + h = ''; + if (a) + for (k in a) + if (Object.prototype.hasOwnProperty.call(a, k)) { + if (!Tb.test(k)) + throw Error(''); + d = a[k]; + if (null != d) { + c = k; + if (d instanceof Ab) + d = Bb(d); + else { + if ('style' == c.toLowerCase()) + throw Error(''); + if (/^on/i.test(c)) + throw Error(''); + if (c.toLowerCase() in Ub) + if (d instanceof J) + d = Hb(d).toString(); + else if (d instanceof K) + d = d instanceof K && d.constructor === K ? d.i : 'type_error:SafeUrl'; + else if ('string' === typeof d) + d instanceof K || (d = 'object' == typeof d && d.B ? d.g() : String(d), Ob.test(d) ? d = new K(d, Lb) : (d = String(d), d = d.replace(/(%0A|%0D)/g, ''), d = (e = d.match(Nb)) && Mb.test(e[1]) ? new K(d, Lb) : null)), d = (d || Pb).g(); + else + throw Error(''); + } + d.B && (d = d.g()); + c = c + '="' + Ia(String(d)) + '"'; + h += ' ' + c; + } + } + var k = '', b = g.h()); + (a = a && a.dir) && (/^(ltr|rtl|auto)$/i.test(a) ? b = 0 : b = null); + return new L(k, b, Qb); + }, Yb = function (a) { + var b = Sb(Xb), c = b.h(), d = [], e = function (f) { + Array.isArray(f) ? f.forEach(e) : (f = Sb(f), d.push(Rb(f).toString()), f = f.h(), 0 == c ? c = f : 0 != f && c != f && (c = null)); + }; + a.forEach(e); + return new L(d.join(Rb(b).toString()), c, Qb); + }, Vb = function (a) { + return Yb(Array.prototype.slice.call(arguments)); + }, Tb = /^[a-zA-Z0-9-]+$/, Ub = { + action: !0, + cite: !0, + data: !0, + formaction: !0, + href: !0, + manifest: !0, + poster: !0, + src: !0 + }, Xb = new L(z.trustedTypes && z.trustedTypes.emptyHTML || '', 0, Qb); + var Zb = {}; + function $b() { + var a = 'undefined' !== typeof window ? window.trustedTypes : void 0; + return null !== a && void 0 !== a ? a : null; + } + var ac; + function bc() { + var a, b; + if (void 0 === ac) + try { + ac = null !== (b = null === (a = $b()) || void 0 === a ? void 0 : a.createPolicy('google#safe', { + createHTML: function (c) { + return c; + }, + createScript: function (c) { + return c; + }, + createScriptURL: function (c) { + return c; + } + })) && void 0 !== b ? b : null; + } catch (c) { + ac = null; + } + return ac; + } + ; + var cc = function () { + }, dc = function (a) { + this.g = a; + }; + v(dc, cc); + dc.prototype.toString = function () { + return this.g.toString(); + }; + function ec(a) { + var b, c = null === (b = bc()) || void 0 === b ? void 0 : b.createScriptURL(a); + return new dc(null !== c && void 0 !== c ? c : a, Zb); + } + ; + function fc(a) { + if (a instanceof cc) + if (a instanceof dc) + a = a.g; + else + throw Error(''); + else + a = Hb(a); + return a; + } + ; + function gc(a) { + var b, c = (a.ownerDocument && a.ownerDocument.defaultView || window).document, d = null === (b = c.querySelector) || void 0 === b ? void 0 : b.call(c, 'script[nonce]'); + (b = d ? d.nonce || d.getAttribute('nonce') || '' : '') && a.setAttribute('nonce', b); + } + ; + function hc(a, b) { + a.write(Rb(b)); + } + ; + var ic = function (a) { + var b = !1, c; + return function () { + b || (c = a(), b = !0); + return c; + }; + }; + var jc = function (a, b) { + a.addEventListener && a.addEventListener('load', b, !1); + }; + var lc = function () { + a: { + var a = z.document; + if (a.querySelector && (a = a.querySelector('script[nonce]')) && (a = a.nonce || a.getAttribute('nonce')) && kc.test(a)) + break a; + a = ''; + } + return a; + }, kc = /^[\w+/_-]+[=]{0,2}$/; + var mc = function () { + return Na('iPad') || Na('Android') && !Na('Mobile') || Na('Silk'); + }; + var nc = RegExp('^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$'), oc = function (a) { + return a ? decodeURI(a) : a; + }, pc = /#|$/, qc = function (a, b) { + var c = a.search(pc); + a: { + var d = 0; + for (var e = b.length; 0 <= (d = a.indexOf(b, d)) && d < c;) { + var f = a.charCodeAt(d - 1); + if (38 == f || 63 == f) + if (f = a.charCodeAt(d + e), !f || 61 == f || 38 == f || 35 == f) + break a; + d += e + 1; + } + d = -1; + } + if (0 > d) + return null; + e = a.indexOf('&', d); + if (0 > e || e > c) + e = c; + d += b.length + 1; + return decodeURIComponent(a.substr(d, e - d).replace(/\+/g, ' ')); + }; + var uc = function (a, b) { + if (!rc() && !sc()) { + var c = Math.random(); + if (c < b) + return c = tc(), a[Math.floor(c * a.length)]; + } + return null; + }, tc = function () { + if (!m.globalThis.crypto) + return Math.random(); + try { + var a = new Uint32Array(1); + m.globalThis.crypto.getRandomValues(a); + return a[0] / 65536 / 65536; + } catch (b) { + return Math.random(); + } + }, vc = function (a, b) { + if (a) + for (var c in a) + Object.prototype.hasOwnProperty.call(a, c) && b.call(void 0, a[c], c, a); + }, wc = function (a) { + var b = a.length; + if (0 == b) + return 0; + for (var c = 305419896, d = 0; d < b; d++) + c ^= (c << 5) + (c >> 2) + a.charCodeAt(d) & 4294967295; + return 0 < c ? c : 4294967296 + c; + }, sc = ic(function () { + return Array.prototype.some.call([ + 'Google Web Preview', + 'Mediapartners-Google', + 'Google-Read-Aloud', + 'Google-Adwords' + ], xc, void 0) || 0.0001 > Math.random(); + }), rc = ic(function () { + return xc('MSIE'); + }), xc = function (a) { + return -1 != Ma().indexOf(a); + }, yc = /^(-?[0-9.]{1,30})$/, zc = function (a) { + return yc.test(a) && (a = Number(a), !isNaN(a)) ? a : null; + }, Ac = function (a) { + return /^true$/.test(a); + }, Bc = ic(function () { + return !mc() && (Na('iPod') || Na('iPhone') || Na('Android') || Na('IEMobile')) ? 2 : mc() ? 1 : 0; + }), Cc = function (a, b) { + a = void 0 === a ? '' : a; + b = void 0 === b ? window : b; + return (b = oc(b.location.href.match(nc)[3] || null)) ? wc(b + a) : null; + }, Ec = function (a, b) { + b = void 0 === b ? window.document : b; + 0 != a.length && b.head && a.forEach(function (c) { + if (c) { + var d = b; + d = void 0 === d ? window.document : d; + if (c && d.head) { + var e = Dc('META'); + d.head.appendChild(e); + e.httpEquiv = 'origin-trial'; + e.content = c; + } + } + }); + }, Fc = function (a) { + if ('number' !== typeof a.goog_pvsid) + try { + Object.defineProperty(a, 'goog_pvsid', { + value: Math.floor(Math.random() * Math.pow(2, 52)), + configurable: !1 + }); + } catch (b) { + } + return Number(a.goog_pvsid) || -1; + }, Dc = function (a, b) { + b = void 0 === b ? document : b; + return b.createElement(String(a).toLowerCase()); + }; + var Hc = function (a, b) { + var c = 'https://pagead2.googlesyndication.com/pagead/gen_204?id=' + b; + vc(a, function (d, e) { + d && (c += '&' + e + '=' + encodeURIComponent(d)); + }); + Gc(c); + }, Gc = function (a) { + var b = window; + if (b.fetch) + b.fetch(a, { + keepalive: !0, + credentials: 'include', + redirect: 'follow', + method: 'get', + mode: 'no-cors' + }); + else { + b.google_image_requests || (b.google_image_requests = []); + var c = Dc('IMG', b.document); + c.src = a; + b.google_image_requests.push(c); + } + }; + function Ic(a) { + var b = w.apply(1, arguments); + if (0 === b.length) + return ec(a[0]); + for (var c = [a[0]], d = 0; d < b.length; d++) + c.push(encodeURIComponent(b[d])), c.push(a[d + 1]); + return ec(c.join('')); + } + ; + var Jc = 'a'.charCodeAt(), Kc = Db({ + ra: 0, + qa: 1, + na: 2, + ia: 3, + oa: 4, + ja: 5, + pa: 6, + la: 7, + ma: 8, + ha: 9, + ka: 10 + }), Lc = Db({ + ta: 0, + ua: 1, + sa: 2 + }); + var Mc = function (a) { + if (/[^01]/.test(a)) + throw Error('Input bitstring ' + a + ' is malformed!'); + this.h = a; + this.g = 0; + }, Pc = function (a) { + var b = M(a, 16); + return !0 === !!M(a, 1) ? (a = Nc(a), a.forEach(function (c) { + if (c > b) + throw Error('ID ' + c + ' is past MaxVendorId ' + b + '!'); + }), a) : Oc(a, b); + }, Nc = function (a) { + for (var b = M(a, 12), c = []; b--;) { + var d = !0 === !!M(a, 1), e = M(a, 16); + if (d) + for (d = M(a, 16); e <= d; e++) + c.push(e); + else + c.push(e); + } + c.sort(function (f, h) { + return f - h; + }); + return c; + }, Oc = function (a, b, c) { + for (var d = [], e = 0; e < b; e++) + if (M(a, 1)) { + var f = e + 1; + if (c && -1 === c.indexOf(f)) + throw Error('ID: ' + f + ' is outside of allowed values!'); + d.push(f); + } + return d; + }, M = function (a, b) { + if (a.g + b > a.h.length) + throw Error('Requested length ' + b + ' is past end of string.'); + var c = a.h.substring(a.g, a.g + b); + a.g += b; + return parseInt(c, 2); + }; + var Rc = function (a, b) { + try { + var c = Xa(a.split('.')[0]).map(function (e) { + return (aa = e.toString(2), p(aa, 'padStart')).call(aa, 8, '0'); + }).join(''), d = new Mc(c); + c = {}; + c.tcString = a; + c.gdprApplies = !0; + d.g += 78; + c.cmpId = M(d, 12); + c.cmpVersion = M(d, 12); + d.g += 30; + c.tcfPolicyVersion = M(d, 6); + c.isServiceSpecific = !!M(d, 1); + c.useNonStandardStacks = !!M(d, 1); + c.specialFeatureOptins = Qc(Oc(d, 12, Lc), Lc); + c.purpose = { + consents: Qc(Oc(d, 24, Kc), Kc), + legitimateInterests: Qc(Oc(d, 24, Kc), Kc) + }; + c.purposeOneTreatment = !!M(d, 1); + c.publisherCC = String.fromCharCode(Jc + M(d, 6)) + String.fromCharCode(Jc + M(d, 6)); + c.vendor = { + consents: Qc(Pc(d), b), + legitimateInterests: Qc(Pc(d), b) + }; + return c; + } catch (e) { + return null; + } + }, Qc = function (a, b) { + var c = {}; + if (Array.isArray(b) && 0 !== b.length) { + b = t(b); + for (var d = b.next(); !d.done; d = b.next()) + d = d.value, c[d] = -1 !== a.indexOf(d); + } else + for (a = t(a), d = a.next(); !d.done; d = a.next()) + c[d.value] = !0; + delete c[0]; + return c; + }; + function Sc(a) { + return function () { + var b = w.apply(0, arguments); + try { + return a.apply(this, b); + } catch (c) { + } + }; + } + var Tc = Sc(function (a) { + var b = [], c = {}; + a = t(a); + for (var d = a.next(); !d.done; c = { C: c.C }, d = a.next()) + c.C = d.value, Sc(function (e) { + return function () { + b.push('[{"' + e.C.ga + '":' + vb(e.C.message) + '}]'); + }; + }(c))(); + return '[[' + b.join(',') + ']]'; + }); + var Uc = function (a, b) { + if (m.globalThis.fetch) + m.globalThis.fetch(a, { + method: 'POST', + body: b, + keepalive: 65536 > b.length, + credentials: 'omit', + mode: 'no-cors', + redirect: 'follow' + }); + else { + var c = new XMLHttpRequest(); + c.open('POST', a, !0); + c.send(b); + } + }; + function Vc(a) { + a.fa.apply(a, u(w.apply(1, arguments).map(function (b) { + return { + ga: 4, + message: b + }; + }))); + } + ; + var Wc = function (a) { + var b = void 0 === b ? Uc : b; + this.i = void 0 === a ? 1000 : a; + this.j = b; + this.h = []; + this.g = null; + }; + Wc.prototype.fa = function () { + var a = w.apply(0, arguments), b = this; + Sc(function () { + b.h.push.apply(b.h, u(a)); + var c = Sc(function () { + var d = Tc(b.h); + b.j('https://pagead2.googlesyndication.com/pagead/ping?e=1', d); + b.h = []; + b.g = null; + }); + 100 <= b.h.length ? (null !== b.g && clearTimeout(b.g), b.g = setTimeout(c, 0)) : null === b.g && (b.g = setTimeout(c, b.i)); + })(); + }; + var Xc = function (a) { + this.g = a; + this.defaultValue = !1; + }, Yc = function (a) { + this.g = a; + this.defaultValue = 0; + }, Zc = function (a, b) { + b = void 0 === b ? [] : b; + this.g = a; + this.defaultValue = b; + }; + var $c = new Xc(399544548), ad = new Yc(24), bd = new Zc(1939), cd = new Zc(1934, [ + 'A8FHS1NmdCwGqD9DwOicnHHY+y27kdWfxKa0YHSGDfv0CSpDKRHTQdQmZVPDUdaFWUsxdgVxlwAd6o+dhJykPA0AAACWeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9', + 'A8zdXi6dr1hwXEUjQrYiyYQGlU3557y5QWDnN0Lwgj9ePt66XMEvNkVWOEOWPd7TP9sBQ25X0Q15Lr1Nn4oGFQkAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9', + 'A4/Htern2udN9w3yJK9QgWQxQFruxOXsXL7cW60DyCl0EZFGCSme/J33Q/WzF7bBkVvhEWDlcBiUyZaim5CpFQwAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9' + ]), dd = new Xc(1959), ed = new Xc(203), fd = new Xc(1928), gd = new Xc(1941), hd = new Xc(370946349), id = new Xc(392736476), jd = new Yc(406149835), kd = new Zc(1932, [ + 'AxujKG9INjsZ8/gUq8+dTruNvk7RjZQ1oFhhgQbcTJKDnZfbzSTE81wvC2Hzaf3TW4avA76LTZEMdiedF1vIbA4AAABueyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzVGhpcmRQYXJ0eSI6dHJ1ZX0=', + 'Azuce85ORtSnWe1MZDTv68qpaW3iHyfL9YbLRy0cwcCZwVnePnOmkUJlG8HGikmOwhZU22dElCcfrfX2HhrBPAkAAAB7eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'A16nvcdeoOAqrJcmjLRpl1I6f3McDD8EfofAYTt/P/H4/AWwB99nxiPp6kA0fXoiZav908Z8etuL16laFPUdfQsAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'AxBHdr0J44vFBQtZUqX9sjiqf5yWZ/OcHRcRMN3H9TH+t90V/j3ENW6C8+igBZFXMJ7G3Pr8Dd13632aLng42wgAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'A88BWHFjcawUfKU3lIejLoryXoyjooBXLgWmGh+hNcqMK44cugvsI5YZbNarYvi3roc1fYbHA1AVbhAtuHZflgEAAAB2eyJvcmlnaW4iOiJodHRwczovL2dvb2dsZS5jb206NDQzIiwiZmVhdHVyZSI6IlRydXN0VG9rZW5zIiwiZXhwaXJ5IjoxNjUyNzc0NDAwLCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==' + ]), ld = new Yc(1935); + var nd = function (a) { + A.call(this, a, -1, md); + }; + v(nd, A); + var md = [6]; + var pd = function (a) { + A.call(this, a, -1, od); + }; + v(pd, A); + var qd = function (a) { + A.call(this, a); + }; + v(qd, A); + var rd = function (a) { + A.call(this, a); + }; + v(rd, A); + var od = [7]; + var sd = function (a) { + this.g = a || { cookie: '' }; + }; + sd.prototype.set = function (a, b, c) { + var d = !1; + if ('object' === typeof c) { + var e = c.ya; + d = c.za || !1; + var f = c.domain || void 0; + var h = c.path || void 0; + var g = c.da; + } + if (/[;=\s]/.test(a)) + throw Error('Invalid cookie name "' + a + '"'); + if (/[;\r\n]/.test(b)) + throw Error('Invalid cookie value "' + b + '"'); + void 0 === g && (g = -1); + this.g.cookie = a + '=' + b + (f ? ';domain=' + f : '') + (h ? ';path=' + h : '') + (0 > g ? '' : 0 == g ? ';expires=' + new Date(1970, 1, 1).toUTCString() : ';expires=' + new Date(Date.now() + 1000 * g).toUTCString()) + (d ? ';secure' : '') + (null != e ? ';samesite=' + e : ''); + }; + sd.prototype.get = function (a, b) { + for (var c = a + '=', d = (this.g.cookie || '').split(';'), e = 0, f; e < d.length; e++) { + f = Aa(d[e]); + if (0 == f.lastIndexOf(c, 0)) + return f.substr(c.length); + if (f == a) + return ''; + } + return b; + }; + sd.prototype.isEmpty = function () { + return !this.g.cookie; + }; + sd.prototype.clear = function () { + for (var a = (this.g.cookie || '').split(';'), b = [], c = [], d, e, f = 0; f < a.length; f++) + e = Aa(a[f]), d = e.indexOf('='), -1 == d ? (b.push(''), c.push(e)) : (b.push(e.substring(0, d)), c.push(e.substring(d + 1))); + for (a = b.length - 1; 0 <= a; a--) + c = b[a], this.get(c), this.set(c, '', { + da: 0, + path: void 0, + domain: void 0 + }); + }; + function td(a) { + return (a = vd(a)) ? H(a, qd, 4) : null; + } + function vd(a) { + a = (a = new sd(a).get('FCCDCF', '')) ? a : null; + try { + if (a) { + var b = a ? JSON.parse(a) : null; + hb = b; + var c = new pd(b); + hb = null; + var d = c; + } else + d = null; + return d; + } catch (e) { + return null; + } + } + ; + var wd = function (a) { + this.g = a; + this.h = null; + }, yd = function (a) { + a.__tcfapiPostMessageReady || xd(new wd(a)); + }, xd = function (a) { + a.h = function (b) { + var c = 'string' == typeof b.data; + try { + var d = c ? JSON.parse(b.data) : b.data; + } catch (f) { + return; + } + var e = d.__tcfapiCall; + !e || 'ping' !== e.command && 'getTCData' !== e.command && 'addEventListener' !== e.command && 'removeEventListener' !== e.command || a.g.__tcfapi(e.command, e.version, function (f, h) { + var g = {}; + g.__tcfapiReturn = 'removeEventListener' === e.command ? { + success: f, + callId: e.callId + } : { + returnValue: f, + success: h, + callId: e.callId + }; + f = c ? JSON.stringify(g) : g; + b.source && 'function' === typeof b.source.postMessage && b.source.postMessage(f, b.origin); + return f; + }, e.parameter); + }; + a.g.addEventListener('message', a.h); + a.g.__tcfapiPostMessageReady = !0; + }; + var zd = function (a, b) { + var c = a.document, d = function () { + if (!a.frames[b]) + if (c.body) { + var e = Dc('IFRAME', c); + e.style.display = 'none'; + e.style.width = '0px'; + e.style.height = '0px'; + e.style.border = 'none'; + e.style.zIndex = '-1000'; + e.style.left = '-1000px'; + e.style.top = '-1000px'; + e.name = b; + c.body.appendChild(e); + } else + a.setTimeout(d, 5); + }; + d(); + }; + var Ad = function (a) { + this.g = a; + this.h = a.document; + this.l = (a = (a = vd(this.h)) ? H(a, rd, 5) || null : null) ? B(a, 2) : null; + this.j = (a = td(this.h)) && null != B(a, 1) ? B(a, 1) : null; + this.i = (a = td(this.h)) && null != B(a, 2) ? B(a, 2) : null; + }, Dd = function (a) { + a.__uspapi || a.frames.__uspapiLocator || (a = new Ad(a), Bd(a), Cd(a)); + }, Bd = function (a) { + !a.l || a.g.__uspapi || a.g.frames.__uspapiLocator || (a.g.__uspapiManager = 'fc', zd(a.g, '__uspapiLocator'), za('__uspapi', function () { + return a.s.apply(a, u(w.apply(0, arguments))); + })); + }; + Ad.prototype.s = function (a, b, c) { + 'function' === typeof c && 'getUSPData' === a && c({ + version: 1, + uspString: this.l + }, !0); + }; + var Cd = function (a) { + !a.j || a.g.__tcfapi || a.g.frames.__tcfapiLocator || (a.g.__tcfapiManager = 'fc', zd(a.g, '__tcfapiLocator'), a.g.__tcfapiEventListeners = a.g.__tcfapiEventListeners || [], za('__tcfapi', function () { + return a.o.apply(a, u(w.apply(0, arguments))); + }), yd(a.g)); + }; + Ad.prototype.o = function (a, b, c, d) { + d = void 0 === d ? null : d; + if ('function' === typeof c) + if (b && 2 !== b) + c(null, !1); + else + switch (b = this.g.__tcfapiEventListeners, a) { + case 'getTCData': + !d || Array.isArray(d) && d.every(function (e) { + return 'number' === typeof e; + }) ? c(Ed(this, d, null), !0) : c(null, !1); + break; + case 'ping': + c({ + gdprApplies: !0, + cmpLoaded: !0, + cmpStatus: 'loaded', + displayStatus: 'disabled', + apiVersion: '2.0', + cmpVersion: 1, + cmpId: 300 + }); + break; + case 'addEventListener': + a = b.push(c); + c(Ed(this, null, a - 1), !0); + break; + case 'removeEventListener': + b[d] ? (b[d] = null, c(!0)) : c(!1); + break; + case 'getInAppTCData': + case 'getVendorList': + c(null, !1); + } + }; + var Ed = function (a, b, c) { + if (!a.j) + return null; + b = Rc(a.j, b); + b.addtlConsent = null != a.i ? a.i : void 0; + b.cmpStatus = 'loaded'; + b.eventStatus = 'tcloaded'; + null != c && (b.listenerId = c); + return b; + }; + var Gd = function (a) { + A.call(this, a, -1, Fd); + }; + v(Gd, A); + var Hd = function (a, b) { + return qb(a, 1, b); + }, Id = function (a, b) { + return tb(a, 2, b); + }, Jd = function (a, b) { + return ob(a, 4, b); + }, Kd = function (a, b) { + return tb(a, 5, b); + }, Ld = function (a, b) { + return F(a, 6, b); + }, Md = function (a) { + A.call(this, a); + }; + v(Md, A); + Md.prototype.A = function () { + return D(this, 1, 0); + }; + var Nd = function (a, b) { + return F(a, 1, b); + }, Od = function (a, b) { + return F(a, 2, b); + }, Pd = function (a) { + A.call(this, a); + }; + v(Pd, A); + var Fd = [ + 2, + 4, + 5 + ], Qd = [ + 1, + 2 + ]; + var Sd = function (a) { + A.call(this, a, -1, Rd); + }; + v(Sd, A); + var Ud = function (a) { + A.call(this, a, -1, Td); + }; + v(Ud, A); + var Rd = [ + 2, + 3 + ], Td = [5], Vd = [ + 1, + 2, + 3, + 4 + ]; + var Wd = function (a) { + A.call(this, a); + }; + v(Wd, A); + Wd.prototype.getTagSessionCorrelator = function () { + return D(this, 2, 0); + }; + var Xd = function (a) { + var b = new Wd(); + return sb(b, 4, a); + }, rb = [ + 4, + 5, + 7 + ]; + var Yd = function (a, b) { + var c = void 0 === c ? {} : c; + this.error = a; + this.context = b.context; + this.msg = b.message || ''; + this.id = b.id || 'jserror'; + this.meta = c; + }; + var Zd = null, $d = function () { + if (null === Zd) { + Zd = ''; + try { + var a = ''; + try { + a = z.top.location.hash; + } catch (c) { + a = z.location.hash; + } + if (a) { + var b = a.match(/\bdeid=([\d,]+)/); + Zd = b ? b[1] : ''; + } + } catch (c) { + } + } + return Zd; + }; + var be = function (a) { + A.call(this, a, -1, ae); + }; + v(be, A); + var ae = [ + 2, + 8 + ], ce = [ + 3, + 4, + 5 + ], de = [ + 6, + 7 + ]; + var ee; + ee = { + va: 0, + aa: 3, + ba: 4, + ca: 5 + }; + var fe = ee.aa, N = ee.ba, ge = ee.ca, he = function (a) { + return null != a ? !a : a; + }, ie = function (a, b) { + for (var c = !1, d = 0; d < a.length; d++) { + var e = a[d](); + if (e === b) + return e; + null == e && (c = !0); + } + if (!c) + return !b; + }, ke = function (a, b) { + var c = I(a, be, 2); + if (!c.length) + return je(a, b); + a = D(a, 1, 0); + if (1 === a) + return he(ke(c[0], b)); + c = Qa(c, function (d) { + return function () { + return ke(d, b); + }; + }); + switch (a) { + case 2: + return ie(c, !1); + case 3: + return ie(c, !0); + } + }, je = function (a, b) { + var c = G(a, ce); + a: { + switch (c) { + case fe: + var d = xb(a, 3, ce); + break a; + case N: + d = xb(a, 4, ce); + break a; + case ge: + d = xb(a, 5, ce); + break a; + } + d = void 0; + } + if (d && (b = (b = b[c]) && b[d])) { + try { + var e = b.apply(null, u(lb(a, 8))); + } catch (f) { + return; + } + b = D(a, 1, 0); + if (4 === b) + return !!e; + d = null != e; + if (5 === b) + return d; + if (12 === b) + a = wb(a, 7 === G(a, de) ? 7 : -1, void 0); + else + a: { + switch (c) { + case N: + a = nb(a, 6 === G(a, de) ? 6 : -1, void 0); + break a; + case ge: + a = wb(a, 7 === G(a, de) ? 7 : -1, void 0); + break a; + } + a = void 0; + } + if (null != a) { + if (6 === b) + return e === a; + if (9 === b) + return null != e && 0 === La(String(e), a); + if (d) + switch (b) { + case 7: + return e < a; + case 8: + return e > a; + case 12: + return 'string' === typeof a && 'string' === typeof e && new RegExp(a).test(e); + case 10: + return null != e && -1 === La(String(e), a); + case 11: + return null != e && 1 === La(String(e), a); + } + } + } + }, le = function (a, b) { + return !a || !(!b || !ke(a, b)); + }; + var ne = function (a) { + A.call(this, a, -1, me); + }; + v(ne, A); + var me = [4]; + var oe = function (a) { + A.call(this, a); + }; + v(oe, A); + var O = function (a) { + A.call(this, a, -1, pe); + }; + v(O, A); + var pe = [5], qe = [ + 1, + 2, + 3, + 6, + 7 + ]; + var re = function (a, b, c) { + var d = void 0 === d ? new Wc(b) : d; + this.h = a; + this.l = c; + this.j = d; + this.g = []; + this.i = 0 < this.h && tc() < 1 / this.h; + }, te = function (a, b, c, d, e, f) { + var h = Od(Nd(new Md(), b), c); + b = Ld(Id(Hd(Kd(Jd(new Gd(), d), e), h), a.g), f); + b = Xd(b); + a.i && Vc(a.j, se(a, b)); + if (1 === f || 3 === f || 4 === f && !a.g.some(function (g) { + return g.A() === h.A() && D(g, 2, 0) === c; + })) + a.g.push(h), 100 < a.g.length && a.g.shift(); + }, ue = function (a, b, c, d) { + if (a.l) { + var e = new Sd(); + b = tb(e, 2, b); + c = tb(b, 3, c); + d && F(c, 1, d); + d = new Wd(); + d = sb(d, 7, c); + a.i && Vc(a.j, se(a, d)); + } + }, se = function (a, b) { + b = F(b, 1, Date.now()); + var c = Fc(window); + b = F(b, 2, c); + return F(b, 6, a.h); + }; + var P = function (a) { + var b = 'J'; + if (a.J && a.hasOwnProperty(b)) + return a.J; + b = new a(); + return a.J = b; + }; + var ve = function () { + var a = {}; + this.g = (a[fe] = {}, a[N] = {}, a[ge] = {}, a); + }; + var we = Ac('false'); + var xe = we, ye = function (a, b) { + switch (b) { + case 1: + return xb(a, 1, qe); + case 2: + return xb(a, 2, qe); + case 3: + return xb(a, 3, qe); + case 6: + return xb(a, 6, qe); + default: + return null; + } + }, ze = function (a, b) { + if (!a) + return null; + switch (b) { + case 1: + return mb(a, 1); + case 7: + return wb(a, 3); + case 2: + return nb(a, 2); + case 3: + return wb(a, 3); + case 6: + return lb(a, 4); + default: + return null; + } + }, Ae = ic(function () { + if (!xe) + return {}; + try { + var a = window.sessionStorage && window.sessionStorage.getItem('GGDFSSK'); + if (a) + return JSON.parse(a); + } catch (b) { + } + return {}; + }), De = function (a, b, c, d) { + var e = d = void 0 === d ? 0 : d, f, h; + P(Q).j[e] = null != (h = null == (f = P(Q).j[e]) ? void 0 : f.add(b)) ? h : new m.Set().add(b); + e = Ae(); + if (null != e[b]) + return e[b]; + b = Be(d)[b]; + if (!b) + return c; + b = new O(b); + b = Ce(b); + a = ze(b, a); + return null != a ? a : c; + }, Ce = function (a) { + var b = P(ve).g; + if (b) { + var c = Sa(I(a, oe, 5), function (d) { + return le(H(d, be, 1), b); + }); + if (c) + return H(c, ne, 2); + } + return H(a, ne, 4); + }, Q = function () { + this.h = {}; + this.i = []; + this.j = {}; + this.g = new m.Map(); + }, Ee = function (a, b, c) { + return !!De(1, a, void 0 === b ? !1 : b, c); + }, Fe = function (a, b, c) { + b = void 0 === b ? 0 : b; + a = Number(De(2, a, b, c)); + return isNaN(a) ? b : a; + }, Ge = function (a, b, c) { + return De(3, a, void 0 === b ? '' : b, c); + }, He = function (a, b, c) { + b = void 0 === b ? [] : b; + return De(6, a, b, c); + }, Be = function (a) { + return P(Q).h[a] || (P(Q).h[a] = {}); + }, Ie = function (a, b) { + var c = Be(b); + vc(a, function (d, e) { + return c[e] = d; + }); + }, Je = function (a, b, c, d, e) { + e = void 0 === e ? !1 : e; + var f = [], h = []; + Oa(b, function (g) { + var k = Be(g); + Oa(a, function (l) { + var n = G(l, qe), q = ye(l, n); + if (q) { + var y, ib, ud; + var jb = null != (ud = null == (y = P(Q).g.get(g)) ? void 0 : null == (ib = y.get(q)) ? void 0 : ib.slice(0)) ? ud : []; + a: { + y = new Ud(); + switch (n) { + case 1: + pb(y, 1, Vd, q); + break; + case 2: + pb(y, 2, Vd, q); + break; + case 3: + pb(y, 3, Vd, q); + break; + case 6: + pb(y, 4, Vd, q); + break; + default: + n = void 0; + break a; + } + ob(y, 5, jb); + n = y; + } + if (jb = n) { + var Ja; + jb = !(null == (Ja = P(Q).j[g]) || !Ja.has(q)); + } + jb && f.push(n); + if (Ja = n) { + var fa; + Ja = !(null == (fa = P(Q).g.get(g)) || !fa.has(q)); + } + Ja && h.push(n); + e || (fa = P(Q), fa.g.has(g) || fa.g.set(g, new m.Map()), fa.g.get(g).has(q) || fa.g.get(g).set(q, []), d && fa.g.get(g).get(q).push(d)); + k[q] = l.toJSON(); + } + }); + }); + (f.length || h.length) && ue(c, f, h, null != d ? d : void 0); + }, Ke = function (a, b) { + var c = Be(b); + Oa(a, function (d) { + var e = new O(d), f = G(e, qe); + (e = ye(e, f)) && (c[e] || (c[e] = d)); + }); + }, Le = function () { + return Qa(p(Object, 'keys').call(Object, P(Q).h), function (a) { + return Number(a); + }); + }, Me = function (a) { + Ta(P(Q).i, a) || Ie(Be(4), a); + }; + var R = function (a) { + this.methodName = a; + }, Ne = new R(1), Oe = new R(16), Pe = new R(15), Qe = new R(2), Re = new R(3), Se = new R(4), Te = new R(5), Ue = new R(6), Ve = new R(7), We = new R(8), Xe = new R(9), Ye = new R(10), Ze = new R(11), $e = new R(12), af = new R(13), bf = new R(14), S = function (a, b, c) { + c.hasOwnProperty(a.methodName) || Object.defineProperty(c, String(a.methodName), { value: b }); + }, T = function (a, b, c) { + return b[a.methodName] || c || function () { + }; + }, cf = function (a) { + S(Te, Ee, a); + S(Ue, Fe, a); + S(Ve, Ge, a); + S(We, He, a); + S(af, Ke, a); + S(Pe, Me, a); + }, df = function (a) { + S(Se, function (b) { + P(ve).g = b; + }, a); + S(Xe, function (b, c) { + var d = P(ve); + d.g[fe][b] || (d.g[fe][b] = c); + }, a); + S(Ye, function (b, c) { + var d = P(ve); + d.g[N][b] || (d.g[N][b] = c); + }, a); + S(Ze, function (b, c) { + var d = P(ve); + d.g[ge][b] || (d.g[ge][b] = c); + }, a); + S(bf, function (b) { + for (var c = P(ve), d = t([ + fe, + N, + ge + ]), e = d.next(); !e.done; e = d.next()) + e = e.value, p(Object, 'assign').call(Object, c.g[e], b[e]); + }, a); + }, ef = function (a) { + a.hasOwnProperty('init-done') || Object.defineProperty(a, 'init-done', { value: !0 }); + }; + var ff = function () { + this.g = function () { + }; + this.h = function () { + return []; + }; + }, gf = function (a, b, c) { + a.g = function (d) { + T(Qe, b, function () { + return []; + })(d, c); + }; + a.h = function () { + return T(Re, b, function () { + return []; + })(c); + }; + }; + var hf = function (a, b) { + try { + var c = a.split('.'); + a = z; + for (var d = 0, e; null != a && d < c.length; d++) + e = a, a = a[c[d]], 'function' === typeof a && (a = e[c[d]]()); + var f = a; + if (typeof f === b) + return f; + } catch (h) { + } + }, jf = function () { + var a = {}; + this[fe] = (a[8] = function (b) { + try { + return null != va(b); + } catch (c) { + } + }, a[9] = function (b) { + try { + var c = va(b); + } catch (d) { + return; + } + if (b = 'function' === typeof c) + c = c && c.toString && c.toString(), b = 'string' === typeof c && -1 != c.indexOf('[native code]'); + return b; + }, a[10] = function () { + return window == window.top; + }, a[6] = function (b) { + return Ta(P(ff).h(), parseInt(b, 10)); + }, a[27] = function (b) { + b = hf(b, 'boolean'); + return void 0 !== b ? b : void 0; + }, a[60] = function (b) { + try { + return !!z.document.querySelector(b); + } catch (c) { + } + }, a); + a = {}; + this[N] = (a[3] = function () { + return Bc(); + }, a[6] = function (b) { + b = hf(b, 'number'); + return void 0 !== b ? b : void 0; + }, a[11] = function (b) { + b = Cc(void 0 === b ? '' : b, z); + return null == b ? void 0 : b % 1000; + }, a); + a = {}; + this[ge] = (a[2] = function () { + return window.location.href; + }, a[3] = function () { + try { + return window.top.location.hash; + } catch (b) { + return ''; + } + }, a[4] = function (b) { + b = hf(b, 'string'); + return void 0 !== b ? b : void 0; + }, a); + }; + var kf = function () { + var a = void 0 === a ? z : a; + return a.ggeac || (a.ggeac = {}); + }; + var mf = function (a) { + A.call(this, a, -1, lf); + }; + v(mf, A); + mf.prototype.getId = function () { + return D(this, 1, 0); + }; + mf.prototype.A = function () { + return D(this, 7, 0); + }; + var lf = [2]; + var of = function (a) { + A.call(this, a, -1, nf); + }; + v(of, A); + of.prototype.A = function () { + return D(this, 5, 0); + }; + var nf = [2]; + var qf = function (a) { + A.call(this, a, -1, pf); + }; + v(qf, A); + var sf = function (a) { + A.call(this, a, -1, rf); + }; + v(sf, A); + sf.prototype.A = function () { + return D(this, 1, 0); + }; + var tf = function (a) { + A.call(this, a); + }; + v(tf, A); + var pf = [ + 1, + 4, + 2, + 3 + ], rf = [2]; + var uf = [ + 12, + 13, + 20 + ], vf = function () { + }, wf = function (a, b, c, d, e) { + e = void 0 === e ? {} : e; + var f = void 0 === e.Z ? !1 : e.Z, h = void 0 === e.ea ? {} : e.ea; + e = void 0 === e.$ ? [] : e.$; + a.i = b; + a.o = {}; + a.s = f; + a.l = h; + b = {}; + a.h = (b[c] = [], b[4] = [], b); + a.j = {}; + (c = $d()) && Oa(c.split(',') || [], function (g) { + (g = parseInt(g, 10)) && (a.j[g] = !0); + }); + Oa(e, function (g) { + a.j[g] = !0; + }); + a.g = d; + return a; + }, Af = function (a, b, c) { + var d = [], e = xf(a.i, b), f; + if (f = 9 !== b) + a.o[b] ? f = !0 : (a.o[b] = !0, f = !1); + if (f) { + var h; + null == (h = a.g) || te(h, b, c, d, [], 4); + return d; + } + if (!e.length) { + var g; + null == (g = a.g) || te(g, b, c, d, [], 3); + return d; + } + var k = Ta(uf, b), l = []; + Oa(e, function (q) { + var y = new Pd(); + if (q = yf(a, q, c, y)) + 0 !== G(y, Qd) && l.push(y), y = q.getId(), d.push(y), zf(a, y, k ? 4 : c), (q = I(q, O, 2)) && (k ? Je(q, Le(), a.g, y) : Je(q, [c], a.g, y)); + }); + var n; + null == (n = a.g) || te(n, b, c, d, l, 1); + return d; + }, zf = function (a, b, c) { + a.h[c] || (a.h[c] = []); + a = a.h[c]; + Ta(a, b) || a.push(b); + }, Bf = function (a, b) { + a.i.push.apply(a.i, u(Pa(Qa(b, function (c) { + return new sf(c); + }), function (c) { + return !Ta(uf, c.A()); + }))); + }, yf = function (a, b, c, d) { + var e = P(ve).g; + if (!le(H(b, be, 3), e)) + return null; + var f = I(b, mf, 2), h = D(b, 6, 0); + if (h) { + pb(d, 1, Qd, h); + f = e[N]; + switch (c) { + case 2: + var g = f[8]; + break; + case 1: + g = f[7]; + } + c = void 0; + if (g) + try { + c = g(h), F(d, 3, c); + } catch (k) { + } + return (b = Cf(b, c)) ? Df(a, [b], 1) : null; + } + if (h = D(b, 10, 0)) { + pb(d, 2, Qd, h); + g = null; + switch (c) { + case 1: + g = e[N][9]; + break; + case 2: + g = e[N][10]; + break; + default: + return null; + } + c = g ? g(String(h)) : void 0; + if (void 0 === c && 1 === D(b, 11, 0)) + return null; + void 0 !== c && F(d, 3, c); + return (b = Cf(b, c)) ? Df(a, [b], 1) : null; + } + d = e ? Pa(f, function (k) { + return le(H(k, be, 3), e); + }) : f; + if (!d.length) + return null; + c = d.length * D(b, 1, 0); + return (b = D(b, 4, 0)) ? Ef(a, b, c, d) : Df(a, d, c / 1000); + }, Ef = function (a, b, c, d) { + var e = null != a.l[b] ? a.l[b] : 1000; + if (0 >= e) + return null; + d = Df(a, d, c / e); + a.l[b] = d ? 0 : e - c; + return d; + }, Df = function (a, b, c) { + var d = a.j, e = Ra(b, function (f) { + return !!d[f.getId()]; + }); + return e ? e : a.s ? null : uc(b, c); + }, Ff = function (a, b) { + S(Ne, function (c) { + a.j[c] = !0; + }, b); + S(Qe, function (c, d) { + return Af(a, c, d); + }, b); + S(Re, function (c) { + return (a.h[c] || []).concat(a.h[4]); + }, b); + S($e, function (c) { + return Bf(a, c); + }, b); + S(Oe, function (c, d) { + return zf(a, c, d); + }, b); + }, xf = function (a, b) { + return (a = Ra(a, function (c) { + return c.A() == b; + })) && I(a, of, 2) || []; + }, Cf = function (a, b) { + var c = I(a, mf, 2), d = c.length, e = D(a, 8, 0); + a = d * D(a, 1, 0) - 1; + b = void 0 !== b ? b : Math.floor(1000 * tc()); + d = (b - e) % d; + if (b < e || b - e - d >= a) + return null; + c = c[d]; + e = P(ve).g; + return !c || e && !le(H(c, be, 3), e) ? null : c; + }; + var Gf = function () { + var a = {}; + this.j = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.g = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.l = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.h = function (b, c) { + return null != a[b] ? a[b] : c; + }; + this.i = function () { + }; + }, Hf = function (a) { + return P(Gf).j(a.g, a.defaultValue); + }; + var If = function () { + this.g = function () { + }; + }, Jf = function (a) { + P(If).g(a); + }; + var Kf, Lf, Mf, Nf, Of, Pf, Sf = function (a) { + var b = P(Qf).g, c = { + Z: U[211], + $: U[226] + }, d = void 0, e = 2; + d = void 0 === d ? kf() : d; + e = void 0 === e ? 0 : e; + var f = void 0 === f ? new re(null != (Nf = null == (Kf = H(a, tf, 5)) ? void 0 : D(Kf, 2, 0)) ? Nf : 0, null != (Of = null == (Lf = H(a, tf, 5)) ? void 0 : D(Lf, 4, 0)) ? Of : 0, null != (Pf = null == (Mf = H(a, tf, 5)) ? void 0 : mb(Mf, 3)) ? Pf : !1) : f; + d.hasOwnProperty('init-done') ? (T($e, d)(Qa(I(a, sf, 2), function (h) { + return h.toJSON(); + })), T(af, d)(Qa(I(a, O, 1), function (h) { + return h.toJSON(); + }), e), b && T(bf, d)(b), Rf(d, e)) : (Ff(wf(P(vf), I(a, sf, 2), e, f, c), d), cf(d), df(d), ef(d), Rf(d, e), Je(I(a, O, 1), [e], f, void 0, !0), xe = xe || !(!c || !c.xa), Jf(P(jf)), b && Jf(b)); + }, Rf = function (a, b) { + a = void 0 === a ? kf() : a; + b = void 0 === b ? 0 : b; + var c = a, d = b; + d = void 0 === d ? 0 : d; + gf(P(ff), c, d); + Tf(a, b); + P(If).g = T(bf, a); + P(Gf).i(); + }, Tf = function (a, b) { + var c = P(Gf); + c.j = function (d, e) { + return T(Te, a, function () { + return !1; + })(d, e, b); + }; + c.g = function (d, e) { + return T(Ue, a, function () { + return 0; + })(d, e, b); + }; + c.l = function (d, e) { + return T(Ve, a, function () { + return ''; + })(d, e, b); + }; + c.h = function (d, e) { + return T(We, a, function () { + return []; + })(d, e, b); + }; + c.i = function () { + T(Pe, a)(b); + }; + }; + var Uf = P(Gf).h(bd.g, bd.defaultValue); + function Vf(a) { + a = void 0 === a ? window.document : a; + Ec(Uf, a); + } + ; + var Wf = function (a) { + a = void 0 === a ? z : a; + return (a = a.performance) && a.now ? a.now() : null; + }; + var Xf = z.performance, Yf = !!(Xf && Xf.mark && Xf.measure && Xf.clearMarks), Zf = ic(function () { + var a; + if (a = Yf) + a = $d(), a = !!a.indexOf && 0 <= a.indexOf('1337'); + return a; + }); + var $f = ka(['https://pagead2.googlesyndication.com/pagead/js/err_rep.js']), ag = function (a, b, c) { + this.g = void 0 === a ? null : a; + this.i = void 0 === b ? 'jserror' : b; + this.h = null; + this.j = void 0 === c ? 0.01 : c; + this.o = this.l; + this.s = null; + }, bg = function (a, b) { + a.h = b; + }; + ag.prototype.l = function (a, b, c, d, e) { + c = void 0 === c ? this.j : c; + e = void 0 === e ? this.i : e; + if (Math.random() > c) + return !1; + b.error && b.meta && b.id || (b = new Yd(b, { + context: a, + id: e + })); + if (d || this.h) + b.meta = {}, this.h && this.h(b.meta), d && d(b.meta); + z.google_js_errors = z.google_js_errors || []; + z.google_js_errors.push(b); + if (!z.error_rep_loaded) { + c = Ic($f); + var f; + a = z.document; + b = null != (f = this.s) ? f : new J(fc(c).toString(), Fb); + f = Dc('SCRIPT', a); + f.src = fc(b); + gc(f); + (a = a.getElementsByTagName('script')[0]) && a.parentNode && a.parentNode.insertBefore(f, a); + z.error_rep_loaded = !0; + } + return !1; + }; + var cg = function (a, b) { + try { + var c = a.g && a.g.start('420', 3); + b(); + a.g && c && a.g.end(c); + } catch (d) { + if (a.g && c && (b = c) && Xf && Zf() && (Xf.clearMarks('goog_' + b.label + '_' + b.uniqueId + '_start'), Xf.clearMarks('goog_' + b.label + '_' + b.uniqueId + '_end')), !a.o(420, d, a.j, void 0, a.i)) + throw d; + } + }; + var dg = P(Gf).h(cd.g, cd.defaultValue); + function eg(a) { + a = void 0 === a ? window.document : a; + Ec(dg, a); + } + ; + var fg = Cb('gpt/pubads_impl_'); + var gg = function (a, b) { + var c = Wf(b); + c && (a = { + label: a, + type: 9, + value: c + }, b = b.google_js_reporting_queue = b.google_js_reporting_queue || [], 2048 > b.length && b.push(a)); + }, hg = function (a, b, c) { + var d = window; + return function () { + var e = Wf(), f = 3; + try { + var h = b.apply(this, arguments); + } catch (g) { + f = 13; + if (c) + return c(a, g), h; + throw g; + } finally { + d.google_measure_js_timing && e && (e = { + label: a.toString(), + value: e, + duration: (Wf() || 0) - e, + type: f + }, f = d.google_js_reporting_queue = d.google_js_reporting_queue || [], 2048 > f.length && f.push(e)); + } + return h; + }; + }, ig = function (a, b) { + return hg(a, b, function (c, d) { + new ag().l(c, d); + }); + }; + var jg = function () { + this.j = this.j; + this.i = this.i; + }; + jg.prototype.j = !1; + jg.prototype.L = function () { + if (this.i) + for (; this.i.length;) + this.i.shift()(); + }; + function V(a, b) { + return null == b ? '&' + a + '=null' : '&' + a + '=' + Math.floor(b); + } + function kg(a, b) { + return '&' + a + '=' + b.toFixed(3); + } + function lg() { + var a = new m.Set(); + var b = void 0 === b ? window : b; + b = b.googletag; + b = (null === b || void 0 === b ? 0 : b.apiReady) ? b : void 0; + try { + if (!b) + return a; + for (var c = b.pubads(), d = t(c.getSlots()), e = d.next(); !e.done; e = d.next()) + a.add(e.value.getSlotId().getDomId()); + } catch (f) { + } + return a; + } + function mg(a) { + a = a.id; + return null != a && (lg().has(a) || p(a, 'startsWith').call(a, 'google_ads_iframe_') || p(a, 'startsWith').call(a, 'aswift')); + } + function ng(a, b, c) { + if (!a.sources) + return !1; + switch (og(a)) { + case 2: + var d = pg(a); + if (d) + return c.some(function (f) { + return qg(d, f); + }); + case 1: + var e = rg(a); + if (e) + return b.some(function (f) { + return qg(e, f); + }); + } + return !1; + } + function og(a) { + if (!a.sources) + return 0; + a = a.sources.filter(function (b) { + return b.previousRect && b.currentRect; + }); + if (1 <= a.length) { + a = a[0]; + if (a.previousRect.top < a.currentRect.top) + return 2; + if (a.previousRect.top > a.currentRect.top) + return 1; + } + return 0; + } + function rg(a) { + return sg(a, function (b) { + return b.currentRect; + }); + } + function pg(a) { + return sg(a, function (b) { + return b.previousRect; + }); + } + function sg(a, b) { + return a.sources.reduce(function (c, d) { + d = b(d); + return c ? d && 0 !== d.width * d.height ? d.top < c.top ? d : c : c : d; + }, null); + } + var tg = function () { + jg.call(this); + this.h = this.g = this.G = this.F = this.K = 0; + this.V = this.S = Number.NEGATIVE_INFINITY; + this.N = this.P = this.R = this.T = this.Y = this.o = this.X = this.I = 0; + this.O = !1; + this.H = this.D = this.s = 0; + var a = document.querySelector('[data-google-query-id]'); + this.W = a ? a.getAttribute('data-google-query-id') : null; + this.l = null; + this.U = !1; + this.M = function () { + }; + }; + v(tg, jg); + var wg = function () { + var a = new tg(); + if (Hf(ed) && !window.google_plmetrics && window.PerformanceObserver) { + window.google_plmetrics = !0; + for (var b = t([ + 'layout-shift', + 'largest-contentful-paint', + 'first-input', + 'longtask' + ]), c = b.next(); !c.done; c = b.next()) + c = c.value, ug(a).observe({ + type: c, + buffered: !0 + }); + vg(a); + } + }, ug = function (a) { + a.l || (a.l = new PerformanceObserver(ig(640, function (b) { + var c = xg !== window.scrollX || yg !== window.scrollY ? [] : zg, d = Ag(); + b = t(b.getEntries()); + for (var e = b.next(); !e.done; e = b.next()) + switch (e = e.value, e.entryType) { + case 'layout-shift': + var f = a; + if (!e.hadRecentInput) { + f.K += Number(e.value); + Number(e.value) > f.F && (f.F = Number(e.value)); + f.G += 1; + var h = ng(e, c, d); + h && (f.o += e.value, f.T++); + if (5000 < e.startTime - f.S || 1000 < e.startTime - f.V) + f.S = e.startTime, f.g = 0, f.h = 0; + f.V = e.startTime; + f.g += e.value; + h && (f.h += e.value); + f.g > f.I && (f.I = f.g, f.Y = f.h, f.X = e.startTime + e.duration); + } + break; + case 'largest-contentful-paint': + a.R = Math.floor(e.renderTime || e.loadTime); + a.P = e.size; + break; + case 'first-input': + a.N = Number((e.processingStart - e.startTime).toFixed(3)); + a.O = !0; + break; + case 'longtask': + e = Math.max(0, e.duration - 50), a.s += e, a.D = Math.max(a.D, e), a.H += 1; + } + }))); + return a.l; + }, vg = function (a) { + var b = ig(641, function () { + var d = document; + 2 == (Hf(dd) && d.prerendering ? 3 : { + visible: 1, + hidden: 2, + prerender: 3, + preview: 4, + unloaded: 5 + }[d.visibilityState || d.webkitVisibilityState || d.mozVisibilityState || ''] || 0) && Bg(a); + }), c = ig(641, function () { + return void Bg(a); + }); + document.addEventListener('visibilitychange', b); + document.addEventListener('unload', c); + a.M = function () { + document.removeEventListener('visibilitychange', b); + document.removeEventListener('unload', c); + ug(a).disconnect(); + }; + }; + tg.prototype.L = function () { + jg.prototype.L.call(this); + this.M(); + }; + var Bg = function (a) { + if (!a.U) { + a.U = !0; + ug(a).takeRecords(); + var b = 'https://pagead2.googlesyndication.com/pagead/gen_204?id=plmetrics'; + window.LayoutShift && (b += kg('cls', a.K), b += kg('mls', a.F), b += V('nls', a.G), window.LayoutShiftAttribution && (b += kg('cas', a.o), b += V('nas', a.T)), b += kg('wls', a.I), b += kg('tls', a.X), window.LayoutShiftAttribution && (b += kg('was', a.Y))); + window.LargestContentfulPaint && (b += V('lcp', a.R), b += V('lcps', a.P)); + window.PerformanceEventTiming && a.O && (b += V('fid', a.N)); + window.PerformanceLongTaskTiming && (b += V('cbt', a.s), b += V('mbt', a.D), b += V('nlt', a.H)); + for (var c = 0, d = t(document.getElementsByTagName('iframe')), e = d.next(); !e.done; e = d.next()) + mg(e.value) && c++; + b += V('nif', c); + c = window.google_unique_id; + b += V('ifi', 'number' === typeof c ? c : 0); + c = P(ff).h(); + b += '&eid=' + encodeURIComponent(c.join()); + b += '&top=' + (z === z.top ? 1 : 0); + b += a.W ? '&qqid=' + encodeURIComponent(a.W) : V('pvsid', Fc(z)); + window.googletag && (b += '&gpt=1'); + window.fetch(b, { + keepalive: !0, + credentials: 'include', + redirect: 'follow', + method: 'get', + mode: 'no-cors' + }); + a.j || (a.j = !0, a.L()); + } + }, qg = function (a, b) { + var c = Math.min(a.right, b.right) - Math.max(a.left, b.left); + a = Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top); + return 0 >= c || 0 >= a ? !1 : 50 <= 100 * c * a / ((b.right - b.left) * (b.bottom - b.top)); + }, Ag = function () { + var a = [].concat(u(document.getElementsByTagName('iframe'))).filter(mg), b = [].concat(u(lg())).map(function (c) { + return document.getElementById(c); + }).filter(function (c) { + return null !== c; + }); + xg = window.scrollX; + yg = window.scrollY; + return zg = [].concat(u(a), u(b)).map(function (c) { + return c.getBoundingClientRect(); + }); + }, xg = void 0, yg = void 0, zg = []; + var W = { + issuerOrigin: 'https://attestation.android.com', + issuancePath: '/att/i', + redemptionPath: '/att/r' + }, X = { + issuerOrigin: 'https://pagead2.googlesyndication.com', + issuancePath: '/dtt/i', + redemptionPath: '/dtt/r', + getStatePath: '/dtt/s' + }; + var Cg = function () { + var a = void 0 === a ? window : a; + a = a.navigator.userAgent; + var b = /Chrome/.test(a); + return /Android/.test(a) && b; + }, Dg = P(Gf).h(kd.g, kd.defaultValue), Eg = function (a, b, c) { + a = void 0 === a ? !1 : a; + b = void 0 === b ? !1 : b; + c = void 0 === c ? !1 : c; + jg.call(this); + var d = this; + this.g = a; + a = []; + b && Cg() && a.push(W); + c && a.push(X); + if (document.hasTrustToken && !Hf(hd) && !Array.isArray(window.goog_tt_state)) { + var e = a.map(function (f) { + return { + issuerOrigin: f.issuerOrigin, + state: d.g ? 1 : 12 + }; + }); + Object.defineProperty(window, 'goog_tt_state', { + configurable: !1, + get: function () { + return e.slice(); + } + }); + } + }; + v(Eg, jg); + var Fg = function () { + var a = window; + a = void 0 === a ? window : a; + return !a.PeriodicSyncManager; + }, Gg = function () { + var a = void 0 === a ? window.document : a; + Ec(Dg, a); + }, Hg = function (a) { + var b = U[150]; + return U[221] || '.google.ch' === b || 'function' === typeof a.__tcfapi; + }, Y = function (a, b, c) { + var d, e = null == (d = window.goog_tt_state) ? void 0 : p(d, 'find').call(d, function (f) { + return f.issuerOrigin === a; + }); + e && (e.state = b, void 0 != c && (e.hasRedemptionRecord = c)); + }, Ig = function () { + var a = W.issuerOrigin + W.redemptionPath, b = { + keepalive: !0, + trustToken: { + type: 'token-redemption', + issuer: W.issuerOrigin, + refreshPolicy: 'none' + } + }; + Y(W.issuerOrigin, 2); + return window.fetch(a, b).then(function (c) { + if (!c.ok) + throw Error(c.status + ': Network response was not ok!'); + Y(W.issuerOrigin, 6, !0); + }).catch(function (c) { + c && 'NoModificationAllowedError' === c.name ? Y(W.issuerOrigin, 6, !0) : Y(W.issuerOrigin, 5); + }); + }, Jg = function () { + var a = W.issuerOrigin + W.issuancePath; + Y(W.issuerOrigin, 8); + return window.fetch(a, { + keepalive: !0, + trustToken: { type: 'token-request' } + }).then(function (b) { + if (!b.ok) + throw Error(b.status + ': Network response was not ok!'); + Y(W.issuerOrigin, 10); + return Ig(); + }).catch(function (b) { + if (b && 'NoModificationAllowedError' === b.name) + return Y(W.issuerOrigin, 10), Ig(); + Y(W.issuerOrigin, 9); + }); + }, Kg = function () { + Y(W.issuerOrigin, 13); + return document.hasTrustToken(W.issuerOrigin).then(function (a) { + return a ? Ig() : Jg(); + }); + }, Lg = function () { + Y(X.issuerOrigin, 13); + if (window.Promise) { + var a = document.hasTrustToken(X.issuerOrigin).then(function (e) { + return e; + }).catch(function (e) { + return window.Promise.reject({ + state: 19, + error: e + }); + }), b = X.issuerOrigin + X.redemptionPath, c = { + keepalive: !0, + trustToken: { + type: 'token-redemption', + refreshPolicy: 'none' + } + }; + Y(X.issuerOrigin, 16); + a = a.then(function (e) { + return window.fetch(b, c).then(function (f) { + if (!f.ok) + throw Error(f.status + ': Network response was not ok!'); + Y(X.issuerOrigin, 18, !0); + }).catch(function (f) { + if (f && 'NoModificationAllowedError' === f.name) + Y(X.issuerOrigin, 18, !0); + else { + if (e) + return window.Promise.reject({ + state: 17, + error: f + }); + Y(X.issuerOrigin, 17); + } + }); + }).then(function () { + return document.hasTrustToken(X.issuerOrigin).then(function (e) { + return e; + }).catch(function (e) { + return window.Promise.reject({ + state: 19, + error: e + }); + }); + }).then(function (e) { + var f = X.issuerOrigin + X.getStatePath; + Y(X.issuerOrigin, 20); + return window.fetch(f + '?ht=' + e, { + trustToken: { + type: 'send-redemption-record', + issuers: [X.issuerOrigin] + } + }).then(function (h) { + if (!h.ok) + throw Error(h.status + ': Network response was not ok!'); + Y(X.issuerOrigin, 22); + return h.text().then(function (g) { + return JSON.parse(g); + }); + }).catch(function (h) { + return window.Promise.reject({ + state: 21, + error: h + }); + }); + }); + var d = Fc(window); + return a.then(function (e) { + var f = X.issuerOrigin + X.issuancePath; + return e && e.srqt && e.cs ? (Y(X.issuerOrigin, 23), window.fetch(f + '?cs=' + e.cs + '&correlator=' + d, { + keepalive: !0, + trustToken: { type: 'token-request' } + }).then(function (h) { + if (!h.ok) + throw Error(h.status + ': Network response was not ok!'); + Y(X.issuerOrigin, 25); + return e; + }).catch(function (h) { + return window.Promise.reject({ + state: 24, + error: h + }); + })) : e; + }).then(function (e) { + if (e && e.srdt && e.cs) + return Y(X.issuerOrigin, 26), window.fetch(b + '?cs=' + e.cs + '&correlator=' + d, { + keepalive: !0, + trustToken: { + type: 'token-redemption', + refreshPolicy: 'refresh' + } + }).then(function (f) { + if (!f.ok) + throw Error(f.status + ': Network response was not ok!'); + Y(X.issuerOrigin, 28, !0); + }).catch(function (f) { + return window.Promise.reject({ + state: 27, + error: f + }); + }); + }).then(function () { + Y(X.issuerOrigin, 29); + }).catch(function (e) { + if (e instanceof Object && e.hasOwnProperty('state') && e.hasOwnProperty('error')) + if ('number' === typeof e.state && e.error instanceof Error) { + Y(X.issuerOrigin, e.state); + var f = P(Gf).g(jd.g, jd.defaultValue); + Math.random() <= f && Hc({ + state: e.state, + err: e.error.toString() + }, 'dtt_err'); + } else + throw Error(e); + else + throw e; + }); + } + }, Mg = function (a) { + if (document.hasTrustToken && !Hf(hd) && a.g) { + if (window.goog_tt_promise) + return window.goog_tt_promise; + a = window.goog_tt_state; + if (Array.isArray(a)) { + var b = []; + p(a, 'find').call(a, function (c) { + return c.issuerOrigin === W.issuerOrigin; + }) && b.push(Kg()); + p(a, 'find').call(a, function (c) { + return c.issuerOrigin === X.issuerOrigin; + }) && b.push(Lg()); + if (window.Promise && window.Promise.all) + return a = window.Promise.all(b), 'object' != typeof window.goog_tt_promise && Object.defineProperty(window, 'goog_tt_promise', { + configurable: !1, + value: a, + writable: !1 + }), a; + } + } + }; + var Ng = 'platform platformVersion architecture model uaFullVersion bitness'.split(' '); + function Og(a) { + var b, c; + return 'function' !== typeof (null === (c = null === (b = null === a || void 0 === a ? void 0 : a.navigator) || void 0 === b ? void 0 : b.userAgentData) || void 0 === c ? void 0 : c.getHighEntropyValues) ? null : a.navigator.userAgentData.getHighEntropyValues(Ng).then(function (d) { + var e = new nd(); + e = C(e, 1, d.platform); + e = C(e, 2, d.platformVersion); + e = C(e, 3, d.architecture); + e = C(e, 4, d.model); + e = C(e, 5, d.uaFullVersion); + return C(e, 9, d.bitness); + }); + } + ; + function Pg() { + var a; + return null !== (a = z.googletag) && void 0 !== a ? a : z.googletag = {}; + } + function Qg(a, b) { + var c = Pg(); + c.hasOwnProperty(a) || (c[a] = b); + } + ; + var Z = {}, U = (Z[23] = 0.001, Z[38] = 0.001, Z[58] = 1, Z[150] = '', Z[211] = !1, Z[253] = !1, Z[172] = null, Z[246] = [], Z[226] = [], Z[252] = null, Z[258] = null, Z[251] = null, Z[259] = null, Z[6] = function (a, b) { + b = void 0 === b ? !0 : b; + try { + for (var c = null; c != a; c = a, a = a.parent) + switch (a.location.protocol) { + case 'https:': + return !0; + case 'file:': + return b; + case 'http:': + return !1; + } + } catch (d) { + } + return !0; + }(window), Z[36] = Ac('false'), Z[148] = we, Z[221] = Ac(''), Z[257] = Ac('false'), Z[260] = void 0, Z[262] = Ac('false'), Z); + function Rg(a, b) { + U[a] = b; + } + var Sg = Pg(); + p(Object, 'assign').call(Object, U, Sg._vars_); + Sg._vars_ = U; + var Tg = new m.WeakMap(), Ug = function (a, b) { + a = [a]; + for (var c = b.length - 1; 0 <= c; --c) + a.push(typeof b[c], b[c]); + return a.join('\x0B'); + }; + var Vg = function (a, b) { + b = void 0 === b ? Ug : b; + var c = ya(a), d = function (e) { + e = t(e); + e.next(); + e = la(e); + return b(c, e); + }; + return function () { + var e = w.apply(0, arguments), f = this || z, h = Tg.get(f); + h || (h = {}, Tg.set(f, h)); + f = h; + h = [this].concat(u(e)); + e = d ? d(h) : h; + if (Object.prototype.hasOwnProperty.call(f, e)) + f = f[e]; + else { + var g = t(h); + h = g.next().value; + g = la(g); + h = a.apply(h, g); + f = f[e] = h; + } + return f; + }; + }(function (a) { + return (null === a || void 0 === a ? 0 : a.src) ? /^(?:https?:)?\/\/(?:www\.googletagservices\.com|securepubads\.g\.doubleclick\.net|pagead2\.googlesyndication\.com)\/tag\/js\/gpt(?:_[a-z]+)*\.js/.test(a.src) ? 0 : 1 : 2; + }, function (a, b) { + var c; + return a + '\x0B' + (null === (c = b[0]) || void 0 === c ? void 0 : c.src); + }); + function Wg() { + return 0 === Vg(U[172]); + } + ; + function Xg() { + return zc('1') || 0; + } + function Yg() { + var a = Zg; + var b = Number(a); + if (1 > b || Math.floor(b) !== b) + Hc({ v: a }, 'gpt_inv_ver'), a = '1'; + return a; + } + var Zg = '2022011002'; + var Qf = function () { + var a = {}, b = {}, c = {}; + this.g = (c[fe] = (a[3] = Wg, a[17] = function () { + return p(w.apply(0, arguments), 'includes').call(w.apply(0, arguments), String(Cc())); + }, a[59] = function () { + var d = w.apply(0, arguments), e = p(d, 'includes'), f = String, h; + var g = void 0 === g ? window : g; + var k; + g = null != (k = null == (h = oc(g.location.href.match(nc)[3] || null)) ? void 0 : h.split('.')) ? k : []; + h = 2 > g.length ? null : 'uk' === g[g.length - 1] ? 3 > g.length ? null : wc(g.splice(g.length - 3).join('.')) : wc(g.splice(g.length - 2).join('.')); + return e.call(d, f(h)); + }, a[21] = function () { + return U[148]; + }, a[61] = function () { + return U[221]; + }, a[63] = function () { + return U[221] || '.google.ch' === U[150]; + }, a[50] = function () { + return 1 === Math.floor(new Date().getTime() / 24 / 60 / 60 / 1000) % 2; + }, a[54] = function () { + return !!U[259]; + }, a), c[N] = (b[1] = function () { + var d; + return null !== (d = zc('{{MOD}}')) && void 0 !== d ? d : -1; + }, b[4] = Xg, b), c); + }; + function $g(a) { + var b = new qf(U[246]); + a = new qf(a); + if (!I(b, O, 1).length && I(a, O, 1).length) { + var c = I(a, O, 1); + tb(b, 1, c); + } + !I(b, sf, 2).length && I(a, sf, 2).length && (c = I(a, sf, 2), tb(b, 2, c)); + null == B(b, 5) && null != B(a, 5) && (a = H(a, tf, 5), qb(b, 5, a)); + Sf(b); + } + ; + function ah(a) { + return (a = a.currentScript) ? a : null; + } + function bh(a) { + var b; + a = t(null !== (b = a.scripts) && void 0 !== b ? b : []); + for (var c = a.next(); !c.done; c = a.next()) + if (c = c.value, p(c.src, 'includes').call(c.src, '/tag/js/gpt')) + return c; + return null; + } + function ch(a) { + return !(null === a || void 0 === a || !a.src) && 'pagead2.googlesyndication.com' === oc(a.src.match(nc)[3] || null); + } + function dh(a) { + var b = ah(a); + return 'complete' === a.readyState || 'loaded' === a.readyState || !(null === b || void 0 === b || !b.async); + } + function eh(a) { + a = ch(a) ? Cb('https://pagead2.googlesyndication.com/') : Cb('https://securepubads.g.doubleclick.net/'); + a = Kb([ + a, + fg, + Cb('2022011002'), + Cb('.js') + ]); + var b = P(Gf).g(ad.g, ad.defaultValue); + return b ? Jb(a, String(b)) : a; + } + var fh = function () { + this.h = []; + this.error = this.g = void 0; + }, gh = function (a, b, c) { + a.g = b; + a.error = c; + for (var d = t(a.h), e = d.next(); !e.done; e = d.next()) + e = e.value, e(b, c); + a.h.length = 0; + }; + function hh(a, b, c) { + a = a.location.host; + var d = b && qc(b.src, 'domain'), e = b && qc(b.src, 'network-code'); + if (!a && !d && !e) + return gh(c, void 0, new m.globalThis.Error('no provided or inferred data')), null; + b = ch(b) ? Cb('https://pagead2.googlesyndication.com') : Cb('https://securepubads.g.doubleclick.net'); + return Jb(Kb([ + b, + Cb('/pagead/ppub_config') + ]), { + ippd: a, + pppd: d, + pppnc: e + }); + } + function ih(a, b) { + const $___old_1843790d7c1b5b9e = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'), $___old_b219158d66bcdf33 = {}.constructor.getOwnPropertyDescriptor(window, 'XMLHttpRequest'); + try { + if ($___old_1843790d7c1b5b9e) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_00465284004d4aa8.XMLHttpRequest)); + if ($___old_b219158d66bcdf33) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___mock_00465284004d4aa8.XMLHttpRequest)); + return function () { + var c = new fh(); + Rg(260, function (e) { + void 0 !== c.g || c.error ? e(c.g, c.error) : c.h.push(e); + }); + if (b = hh(a, b, c)) { + var d = new m.globalThis.XMLHttpRequest(); + d.open('GET', b.toString(), !0); + d.withCredentials = !1; + d.onload = function () { + 300 > d.status ? (gg('13', a), gh(c, 204 === d.status ? '' : d.responseText)) : gh(c, void 0, new m.globalThis.Error('resp:' + d.status)); + }; + d.onerror = function () { + return void gh(c, void 0, new m.globalThis.Error('s:' + d.status + ' rs:' + d.readyState)); + }; + d.send(); + } + }.apply(this, arguments); + } finally { + if ($___old_1843790d7c1b5b9e) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_1843790d7c1b5b9e)); + if ($___old_b219158d66bcdf33) + ({}.constructor.defineProperty(window, 'XMLHttpRequest', $___old_b219158d66bcdf33)); + } + } + function jh(a, b, c, d) { + U[172] = d; + U[259] = dh(a); + $g(b); + P(ff).g(12); + P(ff).g(5); + Gg(); + Hg(c) || (a = !Fg() && Hf(fd) || Fg() && Hf(gd), b = Hf(id), a = new Eg(!0, a, b), 0 < P(Gf).g(ld.g, ld.defaultValue) ? Rg(258, Mg(a)) : Mg(a)); + (a = Og(c)) && a.then(function (e) { + e = vb(e); + U[251] = e; + }); + eg(c.document); + Vf(c.document); + } + function kh(a, b) { + var c, d, e, f, h, g = Pg(), k = null !== (c = null !== a && void 0 !== a ? a : g.fifWin) && void 0 !== c ? c : window; + a = k.document; + var l = g.fifWin ? window : k; + Qg('_loaded_', !0); + Qg('getVersion', Yg); + Qg('cmd', []); + var n = null !== (d = ah(a)) && void 0 !== d ? d : bh(a); + jh(a, b, k, n); + try { + wg(); + } catch (ib) { + } + gg('1', k); + b = eh(n); + if (!U[259]) { + k = 'gpt-impl-' + Math.random(); + try { + hc(a, Wb(b, { + id: k, + nonce: lc() + })); + } catch (ib) { + } + a.getElementById(k) && (g._loadStarted_ = !0); + } + if (!g._loadStarted_) { + k = g.fifWin ? l.document : a; + var q = Dc('SCRIPT'); + q.src = fc(b); + gc(q); + q.async = !0; + var y = null !== (f = null !== (e = k.head) && void 0 !== e ? e : k.body) && void 0 !== f ? f : k.documentElement; + 'complete' !== l.document.readyState && g.fifWin ? jc(l, function () { + return void y.appendChild(q); + }) : y.appendChild(q); + g._loadStarted_ = !0; + } + l === l.top && (Hf($c) || U[259] || !ah(a) && (null === (h = bh(a)) || void 0 === h ? 0 : h.async)) && (Dd(l), ih(l, n)); + } + ; + var lh; + a: { + try { + if (Array.isArray(E)) { + lh = E; + break a; + } + } catch (a) { + } + lh = []; + } + (function (a, b) { + var c = new ag(null, 'gpt_exception', 0.01); + bg(c, function (d) { + d.methodId = 420; + }); + cg(c, function () { + return void kh(a, b); + }); + }(void 0, lh)); + }.call(this.googletag && googletag.fifWin ? googletag.fifWin.parent : this, [ + [ + [ + null, + 7, + null, + [ + null, + 0.1 + ] + ], + [ + 410803690, + null, + null, + [1] + ], + [ + 398776878, + null, + null, + [1] + ], + [ + 411170147, + null, + null, + [1] + ], + [ + null, + 408380992, + null, + [ + null, + 0.01 + ] + ], + [ + 400963805, + null, + null, + [1] + ], + [ + 400992468, + null, + null, + [1] + ], + [ + null, + 397316938, + null, + [ + null, + 1000 + ] + ], + [ + null, + 385440135, + null, + [ + null, + 1000 + ] + ], + [ + null, + 377289019, + null, + [ + null, + 10000 + ] + ], + [ + null, + 385610149, + null, + [ + null, + 300 + ] + ], + [ + null, + 529, + null, + [ + null, + 20 + ] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ] + ], + [ + 410568046, + null, + null, + [1] + ], + [ + 411840949, + null, + null, + [1] + ], + [ + 413681686, + null, + null, + [1] + ], + [ + 413477729, + null, + null, + [1] + ], + [ + 413667516, + null, + null, + [1] + ], + [ + 20, + null, + null, + null, + [[ + [ + 1, + [[ + 6, + null, + null, + 3, + null, + 0 + ]] + ], + [1] + ]] + ], + [ + null, + 388529191, + null, + null, + [[ + [ + 4, + null, + 59, + null, + null, + null, + null, + ['4276767238'] + ], + [ + null, + 86400 + ] + ]] + ], + [ + null, + 492, + null, + [ + null, + 0.01 + ] + ], + [ + null, + 389357230, + null, + [ + null, + 1000 + ] + ], + [ + null, + 398776877, + null, + [ + null, + 60000 + ] + ], + [ + 403426966, + null, + null, + [1] + ], + [ + null, + 374201269, + null, + [ + null, + 60000 + ] + ], + [ + null, + 371364213, + null, + [ + null, + 60000 + ] + ], + [ + null, + 373440923, + null, + [ + null, + 0.0001 + ] + ], + [ + null, + 376149757, + null, + [ + null, + 0.0025 + ] + ], + [ + null, + 396668915, + null, + [ + null, + 5 + ] + ], + [ + 399982759, + null, + null, + [1] + ], + [ + null, + 47, + null, + [ + null, + 1 + ] + ], + [ + null, + null, + 2, + [ + null, + null, + '1-0-38' + ] + ], + [ + 392065905, + null, + null, + null, + [[ + [ + 3, + [ + [ + 4, + null, + 15, + null, + null, + null, + null, + ['18190176,155953048'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['49944529'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['5441'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6177'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6782'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6581'] + ] + ] + ], + [1] + ]] + ], + [ + null, + 360245595, + null, + [ + null, + 500 + ] + ], + [ + 396442598, + null, + null, + [1] + ], + [ + null, + 61, + null, + [ + null, + 0.001 + ] + ], + [ + 1936, + null, + null, + [1] + ], + [ + null, + 1921, + null, + [ + null, + 72 + ] + ], + [ + null, + 1920, + null, + [ + null, + 24 + ] + ], + [ + null, + 1922, + null, + [ + null, + 5 + ] + ], + [ + null, + 1917, + null, + [ + null, + 300 + ] + ], + [ + null, + 1916, + null, + [ + null, + 0.001 + ] + ], + [ + null, + null, + null, + [ + null, + null, + null, + [ + 'A8FHS1NmdCwGqD9DwOicnHHY+y27kdWfxKa0YHSGDfv0CSpDKRHTQdQmZVPDUdaFWUsxdgVxlwAd6o+dhJykPA0AAACWeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9', + 'A8zdXi6dr1hwXEUjQrYiyYQGlU3557y5QWDnN0Lwgj9ePt66XMEvNkVWOEOWPd7TP9sBQ25X0Q15Lr1Nn4oGFQkAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9', + 'A4/Htern2udN9w3yJK9QgWQxQFruxOXsXL7cW60DyCl0EZFGCSme/J33Q/WzF7bBkVvhEWDlcBiUyZaim5CpFQwAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9' + ] + ], + null, + 1934 + ], + [ + 1903, + null, + null, + [1] + ], + [ + 1953, + null, + null, + [1] + ], + [ + 1938, + null, + null, + [1] + ], + [ + 1948, + null, + null, + [1] + ], + [ + null, + null, + null, + [ + null, + null, + null, + [ + 'AxujKG9INjsZ8/gUq8+dTruNvk7RjZQ1oFhhgQbcTJKDnZfbzSTE81wvC2Hzaf3TW4avA76LTZEMdiedF1vIbA4AAABueyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzVGhpcmRQYXJ0eSI6dHJ1ZX0=', + 'Azuce85ORtSnWe1MZDTv68qpaW3iHyfL9YbLRy0cwcCZwVnePnOmkUJlG8HGikmOwhZU22dElCcfrfX2HhrBPAkAAAB7eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'A16nvcdeoOAqrJcmjLRpl1I6f3McDD8EfofAYTt/P/H4/AWwB99nxiPp6kA0fXoiZav908Z8etuL16laFPUdfQsAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'AxBHdr0J44vFBQtZUqX9sjiqf5yWZ/OcHRcRMN3H9TH+t90V/j3ENW6C8+igBZFXMJ7G3Pr8Dd13632aLng42wgAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9', + 'A88BWHFjcawUfKU3lIejLoryXoyjooBXLgWmGh+hNcqMK44cugvsI5YZbNarYvi3roc1fYbHA1AVbhAtuHZflgEAAAB2eyJvcmlnaW4iOiJodHRwczovL2dvb2dsZS5jb206NDQzIiwiZmVhdHVyZSI6IlRydXN0VG9rZW5zIiwiZXhwaXJ5IjoxNjUyNzc0NDAwLCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ==' + ] + ], + null, + 1932 + ], + [ + null, + 397907552, + null, + [ + null, + 500 + ] + ], + [ + 401243724, + null, + null, + [1] + ] + ], + [ + [ + 20, + [[ + 50, + [ + [31062930], + [ + 31062931, + [[ + 380025941, + null, + null, + [1] + ]] + ] + ], + null, + null, + null, + null, + null, + 101, + null, + 102 + ]] + ], + [ + 13, + [ + [ + 10, + [ + [44756894], + [ + 44756895, + [[ + 1947, + null, + null, + [1] + ]] + ] + ] + ], + [ + 10, + [ + [44756896], + [44756897] + ] + ], + [ + 10, + [ + [44756431], + [ + 44756432, + [[ + 1960, + null, + null, + [1] + ]] + ] + ] + ], + [ + 1, + [ + [ + 31062554, + null, + [ + 2, + [ + [ + 6, + null, + null, + 3, + null, + 0 + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(9[23456789]|\\d{3,})', + ['navigator.userAgent'] + ] + ] + ] + ], + [ + 31062555, + [[ + 395842139, + null, + null, + [1] + ]], + [ + 2, + [ + [ + 6, + null, + null, + 3, + null, + 0 + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(9[23456789]|\\d{3,})', + ['navigator.userAgent'] + ] + ] + ] + ] + ] + ], + [ + 1000, + [[21067496]], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['document.hasTrustToken'] + ] + ], + [ + 1000, + [[ + 31060475, + null, + [ + 2, + [ + [ + 1, + [[ + 4, + null, + 9, + null, + null, + null, + null, + ['window.PeriodicSyncManager'] + ]] + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ] + ] + ] + ]] + ], + [ + 500, + [ + [31061692], + [ + 31061693, + [ + [ + 77, + null, + null, + [1] + ], + [ + 78, + null, + null, + [1] + ], + [ + 85, + null, + null, + [1] + ], + [ + 80, + null, + null, + [1] + ], + [ + 76, + null, + null, + [1] + ] + ] + ] + ], + [ + 4, + null, + 6, + null, + null, + null, + null, + ['31061691'] + ] + ], + [ + 1, + [ + [31062890], + [ + 31062891, + [[ + 397841828, + null, + null, + [1] + ]] + ] + ] + ], + [ + 1, + [[31062946]], + [ + 4, + null, + 27, + null, + null, + null, + null, + ['document.prerendering'] + ] + ], + [ + 1, + [[31062947]], + [ + 1, + [[ + 4, + null, + 27, + null, + null, + null, + null, + ['document.prerendering'] + ]] + ] + ] + ] + ], + [ + 4, + [ + [ + null, + [ + [ + 44714449, + [[ + null, + 7, + null, + [ + null, + 1 + ] + ]] + ], + [ + 676982961, + [ + [ + null, + 7, + null, + [ + null, + 0.4 + ] + ], + [ + 212, + null, + null, + [1] + ] + ] + ], + [ + 676982996, + [[ + null, + 7, + null, + [ + null, + 1 + ] + ]] + ] + ] + ], + [ + 10, + [ + [31063162], + [ + 31063163, + [[ + 359351145, + null, + null, + [1] + ]] + ] + ], + [ + 3, + [ + [ + 4, + null, + 15, + null, + null, + null, + null, + ['18190176,155953048'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['49944529'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['5441'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6177'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6782'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6581'] + ] + ] + ], + 40 + ] + ] + ], + [ + 3, + [ + [ + null, + [ + [44732730], + [44732731] + ] + ], + [ + null, + [ + [676982960], + [676982994], + [676982998] + ] + ], + [ + null, + [ + [676982975], + [676982980] + ] + ], + [ + null, + [[ + 1337, + [ + [ + 77, + null, + null, + [1] + ], + [ + 78, + null, + null, + [1] + ], + [ + 85, + null, + null, + [1] + ], + [ + 80, + null, + null, + [1] + ], + [ + 76, + null, + null, + [1] + ], + [ + 84, + null, + null, + [1] + ], + [ + 188, + null, + null, + [1] + ] + ] + ]] + ], + [ + 10, + [ + [21064365], + [ + 21064372, + [[ + null, + null, + null, + [ + null, + null, + null, + ['flash'] + ], + null, + 489 + ]] + ] + ], + null, + 15 + ], + [ + 10, + [ + [21068766], + [ + 21068767, + [[ + null, + 488, + null, + [ + null, + 0.1 + ] + ]] + ] + ], + null, + 42 + ], + [ + 1000, + [[ + 31060545, + [[ + null, + null, + 363931022, + [ + null, + null, + 'A0Bg2nddUj4Nw6FzsXudBXHZs1aAzIgO+UGzfJGkC1f4J56ghvJ6TCirjdt8BUwsK14sBBjWGmOY+QCTr2HrBQoAAACBeyJvcmlnaW4iOiJodHRwczovL3NlY3VyZXB1YmFkcy5nLmRvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiU3VicmVzb3VyY2VXZWJCdW5kbGVzIiwiZXhwaXJ5IjoxNjUyODMxOTk5LCJpc1RoaXJkUGFydHkiOnRydWV9' + ] + ]] + ]], + [ + 2, + [ + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(9\\d|\\d{3,})', + ['navigator.userAgent'] + ], + [ + 3, + [ + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + -1 + ], + [ + 7, + null, + null, + 1, + null, + 10 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 29 + ], + [ + 7, + null, + null, + 1, + null, + 50 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ] + ] + ] + ] + ], + [ + 1, + [ + [31062923], + [ + 31062924, + [[ + 144, + null, + null, + [1] + ]] + ] + ] + ], + [ + 10, + [ + [31063256], + [31063257] + ] + ], + [ + 10, + [ + [31063706], + [ + 31063707, + [[ + null, + 359346956, + null, + [ + null, + 1 + ] + ]] + ], + [ + 31063708, + [[ + null, + 359346956, + null, + [ + null, + 2 + ] + ]] + ] + ] + ], + [ + 500, + [ + [ + 31063709, + null, + [ + 4, + null, + 8, + null, + null, + null, + null, + ['top.frames.google_ads_top_frame'] + ] + ], + [ + 31063710, + [[ + 360245596, + null, + null, + [1] + ]], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['top.frames.google_ads_top_frame'] + ] + ] + ] + ], + [ + null, + [ + [ + 31063831, + null, + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + -1 + ], + [ + 7, + null, + null, + 1, + null, + 5 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ], + [ + 31063832, + null, + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 4 + ], + [ + 7, + null, + null, + 1, + null, + 10 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ] + ], + [ + 4, + null, + 3 + ] + ], + [ + 1, + [ + [31063874], + [ + 31063875, + [[ + null, + 357045128, + null, + [ + null, + 1 + ] + ]] + ], + [ + 31063876, + [[ + null, + 357045128, + null, + [ + null, + 2 + ] + ]] + ] + ] + ], + [ + null, + [ + [ + 31063890, + [[ + null, + 488, + null, + [ + null, + 0.1 + ] + ]] + ], + [ + 31063891, + [ + [ + 402905035, + null, + null, + [1] + ], + [ + null, + 488, + null, + [ + null, + 0.1 + ] + ] + ] + ] + ], + null, + 42 + ], + [ + 1, + [ + [31063916], + [ + 31063917, + [[ + null, + 413725046, + null, + [ + null, + 1 + ] + ]] + ] + ], + null, + 40 + ], + [ + 10, + [ + [31064020], + [ + 31064021, + [ + [ + null, + 385440135, + null, + [] + ], + [ + 378290973, + null, + null, + [1] + ] + ] + ], + [ + 31064022, + [ + [ + null, + 385440135, + null, + [ + null, + 1000 + ] + ], + [ + 378290973, + null, + null, + [1] + ] + ] + ], + [ + 31064023, + [ + [ + null, + 385440135, + null, + [ + null, + 1 + ] + ], + [ + 378290973, + null, + null, + [1] + ] + ] + ] + ] + ], + [ + 10, + [ + [44755845], + [ + 44755846, + [[ + null, + 387165532, + null, + [ + null, + 0.05 + ] + ]] + ] + ], + [ + 2, + [ + [ + 1, + [[ + 4, + null, + 63 + ]] + ], + [ + 4, + null, + 59, + null, + null, + null, + null, + [ + '3372044115', + '2902623493', + '1900948638', + '3922065694', + '1163038905', + '2299118599', + '528876146', + '1417165976' + ] + ] + ] + ] + ] + ] + ], + [ + 5, + [ + [ + 50, + [ + [ + 21062785, + null, + [ + 4, + null, + 8, + null, + null, + null, + null, + ['_gmptnl'] + ] + ], + [ + 21062786, + [[ + 23, + null, + null, + [1] + ]], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['_gmptnl'] + ] + ] + ], + [ + 12, + null, + null, + null, + 2, + null, + 'today\\.line\\.me/.+/(main|article)' + ], + 43 + ], + [ + 900, + [[ + 21062812, + [[ + 23, + null, + null, + [1] + ]], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['_gmptnl'] + ] + ]], + [ + 12, + null, + null, + null, + 2, + null, + 'today\\.line\\.me/.+/(main|article)' + ], + 43 + ], + [ + 50, + [ + [ + 21063916, + null, + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers._gmptnl'] + ] + ], + [ + 21063917, + [[ + 23, + null, + null, + [1] + ]], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers._gmptnl'] + ] + ] + ], + [ + 12, + null, + null, + null, + 2, + null, + 'today\\.line\\.me/.+/(main|article)' + ], + 44 + ], + [ + 900, + [[ + 21064113, + [[ + 23, + null, + null, + [1] + ]], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers._gmptnl'] + ] + ]], + [ + 12, + null, + null, + null, + 2, + null, + 'today\\.line\\.me/.+/(main|article)' + ], + 44 + ], + [ + 10, + [ + [31060437], + [ + 31060438, + [[ + 200, + null, + null, + [1] + ]] + ], + [ + 31060439, + [[ + 220, + null, + null, + [1] + ]] + ] + ], + null, + 24 + ], + [ + 10, + [ + [31060837], + [ + 31060838, + [ + [ + 368279556, + null, + null, + [1] + ], + [ + 366809413, + null, + null, + [1] + ] + ] + ] + ] + ], + [ + 150, + [ + [31061482], + [ + 31061483, + [ + [ + 360245597, + null, + null, + [1] + ], + [ + 45360254, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ], + [ + 31063012, + [ + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ], + [ + 31064123, + [ + [ + null, + null, + null, + [ + null, + null, + null, + ['scar'] + ], + null, + 489 + ], + [ + null, + 405881106, + null, + [ + null, + 1 + ] + ], + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ], + [ + 44753752, + [ + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ] + ], + [ + 3, + [ + [ + 4, + null, + 8, + null, + null, + null, + null, + ['gmaSdk.getQueryInfo'] + ], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers.getGmaQueryInfo.postMessage'] + ], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers.getGmaSig.postMessage'] + ] + ] + ], + 15 + ], + [ + 100, + [ + [31061814], + [ + 31061815, + [ + [ + 384734642, + null, + null, + [1] + ], + [ + null, + 529, + null, + [ + null, + 20 + ] + ] + ] + ] + ] + ], + [ + 50, + [ + [ + 31063011, + [ + [ + null, + null, + null, + [ + null, + null, + null, + ['scar'] + ], + null, + 489 + ], + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ], + [ + 31063841, + [ + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ], + [44753813] + ], + [ + 3, + [ + [ + 4, + null, + 8, + null, + null, + null, + null, + ['gmaSdk.getQueryInfo'] + ], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers.getGmaQueryInfo.postMessage'] + ], + [ + 4, + null, + 8, + null, + null, + null, + null, + ['webkit.messageHandlers.getGmaSig.postMessage'] + ] + ] + ], + 15 + ], + [ + 50, + [ + [31063377], + [ + 31063378, + [[ + 1958, + null, + null, + [1] + ]] + ] + ] + ], + [ + 50, + [ + [31063820], + [ + 31063821, + [[ + 410573952, + null, + null, + [1] + ]] + ] + ] + ], + [ + 50, + [ + [31063822], + [ + 31063823, + [ + [ + 402847016, + null, + null, + [1] + ], + [ + 1959, + null, + null, + [1] + ] + ] + ] + ] + ], + [ + 10, + [ + [31063870], + [ + 31063871, + [[ + 384700361, + null, + null, + [1] + ]] + ] + ] + ], + [ + 100, + [ + [31064026], + [ + 31064027, + [[ + 413925305, + null, + null, + [1] + ]] + ] + ] + ], + [ + 1000, + [ + [ + 31064136, + [ + [ + null, + 24, + null, + [ + null, + 31064136 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064136 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 2 + ] + ], + [ + 31064137, + [ + [ + null, + 24, + null, + [ + null, + 31064137 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064137 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 3 + ] + ], + [ + 31064138, + [ + [ + null, + 24, + null, + [ + null, + 31064138 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064138 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 4 + ] + ], + [ + 31064139, + [ + [ + null, + 24, + null, + [ + null, + 31064139 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064139 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 5 + ] + ], + [ + 31064140, + [ + [ + null, + 24, + null, + [ + null, + 31064140 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064140 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 6 + ] + ], + [ + 31064141, + [ + [ + null, + 24, + null, + [ + null, + 31064141 + ] + ], + [ + null, + 25, + null, + [ + null, + 31064141 + ] + ] + ], + [ + 6, + null, + null, + 4, + null, + 7 + ] + ] + ], + [ + 4, + null, + 3 + ], + 1 + ], + [ + 50, + [ + [44752540], + [ + 44752541, + [[ + 399544548, + null, + null, + [1] + ]] + ] + ] + ], + [ + 50, + [ + [44757100], + [ + 44757101, + [[ + 398776878, + null, + null, + [] + ]] + ] + ], + null, + 40 + ], + [ + 1000, + [ + [ + 31063223, + null, + [ + 3, + [ + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + -1 + ], + [ + 7, + null, + null, + 1, + null, + 3 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 29 + ], + [ + 7, + null, + null, + 1, + null, + 33 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 39 + ], + [ + 7, + null, + null, + 1, + null, + 43 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ] + ] + ], + [ + 31063224, + [[ + 1954, + null, + null, + [1] + ]], + [ + 3, + [ + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 2 + ], + [ + 7, + null, + null, + 1, + null, + 6 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 32 + ], + [ + 7, + null, + null, + 1, + null, + 36 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 42 + ], + [ + 7, + null, + null, + 1, + null, + 46 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ] + ] + ] + ] + ] + ] + ], + [ + 2, + [ + [ + 10, + [[31060888]] + ], + [ + 10, + [ + [31060889], + [31060890] + ], + null, + null, + null, + null, + null, + null, + null, + 104 + ], + [ + 10, + [ + [31061165], + [ + 31061166, + [[ + null, + 363650251, + null, + [ + null, + 2 + ] + ]] + ], + [ + 31061167, + [[ + null, + 363650251, + null, + [ + null, + 1 + ] + ]] + ] + ], + null, + null, + null, + null, + null, + 1, + null, + 102 + ], + [ + 10, + [ + [44742767], + [44742768] + ] + ], + [ + 10, + [ + [44752585], + [ + 44752586, + [[ + 392065905, + null, + null, + [1] + ]] + ] + ], + null, + 41 + ], + [ + 50, + [ + [44753506], + [ + 44753507, + [[ + 392065905, + null, + null, + [] + ]] + ] + ], + [ + 3, + [ + [ + 4, + null, + 15, + null, + null, + null, + null, + ['18190176,155953048'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['49944529'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['5441'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6177'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6782'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6581'] + ] + ] + ], + 41 + ], + [ + null, + [ + [44757045], + [ + 44757046, + [[ + 398776878, + null, + null, + [] + ]] + ] + ], + [ + 3, + [ + [ + 4, + null, + 15, + null, + null, + null, + null, + ['18190176,155953048'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['49944529'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['5441'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6177'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6782'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6581'] + ] + ] + ], + 40 + ], + [ + 1, + [ + [44757300], + [ + 44757301, + [ + [ + 398776878, + null, + null, + [] + ], + [ + 391385505, + null, + null, + [1] + ] + ] + ] + ], + [ + 1, + [[ + 3, + [ + [ + 4, + null, + 15, + null, + null, + null, + null, + ['18190176,155953048'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['49944529'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['5441'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6177'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6782'] + ], + [ + 4, + null, + 15, + null, + null, + null, + null, + ['6581'] + ] + ] + ]] + ], + 40 + ] + ] + ], + [ + 12, + [ + [ + 1, + [ + [31061828], + [ + 31061829, + [ + [ + null, + 1032, + null, + [ + null, + 200 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 500 + ] + ]] + ], + [ + 360245597, + null, + null, + [1] + ], + [ + null, + 494, + null, + [ + null, + 5000 + ], + [[ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + null, + 5500 + ] + ]] + ], + [ + null, + 517, + null, + [ + null, + 1 + ] + ] + ] + ] + ], + null, + 15 + ], + [ + 20, + [ + [21065724], + [ + 21065725, + [[ + 203, + null, + null, + [1] + ]] + ] + ], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['LayoutShift'] + ] + ], + [ + 50, + [ + [ + 31060006, + null, + [ + 2, + [ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(89|9\\d|\\d{3,})', + ['navigator.userAgent'] + ], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['window.PeriodicSyncManager'] + ] + ] + ] + ], + [ + 31060007, + [[ + 1928, + null, + null, + [1] + ]], + [ + 2, + [ + [ + 12, + null, + null, + null, + 4, + null, + 'Android', + ['navigator.userAgent'] + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(89|9\\d|\\d{3,})', + ['navigator.userAgent'] + ], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['window.PeriodicSyncManager'] + ] + ] + ] + ] + ], + null, + 21 + ], + [ + 10, + [ + [31060032], + [ + 31060033, + [[ + 1928, + null, + null, + [1] + ]] + ] + ], + null, + 21 + ], + [ + 10, + [ + [31061690], + [ + 31061691, + [ + [ + 83, + null, + null, + [1] + ], + [ + 84, + null, + null, + [1] + ] + ] + ] + ] + ], + [ + 1, + [ + [31063244], + [ + 31063245, + [[ + 392736476, + null, + null, + [1] + ]] + ] + ], + null, + 45 + ], + [ + 50, + [ + [31063246], + [ + 31063247, + [ + [ + 392736476, + null, + null, + [1] + ], + [ + null, + 406149835, + null, + [ + null, + 0.01 + ] + ] + ] + ] + ], + [ + 2, + [ + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(9[3456789]|\\d{3,})', + ['navigator.userAgent'] + ], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['window.PeriodicSyncManager'] + ] + ] + ], + 45 + ], + [ + 10, + [ + [31063910], + [ + 31063911, + [[ + 1948, + null, + null, + [] + ]] + ] + ] + ] + ] + ], + [ + 9, + [[ + 1000, + [[31063049]], + [ + 4, + null, + 13, + null, + null, + null, + null, + ['cxbbhbxm'] + ] + ]] + ], + [ + 6, + [[ + 1000, + [ + [ + 31063877, + null, + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + -1 + ], + [ + 7, + null, + null, + 1, + null, + 10 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ], + [ + 31063878, + [[ + 501, + null, + null, + [1] + ]], + [ + 2, + [ + [ + 2, + [ + [ + 8, + null, + null, + 1, + null, + 29 + ], + [ + 7, + null, + null, + 1, + null, + 40 + ] + ] + ], + [ + 4, + null, + 3 + ] + ] + ] + ] + ], + [ + 2, + [ + [ + 4, + null, + 53 + ], + [ + 12, + null, + null, + null, + 4, + null, + 'Chrome/(9[23456789]|\\d{3,})', + ['navigator.userAgent'] + ], + [ + 1, + [[ + 4, + null, + 8, + null, + null, + null, + null, + ['navigator.serviceWorker.controller'] + ]] + ], + [ + 4, + null, + 9, + null, + null, + null, + null, + ['document.head.appendChild'] + ] + ] + ] + ]] + ] + ], + null, + null, + [ + 0.001, + 1000, + 1, + 1000 + ] + ])); + }()) +} \ No newline at end of file